@vaadin/combo-box 25.0.0-alpha1 → 25.0.0-alpha2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +16 -14
- package/src/styles/vaadin-combo-box-base-styles.d.ts +8 -0
- package/src/styles/vaadin-combo-box-base-styles.js +17 -0
- package/src/styles/vaadin-combo-box-core-styles.d.ts +8 -0
- package/src/styles/vaadin-combo-box-core-styles.js +12 -0
- package/src/styles/vaadin-combo-box-overlay-base-styles.js +63 -0
- package/src/styles/vaadin-combo-box-overlay-core-styles.js +18 -0
- package/src/styles/vaadin-combo-box-scroller-base-styles.js +29 -0
- package/src/styles/vaadin-combo-box-scroller-core-styles.js +30 -0
- package/src/vaadin-combo-box-item.js +3 -10
- package/src/vaadin-combo-box-mixin.js +8 -20
- package/src/vaadin-combo-box-overlay.js +2 -13
- package/src/vaadin-combo-box-scroller.js +3 -24
- package/src/vaadin-combo-box.js +3 -9
- 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/combo-box",
|
|
3
|
-
"version": "25.0.0-
|
|
3
|
+
"version": "25.0.0-alpha2",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -22,6 +22,8 @@
|
|
|
22
22
|
"lit.d.ts",
|
|
23
23
|
"lit.js",
|
|
24
24
|
"src",
|
|
25
|
+
"!src/styles/*-base-styles.d.ts",
|
|
26
|
+
"!src/styles/*-base-styles.js",
|
|
25
27
|
"theme",
|
|
26
28
|
"vaadin-*.d.ts",
|
|
27
29
|
"vaadin-*.js",
|
|
@@ -36,26 +38,26 @@
|
|
|
36
38
|
],
|
|
37
39
|
"dependencies": {
|
|
38
40
|
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
39
|
-
"@vaadin/a11y-base": "25.0.0-
|
|
40
|
-
"@vaadin/component-base": "25.0.0-
|
|
41
|
-
"@vaadin/field-base": "25.0.0-
|
|
42
|
-
"@vaadin/input-container": "25.0.0-
|
|
43
|
-
"@vaadin/item": "25.0.0-
|
|
44
|
-
"@vaadin/lit-renderer": "25.0.0-
|
|
45
|
-
"@vaadin/overlay": "25.0.0-
|
|
46
|
-
"@vaadin/vaadin-lumo-styles": "25.0.0-
|
|
47
|
-
"@vaadin/vaadin-themable-mixin": "25.0.0-
|
|
41
|
+
"@vaadin/a11y-base": "25.0.0-alpha2",
|
|
42
|
+
"@vaadin/component-base": "25.0.0-alpha2",
|
|
43
|
+
"@vaadin/field-base": "25.0.0-alpha2",
|
|
44
|
+
"@vaadin/input-container": "25.0.0-alpha2",
|
|
45
|
+
"@vaadin/item": "25.0.0-alpha2",
|
|
46
|
+
"@vaadin/lit-renderer": "25.0.0-alpha2",
|
|
47
|
+
"@vaadin/overlay": "25.0.0-alpha2",
|
|
48
|
+
"@vaadin/vaadin-lumo-styles": "25.0.0-alpha2",
|
|
49
|
+
"@vaadin/vaadin-themable-mixin": "25.0.0-alpha2",
|
|
48
50
|
"lit": "^3.0.0"
|
|
49
51
|
},
|
|
50
52
|
"devDependencies": {
|
|
51
|
-
"@vaadin/chai-plugins": "25.0.0-
|
|
52
|
-
"@vaadin/test-runner-commands": "25.0.0-
|
|
53
|
-
"@vaadin/testing-helpers": "^
|
|
53
|
+
"@vaadin/chai-plugins": "25.0.0-alpha2",
|
|
54
|
+
"@vaadin/test-runner-commands": "25.0.0-alpha2",
|
|
55
|
+
"@vaadin/testing-helpers": "^2.0.0",
|
|
54
56
|
"sinon": "^18.0.0"
|
|
55
57
|
},
|
|
56
58
|
"web-types": [
|
|
57
59
|
"web-types.json",
|
|
58
60
|
"web-types.lit.json"
|
|
59
61
|
],
|
|
60
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "67ffcd5355cf21ce1b5039c598525109fc4c164b"
|
|
61
63
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) 2015 - 2025 Vaadin Ltd.
|
|
4
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
+
*/
|
|
6
|
+
import '@vaadin/component-base/src/style-props.js';
|
|
7
|
+
import { css } from 'lit';
|
|
8
|
+
|
|
9
|
+
export const comboBoxStyles = css`
|
|
10
|
+
:host([opened]) {
|
|
11
|
+
pointer-events: auto;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
[part='toggle-button']::before {
|
|
15
|
+
mask-image: var(--_vaadin-icon-chevron-down);
|
|
16
|
+
}
|
|
17
|
+
`;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) 2015 - 2025 Vaadin Ltd.
|
|
4
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
+
*/
|
|
6
|
+
import { css } from 'lit';
|
|
7
|
+
|
|
8
|
+
export const comboBoxStyles = css`
|
|
9
|
+
:host([opened]) {
|
|
10
|
+
pointer-events: auto;
|
|
11
|
+
}
|
|
12
|
+
`;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) 2015 - 2025 Vaadin Ltd.
|
|
4
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
+
*/
|
|
6
|
+
import '@vaadin/component-base/src/style-props.js';
|
|
7
|
+
import { css } from 'lit';
|
|
8
|
+
|
|
9
|
+
export const comboBoxOverlayStyles = css`
|
|
10
|
+
:host {
|
|
11
|
+
--vaadin-item-checkmark-display: block;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
[part='overlay'] {
|
|
15
|
+
position: relative;
|
|
16
|
+
width: var(--vaadin-combo-box-overlay-width, var(--_vaadin-combo-box-overlay-default-width, auto));
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
[part='loader'] {
|
|
20
|
+
animation: spin 1s linear infinite;
|
|
21
|
+
border: 2px solid;
|
|
22
|
+
--_spinner-color: var(--vaadin-combo-box-spinner-color, var(--_vaadin-color-strong));
|
|
23
|
+
border-color: var(--_spinner-color) var(--_spinner-color) hsl(from var(--_spinner-color) h s l / 0.2)
|
|
24
|
+
hsl(from var(--_spinner-color) h s l / 0.2);
|
|
25
|
+
border-radius: var(--_vaadin-radius-full);
|
|
26
|
+
box-sizing: border-box;
|
|
27
|
+
display: none;
|
|
28
|
+
height: var(--vaadin-icon-size, 1lh);
|
|
29
|
+
inset: calc(var(--vaadin-item-overlay-padding, 4px) + 2px);
|
|
30
|
+
inset-block-end: auto;
|
|
31
|
+
inset-inline-start: auto;
|
|
32
|
+
pointer-events: none;
|
|
33
|
+
position: absolute;
|
|
34
|
+
width: var(--vaadin-icon-size, 1lh);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
[part='content'] {
|
|
38
|
+
display: flex;
|
|
39
|
+
flex-direction: column;
|
|
40
|
+
height: 100%;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
:host([loading]) [part='loader'] {
|
|
44
|
+
display: block;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
:host([loading]) [part='content'] {
|
|
48
|
+
--_items-min-height: calc(var(--vaadin-icon-size, 1lh) + 4px);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
@keyframes spin {
|
|
52
|
+
to {
|
|
53
|
+
rotate: 1turn;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
@media (forced-colors: active) {
|
|
58
|
+
[part='loader'] {
|
|
59
|
+
forced-color-adjust: none;
|
|
60
|
+
--vaadin-combo-box-spinner-color: CanvasText;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
`;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) 2015 - 2025 Vaadin Ltd.
|
|
4
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
+
*/
|
|
6
|
+
import { css } from 'lit';
|
|
7
|
+
|
|
8
|
+
export const comboBoxOverlayStyles = css`
|
|
9
|
+
#overlay {
|
|
10
|
+
width: var(--vaadin-combo-box-overlay-width, var(--_vaadin-combo-box-overlay-default-width, auto));
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
[part='content'] {
|
|
14
|
+
display: flex;
|
|
15
|
+
flex-direction: column;
|
|
16
|
+
height: 100%;
|
|
17
|
+
}
|
|
18
|
+
`;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) 2015 - 2025 Vaadin Ltd.
|
|
4
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
+
*/
|
|
6
|
+
import { css } from 'lit';
|
|
7
|
+
|
|
8
|
+
export const comboBoxScrollerStyles = css`
|
|
9
|
+
:host {
|
|
10
|
+
/* Fixes scrollbar disappearing when 'Show scroll bars: Always' enabled in Safari */
|
|
11
|
+
box-shadow: 0 0 0 white;
|
|
12
|
+
display: block;
|
|
13
|
+
min-height: 1px;
|
|
14
|
+
overflow: auto;
|
|
15
|
+
/* Fixes item background from getting on top of scrollbars on Safari */
|
|
16
|
+
transform: translate3d(0, 0, 0);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
#selector {
|
|
20
|
+
border: var(--vaadin-item-overlay-padding, 4px) solid transparent;
|
|
21
|
+
position: relative;
|
|
22
|
+
forced-color-adjust: none;
|
|
23
|
+
min-height: var(--_items-min-height, auto);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
#selector > * {
|
|
27
|
+
forced-color-adjust: auto;
|
|
28
|
+
}
|
|
29
|
+
`;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) 2015 - 2025 Vaadin Ltd.
|
|
4
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
+
*/
|
|
6
|
+
import { css } from 'lit';
|
|
7
|
+
|
|
8
|
+
export const comboBoxScrollerStyles = css`
|
|
9
|
+
:host {
|
|
10
|
+
display: block;
|
|
11
|
+
min-height: 1px;
|
|
12
|
+
overflow: auto;
|
|
13
|
+
|
|
14
|
+
/* Fixes item background from getting on top of scrollbars on Safari */
|
|
15
|
+
transform: translate3d(0, 0, 0);
|
|
16
|
+
|
|
17
|
+
/* Enable momentum scrolling on iOS */
|
|
18
|
+
-webkit-overflow-scrolling: touch;
|
|
19
|
+
|
|
20
|
+
/* Fixes scrollbar disappearing when 'Show scroll bars: Always' enabled in Safari */
|
|
21
|
+
box-shadow: 0 0 0 white;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
#selector {
|
|
25
|
+
border-width: var(--_vaadin-combo-box-items-container-border-width);
|
|
26
|
+
border-style: var(--_vaadin-combo-box-items-container-border-style);
|
|
27
|
+
border-color: var(--_vaadin-combo-box-items-container-border-color, transparent);
|
|
28
|
+
position: relative;
|
|
29
|
+
}
|
|
30
|
+
`;
|
|
@@ -3,10 +3,11 @@
|
|
|
3
3
|
* Copyright (c) 2015 - 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 {
|
|
6
|
+
import { html, LitElement } from 'lit';
|
|
7
7
|
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
8
8
|
import { DirMixin } from '@vaadin/component-base/src/dir-mixin.js';
|
|
9
9
|
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
|
|
10
|
+
import { itemStyles } from '@vaadin/item/src/vaadin-item-core-styles.js';
|
|
10
11
|
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
11
12
|
import { ComboBoxItemMixin } from './vaadin-combo-box-item-mixin.js';
|
|
12
13
|
|
|
@@ -43,15 +44,7 @@ export class ComboBoxItem extends ComboBoxItemMixin(ThemableMixin(DirMixin(Polyl
|
|
|
43
44
|
}
|
|
44
45
|
|
|
45
46
|
static get styles() {
|
|
46
|
-
return
|
|
47
|
-
:host {
|
|
48
|
-
display: block;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
:host([hidden]) {
|
|
52
|
-
display: none;
|
|
53
|
-
}
|
|
54
|
-
`;
|
|
47
|
+
return itemStyles;
|
|
55
48
|
}
|
|
56
49
|
|
|
57
50
|
/** @protected */
|
|
@@ -316,26 +316,14 @@ export const ComboBoxMixin = (subclass) =>
|
|
|
316
316
|
return 'vaadin-combo-box';
|
|
317
317
|
}
|
|
318
318
|
|
|
319
|
-
/**
|
|
320
|
-
* Get a reference to the native `<input>` element.
|
|
321
|
-
* Override to provide a custom input.
|
|
322
|
-
* @protected
|
|
323
|
-
* @return {HTMLInputElement | undefined}
|
|
324
|
-
*/
|
|
325
|
-
get _nativeInput() {
|
|
326
|
-
return this.inputElement;
|
|
327
|
-
}
|
|
328
|
-
|
|
329
319
|
/**
|
|
330
320
|
* Override method inherited from `InputMixin`
|
|
331
321
|
* to customize the input element.
|
|
332
322
|
* @protected
|
|
333
323
|
* @override
|
|
334
324
|
*/
|
|
335
|
-
_inputElementChanged(
|
|
336
|
-
super._inputElementChanged(
|
|
337
|
-
|
|
338
|
-
const input = this._nativeInput;
|
|
325
|
+
_inputElementChanged(input) {
|
|
326
|
+
super._inputElementChanged(input);
|
|
339
327
|
|
|
340
328
|
if (input) {
|
|
341
329
|
input.autocomplete = 'off';
|
|
@@ -352,10 +340,6 @@ export const ComboBoxMixin = (subclass) =>
|
|
|
352
340
|
input.setAttribute('autocorrect', 'off');
|
|
353
341
|
|
|
354
342
|
this._revertInputValueToValue();
|
|
355
|
-
|
|
356
|
-
if (this.clearElement) {
|
|
357
|
-
this.clearElement.addEventListener('mousedown', this._boundOnClearButtonMouseDown);
|
|
358
|
-
}
|
|
359
343
|
}
|
|
360
344
|
}
|
|
361
345
|
|
|
@@ -371,6 +355,10 @@ export const ComboBoxMixin = (subclass) =>
|
|
|
371
355
|
this.addEventListener('click', this._boundOnClick);
|
|
372
356
|
this.addEventListener('touchend', this._boundOnTouchend);
|
|
373
357
|
|
|
358
|
+
if (this.clearElement) {
|
|
359
|
+
this.clearElement.addEventListener('mousedown', this._boundOnClearButtonMouseDown);
|
|
360
|
+
}
|
|
361
|
+
|
|
374
362
|
const bringToFrontListener = () => {
|
|
375
363
|
requestAnimationFrame(() => {
|
|
376
364
|
this._overlayElement.bringToFront();
|
|
@@ -557,7 +545,7 @@ export const ComboBoxMixin = (subclass) =>
|
|
|
557
545
|
|
|
558
546
|
/** @private */
|
|
559
547
|
_updateActiveDescendant(index) {
|
|
560
|
-
const input = this.
|
|
548
|
+
const input = this.inputElement;
|
|
561
549
|
if (!input) {
|
|
562
550
|
return;
|
|
563
551
|
}
|
|
@@ -589,7 +577,7 @@ export const ComboBoxMixin = (subclass) =>
|
|
|
589
577
|
this._onClosed();
|
|
590
578
|
}
|
|
591
579
|
|
|
592
|
-
const input = this.
|
|
580
|
+
const input = this.inputElement;
|
|
593
581
|
if (input) {
|
|
594
582
|
input.setAttribute('aria-expanded', !!opened);
|
|
595
583
|
|
|
@@ -3,27 +3,16 @@
|
|
|
3
3
|
* Copyright (c) 2015 - 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 {
|
|
6
|
+
import { html, LitElement } from 'lit';
|
|
7
7
|
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
8
8
|
import { DirMixin } from '@vaadin/component-base/src/dir-mixin.js';
|
|
9
9
|
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
|
|
10
10
|
import { OverlayMixin } from '@vaadin/overlay/src/vaadin-overlay-mixin.js';
|
|
11
11
|
import { overlayStyles } from '@vaadin/overlay/src/vaadin-overlay-styles.js';
|
|
12
12
|
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
13
|
+
import { comboBoxOverlayStyles } from './styles/vaadin-combo-box-overlay-core-styles.js';
|
|
13
14
|
import { ComboBoxOverlayMixin } from './vaadin-combo-box-overlay-mixin.js';
|
|
14
15
|
|
|
15
|
-
const comboBoxOverlayStyles = css`
|
|
16
|
-
#overlay {
|
|
17
|
-
width: var(--vaadin-combo-box-overlay-width, var(--_vaadin-combo-box-overlay-default-width, auto));
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
[part='content'] {
|
|
21
|
-
display: flex;
|
|
22
|
-
flex-direction: column;
|
|
23
|
-
height: 100%;
|
|
24
|
-
}
|
|
25
|
-
`;
|
|
26
|
-
|
|
27
16
|
/**
|
|
28
17
|
* An element used internally by `<vaadin-combo-box>`. Not intended to be used separately.
|
|
29
18
|
*
|
|
@@ -3,9 +3,10 @@
|
|
|
3
3
|
* Copyright (c) 2015 - 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 {
|
|
6
|
+
import { html, LitElement } from 'lit';
|
|
7
7
|
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
8
8
|
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
|
|
9
|
+
import { comboBoxScrollerStyles } from './styles/vaadin-combo-box-scroller-core-styles.js';
|
|
9
10
|
import { ComboBoxScrollerMixin } from './vaadin-combo-box-scroller-mixin.js';
|
|
10
11
|
|
|
11
12
|
/**
|
|
@@ -22,29 +23,7 @@ export class ComboBoxScroller extends ComboBoxScrollerMixin(PolylitMixin(LitElem
|
|
|
22
23
|
}
|
|
23
24
|
|
|
24
25
|
static get styles() {
|
|
25
|
-
return
|
|
26
|
-
:host {
|
|
27
|
-
display: block;
|
|
28
|
-
min-height: 1px;
|
|
29
|
-
overflow: auto;
|
|
30
|
-
|
|
31
|
-
/* Fixes item background from getting on top of scrollbars on Safari */
|
|
32
|
-
transform: translate3d(0, 0, 0);
|
|
33
|
-
|
|
34
|
-
/* Enable momentum scrolling on iOS */
|
|
35
|
-
-webkit-overflow-scrolling: touch;
|
|
36
|
-
|
|
37
|
-
/* Fixes scrollbar disappearing when 'Show scroll bars: Always' enabled in Safari */
|
|
38
|
-
box-shadow: 0 0 0 white;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
#selector {
|
|
42
|
-
border-width: var(--_vaadin-combo-box-items-container-border-width);
|
|
43
|
-
border-style: var(--_vaadin-combo-box-items-container-border-style);
|
|
44
|
-
border-color: var(--_vaadin-combo-box-items-container-border-color, transparent);
|
|
45
|
-
position: relative;
|
|
46
|
-
}
|
|
47
|
-
`;
|
|
26
|
+
return comboBoxScrollerStyles;
|
|
48
27
|
}
|
|
49
28
|
|
|
50
29
|
/** @protected */
|
package/src/vaadin-combo-box.js
CHANGED
|
@@ -7,7 +7,7 @@ import '@vaadin/input-container/src/vaadin-input-container.js';
|
|
|
7
7
|
import './vaadin-combo-box-item.js';
|
|
8
8
|
import './vaadin-combo-box-overlay.js';
|
|
9
9
|
import './vaadin-combo-box-scroller.js';
|
|
10
|
-
import {
|
|
10
|
+
import { html, LitElement } from 'lit';
|
|
11
11
|
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
12
12
|
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
13
13
|
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
|
|
@@ -19,6 +19,7 @@ import { LabelledInputController } from '@vaadin/field-base/src/labelled-input-c
|
|
|
19
19
|
import { PatternMixin } from '@vaadin/field-base/src/pattern-mixin.js';
|
|
20
20
|
import { inputFieldShared } from '@vaadin/field-base/src/styles/input-field-shared-styles.js';
|
|
21
21
|
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
22
|
+
import { comboBoxStyles } from './styles/vaadin-combo-box-core-styles.js';
|
|
22
23
|
import { ComboBoxDataProviderMixin } from './vaadin-combo-box-data-provider-mixin.js';
|
|
23
24
|
import { ComboBoxMixin } from './vaadin-combo-box-mixin.js';
|
|
24
25
|
|
|
@@ -161,14 +162,7 @@ class ComboBox extends ComboBoxDataProviderMixin(
|
|
|
161
162
|
}
|
|
162
163
|
|
|
163
164
|
static get styles() {
|
|
164
|
-
return [
|
|
165
|
-
inputFieldShared,
|
|
166
|
-
css`
|
|
167
|
-
:host([opened]) {
|
|
168
|
-
pointer-events: auto;
|
|
169
|
-
}
|
|
170
|
-
`,
|
|
171
|
-
];
|
|
165
|
+
return [inputFieldShared, comboBoxStyles];
|
|
172
166
|
}
|
|
173
167
|
|
|
174
168
|
static get properties() {
|
package/web-types.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/web-types",
|
|
3
3
|
"name": "@vaadin/combo-box",
|
|
4
|
-
"version": "25.0.0-
|
|
4
|
+
"version": "25.0.0-alpha2",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"contributions": {
|
|
7
7
|
"html": {
|
|
8
8
|
"elements": [
|
|
9
9
|
{
|
|
10
10
|
"name": "vaadin-combo-box",
|
|
11
|
-
"description": "`<vaadin-combo-box>` is a web component for choosing a value from a filterable list of options\npresented in a dropdown overlay. The options can be provided as a list of strings or objects\nby setting [`items`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-
|
|
11
|
+
"description": "`<vaadin-combo-box>` is a web component for choosing a value from a filterable list of options\npresented in a dropdown overlay. The options can be provided as a list of strings or objects\nby setting [`items`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha2/#/elements/vaadin-combo-box#property-items) property on the element.\n\n```html\n<vaadin-combo-box id=\"combo-box\"></vaadin-combo-box>\n```\n```js\ndocument.querySelector('#combo-box').items = ['apple', 'orange', 'banana'];\n```\n\nWhen the selected `value` is changed, a `value-changed` event is triggered.\n\n### Item rendering\n\nTo customize the content of the `<vaadin-combo-box-item>` elements placed in the dropdown, use\n[`renderer`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha2/#/elements/vaadin-combo-box#property-renderer) property which accepts a function.\nThe renderer function is called with `root`, `comboBox`, and `model` as arguments.\n\nGenerate DOM content by using `model` object properties if needed, and append it to the `root`\nelement. The `comboBox` reference is provided to access the combo-box element state. Do not\nset combo-box properties in a `renderer` function.\n\n```js\nconst comboBox = document.querySelector('#combo-box');\ncomboBox.items = [{'label': 'Hydrogen', 'value': 'H'}];\ncomboBox.renderer = (root, comboBox, model) => {\n const item = model.item;\n root.innerHTML = `${model.index}: ${item.label} <b>${item.value}</b>`;\n};\n```\n\nRenderer is called on the opening of the combo-box and each time the related model is updated.\nBefore creating new content, it is recommended to check if there is already an existing DOM\nelement in `root` from a previous renderer call for reusing it. Even though combo-box uses\ninfinite scrolling, reducing DOM operations might improve performance.\n\nThe following properties are available in the `model` argument:\n\nProperty | Type | Description\n-----------|------------------|-------------\n`index` | Number | Index of the item in the `items` array\n`item` | String or Object | The item reference\n`selected` | Boolean | True when item is selected\n`focused` | Boolean | True when item is focused\n\n### Lazy Loading with Function Data Provider\n\nIn addition to assigning an array to the items property, you can alternatively use the\n[`dataProvider`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha2/#/elements/vaadin-combo-box#property-dataProvider) function property.\nThe `<vaadin-combo-box>` calls this function lazily, only when it needs more data\nto be displayed.\n\n__Note that when using function data providers, the total number of items\nneeds to be set manually. The total number of items can be returned\nin the second argument of the data provider callback:__\n\n```js\ncomboBox.dataProvider = async (params, callback) => {\n const API = 'https://demo.vaadin.com/demo-data/1.0/filtered-countries';\n const { filter, page, pageSize } = params;\n const index = page * pageSize;\n\n const res = await fetch(`${API}?index=${index}&count=${pageSize}&filter=${filter}`);\n if (res.ok) {\n const { result, size } = await res.json();\n callback(result, size);\n }\n};\n```\n\n### Styling\n\nThe following custom properties are available for styling:\n\nCustom property | Description | Default\n----------------------------------------|----------------------------|---------\n`--vaadin-field-default-width` | Default width of the field | `12em`\n`--vaadin-combo-box-overlay-width` | Width of the overlay | `auto`\n`--vaadin-combo-box-overlay-max-height` | Max height of the overlay | `65vh`\n\n`<vaadin-combo-box>` provides the same set of shadow DOM parts and state attributes as `<vaadin-text-field>`.\nSee [`<vaadin-text-field>`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha2/#/elements/vaadin-text-field) for the styling documentation.\n\nIn addition to `<vaadin-text-field>` parts, the following parts are available for theming:\n\nPart name | Description\n----------------|----------------\n`toggle-button` | The toggle button\n\nIn addition to `<vaadin-text-field>` state attributes, the following state attributes are available for theming:\n\nAttribute | Description | Part name\n----------|-------------|------------\n`opened` | Set when the combo box dropdown is open | :host\n`loading` | Set when new items are expected | :host\n\n### Internal components\n\nIn addition to `<vaadin-combo-box>` itself, the following internal\ncomponents are themable:\n\n- `<vaadin-combo-box-overlay>` - has the same API as [`<vaadin-overlay>`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha2/#/elements/vaadin-overlay).\n- `<vaadin-combo-box-item>` - has the same API as [`<vaadin-item>`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha2/#/elements/vaadin-item).\n- [`<vaadin-input-container>`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha2/#/elements/vaadin-input-container) - an internal element wrapping the input.\n\nNote: the `theme` attribute value set on `<vaadin-combo-box>` is\npropagated to the internal components listed above.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/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/combo-box",
|
|
4
|
-
"version": "25.0.0-
|
|
4
|
+
"version": "25.0.0-alpha2",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"framework": "lit",
|
|
7
7
|
"framework-config": {
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"elements": [
|
|
17
17
|
{
|
|
18
18
|
"name": "vaadin-combo-box",
|
|
19
|
-
"description": "`<vaadin-combo-box>` is a web component for choosing a value from a filterable list of options\npresented in a dropdown overlay. The options can be provided as a list of strings or objects\nby setting [`items`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-
|
|
19
|
+
"description": "`<vaadin-combo-box>` is a web component for choosing a value from a filterable list of options\npresented in a dropdown overlay. The options can be provided as a list of strings or objects\nby setting [`items`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha2/#/elements/vaadin-combo-box#property-items) property on the element.\n\n```html\n<vaadin-combo-box id=\"combo-box\"></vaadin-combo-box>\n```\n```js\ndocument.querySelector('#combo-box').items = ['apple', 'orange', 'banana'];\n```\n\nWhen the selected `value` is changed, a `value-changed` event is triggered.\n\n### Item rendering\n\nTo customize the content of the `<vaadin-combo-box-item>` elements placed in the dropdown, use\n[`renderer`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha2/#/elements/vaadin-combo-box#property-renderer) property which accepts a function.\nThe renderer function is called with `root`, `comboBox`, and `model` as arguments.\n\nGenerate DOM content by using `model` object properties if needed, and append it to the `root`\nelement. The `comboBox` reference is provided to access the combo-box element state. Do not\nset combo-box properties in a `renderer` function.\n\n```js\nconst comboBox = document.querySelector('#combo-box');\ncomboBox.items = [{'label': 'Hydrogen', 'value': 'H'}];\ncomboBox.renderer = (root, comboBox, model) => {\n const item = model.item;\n root.innerHTML = `${model.index}: ${item.label} <b>${item.value}</b>`;\n};\n```\n\nRenderer is called on the opening of the combo-box and each time the related model is updated.\nBefore creating new content, it is recommended to check if there is already an existing DOM\nelement in `root` from a previous renderer call for reusing it. Even though combo-box uses\ninfinite scrolling, reducing DOM operations might improve performance.\n\nThe following properties are available in the `model` argument:\n\nProperty | Type | Description\n-----------|------------------|-------------\n`index` | Number | Index of the item in the `items` array\n`item` | String or Object | The item reference\n`selected` | Boolean | True when item is selected\n`focused` | Boolean | True when item is focused\n\n### Lazy Loading with Function Data Provider\n\nIn addition to assigning an array to the items property, you can alternatively use the\n[`dataProvider`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha2/#/elements/vaadin-combo-box#property-dataProvider) function property.\nThe `<vaadin-combo-box>` calls this function lazily, only when it needs more data\nto be displayed.\n\n__Note that when using function data providers, the total number of items\nneeds to be set manually. The total number of items can be returned\nin the second argument of the data provider callback:__\n\n```js\ncomboBox.dataProvider = async (params, callback) => {\n const API = 'https://demo.vaadin.com/demo-data/1.0/filtered-countries';\n const { filter, page, pageSize } = params;\n const index = page * pageSize;\n\n const res = await fetch(`${API}?index=${index}&count=${pageSize}&filter=${filter}`);\n if (res.ok) {\n const { result, size } = await res.json();\n callback(result, size);\n }\n};\n```\n\n### Styling\n\nThe following custom properties are available for styling:\n\nCustom property | Description | Default\n----------------------------------------|----------------------------|---------\n`--vaadin-field-default-width` | Default width of the field | `12em`\n`--vaadin-combo-box-overlay-width` | Width of the overlay | `auto`\n`--vaadin-combo-box-overlay-max-height` | Max height of the overlay | `65vh`\n\n`<vaadin-combo-box>` provides the same set of shadow DOM parts and state attributes as `<vaadin-text-field>`.\nSee [`<vaadin-text-field>`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha2/#/elements/vaadin-text-field) for the styling documentation.\n\nIn addition to `<vaadin-text-field>` parts, the following parts are available for theming:\n\nPart name | Description\n----------------|----------------\n`toggle-button` | The toggle button\n\nIn addition to `<vaadin-text-field>` state attributes, the following state attributes are available for theming:\n\nAttribute | Description | Part name\n----------|-------------|------------\n`opened` | Set when the combo box dropdown is open | :host\n`loading` | Set when new items are expected | :host\n\n### Internal components\n\nIn addition to `<vaadin-combo-box>` itself, the following internal\ncomponents are themable:\n\n- `<vaadin-combo-box-overlay>` - has the same API as [`<vaadin-overlay>`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha2/#/elements/vaadin-overlay).\n- `<vaadin-combo-box-item>` - has the same API as [`<vaadin-item>`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha2/#/elements/vaadin-item).\n- [`<vaadin-input-container>`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha2/#/elements/vaadin-input-container) - an internal element wrapping the input.\n\nNote: the `theme` attribute value set on `<vaadin-combo-box>` is\npropagated to the internal components listed above.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
|
|
20
20
|
"extension": true,
|
|
21
21
|
"attributes": [
|
|
22
22
|
{
|