@vaadin/select 25.0.0-alpha2 → 25.0.0-alpha20

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.
@@ -10,14 +10,16 @@ import './vaadin-select-overlay.js';
10
10
  import './vaadin-select-value-button.js';
11
11
  import { html, LitElement } from 'lit';
12
12
  import { ifDefined } from 'lit/directives/if-defined.js';
13
+ import { isKeyboardActive } from '@vaadin/a11y-base/src/focus-utils.js';
13
14
  import { screenReaderOnly } from '@vaadin/a11y-base/src/styles/sr-only-styles.js';
14
15
  import { defineCustomElement } from '@vaadin/component-base/src/define.js';
15
16
  import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
16
17
  import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
17
18
  import { inputFieldShared } from '@vaadin/field-base/src/styles/input-field-shared-styles.js';
19
+ import { LumoInjectionMixin } from '@vaadin/vaadin-themable-mixin/lumo-injection-mixin.js';
18
20
  import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
21
+ import { selectStyles } from './styles/vaadin-select-base-styles.js';
19
22
  import { SelectBaseMixin } from './vaadin-select-base-mixin.js';
20
- import { selectStyles } from './vaadin-select-core-styles.js';
21
23
 
22
24
  /**
23
25
  * `<vaadin-select>` is a Web Component for selecting values from a list of items.
@@ -79,43 +81,50 @@ import { selectStyles } from './vaadin-select-core-styles.js';
79
81
  *
80
82
  * The following custom properties are available for styling:
81
83
  *
82
- * Custom property | Description | Target element | Default
83
- * -----------------------------------|------------------------------|----------------------------------
84
- * `--vaadin-field-default-width` | Default width of the field | :host | `12em`
85
- * `--vaadin-select-text-field-width` | Effective width of the field | `vaadin-select-overlay` |
86
- * `--vaadin-select-overlay-width` | Width of the overlay | `vaadin-select-overlay` |
87
- *
88
- * `<vaadin-select>` provides mostly the same set of shadow DOM parts and state attributes as `<vaadin-text-field>`.
89
- * See [`<vaadin-text-field>`](#/elements/vaadin-text-field) for the styling documentation.
90
- *
91
- *
92
- * In addition to `<vaadin-text-field>` parts, the following parts are available for theming:
93
- *
94
- * Part name | Description
95
- * ----------------|----------------
96
- * `toggle-button` | The toggle button
97
- *
98
- * In addition to `<vaadin-text-field>` state attributes, the following state attributes are available for theming:
99
- *
100
- * Attribute | Description | Part name
101
- * ----------|-----------------------------|-----------
102
- * `opened` | Set when the select is open | :host
103
- *
104
- * There are two exceptions in terms of styling compared to `<vaadin-text-field>`:
105
- * - the `clear-button` shadow DOM part does not exist in `<vaadin-select>`.
106
- * - the `input-prevented` state attribute is not supported by `<vaadin-select>`.
84
+ * Custom property | Description | Default
85
+ * ---------------------------------|-----------------------------|--------
86
+ * `--vaadin-field-default-width` | Default width of the field | `12em`
87
+ * `--vaadin-select-overlay-width` | Width of the overlay |
88
+ *
89
+ * The following shadow DOM parts are available for styling:
90
+ *
91
+ * Part name | Description
92
+ * ---------------------|----------------
93
+ * `label` | The label element
94
+ * `input-field` | The element that wraps prefix, value and toggle button
95
+ * `field-button` | Set on the toggle button
96
+ * `error-message` | The error message element
97
+ * `helper-text` | The helper text element wrapper
98
+ * `required-indicator` | The `required` state indicator element
99
+ * `toggle-button` | The toggle button
100
+ * `backdrop` | Backdrop of the overlay
101
+ * `overlay` | The overlay container
102
+ * `content` | The overlay content
103
+ *
104
+ * The following state attributes are available for styling:
105
+ *
106
+ * Attribute | Description
107
+ * ---------------------|---------------------------------
108
+ * `disabled` | Set when the element is disabled
109
+ * `has-value` | Set when the element has a value
110
+ * `has-label` | Set when the element has a label
111
+ * `has-helper` | Set when the element has helper text or slot
112
+ * `has-error-message` | Set when the element has an error message
113
+ * `invalid` | Set when the element is invalid
114
+ * `focused` | Set when the element is focused
115
+ * `focus-ring` | Set when the element is keyboard focused
116
+ * `readonly` | Set when the element is readonly
117
+ * `opened` | Set when the overlay is opened
118
+ * `phone` | Set when the overlay is shown in phone mode
107
119
  *
108
120
  * ### Internal components
109
121
  *
110
122
  * In addition to `<vaadin-select>` itself, the following internal
111
123
  * components are themable:
112
124
  *
113
- * - `<vaadin-select-overlay>` - has the same API as [`<vaadin-overlay>`](#/elements/vaadin-overlay).
114
125
  * - `<vaadin-select-value-button>` - has the same API as [`<vaadin-button>`](#/elements/vaadin-button).
115
- * - [`<vaadin-input-container>`](#/elements/vaadin-input-container) - an internal element wrapping the button.
116
- *
117
- * Note: the `theme` attribute value set on `<vaadin-select>` is
118
- * propagated to the internal components listed above.
126
+ * - `<vaadin-select-list-box>` - has the same API as [`<vaadin-list-box>`](#/elements/vaadin-list-box).
127
+ * - `<vaadin-select-item>` - has the same API as [`<vaadin-item>`](#/elements/vaadin-item).
119
128
  *
120
129
  * See [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.
121
130
  *
@@ -131,7 +140,7 @@ import { selectStyles } from './vaadin-select-core-styles.js';
131
140
  * @mixes SelectBaseMixin
132
141
  * @mixes ThemableMixin
133
142
  */
134
- class Select extends SelectBaseMixin(ElementMixin(ThemableMixin(PolylitMixin(LitElement)))) {
143
+ class Select extends SelectBaseMixin(ElementMixin(ThemableMixin(PolylitMixin(LumoInjectionMixin(LitElement))))) {
135
144
  static get is() {
136
145
  return 'vaadin-select';
137
146
  }
@@ -159,7 +168,12 @@ class Select extends SelectBaseMixin(ElementMixin(ThemableMixin(PolylitMixin(Lit
159
168
  >
160
169
  <slot name="prefix" slot="prefix"></slot>
161
170
  <slot name="value"></slot>
162
- <div part="toggle-button" slot="suffix" aria-hidden="true" @mousedown="${this._onToggleMouseDown}"></div>
171
+ <div
172
+ part="field-button toggle-button"
173
+ slot="suffix"
174
+ aria-hidden="true"
175
+ @mousedown="${this._onToggleMouseDown}"
176
+ ></div>
163
177
  </vaadin-input-container>
164
178
 
165
179
  <div part="helper-text">
@@ -181,9 +195,12 @@ class Select extends SelectBaseMixin(ElementMixin(ThemableMixin(PolylitMixin(Lit
181
195
  ?phone="${this._phone}"
182
196
  theme="${ifDefined(this._theme)}"
183
197
  ?no-vertical-overlap="${this.noVerticalOverlap}"
198
+ exportparts="backdrop, overlay, content"
184
199
  @opened-changed="${this._onOpenedChanged}"
185
200
  @vaadin-overlay-open="${this._onOverlayOpen}"
186
- ></vaadin-select-overlay>
201
+ >
202
+ <slot name="overlay"></slot>
203
+ </vaadin-select-overlay>
187
204
 
188
205
  <slot name="tooltip"></slot>
189
206
  <div class="sr-only">
@@ -200,7 +217,7 @@ class Select extends SelectBaseMixin(ElementMixin(ThemableMixin(PolylitMixin(Lit
200
217
  /** @private */
201
218
  _onOverlayOpen() {
202
219
  if (this._menuElement) {
203
- this._menuElement.focus();
220
+ this._menuElement.focus({ focusVisible: isKeyboardActive() });
204
221
  }
205
222
  }
206
223
 
package/vaadin-select.js CHANGED
@@ -1,2 +1,2 @@
1
- import './theme/lumo/vaadin-select.js';
1
+ import './src/vaadin-select.js';
2
2
  export * from './src/vaadin-select.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": "25.0.0-alpha2",
4
+ "version": "25.0.0-alpha20",
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', className: 'asc' },\n { label: 'Rating: high to low', value: 'rating-desc', className: '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`--vaadin-select-overlay-width` | Width of the overlay | `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/25.0.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/25.0.0-alpha2/#/elements/vaadin-overlay).\n- `<vaadin-select-value-button>` - has the same API as [`<vaadin-button>`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha2/#/elements/vaadin-button).\n- [`<vaadin-input-container>`](https://cdn.vaadin.com/vaadin-web-components/25.0.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.",
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', className: 'asc' },\n { label: 'Rating: high to low', value: 'rating-desc', className: '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 | Default\n---------------------------------|-----------------------------|--------\n`--vaadin-field-default-width` | Default width of the field | `12em`\n`--vaadin-select-overlay-width` | Width of the overlay |\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n---------------------|----------------\n`label` | The label element\n`input-field` | The element that wraps prefix, value and toggle button\n`field-button` | Set on the toggle button\n`error-message` | The error message element\n`helper-text` | The helper text element wrapper\n`required-indicator` | The `required` state indicator element\n`toggle-button` | The toggle button\n`backdrop` | Backdrop of the overlay\n`overlay` | The overlay container\n`content` | The overlay content\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n---------------------|---------------------------------\n`disabled` | Set when the element is disabled\n`has-value` | Set when the element has a value\n`has-label` | Set when the element has a label\n`has-helper` | Set when the element has helper text or slot\n`has-error-message` | Set when the element has an error message\n`invalid` | Set when the element is invalid\n`focused` | Set when the element is focused\n`focus-ring` | Set when the element is keyboard focused\n`readonly` | Set when the element is readonly\n`opened` | Set when the overlay is opened\n`phone` | Set when the overlay is shown in phone mode\n\n### Internal components\n\nIn addition to `<vaadin-select>` itself, the following internal\ncomponents are themable:\n\n- `<vaadin-select-value-button>` - has the same API as [`<vaadin-button>`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha20/#/elements/vaadin-button).\n- `<vaadin-select-list-box>` - has the same API as [`<vaadin-list-box>`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha20/#/elements/vaadin-list-box).\n- `<vaadin-select-item>` - has the same API as [`<vaadin-item>`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha20/#/elements/vaadin-item).\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
12
12
  "attributes": [
13
13
  {
14
14
  "name": "disabled",
@@ -120,17 +120,6 @@
120
120
  ]
121
121
  }
122
122
  },
123
- {
124
- "name": "overlay-class",
125
- "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.",
126
- "value": {
127
- "type": [
128
- "string",
129
- "null",
130
- "undefined"
131
- ]
132
- }
133
- },
134
123
  {
135
124
  "name": "opened",
136
125
  "description": "Set when the select is open",
@@ -315,17 +304,6 @@
315
304
  ]
316
305
  }
317
306
  },
318
- {
319
- "name": "overlayClass",
320
- "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.",
321
- "value": {
322
- "type": [
323
- "string",
324
- "null",
325
- "undefined"
326
- ]
327
- }
328
- },
329
307
  {
330
308
  "name": "items",
331
309
  "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', className: 'asc' },\n { label: 'Rating: high to low', value: 'rating-desc', className: '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.",
@@ -346,7 +324,7 @@
346
324
  },
347
325
  {
348
326
  "name": "renderer",
349
- "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.",
327
+ "description": "Custom function for rendering the content of the `<vaadin-select>`.\nReceives two arguments:\n\n- `root` The internal container DOM element. Append your content to it.\n- `select` The reference to the `<vaadin-select>` element.",
350
328
  "value": {
351
329
  "type": [
352
330
  "SelectRenderer",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/select",
4
- "version": "25.0.0-alpha2",
4
+ "version": "25.0.0-alpha20",
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', className: 'asc' },\n { label: 'Rating: high to low', value: 'rating-desc', className: '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`--vaadin-select-overlay-width` | Width of the overlay | `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/25.0.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/25.0.0-alpha2/#/elements/vaadin-overlay).\n- `<vaadin-select-value-button>` - has the same API as [`<vaadin-button>`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha2/#/elements/vaadin-button).\n- [`<vaadin-input-container>`](https://cdn.vaadin.com/vaadin-web-components/25.0.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.",
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', className: 'asc' },\n { label: 'Rating: high to low', value: 'rating-desc', className: '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 | Default\n---------------------------------|-----------------------------|--------\n`--vaadin-field-default-width` | Default width of the field | `12em`\n`--vaadin-select-overlay-width` | Width of the overlay |\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n---------------------|----------------\n`label` | The label element\n`input-field` | The element that wraps prefix, value and toggle button\n`field-button` | Set on the toggle button\n`error-message` | The error message element\n`helper-text` | The helper text element wrapper\n`required-indicator` | The `required` state indicator element\n`toggle-button` | The toggle button\n`backdrop` | Backdrop of the overlay\n`overlay` | The overlay container\n`content` | The overlay content\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n---------------------|---------------------------------\n`disabled` | Set when the element is disabled\n`has-value` | Set when the element has a value\n`has-label` | Set when the element has a label\n`has-helper` | Set when the element has helper text or slot\n`has-error-message` | Set when the element has an error message\n`invalid` | Set when the element is invalid\n`focused` | Set when the element is focused\n`focus-ring` | Set when the element is keyboard focused\n`readonly` | Set when the element is readonly\n`opened` | Set when the overlay is opened\n`phone` | Set when the overlay is shown in phone mode\n\n### Internal components\n\nIn addition to `<vaadin-select>` itself, the following internal\ncomponents are themable:\n\n- `<vaadin-select-value-button>` - has the same API as [`<vaadin-button>`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha20/#/elements/vaadin-button).\n- `<vaadin-select-list-box>` - has the same API as [`<vaadin-list-box>`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha20/#/elements/vaadin-list-box).\n- `<vaadin-select-item>` - has the same API as [`<vaadin-item>`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha20/#/elements/vaadin-item).\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
20
20
  "extension": true,
21
21
  "attributes": [
22
22
  {
@@ -110,13 +110,6 @@
110
110
  "kind": "expression"
111
111
  }
112
112
  },
113
- {
114
- "name": ".overlayClass",
115
- "description": "A space-delimited list of CSS class names to set on the overlay element.\nThis property does not affect other CSS class names set manually via JS.\n\nNote, if the CSS class name was set with this property, clearing it will\nremove it from the overlay, even if the same class name was also added\nmanually, e.g. by using `classList.add()` in the `renderer` function.",
116
- "value": {
117
- "kind": "expression"
118
- }
119
- },
120
113
  {
121
114
  "name": ".items",
122
115
  "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', className: 'asc' },\n { label: 'Rating: high to low', value: 'rating-desc', className: '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.",
@@ -126,7 +119,7 @@
126
119
  },
127
120
  {
128
121
  "name": ".renderer",
129
- "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.",
122
+ "description": "Custom function for rendering the content of the `<vaadin-select>`.\nReceives two arguments:\n\n- `root` The internal container DOM element. Append your content to it.\n- `select` The reference to the `<vaadin-select>` element.",
130
123
  "value": {
131
124
  "kind": "expression"
132
125
  }
@@ -1,36 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright (c) 2017 - 2025 Vaadin Ltd.
4
- * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
- */
6
- import '@vaadin/component-base/src/style-props.js';
7
- import { css } from 'lit';
8
-
9
- export const selectStyles = css`
10
- @layer base {
11
- :host {
12
- position: relative;
13
- }
14
-
15
- ::slotted([slot='value']) {
16
- flex: 1;
17
- }
18
-
19
- :host(:not([focus-ring])) [part='input-field'] {
20
- outline: none;
21
- }
22
-
23
- :host([readonly]:not([focus-ring])) [part='input-field'] {
24
- --vaadin-input-field-border-color: inherit;
25
- }
26
-
27
- [part='input-field'],
28
- :host(:not([readonly])) ::slotted([slot='value']) {
29
- cursor: var(--vaadin-clickable-cursor);
30
- }
31
-
32
- [part='toggle-button']::before {
33
- mask-image: var(--_vaadin-icon-chevron-down);
34
- }
35
- }
36
- `;
@@ -1,8 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright (c) 2017 - 2025 Vaadin Ltd.
4
- * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
- */
6
- import type { CSSResult } from 'lit';
7
-
8
- export const selectStyles: CSSResult;
@@ -1,16 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright (c) 2017 - 2025 Vaadin Ltd.
4
- * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
- */
6
- import { css } from 'lit';
7
-
8
- export const selectStyles = css`
9
- :host {
10
- position: relative;
11
- }
12
-
13
- ::slotted([slot='value']) {
14
- flex-grow: 1;
15
- }
16
- `;
@@ -1,23 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright (c) 2017 - 2025 Vaadin Ltd.
4
- * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
- */
6
- import { css } from 'lit';
7
-
8
- export const selectOverlayStyles = css`
9
- @layer base {
10
- :host {
11
- align-items: flex-start;
12
- justify-content: flex-start;
13
- }
14
-
15
- :host(:not([phone])) [part='overlay'] {
16
- min-width: var(--vaadin-select-overlay-width, var(--vaadin-select-text-field-width));
17
- }
18
-
19
- [part='content'] {
20
- padding: var(--vaadin-item-overlay-padding, 4px);
21
- }
22
- }
23
- `;
@@ -1,32 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright (c) 2017 - 2025 Vaadin Ltd.
4
- * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
- */
6
- import { css } from 'lit';
7
-
8
- export const valueButton = css`
9
- @layer base {
10
- :host {
11
- min-height: 1lh;
12
- outline: none;
13
- overflow: hidden;
14
- white-space: nowrap;
15
- width: 100%;
16
- }
17
-
18
- ::slotted(*) {
19
- padding: 0;
20
- cursor: inherit;
21
- }
22
-
23
- .vaadin-button-container,
24
- [part='label'] {
25
- display: contents;
26
- }
27
-
28
- :host([disabled]) {
29
- pointer-events: none;
30
- }
31
- }
32
- `;
@@ -1,49 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright (c) 2017 - 2025 Vaadin Ltd.
4
- * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
- */
6
- import { css } from 'lit';
7
-
8
- export const valueButton = css`
9
- :host {
10
- display: inline-block;
11
- position: relative;
12
- outline: none;
13
- white-space: nowrap;
14
- -webkit-user-select: none;
15
- user-select: none;
16
- min-width: 0;
17
- width: 0;
18
- }
19
-
20
- ::slotted(*) {
21
- padding-left: 0;
22
- padding-right: 0;
23
- flex: auto;
24
- }
25
-
26
- /* placeholder styles */
27
- ::slotted(*:not([selected])) {
28
- line-height: 1;
29
- }
30
-
31
- .vaadin-button-container {
32
- display: inline-flex;
33
- align-items: center;
34
- justify-content: center;
35
- text-align: inherit;
36
- width: 100%;
37
- height: 100%;
38
- min-height: inherit;
39
- text-shadow: inherit;
40
- }
41
-
42
- [part='label'] {
43
- white-space: nowrap;
44
- overflow: hidden;
45
- text-overflow: ellipsis;
46
- width: 100%;
47
- line-height: inherit;
48
- }
49
- `;
@@ -1,9 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright (c) 2017 - 2025 Vaadin Ltd.
4
- * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
- */
6
- import '@vaadin/input-container/theme/lumo/vaadin-input-container-styles.js';
7
- import '@vaadin/vaadin-lumo-styles/sizing.js';
8
- import '@vaadin/vaadin-lumo-styles/style.js';
9
- import '@vaadin/vaadin-lumo-styles/font-icons.js';
@@ -1,135 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright (c) 2017 - 2025 Vaadin Ltd.
4
- * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
- */
6
- import '@vaadin/input-container/theme/lumo/vaadin-input-container-styles.js';
7
- import '@vaadin/vaadin-lumo-styles/sizing.js';
8
- import '@vaadin/vaadin-lumo-styles/style.js';
9
- import '@vaadin/vaadin-lumo-styles/font-icons.js';
10
- import { item } from '@vaadin/item/theme/lumo/vaadin-item-styles.js';
11
- import { listBox } from '@vaadin/list-box/theme/lumo/vaadin-list-box-styles.js';
12
- import { inputFieldShared } from '@vaadin/vaadin-lumo-styles/mixins/input-field-shared.js';
13
- import { menuOverlay } from '@vaadin/vaadin-lumo-styles/mixins/menu-overlay.js';
14
- import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
15
-
16
- registerStyles('vaadin-select-item', item, { moduleId: 'lumo-select-item' });
17
-
18
- registerStyles('vaadin-select-list-box', listBox, { moduleId: 'lumo-select-list-box' });
19
-
20
- const select = css`
21
- :host {
22
- /* Disable pointer focus-ring for select, not supported yet */
23
- --lumo-input-field-pointer-focus-visible: 0;
24
- }
25
-
26
- :host(:not([theme*='align'])) ::slotted([slot='value']) {
27
- text-align: start;
28
- }
29
-
30
- [part='input-field'] {
31
- cursor: var(--lumo-clickable-cursor);
32
- }
33
-
34
- [part='input-field'] ::slotted([slot='value']) {
35
- font-weight: var(--vaadin-input-field-value-font-weight, 500);
36
- }
37
-
38
- [part='input-field'] ::slotted([slot='value']:not([placeholder])) {
39
- color: var(--vaadin-input-field-value-color, var(--lumo-body-text-color));
40
- }
41
-
42
- :host([readonly]) [part='input-field'] ::slotted([slot='value']:not([placeholder])) {
43
- color: var(--lumo-secondary-text-color);
44
- }
45
-
46
- /* placeholder styles */
47
- [part='input-field'] ::slotted([slot='value'][placeholder]) {
48
- color: var(--vaadin-input-field-placeholder-color, var(--lumo-secondary-text-color));
49
- }
50
-
51
- :host(:is([readonly], [disabled])) ::slotted([slot='value'][placeholder]) {
52
- opacity: 0;
53
- }
54
-
55
- [part='toggle-button']::before {
56
- content: var(--lumo-icons-dropdown);
57
- }
58
-
59
- /* Highlight the toggle button when hovering over the entire component */
60
- :host(:hover:not([readonly]):not([disabled])) [part='toggle-button'] {
61
- color: var(--lumo-contrast-80pct);
62
- }
63
-
64
- :host([theme~='small']) [part='input-field'] ::slotted([slot='value']) {
65
- --_lumo-selected-item-height: var(--lumo-size-s);
66
- --_lumo-selected-item-padding: 0;
67
- }
68
- `;
69
-
70
- registerStyles('vaadin-select', [inputFieldShared, select], { moduleId: 'lumo-select' });
71
-
72
- registerStyles(
73
- 'vaadin-select-value-button',
74
- css`
75
- :host {
76
- font-family: var(--lumo-font-family);
77
- font-size: var(--vaadin-input-field-value-font-size, var(--lumo-font-size-m));
78
- padding: 0 0.25em;
79
- --_lumo-selected-item-height: var(--lumo-size-m);
80
- --_lumo-selected-item-padding: 0.5em;
81
- }
82
-
83
- ::slotted(*) {
84
- min-height: var(--_lumo-selected-item-height);
85
- padding-top: var(--_lumo-selected-item-padding);
86
- padding-bottom: var(--_lumo-selected-item-padding);
87
- font-size: inherit;
88
- }
89
-
90
- ::slotted(*:hover) {
91
- background-color: transparent;
92
- }
93
- `,
94
- { moduleId: 'lumo-select-value-button' },
95
- );
96
-
97
- const selectOverlay = css`
98
- :host {
99
- --_lumo-item-selected-icon-display: block;
100
- }
101
-
102
- /* Small viewport adjustment */
103
- :host([phone]) {
104
- /* stylelint-disable declaration-block-no-redundant-longhand-properties */
105
- top: 0 !important;
106
- right: 0 !important;
107
- bottom: var(--vaadin-overlay-viewport-bottom, 0) !important;
108
- left: 0 !important;
109
- /* stylelint-enable declaration-block-no-redundant-longhand-properties */
110
- align-items: stretch;
111
- justify-content: flex-end;
112
- }
113
-
114
- :host([no-vertical-overlap][top-aligned]) [part='overlay'] {
115
- margin-block-start: var(--lumo-space-xs);
116
- }
117
-
118
- :host([no-vertical-overlap][bottom-aligned]) [part='overlay'] {
119
- margin-block-end: var(--lumo-space-xs);
120
- }
121
-
122
- :host([theme~='align-left']) {
123
- text-align: left;
124
- }
125
-
126
- :host([theme~='align-right']) {
127
- text-align: right;
128
- }
129
-
130
- :host([theme~='align-center']) {
131
- text-align: center;
132
- }
133
- `;
134
-
135
- registerStyles('vaadin-select-overlay', [menuOverlay, selectOverlay], { moduleId: 'lumo-select-overlay' });
@@ -1,7 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright (c) 2017 - 2025 Vaadin Ltd.
4
- * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
- */
6
- import './vaadin-select-styles.js';
7
- import '../../src/vaadin-select.js';
@@ -1,7 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright (c) 2017 - 2025 Vaadin Ltd.
4
- * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
- */
6
- import './vaadin-select-styles.js';
7
- import '../../src/vaadin-select.js';