@vaadin/multi-select-combo-box 25.0.0-alpha2 → 25.0.0-alpha20

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.
Files changed (27) hide show
  1. package/package.json +15 -16
  2. package/src/{vaadin-multi-select-combo-box-styles.d.ts → styles/vaadin-multi-select-combo-box-base-styles.d.ts} +1 -3
  3. package/src/styles/vaadin-multi-select-combo-box-base-styles.js +58 -0
  4. package/src/styles/vaadin-multi-select-combo-box-chip-base-styles.js +126 -0
  5. package/src/styles/vaadin-multi-select-combo-box-overlay-base-styles.js +19 -0
  6. package/src/styles/vaadin-multi-select-combo-box-scroller-base-styles.js +8 -0
  7. package/src/vaadin-multi-select-combo-box-chip.js +4 -3
  8. package/src/vaadin-multi-select-combo-box-container.js +2 -0
  9. package/src/vaadin-multi-select-combo-box-item.js +7 -11
  10. package/src/vaadin-multi-select-combo-box-mixin.d.ts +18 -89
  11. package/src/vaadin-multi-select-combo-box-mixin.js +426 -307
  12. package/src/vaadin-multi-select-combo-box-overlay.js +5 -19
  13. package/src/vaadin-multi-select-combo-box-scroller.js +3 -24
  14. package/src/vaadin-multi-select-combo-box.d.ts +13 -7
  15. package/src/vaadin-multi-select-combo-box.js +42 -90
  16. package/vaadin-multi-select-combo-box.js +1 -1
  17. package/web-types.json +200 -236
  18. package/web-types.lit.json +76 -83
  19. package/src/vaadin-multi-select-combo-box-internal-mixin.js +0 -449
  20. package/src/vaadin-multi-select-combo-box-internal.js +0 -56
  21. package/src/vaadin-multi-select-combo-box-styles.js +0 -74
  22. package/theme/lumo/vaadin-multi-select-combo-box-chip-styles.d.ts +0 -10
  23. package/theme/lumo/vaadin-multi-select-combo-box-chip-styles.js +0 -107
  24. package/theme/lumo/vaadin-multi-select-combo-box-styles.d.ts +0 -10
  25. package/theme/lumo/vaadin-multi-select-combo-box-styles.js +0 -118
  26. package/theme/lumo/vaadin-multi-select-combo-box.d.ts +0 -8
  27. package/theme/lumo/vaadin-multi-select-combo-box.js +0 -8
@@ -3,29 +3,16 @@
3
3
  * Copyright (c) 2021 - 2025 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
- import { css, html, LitElement } from 'lit';
6
+ import { html, LitElement } from 'lit';
7
7
  import { ComboBoxOverlayMixin } from '@vaadin/combo-box/src/vaadin-combo-box-overlay-mixin.js';
8
8
  import { defineCustomElement } from '@vaadin/component-base/src/define.js';
9
9
  import { DirMixin } from '@vaadin/component-base/src/dir-mixin.js';
10
10
  import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
11
+ import { overlayStyles } from '@vaadin/overlay/src/styles/vaadin-overlay-base-styles.js';
11
12
  import { OverlayMixin } from '@vaadin/overlay/src/vaadin-overlay-mixin.js';
12
- import { overlayStyles } from '@vaadin/overlay/src/vaadin-overlay-styles.js';
13
+ import { LumoInjectionMixin } from '@vaadin/vaadin-themable-mixin/lumo-injection-mixin.js';
13
14
  import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
14
-
15
- const multiSelectComboBoxOverlayStyles = css`
16
- #overlay {
17
- width: var(
18
- --vaadin-multi-select-combo-box-overlay-width,
19
- var(--_vaadin-multi-select-combo-box-overlay-default-width, auto)
20
- );
21
- }
22
-
23
- [part='content'] {
24
- display: flex;
25
- flex-direction: column;
26
- height: 100%;
27
- }
28
- `;
15
+ import { multiSelectComboBoxOverlayStyles } from './styles/vaadin-multi-select-combo-box-overlay-base-styles.js';
29
16
 
30
17
  /**
31
18
  * An element used internally by `<vaadin-multi-select-combo-box>`. Not intended to be used separately.
@@ -39,7 +26,7 @@ const multiSelectComboBoxOverlayStyles = css`
39
26
  * @private
40
27
  */
41
28
  class MultiSelectComboBoxOverlay extends ComboBoxOverlayMixin(
42
- OverlayMixin(DirMixin(ThemableMixin(PolylitMixin(LitElement)))),
29
+ OverlayMixin(DirMixin(ThemableMixin(PolylitMixin(LumoInjectionMixin(LitElement))))),
43
30
  ) {
44
31
  static get is() {
45
32
  return 'vaadin-multi-select-combo-box-overlay';
@@ -52,7 +39,6 @@ class MultiSelectComboBoxOverlay extends ComboBoxOverlayMixin(
52
39
  /** @protected */
53
40
  render() {
54
41
  return html`
55
- <div id="backdrop" part="backdrop" hidden></div>
56
42
  <div part="overlay" id="overlay">
57
43
  <div part="loader"></div>
58
44
  <div part="content" id="content"><slot></slot></div>
@@ -3,11 +3,12 @@
3
3
  * Copyright (c) 2021 - 2025 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
- import { css, html, LitElement } from 'lit';
6
+ import { html, LitElement } from 'lit';
7
7
  import { ComboBoxPlaceholder } from '@vaadin/combo-box/src/vaadin-combo-box-placeholder.js';
8
8
  import { ComboBoxScrollerMixin } from '@vaadin/combo-box/src/vaadin-combo-box-scroller-mixin.js';
9
9
  import { defineCustomElement } from '@vaadin/component-base/src/define.js';
10
10
  import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
11
+ import { multiSelectComboBoxScrollerStyles } from './styles/vaadin-multi-select-combo-box-scroller-base-styles.js';
11
12
 
12
13
  /**
13
14
  * An element used internally by `<vaadin-multi-select-combo-box>`. Not intended to be used separately.
@@ -23,29 +24,7 @@ export class MultiSelectComboBoxScroller extends ComboBoxScrollerMixin(PolylitMi
23
24
  }
24
25
 
25
26
  static get styles() {
26
- return css`
27
- :host {
28
- display: block;
29
- min-height: 1px;
30
- overflow: auto;
31
-
32
- /* Fixes item background from getting on top of scrollbars on Safari */
33
- transform: translate3d(0, 0, 0);
34
-
35
- /* Enable momentum scrolling on iOS */
36
- -webkit-overflow-scrolling: touch;
37
-
38
- /* Fixes scrollbar disappearing when 'Show scroll bars: Always' enabled in Safari */
39
- box-shadow: 0 0 0 white;
40
- }
41
-
42
- #selector {
43
- border-width: var(--_vaadin-multi-select-combo-box-items-container-border-width);
44
- border-style: var(--_vaadin-multi-select-combo-box-items-container-border-style);
45
- border-color: var(--_vaadin-multi-select-combo-box-items-container-border-color, transparent);
46
- position: relative;
47
- }
48
- `;
27
+ return multiSelectComboBoxScrollerStyles;
49
28
  }
50
29
 
51
30
  /** @protected */
@@ -8,6 +8,9 @@ import type { DisabledMixinClass } from '@vaadin/a11y-base/src/disabled-mixin.js
8
8
  import type { FocusMixinClass } from '@vaadin/a11y-base/src/focus-mixin.js';
9
9
  import type { KeyboardMixinClass } from '@vaadin/a11y-base/src/keyboard-mixin.js';
10
10
  import type { ComboBoxDefaultItem } from '@vaadin/combo-box/src/vaadin-combo-box.js';
11
+ import type { ComboBoxBaseMixinClass } from '@vaadin/combo-box/src/vaadin-combo-box-base-mixin.js';
12
+ import type { ComboBoxDataProviderMixinClass } from '@vaadin/combo-box/src/vaadin-combo-box-data-provider-mixin.js';
13
+ import type { ComboBoxItemsMixinClass } from '@vaadin/combo-box/src/vaadin-combo-box-items-mixin.js';
11
14
  import type { DelegateStateMixinClass } from '@vaadin/component-base/src/delegate-state-mixin.js';
12
15
  import type { ElementMixinClass } from '@vaadin/component-base/src/element-mixin.js';
13
16
  import type { ResizeMixinClass } from '@vaadin/component-base/src/resize-mixin.js';
@@ -101,11 +104,15 @@ export interface MultiSelectComboBoxEventMap<TItem> extends HTMLElementEventMap
101
104
  * `chips` | The element that wraps slotted chips for selected items
102
105
  * `label` | The label element
103
106
  * `input-field` | The element that wraps prefix, value and suffix
107
+ * `field-button` | Set on both clear and toggle buttons
104
108
  * `clear-button` | The clear button
105
109
  * `error-message` | The error message element
106
110
  * `helper-text` | The helper text element wrapper
107
111
  * `required-indicator` | The `required` state indicator element
108
112
  * `toggle-button` | The toggle button
113
+ * `overlay` | The overlay container
114
+ * `content` | The overlay content
115
+ * `loader` | The loading indicator shown while loading items
109
116
  *
110
117
  * The following state attributes are available for styling:
111
118
  *
@@ -116,6 +123,7 @@ export interface MultiSelectComboBoxEventMap<TItem> extends HTMLElementEventMap
116
123
  * `has-label` | Set when the element has a label
117
124
  * `has-helper` | Set when the element has helper text or slot
118
125
  * `has-error-message` | Set when the element has an error message
126
+ * `has-tooltip` | Set when the element has a slotted tooltip
119
127
  * `invalid` | Set when the element is invalid
120
128
  * `focused` | Set when the element is focused
121
129
  * `focus-ring` | Set when the element is keyboard focused
@@ -130,7 +138,6 @@ export interface MultiSelectComboBoxEventMap<TItem> extends HTMLElementEventMap
130
138
  * `--vaadin-field-default-width` | Default width of the field | `12em`
131
139
  * `--vaadin-multi-select-combo-box-overlay-width` | Width of the overlay | `auto`
132
140
  * `--vaadin-multi-select-combo-box-overlay-max-height` | Max height of the overlay | `65vh`
133
- * `--vaadin-multi-select-combo-box-chip-min-width` | Min width of the chip | `50px`
134
141
  * `--vaadin-multi-select-combo-box-input-min-width` | Min width of the input | `4em`
135
142
  *
136
143
  * ### Internal components
@@ -138,12 +145,8 @@ export interface MultiSelectComboBoxEventMap<TItem> extends HTMLElementEventMap
138
145
  * In addition to `<vaadin-multi-select-combo-box>` itself, the following internal
139
146
  * components are themable:
140
147
  *
141
- * - `<vaadin-multi-select-combo-box-overlay>` - has the same API as `<vaadin-overlay>`.
148
+ * - `<vaadin-multi-select-combo-box-chip>`
142
149
  * - `<vaadin-multi-select-combo-box-item>` - has the same API as `<vaadin-item>`.
143
- * - `<vaadin-multi-select-combo-box-container>` - has the same API as `<vaadin-input-container>`.
144
- *
145
- * Note: the `theme` attribute value set on `<vaadin-multi-select-combo-box>` is
146
- * propagated to these components.
147
150
  *
148
151
  * See [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.
149
152
  *
@@ -170,7 +173,10 @@ declare class MultiSelectComboBox<TItem = ComboBoxDefaultItem> extends HTMLEleme
170
173
  }
171
174
 
172
175
  interface MultiSelectComboBox<TItem = ComboBoxDefaultItem>
173
- extends ValidateMixinClass,
176
+ extends ComboBoxBaseMixinClass,
177
+ ComboBoxDataProviderMixinClass<TItem>,
178
+ ComboBoxItemsMixinClass<TItem>,
179
+ ValidateMixinClass,
174
180
  SlotStylesMixinClass,
175
181
  LabelMixinClass,
176
182
  KeyboardMixinClass,
@@ -5,16 +5,19 @@
5
5
  */
6
6
  import './vaadin-multi-select-combo-box-chip.js';
7
7
  import './vaadin-multi-select-combo-box-container.js';
8
- import './vaadin-multi-select-combo-box-internal.js';
8
+ import './vaadin-multi-select-combo-box-item.js';
9
+ import './vaadin-multi-select-combo-box-overlay.js';
10
+ import './vaadin-multi-select-combo-box-scroller.js';
9
11
  import { html, LitElement } from 'lit';
10
12
  import { ifDefined } from 'lit/directives/if-defined.js';
11
13
  import { defineCustomElement } from '@vaadin/component-base/src/define.js';
12
14
  import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
13
15
  import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
14
16
  import { inputFieldShared } from '@vaadin/field-base/src/styles/input-field-shared-styles.js';
17
+ import { LumoInjectionMixin } from '@vaadin/vaadin-themable-mixin/lumo-injection-mixin.js';
15
18
  import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
19
+ import { multiSelectComboBoxStyles } from './styles/vaadin-multi-select-combo-box-base-styles.js';
16
20
  import { MultiSelectComboBoxMixin } from './vaadin-multi-select-combo-box-mixin.js';
17
- import { multiSelectComboBox } from './vaadin-multi-select-combo-box-styles.js';
18
21
 
19
22
  /**
20
23
  * `<vaadin-multi-select-combo-box>` is a web component that wraps `<vaadin-combo-box>` and extends
@@ -39,11 +42,15 @@ import { multiSelectComboBox } from './vaadin-multi-select-combo-box-styles.js';
39
42
  * `chips` | The element that wraps slotted chips for selected items
40
43
  * `label` | The label element
41
44
  * `input-field` | The element that wraps prefix, value and suffix
45
+ * `field-button` | Set on both clear and toggle buttons
42
46
  * `clear-button` | The clear button
43
47
  * `error-message` | The error message element
44
48
  * `helper-text` | The helper text element wrapper
45
49
  * `required-indicator` | The `required` state indicator element
46
50
  * `toggle-button` | The toggle button
51
+ * `overlay` | The overlay container
52
+ * `content` | The overlay content
53
+ * `loader` | The loading indicator shown while loading items
47
54
  *
48
55
  * The following state attributes are available for styling:
49
56
  *
@@ -54,6 +61,7 @@ import { multiSelectComboBox } from './vaadin-multi-select-combo-box-styles.js';
54
61
  * `has-label` | Set when the element has a label
55
62
  * `has-helper` | Set when the element has helper text or slot
56
63
  * `has-error-message` | Set when the element has an error message
64
+ * `has-tooltip` | Set when the element has a slotted tooltip
57
65
  * `invalid` | Set when the element is invalid
58
66
  * `focused` | Set when the element is focused
59
67
  * `focus-ring` | Set when the element is keyboard focused
@@ -68,7 +76,6 @@ import { multiSelectComboBox } from './vaadin-multi-select-combo-box-styles.js';
68
76
  * `--vaadin-field-default-width` | Default width of the field | `12em`
69
77
  * `--vaadin-multi-select-combo-box-overlay-width` | Width of the overlay | `auto`
70
78
  * `--vaadin-multi-select-combo-box-overlay-max-height` | Max height of the overlay | `65vh`
71
- * `--vaadin-multi-select-combo-box-chip-min-width` | Min width of the chip | `50px`
72
79
  * `--vaadin-multi-select-combo-box-input-min-width` | Min width of the input | `4em`
73
80
  *
74
81
  * ### Internal components
@@ -76,12 +83,8 @@ import { multiSelectComboBox } from './vaadin-multi-select-combo-box-styles.js';
76
83
  * In addition to `<vaadin-multi-select-combo-box>` itself, the following internal
77
84
  * components are themable:
78
85
  *
79
- * - `<vaadin-multi-select-combo-box-overlay>` - has the same API as `<vaadin-overlay>`.
86
+ * - `<vaadin-multi-select-combo-box-chip>`
80
87
  * - `<vaadin-multi-select-combo-box-item>` - has the same API as `<vaadin-item>`.
81
- * - `<vaadin-multi-select-combo-box-container>` - has the same API as `<vaadin-input-container>`.
82
- *
83
- * Note: the `theme` attribute value set on `<vaadin-multi-select-combo-box>` is
84
- * propagated to these components.
85
88
  *
86
89
  * See [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.
87
90
  *
@@ -99,13 +102,15 @@ import { multiSelectComboBox } from './vaadin-multi-select-combo-box-styles.js';
99
102
  * @mixes ThemableMixin
100
103
  * @mixes MultiSelectComboBoxMixin
101
104
  */
102
- class MultiSelectComboBox extends MultiSelectComboBoxMixin(ThemableMixin(ElementMixin(PolylitMixin(LitElement)))) {
105
+ class MultiSelectComboBox extends MultiSelectComboBoxMixin(
106
+ ThemableMixin(ElementMixin(PolylitMixin(LumoInjectionMixin(LitElement)))),
107
+ ) {
103
108
  static get is() {
104
109
  return 'vaadin-multi-select-combo-box';
105
110
  }
106
111
 
107
112
  static get styles() {
108
- return [inputFieldShared, multiSelectComboBox];
113
+ return [inputFieldShared, multiSelectComboBoxStyles];
109
114
  }
110
115
 
111
116
  /** @protected */
@@ -117,64 +122,22 @@ class MultiSelectComboBox extends MultiSelectComboBoxMixin(ThemableMixin(Element
117
122
  <span part="required-indicator" aria-hidden="true" @click="${this.focus}"></span>
118
123
  </div>
119
124
 
120
- <vaadin-multi-select-combo-box-internal
121
- id="comboBox"
122
- .filteredItems="${this.filteredItems}"
123
- .items="${this.items}"
124
- .itemIdPath="${this.itemIdPath}"
125
- .itemLabelPath="${this.itemLabelPath}"
126
- .itemValuePath="${this.itemValuePath}"
127
- .disabled="${this.disabled}"
125
+ <vaadin-multi-select-combo-box-container
126
+ part="input-field"
127
+ .autoExpandVertically="${this.autoExpandVertically}"
128
128
  .readonly="${this.readonly}"
129
- .autoOpenDisabled="${this.autoOpenDisabled}"
130
- .allowCustomValue="${this.allowCustomValue}"
131
- .overlayClass="${this.overlayClass}"
132
- .dataProvider="${this.dataProvider}"
133
- .filter="${this.filter}"
134
- .lastFilter="${this._lastFilter}"
135
- .loading="${this.loading}"
136
- .size="${this.size}"
137
- .selectedItems="${this.selectedItems}"
138
- .selectedItemsOnTop="${this.selectedItemsOnTop}"
139
- .itemClassNameGenerator="${this.itemClassNameGenerator}"
140
- .topGroup="${this._topGroup}"
141
- .opened="${this.opened}"
142
- .renderer="${this.renderer}"
143
- .keepFilter="${this.keepFilter}"
129
+ .disabled="${this.disabled}"
130
+ .invalid="${this.invalid}"
144
131
  theme="${ifDefined(this._theme)}"
145
- @combo-box-item-selected="${this._onComboBoxItemSelected}"
146
- @change="${this._onComboBoxChange}"
147
- @custom-value-set="${this._onCustomValueSet}"
148
- @filtered-items-changed="${this._onFilteredItemsChanged}"
149
- @filter-changed="${this._onComboBoxFilterChanged}"
150
- @last-filter-changed="${this._onComboBoxLastFilterChanged}"
151
- @loading-changed="${this._onComboBoxLoadingChanged}"
152
- @opened-changed="${this._onComboBoxOpenedChanged}"
153
- @size-changed="${this._onComboBoxSizeChanged}"
154
132
  >
155
- <vaadin-multi-select-combo-box-container
156
- part="input-field"
157
- .autoExpandVertically="${this.autoExpandVertically}"
158
- .readonly="${this.readonly}"
159
- .disabled="${this.disabled}"
160
- .invalid="${this.invalid}"
161
- theme="${ifDefined(this._theme)}"
162
- >
163
- <slot name="overflow" slot="prefix"></slot>
164
- <div id="chips" part="chips" slot="prefix">
165
- <slot name="chip"></slot>
166
- </div>
167
- <slot name="input"></slot>
168
- <div
169
- id="clearButton"
170
- part="clear-button"
171
- slot="suffix"
172
- @touchend="${this._onClearButtonTouchend}"
173
- aria-hidden="true"
174
- ></div>
175
- <div id="toggleButton" class="toggle-button" part="toggle-button" slot="suffix" aria-hidden="true"></div>
176
- </vaadin-multi-select-combo-box-container>
177
- </vaadin-multi-select-combo-box-internal>
133
+ <slot name="overflow" slot="prefix"></slot>
134
+ <div id="chips" part="chips" slot="prefix">
135
+ <slot name="chip"></slot>
136
+ </div>
137
+ <slot name="input"></slot>
138
+ <div id="clearButton" part="field-button clear-button" slot="suffix" aria-hidden="true"></div>
139
+ <div id="toggleButton" part="field-button toggle-button" slot="suffix" aria-hidden="true"></div>
140
+ </vaadin-multi-select-combo-box-container>
178
141
 
179
142
  <div part="helper-text">
180
143
  <slot name="helper"></slot>
@@ -185,34 +148,23 @@ class MultiSelectComboBox extends MultiSelectComboBoxMixin(ThemableMixin(Element
185
148
  </div>
186
149
  </div>
187
150
 
151
+ <vaadin-multi-select-combo-box-overlay
152
+ id="overlay"
153
+ exportparts="overlay, content, loader"
154
+ .owner="${this}"
155
+ .dir="${this.dir}"
156
+ .opened="${this._overlayOpened}"
157
+ ?loading="${this.loading}"
158
+ theme="${ifDefined(this._theme)}"
159
+ .positionTarget="${this._inputField}"
160
+ no-vertical-overlap
161
+ >
162
+ <slot name="overlay"></slot>
163
+ </vaadin-multi-select-combo-box-overlay>
164
+
188
165
  <slot name="tooltip"></slot>
189
166
  `;
190
167
  }
191
-
192
- /** @private */
193
- _onComboBoxFilterChanged(event) {
194
- this.filter = event.detail.value;
195
- }
196
-
197
- /** @private */
198
- _onComboBoxLoadingChanged(event) {
199
- this.loading = event.detail.value;
200
- }
201
-
202
- /** @private */
203
- _onComboBoxLastFilterChanged(event) {
204
- this._lastFilter = event.detail.value;
205
- }
206
-
207
- /** @private */
208
- _onComboBoxOpenedChanged(event) {
209
- this.opened = event.detail.value;
210
- }
211
-
212
- /** @private */
213
- _onComboBoxSizeChanged(event) {
214
- this.size = event.detail.value;
215
- }
216
168
  }
217
169
 
218
170
  defineCustomElement(MultiSelectComboBox);
@@ -1,2 +1,2 @@
1
- import './theme/lumo/vaadin-multi-select-combo-box.js';
1
+ import './src/vaadin-multi-select-combo-box.js';
2
2
  export * from './src/vaadin-multi-select-combo-box.js';