@golemui/gui-lit 1.0.3 → 1.1.1-rc.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.
Files changed (83) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/{button.element-3a7rRHbA.js → button.element-CJay43iR.js} +16 -13
  3. package/calendar-D31xNsxx.js +267 -0
  4. package/{range-calendar.element-_1bHW_c1.js → calendar.element-BhFrCsns.js} +16 -16
  5. package/{checkbox.element-CVskoXEc.js → checkbox.element-DAAVB651.js} +49 -49
  6. package/{currency.element-5GSakkxF.js → currency.element-D8A2ObpM.js} +15 -11
  7. package/{date-CDUlLuYy.js → date-DBuYpvcO.js} +88 -29
  8. package/date-input-DLiMreSS.js +204 -0
  9. package/date-picker.element-DeUQtbLg.js +357 -0
  10. package/date-time-calendar-DzU-FtVl.js +374 -0
  11. package/date-time-calendar.element-BLBcVsFu.js +95 -0
  12. package/date-time-input-DZaz2heD.js +246 -0
  13. package/date-time-picker.element-BUbLdV6i.js +440 -0
  14. package/date-time.element-B5onfSBG.js +93 -0
  15. package/{date.element-BZO0UQez.js → date.element-BsKhLrEc.js} +27 -19
  16. package/day-status-CsWStVQV.js +554 -0
  17. package/{dropdown.element-CyJbVAA5.js → dropdown.element-CXpMwJsU.js} +53 -37
  18. package/{errors-QjKhr6mA.js → errors-Byb2dIhK.js} +3 -2
  19. package/focus-leave.controller-2gV0pQd5.js +73 -0
  20. package/index.js +1635 -948
  21. package/index.umd.cjs +2046 -601
  22. package/lib/components/date-picker.element.d.ts +0 -11
  23. package/lib/components/date-time-calendar.element.d.ts +18 -0
  24. package/lib/components/date-time-picker.element.d.ts +18 -0
  25. package/lib/components/date-time.element.d.ts +18 -0
  26. package/lib/components/dropdown.element.d.ts +2 -0
  27. package/lib/components/range-calendar.element.d.ts +2 -1
  28. package/lib/components/range-date-picker.element.d.ts +0 -15
  29. package/lib/components/range-date-time-calendar.element.d.ts +18 -0
  30. package/lib/components/range-date-time-input.element.d.ts +18 -0
  31. package/lib/components/range-date-time-picker.element.d.ts +18 -0
  32. package/lib/components/range-time-input.element.d.ts +18 -0
  33. package/lib/components/range-time-picker.element.d.ts +18 -0
  34. package/lib/components/time-picker.element.d.ts +18 -0
  35. package/lib/components/time.element.d.ts +18 -0
  36. package/list-D730tmGN.js +297 -0
  37. package/{list.element-Co3V3Cn5.js → list.element-eo3DIOrp.js} +23 -23
  38. package/{markdown.element-p-kC47D7.js → markdown.element-FbtwdnAv.js} +310 -218
  39. package/{number.element-CBr47IiY.js → number.element-BEpOCzXy.js} +76 -61
  40. package/package.json +6 -6
  41. package/part-templates-VORbpgs2.js +691 -0
  42. package/{password.element-n-R9RbkB.js → password.element-CBaB8h5b.js} +19 -17
  43. package/pill-ranges-DpvWwP-3.js +48 -0
  44. package/{pills-B66qz_KX.js → pills-BDMO2NiR.js} +84 -59
  45. package/popup.controller-B33OvX_y.js +86 -0
  46. package/{radiogroup.element-CeQn623u.js → radiogroup.element-KWzBx8mx.js} +55 -51
  47. package/range-calendar-DO_woqcF.js +466 -0
  48. package/{calendar.element-DcnTyvfg.js → range-calendar.element-DHLZhpnj.js} +37 -29
  49. package/range-commit-8-MmYUyo.js +14 -0
  50. package/range-date-input-Br7XqQPK.js +311 -0
  51. package/{range-date-input.element-BqzAF0O3.js → range-date-input.element-BdD4SlB4.js} +12 -8
  52. package/range-date-picker.element-DWRHiAoC.js +434 -0
  53. package/range-date-time-calendar-B3EMgN1E.js +734 -0
  54. package/range-date-time-calendar.element-Coea6RF4.js +97 -0
  55. package/range-date-time-input-Cu-T_nuC.js +353 -0
  56. package/range-date-time-input.element-Cti44iuW.js +87 -0
  57. package/range-date-time-picker.element-CDN2RL1y.js +472 -0
  58. package/range-selection-CU3hxLJE.js +25 -0
  59. package/range-time-input-BP9ZL9O8.js +348 -0
  60. package/range-time-input.element-B7wtHJoQ.js +84 -0
  61. package/range-time-picker.element-CPIAiQPC.js +470 -0
  62. package/{repeater.element-CtNgB4F5.js → repeater.element-BM1Keckd.js} +1 -1
  63. package/{select.element-jcDF1h-g.js → select.element-eepcXTpL.js} +117 -107
  64. package/{tabs.element-BvAyI71N.js → tabs.element-CvcIA8P3.js} +1 -0
  65. package/{tags.element-CX3vQL8L.js → tags.element-CPHgotb0.js} +21 -14
  66. package/templates-Dmr34nwp.js +88 -0
  67. package/{textarea.element-HThYqdR_.js → textarea.element-CiNEy9uq.js} +8 -7
  68. package/{textinput.element-CkXNzMUg.js → textinput.element-AL2Nr768.js} +10 -9
  69. package/time-input-5dkSm8UW.js +201 -0
  70. package/time-list-DLcq8BAp.js +217 -0
  71. package/time-picker-g337F8d0.js +299 -0
  72. package/time-picker.element-DLihegjg.js +89 -0
  73. package/time.element-BneqgMlQ.js +85 -0
  74. package/{toggle.element-C1kCw5H8.js → toggle.element-Cz91CRdp.js} +44 -43
  75. package/abstract-calendar-D0-077XJ.js +0 -545
  76. package/calendar-BclCC9VJ.js +0 -96
  77. package/date-input-DCdGWRio.js +0 -268
  78. package/date-picker.element-k7AJFQ5W.js +0 -168
  79. package/list-D1oKnH89.js +0 -283
  80. package/range-calendar-CBINu84w.js +0 -255
  81. package/range-date-input-BYXzqnr1.js +0 -395
  82. package/range-date-picker.element-BCBefgvY.js +0 -182
  83. package/templates-Dk1jxLwS.js +0 -75
@@ -0,0 +1,554 @@
1
+ import { nothing as m, html as c } from "lit";
2
+ import { g as C, n as Y, c as k } from "./focus-leave.controller-2gV0pQd5.js";
3
+ import { t as v, p as M, k as A, i as R, l as x, n as I, o as L, w as N, h as P, j as q, q as y } from "./date-DBuYpvcO.js";
4
+ import { repeat as w } from "lit-html/directives/repeat.js";
5
+ import { b as F, c as G } from "./templates-Dmr34nwp.js";
6
+ const S = ".gui-calendar__day-button:not(.other-month)", U = ".gui-calendar__panel", K = "gui-calendar__year-button", H = ".gui-calendar__year-button", O = ".gui-calendar__year-button.current", j = ".gui-calendar__year-grid", B = ".gui-calendar__year-selector", V = '.gui-calendar__day-button[tabindex="0"]';
7
+ class re {
8
+ constructor(e, r) {
9
+ this.handleDayKeydown = async (n) => {
10
+ if (!["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"].includes(n.key) && n.key !== " " && n.key !== "Enter") return;
11
+ const o = n.target, u = Array.from(this.host.querySelectorAll(S)), p = u.indexOf(o), f = window.getComputedStyle(this.host).direction === "rtl";
12
+ if (n.key === " " || n.key === "Enter") {
13
+ n.preventDefault(), this.options.onActivateDay(o.dataset.date ?? "", n);
14
+ return;
15
+ }
16
+ const d = C(n.key, { columns: 7, isRTL: f });
17
+ if (d.kind !== "delta") return;
18
+ const h = d.delta;
19
+ n.preventDefault();
20
+ const i = Y(
21
+ p,
22
+ h,
23
+ u.length,
24
+ (a) => this.isButtonDisabled(u[a])
25
+ );
26
+ let l = !1;
27
+ if (i < 0)
28
+ if (this.options.canGoPrev())
29
+ this.options.goPrev(), l = !0;
30
+ else {
31
+ u.find((g) => !this.isButtonDisabled(g))?.focus();
32
+ return;
33
+ }
34
+ else if (i >= u.length)
35
+ if (this.options.canGoNext())
36
+ this.options.goNext(), l = !0;
37
+ else {
38
+ [...u].reverse().find((b) => !this.isButtonDisabled(b))?.focus();
39
+ return;
40
+ }
41
+ if (l) {
42
+ await this.host.updateComplete;
43
+ const a = Array.from(
44
+ this.host.querySelectorAll(S)
45
+ ), g = Array.from(this.host.querySelectorAll(U));
46
+ let b;
47
+ if (i < 0)
48
+ b = g[0].querySelectorAll(S).length + i;
49
+ else {
50
+ const _ = g[g.length - 1].querySelectorAll(S).length;
51
+ b = a.length - _ + (i - u.length);
52
+ }
53
+ if (this.isButtonDisabled(a[b])) {
54
+ const D = Y(
55
+ b,
56
+ h,
57
+ a.length,
58
+ (_) => this.isButtonDisabled(a[_])
59
+ );
60
+ if (D < 0 || D >= a.length) {
61
+ const _ = a.findIndex((E) => !this.isButtonDisabled(E));
62
+ _ > -1 && a[_].focus();
63
+ } else
64
+ a[D]?.focus();
65
+ } else {
66
+ const D = Math.max(0, Math.min(b, a.length - 1));
67
+ a[D]?.focus();
68
+ }
69
+ } else
70
+ u[i]?.focus();
71
+ }, this.handleYearKeydown = (n) => {
72
+ const s = n.target;
73
+ if (!s.classList.contains(K)) return;
74
+ const o = Array.from(this.host.querySelectorAll(H)), u = o.indexOf(s), p = window.getComputedStyle(this.host).direction === "rtl";
75
+ if (n.key === "Enter" || n.key === " ") {
76
+ n.preventDefault();
77
+ const h = parseInt(s.dataset.year ?? "", 10);
78
+ isNaN(h) || this.selectYear(h);
79
+ return;
80
+ }
81
+ if (n.key === "Escape") {
82
+ n.preventDefault(), n.stopPropagation(), this.host.querySelector(B)?.focus(), this.options.onCloseYearGrid();
83
+ return;
84
+ }
85
+ const f = C(n.key, { columns: 4, isRTL: p });
86
+ if (f.kind !== "delta") return;
87
+ n.preventDefault();
88
+ const d = u + f.delta;
89
+ d >= 0 && d < o.length && o[d].focus();
90
+ }, this.onPrevMonthClick = () => {
91
+ this.options.goPrev(), this.keepNavFocusInside("prev", "next");
92
+ }, this.onNextMonthClick = () => {
93
+ this.options.goNext(), this.keepNavFocusInside("next", "prev");
94
+ }, this.host = e, this.options = r, e.addController(this);
95
+ }
96
+ hostConnected() {
97
+ }
98
+ selectYear(e) {
99
+ this.host.querySelector(
100
+ B
101
+ )?.focus(), this.options.onSelectYear(e), this.host.updateComplete.then(() => {
102
+ this.host.querySelector(V)?.focus();
103
+ });
104
+ }
105
+ /**
106
+ * When the grid just opened, waits for the update, then scrolls the current year
107
+ * button into the middle of the grid viewport and focuses it. A close is a no-op.
108
+ */
109
+ onYearGridToggled() {
110
+ this.options.isYearGridOpen() && this.host.updateComplete.then(() => {
111
+ this.scrollToCurrentYear(), this.focusCurrentYearButton();
112
+ });
113
+ }
114
+ scrollToCurrentYear() {
115
+ const e = this.host.querySelector(j), r = this.host.querySelector(O);
116
+ if (e && r) {
117
+ const n = e.getBoundingClientRect(), s = r.getBoundingClientRect(), o = e.scrollTop + (s.top - n.top) - n.height / 2 + s.height / 2;
118
+ e.scrollTop = Math.max(0, o);
119
+ }
120
+ }
121
+ focusCurrentYearButton() {
122
+ this.host.querySelector(O)?.focus();
123
+ }
124
+ /**
125
+ * After a nav click lands on a min/max boundary, the clicked button renders
126
+ * disabled and would drop focus to the body; refocus the opposite nav
127
+ * button, falling back to any enabled day button.
128
+ */
129
+ async keepNavFocusInside(e, r) {
130
+ await this.host.updateComplete;
131
+ const n = this.host.querySelector(
132
+ `.gui-calendar__month-button--${e}`
133
+ );
134
+ if (!n || !n.disabled) return;
135
+ (this.host.querySelector(
136
+ `.gui-calendar__month-button--${r}:not([disabled])`
137
+ ) ?? this.host.querySelector(
138
+ '.gui-calendar__day-button:not([disabled]):not([aria-disabled="true"])'
139
+ ))?.focus();
140
+ }
141
+ /**
142
+ * Whether a queried button is disabled; a missing button counts as disabled.
143
+ * Blocked in-month days carry `aria-disabled` instead of the native
144
+ * attribute (they stay in the accessibility tree) — skip both alike.
145
+ */
146
+ isButtonDisabled(e) {
147
+ return e ? e.hasAttribute("disabled") || e.getAttribute("aria-disabled") === "true" : !0;
148
+ }
149
+ }
150
+ class se {
151
+ constructor(e, r) {
152
+ this._currentDate = /* @__PURE__ */ new Date(), this._yearSelectorOpen = !1, this.host = e, this.options = r, e.addController(this);
153
+ }
154
+ hostConnected() {
155
+ }
156
+ /** The first visible month. */
157
+ get currentDate() {
158
+ return this._currentDate;
159
+ }
160
+ set currentDate(e) {
161
+ Object.is(e, this._currentDate) || (this._currentDate = e, this.host.requestUpdate());
162
+ }
163
+ /** Whether the year grid is open. */
164
+ get yearSelectorOpen() {
165
+ return this._yearSelectorOpen;
166
+ }
167
+ set yearSelectorOpen(e) {
168
+ Object.is(e, this._yearSelectorOpen) || (this._yearSelectorOpen = e, this.host.requestUpdate());
169
+ }
170
+ prevMonth() {
171
+ const e = this._currentDate;
172
+ this.currentDate = new Date(e.getFullYear(), e.getMonth() - 1, 1);
173
+ }
174
+ nextMonth() {
175
+ const e = this._currentDate;
176
+ this.currentDate = new Date(e.getFullYear(), e.getMonth() + 1, 1);
177
+ }
178
+ /**
179
+ * Determines whether navigation to the previous month is allowed.
180
+ *
181
+ * This method checks if the last day of the previous month exceeds the allowed minimum date.
182
+ * If there is no minimum date defined, navigation is always allowed.
183
+ *
184
+ * @return {boolean} Returns true if navigation to the previous month is permitted; otherwise, returns false.
185
+ */
186
+ canGoPrev() {
187
+ const e = this.options.getMinDate();
188
+ if (!e) return !0;
189
+ const r = new Date(
190
+ this._currentDate.getFullYear(),
191
+ this._currentDate.getMonth(),
192
+ 0
193
+ );
194
+ return v(r) >= e;
195
+ }
196
+ /**
197
+ * Determines whether navigation to the next month is allowed.
198
+ *
199
+ * This method checks if the first day of the next month exceeds the allowed maximum date.
200
+ * If there is no maximum date defined, navigation is always allowed.
201
+ *
202
+ * @return {boolean} Returns true if navigation to the next month is permitted; otherwise, returns false.
203
+ */
204
+ canGoNext() {
205
+ const e = this.options.getMaxDate();
206
+ if (!e) return !0;
207
+ const r = (this.options.getNumberOfMonths() ?? 1) - 1, n = new Date(
208
+ this._currentDate.getFullYear(),
209
+ this._currentDate.getMonth() + r + 1,
210
+ 1
211
+ );
212
+ return v(n) <= e;
213
+ }
214
+ /** First selectable year: `minDate`'s year, or the 1900 floor. */
215
+ get effectiveMinYear() {
216
+ const e = this.options.getMinDate();
217
+ return e ? M(e).getFullYear() : 1900;
218
+ }
219
+ /** Last selectable year: `maxDate`'s year, or the 2099 ceiling. */
220
+ get effectiveMaxYear() {
221
+ const e = this.options.getMaxDate();
222
+ return e ? M(e).getFullYear() : 2099;
223
+ }
224
+ /** The year-grid entries, min..max inclusive. */
225
+ get yearList() {
226
+ const e = [];
227
+ for (let r = this.effectiveMinYear; r <= this.effectiveMaxYear; r++)
228
+ e.push(r);
229
+ return e;
230
+ }
231
+ /** Flips the year grid and fires `onYearSelectorToggled` */
232
+ toggleYearSelector() {
233
+ this.yearSelectorOpen = !this._yearSelectorOpen, this.options.onYearSelectorToggled?.();
234
+ }
235
+ /** Applies a picked year: jump to the same month of `year` and close the year grid. */
236
+ selectYear(e) {
237
+ this.currentDate = new Date(e, this._currentDate.getMonth(), 1), this.yearSelectorOpen = !1;
238
+ }
239
+ /** Closes the year grid. */
240
+ closeYearSelector() {
241
+ this.yearSelectorOpen = !1;
242
+ }
243
+ /**
244
+ * Navigates so `date` becomes visible — a no-op for invalid dates and for
245
+ * dates already inside the visible months.
246
+ */
247
+ navigateToDate(e) {
248
+ !isNaN(e.getTime()) && !A(e, this._currentDate, this.options.getNumberOfMonths() ?? 1) && (this.currentDate = e);
249
+ }
250
+ /** Whether a day is outside min/max or inside a disabled range. */
251
+ isDisabled(e) {
252
+ return R(
253
+ v(e),
254
+ this.options.getMinDate(),
255
+ this.options.getMaxDate(),
256
+ this.options.getDisabledRanges()
257
+ );
258
+ }
259
+ }
260
+ function $(t, e) {
261
+ const r = new Date(t);
262
+ return r.setDate(1), r.setMonth(r.getMonth() + e), r;
263
+ }
264
+ function oe(t) {
265
+ const e = {
266
+ uid: t.uid,
267
+ label: t.label,
268
+ hint: t.hint,
269
+ errors: t.errors,
270
+ touched: t.touched,
271
+ required: t.required
272
+ }, r = Array.from({ length: t.numberOfMonths ?? 1 }, (s, o) => o), n = r.map((s) => x(t.localeId, $(t.currentDate, s))).join(", ");
273
+ return c`
274
+ ${t.label ? F(t.uid, e, !1, "calendar") : m}
275
+
276
+ <div class="gui-widget" @focusout=${t.onFocusOut}>
277
+ <div
278
+ id=${`${t.uid}_calendar`}
279
+ class="gui-calendar-input"
280
+ role="group"
281
+ aria-labelledby=${t.label ? `${t.uid}_calendar_label` : m}
282
+ aria-disabled=${t.disabled ? "true" : m}
283
+ >
284
+ <div class="gui-visually-hidden" aria-live="polite">${n}</div>
285
+ ${t.renderAboveCalendar()}
286
+ <div class="gui-calendar__container">
287
+ ${T("prev", {
288
+ icon: t.prevMonthIcon,
289
+ ariaLabel: t.prevMonthAriaLabel,
290
+ disabled: !t.canGoPrev,
291
+ onClick: t.onPrevMonthClick
292
+ })}
293
+
294
+ <div class="gui-calendar__months-grid">
295
+ ${r.map((s) => t.renderMonthPanel(s))}
296
+ </div>
297
+
298
+ ${T("next", {
299
+ icon: t.nextMonthIcon,
300
+ ariaLabel: t.nextMonthAriaLabel,
301
+ disabled: !t.canGoNext,
302
+ onClick: t.onNextMonthClick
303
+ })}
304
+ </div>
305
+ </div>
306
+ </div>
307
+
308
+ ${t.errors?.length ? G(t.uid, e) : m}
309
+ `;
310
+ }
311
+ function T(t, e) {
312
+ return t === "prev" ? c`
313
+ <button
314
+ type="button"
315
+ class="gui-button gui-calendar__month-button gui-calendar__month-button--prev"
316
+ ?disabled=${e.disabled}
317
+ @click=${e.onClick}
318
+ aria-label=${e.ariaLabel ?? "Previous month"}
319
+ >
320
+ ${e.icon ? c`<span
321
+ class=${`gui-widget-icon ${e.icon}`}
322
+ data-icon=${e.icon}
323
+ aria-hidden="true"
324
+ ></span>` : c`<svg
325
+ xmlns="http://www.w3.org/2000/svg"
326
+ width="16"
327
+ height="16"
328
+ viewBox="0 0 256 256"
329
+ aria-hidden="true"
330
+ >
331
+ <path
332
+ d="M165.66,202.34a8,8,0,0,1-11.32,11.32l-80-80a8,8,0,0,1,0-11.32l80-80a8,8,0,0,1,11.32,11.32L91.31,128Z"
333
+ ></path>
334
+ </svg>`}
335
+ </button>
336
+ ` : c`
337
+ <button
338
+ type="button"
339
+ class="gui-button gui-calendar__month-button gui-calendar__month-button--next"
340
+ ?disabled=${e.disabled}
341
+ @click=${e.onClick}
342
+ aria-label=${e.ariaLabel ?? "Next month"}
343
+ >
344
+ ${e.icon ? c`<span
345
+ class=${`gui-widget-icon ${e.icon}`}
346
+ data-icon=${e.icon}
347
+ aria-hidden="true"
348
+ ></span>` : c`<svg
349
+ xmlns="http://www.w3.org/2000/svg"
350
+ width="16"
351
+ height="16"
352
+ viewBox="0 0 256 256"
353
+ aria-hidden="true"
354
+ >
355
+ <path
356
+ d="M181.66,133.66l-80,80a8,8,0,0,1-11.32-11.32L164.69,128,90.34,53.66a8,8,0,0,1,11.32-11.32l80,80A8,8,0,0,1,181.66,133.66Z"
357
+ ></path>
358
+ </svg>`}
359
+ </button>
360
+ `;
361
+ }
362
+ function W(t) {
363
+ const e = $(t.currentDate, t.offset);
364
+ return c`
365
+ <div class="gui-calendar__panel">
366
+ ${t.renderHeader(e)} ${t.renderBelowHeader(t.offset)}
367
+ ${t.renderPanelBody(t.offset)}
368
+ </div>
369
+ `;
370
+ }
371
+ function ie(t) {
372
+ return W({
373
+ currentDate: t.currentDate,
374
+ offset: t.offset,
375
+ renderHeader: (e) => Z(e, {
376
+ localeId: t.localeId,
377
+ monthFormat: t.monthFormat,
378
+ yearSelectorOpen: t.yearSelectorOpen,
379
+ selectYearAriaLabel: t.selectYearAriaLabel,
380
+ onToggleYearSelector: t.onToggleYearSelector
381
+ }),
382
+ renderBelowHeader: t.renderBelowHeader ?? (() => m),
383
+ renderPanelBody: t.renderPanelBody
384
+ });
385
+ }
386
+ function ae(t) {
387
+ return t.yearSelectorOpen && t.offset === 0 ? J({
388
+ years: t.years,
389
+ currentYear: t.currentYear,
390
+ onSelectYear: t.onSelectYear,
391
+ onKeydown: t.onYearKeydown,
392
+ ariaLabel: t.yearGridAriaLabel
393
+ }) : z(
394
+ k(t.getDays(t.offset), 7),
395
+ I(t.localeId),
396
+ (e) => t.renderDay(e),
397
+ x(t.localeId, $(t.currentDate, t.offset))
398
+ );
399
+ }
400
+ function Z(t, e) {
401
+ const r = L(e.localeId, t, e.monthFormat);
402
+ return c`
403
+ <header class="gui-calendar__header">
404
+ <h2>
405
+ ${r.map(
406
+ (n) => n.type === "year" ? c`<button
407
+ type="button"
408
+ class="gui-calendar__year-selector"
409
+ @click=${e.onToggleYearSelector}
410
+ aria-expanded=${e.yearSelectorOpen}
411
+ aria-label=${`${e.selectYearAriaLabel ?? "Select year"}, ${n.value}`}
412
+ >
413
+ <span class="gui-calendar__year-value">${n.value}</span>
414
+ <span class="gui-calendar__year-arrow" aria-hidden="true">
415
+ <svg
416
+ xmlns="http://www.w3.org/2000/svg"
417
+ width="16"
418
+ height="16"
419
+ viewBox="0 0 256 256"
420
+ >
421
+ <path
422
+ d="M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,53.66,90.34L128,164.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z"
423
+ ></path>
424
+ </svg>
425
+ </span>
426
+ </button>` : c`<span class="gui-calendar__month-name">${n.value}</span>`
427
+ )}
428
+ </h2>
429
+ </header>
430
+ `;
431
+ }
432
+ function z(t, e, r, n) {
433
+ return c`
434
+ <div class="gui-calendar__days-grid" role="grid" aria-label=${n ?? m}>
435
+ <div role="row" class="gui-calendar__rows">
436
+ ${w(
437
+ e,
438
+ (s, o) => o,
439
+ (s) => c`<span class="gui-calendar__weekday" role="columnheader">${s}</span>`
440
+ )}
441
+ </div>
442
+
443
+ ${w(
444
+ t,
445
+ (s) => c`
446
+ <div role="row" class="gui-calendar__rows">
447
+ ${w(
448
+ s,
449
+ (o) => o.date.toISOString(),
450
+ (o) => r(o)
451
+ )}
452
+ </div>
453
+ `
454
+ )}
455
+ </div>
456
+ `;
457
+ }
458
+ function J(t) {
459
+ const e = t.currentYear;
460
+ return c`
461
+ <div
462
+ class="gui-calendar__year-grid"
463
+ role="grid"
464
+ aria-label=${t.ariaLabel ?? "Year selection"}
465
+ @keydown=${t.onKeydown}
466
+ >
467
+ ${k(t.years, 4).map(
468
+ (r) => c`
469
+ <div role="row" class="gui-calendar__year-row">
470
+ ${r.map(
471
+ (n) => c`
472
+ <button
473
+ type="button"
474
+ role="gridcell"
475
+ class="gui-calendar__year-button ${n === e ? "current" : ""}"
476
+ tabindex=${n === e ? 0 : -1}
477
+ data-year=${n}
478
+ @click=${(s) => {
479
+ s.stopPropagation(), t.onSelectYear(n);
480
+ }}
481
+ aria-selected=${n === e}
482
+ >
483
+ ${n}
484
+ </button>
485
+ `
486
+ )}
487
+ </div>
488
+ `
489
+ )}
490
+ </div>
491
+ `;
492
+ }
493
+ function le(t, e) {
494
+ const r = t.getTime();
495
+ let n = !1, s = !1, o = !1, u = !1, p = !1, f = !1, d = !1, h = !1;
496
+ if (e.selectedISO && (n = y(t, M(e.selectedISO))), e.invalidRange) {
497
+ const i = e.invalidRange.start, l = e.invalidRange.end;
498
+ f = y(t, i), d = y(t, l), r > i.getTime() && r < l.getTime() && (h = !0);
499
+ }
500
+ if (e.selectingSpan && (p = r >= e.selectingSpan.start.getTime() && r <= e.selectingSpan.end.getTime()), e.ranges)
501
+ for (const i of e.ranges)
502
+ y(t, i.start) && (s = !0, o = !i.end), i.end && (y(t, i.end) && (o = !0), r > i.start.getTime() && r < i.end.getTime() && (u = !0));
503
+ if (e.workingRange) {
504
+ const { start: i, end: l } = e.workingRange;
505
+ y(t, i) && (s = !0), y(t, l) && (o = !0), r > i.getTime() && r < l.getTime() && (u = !0);
506
+ }
507
+ return {
508
+ isSelected: n,
509
+ isRangeStart: s,
510
+ isRangeEnd: o,
511
+ isInRange: u,
512
+ isOneDayRange: s && o,
513
+ isAnchor: e.anchor ? y(t, e.anchor) : !1,
514
+ isSelecting: p,
515
+ isInvalidStart: f,
516
+ isInvalidEnd: d,
517
+ isInvalidInRange: h
518
+ };
519
+ }
520
+ function ce(t) {
521
+ const { currentDate: e, offset: r = 0, localeId: n, numberOfMonths: s = 1 } = t, o = new Date(e.getFullYear(), e.getMonth() + r, 1), u = o.getMonth(), p = o.getDay(), f = N(n)[0], d = (p - f + 7) % 7, h = new Date(o);
522
+ h.setDate(o.getDate() - d);
523
+ let i = [];
524
+ for (let l = 0; l < 42; l++) {
525
+ const a = new Date(h);
526
+ a.setDate(h.getDate() + l), i.push(
527
+ t.toDay({
528
+ date: a,
529
+ dayLabel: q(n, a),
530
+ isCurrentMonth: a.getMonth() === u,
531
+ isToday: P(a),
532
+ isDisabled: t.isDisabled(a)
533
+ })
534
+ );
535
+ }
536
+ for (let l = 0; l < 2; l++)
537
+ i.slice(-7).every((g) => !g.isCurrentMonth) && (i = i.slice(0, -7));
538
+ if (r === 0 && !i.some((l) => l.isFocusable) && !(t.focusFallbackDates ?? []).some(
539
+ (a) => A(a, e, s)
540
+ )) {
541
+ const a = i.find((g) => g.isCurrentMonth && !g.isDisabled);
542
+ a && (a.isFocusable = !0);
543
+ }
544
+ return i;
545
+ }
546
+ export {
547
+ se as G,
548
+ re as a,
549
+ ie as b,
550
+ ae as c,
551
+ ce as d,
552
+ le as e,
553
+ oe as r
554
+ };