@vaadin/time-picker 24.0.0-alpha9 → 24.0.0-beta2
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 +10 -10
- package/src/vaadin-time-picker-item.d.ts +42 -0
- package/src/vaadin-time-picker-item.js +35 -11
- package/src/vaadin-time-picker-overlay.d.ts +20 -0
- package/src/vaadin-time-picker-overlay.js +20 -2
- package/src/vaadin-time-picker-scroller.d.ts +19 -0
- package/src/vaadin-time-picker-scroller.js +35 -4
- package/src/vaadin-time-picker.d.ts +7 -0
- package/src/vaadin-time-picker.js +14 -21
- package/theme/lumo/vaadin-time-picker-styles.js +27 -0
- package/theme/lumo/vaadin-time-picker.js +1 -2
- package/theme/material/vaadin-time-picker-styles.js +25 -0
- package/theme/material/vaadin-time-picker.js +1 -2
- package/web-types.json +40 -18
- package/web-types.lit.json +13 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/time-picker",
|
|
3
|
-
"version": "24.0.0-
|
|
3
|
+
"version": "24.0.0-beta2",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -36,22 +36,22 @@
|
|
|
36
36
|
],
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@polymer/polymer": "^3.0.0",
|
|
39
|
-
"@vaadin/combo-box": "24.0.0-
|
|
40
|
-
"@vaadin/component-base": "24.0.0-
|
|
41
|
-
"@vaadin/field-base": "24.0.0-
|
|
42
|
-
"@vaadin/input-container": "24.0.0-
|
|
43
|
-
"@vaadin/vaadin-lumo-styles": "24.0.0-
|
|
44
|
-
"@vaadin/vaadin-material-styles": "24.0.0-
|
|
45
|
-
"@vaadin/vaadin-themable-mixin": "24.0.0-
|
|
39
|
+
"@vaadin/combo-box": "24.0.0-beta2",
|
|
40
|
+
"@vaadin/component-base": "24.0.0-beta2",
|
|
41
|
+
"@vaadin/field-base": "24.0.0-beta2",
|
|
42
|
+
"@vaadin/input-container": "24.0.0-beta2",
|
|
43
|
+
"@vaadin/vaadin-lumo-styles": "24.0.0-beta2",
|
|
44
|
+
"@vaadin/vaadin-material-styles": "24.0.0-beta2",
|
|
45
|
+
"@vaadin/vaadin-themable-mixin": "24.0.0-beta2"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@esm-bundle/chai": "^4.3.4",
|
|
49
|
-
"@vaadin/testing-helpers": "^0.
|
|
49
|
+
"@vaadin/testing-helpers": "^0.4.0",
|
|
50
50
|
"sinon": "^13.0.2"
|
|
51
51
|
},
|
|
52
52
|
"web-types": [
|
|
53
53
|
"web-types.json",
|
|
54
54
|
"web-types.lit.json"
|
|
55
55
|
],
|
|
56
|
-
"gitHead": "
|
|
56
|
+
"gitHead": "00086f1f6d487f042f189c9b9ecd7ba736960888"
|
|
57
57
|
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) 2018 - 2023 Vaadin Ltd.
|
|
4
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
+
*/
|
|
6
|
+
import type { ComboBoxItemMixinClass } from '@vaadin/combo-box/src/vaadin-combo-box-item-mixin.js';
|
|
7
|
+
import type { DirMixinClass } from '@vaadin/component-base/src/dir-mixin.js';
|
|
8
|
+
import type { ThemableMixinClass } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
9
|
+
import type { TimePicker } from './vaadin-time-picker.js';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* An item element used by the `<vaadin-time-picker>` dropdown.
|
|
13
|
+
*
|
|
14
|
+
* ### Styling
|
|
15
|
+
*
|
|
16
|
+
* The following shadow DOM parts are available for styling:
|
|
17
|
+
*
|
|
18
|
+
* Part name | Description
|
|
19
|
+
* ------------|--------------
|
|
20
|
+
* `checkmark` | The graphical checkmark shown for a selected item
|
|
21
|
+
* `content` | The element that wraps the item content
|
|
22
|
+
*
|
|
23
|
+
* The following state attributes are exposed for styling:
|
|
24
|
+
*
|
|
25
|
+
* Attribute | Description
|
|
26
|
+
* -------------|-------------
|
|
27
|
+
* `selected` | Set when the item is selected
|
|
28
|
+
* `focused` | Set when the item is focused
|
|
29
|
+
*
|
|
30
|
+
* See [Styling Components](https://vaadin.com/docs/latest/styling/custom-theme/styling-components) documentation.
|
|
31
|
+
*/
|
|
32
|
+
declare class TimePickerItem extends HTMLElement {}
|
|
33
|
+
|
|
34
|
+
interface TimePickerItem extends ComboBoxItemMixinClass<string, TimePicker>, DirMixinClass, ThemableMixinClass {}
|
|
35
|
+
|
|
36
|
+
declare global {
|
|
37
|
+
interface HTMLElementTagNameMap {
|
|
38
|
+
'vaadin-time-picker-item': TimePickerItem;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export { TimePickerItem };
|
|
@@ -3,35 +3,59 @@
|
|
|
3
3
|
* Copyright (c) 2018 - 2023 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
-
import {
|
|
6
|
+
import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
|
|
7
|
+
import { ComboBoxItemMixin } from '@vaadin/combo-box/src/vaadin-combo-box-item-mixin.js';
|
|
8
|
+
import { DirMixin } from '@vaadin/component-base/src/dir-mixin.js';
|
|
9
|
+
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
7
10
|
|
|
8
11
|
/**
|
|
9
|
-
* An element used
|
|
12
|
+
* An item element used by the `<vaadin-time-picker>` dropdown.
|
|
10
13
|
*
|
|
11
14
|
* ### Styling
|
|
12
15
|
*
|
|
13
16
|
* The following shadow DOM parts are available for styling:
|
|
14
17
|
*
|
|
15
|
-
* Part name
|
|
16
|
-
*
|
|
17
|
-
* `
|
|
18
|
+
* Part name | Description
|
|
19
|
+
* ------------|--------------
|
|
20
|
+
* `checkmark` | The graphical checkmark shown for a selected item
|
|
21
|
+
* `content` | The element that wraps the item content
|
|
18
22
|
*
|
|
19
23
|
* The following state attributes are exposed for styling:
|
|
20
24
|
*
|
|
21
|
-
* Attribute
|
|
22
|
-
*
|
|
23
|
-
* `selected`
|
|
24
|
-
* `focused`
|
|
25
|
+
* Attribute | Description
|
|
26
|
+
* -------------|-------------
|
|
27
|
+
* `selected` | Set when the item is selected
|
|
28
|
+
* `focused` | Set when the item is focused
|
|
25
29
|
*
|
|
26
30
|
* See [Styling Components](https://vaadin.com/docs/latest/styling/custom-theme/styling-components) documentation.
|
|
27
31
|
*
|
|
28
|
-
* @
|
|
32
|
+
* @mixes ComboBoxItemMixin
|
|
33
|
+
* @mixes ThemableMixin
|
|
34
|
+
* @mixes DirMixin
|
|
29
35
|
* @private
|
|
30
36
|
*/
|
|
31
|
-
class TimePickerItem extends
|
|
37
|
+
export class TimePickerItem extends ComboBoxItemMixin(ThemableMixin(DirMixin(PolymerElement))) {
|
|
32
38
|
static get is() {
|
|
33
39
|
return 'vaadin-time-picker-item';
|
|
34
40
|
}
|
|
41
|
+
|
|
42
|
+
static get template() {
|
|
43
|
+
return html`
|
|
44
|
+
<style>
|
|
45
|
+
:host {
|
|
46
|
+
display: block;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
:host([hidden]) {
|
|
50
|
+
display: none !important;
|
|
51
|
+
}
|
|
52
|
+
</style>
|
|
53
|
+
<span part="checkmark" aria-hidden="true"></span>
|
|
54
|
+
<div part="content">
|
|
55
|
+
<slot></slot>
|
|
56
|
+
</div>
|
|
57
|
+
`;
|
|
58
|
+
}
|
|
35
59
|
}
|
|
36
60
|
|
|
37
61
|
customElements.define(TimePickerItem.is, TimePickerItem);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) 2018 - 2023 Vaadin Ltd.
|
|
4
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
+
*/
|
|
6
|
+
import { ComboBoxOverlayMixin } from '@vaadin/combo-box/src/vaadin-combo-box-overlay-mixin.js';
|
|
7
|
+
import { Overlay } from '@vaadin/overlay/src/vaadin-overlay.js';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* An element used internally by `<vaadin-time-picker>`. Not intended to be used separately.
|
|
11
|
+
*/
|
|
12
|
+
declare class TimePickerOverlay extends ComboBoxOverlayMixin(Overlay) {}
|
|
13
|
+
|
|
14
|
+
declare global {
|
|
15
|
+
interface HTMLElementTagNameMap {
|
|
16
|
+
'vaadin-time-picker-overlay': TimePickerOverlay;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export { TimePickerOverlay };
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
* Copyright (c) 2018 - 2023 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
-
import {
|
|
6
|
+
import { ComboBoxOverlayMixin } from '@vaadin/combo-box/src/vaadin-combo-box-overlay-mixin.js';
|
|
7
|
+
import { Overlay } from '@vaadin/overlay/src/vaadin-overlay.js';
|
|
7
8
|
import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
8
9
|
|
|
9
10
|
registerStyles(
|
|
@@ -12,20 +13,37 @@ registerStyles(
|
|
|
12
13
|
#overlay {
|
|
13
14
|
width: var(--vaadin-time-picker-overlay-width, var(--_vaadin-time-picker-overlay-default-width, auto));
|
|
14
15
|
}
|
|
16
|
+
|
|
17
|
+
[part='content'] {
|
|
18
|
+
display: flex;
|
|
19
|
+
flex-direction: column;
|
|
20
|
+
height: 100%;
|
|
21
|
+
}
|
|
15
22
|
`,
|
|
16
23
|
{ moduleId: 'vaadin-time-picker-overlay-styles' },
|
|
17
24
|
);
|
|
18
25
|
|
|
26
|
+
let memoizedTemplate;
|
|
27
|
+
|
|
19
28
|
/**
|
|
20
29
|
* An element used internally by `<vaadin-time-picker>`. Not intended to be used separately.
|
|
21
30
|
*
|
|
22
31
|
* @extends ComboBoxOverlay
|
|
23
32
|
* @private
|
|
24
33
|
*/
|
|
25
|
-
class TimePickerOverlay extends
|
|
34
|
+
class TimePickerOverlay extends ComboBoxOverlayMixin(Overlay) {
|
|
26
35
|
static get is() {
|
|
27
36
|
return 'vaadin-time-picker-overlay';
|
|
28
37
|
}
|
|
38
|
+
|
|
39
|
+
static get template() {
|
|
40
|
+
if (!memoizedTemplate) {
|
|
41
|
+
memoizedTemplate = super.template.cloneNode(true);
|
|
42
|
+
memoizedTemplate.content.querySelector('[part~="overlay"]').removeAttribute('tabindex');
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return memoizedTemplate;
|
|
46
|
+
}
|
|
29
47
|
}
|
|
30
48
|
|
|
31
49
|
customElements.define(TimePickerOverlay.is, TimePickerOverlay);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) 2018 - 2023 Vaadin Ltd.
|
|
4
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
+
*/
|
|
6
|
+
import { ComboBoxScrollerMixin } from '@vaadin/combo-box/src/vaadin-combo-box-scroller-mixin.js';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* An element used internally by `<vaadin-time-picker>`. Not intended to be used separately.
|
|
10
|
+
*/
|
|
11
|
+
declare class TimePickerScroller extends ComboBoxScrollerMixin(HTMLElement) {}
|
|
12
|
+
|
|
13
|
+
declare global {
|
|
14
|
+
interface HTMLElementTagNameMap {
|
|
15
|
+
'vaadin-time-picker-scroller': TimePickerScroller;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export { TimePickerScroller };
|
|
@@ -3,18 +3,49 @@
|
|
|
3
3
|
* Copyright (c) 2018 - 2023 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
-
import {
|
|
7
|
-
|
|
6
|
+
import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
|
|
7
|
+
import { ComboBoxScrollerMixin } from '@vaadin/combo-box/src/vaadin-combo-box-scroller-mixin.js';
|
|
8
8
|
/**
|
|
9
9
|
* An element used internally by `<vaadin-time-picker>`. Not intended to be used separately.
|
|
10
10
|
*
|
|
11
|
-
* @extends
|
|
11
|
+
* @extends HTMLElement
|
|
12
|
+
* @mixes ComboBoxScrollerMixin
|
|
12
13
|
* @private
|
|
13
14
|
*/
|
|
14
|
-
class TimePickerScroller extends
|
|
15
|
+
export class TimePickerScroller extends ComboBoxScrollerMixin(PolymerElement) {
|
|
15
16
|
static get is() {
|
|
16
17
|
return 'vaadin-time-picker-scroller';
|
|
17
18
|
}
|
|
19
|
+
|
|
20
|
+
static get template() {
|
|
21
|
+
return html`
|
|
22
|
+
<style>
|
|
23
|
+
:host {
|
|
24
|
+
display: block;
|
|
25
|
+
min-height: 1px;
|
|
26
|
+
overflow: auto;
|
|
27
|
+
|
|
28
|
+
/* Fixes item background from getting on top of scrollbars on Safari */
|
|
29
|
+
transform: translate3d(0, 0, 0);
|
|
30
|
+
|
|
31
|
+
/* Enable momentum scrolling on iOS */
|
|
32
|
+
-webkit-overflow-scrolling: touch;
|
|
33
|
+
|
|
34
|
+
/* Fixes scrollbar disappearing when 'Show scroll bars: Always' enabled in Safari */
|
|
35
|
+
box-shadow: 0 0 0 white;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
#selector {
|
|
39
|
+
border-width: var(--_vaadin-time-picker-items-container-border-width);
|
|
40
|
+
border-style: var(--_vaadin-time-picker-items-container-border-style);
|
|
41
|
+
border-color: var(--_vaadin-time-picker-items-container-border-color, transparent);
|
|
42
|
+
}
|
|
43
|
+
</style>
|
|
44
|
+
<div id="selector">
|
|
45
|
+
<slot></slot>
|
|
46
|
+
</div>
|
|
47
|
+
`;
|
|
48
|
+
}
|
|
18
49
|
}
|
|
19
50
|
|
|
20
51
|
customElements.define(TimePickerScroller.is, TimePickerScroller);
|
|
@@ -178,6 +178,13 @@ declare class TimePicker extends PatternMixin(InputControlMixin(ThemableMixin(El
|
|
|
178
178
|
*/
|
|
179
179
|
autoOpenDisabled: boolean | null | undefined;
|
|
180
180
|
|
|
181
|
+
/**
|
|
182
|
+
* A space-delimited list of CSS class names to set on the overlay element.
|
|
183
|
+
*
|
|
184
|
+
* @attr {string} overlay-class
|
|
185
|
+
*/
|
|
186
|
+
overlayClass: string;
|
|
187
|
+
|
|
181
188
|
/**
|
|
182
189
|
* The object used to localize this component.
|
|
183
190
|
* To change the default localization, replace the entire
|
|
@@ -121,6 +121,7 @@ class TimePicker extends PatternMixin(InputControlMixin(ThemableMixin(ElementMix
|
|
|
121
121
|
readonly="[[readonly]]"
|
|
122
122
|
clear-button-visible="[[clearButtonVisible]]"
|
|
123
123
|
auto-open-disabled="[[autoOpenDisabled]]"
|
|
124
|
+
overlay-class="[[overlayClass]]"
|
|
124
125
|
position-target="[[_inputContainer]]"
|
|
125
126
|
theme$="[[_theme]]"
|
|
126
127
|
on-change="__onComboBoxChange"
|
|
@@ -232,6 +233,15 @@ class TimePicker extends PatternMixin(InputControlMixin(ThemableMixin(ElementMix
|
|
|
232
233
|
*/
|
|
233
234
|
autoOpenDisabled: Boolean,
|
|
234
235
|
|
|
236
|
+
/**
|
|
237
|
+
* A space-delimited list of CSS class names to set on the overlay element.
|
|
238
|
+
*
|
|
239
|
+
* @attr {string} overlay-class
|
|
240
|
+
*/
|
|
241
|
+
overlayClass: {
|
|
242
|
+
type: String,
|
|
243
|
+
},
|
|
244
|
+
|
|
235
245
|
/** @private */
|
|
236
246
|
__dropdownItems: {
|
|
237
247
|
type: Array,
|
|
@@ -536,8 +546,6 @@ class TimePicker extends PatternMixin(InputControlMixin(ThemableMixin(ElementMix
|
|
|
536
546
|
const maxTimeObj = this.__validateTime(this.__parseISO(max || MAX_ALLOWED_TIME));
|
|
537
547
|
const maxSec = this.__getSec(maxTimeObj);
|
|
538
548
|
|
|
539
|
-
this.__adjustValue(minSec, maxSec, minTimeObj, maxTimeObj);
|
|
540
|
-
|
|
541
549
|
this.__dropdownItems = this.__generateDropdownList(minSec, maxSec, step);
|
|
542
550
|
|
|
543
551
|
if (step !== this.__oldStep) {
|
|
@@ -575,22 +583,6 @@ class TimePicker extends PatternMixin(InputControlMixin(ThemableMixin(ElementMix
|
|
|
575
583
|
return generatedList;
|
|
576
584
|
}
|
|
577
585
|
|
|
578
|
-
/** @private */
|
|
579
|
-
__adjustValue(minSec, maxSec, minTimeObj, maxTimeObj) {
|
|
580
|
-
// Do not change the value if it is empty
|
|
581
|
-
if (!this.__memoValue) {
|
|
582
|
-
return;
|
|
583
|
-
}
|
|
584
|
-
|
|
585
|
-
const valSec = this.__getSec(this.__memoValue);
|
|
586
|
-
|
|
587
|
-
if (valSec < minSec) {
|
|
588
|
-
this.__updateValue(minTimeObj);
|
|
589
|
-
} else if (valSec > maxSec) {
|
|
590
|
-
this.__updateValue(maxTimeObj);
|
|
591
|
-
}
|
|
592
|
-
}
|
|
593
|
-
|
|
594
586
|
/**
|
|
595
587
|
* Override an observer from `InputMixin`.
|
|
596
588
|
* @protected
|
|
@@ -666,16 +658,17 @@ class TimePicker extends PatternMixin(InputControlMixin(ThemableMixin(ElementMix
|
|
|
666
658
|
/** @private */
|
|
667
659
|
__validateTime(timeObject) {
|
|
668
660
|
if (timeObject) {
|
|
661
|
+
const stepSegment = this.__getStepSegment();
|
|
669
662
|
timeObject.hours = parseInt(timeObject.hours);
|
|
670
663
|
timeObject.minutes = parseInt(timeObject.minutes || 0);
|
|
671
|
-
timeObject.seconds =
|
|
672
|
-
timeObject.milliseconds =
|
|
664
|
+
timeObject.seconds = stepSegment < 3 ? undefined : parseInt(timeObject.seconds || 0);
|
|
665
|
+
timeObject.milliseconds = stepSegment < 4 ? undefined : parseInt(timeObject.milliseconds || 0);
|
|
673
666
|
}
|
|
674
667
|
return timeObject;
|
|
675
668
|
}
|
|
676
669
|
|
|
677
670
|
/** @private */
|
|
678
|
-
|
|
671
|
+
__getStepSegment() {
|
|
679
672
|
if (this.step % 3600 === 0) {
|
|
680
673
|
// Accept hours
|
|
681
674
|
return 1;
|
|
@@ -4,9 +4,36 @@
|
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import '@vaadin/vaadin-lumo-styles/font-icons.js';
|
|
7
|
+
import { comboBoxItem } from '@vaadin/combo-box/theme/lumo/vaadin-combo-box-item-styles.js';
|
|
8
|
+
import { comboBoxOverlay } from '@vaadin/combo-box/theme/lumo/vaadin-combo-box-overlay-styles.js';
|
|
9
|
+
import { item } from '@vaadin/item/theme/lumo/vaadin-item-styles.js';
|
|
7
10
|
import { inputFieldShared } from '@vaadin/vaadin-lumo-styles/mixins/input-field-shared.js';
|
|
11
|
+
import { menuOverlayCore } from '@vaadin/vaadin-lumo-styles/mixins/menu-overlay.js';
|
|
12
|
+
import { overlay } from '@vaadin/vaadin-lumo-styles/mixins/overlay.js';
|
|
8
13
|
import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
9
14
|
|
|
15
|
+
registerStyles('vaadin-time-picker-item', [item, comboBoxItem], {
|
|
16
|
+
moduleId: 'lumo-time-picker-item',
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
registerStyles(
|
|
20
|
+
'vaadin-time-picker-overlay',
|
|
21
|
+
[
|
|
22
|
+
overlay,
|
|
23
|
+
menuOverlayCore,
|
|
24
|
+
comboBoxOverlay,
|
|
25
|
+
css`
|
|
26
|
+
:host {
|
|
27
|
+
--_vaadin-time-picker-items-container-border-width: var(--lumo-space-xs);
|
|
28
|
+
--_vaadin-time-picker-items-container-border-style: solid;
|
|
29
|
+
}
|
|
30
|
+
`,
|
|
31
|
+
],
|
|
32
|
+
{
|
|
33
|
+
moduleId: 'lumo-time-picker-overlay',
|
|
34
|
+
},
|
|
35
|
+
);
|
|
36
|
+
|
|
10
37
|
const timePicker = css`
|
|
11
38
|
[part~='toggle-button']::before {
|
|
12
39
|
content: var(--lumo-icons-clock);
|
|
@@ -3,8 +3,7 @@
|
|
|
3
3
|
* Copyright (c) 2018 - 2023 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
-
import '@vaadin/combo-box/theme/lumo/vaadin-combo-box-dropdown-styles.js';
|
|
7
|
-
import '@vaadin/combo-box/theme/lumo/vaadin-combo-box-item-styles.js';
|
|
8
6
|
import '@vaadin/input-container/theme/lumo/vaadin-input-container.js';
|
|
7
|
+
import '@vaadin/overlay/theme/lumo/vaadin-overlay.js';
|
|
9
8
|
import './vaadin-time-picker-styles.js';
|
|
10
9
|
import '../../src/vaadin-time-picker.js';
|
|
@@ -4,9 +4,34 @@
|
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import '@vaadin/vaadin-material-styles/font-icons.js';
|
|
7
|
+
import { comboBoxItem } from '@vaadin/combo-box/theme/material/vaadin-combo-box-item-styles.js';
|
|
8
|
+
import { comboBoxOverlay } from '@vaadin/combo-box/theme/material/vaadin-combo-box-overlay-styles.js';
|
|
9
|
+
import { item } from '@vaadin/item/theme/material/vaadin-item-styles.js';
|
|
7
10
|
import { inputFieldShared } from '@vaadin/vaadin-material-styles/mixins/input-field-shared.js';
|
|
11
|
+
import { menuOverlay } from '@vaadin/vaadin-material-styles/mixins/menu-overlay.js';
|
|
8
12
|
import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
9
13
|
|
|
14
|
+
registerStyles('vaadin-time-picker-item', [item, comboBoxItem], {
|
|
15
|
+
moduleId: 'material-time-picker-item',
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
registerStyles(
|
|
19
|
+
'vaadin-time-picker-overlay',
|
|
20
|
+
[
|
|
21
|
+
menuOverlay,
|
|
22
|
+
comboBoxOverlay,
|
|
23
|
+
css`
|
|
24
|
+
:host {
|
|
25
|
+
--_vaadin-time-picker-items-container-border-width: 8px 0;
|
|
26
|
+
--_vaadin-time-picker-items-container-border-style: solid;
|
|
27
|
+
}
|
|
28
|
+
`,
|
|
29
|
+
],
|
|
30
|
+
{
|
|
31
|
+
moduleId: 'material-time-picker-overlay',
|
|
32
|
+
},
|
|
33
|
+
);
|
|
34
|
+
|
|
10
35
|
const timePicker = css`
|
|
11
36
|
[part~='toggle-button']::before {
|
|
12
37
|
content: var(--material-icons-clock);
|
|
@@ -3,8 +3,7 @@
|
|
|
3
3
|
* Copyright (c) 2018 - 2023 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
-
import '@vaadin/combo-box/theme/material/vaadin-combo-box-dropdown-styles.js';
|
|
7
|
-
import '@vaadin/combo-box/theme/material/vaadin-combo-box-item-styles.js';
|
|
8
6
|
import '@vaadin/input-container/theme/material/vaadin-input-container.js';
|
|
7
|
+
import '@vaadin/overlay/theme/material/vaadin-overlay.js';
|
|
9
8
|
import './vaadin-time-picker-styles.js';
|
|
10
9
|
import '../../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": "24.0.0-
|
|
4
|
+
"version": "24.0.0-beta2",
|
|
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-combo-box-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/24.0.0-
|
|
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-combo-box-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/24.0.0-beta2/#/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>` - has the same API as [`<vaadin-combo-box-light>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-beta2/#/elements/vaadin-combo-box-light).\n- `<vaadin-time-picker-overlay>` - has the same API as [`<vaadin-overlay>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-beta2/#/elements/vaadin-overlay).\n- `<vaadin-time-picker-item>` - has the same API as [`<vaadin-item>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-beta2/#/elements/vaadin-item).\n- [`<vaadin-input-container>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-beta2/#/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/custom-theme/styling-components) documentation.",
|
|
12
12
|
"attributes": [
|
|
13
13
|
{
|
|
14
14
|
"name": "disabled",
|
|
@@ -97,30 +97,30 @@
|
|
|
97
97
|
}
|
|
98
98
|
},
|
|
99
99
|
{
|
|
100
|
-
"name": "
|
|
101
|
-
"description": "
|
|
100
|
+
"name": "clear-button-visible",
|
|
101
|
+
"description": "Set to true to display the clear icon which clears the input.\n\nIt is up to the component to choose where to place the clear icon:\nin the Shadow DOM or in the light DOM. In any way, a reference to\nthe clear icon element should be provided via the `clearElement` getter.",
|
|
102
102
|
"value": {
|
|
103
103
|
"type": [
|
|
104
|
-
"
|
|
104
|
+
"boolean",
|
|
105
105
|
"null",
|
|
106
106
|
"undefined"
|
|
107
107
|
]
|
|
108
108
|
}
|
|
109
109
|
},
|
|
110
110
|
{
|
|
111
|
-
"name": "
|
|
112
|
-
"description": "
|
|
111
|
+
"name": "allowed-char-pattern",
|
|
112
|
+
"description": "A pattern matched against individual characters the user inputs.\n\nWhen set, the field will prevent:\n- `keydown` events if the entered key doesn't match `/^allowedCharPattern$/`\n- `paste` events if the pasted text doesn't match `/^allowedCharPattern*$/`\n- `drop` events if the dropped text doesn't match `/^allowedCharPattern*$/`\n\nFor example, to allow entering only numbers and minus signs, use:\n`allowedCharPattern = \"[\\\\d-]\"`",
|
|
113
113
|
"value": {
|
|
114
114
|
"type": [
|
|
115
|
-
"
|
|
115
|
+
"string",
|
|
116
116
|
"null",
|
|
117
117
|
"undefined"
|
|
118
118
|
]
|
|
119
119
|
}
|
|
120
120
|
},
|
|
121
121
|
{
|
|
122
|
-
"name": "
|
|
123
|
-
"description": "
|
|
122
|
+
"name": "autoselect",
|
|
123
|
+
"description": "If true, the input text gets fully selected when the field is focused using click or touch / tap.",
|
|
124
124
|
"value": {
|
|
125
125
|
"type": [
|
|
126
126
|
"boolean",
|
|
@@ -235,6 +235,17 @@
|
|
|
235
235
|
]
|
|
236
236
|
}
|
|
237
237
|
},
|
|
238
|
+
{
|
|
239
|
+
"name": "overlay-class",
|
|
240
|
+
"description": "A space-delimited list of CSS class names to set on the overlay element.",
|
|
241
|
+
"value": {
|
|
242
|
+
"type": [
|
|
243
|
+
"string",
|
|
244
|
+
"null",
|
|
245
|
+
"undefined"
|
|
246
|
+
]
|
|
247
|
+
}
|
|
248
|
+
},
|
|
238
249
|
{
|
|
239
250
|
"name": "theme",
|
|
240
251
|
"description": "The theme variants to apply to the component.",
|
|
@@ -336,30 +347,30 @@
|
|
|
336
347
|
}
|
|
337
348
|
},
|
|
338
349
|
{
|
|
339
|
-
"name": "
|
|
340
|
-
"description": "
|
|
350
|
+
"name": "clearButtonVisible",
|
|
351
|
+
"description": "Set to true to display the clear icon which clears the input.\n\nIt is up to the component to choose where to place the clear icon:\nin the Shadow DOM or in the light DOM. In any way, a reference to\nthe clear icon element should be provided via the `clearElement` getter.",
|
|
341
352
|
"value": {
|
|
342
353
|
"type": [
|
|
343
|
-
"
|
|
354
|
+
"boolean",
|
|
344
355
|
"null",
|
|
345
356
|
"undefined"
|
|
346
357
|
]
|
|
347
358
|
}
|
|
348
359
|
},
|
|
349
360
|
{
|
|
350
|
-
"name": "
|
|
351
|
-
"description": "
|
|
361
|
+
"name": "allowedCharPattern",
|
|
362
|
+
"description": "A pattern matched against individual characters the user inputs.\n\nWhen set, the field will prevent:\n- `keydown` events if the entered key doesn't match `/^allowedCharPattern$/`\n- `paste` events if the pasted text doesn't match `/^allowedCharPattern*$/`\n- `drop` events if the dropped text doesn't match `/^allowedCharPattern*$/`\n\nFor example, to allow entering only numbers and minus signs, use:\n`allowedCharPattern = \"[\\\\d-]\"`",
|
|
352
363
|
"value": {
|
|
353
364
|
"type": [
|
|
354
|
-
"
|
|
365
|
+
"string",
|
|
355
366
|
"null",
|
|
356
367
|
"undefined"
|
|
357
368
|
]
|
|
358
369
|
}
|
|
359
370
|
},
|
|
360
371
|
{
|
|
361
|
-
"name": "
|
|
362
|
-
"description": "
|
|
372
|
+
"name": "autoselect",
|
|
373
|
+
"description": "If true, the input text gets fully selected when the field is focused using click or touch / tap.",
|
|
363
374
|
"value": {
|
|
364
375
|
"type": [
|
|
365
376
|
"boolean",
|
|
@@ -474,6 +485,17 @@
|
|
|
474
485
|
]
|
|
475
486
|
}
|
|
476
487
|
},
|
|
488
|
+
{
|
|
489
|
+
"name": "overlayClass",
|
|
490
|
+
"description": "A space-delimited list of CSS class names to set on the overlay element.",
|
|
491
|
+
"value": {
|
|
492
|
+
"type": [
|
|
493
|
+
"string",
|
|
494
|
+
"null",
|
|
495
|
+
"undefined"
|
|
496
|
+
]
|
|
497
|
+
}
|
|
498
|
+
},
|
|
477
499
|
{
|
|
478
500
|
"name": "i18n",
|
|
479
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.",
|
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": "24.0.0-
|
|
4
|
+
"version": "24.0.0-beta2",
|
|
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-combo-box-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/24.0.0-
|
|
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-combo-box-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/24.0.0-beta2/#/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>` - has the same API as [`<vaadin-combo-box-light>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-beta2/#/elements/vaadin-combo-box-light).\n- `<vaadin-time-picker-overlay>` - has the same API as [`<vaadin-overlay>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-beta2/#/elements/vaadin-overlay).\n- `<vaadin-time-picker-item>` - has the same API as [`<vaadin-item>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-beta2/#/elements/vaadin-item).\n- [`<vaadin-input-container>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-beta2/#/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/custom-theme/styling-components) documentation.",
|
|
20
20
|
"extension": true,
|
|
21
21
|
"attributes": [
|
|
22
22
|
{
|
|
@@ -48,15 +48,15 @@
|
|
|
48
48
|
}
|
|
49
49
|
},
|
|
50
50
|
{
|
|
51
|
-
"name": "?
|
|
52
|
-
"description": "
|
|
51
|
+
"name": "?clearButtonVisible",
|
|
52
|
+
"description": "Set to true to display the clear icon which clears the input.\n\nIt is up to the component to choose where to place the clear icon:\nin the Shadow DOM or in the light DOM. In any way, a reference to\nthe clear icon element should be provided via the `clearElement` getter.",
|
|
53
53
|
"value": {
|
|
54
54
|
"kind": "expression"
|
|
55
55
|
}
|
|
56
56
|
},
|
|
57
57
|
{
|
|
58
|
-
"name": "?
|
|
59
|
-
"description": "
|
|
58
|
+
"name": "?autoselect",
|
|
59
|
+
"description": "If true, the input text gets fully selected when the field is focused using click or touch / tap.",
|
|
60
60
|
"value": {
|
|
61
61
|
"kind": "expression"
|
|
62
62
|
}
|
|
@@ -166,6 +166,13 @@
|
|
|
166
166
|
"kind": "expression"
|
|
167
167
|
}
|
|
168
168
|
},
|
|
169
|
+
{
|
|
170
|
+
"name": ".overlayClass",
|
|
171
|
+
"description": "A space-delimited list of CSS class names to set on the overlay element.",
|
|
172
|
+
"value": {
|
|
173
|
+
"kind": "expression"
|
|
174
|
+
}
|
|
175
|
+
},
|
|
169
176
|
{
|
|
170
177
|
"name": ".i18n",
|
|
171
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.",
|