@vaadin/multi-select-combo-box 23.3.0-alpha5 → 24.0.0-alpha2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +10 -10
- package/src/vaadin-multi-select-combo-box-chip.js +2 -1
- package/src/vaadin-multi-select-combo-box.d.ts +1 -5
- package/src/vaadin-multi-select-combo-box.js +52 -63
- package/theme/lumo/vaadin-multi-select-combo-box-chip-styles.js +12 -20
- package/theme/lumo/vaadin-multi-select-combo-box-styles.js +19 -3
- package/theme/material/vaadin-multi-select-combo-box-chip-styles.js +12 -15
- package/theme/material/vaadin-multi-select-combo-box-styles.js +10 -0
- package/web-types.json +2 -2
- package/web-types.lit.json +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/multi-select-combo-box",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "24.0.0-alpha2",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -37,14 +37,14 @@
|
|
|
37
37
|
],
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@polymer/polymer": "^3.0.0",
|
|
40
|
-
"@vaadin/combo-box": "
|
|
41
|
-
"@vaadin/component-base": "
|
|
42
|
-
"@vaadin/field-base": "
|
|
43
|
-
"@vaadin/input-container": "
|
|
44
|
-
"@vaadin/lit-renderer": "
|
|
45
|
-
"@vaadin/vaadin-lumo-styles": "
|
|
46
|
-
"@vaadin/vaadin-material-styles": "
|
|
47
|
-
"@vaadin/vaadin-themable-mixin": "
|
|
40
|
+
"@vaadin/combo-box": "24.0.0-alpha2",
|
|
41
|
+
"@vaadin/component-base": "24.0.0-alpha2",
|
|
42
|
+
"@vaadin/field-base": "24.0.0-alpha2",
|
|
43
|
+
"@vaadin/input-container": "24.0.0-alpha2",
|
|
44
|
+
"@vaadin/lit-renderer": "24.0.0-alpha2",
|
|
45
|
+
"@vaadin/vaadin-lumo-styles": "24.0.0-alpha2",
|
|
46
|
+
"@vaadin/vaadin-material-styles": "24.0.0-alpha2",
|
|
47
|
+
"@vaadin/vaadin-themable-mixin": "24.0.0-alpha2"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@esm-bundle/chai": "^4.3.4",
|
|
@@ -56,5 +56,5 @@
|
|
|
56
56
|
"web-types.json",
|
|
57
57
|
"web-types.lit.json"
|
|
58
58
|
],
|
|
59
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "0c16c01a6807e629a84f5a982793afecc1a7ced0"
|
|
60
60
|
}
|
|
@@ -66,7 +66,8 @@ class MultiSelectComboBoxChip extends ThemableMixin(PolymerElement) {
|
|
|
66
66
|
text-overflow: ellipsis;
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
:host(
|
|
69
|
+
:host([hidden]),
|
|
70
|
+
:host(:is([readonly], [disabled], [slot='overflow'])) [part='remove-button'] {
|
|
70
71
|
display: none !important;
|
|
71
72
|
}
|
|
72
73
|
</style>
|
|
@@ -106,17 +106,13 @@ export interface MultiSelectComboBoxEventMap<TItem> extends HTMLElementEventMap
|
|
|
106
106
|
*
|
|
107
107
|
* Part name | Description
|
|
108
108
|
* -----------------------|----------------
|
|
109
|
-
* `chips` | The element that wraps chips for selected items
|
|
110
|
-
* `chip` | Chip shown for every selected item
|
|
109
|
+
* `chips` | The element that wraps slotted chips for selected items
|
|
111
110
|
* `label` | The label element
|
|
112
111
|
* `input-field` | The element that wraps prefix, value and suffix
|
|
113
112
|
* `clear-button` | The clear button
|
|
114
113
|
* `error-message` | The error message element
|
|
115
114
|
* `helper-text` | The helper text element wrapper
|
|
116
115
|
* `required-indicator` | The `required` state indicator element
|
|
117
|
-
* `overflow` | The chip shown when component width is not enough to fit all chips
|
|
118
|
-
* `overflow-one` | Set on the overflow chip when only one chip does not fit
|
|
119
|
-
* `overflow-two` | Set on the overflow chip when two chips do not fit
|
|
120
116
|
* `toggle-button` | The toggle button
|
|
121
117
|
*
|
|
122
118
|
* The following state attributes are available for styling:
|
|
@@ -10,6 +10,7 @@ import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
|
|
|
10
10
|
import { announce } from '@vaadin/component-base/src/a11y-announcer.js';
|
|
11
11
|
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
|
|
12
12
|
import { ResizeMixin } from '@vaadin/component-base/src/resize-mixin.js';
|
|
13
|
+
import { SlotController } from '@vaadin/component-base/src/slot-controller.js';
|
|
13
14
|
import { processTemplates } from '@vaadin/component-base/src/templates.js';
|
|
14
15
|
import { TooltipController } from '@vaadin/component-base/src/tooltip-controller.js';
|
|
15
16
|
import { InputControlMixin } from '@vaadin/field-base/src/input-control-mixin.js';
|
|
@@ -23,10 +24,6 @@ const multiSelectComboBox = css`
|
|
|
23
24
|
--input-min-width: var(--vaadin-multi-select-combo-box-input-min-width, 4em);
|
|
24
25
|
}
|
|
25
26
|
|
|
26
|
-
[hidden] {
|
|
27
|
-
display: none !important;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
27
|
#chips {
|
|
31
28
|
display: flex;
|
|
32
29
|
align-items: center;
|
|
@@ -37,7 +34,8 @@ const multiSelectComboBox = css`
|
|
|
37
34
|
flex: 1 0 var(--input-min-width);
|
|
38
35
|
}
|
|
39
36
|
|
|
40
|
-
[
|
|
37
|
+
::slotted([slot='chip']),
|
|
38
|
+
::slotted([slot='overflow']) {
|
|
41
39
|
flex: 0 1 auto;
|
|
42
40
|
}
|
|
43
41
|
|
|
@@ -72,17 +70,13 @@ registerStyles('vaadin-multi-select-combo-box', [inputFieldShared, multiSelectCo
|
|
|
72
70
|
*
|
|
73
71
|
* Part name | Description
|
|
74
72
|
* -----------------------|----------------
|
|
75
|
-
* `chips` | The element that wraps chips for selected items
|
|
76
|
-
* `chip` | Chip shown for every selected item
|
|
73
|
+
* `chips` | The element that wraps slotted chips for selected items
|
|
77
74
|
* `label` | The label element
|
|
78
75
|
* `input-field` | The element that wraps prefix, value and suffix
|
|
79
76
|
* `clear-button` | The clear button
|
|
80
77
|
* `error-message` | The error message element
|
|
81
78
|
* `helper-text` | The helper text element wrapper
|
|
82
79
|
* `required-indicator` | The `required` state indicator element
|
|
83
|
-
* `overflow` | The chip shown when component width is not enough to fit all chips
|
|
84
|
-
* `overflow-one` | Set on the overflow chip when only one chip does not fit
|
|
85
|
-
* `overflow-two` | Set on the overflow chip when two chips do not fit
|
|
86
80
|
* `toggle-button` | The toggle button
|
|
87
81
|
*
|
|
88
82
|
* The following state attributes are available for styling:
|
|
@@ -182,18 +176,10 @@ class MultiSelectComboBox extends ResizeMixin(InputControlMixin(ThemableMixin(El
|
|
|
182
176
|
invalid="[[invalid]]"
|
|
183
177
|
theme$="[[_theme]]"
|
|
184
178
|
>
|
|
185
|
-
<
|
|
186
|
-
|
|
187
|
-
slot="
|
|
188
|
-
|
|
189
|
-
disabled="[[disabled]]"
|
|
190
|
-
readonly="[[readonly]]"
|
|
191
|
-
label="[[_getOverflowLabel(_overflowItems.length)]]"
|
|
192
|
-
title$="[[_getOverflowTitle(_overflowItems)]]"
|
|
193
|
-
hidden$="[[_isOverflowHidden(_overflowItems.length)]]"
|
|
194
|
-
on-mousedown="_preventBlur"
|
|
195
|
-
></vaadin-multi-select-combo-box-chip>
|
|
196
|
-
<div id="chips" part="chips" slot="prefix"></div>
|
|
179
|
+
<slot name="overflow" slot="prefix"></slot>
|
|
180
|
+
<div id="chips" part="chips" slot="prefix">
|
|
181
|
+
<slot name="chip"></slot>
|
|
182
|
+
</div>
|
|
197
183
|
<slot name="input"></slot>
|
|
198
184
|
<div
|
|
199
185
|
id="clearButton"
|
|
@@ -469,7 +455,10 @@ class MultiSelectComboBox extends ResizeMixin(InputControlMixin(ThemableMixin(El
|
|
|
469
455
|
}
|
|
470
456
|
|
|
471
457
|
static get observers() {
|
|
472
|
-
return [
|
|
458
|
+
return [
|
|
459
|
+
'_selectedItemsChanged(selectedItems, selectedItems.*)',
|
|
460
|
+
'__updateOverflowChip(_overflow, _overflowItems, disabled, readonly)',
|
|
461
|
+
];
|
|
473
462
|
}
|
|
474
463
|
|
|
475
464
|
/** @protected */
|
|
@@ -496,7 +485,7 @@ class MultiSelectComboBox extends ResizeMixin(InputControlMixin(ThemableMixin(El
|
|
|
496
485
|
|
|
497
486
|
/** @protected */
|
|
498
487
|
get _chips() {
|
|
499
|
-
return this.
|
|
488
|
+
return [...this.querySelectorAll('[slot="chip"]')];
|
|
500
489
|
}
|
|
501
490
|
|
|
502
491
|
/** @protected */
|
|
@@ -519,6 +508,18 @@ class MultiSelectComboBox extends ResizeMixin(InputControlMixin(ThemableMixin(El
|
|
|
519
508
|
this._tooltipController.setShouldShow((target) => !target.opened);
|
|
520
509
|
|
|
521
510
|
this._inputField = this.shadowRoot.querySelector('[part="input-field"]');
|
|
511
|
+
|
|
512
|
+
this._overflowController = new SlotController(
|
|
513
|
+
this,
|
|
514
|
+
'overflow',
|
|
515
|
+
() => document.createElement('vaadin-multi-select-combo-box-chip'),
|
|
516
|
+
(_, chip) => {
|
|
517
|
+
chip.addEventListener('mousedown', (e) => this._preventBlur(e));
|
|
518
|
+
this._overflow = chip;
|
|
519
|
+
},
|
|
520
|
+
);
|
|
521
|
+
this.addController(this._overflowController);
|
|
522
|
+
|
|
522
523
|
this.__updateChips();
|
|
523
524
|
|
|
524
525
|
processTemplates(this);
|
|
@@ -716,34 +717,6 @@ class MultiSelectComboBox extends ResizeMixin(InputControlMixin(ThemableMixin(El
|
|
|
716
717
|
return this.$.comboBox._getItemLabel(item);
|
|
717
718
|
}
|
|
718
719
|
|
|
719
|
-
/** @private */
|
|
720
|
-
_getOverflowLabel(length) {
|
|
721
|
-
return length;
|
|
722
|
-
}
|
|
723
|
-
|
|
724
|
-
/** @private */
|
|
725
|
-
_getOverflowPart(length) {
|
|
726
|
-
let part = `chip overflow`;
|
|
727
|
-
|
|
728
|
-
if (length === 1) {
|
|
729
|
-
part += ' overflow-one';
|
|
730
|
-
} else if (length === 2) {
|
|
731
|
-
part += ' overflow-two';
|
|
732
|
-
}
|
|
733
|
-
|
|
734
|
-
return part;
|
|
735
|
-
}
|
|
736
|
-
|
|
737
|
-
/** @private */
|
|
738
|
-
_getOverflowTitle(items) {
|
|
739
|
-
return this._mergeItemLabels(items);
|
|
740
|
-
}
|
|
741
|
-
|
|
742
|
-
/** @private */
|
|
743
|
-
_isOverflowHidden(length) {
|
|
744
|
-
return length === 0;
|
|
745
|
-
}
|
|
746
|
-
|
|
747
720
|
/** @private */
|
|
748
721
|
_mergeItemLabels(items) {
|
|
749
722
|
return items.map((item) => this._getItemLabel(item)).join(', ');
|
|
@@ -828,8 +801,7 @@ class MultiSelectComboBox extends ResizeMixin(InputControlMixin(ThemableMixin(El
|
|
|
828
801
|
/** @private */
|
|
829
802
|
__createChip(item) {
|
|
830
803
|
const chip = document.createElement('vaadin-multi-select-combo-box-chip');
|
|
831
|
-
chip.setAttribute('
|
|
832
|
-
chip.setAttribute('slot', 'prefix');
|
|
804
|
+
chip.setAttribute('slot', 'chip');
|
|
833
805
|
|
|
834
806
|
chip.item = item;
|
|
835
807
|
chip.disabled = this.disabled;
|
|
@@ -847,16 +819,20 @@ class MultiSelectComboBox extends ResizeMixin(InputControlMixin(ThemableMixin(El
|
|
|
847
819
|
|
|
848
820
|
/** @private */
|
|
849
821
|
__getOverflowWidth() {
|
|
850
|
-
const chip = this
|
|
822
|
+
const chip = this._overflow;
|
|
851
823
|
|
|
852
824
|
chip.style.visibility = 'hidden';
|
|
853
825
|
chip.removeAttribute('hidden');
|
|
854
826
|
|
|
827
|
+
const count = chip.getAttribute('count');
|
|
828
|
+
|
|
855
829
|
// Detect max possible width of the overflow chip
|
|
856
|
-
|
|
830
|
+
// by measuring it with widest number (2 digits)
|
|
831
|
+
chip.setAttribute('count', '99');
|
|
857
832
|
const overflowStyle = getComputedStyle(chip);
|
|
858
833
|
const overflowWidth = chip.clientWidth + parseInt(overflowStyle.marginInlineStart);
|
|
859
834
|
|
|
835
|
+
chip.setAttribute('count', count);
|
|
860
836
|
chip.setAttribute('hidden', '');
|
|
861
837
|
chip.style.visibility = '';
|
|
862
838
|
|
|
@@ -870,10 +846,8 @@ class MultiSelectComboBox extends ResizeMixin(InputControlMixin(ThemableMixin(El
|
|
|
870
846
|
}
|
|
871
847
|
|
|
872
848
|
// Clear all chips except the overflow
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
chip.remove();
|
|
876
|
-
}
|
|
849
|
+
this._chips.forEach((chip) => {
|
|
850
|
+
chip.remove();
|
|
877
851
|
});
|
|
878
852
|
|
|
879
853
|
const items = [...this.selectedItems];
|
|
@@ -891,7 +865,7 @@ class MultiSelectComboBox extends ResizeMixin(InputControlMixin(ThemableMixin(El
|
|
|
891
865
|
// Add chips until remaining width is exceeded
|
|
892
866
|
for (let i = items.length - 1, refNode = null; i >= 0; i--) {
|
|
893
867
|
const chip = this.__createChip(items[i]);
|
|
894
|
-
this
|
|
868
|
+
this.insertBefore(chip, refNode);
|
|
895
869
|
|
|
896
870
|
if (this.$.chips.clientWidth > remainingWidth) {
|
|
897
871
|
chip.remove();
|
|
@@ -905,6 +879,21 @@ class MultiSelectComboBox extends ResizeMixin(InputControlMixin(ThemableMixin(El
|
|
|
905
879
|
this._overflowItems = items;
|
|
906
880
|
}
|
|
907
881
|
|
|
882
|
+
/** @private */
|
|
883
|
+
__updateOverflowChip(overflow, items, disabled, readonly) {
|
|
884
|
+
if (overflow) {
|
|
885
|
+
const count = items.length;
|
|
886
|
+
|
|
887
|
+
overflow.label = `${count}`;
|
|
888
|
+
overflow.setAttribute('count', `${count}`);
|
|
889
|
+
overflow.setAttribute('title', this._mergeItemLabels(items));
|
|
890
|
+
overflow.toggleAttribute('hidden', count === 0);
|
|
891
|
+
|
|
892
|
+
overflow.disabled = disabled;
|
|
893
|
+
overflow.readonly = readonly;
|
|
894
|
+
}
|
|
895
|
+
}
|
|
896
|
+
|
|
908
897
|
/** @private */
|
|
909
898
|
_onClearButtonTouchend(event) {
|
|
910
899
|
// Cancel the following click and focus events
|
|
@@ -961,7 +950,7 @@ class MultiSelectComboBox extends ResizeMixin(InputControlMixin(ThemableMixin(El
|
|
|
961
950
|
_onKeyDown(event) {
|
|
962
951
|
super._onKeyDown(event);
|
|
963
952
|
|
|
964
|
-
const chips =
|
|
953
|
+
const chips = this._chips;
|
|
965
954
|
|
|
966
955
|
if (!this.readonly && chips.length > 0) {
|
|
967
956
|
switch (event.key) {
|
|
@@ -1065,7 +1054,7 @@ class MultiSelectComboBox extends ResizeMixin(InputControlMixin(ThemableMixin(El
|
|
|
1065
1054
|
/** @private */
|
|
1066
1055
|
_focusedChipIndexChanged(focusedIndex, oldFocusedIndex) {
|
|
1067
1056
|
if (focusedIndex > -1 || oldFocusedIndex > -1) {
|
|
1068
|
-
const chips =
|
|
1057
|
+
const chips = this._chips;
|
|
1069
1058
|
chips.forEach((chip, index) => {
|
|
1070
1059
|
chip.toggleAttribute('focused', index === focusedIndex);
|
|
1071
1060
|
});
|
|
@@ -15,34 +15,26 @@ const chip = css`
|
|
|
15
15
|
:host {
|
|
16
16
|
font-size: var(--lumo-font-size-xxs);
|
|
17
17
|
line-height: 1;
|
|
18
|
-
padding: 0.3125em calc(0.5em + var(--lumo-border-radius-s) / 4);
|
|
19
18
|
color: var(--lumo-body-text-color);
|
|
20
19
|
border-radius: var(--lumo-border-radius-s);
|
|
21
20
|
background-color: var(--lumo-contrast-20pct);
|
|
22
21
|
cursor: var(--lumo-clickable-cursor);
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
:host([focused]) {
|
|
26
|
-
background-color: var(--lumo-primary-color);
|
|
27
|
-
color: var(--lumo-primary-contrast-color);
|
|
22
|
+
-webkit-font-smoothing: antialiased;
|
|
23
|
+
-moz-osx-font-smoothing: grayscale;
|
|
28
24
|
}
|
|
29
25
|
|
|
30
26
|
:host([focused]) [part='remove-button'] {
|
|
31
27
|
color: inherit;
|
|
32
28
|
}
|
|
33
29
|
|
|
34
|
-
:host(
|
|
35
|
-
padding-inline-end: 0;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
:host([part~='overflow']) {
|
|
30
|
+
:host([slot='overflow']) {
|
|
39
31
|
position: relative;
|
|
40
32
|
min-width: var(--lumo-size-xxs);
|
|
41
33
|
margin-inline-start: var(--lumo-space-s);
|
|
42
34
|
}
|
|
43
35
|
|
|
44
|
-
:host([
|
|
45
|
-
:host([
|
|
36
|
+
:host([slot='overflow'])::before,
|
|
37
|
+
:host([slot='overflow'])::after {
|
|
46
38
|
position: absolute;
|
|
47
39
|
content: '';
|
|
48
40
|
width: 100%;
|
|
@@ -52,28 +44,28 @@ const chip = css`
|
|
|
52
44
|
border-color: var(--lumo-contrast-30pct);
|
|
53
45
|
}
|
|
54
46
|
|
|
55
|
-
:host([
|
|
47
|
+
:host([slot='overflow'])::before {
|
|
56
48
|
left: calc(-1 * var(--lumo-space-s) / 2);
|
|
57
49
|
}
|
|
58
50
|
|
|
59
|
-
:host([
|
|
51
|
+
:host([slot='overflow'])::after {
|
|
60
52
|
left: calc(-1 * var(--lumo-space-s));
|
|
61
53
|
}
|
|
62
54
|
|
|
63
|
-
:host([
|
|
55
|
+
:host([count='2']) {
|
|
64
56
|
margin-inline-start: calc(var(--lumo-space-s) / 2);
|
|
65
57
|
}
|
|
66
58
|
|
|
67
|
-
:host([
|
|
59
|
+
:host([count='2'])::after {
|
|
68
60
|
display: none;
|
|
69
61
|
}
|
|
70
62
|
|
|
71
|
-
:host([
|
|
63
|
+
:host([count='1']) {
|
|
72
64
|
margin-inline-start: 0;
|
|
73
65
|
}
|
|
74
66
|
|
|
75
|
-
:host([
|
|
76
|
-
:host([
|
|
67
|
+
:host([count='1'])::before,
|
|
68
|
+
:host([count='1'])::after {
|
|
77
69
|
display: none;
|
|
78
70
|
}
|
|
79
71
|
|
|
@@ -34,12 +34,28 @@ const multiSelectComboBox = css`
|
|
|
34
34
|
caret-color: var(--lumo-body-text-color) !important;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
/* Override input-container styles */
|
|
38
|
+
::slotted([slot='chip']),
|
|
39
|
+
::slotted([slot='overflow']) {
|
|
40
|
+
min-height: auto;
|
|
41
|
+
padding: 0.3125em calc(0.5em + var(--lumo-border-radius-s) / 4);
|
|
42
|
+
color: var(--lumo-body-text-color);
|
|
43
|
+
-webkit-mask-image: none;
|
|
44
|
+
mask-image: none;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
::slotted([slot='chip']:not([readonly]):not([disabled])) {
|
|
48
|
+
padding-inline-end: 0;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
::slotted([slot='chip']:not(:last-of-type)),
|
|
52
|
+
::slotted([slot='overflow']:not(:last-of-type)) {
|
|
38
53
|
margin-inline-end: var(--lumo-space-xs);
|
|
39
54
|
}
|
|
40
55
|
|
|
41
|
-
[
|
|
42
|
-
|
|
56
|
+
::slotted([slot='chip'][focused]) {
|
|
57
|
+
background-color: var(--lumo-primary-color);
|
|
58
|
+
color: var(--lumo-primary-contrast-color);
|
|
43
59
|
}
|
|
44
60
|
|
|
45
61
|
[part='toggle-button']::before {
|
|
@@ -13,28 +13,25 @@ const chip = css`
|
|
|
13
13
|
:host {
|
|
14
14
|
height: 1.25rem;
|
|
15
15
|
margin-inline-end: 0.25rem;
|
|
16
|
-
padding: 0 0.5rem;
|
|
17
16
|
border-radius: 4px;
|
|
18
17
|
background-color: rgba(0, 0, 0, 0.08);
|
|
19
18
|
cursor: default;
|
|
20
19
|
font-family: var(--material-font-family);
|
|
20
|
+
-webkit-font-smoothing: antialiased;
|
|
21
|
+
-moz-osx-font-smoothing: grayscale;
|
|
21
22
|
}
|
|
22
23
|
|
|
23
24
|
:host([focused]) {
|
|
24
25
|
background-color: rgba(0, 0, 0, 0.16);
|
|
25
26
|
}
|
|
26
27
|
|
|
27
|
-
:host(
|
|
28
|
-
padding-inline-end: 0;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
:host([part~='overflow']) {
|
|
28
|
+
:host([slot='overflow']) {
|
|
32
29
|
position: relative;
|
|
33
30
|
margin-inline-start: 0.5rem;
|
|
34
31
|
}
|
|
35
32
|
|
|
36
|
-
:host([
|
|
37
|
-
:host([
|
|
33
|
+
:host([slot='overflow'])::before,
|
|
34
|
+
:host([slot='overflow'])::after {
|
|
38
35
|
position: absolute;
|
|
39
36
|
content: '';
|
|
40
37
|
width: 100%;
|
|
@@ -44,28 +41,28 @@ const chip = css`
|
|
|
44
41
|
border-color: rgba(0, 0, 0, 0.08);
|
|
45
42
|
}
|
|
46
43
|
|
|
47
|
-
:host([
|
|
44
|
+
:host([slot='overflow'])::before {
|
|
48
45
|
left: -0.25rem;
|
|
49
46
|
}
|
|
50
47
|
|
|
51
|
-
:host([
|
|
48
|
+
:host([slot='overflow'])::after {
|
|
52
49
|
left: -0.5rem;
|
|
53
50
|
}
|
|
54
51
|
|
|
55
|
-
:host([
|
|
52
|
+
:host([count='2']) {
|
|
56
53
|
margin-inline-start: 0.25rem;
|
|
57
54
|
}
|
|
58
55
|
|
|
59
|
-
:host([
|
|
56
|
+
:host([count='2'])::after {
|
|
60
57
|
display: none;
|
|
61
58
|
}
|
|
62
59
|
|
|
63
|
-
:host([
|
|
60
|
+
:host([count='1']) {
|
|
64
61
|
margin-inline-start: 0;
|
|
65
62
|
}
|
|
66
63
|
|
|
67
|
-
:host([
|
|
68
|
-
:host([
|
|
64
|
+
:host([count='1'])::before,
|
|
65
|
+
:host([count='1'])::after {
|
|
69
66
|
display: none;
|
|
70
67
|
}
|
|
71
68
|
|
|
@@ -29,6 +29,16 @@ const multiSelectComboBox = css`
|
|
|
29
29
|
caret-color: var(--material-body-text-color) !important;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
+
/* Override input-container styles */
|
|
33
|
+
::slotted([slot='chip']),
|
|
34
|
+
::slotted([slot='overflow']) {
|
|
35
|
+
padding: 0 0.5rem;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
::slotted([slot='chip']:not([readonly]):not([disabled])) {
|
|
39
|
+
padding-inline-end: 0;
|
|
40
|
+
}
|
|
41
|
+
|
|
32
42
|
[part='input-field'] {
|
|
33
43
|
height: auto;
|
|
34
44
|
min-height: 32px;
|
package/web-types.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/web-types",
|
|
3
3
|
"name": "@vaadin/multi-select-combo-box",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "24.0.0-alpha2",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"contributions": {
|
|
7
7
|
"html": {
|
|
8
8
|
"elements": [
|
|
9
9
|
{
|
|
10
10
|
"name": "vaadin-multi-select-combo-box",
|
|
11
|
-
"description": "`<vaadin-multi-select-combo-box>` is a web component that wraps `<vaadin-combo-box>` and extends\nits functionality to allow selecting multiple items, in addition to basic features.\n\n```html\n<vaadin-multi-select-combo-box id=\"comboBox\"></vaadin-multi-select-combo-box>\n```\n```js\nconst comboBox = document.querySelector('#comboBox');\ncomboBox.items = ['apple', 'banana', 'lemon', 'orange'];\ncomboBox.selectedItems = ['lemon', 'orange'];\n```\n\n### Styling\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n-----------------------|----------------\n`chips` | The element that wraps chips for selected items\n`
|
|
11
|
+
"description": "`<vaadin-multi-select-combo-box>` is a web component that wraps `<vaadin-combo-box>` and extends\nits functionality to allow selecting multiple items, in addition to basic features.\n\n```html\n<vaadin-multi-select-combo-box id=\"comboBox\"></vaadin-multi-select-combo-box>\n```\n```js\nconst comboBox = document.querySelector('#comboBox');\ncomboBox.items = ['apple', 'banana', 'lemon', 'orange'];\ncomboBox.selectedItems = ['lemon', 'orange'];\n```\n\n### Styling\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n-----------------------|----------------\n`chips` | The element that wraps slotted chips for selected items\n`label` | The label element\n`input-field` | The element that wraps prefix, value and suffix\n`clear-button` | The clear button\n`error-message` | The error message element\n`helper-text` | The helper text element wrapper\n`required-indicator` | The `required` state indicator element\n`toggle-button` | The toggle button\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n-----------------------|-----------------\n`disabled` | Set to a disabled element\n`has-value` | Set when the element has a value\n`has-label` | Set when the element has a label\n`has-helper` | Set when the element has helper text or slot\n`has-error-message` | Set when the element has an error message\n`invalid` | Set when the element is invalid\n`focused` | Set when the element is focused\n`focus-ring` | Set when the element is keyboard focused\n`loading` | Set when loading items from the data provider\n`opened` | Set when the dropdown is open\n`readonly` | Set to a readonly element\n\nThe following custom CSS properties are available for styling:\n\nCustom property | Description | Default\n-----------------------------------------------------|----------------------------|--------\n`--vaadin-field-default-width` | Default width of the field | `12em`\n`--vaadin-multi-select-combo-box-overlay-width` | Width of the overlay | `auto`\n`--vaadin-multi-select-combo-box-overlay-max-height` | Max height of the overlay | `65vh`\n`--vaadin-multi-select-combo-box-input-min-width` | Min width of the input | `4em`\n\n### Internal components\n\nIn addition to `<vaadin-multi-select-combo-box>` itself, the following internal\ncomponents are themable:\n\n- `<vaadin-multi-select-combo-box-overlay>` - has the same API as `<vaadin-overlay>`.\n- `<vaadin-multi-select-combo-box-item>` - has the same API as `<vaadin-item>`.\n- `<vaadin-multi-select-combo-box-container>` - has the same API as `<vaadin-input-container>`.\n\nNote: the `theme` attribute value set on `<vaadin-multi-select-combo-box>` is\npropagated to these components.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/custom-theme/styling-components) documentation.",
|
|
12
12
|
"attributes": [
|
|
13
13
|
{
|
|
14
14
|
"name": "disabled",
|
package/web-types.lit.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/web-types",
|
|
3
3
|
"name": "@vaadin/multi-select-combo-box",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "24.0.0-alpha2",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"framework": "lit",
|
|
7
7
|
"framework-config": {
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"elements": [
|
|
17
17
|
{
|
|
18
18
|
"name": "vaadin-multi-select-combo-box",
|
|
19
|
-
"description": "`<vaadin-multi-select-combo-box>` is a web component that wraps `<vaadin-combo-box>` and extends\nits functionality to allow selecting multiple items, in addition to basic features.\n\n```html\n<vaadin-multi-select-combo-box id=\"comboBox\"></vaadin-multi-select-combo-box>\n```\n```js\nconst comboBox = document.querySelector('#comboBox');\ncomboBox.items = ['apple', 'banana', 'lemon', 'orange'];\ncomboBox.selectedItems = ['lemon', 'orange'];\n```\n\n### Styling\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n-----------------------|----------------\n`chips` | The element that wraps chips for selected items\n`
|
|
19
|
+
"description": "`<vaadin-multi-select-combo-box>` is a web component that wraps `<vaadin-combo-box>` and extends\nits functionality to allow selecting multiple items, in addition to basic features.\n\n```html\n<vaadin-multi-select-combo-box id=\"comboBox\"></vaadin-multi-select-combo-box>\n```\n```js\nconst comboBox = document.querySelector('#comboBox');\ncomboBox.items = ['apple', 'banana', 'lemon', 'orange'];\ncomboBox.selectedItems = ['lemon', 'orange'];\n```\n\n### Styling\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n-----------------------|----------------\n`chips` | The element that wraps slotted chips for selected items\n`label` | The label element\n`input-field` | The element that wraps prefix, value and suffix\n`clear-button` | The clear button\n`error-message` | The error message element\n`helper-text` | The helper text element wrapper\n`required-indicator` | The `required` state indicator element\n`toggle-button` | The toggle button\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n-----------------------|-----------------\n`disabled` | Set to a disabled element\n`has-value` | Set when the element has a value\n`has-label` | Set when the element has a label\n`has-helper` | Set when the element has helper text or slot\n`has-error-message` | Set when the element has an error message\n`invalid` | Set when the element is invalid\n`focused` | Set when the element is focused\n`focus-ring` | Set when the element is keyboard focused\n`loading` | Set when loading items from the data provider\n`opened` | Set when the dropdown is open\n`readonly` | Set to a readonly element\n\nThe following custom CSS properties are available for styling:\n\nCustom property | Description | Default\n-----------------------------------------------------|----------------------------|--------\n`--vaadin-field-default-width` | Default width of the field | `12em`\n`--vaadin-multi-select-combo-box-overlay-width` | Width of the overlay | `auto`\n`--vaadin-multi-select-combo-box-overlay-max-height` | Max height of the overlay | `65vh`\n`--vaadin-multi-select-combo-box-input-min-width` | Min width of the input | `4em`\n\n### Internal components\n\nIn addition to `<vaadin-multi-select-combo-box>` itself, the following internal\ncomponents are themable:\n\n- `<vaadin-multi-select-combo-box-overlay>` - has the same API as `<vaadin-overlay>`.\n- `<vaadin-multi-select-combo-box-item>` - has the same API as `<vaadin-item>`.\n- `<vaadin-multi-select-combo-box-container>` - has the same API as `<vaadin-input-container>`.\n\nNote: the `theme` attribute value set on `<vaadin-multi-select-combo-box>` is\npropagated to these components.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/custom-theme/styling-components) documentation.",
|
|
20
20
|
"extension": true,
|
|
21
21
|
"attributes": [
|
|
22
22
|
{
|