monobill-mintui 0.1.2 → 0.1.4
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/check-BlBVFo8S.cjs +1 -0
- package/dist/check-DU-jKCe4.js +29 -0
- package/dist/components/icon/icons/index.cjs +1 -0
- package/dist/components/icon/icons/index.js +679 -0
- package/dist/components/page/Page.d.ts +2 -0
- package/dist/components/page/Page.d.ts.map +1 -1
- package/dist/components/select/Select.d.ts.map +1 -1
- package/dist/components/table/Table.d.ts +1 -1
- package/dist/components/table/Table.d.ts.map +1 -1
- package/dist/index.cjs +5 -5
- package/dist/index.js +470 -496
- package/package.json +2 -1
package/dist/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { g as O } from "./check-DU-jKCe4.js";
|
|
2
|
+
class q extends HTMLElement {
|
|
2
3
|
constructor() {
|
|
3
4
|
super(), this._darkModeObserver = null;
|
|
4
5
|
}
|
|
@@ -34,17 +35,17 @@ class B extends HTMLElement {
|
|
|
34
35
|
const e = this.getSize(), t = this.getAttribute("size") || "default", i = !!(this.style.width && this.style.height), s = this.getAttribute("data-button-variant"), r = document.documentElement.classList.contains("dark");
|
|
35
36
|
let n;
|
|
36
37
|
if (i) {
|
|
37
|
-
const
|
|
38
|
-
s === "solid" ?
|
|
38
|
+
const l = this.getAttribute("data-button-tone") || "neutral";
|
|
39
|
+
s === "solid" ? l === "neutral" ? n = r ? "#ffffff" : "#0f172a" : n = "#ffffff" : n = r ? "#ffffff" : "#0f172a";
|
|
39
40
|
} else
|
|
40
41
|
n = r ? "#e2e8f0" : "#0f172a";
|
|
41
|
-
const a = t === "large" ? "2" : "4",
|
|
42
|
+
const a = t === "large" ? "2" : "4", c = !!(this.style.width && this.style.height), o = `
|
|
42
43
|
<svg
|
|
43
44
|
xmlns="http://www.w3.org/2000/svg"
|
|
44
45
|
fill="none"
|
|
45
46
|
viewBox="0 0 24 24"
|
|
46
|
-
class="animate-spin ${
|
|
47
|
-
style="${
|
|
47
|
+
class="animate-spin ${c ? "" : e}"
|
|
48
|
+
style="${c ? `width: ${this.style.width}; height: ${this.style.height}; animation-duration: 0.8s;` : "animation-duration: 0.8s;"}"
|
|
48
49
|
>
|
|
49
50
|
<circle
|
|
50
51
|
cx="12"
|
|
@@ -85,15 +86,8 @@ class B extends HTMLElement {
|
|
|
85
86
|
this.innerHTML = o.trim();
|
|
86
87
|
}
|
|
87
88
|
}
|
|
88
|
-
customElements.get("mint-spinner") || customElements.define("mint-spinner",
|
|
89
|
-
|
|
90
|
-
function P(x) {
|
|
91
|
-
F.set(x.name, x);
|
|
92
|
-
}
|
|
93
|
-
function z(x) {
|
|
94
|
-
return F.get(x);
|
|
95
|
-
}
|
|
96
|
-
class V extends HTMLElement {
|
|
89
|
+
customElements.get("mint-spinner") || customElements.define("mint-spinner", q);
|
|
90
|
+
class B extends HTMLElement {
|
|
97
91
|
constructor() {
|
|
98
92
|
super(), this._darkModeObserver = null;
|
|
99
93
|
}
|
|
@@ -130,17 +124,17 @@ class V extends HTMLElement {
|
|
|
130
124
|
return e ? `${e}/${this.getName()}.svg` : `/icons/${this.getName()}.svg`;
|
|
131
125
|
}
|
|
132
126
|
render() {
|
|
133
|
-
var a,
|
|
127
|
+
var a, c;
|
|
134
128
|
const e = this.getName();
|
|
135
129
|
if (!e) {
|
|
136
130
|
this.innerHTML = "", this.style.maskImage = "", this.style.webkitMaskImage = "";
|
|
137
131
|
return;
|
|
138
132
|
}
|
|
139
|
-
if (!
|
|
133
|
+
if (!O(e)) {
|
|
140
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 = "";
|
|
141
135
|
return;
|
|
142
136
|
}
|
|
143
|
-
const i = this.closest("mint-button") || ((a = this.parentElement) == null ? void 0 : a.closest("mint-button")), s = this.closest("mint-switch") || ((
|
|
137
|
+
const i = this.closest("mint-button") || ((a = this.parentElement) == null ? void 0 : a.closest("mint-button")), s = this.closest("mint-switch") || ((c = this.parentElement) == null ? void 0 : c.closest("mint-switch"));
|
|
144
138
|
let r;
|
|
145
139
|
s ? r = "w-3 h-3" : i ? r = "w-5 h-5" : r = "w-[1.3em] h-[1.3em]", this.classList.remove("w-4", "h-4", "w-5", "h-5", "w-[1em]", "h-[1em]"), r.split(" ").forEach((o) => {
|
|
146
140
|
o && this.classList.add(o);
|
|
@@ -151,14 +145,14 @@ class V extends HTMLElement {
|
|
|
151
145
|
else if (i)
|
|
152
146
|
this.classList.remove("text-gray-100", "text-gray-900");
|
|
153
147
|
else {
|
|
154
|
-
const
|
|
155
|
-
this.classList.remove("text-gray-100", "text-gray-900"), this.classList.add(
|
|
148
|
+
const l = document.documentElement.classList.contains("dark") ? "text-gray-100" : "text-gray-900";
|
|
149
|
+
this.classList.remove("text-gray-100", "text-gray-900"), this.classList.add(l);
|
|
156
150
|
}
|
|
157
151
|
this.innerHTML = "";
|
|
158
152
|
}
|
|
159
153
|
}
|
|
160
|
-
customElements.get("mint-icon") || customElements.define("mint-icon",
|
|
161
|
-
class
|
|
154
|
+
customElements.get("mint-icon") || customElements.define("mint-icon", B);
|
|
155
|
+
class z extends HTMLElement {
|
|
162
156
|
constructor() {
|
|
163
157
|
super(), this._button = null, this._clickHandler = null, this._isHandlingClick = !1, this._handleMouseDown = () => {
|
|
164
158
|
this._button && !this.isDisabled() && !this.isLoading() && this._button.classList.add("mint-button-active");
|
|
@@ -216,11 +210,11 @@ class R extends HTMLElement {
|
|
|
216
210
|
const t = (s = this._button) == null ? void 0 : s.querySelector(".mint-button-content");
|
|
217
211
|
if (t && ((r = t.textContent) != null && r.trim())) return !1;
|
|
218
212
|
if (this._button)
|
|
219
|
-
for (let
|
|
220
|
-
if (
|
|
213
|
+
for (let c = this._button.firstChild; c; c = c.nextSibling) {
|
|
214
|
+
if (c.nodeType === Node.TEXT_NODE && ((n = c.textContent) != null && n.trim()))
|
|
221
215
|
return !1;
|
|
222
|
-
if (
|
|
223
|
-
const o =
|
|
216
|
+
if (c.nodeType === Node.ELEMENT_NODE) {
|
|
217
|
+
const o = c;
|
|
224
218
|
if (o.tagName !== "MINT-ICON" && o.tagName !== "MINT-SPINNER" && !o.querySelector("mint-spinner") && !o.hasAttribute("slot") && o.className !== "mint-button-icon" && !(o.className === "mr-2" && o.querySelector("mint-spinner")) && (a = o.textContent) != null && a.trim())
|
|
225
219
|
return !1;
|
|
226
220
|
}
|
|
@@ -536,14 +530,14 @@ class R extends HTMLElement {
|
|
|
536
530
|
"border-transparent"
|
|
537
531
|
// Match other button border width
|
|
538
532
|
]
|
|
539
|
-
}, n = `${t}-${s}`, a = r[n] || r["solid-neutral"],
|
|
533
|
+
}, n = `${t}-${s}`, a = r[n] || r["solid-neutral"], c = [
|
|
540
534
|
...i,
|
|
541
535
|
...a
|
|
542
536
|
];
|
|
543
|
-
return this.isFullWidth() &&
|
|
537
|
+
return this.isFullWidth() && c.push("w-full"), c.join(" ");
|
|
544
538
|
}
|
|
545
539
|
render() {
|
|
546
|
-
var
|
|
540
|
+
var l, d, h, u, b;
|
|
547
541
|
const e = this.isDisabled() || this.isLoading(), t = this.getType();
|
|
548
542
|
if (!this._button) {
|
|
549
543
|
for (this._button = document.createElement("button"); this.firstChild; )
|
|
@@ -556,12 +550,12 @@ class R extends HTMLElement {
|
|
|
556
550
|
if (i)
|
|
557
551
|
i.setAttribute("data-button-variant", this.getVariant()), i.setAttribute("data-button-tone", this.getTone()), "render" in i && typeof i.render == "function" && i.render();
|
|
558
552
|
else {
|
|
559
|
-
const
|
|
560
|
-
|
|
553
|
+
const f = document.createElement("span");
|
|
554
|
+
f.className = "mr-2 inline-flex items-center";
|
|
561
555
|
const _ = document.createElement("mint-spinner");
|
|
562
|
-
_.setAttribute("size", "default"), _.setAttribute("data-button-variant", this.getVariant()), _.setAttribute("data-button-tone", this.getTone()), _.style.width = "0.875rem", _.style.height = "0.875rem",
|
|
556
|
+
_.setAttribute("size", "default"), _.setAttribute("data-button-variant", this.getVariant()), _.setAttribute("data-button-tone", this.getTone()), _.style.width = "0.875rem", _.style.height = "0.875rem", f.appendChild(_), this._button.insertBefore(f, this._button.firstChild);
|
|
563
557
|
}
|
|
564
|
-
else i && ((
|
|
558
|
+
else i && ((l = i.parentElement) == null || l.remove());
|
|
565
559
|
for (; this.firstChild && this.firstChild !== this._button; )
|
|
566
560
|
this._button.appendChild(this.firstChild);
|
|
567
561
|
const s = this.getIcon();
|
|
@@ -570,38 +564,38 @@ class R extends HTMLElement {
|
|
|
570
564
|
const n = this.getIconPosition();
|
|
571
565
|
let a = this._button.querySelector(".mint-button-content");
|
|
572
566
|
if (a) {
|
|
573
|
-
const
|
|
567
|
+
const f = r && r.tagName === "MINT-ICON";
|
|
574
568
|
if (r && !r.parentElement) {
|
|
575
569
|
const _ = (u = this._button.querySelector("mint-spinner")) == null ? void 0 : u.parentElement;
|
|
576
|
-
|
|
577
|
-
} else if (r && (
|
|
570
|
+
f || n === "left" ? _ ? _.insertAdjacentElement("afterend", r) : this._button.insertBefore(r, a) : a.insertAdjacentElement("afterend", r);
|
|
571
|
+
} else if (r && (f || n === "left") && r.nextSibling !== a) {
|
|
578
572
|
r.remove();
|
|
579
|
-
const _ = (
|
|
573
|
+
const _ = (b = this._button.querySelector("mint-spinner")) == null ? void 0 : b.parentElement;
|
|
580
574
|
_ ? _.insertAdjacentElement("afterend", r) : this._button.insertBefore(r, a);
|
|
581
|
-
} else r && !
|
|
575
|
+
} else r && !f && n === "right" && r.previousSibling !== a && (r.remove(), a.insertAdjacentElement("afterend", r));
|
|
582
576
|
} else {
|
|
583
|
-
const
|
|
577
|
+
const f = [];
|
|
584
578
|
for (let _ = this._button.firstChild; _; _ = _.nextSibling) {
|
|
585
579
|
if (_.nodeType !== Node.ELEMENT_NODE) {
|
|
586
|
-
|
|
580
|
+
f.push(_);
|
|
587
581
|
continue;
|
|
588
582
|
}
|
|
589
583
|
const m = _;
|
|
590
|
-
m.tagName !== "MINT-SPINNER" && !m.querySelector("mint-spinner") && _ !== r && !m.hasAttribute("slot") && !(m.className === "mr-2" && m.querySelector("mint-spinner")) &&
|
|
584
|
+
m.tagName !== "MINT-SPINNER" && !m.querySelector("mint-spinner") && _ !== r && !m.hasAttribute("slot") && !(m.className === "mr-2" && m.querySelector("mint-spinner")) && f.push(_);
|
|
591
585
|
}
|
|
592
|
-
if (
|
|
593
|
-
a = document.createElement("span"), a.className = "mint-button-content inline-flex items-center",
|
|
586
|
+
if (f.length > 0) {
|
|
587
|
+
a = document.createElement("span"), a.className = "mint-button-content inline-flex items-center", f.forEach((m) => {
|
|
594
588
|
a.appendChild(m);
|
|
595
589
|
});
|
|
596
|
-
const _ = (
|
|
590
|
+
const _ = (d = this._button.querySelector("mint-spinner")) == null ? void 0 : d.parentElement;
|
|
597
591
|
r && n === "left" ? _ ? (_.insertAdjacentElement("afterend", r), r.insertAdjacentElement("afterend", a)) : (this._button.insertBefore(r, this._button.firstChild), r.insertAdjacentElement("afterend", a)) : r && n === "right" ? _ ? (_.insertAdjacentElement("afterend", a), a.insertAdjacentElement("afterend", r)) : (this._button.insertBefore(a, this._button.firstChild), a.insertAdjacentElement("afterend", r)) : _ ? _.insertAdjacentElement("afterend", a) : this._button.insertBefore(a, this._button.firstChild);
|
|
598
592
|
} else if (r && r.tagName === "MINT-ICON" && !r.parentElement) {
|
|
599
|
-
const _ = (
|
|
593
|
+
const _ = (h = this._button.querySelector("mint-spinner")) == null ? void 0 : h.parentElement;
|
|
600
594
|
_ ? _.insertAdjacentElement("afterend", r) : this._button.insertBefore(r, this._button.firstChild);
|
|
601
595
|
}
|
|
602
596
|
}
|
|
603
|
-
const
|
|
604
|
-
r && (r.classList.contains("mint-button-icon") || r.classList.add("mint-button-icon"), r.classList.remove("mr-1.5", "ml-1.5"),
|
|
597
|
+
const c = this.isIconOnly();
|
|
598
|
+
r && (r.classList.contains("mint-button-icon") || r.classList.add("mint-button-icon"), r.classList.remove("mr-1.5", "ml-1.5"), c ? r.tagName === "MINT-ICON" ? (r.style.width = "1rem", r.style.height = "1rem", r.style.maxWidth = "1rem", r.style.maxHeight = "1rem", r.style.flexShrink = "0") : (r.style.maxWidth = "1rem", r.style.maxHeight = "1rem", r.style.flexShrink = "0", r.tagName === "svg" && (r.style.width = "1rem", r.style.height = "1rem")) : n === "left" ? r.classList.add("mr-1.5") : r.classList.add("ml-1.5"));
|
|
605
599
|
const o = this.getButtonClasses();
|
|
606
600
|
this._button.className = o;
|
|
607
601
|
}
|
|
@@ -632,8 +626,8 @@ class R extends HTMLElement {
|
|
|
632
626
|
});
|
|
633
627
|
}
|
|
634
628
|
}
|
|
635
|
-
customElements.get("mint-button") || customElements.define("mint-button",
|
|
636
|
-
class
|
|
629
|
+
customElements.get("mint-button") || customElements.define("mint-button", z);
|
|
630
|
+
class V extends HTMLElement {
|
|
637
631
|
constructor() {
|
|
638
632
|
super(), this._button = null, this._checked = !1;
|
|
639
633
|
}
|
|
@@ -735,8 +729,8 @@ class W extends HTMLElement {
|
|
|
735
729
|
if (s) {
|
|
736
730
|
let a = n;
|
|
737
731
|
a || (a = document.createElement("span"), a.className = this.getIconClasses(), r.appendChild(a));
|
|
738
|
-
let
|
|
739
|
-
|
|
732
|
+
let c = a.querySelector("mint-icon");
|
|
733
|
+
c || (c = document.createElement("mint-icon"), a.appendChild(c)), c.setAttribute("name", s);
|
|
740
734
|
} else n && n.remove();
|
|
741
735
|
}
|
|
742
736
|
setupEventListeners() {
|
|
@@ -761,8 +755,8 @@ class W extends HTMLElement {
|
|
|
761
755
|
));
|
|
762
756
|
}
|
|
763
757
|
}
|
|
764
|
-
customElements.get("mint-switch") || customElements.define("mint-switch",
|
|
765
|
-
class
|
|
758
|
+
customElements.get("mint-switch") || customElements.define("mint-switch", V);
|
|
759
|
+
class R extends HTMLElement {
|
|
766
760
|
// Store classes set via class attribute
|
|
767
761
|
constructor() {
|
|
768
762
|
super(), this._darkModeObserver = null, this._userClasses = /* @__PURE__ */ new Set();
|
|
@@ -868,12 +862,12 @@ class j extends HTMLElement {
|
|
|
868
862
|
// Scales between 1rem (16px) and 1.125rem (18px)
|
|
869
863
|
regular: "clamp(0.875rem, 1vw + 0.5rem, 0.875rem)"
|
|
870
864
|
// Scales between 0.875rem (14px) and 0.875rem (14px)
|
|
871
|
-
},
|
|
872
|
-
this.style.setProperty("font-size",
|
|
865
|
+
}, c = a[e] || a.regular;
|
|
866
|
+
this.style.setProperty("font-size", c);
|
|
873
867
|
}
|
|
874
868
|
}
|
|
875
|
-
customElements.get("mint-text") || customElements.define("mint-text",
|
|
876
|
-
class
|
|
869
|
+
customElements.get("mint-text") || customElements.define("mint-text", R);
|
|
870
|
+
class W extends HTMLElement {
|
|
877
871
|
constructor() {
|
|
878
872
|
super(), this._childObserver = null;
|
|
879
873
|
}
|
|
@@ -978,8 +972,8 @@ class $ extends HTMLElement {
|
|
|
978
972
|
});
|
|
979
973
|
}
|
|
980
974
|
}
|
|
981
|
-
customElements.get("mint-stack") || customElements.define("mint-stack",
|
|
982
|
-
class
|
|
975
|
+
customElements.get("mint-stack") || customElements.define("mint-stack", W);
|
|
976
|
+
class j extends HTMLElement {
|
|
983
977
|
static get observedAttributes() {
|
|
984
978
|
return [];
|
|
985
979
|
}
|
|
@@ -996,8 +990,8 @@ class Y extends HTMLElement {
|
|
|
996
990
|
this.classList.add("rounded-lg", "shadow", "bg-white", "dark:bg-gray-800", "border", "border-gray-200", "dark:border-gray-700", "overflow-hidden", "transition-colors", "duration-200");
|
|
997
991
|
}
|
|
998
992
|
}
|
|
999
|
-
customElements.get("mint-card") || customElements.define("mint-card",
|
|
1000
|
-
class
|
|
993
|
+
customElements.get("mint-card") || customElements.define("mint-card", j);
|
|
994
|
+
class $ extends HTMLElement {
|
|
1001
995
|
constructor() {
|
|
1002
996
|
super(), this._link = null, this._contentObserver = null;
|
|
1003
997
|
}
|
|
@@ -1063,8 +1057,8 @@ class U extends HTMLElement {
|
|
|
1063
1057
|
});
|
|
1064
1058
|
}
|
|
1065
1059
|
}
|
|
1066
|
-
customElements.get("mint-link") || customElements.define("mint-link",
|
|
1067
|
-
class
|
|
1060
|
+
customElements.get("mint-link") || customElements.define("mint-link", $);
|
|
1061
|
+
class Y extends HTMLElement {
|
|
1068
1062
|
constructor() {
|
|
1069
1063
|
super(), this._button = null, this._historyDepth = 0, this._maxBackAttempts = 10, this._backAttempts = 0, this._initialUrl = "", this._initialOrigin = "", this._popstateHandler = null;
|
|
1070
1064
|
}
|
|
@@ -1164,17 +1158,20 @@ class J extends HTMLElement {
|
|
|
1164
1158
|
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));
|
|
1165
1159
|
}
|
|
1166
1160
|
}
|
|
1167
|
-
customElements.get("mint-back-button") || customElements.define("mint-back-button",
|
|
1168
|
-
class
|
|
1161
|
+
customElements.get("mint-back-button") || customElements.define("mint-back-button", Y);
|
|
1162
|
+
class U extends HTMLElement {
|
|
1169
1163
|
constructor() {
|
|
1170
1164
|
super(), this._pageContainer = null, this._header = null, this._titleElement = null, this._headingText = null, this._actionsSlot = null, this._bodySlot = null, this._darkModeObserver = null;
|
|
1171
1165
|
}
|
|
1172
1166
|
static get observedAttributes() {
|
|
1173
|
-
return ["heading", "fallback-href", "show-back-button"];
|
|
1167
|
+
return ["heading", "fallback-href", "show-back-button", "containered"];
|
|
1174
1168
|
}
|
|
1175
1169
|
connectedCallback() {
|
|
1176
1170
|
this.classList.add("box-border", "m-0", "p-0", "border-0", "align-baseline", "block"), this.render(), this._observeDarkMode();
|
|
1177
1171
|
}
|
|
1172
|
+
attributeChangedCallback(e, t, i) {
|
|
1173
|
+
t !== i && this.render();
|
|
1174
|
+
}
|
|
1178
1175
|
disconnectedCallback() {
|
|
1179
1176
|
this._darkModeObserver && (this._darkModeObserver.disconnect(), this._darkModeObserver = null);
|
|
1180
1177
|
}
|
|
@@ -1189,7 +1186,7 @@ class G extends HTMLElement {
|
|
|
1189
1186
|
}
|
|
1190
1187
|
render() {
|
|
1191
1188
|
const e = this.getHeading();
|
|
1192
|
-
this._pageContainer || (this._pageContainer = document.createElement("div"), this.
|
|
1189
|
+
this._pageContainer || (this._pageContainer = document.createElement("div"), this.appendChild(this._pageContainer)), this._applyContainerClasses(), this._header || (this._header = document.createElement("div"), this._header.className = "flex justify-between mb-8", this._pageContainer.appendChild(this._header)), this._titleElement || (this._titleElement = document.createElement("div"), this._titleElement.className = "flex gap-4 min-w-0 flex-1", this._header.appendChild(this._titleElement));
|
|
1193
1190
|
let t = this._titleElement.querySelector("mint-back-button");
|
|
1194
1191
|
if (this.shouldShowBackButton()) {
|
|
1195
1192
|
t || (t = document.createElement("mint-back-button"), this._titleElement.insertBefore(t, this._titleElement.firstChild));
|
|
@@ -1199,11 +1196,14 @@ class G extends HTMLElement {
|
|
|
1199
1196
|
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(
|
|
1200
1197
|
(n) => n !== this._pageContainer && n !== this._actionsSlot && n.getAttribute("slot") === "actions"
|
|
1201
1198
|
).forEach((n) => {
|
|
1202
|
-
n.parentElement !== this._actionsSlot && this._actionsSlot.appendChild(n);
|
|
1199
|
+
this._actionsSlot && n.parentElement !== this._actionsSlot && this._actionsSlot.appendChild(n);
|
|
1203
1200
|
}), this._bodySlot || (this._bodySlot = document.createElement("div"), this._pageContainer.appendChild(this._bodySlot)), Array.from(this.children).forEach((n) => {
|
|
1204
1201
|
n !== this._pageContainer && n.getAttribute("slot") !== "actions" && n !== this._actionsSlot && n !== this._header && n !== this._bodySlot && n !== this._headingText && n.parentElement !== this._bodySlot && n.parentElement !== this._pageContainer && this._bodySlot.appendChild(n);
|
|
1205
1202
|
}), this._updateBackgroundColor();
|
|
1206
1203
|
}
|
|
1204
|
+
_applyContainerClasses() {
|
|
1205
|
+
this._pageContainer && (this._pageContainer.classList.add("min-h-screen", "p-8", "transition-colors", "duration-200"), this.hasAttribute("containered") ? this._pageContainer.classList.add("max-w-6xl", "mx-auto", "w-full") : this._pageContainer.classList.remove("max-w-6xl", "mx-auto"));
|
|
1206
|
+
}
|
|
1207
1207
|
_updateBackgroundColor() {
|
|
1208
1208
|
if (!this._pageContainer) return;
|
|
1209
1209
|
document.documentElement.classList.contains("dark") ? (this._pageContainer.classList.remove("bg-gray-20"), this._pageContainer.classList.add("bg-gray-900")) : (this._pageContainer.classList.remove("bg-gray-900"), this._pageContainer.classList.add("bg-gray-20"));
|
|
@@ -1217,8 +1217,8 @@ class G extends HTMLElement {
|
|
|
1217
1217
|
}));
|
|
1218
1218
|
}
|
|
1219
1219
|
}
|
|
1220
|
-
customElements.get("mint-page") || customElements.define("mint-page",
|
|
1221
|
-
class
|
|
1220
|
+
customElements.get("mint-page") || customElements.define("mint-page", U);
|
|
1221
|
+
class G extends HTMLElement {
|
|
1222
1222
|
static get observedAttributes() {
|
|
1223
1223
|
return ["columns", "sm", "md", "lg", "xl", "gap"];
|
|
1224
1224
|
}
|
|
@@ -1271,16 +1271,8 @@ class X extends HTMLElement {
|
|
|
1271
1271
|
});
|
|
1272
1272
|
}
|
|
1273
1273
|
}
|
|
1274
|
-
customElements.get("mint-grid") || customElements.define("mint-grid",
|
|
1275
|
-
|
|
1276
|
-
name: "close",
|
|
1277
|
-
viewBox: "0 0 24 24",
|
|
1278
|
-
path: "M6 18L18 6M6 6l12 12",
|
|
1279
|
-
strokeLinecap: "round",
|
|
1280
|
-
strokeLinejoin: "round"
|
|
1281
|
-
};
|
|
1282
|
-
P(K);
|
|
1283
|
-
class Z extends HTMLElement {
|
|
1274
|
+
customElements.get("mint-grid") || customElements.define("mint-grid", G);
|
|
1275
|
+
class J extends HTMLElement {
|
|
1284
1276
|
constructor() {
|
|
1285
1277
|
super(), this._overlay = null, this._modal = null, this._header = null, this._headingSlot = null, this._bodySlot = null, this._actionsSlot = null, this._closeButton = null, this._darkModeObserver = null;
|
|
1286
1278
|
}
|
|
@@ -1314,31 +1306,31 @@ class Z extends HTMLElement {
|
|
|
1314
1306
|
render() {
|
|
1315
1307
|
const e = this.getId(), t = this.getHeading(), i = this.isOpen();
|
|
1316
1308
|
if (e && (this.id = e), this._overlay || (this._overlay = document.createElement("div"), this._overlay.className = "fixed inset-0 bg-black bg-opacity-50 transition-opacity duration-200 z-40", this._overlay.addEventListener("click", () => this.close()), this.appendChild(this._overlay)), this._modal || (this._modal = document.createElement("div"), this._modal.className = "fixed inset-0 flex items-center justify-center p-2 pointer-events-none z-50", this.appendChild(this._modal)), i) {
|
|
1317
|
-
let
|
|
1318
|
-
|
|
1309
|
+
let d = this._modal.querySelector(".modal-content");
|
|
1310
|
+
d || (d = document.createElement("div"), d.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(d)), this._animateEnter();
|
|
1319
1311
|
} else
|
|
1320
1312
|
this._animateExit();
|
|
1321
1313
|
let s = this._modal.querySelector(".modal-content");
|
|
1322
1314
|
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));
|
|
1323
1315
|
let r = this._headingSlot.querySelector("mint-text");
|
|
1324
1316
|
t ? (r || (r = document.createElement("mint-text"), r.setAttribute("size", "sub-heading"), r.setAttribute("bold", ""), this._headingSlot.appendChild(r)), r.textContent = t) : r && r.remove(), Array.from(this.children).filter(
|
|
1325
|
-
(
|
|
1326
|
-
).forEach((
|
|
1327
|
-
|
|
1317
|
+
(d) => d !== this._overlay && d !== this._modal && d !== this._headingSlot && d.getAttribute("slot") === "heading"
|
|
1318
|
+
).forEach((d) => {
|
|
1319
|
+
d.parentElement !== this._headingSlot && this._headingSlot.appendChild(d);
|
|
1328
1320
|
}), this._closeButton || (this._closeButton = document.createElement("mint-button"), this._closeButton.setAttribute("variant", "ghost"), this._closeButton.setAttribute("icon", "close"), this._closeButton.addEventListener("click", () => this.close()), this._header.appendChild(this._closeButton)), this._bodySlot || (this._bodySlot = document.createElement("div"), this._bodySlot.className = "flex-1 overflow-y-auto p-4", this._bodySlot.setAttribute("slot", "body"), s.appendChild(this._bodySlot)), Array.from(this.children).filter(
|
|
1329
|
-
(
|
|
1330
|
-
).forEach((
|
|
1331
|
-
|
|
1321
|
+
(d) => d !== this._overlay && d !== this._modal && d !== this._bodySlot && d.getAttribute("slot") === "body"
|
|
1322
|
+
).forEach((d) => {
|
|
1323
|
+
d.parentElement !== this._bodySlot && this._bodySlot.appendChild(d);
|
|
1332
1324
|
}), this._actionsSlot || (this._actionsSlot = document.createElement("div"), this._actionsSlot.className = "p-4 border-t border-gray-200 dark:border-gray-700", this._actionsSlot.setAttribute("slot", "actions"), s.appendChild(this._actionsSlot));
|
|
1333
|
-
let
|
|
1334
|
-
|
|
1335
|
-
(
|
|
1336
|
-
).forEach((
|
|
1337
|
-
Array.from(
|
|
1338
|
-
u.parentElement !==
|
|
1339
|
-
}),
|
|
1340
|
-
}), Array.from(this.children).forEach((
|
|
1341
|
-
|
|
1325
|
+
let c = this._actionsSlot.querySelector("mint-stack");
|
|
1326
|
+
c || (c = document.createElement("mint-stack"), c.setAttribute("direction", "horizontal"), c.className = "justify-end", this._actionsSlot.appendChild(c)), Array.from(this.children).filter(
|
|
1327
|
+
(d) => d !== this._overlay && d !== this._modal && d !== this._actionsSlot && d.getAttribute("slot") === "actions"
|
|
1328
|
+
).forEach((d) => {
|
|
1329
|
+
Array.from(d.children).forEach((u) => {
|
|
1330
|
+
u.parentElement !== c && c.appendChild(u);
|
|
1331
|
+
}), d.parentElement && d.remove();
|
|
1332
|
+
}), Array.from(this.children).forEach((d) => {
|
|
1333
|
+
d !== this._overlay && d !== this._modal && d.getAttribute("slot") !== "heading" && d.getAttribute("slot") !== "body" && d.getAttribute("slot") !== "actions" && d !== this._headingSlot && d !== this._bodySlot && d !== this._actionsSlot && d.parentElement !== this._bodySlot && this._bodySlot.appendChild(d);
|
|
1342
1334
|
}), this._updateBackgroundColor();
|
|
1343
1335
|
}
|
|
1344
1336
|
_updateBackgroundColor() {
|
|
@@ -1375,8 +1367,8 @@ class Z extends HTMLElement {
|
|
|
1375
1367
|
}, 200);
|
|
1376
1368
|
}
|
|
1377
1369
|
}
|
|
1378
|
-
customElements.get("mint-modal") || customElements.define("mint-modal",
|
|
1379
|
-
class
|
|
1370
|
+
customElements.get("mint-modal") || customElements.define("mint-modal", J);
|
|
1371
|
+
class X extends HTMLElement {
|
|
1380
1372
|
constructor() {
|
|
1381
1373
|
super(), this._overlay = null, this._popover = null, this._triggerElement = null, this._darkModeObserver = null, this._clickOutsideHandler = null, this._triggerClickHandler = null, this._triggerHoverEnterHandler = null, this._triggerHoverLeaveHandler = null, this._popoverHoverEnterHandler = null, this._popoverHoverLeaveHandler = null, this._hoverCloseTimeout = null, this._scrollHandler = null, this._resizeHandler = null;
|
|
1382
1374
|
}
|
|
@@ -1488,38 +1480,38 @@ class Q extends HTMLElement {
|
|
|
1488
1480
|
if (!t) return { top: 0, left: 0, direction: "down" };
|
|
1489
1481
|
this.classList.contains("hidden") && (this.classList.remove("hidden"), this._popover.style.visibility = "hidden");
|
|
1490
1482
|
const s = t.getBoundingClientRect(), r = window.innerWidth, n = window.innerHeight, a = 8;
|
|
1491
|
-
let
|
|
1492
|
-
switch (
|
|
1483
|
+
let c = this.getDirection(), o = 0, l = 0;
|
|
1484
|
+
switch (c) {
|
|
1493
1485
|
case "down":
|
|
1494
|
-
if (o = e.bottom + a,
|
|
1495
|
-
const
|
|
1496
|
-
|
|
1486
|
+
if (o = e.bottom + a, l = e.left + e.width / 2 - s.width / 2, o + s.height > n) {
|
|
1487
|
+
const d = e.top - s.height - a;
|
|
1488
|
+
d >= 0 ? (c = "up", o = d) : (o = Math.max(0, n - s.height - a), o + s.height > n && (o = 0));
|
|
1497
1489
|
}
|
|
1498
|
-
|
|
1490
|
+
l < 0 && (l = a), l + s.width > r && (l = Math.max(a, r - s.width - a), l + s.width > r && (l = r - s.width));
|
|
1499
1491
|
break;
|
|
1500
1492
|
case "up":
|
|
1501
|
-
if (o = e.top - s.height - a,
|
|
1502
|
-
const
|
|
1503
|
-
|
|
1493
|
+
if (o = e.top - s.height - a, l = e.left + e.width / 2 - s.width / 2, o < 0) {
|
|
1494
|
+
const d = e.bottom + a;
|
|
1495
|
+
d + s.height <= n ? (c = "down", o = d) : (o = Math.min(n - s.height - a, n - s.height), o < 0 && (o = n - s.height));
|
|
1504
1496
|
}
|
|
1505
|
-
|
|
1497
|
+
l < 0 && (l = a), l + s.width > r && (l = Math.max(a, r - s.width - a), l + s.width > r && (l = r - s.width));
|
|
1506
1498
|
break;
|
|
1507
1499
|
case "right":
|
|
1508
|
-
if (o = e.top + e.height / 2 - s.height / 2,
|
|
1509
|
-
const
|
|
1510
|
-
|
|
1500
|
+
if (o = e.top + e.height / 2 - s.height / 2, l = e.right + a, l + s.width > r) {
|
|
1501
|
+
const d = e.left - s.width - a;
|
|
1502
|
+
d >= 0 ? (c = "left", l = d) : (l = Math.max(0, r - s.width - a), l + s.width > r && (l = r - s.width));
|
|
1511
1503
|
}
|
|
1512
1504
|
o < 0 && (o = a), o + s.height > n && (o = Math.max(a, n - s.height - a), o + s.height > n && (o = n - s.height));
|
|
1513
1505
|
break;
|
|
1514
1506
|
case "left":
|
|
1515
|
-
if (o = e.top + e.height / 2 - s.height / 2,
|
|
1516
|
-
const
|
|
1517
|
-
|
|
1507
|
+
if (o = e.top + e.height / 2 - s.height / 2, l = e.left - s.width - a, l < 0) {
|
|
1508
|
+
const d = e.right + a;
|
|
1509
|
+
d + s.width <= r ? (c = "right", l = d) : (l = Math.min(r - s.width - a, r - s.width), l < 0 && (l = 0));
|
|
1518
1510
|
}
|
|
1519
1511
|
o < 0 && (o = a), o + s.height > n && (o = Math.max(a, n - s.height - a), o + s.height > n && (o = n - s.height));
|
|
1520
1512
|
break;
|
|
1521
1513
|
}
|
|
1522
|
-
return { top: o, left:
|
|
1514
|
+
return { top: o, left: l, direction: c };
|
|
1523
1515
|
}
|
|
1524
1516
|
render() {
|
|
1525
1517
|
const e = this.getId(), t = this.isOpen(), i = this.getPadding();
|
|
@@ -1527,8 +1519,8 @@ class Q extends HTMLElement {
|
|
|
1527
1519
|
if (this.classList.remove("hidden"), this.style.pointerEvents = "auto", !this._clickOutsideHandler) {
|
|
1528
1520
|
const n = this;
|
|
1529
1521
|
this._clickOutsideHandler = function(a) {
|
|
1530
|
-
const
|
|
1531
|
-
if (!(n._triggerElement &&
|
|
1522
|
+
const c = a.composedPath(), o = c.includes(n);
|
|
1523
|
+
if (!(n._triggerElement && c.includes(n._triggerElement)) && !o) {
|
|
1532
1524
|
n.close();
|
|
1533
1525
|
return;
|
|
1534
1526
|
}
|
|
@@ -1543,8 +1535,8 @@ class Q extends HTMLElement {
|
|
|
1543
1535
|
if (!s)
|
|
1544
1536
|
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);
|
|
1545
1537
|
else {
|
|
1546
|
-
const n = 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"],
|
|
1547
|
-
s.className = [...
|
|
1538
|
+
const n = 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"], c = n.filter((o) => !a.includes(o));
|
|
1539
|
+
s.className = [...c, i].join(" ");
|
|
1548
1540
|
}
|
|
1549
1541
|
Array.from(this.children).forEach((n) => {
|
|
1550
1542
|
n !== this._overlay && n !== this._popover && n.parentElement === this && s.appendChild(n);
|
|
@@ -1612,16 +1604,8 @@ class Q extends HTMLElement {
|
|
|
1612
1604
|
});
|
|
1613
1605
|
}
|
|
1614
1606
|
}
|
|
1615
|
-
customElements.get("mint-popover") || customElements.define("mint-popover",
|
|
1616
|
-
|
|
1617
|
-
name: "check",
|
|
1618
|
-
viewBox: "0 0 24 24",
|
|
1619
|
-
path: "M5 13l4 4L19 7",
|
|
1620
|
-
strokeLinecap: "round",
|
|
1621
|
-
strokeLinejoin: "round"
|
|
1622
|
-
};
|
|
1623
|
-
P(ee);
|
|
1624
|
-
class te extends HTMLElement {
|
|
1607
|
+
customElements.get("mint-popover") || customElements.define("mint-popover", X);
|
|
1608
|
+
class K extends HTMLElement {
|
|
1625
1609
|
constructor() {
|
|
1626
1610
|
super(), this._checkbox = null, this._checked = !1, this._clickHandler = null, this._changeHandler = null, this._mousedownHandler = null, this._mouseupHandler = null, this._mouseleaveHandler = null, this._touchstartHandler = null, this._touchendHandler = null, this._focusHandler = null, this._blurHandler = null;
|
|
1627
1611
|
}
|
|
@@ -1711,20 +1695,20 @@ class te extends HTMLElement {
|
|
|
1711
1695
|
n ? this._checkbox.name = n : this._checkbox.removeAttribute("name");
|
|
1712
1696
|
const a = this.getValue();
|
|
1713
1697
|
a ? this._checkbox.value = a : this._checkbox.removeAttribute("value"), e ? this._checkbox.setAttribute("aria-label", e) : this._checkbox.removeAttribute("aria-label"), s.className = `mint-checkbox-wrapper ${this.getCheckboxClasses()}`, s.style.pointerEvents = "none", this._checkbox.style.pointerEvents = "auto";
|
|
1714
|
-
let
|
|
1715
|
-
|
|
1698
|
+
let c = s.querySelector("mint-icon");
|
|
1699
|
+
c || (c = document.createElement("mint-icon"), c.setAttribute("name", "check"), c.className = "w-3.5 h-3.5 text-white pointer-events-none absolute inset-0 m-auto", c.style.transition = "opacity 200ms ease-out, transform 200ms ease-out", c.style.zIndex = "1", s.appendChild(c)), this.updateVisualState();
|
|
1716
1700
|
let o = this.querySelector(".mint-checkbox-label-container");
|
|
1717
1701
|
if (e || t) {
|
|
1718
1702
|
o || (o = document.createElement("div"), o.className = "mint-checkbox-label-container flex flex-col gap-0.5 flex-1", this.appendChild(o));
|
|
1719
|
-
let
|
|
1720
|
-
e ? (
|
|
1721
|
-
let
|
|
1722
|
-
if (t ? (
|
|
1703
|
+
let l = o.querySelector(".mint-checkbox-label");
|
|
1704
|
+
e ? (l || (l = document.createElement("span"), l.className = "mint-checkbox-label text-sm font-medium text-gray-900 dark:text-gray-100 cursor-pointer select-none", o.insertBefore(l, o.firstChild)), l.textContent = e, i ? l.classList.add("opacity-40") : l.classList.remove("opacity-40")) : l && l.remove();
|
|
1705
|
+
let d = o.querySelector(".mint-checkbox-info");
|
|
1706
|
+
if (t ? (d || (d = document.createElement("span"), d.className = "mint-checkbox-info text-xs text-gray-500 dark:text-gray-400 cursor-pointer select-none", o.appendChild(d)), d.textContent = t, i ? d.classList.add("opacity-40") : d.classList.remove("opacity-40")) : d && d.remove(), i)
|
|
1723
1707
|
o.style.cursor = "default", o._clickHandler && (o.removeEventListener("click", o._clickHandler), o._clickHandler = null);
|
|
1724
1708
|
else {
|
|
1725
1709
|
o.style.cursor = "pointer";
|
|
1726
|
-
const
|
|
1727
|
-
|
|
1710
|
+
const h = o._clickHandler;
|
|
1711
|
+
h && o.removeEventListener("click", h), o._clickHandler = (u) => {
|
|
1728
1712
|
this._checkbox && (u.target === this._checkbox || this._checkbox.contains(u.target) || u.composedPath().includes(this._checkbox)) || this.toggle();
|
|
1729
1713
|
}, o.addEventListener("click", o._clickHandler);
|
|
1730
1714
|
}
|
|
@@ -1787,8 +1771,8 @@ class te extends HTMLElement {
|
|
|
1787
1771
|
}
|
|
1788
1772
|
}
|
|
1789
1773
|
}
|
|
1790
|
-
customElements.get("mint-checkbox") || customElements.define("mint-checkbox",
|
|
1791
|
-
class
|
|
1774
|
+
customElements.get("mint-checkbox") || customElements.define("mint-checkbox", K);
|
|
1775
|
+
class Z extends HTMLElement {
|
|
1792
1776
|
constructor() {
|
|
1793
1777
|
super(), this._radio = null, this._checked = !1, this._changeHandler = null, this._groupChangeHandler = null, this._clickHandler = null, this._mousedownHandler = null, this._mouseupHandler = null, this._mouseleaveHandler = null, this._touchstartHandler = null, this._touchendHandler = null, this._focusHandler = null, this._blurHandler = null;
|
|
1794
1778
|
}
|
|
@@ -1878,20 +1862,20 @@ class ie extends HTMLElement {
|
|
|
1878
1862
|
n ? this._radio.name = n : this._radio.removeAttribute("name");
|
|
1879
1863
|
const a = this.getValue();
|
|
1880
1864
|
a ? this._radio.value = a : this._radio.removeAttribute("value"), e ? this._radio.setAttribute("aria-label", e) : this._radio.removeAttribute("aria-label"), s.className = `mint-choice-wrapper ${this.getChoiceClasses()}`, s.style.pointerEvents = "none", this._radio.style.pointerEvents = "auto";
|
|
1881
|
-
let
|
|
1882
|
-
|
|
1865
|
+
let c = s.querySelector(".mint-choice-indicator");
|
|
1866
|
+
c || (c = document.createElement("div"), c.className = "mint-choice-indicator w-2.5 h-2.5 rounded-full bg-white pointer-events-none absolute inset-0 m-auto", c.style.transition = "opacity 200ms ease-out, transform 200ms ease-out", c.style.zIndex = "1", s.appendChild(c)), c.style.opacity = this._checked ? "1" : "0", c.style.transform = this._checked ? "scale(1)" : "scale(0.8)", this.updateVisualState();
|
|
1883
1867
|
let o = this.querySelector(".mint-choice-label-container");
|
|
1884
1868
|
if (e || t) {
|
|
1885
1869
|
o || (o = document.createElement("div"), o.className = "mint-choice-label-container flex flex-col gap-0.5 flex-1", this.appendChild(o));
|
|
1886
|
-
let
|
|
1887
|
-
e ? (
|
|
1888
|
-
let
|
|
1889
|
-
if (t ? (
|
|
1870
|
+
let l = o.querySelector(".mint-choice-label");
|
|
1871
|
+
e ? (l || (l = document.createElement("span"), l.className = "mint-choice-label text-sm font-medium text-gray-900 dark:text-gray-100 cursor-pointer select-none", o.insertBefore(l, o.firstChild)), l.textContent = e, i ? l.classList.add("opacity-40") : l.classList.remove("opacity-40")) : l && l.remove();
|
|
1872
|
+
let d = o.querySelector(".mint-choice-info");
|
|
1873
|
+
if (t ? (d || (d = document.createElement("span"), d.className = "mint-choice-info text-xs text-gray-500 dark:text-gray-400 cursor-pointer select-none", o.appendChild(d)), d.textContent = t, i ? d.classList.add("opacity-40") : d.classList.remove("opacity-40")) : d && d.remove(), i)
|
|
1890
1874
|
o.style.cursor = "default", o._clickHandler && (o.removeEventListener("click", o._clickHandler), o._clickHandler = null);
|
|
1891
1875
|
else {
|
|
1892
1876
|
o.style.cursor = "pointer";
|
|
1893
|
-
const
|
|
1894
|
-
|
|
1877
|
+
const h = o._clickHandler;
|
|
1878
|
+
h && o.removeEventListener("click", h), o._clickHandler = (u) => {
|
|
1895
1879
|
this._radio && (u.target === this._radio || this._radio.contains(u.target) || u.composedPath().includes(this._radio)) || this.select();
|
|
1896
1880
|
}, o.addEventListener("click", o._clickHandler);
|
|
1897
1881
|
}
|
|
@@ -1988,8 +1972,8 @@ class ie extends HTMLElement {
|
|
|
1988
1972
|
}
|
|
1989
1973
|
}
|
|
1990
1974
|
}
|
|
1991
|
-
customElements.get("mint-choice") || customElements.define("mint-choice",
|
|
1992
|
-
class
|
|
1975
|
+
customElements.get("mint-choice") || customElements.define("mint-choice", Z);
|
|
1976
|
+
class Q extends HTMLElement {
|
|
1993
1977
|
constructor() {
|
|
1994
1978
|
super(), this._input = null, this._textarea = null, this._element = null, this._wrapper = null, this._icon = null, this._colorPicker = null, this._colorTextInput = null, this._colorContainer = null, this._colorPickerWrapper = null, this._numberSpinnerContainer = null, this._numberIncrementButton = null, this._numberDecrementButton = null, this._focusHandler = null, this._blurHandler = null, this._clickHandler = null, this._clickOutsideHandler = null;
|
|
1995
1979
|
}
|
|
@@ -2106,19 +2090,19 @@ class se extends HTMLElement {
|
|
|
2106
2090
|
], a = [
|
|
2107
2091
|
"border-2",
|
|
2108
2092
|
r ? "border-red-300 dark:border-red-300" : "border-gray-200 dark:border-gray-600"
|
|
2109
|
-
],
|
|
2093
|
+
], c = [
|
|
2110
2094
|
"focus-visible:ring-2",
|
|
2111
2095
|
"focus-visible:ring-offset-1",
|
|
2112
2096
|
r ? "focus-visible:ring-red-400 dark:focus-visible:ring-red-500" : "focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500"
|
|
2113
2097
|
];
|
|
2114
|
-
return [...n, ...a, ...
|
|
2098
|
+
return [...n, ...a, ...c].filter(Boolean).join(" ");
|
|
2115
2099
|
}
|
|
2116
2100
|
render() {
|
|
2117
|
-
var v,
|
|
2101
|
+
var v, E, S, y;
|
|
2118
2102
|
this.getType();
|
|
2119
|
-
const e = this._getNormalizedType(), t = this._isTextarea(), i = this._isMoney(), s = this._isColor(), r = this.getPlaceholder(), n = this.isDisabled(), a = this.isReadonly(),
|
|
2103
|
+
const e = this._getNormalizedType(), t = this._isTextarea(), i = this._isMoney(), s = this._isColor(), r = this.getPlaceholder(), n = this.isDisabled(), a = this.isReadonly(), c = this.isRequired(), o = this.getId(), l = this.getName(), d = this.getAttribute("value") || (s ? "#000000" : ""), h = this.getRows(), u = this.getIcon(), b = this.getLabel(), f = this.getInfo();
|
|
2120
2104
|
if (s) {
|
|
2121
|
-
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 =
|
|
2105
|
+
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 = d || "#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 = (p) => {
|
|
2122
2106
|
this._colorPickerWrapper && this._colorPicker && this._colorPicker.matches(":focus-visible") && requestAnimationFrame(() => {
|
|
2123
2107
|
var k;
|
|
2124
2108
|
this._colorPicker && this._colorPicker.matches(":focus-visible") && ((k = this._colorPickerWrapper) == null || k.classList.add("ring-2", "ring-offset-1", "ring-gray-400", "dark:ring-gray-500"));
|
|
@@ -2150,18 +2134,18 @@ class se extends HTMLElement {
|
|
|
2150
2134
|
cancelable: !0
|
|
2151
2135
|
})));
|
|
2152
2136
|
}), this._colorTextInput.addEventListener("blur", () => {
|
|
2153
|
-
var k,
|
|
2137
|
+
var k, x;
|
|
2154
2138
|
const p = ((k = this._colorTextInput) == null ? void 0 : k.value) || "";
|
|
2155
2139
|
/^#[0-9A-Fa-f]{6}$/.test(p) ? (this._colorPicker && (this._colorPicker.value = p), this.setAttribute("value", p)) : this._colorPicker && this._colorTextInput && (this._colorTextInput.value = this._colorPicker.value), this.dispatchEvent(new CustomEvent("change", {
|
|
2156
|
-
detail: { value: ((
|
|
2140
|
+
detail: { value: ((x = this._colorPicker) == null ? void 0 : x.value) || "#000000" },
|
|
2157
2141
|
bubbles: !0,
|
|
2158
2142
|
cancelable: !0
|
|
2159
2143
|
}));
|
|
2160
2144
|
}));
|
|
2161
|
-
const
|
|
2162
|
-
if (this._colorPicker && this._colorPicker.value !==
|
|
2145
|
+
const g = d || "#000000";
|
|
2146
|
+
if (this._colorPicker && this._colorPicker.value !== g && (this._colorPicker.value = g), this._colorPickerWrapper && (this._colorPickerWrapper.style.backgroundColor = g), this._colorTextInput && this._colorTextInput.value !== g && (this._colorTextInput.value = g), this._colorPicker && (this._colorPicker.disabled = n), this._colorPickerWrapper && (n ? (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 = n, this._colorTextInput.readOnly = a, this._colorTextInput.required = c), this._colorTextInput) {
|
|
2163
2147
|
const p = this._colorTextInput;
|
|
2164
|
-
o ? p.id = o : p.removeAttribute("id"),
|
|
2148
|
+
o ? p.id = o : p.removeAttribute("id"), l ? p.name = l : p.removeAttribute("name"), p.setAttribute("aria-invalid", this.hasError() ? "true" : "false"), this._element = p;
|
|
2165
2149
|
}
|
|
2166
2150
|
this._renderErrorState();
|
|
2167
2151
|
return;
|
|
@@ -2169,51 +2153,51 @@ class se extends HTMLElement {
|
|
|
2169
2153
|
if (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._colorPicker = null, this._colorTextInput = null), this._colorPickerWrapper && !s && (this._colorPickerWrapper.remove(), this._colorPickerWrapper = null, this._colorPicker = null, this._colorTextInput = null), u && !t ? this._icon ? this._icon.setAttribute("name", u) : (this._icon = document.createElement("mint-icon"), this._icon.setAttribute("name", u), this._icon.className = "absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400 dark:text-gray-500 pointer-events-none", this._wrapper.appendChild(this._icon)) : this._icon && (this._icon.remove(), this._icon = null), this._isNumber() && !t) {
|
|
2170
2154
|
if (!this._numberSpinnerContainer) {
|
|
2171
2155
|
this._numberSpinnerContainer = document.createElement("div"), this._numberSpinnerContainer.className = "absolute right-1 top-1/2 -translate-y-1/2 flex flex-col h-8 pointer-events-none", this._wrapper.appendChild(this._numberSpinnerContainer), this._numberIncrementButton = document.createElement("button"), this._numberIncrementButton.type = "button", this._numberIncrementButton.className = "flex items-center justify-center w-5 h-4 text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 disabled:opacity-40 disabled:cursor-not-allowed transition-colors pointer-events-auto bg-gray-100 dark:bg-gray-600 active:bg-gray-200 dark:active:bg-gray-500 rounded";
|
|
2172
|
-
const
|
|
2173
|
-
|
|
2156
|
+
const g = document.createElement("mint-icon");
|
|
2157
|
+
g.setAttribute("name", "caret-up"), g.className = "w-[1rem] h-[1rem]", this._numberIncrementButton.appendChild(g), this._numberSpinnerContainer.appendChild(this._numberIncrementButton), this._numberDecrementButton = document.createElement("button"), this._numberDecrementButton.type = "button", this._numberDecrementButton.className = "flex items-center justify-center w-5 h-4 text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 disabled:opacity-40 disabled:cursor-not-allowed transition-colors pointer-events-auto bg-gray-100 dark:bg-gray-600 active:bg-gray-200 dark:active:bg-gray-500 rounded";
|
|
2174
2158
|
const p = document.createElement("mint-icon");
|
|
2175
2159
|
p.setAttribute("name", "caret-down"), p.className = "w-[1rem] h-[1rem]", this._numberDecrementButton.appendChild(p), this._numberSpinnerContainer.appendChild(this._numberDecrementButton), this._numberIncrementButton.addEventListener("click", (k) => {
|
|
2176
2160
|
if (k.preventDefault(), k.stopPropagation(), this._input && !this._input.disabled && !this._input.readOnly) {
|
|
2177
|
-
const
|
|
2178
|
-
let L =
|
|
2179
|
-
|
|
2161
|
+
const x = parseFloat(this._input.value) || 0, I = parseFloat(this._input.step) || 1, C = this._input.min ? parseFloat(this._input.min) : void 0, w = this._input.max ? parseFloat(this._input.max) : void 0;
|
|
2162
|
+
let L = x + I;
|
|
2163
|
+
w !== void 0 && L > w && (L = w), C !== void 0 && L < C && (L = C), this._input.value = L.toString(), this.setAttribute("value", L.toString()), this._input.dispatchEvent(new Event("input", { bubbles: !0 })), this._input.dispatchEvent(new Event("change", { bubbles: !0 }));
|
|
2180
2164
|
}
|
|
2181
2165
|
}), this._numberDecrementButton.addEventListener("click", (k) => {
|
|
2182
2166
|
if (k.preventDefault(), k.stopPropagation(), this._input && !this._input.disabled && !this._input.readOnly) {
|
|
2183
|
-
const
|
|
2184
|
-
let L =
|
|
2185
|
-
|
|
2167
|
+
const x = parseFloat(this._input.value) || 0, I = parseFloat(this._input.step) || 1, C = this._input.min ? parseFloat(this._input.min) : void 0, w = this._input.max ? parseFloat(this._input.max) : void 0;
|
|
2168
|
+
let L = x - I;
|
|
2169
|
+
C !== void 0 && L < C && (L = C), w !== void 0 && L > w && (L = w), this._input.value = L.toString(), this.setAttribute("value", L.toString()), this._input.dispatchEvent(new Event("input", { bubbles: !0 })), this._input.dispatchEvent(new Event("change", { bubbles: !0 }));
|
|
2186
2170
|
}
|
|
2187
2171
|
});
|
|
2188
2172
|
}
|
|
2189
2173
|
this._numberIncrementButton && (this._numberIncrementButton.disabled = n || a), this._numberDecrementButton && (this._numberDecrementButton.disabled = n || a);
|
|
2190
2174
|
} else this._numberSpinnerContainer && (this._numberSpinnerContainer.remove(), this._numberSpinnerContainer = null, this._numberIncrementButton = null, this._numberDecrementButton = null);
|
|
2191
2175
|
if (t) {
|
|
2192
|
-
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 = r, this._textarea.disabled = n, this._textarea.readOnly = a, this._textarea.required =
|
|
2193
|
-
const
|
|
2194
|
-
|
|
2176
|
+
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 = r, this._textarea.disabled = n, this._textarea.readOnly = a, this._textarea.required = c, this._textarea.rows = h, this._textarea.setAttribute("aria-invalid", this.hasError() ? "true" : "false"), d !== this._textarea.value && (this._textarea.value = d), o ? this._textarea.id = o : this._textarea.removeAttribute("id"), l ? this._textarea.name = l : this._textarea.removeAttribute("name"), this._textarea.className = this.getInputClasses(), this.firstChild && this.firstChild !== this._wrapper && this.firstChild.nodeType === Node.TEXT_NODE) {
|
|
2177
|
+
const g = this.firstChild.textContent;
|
|
2178
|
+
g && !this._textarea.value && (this._textarea.value = g.trim()), this.removeChild(this.firstChild);
|
|
2195
2179
|
}
|
|
2196
|
-
} 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 = r, this._input.disabled = n, this._input.readOnly = a, this._input.required =
|
|
2197
|
-
const
|
|
2198
|
-
|
|
2180
|
+
} 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 = r, this._input.disabled = n, this._input.readOnly = a, this._input.required = c, 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")), d !== this._input.value && (this._input.value = d), o ? this._input.id = o : this._input.removeAttribute("id"), l ? this._input.name = l : this._input.removeAttribute("name"), this._input.className = this.getInputClasses(), this.firstChild && this.firstChild !== this._wrapper && this.firstChild.nodeType === Node.TEXT_NODE) {
|
|
2181
|
+
const g = this.firstChild.textContent;
|
|
2182
|
+
g && !this._input.value && (this._input.value = g.trim()), this.removeChild(this.firstChild);
|
|
2199
2183
|
}
|
|
2200
2184
|
let m = this.querySelector(".mint-input-label-container");
|
|
2201
|
-
if (
|
|
2185
|
+
if (b || f) {
|
|
2202
2186
|
m || (m = document.createElement("div"), m.className = "mint-input-label-container flex flex-col gap-0.5 mb-[.25rem]", this._wrapper && this._wrapper.parentElement === this ? this.insertBefore(m, this._wrapper) : this.insertBefore(m, this.firstChild));
|
|
2203
|
-
let
|
|
2204
|
-
if (
|
|
2205
|
-
|
|
2206
|
-
const k = o || ((v = this._element) == null ? void 0 : v.id) || ((
|
|
2187
|
+
let g = m.querySelector(".mint-input-label");
|
|
2188
|
+
if (b) {
|
|
2189
|
+
g || (g = document.createElement("label"), g.className = "mint-input-label text-sm font-medium text-gray-900 dark:text-gray-100 select-none", m.insertBefore(g, m.firstChild)), g.textContent = b;
|
|
2190
|
+
const k = o || ((v = this._element) == null ? void 0 : v.id) || ((E = this._colorTextInput) == null ? void 0 : E.id) || ((S = this._input) == null ? void 0 : S.id) || ((y = this._textarea) == null ? void 0 : y.id);
|
|
2207
2191
|
if (k)
|
|
2208
|
-
|
|
2192
|
+
g.setAttribute("for", k);
|
|
2209
2193
|
else {
|
|
2210
|
-
const
|
|
2211
|
-
this._element ? this._element.id =
|
|
2194
|
+
const x = `mint-input-${Math.random().toString(36).substr(2, 9)}`;
|
|
2195
|
+
this._element ? this._element.id = x : this._colorTextInput ? this._colorTextInput.id = x : this._input ? this._input.id = x : this._textarea && (this._textarea.id = x), g.setAttribute("for", x);
|
|
2212
2196
|
}
|
|
2213
|
-
n ?
|
|
2214
|
-
} else
|
|
2197
|
+
n ? g.classList.add("opacity-40") : g.classList.remove("opacity-40");
|
|
2198
|
+
} else g && g.remove();
|
|
2215
2199
|
let p = m.querySelector(".mint-input-info");
|
|
2216
|
-
|
|
2200
|
+
f ? (p || (p = document.createElement("span"), p.className = "mint-input-info text-xs text-gray-500 dark:text-gray-400 select-none", m.appendChild(p)), p.textContent = f, n ? p.classList.add("opacity-40") : p.classList.remove("opacity-40")) : p && p.remove();
|
|
2217
2201
|
} else m && m.remove();
|
|
2218
2202
|
this._renderErrorState();
|
|
2219
2203
|
}
|
|
@@ -2253,8 +2237,8 @@ class se extends HTMLElement {
|
|
|
2253
2237
|
this._isColor() && this._colorTextInput ? this._colorTextInput.blur() : (e = this._element) == null || e.blur();
|
|
2254
2238
|
}
|
|
2255
2239
|
}
|
|
2256
|
-
customElements.get("mint-input") || customElements.define("mint-input",
|
|
2257
|
-
class
|
|
2240
|
+
customElements.get("mint-input") || customElements.define("mint-input", Q);
|
|
2241
|
+
class ee extends HTMLElement {
|
|
2258
2242
|
constructor() {
|
|
2259
2243
|
super(), this._input = null, this._textInput = null, this._popover = null, this._calendarContainer = null, this._iconButton = null, this._hiddenInput = null, this._startPartInputs = [], this._endPartInputs = [], this._displayEl = null, this._inputsWrapperEl = null, this._fieldsContainer = null, this._resetHandler = null, this._isInputMode = !1, this._currentMonth = (/* @__PURE__ */ new Date()).getMonth(), this._currentYear = (/* @__PURE__ */ new Date()).getFullYear(), this._viewMode = "calendar", this._selectedStartDate = null, this._selectedEndDate = null, this._isRange = !1, this._popoverObserver = null, this._focusTrapHandler = null, this._escapeHandler = null;
|
|
2260
2244
|
}
|
|
@@ -2413,17 +2397,17 @@ class re extends HTMLElement {
|
|
|
2413
2397
|
_applyDateToParts(e, t, i, s) {
|
|
2414
2398
|
if (!t.length) return;
|
|
2415
2399
|
if (!e) {
|
|
2416
|
-
t.forEach((
|
|
2400
|
+
t.forEach((c) => c.value = "");
|
|
2417
2401
|
return;
|
|
2418
2402
|
}
|
|
2419
2403
|
const r = this._formatDate(e, s);
|
|
2420
2404
|
let n = 0, a = 0;
|
|
2421
|
-
i.forEach((
|
|
2422
|
-
if (
|
|
2423
|
-
n +=
|
|
2405
|
+
i.forEach((c) => {
|
|
2406
|
+
if (c.type === "sep")
|
|
2407
|
+
n += c.value.length;
|
|
2424
2408
|
else {
|
|
2425
|
-
const o = r.substr(n,
|
|
2426
|
-
t[a] && (t[a].value = o), a++, n +=
|
|
2409
|
+
const o = r.substr(n, c.len);
|
|
2410
|
+
t[a] && (t[a].value = o), a++, n += c.len;
|
|
2427
2411
|
}
|
|
2428
2412
|
});
|
|
2429
2413
|
}
|
|
@@ -2458,8 +2442,8 @@ class re extends HTMLElement {
|
|
|
2458
2442
|
}), s.addEventListener("blur", (a) => {
|
|
2459
2443
|
var o;
|
|
2460
2444
|
this._syncHiddenInput();
|
|
2461
|
-
const
|
|
2462
|
-
|
|
2445
|
+
const c = a.relatedTarget;
|
|
2446
|
+
c && i.contains(c) || (this._handleBlur(((o = this._hiddenInput) == null ? void 0 : o.value) || ""), this._exitInputMode());
|
|
2463
2447
|
});
|
|
2464
2448
|
});
|
|
2465
2449
|
}
|
|
@@ -2472,8 +2456,8 @@ class re extends HTMLElement {
|
|
|
2472
2456
|
if (this._isRange) {
|
|
2473
2457
|
const [s, r] = this._splitRangeInput(e, t), n = s ? this._parseDateString(s, t) : null, a = r ? this._parseDateString(r, t) : null;
|
|
2474
2458
|
if (n && a) {
|
|
2475
|
-
const [
|
|
2476
|
-
this._selectedStartDate =
|
|
2459
|
+
const [c, o] = n <= a ? [n, a] : [a, n];
|
|
2460
|
+
this._selectedStartDate = c, this._selectedEndDate = o, this._currentMonth = c.getMonth(), this._currentYear = c.getFullYear();
|
|
2477
2461
|
} else n && (this._selectedStartDate = n, this._selectedEndDate = null, this._currentMonth = n.getMonth(), this._currentYear = n.getFullYear());
|
|
2478
2462
|
this._applyDateToParts(this._selectedStartDate, this._startPartInputs, i, t), this._applyDateToParts(this._selectedEndDate, this._endPartInputs, i, t);
|
|
2479
2463
|
} else {
|
|
@@ -2487,53 +2471,53 @@ class re extends HTMLElement {
|
|
|
2487
2471
|
if (i.test(e)) {
|
|
2488
2472
|
const _ = e.split(i).filter((v) => v.length > 0), m = t.split(/[\/\-\.\s]+/).filter((v) => v.length > 0);
|
|
2489
2473
|
if (_.length === m.length) {
|
|
2490
|
-
let v = 0,
|
|
2474
|
+
let v = 0, E = 0, S = 0;
|
|
2491
2475
|
for (let y = 0; y < m.length; y++) {
|
|
2492
|
-
const
|
|
2493
|
-
if (
|
|
2476
|
+
const g = m[y].toLowerCase(), p = _[y];
|
|
2477
|
+
if (g.includes("d"))
|
|
2494
2478
|
v = parseInt(p, 10);
|
|
2495
|
-
else if (
|
|
2496
|
-
|
|
2497
|
-
else if (
|
|
2479
|
+
else if (g.includes("m"))
|
|
2480
|
+
E = parseInt(p, 10) - 1;
|
|
2481
|
+
else if (g.includes("y")) {
|
|
2498
2482
|
let k = parseInt(p, 10);
|
|
2499
|
-
const
|
|
2500
|
-
I === 2 &&
|
|
2483
|
+
const x = g.length, I = p.length;
|
|
2484
|
+
I === 2 && x === 4 ? k = Math.floor((/* @__PURE__ */ new Date()).getFullYear() / 100) * 100 + k : I === 2 && x === 2 && (k = Math.floor((/* @__PURE__ */ new Date()).getFullYear() / 100) * 100 + k), S = k;
|
|
2501
2485
|
}
|
|
2502
2486
|
}
|
|
2503
|
-
if (v &&
|
|
2504
|
-
const y = new Date(S,
|
|
2505
|
-
if (!isNaN(y.getTime()) && y.getDate() === v && y.getMonth() ===
|
|
2487
|
+
if (v && E >= 0 && E <= 11 && S) {
|
|
2488
|
+
const y = new Date(S, E, v);
|
|
2489
|
+
if (!isNaN(y.getTime()) && y.getDate() === v && y.getMonth() === E && y.getFullYear() === S)
|
|
2506
2490
|
return y;
|
|
2507
2491
|
}
|
|
2508
2492
|
}
|
|
2509
2493
|
}
|
|
2510
2494
|
const r = e.replace(/[\/\-\.]/g, ""), n = t.replace(/[\/\-\.]/g, "").toLowerCase();
|
|
2511
|
-
let a = n.indexOf("d"),
|
|
2512
|
-
const
|
|
2495
|
+
let a = n.indexOf("d"), c = n.indexOf("m"), o = n.indexOf("y");
|
|
2496
|
+
const l = [
|
|
2513
2497
|
{ char: "d", index: a },
|
|
2514
|
-
{ char: "m", index:
|
|
2498
|
+
{ char: "m", index: c },
|
|
2515
2499
|
{ char: "y", index: o }
|
|
2516
2500
|
].sort((_, m) => _.index - m.index);
|
|
2517
|
-
let
|
|
2501
|
+
let d = 0, h = 0, u = 0, b = 0;
|
|
2518
2502
|
n.length, r.length;
|
|
2519
|
-
for (const _ of
|
|
2503
|
+
for (const _ of l)
|
|
2520
2504
|
if (_.char === "d") {
|
|
2521
|
-
const m = n.lastIndexOf("d") - n.indexOf("d") + 1, v = r.substr(
|
|
2505
|
+
const m = n.lastIndexOf("d") - n.indexOf("d") + 1, v = r.substr(b, m);
|
|
2522
2506
|
if (v.length === 0) return null;
|
|
2523
|
-
|
|
2507
|
+
d = parseInt(v, 10), b += v.length;
|
|
2524
2508
|
} else if (_.char === "m") {
|
|
2525
|
-
const m = n.lastIndexOf("m") - n.indexOf("m") + 1, v = r.substr(
|
|
2509
|
+
const m = n.lastIndexOf("m") - n.indexOf("m") + 1, v = r.substr(b, m);
|
|
2526
2510
|
if (v.length === 0) return null;
|
|
2527
|
-
|
|
2511
|
+
h = parseInt(v, 10) - 1, b += v.length;
|
|
2528
2512
|
} else if (_.char === "y") {
|
|
2529
|
-
const m = n.lastIndexOf("y") - n.indexOf("y") + 1, v = r.substr(
|
|
2513
|
+
const m = n.lastIndexOf("y") - n.indexOf("y") + 1, v = r.substr(b), E = Math.min(m, v.length), S = v.substr(0, E);
|
|
2530
2514
|
if (S.length === 0) return null;
|
|
2531
2515
|
let y = parseInt(S, 10);
|
|
2532
|
-
|
|
2516
|
+
E === 2 && m === 4 ? y = Math.floor((/* @__PURE__ */ new Date()).getFullYear() / 100) * 100 + y : E === 2 && m === 2 && (y = Math.floor((/* @__PURE__ */ new Date()).getFullYear() / 100) * 100 + y), u = y, b += E;
|
|
2533
2517
|
}
|
|
2534
|
-
if (!
|
|
2535
|
-
const
|
|
2536
|
-
return isNaN(
|
|
2518
|
+
if (!d || h < 0 || h > 11 || !u) return null;
|
|
2519
|
+
const f = new Date(u, h, d);
|
|
2520
|
+
return isNaN(f.getTime()) || f.getDate() !== d || f.getMonth() !== h || f.getFullYear() !== u ? null : f;
|
|
2537
2521
|
}
|
|
2538
2522
|
_formatDate(e, t) {
|
|
2539
2523
|
const i = e.getDate(), s = e.getMonth() + 1, r = e.getFullYear(), n = t.toLowerCase();
|
|
@@ -2542,102 +2526,102 @@ class re extends HTMLElement {
|
|
|
2542
2526
|
}
|
|
2543
2527
|
// PHP-style formatter for display mode
|
|
2544
2528
|
_formatDatePhp(e, t) {
|
|
2545
|
-
const i = e.getDate(), s = e.getMonth() + 1, r = e.getFullYear(), n = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], a = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
|
|
2546
|
-
const
|
|
2547
|
-
return
|
|
2529
|
+
const i = e.getDate(), s = e.getMonth() + 1, r = e.getFullYear(), n = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], a = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], c = ["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"], l = (u, b = 2) => u.toString().padStart(b, "0"), d = (u) => {
|
|
2530
|
+
const b = u % 10, f = u % 100;
|
|
2531
|
+
return b === 1 && f !== 11 ? "st" : b === 2 && f !== 12 ? "nd" : b === 3 && f !== 13 ? "rd" : "th";
|
|
2548
2532
|
};
|
|
2549
|
-
let
|
|
2533
|
+
let h = "";
|
|
2550
2534
|
for (let u = 0; u < t.length; u++) {
|
|
2551
|
-
const
|
|
2552
|
-
if (
|
|
2553
|
-
|
|
2535
|
+
const b = t[u];
|
|
2536
|
+
if (b === "\\" && u + 1 < t.length) {
|
|
2537
|
+
h += t[u + 1], u++;
|
|
2554
2538
|
continue;
|
|
2555
2539
|
}
|
|
2556
|
-
switch (
|
|
2540
|
+
switch (b) {
|
|
2557
2541
|
case "Y":
|
|
2558
|
-
|
|
2542
|
+
h += r.toString();
|
|
2559
2543
|
break;
|
|
2560
2544
|
case "y":
|
|
2561
|
-
|
|
2545
|
+
h += r.toString().slice(-2);
|
|
2562
2546
|
break;
|
|
2563
2547
|
case "m":
|
|
2564
|
-
|
|
2548
|
+
h += l(s);
|
|
2565
2549
|
break;
|
|
2566
2550
|
case "n":
|
|
2567
|
-
|
|
2551
|
+
h += s.toString();
|
|
2568
2552
|
break;
|
|
2569
2553
|
case "M":
|
|
2570
|
-
|
|
2554
|
+
h += o[s - 1];
|
|
2571
2555
|
break;
|
|
2572
2556
|
case "F":
|
|
2573
|
-
|
|
2557
|
+
h += c[s - 1];
|
|
2574
2558
|
break;
|
|
2575
2559
|
case "d":
|
|
2576
|
-
|
|
2560
|
+
h += l(i);
|
|
2577
2561
|
break;
|
|
2578
2562
|
case "j":
|
|
2579
|
-
|
|
2563
|
+
h += i.toString();
|
|
2580
2564
|
break;
|
|
2581
2565
|
case "D":
|
|
2582
|
-
|
|
2566
|
+
h += a[e.getDay()];
|
|
2583
2567
|
break;
|
|
2584
2568
|
case "l":
|
|
2585
|
-
|
|
2569
|
+
h += n[e.getDay()];
|
|
2586
2570
|
break;
|
|
2587
2571
|
case "S":
|
|
2588
|
-
|
|
2572
|
+
h += d(i);
|
|
2589
2573
|
break;
|
|
2590
2574
|
default:
|
|
2591
|
-
|
|
2575
|
+
h += b;
|
|
2592
2576
|
break;
|
|
2593
2577
|
}
|
|
2594
2578
|
}
|
|
2595
|
-
return
|
|
2579
|
+
return h;
|
|
2596
2580
|
}
|
|
2597
2581
|
_validateDateString(e, t) {
|
|
2598
2582
|
const i = this._parseDateString(e, t);
|
|
2599
2583
|
return i !== null && !isNaN(i.getTime());
|
|
2600
2584
|
}
|
|
2601
2585
|
render() {
|
|
2602
|
-
const e = this.getLabel(), t = this.getInfo(), i = this.getValue(), s = this.isDisabled(), r = this.isReadonly(), n = this.isRequired(), a = this.getId(),
|
|
2586
|
+
const e = this.getLabel(), t = this.getInfo(), i = this.getValue(), s = this.isDisabled(), r = this.isReadonly(), n = this.isRequired(), a = this.getId(), c = this.getName(), o = this.getFormat(), l = this.hasError(), d = this.getErrorMessage();
|
|
2603
2587
|
this._isRange = this.isRange(), this._input || (this._input = document.createElement("div"), this._input.className = "relative w-full", this.appendChild(this._input));
|
|
2604
|
-
let
|
|
2588
|
+
let h = this.querySelector(".mint-date-picker-label-container");
|
|
2605
2589
|
if (e || t) {
|
|
2606
|
-
|
|
2607
|
-
let m =
|
|
2608
|
-
e ? (m || (m = document.createElement("label"), m.className = "mint-date-picker-label text-sm font-medium text-gray-900 dark:text-gray-100 select-none",
|
|
2609
|
-
let v =
|
|
2610
|
-
t ? (v || (v = document.createElement("span"), v.className = "mint-date-picker-info text-xs text-gray-500 dark:text-gray-400 select-none",
|
|
2611
|
-
} else
|
|
2612
|
-
this._hiddenInput || (this._hiddenInput = document.createElement("input"), this._hiddenInput.type = "hidden", this._hiddenInput.value = i || "", this._textInput = this._hiddenInput, this._input.appendChild(this._hiddenInput)), a && (this._hiddenInput.id = a),
|
|
2590
|
+
h || (h = document.createElement("div"), h.className = "mint-date-picker-label-container flex flex-col gap-0.5 mb-[.25rem]", this.insertBefore(h, this._input));
|
|
2591
|
+
let m = h.querySelector(".mint-date-picker-label");
|
|
2592
|
+
e ? (m || (m = document.createElement("label"), m.className = "mint-date-picker-label text-sm font-medium text-gray-900 dark:text-gray-100 select-none", h.insertBefore(m, h.firstChild)), m.textContent = e, a && this._textInput && m.setAttribute("for", a)) : m && m.remove();
|
|
2593
|
+
let v = h.querySelector(".mint-date-picker-info");
|
|
2594
|
+
t ? (v || (v = document.createElement("span"), v.className = "mint-date-picker-info text-xs text-gray-500 dark:text-gray-400 select-none", h.appendChild(v)), v.textContent = t) : v && v.remove();
|
|
2595
|
+
} else h && h.remove();
|
|
2596
|
+
this._hiddenInput || (this._hiddenInput = document.createElement("input"), this._hiddenInput.type = "hidden", this._hiddenInput.value = i || "", this._textInput = this._hiddenInput, this._input.appendChild(this._hiddenInput)), a && (this._hiddenInput.id = a), c && (this._hiddenInput.name = c), this._hiddenInput.value = i || "", this._hiddenInput.setAttribute("aria-invalid", l ? "true" : "false");
|
|
2613
2597
|
let u = this._input.querySelector(".mint-date-fields");
|
|
2614
|
-
u || (u = document.createElement("div"), this._input.appendChild(u)), this._fieldsContainer = u, this._applyErrorVisuals(
|
|
2598
|
+
u || (u = document.createElement("div"), this._input.appendChild(u)), this._fieldsContainer = u, this._applyErrorVisuals(l, d, s), u.innerHTML = "", this._displayEl = document.createElement("div"), this._displayEl.className = "flex-1 text-gray-900 dark:text-white cursor-text select-none focus:outline-none", this._displayEl.tabIndex = s ? -1 : 0, this._displayEl.addEventListener("click", () => {
|
|
2615
2599
|
s || r || this._enterInputMode();
|
|
2616
2600
|
}), this._displayEl.addEventListener("keydown", (m) => {
|
|
2617
2601
|
s || r || (m.key === "Enter" || m.key === " ") && (m.preventDefault(), this._enterInputMode());
|
|
2618
2602
|
}), this._inputsWrapperEl = document.createElement("div"), this._inputsWrapperEl.className = "flex items-center gap-1 w-full";
|
|
2619
|
-
const
|
|
2603
|
+
const b = this._getFormatTokens(o);
|
|
2620
2604
|
this._startPartInputs = [], this._endPartInputs = [];
|
|
2621
|
-
const
|
|
2605
|
+
const f = (m) => {
|
|
2622
2606
|
const v = document.createDocumentFragment();
|
|
2623
|
-
return
|
|
2624
|
-
if (
|
|
2607
|
+
return b.forEach((E) => {
|
|
2608
|
+
if (E.type === "sep") {
|
|
2625
2609
|
const S = document.createElement("span");
|
|
2626
|
-
S.textContent =
|
|
2610
|
+
S.textContent = E.value, S.className = "text-gray-400 dark:text-gray-500 select-none", v.appendChild(S);
|
|
2627
2611
|
} else {
|
|
2628
|
-
const S =
|
|
2612
|
+
const S = E.part === "d" ? "dd" : E.part === "m" ? "mm" : E.len === 2 ? "yy" : "yyyy", y = this._createPartInput(E.len, S, s, r, n);
|
|
2629
2613
|
m === "start" ? this._startPartInputs.push(y) : this._endPartInputs.push(y), v.appendChild(y);
|
|
2630
2614
|
}
|
|
2631
2615
|
}), v;
|
|
2632
2616
|
};
|
|
2633
|
-
if (this._inputsWrapperEl.appendChild(
|
|
2617
|
+
if (this._inputsWrapperEl.appendChild(f("start")), this._isRange) {
|
|
2634
2618
|
const m = document.createElement("span");
|
|
2635
|
-
m.textContent = " - ", m.className = "text-gray-400 dark:text-gray-500 select-none", this._inputsWrapperEl.appendChild(m), this._inputsWrapperEl.appendChild(
|
|
2619
|
+
m.textContent = " - ", m.className = "text-gray-400 dark:text-gray-500 select-none", this._inputsWrapperEl.appendChild(m), this._inputsWrapperEl.appendChild(f("end"));
|
|
2636
2620
|
}
|
|
2637
2621
|
const _ = document.createElement("div");
|
|
2638
2622
|
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), u.appendChild(_), u.addEventListener("click", () => {
|
|
2639
2623
|
this._isInputMode || s || r || this._enterInputMode();
|
|
2640
|
-
}), this._attachPartInputHandlers(this._startPartInputs,
|
|
2624
|
+
}), this._attachPartInputHandlers(this._startPartInputs, b, u), this._isRange && this._attachPartInputHandlers(this._endPartInputs, b, u), this._parseValue(i), this._syncHiddenInput(), this._updateDisplayText(), this._iconButton)
|
|
2641
2625
|
this._iconButton.disabled = s || r, !s && !r ? this._iconButton.tabIndex = 0 : this._iconButton.tabIndex = -1;
|
|
2642
2626
|
else {
|
|
2643
2627
|
this._iconButton = document.createElement("button"), this._iconButton.type = "button", this._iconButton.tabIndex = 0, this._iconButton.className = "absolute left-2 top-2 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";
|
|
@@ -2648,7 +2632,7 @@ class re extends HTMLElement {
|
|
|
2648
2632
|
s || r || this._enterInputMode();
|
|
2649
2633
|
}), this._input.prepend(this._iconButton), this._iconButton.disabled = s || r;
|
|
2650
2634
|
}
|
|
2651
|
-
this._renderErrorState(
|
|
2635
|
+
this._renderErrorState(l, d);
|
|
2652
2636
|
}
|
|
2653
2637
|
_renderErrorState(e, t) {
|
|
2654
2638
|
let i = this.querySelector(".mint-date-picker-error");
|
|
@@ -2696,8 +2680,8 @@ class re extends HTMLElement {
|
|
|
2696
2680
|
if (this._isRange) {
|
|
2697
2681
|
const [i, s] = this._splitRangeInput(e, t), r = i ? this._parseDateString(i, t) : null, n = s ? this._parseDateString(s, t) : null;
|
|
2698
2682
|
if (r && n) {
|
|
2699
|
-
const [a,
|
|
2700
|
-
this.setValue(
|
|
2683
|
+
const [a, c] = r <= n ? [r, n] : [n, r], o = this._formatDate(a, t), l = this._formatDate(c, t), d = `${o} - ${l}`;
|
|
2684
|
+
this.setValue(d), this._applyDateToParts(a, this._startPartInputs, this._getFormatTokens(t), t), this._applyDateToParts(c, this._endPartInputs, this._getFormatTokens(t), t), this._selectedStartDate = a, this._selectedEndDate = c, this._currentMonth = a.getMonth(), this._currentYear = a.getFullYear();
|
|
2701
2685
|
} else if (r) {
|
|
2702
2686
|
const a = this._formatDate(r, t);
|
|
2703
2687
|
this.setValue(a), this._applyDateToParts(r, this._startPartInputs, this._getFormatTokens(t), t), this._applyDateToParts(null, this._endPartInputs, this._getFormatTokens(t), t), this._selectedStartDate = r, this._selectedEndDate = null, this._currentMonth = r.getMonth(), this._currentYear = r.getFullYear();
|
|
@@ -2796,61 +2780,61 @@ class re extends HTMLElement {
|
|
|
2796
2780
|
this._calendarContainer.className = n ? "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]";
|
|
2797
2781
|
const a = document.createElement("div");
|
|
2798
2782
|
a.className = "flex flex-col md:flex-row md:gap-6 md:items-start";
|
|
2799
|
-
const
|
|
2800
|
-
|
|
2783
|
+
const c = document.createElement("div");
|
|
2784
|
+
c.className = "flex-1 min-w-0";
|
|
2801
2785
|
const o = document.createElement("div");
|
|
2802
2786
|
o.className = "flex items-center justify-between mb-4";
|
|
2803
|
-
const
|
|
2804
|
-
|
|
2805
|
-
const
|
|
2806
|
-
|
|
2787
|
+
const l = document.createElement("button");
|
|
2788
|
+
l.type = "button", l.tabIndex = 0, l.className = "p-1 rounded hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-600 dark:text-gray-300 transition-colors flex items-center focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500", l.setAttribute("data-keep-popover-open", "true");
|
|
2789
|
+
const d = document.createElement("mint-icon");
|
|
2790
|
+
d.setAttribute("name", "caret-left"), d.className = "w-4 h-4", l.appendChild(d), l.addEventListener("click", () => {
|
|
2807
2791
|
this._currentMonth === 0 ? (this._currentMonth = 11, this._currentYear--) : this._currentMonth--, this._buildCalendar();
|
|
2808
|
-
}), o.appendChild(
|
|
2809
|
-
const
|
|
2810
|
-
|
|
2792
|
+
}), o.appendChild(l);
|
|
2793
|
+
const h = document.createElement("div");
|
|
2794
|
+
h.className = "flex items-center gap-2";
|
|
2811
2795
|
const u = document.createElement("button");
|
|
2812
2796
|
u.type = "button", u.tabIndex = 0, u.className = "text-sm font-medium text-gray-900 dark:text-gray-100 hover:text-gray-600 dark:hover:text-gray-300 transition-colors flex items-center focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500", u.setAttribute("data-keep-popover-open", "true"), u.textContent = i[this._currentMonth], u.addEventListener("click", () => {
|
|
2813
2797
|
this._viewMode = "month", this._buildCalendar();
|
|
2814
|
-
}),
|
|
2815
|
-
const
|
|
2816
|
-
|
|
2798
|
+
}), h.appendChild(u);
|
|
2799
|
+
const b = document.createElement("button");
|
|
2800
|
+
b.type = "button", b.tabIndex = 0, b.className = "text-sm font-medium text-gray-900 dark:text-gray-100 hover:text-gray-600 dark:hover:text-gray-300 transition-colors flex items-center focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500", b.setAttribute("data-keep-popover-open", "true"), b.textContent = String(this._currentYear), b.addEventListener("click", () => {
|
|
2817
2801
|
this._viewMode = "year", this._buildCalendar();
|
|
2818
|
-
}),
|
|
2819
|
-
const
|
|
2820
|
-
|
|
2802
|
+
}), h.appendChild(b), o.appendChild(h);
|
|
2803
|
+
const f = document.createElement("button");
|
|
2804
|
+
f.type = "button", f.tabIndex = 0, f.className = "p-1 rounded hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-600 dark:text-gray-300 transition-colors flex items-center focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500", f.setAttribute("data-keep-popover-open", "true");
|
|
2821
2805
|
const _ = document.createElement("mint-icon");
|
|
2822
|
-
_.setAttribute("name", "caret-right"), _.className = "w-4 h-4",
|
|
2806
|
+
_.setAttribute("name", "caret-right"), _.className = "w-4 h-4", f.appendChild(_), f.addEventListener("click", () => {
|
|
2823
2807
|
this._currentMonth === 11 ? (this._currentMonth = 0, this._currentYear++) : this._currentMonth++, this._buildCalendar();
|
|
2824
|
-
}), o.appendChild(
|
|
2808
|
+
}), o.appendChild(f);
|
|
2825
2809
|
const m = document.createElement("div");
|
|
2826
2810
|
m.className = "grid grid-cols-7 mb-2", s.forEach((y) => {
|
|
2827
|
-
const
|
|
2828
|
-
|
|
2811
|
+
const g = document.createElement("div");
|
|
2812
|
+
g.className = "text-xs font-medium text-gray-500 dark:text-gray-400 text-center py-1", g.textContent = y, m.appendChild(g);
|
|
2829
2813
|
});
|
|
2830
2814
|
const v = document.createElement("div");
|
|
2831
2815
|
v.className = "grid grid-cols-7";
|
|
2832
2816
|
for (let y = 0; y < t; y++) {
|
|
2833
|
-
const
|
|
2834
|
-
|
|
2817
|
+
const g = document.createElement("div");
|
|
2818
|
+
g.className = "w-8 h-8", v.appendChild(g);
|
|
2835
2819
|
}
|
|
2836
|
-
const
|
|
2820
|
+
const E = this.getMin() ? this._parseDateString(this.getMin(), this.getFormat()) : null, S = this.getMax() ? this._parseDateString(this.getMax(), this.getFormat()) : null;
|
|
2837
2821
|
for (let y = 1; y <= e; y++) {
|
|
2838
|
-
const
|
|
2839
|
-
let
|
|
2822
|
+
const g = new Date(this._currentYear, this._currentMonth, y), p = this._isToday(g), k = this._isDateSelected(g), x = this._isDateInRange(g), I = E && g < E || S && g > S;
|
|
2823
|
+
let C = "rounded-md";
|
|
2840
2824
|
if (this._isRange && this._selectedStartDate && this._selectedEndDate) {
|
|
2841
|
-
const L = this._isSameDate(
|
|
2842
|
-
L && M ?
|
|
2843
|
-
} else k && !this._isRange && (
|
|
2844
|
-
const
|
|
2845
|
-
|
|
2846
|
-
this._handleDateClick(
|
|
2847
|
-
}), v.appendChild(
|
|
2825
|
+
const L = this._isSameDate(g, this._selectedStartDate), M = this._isSameDate(g, this._selectedEndDate);
|
|
2826
|
+
L && M ? C = "rounded-md" : L ? C = "rounded-l-md" : M ? C = "rounded-r-md" : x && (C = "rounded-none");
|
|
2827
|
+
} else k && !this._isRange && (C = "rounded-md");
|
|
2828
|
+
const w = document.createElement("button");
|
|
2829
|
+
w.type = "button", w.disabled = !!I, w.tabIndex = I ? -1 : 0, w.className = `w-full h-8 ${C} border-0 text-sm font-medium 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 ${k ? "bg-slate-800 dark:bg-slate-600 text-white" : x ? "bg-slate-100 dark:bg-slate-700 text-slate-800 dark:text-slate-200" : p ? "text-gray-900 dark:text-gray-100 font-semibold" : "text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700"} ${I ? "opacity-40 cursor-not-allowed" : ""}`, w.textContent = y.toString(), I || w.addEventListener("click", () => {
|
|
2830
|
+
this._handleDateClick(g);
|
|
2831
|
+
}), v.appendChild(w);
|
|
2848
2832
|
}
|
|
2849
2833
|
if (n) {
|
|
2850
2834
|
const y = document.createElement("div");
|
|
2851
2835
|
y.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";
|
|
2852
|
-
const
|
|
2853
|
-
|
|
2836
|
+
const g = document.createElement("div");
|
|
2837
|
+
g.className = "relative md:relative md:flex-1 md:min-h-0";
|
|
2854
2838
|
const p = document.createElement("div");
|
|
2855
2839
|
p.className = "flex gap-2 overflow-x-auto pb-1 md:flex-col md:overflow-x-visible md:overflow-y-auto md:pb-0 md:gap-2", p.style.scrollbarWidth = "none", p.style.msOverflowStyle = "none", p.style.setProperty("-webkit-overflow-scrolling", "touch");
|
|
2856
2840
|
const k = document.createElement("style");
|
|
@@ -2879,21 +2863,21 @@ class re extends HTMLElement {
|
|
|
2879
2863
|
}
|
|
2880
2864
|
}
|
|
2881
2865
|
`, p.classList.add("mint-date-shortcuts-row"), document.head.querySelector("style[data-mint-date-shortcuts]") || (k.setAttribute("data-mint-date-shortcuts", "true"), document.head.appendChild(k));
|
|
2882
|
-
const
|
|
2883
|
-
|
|
2866
|
+
const x = document.createElement("div");
|
|
2867
|
+
x.className = "absolute left-0 top-0 bottom-0 w-8 pointer-events-none z-10 bg-gradient-to-r from-white dark:from-gray-800 to-transparent opacity-0 transition-opacity duration-200 md:hidden", g.appendChild(x);
|
|
2884
2868
|
const I = document.createElement("div");
|
|
2885
|
-
I.className = "absolute right-0 top-0 bottom-0 w-8 pointer-events-none z-10 bg-gradient-to-l from-white dark:from-gray-800 to-transparent opacity-100 transition-opacity duration-200 md:hidden",
|
|
2869
|
+
I.className = "absolute right-0 top-0 bottom-0 w-8 pointer-events-none z-10 bg-gradient-to-l from-white dark:from-gray-800 to-transparent opacity-100 transition-opacity duration-200 md:hidden", g.appendChild(I);
|
|
2870
|
+
const C = document.createElement("div");
|
|
2871
|
+
C.className = "hidden md:block absolute top-0 left-0 right-0 h-8 pointer-events-none z-10 bg-gradient-to-b from-white dark:from-gray-800 to-transparent opacity-0 transition-opacity duration-200", g.appendChild(C);
|
|
2886
2872
|
const w = document.createElement("div");
|
|
2887
|
-
w.className = "hidden md:block absolute
|
|
2888
|
-
const A = document.createElement("div");
|
|
2889
|
-
A.className = "hidden md:block absolute bottom-0 left-0 right-0 h-8 pointer-events-none z-10 bg-gradient-to-t from-white dark:from-gray-800 to-transparent opacity-100 transition-opacity duration-200", b.appendChild(A);
|
|
2873
|
+
w.className = "hidden md:block absolute bottom-0 left-0 right-0 h-8 pointer-events-none z-10 bg-gradient-to-t from-white dark:from-gray-800 to-transparent opacity-100 transition-opacity duration-200", g.appendChild(w);
|
|
2890
2874
|
const L = () => {
|
|
2891
2875
|
if (window.innerWidth >= 768) {
|
|
2892
2876
|
const T = p.scrollTop, H = p.scrollHeight, D = p.clientHeight;
|
|
2893
|
-
T > 0 ?
|
|
2877
|
+
T > 0 ? C.style.opacity = "1" : C.style.opacity = "0", T + D < H - 1 ? w.style.opacity = "1" : w.style.opacity = "0", x.style.opacity = "0", I.style.opacity = "0";
|
|
2894
2878
|
} else {
|
|
2895
2879
|
const T = p.scrollLeft, H = p.scrollWidth, D = p.clientWidth;
|
|
2896
|
-
T > 0 ?
|
|
2880
|
+
T > 0 ? x.style.opacity = "1" : x.style.opacity = "0", T + D < H - 1 ? I.style.opacity = "1" : I.style.opacity = "0", C.style.opacity = "0", w.style.opacity = "0";
|
|
2897
2881
|
}
|
|
2898
2882
|
};
|
|
2899
2883
|
p.addEventListener("scroll", L), window.addEventListener("resize", L), setTimeout(L, 0), r.forEach((M) => {
|
|
@@ -2903,8 +2887,8 @@ class re extends HTMLElement {
|
|
|
2903
2887
|
if (H) {
|
|
2904
2888
|
if (this._isRange && "start" in H && "end" in H) {
|
|
2905
2889
|
this._selectedStartDate = H.start, this._selectedEndDate = H.end;
|
|
2906
|
-
const D = this.getFormat(), N = this._formatDate(H.start, D),
|
|
2907
|
-
this.setValue(
|
|
2890
|
+
const D = this.getFormat(), N = this._formatDate(H.start, D), F = this._formatDate(H.end, D), P = `${N} - ${F}`;
|
|
2891
|
+
this.setValue(P), this._currentMonth = H.start.getMonth(), this._currentYear = H.start.getFullYear();
|
|
2908
2892
|
} else if (H instanceof Date) {
|
|
2909
2893
|
this._selectedStartDate = H, this._selectedEndDate = null;
|
|
2910
2894
|
const D = this.getFormat(), N = this._formatDate(H, D);
|
|
@@ -2921,9 +2905,9 @@ class re extends HTMLElement {
|
|
|
2921
2905
|
}));
|
|
2922
2906
|
}
|
|
2923
2907
|
}), p.appendChild(T);
|
|
2924
|
-
}),
|
|
2908
|
+
}), g.appendChild(p), y.appendChild(g), a.appendChild(y);
|
|
2925
2909
|
}
|
|
2926
|
-
|
|
2910
|
+
c.appendChild(o), c.appendChild(m), c.appendChild(v), a.appendChild(c), this._calendarContainer.appendChild(a);
|
|
2927
2911
|
}
|
|
2928
2912
|
_buildMonthView() {
|
|
2929
2913
|
if (!this._calendarContainer) return;
|
|
@@ -2945,15 +2929,15 @@ class re extends HTMLElement {
|
|
|
2945
2929
|
a.setAttribute("name", "caret-right"), a.className = "w-4 h-4", n.appendChild(a), n.addEventListener("click", () => {
|
|
2946
2930
|
this._currentYear++, this._buildCalendar();
|
|
2947
2931
|
}), t.appendChild(n);
|
|
2948
|
-
const
|
|
2949
|
-
|
|
2950
|
-
const
|
|
2951
|
-
|
|
2952
|
-
const
|
|
2953
|
-
|
|
2954
|
-
this._currentMonth =
|
|
2955
|
-
}),
|
|
2956
|
-
}), this._calendarContainer.appendChild(t), this._calendarContainer.appendChild(
|
|
2932
|
+
const c = document.createElement("div");
|
|
2933
|
+
c.className = "grid grid-cols-3 gap-2", e.forEach((o, l) => {
|
|
2934
|
+
const d = document.createElement("button");
|
|
2935
|
+
d.type = "button", d.tabIndex = 0, d.setAttribute("data-keep-popover-open", "true");
|
|
2936
|
+
const h = this._currentMonth === l;
|
|
2937
|
+
d.className = `p-2 rounded text-sm font-medium 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 ${h ? "bg-slate-800 dark:bg-slate-600 text-white" : "text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700"}`, d.textContent = o, d.addEventListener("click", () => {
|
|
2938
|
+
this._currentMonth = l, this._viewMode = "calendar", this._buildCalendar();
|
|
2939
|
+
}), c.appendChild(d);
|
|
2940
|
+
}), this._calendarContainer.appendChild(t), this._calendarContainer.appendChild(c);
|
|
2957
2941
|
}
|
|
2958
2942
|
_buildYearView() {
|
|
2959
2943
|
if (!this._calendarContainer) return;
|
|
@@ -2969,19 +2953,19 @@ class re extends HTMLElement {
|
|
|
2969
2953
|
n.className = "text-sm font-medium text-gray-900 dark:text-gray-100", n.textContent = `${e} - ${t}`, i.appendChild(n);
|
|
2970
2954
|
const a = document.createElement("button");
|
|
2971
2955
|
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");
|
|
2972
|
-
const
|
|
2973
|
-
|
|
2956
|
+
const c = document.createElement("mint-icon");
|
|
2957
|
+
c.setAttribute("name", "caret-right"), c.className = "w-4 h-4", a.appendChild(c), a.addEventListener("click", () => {
|
|
2974
2958
|
this._currentYear += 12, this._buildCalendar();
|
|
2975
2959
|
}), i.appendChild(a);
|
|
2976
2960
|
const o = document.createElement("div");
|
|
2977
2961
|
o.className = "grid grid-cols-3 gap-2";
|
|
2978
|
-
for (let
|
|
2979
|
-
const
|
|
2980
|
-
|
|
2981
|
-
const
|
|
2982
|
-
|
|
2983
|
-
this._currentYear =
|
|
2984
|
-
}), o.appendChild(
|
|
2962
|
+
for (let l = e; l <= t; l++) {
|
|
2963
|
+
const d = document.createElement("button");
|
|
2964
|
+
d.type = "button", d.tabIndex = 0, d.setAttribute("data-keep-popover-open", "true");
|
|
2965
|
+
const h = this._currentYear === l;
|
|
2966
|
+
d.className = `p-2 rounded text-sm font-medium 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 ${h ? "bg-slate-800 dark:bg-slate-600 text-white" : "text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700"}`, d.textContent = String(l), d.addEventListener("click", () => {
|
|
2967
|
+
this._currentYear = l, this._viewMode = "calendar", this._buildCalendar();
|
|
2968
|
+
}), o.appendChild(d);
|
|
2985
2969
|
}
|
|
2986
2970
|
this._calendarContainer.appendChild(i), this._calendarContainer.appendChild(o);
|
|
2987
2971
|
}
|
|
@@ -3074,7 +3058,7 @@ class re extends HTMLElement {
|
|
|
3074
3058
|
this._removeFocusTrap();
|
|
3075
3059
|
const e = this;
|
|
3076
3060
|
this._focusTrapHandler = function(t) {
|
|
3077
|
-
var
|
|
3061
|
+
var c;
|
|
3078
3062
|
if (t.key !== "Tab") return;
|
|
3079
3063
|
if (!e._popover || !e._popover.hasAttribute("open")) {
|
|
3080
3064
|
e._removeFocusTrap();
|
|
@@ -3083,7 +3067,7 @@ class re extends HTMLElement {
|
|
|
3083
3067
|
const i = e._getFocusableElements();
|
|
3084
3068
|
if (i.length === 0) return;
|
|
3085
3069
|
const s = i[0], r = i[i.length - 1], n = document.activeElement;
|
|
3086
|
-
if (!(((
|
|
3070
|
+
if (!(((c = e._calendarContainer) == null ? void 0 : c.contains(n)) || !1)) {
|
|
3087
3071
|
t.preventDefault(), s.focus();
|
|
3088
3072
|
return;
|
|
3089
3073
|
}
|
|
@@ -3106,8 +3090,8 @@ class re extends HTMLElement {
|
|
|
3106
3090
|
this._focusTrapHandler && (document.removeEventListener("keydown", this._focusTrapHandler, !0), this._focusTrapHandler = null), this._escapeHandler && (document.removeEventListener("keydown", this._escapeHandler, !0), this._escapeHandler = null);
|
|
3107
3091
|
}
|
|
3108
3092
|
}
|
|
3109
|
-
customElements.get("mint-date-picker") || customElements.define("mint-date-picker",
|
|
3110
|
-
class
|
|
3093
|
+
customElements.get("mint-date-picker") || customElements.define("mint-date-picker", ee);
|
|
3094
|
+
class te extends HTMLElement {
|
|
3111
3095
|
constructor() {
|
|
3112
3096
|
super(), this._select = null, this._wrapper = null, this._caretUpIcon = null, this._caretDownIcon = null, this._changeHandler = null;
|
|
3113
3097
|
}
|
|
@@ -3202,32 +3186,32 @@ class ne extends HTMLElement {
|
|
|
3202
3186
|
}
|
|
3203
3187
|
render() {
|
|
3204
3188
|
const e = [];
|
|
3205
|
-
this._select && Array.from(this._select.
|
|
3206
|
-
e.push(
|
|
3189
|
+
this._select && Array.from(this._select.children).forEach((h) => {
|
|
3190
|
+
(h.tagName === "OPTION" || h.tagName === "OPTGROUP") && e.push(h.cloneNode(!0));
|
|
3207
3191
|
});
|
|
3208
|
-
const t = Array.from(this.
|
|
3192
|
+
const t = Array.from(this.children).filter((h) => h.tagName === "OPTION" || h.tagName === "OPTGROUP").map((h) => h.cloneNode(!0));
|
|
3209
3193
|
for (; this.firstChild; )
|
|
3210
3194
|
this.removeChild(this.firstChild);
|
|
3211
3195
|
this._wrapper = null, this._select = null;
|
|
3212
|
-
const i = this.getLabel(), s = this.getInfo(), r = this.getId(), n = this.getName(), a = this.getValue(),
|
|
3196
|
+
const i = this.getLabel(), s = this.getInfo(), r = this.getId(), n = this.getName(), a = this.getValue(), c = this.isDisabled(), o = this.isMultiple(), l = this.hasError();
|
|
3213
3197
|
if (i) {
|
|
3214
|
-
const
|
|
3215
|
-
|
|
3198
|
+
const h = document.createElement("label");
|
|
3199
|
+
h.className = "block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1", r && h.setAttribute("for", r);
|
|
3216
3200
|
const u = document.createTextNode(i);
|
|
3217
|
-
|
|
3201
|
+
h.appendChild(u), this.appendChild(h);
|
|
3218
3202
|
}
|
|
3219
|
-
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), n && (this._select.name = n),
|
|
3220
|
-
const
|
|
3221
|
-
if (
|
|
3222
|
-
this._select.appendChild(
|
|
3203
|
+
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), n && (this._select.name = n), c && (this._select.disabled = !0), o && (this._select.multiple = !0), a && (this._select.value = a), this._select.setAttribute("aria-invalid", l ? "true" : "false");
|
|
3204
|
+
const d = e.length > 0 ? e : t;
|
|
3205
|
+
if (d.length > 0 && d.forEach((h) => {
|
|
3206
|
+
this._select.appendChild(h);
|
|
3223
3207
|
}), this._select.options.length === 0) {
|
|
3224
|
-
const
|
|
3225
|
-
|
|
3208
|
+
const h = document.createElement("option");
|
|
3209
|
+
h.value = "", h.textContent = "Select an option", h.disabled = !0, h.selected = !0, this._select.appendChild(h);
|
|
3226
3210
|
}
|
|
3227
|
-
if (this._changeHandler && this._select && this._select.removeEventListener("change", this._changeHandler), this._changeHandler = (
|
|
3228
|
-
const
|
|
3229
|
-
|
|
3230
|
-
detail: { value:
|
|
3211
|
+
if (this._changeHandler && this._select && this._select.removeEventListener("change", this._changeHandler), this._changeHandler = (h) => {
|
|
3212
|
+
const b = h.target.value;
|
|
3213
|
+
b ? this.setAttribute("value", b) : this.removeAttribute("value"), this.dispatchEvent(new CustomEvent("change", {
|
|
3214
|
+
detail: { value: b },
|
|
3231
3215
|
bubbles: !0,
|
|
3232
3216
|
cancelable: !0,
|
|
3233
3217
|
composed: !0
|
|
@@ -3235,12 +3219,12 @@ class ne extends HTMLElement {
|
|
|
3235
3219
|
}, this._select.addEventListener("change", this._changeHandler), this._wrapper.appendChild(this._select), o)
|
|
3236
3220
|
this._caretUpIcon = null, this._caretDownIcon = null;
|
|
3237
3221
|
else {
|
|
3238
|
-
const
|
|
3239
|
-
|
|
3222
|
+
const h = document.createElement("div");
|
|
3223
|
+
h.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]", h.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]", h.appendChild(this._caretDownIcon), this._wrapper.appendChild(h);
|
|
3240
3224
|
}
|
|
3241
3225
|
if (s) {
|
|
3242
|
-
const
|
|
3243
|
-
|
|
3226
|
+
const h = document.createElement("div");
|
|
3227
|
+
h.className = "mt-1 text-xs text-gray-500 dark:text-gray-400", h.textContent = s, this.appendChild(h);
|
|
3244
3228
|
}
|
|
3245
3229
|
this._renderErrorState();
|
|
3246
3230
|
}
|
|
@@ -3250,8 +3234,8 @@ class ne extends HTMLElement {
|
|
|
3250
3234
|
e && t ? (i || (i = document.createElement("div"), i.className = "mint-select-error mt-1 text-xs text-red-600 dark:text-red-400", this.appendChild(i)), i.textContent = t) : i && i.remove();
|
|
3251
3235
|
}
|
|
3252
3236
|
}
|
|
3253
|
-
customElements.get("mint-select") || customElements.define("mint-select",
|
|
3254
|
-
class
|
|
3237
|
+
customElements.get("mint-select") || customElements.define("mint-select", te);
|
|
3238
|
+
class ie extends HTMLElement {
|
|
3255
3239
|
constructor() {
|
|
3256
3240
|
super(), this._dropzone = null, this._fileInput = null, this._previewContainer = null, this._isDragging = !1, this._wasDragging = !1, this._isUpdatingFiles = !1, this._listenersInitialized = !1, this._selectedFiles = [], this._previewUrls = [], this._resetHandler = null;
|
|
3257
3241
|
}
|
|
@@ -3304,18 +3288,18 @@ class ae extends HTMLElement {
|
|
|
3304
3288
|
return this.hasAttribute("disabled");
|
|
3305
3289
|
}
|
|
3306
3290
|
render() {
|
|
3307
|
-
const e = this.getLabel(), t = this.getAccept(), i = this.isMultiple(), s = this.isDisabled(), r = this.getWidth(), n = this.getHeight(), a = this.getName(),
|
|
3308
|
-
this._dropzone || (this._dropzone = document.createElement("div"), this.appendChild(this._dropzone)), this._updateDragStateClass(), this._dropzone.setAttribute("aria-invalid",
|
|
3309
|
-
const
|
|
3310
|
-
|
|
3311
|
-
const
|
|
3312
|
-
|
|
3291
|
+
const e = this.getLabel(), t = this.getAccept(), i = this.isMultiple(), s = this.isDisabled(), r = this.getWidth(), n = this.getHeight(), a = this.getName(), c = this.hasError(), o = this.getErrorMessage();
|
|
3292
|
+
this._dropzone || (this._dropzone = document.createElement("div"), this.appendChild(this._dropzone)), this._updateDragStateClass(), this._dropzone.setAttribute("aria-invalid", c ? "true" : "false"), this._dropzone.style.width = r, this._dropzone.style.height = n, this._dropzone.style.minWidth = r, this._dropzone.style.minHeight = n, this._fileInput || (this._fileInput = document.createElement("input"), this._fileInput.type = "file", this._fileInput.style.display = "none", this._dropzone.appendChild(this._fileInput)), this._fileInput.accept = t, this._fileInput.multiple = i, this._fileInput.disabled = s, a ? this._fileInput.name = a : this._fileInput.removeAttribute("name"), this._fileInput.setAttribute("aria-invalid", c ? "true" : "false");
|
|
3293
|
+
const l = this._dropzone.querySelector(".mint-dropzone-icon"), d = this._dropzone.querySelector(".mint-dropzone-label");
|
|
3294
|
+
l && l.remove(), d && d.remove();
|
|
3295
|
+
const h = document.createElement("div");
|
|
3296
|
+
h.className = "mint-dropzone-icon flex items-center justify-center mt-2 mb-2 flex-shrink-0";
|
|
3313
3297
|
const u = document.createElement("mint-icon");
|
|
3314
|
-
if (u.setAttribute("name", "upload"), u.className = "w-12 h-12 text-gray-400 dark:text-gray-500",
|
|
3315
|
-
const
|
|
3316
|
-
|
|
3298
|
+
if (u.setAttribute("name", "upload"), u.className = "w-12 h-12 text-gray-400 dark:text-gray-500", h.appendChild(u), this._dropzone.appendChild(h), e) {
|
|
3299
|
+
const b = document.createElement("div");
|
|
3300
|
+
b.className = "mint-dropzone-label text-sm font-medium text-gray-600 dark:text-gray-400 text-center px-4 flex-shrink-0", b.textContent = e, this._dropzone.appendChild(b);
|
|
3317
3301
|
}
|
|
3318
|
-
this.setupEventListeners(), this._renderErrorState(
|
|
3302
|
+
this.setupEventListeners(), this._renderErrorState(c, o), this._renderPreviews();
|
|
3319
3303
|
}
|
|
3320
3304
|
_updateDragState() {
|
|
3321
3305
|
this._dropzone && this._updateDragStateClass();
|
|
@@ -3326,8 +3310,8 @@ class ae extends HTMLElement {
|
|
|
3326
3310
|
}
|
|
3327
3311
|
_updateDragStateClass() {
|
|
3328
3312
|
if (!this._dropzone) return;
|
|
3329
|
-
const e = this.isDisabled(), t = this.hasError(), r = `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`, n = 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" : "",
|
|
3330
|
-
this._dropzone.className = `${r} ${t ? a : n} ${
|
|
3313
|
+
const e = this.isDisabled(), t = this.hasError(), r = `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`, n = 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" : "", c = e ? "opacity-40 cursor-not-allowed" : "";
|
|
3314
|
+
this._dropzone.className = `${r} ${t ? a : n} ${c}`.trim();
|
|
3331
3315
|
}
|
|
3332
3316
|
setupEventListeners() {
|
|
3333
3317
|
this._listenersInitialized || (this._listenersInitialized = !0, this.removeEventListeners(), !(!this._dropzone || !this._fileInput || this.isDisabled()) && (this._onDropzoneClick || (this._onDropzoneClick = (e) => {
|
|
@@ -3357,17 +3341,17 @@ class ae extends HTMLElement {
|
|
|
3357
3341
|
const i = e.target.files;
|
|
3358
3342
|
if (i && i.length > 0) {
|
|
3359
3343
|
const s = this.getAccept(), r = this.isMultiple(), n = [], a = [];
|
|
3360
|
-
for (let
|
|
3361
|
-
const o = i[
|
|
3344
|
+
for (let c = 0; c < i.length; c++) {
|
|
3345
|
+
const o = i[c];
|
|
3362
3346
|
this._isFileAccepted(o, s) ? n.push(o) : a.push(o);
|
|
3363
3347
|
}
|
|
3364
3348
|
if (!r && n.length > 1 && (a.push(...n.slice(1)), n.splice(1)), a.length > 0) {
|
|
3365
|
-
const
|
|
3349
|
+
const c = new CustomEvent("dropRejected", {
|
|
3366
3350
|
detail: { files: a, reason: "File type not accepted or multiple files not allowed" },
|
|
3367
3351
|
bubbles: !0,
|
|
3368
3352
|
cancelable: !0
|
|
3369
3353
|
});
|
|
3370
|
-
this.dispatchEvent(
|
|
3354
|
+
this.dispatchEvent(c);
|
|
3371
3355
|
}
|
|
3372
3356
|
n.length > 0 && this._applyValidFiles(n);
|
|
3373
3357
|
}
|
|
@@ -3457,25 +3441,25 @@ class ae extends HTMLElement {
|
|
|
3457
3441
|
const e = document.createElement("div");
|
|
3458
3442
|
e.className = "mint-dropzone-previews-wrapper mt-3 w-full relative max-h-48";
|
|
3459
3443
|
const t = document.createElement("div");
|
|
3460
|
-
t.className = "mint-dropzone-previews w-full flex flex-col gap-2 max-h-48 overflow-y-auto overflow-x-hidden px-2 pb-2", this._selectedFiles.forEach((o,
|
|
3461
|
-
const
|
|
3462
|
-
if (
|
|
3463
|
-
const
|
|
3464
|
-
|
|
3444
|
+
t.className = "mint-dropzone-previews w-full flex flex-col gap-2 max-h-48 overflow-y-auto overflow-x-hidden px-2 pb-2", this._selectedFiles.forEach((o, l) => {
|
|
3445
|
+
const d = document.createElement("div");
|
|
3446
|
+
if (d.className = "flex items-center gap-3 p-2 rounded border border-gray-200 dark:border-gray-600 bg-gray-50 dark:bg-gray-800", o.type.startsWith("image/")) {
|
|
3447
|
+
const f = document.createElement("img");
|
|
3448
|
+
f.className = "w-12 h-12 object-cover rounded border border-gray-200 dark:border-gray-700";
|
|
3465
3449
|
const _ = URL.createObjectURL(o);
|
|
3466
|
-
this._previewUrls.push(_),
|
|
3450
|
+
this._previewUrls.push(_), f.src = _, d.appendChild(f);
|
|
3467
3451
|
} else {
|
|
3468
|
-
const
|
|
3469
|
-
|
|
3452
|
+
const f = document.createElement("mint-icon");
|
|
3453
|
+
f.setAttribute("name", "attach"), f.className = "w-5 h-5 text-gray-500 dark:text-gray-300", d.appendChild(f);
|
|
3470
3454
|
}
|
|
3471
|
-
const
|
|
3472
|
-
|
|
3455
|
+
const h = document.createElement("div");
|
|
3456
|
+
h.className = "flex-1 text-sm text-gray-800 dark:text-gray-100 truncate", h.textContent = o.name, d.appendChild(h);
|
|
3473
3457
|
const u = document.createElement("button");
|
|
3474
3458
|
u.type = "button", u.className = "text-gray-500 hover:bg-red-100 dark:hover:bg-red-900/30 transition-colors flex items-center justify-center w-6 h-6 rounded-full";
|
|
3475
|
-
const
|
|
3476
|
-
|
|
3477
|
-
|
|
3478
|
-
}),
|
|
3459
|
+
const b = document.createElement("mint-icon");
|
|
3460
|
+
b.setAttribute("name", "close"), b.className = "w-4 h-4", u.appendChild(b), u.addEventListener("click", (f) => {
|
|
3461
|
+
f.preventDefault(), f.stopPropagation(), this._removeFileAt(l);
|
|
3462
|
+
}), d.appendChild(u), t.appendChild(d);
|
|
3479
3463
|
});
|
|
3480
3464
|
const i = this.hasError(), s = this._isDragging;
|
|
3481
3465
|
let r = "from-white dark:from-gray-700";
|
|
@@ -3484,11 +3468,11 @@ class ae extends HTMLElement {
|
|
|
3484
3468
|
n.className = `absolute top-0 left-0 right-0 h-4 pointer-events-none z-10 bg-gradient-to-b ${r} to-transparent opacity-0 transition-opacity duration-200`, e.appendChild(n);
|
|
3485
3469
|
const a = document.createElement("div");
|
|
3486
3470
|
a.className = `absolute bottom-0 left-0 right-0 h-4 pointer-events-none z-10 bg-gradient-to-t ${r} to-transparent opacity-100 transition-opacity duration-200`, e.appendChild(a);
|
|
3487
|
-
const
|
|
3488
|
-
const o = t.scrollTop,
|
|
3489
|
-
o > 0 ? n.style.opacity = "1" : n.style.opacity = "0", o +
|
|
3471
|
+
const c = () => {
|
|
3472
|
+
const o = t.scrollTop, l = t.scrollHeight, d = t.clientHeight;
|
|
3473
|
+
o > 0 ? n.style.opacity = "1" : n.style.opacity = "0", o + d < l - 1 ? a.style.opacity = "1" : a.style.opacity = "0";
|
|
3490
3474
|
};
|
|
3491
|
-
|
|
3475
|
+
c(), t.addEventListener("scroll", c), e.appendChild(t), this._previewContainer = e, this._dropzone.appendChild(e), this._updateDragStateClass();
|
|
3492
3476
|
}
|
|
3493
3477
|
_removeFileAt(e) {
|
|
3494
3478
|
if (e < 0 || e >= this._selectedFiles.length) return;
|
|
@@ -3518,8 +3502,8 @@ class ae extends HTMLElement {
|
|
|
3518
3502
|
);
|
|
3519
3503
|
}
|
|
3520
3504
|
}
|
|
3521
|
-
customElements.get("mint-dropzone") || customElements.define("mint-dropzone",
|
|
3522
|
-
class
|
|
3505
|
+
customElements.get("mint-dropzone") || customElements.define("mint-dropzone", ie);
|
|
3506
|
+
class se extends HTMLElement {
|
|
3523
3507
|
constructor() {
|
|
3524
3508
|
super(), this._form = null, this._submitHandler = null, this._hostSubmitHandler = null, this._errors = {}, this._fieldBlurHandlers = /* @__PURE__ */ new Map(), this._fieldChangeHandlers = /* @__PURE__ */ new Map(), this._observer = null;
|
|
3525
3509
|
}
|
|
@@ -3596,56 +3580,56 @@ class oe extends HTMLElement {
|
|
|
3596
3580
|
const i = this.getAttribute("action"), s = (this.getAttribute("method") || "POST").toUpperCase(), r = this.getAttribute("enctype") || "application/x-www-form-urlencoded";
|
|
3597
3581
|
if (!i)
|
|
3598
3582
|
return { status: 0, ok: !0, data: { values: t } };
|
|
3599
|
-
const n = Array.from(e.values()).some((
|
|
3583
|
+
const n = Array.from(e.values()).some((l) => l instanceof File);
|
|
3600
3584
|
let a = null;
|
|
3601
|
-
const
|
|
3585
|
+
const c = {};
|
|
3602
3586
|
let o = i;
|
|
3603
3587
|
if (s === "GET") {
|
|
3604
|
-
const
|
|
3605
|
-
e.forEach((
|
|
3606
|
-
|
|
3607
|
-
}), o += (i.includes("?") ? "&" : "?") +
|
|
3588
|
+
const l = new URLSearchParams();
|
|
3589
|
+
e.forEach((d, h) => {
|
|
3590
|
+
d instanceof File || l.append(h, String(d));
|
|
3591
|
+
}), o += (i.includes("?") ? "&" : "?") + l.toString();
|
|
3608
3592
|
} else if (r === "multipart/form-data" || n)
|
|
3609
3593
|
a = e;
|
|
3610
3594
|
else if (r === "application/json")
|
|
3611
|
-
a = JSON.stringify(t),
|
|
3595
|
+
a = JSON.stringify(t), c["Content-Type"] = "application/json";
|
|
3612
3596
|
else {
|
|
3613
|
-
const
|
|
3614
|
-
e.forEach((
|
|
3615
|
-
|
|
3616
|
-
}), a =
|
|
3597
|
+
const l = new URLSearchParams();
|
|
3598
|
+
e.forEach((d, h) => {
|
|
3599
|
+
d instanceof File || l.append(h, String(d));
|
|
3600
|
+
}), a = l, c["Content-Type"] = "application/x-www-form-urlencoded";
|
|
3617
3601
|
}
|
|
3618
3602
|
if (typeof fetch == "function") {
|
|
3619
|
-
const
|
|
3603
|
+
const l = await fetch(o, {
|
|
3620
3604
|
method: s,
|
|
3621
3605
|
body: s === "GET" ? null : a,
|
|
3622
|
-
headers:
|
|
3623
|
-
}),
|
|
3624
|
-
let
|
|
3606
|
+
headers: c
|
|
3607
|
+
}), d = await l.text().catch(() => "");
|
|
3608
|
+
let h = d;
|
|
3625
3609
|
try {
|
|
3626
|
-
|
|
3610
|
+
h = JSON.parse(d);
|
|
3627
3611
|
} catch {
|
|
3628
3612
|
}
|
|
3629
|
-
if (!
|
|
3630
|
-
throw { status:
|
|
3631
|
-
return { status:
|
|
3632
|
-
}
|
|
3633
|
-
return await new Promise((
|
|
3634
|
-
const
|
|
3635
|
-
|
|
3636
|
-
const { status: u, responseText:
|
|
3613
|
+
if (!l.ok)
|
|
3614
|
+
throw { status: l.status, data: h };
|
|
3615
|
+
return { status: l.status, ok: l.ok, data: h };
|
|
3616
|
+
}
|
|
3617
|
+
return await new Promise((l, d) => {
|
|
3618
|
+
const h = new XMLHttpRequest();
|
|
3619
|
+
h.open(s, o, !0), Object.entries(c).forEach(([u, b]) => h.setRequestHeader(u, b)), h.onload = function() {
|
|
3620
|
+
const { status: u, responseText: b } = h;
|
|
3637
3621
|
if (u >= 200 && u < 300) {
|
|
3638
|
-
let
|
|
3622
|
+
let f = b;
|
|
3639
3623
|
try {
|
|
3640
|
-
|
|
3624
|
+
f = JSON.parse(b);
|
|
3641
3625
|
} catch {
|
|
3642
3626
|
}
|
|
3643
|
-
|
|
3627
|
+
l({ status: u, ok: !0, data: f });
|
|
3644
3628
|
} else
|
|
3645
|
-
|
|
3646
|
-
},
|
|
3647
|
-
|
|
3648
|
-
},
|
|
3629
|
+
d({ status: u, data: b });
|
|
3630
|
+
}, h.onerror = function() {
|
|
3631
|
+
d({ status: h.status, data: h.responseText });
|
|
3632
|
+
}, h.send(s === "GET" ? null : a);
|
|
3649
3633
|
});
|
|
3650
3634
|
}
|
|
3651
3635
|
_formDataToValues(e) {
|
|
@@ -3658,10 +3642,10 @@ class oe extends HTMLElement {
|
|
|
3658
3642
|
const n = s.files;
|
|
3659
3643
|
if (n.length > 0) {
|
|
3660
3644
|
const a = Array.from(n);
|
|
3661
|
-
t[r] && Array.isArray(t[r]) ? a.forEach((
|
|
3645
|
+
t[r] && Array.isArray(t[r]) ? a.forEach((c) => {
|
|
3662
3646
|
t[r].some(
|
|
3663
|
-
(
|
|
3664
|
-
) || t[r].push(
|
|
3647
|
+
(l) => l.name === c.name && l.size === c.size && l.lastModified === c.lastModified
|
|
3648
|
+
) || t[r].push(c);
|
|
3665
3649
|
}) : t[r] = a;
|
|
3666
3650
|
}
|
|
3667
3651
|
}
|
|
@@ -3689,7 +3673,7 @@ class oe extends HTMLElement {
|
|
|
3689
3673
|
_validate(e, t) {
|
|
3690
3674
|
let i = !0;
|
|
3691
3675
|
return this._errors = {}, Object.entries(t || {}).forEach(([s, r]) => {
|
|
3692
|
-
const n = Array.isArray(r) ? r : [r], a = this._getFieldElements(s),
|
|
3676
|
+
const n = Array.isArray(r) ? r : [r], a = this._getFieldElements(s), c = this._extractFieldValue(a), o = this._validateRules(c, n);
|
|
3693
3677
|
o ? (i = !1, this._errors[s] = o, this._flagFieldError(a, o)) : this._clearFieldError(a);
|
|
3694
3678
|
}), i;
|
|
3695
3679
|
}
|
|
@@ -3853,8 +3837,8 @@ class oe extends HTMLElement {
|
|
|
3853
3837
|
if (!r) return;
|
|
3854
3838
|
const n = this._getFieldName(r);
|
|
3855
3839
|
if (!n || !this._collectValidationRules()[n]) return;
|
|
3856
|
-
const
|
|
3857
|
-
(o ||
|
|
3840
|
+
const c = this._extractFieldValue([r]), o = c != null && (typeof c == "string" ? c.trim() !== "" : c instanceof FileList || Array.isArray(c) ? c.length > 0 : !0), l = r.hasAttribute("data-mint-form-error") || s instanceof HTMLElement && (s.hasAttribute("aria-invalid") || s.closest("[data-mint-form-error]"));
|
|
3841
|
+
(o || l) && setTimeout(() => {
|
|
3858
3842
|
this._validateField(n);
|
|
3859
3843
|
}, 0);
|
|
3860
3844
|
};
|
|
@@ -3865,10 +3849,10 @@ class oe extends HTMLElement {
|
|
|
3865
3849
|
if (s instanceof HTMLSelectElement || s.tagName === "MINT-SELECT" || s.closest("mint-select")) {
|
|
3866
3850
|
const o = this._findFieldElement(s);
|
|
3867
3851
|
if (!o) return;
|
|
3868
|
-
const
|
|
3869
|
-
if (!
|
|
3852
|
+
const l = this._getFieldName(o);
|
|
3853
|
+
if (!l || !this._collectValidationRules()[l]) return;
|
|
3870
3854
|
setTimeout(() => {
|
|
3871
|
-
this._validateField(
|
|
3855
|
+
this._validateField(l);
|
|
3872
3856
|
}, 0);
|
|
3873
3857
|
return;
|
|
3874
3858
|
}
|
|
@@ -3918,19 +3902,23 @@ class oe extends HTMLElement {
|
|
|
3918
3902
|
});
|
|
3919
3903
|
}
|
|
3920
3904
|
}
|
|
3921
|
-
customElements.get("mint-form") || customElements.define("mint-form",
|
|
3922
|
-
class
|
|
3905
|
+
customElements.get("mint-form") || customElements.define("mint-form", se);
|
|
3906
|
+
class re extends HTMLElement {
|
|
3923
3907
|
constructor() {
|
|
3924
|
-
super(), this._observer = null;
|
|
3908
|
+
super(), this._observer = null, this._hoverHandlers = /* @__PURE__ */ new Map();
|
|
3925
3909
|
}
|
|
3926
3910
|
static get observedAttributes() {
|
|
3927
3911
|
return ["striped", "hover", "bordered", "compact"];
|
|
3928
3912
|
}
|
|
3929
3913
|
connectedCallback() {
|
|
3930
|
-
this.
|
|
3914
|
+
this.style.display = "block", this.style.width = "100%", this.style.overflowX = "auto", this._observeChanges(), this._applyStyles(), requestAnimationFrame(() => {
|
|
3915
|
+
this._applyStyles(), setTimeout(() => this._applyStyles(), 0), setTimeout(() => this._applyStyles(), 50), setTimeout(() => this._applyStyles(), 100), setTimeout(() => this._applyStyles(), 200);
|
|
3916
|
+
});
|
|
3931
3917
|
}
|
|
3932
3918
|
disconnectedCallback() {
|
|
3933
|
-
this._observer && (this._observer.disconnect(), this._observer = null)
|
|
3919
|
+
this._observer && (this._observer.disconnect(), this._observer = null), this._hoverHandlers.forEach((e, t) => {
|
|
3920
|
+
t.removeEventListener("mouseenter", e.enter), t.removeEventListener("mouseleave", e.leave);
|
|
3921
|
+
}), this._hoverHandlers.clear();
|
|
3934
3922
|
}
|
|
3935
3923
|
attributeChangedCallback() {
|
|
3936
3924
|
this._applyStyles();
|
|
@@ -3948,73 +3936,59 @@ class le extends HTMLElement {
|
|
|
3948
3936
|
const e = this.querySelector("table");
|
|
3949
3937
|
if (!e) return;
|
|
3950
3938
|
const t = this.hasAttribute("bordered"), i = this.hasAttribute("striped"), s = this.hasAttribute("hover"), r = this.hasAttribute("compact");
|
|
3951
|
-
|
|
3952
|
-
"w-full",
|
|
3953
|
-
"border-collapse",
|
|
3954
|
-
"text-sm",
|
|
3955
|
-
"font-medium"
|
|
3956
|
-
]);
|
|
3939
|
+
e.style.width = "100%", e.style.borderCollapse = "collapse", e.style.fontSize = "0.875rem", e.style.fontWeight = "500";
|
|
3957
3940
|
const n = e.querySelector("thead");
|
|
3958
|
-
n && (
|
|
3959
|
-
|
|
3960
|
-
"text-left",
|
|
3961
|
-
"font-semibold",
|
|
3962
|
-
"text-gray-900",
|
|
3963
|
-
"dark:text-white",
|
|
3964
|
-
"uppercase",
|
|
3965
|
-
"tracking-wider",
|
|
3966
|
-
"text-xs"
|
|
3967
|
-
];
|
|
3968
|
-
t && c.push("border", "border-gray-200", "dark:border-gray-700"), r ? c.push("px-3", "py-1.5") : c.push("px-4", "py-3"), this._setClasses(h, c);
|
|
3941
|
+
n && (n.style.backgroundColor = "rgb(249 250 251)", document.documentElement.classList.contains("dark") && (n.style.backgroundColor = "rgb(31 41 55)"), n.querySelectorAll("th").forEach((l) => {
|
|
3942
|
+
l.style.textAlign = "left", l.style.fontWeight = "600", l.style.color = "rgb(17 24 39)", document.documentElement.classList.contains("dark") && (l.style.color = "rgb(255 255 255)"), l.style.textTransform = "uppercase", l.style.letterSpacing = "0.05em", l.style.fontSize = "0.75rem", t && (l.style.border = "1px solid rgb(229 231 235)", document.documentElement.classList.contains("dark") && (l.style.borderColor = "rgb(55 65 81)")), r ? l.style.padding = "0.375rem 0.75rem" : l.style.padding = "0.75rem 1rem";
|
|
3969
3943
|
}));
|
|
3970
3944
|
const a = e.querySelector("tbody");
|
|
3971
|
-
a && (i
|
|
3972
|
-
|
|
3973
|
-
|
|
3974
|
-
const
|
|
3975
|
-
|
|
3976
|
-
|
|
3977
|
-
|
|
3978
|
-
|
|
3945
|
+
a && (i && (a.style.borderTopWidth = "1px", a.style.borderTopStyle = "solid", a.style.borderTopColor = "rgb(229 231 235)", document.documentElement.classList.contains("dark") && (a.style.borderTopColor = "rgb(55 65 81)")), a.querySelectorAll("tr").forEach((l, d) => {
|
|
3946
|
+
if (t && (l.style.borderBottomWidth = "1px", l.style.borderBottomStyle = "solid", l.style.borderBottomColor = "rgb(229 231 235)", document.documentElement.classList.contains("dark") && (l.style.borderBottomColor = "rgb(55 65 81)")), i ? d % 2 === 0 ? (l.style.backgroundColor = "rgb(255 255 255)", document.documentElement.classList.contains("dark") && (l.style.backgroundColor = "rgb(17 24 39)")) : (l.style.backgroundColor = "rgb(249 250 251)", document.documentElement.classList.contains("dark") && (l.style.backgroundColor = "rgb(31 41 55)")) : (l.style.backgroundColor = "rgb(255 255 255)", document.documentElement.classList.contains("dark") && (l.style.backgroundColor = "rgb(17 24 39)")), s) {
|
|
3947
|
+
l.style.transition = "background-color 150ms";
|
|
3948
|
+
const u = this._hoverHandlers.get(l);
|
|
3949
|
+
u && (l.removeEventListener("mouseenter", u.enter), l.removeEventListener("mouseleave", u.leave));
|
|
3950
|
+
const b = () => {
|
|
3951
|
+
l.style.backgroundColor = "rgb(243 244 246)", document.documentElement.classList.contains("dark") && (l.style.backgroundColor = "rgb(31 41 55)");
|
|
3952
|
+
}, f = () => {
|
|
3953
|
+
i ? d % 2 === 0 ? (l.style.backgroundColor = "rgb(255 255 255)", document.documentElement.classList.contains("dark") && (l.style.backgroundColor = "rgb(17 24 39)")) : (l.style.backgroundColor = "rgb(249 250 251)", document.documentElement.classList.contains("dark") && (l.style.backgroundColor = "rgb(31 41 55)")) : (l.style.backgroundColor = "rgb(255 255 255)", document.documentElement.classList.contains("dark") && (l.style.backgroundColor = "rgb(17 24 39)"));
|
|
3954
|
+
};
|
|
3955
|
+
this._hoverHandlers.set(l, { enter: b, leave: f }), l.addEventListener("mouseenter", b), l.addEventListener("mouseleave", f);
|
|
3956
|
+
} else {
|
|
3957
|
+
const u = this._hoverHandlers.get(l);
|
|
3958
|
+
u && (l.removeEventListener("mouseenter", u.enter), l.removeEventListener("mouseleave", u.leave), this._hoverHandlers.delete(l));
|
|
3959
|
+
}
|
|
3960
|
+
l.querySelectorAll("td").forEach((u) => {
|
|
3961
|
+
u.style.color = "rgb(17 24 39)", document.documentElement.classList.contains("dark") && (u.style.color = "rgb(243 244 246)"), t && (u.style.border = "1px solid rgb(229 231 235)", document.documentElement.classList.contains("dark") && (u.style.borderColor = "rgb(55 65 81)")), r ? u.style.padding = "0.375rem 0.75rem" : u.style.padding = "0.75rem 1rem";
|
|
3979
3962
|
});
|
|
3980
3963
|
}));
|
|
3981
|
-
const
|
|
3982
|
-
|
|
3983
|
-
|
|
3984
|
-
"text-gray-900",
|
|
3985
|
-
"dark:text-gray-100"
|
|
3986
|
-
];
|
|
3987
|
-
t && c.push("border", "border-gray-200", "dark:border-gray-700"), r ? c.push("px-3", "py-1.5") : c.push("px-4", "py-3"), this._setClasses(h, c);
|
|
3964
|
+
const c = e.querySelector("tfoot");
|
|
3965
|
+
c && (c.style.backgroundColor = "rgb(249 250 251)", document.documentElement.classList.contains("dark") && (c.style.backgroundColor = "rgb(31 41 55)"), c.style.fontWeight = "600", c.querySelectorAll("td").forEach((l) => {
|
|
3966
|
+
l.style.color = "rgb(17 24 39)", document.documentElement.classList.contains("dark") && (l.style.color = "rgb(243 244 246)"), t && (l.style.border = "1px solid rgb(229 231 235)", document.documentElement.classList.contains("dark") && (l.style.borderColor = "rgb(55 65 81)")), r ? l.style.padding = "0.375rem 0.75rem" : l.style.padding = "0.75rem 1rem";
|
|
3988
3967
|
}));
|
|
3989
3968
|
}
|
|
3990
|
-
_setClasses(e, t) {
|
|
3991
|
-
e.className = "", t.forEach((i) => {
|
|
3992
|
-
i && i.trim() && e.classList.add(i);
|
|
3993
|
-
});
|
|
3994
|
-
}
|
|
3995
3969
|
}
|
|
3996
|
-
customElements.get("mint-table") || customElements.define("mint-table",
|
|
3970
|
+
customElements.get("mint-table") || customElements.define("mint-table", re);
|
|
3997
3971
|
export {
|
|
3998
|
-
|
|
3999
|
-
|
|
4000
|
-
|
|
4001
|
-
|
|
4002
|
-
|
|
4003
|
-
|
|
4004
|
-
|
|
4005
|
-
|
|
4006
|
-
|
|
4007
|
-
|
|
4008
|
-
|
|
4009
|
-
|
|
4010
|
-
|
|
4011
|
-
|
|
4012
|
-
|
|
4013
|
-
|
|
4014
|
-
|
|
4015
|
-
|
|
4016
|
-
|
|
4017
|
-
|
|
4018
|
-
|
|
4019
|
-
|
|
3972
|
+
Y as BackButton,
|
|
3973
|
+
z as Button,
|
|
3974
|
+
j as Card,
|
|
3975
|
+
K as Checkbox,
|
|
3976
|
+
Z as Choice,
|
|
3977
|
+
ee as DatePicker,
|
|
3978
|
+
ie as Dropzone,
|
|
3979
|
+
se as Form,
|
|
3980
|
+
G as Grid,
|
|
3981
|
+
B as Icon,
|
|
3982
|
+
Q as Input,
|
|
3983
|
+
$ as Link,
|
|
3984
|
+
J as Modal,
|
|
3985
|
+
U as Page,
|
|
3986
|
+
X as Popover,
|
|
3987
|
+
te as Select,
|
|
3988
|
+
q as Spinner,
|
|
3989
|
+
W as Stack,
|
|
3990
|
+
V as Switch,
|
|
3991
|
+
re as Table,
|
|
3992
|
+
R as Text,
|
|
3993
|
+
z as default
|
|
4020
3994
|
};
|