@vaadin/multi-select-combo-box 24.0.0-alpha1 → 24.0.0-alpha3
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 +62 -70
- 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": "24.0.0-
|
|
3
|
+
"version": "24.0.0-alpha3",
|
|
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": "24.0.0-
|
|
41
|
-
"@vaadin/component-base": "24.0.0-
|
|
42
|
-
"@vaadin/field-base": "24.0.0-
|
|
43
|
-
"@vaadin/input-container": "24.0.0-
|
|
44
|
-
"@vaadin/lit-renderer": "24.0.0-
|
|
45
|
-
"@vaadin/vaadin-lumo-styles": "24.0.0-
|
|
46
|
-
"@vaadin/vaadin-material-styles": "24.0.0-
|
|
47
|
-
"@vaadin/vaadin-themable-mixin": "24.0.0-
|
|
40
|
+
"@vaadin/combo-box": "24.0.0-alpha3",
|
|
41
|
+
"@vaadin/component-base": "24.0.0-alpha3",
|
|
42
|
+
"@vaadin/field-base": "24.0.0-alpha3",
|
|
43
|
+
"@vaadin/input-container": "24.0.0-alpha3",
|
|
44
|
+
"@vaadin/lit-renderer": "24.0.0-alpha3",
|
|
45
|
+
"@vaadin/vaadin-lumo-styles": "24.0.0-alpha3",
|
|
46
|
+
"@vaadin/vaadin-material-styles": "24.0.0-alpha3",
|
|
47
|
+
"@vaadin/vaadin-themable-mixin": "24.0.0-alpha3"
|
|
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": "7a013a3c5a56abd61dd4f7773c6ec77c3541bdf2"
|
|
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,15 @@ 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(this, 'overflow', 'vaadin-multi-select-combo-box-chip', {
|
|
513
|
+
initializer: (chip) => {
|
|
514
|
+
chip.addEventListener('mousedown', (e) => this._preventBlur(e));
|
|
515
|
+
this._overflow = chip;
|
|
516
|
+
},
|
|
517
|
+
});
|
|
518
|
+
this.addController(this._overflowController);
|
|
519
|
+
|
|
522
520
|
this.__updateChips();
|
|
523
521
|
|
|
524
522
|
processTemplates(this);
|
|
@@ -716,34 +714,6 @@ class MultiSelectComboBox extends ResizeMixin(InputControlMixin(ThemableMixin(El
|
|
|
716
714
|
return this.$.comboBox._getItemLabel(item);
|
|
717
715
|
}
|
|
718
716
|
|
|
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
717
|
/** @private */
|
|
748
718
|
_mergeItemLabels(items) {
|
|
749
719
|
return items.map((item) => this._getItemLabel(item)).join(', ');
|
|
@@ -828,8 +798,7 @@ class MultiSelectComboBox extends ResizeMixin(InputControlMixin(ThemableMixin(El
|
|
|
828
798
|
/** @private */
|
|
829
799
|
__createChip(item) {
|
|
830
800
|
const chip = document.createElement('vaadin-multi-select-combo-box-chip');
|
|
831
|
-
chip.setAttribute('
|
|
832
|
-
chip.setAttribute('slot', 'prefix');
|
|
801
|
+
chip.setAttribute('slot', 'chip');
|
|
833
802
|
|
|
834
803
|
chip.item = item;
|
|
835
804
|
chip.disabled = this.disabled;
|
|
@@ -847,16 +816,20 @@ class MultiSelectComboBox extends ResizeMixin(InputControlMixin(ThemableMixin(El
|
|
|
847
816
|
|
|
848
817
|
/** @private */
|
|
849
818
|
__getOverflowWidth() {
|
|
850
|
-
const chip = this
|
|
819
|
+
const chip = this._overflow;
|
|
851
820
|
|
|
852
821
|
chip.style.visibility = 'hidden';
|
|
853
822
|
chip.removeAttribute('hidden');
|
|
854
823
|
|
|
824
|
+
const count = chip.getAttribute('count');
|
|
825
|
+
|
|
855
826
|
// Detect max possible width of the overflow chip
|
|
856
|
-
|
|
827
|
+
// by measuring it with widest number (2 digits)
|
|
828
|
+
chip.setAttribute('count', '99');
|
|
857
829
|
const overflowStyle = getComputedStyle(chip);
|
|
858
830
|
const overflowWidth = chip.clientWidth + parseInt(overflowStyle.marginInlineStart);
|
|
859
831
|
|
|
832
|
+
chip.setAttribute('count', count);
|
|
860
833
|
chip.setAttribute('hidden', '');
|
|
861
834
|
chip.style.visibility = '';
|
|
862
835
|
|
|
@@ -870,10 +843,8 @@ class MultiSelectComboBox extends ResizeMixin(InputControlMixin(ThemableMixin(El
|
|
|
870
843
|
}
|
|
871
844
|
|
|
872
845
|
// Clear all chips except the overflow
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
chip.remove();
|
|
876
|
-
}
|
|
846
|
+
this._chips.forEach((chip) => {
|
|
847
|
+
chip.remove();
|
|
877
848
|
});
|
|
878
849
|
|
|
879
850
|
const items = [...this.selectedItems];
|
|
@@ -891,7 +862,7 @@ class MultiSelectComboBox extends ResizeMixin(InputControlMixin(ThemableMixin(El
|
|
|
891
862
|
// Add chips until remaining width is exceeded
|
|
892
863
|
for (let i = items.length - 1, refNode = null; i >= 0; i--) {
|
|
893
864
|
const chip = this.__createChip(items[i]);
|
|
894
|
-
this
|
|
865
|
+
this.insertBefore(chip, refNode);
|
|
895
866
|
|
|
896
867
|
if (this.$.chips.clientWidth > remainingWidth) {
|
|
897
868
|
chip.remove();
|
|
@@ -905,6 +876,21 @@ class MultiSelectComboBox extends ResizeMixin(InputControlMixin(ThemableMixin(El
|
|
|
905
876
|
this._overflowItems = items;
|
|
906
877
|
}
|
|
907
878
|
|
|
879
|
+
/** @private */
|
|
880
|
+
__updateOverflowChip(overflow, items, disabled, readonly) {
|
|
881
|
+
if (overflow) {
|
|
882
|
+
const count = items.length;
|
|
883
|
+
|
|
884
|
+
overflow.label = `${count}`;
|
|
885
|
+
overflow.setAttribute('count', `${count}`);
|
|
886
|
+
overflow.setAttribute('title', this._mergeItemLabels(items));
|
|
887
|
+
overflow.toggleAttribute('hidden', count === 0);
|
|
888
|
+
|
|
889
|
+
overflow.disabled = disabled;
|
|
890
|
+
overflow.readonly = readonly;
|
|
891
|
+
}
|
|
892
|
+
}
|
|
893
|
+
|
|
908
894
|
/** @private */
|
|
909
895
|
_onClearButtonTouchend(event) {
|
|
910
896
|
// Cancel the following click and focus events
|
|
@@ -961,7 +947,7 @@ class MultiSelectComboBox extends ResizeMixin(InputControlMixin(ThemableMixin(El
|
|
|
961
947
|
_onKeyDown(event) {
|
|
962
948
|
super._onKeyDown(event);
|
|
963
949
|
|
|
964
|
-
const chips =
|
|
950
|
+
const chips = this._chips;
|
|
965
951
|
|
|
966
952
|
if (!this.readonly && chips.length > 0) {
|
|
967
953
|
switch (event.key) {
|
|
@@ -969,10 +955,10 @@ class MultiSelectComboBox extends ResizeMixin(InputControlMixin(ThemableMixin(El
|
|
|
969
955
|
this._onBackSpace(chips);
|
|
970
956
|
break;
|
|
971
957
|
case 'ArrowLeft':
|
|
972
|
-
this._onArrowLeft(chips);
|
|
958
|
+
this._onArrowLeft(chips, event);
|
|
973
959
|
break;
|
|
974
960
|
case 'ArrowRight':
|
|
975
|
-
this._onArrowRight(chips);
|
|
961
|
+
this._onArrowRight(chips, event);
|
|
976
962
|
break;
|
|
977
963
|
default:
|
|
978
964
|
this._focusedChipIndex = -1;
|
|
@@ -982,12 +968,15 @@ class MultiSelectComboBox extends ResizeMixin(InputControlMixin(ThemableMixin(El
|
|
|
982
968
|
}
|
|
983
969
|
|
|
984
970
|
/** @private */
|
|
985
|
-
_onArrowLeft(chips) {
|
|
986
|
-
if (this.inputElement.
|
|
971
|
+
_onArrowLeft(chips, event) {
|
|
972
|
+
if (this.inputElement.selectionStart !== 0) {
|
|
987
973
|
return;
|
|
988
974
|
}
|
|
989
975
|
|
|
990
976
|
const idx = this._focusedChipIndex;
|
|
977
|
+
if (idx !== -1) {
|
|
978
|
+
event.preventDefault();
|
|
979
|
+
}
|
|
991
980
|
let newIdx;
|
|
992
981
|
|
|
993
982
|
if (this.getAttribute('dir') !== 'rtl') {
|
|
@@ -1012,12 +1001,15 @@ class MultiSelectComboBox extends ResizeMixin(InputControlMixin(ThemableMixin(El
|
|
|
1012
1001
|
}
|
|
1013
1002
|
|
|
1014
1003
|
/** @private */
|
|
1015
|
-
_onArrowRight(chips) {
|
|
1016
|
-
if (this.inputElement.
|
|
1004
|
+
_onArrowRight(chips, event) {
|
|
1005
|
+
if (this.inputElement.selectionStart !== 0) {
|
|
1017
1006
|
return;
|
|
1018
1007
|
}
|
|
1019
1008
|
|
|
1020
1009
|
const idx = this._focusedChipIndex;
|
|
1010
|
+
if (idx !== -1) {
|
|
1011
|
+
event.preventDefault();
|
|
1012
|
+
}
|
|
1021
1013
|
let newIdx;
|
|
1022
1014
|
|
|
1023
1015
|
if (this.getAttribute('dir') === 'rtl') {
|
|
@@ -1043,7 +1035,7 @@ class MultiSelectComboBox extends ResizeMixin(InputControlMixin(ThemableMixin(El
|
|
|
1043
1035
|
|
|
1044
1036
|
/** @private */
|
|
1045
1037
|
_onBackSpace(chips) {
|
|
1046
|
-
if (this.inputElement.
|
|
1038
|
+
if (this.inputElement.selectionStart !== 0) {
|
|
1047
1039
|
return;
|
|
1048
1040
|
}
|
|
1049
1041
|
|
|
@@ -1059,7 +1051,7 @@ class MultiSelectComboBox extends ResizeMixin(InputControlMixin(ThemableMixin(El
|
|
|
1059
1051
|
/** @private */
|
|
1060
1052
|
_focusedChipIndexChanged(focusedIndex, oldFocusedIndex) {
|
|
1061
1053
|
if (focusedIndex > -1 || oldFocusedIndex > -1) {
|
|
1062
|
-
const chips =
|
|
1054
|
+
const chips = this._chips;
|
|
1063
1055
|
chips.forEach((chip, index) => {
|
|
1064
1056
|
chip.toggleAttribute('focused', index === focusedIndex);
|
|
1065
1057
|
});
|
|
@@ -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": "24.0.0-
|
|
4
|
+
"version": "24.0.0-alpha3",
|
|
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": "24.0.0-
|
|
4
|
+
"version": "24.0.0-alpha3",
|
|
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
|
{
|