@vaadin/combo-box 24.0.0-alpha9 → 24.0.0-beta2
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 +13 -13
- package/src/vaadin-combo-box-data-provider-mixin.js +4 -6
- package/src/vaadin-combo-box-item-mixin.d.ts +65 -0
- package/src/vaadin-combo-box-item-mixin.js +127 -0
- package/src/vaadin-combo-box-item.d.ts +45 -0
- package/src/vaadin-combo-box-item.js +3 -114
- package/src/vaadin-combo-box-light.js +25 -25
- package/src/vaadin-combo-box-mixin.d.ts +4 -12
- package/src/vaadin-combo-box-mixin.js +42 -40
- package/src/vaadin-combo-box-overlay-mixin.d.ts +11 -0
- package/src/vaadin-combo-box-overlay-mixin.js +60 -0
- package/src/vaadin-combo-box-overlay.d.ts +20 -0
- package/src/vaadin-combo-box-overlay.js +12 -45
- package/src/vaadin-combo-box-scroller-mixin.d.ts +82 -0
- package/src/vaadin-combo-box-scroller-mixin.js +361 -0
- package/src/vaadin-combo-box-scroller.d.ts +19 -0
- package/src/vaadin-combo-box-scroller.js +5 -345
- package/src/vaadin-combo-box.d.ts +2 -0
- package/src/vaadin-combo-box.js +5 -4
- package/theme/lumo/vaadin-combo-box-item-styles.js +2 -0
- package/theme/lumo/vaadin-combo-box-light.js +1 -1
- package/theme/lumo/{vaadin-combo-box-dropdown-styles.js → vaadin-combo-box-overlay-styles.js} +21 -13
- package/theme/lumo/vaadin-combo-box.js +1 -1
- package/theme/material/vaadin-combo-box-item-styles.js +2 -0
- package/theme/material/vaadin-combo-box-light.js +1 -1
- package/theme/material/{vaadin-combo-box-dropdown-styles.js → vaadin-combo-box-overlay-styles.js} +20 -9
- package/theme/material/vaadin-combo-box.js +1 -1
- package/web-types.json +18 -18
- package/web-types.lit.json +6 -6
|
@@ -4,17 +4,16 @@
|
|
|
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';
|
|
7
|
-
import {
|
|
8
|
-
import { Virtualizer } from '@vaadin/component-base/src/virtualizer.js';
|
|
9
|
-
import { ComboBoxPlaceholder } from './vaadin-combo-box-placeholder.js';
|
|
7
|
+
import { ComboBoxScrollerMixin } from './vaadin-combo-box-scroller-mixin.js';
|
|
10
8
|
|
|
11
9
|
/**
|
|
12
|
-
*
|
|
10
|
+
* An element used internally by `<vaadin-combo-box>`. Not intended to be used separately.
|
|
13
11
|
*
|
|
14
12
|
* @extends HTMLElement
|
|
13
|
+
* @mixes ComboBoxScrollerMixin
|
|
15
14
|
* @private
|
|
16
15
|
*/
|
|
17
|
-
export class ComboBoxScroller extends PolymerElement {
|
|
16
|
+
export class ComboBoxScroller extends ComboBoxScrollerMixin(PolymerElement) {
|
|
18
17
|
static get is() {
|
|
19
18
|
return 'vaadin-combo-box-scroller';
|
|
20
19
|
}
|
|
@@ -40,7 +39,7 @@ export class ComboBoxScroller extends PolymerElement {
|
|
|
40
39
|
#selector {
|
|
41
40
|
border-width: var(--_vaadin-combo-box-items-container-border-width);
|
|
42
41
|
border-style: var(--_vaadin-combo-box-items-container-border-style);
|
|
43
|
-
border-color: var(--_vaadin-combo-box-items-container-border-color);
|
|
42
|
+
border-color: var(--_vaadin-combo-box-items-container-border-color, transparent);
|
|
44
43
|
}
|
|
45
44
|
</style>
|
|
46
45
|
<div id="selector">
|
|
@@ -48,345 +47,6 @@ export class ComboBoxScroller extends PolymerElement {
|
|
|
48
47
|
</div>
|
|
49
48
|
`;
|
|
50
49
|
}
|
|
51
|
-
|
|
52
|
-
static get properties() {
|
|
53
|
-
return {
|
|
54
|
-
/**
|
|
55
|
-
* A full set of items to filter the visible options from.
|
|
56
|
-
* Set to an empty array when combo-box is not opened.
|
|
57
|
-
*/
|
|
58
|
-
items: {
|
|
59
|
-
type: Array,
|
|
60
|
-
observer: '__itemsChanged',
|
|
61
|
-
},
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* Index of an item that has focus outline and is scrolled into view.
|
|
65
|
-
* The actual focus still remains in the input field.
|
|
66
|
-
*/
|
|
67
|
-
focusedIndex: {
|
|
68
|
-
type: Number,
|
|
69
|
-
observer: '__focusedIndexChanged',
|
|
70
|
-
},
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* Set to true while combo-box fetches new page from the data provider.
|
|
74
|
-
*/
|
|
75
|
-
loading: {
|
|
76
|
-
type: Boolean,
|
|
77
|
-
observer: '__loadingChanged',
|
|
78
|
-
},
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* Whether the combo-box is currently opened or not. If set to false,
|
|
82
|
-
* calling `scrollIntoView` does not have any effect.
|
|
83
|
-
*/
|
|
84
|
-
opened: {
|
|
85
|
-
type: Boolean,
|
|
86
|
-
observer: '__openedChanged',
|
|
87
|
-
},
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* The selected item from the `items` array.
|
|
91
|
-
*/
|
|
92
|
-
selectedItem: {
|
|
93
|
-
type: Object,
|
|
94
|
-
observer: '__selectedItemChanged',
|
|
95
|
-
},
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* Path for the id of the item, used to detect whether the item is selected.
|
|
99
|
-
*/
|
|
100
|
-
itemIdPath: {
|
|
101
|
-
type: String,
|
|
102
|
-
},
|
|
103
|
-
|
|
104
|
-
/**
|
|
105
|
-
* Reference to the combo-box, used by the item elements.
|
|
106
|
-
*/
|
|
107
|
-
comboBox: {
|
|
108
|
-
type: Object,
|
|
109
|
-
},
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* Function used to set a label for every combo-box item.
|
|
113
|
-
*/
|
|
114
|
-
getItemLabel: {
|
|
115
|
-
type: Object,
|
|
116
|
-
},
|
|
117
|
-
|
|
118
|
-
/**
|
|
119
|
-
* Function used to render the content of every combo-box item.
|
|
120
|
-
*/
|
|
121
|
-
renderer: {
|
|
122
|
-
type: Object,
|
|
123
|
-
observer: '__rendererChanged',
|
|
124
|
-
},
|
|
125
|
-
|
|
126
|
-
/**
|
|
127
|
-
* Used to propagate the `theme` attribute from the host element.
|
|
128
|
-
*/
|
|
129
|
-
theme: {
|
|
130
|
-
type: String,
|
|
131
|
-
},
|
|
132
|
-
};
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
constructor() {
|
|
136
|
-
super();
|
|
137
|
-
this.__boundOnItemClick = this.__onItemClick.bind(this);
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
__openedChanged(opened) {
|
|
141
|
-
if (opened) {
|
|
142
|
-
this.requestContentUpdate();
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
/** @protected */
|
|
147
|
-
ready() {
|
|
148
|
-
super.ready();
|
|
149
|
-
|
|
150
|
-
// Ensure every instance has unique ID
|
|
151
|
-
this.id = `${this.localName}-${generateUniqueId()}`;
|
|
152
|
-
|
|
153
|
-
// Allow extensions to customize tag name for the items
|
|
154
|
-
this.__hostTagName = this.constructor.is.replace('-scroller', '');
|
|
155
|
-
|
|
156
|
-
this.setAttribute('role', 'listbox');
|
|
157
|
-
|
|
158
|
-
this.addEventListener('click', (e) => e.stopPropagation());
|
|
159
|
-
|
|
160
|
-
this.__patchWheelOverScrolling();
|
|
161
|
-
|
|
162
|
-
this.__virtualizer = new Virtualizer({
|
|
163
|
-
createElements: this.__createElements.bind(this),
|
|
164
|
-
updateElement: this.__updateElement.bind(this),
|
|
165
|
-
elementsContainer: this,
|
|
166
|
-
scrollTarget: this,
|
|
167
|
-
scrollContainer: this.$.selector,
|
|
168
|
-
});
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
requestContentUpdate() {
|
|
172
|
-
this.__virtualizer.update();
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
scrollIntoView(index) {
|
|
176
|
-
if (!(this.opened && index >= 0)) {
|
|
177
|
-
return;
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
const visibleItemsCount = this._visibleItemsCount();
|
|
181
|
-
|
|
182
|
-
let targetIndex = index;
|
|
183
|
-
|
|
184
|
-
if (index > this.__virtualizer.lastVisibleIndex - 1) {
|
|
185
|
-
// Index is below the bottom, scrolling down. Make the item appear at the bottom.
|
|
186
|
-
// First scroll to target (will be at the top of the scroller) to make sure it's rendered.
|
|
187
|
-
this.__virtualizer.scrollToIndex(index);
|
|
188
|
-
// Then calculate the index for the following scroll (to get the target to bottom of the scroller).
|
|
189
|
-
targetIndex = index - visibleItemsCount + 1;
|
|
190
|
-
} else if (index > this.__virtualizer.firstVisibleIndex) {
|
|
191
|
-
// The item is already visible, scrolling is unnecessary per se. But we need to trigger iron-list to set
|
|
192
|
-
// the correct scrollTop on the scrollTarget. Scrolling to firstVisibleIndex.
|
|
193
|
-
targetIndex = this.__virtualizer.firstVisibleIndex;
|
|
194
|
-
}
|
|
195
|
-
this.__virtualizer.scrollToIndex(Math.max(0, targetIndex));
|
|
196
|
-
|
|
197
|
-
// Sometimes the item is partly below the bottom edge, detect and adjust.
|
|
198
|
-
const lastPhysicalItem = [...this.children].find(
|
|
199
|
-
(el) => !el.hidden && el.index === this.__virtualizer.lastVisibleIndex,
|
|
200
|
-
);
|
|
201
|
-
if (!lastPhysicalItem || index !== lastPhysicalItem.index) {
|
|
202
|
-
return;
|
|
203
|
-
}
|
|
204
|
-
const lastPhysicalItemRect = lastPhysicalItem.getBoundingClientRect();
|
|
205
|
-
const scrollerRect = this.getBoundingClientRect();
|
|
206
|
-
const scrollTopAdjust = lastPhysicalItemRect.bottom - scrollerRect.bottom + this._viewportTotalPaddingBottom;
|
|
207
|
-
if (scrollTopAdjust > 0) {
|
|
208
|
-
this.scrollTop += scrollTopAdjust;
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
/** @private */
|
|
213
|
-
__getAriaRole(itemIndex) {
|
|
214
|
-
return itemIndex !== undefined ? 'option' : false;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
/** @private */
|
|
218
|
-
__getAriaSelected(focusedIndex, itemIndex) {
|
|
219
|
-
return this.__isItemFocused(focusedIndex, itemIndex).toString();
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
/** @private */
|
|
223
|
-
__isItemFocused(focusedIndex, itemIndex) {
|
|
224
|
-
return !this.loading && focusedIndex === itemIndex;
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
/** @private */
|
|
228
|
-
__isItemSelected(item, selectedItem, itemIdPath) {
|
|
229
|
-
if (item instanceof ComboBoxPlaceholder) {
|
|
230
|
-
return false;
|
|
231
|
-
} else if (itemIdPath && item !== undefined && selectedItem !== undefined) {
|
|
232
|
-
return this.get(itemIdPath, item) === this.get(itemIdPath, selectedItem);
|
|
233
|
-
}
|
|
234
|
-
return item === selectedItem;
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
/** @private */
|
|
238
|
-
__itemsChanged(items) {
|
|
239
|
-
if (this.__virtualizer && items) {
|
|
240
|
-
this.__virtualizer.size = items.length;
|
|
241
|
-
this.__virtualizer.flush();
|
|
242
|
-
// Ensure the total count of items is properly announced.
|
|
243
|
-
this.setAttribute('aria-setsize', items.length);
|
|
244
|
-
this.requestContentUpdate();
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
/** @private */
|
|
249
|
-
__loadingChanged() {
|
|
250
|
-
this.requestContentUpdate();
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
/** @private */
|
|
254
|
-
__selectedItemChanged() {
|
|
255
|
-
this.requestContentUpdate();
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
/** @private */
|
|
259
|
-
__focusedIndexChanged(index, oldIndex) {
|
|
260
|
-
if (index !== oldIndex) {
|
|
261
|
-
this.requestContentUpdate();
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
// Do not jump back to the previously focused item while loading
|
|
265
|
-
// when requesting next page from the data provider on scroll.
|
|
266
|
-
if (index >= 0 && !this.loading) {
|
|
267
|
-
this.scrollIntoView(index);
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
/** @private */
|
|
272
|
-
__rendererChanged(renderer, oldRenderer) {
|
|
273
|
-
if (renderer || oldRenderer) {
|
|
274
|
-
this.requestContentUpdate();
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
/** @private */
|
|
279
|
-
__createElements(count) {
|
|
280
|
-
return [...Array(count)].map(() => {
|
|
281
|
-
const item = document.createElement(`${this.__hostTagName}-item`);
|
|
282
|
-
item.addEventListener('click', this.__boundOnItemClick);
|
|
283
|
-
// Negative tabindex prevents the item content from being focused.
|
|
284
|
-
item.tabIndex = '-1';
|
|
285
|
-
item.style.width = '100%';
|
|
286
|
-
return item;
|
|
287
|
-
});
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
/** @private */
|
|
291
|
-
__updateElement(el, index) {
|
|
292
|
-
const item = this.items[index];
|
|
293
|
-
const focusedIndex = this.focusedIndex;
|
|
294
|
-
|
|
295
|
-
el.setProperties({
|
|
296
|
-
item,
|
|
297
|
-
index,
|
|
298
|
-
label: this.getItemLabel(item),
|
|
299
|
-
selected: this.__isItemSelected(item, this.selectedItem, this.itemIdPath),
|
|
300
|
-
renderer: this.renderer,
|
|
301
|
-
focused: this.__isItemFocused(focusedIndex, index),
|
|
302
|
-
});
|
|
303
|
-
|
|
304
|
-
el.id = `${this.__hostTagName}-item-${index}`;
|
|
305
|
-
el.setAttribute('role', this.__getAriaRole(index));
|
|
306
|
-
el.setAttribute('aria-selected', this.__getAriaSelected(focusedIndex, index));
|
|
307
|
-
el.setAttribute('aria-posinset', index + 1);
|
|
308
|
-
|
|
309
|
-
if (this.theme) {
|
|
310
|
-
el.setAttribute('theme', this.theme);
|
|
311
|
-
} else {
|
|
312
|
-
el.removeAttribute('theme');
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
if (item instanceof ComboBoxPlaceholder) {
|
|
316
|
-
this.__requestItemByIndex(index);
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
/** @private */
|
|
321
|
-
__onItemClick(e) {
|
|
322
|
-
this.dispatchEvent(new CustomEvent('selection-changed', { detail: { item: e.currentTarget.item } }));
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
/**
|
|
326
|
-
* We want to prevent the kinetic scrolling energy from being transferred from the overlay contents over to the parent.
|
|
327
|
-
* Further improvement ideas: after the contents have been scrolled to the top or bottom and scrolling has stopped, it could allow
|
|
328
|
-
* scrolling the parent similarly to touch scrolling.
|
|
329
|
-
*/
|
|
330
|
-
__patchWheelOverScrolling() {
|
|
331
|
-
this.$.selector.addEventListener('wheel', (e) => {
|
|
332
|
-
const scrolledToTop = this.scrollTop === 0;
|
|
333
|
-
const scrolledToBottom = this.scrollHeight - this.scrollTop - this.clientHeight <= 1;
|
|
334
|
-
if (scrolledToTop && e.deltaY < 0) {
|
|
335
|
-
e.preventDefault();
|
|
336
|
-
} else if (scrolledToBottom && e.deltaY > 0) {
|
|
337
|
-
e.preventDefault();
|
|
338
|
-
}
|
|
339
|
-
});
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
get _viewportTotalPaddingBottom() {
|
|
343
|
-
if (this._cachedViewportTotalPaddingBottom === undefined) {
|
|
344
|
-
const itemsStyle = window.getComputedStyle(this.$.selector);
|
|
345
|
-
this._cachedViewportTotalPaddingBottom = [itemsStyle.paddingBottom, itemsStyle.borderBottomWidth]
|
|
346
|
-
.map((v) => {
|
|
347
|
-
return parseInt(v, 10);
|
|
348
|
-
})
|
|
349
|
-
.reduce((sum, v) => {
|
|
350
|
-
return sum + v;
|
|
351
|
-
});
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
return this._cachedViewportTotalPaddingBottom;
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
/**
|
|
358
|
-
* Dispatches an `index-requested` event for the given index to notify
|
|
359
|
-
* the data provider that it should start loading the page containing the requested index.
|
|
360
|
-
*
|
|
361
|
-
* The event is dispatched asynchronously to prevent an immediate page request and therefore
|
|
362
|
-
* a possible infinite recursion in case the data provider implements page request cancelation logic
|
|
363
|
-
* by invoking data provider page callbacks with an empty array.
|
|
364
|
-
* The infinite recursion may occur otherwise since invoking a data provider page callback with an empty array
|
|
365
|
-
* triggers a synchronous scroller update and, if the callback corresponds to the currently visible page,
|
|
366
|
-
* the scroller will synchronously request the page again which may lead to looping in the end.
|
|
367
|
-
* That was the case for the Flow counterpart:
|
|
368
|
-
* https://github.com/vaadin/flow-components/issues/3553#issuecomment-1239344828
|
|
369
|
-
*/
|
|
370
|
-
__requestItemByIndex(index) {
|
|
371
|
-
requestAnimationFrame(() => {
|
|
372
|
-
this.dispatchEvent(
|
|
373
|
-
new CustomEvent('index-requested', {
|
|
374
|
-
detail: {
|
|
375
|
-
index,
|
|
376
|
-
currentScrollerPos: this._oldScrollerPosition,
|
|
377
|
-
},
|
|
378
|
-
}),
|
|
379
|
-
);
|
|
380
|
-
});
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
/** @private */
|
|
384
|
-
_visibleItemsCount() {
|
|
385
|
-
// Ensure items are positioned
|
|
386
|
-
this.__virtualizer.scrollToIndex(this.__virtualizer.firstVisibleIndex);
|
|
387
|
-
const hasItems = this.__virtualizer.size > 0;
|
|
388
|
-
return hasItems ? this.__virtualizer.lastVisibleIndex - this.__virtualizer.firstVisibleIndex + 1 : 0;
|
|
389
|
-
}
|
|
390
50
|
}
|
|
391
51
|
|
|
392
52
|
customElements.define(ComboBoxScroller.is, ComboBoxScroller);
|
|
@@ -11,6 +11,7 @@ import type { ElementMixinClass } from '@vaadin/component-base/src/element-mixin
|
|
|
11
11
|
import type { FocusMixinClass } from '@vaadin/component-base/src/focus-mixin.js';
|
|
12
12
|
import type { KeyboardMixinClass } from '@vaadin/component-base/src/keyboard-mixin.js';
|
|
13
13
|
import type { OverlayClassMixinClass } from '@vaadin/component-base/src/overlay-class-mixin.js';
|
|
14
|
+
import type { ClearButtonMixinClass } from '@vaadin/field-base/src/clear-button-mixin.js';
|
|
14
15
|
import type { FieldMixinClass } from '@vaadin/field-base/src/field-mixin.js';
|
|
15
16
|
import type { InputConstraintsMixinClass } from '@vaadin/field-base/src/input-constraints-mixin.js';
|
|
16
17
|
import type { InputControlMixinClass } from '@vaadin/field-base/src/input-control-mixin.js';
|
|
@@ -238,6 +239,7 @@ interface ComboBox<TItem = ComboBoxDefaultItem>
|
|
|
238
239
|
KeyboardMixinClass,
|
|
239
240
|
OverlayClassMixinClass,
|
|
240
241
|
InputMixinClass,
|
|
242
|
+
ClearButtonMixinClass,
|
|
241
243
|
InputControlMixinClass,
|
|
242
244
|
InputConstraintsMixinClass,
|
|
243
245
|
FocusMixinClass,
|
package/src/vaadin-combo-box.js
CHANGED
|
@@ -287,16 +287,17 @@ class ComboBox extends ComboBoxDataProviderMixin(
|
|
|
287
287
|
}
|
|
288
288
|
|
|
289
289
|
/**
|
|
290
|
-
* Override method
|
|
291
|
-
*
|
|
290
|
+
* Override the method from `InputControlMixin`
|
|
291
|
+
* to stop event propagation to prevent `ComboBoxMixin`
|
|
292
|
+
* from handling this click event also on its own.
|
|
293
|
+
*
|
|
292
294
|
* @param {Event} event
|
|
293
295
|
* @protected
|
|
294
296
|
* @override
|
|
295
297
|
*/
|
|
296
298
|
_onClearButtonClick(event) {
|
|
297
299
|
event.stopPropagation();
|
|
298
|
-
|
|
299
|
-
this._handleClearButtonClick(event);
|
|
300
|
+
super._onClearButtonClick(event);
|
|
300
301
|
}
|
|
301
302
|
|
|
302
303
|
/**
|
package/theme/lumo/{vaadin-combo-box-dropdown-styles.js → vaadin-combo-box-overlay-styles.js}
RENAMED
|
@@ -12,14 +12,6 @@ const comboBoxOverlay = css`
|
|
|
12
12
|
padding: 0;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
:host {
|
|
16
|
-
--_vaadin-combo-box-items-container-border-width: var(--lumo-space-xs);
|
|
17
|
-
--_vaadin-combo-box-items-container-border-style: solid;
|
|
18
|
-
--_vaadin-combo-box-items-container-border-color: transparent;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/* Loading state */
|
|
22
|
-
|
|
23
15
|
/* When items are empty, the spinner needs some room */
|
|
24
16
|
:host(:not([closing])) [part~='content'] {
|
|
25
17
|
min-height: calc(2 * var(--lumo-space-s) + var(--lumo-icon-size-s));
|
|
@@ -36,7 +28,9 @@ const comboBoxOverlay = css`
|
|
|
36
28
|
:host([bottom-aligned]) [part~='overlay'] {
|
|
37
29
|
margin-bottom: var(--lumo-space-xs);
|
|
38
30
|
}
|
|
31
|
+
`;
|
|
39
32
|
|
|
33
|
+
const comboBoxLoader = css`
|
|
40
34
|
[part~='loader'] {
|
|
41
35
|
position: absolute;
|
|
42
36
|
z-index: 1;
|
|
@@ -48,8 +42,6 @@ const comboBoxOverlay = css`
|
|
|
48
42
|
margin-inline-end: 0;
|
|
49
43
|
}
|
|
50
44
|
|
|
51
|
-
/* RTL specific styles */
|
|
52
|
-
|
|
53
45
|
:host([dir='rtl']) [part~='loader'] {
|
|
54
46
|
left: auto;
|
|
55
47
|
margin-left: 0;
|
|
@@ -59,6 +51,22 @@ const comboBoxOverlay = css`
|
|
|
59
51
|
}
|
|
60
52
|
`;
|
|
61
53
|
|
|
62
|
-
registerStyles(
|
|
63
|
-
|
|
64
|
-
|
|
54
|
+
registerStyles(
|
|
55
|
+
'vaadin-combo-box-overlay',
|
|
56
|
+
[
|
|
57
|
+
overlay,
|
|
58
|
+
menuOverlayCore,
|
|
59
|
+
comboBoxOverlay,
|
|
60
|
+
loader,
|
|
61
|
+
comboBoxLoader,
|
|
62
|
+
css`
|
|
63
|
+
:host {
|
|
64
|
+
--_vaadin-combo-box-items-container-border-width: var(--lumo-space-xs);
|
|
65
|
+
--_vaadin-combo-box-items-container-border-style: solid;
|
|
66
|
+
}
|
|
67
|
+
`,
|
|
68
|
+
],
|
|
69
|
+
{ moduleId: 'lumo-combo-box-overlay' },
|
|
70
|
+
);
|
|
71
|
+
|
|
72
|
+
export { comboBoxLoader, comboBoxOverlay };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import '@vaadin/input-container/theme/lumo/vaadin-input-container.js';
|
|
2
|
-
import './vaadin-combo-box-dropdown-styles.js';
|
|
3
2
|
import './vaadin-combo-box-item-styles.js';
|
|
3
|
+
import './vaadin-combo-box-overlay-styles.js';
|
|
4
4
|
import './vaadin-combo-box-styles.js';
|
|
5
5
|
import '../../src/vaadin-combo-box.js';
|
package/theme/material/{vaadin-combo-box-dropdown-styles.js → vaadin-combo-box-overlay-styles.js}
RENAMED
|
@@ -5,12 +5,6 @@ import { menuOverlay } from '@vaadin/vaadin-material-styles/mixins/menu-overlay.
|
|
|
5
5
|
import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
6
6
|
|
|
7
7
|
const comboBoxOverlay = css`
|
|
8
|
-
:host {
|
|
9
|
-
--_vaadin-combo-box-items-container-border-width: 8px 0;
|
|
10
|
-
--_vaadin-combo-box-items-container-border-style: solid;
|
|
11
|
-
--_vaadin-combo-box-items-container-border-color: transparent;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
8
|
[part='overlay'] {
|
|
15
9
|
position: relative;
|
|
16
10
|
overflow: visible;
|
|
@@ -21,7 +15,9 @@ const comboBoxOverlay = css`
|
|
|
21
15
|
[part='content'] {
|
|
22
16
|
padding: 0;
|
|
23
17
|
}
|
|
18
|
+
`;
|
|
24
19
|
|
|
20
|
+
const comboBoxLoader = css`
|
|
25
21
|
[part~='loader'] {
|
|
26
22
|
position: absolute;
|
|
27
23
|
z-index: 1;
|
|
@@ -31,6 +27,21 @@ const comboBoxOverlay = css`
|
|
|
31
27
|
}
|
|
32
28
|
`;
|
|
33
29
|
|
|
34
|
-
registerStyles(
|
|
35
|
-
|
|
36
|
-
|
|
30
|
+
registerStyles(
|
|
31
|
+
'vaadin-combo-box-overlay',
|
|
32
|
+
[
|
|
33
|
+
menuOverlay,
|
|
34
|
+
comboBoxOverlay,
|
|
35
|
+
loader,
|
|
36
|
+
comboBoxLoader,
|
|
37
|
+
css`
|
|
38
|
+
:host {
|
|
39
|
+
--_vaadin-combo-box-items-container-border-width: 8px 0;
|
|
40
|
+
--_vaadin-combo-box-items-container-border-style: solid;
|
|
41
|
+
}
|
|
42
|
+
`,
|
|
43
|
+
],
|
|
44
|
+
{ moduleId: 'material-combo-box-overlay' },
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
export { comboBoxLoader, comboBoxOverlay };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import '@vaadin/input-container/theme/material/vaadin-input-container.js';
|
|
2
|
-
import './vaadin-combo-box-dropdown-styles.js';
|
|
3
2
|
import './vaadin-combo-box-item-styles.js';
|
|
3
|
+
import './vaadin-combo-box-overlay-styles.js';
|
|
4
4
|
import './vaadin-combo-box-styles.js';
|
|
5
5
|
import '../../src/vaadin-combo-box.js';
|