@vaadin/select 23.3.3 → 24.0.0-alpha10

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": "23.3.3",
3
+ "version": "24.0.0-alpha10",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -38,22 +38,20 @@
38
38
  ],
39
39
  "dependencies": {
40
40
  "@polymer/polymer": "^3.2.0",
41
- "@vaadin/button": "~23.3.3",
42
- "@vaadin/component-base": "~23.3.3",
43
- "@vaadin/field-base": "~23.3.3",
44
- "@vaadin/input-container": "~23.3.3",
45
- "@vaadin/item": "~23.3.3",
46
- "@vaadin/list-box": "~23.3.3",
47
- "@vaadin/lit-renderer": "~23.3.3",
48
- "@vaadin/overlay": "~23.3.3",
49
- "@vaadin/vaadin-list-mixin": "~23.3.3",
50
- "@vaadin/vaadin-lumo-styles": "~23.3.3",
51
- "@vaadin/vaadin-material-styles": "~23.3.3",
52
- "@vaadin/vaadin-themable-mixin": "~23.3.3"
41
+ "@vaadin/button": "24.0.0-alpha10",
42
+ "@vaadin/component-base": "24.0.0-alpha10",
43
+ "@vaadin/field-base": "24.0.0-alpha10",
44
+ "@vaadin/input-container": "24.0.0-alpha10",
45
+ "@vaadin/item": "24.0.0-alpha10",
46
+ "@vaadin/list-box": "24.0.0-alpha10",
47
+ "@vaadin/lit-renderer": "24.0.0-alpha10",
48
+ "@vaadin/overlay": "24.0.0-alpha10",
49
+ "@vaadin/vaadin-lumo-styles": "24.0.0-alpha10",
50
+ "@vaadin/vaadin-material-styles": "24.0.0-alpha10",
51
+ "@vaadin/vaadin-themable-mixin": "24.0.0-alpha10"
53
52
  },
54
53
  "devDependencies": {
55
54
  "@esm-bundle/chai": "^4.3.4",
56
- "@vaadin/polymer-legacy-adapter": "~23.3.3",
57
55
  "@vaadin/testing-helpers": "^0.3.2",
58
56
  "lit": "^2.0.0",
59
57
  "sinon": "^13.0.2"
@@ -62,5 +60,5 @@
62
60
  "web-types.json",
63
61
  "web-types.lit.json"
64
62
  ],
65
- "gitHead": "1529ed623e053d28a3c1c66af55ebe402743ddd0"
63
+ "gitHead": "2e04534d8b47bcd216f89b5f849bafef1a73b174"
66
64
  }
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2023 Vaadin Ltd.
4
+ * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
+ */
6
+ import { SlotController } from '@vaadin/component-base/src/slot-controller.js';
7
+
8
+ /**
9
+ * A controller to manage the value button element.
10
+ */
11
+ export class ButtonController extends SlotController {}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2023 Vaadin Ltd.
4
+ * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
+ */
6
+ import { SlotController } from '@vaadin/component-base/src/slot-controller.js';
7
+
8
+ /**
9
+ * A controller to manage the value button element.
10
+ */
11
+ export class ButtonController extends SlotController {
12
+ constructor(host) {
13
+ super(host, 'value', 'vaadin-select-value-button', {
14
+ initializer: (button, host) => {
15
+ host._setFocusElement(button);
16
+ host.ariaTarget = button;
17
+ host.stateTarget = button;
18
+
19
+ button.setAttribute('aria-haspopup', 'listbox');
20
+ },
21
+ });
22
+ }
23
+ }
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2017 - 2022 Vaadin Ltd.
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
6
  import type { TemplateResult } from 'lit';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2017 - 2022 Vaadin Ltd.
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
6
  import { directive } from 'lit/directive.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2017 - 2022 Vaadin Ltd.
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
6
  import { Item } from '@vaadin/item/src/vaadin-item.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2017 - 2022 Vaadin Ltd.
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
6
  import { ListBox } from '@vaadin/list-box/src/vaadin-list-box.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2017 - 2022 Vaadin Ltd.
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
6
  import { Overlay } from '@vaadin/overlay/src/vaadin-overlay.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2017 - 2022 Vaadin Ltd.
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
6
  import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
@@ -1,11 +1,13 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2017 - 2022 Vaadin Ltd.
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 { DelegateFocusMixin } from '@vaadin/component-base/src/delegate-focus-mixin.js';
7
+ import { DelegateStateMixin } from '@vaadin/component-base/src/delegate-state-mixin.js';
6
8
  import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
7
- import { DelegateFocusMixin } from '@vaadin/field-base/src/delegate-focus-mixin.js';
8
- import { DelegateStateMixin } from '@vaadin/field-base/src/delegate-state-mixin.js';
9
+ import { KeyboardMixin } from '@vaadin/component-base/src/keyboard-mixin.js';
10
+ import { OverlayClassMixin } from '@vaadin/component-base/src/overlay-class-mixin.js';
9
11
  import { FieldMixin } from '@vaadin/field-base/src/field-mixin.js';
10
12
  import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
11
13
 
@@ -172,8 +174,8 @@ export interface SelectEventMap extends HTMLElementEventMap, SelectCustomEventMa
172
174
  * @fires {CustomEvent} value-changed - Fired when the `value` property changes.
173
175
  * @fires {CustomEvent} validated - Fired whenever the field is validated.
174
176
  */
175
- declare class Select extends DelegateFocusMixin(
176
- DelegateStateMixin(FieldMixin(ElementMixin(ThemableMixin(HTMLElement)))),
177
+ declare class Select extends OverlayClassMixin(
178
+ DelegateFocusMixin(DelegateStateMixin(KeyboardMixin(FieldMixin(ElementMixin(ThemableMixin(HTMLElement)))))),
177
179
  ) {
178
180
  /**
179
181
  * An array containing items that will be rendered as the options of the select.
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2017 - 2022 Vaadin Ltd.
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
6
  import '@vaadin/input-container/src/vaadin-input-container.js';
@@ -9,18 +9,20 @@ import './vaadin-select-list-box.js';
9
9
  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
+ import { DelegateFocusMixin } from '@vaadin/component-base/src/delegate-focus-mixin.js';
13
+ import { DelegateStateMixin } from '@vaadin/component-base/src/delegate-state-mixin.js';
12
14
  import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
15
+ import { KeyboardMixin } from '@vaadin/component-base/src/keyboard-mixin.js';
13
16
  import { MediaQueryController } from '@vaadin/component-base/src/media-query-controller.js';
14
- import { SlotController } from '@vaadin/component-base/src/slot-controller.js';
17
+ import { OverlayClassMixin } from '@vaadin/component-base/src/overlay-class-mixin.js';
15
18
  import { processTemplates } from '@vaadin/component-base/src/templates.js';
16
19
  import { TooltipController } from '@vaadin/component-base/src/tooltip-controller.js';
17
20
  import { generateUniqueId } from '@vaadin/component-base/src/unique-id-utils.js';
18
- import { DelegateFocusMixin } from '@vaadin/field-base/src/delegate-focus-mixin.js';
19
- import { DelegateStateMixin } from '@vaadin/field-base/src/delegate-state-mixin.js';
20
21
  import { FieldMixin } from '@vaadin/field-base/src/field-mixin.js';
21
22
  import { fieldShared } from '@vaadin/field-base/src/styles/field-shared-styles.js';
22
23
  import { inputFieldContainer } from '@vaadin/field-base/src/styles/input-field-container-styles.js';
23
24
  import { registerStyles, ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
25
+ import { ButtonController } from './button-controller.js';
24
26
 
25
27
  registerStyles('vaadin-select', [fieldShared, inputFieldContainer], { moduleId: 'vaadin-select-styles' });
26
28
 
@@ -135,8 +137,12 @@ registerStyles('vaadin-select', [fieldShared, inputFieldContainer], { moduleId:
135
137
  * @mixes FieldMixin
136
138
  * @mixes DelegateFocusMixin
137
139
  * @mixes DelegateStateMixin
140
+ * @mixes KeyboardMixin
141
+ * @mixes OverlayClassMixin
138
142
  */
139
- class Select extends DelegateFocusMixin(DelegateStateMixin(FieldMixin(ElementMixin(ThemableMixin(PolymerElement))))) {
143
+ class Select extends OverlayClassMixin(
144
+ DelegateFocusMixin(DelegateStateMixin(KeyboardMixin(FieldMixin(ElementMixin(ThemableMixin(PolymerElement)))))),
145
+ ) {
140
146
  static get is() {
141
147
  return 'vaadin-select';
142
148
  }
@@ -297,9 +303,6 @@ class Select extends DelegateFocusMixin(DelegateStateMixin(FieldMixin(ElementMix
297
303
  value: '(max-width: 420px), (max-height: 420px)',
298
304
  },
299
305
 
300
- /** @private */
301
- _overlayElement: Object,
302
-
303
306
  /** @private */
304
307
  _inputContainer: Object,
305
308
 
@@ -314,23 +317,16 @@ class Select extends DelegateFocusMixin(DelegateStateMixin(FieldMixin(ElementMix
314
317
 
315
318
  static get observers() {
316
319
  return [
317
- '_updateAriaExpanded(opened)',
320
+ '_updateAriaExpanded(opened, focusElement)',
318
321
  '_updateSelectedItem(value, _items, placeholder)',
319
322
  '_rendererChanged(renderer, _overlayElement)',
320
323
  ];
321
324
  }
322
325
 
323
- /** @protected */
324
- get _valueButton() {
325
- return this._valueButtonController && this._valueButtonController.node;
326
- }
327
-
328
326
  constructor() {
329
327
  super();
330
328
 
331
- this._fieldId = `${this.localName}-${generateUniqueId()}`;
332
-
333
- this._boundOnKeyDown = this._onKeyDown.bind(this);
329
+ this._itemId = `value-${this.localName}-${generateUniqueId()}`;
334
330
  }
335
331
 
336
332
  /** @protected */
@@ -348,23 +344,7 @@ class Select extends DelegateFocusMixin(DelegateStateMixin(FieldMixin(ElementMix
348
344
  this._overlayElement = this.shadowRoot.querySelector('vaadin-select-overlay');
349
345
  this._inputContainer = this.shadowRoot.querySelector('[part~="input-field"]');
350
346
 
351
- this._valueButtonController = new SlotController(
352
- this,
353
- 'value',
354
- () => document.createElement('vaadin-select-value-button'),
355
- (host, btn) => {
356
- this._setFocusElement(btn);
357
- this.ariaTarget = btn;
358
- this.stateTarget = btn;
359
-
360
- btn.setAttribute('aria-haspopup', 'listbox');
361
- btn.setAttribute('aria-labelledby', `${this._labelId} ${this._fieldId}`);
362
-
363
- this._updateAriaExpanded(host.opened);
364
-
365
- btn.addEventListener('keydown', this._boundOnKeyDown);
366
- },
367
- );
347
+ this._valueButtonController = new ButtonController(this);
368
348
  this.addController(this._valueButtonController);
369
349
 
370
350
  this.addController(
@@ -515,10 +495,11 @@ class Select extends DelegateFocusMixin(DelegateStateMixin(FieldMixin(ElementMix
515
495
  /**
516
496
  * @param {!KeyboardEvent} e
517
497
  * @protected
498
+ * @override
518
499
  */
519
500
  _onKeyDown(e) {
520
- if (!this.readonly && !this.opened) {
521
- if (/^(Enter|SpaceBar|\s|ArrowDown|Down|ArrowUp|Up)$/.test(e.key)) {
501
+ if (e.target === this.focusElement && !this.readonly && !this.opened) {
502
+ if (/^(Enter|SpaceBar|\s|ArrowDown|Down|ArrowUp|Up)$/u.test(e.key)) {
522
503
  e.preventDefault();
523
504
  this.opened = true;
524
505
  } else if (/[\p{L}\p{Nd}]/u.test(e.key) && e.key.length === 1) {
@@ -541,7 +522,7 @@ class Select extends DelegateFocusMixin(DelegateStateMixin(FieldMixin(ElementMix
541
522
  * @protected
542
523
  */
543
524
  _onKeyDownInside(e) {
544
- if (/^(Tab)$/.test(e.key)) {
525
+ if (/^(Tab)$/u.test(e.key)) {
545
526
  this.opened = false;
546
527
  }
547
528
  }
@@ -582,19 +563,19 @@ class Select extends DelegateFocusMixin(DelegateStateMixin(FieldMixin(ElementMix
582
563
  }
583
564
 
584
565
  /** @private */
585
- _updateAriaExpanded(opened) {
586
- if (this._valueButton) {
587
- this._valueButton.setAttribute('aria-expanded', opened ? 'true' : 'false');
566
+ _updateAriaExpanded(opened, focusElement) {
567
+ if (focusElement) {
568
+ focusElement.setAttribute('aria-expanded', opened ? 'true' : 'false');
588
569
  }
589
570
  }
590
571
 
591
572
  /** @private */
592
573
  _updateAriaLive(ariaLive) {
593
- if (this._valueButton) {
574
+ if (this.focusElement) {
594
575
  if (ariaLive) {
595
- this._valueButton.setAttribute('aria-live', 'polite');
576
+ this.focusElement.setAttribute('aria-live', 'polite');
596
577
  } else {
597
- this._valueButton.removeAttribute('aria-live');
578
+ this.focusElement.removeAttribute('aria-live');
598
579
  }
599
580
  }
600
581
  }
@@ -613,7 +594,8 @@ class Select extends DelegateFocusMixin(DelegateStateMixin(FieldMixin(ElementMix
613
594
  // Store reference to the original item
614
595
  labelItem._sourceItem = selected;
615
596
 
616
- this.__appendValueItemElement(labelItem);
597
+ this.__initValueItemElement(labelItem);
598
+ this.focusElement.appendChild(labelItem);
617
599
 
618
600
  // Ensure the item gets proper styles
619
601
  labelItem.selected = true;
@@ -641,31 +623,32 @@ class Select extends DelegateFocusMixin(DelegateStateMixin(FieldMixin(ElementMix
641
623
  * @param {!HTMLElement} itemElement
642
624
  * @private
643
625
  */
644
- __appendValueItemElement(itemElement) {
626
+ __initValueItemElement(itemElement) {
645
627
  itemElement.removeAttribute('tabindex');
646
628
  itemElement.removeAttribute('role');
647
- itemElement.setAttribute('id', this._fieldId);
648
-
649
- this._valueButton.appendChild(itemElement);
629
+ itemElement.setAttribute('id', this._itemId);
650
630
  }
651
631
 
652
632
  /** @private */
653
633
  __updateValueButton() {
654
- if (!this._valueButton) {
634
+ const valueButton = this.focusElement;
635
+
636
+ if (!valueButton) {
655
637
  return;
656
638
  }
657
639
 
658
- this._valueButton.innerHTML = '';
640
+ valueButton.innerHTML = '';
659
641
 
660
642
  const selected = this._items[this._menuElement.selected];
661
643
 
662
- this._valueButton.removeAttribute('placeholder');
644
+ valueButton.removeAttribute('placeholder');
663
645
 
664
646
  if (!selected) {
665
647
  if (this.placeholder) {
666
648
  const item = this.__createItemElement({ label: this.placeholder });
667
- this.__appendValueItemElement(item);
668
- this._valueButton.setAttribute('placeholder', '');
649
+ this.__initValueItemElement(item);
650
+ valueButton.appendChild(item);
651
+ valueButton.setAttribute('placeholder', '');
669
652
  }
670
653
  } else {
671
654
  this.__attachSelectedItem(selected);
@@ -681,6 +664,12 @@ class Select extends DelegateFocusMixin(DelegateStateMixin(FieldMixin(ElementMix
681
664
  delete this._selectedChanging;
682
665
  }
683
666
  }
667
+
668
+ // Use item ID if there is a selected item or placeholder text
669
+ valueButton.setAttribute(
670
+ 'aria-labelledby',
671
+ selected || this.placeholder ? `${this._labelId} ${this._itemId}` : this._labelId,
672
+ );
684
673
  }
685
674
 
686
675
  /** @private */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2017 - 2022 Vaadin Ltd.
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
6
  import '@vaadin/vaadin-lumo-styles/sizing.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2017 - 2022 Vaadin Ltd.
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
6
  import '@vaadin/input-container/theme/lumo/vaadin-input-container.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2017 - 2022 Vaadin Ltd.
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
6
  import '@vaadin/vaadin-material-styles/font-icons.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2017 - 2022 Vaadin Ltd.
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
6
  import '@vaadin/input-container/theme/material/vaadin-input-container.js';
package/web-types.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/select",
4
- "version": "23.3.3",
4
+ "version": "24.0.0-alpha10",
5
5
  "description-markup": "markdown",
6
6
  "contributions": {
7
7
  "html": {
8
8
  "elements": [
9
9
  {
10
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/23.3.3/#/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/23.3.3/#/elements/vaadin-overlay).\n- `<vaadin-select-value-button>` - has the same API as [`<vaadin-button>`](https://cdn.vaadin.com/vaadin-web-components/23.3.3/#/elements/vaadin-button).\n- [`<vaadin-input-container>`](https://cdn.vaadin.com/vaadin-web-components/23.3.3/#/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/custom-theme/styling-components) documentation.",
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.0.0-alpha10/#/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.0.0-alpha10/#/elements/vaadin-overlay).\n- `<vaadin-select-value-button>` - has the same API as [`<vaadin-button>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-alpha10/#/elements/vaadin-button).\n- [`<vaadin-input-container>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-alpha10/#/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/custom-theme/styling-components) documentation.",
12
12
  "attributes": [
13
13
  {
14
14
  "name": "label",
@@ -87,6 +87,17 @@
87
87
  ]
88
88
  }
89
89
  },
90
+ {
91
+ "name": "overlay-class",
92
+ "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.",
93
+ "value": {
94
+ "type": [
95
+ "string",
96
+ "null",
97
+ "undefined"
98
+ ]
99
+ }
100
+ },
90
101
  {
91
102
  "name": "opened",
92
103
  "description": "Set when the select is open",
@@ -227,6 +238,17 @@
227
238
  ]
228
239
  }
229
240
  },
241
+ {
242
+ "name": "overlayClass",
243
+ "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.",
244
+ "value": {
245
+ "type": [
246
+ "string",
247
+ "null",
248
+ "undefined"
249
+ ]
250
+ }
251
+ },
230
252
  {
231
253
  "name": "items",
232
254
  "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.",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/select",
4
- "version": "23.3.3",
4
+ "version": "24.0.0-alpha10",
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-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/23.3.3/#/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/23.3.3/#/elements/vaadin-overlay).\n- `<vaadin-select-value-button>` - has the same API as [`<vaadin-button>`](https://cdn.vaadin.com/vaadin-web-components/23.3.3/#/elements/vaadin-button).\n- [`<vaadin-input-container>`](https://cdn.vaadin.com/vaadin-web-components/23.3.3/#/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/custom-theme/styling-components) documentation.",
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.0.0-alpha10/#/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.0.0-alpha10/#/elements/vaadin-overlay).\n- `<vaadin-select-value-button>` - has the same API as [`<vaadin-button>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-alpha10/#/elements/vaadin-button).\n- [`<vaadin-input-container>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-alpha10/#/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/custom-theme/styling-components) documentation.",
20
20
  "extension": true,
21
21
  "attributes": [
22
22
  {
@@ -82,6 +82,13 @@
82
82
  "kind": "expression"
83
83
  }
84
84
  },
85
+ {
86
+ "name": ".overlayClass",
87
+ "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.",
88
+ "value": {
89
+ "kind": "expression"
90
+ }
91
+ },
85
92
  {
86
93
  "name": ".items",
87
94
  "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.",