@vaadin/date-picker 24.4.0-alpha1 → 24.4.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.
Files changed (46) hide show
  1. package/package.json +11 -11
  2. package/src/vaadin-date-picker-helper.d.ts +6 -1
  3. package/src/vaadin-date-picker-helper.js +24 -17
  4. package/src/vaadin-date-picker-light.d.ts +1 -1
  5. package/src/vaadin-date-picker-light.js +1 -1
  6. package/src/vaadin-date-picker-mixin.d.ts +8 -1
  7. package/src/vaadin-date-picker-mixin.js +34 -7
  8. package/src/vaadin-date-picker-month-scroller.js +1 -1
  9. package/src/vaadin-date-picker-overlay-content-mixin.js +39 -14
  10. package/src/vaadin-date-picker-overlay-content-styles.js +1 -1
  11. package/src/vaadin-date-picker-overlay-content.js +1 -1
  12. package/src/vaadin-date-picker-overlay-styles.js +1 -1
  13. package/src/vaadin-date-picker-overlay.js +1 -1
  14. package/src/vaadin-date-picker-styles.js +1 -1
  15. package/src/vaadin-date-picker-year-mixin.js +1 -1
  16. package/src/vaadin-date-picker-year-scroller.js +1 -1
  17. package/src/vaadin-date-picker-year.js +1 -1
  18. package/src/vaadin-date-picker.d.ts +1 -1
  19. package/src/vaadin-date-picker.js +1 -1
  20. package/src/vaadin-infinite-scroller.js +1 -1
  21. package/src/vaadin-lit-date-picker-overlay-content.js +1 -1
  22. package/src/vaadin-lit-date-picker-overlay.js +1 -1
  23. package/src/vaadin-lit-date-picker-year.js +1 -1
  24. package/src/vaadin-lit-date-picker.js +2 -2
  25. package/src/vaadin-lit-month-calendar.js +1 -1
  26. package/src/vaadin-month-calendar-mixin.js +12 -1
  27. package/src/vaadin-month-calendar-styles.js +1 -1
  28. package/src/vaadin-month-calendar.js +12 -12
  29. package/theme/lumo/vaadin-date-picker-light.d.ts +4 -0
  30. package/theme/lumo/vaadin-date-picker-overlay-content-styles.d.ts +7 -0
  31. package/theme/lumo/vaadin-date-picker-overlay-styles.d.ts +2 -0
  32. package/theme/lumo/vaadin-date-picker-styles.d.ts +2 -0
  33. package/theme/lumo/vaadin-date-picker-year-styles.d.ts +1 -0
  34. package/theme/lumo/vaadin-date-picker.d.ts +5 -0
  35. package/theme/lumo/vaadin-lit-date-picker.d.ts +5 -0
  36. package/theme/lumo/vaadin-month-calendar-styles.d.ts +5 -0
  37. package/theme/material/vaadin-date-picker-light.d.ts +4 -0
  38. package/theme/material/vaadin-date-picker-overlay-content-styles.d.ts +6 -0
  39. package/theme/material/vaadin-date-picker-overlay-styles.d.ts +1 -0
  40. package/theme/material/vaadin-date-picker-styles.d.ts +3 -0
  41. package/theme/material/vaadin-date-picker-year-styles.d.ts +1 -0
  42. package/theme/material/vaadin-date-picker.d.ts +5 -0
  43. package/theme/material/vaadin-lit-date-picker.d.ts +5 -0
  44. package/theme/material/vaadin-month-calendar-styles.d.ts +2 -0
  45. package/web-types.json +22 -2
  46. package/web-types.lit.json +16 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaadin/date-picker",
3
- "version": "24.4.0-alpha1",
3
+ "version": "24.4.0-alpha10",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -36,15 +36,15 @@
36
36
  "dependencies": {
37
37
  "@open-wc/dedupe-mixin": "^1.3.0",
38
38
  "@polymer/polymer": "^3.2.0",
39
- "@vaadin/a11y-base": "24.4.0-alpha1",
40
- "@vaadin/button": "24.4.0-alpha1",
41
- "@vaadin/component-base": "24.4.0-alpha1",
42
- "@vaadin/field-base": "24.4.0-alpha1",
43
- "@vaadin/input-container": "24.4.0-alpha1",
44
- "@vaadin/overlay": "24.4.0-alpha1",
45
- "@vaadin/vaadin-lumo-styles": "24.4.0-alpha1",
46
- "@vaadin/vaadin-material-styles": "24.4.0-alpha1",
47
- "@vaadin/vaadin-themable-mixin": "24.4.0-alpha1",
39
+ "@vaadin/a11y-base": "24.4.0-alpha10",
40
+ "@vaadin/button": "24.4.0-alpha10",
41
+ "@vaadin/component-base": "24.4.0-alpha10",
42
+ "@vaadin/field-base": "24.4.0-alpha10",
43
+ "@vaadin/input-container": "24.4.0-alpha10",
44
+ "@vaadin/overlay": "24.4.0-alpha10",
45
+ "@vaadin/vaadin-lumo-styles": "24.4.0-alpha10",
46
+ "@vaadin/vaadin-material-styles": "24.4.0-alpha10",
47
+ "@vaadin/vaadin-themable-mixin": "24.4.0-alpha10",
48
48
  "lit": "^3.0.0"
49
49
  },
50
50
  "devDependencies": {
@@ -56,5 +56,5 @@
56
56
  "web-types.json",
57
57
  "web-types.lit.json"
58
58
  ],
59
- "gitHead": "3e2ed41c99d618ff7def2734fd863c21c85775a3"
59
+ "gitHead": "c563c01d6ac5157f5a5885c8f6048d1cf4c727b4"
60
60
  }
@@ -17,7 +17,12 @@ declare function dateEquals(date1: Date | null, date2: Date | null): boolean;
17
17
  *
18
18
  * @returns True if the date is in the range
19
19
  */
20
- declare function dateAllowed(date: Date, min: Date | null, max: Date | null): boolean;
20
+ declare function dateAllowed(
21
+ date: Date,
22
+ min: Date | null,
23
+ max: Date | null,
24
+ isDateDisabled: (DatePickerDate) => boolean | null,
25
+ ): boolean;
21
26
 
22
27
  /**
23
28
  * Get closest date from array of dates.
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2016 - 2023 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2024 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
 
@@ -53,16 +53,37 @@ export function dateEquals(date1, date2) {
53
53
  );
54
54
  }
55
55
 
56
+ /**
57
+ * Extracts the basic component parts of a date (day, month and year)
58
+ * to the expected format.
59
+ * @param {!Date} date
60
+ * @return {{day: number, month: number, year: number}}
61
+ */
62
+ export function extractDateParts(date) {
63
+ return {
64
+ day: date.getDate(),
65
+ month: date.getMonth(),
66
+ year: date.getFullYear(),
67
+ };
68
+ }
69
+
56
70
  /**
57
71
  * Check if the given date is in the range of allowed dates.
58
72
  *
59
73
  * @param {!Date} date The date to check
60
74
  * @param {Date} min Range start
61
75
  * @param {Date} max Range end
76
+ * @param {function(!DatePickerDate): boolean} isDateDisabled Callback to check if the date is disabled
62
77
  * @return {boolean} True if the date is in the range
63
78
  */
64
- export function dateAllowed(date, min, max) {
65
- return (!min || date >= min) && (!max || date <= max);
79
+ export function dateAllowed(date, min, max, isDateDisabled) {
80
+ let dateIsDisabled = false;
81
+ if (typeof isDateDisabled === 'function' && !!date) {
82
+ const dateToCheck = extractDateParts(date);
83
+ dateIsDisabled = isDateDisabled(dateToCheck);
84
+ }
85
+
86
+ return (!min || date >= min) && (!max || date <= max) && !dateIsDisabled;
66
87
  }
67
88
 
68
89
  /**
@@ -90,20 +111,6 @@ export function getClosestDate(date, dates) {
90
111
  });
91
112
  }
92
113
 
93
- /**
94
- * Extracts the basic component parts of a date (day, month and year)
95
- * to the expected format.
96
- * @param {!Date} date
97
- * @return {{day: number, month: number, year: number}}
98
- */
99
- export function extractDateParts(date) {
100
- return {
101
- day: date.getDate(),
102
- month: date.getMonth(),
103
- year: date.getFullYear(),
104
- };
105
- }
106
-
107
114
  /**
108
115
  * Get difference in months between today and given months value.
109
116
  *
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2016 - 2023 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2024 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 { ValidateMixin } from '@vaadin/field-base/src/validate-mixin.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2016 - 2023 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2024 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 './vaadin-date-picker-overlay-content.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2016 - 2023 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2024 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 { Constructor } from '@open-wc/dedupe-mixin';
@@ -237,6 +237,13 @@ export declare class DatePickerMixinClass {
237
237
  */
238
238
  max: string | undefined;
239
239
 
240
+ /**
241
+ * A function to be used to determine whether the user can select a given date.
242
+ * Receives a `DatePickerDate` object of the date to be selected and should return a
243
+ * boolean.
244
+ */
245
+ isDateDisabled: (date: DatePickerDate) => boolean;
246
+
240
247
  /**
241
248
  * Opens the dropdown.
242
249
  */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2016 - 2023 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2024 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 { hideOthers } from '@vaadin/a11y-base/src/aria-hidden.js';
@@ -302,6 +302,17 @@ export const DatePickerMixin = (subclass) =>
302
302
  sync: true,
303
303
  },
304
304
 
305
+ /**
306
+ * A function to be used to determine whether the user can select a given date.
307
+ * Receives a `DatePickerDate` object of the date to be selected and should return a
308
+ * boolean.
309
+ *
310
+ * @type {function(DatePickerDate): boolean | undefined}
311
+ */
312
+ isDateDisabled: {
313
+ type: Function,
314
+ },
315
+
305
316
  /**
306
317
  * The earliest date that can be selected. All earlier dates will be disabled.
307
318
  * @type {Date | undefined}
@@ -365,7 +376,7 @@ export const DatePickerMixin = (subclass) =>
365
376
  return [
366
377
  '_selectedDateChanged(_selectedDate, i18n)',
367
378
  '_focusedDateChanged(_focusedDate, i18n)',
368
- '__updateOverlayContent(_overlayContent, i18n, label, _minDate, _maxDate, _focusedDate, _selectedDate, showWeekNumbers)',
379
+ '__updateOverlayContent(_overlayContent, i18n, label, _minDate, _maxDate, _focusedDate, _selectedDate, showWeekNumbers, isDateDisabled)',
369
380
  '__updateOverlayContentTheme(_overlayContent, _theme)',
370
381
  '__updateOverlayContentFullScreen(_overlayContent, _fullscreen)',
371
382
  ];
@@ -559,6 +570,8 @@ export const DatePickerMixin = (subclass) =>
559
570
  content.addEventListener('focused-date-changed', (e) => {
560
571
  this._focusedDate = e.detail.value;
561
572
  });
573
+
574
+ content.addEventListener('click', (e) => e.stopPropagation());
562
575
  }
563
576
 
564
577
  /**
@@ -599,7 +612,8 @@ export const DatePickerMixin = (subclass) =>
599
612
  checkValidity() {
600
613
  const inputValue = this._inputElementValue;
601
614
  const inputValid = !inputValue || (!!this._selectedDate && inputValue === this.__formatDate(this._selectedDate));
602
- const minMaxValid = !this._selectedDate || dateAllowed(this._selectedDate, this._minDate, this._maxDate);
615
+ const isDateValid =
616
+ !this._selectedDate || dateAllowed(this._selectedDate, this._minDate, this._maxDate, this.isDateDisabled);
603
617
 
604
618
  let inputValidity = true;
605
619
  if (this.inputElement) {
@@ -611,7 +625,7 @@ export const DatePickerMixin = (subclass) =>
611
625
  }
612
626
  }
613
627
 
614
- return inputValid && minMaxValid && inputValidity;
628
+ return inputValid && isDateValid && inputValidity;
615
629
  }
616
630
 
617
631
  /**
@@ -850,7 +864,17 @@ export const DatePickerMixin = (subclass) =>
850
864
 
851
865
  /** @private */
852
866
  // eslint-disable-next-line max-params
853
- __updateOverlayContent(overlayContent, i18n, label, minDate, maxDate, focusedDate, selectedDate, showWeekNumbers) {
867
+ __updateOverlayContent(
868
+ overlayContent,
869
+ i18n,
870
+ label,
871
+ minDate,
872
+ maxDate,
873
+ focusedDate,
874
+ selectedDate,
875
+ showWeekNumbers,
876
+ isDateDisabled,
877
+ ) {
854
878
  if (overlayContent) {
855
879
  overlayContent.i18n = i18n;
856
880
  overlayContent.label = label;
@@ -859,6 +883,7 @@ export const DatePickerMixin = (subclass) =>
859
883
  overlayContent.focusedDate = focusedDate;
860
884
  overlayContent.selectedDate = selectedDate;
861
885
  overlayContent.showWeekNumbers = showWeekNumbers;
886
+ overlayContent.isDateDisabled = isDateDisabled;
862
887
  }
863
888
  }
864
889
 
@@ -930,9 +955,11 @@ export const DatePickerMixin = (subclass) =>
930
955
  const initialPosition =
931
956
  this._selectedDate || this._overlayContent.initialPosition || parsedInitialPosition || new Date();
932
957
 
933
- return parsedInitialPosition || dateAllowed(initialPosition, this._minDate, this._maxDate)
958
+ return parsedInitialPosition || dateAllowed(initialPosition, this._minDate, this._maxDate, this.isDateDisabled)
934
959
  ? initialPosition
935
- : getClosestDate(initialPosition, [this._minDate, this._maxDate]);
960
+ : this._minDate || this._maxDate
961
+ ? getClosestDate(initialPosition, [this._minDate, this._maxDate])
962
+ : new Date();
936
963
  }
937
964
 
938
965
  /**
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2016 - 2023 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2024 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 { defineCustomElement } from '@vaadin/component-base/src/define.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2016 - 2023 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2024 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 { flush } from '@polymer/polymer/lib/utils/flush.js';
@@ -10,7 +10,13 @@ import { Debouncer } from '@vaadin/component-base/src/debounce.js';
10
10
  import { addListener, setTouchAction } from '@vaadin/component-base/src/gestures.js';
11
11
  import { MediaQueryController } from '@vaadin/component-base/src/media-query-controller.js';
12
12
  import { SlotController } from '@vaadin/component-base/src/slot-controller.js';
13
- import { dateAfterXMonths, dateEquals, extractDateParts, getClosestDate } from './vaadin-date-picker-helper.js';
13
+ import {
14
+ dateAfterXMonths,
15
+ dateAllowed,
16
+ dateEquals,
17
+ extractDateParts,
18
+ getClosestDate,
19
+ } from './vaadin-date-picker-helper.js';
14
20
 
15
21
  /**
16
22
  * @polymerMixin
@@ -107,6 +113,17 @@ export const DatePickerOverlayContentMixin = (superClass) =>
107
113
  sync: true,
108
114
  },
109
115
 
116
+ /**
117
+ * A function to be used to determine whether the user can select a given date.
118
+ * Receives a `DatePickerDate` object of the date to be selected and should return a
119
+ * boolean.
120
+ *
121
+ * @type {function(DatePickerDate): boolean | undefined}
122
+ */
123
+ isDateDisabled: {
124
+ type: Function,
125
+ },
126
+
110
127
  /**
111
128
  * Input label
112
129
  */
@@ -134,9 +151,9 @@ export const DatePickerOverlayContentMixin = (superClass) =>
134
151
 
135
152
  static get observers() {
136
153
  return [
137
- '__updateCalendars(calendars, i18n, minDate, maxDate, selectedDate, focusedDate, showWeekNumbers, _ignoreTaps, _theme)',
154
+ '__updateCalendars(calendars, i18n, minDate, maxDate, selectedDate, focusedDate, showWeekNumbers, _ignoreTaps, _theme, isDateDisabled)',
138
155
  '__updateCancelButton(_cancelButton, i18n)',
139
- '__updateTodayButton(_todayButton, i18n, minDate, maxDate)',
156
+ '__updateTodayButton(_todayButton, i18n, minDate, maxDate, isDateDisabled)',
140
157
  '__updateYears(years, selectedDate, _theme)',
141
158
  ];
142
159
  }
@@ -303,10 +320,10 @@ export const DatePickerOverlayContentMixin = (superClass) =>
303
320
  }
304
321
 
305
322
  /** @private */
306
- __updateTodayButton(todayButton, i18n, minDate, maxDate) {
323
+ __updateTodayButton(todayButton, i18n, minDate, maxDate, isDateDisabled) {
307
324
  if (todayButton) {
308
325
  todayButton.textContent = i18n && i18n.today;
309
- todayButton.disabled = !this._isTodayAllowed(minDate, maxDate);
326
+ todayButton.disabled = !this._isTodayAllowed(minDate, maxDate, isDateDisabled);
310
327
  }
311
328
  }
312
329
 
@@ -321,12 +338,14 @@ export const DatePickerOverlayContentMixin = (superClass) =>
321
338
  showWeekNumbers,
322
339
  ignoreTaps,
323
340
  theme,
341
+ isDateDisabled,
324
342
  ) {
325
343
  if (calendars && calendars.length) {
326
344
  calendars.forEach((calendar) => {
327
345
  calendar.i18n = i18n;
328
346
  calendar.minDate = minDate;
329
347
  calendar.maxDate = maxDate;
348
+ calendar.isDateDisabled = isDateDisabled;
330
349
  calendar.focusedDate = focusedDate;
331
350
  calendar.selectedDate = selectedDate;
332
351
  calendar.showWeekNumbers = showWeekNumbers;
@@ -361,10 +380,14 @@ export const DatePickerOverlayContentMixin = (superClass) =>
361
380
  * @protected
362
381
  */
363
382
  _selectDate(dateToSelect) {
383
+ if (!this._dateAllowed(dateToSelect)) {
384
+ return false;
385
+ }
364
386
  this.selectedDate = dateToSelect;
365
387
  this.dispatchEvent(
366
388
  new CustomEvent('date-selected', { detail: { date: dateToSelect }, bubbles: true, composed: true }),
367
389
  );
390
+ return true;
368
391
  }
369
392
 
370
393
  /** @private */
@@ -775,9 +798,10 @@ export const DatePickerOverlayContentMixin = (superClass) =>
775
798
  handled = true;
776
799
  break;
777
800
  case 'Enter':
778
- this._selectDate(this.focusedDate);
779
- this._close();
780
- handled = true;
801
+ if (this._selectDate(this.focusedDate)) {
802
+ this._close();
803
+ handled = true;
804
+ }
781
805
  break;
782
806
  case ' ':
783
807
  this.__toggleDate(this.focusedDate);
@@ -931,7 +955,8 @@ export const DatePickerOverlayContentMixin = (superClass) =>
931
955
 
932
956
  /** @private */
933
957
  _focusAllowedDate(dateToFocus, diff, keepMonth) {
934
- if (this._dateAllowed(dateToFocus)) {
958
+ // For this check we do consider the isDateDisabled function because disabled dates are allowed to be focused, just not outside min/max
959
+ if (this._dateAllowed(dateToFocus, undefined, undefined, () => false)) {
935
960
  this.focusDate(dateToFocus, keepMonth);
936
961
  } else if (this._dateAllowed(this.focusedDate)) {
937
962
  // Move to min or max date
@@ -1009,18 +1034,18 @@ export const DatePickerOverlayContentMixin = (superClass) =>
1009
1034
  }
1010
1035
 
1011
1036
  /** @private */
1012
- _dateAllowed(date, min = this.minDate, max = this.maxDate) {
1013
- return (!min || date >= min) && (!max || date <= max);
1037
+ _dateAllowed(date, min = this.minDate, max = this.maxDate, isDateDisabled = this.isDateDisabled) {
1038
+ return dateAllowed(date, min, max, isDateDisabled);
1014
1039
  }
1015
1040
 
1016
1041
  /** @private */
1017
- _isTodayAllowed(min, max) {
1042
+ _isTodayAllowed(min, max, isDateDisabled) {
1018
1043
  const today = new Date();
1019
1044
  const todayMidnight = new Date(0, 0);
1020
1045
  todayMidnight.setFullYear(today.getFullYear());
1021
1046
  todayMidnight.setMonth(today.getMonth());
1022
1047
  todayMidnight.setDate(today.getDate());
1023
- return this._dateAllowed(todayMidnight, min, max);
1048
+ return this._dateAllowed(todayMidnight, min, max, isDateDisabled);
1024
1049
  }
1025
1050
 
1026
1051
  /**
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2016 - 2023 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2024 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 { css } from 'lit';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2016 - 2023 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2024 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 '@vaadin/button/src/vaadin-button.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2016 - 2023 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2024 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 { css } from 'lit';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2016 - 2023 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2024 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 { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2016 - 2023 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2024 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 { css } from 'lit';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2016 - 2023 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2024 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
 
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2016 - 2023 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2024 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 { defineCustomElement } from '@vaadin/component-base/src/define.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2016 - 2023 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2024 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 { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2016 - 2023 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2024 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 { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2016 - 2023 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2024 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 '@vaadin/input-container/src/vaadin-input-container.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2016 - 2023 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2024 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 { timeOut } from '@vaadin/component-base/src/async.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2016 - 2023 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2024 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 '@vaadin/button/src/vaadin-lit-button.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2016 - 2023 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2024 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 { html, LitElement } from 'lit';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2016 - 2023 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2024 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 { css, html, LitElement } from 'lit';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2016 - 2023 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2024 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 '@vaadin/input-container/src/vaadin-lit-input-container.js';
@@ -25,7 +25,7 @@ import { datePickerStyles } from './vaadin-date-picker-styles.js';
25
25
  *
26
26
  * ## Disclaimer
27
27
  *
28
- * This component is an experiment not intended for publishing to npm.
28
+ * This component is an experiment and not yet a part of Vaadin platform.
29
29
  * There is no ETA regarding specific Vaadin version where it'll land.
30
30
  * Feel free to try this code in your apps as per Apache 2.0 license.
31
31
  */
@@ -61,7 +61,7 @@ class MonthCalendar extends MonthCalendarMixin(ThemableMixin(PolylitMixin(LitEle
61
61
  ${week.map((date) => {
62
62
  const isFocused = dateEquals(date, this.focusedDate);
63
63
  const isSelected = dateEquals(date, this.selectedDate);
64
- const isDisabled = !dateAllowed(date, this.minDate, this.maxDate);
64
+ const isDisabled = !dateAllowed(date, this.minDate, this.maxDate, this.isDateDisabled);
65
65
 
66
66
  const parts = [
67
67
  'date',
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2016 - 2023 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2024 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 { FocusMixin } from '@vaadin/a11y-base/src/focus-mixin.js';
@@ -80,6 +80,17 @@ export const MonthCalendarMixin = (superClass) =>
80
80
  sync: true,
81
81
  },
82
82
 
83
+ /**
84
+ * A function to be used to determine whether the user can select a given date.
85
+ * Receives a `DatePickerDate` object of the date to be selected and should return a
86
+ * boolean.
87
+ * @type {Function | undefined}
88
+ */
89
+ isDateDisabled: {
90
+ type: Function,
91
+ value: () => false,
92
+ },
93
+
83
94
  disabled: {
84
95
  type: Boolean,
85
96
  reflectToAttribute: true,
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2016 - 2023 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2024 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 { css } from 'lit';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2016 - 2023 Vaadin Ltd.
3
+ * Copyright (c) 2016 - 2024 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 '@polymer/polymer/lib/elements/dom-repeat.js';
@@ -50,12 +50,12 @@ class MonthCalendar extends MonthCalendarMixin(ThemableMixin(PolymerElement)) {
50
50
  <template is="dom-repeat" items="[[week]]">
51
51
  <td
52
52
  role="gridcell"
53
- part$="[[__getDatePart(item, focusedDate, selectedDate, minDate, maxDate)]]"
53
+ part$="[[__getDatePart(item, focusedDate, selectedDate, minDate, maxDate, isDateDisabled)]]"
54
54
  date="[[item]]"
55
55
  tabindex$="[[__getDayTabindex(item, focusedDate)]]"
56
- disabled$="[[__isDayDisabled(item, minDate, maxDate)]]"
56
+ disabled$="[[__isDayDisabled(item, minDate, maxDate, isDateDisabled)]]"
57
57
  aria-selected$="[[__getDayAriaSelected(item, selectedDate)]]"
58
- aria-disabled$="[[__getDayAriaDisabled(item, minDate, maxDate)]]"
58
+ aria-disabled$="[[__getDayAriaDisabled(item, minDate, maxDate, isDateDisabled)]]"
59
59
  aria-label$="[[__getDayAriaLabel(item)]]"
60
60
  >[[_getDate(item)]]</td
61
61
  >
@@ -76,7 +76,7 @@ class MonthCalendar extends MonthCalendarMixin(ThemableMixin(PolymerElement)) {
76
76
  /** @protected */
77
77
  _days: {
78
78
  type: Array,
79
- computed: '_getDays(month, i18n, minDate, maxDate)',
79
+ computed: '_getDays(month, i18n, minDate, maxDate, isDateDisabled)',
80
80
  },
81
81
 
82
82
  /** @protected */
@@ -107,10 +107,10 @@ class MonthCalendar extends MonthCalendarMixin(ThemableMixin(PolymerElement)) {
107
107
  }
108
108
 
109
109
  /** @private */
110
- __getDatePart(date, focusedDate, selectedDate, minDate, maxDate) {
110
+ __getDatePart(date, focusedDate, selectedDate, minDate, maxDate, isDateDisabled) {
111
111
  const result = ['date'];
112
112
 
113
- if (this.__isDayDisabled(date, minDate, maxDate)) {
113
+ if (this.__isDayDisabled(date, minDate, maxDate, isDateDisabled)) {
114
114
  result.push('disabled');
115
115
  }
116
116
 
@@ -147,17 +147,17 @@ class MonthCalendar extends MonthCalendarMixin(ThemableMixin(PolymerElement)) {
147
147
  }
148
148
 
149
149
  /** @private */
150
- __isDayDisabled(date, minDate, maxDate) {
151
- return !dateAllowed(date, minDate, maxDate);
150
+ __isDayDisabled(date, minDate, maxDate, isDateDisabled) {
151
+ return !dateAllowed(date, minDate, maxDate, isDateDisabled);
152
152
  }
153
153
 
154
154
  /** @private */
155
- __getDayAriaDisabled(date, min, max) {
156
- if (date === undefined || min === undefined || max === undefined) {
155
+ __getDayAriaDisabled(date, min, max, isDateDisabled) {
156
+ if (date === undefined || (min === undefined && max === undefined && isDateDisabled === undefined)) {
157
157
  return;
158
158
  }
159
159
 
160
- if (this.__isDayDisabled(date, min, max)) {
160
+ if (this.__isDayDisabled(date, min, max, isDateDisabled)) {
161
161
  return 'true';
162
162
  }
163
163
  }
@@ -0,0 +1,4 @@
1
+ import './vaadin-date-picker-overlay-styles.js';
2
+ import './vaadin-date-picker-overlay-content-styles.js';
3
+ import './vaadin-month-calendar-styles.js';
4
+ import '../../src/vaadin-date-picker-light.js';
@@ -0,0 +1,7 @@
1
+ import '@vaadin/vaadin-lumo-styles/color.js';
2
+ import '@vaadin/vaadin-lumo-styles/sizing.js';
3
+ import '@vaadin/vaadin-lumo-styles/spacing.js';
4
+ import '@vaadin/vaadin-lumo-styles/style.js';
5
+ import '@vaadin/vaadin-lumo-styles/typography.js';
6
+ import '@vaadin/button/theme/lumo/vaadin-button-styles.js';
7
+ import './vaadin-date-picker-year-styles.js';
@@ -0,0 +1,2 @@
1
+ import '@vaadin/vaadin-lumo-styles/sizing.js';
2
+ import '@vaadin/vaadin-lumo-styles/spacing.js';
@@ -0,0 +1,2 @@
1
+ import '@vaadin/input-container/theme/lumo/vaadin-input-container-styles.js';
2
+ import '@vaadin/vaadin-lumo-styles/font-icons.js';
@@ -0,0 +1 @@
1
+ import '@vaadin/vaadin-lumo-styles/color.js';
@@ -0,0 +1,5 @@
1
+ import './vaadin-date-picker-overlay-styles.js';
2
+ import './vaadin-date-picker-overlay-content-styles.js';
3
+ import './vaadin-month-calendar-styles.js';
4
+ import './vaadin-date-picker-styles.js';
5
+ import '../../src/vaadin-date-picker.js';
@@ -0,0 +1,5 @@
1
+ import './vaadin-date-picker-overlay-styles.js';
2
+ import './vaadin-date-picker-overlay-content-styles.js';
3
+ import './vaadin-month-calendar-styles.js';
4
+ import './vaadin-date-picker-styles.js';
5
+ import '../../src/vaadin-lit-date-picker.js';
@@ -0,0 +1,5 @@
1
+ import '@vaadin/vaadin-lumo-styles/color.js';
2
+ import '@vaadin/vaadin-lumo-styles/sizing.js';
3
+ import '@vaadin/vaadin-lumo-styles/spacing.js';
4
+ import '@vaadin/vaadin-lumo-styles/style.js';
5
+ import '@vaadin/vaadin-lumo-styles/typography.js';
@@ -0,0 +1,4 @@
1
+ import './vaadin-date-picker-overlay-styles.js';
2
+ import './vaadin-date-picker-overlay-content-styles.js';
3
+ import './vaadin-month-calendar-styles.js';
4
+ import '../../src/vaadin-date-picker-light.js';
@@ -0,0 +1,6 @@
1
+ import '@vaadin/vaadin-material-styles/color.js';
2
+ import '@vaadin/vaadin-material-styles/font-icons.js';
3
+ import '@vaadin/vaadin-material-styles/typography.js';
4
+ import '@vaadin/vaadin-material-styles/shadow.js';
5
+ import '@vaadin/button/theme/material/vaadin-button-styles.js';
6
+ import './vaadin-date-picker-year-styles.js';
@@ -0,0 +1,3 @@
1
+ import '@vaadin/input-container/theme/material/vaadin-input-container-styles.js';
2
+ import '@vaadin/vaadin-material-styles/color.js';
3
+ import '@vaadin/vaadin-material-styles/font-icons.js';
@@ -0,0 +1 @@
1
+ import '@vaadin/vaadin-material-styles/typography.js';
@@ -0,0 +1,5 @@
1
+ import './vaadin-date-picker-overlay-styles.js';
2
+ import './vaadin-date-picker-overlay-content-styles.js';
3
+ import './vaadin-month-calendar-styles.js';
4
+ import './vaadin-date-picker-styles.js';
5
+ import '../../src/vaadin-date-picker.js';
@@ -0,0 +1,5 @@
1
+ import './vaadin-date-picker-overlay-styles.js';
2
+ import './vaadin-date-picker-overlay-content-styles.js';
3
+ import './vaadin-month-calendar-styles.js';
4
+ import './vaadin-date-picker-styles.js';
5
+ import '../../src/vaadin-lit-date-picker.js';
@@ -0,0 +1,2 @@
1
+ import '@vaadin/vaadin-material-styles/color.js';
2
+ import '@vaadin/vaadin-material-styles/typography.js';
package/web-types.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/date-picker",
4
- "version": "24.4.0-alpha1",
4
+ "version": "24.4.0-alpha10",
5
5
  "description-markup": "markdown",
6
6
  "contributions": {
7
7
  "html": {
@@ -298,6 +298,16 @@
298
298
  ]
299
299
  }
300
300
  },
301
+ {
302
+ "name": "isDateDisabled",
303
+ "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.",
304
+ "value": {
305
+ "type": [
306
+ "function DatePickerDate: boolean",
307
+ "undefined"
308
+ ]
309
+ }
310
+ },
301
311
  {
302
312
  "name": "attrForValue",
303
313
  "description": "Name of the two-way data-bindable property representing the\nvalue of the custom input field.",
@@ -334,7 +344,7 @@
334
344
  },
335
345
  {
336
346
  "name": "vaadin-date-picker",
337
- "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\n`<vaadin-date-picker>` provides the same set of shadow DOM parts and state attributes as `<vaadin-text-field>`.\nSee [`<vaadin-text-field>`](https://cdn.vaadin.com/vaadin-web-components/24.4.0-alpha1/#/elements/vaadin-text-field) for the styling documentation.\n\nIn addition to `<vaadin-text-field>` parts, the following parts are available for theming:\n\nPart name | Description\n----------------------|--------------------\n`toggle-button` | Toggle button\n\nIn addition to `<vaadin-text-field>` state attributes, the following state attributes are available for theming:\n\nAttribute | Description | Part name\n-----------|--------------------------------------------------|-----------\n`opened` | Set when the date selector overlay is opened | :host\n\nIf you want to replace the default `<input>` and its container with a custom implementation to get full control\nover the input field, consider using the [`<vaadin-date-picker-light>`](https://cdn.vaadin.com/vaadin-web-components/24.4.0-alpha1/#/elements/vaadin-date-picker-light) element.\n\n### Internal components\n\nIn addition to `<vaadin-date-picker>` itself, the following internal\ncomponents are themable:\n\n- `<vaadin-date-picker-overlay>` - has the same API as [`<vaadin-overlay>`](https://cdn.vaadin.com/vaadin-web-components/24.4.0-alpha1/#/elements/vaadin-overlay).\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- [`<vaadin-input-container>`](https://cdn.vaadin.com/vaadin-web-components/24.4.0-alpha1/#/elements/vaadin-input-container) - an internal element wrapping the input.\n\nIn order to style the overlay content, use `<vaadin-date-picker-overlay-content>` shadow DOM parts:\n\nPart name | Description\n----------------------|--------------------\n`overlay-header` | Fullscreen mode header\n`label` | Fullscreen mode value/label\n`clear-button` | Fullscreen mode clear button\n`toggle-button` | Fullscreen mode toggle button\n`years-toggle-button` | Fullscreen mode years scroller toggle\n`toolbar` | Footer bar with slotted buttons\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\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`focused` | Focused date element\n`selected` | Selected date element\n`today` | Date element corresponding to the current day\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\nNote: the `theme` attribute value set on `<vaadin-date-picker>` is\npropagated to the internal components listed above.\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",
347
+ "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\n`<vaadin-date-picker>` provides the same set of shadow DOM parts and state attributes as `<vaadin-text-field>`.\nSee [`<vaadin-text-field>`](https://cdn.vaadin.com/vaadin-web-components/24.4.0-alpha10/#/elements/vaadin-text-field) for the styling documentation.\n\nIn addition to `<vaadin-text-field>` parts, the following parts are available for theming:\n\nPart name | Description\n----------------------|--------------------\n`toggle-button` | Toggle button\n\nIn addition to `<vaadin-text-field>` state attributes, the following state attributes are available for theming:\n\nAttribute | Description | Part name\n-----------|--------------------------------------------------|-----------\n`opened` | Set when the date selector overlay is opened | :host\n\nIf you want to replace the default `<input>` and its container with a custom implementation to get full control\nover the input field, consider using the [`<vaadin-date-picker-light>`](https://cdn.vaadin.com/vaadin-web-components/24.4.0-alpha10/#/elements/vaadin-date-picker-light) element.\n\n### Internal components\n\nIn addition to `<vaadin-date-picker>` itself, the following internal\ncomponents are themable:\n\n- `<vaadin-date-picker-overlay>` - has the same API as [`<vaadin-overlay>`](https://cdn.vaadin.com/vaadin-web-components/24.4.0-alpha10/#/elements/vaadin-overlay).\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- [`<vaadin-input-container>`](https://cdn.vaadin.com/vaadin-web-components/24.4.0-alpha10/#/elements/vaadin-input-container) - an internal element wrapping the input.\n\nIn order to style the overlay content, use `<vaadin-date-picker-overlay-content>` shadow DOM parts:\n\nPart name | Description\n----------------------|--------------------\n`overlay-header` | Fullscreen mode header\n`label` | Fullscreen mode value/label\n`clear-button` | Fullscreen mode clear button\n`toggle-button` | Fullscreen mode toggle button\n`years-toggle-button` | Fullscreen mode years scroller toggle\n`toolbar` | Footer bar with slotted buttons\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\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`focused` | Focused date element\n`selected` | Selected date element\n`today` | Date element corresponding to the current day\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\nNote: the `theme` attribute value set on `<vaadin-date-picker>` is\npropagated to the internal components listed above.\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",
338
348
  "attributes": [
339
349
  {
340
350
  "name": "disabled",
@@ -878,6 +888,16 @@
878
888
  "undefined"
879
889
  ]
880
890
  }
891
+ },
892
+ {
893
+ "name": "isDateDisabled",
894
+ "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.",
895
+ "value": {
896
+ "type": [
897
+ "function DatePickerDate: boolean",
898
+ "undefined"
899
+ ]
900
+ }
881
901
  }
882
902
  ],
883
903
  "events": [
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/date-picker",
4
- "version": "24.4.0-alpha1",
4
+ "version": "24.4.0-alpha10",
5
5
  "description-markup": "markdown",
6
6
  "framework": "lit",
7
7
  "framework-config": {
@@ -68,6 +68,13 @@
68
68
  "kind": "expression"
69
69
  }
70
70
  },
71
+ {
72
+ "name": "?isDateDisabled",
73
+ "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.",
74
+ "value": {
75
+ "kind": "expression"
76
+ }
77
+ },
71
78
  {
72
79
  "name": ".value",
73
80
  "description": "Selected date.\n\nSupported date formats:\n- ISO 8601 `\"YYYY-MM-DD\"` (default)\n- 6-digit extended ISO 8601 `\"+YYYYYY-MM-DD\"`, `\"-YYYYYY-MM-DD\"`",
@@ -156,7 +163,7 @@
156
163
  },
157
164
  {
158
165
  "name": "vaadin-date-picker",
159
- "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\n`<vaadin-date-picker>` provides the same set of shadow DOM parts and state attributes as `<vaadin-text-field>`.\nSee [`<vaadin-text-field>`](https://cdn.vaadin.com/vaadin-web-components/24.4.0-alpha1/#/elements/vaadin-text-field) for the styling documentation.\n\nIn addition to `<vaadin-text-field>` parts, the following parts are available for theming:\n\nPart name | Description\n----------------------|--------------------\n`toggle-button` | Toggle button\n\nIn addition to `<vaadin-text-field>` state attributes, the following state attributes are available for theming:\n\nAttribute | Description | Part name\n-----------|--------------------------------------------------|-----------\n`opened` | Set when the date selector overlay is opened | :host\n\nIf you want to replace the default `<input>` and its container with a custom implementation to get full control\nover the input field, consider using the [`<vaadin-date-picker-light>`](https://cdn.vaadin.com/vaadin-web-components/24.4.0-alpha1/#/elements/vaadin-date-picker-light) element.\n\n### Internal components\n\nIn addition to `<vaadin-date-picker>` itself, the following internal\ncomponents are themable:\n\n- `<vaadin-date-picker-overlay>` - has the same API as [`<vaadin-overlay>`](https://cdn.vaadin.com/vaadin-web-components/24.4.0-alpha1/#/elements/vaadin-overlay).\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- [`<vaadin-input-container>`](https://cdn.vaadin.com/vaadin-web-components/24.4.0-alpha1/#/elements/vaadin-input-container) - an internal element wrapping the input.\n\nIn order to style the overlay content, use `<vaadin-date-picker-overlay-content>` shadow DOM parts:\n\nPart name | Description\n----------------------|--------------------\n`overlay-header` | Fullscreen mode header\n`label` | Fullscreen mode value/label\n`clear-button` | Fullscreen mode clear button\n`toggle-button` | Fullscreen mode toggle button\n`years-toggle-button` | Fullscreen mode years scroller toggle\n`toolbar` | Footer bar with slotted buttons\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\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`focused` | Focused date element\n`selected` | Selected date element\n`today` | Date element corresponding to the current day\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\nNote: the `theme` attribute value set on `<vaadin-date-picker>` is\npropagated to the internal components listed above.\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",
166
+ "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\n`<vaadin-date-picker>` provides the same set of shadow DOM parts and state attributes as `<vaadin-text-field>`.\nSee [`<vaadin-text-field>`](https://cdn.vaadin.com/vaadin-web-components/24.4.0-alpha10/#/elements/vaadin-text-field) for the styling documentation.\n\nIn addition to `<vaadin-text-field>` parts, the following parts are available for theming:\n\nPart name | Description\n----------------------|--------------------\n`toggle-button` | Toggle button\n\nIn addition to `<vaadin-text-field>` state attributes, the following state attributes are available for theming:\n\nAttribute | Description | Part name\n-----------|--------------------------------------------------|-----------\n`opened` | Set when the date selector overlay is opened | :host\n\nIf you want to replace the default `<input>` and its container with a custom implementation to get full control\nover the input field, consider using the [`<vaadin-date-picker-light>`](https://cdn.vaadin.com/vaadin-web-components/24.4.0-alpha10/#/elements/vaadin-date-picker-light) element.\n\n### Internal components\n\nIn addition to `<vaadin-date-picker>` itself, the following internal\ncomponents are themable:\n\n- `<vaadin-date-picker-overlay>` - has the same API as [`<vaadin-overlay>`](https://cdn.vaadin.com/vaadin-web-components/24.4.0-alpha10/#/elements/vaadin-overlay).\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- [`<vaadin-input-container>`](https://cdn.vaadin.com/vaadin-web-components/24.4.0-alpha10/#/elements/vaadin-input-container) - an internal element wrapping the input.\n\nIn order to style the overlay content, use `<vaadin-date-picker-overlay-content>` shadow DOM parts:\n\nPart name | Description\n----------------------|--------------------\n`overlay-header` | Fullscreen mode header\n`label` | Fullscreen mode value/label\n`clear-button` | Fullscreen mode clear button\n`toggle-button` | Fullscreen mode toggle button\n`years-toggle-button` | Fullscreen mode years scroller toggle\n`toolbar` | Footer bar with slotted buttons\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\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`focused` | Focused date element\n`selected` | Selected date element\n`today` | Date element corresponding to the current day\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\nNote: the `theme` attribute value set on `<vaadin-date-picker>` is\npropagated to the internal components listed above.\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",
160
167
  "extension": true,
161
168
  "attributes": [
162
169
  {
@@ -229,6 +236,13 @@
229
236
  "kind": "expression"
230
237
  }
231
238
  },
239
+ {
240
+ "name": "?isDateDisabled",
241
+ "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.",
242
+ "value": {
243
+ "kind": "expression"
244
+ }
245
+ },
232
246
  {
233
247
  "name": ".label",
234
248
  "description": "The label text for the input node.\nWhen no light dom defined via [slot=label], this value will be used.",