monobill-mintui 0.2.3 → 0.2.5
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/dist/components/form/Form.d.ts.map +1 -1
- package/dist/index.cjs +6 -6
- package/dist/index.js +459 -450
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -32,13 +32,13 @@ class O extends HTMLElement {
|
|
|
32
32
|
return t[e] || t.default;
|
|
33
33
|
}
|
|
34
34
|
render() {
|
|
35
|
-
const e = this.getSize(), t = this.getAttribute("size") || "default", i = !!(this.style.width && this.style.height), s = this.getAttribute("data-button-variant"),
|
|
36
|
-
let
|
|
35
|
+
const e = this.getSize(), t = this.getAttribute("size") || "default", i = !!(this.style.width && this.style.height), s = this.getAttribute("data-button-variant"), n = document.documentElement.classList.contains("dark");
|
|
36
|
+
let r;
|
|
37
37
|
if (i) {
|
|
38
38
|
const h = this.getAttribute("data-button-tone") || "neutral";
|
|
39
|
-
s === "solid" ? h === "neutral" ?
|
|
39
|
+
s === "solid" ? h === "neutral" ? r = n ? "#ffffff" : "#0f172a" : r = "#ffffff" : r = n ? "#ffffff" : "#0f172a";
|
|
40
40
|
} else
|
|
41
|
-
|
|
41
|
+
r = n ? "#e2e8f0" : "#0f172a";
|
|
42
42
|
const a = t === "large" ? "2" : "4", l = !!(this.style.width && this.style.height), o = `
|
|
43
43
|
<svg
|
|
44
44
|
xmlns="http://www.w3.org/2000/svg"
|
|
@@ -51,7 +51,7 @@ class O extends HTMLElement {
|
|
|
51
51
|
cx="12"
|
|
52
52
|
cy="12"
|
|
53
53
|
r="10"
|
|
54
|
-
stroke="${
|
|
54
|
+
stroke="${r}"
|
|
55
55
|
stroke-width="${a}"
|
|
56
56
|
opacity="0.25"
|
|
57
57
|
class="opacity-25"
|
|
@@ -60,7 +60,7 @@ class O extends HTMLElement {
|
|
|
60
60
|
cx="12"
|
|
61
61
|
cy="12"
|
|
62
62
|
r="10"
|
|
63
|
-
stroke="${
|
|
63
|
+
stroke="${r}"
|
|
64
64
|
stroke-width="${a}"
|
|
65
65
|
stroke-linecap="round"
|
|
66
66
|
fill="none"
|
|
@@ -134,10 +134,10 @@ class B extends HTMLElement {
|
|
|
134
134
|
console.warn(`Icon "${e}" not found. Make sure you've imported the icon: import '@monobill-mintui/icon/icons/${e}'`), this.innerHTML = "", this.style.maskImage = "", this.style.webkitMaskImage = "";
|
|
135
135
|
return;
|
|
136
136
|
}
|
|
137
|
-
const i = this.closest("mint-button") || ((l = this.parentElement) == null ? void 0 : l.closest("mint-button")), s = this.closest("mint-switch") || ((o = this.parentElement) == null ? void 0 : o.closest("mint-switch")),
|
|
137
|
+
const i = this.closest("mint-button") || ((l = this.parentElement) == null ? void 0 : l.closest("mint-button")), s = this.closest("mint-switch") || ((o = this.parentElement) == null ? void 0 : o.closest("mint-switch")), n = this.closest("mint-select") || ((h = this.parentElement) == null ? void 0 : h.closest("mint-select"));
|
|
138
138
|
if (!Array.from(this.classList).some(
|
|
139
139
|
(c) => c.startsWith("w-") || c.startsWith("h-")
|
|
140
|
-
) && !
|
|
140
|
+
) && !n) {
|
|
141
141
|
let c;
|
|
142
142
|
s ? c = "w-3 h-3" : i ? c = "w-5 h-5" : c = "w-[1.3em] h-[1.3em]", this.classList.remove("w-4", "h-4", "w-5", "h-5", "w-[1em]", "h-[1em]", "w-[1.3em]", "h-[1.3em]", "w-3", "h-3"), c.split(" ").forEach((u) => {
|
|
143
143
|
u && this.classList.add(u);
|
|
@@ -211,13 +211,13 @@ class z extends HTMLElement {
|
|
|
211
211
|
return this.getAttribute("icon") || "";
|
|
212
212
|
}
|
|
213
213
|
isIconOnly() {
|
|
214
|
-
var i, s,
|
|
214
|
+
var i, s, n, r, a;
|
|
215
215
|
if (!(this.getIcon() || ((i = this._button) == null ? void 0 : i.querySelector('[slot="icon"], .mint-button-icon, mint-icon')))) return !1;
|
|
216
216
|
const t = (s = this._button) == null ? void 0 : s.querySelector(".mint-button-content");
|
|
217
|
-
if (t && ((
|
|
217
|
+
if (t && ((n = t.textContent) != null && n.trim())) return !1;
|
|
218
218
|
if (this._button)
|
|
219
219
|
for (let l = this._button.firstChild; l; l = l.nextSibling) {
|
|
220
|
-
if (l.nodeType === Node.TEXT_NODE && ((
|
|
220
|
+
if (l.nodeType === Node.TEXT_NODE && ((r = l.textContent) != null && r.trim()))
|
|
221
221
|
return !1;
|
|
222
222
|
if (l.nodeType === Node.ELEMENT_NODE) {
|
|
223
223
|
const o = l;
|
|
@@ -251,7 +251,7 @@ class z extends HTMLElement {
|
|
|
251
251
|
"[&>*]:duration-100",
|
|
252
252
|
"disabled:opacity-50",
|
|
253
253
|
"disabled:cursor-not-allowed"
|
|
254
|
-
], s = this.getTone(),
|
|
254
|
+
], s = this.getTone(), n = {
|
|
255
255
|
"solid-action": [
|
|
256
256
|
"bg-slate-800",
|
|
257
257
|
"dark:bg-slate-600",
|
|
@@ -536,7 +536,7 @@ class z extends HTMLElement {
|
|
|
536
536
|
"border-transparent"
|
|
537
537
|
// Match other button border width
|
|
538
538
|
]
|
|
539
|
-
},
|
|
539
|
+
}, r = `${t}-${s}`, a = n[r] || n["solid-neutral"], l = [
|
|
540
540
|
...i,
|
|
541
541
|
...a
|
|
542
542
|
];
|
|
@@ -565,20 +565,20 @@ class z extends HTMLElement {
|
|
|
565
565
|
for (; this.firstChild && this.firstChild !== this._button; )
|
|
566
566
|
this._button.appendChild(this.firstChild);
|
|
567
567
|
const s = this.getIcon();
|
|
568
|
-
let
|
|
569
|
-
s ? (
|
|
570
|
-
const
|
|
568
|
+
let n = this._button.querySelector('[slot="icon"], .mint-button-icon, mint-icon');
|
|
569
|
+
s ? (n && n.tagName !== "MINT-ICON" && (n.remove(), n = null), !n || n.tagName !== "MINT-ICON" ? (n = document.createElement("mint-icon"), n.setAttribute("name", s), n.className = "mint-button-icon") : n.setAttribute("name", s)) : n && n.tagName === "MINT-ICON" && (n.remove(), n = null), n || (n = this._button.querySelector('[slot="icon"], .mint-button-icon'));
|
|
570
|
+
const r = this.getIconPosition();
|
|
571
571
|
let a = this._button.querySelector(".mint-button-content");
|
|
572
572
|
if (a) {
|
|
573
|
-
const p =
|
|
574
|
-
if (
|
|
573
|
+
const p = n && n.tagName === "MINT-ICON";
|
|
574
|
+
if (n && !n.parentElement) {
|
|
575
575
|
const m = (d = this._button.querySelector("mint-spinner")) == null ? void 0 : d.parentElement;
|
|
576
|
-
p ||
|
|
577
|
-
} else if (
|
|
578
|
-
|
|
576
|
+
p || r === "left" ? m ? m.insertAdjacentElement("afterend", n) : this._button.insertBefore(n, a) : a.insertAdjacentElement("afterend", n);
|
|
577
|
+
} else if (n && (p || r === "left") && n.nextSibling !== a) {
|
|
578
|
+
n.remove();
|
|
579
579
|
const m = (f = this._button.querySelector("mint-spinner")) == null ? void 0 : f.parentElement;
|
|
580
|
-
m ? m.insertAdjacentElement("afterend",
|
|
581
|
-
} else
|
|
580
|
+
m ? m.insertAdjacentElement("afterend", n) : this._button.insertBefore(n, a);
|
|
581
|
+
} else n && !p && r === "right" && n.previousSibling !== a && (n.remove(), a.insertAdjacentElement("afterend", n));
|
|
582
582
|
} else {
|
|
583
583
|
const p = [];
|
|
584
584
|
for (let m = this._button.firstChild; m; m = m.nextSibling) {
|
|
@@ -587,21 +587,21 @@ class z extends HTMLElement {
|
|
|
587
587
|
continue;
|
|
588
588
|
}
|
|
589
589
|
const k = m;
|
|
590
|
-
k.tagName !== "MINT-SPINNER" && !k.querySelector("mint-spinner") && m !==
|
|
590
|
+
k.tagName !== "MINT-SPINNER" && !k.querySelector("mint-spinner") && m !== n && !k.hasAttribute("slot") && !(k.className === "mr-2" && k.querySelector("mint-spinner")) && p.push(m);
|
|
591
591
|
}
|
|
592
592
|
if (p.length > 0) {
|
|
593
593
|
a = document.createElement("span"), a.className = "mint-button-content inline-flex items-center", p.forEach((k) => {
|
|
594
594
|
a.appendChild(k);
|
|
595
595
|
});
|
|
596
596
|
const m = (c = this._button.querySelector("mint-spinner")) == null ? void 0 : c.parentElement;
|
|
597
|
-
|
|
598
|
-
} else if (
|
|
597
|
+
n && r === "left" ? m ? (m.insertAdjacentElement("afterend", n), n.insertAdjacentElement("afterend", a)) : (this._button.insertBefore(n, this._button.firstChild), n.insertAdjacentElement("afterend", a)) : n && r === "right" ? m ? (m.insertAdjacentElement("afterend", a), a.insertAdjacentElement("afterend", n)) : (this._button.insertBefore(a, this._button.firstChild), a.insertAdjacentElement("afterend", n)) : m ? m.insertAdjacentElement("afterend", a) : this._button.insertBefore(a, this._button.firstChild);
|
|
598
|
+
} else if (n && n.tagName === "MINT-ICON" && !n.parentElement) {
|
|
599
599
|
const m = (u = this._button.querySelector("mint-spinner")) == null ? void 0 : u.parentElement;
|
|
600
|
-
m ? m.insertAdjacentElement("afterend",
|
|
600
|
+
m ? m.insertAdjacentElement("afterend", n) : this._button.insertBefore(n, this._button.firstChild);
|
|
601
601
|
}
|
|
602
602
|
}
|
|
603
603
|
const l = this.isIconOnly();
|
|
604
|
-
|
|
604
|
+
n && (n.classList.contains("mint-button-icon") || n.classList.add("mint-button-icon"), n.classList.remove("mr-1.5", "ml-1.5"), l ? n.tagName === "MINT-ICON" ? (n.style.width = "1rem", n.style.height = "1rem", n.style.maxWidth = "1rem", n.style.maxHeight = "1rem", n.style.flexShrink = "0") : (n.style.maxWidth = "1rem", n.style.maxHeight = "1rem", n.style.flexShrink = "0", n.tagName === "svg" && (n.style.width = "1rem", n.style.height = "1rem")) : r === "left" ? n.classList.add("mr-1.5") : n.classList.add("ml-1.5"));
|
|
605
605
|
const o = this.getButtonClasses();
|
|
606
606
|
this._button.className = o;
|
|
607
607
|
}
|
|
@@ -771,7 +771,7 @@ class W extends HTMLElement {
|
|
|
771
771
|
].join(" ");
|
|
772
772
|
}
|
|
773
773
|
render() {
|
|
774
|
-
const e = this.isLoading(), t = this.getSwitchClasses(), i = this.getThumbClasses(), s = this.getLabel(),
|
|
774
|
+
const e = this.isLoading(), t = this.getSwitchClasses(), i = this.getThumbClasses(), s = this.getLabel(), n = this.getInfo(), r = this.getIcon(), a = this.getAttribute("id") || `mint-switch-${Math.random().toString(36).substr(2, 9)}`;
|
|
775
775
|
this.getAttribute("id") || this.setAttribute("id", a);
|
|
776
776
|
const l = this._getSwitchContainer();
|
|
777
777
|
this._button ? this._button.parentElement !== l && l.appendChild(this._button) : (this._button = document.createElement("button"), l.appendChild(this._button), this.setupEventListeners());
|
|
@@ -780,14 +780,14 @@ class W extends HTMLElement {
|
|
|
780
780
|
let h = this._button.querySelector("span");
|
|
781
781
|
h || (h = document.createElement("span"), this._button.appendChild(h)), h.className = i;
|
|
782
782
|
const c = h.querySelector("span");
|
|
783
|
-
if (
|
|
783
|
+
if (r) {
|
|
784
784
|
let d = c;
|
|
785
785
|
d || (d = document.createElement("span"), d.className = this.getIconClasses(), h.appendChild(d));
|
|
786
786
|
let f = d.querySelector("mint-icon");
|
|
787
|
-
f || (f = document.createElement("mint-icon"), d.appendChild(f)), f.setAttribute("name",
|
|
787
|
+
f || (f = document.createElement("mint-icon"), d.appendChild(f)), f.setAttribute("name", r);
|
|
788
788
|
} else c && c.remove();
|
|
789
789
|
let u = this.querySelector(".mint-switch-info");
|
|
790
|
-
|
|
790
|
+
n ? (u || (u = document.createElement("span"), u.className = "mint-switch-info text-xs text-gray-500 dark:text-gray-400 select-none mt-1 block", l && l.parentElement === this ? this.insertBefore(u, l.nextSibling) : this.appendChild(u)), u.textContent = n, this.isDisabled() ? u.classList.add("opacity-40") : u.classList.remove("opacity-40")) : u && u.remove(), this._renderErrorState(), this._renderSkeleton(e);
|
|
791
791
|
}
|
|
792
792
|
setupEventListeners() {
|
|
793
793
|
this._button && this._button.addEventListener("click", this.handleToggle.bind(this));
|
|
@@ -812,27 +812,27 @@ class W extends HTMLElement {
|
|
|
812
812
|
}
|
|
813
813
|
_renderSkeleton(e) {
|
|
814
814
|
const t = this._getSwitchContainer(), i = this.getLabel(), s = this.getInfo();
|
|
815
|
-
let
|
|
815
|
+
let n = t.querySelector(".mint-switch-skeleton-container"), r = this.querySelector(".mint-switch-info-skeleton");
|
|
816
816
|
if (e) {
|
|
817
|
-
t.classList.contains("relative") || t.classList.add("relative"),
|
|
818
|
-
let a =
|
|
819
|
-
if (a || (a = document.createElement("div"), a.className = "mint-switch-skeleton-box flex-shrink-0 w-10 h-5 rounded-full bg-gray-200 dark:bg-gray-700 animate-pulse",
|
|
820
|
-
let o =
|
|
821
|
-
o || (o = document.createElement("div"), o.className = "mint-switch-skeleton-label h-4 w-24 rounded bg-gray-200 dark:bg-gray-700 animate-pulse",
|
|
817
|
+
t.classList.contains("relative") || t.classList.add("relative"), n || (n = document.createElement("div"), n.className = "mint-switch-skeleton-container absolute inset-0 z-10 pointer-events-none flex items-center gap-2", t.appendChild(n));
|
|
818
|
+
let a = n.querySelector(".mint-switch-skeleton-box");
|
|
819
|
+
if (a || (a = document.createElement("div"), a.className = "mint-switch-skeleton-box flex-shrink-0 w-10 h-5 rounded-full bg-gray-200 dark:bg-gray-700 animate-pulse", n.appendChild(a)), i) {
|
|
820
|
+
let o = n.querySelector(".mint-switch-skeleton-label");
|
|
821
|
+
o || (o = document.createElement("div"), o.className = "mint-switch-skeleton-label h-4 w-24 rounded bg-gray-200 dark:bg-gray-700 animate-pulse", n.appendChild(o));
|
|
822
822
|
} else {
|
|
823
|
-
const o =
|
|
823
|
+
const o = n.querySelector(".mint-switch-skeleton-label");
|
|
824
824
|
o && o.remove();
|
|
825
825
|
}
|
|
826
|
-
|
|
826
|
+
n.style.display = "flex", this._button && (this._button.style.visibility = "hidden", this._button.style.pointerEvents = "none");
|
|
827
827
|
const l = t.querySelector(".mint-switch-label");
|
|
828
828
|
if (l && (l.style.visibility = "hidden", l.style.pointerEvents = "none"), s) {
|
|
829
|
-
|
|
829
|
+
r || (r = document.createElement("div"), r.className = "mint-switch-info-skeleton h-3 w-32 rounded bg-gray-200 dark:bg-gray-700 animate-pulse mt-2", t && t.parentElement === this ? this.insertBefore(r, t.nextSibling) : this.appendChild(r)), r.style.display = "block";
|
|
830
830
|
const o = this.querySelector(".mint-switch-info");
|
|
831
831
|
o && (o.style.display = "none");
|
|
832
832
|
} else
|
|
833
|
-
|
|
833
|
+
r && (r.style.display = "none");
|
|
834
834
|
} else {
|
|
835
|
-
|
|
835
|
+
n && (n.style.display = "none"), r && (r.style.display = "none"), this._button && (this._button.style.visibility = "visible", this._button.style.pointerEvents = "auto");
|
|
836
836
|
const a = t.querySelector(".mint-switch-label");
|
|
837
837
|
a && (a.style.visibility = "visible", a.style.pointerEvents = "auto");
|
|
838
838
|
const l = this.querySelector(".mint-switch-info");
|
|
@@ -906,19 +906,19 @@ class V extends HTMLElement {
|
|
|
906
906
|
regular: [
|
|
907
907
|
// No default margin for regular text
|
|
908
908
|
]
|
|
909
|
-
},
|
|
909
|
+
}, n = {
|
|
910
910
|
default: i ? ["text-gray-100"] : ["text-gray-900"],
|
|
911
911
|
muted: i ? ["text-gray-400"] : ["text-gray-400"],
|
|
912
912
|
danger: i ? ["text-red-400"] : ["text-red-600"],
|
|
913
913
|
success: i ? ["text-green-400"] : ["text-green-600"]
|
|
914
|
-
},
|
|
915
|
-
this.isBold() &&
|
|
914
|
+
}, r = [];
|
|
915
|
+
this.isBold() && r.push("font-bold"), this.isUnderline() && r.push("underline"), this.isStrike() && r.push("line-through"), this.isItalic() && r.push("italic");
|
|
916
916
|
const a = this.getDisplay();
|
|
917
917
|
return [
|
|
918
918
|
a === "block" ? "block" : a === "inline" ? "inline" : "inline-block",
|
|
919
919
|
...s[e] || s.regular,
|
|
920
|
-
...
|
|
921
|
-
...
|
|
920
|
+
...n[t] || n.default,
|
|
921
|
+
...r
|
|
922
922
|
].join(" ");
|
|
923
923
|
}
|
|
924
924
|
render() {
|
|
@@ -943,8 +943,8 @@ class V extends HTMLElement {
|
|
|
943
943
|
Array.from(this.classList).forEach((o) => {
|
|
944
944
|
!t.includes(o) && !i.includes(o) && this._userClasses.add(o);
|
|
945
945
|
});
|
|
946
|
-
const
|
|
947
|
-
this.className =
|
|
946
|
+
const r = [.../* @__PURE__ */ new Set([...s, ...Array.from(this._userClasses)])];
|
|
947
|
+
this.className = r.join(" ");
|
|
948
948
|
const a = {
|
|
949
949
|
heading: "clamp(1.25rem, 2.5vw + 0.5rem, 1.5rem)",
|
|
950
950
|
// Scales between 1.25rem (20px) and 1.5rem (24px)
|
|
@@ -1029,10 +1029,10 @@ class R extends HTMLElement {
|
|
|
1029
1029
|
"[&>mint-button>button]:!justify-start",
|
|
1030
1030
|
"[&>mint-button>button]:!justify-center",
|
|
1031
1031
|
"[&>mint-button>button]:!justify-end"
|
|
1032
|
-
].forEach((
|
|
1033
|
-
|
|
1034
|
-
}), ["box-border", "m-0", "p-0", "border-0", "align-baseline", "block"].forEach((
|
|
1035
|
-
this.classList.contains(
|
|
1032
|
+
].forEach((n) => this.classList.remove(n)), e.split(" ").forEach((n) => {
|
|
1033
|
+
n && this.classList.add(n);
|
|
1034
|
+
}), ["box-border", "m-0", "p-0", "border-0", "align-baseline", "block"].forEach((n) => {
|
|
1035
|
+
this.classList.contains(n) || this.classList.add(n);
|
|
1036
1036
|
}), t ? this._applyTextAlignToChildren(t) : this._removeTextAlignFromChildren();
|
|
1037
1037
|
}
|
|
1038
1038
|
_applyTextAlignToChildren(e) {
|
|
@@ -1041,8 +1041,8 @@ class R extends HTMLElement {
|
|
|
1041
1041
|
const s = i.querySelector("button");
|
|
1042
1042
|
if (s) {
|
|
1043
1043
|
s.classList.remove("justify-start", "justify-center", "justify-end"), e === "left" ? s.classList.add("justify-start") : e === "right" ? s.classList.add("justify-end") : e === "center" && s.classList.add("justify-center");
|
|
1044
|
-
const
|
|
1045
|
-
|
|
1044
|
+
const n = s.querySelector(".mint-button-content");
|
|
1045
|
+
n && (n.classList.remove("text-left", "text-center", "text-right", "text-justify"), n.classList.add(`text-${e}`));
|
|
1046
1046
|
}
|
|
1047
1047
|
} else
|
|
1048
1048
|
i.classList.remove("text-left", "text-center", "text-right", "text-justify"), i.classList.add(`text-${e}`);
|
|
@@ -1202,7 +1202,7 @@ class Y extends HTMLElement {
|
|
|
1202
1202
|
} catch {
|
|
1203
1203
|
return !1;
|
|
1204
1204
|
}
|
|
1205
|
-
})(),
|
|
1205
|
+
})(), n = new CustomEvent("back", {
|
|
1206
1206
|
detail: {
|
|
1207
1207
|
url: t,
|
|
1208
1208
|
isFromReferrer: s,
|
|
@@ -1213,7 +1213,7 @@ class Y extends HTMLElement {
|
|
|
1213
1213
|
cancelable: !0,
|
|
1214
1214
|
composed: !0
|
|
1215
1215
|
});
|
|
1216
|
-
this.dispatchEvent(
|
|
1216
|
+
this.dispatchEvent(n);
|
|
1217
1217
|
}
|
|
1218
1218
|
render() {
|
|
1219
1219
|
this._button || (this._button = document.createElement("mint-button"), this._button.setAttribute("variant", "neutral"), this._button.setAttribute("icon", "arrow-left"), this._button.addEventListener("click", (e) => this.handleClick(e)), this.appendChild(this._button));
|
|
@@ -1251,15 +1251,15 @@ class U extends HTMLElement {
|
|
|
1251
1251
|
let t = this._titleElement.querySelector("mint-back-button");
|
|
1252
1252
|
if (this.shouldShowBackButton()) {
|
|
1253
1253
|
t || (t = document.createElement("mint-back-button"), this._titleElement.insertBefore(t, this._titleElement.firstChild));
|
|
1254
|
-
const
|
|
1255
|
-
t.setAttribute("fallback-href",
|
|
1254
|
+
const r = this.getFallbackHref();
|
|
1255
|
+
t.setAttribute("fallback-href", r), this._backButton = t;
|
|
1256
1256
|
} else t && (t.remove(), t = null, this._backButton = null);
|
|
1257
1257
|
e ? (this._headingText ? (this._headingText.classList.add("truncate", "min-w-0"), t && t.parentElement === this._titleElement ? this._headingText.previousSibling !== t && this._titleElement.insertBefore(this._headingText, t.nextSibling) : this._headingText.previousSibling && this._titleElement.insertBefore(this._headingText, this._titleElement.firstChild)) : (this._headingText = document.createElement("mint-text"), this._headingText.setAttribute("size", "heading"), this._headingText.setAttribute("bold", ""), this._headingText.classList.add("truncate", "min-w-0"), t && t.parentElement === this._titleElement ? this._titleElement.insertBefore(this._headingText, t.nextSibling) : this._titleElement.insertBefore(this._headingText, this._titleElement.firstChild)), this._headingText.textContent = e) : this._headingText && (this._headingText.remove(), this._headingText = null), this._actionsSlot ? this._actionsSlot.classList.contains("ml-4") || this._actionsSlot.classList.add("ml-4") : (this._actionsSlot = document.createElement("div"), this._actionsSlot.className = "flex gap-2 items-center ml-4", this._actionsSlot.setAttribute("slot", "actions"), this._header.appendChild(this._actionsSlot)), Array.from(this.children).filter(
|
|
1258
|
-
(
|
|
1259
|
-
).forEach((
|
|
1260
|
-
this._actionsSlot &&
|
|
1261
|
-
}), this._bodySlot || (this._bodySlot = document.createElement("div"), this._pageContainer.appendChild(this._bodySlot)), Array.from(this.children).forEach((
|
|
1262
|
-
|
|
1258
|
+
(r) => r !== this._pageContainer && r !== this._actionsSlot && r.getAttribute("slot") === "actions"
|
|
1259
|
+
).forEach((r) => {
|
|
1260
|
+
this._actionsSlot && r.parentElement !== this._actionsSlot && this._actionsSlot.appendChild(r);
|
|
1261
|
+
}), this._bodySlot || (this._bodySlot = document.createElement("div"), this._pageContainer.appendChild(this._bodySlot)), Array.from(this.children).forEach((r) => {
|
|
1262
|
+
r !== this._pageContainer && r.getAttribute("slot") !== "actions" && r !== this._actionsSlot && r !== this._header && r !== this._bodySlot && r !== this._headingText && r.parentElement !== this._bodySlot && r.parentElement !== this._pageContainer && this._bodySlot.appendChild(r);
|
|
1263
1263
|
}), this._updateBackgroundColor();
|
|
1264
1264
|
}
|
|
1265
1265
|
_applyContainerClasses() {
|
|
@@ -1335,10 +1335,10 @@ class G extends HTMLElement {
|
|
|
1335
1335
|
i && e.push(`sm:grid-cols-${i}`);
|
|
1336
1336
|
const s = this.getMd();
|
|
1337
1337
|
s && e.push(`md:grid-cols-${s}`);
|
|
1338
|
-
const
|
|
1339
|
-
|
|
1340
|
-
const
|
|
1341
|
-
|
|
1338
|
+
const n = this.getLg();
|
|
1339
|
+
n && e.push(`lg:grid-cols-${n}`);
|
|
1340
|
+
const r = this.getXl();
|
|
1341
|
+
r && e.push(`xl:grid-cols-${r}`);
|
|
1342
1342
|
const a = this.getGap();
|
|
1343
1343
|
return e.push(`gap-${a}`), e;
|
|
1344
1344
|
}
|
|
@@ -1391,8 +1391,8 @@ class J extends HTMLElement {
|
|
|
1391
1391
|
this._animateExit();
|
|
1392
1392
|
let s = this._modal.querySelector(".modal-content");
|
|
1393
1393
|
s || (s = document.createElement("div"), s.className = "modal-content bg-white dark:bg-gray-800 rounded-lg shadow-xl max-w-2xl w-full max-h-[90vh] flex flex-col pointer-events-auto transition-all duration-200 ease-out transform", this._modal.appendChild(s)), this._header || (this._header = document.createElement("div"), this._header.className = "flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-700", s.appendChild(this._header)), this._headingSlot || (this._headingSlot = document.createElement("div"), this._headingSlot.className = "flex-1", this._headingSlot.setAttribute("slot", "heading"), this._header.appendChild(this._headingSlot));
|
|
1394
|
-
let
|
|
1395
|
-
t ? (
|
|
1394
|
+
let n = this._headingSlot.querySelector("mint-text");
|
|
1395
|
+
t ? (n || (n = document.createElement("mint-text"), n.setAttribute("size", "sub-heading"), n.setAttribute("bold", ""), this._headingSlot.appendChild(n)), n.textContent = t) : n && n.remove(), Array.from(this.children).filter(
|
|
1396
1396
|
(c) => c !== this._overlay && c !== this._modal && c !== this._headingSlot && c.getAttribute("slot") === "heading"
|
|
1397
1397
|
).forEach((c) => {
|
|
1398
1398
|
this._headingSlot && c.parentElement !== this._headingSlot && this._headingSlot.appendChild(c);
|
|
@@ -1558,36 +1558,36 @@ class X extends HTMLElement {
|
|
|
1558
1558
|
const e = this._triggerElement.getBoundingClientRect(), t = this._popover.querySelector(".popover-content");
|
|
1559
1559
|
if (!t) return { top: 0, left: 0, direction: "down" };
|
|
1560
1560
|
this.classList.contains("hidden") && (this.classList.remove("hidden"), this._popover.style.visibility = "hidden");
|
|
1561
|
-
const s = t.getBoundingClientRect(),
|
|
1561
|
+
const s = t.getBoundingClientRect(), n = window.innerWidth, r = window.innerHeight, a = 8;
|
|
1562
1562
|
let l = this.getDirection(), o = 0, h = 0;
|
|
1563
1563
|
switch (l) {
|
|
1564
1564
|
case "down":
|
|
1565
|
-
if (o = e.bottom + a, h = e.left + e.width / 2 - s.width / 2, o + s.height >
|
|
1565
|
+
if (o = e.bottom + a, h = e.left + e.width / 2 - s.width / 2, o + s.height > r) {
|
|
1566
1566
|
const c = e.top - s.height - a;
|
|
1567
|
-
c >= 0 ? (l = "up", o = c) : (o = Math.max(0,
|
|
1567
|
+
c >= 0 ? (l = "up", o = c) : (o = Math.max(0, r - s.height - a), o + s.height > r && (o = 0));
|
|
1568
1568
|
}
|
|
1569
|
-
h < 0 && (h = a), h + s.width >
|
|
1569
|
+
h < 0 && (h = a), h + s.width > n && (h = Math.max(a, n - s.width - a), h + s.width > n && (h = n - s.width));
|
|
1570
1570
|
break;
|
|
1571
1571
|
case "up":
|
|
1572
1572
|
if (o = e.top - s.height - a, h = e.left + e.width / 2 - s.width / 2, o < 0) {
|
|
1573
1573
|
const c = e.bottom + a;
|
|
1574
|
-
c + s.height <=
|
|
1574
|
+
c + s.height <= r ? (l = "down", o = c) : (o = Math.min(r - s.height - a, r - s.height), o < 0 && (o = r - s.height));
|
|
1575
1575
|
}
|
|
1576
|
-
h < 0 && (h = a), h + s.width >
|
|
1576
|
+
h < 0 && (h = a), h + s.width > n && (h = Math.max(a, n - s.width - a), h + s.width > n && (h = n - s.width));
|
|
1577
1577
|
break;
|
|
1578
1578
|
case "right":
|
|
1579
|
-
if (o = e.top + e.height / 2 - s.height / 2, h = e.right + a, h + s.width >
|
|
1579
|
+
if (o = e.top + e.height / 2 - s.height / 2, h = e.right + a, h + s.width > n) {
|
|
1580
1580
|
const c = e.left - s.width - a;
|
|
1581
|
-
c >= 0 ? (l = "left", h = c) : (h = Math.max(0,
|
|
1581
|
+
c >= 0 ? (l = "left", h = c) : (h = Math.max(0, n - s.width - a), h + s.width > n && (h = n - s.width));
|
|
1582
1582
|
}
|
|
1583
|
-
o < 0 && (o = a), o + s.height >
|
|
1583
|
+
o < 0 && (o = a), o + s.height > r && (o = Math.max(a, r - s.height - a), o + s.height > r && (o = r - s.height));
|
|
1584
1584
|
break;
|
|
1585
1585
|
case "left":
|
|
1586
1586
|
if (o = e.top + e.height / 2 - s.height / 2, h = e.left - s.width - a, h < 0) {
|
|
1587
1587
|
const c = e.right + a;
|
|
1588
|
-
c + s.width <=
|
|
1588
|
+
c + s.width <= n ? (l = "right", h = c) : (h = Math.min(n - s.width - a, n - s.width), h < 0 && (h = 0));
|
|
1589
1589
|
}
|
|
1590
|
-
o < 0 && (o = a), o + s.height >
|
|
1590
|
+
o < 0 && (o = a), o + s.height > r && (o = Math.max(a, r - s.height - a), o + s.height > r && (o = r - s.height));
|
|
1591
1591
|
break;
|
|
1592
1592
|
}
|
|
1593
1593
|
return { top: o, left: h, direction: l };
|
|
@@ -1596,11 +1596,11 @@ class X extends HTMLElement {
|
|
|
1596
1596
|
const e = this.getId(), t = this.isOpen(), i = this.getPadding();
|
|
1597
1597
|
if (e && (this.id = e), t) {
|
|
1598
1598
|
if (this.classList.remove("hidden"), this.style.pointerEvents = "auto", !this._clickOutsideHandler) {
|
|
1599
|
-
const
|
|
1599
|
+
const r = this;
|
|
1600
1600
|
this._clickOutsideHandler = function(a) {
|
|
1601
|
-
const l = a.composedPath(), o = l.includes(
|
|
1602
|
-
if (!(
|
|
1603
|
-
|
|
1601
|
+
const l = a.composedPath(), o = l.includes(r);
|
|
1602
|
+
if (!(r._triggerElement && l.includes(r._triggerElement)) && !o) {
|
|
1603
|
+
r.close();
|
|
1604
1604
|
return;
|
|
1605
1605
|
}
|
|
1606
1606
|
}, setTimeout(() => {
|
|
@@ -1614,11 +1614,11 @@ class X extends HTMLElement {
|
|
|
1614
1614
|
if (!s)
|
|
1615
1615
|
s = document.createElement("div"), s.className = `popover-content bg-white dark:bg-gray-800 rounded-lg shadow-xl ${i} transition-all duration-200 ease-out transform`, this._popover.appendChild(s);
|
|
1616
1616
|
else {
|
|
1617
|
-
const
|
|
1617
|
+
const r = s.className.split(" "), a = ["p-0", "p-0.5", "p-1", "p-1.5", "p-2", "p-2.5", "p-3", "p-3.5", "p-4", "p-5", "p-6", "p-8", "p-10", "p-12", "p-16", "p-20", "p-24"], l = r.filter((o) => !a.includes(o));
|
|
1618
1618
|
s.className = [...l, i].join(" ");
|
|
1619
1619
|
}
|
|
1620
|
-
Array.from(this.children).forEach((
|
|
1621
|
-
|
|
1620
|
+
Array.from(this.children).forEach((r) => {
|
|
1621
|
+
r !== this._overlay && r !== this._popover && r.parentElement === this && s.appendChild(r);
|
|
1622
1622
|
}), t ? (this._triggerElement || this._setupTrigger(), this._setupPositionListeners(), this.offsetHeight, this._triggerElement ? this._updatePosition(s) : (this._popover.style.top = "50%", this._popover.style.left = "50%", this._popover.style.transform = "translate(-50%, -50%)", this._popover.style.visibility = "visible", this._popover.style.display = "block", s.style.transform = "scale(0.97) translateY(10px)", s.style.opacity = "0", s.style.transition = "all 200ms ease-out", requestAnimationFrame(() => {
|
|
1623
1623
|
requestAnimationFrame(() => {
|
|
1624
1624
|
s.style.transform = "scale(1) translateY(0)", s.style.opacity = "1";
|
|
@@ -1782,18 +1782,18 @@ class K extends HTMLElement {
|
|
|
1782
1782
|
}
|
|
1783
1783
|
render() {
|
|
1784
1784
|
const e = this.isLoading(), t = this.getLabel(), i = this.getInfo(), s = this.isDisabled();
|
|
1785
|
-
let
|
|
1786
|
-
|
|
1787
|
-
let
|
|
1788
|
-
|
|
1785
|
+
let n = this.querySelector(".mint-checkbox-container");
|
|
1786
|
+
n || (n = document.createElement("div"), n.className = "mint-checkbox-container relative inline-flex items-start gap-2", this.insertBefore(n, this.firstChild));
|
|
1787
|
+
let r = this.querySelector(".mint-checkbox-wrapper");
|
|
1788
|
+
r ? r.parentElement !== n && n.appendChild(r) : (r = document.createElement("div"), r.className = "mint-checkbox-wrapper", n.appendChild(r)), this._checkbox ? this._checkbox.parentElement !== r && r.appendChild(this._checkbox) : (this._checkbox = document.createElement("input"), this._checkbox.type = "checkbox", r.appendChild(this._checkbox), this.setupEventListeners()), this._checkbox.className = "absolute inset-0 w-full h-full opacity-0 cursor-pointer", this._checkbox.style.cssText = "position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; z-index: 10; pointer-events: auto; margin: 0; padding: 0;", this._checkbox.checked = this._checked, this._checkbox.disabled = s, this._changeHandler || this.setupEventListeners();
|
|
1789
1789
|
const a = this.getId();
|
|
1790
1790
|
a ? this._checkbox.id = a : this._checkbox.removeAttribute("id");
|
|
1791
1791
|
const l = this.getName();
|
|
1792
1792
|
l ? this._checkbox.name = l : this._checkbox.removeAttribute("name");
|
|
1793
1793
|
const o = this.getValue();
|
|
1794
|
-
o ? this._checkbox.value = o : this._checkbox.removeAttribute("value"), t ? this._checkbox.setAttribute("aria-label", t) : this._checkbox.removeAttribute("aria-label"),
|
|
1795
|
-
let h =
|
|
1796
|
-
h || (h = document.createElement("mint-icon"), h.setAttribute("name", "check"), h.className = "w-3.5 h-3.5 text-white pointer-events-none absolute inset-0 m-auto", h.style.transition = "opacity 200ms ease-out, transform 200ms ease-out", h.style.zIndex = "1",
|
|
1794
|
+
o ? this._checkbox.value = o : this._checkbox.removeAttribute("value"), t ? this._checkbox.setAttribute("aria-label", t) : this._checkbox.removeAttribute("aria-label"), r.className = `mint-checkbox-wrapper ${this.getCheckboxClasses()}`, r.style.pointerEvents = "none", this._checkbox.style.pointerEvents = "auto";
|
|
1795
|
+
let h = r.querySelector("mint-icon");
|
|
1796
|
+
h || (h = document.createElement("mint-icon"), h.setAttribute("name", "check"), h.className = "w-3.5 h-3.5 text-white pointer-events-none absolute inset-0 m-auto", h.style.transition = "opacity 200ms ease-out, transform 200ms ease-out", h.style.zIndex = "1", r.appendChild(h)), this.updateVisualState();
|
|
1797
1797
|
let c = this.querySelector(".mint-checkbox-label-container");
|
|
1798
1798
|
const u = this.querySelector(".mint-checkbox-container");
|
|
1799
1799
|
if (t || i) {
|
|
@@ -1871,17 +1871,17 @@ class K extends HTMLElement {
|
|
|
1871
1871
|
}
|
|
1872
1872
|
_renderSkeleton(e) {
|
|
1873
1873
|
let t = this.querySelector(".mint-checkbox-skeleton-container");
|
|
1874
|
-
const i = this.querySelector(".mint-checkbox-container"), s = this.querySelector(".mint-checkbox-wrapper"),
|
|
1874
|
+
const i = this.querySelector(".mint-checkbox-container"), s = this.querySelector(".mint-checkbox-wrapper"), n = this.querySelector(".mint-checkbox-label-container");
|
|
1875
1875
|
if (e) {
|
|
1876
1876
|
t || (t = document.createElement("div"), t.className = "mint-checkbox-skeleton-container absolute inset-0 z-10 pointer-events-none flex items-center gap-2", i ? i.appendChild(t) : (this.style.position = "relative", this.appendChild(t)));
|
|
1877
|
-
let
|
|
1878
|
-
if (
|
|
1877
|
+
let r = t.querySelector(".mint-checkbox-skeleton-box");
|
|
1878
|
+
if (r || (r = document.createElement("div"), r.className = "mint-checkbox-skeleton-box flex-shrink-0 w-5 h-5 rounded bg-gray-200 dark:bg-gray-700 animate-pulse", t.appendChild(r)), n) {
|
|
1879
1879
|
let a = t.querySelector(".mint-checkbox-skeleton-label");
|
|
1880
1880
|
a || (a = document.createElement("div"), a.className = "mint-checkbox-skeleton-label h-4 w-24 rounded bg-gray-200 dark:bg-gray-700 animate-pulse", t.appendChild(a));
|
|
1881
1881
|
}
|
|
1882
|
-
t.style.display = "flex", s && (s.style.visibility = "hidden", s.style.pointerEvents = "none"),
|
|
1882
|
+
t.style.display = "flex", s && (s.style.visibility = "hidden", s.style.pointerEvents = "none"), n && (n.style.visibility = "hidden", n.style.pointerEvents = "none");
|
|
1883
1883
|
} else
|
|
1884
|
-
t && (t.style.display = "none"), s && (s.style.visibility = "visible", s.style.pointerEvents = "auto"),
|
|
1884
|
+
t && (t.style.display = "none"), s && (s.style.visibility = "visible", s.style.pointerEvents = "auto"), n && (n.style.visibility = "visible", n.style.pointerEvents = "auto");
|
|
1885
1885
|
}
|
|
1886
1886
|
_renderErrorState() {
|
|
1887
1887
|
const e = this.hasError(), t = this.getErrorMessage();
|
|
@@ -1889,8 +1889,8 @@ class K extends HTMLElement {
|
|
|
1889
1889
|
!i && e && t && (i = document.createElement("div"), i.className = "mint-checkbox-label-container flex flex-col gap-0.5 flex-1", this.appendChild(i));
|
|
1890
1890
|
let s = this.querySelector(".mint-checkbox-error");
|
|
1891
1891
|
e && t ? (s ? (s.classList.add("block", "w-full"), s.style.display = "block", (i && s.parentElement !== i || i && s.parentElement === i) && i.appendChild(s)) : (s = document.createElement("div"), s.className = "mint-checkbox-error text-xs text-red-600 dark:text-red-400 block w-full", s.style.display = "block", i ? i.appendChild(s) : this.appendChild(s)), s.textContent = t) : s && s.remove();
|
|
1892
|
-
const
|
|
1893
|
-
|
|
1892
|
+
const n = this.querySelector(".mint-checkbox-wrapper");
|
|
1893
|
+
n && (n.className = `mint-checkbox-wrapper ${this.getCheckboxClasses()}`);
|
|
1894
1894
|
}
|
|
1895
1895
|
}
|
|
1896
1896
|
customElements.get("mint-checkbox") || customElements.define("mint-checkbox", K);
|
|
@@ -1953,14 +1953,14 @@ class Z extends HTMLElement {
|
|
|
1953
1953
|
}
|
|
1954
1954
|
render() {
|
|
1955
1955
|
var f;
|
|
1956
|
-
const e = this.isLoading(), t = this.isDisabled(), i = this.getValue(), s = this.closest("mint-choice"),
|
|
1957
|
-
let
|
|
1956
|
+
const e = this.isLoading(), t = this.isDisabled(), i = this.getValue(), s = this.closest("mint-choice"), n = (s == null ? void 0 : s.getAttribute("name")) || "";
|
|
1957
|
+
let r = "";
|
|
1958
1958
|
const a = this.querySelector(".mint-choice-option-label");
|
|
1959
|
-
a ?
|
|
1959
|
+
a ? r = ((f = a.textContent) == null ? void 0 : f.trim()) || "" : Array.from(this.childNodes).forEach((p) => {
|
|
1960
1960
|
var m;
|
|
1961
1961
|
if (p.nodeType === Node.TEXT_NODE) {
|
|
1962
1962
|
const k = (m = p.textContent) == null ? void 0 : m.trim();
|
|
1963
|
-
k && (
|
|
1963
|
+
k && (r += k);
|
|
1964
1964
|
}
|
|
1965
1965
|
});
|
|
1966
1966
|
const l = this.querySelectorAll(".mint-choice-option-wrapper");
|
|
@@ -2005,16 +2005,16 @@ class Z extends HTMLElement {
|
|
|
2005
2005
|
this.isDisabled() || (m.key === "ArrowDown" || m.key === "ArrowRight" ? (m.preventDefault(), this._focusNextOption()) : (m.key === "ArrowUp" || m.key === "ArrowLeft") && (m.preventDefault(), this._focusPreviousOption()));
|
|
2006
2006
|
}, this._radio.addEventListener("keydown", this._keydownHandler);
|
|
2007
2007
|
}
|
|
2008
|
-
this._radio.name =
|
|
2008
|
+
this._radio.name = n, this._radio.value = i, this._radio.checked !== this._checked ? (this._checked = this._radio.checked, this._checked ? this.hasAttribute("checked") || this.setAttribute("checked", "") : this.hasAttribute("checked") && this.removeAttribute("checked")) : this._radio.checked = this._checked, this._radio.disabled = t, t ? this._radio.setAttribute("tabindex", "-1") : this._radio.removeAttribute("tabindex"), r ? this._radio.setAttribute("aria-label", r) : this._radio.removeAttribute("aria-label"), o.querySelectorAll(".mint-choice-option-indicator").forEach((p, m) => {
|
|
2009
2009
|
m > 0 && p.remove();
|
|
2010
2010
|
});
|
|
2011
2011
|
let u = o.querySelector(".mint-choice-option-indicator");
|
|
2012
2012
|
u || (u = document.createElement("div"), u.className = "mint-choice-option-indicator", o.appendChild(u)), u.className = "mint-choice-option-indicator w-2 h-2 rounded-full bg-white transition-all duration-200 pointer-events-none", u.style.position = "absolute", u.style.top = "50%", u.style.left = "50%", u.style.transform = this._checked ? "translate(-50%, -50%) scale(1)" : "translate(-50%, -50%) scale(0)", u.style.opacity = this._checked ? "1" : "0", this._updateVisualState(), this._renderSkeleton(e);
|
|
2013
2013
|
let d = this.querySelector(".mint-choice-option-label");
|
|
2014
|
-
|
|
2014
|
+
r && (d || (d = document.createElement("span"), d.className = "mint-choice-option-label", this.appendChild(d), Array.from(this.childNodes).forEach((p) => {
|
|
2015
2015
|
var m;
|
|
2016
2016
|
p.nodeType === Node.TEXT_NODE && ((m = p.textContent) != null && m.trim()) && (p.textContent = "");
|
|
2017
|
-
})), d.className = `mint-choice-option-label text-sm text-gray-900 dark:text-gray-100 ${t ? "opacity-40" : ""}`, d.textContent =
|
|
2017
|
+
})), d.className = `mint-choice-option-label text-sm text-gray-900 dark:text-gray-100 ${t ? "opacity-40" : ""}`, d.textContent = r), t ? (this.classList.add("cursor-not-allowed"), this.classList.remove("cursor-pointer")) : (this.classList.add("cursor-pointer"), this.classList.remove("cursor-not-allowed")), this._updateVisualState();
|
|
2018
2018
|
}
|
|
2019
2019
|
_getWrapperClasses() {
|
|
2020
2020
|
const e = this.isDisabled(), t = [
|
|
@@ -2054,13 +2054,13 @@ class Z extends HTMLElement {
|
|
|
2054
2054
|
t || (t = document.createElement("div"), t.className = "mint-choice-option-skeleton-container absolute inset-0 z-10 pointer-events-none flex items-center gap-2", i ? (i.classList.contains("relative") || i.classList.add("relative"), i.appendChild(t)) : (this.style.position = "relative", this.appendChild(t)));
|
|
2055
2055
|
let s = t.querySelector(".mint-choice-option-skeleton-radio");
|
|
2056
2056
|
if (s || (s = document.createElement("div"), s.className = "mint-choice-option-skeleton-radio flex-shrink-0 w-5 h-5 rounded-full bg-gray-200 dark:bg-gray-700 animate-pulse", t.appendChild(s)), t.style.display = "flex", i) {
|
|
2057
|
-
const
|
|
2058
|
-
|
|
2057
|
+
const n = i.querySelector('input[type="radio"]'), r = i.querySelector(".mint-choice-option-indicator");
|
|
2058
|
+
n && (n.style.visibility = "hidden"), r && (r.style.visibility = "hidden"), i.style.pointerEvents = "none";
|
|
2059
2059
|
}
|
|
2060
2060
|
} else {
|
|
2061
2061
|
if (t && (t.style.display = "none"), i) {
|
|
2062
|
-
const
|
|
2063
|
-
|
|
2062
|
+
const n = i.querySelector('input[type="radio"]'), r = i.querySelector(".mint-choice-option-indicator");
|
|
2063
|
+
n && (n.style.visibility = "visible"), r && (r.style.visibility = "visible"), i.style.pointerEvents = "auto";
|
|
2064
2064
|
}
|
|
2065
2065
|
const s = this.querySelector(".mint-choice-option-label");
|
|
2066
2066
|
s && !(i != null && i.contains(s)) && (s.style.visibility = "visible", s.style.pointerEvents = "auto");
|
|
@@ -2082,21 +2082,21 @@ class Z extends HTMLElement {
|
|
|
2082
2082
|
if (!((s = this._radio) != null && s.name)) return;
|
|
2083
2083
|
const e = Array.from(document.querySelectorAll(
|
|
2084
2084
|
`input[type="radio"][name="${this._radio.name}"]`
|
|
2085
|
-
)).filter((
|
|
2085
|
+
)).filter((n) => !n.disabled), t = e.indexOf(this._radio);
|
|
2086
2086
|
let i = null;
|
|
2087
2087
|
if (t >= 0 && t < e.length - 1 ? i = e[t + 1] : e.length > 0 && (i = e[0]), i) {
|
|
2088
|
-
const
|
|
2089
|
-
if (i.checked = !0,
|
|
2090
|
-
const
|
|
2091
|
-
if (
|
|
2088
|
+
const n = i.closest("mint-choice-option");
|
|
2089
|
+
if (i.checked = !0, n) {
|
|
2090
|
+
const r = n._checked;
|
|
2091
|
+
if (n._checked = !0, n.setAttribute("checked", ""), n._changeHandler) {
|
|
2092
2092
|
const l = new Event("change", { bubbles: !0 });
|
|
2093
|
-
|
|
2093
|
+
n._changeHandler.call(n, l);
|
|
2094
2094
|
} else
|
|
2095
|
-
|
|
2096
|
-
const a =
|
|
2097
|
-
a && !
|
|
2095
|
+
n._updateVisualState(), n._updateGroupState();
|
|
2096
|
+
const a = n.closest("mint-choice");
|
|
2097
|
+
a && !r && setTimeout(() => {
|
|
2098
2098
|
a.dispatchEvent(new CustomEvent("choice-change", {
|
|
2099
|
-
detail: { checked: !0, value:
|
|
2099
|
+
detail: { checked: !0, value: n.getValue() },
|
|
2100
2100
|
bubbles: !0,
|
|
2101
2101
|
cancelable: !0
|
|
2102
2102
|
}));
|
|
@@ -2110,21 +2110,21 @@ class Z extends HTMLElement {
|
|
|
2110
2110
|
if (!((s = this._radio) != null && s.name)) return;
|
|
2111
2111
|
const e = Array.from(document.querySelectorAll(
|
|
2112
2112
|
`input[type="radio"][name="${this._radio.name}"]`
|
|
2113
|
-
)).filter((
|
|
2113
|
+
)).filter((n) => !n.disabled), t = e.indexOf(this._radio);
|
|
2114
2114
|
let i = null;
|
|
2115
2115
|
if (t > 0 ? i = e[t - 1] : e.length > 0 && (i = e[e.length - 1]), i) {
|
|
2116
|
-
const
|
|
2117
|
-
if (i.checked = !0,
|
|
2118
|
-
const
|
|
2119
|
-
if (
|
|
2116
|
+
const n = i.closest("mint-choice-option");
|
|
2117
|
+
if (i.checked = !0, n) {
|
|
2118
|
+
const r = n._checked;
|
|
2119
|
+
if (n._checked = !0, n.setAttribute("checked", ""), n._changeHandler) {
|
|
2120
2120
|
const l = new Event("change", { bubbles: !0 });
|
|
2121
|
-
|
|
2121
|
+
n._changeHandler.call(n, l);
|
|
2122
2122
|
} else
|
|
2123
|
-
|
|
2124
|
-
const a =
|
|
2125
|
-
a && !
|
|
2123
|
+
n._updateVisualState(), n._updateGroupState();
|
|
2124
|
+
const a = n.closest("mint-choice");
|
|
2125
|
+
a && !r && setTimeout(() => {
|
|
2126
2126
|
a.dispatchEvent(new CustomEvent("choice-change", {
|
|
2127
|
-
detail: { checked: !0, value:
|
|
2127
|
+
detail: { checked: !0, value: n.getValue() },
|
|
2128
2128
|
bubbles: !0,
|
|
2129
2129
|
cancelable: !0
|
|
2130
2130
|
}));
|
|
@@ -2151,10 +2151,10 @@ class Q extends HTMLElement {
|
|
|
2151
2151
|
return this.hasAttribute("loading");
|
|
2152
2152
|
}
|
|
2153
2153
|
attributeChangedCallback(e, t, i) {
|
|
2154
|
-
t !== i && (e === "error" || e === "error-message" ? this._renderErrorState() : e === "loading" ? (this.render(), this.querySelectorAll("mint-choice-option").forEach((
|
|
2155
|
-
this.isLoading() ?
|
|
2156
|
-
})) : (this.render(), e === "name" && this.querySelectorAll("mint-choice-option").forEach((
|
|
2157
|
-
typeof
|
|
2154
|
+
t !== i && (e === "error" || e === "error-message" ? this._renderErrorState() : e === "loading" ? (this.render(), this.querySelectorAll("mint-choice-option").forEach((n) => {
|
|
2155
|
+
this.isLoading() ? n.setAttribute("loading", "") : n.removeAttribute("loading");
|
|
2156
|
+
})) : (this.render(), e === "name" && this.querySelectorAll("mint-choice-option").forEach((n) => {
|
|
2157
|
+
typeof n.render == "function" && n.render();
|
|
2158
2158
|
})));
|
|
2159
2159
|
}
|
|
2160
2160
|
getLabel() {
|
|
@@ -2189,23 +2189,23 @@ class Q extends HTMLElement {
|
|
|
2189
2189
|
const t = this.querySelectorAll("mint-choice-option");
|
|
2190
2190
|
t.forEach((i) => {
|
|
2191
2191
|
if ((i.getAttribute("value") || "") === e) {
|
|
2192
|
-
const
|
|
2193
|
-
|
|
2194
|
-
const
|
|
2195
|
-
|
|
2192
|
+
const n = i;
|
|
2193
|
+
n.checked = !0;
|
|
2194
|
+
const r = i.querySelector('input[type="radio"]');
|
|
2195
|
+
r && (r.checked = !0, r.dispatchEvent(new Event("change", { bubbles: !0 })));
|
|
2196
2196
|
} else {
|
|
2197
|
-
const
|
|
2198
|
-
|
|
2199
|
-
const
|
|
2200
|
-
|
|
2197
|
+
const n = i;
|
|
2198
|
+
n.checked = !1;
|
|
2199
|
+
const r = i.querySelector('input[type="radio"]');
|
|
2200
|
+
r && (r.checked = !1);
|
|
2201
2201
|
}
|
|
2202
2202
|
}), requestAnimationFrame(() => {
|
|
2203
2203
|
t.forEach((i) => {
|
|
2204
2204
|
typeof i._updateVisualState == "function" && i._updateVisualState();
|
|
2205
2205
|
const s = i.querySelector('input[type="radio"]');
|
|
2206
2206
|
if (s) {
|
|
2207
|
-
const
|
|
2208
|
-
s.checked !==
|
|
2207
|
+
const n = i;
|
|
2208
|
+
s.checked !== n.checked && (s.checked = n.checked);
|
|
2209
2209
|
}
|
|
2210
2210
|
});
|
|
2211
2211
|
});
|
|
@@ -2213,15 +2213,15 @@ class Q extends HTMLElement {
|
|
|
2213
2213
|
render() {
|
|
2214
2214
|
const e = this.isLoading(), t = this.getLabel(), i = this.getInfo(), s = this.getId() || `mint-choice-${Math.random().toString(36).substr(2, 9)}`;
|
|
2215
2215
|
this.getId() || this.setAttribute("id", s);
|
|
2216
|
-
const
|
|
2217
|
-
let
|
|
2216
|
+
const n = this.isDisabled();
|
|
2217
|
+
let r = this.querySelector(".mint-choice-label-container");
|
|
2218
2218
|
if (t || i) {
|
|
2219
|
-
|
|
2220
|
-
let o =
|
|
2221
|
-
t ? (o || (o = document.createElement("label"), o.className = "mint-choice-label text-sm font-medium text-gray-900 dark:text-gray-100 select-none",
|
|
2222
|
-
let h =
|
|
2223
|
-
i ? (h || (h = document.createElement("span"), h.className = "mint-choice-info text-xs text-gray-500 dark:text-gray-400 select-none",
|
|
2224
|
-
} else
|
|
2219
|
+
r || (r = document.createElement("div"), r.className = "mint-choice-label-container flex flex-col gap-0.5 mb-2", this.insertBefore(r, this.firstChild));
|
|
2220
|
+
let o = r.querySelector(".mint-choice-label");
|
|
2221
|
+
t ? (o || (o = document.createElement("label"), o.className = "mint-choice-label text-sm font-medium text-gray-900 dark:text-gray-100 select-none", r.insertBefore(o, r.firstChild)), o.textContent = t, o.setAttribute("for", s), n ? o.classList.add("opacity-40") : o.classList.remove("opacity-40")) : o && o.remove();
|
|
2222
|
+
let h = r.querySelector(".mint-choice-info");
|
|
2223
|
+
i ? (h || (h = document.createElement("span"), h.className = "mint-choice-info text-xs text-gray-500 dark:text-gray-400 select-none", r.appendChild(h)), h.textContent = i, n ? h.classList.add("opacity-40") : h.classList.remove("opacity-40")) : h && h.remove();
|
|
2224
|
+
} else r && r.remove();
|
|
2225
2225
|
let a = this.querySelector(".mint-choice-options-wrapper");
|
|
2226
2226
|
if (!a) {
|
|
2227
2227
|
a = document.createElement("div"), a.className = "mint-choice-options-wrapper relative";
|
|
@@ -2239,7 +2239,7 @@ class Q extends HTMLElement {
|
|
|
2239
2239
|
const i = this.querySelector(".mint-choice-options-wrapper"), s = this.querySelector(".mint-choice-options-container");
|
|
2240
2240
|
if (e) {
|
|
2241
2241
|
if (t || (t = document.createElement("div"), t.className = "mint-choice-skeleton-container absolute inset-0 z-10 pointer-events-none flex flex-col gap-3", i ? i.appendChild(t) : (this.style.position = "relative", this.appendChild(t))), t.querySelectorAll(".mint-choice-option-skeleton").length === 0)
|
|
2242
|
-
for (let
|
|
2242
|
+
for (let r = 0; r < 3; r++) {
|
|
2243
2243
|
const a = document.createElement("div");
|
|
2244
2244
|
a.className = "mint-choice-option-skeleton flex items-center gap-3";
|
|
2245
2245
|
const l = document.createElement("div");
|
|
@@ -2351,7 +2351,7 @@ class ee extends HTMLElement {
|
|
|
2351
2351
|
return this.getAttribute("info") || "";
|
|
2352
2352
|
}
|
|
2353
2353
|
getInputClasses() {
|
|
2354
|
-
const e = this._isTextarea(), t = !!this.getIcon(), i = this._isColor(), s = this._isNumber(),
|
|
2354
|
+
const e = this._isTextarea(), t = !!this.getIcon(), i = this._isColor(), s = this._isNumber(), n = this.hasError(), r = [
|
|
2355
2355
|
"w-full",
|
|
2356
2356
|
t || i ? "pl-10" : "px-3.5",
|
|
2357
2357
|
t || i ? "pr-3.5" : s ? "pr-10" : "",
|
|
@@ -2378,13 +2378,13 @@ class ee extends HTMLElement {
|
|
|
2378
2378
|
s ? "[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none" : ""
|
|
2379
2379
|
], a = [
|
|
2380
2380
|
"border-2",
|
|
2381
|
-
|
|
2381
|
+
n ? "border-red-300 dark:border-red-300" : "border-gray-200 dark:border-gray-600"
|
|
2382
2382
|
], l = [
|
|
2383
2383
|
"focus-visible:ring-2",
|
|
2384
2384
|
"focus-visible:ring-offset-1",
|
|
2385
|
-
|
|
2385
|
+
n ? "focus-visible:ring-red-400 dark:focus-visible:ring-red-500" : "focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500"
|
|
2386
2386
|
];
|
|
2387
|
-
return [...
|
|
2387
|
+
return [...r, ...a, ...l].filter(Boolean).join(" ");
|
|
2388
2388
|
}
|
|
2389
2389
|
isLoading() {
|
|
2390
2390
|
return this.hasAttribute("loading");
|
|
@@ -2392,7 +2392,7 @@ class ee extends HTMLElement {
|
|
|
2392
2392
|
render() {
|
|
2393
2393
|
var E, C, v, y;
|
|
2394
2394
|
this.getType();
|
|
2395
|
-
const e = this._getNormalizedType(), t = this._isTextarea(), i = this._isMoney(), s = this._isColor(),
|
|
2395
|
+
const e = this._getNormalizedType(), t = this._isTextarea(), i = this._isMoney(), s = this._isColor(), n = this.getPlaceholder(), r = this.isDisabled(), a = this.isReadonly(), l = this.isRequired(), o = this.getId(), h = this.getName(), c = this.getAttribute("value") || (s ? "#000000" : ""), u = this.getRows(), d = this.getIcon(), f = this.getLabel(), p = this.getInfo(), m = this.isLoading();
|
|
2396
2396
|
if (this._renderSkeleton(m), s) {
|
|
2397
2397
|
this._input && (this._input.remove(), this._input = null), this._textarea && (this._textarea.remove(), this._textarea = null), this._wrapper || (this._wrapper = document.createElement("div"), this._wrapper.className = "relative w-full", this.appendChild(this._wrapper)), this._colorContainer && (this._colorContainer.remove(), this._colorContainer = null), this._colorPickerWrapper && !s && (this._colorPickerWrapper.remove(), this._colorPickerWrapper = null), this._colorPickerWrapper || (this._colorPickerWrapper = document.createElement("div"), this._colorPickerWrapper.className = "mint-color-picker-wrapper absolute left-[.65rem] top-1/2 -translate-y-1/2 w-6 h-6 rounded cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500", this._colorPickerWrapper.style.backgroundColor = c || "#000000", this._wrapper.appendChild(this._colorPickerWrapper), this._colorPicker = document.createElement("input"), this._colorPicker.type = "color", this._colorPicker.className = "absolute inset-0 w-full h-full opacity-0 cursor-pointer", this._colorPicker.style.cssText = "position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; z-index: 10; pointer-events: auto; margin: 0; padding: 0; border: none;", this._colorPickerWrapper.appendChild(this._colorPicker), this._focusHandler = (g) => {
|
|
2398
2398
|
this._colorPickerWrapper && this._colorPicker && this._colorPicker.matches(":focus-visible") && requestAnimationFrame(() => {
|
|
@@ -2417,7 +2417,7 @@ class ee extends HTMLElement {
|
|
|
2417
2417
|
bubbles: !0,
|
|
2418
2418
|
cancelable: !0
|
|
2419
2419
|
}));
|
|
2420
|
-
})), this._colorTextInput || (this._colorTextInput = document.createElement("input"), this._colorTextInput.type = "text", this._colorTextInput.className = this.getInputClasses(), this._colorTextInput.placeholder =
|
|
2420
|
+
})), this._colorTextInput || (this._colorTextInput = document.createElement("input"), this._colorTextInput.type = "text", this._colorTextInput.className = this.getInputClasses(), this._colorTextInput.placeholder = n || "#000000", this._colorTextInput.pattern = "^#[0-9A-Fa-f]{6}$", this._wrapper.appendChild(this._colorTextInput), this._colorTextInput.addEventListener("input", () => {
|
|
2421
2421
|
var x;
|
|
2422
2422
|
const g = ((x = this._colorTextInput) == null ? void 0 : x.value) || "";
|
|
2423
2423
|
/^#[0-9A-Fa-f]{6}$/.test(g) && (this._colorPicker && (this._colorPicker.value = g), this.setAttribute("value", g), this.dispatchEvent(new CustomEvent("input", {
|
|
@@ -2435,7 +2435,7 @@ class ee extends HTMLElement {
|
|
|
2435
2435
|
}));
|
|
2436
2436
|
}));
|
|
2437
2437
|
const b = c || "#000000";
|
|
2438
|
-
if (this._colorPicker && this._colorPicker.value !== b && (this._colorPicker.value = b), this._colorPickerWrapper && (this._colorPickerWrapper.style.backgroundColor = b), this._colorTextInput && this._colorTextInput.value !== b && (this._colorTextInput.value = b), this._colorPicker && (this._colorPicker.disabled =
|
|
2438
|
+
if (this._colorPicker && this._colorPicker.value !== b && (this._colorPicker.value = b), this._colorPickerWrapper && (this._colorPickerWrapper.style.backgroundColor = b), this._colorTextInput && this._colorTextInput.value !== b && (this._colorTextInput.value = b), this._colorPicker && (this._colorPicker.disabled = r), this._colorPickerWrapper && (r ? (this._colorPickerWrapper.classList.add("opacity-40", "cursor-not-allowed"), this._colorPickerWrapper.classList.remove("cursor-pointer")) : (this._colorPickerWrapper.classList.remove("opacity-40", "cursor-not-allowed"), this._colorPickerWrapper.classList.add("cursor-pointer"))), this._colorTextInput && (this._colorTextInput.disabled = r, this._colorTextInput.readOnly = a, this._colorTextInput.required = l), this._colorTextInput) {
|
|
2439
2439
|
const g = this._colorTextInput;
|
|
2440
2440
|
o ? g.id = o : g.removeAttribute("id"), h ? g.name = h : g.removeAttribute("name"), g.setAttribute("aria-invalid", this.hasError() ? "true" : "false"), this._element = g;
|
|
2441
2441
|
}
|
|
@@ -2462,14 +2462,14 @@ class ee extends HTMLElement {
|
|
|
2462
2462
|
}
|
|
2463
2463
|
});
|
|
2464
2464
|
}
|
|
2465
|
-
this._numberIncrementButton && (this._numberIncrementButton.disabled =
|
|
2465
|
+
this._numberIncrementButton && (this._numberIncrementButton.disabled = r || a), this._numberDecrementButton && (this._numberDecrementButton.disabled = r || a);
|
|
2466
2466
|
} else this._numberSpinnerContainer && (this._numberSpinnerContainer.remove(), this._numberSpinnerContainer = null, this._numberIncrementButton = null, this._numberDecrementButton = null);
|
|
2467
2467
|
if (t) {
|
|
2468
|
-
if (this._input && (this._input.remove(), this._input = null), this._textarea || (this._textarea = document.createElement("textarea"), this._wrapper.appendChild(this._textarea), this.setupEventListeners()), this._element = this._textarea, this._textarea.placeholder =
|
|
2468
|
+
if (this._input && (this._input.remove(), this._input = null), this._textarea || (this._textarea = document.createElement("textarea"), this._wrapper.appendChild(this._textarea), this.setupEventListeners()), this._element = this._textarea, this._textarea.placeholder = n, this._textarea.disabled = r, this._textarea.readOnly = a, this._textarea.required = l, this._textarea.rows = u, this._textarea.setAttribute("aria-invalid", this.hasError() ? "true" : "false"), c !== this._textarea.value && (this._textarea.value = c), o ? this._textarea.id = o : this._textarea.removeAttribute("id"), h ? this._textarea.name = h : this._textarea.removeAttribute("name"), this._textarea.className = this.getInputClasses(), this.firstChild && this.firstChild !== this._wrapper && this.firstChild.nodeType === Node.TEXT_NODE) {
|
|
2469
2469
|
const b = this.firstChild.textContent;
|
|
2470
2470
|
b && !this._textarea.value && (this._textarea.value = b.trim()), this.removeChild(this.firstChild);
|
|
2471
2471
|
}
|
|
2472
|
-
} else if (this._textarea && (this._textarea.remove(), this._textarea = null), this._input || (this._input = document.createElement("input"), this._wrapper.appendChild(this._input), this.setupEventListeners()), this._element = this._input, this._input.type = e, this._input.placeholder =
|
|
2472
|
+
} else if (this._textarea && (this._textarea.remove(), this._textarea = null), this._input || (this._input = document.createElement("input"), this._wrapper.appendChild(this._input), this.setupEventListeners()), this._element = this._input, this._input.type = e, this._input.placeholder = n, this._input.disabled = r, this._input.readOnly = a, this._input.required = l, this._input.setAttribute("aria-invalid", this.hasError() ? "true" : "false"), i ? (this._input.inputMode = "decimal", this._input.pattern = "[0-9]*\\.?[0-9]*") : (this._input.removeAttribute("inputmode"), this._input.removeAttribute("pattern")), c !== this._input.value && (this._input.value = c), o ? this._input.id = o : this._input.removeAttribute("id"), h ? this._input.name = h : this._input.removeAttribute("name"), this._input.className = this.getInputClasses(), this.firstChild && this.firstChild !== this._wrapper && this.firstChild.nodeType === Node.TEXT_NODE) {
|
|
2473
2473
|
const b = this.firstChild.textContent;
|
|
2474
2474
|
b && !this._input.value && (this._input.value = b.trim()), this.removeChild(this.firstChild);
|
|
2475
2475
|
}
|
|
@@ -2486,10 +2486,10 @@ class ee extends HTMLElement {
|
|
|
2486
2486
|
const w = `mint-input-${Math.random().toString(36).substr(2, 9)}`;
|
|
2487
2487
|
this._element ? this._element.id = w : this._colorTextInput ? this._colorTextInput.id = w : this._input ? this._input.id = w : this._textarea && (this._textarea.id = w), b.setAttribute("for", w);
|
|
2488
2488
|
}
|
|
2489
|
-
|
|
2489
|
+
r ? b.classList.add("opacity-40") : b.classList.remove("opacity-40");
|
|
2490
2490
|
} else b && b.remove();
|
|
2491
2491
|
let g = _.querySelector(".mint-input-info");
|
|
2492
|
-
p ? (g || (g = document.createElement("span"), g.className = "mint-input-info text-xs text-gray-500 dark:text-gray-400 select-none", _.appendChild(g)), g.textContent = p,
|
|
2492
|
+
p ? (g || (g = document.createElement("span"), g.className = "mint-input-info text-xs text-gray-500 dark:text-gray-400 select-none", _.appendChild(g)), g.textContent = p, r ? g.classList.add("opacity-40") : g.classList.remove("opacity-40")) : g && g.remove();
|
|
2493
2493
|
} else _ && _.remove();
|
|
2494
2494
|
this._renderErrorState(), this._renderSkeleton(m);
|
|
2495
2495
|
}
|
|
@@ -2536,9 +2536,9 @@ class ee extends HTMLElement {
|
|
|
2536
2536
|
let s = t.querySelector(".mint-input-skeleton");
|
|
2537
2537
|
if (!s) {
|
|
2538
2538
|
s = document.createElement("div"), s.className = "mint-input-skeleton w-full rounded-lg bg-gray-200 dark:bg-gray-700 animate-pulse";
|
|
2539
|
-
const
|
|
2540
|
-
if (
|
|
2541
|
-
const a =
|
|
2539
|
+
const n = this._isTextarea(), r = this.getRows();
|
|
2540
|
+
if (n) {
|
|
2541
|
+
const a = r * 24 + 12;
|
|
2542
2542
|
s.style.height = `${a}px`;
|
|
2543
2543
|
} else
|
|
2544
2544
|
s.style.height = "2.2rem";
|
|
@@ -2572,8 +2572,8 @@ class te extends HTMLElement {
|
|
|
2572
2572
|
attributeChangedCallback(e, t, i) {
|
|
2573
2573
|
if (t !== i) {
|
|
2574
2574
|
if (e === "error" || e === "error-message") {
|
|
2575
|
-
const s = this.hasError(),
|
|
2576
|
-
this._applyErrorVisuals(s,
|
|
2575
|
+
const s = this.hasError(), n = this.getErrorMessage();
|
|
2576
|
+
this._applyErrorVisuals(s, n, this.isDisabled());
|
|
2577
2577
|
return;
|
|
2578
2578
|
}
|
|
2579
2579
|
if (e === "loading") {
|
|
@@ -2647,9 +2647,9 @@ class te extends HTMLElement {
|
|
|
2647
2647
|
if (i && typeof window[i] == "function") {
|
|
2648
2648
|
const s = window[i]();
|
|
2649
2649
|
if (Array.isArray(s))
|
|
2650
|
-
return s.map((
|
|
2651
|
-
label:
|
|
2652
|
-
action: typeof
|
|
2650
|
+
return s.map((n) => ({
|
|
2651
|
+
label: n.label,
|
|
2652
|
+
action: typeof n.action == "function" ? n.action : this._createShortcutAction(n.action)
|
|
2653
2653
|
}));
|
|
2654
2654
|
}
|
|
2655
2655
|
}
|
|
@@ -2671,8 +2671,8 @@ class te extends HTMLElement {
|
|
|
2671
2671
|
action: () => {
|
|
2672
2672
|
const t = /* @__PURE__ */ new Date(), i = t.getDay(), s = new Date(t);
|
|
2673
2673
|
s.setDate(t.getDate() - i), s.setHours(0, 0, 0, 0);
|
|
2674
|
-
const
|
|
2675
|
-
return
|
|
2674
|
+
const n = new Date(s);
|
|
2675
|
+
return n.setDate(s.getDate() + 6), n.setHours(23, 59, 59, 999), { start: s, end: n };
|
|
2676
2676
|
}
|
|
2677
2677
|
},
|
|
2678
2678
|
{
|
|
@@ -2689,28 +2689,28 @@ class te extends HTMLElement {
|
|
|
2689
2689
|
let i = 0;
|
|
2690
2690
|
const s = e.toLowerCase();
|
|
2691
2691
|
for (; i < s.length; ) {
|
|
2692
|
-
const
|
|
2693
|
-
if (
|
|
2694
|
-
let
|
|
2695
|
-
for (; a < s.length && s[a] ===
|
|
2696
|
-
|
|
2697
|
-
t.push({ type: "part", part:
|
|
2692
|
+
const n = s[i];
|
|
2693
|
+
if (n === "d" || n === "m" || n === "y") {
|
|
2694
|
+
let r = 1, a = i + 1;
|
|
2695
|
+
for (; a < s.length && s[a] === n; )
|
|
2696
|
+
r++, a++;
|
|
2697
|
+
t.push({ type: "part", part: n, len: r }), i = a;
|
|
2698
2698
|
} else
|
|
2699
2699
|
t.push({ type: "sep", value: e[i] }), i++;
|
|
2700
2700
|
}
|
|
2701
2701
|
return t;
|
|
2702
2702
|
}
|
|
2703
|
-
_createPartInput(e, t, i, s,
|
|
2704
|
-
const
|
|
2705
|
-
return
|
|
2703
|
+
_createPartInput(e, t, i, s, n) {
|
|
2704
|
+
const r = document.createElement("input");
|
|
2705
|
+
return r.type = "text", r.inputMode = "numeric", r.pattern = "\\d*", r.maxLength = e, r.placeholder = t, r.className = "bg-transparent border-none outline-none text-center text-sm font-medium p-0 m-0 focus:outline-none focus:ring-0 disabled:opacity-40 disabled:cursor-not-allowed", r.disabled = i || s, r.readOnly = s, r.required = n, e === 4 ? r.className += " w-[40px]" : e === 2 && (r.className += " w-[30px]"), r;
|
|
2706
2706
|
}
|
|
2707
2707
|
_buildValueFromParts(e, t) {
|
|
2708
2708
|
let i = 0;
|
|
2709
2709
|
return t.map((s) => {
|
|
2710
|
-
var
|
|
2710
|
+
var r;
|
|
2711
2711
|
if (s.type === "sep") return s.value;
|
|
2712
|
-
const
|
|
2713
|
-
return i++,
|
|
2712
|
+
const n = ((r = e[i]) == null ? void 0 : r.value) || "";
|
|
2713
|
+
return i++, n;
|
|
2714
2714
|
}).join("");
|
|
2715
2715
|
}
|
|
2716
2716
|
_applyDateToParts(e, t, i, s) {
|
|
@@ -2719,14 +2719,14 @@ class te extends HTMLElement {
|
|
|
2719
2719
|
t.forEach((l) => l.value = "");
|
|
2720
2720
|
return;
|
|
2721
2721
|
}
|
|
2722
|
-
const
|
|
2723
|
-
let
|
|
2722
|
+
const n = this._formatDate(e, s);
|
|
2723
|
+
let r = 0, a = 0;
|
|
2724
2724
|
i.forEach((l) => {
|
|
2725
2725
|
if (l.type === "sep")
|
|
2726
|
-
|
|
2726
|
+
r += l.value.length;
|
|
2727
2727
|
else {
|
|
2728
|
-
const o =
|
|
2729
|
-
t[a] && (t[a].value = o), a++,
|
|
2728
|
+
const o = n.substr(r, l.len);
|
|
2729
|
+
t[a] && (t[a].value = o), a++, r += l.len;
|
|
2730
2730
|
}
|
|
2731
2731
|
});
|
|
2732
2732
|
}
|
|
@@ -2752,12 +2752,12 @@ class te extends HTMLElement {
|
|
|
2752
2752
|
}
|
|
2753
2753
|
}
|
|
2754
2754
|
_attachPartInputHandlers(e, t, i) {
|
|
2755
|
-
e.forEach((s,
|
|
2756
|
-
const
|
|
2755
|
+
e.forEach((s, n) => {
|
|
2756
|
+
const r = s.maxLength || 2;
|
|
2757
2757
|
s.addEventListener("input", () => {
|
|
2758
|
-
s.value = s.value.replace(/\D/g, "").slice(0,
|
|
2758
|
+
s.value = s.value.replace(/\D/g, "").slice(0, r), s.value.length >= r && this._focusNext(e, n), this._syncHiddenInput();
|
|
2759
2759
|
}), s.addEventListener("keydown", (a) => {
|
|
2760
|
-
a.key === "Backspace" && s.selectionStart === 0 && s.selectionEnd === 0 && this._focusPrev(e,
|
|
2760
|
+
a.key === "Backspace" && s.selectionStart === 0 && s.selectionEnd === 0 && this._focusPrev(e, n), a.key === "ArrowLeft" && s.selectionStart === 0 && s.selectionEnd === 0 && (this._focusPrev(e, n), a.preventDefault()), a.key === "ArrowRight" && s.selectionStart === s.value.length && s.selectionEnd === s.value.length && (this._focusNext(e, n), a.preventDefault());
|
|
2761
2761
|
}), s.addEventListener("blur", (a) => {
|
|
2762
2762
|
var h, c;
|
|
2763
2763
|
this._syncHiddenInput();
|
|
@@ -2782,11 +2782,11 @@ class te extends HTMLElement {
|
|
|
2782
2782
|
_parseValue(e) {
|
|
2783
2783
|
const t = this.getFormat(), i = this._getFormatTokens(t);
|
|
2784
2784
|
if (this._isRange) {
|
|
2785
|
-
const [s,
|
|
2786
|
-
if (
|
|
2787
|
-
const [l, o] =
|
|
2785
|
+
const [s, n] = this._splitRangeInput(e, t), r = s ? this._parseDateString(s, t) : null, a = n ? this._parseDateString(n, t) : null;
|
|
2786
|
+
if (r && a) {
|
|
2787
|
+
const [l, o] = r <= a ? [r, a] : [a, r];
|
|
2788
2788
|
this._selectedStartDate = l, this._selectedEndDate = o, this._currentMonth = l.getMonth(), this._currentYear = l.getFullYear();
|
|
2789
|
-
} else
|
|
2789
|
+
} else r && (this._selectedStartDate = r, this._selectedEndDate = null, this._currentMonth = r.getMonth(), this._currentYear = r.getFullYear());
|
|
2790
2790
|
this._applyDateToParts(this._selectedStartDate, this._startPartInputs, i, t), this._applyDateToParts(this._selectedEndDate, this._endPartInputs, i, t);
|
|
2791
2791
|
} else {
|
|
2792
2792
|
const s = this._parseDateString(e, t);
|
|
@@ -2819,26 +2819,26 @@ class te extends HTMLElement {
|
|
|
2819
2819
|
}
|
|
2820
2820
|
}
|
|
2821
2821
|
}
|
|
2822
|
-
const
|
|
2823
|
-
let a =
|
|
2822
|
+
const n = e.replace(/[\/\-\.]/g, ""), r = t.replace(/[\/\-\.]/g, "").toLowerCase();
|
|
2823
|
+
let a = r.indexOf("d"), l = r.indexOf("m"), o = r.indexOf("y");
|
|
2824
2824
|
const h = [
|
|
2825
2825
|
{ char: "d", index: a },
|
|
2826
2826
|
{ char: "m", index: l },
|
|
2827
2827
|
{ char: "y", index: o }
|
|
2828
2828
|
].sort((m, k) => m.index - k.index);
|
|
2829
2829
|
let c = 0, u = 0, d = 0, f = 0;
|
|
2830
|
-
|
|
2830
|
+
r.length, n.length;
|
|
2831
2831
|
for (const m of h)
|
|
2832
2832
|
if (m.char === "d") {
|
|
2833
|
-
const k =
|
|
2833
|
+
const k = r.lastIndexOf("d") - r.indexOf("d") + 1, _ = n.substr(f, k);
|
|
2834
2834
|
if (_.length === 0) return null;
|
|
2835
2835
|
c = parseInt(_, 10), f += _.length;
|
|
2836
2836
|
} else if (m.char === "m") {
|
|
2837
|
-
const k =
|
|
2837
|
+
const k = r.lastIndexOf("m") - r.indexOf("m") + 1, _ = n.substr(f, k);
|
|
2838
2838
|
if (_.length === 0) return null;
|
|
2839
2839
|
u = parseInt(_, 10) - 1, f += _.length;
|
|
2840
2840
|
} else if (m.char === "y") {
|
|
2841
|
-
const k =
|
|
2841
|
+
const k = r.lastIndexOf("y") - r.indexOf("y") + 1, _ = n.substr(f), E = Math.min(k, _.length), C = _.substr(0, E);
|
|
2842
2842
|
if (C.length === 0) return null;
|
|
2843
2843
|
let v = parseInt(C, 10);
|
|
2844
2844
|
E === 2 && k === 4 ? v = Math.floor((/* @__PURE__ */ new Date()).getFullYear() / 100) * 100 + v : E === 2 && k === 2 && (v = Math.floor((/* @__PURE__ */ new Date()).getFullYear() / 100) * 100 + v), d = v, f += E;
|
|
@@ -2848,13 +2848,13 @@ class te extends HTMLElement {
|
|
|
2848
2848
|
return isNaN(p.getTime()) || p.getDate() !== c || p.getMonth() !== u || p.getFullYear() !== d ? null : p;
|
|
2849
2849
|
}
|
|
2850
2850
|
_formatDate(e, t) {
|
|
2851
|
-
const i = e.getDate(), s = e.getMonth() + 1,
|
|
2851
|
+
const i = e.getDate(), s = e.getMonth() + 1, n = e.getFullYear(), r = t.toLowerCase();
|
|
2852
2852
|
let a = t;
|
|
2853
|
-
return
|
|
2853
|
+
return r.includes("dd") ? a = a.replace(/dd/gi, String(i).padStart(2, "0")) : r.includes("d") && (a = a.replace(/d/gi, String(i))), r.includes("mm") ? a = a.replace(/mm/gi, String(s).padStart(2, "0")) : r.includes("m") && (a = a.replace(/m/gi, String(s))), r.includes("yyyy") ? a = a.replace(/yyyy/gi, String(n)) : r.includes("yy") && (a = a.replace(/yy/gi, String(n).substr(2))), a;
|
|
2854
2854
|
}
|
|
2855
2855
|
// PHP-style formatter for display mode
|
|
2856
2856
|
_formatDatePhp(e, t) {
|
|
2857
|
-
const i = e.getDate(), s = e.getMonth() + 1,
|
|
2857
|
+
const i = e.getDate(), s = e.getMonth() + 1, n = e.getFullYear(), r = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], a = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], l = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], o = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], h = (d, f = 2) => d.toString().padStart(f, "0"), c = (d) => {
|
|
2858
2858
|
const f = d % 10, p = d % 100;
|
|
2859
2859
|
return f === 1 && p !== 11 ? "st" : f === 2 && p !== 12 ? "nd" : f === 3 && p !== 13 ? "rd" : "th";
|
|
2860
2860
|
};
|
|
@@ -2867,10 +2867,10 @@ class te extends HTMLElement {
|
|
|
2867
2867
|
}
|
|
2868
2868
|
switch (f) {
|
|
2869
2869
|
case "Y":
|
|
2870
|
-
u +=
|
|
2870
|
+
u += n.toString();
|
|
2871
2871
|
break;
|
|
2872
2872
|
case "y":
|
|
2873
|
-
u +=
|
|
2873
|
+
u += n.toString().slice(-2);
|
|
2874
2874
|
break;
|
|
2875
2875
|
case "m":
|
|
2876
2876
|
u += h(s);
|
|
@@ -2894,7 +2894,7 @@ class te extends HTMLElement {
|
|
|
2894
2894
|
u += a[e.getDay()];
|
|
2895
2895
|
break;
|
|
2896
2896
|
case "l":
|
|
2897
|
-
u +=
|
|
2897
|
+
u += r[e.getDay()];
|
|
2898
2898
|
break;
|
|
2899
2899
|
case "S":
|
|
2900
2900
|
u += c(i);
|
|
@@ -2911,7 +2911,7 @@ class te extends HTMLElement {
|
|
|
2911
2911
|
return i !== null && !isNaN(i.getTime());
|
|
2912
2912
|
}
|
|
2913
2913
|
render() {
|
|
2914
|
-
const e = this.isLoading(), t = this.getLabel(), i = this.getInfo(), s = this.getValue(),
|
|
2914
|
+
const e = this.isLoading(), t = this.getLabel(), i = this.getInfo(), s = this.getValue(), n = this.isDisabled(), r = this.isReadonly(), a = this.isRequired(), l = this.getId(), o = this.getName(), h = this.getFormat(), c = this.hasError(), u = this.getErrorMessage();
|
|
2915
2915
|
this._isRange = this.isRange(), this._input || (this._input = document.createElement("div"), this._input.className = "relative w-full", this.appendChild(this._input));
|
|
2916
2916
|
let d = this.querySelector(".mint-date-picker-label-container");
|
|
2917
2917
|
if (t || i) {
|
|
@@ -2923,12 +2923,12 @@ class te extends HTMLElement {
|
|
|
2923
2923
|
} else d && d.remove();
|
|
2924
2924
|
this._hiddenInput || (this._hiddenInput = document.createElement("input"), this._hiddenInput.type = "hidden", this._hiddenInput.value = s || "", this._textInput = this._hiddenInput, this._input.appendChild(this._hiddenInput)), l && (this._hiddenInput.id = l), o && (this._hiddenInput.name = o), this._hiddenInput.value = s || "", this._hiddenInput.setAttribute("aria-invalid", c ? "true" : "false");
|
|
2925
2925
|
let f = this._input.querySelector(".mint-date-fields");
|
|
2926
|
-
f || (f = document.createElement("div"), this._input.appendChild(f)), this._fieldsContainer = f, this._applyErrorVisuals(c, u,
|
|
2927
|
-
const p =
|
|
2928
|
-
this._displayEl.className = `flex-1 text-gray-900 dark:text-white ${
|
|
2929
|
-
|
|
2926
|
+
f || (f = document.createElement("div"), this._input.appendChild(f)), this._fieldsContainer = f, this._applyErrorVisuals(c, u, n), f.innerHTML = "", this._displayEl = document.createElement("div");
|
|
2927
|
+
const p = r ? "select-text" : "select-none";
|
|
2928
|
+
this._displayEl.className = `flex-1 text-gray-900 dark:text-white ${r ? "cursor-default" : "cursor-text"} ${p} focus:outline-none`, this._displayEl.tabIndex = n || r ? -1 : 0, this._displayEl.addEventListener("click", () => {
|
|
2929
|
+
n || r || this._enterInputMode();
|
|
2930
2930
|
}), this._displayEl.addEventListener("keydown", (E) => {
|
|
2931
|
-
|
|
2931
|
+
n || r || (E.key === "Enter" || E.key === " ") && (E.preventDefault(), this._enterInputMode());
|
|
2932
2932
|
}), this._inputsWrapperEl = document.createElement("div"), this._inputsWrapperEl.className = "flex items-center gap-1 w-full";
|
|
2933
2933
|
const m = this._getFormatTokens(h);
|
|
2934
2934
|
this._startPartInputs = [], this._endPartInputs = [];
|
|
@@ -2939,7 +2939,7 @@ class te extends HTMLElement {
|
|
|
2939
2939
|
const y = document.createElement("span");
|
|
2940
2940
|
y.textContent = v.value, y.className = "text-gray-400 dark:text-gray-500 select-none", C.appendChild(y);
|
|
2941
2941
|
} else {
|
|
2942
|
-
const y = v.part === "d" ? "dd" : v.part === "m" ? "mm" : v.len === 2 ? "yy" : "yyyy", b = this._createPartInput(v.len, y,
|
|
2942
|
+
const y = v.part === "d" ? "dd" : v.part === "m" ? "mm" : v.len === 2 ? "yy" : "yyyy", b = this._createPartInput(v.len, y, n, r, a);
|
|
2943
2943
|
E === "start" ? this._startPartInputs.push(b) : this._endPartInputs.push(b), C.appendChild(b);
|
|
2944
2944
|
}
|
|
2945
2945
|
}), C;
|
|
@@ -2950,17 +2950,17 @@ class te extends HTMLElement {
|
|
|
2950
2950
|
}
|
|
2951
2951
|
const _ = document.createElement("div");
|
|
2952
2952
|
if (_.className = "flex flex-col w-full", this._displayEl.style.display = this._isInputMode ? "none" : "flex", this._inputsWrapperEl.style.display = this._isInputMode ? "flex" : "none", _.appendChild(this._displayEl), _.appendChild(this._inputsWrapperEl), f.appendChild(_), f.addEventListener("click", () => {
|
|
2953
|
-
this._isInputMode ||
|
|
2953
|
+
this._isInputMode || n || r || this._enterInputMode();
|
|
2954
2954
|
}), this._attachPartInputHandlers(this._startPartInputs, m, f), this._isRange && this._attachPartInputHandlers(this._endPartInputs, m, f), this._parseValue(s), this._syncHiddenInput(), this._updateDisplayText(), this._iconButton)
|
|
2955
|
-
this._iconButton.disabled =
|
|
2955
|
+
this._iconButton.disabled = n || r, !n && !r ? this._iconButton.tabIndex = 0 : this._iconButton.tabIndex = -1;
|
|
2956
2956
|
else {
|
|
2957
2957
|
this._iconButton = document.createElement("button"), this._iconButton.type = "button", this._iconButton.tabIndex = 0, this._iconButton.className = "absolute left-2 top-[.55rem] text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 cursor-pointer z-10 focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500 pointer-events-auto disabled:opacity-40 disabled:cursor-not-allowed flex items-center justify-center rounded-sm";
|
|
2958
2958
|
const E = `date-icon-${Math.random().toString(36).substr(2, 9)}`;
|
|
2959
2959
|
this._iconButton.id = E;
|
|
2960
2960
|
const C = document.createElement("mint-icon");
|
|
2961
2961
|
C.setAttribute("name", "calendar"), C.className = "w-4 h-4 pointer-events-none", this._iconButton.appendChild(C), this._iconButton.addEventListener("click", () => {
|
|
2962
|
-
|
|
2963
|
-
}), this._input.prepend(this._iconButton), this._iconButton.disabled =
|
|
2962
|
+
n || r || this._enterInputMode();
|
|
2963
|
+
}), this._input.prepend(this._iconButton), this._iconButton.disabled = n || r;
|
|
2964
2964
|
}
|
|
2965
2965
|
this._renderErrorState(c, u), this._renderSkeleton(e);
|
|
2966
2966
|
}
|
|
@@ -3008,13 +3008,13 @@ class te extends HTMLElement {
|
|
|
3008
3008
|
return;
|
|
3009
3009
|
}
|
|
3010
3010
|
if (this._isRange) {
|
|
3011
|
-
const [i, s] = this._splitRangeInput(e, t),
|
|
3012
|
-
if (
|
|
3013
|
-
const [a, l] =
|
|
3011
|
+
const [i, s] = this._splitRangeInput(e, t), n = i ? this._parseDateString(i, t) : null, r = s ? this._parseDateString(s, t) : null;
|
|
3012
|
+
if (n && r) {
|
|
3013
|
+
const [a, l] = n <= r ? [n, r] : [r, n], o = this._formatDate(a, t), h = this._formatDate(l, t), c = `${o} - ${h}`;
|
|
3014
3014
|
this.setValue(c), this._applyDateToParts(a, this._startPartInputs, this._getFormatTokens(t), t), this._applyDateToParts(l, this._endPartInputs, this._getFormatTokens(t), t), this._selectedStartDate = a, this._selectedEndDate = l, this._currentMonth = a.getMonth(), this._currentYear = a.getFullYear();
|
|
3015
|
-
} else if (
|
|
3016
|
-
const a = this._formatDate(
|
|
3017
|
-
this.setValue(a), this._applyDateToParts(
|
|
3015
|
+
} else if (n) {
|
|
3016
|
+
const a = this._formatDate(n, t);
|
|
3017
|
+
this.setValue(a), this._applyDateToParts(n, this._startPartInputs, this._getFormatTokens(t), t), this._applyDateToParts(null, this._endPartInputs, this._getFormatTokens(t), t), this._selectedStartDate = n, this._selectedEndDate = null, this._currentMonth = n.getMonth(), this._currentYear = n.getFullYear();
|
|
3018
3018
|
} else
|
|
3019
3019
|
this.setValue(""), this._applyDateToParts(null, this._startPartInputs, this._getFormatTokens(t), t), this._applyDateToParts(null, this._endPartInputs, this._getFormatTokens(t), t), this._selectedStartDate = null, this._selectedEndDate = null;
|
|
3020
3020
|
} else if (this._validateDateString(e, t)) {
|
|
@@ -3053,9 +3053,9 @@ class te extends HTMLElement {
|
|
|
3053
3053
|
requestAnimationFrame(() => {
|
|
3054
3054
|
this._popover && this._popover.isConnected && (this._popover.setAttribute("trigger-id", e), this._popoverObserver || (this._popoverObserver = new MutationObserver((i) => {
|
|
3055
3055
|
i.forEach((s) => {
|
|
3056
|
-
var
|
|
3056
|
+
var n;
|
|
3057
3057
|
if (s.type === "attributes" && s.attributeName === "open")
|
|
3058
|
-
if ((
|
|
3058
|
+
if ((n = this._popover) == null ? void 0 : n.hasAttribute("open"))
|
|
3059
3059
|
requestAnimationFrame(() => {
|
|
3060
3060
|
this._buildCalendar();
|
|
3061
3061
|
const a = this._popover;
|
|
@@ -3114,8 +3114,8 @@ class te extends HTMLElement {
|
|
|
3114
3114
|
}
|
|
3115
3115
|
_buildCalendarView() {
|
|
3116
3116
|
if (!this._calendarContainer) return;
|
|
3117
|
-
const e = this._getDaysInMonth(this._currentMonth, this._currentYear), t = this._getFirstDayOfMonth(this._currentMonth, this._currentYear), i = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], s = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
|
|
3118
|
-
this._calendarContainer.className =
|
|
3117
|
+
const e = this._getDaysInMonth(this._currentMonth, this._currentYear), t = this._getFirstDayOfMonth(this._currentMonth, this._currentYear), i = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], s = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], n = this.getShortcuts(), r = n.length > 0;
|
|
3118
|
+
this._calendarContainer.className = r ? "mint-date-calendar bg-white dark:bg-gray-800 rounded-lg p-4 w-[18rem] md:w-auto md:min-w-[28rem]" : "mint-date-calendar bg-white dark:bg-gray-800 rounded-lg p-4 w-[18rem] md:min-w-[18rem]";
|
|
3119
3119
|
const a = document.createElement("div");
|
|
3120
3120
|
a.className = "flex flex-col md:flex-row md:gap-6 md:items-start";
|
|
3121
3121
|
const l = document.createElement("div");
|
|
@@ -3168,7 +3168,7 @@ class te extends HTMLElement {
|
|
|
3168
3168
|
this._handleDateClick(y);
|
|
3169
3169
|
}), _.appendChild(S);
|
|
3170
3170
|
}
|
|
3171
|
-
if (
|
|
3171
|
+
if (r) {
|
|
3172
3172
|
const v = document.createElement("div");
|
|
3173
3173
|
v.className = "mb-4 pb-4 border-b border-gray-200 dark:border-gray-700 md:mb-0 md:pb-0 md:border-b-0 md:border-r md:border-r-gray-200 dark:md:border-r-gray-700 md:pr-6 md:mr-0 md:w-32 md:flex-shrink-0 md:h-full md:flex md:flex-col";
|
|
3174
3174
|
const y = document.createElement("div");
|
|
@@ -3218,7 +3218,7 @@ class te extends HTMLElement {
|
|
|
3218
3218
|
D > 0 ? x.style.opacity = "1" : x.style.opacity = "0", D + N < I - 1 ? w.style.opacity = "1" : w.style.opacity = "0", T.style.opacity = "0", S.style.opacity = "0";
|
|
3219
3219
|
}
|
|
3220
3220
|
};
|
|
3221
|
-
b.addEventListener("scroll", H), window.addEventListener("resize", H), setTimeout(H, 0),
|
|
3221
|
+
b.addEventListener("scroll", H), window.addEventListener("resize", H), setTimeout(H, 0), n.forEach((L) => {
|
|
3222
3222
|
const D = document.createElement("button");
|
|
3223
3223
|
D.type = "button", D.tabIndex = 0, D.className = "px-3 py-1.5 text-xs font-medium rounded-md bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-600 transition-colors whitespace-nowrap flex-shrink-0 md:w-full md:text-left focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500", D.textContent = L.label, D.setAttribute("data-keep-popover-open", "true"), D.addEventListener("click", () => {
|
|
3224
3224
|
const I = L.action();
|
|
@@ -3257,16 +3257,16 @@ class te extends HTMLElement {
|
|
|
3257
3257
|
s.setAttribute("name", "caret-left"), s.className = "w-4 h-4", i.appendChild(s), i.addEventListener("click", () => {
|
|
3258
3258
|
this._currentYear--, this._buildCalendar();
|
|
3259
3259
|
}), t.appendChild(i);
|
|
3260
|
-
const r = document.createElement("button");
|
|
3261
|
-
r.type = "button", r.tabIndex = 0, r.className = "text-sm font-medium text-gray-900 dark:text-gray-100 hover:text-gray-600 dark:hover:text-gray-300 cursor-pointer transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500 rounded px-1", r.setAttribute("data-keep-popover-open", "true"), r.textContent = String(this._currentYear), r.addEventListener("click", () => {
|
|
3262
|
-
this._viewMode = "year", this._buildCalendar();
|
|
3263
|
-
}), t.appendChild(r);
|
|
3264
3260
|
const n = document.createElement("button");
|
|
3265
|
-
n.type = "button", n.tabIndex = 0, n.className = "
|
|
3261
|
+
n.type = "button", n.tabIndex = 0, n.className = "text-sm font-medium text-gray-900 dark:text-gray-100 hover:text-gray-600 dark:hover:text-gray-300 cursor-pointer transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500 rounded px-1", n.setAttribute("data-keep-popover-open", "true"), n.textContent = String(this._currentYear), n.addEventListener("click", () => {
|
|
3262
|
+
this._viewMode = "year", this._buildCalendar();
|
|
3263
|
+
}), t.appendChild(n);
|
|
3264
|
+
const r = document.createElement("button");
|
|
3265
|
+
r.type = "button", r.tabIndex = 0, r.className = "p-1 rounded hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-600 dark:text-gray-300 transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500", r.setAttribute("data-keep-popover-open", "true");
|
|
3266
3266
|
const a = document.createElement("mint-icon");
|
|
3267
|
-
a.setAttribute("name", "caret-right"), a.className = "w-4 h-4",
|
|
3267
|
+
a.setAttribute("name", "caret-right"), a.className = "w-4 h-4", r.appendChild(a), r.addEventListener("click", () => {
|
|
3268
3268
|
this._currentYear++, this._buildCalendar();
|
|
3269
|
-
}), t.appendChild(
|
|
3269
|
+
}), t.appendChild(r);
|
|
3270
3270
|
const l = document.createElement("div");
|
|
3271
3271
|
l.className = "grid grid-cols-3 gap-2", e.forEach((o, h) => {
|
|
3272
3272
|
const c = document.createElement("button");
|
|
@@ -3283,12 +3283,12 @@ class te extends HTMLElement {
|
|
|
3283
3283
|
i.className = "flex items-center justify-between mb-4";
|
|
3284
3284
|
const s = document.createElement("button");
|
|
3285
3285
|
s.type = "button", s.tabIndex = 0, s.className = "p-1 rounded hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-600 dark:text-gray-300 transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500", s.setAttribute("data-keep-popover-open", "true");
|
|
3286
|
-
const
|
|
3287
|
-
|
|
3286
|
+
const n = document.createElement("mint-icon");
|
|
3287
|
+
n.setAttribute("name", "caret-left"), n.className = "w-4 h-4", s.appendChild(n), s.addEventListener("click", () => {
|
|
3288
3288
|
this._currentYear -= 12, this._buildCalendar();
|
|
3289
3289
|
}), i.appendChild(s);
|
|
3290
|
-
const
|
|
3291
|
-
|
|
3290
|
+
const r = document.createElement("div");
|
|
3291
|
+
r.className = "text-sm font-medium text-gray-900 dark:text-gray-100", r.textContent = `${e} - ${t}`, i.appendChild(r);
|
|
3292
3292
|
const a = document.createElement("button");
|
|
3293
3293
|
a.type = "button", a.tabIndex = 0, a.className = "p-1 rounded hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-600 dark:text-gray-300 transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500", a.setAttribute("data-keep-popover-open", "true");
|
|
3294
3294
|
const l = document.createElement("mint-icon");
|
|
@@ -3333,8 +3333,8 @@ class te extends HTMLElement {
|
|
|
3333
3333
|
const t = this.getFormat();
|
|
3334
3334
|
if (this._isRange) {
|
|
3335
3335
|
if (!this._selectedStartDate || this._selectedStartDate && this._selectedEndDate ? (this._selectedStartDate = e, this._selectedEndDate = null) : this._selectedStartDate && !this._selectedEndDate && (e < this._selectedStartDate ? (this._selectedEndDate = this._selectedStartDate, this._selectedStartDate = e) : this._selectedEndDate = e), this._selectedStartDate && this._selectedEndDate) {
|
|
3336
|
-
const i = this._formatDate(this._selectedStartDate, t), s = this._formatDate(this._selectedEndDate, t),
|
|
3337
|
-
this.setValue(
|
|
3336
|
+
const i = this._formatDate(this._selectedStartDate, t), s = this._formatDate(this._selectedEndDate, t), n = `${i} - ${s}`;
|
|
3337
|
+
this.setValue(n), this._textInput && (this._textInput.value = n), this._popover && typeof this._popover.close == "function" && this._popover.close();
|
|
3338
3338
|
} else if (this._selectedStartDate) {
|
|
3339
3339
|
const i = this._formatDate(this._selectedStartDate, t);
|
|
3340
3340
|
this.setValue(i), this._textInput && (this._textInput.value = i);
|
|
@@ -3381,8 +3381,8 @@ class te extends HTMLElement {
|
|
|
3381
3381
|
const i = this._fieldsContainer, s = this._input;
|
|
3382
3382
|
if (e) {
|
|
3383
3383
|
t || (t = document.createElement("div"), t.className = "mint-date-picker-skeleton-container absolute inset-0 z-10 pointer-events-none", s ? (s.classList.contains("relative") || s.classList.add("relative"), s.appendChild(t)) : (this.style.position = "relative", this.appendChild(t)));
|
|
3384
|
-
let
|
|
3385
|
-
|
|
3384
|
+
let n = t.querySelector(".mint-date-picker-skeleton");
|
|
3385
|
+
n || (n = document.createElement("div"), n.className = "mint-date-picker-skeleton w-full rounded-lg bg-gray-200 dark:bg-gray-700 animate-pulse", n.style.height = "2.25rem", t.appendChild(n)), t.style.display = "block", i && (i.style.visibility = "hidden", i.style.pointerEvents = "none"), this._displayEl && (this._displayEl.style.visibility = "hidden", this._displayEl.style.pointerEvents = "none");
|
|
3386
3386
|
} else
|
|
3387
3387
|
t && (t.style.display = "none"), i && (i.style.visibility = "visible", i.style.pointerEvents = "auto"), this._displayEl && (this._displayEl.style.visibility = "visible", this._displayEl.style.pointerEvents = "auto");
|
|
3388
3388
|
}
|
|
@@ -3414,16 +3414,16 @@ class te extends HTMLElement {
|
|
|
3414
3414
|
}
|
|
3415
3415
|
const i = e._getFocusableElements();
|
|
3416
3416
|
if (i.length === 0) return;
|
|
3417
|
-
const s = i[0],
|
|
3418
|
-
if (!(((l = e._calendarContainer) == null ? void 0 : l.contains(
|
|
3417
|
+
const s = i[0], n = i[i.length - 1], r = document.activeElement;
|
|
3418
|
+
if (!(((l = e._calendarContainer) == null ? void 0 : l.contains(r)) || !1)) {
|
|
3419
3419
|
t.preventDefault(), s.focus();
|
|
3420
3420
|
return;
|
|
3421
3421
|
}
|
|
3422
|
-
if (t.shiftKey &&
|
|
3423
|
-
t.preventDefault(),
|
|
3422
|
+
if (t.shiftKey && r === s) {
|
|
3423
|
+
t.preventDefault(), n.focus();
|
|
3424
3424
|
return;
|
|
3425
3425
|
}
|
|
3426
|
-
if (!t.shiftKey &&
|
|
3426
|
+
if (!t.shiftKey && r === n) {
|
|
3427
3427
|
t.preventDefault(), s.focus();
|
|
3428
3428
|
return;
|
|
3429
3429
|
}
|
|
@@ -3533,12 +3533,12 @@ class ie extends HTMLElement {
|
|
|
3533
3533
|
], s = [
|
|
3534
3534
|
"border-2",
|
|
3535
3535
|
e ? "border-red-300 dark:border-red-300" : "border-gray-200 dark:border-gray-600"
|
|
3536
|
-
],
|
|
3536
|
+
], n = [
|
|
3537
3537
|
"focus-visible:ring-2",
|
|
3538
3538
|
"focus-visible:ring-offset-1",
|
|
3539
3539
|
e ? "focus-visible:ring-red-400 dark:focus-visible:ring-red-500" : "focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500"
|
|
3540
3540
|
];
|
|
3541
|
-
return [...i, ...s, ...
|
|
3541
|
+
return [...i, ...s, ...n].filter(Boolean).join(" ");
|
|
3542
3542
|
}
|
|
3543
3543
|
render() {
|
|
3544
3544
|
const e = this.isLoading(), t = [];
|
|
@@ -3549,14 +3549,14 @@ class ie extends HTMLElement {
|
|
|
3549
3549
|
for (; this.firstChild; )
|
|
3550
3550
|
this.removeChild(this.firstChild);
|
|
3551
3551
|
this._wrapper = null, this._select = null;
|
|
3552
|
-
const s = this.getLabel(),
|
|
3552
|
+
const s = this.getLabel(), n = this.getInfo(), r = this.getId(), a = this.getName(), l = this.getValue(), o = this.isDisabled(), h = this.isMultiple(), c = this.hasError();
|
|
3553
3553
|
if (s) {
|
|
3554
3554
|
const d = document.createElement("label");
|
|
3555
|
-
d.className = "block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",
|
|
3555
|
+
d.className = "block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1", r && d.setAttribute("for", r);
|
|
3556
3556
|
const f = document.createTextNode(s);
|
|
3557
3557
|
d.appendChild(f), this.appendChild(d);
|
|
3558
3558
|
}
|
|
3559
|
-
this._wrapper = document.createElement("div"), this._wrapper.className = "relative w-full", this.appendChild(this._wrapper), this._select = document.createElement("select"), this._select.className = this.getSelectClasses(),
|
|
3559
|
+
this._wrapper = document.createElement("div"), this._wrapper.className = "relative w-full", this.appendChild(this._wrapper), this._select = document.createElement("select"), this._select.className = this.getSelectClasses(), r && (this._select.id = r), a && (this._select.name = a), o && (this._select.disabled = !0), h && (this._select.multiple = !0), this._select.setAttribute("aria-invalid", c ? "true" : "false");
|
|
3560
3560
|
const u = t.length > 0 ? t : i;
|
|
3561
3561
|
if (u.length > 0 && u.forEach((d) => {
|
|
3562
3562
|
this._select.appendChild(d);
|
|
@@ -3578,9 +3578,9 @@ class ie extends HTMLElement {
|
|
|
3578
3578
|
const d = document.createElement("div");
|
|
3579
3579
|
d.className = "absolute right-2 top-1/2 -translate-y-1/2 pointer-events-none z-10 flex flex-col", this._caretUpIcon = document.createElement("mint-icon"), this._caretUpIcon.setAttribute("name", "caret-up"), this._caretUpIcon.className = "w-[.9em] h-[.9em] text-gray-400 dark:text-gray-500 mb-[-.2rem]", d.appendChild(this._caretUpIcon), this._caretDownIcon = document.createElement("mint-icon"), this._caretDownIcon.setAttribute("name", "caret-down"), this._caretDownIcon.className = "w-[.9em] h-[.9em] text-gray-400 dark:text-gray-500 mt-[-.2rem]", d.appendChild(this._caretDownIcon), this._wrapper.appendChild(d);
|
|
3580
3580
|
}
|
|
3581
|
-
if (
|
|
3581
|
+
if (n) {
|
|
3582
3582
|
const d = document.createElement("div");
|
|
3583
|
-
d.className = "mt-1 text-xs text-gray-500 dark:text-gray-400", d.textContent =
|
|
3583
|
+
d.className = "mt-1 text-xs text-gray-500 dark:text-gray-400", d.textContent = n, this.appendChild(d);
|
|
3584
3584
|
}
|
|
3585
3585
|
this._renderErrorState(), this._renderSkeleton(e);
|
|
3586
3586
|
}
|
|
@@ -3592,8 +3592,8 @@ class ie extends HTMLElement {
|
|
|
3592
3592
|
let s = t.querySelector(".mint-select-skeleton");
|
|
3593
3593
|
if (!s) {
|
|
3594
3594
|
s = document.createElement("div"), s.className = "mint-select-skeleton w-full rounded-lg bg-gray-200 dark:bg-gray-700 animate-pulse";
|
|
3595
|
-
const
|
|
3596
|
-
s.style.height =
|
|
3595
|
+
const n = this.isMultiple();
|
|
3596
|
+
s.style.height = n ? "6rem" : "2.25rem", t.appendChild(s);
|
|
3597
3597
|
}
|
|
3598
3598
|
t.style.display = "block", this._select && (this._select.style.opacity = "0", this._select.style.pointerEvents = "none");
|
|
3599
3599
|
} else
|
|
@@ -3657,15 +3657,15 @@ class se extends HTMLElement {
|
|
|
3657
3657
|
t || (t = document.createElement("div"), t.className = "mint-dropzone-skeleton-container absolute inset-0 z-10 pointer-events-none flex items-center justify-center", i ? (i.classList.contains("relative") || i.classList.add("relative"), i.appendChild(t)) : (this.style.position = "relative", this.appendChild(t)));
|
|
3658
3658
|
let s = t.querySelector(".mint-dropzone-skeleton");
|
|
3659
3659
|
if (s || (s = document.createElement("div"), s.className = "mint-dropzone-skeleton rounded-lg border-2 border-dashed border-gray-300 dark:border-gray-600 bg-gray-200 dark:bg-gray-700 animate-pulse", s.style.width = "100%", s.style.height = "100%", t.appendChild(s)), t.style.display = "flex", i) {
|
|
3660
|
-
const
|
|
3661
|
-
if (r) {
|
|
3662
|
-
const o = r;
|
|
3663
|
-
o.style.visibility = "hidden", o.style.pointerEvents = "none";
|
|
3664
|
-
}
|
|
3660
|
+
const n = i.querySelector(".mint-dropzone-icon"), r = i.querySelector(".mint-dropzone-label"), a = i.querySelector(".mint-dropzone-previews-wrapper"), l = this._fileInput;
|
|
3665
3661
|
if (n) {
|
|
3666
3662
|
const o = n;
|
|
3667
3663
|
o.style.visibility = "hidden", o.style.pointerEvents = "none";
|
|
3668
3664
|
}
|
|
3665
|
+
if (r) {
|
|
3666
|
+
const o = r;
|
|
3667
|
+
o.style.visibility = "hidden", o.style.pointerEvents = "none";
|
|
3668
|
+
}
|
|
3669
3669
|
if (a) {
|
|
3670
3670
|
const o = a;
|
|
3671
3671
|
o.style.visibility = "hidden", o.style.pointerEvents = "none";
|
|
@@ -3673,19 +3673,19 @@ class se extends HTMLElement {
|
|
|
3673
3673
|
l && (l.style.visibility = "hidden", l.style.pointerEvents = "none"), i.style.pointerEvents = "none";
|
|
3674
3674
|
}
|
|
3675
3675
|
} else if (t && (t.style.display = "none"), i) {
|
|
3676
|
-
const s = i.querySelector(".mint-dropzone-icon"),
|
|
3676
|
+
const s = i.querySelector(".mint-dropzone-icon"), n = i.querySelector(".mint-dropzone-label"), r = i.querySelector(".mint-dropzone-previews-wrapper"), a = this._fileInput;
|
|
3677
3677
|
if (s) {
|
|
3678
3678
|
const l = s;
|
|
3679
3679
|
l.style.visibility = "visible", l.style.pointerEvents = "auto";
|
|
3680
3680
|
}
|
|
3681
|
-
if (r) {
|
|
3682
|
-
const l = r;
|
|
3683
|
-
l.style.visibility = "visible", l.style.pointerEvents = "auto";
|
|
3684
|
-
}
|
|
3685
3681
|
if (n) {
|
|
3686
3682
|
const l = n;
|
|
3687
3683
|
l.style.visibility = "visible", l.style.pointerEvents = "auto";
|
|
3688
3684
|
}
|
|
3685
|
+
if (r) {
|
|
3686
|
+
const l = r;
|
|
3687
|
+
l.style.visibility = "visible", l.style.pointerEvents = "auto";
|
|
3688
|
+
}
|
|
3689
3689
|
a && (a.style.visibility = "visible", a.style.pointerEvents = "auto"), i.style.pointerEvents = "auto";
|
|
3690
3690
|
}
|
|
3691
3691
|
}
|
|
@@ -3705,8 +3705,8 @@ class se extends HTMLElement {
|
|
|
3705
3705
|
return this.hasAttribute("loading");
|
|
3706
3706
|
}
|
|
3707
3707
|
render() {
|
|
3708
|
-
const e = this.isLoading(), t = this.getLabel(), i = this.getAccept(), s = this.isMultiple(),
|
|
3709
|
-
this._dropzone || (this._dropzone = document.createElement("div"), this.appendChild(this._dropzone)), this._updateDragStateClass(), this._dropzone.setAttribute("aria-invalid", o ? "true" : "false"),
|
|
3708
|
+
const e = this.isLoading(), t = this.getLabel(), i = this.getAccept(), s = this.isMultiple(), n = this.isDisabled(), r = this.getWidth(), a = this.getHeight(), l = this.getName(), o = this.hasError(), h = this.getErrorMessage();
|
|
3709
|
+
this._dropzone || (this._dropzone = document.createElement("div"), this.appendChild(this._dropzone)), this._updateDragStateClass(), this._dropzone.setAttribute("aria-invalid", o ? "true" : "false"), n ? (this._dropzone.setAttribute("tabindex", "-1"), this._dropzone.removeAttribute("role")) : (this._dropzone.setAttribute("tabindex", "0"), this._dropzone.setAttribute("role", "button"), this._dropzone.setAttribute("aria-label", t || "File upload dropzone")), this._dropzone.style.width = r, this._dropzone.style.height = a, this._dropzone.style.minWidth = r, this._dropzone.style.minHeight = a, this._fileInput || (this._fileInput = document.createElement("input"), this._fileInput.type = "file", this._fileInput.style.display = "none", this._fileInput.setAttribute("tabindex", "-1"), this._fileInput.setAttribute("aria-hidden", "true"), this._dropzone.appendChild(this._fileInput)), this._fileInput.accept = i, this._fileInput.multiple = s, this._fileInput.disabled = n, l ? this._fileInput.name = l : this._fileInput.removeAttribute("name"), this._fileInput.setAttribute("aria-invalid", o ? "true" : "false");
|
|
3710
3710
|
const c = this._dropzone.querySelector(".mint-dropzone-icon"), u = this._dropzone.querySelector(".mint-dropzone-label");
|
|
3711
3711
|
c && c.remove(), u && u.remove();
|
|
3712
3712
|
const d = document.createElement("div");
|
|
@@ -3727,8 +3727,8 @@ class se extends HTMLElement {
|
|
|
3727
3727
|
}
|
|
3728
3728
|
_updateDragStateClass() {
|
|
3729
3729
|
if (!this._dropzone) return;
|
|
3730
|
-
const e = this.isDisabled(), t = this.hasError(),
|
|
3731
|
-
this._dropzone.className = `${
|
|
3730
|
+
const e = this.isDisabled(), t = this.hasError(), n = `relative border-2 border-dashed rounded-lg transition-all duration-200 flex flex-col items-center ${this._selectedFiles.length > 0 ? "justify-start" : "justify-center"} cursor-pointer overflow-hidden`, r = this._isDragging ? "border-gray-400 dark:border-gray-500 bg-gray-50 dark:bg-gray-800" : "border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 hover:border-gray-400 dark:hover:border-gray-500", a = t ? "border-red-300 dark:border-red-300 bg-red-50/50 dark:bg-red-900/30" : "", l = e ? "opacity-40 cursor-not-allowed" : "", o = "focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500";
|
|
3731
|
+
this._dropzone.className = `${n} ${t ? a : r} ${l} ${o}`.trim();
|
|
3732
3732
|
}
|
|
3733
3733
|
setupEventListeners() {
|
|
3734
3734
|
this._listenersInitialized || (this._listenersInitialized = !0, this.removeEventListeners(), !(!this._dropzone || !this._fileInput || this.isDisabled()) && (this._onDropzoneClick || (this._onDropzoneClick = (e) => {
|
|
@@ -3768,12 +3768,12 @@ class se extends HTMLElement {
|
|
|
3768
3768
|
return;
|
|
3769
3769
|
const i = e.target.files;
|
|
3770
3770
|
if (i && i.length > 0) {
|
|
3771
|
-
const s = this.getAccept(),
|
|
3771
|
+
const s = this.getAccept(), n = this.isMultiple(), r = [], a = [];
|
|
3772
3772
|
for (let l = 0; l < i.length; l++) {
|
|
3773
3773
|
const o = i[l];
|
|
3774
|
-
this._isFileAccepted(o, s) ?
|
|
3774
|
+
this._isFileAccepted(o, s) ? r.push(o) : a.push(o);
|
|
3775
3775
|
}
|
|
3776
|
-
if (!
|
|
3776
|
+
if (!n && r.length > 1 && (a.push(...r.slice(1)), r.splice(1)), a.length > 0) {
|
|
3777
3777
|
const l = new CustomEvent("dropRejected", {
|
|
3778
3778
|
detail: { files: a, reason: "File type not accepted or multiple files not allowed" },
|
|
3779
3779
|
bubbles: !0,
|
|
@@ -3781,7 +3781,7 @@ class se extends HTMLElement {
|
|
|
3781
3781
|
});
|
|
3782
3782
|
this.dispatchEvent(l);
|
|
3783
3783
|
}
|
|
3784
|
-
|
|
3784
|
+
r.length > 0 && this._applyValidFiles(r);
|
|
3785
3785
|
}
|
|
3786
3786
|
}), this._dropzone.addEventListener("click", this._onDropzoneClick), this._dropzone.addEventListener("dragover", this._onDragOver), this._dropzone.addEventListener("dragleave", this._onDragLeave), this._dropzone.addEventListener("drop", this._onDrop), this._dropzone.addEventListener("keydown", this._onKeyDown), this._dropzone.addEventListener("focus", this._onFocus), this._dropzone.addEventListener("blur", this._onBlur), this._fileInput.addEventListener("change", this._onFileInputChange), this._fileInput.addEventListener("input", this._onFileInputInput, !0)));
|
|
3787
3787
|
}
|
|
@@ -3789,32 +3789,32 @@ class se extends HTMLElement {
|
|
|
3789
3789
|
this._dropzone && (this._onDropzoneClick && this._dropzone.removeEventListener("click", this._onDropzoneClick), this._onDragOver && this._dropzone.removeEventListener("dragover", this._onDragOver), this._onDragLeave && this._dropzone.removeEventListener("dragleave", this._onDragLeave), this._onDrop && this._dropzone.removeEventListener("drop", this._onDrop), this._onKeyDown && this._dropzone.removeEventListener("keydown", this._onKeyDown), this._onFocus && this._dropzone.removeEventListener("focus", this._onFocus), this._onBlur && this._dropzone.removeEventListener("blur", this._onBlur)), this._fileInput && (this._onFileInputChange && this._fileInput.removeEventListener("change", this._onFileInputChange), this._onFileInputInput && this._fileInput.removeEventListener("input", this._onFileInputInput, !0)), this._isDragging = !1, this._listenersInitialized = !1;
|
|
3790
3790
|
}
|
|
3791
3791
|
_handleFiles(e) {
|
|
3792
|
-
const t = this.getAccept(), i = this.isMultiple(), s = [],
|
|
3793
|
-
for (let
|
|
3794
|
-
const a = e[
|
|
3795
|
-
this._isFileAccepted(a, t) ? s.push(a) :
|
|
3792
|
+
const t = this.getAccept(), i = this.isMultiple(), s = [], n = [];
|
|
3793
|
+
for (let r = 0; r < e.length; r++) {
|
|
3794
|
+
const a = e[r];
|
|
3795
|
+
this._isFileAccepted(a, t) ? s.push(a) : n.push(a);
|
|
3796
3796
|
}
|
|
3797
|
-
if (!i && s.length > 1 && (
|
|
3798
|
-
const
|
|
3799
|
-
detail: { files:
|
|
3797
|
+
if (!i && s.length > 1 && (n.push(...s.slice(1)), s.splice(1)), n.length > 0) {
|
|
3798
|
+
const r = new CustomEvent("dropRejected", {
|
|
3799
|
+
detail: { files: n, reason: "File type not accepted or multiple files not allowed" },
|
|
3800
3800
|
bubbles: !0,
|
|
3801
3801
|
cancelable: !0
|
|
3802
3802
|
});
|
|
3803
|
-
this.dispatchEvent(
|
|
3803
|
+
this.dispatchEvent(r);
|
|
3804
3804
|
}
|
|
3805
3805
|
s.length > 0 && this._applyValidFiles(s);
|
|
3806
3806
|
}
|
|
3807
3807
|
_isFileAccepted(e, t) {
|
|
3808
3808
|
var s;
|
|
3809
3809
|
if (!t) return !0;
|
|
3810
|
-
const i = t.split(",").map((
|
|
3811
|
-
for (const
|
|
3812
|
-
if (
|
|
3813
|
-
if ("." + ((s = e.name.split(".").pop()) == null ? void 0 : s.toLowerCase()) ===
|
|
3814
|
-
} else if (
|
|
3815
|
-
const
|
|
3816
|
-
if (
|
|
3817
|
-
} else if (e.type ===
|
|
3810
|
+
const i = t.split(",").map((n) => n.trim().toLowerCase());
|
|
3811
|
+
for (const n of i)
|
|
3812
|
+
if (n.startsWith(".")) {
|
|
3813
|
+
if ("." + ((s = e.name.split(".").pop()) == null ? void 0 : s.toLowerCase()) === n) return !0;
|
|
3814
|
+
} else if (n.includes("/*")) {
|
|
3815
|
+
const r = n.split("/")[0], a = e.type.split("/")[0];
|
|
3816
|
+
if (r === a) return !0;
|
|
3817
|
+
} else if (e.type === n) return !0;
|
|
3818
3818
|
return !1;
|
|
3819
3819
|
}
|
|
3820
3820
|
_dispatchEvent(e, t) {
|
|
@@ -3890,15 +3890,15 @@ class se extends HTMLElement {
|
|
|
3890
3890
|
}), c.appendChild(d), t.appendChild(c);
|
|
3891
3891
|
});
|
|
3892
3892
|
const i = this.hasError(), s = this._isDragging;
|
|
3893
|
-
let
|
|
3894
|
-
i ?
|
|
3895
|
-
const
|
|
3896
|
-
|
|
3893
|
+
let n = "from-white dark:from-gray-700";
|
|
3894
|
+
i ? n = "from-red-50 dark:from-red-900/30" : s && (n = "from-gray-50 dark:from-gray-800");
|
|
3895
|
+
const r = document.createElement("div");
|
|
3896
|
+
r.className = `absolute top-0 left-0 right-0 h-4 pointer-events-none z-10 bg-gradient-to-b ${n} to-transparent opacity-0 transition-opacity duration-200`, e.appendChild(r);
|
|
3897
3897
|
const a = document.createElement("div");
|
|
3898
|
-
a.className = `absolute bottom-0 left-0 right-0 h-4 pointer-events-none z-10 bg-gradient-to-t ${
|
|
3898
|
+
a.className = `absolute bottom-0 left-0 right-0 h-4 pointer-events-none z-10 bg-gradient-to-t ${n} to-transparent opacity-100 transition-opacity duration-200`, e.appendChild(a);
|
|
3899
3899
|
const l = () => {
|
|
3900
3900
|
const o = t.scrollTop, h = t.scrollHeight, c = t.clientHeight;
|
|
3901
|
-
o > 0 ?
|
|
3901
|
+
o > 0 ? r.style.opacity = "1" : r.style.opacity = "0", o + c < h - 1 ? a.style.opacity = "1" : a.style.opacity = "0";
|
|
3902
3902
|
};
|
|
3903
3903
|
l(), t.addEventListener("scroll", l), e.appendChild(t), this._previewContainer = e, this._dropzone.appendChild(e), this._updateDragStateClass();
|
|
3904
3904
|
}
|
|
@@ -3994,10 +3994,7 @@ class re extends HTMLElement {
|
|
|
3994
3994
|
if (this.classList.add("block", "w-full"), !this._form) {
|
|
3995
3995
|
for (this._form = document.createElement("form"), this._form.noValidate = !0; this.firstChild; )
|
|
3996
3996
|
this._form.appendChild(this.firstChild);
|
|
3997
|
-
this.appendChild(this._form), this._submitHandler = (e) => this._handleSubmit(e), this._form.addEventListener("submit",
|
|
3998
|
-
var t;
|
|
3999
|
-
(t = this.closest("mint-form")) == null || t._handleSubmit(e);
|
|
4000
|
-
});
|
|
3997
|
+
this.appendChild(this._form), this._submitHandler = (e) => this._handleSubmit(e), this._form.addEventListener("submit", this._submitHandler, !0);
|
|
4001
3998
|
}
|
|
4002
3999
|
this._applyFormAttributes();
|
|
4003
4000
|
}
|
|
@@ -4007,7 +4004,7 @@ class re extends HTMLElement {
|
|
|
4007
4004
|
e && (this._form.action = e), this._form.method = t, this._form.enctype = i;
|
|
4008
4005
|
}
|
|
4009
4006
|
async _handleSubmit(e) {
|
|
4010
|
-
if (e.preventDefault(), !this._form) return;
|
|
4007
|
+
if (e.preventDefault(), e.stopPropagation(), !this._form) return;
|
|
4011
4008
|
this._clearErrors(), this._syncDropzoneFiles();
|
|
4012
4009
|
const t = this._collectValidationRules(), i = new FormData(this._form), s = this._formDataToValues(i);
|
|
4013
4010
|
if (!this._validate(s, t)) {
|
|
@@ -4019,33 +4016,36 @@ class re extends HTMLElement {
|
|
|
4019
4016
|
}));
|
|
4020
4017
|
return;
|
|
4021
4018
|
}
|
|
4022
|
-
const
|
|
4019
|
+
const r = new CustomEvent("submit", {
|
|
4023
4020
|
detail: { formData: i, values: s },
|
|
4024
4021
|
bubbles: !0,
|
|
4025
4022
|
cancelable: !0,
|
|
4026
4023
|
composed: !0
|
|
4027
4024
|
});
|
|
4028
|
-
if (this.dispatchEvent(
|
|
4025
|
+
if (this.dispatchEvent(r), r.defaultPrevented)
|
|
4026
|
+
return;
|
|
4027
|
+
const a = this.getAttribute("action"), l = this.getAttribute("method");
|
|
4028
|
+
if (!(!a || !l))
|
|
4029
4029
|
try {
|
|
4030
|
-
const
|
|
4030
|
+
const o = await this._submitData(i, s);
|
|
4031
4031
|
this.dispatchEvent(new CustomEvent("submitsuccess", {
|
|
4032
|
-
detail:
|
|
4032
|
+
detail: o,
|
|
4033
4033
|
bubbles: !0,
|
|
4034
4034
|
cancelable: !0
|
|
4035
4035
|
}));
|
|
4036
|
-
} catch (
|
|
4036
|
+
} catch (o) {
|
|
4037
4037
|
this.dispatchEvent(new CustomEvent("submiterror", {
|
|
4038
|
-
detail: { error:
|
|
4038
|
+
detail: { error: o },
|
|
4039
4039
|
bubbles: !0,
|
|
4040
4040
|
cancelable: !0
|
|
4041
4041
|
}));
|
|
4042
4042
|
}
|
|
4043
4043
|
}
|
|
4044
4044
|
async _submitData(e, t) {
|
|
4045
|
-
const i = this.getAttribute("action"), s =
|
|
4045
|
+
const i = this.getAttribute("action"), s = this.getAttribute("method"), n = this.getAttribute("enctype") || "application/x-www-form-urlencoded";
|
|
4046
4046
|
if (!i)
|
|
4047
4047
|
return { status: 0, ok: !0, data: { values: t } };
|
|
4048
|
-
const
|
|
4048
|
+
const r = Array.from(e.values()).some((h) => h instanceof File);
|
|
4049
4049
|
let a = null;
|
|
4050
4050
|
const l = {};
|
|
4051
4051
|
let o = i;
|
|
@@ -4054,9 +4054,9 @@ class re extends HTMLElement {
|
|
|
4054
4054
|
e.forEach((c, u) => {
|
|
4055
4055
|
c instanceof File || h.append(u, String(c));
|
|
4056
4056
|
}), o += (i.includes("?") ? "&" : "?") + h.toString();
|
|
4057
|
-
} else if (
|
|
4057
|
+
} else if (n === "multipart/form-data" || r)
|
|
4058
4058
|
a = e;
|
|
4059
|
-
else if (
|
|
4059
|
+
else if (n === "application/json")
|
|
4060
4060
|
a = JSON.stringify(t), l["Content-Type"] = "application/json";
|
|
4061
4061
|
else {
|
|
4062
4062
|
const h = new URLSearchParams();
|
|
@@ -4066,7 +4066,7 @@ class re extends HTMLElement {
|
|
|
4066
4066
|
}
|
|
4067
4067
|
if (typeof fetch == "function") {
|
|
4068
4068
|
const h = await fetch(o, {
|
|
4069
|
-
method: s,
|
|
4069
|
+
method: s || "POST",
|
|
4070
4070
|
body: s === "GET" ? null : a,
|
|
4071
4071
|
headers: l
|
|
4072
4072
|
}), c = await h.text().catch(() => "");
|
|
@@ -4081,7 +4081,7 @@ class re extends HTMLElement {
|
|
|
4081
4081
|
}
|
|
4082
4082
|
return await new Promise((h, c) => {
|
|
4083
4083
|
const u = new XMLHttpRequest();
|
|
4084
|
-
u.open(s, o, !0), Object.entries(l).forEach(([d, f]) => u.setRequestHeader(d, f)), u.onload = function() {
|
|
4084
|
+
u.open(s || "POST", o, !0), Object.entries(l).forEach(([d, f]) => u.setRequestHeader(d, f)), u.onload = function() {
|
|
4085
4085
|
const { status: d, responseText: f } = u;
|
|
4086
4086
|
if (d >= 200 && d < 300) {
|
|
4087
4087
|
let p = f;
|
|
@@ -4102,37 +4102,47 @@ class re extends HTMLElement {
|
|
|
4102
4102
|
return e.forEach((i, s) => {
|
|
4103
4103
|
i instanceof File ? (t[s] || (t[s] = []), t[s].push(i)) : s in t ? Array.isArray(t[s]) ? (t[s].length > 0 && t[s][0] instanceof File, t[s].push(i)) : t[s] = [t[s], i] : t[s] = i;
|
|
4104
4104
|
}), this._form && (Array.from(this._form.querySelectorAll("mint-dropzone[name]")).forEach((r) => {
|
|
4105
|
-
const
|
|
4106
|
-
if (
|
|
4107
|
-
const
|
|
4108
|
-
if (
|
|
4109
|
-
const
|
|
4110
|
-
t[
|
|
4111
|
-
t[
|
|
4112
|
-
(
|
|
4113
|
-
) || t[
|
|
4114
|
-
}) : t[
|
|
4105
|
+
const a = r.getAttribute("name");
|
|
4106
|
+
if (a && typeof r.files < "u" && r.files) {
|
|
4107
|
+
const l = r.files;
|
|
4108
|
+
if (l.length > 0) {
|
|
4109
|
+
const o = Array.from(l);
|
|
4110
|
+
t[a] && Array.isArray(t[a]) ? o.forEach((h) => {
|
|
4111
|
+
t[a].some(
|
|
4112
|
+
(u) => u.name === h.name && u.size === h.size && u.lastModified === h.lastModified
|
|
4113
|
+
) || t[a].push(h);
|
|
4114
|
+
}) : t[a] = o;
|
|
4115
4115
|
}
|
|
4116
4116
|
}
|
|
4117
|
+
}), Array.from(this._form.querySelectorAll('input[type="file"][name]')).forEach((r) => {
|
|
4118
|
+
const a = r.name;
|
|
4119
|
+
if (a && r.files && r.files.length > 0) {
|
|
4120
|
+
const l = Array.from(r.files);
|
|
4121
|
+
t[a] && Array.isArray(t[a]) ? l.forEach((o) => {
|
|
4122
|
+
t[a].some(
|
|
4123
|
+
(c) => c.name === o.name && c.size === o.size && c.lastModified === o.lastModified
|
|
4124
|
+
) || t[a].push(o);
|
|
4125
|
+
}) : t[a] = l;
|
|
4126
|
+
}
|
|
4117
4127
|
}), Array.from(this._form.querySelectorAll("mint-tags[name]")).forEach((r) => {
|
|
4118
|
-
const
|
|
4119
|
-
if (
|
|
4120
|
-
let
|
|
4121
|
-
if (typeof r.tags < "u" ?
|
|
4122
|
-
const
|
|
4123
|
-
t[
|
|
4128
|
+
const a = r.getAttribute("name");
|
|
4129
|
+
if (a) {
|
|
4130
|
+
let l = [];
|
|
4131
|
+
if (typeof r.tags < "u" ? l = r.tags : typeof r.getTags == "function" && (l = r.getTags()), Array.isArray(l) && l.length > 0) {
|
|
4132
|
+
const o = l.map((h) => typeof h == "string" ? h : (h == null ? void 0 : h.value) || (h == null ? void 0 : h.label) || "").filter((h) => h.trim() !== "");
|
|
4133
|
+
t[a] = o;
|
|
4124
4134
|
} else
|
|
4125
|
-
t[
|
|
4135
|
+
t[a] = [];
|
|
4126
4136
|
}
|
|
4127
4137
|
})), t;
|
|
4128
4138
|
}
|
|
4129
4139
|
_collectValidationRules() {
|
|
4130
4140
|
const e = {};
|
|
4131
4141
|
return this._form && Array.from(this._form.querySelectorAll("[name][validation]")).forEach((i) => {
|
|
4132
|
-
const s = i.getAttribute("name") || "",
|
|
4133
|
-
if (!s || !
|
|
4134
|
-
const
|
|
4135
|
-
|
|
4142
|
+
const s = i.getAttribute("name") || "", n = i.getAttribute("validation");
|
|
4143
|
+
if (!s || !n) return;
|
|
4144
|
+
const r = this._parseRules(n);
|
|
4145
|
+
r.length && (e[s] = r);
|
|
4136
4146
|
}), e;
|
|
4137
4147
|
}
|
|
4138
4148
|
_parseRules(e) {
|
|
@@ -4147,20 +4157,20 @@ class re extends HTMLElement {
|
|
|
4147
4157
|
}
|
|
4148
4158
|
_validate(e, t) {
|
|
4149
4159
|
let i = !0;
|
|
4150
|
-
return this._errors = {}, Object.entries(t || {}).forEach(([s,
|
|
4151
|
-
const
|
|
4160
|
+
return this._errors = {}, Object.entries(t || {}).forEach(([s, n]) => {
|
|
4161
|
+
const r = Array.isArray(n) ? n : [n], a = this._getFieldElements(s), l = this._extractFieldValue(a), o = this._validateRules(l, r);
|
|
4152
4162
|
o ? (i = !1, this._errors[s] = o, this._flagFieldError(a, o)) : this._clearFieldError(a);
|
|
4153
4163
|
}), i;
|
|
4154
4164
|
}
|
|
4155
4165
|
_validateField(e) {
|
|
4156
4166
|
const t = this._collectValidationRules();
|
|
4157
4167
|
if (!t[e]) return;
|
|
4158
|
-
const i = t[e], s = Array.isArray(i) ? i : [i],
|
|
4159
|
-
a ? (this._errors[e] = a, this._flagFieldError(
|
|
4168
|
+
const i = t[e], s = Array.isArray(i) ? i : [i], n = this._getFieldElements(e), r = this._extractFieldValue(n), a = this._validateRules(r, s);
|
|
4169
|
+
a ? (this._errors[e] = a, this._flagFieldError(n, a)) : (this._clearFieldError(n), delete this._errors[e]);
|
|
4160
4170
|
}
|
|
4161
4171
|
_validateRules(e, t) {
|
|
4162
4172
|
for (const i of t) {
|
|
4163
|
-
const [s,
|
|
4173
|
+
const [s, n] = i.split(":");
|
|
4164
4174
|
switch (s) {
|
|
4165
4175
|
case "required": {
|
|
4166
4176
|
if (e == null || typeof e == "string" && e.trim() === "" || e instanceof FileList && e.length === 0 || Array.isArray(e) && e.length === 0) return "This field is required.";
|
|
@@ -4176,26 +4186,26 @@ class re extends HTMLElement {
|
|
|
4176
4186
|
break;
|
|
4177
4187
|
}
|
|
4178
4188
|
case "number": {
|
|
4179
|
-
const
|
|
4180
|
-
if (Number.isNaN(
|
|
4189
|
+
const r = Number(e);
|
|
4190
|
+
if (Number.isNaN(r)) return "Must be a number.";
|
|
4181
4191
|
break;
|
|
4182
4192
|
}
|
|
4183
4193
|
case "min": {
|
|
4184
|
-
const
|
|
4185
|
-
if (Number.isNaN(
|
|
4186
|
-
if (typeof e == "string" && e.trim().length <
|
|
4187
|
-
if (Array.isArray(e) && e.length <
|
|
4188
|
-
if (e instanceof FileList && e.length <
|
|
4189
|
-
if (e != null && !Number.isNaN(Number(e)) && Number(e) <
|
|
4194
|
+
const r = Number(n);
|
|
4195
|
+
if (Number.isNaN(r)) break;
|
|
4196
|
+
if (typeof e == "string" && e.trim().length < r) return `Must be at least ${r} characters.`;
|
|
4197
|
+
if (Array.isArray(e) && e.length < r) return `Select at least ${r}.`;
|
|
4198
|
+
if (e instanceof FileList && e.length < r) return `Upload at least ${r} files.`;
|
|
4199
|
+
if (e != null && !Number.isNaN(Number(e)) && Number(e) < r) return `Must be at least ${r}.`;
|
|
4190
4200
|
break;
|
|
4191
4201
|
}
|
|
4192
4202
|
case "max": {
|
|
4193
|
-
const
|
|
4194
|
-
if (Number.isNaN(
|
|
4195
|
-
if (typeof e == "string" && e.trim().length >
|
|
4196
|
-
if (Array.isArray(e) && e.length >
|
|
4197
|
-
if (e instanceof FileList && e.length >
|
|
4198
|
-
if (e != null && !Number.isNaN(Number(e)) && Number(e) >
|
|
4203
|
+
const r = Number(n);
|
|
4204
|
+
if (Number.isNaN(r)) break;
|
|
4205
|
+
if (typeof e == "string" && e.trim().length > r) return `Must be at most ${r} characters.`;
|
|
4206
|
+
if (Array.isArray(e) && e.length > r) return `Select no more than ${r}.`;
|
|
4207
|
+
if (e instanceof FileList && e.length > r) return `Upload no more than ${r} files.`;
|
|
4208
|
+
if (e != null && !Number.isNaN(Number(e)) && Number(e) > r) return `Must be at most ${r}.`;
|
|
4199
4209
|
break;
|
|
4200
4210
|
}
|
|
4201
4211
|
}
|
|
@@ -4204,23 +4214,23 @@ class re extends HTMLElement {
|
|
|
4204
4214
|
}
|
|
4205
4215
|
_getFieldElements(e) {
|
|
4206
4216
|
if (!this._form) return [];
|
|
4207
|
-
const t = Array.from(this._form.querySelectorAll(`[name="${e}"]`)), i = t.filter((
|
|
4217
|
+
const t = Array.from(this._form.querySelectorAll(`[name="${e}"]`)), i = t.filter((r) => r.tagName === "MINT-SELECT");
|
|
4208
4218
|
if (i.length > 0) {
|
|
4209
|
-
const
|
|
4219
|
+
const r = [];
|
|
4210
4220
|
return i.forEach((a) => {
|
|
4211
4221
|
const l = a.querySelector('select[name="' + e + '"]');
|
|
4212
|
-
l &&
|
|
4213
|
-
}), t.filter((a) => a.tagName !== "MINT-SELECT").concat(
|
|
4222
|
+
l && r.push(l);
|
|
4223
|
+
}), t.filter((a) => a.tagName !== "MINT-SELECT").concat(r);
|
|
4214
4224
|
}
|
|
4215
|
-
if (t.filter((
|
|
4216
|
-
return t.filter((
|
|
4217
|
-
const
|
|
4218
|
-
if (
|
|
4219
|
-
const
|
|
4220
|
-
return
|
|
4225
|
+
if (t.filter((r) => r.tagName === "MINT-TAGS").length > 0)
|
|
4226
|
+
return t.filter((r) => r.tagName !== "INPUT" || !r.closest("mint-tags"));
|
|
4227
|
+
const n = t.filter((r) => r.tagName === "INPUT" && r.closest("mint-tags"));
|
|
4228
|
+
if (n.length > 0) {
|
|
4229
|
+
const r = [];
|
|
4230
|
+
return n.forEach((a) => {
|
|
4221
4231
|
const l = a.closest("mint-tags");
|
|
4222
|
-
l && !
|
|
4223
|
-
}), t.filter((a) => a.tagName !== "INPUT" || !a.closest("mint-tags")).concat(
|
|
4232
|
+
l && !r.includes(l) && r.push(l);
|
|
4233
|
+
}), t.filter((a) => a.tagName !== "INPUT" || !a.closest("mint-tags")).concat(r);
|
|
4224
4234
|
}
|
|
4225
4235
|
return t;
|
|
4226
4236
|
}
|
|
@@ -4238,9 +4248,9 @@ class re extends HTMLElement {
|
|
|
4238
4248
|
if (s.every((l) => l.type === "checkbox"))
|
|
4239
4249
|
return a.map((l) => l.value || "on");
|
|
4240
4250
|
}
|
|
4241
|
-
const
|
|
4242
|
-
if (
|
|
4243
|
-
const a =
|
|
4251
|
+
const n = e.filter((a) => a.tagName === "MINT-CHOICE");
|
|
4252
|
+
if (n.length > 0 && n.length === e.length) {
|
|
4253
|
+
const a = n.find((l) => typeof l.getValue == "function" ? l.getValue() !== "" : l.querySelector("mint-choice-option[checked]") !== null);
|
|
4244
4254
|
if (a) {
|
|
4245
4255
|
if (typeof a.getValue == "function")
|
|
4246
4256
|
return a.getValue();
|
|
@@ -4250,9 +4260,9 @@ class re extends HTMLElement {
|
|
|
4250
4260
|
}
|
|
4251
4261
|
return "";
|
|
4252
4262
|
}
|
|
4253
|
-
const
|
|
4254
|
-
if (
|
|
4255
|
-
return
|
|
4263
|
+
const r = e.filter((a) => a.tagName === "MINT-CHECKBOX");
|
|
4264
|
+
if (r.length > 0 && r.length === e.length)
|
|
4265
|
+
return r.filter((l) => typeof l.checked < "u" ? l.checked : l.hasAttribute("checked")).map((l) => l.getAttribute("value") || "on");
|
|
4256
4266
|
}
|
|
4257
4267
|
const i = e[0];
|
|
4258
4268
|
if (i instanceof HTMLInputElement)
|
|
@@ -4264,18 +4274,18 @@ class re extends HTMLElement {
|
|
|
4264
4274
|
if (s)
|
|
4265
4275
|
return s.value;
|
|
4266
4276
|
if (typeof i.getValue == "function") {
|
|
4267
|
-
const
|
|
4268
|
-
if (
|
|
4269
|
-
return
|
|
4277
|
+
const r = i.getValue();
|
|
4278
|
+
if (r != null && r !== "")
|
|
4279
|
+
return r;
|
|
4270
4280
|
}
|
|
4271
|
-
const
|
|
4272
|
-
return
|
|
4281
|
+
const n = i.getAttribute("value");
|
|
4282
|
+
return n || "";
|
|
4273
4283
|
}
|
|
4274
4284
|
if (i.tagName === "MINT-DROPZONE" && typeof i.files < "u")
|
|
4275
4285
|
return i.files;
|
|
4276
4286
|
if (i.tagName === "MINT-TAGS") {
|
|
4277
4287
|
let s = null;
|
|
4278
|
-
return typeof i.tags < "u" ? s = i.tags : typeof i.getTags == "function" && (s = i.getTags()), Array.isArray(s) ? s.map((
|
|
4288
|
+
return typeof i.tags < "u" ? s = i.tags : typeof i.getTags == "function" && (s = i.getTags()), Array.isArray(s) ? s.map((r) => typeof r == "string" ? r : (r == null ? void 0 : r.value) || (r == null ? void 0 : r.label) || "").filter((r) => r.trim() !== "") : [];
|
|
4279
4289
|
}
|
|
4280
4290
|
return i.tagName === "MINT-CHECKBOX" || i.tagName === "MINT-SWITCH" ? (typeof i.checked < "u" ? i.checked : i.hasAttribute("checked")) ? i.getAttribute("value") || "on" : "" : i.tagName === "MINT-CHOICE" ? (typeof i.getValue == "function" ? i.getValue() : "") || "" : typeof i.value < "u" ? i.value : i.getAttribute("value") || "";
|
|
4281
4291
|
}
|
|
@@ -4326,8 +4336,8 @@ class re extends HTMLElement {
|
|
|
4326
4336
|
const s = this._getFieldElements(t);
|
|
4327
4337
|
if (s.length === 0) {
|
|
4328
4338
|
setTimeout(() => {
|
|
4329
|
-
const
|
|
4330
|
-
|
|
4339
|
+
const n = this._getFieldElements(t);
|
|
4340
|
+
n.length > 0 && this._applyValueToField(n, t, i);
|
|
4331
4341
|
}, 300);
|
|
4332
4342
|
return;
|
|
4333
4343
|
}
|
|
@@ -4342,24 +4352,23 @@ class re extends HTMLElement {
|
|
|
4342
4352
|
}
|
|
4343
4353
|
_applyValueToField(e, t, i) {
|
|
4344
4354
|
e.forEach((s) => {
|
|
4345
|
-
var
|
|
4346
|
-
const
|
|
4347
|
-
console.log(r);
|
|
4355
|
+
var r;
|
|
4356
|
+
const n = s.tagName;
|
|
4348
4357
|
try {
|
|
4349
|
-
if (
|
|
4358
|
+
if (n === "MINT-INPUT")
|
|
4350
4359
|
typeof s.value < "u" && (s.value = i || "");
|
|
4351
|
-
else if (
|
|
4360
|
+
else if (n === "MINT-DATE-PICKER")
|
|
4352
4361
|
typeof s.setValue == "function" && s.setValue(i || "");
|
|
4353
|
-
else if (
|
|
4354
|
-
|
|
4355
|
-
else if (
|
|
4362
|
+
else if (n === "MINT-SELECT" || n === "SELECT")
|
|
4363
|
+
n === "SELECT" ? (r = s.closest("mint-select")) == null || r.setValue(i || "") : typeof s.setValue == "function" && s.setValue(i || "");
|
|
4364
|
+
else if (n === "MINT-CHOICE")
|
|
4356
4365
|
typeof s.setValue == "function" ? s.setValue(i || "") : s.querySelectorAll("mint-choice-option").forEach((l) => {
|
|
4357
4366
|
l.checked = l.getAttribute("value") === i;
|
|
4358
4367
|
});
|
|
4359
|
-
else if (
|
|
4368
|
+
else if (n === "MINT-CHECKBOX" || n === "MINT-SWITCH") {
|
|
4360
4369
|
const a = i === !0 || i === "true" || i === "on" || i === 1 || i === "1";
|
|
4361
4370
|
typeof s.checked < "u" ? s.checked = a : a ? s.setAttribute("checked", "") : s.removeAttribute("checked");
|
|
4362
|
-
} else
|
|
4371
|
+
} else n === "MINT-TAGS" ? Array.isArray(i) && typeof s.tags < "u" && (s.tags = i.map((a) => typeof a == "string" ? { value: a, label: a, dismissable: !0 } : a)) : s instanceof HTMLInputElement ? s.type === "checkbox" || s.type === "radio" ? s.checked = i === !0 || i === "true" || i === "on" || i === 1 || i === "1" : s.value = i || "" : (s instanceof HTMLTextAreaElement || s instanceof HTMLSelectElement) && (s.value = i || "");
|
|
4363
4372
|
} catch (a) {
|
|
4364
4373
|
console.warn(`Failed to set value for field ${t}:`, a);
|
|
4365
4374
|
}
|
|
@@ -4367,7 +4376,7 @@ class re extends HTMLElement {
|
|
|
4367
4376
|
}
|
|
4368
4377
|
_resetCustomFields() {
|
|
4369
4378
|
this.querySelectorAll("mint-input, mint-date-picker, mint-select, mint-dropzone, mint-checkbox, mint-choice, mint-switch, mint-tags").forEach((t) => {
|
|
4370
|
-
var s,
|
|
4379
|
+
var s, n;
|
|
4371
4380
|
t.removeAttribute("error"), t.removeAttribute("error-message");
|
|
4372
4381
|
const i = t.tagName;
|
|
4373
4382
|
if (i === "MINT-INPUT")
|
|
@@ -4382,20 +4391,20 @@ class re extends HTMLElement {
|
|
|
4382
4391
|
}
|
|
4383
4392
|
else if (i === "MINT-SELECT")
|
|
4384
4393
|
try {
|
|
4385
|
-
(
|
|
4394
|
+
(n = t.setValue) == null || n.call(t, "");
|
|
4386
4395
|
} catch {
|
|
4387
4396
|
}
|
|
4388
4397
|
else if (i === "MINT-DROPZONE") {
|
|
4389
|
-
const
|
|
4390
|
-
|
|
4398
|
+
const r = t.querySelector('input[type="file"]');
|
|
4399
|
+
r && (r.value = "");
|
|
4391
4400
|
} else if (i === "MINT-CHECKBOX" || i === "MINT-SWITCH")
|
|
4392
4401
|
try {
|
|
4393
4402
|
if (typeof t.checked < "u")
|
|
4394
4403
|
t.checked = !1;
|
|
4395
4404
|
else {
|
|
4396
4405
|
t.removeAttribute("checked");
|
|
4397
|
-
const
|
|
4398
|
-
|
|
4406
|
+
const r = t.querySelector('input[type="checkbox"], input[type="radio"]');
|
|
4407
|
+
r && (r.checked = !1);
|
|
4399
4408
|
}
|
|
4400
4409
|
} catch {
|
|
4401
4410
|
}
|
|
@@ -4426,13 +4435,13 @@ class re extends HTMLElement {
|
|
|
4426
4435
|
const e = (i) => {
|
|
4427
4436
|
const s = i.target;
|
|
4428
4437
|
if (!s) return;
|
|
4429
|
-
const
|
|
4430
|
-
if (!
|
|
4431
|
-
const
|
|
4432
|
-
if (!
|
|
4433
|
-
const l = this._extractFieldValue([
|
|
4438
|
+
const n = this._findFieldElement(s);
|
|
4439
|
+
if (!n) return;
|
|
4440
|
+
const r = this._getFieldName(n);
|
|
4441
|
+
if (!r || !this._collectValidationRules()[r]) return;
|
|
4442
|
+
const l = this._extractFieldValue([n]), o = l != null && (typeof l == "string" ? l.trim() !== "" : l instanceof FileList || Array.isArray(l) ? l.length > 0 : !0), h = n.hasAttribute("data-mint-form-error") || s instanceof HTMLElement && (s.hasAttribute("aria-invalid") || s.closest("[data-mint-form-error]")), c = !!n.closest("mint-tags"), u = n.tagName === "MINT-CHECKBOX" || n.tagName === "MINT-SWITCH" || n.tagName === "MINT-CHOICE" || s instanceof HTMLElement && (s.closest("mint-checkbox, mint-switch, mint-choice") || s.closest("mint-choice-option")), d = n.tagName === "MINT-DATE-PICKER" || s instanceof HTMLElement && s.closest("mint-date-picker");
|
|
4434
4443
|
(o || h || c || u || d) && setTimeout(() => {
|
|
4435
|
-
this._validateField(
|
|
4444
|
+
this._validateField(r);
|
|
4436
4445
|
}, 0);
|
|
4437
4446
|
};
|
|
4438
4447
|
this._form.addEventListener("blur", e, !0), this._fieldBlurHandlers.set(this._form, e);
|
|
@@ -4577,8 +4586,8 @@ class ne extends HTMLElement {
|
|
|
4577
4586
|
}
|
|
4578
4587
|
const t = this.hasAttribute("collapse") && !this.hasAttribute("scroll"), i = this.hasAttribute("scroll");
|
|
4579
4588
|
i ? this.classList.add("relative") : this.classList.remove("relative");
|
|
4580
|
-
const s = [],
|
|
4581
|
-
|
|
4589
|
+
const s = [], n = e.querySelector("thead tr");
|
|
4590
|
+
n && n.querySelectorAll("th").forEach((h) => s.push((h.textContent || "").trim())), this._setClasses(e, [
|
|
4582
4591
|
"w-full",
|
|
4583
4592
|
i ? "min-w-[1200px]" : "",
|
|
4584
4593
|
"border-collapse",
|
|
@@ -4590,11 +4599,11 @@ class ne extends HTMLElement {
|
|
|
4590
4599
|
"dark:border-gray-700",
|
|
4591
4600
|
"overflow-hidden"
|
|
4592
4601
|
]);
|
|
4593
|
-
const
|
|
4594
|
-
|
|
4602
|
+
const r = e.querySelector("thead");
|
|
4603
|
+
r && (this._setClasses(r, [
|
|
4595
4604
|
"bg-[#F7F7F7]",
|
|
4596
4605
|
"dark:bg-gray-800"
|
|
4597
|
-
]),
|
|
4606
|
+
]), r.querySelectorAll("th").forEach((h) => {
|
|
4598
4607
|
this._setClasses(h, [
|
|
4599
4608
|
"text-left",
|
|
4600
4609
|
"font-semibold",
|
|
@@ -4646,12 +4655,12 @@ class ne extends HTMLElement {
|
|
|
4646
4655
|
}
|
|
4647
4656
|
_applyMobileCell(e, t) {
|
|
4648
4657
|
if (e.closest("tfoot") || e.dataset.mtProcessed === "true") return;
|
|
4649
|
-
const i = t[e.cellIndex] || "", s = e.getAttribute("data-original"),
|
|
4650
|
-
e.setAttribute("data-original",
|
|
4651
|
-
const
|
|
4652
|
-
|
|
4658
|
+
const i = t[e.cellIndex] || "", s = e.getAttribute("data-original"), n = s !== null ? s : e.innerHTML;
|
|
4659
|
+
e.setAttribute("data-original", n), e.dataset.mtProcessed = "true", e.innerHTML = "";
|
|
4660
|
+
const r = document.createElement("span");
|
|
4661
|
+
r.className = "mt-label font-semibold text-gray-700 dark:text-gray-200 hidden", r.textContent = i;
|
|
4653
4662
|
const a = document.createElement("span");
|
|
4654
|
-
a.className = "mt-value text-gray-900 dark:text-gray-100 text-right md:text-left w-full", a.innerHTML =
|
|
4663
|
+
a.className = "mt-value text-gray-900 dark:text-gray-100 text-right md:text-left w-full", a.innerHTML = n, e.appendChild(r), e.appendChild(a);
|
|
4655
4664
|
}
|
|
4656
4665
|
_restoreCell(e) {
|
|
4657
4666
|
if (e.dataset.mtProcessed !== "true") return;
|
|
@@ -4821,7 +4830,7 @@ class oe extends HTMLElement {
|
|
|
4821
4830
|
if (t !== i) {
|
|
4822
4831
|
if (e === "error" || e === "error-message") {
|
|
4823
4832
|
if (this._renderErrorState(), this._container) {
|
|
4824
|
-
const s = this.hasError(),
|
|
4833
|
+
const s = this.hasError(), n = [
|
|
4825
4834
|
"flex",
|
|
4826
4835
|
"flex-wrap",
|
|
4827
4836
|
"items-center",
|
|
@@ -4841,7 +4850,7 @@ class oe extends HTMLElement {
|
|
|
4841
4850
|
"transition-colors",
|
|
4842
4851
|
"duration-200"
|
|
4843
4852
|
];
|
|
4844
|
-
this._container.className =
|
|
4853
|
+
this._container.className = n.join(" ");
|
|
4845
4854
|
}
|
|
4846
4855
|
return;
|
|
4847
4856
|
}
|
|
@@ -4899,8 +4908,8 @@ class oe extends HTMLElement {
|
|
|
4899
4908
|
}
|
|
4900
4909
|
_render() {
|
|
4901
4910
|
this.classList.add("box-border", "m-0", "p-0", "border-0", "align-baseline", "block", "w-full");
|
|
4902
|
-
const e = this.isLoading(), t = this.getLabel(), i = this.getInfo(), s = this.hasError(),
|
|
4903
|
-
if (this.getId() || this.setAttribute("id",
|
|
4911
|
+
const e = this.isLoading(), t = this.getLabel(), i = this.getInfo(), s = this.hasError(), n = this.getId() || `mint-tags-${Math.random().toString(36).substr(2, 9)}`;
|
|
4912
|
+
if (this.getId() || this.setAttribute("id", n), this._container)
|
|
4904
4913
|
this._input && (this._input.placeholder = this._placeholder);
|
|
4905
4914
|
else {
|
|
4906
4915
|
this._container = document.createElement("div");
|
|
@@ -4967,16 +4976,16 @@ class oe extends HTMLElement {
|
|
|
4967
4976
|
];
|
|
4968
4977
|
this._container.className = o.join(" ");
|
|
4969
4978
|
}
|
|
4970
|
-
let
|
|
4979
|
+
let r = this.querySelector(".mint-tags-label-container");
|
|
4971
4980
|
if (t) {
|
|
4972
|
-
|
|
4973
|
-
let o =
|
|
4974
|
-
t ? (o || (o = document.createElement("label"), o.className = "mint-tags-label text-sm font-medium text-gray-900 dark:text-gray-100 select-none",
|
|
4975
|
-
} else
|
|
4981
|
+
r || (r = document.createElement("div"), r.className = "mint-tags-label-container mb-[.25rem]", this._container && this._container.parentElement === this ? this.insertBefore(r, this._container) : this.insertBefore(r, this.firstChild));
|
|
4982
|
+
let o = r.querySelector(".mint-tags-label");
|
|
4983
|
+
t ? (o || (o = document.createElement("label"), o.className = "mint-tags-label text-sm font-medium text-gray-900 dark:text-gray-100 select-none", r.appendChild(o)), o.textContent = t, o.setAttribute("for", n)) : o && o.remove();
|
|
4984
|
+
} else r && r.remove();
|
|
4976
4985
|
let a = this.querySelector(".mint-tags-info");
|
|
4977
4986
|
i ? (a || (a = document.createElement("span"), a.className = "mint-tags-info text-xs text-gray-500 dark:text-gray-400 select-none mt-1 block", this._container && this._container.parentElement === this ? this.insertBefore(a, this._container.nextSibling) : this.appendChild(a)), a.textContent = i) : a && a.remove();
|
|
4978
4987
|
const l = this.getName();
|
|
4979
|
-
l ? (this.setAttribute("name", l), this._input && (this._input.name = l, this._input.id =
|
|
4988
|
+
l ? (this.setAttribute("name", l), this._input && (this._input.name = l, this._input.id = n)) : (this.removeAttribute("name"), this._input && (this._input.removeAttribute("name"), this._input.id = n)), this._wireInputBackspace(), this._renderChips(), this._renderErrorState(), this._renderSkeleton(e);
|
|
4980
4989
|
}
|
|
4981
4990
|
_renderSkeleton(e) {
|
|
4982
4991
|
const t = this._container;
|
|
@@ -4998,7 +5007,7 @@ class oe extends HTMLElement {
|
|
|
4998
5007
|
const i = document.createElement("mint-chip");
|
|
4999
5008
|
i.dataset.index = String(e++), i.dataset.value = t.value, i.draggable = this.hasAttribute("sortable"), i.draggable && i.classList.add("cursor-move"), t.dismissable && (i.setAttribute("dismissable", ""), i.addEventListener("dismissed", () => this._removeTag(t.value))), this._chipsWrap.appendChild(i);
|
|
5000
5009
|
const s = i.querySelector("[data-mt-chip-text]");
|
|
5001
|
-
s && (s.textContent = t.label || t.value), this._setupChipEvents(i, t), i.draggable && (i.addEventListener("dragstart", (
|
|
5010
|
+
s && (s.textContent = t.label || t.value), this._setupChipEvents(i, t), i.draggable && (i.addEventListener("dragstart", (n) => this._onDragStart(n, i)), i.addEventListener("dragover", (n) => this._onDragOverChip(n, i)), i.addEventListener("drop", (n) => this._onDrop(n)), i.addEventListener("dragend", () => this._onDragEnd())), this.hasAttribute("sortable") && i.addEventListener("pointerdown", (n) => this._onPointerDown(n, i));
|
|
5002
5011
|
}), this._input && (this.hasAttribute("sortable") && (this._input.addEventListener("dragover", (t) => this._onDragOverInput(t)), this._input.addEventListener("drop", (t) => this._onDrop(t)), this._input.addEventListener("dragend", () => this._onDragEnd())), this._chipsWrap.appendChild(this._input));
|
|
5003
5012
|
}
|
|
5004
5013
|
_addFromInput() {
|
|
@@ -5061,14 +5070,14 @@ class oe extends HTMLElement {
|
|
|
5061
5070
|
}
|
|
5062
5071
|
_onDragOverChip(e, t) {
|
|
5063
5072
|
if (!this.hasAttribute("sortable") || (e.preventDefault(), e.dataTransfer && (e.dataTransfer.dropEffect = "move"), !this._dragChip || !this._chipsWrap) || t === this._dragChip) return;
|
|
5064
|
-
const i = t.getBoundingClientRect(), s = e.clientX,
|
|
5065
|
-
if (s <
|
|
5073
|
+
const i = t.getBoundingClientRect(), s = e.clientX, n = i.left + i.width * 0.5;
|
|
5074
|
+
if (s < n) {
|
|
5066
5075
|
if (this._dragChip.nextSibling === t) return;
|
|
5067
5076
|
this._chipsWrap.insertBefore(this._dragChip, t);
|
|
5068
5077
|
} else {
|
|
5069
5078
|
if (t.nextSibling === this._dragChip) return;
|
|
5070
|
-
const
|
|
5071
|
-
|
|
5079
|
+
const r = t.nextSibling;
|
|
5080
|
+
r ? this._chipsWrap.insertBefore(this._dragChip, r) : this._chipsWrap.appendChild(this._dragChip);
|
|
5072
5081
|
}
|
|
5073
5082
|
}
|
|
5074
5083
|
_onDrop(e) {
|
|
@@ -5085,8 +5094,8 @@ class oe extends HTMLElement {
|
|
|
5085
5094
|
e.forEach((i) => {
|
|
5086
5095
|
const s = i.dataset.value;
|
|
5087
5096
|
if (!s) return;
|
|
5088
|
-
const
|
|
5089
|
-
|
|
5097
|
+
const n = this._tags.find((r) => r.value === s);
|
|
5098
|
+
n && t.push(n);
|
|
5090
5099
|
}), t.length === this._tags.length && (this._tags = t, this._syncAttr(), this._renderChips(), this._emitChange());
|
|
5091
5100
|
}
|
|
5092
5101
|
// Pointer-based sortable for touch (and optionally mouse)
|
|
@@ -5106,8 +5115,8 @@ class oe extends HTMLElement {
|
|
|
5106
5115
|
if (!t) return;
|
|
5107
5116
|
const i = t.closest("mint-chip");
|
|
5108
5117
|
if (i && i !== this._dragChip) {
|
|
5109
|
-
const s = i.getBoundingClientRect(),
|
|
5110
|
-
if (
|
|
5118
|
+
const s = i.getBoundingClientRect(), n = e.clientX, r = s.left + s.width * 0.5;
|
|
5119
|
+
if (n < r)
|
|
5111
5120
|
this._dragChip.nextSibling !== i && this._chipsWrap.insertBefore(this._dragChip, i);
|
|
5112
5121
|
else if (i.nextSibling !== this._dragChip) {
|
|
5113
5122
|
const a = i.nextSibling;
|
|
@@ -5281,25 +5290,25 @@ class ce extends HTMLElement {
|
|
|
5281
5290
|
this.className = `box-border m-0 p-0 border-0 align-baseline block rounded-lg border shadow-sm overflow-hidden transition-colors duration-200 ${this.getBorderClasses()}`;
|
|
5282
5291
|
const s = this.getAriaLive();
|
|
5283
5292
|
this.setAttribute("role", "alert"), this.setAttribute("aria-live", s), e === "danger" ? this.setAttribute("aria-atomic", "true") : this.removeAttribute("aria-atomic");
|
|
5284
|
-
const
|
|
5293
|
+
const n = [];
|
|
5285
5294
|
for (this._bodyWrapper ? Array.from(this._bodyWrapper.childNodes).forEach((a) => {
|
|
5286
|
-
|
|
5287
|
-
}) : Array.from(this.childNodes).forEach((
|
|
5288
|
-
|
|
5295
|
+
n.push(a);
|
|
5296
|
+
}) : Array.from(this.childNodes).forEach((r) => {
|
|
5297
|
+
r !== this._headerWrapper && r !== this._bodyWrapper && r !== this._iconElement && r !== this._headingElement && r !== this._dismissButton && n.push(r);
|
|
5289
5298
|
}), this._dismissButton && this._dismissHandler && this._dismissButton.removeEventListener("click", this._dismissHandler); this.firstChild; )
|
|
5290
5299
|
this.removeChild(this.firstChild);
|
|
5291
5300
|
if (this._headerWrapper = null, this._bodyWrapper = null, this._iconElement = null, this._headingElement = null, this._dismissButton = null, this._headerWrapper = document.createElement("div"), this._headerWrapper.className = `px-4 py-3 flex items-center gap-3 ${this.getHeaderBackgroundClasses()}`, this._iconElement = document.createElement("mint-icon"), this._iconElement.setAttribute("name", this.getIconName()), this._iconElement.className = `flex-shrink-0 w-5 h-5 ${this.getIconColorClasses()}`, this._headerWrapper.appendChild(this._iconElement), this._headingElement = document.createElement("mint-text"), this._headingElement.className = `font-semibold flex-1 ${this.getHeadingColorClasses()}`, this._headingElement.textContent = t || "", this._headerWrapper.appendChild(this._headingElement), i) {
|
|
5292
5301
|
this._dismissButton = document.createElement("button"), this._dismissButton.className = "flex-shrink-0 p-1 rounded hover:bg-black/10 dark:hover:bg-white/10 transition-colors", this._dismissButton.setAttribute("aria-label", "Dismiss alert"), this._dismissButton.setAttribute("type", "button");
|
|
5293
|
-
const
|
|
5294
|
-
|
|
5302
|
+
const r = document.createElement("mint-icon");
|
|
5303
|
+
r.setAttribute("name", "close"), r.className = "w-4 h-4 text-gray-700 dark:text-gray-300", this._dismissButton.appendChild(r), this._dismissHandler = (a) => {
|
|
5295
5304
|
a.preventDefault(), a.stopPropagation(), this.dispatchEvent(new CustomEvent("dismissed", {
|
|
5296
5305
|
bubbles: !0,
|
|
5297
5306
|
composed: !0
|
|
5298
5307
|
})), this.remove();
|
|
5299
5308
|
}, this._dismissButton.addEventListener("click", this._dismissHandler), this._headerWrapper.appendChild(this._dismissButton);
|
|
5300
5309
|
}
|
|
5301
|
-
this._bodyWrapper = document.createElement("div"), this._bodyWrapper.className = "px-4 py-3 bg-white dark:bg-gray-800",
|
|
5302
|
-
this._bodyWrapper.appendChild(
|
|
5310
|
+
this._bodyWrapper = document.createElement("div"), this._bodyWrapper.className = "px-4 py-3 bg-white dark:bg-gray-800", n.forEach((r) => {
|
|
5311
|
+
this._bodyWrapper.appendChild(r);
|
|
5303
5312
|
}), this.appendChild(this._headerWrapper), this.appendChild(this._bodyWrapper);
|
|
5304
5313
|
}
|
|
5305
5314
|
}
|