@vaadin/date-picker 25.0.0-alpha1 → 25.0.0-alpha10
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 +15 -13
- package/src/styles/vaadin-date-picker-base-styles.d.ts +8 -0
- package/src/styles/vaadin-date-picker-base-styles.js +30 -0
- package/src/styles/vaadin-date-picker-core-styles.d.ts +8 -0
- package/src/styles/vaadin-date-picker-overlay-base-styles.js +48 -0
- package/src/styles/vaadin-date-picker-overlay-content-base-styles.js +107 -0
- package/src/styles/vaadin-date-picker-overlay-content-core-styles.js +54 -0
- package/src/styles/vaadin-date-picker-year-base-styles.js +26 -0
- package/src/styles/vaadin-date-picker-year-core-styles.js +13 -0
- package/src/styles/vaadin-month-calendar-base-styles.js +140 -0
- package/src/vaadin-date-picker-helper.d.ts +5 -0
- package/src/vaadin-date-picker-mixin.js +45 -31
- package/src/vaadin-date-picker-month-scroller.js +2 -6
- package/src/vaadin-date-picker-overlay-content-mixin.js +5 -132
- package/src/vaadin-date-picker-overlay-content.js +13 -17
- package/src/vaadin-date-picker-overlay.js +17 -3
- package/src/vaadin-date-picker-year-scroller.js +3 -4
- package/src/vaadin-date-picker-year.js +32 -9
- package/src/vaadin-date-picker.d.ts +11 -11
- package/src/vaadin-date-picker.js +21 -14
- package/src/vaadin-infinite-scroller.js +1 -19
- package/src/vaadin-month-calendar.js +3 -2
- package/theme/lumo/vaadin-date-picker-overlay-content-styles.js +19 -46
- package/theme/lumo/vaadin-date-picker-overlay-styles.js +0 -1
- package/web-types.json +2 -2
- package/web-types.lit.json +2 -2
- package/src/vaadin-date-picker-overlay-content-styles.js +0 -68
- package/src/vaadin-date-picker-year-mixin.js +0 -35
- /package/src/{vaadin-date-picker-styles.js → styles/vaadin-date-picker-core-styles.js} +0 -0
- /package/src/{vaadin-date-picker-overlay-styles.js → styles/vaadin-date-picker-overlay-core-styles.js} +0 -0
- /package/src/{vaadin-month-calendar-styles.js → styles/vaadin-month-calendar-core-styles.js} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/date-picker",
|
|
3
|
-
"version": "25.0.0-
|
|
3
|
+
"version": "25.0.0-alpha10",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -21,6 +21,8 @@
|
|
|
21
21
|
"type": "module",
|
|
22
22
|
"files": [
|
|
23
23
|
"src",
|
|
24
|
+
"!src/styles/*-base-styles.d.ts",
|
|
25
|
+
"!src/styles/*-base-styles.js",
|
|
24
26
|
"theme",
|
|
25
27
|
"vaadin-*.d.ts",
|
|
26
28
|
"vaadin-*.js",
|
|
@@ -35,25 +37,25 @@
|
|
|
35
37
|
],
|
|
36
38
|
"dependencies": {
|
|
37
39
|
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
38
|
-
"@vaadin/a11y-base": "25.0.0-
|
|
39
|
-
"@vaadin/button": "25.0.0-
|
|
40
|
-
"@vaadin/component-base": "25.0.0-
|
|
41
|
-
"@vaadin/field-base": "25.0.0-
|
|
42
|
-
"@vaadin/input-container": "25.0.0-
|
|
43
|
-
"@vaadin/overlay": "25.0.0-
|
|
44
|
-
"@vaadin/vaadin-lumo-styles": "25.0.0-
|
|
45
|
-
"@vaadin/vaadin-themable-mixin": "25.0.0-
|
|
40
|
+
"@vaadin/a11y-base": "25.0.0-alpha10",
|
|
41
|
+
"@vaadin/button": "25.0.0-alpha10",
|
|
42
|
+
"@vaadin/component-base": "25.0.0-alpha10",
|
|
43
|
+
"@vaadin/field-base": "25.0.0-alpha10",
|
|
44
|
+
"@vaadin/input-container": "25.0.0-alpha10",
|
|
45
|
+
"@vaadin/overlay": "25.0.0-alpha10",
|
|
46
|
+
"@vaadin/vaadin-lumo-styles": "25.0.0-alpha10",
|
|
47
|
+
"@vaadin/vaadin-themable-mixin": "25.0.0-alpha10",
|
|
46
48
|
"lit": "^3.0.0"
|
|
47
49
|
},
|
|
48
50
|
"devDependencies": {
|
|
49
|
-
"@vaadin/chai-plugins": "25.0.0-
|
|
50
|
-
"@vaadin/test-runner-commands": "25.0.0-
|
|
51
|
-
"@vaadin/testing-helpers": "^
|
|
51
|
+
"@vaadin/chai-plugins": "25.0.0-alpha10",
|
|
52
|
+
"@vaadin/test-runner-commands": "25.0.0-alpha10",
|
|
53
|
+
"@vaadin/testing-helpers": "^2.0.0",
|
|
52
54
|
"sinon": "^18.0.0"
|
|
53
55
|
},
|
|
54
56
|
"web-types": [
|
|
55
57
|
"web-types.json",
|
|
56
58
|
"web-types.lit.json"
|
|
57
59
|
],
|
|
58
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "6cc6c94079e805fa5b2f0af4dbf3b2a7485e57d0"
|
|
59
61
|
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) 2016 - 2025 Vaadin Ltd.
|
|
4
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
+
*/
|
|
6
|
+
import '@vaadin/component-base/src/style-props.js';
|
|
7
|
+
import { css } from 'lit';
|
|
8
|
+
|
|
9
|
+
export const datePickerStyles = css`
|
|
10
|
+
:host([opened]) {
|
|
11
|
+
pointer-events: auto;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
:host([week-numbers]) {
|
|
15
|
+
--_vaadin-date-picker-week-numbers-visible: 1;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
:host([dir='rtl']) [part='input-field'] {
|
|
19
|
+
direction: ltr;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
:host([dir='rtl']) [part='input-field'] ::slotted(input)::placeholder {
|
|
23
|
+
direction: rtl;
|
|
24
|
+
text-align: left;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
[part='toggle-button']::before {
|
|
28
|
+
mask-image: var(--_vaadin-icon-calendar);
|
|
29
|
+
}
|
|
30
|
+
`;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) 2016 - 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 datePickerOverlayStyles = css`
|
|
9
|
+
[part='overlay'] {
|
|
10
|
+
display: flex;
|
|
11
|
+
flex: auto;
|
|
12
|
+
max-height: var(--vaadin-date-picker-overlay-max-height, 30rem);
|
|
13
|
+
box-sizing: content-box;
|
|
14
|
+
width: var(
|
|
15
|
+
--vaadin-date-picker-overlay-width,
|
|
16
|
+
calc(
|
|
17
|
+
var(--vaadin-date-picker-date-width, 2rem) * 7 + var(--vaadin-date-picker-month-padding, 0.5rem) * 2 +
|
|
18
|
+
var(--vaadin-date-picker-year-scroller-width, 3rem)
|
|
19
|
+
)
|
|
20
|
+
);
|
|
21
|
+
cursor: default;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
:host([fullscreen]) {
|
|
25
|
+
--vaadin-date-picker-date-width: calc(100% / 7);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
:host([fullscreen]) [part='backdrop'] {
|
|
29
|
+
display: block;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
:host([fullscreen]) [part='overlay'] {
|
|
33
|
+
border: none;
|
|
34
|
+
border-radius: 0;
|
|
35
|
+
max-height: 75vh;
|
|
36
|
+
width: 100%;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
[part~='content'] {
|
|
40
|
+
flex: auto;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
@media (max-width: 450px), (max-height: 450px) {
|
|
44
|
+
:host {
|
|
45
|
+
inset: auto 0 0 !important;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
`;
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) 2016 - 2025 Vaadin Ltd.
|
|
4
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
+
*/
|
|
6
|
+
import '@vaadin/component-base/src/style-props.js';
|
|
7
|
+
import { css } from 'lit';
|
|
8
|
+
|
|
9
|
+
export const overlayContentStyles = css`
|
|
10
|
+
:host {
|
|
11
|
+
display: grid;
|
|
12
|
+
grid-template-areas:
|
|
13
|
+
'header header'
|
|
14
|
+
'months years'
|
|
15
|
+
'toolbar years';
|
|
16
|
+
grid-template-columns: minmax(0, 1fr) 0;
|
|
17
|
+
height: 100%;
|
|
18
|
+
outline: none;
|
|
19
|
+
overflow: hidden;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
:host([desktop]) {
|
|
23
|
+
grid-template-columns: minmax(0, 1fr) auto;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
:host([fullscreen][years-visible]) {
|
|
27
|
+
grid-template-columns: minmax(0, 1fr) auto;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
[part='years-toggle-button'] {
|
|
31
|
+
display: inline-flex;
|
|
32
|
+
border: var(--vaadin-button-border, var(--vaadin-button-border-width, 1px) solid transparent);
|
|
33
|
+
border-radius: var(--vaadin-button-border-radius, var(--vaadin-radius-m));
|
|
34
|
+
color: var(--vaadin-button-text-color, var(--_vaadin-button-text-color));
|
|
35
|
+
font-size: var(--vaadin-button-font-size, inherit);
|
|
36
|
+
font-weight: var(--vaadin-button-font-weight, 500);
|
|
37
|
+
height: var(--vaadin-button-height, auto);
|
|
38
|
+
line-height: var(--vaadin-button-line-height, inherit);
|
|
39
|
+
padding: var(--vaadin-button-padding, var(--vaadin-padding-container));
|
|
40
|
+
cursor: var(--vaadin-clickable-cursor);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
:host([years-visible]) [part='years-toggle-button'] {
|
|
44
|
+
background: var(--vaadin-color);
|
|
45
|
+
color: var(--vaadin-background-color);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
[hidden] {
|
|
49
|
+
display: none !important;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
::slotted([slot='months']) {
|
|
53
|
+
--vaadin-infinite-scroller-item-height: calc(
|
|
54
|
+
16.5rem + var(--_vaadin-date-picker-week-numbers-visible, 0) *
|
|
55
|
+
(var(--vaadin-date-picker-week-number-font-size, 0.7rem) * 1.25 * 6)
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
:host([desktop]) ::slotted([slot='months']) {
|
|
60
|
+
border-bottom: 1px solid var(--vaadin-border-color);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
::slotted([slot='years']) {
|
|
64
|
+
visibility: hidden;
|
|
65
|
+
background: var(--vaadin-date-picker-year-scroller-background, var(--vaadin-background-container));
|
|
66
|
+
width: var(--vaadin-date-picker-year-scroller-width, 3rem);
|
|
67
|
+
box-sizing: border-box;
|
|
68
|
+
border-inline-start: 1px solid var(--vaadin-date-picker-year-scroller-border-color, var(--vaadin-border-color));
|
|
69
|
+
overflow: visible;
|
|
70
|
+
min-height: 0;
|
|
71
|
+
clip-path: inset(0);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
::slotted([slot='years'])::before {
|
|
75
|
+
background: var(--vaadin-overlay-background, var(--vaadin-background-color));
|
|
76
|
+
border: 1px solid var(--vaadin-date-picker-year-scroller-border-color, var(--vaadin-border-color));
|
|
77
|
+
width: 16px;
|
|
78
|
+
height: 16px;
|
|
79
|
+
position: absolute;
|
|
80
|
+
left: auto;
|
|
81
|
+
z-index: 1;
|
|
82
|
+
rotate: 45deg;
|
|
83
|
+
translate: calc(-50% - 1px) -50%;
|
|
84
|
+
transform: none;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
:host([dir='rtl']) ::slotted([slot='years'])::before {
|
|
88
|
+
translate: calc(50% + 1px) -50%;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
:host([desktop]) ::slotted([slot='years']),
|
|
92
|
+
:host([years-visible]) ::slotted([slot='years']) {
|
|
93
|
+
visibility: visible;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
[part='toolbar'] {
|
|
97
|
+
display: flex;
|
|
98
|
+
grid-area: toolbar;
|
|
99
|
+
justify-content: space-between;
|
|
100
|
+
padding: var(--vaadin-date-picker-toolbar-padding, var(--vaadin-padding));
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
:host([fullscreen]) [part='toolbar'] {
|
|
104
|
+
grid-area: header;
|
|
105
|
+
border-bottom: 1px solid var(--vaadin-border-color);
|
|
106
|
+
}
|
|
107
|
+
`;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) 2016 - 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 overlayContentStyles = css`
|
|
9
|
+
:host {
|
|
10
|
+
display: grid;
|
|
11
|
+
grid-template-areas:
|
|
12
|
+
'header header'
|
|
13
|
+
'months years'
|
|
14
|
+
'toolbar years';
|
|
15
|
+
grid-template-columns: minmax(0, 1fr) 0;
|
|
16
|
+
height: 100%;
|
|
17
|
+
outline: none;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
:host([desktop]) {
|
|
21
|
+
grid-template-columns: minmax(0, 1fr) auto;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
:host([fullscreen][years-visible]) {
|
|
25
|
+
grid-template-columns: minmax(0, 1fr) auto;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
[hidden] {
|
|
29
|
+
display: none !important;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
[part='years-toggle-button'] {
|
|
33
|
+
display: flex;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
::slotted([slot='years']) {
|
|
37
|
+
visibility: hidden;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
:host([desktop]) ::slotted([slot='years']),
|
|
41
|
+
:host([years-visible]) ::slotted([slot='years']) {
|
|
42
|
+
visibility: visible;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
[part='toolbar'] {
|
|
46
|
+
display: flex;
|
|
47
|
+
grid-area: toolbar;
|
|
48
|
+
justify-content: space-between;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
:host([fullscreen]) [part='toolbar'] {
|
|
52
|
+
grid-area: header;
|
|
53
|
+
}
|
|
54
|
+
`;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) 2016 - 2025 Vaadin Ltd.
|
|
4
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
+
*/
|
|
6
|
+
import '@vaadin/component-base/src/style-props.js';
|
|
7
|
+
import { css } from 'lit';
|
|
8
|
+
|
|
9
|
+
export const datePickerYearStyles = css`
|
|
10
|
+
:host {
|
|
11
|
+
display: block;
|
|
12
|
+
height: 100%;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
[part='year-number'] {
|
|
16
|
+
align-items: center;
|
|
17
|
+
display: flex;
|
|
18
|
+
height: 50%;
|
|
19
|
+
justify-content: center;
|
|
20
|
+
transform: translateY(-50%);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
:host([current]) [part='year-number'] {
|
|
24
|
+
color: var(--vaadin-date-picker-year-scroller-current-year-color, var(--vaadin-color));
|
|
25
|
+
}
|
|
26
|
+
`;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) 2016 - 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 datePickerYearStyles = css`
|
|
9
|
+
:host {
|
|
10
|
+
display: block;
|
|
11
|
+
height: 100%;
|
|
12
|
+
}
|
|
13
|
+
`;
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) 2016 - 2025 Vaadin Ltd.
|
|
4
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
+
*/
|
|
6
|
+
import '@vaadin/component-base/src/style-props.js';
|
|
7
|
+
import { css } from 'lit';
|
|
8
|
+
|
|
9
|
+
export const monthCalendarStyles = css`
|
|
10
|
+
:host {
|
|
11
|
+
display: block;
|
|
12
|
+
padding: var(--vaadin-date-picker-month-padding, var(--vaadin-padding));
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
[part='month-header'] {
|
|
16
|
+
color: var(--vaadin-date-picker-month-header-color, var(--vaadin-color));
|
|
17
|
+
font-size: var(--vaadin-date-picker-month-header-font-size, 0.9375rem);
|
|
18
|
+
font-weight: var(--vaadin-date-picker-month-header-font-weight, 500);
|
|
19
|
+
line-height: inherit;
|
|
20
|
+
margin-bottom: 0.75rem;
|
|
21
|
+
text-align: center;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
table {
|
|
25
|
+
border-collapse: collapse;
|
|
26
|
+
display: flex;
|
|
27
|
+
flex-direction: column;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
tr {
|
|
31
|
+
display: flex;
|
|
32
|
+
flex-wrap: wrap;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
[part~='weekday'] {
|
|
36
|
+
color: var(--vaadin-date-picker-weekday-color, inherit);
|
|
37
|
+
font-size: var(--vaadin-date-picker-weekday-font-size, 0.75rem);
|
|
38
|
+
font-weight: var(--vaadin-date-picker-weekday-font-weight, 500);
|
|
39
|
+
margin-bottom: 0.375rem;
|
|
40
|
+
width: var(--vaadin-date-picker-date-width, 2rem);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/* Week numbers are on a separate row, don't reserve space on weekday row. */
|
|
44
|
+
[part~='weekday']:empty {
|
|
45
|
+
display: none;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
[part~='week-number'] {
|
|
49
|
+
color: var(--vaadin-date-picker-week-number-color, inherit);
|
|
50
|
+
font-size: var(--vaadin-date-picker-week-number-font-size, 0.7rem);
|
|
51
|
+
line-height: 1;
|
|
52
|
+
width: 100%;
|
|
53
|
+
margin-top: 0.125em;
|
|
54
|
+
margin-bottom: 0.125em;
|
|
55
|
+
gap: 0.25em;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
[part~='week-number']::after {
|
|
59
|
+
content: '';
|
|
60
|
+
height: 1px;
|
|
61
|
+
flex: 1;
|
|
62
|
+
background: var(--vaadin-date-picker-week-divider-color, var(--vaadin-divider-color, var(--vaadin-border-color)));
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
[part~='weekday'],
|
|
66
|
+
[part~='week-number'],
|
|
67
|
+
[part~='date'] {
|
|
68
|
+
align-items: center;
|
|
69
|
+
display: flex;
|
|
70
|
+
justify-content: center;
|
|
71
|
+
padding: 0;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
[part~='date'] {
|
|
75
|
+
border-radius: var(--vaadin-date-picker-date-border-radius, var(--vaadin-radius-m));
|
|
76
|
+
position: relative;
|
|
77
|
+
width: var(--vaadin-date-picker-date-width, 2rem);
|
|
78
|
+
height: var(--vaadin-date-picker-date-height, 2rem);
|
|
79
|
+
cursor: var(--vaadin-clickable-cursor);
|
|
80
|
+
outline: none;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
[part~='date']::after {
|
|
84
|
+
border-radius: inherit;
|
|
85
|
+
content: '';
|
|
86
|
+
position: absolute;
|
|
87
|
+
z-index: -1;
|
|
88
|
+
height: inherit;
|
|
89
|
+
aspect-ratio: 1;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
:where([part~='date']:focus)::after {
|
|
93
|
+
outline: var(--vaadin-focus-ring-width) solid var(--vaadin-focus-ring-color);
|
|
94
|
+
outline-offset: calc(var(--vaadin-focus-ring-width) * -1);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
[part~='today'] {
|
|
98
|
+
color: var(--vaadin-date-picker-date-today-color, var(--vaadin-color));
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
[part~='selected'] {
|
|
102
|
+
color: var(--vaadin-date-picker-date-selected-color, var(--vaadin-background-color));
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
[part~='selected']::after {
|
|
106
|
+
background: var(--vaadin-date-picker-date-selected-background, var(--vaadin-color));
|
|
107
|
+
outline-offset: 1px;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
[disabled] {
|
|
111
|
+
cursor: var(--vaadin-disabled-cursor);
|
|
112
|
+
color: var(--vaadin-date-picker-date-disabled-color, var(--vaadin-color-disabled));
|
|
113
|
+
opacity: 0.7;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
[hidden] {
|
|
117
|
+
display: none;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
@media (forced-colors: active) {
|
|
121
|
+
[part~='week-number']::after {
|
|
122
|
+
background: CanvasText;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
[part~='today'] {
|
|
126
|
+
font-weight: 600;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
[part~='selected'] {
|
|
130
|
+
forced-color-adjust: none;
|
|
131
|
+
--vaadin-date-picker-date-selected-color: SelectedItemText;
|
|
132
|
+
color: SelectedItemText !important;
|
|
133
|
+
--vaadin-date-picker-date-selected-background: SelectedItem;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
[disabled] {
|
|
137
|
+
color: GrayText !important;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
`;
|
|
@@ -295,7 +295,6 @@ export const DatePickerMixin = (subclass) =>
|
|
|
295
295
|
|
|
296
296
|
this._boundOnClick = this._onClick.bind(this);
|
|
297
297
|
this._boundOnScroll = this._onScroll.bind(this);
|
|
298
|
-
this._boundOverlayRenderer = this._overlayRenderer.bind(this);
|
|
299
298
|
}
|
|
300
299
|
|
|
301
300
|
/**
|
|
@@ -395,15 +394,6 @@ export const DatePickerMixin = (subclass) =>
|
|
|
395
394
|
this.__setEnteredDate(parsedDate);
|
|
396
395
|
}
|
|
397
396
|
|
|
398
|
-
/** @private */
|
|
399
|
-
get _nativeInput() {
|
|
400
|
-
if (this.inputElement) {
|
|
401
|
-
// TODO: support focusElement for backwards compatibility
|
|
402
|
-
return this.inputElement.focusElement || this.inputElement;
|
|
403
|
-
}
|
|
404
|
-
return null;
|
|
405
|
-
}
|
|
406
|
-
|
|
407
397
|
/**
|
|
408
398
|
* The input element's value when it cannot be parsed as a date, and an empty string otherwise.
|
|
409
399
|
*
|
|
@@ -462,13 +452,17 @@ export const DatePickerMixin = (subclass) =>
|
|
|
462
452
|
|
|
463
453
|
this.addController(new VirtualKeyboardController(this));
|
|
464
454
|
|
|
465
|
-
|
|
466
|
-
|
|
455
|
+
this._overlayElement = this.$.overlay;
|
|
456
|
+
}
|
|
467
457
|
|
|
468
|
-
|
|
458
|
+
/** @protected */
|
|
459
|
+
updated(props) {
|
|
460
|
+
super.updated(props);
|
|
469
461
|
|
|
470
|
-
|
|
471
|
-
|
|
462
|
+
if (props.has('showWeekNumbers') || props.has('__effectiveI18n')) {
|
|
463
|
+
// Currently only supported for locales that start the week on Monday.
|
|
464
|
+
this.toggleAttribute('week-numbers', this.showWeekNumbers && this.__effectiveI18n.firstDayOfWeek === 1);
|
|
465
|
+
}
|
|
472
466
|
}
|
|
473
467
|
|
|
474
468
|
/** @protected */
|
|
@@ -478,6 +472,18 @@ export const DatePickerMixin = (subclass) =>
|
|
|
478
472
|
this.opened = false;
|
|
479
473
|
}
|
|
480
474
|
|
|
475
|
+
/**
|
|
476
|
+
* @protected
|
|
477
|
+
* @override
|
|
478
|
+
*/
|
|
479
|
+
focus(options) {
|
|
480
|
+
if (this._noInput && !isKeyboardActive()) {
|
|
481
|
+
this.open();
|
|
482
|
+
} else {
|
|
483
|
+
super.focus(options);
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
|
|
481
487
|
/**
|
|
482
488
|
* Opens the dropdown.
|
|
483
489
|
*/
|
|
@@ -495,14 +501,15 @@ export const DatePickerMixin = (subclass) =>
|
|
|
495
501
|
}
|
|
496
502
|
|
|
497
503
|
/** @private */
|
|
498
|
-
|
|
499
|
-
if (
|
|
504
|
+
__ensureContent() {
|
|
505
|
+
if (this._overlayContent) {
|
|
500
506
|
return;
|
|
501
507
|
}
|
|
502
508
|
|
|
503
509
|
// Create and store document content element
|
|
504
510
|
const content = document.createElement('vaadin-date-picker-overlay-content');
|
|
505
|
-
|
|
511
|
+
content.setAttribute('slot', 'overlay');
|
|
512
|
+
this.appendChild(content);
|
|
506
513
|
|
|
507
514
|
this._overlayContent = content;
|
|
508
515
|
|
|
@@ -709,13 +716,6 @@ export const DatePickerMixin = (subclass) =>
|
|
|
709
716
|
this.close();
|
|
710
717
|
}
|
|
711
718
|
|
|
712
|
-
/** @private */
|
|
713
|
-
__bringToFront() {
|
|
714
|
-
requestAnimationFrame(() => {
|
|
715
|
-
this.$.overlay.bringToFront();
|
|
716
|
-
});
|
|
717
|
-
}
|
|
718
|
-
|
|
719
719
|
/** @private */
|
|
720
720
|
// eslint-disable-next-line @typescript-eslint/max-params
|
|
721
721
|
_isNoInput(inputElement, fullscreen, ios, effectiveI18n, opened, autoOpenDisabled) {
|
|
@@ -749,6 +749,10 @@ export const DatePickerMixin = (subclass) =>
|
|
|
749
749
|
|
|
750
750
|
/** @protected */
|
|
751
751
|
_openedChanged(opened) {
|
|
752
|
+
if (opened) {
|
|
753
|
+
this.__ensureContent();
|
|
754
|
+
}
|
|
755
|
+
|
|
752
756
|
if (this.inputElement) {
|
|
753
757
|
this.inputElement.setAttribute('aria-expanded', opened);
|
|
754
758
|
}
|
|
@@ -903,7 +907,7 @@ export const DatePickerMixin = (subclass) =>
|
|
|
903
907
|
this._focus();
|
|
904
908
|
}
|
|
905
909
|
|
|
906
|
-
const input = this.
|
|
910
|
+
const input = this.inputElement;
|
|
907
911
|
if (this._noInput && input) {
|
|
908
912
|
input.blur();
|
|
909
913
|
this._overlayContent.focusDateElement();
|
|
@@ -969,8 +973,8 @@ export const DatePickerMixin = (subclass) =>
|
|
|
969
973
|
}
|
|
970
974
|
this.__commitParsedOrFocusedDate();
|
|
971
975
|
|
|
972
|
-
if (this.
|
|
973
|
-
this.
|
|
976
|
+
if (this.inputElement && this.inputElement.selectionStart) {
|
|
977
|
+
this.inputElement.selectionStart = this.inputElement.selectionEnd;
|
|
974
978
|
}
|
|
975
979
|
// No need to revalidate the value after `_selectedDateChanged`
|
|
976
980
|
// Needed in case the value was not changed: open and close dropdown,
|
|
@@ -1007,8 +1011,8 @@ export const DatePickerMixin = (subclass) =>
|
|
|
1007
1011
|
|
|
1008
1012
|
/** @private */
|
|
1009
1013
|
_setSelectionRange(a, b) {
|
|
1010
|
-
if (this.
|
|
1011
|
-
this.
|
|
1014
|
+
if (this.inputElement) {
|
|
1015
|
+
this.inputElement.setSelectionRange(a, b);
|
|
1012
1016
|
}
|
|
1013
1017
|
}
|
|
1014
1018
|
|
|
@@ -1028,6 +1032,11 @@ export const DatePickerMixin = (subclass) =>
|
|
|
1028
1032
|
* @private
|
|
1029
1033
|
*/
|
|
1030
1034
|
_onClick(event) {
|
|
1035
|
+
// Ignore click events bubbling from the overlay
|
|
1036
|
+
if (event.composedPath().includes(this._overlayContent)) {
|
|
1037
|
+
return;
|
|
1038
|
+
}
|
|
1039
|
+
|
|
1031
1040
|
// Clear button click is handled in separate listener
|
|
1032
1041
|
// but bubbles to the host, so we need to ignore it.
|
|
1033
1042
|
if (!this._isClearButton(event)) {
|
|
@@ -1116,7 +1125,12 @@ export const DatePickerMixin = (subclass) =>
|
|
|
1116
1125
|
* @protected
|
|
1117
1126
|
* @override
|
|
1118
1127
|
*/
|
|
1119
|
-
_onEnter(
|
|
1128
|
+
_onEnter(event) {
|
|
1129
|
+
// Ignore Enter keydown event bubbling from the overlay
|
|
1130
|
+
if (event.composedPath().includes(this._overlayContent)) {
|
|
1131
|
+
return;
|
|
1132
|
+
}
|
|
1133
|
+
|
|
1120
1134
|
if (this.opened) {
|
|
1121
1135
|
// Closing will implicitly select parsed or focused date
|
|
1122
1136
|
this.close();
|
|
@@ -12,12 +12,8 @@ stylesTemplate.innerHTML = `
|
|
|
12
12
|
<style>
|
|
13
13
|
:host {
|
|
14
14
|
--vaadin-infinite-scroller-item-height: 270px;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
left: 0;
|
|
18
|
-
right: 0;
|
|
19
|
-
bottom: 0;
|
|
20
|
-
height: 100%;
|
|
15
|
+
grid-area: months;
|
|
16
|
+
height: auto;
|
|
21
17
|
}
|
|
22
18
|
</style>
|
|
23
19
|
`;
|