@vaadin/select 23.1.2 → 23.2.0-dev.48e5e3967
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 +17 -17
- package/src/vaadin-select.d.ts +1 -2
- package/src/vaadin-select.js +25 -39
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/select",
|
|
3
|
-
"version": "23.
|
|
3
|
+
"version": "23.2.0-dev.48e5e3967",
|
|
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": "
|
|
40
|
-
"@vaadin/component-base": "
|
|
41
|
-
"@vaadin/field-base": "
|
|
42
|
-
"@vaadin/input-container": "
|
|
43
|
-
"@vaadin/item": "
|
|
44
|
-
"@vaadin/list-box": "
|
|
45
|
-
"@vaadin/lit-renderer": "
|
|
46
|
-
"@vaadin/vaadin-list-mixin": "
|
|
47
|
-
"@vaadin/vaadin-lumo-styles": "
|
|
48
|
-
"@vaadin/vaadin-material-styles": "
|
|
49
|
-
"@vaadin/vaadin-overlay": "
|
|
50
|
-
"@vaadin/vaadin-themable-mixin": "
|
|
39
|
+
"@vaadin/button": "23.2.0-dev.48e5e3967",
|
|
40
|
+
"@vaadin/component-base": "23.2.0-dev.48e5e3967",
|
|
41
|
+
"@vaadin/field-base": "23.2.0-dev.48e5e3967",
|
|
42
|
+
"@vaadin/input-container": "23.2.0-dev.48e5e3967",
|
|
43
|
+
"@vaadin/item": "23.2.0-dev.48e5e3967",
|
|
44
|
+
"@vaadin/list-box": "23.2.0-dev.48e5e3967",
|
|
45
|
+
"@vaadin/lit-renderer": "23.2.0-dev.48e5e3967",
|
|
46
|
+
"@vaadin/vaadin-list-mixin": "23.2.0-dev.48e5e3967",
|
|
47
|
+
"@vaadin/vaadin-lumo-styles": "23.2.0-dev.48e5e3967",
|
|
48
|
+
"@vaadin/vaadin-material-styles": "23.2.0-dev.48e5e3967",
|
|
49
|
+
"@vaadin/vaadin-overlay": "23.2.0-dev.48e5e3967",
|
|
50
|
+
"@vaadin/vaadin-themable-mixin": "23.2.0-dev.48e5e3967"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@esm-bundle/chai": "^4.3.4",
|
|
54
|
-
"@vaadin/polymer-legacy-adapter": "
|
|
54
|
+
"@vaadin/polymer-legacy-adapter": "23.2.0-dev.48e5e3967",
|
|
55
55
|
"@vaadin/testing-helpers": "^0.3.2",
|
|
56
56
|
"lit": "^2.0.0",
|
|
57
57
|
"sinon": "^13.0.2"
|
|
58
58
|
},
|
|
59
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "961bc4ae5b707c3c02f12b99819b3c12c9b478aa"
|
|
60
60
|
}
|
package/src/vaadin-select.d.ts
CHANGED
|
@@ -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(
|
|
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
|
*
|
package/src/vaadin-select.js
CHANGED
|
@@ -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 {
|
|
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(
|
|
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.
|
|
316
|
+
return this._valueButtonController && this._valueButtonController.node;
|
|
329
317
|
}
|
|
330
318
|
|
|
331
319
|
constructor() {
|
|
332
320
|
super();
|
|
333
321
|
|
|
334
|
-
|
|
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
|
-
|
|
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;
|