@vaadin/combo-box 25.0.0-alpha1 → 25.0.0-alpha11
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 +14 -15
- package/src/styles/vaadin-combo-box-base-styles.d.ts +8 -0
- package/src/styles/vaadin-combo-box-base-styles.js +17 -0
- package/src/styles/vaadin-combo-box-overlay-base-styles.js +46 -0
- package/src/styles/vaadin-combo-box-scroller-base-styles.js +29 -0
- package/src/vaadin-combo-box-base-mixin.d.ts +56 -0
- package/src/vaadin-combo-box-base-mixin.js +776 -0
- package/src/vaadin-combo-box-data-provider-mixin.js +17 -32
- package/src/vaadin-combo-box-item-mixin.js +6 -1
- package/src/vaadin-combo-box-item.js +7 -11
- package/src/vaadin-combo-box-items-mixin.d.ts +53 -0
- package/src/vaadin-combo-box-items-mixin.js +275 -0
- package/src/vaadin-combo-box-mixin.d.ts +3 -72
- package/src/vaadin-combo-box-mixin.js +84 -898
- package/src/vaadin-combo-box-overlay-mixin.js +1 -22
- package/src/vaadin-combo-box-overlay.js +5 -16
- package/src/vaadin-combo-box-scroller.js +3 -24
- package/src/vaadin-combo-box.d.ts +10 -8
- package/src/vaadin-combo-box.js +44 -19
- package/vaadin-combo-box.js +1 -1
- package/web-types.json +51 -51
- package/web-types.lit.json +17 -17
- package/theme/lumo/vaadin-combo-box-item-styles.d.ts +0 -5
- package/theme/lumo/vaadin-combo-box-item-styles.js +0 -25
- package/theme/lumo/vaadin-combo-box-overlay-styles.d.ts +0 -6
- package/theme/lumo/vaadin-combo-box-overlay-styles.js +0 -60
- package/theme/lumo/vaadin-combo-box-styles.d.ts +0 -2
- package/theme/lumo/vaadin-combo-box-styles.js +0 -12
- package/theme/lumo/vaadin-combo-box.d.ts +0 -4
- package/theme/lumo/vaadin-combo-box.js +0 -4
package/web-types.lit.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/web-types",
|
|
3
3
|
"name": "@vaadin/combo-box",
|
|
4
|
-
"version": "25.0.0-
|
|
4
|
+
"version": "25.0.0-alpha11",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"framework": "lit",
|
|
7
7
|
"framework-config": {
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"elements": [
|
|
17
17
|
{
|
|
18
18
|
"name": "vaadin-combo-box",
|
|
19
|
-
"description": "`<vaadin-combo-box>` is a web component for choosing a value from a filterable list of options\npresented in a dropdown overlay. The options can be provided as a list of strings or objects\nby setting [`items`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-
|
|
19
|
+
"description": "`<vaadin-combo-box>` is a web component for choosing a value from a filterable list of options\npresented in a dropdown overlay. The options can be provided as a list of strings or objects\nby setting [`items`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha11/#/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-alpha11/#/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-alpha11/#/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-alpha11/#/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`overlay` | The overlay container\n`content` | The overlay content\n`loader` | The loading indicator shown while loading items\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-item>` - has the same API as [`<vaadin-item>`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha11/#/elements/vaadin-item).\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
|
|
20
20
|
"extension": true,
|
|
21
21
|
"attributes": [
|
|
22
22
|
{
|
|
@@ -208,13 +208,6 @@
|
|
|
208
208
|
"kind": "expression"
|
|
209
209
|
}
|
|
210
210
|
},
|
|
211
|
-
{
|
|
212
|
-
"name": ".renderer",
|
|
213
|
-
"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.",
|
|
214
|
-
"value": {
|
|
215
|
-
"kind": "expression"
|
|
216
|
-
}
|
|
217
|
-
},
|
|
218
211
|
{
|
|
219
212
|
"name": ".items",
|
|
220
213
|
"description": "A full set of items to filter the visible options from.\nThe items can be of either `String` or `Object` type.",
|
|
@@ -237,29 +230,36 @@
|
|
|
237
230
|
}
|
|
238
231
|
},
|
|
239
232
|
{
|
|
240
|
-
"name": ".
|
|
241
|
-
"description": "
|
|
233
|
+
"name": ".itemLabelPath",
|
|
234
|
+
"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.",
|
|
242
235
|
"value": {
|
|
243
236
|
"kind": "expression"
|
|
244
237
|
}
|
|
245
238
|
},
|
|
246
239
|
{
|
|
247
|
-
"name": ".
|
|
248
|
-
"description": "
|
|
240
|
+
"name": ".itemValuePath",
|
|
241
|
+
"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.",
|
|
249
242
|
"value": {
|
|
250
243
|
"kind": "expression"
|
|
251
244
|
}
|
|
252
245
|
},
|
|
253
246
|
{
|
|
254
|
-
"name": ".
|
|
255
|
-
"description": "
|
|
247
|
+
"name": ".renderer",
|
|
248
|
+
"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.",
|
|
256
249
|
"value": {
|
|
257
250
|
"kind": "expression"
|
|
258
251
|
}
|
|
259
252
|
},
|
|
260
253
|
{
|
|
261
|
-
"name": ".
|
|
262
|
-
"description": "
|
|
254
|
+
"name": ".selectedItem",
|
|
255
|
+
"description": "The selected item from the `items` array.",
|
|
256
|
+
"value": {
|
|
257
|
+
"kind": "expression"
|
|
258
|
+
}
|
|
259
|
+
},
|
|
260
|
+
{
|
|
261
|
+
"name": ".itemClassNameGenerator",
|
|
262
|
+
"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.",
|
|
263
263
|
"value": {
|
|
264
264
|
"kind": "expression"
|
|
265
265
|
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import '@vaadin/vaadin-lumo-styles/color.js';
|
|
2
|
-
import '@vaadin/vaadin-lumo-styles/spacing.js';
|
|
3
|
-
import '@vaadin/vaadin-lumo-styles/style.js';
|
|
4
|
-
import { item } from '@vaadin/item/theme/lumo/vaadin-item-styles.js';
|
|
5
|
-
import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
6
|
-
|
|
7
|
-
const comboBoxItem = css`
|
|
8
|
-
:host {
|
|
9
|
-
transition: background-color 100ms;
|
|
10
|
-
overflow: hidden;
|
|
11
|
-
--_lumo-item-selected-icon-display: block;
|
|
12
|
-
--_focus-ring-color: var(--vaadin-focus-ring-color, var(--lumo-primary-color-50pct));
|
|
13
|
-
--_focus-ring-width: var(--vaadin-focus-ring-width, 2px);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
:host([focused]:not([disabled])) {
|
|
17
|
-
box-shadow: inset 0 0 0 var(--_focus-ring-width) var(--_focus-ring-color);
|
|
18
|
-
}
|
|
19
|
-
`;
|
|
20
|
-
|
|
21
|
-
registerStyles('vaadin-combo-box-item', [item, comboBoxItem], {
|
|
22
|
-
moduleId: 'lumo-combo-box-item',
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
export { comboBoxItem };
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import '@vaadin/vaadin-lumo-styles/color.js';
|
|
2
|
-
import '@vaadin/vaadin-lumo-styles/spacing.js';
|
|
3
|
-
import '@vaadin/vaadin-lumo-styles/style.js';
|
|
4
|
-
declare const comboBoxOverlay: import("lit").CSSResult;
|
|
5
|
-
declare const comboBoxLoader: import("lit").CSSResult;
|
|
6
|
-
export { comboBoxLoader, comboBoxOverlay };
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import '@vaadin/vaadin-lumo-styles/color.js';
|
|
2
|
-
import '@vaadin/vaadin-lumo-styles/spacing.js';
|
|
3
|
-
import '@vaadin/vaadin-lumo-styles/style.js';
|
|
4
|
-
import { loader } from '@vaadin/vaadin-lumo-styles/mixins/loader.js';
|
|
5
|
-
import { menuOverlayCore } from '@vaadin/vaadin-lumo-styles/mixins/menu-overlay.js';
|
|
6
|
-
import { overlay } from '@vaadin/vaadin-lumo-styles/mixins/overlay.js';
|
|
7
|
-
import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
8
|
-
|
|
9
|
-
const comboBoxOverlay = css`
|
|
10
|
-
[part='content'] {
|
|
11
|
-
padding: 0;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
/* When items are empty, the spinner needs some room */
|
|
15
|
-
:host(:not([closing])) [part~='content'] {
|
|
16
|
-
min-height: calc(2 * var(--lumo-space-s) + var(--lumo-icon-size-s));
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
[part~='overlay'] {
|
|
20
|
-
position: relative;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
:host([top-aligned]) [part~='overlay'] {
|
|
24
|
-
margin-top: var(--lumo-space-xs);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
:host([bottom-aligned]) [part~='overlay'] {
|
|
28
|
-
margin-bottom: var(--lumo-space-xs);
|
|
29
|
-
}
|
|
30
|
-
`;
|
|
31
|
-
|
|
32
|
-
const comboBoxLoader = css`
|
|
33
|
-
[part~='loader'] {
|
|
34
|
-
position: absolute;
|
|
35
|
-
z-index: 1;
|
|
36
|
-
inset-inline: var(--lumo-space-s);
|
|
37
|
-
top: var(--lumo-space-s);
|
|
38
|
-
margin-inline: auto 0;
|
|
39
|
-
}
|
|
40
|
-
`;
|
|
41
|
-
|
|
42
|
-
registerStyles(
|
|
43
|
-
'vaadin-combo-box-overlay',
|
|
44
|
-
[
|
|
45
|
-
overlay,
|
|
46
|
-
menuOverlayCore,
|
|
47
|
-
comboBoxOverlay,
|
|
48
|
-
loader,
|
|
49
|
-
comboBoxLoader,
|
|
50
|
-
css`
|
|
51
|
-
:host {
|
|
52
|
-
--_vaadin-combo-box-items-container-border-width: var(--lumo-space-xs);
|
|
53
|
-
--_vaadin-combo-box-items-container-border-style: solid;
|
|
54
|
-
}
|
|
55
|
-
`,
|
|
56
|
-
],
|
|
57
|
-
{ moduleId: 'lumo-combo-box-overlay' },
|
|
58
|
-
);
|
|
59
|
-
|
|
60
|
-
export { comboBoxLoader, comboBoxOverlay };
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import '@vaadin/input-container/theme/lumo/vaadin-input-container-styles.js';
|
|
2
|
-
import '@vaadin/vaadin-lumo-styles/font-icons.js';
|
|
3
|
-
import { inputFieldShared } from '@vaadin/vaadin-lumo-styles/mixins/input-field-shared.js';
|
|
4
|
-
import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
5
|
-
|
|
6
|
-
const comboBox = css`
|
|
7
|
-
[part='toggle-button']::before {
|
|
8
|
-
content: var(--lumo-icons-dropdown);
|
|
9
|
-
}
|
|
10
|
-
`;
|
|
11
|
-
|
|
12
|
-
registerStyles('vaadin-combo-box', [inputFieldShared, comboBox], { moduleId: 'lumo-combo-box' });
|