@vaadin/select 23.1.0 → 23.2.0-dev.53560527d

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.1.0",
3
+ "version": "23.2.0-dev.53560527d",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -20,10 +20,10 @@
20
20
  "module": "vaadin-select.js",
21
21
  "type": "module",
22
22
  "files": [
23
+ "lit.d.ts",
24
+ "lit.js",
23
25
  "src",
24
26
  "theme",
25
- "lit.js",
26
- "lit.d.ts",
27
27
  "vaadin-*.d.ts",
28
28
  "vaadin-*.js"
29
29
  ],
@@ -36,25 +36,25 @@
36
36
  ],
37
37
  "dependencies": {
38
38
  "@polymer/polymer": "^3.2.0",
39
- "@vaadin/button": "^23.1.0",
40
- "@vaadin/component-base": "^23.1.0",
41
- "@vaadin/field-base": "^23.1.0",
42
- "@vaadin/input-container": "^23.1.0",
43
- "@vaadin/item": "^23.1.0",
44
- "@vaadin/list-box": "^23.1.0",
45
- "@vaadin/lit-renderer": "^23.1.0",
46
- "@vaadin/vaadin-list-mixin": "^23.1.0",
47
- "@vaadin/vaadin-lumo-styles": "^23.1.0",
48
- "@vaadin/vaadin-material-styles": "^23.1.0",
49
- "@vaadin/vaadin-overlay": "^23.1.0",
50
- "@vaadin/vaadin-themable-mixin": "^23.1.0"
39
+ "@vaadin/button": "23.2.0-dev.53560527d",
40
+ "@vaadin/component-base": "23.2.0-dev.53560527d",
41
+ "@vaadin/field-base": "23.2.0-dev.53560527d",
42
+ "@vaadin/input-container": "23.2.0-dev.53560527d",
43
+ "@vaadin/item": "23.2.0-dev.53560527d",
44
+ "@vaadin/list-box": "23.2.0-dev.53560527d",
45
+ "@vaadin/lit-renderer": "23.2.0-dev.53560527d",
46
+ "@vaadin/vaadin-list-mixin": "23.2.0-dev.53560527d",
47
+ "@vaadin/vaadin-lumo-styles": "23.2.0-dev.53560527d",
48
+ "@vaadin/vaadin-material-styles": "23.2.0-dev.53560527d",
49
+ "@vaadin/vaadin-overlay": "23.2.0-dev.53560527d",
50
+ "@vaadin/vaadin-themable-mixin": "23.2.0-dev.53560527d"
51
51
  },
52
52
  "devDependencies": {
53
53
  "@esm-bundle/chai": "^4.3.4",
54
- "@vaadin/polymer-legacy-adapter": "^23.1.0",
54
+ "@vaadin/polymer-legacy-adapter": "23.2.0-dev.53560527d",
55
55
  "@vaadin/testing-helpers": "^0.3.2",
56
56
  "lit": "^2.0.0",
57
57
  "sinon": "^13.0.2"
58
58
  },
59
- "gitHead": "322bba42b83f908a78cd972b06acadc5da95a69d"
59
+ "gitHead": "6c5c18369b09e22e76365d8a8a5e4bbb220f969b"
60
60
  }
@@ -4,7 +4,6 @@
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
7
- import { SlotMixin } from '@vaadin/component-base/src/slot-mixin.js';
8
7
  import { DelegateFocusMixin } from '@vaadin/field-base/src/delegate-focus-mixin.js';
9
8
  import { FieldMixin } from '@vaadin/field-base/src/field-mixin.js';
10
9
  import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
@@ -164,7 +163,7 @@ export interface SelectEventMap extends HTMLElementEventMap, SelectCustomEventMa
164
163
  * @fires {CustomEvent} opened-changed - Fired when the `opened` property changes.
165
164
  * @fires {CustomEvent} value-changed - Fired when the `value` property changes.
166
165
  */
167
- declare class Select extends DelegateFocusMixin(FieldMixin(SlotMixin(ElementMixin(ThemableMixin(HTMLElement))))) {
166
+ declare class Select extends DelegateFocusMixin(FieldMixin(ElementMixin(ThemableMixin(HTMLElement)))) {
168
167
  /**
169
168
  * An array containing items that will be rendered as the options of the select.
170
169
  *
@@ -11,8 +11,9 @@ import './vaadin-select-value-button.js';
11
11
  import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
12
12
  import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
13
13
  import { MediaQueryController } from '@vaadin/component-base/src/media-query-controller.js';
14
- import { SlotMixin } from '@vaadin/component-base/src/slot-mixin.js';
14
+ import { SlotController } from '@vaadin/component-base/src/slot-controller.js';
15
15
  import { processTemplates } from '@vaadin/component-base/src/templates.js';
16
+ import { generateUniqueId } from '@vaadin/component-base/src/unique-id-utils.js';
16
17
  import { DelegateFocusMixin } from '@vaadin/field-base/src/delegate-focus-mixin.js';
17
18
  import { FieldMixin } from '@vaadin/field-base/src/field-mixin.js';
18
19
  import { fieldShared } from '@vaadin/field-base/src/styles/field-shared-styles.js';
@@ -128,11 +129,10 @@ registerStyles('vaadin-select', [fieldShared, inputFieldContainer], { moduleId:
128
129
  * @extends HTMLElement
129
130
  * @mixes ElementMixin
130
131
  * @mixes ThemableMixin
131
- * @mixes SlotMixin
132
132
  * @mixes FieldMixin
133
133
  * @mixes DelegateFocusMixin
134
134
  */
135
- class Select extends DelegateFocusMixin(FieldMixin(SlotMixin(ElementMixin(ThemableMixin(PolymerElement))))) {
135
+ class Select extends DelegateFocusMixin(FieldMixin(ElementMixin(ThemableMixin(PolymerElement)))) {
136
136
  static get is() {
137
137
  return 'vaadin-select';
138
138
  }
@@ -311,56 +311,23 @@ class Select extends DelegateFocusMixin(FieldMixin(SlotMixin(ElementMixin(Themab
311
311
  ];
312
312
  }
313
313
 
314
- /** @protected */
315
- get slots() {
316
- return {
317
- ...super.slots,
318
- value: () => {
319
- const button = document.createElement('vaadin-select-value-button');
320
- button.setAttribute('aria-haspopup', 'listbox');
321
- return button;
322
- },
323
- };
324
- }
325
-
326
314
  /** @protected */
327
315
  get _valueButton() {
328
- return this._getDirectSlotChild('value');
316
+ return this._valueButtonController && this._valueButtonController.node;
329
317
  }
330
318
 
331
319
  constructor() {
332
320
  super();
333
321
 
334
- // Ensure every instance has unique ID
335
- const uniqueId = (Select._uniqueSelectId = 1 + Select._uniqueSelectId || 0);
336
- this._fieldId = `${this.localName}-${uniqueId}`;
322
+ this._fieldId = `${this.localName}-${generateUniqueId()}`;
337
323
 
338
324
  this._boundOnKeyDown = this._onKeyDown.bind(this);
339
325
  }
340
326
 
341
- /** @protected */
342
- connectedCallback() {
343
- super.connectedCallback();
344
-
345
- if (this._valueButton) {
346
- this._valueButton.setAttribute('aria-labelledby', `${this._labelId} ${this._fieldId}`);
347
-
348
- this._updateAriaRequired(this.required);
349
- this._updateAriaExpanded(this.opened);
350
-
351
- this._setFocusElement(this._valueButton);
352
- this.ariaTarget = this._valueButton;
353
-
354
- this._valueButton.addEventListener('keydown', this._boundOnKeyDown);
355
- }
356
- }
357
-
358
327
  /** @protected */
359
328
  disconnectedCallback() {
360
329
  super.disconnectedCallback();
361
- if (this._valueButton) {
362
- this._valueButton.removeEventListener('keydown', this._boundOnKeyDown);
363
- }
330
+
364
331
  // Making sure the select is closed and removed from DOM after detaching the select.
365
332
  this.opened = false;
366
333
  }
@@ -372,6 +339,25 @@ class Select extends DelegateFocusMixin(FieldMixin(SlotMixin(ElementMixin(Themab
372
339
  this._overlayElement = this.shadowRoot.querySelector('vaadin-select-overlay');
373
340
  this._inputContainer = this.shadowRoot.querySelector('[part~="input-field"]');
374
341
 
342
+ this._valueButtonController = new SlotController(
343
+ this,
344
+ 'value',
345
+ () => document.createElement('vaadin-select-value-button'),
346
+ (host, btn) => {
347
+ this._setFocusElement(btn);
348
+ this.ariaTarget = btn;
349
+
350
+ btn.setAttribute('aria-haspopup', 'listbox');
351
+ btn.setAttribute('aria-labelledby', `${this._labelId} ${this._fieldId}`);
352
+
353
+ this._updateAriaRequired(host.required);
354
+ this._updateAriaExpanded(host.opened);
355
+
356
+ btn.addEventListener('keydown', this._boundOnKeyDown);
357
+ },
358
+ );
359
+ this.addController(this._valueButtonController);
360
+
375
361
  this.addController(
376
362
  new MediaQueryController(this._phoneMediaQuery, (matches) => {
377
363
  this._phone = matches;