@mintplayer/web-components 2.2.0 → 2.3.0
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/a11y/index.mjs +26 -2
- package/a11y/src/dismiss-stack.d.ts +25 -0
- package/a11y/src/error-text.d.ts +41 -0
- package/a11y/src/focus-restore.d.ts +116 -0
- package/a11y/src/focus-trap.d.ts +69 -0
- package/a11y/src/form-associated.d.ts +48 -0
- package/a11y/src/host-aria.d.ts +154 -0
- package/a11y/src/index.d.ts +16 -0
- package/a11y/src/inert-regions.d.ts +52 -0
- package/a11y/src/live-announcer.d.ts +8 -0
- package/a11y/src/roving-focus.d.ts +118 -0
- package/a11y/src/testing/expect-idref-resolves.d.ts +31 -0
- package/a11y/src/testing/index.d.ts +1 -0
- package/accordion/index.mjs +180 -174
- package/accordion/src/components/mp-accordion.d.ts +18 -13
- package/calendar/index.mjs +1 -1
- package/calendar/src/mp-calendar.element.d.ts +2 -0
- package/carousel/index.mjs +211 -164
- package/carousel/src/components/mp-carousel.d.ts +1 -0
- package/checkbox/index.mjs +1 -1
- package/checkbox/src/components/mp-checkbox.d.ts +59 -1
- package/chunks/focus-restore-DxuP1Oe2.mjs +94 -0
- package/chunks/focus-trap-DTOLJ5bb.mjs +121 -0
- package/chunks/form-associated-axmc5sY0.mjs +58 -0
- package/chunks/host-aria-WSGs7SPQ.mjs +152 -0
- package/chunks/inert-regions-DXCnn1LN.mjs +48 -0
- package/chunks/invalid-feedback.styles-he0JYrJm.mjs +11 -0
- package/chunks/{live-announcer-CZDTKulf.mjs → live-announcer-Bi0orG4n.mjs} +9 -9
- package/chunks/{mp-calendar.element-UC68iDbi.mjs → mp-calendar.element-u6uS31_j.mjs} +136 -105
- package/chunks/mp-checkbox-Ph2mMRGz.mjs +312 -0
- package/chunks/{mp-datatable-Bfw0KGkV.mjs → mp-datatable-BwTlh9A_.mjs} +265 -103
- package/chunks/{mp-pagination-BGxsawFL.mjs → mp-pagination-Dea75mD4.mjs} +25 -22
- package/chunks/mp-radio-BjW1HNSc.mjs +300 -0
- package/chunks/{mp-select-BDS1-YGn.mjs → mp-select-Ctu-v1-p.mjs} +163 -40
- package/chunks/{mp-splitter-C8cGCmac.mjs → mp-splitter-LszuRDbR.mjs} +53 -46
- package/chunks/{mp-tab-page-D1b4x-y2.mjs → mp-tab-page-CaCzX1ym.mjs} +46 -45
- package/chunks/{mp-timepicker.element-BwEiwX92.mjs → mp-timepicker.element-Bz393NDQ.mjs} +93 -86
- package/chunks/{mp-toggle-button-dLZNDUVz.mjs → mp-toggle-button-Kz6sIgBJ.mjs} +131 -37
- package/chunks/{mp-treeview-C48F63xb.mjs → mp-treeview-tkWu28iF.mjs} +67 -43
- package/chunks/overlay-controller-DPt13i8p.mjs +314 -0
- package/chunks/roving-focus-CrL9982a.mjs +129 -0
- package/code-snippet/index.mjs +21 -13
- package/code-snippet/src/mp-code-snippet.element.d.ts +6 -0
- package/datatable/index.mjs +1 -1
- package/datatable/src/components/mp-datatable.d.ts +50 -0
- package/datatable/src/types/index.d.ts +2 -0
- package/datatable/src/types/labels.d.ts +30 -0
- package/datepicker/index.mjs +45 -22
- package/datepicker/src/mp-datepicker.element.d.ts +30 -0
- package/datetime-picker/index.mjs +15 -9
- package/dock/index.mjs +365 -209
- package/dock/src/components/mint-dock-manager.element.d.ts +63 -3
- package/dropdown-menu/index.mjs +135 -90
- package/dropdown-menu/src/components/mp-dropdown-menu.d.ts +12 -3
- package/file-manager/index.mjs +279 -214
- package/file-manager/src/components/mp-file-manager.d.ts +22 -0
- package/file-manager/src/types/messages.d.ts +9 -0
- package/multi-range/index.mjs +26 -10
- package/multi-range/src/mint-multi-range.element.d.ts +7 -0
- package/navbar/index.mjs +53 -39
- package/navbar/src/components/mp-navbar.d.ts +1 -0
- package/otp-input/index.mjs +82 -48
- package/otp-input/src/mint-otp-input.element.d.ts +31 -3
- package/overlay/index.mjs +2 -258
- package/overlay/src/overlay-controller.d.ts +64 -4
- package/package.json +9 -1
- package/pagination/index.mjs +1 -1
- package/query-builder/index.mjs +117 -87
- package/query-builder/src/model/messages.d.ts +9 -0
- package/radio/index.mjs +2 -160
- package/radio/src/components/mp-radio.d.ts +58 -3
- package/radio-group/index.d.ts +1 -0
- package/radio-group/index.mjs +145 -0
- package/radio-group/src/components/mp-radio-group.d.ts +52 -0
- package/radio-group/src/index.d.ts +1 -0
- package/radio-group/src/styles/radio-group.styles.d.ts +2 -0
- package/ribbon/index.mjs +316 -304
- package/ribbon/src/mp-ribbon.element.d.ts +16 -0
- package/scheduler/index.mjs +219 -132
- package/scheduler/src/components/mp-scheduler.d.ts +3 -0
- package/scheduler/src/views/base-view.d.ts +23 -0
- package/select/index.mjs +1 -1
- package/select/src/components/mp-select.d.ts +60 -3
- package/shell/index.mjs +142 -31
- package/shell/src/components/mp-shell.d.ts +1 -0
- package/signature-pad/index.d.ts +1 -0
- package/signature-pad/index.mjs +230 -0
- package/signature-pad/src/index.d.ts +2 -0
- package/signature-pad/src/mp-signature-pad.element.d.ts +143 -0
- package/signature-pad/src/mp-signature-pad.element.template.d.ts +2 -0
- package/signature-pad/src/types/signature.d.ts +12 -0
- package/splitter/index.mjs +1 -1
- package/splitter/src/components/mp-splitter.d.ts +7 -0
- package/tab-control/index.mjs +1 -1
- package/tile-manager/index.mjs +110 -93
- package/timeline/index.mjs +138 -54
- package/timeline/src/components/mp-timeline.d.ts +15 -0
- package/timepicker/index.mjs +1 -1
- package/timepicker/src/mp-time-list.element.d.ts +13 -4
- package/timepicker/src/mp-timepicker.element.d.ts +29 -0
- package/toggle-button/index.mjs +1 -1
- package/toggle-button/src/components/mp-toggle-button.d.ts +32 -1
- package/tree-select/index.mjs +233 -121
- package/tree-select/src/components/mp-tree-select.d.ts +37 -0
- package/treeview/index.mjs +1 -1
- package/treeview/src/components/mp-treeview.d.ts +10 -1
- package/chunks/mp-checkbox-BokLL7BS.mjs +0 -211
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { html as u, unsafeCSS as b, LitElement as
|
|
1
|
+
import { html as u, unsafeCSS as b, LitElement as p, nothing as c } from "lit";
|
|
2
2
|
u`<!-- The calendar is rendered dynamically by render(). This file exists only so
|
|
3
3
|
the codegen-wc target emits a \`styles\` export from the sibling .scss; the
|
|
4
4
|
\`template\` export is intentionally unused. -->`;
|
|
5
|
-
const
|
|
5
|
+
const D = b(`:host {
|
|
6
6
|
display: inline-block;
|
|
7
7
|
box-sizing: border-box;
|
|
8
8
|
color: var(--bs-body-color);
|
|
@@ -51,14 +51,26 @@ table th {
|
|
|
51
51
|
table tr {
|
|
52
52
|
border-top: none;
|
|
53
53
|
}
|
|
54
|
-
table tr:first-child >
|
|
54
|
+
table tr:first-child > th:not(:nth-of-type(1)) {
|
|
55
55
|
border-bottom: 1px solid var(--bs-border-color);
|
|
56
56
|
}
|
|
57
|
-
table tr:
|
|
57
|
+
table tr:not(:first-child) > th:nth-of-type(1) {
|
|
58
|
+
border-right: 1px solid var(--bs-border-color);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.calendar-nav {
|
|
62
|
+
display: flex;
|
|
63
|
+
align-items: center;
|
|
58
64
|
border-bottom: 1px solid var(--bs-border-color);
|
|
59
65
|
}
|
|
60
|
-
|
|
61
|
-
|
|
66
|
+
.calendar-nav .chevron-btn {
|
|
67
|
+
flex: 0 0 auto;
|
|
68
|
+
width: auto;
|
|
69
|
+
padding: 0.25rem 0.5rem;
|
|
70
|
+
}
|
|
71
|
+
.calendar-nav .month-label {
|
|
72
|
+
flex: 1 1 auto;
|
|
73
|
+
text-align: center;
|
|
62
74
|
}
|
|
63
75
|
|
|
64
76
|
.chevron-btn {
|
|
@@ -88,14 +100,26 @@ table tr:not(:nth-of-type(2)) > th:nth-of-type(1) {
|
|
|
88
100
|
|
|
89
101
|
.month-label {
|
|
90
102
|
font-weight: bolder;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.visually-hidden {
|
|
106
|
+
position: absolute;
|
|
107
|
+
width: 1px;
|
|
108
|
+
height: 1px;
|
|
109
|
+
padding: 0;
|
|
110
|
+
margin: -1px;
|
|
111
|
+
overflow: hidden;
|
|
112
|
+
clip: rect(0, 0, 0, 0);
|
|
113
|
+
white-space: nowrap;
|
|
114
|
+
border: 0;
|
|
115
|
+
}`), m = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor" aria-hidden="true"><path fill-rule="evenodd" d="M11.354 1.646a.5.5 0 0 1 0 .708L5.707 8l5.647 5.646a.5.5 0 0 1-.708.708l-6-6a.5.5 0 0 1 0-.708l6-6a.5.5 0 0 1 .708 0z"/></svg>', w = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor" aria-hidden="true"><path fill-rule="evenodd" d="M4.646 1.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1 0 .708l-6 6a.5.5 0 0 1-.708-.708L10.293 8 4.646 2.354a.5.5 0 0 1 0-.708z"/></svg>';
|
|
116
|
+
let M = 0;
|
|
117
|
+
class y extends p {
|
|
94
118
|
constructor() {
|
|
95
|
-
super(...arguments), this.selectedDate = null, this.currentMonth = null, this.disableDateFn = null, this.min = null, this.max = null, this.firstDayOfWeek = 1, this.locale = void 0, this._focusedDate = null, this.pendingFocusMove = !1, this.instanceId = `mp-cal-${++
|
|
119
|
+
super(...arguments), this.selectedDate = null, this.currentMonth = null, this.disableDateFn = null, this.min = null, this.max = null, this.firstDayOfWeek = 1, this.locale = void 0, this._focusedDate = null, this.pendingFocusMove = !1, this.instanceId = `mp-cal-${++M}`, this.monthLabelId = `${this.instanceId}-month`;
|
|
96
120
|
}
|
|
97
121
|
static {
|
|
98
|
-
this.styles = [
|
|
122
|
+
this.styles = [D];
|
|
99
123
|
}
|
|
100
124
|
static {
|
|
101
125
|
this.properties = {
|
|
@@ -112,40 +136,40 @@ class y extends D {
|
|
|
112
136
|
connectedCallback() {
|
|
113
137
|
super.connectedCallback(), this.currentMonth === null && (this.currentMonth = /* @__PURE__ */ new Date());
|
|
114
138
|
}
|
|
115
|
-
updated(
|
|
139
|
+
updated(e) {
|
|
116
140
|
if (this.pendingFocusMove) {
|
|
117
141
|
this.pendingFocusMove = !1;
|
|
118
|
-
const
|
|
119
|
-
|
|
120
|
-
`[id="${this.cellId(
|
|
142
|
+
const t = this._focusedDate;
|
|
143
|
+
t && this.renderRoot.querySelector(
|
|
144
|
+
`[id="${this.cellId(t)}"]`
|
|
121
145
|
)?.focus();
|
|
122
146
|
}
|
|
123
147
|
}
|
|
124
|
-
cellId(
|
|
125
|
-
return `${this.instanceId}-cell-${
|
|
148
|
+
cellId(e) {
|
|
149
|
+
return `${this.instanceId}-cell-${e.getFullYear()}-${e.getMonth()}-${e.getDate()}`;
|
|
126
150
|
}
|
|
127
|
-
isSameDate(
|
|
128
|
-
return
|
|
151
|
+
isSameDate(e, t) {
|
|
152
|
+
return e === null && t === null ? !0 : e === null || t === null ? !1 : e.getFullYear() === t.getFullYear() && e.getMonth() === t.getMonth() && e.getDate() === t.getDate();
|
|
129
153
|
}
|
|
130
|
-
isToday(
|
|
131
|
-
return this.isSameDate(
|
|
154
|
+
isToday(e) {
|
|
155
|
+
return this.isSameDate(e, /* @__PURE__ */ new Date());
|
|
132
156
|
}
|
|
133
157
|
/** Disabled if out of [min, max] (date-only) or rejected by disableDateFn. */
|
|
134
|
-
isDisabled(
|
|
135
|
-
return this.min && this.dateOnly(
|
|
158
|
+
isDisabled(e) {
|
|
159
|
+
return this.min && this.dateOnly(e) < this.dateOnly(this.min) || this.max && this.dateOnly(e) > this.dateOnly(this.max) ? !0 : !!this.disableDateFn && this.disableDateFn(e);
|
|
136
160
|
}
|
|
137
|
-
dateOnly(
|
|
138
|
-
return new Date(
|
|
161
|
+
dateOnly(e) {
|
|
162
|
+
return new Date(e.getFullYear(), e.getMonth(), e.getDate()).getTime();
|
|
139
163
|
}
|
|
140
164
|
/** Compute the weeks rendered for the current month, honoring firstDayOfWeek. */
|
|
141
|
-
getWeeks(
|
|
142
|
-
const
|
|
165
|
+
getWeeks(e) {
|
|
166
|
+
const t = new Date(e.getFullYear(), e.getMonth(), 1), n = new Date(e.getFullYear(), e.getMonth() + 1, 0), r = this.startOfWeek(t), i = this.endOfWeek(n), s = this.daysBetween(r, i) + 1, l = [];
|
|
143
167
|
for (let a = 0; a < s; a++) {
|
|
144
168
|
const h = new Date(r.getFullYear(), r.getMonth(), r.getDate() + a);
|
|
145
169
|
l.push({
|
|
146
170
|
date: h,
|
|
147
171
|
dayOfMonth: h.getDate(),
|
|
148
|
-
isInMonth: h.getFullYear() ===
|
|
172
|
+
isInMonth: h.getFullYear() === e.getFullYear() && h.getMonth() === e.getMonth()
|
|
149
173
|
});
|
|
150
174
|
}
|
|
151
175
|
const o = [];
|
|
@@ -159,54 +183,59 @@ class y extends D {
|
|
|
159
183
|
return o;
|
|
160
184
|
}
|
|
161
185
|
/** First day of the visible grid — Monday-on-top by default. */
|
|
162
|
-
startOfWeek(
|
|
163
|
-
const n = (
|
|
164
|
-
return new Date(
|
|
186
|
+
startOfWeek(e) {
|
|
187
|
+
const n = (e.getDay() - this.firstDayOfWeek + 7) % 7;
|
|
188
|
+
return new Date(e.getFullYear(), e.getMonth(), e.getDate() - n);
|
|
165
189
|
}
|
|
166
|
-
endOfWeek(
|
|
167
|
-
const
|
|
168
|
-
return new Date(
|
|
190
|
+
endOfWeek(e) {
|
|
191
|
+
const t = e.getDay(), n = (this.firstDayOfWeek + 6 - t + 7) % 7;
|
|
192
|
+
return new Date(e.getFullYear(), e.getMonth(), e.getDate() + n);
|
|
169
193
|
}
|
|
170
|
-
daysBetween(
|
|
171
|
-
return Math.floor((this.dateOnly(
|
|
194
|
+
daysBetween(e, t) {
|
|
195
|
+
return Math.floor((this.dateOnly(t) - this.dateOnly(e)) / 864e5);
|
|
172
196
|
}
|
|
173
197
|
/** ISO-8601 week-of-year. */
|
|
174
|
-
weekOfYear(
|
|
175
|
-
const
|
|
176
|
-
|
|
177
|
-
const n = new Date(Date.UTC(
|
|
178
|
-
return Math.ceil(((
|
|
198
|
+
weekOfYear(e) {
|
|
199
|
+
const t = new Date(Date.UTC(e.getFullYear(), e.getMonth(), e.getDate()));
|
|
200
|
+
t.setUTCDate(t.getUTCDate() + 4 - (t.getUTCDay() || 7));
|
|
201
|
+
const n = new Date(Date.UTC(t.getUTCFullYear(), 0, 1));
|
|
202
|
+
return Math.ceil(((t.getTime() - n.getTime()) / 864e5 + 1) / 7);
|
|
179
203
|
}
|
|
180
204
|
/** Localized weekday short + long names, in the order driven by firstDayOfWeek. */
|
|
181
205
|
weekdayNames() {
|
|
182
|
-
const
|
|
206
|
+
const e = new Date(2024, 0, 7), t = [];
|
|
183
207
|
for (let n = 0; n < 7; n++) {
|
|
184
|
-
const r = new Date(
|
|
185
|
-
r.setDate(
|
|
208
|
+
const r = new Date(e);
|
|
209
|
+
r.setDate(e.getDate() + (this.firstDayOfWeek + n) % 7), t.push({
|
|
186
210
|
short: r.toLocaleString(this.locale ?? "default", { weekday: "short" }),
|
|
187
211
|
long: r.toLocaleString(this.locale ?? "default", { weekday: "long" })
|
|
188
212
|
});
|
|
189
213
|
}
|
|
190
|
-
return
|
|
214
|
+
return t;
|
|
191
215
|
}
|
|
192
|
-
monthLabel(
|
|
193
|
-
const
|
|
194
|
-
return `${
|
|
216
|
+
monthLabel(e) {
|
|
217
|
+
const t = e.toLocaleString(this.locale ?? "default", { month: "long" });
|
|
218
|
+
return `${t.charAt(0).toUpperCase()}${t.slice(1)} ${e.getFullYear()}`;
|
|
219
|
+
}
|
|
220
|
+
/** Focus the grid = focus its roving cell (dialog initial focus calls host.focus()). */
|
|
221
|
+
focus(e) {
|
|
222
|
+
const t = this.renderRoot.querySelector('[tabindex="0"]');
|
|
223
|
+
t ? t.focus(e) : super.focus(e);
|
|
195
224
|
}
|
|
196
225
|
/**
|
|
197
226
|
* The cell that should carry tabindex="0". One per month — focused, else
|
|
198
227
|
* selected, else today, else first enabled day. Mirrors APG convention.
|
|
199
228
|
*/
|
|
200
229
|
focusableDate() {
|
|
201
|
-
const
|
|
202
|
-
if (!
|
|
203
|
-
const
|
|
230
|
+
const e = this.currentMonth;
|
|
231
|
+
if (!e) return null;
|
|
232
|
+
const t = (o) => o.getFullYear() === e.getFullYear() && o.getMonth() === e.getMonth(), n = (o) => o && t(o) ? o : null, r = n(this._focusedDate);
|
|
204
233
|
if (r) return r;
|
|
205
234
|
const i = n(this.selectedDate);
|
|
206
235
|
if (i) return i;
|
|
207
236
|
const l = n(/* @__PURE__ */ new Date());
|
|
208
237
|
if (l) return l;
|
|
209
|
-
for (const o of this.getWeeks(
|
|
238
|
+
for (const o of this.getWeeks(e))
|
|
210
239
|
for (const a of o.days)
|
|
211
240
|
if (a && a.isInMonth && !this.isDisabled(a.date)) return a.date;
|
|
212
241
|
return null;
|
|
@@ -222,42 +251,42 @@ class y extends D {
|
|
|
222
251
|
new Date(this.currentMonth.getFullYear(), this.currentMonth.getMonth() + 1, 1)
|
|
223
252
|
);
|
|
224
253
|
}
|
|
225
|
-
goto(
|
|
226
|
-
!
|
|
254
|
+
goto(e) {
|
|
255
|
+
!e || !e.isInMonth || this.isDisabled(e.date) || (this.setSelectedDate(e.date), this._focusedDate = e.date, this.requestUpdate());
|
|
227
256
|
}
|
|
228
257
|
/* ---- Internal setters with event dispatch ---- */
|
|
229
|
-
setCurrentMonth(
|
|
230
|
-
const
|
|
231
|
-
|
|
258
|
+
setCurrentMonth(e) {
|
|
259
|
+
const t = this.currentMonth;
|
|
260
|
+
t && this.isSameYearMonth(t, e) || (this.currentMonth = e, this.requestUpdate(), this.dispatchEvent(
|
|
232
261
|
new CustomEvent("current-month-change", {
|
|
233
|
-
detail: new Date(
|
|
262
|
+
detail: new Date(e.getFullYear(), e.getMonth(), 1),
|
|
234
263
|
bubbles: !0,
|
|
235
264
|
composed: !0
|
|
236
265
|
})
|
|
237
266
|
));
|
|
238
267
|
}
|
|
239
|
-
setSelectedDate(
|
|
240
|
-
this.selectedDate =
|
|
268
|
+
setSelectedDate(e) {
|
|
269
|
+
this.selectedDate = e, this.requestUpdate(), this.dispatchEvent(
|
|
241
270
|
new CustomEvent("selected-date-change", {
|
|
242
|
-
detail: new Date(
|
|
271
|
+
detail: new Date(e.getFullYear(), e.getMonth(), e.getDate()),
|
|
243
272
|
bubbles: !0,
|
|
244
273
|
composed: !0
|
|
245
274
|
})
|
|
246
275
|
);
|
|
247
276
|
}
|
|
248
|
-
isSameYearMonth(
|
|
249
|
-
return
|
|
277
|
+
isSameYearMonth(e, t) {
|
|
278
|
+
return e.getFullYear() === t.getFullYear() && e.getMonth() === t.getMonth();
|
|
250
279
|
}
|
|
251
280
|
/* ---- Keyboard ---- */
|
|
252
|
-
onCellKeyDown(
|
|
253
|
-
if (!
|
|
254
|
-
const n =
|
|
281
|
+
onCellKeyDown(e, t) {
|
|
282
|
+
if (!t || !t.isInMonth) return;
|
|
283
|
+
const n = e.key, r = n === "ArrowLeft" || n === "ArrowRight" || n === "ArrowUp" || n === "ArrowDown" || n === "Home" || n === "End" || n === "PageUp" || n === "PageDown", i = n === "Enter" || n === " ";
|
|
255
284
|
if (!r && !i) return;
|
|
256
|
-
if (
|
|
257
|
-
this.goto(
|
|
285
|
+
if (e.preventDefault(), i) {
|
|
286
|
+
this.goto(t);
|
|
258
287
|
return;
|
|
259
288
|
}
|
|
260
|
-
const s =
|
|
289
|
+
const s = t.date;
|
|
261
290
|
let l = new Date(s);
|
|
262
291
|
const o = getComputedStyle(this).direction === "rtl";
|
|
263
292
|
switch (n) {
|
|
@@ -284,52 +313,54 @@ class y extends D {
|
|
|
284
313
|
break;
|
|
285
314
|
}
|
|
286
315
|
case "PageUp":
|
|
287
|
-
l =
|
|
316
|
+
l = e.ctrlKey ? new Date(s.getFullYear() - 1, s.getMonth(), s.getDate()) : new Date(s.getFullYear(), s.getMonth() - 1, s.getDate());
|
|
288
317
|
break;
|
|
289
318
|
case "PageDown":
|
|
290
|
-
l =
|
|
319
|
+
l = e.ctrlKey ? new Date(s.getFullYear() + 1, s.getMonth(), s.getDate()) : new Date(s.getFullYear(), s.getMonth() + 1, s.getDate());
|
|
291
320
|
break;
|
|
292
321
|
}
|
|
293
322
|
this.moveFocusTo(l);
|
|
294
323
|
}
|
|
295
|
-
moveFocusTo(
|
|
296
|
-
this.currentMonth && (this.isSameYearMonth(this.currentMonth,
|
|
324
|
+
moveFocusTo(e) {
|
|
325
|
+
this.currentMonth && (this.isSameYearMonth(this.currentMonth, e) || this.setCurrentMonth(new Date(e.getFullYear(), e.getMonth(), 1)), this._focusedDate = e, this.pendingFocusMove = !0, this.requestUpdate());
|
|
297
326
|
}
|
|
298
327
|
/* ---- Render ---- */
|
|
299
328
|
render() {
|
|
300
|
-
const
|
|
329
|
+
const e = this.currentMonth ?? /* @__PURE__ */ new Date(), t = this.getWeeks(e), n = this.weekdayNames(), r = this.focusableDate();
|
|
301
330
|
return u`
|
|
331
|
+
<!-- The month-nav toolbar lives OUTSIDE the table: a presentational
|
|
332
|
+
row does not remove its BUTTONS from the grid's owned children,
|
|
333
|
+
so the grid still owned two role=button nodes — invalid
|
|
334
|
+
(axe aria-required-children, critical). -->
|
|
335
|
+
<div class="calendar-nav">
|
|
336
|
+
<button
|
|
337
|
+
type="button"
|
|
338
|
+
class="chevron-btn"
|
|
339
|
+
aria-label="Previous month"
|
|
340
|
+
@click="${() => this.previousMonth()}"
|
|
341
|
+
.innerHTML="${m}"
|
|
342
|
+
></button>
|
|
343
|
+
<span id="${this.monthLabelId}" class="month-label" aria-live="polite">
|
|
344
|
+
${this.monthLabel(e)}
|
|
345
|
+
</span>
|
|
346
|
+
<button
|
|
347
|
+
type="button"
|
|
348
|
+
class="chevron-btn"
|
|
349
|
+
aria-label="Next month"
|
|
350
|
+
@click="${() => this.nextMonth()}"
|
|
351
|
+
.innerHTML="${w}"
|
|
352
|
+
></button>
|
|
353
|
+
</div>
|
|
302
354
|
<table role="grid" aria-labelledby="${this.monthLabelId}">
|
|
303
|
-
<tr>
|
|
304
|
-
<td>
|
|
305
|
-
<button
|
|
306
|
-
type="button"
|
|
307
|
-
class="chevron-btn"
|
|
308
|
-
aria-label="Previous month"
|
|
309
|
-
@click="${() => this.previousMonth()}"
|
|
310
|
-
.innerHTML="${m}"
|
|
311
|
-
></button>
|
|
312
|
-
</td>
|
|
313
|
-
<td colspan="6" id="${this.monthLabelId}" class="month-label" aria-live="polite">
|
|
314
|
-
${this.monthLabel(t)}
|
|
315
|
-
</td>
|
|
316
|
-
<td>
|
|
317
|
-
<button
|
|
318
|
-
type="button"
|
|
319
|
-
class="chevron-btn"
|
|
320
|
-
aria-label="Next month"
|
|
321
|
-
@click="${() => this.nextMonth()}"
|
|
322
|
-
.innerHTML="${M}"
|
|
323
|
-
></button>
|
|
324
|
-
</td>
|
|
325
|
-
</tr>
|
|
326
355
|
<tr role="row">
|
|
327
|
-
|
|
356
|
+
<!-- The week-number column's header: hidden it left every
|
|
357
|
+
rowheader in an unlabelled column. Visually empty, spoken. -->
|
|
358
|
+
<th scope="col" role="columnheader"><span class="visually-hidden">Week</span></th>
|
|
328
359
|
${n.map(
|
|
329
360
|
(i) => u`<th scope="col" role="columnheader" title="${i.long}">${i.short}</th>`
|
|
330
361
|
)}
|
|
331
362
|
</tr>
|
|
332
|
-
${
|
|
363
|
+
${t.map(
|
|
333
364
|
(i) => u`
|
|
334
365
|
<tr role="row">
|
|
335
366
|
<th scope="row" role="rowheader">${i.number}</th>
|
|
@@ -340,10 +371,10 @@ class y extends D {
|
|
|
340
371
|
</table>
|
|
341
372
|
`;
|
|
342
373
|
}
|
|
343
|
-
renderCell(
|
|
344
|
-
const n = !!
|
|
374
|
+
renderCell(e, t) {
|
|
375
|
+
const n = !!e && e.isInMonth, r = !!e && this.isDisabled(e.date), i = !!e && e.isInMonth && this.isSameDate(this.selectedDate, e.date), s = !!e && e.isInMonth && this.isToday(e.date), l = !!e && e.isInMonth && this.isSameDate(t, e.date), o = [];
|
|
345
376
|
i && o.push("selected"), n && !r && o.push("cursor-pointer");
|
|
346
|
-
const a = o.length ? o.join(" ") : void 0, h =
|
|
377
|
+
const a = o.length ? o.join(" ") : void 0, h = e && e.isInMonth ? this.cellId(e.date) : void 0;
|
|
347
378
|
return u`<td
|
|
348
379
|
role="gridcell"
|
|
349
380
|
id="${h ?? c}"
|
|
@@ -352,10 +383,10 @@ class y extends D {
|
|
|
352
383
|
aria-selected="${n ? i ? "true" : "false" : c}"
|
|
353
384
|
aria-current="${s ? "date" : c}"
|
|
354
385
|
aria-disabled="${r ? "true" : c}"
|
|
355
|
-
@click="${() => this.goto(
|
|
356
|
-
@keydown="${(d) => this.onCellKeyDown(d,
|
|
386
|
+
@click="${() => this.goto(e)}"
|
|
387
|
+
@keydown="${(d) => this.onCellKeyDown(d, e)}"
|
|
357
388
|
>
|
|
358
|
-
${n ? u`<span class="${r ? "text-muted" : ""}">${
|
|
389
|
+
${n ? u`<span class="${r ? "text-muted" : ""}">${e.dayOfMonth}</span>` : c}
|
|
359
390
|
</td>`;
|
|
360
391
|
}
|
|
361
392
|
}
|