@vaadin/select 24.2.0-dev.f254716fe → 24.3.0-alpha2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaadin/select",
3
- "version": "24.2.0-dev.f254716fe",
3
+ "version": "24.3.0-alpha2",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -47,22 +47,22 @@
47
47
  "dependencies": {
48
48
  "@open-wc/dedupe-mixin": "^1.3.0",
49
49
  "@polymer/polymer": "^3.2.0",
50
- "@vaadin/a11y-base": "24.2.0-dev.f254716fe",
51
- "@vaadin/button": "24.2.0-dev.f254716fe",
52
- "@vaadin/component-base": "24.2.0-dev.f254716fe",
53
- "@vaadin/field-base": "24.2.0-dev.f254716fe",
54
- "@vaadin/input-container": "24.2.0-dev.f254716fe",
55
- "@vaadin/item": "24.2.0-dev.f254716fe",
56
- "@vaadin/list-box": "24.2.0-dev.f254716fe",
57
- "@vaadin/lit-renderer": "24.2.0-dev.f254716fe",
58
- "@vaadin/overlay": "24.2.0-dev.f254716fe",
59
- "@vaadin/vaadin-lumo-styles": "24.2.0-dev.f254716fe",
60
- "@vaadin/vaadin-material-styles": "24.2.0-dev.f254716fe",
61
- "@vaadin/vaadin-themable-mixin": "24.2.0-dev.f254716fe"
50
+ "@vaadin/a11y-base": "24.3.0-alpha2",
51
+ "@vaadin/button": "24.3.0-alpha2",
52
+ "@vaadin/component-base": "24.3.0-alpha2",
53
+ "@vaadin/field-base": "24.3.0-alpha2",
54
+ "@vaadin/input-container": "24.3.0-alpha2",
55
+ "@vaadin/item": "24.3.0-alpha2",
56
+ "@vaadin/list-box": "24.3.0-alpha2",
57
+ "@vaadin/lit-renderer": "24.3.0-alpha2",
58
+ "@vaadin/overlay": "24.3.0-alpha2",
59
+ "@vaadin/vaadin-lumo-styles": "24.3.0-alpha2",
60
+ "@vaadin/vaadin-material-styles": "24.3.0-alpha2",
61
+ "@vaadin/vaadin-themable-mixin": "24.3.0-alpha2"
62
62
  },
63
63
  "devDependencies": {
64
64
  "@esm-bundle/chai": "^4.3.4",
65
- "@vaadin/testing-helpers": "^0.4.3",
65
+ "@vaadin/testing-helpers": "^0.5.0",
66
66
  "lit": "^2.0.0",
67
67
  "sinon": "^13.0.2"
68
68
  },
@@ -70,5 +70,5 @@
70
70
  "web-types.json",
71
71
  "web-types.lit.json"
72
72
  ],
73
- "gitHead": "da54950b9f8c14c6451ede0d426e16a489c7fb9b"
73
+ "gitHead": "0fd437292fa2a2f65e29b424d2456909ad2d684b"
74
74
  }
@@ -5,7 +5,10 @@
5
5
  */
6
6
  import type { Constructor } from '@open-wc/dedupe-mixin';
7
7
  import type { DelegateFocusMixinClass } from '@vaadin/a11y-base/src/delegate-focus-mixin.js';
8
+ import type { DisabledMixinClass } from '@vaadin/a11y-base/src/disabled-mixin.js';
9
+ import type { FocusMixinClass } from '@vaadin/a11y-base/src/focus-mixin.js';
8
10
  import type { KeyboardMixinClass } from '@vaadin/a11y-base/src/keyboard-mixin.js';
11
+ import type { TabindexMixinClass } from '@vaadin/a11y-base/src/tabindex-mixin.js';
9
12
  import type { DelegateStateMixinClass } from '@vaadin/component-base/src/delegate-state-mixin.js';
10
13
  import type { OverlayClassMixinClass } from '@vaadin/component-base/src/overlay-class-mixin.js';
11
14
  import type { FieldMixinClass } from '@vaadin/field-base/src/field-mixin.js';
@@ -17,11 +20,14 @@ export declare function SelectBaseMixin<T extends Constructor<HTMLElement>>(
17
20
  base: T,
18
21
  ): Constructor<DelegateFocusMixinClass> &
19
22
  Constructor<DelegateStateMixinClass> &
23
+ Constructor<DisabledMixinClass> &
20
24
  Constructor<FieldMixinClass> &
25
+ Constructor<FocusMixinClass> &
21
26
  Constructor<KeyboardMixinClass> &
22
27
  Constructor<LabelMixinClass> &
23
28
  Constructor<OverlayClassMixinClass> &
24
29
  Constructor<SelectBaseMixinClass> &
30
+ Constructor<TabindexMixinClass> &
25
31
  Constructor<ValidateMixinClass> &
26
32
  T;
27
33
 
@@ -190,6 +190,7 @@ export const SelectBaseMixin = (superClass) =>
190
190
 
191
191
  this._tooltipController = new TooltipController(this);
192
192
  this._tooltipController.setPosition('top');
193
+ this._tooltipController.setAriaTarget(this.focusElement);
193
194
  this.addController(this._tooltipController);
194
195
  }
195
196
 
@@ -259,8 +260,7 @@ export const SelectBaseMixin = (superClass) =>
259
260
  menuElement.addEventListener(
260
261
  'click',
261
262
  () => {
262
- this.__userInteraction = true;
263
- this.opened = false;
263
+ this.__dispatchChangePending = true;
264
264
  },
265
265
  true,
266
266
  );
@@ -281,8 +281,10 @@ export const SelectBaseMixin = (superClass) =>
281
281
  _valueChanged(value, oldValue) {
282
282
  this.toggleAttribute('has-value', Boolean(value));
283
283
 
284
- // Validate only if `value` changes after initialization.
285
- if (oldValue !== undefined) {
284
+ // Skip validation during initialization and when
285
+ // a change event is scheduled, as validation will be
286
+ // triggered by `__dispatchChange()` in that case.
287
+ if (oldValue !== undefined && !this.__dispatchChangePending) {
286
288
  this.validate();
287
289
  }
288
290
  }
@@ -322,7 +324,7 @@ export const SelectBaseMixin = (superClass) =>
322
324
  const currentIdx = selected !== undefined ? selected : -1;
323
325
  const newIdx = this._menuElement._searchKey(currentIdx, e.key);
324
326
  if (newIdx >= 0) {
325
- this.__userInteraction = true;
327
+ this.__dispatchChangePending = true;
326
328
 
327
329
  // Announce the value selected with the first letter shortcut
328
330
  this._updateAriaLive(true);
@@ -371,7 +373,13 @@ export const SelectBaseMixin = (superClass) =>
371
373
  if (this._openedWithFocusRing) {
372
374
  this.setAttribute('focus-ring', '');
373
375
  }
374
- this.validate();
376
+
377
+ // Skip validation when a change event is scheduled, as validation
378
+ // will be triggered by `__dispatchChange()` in that case.
379
+ // Also, skip validation when closed on Escape or Tab keys.
380
+ if (!this.__dispatchChangePending && !this._keyboardActive) {
381
+ this.validate();
382
+ }
375
383
  }
376
384
  }
377
385
 
@@ -441,6 +449,9 @@ export const SelectBaseMixin = (superClass) =>
441
449
  itemElement.removeAttribute('tabindex');
442
450
  itemElement.removeAttribute('aria-selected');
443
451
  itemElement.removeAttribute('role');
452
+ itemElement.removeAttribute('focused');
453
+ itemElement.removeAttribute('focus-ring');
454
+ itemElement.removeAttribute('active');
444
455
  itemElement.setAttribute('id', this._itemId);
445
456
  }
446
457
 
@@ -508,10 +519,9 @@ export const SelectBaseMixin = (superClass) =>
508
519
  if (!this._valueChanging) {
509
520
  this._selectedChanging = true;
510
521
  this.value = selected.value || '';
511
- if (this.__userInteraction) {
522
+ if (this.__dispatchChangePending) {
512
523
  this.opened = false;
513
- this.dispatchEvent(new CustomEvent('change', { bubbles: true }));
514
- this.__userInteraction = false;
524
+ this.__dispatchChange();
515
525
  }
516
526
  delete this._selectedChanging;
517
527
  }
@@ -600,4 +610,17 @@ export const SelectBaseMixin = (superClass) =>
600
610
  listBox.appendChild(this.__createItemElement(item));
601
611
  });
602
612
  }
613
+
614
+ /** @private */
615
+ async __dispatchChange() {
616
+ // Wait for the update complete to guarantee that value-changed is fired
617
+ // before validated and change events when using the Lit version of the component.
618
+ if (this.updateComplete) {
619
+ await this.updateComplete;
620
+ }
621
+
622
+ this.validate();
623
+ this.dispatchEvent(new CustomEvent('change', { bubbles: true }));
624
+ this.__dispatchChangePending = false;
625
+ }
603
626
  };
@@ -4,6 +4,7 @@
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
7
+ import { defineCustomElement } from '@vaadin/component-base/src/define.js';
7
8
  import { DirMixin } from '@vaadin/component-base/src/dir-mixin.js';
8
9
  import { ItemMixin } from '@vaadin/item/src/vaadin-item-mixin.js';
9
10
  import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
@@ -11,6 +12,7 @@ import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mix
11
12
  /**
12
13
  * An element used internally by `<vaadin-select>`. Not intended to be used separately.
13
14
  *
15
+ * @customElement
14
16
  * @extends HTMLElement
15
17
  * @mixes DirMixin
16
18
  * @mixes ItemMixin
@@ -48,6 +50,6 @@ class SelectItem extends ItemMixin(ThemableMixin(DirMixin(PolymerElement))) {
48
50
  }
49
51
  }
50
52
 
51
- customElements.define(SelectItem.is, SelectItem);
53
+ defineCustomElement(SelectItem);
52
54
 
53
55
  export { SelectItem };
@@ -6,12 +6,14 @@
6
6
  import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
7
7
  import { ListMixin } from '@vaadin/a11y-base/src/list-mixin.js';
8
8
  import { ControllerMixin } from '@vaadin/component-base/src/controller-mixin.js';
9
+ import { defineCustomElement } from '@vaadin/component-base/src/define.js';
9
10
  import { DirMixin } from '@vaadin/component-base/src/dir-mixin.js';
10
11
  import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
11
12
 
12
13
  /**
13
14
  * An element used internally by `<vaadin-select>`. Not intended to be used separately.
14
15
  *
16
+ * @customElement
15
17
  * @extends HTMLElement
16
18
  * @mixes ControllerMixin
17
19
  * @mixes DirMixin
@@ -76,4 +78,4 @@ class SelectListBox extends ListMixin(ThemableMixin(DirMixin(ControllerMixin(Pol
76
78
  }
77
79
  }
78
80
 
79
- customElements.define(SelectListBox.is, SelectListBox);
81
+ defineCustomElement(SelectListBox);
@@ -4,6 +4,7 @@
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
7
+ import { defineCustomElement } from '@vaadin/component-base/src/define.js';
7
8
  import { DirMixin } from '@vaadin/component-base/src/dir-mixin.js';
8
9
  import { OverlayMixin } from '@vaadin/overlay/src/vaadin-overlay-mixin.js';
9
10
  import { PositionMixin } from '@vaadin/overlay/src/vaadin-overlay-position-mixin.js';
@@ -30,6 +31,7 @@ registerStyles('vaadin-select-overlay', [overlayStyles, selectOverlayStyles], {
30
31
  /**
31
32
  * An element used internally by `<vaadin-select>`. Not intended to be used separately.
32
33
  *
34
+ * @customElement
33
35
  * @extends HTMLElement
34
36
  * @mixes DirMixin
35
37
  * @mixes OverlayMixin
@@ -69,4 +71,4 @@ export class SelectOverlay extends PositionMixin(OverlayMixin(DirMixin(ThemableM
69
71
  }
70
72
  }
71
73
 
72
- customElements.define(SelectOverlay.is, SelectOverlay);
74
+ defineCustomElement(SelectOverlay);
@@ -5,6 +5,7 @@
5
5
  */
6
6
  import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
7
7
  import { ButtonMixin } from '@vaadin/button/src/vaadin-button-mixin.js';
8
+ import { defineCustomElement } from '@vaadin/component-base/src/define.js';
8
9
  import { registerStyles, ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
9
10
  import { valueButton } from './vaadin-select-value-button-styles.js';
10
11
 
@@ -13,6 +14,7 @@ registerStyles('vaadin-select-value-button', valueButton, { moduleId: 'vaadin-se
13
14
  /**
14
15
  * An element used internally by `<vaadin-select>`. Not intended to be used separately.
15
16
  *
17
+ * @customElement
16
18
  * @extends HTMLElement
17
19
  * @mixes ButtonMixin
18
20
  * @mixes ThemableMixin
@@ -34,4 +36,4 @@ class SelectValueButton extends ButtonMixin(ThemableMixin(PolymerElement)) {
34
36
  }
35
37
  }
36
38
 
37
- customElements.define(SelectValueButton.is, SelectValueButton);
39
+ defineCustomElement(SelectValueButton);
@@ -10,6 +10,7 @@ import './vaadin-select-overlay.js';
10
10
  import './vaadin-select-value-button.js';
11
11
  import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
12
12
  import { screenReaderOnly } from '@vaadin/a11y-base/src/styles/sr-only-styles.js';
13
+ import { defineCustomElement } from '@vaadin/component-base/src/define.js';
13
14
  import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
14
15
  import { processTemplates } from '@vaadin/component-base/src/templates.js';
15
16
  import { fieldShared } from '@vaadin/field-base/src/styles/field-shared-styles.js';
@@ -126,6 +127,7 @@ registerStyles('vaadin-select', [fieldShared, inputFieldContainer, screenReaderO
126
127
  * @fires {CustomEvent} value-changed - Fired when the `value` property changes.
127
128
  * @fires {CustomEvent} validated - Fired whenever the field is validated.
128
129
  *
130
+ * @customElement
129
131
  * @extends HTMLElement
130
132
  * @mixes ElementMixin
131
133
  * @mixes SelectBaseMixin
@@ -139,6 +141,10 @@ class Select extends SelectBaseMixin(ElementMixin(ThemableMixin(PolymerElement))
139
141
  static get template() {
140
142
  return html`
141
143
  <style>
144
+ :host {
145
+ position: relative;
146
+ }
147
+
142
148
  ::slotted([slot='value']) {
143
149
  flex-grow: 1;
144
150
  }
@@ -228,6 +234,6 @@ class Select extends SelectBaseMixin(ElementMixin(ThemableMixin(PolymerElement))
228
234
  */
229
235
  }
230
236
 
231
- customElements.define(Select.is, Select);
237
+ defineCustomElement(Select);
232
238
 
233
239
  export { Select };
@@ -3,6 +3,7 @@
3
3
  * Copyright (c) 2017 - 2023 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
+ import '@vaadin/input-container/theme/lumo/vaadin-input-container-styles.js';
6
7
  import '@vaadin/vaadin-lumo-styles/sizing.js';
7
8
  import '@vaadin/vaadin-lumo-styles/style.js';
8
9
  import '@vaadin/vaadin-lumo-styles/font-icons.js';
@@ -3,6 +3,5 @@
3
3
  * Copyright (c) 2017 - 2023 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
- import '@vaadin/input-container/theme/lumo/vaadin-input-container.js';
7
6
  import './vaadin-select-styles.js';
8
7
  import '../../src/vaadin-select.js';
@@ -3,6 +3,7 @@
3
3
  * Copyright (c) 2017 - 2023 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
+ import '@vaadin/input-container/theme/material/vaadin-input-container-styles.js';
6
7
  import '@vaadin/vaadin-material-styles/font-icons.js';
7
8
  import { item } from '@vaadin/item/theme/material/vaadin-item-styles.js';
8
9
  import { listBox } from '@vaadin/list-box/theme/material/vaadin-list-box-styles.js';
@@ -3,6 +3,5 @@
3
3
  * Copyright (c) 2017 - 2023 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
- import '@vaadin/input-container/theme/material/vaadin-input-container.js';
7
6
  import './vaadin-select-styles.js';
8
7
  import '../../src/vaadin-select.js';
package/web-types.json ADDED
@@ -0,0 +1,392 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/web-types",
3
+ "name": "@vaadin/select",
4
+ "version": "24.3.0-alpha2",
5
+ "description-markup": "markdown",
6
+ "contributions": {
7
+ "html": {
8
+ "elements": [
9
+ {
10
+ "name": "vaadin-select",
11
+ "description": "`<vaadin-select>` is a Web Component for selecting values from a list of items.\n\n### Items\n\nUse the `items` property to define possible options for the select:\n\n```html\n<vaadin-select id=\"select\"></vaadin-select>\n```\n```js\nconst select = document.querySelector('#select');\nselect.items = [\n { label: 'Most recent first', value: 'recent' },\n { component: 'hr' },\n { label: 'Rating: low to high', value: 'rating-asc' },\n { label: 'Rating: high to low', value: 'rating-desc' },\n { component: 'hr' },\n { label: 'Price: low to high', value: 'price-asc', disabled: true },\n { label: 'Price: high to low', value: 'price-desc', disabled: true }\n];\n```\n\n### Rendering\n\nAlternatively, the content of the select can be populated by using the renderer callback function.\n\nThe renderer function provides `root`, `select` arguments.\nGenerate DOM content, append it to the `root` element and control the state\nof the host element by accessing `select`.\n\n```js\nconst select = document.querySelector('#select');\nselect.renderer = function(root, select) {\n const listBox = document.createElement('vaadin-list-box');\n // append 3 <vaadin-item> elements\n ['Jose', 'Manolo', 'Pedro'].forEach(function(name) {\n const item = document.createElement('vaadin-item');\n item.textContent = name;\n item.setAttribute('label', name)\n listBox.appendChild(item);\n });\n\n // update the content\n root.appendChild(listBox);\n};\n```\n\nRenderer is called on initialization of new select and on its opening.\nDOM generated during the renderer call can be reused\nin the next renderer call and will be provided with the `root` argument.\nOn first call it will be empty.\n\n* Hint: By setting the `label` property of inner vaadin-items you will\nbe able to change the visual representation of the selected value in the input part.\n\n### Styling\n\nThe following custom properties are available for styling:\n\nCustom property | Description | Target element | Default\n-----------------------------------|------------------------------|----------------------------------\n`--vaadin-field-default-width` | Default width of the field | :host | `12em`\n`--vaadin-select-text-field-width` | Effective width of the field | `vaadin-select-overlay` |\n\n`<vaadin-select>` provides mostly 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.3.0-alpha2/#/elements/vaadin-text-field) for the styling documentation.\n\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 select is open | :host\n\nThere are two exceptions in terms of styling compared to `<vaadin-text-field>`:\n- the `clear-button` shadow DOM part does not exist in `<vaadin-select>`.\n- the `input-prevented` state attribute is not supported by `<vaadin-select>`.\n\n### Internal components\n\nIn addition to `<vaadin-select>` itself, the following internal\ncomponents are themable:\n\n- `<vaadin-select-overlay>` - has the same API as [`<vaadin-overlay>`](https://cdn.vaadin.com/vaadin-web-components/24.3.0-alpha2/#/elements/vaadin-overlay).\n- `<vaadin-select-value-button>` - has the same API as [`<vaadin-button>`](https://cdn.vaadin.com/vaadin-web-components/24.3.0-alpha2/#/elements/vaadin-button).\n- [`<vaadin-input-container>`](https://cdn.vaadin.com/vaadin-web-components/24.3.0-alpha2/#/elements/vaadin-input-container) - an internal element wrapping the button.\n\nNote: the `theme` attribute value set on `<vaadin-select>` is\npropagated to the internal components listed above.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
12
+ "attributes": [
13
+ {
14
+ "name": "disabled",
15
+ "description": "If true, the user cannot interact with this element.",
16
+ "value": {
17
+ "type": [
18
+ "boolean",
19
+ "null",
20
+ "undefined"
21
+ ]
22
+ }
23
+ },
24
+ {
25
+ "name": "autofocus",
26
+ "description": "Specify that this control should have input focus when the page loads.",
27
+ "value": {
28
+ "type": [
29
+ "boolean",
30
+ "null",
31
+ "undefined"
32
+ ]
33
+ }
34
+ },
35
+ {
36
+ "name": "label",
37
+ "description": "The label text for the input node.\nWhen no light dom defined via [slot=label], this value will be used.",
38
+ "value": {
39
+ "type": [
40
+ "string",
41
+ "null",
42
+ "undefined"
43
+ ]
44
+ }
45
+ },
46
+ {
47
+ "name": "invalid",
48
+ "description": "Set to true when the field is invalid.",
49
+ "value": {
50
+ "type": [
51
+ "boolean",
52
+ "null",
53
+ "undefined"
54
+ ]
55
+ }
56
+ },
57
+ {
58
+ "name": "required",
59
+ "description": "Specifies that the user must fill in a value.",
60
+ "value": {
61
+ "type": [
62
+ "boolean",
63
+ "null",
64
+ "undefined"
65
+ ]
66
+ }
67
+ },
68
+ {
69
+ "name": "error-message",
70
+ "description": "Error to show when the field is invalid.",
71
+ "value": {
72
+ "type": [
73
+ "string",
74
+ "null",
75
+ "undefined"
76
+ ]
77
+ }
78
+ },
79
+ {
80
+ "name": "helper-text",
81
+ "description": "String used for the helper text.",
82
+ "value": {
83
+ "type": [
84
+ "string",
85
+ "null",
86
+ "undefined"
87
+ ]
88
+ }
89
+ },
90
+ {
91
+ "name": "accessible-name",
92
+ "description": "String used to label the component to screen reader users.",
93
+ "value": {
94
+ "type": [
95
+ "string",
96
+ "null",
97
+ "undefined"
98
+ ]
99
+ }
100
+ },
101
+ {
102
+ "name": "accessible-name-ref",
103
+ "description": "Id of the element used as label of the component to screen reader users.",
104
+ "value": {
105
+ "type": [
106
+ "string",
107
+ "null",
108
+ "undefined"
109
+ ]
110
+ }
111
+ },
112
+ {
113
+ "name": "overlay-class",
114
+ "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.",
115
+ "value": {
116
+ "type": [
117
+ "string",
118
+ "null",
119
+ "undefined"
120
+ ]
121
+ }
122
+ },
123
+ {
124
+ "name": "opened",
125
+ "description": "Set when the select is open",
126
+ "value": {
127
+ "type": [
128
+ "boolean"
129
+ ]
130
+ }
131
+ },
132
+ {
133
+ "name": "value",
134
+ "description": "The `value` property of the selected item, or an empty string\nif no item is selected.\nOn change or initialization, the component finds the item which matches the\nvalue and displays it.\nIf no value is provided to the component, it selects the first item without\nvalue or empty value.\nHint: If you do not want to select any item by default, you can either set all\nthe values of inner vaadin-items, or set the vaadin-select value to\nan inexistent value in the items list.",
135
+ "value": {
136
+ "type": [
137
+ "string"
138
+ ]
139
+ }
140
+ },
141
+ {
142
+ "name": "name",
143
+ "description": "The name of this element.",
144
+ "value": {
145
+ "type": [
146
+ "string",
147
+ "null",
148
+ "undefined"
149
+ ]
150
+ }
151
+ },
152
+ {
153
+ "name": "placeholder",
154
+ "description": "A hint to the user of what can be entered in the control.\nThe placeholder will be displayed in the case that there\nis no item selected, or the selected item has an empty\nstring label, or the selected item has no label and it's\nDOM content is empty.",
155
+ "value": {
156
+ "type": [
157
+ "string",
158
+ "null",
159
+ "undefined"
160
+ ]
161
+ }
162
+ },
163
+ {
164
+ "name": "readonly",
165
+ "description": "When present, it specifies that the element is read-only.",
166
+ "value": {
167
+ "type": [
168
+ "boolean"
169
+ ]
170
+ }
171
+ },
172
+ {
173
+ "name": "theme",
174
+ "description": "The theme variants to apply to the component.",
175
+ "value": {
176
+ "type": [
177
+ "string",
178
+ "null",
179
+ "undefined"
180
+ ]
181
+ }
182
+ }
183
+ ],
184
+ "js": {
185
+ "properties": [
186
+ {
187
+ "name": "disabled",
188
+ "description": "If true, the user cannot interact with this element.",
189
+ "value": {
190
+ "type": [
191
+ "boolean",
192
+ "null",
193
+ "undefined"
194
+ ]
195
+ }
196
+ },
197
+ {
198
+ "name": "autofocus",
199
+ "description": "Specify that this control should have input focus when the page loads.",
200
+ "value": {
201
+ "type": [
202
+ "boolean",
203
+ "null",
204
+ "undefined"
205
+ ]
206
+ }
207
+ },
208
+ {
209
+ "name": "label",
210
+ "description": "The label text for the input node.\nWhen no light dom defined via [slot=label], this value will be used.",
211
+ "value": {
212
+ "type": [
213
+ "string",
214
+ "null",
215
+ "undefined"
216
+ ]
217
+ }
218
+ },
219
+ {
220
+ "name": "invalid",
221
+ "description": "Set to true when the field is invalid.",
222
+ "value": {
223
+ "type": [
224
+ "boolean",
225
+ "null",
226
+ "undefined"
227
+ ]
228
+ }
229
+ },
230
+ {
231
+ "name": "required",
232
+ "description": "Specifies that the user must fill in a value.",
233
+ "value": {
234
+ "type": [
235
+ "boolean",
236
+ "null",
237
+ "undefined"
238
+ ]
239
+ }
240
+ },
241
+ {
242
+ "name": "errorMessage",
243
+ "description": "Error to show when the field is invalid.",
244
+ "value": {
245
+ "type": [
246
+ "string",
247
+ "null",
248
+ "undefined"
249
+ ]
250
+ }
251
+ },
252
+ {
253
+ "name": "helperText",
254
+ "description": "String used for the helper text.",
255
+ "value": {
256
+ "type": [
257
+ "string",
258
+ "null",
259
+ "undefined"
260
+ ]
261
+ }
262
+ },
263
+ {
264
+ "name": "accessibleName",
265
+ "description": "String used to label the component to screen reader users.",
266
+ "value": {
267
+ "type": [
268
+ "string",
269
+ "null",
270
+ "undefined"
271
+ ]
272
+ }
273
+ },
274
+ {
275
+ "name": "accessibleNameRef",
276
+ "description": "Id of the element used as label of the component to screen reader users.",
277
+ "value": {
278
+ "type": [
279
+ "string",
280
+ "null",
281
+ "undefined"
282
+ ]
283
+ }
284
+ },
285
+ {
286
+ "name": "overlayClass",
287
+ "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.",
288
+ "value": {
289
+ "type": [
290
+ "string",
291
+ "null",
292
+ "undefined"
293
+ ]
294
+ }
295
+ },
296
+ {
297
+ "name": "items",
298
+ "description": "An array containing items that will be rendered as the options of the select.\n\n#### Example\n```js\nselect.items = [\n { label: 'Most recent first', value: 'recent' },\n { component: 'hr' },\n { label: 'Rating: low to high', value: 'rating-asc' },\n { label: 'Rating: high to low', value: 'rating-desc' },\n { component: 'hr' },\n { label: 'Price: low to high', value: 'price-asc', disabled: true },\n { label: 'Price: high to low', value: 'price-desc', disabled: true }\n];\n```\n\nNote: each item is rendered by default as the internal `<vaadin-select-item>` that is an extension of `<vaadin-item>`.\nTo render the item with a custom component, provide a tag name by the `component` property.",
299
+ "value": {
300
+ "type": [
301
+ "Array.<SelectItem>"
302
+ ]
303
+ }
304
+ },
305
+ {
306
+ "name": "opened",
307
+ "description": "Set when the select is open",
308
+ "value": {
309
+ "type": [
310
+ "boolean"
311
+ ]
312
+ }
313
+ },
314
+ {
315
+ "name": "renderer",
316
+ "description": "Custom function for rendering the content of the `<vaadin-select>`.\nReceives two arguments:\n\n- `root` The `<vaadin-select-overlay>` internal container\n DOM element. Append your content to it.\n- `select` The reference to the `<vaadin-select>` element.",
317
+ "value": {
318
+ "type": [
319
+ "SelectRenderer",
320
+ "undefined"
321
+ ]
322
+ }
323
+ },
324
+ {
325
+ "name": "value",
326
+ "description": "The `value` property of the selected item, or an empty string\nif no item is selected.\nOn change or initialization, the component finds the item which matches the\nvalue and displays it.\nIf no value is provided to the component, it selects the first item without\nvalue or empty value.\nHint: If you do not want to select any item by default, you can either set all\nthe values of inner vaadin-items, or set the vaadin-select value to\nan inexistent value in the items list.",
327
+ "value": {
328
+ "type": [
329
+ "string"
330
+ ]
331
+ }
332
+ },
333
+ {
334
+ "name": "name",
335
+ "description": "The name of this element.",
336
+ "value": {
337
+ "type": [
338
+ "string",
339
+ "null",
340
+ "undefined"
341
+ ]
342
+ }
343
+ },
344
+ {
345
+ "name": "placeholder",
346
+ "description": "A hint to the user of what can be entered in the control.\nThe placeholder will be displayed in the case that there\nis no item selected, or the selected item has an empty\nstring label, or the selected item has no label and it's\nDOM content is empty.",
347
+ "value": {
348
+ "type": [
349
+ "string",
350
+ "null",
351
+ "undefined"
352
+ ]
353
+ }
354
+ },
355
+ {
356
+ "name": "readonly",
357
+ "description": "When present, it specifies that the element is read-only.",
358
+ "value": {
359
+ "type": [
360
+ "boolean"
361
+ ]
362
+ }
363
+ }
364
+ ],
365
+ "events": [
366
+ {
367
+ "name": "validated",
368
+ "description": "Fired whenever the field is validated."
369
+ },
370
+ {
371
+ "name": "change",
372
+ "description": "Fired when the user commits a value change."
373
+ },
374
+ {
375
+ "name": "invalid-changed",
376
+ "description": "Fired when the `invalid` property changes."
377
+ },
378
+ {
379
+ "name": "opened-changed",
380
+ "description": "Fired when the `opened` property changes."
381
+ },
382
+ {
383
+ "name": "value-changed",
384
+ "description": "Fired when the `value` property changes."
385
+ }
386
+ ]
387
+ }
388
+ }
389
+ ]
390
+ }
391
+ }
392
+ }
@@ -0,0 +1,181 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/web-types",
3
+ "name": "@vaadin/select",
4
+ "version": "24.3.0-alpha2",
5
+ "description-markup": "markdown",
6
+ "framework": "lit",
7
+ "framework-config": {
8
+ "enable-when": {
9
+ "node-packages": [
10
+ "lit"
11
+ ]
12
+ }
13
+ },
14
+ "contributions": {
15
+ "html": {
16
+ "elements": [
17
+ {
18
+ "name": "vaadin-select",
19
+ "description": "`<vaadin-select>` is a Web Component for selecting values from a list of items.\n\n### Items\n\nUse the `items` property to define possible options for the select:\n\n```html\n<vaadin-select id=\"select\"></vaadin-select>\n```\n```js\nconst select = document.querySelector('#select');\nselect.items = [\n { label: 'Most recent first', value: 'recent' },\n { component: 'hr' },\n { label: 'Rating: low to high', value: 'rating-asc' },\n { label: 'Rating: high to low', value: 'rating-desc' },\n { component: 'hr' },\n { label: 'Price: low to high', value: 'price-asc', disabled: true },\n { label: 'Price: high to low', value: 'price-desc', disabled: true }\n];\n```\n\n### Rendering\n\nAlternatively, the content of the select can be populated by using the renderer callback function.\n\nThe renderer function provides `root`, `select` arguments.\nGenerate DOM content, append it to the `root` element and control the state\nof the host element by accessing `select`.\n\n```js\nconst select = document.querySelector('#select');\nselect.renderer = function(root, select) {\n const listBox = document.createElement('vaadin-list-box');\n // append 3 <vaadin-item> elements\n ['Jose', 'Manolo', 'Pedro'].forEach(function(name) {\n const item = document.createElement('vaadin-item');\n item.textContent = name;\n item.setAttribute('label', name)\n listBox.appendChild(item);\n });\n\n // update the content\n root.appendChild(listBox);\n};\n```\n\nRenderer is called on initialization of new select and on its opening.\nDOM generated during the renderer call can be reused\nin the next renderer call and will be provided with the `root` argument.\nOn first call it will be empty.\n\n* Hint: By setting the `label` property of inner vaadin-items you will\nbe able to change the visual representation of the selected value in the input part.\n\n### Styling\n\nThe following custom properties are available for styling:\n\nCustom property | Description | Target element | Default\n-----------------------------------|------------------------------|----------------------------------\n`--vaadin-field-default-width` | Default width of the field | :host | `12em`\n`--vaadin-select-text-field-width` | Effective width of the field | `vaadin-select-overlay` |\n\n`<vaadin-select>` provides mostly 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.3.0-alpha2/#/elements/vaadin-text-field) for the styling documentation.\n\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 select is open | :host\n\nThere are two exceptions in terms of styling compared to `<vaadin-text-field>`:\n- the `clear-button` shadow DOM part does not exist in `<vaadin-select>`.\n- the `input-prevented` state attribute is not supported by `<vaadin-select>`.\n\n### Internal components\n\nIn addition to `<vaadin-select>` itself, the following internal\ncomponents are themable:\n\n- `<vaadin-select-overlay>` - has the same API as [`<vaadin-overlay>`](https://cdn.vaadin.com/vaadin-web-components/24.3.0-alpha2/#/elements/vaadin-overlay).\n- `<vaadin-select-value-button>` - has the same API as [`<vaadin-button>`](https://cdn.vaadin.com/vaadin-web-components/24.3.0-alpha2/#/elements/vaadin-button).\n- [`<vaadin-input-container>`](https://cdn.vaadin.com/vaadin-web-components/24.3.0-alpha2/#/elements/vaadin-input-container) - an internal element wrapping the button.\n\nNote: the `theme` attribute value set on `<vaadin-select>` is\npropagated to the internal components listed above.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
20
+ "extension": true,
21
+ "attributes": [
22
+ {
23
+ "name": "?disabled",
24
+ "description": "If true, the user cannot interact with this element.",
25
+ "value": {
26
+ "kind": "expression"
27
+ }
28
+ },
29
+ {
30
+ "name": "?autofocus",
31
+ "description": "Specify that this control should have input focus when the page loads.",
32
+ "value": {
33
+ "kind": "expression"
34
+ }
35
+ },
36
+ {
37
+ "name": "?invalid",
38
+ "description": "Set to true when the field is invalid.",
39
+ "value": {
40
+ "kind": "expression"
41
+ }
42
+ },
43
+ {
44
+ "name": "?required",
45
+ "description": "Specifies that the user must fill in a value.",
46
+ "value": {
47
+ "kind": "expression"
48
+ }
49
+ },
50
+ {
51
+ "name": "?opened",
52
+ "description": "Set when the select is open",
53
+ "value": {
54
+ "kind": "expression"
55
+ }
56
+ },
57
+ {
58
+ "name": "?readonly",
59
+ "description": "When present, it specifies that the element is read-only.",
60
+ "value": {
61
+ "kind": "expression"
62
+ }
63
+ },
64
+ {
65
+ "name": ".label",
66
+ "description": "The label text for the input node.\nWhen no light dom defined via [slot=label], this value will be used.",
67
+ "value": {
68
+ "kind": "expression"
69
+ }
70
+ },
71
+ {
72
+ "name": ".errorMessage",
73
+ "description": "Error to show when the field is invalid.",
74
+ "value": {
75
+ "kind": "expression"
76
+ }
77
+ },
78
+ {
79
+ "name": ".helperText",
80
+ "description": "String used for the helper text.",
81
+ "value": {
82
+ "kind": "expression"
83
+ }
84
+ },
85
+ {
86
+ "name": ".accessibleName",
87
+ "description": "String used to label the component to screen reader users.",
88
+ "value": {
89
+ "kind": "expression"
90
+ }
91
+ },
92
+ {
93
+ "name": ".accessibleNameRef",
94
+ "description": "Id of the element used as label of the component to screen reader users.",
95
+ "value": {
96
+ "kind": "expression"
97
+ }
98
+ },
99
+ {
100
+ "name": ".overlayClass",
101
+ "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.",
102
+ "value": {
103
+ "kind": "expression"
104
+ }
105
+ },
106
+ {
107
+ "name": ".items",
108
+ "description": "An array containing items that will be rendered as the options of the select.\n\n#### Example\n```js\nselect.items = [\n { label: 'Most recent first', value: 'recent' },\n { component: 'hr' },\n { label: 'Rating: low to high', value: 'rating-asc' },\n { label: 'Rating: high to low', value: 'rating-desc' },\n { component: 'hr' },\n { label: 'Price: low to high', value: 'price-asc', disabled: true },\n { label: 'Price: high to low', value: 'price-desc', disabled: true }\n];\n```\n\nNote: each item is rendered by default as the internal `<vaadin-select-item>` that is an extension of `<vaadin-item>`.\nTo render the item with a custom component, provide a tag name by the `component` property.",
109
+ "value": {
110
+ "kind": "expression"
111
+ }
112
+ },
113
+ {
114
+ "name": ".renderer",
115
+ "description": "Custom function for rendering the content of the `<vaadin-select>`.\nReceives two arguments:\n\n- `root` The `<vaadin-select-overlay>` internal container\n DOM element. Append your content to it.\n- `select` The reference to the `<vaadin-select>` element.",
116
+ "value": {
117
+ "kind": "expression"
118
+ }
119
+ },
120
+ {
121
+ "name": ".value",
122
+ "description": "The `value` property of the selected item, or an empty string\nif no item is selected.\nOn change or initialization, the component finds the item which matches the\nvalue and displays it.\nIf no value is provided to the component, it selects the first item without\nvalue or empty value.\nHint: If you do not want to select any item by default, you can either set all\nthe values of inner vaadin-items, or set the vaadin-select value to\nan inexistent value in the items list.",
123
+ "value": {
124
+ "kind": "expression"
125
+ }
126
+ },
127
+ {
128
+ "name": ".name",
129
+ "description": "The name of this element.",
130
+ "value": {
131
+ "kind": "expression"
132
+ }
133
+ },
134
+ {
135
+ "name": ".placeholder",
136
+ "description": "A hint to the user of what can be entered in the control.\nThe placeholder will be displayed in the case that there\nis no item selected, or the selected item has an empty\nstring label, or the selected item has no label and it's\nDOM content is empty.",
137
+ "value": {
138
+ "kind": "expression"
139
+ }
140
+ },
141
+ {
142
+ "name": "@validated",
143
+ "description": "Fired whenever the field is validated.",
144
+ "value": {
145
+ "kind": "expression"
146
+ }
147
+ },
148
+ {
149
+ "name": "@change",
150
+ "description": "Fired when the user commits a value change.",
151
+ "value": {
152
+ "kind": "expression"
153
+ }
154
+ },
155
+ {
156
+ "name": "@invalid-changed",
157
+ "description": "Fired when the `invalid` property changes.",
158
+ "value": {
159
+ "kind": "expression"
160
+ }
161
+ },
162
+ {
163
+ "name": "@opened-changed",
164
+ "description": "Fired when the `opened` property changes.",
165
+ "value": {
166
+ "kind": "expression"
167
+ }
168
+ },
169
+ {
170
+ "name": "@value-changed",
171
+ "description": "Fired when the `value` property changes.",
172
+ "value": {
173
+ "kind": "expression"
174
+ }
175
+ }
176
+ ]
177
+ }
178
+ ]
179
+ }
180
+ }
181
+ }