monobill-mintui 0.1.5 → 0.1.7
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 +35 -0
- package/dist/components/icon/Icon.d.ts.map +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.js +180 -177
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -35,11 +35,11 @@ class q extends HTMLElement {
|
|
|
35
35
|
const e = this.getSize(), t = this.getAttribute("size") || "default", i = !!(this.style.width && this.style.height), s = this.getAttribute("data-button-variant"), r = document.documentElement.classList.contains("dark");
|
|
36
36
|
let n;
|
|
37
37
|
if (i) {
|
|
38
|
-
const
|
|
39
|
-
s === "solid" ?
|
|
38
|
+
const o = this.getAttribute("data-button-tone") || "neutral";
|
|
39
|
+
s === "solid" ? o === "neutral" ? n = r ? "#ffffff" : "#0f172a" : n = "#ffffff" : n = r ? "#ffffff" : "#0f172a";
|
|
40
40
|
} else
|
|
41
41
|
n = r ? "#e2e8f0" : "#0f172a";
|
|
42
|
-
const a = t === "large" ? "2" : "4", c = !!(this.style.width && this.style.height),
|
|
42
|
+
const a = t === "large" ? "2" : "4", c = !!(this.style.width && this.style.height), l = `
|
|
43
43
|
<svg
|
|
44
44
|
xmlns="http://www.w3.org/2000/svg"
|
|
45
45
|
fill="none"
|
|
@@ -83,7 +83,7 @@ class q extends HTMLElement {
|
|
|
83
83
|
</circle>
|
|
84
84
|
</svg>
|
|
85
85
|
`;
|
|
86
|
-
this.innerHTML =
|
|
86
|
+
this.innerHTML = l.trim();
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
89
|
customElements.get("mint-spinner") || customElements.define("mint-spinner", q);
|
|
@@ -120,11 +120,11 @@ class B extends HTMLElement {
|
|
|
120
120
|
}
|
|
121
121
|
getIconUrl() {
|
|
122
122
|
var t;
|
|
123
|
-
const e =
|
|
124
|
-
return e ? `${e}
|
|
123
|
+
const e = (t = document.querySelector('meta[name="mint-icon-base-url"]')) == null ? void 0 : t.getAttribute("content");
|
|
124
|
+
return e ? e === "local" ? `/icons/${this.getName()}.svg` : e === "cdn" ? `https://assets.gomonobill.com/mintui/icons/${this.getName()}.svg` : `${e.endsWith("/") ? e : `${e}/`}${this.getName()}.svg` : `https://assets.gomonobill.com/mintui/icons/${this.getName()}.svg`;
|
|
125
125
|
}
|
|
126
126
|
render() {
|
|
127
|
-
var
|
|
127
|
+
var c, l, o;
|
|
128
128
|
const e = this.getName();
|
|
129
129
|
if (!e) {
|
|
130
130
|
this.innerHTML = "", this.style.maskImage = "", this.style.webkitMaskImage = "";
|
|
@@ -134,21 +134,24 @@ class B extends HTMLElement {
|
|
|
134
134
|
console.warn(`Icon "${e}" not found. Make sure you've imported the icon: import '@monobill-mintui/icon/icons/${e}'`), this.innerHTML = "", this.style.maskImage = "", this.style.webkitMaskImage = "";
|
|
135
135
|
return;
|
|
136
136
|
}
|
|
137
|
-
const i = this.closest("mint-button") || ((
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
137
|
+
const i = this.closest("mint-button") || ((c = this.parentElement) == null ? void 0 : c.closest("mint-button")), s = this.closest("mint-switch") || ((l = this.parentElement) == null ? void 0 : l.closest("mint-switch")), r = this.closest("mint-select") || ((o = this.parentElement) == null ? void 0 : o.closest("mint-select"));
|
|
138
|
+
if (!Array.from(this.classList).some(
|
|
139
|
+
(d) => d.startsWith("w-") || d.startsWith("h-")
|
|
140
|
+
) && !r) {
|
|
141
|
+
let d;
|
|
142
|
+
s ? d = "w-3 h-3" : i ? d = "w-5 h-5" : d = "w-[1.3em] h-[1.3em]", this.classList.remove("w-4", "h-4", "w-5", "h-5", "w-[1em]", "h-[1em]", "w-[1.3em]", "h-[1.3em]", "w-3", "h-3"), d.split(" ").forEach((h) => {
|
|
143
|
+
h && this.classList.add(h);
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
const a = this.getIconUrl();
|
|
147
|
+
if (this.style.maskImage = `url(${a})`, this.style.webkitMaskImage = `url(${a})`, this.style.maskSize = "contain", this.style.webkitMaskSize = "contain", this.style.maskRepeat = "no-repeat", this.style.webkitMaskRepeat = "no-repeat", this.style.maskPosition = "center", this.style.webkitMaskPosition = "center", this.style.aspectRatio = "1 / 1", this.style.backgroundColor = "currentColor", this.innerHTML = "", s)
|
|
144
148
|
this.classList.remove("text-gray-100", "text-gray-900"), this.classList.add("text-gray-900");
|
|
145
149
|
else if (i)
|
|
146
150
|
this.classList.remove("text-gray-100", "text-gray-900");
|
|
147
151
|
else {
|
|
148
|
-
const
|
|
149
|
-
this.classList.remove("text-gray-100", "text-gray-900"), this.classList.add(
|
|
152
|
+
const h = document.documentElement.classList.contains("dark") ? "text-gray-100" : "text-gray-900";
|
|
153
|
+
this.classList.remove("text-gray-100", "text-gray-900"), this.classList.add(h);
|
|
150
154
|
}
|
|
151
|
-
this.innerHTML = "";
|
|
152
155
|
}
|
|
153
156
|
}
|
|
154
157
|
customElements.get("mint-icon") || customElements.define("mint-icon", B);
|
|
@@ -214,8 +217,8 @@ class z extends HTMLElement {
|
|
|
214
217
|
if (c.nodeType === Node.TEXT_NODE && ((n = c.textContent) != null && n.trim()))
|
|
215
218
|
return !1;
|
|
216
219
|
if (c.nodeType === Node.ELEMENT_NODE) {
|
|
217
|
-
const
|
|
218
|
-
if (
|
|
220
|
+
const l = c;
|
|
221
|
+
if (l.tagName !== "MINT-ICON" && l.tagName !== "MINT-SPINNER" && !l.querySelector("mint-spinner") && !l.hasAttribute("slot") && l.className !== "mint-button-icon" && !(l.className === "mr-2" && l.querySelector("mint-spinner")) && (a = l.textContent) != null && a.trim())
|
|
219
222
|
return !1;
|
|
220
223
|
}
|
|
221
224
|
}
|
|
@@ -537,7 +540,7 @@ class z extends HTMLElement {
|
|
|
537
540
|
return this.isFullWidth() && c.push("w-full"), c.join(" ");
|
|
538
541
|
}
|
|
539
542
|
render() {
|
|
540
|
-
var
|
|
543
|
+
var o, d, h, u, b;
|
|
541
544
|
const e = this.isDisabled() || this.isLoading(), t = this.getType();
|
|
542
545
|
if (!this._button) {
|
|
543
546
|
for (this._button = document.createElement("button"); this.firstChild; )
|
|
@@ -555,7 +558,7 @@ class z extends HTMLElement {
|
|
|
555
558
|
const _ = document.createElement("mint-spinner");
|
|
556
559
|
_.setAttribute("size", "default"), _.setAttribute("data-button-variant", this.getVariant()), _.setAttribute("data-button-tone", this.getTone()), _.style.width = "0.875rem", _.style.height = "0.875rem", f.appendChild(_), this._button.insertBefore(f, this._button.firstChild);
|
|
557
560
|
}
|
|
558
|
-
else i && ((
|
|
561
|
+
else i && ((o = i.parentElement) == null || o.remove());
|
|
559
562
|
for (; this.firstChild && this.firstChild !== this._button; )
|
|
560
563
|
this._button.appendChild(this.firstChild);
|
|
561
564
|
const s = this.getIcon();
|
|
@@ -596,8 +599,8 @@ class z extends HTMLElement {
|
|
|
596
599
|
}
|
|
597
600
|
const c = this.isIconOnly();
|
|
598
601
|
r && (r.classList.contains("mint-button-icon") || r.classList.add("mint-button-icon"), r.classList.remove("mr-1.5", "ml-1.5"), c ? r.tagName === "MINT-ICON" ? (r.style.width = "1rem", r.style.height = "1rem", r.style.maxWidth = "1rem", r.style.maxHeight = "1rem", r.style.flexShrink = "0") : (r.style.maxWidth = "1rem", r.style.maxHeight = "1rem", r.style.flexShrink = "0", r.tagName === "svg" && (r.style.width = "1rem", r.style.height = "1rem")) : n === "left" ? r.classList.add("mr-1.5") : r.classList.add("ml-1.5"));
|
|
599
|
-
const
|
|
600
|
-
this._button.className =
|
|
602
|
+
const l = this.getButtonClasses();
|
|
603
|
+
this._button.className = l;
|
|
601
604
|
}
|
|
602
605
|
setupEventListeners() {
|
|
603
606
|
this._button && !this._clickHandler && (this._clickHandler = this.handleClick.bind(this), this._clickHandler && this._button.addEventListener("click", this._clickHandler, !0), this._button.addEventListener("mousedown", this._handleMouseDown), this._button.addEventListener("mouseup", this._handleMouseUp), this._button.addEventListener("mouseleave", this._handleMouseLeave), this._button.addEventListener("touchstart", this._handleTouchStart), this._button.addEventListener("touchend", this._handleTouchEnd), this._button.addEventListener("touchcancel", this._handleTouchCancel));
|
|
@@ -844,14 +847,14 @@ class R extends HTMLElement {
|
|
|
844
847
|
"text-green-600"
|
|
845
848
|
// success
|
|
846
849
|
], i = ["text-2xl", "text-lg", "text-sm"];
|
|
847
|
-
i.forEach((
|
|
848
|
-
this.classList.remove(
|
|
849
|
-
}), t.forEach((
|
|
850
|
-
this.classList.remove(
|
|
850
|
+
i.forEach((l) => {
|
|
851
|
+
this.classList.remove(l), this._userClasses.delete(l);
|
|
852
|
+
}), t.forEach((l) => {
|
|
853
|
+
this.classList.remove(l), this._userClasses.delete(l);
|
|
851
854
|
});
|
|
852
|
-
const s = this.getTextClasses().split(" ").filter((
|
|
853
|
-
Array.from(this.classList).forEach((
|
|
854
|
-
!t.includes(
|
|
855
|
+
const s = this.getTextClasses().split(" ").filter((l) => l.trim());
|
|
856
|
+
Array.from(this.classList).forEach((l) => {
|
|
857
|
+
!t.includes(l) && !i.includes(l) && this._userClasses.add(l);
|
|
855
858
|
});
|
|
856
859
|
const n = [.../* @__PURE__ */ new Set([...s, ...Array.from(this._userClasses)])];
|
|
857
860
|
this.className = n.join(" ");
|
|
@@ -1316,11 +1319,11 @@ class J extends HTMLElement {
|
|
|
1316
1319
|
t ? (r || (r = document.createElement("mint-text"), r.setAttribute("size", "sub-heading"), r.setAttribute("bold", ""), this._headingSlot.appendChild(r)), r.textContent = t) : r && r.remove(), Array.from(this.children).filter(
|
|
1317
1320
|
(d) => d !== this._overlay && d !== this._modal && d !== this._headingSlot && d.getAttribute("slot") === "heading"
|
|
1318
1321
|
).forEach((d) => {
|
|
1319
|
-
d.parentElement !== this._headingSlot && this._headingSlot.appendChild(d);
|
|
1322
|
+
this._headingSlot && d.parentElement !== this._headingSlot && this._headingSlot.appendChild(d);
|
|
1320
1323
|
}), this._closeButton || (this._closeButton = document.createElement("mint-button"), this._closeButton.setAttribute("variant", "ghost"), this._closeButton.setAttribute("icon", "close"), this._closeButton.addEventListener("click", () => this.close()), this._header.appendChild(this._closeButton)), this._bodySlot || (this._bodySlot = document.createElement("div"), this._bodySlot.className = "flex-1 overflow-y-auto p-4", this._bodySlot.setAttribute("slot", "body"), s.appendChild(this._bodySlot)), Array.from(this.children).filter(
|
|
1321
1324
|
(d) => d !== this._overlay && d !== this._modal && d !== this._bodySlot && d.getAttribute("slot") === "body"
|
|
1322
1325
|
).forEach((d) => {
|
|
1323
|
-
d.parentElement !== this._bodySlot && this._bodySlot.appendChild(d);
|
|
1326
|
+
this._bodySlot && d.parentElement !== this._bodySlot && this._bodySlot.appendChild(d);
|
|
1324
1327
|
}), this._actionsSlot || (this._actionsSlot = document.createElement("div"), this._actionsSlot.className = "p-4 border-t border-gray-200 dark:border-gray-700", this._actionsSlot.setAttribute("slot", "actions"), s.appendChild(this._actionsSlot));
|
|
1325
1328
|
let c = this._actionsSlot.querySelector("mint-stack");
|
|
1326
1329
|
c || (c = document.createElement("mint-stack"), c.setAttribute("direction", "horizontal"), c.className = "justify-end", this._actionsSlot.appendChild(c)), Array.from(this.children).filter(
|
|
@@ -1480,38 +1483,38 @@ class X extends HTMLElement {
|
|
|
1480
1483
|
if (!t) return { top: 0, left: 0, direction: "down" };
|
|
1481
1484
|
this.classList.contains("hidden") && (this.classList.remove("hidden"), this._popover.style.visibility = "hidden");
|
|
1482
1485
|
const s = t.getBoundingClientRect(), r = window.innerWidth, n = window.innerHeight, a = 8;
|
|
1483
|
-
let c = this.getDirection(),
|
|
1486
|
+
let c = this.getDirection(), l = 0, o = 0;
|
|
1484
1487
|
switch (c) {
|
|
1485
1488
|
case "down":
|
|
1486
|
-
if (
|
|
1489
|
+
if (l = e.bottom + a, o = e.left + e.width / 2 - s.width / 2, l + s.height > n) {
|
|
1487
1490
|
const d = e.top - s.height - a;
|
|
1488
|
-
d >= 0 ? (c = "up",
|
|
1491
|
+
d >= 0 ? (c = "up", l = d) : (l = Math.max(0, n - s.height - a), l + s.height > n && (l = 0));
|
|
1489
1492
|
}
|
|
1490
|
-
|
|
1493
|
+
o < 0 && (o = a), o + s.width > r && (o = Math.max(a, r - s.width - a), o + s.width > r && (o = r - s.width));
|
|
1491
1494
|
break;
|
|
1492
1495
|
case "up":
|
|
1493
|
-
if (
|
|
1496
|
+
if (l = e.top - s.height - a, o = e.left + e.width / 2 - s.width / 2, l < 0) {
|
|
1494
1497
|
const d = e.bottom + a;
|
|
1495
|
-
d + s.height <= n ? (c = "down",
|
|
1498
|
+
d + s.height <= n ? (c = "down", l = d) : (l = Math.min(n - s.height - a, n - s.height), l < 0 && (l = n - s.height));
|
|
1496
1499
|
}
|
|
1497
|
-
|
|
1500
|
+
o < 0 && (o = a), o + s.width > r && (o = Math.max(a, r - s.width - a), o + s.width > r && (o = r - s.width));
|
|
1498
1501
|
break;
|
|
1499
1502
|
case "right":
|
|
1500
|
-
if (
|
|
1503
|
+
if (l = e.top + e.height / 2 - s.height / 2, o = e.right + a, o + s.width > r) {
|
|
1501
1504
|
const d = e.left - s.width - a;
|
|
1502
|
-
d >= 0 ? (c = "left",
|
|
1505
|
+
d >= 0 ? (c = "left", o = d) : (o = Math.max(0, r - s.width - a), o + s.width > r && (o = r - s.width));
|
|
1503
1506
|
}
|
|
1504
|
-
|
|
1507
|
+
l < 0 && (l = a), l + s.height > n && (l = Math.max(a, n - s.height - a), l + s.height > n && (l = n - s.height));
|
|
1505
1508
|
break;
|
|
1506
1509
|
case "left":
|
|
1507
|
-
if (
|
|
1510
|
+
if (l = e.top + e.height / 2 - s.height / 2, o = e.left - s.width - a, o < 0) {
|
|
1508
1511
|
const d = e.right + a;
|
|
1509
|
-
d + s.width <= r ? (c = "right",
|
|
1512
|
+
d + s.width <= r ? (c = "right", o = d) : (o = Math.min(r - s.width - a, r - s.width), o < 0 && (o = 0));
|
|
1510
1513
|
}
|
|
1511
|
-
|
|
1514
|
+
l < 0 && (l = a), l + s.height > n && (l = Math.max(a, n - s.height - a), l + s.height > n && (l = n - s.height));
|
|
1512
1515
|
break;
|
|
1513
1516
|
}
|
|
1514
|
-
return { top:
|
|
1517
|
+
return { top: l, left: o, direction: c };
|
|
1515
1518
|
}
|
|
1516
1519
|
render() {
|
|
1517
1520
|
const e = this.getId(), t = this.isOpen(), i = this.getPadding();
|
|
@@ -1519,8 +1522,8 @@ class X extends HTMLElement {
|
|
|
1519
1522
|
if (this.classList.remove("hidden"), this.style.pointerEvents = "auto", !this._clickOutsideHandler) {
|
|
1520
1523
|
const n = this;
|
|
1521
1524
|
this._clickOutsideHandler = function(a) {
|
|
1522
|
-
const c = a.composedPath(),
|
|
1523
|
-
if (!(n._triggerElement && c.includes(n._triggerElement)) && !
|
|
1525
|
+
const c = a.composedPath(), l = c.includes(n);
|
|
1526
|
+
if (!(n._triggerElement && c.includes(n._triggerElement)) && !l) {
|
|
1524
1527
|
n.close();
|
|
1525
1528
|
return;
|
|
1526
1529
|
}
|
|
@@ -1535,7 +1538,7 @@ class X extends HTMLElement {
|
|
|
1535
1538
|
if (!s)
|
|
1536
1539
|
s = document.createElement("div"), s.className = `popover-content bg-white dark:bg-gray-800 rounded-lg shadow-xl ${i} transition-all duration-200 ease-out transform`, this._popover.appendChild(s);
|
|
1537
1540
|
else {
|
|
1538
|
-
const n = s.className.split(" "), a = ["p-0", "p-0.5", "p-1", "p-1.5", "p-2", "p-2.5", "p-3", "p-3.5", "p-4", "p-5", "p-6", "p-8", "p-10", "p-12", "p-16", "p-20", "p-24"], c = n.filter((
|
|
1541
|
+
const n = s.className.split(" "), a = ["p-0", "p-0.5", "p-1", "p-1.5", "p-2", "p-2.5", "p-3", "p-3.5", "p-4", "p-5", "p-6", "p-8", "p-10", "p-12", "p-16", "p-20", "p-24"], c = n.filter((l) => !a.includes(l));
|
|
1539
1542
|
s.className = [...c, i].join(" ");
|
|
1540
1543
|
}
|
|
1541
1544
|
Array.from(this.children).forEach((n) => {
|
|
@@ -1697,22 +1700,22 @@ class K extends HTMLElement {
|
|
|
1697
1700
|
a ? this._checkbox.value = a : this._checkbox.removeAttribute("value"), e ? this._checkbox.setAttribute("aria-label", e) : this._checkbox.removeAttribute("aria-label"), s.className = `mint-checkbox-wrapper ${this.getCheckboxClasses()}`, s.style.pointerEvents = "none", this._checkbox.style.pointerEvents = "auto";
|
|
1698
1701
|
let c = s.querySelector("mint-icon");
|
|
1699
1702
|
c || (c = document.createElement("mint-icon"), c.setAttribute("name", "check"), c.className = "w-3.5 h-3.5 text-white pointer-events-none absolute inset-0 m-auto", c.style.transition = "opacity 200ms ease-out, transform 200ms ease-out", c.style.zIndex = "1", s.appendChild(c)), this.updateVisualState();
|
|
1700
|
-
let
|
|
1703
|
+
let l = this.querySelector(".mint-checkbox-label-container");
|
|
1701
1704
|
if (e || t) {
|
|
1702
|
-
|
|
1703
|
-
let
|
|
1704
|
-
e ? (
|
|
1705
|
-
let d =
|
|
1706
|
-
if (t ? (d || (d = document.createElement("span"), d.className = "mint-checkbox-info text-xs text-gray-500 dark:text-gray-400 cursor-pointer select-none",
|
|
1707
|
-
|
|
1705
|
+
l || (l = document.createElement("div"), l.className = "mint-checkbox-label-container flex flex-col gap-0.5 flex-1", this.appendChild(l));
|
|
1706
|
+
let o = l.querySelector(".mint-checkbox-label");
|
|
1707
|
+
e ? (o || (o = document.createElement("span"), o.className = "mint-checkbox-label text-sm font-medium text-gray-900 dark:text-gray-100 cursor-pointer select-none", l.insertBefore(o, l.firstChild)), o.textContent = e, i ? o.classList.add("opacity-40") : o.classList.remove("opacity-40")) : o && o.remove();
|
|
1708
|
+
let d = l.querySelector(".mint-checkbox-info");
|
|
1709
|
+
if (t ? (d || (d = document.createElement("span"), d.className = "mint-checkbox-info text-xs text-gray-500 dark:text-gray-400 cursor-pointer select-none", l.appendChild(d)), d.textContent = t, i ? d.classList.add("opacity-40") : d.classList.remove("opacity-40")) : d && d.remove(), i)
|
|
1710
|
+
l.style.cursor = "default", l._clickHandler && (l.removeEventListener("click", l._clickHandler), l._clickHandler = null);
|
|
1708
1711
|
else {
|
|
1709
|
-
|
|
1710
|
-
const h =
|
|
1711
|
-
h &&
|
|
1712
|
+
l.style.cursor = "pointer";
|
|
1713
|
+
const h = l._clickHandler;
|
|
1714
|
+
h && l.removeEventListener("click", h), l._clickHandler = (u) => {
|
|
1712
1715
|
this._checkbox && (u.target === this._checkbox || this._checkbox.contains(u.target) || u.composedPath().includes(this._checkbox)) || this.toggle();
|
|
1713
|
-
},
|
|
1716
|
+
}, l.addEventListener("click", l._clickHandler);
|
|
1714
1717
|
}
|
|
1715
|
-
} else
|
|
1718
|
+
} else l && l.remove();
|
|
1716
1719
|
}
|
|
1717
1720
|
setupEventListeners() {
|
|
1718
1721
|
this.removeEventListeners(), this._checkbox && (this._changeHandler = (e) => {
|
|
@@ -1864,28 +1867,28 @@ class Z extends HTMLElement {
|
|
|
1864
1867
|
a ? this._radio.value = a : this._radio.removeAttribute("value"), e ? this._radio.setAttribute("aria-label", e) : this._radio.removeAttribute("aria-label"), s.className = `mint-choice-wrapper ${this.getChoiceClasses()}`, s.style.pointerEvents = "none", this._radio.style.pointerEvents = "auto";
|
|
1865
1868
|
let c = s.querySelector(".mint-choice-indicator");
|
|
1866
1869
|
c || (c = document.createElement("div"), c.className = "mint-choice-indicator w-2.5 h-2.5 rounded-full bg-white pointer-events-none absolute inset-0 m-auto", c.style.transition = "opacity 200ms ease-out, transform 200ms ease-out", c.style.zIndex = "1", s.appendChild(c)), c.style.opacity = this._checked ? "1" : "0", c.style.transform = this._checked ? "scale(1)" : "scale(0.8)", this.updateVisualState();
|
|
1867
|
-
let
|
|
1870
|
+
let l = this.querySelector(".mint-choice-label-container");
|
|
1868
1871
|
if (e || t) {
|
|
1869
|
-
|
|
1870
|
-
let
|
|
1871
|
-
e ? (
|
|
1872
|
-
let d =
|
|
1873
|
-
if (t ? (d || (d = document.createElement("span"), d.className = "mint-choice-info text-xs text-gray-500 dark:text-gray-400 cursor-pointer select-none",
|
|
1874
|
-
|
|
1872
|
+
l || (l = document.createElement("div"), l.className = "mint-choice-label-container flex flex-col gap-0.5 flex-1", this.appendChild(l));
|
|
1873
|
+
let o = l.querySelector(".mint-choice-label");
|
|
1874
|
+
e ? (o || (o = document.createElement("span"), o.className = "mint-choice-label text-sm font-medium text-gray-900 dark:text-gray-100 cursor-pointer select-none", l.insertBefore(o, l.firstChild)), o.textContent = e, i ? o.classList.add("opacity-40") : o.classList.remove("opacity-40")) : o && o.remove();
|
|
1875
|
+
let d = l.querySelector(".mint-choice-info");
|
|
1876
|
+
if (t ? (d || (d = document.createElement("span"), d.className = "mint-choice-info text-xs text-gray-500 dark:text-gray-400 cursor-pointer select-none", l.appendChild(d)), d.textContent = t, i ? d.classList.add("opacity-40") : d.classList.remove("opacity-40")) : d && d.remove(), i)
|
|
1877
|
+
l.style.cursor = "default", l._clickHandler && (l.removeEventListener("click", l._clickHandler), l._clickHandler = null);
|
|
1875
1878
|
else {
|
|
1876
|
-
|
|
1877
|
-
const h =
|
|
1878
|
-
h &&
|
|
1879
|
+
l.style.cursor = "pointer";
|
|
1880
|
+
const h = l._clickHandler;
|
|
1881
|
+
h && l.removeEventListener("click", h), l._clickHandler = (u) => {
|
|
1879
1882
|
this._radio && (u.target === this._radio || this._radio.contains(u.target) || u.composedPath().includes(this._radio)) || this.select();
|
|
1880
|
-
},
|
|
1883
|
+
}, l.addEventListener("click", l._clickHandler);
|
|
1881
1884
|
}
|
|
1882
|
-
} else
|
|
1885
|
+
} else l && l.remove();
|
|
1883
1886
|
}
|
|
1884
1887
|
setupEventListeners() {
|
|
1885
1888
|
this.removeEventListeners(), this._radio && (this._changeHandler = (e) => {
|
|
1886
1889
|
e.stopPropagation();
|
|
1887
1890
|
const t = this._checked;
|
|
1888
|
-
if (this._checked = this._radio.checked, this._checked ? this.hasAttribute("checked") || this.setAttribute("checked", "") : this.hasAttribute("checked") && this.removeAttribute("checked"), this.updateVisualState(), this._checked) {
|
|
1891
|
+
if (this._checked = this._radio.checked, this._checked ? this.hasAttribute("checked") || this.setAttribute("checked", "") : this.hasAttribute("checked") && this.removeAttribute("checked"), this.updateVisualState(), this._checked && this._radio) {
|
|
1889
1892
|
const i = this._radio.name;
|
|
1890
1893
|
i && document.querySelectorAll(`input[type="radio"][name="${i}"]`).forEach((r) => {
|
|
1891
1894
|
if (r !== this._radio) {
|
|
@@ -2100,7 +2103,7 @@ class Q extends HTMLElement {
|
|
|
2100
2103
|
render() {
|
|
2101
2104
|
var v, E, S, y;
|
|
2102
2105
|
this.getType();
|
|
2103
|
-
const e = this._getNormalizedType(), t = this._isTextarea(), i = this._isMoney(), s = this._isColor(), r = this.getPlaceholder(), n = this.isDisabled(), a = this.isReadonly(), c = this.isRequired(),
|
|
2106
|
+
const e = this._getNormalizedType(), t = this._isTextarea(), i = this._isMoney(), s = this._isColor(), r = this.getPlaceholder(), n = this.isDisabled(), a = this.isReadonly(), c = this.isRequired(), l = this.getId(), o = this.getName(), d = this.getAttribute("value") || (s ? "#000000" : ""), h = this.getRows(), u = this.getIcon(), b = this.getLabel(), f = this.getInfo();
|
|
2104
2107
|
if (s) {
|
|
2105
2108
|
this._input && (this._input.remove(), this._input = null), this._textarea && (this._textarea.remove(), this._textarea = null), this._wrapper || (this._wrapper = document.createElement("div"), this._wrapper.className = "relative w-full", this.appendChild(this._wrapper)), this._colorContainer && (this._colorContainer.remove(), this._colorContainer = null), this._colorPickerWrapper && !s && (this._colorPickerWrapper.remove(), this._colorPickerWrapper = null), this._colorPickerWrapper || (this._colorPickerWrapper = document.createElement("div"), this._colorPickerWrapper.className = "mint-color-picker-wrapper absolute left-[.65rem] top-1/2 -translate-y-1/2 w-6 h-6 rounded cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500", this._colorPickerWrapper.style.backgroundColor = d || "#000000", this._wrapper.appendChild(this._colorPickerWrapper), this._colorPicker = document.createElement("input"), this._colorPicker.type = "color", this._colorPicker.className = "absolute inset-0 w-full h-full opacity-0 cursor-pointer", this._colorPicker.style.cssText = "position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; z-index: 10; pointer-events: auto; margin: 0; padding: 0; border: none;", this._colorPickerWrapper.appendChild(this._colorPicker), this._focusHandler = (p) => {
|
|
2106
2109
|
this._colorPickerWrapper && this._colorPicker && this._colorPicker.matches(":focus-visible") && requestAnimationFrame(() => {
|
|
@@ -2145,7 +2148,7 @@ class Q extends HTMLElement {
|
|
|
2145
2148
|
const g = d || "#000000";
|
|
2146
2149
|
if (this._colorPicker && this._colorPicker.value !== g && (this._colorPicker.value = g), this._colorPickerWrapper && (this._colorPickerWrapper.style.backgroundColor = g), this._colorTextInput && this._colorTextInput.value !== g && (this._colorTextInput.value = g), this._colorPicker && (this._colorPicker.disabled = n), this._colorPickerWrapper && (n ? (this._colorPickerWrapper.classList.add("opacity-40", "cursor-not-allowed"), this._colorPickerWrapper.classList.remove("cursor-pointer")) : (this._colorPickerWrapper.classList.remove("opacity-40", "cursor-not-allowed"), this._colorPickerWrapper.classList.add("cursor-pointer"))), this._colorTextInput && (this._colorTextInput.disabled = n, this._colorTextInput.readOnly = a, this._colorTextInput.required = c), this._colorTextInput) {
|
|
2147
2150
|
const p = this._colorTextInput;
|
|
2148
|
-
|
|
2151
|
+
l ? p.id = l : p.removeAttribute("id"), o ? p.name = o : p.removeAttribute("name"), p.setAttribute("aria-invalid", this.hasError() ? "true" : "false"), this._element = p;
|
|
2149
2152
|
}
|
|
2150
2153
|
this._renderErrorState();
|
|
2151
2154
|
return;
|
|
@@ -2173,11 +2176,11 @@ class Q extends HTMLElement {
|
|
|
2173
2176
|
this._numberIncrementButton && (this._numberIncrementButton.disabled = n || a), this._numberDecrementButton && (this._numberDecrementButton.disabled = n || a);
|
|
2174
2177
|
} else this._numberSpinnerContainer && (this._numberSpinnerContainer.remove(), this._numberSpinnerContainer = null, this._numberIncrementButton = null, this._numberDecrementButton = null);
|
|
2175
2178
|
if (t) {
|
|
2176
|
-
if (this._input && (this._input.remove(), this._input = null), this._textarea || (this._textarea = document.createElement("textarea"), this._wrapper.appendChild(this._textarea), this.setupEventListeners()), this._element = this._textarea, this._textarea.placeholder = r, this._textarea.disabled = n, this._textarea.readOnly = a, this._textarea.required = c, this._textarea.rows = h, this._textarea.setAttribute("aria-invalid", this.hasError() ? "true" : "false"), d !== this._textarea.value && (this._textarea.value = d),
|
|
2179
|
+
if (this._input && (this._input.remove(), this._input = null), this._textarea || (this._textarea = document.createElement("textarea"), this._wrapper.appendChild(this._textarea), this.setupEventListeners()), this._element = this._textarea, this._textarea.placeholder = r, this._textarea.disabled = n, this._textarea.readOnly = a, this._textarea.required = c, this._textarea.rows = h, this._textarea.setAttribute("aria-invalid", this.hasError() ? "true" : "false"), d !== this._textarea.value && (this._textarea.value = d), l ? this._textarea.id = l : this._textarea.removeAttribute("id"), o ? this._textarea.name = o : this._textarea.removeAttribute("name"), this._textarea.className = this.getInputClasses(), this.firstChild && this.firstChild !== this._wrapper && this.firstChild.nodeType === Node.TEXT_NODE) {
|
|
2177
2180
|
const g = this.firstChild.textContent;
|
|
2178
2181
|
g && !this._textarea.value && (this._textarea.value = g.trim()), this.removeChild(this.firstChild);
|
|
2179
2182
|
}
|
|
2180
|
-
} else if (this._textarea && (this._textarea.remove(), this._textarea = null), this._input || (this._input = document.createElement("input"), this._wrapper.appendChild(this._input), this.setupEventListeners()), this._element = this._input, this._input.type = e, this._input.placeholder = r, this._input.disabled = n, this._input.readOnly = a, this._input.required = c, this._input.setAttribute("aria-invalid", this.hasError() ? "true" : "false"), i ? (this._input.inputMode = "decimal", this._input.pattern = "[0-9]*\\.?[0-9]*") : (this._input.removeAttribute("inputmode"), this._input.removeAttribute("pattern")), d !== this._input.value && (this._input.value = d),
|
|
2183
|
+
} else if (this._textarea && (this._textarea.remove(), this._textarea = null), this._input || (this._input = document.createElement("input"), this._wrapper.appendChild(this._input), this.setupEventListeners()), this._element = this._input, this._input.type = e, this._input.placeholder = r, this._input.disabled = n, this._input.readOnly = a, this._input.required = c, this._input.setAttribute("aria-invalid", this.hasError() ? "true" : "false"), i ? (this._input.inputMode = "decimal", this._input.pattern = "[0-9]*\\.?[0-9]*") : (this._input.removeAttribute("inputmode"), this._input.removeAttribute("pattern")), d !== this._input.value && (this._input.value = d), l ? this._input.id = l : this._input.removeAttribute("id"), o ? this._input.name = o : this._input.removeAttribute("name"), this._input.className = this.getInputClasses(), this.firstChild && this.firstChild !== this._wrapper && this.firstChild.nodeType === Node.TEXT_NODE) {
|
|
2181
2184
|
const g = this.firstChild.textContent;
|
|
2182
2185
|
g && !this._input.value && (this._input.value = g.trim()), this.removeChild(this.firstChild);
|
|
2183
2186
|
}
|
|
@@ -2187,7 +2190,7 @@ class Q extends HTMLElement {
|
|
|
2187
2190
|
let g = m.querySelector(".mint-input-label");
|
|
2188
2191
|
if (b) {
|
|
2189
2192
|
g || (g = document.createElement("label"), g.className = "mint-input-label text-sm font-medium text-gray-900 dark:text-gray-100 select-none", m.insertBefore(g, m.firstChild)), g.textContent = b;
|
|
2190
|
-
const k =
|
|
2193
|
+
const k = l || ((v = this._element) == null ? void 0 : v.id) || ((E = this._colorTextInput) == null ? void 0 : E.id) || ((S = this._input) == null ? void 0 : S.id) || ((y = this._textarea) == null ? void 0 : y.id);
|
|
2191
2194
|
if (k)
|
|
2192
2195
|
g.setAttribute("for", k);
|
|
2193
2196
|
else {
|
|
@@ -2406,8 +2409,8 @@ class ee extends HTMLElement {
|
|
|
2406
2409
|
if (c.type === "sep")
|
|
2407
2410
|
n += c.value.length;
|
|
2408
2411
|
else {
|
|
2409
|
-
const
|
|
2410
|
-
t[a] && (t[a].value =
|
|
2412
|
+
const l = r.substr(n, c.len);
|
|
2413
|
+
t[a] && (t[a].value = l), a++, n += c.len;
|
|
2411
2414
|
}
|
|
2412
2415
|
});
|
|
2413
2416
|
}
|
|
@@ -2440,10 +2443,10 @@ class ee extends HTMLElement {
|
|
|
2440
2443
|
}), s.addEventListener("keydown", (a) => {
|
|
2441
2444
|
a.key === "Backspace" && s.selectionStart === 0 && s.selectionEnd === 0 && this._focusPrev(e, r), a.key === "ArrowLeft" && s.selectionStart === 0 && s.selectionEnd === 0 && (this._focusPrev(e, r), a.preventDefault()), a.key === "ArrowRight" && s.selectionStart === s.value.length && s.selectionEnd === s.value.length && (this._focusNext(e, r), a.preventDefault());
|
|
2442
2445
|
}), s.addEventListener("blur", (a) => {
|
|
2443
|
-
var
|
|
2446
|
+
var l;
|
|
2444
2447
|
this._syncHiddenInput();
|
|
2445
2448
|
const c = a.relatedTarget;
|
|
2446
|
-
c && i.contains(c) || (this._handleBlur(((
|
|
2449
|
+
c && i.contains(c) || (this._handleBlur(((l = this._hiddenInput) == null ? void 0 : l.value) || ""), this._exitInputMode());
|
|
2447
2450
|
});
|
|
2448
2451
|
});
|
|
2449
2452
|
}
|
|
@@ -2456,8 +2459,8 @@ class ee extends HTMLElement {
|
|
|
2456
2459
|
if (this._isRange) {
|
|
2457
2460
|
const [s, r] = this._splitRangeInput(e, t), n = s ? this._parseDateString(s, t) : null, a = r ? this._parseDateString(r, t) : null;
|
|
2458
2461
|
if (n && a) {
|
|
2459
|
-
const [c,
|
|
2460
|
-
this._selectedStartDate = c, this._selectedEndDate =
|
|
2462
|
+
const [c, l] = n <= a ? [n, a] : [a, n];
|
|
2463
|
+
this._selectedStartDate = c, this._selectedEndDate = l, this._currentMonth = c.getMonth(), this._currentYear = c.getFullYear();
|
|
2461
2464
|
} else n && (this._selectedStartDate = n, this._selectedEndDate = null, this._currentMonth = n.getMonth(), this._currentYear = n.getFullYear());
|
|
2462
2465
|
this._applyDateToParts(this._selectedStartDate, this._startPartInputs, i, t), this._applyDateToParts(this._selectedEndDate, this._endPartInputs, i, t);
|
|
2463
2466
|
} else {
|
|
@@ -2492,15 +2495,15 @@ class ee extends HTMLElement {
|
|
|
2492
2495
|
}
|
|
2493
2496
|
}
|
|
2494
2497
|
const r = e.replace(/[\/\-\.]/g, ""), n = t.replace(/[\/\-\.]/g, "").toLowerCase();
|
|
2495
|
-
let a = n.indexOf("d"), c = n.indexOf("m"),
|
|
2496
|
-
const
|
|
2498
|
+
let a = n.indexOf("d"), c = n.indexOf("m"), l = n.indexOf("y");
|
|
2499
|
+
const o = [
|
|
2497
2500
|
{ char: "d", index: a },
|
|
2498
2501
|
{ char: "m", index: c },
|
|
2499
|
-
{ char: "y", index:
|
|
2502
|
+
{ char: "y", index: l }
|
|
2500
2503
|
].sort((_, m) => _.index - m.index);
|
|
2501
2504
|
let d = 0, h = 0, u = 0, b = 0;
|
|
2502
2505
|
n.length, r.length;
|
|
2503
|
-
for (const _ of
|
|
2506
|
+
for (const _ of o)
|
|
2504
2507
|
if (_.char === "d") {
|
|
2505
2508
|
const m = n.lastIndexOf("d") - n.indexOf("d") + 1, v = r.substr(b, m);
|
|
2506
2509
|
if (v.length === 0) return null;
|
|
@@ -2526,7 +2529,7 @@ class ee extends HTMLElement {
|
|
|
2526
2529
|
}
|
|
2527
2530
|
// PHP-style formatter for display mode
|
|
2528
2531
|
_formatDatePhp(e, t) {
|
|
2529
|
-
const i = e.getDate(), s = e.getMonth() + 1, r = e.getFullYear(), n = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], a = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], c = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
|
|
2532
|
+
const i = e.getDate(), s = e.getMonth() + 1, r = e.getFullYear(), n = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], a = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], c = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], l = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], o = (u, b = 2) => u.toString().padStart(b, "0"), d = (u) => {
|
|
2530
2533
|
const b = u % 10, f = u % 100;
|
|
2531
2534
|
return b === 1 && f !== 11 ? "st" : b === 2 && f !== 12 ? "nd" : b === 3 && f !== 13 ? "rd" : "th";
|
|
2532
2535
|
};
|
|
@@ -2545,19 +2548,19 @@ class ee extends HTMLElement {
|
|
|
2545
2548
|
h += r.toString().slice(-2);
|
|
2546
2549
|
break;
|
|
2547
2550
|
case "m":
|
|
2548
|
-
h +=
|
|
2551
|
+
h += o(s);
|
|
2549
2552
|
break;
|
|
2550
2553
|
case "n":
|
|
2551
2554
|
h += s.toString();
|
|
2552
2555
|
break;
|
|
2553
2556
|
case "M":
|
|
2554
|
-
h +=
|
|
2557
|
+
h += l[s - 1];
|
|
2555
2558
|
break;
|
|
2556
2559
|
case "F":
|
|
2557
2560
|
h += c[s - 1];
|
|
2558
2561
|
break;
|
|
2559
2562
|
case "d":
|
|
2560
|
-
h +=
|
|
2563
|
+
h += o(i);
|
|
2561
2564
|
break;
|
|
2562
2565
|
case "j":
|
|
2563
2566
|
h += i.toString();
|
|
@@ -2583,7 +2586,7 @@ class ee extends HTMLElement {
|
|
|
2583
2586
|
return i !== null && !isNaN(i.getTime());
|
|
2584
2587
|
}
|
|
2585
2588
|
render() {
|
|
2586
|
-
const e = this.getLabel(), t = this.getInfo(), i = this.getValue(), s = this.isDisabled(), r = this.isReadonly(), n = this.isRequired(), a = this.getId(), c = this.getName(),
|
|
2589
|
+
const e = this.getLabel(), t = this.getInfo(), i = this.getValue(), s = this.isDisabled(), r = this.isReadonly(), n = this.isRequired(), a = this.getId(), c = this.getName(), l = this.getFormat(), o = this.hasError(), d = this.getErrorMessage();
|
|
2587
2590
|
this._isRange = this.isRange(), this._input || (this._input = document.createElement("div"), this._input.className = "relative w-full", this.appendChild(this._input));
|
|
2588
2591
|
let h = this.querySelector(".mint-date-picker-label-container");
|
|
2589
2592
|
if (e || t) {
|
|
@@ -2593,14 +2596,14 @@ class ee extends HTMLElement {
|
|
|
2593
2596
|
let v = h.querySelector(".mint-date-picker-info");
|
|
2594
2597
|
t ? (v || (v = document.createElement("span"), v.className = "mint-date-picker-info text-xs text-gray-500 dark:text-gray-400 select-none", h.appendChild(v)), v.textContent = t) : v && v.remove();
|
|
2595
2598
|
} else h && h.remove();
|
|
2596
|
-
this._hiddenInput || (this._hiddenInput = document.createElement("input"), this._hiddenInput.type = "hidden", this._hiddenInput.value = i || "", this._textInput = this._hiddenInput, this._input.appendChild(this._hiddenInput)), a && (this._hiddenInput.id = a), c && (this._hiddenInput.name = c), this._hiddenInput.value = i || "", this._hiddenInput.setAttribute("aria-invalid",
|
|
2599
|
+
this._hiddenInput || (this._hiddenInput = document.createElement("input"), this._hiddenInput.type = "hidden", this._hiddenInput.value = i || "", this._textInput = this._hiddenInput, this._input.appendChild(this._hiddenInput)), a && (this._hiddenInput.id = a), c && (this._hiddenInput.name = c), this._hiddenInput.value = i || "", this._hiddenInput.setAttribute("aria-invalid", o ? "true" : "false");
|
|
2597
2600
|
let u = this._input.querySelector(".mint-date-fields");
|
|
2598
|
-
u || (u = document.createElement("div"), this._input.appendChild(u)), this._fieldsContainer = u, this._applyErrorVisuals(
|
|
2601
|
+
u || (u = document.createElement("div"), this._input.appendChild(u)), this._fieldsContainer = u, this._applyErrorVisuals(o, d, s), u.innerHTML = "", this._displayEl = document.createElement("div"), this._displayEl.className = "flex-1 text-gray-900 dark:text-white cursor-text select-none focus:outline-none", this._displayEl.tabIndex = s ? -1 : 0, this._displayEl.addEventListener("click", () => {
|
|
2599
2602
|
s || r || this._enterInputMode();
|
|
2600
2603
|
}), this._displayEl.addEventListener("keydown", (m) => {
|
|
2601
2604
|
s || r || (m.key === "Enter" || m.key === " ") && (m.preventDefault(), this._enterInputMode());
|
|
2602
2605
|
}), this._inputsWrapperEl = document.createElement("div"), this._inputsWrapperEl.className = "flex items-center gap-1 w-full";
|
|
2603
|
-
const b = this._getFormatTokens(
|
|
2606
|
+
const b = this._getFormatTokens(l);
|
|
2604
2607
|
this._startPartInputs = [], this._endPartInputs = [];
|
|
2605
2608
|
const f = (m) => {
|
|
2606
2609
|
const v = document.createDocumentFragment();
|
|
@@ -2632,7 +2635,7 @@ class ee extends HTMLElement {
|
|
|
2632
2635
|
s || r || this._enterInputMode();
|
|
2633
2636
|
}), this._input.prepend(this._iconButton), this._iconButton.disabled = s || r;
|
|
2634
2637
|
}
|
|
2635
|
-
this._renderErrorState(
|
|
2638
|
+
this._renderErrorState(o, d);
|
|
2636
2639
|
}
|
|
2637
2640
|
_renderErrorState(e, t) {
|
|
2638
2641
|
let i = this.querySelector(".mint-date-picker-error");
|
|
@@ -2680,7 +2683,7 @@ class ee extends HTMLElement {
|
|
|
2680
2683
|
if (this._isRange) {
|
|
2681
2684
|
const [i, s] = this._splitRangeInput(e, t), r = i ? this._parseDateString(i, t) : null, n = s ? this._parseDateString(s, t) : null;
|
|
2682
2685
|
if (r && n) {
|
|
2683
|
-
const [a, c] = r <= n ? [r, n] : [n, r],
|
|
2686
|
+
const [a, c] = r <= n ? [r, n] : [n, r], l = this._formatDate(a, t), o = this._formatDate(c, t), d = `${l} - ${o}`;
|
|
2684
2687
|
this.setValue(d), this._applyDateToParts(a, this._startPartInputs, this._getFormatTokens(t), t), this._applyDateToParts(c, this._endPartInputs, this._getFormatTokens(t), t), this._selectedStartDate = a, this._selectedEndDate = c, this._currentMonth = a.getMonth(), this._currentYear = a.getFullYear();
|
|
2685
2688
|
} else if (r) {
|
|
2686
2689
|
const a = this._formatDate(r, t);
|
|
@@ -2782,14 +2785,14 @@ class ee extends HTMLElement {
|
|
|
2782
2785
|
a.className = "flex flex-col md:flex-row md:gap-6 md:items-start";
|
|
2783
2786
|
const c = document.createElement("div");
|
|
2784
2787
|
c.className = "flex-1 min-w-0";
|
|
2785
|
-
const
|
|
2786
|
-
|
|
2787
|
-
const
|
|
2788
|
-
|
|
2788
|
+
const l = document.createElement("div");
|
|
2789
|
+
l.className = "flex items-center justify-between mb-4";
|
|
2790
|
+
const o = document.createElement("button");
|
|
2791
|
+
o.type = "button", o.tabIndex = 0, o.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", o.setAttribute("data-keep-popover-open", "true");
|
|
2789
2792
|
const d = document.createElement("mint-icon");
|
|
2790
|
-
d.setAttribute("name", "caret-left"), d.className = "w-4 h-4",
|
|
2793
|
+
d.setAttribute("name", "caret-left"), d.className = "w-4 h-4", o.appendChild(d), o.addEventListener("click", () => {
|
|
2791
2794
|
this._currentMonth === 0 ? (this._currentMonth = 11, this._currentYear--) : this._currentMonth--, this._buildCalendar();
|
|
2792
|
-
}),
|
|
2795
|
+
}), l.appendChild(o);
|
|
2793
2796
|
const h = document.createElement("div");
|
|
2794
2797
|
h.className = "flex items-center gap-2";
|
|
2795
2798
|
const u = document.createElement("button");
|
|
@@ -2799,13 +2802,13 @@ class ee extends HTMLElement {
|
|
|
2799
2802
|
const b = document.createElement("button");
|
|
2800
2803
|
b.type = "button", b.tabIndex = 0, b.className = "text-sm font-medium text-gray-900 dark:text-gray-100 hover:text-gray-600 dark:hover:text-gray-300 transition-colors flex items-center focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500", b.setAttribute("data-keep-popover-open", "true"), b.textContent = String(this._currentYear), b.addEventListener("click", () => {
|
|
2801
2804
|
this._viewMode = "year", this._buildCalendar();
|
|
2802
|
-
}), h.appendChild(b),
|
|
2805
|
+
}), h.appendChild(b), l.appendChild(h);
|
|
2803
2806
|
const f = document.createElement("button");
|
|
2804
2807
|
f.type = "button", f.tabIndex = 0, f.className = "p-1 rounded hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-600 dark:text-gray-300 transition-colors flex items-center focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500", f.setAttribute("data-keep-popover-open", "true");
|
|
2805
2808
|
const _ = document.createElement("mint-icon");
|
|
2806
2809
|
_.setAttribute("name", "caret-right"), _.className = "w-4 h-4", f.appendChild(_), f.addEventListener("click", () => {
|
|
2807
2810
|
this._currentMonth === 11 ? (this._currentMonth = 0, this._currentYear++) : this._currentMonth++, this._buildCalendar();
|
|
2808
|
-
}),
|
|
2811
|
+
}), l.appendChild(f);
|
|
2809
2812
|
const m = document.createElement("div");
|
|
2810
2813
|
m.className = "grid grid-cols-7 mb-2", s.forEach((y) => {
|
|
2811
2814
|
const g = document.createElement("div");
|
|
@@ -2907,7 +2910,7 @@ class ee extends HTMLElement {
|
|
|
2907
2910
|
}), p.appendChild(T);
|
|
2908
2911
|
}), g.appendChild(p), y.appendChild(g), a.appendChild(y);
|
|
2909
2912
|
}
|
|
2910
|
-
c.appendChild(
|
|
2913
|
+
c.appendChild(l), c.appendChild(m), c.appendChild(v), a.appendChild(c), this._calendarContainer.appendChild(a);
|
|
2911
2914
|
}
|
|
2912
2915
|
_buildMonthView() {
|
|
2913
2916
|
if (!this._calendarContainer) return;
|
|
@@ -2930,12 +2933,12 @@ class ee extends HTMLElement {
|
|
|
2930
2933
|
this._currentYear++, this._buildCalendar();
|
|
2931
2934
|
}), t.appendChild(n);
|
|
2932
2935
|
const c = document.createElement("div");
|
|
2933
|
-
c.className = "grid grid-cols-3 gap-2", e.forEach((
|
|
2936
|
+
c.className = "grid grid-cols-3 gap-2", e.forEach((l, o) => {
|
|
2934
2937
|
const d = document.createElement("button");
|
|
2935
2938
|
d.type = "button", d.tabIndex = 0, d.setAttribute("data-keep-popover-open", "true");
|
|
2936
|
-
const h = this._currentMonth ===
|
|
2937
|
-
d.className = `p-2 rounded text-sm font-medium transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500 ${h ? "bg-slate-800 dark:bg-slate-600 text-white" : "text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700"}`, d.textContent =
|
|
2938
|
-
this._currentMonth =
|
|
2939
|
+
const h = this._currentMonth === o;
|
|
2940
|
+
d.className = `p-2 rounded text-sm font-medium transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500 ${h ? "bg-slate-800 dark:bg-slate-600 text-white" : "text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700"}`, d.textContent = l, d.addEventListener("click", () => {
|
|
2941
|
+
this._currentMonth = o, this._viewMode = "calendar", this._buildCalendar();
|
|
2939
2942
|
}), c.appendChild(d);
|
|
2940
2943
|
}), this._calendarContainer.appendChild(t), this._calendarContainer.appendChild(c);
|
|
2941
2944
|
}
|
|
@@ -2957,17 +2960,17 @@ class ee extends HTMLElement {
|
|
|
2957
2960
|
c.setAttribute("name", "caret-right"), c.className = "w-4 h-4", a.appendChild(c), a.addEventListener("click", () => {
|
|
2958
2961
|
this._currentYear += 12, this._buildCalendar();
|
|
2959
2962
|
}), i.appendChild(a);
|
|
2960
|
-
const
|
|
2961
|
-
|
|
2962
|
-
for (let
|
|
2963
|
+
const l = document.createElement("div");
|
|
2964
|
+
l.className = "grid grid-cols-3 gap-2";
|
|
2965
|
+
for (let o = e; o <= t; o++) {
|
|
2963
2966
|
const d = document.createElement("button");
|
|
2964
2967
|
d.type = "button", d.tabIndex = 0, d.setAttribute("data-keep-popover-open", "true");
|
|
2965
|
-
const h = this._currentYear ===
|
|
2966
|
-
d.className = `p-2 rounded text-sm font-medium transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500 ${h ? "bg-slate-800 dark:bg-slate-600 text-white" : "text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700"}`, d.textContent = String(
|
|
2967
|
-
this._currentYear =
|
|
2968
|
-
}),
|
|
2968
|
+
const h = this._currentYear === o;
|
|
2969
|
+
d.className = `p-2 rounded text-sm font-medium transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500 ${h ? "bg-slate-800 dark:bg-slate-600 text-white" : "text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700"}`, d.textContent = String(o), d.addEventListener("click", () => {
|
|
2970
|
+
this._currentYear = o, this._viewMode = "calendar", this._buildCalendar();
|
|
2971
|
+
}), l.appendChild(d);
|
|
2969
2972
|
}
|
|
2970
|
-
this._calendarContainer.appendChild(i), this._calendarContainer.appendChild(
|
|
2973
|
+
this._calendarContainer.appendChild(i), this._calendarContainer.appendChild(l);
|
|
2971
2974
|
}
|
|
2972
2975
|
_getDaysInMonth(e, t) {
|
|
2973
2976
|
return new Date(t, e + 1, 0).getDate();
|
|
@@ -3193,14 +3196,14 @@ class te extends HTMLElement {
|
|
|
3193
3196
|
for (; this.firstChild; )
|
|
3194
3197
|
this.removeChild(this.firstChild);
|
|
3195
3198
|
this._wrapper = null, this._select = null;
|
|
3196
|
-
const i = this.getLabel(), s = this.getInfo(), r = this.getId(), n = this.getName(), a = this.getValue(), c = this.isDisabled(),
|
|
3199
|
+
const i = this.getLabel(), s = this.getInfo(), r = this.getId(), n = this.getName(), a = this.getValue(), c = this.isDisabled(), l = this.isMultiple(), o = this.hasError();
|
|
3197
3200
|
if (i) {
|
|
3198
3201
|
const h = document.createElement("label");
|
|
3199
3202
|
h.className = "block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1", r && h.setAttribute("for", r);
|
|
3200
3203
|
const u = document.createTextNode(i);
|
|
3201
3204
|
h.appendChild(u), this.appendChild(h);
|
|
3202
3205
|
}
|
|
3203
|
-
this._wrapper = document.createElement("div"), this._wrapper.className = "relative w-full", this.appendChild(this._wrapper), this._select = document.createElement("select"), this._select.className = this.getSelectClasses(), r && (this._select.id = r), n && (this._select.name = n), c && (this._select.disabled = !0),
|
|
3206
|
+
this._wrapper = document.createElement("div"), this._wrapper.className = "relative w-full", this.appendChild(this._wrapper), this._select = document.createElement("select"), this._select.className = this.getSelectClasses(), r && (this._select.id = r), n && (this._select.name = n), c && (this._select.disabled = !0), l && (this._select.multiple = !0), a && (this._select.value = a), this._select.setAttribute("aria-invalid", o ? "true" : "false");
|
|
3204
3207
|
const d = e.length > 0 ? e : t;
|
|
3205
3208
|
if (d.length > 0 && d.forEach((h) => {
|
|
3206
3209
|
this._select.appendChild(h);
|
|
@@ -3216,7 +3219,7 @@ class te extends HTMLElement {
|
|
|
3216
3219
|
cancelable: !0,
|
|
3217
3220
|
composed: !0
|
|
3218
3221
|
}));
|
|
3219
|
-
}, this._select.addEventListener("change", this._changeHandler), this._wrapper.appendChild(this._select),
|
|
3222
|
+
}, this._select.addEventListener("change", this._changeHandler), this._wrapper.appendChild(this._select), l)
|
|
3220
3223
|
this._caretUpIcon = null, this._caretDownIcon = null;
|
|
3221
3224
|
else {
|
|
3222
3225
|
const h = document.createElement("div");
|
|
@@ -3288,10 +3291,10 @@ class ie extends HTMLElement {
|
|
|
3288
3291
|
return this.hasAttribute("disabled");
|
|
3289
3292
|
}
|
|
3290
3293
|
render() {
|
|
3291
|
-
const e = this.getLabel(), t = this.getAccept(), i = this.isMultiple(), s = this.isDisabled(), r = this.getWidth(), n = this.getHeight(), a = this.getName(), c = this.hasError(),
|
|
3294
|
+
const e = this.getLabel(), t = this.getAccept(), i = this.isMultiple(), s = this.isDisabled(), r = this.getWidth(), n = this.getHeight(), a = this.getName(), c = this.hasError(), l = this.getErrorMessage();
|
|
3292
3295
|
this._dropzone || (this._dropzone = document.createElement("div"), this.appendChild(this._dropzone)), this._updateDragStateClass(), this._dropzone.setAttribute("aria-invalid", c ? "true" : "false"), this._dropzone.style.width = r, this._dropzone.style.height = n, this._dropzone.style.minWidth = r, this._dropzone.style.minHeight = n, this._fileInput || (this._fileInput = document.createElement("input"), this._fileInput.type = "file", this._fileInput.style.display = "none", this._dropzone.appendChild(this._fileInput)), this._fileInput.accept = t, this._fileInput.multiple = i, this._fileInput.disabled = s, a ? this._fileInput.name = a : this._fileInput.removeAttribute("name"), this._fileInput.setAttribute("aria-invalid", c ? "true" : "false");
|
|
3293
|
-
const
|
|
3294
|
-
|
|
3296
|
+
const o = this._dropzone.querySelector(".mint-dropzone-icon"), d = this._dropzone.querySelector(".mint-dropzone-label");
|
|
3297
|
+
o && o.remove(), d && d.remove();
|
|
3295
3298
|
const h = document.createElement("div");
|
|
3296
3299
|
h.className = "mint-dropzone-icon flex items-center justify-center mt-2 mb-2 flex-shrink-0";
|
|
3297
3300
|
const u = document.createElement("mint-icon");
|
|
@@ -3299,7 +3302,7 @@ class ie extends HTMLElement {
|
|
|
3299
3302
|
const b = document.createElement("div");
|
|
3300
3303
|
b.className = "mint-dropzone-label text-sm font-medium text-gray-600 dark:text-gray-400 text-center px-4 flex-shrink-0", b.textContent = e, this._dropzone.appendChild(b);
|
|
3301
3304
|
}
|
|
3302
|
-
this.setupEventListeners(), this._renderErrorState(c,
|
|
3305
|
+
this.setupEventListeners(), this._renderErrorState(c, l), this._renderPreviews();
|
|
3303
3306
|
}
|
|
3304
3307
|
_updateDragState() {
|
|
3305
3308
|
this._dropzone && this._updateDragStateClass();
|
|
@@ -3342,8 +3345,8 @@ class ie extends HTMLElement {
|
|
|
3342
3345
|
if (i && i.length > 0) {
|
|
3343
3346
|
const s = this.getAccept(), r = this.isMultiple(), n = [], a = [];
|
|
3344
3347
|
for (let c = 0; c < i.length; c++) {
|
|
3345
|
-
const
|
|
3346
|
-
this._isFileAccepted(
|
|
3348
|
+
const l = i[c];
|
|
3349
|
+
this._isFileAccepted(l, s) ? n.push(l) : a.push(l);
|
|
3347
3350
|
}
|
|
3348
3351
|
if (!r && n.length > 1 && (a.push(...n.slice(1)), n.splice(1)), a.length > 0) {
|
|
3349
3352
|
const c = new CustomEvent("dropRejected", {
|
|
@@ -3441,24 +3444,24 @@ class ie extends HTMLElement {
|
|
|
3441
3444
|
const e = document.createElement("div");
|
|
3442
3445
|
e.className = "mint-dropzone-previews-wrapper mt-3 w-full relative max-h-48";
|
|
3443
3446
|
const t = document.createElement("div");
|
|
3444
|
-
t.className = "mint-dropzone-previews w-full flex flex-col gap-2 max-h-48 overflow-y-auto overflow-x-hidden px-2 pb-2", this._selectedFiles.forEach((
|
|
3447
|
+
t.className = "mint-dropzone-previews w-full flex flex-col gap-2 max-h-48 overflow-y-auto overflow-x-hidden px-2 pb-2", this._selectedFiles.forEach((l, o) => {
|
|
3445
3448
|
const d = document.createElement("div");
|
|
3446
|
-
if (d.className = "flex items-center gap-3 p-2 rounded border border-gray-200 dark:border-gray-600 bg-gray-50 dark:bg-gray-800",
|
|
3449
|
+
if (d.className = "flex items-center gap-3 p-2 rounded border border-gray-200 dark:border-gray-600 bg-gray-50 dark:bg-gray-800", l.type.startsWith("image/")) {
|
|
3447
3450
|
const f = document.createElement("img");
|
|
3448
3451
|
f.className = "w-12 h-12 object-cover rounded border border-gray-200 dark:border-gray-700";
|
|
3449
|
-
const _ = URL.createObjectURL(
|
|
3452
|
+
const _ = URL.createObjectURL(l);
|
|
3450
3453
|
this._previewUrls.push(_), f.src = _, d.appendChild(f);
|
|
3451
3454
|
} else {
|
|
3452
3455
|
const f = document.createElement("mint-icon");
|
|
3453
3456
|
f.setAttribute("name", "attach"), f.className = "w-5 h-5 text-gray-500 dark:text-gray-300", d.appendChild(f);
|
|
3454
3457
|
}
|
|
3455
3458
|
const h = document.createElement("div");
|
|
3456
|
-
h.className = "flex-1 text-sm text-gray-800 dark:text-gray-100 truncate", h.textContent =
|
|
3459
|
+
h.className = "flex-1 text-sm text-gray-800 dark:text-gray-100 truncate", h.textContent = l.name, d.appendChild(h);
|
|
3457
3460
|
const u = document.createElement("button");
|
|
3458
3461
|
u.type = "button", u.className = "text-gray-500 hover:bg-red-100 dark:hover:bg-red-900/30 transition-colors flex items-center justify-center w-6 h-6 rounded-full";
|
|
3459
3462
|
const b = document.createElement("mint-icon");
|
|
3460
3463
|
b.setAttribute("name", "close"), b.className = "w-4 h-4", u.appendChild(b), u.addEventListener("click", (f) => {
|
|
3461
|
-
f.preventDefault(), f.stopPropagation(), this._removeFileAt(
|
|
3464
|
+
f.preventDefault(), f.stopPropagation(), this._removeFileAt(o);
|
|
3462
3465
|
}), d.appendChild(u), t.appendChild(d);
|
|
3463
3466
|
});
|
|
3464
3467
|
const i = this.hasError(), s = this._isDragging;
|
|
@@ -3469,8 +3472,8 @@ class ie extends HTMLElement {
|
|
|
3469
3472
|
const a = document.createElement("div");
|
|
3470
3473
|
a.className = `absolute bottom-0 left-0 right-0 h-4 pointer-events-none z-10 bg-gradient-to-t ${r} to-transparent opacity-100 transition-opacity duration-200`, e.appendChild(a);
|
|
3471
3474
|
const c = () => {
|
|
3472
|
-
const
|
|
3473
|
-
|
|
3475
|
+
const l = t.scrollTop, o = t.scrollHeight, d = t.clientHeight;
|
|
3476
|
+
l > 0 ? n.style.opacity = "1" : n.style.opacity = "0", l + d < o - 1 ? a.style.opacity = "1" : a.style.opacity = "0";
|
|
3474
3477
|
};
|
|
3475
3478
|
c(), t.addEventListener("scroll", c), e.appendChild(t), this._previewContainer = e, this._dropzone.appendChild(e), this._updateDragStateClass();
|
|
3476
3479
|
}
|
|
@@ -3580,43 +3583,43 @@ class se extends HTMLElement {
|
|
|
3580
3583
|
const i = this.getAttribute("action"), s = (this.getAttribute("method") || "POST").toUpperCase(), r = this.getAttribute("enctype") || "application/x-www-form-urlencoded";
|
|
3581
3584
|
if (!i)
|
|
3582
3585
|
return { status: 0, ok: !0, data: { values: t } };
|
|
3583
|
-
const n = Array.from(e.values()).some((
|
|
3586
|
+
const n = Array.from(e.values()).some((o) => o instanceof File);
|
|
3584
3587
|
let a = null;
|
|
3585
3588
|
const c = {};
|
|
3586
|
-
let
|
|
3589
|
+
let l = i;
|
|
3587
3590
|
if (s === "GET") {
|
|
3588
|
-
const
|
|
3591
|
+
const o = new URLSearchParams();
|
|
3589
3592
|
e.forEach((d, h) => {
|
|
3590
|
-
d instanceof File ||
|
|
3591
|
-
}),
|
|
3593
|
+
d instanceof File || o.append(h, String(d));
|
|
3594
|
+
}), l += (i.includes("?") ? "&" : "?") + o.toString();
|
|
3592
3595
|
} else if (r === "multipart/form-data" || n)
|
|
3593
3596
|
a = e;
|
|
3594
3597
|
else if (r === "application/json")
|
|
3595
3598
|
a = JSON.stringify(t), c["Content-Type"] = "application/json";
|
|
3596
3599
|
else {
|
|
3597
|
-
const
|
|
3600
|
+
const o = new URLSearchParams();
|
|
3598
3601
|
e.forEach((d, h) => {
|
|
3599
|
-
d instanceof File ||
|
|
3600
|
-
}), a =
|
|
3602
|
+
d instanceof File || o.append(h, String(d));
|
|
3603
|
+
}), a = o, c["Content-Type"] = "application/x-www-form-urlencoded";
|
|
3601
3604
|
}
|
|
3602
3605
|
if (typeof fetch == "function") {
|
|
3603
|
-
const
|
|
3606
|
+
const o = await fetch(l, {
|
|
3604
3607
|
method: s,
|
|
3605
3608
|
body: s === "GET" ? null : a,
|
|
3606
3609
|
headers: c
|
|
3607
|
-
}), d = await
|
|
3610
|
+
}), d = await o.text().catch(() => "");
|
|
3608
3611
|
let h = d;
|
|
3609
3612
|
try {
|
|
3610
3613
|
h = JSON.parse(d);
|
|
3611
3614
|
} catch {
|
|
3612
3615
|
}
|
|
3613
|
-
if (!
|
|
3614
|
-
throw { status:
|
|
3615
|
-
return { status:
|
|
3616
|
+
if (!o.ok)
|
|
3617
|
+
throw { status: o.status, data: h };
|
|
3618
|
+
return { status: o.status, ok: o.ok, data: h };
|
|
3616
3619
|
}
|
|
3617
|
-
return await new Promise((
|
|
3620
|
+
return await new Promise((o, d) => {
|
|
3618
3621
|
const h = new XMLHttpRequest();
|
|
3619
|
-
h.open(s,
|
|
3622
|
+
h.open(s, l, !0), Object.entries(c).forEach(([u, b]) => h.setRequestHeader(u, b)), h.onload = function() {
|
|
3620
3623
|
const { status: u, responseText: b } = h;
|
|
3621
3624
|
if (u >= 200 && u < 300) {
|
|
3622
3625
|
let f = b;
|
|
@@ -3624,7 +3627,7 @@ class se extends HTMLElement {
|
|
|
3624
3627
|
f = JSON.parse(b);
|
|
3625
3628
|
} catch {
|
|
3626
3629
|
}
|
|
3627
|
-
|
|
3630
|
+
o({ status: u, ok: !0, data: f });
|
|
3628
3631
|
} else
|
|
3629
3632
|
d({ status: u, data: b });
|
|
3630
3633
|
}, h.onerror = function() {
|
|
@@ -3644,7 +3647,7 @@ class se extends HTMLElement {
|
|
|
3644
3647
|
const a = Array.from(n);
|
|
3645
3648
|
t[r] && Array.isArray(t[r]) ? a.forEach((c) => {
|
|
3646
3649
|
t[r].some(
|
|
3647
|
-
(
|
|
3650
|
+
(o) => o.name === c.name && o.size === c.size && o.lastModified === c.lastModified
|
|
3648
3651
|
) || t[r].push(c);
|
|
3649
3652
|
}) : t[r] = a;
|
|
3650
3653
|
}
|
|
@@ -3673,8 +3676,8 @@ class se extends HTMLElement {
|
|
|
3673
3676
|
_validate(e, t) {
|
|
3674
3677
|
let i = !0;
|
|
3675
3678
|
return this._errors = {}, Object.entries(t || {}).forEach(([s, r]) => {
|
|
3676
|
-
const n = Array.isArray(r) ? r : [r], a = this._getFieldElements(s), c = this._extractFieldValue(a),
|
|
3677
|
-
|
|
3679
|
+
const n = Array.isArray(r) ? r : [r], a = this._getFieldElements(s), c = this._extractFieldValue(a), l = this._validateRules(c, n);
|
|
3680
|
+
l ? (i = !1, this._errors[s] = l, this._flagFieldError(a, l)) : this._clearFieldError(a);
|
|
3678
3681
|
}), i;
|
|
3679
3682
|
}
|
|
3680
3683
|
_validateField(e) {
|
|
@@ -3837,8 +3840,8 @@ class se extends HTMLElement {
|
|
|
3837
3840
|
if (!r) return;
|
|
3838
3841
|
const n = this._getFieldName(r);
|
|
3839
3842
|
if (!n || !this._collectValidationRules()[n]) return;
|
|
3840
|
-
const c = this._extractFieldValue([r]),
|
|
3841
|
-
(
|
|
3843
|
+
const c = this._extractFieldValue([r]), l = c != null && (typeof c == "string" ? c.trim() !== "" : c instanceof FileList || Array.isArray(c) ? c.length > 0 : !0), o = r.hasAttribute("data-mint-form-error") || s instanceof HTMLElement && (s.hasAttribute("aria-invalid") || s.closest("[data-mint-form-error]"));
|
|
3844
|
+
(l || o) && setTimeout(() => {
|
|
3842
3845
|
this._validateField(n);
|
|
3843
3846
|
}, 0);
|
|
3844
3847
|
};
|
|
@@ -3847,12 +3850,12 @@ class se extends HTMLElement {
|
|
|
3847
3850
|
const s = i.target;
|
|
3848
3851
|
if (!s) return;
|
|
3849
3852
|
if (s instanceof HTMLSelectElement || s.tagName === "MINT-SELECT" || s.closest("mint-select")) {
|
|
3850
|
-
const
|
|
3851
|
-
if (!
|
|
3852
|
-
const
|
|
3853
|
-
if (!
|
|
3853
|
+
const l = this._findFieldElement(s);
|
|
3854
|
+
if (!l) return;
|
|
3855
|
+
const o = this._getFieldName(l);
|
|
3856
|
+
if (!o || !this._collectValidationRules()[o]) return;
|
|
3854
3857
|
setTimeout(() => {
|
|
3855
|
-
this._validateField(
|
|
3858
|
+
this._validateField(o);
|
|
3856
3859
|
}, 0);
|
|
3857
3860
|
return;
|
|
3858
3861
|
}
|
|
@@ -3938,32 +3941,32 @@ class re extends HTMLElement {
|
|
|
3938
3941
|
const t = this.hasAttribute("bordered"), i = this.hasAttribute("striped"), s = this.hasAttribute("hover"), r = this.hasAttribute("compact");
|
|
3939
3942
|
e.style.width = "100%", e.style.borderCollapse = "collapse", e.style.fontSize = "0.875rem", e.style.fontWeight = "500";
|
|
3940
3943
|
const n = e.querySelector("thead");
|
|
3941
|
-
n && (n.style.backgroundColor = "rgb(249 250 251)", document.documentElement.classList.contains("dark") && (n.style.backgroundColor = "rgb(31 41 55)"), n.querySelectorAll("th").forEach((
|
|
3942
|
-
|
|
3944
|
+
n && (n.style.backgroundColor = "rgb(249 250 251)", document.documentElement.classList.contains("dark") && (n.style.backgroundColor = "rgb(31 41 55)"), n.querySelectorAll("th").forEach((o) => {
|
|
3945
|
+
o.style.textAlign = "left", o.style.fontWeight = "600", o.style.color = "rgb(17 24 39)", document.documentElement.classList.contains("dark") && (o.style.color = "rgb(255 255 255)"), o.style.textTransform = "uppercase", o.style.letterSpacing = "0.05em", o.style.fontSize = "0.75rem", t && (o.style.border = "1px solid rgb(229 231 235)", document.documentElement.classList.contains("dark") && (o.style.borderColor = "rgb(55 65 81)")), r ? o.style.padding = "0.375rem 0.75rem" : o.style.padding = "0.75rem 1rem";
|
|
3943
3946
|
}));
|
|
3944
3947
|
const a = e.querySelector("tbody");
|
|
3945
|
-
a && (i && (a.style.borderTopWidth = "1px", a.style.borderTopStyle = "solid", a.style.borderTopColor = "rgb(229 231 235)", document.documentElement.classList.contains("dark") && (a.style.borderTopColor = "rgb(55 65 81)")), a.querySelectorAll("tr").forEach((
|
|
3946
|
-
if (t && (
|
|
3947
|
-
|
|
3948
|
-
const u = this._hoverHandlers.get(
|
|
3949
|
-
u && (
|
|
3948
|
+
a && (i && (a.style.borderTopWidth = "1px", a.style.borderTopStyle = "solid", a.style.borderTopColor = "rgb(229 231 235)", document.documentElement.classList.contains("dark") && (a.style.borderTopColor = "rgb(55 65 81)")), a.querySelectorAll("tr").forEach((o, d) => {
|
|
3949
|
+
if (t && (o.style.borderBottomWidth = "1px", o.style.borderBottomStyle = "solid", o.style.borderBottomColor = "rgb(229 231 235)", document.documentElement.classList.contains("dark") && (o.style.borderBottomColor = "rgb(55 65 81)")), i ? d % 2 === 0 ? (o.style.backgroundColor = "rgb(255 255 255)", document.documentElement.classList.contains("dark") && (o.style.backgroundColor = "rgb(17 24 39)")) : (o.style.backgroundColor = "rgb(249 250 251)", document.documentElement.classList.contains("dark") && (o.style.backgroundColor = "rgb(31 41 55)")) : (o.style.backgroundColor = "rgb(255 255 255)", document.documentElement.classList.contains("dark") && (o.style.backgroundColor = "rgb(17 24 39)")), s) {
|
|
3950
|
+
o.style.transition = "background-color 150ms";
|
|
3951
|
+
const u = this._hoverHandlers.get(o);
|
|
3952
|
+
u && (o.removeEventListener("mouseenter", u.enter), o.removeEventListener("mouseleave", u.leave));
|
|
3950
3953
|
const b = () => {
|
|
3951
|
-
|
|
3954
|
+
o.style.backgroundColor = "rgb(243 244 246)", document.documentElement.classList.contains("dark") && (o.style.backgroundColor = "rgb(31 41 55)");
|
|
3952
3955
|
}, f = () => {
|
|
3953
|
-
i ? d % 2 === 0 ? (
|
|
3956
|
+
i ? d % 2 === 0 ? (o.style.backgroundColor = "rgb(255 255 255)", document.documentElement.classList.contains("dark") && (o.style.backgroundColor = "rgb(17 24 39)")) : (o.style.backgroundColor = "rgb(249 250 251)", document.documentElement.classList.contains("dark") && (o.style.backgroundColor = "rgb(31 41 55)")) : (o.style.backgroundColor = "rgb(255 255 255)", document.documentElement.classList.contains("dark") && (o.style.backgroundColor = "rgb(17 24 39)"));
|
|
3954
3957
|
};
|
|
3955
|
-
this._hoverHandlers.set(
|
|
3958
|
+
this._hoverHandlers.set(o, { enter: b, leave: f }), o.addEventListener("mouseenter", b), o.addEventListener("mouseleave", f);
|
|
3956
3959
|
} else {
|
|
3957
|
-
const u = this._hoverHandlers.get(
|
|
3958
|
-
u && (
|
|
3960
|
+
const u = this._hoverHandlers.get(o);
|
|
3961
|
+
u && (o.removeEventListener("mouseenter", u.enter), o.removeEventListener("mouseleave", u.leave), this._hoverHandlers.delete(o));
|
|
3959
3962
|
}
|
|
3960
|
-
|
|
3963
|
+
o.querySelectorAll("td").forEach((u) => {
|
|
3961
3964
|
u.style.color = "rgb(17 24 39)", document.documentElement.classList.contains("dark") && (u.style.color = "rgb(243 244 246)"), t && (u.style.border = "1px solid rgb(229 231 235)", document.documentElement.classList.contains("dark") && (u.style.borderColor = "rgb(55 65 81)")), r ? u.style.padding = "0.375rem 0.75rem" : u.style.padding = "0.75rem 1rem";
|
|
3962
3965
|
});
|
|
3963
3966
|
}));
|
|
3964
3967
|
const c = e.querySelector("tfoot");
|
|
3965
|
-
c && (c.style.backgroundColor = "rgb(249 250 251)", document.documentElement.classList.contains("dark") && (c.style.backgroundColor = "rgb(31 41 55)"), c.style.fontWeight = "600", c.querySelectorAll("td").forEach((
|
|
3966
|
-
|
|
3968
|
+
c && (c.style.backgroundColor = "rgb(249 250 251)", document.documentElement.classList.contains("dark") && (c.style.backgroundColor = "rgb(31 41 55)"), c.style.fontWeight = "600", c.querySelectorAll("td").forEach((o) => {
|
|
3969
|
+
o.style.color = "rgb(17 24 39)", document.documentElement.classList.contains("dark") && (o.style.color = "rgb(243 244 246)"), t && (o.style.border = "1px solid rgb(229 231 235)", document.documentElement.classList.contains("dark") && (o.style.borderColor = "rgb(55 65 81)")), r ? o.style.padding = "0.375rem 0.75rem" : o.style.padding = "0.75rem 1rem";
|
|
3967
3970
|
}));
|
|
3968
3971
|
}
|
|
3969
3972
|
}
|