@vaadin/date-picker 25.4.0-alpha4 → 25.4.0-alpha6
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.
- package/custom-elements.json +12 -0
- package/package.json +13 -13
- package/src/styles/vaadin-month-calendar-base-styles.js +9 -3
- package/src/vaadin-date-picker-overlay-content-mixin.js +6 -2
- package/src/vaadin-month-calendar-mixin.js +23 -6
- package/src/vaadin-month-calendar.js +18 -10
- package/web-types.json +1 -1
- package/web-types.lit.json +1 -1
package/custom-elements.json
CHANGED
|
@@ -1619,6 +1619,11 @@
|
|
|
1619
1619
|
"text": "date"
|
|
1620
1620
|
}
|
|
1621
1621
|
},
|
|
1622
|
+
{
|
|
1623
|
+
"kind": "field",
|
|
1624
|
+
"name": "focusableDateButton",
|
|
1625
|
+
"readonly": true
|
|
1626
|
+
},
|
|
1622
1627
|
{
|
|
1623
1628
|
"kind": "field",
|
|
1624
1629
|
"name": "focusableDateElement",
|
|
@@ -3233,9 +3238,16 @@
|
|
|
3233
3238
|
"text": "date"
|
|
3234
3239
|
}
|
|
3235
3240
|
},
|
|
3241
|
+
{
|
|
3242
|
+
"kind": "field",
|
|
3243
|
+
"name": "focusableDateButton",
|
|
3244
|
+
"description": "The button inside the cell of the focused date. Screen readers get the date's name and state\nfrom this element, so it is also the element that takes DOM focus.",
|
|
3245
|
+
"readonly": true
|
|
3246
|
+
},
|
|
3236
3247
|
{
|
|
3237
3248
|
"kind": "field",
|
|
3238
3249
|
"name": "focusableDateElement",
|
|
3250
|
+
"description": "The date cell of the focused date. It carries the `date` property and the date part names,\nwhile the button inside it is the element that takes DOM focus.",
|
|
3239
3251
|
"readonly": true
|
|
3240
3252
|
},
|
|
3241
3253
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/date-picker",
|
|
3
|
-
"version": "25.4.0-
|
|
3
|
+
"version": "25.4.0-alpha6",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -35,21 +35,21 @@
|
|
|
35
35
|
],
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
38
|
-
"@vaadin/a11y-base": "25.4.0-
|
|
39
|
-
"@vaadin/button": "25.4.0-
|
|
40
|
-
"@vaadin/component-base": "25.4.0-
|
|
41
|
-
"@vaadin/field-base": "25.4.0-
|
|
42
|
-
"@vaadin/input-container": "25.4.0-
|
|
43
|
-
"@vaadin/overlay": "25.4.0-
|
|
44
|
-
"@vaadin/vaadin-themable-mixin": "25.4.0-
|
|
38
|
+
"@vaadin/a11y-base": "25.4.0-alpha6",
|
|
39
|
+
"@vaadin/button": "25.4.0-alpha6",
|
|
40
|
+
"@vaadin/component-base": "25.4.0-alpha6",
|
|
41
|
+
"@vaadin/field-base": "25.4.0-alpha6",
|
|
42
|
+
"@vaadin/input-container": "25.4.0-alpha6",
|
|
43
|
+
"@vaadin/overlay": "25.4.0-alpha6",
|
|
44
|
+
"@vaadin/vaadin-themable-mixin": "25.4.0-alpha6",
|
|
45
45
|
"lit": "^3.0.0"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@vaadin/aura": "25.4.0-
|
|
49
|
-
"@vaadin/chai-plugins": "25.4.0-
|
|
50
|
-
"@vaadin/test-runner-commands": "25.4.0-
|
|
48
|
+
"@vaadin/aura": "25.4.0-alpha6",
|
|
49
|
+
"@vaadin/chai-plugins": "25.4.0-alpha6",
|
|
50
|
+
"@vaadin/test-runner-commands": "25.4.0-alpha6",
|
|
51
51
|
"@vaadin/testing-helpers": "^2.0.0",
|
|
52
|
-
"@vaadin/vaadin-lumo-styles": "25.4.0-
|
|
52
|
+
"@vaadin/vaadin-lumo-styles": "25.4.0-alpha6",
|
|
53
53
|
"sinon": "^22.0.0"
|
|
54
54
|
},
|
|
55
55
|
"customElements": "custom-elements.json",
|
|
@@ -57,5 +57,5 @@
|
|
|
57
57
|
"web-types.json",
|
|
58
58
|
"web-types.lit.json"
|
|
59
59
|
],
|
|
60
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "4ead7de23a27c47e5ef4cb172481f8c54e86691a"
|
|
61
61
|
}
|
|
@@ -69,7 +69,8 @@ export const monthCalendarStyles = css`
|
|
|
69
69
|
|
|
70
70
|
[part~='weekday'],
|
|
71
71
|
[part~='week-number'],
|
|
72
|
-
[part~='date']
|
|
72
|
+
[part~='date'],
|
|
73
|
+
.date-button {
|
|
73
74
|
align-items: center;
|
|
74
75
|
display: flex;
|
|
75
76
|
justify-content: center;
|
|
@@ -81,7 +82,6 @@ export const monthCalendarStyles = css`
|
|
|
81
82
|
position: relative;
|
|
82
83
|
height: var(--vaadin-date-picker-date-height, 2rem);
|
|
83
84
|
cursor: var(--vaadin-clickable-cursor);
|
|
84
|
-
outline: none;
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
[part~='date']:empty {
|
|
@@ -97,7 +97,13 @@ export const monthCalendarStyles = css`
|
|
|
97
97
|
aspect-ratio: 1;
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
-
|
|
100
|
+
.date-button {
|
|
101
|
+
flex: 1;
|
|
102
|
+
align-self: stretch;
|
|
103
|
+
outline: none;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
:where([part~='date']:has(:focus-visible))::after {
|
|
101
107
|
outline: var(--vaadin-focus-ring-width) solid var(--vaadin-focus-ring-color);
|
|
102
108
|
outline-offset: calc(var(--vaadin-focus-ring-width) * -1);
|
|
103
109
|
}
|
|
@@ -230,6 +230,10 @@ export const DatePickerOverlayContentMixin = (superClass) =>
|
|
|
230
230
|
return this.calendars.map((calendar) => calendar.focusableDateElement).find(Boolean);
|
|
231
231
|
}
|
|
232
232
|
|
|
233
|
+
get focusableDateButton() {
|
|
234
|
+
return this.calendars.map((calendar) => calendar.focusableDateButton).find(Boolean);
|
|
235
|
+
}
|
|
236
|
+
|
|
233
237
|
/** @protected */
|
|
234
238
|
_initControllers() {
|
|
235
239
|
this.addController(
|
|
@@ -897,12 +901,12 @@ export const DatePickerOverlayContentMixin = (superClass) =>
|
|
|
897
901
|
__tryFocusDate() {
|
|
898
902
|
const dateToFocus = this.__pendingDateFocus;
|
|
899
903
|
if (dateToFocus) {
|
|
900
|
-
// Check the date
|
|
904
|
+
// Check the cell of the date that has the focusable button
|
|
901
905
|
const dateElement = this.focusableDateElement;
|
|
902
906
|
|
|
903
907
|
if (dateElement && dateEquals(dateElement.date, this.__pendingDateFocus)) {
|
|
904
908
|
delete this.__pendingDateFocus;
|
|
905
|
-
|
|
909
|
+
this.focusableDateButton.focus();
|
|
906
910
|
}
|
|
907
911
|
}
|
|
908
912
|
}
|
|
@@ -146,15 +146,32 @@ export const MonthCalendarMixin = (superClass) =>
|
|
|
146
146
|
return ['__focusedDateChanged(focusedDate, _days)', '_showWeekNumbersChanged(showWeekNumbers, i18n)'];
|
|
147
147
|
}
|
|
148
148
|
|
|
149
|
+
/**
|
|
150
|
+
* The date cell of the focused date. It carries the `date` property and the date part names,
|
|
151
|
+
* while the button inside it is the element that takes DOM focus.
|
|
152
|
+
*/
|
|
149
153
|
get focusableDateElement() {
|
|
150
154
|
return [...this.shadowRoot.querySelectorAll('[part~=date]')].find((datePart) => {
|
|
151
155
|
return dateEquals(datePart.date, this.focusedDate);
|
|
152
156
|
});
|
|
153
157
|
}
|
|
154
158
|
|
|
159
|
+
/**
|
|
160
|
+
* The button inside the cell of the focused date. Screen readers get the date's name and state
|
|
161
|
+
* from this element, so it is also the element that takes DOM focus.
|
|
162
|
+
*/
|
|
163
|
+
get focusableDateButton() {
|
|
164
|
+
const cell = this.focusableDateElement;
|
|
165
|
+
return cell ? cell.querySelector('.date-button') : undefined;
|
|
166
|
+
}
|
|
167
|
+
|
|
155
168
|
/** @protected */
|
|
156
169
|
ready() {
|
|
157
170
|
super.ready();
|
|
171
|
+
|
|
172
|
+
// Use application to enforce focus mode for date cells in NVDA
|
|
173
|
+
this.setAttribute('role', 'application');
|
|
174
|
+
|
|
158
175
|
addListener(this.$.monthGrid, 'tap', this._handleTap.bind(this));
|
|
159
176
|
}
|
|
160
177
|
|
|
@@ -289,18 +306,18 @@ export const MonthCalendarMixin = (superClass) =>
|
|
|
289
306
|
if (i % 7 === 0) {
|
|
290
307
|
acc.push([]);
|
|
291
308
|
}
|
|
292
|
-
acc
|
|
309
|
+
acc.at(-1).push(day);
|
|
293
310
|
return acc;
|
|
294
311
|
}, []);
|
|
295
312
|
}
|
|
296
313
|
|
|
297
314
|
/** @protected */
|
|
298
315
|
_handleTap(e) {
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
);
|
|
316
|
+
// A tap can land on the button or on the cell padding around it.
|
|
317
|
+
const cell = e.target.closest('[part~=date]');
|
|
318
|
+
if (!this.ignoreTaps && !this._notTapping && cell?.date && !cell.hasAttribute('disabled')) {
|
|
319
|
+
this.selectedDate = cell.date;
|
|
320
|
+
this.dispatchEvent(new CustomEvent('date-tap', { detail: { date: cell.date }, bubbles: true, composed: true }));
|
|
304
321
|
}
|
|
305
322
|
}
|
|
306
323
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright (c) 2016 - 2026 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
-
import { html, LitElement } from 'lit';
|
|
6
|
+
import { html, LitElement, nothing } from 'lit';
|
|
7
7
|
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
8
8
|
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
|
|
9
9
|
import { LumoInjectionMixin } from '@vaadin/vaadin-themable-mixin/lumo-injection-mixin.js';
|
|
@@ -80,16 +80,24 @@ class MonthCalendar extends MonthCalendarMixin(ThemableMixin(PolylitMixin(LumoIn
|
|
|
80
80
|
)}"
|
|
81
81
|
.date="${date}"
|
|
82
82
|
?disabled="${this.__isDayDisabled(date, this.minDate, this.maxDate, this.isDateDisabled)}"
|
|
83
|
-
tabindex="${this.__computeDayTabIndex(date, this.focusedDate)}"
|
|
84
83
|
aria-selected="${this.__computeDayAriaSelected(date, this.selectedDate)}"
|
|
85
|
-
|
|
86
|
-
date
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
84
|
+
>${
|
|
85
|
+
date
|
|
86
|
+
? html`<div
|
|
87
|
+
class="date-button"
|
|
88
|
+
role="button"
|
|
89
|
+
tabindex="${this.__computeDayTabIndex(date, this.focusedDate)}"
|
|
90
|
+
aria-label="${this.__computeDayAriaLabel(date)}"
|
|
91
|
+
aria-disabled="${this.__computeDayAriaDisabled(
|
|
92
|
+
date,
|
|
93
|
+
this.minDate,
|
|
94
|
+
this.maxDate,
|
|
95
|
+
this.isDateDisabled,
|
|
96
|
+
)}"
|
|
97
|
+
>${this._getDate(date)}</div
|
|
98
|
+
>`
|
|
99
|
+
: nothing
|
|
100
|
+
}</td
|
|
93
101
|
>
|
|
94
102
|
`;
|
|
95
103
|
})}
|
package/web-types.json
CHANGED
package/web-types.lit.json
CHANGED