monobill-mintui 0.3.46 → 0.3.48
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/README.md +19 -1
- package/dist/components/alert/Alert.d.ts.map +1 -1
- package/dist/components/button/Button.d.ts.map +1 -1
- package/dist/components/checkbox/Checkbox.d.ts.map +1 -1
- package/dist/components/chip/Chip.d.ts.map +1 -1
- package/dist/components/choice/Choice.d.ts.map +1 -1
- package/dist/components/choice/ChoiceOption.d.ts.map +1 -1
- package/dist/components/clickable/Clickable.d.ts.map +1 -1
- package/dist/components/date-picker/DatePicker.d.ts.map +1 -1
- package/dist/components/dropzone/Dropzone.d.ts.map +1 -1
- package/dist/components/input/Input.d.ts.map +1 -1
- package/dist/components/modal/Modal.d.ts.map +1 -1
- package/dist/components/off-canvas/OffCanvas.d.ts +1 -0
- package/dist/components/off-canvas/OffCanvas.d.ts.map +1 -1
- package/dist/components/page/Page.d.ts.map +1 -1
- package/dist/components/popover/Popover.d.ts.map +1 -1
- package/dist/components/select/Select.d.ts.map +1 -1
- package/dist/components/switch/Switch.d.ts.map +1 -1
- package/dist/components/tabs/Tab.d.ts +19 -0
- package/dist/components/tabs/Tab.d.ts.map +1 -0
- package/dist/components/tabs/TabContent.d.ts +13 -0
- package/dist/components/tabs/TabContent.d.ts.map +1 -0
- package/dist/components/tabs/TabList.d.ts +12 -0
- package/dist/components/tabs/TabList.d.ts.map +1 -0
- package/dist/components/tabs/Tabs.d.ts +20 -0
- package/dist/components/tabs/Tabs.d.ts.map +1 -0
- package/dist/components/tabs/index.d.ts +9 -0
- package/dist/components/tabs/index.d.ts.map +1 -0
- package/dist/components/tags/Tags.d.ts.map +1 -1
- package/dist/components/text/Text.d.ts.map +1 -1
- package/dist/index.cjs +6 -6
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +765 -463
- package/package.json +8 -2
- package/tailwind.preset.cjs +23 -0
- package/tailwind.preset.js +23 -0
package/dist/index.js
CHANGED
|
@@ -227,11 +227,10 @@ const W = class W extends HTMLElement {
|
|
|
227
227
|
return (t || e || "default") === "submit" ? "submit" : "button";
|
|
228
228
|
}
|
|
229
229
|
isFullWidth() {
|
|
230
|
-
return this.
|
|
230
|
+
return this.getAttribute("full-width") === "true";
|
|
231
231
|
}
|
|
232
232
|
isActive() {
|
|
233
|
-
|
|
234
|
-
return !(t === null || t === "false" || t === "0");
|
|
233
|
+
return this.getAttribute("active") === "true";
|
|
235
234
|
}
|
|
236
235
|
// Convenience property for programmatic usage: button.active = true/false
|
|
237
236
|
get active() {
|
|
@@ -455,16 +454,16 @@ const W = class W extends HTMLElement {
|
|
|
455
454
|
],
|
|
456
455
|
"solid-neutral": [
|
|
457
456
|
"bg-white",
|
|
458
|
-
"dark:bg-gray-
|
|
457
|
+
"dark:bg-gray-900",
|
|
459
458
|
"text-gray-900",
|
|
460
459
|
"dark:text-white",
|
|
461
460
|
"hover:bg-gray-50",
|
|
462
|
-
"dark:hover:bg-gray-
|
|
461
|
+
"dark:hover:bg-gray-800",
|
|
463
462
|
"active:bg-gray-100",
|
|
464
463
|
"active:shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]",
|
|
465
464
|
"dark:active:bg-gray-800",
|
|
466
465
|
"disabled:active:bg-white",
|
|
467
|
-
"dark:disabled:active:bg-gray-
|
|
466
|
+
"dark:disabled:active:bg-gray-900",
|
|
468
467
|
"disabled:active:shadow-none",
|
|
469
468
|
"focus-visible:ring-gray-400",
|
|
470
469
|
"dark:focus-visible:ring-gray-500",
|
|
@@ -473,7 +472,7 @@ const W = class W extends HTMLElement {
|
|
|
473
472
|
"dark:shadow-gray-900/50",
|
|
474
473
|
"border-2",
|
|
475
474
|
"border-gray-200",
|
|
476
|
-
"dark:border-gray-
|
|
475
|
+
"dark:border-gray-700"
|
|
477
476
|
],
|
|
478
477
|
"solid-info": [
|
|
479
478
|
"bg-blue-800",
|
|
@@ -728,7 +727,7 @@ const W = class W extends HTMLElement {
|
|
|
728
727
|
return this.isFullWidth() && o.push("w-full"), o.join(" ");
|
|
729
728
|
}
|
|
730
729
|
render() {
|
|
731
|
-
var h, p, d,
|
|
730
|
+
var h, p, d, f, u, m;
|
|
732
731
|
const t = this.isDisabled() || this.isLoading(), e = this.getType();
|
|
733
732
|
if (!this._button) {
|
|
734
733
|
for (this._button = document.createElement("button"); this.firstChild; )
|
|
@@ -742,10 +741,10 @@ const W = class W extends HTMLElement {
|
|
|
742
741
|
if (i)
|
|
743
742
|
i.setAttribute("data-button-variant", this.getVariant()), i.setAttribute("data-button-tone", this.getTone()), "render" in i && typeof i.render == "function" && i.render();
|
|
744
743
|
else {
|
|
745
|
-
const
|
|
746
|
-
|
|
747
|
-
const
|
|
748
|
-
|
|
744
|
+
const g = document.createElement("span");
|
|
745
|
+
g.className = "mr-2 inline-flex items-center";
|
|
746
|
+
const b = document.createElement("mint-spinner");
|
|
747
|
+
b.setAttribute("size", "default"), b.setAttribute("data-button-variant", this.getVariant()), b.setAttribute("data-button-tone", this.getTone()), b.style.width = "0.875rem", b.style.height = "0.875rem", g.appendChild(b), this._button.insertBefore(g, this._button.firstChild);
|
|
749
748
|
}
|
|
750
749
|
else i && ((h = i.parentElement) == null || h.remove());
|
|
751
750
|
for (; this.firstChild && this.firstChild !== this._button; )
|
|
@@ -756,40 +755,40 @@ const W = class W extends HTMLElement {
|
|
|
756
755
|
const a = this.getIconPosition();
|
|
757
756
|
let o = this._button.querySelector(".mint-button-content");
|
|
758
757
|
if (o) {
|
|
759
|
-
const
|
|
758
|
+
const g = r && r.tagName === "MINT-ICON";
|
|
760
759
|
if (r && !r.parentElement) {
|
|
761
|
-
const
|
|
762
|
-
|
|
763
|
-
} else if (r && (
|
|
760
|
+
const b = (f = this._button.querySelector("mint-spinner")) == null ? void 0 : f.parentElement;
|
|
761
|
+
g || a === "left" ? b ? b.insertAdjacentElement("afterend", r) : this._button.insertBefore(r, o) : o.insertAdjacentElement("afterend", r);
|
|
762
|
+
} else if (r && (g || a === "left") && r.nextSibling !== o) {
|
|
764
763
|
r.remove();
|
|
765
|
-
const
|
|
766
|
-
|
|
767
|
-
} else r && !
|
|
764
|
+
const b = (u = this._button.querySelector("mint-spinner")) == null ? void 0 : u.parentElement;
|
|
765
|
+
b ? b.insertAdjacentElement("afterend", r) : this._button.insertBefore(r, o);
|
|
766
|
+
} else r && !g && a === "right" && r.previousSibling !== o && (r.remove(), o.insertAdjacentElement("afterend", r));
|
|
768
767
|
} else {
|
|
769
|
-
const
|
|
770
|
-
for (let
|
|
771
|
-
if (
|
|
772
|
-
|
|
768
|
+
const g = [];
|
|
769
|
+
for (let b = this._button.firstChild; b; b = b.nextSibling) {
|
|
770
|
+
if (b.nodeType !== Node.ELEMENT_NODE) {
|
|
771
|
+
g.push(b);
|
|
773
772
|
continue;
|
|
774
773
|
}
|
|
775
|
-
const
|
|
776
|
-
|
|
774
|
+
const _ = b;
|
|
775
|
+
_.tagName !== "MINT-SPINNER" && !_.querySelector("mint-spinner") && b !== r && !_.hasAttribute("slot") && !(_.className === "mr-2" && _.querySelector("mint-spinner")) && g.push(b);
|
|
777
776
|
}
|
|
778
|
-
if (
|
|
779
|
-
o = document.createElement("span"), o.className = "mint-button-content inline-flex items-center",
|
|
780
|
-
o.appendChild(
|
|
777
|
+
if (g.length > 0) {
|
|
778
|
+
o = document.createElement("span"), o.className = "mint-button-content inline-flex items-center", g.forEach((_) => {
|
|
779
|
+
o.appendChild(_);
|
|
781
780
|
});
|
|
782
|
-
const
|
|
783
|
-
r && a === "left" ?
|
|
781
|
+
const b = (p = this._button.querySelector("mint-spinner")) == null ? void 0 : p.parentElement;
|
|
782
|
+
r && a === "left" ? b ? (b.insertAdjacentElement("afterend", r), r.insertAdjacentElement("afterend", o)) : (this._button.insertBefore(r, this._button.firstChild), r.insertAdjacentElement("afterend", o)) : r && a === "right" ? b ? (b.insertAdjacentElement("afterend", o), o.insertAdjacentElement("afterend", r)) : (this._button.insertBefore(o, this._button.firstChild), o.insertAdjacentElement("afterend", r)) : b ? b.insertAdjacentElement("afterend", o) : this._button.insertBefore(o, this._button.firstChild);
|
|
784
783
|
} else if (r && r.tagName === "MINT-ICON" && !r.parentElement) {
|
|
785
|
-
const
|
|
786
|
-
|
|
784
|
+
const b = (d = this._button.querySelector("mint-spinner")) == null ? void 0 : d.parentElement;
|
|
785
|
+
b ? b.insertAdjacentElement("afterend", r) : this._button.insertBefore(r, this._button.firstChild);
|
|
787
786
|
}
|
|
788
787
|
}
|
|
789
788
|
const l = this.isIconOnly();
|
|
790
789
|
if (r && (r.classList.contains("mint-button-icon") || r.classList.add("mint-button-icon"), s ? r.style.display = "none" : r.style.display = "", r.classList.remove("mr-1.5", "ml-1.5"), l ? 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")) : a === "left" ? r.classList.add("mr-1.5") : r.classList.add("ml-1.5")), s) {
|
|
791
|
-
const
|
|
792
|
-
|
|
790
|
+
const g = (m = this._button.querySelector("mint-spinner")) == null ? void 0 : m.parentElement;
|
|
791
|
+
g && (l ? (g.classList.remove("mr-2"), g.classList.add("mr-0")) : g.classList.contains("mr-2") || (g.classList.remove("mr-0"), g.classList.add("mr-2")));
|
|
793
792
|
}
|
|
794
793
|
const c = this.getButtonClasses();
|
|
795
794
|
this._button.className = c, this.setAttribute("data-variant", this.getVariant()), this.setAttribute("data-tone", this.getTone()), this.isActive() ? this._button.classList.add("mint-button-active") : this._button.classList.remove("mint-button-active");
|
|
@@ -843,7 +842,9 @@ class tt extends HTMLElement {
|
|
|
843
842
|
return ["checked", "disabled", "label", "icon", "info", "error", "error-message", "loading"];
|
|
844
843
|
}
|
|
845
844
|
connectedCallback() {
|
|
846
|
-
this.classList.add("box-border", "m-0", "p-0", "border-0", "align-baseline", "block", "w-full")
|
|
845
|
+
this.classList.add("box-border", "m-0", "p-0", "border-0", "align-baseline", "block", "w-full");
|
|
846
|
+
const t = this.getAttribute("checked");
|
|
847
|
+
this._checked = t === "true", this.render();
|
|
847
848
|
}
|
|
848
849
|
_getSwitchContainer() {
|
|
849
850
|
let t = this.querySelector(".mint-switch-container");
|
|
@@ -853,10 +854,10 @@ class tt extends HTMLElement {
|
|
|
853
854
|
this.removeEventListeners();
|
|
854
855
|
}
|
|
855
856
|
isLoading() {
|
|
856
|
-
return this.
|
|
857
|
+
return this.getAttribute("loading") === "true";
|
|
857
858
|
}
|
|
858
859
|
attributeChangedCallback(t, e, i) {
|
|
859
|
-
if (t === "checked" && (this._checked = i
|
|
860
|
+
if (t === "checked" && (this._checked = i === "true"), e !== i) {
|
|
860
861
|
if (t === "error" || t === "error-message") {
|
|
861
862
|
this._renderErrorState();
|
|
862
863
|
return;
|
|
@@ -877,12 +878,12 @@ class tt extends HTMLElement {
|
|
|
877
878
|
}
|
|
878
879
|
set checked(t) {
|
|
879
880
|
try {
|
|
880
|
-
t ? this.setAttribute("checked", "") : this.
|
|
881
|
+
t ? this.setAttribute("checked", "true") : this.setAttribute("checked", "false"), this._checked = !!t, this.render();
|
|
881
882
|
} catch {
|
|
882
883
|
}
|
|
883
884
|
}
|
|
884
885
|
isDisabled() {
|
|
885
|
-
return this.
|
|
886
|
+
return this.getAttribute("disabled") === "true";
|
|
886
887
|
}
|
|
887
888
|
getLabel() {
|
|
888
889
|
return this.getAttribute("label") || "";
|
|
@@ -897,7 +898,7 @@ class tt extends HTMLElement {
|
|
|
897
898
|
return !!this.getIcon();
|
|
898
899
|
}
|
|
899
900
|
hasError() {
|
|
900
|
-
return this.
|
|
901
|
+
return this.getAttribute("error") === "true";
|
|
901
902
|
}
|
|
902
903
|
getErrorMessage() {
|
|
903
904
|
return this.getAttribute("error-message") || "";
|
|
@@ -981,8 +982,8 @@ class tt extends HTMLElement {
|
|
|
981
982
|
if (r) {
|
|
982
983
|
let d = h;
|
|
983
984
|
d || (d = document.createElement("span"), d.className = this.getIconClasses(), c.appendChild(d));
|
|
984
|
-
let
|
|
985
|
-
|
|
985
|
+
let f = d.querySelector("mint-icon");
|
|
986
|
+
f || (f = document.createElement("mint-icon"), d.appendChild(f)), f.setAttribute("name", r);
|
|
986
987
|
} else h && h.remove();
|
|
987
988
|
let p = this.querySelector(".mint-switch-info");
|
|
988
989
|
n ? (p || (p = document.createElement("span"), p.className = "mint-switch-info text-xs text-gray-500 dark:text-gray-400 select-none mt-1 block", o && o.parentElement === this ? this.insertBefore(p, o.nextSibling) : this.appendChild(p)), p.textContent = n, this.isDisabled() ? p.classList.add("opacity-40") : p.classList.remove("opacity-40")) : p && p.remove(), this._renderErrorState(), this._renderSkeleton(t);
|
|
@@ -1094,19 +1095,20 @@ class et extends HTMLElement {
|
|
|
1094
1095
|
return this.getAttribute("size") || "regular";
|
|
1095
1096
|
}
|
|
1096
1097
|
isBold() {
|
|
1097
|
-
return this.
|
|
1098
|
+
return this.getAttribute("bold") === "true";
|
|
1098
1099
|
}
|
|
1099
1100
|
isUnderline() {
|
|
1100
|
-
return this.
|
|
1101
|
+
return this.getAttribute("underline") === "true";
|
|
1101
1102
|
}
|
|
1102
1103
|
isStrike() {
|
|
1103
|
-
return this.
|
|
1104
|
+
return this.getAttribute("strike") === "true";
|
|
1104
1105
|
}
|
|
1105
1106
|
isItalic() {
|
|
1106
|
-
return this.
|
|
1107
|
+
return this.getAttribute("italic") === "true";
|
|
1107
1108
|
}
|
|
1108
1109
|
getDisplay() {
|
|
1109
|
-
|
|
1110
|
+
const t = this.getAttribute("display");
|
|
1111
|
+
return t || (this.getAttribute("inline") === "true" ? "inline-block" : "block");
|
|
1110
1112
|
}
|
|
1111
1113
|
getTextClasses() {
|
|
1112
1114
|
const t = this.getSize(), e = this.getVariant(), i = document.documentElement.classList.contains("dark"), s = {
|
|
@@ -1284,7 +1286,7 @@ class st extends HTMLElement {
|
|
|
1284
1286
|
return ["heading"];
|
|
1285
1287
|
}
|
|
1286
1288
|
connectedCallback() {
|
|
1287
|
-
this.classList.add("box-border", "m-0", "
|
|
1289
|
+
this.classList.add("box-border", "m-0", "align-baseline", "block"), this.render();
|
|
1288
1290
|
}
|
|
1289
1291
|
attributeChangedCallback(t, e, i) {
|
|
1290
1292
|
e !== i && this.render();
|
|
@@ -1302,7 +1304,7 @@ class st extends HTMLElement {
|
|
|
1302
1304
|
);
|
|
1303
1305
|
}
|
|
1304
1306
|
render() {
|
|
1305
|
-
this.classList.add("rounded-lg", "shadow", "bg-white", "dark:bg-gray-
|
|
1307
|
+
this.classList.add("rounded-lg", "shadow", "bg-white", "dark:bg-gray-900", "border", "border-gray-200", "dark:border-gray-700", "overflow-hidden", "transition-colors", "duration-200", "mb-6"), this.hasPaddingClass() || this.classList.add("p-4");
|
|
1306
1308
|
const t = this.getHeading();
|
|
1307
1309
|
t ? (this._headingElement || (this._headingElement = document.createElement("mint-text"), this._headingElement.setAttribute("size", "sub-heading"), this.insertBefore(this._headingElement, this.firstChild)), this._headingElement.textContent = t) : this._headingElement && this._headingElement.parentNode && (this._headingElement.remove(), this._headingElement = null);
|
|
1308
1310
|
}
|
|
@@ -1445,7 +1447,7 @@ class at extends HTMLElement {
|
|
|
1445
1447
|
this.classList.add("box-border", "m-0", "p-0", "border-0", "align-baseline", "block"), this.render(), this._observeDarkMode(), this._setupBackButtonListener();
|
|
1446
1448
|
}
|
|
1447
1449
|
attributeChangedCallback(t, e, i) {
|
|
1448
|
-
e !== i && this.render();
|
|
1450
|
+
e !== i && (t === "containered" && this._applyContainerClasses(), this.render());
|
|
1449
1451
|
}
|
|
1450
1452
|
disconnectedCallback() {
|
|
1451
1453
|
this._darkModeObserver && (this._darkModeObserver.disconnect(), this._darkModeObserver = null), this._removeBackButtonListener();
|
|
@@ -1457,7 +1459,7 @@ class at extends HTMLElement {
|
|
|
1457
1459
|
return this.getAttribute("fallback-href") || "/";
|
|
1458
1460
|
}
|
|
1459
1461
|
shouldShowBackButton() {
|
|
1460
|
-
return this.
|
|
1462
|
+
return this.getAttribute("show-back-button") === "true";
|
|
1461
1463
|
}
|
|
1462
1464
|
render() {
|
|
1463
1465
|
const t = this.getHeading();
|
|
@@ -1468,7 +1470,7 @@ class at extends HTMLElement {
|
|
|
1468
1470
|
const r = this.getFallbackHref();
|
|
1469
1471
|
e.setAttribute("fallback-href", r), this._backButton = e;
|
|
1470
1472
|
} else e && (e.remove(), e = null, this._backButton = null);
|
|
1471
|
-
t ? (this._headingText ? (this._headingText.classList.add("truncate", "min-w-0"), e && e.parentElement === this._titleElement ? this._headingText.previousSibling !== e && this._titleElement.insertBefore(this._headingText, e.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"), e && e.parentElement === this._titleElement ? this._titleElement.insertBefore(this._headingText, e.nextSibling) : this._titleElement.insertBefore(this._headingText, this._titleElement.firstChild)), this._headingText.textContent = t) : 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(
|
|
1473
|
+
t ? (this._headingText ? (this._headingText.classList.add("truncate", "min-w-0"), e && e.parentElement === this._titleElement ? this._headingText.previousSibling !== e && this._titleElement.insertBefore(this._headingText, e.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", "true"), this._headingText.classList.add("truncate", "min-w-0"), e && e.parentElement === this._titleElement ? this._titleElement.insertBefore(this._headingText, e.nextSibling) : this._titleElement.insertBefore(this._headingText, this._titleElement.firstChild)), this._headingText.textContent = t) : 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(
|
|
1472
1474
|
(r) => r !== this._pageContainer && r !== this._actionsSlot && r.getAttribute("slot") === "actions"
|
|
1473
1475
|
).forEach((r) => {
|
|
1474
1476
|
this._actionsSlot && r.parentElement !== this._actionsSlot && this._actionsSlot.appendChild(r);
|
|
@@ -1478,9 +1480,7 @@ class at extends HTMLElement {
|
|
|
1478
1480
|
}
|
|
1479
1481
|
_applyContainerClasses() {
|
|
1480
1482
|
if (!this._pageContainer) return;
|
|
1481
|
-
this._pageContainer.classList.add("min-h-screen", "p-8", "transition-colors", "duration-200");
|
|
1482
|
-
const t = this.getAttribute("containered");
|
|
1483
|
-
t !== null && t !== "false" ? this._pageContainer.classList.add("max-w-6xl", "mx-auto", "w-full") : this._pageContainer.classList.remove("max-w-6xl", "mx-auto", "w-full");
|
|
1483
|
+
this._pageContainer.classList.add("min-h-screen", "p-8", "transition-colors", "duration-200"), this.getAttribute("containered") === "true" ? this._pageContainer.classList.add("max-w-6xl", "mx-auto", "w-full") : this._pageContainer.classList.remove("max-w-6xl", "mx-auto", "w-full");
|
|
1484
1484
|
}
|
|
1485
1485
|
_updateBackgroundColor() {
|
|
1486
1486
|
if (!this._pageContainer) return;
|
|
@@ -1591,10 +1591,10 @@ class lt extends HTMLElement {
|
|
|
1591
1591
|
return this.getAttribute("heading") || "";
|
|
1592
1592
|
}
|
|
1593
1593
|
isOpen() {
|
|
1594
|
-
return this.
|
|
1594
|
+
return this.getAttribute("open") === "true";
|
|
1595
1595
|
}
|
|
1596
1596
|
open() {
|
|
1597
|
-
this.setAttribute("open", "");
|
|
1597
|
+
this.setAttribute("open", "true");
|
|
1598
1598
|
}
|
|
1599
1599
|
close() {
|
|
1600
1600
|
this.removeAttribute("open");
|
|
@@ -1603,13 +1603,13 @@ class lt extends HTMLElement {
|
|
|
1603
1603
|
const t = this.getId(), e = this.getHeading(), i = this.isOpen();
|
|
1604
1604
|
if (t && (this.id = t), 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) {
|
|
1605
1605
|
let h = this._modal.querySelector(".modal-content");
|
|
1606
|
-
h || (h = document.createElement("div"), h.className = "modal-content bg-white dark:bg-gray-
|
|
1606
|
+
h || (h = document.createElement("div"), h.className = "modal-content bg-white dark:bg-gray-900 dark:border dark:border-gray-700 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(h)), this._animateEnter();
|
|
1607
1607
|
} else
|
|
1608
1608
|
this._animateExit();
|
|
1609
1609
|
let s = this._modal.querySelector(".modal-content");
|
|
1610
|
-
s || (s = document.createElement("div"), s.className = "modal-content bg-white dark:bg-gray-
|
|
1610
|
+
s || (s = document.createElement("div"), s.className = "modal-content bg-white dark:bg-gray-900 dark:border dark:border-gray-700 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));
|
|
1611
1611
|
let n = this._headingSlot.querySelector("mint-text");
|
|
1612
|
-
e ? (n || (n = document.createElement("mint-text"), n.setAttribute("size", "sub-heading"), n.setAttribute("bold", ""), this._headingSlot.appendChild(n)), n.textContent = e) : n && n.remove(), Array.from(this.children).filter(
|
|
1612
|
+
e ? (n || (n = document.createElement("mint-text"), n.setAttribute("size", "sub-heading"), n.setAttribute("bold", "true"), this._headingSlot.appendChild(n)), n.textContent = e) : n && n.remove(), Array.from(this.children).filter(
|
|
1613
1613
|
(h) => h !== this._overlay && h !== this._modal && h !== this._headingSlot && h.getAttribute("slot") === "heading"
|
|
1614
1614
|
).forEach((h) => {
|
|
1615
1615
|
this._headingSlot && h.parentElement !== this._headingSlot && this._headingSlot.appendChild(h);
|
|
@@ -1632,7 +1632,7 @@ class lt extends HTMLElement {
|
|
|
1632
1632
|
_updateBackgroundColor() {
|
|
1633
1633
|
if (!this._modal) return;
|
|
1634
1634
|
const t = document.documentElement.classList.contains("dark"), e = this._modal.querySelector(".modal-content");
|
|
1635
|
-
e && (t ? (e.classList.remove("bg-white"), e.classList.add("bg-gray-
|
|
1635
|
+
e && (t ? (e.classList.remove("bg-white"), e.classList.add("bg-gray-900", "border", "border-gray-700")) : (e.classList.remove("bg-gray-900", "border", "border-gray-700"), e.classList.add("bg-white")));
|
|
1636
1636
|
}
|
|
1637
1637
|
_observeDarkMode() {
|
|
1638
1638
|
this._darkModeObserver || (this._darkModeObserver = new MutationObserver(() => {
|
|
@@ -1734,13 +1734,13 @@ class ct extends HTMLElement {
|
|
|
1734
1734
|
return this.getAttribute("trigger-id") || "";
|
|
1735
1735
|
}
|
|
1736
1736
|
isHoverEnabled() {
|
|
1737
|
-
return this.
|
|
1737
|
+
return this.getAttribute("hover") === "true";
|
|
1738
1738
|
}
|
|
1739
1739
|
isOpen() {
|
|
1740
|
-
return this.
|
|
1740
|
+
return this.getAttribute("open") === "true";
|
|
1741
1741
|
}
|
|
1742
1742
|
open() {
|
|
1743
|
-
this.setAttribute("open", "");
|
|
1743
|
+
this.setAttribute("open", "true");
|
|
1744
1744
|
}
|
|
1745
1745
|
close() {
|
|
1746
1746
|
this.removeAttribute("open");
|
|
@@ -1755,7 +1755,7 @@ class ct extends HTMLElement {
|
|
|
1755
1755
|
if (this._triggerElement && !this._triggerClickHandler) {
|
|
1756
1756
|
const t = this;
|
|
1757
1757
|
this._triggerClickHandler = function(e) {
|
|
1758
|
-
e.stopImmediatePropagation(), e.preventDefault(), t.
|
|
1758
|
+
e.stopImmediatePropagation(), e.preventDefault(), t.getAttribute("open") === "true" ? t.removeAttribute("open") : t.setAttribute("open", "true");
|
|
1759
1759
|
}, this._triggerElement.addEventListener("click", this._triggerClickHandler, !0);
|
|
1760
1760
|
}
|
|
1761
1761
|
}
|
|
@@ -1879,7 +1879,7 @@ class ct extends HTMLElement {
|
|
|
1879
1879
|
this.isHoverEnabled() && this._attachHoverListeners();
|
|
1880
1880
|
let s = this._popover.querySelector(".popover-content");
|
|
1881
1881
|
if (!s)
|
|
1882
|
-
s = document.createElement("div"), s.className = `popover-content bg-white dark:bg-gray-
|
|
1882
|
+
s = document.createElement("div"), s.className = `popover-content bg-white dark:bg-gray-900 dark:border dark:border-gray-700 rounded-lg shadow-xl ${i} transition-all duration-200 ease-out transform`, this._popover.appendChild(s);
|
|
1883
1883
|
else {
|
|
1884
1884
|
const r = s.className.split(" "), a = ["p-0", "p-0.5", "p-1", "p-1.5", "p-2", "p-2.5", "p-3", "p-3.5", "p-4", "p-5", "p-6", "p-8", "p-10", "p-12", "p-16", "p-20", "p-24"], o = r.filter((l) => !a.includes(l));
|
|
1885
1885
|
s.className = [...o, i].join(" ");
|
|
@@ -1897,7 +1897,7 @@ class ct extends HTMLElement {
|
|
|
1897
1897
|
_updateBackgroundColor() {
|
|
1898
1898
|
if (!this._popover) return;
|
|
1899
1899
|
const t = document.documentElement.classList.contains("dark"), e = this._popover.querySelector(".popover-content");
|
|
1900
|
-
e && (t ? (e.classList.remove("bg-white"), e.classList.add("bg-gray-
|
|
1900
|
+
e && (t ? (e.classList.remove("bg-white"), e.classList.add("bg-gray-900", "border", "border-gray-700")) : (e.classList.remove("bg-gray-900", "border", "border-gray-700"), e.classList.add("bg-white")));
|
|
1901
1901
|
}
|
|
1902
1902
|
_observeDarkMode() {
|
|
1903
1903
|
this._darkModeObserver || (this._darkModeObserver = new MutationObserver(() => {
|
|
@@ -1961,16 +1961,16 @@ class ht extends HTMLElement {
|
|
|
1961
1961
|
connectedCallback() {
|
|
1962
1962
|
this.classList.add("box-border", "m-0", "p-0", "border-0", "align-baseline", "inline-flex", "items-start", "gap-2");
|
|
1963
1963
|
const t = this.getAttribute("checked");
|
|
1964
|
-
this._checked = t
|
|
1964
|
+
this._checked = t === "true", this.render();
|
|
1965
1965
|
}
|
|
1966
1966
|
disconnectedCallback() {
|
|
1967
1967
|
this.removeEventListeners();
|
|
1968
1968
|
}
|
|
1969
1969
|
isLoading() {
|
|
1970
|
-
return this.
|
|
1970
|
+
return this.getAttribute("loading") === "true";
|
|
1971
1971
|
}
|
|
1972
1972
|
attributeChangedCallback(t, e, i) {
|
|
1973
|
-
if (t === "checked" && (this._checked = i
|
|
1973
|
+
if (t === "checked" && (this._checked = i === "true", this._checkbox && (this._checkbox.checked = this._checked)), e !== i) {
|
|
1974
1974
|
if (t === "error" || t === "error-message") {
|
|
1975
1975
|
this._renderErrorState();
|
|
1976
1976
|
return;
|
|
@@ -1991,12 +1991,12 @@ class ht extends HTMLElement {
|
|
|
1991
1991
|
}
|
|
1992
1992
|
set checked(t) {
|
|
1993
1993
|
try {
|
|
1994
|
-
t ? this.setAttribute("checked", "") : this.
|
|
1994
|
+
t ? this.setAttribute("checked", "true") : this.setAttribute("checked", "false"), this._checked = !!t, this._checkbox && (this._checkbox.checked = this._checked), this.updateVisualState();
|
|
1995
1995
|
} catch {
|
|
1996
1996
|
}
|
|
1997
1997
|
}
|
|
1998
1998
|
isDisabled() {
|
|
1999
|
-
return this.
|
|
1999
|
+
return this.getAttribute("disabled") === "true";
|
|
2000
2000
|
}
|
|
2001
2001
|
getLabel() {
|
|
2002
2002
|
return this.getAttribute("label") || "";
|
|
@@ -2014,7 +2014,7 @@ class ht extends HTMLElement {
|
|
|
2014
2014
|
return this.getAttribute("value") || "";
|
|
2015
2015
|
}
|
|
2016
2016
|
hasError() {
|
|
2017
|
-
return this.
|
|
2017
|
+
return this.getAttribute("error") === "true";
|
|
2018
2018
|
}
|
|
2019
2019
|
getErrorMessage() {
|
|
2020
2020
|
return this.getAttribute("error-message") || "";
|
|
@@ -2067,8 +2067,8 @@ class ht extends HTMLElement {
|
|
|
2067
2067
|
const l = this.getValue();
|
|
2068
2068
|
l ? this._checkbox.value = l : this._checkbox.removeAttribute("value"), e ? this._checkbox.setAttribute("aria-label", e) : this._checkbox.removeAttribute("aria-label"), r.className = `mint-checkbox-wrapper ${this.getCheckboxClasses()}`, r.style.cursor = "pointer", r.style.pointerEvents = "auto", this._checkbox.style.pointerEvents = "auto";
|
|
2069
2069
|
const c = r;
|
|
2070
|
-
c._wrapperClickHandler || (c._wrapperClickHandler = (
|
|
2071
|
-
|
|
2070
|
+
c._wrapperClickHandler || (c._wrapperClickHandler = (f) => {
|
|
2071
|
+
f.target === r && !s && (f.preventDefault(), f.stopPropagation(), this.toggle());
|
|
2072
2072
|
}, r.addEventListener("click", c._wrapperClickHandler));
|
|
2073
2073
|
let h = r.querySelector("mint-icon");
|
|
2074
2074
|
h || (h = document.createElement("mint-icon"), h.setAttribute("name", "check"), h.className = "w-3.5 h-3.5 text-white pointer-events-none absolute inset-0 m-auto", h.style.transition = "opacity 200ms ease-out, transform 200ms ease-out", h.style.zIndex = "1", r.appendChild(h)), this.updateVisualState();
|
|
@@ -2076,16 +2076,16 @@ class ht extends HTMLElement {
|
|
|
2076
2076
|
const d = this.querySelector(".mint-checkbox-container");
|
|
2077
2077
|
if (e || i) {
|
|
2078
2078
|
p ? d && p.parentElement !== d && d.appendChild(p) : (p = document.createElement("div"), p.className = "mint-checkbox-label-container flex flex-col gap-0.5 flex-1", d ? d.appendChild(p) : this.appendChild(p));
|
|
2079
|
-
let
|
|
2080
|
-
e ? (
|
|
2081
|
-
let
|
|
2082
|
-
if (i ? (
|
|
2079
|
+
let f = p.querySelector(".mint-checkbox-label");
|
|
2080
|
+
e ? (f || (f = document.createElement("span"), f.className = "mint-checkbox-label text-sm font-medium text-gray-900 dark:text-gray-100 cursor-pointer select-none", p.insertBefore(f, p.firstChild)), f.textContent = e, s ? f.classList.add("opacity-40") : f.classList.remove("opacity-40")) : f && f.remove();
|
|
2081
|
+
let u = p.querySelector(".mint-checkbox-info");
|
|
2082
|
+
if (i ? (u || (u = document.createElement("span"), u.className = "mint-checkbox-info text-xs text-gray-500 dark:text-gray-400 cursor-pointer select-none", p.appendChild(u)), u.textContent = i, s ? u.classList.add("opacity-40") : u.classList.remove("opacity-40")) : u && u.remove(), s)
|
|
2083
2083
|
p.style.cursor = "default", p._clickHandler && (p.removeEventListener("click", p._clickHandler), p._clickHandler = null);
|
|
2084
2084
|
else {
|
|
2085
2085
|
p.style.cursor = "pointer";
|
|
2086
|
-
const
|
|
2087
|
-
|
|
2088
|
-
this._checkbox && (
|
|
2086
|
+
const m = p._clickHandler;
|
|
2087
|
+
m && p.removeEventListener("click", m), p._clickHandler = (g) => {
|
|
2088
|
+
this._checkbox && (g.target === this._checkbox || this._checkbox.contains(g.target) || g.composedPath().includes(this._checkbox)) || this.toggle();
|
|
2089
2089
|
}, p.addEventListener("click", p._clickHandler);
|
|
2090
2090
|
}
|
|
2091
2091
|
} else p && p.remove();
|
|
@@ -2093,7 +2093,7 @@ class ht extends HTMLElement {
|
|
|
2093
2093
|
}
|
|
2094
2094
|
setupEventListeners() {
|
|
2095
2095
|
this.removeEventListeners(), this._checkbox && (this._changeHandler = (t) => {
|
|
2096
|
-
t.stopPropagation(), this._checked = this._checkbox.checked, this._checked ? this.
|
|
2096
|
+
t.stopPropagation(), this._checked = this._checkbox.checked, this._checked ? this.setAttribute("checked", "true") : this.setAttribute("checked", "false"), this.updateVisualState();
|
|
2097
2097
|
const e = new Event("input", {
|
|
2098
2098
|
bubbles: !0,
|
|
2099
2099
|
cancelable: !0,
|
|
@@ -2154,7 +2154,7 @@ class ht extends HTMLElement {
|
|
|
2154
2154
|
}
|
|
2155
2155
|
toggle() {
|
|
2156
2156
|
if (this._checkbox && !this.isDisabled()) {
|
|
2157
|
-
this._checkbox.checked = !this._checked, this._checked = this._checkbox.checked, this._checked ? this.
|
|
2157
|
+
this._checkbox.checked = !this._checked, this._checked = this._checkbox.checked, this._checked ? this.setAttribute("checked", "true") : this.setAttribute("checked", "false"), this.updateVisualState(), this.dispatchEvent(new CustomEvent("input", {
|
|
2158
2158
|
detail: { checked: this._checked },
|
|
2159
2159
|
bubbles: !0,
|
|
2160
2160
|
cancelable: !0,
|
|
@@ -2209,10 +2209,10 @@ class dt extends HTMLElement {
|
|
|
2209
2209
|
this._clickHandler && (this.removeEventListener("click", this._clickHandler), this._clickHandler = null), this._radio && (this._changeHandler && (this._radio.removeEventListener("change", this._changeHandler), this._changeHandler = null), this._focusHandler && (this._radio.removeEventListener("focus", this._focusHandler), this._focusHandler = null), this._blurHandler && (this._radio.removeEventListener("blur", this._blurHandler), this._blurHandler = null), this._keydownHandler && (this._radio.removeEventListener("keydown", this._keydownHandler), this._keydownHandler = null));
|
|
2210
2210
|
}
|
|
2211
2211
|
isLoading() {
|
|
2212
|
-
return this.
|
|
2212
|
+
return this.getAttribute("loading") === "true";
|
|
2213
2213
|
}
|
|
2214
2214
|
attributeChangedCallback(t, e, i) {
|
|
2215
|
-
if (t === "checked" && (this._checked = i
|
|
2215
|
+
if (t === "checked" && (this._checked = i === "true", this._radio && (this._radio.checked = this._checked), this._updateVisualState()), e !== i) {
|
|
2216
2216
|
if (t === "loading") {
|
|
2217
2217
|
this.render();
|
|
2218
2218
|
return;
|
|
@@ -2233,7 +2233,7 @@ class dt extends HTMLElement {
|
|
|
2233
2233
|
}
|
|
2234
2234
|
set checked(t) {
|
|
2235
2235
|
try {
|
|
2236
|
-
this._checked = !!t, t ? this.setAttribute("checked", "") : this.
|
|
2236
|
+
this._checked = !!t, t ? this.setAttribute("checked", "true") : this.setAttribute("checked", "false"), this._radio && (this._radio.checked = this._checked), this.isConnected ? requestAnimationFrame(() => {
|
|
2237
2237
|
this._updateVisualState();
|
|
2238
2238
|
}) : this._updateVisualState();
|
|
2239
2239
|
} catch {
|
|
@@ -2246,14 +2246,14 @@ class dt extends HTMLElement {
|
|
|
2246
2246
|
return this.getAttribute("info") || "";
|
|
2247
2247
|
}
|
|
2248
2248
|
isDisabled() {
|
|
2249
|
-
const
|
|
2250
|
-
return
|
|
2249
|
+
const e = this.getAttribute("disabled") === "true", i = this.closest("mint-choice"), n = (i == null ? void 0 : i.getAttribute("disabled")) === "true";
|
|
2250
|
+
return e || n;
|
|
2251
2251
|
}
|
|
2252
2252
|
_setupClickHandler() {
|
|
2253
2253
|
this._clickHandler || (this._clickHandler = (t) => {
|
|
2254
2254
|
t.target !== this._radio && (this.isDisabled() || this._radio && (this._radio.click(), requestAnimationFrame(() => {
|
|
2255
2255
|
if (this._radio && this._radio.checked !== this._checked) {
|
|
2256
|
-
this._checked = this._radio.checked, this._checked ? this.setAttribute("checked", "") : this.removeAttribute("checked"), this._updateVisualState(), this._updateGroupState();
|
|
2256
|
+
this._checked = this._radio.checked, this._checked ? this.setAttribute("checked", "true") : this.removeAttribute("checked"), this._updateVisualState(), this._updateGroupState();
|
|
2257
2257
|
const e = this.closest("mint-choice");
|
|
2258
2258
|
e && e.dispatchEvent(new CustomEvent("choice-change", {
|
|
2259
2259
|
detail: { checked: this._checked, value: this.getValue() },
|
|
@@ -2265,81 +2265,81 @@ class dt extends HTMLElement {
|
|
|
2265
2265
|
}, this.addEventListener("click", this._clickHandler));
|
|
2266
2266
|
}
|
|
2267
2267
|
render() {
|
|
2268
|
-
var
|
|
2268
|
+
var u;
|
|
2269
2269
|
const t = this.isLoading(), e = this.isDisabled(), i = this.getValue(), s = this.closest("mint-choice"), n = (s == null ? void 0 : s.getAttribute("name")) || "";
|
|
2270
2270
|
let r = "";
|
|
2271
2271
|
const a = this.querySelector(".mint-choice-option-label");
|
|
2272
2272
|
if (a)
|
|
2273
|
-
r = ((
|
|
2273
|
+
r = ((u = a.textContent) == null ? void 0 : u.trim()) || "";
|
|
2274
2274
|
else {
|
|
2275
|
-
const
|
|
2276
|
-
Array.from(this.childNodes).forEach((
|
|
2277
|
-
var
|
|
2278
|
-
if (
|
|
2279
|
-
const
|
|
2280
|
-
|
|
2275
|
+
const m = this.querySelector(".mint-choice-option-label-container");
|
|
2276
|
+
Array.from(this.childNodes).forEach((g) => {
|
|
2277
|
+
var b;
|
|
2278
|
+
if (g !== m && g.nodeType === Node.TEXT_NODE) {
|
|
2279
|
+
const _ = (b = g.textContent) == null ? void 0 : b.trim();
|
|
2280
|
+
_ && (r += _);
|
|
2281
2281
|
}
|
|
2282
2282
|
});
|
|
2283
2283
|
}
|
|
2284
2284
|
const o = this.querySelectorAll(".mint-choice-option-wrapper");
|
|
2285
2285
|
let l = null;
|
|
2286
|
-
if (o.length > 0 && (this._radio && (l = Array.from(o).find((
|
|
2287
|
-
|
|
2288
|
-
})), l || (l = document.createElement("div"), l.className = "mint-choice-option-wrapper", l.style.position = "relative", this.insertBefore(l, this.firstChild)), l.className = `mint-choice-option-wrapper ${this._getWrapperClasses()}`, l.style.position = "relative", this.querySelectorAll('input[type="radio"]').forEach((
|
|
2289
|
-
|
|
2286
|
+
if (o.length > 0 && (this._radio && (l = Array.from(o).find((m) => m.contains(this._radio))), l || (l = o[0]), o.forEach((m, g) => {
|
|
2287
|
+
m !== l && m.remove();
|
|
2288
|
+
})), l || (l = document.createElement("div"), l.className = "mint-choice-option-wrapper", l.style.position = "relative", this.insertBefore(l, this.firstChild)), l.className = `mint-choice-option-wrapper ${this._getWrapperClasses()}`, l.style.position = "relative", this.querySelectorAll('input[type="radio"]').forEach((m) => {
|
|
2289
|
+
m !== this._radio && m.remove();
|
|
2290
2290
|
}), this._radio)
|
|
2291
|
-
this._radio.parentElement !== l && l.appendChild(this._radio), this._radio && this._changeHandler && (this._radio.removeEventListener("change", this._changeHandler), this._radio.addEventListener("change", this._changeHandler)), this._radio && (this._focusHandler || (this._focusHandler = (
|
|
2292
|
-
const
|
|
2293
|
-
|
|
2291
|
+
this._radio.parentElement !== l && l.appendChild(this._radio), this._radio && this._changeHandler && (this._radio.removeEventListener("change", this._changeHandler), this._radio.addEventListener("change", this._changeHandler)), this._radio && (this._focusHandler || (this._focusHandler = (m) => {
|
|
2292
|
+
const g = this.querySelector(".mint-choice-option-wrapper");
|
|
2293
|
+
g && !this.isDisabled() && g.classList.add("ring-2", "ring-offset-1", "ring-gray-400", "dark:ring-gray-500");
|
|
2294
2294
|
}), this._blurHandler || (this._blurHandler = () => {
|
|
2295
|
-
const
|
|
2296
|
-
|
|
2297
|
-
}), this._keydownHandler || (this._keydownHandler = (
|
|
2298
|
-
this.isDisabled() || (
|
|
2295
|
+
const m = this.querySelector(".mint-choice-option-wrapper");
|
|
2296
|
+
m && m.classList.remove("ring-2", "ring-offset-1", "ring-gray-400", "dark:ring-gray-500");
|
|
2297
|
+
}), this._keydownHandler || (this._keydownHandler = (m) => {
|
|
2298
|
+
this.isDisabled() || (m.key === "ArrowDown" || m.key === "ArrowRight" ? (m.preventDefault(), this._focusNextOption()) : (m.key === "ArrowUp" || m.key === "ArrowLeft") && (m.preventDefault(), this._focusPreviousOption()));
|
|
2299
2299
|
}), this._radio.removeEventListener("focus", this._focusHandler), this._radio.removeEventListener("blur", this._blurHandler), this._radio.removeEventListener("keydown", this._keydownHandler), this._radio.addEventListener("focus", this._focusHandler), this._radio.addEventListener("blur", this._blurHandler), this._radio.addEventListener("keydown", this._keydownHandler));
|
|
2300
2300
|
else {
|
|
2301
|
-
this._radio = document.createElement("input"), this._radio.type = "radio", this._radio.className = "sr-only", this._radio.style.position = "absolute", this._radio.style.width = "1px", this._radio.style.height = "1px", this._radio.style.padding = "0", this._radio.style.margin = "-1px", this._radio.style.overflow = "hidden", this._radio.style.clip = "rect(0, 0, 0, 0)", this._radio.style.whiteSpace = "nowrap", this._radio.style.border = "0", l.appendChild(this._radio), this._changeHandler = (
|
|
2302
|
-
const
|
|
2303
|
-
this._checked = this._radio.checked, this._checked ? this.setAttribute("checked", "") : this.removeAttribute("checked"), this._updateVisualState(), this._updateGroupState();
|
|
2304
|
-
const
|
|
2305
|
-
|
|
2306
|
-
|
|
2301
|
+
this._radio = document.createElement("input"), this._radio.type = "radio", this._radio.className = "sr-only", this._radio.style.position = "absolute", this._radio.style.width = "1px", this._radio.style.height = "1px", this._radio.style.padding = "0", this._radio.style.margin = "-1px", this._radio.style.overflow = "hidden", this._radio.style.clip = "rect(0, 0, 0, 0)", this._radio.style.whiteSpace = "nowrap", this._radio.style.border = "0", l.appendChild(this._radio), this._changeHandler = (g) => {
|
|
2302
|
+
const b = this._checked;
|
|
2303
|
+
this._checked = this._radio.checked, this._checked ? this.setAttribute("checked", "true") : this.removeAttribute("checked"), this._updateVisualState(), this._updateGroupState();
|
|
2304
|
+
const _ = this.closest("mint-choice");
|
|
2305
|
+
b !== this._checked && _ && setTimeout(() => {
|
|
2306
|
+
_.dispatchEvent(new CustomEvent("choice-change", {
|
|
2307
2307
|
detail: { checked: this._checked, value: this.getValue() },
|
|
2308
2308
|
bubbles: !0,
|
|
2309
2309
|
cancelable: !0
|
|
2310
2310
|
}));
|
|
2311
2311
|
}, 0);
|
|
2312
2312
|
}, this._radio.addEventListener("change", this._changeHandler);
|
|
2313
|
-
const
|
|
2314
|
-
this._radio && this._radio.checked !== this._checked && (this._checked = this._radio.checked, this._checked ? this.setAttribute("checked", "") : this.removeAttribute("checked"), this._updateVisualState(), this._updateGroupState());
|
|
2313
|
+
const m = () => {
|
|
2314
|
+
this._radio && this._radio.checked !== this._checked && (this._checked = this._radio.checked, this._checked ? this.setAttribute("checked", "true") : this.removeAttribute("checked"), this._updateVisualState(), this._updateGroupState());
|
|
2315
2315
|
};
|
|
2316
|
-
this._radio.addEventListener("click",
|
|
2317
|
-
const
|
|
2318
|
-
|
|
2316
|
+
this._radio.addEventListener("click", m), this._focusHandler = (g) => {
|
|
2317
|
+
const b = this.querySelector(".mint-choice-option-wrapper");
|
|
2318
|
+
b && !this.isDisabled() && b.classList.add("ring-2", "ring-offset-1", "ring-gray-400", "dark:ring-gray-500");
|
|
2319
2319
|
}, this._radio.addEventListener("focus", this._focusHandler), this._blurHandler = () => {
|
|
2320
|
-
const
|
|
2321
|
-
|
|
2322
|
-
}, this._radio.addEventListener("blur", this._blurHandler), this._keydownHandler = (
|
|
2323
|
-
this.isDisabled() || (
|
|
2320
|
+
const g = this.querySelector(".mint-choice-option-wrapper");
|
|
2321
|
+
g && g.classList.remove("ring-2", "ring-offset-1", "ring-gray-400", "dark:ring-gray-500");
|
|
2322
|
+
}, this._radio.addEventListener("blur", this._blurHandler), this._keydownHandler = (g) => {
|
|
2323
|
+
this.isDisabled() || (g.key === "ArrowDown" || g.key === "ArrowRight" ? (g.preventDefault(), this._focusNextOption()) : (g.key === "ArrowUp" || g.key === "ArrowLeft") && (g.preventDefault(), this._focusPreviousOption()));
|
|
2324
2324
|
}, this._radio.addEventListener("keydown", this._keydownHandler);
|
|
2325
2325
|
}
|
|
2326
|
-
this._radio.name = n, this._radio.value = i, this._radio.checked !== this._checked ? (this._checked = this._radio.checked, this._checked ? this.
|
|
2327
|
-
|
|
2326
|
+
this._radio.name = n, this._radio.value = i, this._radio.checked !== this._checked ? (this._checked = this._radio.checked, this._checked ? this.setAttribute("checked", "true") : this.setAttribute("checked", "false")) : this._radio.checked = this._checked, this._radio.disabled = e, e ? this._radio.setAttribute("tabindex", "-1") : this._radio.removeAttribute("tabindex"), r ? this._radio.setAttribute("aria-label", r) : this._radio.removeAttribute("aria-label"), l.querySelectorAll(".mint-choice-option-indicator").forEach((m, g) => {
|
|
2327
|
+
g > 0 && m.remove();
|
|
2328
2328
|
});
|
|
2329
2329
|
let p = l.querySelector(".mint-choice-option-indicator");
|
|
2330
2330
|
p || (p = document.createElement("div"), p.className = "mint-choice-option-indicator", l.appendChild(p)), p.className = "mint-choice-option-indicator w-2 h-2 rounded-full bg-white transition-all duration-200 pointer-events-none", p.style.position = "absolute", p.style.top = "50%", p.style.left = "50%", p.style.transform = this._checked ? "translate(-50%, -50%) scale(1)" : "translate(-50%, -50%) scale(0)", p.style.opacity = this._checked ? "1" : "0", this._updateVisualState(), this._renderSkeleton(t);
|
|
2331
2331
|
const d = this.getInfo();
|
|
2332
|
-
let
|
|
2332
|
+
let f = this.querySelector(".mint-choice-option-label-container");
|
|
2333
2333
|
if (r || d) {
|
|
2334
|
-
|
|
2335
|
-
var
|
|
2336
|
-
|
|
2334
|
+
f || (f = document.createElement("div"), f.className = "mint-choice-option-label-container flex flex-col gap-0.5", this.appendChild(f), Array.from(this.childNodes).forEach((b) => {
|
|
2335
|
+
var _;
|
|
2336
|
+
b.nodeType === Node.TEXT_NODE && ((_ = b.textContent) != null && _.trim()) && b !== f && (b.textContent = "");
|
|
2337
2337
|
}));
|
|
2338
|
-
let
|
|
2339
|
-
r ? (
|
|
2340
|
-
let
|
|
2341
|
-
d ? (
|
|
2342
|
-
} else
|
|
2338
|
+
let m = f.querySelector(".mint-choice-option-label");
|
|
2339
|
+
r ? (m || (m = document.createElement("span"), m.className = "mint-choice-option-label", f.appendChild(m)), m.className = `mint-choice-option-label text-sm text-gray-900 dark:text-gray-100 ${e ? "opacity-40" : ""}`, m.textContent = r) : m && m.remove();
|
|
2340
|
+
let g = f.querySelector(".mint-choice-option-info");
|
|
2341
|
+
d ? (g || (g = document.createElement("span"), g.className = "mint-choice-option-info text-xs text-gray-500 dark:text-gray-400 select-none", f.appendChild(g)), g.textContent = d, e ? g.classList.add("opacity-40") : g.classList.remove("opacity-40")) : g && g.remove();
|
|
2342
|
+
} else f && f.remove();
|
|
2343
2343
|
e ? (this.classList.add("cursor-not-allowed"), this.classList.remove("cursor-pointer")) : (this.classList.add("cursor-pointer"), this.classList.remove("cursor-not-allowed")), this._updateVisualState();
|
|
2344
2344
|
}
|
|
2345
2345
|
_getWrapperClasses() {
|
|
@@ -2363,7 +2363,7 @@ class dt extends HTMLElement {
|
|
|
2363
2363
|
"dark:border-slate-600"
|
|
2364
2364
|
) : e.push(
|
|
2365
2365
|
"bg-white",
|
|
2366
|
-
"dark:bg-gray-
|
|
2366
|
+
"dark:bg-gray-900",
|
|
2367
2367
|
"border-gray-300",
|
|
2368
2368
|
"dark:border-gray-500"
|
|
2369
2369
|
), e.join(" ");
|
|
@@ -2401,7 +2401,7 @@ class dt extends HTMLElement {
|
|
|
2401
2401
|
).forEach((i) => {
|
|
2402
2402
|
if (i === this._radio) return;
|
|
2403
2403
|
const s = i.closest("mint-choice-option");
|
|
2404
|
-
s && s !== this && (s._checked = i.checked, i.checked ? s.setAttribute("checked", "") : s.removeAttribute("checked"), s._updateVisualState());
|
|
2404
|
+
s && s !== this && (s._checked = i.checked, i.checked ? s.setAttribute("checked", "true") : s.removeAttribute("checked"), s._updateVisualState());
|
|
2405
2405
|
});
|
|
2406
2406
|
}
|
|
2407
2407
|
_focusNextOption() {
|
|
@@ -2415,7 +2415,7 @@ class dt extends HTMLElement {
|
|
|
2415
2415
|
const n = i.closest("mint-choice-option");
|
|
2416
2416
|
if (i.checked = !0, n) {
|
|
2417
2417
|
const r = n._checked;
|
|
2418
|
-
if (n._checked = !0, n.setAttribute("checked", ""), n._changeHandler) {
|
|
2418
|
+
if (n._checked = !0, n.setAttribute("checked", "true"), n._changeHandler) {
|
|
2419
2419
|
const o = new Event("change", { bubbles: !0 });
|
|
2420
2420
|
n._changeHandler.call(n, o);
|
|
2421
2421
|
} else
|
|
@@ -2443,7 +2443,7 @@ class dt extends HTMLElement {
|
|
|
2443
2443
|
const n = i.closest("mint-choice-option");
|
|
2444
2444
|
if (i.checked = !0, n) {
|
|
2445
2445
|
const r = n._checked;
|
|
2446
|
-
if (n._checked = !0, n.setAttribute("checked", ""), n._changeHandler) {
|
|
2446
|
+
if (n._checked = !0, n.setAttribute("checked", "true"), n._changeHandler) {
|
|
2447
2447
|
const o = new Event("change", { bubbles: !0 });
|
|
2448
2448
|
n._changeHandler.call(n, o);
|
|
2449
2449
|
} else
|
|
@@ -2499,7 +2499,7 @@ class ut extends HTMLElement {
|
|
|
2499
2499
|
}
|
|
2500
2500
|
attributeChangedCallback(t, e, i) {
|
|
2501
2501
|
e !== i && (t === "error" || t === "error-message" ? this._renderErrorState() : t === "loading" ? (this.render(), this.querySelectorAll("mint-choice-option").forEach((n) => {
|
|
2502
|
-
this.isLoading() ? n.setAttribute("loading", "") : n.removeAttribute("loading");
|
|
2502
|
+
this.isLoading() ? n.setAttribute("loading", "true") : n.removeAttribute("loading");
|
|
2503
2503
|
})) : (this.render(), t === "name" && this.querySelectorAll("mint-choice-option").forEach((n) => {
|
|
2504
2504
|
typeof n.render == "function" && n.render();
|
|
2505
2505
|
})));
|
|
@@ -2514,7 +2514,7 @@ class ut extends HTMLElement {
|
|
|
2514
2514
|
return this.getAttribute("name") || "";
|
|
2515
2515
|
}
|
|
2516
2516
|
hasError() {
|
|
2517
|
-
return this.
|
|
2517
|
+
return this.getAttribute("error") === "true";
|
|
2518
2518
|
}
|
|
2519
2519
|
getErrorMessage() {
|
|
2520
2520
|
return this.getAttribute("error-message") || "";
|
|
@@ -2523,10 +2523,10 @@ class ut extends HTMLElement {
|
|
|
2523
2523
|
return this.getAttribute("id") || "";
|
|
2524
2524
|
}
|
|
2525
2525
|
isDisabled() {
|
|
2526
|
-
return this.
|
|
2526
|
+
return this.getAttribute("disabled") === "true";
|
|
2527
2527
|
}
|
|
2528
2528
|
isRequired() {
|
|
2529
|
-
return this.
|
|
2529
|
+
return this.getAttribute("required") === "true";
|
|
2530
2530
|
}
|
|
2531
2531
|
getValue() {
|
|
2532
2532
|
const t = this.querySelector('input[type="radio"]:checked');
|
|
@@ -2690,16 +2690,16 @@ class pt extends HTMLElement {
|
|
|
2690
2690
|
}
|
|
2691
2691
|
}
|
|
2692
2692
|
isDisabled() {
|
|
2693
|
-
return this.
|
|
2693
|
+
return this.getAttribute("disabled") === "true";
|
|
2694
2694
|
}
|
|
2695
2695
|
isReadonly() {
|
|
2696
|
-
return this.
|
|
2696
|
+
return this.getAttribute("readonly") === "true";
|
|
2697
2697
|
}
|
|
2698
2698
|
isRequired() {
|
|
2699
|
-
return this.
|
|
2699
|
+
return this.getAttribute("required") === "true";
|
|
2700
2700
|
}
|
|
2701
2701
|
hasError() {
|
|
2702
|
-
return this.
|
|
2702
|
+
return this.getAttribute("error") === "true";
|
|
2703
2703
|
}
|
|
2704
2704
|
getErrorMessage() {
|
|
2705
2705
|
return this.getAttribute("error-message") || "";
|
|
@@ -2731,7 +2731,7 @@ class pt extends HTMLElement {
|
|
|
2731
2731
|
"rounded-lg",
|
|
2732
2732
|
"box-border",
|
|
2733
2733
|
"bg-white",
|
|
2734
|
-
"dark:bg-gray-
|
|
2734
|
+
"dark:bg-gray-900",
|
|
2735
2735
|
"text-gray-900",
|
|
2736
2736
|
"dark:text-white",
|
|
2737
2737
|
// Use specific transitions for textarea to avoid animating resize
|
|
@@ -2747,7 +2747,7 @@ class pt extends HTMLElement {
|
|
|
2747
2747
|
s ? "[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none" : ""
|
|
2748
2748
|
], a = [
|
|
2749
2749
|
"border-2",
|
|
2750
|
-
n ? "border-red-300 dark:border-red-300" : "border-gray-200 dark:border-gray-
|
|
2750
|
+
n ? "border-red-300 dark:border-red-300" : "border-gray-200 dark:border-gray-700"
|
|
2751
2751
|
], o = [
|
|
2752
2752
|
"focus-visible:ring-2",
|
|
2753
2753
|
"focus-visible:ring-offset-1",
|
|
@@ -2756,13 +2756,13 @@ class pt extends HTMLElement {
|
|
|
2756
2756
|
return [...r, ...a, ...o].filter(Boolean).join(" ");
|
|
2757
2757
|
}
|
|
2758
2758
|
isLoading() {
|
|
2759
|
-
return this.
|
|
2759
|
+
return this.getAttribute("loading") === "true";
|
|
2760
2760
|
}
|
|
2761
2761
|
render() {
|
|
2762
|
-
var
|
|
2762
|
+
var _, v, k, A;
|
|
2763
2763
|
this.getType();
|
|
2764
|
-
const t = this._getNormalizedType(), e = this._isTextarea(), i = this._isMoney(), s = this._isColor(), n = this.getPlaceholder(), r = this.isDisabled(), a = this.isReadonly(), o = this.isRequired(), l = this.getId(), c = this.getName(), h = this.getAttribute("value") || (s ? "#000000" : ""), p = this.getRows(), d = this.getIcon(),
|
|
2765
|
-
if (this._renderSkeleton(
|
|
2764
|
+
const t = this._getNormalizedType(), e = this._isTextarea(), i = this._isMoney(), s = this._isColor(), n = this.getPlaceholder(), r = this.isDisabled(), a = this.isReadonly(), o = this.isRequired(), l = this.getId(), c = this.getName(), h = this.getAttribute("value") || (s ? "#000000" : ""), p = this.getRows(), d = this.getIcon(), f = this.getLabel(), u = this.getInfo(), m = this.isLoading();
|
|
2765
|
+
if (this._renderSkeleton(m), s) {
|
|
2766
2766
|
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 = h || "#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 = (y) => {
|
|
2767
2767
|
this._colorPickerWrapper && this._colorPicker && this._colorPicker.matches(":focus-visible") && requestAnimationFrame(() => {
|
|
2768
2768
|
var x;
|
|
@@ -2795,10 +2795,10 @@ class pt extends HTMLElement {
|
|
|
2795
2795
|
cancelable: !0
|
|
2796
2796
|
})));
|
|
2797
2797
|
}), this._colorTextInput.addEventListener("blur", () => {
|
|
2798
|
-
var x,
|
|
2798
|
+
var x, I;
|
|
2799
2799
|
const y = ((x = this._colorTextInput) == null ? void 0 : x.value) || "";
|
|
2800
2800
|
/^#[0-9A-Fa-f]{6}$/.test(y) ? (this._colorPicker && (this._colorPicker.value = y), this.setAttribute("value", y)) : this._colorPicker && this._colorTextInput && (this._colorTextInput.value = this._colorPicker.value), this.dispatchEvent(new CustomEvent("change", {
|
|
2801
|
-
detail: { value: ((
|
|
2801
|
+
detail: { value: ((I = this._colorPicker) == null ? void 0 : I.value) || "#000000" },
|
|
2802
2802
|
bubbles: !0,
|
|
2803
2803
|
cancelable: !0
|
|
2804
2804
|
}));
|
|
@@ -2819,15 +2819,15 @@ class pt extends HTMLElement {
|
|
|
2819
2819
|
const y = document.createElement("mint-icon");
|
|
2820
2820
|
y.setAttribute("name", "caret-down"), y.className = "w-[1rem] h-[1rem]", this._numberDecrementButton.appendChild(y), this._numberSpinnerContainer.appendChild(this._numberDecrementButton), this._numberIncrementButton.addEventListener("click", (x) => {
|
|
2821
2821
|
if (x.preventDefault(), x.stopPropagation(), this._input && !this._input.disabled && !this._input.readOnly) {
|
|
2822
|
-
const
|
|
2823
|
-
let H =
|
|
2824
|
-
|
|
2822
|
+
const I = parseFloat(this._input.value) || 0, R = parseFloat(this._input.step) || 1, P = this._input.min ? parseFloat(this._input.min) : void 0, $ = this._input.max ? parseFloat(this._input.max) : void 0;
|
|
2823
|
+
let H = I + R;
|
|
2824
|
+
$ !== void 0 && H > $ && (H = $), P !== void 0 && H < P && (H = P), this._input.value = H.toString(), this.setAttribute("value", H.toString()), this._input.dispatchEvent(new Event("input", { bubbles: !0 })), this._input.dispatchEvent(new Event("change", { bubbles: !0 }));
|
|
2825
2825
|
}
|
|
2826
2826
|
}), this._numberDecrementButton.addEventListener("click", (x) => {
|
|
2827
2827
|
if (x.preventDefault(), x.stopPropagation(), this._input && !this._input.disabled && !this._input.readOnly) {
|
|
2828
|
-
const
|
|
2829
|
-
let H =
|
|
2830
|
-
P !== void 0 && H < P && (H = P),
|
|
2828
|
+
const I = parseFloat(this._input.value) || 0, R = parseFloat(this._input.step) || 1, P = this._input.min ? parseFloat(this._input.min) : void 0, $ = this._input.max ? parseFloat(this._input.max) : void 0;
|
|
2829
|
+
let H = I - R;
|
|
2830
|
+
P !== void 0 && H < P && (H = P), $ !== void 0 && H > $ && (H = $), this._input.value = H.toString(), this.setAttribute("value", H.toString()), this._input.dispatchEvent(new Event("input", { bubbles: !0 })), this._input.dispatchEvent(new Event("change", { bubbles: !0 }));
|
|
2831
2831
|
}
|
|
2832
2832
|
});
|
|
2833
2833
|
}
|
|
@@ -2842,25 +2842,25 @@ class pt extends HTMLElement {
|
|
|
2842
2842
|
const E = this.firstChild.textContent;
|
|
2843
2843
|
E && !this._input.value && (this._input.value = E.trim()), this.removeChild(this.firstChild);
|
|
2844
2844
|
}
|
|
2845
|
-
let
|
|
2846
|
-
if (
|
|
2847
|
-
|
|
2848
|
-
let E =
|
|
2849
|
-
if (
|
|
2850
|
-
E || (E = document.createElement("label"), E.className = "mint-input-label text-sm font-medium text-gray-900 dark:text-gray-100 select-none",
|
|
2851
|
-
const x = l || ((
|
|
2845
|
+
let b = this.querySelector(".mint-input-label-container");
|
|
2846
|
+
if (f || u) {
|
|
2847
|
+
b || (b = document.createElement("div"), b.className = "mint-input-label-container flex flex-col gap-0.5 mb-[.25rem]", this._wrapper && this._wrapper.parentElement === this ? this.insertBefore(b, this._wrapper) : this.insertBefore(b, this.firstChild));
|
|
2848
|
+
let E = b.querySelector(".mint-input-label");
|
|
2849
|
+
if (f) {
|
|
2850
|
+
E || (E = document.createElement("label"), E.className = "mint-input-label text-sm font-medium text-gray-900 dark:text-gray-100 select-none", b.insertBefore(E, b.firstChild)), E.textContent = f;
|
|
2851
|
+
const x = l || ((_ = this._element) == null ? void 0 : _.id) || ((v = this._colorTextInput) == null ? void 0 : v.id) || ((k = this._input) == null ? void 0 : k.id) || ((A = this._textarea) == null ? void 0 : A.id);
|
|
2852
2852
|
if (x)
|
|
2853
2853
|
E.setAttribute("for", x);
|
|
2854
2854
|
else {
|
|
2855
|
-
const
|
|
2856
|
-
this._element ? this._element.id =
|
|
2855
|
+
const I = `mint-input-${Math.random().toString(36).substr(2, 9)}`;
|
|
2856
|
+
this._element ? this._element.id = I : this._colorTextInput ? this._colorTextInput.id = I : this._input ? this._input.id = I : this._textarea && (this._textarea.id = I), E.setAttribute("for", I);
|
|
2857
2857
|
}
|
|
2858
2858
|
r ? E.classList.add("opacity-40") : E.classList.remove("opacity-40");
|
|
2859
2859
|
} else E && E.remove();
|
|
2860
|
-
let y =
|
|
2861
|
-
|
|
2862
|
-
} else
|
|
2863
|
-
this._renderErrorState(), this._renderSkeleton(
|
|
2860
|
+
let y = b.querySelector(".mint-input-info");
|
|
2861
|
+
u ? (y || (y = document.createElement("span"), y.className = "mint-input-info text-xs text-gray-500 dark:text-gray-400 select-none", b.appendChild(y)), y.textContent = u, r ? y.classList.add("opacity-40") : y.classList.remove("opacity-40")) : y && y.remove();
|
|
2862
|
+
} else b && b.remove();
|
|
2863
|
+
this._renderErrorState(), this._renderSkeleton(m);
|
|
2864
2864
|
}
|
|
2865
2865
|
_renderErrorState() {
|
|
2866
2866
|
const t = this.hasError(), e = this.getErrorMessage();
|
|
@@ -2943,7 +2943,7 @@ class ft extends HTMLElement {
|
|
|
2943
2943
|
}
|
|
2944
2944
|
}
|
|
2945
2945
|
isLoading() {
|
|
2946
|
-
return this.
|
|
2946
|
+
return this.getAttribute("loading") === "true";
|
|
2947
2947
|
}
|
|
2948
2948
|
attributeChangedCallback(t, e, i) {
|
|
2949
2949
|
if (e !== i) {
|
|
@@ -2990,16 +2990,16 @@ class ft extends HTMLElement {
|
|
|
2990
2990
|
return this.getAttribute("info") || "";
|
|
2991
2991
|
}
|
|
2992
2992
|
isDisabled() {
|
|
2993
|
-
return this.
|
|
2993
|
+
return this.getAttribute("disabled") === "true";
|
|
2994
2994
|
}
|
|
2995
2995
|
isReadonly() {
|
|
2996
|
-
return this.
|
|
2996
|
+
return this.getAttribute("readonly") === "true";
|
|
2997
2997
|
}
|
|
2998
2998
|
isRequired() {
|
|
2999
|
-
return this.
|
|
2999
|
+
return this.getAttribute("required") === "true";
|
|
3000
3000
|
}
|
|
3001
3001
|
hasError() {
|
|
3002
|
-
return this.
|
|
3002
|
+
return this.getAttribute("error") === "true";
|
|
3003
3003
|
}
|
|
3004
3004
|
getErrorMessage() {
|
|
3005
3005
|
return this.getAttribute("error-message") || "";
|
|
@@ -3205,24 +3205,24 @@ class ft extends HTMLElement {
|
|
|
3205
3205
|
_parseDateString(t, e) {
|
|
3206
3206
|
const i = /[\/\-\.\s]+/;
|
|
3207
3207
|
if (i.test(t)) {
|
|
3208
|
-
const
|
|
3209
|
-
if (
|
|
3210
|
-
let
|
|
3211
|
-
for (let k = 0; k <
|
|
3212
|
-
const A =
|
|
3208
|
+
const m = t.split(i).filter((b) => b.length > 0), g = e.split(/[\/\-\.\s]+/).filter((b) => b.length > 0);
|
|
3209
|
+
if (m.length === g.length) {
|
|
3210
|
+
let b = 0, _ = 0, v = 0;
|
|
3211
|
+
for (let k = 0; k < g.length; k++) {
|
|
3212
|
+
const A = g[k].toLowerCase(), E = m[k];
|
|
3213
3213
|
if (A.includes("d"))
|
|
3214
|
-
|
|
3214
|
+
b = parseInt(E, 10);
|
|
3215
3215
|
else if (A.includes("m"))
|
|
3216
|
-
|
|
3216
|
+
_ = parseInt(E, 10) - 1;
|
|
3217
3217
|
else if (A.includes("y")) {
|
|
3218
3218
|
let y = parseInt(E, 10);
|
|
3219
|
-
const x = A.length,
|
|
3220
|
-
|
|
3219
|
+
const x = A.length, I = E.length;
|
|
3220
|
+
I === 2 && x === 4 ? y = Math.floor((/* @__PURE__ */ new Date()).getFullYear() / 100) * 100 + y : I === 2 && x === 2 && (y = Math.floor((/* @__PURE__ */ new Date()).getFullYear() / 100) * 100 + y), v = y;
|
|
3221
3221
|
}
|
|
3222
3222
|
}
|
|
3223
|
-
if (
|
|
3224
|
-
const k = new Date(v,
|
|
3225
|
-
if (!isNaN(k.getTime()) && k.getDate() ===
|
|
3223
|
+
if (b && _ >= 0 && _ <= 11 && v) {
|
|
3224
|
+
const k = new Date(v, _, b);
|
|
3225
|
+
if (!isNaN(k.getTime()) && k.getDate() === b && k.getMonth() === _ && k.getFullYear() === v)
|
|
3226
3226
|
return k;
|
|
3227
3227
|
}
|
|
3228
3228
|
}
|
|
@@ -3233,27 +3233,27 @@ class ft extends HTMLElement {
|
|
|
3233
3233
|
{ char: "d", index: a },
|
|
3234
3234
|
{ char: "m", index: o },
|
|
3235
3235
|
{ char: "y", index: l }
|
|
3236
|
-
].sort((
|
|
3237
|
-
let h = 0, p = 0, d = 0,
|
|
3236
|
+
].sort((m, g) => m.index - g.index);
|
|
3237
|
+
let h = 0, p = 0, d = 0, f = 0;
|
|
3238
3238
|
r.length, n.length;
|
|
3239
|
-
for (const
|
|
3240
|
-
if (
|
|
3241
|
-
const
|
|
3242
|
-
if (
|
|
3243
|
-
h = parseInt(
|
|
3244
|
-
} else if (
|
|
3245
|
-
const
|
|
3246
|
-
if (
|
|
3247
|
-
p = parseInt(
|
|
3248
|
-
} else if (
|
|
3249
|
-
const
|
|
3239
|
+
for (const m of c)
|
|
3240
|
+
if (m.char === "d") {
|
|
3241
|
+
const g = r.lastIndexOf("d") - r.indexOf("d") + 1, b = n.substr(f, g);
|
|
3242
|
+
if (b.length === 0) return null;
|
|
3243
|
+
h = parseInt(b, 10), f += b.length;
|
|
3244
|
+
} else if (m.char === "m") {
|
|
3245
|
+
const g = r.lastIndexOf("m") - r.indexOf("m") + 1, b = n.substr(f, g);
|
|
3246
|
+
if (b.length === 0) return null;
|
|
3247
|
+
p = parseInt(b, 10) - 1, f += b.length;
|
|
3248
|
+
} else if (m.char === "y") {
|
|
3249
|
+
const g = r.lastIndexOf("y") - r.indexOf("y") + 1, b = n.substr(f), _ = Math.min(g, b.length), v = b.substr(0, _);
|
|
3250
3250
|
if (v.length === 0) return null;
|
|
3251
3251
|
let k = parseInt(v, 10);
|
|
3252
|
-
|
|
3252
|
+
_ === 2 && g === 4 ? k = Math.floor((/* @__PURE__ */ new Date()).getFullYear() / 100) * 100 + k : _ === 2 && g === 2 && (k = Math.floor((/* @__PURE__ */ new Date()).getFullYear() / 100) * 100 + k), d = k, f += _;
|
|
3253
3253
|
}
|
|
3254
3254
|
if (!h || p < 0 || p > 11 || !d) return null;
|
|
3255
|
-
const
|
|
3256
|
-
return isNaN(
|
|
3255
|
+
const u = new Date(d, p, h);
|
|
3256
|
+
return isNaN(u.getTime()) || u.getDate() !== h || u.getMonth() !== p || u.getFullYear() !== d ? null : u;
|
|
3257
3257
|
}
|
|
3258
3258
|
_formatDate(t, e) {
|
|
3259
3259
|
const i = t.getDate(), s = t.getMonth() + 1, n = t.getFullYear(), r = e.toLowerCase();
|
|
@@ -3262,18 +3262,18 @@ class ft extends HTMLElement {
|
|
|
3262
3262
|
}
|
|
3263
3263
|
// PHP-style formatter for display mode
|
|
3264
3264
|
_formatDatePhp(t, e) {
|
|
3265
|
-
const i = t.getDate(), s = t.getMonth() + 1, n = t.getFullYear(), r = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], a = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], o = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], l = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], c = (d,
|
|
3266
|
-
const
|
|
3267
|
-
return
|
|
3265
|
+
const i = t.getDate(), s = t.getMonth() + 1, n = t.getFullYear(), r = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], a = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], o = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], l = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], c = (d, f = 2) => d.toString().padStart(f, "0"), h = (d) => {
|
|
3266
|
+
const f = d % 10, u = d % 100;
|
|
3267
|
+
return f === 1 && u !== 11 ? "st" : f === 2 && u !== 12 ? "nd" : f === 3 && u !== 13 ? "rd" : "th";
|
|
3268
3268
|
};
|
|
3269
3269
|
let p = "";
|
|
3270
3270
|
for (let d = 0; d < e.length; d++) {
|
|
3271
|
-
const
|
|
3272
|
-
if (
|
|
3271
|
+
const f = e[d];
|
|
3272
|
+
if (f === "\\" && d + 1 < e.length) {
|
|
3273
3273
|
p += e[d + 1], d++;
|
|
3274
3274
|
continue;
|
|
3275
3275
|
}
|
|
3276
|
-
switch (
|
|
3276
|
+
switch (f) {
|
|
3277
3277
|
case "Y":
|
|
3278
3278
|
p += n.toString();
|
|
3279
3279
|
break;
|
|
@@ -3308,7 +3308,7 @@ class ft extends HTMLElement {
|
|
|
3308
3308
|
p += h(i);
|
|
3309
3309
|
break;
|
|
3310
3310
|
default:
|
|
3311
|
-
p +=
|
|
3311
|
+
p += f;
|
|
3312
3312
|
break;
|
|
3313
3313
|
}
|
|
3314
3314
|
}
|
|
@@ -3321,28 +3321,28 @@ class ft extends HTMLElement {
|
|
|
3321
3321
|
render() {
|
|
3322
3322
|
const t = this.isLoading(), e = this.getLabel(), i = this.getInfo(), s = this.getValue(), n = this.isDisabled(), r = this.isReadonly(), a = this.isRequired(), o = this.getId(), l = this.getName(), c = this.getFormat(), h = this.hasError(), p = this.getErrorMessage(), d = this.getSelectionMode();
|
|
3323
3323
|
this._isRange = this.isRange() || d === "week" || d === "month", this._input || (this._input = document.createElement("div"), this._input.className = "relative w-full", this.appendChild(this._input));
|
|
3324
|
-
let
|
|
3324
|
+
let f = this.querySelector(".mint-date-picker-label-container");
|
|
3325
3325
|
if (e || i) {
|
|
3326
|
-
|
|
3327
|
-
let v =
|
|
3328
|
-
e ? (v || (v = document.createElement("label"), v.className = "mint-date-picker-label text-sm font-medium text-gray-900 dark:text-gray-100 select-none",
|
|
3329
|
-
let k =
|
|
3330
|
-
i ? (k || (k = document.createElement("span"), k.className = "mint-date-picker-info text-xs text-gray-500 dark:text-gray-400 select-none",
|
|
3331
|
-
} else
|
|
3326
|
+
f || (f = document.createElement("div"), f.className = "mint-date-picker-label-container flex flex-col gap-0.5 mb-[.25rem]", this.contains(this._input) ? this.insertBefore(f, this._input) : this.appendChild(f));
|
|
3327
|
+
let v = f.querySelector(".mint-date-picker-label");
|
|
3328
|
+
e ? (v || (v = document.createElement("label"), v.className = "mint-date-picker-label text-sm font-medium text-gray-900 dark:text-gray-100 select-none", f.insertBefore(v, f.firstChild)), v.textContent = e, o && this._textInput && v.setAttribute("for", o)) : v && v.remove();
|
|
3329
|
+
let k = f.querySelector(".mint-date-picker-info");
|
|
3330
|
+
i ? (k || (k = document.createElement("span"), k.className = "mint-date-picker-info text-xs text-gray-500 dark:text-gray-400 select-none", f.appendChild(k)), k.textContent = i) : k && k.remove();
|
|
3331
|
+
} else f && f.remove();
|
|
3332
3332
|
this._hiddenInput || (this._hiddenInput = document.createElement("input"), this._hiddenInput.type = "hidden", this._hiddenInput.value = s || "", this._textInput = this._hiddenInput, this._input.appendChild(this._hiddenInput)), o && (this._hiddenInput.id = o), l && (this._hiddenInput.name = l), this._hiddenInput.value = s || "", this._hiddenInput.setAttribute("aria-invalid", h ? "true" : "false");
|
|
3333
|
-
let
|
|
3334
|
-
|
|
3335
|
-
const
|
|
3336
|
-
this._displayEl.className = `flex-1 text-gray-900 dark:text-white ${r ? "cursor-default" : "cursor-text"} ${
|
|
3333
|
+
let u = this._input.querySelector(".mint-date-fields");
|
|
3334
|
+
u || (u = document.createElement("div"), this._input.appendChild(u)), this._fieldsContainer = u, this._applyErrorVisuals(h, p, n), u.innerHTML = "", this._displayEl = document.createElement("div");
|
|
3335
|
+
const m = r ? "select-text" : "select-none";
|
|
3336
|
+
this._displayEl.className = `flex-1 text-gray-900 dark:text-white ${r ? "cursor-default" : "cursor-text"} ${m} focus:outline-none`, this._displayEl.tabIndex = n || r ? -1 : 0, this._displayEl.addEventListener("click", () => {
|
|
3337
3337
|
n || r || this._enterInputMode();
|
|
3338
3338
|
}), this._displayEl.addEventListener("keydown", (v) => {
|
|
3339
3339
|
n || r || (v.key === "Enter" || v.key === " ") && (v.preventDefault(), this._enterInputMode());
|
|
3340
3340
|
}), this._inputsWrapperEl = document.createElement("div"), this._inputsWrapperEl.className = "flex items-center gap-1 w-full";
|
|
3341
|
-
const
|
|
3341
|
+
const g = this._getFormatTokens(c);
|
|
3342
3342
|
this._startPartInputs = [], this._endPartInputs = [];
|
|
3343
|
-
const
|
|
3343
|
+
const b = (v) => {
|
|
3344
3344
|
const k = document.createDocumentFragment();
|
|
3345
|
-
return
|
|
3345
|
+
return g.forEach((A) => {
|
|
3346
3346
|
if (A.type === "sep") {
|
|
3347
3347
|
const E = document.createElement("span");
|
|
3348
3348
|
E.textContent = A.value, E.className = "text-gray-400 dark:text-gray-500 select-none", k.appendChild(E);
|
|
@@ -3352,14 +3352,14 @@ class ft extends HTMLElement {
|
|
|
3352
3352
|
}
|
|
3353
3353
|
}), k;
|
|
3354
3354
|
};
|
|
3355
|
-
if (this._inputsWrapperEl.appendChild(
|
|
3355
|
+
if (this._inputsWrapperEl.appendChild(b("start")), this._isRange) {
|
|
3356
3356
|
const v = document.createElement("span");
|
|
3357
|
-
v.textContent = " - ", v.className = "text-gray-400 dark:text-gray-500 select-none", this._inputsWrapperEl.appendChild(v), this._inputsWrapperEl.appendChild(
|
|
3357
|
+
v.textContent = " - ", v.className = "text-gray-400 dark:text-gray-500 select-none", this._inputsWrapperEl.appendChild(v), this._inputsWrapperEl.appendChild(b("end"));
|
|
3358
3358
|
}
|
|
3359
|
-
const
|
|
3360
|
-
if (
|
|
3359
|
+
const _ = document.createElement("div");
|
|
3360
|
+
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", () => {
|
|
3361
3361
|
this._isInputMode || n || r || this._enterInputMode();
|
|
3362
|
-
}), this._attachPartInputHandlers(this._startPartInputs,
|
|
3362
|
+
}), this._attachPartInputHandlers(this._startPartInputs, g, u), this._isRange && this._attachPartInputHandlers(this._endPartInputs, g, u), this._parseValue(s), this._syncHiddenInput(), this._updateDisplayText(), this._iconButton)
|
|
3363
3363
|
this._iconButton.disabled = n || r, !n && !r ? this._iconButton.tabIndex = 0 : this._iconButton.tabIndex = -1;
|
|
3364
3364
|
else {
|
|
3365
3365
|
this._iconButton = document.createElement("button"), this._iconButton.type = "button", this._iconButton.tabIndex = 0, this._iconButton.className = "absolute left-2 top-[.55rem] text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 cursor-pointer z-10 focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500 pointer-events-auto disabled:opacity-40 disabled:cursor-not-allowed flex items-center justify-center rounded-sm";
|
|
@@ -3396,9 +3396,9 @@ class ft extends HTMLElement {
|
|
|
3396
3396
|
}
|
|
3397
3397
|
_getFieldContainerClass(t, e) {
|
|
3398
3398
|
return [
|
|
3399
|
-
"mint-date-fields relative w-full pl-10 pr-3.5 py-1.5 min-h-[2rem] text-sm font-medium rounded-lg box-border bg-white dark:bg-gray-700 text-gray-900 dark:text-white",
|
|
3399
|
+
"mint-date-fields relative w-full pl-10 pr-3.5 py-1.5 min-h-[2rem] text-sm font-medium rounded-lg box-border bg-white dark:bg-gray-900 dark:border dark:border-gray-700 text-gray-900 dark:text-white",
|
|
3400
3400
|
"border-2",
|
|
3401
|
-
t ? "border-red-300 dark:border-red-300" : "border-gray-200 dark:border-gray-
|
|
3401
|
+
t ? "border-red-300 dark:border-red-300" : "border-gray-200 dark:border-gray-700",
|
|
3402
3402
|
"transition-all duration-200 outline-none focus-within:ring-2 focus-within:ring-offset-1",
|
|
3403
3403
|
t ? "focus-within:ring-red-400 dark:focus-within:ring-red-500" : "focus-within:ring-gray-400 dark:focus-within:ring-gray-500",
|
|
3404
3404
|
"flex items-center gap-1"
|
|
@@ -3511,7 +3511,7 @@ class ft extends HTMLElement {
|
|
|
3511
3511
|
}
|
|
3512
3512
|
_buildCalendar() {
|
|
3513
3513
|
if (!this._popover) return;
|
|
3514
|
-
this._calendarContainer && this._calendarContainer.parentNode && this._calendarContainer.remove(), this._calendarContainer = document.createElement("div"), this._calendarContainer.className = "mint-date-calendar bg-white dark:bg-gray-
|
|
3514
|
+
this._calendarContainer && this._calendarContainer.parentNode && this._calendarContainer.remove(), this._calendarContainer = document.createElement("div"), this._calendarContainer.className = "mint-date-calendar bg-white dark:bg-gray-900 dark:border dark:border-gray-700 rounded-lg p-4 w-[22rem] md:w-auto md:min-w-[28rem]", this._viewMode === "calendar" ? this._buildCalendarView() : this._viewMode === "month" ? this._buildMonthView() : this._viewMode === "year" && this._buildYearView();
|
|
3515
3515
|
const t = this._popover.querySelector(".popover-content");
|
|
3516
3516
|
if (t) {
|
|
3517
3517
|
for (; t.firstChild; )
|
|
@@ -3523,7 +3523,7 @@ class ft extends HTMLElement {
|
|
|
3523
3523
|
_buildCalendarView() {
|
|
3524
3524
|
if (!this._calendarContainer) return;
|
|
3525
3525
|
const t = this._getDaysInMonth(this._currentMonth, this._currentYear), e = this._getFirstDayOfMonth(this._currentMonth, this._currentYear), i = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], s = this.getWeekStartDay(), n = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], r = [...n.slice(s), ...n.slice(0, s)], a = this.getShortcuts(), o = a.length > 0;
|
|
3526
|
-
this._calendarContainer.className = o ? "mint-date-calendar bg-white dark:bg-gray-
|
|
3526
|
+
this._calendarContainer.className = o ? "mint-date-calendar bg-white dark:bg-gray-900 dark:border dark:border-gray-700 rounded-lg p-4 w-[18rem] md:w-auto md:min-w-[28rem]" : "mint-date-calendar bg-white dark:bg-gray-900 dark:border dark:border-gray-700 rounded-lg p-4 w-[18rem] md:min-w-[18rem]";
|
|
3527
3527
|
const l = document.createElement("div");
|
|
3528
3528
|
l.className = "flex flex-col md:flex-row md:gap-6 md:items-start";
|
|
3529
3529
|
const c = document.createElement("div");
|
|
@@ -3536,60 +3536,60 @@ class ft extends HTMLElement {
|
|
|
3536
3536
|
d.setAttribute("name", "caret-left"), d.className = "w-4 h-4", p.appendChild(d), p.addEventListener("click", () => {
|
|
3537
3537
|
this._currentMonth === 0 ? (this._currentMonth = 11, this._currentYear--) : this._currentMonth--, this._buildCalendar();
|
|
3538
3538
|
}), h.appendChild(p);
|
|
3539
|
-
const
|
|
3540
|
-
|
|
3541
|
-
const
|
|
3542
|
-
|
|
3539
|
+
const f = document.createElement("div");
|
|
3540
|
+
f.className = "flex items-center gap-2";
|
|
3541
|
+
const u = document.createElement("button");
|
|
3542
|
+
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", () => {
|
|
3543
3543
|
this._viewMode = "month", this._buildCalendar();
|
|
3544
|
-
}),
|
|
3545
|
-
const f = document.createElement("button");
|
|
3546
|
-
f.type = "button", f.tabIndex = 0, f.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", f.setAttribute("data-keep-popover-open", "true"), f.textContent = String(this._currentYear), f.addEventListener("click", () => {
|
|
3547
|
-
this._viewMode = "year", this._buildCalendar();
|
|
3548
|
-
}), u.appendChild(f), h.appendChild(u);
|
|
3544
|
+
}), f.appendChild(u);
|
|
3549
3545
|
const m = document.createElement("button");
|
|
3550
|
-
m.type = "button", m.tabIndex = 0, m.className = "
|
|
3551
|
-
|
|
3552
|
-
|
|
3546
|
+
m.type = "button", m.tabIndex = 0, m.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", m.setAttribute("data-keep-popover-open", "true"), m.textContent = String(this._currentYear), m.addEventListener("click", () => {
|
|
3547
|
+
this._viewMode = "year", this._buildCalendar();
|
|
3548
|
+
}), f.appendChild(m), h.appendChild(f);
|
|
3549
|
+
const g = document.createElement("button");
|
|
3550
|
+
g.type = "button", g.tabIndex = 0, g.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", g.setAttribute("data-keep-popover-open", "true");
|
|
3551
|
+
const b = document.createElement("mint-icon");
|
|
3552
|
+
b.setAttribute("name", "caret-right"), b.className = "w-4 h-4", g.appendChild(b), g.addEventListener("click", () => {
|
|
3553
3553
|
this._currentMonth === 11 ? (this._currentMonth = 0, this._currentYear++) : this._currentMonth++, this._buildCalendar();
|
|
3554
|
-
}), h.appendChild(
|
|
3555
|
-
const
|
|
3556
|
-
|
|
3557
|
-
const
|
|
3558
|
-
|
|
3554
|
+
}), h.appendChild(g);
|
|
3555
|
+
const _ = document.createElement("div");
|
|
3556
|
+
_.className = "grid grid-cols-7 mb-2", r.forEach((w) => {
|
|
3557
|
+
const T = document.createElement("div");
|
|
3558
|
+
T.className = "text-xs font-medium text-gray-500 dark:text-gray-400 text-center py-1", T.textContent = w, _.appendChild(T);
|
|
3559
3559
|
});
|
|
3560
3560
|
const v = document.createElement("div");
|
|
3561
3561
|
v.className = "grid grid-cols-7";
|
|
3562
|
-
const k = this.getMin() ? this._parseDateString(this.getMin(), this.getFormat()) : null, A = this.getMax() ? this._parseDateString(this.getMax(), this.getFormat()) : null, E = this._currentMonth === 0 ? 11 : this._currentMonth - 1, y = this._currentMonth === 0 ? this._currentYear - 1 : this._currentYear, x = this._getDaysInMonth(E, y),
|
|
3563
|
-
const V = this._isToday(
|
|
3562
|
+
const k = this.getMin() ? this._parseDateString(this.getMin(), this.getFormat()) : null, A = this.getMax() ? this._parseDateString(this.getMax(), this.getFormat()) : null, E = this._currentMonth === 0 ? 11 : this._currentMonth - 1, y = this._currentMonth === 0 ? this._currentYear - 1 : this._currentYear, x = this._getDaysInMonth(E, y), I = this._currentMonth === 11 ? 0 : this._currentMonth + 1, R = this._currentMonth === 11 ? this._currentYear + 1 : this._currentYear, P = e + t, G = Math.ceil(P / 7) * 7 - P, j = (w, T, S) => {
|
|
3563
|
+
const V = this._isToday(w), O = this._isDateSelected(w), q = this._isDateInRange(w), F = k && w < k || A && w > A;
|
|
3564
3564
|
let M = "rounded-md";
|
|
3565
3565
|
if (this._isRange && this._selectedStartDate && this._selectedEndDate) {
|
|
3566
|
-
const D = this._isSameDate(
|
|
3567
|
-
D && L ? M = "rounded-md" : D ? M = "rounded-l-md" : L ? M = "rounded-r-md" :
|
|
3566
|
+
const D = this._isSameDate(w, this._selectedStartDate), L = this._isSameDate(w, this._selectedEndDate);
|
|
3567
|
+
D && L ? M = "rounded-md" : D ? M = "rounded-l-md" : L ? M = "rounded-r-md" : q && (M = "rounded-none");
|
|
3568
3568
|
} else O && !this._isRange && (M = "rounded-md");
|
|
3569
3569
|
const N = document.createElement("button");
|
|
3570
3570
|
N.type = "button", N.disabled = !!F, N.tabIndex = F ? -1 : 0;
|
|
3571
3571
|
let B = `w-full h-8 ${M} 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`;
|
|
3572
|
-
return S ? B += O ? " bg-slate-800 dark:bg-slate-600 text-white" :
|
|
3573
|
-
this._handleDateClick(
|
|
3572
|
+
return S ? B += O ? " bg-slate-800 dark:bg-slate-600 text-white" : q ? " bg-slate-100 dark:bg-slate-700 text-slate-800 dark:text-slate-200" : V ? " 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" : B += O ? " bg-slate-800 dark:bg-slate-600 text-white" : q ? " bg-slate-100 dark:bg-slate-700 text-slate-800 dark:text-slate-200" : " text-gray-400 dark:text-gray-500 hover:bg-gray-100 dark:hover:bg-gray-700", B += F ? " opacity-40 cursor-not-allowed" : "", N.className = B, N.textContent = T.toString(), F || N.addEventListener("click", () => {
|
|
3573
|
+
this._handleDateClick(w);
|
|
3574
3574
|
}), N;
|
|
3575
3575
|
};
|
|
3576
|
-
for (let
|
|
3577
|
-
const
|
|
3576
|
+
for (let w = e - 1; w >= 0; w--) {
|
|
3577
|
+
const T = x - w, S = new Date(y, E, T), V = j(S, T, !1);
|
|
3578
3578
|
v.appendChild(V);
|
|
3579
3579
|
}
|
|
3580
|
-
for (let
|
|
3581
|
-
const
|
|
3580
|
+
for (let w = 1; w <= t; w++) {
|
|
3581
|
+
const T = new Date(this._currentYear, this._currentMonth, w), S = j(T, w, !0);
|
|
3582
3582
|
v.appendChild(S);
|
|
3583
3583
|
}
|
|
3584
|
-
for (let
|
|
3585
|
-
const
|
|
3584
|
+
for (let w = 1; w <= G; w++) {
|
|
3585
|
+
const T = new Date(R, I, w), S = j(T, w, !1);
|
|
3586
3586
|
v.appendChild(S);
|
|
3587
3587
|
}
|
|
3588
3588
|
if (o) {
|
|
3589
|
-
const
|
|
3590
|
-
|
|
3591
|
-
const
|
|
3592
|
-
|
|
3589
|
+
const w = document.createElement("div");
|
|
3590
|
+
w.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";
|
|
3591
|
+
const T = document.createElement("div");
|
|
3592
|
+
T.className = "relative md:relative md:flex-1 md:min-h-0";
|
|
3593
3593
|
const S = document.createElement("div");
|
|
3594
3594
|
S.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", S.style.scrollbarWidth = "none", S.style.msOverflowStyle = "none", S.style.setProperty("-webkit-overflow-scrolling", "touch");
|
|
3595
3595
|
const V = document.createElement("style");
|
|
@@ -3619,20 +3619,20 @@ class ft extends HTMLElement {
|
|
|
3619
3619
|
}
|
|
3620
3620
|
`, S.classList.add("mint-date-shortcuts-row"), document.head.querySelector("style[data-mint-date-shortcuts]") || (V.setAttribute("data-mint-date-shortcuts", "true"), document.head.appendChild(V));
|
|
3621
3621
|
const O = document.createElement("div");
|
|
3622
|
-
O.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",
|
|
3623
|
-
const
|
|
3624
|
-
|
|
3622
|
+
O.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", T.appendChild(O);
|
|
3623
|
+
const q = document.createElement("div");
|
|
3624
|
+
q.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", T.appendChild(q);
|
|
3625
3625
|
const F = document.createElement("div");
|
|
3626
|
-
F.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",
|
|
3626
|
+
F.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", T.appendChild(F);
|
|
3627
3627
|
const M = document.createElement("div");
|
|
3628
|
-
M.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",
|
|
3628
|
+
M.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", T.appendChild(M);
|
|
3629
3629
|
const N = () => {
|
|
3630
3630
|
if (window.innerWidth >= 768) {
|
|
3631
3631
|
const D = S.scrollTop, L = S.scrollHeight, z = S.clientHeight;
|
|
3632
|
-
D > 0 ? F.style.opacity = "1" : F.style.opacity = "0", D + z < L - 1 ? M.style.opacity = "1" : M.style.opacity = "0", O.style.opacity = "0",
|
|
3632
|
+
D > 0 ? F.style.opacity = "1" : F.style.opacity = "0", D + z < L - 1 ? M.style.opacity = "1" : M.style.opacity = "0", O.style.opacity = "0", q.style.opacity = "0";
|
|
3633
3633
|
} else {
|
|
3634
3634
|
const D = S.scrollLeft, L = S.scrollWidth, z = S.clientWidth;
|
|
3635
|
-
D > 0 ? O.style.opacity = "1" : O.style.opacity = "0", D + z < L - 1 ?
|
|
3635
|
+
D > 0 ? O.style.opacity = "1" : O.style.opacity = "0", D + z < L - 1 ? q.style.opacity = "1" : q.style.opacity = "0", F.style.opacity = "0", M.style.opacity = "0";
|
|
3636
3636
|
}
|
|
3637
3637
|
};
|
|
3638
3638
|
S.addEventListener("scroll", N), window.addEventListener("resize", N), setTimeout(N, 0), a.forEach((B) => {
|
|
@@ -3660,9 +3660,9 @@ class ft extends HTMLElement {
|
|
|
3660
3660
|
}));
|
|
3661
3661
|
}
|
|
3662
3662
|
}), S.appendChild(D);
|
|
3663
|
-
}),
|
|
3663
|
+
}), T.appendChild(S), w.appendChild(T), l.appendChild(w);
|
|
3664
3664
|
}
|
|
3665
|
-
c.appendChild(h), c.appendChild(
|
|
3665
|
+
c.appendChild(h), c.appendChild(_), c.appendChild(v), l.appendChild(c), this._calendarContainer.appendChild(l);
|
|
3666
3666
|
}
|
|
3667
3667
|
_buildMonthView() {
|
|
3668
3668
|
if (!this._calendarContainer) return;
|
|
@@ -3916,7 +3916,7 @@ class mt extends HTMLElement {
|
|
|
3916
3916
|
this._select && this._changeHandler && (this._select.removeEventListener("change", this._changeHandler), this._changeHandler = null), this._optionObserver && (this._optionObserver.disconnect(), this._optionObserver = null), this._childrenObserver && (this._childrenObserver.disconnect(), this._childrenObserver = null);
|
|
3917
3917
|
}
|
|
3918
3918
|
isLoading() {
|
|
3919
|
-
return this.
|
|
3919
|
+
return this.getAttribute("loading") === "true";
|
|
3920
3920
|
}
|
|
3921
3921
|
attributeChangedCallback(t, e, i) {
|
|
3922
3922
|
if (e !== i) {
|
|
@@ -3966,13 +3966,13 @@ class mt extends HTMLElement {
|
|
|
3966
3966
|
}
|
|
3967
3967
|
}
|
|
3968
3968
|
isDisabled() {
|
|
3969
|
-
return this.
|
|
3969
|
+
return this.getAttribute("disabled") === "true";
|
|
3970
3970
|
}
|
|
3971
3971
|
isMultiple() {
|
|
3972
|
-
return this.
|
|
3972
|
+
return this.getAttribute("multiple") === "true";
|
|
3973
3973
|
}
|
|
3974
3974
|
hasError() {
|
|
3975
|
-
return this.
|
|
3975
|
+
return this.getAttribute("error") === "true";
|
|
3976
3976
|
}
|
|
3977
3977
|
getErrorMessage() {
|
|
3978
3978
|
return this.getAttribute("error-message") || "";
|
|
@@ -3999,7 +3999,7 @@ class mt extends HTMLElement {
|
|
|
3999
3999
|
"rounded-lg",
|
|
4000
4000
|
"box-border",
|
|
4001
4001
|
"bg-white",
|
|
4002
|
-
"dark:bg-gray-
|
|
4002
|
+
"dark:bg-gray-900",
|
|
4003
4003
|
"text-gray-900",
|
|
4004
4004
|
"dark:text-white",
|
|
4005
4005
|
"transition-all",
|
|
@@ -4015,7 +4015,7 @@ class mt extends HTMLElement {
|
|
|
4015
4015
|
"cursor-pointer"
|
|
4016
4016
|
], s = [
|
|
4017
4017
|
"border-2",
|
|
4018
|
-
t ? "border-red-300 dark:border-red-300" : "border-gray-200 dark:border-gray-
|
|
4018
|
+
t ? "border-red-300 dark:border-red-300" : "border-gray-200 dark:border-gray-700"
|
|
4019
4019
|
], n = [
|
|
4020
4020
|
"focus-visible:ring-2",
|
|
4021
4021
|
"focus-visible:ring-offset-1",
|
|
@@ -4036,8 +4036,8 @@ class mt extends HTMLElement {
|
|
|
4036
4036
|
if (s) {
|
|
4037
4037
|
const d = document.createElement("label");
|
|
4038
4038
|
d.className = "block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1", r && d.setAttribute("for", r);
|
|
4039
|
-
const
|
|
4040
|
-
d.appendChild(
|
|
4039
|
+
const f = document.createTextNode(s);
|
|
4040
|
+
d.appendChild(f), this.appendChild(d);
|
|
4041
4041
|
}
|
|
4042
4042
|
this._wrapper = document.createElement("div"), this._wrapper.className = "relative w-full", this.appendChild(this._wrapper), this._select = document.createElement("select"), this._select.className = this.getSelectClasses(), r && (this._select.id = r), a && (this._select.name = a), l && (this._select.disabled = !0), c && (this._select.multiple = !0), this._select.setAttribute("aria-invalid", h ? "true" : "false");
|
|
4043
4043
|
const p = i.length > 0 ? i : e;
|
|
@@ -4048,20 +4048,20 @@ class mt extends HTMLElement {
|
|
|
4048
4048
|
d.value = "", d.textContent = "Select an option", d.disabled = !0, d.selected = !0, this._select.appendChild(d);
|
|
4049
4049
|
}
|
|
4050
4050
|
if (this._select.value = o || "", this._changeHandler && this._select && this._select.removeEventListener("change", this._changeHandler), this._changeHandler = (d) => {
|
|
4051
|
-
const
|
|
4052
|
-
(this.getAttribute("value") || "") !==
|
|
4053
|
-
const
|
|
4051
|
+
const u = d.target.value;
|
|
4052
|
+
(this.getAttribute("value") || "") !== u && (u ? this.setAttribute("value", u) : this.removeAttribute("value"));
|
|
4053
|
+
const g = new Event("input", {
|
|
4054
4054
|
bubbles: !0,
|
|
4055
4055
|
cancelable: !0,
|
|
4056
4056
|
composed: !0
|
|
4057
4057
|
});
|
|
4058
|
-
this.dispatchEvent(
|
|
4059
|
-
detail: { value:
|
|
4058
|
+
this.dispatchEvent(g), this.dispatchEvent(new CustomEvent("input", {
|
|
4059
|
+
detail: { value: u },
|
|
4060
4060
|
bubbles: !0,
|
|
4061
4061
|
cancelable: !0,
|
|
4062
4062
|
composed: !0
|
|
4063
4063
|
})), this.dispatchEvent(new CustomEvent("change", {
|
|
4064
|
-
detail: { value:
|
|
4064
|
+
detail: { value: u },
|
|
4065
4065
|
bubbles: !0,
|
|
4066
4066
|
cancelable: !0,
|
|
4067
4067
|
composed: !0
|
|
@@ -4070,7 +4070,7 @@ class mt extends HTMLElement {
|
|
|
4070
4070
|
const d = this.getAttribute("value") || this.value || "";
|
|
4071
4071
|
this._select && d && requestAnimationFrame(() => {
|
|
4072
4072
|
this._select && Array.from(this._select.options).some(
|
|
4073
|
-
(
|
|
4073
|
+
(u) => u.value === d
|
|
4074
4074
|
) && this._select.value !== d && (this._select.value = d);
|
|
4075
4075
|
});
|
|
4076
4076
|
}), this._optionObserver.observe(this._select, {
|
|
@@ -4146,7 +4146,7 @@ class gt extends HTMLElement {
|
|
|
4146
4146
|
return this.getAttribute("accept") || "";
|
|
4147
4147
|
}
|
|
4148
4148
|
isMultiple() {
|
|
4149
|
-
return this.
|
|
4149
|
+
return this.getAttribute("multiple") === "true";
|
|
4150
4150
|
}
|
|
4151
4151
|
getWidth() {
|
|
4152
4152
|
return this.getAttribute("width") || "200px";
|
|
@@ -4197,16 +4197,16 @@ class gt extends HTMLElement {
|
|
|
4197
4197
|
return this.getAttribute("name") || "";
|
|
4198
4198
|
}
|
|
4199
4199
|
hasError() {
|
|
4200
|
-
return this.
|
|
4200
|
+
return this.getAttribute("error") === "true";
|
|
4201
4201
|
}
|
|
4202
4202
|
getErrorMessage() {
|
|
4203
4203
|
return this.getAttribute("error-message") || "";
|
|
4204
4204
|
}
|
|
4205
4205
|
isDisabled() {
|
|
4206
|
-
return this.
|
|
4206
|
+
return this.getAttribute("disabled") === "true";
|
|
4207
4207
|
}
|
|
4208
4208
|
isLoading() {
|
|
4209
|
-
return this.
|
|
4209
|
+
return this.getAttribute("loading") === "true";
|
|
4210
4210
|
}
|
|
4211
4211
|
render() {
|
|
4212
4212
|
const t = this.isLoading(), e = this.getLabel(), i = this.getAccept(), s = this.isMultiple(), n = this.isDisabled(), r = this.getWidth(), a = this.getHeight(), o = this.getName(), l = this.hasError(), c = this.getErrorMessage();
|
|
@@ -4215,10 +4215,10 @@ class gt extends HTMLElement {
|
|
|
4215
4215
|
h && h.remove(), p && p.remove();
|
|
4216
4216
|
const d = document.createElement("div");
|
|
4217
4217
|
d.className = "mint-dropzone-icon flex items-center justify-center mt-2 mb-2 flex-shrink-0";
|
|
4218
|
-
const
|
|
4219
|
-
if (
|
|
4220
|
-
const
|
|
4221
|
-
|
|
4218
|
+
const f = document.createElement("mint-icon");
|
|
4219
|
+
if (f.setAttribute("name", "upload"), f.className = "w-12 h-12 text-gray-400 dark:text-gray-500", d.appendChild(f), this._dropzone.appendChild(d), e) {
|
|
4220
|
+
const u = document.createElement("div");
|
|
4221
|
+
u.className = "mint-dropzone-label text-sm font-medium text-gray-600 dark:text-gray-400 text-center px-4 flex-shrink-0", u.textContent = e, this._dropzone.appendChild(u);
|
|
4222
4222
|
}
|
|
4223
4223
|
this.setupEventListeners(), this._renderErrorState(l, c), this._renderPreviews(), this._renderSkeleton(t);
|
|
4224
4224
|
}
|
|
@@ -4231,7 +4231,7 @@ class gt extends HTMLElement {
|
|
|
4231
4231
|
}
|
|
4232
4232
|
_updateDragStateClass() {
|
|
4233
4233
|
if (!this._dropzone) return;
|
|
4234
|
-
const t = this.isDisabled(), e = this.hasError(), n = `relative border-2 border-dashed rounded-lg transition-all duration-200 flex flex-col items-center ${this._selectedFiles.length > 0 ? "justify-start" : "justify-center"} cursor-pointer overflow-hidden`, r = this._isDragging ? "border-gray-400 dark:border-gray-500 bg-gray-50 dark:bg-gray-
|
|
4234
|
+
const t = this.isDisabled(), e = this.hasError(), n = `relative border-2 border-dashed rounded-lg transition-all duration-200 flex flex-col items-center ${this._selectedFiles.length > 0 ? "justify-start" : "justify-center"} cursor-pointer overflow-hidden`, r = this._isDragging ? "border-gray-400 dark:border-gray-500 bg-gray-50 dark:bg-gray-900 dark:border-gray-700" : "border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-900 dark:border-gray-700 hover:border-gray-400 dark:hover:border-gray-500", a = e ? "border-red-300 dark:border-red-300 bg-red-50/50 dark:bg-red-900/30" : "", o = t ? "opacity-40 cursor-not-allowed" : "", l = "focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500";
|
|
4235
4235
|
this._dropzone.className = `${n} ${e ? a : r} ${o} ${l}`.trim();
|
|
4236
4236
|
}
|
|
4237
4237
|
setupEventListeners() {
|
|
@@ -4375,22 +4375,22 @@ class gt extends HTMLElement {
|
|
|
4375
4375
|
const e = document.createElement("div");
|
|
4376
4376
|
e.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((l, c) => {
|
|
4377
4377
|
const h = document.createElement("div");
|
|
4378
|
-
if (h.className = "flex items-center gap-3 p-2 rounded border border-gray-200 dark:border-gray-
|
|
4379
|
-
const
|
|
4380
|
-
|
|
4381
|
-
const
|
|
4382
|
-
this._previewUrls.push(
|
|
4378
|
+
if (h.className = "flex items-center gap-3 p-2 rounded border border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-900", l.type.startsWith("image/")) {
|
|
4379
|
+
const u = document.createElement("img");
|
|
4380
|
+
u.className = "w-12 h-12 object-cover rounded border border-gray-200 dark:border-gray-700";
|
|
4381
|
+
const m = URL.createObjectURL(l);
|
|
4382
|
+
this._previewUrls.push(m), u.src = m, h.appendChild(u);
|
|
4383
4383
|
} else {
|
|
4384
|
-
const
|
|
4385
|
-
|
|
4384
|
+
const u = document.createElement("mint-icon");
|
|
4385
|
+
u.setAttribute("name", "attach"), u.className = "w-5 h-5 text-gray-500 dark:text-gray-300", h.appendChild(u);
|
|
4386
4386
|
}
|
|
4387
4387
|
const p = document.createElement("div");
|
|
4388
4388
|
p.className = "flex-1 text-sm text-gray-800 dark:text-gray-100 truncate", p.textContent = l.name, h.appendChild(p);
|
|
4389
4389
|
const d = document.createElement("button");
|
|
4390
4390
|
d.type = "button", d.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";
|
|
4391
|
-
const
|
|
4392
|
-
|
|
4393
|
-
|
|
4391
|
+
const f = document.createElement("mint-icon");
|
|
4392
|
+
f.setAttribute("name", "close"), f.className = "w-4 h-4", d.appendChild(f), d.addEventListener("click", (u) => {
|
|
4393
|
+
u.preventDefault(), u.stopPropagation(), this._removeFileAt(c);
|
|
4394
4394
|
}), h.appendChild(d), e.appendChild(h);
|
|
4395
4395
|
});
|
|
4396
4396
|
const i = this.hasError(), s = this._isDragging;
|
|
@@ -4435,7 +4435,7 @@ class gt extends HTMLElement {
|
|
|
4435
4435
|
}
|
|
4436
4436
|
}
|
|
4437
4437
|
customElements.get("mint-dropzone") || customElements.define("mint-dropzone", gt);
|
|
4438
|
-
class
|
|
4438
|
+
class bt extends HTMLElement {
|
|
4439
4439
|
constructor() {
|
|
4440
4440
|
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, this._formData = null, this._headers = null, this._buttonStates = /* @__PURE__ */ new Map(), this._reactiveDataProxy = null, this._reactiveDataObserver = null, this._lastDataSnapshot = null;
|
|
4441
4441
|
}
|
|
@@ -4592,95 +4592,95 @@ class _t extends HTMLElement {
|
|
|
4592
4592
|
const i = this.getAttribute("action"), s = this.getAttribute("method"), n = this.getAttribute("enctype") || "application/x-www-form-urlencoded";
|
|
4593
4593
|
if (!i)
|
|
4594
4594
|
return { status: 0, ok: !0, data: { values: e } };
|
|
4595
|
-
const r = Array.from(t.values()).some((
|
|
4595
|
+
const r = Array.from(t.values()).some((f) => f instanceof File);
|
|
4596
4596
|
let a = null;
|
|
4597
4597
|
const o = {};
|
|
4598
4598
|
let l = i;
|
|
4599
4599
|
if (typeof window < "u" && ((d = (p = (h = window.mintForm) == null ? void 0 : h.defaults) == null ? void 0 : p.headers) != null && d.common) && Object.assign(o, window.mintForm.defaults.headers.common), this._headers && Object.assign(o, this._headers), s === "GET") {
|
|
4600
|
-
const
|
|
4601
|
-
t.forEach((
|
|
4602
|
-
|
|
4603
|
-
}), l += (i.includes("?") ? "&" : "?") +
|
|
4600
|
+
const f = new URLSearchParams();
|
|
4601
|
+
t.forEach((u, m) => {
|
|
4602
|
+
u instanceof File || f.append(m, String(u));
|
|
4603
|
+
}), l += (i.includes("?") ? "&" : "?") + f.toString();
|
|
4604
4604
|
} else if (n === "multipart/form-data" || r)
|
|
4605
4605
|
a = t;
|
|
4606
4606
|
else if (n === "application/json")
|
|
4607
4607
|
a = JSON.stringify(e), o["Content-Type"] = "application/json";
|
|
4608
4608
|
else {
|
|
4609
|
-
const
|
|
4610
|
-
t.forEach((
|
|
4611
|
-
|
|
4612
|
-
}), a =
|
|
4609
|
+
const f = new URLSearchParams();
|
|
4610
|
+
t.forEach((u, m) => {
|
|
4611
|
+
u instanceof File || f.append(m, String(u));
|
|
4612
|
+
}), a = f, o["Content-Type"] = "application/x-www-form-urlencoded";
|
|
4613
4613
|
}
|
|
4614
4614
|
if (typeof fetch == "function")
|
|
4615
4615
|
try {
|
|
4616
|
-
const
|
|
4616
|
+
const f = await fetch(l, {
|
|
4617
4617
|
method: s || "POST",
|
|
4618
4618
|
body: s === "GET" ? null : a,
|
|
4619
4619
|
headers: o
|
|
4620
|
-
}),
|
|
4621
|
-
let
|
|
4620
|
+
}), u = await f.text().catch(() => "");
|
|
4621
|
+
let m = u;
|
|
4622
4622
|
try {
|
|
4623
|
-
|
|
4623
|
+
m = JSON.parse(u);
|
|
4624
4624
|
} catch {
|
|
4625
4625
|
}
|
|
4626
|
-
if (!
|
|
4627
|
-
const
|
|
4628
|
-
throw await this._applyErrorInterceptors(
|
|
4626
|
+
if (!f.ok) {
|
|
4627
|
+
const b = { status: f.status, data: m, response: { status: f.status, data: m } };
|
|
4628
|
+
throw await this._applyErrorInterceptors(b);
|
|
4629
4629
|
}
|
|
4630
|
-
const
|
|
4631
|
-
return await this._applySuccessInterceptors(
|
|
4632
|
-
} catch (
|
|
4633
|
-
if (
|
|
4634
|
-
throw
|
|
4635
|
-
const
|
|
4636
|
-
status:
|
|
4637
|
-
data:
|
|
4638
|
-
response: { status:
|
|
4630
|
+
const g = { status: f.status, ok: f.ok, data: m };
|
|
4631
|
+
return await this._applySuccessInterceptors(g);
|
|
4632
|
+
} catch (f) {
|
|
4633
|
+
if (f.response)
|
|
4634
|
+
throw f;
|
|
4635
|
+
const u = {
|
|
4636
|
+
status: f.status || 0,
|
|
4637
|
+
data: f.data || f.message || "Network error",
|
|
4638
|
+
response: { status: f.status || 0, data: f.data || f.message || "Network error" }
|
|
4639
4639
|
};
|
|
4640
|
-
throw await this._applyErrorInterceptors(
|
|
4640
|
+
throw await this._applyErrorInterceptors(u);
|
|
4641
4641
|
}
|
|
4642
4642
|
const c = this;
|
|
4643
|
-
return await new Promise(async (
|
|
4644
|
-
const
|
|
4645
|
-
|
|
4646
|
-
const { status:
|
|
4647
|
-
if (
|
|
4648
|
-
let
|
|
4643
|
+
return await new Promise(async (f, u) => {
|
|
4644
|
+
const m = new XMLHttpRequest();
|
|
4645
|
+
m.open(s || "POST", l, !0), Object.entries(o).forEach(([g, b]) => m.setRequestHeader(g, b)), m.onload = async function() {
|
|
4646
|
+
const { status: g, responseText: b } = m;
|
|
4647
|
+
if (g >= 200 && g < 300) {
|
|
4648
|
+
let _ = b;
|
|
4649
4649
|
try {
|
|
4650
|
-
|
|
4650
|
+
_ = JSON.parse(b);
|
|
4651
4651
|
} catch {
|
|
4652
4652
|
}
|
|
4653
4653
|
try {
|
|
4654
|
-
const v = { status:
|
|
4655
|
-
|
|
4654
|
+
const v = { status: g, ok: !0, data: _ }, k = await c._applySuccessInterceptors(v);
|
|
4655
|
+
f(k);
|
|
4656
4656
|
} catch (v) {
|
|
4657
|
-
|
|
4657
|
+
u(v);
|
|
4658
4658
|
}
|
|
4659
4659
|
} else {
|
|
4660
|
-
let
|
|
4660
|
+
let _ = b;
|
|
4661
4661
|
try {
|
|
4662
|
-
|
|
4662
|
+
_ = JSON.parse(b);
|
|
4663
4663
|
} catch {
|
|
4664
4664
|
}
|
|
4665
4665
|
try {
|
|
4666
|
-
const v = { status:
|
|
4667
|
-
|
|
4666
|
+
const v = { status: g, data: _, response: { status: g, data: _ } }, k = await c._applyErrorInterceptors(v);
|
|
4667
|
+
u(k);
|
|
4668
4668
|
} catch (v) {
|
|
4669
|
-
|
|
4669
|
+
u(v);
|
|
4670
4670
|
}
|
|
4671
4671
|
}
|
|
4672
|
-
},
|
|
4672
|
+
}, m.onerror = async function() {
|
|
4673
4673
|
try {
|
|
4674
|
-
const
|
|
4675
|
-
status:
|
|
4676
|
-
data:
|
|
4677
|
-
response: { status:
|
|
4678
|
-
},
|
|
4679
|
-
|
|
4680
|
-
} catch (
|
|
4681
|
-
|
|
4674
|
+
const g = {
|
|
4675
|
+
status: m.status || 0,
|
|
4676
|
+
data: m.responseText || "Network error",
|
|
4677
|
+
response: { status: m.status || 0, data: m.responseText || "Network error" }
|
|
4678
|
+
}, b = await c._applyErrorInterceptors(g);
|
|
4679
|
+
u(b);
|
|
4680
|
+
} catch (g) {
|
|
4681
|
+
u(g);
|
|
4682
4682
|
}
|
|
4683
|
-
},
|
|
4683
|
+
}, m.send(s === "GET" ? null : a);
|
|
4684
4684
|
});
|
|
4685
4685
|
}
|
|
4686
4686
|
async _applySuccessInterceptors(t) {
|
|
@@ -4907,7 +4907,7 @@ class _t extends HTMLElement {
|
|
|
4907
4907
|
t.length !== 0 && t.forEach((i) => {
|
|
4908
4908
|
(i instanceof HTMLInputElement || i instanceof HTMLTextAreaElement || i instanceof HTMLSelectElement) && i.setAttribute("aria-invalid", "true");
|
|
4909
4909
|
const s = this._resolveHost(i);
|
|
4910
|
-
s && (s.setAttribute("error", ""), s.setAttribute("error-message", e), s.setAttribute("data-mint-form-error", "true"));
|
|
4910
|
+
s && (s.setAttribute("error", "true"), s.setAttribute("error-message", e), s.setAttribute("data-mint-form-error", "true"));
|
|
4911
4911
|
});
|
|
4912
4912
|
}
|
|
4913
4913
|
_clearFieldError(t) {
|
|
@@ -5011,7 +5011,7 @@ class _t extends HTMLElement {
|
|
|
5011
5011
|
});
|
|
5012
5012
|
else if (n === "MINT-CHECKBOX" || n === "MINT-SWITCH") {
|
|
5013
5013
|
const a = i === !0 || i === "true" || i === "on" || i === 1 || i === "1";
|
|
5014
|
-
typeof s.checked < "u" ? s.checked = a : a ? s.setAttribute("checked", "") : s.removeAttribute("checked");
|
|
5014
|
+
typeof s.checked < "u" ? s.checked = a : a ? s.setAttribute("checked", "true") : s.removeAttribute("checked");
|
|
5015
5015
|
} else n === "MINT-TAGS" ? Array.isArray(i) && typeof s.tags < "u" && (s.tags = i.map((a) => typeof a == "string" ? { value: a, label: a, dismissable: !0 } : a)) : s instanceof HTMLInputElement ? s.type === "checkbox" || s.type === "radio" ? s.checked = i === !0 || i === "true" || i === "on" || i === 1 || i === "1" : s.value = i || "" : (s instanceof HTMLTextAreaElement || s instanceof HTMLSelectElement) && (s.value = i || "");
|
|
5016
5016
|
} catch (a) {
|
|
5017
5017
|
console.warn(`Failed to set value for field ${e}:`, a);
|
|
@@ -5179,7 +5179,7 @@ class _t extends HTMLElement {
|
|
|
5179
5179
|
Array.from(this._form.querySelectorAll(
|
|
5180
5180
|
"mint-input, mint-select, mint-date-picker, mint-dropzone, mint-checkbox, mint-choice, mint-switch, mint-tags"
|
|
5181
5181
|
)).forEach((s) => {
|
|
5182
|
-
e ? s.setAttribute("loading", "") : s.removeAttribute("loading"), typeof s.render == "function" && s.render();
|
|
5182
|
+
e ? s.setAttribute("loading", "true") : s.removeAttribute("loading"), typeof s.render == "function" && s.render();
|
|
5183
5183
|
});
|
|
5184
5184
|
}
|
|
5185
5185
|
_setButtonsSubmitting() {
|
|
@@ -5324,7 +5324,7 @@ class _t extends HTMLElement {
|
|
|
5324
5324
|
this._reactiveDataObserver !== null && (cancelAnimationFrame(this._reactiveDataObserver), this._reactiveDataObserver = null), this._reactiveDataProxy = null, this._lastDataSnapshot = null;
|
|
5325
5325
|
}
|
|
5326
5326
|
}
|
|
5327
|
-
customElements.get("mint-form") || customElements.define("mint-form",
|
|
5327
|
+
customElements.get("mint-form") || customElements.define("mint-form", bt);
|
|
5328
5328
|
typeof window < "u" && (window.mintForm = window.mintForm || {
|
|
5329
5329
|
defaults: {
|
|
5330
5330
|
headers: {
|
|
@@ -5336,13 +5336,13 @@ typeof window < "u" && (window.mintForm = window.mintForm || {
|
|
|
5336
5336
|
handlers: []
|
|
5337
5337
|
}
|
|
5338
5338
|
}
|
|
5339
|
-
}, window.mintForm.interceptors.response.use || (window.mintForm.interceptors.response.use = function(
|
|
5339
|
+
}, window.mintForm.interceptors.response.use || (window.mintForm.interceptors.response.use = function(C, t) {
|
|
5340
5340
|
return window.mintForm.interceptors.response.handlers.push({
|
|
5341
|
-
fulfilled:
|
|
5341
|
+
fulfilled: C,
|
|
5342
5342
|
rejected: t
|
|
5343
5343
|
}), window.mintForm.interceptors.response.handlers.length - 1;
|
|
5344
5344
|
}));
|
|
5345
|
-
class
|
|
5345
|
+
class _t extends HTMLElement {
|
|
5346
5346
|
constructor() {
|
|
5347
5347
|
super(...arguments), this._observer = null;
|
|
5348
5348
|
}
|
|
@@ -5401,7 +5401,7 @@ class bt extends HTMLElement {
|
|
|
5401
5401
|
]);
|
|
5402
5402
|
const l = r.querySelectorAll("th");
|
|
5403
5403
|
l.forEach((c, h) => {
|
|
5404
|
-
const p = c.querySelector("mint-icon"), d = (p == null ? void 0 : p.getAttribute("name")) || "",
|
|
5404
|
+
const p = c.querySelector("mint-icon"), d = (p == null ? void 0 : p.getAttribute("name")) || "", f = p !== null && d !== "ellipsis";
|
|
5405
5405
|
this._setClasses(c, [
|
|
5406
5406
|
"text-left",
|
|
5407
5407
|
"font-semibold",
|
|
@@ -5412,7 +5412,7 @@ class bt extends HTMLElement {
|
|
|
5412
5412
|
"border-b",
|
|
5413
5413
|
"border-gray-200",
|
|
5414
5414
|
"dark:border-gray-700"
|
|
5415
|
-
]),
|
|
5415
|
+
]), f && c.classList.add("cursor-pointer", "bg-[#F7F7F7]", "dark:bg-gray-800", "hover:bg-gray-100", "dark:hover:bg-gray-700", "transition-colors"), h === 0 && c.classList.add("pl-6"), h === l.length - 1 && c.classList.add("pr-6");
|
|
5416
5416
|
});
|
|
5417
5417
|
}
|
|
5418
5418
|
const a = t.querySelector("tbody");
|
|
@@ -5428,13 +5428,13 @@ class bt extends HTMLElement {
|
|
|
5428
5428
|
"dark:border-gray-700"
|
|
5429
5429
|
]), p && c.classList.add("cursor-pointer", "hover:bg-gray-50", "dark:hover:bg-gray-800", "transition-colors"), h === l.length - 1 && c.classList.remove("border-b");
|
|
5430
5430
|
const d = c.querySelectorAll("td");
|
|
5431
|
-
d.forEach((
|
|
5432
|
-
this._setClasses(
|
|
5431
|
+
d.forEach((f, u) => {
|
|
5432
|
+
this._setClasses(f, [
|
|
5433
5433
|
"text-gray-900",
|
|
5434
5434
|
"dark:text-gray-100",
|
|
5435
5435
|
"px-3",
|
|
5436
5436
|
"py-2"
|
|
5437
|
-
]),
|
|
5437
|
+
]), u === 0 && f.classList.add("pl-6"), u === d.length - 1 && f.classList.add("pr-6"), e ? this._applyMobileCell(f, s) : this._restoreCell(f);
|
|
5438
5438
|
});
|
|
5439
5439
|
});
|
|
5440
5440
|
}
|
|
@@ -5553,7 +5553,7 @@ class bt extends HTMLElement {
|
|
|
5553
5553
|
`, document.head.appendChild(t);
|
|
5554
5554
|
}
|
|
5555
5555
|
}
|
|
5556
|
-
customElements.get("mint-table") || customElements.define("mint-table",
|
|
5556
|
+
customElements.get("mint-table") || customElements.define("mint-table", _t);
|
|
5557
5557
|
class vt extends HTMLElement {
|
|
5558
5558
|
constructor() {
|
|
5559
5559
|
super(...arguments), this._root = null, this._textWrap = null, this._dismissBtn = null, this._clickHandler = null;
|
|
@@ -5571,7 +5571,7 @@ class vt extends HTMLElement {
|
|
|
5571
5571
|
this._render();
|
|
5572
5572
|
}
|
|
5573
5573
|
_render() {
|
|
5574
|
-
var
|
|
5574
|
+
var i;
|
|
5575
5575
|
if (this.classList.add(
|
|
5576
5576
|
"inline-flex",
|
|
5577
5577
|
"items-center",
|
|
@@ -5583,20 +5583,20 @@ class vt extends HTMLElement {
|
|
|
5583
5583
|
"border-gray-200",
|
|
5584
5584
|
"dark:border-gray-700",
|
|
5585
5585
|
"bg-gray-100",
|
|
5586
|
-
"dark:bg-gray-
|
|
5586
|
+
"dark:bg-gray-900",
|
|
5587
5587
|
"text-gray-900",
|
|
5588
5588
|
"dark:text-gray-100",
|
|
5589
5589
|
"text-sm",
|
|
5590
5590
|
"font-medium"
|
|
5591
5591
|
), !this._root) {
|
|
5592
5592
|
for (this._root = document.createElement("div"), this._root.className = "flex items-center gap-2 w-full", this._textWrap = document.createElement("span"), this._textWrap.className = "inline-flex items-center min-w-[0.5rem]", this._textWrap.setAttribute("data-mt-chip-text", ""); this.firstChild; ) {
|
|
5593
|
-
const
|
|
5594
|
-
if (
|
|
5595
|
-
this._textWrap.appendChild(
|
|
5593
|
+
const s = this.firstChild;
|
|
5594
|
+
if (s === this._root) break;
|
|
5595
|
+
this._textWrap.appendChild(s);
|
|
5596
5596
|
}
|
|
5597
5597
|
this._root.appendChild(this._textWrap), this.appendChild(this._root);
|
|
5598
5598
|
}
|
|
5599
|
-
this.
|
|
5599
|
+
this.getAttribute("dismissable") === "true" ? (this._dismissBtn || this._createDismissBtn(), this._dismissBtn && !this._dismissBtn.isConnected && ((i = this._root) == null || i.appendChild(this._dismissBtn))) : this._dismissBtn && this._dismissBtn.parentElement === this._root && this._dismissBtn.remove();
|
|
5600
5600
|
}
|
|
5601
5601
|
_createDismissBtn() {
|
|
5602
5602
|
const t = document.createElement("button");
|
|
@@ -5657,7 +5657,7 @@ class yt extends HTMLElement {
|
|
|
5657
5657
|
"border-2",
|
|
5658
5658
|
s ? "border-red-300 dark:border-red-300" : "border-gray-200 dark:border-gray-700",
|
|
5659
5659
|
"bg-white",
|
|
5660
|
-
"dark:bg-gray-
|
|
5660
|
+
"dark:bg-gray-900",
|
|
5661
5661
|
"focus-within:ring-2",
|
|
5662
5662
|
"focus-within:ring-offset-1",
|
|
5663
5663
|
s ? "focus-within:ring-red-400 dark:focus-within:ring-red-500" : "focus-within:ring-gray-400 dark:focus-within:ring-gray-500",
|
|
@@ -5703,7 +5703,7 @@ class yt extends HTMLElement {
|
|
|
5703
5703
|
return this.getAttribute("info") || "";
|
|
5704
5704
|
}
|
|
5705
5705
|
hasError() {
|
|
5706
|
-
return this.
|
|
5706
|
+
return this.getAttribute("error") === "true";
|
|
5707
5707
|
}
|
|
5708
5708
|
getErrorMessage() {
|
|
5709
5709
|
return this.getAttribute("error-message") || "";
|
|
@@ -5715,7 +5715,7 @@ class yt extends HTMLElement {
|
|
|
5715
5715
|
return this.getAttribute("id") || "";
|
|
5716
5716
|
}
|
|
5717
5717
|
isRequired() {
|
|
5718
|
-
return this.
|
|
5718
|
+
return this.getAttribute("required") === "true";
|
|
5719
5719
|
}
|
|
5720
5720
|
isLoading() {
|
|
5721
5721
|
return this.hasAttribute("loading");
|
|
@@ -5819,7 +5819,7 @@ class yt extends HTMLElement {
|
|
|
5819
5819
|
let t = 0;
|
|
5820
5820
|
this._tags.forEach((e) => {
|
|
5821
5821
|
const i = document.createElement("mint-chip");
|
|
5822
|
-
i.dataset.index = String(t++), i.dataset.value = e.value, i.draggable = this.hasAttribute("sortable"), i.draggable && i.classList.add("cursor-move"), e.dismissable && (i.setAttribute("dismissable", ""), i.addEventListener("dismissed", () => this._removeTag(e.value))), this._chipsWrap.appendChild(i);
|
|
5822
|
+
i.dataset.index = String(t++), i.dataset.value = e.value, i.draggable = this.hasAttribute("sortable"), i.draggable && i.classList.add("cursor-move"), e.dismissable && (i.setAttribute("dismissable", "true"), i.addEventListener("dismissed", () => this._removeTag(e.value))), this._chipsWrap.appendChild(i);
|
|
5823
5823
|
const s = i.querySelector("[data-mt-chip-text]");
|
|
5824
5824
|
s && (s.textContent = e.label || e.value), this._setupChipEvents(i, e), i.draggable && (i.addEventListener("dragstart", (n) => this._onDragStart(n, i)), i.addEventListener("dragover", (n) => this._onDragOverChip(n, i)), i.addEventListener("drop", (n) => this._onDrop(n)), i.addEventListener("dragend", () => this._onDragEnd())), this.hasAttribute("sortable") && i.addEventListener("pointerdown", (n) => this._onPointerDown(n, i));
|
|
5825
5825
|
}), this._input && (this.hasAttribute("sortable") && (this._input.addEventListener("dragover", (e) => this._onDragOverInput(e)), this._input.addEventListener("drop", (e) => this._onDrop(e)), this._input.addEventListener("dragend", () => this._onDragEnd())), this._chipsWrap.appendChild(this._input));
|
|
@@ -5974,18 +5974,18 @@ class kt extends HTMLElement {
|
|
|
5974
5974
|
"focus-visible:ring-gray-400",
|
|
5975
5975
|
"dark:focus-visible:ring-gray-500",
|
|
5976
5976
|
"rounded"
|
|
5977
|
-
), this.
|
|
5977
|
+
), this.getAttribute("disabled") === "true" ? this.classList.add("cursor-not-allowed", "opacity-50") : this.classList.add("cursor-pointer"), this.getAttribute("role") || this.setAttribute("role", "button"), this.getAttribute("tabindex") || this.setAttribute("tabindex", "0");
|
|
5978
5978
|
}
|
|
5979
5979
|
_setupEventListeners() {
|
|
5980
5980
|
this._clickHandler = (t) => {
|
|
5981
|
-
if (this.
|
|
5981
|
+
if (this.getAttribute("disabled") === "true") {
|
|
5982
5982
|
t.preventDefault(), t.stopPropagation();
|
|
5983
5983
|
return;
|
|
5984
5984
|
}
|
|
5985
5985
|
this._handleClick(t);
|
|
5986
5986
|
}, this._keydownHandler = (t) => {
|
|
5987
5987
|
if (t.key === "Enter" || t.key === " ") {
|
|
5988
|
-
if (this.
|
|
5988
|
+
if (this.getAttribute("disabled") === "true") {
|
|
5989
5989
|
t.preventDefault(), t.stopPropagation();
|
|
5990
5990
|
return;
|
|
5991
5991
|
}
|
|
@@ -6007,7 +6007,7 @@ class kt extends HTMLElement {
|
|
|
6007
6007
|
return ["disabled"];
|
|
6008
6008
|
}
|
|
6009
6009
|
attributeChangedCallback(t, e, i) {
|
|
6010
|
-
t === "disabled" && (i
|
|
6010
|
+
t === "disabled" && (i === "true" ? (this.classList.remove("cursor-pointer"), this.classList.add("opacity-50", "cursor-not-allowed"), this.setAttribute("aria-disabled", "true")) : (this.classList.remove("opacity-50", "cursor-not-allowed"), this.classList.add("cursor-pointer"), this.removeAttribute("aria-disabled")));
|
|
6011
6011
|
}
|
|
6012
6012
|
}
|
|
6013
6013
|
customElements.get("mint-clickable") || customElements.define("mint-clickable", kt);
|
|
@@ -6035,7 +6035,7 @@ class Et extends HTMLElement {
|
|
|
6035
6035
|
return t === "info" || t === "success" || t === "warning" || t === "danger" ? t : "info";
|
|
6036
6036
|
}
|
|
6037
6037
|
isDismissable() {
|
|
6038
|
-
return this.
|
|
6038
|
+
return this.getAttribute("dismissable") === "true";
|
|
6039
6039
|
}
|
|
6040
6040
|
getIconName() {
|
|
6041
6041
|
switch (this.getTone()) {
|
|
@@ -6121,7 +6121,7 @@ class Et extends HTMLElement {
|
|
|
6121
6121
|
})), this.remove();
|
|
6122
6122
|
}, this._dismissButton.addEventListener("click", this._dismissHandler), this._headerWrapper.appendChild(this._dismissButton);
|
|
6123
6123
|
}
|
|
6124
|
-
this._bodyWrapper = document.createElement("div"), this._bodyWrapper.className = "px-4 py-3 bg-white dark:bg-gray-
|
|
6124
|
+
this._bodyWrapper = document.createElement("div"), this._bodyWrapper.className = "px-4 py-3 bg-white dark:bg-gray-900", n.forEach((r) => {
|
|
6125
6125
|
this._bodyWrapper.appendChild(r);
|
|
6126
6126
|
}), this.appendChild(this._headerWrapper), this.appendChild(this._bodyWrapper);
|
|
6127
6127
|
}
|
|
@@ -6210,7 +6210,7 @@ class xt extends HTMLElement {
|
|
|
6210
6210
|
}), this._configuration.sortBy || (this._configuration.sortBy = "id"), this._configuration.sort || (this._configuration.sort = "asc"));
|
|
6211
6211
|
}
|
|
6212
6212
|
async _fetchData(t, e = !0, i, s) {
|
|
6213
|
-
var o, l, c, h, p, d,
|
|
6213
|
+
var o, l, c, h, p, d, f, u;
|
|
6214
6214
|
if (!this._configuration) return;
|
|
6215
6215
|
const n = t || (typeof this._configuration.data == "string" ? this._configuration.data : null);
|
|
6216
6216
|
if (!n || this._fetching || this._loading)
|
|
@@ -6218,7 +6218,7 @@ class xt extends HTMLElement {
|
|
|
6218
6218
|
e && (this._fetching = !0, this.render()), this._loading = !0;
|
|
6219
6219
|
const r = i || this._perPage, a = s !== void 0 ? s : this._offset;
|
|
6220
6220
|
try {
|
|
6221
|
-
const
|
|
6221
|
+
const m = new URLSearchParams({
|
|
6222
6222
|
perPage: r.toString(),
|
|
6223
6223
|
offset: a.toString(),
|
|
6224
6224
|
search: this._search,
|
|
@@ -6226,12 +6226,12 @@ class xt extends HTMLElement {
|
|
|
6226
6226
|
sort: this._configuration.sort || "asc",
|
|
6227
6227
|
searchColumns: this._searchColumns.join(","),
|
|
6228
6228
|
columns: this._columns.join(",")
|
|
6229
|
-
}),
|
|
6230
|
-
this._configuration.headers && (
|
|
6231
|
-
const
|
|
6232
|
-
if (!
|
|
6233
|
-
throw new Error(`HTTP error! status: ${
|
|
6234
|
-
const
|
|
6229
|
+
}), g = {};
|
|
6230
|
+
this._configuration.headers && (g.headers = this._configuration.headers);
|
|
6231
|
+
const b = await fetch(`${n}?${m.toString()}`, g);
|
|
6232
|
+
if (!b.ok)
|
|
6233
|
+
throw new Error(`HTTP error! status: ${b.status}`);
|
|
6234
|
+
const _ = await b.json(), v = ((o = _.content) == null ? void 0 : o.rows) || [], k = ((l = _.content) == null ? void 0 : l.total) || 0;
|
|
6235
6235
|
if (this._configuration.loadMore && a !== 0)
|
|
6236
6236
|
this._rows = this._rows.concat(v);
|
|
6237
6237
|
else {
|
|
@@ -6239,19 +6239,19 @@ class xt extends HTMLElement {
|
|
|
6239
6239
|
this._configuration.predefinedData ? (x = [...this._configuration.predefinedData, ...v], this._totalRows = k + this._configuration.predefinedData.length) : this._totalRows = k, this._rows = x;
|
|
6240
6240
|
}
|
|
6241
6241
|
const A = Math.floor(a / r) + 1;
|
|
6242
|
-
this._configuration.loadMore || (((c =
|
|
6242
|
+
this._configuration.loadMore || (((c = _.content) == null ? void 0 : c.current_page) !== void 0 && _.content.current_page === A ? this._currentPage = _.content.current_page : this._currentPage = A, this._offset = (this._currentPage - 1) * r), this._lastPage = ((h = _.content) == null ? void 0 : h.last_page) || 1, this._fetching = !1, this._loaded = !0, this._loading = !1, this._fetchError = null, this._searching = !1;
|
|
6243
6243
|
const E = this._sorting;
|
|
6244
6244
|
if (E && this._updateSortIcons(), this._sorting = !1, this._sortingColumn = null, E && this._updateSortIcons(), this.dispatchEvent(new CustomEvent("loaded", { detail: { rows: this._rows } })), this._updateSearchIcon(), (d = (p = this.querySelector(`#${this._tableId}`)) == null ? void 0 : p.closest("table")) == null ? void 0 : d.querySelector("tbody")) {
|
|
6245
6245
|
if (E) {
|
|
6246
|
-
const x = this._loading,
|
|
6247
|
-
this._loading = !1, this._fetching = !1, this._updateTableBody(), this._loading = x, this._fetching =
|
|
6246
|
+
const x = this._loading, I = this._fetching;
|
|
6247
|
+
this._loading = !1, this._fetching = !1, this._updateTableBody(), this._loading = x, this._fetching = I;
|
|
6248
6248
|
} else
|
|
6249
6249
|
this._updateTableBody();
|
|
6250
6250
|
this._updatePagination();
|
|
6251
6251
|
} else
|
|
6252
6252
|
this.render();
|
|
6253
|
-
} catch (
|
|
6254
|
-
this._fetching = !1, this._loading = !1, this._loaded = !0, this._searching = !1, this._fetchError =
|
|
6253
|
+
} catch (m) {
|
|
6254
|
+
this._fetching = !1, this._loading = !1, this._loaded = !0, this._searching = !1, this._fetchError = m instanceof Error ? m.message : "Failed to fetch data", console.error("mint-resource-table: Error fetching data", m), this._updateSearchIcon(), ((u = (f = this.querySelector(`#${this._tableId}`)) == null ? void 0 : f.closest("table")) == null ? void 0 : u.querySelector("tbody")) ? (this._updateTableBody(), this._updatePagination()) : this.render();
|
|
6255
6255
|
}
|
|
6256
6256
|
}
|
|
6257
6257
|
_getRows() {
|
|
@@ -6375,49 +6375,49 @@ class xt extends HTMLElement {
|
|
|
6375
6375
|
let r = "";
|
|
6376
6376
|
if (!((this._fetching || this._loading) && !this._sorting) && (t.forEach((l, c) => {
|
|
6377
6377
|
const h = typeof this._configuration.onRowClick == "function", p = h ? "cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors" : "";
|
|
6378
|
-
r += `<tr data-row-index="${c}" ${h ? 'data-row-clickable="true"' : ""}${p ? ` class="${p}"` : ""}>`, this._configuration.columns.forEach((d,
|
|
6378
|
+
r += `<tr data-row-index="${c}" ${h ? 'data-row-clickable="true"' : ""}${p ? ` class="${p}"` : ""}>`, this._configuration.columns.forEach((d, f) => {
|
|
6379
6379
|
if (d.hidden) return;
|
|
6380
|
-
const
|
|
6381
|
-
if (r += `<td style="${this._getStyle(d)}" class="${this._getClasses(d, !0)}">`,
|
|
6380
|
+
const u = !d.show || d.show(this, l);
|
|
6381
|
+
if (r += `<td style="${this._getStyle(d)}" class="${this._getClasses(d, !0)}">`, u)
|
|
6382
6382
|
if (d.raw)
|
|
6383
6383
|
if (d.action)
|
|
6384
6384
|
(!d.action.show || d.action.show(this, l)) && (r += `<mint-button variant="solid" data-action="column-action" data-row-index="${c}" data-column-key="${this._configuration.columns.indexOf(d)}">${d.action.label}</mint-button>`);
|
|
6385
6385
|
else if (d.actions)
|
|
6386
6386
|
if (d.actionStyle !== "buttons") {
|
|
6387
|
-
const
|
|
6388
|
-
r += `<mint-button id="${
|
|
6389
|
-
if (!
|
|
6390
|
-
const v = typeof
|
|
6391
|
-
r += `<div class="p-2 cursor-pointer hover:bg-gray-100 dark:hover:bg-gray-700" data-action="row-action" data-row-index="${c}" data-action-index="${
|
|
6387
|
+
const m = `actions-popover-${this._tableId}-${c}`, g = `actions-button-${this._tableId}-${c}`;
|
|
6388
|
+
r += `<mint-button id="${g}" variant="link" icon="ellipsis">`, r += "</mint-button>", r += `<mint-popover id="${m}" trigger-id="${g}" direction="down">`, d.actions.forEach((b, _) => {
|
|
6389
|
+
if (!b.show || b.show(this, l)) {
|
|
6390
|
+
const v = typeof b.label == "function" ? b.label(this, l) : b.label;
|
|
6391
|
+
r += `<div class="p-2 cursor-pointer hover:bg-gray-100 dark:hover:bg-gray-700" data-action="row-action" data-row-index="${c}" data-action-index="${_}" data-column-key="${this._configuration.columns.indexOf(d)}">${v}</div>`;
|
|
6392
6392
|
}
|
|
6393
6393
|
}), r += "</mint-popover>";
|
|
6394
6394
|
} else
|
|
6395
|
-
d.actions.forEach((
|
|
6396
|
-
if (!
|
|
6397
|
-
const
|
|
6398
|
-
r += `<mint-button variant="link" class="${
|
|
6395
|
+
d.actions.forEach((m, g) => {
|
|
6396
|
+
if (!m.show || m.show(this, l)) {
|
|
6397
|
+
const b = m.label ? typeof m.label == "function" ? m.label(this, l) : m.label : "", _ = m.icon ? ` icon="${this._escapeHtml(m.icon)}"` : "", v = m.tone ? ` tone="${this._escapeHtml(m.tone)}"` : "";
|
|
6398
|
+
r += `<mint-button variant="link" class="${m.classes || ""}" data-action="row-action" data-row-index="${c}" data-action-index="${g}" data-column-key="${this._configuration.columns.indexOf(d)}"${_}${v}>`, b && (r += this._escapeHtml(String(b))), r += "</mint-button>";
|
|
6399
6399
|
}
|
|
6400
6400
|
});
|
|
6401
6401
|
else typeof d.format == "function" ? r += d.format(this, l) : d.data && (r += this._escapeHtml(String(l[d.data] || "")));
|
|
6402
6402
|
else if (d.action) {
|
|
6403
6403
|
if (!d.action.show || d.action.show(this, l)) {
|
|
6404
|
-
const
|
|
6405
|
-
r += `<mint-button variant="solid" data-action="column-action" data-row-index="${c}" data-column-key="${this._configuration.columns.indexOf(d)}">${this._escapeHtml(String(
|
|
6404
|
+
const m = typeof d.action.label == "function" ? d.action.label(this, l) : d.action.label;
|
|
6405
|
+
r += `<mint-button variant="solid" data-action="column-action" data-row-index="${c}" data-column-key="${this._configuration.columns.indexOf(d)}">${this._escapeHtml(String(m))}</mint-button>`;
|
|
6406
6406
|
}
|
|
6407
6407
|
} else if (d.actions)
|
|
6408
6408
|
if (d.actionStyle !== "buttons") {
|
|
6409
|
-
const
|
|
6410
|
-
r += `<mint-button id="${
|
|
6411
|
-
if (!
|
|
6412
|
-
const v = typeof
|
|
6413
|
-
r += `<div class="p-2 cursor-pointer hover:bg-gray-100 dark:hover:bg-gray-700" data-action="row-action" data-row-index="${c}" data-action-index="${
|
|
6409
|
+
const m = `actions-popover-${this._tableId}-${c}`, g = `actions-button-${this._tableId}-${c}`;
|
|
6410
|
+
r += `<mint-button id="${g}" variant="link" icon="ellipsis">`, r += "</mint-button>", r += `<mint-popover id="${m}" trigger-id="${g}" direction="down">`, d.actions.forEach((b, _) => {
|
|
6411
|
+
if (!b.show || b.show(this, l)) {
|
|
6412
|
+
const v = typeof b.label == "function" ? b.label(this, l) : b.label;
|
|
6413
|
+
r += `<div class="p-2 cursor-pointer hover:bg-gray-100 dark:hover:bg-gray-700" data-action="row-action" data-row-index="${c}" data-action-index="${_}" data-column-key="${this._configuration.columns.indexOf(d)}">${v}</div>`;
|
|
6414
6414
|
}
|
|
6415
6415
|
}), r += "</mint-popover>";
|
|
6416
6416
|
} else
|
|
6417
|
-
d.actions.forEach((
|
|
6418
|
-
if (!
|
|
6419
|
-
const
|
|
6420
|
-
r += `<mint-button variant="link" class="${
|
|
6417
|
+
d.actions.forEach((m, g) => {
|
|
6418
|
+
if (!m.show || m.show(this, l)) {
|
|
6419
|
+
const b = m.label ? typeof m.label == "function" ? m.label(this, l) : m.label : "", _ = m.icon ? ` icon="${this._escapeHtml(m.icon)}"` : "", v = m.tone ? ` tone="${this._escapeHtml(m.tone)}"` : "";
|
|
6420
|
+
r += `<mint-button variant="link" class="${m.classes || ""}" data-action="row-action" data-row-index="${c}" data-action-index="${g}" data-column-key="${this._configuration.columns.indexOf(d)}"${_}${v}>`, b && (r += this._escapeHtml(String(b))), r += "</mint-button>";
|
|
6421
6421
|
}
|
|
6422
6422
|
});
|
|
6423
6423
|
else typeof d.format == "function" ? r += this._escapeHtml(d.format(this, l)) : d.data && (r += this._escapeHtml(String(l[d.data] || "")));
|
|
@@ -6604,18 +6604,18 @@ class xt extends HTMLElement {
|
|
|
6604
6604
|
}
|
|
6605
6605
|
} else if (c.actions)
|
|
6606
6606
|
if (c.actionStyle !== "buttons") {
|
|
6607
|
-
const d = `actions-popover-${this._tableId}-${a}`,
|
|
6608
|
-
s += `<mint-button id="${
|
|
6609
|
-
if (!
|
|
6610
|
-
const
|
|
6611
|
-
s += `<div class="p-2 cursor-pointer hover:bg-gray-100 dark:hover:bg-gray-700" data-action="row-action" data-row-index="${a}" data-action-index="${
|
|
6607
|
+
const d = `actions-popover-${this._tableId}-${a}`, f = `actions-button-${this._tableId}-${a}`;
|
|
6608
|
+
s += `<mint-button id="${f}" variant="link" icon="ellipsis">`, s += "</mint-button>", s += `<mint-popover id="${d}" trigger-id="${f}" direction="down">`, c.actions.forEach((u, m) => {
|
|
6609
|
+
if (!u.show || u.show(this, r)) {
|
|
6610
|
+
const g = typeof u.label == "function" ? u.label(this, r) : u.label;
|
|
6611
|
+
s += `<div class="p-2 cursor-pointer hover:bg-gray-100 dark:hover:bg-gray-700" data-action="row-action" data-row-index="${a}" data-action-index="${m}" data-column-key="${this._configuration.columns.indexOf(c)}">${this._escapeHtml(String(g))}</div>`;
|
|
6612
6612
|
}
|
|
6613
6613
|
}), s += "</mint-popover>";
|
|
6614
6614
|
} else
|
|
6615
|
-
c.actions.forEach((d,
|
|
6615
|
+
c.actions.forEach((d, f) => {
|
|
6616
6616
|
if (!d.show || d.show(this, r)) {
|
|
6617
|
-
const
|
|
6618
|
-
s += `<mint-button variant="link" class="${d.classes || ""}" data-action="row-action" data-row-index="${a}" data-action-index="${
|
|
6617
|
+
const u = d.label ? typeof d.label == "function" ? d.label(this, r) : d.label : "", m = d.icon ? ` icon="${this._escapeHtml(d.icon)}"` : "", g = d.tone ? ` tone="${this._escapeHtml(d.tone)}"` : "";
|
|
6618
|
+
s += `<mint-button variant="link" class="${d.classes || ""}" data-action="row-action" data-row-index="${a}" data-action-index="${f}" data-column-key="${this._configuration.columns.indexOf(c)}"${m}${g}>`, u && (s += this._escapeHtml(String(u))), s += "</mint-button>";
|
|
6619
6619
|
}
|
|
6620
6620
|
});
|
|
6621
6621
|
else typeof c.format == "function" ? s += c.format(this, r) : c.data && (s += this._escapeHtml(String(r[c.data] || "")));
|
|
@@ -6623,18 +6623,18 @@ class xt extends HTMLElement {
|
|
|
6623
6623
|
(!c.action.show || c.action.show(this, r)) && (s += `<mint-button variant="solid" data-action="column-action" data-row-index="${a}" data-column-key="${this._configuration.columns.indexOf(c)}">${c.action.label}</mint-button>`);
|
|
6624
6624
|
else if (c.actions)
|
|
6625
6625
|
if (c.actionStyle !== "buttons") {
|
|
6626
|
-
const d = `actions-popover-${this._tableId}-${a}`,
|
|
6627
|
-
s += `<mint-button id="${
|
|
6628
|
-
if (!
|
|
6629
|
-
const
|
|
6630
|
-
s += `<div class="p-2 cursor-pointer hover:bg-gray-100 dark:hover:bg-gray-700" data-action="row-action" data-row-index="${a}" data-action-index="${
|
|
6626
|
+
const d = `actions-popover-${this._tableId}-${a}`, f = `actions-button-${this._tableId}-${a}`;
|
|
6627
|
+
s += `<mint-button id="${f}" variant="link" icon="ellipsis">`, s += "</mint-button>", s += `<mint-popover id="${d}" trigger-id="${f}" direction="down">`, c.actions.forEach((u, m) => {
|
|
6628
|
+
if (!u.show || u.show(this, r)) {
|
|
6629
|
+
const g = typeof u.label == "function" ? u.label(this, r) : u.label;
|
|
6630
|
+
s += `<div class="p-2 cursor-pointer hover:bg-gray-100 dark:hover:bg-gray-700" data-action="row-action" data-row-index="${a}" data-action-index="${m}" data-column-key="${this._configuration.columns.indexOf(c)}">${this._escapeHtml(String(g))}</div>`;
|
|
6631
6631
|
}
|
|
6632
6632
|
}), s += "</mint-popover>";
|
|
6633
6633
|
} else
|
|
6634
|
-
c.actions.forEach((d,
|
|
6634
|
+
c.actions.forEach((d, f) => {
|
|
6635
6635
|
if (!d.show || d.show(this, r)) {
|
|
6636
|
-
const
|
|
6637
|
-
s += `<mint-button variant="link" class="${d.classes || ""}" data-action="row-action" data-row-index="${a}" data-action-index="${
|
|
6636
|
+
const u = d.label ? typeof d.label == "function" ? d.label(this, r) : d.label : "", m = d.icon ? ` icon="${this._escapeHtml(d.icon)}"` : "", g = d.tone ? ` tone="${this._escapeHtml(d.tone)}"` : "";
|
|
6637
|
+
s += `<mint-button variant="link" class="${d.classes || ""}" data-action="row-action" data-row-index="${a}" data-action-index="${f}" data-column-key="${this._configuration.columns.indexOf(c)}"${m}${g}>`, u && (s += this._escapeHtml(String(u))), s += "</mint-button>";
|
|
6638
6638
|
}
|
|
6639
6639
|
});
|
|
6640
6640
|
else typeof c.format == "function" ? s += this._escapeHtml(c.format(this, r)) : c.data && (s += this._escapeHtml(String(r[c.data] || "")));
|
|
@@ -6763,12 +6763,12 @@ class xt extends HTMLElement {
|
|
|
6763
6763
|
}
|
|
6764
6764
|
}
|
|
6765
6765
|
customElements.get("mint-resource-table") || customElements.define("mint-resource-table", xt);
|
|
6766
|
-
class
|
|
6766
|
+
class Ct extends HTMLElement {
|
|
6767
6767
|
constructor() {
|
|
6768
6768
|
super(), this._overlay = null, this._offCanvas = null, this._header = null, this._headingSlot = null, this._bodySlot = null, this._actionsSlot = null, this._closeButton = null, this._darkModeObserver = null;
|
|
6769
6769
|
}
|
|
6770
6770
|
static get observedAttributes() {
|
|
6771
|
-
return ["id", "heading", "open", "position", "full-page"];
|
|
6771
|
+
return ["id", "heading", "open", "position", "full-page", "width"];
|
|
6772
6772
|
}
|
|
6773
6773
|
connectedCallback() {
|
|
6774
6774
|
this.classList.add("box-border", "m-0", "p-0", "border-0", "align-baseline", "fixed", "inset-0", "z-50"), this.isOpen() || this.classList.add("hidden"), this.render(), this._observeDarkMode();
|
|
@@ -6791,13 +6791,16 @@ class wt extends HTMLElement {
|
|
|
6791
6791
|
return t === "top" || t === "bottom" || t === "left" || t === "right" ? t : "right";
|
|
6792
6792
|
}
|
|
6793
6793
|
isFullPage() {
|
|
6794
|
-
return this.
|
|
6794
|
+
return this.getAttribute("full-page") === "true";
|
|
6795
|
+
}
|
|
6796
|
+
getWidth() {
|
|
6797
|
+
return this.getAttribute("width") || "w-80";
|
|
6795
6798
|
}
|
|
6796
6799
|
isOpen() {
|
|
6797
|
-
return this.
|
|
6800
|
+
return this.getAttribute("open") === "true";
|
|
6798
6801
|
}
|
|
6799
6802
|
open() {
|
|
6800
|
-
this.setAttribute("open", "");
|
|
6803
|
+
this.setAttribute("open", "true");
|
|
6801
6804
|
}
|
|
6802
6805
|
close() {
|
|
6803
6806
|
this.removeAttribute("open");
|
|
@@ -6808,9 +6811,17 @@ class wt extends HTMLElement {
|
|
|
6808
6811
|
const r = this._getPositionClasses(s, n);
|
|
6809
6812
|
this._offCanvas.className = r;
|
|
6810
6813
|
let a = this._offCanvas.querySelector(".off-canvas-content");
|
|
6811
|
-
a || (a = document.createElement("div"), a.className = "off-canvas-content bg-white dark:bg-gray-
|
|
6812
|
-
|
|
6813
|
-
|
|
6814
|
+
if (a || (a = document.createElement("div"), a.className = "off-canvas-content bg-white dark:bg-gray-900 dark:border dark:border-gray-700 shadow-xl flex flex-col pointer-events-auto transition-all duration-300 ease-out", a.style.transform = this._getTransformValue(s, !1), this._offCanvas.appendChild(a)), i ? this._animateEnter() : this._animateExit(), Array.from(a.classList).forEach((u) => {
|
|
6815
|
+
(u.startsWith("w-") || u.startsWith("max-w-")) && a.classList.remove(u);
|
|
6816
|
+
}), a.classList.remove("h-full", "max-h-[90vh]", "max-h-screen"), n)
|
|
6817
|
+
a.classList.add("w-full", "h-full");
|
|
6818
|
+
else {
|
|
6819
|
+
const u = this.getWidth();
|
|
6820
|
+
s === "top" || s === "bottom" ? a.classList.add("w-full", "max-h-[90vh]") : a.classList.add(u, "h-full");
|
|
6821
|
+
}
|
|
6822
|
+
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 flex-shrink-0", a.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));
|
|
6823
|
+
let l = this._headingSlot.querySelector("mint-text");
|
|
6824
|
+
e ? (l || (l = document.createElement("mint-text"), l.setAttribute("size", "sub-heading"), l.setAttribute("bold", "true"), this._headingSlot.appendChild(l)), l.textContent = e) : l && l.remove(), Array.from(this.children).filter(
|
|
6814
6825
|
(u) => u !== this._overlay && u !== this._offCanvas && u !== this._headingSlot && u.getAttribute("slot") === "heading"
|
|
6815
6826
|
).forEach((u) => {
|
|
6816
6827
|
this._headingSlot && u.parentElement !== this._headingSlot && this._headingSlot.appendChild(u);
|
|
@@ -6819,12 +6830,12 @@ class wt extends HTMLElement {
|
|
|
6819
6830
|
).forEach((u) => {
|
|
6820
6831
|
this._bodySlot && u.parentElement !== this._bodySlot && this._bodySlot.appendChild(u);
|
|
6821
6832
|
}), this._actionsSlot || (this._actionsSlot = document.createElement("div"), this._actionsSlot.className = "p-4 border-t border-gray-200 dark:border-gray-700 flex-shrink-0", this._actionsSlot.setAttribute("slot", "actions"), a.appendChild(this._actionsSlot));
|
|
6822
|
-
let
|
|
6823
|
-
|
|
6833
|
+
let p = this._actionsSlot.querySelector("mint-stack");
|
|
6834
|
+
p || (p = document.createElement("mint-stack"), p.setAttribute("direction", "horizontal"), p.className = "justify-end", this._actionsSlot.appendChild(p)), Array.from(this.children).filter(
|
|
6824
6835
|
(u) => u !== this._overlay && u !== this._offCanvas && u !== this._actionsSlot && u.getAttribute("slot") === "actions"
|
|
6825
6836
|
).forEach((u) => {
|
|
6826
|
-
Array.from(u.children).forEach((
|
|
6827
|
-
|
|
6837
|
+
Array.from(u.children).forEach((g) => {
|
|
6838
|
+
g.parentElement !== p && p.appendChild(g);
|
|
6828
6839
|
}), u.parentElement && u.remove();
|
|
6829
6840
|
}), Array.from(this.children).forEach((u) => {
|
|
6830
6841
|
u !== this._overlay && u !== this._offCanvas && u.getAttribute("slot") !== "heading" && u.getAttribute("slot") !== "body" && u.getAttribute("slot") !== "actions" && u !== this._headingSlot && u !== this._bodySlot && u !== this._actionsSlot && u.parentElement !== this._bodySlot && this._bodySlot.appendChild(u);
|
|
@@ -6876,7 +6887,7 @@ class wt extends HTMLElement {
|
|
|
6876
6887
|
_updateBackgroundColor() {
|
|
6877
6888
|
if (!this._offCanvas) return;
|
|
6878
6889
|
const t = document.documentElement.classList.contains("dark"), e = this._offCanvas.querySelector(".off-canvas-content");
|
|
6879
|
-
e && (t ? (e.classList.remove("bg-white"), e.classList.add("bg-gray-
|
|
6890
|
+
e && (t ? (e.classList.remove("bg-white"), e.classList.add("bg-gray-900", "border", "border-gray-700")) : (e.classList.remove("bg-gray-900", "border", "border-gray-700"), e.classList.add("bg-white")));
|
|
6880
6891
|
}
|
|
6881
6892
|
_observeDarkMode() {
|
|
6882
6893
|
this._darkModeObserver || (this._darkModeObserver = new MutationObserver(() => {
|
|
@@ -6910,7 +6921,294 @@ class wt extends HTMLElement {
|
|
|
6910
6921
|
}, 300);
|
|
6911
6922
|
}
|
|
6912
6923
|
}
|
|
6913
|
-
customElements.get("mint-off-canvas") || customElements.define("mint-off-canvas",
|
|
6924
|
+
customElements.get("mint-off-canvas") || customElements.define("mint-off-canvas", Ct);
|
|
6925
|
+
class wt extends HTMLElement {
|
|
6926
|
+
constructor() {
|
|
6927
|
+
super(), this._clickHandler = null;
|
|
6928
|
+
}
|
|
6929
|
+
static get observedAttributes() {
|
|
6930
|
+
return ["active", "disabled", "target"];
|
|
6931
|
+
}
|
|
6932
|
+
connectedCallback() {
|
|
6933
|
+
this.render(), this.setupEventListeners();
|
|
6934
|
+
}
|
|
6935
|
+
disconnectedCallback() {
|
|
6936
|
+
this.removeEventListeners();
|
|
6937
|
+
}
|
|
6938
|
+
attributeChangedCallback(t, e, i) {
|
|
6939
|
+
e !== i && this.render();
|
|
6940
|
+
}
|
|
6941
|
+
getTarget() {
|
|
6942
|
+
return this.getAttribute("target") || "";
|
|
6943
|
+
}
|
|
6944
|
+
isActive() {
|
|
6945
|
+
const t = this.getAttribute("active");
|
|
6946
|
+
return t !== null && t !== "false";
|
|
6947
|
+
}
|
|
6948
|
+
isDisabled() {
|
|
6949
|
+
return this.getAttribute("disabled") === "true";
|
|
6950
|
+
}
|
|
6951
|
+
get active() {
|
|
6952
|
+
return this.isActive();
|
|
6953
|
+
}
|
|
6954
|
+
set active(t) {
|
|
6955
|
+
t ? this.setAttribute("active", "true") : this.setAttribute("active", "false");
|
|
6956
|
+
}
|
|
6957
|
+
render() {
|
|
6958
|
+
const t = this.isActive(), e = this.isDisabled();
|
|
6959
|
+
this.className = "", this.classList.add(
|
|
6960
|
+
"box-border",
|
|
6961
|
+
"m-0",
|
|
6962
|
+
"p-0",
|
|
6963
|
+
"border-0",
|
|
6964
|
+
"inline-block",
|
|
6965
|
+
"cursor-pointer",
|
|
6966
|
+
"px-4",
|
|
6967
|
+
"py-1.5",
|
|
6968
|
+
"text-sm",
|
|
6969
|
+
"font-medium",
|
|
6970
|
+
"transition-all",
|
|
6971
|
+
"duration-200",
|
|
6972
|
+
"rounded-lg",
|
|
6973
|
+
"border",
|
|
6974
|
+
"text-gray-700",
|
|
6975
|
+
"dark:text-gray-300"
|
|
6976
|
+
);
|
|
6977
|
+
const i = this.closest("mint-tab-list"), s = (i == null ? void 0 : i.getAttribute("position")) || "top", n = s === "left" || s === "right";
|
|
6978
|
+
e ? (this.classList.add(
|
|
6979
|
+
"opacity-60",
|
|
6980
|
+
"cursor-not-allowed",
|
|
6981
|
+
"pointer-events-none",
|
|
6982
|
+
"bg-gray-50",
|
|
6983
|
+
"dark:bg-gray-900",
|
|
6984
|
+
"border-gray-300",
|
|
6985
|
+
"dark:border-gray-700",
|
|
6986
|
+
"text-gray-400",
|
|
6987
|
+
"dark:text-gray-500"
|
|
6988
|
+
), this.classList.remove("cursor-pointer")) : t ? (this.classList.add(
|
|
6989
|
+
"bg-white",
|
|
6990
|
+
"dark:bg-gray-900",
|
|
6991
|
+
"border-gray-200",
|
|
6992
|
+
"dark:border-gray-700",
|
|
6993
|
+
"text-gray-900",
|
|
6994
|
+
"dark:text-gray-100",
|
|
6995
|
+
"shadow-sm",
|
|
6996
|
+
"relative",
|
|
6997
|
+
"z-10"
|
|
6998
|
+
), n ? s === "left" ? this.classList.add("mr-[-1px]") : this.classList.add("ml-[-1px]") : this.classList.add("mb-[-1px]")) : this.classList.add(
|
|
6999
|
+
"bg-gray-100",
|
|
7000
|
+
"dark:bg-gray-900",
|
|
7001
|
+
"border-gray-200",
|
|
7002
|
+
"dark:border-gray-700",
|
|
7003
|
+
"text-gray-600",
|
|
7004
|
+
"dark:text-gray-400",
|
|
7005
|
+
"hover:bg-gray-50",
|
|
7006
|
+
"dark:hover:bg-gray-600"
|
|
7007
|
+
);
|
|
7008
|
+
}
|
|
7009
|
+
setupEventListeners() {
|
|
7010
|
+
this.isDisabled() || this._clickHandler || (this._clickHandler = this.handleClick.bind(this), this.addEventListener("click", this._clickHandler));
|
|
7011
|
+
}
|
|
7012
|
+
removeEventListeners() {
|
|
7013
|
+
this._clickHandler && (this.removeEventListener("click", this._clickHandler), this._clickHandler = null);
|
|
7014
|
+
}
|
|
7015
|
+
handleClick(t) {
|
|
7016
|
+
if (this.isDisabled()) {
|
|
7017
|
+
t.preventDefault(), t.stopPropagation();
|
|
7018
|
+
return;
|
|
7019
|
+
}
|
|
7020
|
+
t.__mintTabsSynthetic || (t.stopPropagation(), this.dispatchEvent(
|
|
7021
|
+
new CustomEvent("tab-click", {
|
|
7022
|
+
detail: { tab: this, target: this.getTarget() },
|
|
7023
|
+
bubbles: !0,
|
|
7024
|
+
cancelable: !0,
|
|
7025
|
+
composed: !0
|
|
7026
|
+
})
|
|
7027
|
+
));
|
|
7028
|
+
}
|
|
7029
|
+
}
|
|
7030
|
+
customElements.get("mint-tab") || customElements.define("mint-tab", wt);
|
|
7031
|
+
class At extends HTMLElement {
|
|
7032
|
+
static get observedAttributes() {
|
|
7033
|
+
return ["position"];
|
|
7034
|
+
}
|
|
7035
|
+
constructor() {
|
|
7036
|
+
super();
|
|
7037
|
+
}
|
|
7038
|
+
connectedCallback() {
|
|
7039
|
+
this.render();
|
|
7040
|
+
}
|
|
7041
|
+
attributeChangedCallback(t, e, i) {
|
|
7042
|
+
e !== i && this.render();
|
|
7043
|
+
}
|
|
7044
|
+
getPosition() {
|
|
7045
|
+
return this.getAttribute("position") || "top";
|
|
7046
|
+
}
|
|
7047
|
+
render() {
|
|
7048
|
+
const t = this.getPosition();
|
|
7049
|
+
this.classList.remove(
|
|
7050
|
+
"flex",
|
|
7051
|
+
"inline-flex",
|
|
7052
|
+
"flex-row",
|
|
7053
|
+
"flex-col",
|
|
7054
|
+
"gap-1",
|
|
7055
|
+
"gap-2",
|
|
7056
|
+
"pb-0",
|
|
7057
|
+
"pr-0",
|
|
7058
|
+
"pl-0",
|
|
7059
|
+
"mb-0",
|
|
7060
|
+
"mr-0",
|
|
7061
|
+
"ml-0",
|
|
7062
|
+
"self-start"
|
|
7063
|
+
), this.classList.add("box-border", "m-0", "p-1", "border", "bg-gray-100", "dark:bg-gray-900", "dark:border-gray-700", "border-gray-200", "w-auto", "rounded-lg", "gap-2"), t === "top" ? this.classList.add(
|
|
7064
|
+
"inline-flex",
|
|
7065
|
+
"flex-row",
|
|
7066
|
+
"mb-0",
|
|
7067
|
+
"self-start"
|
|
7068
|
+
) : t === "left" ? this.classList.add(
|
|
7069
|
+
"flex",
|
|
7070
|
+
"flex-col",
|
|
7071
|
+
"mr-0"
|
|
7072
|
+
) : t === "right" && this.classList.add(
|
|
7073
|
+
"flex",
|
|
7074
|
+
"flex-col",
|
|
7075
|
+
"ml-0"
|
|
7076
|
+
);
|
|
7077
|
+
}
|
|
7078
|
+
}
|
|
7079
|
+
customElements.get("mint-tab-list") || customElements.define("mint-tab-list", At);
|
|
7080
|
+
class St extends HTMLElement {
|
|
7081
|
+
static get observedAttributes() {
|
|
7082
|
+
return ["id"];
|
|
7083
|
+
}
|
|
7084
|
+
constructor() {
|
|
7085
|
+
super();
|
|
7086
|
+
}
|
|
7087
|
+
connectedCallback() {
|
|
7088
|
+
this.classList.add("box-border", "m-0", "p-0", "border-0", "block", "w-full"), this.render(), this.checkInitialVisibility();
|
|
7089
|
+
}
|
|
7090
|
+
attributeChangedCallback(t, e, i) {
|
|
7091
|
+
e !== i && t === "id" && (this.render(), this.checkInitialVisibility());
|
|
7092
|
+
}
|
|
7093
|
+
getId() {
|
|
7094
|
+
return this.getAttribute("id") || "";
|
|
7095
|
+
}
|
|
7096
|
+
show() {
|
|
7097
|
+
this.style.display = "block";
|
|
7098
|
+
}
|
|
7099
|
+
hide() {
|
|
7100
|
+
this.style.display = "none";
|
|
7101
|
+
}
|
|
7102
|
+
checkInitialVisibility() {
|
|
7103
|
+
const t = this.closest("mint-tabs");
|
|
7104
|
+
if (!t) {
|
|
7105
|
+
this.style.display = "none";
|
|
7106
|
+
return;
|
|
7107
|
+
}
|
|
7108
|
+
const e = t.querySelectorAll("mint-tab");
|
|
7109
|
+
let i = !1;
|
|
7110
|
+
if (e.forEach((s) => {
|
|
7111
|
+
const n = s.getAttribute("active"), r = s.getAttribute("target"), a = this.getId();
|
|
7112
|
+
n === "true" && r === a && (i = !0);
|
|
7113
|
+
}), !i && e.length > 0) {
|
|
7114
|
+
const n = e[0].getAttribute("target"), r = this.getId();
|
|
7115
|
+
n === r && !t.querySelector('mint-tab[active="true"]') && (i = !0);
|
|
7116
|
+
}
|
|
7117
|
+
i ? this.style.display = "block" : this.style.display = "none";
|
|
7118
|
+
}
|
|
7119
|
+
render() {
|
|
7120
|
+
}
|
|
7121
|
+
}
|
|
7122
|
+
customElements.get("mint-tab-content") || customElements.define("mint-tab-content", St);
|
|
7123
|
+
class Lt extends HTMLElement {
|
|
7124
|
+
constructor() {
|
|
7125
|
+
super(), this._tabClickHandler = null, this._mutationObserver = null;
|
|
7126
|
+
}
|
|
7127
|
+
connectedCallback() {
|
|
7128
|
+
this.classList.add(
|
|
7129
|
+
"box-border",
|
|
7130
|
+
"m-0",
|
|
7131
|
+
"p-0",
|
|
7132
|
+
"border-0",
|
|
7133
|
+
"block"
|
|
7134
|
+
), this.render(), this.setupEventListeners(), this.setupMutationObserver(), this.initializeActiveTab();
|
|
7135
|
+
}
|
|
7136
|
+
disconnectedCallback() {
|
|
7137
|
+
this.removeEventListeners(), this._mutationObserver && (this._mutationObserver.disconnect(), this._mutationObserver = null);
|
|
7138
|
+
}
|
|
7139
|
+
render() {
|
|
7140
|
+
const t = this.querySelector("mint-tab-list");
|
|
7141
|
+
if (this.querySelectorAll("mint-tab-content"), !t) {
|
|
7142
|
+
console.warn("mint-tabs: mint-tab-list is required");
|
|
7143
|
+
return;
|
|
7144
|
+
}
|
|
7145
|
+
const e = t.getAttribute("position") || "top";
|
|
7146
|
+
this.classList.remove("flex", "flex-row", "flex-col", "gap-4", "gap-6"), e === "left" || e === "right" ? (this.classList.add("flex", "flex-row", "items-start"), e === "left" ? (t.classList.add("mr-4", "flex-shrink-0"), t.classList.remove("ml-4")) : (t.classList.add("ml-4", "flex-shrink-0", "order-2"), t.classList.remove("mr-4"), this.querySelectorAll("mint-tab-content").forEach((s) => {
|
|
7147
|
+
s.classList.add("order-1");
|
|
7148
|
+
}))) : (this.classList.add("flex", "flex-col"), t.classList.remove("mr-4", "ml-4", "flex-shrink-0", "order-2"), this.querySelectorAll("mint-tab-content").forEach((s) => {
|
|
7149
|
+
s.classList.remove("order-1");
|
|
7150
|
+
}));
|
|
7151
|
+
}
|
|
7152
|
+
initializeActiveTab() {
|
|
7153
|
+
requestAnimationFrame(() => {
|
|
7154
|
+
const t = this.querySelectorAll("mint-tab");
|
|
7155
|
+
let e = null;
|
|
7156
|
+
if (t.forEach((s) => {
|
|
7157
|
+
s.getAttribute("active") === "true" && (e = s);
|
|
7158
|
+
}), !e && t.length > 0 && (e = t[0], e.setAttribute("active", "true")), e) {
|
|
7159
|
+
const s = e.getAttribute("target");
|
|
7160
|
+
s ? this.showContent(s) : this.hideAllContent();
|
|
7161
|
+
} else
|
|
7162
|
+
this.hideAllContent();
|
|
7163
|
+
this.querySelectorAll("mint-tab-content").forEach((s) => {
|
|
7164
|
+
const n = s;
|
|
7165
|
+
n.checkInitialVisibility && n.checkInitialVisibility();
|
|
7166
|
+
});
|
|
7167
|
+
});
|
|
7168
|
+
}
|
|
7169
|
+
hideAllContent() {
|
|
7170
|
+
this.querySelectorAll("mint-tab-content").forEach((e) => {
|
|
7171
|
+
const i = e;
|
|
7172
|
+
i.hide ? i.hide() : e.style.display = "none";
|
|
7173
|
+
});
|
|
7174
|
+
}
|
|
7175
|
+
showContent(t) {
|
|
7176
|
+
this.querySelectorAll("mint-tab-content").forEach((s) => {
|
|
7177
|
+
const n = s;
|
|
7178
|
+
n.hide ? n.hide() : s.style.display = "none";
|
|
7179
|
+
});
|
|
7180
|
+
const i = this.querySelector(`mint-tab-content[id="${t}"]`);
|
|
7181
|
+
i && (i.show ? i.show() : i.style.display = "block");
|
|
7182
|
+
}
|
|
7183
|
+
setupEventListeners() {
|
|
7184
|
+
this._tabClickHandler || (this._tabClickHandler = this.handleTabClick.bind(this), this.addEventListener("tab-click", this._tabClickHandler));
|
|
7185
|
+
}
|
|
7186
|
+
removeEventListeners() {
|
|
7187
|
+
this._tabClickHandler && (this.removeEventListener("tab-click", this._tabClickHandler), this._tabClickHandler = null);
|
|
7188
|
+
}
|
|
7189
|
+
setupMutationObserver() {
|
|
7190
|
+
this._mutationObserver = new MutationObserver(() => {
|
|
7191
|
+
this.render();
|
|
7192
|
+
});
|
|
7193
|
+
const t = this.querySelector("mint-tab-list");
|
|
7194
|
+
t && this._mutationObserver.observe(t, {
|
|
7195
|
+
attributes: !0,
|
|
7196
|
+
attributeFilter: ["position"]
|
|
7197
|
+
});
|
|
7198
|
+
}
|
|
7199
|
+
handleTabClick(t) {
|
|
7200
|
+
var r, a;
|
|
7201
|
+
const e = (r = t.detail) == null ? void 0 : r.tab, i = (a = t.detail) == null ? void 0 : a.target;
|
|
7202
|
+
if (!e) return;
|
|
7203
|
+
const s = e.closest("mint-tab-list");
|
|
7204
|
+
if (!s) return;
|
|
7205
|
+
s.querySelectorAll("mint-tab").forEach((o) => {
|
|
7206
|
+
const l = o;
|
|
7207
|
+
o === e ? l.active = !0 : l.active = !1;
|
|
7208
|
+
}), i && this.showContent(i);
|
|
7209
|
+
}
|
|
7210
|
+
}
|
|
7211
|
+
customElements.get("mint-tabs") || customElements.define("mint-tabs", Lt);
|
|
6914
7212
|
export {
|
|
6915
7213
|
Et as Alert,
|
|
6916
7214
|
nt as BackButton,
|
|
@@ -6922,13 +7220,13 @@ export {
|
|
|
6922
7220
|
kt as Clickable,
|
|
6923
7221
|
ft as DatePicker,
|
|
6924
7222
|
gt as Dropzone,
|
|
6925
|
-
|
|
7223
|
+
bt as Form,
|
|
6926
7224
|
ot as Grid,
|
|
6927
7225
|
Q as Icon,
|
|
6928
7226
|
pt as Input,
|
|
6929
7227
|
rt as Link,
|
|
6930
7228
|
lt as Modal,
|
|
6931
|
-
|
|
7229
|
+
Ct as OffCanvas,
|
|
6932
7230
|
at as Page,
|
|
6933
7231
|
ct as Popover,
|
|
6934
7232
|
xt as ResourceTable,
|
|
@@ -6936,7 +7234,11 @@ export {
|
|
|
6936
7234
|
Z as Spinner,
|
|
6937
7235
|
it as Stack,
|
|
6938
7236
|
tt as Switch,
|
|
6939
|
-
|
|
7237
|
+
wt as Tab,
|
|
7238
|
+
St as TabContent,
|
|
7239
|
+
At as TabList,
|
|
7240
|
+
_t as Table,
|
|
7241
|
+
Lt as Tabs,
|
|
6940
7242
|
yt as Tags,
|
|
6941
7243
|
et as Text,
|
|
6942
7244
|
U as default
|