monobill-mintui 0.3.43 → 0.3.44

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
  }
@@ -1599,31 +1599,31 @@ class lt extends HTMLElement {
1599
1599
  render() {
1600
1600
  const t = this.getId(), e = this.getHeading(), i = this.isOpen();
1601
1601
  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();
1602
+ let h = this._modal.querySelector(".modal-content");
1603
+ 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
1604
  } else
1605
1605
  this._animateExit();
1606
1606
  let s = this._modal.querySelector(".modal-content");
1607
1607
  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
1608
  let n = this._headingSlot.querySelector("mint-text");
1609
1609
  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);
1610
+ (h) => h !== this._overlay && h !== this._modal && h !== this._headingSlot && h.getAttribute("slot") === "heading"
1611
+ ).forEach((h) => {
1612
+ this._headingSlot && h.parentElement !== this._headingSlot && this._headingSlot.appendChild(h);
1613
1613
  }), 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);
1614
+ (h) => h !== this._overlay && h !== this._modal && h !== this._bodySlot && h.getAttribute("slot") === "body"
1615
+ ).forEach((h) => {
1616
+ this._bodySlot && h.parentElement !== this._bodySlot && this._bodySlot.appendChild(h);
1617
1617
  }), 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
1618
  let o = this._actionsSlot.querySelector("mint-stack");
1619
1619
  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);
1620
+ (h) => h !== this._overlay && h !== this._modal && h !== this._actionsSlot && h.getAttribute("slot") === "actions"
1621
+ ).forEach((h) => {
1622
+ Array.from(h.children).forEach((d) => {
1623
+ d.parentElement !== o && o.appendChild(d);
1624
+ }), h.parentElement && h.remove();
1625
+ }), Array.from(this.children).forEach((h) => {
1626
+ 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
1627
  }), this._updateBackgroundColor();
1628
1628
  }
1629
1629
  _updateBackgroundColor() {
@@ -1799,29 +1799,29 @@ class ct extends HTMLElement {
1799
1799
  switch (o) {
1800
1800
  case "down":
1801
1801
  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));
1802
+ const h = t.top - s.height - a;
1803
+ h >= 0 ? (o = "up", l = h) : (l = Math.max(0, r - s.height - a), l + s.height > r && (l = 0));
1804
1804
  }
1805
1805
  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
1806
  break;
1807
1807
  case "up":
1808
1808
  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));
1809
+ const h = t.bottom + a;
1810
+ 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
1811
  }
1812
1812
  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
1813
  break;
1814
1814
  case "right":
1815
1815
  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));
1816
+ const h = t.left - s.width - a;
1817
+ h >= 0 ? (o = "left", c = h) : (c = Math.max(0, n - s.width - a), c + s.width > n && (c = n - s.width));
1818
1818
  }
1819
1819
  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
1820
  break;
1821
1821
  case "left":
1822
1822
  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));
1823
+ const h = t.right + a;
1824
+ h + s.width <= n ? (o = "right", c = h) : (c = Math.min(n - s.width - a, n - s.width), c < 0 && (c = 0));
1825
1825
  }
1826
1826
  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
1827
  break;
@@ -2067,12 +2067,12 @@ class ht extends HTMLElement {
2067
2067
  c._wrapperClickHandler || (c._wrapperClickHandler = (u) => {
2068
2068
  u.target === r && !s && (u.preventDefault(), u.stopPropagation(), this.toggle());
2069
2069
  }, 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();
2070
+ let h = r.querySelector("mint-icon");
2071
+ 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
2072
  let p = this.querySelector(".mint-checkbox-label-container");
2073
- const h = this.querySelector(".mint-checkbox-container");
2073
+ const d = this.querySelector(".mint-checkbox-container");
2074
2074
  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));
2075
+ 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
2076
  let u = p.querySelector(".mint-checkbox-label");
2077
2077
  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
2078
  let _ = p.querySelector(".mint-checkbox-info");
@@ -2325,9 +2325,9 @@ class dt extends HTMLElement {
2325
2325
  });
2326
2326
  let p = l.querySelector(".mint-choice-option-indicator");
2327
2327
  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();
2328
+ const d = this.getInfo();
2329
2329
  let u = this.querySelector(".mint-choice-option-label-container");
2330
- if (r || h) {
2330
+ if (r || d) {
2331
2331
  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
2332
  var b;
2333
2333
  g.nodeType === Node.TEXT_NODE && ((b = g.textContent) != null && b.trim()) && g !== u && (g.textContent = "");
@@ -2335,7 +2335,7 @@ class dt extends HTMLElement {
2335
2335
  let f = u.querySelector(".mint-choice-option-label");
2336
2336
  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
2337
  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();
2338
+ 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
2339
  } else u && u.remove();
2340
2340
  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
2341
  }
@@ -2758,9 +2758,9 @@ class pt extends HTMLElement {
2758
2758
  render() {
2759
2759
  var b, v, k, A;
2760
2760
  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();
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(), h = this.getAttribute("value") || (s ? "#000000" : ""), p = this.getRows(), d = this.getIcon(), u = this.getLabel(), _ = this.getInfo(), f = this.isLoading();
2762
2762
  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) => {
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 = 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
2764
  this._colorPickerWrapper && this._colorPicker && this._colorPicker.matches(":focus-visible") && requestAnimationFrame(() => {
2765
2765
  var x;
2766
2766
  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 +2800,7 @@ class pt extends HTMLElement {
2800
2800
  cancelable: !0
2801
2801
  }));
2802
2802
  }));
2803
- const E = d || "#000000";
2803
+ const E = h || "#000000";
2804
2804
  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
2805
  const y = this._colorTextInput;
2806
2806
  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 +2808,7 @@ class pt extends HTMLElement {
2808
2808
  this._renderErrorState();
2809
2809
  return;
2810
2810
  }
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) {
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), 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
2812
  if (!this._numberSpinnerContainer) {
2813
2813
  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
2814
  const E = document.createElement("mint-icon");
@@ -2831,11 +2831,11 @@ class pt extends HTMLElement {
2831
2831
  this._numberIncrementButton && (this._numberIncrementButton.disabled = r || a), this._numberDecrementButton && (this._numberDecrementButton.disabled = r || a);
2832
2832
  } else this._numberSpinnerContainer && (this._numberSpinnerContainer.remove(), this._numberSpinnerContainer = null, this._numberIncrementButton = null, this._numberDecrementButton = null);
2833
2833
  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) {
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"), 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
2835
  const E = this.firstChild.textContent;
2836
2836
  E && !this._textarea.value && (this._textarea.value = E.trim()), this.removeChild(this.firstChild);
2837
2837
  }
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) {
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")), 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
2839
  const E = this.firstChild.textContent;
2840
2840
  E && !this._input.value && (this._input.value = E.trim()), this.removeChild(this.firstChild);
2841
2841
  }
@@ -3164,10 +3164,10 @@ class ft extends HTMLElement {
3164
3164
  }), s.addEventListener("keydown", (a) => {
3165
3165
  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
3166
  }), s.addEventListener("blur", (a) => {
3167
- var c, d;
3167
+ var c, h;
3168
3168
  this._syncHiddenInput();
3169
3169
  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(() => {
3170
+ 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
3171
  if (this._hiddenInput) {
3172
3172
  const p = new FocusEvent("blur", {
3173
3173
  bubbles: !0,
@@ -3189,8 +3189,8 @@ class ft extends HTMLElement {
3189
3189
  if (this._isRange || s === "week" || s === "month") {
3190
3190
  const [r, a] = this._splitRangeInput(t, e), o = r ? this._parseDateString(r, e) : null, l = a ? this._parseDateString(a, e) : null;
3191
3191
  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();
3192
+ const [c, h] = o <= l ? [o, l] : [l, o];
3193
+ this._selectedStartDate = c, this._selectedEndDate = h, this._currentMonth = c.getMonth(), this._currentYear = c.getFullYear();
3194
3194
  } else o && (this._selectedStartDate = o, this._selectedEndDate = null, this._currentMonth = o.getMonth(), this._currentYear = o.getFullYear());
3195
3195
  this._applyDateToParts(this._selectedStartDate, this._startPartInputs, i, e), this._applyDateToParts(this._selectedEndDate, this._endPartInputs, i, e);
3196
3196
  } else {
@@ -3231,13 +3231,13 @@ class ft extends HTMLElement {
3231
3231
  { char: "m", index: o },
3232
3232
  { char: "y", index: l }
3233
3233
  ].sort((f, m) => f.index - m.index);
3234
- let d = 0, p = 0, h = 0, u = 0;
3234
+ let h = 0, p = 0, d = 0, u = 0;
3235
3235
  r.length, n.length;
3236
3236
  for (const f of c)
3237
3237
  if (f.char === "d") {
3238
3238
  const m = r.lastIndexOf("d") - r.indexOf("d") + 1, g = n.substr(u, m);
3239
3239
  if (g.length === 0) return null;
3240
- d = parseInt(g, 10), u += g.length;
3240
+ h = parseInt(g, 10), u += g.length;
3241
3241
  } else if (f.char === "m") {
3242
3242
  const m = r.lastIndexOf("m") - r.indexOf("m") + 1, g = n.substr(u, m);
3243
3243
  if (g.length === 0) return null;
@@ -3246,11 +3246,11 @@ class ft extends HTMLElement {
3246
3246
  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
3247
  if (v.length === 0) return null;
3248
3248
  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;
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), d = k, u += b;
3250
3250
  }
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 : _;
3251
+ if (!h || p < 0 || p > 11 || !d) return null;
3252
+ const _ = new Date(d, p, h);
3253
+ return isNaN(_.getTime()) || _.getDate() !== h || _.getMonth() !== p || _.getFullYear() !== d ? null : _;
3254
3254
  }
3255
3255
  _formatDate(t, e) {
3256
3256
  const i = t.getDate(), s = t.getMonth() + 1, n = t.getFullYear(), r = e.toLowerCase();
@@ -3259,15 +3259,15 @@ class ft extends HTMLElement {
3259
3259
  }
3260
3260
  // PHP-style formatter for display mode
3261
3261
  _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;
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 = (d, u = 2) => d.toString().padStart(u, "0"), h = (d) => {
3263
+ const u = d % 10, _ = d % 100;
3264
3264
  return u === 1 && _ !== 11 ? "st" : u === 2 && _ !== 12 ? "nd" : u === 3 && _ !== 13 ? "rd" : "th";
3265
3265
  };
3266
3266
  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++;
3267
+ for (let d = 0; d < e.length; d++) {
3268
+ const u = e[d];
3269
+ if (u === "\\" && d + 1 < e.length) {
3270
+ p += e[d + 1], d++;
3271
3271
  continue;
3272
3272
  }
3273
3273
  switch (u) {
@@ -3302,7 +3302,7 @@ class ft extends HTMLElement {
3302
3302
  p += r[t.getDay()];
3303
3303
  break;
3304
3304
  case "S":
3305
- p += d(i);
3305
+ p += h(i);
3306
3306
  break;
3307
3307
  default:
3308
3308
  p += u;
@@ -3316,8 +3316,8 @@ class ft extends HTMLElement {
3316
3316
  return i !== null && !isNaN(i.getTime());
3317
3317
  }
3318
3318
  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));
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(), h = this.hasError(), p = this.getErrorMessage(), d = this.getSelectionMode();
3320
+ 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
3321
  let u = this.querySelector(".mint-date-picker-label-container");
3322
3322
  if (e || i) {
3323
3323
  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 +3326,9 @@ class ft extends HTMLElement {
3326
3326
  let k = u.querySelector(".mint-date-picker-info");
3327
3327
  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
3328
  } 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");
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", h ? "true" : "false");
3330
3330
  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");
3331
+ _ || (_ = document.createElement("div"), this._input.appendChild(_)), this._fieldsContainer = _, this._applyErrorVisuals(h, p, n), _.innerHTML = "", this._displayEl = document.createElement("div");
3332
3332
  const f = r ? "select-text" : "select-none";
3333
3333
  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
3334
  n || r || this._enterInputMode();
@@ -3367,7 +3367,7 @@ class ft extends HTMLElement {
3367
3367
  n || r || this._enterInputMode();
3368
3368
  }), this._input.prepend(this._iconButton), this._iconButton.disabled = n || r;
3369
3369
  }
3370
- this._renderErrorState(d, p), this._renderSkeleton(t);
3370
+ this._renderErrorState(h, p), this._renderSkeleton(t);
3371
3371
  }
3372
3372
  _renderErrorState(t, e) {
3373
3373
  let i = this.querySelector(".mint-date-picker-error");
@@ -3415,8 +3415,8 @@ class ft extends HTMLElement {
3415
3415
  if (s) {
3416
3416
  const [n, r] = this._splitRangeInput(t, e), a = n ? this._parseDateString(n, e) : null, o = r ? this._parseDateString(r, e) : null;
3417
3417
  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();
3418
+ const [l, c] = a <= o ? [a, o] : [o, a], h = this._formatDate(l, e), p = this._formatDate(c, e), d = `${h} - ${p}`;
3419
+ 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
3420
  } else if (a) {
3421
3421
  const l = this._formatDate(a, e);
3422
3422
  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 +3525,14 @@ class ft extends HTMLElement {
3525
3525
  l.className = "flex flex-col md:flex-row md:gap-6 md:items-start";
3526
3526
  const c = document.createElement("div");
3527
3527
  c.className = "flex-1 min-w-0";
3528
- const d = document.createElement("div");
3529
- d.className = "flex items-center justify-between mb-4";
3528
+ const h = document.createElement("div");
3529
+ h.className = "flex items-center justify-between mb-4";
3530
3530
  const p = document.createElement("button");
3531
3531
  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", () => {
3532
+ const d = document.createElement("mint-icon");
3533
+ d.setAttribute("name", "caret-left"), d.className = "w-4 h-4", p.appendChild(d), p.addEventListener("click", () => {
3534
3534
  this._currentMonth === 0 ? (this._currentMonth = 11, this._currentYear--) : this._currentMonth--, this._buildCalendar();
3535
- }), d.appendChild(p);
3535
+ }), h.appendChild(p);
3536
3536
  const u = document.createElement("div");
3537
3537
  u.className = "flex items-center gap-2";
3538
3538
  const _ = document.createElement("button");
@@ -3542,13 +3542,13 @@ class ft extends HTMLElement {
3542
3542
  const f = document.createElement("button");
3543
3543
  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
3544
  this._viewMode = "year", this._buildCalendar();
3545
- }), u.appendChild(f), d.appendChild(u);
3545
+ }), u.appendChild(f), h.appendChild(u);
3546
3546
  const m = document.createElement("button");
3547
3547
  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
3548
  const g = document.createElement("mint-icon");
3549
3549
  g.setAttribute("name", "caret-right"), g.className = "w-4 h-4", m.appendChild(g), m.addEventListener("click", () => {
3550
3550
  this._currentMonth === 11 ? (this._currentMonth = 0, this._currentYear++) : this._currentMonth++, this._buildCalendar();
3551
- }), d.appendChild(m);
3551
+ }), h.appendChild(m);
3552
3552
  const b = document.createElement("div");
3553
3553
  b.className = "grid grid-cols-7 mb-2", r.forEach((C) => {
3554
3554
  const I = document.createElement("div");
@@ -3659,7 +3659,7 @@ class ft extends HTMLElement {
3659
3659
  }), S.appendChild(D);
3660
3660
  }), I.appendChild(S), C.appendChild(I), l.appendChild(C);
3661
3661
  }
3662
- c.appendChild(d), c.appendChild(b), c.appendChild(v), l.appendChild(c), this._calendarContainer.appendChild(l);
3662
+ c.appendChild(h), c.appendChild(b), c.appendChild(v), l.appendChild(c), this._calendarContainer.appendChild(l);
3663
3663
  }
3664
3664
  _buildMonthView() {
3665
3665
  if (!this._calendarContainer) return;
@@ -3683,12 +3683,12 @@ class ft extends HTMLElement {
3683
3683
  }), e.appendChild(r);
3684
3684
  const o = document.createElement("div");
3685
3685
  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");
3686
+ const h = document.createElement("button");
3687
+ h.type = "button", h.tabIndex = 0, h.setAttribute("data-keep-popover-open", "true");
3688
3688
  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", () => {
3689
+ 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
3690
  this._currentMonth = c, this._viewMode = "calendar", this._buildCalendar();
3691
- }), o.appendChild(d);
3691
+ }), o.appendChild(h);
3692
3692
  }), this._calendarContainer.appendChild(e), this._calendarContainer.appendChild(o);
3693
3693
  }
3694
3694
  _buildYearView() {
@@ -3712,12 +3712,12 @@ class ft extends HTMLElement {
3712
3712
  const l = document.createElement("div");
3713
3713
  l.className = "grid grid-cols-3 gap-2";
3714
3714
  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");
3715
+ const h = document.createElement("button");
3716
+ h.type = "button", h.tabIndex = 0, h.setAttribute("data-keep-popover-open", "true");
3717
3717
  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", () => {
3718
+ 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
3719
  this._currentYear = c, this._viewMode = "calendar", this._buildCalendar();
3720
- }), l.appendChild(d);
3720
+ }), l.appendChild(h);
3721
3721
  }
3722
3722
  this._calendarContainer.appendChild(i), this._calendarContainer.appendChild(l);
3723
3723
  }
@@ -4022,30 +4022,30 @@ class mt extends HTMLElement {
4022
4022
  }
4023
4023
  render() {
4024
4024
  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));
4025
+ this._select && Array.from(this._select.children).forEach((d) => {
4026
+ (d.tagName === "OPTION" || d.tagName === "OPTGROUP") && e.push(d.cloneNode(!0));
4027
4027
  });
4028
- const i = Array.from(this.children).filter((h) => h.tagName === "OPTION" || h.tagName === "OPTGROUP").map((h) => h.cloneNode(!0));
4028
+ const i = Array.from(this.children).filter((d) => d.tagName === "OPTION" || d.tagName === "OPTGROUP").map((d) => d.cloneNode(!0));
4029
4029
  for (; this.firstChild; )
4030
4030
  this.removeChild(this.firstChild);
4031
4031
  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();
4032
+ 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
4033
  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);
4034
+ const d = document.createElement("label");
4035
+ d.className = "block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1", r && d.setAttribute("for", r);
4036
4036
  const u = document.createTextNode(s);
4037
- h.appendChild(u), this.appendChild(h);
4037
+ d.appendChild(u), this.appendChild(d);
4038
4038
  }
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");
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", h ? "true" : "false");
4040
4040
  const p = i.length > 0 ? i : e;
4041
- if (p.length > 0 && p.forEach((h) => {
4042
- this._select.appendChild(h);
4041
+ if (p.length > 0 && p.forEach((d) => {
4042
+ this._select.appendChild(d);
4043
4043
  }), 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);
4044
+ const d = document.createElement("option");
4045
+ d.value = "", d.textContent = "Select an option", d.disabled = !0, d.selected = !0, this._select.appendChild(d);
4046
4046
  }
4047
- if (this._select.value = o || "", this._changeHandler && this._select && this._select.removeEventListener("change", this._changeHandler), this._changeHandler = (h) => {
4048
- const _ = h.target.value;
4047
+ if (this._select.value = o || "", this._changeHandler && this._select && this._select.removeEventListener("change", this._changeHandler), this._changeHandler = (d) => {
4048
+ const _ = d.target.value;
4049
4049
  (this.getAttribute("value") || "") !== _ && (_ ? this.setAttribute("value", _) : this.removeAttribute("value"));
4050
4050
  const m = new Event("input", {
4051
4051
  bubbles: !0,
@@ -4064,11 +4064,11 @@ class mt extends HTMLElement {
4064
4064
  composed: !0
4065
4065
  }));
4066
4066
  }, 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(() => {
4067
+ const d = this.getAttribute("value") || this.value || "";
4068
+ this._select && d && requestAnimationFrame(() => {
4069
4069
  this._select && Array.from(this._select.options).some(
4070
- (_) => _.value === h
4071
- ) && this._select.value !== h && (this._select.value = h);
4070
+ (_) => _.value === d
4071
+ ) && this._select.value !== d && (this._select.value = d);
4072
4072
  });
4073
4073
  }), this._optionObserver.observe(this._select, {
4074
4074
  childList: !0,
@@ -4076,12 +4076,12 @@ class mt extends HTMLElement {
4076
4076
  }), this._wrapper.appendChild(this._select), c)
4077
4077
  this._caretUpIcon = null, this._caretDownIcon = null;
4078
4078
  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);
4079
+ const d = document.createElement("div");
4080
+ 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
4081
  }
4082
4082
  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);
4083
+ const d = document.createElement("div");
4084
+ d.className = "mt-1 text-xs text-gray-500 dark:text-gray-400", d.textContent = n, this.appendChild(d);
4085
4085
  }
4086
4086
  this._renderErrorState(), this._renderSkeleton(t);
4087
4087
  }
@@ -4208,12 +4208,12 @@ class gt extends HTMLElement {
4208
4208
  render() {
4209
4209
  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
4210
  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";
4211
+ const h = this._dropzone.querySelector(".mint-dropzone-icon"), p = this._dropzone.querySelector(".mint-dropzone-label");
4212
+ h && h.remove(), p && p.remove();
4213
+ const d = document.createElement("div");
4214
+ d.className = "mint-dropzone-icon flex items-center justify-center mt-2 mb-2 flex-shrink-0";
4215
4215
  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) {
4216
+ 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
4217
  const _ = document.createElement("div");
4218
4218
  _.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
4219
  }
@@ -4371,24 +4371,24 @@ class gt extends HTMLElement {
4371
4371
  t.className = "mint-dropzone-previews-wrapper mt-3 w-full relative max-h-48";
4372
4372
  const e = document.createElement("div");
4373
4373
  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/")) {
4374
+ const h = document.createElement("div");
4375
+ 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
4376
  const _ = document.createElement("img");
4377
4377
  _.className = "w-12 h-12 object-cover rounded border border-gray-200 dark:border-gray-700";
4378
4378
  const f = URL.createObjectURL(l);
4379
- this._previewUrls.push(f), _.src = f, d.appendChild(_);
4379
+ this._previewUrls.push(f), _.src = f, h.appendChild(_);
4380
4380
  } else {
4381
4381
  const _ = document.createElement("mint-icon");
4382
- _.setAttribute("name", "attach"), _.className = "w-5 h-5 text-gray-500 dark:text-gray-300", d.appendChild(_);
4382
+ _.setAttribute("name", "attach"), _.className = "w-5 h-5 text-gray-500 dark:text-gray-300", h.appendChild(_);
4383
4383
  }
4384
4384
  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";
4385
+ p.className = "flex-1 text-sm text-gray-800 dark:text-gray-100 truncate", p.textContent = l.name, h.appendChild(p);
4386
+ const d = document.createElement("button");
4387
+ 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
4388
  const u = document.createElement("mint-icon");
4389
- u.setAttribute("name", "close"), u.className = "w-4 h-4", h.appendChild(u), h.addEventListener("click", (_) => {
4389
+ u.setAttribute("name", "close"), u.className = "w-4 h-4", d.appendChild(u), d.addEventListener("click", (_) => {
4390
4390
  _.preventDefault(), _.stopPropagation(), this._removeFileAt(c);
4391
- }), d.appendChild(h), e.appendChild(d);
4391
+ }), h.appendChild(d), e.appendChild(h);
4392
4392
  });
4393
4393
  const i = this.hasError(), s = this._isDragging;
4394
4394
  let n = "from-white dark:from-gray-700";
@@ -4398,8 +4398,8 @@ class gt extends HTMLElement {
4398
4398
  const a = document.createElement("div");
4399
4399
  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
4400
  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";
4401
+ const l = e.scrollTop, c = e.scrollHeight, h = e.clientHeight;
4402
+ l > 0 ? r.style.opacity = "1" : r.style.opacity = "0", l + h < c - 1 ? a.style.opacity = "1" : a.style.opacity = "0";
4403
4403
  };
4404
4404
  o(), e.addEventListener("scroll", o), t.appendChild(e), this._previewContainer = t, this._dropzone.appendChild(t), this._updateDragStateClass();
4405
4405
  }
@@ -4530,14 +4530,14 @@ class _t extends HTMLElement {
4530
4530
  t && (this._form.action = t), e && (this._form.method = e), this._form.enctype = i;
4531
4531
  }
4532
4532
  async _handleSubmit(t) {
4533
- var l;
4533
+ var c;
4534
4534
  if (t.preventDefault(), !this._form) return;
4535
4535
  this._clearErrors(), this._syncDropzoneFiles();
4536
4536
  const e = this._collectValidationRules(), i = new FormData(this._form);
4537
4537
  let s = this._formDataToValues(i);
4538
4538
  if (this._formData) {
4539
- const c = this._getReactiveValue(this._formData);
4540
- c && typeof c == "object" && !Array.isArray(c) && (s = { ...this._extractReactiveData(c), ...s });
4539
+ const h = this._getReactiveValue(this._formData);
4540
+ h && typeof h == "object" && !Array.isArray(h) && (s = { ...this._extractReactiveData(h), ...s });
4541
4541
  }
4542
4542
  if (!this._validate(s, e)) {
4543
4543
  this.dispatchEvent(new CustomEvent("invalid", {
@@ -4549,26 +4549,33 @@ class _t extends HTMLElement {
4549
4549
  return;
4550
4550
  }
4551
4551
  const r = new CustomEvent("submit", {
4552
- detail: { formData: i, values: s },
4552
+ detail: { formData: i, values: s, form: this },
4553
4553
  bubbles: !0,
4554
4554
  cancelable: !0,
4555
4555
  composed: !0
4556
4556
  });
4557
- if (this.dispatchEvent(r), r.defaultPrevented)
4557
+ this.dispatchEvent(r), r.form = this;
4558
+ const a = new CustomEvent("mintFormSubmit", {
4559
+ detail: { formData: i, values: s, form: this },
4560
+ bubbles: !0,
4561
+ cancelable: !0,
4562
+ composed: !0
4563
+ });
4564
+ if (a.form = this, this.dispatchEvent(a), r.defaultPrevented || a.defaultPrevented)
4558
4565
  return;
4559
- const a = this.getAttribute("action"), o = this.getAttribute("method");
4560
- if (!(!a || !o)) {
4566
+ const o = this.getAttribute("action"), l = this.getAttribute("method");
4567
+ if (!(!o || !l)) {
4561
4568
  this._setButtonsSubmitting();
4562
4569
  try {
4563
- const c = await this._submitData(i, s);
4570
+ const h = await this._submitData(i, s);
4564
4571
  this.dispatchEvent(new CustomEvent("submitsuccess", {
4565
- detail: c,
4572
+ detail: h,
4566
4573
  bubbles: !0,
4567
4574
  cancelable: !0
4568
4575
  }));
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 },
4576
+ } catch (h) {
4577
+ (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", {
4578
+ detail: { error: h },
4572
4579
  bubbles: !0,
4573
4580
  cancelable: !0
4574
4581
  }));
@@ -4578,7 +4585,7 @@ class _t extends HTMLElement {
4578
4585
  }
4579
4586
  }
4580
4587
  async _submitData(t, e) {
4581
- var d, p, h;
4588
+ var h, p, d;
4582
4589
  const i = this.getAttribute("action"), s = this.getAttribute("method"), n = this.getAttribute("enctype") || "application/x-www-form-urlencoded";
4583
4590
  if (!i)
4584
4591
  return { status: 0, ok: !0, data: { values: e } };
@@ -4586,7 +4593,7 @@ class _t extends HTMLElement {
4586
4593
  let a = null;
4587
4594
  const o = {};
4588
4595
  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") {
4596
+ 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
4597
  const u = new URLSearchParams();
4591
4598
  t.forEach((_, f) => {
4592
4599
  _ instanceof File || u.append(f, String(_));
@@ -4724,7 +4731,7 @@ class _t extends HTMLElement {
4724
4731
  const o = Array.from(r.files);
4725
4732
  e[a] && Array.isArray(e[a]) ? o.forEach((l) => {
4726
4733
  e[a].some(
4727
- (d) => d.name === l.name && d.size === l.size && d.lastModified === l.lastModified
4734
+ (h) => h.name === l.name && h.size === l.size && h.lastModified === l.lastModified
4728
4735
  ) || e[a].push(l);
4729
4736
  }) : e[a] = o;
4730
4737
  }
@@ -4915,6 +4922,13 @@ class _t extends HTMLElement {
4915
4922
  t.removeAttribute("aria-invalid");
4916
4923
  }), this._errors = {};
4917
4924
  }
4925
+ /**
4926
+ * Public method to set form errors programmatically
4927
+ * Can be called from event handlers to set validation errors
4928
+ */
4929
+ setFormErrors(t) {
4930
+ this._applyServerErrors(t);
4931
+ }
4918
4932
  _applyServerErrors(t) {
4919
4933
  this._clearErrors(), Object.entries(t).forEach(([e, i]) => {
4920
4934
  const s = Array.isArray(i) ? i[0] || "Validation error" : i || "Validation error", n = this._getFieldElements(e);
@@ -5066,8 +5080,8 @@ class _t extends HTMLElement {
5066
5080
  if (!n) return;
5067
5081
  const r = this._getFieldName(n);
5068
5082
  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(() => {
5083
+ 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");
5084
+ (l || c || h || p || d) && setTimeout(() => {
5071
5085
  this._validateField(r);
5072
5086
  }, 0);
5073
5087
  };
@@ -5076,38 +5090,38 @@ class _t extends HTMLElement {
5076
5090
  const s = i.target;
5077
5091
  if (!s) return;
5078
5092
  if (i.type === "tags-change" && s.tagName === "MINT-TAGS") {
5079
- const c = s, d = this._getFieldName(c);
5080
- if (!d || !this._collectValidationRules()[d]) return;
5093
+ const c = s, h = this._getFieldName(c);
5094
+ if (!h || !this._collectValidationRules()[h]) return;
5081
5095
  setTimeout(() => {
5082
- this._validateField(d);
5096
+ this._validateField(h);
5083
5097
  }, 0);
5084
5098
  return;
5085
5099
  }
5086
5100
  if (s instanceof HTMLSelectElement || s.tagName === "MINT-SELECT" || s.closest("mint-select")) {
5087
5101
  const c = this._findFieldElement(s);
5088
5102
  if (!c) return;
5089
- const d = this._getFieldName(c);
5090
- if (!d || !this._collectValidationRules()[d]) return;
5103
+ const h = this._getFieldName(c);
5104
+ if (!h || !this._collectValidationRules()[h]) return;
5091
5105
  setTimeout(() => {
5092
- this._validateField(d);
5106
+ this._validateField(h);
5093
5107
  }, 0);
5094
5108
  return;
5095
5109
  }
5096
5110
  if (i.type === "choice-change" && s.tagName === "MINT-CHOICE") {
5097
- const c = s, d = this._getFieldName(c);
5098
- if (!d || !this._collectValidationRules()[d]) return;
5111
+ const c = s, h = this._getFieldName(c);
5112
+ if (!h || !this._collectValidationRules()[h]) return;
5099
5113
  setTimeout(() => {
5100
- this._validateField(d);
5114
+ this._validateField(h);
5101
5115
  }, 0);
5102
5116
  return;
5103
5117
  }
5104
5118
  if (s instanceof HTMLInputElement && s.type === "checkbox" || s.tagName === "MINT-CHECKBOX" || s.tagName === "MINT-SWITCH" || s.closest("mint-checkbox, mint-switch")) {
5105
5119
  const c = this._findFieldElement(s);
5106
5120
  if (!c) return;
5107
- const d = this._getFieldName(c);
5108
- if (!d || !this._collectValidationRules()[d]) return;
5121
+ const h = this._getFieldName(c);
5122
+ if (!h || !this._collectValidationRules()[h]) return;
5109
5123
  setTimeout(() => {
5110
- this._validateField(d);
5124
+ this._validateField(h);
5111
5125
  }, 0);
5112
5126
  return;
5113
5127
  }
@@ -5383,8 +5397,8 @@ class bt extends HTMLElement {
5383
5397
  "dark:bg-gray-800"
5384
5398
  ]);
5385
5399
  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";
5400
+ l.forEach((c, h) => {
5401
+ const p = c.querySelector("mint-icon"), d = (p == null ? void 0 : p.getAttribute("name")) || "", u = p !== null && d !== "ellipsis";
5388
5402
  this._setClasses(c, [
5389
5403
  "text-left",
5390
5404
  "font-semibold",
@@ -5395,13 +5409,13 @@ class bt extends HTMLElement {
5395
5409
  "border-b",
5396
5410
  "border-gray-200",
5397
5411
  "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");
5412
+ ]), 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
5413
  });
5400
5414
  }
5401
5415
  const a = t.querySelector("tbody");
5402
5416
  if (a) {
5403
5417
  const l = Array.from(a.querySelectorAll("tr"));
5404
- l.forEach((c, d) => {
5418
+ l.forEach((c, h) => {
5405
5419
  const p = c.hasAttribute("data-row-clickable");
5406
5420
  this._setClasses(c, [
5407
5421
  "bg-white",
@@ -5409,15 +5423,15 @@ class bt extends HTMLElement {
5409
5423
  "border-b",
5410
5424
  "border-gray-200",
5411
5425
  "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, _) => {
5426
+ ]), 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");
5427
+ const d = c.querySelectorAll("td");
5428
+ d.forEach((u, _) => {
5415
5429
  this._setClasses(u, [
5416
5430
  "text-gray-900",
5417
5431
  "dark:text-gray-100",
5418
5432
  "px-3",
5419
5433
  "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);
5434
+ ]), _ === 0 && u.classList.add("pl-6"), _ === d.length - 1 && u.classList.add("pr-6"), e ? this._applyMobileCell(u, s) : this._restoreCell(u);
5421
5435
  });
5422
5436
  });
5423
5437
  }
@@ -6193,7 +6207,7 @@ class xt extends HTMLElement {
6193
6207
  }), this._configuration.sortBy || (this._configuration.sortBy = "id"), this._configuration.sort || (this._configuration.sort = "asc"));
6194
6208
  }
6195
6209
  async _fetchData(t, e = !0, i, s) {
6196
- var o, l, c, d, p, h, u, _;
6210
+ var o, l, c, h, p, d, u, _;
6197
6211
  if (!this._configuration) return;
6198
6212
  const n = t || (typeof this._configuration.data == "string" ? this._configuration.data : null);
6199
6213
  if (!n || this._fetching || this._loading)
@@ -6222,9 +6236,9 @@ class xt extends HTMLElement {
6222
6236
  this._configuration.predefinedData ? (x = [...this._configuration.predefinedData, ...v], this._totalRows = k + this._configuration.predefinedData.length) : this._totalRows = k, this._rows = x;
6223
6237
  }
6224
6238
  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;
6239
+ 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
6240
  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")) {
6241
+ 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
6242
  if (E) {
6229
6243
  const x = this._loading, T = this._fetching;
6230
6244
  this._loading = !1, this._fetching = !1, this._updateTableBody(), this._loading = x, this._fetching = T;
@@ -6257,13 +6271,13 @@ class xt extends HTMLElement {
6257
6271
  if (a == null) return -1;
6258
6272
  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
6273
  if (o !== null && l !== null) {
6260
- const h = o - l;
6261
- return i === "asc" ? h : -h;
6274
+ const d = o - l;
6275
+ return i === "asc" ? d : -d;
6262
6276
  }
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;
6277
+ 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;
6278
+ if (c && h && !isNaN(c.getTime()) && !isNaN(h.getTime())) {
6279
+ const d = c.getTime() - h.getTime();
6280
+ return i === "asc" ? d : -d;
6267
6281
  }
6268
6282
  const p = String(r).localeCompare(String(a), void 0, { numeric: !0, sensitivity: "base" });
6269
6283
  return i === "asc" ? p : -p;
@@ -6357,53 +6371,53 @@ class xt extends HTMLElement {
6357
6371
  const i = this.querySelector(`#search-${this._tableId}`), s = document.activeElement === i || (i == null ? void 0 : i.querySelector("input")) === document.activeElement, n = this._search;
6358
6372
  let r = "";
6359
6373
  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") {
6374
+ const h = typeof this._configuration.onRowClick == "function", p = h ? "cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors" : "";
6375
+ r += `<tr data-row-index="${c}" ${h ? 'data-row-clickable="true"' : ""}${p ? ` class="${p}"` : ""}>`, this._configuration.columns.forEach((d, u) => {
6376
+ if (d.hidden) return;
6377
+ const _ = !d.show || d.show(this, l);
6378
+ if (r += `<td style="${this._getStyle(d)}" class="${this._getClasses(d, !0)}">`, _)
6379
+ if (d.raw)
6380
+ if (d.action)
6381
+ (!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>`);
6382
+ else if (d.actions)
6383
+ if (d.actionStyle !== "buttons") {
6370
6384
  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) => {
6385
+ 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
6386
  if (!g.show || g.show(this, l)) {
6373
6387
  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>`;
6388
+ 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
6389
  }
6376
6390
  }), r += "</mint-popover>";
6377
6391
  } else
6378
- h.actions.forEach((f, m) => {
6392
+ d.actions.forEach((f, m) => {
6379
6393
  if (!f.show || f.show(this, l)) {
6380
6394
  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>";
6395
+ 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
6396
  }
6383
6397
  });
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>`;
6398
+ else typeof d.format == "function" ? r += d.format(this, l) : d.data && (r += this._escapeHtml(String(l[d.data] || "")));
6399
+ else if (d.action) {
6400
+ if (!d.action.show || d.action.show(this, l)) {
6401
+ const f = typeof d.action.label == "function" ? d.action.label(this, l) : d.action.label;
6402
+ 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
6403
  }
6390
- } else if (h.actions)
6391
- if (h.actionStyle !== "buttons") {
6404
+ } else if (d.actions)
6405
+ if (d.actionStyle !== "buttons") {
6392
6406
  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) => {
6407
+ 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
6408
  if (!g.show || g.show(this, l)) {
6395
6409
  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>`;
6410
+ 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
6411
  }
6398
6412
  }), r += "</mint-popover>";
6399
6413
  } else
6400
- h.actions.forEach((f, m) => {
6414
+ d.actions.forEach((f, m) => {
6401
6415
  if (!f.show || f.show(this, l)) {
6402
6416
  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>";
6417
+ 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
6418
  }
6405
6419
  });
6406
- else typeof h.format == "function" ? r += this._escapeHtml(h.format(this, l)) : h.data && (r += this._escapeHtml(String(l[h.data] || "")));
6420
+ else typeof d.format == "function" ? r += this._escapeHtml(d.format(this, l)) : d.data && (r += this._escapeHtml(String(l[d.data] || "")));
6407
6421
  r += "</td>";
6408
6422
  }), r += "</tr>";
6409
6423
  }), 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 +6499,7 @@ class xt extends HTMLElement {
6485
6499
  var c;
6486
6500
  const l = o.getAttribute("colspan");
6487
6501
  if (l)
6488
- for (let d = 0; d < parseInt(l) - 1; d++)
6502
+ for (let h = 0; h < parseInt(l) - 1; h++)
6489
6503
  a.push("");
6490
6504
  a.push('"' + ((c = o.textContent) == null ? void 0 : c.trim().replace(/"/g, '""')) + '"');
6491
6505
  }), i += a.join(",") + `
@@ -6575,30 +6589,30 @@ class xt extends HTMLElement {
6575
6589
  }
6576
6590
  }), s += "</tr></thead>", s += "<tbody>", !this._fetching && !this._loading && e.forEach((r, a) => {
6577
6591
  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) => {
6592
+ s += `<tr data-row-index="${a}" ${o ? 'data-row-clickable="true"' : ""}${l ? ` class="${l}"` : ""}>`, this._configuration.columns.forEach((c, h) => {
6579
6593
  if (c.hidden) return;
6580
6594
  const p = !c.show || c.show(this, r);
6581
6595
  if (s += `<td style="${this._getStyle(c)}" class="${this._getClasses(c, !0)}">`, p)
6582
6596
  if (c.raw)
6583
6597
  if (c.action) {
6584
6598
  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>`;
6599
+ const d = typeof c.action.label == "function" ? c.action.label(this, r) : c.action.label;
6600
+ 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
6601
  }
6588
6602
  } else if (c.actions)
6589
6603
  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) => {
6604
+ const d = `actions-popover-${this._tableId}-${a}`, u = `actions-button-${this._tableId}-${a}`;
6605
+ 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
6606
  if (!_.show || _.show(this, r)) {
6593
6607
  const m = typeof _.label == "function" ? _.label(this, r) : _.label;
6594
6608
  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
6609
  }
6596
6610
  }), s += "</mint-popover>";
6597
6611
  } 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>";
6612
+ c.actions.forEach((d, u) => {
6613
+ if (!d.show || d.show(this, r)) {
6614
+ 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)}"` : "";
6615
+ 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
6616
  }
6603
6617
  });
6604
6618
  else typeof c.format == "function" ? s += c.format(this, r) : c.data && (s += this._escapeHtml(String(r[c.data] || "")));
@@ -6606,18 +6620,18 @@ class xt extends HTMLElement {
6606
6620
  (!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
6621
  else if (c.actions)
6608
6622
  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) => {
6623
+ const d = `actions-popover-${this._tableId}-${a}`, u = `actions-button-${this._tableId}-${a}`;
6624
+ 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
6625
  if (!_.show || _.show(this, r)) {
6612
6626
  const m = typeof _.label == "function" ? _.label(this, r) : _.label;
6613
6627
  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
6628
  }
6615
6629
  }), s += "</mint-popover>";
6616
6630
  } 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>";
6631
+ c.actions.forEach((d, u) => {
6632
+ if (!d.show || d.show(this, r)) {
6633
+ 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)}"` : "";
6634
+ 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
6635
  }
6622
6636
  });
6623
6637
  else typeof c.format == "function" ? s += this._escapeHtml(c.format(this, r)) : c.data && (s += this._escapeHtml(String(r[c.data] || "")));
@@ -6802,12 +6816,12 @@ class wt extends HTMLElement {
6802
6816
  ).forEach((u) => {
6803
6817
  this._bodySlot && u.parentElement !== this._bodySlot && this._bodySlot.appendChild(u);
6804
6818
  }), 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(
6819
+ let h = this._actionsSlot.querySelector("mint-stack");
6820
+ h || (h = document.createElement("mint-stack"), h.setAttribute("direction", "horizontal"), h.className = "justify-end", this._actionsSlot.appendChild(h)), Array.from(this.children).filter(
6807
6821
  (u) => u !== this._overlay && u !== this._offCanvas && u !== this._actionsSlot && u.getAttribute("slot") === "actions"
6808
6822
  ).forEach((u) => {
6809
6823
  Array.from(u.children).forEach((f) => {
6810
- f.parentElement !== d && d.appendChild(f);
6824
+ f.parentElement !== h && h.appendChild(f);
6811
6825
  }), u.parentElement && u.remove();
6812
6826
  }), Array.from(this.children).forEach((u) => {
6813
6827
  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);