@vaadin/combo-box 24.4.0-alpha12 → 24.4.0-alpha14
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-light-mixin.d.ts +26 -0
- package/src/vaadin-combo-box-light-mixin.js +140 -0
- package/src/vaadin-combo-box-light.d.ts +2 -7
- package/src/vaadin-combo-box-light.js +3 -127
- package/src/vaadin-combo-box-mixin.js +0 -4
- package/src/vaadin-combo-box-scroller-mixin.js +1 -0
- package/web-types.json +2 -2
- package/web-types.lit.json +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/combo-box",
|
|
3
|
-
"version": "24.4.0-
|
|
3
|
+
"version": "24.4.0-alpha14",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -38,21 +38,21 @@
|
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
40
40
|
"@polymer/polymer": "^3.0.0",
|
|
41
|
-
"@vaadin/a11y-base": "24.4.0-
|
|
42
|
-
"@vaadin/component-base": "24.4.0-
|
|
43
|
-
"@vaadin/field-base": "24.4.0-
|
|
44
|
-
"@vaadin/input-container": "24.4.0-
|
|
45
|
-
"@vaadin/item": "24.4.0-
|
|
46
|
-
"@vaadin/lit-renderer": "24.4.0-
|
|
47
|
-
"@vaadin/overlay": "24.4.0-
|
|
48
|
-
"@vaadin/vaadin-lumo-styles": "24.4.0-
|
|
49
|
-
"@vaadin/vaadin-material-styles": "24.4.0-
|
|
50
|
-
"@vaadin/vaadin-themable-mixin": "24.4.0-
|
|
41
|
+
"@vaadin/a11y-base": "24.4.0-alpha14",
|
|
42
|
+
"@vaadin/component-base": "24.4.0-alpha14",
|
|
43
|
+
"@vaadin/field-base": "24.4.0-alpha14",
|
|
44
|
+
"@vaadin/input-container": "24.4.0-alpha14",
|
|
45
|
+
"@vaadin/item": "24.4.0-alpha14",
|
|
46
|
+
"@vaadin/lit-renderer": "24.4.0-alpha14",
|
|
47
|
+
"@vaadin/overlay": "24.4.0-alpha14",
|
|
48
|
+
"@vaadin/vaadin-lumo-styles": "24.4.0-alpha14",
|
|
49
|
+
"@vaadin/vaadin-material-styles": "24.4.0-alpha14",
|
|
50
|
+
"@vaadin/vaadin-themable-mixin": "24.4.0-alpha14"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@esm-bundle/chai": "^4.3.4",
|
|
54
54
|
"@vaadin/testing-helpers": "^0.6.0",
|
|
55
|
-
"@vaadin/text-field": "24.4.0-
|
|
55
|
+
"@vaadin/text-field": "24.4.0-alpha14",
|
|
56
56
|
"lit": "^3.0.0",
|
|
57
57
|
"sinon": "^13.0.2"
|
|
58
58
|
},
|
|
@@ -60,5 +60,5 @@
|
|
|
60
60
|
"web-types.json",
|
|
61
61
|
"web-types.lit.json"
|
|
62
62
|
],
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "303c07338b748bc6036a92a92cf1733c3bc351eb"
|
|
64
64
|
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) 2015 - 2024 Vaadin Ltd.
|
|
4
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
+
*/
|
|
6
|
+
import type { Constructor } from '@open-wc/dedupe-mixin';
|
|
7
|
+
import type { ValidateMixinClass } from '@vaadin/field-base/src/validate-mixin.js';
|
|
8
|
+
import type { ComboBoxDataProviderMixinClass } from './vaadin-combo-box-data-provider-mixin.js';
|
|
9
|
+
import type { ComboBoxMixinClass } from './vaadin-combo-box-mixin.js';
|
|
10
|
+
|
|
11
|
+
export declare function ComboBoxLightMixin<TItem, T extends Constructor<HTMLElement>>(
|
|
12
|
+
base: T,
|
|
13
|
+
): Constructor<ComboBoxDataProviderMixinClass<TItem>> &
|
|
14
|
+
Constructor<ComboBoxLightMixinClass> &
|
|
15
|
+
Constructor<ComboBoxMixinClass<TItem>> &
|
|
16
|
+
Constructor<ValidateMixinClass> &
|
|
17
|
+
T;
|
|
18
|
+
|
|
19
|
+
export declare class ComboBoxLightMixinClass {
|
|
20
|
+
/**
|
|
21
|
+
* Name of the two-way data-bindable property representing the
|
|
22
|
+
* value of the custom input field.
|
|
23
|
+
* @attr {string} attr-for-value
|
|
24
|
+
*/
|
|
25
|
+
attrForValue: string;
|
|
26
|
+
}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) 2015 - 2024 Vaadin Ltd.
|
|
4
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
+
*/
|
|
6
|
+
import { dashToCamelCase } from '@polymer/polymer/lib/utils/case-map.js';
|
|
7
|
+
import { afterNextRender } from '@polymer/polymer/lib/utils/render-status.js';
|
|
8
|
+
import { ValidateMixin } from '@vaadin/field-base/src/validate-mixin.js';
|
|
9
|
+
import { ComboBoxDataProviderMixin } from './vaadin-combo-box-data-provider-mixin.js';
|
|
10
|
+
import { ComboBoxMixin } from './vaadin-combo-box-mixin.js';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @polymerMixin
|
|
14
|
+
* @mixes ComboBoxDataProviderMixin
|
|
15
|
+
* @mixes ComboBoxMixin
|
|
16
|
+
* @mixes ValidateMixin
|
|
17
|
+
*/
|
|
18
|
+
export const ComboBoxLightMixin = (superClass) =>
|
|
19
|
+
class ComboBoxLightMixinClass extends ComboBoxDataProviderMixin(ComboBoxMixin(ValidateMixin(superClass))) {
|
|
20
|
+
static get properties() {
|
|
21
|
+
return {
|
|
22
|
+
/**
|
|
23
|
+
* Name of the two-way data-bindable property representing the
|
|
24
|
+
* value of the custom input field.
|
|
25
|
+
* @attr {string} attr-for-value
|
|
26
|
+
* @type {string}
|
|
27
|
+
*/
|
|
28
|
+
attrForValue: {
|
|
29
|
+
type: String,
|
|
30
|
+
value: 'value',
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Used by `InputControlMixin` as a reference to the clear button element.
|
|
37
|
+
* @protected
|
|
38
|
+
* @return {!HTMLElement}
|
|
39
|
+
*/
|
|
40
|
+
get clearElement() {
|
|
41
|
+
return this.querySelector('.clear-button');
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Override this getter from `InputMixin` to allow using
|
|
46
|
+
* an arbitrary property name instead of `value`
|
|
47
|
+
* for accessing the input element's value.
|
|
48
|
+
*
|
|
49
|
+
* @protected
|
|
50
|
+
* @override
|
|
51
|
+
* @return {string}
|
|
52
|
+
*/
|
|
53
|
+
get _inputElementValueProperty() {
|
|
54
|
+
return dashToCamelCase(this.attrForValue);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* @protected
|
|
59
|
+
* @override
|
|
60
|
+
* @return {HTMLInputElement | undefined}
|
|
61
|
+
*/
|
|
62
|
+
get _nativeInput() {
|
|
63
|
+
const input = this.inputElement;
|
|
64
|
+
|
|
65
|
+
if (input) {
|
|
66
|
+
// Support `<input class="input">`
|
|
67
|
+
if (input instanceof HTMLInputElement) {
|
|
68
|
+
return input;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// Support `<input>` in light DOM (e.g. `vaadin-text-field`)
|
|
72
|
+
const slottedInput = input.querySelector('input');
|
|
73
|
+
if (slottedInput) {
|
|
74
|
+
return slottedInput;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if (input.shadowRoot) {
|
|
78
|
+
// Support `<input>` in Shadow DOM (e.g. `mwc-textfield`)
|
|
79
|
+
const shadowInput = input.shadowRoot.querySelector('input');
|
|
80
|
+
if (shadowInput) {
|
|
81
|
+
return shadowInput;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return undefined;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/** @protected */
|
|
90
|
+
ready() {
|
|
91
|
+
super.ready();
|
|
92
|
+
|
|
93
|
+
this._toggleElement = this.querySelector('.toggle-button');
|
|
94
|
+
|
|
95
|
+
// Wait until the slotted input DOM is ready
|
|
96
|
+
afterNextRender(this, () => {
|
|
97
|
+
this._setInputElement(this.querySelector('vaadin-text-field,.input'));
|
|
98
|
+
this._revertInputValue();
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Returns true if the current input value satisfies all constraints (if any).
|
|
104
|
+
* @return {boolean}
|
|
105
|
+
*/
|
|
106
|
+
checkValidity() {
|
|
107
|
+
if (this.inputElement && this.inputElement.validate) {
|
|
108
|
+
return this.inputElement.validate();
|
|
109
|
+
}
|
|
110
|
+
return super.checkValidity();
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* @protected
|
|
115
|
+
* @override
|
|
116
|
+
*/
|
|
117
|
+
_isClearButton(event) {
|
|
118
|
+
return (
|
|
119
|
+
super._isClearButton(event) ||
|
|
120
|
+
(event.type === 'input' && !event.isTrusted) || // Fake input event dispatched by clear button
|
|
121
|
+
event.composedPath()[0].getAttribute('part') === 'clear-button'
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* @protected
|
|
127
|
+
* @override
|
|
128
|
+
*/
|
|
129
|
+
_shouldRemoveFocus(event) {
|
|
130
|
+
const isBlurringControlButtons = event.target === this._toggleElement || event.target === this.clearElement;
|
|
131
|
+
const isFocusingInputElement = event.relatedTarget && event.relatedTarget === this._nativeInput;
|
|
132
|
+
|
|
133
|
+
// prevent closing the overlay when moving focus from clear or toggle buttons to the internal input
|
|
134
|
+
if (isBlurringControlButtons && isFocusingInputElement) {
|
|
135
|
+
return false;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
return super._shouldRemoveFocus(event);
|
|
139
|
+
}
|
|
140
|
+
};
|
|
@@ -11,6 +11,7 @@ import type { ValidateMixinClass } from '@vaadin/field-base/src/validate-mixin.j
|
|
|
11
11
|
import type { ThemableMixinClass } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
12
12
|
import type { ThemePropertyMixinClass } from '@vaadin/vaadin-themable-mixin/vaadin-theme-property-mixin.js';
|
|
13
13
|
import type { ComboBoxDataProviderMixinClass } from './vaadin-combo-box-data-provider-mixin.js';
|
|
14
|
+
import type { ComboBoxLightMixinClass } from './vaadin-combo-box-light-mixin.js';
|
|
14
15
|
import type { ComboBoxDefaultItem, ComboBoxMixinClass } from './vaadin-combo-box-mixin.js';
|
|
15
16
|
export {
|
|
16
17
|
ComboBoxDataProvider,
|
|
@@ -126,13 +127,6 @@ export interface ComboBoxLightEventMap<TItem> extends HTMLElementEventMap {
|
|
|
126
127
|
* @fires {CustomEvent} validated - Fired whenever the field is validated.
|
|
127
128
|
*/
|
|
128
129
|
declare class ComboBoxLight<TItem = ComboBoxDefaultItem> extends HTMLElement {
|
|
129
|
-
/**
|
|
130
|
-
* Name of the two-way data-bindable property representing the
|
|
131
|
-
* value of the custom input field.
|
|
132
|
-
* @attr {string} attr-for-value
|
|
133
|
-
*/
|
|
134
|
-
attrForValue: string;
|
|
135
|
-
|
|
136
130
|
addEventListener<K extends keyof ComboBoxLightEventMap<TItem>>(
|
|
137
131
|
type: K,
|
|
138
132
|
listener: (this: ComboBoxLight<TItem>, ev: ComboBoxLightEventMap<TItem>[K]) => void,
|
|
@@ -148,6 +142,7 @@ declare class ComboBoxLight<TItem = ComboBoxDefaultItem> extends HTMLElement {
|
|
|
148
142
|
|
|
149
143
|
interface ComboBoxLight<TItem = ComboBoxDefaultItem>
|
|
150
144
|
extends ComboBoxDataProviderMixinClass<TItem>,
|
|
145
|
+
ComboBoxLightMixinClass,
|
|
151
146
|
ComboBoxMixinClass<TItem>,
|
|
152
147
|
KeyboardMixinClass,
|
|
153
148
|
InputMixinClass,
|
|
@@ -6,14 +6,10 @@
|
|
|
6
6
|
import './vaadin-combo-box-item.js';
|
|
7
7
|
import './vaadin-combo-box-overlay.js';
|
|
8
8
|
import './vaadin-combo-box-scroller.js';
|
|
9
|
-
import { dashToCamelCase } from '@polymer/polymer/lib/utils/case-map.js';
|
|
10
|
-
import { afterNextRender } from '@polymer/polymer/lib/utils/render-status.js';
|
|
11
9
|
import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
|
|
12
10
|
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
13
|
-
import { ValidateMixin } from '@vaadin/field-base/src/validate-mixin.js';
|
|
14
11
|
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
15
|
-
import {
|
|
16
|
-
import { ComboBoxMixin } from './vaadin-combo-box-mixin.js';
|
|
12
|
+
import { ComboBoxLightMixin } from './vaadin-combo-box-light-mixin.js';
|
|
17
13
|
|
|
18
14
|
/**
|
|
19
15
|
* `<vaadin-combo-box-light>` is a customizable version of the `<vaadin-combo-box>` providing
|
|
@@ -63,12 +59,10 @@ import { ComboBoxMixin } from './vaadin-combo-box-mixin.js';
|
|
|
63
59
|
*
|
|
64
60
|
* @customElement
|
|
65
61
|
* @extends HTMLElement
|
|
66
|
-
* @mixes
|
|
67
|
-
* @mixes ComboBoxMixin
|
|
62
|
+
* @mixes ComboBoxLightMixin
|
|
68
63
|
* @mixes ThemableMixin
|
|
69
|
-
* @mixes ValidateMixin
|
|
70
64
|
*/
|
|
71
|
-
class ComboBoxLight extends
|
|
65
|
+
class ComboBoxLight extends ComboBoxLightMixin(ThemableMixin(PolymerElement)) {
|
|
72
66
|
static get is() {
|
|
73
67
|
return 'vaadin-combo-box-light';
|
|
74
68
|
}
|
|
@@ -94,124 +88,6 @@ class ComboBoxLight extends ComboBoxDataProviderMixin(ComboBoxMixin(ValidateMixi
|
|
|
94
88
|
></vaadin-combo-box-overlay>
|
|
95
89
|
`;
|
|
96
90
|
}
|
|
97
|
-
|
|
98
|
-
static get properties() {
|
|
99
|
-
return {
|
|
100
|
-
/**
|
|
101
|
-
* Name of the two-way data-bindable property representing the
|
|
102
|
-
* value of the custom input field.
|
|
103
|
-
* @attr {string} attr-for-value
|
|
104
|
-
* @type {string}
|
|
105
|
-
*/
|
|
106
|
-
attrForValue: {
|
|
107
|
-
type: String,
|
|
108
|
-
value: 'value',
|
|
109
|
-
},
|
|
110
|
-
};
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
/**
|
|
114
|
-
* Used by `InputControlMixin` as a reference to the clear button element.
|
|
115
|
-
* @protected
|
|
116
|
-
* @return {!HTMLElement}
|
|
117
|
-
*/
|
|
118
|
-
get clearElement() {
|
|
119
|
-
return this.querySelector('.clear-button');
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
/**
|
|
123
|
-
* Override this getter from `InputMixin` to allow using
|
|
124
|
-
* an arbitrary property name instead of `value`
|
|
125
|
-
* for accessing the input element's value.
|
|
126
|
-
*
|
|
127
|
-
* @protected
|
|
128
|
-
* @override
|
|
129
|
-
* @return {string}
|
|
130
|
-
*/
|
|
131
|
-
get _inputElementValueProperty() {
|
|
132
|
-
return dashToCamelCase(this.attrForValue);
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
/**
|
|
136
|
-
* @protected
|
|
137
|
-
* @override
|
|
138
|
-
* @return {HTMLInputElement | undefined}
|
|
139
|
-
*/
|
|
140
|
-
get _nativeInput() {
|
|
141
|
-
const input = this.inputElement;
|
|
142
|
-
|
|
143
|
-
if (input) {
|
|
144
|
-
// Support `<input class="input">`
|
|
145
|
-
if (input instanceof HTMLInputElement) {
|
|
146
|
-
return input;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
// Support `<input>` in light DOM (e.g. `vaadin-text-field`)
|
|
150
|
-
const slottedInput = input.querySelector('input');
|
|
151
|
-
if (slottedInput) {
|
|
152
|
-
return slottedInput;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
if (input.shadowRoot) {
|
|
156
|
-
// Support `<input>` in Shadow DOM (e.g. `mwc-textfield`)
|
|
157
|
-
const shadowInput = input.shadowRoot.querySelector('input');
|
|
158
|
-
if (shadowInput) {
|
|
159
|
-
return shadowInput;
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
return undefined;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
/** @protected */
|
|
168
|
-
ready() {
|
|
169
|
-
super.ready();
|
|
170
|
-
|
|
171
|
-
this._toggleElement = this.querySelector('.toggle-button');
|
|
172
|
-
|
|
173
|
-
// Wait until the slotted input DOM is ready
|
|
174
|
-
afterNextRender(this, () => {
|
|
175
|
-
this._setInputElement(this.querySelector('vaadin-text-field,.input'));
|
|
176
|
-
this._revertInputValue();
|
|
177
|
-
});
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
/**
|
|
181
|
-
* Returns true if the current input value satisfies all constraints (if any).
|
|
182
|
-
* @return {boolean}
|
|
183
|
-
*/
|
|
184
|
-
checkValidity() {
|
|
185
|
-
if (this.inputElement && this.inputElement.validate) {
|
|
186
|
-
return this.inputElement.validate();
|
|
187
|
-
}
|
|
188
|
-
return super.checkValidity();
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
/** @protected */
|
|
192
|
-
_isClearButton(event) {
|
|
193
|
-
return (
|
|
194
|
-
super._isClearButton(event) ||
|
|
195
|
-
(event.type === 'input' && !event.isTrusted) || // Fake input event dispatched by clear button
|
|
196
|
-
event.composedPath()[0].getAttribute('part') === 'clear-button'
|
|
197
|
-
);
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
/**
|
|
201
|
-
* @protected
|
|
202
|
-
* @override
|
|
203
|
-
*/
|
|
204
|
-
_shouldRemoveFocus(event) {
|
|
205
|
-
const isBlurringControlButtons = event.target === this._toggleElement || event.target === this.clearElement;
|
|
206
|
-
const isFocusingInputElement = event.relatedTarget && event.relatedTarget === this._nativeInput;
|
|
207
|
-
|
|
208
|
-
// prevent closing the overlay when moving focus from clear or toggle buttons to the internal input
|
|
209
|
-
if (isBlurringControlButtons && isFocusingInputElement) {
|
|
210
|
-
return false;
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
return super._shouldRemoveFocus(event);
|
|
214
|
-
}
|
|
215
91
|
}
|
|
216
92
|
|
|
217
93
|
defineCustomElement(ComboBoxLight);
|
|
@@ -542,7 +542,6 @@ export const ComboBoxMixin = (subclass) =>
|
|
|
542
542
|
}
|
|
543
543
|
|
|
544
544
|
if (opened) {
|
|
545
|
-
this._openedWithFocusRing = this.hasAttribute('focus-ring');
|
|
546
545
|
// For touch devices, we don't want to popup virtual keyboard
|
|
547
546
|
// unless input element is explicitly focused by the user.
|
|
548
547
|
if (!this._isInputFocused() && !isTouch) {
|
|
@@ -554,9 +553,6 @@ export const ComboBoxMixin = (subclass) =>
|
|
|
554
553
|
this._overlayElement.restoreFocusOnClose = true;
|
|
555
554
|
} else {
|
|
556
555
|
this._onClosed();
|
|
557
|
-
if (this._openedWithFocusRing && this._isInputFocused()) {
|
|
558
|
-
this.setAttribute('focus-ring', '');
|
|
559
|
-
}
|
|
560
556
|
}
|
|
561
557
|
|
|
562
558
|
const input = this._nativeInput;
|
package/web-types.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": "24.4.0-
|
|
4
|
+
"version": "24.4.0-alpha14",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"contributions": {
|
|
7
7
|
"html": {
|
|
@@ -460,7 +460,7 @@
|
|
|
460
460
|
},
|
|
461
461
|
{
|
|
462
462
|
"name": "vaadin-combo-box",
|
|
463
|
-
"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/24.4.0-
|
|
463
|
+
"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/24.4.0-alpha14/#/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/24.4.0-alpha14/#/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/24.4.0-alpha14/#/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/24.4.0-alpha14/#/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\nIf you want to replace the default `<input>` and its container with a custom implementation to get full control\nover the input field, consider using the [`<vaadin-combo-box-light>`](https://cdn.vaadin.com/vaadin-web-components/24.4.0-alpha14/#/elements/vaadin-combo-box-light) element.\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/24.4.0-alpha14/#/elements/vaadin-overlay).\n- `<vaadin-combo-box-item>` - has the same API as [`<vaadin-item>`](https://cdn.vaadin.com/vaadin-web-components/24.4.0-alpha14/#/elements/vaadin-item).\n- [`<vaadin-input-container>`](https://cdn.vaadin.com/vaadin-web-components/24.4.0-alpha14/#/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.",
|
|
464
464
|
"attributes": [
|
|
465
465
|
{
|
|
466
466
|
"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": "24.4.0-
|
|
4
|
+
"version": "24.4.0-alpha14",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"framework": "lit",
|
|
7
7
|
"framework-config": {
|
|
@@ -247,7 +247,7 @@
|
|
|
247
247
|
},
|
|
248
248
|
{
|
|
249
249
|
"name": "vaadin-combo-box",
|
|
250
|
-
"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/24.4.0-
|
|
250
|
+
"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/24.4.0-alpha14/#/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/24.4.0-alpha14/#/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/24.4.0-alpha14/#/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/24.4.0-alpha14/#/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\nIf you want to replace the default `<input>` and its container with a custom implementation to get full control\nover the input field, consider using the [`<vaadin-combo-box-light>`](https://cdn.vaadin.com/vaadin-web-components/24.4.0-alpha14/#/elements/vaadin-combo-box-light) element.\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/24.4.0-alpha14/#/elements/vaadin-overlay).\n- `<vaadin-combo-box-item>` - has the same API as [`<vaadin-item>`](https://cdn.vaadin.com/vaadin-web-components/24.4.0-alpha14/#/elements/vaadin-item).\n- [`<vaadin-input-container>`](https://cdn.vaadin.com/vaadin-web-components/24.4.0-alpha14/#/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.",
|
|
251
251
|
"extension": true,
|
|
252
252
|
"attributes": [
|
|
253
253
|
{
|