@vaadin/select 24.0.0-alpha7 → 24.0.0-alpha9

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.0.0-alpha7",
3
+ "version": "24.0.0-alpha9",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -38,17 +38,17 @@
38
38
  ],
39
39
  "dependencies": {
40
40
  "@polymer/polymer": "^3.2.0",
41
- "@vaadin/button": "24.0.0-alpha7",
42
- "@vaadin/component-base": "24.0.0-alpha7",
43
- "@vaadin/field-base": "24.0.0-alpha7",
44
- "@vaadin/input-container": "24.0.0-alpha7",
45
- "@vaadin/item": "24.0.0-alpha7",
46
- "@vaadin/list-box": "24.0.0-alpha7",
47
- "@vaadin/lit-renderer": "24.0.0-alpha7",
48
- "@vaadin/overlay": "24.0.0-alpha7",
49
- "@vaadin/vaadin-lumo-styles": "24.0.0-alpha7",
50
- "@vaadin/vaadin-material-styles": "24.0.0-alpha7",
51
- "@vaadin/vaadin-themable-mixin": "24.0.0-alpha7"
41
+ "@vaadin/button": "24.0.0-alpha9",
42
+ "@vaadin/component-base": "24.0.0-alpha9",
43
+ "@vaadin/field-base": "24.0.0-alpha9",
44
+ "@vaadin/input-container": "24.0.0-alpha9",
45
+ "@vaadin/item": "24.0.0-alpha9",
46
+ "@vaadin/list-box": "24.0.0-alpha9",
47
+ "@vaadin/lit-renderer": "24.0.0-alpha9",
48
+ "@vaadin/overlay": "24.0.0-alpha9",
49
+ "@vaadin/vaadin-lumo-styles": "24.0.0-alpha9",
50
+ "@vaadin/vaadin-material-styles": "24.0.0-alpha9",
51
+ "@vaadin/vaadin-themable-mixin": "24.0.0-alpha9"
52
52
  },
53
53
  "devDependencies": {
54
54
  "@esm-bundle/chai": "^4.3.4",
@@ -60,5 +60,5 @@
60
60
  "web-types.json",
61
61
  "web-types.lit.json"
62
62
  ],
63
- "gitHead": "aeb4535336813636736759e0a5de148b26bfc3b6"
63
+ "gitHead": "cc3f747164041566b300bde4b105d2475649e93f"
64
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,20 +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(this, 'value', 'vaadin-select-value-button', {
352
- initializer: (btn) => {
353
- this._setFocusElement(btn);
354
- this.ariaTarget = btn;
355
- this.stateTarget = btn;
356
-
357
- btn.setAttribute('aria-haspopup', 'listbox');
358
- btn.setAttribute('aria-labelledby', `${this._labelId} ${this._fieldId}`);
359
-
360
- this._updateAriaExpanded(this.opened);
361
-
362
- btn.addEventListener('keydown', this._boundOnKeyDown);
363
- },
364
- });
347
+ this._valueButtonController = new ButtonController(this);
365
348
  this.addController(this._valueButtonController);
366
349
 
367
350
  this.addController(
@@ -512,10 +495,11 @@ class Select extends DelegateFocusMixin(DelegateStateMixin(FieldMixin(ElementMix
512
495
  /**
513
496
  * @param {!KeyboardEvent} e
514
497
  * @protected
498
+ * @override
515
499
  */
516
500
  _onKeyDown(e) {
517
- if (!this.readonly && !this.opened) {
518
- 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)) {
519
503
  e.preventDefault();
520
504
  this.opened = true;
521
505
  } else if (/[\p{L}\p{Nd}]/u.test(e.key) && e.key.length === 1) {
@@ -538,7 +522,7 @@ class Select extends DelegateFocusMixin(DelegateStateMixin(FieldMixin(ElementMix
538
522
  * @protected
539
523
  */
540
524
  _onKeyDownInside(e) {
541
- if (/^(Tab)$/.test(e.key)) {
525
+ if (/^(Tab)$/u.test(e.key)) {
542
526
  this.opened = false;
543
527
  }
544
528
  }
@@ -579,19 +563,19 @@ class Select extends DelegateFocusMixin(DelegateStateMixin(FieldMixin(ElementMix
579
563
  }
580
564
 
581
565
  /** @private */
582
- _updateAriaExpanded(opened) {
583
- if (this._valueButton) {
584
- this._valueButton.setAttribute('aria-expanded', opened ? 'true' : 'false');
566
+ _updateAriaExpanded(opened, focusElement) {
567
+ if (focusElement) {
568
+ focusElement.setAttribute('aria-expanded', opened ? 'true' : 'false');
585
569
  }
586
570
  }
587
571
 
588
572
  /** @private */
589
573
  _updateAriaLive(ariaLive) {
590
- if (this._valueButton) {
574
+ if (this.focusElement) {
591
575
  if (ariaLive) {
592
- this._valueButton.setAttribute('aria-live', 'polite');
576
+ this.focusElement.setAttribute('aria-live', 'polite');
593
577
  } else {
594
- this._valueButton.removeAttribute('aria-live');
578
+ this.focusElement.removeAttribute('aria-live');
595
579
  }
596
580
  }
597
581
  }
@@ -610,7 +594,8 @@ class Select extends DelegateFocusMixin(DelegateStateMixin(FieldMixin(ElementMix
610
594
  // Store reference to the original item
611
595
  labelItem._sourceItem = selected;
612
596
 
613
- this.__appendValueItemElement(labelItem);
597
+ this.__initValueItemElement(labelItem);
598
+ this.focusElement.appendChild(labelItem);
614
599
 
615
600
  // Ensure the item gets proper styles
616
601
  labelItem.selected = true;
@@ -638,31 +623,32 @@ class Select extends DelegateFocusMixin(DelegateStateMixin(FieldMixin(ElementMix
638
623
  * @param {!HTMLElement} itemElement
639
624
  * @private
640
625
  */
641
- __appendValueItemElement(itemElement) {
626
+ __initValueItemElement(itemElement) {
642
627
  itemElement.removeAttribute('tabindex');
643
628
  itemElement.removeAttribute('role');
644
- itemElement.setAttribute('id', this._fieldId);
645
-
646
- this._valueButton.appendChild(itemElement);
629
+ itemElement.setAttribute('id', this._itemId);
647
630
  }
648
631
 
649
632
  /** @private */
650
633
  __updateValueButton() {
651
- if (!this._valueButton) {
634
+ const valueButton = this.focusElement;
635
+
636
+ if (!valueButton) {
652
637
  return;
653
638
  }
654
639
 
655
- this._valueButton.innerHTML = '';
640
+ valueButton.innerHTML = '';
656
641
 
657
642
  const selected = this._items[this._menuElement.selected];
658
643
 
659
- this._valueButton.removeAttribute('placeholder');
644
+ valueButton.removeAttribute('placeholder');
660
645
 
661
646
  if (!selected) {
662
647
  if (this.placeholder) {
663
648
  const item = this.__createItemElement({ label: this.placeholder });
664
- this.__appendValueItemElement(item);
665
- this._valueButton.setAttribute('placeholder', '');
649
+ this.__initValueItemElement(item);
650
+ valueButton.appendChild(item);
651
+ valueButton.setAttribute('placeholder', '');
666
652
  }
667
653
  } else {
668
654
  this.__attachSelectedItem(selected);
@@ -678,6 +664,12 @@ class Select extends DelegateFocusMixin(DelegateStateMixin(FieldMixin(ElementMix
678
664
  delete this._selectedChanging;
679
665
  }
680
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
+ );
681
673
  }
682
674
 
683
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": "24.0.0-alpha7",
4
+ "version": "24.0.0-alpha9",
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/24.0.0-alpha7/#/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-alpha7/#/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-alpha7/#/elements/vaadin-button).\n- [`<vaadin-input-container>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-alpha7/#/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-alpha9/#/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-alpha9/#/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-alpha9/#/elements/vaadin-button).\n- [`<vaadin-input-container>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-alpha9/#/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",
@@ -150,44 +161,6 @@
150
161
  ],
151
162
  "js": {
152
163
  "properties": [
153
- {
154
- "name": "rootPath",
155
- "description": "",
156
- "value": {
157
- "type": [
158
- "string"
159
- ]
160
- }
161
- },
162
- {
163
- "name": "importPath",
164
- "description": "",
165
- "value": {
166
- "type": [
167
- "string"
168
- ]
169
- }
170
- },
171
- {
172
- "name": "root",
173
- "description": "",
174
- "value": {
175
- "type": [
176
- "StampedTemplate",
177
- "HTMLElement",
178
- "ShadowRoot"
179
- ]
180
- }
181
- },
182
- {
183
- "name": "$",
184
- "description": "",
185
- "value": {
186
- "type": [
187
- "Object.<string, Element>"
188
- ]
189
- }
190
- },
191
164
  {
192
165
  "name": "label",
193
166
  "description": "The label text for the input node.\nWhen no light dom defined via [slot=label], this value will be used.",
@@ -265,6 +238,17 @@
265
238
  ]
266
239
  }
267
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
+ },
268
252
  {
269
253
  "name": "items",
270
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": "24.0.0-alpha7",
4
+ "version": "24.0.0-alpha9",
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/24.0.0-alpha7/#/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-alpha7/#/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-alpha7/#/elements/vaadin-button).\n- [`<vaadin-input-container>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-alpha7/#/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-alpha9/#/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-alpha9/#/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-alpha9/#/elements/vaadin-button).\n- [`<vaadin-input-container>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-alpha9/#/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
  {
@@ -61,34 +61,6 @@
61
61
  "kind": "expression"
62
62
  }
63
63
  },
64
- {
65
- "name": ".rootPath",
66
- "description": "",
67
- "value": {
68
- "kind": "expression"
69
- }
70
- },
71
- {
72
- "name": ".importPath",
73
- "description": "",
74
- "value": {
75
- "kind": "expression"
76
- }
77
- },
78
- {
79
- "name": ".root",
80
- "description": "",
81
- "value": {
82
- "kind": "expression"
83
- }
84
- },
85
- {
86
- "name": ".$",
87
- "description": "",
88
- "value": {
89
- "kind": "expression"
90
- }
91
- },
92
64
  {
93
65
  "name": ".label",
94
66
  "description": "The label text for the input node.\nWhen no light dom defined via [slot=label], this value will be used.",
@@ -110,6 +82,13 @@
110
82
  "kind": "expression"
111
83
  }
112
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
+ },
113
92
  {
114
93
  "name": ".items",
115
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.",