@vaadin/date-picker 24.2.0-alpha6 → 24.2.0-alpha8

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.
@@ -5,76 +5,23 @@
5
5
  */
6
6
  import '@polymer/polymer/lib/elements/dom-repeat.js';
7
7
  import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
8
- import { FocusMixin } from '@vaadin/a11y-base/src/focus-mixin.js';
9
- import { addListener } from '@vaadin/component-base/src/gestures.js';
10
- import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
11
- import { dateAllowed, dateEquals, getISOWeekNumber } from './vaadin-date-picker-helper.js';
8
+ import { registerStyles, ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
9
+ import { dateAllowed, dateEquals } from './vaadin-date-picker-helper.js';
10
+ import { MonthCalendarMixin } from './vaadin-month-calendar-mixin.js';
11
+ import { monthCalendarStyles } from './vaadin-month-calendar-styles.js';
12
+
13
+ registerStyles('vaadin-month-calendar', monthCalendarStyles, {
14
+ moduleId: 'vaadin-month-calendar-styles',
15
+ });
12
16
 
13
17
  /**
14
18
  * @extends HTMLElement
15
19
  * @private
16
20
  */
17
- class MonthCalendar extends FocusMixin(ThemableMixin(PolymerElement)) {
21
+ class MonthCalendar extends MonthCalendarMixin(ThemableMixin(PolymerElement)) {
18
22
  static get template() {
19
23
  return html`
20
- <style>
21
- :host {
22
- display: block;
23
- }
24
-
25
- #monthGrid {
26
- width: 100%;
27
- border-collapse: collapse;
28
- }
29
-
30
- #days-container tr,
31
- #weekdays-container tr {
32
- display: flex;
33
- }
34
-
35
- [part~='date'] {
36
- outline: none;
37
- }
38
-
39
- [part~='disabled'] {
40
- pointer-events: none;
41
- }
42
-
43
- [part='week-number'][hidden],
44
- [part='weekday'][hidden] {
45
- display: none;
46
- }
47
-
48
- [part='weekday'],
49
- [part~='date'] {
50
- width: calc(100% / 7);
51
- padding: 0;
52
- font-weight: normal;
53
- }
54
-
55
- [part='weekday']:empty,
56
- [part='week-number'] {
57
- width: 12.5%;
58
- flex-shrink: 0;
59
- padding: 0;
60
- }
61
-
62
- :host([week-numbers]) [part='weekday']:not(:empty),
63
- :host([week-numbers]) [part~='date'] {
64
- width: 12.5%;
65
- }
66
-
67
- @media (forced-colors: active) {
68
- [part~='date'][part~='focused'] {
69
- outline: 1px solid;
70
- }
71
- [part~='date'][part~='selected'] {
72
- outline: 3px solid;
73
- }
74
- }
75
- </style>
76
-
77
- <div part="month-header" id="month-header" aria-hidden="true">[[_getTitle(month, i18n.monthNames)]]</div>
24
+ <div part="month-header" id="month-header" aria-hidden="true">[[_getTitle(month, i18n)]]</div>
78
25
  <table
79
26
  id="monthGrid"
80
27
  role="grid"
@@ -84,15 +31,8 @@ class MonthCalendar extends FocusMixin(ThemableMixin(PolymerElement)) {
84
31
  >
85
32
  <thead id="weekdays-container">
86
33
  <tr role="row" part="weekdays">
87
- <th
88
- part="weekday"
89
- aria-hidden="true"
90
- hidden$="[[!_showWeekSeparator(showWeekNumbers, i18n.firstDayOfWeek)]]"
91
- ></th>
92
- <template
93
- is="dom-repeat"
94
- items="[[_getWeekDayNames(i18n.weekdays, i18n.weekdaysShort, showWeekNumbers, i18n.firstDayOfWeek)]]"
95
- >
34
+ <th part="weekday" aria-hidden="true" hidden$="[[!_showWeekSeparator(showWeekNumbers, i18n)]]"></th>
35
+ <template is="dom-repeat" items="[[_getWeekDayNames(i18n, showWeekNumbers)]]">
96
36
  <th role="columnheader" part="weekday" scope="col" abbr$="[[item.weekDay]]" aria-hidden="true">
97
37
  [[item.weekDayShort]]
98
38
  </th>
@@ -102,11 +42,7 @@ class MonthCalendar extends FocusMixin(ThemableMixin(PolymerElement)) {
102
42
  <tbody id="days-container">
103
43
  <template is="dom-repeat" items="[[_weeks]]" as="week">
104
44
  <tr role="row">
105
- <td
106
- part="week-number"
107
- aria-hidden="true"
108
- hidden$="[[!_showWeekSeparator(showWeekNumbers, i18n.firstDayOfWeek)]]"
109
- >
45
+ <td part="week-number" aria-hidden="true" hidden$="[[!_showWeekSeparator(showWeekNumbers, i18n)]]">
110
46
  [[__getWeekNumber(week)]]
111
47
  </td>
112
48
  <template is="dom-repeat" items="[[week]]">
@@ -135,65 +71,13 @@ class MonthCalendar extends FocusMixin(ThemableMixin(PolymerElement)) {
135
71
 
136
72
  static get properties() {
137
73
  return {
138
- /**
139
- * A `Date` object defining the month to be displayed. Only year and
140
- * month properties are actually used.
141
- */
142
- month: {
143
- type: Date,
144
- value: new Date(),
145
- },
146
-
147
- /**
148
- * A `Date` object for the currently selected date.
149
- */
150
- selectedDate: {
151
- type: Date,
152
- notify: true,
153
- },
154
-
155
- /**
156
- * A `Date` object for the currently focused date.
157
- */
158
- focusedDate: Date,
159
-
160
- showWeekNumbers: {
161
- type: Boolean,
162
- value: false,
163
- },
164
-
165
- i18n: {
166
- type: Object,
167
- },
168
-
169
- /**
170
- * Flag stating whether taps on the component should be ignored.
171
- */
172
- ignoreTaps: Boolean,
173
-
174
- _notTapping: Boolean,
175
-
176
- /**
177
- * The earliest date that can be selected. All earlier dates will be disabled.
178
- */
179
- minDate: {
180
- type: Date,
181
- value: null,
182
- },
183
-
184
- /**
185
- * The latest date that can be selected. All later dates will be disabled.
186
- */
187
- maxDate: {
188
- type: Date,
189
- value: null,
190
- },
191
-
74
+ /** @protected */
192
75
  _days: {
193
76
  type: Array,
194
- computed: '_getDays(month, i18n.firstDayOfWeek, minDate, maxDate)',
77
+ computed: '_getDays(month, i18n, minDate, maxDate)',
195
78
  },
196
79
 
80
+ /** @protected */
197
81
  _weeks: {
198
82
  type: Array,
199
83
  computed: '_getWeeks(_days)',
@@ -208,177 +92,19 @@ class MonthCalendar extends FocusMixin(ThemableMixin(PolymerElement)) {
208
92
  }
209
93
 
210
94
  static get observers() {
211
- return [
212
- '_showWeekNumbersChanged(showWeekNumbers, i18n.firstDayOfWeek)',
213
- '__focusedDateChanged(focusedDate, _days)',
214
- ];
215
- }
216
-
217
- get focusableDateElement() {
218
- return [...this.shadowRoot.querySelectorAll('[part~=date]')].find((datePart) => {
219
- return dateEquals(datePart.date, this.focusedDate);
220
- });
221
- }
222
-
223
- /** @protected */
224
- ready() {
225
- super.ready();
226
- addListener(this.$.monthGrid, 'tap', this._handleTap.bind(this));
227
- }
228
-
229
- /* Returns true if all the dates in the month are out of the allowed range */
230
- _isDisabled(month, minDate, maxDate) {
231
- // First day of the month
232
- const firstDate = new Date(0, 0);
233
- firstDate.setFullYear(month.getFullYear());
234
- firstDate.setMonth(month.getMonth());
235
- firstDate.setDate(1);
236
-
237
- // Last day of the month
238
- const lastDate = new Date(0, 0);
239
- lastDate.setFullYear(month.getFullYear());
240
- lastDate.setMonth(month.getMonth() + 1);
241
- lastDate.setDate(0);
242
-
243
- if (
244
- minDate &&
245
- maxDate &&
246
- minDate.getMonth() === maxDate.getMonth() &&
247
- minDate.getMonth() === month.getMonth() &&
248
- maxDate.getDate() - minDate.getDate() >= 0
249
- ) {
250
- return false;
251
- }
252
-
253
- return !dateAllowed(firstDate, minDate, maxDate) && !dateAllowed(lastDate, minDate, maxDate);
254
- }
255
-
256
- _getTitle(month, monthNames) {
257
- if (month === undefined || monthNames === undefined) {
258
- return;
259
- }
260
- return this.i18n.formatTitle(monthNames[month.getMonth()], month.getFullYear());
261
- }
262
-
263
- _onMonthGridTouchStart() {
264
- this._notTapping = false;
265
- setTimeout(() => {
266
- this._notTapping = true;
267
- }, 300);
268
- }
269
-
270
- _dateAdd(date, delta) {
271
- date.setDate(date.getDate() + delta);
272
- }
273
-
274
- _applyFirstDayOfWeek(weekDayNames, firstDayOfWeek) {
275
- if (weekDayNames === undefined || firstDayOfWeek === undefined) {
276
- return;
277
- }
278
-
279
- return weekDayNames.slice(firstDayOfWeek).concat(weekDayNames.slice(0, firstDayOfWeek));
280
- }
281
-
282
- _getWeekDayNames(weekDayNames, weekDayNamesShort, showWeekNumbers, firstDayOfWeek) {
283
- if (
284
- weekDayNames === undefined ||
285
- weekDayNamesShort === undefined ||
286
- showWeekNumbers === undefined ||
287
- firstDayOfWeek === undefined
288
- ) {
289
- return;
290
- }
291
- weekDayNames = this._applyFirstDayOfWeek(weekDayNames, firstDayOfWeek);
292
- weekDayNamesShort = this._applyFirstDayOfWeek(weekDayNamesShort, firstDayOfWeek);
293
- weekDayNames = weekDayNames.map((day, index) => {
294
- return {
295
- weekDay: day,
296
- weekDayShort: weekDayNamesShort[index],
297
- };
298
- });
299
-
300
- return weekDayNames;
95
+ return ['_showWeekNumbersChanged(showWeekNumbers, i18n)'];
301
96
  }
302
97
 
303
- __focusedDateChanged(focusedDate, days) {
304
- if (days.some((date) => dateEquals(date, focusedDate))) {
305
- this.removeAttribute('aria-hidden');
306
- } else {
307
- this.setAttribute('aria-hidden', 'true');
308
- }
309
- }
310
-
311
- _getDate(date) {
312
- return date ? date.getDate() : '';
313
- }
314
-
315
- _showWeekNumbersChanged(showWeekNumbers, firstDayOfWeek) {
316
- if (showWeekNumbers && firstDayOfWeek === 1) {
98
+ /** @private */
99
+ _showWeekNumbersChanged(showWeekNumbers, i18n) {
100
+ if (showWeekNumbers && i18n && i18n.firstDayOfWeek === 1) {
317
101
  this.setAttribute('week-numbers', '');
318
102
  } else {
319
103
  this.removeAttribute('week-numbers');
320
104
  }
321
105
  }
322
106
 
323
- _showWeekSeparator(showWeekNumbers, firstDayOfWeek) {
324
- // Currently only supported for locales that start the week on Monday.
325
- return showWeekNumbers && firstDayOfWeek === 1;
326
- }
327
-
328
- _isToday(date) {
329
- return dateEquals(new Date(), date);
330
- }
331
-
332
- _getDays(month, firstDayOfWeek) {
333
- if (month === undefined || firstDayOfWeek === undefined) {
334
- return;
335
- }
336
- // First day of the month (at midnight).
337
- const date = new Date(0, 0);
338
- date.setFullYear(month.getFullYear());
339
- date.setMonth(month.getMonth());
340
- date.setDate(1);
341
-
342
- // Rewind to first day of the week.
343
- while (date.getDay() !== firstDayOfWeek) {
344
- this._dateAdd(date, -1);
345
- }
346
-
347
- const days = [];
348
- const startMonth = date.getMonth();
349
- const targetMonth = month.getMonth();
350
- while (date.getMonth() === targetMonth || date.getMonth() === startMonth) {
351
- days.push(date.getMonth() === targetMonth ? new Date(date.getTime()) : null);
352
-
353
- // Advance to next day.
354
- this._dateAdd(date, 1);
355
- }
356
- return days;
357
- }
358
-
359
- _getWeeks(days) {
360
- return days.reduce((acc, day, i) => {
361
- if (i % 7 === 0) {
362
- acc.push([]);
363
- }
364
- acc[acc.length - 1].push(day);
365
- return acc;
366
- }, []);
367
- }
368
-
369
- _handleTap(e) {
370
- if (!this.ignoreTaps && !this._notTapping && e.target.date && !e.target.hasAttribute('disabled')) {
371
- this.selectedDate = e.target.date;
372
- this.dispatchEvent(
373
- new CustomEvent('date-tap', { detail: { date: e.target.date }, bubbles: true, composed: true }),
374
- );
375
- }
376
- }
377
-
378
- _preventDefault(e) {
379
- e.preventDefault();
380
- }
381
-
107
+ /** @private */
382
108
  __getDatePart(date, focusedDate, selectedDate, minDate, maxDate) {
383
109
  const result = ['date'];
384
110
 
@@ -401,32 +127,29 @@ class MonthCalendar extends FocusMixin(ThemableMixin(PolymerElement)) {
401
127
  return result.join(' ');
402
128
  }
403
129
 
404
- __getWeekNumber(days) {
405
- const date = days.reduce((acc, d) => {
406
- return !acc && d ? d : acc;
407
- });
408
-
409
- return getISOWeekNumber(date);
410
- }
411
-
130
+ /** @private */
412
131
  __isDayFocused(date, focusedDate) {
413
132
  return dateEquals(date, focusedDate);
414
133
  }
415
134
 
135
+ /** @private */
416
136
  __isDaySelected(date, selectedDate) {
417
137
  return dateEquals(date, selectedDate);
418
138
  }
419
139
 
140
+ /** @private */
420
141
  __getDayAriaSelected(date, selectedDate) {
421
142
  if (this.__isDaySelected(date, selectedDate)) {
422
143
  return 'true';
423
144
  }
424
145
  }
425
146
 
147
+ /** @private */
426
148
  __isDayDisabled(date, minDate, maxDate) {
427
149
  return !dateAllowed(date, minDate, maxDate);
428
150
  }
429
151
 
152
+ /** @private */
430
153
  __getDayAriaDisabled(date, min, max) {
431
154
  if (date === undefined || min === undefined || max === undefined) {
432
155
  return;
@@ -437,22 +160,7 @@ class MonthCalendar extends FocusMixin(ThemableMixin(PolymerElement)) {
437
160
  }
438
161
  }
439
162
 
440
- __getDayAriaLabel(date) {
441
- if (!date) {
442
- return '';
443
- }
444
-
445
- let ariaLabel = `${this._getDate(date)} ${this.i18n.monthNames[date.getMonth()]} ${date.getFullYear()}, ${
446
- this.i18n.weekdays[date.getDay()]
447
- }`;
448
-
449
- if (this._isToday(date)) {
450
- ariaLabel += `, ${this.i18n.today}`;
451
- }
452
-
453
- return ariaLabel;
454
- }
455
-
163
+ /** @private */
456
164
  __getDayTabindex(date, focusedDate) {
457
165
  if (this.__isDayFocused(date, focusedDate)) {
458
166
  return '0';
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.2.0-alpha6",
4
+ "version": "24.2.0-alpha8",
5
5
  "description-markup": "markdown",
6
6
  "contributions": {
7
7
  "html": {
@@ -41,6 +41,17 @@
41
41
  ]
42
42
  }
43
43
  },
44
+ {
45
+ "name": "dirty",
46
+ "description": "Whether the field is dirty.\n\nThe field is automatically marked as dirty once the user triggers\nan `input` or `change` event. Additionally, the field can be manually\nmarked as dirty by setting the property to `true`.",
47
+ "value": {
48
+ "type": [
49
+ "boolean",
50
+ "null",
51
+ "undefined"
52
+ ]
53
+ }
54
+ },
44
55
  {
45
56
  "name": "invalid",
46
57
  "description": "Set to true when the field is invalid.",
@@ -192,6 +203,17 @@
192
203
  ]
193
204
  }
194
205
  },
206
+ {
207
+ "name": "dirty",
208
+ "description": "Whether the field is dirty.\n\nThe field is automatically marked as dirty once the user triggers\nan `input` or `change` event. Additionally, the field can be manually\nmarked as dirty by setting the property to `true`.",
209
+ "value": {
210
+ "type": [
211
+ "boolean",
212
+ "null",
213
+ "undefined"
214
+ ]
215
+ }
216
+ },
195
217
  {
196
218
  "name": "invalid",
197
219
  "description": "Set to true when the field is invalid.",
@@ -325,6 +347,10 @@
325
347
  "name": "value-changed",
326
348
  "description": "Fired when `value` property value changes."
327
349
  },
350
+ {
351
+ "name": "dirty-changed",
352
+ "description": "Fired when the `dirty` property changes."
353
+ },
328
354
  {
329
355
  "name": "invalid-changed",
330
356
  "description": "Fired when the `invalid` property changes."
@@ -334,7 +360,7 @@
334
360
  },
335
361
  {
336
362
  "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.2.0-alpha6/#/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.2.0-alpha6/#/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.2.0-alpha6/#/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.2.0-alpha6/#/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.",
363
+ "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.2.0-alpha8/#/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.2.0-alpha8/#/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.2.0-alpha8/#/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.2.0-alpha8/#/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.",
338
364
  "attributes": [
339
365
  {
340
366
  "name": "disabled",
@@ -444,6 +470,17 @@
444
470
  ]
445
471
  }
446
472
  },
473
+ {
474
+ "name": "dirty",
475
+ "description": "Whether the field is dirty.\n\nThe field is automatically marked as dirty once the user triggers\nan `input` or `change` event. Additionally, the field can be manually\nmarked as dirty by setting the property to `true`.",
476
+ "value": {
477
+ "type": [
478
+ "boolean",
479
+ "null",
480
+ "undefined"
481
+ ]
482
+ }
483
+ },
447
484
  {
448
485
  "name": "clear-button-visible",
449
486
  "description": "Set to true to display the clear icon which clears the input.\n\nIt is up to the component to choose where to place the clear icon:\nin the Shadow DOM or in the light DOM. In any way, a reference to\nthe clear icon element should be provided via the `clearElement` getter.",
@@ -718,6 +755,17 @@
718
755
  ]
719
756
  }
720
757
  },
758
+ {
759
+ "name": "dirty",
760
+ "description": "Whether the field is dirty.\n\nThe field is automatically marked as dirty once the user triggers\nan `input` or `change` event. Additionally, the field can be manually\nmarked as dirty by setting the property to `true`.",
761
+ "value": {
762
+ "type": [
763
+ "boolean",
764
+ "null",
765
+ "undefined"
766
+ ]
767
+ }
768
+ },
721
769
  {
722
770
  "name": "clearButtonVisible",
723
771
  "description": "Set to true to display the clear icon which clears the input.\n\nIt is up to the component to choose where to place the clear icon:\nin the Shadow DOM or in the light DOM. In any way, a reference to\nthe clear icon element should be provided via the `clearElement` getter.",
@@ -904,6 +952,10 @@
904
952
  {
905
953
  "name": "invalid-changed",
906
954
  "description": "Fired when the `invalid` property changes."
955
+ },
956
+ {
957
+ "name": "dirty-changed",
958
+ "description": "Fired when the `dirty` property changes."
907
959
  }
908
960
  ]
909
961
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/date-picker",
4
- "version": "24.2.0-alpha6",
4
+ "version": "24.2.0-alpha8",
5
5
  "description-markup": "markdown",
6
6
  "framework": "lit",
7
7
  "framework-config": {
@@ -33,6 +33,13 @@
33
33
  "kind": "expression"
34
34
  }
35
35
  },
36
+ {
37
+ "name": "?dirty",
38
+ "description": "Whether the field is dirty.\n\nThe field is automatically marked as dirty once the user triggers\nan `input` or `change` event. Additionally, the field can be manually\nmarked as dirty by setting the property to `true`.",
39
+ "value": {
40
+ "kind": "expression"
41
+ }
42
+ },
36
43
  {
37
44
  "name": "?invalid",
38
45
  "description": "Set to true when the field is invalid.",
@@ -145,6 +152,13 @@
145
152
  "kind": "expression"
146
153
  }
147
154
  },
155
+ {
156
+ "name": "@dirty-changed",
157
+ "description": "Fired when the `dirty` property changes.",
158
+ "value": {
159
+ "kind": "expression"
160
+ }
161
+ },
148
162
  {
149
163
  "name": "@invalid-changed",
150
164
  "description": "Fired when the `invalid` property changes.",
@@ -156,7 +170,7 @@
156
170
  },
157
171
  {
158
172
  "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.2.0-alpha6/#/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.2.0-alpha6/#/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.2.0-alpha6/#/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.2.0-alpha6/#/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.",
173
+ "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.2.0-alpha8/#/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.2.0-alpha8/#/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.2.0-alpha8/#/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.2.0-alpha8/#/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.",
160
174
  "extension": true,
161
175
  "attributes": [
162
176
  {
@@ -187,6 +201,13 @@
187
201
  "kind": "expression"
188
202
  }
189
203
  },
204
+ {
205
+ "name": "?dirty",
206
+ "description": "Whether the field is dirty.\n\nThe field is automatically marked as dirty once the user triggers\nan `input` or `change` event. Additionally, the field can be manually\nmarked as dirty by setting the property to `true`.",
207
+ "value": {
208
+ "kind": "expression"
209
+ }
210
+ },
190
211
  {
191
212
  "name": "?clearButtonVisible",
192
213
  "description": "Set to true to display the clear icon which clears the input.\n\nIt is up to the component to choose where to place the clear icon:\nin the Shadow DOM or in the light DOM. In any way, a reference to\nthe clear icon element should be provided via the `clearElement` getter.",
@@ -375,6 +396,13 @@
375
396
  "value": {
376
397
  "kind": "expression"
377
398
  }
399
+ },
400
+ {
401
+ "name": "@dirty-changed",
402
+ "description": "Fired when the `dirty` property changes.",
403
+ "value": {
404
+ "kind": "expression"
405
+ }
378
406
  }
379
407
  ]
380
408
  }