@vaadin/select 23.0.9 → 23.0.12

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.0.9",
3
+ "version": "23.0.12",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -34,24 +34,24 @@
34
34
  ],
35
35
  "dependencies": {
36
36
  "@polymer/polymer": "^3.2.0",
37
- "@vaadin/button": "^23.0.9",
38
- "@vaadin/component-base": "^23.0.9",
39
- "@vaadin/field-base": "^23.0.9",
40
- "@vaadin/input-container": "^23.0.9",
41
- "@vaadin/item": "^23.0.9",
42
- "@vaadin/list-box": "^23.0.9",
43
- "@vaadin/vaadin-list-mixin": "^23.0.9",
44
- "@vaadin/vaadin-lumo-styles": "^23.0.9",
45
- "@vaadin/vaadin-material-styles": "^23.0.9",
46
- "@vaadin/vaadin-overlay": "^23.0.9",
47
- "@vaadin/vaadin-themable-mixin": "^23.0.9"
37
+ "@vaadin/button": "^23.0.12",
38
+ "@vaadin/component-base": "^23.0.12",
39
+ "@vaadin/field-base": "^23.0.12",
40
+ "@vaadin/input-container": "^23.0.12",
41
+ "@vaadin/item": "^23.0.12",
42
+ "@vaadin/list-box": "^23.0.12",
43
+ "@vaadin/vaadin-list-mixin": "^23.0.12",
44
+ "@vaadin/vaadin-lumo-styles": "^23.0.12",
45
+ "@vaadin/vaadin-material-styles": "^23.0.12",
46
+ "@vaadin/vaadin-overlay": "^23.0.12",
47
+ "@vaadin/vaadin-themable-mixin": "^23.0.12"
48
48
  },
49
49
  "devDependencies": {
50
50
  "@esm-bundle/chai": "^4.3.4",
51
- "@vaadin/polymer-legacy-adapter": "^23.0.9",
51
+ "@vaadin/polymer-legacy-adapter": "^23.0.12",
52
52
  "@vaadin/testing-helpers": "^0.3.2",
53
53
  "lit": "^2.0.0",
54
54
  "sinon": "^9.2.0"
55
55
  },
56
- "gitHead": "4d687bdd48ba78d55f3371a78b70818e4dfca1a3"
56
+ "gitHead": "717908c222c1e241259e30b4144cd5ba32734819"
57
57
  }
@@ -15,7 +15,7 @@ registerStyles(
15
15
  justify-content: flex-start;
16
16
  }
17
17
  `,
18
- { moduleId: 'vaadin-select-overlay-styles' }
18
+ { moduleId: 'vaadin-select-overlay-styles' },
19
19
  );
20
20
 
21
21
  /**
@@ -38,7 +38,7 @@ registerStyles(
38
38
  line-height: inherit;
39
39
  }
40
40
  `,
41
- { moduleId: 'vaadin-select-value-button-styles' }
41
+ { moduleId: 'vaadin-select-value-button-styles' },
42
42
  );
43
43
 
44
44
  /**
@@ -6,6 +6,7 @@
6
6
  import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
7
7
  import { SlotMixin } from '@vaadin/component-base/src/slot-mixin.js';
8
8
  import { DelegateFocusMixin } from '@vaadin/field-base/src/delegate-focus-mixin.js';
9
+ import { DelegateStateMixin } from '@vaadin/field-base/src/delegate-state-mixin.js';
9
10
  import { FieldMixin } from '@vaadin/field-base/src/field-mixin.js';
10
11
  import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
11
12
 
@@ -164,7 +165,9 @@ export interface SelectEventMap extends HTMLElementEventMap, SelectCustomEventMa
164
165
  * @fires {CustomEvent} opened-changed - Fired when the `opened` property changes.
165
166
  * @fires {CustomEvent} value-changed - Fired when the `value` property changes.
166
167
  */
167
- declare class Select extends DelegateFocusMixin(FieldMixin(SlotMixin(ElementMixin(ThemableMixin(HTMLElement))))) {
168
+ declare class Select extends DelegateFocusMixin(
169
+ DelegateStateMixin(FieldMixin(SlotMixin(ElementMixin(ThemableMixin(HTMLElement))))),
170
+ ) {
168
171
  /**
169
172
  * An array containing items that will be rendered as the options of the select.
170
173
  *
@@ -255,13 +258,13 @@ declare class Select extends DelegateFocusMixin(FieldMixin(SlotMixin(ElementMixi
255
258
  addEventListener<K extends keyof SelectEventMap>(
256
259
  type: K,
257
260
  listener: (this: Select, ev: SelectEventMap[K]) => void,
258
- options?: boolean | AddEventListenerOptions
261
+ options?: boolean | AddEventListenerOptions,
259
262
  ): void;
260
263
 
261
264
  removeEventListener<K extends keyof SelectEventMap>(
262
265
  type: K,
263
266
  listener: (this: Select, ev: SelectEventMap[K]) => void,
264
- options?: boolean | EventListenerOptions
267
+ options?: boolean | EventListenerOptions,
265
268
  ): void;
266
269
  }
267
270
 
@@ -14,6 +14,7 @@ import { MediaQueryController } from '@vaadin/component-base/src/media-query-con
14
14
  import { SlotMixin } from '@vaadin/component-base/src/slot-mixin.js';
15
15
  import { processTemplates } from '@vaadin/component-base/src/templates.js';
16
16
  import { DelegateFocusMixin } from '@vaadin/field-base/src/delegate-focus-mixin.js';
17
+ import { DelegateStateMixin } from '@vaadin/field-base/src/delegate-state-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';
19
20
  import { inputFieldContainer } from '@vaadin/field-base/src/styles/input-field-container-styles.js';
@@ -131,8 +132,11 @@ registerStyles('vaadin-select', [fieldShared, inputFieldContainer], { moduleId:
131
132
  * @mixes SlotMixin
132
133
  * @mixes FieldMixin
133
134
  * @mixes DelegateFocusMixin
135
+ * @mixes DelegateStateMixin
134
136
  */
135
- class Select extends DelegateFocusMixin(FieldMixin(SlotMixin(ElementMixin(ThemableMixin(PolymerElement))))) {
137
+ class Select extends DelegateFocusMixin(
138
+ DelegateStateMixin(FieldMixin(SlotMixin(ElementMixin(ThemableMixin(PolymerElement))))),
139
+ ) {
136
140
  static get is() {
137
141
  return 'vaadin-select';
138
142
  }
@@ -209,7 +213,7 @@ class Select extends DelegateFocusMixin(FieldMixin(SlotMixin(ElementMixin(Themab
209
213
  */
210
214
  items: {
211
215
  type: Array,
212
- observer: '__itemsChanged'
216
+ observer: '__itemsChanged',
213
217
  },
214
218
 
215
219
  /**
@@ -221,7 +225,7 @@ class Select extends DelegateFocusMixin(FieldMixin(SlotMixin(ElementMixin(Themab
221
225
  value: false,
222
226
  notify: true,
223
227
  reflectToAttribute: true,
224
- observer: '_openedChanged'
228
+ observer: '_openedChanged',
225
229
  },
226
230
 
227
231
  /**
@@ -253,14 +257,14 @@ class Select extends DelegateFocusMixin(FieldMixin(SlotMixin(ElementMixin(Themab
253
257
  type: String,
254
258
  value: '',
255
259
  notify: true,
256
- observer: '_valueChanged'
260
+ observer: '_valueChanged',
257
261
  },
258
262
 
259
263
  /**
260
264
  * The name of this element.
261
265
  */
262
266
  name: {
263
- type: String
267
+ type: String,
264
268
  },
265
269
 
266
270
  /**
@@ -271,7 +275,7 @@ class Select extends DelegateFocusMixin(FieldMixin(SlotMixin(ElementMixin(Themab
271
275
  * DOM content is empty.
272
276
  */
273
277
  placeholder: {
274
- type: String
278
+ type: String,
275
279
  },
276
280
 
277
281
  /**
@@ -281,7 +285,7 @@ class Select extends DelegateFocusMixin(FieldMixin(SlotMixin(ElementMixin(Themab
281
285
  readonly: {
282
286
  type: Boolean,
283
287
  value: false,
284
- reflectToAttribute: true
288
+ reflectToAttribute: true,
285
289
  },
286
290
 
287
291
  /** @private */
@@ -289,7 +293,7 @@ class Select extends DelegateFocusMixin(FieldMixin(SlotMixin(ElementMixin(Themab
289
293
 
290
294
  /** @private */
291
295
  _phoneMediaQuery: {
292
- value: '(max-width: 420px), (max-height: 420px)'
296
+ value: '(max-width: 420px), (max-height: 420px)',
293
297
  },
294
298
 
295
299
  /** @private */
@@ -299,16 +303,19 @@ class Select extends DelegateFocusMixin(FieldMixin(SlotMixin(ElementMixin(Themab
299
303
  _inputContainer: Object,
300
304
 
301
305
  /** @private */
302
- _items: Object
306
+ _items: Object,
303
307
  };
304
308
  }
305
309
 
310
+ static get delegateAttrs() {
311
+ return [...super.delegateAttrs, 'invalid'];
312
+ }
313
+
306
314
  static get observers() {
307
315
  return [
308
316
  '_updateAriaExpanded(opened)',
309
- '_updateAriaRequired(required)',
310
317
  '_updateSelectedItem(value, _items, placeholder)',
311
- '_rendererChanged(renderer, _overlayElement)'
318
+ '_rendererChanged(renderer, _overlayElement)',
312
319
  ];
313
320
  }
314
321
 
@@ -320,7 +327,7 @@ class Select extends DelegateFocusMixin(FieldMixin(SlotMixin(ElementMixin(Themab
320
327
  const button = document.createElement('vaadin-select-value-button');
321
328
  button.setAttribute('aria-haspopup', 'listbox');
322
329
  return button;
323
- }
330
+ },
324
331
  };
325
332
  }
326
333
 
@@ -346,11 +353,11 @@ class Select extends DelegateFocusMixin(FieldMixin(SlotMixin(ElementMixin(Themab
346
353
  if (this._valueButton) {
347
354
  this._valueButton.setAttribute('aria-labelledby', `${this._labelId} ${this._fieldId}`);
348
355
 
349
- this._updateAriaRequired(this.required);
350
356
  this._updateAriaExpanded(this.opened);
351
357
 
352
358
  this._setFocusElement(this._valueButton);
353
359
  this.ariaTarget = this._valueButton;
360
+ this.stateTarget = this._valueButton;
354
361
 
355
362
  this._valueButton.addEventListener('keydown', this._boundOnKeyDown);
356
363
  }
@@ -376,7 +383,7 @@ class Select extends DelegateFocusMixin(FieldMixin(SlotMixin(ElementMixin(Themab
376
383
  this.addController(
377
384
  new MediaQueryController(this._phoneMediaQuery, (matches) => {
378
385
  this._phone = matches;
379
- })
386
+ }),
380
387
  );
381
388
 
382
389
  processTemplates(this);
@@ -451,7 +458,7 @@ class Select extends DelegateFocusMixin(FieldMixin(SlotMixin(ElementMixin(Themab
451
458
  this.__userInteraction = true;
452
459
  this.opened = false;
453
460
  },
454
- true
461
+ true,
455
462
  );
456
463
 
457
464
  menuElement.setAttribute('role', 'listbox');
@@ -485,7 +492,11 @@ class Select extends DelegateFocusMixin(FieldMixin(SlotMixin(ElementMixin(Themab
485
492
  *
486
493
  * @private
487
494
  */
488
- _onClick() {
495
+ _onClick(event) {
496
+ // Prevent parent components such as `vaadin-grid`
497
+ // from handling the click event after it bubbles.
498
+ event.preventDefault();
499
+
489
500
  this.opened = !this.readonly;
490
501
  }
491
502
 
@@ -536,7 +547,7 @@ class Select extends DelegateFocusMixin(FieldMixin(SlotMixin(ElementMixin(Themab
536
547
 
537
548
  this._overlayElement.style.setProperty(
538
549
  '--vaadin-select-text-field-width',
539
- this._inputContainer.offsetWidth + 'px'
550
+ this._inputContainer.offsetWidth + 'px',
540
551
  );
541
552
 
542
553
  // Preserve focus-ring to restore it later
@@ -565,13 +576,6 @@ class Select extends DelegateFocusMixin(FieldMixin(SlotMixin(ElementMixin(Themab
565
576
  }
566
577
  }
567
578
 
568
- /** @private */
569
- _updateAriaRequired(required) {
570
- if (this._valueButton) {
571
- this._valueButton.setAttribute('aria-required', required ? 'true' : 'false');
572
- }
573
- }
574
-
575
579
  /** @private */
576
580
  _updateAriaLive(ariaLive) {
577
581
  if (this._valueButton) {
@@ -82,7 +82,7 @@ registerStyles(
82
82
  background-color: transparent;
83
83
  }
84
84
  `,
85
- { moduleId: 'lumo-select-value-button' }
85
+ { moduleId: 'lumo-select-value-button' },
86
86
  );
87
87
 
88
88
  const selectOverlay = css`
@@ -7,5 +7,6 @@ import '@vaadin/button/theme/lumo/vaadin-button.js';
7
7
  import '@vaadin/input-container/theme/lumo/vaadin-input-container.js';
8
8
  import '@vaadin/item/theme/lumo/vaadin-item.js';
9
9
  import '@vaadin/list-box/theme/lumo/vaadin-list-box.js';
10
+ import '@vaadin/vaadin-overlay/theme/lumo/vaadin-overlay.js';
10
11
  import './vaadin-select-styles.js';
11
12
  import '../../src/vaadin-select.js';
@@ -63,7 +63,7 @@ registerStyles(
63
63
  background-color: transparent;
64
64
  }
65
65
  `,
66
- { moduleId: 'material-select-value-button' }
66
+ { moduleId: 'material-select-value-button' },
67
67
  );
68
68
 
69
69
  const selectOverlay = css`
@@ -7,5 +7,6 @@ import '@vaadin/button/theme/material/vaadin-button.js';
7
7
  import '@vaadin/input-container/theme/material/vaadin-input-container.js';
8
8
  import '@vaadin/item/theme/material/vaadin-item.js';
9
9
  import '@vaadin/list-box/theme/material/vaadin-list-box.js';
10
+ import '@vaadin/vaadin-overlay/theme/material/vaadin-overlay.js';
10
11
  import './vaadin-select-styles.js';
11
12
  import '../../src/vaadin-select.js';