@golemui/gui-lit 1.1.0 → 1.1.1-rc.1
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/CHANGELOG.md +34 -0
- package/{button.element-3a7rRHbA.js → button.element-CJay43iR.js} +16 -13
- package/{calendar-BuJgwvZx.js → calendar-D31xNsxx.js} +72 -59
- package/{calendar.element-M5MPJmap.js → calendar.element-BhFrCsns.js} +22 -20
- package/{checkbox.element-CVskoXEc.js → checkbox.element-DAAVB651.js} +49 -49
- package/{currency.element-CfFrAtrr.js → currency.element-D8A2ObpM.js} +11 -10
- package/{date-Bj9mI3GU.js → date-DBuYpvcO.js} +35 -27
- package/{date-input-cJDkNnVw.js → date-input-DLiMreSS.js} +64 -44
- package/date-picker.element-DeUQtbLg.js +357 -0
- package/{date-time-calendar-BzRfkLKU.js → date-time-calendar-DzU-FtVl.js} +89 -76
- package/{date-time-calendar.element-DC4NK0y1.js → date-time-calendar.element-BLBcVsFu.js} +13 -11
- package/{date-time-input-BXxsfuyZ.js → date-time-input-DZaz2heD.js} +75 -43
- package/{date-time-picker.element-Dy-8cb-_.js → date-time-picker.element-BUbLdV6i.js} +125 -65
- package/{date-time.element-Bv4XdzMi.js → date-time.element-B5onfSBG.js} +31 -25
- package/{date.element-Consgsbb.js → date.element-BsKhLrEc.js} +22 -19
- package/{day-status-0-hJHrI7.js → day-status-CsWStVQV.js} +153 -129
- package/{dropdown.element-WsD61Qel.js → dropdown.element-CXpMwJsU.js} +19 -13
- package/{errors-QjKhr6mA.js → errors-Byb2dIhK.js} +3 -2
- package/index.js +2933 -2336
- package/index.umd.cjs +798 -405
- package/{list-CrLIL4by.js → list-D730tmGN.js} +115 -116
- package/{list.element-DV82YxnJ.js → list.element-eo3DIOrp.js} +2 -2
- package/{markdown.element-p-kC47D7.js → markdown.element-FbtwdnAv.js} +310 -218
- package/{number.element-CBr47IiY.js → number.element-BEpOCzXy.js} +76 -61
- package/package.json +9 -6
- package/{part-templates-Db871PS3.js → part-templates-VORbpgs2.js} +132 -118
- package/{password.element-n-R9RbkB.js → password.element-CBaB8h5b.js} +19 -17
- package/{pill-ranges-DCqDmpkk.js → pill-ranges-DpvWwP-3.js} +12 -12
- package/{pills-Be1UrLgq.js → pills-BDMO2NiR.js} +80 -58
- package/popup.controller-B33OvX_y.js +86 -0
- package/{radiogroup.element-CeQn623u.js → radiogroup.element-KWzBx8mx.js} +55 -51
- package/{range-calendar-CKPYeSGt.js → range-calendar-DO_woqcF.js} +101 -87
- package/{range-calendar.element-D6KYq18B.js → range-calendar.element-DHLZhpnj.js} +15 -13
- package/{range-date-input-D--AqBMv.js → range-date-input-Br7XqQPK.js} +90 -71
- package/{range-date-input.element-D4nIXJbw.js → range-date-input.element-BdD4SlB4.js} +15 -12
- package/{range-date-picker.element-dhxPAAE6.js → range-date-picker.element-DWRHiAoC.js} +97 -49
- package/{range-date-time-calendar-yksWrR7b.js → range-date-time-calendar-B3EMgN1E.js} +150 -136
- package/{range-date-time-calendar.element-C00aDefZ.js → range-date-time-calendar.element-Coea6RF4.js} +9 -7
- package/{range-date-time-input-B37TUoM3.js → range-date-time-input-Cu-T_nuC.js} +125 -94
- package/{range-date-time-input.element-DUnbv4ed.js → range-date-time-input.element-Cti44iuW.js} +31 -25
- package/{range-date-time-picker.element-Cbps6s_G.js → range-date-time-picker.element-CDN2RL1y.js} +107 -47
- package/{range-time-input-3lhqR1Ku.js → range-time-input-BP9ZL9O8.js} +85 -66
- package/{range-time-input.element-dU2iBdmJ.js → range-time-input.element-B7wtHJoQ.js} +14 -11
- package/{range-time-picker.element-v6nQsIPw.js → range-time-picker.element-CPIAiQPC.js} +92 -51
- package/{repeater.element-CtNgB4F5.js → repeater.element-BM1Keckd.js} +1 -1
- package/{select.element-C0V-Bv3L.js → select.element-eepcXTpL.js} +84 -78
- package/{tabs.element-BvAyI71N.js → tabs.element-CvcIA8P3.js} +1 -0
- package/{tags.element-DvwEpxpK.js → tags.element-CPHgotb0.js} +21 -14
- package/templates-Dmr34nwp.js +88 -0
- package/{textarea.element-HThYqdR_.js → textarea.element-CiNEy9uq.js} +8 -7
- package/{textinput.element-CkXNzMUg.js → textinput.element-AL2Nr768.js} +10 -9
- package/{time-input-BOhlBGJZ.js → time-input-5dkSm8UW.js} +67 -47
- package/{time-list-Czo48bZm.js → time-list-DLcq8BAp.js} +1 -1
- package/{time-picker-bFJ63ky8.js → time-picker-g337F8d0.js} +89 -51
- package/{time-picker.element-CYZVXgRS.js → time-picker.element-DLihegjg.js} +23 -19
- package/{time.element-fK3oLi49.js → time.element-BneqgMlQ.js} +22 -19
- package/{toggle.element-C1kCw5H8.js → toggle.element-Cz91CRdp.js} +44 -43
- package/date-picker.element-va_-LGZD.js +0 -312
- package/popup.controller-eUDxE6jD.js +0 -71
- package/templates-Dk1jxLwS.js +0 -75
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
import { nothing as
|
|
2
|
-
import { g as C, n as
|
|
3
|
-
import { t as v, p as M,
|
|
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
4
|
import { repeat as w } from "lit-html/directives/repeat.js";
|
|
5
|
-
import { b as
|
|
6
|
-
const
|
|
7
|
-
class
|
|
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
8
|
constructor(e, r) {
|
|
9
9
|
this.handleDayKeydown = async (n) => {
|
|
10
10
|
if (!["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"].includes(n.key) && n.key !== " " && n.key !== "Enter") return;
|
|
11
|
-
const
|
|
11
|
+
const o = n.target, u = Array.from(this.host.querySelectorAll(S)), p = u.indexOf(o), f = window.getComputedStyle(this.host).direction === "rtl";
|
|
12
12
|
if (n.key === " " || n.key === "Enter") {
|
|
13
|
-
n.preventDefault(), this.options.onActivateDay(
|
|
13
|
+
n.preventDefault(), this.options.onActivateDay(o.dataset.date ?? "", n);
|
|
14
14
|
return;
|
|
15
15
|
}
|
|
16
16
|
const d = C(n.key, { columns: 7, isRTL: f });
|
|
17
17
|
if (d.kind !== "delta") return;
|
|
18
18
|
const h = d.delta;
|
|
19
19
|
n.preventDefault();
|
|
20
|
-
const
|
|
20
|
+
const i = Y(
|
|
21
21
|
p,
|
|
22
22
|
h,
|
|
23
23
|
u.length,
|
|
24
|
-
(
|
|
24
|
+
(a) => this.isButtonDisabled(u[a])
|
|
25
25
|
);
|
|
26
26
|
let l = !1;
|
|
27
|
-
if (
|
|
27
|
+
if (i < 0)
|
|
28
28
|
if (this.options.canGoPrev())
|
|
29
29
|
this.options.goPrev(), l = !0;
|
|
30
30
|
else {
|
|
31
31
|
u.find((g) => !this.isButtonDisabled(g))?.focus();
|
|
32
32
|
return;
|
|
33
33
|
}
|
|
34
|
-
else if (
|
|
34
|
+
else if (i >= u.length)
|
|
35
35
|
if (this.options.canGoNext())
|
|
36
36
|
this.options.goNext(), l = !0;
|
|
37
37
|
else {
|
|
@@ -40,53 +40,53 @@ class te {
|
|
|
40
40
|
}
|
|
41
41
|
if (l) {
|
|
42
42
|
await this.host.updateComplete;
|
|
43
|
-
const
|
|
44
|
-
this.host.querySelectorAll(
|
|
45
|
-
), g = Array.from(this.host.querySelectorAll(
|
|
43
|
+
const a = Array.from(
|
|
44
|
+
this.host.querySelectorAll(S)
|
|
45
|
+
), g = Array.from(this.host.querySelectorAll(U));
|
|
46
46
|
let b;
|
|
47
|
-
if (
|
|
48
|
-
b = g[0].querySelectorAll(
|
|
47
|
+
if (i < 0)
|
|
48
|
+
b = g[0].querySelectorAll(S).length + i;
|
|
49
49
|
else {
|
|
50
|
-
const _ = g[g.length - 1].querySelectorAll(
|
|
51
|
-
b =
|
|
50
|
+
const _ = g[g.length - 1].querySelectorAll(S).length;
|
|
51
|
+
b = a.length - _ + (i - u.length);
|
|
52
52
|
}
|
|
53
|
-
if (this.isButtonDisabled(
|
|
54
|
-
const D =
|
|
53
|
+
if (this.isButtonDisabled(a[b])) {
|
|
54
|
+
const D = Y(
|
|
55
55
|
b,
|
|
56
56
|
h,
|
|
57
|
-
|
|
58
|
-
(_) => this.isButtonDisabled(
|
|
57
|
+
a.length,
|
|
58
|
+
(_) => this.isButtonDisabled(a[_])
|
|
59
59
|
);
|
|
60
|
-
if (D < 0 || D >=
|
|
61
|
-
const _ =
|
|
62
|
-
_ > -1 &&
|
|
60
|
+
if (D < 0 || D >= a.length) {
|
|
61
|
+
const _ = a.findIndex((E) => !this.isButtonDisabled(E));
|
|
62
|
+
_ > -1 && a[_].focus();
|
|
63
63
|
} else
|
|
64
|
-
|
|
64
|
+
a[D]?.focus();
|
|
65
65
|
} else {
|
|
66
|
-
const D = Math.max(0, Math.min(b,
|
|
67
|
-
|
|
66
|
+
const D = Math.max(0, Math.min(b, a.length - 1));
|
|
67
|
+
a[D]?.focus();
|
|
68
68
|
}
|
|
69
69
|
} else
|
|
70
|
-
u[
|
|
70
|
+
u[i]?.focus();
|
|
71
71
|
}, this.handleYearKeydown = (n) => {
|
|
72
|
-
const
|
|
73
|
-
if (!
|
|
74
|
-
const
|
|
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
75
|
if (n.key === "Enter" || n.key === " ") {
|
|
76
76
|
n.preventDefault();
|
|
77
|
-
const h = parseInt(
|
|
77
|
+
const h = parseInt(s.dataset.year ?? "", 10);
|
|
78
78
|
isNaN(h) || this.selectYear(h);
|
|
79
79
|
return;
|
|
80
80
|
}
|
|
81
81
|
if (n.key === "Escape") {
|
|
82
|
-
n.preventDefault(), n.stopPropagation(), this.host.querySelector(
|
|
82
|
+
n.preventDefault(), n.stopPropagation(), this.host.querySelector(B)?.focus(), this.options.onCloseYearGrid();
|
|
83
83
|
return;
|
|
84
84
|
}
|
|
85
85
|
const f = C(n.key, { columns: 4, isRTL: p });
|
|
86
86
|
if (f.kind !== "delta") return;
|
|
87
87
|
n.preventDefault();
|
|
88
88
|
const d = u + f.delta;
|
|
89
|
-
d >= 0 && d <
|
|
89
|
+
d >= 0 && d < o.length && o[d].focus();
|
|
90
90
|
}, this.onPrevMonthClick = () => {
|
|
91
91
|
this.options.goPrev(), this.keepNavFocusInside("prev", "next");
|
|
92
92
|
}, this.onNextMonthClick = () => {
|
|
@@ -97,9 +97,9 @@ class te {
|
|
|
97
97
|
}
|
|
98
98
|
selectYear(e) {
|
|
99
99
|
this.host.querySelector(
|
|
100
|
-
|
|
100
|
+
B
|
|
101
101
|
)?.focus(), this.options.onSelectYear(e), this.host.updateComplete.then(() => {
|
|
102
|
-
this.host.querySelector(
|
|
102
|
+
this.host.querySelector(V)?.focus();
|
|
103
103
|
});
|
|
104
104
|
}
|
|
105
105
|
/**
|
|
@@ -112,14 +112,14 @@ class te {
|
|
|
112
112
|
});
|
|
113
113
|
}
|
|
114
114
|
scrollToCurrentYear() {
|
|
115
|
-
const e = this.host.querySelector(
|
|
115
|
+
const e = this.host.querySelector(j), r = this.host.querySelector(O);
|
|
116
116
|
if (e && r) {
|
|
117
|
-
const n = e.getBoundingClientRect(),
|
|
118
|
-
e.scrollTop = Math.max(0,
|
|
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
119
|
}
|
|
120
120
|
}
|
|
121
121
|
focusCurrentYearButton() {
|
|
122
|
-
this.host.querySelector(
|
|
122
|
+
this.host.querySelector(O)?.focus();
|
|
123
123
|
}
|
|
124
124
|
/**
|
|
125
125
|
* After a nav click lands on a min/max boundary, the clicked button renders
|
|
@@ -134,16 +134,20 @@ class te {
|
|
|
134
134
|
if (!n || !n.disabled) return;
|
|
135
135
|
(this.host.querySelector(
|
|
136
136
|
`.gui-calendar__month-button--${r}:not([disabled])`
|
|
137
|
-
) ?? this.host.querySelector(
|
|
137
|
+
) ?? this.host.querySelector(
|
|
138
|
+
'.gui-calendar__day-button:not([disabled]):not([aria-disabled="true"])'
|
|
139
|
+
))?.focus();
|
|
138
140
|
}
|
|
139
141
|
/**
|
|
140
|
-
* Whether a queried button is disabled; a missing button counts as disabled
|
|
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.
|
|
141
145
|
*/
|
|
142
146
|
isButtonDisabled(e) {
|
|
143
|
-
return e ? e.hasAttribute("disabled") : !0;
|
|
147
|
+
return e ? e.hasAttribute("disabled") || e.getAttribute("aria-disabled") === "true" : !0;
|
|
144
148
|
}
|
|
145
149
|
}
|
|
146
|
-
class
|
|
150
|
+
class se {
|
|
147
151
|
constructor(e, r) {
|
|
148
152
|
this._currentDate = /* @__PURE__ */ new Date(), this._yearSelectorOpen = !1, this.host = e, this.options = r, e.addController(this);
|
|
149
153
|
}
|
|
@@ -241,11 +245,11 @@ class ne {
|
|
|
241
245
|
* dates already inside the visible months.
|
|
242
246
|
*/
|
|
243
247
|
navigateToDate(e) {
|
|
244
|
-
!isNaN(e.getTime()) && !
|
|
248
|
+
!isNaN(e.getTime()) && !A(e, this._currentDate, this.options.getNumberOfMonths() ?? 1) && (this.currentDate = e);
|
|
245
249
|
}
|
|
246
250
|
/** Whether a day is outside min/max or inside a disabled range. */
|
|
247
251
|
isDisabled(e) {
|
|
248
|
-
return
|
|
252
|
+
return R(
|
|
249
253
|
v(e),
|
|
250
254
|
this.options.getMinDate(),
|
|
251
255
|
this.options.getMaxDate(),
|
|
@@ -253,7 +257,11 @@ class ne {
|
|
|
253
257
|
);
|
|
254
258
|
}
|
|
255
259
|
}
|
|
256
|
-
function
|
|
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) {
|
|
257
265
|
const e = {
|
|
258
266
|
uid: t.uid,
|
|
259
267
|
label: t.label,
|
|
@@ -261,21 +269,22 @@ function re(t) {
|
|
|
261
269
|
errors: t.errors,
|
|
262
270
|
touched: t.touched,
|
|
263
271
|
required: t.required
|
|
264
|
-
}, r = Array.from({ length: t.numberOfMonths ?? 1 }, (
|
|
272
|
+
}, r = Array.from({ length: t.numberOfMonths ?? 1 }, (s, o) => o), n = r.map((s) => x(t.localeId, $(t.currentDate, s))).join(", ");
|
|
265
273
|
return c`
|
|
266
|
-
${t.label ?
|
|
274
|
+
${t.label ? F(t.uid, e, !1, "calendar") : m}
|
|
267
275
|
|
|
268
276
|
<div class="gui-widget" @focusout=${t.onFocusOut}>
|
|
269
277
|
<div
|
|
270
|
-
id=${t.uid}
|
|
278
|
+
id=${`${t.uid}_calendar`}
|
|
271
279
|
class="gui-calendar-input"
|
|
272
280
|
role="group"
|
|
273
|
-
aria-labelledby=${t.label ? `${t.uid}_calendar_label` :
|
|
274
|
-
|
|
281
|
+
aria-labelledby=${t.label ? `${t.uid}_calendar_label` : m}
|
|
282
|
+
aria-disabled=${t.disabled ? "true" : m}
|
|
275
283
|
>
|
|
284
|
+
<div class="gui-visually-hidden" aria-live="polite">${n}</div>
|
|
276
285
|
${t.renderAboveCalendar()}
|
|
277
286
|
<div class="gui-calendar__container">
|
|
278
|
-
${
|
|
287
|
+
${T("prev", {
|
|
279
288
|
icon: t.prevMonthIcon,
|
|
280
289
|
ariaLabel: t.prevMonthAriaLabel,
|
|
281
290
|
disabled: !t.canGoPrev,
|
|
@@ -283,10 +292,10 @@ function re(t) {
|
|
|
283
292
|
})}
|
|
284
293
|
|
|
285
294
|
<div class="gui-calendar__months-grid">
|
|
286
|
-
${r.map((
|
|
295
|
+
${r.map((s) => t.renderMonthPanel(s))}
|
|
287
296
|
</div>
|
|
288
297
|
|
|
289
|
-
${
|
|
298
|
+
${T("next", {
|
|
290
299
|
icon: t.nextMonthIcon,
|
|
291
300
|
ariaLabel: t.nextMonthAriaLabel,
|
|
292
301
|
disabled: !t.canGoNext,
|
|
@@ -296,24 +305,28 @@ function re(t) {
|
|
|
296
305
|
</div>
|
|
297
306
|
</div>
|
|
298
307
|
|
|
299
|
-
${t.errors?.length ?
|
|
308
|
+
${t.errors?.length ? G(t.uid, e) : m}
|
|
300
309
|
`;
|
|
301
310
|
}
|
|
302
|
-
function
|
|
311
|
+
function T(t, e) {
|
|
303
312
|
return t === "prev" ? c`
|
|
304
313
|
<button
|
|
305
314
|
type="button"
|
|
306
|
-
tabindex="0"
|
|
307
315
|
class="gui-button gui-calendar__month-button gui-calendar__month-button--prev"
|
|
308
316
|
?disabled=${e.disabled}
|
|
309
317
|
@click=${e.onClick}
|
|
310
318
|
aria-label=${e.ariaLabel ?? "Previous month"}
|
|
311
319
|
>
|
|
312
|
-
${e.icon ? c`<span
|
|
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
|
|
313
325
|
xmlns="http://www.w3.org/2000/svg"
|
|
314
326
|
width="16"
|
|
315
327
|
height="16"
|
|
316
328
|
viewBox="0 0 256 256"
|
|
329
|
+
aria-hidden="true"
|
|
317
330
|
>
|
|
318
331
|
<path
|
|
319
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"
|
|
@@ -323,13 +336,22 @@ function B(t, e) {
|
|
|
323
336
|
` : c`
|
|
324
337
|
<button
|
|
325
338
|
type="button"
|
|
326
|
-
tabindex="0"
|
|
327
339
|
class="gui-button gui-calendar__month-button gui-calendar__month-button--next"
|
|
328
340
|
?disabled=${e.disabled}
|
|
329
341
|
@click=${e.onClick}
|
|
330
342
|
aria-label=${e.ariaLabel ?? "Next month"}
|
|
331
343
|
>
|
|
332
|
-
${e.icon ? c`<span
|
|
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
|
+
>
|
|
333
355
|
<path
|
|
334
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"
|
|
335
357
|
></path>
|
|
@@ -337,54 +359,56 @@ function B(t, e) {
|
|
|
337
359
|
</button>
|
|
338
360
|
`;
|
|
339
361
|
}
|
|
340
|
-
function
|
|
341
|
-
const e =
|
|
342
|
-
return
|
|
362
|
+
function W(t) {
|
|
363
|
+
const e = $(t.currentDate, t.offset);
|
|
364
|
+
return c`
|
|
343
365
|
<div class="gui-calendar__panel">
|
|
344
366
|
${t.renderHeader(e)} ${t.renderBelowHeader(t.offset)}
|
|
345
367
|
${t.renderPanelBody(t.offset)}
|
|
346
368
|
</div>
|
|
347
369
|
`;
|
|
348
370
|
}
|
|
349
|
-
function
|
|
350
|
-
return
|
|
371
|
+
function ie(t) {
|
|
372
|
+
return W({
|
|
351
373
|
currentDate: t.currentDate,
|
|
352
374
|
offset: t.offset,
|
|
353
|
-
renderHeader: (e) =>
|
|
375
|
+
renderHeader: (e) => Z(e, {
|
|
354
376
|
localeId: t.localeId,
|
|
355
377
|
monthFormat: t.monthFormat,
|
|
356
378
|
yearSelectorOpen: t.yearSelectorOpen,
|
|
379
|
+
selectYearAriaLabel: t.selectYearAriaLabel,
|
|
357
380
|
onToggleYearSelector: t.onToggleYearSelector
|
|
358
381
|
}),
|
|
359
|
-
renderBelowHeader: t.renderBelowHeader ?? (() =>
|
|
382
|
+
renderBelowHeader: t.renderBelowHeader ?? (() => m),
|
|
360
383
|
renderPanelBody: t.renderPanelBody
|
|
361
384
|
});
|
|
362
385
|
}
|
|
363
|
-
function
|
|
364
|
-
return t.yearSelectorOpen && t.offset === 0 ?
|
|
386
|
+
function ae(t) {
|
|
387
|
+
return t.yearSelectorOpen && t.offset === 0 ? J({
|
|
365
388
|
years: t.years,
|
|
366
389
|
currentYear: t.currentYear,
|
|
367
390
|
onSelectYear: t.onSelectYear,
|
|
368
|
-
onKeydown: t.onYearKeydown
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
(
|
|
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))
|
|
373
398
|
);
|
|
374
399
|
}
|
|
375
|
-
function
|
|
376
|
-
const r =
|
|
400
|
+
function Z(t, e) {
|
|
401
|
+
const r = L(e.localeId, t, e.monthFormat);
|
|
377
402
|
return c`
|
|
378
403
|
<header class="gui-calendar__header">
|
|
379
404
|
<h2>
|
|
380
405
|
${r.map(
|
|
381
406
|
(n) => n.type === "year" ? c`<button
|
|
382
407
|
type="button"
|
|
383
|
-
tabindex="0"
|
|
384
408
|
class="gui-calendar__year-selector"
|
|
385
409
|
@click=${e.onToggleYearSelector}
|
|
386
410
|
aria-expanded=${e.yearSelectorOpen}
|
|
387
|
-
aria-label
|
|
411
|
+
aria-label=${`${e.selectYearAriaLabel ?? "Select year"}, ${n.value}`}
|
|
388
412
|
>
|
|
389
413
|
<span class="gui-calendar__year-value">${n.value}</span>
|
|
390
414
|
<span class="gui-calendar__year-arrow" aria-hidden="true">
|
|
@@ -405,25 +429,25 @@ function W(t, e) {
|
|
|
405
429
|
</header>
|
|
406
430
|
`;
|
|
407
431
|
}
|
|
408
|
-
function
|
|
432
|
+
function z(t, e, r, n) {
|
|
409
433
|
return c`
|
|
410
|
-
<div class="gui-calendar__days-grid" role="grid">
|
|
434
|
+
<div class="gui-calendar__days-grid" role="grid" aria-label=${n ?? m}>
|
|
411
435
|
<div role="row" class="gui-calendar__rows">
|
|
412
436
|
${w(
|
|
413
437
|
e,
|
|
414
|
-
(
|
|
415
|
-
(
|
|
438
|
+
(s, o) => o,
|
|
439
|
+
(s) => c`<span class="gui-calendar__weekday" role="columnheader">${s}</span>`
|
|
416
440
|
)}
|
|
417
441
|
</div>
|
|
418
442
|
|
|
419
443
|
${w(
|
|
420
444
|
t,
|
|
421
|
-
(
|
|
445
|
+
(s) => c`
|
|
422
446
|
<div role="row" class="gui-calendar__rows">
|
|
423
447
|
${w(
|
|
424
|
-
|
|
425
|
-
(
|
|
426
|
-
(
|
|
448
|
+
s,
|
|
449
|
+
(o) => o.date.toISOString(),
|
|
450
|
+
(o) => r(o)
|
|
427
451
|
)}
|
|
428
452
|
</div>
|
|
429
453
|
`
|
|
@@ -431,16 +455,16 @@ function j(t, e, r) {
|
|
|
431
455
|
</div>
|
|
432
456
|
`;
|
|
433
457
|
}
|
|
434
|
-
function
|
|
458
|
+
function J(t) {
|
|
435
459
|
const e = t.currentYear;
|
|
436
460
|
return c`
|
|
437
461
|
<div
|
|
438
462
|
class="gui-calendar__year-grid"
|
|
439
463
|
role="grid"
|
|
440
|
-
aria-label
|
|
464
|
+
aria-label=${t.ariaLabel ?? "Year selection"}
|
|
441
465
|
@keydown=${t.onKeydown}
|
|
442
466
|
>
|
|
443
|
-
${
|
|
467
|
+
${k(t.years, 4).map(
|
|
444
468
|
(r) => c`
|
|
445
469
|
<div role="row" class="gui-calendar__year-row">
|
|
446
470
|
${r.map(
|
|
@@ -451,8 +475,8 @@ function Z(t) {
|
|
|
451
475
|
class="gui-calendar__year-button ${n === e ? "current" : ""}"
|
|
452
476
|
tabindex=${n === e ? 0 : -1}
|
|
453
477
|
data-year=${n}
|
|
454
|
-
@click=${(
|
|
455
|
-
|
|
478
|
+
@click=${(s) => {
|
|
479
|
+
s.stopPropagation(), t.onSelectYear(n);
|
|
456
480
|
}}
|
|
457
481
|
aria-selected=${n === e}
|
|
458
482
|
>
|
|
@@ -466,26 +490,26 @@ function Z(t) {
|
|
|
466
490
|
</div>
|
|
467
491
|
`;
|
|
468
492
|
}
|
|
469
|
-
function
|
|
493
|
+
function le(t, e) {
|
|
470
494
|
const r = t.getTime();
|
|
471
|
-
let n = !1,
|
|
495
|
+
let n = !1, s = !1, o = !1, u = !1, p = !1, f = !1, d = !1, h = !1;
|
|
472
496
|
if (e.selectedISO && (n = y(t, M(e.selectedISO))), e.invalidRange) {
|
|
473
|
-
const
|
|
474
|
-
f = y(t,
|
|
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);
|
|
475
499
|
}
|
|
476
500
|
if (e.selectingSpan && (p = r >= e.selectingSpan.start.getTime() && r <= e.selectingSpan.end.getTime()), e.ranges)
|
|
477
|
-
for (const
|
|
478
|
-
y(t,
|
|
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));
|
|
479
503
|
if (e.workingRange) {
|
|
480
|
-
const { start:
|
|
481
|
-
y(t,
|
|
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);
|
|
482
506
|
}
|
|
483
507
|
return {
|
|
484
508
|
isSelected: n,
|
|
485
|
-
isRangeStart:
|
|
486
|
-
isRangeEnd:
|
|
509
|
+
isRangeStart: s,
|
|
510
|
+
isRangeEnd: o,
|
|
487
511
|
isInRange: u,
|
|
488
|
-
isOneDayRange:
|
|
512
|
+
isOneDayRange: s && o,
|
|
489
513
|
isAnchor: e.anchor ? y(t, e.anchor) : !1,
|
|
490
514
|
isSelecting: p,
|
|
491
515
|
isInvalidStart: f,
|
|
@@ -493,38 +517,38 @@ function ie(t, e) {
|
|
|
493
517
|
isInvalidInRange: h
|
|
494
518
|
};
|
|
495
519
|
}
|
|
496
|
-
function
|
|
497
|
-
const { currentDate: e, offset: r = 0, localeId: n, numberOfMonths:
|
|
498
|
-
h.setDate(
|
|
499
|
-
let
|
|
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 = [];
|
|
500
524
|
for (let l = 0; l < 42; l++) {
|
|
501
|
-
const
|
|
502
|
-
|
|
525
|
+
const a = new Date(h);
|
|
526
|
+
a.setDate(h.getDate() + l), i.push(
|
|
503
527
|
t.toDay({
|
|
504
|
-
date:
|
|
505
|
-
dayLabel:
|
|
506
|
-
isCurrentMonth:
|
|
507
|
-
isToday:
|
|
508
|
-
isDisabled: t.isDisabled(
|
|
528
|
+
date: a,
|
|
529
|
+
dayLabel: q(n, a),
|
|
530
|
+
isCurrentMonth: a.getMonth() === u,
|
|
531
|
+
isToday: P(a),
|
|
532
|
+
isDisabled: t.isDisabled(a)
|
|
509
533
|
})
|
|
510
534
|
);
|
|
511
535
|
}
|
|
512
536
|
for (let l = 0; l < 2; l++)
|
|
513
|
-
|
|
514
|
-
if (r === 0 && !
|
|
515
|
-
(
|
|
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)
|
|
516
540
|
)) {
|
|
517
|
-
const
|
|
518
|
-
|
|
541
|
+
const a = i.find((g) => g.isCurrentMonth && !g.isDisabled);
|
|
542
|
+
a && (a.isFocusable = !0);
|
|
519
543
|
}
|
|
520
|
-
return
|
|
544
|
+
return i;
|
|
521
545
|
}
|
|
522
546
|
export {
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
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
|
|
530
554
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { InputWidgetAdapter as w, formContext as y, inputContext as F } from "@golemui/lit";
|
|
2
2
|
import { consume as x, provide as C } from "@lit/context";
|
|
3
3
|
import { LitElement as D, nothing as f, html as g } from "lit";
|
|
4
|
-
import { property as L, state as c, query as
|
|
4
|
+
import { property as L, state as c, query as I, customElement as R } from "lit/decorators.js";
|
|
5
5
|
import { Subject as V, debounceTime as k } from "rxjs";
|
|
6
|
-
import { d as j } from "./list-
|
|
7
|
-
import "./errors-
|
|
6
|
+
import { d as j } from "./list-D730tmGN.js";
|
|
7
|
+
import "./errors-Byb2dIhK.js";
|
|
8
8
|
var O = Object.defineProperty, S = Object.getOwnPropertyDescriptor, l = (e, t, i, s) => {
|
|
9
9
|
for (var r = s > 1 ? void 0 : s ? S(t, i) : t, d = e.length - 1, h; d >= 0; d--)
|
|
10
10
|
(h = e[d]) && (r = (s ? h(t, i, r) : h(r)) || r);
|
|
@@ -126,13 +126,10 @@ let a = class extends D {
|
|
|
126
126
|
.native=${!1}
|
|
127
127
|
></gui-label>
|
|
128
128
|
|
|
129
|
-
<div
|
|
130
|
-
class="gui-widget"
|
|
131
|
-
aria-expanded=${this._isListVisible}
|
|
132
|
-
@keydown=${this._onWidgetKeyDown}
|
|
133
|
-
>
|
|
129
|
+
<div class="gui-widget" @keydown=${this._onWidgetKeyDown}>
|
|
134
130
|
<input
|
|
135
131
|
type="text"
|
|
132
|
+
role="combobox"
|
|
136
133
|
id=${this.widget.uid}
|
|
137
134
|
data-cy=${`${this.widget.uid}_textinput`}
|
|
138
135
|
class="gui-widget-input"
|
|
@@ -146,18 +143,27 @@ let a = class extends D {
|
|
|
146
143
|
@input=${this._onInput}
|
|
147
144
|
@focusout=${this._onFocusOutInput}
|
|
148
145
|
@focus=${this._onFocus}
|
|
146
|
+
aria-expanded=${this._isListVisible ? "true" : "false"}
|
|
147
|
+
aria-controls=${`${this.widget.uid}-list`}
|
|
148
|
+
aria-autocomplete="list"
|
|
149
149
|
aria-labelledby=${e.label ? `${this.widget.uid}_label` : f}
|
|
150
150
|
aria-describedby=${e.hint ? `${this.widget.uid}_hint` : f}
|
|
151
151
|
/>
|
|
152
152
|
<span class="gui-dropdown__arrow"
|
|
153
|
-
><svg
|
|
153
|
+
><svg
|
|
154
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
155
|
+
width="16"
|
|
156
|
+
height="16"
|
|
157
|
+
viewBox="0 0 256 256"
|
|
158
|
+
aria-hidden="true"
|
|
159
|
+
>
|
|
154
160
|
<path
|
|
155
161
|
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"
|
|
156
162
|
></path></svg
|
|
157
163
|
></span>
|
|
158
164
|
|
|
159
165
|
<gui-list
|
|
160
|
-
id=${this.widget.uid}
|
|
166
|
+
id=${`${this.widget.uid}-list`}
|
|
161
167
|
.uid=${this.widget.uid}
|
|
162
168
|
.value=${e.value ?? ""}
|
|
163
169
|
.valueField=${e.valueField}
|
|
@@ -177,7 +183,7 @@ let a = class extends D {
|
|
|
177
183
|
@change=${this._onValueChange}
|
|
178
184
|
>
|
|
179
185
|
${i.map((o, _) => {
|
|
180
|
-
const u = this._range.start + _, p = e.value === o.value, m = this._focusedIndex === u, b = !!e.disabled || !!o.disabled,
|
|
186
|
+
const u = this._range.start + _, p = e.value === o.value, m = this._focusedIndex === u, b = !!e.disabled || !!o.disabled, $ = e.labelField ?? "label", v = o.template !== null && typeof o.template == "object" && $ && !e.itemRenderer ? o.template[$] : o.template;
|
|
181
187
|
return g`
|
|
182
188
|
<div
|
|
183
189
|
role="option"
|
|
@@ -240,10 +246,10 @@ l([
|
|
|
240
246
|
c()
|
|
241
247
|
], a.prototype, "_selectedItem", 2);
|
|
242
248
|
l([
|
|
243
|
-
|
|
249
|
+
I("input")
|
|
244
250
|
], a.prototype, "_inputRef", 2);
|
|
245
251
|
l([
|
|
246
|
-
|
|
252
|
+
I("gui-list")
|
|
247
253
|
], a.prototype, "_listRef", 2);
|
|
248
254
|
a = l([
|
|
249
255
|
R("gui-dropdown-input")
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { LitElement as h, html as y } from "lit";
|
|
2
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-
|
|
3
|
+
import { G as m, b as f, c as g } from "./templates-Dmr34nwp.js";
|
|
4
4
|
var v = Object.defineProperty, b = Object.getOwnPropertyDescriptor, o = (u, s, n, i) => {
|
|
5
5
|
for (var e = i > 1 ? void 0 : i ? b(s, n) : s, l = u.length - 1, a; l >= 0; l--)
|
|
6
6
|
(a = u[l]) && (e = (i ? a(s, n, e) : a(e)) || e);
|
|
@@ -17,7 +17,8 @@ let t = class extends h {
|
|
|
17
17
|
errors: this.errors,
|
|
18
18
|
readonly: this.readOnly,
|
|
19
19
|
disabled: this.disabled,
|
|
20
|
-
touched: this.touched
|
|
20
|
+
touched: this.touched,
|
|
21
|
+
required: this.required
|
|
21
22
|
}
|
|
22
23
|
})
|
|
23
24
|
});
|