@vaadin/date-picker 25.3.0-dev.1fa5a51482 → 25.3.0-rc1

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.
@@ -36,12 +36,6 @@ import { DatePickerMixin } from './vaadin-date-picker-mixin.js';
36
36
  *
37
37
  * ### Styling
38
38
  *
39
- * The following custom properties are available for styling:
40
- *
41
- * Custom property | Description | Default
42
- * -------------------------------|----------------------------|---------
43
- * `--vaadin-field-default-width` | Default width of the field | `12em`
44
- *
45
39
  * The following shadow DOM parts are available for styling:
46
40
  *
47
41
  * Part name | Description
@@ -75,6 +69,69 @@ import { DatePickerMixin } from './vaadin-date-picker-mixin.js';
75
69
  * `opened` | Set when the overlay is opened
76
70
  * `week-numbers` | Set when week numbers are shown in the calendar
77
71
  *
72
+ * The following custom CSS properties are available for styling:
73
+ *
74
+ * Custom CSS property |
75
+ * :----------------------------------------------------------|
76
+ * | `--vaadin-date-picker-date-border-radius` |
77
+ * | `--vaadin-date-picker-date-disabled-color` |
78
+ * | `--vaadin-date-picker-date-height` |
79
+ * | `--vaadin-date-picker-date-selected-background` |
80
+ * | `--vaadin-date-picker-date-selected-color` |
81
+ * | `--vaadin-date-picker-date-today-color` |
82
+ * | `--vaadin-date-picker-date-width` |
83
+ * | `--vaadin-date-picker-month-header-color` |
84
+ * | `--vaadin-date-picker-month-header-font-size` |
85
+ * | `--vaadin-date-picker-month-header-font-weight` |
86
+ * | `--vaadin-date-picker-month-padding` |
87
+ * | `--vaadin-date-picker-overlay-max-height` |
88
+ * | `--vaadin-date-picker-overlay-width` |
89
+ * | `--vaadin-date-picker-toolbar-padding` |
90
+ * | `--vaadin-date-picker-week-divider-color` |
91
+ * | `--vaadin-date-picker-week-number-color` |
92
+ * | `--vaadin-date-picker-week-number-font-size` |
93
+ * | `--vaadin-date-picker-weekday-color` |
94
+ * | `--vaadin-date-picker-weekday-font-size` |
95
+ * | `--vaadin-date-picker-weekday-font-weight` |
96
+ * | `--vaadin-date-picker-year-scroller-background` |
97
+ * | `--vaadin-date-picker-year-scroller-border-color` |
98
+ * | `--vaadin-date-picker-year-scroller-current-year-color` |
99
+ * | `--vaadin-date-picker-year-scroller-width` |
100
+ * | `--vaadin-field-default-width` |
101
+ * | `--vaadin-input-field-background` |
102
+ * | `--vaadin-input-field-border-color` |
103
+ * | `--vaadin-input-field-border-radius` |
104
+ * | `--vaadin-input-field-border-width` |
105
+ * | `--vaadin-input-field-bottom-end-radius` |
106
+ * | `--vaadin-input-field-bottom-start-radius` |
107
+ * | `--vaadin-input-field-button-text-color` |
108
+ * | `--vaadin-input-field-container-gap` |
109
+ * | `--vaadin-input-field-disabled-background` |
110
+ * | `--vaadin-input-field-disabled-text-color` |
111
+ * | `--vaadin-input-field-error-color` |
112
+ * | `--vaadin-input-field-error-font-size` |
113
+ * | `--vaadin-input-field-error-font-weight` |
114
+ * | `--vaadin-input-field-error-line-height` |
115
+ * | `--vaadin-input-field-gap` |
116
+ * | `--vaadin-input-field-helper-color` |
117
+ * | `--vaadin-input-field-helper-font-size` |
118
+ * | `--vaadin-input-field-helper-font-weight` |
119
+ * | `--vaadin-input-field-helper-line-height` |
120
+ * | `--vaadin-input-field-label-color` |
121
+ * | `--vaadin-input-field-label-font-size` |
122
+ * | `--vaadin-input-field-label-font-weight` |
123
+ * | `--vaadin-input-field-label-line-height` |
124
+ * | `--vaadin-input-field-padding` |
125
+ * | `--vaadin-input-field-placeholder-color` |
126
+ * | `--vaadin-input-field-required-indicator` |
127
+ * | `--vaadin-input-field-required-indicator-color` |
128
+ * | `--vaadin-input-field-top-end-radius` |
129
+ * | `--vaadin-input-field-top-start-radius` |
130
+ * | `--vaadin-input-field-value-color` |
131
+ * | `--vaadin-input-field-value-font-size` |
132
+ * | `--vaadin-input-field-value-font-weight` |
133
+ * | `--vaadin-input-field-value-line-height` |
134
+ *
78
135
  * ### Internal components
79
136
  *
80
137
  * In addition to `<vaadin-date-picker>` itself, the following internal
@@ -92,7 +149,7 @@ import { DatePickerMixin } from './vaadin-date-picker-mixin.js';
92
149
  * ----------------------|--------------------
93
150
  * `years-toggle-button` | Fullscreen mode years scroller toggle
94
151
  * `toolbar` | Toolbar with slotted buttons
95
- * `loader` | Loading spinner shown while data is being loaded, for example while the disabled dates provider resolves
152
+ * `loader` | Loading spinner shown while the date metadata provider is resolving
96
153
  *
97
154
  * The following state attributes are available on the `<vaadin-date-picker-overlay-content>` element:
98
155
  *
@@ -101,7 +158,7 @@ import { DatePickerMixin } from './vaadin-date-picker-mixin.js';
101
158
  * `desktop` | Set when the overlay content is in desktop mode
102
159
  * `fullscreen` | Set when the overlay content is in fullscreen mode
103
160
  * `years-visible` | Set when the year scroller is visible in fullscreen mode
104
- * `loading` | Set while data is being loaded, for example while the disabled dates provider resolves
161
+ * `loading` | Set while the date metadata provider is resolving
105
162
  *
106
163
  * In order to style the month calendar, use `<vaadin-month-calendar>` shadow DOM parts:
107
164
  *
@@ -114,17 +171,13 @@ import { DatePickerMixin } from './vaadin-date-picker-mixin.js';
114
171
  * `week-number` | Week number element
115
172
  * `date` | Date element
116
173
  * `disabled` | Disabled date element
117
- * `pending` | Date element in a month whose date metadata provider result is still loading
174
+ * `loading` | Date element in a month whose metadata is currently being fetched
118
175
  * `focused` | Focused date element
119
176
  * `selected` | Selected date element
120
177
  * `today` | Date element corresponding to the current day
121
178
  * `past` | Date element corresponding to the date in the past
122
179
  * `future` | Date element corresponding to the date in the future
123
180
  *
124
- * Custom part names returned per date by `dateMetadataProvider` (the `part` metadata field) are
125
- * also added to the matching date elements, so specific dates can be styled with
126
- * `vaadin-month-calendar::part(<name>)`.
127
- *
128
181
  * In order to style year scroller elements, use `<vaadin-date-picker-year>` shadow DOM parts:
129
182
  *
130
183
  * Part name | Description
@@ -37,6 +37,10 @@ template.innerHTML = `
37
37
  box-sizing: border-box;
38
38
  top: var(--vaadin-infinite-scroller-buffer-offset, 0);
39
39
  }
40
+
41
+ ::slotted(div) {
42
+ height: var(--vaadin-infinite-scroller-item-height);
43
+ }
40
44
  </style>
41
45
 
42
46
  <div id="scroller" tabindex="-1">
@@ -149,7 +153,7 @@ export class InfiniteScroller extends HTMLElement {
149
153
  this.$.scroller.scrollTop = this.itemHeight * (index - this._firstIndex) + this._buffers[0].translateY;
150
154
  } else {
151
155
  this._initialIndex = ~~index;
152
- this._reset();
156
+ this.reset();
153
157
  this._scrollDisabled = true;
154
158
  this.$.scroller.scrollTop += (index % 1) * this.itemHeight;
155
159
  this._scrollDisabled = false;
@@ -235,7 +239,7 @@ export class InfiniteScroller extends HTMLElement {
235
239
  });
236
240
 
237
241
  if (!this._buffers[0].translateY) {
238
- this._reset();
242
+ this.reset();
239
243
  }
240
244
 
241
245
  this._initDone = true;
@@ -262,7 +266,7 @@ export class InfiniteScroller extends HTMLElement {
262
266
  if (scrollTop < this._bufferHeight || scrollTop > this._initialScroll * 2 - this._bufferHeight) {
263
267
  // Scrolled near the end/beginning of the scrollable area -> reset.
264
268
  this._initialIndex = ~~this.position;
265
- this._reset();
269
+ this.reset();
266
270
  }
267
271
 
268
272
  // Check if we scrolled enough to translate the buffer positions.
@@ -288,8 +292,18 @@ export class InfiniteScroller extends HTMLElement {
288
292
  });
289
293
  }
290
294
 
291
- /** @private */
292
- _reset() {
295
+ /**
296
+ * Resets the scroller to the last starting index, and re-measures the
297
+ * item height in case the computed value of the CSS custom property
298
+ * has changed.
299
+ */
300
+ reset() {
301
+ if (!this._activated || !this.isConnected) {
302
+ return;
303
+ }
304
+
305
+ this._itemHeightVal = null;
306
+
293
307
  this._scrollDisabled = true;
294
308
  this.$.scroller.scrollTop = this._initialScroll;
295
309
  this._buffers[0].translateY = this._initialScroll - this._bufferHeight;
@@ -314,7 +328,6 @@ export class InfiniteScroller extends HTMLElement {
314
328
  this._buffers.forEach((buffer) => {
315
329
  for (let i = 0; i < this.bufferSize; i++) {
316
330
  const itemWrapper = document.createElement('div');
317
- itemWrapper.style.height = `${this.itemHeight}px`;
318
331
  itemWrapper.instance = {};
319
332
 
320
333
  const slotName = `vaadin-infinite-scroller-item-content-${generateUniqueId()}`;
@@ -4,8 +4,17 @@
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { FocusMixin } from '@vaadin/a11y-base/src/focus-mixin.js';
7
+ import { setOrRemoveAttribute } from '@vaadin/component-base/src/dom-utils.js';
7
8
  import { addListener } from '@vaadin/component-base/src/gestures.js';
8
- import { dateAllowed, dateEquals, getISOWeekNumber, normalizeDate } from './vaadin-date-picker-helper.js';
9
+ import {
10
+ dateAllowed,
11
+ dateEquals,
12
+ dateSelectable,
13
+ firstOfMonth,
14
+ getISOWeekNumber,
15
+ lastOfMonth,
16
+ normalizeDate,
17
+ } from './vaadin-date-picker-helper.js';
9
18
 
10
19
  export const MonthCalendarMixin = (superClass) =>
11
20
  class MonthCalendarMixinClass extends FocusMixin(superClass) {
@@ -88,25 +97,15 @@ export const MonthCalendarMixin = (superClass) =>
88
97
  },
89
98
 
90
99
  /**
91
- * The shared controller that resolves and caches the dates disabled by the date-picker's
92
- * `dateMetadataProvider`. Set by the overlay content; used to look up the disabled state
93
- * of this month's dates.
94
- * @type {object | undefined}
95
- * @private
100
+ * The date-picker's controller resolving the metadata returned by its
101
+ * `dateMetadataProvider`. Assigned by the overlay content, which also subscribes this
102
+ * calendar to it.
103
+ * @protected
96
104
  */
97
- dateMetadataController: {
105
+ _dateMetadataController: {
98
106
  type: Object,
99
107
  attribute: false,
100
- },
101
-
102
- /**
103
- * Bumped by the overlay content whenever the controller's cache or loading state changes,
104
- * to trigger a re-render of this month.
105
- * @private
106
- */
107
- __dateMetadataVersion: {
108
- type: Number,
109
- attribute: false,
108
+ sync: true,
110
109
  },
111
110
 
112
111
  enteredDate: {
@@ -122,8 +121,7 @@ export const MonthCalendarMixin = (superClass) =>
122
121
  /** @protected */
123
122
  _days: {
124
123
  type: Array,
125
- computed:
126
- '__computeDays(month, i18n, minDate, maxDate, isDateDisabled, dateMetadataController, __dateMetadataVersion)',
124
+ computed: '__computeDays(month, i18n, minDate, maxDate, isDateDisabled)',
127
125
  },
128
126
 
129
127
  /** @protected */
@@ -171,17 +169,8 @@ export const MonthCalendarMixin = (superClass) =>
171
169
  * @protected
172
170
  */
173
171
  __computeDisabled(month, minDate, maxDate) {
174
- // First day of the month
175
- const firstDate = new Date(0, 0);
176
- firstDate.setFullYear(month.getFullYear());
177
- firstDate.setMonth(month.getMonth());
178
- firstDate.setDate(1);
179
-
180
- // Last day of the month
181
- const lastDate = new Date(0, 0);
182
- lastDate.setFullYear(month.getFullYear());
183
- lastDate.setMonth(month.getMonth() + 1);
184
- lastDate.setDate(0);
172
+ const firstDate = firstOfMonth(month);
173
+ const lastDate = lastOfMonth(month);
185
174
 
186
175
  if (
187
176
  minDate &&
@@ -248,11 +237,8 @@ export const MonthCalendarMixin = (superClass) =>
248
237
 
249
238
  /** @private */
250
239
  __focusedDateChanged(focusedDate, days) {
251
- if (Array.isArray(days) && days.some((date) => dateEquals(date, focusedDate))) {
252
- this.removeAttribute('aria-hidden');
253
- } else {
254
- this.setAttribute('aria-hidden', 'true');
255
- }
240
+ const hasFocusedDate = Array.isArray(days) && days.some((date) => dateEquals(date, focusedDate));
241
+ setOrRemoveAttribute(this, 'aria-hidden', !hasFocusedDate);
256
242
  }
257
243
 
258
244
  /** @protected */
@@ -276,11 +262,7 @@ export const MonthCalendarMixin = (superClass) =>
276
262
  if (month === undefined || i18n === undefined) {
277
263
  return [];
278
264
  }
279
- // First day of the month (at midnight).
280
- const date = new Date(0, 0);
281
- date.setFullYear(month.getFullYear());
282
- date.setMonth(month.getMonth());
283
- date.setDate(1);
265
+ const date = firstOfMonth(month);
284
266
 
285
267
  // Rewind to first day of the week.
286
268
  while (date.getDay() !== i18n.firstDayOfWeek) {
@@ -353,11 +335,7 @@ export const MonthCalendarMixin = (superClass) =>
353
335
 
354
336
  /** @private */
355
337
  _showWeekNumbersChanged(showWeekNumbers, i18n) {
356
- if (this.__computeShowWeekSeparator(showWeekNumbers, i18n)) {
357
- this.setAttribute('week-numbers', '');
358
- } else {
359
- this.removeAttribute('week-numbers');
360
- }
338
+ this.toggleAttribute('week-numbers', this.__computeShowWeekSeparator(showWeekNumbers, i18n));
361
339
  }
362
340
 
363
341
  // eslint-disable-next-line @typescript-eslint/max-params
@@ -368,8 +346,8 @@ export const MonthCalendarMixin = (superClass) =>
368
346
  result.push('disabled');
369
347
  }
370
348
 
371
- if (date && this.__isMonthLoading()) {
372
- result.push('pending');
349
+ if (date && this.__isMonthPending()) {
350
+ result.push('loading');
373
351
  }
374
352
 
375
353
  if (dateEquals(date, focusedDate) && (hasFocus || dateEquals(date, enteredDate))) {
@@ -392,11 +370,10 @@ export const MonthCalendarMixin = (superClass) =>
392
370
  result.push('future');
393
371
  }
394
372
 
395
- // Custom part names supplied per date by `dateMetadataProvider`, so a theme can style
396
- // specific dates (e.g. mark a date as busy or almost fully booked) via `::part()`.
397
- const part = date && this.dateMetadataController?.getMetadata(date)?.part;
398
- if (part) {
399
- result.push(...(Array.isArray(part) ? part : String(part).split(' ')).filter(Boolean));
373
+ // Only a string can name parts, so anything else the provider set is ignored.
374
+ const customParts = date && this._dateMetadataController?.getMetadata(date)?.part;
375
+ if (customParts && typeof customParts === 'string') {
376
+ result.push(customParts);
400
377
  }
401
378
 
402
379
  return result.join(' ');
@@ -413,28 +390,28 @@ export const MonthCalendarMixin = (superClass) =>
413
390
  }
414
391
 
415
392
  /**
416
- * Whether the provider result for the currently displayed month is still pending. The overlay
417
- * drives loading for the whole visible range; here we only reflect the controller's state.
393
+ * Whether the displayed month is currently being fetched, which is the same state the overlay
394
+ * reports with its spinner. A month that has not been asked about yet is not pending: nothing is
395
+ * loading, so there is nothing to report.
418
396
  * @private
419
397
  */
420
- __isMonthLoading() {
421
- const controller = this.dateMetadataController;
422
- return !!controller?.provider && this.month !== undefined && !controller.isMonthLoaded(this.month);
398
+ __isMonthPending() {
399
+ return !!this._dateMetadataController?.isMonthPending(this.month);
423
400
  }
424
401
 
425
402
  /** @private */
426
403
  __isDayDisabled(date, minDate, maxDate, isDateDisabled) {
427
- if (!dateAllowed(date, minDate, maxDate, isDateDisabled)) {
428
- return true;
429
- }
430
- // A date is blocked while its month is pending (whole month non-selectable) or once the
431
- // resolved provider result marks it disabled.
432
- return !!this.dateMetadataController?.isDateBlocked(date);
404
+ return !dateSelectable(date, minDate, maxDate, isDateDisabled, this._dateMetadataController);
433
405
  }
434
406
 
435
407
  /** @private */
436
408
  __computeDayAriaDisabled(date, min, max, isDateDisabled) {
437
- if (date === undefined || (min === undefined && max === undefined && isDateDisabled === undefined)) {
409
+ if (date === undefined) {
410
+ return 'false';
411
+ }
412
+
413
+ const hasProvider = !!this._dateMetadataController?.provider;
414
+ if (!hasProvider && min === undefined && max === undefined && isDateDisabled === undefined) {
438
415
  return 'false';
439
416
  }
440
417
 
@@ -26,6 +26,10 @@ class MonthCalendar extends MonthCalendarMixin(ThemableMixin(PolylitMixin(LumoIn
26
26
  return monthCalendarStyles;
27
27
  }
28
28
 
29
+ static get lumoInjector() {
30
+ return { ...super.lumoInjector, includeBaseStyles: true };
31
+ }
32
+
29
33
  /** @protected */
30
34
  render() {
31
35
  const weekDayNames = this.__computeWeekDayNames(this.i18n, this.showWeekNumbers);
package/web-types.json CHANGED
@@ -1,18 +1,27 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/date-picker",
4
- "version": "25.3.0-dev.1fa5a51482",
4
+ "version": "25.3.0-rc1",
5
5
  "description-markup": "markdown",
6
6
  "contributions": {
7
7
  "html": {
8
8
  "elements": [
9
9
  {
10
10
  "name": "vaadin-date-picker",
11
- "description": "`<vaadin-date-picker>` is an input field that allows to enter a date by typing or by selecting from a calendar overlay.\n\n```html\n<vaadin-date-picker label=\"Birthday\"></vaadin-date-picker>\n```\n```js\ndatePicker.value = '2016-03-02';\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\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n---------------------|----------------\n`label` | The label element\n`input-field` | The element that wraps prefix, value and buttons\n`field-button` | Set on both clear and toggle buttons\n`clear-button` | The clear button\n`error-message` | The error message element\n`helper-text` | The helper text element wrapper\n`required-indicator` | The `required` state indicator element\n`toggle-button` | The toggle button\n`backdrop` | Backdrop of the overlay\n`overlay` | The overlay container\n`content` | The overlay content\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n---------------------|---------------------------------\n`disabled` | Set when the element is disabled\n`has-value` | Set when the element has a value\n`has-label` | Set when the element has a label\n`has-helper` | Set when the element has helper text or slot\n`has-error-message` | Set when the element has an error message\n`has-tooltip` | Set when the element has a slotted tooltip\n`invalid` | Set when the element is invalid\n`focused` | Set when the element is focused\n`focus-ring` | Set when the element is keyboard focused\n`readonly` | Set when the element is readonly\n`opened` | Set when the overlay is opened\n`week-numbers` | Set when week numbers are shown in the calendar\n\n### Internal components\n\nIn addition to `<vaadin-date-picker>` itself, the following internal\ncomponents are themable:\n\n- `<vaadin-date-picker-overlay-content>`\n- `<vaadin-date-picker-month-scroller>`\n- `<vaadin-date-picker-year-scroller>`\n- `<vaadin-date-picker-year>`\n- `<vaadin-month-calendar>`\n\nIn order to style the overlay content, use `<vaadin-date-picker-overlay-content>` shadow DOM parts:\n\nPart name | Description\n----------------------|--------------------\n`years-toggle-button` | Fullscreen mode years scroller toggle\n`toolbar` | Toolbar with slotted buttons\n`loader` | Loading spinner shown while data is being loaded, for example while the disabled dates provider resolves\n\nThe following state attributes are available on the `<vaadin-date-picker-overlay-content>` element:\n\nAttribute | Description\n----------------|-------------------------------------------------\n`desktop` | Set when the overlay content is in desktop mode\n`fullscreen` | Set when the overlay content is in fullscreen mode\n`years-visible` | Set when the year scroller is visible in fullscreen mode\n`loading` | Set while data is being loaded, for example while the disabled dates provider resolves\n\nIn order to style the month calendar, use `<vaadin-month-calendar>` shadow DOM parts:\n\nPart name | Description\n----------------------|--------------------\n`month-header` | Month title\n`weekdays` | Weekday container\n`weekday` | Weekday element\n`week-numbers` | Week numbers container\n`week-number` | Week number element\n`date` | Date element\n`disabled` | Disabled date element\n`pending` | Date element in a month whose date metadata provider result is still loading\n`focused` | Focused date element\n`selected` | Selected date element\n`today` | Date element corresponding to the current day\n`past` | Date element corresponding to the date in the past\n`future` | Date element corresponding to the date in the future\n\nCustom part names returned per date by `dateMetadataProvider` (the `part` metadata field) are\nalso added to the matching date elements, so specific dates can be styled with\n`vaadin-month-calendar::part(<name>)`.\n\nIn order to style year scroller elements, use `<vaadin-date-picker-year>` shadow DOM parts:\n\nPart name | Description\n----------------------|--------------------\n`year-number` | Year number\n`year-separator` | Year separator\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.\n\n### Change events\n\nDepending on the nature of the value change that the user attempts to commit e.g. by pressing Enter,\nthe component can fire either a `change` event or an `unparsable-change` event:\n\nValue change | Event\n:------------------------|:------------------\nempty => parsable | change\nempty => unparsable | unparsable-change\nparsable => empty | change\nparsable => parsable | change\nparsable => unparsable | change\nunparsable => empty | unparsable-change\nunparsable => parsable | change\nunparsable => unparsable | unparsable-change",
11
+ "description": "`<vaadin-date-picker>` is an input field that allows to enter a date by typing or by selecting from a calendar overlay.\n\n```html\n<vaadin-date-picker label=\"Birthday\"></vaadin-date-picker>\n```\n```js\ndatePicker.value = '2016-03-02';\n```\n\nWhen the selected `value` is changed, a `value-changed` event is triggered.\n\n### Styling\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n---------------------|----------------\n`label` | The label element\n`input-field` | The element that wraps prefix, value and buttons\n`field-button` | Set on both clear and toggle buttons\n`clear-button` | The clear button\n`error-message` | The error message element\n`helper-text` | The helper text element wrapper\n`required-indicator` | The `required` state indicator element\n`toggle-button` | The toggle button\n`backdrop` | Backdrop of the overlay\n`overlay` | The overlay container\n`content` | The overlay content\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n---------------------|---------------------------------\n`disabled` | Set when the element is disabled\n`has-value` | Set when the element has a value\n`has-label` | Set when the element has a label\n`has-helper` | Set when the element has helper text or slot\n`has-error-message` | Set when the element has an error message\n`has-tooltip` | Set when the element has a slotted tooltip\n`invalid` | Set when the element is invalid\n`focused` | Set when the element is focused\n`focus-ring` | Set when the element is keyboard focused\n`readonly` | Set when the element is readonly\n`opened` | Set when the overlay is opened\n`week-numbers` | Set when week numbers are shown in the calendar\n\nThe following custom CSS properties are available for styling:\n\nCustom CSS property |\n:----------------------------------------------------------|\n| `--vaadin-date-picker-date-border-radius` |\n| `--vaadin-date-picker-date-disabled-color` |\n| `--vaadin-date-picker-date-height` |\n| `--vaadin-date-picker-date-selected-background` |\n| `--vaadin-date-picker-date-selected-color` |\n| `--vaadin-date-picker-date-today-color` |\n| `--vaadin-date-picker-date-width` |\n| `--vaadin-date-picker-month-header-color` |\n| `--vaadin-date-picker-month-header-font-size` |\n| `--vaadin-date-picker-month-header-font-weight` |\n| `--vaadin-date-picker-month-padding` |\n| `--vaadin-date-picker-overlay-max-height` |\n| `--vaadin-date-picker-overlay-width` |\n| `--vaadin-date-picker-toolbar-padding` |\n| `--vaadin-date-picker-week-divider-color` |\n| `--vaadin-date-picker-week-number-color` |\n| `--vaadin-date-picker-week-number-font-size` |\n| `--vaadin-date-picker-weekday-color` |\n| `--vaadin-date-picker-weekday-font-size` |\n| `--vaadin-date-picker-weekday-font-weight` |\n| `--vaadin-date-picker-year-scroller-background` |\n| `--vaadin-date-picker-year-scroller-border-color` |\n| `--vaadin-date-picker-year-scroller-current-year-color` |\n| `--vaadin-date-picker-year-scroller-width` |\n| `--vaadin-field-default-width` |\n| `--vaadin-input-field-background` |\n| `--vaadin-input-field-border-color` |\n| `--vaadin-input-field-border-radius` |\n| `--vaadin-input-field-border-width` |\n| `--vaadin-input-field-bottom-end-radius` |\n| `--vaadin-input-field-bottom-start-radius` |\n| `--vaadin-input-field-button-text-color` |\n| `--vaadin-input-field-container-gap` |\n| `--vaadin-input-field-disabled-background` |\n| `--vaadin-input-field-disabled-text-color` |\n| `--vaadin-input-field-error-color` |\n| `--vaadin-input-field-error-font-size` |\n| `--vaadin-input-field-error-font-weight` |\n| `--vaadin-input-field-error-line-height` |\n| `--vaadin-input-field-gap` |\n| `--vaadin-input-field-helper-color` |\n| `--vaadin-input-field-helper-font-size` |\n| `--vaadin-input-field-helper-font-weight` |\n| `--vaadin-input-field-helper-line-height` |\n| `--vaadin-input-field-label-color` |\n| `--vaadin-input-field-label-font-size` |\n| `--vaadin-input-field-label-font-weight` |\n| `--vaadin-input-field-label-line-height` |\n| `--vaadin-input-field-padding` |\n| `--vaadin-input-field-placeholder-color` |\n| `--vaadin-input-field-required-indicator` |\n| `--vaadin-input-field-required-indicator-color` |\n| `--vaadin-input-field-top-end-radius` |\n| `--vaadin-input-field-top-start-radius` |\n| `--vaadin-input-field-value-color` |\n| `--vaadin-input-field-value-font-size` |\n| `--vaadin-input-field-value-font-weight` |\n| `--vaadin-input-field-value-line-height` |\n\n### Internal components\n\nIn addition to `<vaadin-date-picker>` itself, the following internal\ncomponents are themable:\n\n- `<vaadin-date-picker-overlay-content>`\n- `<vaadin-date-picker-month-scroller>`\n- `<vaadin-date-picker-year-scroller>`\n- `<vaadin-date-picker-year>`\n- `<vaadin-month-calendar>`\n\nIn order to style the overlay content, use `<vaadin-date-picker-overlay-content>` shadow DOM parts:\n\nPart name | Description\n----------------------|--------------------\n`years-toggle-button` | Fullscreen mode years scroller toggle\n`toolbar` | Toolbar with slotted buttons\n`loader` | Loading spinner shown while the date metadata provider is resolving\n\nThe following state attributes are available on the `<vaadin-date-picker-overlay-content>` element:\n\nAttribute | Description\n----------------|-------------------------------------------------\n`desktop` | Set when the overlay content is in desktop mode\n`fullscreen` | Set when the overlay content is in fullscreen mode\n`years-visible` | Set when the year scroller is visible in fullscreen mode\n`loading` | Set while the date metadata provider is resolving\n\nIn order to style the month calendar, use `<vaadin-month-calendar>` shadow DOM parts:\n\nPart name | Description\n----------------------|--------------------\n`month-header` | Month title\n`weekdays` | Weekday container\n`weekday` | Weekday element\n`week-numbers` | Week numbers container\n`week-number` | Week number element\n`date` | Date element\n`disabled` | Disabled date element\n`loading` | Date element in a month whose metadata is currently being fetched\n`focused` | Focused date element\n`selected` | Selected date element\n`today` | Date element corresponding to the current day\n`past` | Date element corresponding to the date in the past\n`future` | Date element corresponding to the date in the future\n\nIn order to style year scroller elements, use `<vaadin-date-picker-year>` shadow DOM parts:\n\nPart name | Description\n----------------------|--------------------\n`year-number` | Year number\n`year-separator` | Year separator\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.\n\n### Change events\n\nDepending on the nature of the value change that the user attempts to commit e.g. by pressing Enter,\nthe component can fire either a `change` event or an `unparsable-change` event:\n\nValue change | Event\n:------------------------|:------------------\nempty => parsable | change\nempty => unparsable | unparsable-change\nparsable => empty | change\nparsable => parsable | change\nparsable => unparsable | change\nunparsable => empty | unparsable-change\nunparsable => parsable | change\nunparsable => unparsable | unparsable-change",
12
12
  "attributes": [
13
+ {
14
+ "name": "accessible-description-ref",
15
+ "description": "A space-separated list of IDs referencing the elements that\ndescribe the component for screen reader users. The referenced\nelements are announced in addition to the helper text and\nthe error message.",
16
+ "value": {
17
+ "type": [
18
+ "string"
19
+ ]
20
+ }
21
+ },
13
22
  {
14
23
  "name": "accessible-name",
15
- "description": "String used to label the component to screen reader users.",
24
+ "description": "String used to label the component for screen reader users.",
16
25
  "value": {
17
26
  "type": [
18
27
  "string"
@@ -21,7 +30,7 @@
21
30
  },
22
31
  {
23
32
  "name": "accessible-name-ref",
24
- "description": "Id of the element used as label of the component to screen reader users.",
33
+ "description": "A space-separated list of IDs referencing the elements that\nlabel the component for screen reader users.",
25
34
  "value": {
26
35
  "type": [
27
36
  "string"
@@ -238,9 +247,18 @@
238
247
  ],
239
248
  "js": {
240
249
  "properties": [
250
+ {
251
+ "name": "accessibleDescriptionRef",
252
+ "description": "A space-separated list of IDs referencing the elements that\ndescribe the component for screen reader users. The referenced\nelements are announced in addition to the helper text and\nthe error message.",
253
+ "value": {
254
+ "type": [
255
+ "string"
256
+ ]
257
+ }
258
+ },
241
259
  {
242
260
  "name": "accessibleName",
243
- "description": "String used to label the component to screen reader users.",
261
+ "description": "String used to label the component for screen reader users.",
244
262
  "value": {
245
263
  "type": [
246
264
  "string"
@@ -249,7 +267,7 @@
249
267
  },
250
268
  {
251
269
  "name": "accessibleNameRef",
252
- "description": "Id of the element used as label of the component to screen reader users.",
270
+ "description": "A space-separated list of IDs referencing the elements that\nlabel the component for screen reader users.",
253
271
  "value": {
254
272
  "type": [
255
273
  "string"
@@ -303,11 +321,11 @@
303
321
  },
304
322
  {
305
323
  "name": "dateMetadataProvider",
306
- "description": "A batch function that fetches metadata for a range of dates the calendar is about to\nrender. It receives a `DatePickerDateRange` object (`{ start, end }` of `DatePickerDate`)\nand returns, or resolves with, an array of metadata objects — a `DatePickerDate` extended\nwith metadata fields such as `disabled` and custom `part` names, e.g.\n`{ year, month, day, disabled: true, part: 'busy' }` — for the dates that have metadata\nwithin that range.\n\nUnlike `isDateDisabled`, which is called once per date, this function is called for a\nrange of dates at a time, and again as the calendar renders further dates. The size of\nthe range is decided by the calendar and may span multiple months. It may return a\n`Promise`, in which case the affected dates render in a non-selectable pending state\nuntil it resolves.\n\n`disabled` from the metadata is combined with `min`, `max` and `isDateDisabled`: a date\nis disabled if it is out of the min/max range, or `isDateDisabled` returns `true`, or its\nmetadata marks it disabled. `part` names are added to the date cell's `part` attribute so\na theme can style specific dates via `::part()`.\n\nBoth `disabled` and `part` are returned by this one function, rather than by separate\ngenerators, so a single backend query (for example in Flow) can answer both at once\ninstead of being split into two passes over the same data.\n\nKeep a stable reference to the function. Assigning a new function resets the internal\ncache and re-fetches every visible range. To reload after the underlying data changes\nwhile keeping the same function, call `clearCache()`.",
324
+ "description": "A function that provides metadata for the dates the calendar is about to render: whether they\nare disabled, and CSS `part` names for styling from outside using the `::part()` selector.\nUnlike `isDateDisabled`, which is called once per date, the metadata provider is called for\na range of dates at a time, and again as the calendar renders further dates.\n\nIt receives a `DatePickerDateRange` and returns an array of `DatePickerDateMetadata` objects\nfor the dates in that range that have metadata. It can return a `Promise` to load the metadata\nasynchronously, and `null` or `undefined` when no date in the range has metadata.\n\nThe returned array has the following structure:\n\n```js\n[\n // The date is an ISO 8601 string.\n { date: '2026-01-01', disabled: true },\n\n // Adds a custom part name to the date.\n { date: '2026-01-02', part: 'busy' },\n]\n```\n\nA date is disabled if its metadata marks it disabled, or `isDateDisabled` returns `true`, or\nit is outside `min` and `max`. Disabled dates are not selectable, and typing a disabled date in\nthe field makes it invalid. The provider does not affect which date is focused when opening the\noverlay. Use `initialPosition` property to provide a selectable date.\n\nWhile a returned `Promise` is pending, the dates it covers are not disabled yet and render with\nthe `loading` part. If the function throws or rejects, corresponding dates are requested again\nthe next time the user navigates.\n\nThe provider is used for validation also when the overlay is closed. Date is considered valid\nwhile the provider is pending, and is re-validated again after the metadata is loaded.\n\nKeep a stable reference to the function: assigning a new one clears the cache and re-fetches\nvisible range. Call `clearCache()` to re-fetch when the data behind the same function changed.",
307
325
  "value": {
308
326
  "type": [
309
- "function DatePickerDateRange: Array<DatePickerDateMetadata>",
310
- "Promise<Array<DatePickerDateMetadata>>",
327
+ "DatePickerDateMetadataProvider",
328
+ "null",
311
329
  "undefined"
312
330
  ]
313
331
  }
@@ -341,7 +359,7 @@
341
359
  },
342
360
  {
343
361
  "name": "i18n",
344
- "description": "The object used to localize this component. To change the default\nlocalization, replace this with an object that provides all properties, or\njust the individual properties you want to change.\n\nThe object has the following JSON structure and default values:\n\n```js\n{\n // An array with the full names of months starting\n // with January.\n monthNames: [\n 'January', 'February', 'March', 'April', 'May',\n 'June', 'July', 'August', 'September',\n 'October', 'November', 'December'\n ],\n\n // An array of weekday names starting with Sunday. Used\n // in screen reader announcements.\n weekdays: [\n 'Sunday', 'Monday', 'Tuesday', 'Wednesday',\n 'Thursday', 'Friday', 'Saturday'\n ],\n\n // An array of short weekday names starting with Sunday.\n // Displayed in the calendar.\n weekdaysShort: [\n 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'\n ],\n\n // An integer indicating the first day of the week\n // (0 = Sunday, 1 = Monday, etc.).\n firstDayOfWeek: 0,\n\n // Translation of the Today shortcut button text.\n today: 'Today',\n\n // Translation of the Cancel button text.\n cancel: 'Cancel',\n\n // Used for adjusting the year value when parsing dates with short years.\n // The year values between 0 and 99 are evaluated and adjusted.\n // Example: for a referenceDate of 1970-10-30;\n // dateToBeParsed: 40-10-30, result: 1940-10-30\n // dateToBeParsed: 80-10-30, result: 1980-10-30\n // dateToBeParsed: 10-10-30, result: 2010-10-30\n // Supported date format: ISO 8601 `\"YYYY-MM-DD\"` (default)\n // The default value is the current date.\n referenceDate: '',\n\n // A function to format given `Object` as\n // date string. Object is in the format `{ day: ..., month: ..., year: ... }`\n // Note: The argument month is 0-based. This means that January = 0 and December = 11.\n formatDate: d => {\n // returns a string representation of the given\n // object in 'MM/DD/YYYY' -format\n },\n\n // A function to parse the given text to an `Object` in the format `{ day: ..., month: ..., year: ... }`.\n // Must properly parse (at least) text formatted by `formatDate`.\n // Setting the property to null will disable keyboard input feature.\n // Note: The argument month is 0-based. This means that January = 0 and December = 11.\n parseDate: text => {\n // Parses a string in 'MM/DD/YY', 'MM/DD' or 'DD' -format to\n // an `Object` in the format `{ day: ..., month: ..., year: ... }`.\n }\n\n // A function to format given `monthName` and\n // `fullYear` integer as calendar title string.\n formatTitle: (monthName, fullYear) => {\n return monthName + ' ' + fullYear;\n }\n}\n```",
362
+ "description": "The object used to localize this component. To change the default\nlocalization, replace this with an object that provides all properties, or\njust the individual properties you want to change.\n\nThe object has the following JSON structure and default values:\n\n```js\n{\n // An array with the full names of months starting\n // with January.\n monthNames: [\n 'January', 'February', 'March', 'April', 'May',\n 'June', 'July', 'August', 'September',\n 'October', 'November', 'December'\n ],\n\n // An array of weekday names starting with Sunday. Used\n // in screen reader announcements.\n weekdays: [\n 'Sunday', 'Monday', 'Tuesday', 'Wednesday',\n 'Thursday', 'Friday', 'Saturday'\n ],\n\n // An array of short weekday names starting with Sunday.\n // Displayed in the calendar.\n weekdaysShort: [\n 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'\n ],\n\n // An integer indicating the first day of the week\n // (0 = Sunday, 1 = Monday, etc.).\n firstDayOfWeek: 0,\n\n // Translation of the Today shortcut button text.\n today: 'Today',\n\n // Translation of the Cancel button text.\n cancel: 'Cancel',\n\n // Accessible name of the overlay content, announced by screen readers\n // when the overlay opens.\n dialogAccessibleName: 'Calendar',\n\n // Used for adjusting the year value when parsing dates with short years.\n // The year values between 0 and 99 are evaluated and adjusted.\n // Example: for a referenceDate of 1970-10-30;\n // dateToBeParsed: 40-10-30, result: 1940-10-30\n // dateToBeParsed: 80-10-30, result: 1980-10-30\n // dateToBeParsed: 10-10-30, result: 2010-10-30\n // Supported date format: ISO 8601 `\"YYYY-MM-DD\"` (default)\n // The default value is the current date.\n referenceDate: '',\n\n // A function to format given `Object` as\n // date string. Object is in the format `{ day: ..., month: ..., year: ... }`\n // Note: The argument month is 0-based. This means that January = 0 and December = 11.\n formatDate: d => {\n // returns a string representation of the given\n // object in 'MM/DD/YYYY' -format\n },\n\n // A function to parse the given text to an `Object` in the format `{ day: ..., month: ..., year: ... }`.\n // Must properly parse (at least) text formatted by `formatDate`.\n // Setting the property to null will disable keyboard input feature.\n // Note: The argument month is 0-based. This means that January = 0 and December = 11.\n parseDate: text => {\n // Parses a string in 'MM/DD/YY', 'MM/DD' or 'DD' -format to\n // an `Object` in the format `{ day: ..., month: ..., year: ... }`.\n }\n\n // A function to format given `monthName` and\n // `fullYear` integer as calendar title string.\n formatTitle: (monthName, fullYear) => {\n return monthName + ' ' + fullYear;\n }\n}\n```",
345
363
  "value": {
346
364
  "type": [
347
365
  "Object"
@@ -368,7 +386,7 @@
368
386
  },
369
387
  {
370
388
  "name": "isDateDisabled",
371
- "description": "A function to be used to determine whether the user can select a given date.\nReceives a `DatePickerDate` object of the date to be selected and should return a\nboolean.",
389
+ "description": "A function to be used to determine whether the user can select a given date.\nReceives a `DatePickerDate` object of the date to be selected and should return a\nboolean.\n\nThe function is called once per date and has to answer synchronously. Use\n`dateMetadataProvider` when the answer has to be loaded first, or when dates also need\ncustom part names. A date is disabled when either of the two disables it.",
372
390
  "value": {
373
391
  "type": [
374
392
  "function DatePickerDate: boolean",