@vaadin/combo-box 25.3.0-dev.3a3c2d7d2a → 25.3.0
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/custom-elements.json +158 -38
- package/package.json +14 -14
- package/src/vaadin-combo-box-base-mixin.js +65 -13
- package/src/vaadin-combo-box-data-provider-mixin.js +15 -9
- package/src/vaadin-combo-box-focus-index-mixin.js +5 -0
- package/src/vaadin-combo-box-item-mixin.js +1 -1
- package/src/vaadin-combo-box-item.js +4 -3
- package/src/vaadin-combo-box-items-mixin.d.ts +45 -0
- package/src/vaadin-combo-box-items-mixin.js +167 -4
- package/src/vaadin-combo-box-mixin.d.ts +0 -17
- package/src/vaadin-combo-box-mixin.js +7 -112
- package/src/vaadin-combo-box-overlay-mixin.js +10 -13
- package/src/vaadin-combo-box-overlay.js +4 -1
- package/src/vaadin-combo-box-placeholder.d.ts +20 -0
- package/src/vaadin-combo-box-scroller-mixin.d.ts +1 -6
- package/src/vaadin-combo-box-scroller-mixin.js +7 -19
- package/src/vaadin-combo-box-scroller.js +3 -1
- package/src/vaadin-combo-box.d.ts +43 -8
- package/src/vaadin-combo-box.js +43 -8
- package/web-types.json +47 -13
- package/web-types.lit.json +20 -6
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright (c) 2015 - 2026 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 { setOrRemoveAttribute } from '@vaadin/component-base/src/dom-utils.js';
|
|
7
7
|
import { generateUniqueId } from '@vaadin/component-base/src/unique-id-utils.js';
|
|
8
8
|
import { Virtualizer } from '@vaadin/component-base/src/virtualizer.js';
|
|
9
9
|
import { ComboBoxPlaceholder } from './vaadin-combo-box-placeholder.js';
|
|
@@ -71,13 +71,6 @@ export const ComboBoxScrollerMixin = (superClass) =>
|
|
|
71
71
|
observer: '__itemClassNameGeneratorChanged',
|
|
72
72
|
},
|
|
73
73
|
|
|
74
|
-
/**
|
|
75
|
-
* Path for the id of the item, used to detect whether the item is selected.
|
|
76
|
-
*/
|
|
77
|
-
itemIdPath: {
|
|
78
|
-
type: String,
|
|
79
|
-
},
|
|
80
|
-
|
|
81
74
|
/**
|
|
82
75
|
* Reference to the owner (combo-box owner), used by the item elements.
|
|
83
76
|
*/
|
|
@@ -243,16 +236,15 @@ export const ComboBoxScrollerMixin = (superClass) =>
|
|
|
243
236
|
/**
|
|
244
237
|
* @param {string | object} item
|
|
245
238
|
* @param {string | object} selectedItem
|
|
246
|
-
* @
|
|
239
|
+
* @return {boolean}
|
|
247
240
|
* @protected
|
|
248
241
|
*/
|
|
249
|
-
_isItemSelected(item, selectedItem
|
|
242
|
+
_isItemSelected(item, selectedItem) {
|
|
250
243
|
if (item instanceof ComboBoxPlaceholder) {
|
|
251
244
|
return false;
|
|
252
|
-
} else if (itemIdPath && item !== undefined && selectedItem !== undefined) {
|
|
253
|
-
return get(itemIdPath, item) === get(itemIdPath, selectedItem);
|
|
254
245
|
}
|
|
255
|
-
|
|
246
|
+
|
|
247
|
+
return this.owner._isSameItem(item, selectedItem);
|
|
256
248
|
}
|
|
257
249
|
|
|
258
250
|
/** @private */
|
|
@@ -366,7 +358,7 @@ export const ComboBoxScrollerMixin = (superClass) =>
|
|
|
366
358
|
_updateElement(el, index) {
|
|
367
359
|
const item = this.items[index];
|
|
368
360
|
const focusedIndex = this.focusedIndex;
|
|
369
|
-
const selected = this._isItemSelected(item, this.selectedItem
|
|
361
|
+
const selected = this._isItemSelected(item, this.selectedItem);
|
|
370
362
|
|
|
371
363
|
el.setProperties({
|
|
372
364
|
item,
|
|
@@ -389,11 +381,7 @@ export const ComboBoxScrollerMixin = (superClass) =>
|
|
|
389
381
|
el.setAttribute('aria-posinset', index + 1);
|
|
390
382
|
el.setAttribute('aria-setsize', this.items.length);
|
|
391
383
|
|
|
392
|
-
|
|
393
|
-
el.setAttribute('theme', this.theme);
|
|
394
|
-
} else {
|
|
395
|
-
el.removeAttribute('theme');
|
|
396
|
-
}
|
|
384
|
+
setOrRemoveAttribute(el, 'theme', this.theme);
|
|
397
385
|
|
|
398
386
|
if (item instanceof ComboBoxPlaceholder) {
|
|
399
387
|
this.__requestItemByIndex(index);
|
|
@@ -16,7 +16,7 @@ import { ComboBoxScrollerMixin } from './vaadin-combo-box-scroller-mixin.js';
|
|
|
16
16
|
* @extends HTMLElement
|
|
17
17
|
* @private
|
|
18
18
|
*/
|
|
19
|
-
|
|
19
|
+
class ComboBoxScroller extends ComboBoxScrollerMixin(PolylitMixin(LitElement)) {
|
|
20
20
|
static get is() {
|
|
21
21
|
return 'vaadin-combo-box-scroller';
|
|
22
22
|
}
|
|
@@ -36,3 +36,5 @@ export class ComboBoxScroller extends ComboBoxScrollerMixin(PolylitMixin(LitElem
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
defineCustomElement(ComboBoxScroller);
|
|
39
|
+
|
|
40
|
+
export { ComboBoxScroller };
|
|
@@ -30,6 +30,7 @@ export {
|
|
|
30
30
|
ComboBoxDataProviderCallback,
|
|
31
31
|
ComboBoxDataProviderParams,
|
|
32
32
|
} from './vaadin-combo-box-data-provider-mixin.js';
|
|
33
|
+
export { ComboBoxPartialMatchMode } from './vaadin-combo-box-items-mixin.js';
|
|
33
34
|
export { ComboBoxDefaultItem, ComboBoxItemModel, ComboBoxRenderer } from './vaadin-combo-box-mixin.js';
|
|
34
35
|
|
|
35
36
|
/**
|
|
@@ -167,14 +168,6 @@ export interface ComboBoxEventMap<TItem> extends HTMLElementEventMap {
|
|
|
167
168
|
*
|
|
168
169
|
* ### Styling
|
|
169
170
|
*
|
|
170
|
-
* The following custom properties are available for styling:
|
|
171
|
-
*
|
|
172
|
-
* Custom property | Description | Default
|
|
173
|
-
* ----------------------------------------|----------------------------|---------
|
|
174
|
-
* `--vaadin-field-default-width` | Default width of the field | `12em`
|
|
175
|
-
* `--vaadin-combo-box-overlay-width` | Width of the overlay | `auto`
|
|
176
|
-
* `--vaadin-combo-box-overlay-max-height` | Max height of the overlay | `65vh`
|
|
177
|
-
*
|
|
178
171
|
* The following shadow DOM parts are available for styling:
|
|
179
172
|
*
|
|
180
173
|
* Part name | Description
|
|
@@ -208,6 +201,48 @@ export interface ComboBoxEventMap<TItem> extends HTMLElementEventMap {
|
|
|
208
201
|
* `opened` | Set when the overlay is opened
|
|
209
202
|
* `loading` | Set when loading items from the data provider
|
|
210
203
|
*
|
|
204
|
+
* The following custom CSS properties are available for styling:
|
|
205
|
+
*
|
|
206
|
+
* Custom CSS property |
|
|
207
|
+
* :--------------------------------------------------|
|
|
208
|
+
* | `--vaadin-combo-box-overlay-max-height` |
|
|
209
|
+
* | `--vaadin-combo-box-overlay-width` |
|
|
210
|
+
* | `--vaadin-field-default-width` |
|
|
211
|
+
* | `--vaadin-input-field-background` |
|
|
212
|
+
* | `--vaadin-input-field-border-color` |
|
|
213
|
+
* | `--vaadin-input-field-border-radius` |
|
|
214
|
+
* | `--vaadin-input-field-border-width` |
|
|
215
|
+
* | `--vaadin-input-field-bottom-end-radius` |
|
|
216
|
+
* | `--vaadin-input-field-bottom-start-radius` |
|
|
217
|
+
* | `--vaadin-input-field-button-text-color` |
|
|
218
|
+
* | `--vaadin-input-field-container-gap` |
|
|
219
|
+
* | `--vaadin-input-field-disabled-background` |
|
|
220
|
+
* | `--vaadin-input-field-disabled-text-color` |
|
|
221
|
+
* | `--vaadin-input-field-error-color` |
|
|
222
|
+
* | `--vaadin-input-field-error-font-size` |
|
|
223
|
+
* | `--vaadin-input-field-error-font-weight` |
|
|
224
|
+
* | `--vaadin-input-field-error-line-height` |
|
|
225
|
+
* | `--vaadin-input-field-gap` |
|
|
226
|
+
* | `--vaadin-input-field-helper-color` |
|
|
227
|
+
* | `--vaadin-input-field-helper-font-size` |
|
|
228
|
+
* | `--vaadin-input-field-helper-font-weight` |
|
|
229
|
+
* | `--vaadin-input-field-helper-line-height` |
|
|
230
|
+
* | `--vaadin-input-field-label-color` |
|
|
231
|
+
* | `--vaadin-input-field-label-font-size` |
|
|
232
|
+
* | `--vaadin-input-field-label-font-weight` |
|
|
233
|
+
* | `--vaadin-input-field-label-line-height` |
|
|
234
|
+
* | `--vaadin-input-field-padding` |
|
|
235
|
+
* | `--vaadin-input-field-placeholder-color` |
|
|
236
|
+
* | `--vaadin-input-field-required-indicator` |
|
|
237
|
+
* | `--vaadin-input-field-required-indicator-color` |
|
|
238
|
+
* | `--vaadin-input-field-top-end-radius` |
|
|
239
|
+
* | `--vaadin-input-field-top-start-radius` |
|
|
240
|
+
* | `--vaadin-input-field-value-color` |
|
|
241
|
+
* | `--vaadin-input-field-value-font-size` |
|
|
242
|
+
* | `--vaadin-input-field-value-font-weight` |
|
|
243
|
+
* | `--vaadin-input-field-value-line-height` |
|
|
244
|
+
* | `--vaadin-item-overlay-padding` |
|
|
245
|
+
*
|
|
211
246
|
* ### Internal components
|
|
212
247
|
*
|
|
213
248
|
* In addition to `<vaadin-combo-box>` itself, the following internal
|
package/src/vaadin-combo-box.js
CHANGED
|
@@ -100,14 +100,6 @@ import { ComboBoxMixin } from './vaadin-combo-box-mixin.js';
|
|
|
100
100
|
*
|
|
101
101
|
* ### Styling
|
|
102
102
|
*
|
|
103
|
-
* The following custom properties are available for styling:
|
|
104
|
-
*
|
|
105
|
-
* Custom property | Description | Default
|
|
106
|
-
* ----------------------------------------|----------------------------|---------
|
|
107
|
-
* `--vaadin-field-default-width` | Default width of the field | `12em`
|
|
108
|
-
* `--vaadin-combo-box-overlay-width` | Width of the overlay | `auto`
|
|
109
|
-
* `--vaadin-combo-box-overlay-max-height` | Max height of the overlay | `65vh`
|
|
110
|
-
*
|
|
111
103
|
* The following shadow DOM parts are available for styling:
|
|
112
104
|
*
|
|
113
105
|
* Part name | Description
|
|
@@ -141,6 +133,48 @@ import { ComboBoxMixin } from './vaadin-combo-box-mixin.js';
|
|
|
141
133
|
* `opened` | Set when the overlay is opened
|
|
142
134
|
* `loading` | Set when loading items from the data provider
|
|
143
135
|
*
|
|
136
|
+
* The following custom CSS properties are available for styling:
|
|
137
|
+
*
|
|
138
|
+
* Custom CSS property |
|
|
139
|
+
* :--------------------------------------------------|
|
|
140
|
+
* | `--vaadin-combo-box-overlay-max-height` |
|
|
141
|
+
* | `--vaadin-combo-box-overlay-width` |
|
|
142
|
+
* | `--vaadin-field-default-width` |
|
|
143
|
+
* | `--vaadin-input-field-background` |
|
|
144
|
+
* | `--vaadin-input-field-border-color` |
|
|
145
|
+
* | `--vaadin-input-field-border-radius` |
|
|
146
|
+
* | `--vaadin-input-field-border-width` |
|
|
147
|
+
* | `--vaadin-input-field-bottom-end-radius` |
|
|
148
|
+
* | `--vaadin-input-field-bottom-start-radius` |
|
|
149
|
+
* | `--vaadin-input-field-button-text-color` |
|
|
150
|
+
* | `--vaadin-input-field-container-gap` |
|
|
151
|
+
* | `--vaadin-input-field-disabled-background` |
|
|
152
|
+
* | `--vaadin-input-field-disabled-text-color` |
|
|
153
|
+
* | `--vaadin-input-field-error-color` |
|
|
154
|
+
* | `--vaadin-input-field-error-font-size` |
|
|
155
|
+
* | `--vaadin-input-field-error-font-weight` |
|
|
156
|
+
* | `--vaadin-input-field-error-line-height` |
|
|
157
|
+
* | `--vaadin-input-field-gap` |
|
|
158
|
+
* | `--vaadin-input-field-helper-color` |
|
|
159
|
+
* | `--vaadin-input-field-helper-font-size` |
|
|
160
|
+
* | `--vaadin-input-field-helper-font-weight` |
|
|
161
|
+
* | `--vaadin-input-field-helper-line-height` |
|
|
162
|
+
* | `--vaadin-input-field-label-color` |
|
|
163
|
+
* | `--vaadin-input-field-label-font-size` |
|
|
164
|
+
* | `--vaadin-input-field-label-font-weight` |
|
|
165
|
+
* | `--vaadin-input-field-label-line-height` |
|
|
166
|
+
* | `--vaadin-input-field-padding` |
|
|
167
|
+
* | `--vaadin-input-field-placeholder-color` |
|
|
168
|
+
* | `--vaadin-input-field-required-indicator` |
|
|
169
|
+
* | `--vaadin-input-field-required-indicator-color` |
|
|
170
|
+
* | `--vaadin-input-field-top-end-radius` |
|
|
171
|
+
* | `--vaadin-input-field-top-start-radius` |
|
|
172
|
+
* | `--vaadin-input-field-value-color` |
|
|
173
|
+
* | `--vaadin-input-field-value-font-size` |
|
|
174
|
+
* | `--vaadin-input-field-value-font-weight` |
|
|
175
|
+
* | `--vaadin-input-field-value-line-height` |
|
|
176
|
+
* | `--vaadin-item-overlay-padding` |
|
|
177
|
+
*
|
|
144
178
|
* ### Internal components
|
|
145
179
|
*
|
|
146
180
|
* In addition to `<vaadin-combo-box>` itself, the following internal
|
|
@@ -161,6 +195,7 @@ import { ComboBoxMixin } from './vaadin-combo-box-mixin.js';
|
|
|
161
195
|
* @fires {CustomEvent} vaadin-combo-box-dropdown-opened - Fired after the `vaadin-combo-box-overlay` opens.
|
|
162
196
|
* @fires {CustomEvent} vaadin-combo-box-dropdown-closed - Fired after the `vaadin-combo-box-overlay` closes.
|
|
163
197
|
*
|
|
198
|
+
* @attr {string} theme - The theme variants to apply to the component.
|
|
164
199
|
* @customElement vaadin-combo-box
|
|
165
200
|
* @extends HTMLElement
|
|
166
201
|
*/
|
package/web-types.json
CHANGED
|
@@ -1,18 +1,27 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/web-types",
|
|
3
3
|
"name": "@vaadin/combo-box",
|
|
4
|
-
"version": "25.3.0
|
|
4
|
+
"version": "25.3.0",
|
|
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.3.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.3.0/#/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.3.0/#/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.3.0/#/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 shadow DOM parts are available for styling:\n\nPart name | Description\n---------------------|----------------\n`label` | The label element\n`input-field` | The element that wraps prefix, value and buttons\n`field-button` | Set on both clear and toggle buttons\n`clear-button` | The clear button\n`error-message` | The error message element\n`helper-text` | The helper text element wrapper\n`required-indicator` | The `required` state indicator element\n`toggle-button` | The toggle button\n`overlay` | The overlay container\n`content` | The overlay content\n`loader` | The loading indicator shown while loading items\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n---------------------|---------------------------------\n`disabled` | Set when the element is disabled\n`has-value` | Set when the element has a value\n`has-label` | Set when the element has a label\n`has-helper` | Set when the element has helper text or slot\n`has-error-message` | Set when the element has an error message\n`has-tooltip` | Set when the element has a slotted tooltip\n`invalid` | Set when the element is invalid\n`focused` | Set when the element is focused\n`focus-ring` | Set when the element is keyboard focused\n`readonly` | Set when the element is readonly\n`opened` | Set when the overlay is opened\n`loading` | Set when loading items from the data provider\n\nThe following custom CSS properties are available for styling:\n\nCustom CSS property |\n:--------------------------------------------------|\n| `--vaadin-combo-box-overlay-max-height` |\n| `--vaadin-combo-box-overlay-width` |\n| `--vaadin-field-default-width` |\n| `--vaadin-input-field-background` |\n| `--vaadin-input-field-border-color` |\n| `--vaadin-input-field-border-radius` |\n| `--vaadin-input-field-border-width` |\n| `--vaadin-input-field-bottom-end-radius` |\n| `--vaadin-input-field-bottom-start-radius` |\n| `--vaadin-input-field-button-text-color` |\n| `--vaadin-input-field-container-gap` |\n| `--vaadin-input-field-disabled-background` |\n| `--vaadin-input-field-disabled-text-color` |\n| `--vaadin-input-field-error-color` |\n| `--vaadin-input-field-error-font-size` |\n| `--vaadin-input-field-error-font-weight` |\n| `--vaadin-input-field-error-line-height` |\n| `--vaadin-input-field-gap` |\n| `--vaadin-input-field-helper-color` |\n| `--vaadin-input-field-helper-font-size` |\n| `--vaadin-input-field-helper-font-weight` |\n| `--vaadin-input-field-helper-line-height` |\n| `--vaadin-input-field-label-color` |\n| `--vaadin-input-field-label-font-size` |\n| `--vaadin-input-field-label-font-weight` |\n| `--vaadin-input-field-label-line-height` |\n| `--vaadin-input-field-padding` |\n| `--vaadin-input-field-placeholder-color` |\n| `--vaadin-input-field-required-indicator` |\n| `--vaadin-input-field-required-indicator-color` |\n| `--vaadin-input-field-top-end-radius` |\n| `--vaadin-input-field-top-start-radius` |\n| `--vaadin-input-field-value-color` |\n| `--vaadin-input-field-value-font-size` |\n| `--vaadin-input-field-value-font-weight` |\n| `--vaadin-input-field-value-line-height` |\n| `--vaadin-item-overlay-padding` |\n\n### Internal components\n\nIn addition to `<vaadin-combo-box>` itself, the following internal\ncomponents are themable:\n\n- `<vaadin-combo-box-item>` - has the same API as [`<vaadin-item>`](https://cdn.vaadin.com/vaadin-web-components/25.3.0/#/elements/vaadin-item).\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
|
|
12
12
|
"attributes": [
|
|
13
|
+
{
|
|
14
|
+
"name": "accessible-description-ref",
|
|
15
|
+
"description": "A space-separated list of IDs referencing the elements that\ndescribe the component for screen reader users. The referenced\nelements are announced in addition to the helper text and\nthe error message.",
|
|
16
|
+
"value": {
|
|
17
|
+
"type": [
|
|
18
|
+
"string"
|
|
19
|
+
]
|
|
20
|
+
}
|
|
21
|
+
},
|
|
13
22
|
{
|
|
14
23
|
"name": "accessible-name",
|
|
15
|
-
"description": "String used to label the component
|
|
24
|
+
"description": "String used to label the component for screen reader users.",
|
|
16
25
|
"value": {
|
|
17
26
|
"type": [
|
|
18
27
|
"string"
|
|
@@ -21,7 +30,7 @@
|
|
|
21
30
|
},
|
|
22
31
|
{
|
|
23
32
|
"name": "accessible-name-ref",
|
|
24
|
-
"description": "
|
|
33
|
+
"description": "A space-separated list of IDs referencing the elements that\nlabel the component for screen reader users.",
|
|
25
34
|
"value": {
|
|
26
35
|
"type": [
|
|
27
36
|
"string"
|
|
@@ -75,7 +84,7 @@
|
|
|
75
84
|
},
|
|
76
85
|
{
|
|
77
86
|
"name": "clear-button-visible",
|
|
78
|
-
"description": "Set to true to display the clear icon which clears the input.\
|
|
87
|
+
"description": "Set to true to display the clear icon which clears the input.\nThis also enables clearing the input when pressing Esc key.",
|
|
79
88
|
"value": {
|
|
80
89
|
"type": [
|
|
81
90
|
"boolean"
|
|
@@ -129,7 +138,7 @@
|
|
|
129
138
|
},
|
|
130
139
|
{
|
|
131
140
|
"name": "item-id-path",
|
|
132
|
-
"description": "Path for the id of the item. If `items` is an array of objects,\nthe `itemIdPath` is used to compare and identify the same item\nin
|
|
141
|
+
"description": "Path for the id of the item. If `items` is an array of objects,\nthe `itemIdPath` is used to compare and identify the same item\nin the selection and in `filteredItems` (items given by the\n`dataProvider` callback).",
|
|
133
142
|
"value": {
|
|
134
143
|
"type": [
|
|
135
144
|
"string"
|
|
@@ -208,6 +217,15 @@
|
|
|
208
217
|
]
|
|
209
218
|
}
|
|
210
219
|
},
|
|
220
|
+
{
|
|
221
|
+
"name": "partial-match-mode",
|
|
222
|
+
"description": "Controls which item is automatically set to be selected, for\nexample on Enter, when the typed filter only partially matches\nits label. The item that will be selected is highlighted in the\ndropdown while typing:\n\n- `none` (default): an item is automatically set to be selected only when the filter matches its label exactly.\n- `first-match`: the first item in the filtered results is automatically set to be selected.\n- `only-match`: the item is automatically set to be selected when filtering narrows the results to a single item.\n\nIn general, an exact match is always set to be selected and takes\nprecedence over partial matches, regardless of the mode.\n\nA partial match is only applied while the dropdown is open. For\nexample, when auto-open is disabled with `autoOpenDisabled`, typing\ndoes not highlight a match or set it to be selected until the\ndropdown is opened.\n\nThis feature cannot be used together with custom values, because a\npartial match is also a valid custom value. A partial match is not\napplied when custom values are allowed with `allowCustomValue`.",
|
|
223
|
+
"value": {
|
|
224
|
+
"type": [
|
|
225
|
+
"string"
|
|
226
|
+
]
|
|
227
|
+
}
|
|
228
|
+
},
|
|
211
229
|
{
|
|
212
230
|
"name": "pattern",
|
|
213
231
|
"description": "A regular expression that the value is checked against.\nThe pattern must match the entire value, not just some subset.",
|
|
@@ -258,9 +276,7 @@
|
|
|
258
276
|
"description": "The theme variants to apply to the component.",
|
|
259
277
|
"value": {
|
|
260
278
|
"type": [
|
|
261
|
-
"string"
|
|
262
|
-
"null",
|
|
263
|
-
"undefined"
|
|
279
|
+
"string"
|
|
264
280
|
]
|
|
265
281
|
}
|
|
266
282
|
},
|
|
@@ -285,9 +301,18 @@
|
|
|
285
301
|
],
|
|
286
302
|
"js": {
|
|
287
303
|
"properties": [
|
|
304
|
+
{
|
|
305
|
+
"name": "accessibleDescriptionRef",
|
|
306
|
+
"description": "A space-separated list of IDs referencing the elements that\ndescribe the component for screen reader users. The referenced\nelements are announced in addition to the helper text and\nthe error message.",
|
|
307
|
+
"value": {
|
|
308
|
+
"type": [
|
|
309
|
+
"string"
|
|
310
|
+
]
|
|
311
|
+
}
|
|
312
|
+
},
|
|
288
313
|
{
|
|
289
314
|
"name": "accessibleName",
|
|
290
|
-
"description": "String used to label the component
|
|
315
|
+
"description": "String used to label the component for screen reader users.",
|
|
291
316
|
"value": {
|
|
292
317
|
"type": [
|
|
293
318
|
"string"
|
|
@@ -296,7 +321,7 @@
|
|
|
296
321
|
},
|
|
297
322
|
{
|
|
298
323
|
"name": "accessibleNameRef",
|
|
299
|
-
"description": "
|
|
324
|
+
"description": "A space-separated list of IDs referencing the elements that\nlabel the component for screen reader users.",
|
|
300
325
|
"value": {
|
|
301
326
|
"type": [
|
|
302
327
|
"string"
|
|
@@ -350,7 +375,7 @@
|
|
|
350
375
|
},
|
|
351
376
|
{
|
|
352
377
|
"name": "clearButtonVisible",
|
|
353
|
-
"description": "Set to true to display the clear icon which clears the input.\
|
|
378
|
+
"description": "Set to true to display the clear icon which clears the input.\nThis also enables clearing the input when pressing Esc key.",
|
|
354
379
|
"value": {
|
|
355
380
|
"type": [
|
|
356
381
|
"boolean"
|
|
@@ -434,7 +459,7 @@
|
|
|
434
459
|
},
|
|
435
460
|
{
|
|
436
461
|
"name": "itemIdPath",
|
|
437
|
-
"description": "Path for the id of the item. If `items` is an array of objects,\nthe `itemIdPath` is used to compare and identify the same item\nin
|
|
462
|
+
"description": "Path for the id of the item. If `items` is an array of objects,\nthe `itemIdPath` is used to compare and identify the same item\nin the selection and in `filteredItems` (items given by the\n`dataProvider` callback).",
|
|
438
463
|
"value": {
|
|
439
464
|
"type": [
|
|
440
465
|
"string"
|
|
@@ -533,6 +558,15 @@
|
|
|
533
558
|
]
|
|
534
559
|
}
|
|
535
560
|
},
|
|
561
|
+
{
|
|
562
|
+
"name": "partialMatchMode",
|
|
563
|
+
"description": "Controls which item is automatically set to be selected, for\nexample on Enter, when the typed filter only partially matches\nits label. The item that will be selected is highlighted in the\ndropdown while typing:\n\n- `none` (default): an item is automatically set to be selected only when the filter matches its label exactly.\n- `first-match`: the first item in the filtered results is automatically set to be selected.\n- `only-match`: the item is automatically set to be selected when filtering narrows the results to a single item.\n\nIn general, an exact match is always set to be selected and takes\nprecedence over partial matches, regardless of the mode.\n\nA partial match is only applied while the dropdown is open. For\nexample, when auto-open is disabled with `autoOpenDisabled`, typing\ndoes not highlight a match or set it to be selected until the\ndropdown is opened.\n\nThis feature cannot be used together with custom values, because a\npartial match is also a valid custom value. A partial match is not\napplied when custom values are allowed with `allowCustomValue`.",
|
|
564
|
+
"value": {
|
|
565
|
+
"type": [
|
|
566
|
+
"string"
|
|
567
|
+
]
|
|
568
|
+
}
|
|
569
|
+
},
|
|
536
570
|
{
|
|
537
571
|
"name": "pattern",
|
|
538
572
|
"description": "A regular expression that the value is checked against.\nThe pattern must match the entire value, not just some subset.",
|
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.3.0
|
|
4
|
+
"version": "25.3.0",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"framework": "lit",
|
|
7
7
|
"framework-config": {
|
|
@@ -16,19 +16,26 @@
|
|
|
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.3.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.3.0/#/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.3.0/#/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.3.0/#/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 shadow DOM parts are available for styling:\n\nPart name | Description\n---------------------|----------------\n`label` | The label element\n`input-field` | The element that wraps prefix, value and buttons\n`field-button` | Set on both clear and toggle buttons\n`clear-button` | The clear button\n`error-message` | The error message element\n`helper-text` | The helper text element wrapper\n`required-indicator` | The `required` state indicator element\n`toggle-button` | The toggle button\n`overlay` | The overlay container\n`content` | The overlay content\n`loader` | The loading indicator shown while loading items\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n---------------------|---------------------------------\n`disabled` | Set when the element is disabled\n`has-value` | Set when the element has a value\n`has-label` | Set when the element has a label\n`has-helper` | Set when the element has helper text or slot\n`has-error-message` | Set when the element has an error message\n`has-tooltip` | Set when the element has a slotted tooltip\n`invalid` | Set when the element is invalid\n`focused` | Set when the element is focused\n`focus-ring` | Set when the element is keyboard focused\n`readonly` | Set when the element is readonly\n`opened` | Set when the overlay is opened\n`loading` | Set when loading items from the data provider\n\nThe following custom CSS properties are available for styling:\n\nCustom CSS property |\n:--------------------------------------------------|\n| `--vaadin-combo-box-overlay-max-height` |\n| `--vaadin-combo-box-overlay-width` |\n| `--vaadin-field-default-width` |\n| `--vaadin-input-field-background` |\n| `--vaadin-input-field-border-color` |\n| `--vaadin-input-field-border-radius` |\n| `--vaadin-input-field-border-width` |\n| `--vaadin-input-field-bottom-end-radius` |\n| `--vaadin-input-field-bottom-start-radius` |\n| `--vaadin-input-field-button-text-color` |\n| `--vaadin-input-field-container-gap` |\n| `--vaadin-input-field-disabled-background` |\n| `--vaadin-input-field-disabled-text-color` |\n| `--vaadin-input-field-error-color` |\n| `--vaadin-input-field-error-font-size` |\n| `--vaadin-input-field-error-font-weight` |\n| `--vaadin-input-field-error-line-height` |\n| `--vaadin-input-field-gap` |\n| `--vaadin-input-field-helper-color` |\n| `--vaadin-input-field-helper-font-size` |\n| `--vaadin-input-field-helper-font-weight` |\n| `--vaadin-input-field-helper-line-height` |\n| `--vaadin-input-field-label-color` |\n| `--vaadin-input-field-label-font-size` |\n| `--vaadin-input-field-label-font-weight` |\n| `--vaadin-input-field-label-line-height` |\n| `--vaadin-input-field-padding` |\n| `--vaadin-input-field-placeholder-color` |\n| `--vaadin-input-field-required-indicator` |\n| `--vaadin-input-field-required-indicator-color` |\n| `--vaadin-input-field-top-end-radius` |\n| `--vaadin-input-field-top-start-radius` |\n| `--vaadin-input-field-value-color` |\n| `--vaadin-input-field-value-font-size` |\n| `--vaadin-input-field-value-font-weight` |\n| `--vaadin-input-field-value-line-height` |\n| `--vaadin-item-overlay-padding` |\n\n### Internal components\n\nIn addition to `<vaadin-combo-box>` itself, the following internal\ncomponents are themable:\n\n- `<vaadin-combo-box-item>` - has the same API as [`<vaadin-item>`](https://cdn.vaadin.com/vaadin-web-components/25.3.0/#/elements/vaadin-item).\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
|
|
20
20
|
"extension": true,
|
|
21
21
|
"attributes": [
|
|
22
|
+
{
|
|
23
|
+
"name": ".accessibleDescriptionRef",
|
|
24
|
+
"description": "A space-separated list of IDs referencing the elements that\ndescribe the component for screen reader users. The referenced\nelements are announced in addition to the helper text and\nthe error message.",
|
|
25
|
+
"value": {
|
|
26
|
+
"kind": "expression"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
22
29
|
{
|
|
23
30
|
"name": ".accessibleName",
|
|
24
|
-
"description": "String used to label the component
|
|
31
|
+
"description": "String used to label the component for screen reader users.",
|
|
25
32
|
"value": {
|
|
26
33
|
"kind": "expression"
|
|
27
34
|
}
|
|
28
35
|
},
|
|
29
36
|
{
|
|
30
37
|
"name": ".accessibleNameRef",
|
|
31
|
-
"description": "
|
|
38
|
+
"description": "A space-separated list of IDs referencing the elements that\nlabel the component for screen reader users.",
|
|
32
39
|
"value": {
|
|
33
40
|
"kind": "expression"
|
|
34
41
|
}
|
|
@@ -70,7 +77,7 @@
|
|
|
70
77
|
},
|
|
71
78
|
{
|
|
72
79
|
"name": "?clearButtonVisible",
|
|
73
|
-
"description": "Set to true to display the clear icon which clears the input.\
|
|
80
|
+
"description": "Set to true to display the clear icon which clears the input.\nThis also enables clearing the input when pressing Esc key.",
|
|
74
81
|
"value": {
|
|
75
82
|
"kind": "expression"
|
|
76
83
|
}
|
|
@@ -133,7 +140,7 @@
|
|
|
133
140
|
},
|
|
134
141
|
{
|
|
135
142
|
"name": ".itemIdPath",
|
|
136
|
-
"description": "Path for the id of the item. If `items` is an array of objects,\nthe `itemIdPath` is used to compare and identify the same item\nin
|
|
143
|
+
"description": "Path for the id of the item. If `items` is an array of objects,\nthe `itemIdPath` is used to compare and identify the same item\nin the selection and in `filteredItems` (items given by the\n`dataProvider` callback).",
|
|
137
144
|
"value": {
|
|
138
145
|
"kind": "expression"
|
|
139
146
|
}
|
|
@@ -208,6 +215,13 @@
|
|
|
208
215
|
"kind": "expression"
|
|
209
216
|
}
|
|
210
217
|
},
|
|
218
|
+
{
|
|
219
|
+
"name": ".partialMatchMode",
|
|
220
|
+
"description": "Controls which item is automatically set to be selected, for\nexample on Enter, when the typed filter only partially matches\nits label. The item that will be selected is highlighted in the\ndropdown while typing:\n\n- `none` (default): an item is automatically set to be selected only when the filter matches its label exactly.\n- `first-match`: the first item in the filtered results is automatically set to be selected.\n- `only-match`: the item is automatically set to be selected when filtering narrows the results to a single item.\n\nIn general, an exact match is always set to be selected and takes\nprecedence over partial matches, regardless of the mode.\n\nA partial match is only applied while the dropdown is open. For\nexample, when auto-open is disabled with `autoOpenDisabled`, typing\ndoes not highlight a match or set it to be selected until the\ndropdown is opened.\n\nThis feature cannot be used together with custom values, because a\npartial match is also a valid custom value. A partial match is not\napplied when custom values are allowed with `allowCustomValue`.",
|
|
221
|
+
"value": {
|
|
222
|
+
"kind": "expression"
|
|
223
|
+
}
|
|
224
|
+
},
|
|
211
225
|
{
|
|
212
226
|
"name": ".pattern",
|
|
213
227
|
"description": "A regular expression that the value is checked against.\nThe pattern must match the entire value, not just some subset.",
|