@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
|
@@ -709,7 +709,7 @@ const l = {
|
|
|
709
709
|
"zh-Hant-HK": { firstDay: 7, weekend: [6, 7], minimalDays: 1 },
|
|
710
710
|
"zh-Hant-MO": { firstDay: 7, weekend: [6, 7], minimalDays: 1 },
|
|
711
711
|
zu: { firstDay: 7, weekend: [6, 7], minimalDays: 1 }
|
|
712
|
-
},
|
|
712
|
+
}, A = "Invalid date: day is greater than the maximum valid day for the month and year.", k = "Invalid date: date is before the minimum allowed date.", w = "Invalid date: date is after the maximum allowed date.", o = "Invalid date: date is within a disabled range.", I = "Invalid time: time is before the minimum allowed time.", S = "Invalid time: time is after the maximum allowed time.", h = "Invalid range: end time must be after start time.", E = "Invalid time: time is within a disabled range.", b = "Invalid date-time: date-time is before the minimum allowed date-time.", L = "Invalid date-time: date-time is after the maximum allowed date-time.";
|
|
713
713
|
function r(e) {
|
|
714
714
|
const a = e.getFullYear(), n = String(e.getMonth() + 1).padStart(2, "0"), i = String(e.getDate()).padStart(2, "0");
|
|
715
715
|
return `${a}-${n}-${i}`;
|
|
@@ -729,11 +729,11 @@ function d(e, a, n, i) {
|
|
|
729
729
|
}
|
|
730
730
|
return !1;
|
|
731
731
|
}
|
|
732
|
-
function
|
|
732
|
+
function T(e, a, n, i, s) {
|
|
733
733
|
const m = e.split("T")[0];
|
|
734
734
|
return a && m < a.split("T")[0] ? s?.minDateMessage ?? k : n && m > n.split("T")[0] ? s?.maxDateMessage ?? w : d(m, void 0, void 0, i) ? s?.disabledDateRangeMessage ?? o : null;
|
|
735
735
|
}
|
|
736
|
-
function
|
|
736
|
+
function G(e, a, n, i, s) {
|
|
737
737
|
const m = t(e), D = t(a);
|
|
738
738
|
if (isNaN(m.getTime()) || isNaN(D.getTime())) return !1;
|
|
739
739
|
const y = new Date(m);
|
|
@@ -777,7 +777,13 @@ function v(e) {
|
|
|
777
777
|
return s.setDate(n.getDate() + i), a.format(s);
|
|
778
778
|
});
|
|
779
779
|
}
|
|
780
|
-
function B(e, a
|
|
780
|
+
function B(e, a) {
|
|
781
|
+
return new Intl.DateTimeFormat(e, { month: "long", year: "numeric" }).format(a);
|
|
782
|
+
}
|
|
783
|
+
function R(e, a) {
|
|
784
|
+
return new Intl.DateTimeFormat(e, { dateStyle: "full" }).format(a);
|
|
785
|
+
}
|
|
786
|
+
function F(e, a, n) {
|
|
781
787
|
for (let i = 0; i < n; i++) {
|
|
782
788
|
const s = new Date(a.getFullYear(), a.getMonth() + i, 1);
|
|
783
789
|
if (e.getMonth() === s.getMonth() && e.getFullYear() === s.getFullYear())
|
|
@@ -785,18 +791,18 @@ function B(e, a, n) {
|
|
|
785
791
|
}
|
|
786
792
|
return !1;
|
|
787
793
|
}
|
|
788
|
-
function
|
|
794
|
+
function H(e, a, n = "long") {
|
|
789
795
|
return new Intl.DateTimeFormat(e, { month: n, year: "numeric" }).formatToParts(a).filter((s) => s.type === "month" || s.type === "year");
|
|
790
796
|
}
|
|
791
|
-
function
|
|
797
|
+
function _(e, a) {
|
|
792
798
|
const n = e || "en-US", m = new Intl.DateTimeFormat(n, { day: "numeric" }).formatToParts(a).find((D) => D.type === "day");
|
|
793
799
|
return m ? m.value : a.getDate().toString();
|
|
794
800
|
}
|
|
795
|
-
function
|
|
801
|
+
function M(e, a) {
|
|
796
802
|
const n = r(e), i = r(a);
|
|
797
803
|
return n === i ? { start: n } : { start: n, end: i };
|
|
798
804
|
}
|
|
799
|
-
function
|
|
805
|
+
function z(e) {
|
|
800
806
|
return e.length ? e.map((i) => ({
|
|
801
807
|
start: t(i.start).getTime(),
|
|
802
808
|
end: t(i.end ?? i.start).getTime()
|
|
@@ -811,31 +817,33 @@ function _(e) {
|
|
|
811
817
|
return [...i, s];
|
|
812
818
|
},
|
|
813
819
|
[]
|
|
814
|
-
).map((i) =>
|
|
820
|
+
).map((i) => M(new Date(i.start), new Date(i.end))) : [];
|
|
815
821
|
}
|
|
816
822
|
export {
|
|
817
823
|
o as D,
|
|
818
824
|
I,
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
825
|
+
N as a,
|
|
826
|
+
S as b,
|
|
827
|
+
M as c,
|
|
828
|
+
T as d,
|
|
823
829
|
E as e,
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
830
|
+
h as f,
|
|
831
|
+
R as g,
|
|
832
|
+
C as h,
|
|
827
833
|
d as i,
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
+
_ as j,
|
|
835
|
+
F as k,
|
|
836
|
+
B as l,
|
|
837
|
+
z as m,
|
|
838
|
+
v as n,
|
|
839
|
+
H as o,
|
|
834
840
|
t as p,
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
841
|
+
u as q,
|
|
842
|
+
G as r,
|
|
843
|
+
b as s,
|
|
838
844
|
r as t,
|
|
839
|
-
|
|
840
|
-
|
|
845
|
+
L as u,
|
|
846
|
+
p as v,
|
|
847
|
+
g as w,
|
|
848
|
+
A as x
|
|
841
849
|
};
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import { LitElement as u, nothing as p, html as h } from "lit";
|
|
2
|
-
import { property as
|
|
2
|
+
import { property as i, customElement as c } from "lit/decorators.js";
|
|
3
3
|
import { classMap as g } from "lit/directives/class-map.js";
|
|
4
|
-
import { G as
|
|
5
|
-
import { n as
|
|
6
|
-
import {
|
|
7
|
-
var
|
|
8
|
-
for (var
|
|
9
|
-
(
|
|
10
|
-
return r &&
|
|
4
|
+
import { G as y, b as m, c as b } from "./templates-Dmr34nwp.js";
|
|
5
|
+
import { n as v, G as D, r as f, q as E, P as A } from "./part-templates-VORbpgs2.js";
|
|
6
|
+
import { a as C, d as S } from "./date-DBuYpvcO.js";
|
|
7
|
+
var w = Object.defineProperty, P = Object.getOwnPropertyDescriptor, e = (s, a, l, r) => {
|
|
8
|
+
for (var o = r > 1 ? void 0 : r ? P(a, l) : a, d = s.length - 1, n; d >= 0; d--)
|
|
9
|
+
(n = s[d]) && (o = (r ? n(a, l, o) : n(o)) || o);
|
|
10
|
+
return r && o && w(a, l, o), o;
|
|
11
11
|
};
|
|
12
12
|
let t = class extends u {
|
|
13
13
|
constructor() {
|
|
14
|
-
super(...arguments), this.uid = void 0, this.label = void 0, this.localeId = void 0, this.errors = [], this.showErrors = !0, this.touched = !1, this.required = !1, this.disabled = !1, this.readOnly = !1, this.icon = "", this.hint = void 0, this.value = void 0, this.invalidDateMessage = void 0, this.minDate = void 0, this.maxDate = void 0, this.minDateMessage = void 0, this.maxDateMessage = void 0, this.inputBlockClass = "gui-date-input", this.groups = ["default"], this.partDescriptors =
|
|
14
|
+
super(...arguments), this.uid = void 0, this.label = void 0, this.localeId = void 0, this.errors = [], this.showErrors = !0, this.touched = !1, this.required = !1, this.disabled = !1, this.readOnly = !1, this.icon = "", this.hint = void 0, this.dayAriaLabel = void 0, this.monthAriaLabel = void 0, this.yearAriaLabel = void 0, this.value = void 0, this.invalidDateMessage = void 0, this.minDate = void 0, this.maxDate = void 0, this.minDateMessage = void 0, this.maxDateMessage = void 0, this.inputBlockClass = "gui-date-input", this.groups = ["default"], this.partDescriptors = v(), this._parts = new D(this, {
|
|
15
15
|
blockClass: this.inputBlockClass,
|
|
16
16
|
groups: this.groups,
|
|
17
|
-
getDescriptor: (
|
|
18
|
-
commitGroup: (
|
|
17
|
+
getDescriptor: (s) => this.getPartDescriptor(s),
|
|
18
|
+
commitGroup: (s) => this.validateAndEmit(s),
|
|
19
19
|
isReadonly: () => !!this.readOnly,
|
|
20
20
|
isDisabled: () => !!this.disabled,
|
|
21
21
|
onEmptyPartBlur: () => this.dispatchEvent(new CustomEvent("change", { detail: { value: null }, bubbles: !0 }))
|
|
22
|
-
}), this.ariaController = new
|
|
22
|
+
}), this.ariaController = new y(this, {
|
|
23
23
|
getTargets: () => this.querySelectorAll(`.${this.inputBlockClass}`),
|
|
24
24
|
getState: () => ({
|
|
25
25
|
uid: this.uid,
|
|
@@ -28,7 +28,8 @@ let t = class extends u {
|
|
|
28
28
|
errors: this.errors,
|
|
29
29
|
readonly: this.readOnly,
|
|
30
30
|
disabled: this.disabled,
|
|
31
|
-
touched: this.touched
|
|
31
|
+
touched: this.touched,
|
|
32
|
+
required: this.required
|
|
32
33
|
}
|
|
33
34
|
})
|
|
34
35
|
});
|
|
@@ -39,14 +40,14 @@ let t = class extends u {
|
|
|
39
40
|
connectedCallback() {
|
|
40
41
|
super.connectedCallback(), this.classList.add("gui-field");
|
|
41
42
|
}
|
|
42
|
-
getPartDescriptor(
|
|
43
|
-
return this.partDescriptors[
|
|
43
|
+
getPartDescriptor(s) {
|
|
44
|
+
return this.partDescriptors[s];
|
|
44
45
|
}
|
|
45
|
-
willUpdate(
|
|
46
|
-
|
|
46
|
+
willUpdate(s) {
|
|
47
|
+
s.has("value") && this._parts.setGroupFromISO("default", this.value ?? "", "date");
|
|
47
48
|
}
|
|
48
49
|
render() {
|
|
49
|
-
const
|
|
50
|
+
const s = {
|
|
50
51
|
uid: this.uid,
|
|
51
52
|
label: this.label,
|
|
52
53
|
errors: this.errors,
|
|
@@ -63,35 +64,45 @@ let t = class extends u {
|
|
|
63
64
|
formatParts: C(this.localeId),
|
|
64
65
|
getDescriptor: (r) => this.getPartDescriptor(r),
|
|
65
66
|
getDisplayValue: this._parts.getPartDisplay,
|
|
66
|
-
|
|
67
|
+
getPartAriaLabel: (r, o) => ({
|
|
68
|
+
day: this.dayAriaLabel,
|
|
69
|
+
month: this.monthAriaLabel,
|
|
70
|
+
year: this.yearAriaLabel
|
|
71
|
+
})[o] ?? A[o],
|
|
67
72
|
disabled: this.disabled,
|
|
68
73
|
partsReadonly: !!this.readOnly
|
|
69
|
-
},
|
|
74
|
+
}, l = {
|
|
70
75
|
"gui-widget-icon": !0,
|
|
71
76
|
[this.icon]: !0
|
|
72
77
|
};
|
|
73
78
|
return h`
|
|
74
|
-
${this.label ?
|
|
79
|
+
${this.label ? m(this.uid, s, !1, void 0, !1) : p}
|
|
75
80
|
|
|
76
81
|
<div class="gui-widget">
|
|
77
82
|
<div
|
|
83
|
+
id=${this.uid}
|
|
78
84
|
class="gui-widget-input gui-parts gui-parts-ring gui-date-input ${this.icon ? "gui-calendar--icon" : ""}"
|
|
79
85
|
role="group"
|
|
86
|
+
aria-labelledby=${`${this.uid}_label`}
|
|
80
87
|
>
|
|
81
88
|
${f("default", a, this._parts)}
|
|
82
89
|
</div>
|
|
83
|
-
${this.icon ? h`<span
|
|
90
|
+
${this.icon ? h`<span
|
|
91
|
+
class=${g(l)}
|
|
92
|
+
data-icon=${this.icon}
|
|
93
|
+
aria-hidden="true"
|
|
94
|
+
></span>` : p}
|
|
84
95
|
</div>
|
|
85
96
|
|
|
86
|
-
${this.showErrors && this.errors?.length ?
|
|
97
|
+
${this.showErrors && this.errors?.length ? b(this.uid, s) : p}
|
|
87
98
|
`;
|
|
88
99
|
}
|
|
89
|
-
validateAndEmit(
|
|
90
|
-
const { result: a, writeBacks:
|
|
100
|
+
validateAndEmit(s) {
|
|
101
|
+
const { result: a, writeBacks: l } = E(this._parts.values[s] ?? {}, {
|
|
91
102
|
descriptors: this.partDescriptors,
|
|
92
103
|
invalidDateMessage: this.invalidDateMessage
|
|
93
104
|
});
|
|
94
|
-
if (this._parts.applyWriteBacks(
|
|
105
|
+
if (this._parts.applyWriteBacks(s, l), a.kind === "invalid")
|
|
95
106
|
this.dispatchEvent(
|
|
96
107
|
new CustomEvent("inputError", {
|
|
97
108
|
detail: { message: a.message },
|
|
@@ -99,7 +110,7 @@ let t = class extends u {
|
|
|
99
110
|
})
|
|
100
111
|
);
|
|
101
112
|
else if (a.kind === "valid") {
|
|
102
|
-
const r =
|
|
113
|
+
const r = S(a.iso, this.minDate, this.maxDate, void 0, {
|
|
103
114
|
minDateMessage: this.minDateMessage,
|
|
104
115
|
maxDateMessage: this.maxDateMessage
|
|
105
116
|
});
|
|
@@ -128,55 +139,64 @@ let t = class extends u {
|
|
|
128
139
|
}
|
|
129
140
|
};
|
|
130
141
|
e([
|
|
131
|
-
|
|
142
|
+
i({ type: String })
|
|
132
143
|
], t.prototype, "uid", 2);
|
|
133
144
|
e([
|
|
134
|
-
|
|
145
|
+
i({ type: String })
|
|
135
146
|
], t.prototype, "label", 2);
|
|
136
147
|
e([
|
|
137
|
-
|
|
148
|
+
i({ type: String, attribute: "locale-id" })
|
|
138
149
|
], t.prototype, "localeId", 2);
|
|
139
150
|
e([
|
|
140
|
-
|
|
151
|
+
i({ type: Array })
|
|
141
152
|
], t.prototype, "errors", 2);
|
|
142
153
|
e([
|
|
143
|
-
|
|
154
|
+
i({ type: Boolean })
|
|
144
155
|
], t.prototype, "showErrors", 2);
|
|
145
156
|
e([
|
|
146
|
-
|
|
157
|
+
i({ type: Boolean })
|
|
147
158
|
], t.prototype, "touched", 2);
|
|
148
159
|
e([
|
|
149
|
-
|
|
160
|
+
i({ type: Boolean })
|
|
150
161
|
], t.prototype, "required", 2);
|
|
151
162
|
e([
|
|
152
|
-
|
|
163
|
+
i({ type: Boolean })
|
|
153
164
|
], t.prototype, "disabled", 2);
|
|
154
165
|
e([
|
|
155
|
-
|
|
166
|
+
i({ type: Boolean, attribute: "readonly" })
|
|
156
167
|
], t.prototype, "readOnly", 2);
|
|
157
168
|
e([
|
|
158
|
-
|
|
169
|
+
i({ type: String })
|
|
159
170
|
], t.prototype, "icon", 2);
|
|
160
171
|
e([
|
|
161
|
-
|
|
172
|
+
i({ type: String })
|
|
162
173
|
], t.prototype, "hint", 2);
|
|
163
174
|
e([
|
|
164
|
-
|
|
175
|
+
i({ type: String })
|
|
176
|
+
], t.prototype, "dayAriaLabel", 2);
|
|
177
|
+
e([
|
|
178
|
+
i({ type: String })
|
|
179
|
+
], t.prototype, "monthAriaLabel", 2);
|
|
180
|
+
e([
|
|
181
|
+
i({ type: String })
|
|
182
|
+
], t.prototype, "yearAriaLabel", 2);
|
|
183
|
+
e([
|
|
184
|
+
i({ type: String })
|
|
165
185
|
], t.prototype, "value", 2);
|
|
166
186
|
e([
|
|
167
|
-
|
|
187
|
+
i({ type: String, attribute: "invalid-date-message" })
|
|
168
188
|
], t.prototype, "invalidDateMessage", 2);
|
|
169
189
|
e([
|
|
170
|
-
|
|
190
|
+
i({ type: String, attribute: "min-date" })
|
|
171
191
|
], t.prototype, "minDate", 2);
|
|
172
192
|
e([
|
|
173
|
-
|
|
193
|
+
i({ type: String, attribute: "max-date" })
|
|
174
194
|
], t.prototype, "maxDate", 2);
|
|
175
195
|
e([
|
|
176
|
-
|
|
196
|
+
i({ type: String, attribute: "min-date-message" })
|
|
177
197
|
], t.prototype, "minDateMessage", 2);
|
|
178
198
|
e([
|
|
179
|
-
|
|
199
|
+
i({ type: String, attribute: "max-date-message" })
|
|
180
200
|
], t.prototype, "maxDateMessage", 2);
|
|
181
201
|
t = e([
|
|
182
202
|
c("gui-date")
|
|
@@ -0,0 +1,357 @@
|
|
|
1
|
+
import { InputWidgetAdapter as g, formContext as m, inputContext as y } from "@golemui/lit";
|
|
2
|
+
import { LitElement as c, html as h, nothing as $ } from "lit";
|
|
3
|
+
import { property as a, customElement as b } from "lit/decorators.js";
|
|
4
|
+
import { classMap as v } from "lit/directives/class-map.js";
|
|
5
|
+
import "./date-input-DLiMreSS.js";
|
|
6
|
+
import "./calendar-D31xNsxx.js";
|
|
7
|
+
import { G as M } from "./popup.controller-B33OvX_y.js";
|
|
8
|
+
import { d as f } from "./date-DBuYpvcO.js";
|
|
9
|
+
import { a as A, b as D, c as L } from "./templates-Dmr34nwp.js";
|
|
10
|
+
import { consume as x, provide as w } from "@lit/context";
|
|
11
|
+
import "rxjs";
|
|
12
|
+
var _ = Object.defineProperty, C = Object.getOwnPropertyDescriptor, i = (e, r, n, s) => {
|
|
13
|
+
for (var o = s > 1 ? void 0 : s ? C(r, n) : r, l = e.length - 1, d; l >= 0; l--)
|
|
14
|
+
(d = e[l]) && (o = (s ? d(r, n, o) : d(o)) || o);
|
|
15
|
+
return s && o && _(r, n, o), o;
|
|
16
|
+
};
|
|
17
|
+
let t = class extends c {
|
|
18
|
+
constructor() {
|
|
19
|
+
super(...arguments), this.uid = void 0, this.label = void 0, this.hint = void 0, this.icon = "", this.toggleAriaLabel = void 0, this.dayAriaLabel = void 0, this.monthAriaLabel = void 0, this.yearAriaLabel = void 0, this.errors = [], this.showErrors = !0, this.touched = !1, this.required = !1, this.disabled = !1, this.readOnly = !1, this.localeId = void 0, this.value = void 0, this.prevMonthIcon = "", this.nextMonthIcon = "", this.prevMonthAriaLabel = void 0, this.nextMonthAriaLabel = void 0, this.selectYearAriaLabel = void 0, this.yearGridAriaLabel = void 0, this.dayFormat = void 0, this.weekdayFormat = void 0, this.monthFormat = void 0, this.minDate = void 0, this.maxDate = void 0, this.disabledRanges = void 0, this.numberOfMonths = void 0, this.invalidDateMessage = void 0, this.minDateMessage = void 0, this.maxDateMessage = void 0, this.disabledDateRangeMessage = void 0, this._popup = new M(this, {
|
|
20
|
+
focusRestoreSelector: "gui-date input",
|
|
21
|
+
focusPopupSelector: '.gui-calendar__day-button[tabindex="0"]',
|
|
22
|
+
isDisabled: () => !!this.disabled,
|
|
23
|
+
clickIntent: (e) => e.closest(".gui-calendar__day-button") ? "ignore" : e.closest(".gui-date-input__part") || e.closest("gui-calendar") ? "open" : "toggle",
|
|
24
|
+
keyToggleMode: "toggle"
|
|
25
|
+
}), this.onToggleClick = (e) => {
|
|
26
|
+
e.stopPropagation(), this._popup.open ? this._popup.close() : this._popup.openAndFocus();
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
createRenderRoot() {
|
|
30
|
+
return this;
|
|
31
|
+
}
|
|
32
|
+
render() {
|
|
33
|
+
const e = A("datePicker", { icon: this.icon }), r = this._popup.open ? h`<gui-calendar
|
|
34
|
+
id=${`${this.uid}_popup`}
|
|
35
|
+
role="dialog"
|
|
36
|
+
aria-label=${this.label ?? "Calendar"}
|
|
37
|
+
.uid=${this.uid}
|
|
38
|
+
.hint=${this.hint}
|
|
39
|
+
?touched=${this.touched}
|
|
40
|
+
?required=${this.required}
|
|
41
|
+
?disabled=${this.disabled}
|
|
42
|
+
?readonly=${this.readOnly}
|
|
43
|
+
.value=${this.value}
|
|
44
|
+
.prevMonthIcon=${this.prevMonthIcon}
|
|
45
|
+
.nextMonthIcon=${this.nextMonthIcon}
|
|
46
|
+
.prevMonthAriaLabel=${this.prevMonthAriaLabel}
|
|
47
|
+
.nextMonthAriaLabel=${this.nextMonthAriaLabel}
|
|
48
|
+
.selectYearAriaLabel=${this.selectYearAriaLabel}
|
|
49
|
+
.yearGridAriaLabel=${this.yearGridAriaLabel}
|
|
50
|
+
.dayFormat=${this.dayFormat}
|
|
51
|
+
.weekdayFormat=${this.weekdayFormat}
|
|
52
|
+
.monthFormat=${this.monthFormat}
|
|
53
|
+
.minDate=${this.minDate}
|
|
54
|
+
.maxDate=${this.maxDate}
|
|
55
|
+
.disabledRanges=${this.disabledRanges}
|
|
56
|
+
.numberOfMonths=${this.numberOfMonths}
|
|
57
|
+
.localeId=${this.localeId}
|
|
58
|
+
@blur=${this.onCalendarBlur}
|
|
59
|
+
@change=${this.onCalendarChange}
|
|
60
|
+
></gui-calendar>` : $;
|
|
61
|
+
return h`
|
|
62
|
+
${D(
|
|
63
|
+
this.uid ?? "",
|
|
64
|
+
{
|
|
65
|
+
label: this.label,
|
|
66
|
+
hint: this.hint,
|
|
67
|
+
required: this.required
|
|
68
|
+
},
|
|
69
|
+
!1,
|
|
70
|
+
void 0,
|
|
71
|
+
!1
|
|
72
|
+
)}
|
|
73
|
+
|
|
74
|
+
<div
|
|
75
|
+
class="gui-widget"
|
|
76
|
+
@keydown=${this._popup.onAnchorKeyDown}
|
|
77
|
+
@click=${this._popup.onAnchorClick}
|
|
78
|
+
>
|
|
79
|
+
<gui-date
|
|
80
|
+
id="date-input"
|
|
81
|
+
class=${v(e.widgetClasses)}
|
|
82
|
+
.uid=${this.uid}
|
|
83
|
+
.hint=${this.hint}
|
|
84
|
+
.showErrors=${!1}
|
|
85
|
+
.errors=${this.errors}
|
|
86
|
+
?touched=${this.touched}
|
|
87
|
+
?required=${this.required}
|
|
88
|
+
?disabled=${this.disabled}
|
|
89
|
+
?readonly=${this.readOnly}
|
|
90
|
+
.value=${this.value}
|
|
91
|
+
.icon=${this.icon}
|
|
92
|
+
.localeId=${this.localeId}
|
|
93
|
+
.dayAriaLabel=${this.dayAriaLabel}
|
|
94
|
+
.monthAriaLabel=${this.monthAriaLabel}
|
|
95
|
+
.yearAriaLabel=${this.yearAriaLabel}
|
|
96
|
+
.invalidDateMessage=${this.invalidDateMessage}
|
|
97
|
+
@blur=${this.onDateBlur}
|
|
98
|
+
@focus=${this._popup.show}
|
|
99
|
+
@change=${this.onDateChange}
|
|
100
|
+
></gui-date>
|
|
101
|
+
<button
|
|
102
|
+
type="button"
|
|
103
|
+
class="gui-date-picker__arrow"
|
|
104
|
+
aria-label=${this.toggleAriaLabel ?? "Show calendar"}
|
|
105
|
+
aria-haspopup="dialog"
|
|
106
|
+
aria-expanded=${this._popup.open ? "true" : "false"}
|
|
107
|
+
aria-controls=${`${this.uid}_popup`}
|
|
108
|
+
?disabled=${this.disabled}
|
|
109
|
+
@click=${this.onToggleClick}
|
|
110
|
+
>
|
|
111
|
+
<svg
|
|
112
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
113
|
+
width="16"
|
|
114
|
+
height="16"
|
|
115
|
+
viewBox="0 0 256 256"
|
|
116
|
+
aria-hidden="true"
|
|
117
|
+
>
|
|
118
|
+
<path
|
|
119
|
+
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"
|
|
120
|
+
></path>
|
|
121
|
+
</svg>
|
|
122
|
+
</button>
|
|
123
|
+
|
|
124
|
+
${r}
|
|
125
|
+
</div>
|
|
126
|
+
|
|
127
|
+
${this.showErrors ? L(this.uid ?? "", { errors: this.errors, touched: this.touched }) : ""}
|
|
128
|
+
`;
|
|
129
|
+
}
|
|
130
|
+
onDateChange(e) {
|
|
131
|
+
e.stopPropagation(), this.commitValue(e.detail.value);
|
|
132
|
+
}
|
|
133
|
+
onDateBlur() {
|
|
134
|
+
this.dispatchEvent(new CustomEvent("blur"));
|
|
135
|
+
}
|
|
136
|
+
onCalendarChange(e) {
|
|
137
|
+
e.stopPropagation(), this.commitValue(e.detail.value), this._popup.close();
|
|
138
|
+
}
|
|
139
|
+
commitValue(e) {
|
|
140
|
+
this.value = e ?? void 0;
|
|
141
|
+
const r = this.validateBounds(this.value);
|
|
142
|
+
this.dispatchEvent(
|
|
143
|
+
new CustomEvent("change", {
|
|
144
|
+
detail: { value: e ?? null },
|
|
145
|
+
bubbles: !0,
|
|
146
|
+
composed: !0
|
|
147
|
+
})
|
|
148
|
+
), r && this.dispatchEvent(
|
|
149
|
+
new CustomEvent("inputError", {
|
|
150
|
+
detail: { message: r },
|
|
151
|
+
bubbles: !0,
|
|
152
|
+
composed: !0
|
|
153
|
+
})
|
|
154
|
+
);
|
|
155
|
+
}
|
|
156
|
+
validateBounds(e) {
|
|
157
|
+
return e ? f(e, this.minDate, this.maxDate, this.disabledRanges, {
|
|
158
|
+
minDateMessage: this.minDateMessage,
|
|
159
|
+
maxDateMessage: this.maxDateMessage,
|
|
160
|
+
disabledDateRangeMessage: this.disabledDateRangeMessage
|
|
161
|
+
}) : null;
|
|
162
|
+
}
|
|
163
|
+
onCalendarBlur() {
|
|
164
|
+
this._popup.closeOnFocusLeave();
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
i([
|
|
168
|
+
a({ type: String })
|
|
169
|
+
], t.prototype, "uid", 2);
|
|
170
|
+
i([
|
|
171
|
+
a({ type: String })
|
|
172
|
+
], t.prototype, "label", 2);
|
|
173
|
+
i([
|
|
174
|
+
a({ type: String })
|
|
175
|
+
], t.prototype, "hint", 2);
|
|
176
|
+
i([
|
|
177
|
+
a({ type: String })
|
|
178
|
+
], t.prototype, "icon", 2);
|
|
179
|
+
i([
|
|
180
|
+
a({ type: String, attribute: "toggle-aria-label" })
|
|
181
|
+
], t.prototype, "toggleAriaLabel", 2);
|
|
182
|
+
i([
|
|
183
|
+
a({ type: String })
|
|
184
|
+
], t.prototype, "dayAriaLabel", 2);
|
|
185
|
+
i([
|
|
186
|
+
a({ type: String })
|
|
187
|
+
], t.prototype, "monthAriaLabel", 2);
|
|
188
|
+
i([
|
|
189
|
+
a({ type: String })
|
|
190
|
+
], t.prototype, "yearAriaLabel", 2);
|
|
191
|
+
i([
|
|
192
|
+
a({ type: Array })
|
|
193
|
+
], t.prototype, "errors", 2);
|
|
194
|
+
i([
|
|
195
|
+
a({ type: Boolean })
|
|
196
|
+
], t.prototype, "showErrors", 2);
|
|
197
|
+
i([
|
|
198
|
+
a({ type: Boolean })
|
|
199
|
+
], t.prototype, "touched", 2);
|
|
200
|
+
i([
|
|
201
|
+
a({ type: Boolean })
|
|
202
|
+
], t.prototype, "required", 2);
|
|
203
|
+
i([
|
|
204
|
+
a({ type: Boolean })
|
|
205
|
+
], t.prototype, "disabled", 2);
|
|
206
|
+
i([
|
|
207
|
+
a({ type: Boolean, attribute: "readonly" })
|
|
208
|
+
], t.prototype, "readOnly", 2);
|
|
209
|
+
i([
|
|
210
|
+
a({ type: String, attribute: "locale-id" })
|
|
211
|
+
], t.prototype, "localeId", 2);
|
|
212
|
+
i([
|
|
213
|
+
a({ type: String })
|
|
214
|
+
], t.prototype, "value", 2);
|
|
215
|
+
i([
|
|
216
|
+
a({ type: String, attribute: "prev-month-icon" })
|
|
217
|
+
], t.prototype, "prevMonthIcon", 2);
|
|
218
|
+
i([
|
|
219
|
+
a({ type: String, attribute: "next-month-icon" })
|
|
220
|
+
], t.prototype, "nextMonthIcon", 2);
|
|
221
|
+
i([
|
|
222
|
+
a({ type: String, attribute: "prev-month-aria-label" })
|
|
223
|
+
], t.prototype, "prevMonthAriaLabel", 2);
|
|
224
|
+
i([
|
|
225
|
+
a({ type: String, attribute: "next-month-aria-label" })
|
|
226
|
+
], t.prototype, "nextMonthAriaLabel", 2);
|
|
227
|
+
i([
|
|
228
|
+
a({ type: String, attribute: "select-year-aria-label" })
|
|
229
|
+
], t.prototype, "selectYearAriaLabel", 2);
|
|
230
|
+
i([
|
|
231
|
+
a({ type: String, attribute: "year-grid-aria-label" })
|
|
232
|
+
], t.prototype, "yearGridAriaLabel", 2);
|
|
233
|
+
i([
|
|
234
|
+
a({ type: String, attribute: "day-format" })
|
|
235
|
+
], t.prototype, "dayFormat", 2);
|
|
236
|
+
i([
|
|
237
|
+
a({ type: String, attribute: "weekday-format" })
|
|
238
|
+
], t.prototype, "weekdayFormat", 2);
|
|
239
|
+
i([
|
|
240
|
+
a({ type: String, attribute: "month-format" })
|
|
241
|
+
], t.prototype, "monthFormat", 2);
|
|
242
|
+
i([
|
|
243
|
+
a({ type: String, attribute: "min-date" })
|
|
244
|
+
], t.prototype, "minDate", 2);
|
|
245
|
+
i([
|
|
246
|
+
a({ type: String, attribute: "max-date" })
|
|
247
|
+
], t.prototype, "maxDate", 2);
|
|
248
|
+
i([
|
|
249
|
+
a({ type: Array, attribute: "disabled-ranges" })
|
|
250
|
+
], t.prototype, "disabledRanges", 2);
|
|
251
|
+
i([
|
|
252
|
+
a({ type: Number, attribute: "number-of-months" })
|
|
253
|
+
], t.prototype, "numberOfMonths", 2);
|
|
254
|
+
i([
|
|
255
|
+
a({ type: String, attribute: "invalid-date-message" })
|
|
256
|
+
], t.prototype, "invalidDateMessage", 2);
|
|
257
|
+
i([
|
|
258
|
+
a({ type: String, attribute: "min-date-message" })
|
|
259
|
+
], t.prototype, "minDateMessage", 2);
|
|
260
|
+
i([
|
|
261
|
+
a({ type: String, attribute: "max-date-message" })
|
|
262
|
+
], t.prototype, "maxDateMessage", 2);
|
|
263
|
+
i([
|
|
264
|
+
a({ type: String, attribute: "disabled-date-range-message" })
|
|
265
|
+
], t.prototype, "disabledDateRangeMessage", 2);
|
|
266
|
+
t = i([
|
|
267
|
+
b("gui-date-picker")
|
|
268
|
+
], t);
|
|
269
|
+
typeof customElements < "u" && !customElements.get("gui-date-picker") && customElements.define("gui-date-picker", t);
|
|
270
|
+
var S = Object.defineProperty, I = Object.getOwnPropertyDescriptor, u = (e, r, n, s) => {
|
|
271
|
+
for (var o = s > 1 ? void 0 : s ? I(r, n) : r, l = e.length - 1, d; l >= 0; l--)
|
|
272
|
+
(d = e[l]) && (o = (s ? d(r, n, o) : d(o)) || o);
|
|
273
|
+
return s && o && S(r, n, o), o;
|
|
274
|
+
};
|
|
275
|
+
let p = class extends c {
|
|
276
|
+
constructor() {
|
|
277
|
+
super(...arguments), this.adapter = new g(), this.subscriptions = [];
|
|
278
|
+
}
|
|
279
|
+
createRenderRoot() {
|
|
280
|
+
return this;
|
|
281
|
+
}
|
|
282
|
+
updated(e) {
|
|
283
|
+
super.updated(e);
|
|
284
|
+
const r = this.adapter.templateData.size;
|
|
285
|
+
r ? this.style.flex = String(r) : this.style.removeProperty("flex");
|
|
286
|
+
}
|
|
287
|
+
connectedCallback() {
|
|
288
|
+
super.connectedCallback(), this.classList.add("gui-date-picker", "gui-field"), this.adapter.context = this.formContext, this.adapter.init(this.widget), this.subscriptions.push(
|
|
289
|
+
this.adapter.templateDataChanged$.subscribe(() => this.requestUpdate())
|
|
290
|
+
);
|
|
291
|
+
}
|
|
292
|
+
render() {
|
|
293
|
+
super.render();
|
|
294
|
+
const e = this.adapter.templateData;
|
|
295
|
+
return h`
|
|
296
|
+
<gui-date-picker
|
|
297
|
+
.uid=${this.widget.uid}
|
|
298
|
+
.label=${e.label}
|
|
299
|
+
.hint=${e.hint}
|
|
300
|
+
.errors=${e.errors}
|
|
301
|
+
?touched=${e.touched}
|
|
302
|
+
?required=${e.validator?.required}
|
|
303
|
+
?disabled=${e.disabled}
|
|
304
|
+
?readonly=${e.readonly}
|
|
305
|
+
.value=${e.value}
|
|
306
|
+
.icon=${e.icon}
|
|
307
|
+
.localeId=${e.lang}
|
|
308
|
+
.toggleAriaLabel=${e.toggleAriaLabel}
|
|
309
|
+
.dayAriaLabel=${e.dayAriaLabel}
|
|
310
|
+
.monthAriaLabel=${e.monthAriaLabel}
|
|
311
|
+
.yearAriaLabel=${e.yearAriaLabel}
|
|
312
|
+
.prevMonthIcon=${e.prevMonthIcon}
|
|
313
|
+
.nextMonthIcon=${e.nextMonthIcon}
|
|
314
|
+
.prevMonthAriaLabel=${e.prevMonthAriaLabel}
|
|
315
|
+
.nextMonthAriaLabel=${e.nextMonthAriaLabel}
|
|
316
|
+
.selectYearAriaLabel=${e.selectYearAriaLabel}
|
|
317
|
+
.yearGridAriaLabel=${e.yearGridAriaLabel}
|
|
318
|
+
.dayFormat=${e.dayFormat}
|
|
319
|
+
.weekdayFormat=${e.weekdayFormat}
|
|
320
|
+
.monthFormat=${e.monthFormat}
|
|
321
|
+
.minDate=${e.minDate}
|
|
322
|
+
.maxDate=${e.maxDate}
|
|
323
|
+
.disabledRanges=${e.disabledRanges}
|
|
324
|
+
.numberOfMonths=${e.numberOfMonths}
|
|
325
|
+
.invalidDateMessage=${e.invalidDateMessage}
|
|
326
|
+
.minDateMessage=${e.minDateMessage}
|
|
327
|
+
.maxDateMessage=${e.maxDateMessage}
|
|
328
|
+
.disabledDateRangeMessage=${e.disabledDateRangeMessage}
|
|
329
|
+
@inputError=${this.onInputError}
|
|
330
|
+
@blur=${() => this.adapter.onBlur()}
|
|
331
|
+
@change=${this.valueChanged}
|
|
332
|
+
></gui-date-picker>
|
|
333
|
+
`;
|
|
334
|
+
}
|
|
335
|
+
valueChanged(e) {
|
|
336
|
+
this.adapter.injectValidationIssues(null), this.adapter.valueChanged(e.detail.value);
|
|
337
|
+
}
|
|
338
|
+
onInputError(e) {
|
|
339
|
+
this.adapter.injectValidationIssues([e.detail.message]);
|
|
340
|
+
}
|
|
341
|
+
disconnectedCallback() {
|
|
342
|
+
super.disconnectedCallback(), this.adapter.destroy(), this.subscriptions.forEach((e) => e.unsubscribe());
|
|
343
|
+
}
|
|
344
|
+
};
|
|
345
|
+
u([
|
|
346
|
+
x({ context: m }),
|
|
347
|
+
a({ attribute: !1 })
|
|
348
|
+
], p.prototype, "formContext", 2);
|
|
349
|
+
u([
|
|
350
|
+
w({ context: y })
|
|
351
|
+
], p.prototype, "adapter", 2);
|
|
352
|
+
p = u([
|
|
353
|
+
b("gui-date-picker-input")
|
|
354
|
+
], p);
|
|
355
|
+
export {
|
|
356
|
+
p as DatePickerElement
|
|
357
|
+
};
|