@vaadin/select 24.2.0-alpha4 → 24.2.0-alpha5

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.
@@ -0,0 +1,50 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2017 - 2023 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
+ -moz-user-select: none;
16
+ user-select: none;
17
+ min-width: 0;
18
+ width: 0;
19
+ }
20
+
21
+ ::slotted(*) {
22
+ padding-left: 0;
23
+ padding-right: 0;
24
+ flex: auto;
25
+ }
26
+
27
+ /* placeholder styles */
28
+ ::slotted(*:not([selected])) {
29
+ line-height: 1;
30
+ }
31
+
32
+ .vaadin-button-container {
33
+ display: inline-flex;
34
+ align-items: center;
35
+ justify-content: center;
36
+ text-align: inherit;
37
+ width: 100%;
38
+ height: 100%;
39
+ min-height: inherit;
40
+ text-shadow: inherit;
41
+ }
42
+
43
+ [part='label'] {
44
+ white-space: nowrap;
45
+ overflow: hidden;
46
+ text-overflow: ellipsis;
47
+ width: 100%;
48
+ line-height: inherit;
49
+ }
50
+ `;
@@ -5,7 +5,10 @@
5
5
  */
6
6
  import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
7
7
  import { ButtonMixin } from '@vaadin/button/src/vaadin-button-mixin.js';
8
- import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
8
+ import { registerStyles, ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
9
+ import { valueButton } from './vaadin-select-value-button-styles.js';
10
+
11
+ registerStyles('vaadin-select-value-button', valueButton, { moduleId: 'vaadin-select-value-button-styles' });
9
12
 
10
13
  /**
11
14
  * An element used internally by `<vaadin-select>`. Not intended to be used separately.
@@ -22,49 +25,6 @@ class SelectValueButton extends ButtonMixin(ThemableMixin(PolymerElement)) {
22
25
 
23
26
  static get template() {
24
27
  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
28
  <div class="vaadin-button-container">
69
29
  <span part="label">
70
30
  <slot></slot>
@@ -3,13 +3,9 @@
3
3
  * Copyright (c) 2017 - 2023 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
- import { DelegateFocusMixin } from '@vaadin/a11y-base/src/delegate-focus-mixin.js';
7
- import { KeyboardMixin } from '@vaadin/a11y-base/src/keyboard-mixin.js';
8
- import { DelegateStateMixin } from '@vaadin/component-base/src/delegate-state-mixin.js';
9
6
  import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
10
- import { OverlayClassMixin } from '@vaadin/component-base/src/overlay-class-mixin.js';
11
- import { FieldMixin } from '@vaadin/field-base/src/field-mixin.js';
12
7
  import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
8
+ import { SelectBaseMixin } from './vaadin-select-base-mixin.js';
13
9
 
14
10
  export interface SelectItem {
15
11
  label?: string;
@@ -174,87 +170,7 @@ export interface SelectEventMap extends HTMLElementEventMap, SelectCustomEventMa
174
170
  * @fires {CustomEvent} value-changed - Fired when the `value` property changes.
175
171
  * @fires {CustomEvent} validated - Fired whenever the field is validated.
176
172
  */
177
- declare class Select extends OverlayClassMixin(
178
- DelegateFocusMixin(DelegateStateMixin(KeyboardMixin(FieldMixin(ElementMixin(ThemableMixin(HTMLElement)))))),
179
- ) {
180
- /**
181
- * An array containing items that will be rendered as the options of the select.
182
- *
183
- * #### Example
184
- * ```js
185
- * select.items = [
186
- * { label: 'Most recent first', value: 'recent' },
187
- * { component: 'hr' },
188
- * { label: 'Rating: low to high', value: 'rating-asc' },
189
- * { label: 'Rating: high to low', value: 'rating-desc' },
190
- * { component: 'hr' },
191
- * { label: 'Price: low to high', value: 'price-asc', disabled: true },
192
- * { label: 'Price: high to low', value: 'price-desc', disabled: true }
193
- * ];
194
- * ```
195
- *
196
- * Note: each item is rendered by default as the internal `<vaadin-select-item>` that is an extension of `<vaadin-item>`.
197
- * To render the item with a custom component, provide a tag name by the `component` property.
198
- *
199
- * @type {!Array<!SelectItem>}
200
- */
201
- items: SelectItem[] | null | undefined;
202
-
203
- /**
204
- * Set when the select is open
205
- */
206
- opened: boolean;
207
-
208
- /**
209
- * Custom function for rendering the content of the `<vaadin-select>`.
210
- * Receives two arguments:
211
- *
212
- * - `root` The `<vaadin-select-overlay>` internal container
213
- * DOM element. Append your content to it.
214
- * - `select` The reference to the `<vaadin-select>` element.
215
- */
216
- renderer: SelectRenderer | undefined;
217
-
218
- /**
219
- * The `value` property of the selected item, or an empty string
220
- * if no item is selected.
221
- * On change or initialization, the component finds the item which matches the
222
- * value and displays it.
223
- * If no value is provided to the component, it selects the first item without
224
- * value or empty value.
225
- * Hint: If you do not want to select any item by default, you can either set all
226
- * the values of inner vaadin-items, or set the vaadin-select value to
227
- * an inexistent value in the items list.
228
- */
229
- value: string;
230
-
231
- /**
232
- * The name of this element.
233
- */
234
- name: string | null | undefined;
235
-
236
- /**
237
- * A hint to the user of what can be entered in the control.
238
- * The placeholder will be displayed in the case that there
239
- * is no item selected, or the selected item has an empty
240
- * string label, or the selected item has no label and it's
241
- * DOM content is empty.
242
- */
243
- placeholder: string | null | undefined;
244
-
245
- /**
246
- * When present, it specifies that the element is read-only.
247
- */
248
- readonly: boolean;
249
-
250
- /**
251
- * Requests an update for the content of the select.
252
- * While performing the update, it invokes the renderer passed in the `renderer` property.
253
- *
254
- * It is not guaranteed that the update happens immediately (synchronously) after it is requested.
255
- */
256
- requestContentUpdate(): void;
257
-
173
+ declare class Select extends SelectBaseMixin(ElementMixin(ThemableMixin(HTMLElement))) {
258
174
  addEventListener<K extends keyof SelectEventMap>(
259
175
  type: K,
260
176
  listener: (this: Select, ev: SelectEventMap[K]) => void,