@vaadin/select 23.1.0-alpha1 → 23.1.0-alpha4
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 +15 -15
- package/src/vaadin-select-overlay.js +1 -1
- package/src/vaadin-select-value-button.js +60 -39
- package/src/vaadin-select.d.ts +2 -2
- package/src/vaadin-select.js +13 -14
- package/theme/lumo/vaadin-select-styles.js +8 -14
- package/theme/lumo/vaadin-select.js +0 -1
- package/theme/material/vaadin-select-styles.js +3 -8
- package/theme/material/vaadin-select.js +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/select",
|
|
3
|
-
"version": "23.1.0-
|
|
3
|
+
"version": "23.1.0-alpha4",
|
|
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.1.0-
|
|
38
|
-
"@vaadin/component-base": "23.1.0-
|
|
39
|
-
"@vaadin/field-base": "23.1.0-
|
|
40
|
-
"@vaadin/input-container": "23.1.0-
|
|
41
|
-
"@vaadin/item": "23.1.0-
|
|
42
|
-
"@vaadin/list-box": "23.1.0-
|
|
43
|
-
"@vaadin/vaadin-list-mixin": "23.1.0-
|
|
44
|
-
"@vaadin/vaadin-lumo-styles": "23.1.0-
|
|
45
|
-
"@vaadin/vaadin-material-styles": "23.1.0-
|
|
46
|
-
"@vaadin/vaadin-overlay": "23.1.0-
|
|
47
|
-
"@vaadin/vaadin-themable-mixin": "23.1.0-
|
|
37
|
+
"@vaadin/button": "23.1.0-alpha4",
|
|
38
|
+
"@vaadin/component-base": "23.1.0-alpha4",
|
|
39
|
+
"@vaadin/field-base": "23.1.0-alpha4",
|
|
40
|
+
"@vaadin/input-container": "23.1.0-alpha4",
|
|
41
|
+
"@vaadin/item": "23.1.0-alpha4",
|
|
42
|
+
"@vaadin/list-box": "23.1.0-alpha4",
|
|
43
|
+
"@vaadin/vaadin-list-mixin": "23.1.0-alpha4",
|
|
44
|
+
"@vaadin/vaadin-lumo-styles": "23.1.0-alpha4",
|
|
45
|
+
"@vaadin/vaadin-material-styles": "23.1.0-alpha4",
|
|
46
|
+
"@vaadin/vaadin-overlay": "23.1.0-alpha4",
|
|
47
|
+
"@vaadin/vaadin-themable-mixin": "23.1.0-alpha4"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@esm-bundle/chai": "^4.3.4",
|
|
51
|
-
"@vaadin/polymer-legacy-adapter": "23.1.0-
|
|
51
|
+
"@vaadin/polymer-legacy-adapter": "23.1.0-alpha4",
|
|
52
52
|
"@vaadin/testing-helpers": "^0.3.2",
|
|
53
53
|
"lit": "^2.0.0",
|
|
54
|
-
"sinon": "^
|
|
54
|
+
"sinon": "^13.0.2"
|
|
55
55
|
},
|
|
56
|
-
"gitHead": "
|
|
56
|
+
"gitHead": "aacdb7fe09811894751f0378ff7fb66071892c71"
|
|
57
57
|
}
|
|
@@ -3,54 +3,75 @@
|
|
|
3
3
|
* Copyright (c) 2017 - 2022 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
registerStyles(
|
|
10
|
-
'vaadin-select-value-button',
|
|
11
|
-
css`
|
|
12
|
-
:host {
|
|
13
|
-
margin: 0;
|
|
14
|
-
min-width: 0;
|
|
15
|
-
width: 0;
|
|
16
|
-
height: auto;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
::slotted(:not([slot])) {
|
|
20
|
-
padding-left: 0;
|
|
21
|
-
padding-right: 0;
|
|
22
|
-
flex: auto;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/* placeholder styles */
|
|
26
|
-
::slotted(:not([slot]):not([selected])) {
|
|
27
|
-
line-height: 1;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/* TODO: unsupported selector */
|
|
31
|
-
.vaadin-button-container {
|
|
32
|
-
text-align: inherit;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
[part='label'] {
|
|
36
|
-
width: 100%;
|
|
37
|
-
padding: 0;
|
|
38
|
-
line-height: inherit;
|
|
39
|
-
}
|
|
40
|
-
`,
|
|
41
|
-
{ moduleId: 'vaadin-select-value-button-styles' }
|
|
42
|
-
);
|
|
6
|
+
import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
|
|
7
|
+
import { ButtonMixin } from '@vaadin/button/src/vaadin-button-mixin.js';
|
|
8
|
+
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
43
9
|
|
|
44
10
|
/**
|
|
45
11
|
* An element used internally by `<vaadin-select>`. Not intended to be used separately.
|
|
46
12
|
*
|
|
47
|
-
* @extends
|
|
13
|
+
* @extends HTMLElement
|
|
14
|
+
* @mixes ButtonMixin
|
|
15
|
+
* @mixes ThemableMixin
|
|
48
16
|
* @protected
|
|
49
17
|
*/
|
|
50
|
-
class SelectValueButton extends
|
|
18
|
+
class SelectValueButton extends ButtonMixin(ThemableMixin(PolymerElement)) {
|
|
51
19
|
static get is() {
|
|
52
20
|
return 'vaadin-select-value-button';
|
|
53
21
|
}
|
|
22
|
+
|
|
23
|
+
static get template() {
|
|
24
|
+
return html`
|
|
25
|
+
<style>
|
|
26
|
+
:host {
|
|
27
|
+
display: inline-block;
|
|
28
|
+
position: relative;
|
|
29
|
+
outline: none;
|
|
30
|
+
white-space: nowrap;
|
|
31
|
+
-webkit-user-select: none;
|
|
32
|
+
-moz-user-select: none;
|
|
33
|
+
user-select: none;
|
|
34
|
+
min-width: 0;
|
|
35
|
+
width: 0;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
::slotted(*) {
|
|
39
|
+
padding-left: 0;
|
|
40
|
+
padding-right: 0;
|
|
41
|
+
flex: auto;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/* placeholder styles */
|
|
45
|
+
::slotted(*:not([selected])) {
|
|
46
|
+
line-height: 1;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.vaadin-button-container {
|
|
50
|
+
display: inline-flex;
|
|
51
|
+
align-items: center;
|
|
52
|
+
justify-content: center;
|
|
53
|
+
text-align: inherit;
|
|
54
|
+
width: 100%;
|
|
55
|
+
height: 100%;
|
|
56
|
+
min-height: inherit;
|
|
57
|
+
text-shadow: inherit;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
[part='label'] {
|
|
61
|
+
white-space: nowrap;
|
|
62
|
+
overflow: hidden;
|
|
63
|
+
text-overflow: ellipsis;
|
|
64
|
+
width: 100%;
|
|
65
|
+
line-height: inherit;
|
|
66
|
+
}
|
|
67
|
+
</style>
|
|
68
|
+
<div class="vaadin-button-container">
|
|
69
|
+
<span part="label">
|
|
70
|
+
<slot></slot>
|
|
71
|
+
</span>
|
|
72
|
+
</div>
|
|
73
|
+
`;
|
|
74
|
+
}
|
|
54
75
|
}
|
|
55
76
|
|
|
56
77
|
customElements.define(SelectValueButton.is, SelectValueButton);
|
package/src/vaadin-select.d.ts
CHANGED
|
@@ -255,13 +255,13 @@ declare class Select extends DelegateFocusMixin(FieldMixin(SlotMixin(ElementMixi
|
|
|
255
255
|
addEventListener<K extends keyof SelectEventMap>(
|
|
256
256
|
type: K,
|
|
257
257
|
listener: (this: Select, ev: SelectEventMap[K]) => void,
|
|
258
|
-
options?: boolean | AddEventListenerOptions
|
|
258
|
+
options?: boolean | AddEventListenerOptions,
|
|
259
259
|
): void;
|
|
260
260
|
|
|
261
261
|
removeEventListener<K extends keyof SelectEventMap>(
|
|
262
262
|
type: K,
|
|
263
263
|
listener: (this: Select, ev: SelectEventMap[K]) => void,
|
|
264
|
-
options?: boolean | EventListenerOptions
|
|
264
|
+
options?: boolean | EventListenerOptions,
|
|
265
265
|
): void;
|
|
266
266
|
}
|
|
267
267
|
|
package/src/vaadin-select.js
CHANGED
|
@@ -142,7 +142,6 @@ class Select extends DelegateFocusMixin(FieldMixin(SlotMixin(ElementMixin(Themab
|
|
|
142
142
|
<style>
|
|
143
143
|
::slotted([slot='value']) {
|
|
144
144
|
flex-grow: 1;
|
|
145
|
-
background-color: transparent;
|
|
146
145
|
}
|
|
147
146
|
</style>
|
|
148
147
|
|
|
@@ -209,7 +208,7 @@ class Select extends DelegateFocusMixin(FieldMixin(SlotMixin(ElementMixin(Themab
|
|
|
209
208
|
*/
|
|
210
209
|
items: {
|
|
211
210
|
type: Array,
|
|
212
|
-
observer: '__itemsChanged'
|
|
211
|
+
observer: '__itemsChanged',
|
|
213
212
|
},
|
|
214
213
|
|
|
215
214
|
/**
|
|
@@ -221,7 +220,7 @@ class Select extends DelegateFocusMixin(FieldMixin(SlotMixin(ElementMixin(Themab
|
|
|
221
220
|
value: false,
|
|
222
221
|
notify: true,
|
|
223
222
|
reflectToAttribute: true,
|
|
224
|
-
observer: '_openedChanged'
|
|
223
|
+
observer: '_openedChanged',
|
|
225
224
|
},
|
|
226
225
|
|
|
227
226
|
/**
|
|
@@ -253,14 +252,14 @@ class Select extends DelegateFocusMixin(FieldMixin(SlotMixin(ElementMixin(Themab
|
|
|
253
252
|
type: String,
|
|
254
253
|
value: '',
|
|
255
254
|
notify: true,
|
|
256
|
-
observer: '_valueChanged'
|
|
255
|
+
observer: '_valueChanged',
|
|
257
256
|
},
|
|
258
257
|
|
|
259
258
|
/**
|
|
260
259
|
* The name of this element.
|
|
261
260
|
*/
|
|
262
261
|
name: {
|
|
263
|
-
type: String
|
|
262
|
+
type: String,
|
|
264
263
|
},
|
|
265
264
|
|
|
266
265
|
/**
|
|
@@ -271,7 +270,7 @@ class Select extends DelegateFocusMixin(FieldMixin(SlotMixin(ElementMixin(Themab
|
|
|
271
270
|
* DOM content is empty.
|
|
272
271
|
*/
|
|
273
272
|
placeholder: {
|
|
274
|
-
type: String
|
|
273
|
+
type: String,
|
|
275
274
|
},
|
|
276
275
|
|
|
277
276
|
/**
|
|
@@ -281,7 +280,7 @@ class Select extends DelegateFocusMixin(FieldMixin(SlotMixin(ElementMixin(Themab
|
|
|
281
280
|
readonly: {
|
|
282
281
|
type: Boolean,
|
|
283
282
|
value: false,
|
|
284
|
-
reflectToAttribute: true
|
|
283
|
+
reflectToAttribute: true,
|
|
285
284
|
},
|
|
286
285
|
|
|
287
286
|
/** @private */
|
|
@@ -289,7 +288,7 @@ class Select extends DelegateFocusMixin(FieldMixin(SlotMixin(ElementMixin(Themab
|
|
|
289
288
|
|
|
290
289
|
/** @private */
|
|
291
290
|
_phoneMediaQuery: {
|
|
292
|
-
value: '(max-width: 420px), (max-height: 420px)'
|
|
291
|
+
value: '(max-width: 420px), (max-height: 420px)',
|
|
293
292
|
},
|
|
294
293
|
|
|
295
294
|
/** @private */
|
|
@@ -299,7 +298,7 @@ class Select extends DelegateFocusMixin(FieldMixin(SlotMixin(ElementMixin(Themab
|
|
|
299
298
|
_inputContainer: Object,
|
|
300
299
|
|
|
301
300
|
/** @private */
|
|
302
|
-
_items: Object
|
|
301
|
+
_items: Object,
|
|
303
302
|
};
|
|
304
303
|
}
|
|
305
304
|
|
|
@@ -308,7 +307,7 @@ class Select extends DelegateFocusMixin(FieldMixin(SlotMixin(ElementMixin(Themab
|
|
|
308
307
|
'_updateAriaExpanded(opened)',
|
|
309
308
|
'_updateAriaRequired(required)',
|
|
310
309
|
'_updateSelectedItem(value, _items, placeholder)',
|
|
311
|
-
'_rendererChanged(renderer, _overlayElement)'
|
|
310
|
+
'_rendererChanged(renderer, _overlayElement)',
|
|
312
311
|
];
|
|
313
312
|
}
|
|
314
313
|
|
|
@@ -320,7 +319,7 @@ class Select extends DelegateFocusMixin(FieldMixin(SlotMixin(ElementMixin(Themab
|
|
|
320
319
|
const button = document.createElement('vaadin-select-value-button');
|
|
321
320
|
button.setAttribute('aria-haspopup', 'listbox');
|
|
322
321
|
return button;
|
|
323
|
-
}
|
|
322
|
+
},
|
|
324
323
|
};
|
|
325
324
|
}
|
|
326
325
|
|
|
@@ -376,7 +375,7 @@ class Select extends DelegateFocusMixin(FieldMixin(SlotMixin(ElementMixin(Themab
|
|
|
376
375
|
this.addController(
|
|
377
376
|
new MediaQueryController(this._phoneMediaQuery, (matches) => {
|
|
378
377
|
this._phone = matches;
|
|
379
|
-
})
|
|
378
|
+
}),
|
|
380
379
|
);
|
|
381
380
|
|
|
382
381
|
processTemplates(this);
|
|
@@ -451,7 +450,7 @@ class Select extends DelegateFocusMixin(FieldMixin(SlotMixin(ElementMixin(Themab
|
|
|
451
450
|
this.__userInteraction = true;
|
|
452
451
|
this.opened = false;
|
|
453
452
|
},
|
|
454
|
-
true
|
|
453
|
+
true,
|
|
455
454
|
);
|
|
456
455
|
|
|
457
456
|
menuElement.setAttribute('role', 'listbox');
|
|
@@ -536,7 +535,7 @@ class Select extends DelegateFocusMixin(FieldMixin(SlotMixin(ElementMixin(Themab
|
|
|
536
535
|
|
|
537
536
|
this._overlayElement.style.setProperty(
|
|
538
537
|
'--vaadin-select-text-field-width',
|
|
539
|
-
this._inputContainer.offsetWidth
|
|
538
|
+
`${this._inputContainer.offsetWidth}px`,
|
|
540
539
|
);
|
|
541
540
|
|
|
542
541
|
// Preserve focus-ring to restore it later
|
|
@@ -48,7 +48,7 @@ const select = css`
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
:host([theme~='small']) [part='input-field'] ::slotted([slot='value']) {
|
|
51
|
-
--
|
|
51
|
+
--_lumo-selected-item-height: var(--lumo-size-s);
|
|
52
52
|
--_lumo-selected-item-padding: 0;
|
|
53
53
|
}
|
|
54
54
|
`;
|
|
@@ -59,30 +59,24 @@ registerStyles(
|
|
|
59
59
|
'vaadin-select-value-button',
|
|
60
60
|
css`
|
|
61
61
|
:host {
|
|
62
|
+
font-family: var(--lumo-font-family);
|
|
63
|
+
font-size: var(--lumo-font-size-m);
|
|
62
64
|
padding: 0 0.25em;
|
|
65
|
+
--_lumo-selected-item-height: var(--lumo-size-m);
|
|
63
66
|
--_lumo-selected-item-padding: 0.5em;
|
|
64
67
|
}
|
|
65
68
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
display: none;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
:host([focus-ring]) {
|
|
72
|
-
box-shadow: none;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
::slotted(:not([slot])) {
|
|
76
|
-
min-height: var(--lumo-button-size);
|
|
69
|
+
::slotted(*) {
|
|
70
|
+
min-height: var(--_lumo-selected-item-height);
|
|
77
71
|
padding-top: var(--_lumo-selected-item-padding);
|
|
78
72
|
padding-bottom: var(--_lumo-selected-item-padding);
|
|
79
73
|
}
|
|
80
74
|
|
|
81
|
-
::slotted(
|
|
75
|
+
::slotted(*:hover) {
|
|
82
76
|
background-color: transparent;
|
|
83
77
|
}
|
|
84
78
|
`,
|
|
85
|
-
{ moduleId: 'lumo-select-value-button' }
|
|
79
|
+
{ moduleId: 'lumo-select-value-button' },
|
|
86
80
|
);
|
|
87
81
|
|
|
88
82
|
const selectOverlay = css`
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
* Copyright (c) 2017 - 2022 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
-
import '@vaadin/button/theme/lumo/vaadin-button.js';
|
|
7
6
|
import '@vaadin/input-container/theme/lumo/vaadin-input-container.js';
|
|
8
7
|
import '@vaadin/item/theme/lumo/vaadin-item.js';
|
|
9
8
|
import '@vaadin/list-box/theme/lumo/vaadin-list-box.js';
|
|
@@ -49,21 +49,16 @@ registerStyles(
|
|
|
49
49
|
text-transform: none;
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
|
|
53
|
-
:host::after {
|
|
54
|
-
display: none;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
::slotted(:not([slot])) {
|
|
52
|
+
::slotted(*) {
|
|
58
53
|
font: inherit;
|
|
59
54
|
padding: 4px 0;
|
|
60
55
|
}
|
|
61
56
|
|
|
62
|
-
::slotted(
|
|
57
|
+
::slotted(*:hover) {
|
|
63
58
|
background-color: transparent;
|
|
64
59
|
}
|
|
65
60
|
`,
|
|
66
|
-
{ moduleId: 'material-select-value-button' }
|
|
61
|
+
{ moduleId: 'material-select-value-button' },
|
|
67
62
|
);
|
|
68
63
|
|
|
69
64
|
const selectOverlay = css`
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
* Copyright (c) 2017 - 2022 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
-
import '@vaadin/button/theme/material/vaadin-button.js';
|
|
7
6
|
import '@vaadin/input-container/theme/material/vaadin-input-container.js';
|
|
8
7
|
import '@vaadin/item/theme/material/vaadin-item.js';
|
|
9
8
|
import '@vaadin/list-box/theme/material/vaadin-list-box.js';
|