@vaadin/time-picker 25.0.0-alpha8 → 25.0.0-beta1
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 +13 -16
- package/src/styles/vaadin-time-picker-base-styles.js +2 -2
- package/src/vaadin-time-picker-item.js +1 -12
- package/src/vaadin-time-picker-mixin.d.ts +11 -10
- package/src/vaadin-time-picker-mixin.js +58 -63
- package/src/vaadin-time-picker-overlay.js +2 -29
- package/src/vaadin-time-picker-scroller.js +1 -1
- package/src/vaadin-time-picker.d.ts +30 -21
- package/src/vaadin-time-picker.js +34 -25
- package/vaadin-time-picker.js +1 -1
- package/web-types.json +20 -33
- package/web-types.lit.json +4 -11
- package/src/styles/vaadin-time-picker-core-styles.d.ts +0 -8
- package/src/styles/vaadin-time-picker-core-styles.js +0 -26
- package/src/styles/vaadin-time-picker-overlay-core-styles.js +0 -18
- package/src/styles/vaadin-time-picker-scroller-core-styles.js +0 -27
- package/theme/lumo/vaadin-time-picker-styles.d.ts +0 -7
- package/theme/lumo/vaadin-time-picker-styles.js +0 -52
- package/theme/lumo/vaadin-time-picker.d.ts +0 -7
- package/theme/lumo/vaadin-time-picker.js +0 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/time-picker",
|
|
3
|
-
"version": "25.0.0-
|
|
3
|
+
"version": "25.0.0-beta1",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -21,9 +21,6 @@
|
|
|
21
21
|
"type": "module",
|
|
22
22
|
"files": [
|
|
23
23
|
"src",
|
|
24
|
-
"!src/styles/*-base-styles.d.ts",
|
|
25
|
-
"!src/styles/*-base-styles.js",
|
|
26
|
-
"theme",
|
|
27
24
|
"vaadin-*.d.ts",
|
|
28
25
|
"vaadin-*.js",
|
|
29
26
|
"web-types.json",
|
|
@@ -37,25 +34,25 @@
|
|
|
37
34
|
],
|
|
38
35
|
"dependencies": {
|
|
39
36
|
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
40
|
-
"@vaadin/combo-box": "25.0.0-
|
|
41
|
-
"@vaadin/component-base": "25.0.0-
|
|
42
|
-
"@vaadin/field-base": "25.0.0-
|
|
43
|
-
"@vaadin/input-container": "25.0.0-
|
|
44
|
-
"@vaadin/item": "25.0.0-
|
|
45
|
-
"@vaadin/overlay": "25.0.0-
|
|
46
|
-
"@vaadin/vaadin-
|
|
47
|
-
"@vaadin/vaadin-themable-mixin": "25.0.0-alpha8",
|
|
37
|
+
"@vaadin/combo-box": "25.0.0-beta1",
|
|
38
|
+
"@vaadin/component-base": "25.0.0-beta1",
|
|
39
|
+
"@vaadin/field-base": "25.0.0-beta1",
|
|
40
|
+
"@vaadin/input-container": "25.0.0-beta1",
|
|
41
|
+
"@vaadin/item": "25.0.0-beta1",
|
|
42
|
+
"@vaadin/overlay": "25.0.0-beta1",
|
|
43
|
+
"@vaadin/vaadin-themable-mixin": "25.0.0-beta1",
|
|
48
44
|
"lit": "^3.0.0"
|
|
49
45
|
},
|
|
50
46
|
"devDependencies": {
|
|
51
|
-
"@vaadin/chai-plugins": "25.0.0-
|
|
52
|
-
"@vaadin/test-runner-commands": "25.0.0-
|
|
47
|
+
"@vaadin/chai-plugins": "25.0.0-beta1",
|
|
48
|
+
"@vaadin/test-runner-commands": "25.0.0-beta1",
|
|
53
49
|
"@vaadin/testing-helpers": "^2.0.0",
|
|
54
|
-
"
|
|
50
|
+
"@vaadin/vaadin-lumo-styles": "25.0.0-beta1",
|
|
51
|
+
"sinon": "^21.0.0"
|
|
55
52
|
},
|
|
56
53
|
"web-types": [
|
|
57
54
|
"web-types.json",
|
|
58
55
|
"web-types.lit.json"
|
|
59
56
|
],
|
|
60
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "1d20cf54e582d1f2e209126d4586f8b4c01c50e0"
|
|
61
58
|
}
|
|
@@ -3,7 +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 '@vaadin/component-base/src/style-props.js';
|
|
6
|
+
import '@vaadin/component-base/src/styles/style-props.js';
|
|
7
7
|
import { css } from 'lit';
|
|
8
8
|
|
|
9
9
|
export const timePickerStyles = css`
|
|
@@ -11,7 +11,7 @@ export const timePickerStyles = css`
|
|
|
11
11
|
pointer-events: auto;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
[part
|
|
14
|
+
[part~='toggle-button']::before {
|
|
15
15
|
mask-image: var(--_vaadin-icon-clock);
|
|
16
16
|
}
|
|
17
17
|
|
|
@@ -8,7 +8,7 @@ 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/styles/vaadin-item-
|
|
11
|
+
import { itemStyles } from '@vaadin/item/src/styles/vaadin-item-base-styles.js';
|
|
12
12
|
import { LumoInjectionMixin } from '@vaadin/vaadin-themable-mixin/lumo-injection-mixin.js';
|
|
13
13
|
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
14
14
|
|
|
@@ -59,17 +59,6 @@ export class TimePickerItem extends ComboBoxItemMixin(
|
|
|
59
59
|
</div>
|
|
60
60
|
`;
|
|
61
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
|
-
}
|
|
73
62
|
}
|
|
74
63
|
|
|
75
64
|
defineCustomElement(TimePickerItem);
|
|
@@ -10,7 +10,7 @@ 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
11
|
import type { ComboBoxBaseMixinClass } from '@vaadin/combo-box/src/vaadin-combo-box-base-mixin.js';
|
|
12
12
|
import type { DelegateStateMixinClass } from '@vaadin/component-base/src/delegate-state-mixin.js';
|
|
13
|
-
import type {
|
|
13
|
+
import type { I18nMixinClass } from '@vaadin/component-base/src/i18n-mixin.js';
|
|
14
14
|
import type { SlotStylesMixinClass } from '@vaadin/component-base/src/slot-styles-mixin.js';
|
|
15
15
|
import type { ClearButtonMixinClass } from '@vaadin/field-base/src/clear-button-mixin.js';
|
|
16
16
|
import type { FieldMixinClass } from '@vaadin/field-base/src/field-mixin.js';
|
|
@@ -23,8 +23,9 @@ import type { ValidateMixinClass } from '@vaadin/field-base/src/validate-mixin.j
|
|
|
23
23
|
import type { TimePickerTime } from './vaadin-time-picker-helper.js';
|
|
24
24
|
|
|
25
25
|
export interface TimePickerI18n {
|
|
26
|
-
parseTime(time: string): TimePickerTime | undefined;
|
|
27
|
-
|
|
26
|
+
parseTime?(time: string): TimePickerTime | undefined;
|
|
27
|
+
|
|
28
|
+
formatTime?(time: TimePickerTime | undefined): string;
|
|
28
29
|
}
|
|
29
30
|
|
|
30
31
|
/**
|
|
@@ -39,12 +40,12 @@ export declare function TimePickerMixin<T extends Constructor<HTMLElement>>(
|
|
|
39
40
|
Constructor<DisabledMixinClass> &
|
|
40
41
|
Constructor<FieldMixinClass> &
|
|
41
42
|
Constructor<FocusMixinClass> &
|
|
43
|
+
Constructor<I18nMixinClass<TimePickerI18n>> &
|
|
42
44
|
Constructor<InputConstraintsMixinClass> &
|
|
43
45
|
Constructor<InputControlMixinClass> &
|
|
44
46
|
Constructor<InputMixinClass> &
|
|
45
47
|
Constructor<KeyboardMixinClass> &
|
|
46
48
|
Constructor<LabelMixinClass> &
|
|
47
|
-
Constructor<OverlayClassMixinClass> &
|
|
48
49
|
Constructor<PatternMixinClass> &
|
|
49
50
|
Constructor<SlotStylesMixinClass> &
|
|
50
51
|
Constructor<TimePickerMixinClass> &
|
|
@@ -101,13 +102,13 @@ export declare class TimePickerMixinClass {
|
|
|
101
102
|
step: number | null | undefined;
|
|
102
103
|
|
|
103
104
|
/**
|
|
104
|
-
* The object used to localize this component.
|
|
105
|
-
*
|
|
106
|
-
*
|
|
105
|
+
* The object used to localize this component. To change the default
|
|
106
|
+
* localization, replace this with an object that provides both the
|
|
107
|
+
* time parsing and formatting functions.
|
|
107
108
|
*
|
|
108
109
|
* The object has the following JSON structure:
|
|
109
110
|
*
|
|
110
|
-
* ```
|
|
111
|
+
* ```js
|
|
111
112
|
* {
|
|
112
113
|
* // A function to format given `Object` as
|
|
113
114
|
* // time string. Object is in the format `{ hours: ..., minutes: ..., seconds: ..., milliseconds: ... }`
|
|
@@ -126,8 +127,8 @@ export declare class TimePickerMixinClass {
|
|
|
126
127
|
* }
|
|
127
128
|
* ```
|
|
128
129
|
*
|
|
129
|
-
*
|
|
130
|
-
* to ensure the component works properly.
|
|
130
|
+
* NOTE: `formatTime` and `parseTime` must be implemented in a
|
|
131
|
+
* compatible manner to ensure the component works properly.
|
|
131
132
|
*/
|
|
132
133
|
i18n: TimePickerI18n;
|
|
133
134
|
}
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import { ComboBoxBaseMixin } from '@vaadin/combo-box/src/vaadin-combo-box-base-mixin.js';
|
|
7
|
+
import { I18nMixin } from '@vaadin/component-base/src/i18n-mixin.js';
|
|
7
8
|
import { TooltipController } from '@vaadin/component-base/src/tooltip-controller.js';
|
|
8
9
|
import { InputControlMixin } from '@vaadin/field-base/src/input-control-mixin.js';
|
|
9
10
|
import { InputController } from '@vaadin/field-base/src/input-controller.js';
|
|
@@ -24,11 +25,15 @@ const MAX_ALLOWED_TIME = '23:59:59.999';
|
|
|
24
25
|
*
|
|
25
26
|
* @polymerMixin
|
|
26
27
|
* @mixes ComboBoxBaseMixin
|
|
28
|
+
* @mixes I18nMixin
|
|
27
29
|
* @mixes InputControlMixin
|
|
28
30
|
* @mixes PatternMixin
|
|
29
31
|
*/
|
|
30
32
|
export const TimePickerMixin = (superClass) =>
|
|
31
|
-
class TimePickerMixinClass extends
|
|
33
|
+
class TimePickerMixinClass extends I18nMixin(
|
|
34
|
+
timePickerI18nDefaults,
|
|
35
|
+
PatternMixin(ComboBoxBaseMixin(InputControlMixin(superClass))),
|
|
36
|
+
) {
|
|
32
37
|
static get properties() {
|
|
33
38
|
return {
|
|
34
39
|
/**
|
|
@@ -98,43 +103,6 @@ export const TimePickerMixin = (superClass) =>
|
|
|
98
103
|
sync: true,
|
|
99
104
|
},
|
|
100
105
|
|
|
101
|
-
/**
|
|
102
|
-
* The object used to localize this component.
|
|
103
|
-
* To change the default localization, replace the entire
|
|
104
|
-
* _i18n_ object or just the property you want to modify.
|
|
105
|
-
*
|
|
106
|
-
* The object has the following JSON structure:
|
|
107
|
-
*
|
|
108
|
-
* ```
|
|
109
|
-
* {
|
|
110
|
-
* // A function to format given `Object` as
|
|
111
|
-
* // time string. Object is in the format `{ hours: ..., minutes: ..., seconds: ..., milliseconds: ... }`
|
|
112
|
-
* formatTime: (time) => {
|
|
113
|
-
* // returns a string representation of the given
|
|
114
|
-
* // object in `hh` / 'hh:mm' / 'hh:mm:ss' / 'hh:mm:ss.fff' - formats
|
|
115
|
-
* },
|
|
116
|
-
*
|
|
117
|
-
* // A function to parse the given text to an `Object` in the format
|
|
118
|
-
* // `{ hours: ..., minutes: ..., seconds: ..., milliseconds: ... }`.
|
|
119
|
-
* // Must properly parse (at least) text
|
|
120
|
-
* // formatted by `formatTime`.
|
|
121
|
-
* parseTime: text => {
|
|
122
|
-
* // Parses a string in object/string that can be formatted by`formatTime`.
|
|
123
|
-
* }
|
|
124
|
-
* }
|
|
125
|
-
* ```
|
|
126
|
-
*
|
|
127
|
-
* Both `formatTime` and `parseTime` need to be implemented
|
|
128
|
-
* to ensure the component works properly.
|
|
129
|
-
*
|
|
130
|
-
* @type {!TimePickerI18n}
|
|
131
|
-
*/
|
|
132
|
-
i18n: {
|
|
133
|
-
type: Object,
|
|
134
|
-
sync: true,
|
|
135
|
-
value: () => ({ ...timePickerI18nDefaults }),
|
|
136
|
-
},
|
|
137
|
-
|
|
138
106
|
/** @private */
|
|
139
107
|
_comboBoxValue: {
|
|
140
108
|
type: String,
|
|
@@ -154,7 +122,7 @@ export const TimePickerMixin = (superClass) =>
|
|
|
154
122
|
'_openedOrItemsChanged(opened, _dropdownItems)',
|
|
155
123
|
'_updateScroller(opened, _dropdownItems, _focusedIndex, _theme)',
|
|
156
124
|
'__updateAriaAttributes(_dropdownItems, opened, inputElement)',
|
|
157
|
-
'__updateDropdownItems(
|
|
125
|
+
'__updateDropdownItems(__effectiveI18n, min, max, step)',
|
|
158
126
|
];
|
|
159
127
|
}
|
|
160
128
|
|
|
@@ -180,6 +148,45 @@ export const TimePickerMixin = (superClass) =>
|
|
|
180
148
|
return this.$.clearButton;
|
|
181
149
|
}
|
|
182
150
|
|
|
151
|
+
/**
|
|
152
|
+
* The object used to localize this component. To change the default
|
|
153
|
+
* localization, replace this with an object that provides both the
|
|
154
|
+
* time parsing and formatting functions.
|
|
155
|
+
*
|
|
156
|
+
* The object has the following JSON structure:
|
|
157
|
+
*
|
|
158
|
+
* ```js
|
|
159
|
+
* {
|
|
160
|
+
* // A function to format given `Object` as
|
|
161
|
+
* // time string. Object is in the format `{ hours: ..., minutes: ..., seconds: ..., milliseconds: ... }`
|
|
162
|
+
* formatTime: (time) => {
|
|
163
|
+
* // returns a string representation of the given
|
|
164
|
+
* // object in `hh` / 'hh:mm' / 'hh:mm:ss' / 'hh:mm:ss.fff' - formats
|
|
165
|
+
* },
|
|
166
|
+
*
|
|
167
|
+
* // A function to parse the given text to an `Object` in the format
|
|
168
|
+
* // `{ hours: ..., minutes: ..., seconds: ..., milliseconds: ... }`.
|
|
169
|
+
* // Must properly parse (at least) text
|
|
170
|
+
* // formatted by `formatTime`.
|
|
171
|
+
* parseTime: text => {
|
|
172
|
+
* // Parses a string in object/string that can be formatted by`formatTime`.
|
|
173
|
+
* }
|
|
174
|
+
* }
|
|
175
|
+
* ```
|
|
176
|
+
*
|
|
177
|
+
* NOTE: `formatTime` and `parseTime` must be implemented in a
|
|
178
|
+
* compatible manner to ensure the component works properly.
|
|
179
|
+
*
|
|
180
|
+
* @return {!TimePickerI18n}
|
|
181
|
+
*/
|
|
182
|
+
get i18n() {
|
|
183
|
+
return super.i18n;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
set i18n(value) {
|
|
187
|
+
super.i18n = value;
|
|
188
|
+
}
|
|
189
|
+
|
|
183
190
|
/**
|
|
184
191
|
* The input element's value when it cannot be parsed as a time, and an empty string otherwise.
|
|
185
192
|
*
|
|
@@ -187,7 +194,7 @@ export const TimePickerMixin = (superClass) =>
|
|
|
187
194
|
* @return {string}
|
|
188
195
|
*/
|
|
189
196
|
get __unparsableValue() {
|
|
190
|
-
if (this._inputElementValue && !this.
|
|
197
|
+
if (this._inputElementValue && !this.__effectiveI18n.parseTime(this._inputElementValue)) {
|
|
191
198
|
return this._inputElementValue;
|
|
192
199
|
}
|
|
193
200
|
|
|
@@ -245,8 +252,8 @@ export const TimePickerMixin = (superClass) =>
|
|
|
245
252
|
checkValidity() {
|
|
246
253
|
return !!(
|
|
247
254
|
this.inputElement.checkValidity() &&
|
|
248
|
-
(!this.value || this._timeAllowed(this.
|
|
249
|
-
(!this._comboBoxValue || this.
|
|
255
|
+
(!this.value || this._timeAllowed(this.__effectiveI18n.parseTime(this.value))) &&
|
|
256
|
+
(!this._comboBoxValue || this.__effectiveI18n.parseTime(this._comboBoxValue))
|
|
250
257
|
);
|
|
251
258
|
}
|
|
252
259
|
|
|
@@ -259,18 +266,6 @@ export const TimePickerMixin = (superClass) =>
|
|
|
259
266
|
return item ? item.label : '';
|
|
260
267
|
}
|
|
261
268
|
|
|
262
|
-
/**
|
|
263
|
-
* Override method from `ComboBoxBaseMixin` to render scroller in the slot.
|
|
264
|
-
* @protected
|
|
265
|
-
* @override
|
|
266
|
-
*/
|
|
267
|
-
_renderScroller(scroller) {
|
|
268
|
-
scroller.setAttribute('slot', 'overlay');
|
|
269
|
-
// Prevent focusing scroller on input Tab
|
|
270
|
-
scroller.setAttribute('tabindex', '-1');
|
|
271
|
-
this.appendChild(scroller);
|
|
272
|
-
}
|
|
273
|
-
|
|
274
269
|
/** @private */
|
|
275
270
|
_updateScroller(opened, items, focusedIndex, theme) {
|
|
276
271
|
if (opened) {
|
|
@@ -423,7 +418,7 @@ export const TimePickerMixin = (superClass) =>
|
|
|
423
418
|
// observer where the value can be parsed again, so we set
|
|
424
419
|
// this flag to ensure it does not alter the value.
|
|
425
420
|
this.__useMemo = true;
|
|
426
|
-
this._comboBoxValue = this.
|
|
421
|
+
this._comboBoxValue = this.__effectiveI18n.formatTime(objWithStep);
|
|
427
422
|
this.__useMemo = false;
|
|
428
423
|
|
|
429
424
|
this.__commitValueChange();
|
|
@@ -520,7 +515,7 @@ export const TimePickerMixin = (superClass) =>
|
|
|
520
515
|
}
|
|
521
516
|
|
|
522
517
|
/** @private */
|
|
523
|
-
__updateDropdownItems(
|
|
518
|
+
__updateDropdownItems(effectiveI18n, min, max, step) {
|
|
524
519
|
const minTimeObj = validateTime(parseISOTime(min || MIN_ALLOWED_TIME), step);
|
|
525
520
|
const minSec = this.__getSec(minTimeObj);
|
|
526
521
|
|
|
@@ -536,7 +531,7 @@ export const TimePickerMixin = (superClass) =>
|
|
|
536
531
|
}
|
|
537
532
|
|
|
538
533
|
if (this.value) {
|
|
539
|
-
this._comboBoxValue =
|
|
534
|
+
this._comboBoxValue = effectiveI18n.formatTime(effectiveI18n.parseTime(this.value));
|
|
540
535
|
}
|
|
541
536
|
}
|
|
542
537
|
|
|
@@ -572,7 +567,7 @@ export const TimePickerMixin = (superClass) =>
|
|
|
572
567
|
while (time + step >= minSec && time + step <= maxSec) {
|
|
573
568
|
const timeObj = validateTime(this.__addStep(time * 1000, step), step);
|
|
574
569
|
time += step;
|
|
575
|
-
const formatted = this.
|
|
570
|
+
const formatted = this.__effectiveI18n.formatTime(timeObj);
|
|
576
571
|
generatedList.push({ label: formatted, value: formatted });
|
|
577
572
|
}
|
|
578
573
|
|
|
@@ -618,8 +613,8 @@ export const TimePickerMixin = (superClass) =>
|
|
|
618
613
|
return;
|
|
619
614
|
}
|
|
620
615
|
|
|
621
|
-
const parsedObj = this.__useMemo ? this.__memoValue : this.
|
|
622
|
-
const newValue = this.
|
|
616
|
+
const parsedObj = this.__useMemo ? this.__memoValue : this.__effectiveI18n.parseTime(value);
|
|
617
|
+
const newValue = this.__effectiveI18n.formatTime(parsedObj) || '';
|
|
623
618
|
|
|
624
619
|
if (parsedObj) {
|
|
625
620
|
if (value !== newValue) {
|
|
@@ -656,7 +651,7 @@ export const TimePickerMixin = (superClass) =>
|
|
|
656
651
|
|
|
657
652
|
/** @private */
|
|
658
653
|
__updateInputValue(obj) {
|
|
659
|
-
const timeString = this.
|
|
654
|
+
const timeString = this.__effectiveI18n.formatTime(validateTime(obj, this.step)) || '';
|
|
660
655
|
this._inputElementValue = timeString;
|
|
661
656
|
this._comboBoxValue = timeString;
|
|
662
657
|
}
|
|
@@ -669,8 +664,8 @@ export const TimePickerMixin = (superClass) =>
|
|
|
669
664
|
* @protected
|
|
670
665
|
*/
|
|
671
666
|
_timeAllowed(time) {
|
|
672
|
-
const parsedMin = this.
|
|
673
|
-
const parsedMax = this.
|
|
667
|
+
const parsedMin = this.__effectiveI18n.parseTime(this.min || MIN_ALLOWED_TIME);
|
|
668
|
+
const parsedMax = this.__effectiveI18n.parseTime(this.max || MAX_ALLOWED_TIME);
|
|
674
669
|
|
|
675
670
|
return (
|
|
676
671
|
(!this.__getMsec(parsedMin) || this.__getMsec(time) >= this.__getMsec(parsedMin)) &&
|
|
@@ -8,11 +8,11 @@ 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-
|
|
11
|
+
import { overlayStyles } from '@vaadin/overlay/src/styles/vaadin-overlay-base-styles.js';
|
|
12
12
|
import { OverlayMixin } from '@vaadin/overlay/src/vaadin-overlay-mixin.js';
|
|
13
13
|
import { LumoInjectionMixin } from '@vaadin/vaadin-themable-mixin/lumo-injection-mixin.js';
|
|
14
14
|
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
15
|
-
import { timePickerOverlayStyles } from './styles/vaadin-time-picker-overlay-
|
|
15
|
+
import { timePickerOverlayStyles } from './styles/vaadin-time-picker-overlay-base-styles.js';
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* An element used internally by `<vaadin-time-picker>`. Not intended to be used separately.
|
|
@@ -45,33 +45,6 @@ export class TimePickerOverlay extends ComboBoxOverlayMixin(
|
|
|
45
45
|
</div>
|
|
46
46
|
`;
|
|
47
47
|
}
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* @protected
|
|
51
|
-
* @override
|
|
52
|
-
*/
|
|
53
|
-
_attachOverlay() {
|
|
54
|
-
this.showPopover();
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* @protected
|
|
59
|
-
* @override
|
|
60
|
-
*/
|
|
61
|
-
_detachOverlay() {
|
|
62
|
-
this.hidePopover();
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* Override method from `ComboBoxOverlayMixin` to enforce
|
|
67
|
-
* `dir` attribute to be set to `ltr` on the overlay.
|
|
68
|
-
* @protected
|
|
69
|
-
* @override
|
|
70
|
-
*/
|
|
71
|
-
_getHostDir() {
|
|
72
|
-
// See https://github.com/vaadin/vaadin-time-picker/issues/145
|
|
73
|
-
return 'ltr';
|
|
74
|
-
}
|
|
75
48
|
}
|
|
76
49
|
|
|
77
50
|
defineCustomElement(TimePickerOverlay);
|
|
@@ -7,7 +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 { timePickerScrollerStyles } from './styles/vaadin-time-picker-scroller-
|
|
10
|
+
import { timePickerScrollerStyles } from './styles/vaadin-time-picker-scroller-base-styles.js';
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* An element used internally by `<vaadin-time-picker>`. Not intended to be used separately.
|
|
@@ -73,34 +73,43 @@ export interface TimePickerEventMap extends HTMLElementEventMap, TimePickerCusto
|
|
|
73
73
|
* `--vaadin-time-picker-overlay-width` | Width of the overlay | `auto`
|
|
74
74
|
* `--vaadin-time-picker-overlay-max-height`| Max height of the overlay | `65vh`
|
|
75
75
|
*
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
* `
|
|
84
|
-
* `
|
|
85
|
-
* `
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
*
|
|
90
|
-
*
|
|
91
|
-
*
|
|
76
|
+
* The following shadow DOM parts are available for styling:
|
|
77
|
+
*
|
|
78
|
+
* Part name | Description
|
|
79
|
+
* ---------------------|----------------
|
|
80
|
+
* `label` | The label element
|
|
81
|
+
* `input-field` | The element that wraps prefix, value and buttons
|
|
82
|
+
* `field-button` | Set on both clear and toggle buttons
|
|
83
|
+
* `clear-button` | The clear button
|
|
84
|
+
* `error-message` | The error message element
|
|
85
|
+
* `helper-text` | The helper text element wrapper
|
|
86
|
+
* `required-indicator` | The `required` state indicator element
|
|
87
|
+
* `toggle-button` | The toggle button
|
|
88
|
+
* `overlay` | The overlay container
|
|
89
|
+
* `content` | The overlay content
|
|
90
|
+
*
|
|
91
|
+
* The following state attributes are available for styling:
|
|
92
|
+
*
|
|
93
|
+
* Attribute | Description
|
|
94
|
+
* ---------------------|---------------------------------
|
|
95
|
+
* `disabled` | Set when the element is disabled
|
|
96
|
+
* `has-value` | Set when the element has a value
|
|
97
|
+
* `has-label` | Set when the element has a label
|
|
98
|
+
* `has-helper` | Set when the element has helper text or slot
|
|
99
|
+
* `has-error-message` | Set when the element has an error message
|
|
100
|
+
* `has-tooltip` | Set when the element has a slotted tooltip
|
|
101
|
+
* `invalid` | Set when the element is invalid
|
|
102
|
+
* `focused` | Set when the element is focused
|
|
103
|
+
* `focus-ring` | Set when the element is keyboard focused
|
|
104
|
+
* `readonly` | Set when the element is readonly
|
|
105
|
+
* `opened` | Set when the overlay is opened
|
|
92
106
|
*
|
|
93
107
|
* ### Internal components
|
|
94
108
|
*
|
|
95
109
|
* In addition to `<vaadin-time-picker>` itself, the following internal
|
|
96
110
|
* components are themable:
|
|
97
111
|
*
|
|
98
|
-
* - `<vaadin-time-picker-overlay>` - has the same API as [`<vaadin-overlay>`](#/elements/vaadin-overlay).
|
|
99
112
|
* - `<vaadin-time-picker-item>` - has the same API as [`<vaadin-item>`](#/elements/vaadin-item).
|
|
100
|
-
* - [`<vaadin-input-container>`](#/elements/vaadin-input-container) - an internal element wrapping the input.
|
|
101
|
-
*
|
|
102
|
-
* Note: the `theme` attribute value set on `<vaadin-time-picker>` is
|
|
103
|
-
* propagated to the internal components listed above.
|
|
104
113
|
*
|
|
105
114
|
* See [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.
|
|
106
115
|
*
|
|
@@ -15,7 +15,7 @@ import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
|
|
|
15
15
|
import { inputFieldShared } from '@vaadin/field-base/src/styles/input-field-shared-styles.js';
|
|
16
16
|
import { LumoInjectionMixin } from '@vaadin/vaadin-themable-mixin/lumo-injection-mixin.js';
|
|
17
17
|
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
18
|
-
import { timePickerStyles } from './styles/vaadin-time-picker-
|
|
18
|
+
import { timePickerStyles } from './styles/vaadin-time-picker-base-styles.js';
|
|
19
19
|
import { TimePickerMixin } from './vaadin-time-picker-mixin.js';
|
|
20
20
|
|
|
21
21
|
/**
|
|
@@ -40,34 +40,43 @@ import { TimePickerMixin } from './vaadin-time-picker-mixin.js';
|
|
|
40
40
|
* `--vaadin-time-picker-overlay-width` | Width of the overlay | `auto`
|
|
41
41
|
* `--vaadin-time-picker-overlay-max-height`| Max height of the overlay | `65vh`
|
|
42
42
|
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
* `
|
|
51
|
-
* `
|
|
52
|
-
* `
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
43
|
+
* The following shadow DOM parts are available for styling:
|
|
44
|
+
*
|
|
45
|
+
* Part name | Description
|
|
46
|
+
* ---------------------|----------------
|
|
47
|
+
* `label` | The label element
|
|
48
|
+
* `input-field` | The element that wraps prefix, value and buttons
|
|
49
|
+
* `field-button` | Set on both clear and toggle buttons
|
|
50
|
+
* `clear-button` | The clear button
|
|
51
|
+
* `error-message` | The error message element
|
|
52
|
+
* `helper-text` | The helper text element wrapper
|
|
53
|
+
* `required-indicator` | The `required` state indicator element
|
|
54
|
+
* `toggle-button` | The toggle button
|
|
55
|
+
* `overlay` | The overlay container
|
|
56
|
+
* `content` | The overlay content
|
|
57
|
+
*
|
|
58
|
+
* The following state attributes are available for styling:
|
|
59
|
+
*
|
|
60
|
+
* Attribute | Description
|
|
61
|
+
* ---------------------|---------------------------------
|
|
62
|
+
* `disabled` | Set when the element is disabled
|
|
63
|
+
* `has-value` | Set when the element has a value
|
|
64
|
+
* `has-label` | Set when the element has a label
|
|
65
|
+
* `has-helper` | Set when the element has helper text or slot
|
|
66
|
+
* `has-error-message` | Set when the element has an error message
|
|
67
|
+
* `has-tooltip` | Set when the element has a slotted tooltip
|
|
68
|
+
* `invalid` | Set when the element is invalid
|
|
69
|
+
* `focused` | Set when the element is focused
|
|
70
|
+
* `focus-ring` | Set when the element is keyboard focused
|
|
71
|
+
* `readonly` | Set when the element is readonly
|
|
72
|
+
* `opened` | Set when the overlay is opened
|
|
59
73
|
*
|
|
60
74
|
* ### Internal components
|
|
61
75
|
*
|
|
62
76
|
* In addition to `<vaadin-time-picker>` itself, the following internal
|
|
63
77
|
* components are themable:
|
|
64
78
|
*
|
|
65
|
-
* - `<vaadin-time-picker-overlay>` - has the same API as [`<vaadin-overlay>`](#/elements/vaadin-overlay).
|
|
66
79
|
* - `<vaadin-time-picker-item>` - has the same API as [`<vaadin-item>`](#/elements/vaadin-item).
|
|
67
|
-
* - [`<vaadin-input-container>`](#/elements/vaadin-input-container) - an internal element wrapping the input.
|
|
68
|
-
*
|
|
69
|
-
* Note: the `theme` attribute value set on `<vaadin-time-picker>` is
|
|
70
|
-
* propagated to the internal components listed above.
|
|
71
80
|
*
|
|
72
81
|
* See [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.
|
|
73
82
|
*
|
|
@@ -126,8 +135,8 @@ class TimePicker extends TimePickerMixin(ThemableMixin(ElementMixin(PolylitMixin
|
|
|
126
135
|
>
|
|
127
136
|
<slot name="prefix" slot="prefix"></slot>
|
|
128
137
|
<slot name="input"></slot>
|
|
129
|
-
<div id="clearButton" part="clear-button" slot="suffix" aria-hidden="true"></div>
|
|
130
|
-
<div id="toggleButton" part="toggle-button" slot="suffix" aria-hidden="true"></div>
|
|
138
|
+
<div id="clearButton" part="field-button clear-button" slot="suffix" aria-hidden="true"></div>
|
|
139
|
+
<div id="toggleButton" part="field-button toggle-button" slot="suffix" aria-hidden="true"></div>
|
|
131
140
|
</vaadin-input-container>
|
|
132
141
|
|
|
133
142
|
<div part="helper-text">
|
|
@@ -141,7 +150,7 @@ class TimePicker extends TimePickerMixin(ThemableMixin(ElementMixin(PolylitMixin
|
|
|
141
150
|
|
|
142
151
|
<vaadin-time-picker-overlay
|
|
143
152
|
id="overlay"
|
|
144
|
-
|
|
153
|
+
dir="ltr"
|
|
145
154
|
.owner="${this}"
|
|
146
155
|
.opened="${this._overlayOpened}"
|
|
147
156
|
theme="${ifDefined(this._theme)}"
|
package/vaadin-time-picker.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import './
|
|
1
|
+
import './src/vaadin-time-picker.js';
|
|
2
2
|
export * from './src/vaadin-time-picker.js';
|
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-
|
|
4
|
+
"version": "25.0.0-beta1",
|
|
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\
|
|
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\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n---------------------|----------------\n`label` | The label element\n`input-field` | The element that wraps prefix, value and buttons\n`field-button` | Set on both clear and toggle buttons\n`clear-button` | The clear button\n`error-message` | The error message element\n`helper-text` | The helper text element wrapper\n`required-indicator` | The `required` state indicator element\n`toggle-button` | The toggle button\n`overlay` | The overlay container\n`content` | The overlay content\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n---------------------|---------------------------------\n`disabled` | Set when the element is disabled\n`has-value` | Set when the element has a value\n`has-label` | Set when the element has a label\n`has-helper` | Set when the element has helper text or slot\n`has-error-message` | Set when the element has an error message\n`has-tooltip` | Set when the element has a slotted tooltip\n`invalid` | Set when the element is invalid\n`focused` | Set when the element is focused\n`focus-ring` | Set when the element is keyboard focused\n`readonly` | Set when the element is readonly\n`opened` | Set when the overlay is opened\n\n### Internal components\n\nIn addition to `<vaadin-time-picker>` itself, the following internal\ncomponents are themable:\n\n- `<vaadin-time-picker-item>` - has the same API as [`<vaadin-item>`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-beta1/#/elements/vaadin-item).\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",
|
|
@@ -30,17 +30,6 @@
|
|
|
30
30
|
]
|
|
31
31
|
}
|
|
32
32
|
},
|
|
33
|
-
{
|
|
34
|
-
"name": "overlay-class",
|
|
35
|
-
"description": "A space-delimited list of CSS class names to set on the overlay element.\nThis property does not affect other CSS class names set manually via JS.\n\nNote, if the CSS class name was set with this property, clearing it will\nremove it from the overlay, even if the same class name was also added\nmanually, e.g. by using `classList.add()` in the `renderer` function.",
|
|
36
|
-
"value": {
|
|
37
|
-
"type": [
|
|
38
|
-
"string",
|
|
39
|
-
"null",
|
|
40
|
-
"undefined"
|
|
41
|
-
]
|
|
42
|
-
}
|
|
43
|
-
},
|
|
44
33
|
{
|
|
45
34
|
"name": "opened",
|
|
46
35
|
"description": "True if the dropdown is open, false otherwise.",
|
|
@@ -72,6 +61,15 @@
|
|
|
72
61
|
]
|
|
73
62
|
}
|
|
74
63
|
},
|
|
64
|
+
{
|
|
65
|
+
"name": "i18n",
|
|
66
|
+
"description": "The object used to localize this component. To change the default\nlocalization, replace this with an object that provides all properties, or\njust the individual properties you want to change.\n\nShould be overridden by subclasses to provide a custom JSDoc with the\ndefault I18N properties.",
|
|
67
|
+
"value": {
|
|
68
|
+
"type": [
|
|
69
|
+
"Object"
|
|
70
|
+
]
|
|
71
|
+
}
|
|
72
|
+
},
|
|
75
73
|
{
|
|
76
74
|
"name": "autofocus",
|
|
77
75
|
"description": "Specify that this control should have input focus when the page loads.",
|
|
@@ -311,17 +309,6 @@
|
|
|
311
309
|
]
|
|
312
310
|
}
|
|
313
311
|
},
|
|
314
|
-
{
|
|
315
|
-
"name": "overlayClass",
|
|
316
|
-
"description": "A space-delimited list of CSS class names to set on the overlay element.\nThis property does not affect other CSS class names set manually via JS.\n\nNote, if the CSS class name was set with this property, clearing it will\nremove it from the overlay, even if the same class name was also added\nmanually, e.g. by using `classList.add()` in the `renderer` function.",
|
|
317
|
-
"value": {
|
|
318
|
-
"type": [
|
|
319
|
-
"string",
|
|
320
|
-
"null",
|
|
321
|
-
"undefined"
|
|
322
|
-
]
|
|
323
|
-
}
|
|
324
|
-
},
|
|
325
312
|
{
|
|
326
313
|
"name": "opened",
|
|
327
314
|
"description": "True if the dropdown is open, false otherwise.",
|
|
@@ -353,6 +340,15 @@
|
|
|
353
340
|
]
|
|
354
341
|
}
|
|
355
342
|
},
|
|
343
|
+
{
|
|
344
|
+
"name": "i18n",
|
|
345
|
+
"description": "The object used to localize this component. To change the default\nlocalization, replace this with an object that provides both the\ntime parsing and formatting functions.\n\nThe object has the following JSON structure:\n\n```js\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\nNOTE: `formatTime` and `parseTime` must be implemented in a\ncompatible manner to ensure the component works properly.",
|
|
346
|
+
"value": {
|
|
347
|
+
"type": [
|
|
348
|
+
"TimePickerI18n"
|
|
349
|
+
]
|
|
350
|
+
}
|
|
351
|
+
},
|
|
356
352
|
{
|
|
357
353
|
"name": "autofocus",
|
|
358
354
|
"description": "Specify that this control should have input focus when the page loads.",
|
|
@@ -557,15 +553,6 @@
|
|
|
557
553
|
"undefined"
|
|
558
554
|
]
|
|
559
555
|
}
|
|
560
|
-
},
|
|
561
|
-
{
|
|
562
|
-
"name": "i18n",
|
|
563
|
-
"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.",
|
|
564
|
-
"value": {
|
|
565
|
-
"type": [
|
|
566
|
-
"TimePickerI18n"
|
|
567
|
-
]
|
|
568
|
-
}
|
|
569
556
|
}
|
|
570
557
|
],
|
|
571
558
|
"events": [
|
package/web-types.lit.json
CHANGED
|
@@ -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-
|
|
4
|
+
"version": "25.0.0-beta1",
|
|
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\
|
|
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\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n---------------------|----------------\n`label` | The label element\n`input-field` | The element that wraps prefix, value and buttons\n`field-button` | Set on both clear and toggle buttons\n`clear-button` | The clear button\n`error-message` | The error message element\n`helper-text` | The helper text element wrapper\n`required-indicator` | The `required` state indicator element\n`toggle-button` | The toggle button\n`overlay` | The overlay container\n`content` | The overlay content\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n---------------------|---------------------------------\n`disabled` | Set when the element is disabled\n`has-value` | Set when the element has a value\n`has-label` | Set when the element has a label\n`has-helper` | Set when the element has helper text or slot\n`has-error-message` | Set when the element has an error message\n`has-tooltip` | Set when the element has a slotted tooltip\n`invalid` | Set when the element is invalid\n`focused` | Set when the element is focused\n`focus-ring` | Set when the element is keyboard focused\n`readonly` | Set when the element is readonly\n`opened` | Set when the overlay is opened\n\n### Internal components\n\nIn addition to `<vaadin-time-picker>` itself, the following internal\ncomponents are themable:\n\n- `<vaadin-time-picker-item>` - has the same API as [`<vaadin-item>`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-beta1/#/elements/vaadin-item).\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
|
{
|
|
@@ -97,8 +97,8 @@
|
|
|
97
97
|
}
|
|
98
98
|
},
|
|
99
99
|
{
|
|
100
|
-
"name": ".
|
|
101
|
-
"description": "
|
|
100
|
+
"name": ".i18n",
|
|
101
|
+
"description": "The object used to localize this component. To change the default\nlocalization, replace this with an object that provides both the\ntime parsing and formatting functions.\n\nThe object has the following JSON structure:\n\n```js\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\nNOTE: `formatTime` and `parseTime` must be implemented in a\ncompatible manner to ensure the component works properly.",
|
|
102
102
|
"value": {
|
|
103
103
|
"kind": "expression"
|
|
104
104
|
}
|
|
@@ -194,13 +194,6 @@
|
|
|
194
194
|
"kind": "expression"
|
|
195
195
|
}
|
|
196
196
|
},
|
|
197
|
-
{
|
|
198
|
-
"name": ".i18n",
|
|
199
|
-
"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.",
|
|
200
|
-
"value": {
|
|
201
|
-
"kind": "expression"
|
|
202
|
-
}
|
|
203
|
-
},
|
|
204
197
|
{
|
|
205
198
|
"name": "@validated",
|
|
206
199
|
"description": "Fired whenever the field is validated.",
|
|
@@ -1,26 +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 { css } from 'lit';
|
|
7
|
-
|
|
8
|
-
export const timePickerStyles = css`
|
|
9
|
-
:host([opened]) {
|
|
10
|
-
pointer-events: auto;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
/* See https://github.com/vaadin/vaadin-time-picker/issues/145 */
|
|
14
|
-
:host([dir='rtl']) [part='input-field'] {
|
|
15
|
-
direction: ltr;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
:host([dir='rtl']) [part='input-field'] ::slotted(input)::placeholder {
|
|
19
|
-
direction: rtl;
|
|
20
|
-
text-align: left;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
[part~='toggle-button'] {
|
|
24
|
-
cursor: pointer;
|
|
25
|
-
}
|
|
26
|
-
`;
|
|
@@ -1,18 +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 { css } from 'lit';
|
|
7
|
-
|
|
8
|
-
export const timePickerOverlayStyles = css`
|
|
9
|
-
#overlay {
|
|
10
|
-
width: var(--vaadin-time-picker-overlay-width, var(--_vaadin-time-picker-overlay-default-width, auto));
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
[part='content'] {
|
|
14
|
-
display: flex;
|
|
15
|
-
flex-direction: column;
|
|
16
|
-
height: 100%;
|
|
17
|
-
}
|
|
18
|
-
`;
|
|
@@ -1,27 +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 { css } from 'lit';
|
|
7
|
-
|
|
8
|
-
export const timePickerScrollerStyles = css`
|
|
9
|
-
:host {
|
|
10
|
-
display: block;
|
|
11
|
-
min-height: 1px;
|
|
12
|
-
overflow: auto;
|
|
13
|
-
|
|
14
|
-
/* Fixes item background from getting on top of scrollbars on Safari */
|
|
15
|
-
transform: translate3d(0, 0, 0);
|
|
16
|
-
|
|
17
|
-
/* Fixes scrollbar disappearing when 'Show scroll bars: Always' enabled in Safari */
|
|
18
|
-
box-shadow: 0 0 0 white;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
#selector {
|
|
22
|
-
border-width: var(--_vaadin-time-picker-items-container-border-width);
|
|
23
|
-
border-style: var(--_vaadin-time-picker-items-container-border-style);
|
|
24
|
-
border-color: var(--_vaadin-time-picker-items-container-border-color, transparent);
|
|
25
|
-
position: relative;
|
|
26
|
-
}
|
|
27
|
-
`;
|
|
@@ -1,7 +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/input-container/theme/lumo/vaadin-input-container-styles.js';
|
|
7
|
-
import '@vaadin/vaadin-lumo-styles/font-icons.js';
|
|
@@ -1,52 +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/input-container/theme/lumo/vaadin-input-container-styles.js';
|
|
7
|
-
import '@vaadin/vaadin-lumo-styles/font-icons.js';
|
|
8
|
-
import { comboBoxItem } from '@vaadin/combo-box/theme/lumo/vaadin-combo-box-item-styles.js';
|
|
9
|
-
import { comboBoxOverlay } from '@vaadin/combo-box/theme/lumo/vaadin-combo-box-overlay-styles.js';
|
|
10
|
-
import { item } from '@vaadin/item/theme/lumo/vaadin-item-styles.js';
|
|
11
|
-
import { inputFieldShared } from '@vaadin/vaadin-lumo-styles/mixins/input-field-shared.js';
|
|
12
|
-
import { menuOverlayCore } from '@vaadin/vaadin-lumo-styles/mixins/menu-overlay.js';
|
|
13
|
-
import { overlay } from '@vaadin/vaadin-lumo-styles/mixins/overlay.js';
|
|
14
|
-
import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
15
|
-
|
|
16
|
-
registerStyles('vaadin-time-picker-item', [item, comboBoxItem], {
|
|
17
|
-
moduleId: 'lumo-time-picker-item',
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
registerStyles(
|
|
21
|
-
'vaadin-time-picker-overlay',
|
|
22
|
-
[
|
|
23
|
-
overlay,
|
|
24
|
-
menuOverlayCore,
|
|
25
|
-
comboBoxOverlay,
|
|
26
|
-
css`
|
|
27
|
-
:host {
|
|
28
|
-
--_vaadin-time-picker-items-container-border-width: var(--lumo-space-xs);
|
|
29
|
-
--_vaadin-time-picker-items-container-border-style: solid;
|
|
30
|
-
}
|
|
31
|
-
`,
|
|
32
|
-
],
|
|
33
|
-
{
|
|
34
|
-
moduleId: 'lumo-time-picker-overlay',
|
|
35
|
-
},
|
|
36
|
-
);
|
|
37
|
-
|
|
38
|
-
const timePicker = css`
|
|
39
|
-
[part~='toggle-button']::before {
|
|
40
|
-
content: var(--lumo-icons-clock);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
:host([dir='rtl']) [part='input-field'] ::slotted(input:placeholder-shown) {
|
|
44
|
-
--_lumo-text-field-overflow-mask-image: none;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
:host([dir='rtl']) [part='input-field'] ::slotted(input) {
|
|
48
|
-
--_lumo-text-field-overflow-mask-image: linear-gradient(to left, transparent, #000 1.25em);
|
|
49
|
-
}
|
|
50
|
-
`;
|
|
51
|
-
|
|
52
|
-
registerStyles('vaadin-time-picker', [inputFieldShared, timePicker], { moduleId: 'lumo-time-picker' });
|