@vaadin/date-picker 25.2.0-alpha8 → 25.2.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.
@@ -16,20 +16,20 @@ export const monthCalendarStyles = css`
16
16
  color: var(--vaadin-date-picker-month-header-color, var(--vaadin-text-color));
17
17
  font-size: var(--vaadin-date-picker-month-header-font-size, 0.9375rem);
18
18
  font-weight: var(--vaadin-date-picker-month-header-font-weight, 500);
19
- line-height: inherit;
19
+ line-height: 1;
20
20
  margin-bottom: 0.75rem;
21
21
  text-align: center;
22
22
  }
23
23
 
24
24
  table {
25
- border-collapse: collapse;
26
- display: flex;
27
- flex-direction: column;
25
+ display: grid;
26
+ grid-template-columns: repeat(7, 1fr);
28
27
  }
29
28
 
29
+ thead,
30
+ tbody,
30
31
  tr {
31
- display: flex;
32
- flex-wrap: wrap;
32
+ display: contents;
33
33
  }
34
34
 
35
35
  [part~='weekday'] {
@@ -37,7 +37,6 @@ export const monthCalendarStyles = css`
37
37
  font-size: var(--vaadin-date-picker-weekday-font-size, 0.75rem);
38
38
  font-weight: var(--vaadin-date-picker-weekday-font-weight, 500);
39
39
  margin-bottom: 0.375rem;
40
- width: var(--vaadin-date-picker-date-width, 2rem);
41
40
  }
42
41
 
43
42
  /* Week numbers are on a separate row, don't reserve space on weekday row. */
@@ -46,10 +45,10 @@ export const monthCalendarStyles = css`
46
45
  }
47
46
 
48
47
  [part~='week-number'] {
48
+ grid-column: -1 / 1;
49
49
  color: var(--vaadin-date-picker-week-number-color, var(--vaadin-text-color-secondary));
50
50
  font-size: var(--vaadin-date-picker-week-number-font-size, 0.7rem);
51
51
  line-height: 1;
52
- width: 100%;
53
52
  margin-top: 0.125em;
54
53
  margin-bottom: 0.125em;
55
54
  gap: 0.25em;
@@ -77,7 +76,6 @@ export const monthCalendarStyles = css`
77
76
  [part~='date'] {
78
77
  border-radius: var(--vaadin-date-picker-date-border-radius, var(--vaadin-radius-m));
79
78
  position: relative;
80
- width: var(--vaadin-date-picker-date-width, 2rem);
81
79
  height: var(--vaadin-date-picker-date-height, 2rem);
82
80
  cursor: var(--vaadin-clickable-cursor);
83
81
  outline: none;
@@ -88,11 +86,11 @@ export const monthCalendarStyles = css`
88
86
  content: '';
89
87
  position: absolute;
90
88
  z-index: -1;
91
- height: inherit;
89
+ height: min(2em, 100%);
92
90
  aspect-ratio: 1;
93
91
  }
94
92
 
95
- :where([part~='date']:focus)::after {
93
+ :where([part~='date']:focus-visible)::after {
96
94
  outline: var(--vaadin-focus-ring-width) solid var(--vaadin-focus-ring-color);
97
95
  outline-offset: calc(var(--vaadin-focus-ring-width) * -1);
98
96
  }
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2000 - 2026 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2026 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import type { DatePickerDate } from './vaadin-date-picker-mixin.js';
@@ -78,19 +78,8 @@ export const datePickerI18nDefaults = Object.freeze({
78
78
  },
79
79
  });
80
80
 
81
- /**
82
- * @polymerMixin
83
- * @mixes DelegateFocusMixin
84
- * @mixes I18nMixin
85
- * @mixes InputConstraintsMixin
86
- * @mixes KeyboardMixin
87
- * @param {function(new:HTMLElement)} subclass
88
- */
89
81
  export const DatePickerMixin = (subclass) =>
90
- class DatePickerMixinClass extends I18nMixin(
91
- datePickerI18nDefaults,
92
- DelegateFocusMixin(InputConstraintsMixin(KeyboardMixin(subclass))),
93
- ) {
82
+ class DatePickerMixinClass extends I18nMixin(DelegateFocusMixin(InputConstraintsMixin(KeyboardMixin(subclass)))) {
94
83
  static get properties() {
95
84
  return {
96
85
  /**
@@ -278,6 +267,10 @@ export const DatePickerMixin = (subclass) =>
278
267
  ];
279
268
  }
280
269
 
270
+ static get defaultI18n() {
271
+ return datePickerI18nDefaults;
272
+ }
273
+
281
274
  static get constraints() {
282
275
  return [...super.constraints, 'min', 'max'];
283
276
  }
@@ -1219,22 +1212,4 @@ export const DatePickerMixin = (subclass) =>
1219
1212
  __computeMinOrMaxDate(dateString) {
1220
1213
  return parseDate(dateString);
1221
1214
  }
1222
-
1223
- /**
1224
- * Fired when the user commits a value change.
1225
- *
1226
- * @event change
1227
- */
1228
-
1229
- /**
1230
- * Fired when `value` property value changes.
1231
- *
1232
- * @event value-changed
1233
- */
1234
-
1235
- /**
1236
- * Fired when `opened` property value changes.
1237
- *
1238
- * @event opened-changed
1239
- */
1240
1215
  };
@@ -10,9 +10,6 @@ import { MediaQueryController } from '@vaadin/component-base/src/media-query-con
10
10
  import { SlotController } from '@vaadin/component-base/src/slot-controller.js';
11
11
  import { dateAfterXMonths, dateAllowed, dateEquals, getClosestDate } from './vaadin-date-picker-helper.js';
12
12
 
13
- /**
14
- * @polymerMixin
15
- */
16
13
  export const DatePickerOverlayContentMixin = (superClass) =>
17
14
  class DatePickerOverlayContentMixin extends superClass {
18
15
  static get properties() {
@@ -290,14 +287,14 @@ export const DatePickerOverlayContentMixin = (superClass) =>
290
287
  /** @private */
291
288
  __updateCancelButton(cancelButton, i18n) {
292
289
  if (cancelButton) {
293
- cancelButton.textContent = i18n && i18n.cancel;
290
+ cancelButton.textContent = i18n?.cancel;
294
291
  }
295
292
  }
296
293
 
297
294
  /** @private */
298
295
  __updateTodayButton(todayButton, i18n, minDate, maxDate, isDateDisabled) {
299
296
  if (todayButton) {
300
- todayButton.textContent = i18n && i18n.today;
297
+ todayButton.textContent = i18n?.today;
301
298
  todayButton.disabled = !this._isTodayAllowed(minDate, maxDate, isDateDisabled);
302
299
  }
303
300
  }
@@ -316,7 +313,7 @@ export const DatePickerOverlayContentMixin = (superClass) =>
316
313
  isDateDisabled,
317
314
  enteredDate,
318
315
  ) {
319
- if (calendars && calendars.length) {
316
+ if (calendars?.length) {
320
317
  calendars.forEach((calendar) => {
321
318
  calendar.i18n = i18n;
322
319
  calendar.minDate = minDate;
@@ -339,7 +336,7 @@ export const DatePickerOverlayContentMixin = (superClass) =>
339
336
 
340
337
  /** @private */
341
338
  __updateYears(years, selectedDate, theme) {
342
- if (years && years.length) {
339
+ if (years?.length) {
343
340
  years.forEach((year) => {
344
341
  year.selectedDate = selectedDate;
345
342
 
@@ -933,11 +930,4 @@ export const DatePickerOverlayContentMixin = (superClass) =>
933
930
  todayMidnight.setDate(today.getDate());
934
931
  return todayMidnight;
935
932
  }
936
-
937
- /**
938
- * Fired when the scroller reaches the target scrolling position.
939
- * @event scroll-animation-finished
940
- * @param {Number} detail.position new position
941
- * @param {Number} detail.oldPosition old position
942
- */
943
933
  };
@@ -7,11 +7,6 @@ import { isElementFocusable } from '@vaadin/a11y-base/src/focus-utils.js';
7
7
  import { OverlayMixin } from '@vaadin/overlay/src/vaadin-overlay-mixin.js';
8
8
  import { PositionMixin } from '@vaadin/overlay/src/vaadin-overlay-position-mixin.js';
9
9
 
10
- /**
11
- * @polymerMixin
12
- * @mixes OverlayMixin
13
- * @mixes PositionMixin
14
- */
15
10
  export const DatePickerOverlayMixin = (superClass) =>
16
11
  class DatePickerOverlayMixin extends PositionMixin(OverlayMixin(superClass)) {
17
12
  /**
@@ -18,9 +18,6 @@ import { DatePickerOverlayMixin } from './vaadin-date-picker-overlay-mixin.js';
18
18
  *
19
19
  * @customElement vaadin-date-picker-overlay
20
20
  * @extends HTMLElement
21
- * @mixes DatePickerOverlayMixin
22
- * @mixes DirMixin
23
- * @mixes ThemableMixin
24
21
  * @private
25
22
  */
26
23
  class DatePickerOverlay extends DatePickerOverlayMixin(
@@ -15,7 +15,6 @@ import { datePickerYearStyles } from './styles/vaadin-date-picker-year-base-styl
15
15
  *
16
16
  * @customElement vaadin-date-picker-year
17
17
  * @extends HTMLElement
18
- * @mixes ThemableMixin
19
18
  * @private
20
19
  */
21
20
  export class DatePickerYear extends ThemableMixin(PolylitMixin(LumoInjectionMixin(LitElement))) {
@@ -152,10 +152,6 @@ import { DatePickerMixin } from './vaadin-date-picker-mixin.js';
152
152
  *
153
153
  * @customElement vaadin-date-picker
154
154
  * @extends HTMLElement
155
- * @mixes ElementMixin
156
- * @mixes ThemableMixin
157
- * @mixes InputControlMixin
158
- * @mixes DatePickerMixin
159
155
  */
160
156
  class DatePicker extends DatePickerMixin(
161
157
  InputControlMixin(ThemableMixin(ElementMixin(PolylitMixin(LumoInjectionMixin(LitElement))))),
@@ -285,7 +281,7 @@ class DatePicker extends DatePickerMixin(
285
281
  _onVaadinOverlayClose(e) {
286
282
  // Prevent closing the overlay on label element click
287
283
  const event = e.detail.sourceEvent;
288
- if (event && event.composedPath().includes(this) && !event.composedPath().includes(this._overlayElement)) {
284
+ if (event?.composedPath().includes(this) && !event.composedPath().includes(this._overlayElement)) {
289
285
  e.preventDefault();
290
286
  }
291
287
  }
@@ -7,10 +7,6 @@ import { FocusMixin } from '@vaadin/a11y-base/src/focus-mixin.js';
7
7
  import { addListener } from '@vaadin/component-base/src/gestures.js';
8
8
  import { dateAllowed, dateEquals, getISOWeekNumber, normalizeDate } from './vaadin-date-picker-helper.js';
9
9
 
10
- /**
11
- * @polymerMixin
12
- * @mixes FocusMixin
13
- */
14
10
  export const MonthCalendarMixin = (superClass) =>
15
11
  class MonthCalendarMixinClass extends FocusMixin(superClass) {
16
12
  static get properties() {
@@ -244,7 +240,7 @@ export const MonthCalendarMixin = (superClass) =>
244
240
  /** @protected */
245
241
  __computeShowWeekSeparator(showWeekNumbers, i18n) {
246
242
  // Currently only supported for locales that start the week on Monday.
247
- return showWeekNumbers && i18n && i18n.firstDayOfWeek === 1;
243
+ return showWeekNumbers && i18n?.firstDayOfWeek === 1;
248
244
  }
249
245
 
250
246
  /** @protected */