monobill-mintui 0.3.43 → 0.3.45

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -133,7 +133,7 @@ class Q extends HTMLElement {
133
133
  </svg>`, e;
134
134
  }
135
135
  render() {
136
- var l, c, d;
136
+ var l, c, h;
137
137
  const t = this.getName();
138
138
  if (!t) {
139
139
  this.innerHTML = "", this.style.maskImage = "", this.style.webkitMaskImage = "", this.style.backgroundColor = "";
@@ -144,13 +144,13 @@ class Q extends HTMLElement {
144
144
  console.warn(`Icon "${t}" not found. Make sure you've imported the icon: import '@monobill-mintui/icon/icons/${t}'`), this.innerHTML = "", this.style.maskImage = "", this.style.webkitMaskImage = "", this.style.backgroundColor = "";
145
145
  return;
146
146
  }
147
- const i = this.closest("mint-button") || ((l = this.parentElement) == null ? void 0 : l.closest("mint-button")), s = this.closest("mint-switch") || ((c = this.parentElement) == null ? void 0 : c.closest("mint-switch")), n = this.closest("mint-select") || ((d = this.parentElement) == null ? void 0 : d.closest("mint-select"));
147
+ const i = this.closest("mint-button") || ((l = this.parentElement) == null ? void 0 : l.closest("mint-button")), s = this.closest("mint-switch") || ((c = this.parentElement) == null ? void 0 : c.closest("mint-switch")), n = this.closest("mint-select") || ((h = this.parentElement) == null ? void 0 : h.closest("mint-select"));
148
148
  if (!Array.from(this.classList).some(
149
149
  (p) => p.startsWith("w-") || p.startsWith("h-")
150
150
  ) && !n) {
151
151
  let p;
152
- s ? p = "w-3 h-3" : i ? p = "w-5 h-5" : p = "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"), p.split(" ").forEach((h) => {
153
- h && this.classList.add(h);
152
+ s ? p = "w-3 h-3" : i ? p = "w-5 h-5" : p = "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"), p.split(" ").forEach((d) => {
153
+ d && this.classList.add(d);
154
154
  });
155
155
  }
156
156
  const a = this.generateSVGMarkup(e);
@@ -161,8 +161,8 @@ class Q extends HTMLElement {
161
161
  else if (i)
162
162
  this.classList.remove("text-gray-100", "text-gray-900");
163
163
  else {
164
- const h = document.documentElement.classList.contains("dark") ? "text-gray-100" : "text-gray-900";
165
- this.classList.remove("text-gray-100", "text-gray-900"), this.classList.add(h);
164
+ const d = document.documentElement.classList.contains("dark") ? "text-gray-100" : "text-gray-900";
165
+ this.classList.remove("text-gray-100", "text-gray-900"), this.classList.add(d);
166
166
  }
167
167
  }
168
168
  }
@@ -728,7 +728,7 @@ const W = class W extends HTMLElement {
728
728
  return this.isFullWidth() && o.push("w-full"), o.join(" ");
729
729
  }
730
730
  render() {
731
- var d, p, h, u, _, f;
731
+ var h, p, d, u, _, f;
732
732
  const t = this.isDisabled() || this.isLoading(), e = this.getType();
733
733
  if (!this._button) {
734
734
  for (this._button = document.createElement("button"); this.firstChild; )
@@ -747,7 +747,7 @@ const W = class W extends HTMLElement {
747
747
  const g = document.createElement("mint-spinner");
748
748
  g.setAttribute("size", "default"), g.setAttribute("data-button-variant", this.getVariant()), g.setAttribute("data-button-tone", this.getTone()), g.style.width = "0.875rem", g.style.height = "0.875rem", m.appendChild(g), this._button.insertBefore(m, this._button.firstChild);
749
749
  }
750
- else i && ((d = i.parentElement) == null || d.remove());
750
+ else i && ((h = i.parentElement) == null || h.remove());
751
751
  for (; this.firstChild && this.firstChild !== this._button; )
752
752
  this._button.appendChild(this.firstChild);
753
753
  const n = this.getIcon();
@@ -782,7 +782,7 @@ const W = class W extends HTMLElement {
782
782
  const g = (p = this._button.querySelector("mint-spinner")) == null ? void 0 : p.parentElement;
783
783
  r && a === "left" ? g ? (g.insertAdjacentElement("afterend", r), r.insertAdjacentElement("afterend", o)) : (this._button.insertBefore(r, this._button.firstChild), r.insertAdjacentElement("afterend", o)) : r && a === "right" ? g ? (g.insertAdjacentElement("afterend", o), o.insertAdjacentElement("afterend", r)) : (this._button.insertBefore(o, this._button.firstChild), o.insertAdjacentElement("afterend", r)) : g ? g.insertAdjacentElement("afterend", o) : this._button.insertBefore(o, this._button.firstChild);
784
784
  } else if (r && r.tagName === "MINT-ICON" && !r.parentElement) {
785
- const g = (h = this._button.querySelector("mint-spinner")) == null ? void 0 : h.parentElement;
785
+ const g = (d = this._button.querySelector("mint-spinner")) == null ? void 0 : d.parentElement;
786
786
  g ? g.insertAdjacentElement("afterend", r) : this._button.insertBefore(r, this._button.firstChild);
787
787
  }
788
788
  }
@@ -977,13 +977,13 @@ class tt extends HTMLElement {
977
977
  s ? (l || (l = document.createElement("label"), l.className = "mint-switch-label text-sm font-medium text-gray-900 dark:text-gray-100 select-none", this._button && this._button.parentElement === o ? o.insertBefore(l, this._button.nextSibling) : o.appendChild(l)), l.textContent = s, l.setAttribute("for", a), this.isDisabled() ? l.classList.add("opacity-40") : l.classList.remove("opacity-40")) : l && l.remove(), this._button.className = e, this._button.disabled = this.isDisabled(), this._button.id = a, this._button.setAttribute("aria-checked", String(this._checked)), this._button.setAttribute("aria-label", s || "Toggle switch"), this._button.setAttribute("role", "switch"), this._button.type = "button";
978
978
  let c = this._button.querySelector("span");
979
979
  c || (c = document.createElement("span"), this._button.appendChild(c)), c.className = i;
980
- const d = c.querySelector("span");
980
+ const h = c.querySelector("span");
981
981
  if (r) {
982
- let h = d;
983
- h || (h = document.createElement("span"), h.className = this.getIconClasses(), c.appendChild(h));
984
- let u = h.querySelector("mint-icon");
985
- u || (u = document.createElement("mint-icon"), h.appendChild(u)), u.setAttribute("name", r);
986
- } else d && d.remove();
982
+ let d = h;
983
+ d || (d = document.createElement("span"), d.className = this.getIconClasses(), c.appendChild(d));
984
+ let u = d.querySelector("mint-icon");
985
+ u || (u = document.createElement("mint-icon"), d.appendChild(u)), u.setAttribute("name", r);
986
+ } else h && h.remove();
987
987
  let p = this.querySelector(".mint-switch-info");
988
988
  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);
989
989
  }
@@ -1477,7 +1477,10 @@ class at extends HTMLElement {
1477
1477
  }), this._updateBackgroundColor();
1478
1478
  }
1479
1479
  _applyContainerClasses() {
1480
- this._pageContainer && (this._pageContainer.classList.add("min-h-screen", "p-8", "transition-colors", "duration-200"), this.hasAttribute("containered") ? this._pageContainer.classList.add("max-w-6xl", "mx-auto", "w-full") : this._pageContainer.classList.remove("max-w-6xl", "mx-auto"));
1480
+ 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");
1481
1484
  }
1482
1485
  _updateBackgroundColor() {
1483
1486
  if (!this._pageContainer) return;
@@ -1599,31 +1602,31 @@ class lt extends HTMLElement {
1599
1602
  render() {
1600
1603
  const t = this.getId(), e = this.getHeading(), i = this.isOpen();
1601
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) {
1602
- let d = this._modal.querySelector(".modal-content");
1603
- d || (d = document.createElement("div"), d.className = "modal-content bg-white dark:bg-gray-800 rounded-lg shadow-xl max-w-2xl w-full max-h-[90vh] flex flex-col pointer-events-auto transition-all duration-200 ease-out transform", this._modal.appendChild(d)), this._animateEnter();
1605
+ let h = this._modal.querySelector(".modal-content");
1606
+ h || (h = document.createElement("div"), h.className = "modal-content bg-white dark:bg-gray-800 rounded-lg shadow-xl max-w-2xl w-full max-h-[90vh] flex flex-col pointer-events-auto transition-all duration-200 ease-out transform", this._modal.appendChild(h)), this._animateEnter();
1604
1607
  } else
1605
1608
  this._animateExit();
1606
1609
  let s = this._modal.querySelector(".modal-content");
1607
1610
  s || (s = document.createElement("div"), s.className = "modal-content bg-white dark:bg-gray-800 rounded-lg shadow-xl max-w-2xl w-full max-h-[90vh] flex flex-col pointer-events-auto transition-all duration-200 ease-out transform", this._modal.appendChild(s)), this._header || (this._header = document.createElement("div"), this._header.className = "flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-700", s.appendChild(this._header)), this._headingSlot || (this._headingSlot = document.createElement("div"), this._headingSlot.className = "flex-1", this._headingSlot.setAttribute("slot", "heading"), this._header.appendChild(this._headingSlot));
1608
1611
  let n = this._headingSlot.querySelector("mint-text");
1609
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(
1610
- (d) => d !== this._overlay && d !== this._modal && d !== this._headingSlot && d.getAttribute("slot") === "heading"
1611
- ).forEach((d) => {
1612
- this._headingSlot && d.parentElement !== this._headingSlot && this._headingSlot.appendChild(d);
1613
+ (h) => h !== this._overlay && h !== this._modal && h !== this._headingSlot && h.getAttribute("slot") === "heading"
1614
+ ).forEach((h) => {
1615
+ this._headingSlot && h.parentElement !== this._headingSlot && this._headingSlot.appendChild(h);
1613
1616
  }), 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(
1614
- (d) => d !== this._overlay && d !== this._modal && d !== this._bodySlot && d.getAttribute("slot") === "body"
1615
- ).forEach((d) => {
1616
- this._bodySlot && d.parentElement !== this._bodySlot && this._bodySlot.appendChild(d);
1617
+ (h) => h !== this._overlay && h !== this._modal && h !== this._bodySlot && h.getAttribute("slot") === "body"
1618
+ ).forEach((h) => {
1619
+ this._bodySlot && h.parentElement !== this._bodySlot && this._bodySlot.appendChild(h);
1617
1620
  }), 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));
1618
1621
  let o = this._actionsSlot.querySelector("mint-stack");
1619
1622
  o || (o = document.createElement("mint-stack"), o.setAttribute("direction", "horizontal"), o.className = "justify-end", this._actionsSlot.appendChild(o)), Array.from(this.children).filter(
1620
- (d) => d !== this._overlay && d !== this._modal && d !== this._actionsSlot && d.getAttribute("slot") === "actions"
1621
- ).forEach((d) => {
1622
- Array.from(d.children).forEach((h) => {
1623
- h.parentElement !== o && o.appendChild(h);
1624
- }), d.parentElement && d.remove();
1625
- }), Array.from(this.children).forEach((d) => {
1626
- d !== this._overlay && d !== this._modal && d.getAttribute("slot") !== "heading" && d.getAttribute("slot") !== "body" && d.getAttribute("slot") !== "actions" && d !== this._headingSlot && d !== this._bodySlot && d !== this._actionsSlot && d.parentElement !== this._bodySlot && this._bodySlot.appendChild(d);
1623
+ (h) => h !== this._overlay && h !== this._modal && h !== this._actionsSlot && h.getAttribute("slot") === "actions"
1624
+ ).forEach((h) => {
1625
+ Array.from(h.children).forEach((d) => {
1626
+ d.parentElement !== o && o.appendChild(d);
1627
+ }), h.parentElement && h.remove();
1628
+ }), Array.from(this.children).forEach((h) => {
1629
+ h !== this._overlay && h !== this._modal && h.getAttribute("slot") !== "heading" && h.getAttribute("slot") !== "body" && h.getAttribute("slot") !== "actions" && h !== this._headingSlot && h !== this._bodySlot && h !== this._actionsSlot && h.parentElement !== this._bodySlot && this._bodySlot.appendChild(h);
1627
1630
  }), this._updateBackgroundColor();
1628
1631
  }
1629
1632
  _updateBackgroundColor() {
@@ -1799,29 +1802,29 @@ class ct extends HTMLElement {
1799
1802
  switch (o) {
1800
1803
  case "down":
1801
1804
  if (l = t.bottom + a, c = t.left + t.width / 2 - s.width / 2, l + s.height > r) {
1802
- const d = t.top - s.height - a;
1803
- d >= 0 ? (o = "up", l = d) : (l = Math.max(0, r - s.height - a), l + s.height > r && (l = 0));
1805
+ const h = t.top - s.height - a;
1806
+ h >= 0 ? (o = "up", l = h) : (l = Math.max(0, r - s.height - a), l + s.height > r && (l = 0));
1804
1807
  }
1805
1808
  c < 0 && (c = a), c + s.width > n && (c = Math.max(a, n - s.width - a), c + s.width > n && (c = n - s.width));
1806
1809
  break;
1807
1810
  case "up":
1808
1811
  if (l = t.top - s.height - a, c = t.left + t.width / 2 - s.width / 2, l < 0) {
1809
- const d = t.bottom + a;
1810
- d + s.height <= r ? (o = "down", l = d) : (l = Math.min(r - s.height - a, r - s.height), l < 0 && (l = r - s.height));
1812
+ const h = t.bottom + a;
1813
+ h + s.height <= r ? (o = "down", l = h) : (l = Math.min(r - s.height - a, r - s.height), l < 0 && (l = r - s.height));
1811
1814
  }
1812
1815
  c < 0 && (c = a), c + s.width > n && (c = Math.max(a, n - s.width - a), c + s.width > n && (c = n - s.width));
1813
1816
  break;
1814
1817
  case "right":
1815
1818
  if (l = t.top + t.height / 2 - s.height / 2, c = t.right + a, c + s.width > n) {
1816
- const d = t.left - s.width - a;
1817
- d >= 0 ? (o = "left", c = d) : (c = Math.max(0, n - s.width - a), c + s.width > n && (c = n - s.width));
1819
+ const h = t.left - s.width - a;
1820
+ h >= 0 ? (o = "left", c = h) : (c = Math.max(0, n - s.width - a), c + s.width > n && (c = n - s.width));
1818
1821
  }
1819
1822
  l < 0 && (l = a), l + s.height > r && (l = Math.max(a, r - s.height - a), l + s.height > r && (l = r - s.height));
1820
1823
  break;
1821
1824
  case "left":
1822
1825
  if (l = t.top + t.height / 2 - s.height / 2, c = t.left - s.width - a, c < 0) {
1823
- const d = t.right + a;
1824
- d + s.width <= n ? (o = "right", c = d) : (c = Math.min(n - s.width - a, n - s.width), c < 0 && (c = 0));
1826
+ const h = t.right + a;
1827
+ h + s.width <= n ? (o = "right", c = h) : (c = Math.min(n - s.width - a, n - s.width), c < 0 && (c = 0));
1825
1828
  }
1826
1829
  l < 0 && (l = a), l + s.height > r && (l = Math.max(a, r - s.height - a), l + s.height > r && (l = r - s.height));
1827
1830
  break;
@@ -2067,12 +2070,12 @@ class ht extends HTMLElement {
2067
2070
  c._wrapperClickHandler || (c._wrapperClickHandler = (u) => {
2068
2071
  u.target === r && !s && (u.preventDefault(), u.stopPropagation(), this.toggle());
2069
2072
  }, r.addEventListener("click", c._wrapperClickHandler));
2070
- let d = r.querySelector("mint-icon");
2071
- d || (d = document.createElement("mint-icon"), d.setAttribute("name", "check"), d.className = "w-3.5 h-3.5 text-white pointer-events-none absolute inset-0 m-auto", d.style.transition = "opacity 200ms ease-out, transform 200ms ease-out", d.style.zIndex = "1", r.appendChild(d)), this.updateVisualState();
2073
+ let h = r.querySelector("mint-icon");
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();
2072
2075
  let p = this.querySelector(".mint-checkbox-label-container");
2073
- const h = this.querySelector(".mint-checkbox-container");
2076
+ const d = this.querySelector(".mint-checkbox-container");
2074
2077
  if (e || i) {
2075
- p ? h && p.parentElement !== h && h.appendChild(p) : (p = document.createElement("div"), p.className = "mint-checkbox-label-container flex flex-col gap-0.5 flex-1", h ? h.appendChild(p) : this.appendChild(p));
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));
2076
2079
  let u = p.querySelector(".mint-checkbox-label");
2077
2080
  e ? (u || (u = document.createElement("span"), u.className = "mint-checkbox-label text-sm font-medium text-gray-900 dark:text-gray-100 cursor-pointer select-none", p.insertBefore(u, p.firstChild)), u.textContent = e, s ? u.classList.add("opacity-40") : u.classList.remove("opacity-40")) : u && u.remove();
2078
2081
  let _ = p.querySelector(".mint-checkbox-info");
@@ -2325,9 +2328,9 @@ class dt extends HTMLElement {
2325
2328
  });
2326
2329
  let p = l.querySelector(".mint-choice-option-indicator");
2327
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);
2328
- const h = this.getInfo();
2331
+ const d = this.getInfo();
2329
2332
  let u = this.querySelector(".mint-choice-option-label-container");
2330
- if (r || h) {
2333
+ if (r || d) {
2331
2334
  u || (u = document.createElement("div"), u.className = "mint-choice-option-label-container flex flex-col gap-0.5", this.appendChild(u), Array.from(this.childNodes).forEach((g) => {
2332
2335
  var b;
2333
2336
  g.nodeType === Node.TEXT_NODE && ((b = g.textContent) != null && b.trim()) && g !== u && (g.textContent = "");
@@ -2335,7 +2338,7 @@ class dt extends HTMLElement {
2335
2338
  let f = u.querySelector(".mint-choice-option-label");
2336
2339
  r ? (f || (f = document.createElement("span"), f.className = "mint-choice-option-label", u.appendChild(f)), f.className = `mint-choice-option-label text-sm text-gray-900 dark:text-gray-100 ${e ? "opacity-40" : ""}`, f.textContent = r) : f && f.remove();
2337
2340
  let m = u.querySelector(".mint-choice-option-info");
2338
- h ? (m || (m = document.createElement("span"), m.className = "mint-choice-option-info text-xs text-gray-500 dark:text-gray-400 select-none", u.appendChild(m)), m.textContent = h, e ? m.classList.add("opacity-40") : m.classList.remove("opacity-40")) : m && m.remove();
2341
+ d ? (m || (m = document.createElement("span"), m.className = "mint-choice-option-info text-xs text-gray-500 dark:text-gray-400 select-none", u.appendChild(m)), m.textContent = d, e ? m.classList.add("opacity-40") : m.classList.remove("opacity-40")) : m && m.remove();
2339
2342
  } else u && u.remove();
2340
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();
2341
2344
  }
@@ -2758,9 +2761,9 @@ class pt extends HTMLElement {
2758
2761
  render() {
2759
2762
  var b, v, k, A;
2760
2763
  this.getType();
2761
- 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(), d = this.getAttribute("value") || (s ? "#000000" : ""), p = this.getRows(), h = this.getIcon(), u = this.getLabel(), _ = this.getInfo(), f = this.isLoading();
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(), u = this.getLabel(), _ = this.getInfo(), f = this.isLoading();
2762
2765
  if (this._renderSkeleton(f), s) {
2763
- 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 = (y) => {
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) => {
2764
2767
  this._colorPickerWrapper && this._colorPicker && this._colorPicker.matches(":focus-visible") && requestAnimationFrame(() => {
2765
2768
  var x;
2766
2769
  this._colorPicker && this._colorPicker.matches(":focus-visible") && ((x = this._colorPickerWrapper) == null || x.classList.add("ring-2", "ring-offset-1", "ring-gray-400", "dark:ring-gray-500"));
@@ -2800,7 +2803,7 @@ class pt extends HTMLElement {
2800
2803
  cancelable: !0
2801
2804
  }));
2802
2805
  }));
2803
- const E = d || "#000000";
2806
+ const E = h || "#000000";
2804
2807
  if (this._colorPicker && this._colorPicker.value !== E && (this._colorPicker.value = E), this._colorPickerWrapper && (this._colorPickerWrapper.style.backgroundColor = E), this._colorTextInput && this._colorTextInput.value !== E && (this._colorTextInput.value = E), this._colorPicker && (this._colorPicker.disabled = r), this._colorPickerWrapper && (r ? (this._colorPickerWrapper.classList.add("opacity-40", "cursor-not-allowed"), this._colorPickerWrapper.classList.remove("cursor-pointer")) : (this._colorPickerWrapper.classList.remove("opacity-40", "cursor-not-allowed"), this._colorPickerWrapper.classList.add("cursor-pointer"))), this._colorTextInput && (this._colorTextInput.disabled = r, this._colorTextInput.readOnly = a, this._colorTextInput.required = o), this._colorTextInput) {
2805
2808
  const y = this._colorTextInput;
2806
2809
  l ? y.id = l : y.removeAttribute("id"), c ? y.name = c : y.removeAttribute("name"), y.setAttribute("aria-invalid", this.hasError() ? "true" : "false"), this._element = y;
@@ -2808,7 +2811,7 @@ class pt extends HTMLElement {
2808
2811
  this._renderErrorState();
2809
2812
  return;
2810
2813
  }
2811
- if (this._wrapper || (this._wrapper = document.createElement("div"), this._wrapper.className = "relative w-full", this.appendChild(this._wrapper)), this._colorContainer && (this._colorContainer.remove(), this._colorContainer = null, this._colorPicker = null, this._colorTextInput = null), this._colorPickerWrapper && !s && (this._colorPickerWrapper.remove(), this._colorPickerWrapper = null, this._colorPicker = null, this._colorTextInput = null), h && !e ? this._icon ? this._icon.setAttribute("name", h) : (this._icon = document.createElement("mint-icon"), this._icon.setAttribute("name", h), this._icon.className = "absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400 dark:text-gray-500 pointer-events-none", this._wrapper.appendChild(this._icon)) : this._icon && (this._icon.remove(), this._icon = null), this._isNumber() && !e) {
2814
+ if (this._wrapper || (this._wrapper = document.createElement("div"), this._wrapper.className = "relative w-full", this.appendChild(this._wrapper)), this._colorContainer && (this._colorContainer.remove(), this._colorContainer = null, this._colorPicker = null, this._colorTextInput = null), this._colorPickerWrapper && !s && (this._colorPickerWrapper.remove(), this._colorPickerWrapper = null, this._colorPicker = null, this._colorTextInput = null), d && !e ? this._icon ? this._icon.setAttribute("name", d) : (this._icon = document.createElement("mint-icon"), this._icon.setAttribute("name", d), this._icon.className = "absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400 dark:text-gray-500 pointer-events-none", this._wrapper.appendChild(this._icon)) : this._icon && (this._icon.remove(), this._icon = null), this._isNumber() && !e) {
2812
2815
  if (!this._numberSpinnerContainer) {
2813
2816
  this._numberSpinnerContainer = document.createElement("div"), this._numberSpinnerContainer.className = "absolute right-1 top-1/2 -translate-y-1/2 flex flex-col h-8 pointer-events-none", this._wrapper.appendChild(this._numberSpinnerContainer), this._numberIncrementButton = document.createElement("button"), this._numberIncrementButton.type = "button", this._numberIncrementButton.className = "flex items-center justify-center w-5 h-4 text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 disabled:opacity-40 disabled:cursor-not-allowed transition-colors pointer-events-auto bg-gray-100 dark:bg-gray-600 active:bg-gray-200 dark:active:bg-gray-500 rounded";
2814
2817
  const E = document.createElement("mint-icon");
@@ -2831,11 +2834,11 @@ class pt extends HTMLElement {
2831
2834
  this._numberIncrementButton && (this._numberIncrementButton.disabled = r || a), this._numberDecrementButton && (this._numberDecrementButton.disabled = r || a);
2832
2835
  } else this._numberSpinnerContainer && (this._numberSpinnerContainer.remove(), this._numberSpinnerContainer = null, this._numberIncrementButton = null, this._numberDecrementButton = null);
2833
2836
  if (e) {
2834
- if (this._input && (this._input.remove(), this._input = null), this._textarea || (this._textarea = document.createElement("textarea"), this._wrapper.appendChild(this._textarea), this.setupEventListeners()), this._element = this._textarea, this._textarea.placeholder = n, this._textarea.disabled = r, this._textarea.readOnly = a, this._textarea.required = o, this._textarea.rows = p, 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"), c ? this._textarea.name = c : this._textarea.removeAttribute("name"), this._textarea.className = this.getInputClasses(), this.firstChild && this.firstChild !== this._wrapper && this.firstChild.nodeType === Node.TEXT_NODE) {
2837
+ if (this._input && (this._input.remove(), this._input = null), this._textarea || (this._textarea = document.createElement("textarea"), this._wrapper.appendChild(this._textarea), this.setupEventListeners()), this._element = this._textarea, this._textarea.placeholder = n, this._textarea.disabled = r, this._textarea.readOnly = a, this._textarea.required = o, this._textarea.rows = p, this._textarea.setAttribute("aria-invalid", this.hasError() ? "true" : "false"), h !== this._textarea.value && (this._textarea.value = h), l ? this._textarea.id = l : this._textarea.removeAttribute("id"), c ? this._textarea.name = c : this._textarea.removeAttribute("name"), this._textarea.className = this.getInputClasses(), this.firstChild && this.firstChild !== this._wrapper && this.firstChild.nodeType === Node.TEXT_NODE) {
2835
2838
  const E = this.firstChild.textContent;
2836
2839
  E && !this._textarea.value && (this._textarea.value = E.trim()), this.removeChild(this.firstChild);
2837
2840
  }
2838
- } 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 = t, this._input.placeholder = n, this._input.disabled = r, this._input.readOnly = a, this._input.required = o, 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"), c ? this._input.name = c : this._input.removeAttribute("name"), this._input.className = this.getInputClasses(), this.firstChild && this.firstChild !== this._wrapper && this.firstChild.nodeType === Node.TEXT_NODE) {
2841
+ } 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 = t, this._input.placeholder = n, this._input.disabled = r, this._input.readOnly = a, this._input.required = o, 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")), h !== this._input.value && (this._input.value = h), l ? this._input.id = l : this._input.removeAttribute("id"), c ? this._input.name = c : this._input.removeAttribute("name"), this._input.className = this.getInputClasses(), this.firstChild && this.firstChild !== this._wrapper && this.firstChild.nodeType === Node.TEXT_NODE) {
2839
2842
  const E = this.firstChild.textContent;
2840
2843
  E && !this._input.value && (this._input.value = E.trim()), this.removeChild(this.firstChild);
2841
2844
  }
@@ -3164,10 +3167,10 @@ class ft extends HTMLElement {
3164
3167
  }), s.addEventListener("keydown", (a) => {
3165
3168
  a.key === "Backspace" && s.selectionStart === 0 && s.selectionEnd === 0 && this._focusPrev(t, n), a.key === "ArrowLeft" && s.selectionStart === 0 && s.selectionEnd === 0 && (this._focusPrev(t, n), a.preventDefault()), a.key === "ArrowRight" && s.selectionStart === s.value.length && s.selectionEnd === s.value.length && (this._focusNext(t, n), a.preventDefault());
3166
3169
  }), s.addEventListener("blur", (a) => {
3167
- var c, d;
3170
+ var c, h;
3168
3171
  this._syncHiddenInput();
3169
3172
  const o = a.relatedTarget;
3170
- o && (this.contains(o) || (c = this._popover) != null && c.contains(o) || this._calendarContainer && this._calendarContainer.contains(o)) || (this._handleBlur(((d = this._hiddenInput) == null ? void 0 : d.value) || ""), this._exitInputMode(), setTimeout(() => {
3173
+ o && (this.contains(o) || (c = this._popover) != null && c.contains(o) || this._calendarContainer && this._calendarContainer.contains(o)) || (this._handleBlur(((h = this._hiddenInput) == null ? void 0 : h.value) || ""), this._exitInputMode(), setTimeout(() => {
3171
3174
  if (this._hiddenInput) {
3172
3175
  const p = new FocusEvent("blur", {
3173
3176
  bubbles: !0,
@@ -3189,8 +3192,8 @@ class ft extends HTMLElement {
3189
3192
  if (this._isRange || s === "week" || s === "month") {
3190
3193
  const [r, a] = this._splitRangeInput(t, e), o = r ? this._parseDateString(r, e) : null, l = a ? this._parseDateString(a, e) : null;
3191
3194
  if (o && l) {
3192
- const [c, d] = o <= l ? [o, l] : [l, o];
3193
- this._selectedStartDate = c, this._selectedEndDate = d, this._currentMonth = c.getMonth(), this._currentYear = c.getFullYear();
3195
+ const [c, h] = o <= l ? [o, l] : [l, o];
3196
+ this._selectedStartDate = c, this._selectedEndDate = h, this._currentMonth = c.getMonth(), this._currentYear = c.getFullYear();
3194
3197
  } else o && (this._selectedStartDate = o, this._selectedEndDate = null, this._currentMonth = o.getMonth(), this._currentYear = o.getFullYear());
3195
3198
  this._applyDateToParts(this._selectedStartDate, this._startPartInputs, i, e), this._applyDateToParts(this._selectedEndDate, this._endPartInputs, i, e);
3196
3199
  } else {
@@ -3231,13 +3234,13 @@ class ft extends HTMLElement {
3231
3234
  { char: "m", index: o },
3232
3235
  { char: "y", index: l }
3233
3236
  ].sort((f, m) => f.index - m.index);
3234
- let d = 0, p = 0, h = 0, u = 0;
3237
+ let h = 0, p = 0, d = 0, u = 0;
3235
3238
  r.length, n.length;
3236
3239
  for (const f of c)
3237
3240
  if (f.char === "d") {
3238
3241
  const m = r.lastIndexOf("d") - r.indexOf("d") + 1, g = n.substr(u, m);
3239
3242
  if (g.length === 0) return null;
3240
- d = parseInt(g, 10), u += g.length;
3243
+ h = parseInt(g, 10), u += g.length;
3241
3244
  } else if (f.char === "m") {
3242
3245
  const m = r.lastIndexOf("m") - r.indexOf("m") + 1, g = n.substr(u, m);
3243
3246
  if (g.length === 0) return null;
@@ -3246,11 +3249,11 @@ class ft extends HTMLElement {
3246
3249
  const m = r.lastIndexOf("y") - r.indexOf("y") + 1, g = n.substr(u), b = Math.min(m, g.length), v = g.substr(0, b);
3247
3250
  if (v.length === 0) return null;
3248
3251
  let k = parseInt(v, 10);
3249
- b === 2 && m === 4 ? k = Math.floor((/* @__PURE__ */ new Date()).getFullYear() / 100) * 100 + k : b === 2 && m === 2 && (k = Math.floor((/* @__PURE__ */ new Date()).getFullYear() / 100) * 100 + k), h = k, u += b;
3252
+ b === 2 && m === 4 ? k = Math.floor((/* @__PURE__ */ new Date()).getFullYear() / 100) * 100 + k : b === 2 && m === 2 && (k = Math.floor((/* @__PURE__ */ new Date()).getFullYear() / 100) * 100 + k), d = k, u += b;
3250
3253
  }
3251
- if (!d || p < 0 || p > 11 || !h) return null;
3252
- const _ = new Date(h, p, d);
3253
- return isNaN(_.getTime()) || _.getDate() !== d || _.getMonth() !== p || _.getFullYear() !== h ? null : _;
3254
+ if (!h || p < 0 || p > 11 || !d) return null;
3255
+ const _ = new Date(d, p, h);
3256
+ return isNaN(_.getTime()) || _.getDate() !== h || _.getMonth() !== p || _.getFullYear() !== d ? null : _;
3254
3257
  }
3255
3258
  _formatDate(t, e) {
3256
3259
  const i = t.getDate(), s = t.getMonth() + 1, n = t.getFullYear(), r = e.toLowerCase();
@@ -3259,15 +3262,15 @@ class ft extends HTMLElement {
3259
3262
  }
3260
3263
  // PHP-style formatter for display mode
3261
3264
  _formatDatePhp(t, e) {
3262
- 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 = (h, u = 2) => h.toString().padStart(u, "0"), d = (h) => {
3263
- const u = h % 10, _ = h % 100;
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, u = 2) => d.toString().padStart(u, "0"), h = (d) => {
3266
+ const u = d % 10, _ = d % 100;
3264
3267
  return u === 1 && _ !== 11 ? "st" : u === 2 && _ !== 12 ? "nd" : u === 3 && _ !== 13 ? "rd" : "th";
3265
3268
  };
3266
3269
  let p = "";
3267
- for (let h = 0; h < e.length; h++) {
3268
- const u = e[h];
3269
- if (u === "\\" && h + 1 < e.length) {
3270
- p += e[h + 1], h++;
3270
+ for (let d = 0; d < e.length; d++) {
3271
+ const u = e[d];
3272
+ if (u === "\\" && d + 1 < e.length) {
3273
+ p += e[d + 1], d++;
3271
3274
  continue;
3272
3275
  }
3273
3276
  switch (u) {
@@ -3302,7 +3305,7 @@ class ft extends HTMLElement {
3302
3305
  p += r[t.getDay()];
3303
3306
  break;
3304
3307
  case "S":
3305
- p += d(i);
3308
+ p += h(i);
3306
3309
  break;
3307
3310
  default:
3308
3311
  p += u;
@@ -3316,8 +3319,8 @@ class ft extends HTMLElement {
3316
3319
  return i !== null && !isNaN(i.getTime());
3317
3320
  }
3318
3321
  render() {
3319
- 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(), d = this.hasError(), p = this.getErrorMessage(), h = this.getSelectionMode();
3320
- this._isRange = this.isRange() || h === "week" || h === "month", this._input || (this._input = document.createElement("div"), this._input.className = "relative w-full", this.appendChild(this._input));
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
+ 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));
3321
3324
  let u = this.querySelector(".mint-date-picker-label-container");
3322
3325
  if (e || i) {
3323
3326
  u || (u = document.createElement("div"), u.className = "mint-date-picker-label-container flex flex-col gap-0.5 mb-[.25rem]", this.contains(this._input) ? this.insertBefore(u, this._input) : this.appendChild(u));
@@ -3326,9 +3329,9 @@ class ft extends HTMLElement {
3326
3329
  let k = u.querySelector(".mint-date-picker-info");
3327
3330
  i ? (k || (k = document.createElement("span"), k.className = "mint-date-picker-info text-xs text-gray-500 dark:text-gray-400 select-none", u.appendChild(k)), k.textContent = i) : k && k.remove();
3328
3331
  } else u && u.remove();
3329
- 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", d ? "true" : "false");
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");
3330
3333
  let _ = this._input.querySelector(".mint-date-fields");
3331
- _ || (_ = document.createElement("div"), this._input.appendChild(_)), this._fieldsContainer = _, this._applyErrorVisuals(d, p, n), _.innerHTML = "", this._displayEl = document.createElement("div");
3334
+ _ || (_ = document.createElement("div"), this._input.appendChild(_)), this._fieldsContainer = _, this._applyErrorVisuals(h, p, n), _.innerHTML = "", this._displayEl = document.createElement("div");
3332
3335
  const f = r ? "select-text" : "select-none";
3333
3336
  this._displayEl.className = `flex-1 text-gray-900 dark:text-white ${r ? "cursor-default" : "cursor-text"} ${f} focus:outline-none`, this._displayEl.tabIndex = n || r ? -1 : 0, this._displayEl.addEventListener("click", () => {
3334
3337
  n || r || this._enterInputMode();
@@ -3367,7 +3370,7 @@ class ft extends HTMLElement {
3367
3370
  n || r || this._enterInputMode();
3368
3371
  }), this._input.prepend(this._iconButton), this._iconButton.disabled = n || r;
3369
3372
  }
3370
- this._renderErrorState(d, p), this._renderSkeleton(t);
3373
+ this._renderErrorState(h, p), this._renderSkeleton(t);
3371
3374
  }
3372
3375
  _renderErrorState(t, e) {
3373
3376
  let i = this.querySelector(".mint-date-picker-error");
@@ -3415,8 +3418,8 @@ class ft extends HTMLElement {
3415
3418
  if (s) {
3416
3419
  const [n, r] = this._splitRangeInput(t, e), a = n ? this._parseDateString(n, e) : null, o = r ? this._parseDateString(r, e) : null;
3417
3420
  if (a && o) {
3418
- const [l, c] = a <= o ? [a, o] : [o, a], d = this._formatDate(l, e), p = this._formatDate(c, e), h = `${d} - ${p}`;
3419
- this.setValue(h), this._applyDateToParts(l, this._startPartInputs, this._getFormatTokens(e), e), this._applyDateToParts(c, this._endPartInputs, this._getFormatTokens(e), e), this._selectedStartDate = l, this._selectedEndDate = c, this._currentMonth = l.getMonth(), this._currentYear = l.getFullYear();
3421
+ const [l, c] = a <= o ? [a, o] : [o, a], h = this._formatDate(l, e), p = this._formatDate(c, e), d = `${h} - ${p}`;
3422
+ this.setValue(d), this._applyDateToParts(l, this._startPartInputs, this._getFormatTokens(e), e), this._applyDateToParts(c, this._endPartInputs, this._getFormatTokens(e), e), this._selectedStartDate = l, this._selectedEndDate = c, this._currentMonth = l.getMonth(), this._currentYear = l.getFullYear();
3420
3423
  } else if (a) {
3421
3424
  const l = this._formatDate(a, e);
3422
3425
  this.setValue(l), this._applyDateToParts(a, this._startPartInputs, this._getFormatTokens(e), e), this._applyDateToParts(null, this._endPartInputs, this._getFormatTokens(e), e), this._selectedStartDate = a, this._selectedEndDate = null, this._currentMonth = a.getMonth(), this._currentYear = a.getFullYear();
@@ -3525,14 +3528,14 @@ class ft extends HTMLElement {
3525
3528
  l.className = "flex flex-col md:flex-row md:gap-6 md:items-start";
3526
3529
  const c = document.createElement("div");
3527
3530
  c.className = "flex-1 min-w-0";
3528
- const d = document.createElement("div");
3529
- d.className = "flex items-center justify-between mb-4";
3531
+ const h = document.createElement("div");
3532
+ h.className = "flex items-center justify-between mb-4";
3530
3533
  const p = document.createElement("button");
3531
3534
  p.type = "button", p.tabIndex = 0, p.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", p.setAttribute("data-keep-popover-open", "true");
3532
- const h = document.createElement("mint-icon");
3533
- h.setAttribute("name", "caret-left"), h.className = "w-4 h-4", p.appendChild(h), p.addEventListener("click", () => {
3535
+ const d = document.createElement("mint-icon");
3536
+ d.setAttribute("name", "caret-left"), d.className = "w-4 h-4", p.appendChild(d), p.addEventListener("click", () => {
3534
3537
  this._currentMonth === 0 ? (this._currentMonth = 11, this._currentYear--) : this._currentMonth--, this._buildCalendar();
3535
- }), d.appendChild(p);
3538
+ }), h.appendChild(p);
3536
3539
  const u = document.createElement("div");
3537
3540
  u.className = "flex items-center gap-2";
3538
3541
  const _ = document.createElement("button");
@@ -3542,13 +3545,13 @@ class ft extends HTMLElement {
3542
3545
  const f = document.createElement("button");
3543
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", () => {
3544
3547
  this._viewMode = "year", this._buildCalendar();
3545
- }), u.appendChild(f), d.appendChild(u);
3548
+ }), u.appendChild(f), h.appendChild(u);
3546
3549
  const m = document.createElement("button");
3547
3550
  m.type = "button", m.tabIndex = 0, m.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", m.setAttribute("data-keep-popover-open", "true");
3548
3551
  const g = document.createElement("mint-icon");
3549
3552
  g.setAttribute("name", "caret-right"), g.className = "w-4 h-4", m.appendChild(g), m.addEventListener("click", () => {
3550
3553
  this._currentMonth === 11 ? (this._currentMonth = 0, this._currentYear++) : this._currentMonth++, this._buildCalendar();
3551
- }), d.appendChild(m);
3554
+ }), h.appendChild(m);
3552
3555
  const b = document.createElement("div");
3553
3556
  b.className = "grid grid-cols-7 mb-2", r.forEach((C) => {
3554
3557
  const I = document.createElement("div");
@@ -3659,7 +3662,7 @@ class ft extends HTMLElement {
3659
3662
  }), S.appendChild(D);
3660
3663
  }), I.appendChild(S), C.appendChild(I), l.appendChild(C);
3661
3664
  }
3662
- c.appendChild(d), c.appendChild(b), c.appendChild(v), l.appendChild(c), this._calendarContainer.appendChild(l);
3665
+ c.appendChild(h), c.appendChild(b), c.appendChild(v), l.appendChild(c), this._calendarContainer.appendChild(l);
3663
3666
  }
3664
3667
  _buildMonthView() {
3665
3668
  if (!this._calendarContainer) return;
@@ -3683,12 +3686,12 @@ class ft extends HTMLElement {
3683
3686
  }), e.appendChild(r);
3684
3687
  const o = document.createElement("div");
3685
3688
  o.className = "grid grid-cols-3 gap-2", t.forEach((l, c) => {
3686
- const d = document.createElement("button");
3687
- d.type = "button", d.tabIndex = 0, d.setAttribute("data-keep-popover-open", "true");
3689
+ const h = document.createElement("button");
3690
+ h.type = "button", h.tabIndex = 0, h.setAttribute("data-keep-popover-open", "true");
3688
3691
  const p = this._currentMonth === c;
3689
- 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 ${p ? "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", () => {
3692
+ h.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 ${p ? "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"}`, h.textContent = l, h.addEventListener("click", () => {
3690
3693
  this._currentMonth = c, this._viewMode = "calendar", this._buildCalendar();
3691
- }), o.appendChild(d);
3694
+ }), o.appendChild(h);
3692
3695
  }), this._calendarContainer.appendChild(e), this._calendarContainer.appendChild(o);
3693
3696
  }
3694
3697
  _buildYearView() {
@@ -3712,12 +3715,12 @@ class ft extends HTMLElement {
3712
3715
  const l = document.createElement("div");
3713
3716
  l.className = "grid grid-cols-3 gap-2";
3714
3717
  for (let c = t; c <= e; c++) {
3715
- const d = document.createElement("button");
3716
- d.type = "button", d.tabIndex = 0, d.setAttribute("data-keep-popover-open", "true");
3718
+ const h = document.createElement("button");
3719
+ h.type = "button", h.tabIndex = 0, h.setAttribute("data-keep-popover-open", "true");
3717
3720
  const p = this._currentYear === c;
3718
- 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 ${p ? "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(c), d.addEventListener("click", () => {
3721
+ h.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 ${p ? "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"}`, h.textContent = String(c), h.addEventListener("click", () => {
3719
3722
  this._currentYear = c, this._viewMode = "calendar", this._buildCalendar();
3720
- }), l.appendChild(d);
3723
+ }), l.appendChild(h);
3721
3724
  }
3722
3725
  this._calendarContainer.appendChild(i), this._calendarContainer.appendChild(l);
3723
3726
  }
@@ -4022,30 +4025,30 @@ class mt extends HTMLElement {
4022
4025
  }
4023
4026
  render() {
4024
4027
  const t = this.isLoading(), e = [];
4025
- this._select && Array.from(this._select.children).forEach((h) => {
4026
- (h.tagName === "OPTION" || h.tagName === "OPTGROUP") && e.push(h.cloneNode(!0));
4028
+ this._select && Array.from(this._select.children).forEach((d) => {
4029
+ (d.tagName === "OPTION" || d.tagName === "OPTGROUP") && e.push(d.cloneNode(!0));
4027
4030
  });
4028
- const i = Array.from(this.children).filter((h) => h.tagName === "OPTION" || h.tagName === "OPTGROUP").map((h) => h.cloneNode(!0));
4031
+ const i = Array.from(this.children).filter((d) => d.tagName === "OPTION" || d.tagName === "OPTGROUP").map((d) => d.cloneNode(!0));
4029
4032
  for (; this.firstChild; )
4030
4033
  this.removeChild(this.firstChild);
4031
4034
  this._wrapper = null, this._select = null;
4032
- const s = this.getLabel(), n = this.getInfo(), r = this.getId(), a = this.getName(), o = this.getValue(), l = this.isDisabled(), c = this.isMultiple(), d = this.hasError();
4035
+ const s = this.getLabel(), n = this.getInfo(), r = this.getId(), a = this.getName(), o = this.getValue(), l = this.isDisabled(), c = this.isMultiple(), h = this.hasError();
4033
4036
  if (s) {
4034
- const h = document.createElement("label");
4035
- h.className = "block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1", r && h.setAttribute("for", r);
4037
+ const d = document.createElement("label");
4038
+ d.className = "block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1", r && d.setAttribute("for", r);
4036
4039
  const u = document.createTextNode(s);
4037
- h.appendChild(u), this.appendChild(h);
4040
+ d.appendChild(u), this.appendChild(d);
4038
4041
  }
4039
- 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", d ? "true" : "false");
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");
4040
4043
  const p = i.length > 0 ? i : e;
4041
- if (p.length > 0 && p.forEach((h) => {
4042
- this._select.appendChild(h);
4044
+ if (p.length > 0 && p.forEach((d) => {
4045
+ this._select.appendChild(d);
4043
4046
  }), this._select.options.length === 0) {
4044
- const h = document.createElement("option");
4045
- h.value = "", h.textContent = "Select an option", h.disabled = !0, h.selected = !0, this._select.appendChild(h);
4047
+ const d = document.createElement("option");
4048
+ d.value = "", d.textContent = "Select an option", d.disabled = !0, d.selected = !0, this._select.appendChild(d);
4046
4049
  }
4047
- if (this._select.value = o || "", this._changeHandler && this._select && this._select.removeEventListener("change", this._changeHandler), this._changeHandler = (h) => {
4048
- const _ = h.target.value;
4050
+ if (this._select.value = o || "", this._changeHandler && this._select && this._select.removeEventListener("change", this._changeHandler), this._changeHandler = (d) => {
4051
+ const _ = d.target.value;
4049
4052
  (this.getAttribute("value") || "") !== _ && (_ ? this.setAttribute("value", _) : this.removeAttribute("value"));
4050
4053
  const m = new Event("input", {
4051
4054
  bubbles: !0,
@@ -4064,11 +4067,11 @@ class mt extends HTMLElement {
4064
4067
  composed: !0
4065
4068
  }));
4066
4069
  }, this._select.addEventListener("change", this._changeHandler), this._optionObserver && this._optionObserver.disconnect(), this._optionObserver = new MutationObserver(() => {
4067
- const h = this.getAttribute("value") || this.value || "";
4068
- this._select && h && requestAnimationFrame(() => {
4070
+ const d = this.getAttribute("value") || this.value || "";
4071
+ this._select && d && requestAnimationFrame(() => {
4069
4072
  this._select && Array.from(this._select.options).some(
4070
- (_) => _.value === h
4071
- ) && this._select.value !== h && (this._select.value = h);
4073
+ (_) => _.value === d
4074
+ ) && this._select.value !== d && (this._select.value = d);
4072
4075
  });
4073
4076
  }), this._optionObserver.observe(this._select, {
4074
4077
  childList: !0,
@@ -4076,12 +4079,12 @@ class mt extends HTMLElement {
4076
4079
  }), this._wrapper.appendChild(this._select), c)
4077
4080
  this._caretUpIcon = null, this._caretDownIcon = null;
4078
4081
  else {
4079
- const h = document.createElement("div");
4080
- h.className = "absolute right-2 top-1/2 -translate-y-1/2 pointer-events-none z-10 flex flex-col", this._caretUpIcon = document.createElement("mint-icon"), this._caretUpIcon.setAttribute("name", "caret-up"), this._caretUpIcon.className = "w-[.9em] h-[.9em] text-gray-400 dark:text-gray-500 mb-[-.2rem]", h.appendChild(this._caretUpIcon), this._caretDownIcon = document.createElement("mint-icon"), this._caretDownIcon.setAttribute("name", "caret-down"), this._caretDownIcon.className = "w-[.9em] h-[.9em] text-gray-400 dark:text-gray-500 mt-[-.2rem]", h.appendChild(this._caretDownIcon), this._wrapper.appendChild(h);
4082
+ const d = document.createElement("div");
4083
+ d.className = "absolute right-2 top-1/2 -translate-y-1/2 pointer-events-none z-10 flex flex-col", this._caretUpIcon = document.createElement("mint-icon"), this._caretUpIcon.setAttribute("name", "caret-up"), this._caretUpIcon.className = "w-[.9em] h-[.9em] text-gray-400 dark:text-gray-500 mb-[-.2rem]", d.appendChild(this._caretUpIcon), this._caretDownIcon = document.createElement("mint-icon"), this._caretDownIcon.setAttribute("name", "caret-down"), this._caretDownIcon.className = "w-[.9em] h-[.9em] text-gray-400 dark:text-gray-500 mt-[-.2rem]", d.appendChild(this._caretDownIcon), this._wrapper.appendChild(d);
4081
4084
  }
4082
4085
  if (n) {
4083
- const h = document.createElement("div");
4084
- h.className = "mt-1 text-xs text-gray-500 dark:text-gray-400", h.textContent = n, this.appendChild(h);
4086
+ const d = document.createElement("div");
4087
+ d.className = "mt-1 text-xs text-gray-500 dark:text-gray-400", d.textContent = n, this.appendChild(d);
4085
4088
  }
4086
4089
  this._renderErrorState(), this._renderSkeleton(t);
4087
4090
  }
@@ -4208,12 +4211,12 @@ class gt extends HTMLElement {
4208
4211
  render() {
4209
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();
4210
4213
  this._dropzone || (this._dropzone = document.createElement("div"), this.appendChild(this._dropzone)), this._updateDragStateClass(), this._dropzone.setAttribute("aria-invalid", l ? "true" : "false"), n ? (this._dropzone.setAttribute("tabindex", "-1"), this._dropzone.removeAttribute("role")) : (this._dropzone.setAttribute("tabindex", "0"), this._dropzone.setAttribute("role", "button"), this._dropzone.setAttribute("aria-label", e || "File upload dropzone")), this._dropzone.style.width = r, this._dropzone.style.height = a, this._dropzone.style.minWidth = r, this._dropzone.style.minHeight = a, this._fileInput || (this._fileInput = document.createElement("input"), this._fileInput.type = "file", this._fileInput.style.display = "none", this._fileInput.setAttribute("tabindex", "-1"), this._fileInput.setAttribute("aria-hidden", "true"), this._dropzone.appendChild(this._fileInput)), this._fileInput.accept = i, this._fileInput.multiple = s, this._fileInput.disabled = n, o ? this._fileInput.name = o : this._fileInput.removeAttribute("name"), this._fileInput.setAttribute("aria-invalid", l ? "true" : "false");
4211
- const d = this._dropzone.querySelector(".mint-dropzone-icon"), p = this._dropzone.querySelector(".mint-dropzone-label");
4212
- d && d.remove(), p && p.remove();
4213
- const h = document.createElement("div");
4214
- h.className = "mint-dropzone-icon flex items-center justify-center mt-2 mb-2 flex-shrink-0";
4214
+ const h = this._dropzone.querySelector(".mint-dropzone-icon"), p = this._dropzone.querySelector(".mint-dropzone-label");
4215
+ h && h.remove(), p && p.remove();
4216
+ const d = document.createElement("div");
4217
+ d.className = "mint-dropzone-icon flex items-center justify-center mt-2 mb-2 flex-shrink-0";
4215
4218
  const u = document.createElement("mint-icon");
4216
- if (u.setAttribute("name", "upload"), u.className = "w-12 h-12 text-gray-400 dark:text-gray-500", h.appendChild(u), this._dropzone.appendChild(h), e) {
4219
+ if (u.setAttribute("name", "upload"), u.className = "w-12 h-12 text-gray-400 dark:text-gray-500", d.appendChild(u), this._dropzone.appendChild(d), e) {
4217
4220
  const _ = document.createElement("div");
4218
4221
  _.className = "mint-dropzone-label text-sm font-medium text-gray-600 dark:text-gray-400 text-center px-4 flex-shrink-0", _.textContent = e, this._dropzone.appendChild(_);
4219
4222
  }
@@ -4371,24 +4374,24 @@ class gt extends HTMLElement {
4371
4374
  t.className = "mint-dropzone-previews-wrapper mt-3 w-full relative max-h-48";
4372
4375
  const e = document.createElement("div");
4373
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) => {
4374
- const d = document.createElement("div");
4375
- 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/")) {
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-600 bg-gray-50 dark:bg-gray-800", l.type.startsWith("image/")) {
4376
4379
  const _ = document.createElement("img");
4377
4380
  _.className = "w-12 h-12 object-cover rounded border border-gray-200 dark:border-gray-700";
4378
4381
  const f = URL.createObjectURL(l);
4379
- this._previewUrls.push(f), _.src = f, d.appendChild(_);
4382
+ this._previewUrls.push(f), _.src = f, h.appendChild(_);
4380
4383
  } else {
4381
4384
  const _ = document.createElement("mint-icon");
4382
- _.setAttribute("name", "attach"), _.className = "w-5 h-5 text-gray-500 dark:text-gray-300", d.appendChild(_);
4385
+ _.setAttribute("name", "attach"), _.className = "w-5 h-5 text-gray-500 dark:text-gray-300", h.appendChild(_);
4383
4386
  }
4384
4387
  const p = document.createElement("div");
4385
- p.className = "flex-1 text-sm text-gray-800 dark:text-gray-100 truncate", p.textContent = l.name, d.appendChild(p);
4386
- const h = document.createElement("button");
4387
- h.type = "button", h.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";
4388
+ p.className = "flex-1 text-sm text-gray-800 dark:text-gray-100 truncate", p.textContent = l.name, h.appendChild(p);
4389
+ const d = document.createElement("button");
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";
4388
4391
  const u = document.createElement("mint-icon");
4389
- u.setAttribute("name", "close"), u.className = "w-4 h-4", h.appendChild(u), h.addEventListener("click", (_) => {
4392
+ u.setAttribute("name", "close"), u.className = "w-4 h-4", d.appendChild(u), d.addEventListener("click", (_) => {
4390
4393
  _.preventDefault(), _.stopPropagation(), this._removeFileAt(c);
4391
- }), d.appendChild(h), e.appendChild(d);
4394
+ }), h.appendChild(d), e.appendChild(h);
4392
4395
  });
4393
4396
  const i = this.hasError(), s = this._isDragging;
4394
4397
  let n = "from-white dark:from-gray-700";
@@ -4398,8 +4401,8 @@ class gt extends HTMLElement {
4398
4401
  const a = document.createElement("div");
4399
4402
  a.className = `absolute bottom-0 left-0 right-0 h-4 pointer-events-none z-10 bg-gradient-to-t ${n} to-transparent opacity-100 transition-opacity duration-200`, t.appendChild(a);
4400
4403
  const o = () => {
4401
- const l = e.scrollTop, c = e.scrollHeight, d = e.clientHeight;
4402
- l > 0 ? r.style.opacity = "1" : r.style.opacity = "0", l + d < c - 1 ? a.style.opacity = "1" : a.style.opacity = "0";
4404
+ const l = e.scrollTop, c = e.scrollHeight, h = e.clientHeight;
4405
+ l > 0 ? r.style.opacity = "1" : r.style.opacity = "0", l + h < c - 1 ? a.style.opacity = "1" : a.style.opacity = "0";
4403
4406
  };
4404
4407
  o(), e.addEventListener("scroll", o), t.appendChild(e), this._previewContainer = t, this._dropzone.appendChild(t), this._updateDragStateClass();
4405
4408
  }
@@ -4530,14 +4533,14 @@ class _t extends HTMLElement {
4530
4533
  t && (this._form.action = t), e && (this._form.method = e), this._form.enctype = i;
4531
4534
  }
4532
4535
  async _handleSubmit(t) {
4533
- var l;
4536
+ var c;
4534
4537
  if (t.preventDefault(), !this._form) return;
4535
4538
  this._clearErrors(), this._syncDropzoneFiles();
4536
4539
  const e = this._collectValidationRules(), i = new FormData(this._form);
4537
4540
  let s = this._formDataToValues(i);
4538
4541
  if (this._formData) {
4539
- const c = this._getReactiveValue(this._formData);
4540
- c && typeof c == "object" && !Array.isArray(c) && (s = { ...this._extractReactiveData(c), ...s });
4542
+ const h = this._getReactiveValue(this._formData);
4543
+ h && typeof h == "object" && !Array.isArray(h) && (s = { ...this._extractReactiveData(h), ...s });
4541
4544
  }
4542
4545
  if (!this._validate(s, e)) {
4543
4546
  this.dispatchEvent(new CustomEvent("invalid", {
@@ -4549,26 +4552,33 @@ class _t extends HTMLElement {
4549
4552
  return;
4550
4553
  }
4551
4554
  const r = new CustomEvent("submit", {
4552
- detail: { formData: i, values: s },
4555
+ detail: { formData: i, values: s, form: this },
4556
+ bubbles: !0,
4557
+ cancelable: !0,
4558
+ composed: !0
4559
+ });
4560
+ this.dispatchEvent(r), r.form = this;
4561
+ const a = new CustomEvent("mintFormSubmit", {
4562
+ detail: { formData: i, values: s, form: this },
4553
4563
  bubbles: !0,
4554
4564
  cancelable: !0,
4555
4565
  composed: !0
4556
4566
  });
4557
- if (this.dispatchEvent(r), r.defaultPrevented)
4567
+ if (a.form = this, this.dispatchEvent(a), r.defaultPrevented || a.defaultPrevented)
4558
4568
  return;
4559
- const a = this.getAttribute("action"), o = this.getAttribute("method");
4560
- if (!(!a || !o)) {
4569
+ const o = this.getAttribute("action"), l = this.getAttribute("method");
4570
+ if (!(!o || !l)) {
4561
4571
  this._setButtonsSubmitting();
4562
4572
  try {
4563
- const c = await this._submitData(i, s);
4573
+ const h = await this._submitData(i, s);
4564
4574
  this.dispatchEvent(new CustomEvent("submitsuccess", {
4565
- detail: c,
4575
+ detail: h,
4566
4576
  bubbles: !0,
4567
4577
  cancelable: !0
4568
4578
  }));
4569
- } catch (c) {
4570
- (c == null ? void 0 : c.status) === 422 && ((l = c == null ? void 0 : c.data) != null && l.errors) && this._applyServerErrors(c.data.errors), this.dispatchEvent(new CustomEvent("submiterror", {
4571
- detail: { error: c },
4579
+ } catch (h) {
4580
+ (h == null ? void 0 : h.status) === 422 && ((c = h == null ? void 0 : h.data) != null && c.errors) && this._applyServerErrors(h.data.errors), this.dispatchEvent(new CustomEvent("submiterror", {
4581
+ detail: { error: h },
4572
4582
  bubbles: !0,
4573
4583
  cancelable: !0
4574
4584
  }));
@@ -4578,7 +4588,7 @@ class _t extends HTMLElement {
4578
4588
  }
4579
4589
  }
4580
4590
  async _submitData(t, e) {
4581
- var d, p, h;
4591
+ var h, p, d;
4582
4592
  const i = this.getAttribute("action"), s = this.getAttribute("method"), n = this.getAttribute("enctype") || "application/x-www-form-urlencoded";
4583
4593
  if (!i)
4584
4594
  return { status: 0, ok: !0, data: { values: e } };
@@ -4586,7 +4596,7 @@ class _t extends HTMLElement {
4586
4596
  let a = null;
4587
4597
  const o = {};
4588
4598
  let l = i;
4589
- if (typeof window < "u" && ((h = (p = (d = window.mintForm) == null ? void 0 : d.defaults) == null ? void 0 : p.headers) != null && h.common) && Object.assign(o, window.mintForm.defaults.headers.common), this._headers && Object.assign(o, this._headers), s === "GET") {
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") {
4590
4600
  const u = new URLSearchParams();
4591
4601
  t.forEach((_, f) => {
4592
4602
  _ instanceof File || u.append(f, String(_));
@@ -4724,7 +4734,7 @@ class _t extends HTMLElement {
4724
4734
  const o = Array.from(r.files);
4725
4735
  e[a] && Array.isArray(e[a]) ? o.forEach((l) => {
4726
4736
  e[a].some(
4727
- (d) => d.name === l.name && d.size === l.size && d.lastModified === l.lastModified
4737
+ (h) => h.name === l.name && h.size === l.size && h.lastModified === l.lastModified
4728
4738
  ) || e[a].push(l);
4729
4739
  }) : e[a] = o;
4730
4740
  }
@@ -4915,6 +4925,13 @@ class _t extends HTMLElement {
4915
4925
  t.removeAttribute("aria-invalid");
4916
4926
  }), this._errors = {};
4917
4927
  }
4928
+ /**
4929
+ * Public method to set form errors programmatically
4930
+ * Can be called from event handlers to set validation errors
4931
+ */
4932
+ setFormErrors(t) {
4933
+ this._applyServerErrors(t);
4934
+ }
4918
4935
  _applyServerErrors(t) {
4919
4936
  this._clearErrors(), Object.entries(t).forEach(([e, i]) => {
4920
4937
  const s = Array.isArray(i) ? i[0] || "Validation error" : i || "Validation error", n = this._getFieldElements(e);
@@ -5066,8 +5083,8 @@ class _t extends HTMLElement {
5066
5083
  if (!n) return;
5067
5084
  const r = this._getFieldName(n);
5068
5085
  if (!r || !this._collectValidationRules()[r]) return;
5069
- const o = this._extractFieldValue([n]), l = o != null && (typeof o == "string" ? o.trim() !== "" : o instanceof FileList || Array.isArray(o) ? o.length > 0 : !0), c = n.hasAttribute("data-mint-form-error") || s instanceof HTMLElement && (s.hasAttribute("aria-invalid") || s.closest("[data-mint-form-error]")), d = !!n.closest("mint-tags"), p = n.tagName === "MINT-CHECKBOX" || n.tagName === "MINT-SWITCH" || n.tagName === "MINT-CHOICE" || s instanceof HTMLElement && (s.closest("mint-checkbox, mint-switch, mint-choice") || s.closest("mint-choice-option")), h = n.tagName === "MINT-DATE-PICKER" || s instanceof HTMLElement && s.closest("mint-date-picker");
5070
- (l || c || d || p || h) && setTimeout(() => {
5086
+ const o = this._extractFieldValue([n]), l = o != null && (typeof o == "string" ? o.trim() !== "" : o instanceof FileList || Array.isArray(o) ? o.length > 0 : !0), c = n.hasAttribute("data-mint-form-error") || s instanceof HTMLElement && (s.hasAttribute("aria-invalid") || s.closest("[data-mint-form-error]")), h = !!n.closest("mint-tags"), p = n.tagName === "MINT-CHECKBOX" || n.tagName === "MINT-SWITCH" || n.tagName === "MINT-CHOICE" || s instanceof HTMLElement && (s.closest("mint-checkbox, mint-switch, mint-choice") || s.closest("mint-choice-option")), d = n.tagName === "MINT-DATE-PICKER" || s instanceof HTMLElement && s.closest("mint-date-picker");
5087
+ (l || c || h || p || d) && setTimeout(() => {
5071
5088
  this._validateField(r);
5072
5089
  }, 0);
5073
5090
  };
@@ -5076,38 +5093,38 @@ class _t extends HTMLElement {
5076
5093
  const s = i.target;
5077
5094
  if (!s) return;
5078
5095
  if (i.type === "tags-change" && s.tagName === "MINT-TAGS") {
5079
- const c = s, d = this._getFieldName(c);
5080
- if (!d || !this._collectValidationRules()[d]) return;
5096
+ const c = s, h = this._getFieldName(c);
5097
+ if (!h || !this._collectValidationRules()[h]) return;
5081
5098
  setTimeout(() => {
5082
- this._validateField(d);
5099
+ this._validateField(h);
5083
5100
  }, 0);
5084
5101
  return;
5085
5102
  }
5086
5103
  if (s instanceof HTMLSelectElement || s.tagName === "MINT-SELECT" || s.closest("mint-select")) {
5087
5104
  const c = this._findFieldElement(s);
5088
5105
  if (!c) return;
5089
- const d = this._getFieldName(c);
5090
- if (!d || !this._collectValidationRules()[d]) return;
5106
+ const h = this._getFieldName(c);
5107
+ if (!h || !this._collectValidationRules()[h]) return;
5091
5108
  setTimeout(() => {
5092
- this._validateField(d);
5109
+ this._validateField(h);
5093
5110
  }, 0);
5094
5111
  return;
5095
5112
  }
5096
5113
  if (i.type === "choice-change" && s.tagName === "MINT-CHOICE") {
5097
- const c = s, d = this._getFieldName(c);
5098
- if (!d || !this._collectValidationRules()[d]) return;
5114
+ const c = s, h = this._getFieldName(c);
5115
+ if (!h || !this._collectValidationRules()[h]) return;
5099
5116
  setTimeout(() => {
5100
- this._validateField(d);
5117
+ this._validateField(h);
5101
5118
  }, 0);
5102
5119
  return;
5103
5120
  }
5104
5121
  if (s instanceof HTMLInputElement && s.type === "checkbox" || s.tagName === "MINT-CHECKBOX" || s.tagName === "MINT-SWITCH" || s.closest("mint-checkbox, mint-switch")) {
5105
5122
  const c = this._findFieldElement(s);
5106
5123
  if (!c) return;
5107
- const d = this._getFieldName(c);
5108
- if (!d || !this._collectValidationRules()[d]) return;
5124
+ const h = this._getFieldName(c);
5125
+ if (!h || !this._collectValidationRules()[h]) return;
5109
5126
  setTimeout(() => {
5110
- this._validateField(d);
5127
+ this._validateField(h);
5111
5128
  }, 0);
5112
5129
  return;
5113
5130
  }
@@ -5383,8 +5400,8 @@ class bt extends HTMLElement {
5383
5400
  "dark:bg-gray-800"
5384
5401
  ]);
5385
5402
  const l = r.querySelectorAll("th");
5386
- l.forEach((c, d) => {
5387
- const p = c.querySelector("mint-icon"), h = (p == null ? void 0 : p.getAttribute("name")) || "", u = p !== null && h !== "ellipsis";
5403
+ l.forEach((c, h) => {
5404
+ const p = c.querySelector("mint-icon"), d = (p == null ? void 0 : p.getAttribute("name")) || "", u = p !== null && d !== "ellipsis";
5388
5405
  this._setClasses(c, [
5389
5406
  "text-left",
5390
5407
  "font-semibold",
@@ -5395,13 +5412,13 @@ class bt extends HTMLElement {
5395
5412
  "border-b",
5396
5413
  "border-gray-200",
5397
5414
  "dark:border-gray-700"
5398
- ]), u && c.classList.add("cursor-pointer", "bg-[#F7F7F7]", "dark:bg-gray-800", "hover:bg-gray-100", "dark:hover:bg-gray-700", "transition-colors"), d === 0 && c.classList.add("pl-6"), d === l.length - 1 && c.classList.add("pr-6");
5415
+ ]), u && 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");
5399
5416
  });
5400
5417
  }
5401
5418
  const a = t.querySelector("tbody");
5402
5419
  if (a) {
5403
5420
  const l = Array.from(a.querySelectorAll("tr"));
5404
- l.forEach((c, d) => {
5421
+ l.forEach((c, h) => {
5405
5422
  const p = c.hasAttribute("data-row-clickable");
5406
5423
  this._setClasses(c, [
5407
5424
  "bg-white",
@@ -5409,15 +5426,15 @@ class bt extends HTMLElement {
5409
5426
  "border-b",
5410
5427
  "border-gray-200",
5411
5428
  "dark:border-gray-700"
5412
- ]), p && c.classList.add("cursor-pointer", "hover:bg-gray-50", "dark:hover:bg-gray-800", "transition-colors"), d === l.length - 1 && c.classList.remove("border-b");
5413
- const h = c.querySelectorAll("td");
5414
- h.forEach((u, _) => {
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
+ const d = c.querySelectorAll("td");
5431
+ d.forEach((u, _) => {
5415
5432
  this._setClasses(u, [
5416
5433
  "text-gray-900",
5417
5434
  "dark:text-gray-100",
5418
5435
  "px-3",
5419
5436
  "py-2"
5420
- ]), _ === 0 && u.classList.add("pl-6"), _ === h.length - 1 && u.classList.add("pr-6"), e ? this._applyMobileCell(u, s) : this._restoreCell(u);
5437
+ ]), _ === 0 && u.classList.add("pl-6"), _ === d.length - 1 && u.classList.add("pr-6"), e ? this._applyMobileCell(u, s) : this._restoreCell(u);
5421
5438
  });
5422
5439
  });
5423
5440
  }
@@ -6193,7 +6210,7 @@ class xt extends HTMLElement {
6193
6210
  }), this._configuration.sortBy || (this._configuration.sortBy = "id"), this._configuration.sort || (this._configuration.sort = "asc"));
6194
6211
  }
6195
6212
  async _fetchData(t, e = !0, i, s) {
6196
- var o, l, c, d, p, h, u, _;
6213
+ var o, l, c, h, p, d, u, _;
6197
6214
  if (!this._configuration) return;
6198
6215
  const n = t || (typeof this._configuration.data == "string" ? this._configuration.data : null);
6199
6216
  if (!n || this._fetching || this._loading)
@@ -6222,9 +6239,9 @@ class xt extends HTMLElement {
6222
6239
  this._configuration.predefinedData ? (x = [...this._configuration.predefinedData, ...v], this._totalRows = k + this._configuration.predefinedData.length) : this._totalRows = k, this._rows = x;
6223
6240
  }
6224
6241
  const A = Math.floor(a / r) + 1;
6225
- this._configuration.loadMore || (((c = b.content) == null ? void 0 : c.current_page) !== void 0 && b.content.current_page === A ? this._currentPage = b.content.current_page : this._currentPage = A, this._offset = (this._currentPage - 1) * r), this._lastPage = ((d = b.content) == null ? void 0 : d.last_page) || 1, this._fetching = !1, this._loaded = !0, this._loading = !1, this._fetchError = null, this._searching = !1;
6242
+ this._configuration.loadMore || (((c = b.content) == null ? void 0 : c.current_page) !== void 0 && b.content.current_page === A ? this._currentPage = b.content.current_page : this._currentPage = A, this._offset = (this._currentPage - 1) * r), this._lastPage = ((h = b.content) == null ? void 0 : h.last_page) || 1, this._fetching = !1, this._loaded = !0, this._loading = !1, this._fetchError = null, this._searching = !1;
6226
6243
  const E = this._sorting;
6227
- if (E && this._updateSortIcons(), this._sorting = !1, this._sortingColumn = null, E && this._updateSortIcons(), this.dispatchEvent(new CustomEvent("loaded", { detail: { rows: this._rows } })), this._updateSearchIcon(), (h = (p = this.querySelector(`#${this._tableId}`)) == null ? void 0 : p.closest("table")) == null ? void 0 : h.querySelector("tbody")) {
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")) {
6228
6245
  if (E) {
6229
6246
  const x = this._loading, T = this._fetching;
6230
6247
  this._loading = !1, this._fetching = !1, this._updateTableBody(), this._loading = x, this._fetching = T;
@@ -6257,13 +6274,13 @@ class xt extends HTMLElement {
6257
6274
  if (a == null) return -1;
6258
6275
  const o = typeof r == "number" ? r : typeof r == "string" && !isNaN(Number(r)) && r.trim() !== "" ? Number(r) : null, l = typeof a == "number" ? a : typeof a == "string" && !isNaN(Number(a)) && a.trim() !== "" ? Number(a) : null;
6259
6276
  if (o !== null && l !== null) {
6260
- const h = o - l;
6261
- return i === "asc" ? h : -h;
6277
+ const d = o - l;
6278
+ return i === "asc" ? d : -d;
6262
6279
  }
6263
- const c = r instanceof Date ? r : typeof r == "string" ? new Date(r) : null, d = a instanceof Date ? a : typeof a == "string" ? new Date(a) : null;
6264
- if (c && d && !isNaN(c.getTime()) && !isNaN(d.getTime())) {
6265
- const h = c.getTime() - d.getTime();
6266
- return i === "asc" ? h : -h;
6280
+ const c = r instanceof Date ? r : typeof r == "string" ? new Date(r) : null, h = a instanceof Date ? a : typeof a == "string" ? new Date(a) : null;
6281
+ if (c && h && !isNaN(c.getTime()) && !isNaN(h.getTime())) {
6282
+ const d = c.getTime() - h.getTime();
6283
+ return i === "asc" ? d : -d;
6267
6284
  }
6268
6285
  const p = String(r).localeCompare(String(a), void 0, { numeric: !0, sensitivity: "base" });
6269
6286
  return i === "asc" ? p : -p;
@@ -6357,53 +6374,53 @@ class xt extends HTMLElement {
6357
6374
  const i = this.querySelector(`#search-${this._tableId}`), s = document.activeElement === i || (i == null ? void 0 : i.querySelector("input")) === document.activeElement, n = this._search;
6358
6375
  let r = "";
6359
6376
  if (!((this._fetching || this._loading) && !this._sorting) && (t.forEach((l, c) => {
6360
- const d = typeof this._configuration.onRowClick == "function", p = d ? "cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors" : "";
6361
- r += `<tr data-row-index="${c}" ${d ? 'data-row-clickable="true"' : ""}${p ? ` class="${p}"` : ""}>`, this._configuration.columns.forEach((h, u) => {
6362
- if (h.hidden) return;
6363
- const _ = !h.show || h.show(this, l);
6364
- if (r += `<td style="${this._getStyle(h)}" class="${this._getClasses(h, !0)}">`, _)
6365
- if (h.raw)
6366
- if (h.action)
6367
- (!h.action.show || h.action.show(this, l)) && (r += `<mint-button variant="solid" data-action="column-action" data-row-index="${c}" data-column-key="${this._configuration.columns.indexOf(h)}">${h.action.label}</mint-button>`);
6368
- else if (h.actions)
6369
- if (h.actionStyle !== "buttons") {
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, u) => {
6379
+ if (d.hidden) return;
6380
+ const _ = !d.show || d.show(this, l);
6381
+ if (r += `<td style="${this._getStyle(d)}" class="${this._getClasses(d, !0)}">`, _)
6382
+ if (d.raw)
6383
+ if (d.action)
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
+ else if (d.actions)
6386
+ if (d.actionStyle !== "buttons") {
6370
6387
  const f = `actions-popover-${this._tableId}-${c}`, m = `actions-button-${this._tableId}-${c}`;
6371
- r += `<mint-button id="${m}" variant="link" icon="ellipsis">`, r += "</mint-button>", r += `<mint-popover id="${f}" trigger-id="${m}" direction="down">`, h.actions.forEach((g, b) => {
6388
+ r += `<mint-button id="${m}" variant="link" icon="ellipsis">`, r += "</mint-button>", r += `<mint-popover id="${f}" trigger-id="${m}" direction="down">`, d.actions.forEach((g, b) => {
6372
6389
  if (!g.show || g.show(this, l)) {
6373
6390
  const v = typeof g.label == "function" ? g.label(this, l) : g.label;
6374
- 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="${b}" data-column-key="${this._configuration.columns.indexOf(h)}">${v}</div>`;
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="${b}" data-column-key="${this._configuration.columns.indexOf(d)}">${v}</div>`;
6375
6392
  }
6376
6393
  }), r += "</mint-popover>";
6377
6394
  } else
6378
- h.actions.forEach((f, m) => {
6395
+ d.actions.forEach((f, m) => {
6379
6396
  if (!f.show || f.show(this, l)) {
6380
6397
  const g = f.label ? typeof f.label == "function" ? f.label(this, l) : f.label : "", b = f.icon ? ` icon="${this._escapeHtml(f.icon)}"` : "", v = f.tone ? ` tone="${this._escapeHtml(f.tone)}"` : "";
6381
- r += `<mint-button variant="link" class="${f.classes || ""}" data-action="row-action" data-row-index="${c}" data-action-index="${m}" data-column-key="${this._configuration.columns.indexOf(h)}"${b}${v}>`, g && (r += this._escapeHtml(String(g))), r += "</mint-button>";
6398
+ r += `<mint-button variant="link" class="${f.classes || ""}" data-action="row-action" data-row-index="${c}" data-action-index="${m}" data-column-key="${this._configuration.columns.indexOf(d)}"${b}${v}>`, g && (r += this._escapeHtml(String(g))), r += "</mint-button>";
6382
6399
  }
6383
6400
  });
6384
- else typeof h.format == "function" ? r += h.format(this, l) : h.data && (r += this._escapeHtml(String(l[h.data] || "")));
6385
- else if (h.action) {
6386
- if (!h.action.show || h.action.show(this, l)) {
6387
- const f = typeof h.action.label == "function" ? h.action.label(this, l) : h.action.label;
6388
- r += `<mint-button variant="solid" data-action="column-action" data-row-index="${c}" data-column-key="${this._configuration.columns.indexOf(h)}">${this._escapeHtml(String(f))}</mint-button>`;
6401
+ else typeof d.format == "function" ? r += d.format(this, l) : d.data && (r += this._escapeHtml(String(l[d.data] || "")));
6402
+ else if (d.action) {
6403
+ if (!d.action.show || d.action.show(this, l)) {
6404
+ const f = 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(f))}</mint-button>`;
6389
6406
  }
6390
- } else if (h.actions)
6391
- if (h.actionStyle !== "buttons") {
6407
+ } else if (d.actions)
6408
+ if (d.actionStyle !== "buttons") {
6392
6409
  const f = `actions-popover-${this._tableId}-${c}`, m = `actions-button-${this._tableId}-${c}`;
6393
- r += `<mint-button id="${m}" variant="link" icon="ellipsis">`, r += "</mint-button>", r += `<mint-popover id="${f}" trigger-id="${m}" direction="down">`, h.actions.forEach((g, b) => {
6410
+ r += `<mint-button id="${m}" variant="link" icon="ellipsis">`, r += "</mint-button>", r += `<mint-popover id="${f}" trigger-id="${m}" direction="down">`, d.actions.forEach((g, b) => {
6394
6411
  if (!g.show || g.show(this, l)) {
6395
6412
  const v = typeof g.label == "function" ? g.label(this, l) : g.label;
6396
- 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="${b}" data-column-key="${this._configuration.columns.indexOf(h)}">${v}</div>`;
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="${b}" data-column-key="${this._configuration.columns.indexOf(d)}">${v}</div>`;
6397
6414
  }
6398
6415
  }), r += "</mint-popover>";
6399
6416
  } else
6400
- h.actions.forEach((f, m) => {
6417
+ d.actions.forEach((f, m) => {
6401
6418
  if (!f.show || f.show(this, l)) {
6402
6419
  const g = f.label ? typeof f.label == "function" ? f.label(this, l) : f.label : "", b = f.icon ? ` icon="${this._escapeHtml(f.icon)}"` : "", v = f.tone ? ` tone="${this._escapeHtml(f.tone)}"` : "";
6403
- r += `<mint-button variant="link" class="${f.classes || ""}" data-action="row-action" data-row-index="${c}" data-action-index="${m}" data-column-key="${this._configuration.columns.indexOf(h)}"${b}${v}>`, g && (r += this._escapeHtml(String(g))), r += "</mint-button>";
6420
+ r += `<mint-button variant="link" class="${f.classes || ""}" data-action="row-action" data-row-index="${c}" data-action-index="${m}" data-column-key="${this._configuration.columns.indexOf(d)}"${b}${v}>`, g && (r += this._escapeHtml(String(g))), r += "</mint-button>";
6404
6421
  }
6405
6422
  });
6406
- else typeof h.format == "function" ? r += this._escapeHtml(h.format(this, l)) : h.data && (r += this._escapeHtml(String(l[h.data] || "")));
6423
+ else typeof d.format == "function" ? r += this._escapeHtml(d.format(this, l)) : d.data && (r += this._escapeHtml(String(l[d.data] || "")));
6407
6424
  r += "</td>";
6408
6425
  }), r += "</tr>";
6409
6426
  }), t.length === 0 && (this._fetchError ? r += `<tr><td colspan="${this._configuration.columns.filter((l) => !l.hidden).length}" class="text-center py-8 text-red-500 dark:text-red-400">Failed to load data: ${this._escapeHtml(this._fetchError)}</td></tr>` : r += `<tr><td colspan="${this._configuration.columns.filter((l) => !l.hidden).length}" class="text-center py-8">No records found.</td></tr>`), e.innerHTML = r, this._attachTableEventListeners(), this._attachRowClickHandler(), s && i)) {
@@ -6485,7 +6502,7 @@ class xt extends HTMLElement {
6485
6502
  var c;
6486
6503
  const l = o.getAttribute("colspan");
6487
6504
  if (l)
6488
- for (let d = 0; d < parseInt(l) - 1; d++)
6505
+ for (let h = 0; h < parseInt(l) - 1; h++)
6489
6506
  a.push("");
6490
6507
  a.push('"' + ((c = o.textContent) == null ? void 0 : c.trim().replace(/"/g, '""')) + '"');
6491
6508
  }), i += a.join(",") + `
@@ -6575,30 +6592,30 @@ class xt extends HTMLElement {
6575
6592
  }
6576
6593
  }), s += "</tr></thead>", s += "<tbody>", !this._fetching && !this._loading && e.forEach((r, a) => {
6577
6594
  const o = typeof this._configuration.onRowClick == "function", l = o ? "cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors" : "";
6578
- s += `<tr data-row-index="${a}" ${o ? 'data-row-clickable="true"' : ""}${l ? ` class="${l}"` : ""}>`, this._configuration.columns.forEach((c, d) => {
6595
+ s += `<tr data-row-index="${a}" ${o ? 'data-row-clickable="true"' : ""}${l ? ` class="${l}"` : ""}>`, this._configuration.columns.forEach((c, h) => {
6579
6596
  if (c.hidden) return;
6580
6597
  const p = !c.show || c.show(this, r);
6581
6598
  if (s += `<td style="${this._getStyle(c)}" class="${this._getClasses(c, !0)}">`, p)
6582
6599
  if (c.raw)
6583
6600
  if (c.action) {
6584
6601
  if (!c.action.show || c.action.show(this, r)) {
6585
- const h = typeof c.action.label == "function" ? c.action.label(this, r) : c.action.label;
6586
- s += `<mint-button variant="solid" data-action="column-action" data-row-index="${a}" data-column-key="${this._configuration.columns.indexOf(c)}">${this._escapeHtml(String(h))}</mint-button>`;
6602
+ const d = typeof c.action.label == "function" ? c.action.label(this, r) : c.action.label;
6603
+ s += `<mint-button variant="solid" data-action="column-action" data-row-index="${a}" data-column-key="${this._configuration.columns.indexOf(c)}">${this._escapeHtml(String(d))}</mint-button>`;
6587
6604
  }
6588
6605
  } else if (c.actions)
6589
6606
  if (c.actionStyle !== "buttons") {
6590
- const h = `actions-popover-${this._tableId}-${a}`, u = `actions-button-${this._tableId}-${a}`;
6591
- s += `<mint-button id="${u}" variant="link" icon="ellipsis">`, s += "</mint-button>", s += `<mint-popover id="${h}" trigger-id="${u}" direction="down">`, c.actions.forEach((_, f) => {
6607
+ const d = `actions-popover-${this._tableId}-${a}`, u = `actions-button-${this._tableId}-${a}`;
6608
+ s += `<mint-button id="${u}" variant="link" icon="ellipsis">`, s += "</mint-button>", s += `<mint-popover id="${d}" trigger-id="${u}" direction="down">`, c.actions.forEach((_, f) => {
6592
6609
  if (!_.show || _.show(this, r)) {
6593
6610
  const m = typeof _.label == "function" ? _.label(this, r) : _.label;
6594
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="${f}" data-column-key="${this._configuration.columns.indexOf(c)}">${this._escapeHtml(String(m))}</div>`;
6595
6612
  }
6596
6613
  }), s += "</mint-popover>";
6597
6614
  } else
6598
- c.actions.forEach((h, u) => {
6599
- if (!h.show || h.show(this, r)) {
6600
- const _ = h.label ? typeof h.label == "function" ? h.label(this, r) : h.label : "", f = h.icon ? ` icon="${this._escapeHtml(h.icon)}"` : "", m = h.tone ? ` tone="${this._escapeHtml(h.tone)}"` : "";
6601
- s += `<mint-button variant="link" class="${h.classes || ""}" data-action="row-action" data-row-index="${a}" data-action-index="${u}" data-column-key="${this._configuration.columns.indexOf(c)}"${f}${m}>`, _ && (s += this._escapeHtml(String(_))), s += "</mint-button>";
6615
+ c.actions.forEach((d, u) => {
6616
+ if (!d.show || d.show(this, r)) {
6617
+ const _ = d.label ? typeof d.label == "function" ? d.label(this, r) : d.label : "", f = d.icon ? ` icon="${this._escapeHtml(d.icon)}"` : "", m = 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="${u}" data-column-key="${this._configuration.columns.indexOf(c)}"${f}${m}>`, _ && (s += this._escapeHtml(String(_))), s += "</mint-button>";
6602
6619
  }
6603
6620
  });
6604
6621
  else typeof c.format == "function" ? s += c.format(this, r) : c.data && (s += this._escapeHtml(String(r[c.data] || "")));
@@ -6606,18 +6623,18 @@ class xt extends HTMLElement {
6606
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>`);
6607
6624
  else if (c.actions)
6608
6625
  if (c.actionStyle !== "buttons") {
6609
- const h = `actions-popover-${this._tableId}-${a}`, u = `actions-button-${this._tableId}-${a}`;
6610
- s += `<mint-button id="${u}" variant="link" icon="ellipsis">`, s += "</mint-button>", s += `<mint-popover id="${h}" trigger-id="${u}" direction="down">`, c.actions.forEach((_, f) => {
6626
+ const d = `actions-popover-${this._tableId}-${a}`, u = `actions-button-${this._tableId}-${a}`;
6627
+ s += `<mint-button id="${u}" variant="link" icon="ellipsis">`, s += "</mint-button>", s += `<mint-popover id="${d}" trigger-id="${u}" direction="down">`, c.actions.forEach((_, f) => {
6611
6628
  if (!_.show || _.show(this, r)) {
6612
6629
  const m = typeof _.label == "function" ? _.label(this, r) : _.label;
6613
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="${f}" data-column-key="${this._configuration.columns.indexOf(c)}">${this._escapeHtml(String(m))}</div>`;
6614
6631
  }
6615
6632
  }), s += "</mint-popover>";
6616
6633
  } else
6617
- c.actions.forEach((h, u) => {
6618
- if (!h.show || h.show(this, r)) {
6619
- const _ = h.label ? typeof h.label == "function" ? h.label(this, r) : h.label : "", f = h.icon ? ` icon="${this._escapeHtml(h.icon)}"` : "", m = h.tone ? ` tone="${this._escapeHtml(h.tone)}"` : "";
6620
- s += `<mint-button variant="link" class="${h.classes || ""}" data-action="row-action" data-row-index="${a}" data-action-index="${u}" data-column-key="${this._configuration.columns.indexOf(c)}"${f}${m}>`, _ && (s += this._escapeHtml(String(_))), s += "</mint-button>";
6634
+ c.actions.forEach((d, u) => {
6635
+ if (!d.show || d.show(this, r)) {
6636
+ const _ = d.label ? typeof d.label == "function" ? d.label(this, r) : d.label : "", f = d.icon ? ` icon="${this._escapeHtml(d.icon)}"` : "", m = 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="${u}" data-column-key="${this._configuration.columns.indexOf(c)}"${f}${m}>`, _ && (s += this._escapeHtml(String(_))), s += "</mint-button>";
6621
6638
  }
6622
6639
  });
6623
6640
  else typeof c.format == "function" ? s += this._escapeHtml(c.format(this, r)) : c.data && (s += this._escapeHtml(String(r[c.data] || "")));
@@ -6802,12 +6819,12 @@ class wt extends HTMLElement {
6802
6819
  ).forEach((u) => {
6803
6820
  this._bodySlot && u.parentElement !== this._bodySlot && this._bodySlot.appendChild(u);
6804
6821
  }), 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));
6805
- let d = this._actionsSlot.querySelector("mint-stack");
6806
- d || (d = document.createElement("mint-stack"), d.setAttribute("direction", "horizontal"), d.className = "justify-end", this._actionsSlot.appendChild(d)), Array.from(this.children).filter(
6822
+ let h = this._actionsSlot.querySelector("mint-stack");
6823
+ h || (h = document.createElement("mint-stack"), h.setAttribute("direction", "horizontal"), h.className = "justify-end", this._actionsSlot.appendChild(h)), Array.from(this.children).filter(
6807
6824
  (u) => u !== this._overlay && u !== this._offCanvas && u !== this._actionsSlot && u.getAttribute("slot") === "actions"
6808
6825
  ).forEach((u) => {
6809
6826
  Array.from(u.children).forEach((f) => {
6810
- f.parentElement !== d && d.appendChild(f);
6827
+ f.parentElement !== h && h.appendChild(f);
6811
6828
  }), u.parentElement && u.remove();
6812
6829
  }), Array.from(this.children).forEach((u) => {
6813
6830
  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);