@vaadin/date-picker 25.0.0-alpha2 → 25.0.0-alpha20

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.
Files changed (40) hide show
  1. package/package.json +13 -14
  2. package/src/styles/vaadin-date-picker-base-styles.d.ts +8 -0
  3. package/src/{vaadin-date-picker-styles.js → styles/vaadin-date-picker-base-styles.js} +9 -0
  4. package/src/styles/vaadin-date-picker-overlay-base-styles.js +48 -0
  5. package/src/styles/vaadin-date-picker-overlay-content-base-styles.js +108 -0
  6. package/src/styles/vaadin-date-picker-year-base-styles.js +27 -0
  7. package/src/styles/vaadin-month-calendar-base-styles.js +143 -0
  8. package/src/vaadin-date-picker-helper.d.ts +5 -0
  9. package/src/vaadin-date-picker-helper.js +1 -1
  10. package/src/vaadin-date-picker-mixin.d.ts +1 -3
  11. package/src/vaadin-date-picker-mixin.js +45 -23
  12. package/src/vaadin-date-picker-month-scroller.js +2 -6
  13. package/src/vaadin-date-picker-overlay-content-mixin.js +5 -132
  14. package/src/vaadin-date-picker-overlay-content.js +19 -17
  15. package/src/vaadin-date-picker-overlay.js +17 -3
  16. package/src/vaadin-date-picker-year-scroller.js +3 -4
  17. package/src/vaadin-date-picker-year.js +32 -10
  18. package/src/vaadin-date-picker.d.ts +33 -24
  19. package/src/vaadin-date-picker.js +45 -28
  20. package/src/vaadin-infinite-scroller.js +1 -19
  21. package/src/vaadin-month-calendar.js +3 -2
  22. package/vaadin-date-picker.js +1 -1
  23. package/web-types.json +3 -25
  24. package/web-types.lit.json +3 -10
  25. package/src/vaadin-date-picker-overlay-content-styles.js +0 -68
  26. package/src/vaadin-date-picker-overlay-styles.js +0 -23
  27. package/src/vaadin-date-picker-year-mixin.js +0 -35
  28. package/src/vaadin-month-calendar-styles.js +0 -64
  29. package/theme/lumo/vaadin-date-picker-overlay-content-styles.d.ts +0 -7
  30. package/theme/lumo/vaadin-date-picker-overlay-content-styles.js +0 -164
  31. package/theme/lumo/vaadin-date-picker-overlay-styles.d.ts +0 -2
  32. package/theme/lumo/vaadin-date-picker-overlay-styles.js +0 -55
  33. package/theme/lumo/vaadin-date-picker-styles.d.ts +0 -2
  34. package/theme/lumo/vaadin-date-picker-styles.js +0 -30
  35. package/theme/lumo/vaadin-date-picker-year-styles.d.ts +0 -1
  36. package/theme/lumo/vaadin-date-picker-year-styles.js +0 -32
  37. package/theme/lumo/vaadin-date-picker.d.ts +0 -5
  38. package/theme/lumo/vaadin-date-picker.js +0 -5
  39. package/theme/lumo/vaadin-month-calendar-styles.d.ts +0 -5
  40. package/theme/lumo/vaadin-month-calendar-styles.js +0 -158
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaadin/date-picker",
3
- "version": "25.0.0-alpha2",
3
+ "version": "25.0.0-alpha20",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -21,7 +21,6 @@
21
21
  "type": "module",
22
22
  "files": [
23
23
  "src",
24
- "theme",
25
24
  "vaadin-*.d.ts",
26
25
  "vaadin-*.js",
27
26
  "web-types.json",
@@ -35,25 +34,25 @@
35
34
  ],
36
35
  "dependencies": {
37
36
  "@open-wc/dedupe-mixin": "^1.3.0",
38
- "@vaadin/a11y-base": "25.0.0-alpha2",
39
- "@vaadin/button": "25.0.0-alpha2",
40
- "@vaadin/component-base": "25.0.0-alpha2",
41
- "@vaadin/field-base": "25.0.0-alpha2",
42
- "@vaadin/input-container": "25.0.0-alpha2",
43
- "@vaadin/overlay": "25.0.0-alpha2",
44
- "@vaadin/vaadin-lumo-styles": "25.0.0-alpha2",
45
- "@vaadin/vaadin-themable-mixin": "25.0.0-alpha2",
37
+ "@vaadin/a11y-base": "25.0.0-alpha20",
38
+ "@vaadin/button": "25.0.0-alpha20",
39
+ "@vaadin/component-base": "25.0.0-alpha20",
40
+ "@vaadin/field-base": "25.0.0-alpha20",
41
+ "@vaadin/input-container": "25.0.0-alpha20",
42
+ "@vaadin/overlay": "25.0.0-alpha20",
43
+ "@vaadin/vaadin-themable-mixin": "25.0.0-alpha20",
46
44
  "lit": "^3.0.0"
47
45
  },
48
46
  "devDependencies": {
49
- "@vaadin/chai-plugins": "25.0.0-alpha2",
50
- "@vaadin/test-runner-commands": "25.0.0-alpha2",
47
+ "@vaadin/chai-plugins": "25.0.0-alpha20",
48
+ "@vaadin/test-runner-commands": "25.0.0-alpha20",
51
49
  "@vaadin/testing-helpers": "^2.0.0",
52
- "sinon": "^18.0.0"
50
+ "@vaadin/vaadin-lumo-styles": "25.0.0-alpha20",
51
+ "sinon": "^21.0.0"
53
52
  },
54
53
  "web-types": [
55
54
  "web-types.json",
56
55
  "web-types.lit.json"
57
56
  ],
58
- "gitHead": "67ffcd5355cf21ce1b5039c598525109fc4c164b"
57
+ "gitHead": "c948aae591a30b432f3784000d4677674cae56e0"
59
58
  }
@@ -0,0 +1,8 @@
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 type { CSSResult } from 'lit';
7
+
8
+ export const datePickerStyles: CSSResult;
@@ -3,6 +3,7 @@
3
3
  * Copyright (c) 2016 - 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/styles/style-props.js';
6
7
  import { css } from 'lit';
7
8
 
8
9
  export const datePickerStyles = css`
@@ -10,6 +11,10 @@ export const datePickerStyles = css`
10
11
  pointer-events: auto;
11
12
  }
12
13
 
14
+ :host([week-numbers]) {
15
+ --_vaadin-date-picker-week-numbers-visible: 1;
16
+ }
17
+
13
18
  :host([dir='rtl']) [part='input-field'] {
14
19
  direction: ltr;
15
20
  }
@@ -18,4 +23,8 @@ export const datePickerStyles = css`
18
23
  direction: rtl;
19
24
  text-align: left;
20
25
  }
26
+
27
+ [part~='toggle-button']::before {
28
+ mask-image: var(--_vaadin-icon-calendar);
29
+ }
21
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,108 @@
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/styles/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
+ align-items: center;
33
+ border-radius: var(--vaadin-button-border-radius, var(--vaadin-radius-m));
34
+ color: var(--vaadin-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-text-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-secondary);
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
69
+ var(--vaadin-date-picker-year-scroller-border-color, var(--vaadin-border-color-secondary));
70
+ overflow: visible;
71
+ min-height: 0;
72
+ clip-path: inset(0);
73
+ }
74
+
75
+ ::slotted([slot='years'])::before {
76
+ background: var(--vaadin-overlay-background, var(--vaadin-background-color));
77
+ border: 1px solid var(--vaadin-date-picker-year-scroller-border-color, var(--vaadin-border-color-secondary));
78
+ width: 16px;
79
+ height: 16px;
80
+ position: absolute;
81
+ left: auto;
82
+ z-index: 1;
83
+ rotate: 45deg;
84
+ translate: calc(-50% - 1px) -50%;
85
+ transform: none;
86
+ }
87
+
88
+ :host([dir='rtl']) ::slotted([slot='years'])::before {
89
+ translate: calc(50% + 1px) -50%;
90
+ }
91
+
92
+ :host([desktop]) ::slotted([slot='years']),
93
+ :host([years-visible]) ::slotted([slot='years']) {
94
+ visibility: visible;
95
+ }
96
+
97
+ [part='toolbar'] {
98
+ display: flex;
99
+ grid-area: toolbar;
100
+ justify-content: space-between;
101
+ padding: var(--vaadin-date-picker-toolbar-padding, var(--vaadin-padding-s));
102
+ }
103
+
104
+ :host([fullscreen]) [part='toolbar'] {
105
+ grid-area: header;
106
+ border-bottom: 1px solid var(--vaadin-border-color-secondary);
107
+ }
108
+ `;
@@ -0,0 +1,27 @@
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/styles/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
+ color: var(--vaadin-text-color-secondary);
22
+ }
23
+
24
+ :host([current]) [part='year-number'] {
25
+ color: var(--vaadin-date-picker-year-scroller-current-year-color, var(--vaadin-text-color));
26
+ }
27
+ `;
@@ -0,0 +1,143 @@
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/styles/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-s));
13
+ }
14
+
15
+ [part='month-header'] {
16
+ color: var(--vaadin-date-picker-month-header-color, var(--vaadin-text-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, var(--vaadin-text-color-secondary));
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, var(--vaadin-text-color-secondary));
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(
63
+ --vaadin-date-picker-week-divider-color,
64
+ var(--vaadin-divider-color, var(--vaadin-border-color-secondary))
65
+ );
66
+ }
67
+
68
+ [part~='weekday'],
69
+ [part~='week-number'],
70
+ [part~='date'] {
71
+ align-items: center;
72
+ display: flex;
73
+ justify-content: center;
74
+ padding: 0;
75
+ }
76
+
77
+ [part~='date'] {
78
+ border-radius: var(--vaadin-date-picker-date-border-radius, var(--vaadin-radius-m));
79
+ position: relative;
80
+ width: var(--vaadin-date-picker-date-width, 2rem);
81
+ height: var(--vaadin-date-picker-date-height, 2rem);
82
+ cursor: var(--vaadin-clickable-cursor);
83
+ outline: none;
84
+ }
85
+
86
+ [part~='date']::after {
87
+ border-radius: inherit;
88
+ content: '';
89
+ position: absolute;
90
+ z-index: -1;
91
+ height: inherit;
92
+ aspect-ratio: 1;
93
+ }
94
+
95
+ :where([part~='date']:focus)::after {
96
+ outline: var(--vaadin-focus-ring-width) solid var(--vaadin-focus-ring-color);
97
+ outline-offset: calc(var(--vaadin-focus-ring-width) * -1);
98
+ }
99
+
100
+ [part~='today'] {
101
+ color: var(--vaadin-date-picker-date-today-color, var(--vaadin-text-color));
102
+ }
103
+
104
+ [part~='selected'] {
105
+ color: var(--vaadin-date-picker-date-selected-color, var(--vaadin-background-color));
106
+ }
107
+
108
+ [part~='selected']::after {
109
+ background: var(--vaadin-date-picker-date-selected-background, var(--vaadin-text-color));
110
+ outline-offset: 1px;
111
+ }
112
+
113
+ [disabled] {
114
+ cursor: var(--vaadin-disabled-cursor);
115
+ color: var(--vaadin-date-picker-date-disabled-color, var(--vaadin-text-color-disabled));
116
+ opacity: 0.7;
117
+ }
118
+
119
+ [hidden] {
120
+ display: none;
121
+ }
122
+
123
+ @media (forced-colors: active) {
124
+ [part~='week-number']::after {
125
+ background: CanvasText;
126
+ }
127
+
128
+ [part~='today'] {
129
+ font-weight: 600;
130
+ }
131
+
132
+ [part~='selected'] {
133
+ forced-color-adjust: none;
134
+ --vaadin-date-picker-date-selected-color: SelectedItemText;
135
+ color: SelectedItemText !important;
136
+ --vaadin-date-picker-date-selected-background: SelectedItem;
137
+ }
138
+
139
+ [disabled] {
140
+ color: GrayText !important;
141
+ }
142
+ }
143
+ `;
@@ -1,3 +1,8 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2000 - 2025 Vaadin Ltd.
4
+ * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
+ */
1
6
  import type { DatePickerDate } from './vaadin-date-picker-mixin.js';
2
7
 
3
8
  /**
@@ -7,7 +7,7 @@
7
7
  /**
8
8
  * Get ISO 8601 week number for the given date.
9
9
  *
10
- * @param {!Date} Date object
10
+ * @param {!Date} date
11
11
  * @return {number} Week number
12
12
  */
13
13
  export function getISOWeekNumber(date) {
@@ -9,7 +9,6 @@ import type { DisabledMixinClass } from '@vaadin/a11y-base/src/disabled-mixin.js
9
9
  import type { FocusMixinClass } from '@vaadin/a11y-base/src/focus-mixin.js';
10
10
  import type { KeyboardMixinClass } from '@vaadin/a11y-base/src/keyboard-mixin.js';
11
11
  import type { I18nMixinClass } from '@vaadin/component-base/src/i18n-mixin.js';
12
- import type { OverlayClassMixinClass } from '@vaadin/component-base/src/overlay-class-mixin.js';
13
12
  import type { InputConstraintsMixinClass } from '@vaadin/field-base/src/input-constraints-mixin.js';
14
13
  import type { InputMixinClass } from '@vaadin/field-base/src/input-mixin.js';
15
14
 
@@ -96,7 +95,6 @@ export declare function DatePickerMixin<T extends Constructor<HTMLElement>>(
96
95
  Constructor<InputConstraintsMixinClass> &
97
96
  Constructor<InputMixinClass> &
98
97
  Constructor<KeyboardMixinClass> &
99
- Constructor<OverlayClassMixinClass> &
100
98
  T;
101
99
 
102
100
  export declare class DatePickerMixinClass {
@@ -143,7 +141,7 @@ export declare class DatePickerMixinClass {
143
141
  *
144
142
  * The object has the following JSON structure and default values:
145
143
  *
146
- * ```
144
+ * ```js
147
145
  * {
148
146
  * // An array with the full names of months starting
149
147
  * // with January.
@@ -10,7 +10,6 @@ import { KeyboardMixin } from '@vaadin/a11y-base/src/keyboard-mixin.js';
10
10
  import { isIOS } from '@vaadin/component-base/src/browser-utils.js';
11
11
  import { I18nMixin } from '@vaadin/component-base/src/i18n-mixin.js';
12
12
  import { MediaQueryController } from '@vaadin/component-base/src/media-query-controller.js';
13
- import { OverlayClassMixin } from '@vaadin/component-base/src/overlay-class-mixin.js';
14
13
  import { InputConstraintsMixin } from '@vaadin/field-base/src/input-constraints-mixin.js';
15
14
  import { VirtualKeyboardController } from '@vaadin/field-base/src/virtual-keyboard-controller.js';
16
15
  import {
@@ -85,13 +84,12 @@ export const datePickerI18nDefaults = Object.freeze({
85
84
  * @mixes I18nMixin
86
85
  * @mixes InputConstraintsMixin
87
86
  * @mixes KeyboardMixin
88
- * @mixes OverlayClassMixin
89
87
  * @param {function(new:HTMLElement)} subclass
90
88
  */
91
89
  export const DatePickerMixin = (subclass) =>
92
90
  class DatePickerMixinClass extends I18nMixin(
93
91
  datePickerI18nDefaults,
94
- OverlayClassMixin(DelegateFocusMixin(InputConstraintsMixin(KeyboardMixin(subclass)))),
92
+ DelegateFocusMixin(InputConstraintsMixin(KeyboardMixin(subclass))),
95
93
  ) {
96
94
  static get properties() {
97
95
  return {
@@ -295,7 +293,6 @@ export const DatePickerMixin = (subclass) =>
295
293
 
296
294
  this._boundOnClick = this._onClick.bind(this);
297
295
  this._boundOnScroll = this._onScroll.bind(this);
298
- this._boundOverlayRenderer = this._overlayRenderer.bind(this);
299
296
  }
300
297
 
301
298
  /**
@@ -305,7 +302,7 @@ export const DatePickerMixin = (subclass) =>
305
302
  *
306
303
  * The object has the following JSON structure and default values:
307
304
  *
308
- * ```
305
+ * ```js
309
306
  * {
310
307
  * // An array with the full names of months starting
311
308
  * // with January.
@@ -453,13 +450,17 @@ export const DatePickerMixin = (subclass) =>
453
450
 
454
451
  this.addController(new VirtualKeyboardController(this));
455
452
 
456
- const overlay = this.$.overlay;
457
- this._overlayElement = overlay;
453
+ this._overlayElement = this.$.overlay;
454
+ }
458
455
 
459
- overlay.renderer = this._boundOverlayRenderer;
456
+ /** @protected */
457
+ updated(props) {
458
+ super.updated(props);
460
459
 
461
- this.addEventListener('mousedown', () => this.__bringToFront());
462
- this.addEventListener('touchstart', () => this.__bringToFront());
460
+ if (props.has('showWeekNumbers') || props.has('__effectiveI18n')) {
461
+ // Currently only supported for locales that start the week on Monday.
462
+ this.toggleAttribute('week-numbers', this.showWeekNumbers && this.__effectiveI18n.firstDayOfWeek === 1);
463
+ }
463
464
  }
464
465
 
465
466
  /** @protected */
@@ -469,6 +470,19 @@ export const DatePickerMixin = (subclass) =>
469
470
  this.opened = false;
470
471
  }
471
472
 
473
+ /**
474
+ * @param {FocusOptions=} options
475
+ * @protected
476
+ * @override
477
+ */
478
+ focus(options) {
479
+ if (this._noInput && !isKeyboardActive()) {
480
+ this.open();
481
+ } else {
482
+ super.focus(options);
483
+ }
484
+ }
485
+
472
486
  /**
473
487
  * Opens the dropdown.
474
488
  */
@@ -486,14 +500,15 @@ export const DatePickerMixin = (subclass) =>
486
500
  }
487
501
 
488
502
  /** @private */
489
- _overlayRenderer(root) {
490
- if (root.firstChild) {
503
+ __ensureContent() {
504
+ if (this._overlayContent) {
491
505
  return;
492
506
  }
493
507
 
494
508
  // Create and store document content element
495
509
  const content = document.createElement('vaadin-date-picker-overlay-content');
496
- root.appendChild(content);
510
+ content.setAttribute('slot', 'overlay');
511
+ this.appendChild(content);
497
512
 
498
513
  this._overlayContent = content;
499
514
 
@@ -700,13 +715,6 @@ export const DatePickerMixin = (subclass) =>
700
715
  this.close();
701
716
  }
702
717
 
703
- /** @private */
704
- __bringToFront() {
705
- requestAnimationFrame(() => {
706
- this.$.overlay.bringToFront();
707
- });
708
- }
709
-
710
718
  /** @private */
711
719
  // eslint-disable-next-line @typescript-eslint/max-params
712
720
  _isNoInput(inputElement, fullscreen, ios, effectiveI18n, opened, autoOpenDisabled) {
@@ -740,6 +748,10 @@ export const DatePickerMixin = (subclass) =>
740
748
 
741
749
  /** @protected */
742
750
  _openedChanged(opened) {
751
+ if (opened) {
752
+ this.__ensureContent();
753
+ }
754
+
743
755
  if (this.inputElement) {
744
756
  this.inputElement.setAttribute('aria-expanded', opened);
745
757
  }
@@ -900,7 +912,7 @@ export const DatePickerMixin = (subclass) =>
900
912
  this._overlayContent.focusDateElement();
901
913
  }
902
914
 
903
- const focusables = this._noInput ? content : [input, content];
915
+ const focusables = this._noInput ? content : this;
904
916
  this.__showOthers = hideOthers(focusables);
905
917
  }
906
918
 
@@ -1019,6 +1031,11 @@ export const DatePickerMixin = (subclass) =>
1019
1031
  * @private
1020
1032
  */
1021
1033
  _onClick(event) {
1034
+ // Ignore click events bubbling from the overlay
1035
+ if (event.composedPath().includes(this._overlayElement)) {
1036
+ return;
1037
+ }
1038
+
1022
1039
  // Clear button click is handled in separate listener
1023
1040
  // but bubbles to the host, so we need to ignore it.
1024
1041
  if (!this._isClearButton(event)) {
@@ -1103,11 +1120,16 @@ export const DatePickerMixin = (subclass) =>
1103
1120
  /**
1104
1121
  * Override an event listener from `KeyboardMixin`.
1105
1122
  *
1106
- * @param {!KeyboardEvent} _event
1123
+ * @param {!KeyboardEvent} event
1107
1124
  * @protected
1108
1125
  * @override
1109
1126
  */
1110
- _onEnter(_event) {
1127
+ _onEnter(event) {
1128
+ // Ignore Enter keydown event bubbling from the overlay
1129
+ if (event.composedPath().includes(this._overlayContent)) {
1130
+ return;
1131
+ }
1132
+
1111
1133
  if (this.opened) {
1112
1134
  // Closing will implicitly select parsed or focused date
1113
1135
  this.close();
@@ -12,12 +12,8 @@ stylesTemplate.innerHTML = `
12
12
  <style>
13
13
  :host {
14
14
  --vaadin-infinite-scroller-item-height: 270px;
15
- position: absolute;
16
- top: 0;
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
  `;