@golemui/gui-lit 1.2.0 → 1.2.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 (91) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/{accordion.element-BIgxl5e9.js → accordion.element-C9GzfKrY.js} +29 -30
  3. package/alert.element-CHn49Yaf.js +55 -0
  4. package/button.element-C9fHivSw.js +59 -0
  5. package/{calendar.element-Cv3RBphf.js → calendar.element-XkojKTJk.js} +30 -31
  6. package/checkbox.element-DU_tVMXu.js +66 -0
  7. package/currency.element-BmAH5KS_.js +73 -0
  8. package/date-picker.element-Bg3rF95F.js +94 -0
  9. package/{date-time-calendar.element-DlbWZjoe.js → date-time-calendar.element-sywQCeQQ.js} +24 -24
  10. package/date-time-picker.element-HHpwjWTQ.js +107 -0
  11. package/{date-time.element-CLLxM2nV.js → date-time.element-ucETvSTC.js} +26 -26
  12. package/{date.element-B8ZHK9KJ.js → date.element-BEHGxRFF.js} +27 -27
  13. package/default-list-item-renderer-CuPJ9jUD.js +24 -0
  14. package/{dropdown.element-DMZ7oL5n.js → dropdown.element-DUqG_p1x.js} +85 -84
  15. package/{flex.element-DG4Uaj_X.js → flex.element-pwba7621.js} +27 -28
  16. package/{grid.element-DCZsh-3J.js → grid.element-C8K7_Qi3.js} +29 -30
  17. package/index.js +1316 -3883
  18. package/index.umd.cjs +117 -2132
  19. package/{list.element-ADtUK2na.js → list.element-ZtEMKE2x.js} +41 -40
  20. package/markdown-text.element-DDm36qD0.js +54 -0
  21. package/markdown.element-DWz3U9rG.js +84 -0
  22. package/number.element-VkG5wScD.js +71 -0
  23. package/package.json +6 -6
  24. package/password.element-C5vQHq5P.js +72 -0
  25. package/radiogroup.element-CKdO9HwO.js +69 -0
  26. package/{range-calendar.element-D5eb2f7p.js → range-calendar.element-BznGrej5.js} +23 -24
  27. package/{range-date-input.element-C35grlYo.js → range-date-input.element-BloTHRDl.js} +24 -24
  28. package/range-date-picker.element-DKhwFasW.js +98 -0
  29. package/{range-date-time-calendar.element-BV0J96Gu.js → range-date-time-calendar.element-CZCET-sb.js} +26 -26
  30. package/{range-date-time-input.element-CzgRbR9F.js → range-date-time-input.element-Dr2VrYhG.js} +24 -24
  31. package/range-date-time-picker.element-CYeIMWLp.js +109 -0
  32. package/{range-time-input.element-BOHLUO8z.js → range-time-input.element-7OZhPQqx.js} +23 -23
  33. package/range-time-picker.element-D0mRFZkK.js +96 -0
  34. package/renderer.element-DbsFoBba.js +48 -0
  35. package/{repeater.element-Da8YN1Vy.js → repeater.element-DGEbwvhY.js} +54 -65
  36. package/select.element-Bb_9jAVB.js +76 -0
  37. package/{tabs.element-CvcIA8P3.js → tabs.element-BYDNF_pm.js} +49 -50
  38. package/tags.element-BSN3i9Gx.js +73 -0
  39. package/textarea.element-Dl1ZEOqO.js +71 -0
  40. package/textinput.element-C5Vbbkxq.js +68 -0
  41. package/{time-picker.element-C3oR0EkQ.js → time-picker.element-Crmj9YDy.js} +26 -26
  42. package/{time.element-X286nthD.js → time.element-DfSeAZp4.js} +29 -29
  43. package/toggle.element-ORsprZ2M.js +66 -0
  44. package/alert.element-DPWq9-0F.js +0 -56
  45. package/button.element-CJay43iR.js +0 -132
  46. package/calendar-DleRbmvP.js +0 -267
  47. package/checkbox.element-CpmrzdH0.js +0 -200
  48. package/currency.element-Cezgzbbs.js +0 -276
  49. package/date-DBuYpvcO.js +0 -849
  50. package/date-input-B3yHsn-g.js +0 -204
  51. package/date-picker.element-ByZefznr.js +0 -357
  52. package/date-time-calendar-CB5cNoOX.js +0 -374
  53. package/date-time-input-DrY68YDX.js +0 -246
  54. package/date-time-picker.element-CYwmumfq.js +0 -440
  55. package/day-status-ljexnwEO.js +0 -554
  56. package/errors-Bs_vYN-_.js +0 -110
  57. package/focus-leave.controller-2gV0pQd5.js +0 -73
  58. package/list-D730tmGN.js +0 -297
  59. package/markdown-text-X-BRJT6K.js +0 -30
  60. package/markdown-text.element-B8TfVLIO.js +0 -55
  61. package/markdown.element-D5zcxAUS.js +0 -693
  62. package/number.element-DEY5tR_y.js +0 -291
  63. package/numeric-jmOOKz30.js +0 -12
  64. package/one-of-anKkm7mD.js +0 -50
  65. package/part-templates-VORbpgs2.js +0 -691
  66. package/password.element-C1aQh_iz.js +0 -240
  67. package/pill-ranges-DpvWwP-3.js +0 -48
  68. package/pills-BDMO2NiR.js +0 -348
  69. package/popup.controller-B33OvX_y.js +0 -86
  70. package/radiogroup.element-B2G-XyGx.js +0 -235
  71. package/range-calendar-D7sG24Kx.js +0 -466
  72. package/range-commit-8-MmYUyo.js +0 -14
  73. package/range-date-input-BChaoBC1.js +0 -311
  74. package/range-date-picker.element-Do5YsL5V.js +0 -434
  75. package/range-date-time-calendar-DulGK2EQ.js +0 -734
  76. package/range-date-time-input-8ggqckP7.js +0 -353
  77. package/range-date-time-picker.element-hi5KdopZ.js +0 -472
  78. package/range-selection-CU3hxLJE.js +0 -25
  79. package/range-time-input-D7GFdDeA.js +0 -348
  80. package/range-time-picker.element-DDNQMA_u.js +0 -470
  81. package/renderer.element-CNyMn2Lu.js +0 -49
  82. package/select.element-SDxBhGjz.js +0 -266
  83. package/tabs-DzSCq_98.js +0 -13
  84. package/tags.element-Bnhfevp3.js +0 -369
  85. package/templates-Df7abEkB.js +0 -92
  86. package/textarea.element-Dx7eYEnl.js +0 -239
  87. package/textinput.element-BnIoDRmY.js +0 -205
  88. package/time-input-Kk4EX6at.js +0 -201
  89. package/time-list-DLcq8BAp.js +0 -217
  90. package/time-picker-DLj1rhOf.js +0 -299
  91. package/toggle.element-Dokdat_o.js +0 -203
@@ -1,554 +0,0 @@
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-Df7abEkB.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
- };
@@ -1,110 +0,0 @@
1
- import { LitElement as h, html as y } from "lit";
2
- import { property as r, customElement as c } from "lit/decorators.js";
3
- import { G as m, b as f, c as g } from "./templates-Df7abEkB.js";
4
- var v = Object.defineProperty, b = Object.getOwnPropertyDescriptor, o = (u, s, n, i) => {
5
- for (var e = i > 1 ? void 0 : i ? b(s, n) : s, l = u.length - 1, a; l >= 0; l--)
6
- (a = u[l]) && (e = (i ? a(s, n, e) : a(e)) || e);
7
- return i && e && v(s, n, e), e;
8
- };
9
- let t = class extends h {
10
- constructor() {
11
- super(...arguments), this.targetElement = void 0, this.uid = void 0, this.label = void 0, this.hint = void 0, this.required = void 0, this.errors = [], this.disabled = !1, this.readOnly = !1, this.touched = !1, this.native = !0, this.ariaController = new m(this, {
12
- getTargets: () => Array.isArray(this.targetElement) ? [...this.targetElement] : [this.targetElement],
13
- getState: () => ({
14
- uid: this.uid,
15
- templateData: {
16
- hint: this.hint,
17
- errors: this.errors,
18
- readonly: this.readOnly,
19
- disabled: this.disabled,
20
- touched: this.touched,
21
- required: this.required
22
- }
23
- })
24
- });
25
- }
26
- createRenderRoot() {
27
- return this;
28
- }
29
- render() {
30
- return super.render(), y`${f(
31
- this.uid,
32
- {
33
- label: this.label,
34
- hint: this.hint,
35
- required: this.required,
36
- errors: this.errors,
37
- touched: this.touched
38
- },
39
- !1,
40
- void 0,
41
- this.native
42
- )}`;
43
- }
44
- };
45
- o([
46
- r({ type: Object })
47
- ], t.prototype, "targetElement", 2);
48
- o([
49
- r({ type: String })
50
- ], t.prototype, "uid", 2);
51
- o([
52
- r({ type: String })
53
- ], t.prototype, "label", 2);
54
- o([
55
- r({ type: String })
56
- ], t.prototype, "hint", 2);
57
- o([
58
- r({ type: Boolean })
59
- ], t.prototype, "required", 2);
60
- o([
61
- r({ type: Array })
62
- ], t.prototype, "errors", 2);
63
- o([
64
- r({ type: Boolean })
65
- ], t.prototype, "disabled", 2);
66
- o([
67
- r({ type: Boolean, attribute: "readonly" })
68
- ], t.prototype, "readOnly", 2);
69
- o([
70
- r({ type: Boolean })
71
- ], t.prototype, "touched", 2);
72
- o([
73
- r({ type: Boolean })
74
- ], t.prototype, "native", 2);
75
- t = o([
76
- c("gui-label")
77
- ], t);
78
- typeof customElements < "u" && !customElements.get("gui-label") && customElements.define("gui-label", t);
79
- var E = Object.defineProperty, O = Object.getOwnPropertyDescriptor, d = (u, s, n, i) => {
80
- for (var e = i > 1 ? void 0 : i ? O(s, n) : s, l = u.length - 1, a; l >= 0; l--)
81
- (a = u[l]) && (e = (i ? a(s, n, e) : a(e)) || e);
82
- return i && e && E(s, n, e), e;
83
- };
84
- let p = class extends h {
85
- constructor() {
86
- super(...arguments), this.uid = void 0, this.errors = [], this.touched = !1;
87
- }
88
- createRenderRoot() {
89
- return this;
90
- }
91
- render() {
92
- return super.render(), y`${g(this.uid, {
93
- touched: this.touched,
94
- errors: this.errors
95
- })}`;
96
- }
97
- };
98
- d([
99
- r({ type: String })
100
- ], p.prototype, "uid", 2);
101
- d([
102
- r({ type: Array })
103
- ], p.prototype, "errors", 2);
104
- d([
105
- r({ type: Boolean })
106
- ], p.prototype, "touched", 2);
107
- p = d([
108
- c("gui-errors")
109
- ], p);
110
- typeof customElements < "u" && !customElements.get("gui-errors") && customElements.define("gui-errors", p);