-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: extract multi-select-combo-box styles into CSS literals (#8182
- Loading branch information
1 parent
e6afb4a
commit 0435e94
Showing
4 changed files
with
91 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
packages/multi-select-combo-box/src/vaadin-multi-select-combo-box-styles.d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/** | ||
* @license | ||
* Copyright (c) 2021 - 2024 Vaadin Ltd. | ||
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/ | ||
*/ | ||
import type { CSSResult } from 'lit'; | ||
|
||
export const multiSelectComboBox: CSSResult; | ||
|
||
export const multiSelectComboBoxChip: CSSResult; |
73 changes: 73 additions & 0 deletions
73
packages/multi-select-combo-box/src/vaadin-multi-select-combo-box-styles.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
/** | ||
* @license | ||
* Copyright (c) 2021 - 2024 Vaadin Ltd. | ||
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/ | ||
*/ | ||
import { css } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js'; | ||
|
||
export const multiSelectComboBox = css` | ||
:host { | ||
--input-min-width: var(--vaadin-multi-select-combo-box-input-min-width, 4em); | ||
--_chip-min-width: var(--vaadin-multi-select-combo-box-chip-min-width, 50px); | ||
} | ||
#chips { | ||
display: flex; | ||
align-items: center; | ||
} | ||
::slotted(input) { | ||
box-sizing: border-box; | ||
flex: 1 0 var(--input-min-width); | ||
} | ||
::slotted([slot='chip']), | ||
::slotted([slot='overflow']) { | ||
flex: 0 1 auto; | ||
} | ||
::slotted([slot='chip']) { | ||
overflow: hidden; | ||
} | ||
:host(:is([readonly], [disabled])) ::slotted(input) { | ||
flex-grow: 0; | ||
flex-basis: 0; | ||
padding: 0; | ||
} | ||
:host([auto-expand-vertically]) #chips { | ||
display: contents; | ||
} | ||
:host([auto-expand-horizontally]) [class$='container'] { | ||
width: auto; | ||
} | ||
`; | ||
|
||
export const multiSelectComboBoxChip = css` | ||
:host { | ||
display: inline-flex; | ||
align-items: center; | ||
align-self: center; | ||
white-space: nowrap; | ||
box-sizing: border-box; | ||
} | ||
[part='label'] { | ||
overflow: hidden; | ||
text-overflow: ellipsis; | ||
} | ||
:host([hidden]), | ||
:host(:is([readonly], [disabled], [slot='overflow'])) [part='remove-button'] { | ||
display: none !important; | ||
} | ||
@media (forced-colors: active) { | ||
:host { | ||
outline: 1px solid; | ||
outline-offset: -1px; | ||
} | ||
} | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters