@vaadin/multi-select-combo-box 23.3.3 → 24.0.0-alpha10
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/lit/renderer-directives.d.ts +1 -1
- package/src/lit/renderer-directives.js +1 -1
- package/src/vaadin-multi-select-combo-box-chip.js +3 -2
- package/src/vaadin-multi-select-combo-box-container.js +1 -1
- package/src/vaadin-multi-select-combo-box-internal.js +1 -1
- package/src/vaadin-multi-select-combo-box-item.js +1 -1
- package/src/vaadin-multi-select-combo-box-overlay.js +1 -1
- package/src/vaadin-multi-select-combo-box-scroller.js +1 -1
- package/src/vaadin-multi-select-combo-box.d.ts +4 -8
- package/src/vaadin-multi-select-combo-box.js +63 -77
- package/theme/lumo/vaadin-multi-select-combo-box-chip-styles.js +13 -21
- package/theme/lumo/vaadin-multi-select-combo-box-styles.js +20 -4
- package/theme/lumo/vaadin-multi-select-combo-box.js +1 -1
- package/theme/material/vaadin-multi-select-combo-box-chip-styles.js +13 -16
- package/theme/material/vaadin-multi-select-combo-box-styles.js +11 -1
- package/theme/material/vaadin-multi-select-combo-box.js +1 -1
- 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-alpha10",
|
|
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-alpha10",
|
|
41
|
+
"@vaadin/component-base": "24.0.0-alpha10",
|
|
42
|
+
"@vaadin/field-base": "24.0.0-alpha10",
|
|
43
|
+
"@vaadin/input-container": "24.0.0-alpha10",
|
|
44
|
+
"@vaadin/lit-renderer": "24.0.0-alpha10",
|
|
45
|
+
"@vaadin/vaadin-lumo-styles": "24.0.0-alpha10",
|
|
46
|
+
"@vaadin/vaadin-material-styles": "24.0.0-alpha10",
|
|
47
|
+
"@vaadin/vaadin-themable-mixin": "24.0.0-alpha10"
|
|
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": "2e04534d8b47bcd216f89b5f849bafef1a73b174"
|
|
60
60
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c) 2021 -
|
|
3
|
+
* Copyright (c) 2021 - 2023 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
|
|
@@ -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>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c) 2021 -
|
|
3
|
+
* Copyright (c) 2021 - 2023 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import { InputContainer } from '@vaadin/input-container/src/vaadin-input-container.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c) 2021 -
|
|
3
|
+
* Copyright (c) 2021 - 2023 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import { ComboBoxItem } from '@vaadin/combo-box/src/vaadin-combo-box-item.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c) 2021 -
|
|
3
|
+
* Copyright (c) 2021 - 2023 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import { ComboBoxOverlay } from '@vaadin/combo-box/src/vaadin-combo-box-overlay.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c) 2021 -
|
|
3
|
+
* Copyright (c) 2021 - 2023 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import { ComboBoxPlaceholder } from '@vaadin/combo-box/src/vaadin-combo-box-placeholder.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c) 2021 -
|
|
3
|
+
* Copyright (c) 2021 - 2023 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import type {
|
|
@@ -9,13 +9,13 @@ import type {
|
|
|
9
9
|
ComboBoxItemModel,
|
|
10
10
|
} from '@vaadin/combo-box/src/vaadin-combo-box.js';
|
|
11
11
|
import type { ControllerMixinClass } from '@vaadin/component-base/src/controller-mixin.js';
|
|
12
|
+
import type { DelegateFocusMixinClass } from '@vaadin/component-base/src/delegate-focus-mixin.js';
|
|
13
|
+
import type { DelegateStateMixinClass } from '@vaadin/component-base/src/delegate-state-mixin.js';
|
|
12
14
|
import type { DisabledMixinClass } from '@vaadin/component-base/src/disabled-mixin.js';
|
|
13
15
|
import type { ElementMixinClass } from '@vaadin/component-base/src/element-mixin.js';
|
|
14
16
|
import type { FocusMixinClass } from '@vaadin/component-base/src/focus-mixin.js';
|
|
15
17
|
import type { KeyboardMixinClass } from '@vaadin/component-base/src/keyboard-mixin.js';
|
|
16
18
|
import type { ResizeMixinClass } from '@vaadin/component-base/src/resize-mixin.js';
|
|
17
|
-
import type { DelegateFocusMixinClass } from '@vaadin/field-base/src/delegate-focus-mixin.js';
|
|
18
|
-
import type { DelegateStateMixinClass } from '@vaadin/field-base/src/delegate-state-mixin.js';
|
|
19
19
|
import type { FieldMixinClass } from '@vaadin/field-base/src/field-mixin.js';
|
|
20
20
|
import type { InputConstraintsMixinClass } from '@vaadin/field-base/src/input-constraints-mixin.js';
|
|
21
21
|
import type { InputControlMixinClass } from '@vaadin/field-base/src/input-control-mixin.js';
|
|
@@ -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:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c) 2021 -
|
|
3
|
+
* Copyright (c) 2021 - 2023 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import './vaadin-multi-select-combo-box-chip.js';
|
|
@@ -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,18 @@ 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"]')];
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
/**
|
|
492
|
+
* Override a getter from `InputMixin` to compute
|
|
493
|
+
* the presence of value based on `selectedItems`.
|
|
494
|
+
*
|
|
495
|
+
* @protected
|
|
496
|
+
* @override
|
|
497
|
+
*/
|
|
498
|
+
get _hasValue() {
|
|
499
|
+
return this.selectedItems && this.selectedItems.length > 0;
|
|
500
500
|
}
|
|
501
501
|
|
|
502
502
|
/** @protected */
|
|
@@ -519,6 +519,15 @@ class MultiSelectComboBox extends ResizeMixin(InputControlMixin(ThemableMixin(El
|
|
|
519
519
|
this._tooltipController.setShouldShow((target) => !target.opened);
|
|
520
520
|
|
|
521
521
|
this._inputField = this.shadowRoot.querySelector('[part="input-field"]');
|
|
522
|
+
|
|
523
|
+
this._overflowController = new SlotController(this, 'overflow', 'vaadin-multi-select-combo-box-chip', {
|
|
524
|
+
initializer: (chip) => {
|
|
525
|
+
chip.addEventListener('mousedown', (e) => this._preventBlur(e));
|
|
526
|
+
this._overflow = chip;
|
|
527
|
+
},
|
|
528
|
+
});
|
|
529
|
+
this.addController(this._overflowController);
|
|
530
|
+
|
|
522
531
|
this.__updateChips();
|
|
523
532
|
|
|
524
533
|
processTemplates(this);
|
|
@@ -716,34 +725,6 @@ class MultiSelectComboBox extends ResizeMixin(InputControlMixin(ThemableMixin(El
|
|
|
716
725
|
return this.$.comboBox._getItemLabel(item);
|
|
717
726
|
}
|
|
718
727
|
|
|
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
728
|
/** @private */
|
|
748
729
|
_mergeItemLabels(items) {
|
|
749
730
|
return items.map((item) => this._getItemLabel(item)).join(', ');
|
|
@@ -828,8 +809,7 @@ class MultiSelectComboBox extends ResizeMixin(InputControlMixin(ThemableMixin(El
|
|
|
828
809
|
/** @private */
|
|
829
810
|
__createChip(item) {
|
|
830
811
|
const chip = document.createElement('vaadin-multi-select-combo-box-chip');
|
|
831
|
-
chip.setAttribute('
|
|
832
|
-
chip.setAttribute('slot', 'prefix');
|
|
812
|
+
chip.setAttribute('slot', 'chip');
|
|
833
813
|
|
|
834
814
|
chip.item = item;
|
|
835
815
|
chip.disabled = this.disabled;
|
|
@@ -847,16 +827,20 @@ class MultiSelectComboBox extends ResizeMixin(InputControlMixin(ThemableMixin(El
|
|
|
847
827
|
|
|
848
828
|
/** @private */
|
|
849
829
|
__getOverflowWidth() {
|
|
850
|
-
const chip = this
|
|
830
|
+
const chip = this._overflow;
|
|
851
831
|
|
|
852
832
|
chip.style.visibility = 'hidden';
|
|
853
833
|
chip.removeAttribute('hidden');
|
|
854
834
|
|
|
835
|
+
const count = chip.getAttribute('count');
|
|
836
|
+
|
|
855
837
|
// Detect max possible width of the overflow chip
|
|
856
|
-
|
|
838
|
+
// by measuring it with widest number (2 digits)
|
|
839
|
+
chip.setAttribute('count', '99');
|
|
857
840
|
const overflowStyle = getComputedStyle(chip);
|
|
858
841
|
const overflowWidth = chip.clientWidth + parseInt(overflowStyle.marginInlineStart);
|
|
859
842
|
|
|
843
|
+
chip.setAttribute('count', count);
|
|
860
844
|
chip.setAttribute('hidden', '');
|
|
861
845
|
chip.style.visibility = '';
|
|
862
846
|
|
|
@@ -870,10 +854,8 @@ class MultiSelectComboBox extends ResizeMixin(InputControlMixin(ThemableMixin(El
|
|
|
870
854
|
}
|
|
871
855
|
|
|
872
856
|
// Clear all chips except the overflow
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
chip.remove();
|
|
876
|
-
}
|
|
857
|
+
this._chips.forEach((chip) => {
|
|
858
|
+
chip.remove();
|
|
877
859
|
});
|
|
878
860
|
|
|
879
861
|
const items = [...this.selectedItems];
|
|
@@ -891,7 +873,7 @@ class MultiSelectComboBox extends ResizeMixin(InputControlMixin(ThemableMixin(El
|
|
|
891
873
|
// Add chips until remaining width is exceeded
|
|
892
874
|
for (let i = items.length - 1, refNode = null; i >= 0; i--) {
|
|
893
875
|
const chip = this.__createChip(items[i]);
|
|
894
|
-
this
|
|
876
|
+
this.insertBefore(chip, refNode);
|
|
895
877
|
|
|
896
878
|
if (this.$.chips.clientWidth > remainingWidth) {
|
|
897
879
|
chip.remove();
|
|
@@ -905,6 +887,21 @@ class MultiSelectComboBox extends ResizeMixin(InputControlMixin(ThemableMixin(El
|
|
|
905
887
|
this._overflowItems = items;
|
|
906
888
|
}
|
|
907
889
|
|
|
890
|
+
/** @private */
|
|
891
|
+
__updateOverflowChip(overflow, items, disabled, readonly) {
|
|
892
|
+
if (overflow) {
|
|
893
|
+
const count = items.length;
|
|
894
|
+
|
|
895
|
+
overflow.label = `${count}`;
|
|
896
|
+
overflow.setAttribute('count', `${count}`);
|
|
897
|
+
overflow.setAttribute('title', this._mergeItemLabels(items));
|
|
898
|
+
overflow.toggleAttribute('hidden', count === 0);
|
|
899
|
+
|
|
900
|
+
overflow.disabled = disabled;
|
|
901
|
+
overflow.readonly = readonly;
|
|
902
|
+
}
|
|
903
|
+
}
|
|
904
|
+
|
|
908
905
|
/** @private */
|
|
909
906
|
_onClearButtonTouchend(event) {
|
|
910
907
|
// Cancel the following click and focus events
|
|
@@ -961,7 +958,7 @@ class MultiSelectComboBox extends ResizeMixin(InputControlMixin(ThemableMixin(El
|
|
|
961
958
|
_onKeyDown(event) {
|
|
962
959
|
super._onKeyDown(event);
|
|
963
960
|
|
|
964
|
-
const chips =
|
|
961
|
+
const chips = this._chips;
|
|
965
962
|
|
|
966
963
|
if (!this.readonly && chips.length > 0) {
|
|
967
964
|
switch (event.key) {
|
|
@@ -993,7 +990,7 @@ class MultiSelectComboBox extends ResizeMixin(InputControlMixin(ThemableMixin(El
|
|
|
993
990
|
}
|
|
994
991
|
let newIdx;
|
|
995
992
|
|
|
996
|
-
if (this.
|
|
993
|
+
if (!this.__isRTL) {
|
|
997
994
|
if (idx === -1) {
|
|
998
995
|
// Focus last chip
|
|
999
996
|
newIdx = chips.length - 1;
|
|
@@ -1026,7 +1023,7 @@ class MultiSelectComboBox extends ResizeMixin(InputControlMixin(ThemableMixin(El
|
|
|
1026
1023
|
}
|
|
1027
1024
|
let newIdx;
|
|
1028
1025
|
|
|
1029
|
-
if (this.
|
|
1026
|
+
if (this.__isRTL) {
|
|
1030
1027
|
if (idx === -1) {
|
|
1031
1028
|
// Focus last chip
|
|
1032
1029
|
newIdx = chips.length - 1;
|
|
@@ -1065,7 +1062,7 @@ class MultiSelectComboBox extends ResizeMixin(InputControlMixin(ThemableMixin(El
|
|
|
1065
1062
|
/** @private */
|
|
1066
1063
|
_focusedChipIndexChanged(focusedIndex, oldFocusedIndex) {
|
|
1067
1064
|
if (focusedIndex > -1 || oldFocusedIndex > -1) {
|
|
1068
|
-
const chips =
|
|
1065
|
+
const chips = this._chips;
|
|
1069
1066
|
chips.forEach((chip, index) => {
|
|
1070
1067
|
chip.toggleAttribute('focused', index === focusedIndex);
|
|
1071
1068
|
});
|
|
@@ -1132,17 +1129,6 @@ class MultiSelectComboBox extends ResizeMixin(InputControlMixin(ThemableMixin(El
|
|
|
1132
1129
|
__computeEffectiveFilteredItems(items, filteredItems, selectedItems, readonly) {
|
|
1133
1130
|
return !items && readonly ? selectedItems : filteredItems;
|
|
1134
1131
|
}
|
|
1135
|
-
|
|
1136
|
-
/**
|
|
1137
|
-
* Override a method from `InputMixin` to
|
|
1138
|
-
* compute the presence of value based on `selectedItems`.
|
|
1139
|
-
*
|
|
1140
|
-
* @protected
|
|
1141
|
-
* @override
|
|
1142
|
-
*/
|
|
1143
|
-
get _hasValue() {
|
|
1144
|
-
return this.selectedItems && this.selectedItems.length > 0;
|
|
1145
|
-
}
|
|
1146
1132
|
}
|
|
1147
1133
|
|
|
1148
1134
|
customElements.define(MultiSelectComboBox.is, MultiSelectComboBox);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c) 2021 -
|
|
3
|
+
* Copyright (c) 2021 - 2023 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import '@vaadin/vaadin-lumo-styles/color.js';
|
|
@@ -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
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c) 2021 -
|
|
3
|
+
* Copyright (c) 2021 - 2023 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import '@vaadin/vaadin-lumo-styles/color.js';
|
|
@@ -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 {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c) 2021 -
|
|
3
|
+
* Copyright (c) 2021 - 2023 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import '@vaadin/combo-box/theme/lumo/vaadin-combo-box-item-styles.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c) 2021 -
|
|
3
|
+
* Copyright (c) 2021 - 2023 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import '@vaadin/vaadin-material-styles/color.js';
|
|
@@ -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
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c) 2021 -
|
|
3
|
+
* Copyright (c) 2021 - 2023 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import '@vaadin/vaadin-material-styles/color.js';
|
|
@@ -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;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c) 2021 -
|
|
3
|
+
* Copyright (c) 2021 - 2023 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import '@vaadin/combo-box/theme/material/vaadin-combo-box-item-styles.js';
|
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-alpha10",
|
|
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-alpha10",
|
|
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
|
{
|