@vaadin/time-picker 25.0.0-alpha3 → 25.0.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaadin/time-picker",
3
- "version": "25.0.0-alpha3",
3
+ "version": "25.0.0-alpha5",
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-alpha3",
41
- "@vaadin/component-base": "25.0.0-alpha3",
42
- "@vaadin/field-base": "25.0.0-alpha3",
43
- "@vaadin/input-container": "25.0.0-alpha3",
44
- "@vaadin/item": "25.0.0-alpha3",
45
- "@vaadin/overlay": "25.0.0-alpha3",
46
- "@vaadin/vaadin-lumo-styles": "25.0.0-alpha3",
47
- "@vaadin/vaadin-themable-mixin": "25.0.0-alpha3",
40
+ "@vaadin/combo-box": "25.0.0-alpha5",
41
+ "@vaadin/component-base": "25.0.0-alpha5",
42
+ "@vaadin/field-base": "25.0.0-alpha5",
43
+ "@vaadin/input-container": "25.0.0-alpha5",
44
+ "@vaadin/item": "25.0.0-alpha5",
45
+ "@vaadin/overlay": "25.0.0-alpha5",
46
+ "@vaadin/vaadin-lumo-styles": "25.0.0-alpha5",
47
+ "@vaadin/vaadin-themable-mixin": "25.0.0-alpha5",
48
48
  "lit": "^3.0.0"
49
49
  },
50
50
  "devDependencies": {
51
- "@vaadin/chai-plugins": "25.0.0-alpha3",
52
- "@vaadin/test-runner-commands": "25.0.0-alpha3",
51
+ "@vaadin/chai-plugins": "25.0.0-alpha5",
52
+ "@vaadin/test-runner-commands": "25.0.0-alpha5",
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": "8367dd20a47f53ca5589ad349a8e286ec2673055"
60
+ "gitHead": "7dc87bb2a3cae81ed53259fa10b58f990d50c6fd"
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';
@@ -22,11 +23,12 @@ const MAX_ALLOWED_TIME = '23:59:59.999';
22
23
  * A mixin providing common time-picker functionality.
23
24
  *
24
25
  * @polymerMixin
26
+ * @mixes ComboBoxBaseMixin
25
27
  * @mixes InputControlMixin
26
28
  * @mixes PatternMixin
27
29
  */
28
30
  export const TimePickerMixin = (superClass) =>
29
- class TimePickerMixinClass extends PatternMixin(InputControlMixin(superClass)) {
31
+ class TimePickerMixinClass extends PatternMixin(ComboBoxBaseMixin(InputControlMixin(superClass))) {
30
32
  static get properties() {
31
33
  return {
32
34
  /**
@@ -45,17 +47,6 @@ export const TimePickerMixin = (superClass) =>
45
47
  sync: true,
46
48
  },
47
49
 
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
50
  /**
60
51
  * Minimum time allowed.
61
52
  *
@@ -107,24 +98,6 @@ export const TimePickerMixin = (superClass) =>
107
98
  sync: true,
108
99
  },
109
100
 
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
101
  /**
129
102
  * The object used to localize this component.
130
103
  * To change the default localization, replace the entire
@@ -169,12 +142,6 @@ export const TimePickerMixin = (superClass) =>
169
142
  observer: '__comboBoxValueChanged',
170
143
  },
171
144
 
172
- /** @private */
173
- __dropdownItems: {
174
- type: Array,
175
- sync: true,
176
- },
177
-
178
145
  /** @private */
179
146
  _inputContainer: {
180
147
  type: Object,
@@ -184,7 +151,9 @@ export const TimePickerMixin = (superClass) =>
184
151
 
185
152
  static get observers() {
186
153
  return [
187
- '__updateAriaAttributes(__dropdownItems, opened, inputElement)',
154
+ '_openedOrItemsChanged(opened, _dropdownItems)',
155
+ '_updateScroller(opened, _dropdownItems, _focusedIndex, _theme)',
156
+ '__updateAriaAttributes(_dropdownItems, opened, inputElement)',
188
157
  '__updateDropdownItems(i18n, min, max, step)',
189
158
  ];
190
159
  }
@@ -193,6 +162,15 @@ export const TimePickerMixin = (superClass) =>
193
162
  return [...super.constraints, 'min', 'max'];
194
163
  }
195
164
 
165
+ /**
166
+ * Tag name prefix used by `ComboBoxBaseMixin` for scroller and items.
167
+ * @protected
168
+ * @return {string}
169
+ */
170
+ get _tagNamePrefix() {
171
+ return 'vaadin-time-picker';
172
+ }
173
+
196
174
  /**
197
175
  * Used by `ClearButtonMixin` as a reference to the clear button element.
198
176
  * @protected
@@ -239,6 +217,7 @@ export const TimePickerMixin = (superClass) =>
239
217
  );
240
218
  this.addController(new LabelledInputController(this.inputElement, this._labelController));
241
219
  this._inputContainer = this.shadowRoot.querySelector('[part~="input-field"]');
220
+ this._toggleElement = this.$.toggleButton;
242
221
 
243
222
  this._tooltipController = new TooltipController(this);
244
223
  this._tooltipController.setShouldShow((timePicker) => !timePicker.opened);
@@ -247,47 +226,136 @@ export const TimePickerMixin = (superClass) =>
247
226
  this.addController(this._tooltipController);
248
227
  }
249
228
 
229
+ /** @protected */
230
+ updated(props) {
231
+ super.updated(props);
232
+
233
+ // Update selected item in the scroller
234
+ if (props.has('_comboBoxValue') && this._dropdownItems) {
235
+ this._scroller.selectedItem = this._dropdownItems.find((item) => item.value === this._comboBoxValue);
236
+ }
237
+ }
238
+
250
239
  /**
251
- * Override method inherited from `InputMixin` to forward the input to combo-box.
240
+ * Returns true if the current input value satisfies all constraints (if any).
241
+ * You can override this method for custom validations.
242
+ *
243
+ * @return {boolean} True if the value is valid
244
+ */
245
+ checkValidity() {
246
+ return !!(
247
+ this.inputElement.checkValidity() &&
248
+ (!this.value || this._timeAllowed(this.i18n.parseTime(this.value))) &&
249
+ (!this._comboBoxValue || this.i18n.parseTime(this._comboBoxValue))
250
+ );
251
+ }
252
+
253
+ /**
254
+ * Override method from `ComboBoxBaseMixin` to handle item label path.
252
255
  * @protected
253
256
  * @override
254
257
  */
255
- _inputElementChanged(input) {
256
- super._inputElementChanged(input);
258
+ _getItemLabel(item) {
259
+ return item ? item.label : '';
260
+ }
257
261
 
258
- if (input) {
259
- this.$.comboBox._setInputElement(input);
262
+ /** @private */
263
+ _updateScroller(opened, items, focusedIndex, theme) {
264
+ if (opened) {
265
+ this._scroller.style.maxHeight =
266
+ getComputedStyle(this).getPropertyValue(`--${this._tagNamePrefix}-overlay-max-height`) || '65vh';
260
267
  }
268
+
269
+ this._scroller.setProperties({
270
+ items: opened ? items : [],
271
+ opened,
272
+ focusedIndex,
273
+ theme,
274
+ });
275
+ }
276
+
277
+ /** @private */
278
+ _openedOrItemsChanged(opened, items) {
279
+ // Close the overlay if there are no items to display.
280
+ this._overlayOpened = opened && !!(items && items.length);
281
+ }
282
+
283
+ /**
284
+ * Override method from `ComboBoxBaseMixin` to commit value on overlay closing.
285
+ * @protected
286
+ * @override
287
+ */
288
+ _onClosed() {
289
+ this._commitValue();
290
+ }
291
+
292
+ /**
293
+ * Override method from `ComboBoxBaseMixin` to handle Escape pres..
294
+ * @protected
295
+ * @override
296
+ */
297
+ _onEscapeCancel() {
298
+ this._inputElementValue = this._comboBoxValue;
299
+ this._closeOrCommit();
261
300
  }
262
301
 
263
302
  /**
264
- * Opens the dropdown list.
303
+ * Override method from `ComboBoxBaseMixin` to implement clearing logic.
304
+ * @protected
305
+ * @override
306
+ */
307
+ _onClearAction() {
308
+ this._comboBoxValue = '';
309
+ this._inputElementValue = '';
310
+
311
+ this.__commitValueChange();
312
+ }
313
+
314
+ /**
315
+ * Override method from `ComboBoxBaseMixin` to implement value commit logic.
316
+ * @protected
317
+ * @override
265
318
  */
266
- open() {
267
- if (!this.disabled && !this.readonly) {
268
- this.opened = true;
319
+ _commitValue() {
320
+ if (this._focusedIndex > -1) {
321
+ // Commit value based on focused index
322
+ const focusedItem = this._dropdownItems[this._focusedIndex];
323
+ const itemValue = this._getItemLabel(focusedItem);
324
+ this._inputElementValue = itemValue;
325
+ this._comboBoxValue = itemValue;
326
+ this._focusedIndex = -1;
327
+ } else if (this._inputElementValue === '' || this._inputElementValue === undefined) {
328
+ this._comboBoxValue = '';
329
+ } else {
330
+ this._comboBoxValue = this._inputElementValue;
269
331
  }
332
+
333
+ this.__commitValueChange();
334
+
335
+ this._clearSelectionRange();
270
336
  }
271
337
 
272
338
  /**
273
- * Closes the dropdown list.
339
+ * Override method from `ComboBoxBaseMixin` to handle loading.
340
+ * @protected
341
+ * @override
274
342
  */
275
- close() {
276
- this.opened = false;
343
+ _closeOrCommit() {
344
+ if (!this.opened) {
345
+ this._commitValue();
346
+ } else {
347
+ this.close();
348
+ }
277
349
  }
278
350
 
279
351
  /**
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
352
+ * Override method from `ComboBoxBaseMixin` to handle reverting value.
353
+ * @protected
354
+ * @override
284
355
  */
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
- );
356
+ _revertInputValue() {
357
+ this._inputElementValue = this._comboBoxValue;
358
+ this._clearSelectionRange();
291
359
  }
292
360
 
293
361
  /**
@@ -321,7 +389,7 @@ export const TimePickerMixin = (superClass) =>
321
389
  _onKeyDown(e) {
322
390
  super._onKeyDown(e);
323
391
 
324
- if (this.readonly || this.disabled || this.__dropdownItems.length) {
392
+ if (this.readonly || this.disabled || this._dropdownItems.length) {
325
393
  return;
326
394
  }
327
395
 
@@ -334,17 +402,6 @@ export const TimePickerMixin = (superClass) =>
334
402
  }
335
403
  }
336
404
 
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
405
  /** @private */
349
406
  __onArrowPressWithStep(step) {
350
407
  const objWithStep = this.__addStep(this.__getMsec(this.__memoValue), step, true);
@@ -458,7 +515,7 @@ export const TimePickerMixin = (superClass) =>
458
515
  const maxTimeObj = validateTime(parseISOTime(max || MAX_ALLOWED_TIME), step);
459
516
  const maxSec = this.__getSec(maxTimeObj);
460
517
 
461
- this.__dropdownItems = this.__generateDropdownList(minSec, maxSec, step);
518
+ this._dropdownItems = this.__generateDropdownList(minSec, maxSec, step);
462
519
 
463
520
  if (step !== this.__oldStep) {
464
521
  this.__oldStep = step;
@@ -574,12 +631,6 @@ export const TimePickerMixin = (superClass) =>
574
631
  }
575
632
  }
576
633
 
577
- /** @private */
578
- __onComboBoxChange(event) {
579
- event.stopPropagation();
580
- this.__commitValueChange();
581
- }
582
-
583
634
  /** @private */
584
635
  __updateValue(obj) {
585
636
  const timeString = formatISOTime(validateTime(obj, this.step)) || '';
@@ -594,6 +645,7 @@ export const TimePickerMixin = (superClass) =>
594
645
  /** @private */
595
646
  __updateInputValue(obj) {
596
647
  const timeString = this.i18n.formatTime(validateTime(obj, this.step)) || '';
648
+ this._inputElementValue = timeString;
597
649
  this._comboBoxValue = timeString;
598
650
  }
599
651
 
@@ -615,22 +667,44 @@ export const TimePickerMixin = (superClass) =>
615
667
  }
616
668
 
617
669
  /**
618
- * Override method inherited from `InputControlMixin`.
670
+ * Override method from `ComboBoxBaseMixin` to deselect
671
+ * dropdown item by requesting content update on clear.
672
+ * @param {Event} event
619
673
  * @protected
620
674
  */
621
- _onClearButtonClick() {}
675
+ _onClearButtonClick(event) {
676
+ event.stopPropagation();
677
+ super._onClearButtonClick(event);
678
+
679
+ if (this.opened) {
680
+ this._scroller.requestContentUpdate();
681
+ }
682
+ }
622
683
 
623
684
  /**
624
- * Override method inherited from `InputConstraintsMixin`.
685
+ * @param {Event} event
625
686
  * @protected
626
687
  */
627
- _onChange() {}
688
+ _onHostClick(event) {
689
+ const path = event.composedPath();
690
+
691
+ // Open dropdown only when clicking on the label or input field
692
+ if (path.includes(this._labelNode) || path.includes(this._inputContainer)) {
693
+ super._onHostClick(event);
694
+ }
695
+ }
628
696
 
629
697
  /**
630
- * Override method inherited from `InputMixin`.
698
+ * Override an event listener from `InputMixin`.
699
+ * @param {!Event} event
631
700
  * @protected
701
+ * @override
632
702
  */
633
- _onInput() {}
703
+ _onChange(event) {
704
+ // Suppress the native change event fired on the native input.
705
+ // We use `__commitValueChange` to fire a custom event.
706
+ event.stopPropagation();
707
+ }
634
708
 
635
709
  /**
636
710
  * 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.