@vaadin/combo-box 24.8.0-alpha9 → 25.0.0-alpha1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/README.md +0 -23
  2. package/package.json +14 -18
  3. package/src/vaadin-combo-box-item.js +21 -16
  4. package/src/vaadin-combo-box-mixin.js +1 -25
  5. package/src/vaadin-combo-box-overlay-mixin.js +1 -1
  6. package/src/vaadin-combo-box-overlay.js +12 -8
  7. package/src/vaadin-combo-box-scroller.js +31 -26
  8. package/src/vaadin-combo-box.d.ts +2 -6
  9. package/src/vaadin-combo-box.js +44 -41
  10. package/web-types.json +2 -487
  11. package/web-types.lit.json +2 -247
  12. package/src/vaadin-combo-box-light-mixin.d.ts +0 -26
  13. package/src/vaadin-combo-box-light-mixin.js +0 -129
  14. package/src/vaadin-combo-box-light.d.ts +0 -161
  15. package/src/vaadin-combo-box-light.js +0 -94
  16. package/src/vaadin-lit-combo-box-item.js +0 -50
  17. package/src/vaadin-lit-combo-box-light.js +0 -57
  18. package/src/vaadin-lit-combo-box-overlay.js +0 -60
  19. package/src/vaadin-lit-combo-box-scroller.js +0 -59
  20. package/src/vaadin-lit-combo-box.js +0 -169
  21. package/theme/lumo/vaadin-combo-box-light.d.ts +0 -3
  22. package/theme/lumo/vaadin-combo-box-light.js +0 -3
  23. package/theme/lumo/vaadin-lit-combo-box-light.d.ts +0 -3
  24. package/theme/lumo/vaadin-lit-combo-box-light.js +0 -3
  25. package/theme/lumo/vaadin-lit-combo-box.d.ts +0 -4
  26. package/theme/lumo/vaadin-lit-combo-box.js +0 -4
  27. package/theme/material/vaadin-combo-box-item-styles.d.ts +0 -5
  28. package/theme/material/vaadin-combo-box-item-styles.js +0 -20
  29. package/theme/material/vaadin-combo-box-light.d.ts +0 -3
  30. package/theme/material/vaadin-combo-box-light.js +0 -3
  31. package/theme/material/vaadin-combo-box-overlay-styles.d.ts +0 -4
  32. package/theme/material/vaadin-combo-box-overlay-styles.js +0 -51
  33. package/theme/material/vaadin-combo-box-styles.d.ts +0 -3
  34. package/theme/material/vaadin-combo-box-styles.js +0 -21
  35. package/theme/material/vaadin-combo-box.d.ts +0 -4
  36. package/theme/material/vaadin-combo-box.js +0 -4
  37. package/theme/material/vaadin-lit-combo-box-light.d.ts +0 -3
  38. package/theme/material/vaadin-lit-combo-box-light.js +0 -3
  39. package/theme/material/vaadin-lit-combo-box.d.ts +0 -4
  40. package/theme/material/vaadin-lit-combo-box.js +0 -4
  41. package/vaadin-combo-box-light.d.ts +0 -1
  42. package/vaadin-combo-box-light.js +0 -2
  43. package/vaadin-lit-combo-box-light.d.ts +0 -1
  44. package/vaadin-lit-combo-box-light.js +0 -2
  45. package/vaadin-lit-combo-box.d.ts +0 -1
  46. package/vaadin-lit-combo-box.js +0 -2
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/combo-box",
4
- "version": "24.8.0-alpha9",
4
+ "version": "25.0.0-alpha1",
5
5
  "description-markup": "markdown",
6
6
  "framework": "lit",
7
7
  "framework-config": {
@@ -14,254 +14,9 @@
14
14
  "contributions": {
15
15
  "html": {
16
16
  "elements": [
17
- {
18
- "name": "vaadin-combo-box-light",
19
- "description": "`<vaadin-combo-box-light>` is a customizable version of the `<vaadin-combo-box>` providing\nonly the dropdown functionality and leaving the input field definition to the user.\n\nThe element has the same API as `<vaadin-combo-box>`.\n\nTo create a custom input field, you need to add a child element which has a two-way\ndata-bindable property representing the input value. The property name is expected\nto be `value` by default. For example, you can use `<vaadin-text-field>` element:\n\n```html\n<vaadin-combo-box-light>\n <vaadin-text-field></vaadin-text-field>\n</vaadin-combo-box-light>\n```\n\nIf you are using custom input field that has other property for value,\nset `class=\"input\"` to enable corresponding logic, and use `attr-for-value`\nattribute to specify which property to use:\n\n```html\n<vaadin-combo-box-light attr-for-value=\"input-value\">\n <custom-input class=\"input\"></custom-input>\n</vaadin-combo-box-light>\n```\n\nYou can also pass custom toggle and clear buttons with corresponding classes:\n\n```html\n<vaadin-combo-box-light>\n <custom-input class=\"input\" attr-for-value=\"input-value\">\n <button slot=\"suffix\" class=\"clear-button\">Clear</button>\n <button slot=\"suffix\" class=\"toggle-button\">Toggle</button>\n </custom-input>\n</vaadin-combo-box-light>\n```",
20
- "extension": true,
21
- "attributes": [
22
- {
23
- "name": "?invalid",
24
- "description": "Set to true when the field is invalid.",
25
- "value": {
26
- "kind": "expression"
27
- }
28
- },
29
- {
30
- "name": "?manualValidation",
31
- "description": "Set to true to enable manual validation mode. This mode disables automatic\nconstraint validation, allowing you to control the validation process yourself.\nYou can still trigger constraint validation manually with the `validate()` method\nor use `checkValidity()` to assess the component's validity without affecting\nthe invalid state. In manual validation mode, you can also manipulate\nthe `invalid` property directly through your application logic without conflicts\nwith the component's internal validation.",
32
- "value": {
33
- "kind": "expression"
34
- }
35
- },
36
- {
37
- "name": "?required",
38
- "description": "Specifies that the user must fill in a value.",
39
- "value": {
40
- "kind": "expression"
41
- }
42
- },
43
- {
44
- "name": "?disabled",
45
- "description": "If true, the user cannot interact with this element.",
46
- "value": {
47
- "kind": "expression"
48
- }
49
- },
50
- {
51
- "name": "?opened",
52
- "description": "True if the dropdown is open, false otherwise.",
53
- "value": {
54
- "kind": "expression"
55
- }
56
- },
57
- {
58
- "name": "?autoOpenDisabled",
59
- "description": "Set true to prevent the overlay from opening automatically.",
60
- "value": {
61
- "kind": "expression"
62
- }
63
- },
64
- {
65
- "name": "?readonly",
66
- "description": "When present, it specifies that the field is read-only.",
67
- "value": {
68
- "kind": "expression"
69
- }
70
- },
71
- {
72
- "name": "?allowCustomValue",
73
- "description": "If `true`, the user can input a value that is not present in the items list.\n`value` property will be set to the input value in this case.\nAlso, when `value` is set programmatically, the input value will be set\nto reflect that value.",
74
- "value": {
75
- "kind": "expression"
76
- }
77
- },
78
- {
79
- "name": "?loading",
80
- "description": "When set to `true`, \"loading\" attribute is added to host and the overlay element.",
81
- "value": {
82
- "kind": "expression"
83
- }
84
- },
85
- {
86
- "name": ".pageSize",
87
- "description": "Number of items fetched at a time from the dataprovider.",
88
- "value": {
89
- "kind": "expression"
90
- }
91
- },
92
- {
93
- "name": ".size",
94
- "description": "Total number of items.",
95
- "value": {
96
- "kind": "expression"
97
- }
98
- },
99
- {
100
- "name": ".dataProvider",
101
- "description": "Function that provides items lazily. Receives arguments `params`, `callback`\n\n`params.page` Requested page index\n\n`params.pageSize` Current page size\n\n`params.filter` Currently applied filter\n\n`callback(items, size)` Callback function with arguments:\n - `items` Current page of items\n - `size` Total number of items.",
102
- "value": {
103
- "kind": "expression"
104
- }
105
- },
106
- {
107
- "name": ".value",
108
- "description": "The value of the field.",
109
- "value": {
110
- "kind": "expression"
111
- }
112
- },
113
- {
114
- "name": ".overlayClass",
115
- "description": "A space-delimited list of CSS class names to set on the overlay element.\nThis property does not affect other CSS class names set manually via JS.\n\nNote, if the CSS class name was set with this property, clearing it will\nremove it from the overlay, even if the same class name was also added\nmanually, e.g. by using `classList.add()` in the `renderer` function.",
116
- "value": {
117
- "kind": "expression"
118
- }
119
- },
120
- {
121
- "name": ".renderer",
122
- "description": "Custom function for rendering the content of every item.\nReceives three arguments:\n\n- `root` The `<vaadin-combo-box-item>` internal container DOM element.\n- `comboBox` The reference to the `<vaadin-combo-box>` element.\n- `model` The object with the properties related with the rendered\n item, contains:\n - `model.index` The index of the rendered item.\n - `model.item` The item.",
123
- "value": {
124
- "kind": "expression"
125
- }
126
- },
127
- {
128
- "name": ".items",
129
- "description": "A full set of items to filter the visible options from.\nThe items can be of either `String` or `Object` type.",
130
- "value": {
131
- "kind": "expression"
132
- }
133
- },
134
- {
135
- "name": ".filteredItems",
136
- "description": "A subset of items, filtered based on the user input. Filtered items\ncan be assigned directly to omit the internal filtering functionality.\nThe items can be of either `String` or `Object` type.",
137
- "value": {
138
- "kind": "expression"
139
- }
140
- },
141
- {
142
- "name": ".filter",
143
- "description": "Filtering string the user has typed into the input field.",
144
- "value": {
145
- "kind": "expression"
146
- }
147
- },
148
- {
149
- "name": ".selectedItem",
150
- "description": "The selected item from the `items` array.",
151
- "value": {
152
- "kind": "expression"
153
- }
154
- },
155
- {
156
- "name": ".itemClassNameGenerator",
157
- "description": "A function used to generate CSS class names for dropdown\nitems based on the item. The return value should be the\ngenerated class name as a string, or multiple class names\nseparated by whitespace characters.",
158
- "value": {
159
- "kind": "expression"
160
- }
161
- },
162
- {
163
- "name": ".itemLabelPath",
164
- "description": "Path for label of the item. If `items` is an array of objects, the\n`itemLabelPath` is used to fetch the displayed string label for each\nitem.\n\nThe item label is also used for matching items when processing user\ninput, i.e., for filtering and selecting items.",
165
- "value": {
166
- "kind": "expression"
167
- }
168
- },
169
- {
170
- "name": ".itemValuePath",
171
- "description": "Path for the value of the item. If `items` is an array of objects, the\n`itemValuePath:` is used to fetch the string value for the selected\nitem.\n\nThe item value is used in the `value` property of the combo box,\nto provide the form value.",
172
- "value": {
173
- "kind": "expression"
174
- }
175
- },
176
- {
177
- "name": ".itemIdPath",
178
- "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 `selectedItem` and `filteredItems` (items given by the\n`dataProvider` callback).",
179
- "value": {
180
- "kind": "expression"
181
- }
182
- },
183
- {
184
- "name": ".attrForValue",
185
- "description": "Name of the two-way data-bindable property representing the\nvalue of the custom input field.",
186
- "value": {
187
- "kind": "expression"
188
- }
189
- },
190
- {
191
- "name": "@validated",
192
- "description": "Fired whenever the field is validated.",
193
- "value": {
194
- "kind": "expression"
195
- }
196
- },
197
- {
198
- "name": "@change",
199
- "description": "Fired when the user commits a value change.",
200
- "value": {
201
- "kind": "expression"
202
- }
203
- },
204
- {
205
- "name": "@custom-value-set",
206
- "description": "Fired when the user sets a custom value.",
207
- "value": {
208
- "kind": "expression"
209
- }
210
- },
211
- {
212
- "name": "@selected-item-changed",
213
- "description": "Fired when selected item changes.",
214
- "value": {
215
- "kind": "expression"
216
- }
217
- },
218
- {
219
- "name": "@vaadin-combo-box-dropdown-closed",
220
- "description": "Fired after the `vaadin-combo-box-overlay` closes.",
221
- "value": {
222
- "kind": "expression"
223
- }
224
- },
225
- {
226
- "name": "@vaadin-combo-box-dropdown-opened",
227
- "description": "Fired after the `vaadin-combo-box-overlay` opens.",
228
- "value": {
229
- "kind": "expression"
230
- }
231
- },
232
- {
233
- "name": "@value-changed",
234
- "description": "Fired when the value changes.",
235
- "value": {
236
- "kind": "expression"
237
- }
238
- },
239
- {
240
- "name": "@invalid-changed",
241
- "description": "Fired when the `invalid` property changes.",
242
- "value": {
243
- "kind": "expression"
244
- }
245
- },
246
- {
247
- "name": "@opened-changed",
248
- "description": "Fired when the `opened` property changes.",
249
- "value": {
250
- "kind": "expression"
251
- }
252
- },
253
- {
254
- "name": "@filter-changed",
255
- "description": "Fired when the `filter` property changes.",
256
- "value": {
257
- "kind": "expression"
258
- }
259
- }
260
- ]
261
- },
262
17
  {
263
18
  "name": "vaadin-combo-box",
264
- "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.8.0-alpha9/#/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.8.0-alpha9/#/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.8.0-alpha9/#/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.8.0-alpha9/#/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.8.0-alpha9/#/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.8.0-alpha9/#/elements/vaadin-overlay).\n- `<vaadin-combo-box-item>` - has the same API as [`<vaadin-item>`](https://cdn.vaadin.com/vaadin-web-components/24.8.0-alpha9/#/elements/vaadin-item).\n- [`<vaadin-input-container>`](https://cdn.vaadin.com/vaadin-web-components/24.8.0-alpha9/#/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.",
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-alpha1/#/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-alpha1/#/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-alpha1/#/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-alpha1/#/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-alpha1/#/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-alpha1/#/elements/vaadin-item).\n- [`<vaadin-input-container>`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha1/#/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.",
265
20
  "extension": true,
266
21
  "attributes": [
267
22
  {
@@ -1,26 +0,0 @@
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 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
- }
@@ -1,129 +0,0 @@
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 { 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
- * @protected
104
- * @override
105
- */
106
- _isClearButton(event) {
107
- return (
108
- super._isClearButton(event) ||
109
- (event.type === 'input' && !event.isTrusted) || // Fake input event dispatched by clear button
110
- event.composedPath()[0].getAttribute('part') === 'clear-button'
111
- );
112
- }
113
-
114
- /**
115
- * @protected
116
- * @override
117
- */
118
- _shouldRemoveFocus(event) {
119
- const isBlurringControlButtons = event.target === this._toggleElement || event.target === this.clearElement;
120
- const isFocusingInputElement = event.relatedTarget && event.relatedTarget === this._nativeInput;
121
-
122
- // prevent closing the overlay when moving focus from clear or toggle buttons to the internal input
123
- if (isBlurringControlButtons && isFocusingInputElement) {
124
- return false;
125
- }
126
-
127
- return super._shouldRemoveFocus(event);
128
- }
129
- };
@@ -1,161 +0,0 @@
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 type { DisabledMixinClass } from '@vaadin/a11y-base/src/disabled-mixin.js';
7
- import type { FocusMixinClass } from '@vaadin/a11y-base/src/focus-mixin.js';
8
- import type { KeyboardMixinClass } from '@vaadin/a11y-base/src/keyboard-mixin.js';
9
- import type { InputMixinClass } from '@vaadin/field-base/src/input-mixin.js';
10
- import type { ValidateMixinClass } from '@vaadin/field-base/src/validate-mixin.js';
11
- import type { ThemableMixinClass } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
12
- import type { ThemePropertyMixinClass } from '@vaadin/vaadin-themable-mixin/vaadin-theme-property-mixin.js';
13
- import type { ComboBoxDataProviderMixinClass } from './vaadin-combo-box-data-provider-mixin.js';
14
- import type { ComboBoxLightMixinClass } from './vaadin-combo-box-light-mixin.js';
15
- import type { ComboBoxDefaultItem, ComboBoxMixinClass } from './vaadin-combo-box-mixin.js';
16
- export {
17
- ComboBoxDataProvider,
18
- ComboBoxDataProviderCallback,
19
- ComboBoxDataProviderParams,
20
- } from './vaadin-combo-box-data-provider-mixin.js';
21
- export { ComboBoxDefaultItem, ComboBoxItemModel, ComboBoxRenderer } from './vaadin-combo-box-mixin.js';
22
-
23
- /**
24
- * Fired when the user commits a value change.
25
- */
26
- export type ComboBoxLightChangeEvent<TItem> = Event & {
27
- target: ComboBoxLight<TItem>;
28
- };
29
-
30
- /**
31
- * Fired when the user sets a custom value.
32
- */
33
- export type ComboBoxLightCustomValueSetEvent = CustomEvent<string>;
34
-
35
- /**
36
- * Fired when the `opened` property changes.
37
- */
38
- export type ComboBoxLightOpenedChangedEvent = CustomEvent<{ value: boolean }>;
39
-
40
- /**
41
- * Fired when the `invalid` property changes.
42
- */
43
- export type ComboBoxLightInvalidChangedEvent = CustomEvent<{ value: boolean }>;
44
-
45
- /**
46
- * Fired when the `value` property changes.
47
- */
48
- export type ComboBoxLightValueChangedEvent = CustomEvent<{ value: string }>;
49
-
50
- /**
51
- * Fired when the `filter` property changes.
52
- */
53
- export type ComboBoxLightFilterChangedEvent = CustomEvent<{ value: string }>;
54
-
55
- /**
56
- * Fired when the `selectedItem` property changes.
57
- */
58
- export type ComboBoxLightSelectedItemChangedEvent<TItem> = CustomEvent<{ value: TItem | null | undefined }>;
59
-
60
- /**
61
- * Fired whenever the field is validated.
62
- */
63
- export type ComboBoxLightValidatedEvent = CustomEvent<{ valid: boolean }>;
64
-
65
- export interface ComboBoxLightEventMap<TItem> extends HTMLElementEventMap {
66
- change: ComboBoxLightChangeEvent<TItem>;
67
-
68
- 'custom-value-set': ComboBoxLightCustomValueSetEvent;
69
-
70
- 'opened-changed': ComboBoxLightOpenedChangedEvent;
71
-
72
- 'filter-changed': ComboBoxLightFilterChangedEvent;
73
-
74
- 'invalid-changed': ComboBoxLightInvalidChangedEvent;
75
-
76
- 'value-changed': ComboBoxLightValueChangedEvent;
77
-
78
- 'selected-item-changed': ComboBoxLightSelectedItemChangedEvent<TItem>;
79
-
80
- validated: ComboBoxLightValidatedEvent;
81
- }
82
-
83
- /**
84
- * `<vaadin-combo-box-light>` is a customizable version of the `<vaadin-combo-box>` providing
85
- * only the dropdown functionality and leaving the input field definition to the user.
86
- *
87
- * The element has the same API as `<vaadin-combo-box>`.
88
- *
89
- * To create a custom input field, you need to add a child element which has a two-way
90
- * data-bindable property representing the input value. The property name is expected
91
- * to be `value` by default. For example, you can use `<vaadin-text-field>` element:
92
- *
93
- * ```html
94
- * <vaadin-combo-box-light>
95
- * <vaadin-text-field></vaadin-text-field>
96
- * </vaadin-combo-box-light>
97
- * ```
98
- *
99
- * If you are using custom input field that has other property for value,
100
- * set `class="input"` to enable corresponding logic, and use `attr-for-value`
101
- * attribute to specify which property to use:
102
- *
103
- * ```html
104
- * <vaadin-combo-box-light attr-for-value="input-value">
105
- * <custom-input class="input"></custom-input>
106
- * </vaadin-combo-box-light>
107
- * ```
108
- *
109
- * You can also pass custom toggle and clear buttons with corresponding classes:
110
- *
111
- * ```html
112
- * <vaadin-combo-box-light>
113
- * <custom-input class="input" attr-for-value="input-value">
114
- * <button slot="suffix" class="clear-button">Clear</button>
115
- * <button slot="suffix" class="toggle-button">Toggle</button>
116
- * </custom-input>
117
- * </vaadin-combo-box-light>
118
- * ```
119
- *
120
- * @fires {Event} change - Fired when the user commits a value change.
121
- * @fires {CustomEvent} custom-value-set - Fired when the user sets a custom value.
122
- * @fires {CustomEvent} filter-changed - Fired when the `filter` property changes.
123
- * @fires {CustomEvent} invalid-changed - Fired when the `invalid` property changes.
124
- * @fires {CustomEvent} opened-changed - Fired when the `opened` property changes.
125
- * @fires {CustomEvent} selected-item-changed - Fired when the `selectedItem` property changes.
126
- * @fires {CustomEvent} value-changed - Fired when the `value` property changes.
127
- * @fires {CustomEvent} validated - Fired whenever the field is validated.
128
- */
129
- declare class ComboBoxLight<TItem = ComboBoxDefaultItem> extends HTMLElement {
130
- addEventListener<K extends keyof ComboBoxLightEventMap<TItem>>(
131
- type: K,
132
- listener: (this: ComboBoxLight<TItem>, ev: ComboBoxLightEventMap<TItem>[K]) => void,
133
- options?: AddEventListenerOptions | boolean,
134
- ): void;
135
-
136
- removeEventListener<K extends keyof ComboBoxLightEventMap<TItem>>(
137
- type: K,
138
- listener: (this: ComboBoxLight<TItem>, ev: ComboBoxLightEventMap<TItem>[K]) => void,
139
- options?: EventListenerOptions | boolean,
140
- ): void;
141
- }
142
-
143
- interface ComboBoxLight<TItem = ComboBoxDefaultItem>
144
- extends ComboBoxDataProviderMixinClass<TItem>,
145
- ComboBoxLightMixinClass,
146
- ComboBoxMixinClass<TItem>,
147
- KeyboardMixinClass,
148
- InputMixinClass,
149
- DisabledMixinClass,
150
- ThemableMixinClass,
151
- FocusMixinClass,
152
- ThemePropertyMixinClass,
153
- ValidateMixinClass {}
154
-
155
- declare global {
156
- interface HTMLElementTagNameMap {
157
- 'vaadin-combo-box-light': ComboBoxLight;
158
- }
159
- }
160
-
161
- export { ComboBoxLight };