@vaadin/time-picker 25.0.0-alpha2 → 25.0.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaadin/time-picker",
3
- "version": "25.0.0-alpha2",
3
+ "version": "25.0.0-alpha4",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -37,19 +37,19 @@
37
37
  ],
38
38
  "dependencies": {
39
39
  "@open-wc/dedupe-mixin": "^1.3.0",
40
- "@vaadin/combo-box": "25.0.0-alpha2",
41
- "@vaadin/component-base": "25.0.0-alpha2",
42
- "@vaadin/field-base": "25.0.0-alpha2",
43
- "@vaadin/input-container": "25.0.0-alpha2",
44
- "@vaadin/item": "25.0.0-alpha2",
45
- "@vaadin/overlay": "25.0.0-alpha2",
46
- "@vaadin/vaadin-lumo-styles": "25.0.0-alpha2",
47
- "@vaadin/vaadin-themable-mixin": "25.0.0-alpha2",
40
+ "@vaadin/combo-box": "25.0.0-alpha4",
41
+ "@vaadin/component-base": "25.0.0-alpha4",
42
+ "@vaadin/field-base": "25.0.0-alpha4",
43
+ "@vaadin/input-container": "25.0.0-alpha4",
44
+ "@vaadin/item": "25.0.0-alpha4",
45
+ "@vaadin/overlay": "25.0.0-alpha4",
46
+ "@vaadin/vaadin-lumo-styles": "25.0.0-alpha4",
47
+ "@vaadin/vaadin-themable-mixin": "25.0.0-alpha4",
48
48
  "lit": "^3.0.0"
49
49
  },
50
50
  "devDependencies": {
51
- "@vaadin/chai-plugins": "25.0.0-alpha2",
52
- "@vaadin/test-runner-commands": "25.0.0-alpha2",
51
+ "@vaadin/chai-plugins": "25.0.0-alpha4",
52
+ "@vaadin/test-runner-commands": "25.0.0-alpha4",
53
53
  "@vaadin/testing-helpers": "^2.0.0",
54
54
  "sinon": "^18.0.0"
55
55
  },
@@ -57,5 +57,5 @@
57
57
  "web-types.json",
58
58
  "web-types.lit.json"
59
59
  ],
60
- "gitHead": "67ffcd5355cf21ce1b5039c598525109fc4c164b"
60
+ "gitHead": "ce4421f0daf26027b863b91787a474e4cc264344"
61
61
  }
@@ -7,17 +7,23 @@ import '@vaadin/component-base/src/style-props.js';
7
7
  import { css } from 'lit';
8
8
 
9
9
  export const timePickerStyles = css`
10
- [part='toggle-button']::before {
11
- mask-image: var(--_vaadin-icon-clock);
12
- }
10
+ @layer base {
11
+ :host([opened]) {
12
+ pointer-events: auto;
13
+ }
13
14
 
14
- /* See https://github.com/vaadin/vaadin-time-picker/issues/145 */
15
- :host([dir='rtl']) [part='input-field'] {
16
- direction: ltr;
17
- }
15
+ [part='toggle-button']::before {
16
+ mask-image: var(--_vaadin-icon-clock);
17
+ }
18
+
19
+ /* See https://github.com/vaadin/vaadin-time-picker/issues/145 */
20
+ :host([dir='rtl']) [part='input-field'] {
21
+ direction: ltr;
22
+ }
18
23
 
19
- :host([dir='rtl']) [part='input-field'] ::slotted(input)::placeholder {
20
- direction: rtl;
21
- text-align: left;
24
+ :host([dir='rtl']) [part='input-field'] ::slotted(input)::placeholder {
25
+ direction: rtl;
26
+ text-align: left;
27
+ }
22
28
  }
23
29
  `;
@@ -6,6 +6,10 @@
6
6
  import { css } from 'lit';
7
7
 
8
8
  export const timePickerStyles = css`
9
+ :host([opened]) {
10
+ pointer-events: auto;
11
+ }
12
+
9
13
  /* See https://github.com/vaadin/vaadin-time-picker/issues/145 */
10
14
  :host([dir='rtl']) [part='input-field'] {
11
15
  direction: ltr;
@@ -6,17 +6,19 @@
6
6
  import { css } from 'lit';
7
7
 
8
8
  export const timePickerOverlayStyles = css`
9
- :host {
10
- --vaadin-item-checkmark-display: block;
11
- }
9
+ @layer base {
10
+ :host {
11
+ --vaadin-item-checkmark-display: block;
12
+ }
12
13
 
13
- #overlay {
14
- width: var(--vaadin-time-picker-overlay-width, var(--_vaadin-time-picker-overlay-default-width, auto));
15
- }
14
+ #overlay {
15
+ width: var(--vaadin-time-picker-overlay-width, var(--_vaadin-time-picker-overlay-default-width, auto));
16
+ }
16
17
 
17
- [part='content'] {
18
- display: flex;
19
- flex-direction: column;
20
- height: 100%;
18
+ [part='content'] {
19
+ display: flex;
20
+ flex-direction: column;
21
+ height: 100%;
22
+ }
21
23
  }
22
24
  `;
@@ -8,7 +8,8 @@ import { ComboBoxItemMixin } from '@vaadin/combo-box/src/vaadin-combo-box-item-m
8
8
  import { defineCustomElement } from '@vaadin/component-base/src/define.js';
9
9
  import { DirMixin } from '@vaadin/component-base/src/dir-mixin.js';
10
10
  import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
11
- import { itemStyles } from '@vaadin/item/src/vaadin-item-core-styles.js';
11
+ import { itemStyles } from '@vaadin/item/src/styles/vaadin-item-core-styles.js';
12
+ import { CSSInjectionMixin } from '@vaadin/vaadin-themable-mixin/css-injection-mixin.js';
12
13
  import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
13
14
 
14
15
  /**
@@ -38,7 +39,9 @@ import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mix
38
39
  * @mixes DirMixin
39
40
  * @private
40
41
  */
41
- export class TimePickerItem extends ComboBoxItemMixin(ThemableMixin(DirMixin(PolylitMixin(LitElement)))) {
42
+ export class TimePickerItem extends ComboBoxItemMixin(
43
+ CSSInjectionMixin(ThemableMixin(DirMixin(PolylitMixin(LitElement)))),
44
+ ) {
42
45
  static get is() {
43
46
  return 'vaadin-time-picker-item';
44
47
  }
@@ -56,6 +59,17 @@ export class TimePickerItem extends ComboBoxItemMixin(ThemableMixin(DirMixin(Pol
56
59
  </div>
57
60
  `;
58
61
  }
62
+
63
+ /**
64
+ * Override method from `ComboBoxItemMixin` to enforce
65
+ * `dir` attribute to be set to `ltr` on the item.
66
+ * @protected
67
+ * @override
68
+ */
69
+ _getHostDir() {
70
+ // See https://github.com/vaadin/vaadin-time-picker/issues/145
71
+ return 'ltr';
72
+ }
59
73
  }
60
74
 
61
75
  defineCustomElement(TimePickerItem);
@@ -8,7 +8,9 @@ import type { DelegateFocusMixinClass } from '@vaadin/a11y-base/src/delegate-foc
8
8
  import type { DisabledMixinClass } from '@vaadin/a11y-base/src/disabled-mixin.js';
9
9
  import type { FocusMixinClass } from '@vaadin/a11y-base/src/focus-mixin.js';
10
10
  import type { KeyboardMixinClass } from '@vaadin/a11y-base/src/keyboard-mixin.js';
11
+ import type { ComboBoxBaseMixinClass } from '@vaadin/combo-box/src/vaadin-combo-box-base-mixin.js';
11
12
  import type { DelegateStateMixinClass } from '@vaadin/component-base/src/delegate-state-mixin.js';
13
+ import type { OverlayClassMixinClass } from '@vaadin/component-base/src/overlay-class-mixin.js';
12
14
  import type { SlotStylesMixinClass } from '@vaadin/component-base/src/slot-styles-mixin.js';
13
15
  import type { ClearButtonMixinClass } from '@vaadin/field-base/src/clear-button-mixin.js';
14
16
  import type { FieldMixinClass } from '@vaadin/field-base/src/field-mixin.js';
@@ -31,6 +33,7 @@ export interface TimePickerI18n {
31
33
  export declare function TimePickerMixin<T extends Constructor<HTMLElement>>(
32
34
  base: T,
33
35
  ): Constructor<ClearButtonMixinClass> &
36
+ Constructor<ComboBoxBaseMixinClass> &
34
37
  Constructor<DelegateFocusMixinClass> &
35
38
  Constructor<DelegateStateMixinClass> &
36
39
  Constructor<DisabledMixinClass> &
@@ -41,6 +44,7 @@ export declare function TimePickerMixin<T extends Constructor<HTMLElement>>(
41
44
  Constructor<InputMixinClass> &
42
45
  Constructor<KeyboardMixinClass> &
43
46
  Constructor<LabelMixinClass> &
47
+ Constructor<OverlayClassMixinClass> &
44
48
  Constructor<PatternMixinClass> &
45
49
  Constructor<SlotStylesMixinClass> &
46
50
  Constructor<TimePickerMixinClass> &
@@ -58,11 +62,6 @@ export declare class TimePickerMixinClass {
58
62
  */
59
63
  value: string;
60
64
 
61
- /**
62
- * True if the dropdown is open, false otherwise.
63
- */
64
- opened: boolean;
65
-
66
65
  /**
67
66
  * Minimum time allowed.
68
67
  *
@@ -101,19 +100,6 @@ export declare class TimePickerMixinClass {
101
100
  */
102
101
  step: number | null | undefined;
103
102
 
104
- /**
105
- * Set true to prevent the overlay from opening automatically.
106
- * @attr {boolean} auto-open-disabled
107
- */
108
- autoOpenDisabled: boolean | null | undefined;
109
-
110
- /**
111
- * A space-delimited list of CSS class names to set on the overlay element.
112
- *
113
- * @attr {string} overlay-class
114
- */
115
- overlayClass: string;
116
-
117
103
  /**
118
104
  * The object used to localize this component.
119
105
  * To change the default localization, replace the entire
@@ -144,14 +130,4 @@ export declare class TimePickerMixinClass {
144
130
  * to ensure the component works properly.
145
131
  */
146
132
  i18n: TimePickerI18n;
147
-
148
- /**
149
- * Opens the dropdown list.
150
- */
151
- open(): void;
152
-
153
- /**
154
- * Closes the dropdown list.
155
- */
156
- close(): void;
157
133
  }
@@ -3,6 +3,7 @@
3
3
  * Copyright (c) 2018 - 2025 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
+ import { ComboBoxBaseMixin } from '@vaadin/combo-box/src/vaadin-combo-box-base-mixin.js';
6
7
  import { TooltipController } from '@vaadin/component-base/src/tooltip-controller.js';
7
8
  import { InputControlMixin } from '@vaadin/field-base/src/input-control-mixin.js';
8
9
  import { InputController } from '@vaadin/field-base/src/input-controller.js';
@@ -26,7 +27,7 @@ const MAX_ALLOWED_TIME = '23:59:59.999';
26
27
  * @mixes PatternMixin
27
28
  */
28
29
  export const TimePickerMixin = (superClass) =>
29
- class TimePickerMixinClass extends PatternMixin(InputControlMixin(superClass)) {
30
+ class TimePickerMixinClass extends PatternMixin(ComboBoxBaseMixin(InputControlMixin(superClass))) {
30
31
  static get properties() {
31
32
  return {
32
33
  /**
@@ -45,17 +46,6 @@ export const TimePickerMixin = (superClass) =>
45
46
  sync: true,
46
47
  },
47
48
 
48
- /**
49
- * True if the dropdown is open, false otherwise.
50
- */
51
- opened: {
52
- type: Boolean,
53
- notify: true,
54
- value: false,
55
- reflectToAttribute: true,
56
- sync: true,
57
- },
58
-
59
49
  /**
60
50
  * Minimum time allowed.
61
51
  *
@@ -107,24 +97,6 @@ export const TimePickerMixin = (superClass) =>
107
97
  sync: true,
108
98
  },
109
99
 
110
- /**
111
- * Set true to prevent the overlay from opening automatically.
112
- * @attr {boolean} auto-open-disabled
113
- */
114
- autoOpenDisabled: {
115
- type: Boolean,
116
- sync: true,
117
- },
118
-
119
- /**
120
- * A space-delimited list of CSS class names to set on the overlay element.
121
- *
122
- * @attr {string} overlay-class
123
- */
124
- overlayClass: {
125
- type: String,
126
- },
127
-
128
100
  /**
129
101
  * The object used to localize this component.
130
102
  * To change the default localization, replace the entire
@@ -169,12 +141,6 @@ export const TimePickerMixin = (superClass) =>
169
141
  observer: '__comboBoxValueChanged',
170
142
  },
171
143
 
172
- /** @private */
173
- __dropdownItems: {
174
- type: Array,
175
- sync: true,
176
- },
177
-
178
144
  /** @private */
179
145
  _inputContainer: {
180
146
  type: Object,
@@ -184,7 +150,9 @@ export const TimePickerMixin = (superClass) =>
184
150
 
185
151
  static get observers() {
186
152
  return [
187
- '__updateAriaAttributes(__dropdownItems, opened, inputElement)',
153
+ '_openedOrItemsChanged(opened, _dropdownItems)',
154
+ '_updateScroller(opened, _dropdownItems, _focusedIndex, _theme)',
155
+ '__updateAriaAttributes(_dropdownItems, opened, inputElement)',
188
156
  '__updateDropdownItems(i18n, min, max, step)',
189
157
  ];
190
158
  }
@@ -193,6 +161,15 @@ export const TimePickerMixin = (superClass) =>
193
161
  return [...super.constraints, 'min', 'max'];
194
162
  }
195
163
 
164
+ /**
165
+ * Tag name prefix used by `ComboBoxBaseMixin` for scroller and items.
166
+ * @protected
167
+ * @return {string}
168
+ */
169
+ get _tagNamePrefix() {
170
+ return 'vaadin-time-picker';
171
+ }
172
+
196
173
  /**
197
174
  * Used by `ClearButtonMixin` as a reference to the clear button element.
198
175
  * @protected
@@ -239,6 +216,7 @@ export const TimePickerMixin = (superClass) =>
239
216
  );
240
217
  this.addController(new LabelledInputController(this.inputElement, this._labelController));
241
218
  this._inputContainer = this.shadowRoot.querySelector('[part~="input-field"]');
219
+ this._toggleElement = this.$.toggleButton;
242
220
 
243
221
  this._tooltipController = new TooltipController(this);
244
222
  this._tooltipController.setShouldShow((timePicker) => !timePicker.opened);
@@ -247,47 +225,136 @@ export const TimePickerMixin = (superClass) =>
247
225
  this.addController(this._tooltipController);
248
226
  }
249
227
 
228
+ /** @protected */
229
+ updated(props) {
230
+ super.updated(props);
231
+
232
+ // Update selected item in the scroller
233
+ if (props.has('_comboBoxValue') && this._dropdownItems) {
234
+ this._scroller.selectedItem = this._dropdownItems.find((item) => item.value === this._comboBoxValue);
235
+ }
236
+ }
237
+
250
238
  /**
251
- * Override method inherited from `InputMixin` to forward the input to combo-box.
239
+ * Returns true if the current input value satisfies all constraints (if any).
240
+ * You can override this method for custom validations.
241
+ *
242
+ * @return {boolean} True if the value is valid
243
+ */
244
+ checkValidity() {
245
+ return !!(
246
+ this.inputElement.checkValidity() &&
247
+ (!this.value || this._timeAllowed(this.i18n.parseTime(this.value))) &&
248
+ (!this._comboBoxValue || this.i18n.parseTime(this._comboBoxValue))
249
+ );
250
+ }
251
+
252
+ /**
253
+ * Override method from `ComboBoxBaseMixin` to handle item label path.
252
254
  * @protected
253
255
  * @override
254
256
  */
255
- _inputElementChanged(input) {
256
- super._inputElementChanged(input);
257
+ _getItemLabel(item) {
258
+ return item ? item.label : '';
259
+ }
257
260
 
258
- if (input) {
259
- this.$.comboBox._setInputElement(input);
261
+ /** @private */
262
+ _updateScroller(opened, items, focusedIndex, theme) {
263
+ if (opened) {
264
+ this._scroller.style.maxHeight =
265
+ getComputedStyle(this).getPropertyValue(`--${this._tagNamePrefix}-overlay-max-height`) || '65vh';
260
266
  }
267
+
268
+ this._scroller.setProperties({
269
+ items: opened ? items : [],
270
+ opened,
271
+ focusedIndex,
272
+ theme,
273
+ });
274
+ }
275
+
276
+ /** @private */
277
+ _openedOrItemsChanged(opened, items) {
278
+ // Close the overlay if there are no items to display.
279
+ this._overlayOpened = opened && !!(items && items.length);
280
+ }
281
+
282
+ /**
283
+ * Override method from `ComboBoxBaseMixin` to commit value on overlay closing.
284
+ * @protected
285
+ * @override
286
+ */
287
+ _onClosed() {
288
+ this._commitValue();
289
+ }
290
+
291
+ /**
292
+ * Override method from `ComboBoxBaseMixin` to handle Escape pres..
293
+ * @protected
294
+ * @override
295
+ */
296
+ _onEscapeCancel() {
297
+ this._inputElementValue = this._comboBoxValue;
298
+ this._closeOrCommit();
261
299
  }
262
300
 
263
301
  /**
264
- * Opens the dropdown list.
302
+ * Override method from `ComboBoxBaseMixin` to implement clearing logic.
303
+ * @protected
304
+ * @override
305
+ */
306
+ _onClearAction() {
307
+ this._comboBoxValue = '';
308
+ this._inputElementValue = '';
309
+
310
+ this.__commitValueChange();
311
+ }
312
+
313
+ /**
314
+ * Override method from `ComboBoxBaseMixin` to implement value commit logic.
315
+ * @protected
316
+ * @override
265
317
  */
266
- open() {
267
- if (!this.disabled && !this.readonly) {
268
- this.opened = true;
318
+ _commitValue() {
319
+ if (this._focusedIndex > -1) {
320
+ // Commit value based on focused index
321
+ const focusedItem = this._dropdownItems[this._focusedIndex];
322
+ const itemValue = this._getItemLabel(focusedItem);
323
+ this._inputElementValue = itemValue;
324
+ this._comboBoxValue = itemValue;
325
+ this._focusedIndex = -1;
326
+ } else if (this._inputElementValue === '' || this._inputElementValue === undefined) {
327
+ this._comboBoxValue = '';
328
+ } else {
329
+ this._comboBoxValue = this._inputElementValue;
269
330
  }
331
+
332
+ this.__commitValueChange();
333
+
334
+ this._clearSelectionRange();
270
335
  }
271
336
 
272
337
  /**
273
- * Closes the dropdown list.
338
+ * Override method from `ComboBoxBaseMixin` to handle loading.
339
+ * @protected
340
+ * @override
274
341
  */
275
- close() {
276
- this.opened = false;
342
+ _closeOrCommit() {
343
+ if (!this.opened) {
344
+ this._commitValue();
345
+ } else {
346
+ this.close();
347
+ }
277
348
  }
278
349
 
279
350
  /**
280
- * Returns true if the current input value satisfies all constraints (if any).
281
- * You can override this method for custom validations.
282
- *
283
- * @return {boolean} True if the value is valid
351
+ * Override method from `ComboBoxBaseMixin` to handle reverting value.
352
+ * @protected
353
+ * @override
284
354
  */
285
- checkValidity() {
286
- return !!(
287
- this.inputElement.checkValidity() &&
288
- (!this.value || this._timeAllowed(this.i18n.parseTime(this.value))) &&
289
- (!this._comboBoxValue || this.i18n.parseTime(this._comboBoxValue))
290
- );
355
+ _revertInputValue() {
356
+ this._inputElementValue = this._comboBoxValue;
357
+ this._clearSelectionRange();
291
358
  }
292
359
 
293
360
  /**
@@ -321,7 +388,7 @@ export const TimePickerMixin = (superClass) =>
321
388
  _onKeyDown(e) {
322
389
  super._onKeyDown(e);
323
390
 
324
- if (this.readonly || this.disabled || this.__dropdownItems.length) {
391
+ if (this.readonly || this.disabled || this._dropdownItems.length) {
325
392
  return;
326
393
  }
327
394
 
@@ -334,17 +401,6 @@ export const TimePickerMixin = (superClass) =>
334
401
  }
335
402
  }
336
403
 
337
- /**
338
- * Override an event listener from `KeyboardMixin`.
339
- * Do not call `super` in order to override clear
340
- * button logic defined in `InputControlMixin`.
341
- * @param {Event} event
342
- * @protected
343
- */
344
- _onEscape() {
345
- // Do nothing, the internal combo-box handles Escape.
346
- }
347
-
348
404
  /** @private */
349
405
  __onArrowPressWithStep(step) {
350
406
  const objWithStep = this.__addStep(this.__getMsec(this.__memoValue), step, true);
@@ -458,7 +514,7 @@ export const TimePickerMixin = (superClass) =>
458
514
  const maxTimeObj = validateTime(parseISOTime(max || MAX_ALLOWED_TIME), step);
459
515
  const maxSec = this.__getSec(maxTimeObj);
460
516
 
461
- this.__dropdownItems = this.__generateDropdownList(minSec, maxSec, step);
517
+ this._dropdownItems = this.__generateDropdownList(minSec, maxSec, step);
462
518
 
463
519
  if (step !== this.__oldStep) {
464
520
  this.__oldStep = step;
@@ -574,12 +630,6 @@ export const TimePickerMixin = (superClass) =>
574
630
  }
575
631
  }
576
632
 
577
- /** @private */
578
- __onComboBoxChange(event) {
579
- event.stopPropagation();
580
- this.__commitValueChange();
581
- }
582
-
583
633
  /** @private */
584
634
  __updateValue(obj) {
585
635
  const timeString = formatISOTime(validateTime(obj, this.step)) || '';
@@ -594,6 +644,7 @@ export const TimePickerMixin = (superClass) =>
594
644
  /** @private */
595
645
  __updateInputValue(obj) {
596
646
  const timeString = this.i18n.formatTime(validateTime(obj, this.step)) || '';
647
+ this._inputElementValue = timeString;
597
648
  this._comboBoxValue = timeString;
598
649
  }
599
650
 
@@ -615,22 +666,44 @@ export const TimePickerMixin = (superClass) =>
615
666
  }
616
667
 
617
668
  /**
618
- * Override method inherited from `InputControlMixin`.
669
+ * Override method from `ComboBoxBaseMixin` to deselect
670
+ * dropdown item by requesting content update on clear.
671
+ * @param {Event} event
619
672
  * @protected
620
673
  */
621
- _onClearButtonClick() {}
674
+ _onClearButtonClick(event) {
675
+ event.stopPropagation();
676
+ super._onClearButtonClick(event);
677
+
678
+ if (this.opened) {
679
+ this._scroller.requestContentUpdate();
680
+ }
681
+ }
622
682
 
623
683
  /**
624
- * Override method inherited from `InputConstraintsMixin`.
684
+ * @param {Event} event
625
685
  * @protected
626
686
  */
627
- _onChange() {}
687
+ _onHostClick(event) {
688
+ const path = event.composedPath();
689
+
690
+ // Open dropdown only when clicking on the label or input field
691
+ if (path.includes(this._labelNode) || path.includes(this._inputContainer)) {
692
+ super._onHostClick(event);
693
+ }
694
+ }
628
695
 
629
696
  /**
630
- * Override method inherited from `InputMixin`.
697
+ * Override an event listener from `InputMixin`.
698
+ * @param {!Event} event
631
699
  * @protected
700
+ * @override
632
701
  */
633
- _onInput() {}
702
+ _onChange(event) {
703
+ // Suppress the native change event fired on the native input.
704
+ // We use `__commitValueChange` to fire a custom event.
705
+ event.stopPropagation();
706
+ }
634
707
 
635
708
  /**
636
709
  * Fired when the user commits a value change.
@@ -8,8 +8,9 @@ import { ComboBoxOverlayMixin } from '@vaadin/combo-box/src/vaadin-combo-box-ove
8
8
  import { defineCustomElement } from '@vaadin/component-base/src/define.js';
9
9
  import { DirMixin } from '@vaadin/component-base/src/dir-mixin.js';
10
10
  import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
11
+ import { overlayStyles } from '@vaadin/overlay/src/styles/vaadin-overlay-core-styles.js';
11
12
  import { OverlayMixin } from '@vaadin/overlay/src/vaadin-overlay-mixin.js';
12
- import { overlayStyles } from '@vaadin/overlay/src/vaadin-overlay-styles.js';
13
+ import { CSSInjectionMixin } from '@vaadin/vaadin-themable-mixin/css-injection-mixin.js';
13
14
  import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
14
15
  import { timePickerOverlayStyles } from './styles/vaadin-time-picker-overlay-core-styles.js';
15
16
 
@@ -24,7 +25,7 @@ import { timePickerOverlayStyles } from './styles/vaadin-time-picker-overlay-cor
24
25
  * @private
25
26
  */
26
27
  export class TimePickerOverlay extends ComboBoxOverlayMixin(
27
- OverlayMixin(DirMixin(ThemableMixin(PolylitMixin(LitElement)))),
28
+ OverlayMixin(DirMixin(CSSInjectionMixin(ThemableMixin(PolylitMixin(LitElement))))),
28
29
  ) {
29
30
  static get is() {
30
31
  return 'vaadin-time-picker-overlay';
@@ -45,6 +46,17 @@ export class TimePickerOverlay extends ComboBoxOverlayMixin(
45
46
  </div>
46
47
  `;
47
48
  }
49
+
50
+ /**
51
+ * Override method from `ComboBoxOverlayMixin` to enforce
52
+ * `dir` attribute to be set to `ltr` on the overlay.
53
+ * @protected
54
+ * @override
55
+ */
56
+ _getHostDir() {
57
+ // See https://github.com/vaadin/vaadin-time-picker/issues/145
58
+ return 'ltr';
59
+ }
48
60
  }
49
61
 
50
62
  defineCustomElement(TimePickerOverlay);
@@ -7,6 +7,7 @@ import { html, LitElement } from 'lit';
7
7
  import { ComboBoxScrollerMixin } from '@vaadin/combo-box/src/vaadin-combo-box-scroller-mixin.js';
8
8
  import { defineCustomElement } from '@vaadin/component-base/src/define.js';
9
9
  import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
10
+ import { CSSInjectionMixin } from '@vaadin/vaadin-themable-mixin/css-injection-mixin.js';
10
11
  import { timePickerScrollerStyles } from './styles/vaadin-time-picker-scroller-core-styles.js';
11
12
 
12
13
  /**
@@ -17,7 +18,7 @@ import { timePickerScrollerStyles } from './styles/vaadin-time-picker-scroller-c
17
18
  * @mixes ComboBoxScrollerMixin
18
19
  * @private
19
20
  */
20
- export class TimePickerScroller extends ComboBoxScrollerMixin(PolylitMixin(LitElement)) {
21
+ export class TimePickerScroller extends ComboBoxScrollerMixin(CSSInjectionMixin(PolylitMixin(LitElement))) {
21
22
  static get is() {
22
23
  return 'vaadin-time-picker-scroller';
23
24
  }
@@ -93,7 +93,6 @@ export interface TimePickerEventMap extends HTMLElementEventMap, TimePickerCusto
93
93
  * In addition to `<vaadin-time-picker>` itself, the following internal
94
94
  * components are themable:
95
95
  *
96
- * - `<vaadin-time-picker-combo-box>` - an internal version of [`<vaadin-combo-box>`](#/elements/vaadin-combo-box).
97
96
  * - `<vaadin-time-picker-overlay>` - has the same API as [`<vaadin-overlay>`](#/elements/vaadin-overlay).
98
97
  * - `<vaadin-time-picker-item>` - has the same API as [`<vaadin-item>`](#/elements/vaadin-item).
99
98
  * - [`<vaadin-input-container>`](#/elements/vaadin-input-container) - an internal element wrapping the input.
@@ -4,13 +4,16 @@
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import '@vaadin/input-container/src/vaadin-input-container.js';
7
- import './vaadin-time-picker-combo-box.js';
7
+ import './vaadin-time-picker-item.js';
8
+ import './vaadin-time-picker-overlay.js';
9
+ import './vaadin-time-picker-scroller.js';
8
10
  import { html, LitElement } from 'lit';
9
11
  import { ifDefined } from 'lit/directives/if-defined.js';
10
12
  import { defineCustomElement } from '@vaadin/component-base/src/define.js';
11
13
  import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
12
14
  import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
13
15
  import { inputFieldShared } from '@vaadin/field-base/src/styles/input-field-shared-styles.js';
16
+ import { CSSInjectionMixin } from '@vaadin/vaadin-themable-mixin/css-injection-mixin.js';
14
17
  import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
15
18
  import { timePickerStyles } from './styles/vaadin-time-picker-core-styles.js';
16
19
  import { TimePickerMixin } from './vaadin-time-picker-mixin.js';
@@ -57,7 +60,6 @@ import { TimePickerMixin } from './vaadin-time-picker-mixin.js';
57
60
  * In addition to `<vaadin-time-picker>` itself, the following internal
58
61
  * components are themable:
59
62
  *
60
- * - `<vaadin-time-picker-combo-box>` - an internal version of [`<vaadin-combo-box>`](#/elements/vaadin-combo-box).
61
63
  * - `<vaadin-time-picker-overlay>` - has the same API as [`<vaadin-overlay>`](#/elements/vaadin-overlay).
62
64
  * - `<vaadin-time-picker-item>` - has the same API as [`<vaadin-item>`](#/elements/vaadin-item).
63
65
  * - [`<vaadin-input-container>`](#/elements/vaadin-input-container) - an internal element wrapping the input.
@@ -95,7 +97,7 @@ import { TimePickerMixin } from './vaadin-time-picker-mixin.js';
95
97
  * @mixes ThemableMixin
96
98
  * @mixes TimePickerMixin
97
99
  */
98
- class TimePicker extends TimePickerMixin(ThemableMixin(ElementMixin(PolylitMixin(LitElement)))) {
100
+ class TimePicker extends TimePickerMixin(CSSInjectionMixin(ThemableMixin(ElementMixin(PolylitMixin(LitElement))))) {
99
101
  static get is() {
100
102
  return 'vaadin-time-picker';
101
103
  }
@@ -113,35 +115,18 @@ class TimePicker extends TimePickerMixin(ThemableMixin(ElementMixin(PolylitMixin
113
115
  <span part="required-indicator" aria-hidden="true" @click="${this.focus}"></span>
114
116
  </div>
115
117
 
116
- <vaadin-time-picker-combo-box
117
- id="comboBox"
118
- .filteredItems="${this.__dropdownItems}"
119
- .value="${this._comboBoxValue}"
120
- .opened="${this.opened}"
121
- .disabled="${this.disabled}"
118
+ <vaadin-input-container
119
+ part="input-field"
122
120
  .readonly="${this.readonly}"
123
- .clearButtonVisible="${this.clearButtonVisible}"
124
- .autoOpenDisabled="${this.autoOpenDisabled}"
125
- .overlayClass="${this.overlayClass}"
126
- .positionTarget="${this._inputContainer}"
121
+ .disabled="${this.disabled}"
122
+ .invalid="${this.invalid}"
127
123
  theme="${ifDefined(this._theme)}"
128
- @value-changed="${this.__onComboBoxValueChanged}"
129
- @opened-changed="${this.__onComboBoxOpenedChanged}"
130
- @change="${this.__onComboBoxChange}"
131
124
  >
132
- <vaadin-input-container
133
- part="input-field"
134
- .readonly="${this.readonly}"
135
- .disabled="${this.disabled}"
136
- .invalid="${this.invalid}"
137
- theme="${ifDefined(this._theme)}"
138
- >
139
- <slot name="prefix" slot="prefix"></slot>
140
- <slot name="input"></slot>
141
- <div id="clearButton" part="clear-button" slot="suffix" aria-hidden="true"></div>
142
- <div id="toggleButton" class="toggle-button" part="toggle-button" slot="suffix" aria-hidden="true"></div>
143
- </vaadin-input-container>
144
- </vaadin-time-picker-combo-box>
125
+ <slot name="prefix" slot="prefix"></slot>
126
+ <slot name="input"></slot>
127
+ <div id="clearButton" part="clear-button" slot="suffix" aria-hidden="true"></div>
128
+ <div id="toggleButton" part="toggle-button" slot="suffix" aria-hidden="true"></div>
129
+ </vaadin-input-container>
145
130
 
146
131
  <div part="helper-text">
147
132
  <slot name="helper"></slot>
@@ -151,18 +136,17 @@ class TimePicker extends TimePickerMixin(ThemableMixin(ElementMixin(PolylitMixin
151
136
  <slot name="error-message"></slot>
152
137
  </div>
153
138
  </div>
154
- <slot name="tooltip"></slot>
155
- `;
156
- }
157
139
 
158
- /** @private */
159
- __onComboBoxOpenedChanged(event) {
160
- this.opened = event.detail.value;
161
- }
140
+ <vaadin-time-picker-overlay
141
+ id="overlay"
142
+ .opened="${this._overlayOpened}"
143
+ theme="${ifDefined(this._theme)}"
144
+ .positionTarget="${this._inputContainer}"
145
+ no-vertical-overlap
146
+ ></vaadin-time-picker-overlay>
162
147
 
163
- /** @private */
164
- __onComboBoxValueChanged(event) {
165
- this._comboBoxValue = event.detail.value;
148
+ <slot name="tooltip"></slot>
149
+ `;
166
150
  }
167
151
  }
168
152
 
package/web-types.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/time-picker",
4
- "version": "25.0.0-alpha2",
4
+ "version": "25.0.0-alpha4",
5
5
  "description-markup": "markdown",
6
6
  "contributions": {
7
7
  "html": {
8
8
  "elements": [
9
9
  {
10
10
  "name": "vaadin-time-picker",
11
- "description": "`<vaadin-time-picker>` is a Web Component providing a time-selection field.\n\n```html\n<vaadin-time-picker></vaadin-time-picker>\n```\n```js\ntimePicker.value = '14:30';\n```\n\nWhen the selected `value` is changed, a `value-changed` event is triggered.\n\n### Styling\n\nThe following custom properties are available for styling:\n\nCustom property | Description | Default\n-----------------------------------------|----------------------------|---------\n`--vaadin-field-default-width` | Default width of the field | `12em`\n`--vaadin-time-picker-overlay-width` | Width of the overlay | `auto`\n`--vaadin-time-picker-overlay-max-height`| Max height of the overlay | `65vh`\n\n`<vaadin-time-picker>` provides the same set of shadow DOM parts and state attributes as `<vaadin-text-field>`.\nSee [`<vaadin-text-field>`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha2/#/elements/vaadin-text-field) for the styling documentation.\n\nIn addition to `<vaadin-text-field>` parts, the following parts are available for theming:\n\nPart name | Description\n----------------|----------------\n`toggle-button` | The toggle button\n\nIn addition to `<vaadin-text-field>` state attributes, the following state attributes are available for theming:\n\nAttribute | Description\n----------|------------------------------------------\n`opened` | Set when the time-picker dropdown is open\n\n### Internal components\n\nIn addition to `<vaadin-time-picker>` itself, the following internal\ncomponents are themable:\n\n- `<vaadin-time-picker-combo-box>` - an internal version of [`<vaadin-combo-box>`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha2/#/elements/vaadin-combo-box).\n- `<vaadin-time-picker-overlay>` - has the same API as [`<vaadin-overlay>`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha2/#/elements/vaadin-overlay).\n- `<vaadin-time-picker-item>` - has the same API as [`<vaadin-item>`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha2/#/elements/vaadin-item).\n- [`<vaadin-input-container>`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha2/#/elements/vaadin-input-container) - an internal element wrapping the input.\n\nNote: the `theme` attribute value set on `<vaadin-time-picker>` is\npropagated to the internal components listed above.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.\n\n### Change events\n\nDepending on the nature of the value change that the user attempts to commit e.g. by pressing Enter,\nthe component can fire either a `change` event or an `unparsable-change` event:\n\nValue change | Event\n:------------------------|:------------------\nempty => parsable | change\nempty => unparsable | unparsable-change\nparsable => empty | change\nparsable => parsable | change\nparsable => unparsable | change\nunparsable => empty | unparsable-change\nunparsable => parsable | change\nunparsable => unparsable | unparsable-change",
11
+ "description": "`<vaadin-time-picker>` is a Web Component providing a time-selection field.\n\n```html\n<vaadin-time-picker></vaadin-time-picker>\n```\n```js\ntimePicker.value = '14:30';\n```\n\nWhen the selected `value` is changed, a `value-changed` event is triggered.\n\n### Styling\n\nThe following custom properties are available for styling:\n\nCustom property | Description | Default\n-----------------------------------------|----------------------------|---------\n`--vaadin-field-default-width` | Default width of the field | `12em`\n`--vaadin-time-picker-overlay-width` | Width of the overlay | `auto`\n`--vaadin-time-picker-overlay-max-height`| Max height of the overlay | `65vh`\n\n`<vaadin-time-picker>` provides the same set of shadow DOM parts and state attributes as `<vaadin-text-field>`.\nSee [`<vaadin-text-field>`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha4/#/elements/vaadin-text-field) for the styling documentation.\n\nIn addition to `<vaadin-text-field>` parts, the following parts are available for theming:\n\nPart name | Description\n----------------|----------------\n`toggle-button` | The toggle button\n\nIn addition to `<vaadin-text-field>` state attributes, the following state attributes are available for theming:\n\nAttribute | Description\n----------|------------------------------------------\n`opened` | Set when the time-picker dropdown is open\n\n### Internal components\n\nIn addition to `<vaadin-time-picker>` itself, the following internal\ncomponents are themable:\n\n- `<vaadin-time-picker-overlay>` - has the same API as [`<vaadin-overlay>`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha4/#/elements/vaadin-overlay).\n- `<vaadin-time-picker-item>` - has the same API as [`<vaadin-item>`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha4/#/elements/vaadin-item).\n- [`<vaadin-input-container>`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha4/#/elements/vaadin-input-container) - an internal element wrapping the input.\n\nNote: the `theme` attribute value set on `<vaadin-time-picker>` is\npropagated to the internal components listed above.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.\n\n### Change events\n\nDepending on the nature of the value change that the user attempts to commit e.g. by pressing Enter,\nthe component can fire either a `change` event or an `unparsable-change` event:\n\nValue change | Event\n:------------------------|:------------------\nempty => parsable | change\nempty => unparsable | unparsable-change\nparsable => empty | change\nparsable => parsable | change\nparsable => unparsable | change\nunparsable => empty | unparsable-change\nunparsable => parsable | change\nunparsable => unparsable | unparsable-change",
12
12
  "attributes": [
13
13
  {
14
14
  "name": "disabled",
@@ -217,17 +217,6 @@
217
217
  ]
218
218
  }
219
219
  },
220
- {
221
- "name": "opened",
222
- "description": "True if the dropdown is open, false otherwise.",
223
- "value": {
224
- "type": [
225
- "boolean",
226
- "null",
227
- "undefined"
228
- ]
229
- }
230
- },
231
220
  {
232
221
  "name": "min",
233
222
  "description": "Minimum time allowed.\n\nSupported time formats are in ISO 8601:\n- `hh:mm`\n- `hh:mm:ss`\n- `hh:mm:ss.fff`",
@@ -257,28 +246,6 @@
257
246
  ]
258
247
  }
259
248
  },
260
- {
261
- "name": "auto-open-disabled",
262
- "description": "Set true to prevent the overlay from opening automatically.",
263
- "value": {
264
- "type": [
265
- "boolean",
266
- "null",
267
- "undefined"
268
- ]
269
- }
270
- },
271
- {
272
- "name": "overlay-class",
273
- "description": "A space-delimited list of CSS class names to set on the overlay element.",
274
- "value": {
275
- "type": [
276
- "string",
277
- "null",
278
- "undefined"
279
- ]
280
- }
281
- },
282
249
  {
283
250
  "name": "theme",
284
251
  "description": "The theme variants to apply to the component.",
@@ -500,17 +467,6 @@
500
467
  ]
501
468
  }
502
469
  },
503
- {
504
- "name": "opened",
505
- "description": "True if the dropdown is open, false otherwise.",
506
- "value": {
507
- "type": [
508
- "boolean",
509
- "null",
510
- "undefined"
511
- ]
512
- }
513
- },
514
470
  {
515
471
  "name": "min",
516
472
  "description": "Minimum time allowed.\n\nSupported time formats are in ISO 8601:\n- `hh:mm`\n- `hh:mm:ss`\n- `hh:mm:ss.fff`",
@@ -540,28 +496,6 @@
540
496
  ]
541
497
  }
542
498
  },
543
- {
544
- "name": "autoOpenDisabled",
545
- "description": "Set true to prevent the overlay from opening automatically.",
546
- "value": {
547
- "type": [
548
- "boolean",
549
- "null",
550
- "undefined"
551
- ]
552
- }
553
- },
554
- {
555
- "name": "overlayClass",
556
- "description": "A space-delimited list of CSS class names to set on the overlay element.",
557
- "value": {
558
- "type": [
559
- "string",
560
- "null",
561
- "undefined"
562
- ]
563
- }
564
- },
565
499
  {
566
500
  "name": "i18n",
567
501
  "description": "The object used to localize this component.\nTo change the default localization, replace the entire\n_i18n_ object or just the property you want to modify.\n\nThe object has the following JSON structure:\n\n```\n{\n // A function to format given `Object` as\n // time string. Object is in the format `{ hours: ..., minutes: ..., seconds: ..., milliseconds: ... }`\n formatTime: (time) => {\n // returns a string representation of the given\n // object in `hh` / 'hh:mm' / 'hh:mm:ss' / 'hh:mm:ss.fff' - formats\n },\n\n // A function to parse the given text to an `Object` in the format\n // `{ hours: ..., minutes: ..., seconds: ..., milliseconds: ... }`.\n // Must properly parse (at least) text\n // formatted by `formatTime`.\n parseTime: text => {\n // Parses a string in object/string that can be formatted by`formatTime`.\n }\n}\n```\n\nBoth `formatTime` and `parseTime` need to be implemented\nto ensure the component works properly.",
@@ -592,10 +526,6 @@
592
526
  {
593
527
  "name": "value-changed",
594
528
  "description": "Fired when the `value` property changes."
595
- },
596
- {
597
- "name": "opened-changed",
598
- "description": "Fired when the `opened` property changes."
599
529
  }
600
530
  ]
601
531
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/time-picker",
4
- "version": "25.0.0-alpha2",
4
+ "version": "25.0.0-alpha4",
5
5
  "description-markup": "markdown",
6
6
  "framework": "lit",
7
7
  "framework-config": {
@@ -16,7 +16,7 @@
16
16
  "elements": [
17
17
  {
18
18
  "name": "vaadin-time-picker",
19
- "description": "`<vaadin-time-picker>` is a Web Component providing a time-selection field.\n\n```html\n<vaadin-time-picker></vaadin-time-picker>\n```\n```js\ntimePicker.value = '14:30';\n```\n\nWhen the selected `value` is changed, a `value-changed` event is triggered.\n\n### Styling\n\nThe following custom properties are available for styling:\n\nCustom property | Description | Default\n-----------------------------------------|----------------------------|---------\n`--vaadin-field-default-width` | Default width of the field | `12em`\n`--vaadin-time-picker-overlay-width` | Width of the overlay | `auto`\n`--vaadin-time-picker-overlay-max-height`| Max height of the overlay | `65vh`\n\n`<vaadin-time-picker>` provides the same set of shadow DOM parts and state attributes as `<vaadin-text-field>`.\nSee [`<vaadin-text-field>`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha2/#/elements/vaadin-text-field) for the styling documentation.\n\nIn addition to `<vaadin-text-field>` parts, the following parts are available for theming:\n\nPart name | Description\n----------------|----------------\n`toggle-button` | The toggle button\n\nIn addition to `<vaadin-text-field>` state attributes, the following state attributes are available for theming:\n\nAttribute | Description\n----------|------------------------------------------\n`opened` | Set when the time-picker dropdown is open\n\n### Internal components\n\nIn addition to `<vaadin-time-picker>` itself, the following internal\ncomponents are themable:\n\n- `<vaadin-time-picker-combo-box>` - an internal version of [`<vaadin-combo-box>`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha2/#/elements/vaadin-combo-box).\n- `<vaadin-time-picker-overlay>` - has the same API as [`<vaadin-overlay>`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha2/#/elements/vaadin-overlay).\n- `<vaadin-time-picker-item>` - has the same API as [`<vaadin-item>`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha2/#/elements/vaadin-item).\n- [`<vaadin-input-container>`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha2/#/elements/vaadin-input-container) - an internal element wrapping the input.\n\nNote: the `theme` attribute value set on `<vaadin-time-picker>` is\npropagated to the internal components listed above.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.\n\n### Change events\n\nDepending on the nature of the value change that the user attempts to commit e.g. by pressing Enter,\nthe component can fire either a `change` event or an `unparsable-change` event:\n\nValue change | Event\n:------------------------|:------------------\nempty => parsable | change\nempty => unparsable | unparsable-change\nparsable => empty | change\nparsable => parsable | change\nparsable => unparsable | change\nunparsable => empty | unparsable-change\nunparsable => parsable | change\nunparsable => unparsable | unparsable-change",
19
+ "description": "`<vaadin-time-picker>` is a Web Component providing a time-selection field.\n\n```html\n<vaadin-time-picker></vaadin-time-picker>\n```\n```js\ntimePicker.value = '14:30';\n```\n\nWhen the selected `value` is changed, a `value-changed` event is triggered.\n\n### Styling\n\nThe following custom properties are available for styling:\n\nCustom property | Description | Default\n-----------------------------------------|----------------------------|---------\n`--vaadin-field-default-width` | Default width of the field | `12em`\n`--vaadin-time-picker-overlay-width` | Width of the overlay | `auto`\n`--vaadin-time-picker-overlay-max-height`| Max height of the overlay | `65vh`\n\n`<vaadin-time-picker>` provides the same set of shadow DOM parts and state attributes as `<vaadin-text-field>`.\nSee [`<vaadin-text-field>`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha4/#/elements/vaadin-text-field) for the styling documentation.\n\nIn addition to `<vaadin-text-field>` parts, the following parts are available for theming:\n\nPart name | Description\n----------------|----------------\n`toggle-button` | The toggle button\n\nIn addition to `<vaadin-text-field>` state attributes, the following state attributes are available for theming:\n\nAttribute | Description\n----------|------------------------------------------\n`opened` | Set when the time-picker dropdown is open\n\n### Internal components\n\nIn addition to `<vaadin-time-picker>` itself, the following internal\ncomponents are themable:\n\n- `<vaadin-time-picker-overlay>` - has the same API as [`<vaadin-overlay>`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha4/#/elements/vaadin-overlay).\n- `<vaadin-time-picker-item>` - has the same API as [`<vaadin-item>`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha4/#/elements/vaadin-item).\n- [`<vaadin-input-container>`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha4/#/elements/vaadin-input-container) - an internal element wrapping the input.\n\nNote: the `theme` attribute value set on `<vaadin-time-picker>` is\npropagated to the internal components listed above.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.\n\n### Change events\n\nDepending on the nature of the value change that the user attempts to commit e.g. by pressing Enter,\nthe component can fire either a `change` event or an `unparsable-change` event:\n\nValue change | Event\n:------------------------|:------------------\nempty => parsable | change\nempty => unparsable | unparsable-change\nparsable => empty | change\nparsable => parsable | change\nparsable => unparsable | change\nunparsable => empty | unparsable-change\nunparsable => parsable | change\nunparsable => unparsable | unparsable-change",
20
20
  "extension": true,
21
21
  "attributes": [
22
22
  {
@@ -75,20 +75,6 @@
75
75
  "kind": "expression"
76
76
  }
77
77
  },
78
- {
79
- "name": "?opened",
80
- "description": "True if the dropdown is open, false otherwise.",
81
- "value": {
82
- "kind": "expression"
83
- }
84
- },
85
- {
86
- "name": "?autoOpenDisabled",
87
- "description": "Set true to prevent the overlay from opening automatically.",
88
- "value": {
89
- "kind": "expression"
90
- }
91
- },
92
78
  {
93
79
  "name": ".label",
94
80
  "description": "The label text for the input node.\nWhen no light dom defined via [slot=label], this value will be used.",
@@ -187,13 +173,6 @@
187
173
  "kind": "expression"
188
174
  }
189
175
  },
190
- {
191
- "name": ".overlayClass",
192
- "description": "A space-delimited list of CSS class names to set on the overlay element.",
193
- "value": {
194
- "kind": "expression"
195
- }
196
- },
197
176
  {
198
177
  "name": ".i18n",
199
178
  "description": "The object used to localize this component.\nTo change the default localization, replace the entire\n_i18n_ object or just the property you want to modify.\n\nThe object has the following JSON structure:\n\n```\n{\n // A function to format given `Object` as\n // time string. Object is in the format `{ hours: ..., minutes: ..., seconds: ..., milliseconds: ... }`\n formatTime: (time) => {\n // returns a string representation of the given\n // object in `hh` / 'hh:mm' / 'hh:mm:ss' / 'hh:mm:ss.fff' - formats\n },\n\n // A function to parse the given text to an `Object` in the format\n // `{ hours: ..., minutes: ..., seconds: ..., milliseconds: ... }`.\n // Must properly parse (at least) text\n // formatted by `formatTime`.\n parseTime: text => {\n // Parses a string in object/string that can be formatted by`formatTime`.\n }\n}\n```\n\nBoth `formatTime` and `parseTime` need to be implemented\nto ensure the component works properly.",
@@ -235,13 +214,6 @@
235
214
  "value": {
236
215
  "kind": "expression"
237
216
  }
238
- },
239
- {
240
- "name": "@opened-changed",
241
- "description": "Fired when the `opened` property changes.",
242
- "value": {
243
- "kind": "expression"
244
- }
245
217
  }
246
218
  ]
247
219
  }
@@ -1,92 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright (c) 2018 - 2025 Vaadin Ltd.
4
- * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
- */
6
- import './vaadin-time-picker-item.js';
7
- import './vaadin-time-picker-overlay.js';
8
- import './vaadin-time-picker-scroller.js';
9
- import { css, html, LitElement } from 'lit';
10
- import { ifDefined } from 'lit/directives/if-defined.js';
11
- import { ComboBoxMixin } from '@vaadin/combo-box/src/vaadin-combo-box-mixin.js';
12
- import { defineCustomElement } from '@vaadin/component-base/src/define.js';
13
- import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
14
- import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
15
-
16
- /**
17
- * An element used internally by `<vaadin-time-picker>`. Not intended to be used separately.
18
- *
19
- * @customElement
20
- * @extends HTMLElement
21
- * @mixes ComboBoxMixin
22
- * @mixes ThemableMixin
23
- * @private
24
- */
25
- class TimePickerComboBox extends ComboBoxMixin(ThemableMixin(PolylitMixin(LitElement))) {
26
- static get is() {
27
- return 'vaadin-time-picker-combo-box';
28
- }
29
-
30
- static get styles() {
31
- return css`
32
- :host([opened]) {
33
- pointer-events: auto;
34
- }
35
- `;
36
- }
37
-
38
- static get properties() {
39
- return {
40
- positionTarget: {
41
- type: Object,
42
- },
43
- };
44
- }
45
-
46
- /**
47
- * Tag name prefix used by scroller and items.
48
- * @protected
49
- * @return {string}
50
- */
51
- get _tagNamePrefix() {
52
- return 'vaadin-time-picker';
53
- }
54
-
55
- /**
56
- * Reference to the clear button element.
57
- * @protected
58
- * @return {!HTMLElement}
59
- */
60
- get clearElement() {
61
- return this.querySelector('[part="clear-button"]');
62
- }
63
-
64
- /** @protected */
65
- render() {
66
- return html`
67
- <slot></slot>
68
-
69
- <vaadin-time-picker-overlay
70
- id="overlay"
71
- .opened="${this._overlayOpened}"
72
- ?loading="${this.loading}"
73
- theme="${ifDefined(this._theme)}"
74
- .positionTarget="${this.positionTarget}"
75
- .restoreFocusNode="${this.inputElement}"
76
- no-vertical-overlap
77
- ></vaadin-time-picker-overlay>
78
- `;
79
- }
80
- /** @protected */
81
- ready() {
82
- super.ready();
83
-
84
- this.allowCustomValue = true;
85
- this._toggleElement = this.querySelector('.toggle-button');
86
-
87
- // See https://github.com/vaadin/vaadin-time-picker/issues/145
88
- this.setAttribute('dir', 'ltr');
89
- }
90
- }
91
-
92
- defineCustomElement(TimePickerComboBox);