monobill-mintui 0.5.91 → 0.5.93

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.
Files changed (31) hide show
  1. package/dist/components/button/Button.d.ts +12 -1
  2. package/dist/components/button/Button.d.ts.map +1 -1
  3. package/dist/components/icon/Icon.d.ts.map +1 -1
  4. package/dist/components/icon/icons/ai.d.ts +3 -0
  5. package/dist/components/icon/icons/ai.d.ts.map +1 -0
  6. package/dist/components/icon/icons/bank.d.ts +3 -0
  7. package/dist/components/icon/icons/bank.d.ts.map +1 -0
  8. package/dist/components/icon/icons/gavel.d.ts +3 -0
  9. package/dist/components/icon/icons/gavel.d.ts.map +1 -0
  10. package/dist/components/icon/icons/index.cjs +29 -2
  11. package/dist/components/icon/icons/index.d.ts +4 -0
  12. package/dist/components/icon/icons/index.d.ts.map +1 -1
  13. package/dist/components/icon/icons/index.js +190 -172
  14. package/dist/components/icon/icons/truck.d.ts +3 -0
  15. package/dist/components/icon/icons/truck.d.ts.map +1 -0
  16. package/dist/components/popover/Popover.d.ts.map +1 -1
  17. package/dist/components/resource-table/ResourceTable.d.ts +167 -13
  18. package/dist/components/resource-table/ResourceTable.d.ts.map +1 -1
  19. package/dist/components/resource-table/ResourceTableContextMenu.d.ts +40 -0
  20. package/dist/components/resource-table/ResourceTableContextMenu.d.ts.map +1 -0
  21. package/dist/components/resource-table/index.d.ts +1 -0
  22. package/dist/components/resource-table/index.d.ts.map +1 -1
  23. package/dist/components/table/Table.d.ts +0 -4
  24. package/dist/components/table/Table.d.ts.map +1 -1
  25. package/dist/index.cjs +7 -70
  26. package/dist/index.js +1102 -452
  27. package/dist/search-D689q6uZ.cjs +1 -0
  28. package/dist/{search-CzN2cZZy.js → search-RbD9n2_q.js} +39 -9
  29. package/dist/styles.css +1 -1
  30. package/package.json +1 -1
  31. package/dist/search-DDVJFS8d.cjs +0 -1
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { m as e } from "./search-CzN2cZZy.js";
1
+ import { _ as e } from "./search-RbD9n2_q.js";
2
2
  //#region src/components/spinner/Spinner.ts
3
3
  var t = class extends HTMLElement {
4
4
  static get observedAttributes() {
@@ -162,7 +162,7 @@ var n = class extends HTMLElement {
162
162
  let r = this.closest("mint-button") || this.parentElement?.closest("mint-button"), i = this.closest("mint-switch") || this.parentElement?.closest("mint-switch"), a = this.closest("mint-select") || this.parentElement?.closest("mint-select"), o = !!this.closest("mint-sidenav-link") && !r && !i && !a;
163
163
  if (!Array.from(this.classList).some((e) => e.startsWith("w-") || e.startsWith("h-")) && !a) {
164
164
  let e;
165
- e = i ? "w-3 h-3" : r || o ? "w-[1em] h-[1em]" : "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", "w-[0.875em]", "h-[0.875em]"), e.split(" ").forEach((e) => {
165
+ e = i ? "w-3 h-3" : r || o ? "w-[1em] h-[1em]" : "w-[1.3em] h-[1.3em]", this.classList.remove("w-4", "h-4", "w-5", "h-5", "w-[1em]", "h-[1em]", "w-[1.12em]", "h-[1.12em]", "w-[1.3em]", "h-[1.3em]", "w-[1.65em]", "h-[1.65em]", "w-3", "h-3", "w-[0.875em]", "h-[0.875em]"), e.split(" ").forEach((e) => {
166
166
  e && this.classList.add(e);
167
167
  });
168
168
  }
@@ -204,7 +204,7 @@ var r = class e extends HTMLElement {
204
204
  this._activeShadowStyleInjected = !1;
205
205
  }
206
206
  constructor() {
207
- super(), this._button = null, this._clickHandler = null, this._isHandlingClick = !1, this._handleMouseDown = () => {
207
+ super(), this._button = null, this._clickHandler = null, this._isHandlingClick = !1, this._hostChildObserver = null, this._hostRenderFromObserverRaf = null, this._handleMouseDown = () => {
208
208
  this._button && !this.isDisabled() && !this.isLoading() && this._button.classList.add("mint-button-active");
209
209
  }, this._handleMouseUp = () => {
210
210
  this._button && (this.isActive() || this._button.classList.remove("mint-button-active"));
@@ -232,7 +232,7 @@ var r = class e extends HTMLElement {
232
232
  this.classList.add("box-border", "m-0", "p-0", "border-0", "align-baseline", "inline-block"), this.render(), this._button && this.setupEventListeners(), this.isFullWidth() && this.classList.add("w-full");
233
233
  }
234
234
  disconnectedCallback() {
235
- this.removeEventListeners();
235
+ this._disconnectHostChildObserver(), this._hostRenderFromObserverRaf !== null && (cancelAnimationFrame(this._hostRenderFromObserverRaf), this._hostRenderFromObserverRaf = null), this.removeEventListeners();
236
236
  }
237
237
  attributeChangedCallback(e, t, n) {
238
238
  t !== n && this.render();
@@ -437,6 +437,38 @@ var r = class e extends HTMLElement {
437
437
  ]
438
438
  }[e] || [];
439
439
  }
440
+ _disconnectHostChildObserver() {
441
+ this._hostChildObserver?.disconnect();
442
+ }
443
+ _connectHostChildObserver() {
444
+ this.isConnected && (this._hostChildObserver ||= new MutationObserver((e) => {
445
+ this._onLightDomMutation(e);
446
+ }), this._hostChildObserver.disconnect(), this._hostChildObserver.observe(this, {
447
+ childList: !0,
448
+ subtree: !0,
449
+ characterData: !0
450
+ }));
451
+ }
452
+ _onLightDomMutation(e) {
453
+ if (this.isConnected) {
454
+ if (this._button && !this._button.isConnected) {
455
+ this._button = null, this._scheduleRenderFromHostObserver();
456
+ return;
457
+ }
458
+ for (let t of e) {
459
+ let e = t.target;
460
+ if (!(this._button && (e === this._button || this._button.contains(e)))) {
461
+ this._scheduleRenderFromHostObserver();
462
+ return;
463
+ }
464
+ }
465
+ }
466
+ }
467
+ _scheduleRenderFromHostObserver() {
468
+ this._hostRenderFromObserverRaf === null && (this._hostRenderFromObserverRaf = requestAnimationFrame(() => {
469
+ this._hostRenderFromObserverRaf = null, this.isConnected && this.render();
470
+ }));
471
+ }
440
472
  getButtonClasses() {
441
473
  let e = this.isIconOnly(), t = this.getVariant(), n = this.getAlignment(), r = "justify-center";
442
474
  n === "left" ? r = "justify-start" : n === "right" && (r = "justify-end");
@@ -657,69 +689,76 @@ var r = class e extends HTMLElement {
657
689
  return this.isFullWidth() && c.push("w-full"), c.join(" ");
658
690
  }
659
691
  render() {
660
- let e = this.isDisabled() || this.isLoading(), t = this.getType();
661
- if (!this._button) {
662
- let e = this.firstElementChild;
663
- if (e instanceof HTMLButtonElement) this._button = e;
664
- else {
665
- for (this._button = document.createElement("button"); this.firstChild;) this._button.appendChild(this.firstChild);
666
- this.appendChild(this._button);
692
+ this._disconnectHostChildObserver(), this._button && !this._button.isConnected && (this._button = null);
693
+ try {
694
+ let e = this.isDisabled() || this.isLoading(), t = this.getType();
695
+ if (!this._button) {
696
+ let e = this.firstElementChild;
697
+ if (e instanceof HTMLButtonElement) this._button = e;
698
+ else {
699
+ for (this._button = document.createElement("button"); this.firstChild;) this._button.appendChild(this.firstChild);
700
+ this.appendChild(this._button);
701
+ }
702
+ this.setupEventListeners();
667
703
  }
668
- this.setupEventListeners();
669
- }
670
- this._button.type = t, this._button.disabled = e;
671
- let n = this._button.querySelector("mint-spinner"), r = this.isLoading();
672
- if (r) if (n) n.setAttribute("data-button-variant", this.getVariant()), n.setAttribute("data-button-tone", this.getTone()), "render" in n && typeof n.render == "function" && n.render();
673
- else {
674
- let e = document.createElement("span");
675
- e.className = "mr-2 inline-flex items-center";
676
- let t = document.createElement("mint-spinner");
677
- t.setAttribute("size", "default"), t.setAttribute("data-button-variant", this.getVariant()), t.setAttribute("data-button-tone", this.getTone()), t.style.width = "0.875rem", t.style.height = "0.875rem", e.appendChild(t), this._button.insertBefore(e, this._button.firstChild);
678
- }
679
- else n && n.parentElement?.remove();
680
- for (; this.firstChild && this.firstChild !== this._button;) this._button.appendChild(this.firstChild);
681
- let i = this.getIcon(), a = this._getGeneratedIcon();
682
- i ? (a || (a = document.createElement("mint-icon"), a.setAttribute("data-generated-icon", "true"), a.className = "mint-button-icon"), a.setAttribute("name", i)) : a && a.tagName === "MINT-ICON" && (a.remove(), a = null);
683
- let o = this.getIconPosition(), s = this._button.querySelector(".mint-button-content");
684
- if (s) {
685
- s.className = this._getContentWrapperClass(s);
686
- let e = a && a.tagName === "MINT-ICON";
687
- if (a && !a.parentElement) {
688
- let t = this._button.querySelector("mint-spinner")?.parentElement;
689
- e || o === "left" ? t ? t.insertAdjacentElement("afterend", a) : this._button.insertBefore(a, s) : s.insertAdjacentElement("afterend", a);
690
- } else if (a && (e || o === "left") && a.nextSibling !== s) {
691
- a.remove();
692
- let e = this._button.querySelector("mint-spinner")?.parentElement;
693
- e ? e.insertAdjacentElement("afterend", a) : this._button.insertBefore(a, s);
694
- } else a && !e && o === "right" && a.previousSibling !== s && (a.remove(), s.insertAdjacentElement("afterend", a));
695
- } else {
696
- let e = [];
697
- for (let t = this._button.firstChild; t; t = t.nextSibling) {
698
- if (t.nodeType !== Node.ELEMENT_NODE) {
699
- e.push(t);
700
- continue;
704
+ this._button.type = t, this._button.disabled = e;
705
+ let n = this._button.querySelector("mint-spinner"), r = this.isLoading();
706
+ if (r) if (n) n.setAttribute("data-button-variant", this.getVariant()), n.setAttribute("data-button-tone", this.getTone()), "render" in n && typeof n.render == "function" && n.render();
707
+ else {
708
+ let e = document.createElement("span");
709
+ e.className = "mr-2 inline-flex items-center";
710
+ let t = document.createElement("mint-spinner");
711
+ t.setAttribute("size", "default"), t.setAttribute("data-button-variant", this.getVariant()), t.setAttribute("data-button-tone", this.getTone()), t.style.width = "0.875rem", t.style.height = "0.875rem", e.appendChild(t), this._button.insertBefore(e, this._button.firstChild);
712
+ }
713
+ else n && n.parentElement?.remove();
714
+ for (; this.firstChild && this.firstChild !== this._button;) this._button.appendChild(this.firstChild);
715
+ let i = this.getIcon(), a = this._getGeneratedIcon();
716
+ i ? (a || (a = document.createElement("mint-icon"), a.setAttribute("data-generated-icon", "true"), a.className = "mint-button-icon"), a.setAttribute("name", i)) : a && a.tagName === "MINT-ICON" && (a.remove(), a = null);
717
+ let o = this.getIconPosition(), s = this._button.querySelector(".mint-button-content");
718
+ if (s) {
719
+ s.className = this._getContentWrapperClass(s);
720
+ let e = a && a.tagName === "MINT-ICON";
721
+ if (a && !a.parentElement) {
722
+ let t = this._button.querySelector("mint-spinner")?.parentElement;
723
+ e || o === "left" ? t ? t.insertAdjacentElement("afterend", a) : this._button.insertBefore(a, s) : s.insertAdjacentElement("afterend", a);
724
+ } else if (a && (e || o === "left") && a.nextSibling !== s) {
725
+ a.remove();
726
+ let e = this._button.querySelector("mint-spinner")?.parentElement;
727
+ e ? e.insertAdjacentElement("afterend", a) : this._button.insertBefore(a, s);
728
+ } else a && !e && o === "right" && a.previousSibling !== s && (a.remove(), s.insertAdjacentElement("afterend", a));
729
+ } else {
730
+ let e = [];
731
+ for (let t = this._button.firstChild; t; t = t.nextSibling) {
732
+ if (t.nodeType !== Node.ELEMENT_NODE) {
733
+ e.push(t);
734
+ continue;
735
+ }
736
+ let n = t;
737
+ n.tagName !== "MINT-SPINNER" && !n.querySelector("mint-spinner") && t !== a && !n.hasAttribute("slot") && !(n.className === "mr-2" && n.querySelector("mint-spinner")) && e.push(t);
701
738
  }
702
- let n = t;
703
- n.tagName !== "MINT-SPINNER" && !n.querySelector("mint-spinner") && t !== a && !n.hasAttribute("slot") && !(n.className === "mr-2" && n.querySelector("mint-spinner")) && e.push(t);
704
- }
705
- if (e.length > 0) {
706
- s = document.createElement("span"), s.className = this._getContentWrapperClass(s), e.forEach((e) => {
707
- s.appendChild(e);
708
- }), s.className = this._getContentWrapperClass(s);
709
- let t = this._button.querySelector("mint-spinner")?.parentElement;
710
- a && o === "left" ? t ? (t.insertAdjacentElement("afterend", a), a.insertAdjacentElement("afterend", s)) : (this._button.insertBefore(a, this._button.firstChild), a.insertAdjacentElement("afterend", s)) : a && o === "right" ? t ? (t.insertAdjacentElement("afterend", s), s.insertAdjacentElement("afterend", a)) : (this._button.insertBefore(s, this._button.firstChild), s.insertAdjacentElement("afterend", a)) : t ? t.insertAdjacentElement("afterend", s) : this._button.insertBefore(s, this._button.firstChild);
711
- } else if (a && a.tagName === "MINT-ICON" && !a.parentElement) {
739
+ if (e.length > 0) {
740
+ s = document.createElement("span"), s.className = this._getContentWrapperClass(s), e.forEach((e) => {
741
+ s.appendChild(e);
742
+ }), s.className = this._getContentWrapperClass(s);
743
+ let t = this._button.querySelector("mint-spinner")?.parentElement;
744
+ a && o === "left" ? t ? (t.insertAdjacentElement("afterend", a), a.insertAdjacentElement("afterend", s)) : (this._button.insertBefore(a, this._button.firstChild), a.insertAdjacentElement("afterend", s)) : a && o === "right" ? t ? (t.insertAdjacentElement("afterend", s), s.insertAdjacentElement("afterend", a)) : (this._button.insertBefore(s, this._button.firstChild), s.insertAdjacentElement("afterend", a)) : t ? t.insertAdjacentElement("afterend", s) : this._button.insertBefore(s, this._button.firstChild);
745
+ } else if (a && a.tagName === "MINT-ICON" && !a.parentElement) {
746
+ let e = this._button.querySelector("mint-spinner")?.parentElement;
747
+ e ? e.insertAdjacentElement("afterend", a) : this._button.insertBefore(a, this._button.firstChild);
748
+ }
749
+ }
750
+ let c = this.isIconOnly();
751
+ if (a && (a.classList.contains("mint-button-icon") || a.classList.add("mint-button-icon"), r ? a.style.display = "none" : a.style.display = "", a.classList.remove("mr-1.5", "ml-1.5"), c ? a.tagName === "MINT-ICON" ? (a.style.width = "1em", a.style.height = "1em", a.style.maxWidth = "1em", a.style.maxHeight = "1em", a.style.flexShrink = "0") : (a.style.maxWidth = "1em", a.style.maxHeight = "1em", a.style.flexShrink = "0", a.tagName === "svg" && (a.style.width = "1em", a.style.height = "1em")) : o === "left" ? a.classList.add("mr-1.5") : a.classList.add("ml-1.5")), r) {
712
752
  let e = this._button.querySelector("mint-spinner")?.parentElement;
713
- e ? e.insertAdjacentElement("afterend", a) : this._button.insertBefore(a, this._button.firstChild);
753
+ e && (c ? (e.classList.remove("mr-2"), e.classList.add("mr-0")) : e.classList.contains("mr-2") || (e.classList.remove("mr-0"), e.classList.add("mr-2")));
714
754
  }
755
+ let l = this.getButtonClasses();
756
+ this._button.className = l, this.setAttribute("data-variant", this.getVariant()), this.setAttribute("data-tone", this.getTone()), this._button.setAttribute("data-variant", this.getVariant()), r ? this._button.setAttribute("data-loading", "true") : this._button.removeAttribute("data-loading"), this.isActive() ? this._button.classList.add("mint-button-active") : this._button.classList.remove("mint-button-active");
757
+ } finally {
758
+ queueMicrotask(() => {
759
+ this.isConnected && this._connectHostChildObserver();
760
+ });
715
761
  }
716
- let c = this.isIconOnly();
717
- if (a && (a.classList.contains("mint-button-icon") || a.classList.add("mint-button-icon"), r ? a.style.display = "none" : a.style.display = "", a.classList.remove("mr-1.5", "ml-1.5"), c ? a.tagName === "MINT-ICON" ? (a.style.width = "1em", a.style.height = "1em", a.style.maxWidth = "1em", a.style.maxHeight = "1em", a.style.flexShrink = "0") : (a.style.maxWidth = "1em", a.style.maxHeight = "1em", a.style.flexShrink = "0", a.tagName === "svg" && (a.style.width = "1em", a.style.height = "1em")) : o === "left" ? a.classList.add("mr-1.5") : a.classList.add("ml-1.5")), r) {
718
- let e = this._button.querySelector("mint-spinner")?.parentElement;
719
- e && (c ? (e.classList.remove("mr-2"), e.classList.add("mr-0")) : e.classList.contains("mr-2") || (e.classList.remove("mr-0"), e.classList.add("mr-2")));
720
- }
721
- let l = this.getButtonClasses();
722
- this._button.className = l, this.setAttribute("data-variant", this.getVariant()), this.setAttribute("data-tone", this.getTone()), this._button.setAttribute("data-variant", this.getVariant()), r ? this._button.setAttribute("data-loading", "true") : this._button.removeAttribute("data-loading"), this.isActive() ? this._button.classList.add("mint-button-active") : this._button.classList.remove("mint-button-active");
723
762
  }
724
763
  setupEventListeners() {
725
764
  this._button && !this._clickHandler && (this._clickHandler = this.handleClick.bind(this), this._clickHandler && this._button.addEventListener("click", this._clickHandler, !0), this._button.addEventListener("mousedown", this._handleMouseDown), this._button.addEventListener("mouseup", this._handleMouseUp), this._button.addEventListener("mouseleave", this._handleMouseLeave), this._button.addEventListener("touchstart", this._handleTouchStart), this._button.addEventListener("touchend", this._handleTouchEnd), this._button.addEventListener("touchcancel", this._handleTouchCancel));
@@ -1840,9 +1879,9 @@ var p = class extends HTMLElement {
1840
1879
  }
1841
1880
  this.isHoverEnabled() && this._attachHoverListeners();
1842
1881
  let r = this._popover.querySelector(".popover-content");
1843
- if (!r) r = document.createElement("div"), r.className = `popover-content bg-white dark:bg-mint-elevated dark:border dark:border-mint-divider rounded-lg shadow-xl ${n} transform`, this._popover.appendChild(r);
1882
+ if (!r) r = document.createElement("div"), r.className = `popover-content bg-white dark:bg-mint-elevated border border-gray-200 dark:border-mint-divider rounded-lg shadow-xl ${n} transform`, this._popover.appendChild(r);
1844
1883
  else {
1845
- let e = r.className.split(" "), t = [
1884
+ let e = r.className.split(/\s+/).filter(Boolean), t = [
1846
1885
  "p-0",
1847
1886
  "p-0.5",
1848
1887
  "p-1",
@@ -1860,8 +1899,13 @@ var p = class extends HTMLElement {
1860
1899
  "p-16",
1861
1900
  "p-20",
1862
1901
  "p-24"
1863
- ], i = e.filter((e) => !t.includes(e));
1864
- r.className = [...i, n].join(" ");
1902
+ ], i = e.filter((e) => !t.includes(e)), a = [
1903
+ "border",
1904
+ "border-gray-200",
1905
+ "dark:border-mint-divider"
1906
+ ], o = [...i];
1907
+ for (let e of a) o.includes(e) || o.push(e);
1908
+ r.className = [...o, n].join(" ");
1865
1909
  }
1866
1910
  Array.from(this.children).forEach((e) => {
1867
1911
  e !== this._overlay && e !== this._popover && e.parentElement === this && r.appendChild(e);
@@ -1876,7 +1920,7 @@ var p = class extends HTMLElement {
1876
1920
  _updateBackgroundColor() {
1877
1921
  if (!this._popover) return;
1878
1922
  let e = document.documentElement.classList.contains("dark"), t = this._popover.querySelector(".popover-content");
1879
- t && (e ? (t.classList.remove("bg-white"), t.classList.add("bg-mint-elevated", "border", "border-mint-divider")) : (t.classList.remove("bg-mint-elevated", "border", "border-mint-divider"), t.classList.add("bg-white")));
1923
+ t && (e ? (t.classList.remove("bg-white"), t.classList.add("bg-mint-elevated")) : (t.classList.remove("bg-mint-elevated"), t.classList.add("bg-white")));
1880
1924
  }
1881
1925
  _observeDarkMode() {
1882
1926
  this._darkModeObserver || (this._darkModeObserver = new MutationObserver(() => {
@@ -5582,20 +5626,14 @@ var S = class extends HTMLElement {
5582
5626
  constructor(...e) {
5583
5627
  super(...e), this._observer = null;
5584
5628
  }
5585
- static get observedAttributes() {
5586
- return ["collapse", "scroll"];
5587
- }
5588
5629
  connectedCallback() {
5589
- this.classList.add("box-border", "m-0", "p-0", "align-baseline", "block", "w-full", "overflow-x-auto"), this.hasAttribute("collapse") && !this.hasAttribute("scroll") && this._ensureResponsiveStyles(), this._observeChanges(), this._applyStyles(), requestAnimationFrame(() => {
5630
+ this.classList.add("box-border", "m-0", "p-0", "align-baseline", "block", "w-full", "rounded-lg", "border", "border-gray-200", "dark:border-mint-divider"), this.hasAttribute("data-mint-rt-scroll-inner") ? this.classList.add("min-w-0", "overflow-x-visible", "overflow-y-visible") : this.classList.add("min-w-0", "overflow-x-auto"), this._observeChanges(), this._applyStyles(), requestAnimationFrame(() => {
5590
5631
  this._applyStyles(), setTimeout(() => this._applyStyles(), 0);
5591
5632
  });
5592
5633
  }
5593
5634
  disconnectedCallback() {
5594
5635
  this._observer &&= (this._observer.disconnect(), null);
5595
5636
  }
5596
- attributeChangedCallback() {
5597
- this.hasAttribute("collapse") && !this.hasAttribute("scroll") && this._ensureResponsiveStyles(), this._applyStyles();
5598
- }
5599
5637
  _observeChanges() {
5600
5638
  this._observer = new MutationObserver(() => this._applyStyles()), this._observer.observe(this, {
5601
5639
  childList: !0,
@@ -5605,28 +5643,28 @@ var S = class extends HTMLElement {
5605
5643
  }
5606
5644
  _applyStyles() {
5607
5645
  this._observer && this._observer.disconnect();
5608
- let e = this.querySelector("table");
5609
- if (!e) {
5646
+ let e = Array.from(this.querySelectorAll("table"));
5647
+ if (e.length === 0) {
5610
5648
  this._observer && this._observeChanges();
5611
5649
  return;
5612
5650
  }
5613
- let t = this.hasAttribute("collapse") && !this.hasAttribute("scroll"), n = this.hasAttribute("scroll");
5614
- n ? this.classList.add("relative") : this.classList.remove("relative");
5615
- let r = [], i = e.querySelector("thead tr");
5616
- i && i.querySelectorAll("th").forEach((e) => r.push((e.textContent || "").trim())), this._setClasses(e, [
5617
- "w-full",
5618
- n ? "min-w-[1200px]" : "",
5619
- "border-collapse",
5620
- "text-sm",
5621
- "font-medium",
5622
- "overflow-hidden"
5623
- ]);
5624
- let a = e.querySelector("thead");
5625
- if (a) {
5626
- this._setClasses(a, ["bg-[#F7F7F7]", "dark:bg-mint-elevated"]);
5627
- let e = a.querySelectorAll("th");
5651
+ let t = e.find((e) => e.querySelector("thead")) ?? e[0], n = e.find((e) => e.querySelector("tbody")) ?? e[0];
5652
+ e.forEach((e) => {
5653
+ let t = !!e.closest("[id^=\"mint-rt-vscroll-\"]"), n = !!e.closest("mint-resource-table[data-mint-rt-fixed-header]"), r = t || n, i = [
5654
+ "w-full",
5655
+ r ? "border-separate border-spacing-0" : "border-collapse",
5656
+ "text-sm",
5657
+ "font-medium",
5658
+ ...r ? [] : ["overflow-hidden"]
5659
+ ];
5660
+ this._setClasses(e, i);
5661
+ });
5662
+ let r = t.querySelector("thead");
5663
+ if (r) {
5664
+ r.classList.add("bg-[#F7F7F7]", "dark:bg-mint-nav");
5665
+ let e = r.querySelectorAll("th");
5628
5666
  e.forEach((t, n) => {
5629
- let r = t.querySelector("mint-icon"), i = r?.getAttribute("name") || "", a = r !== null && i !== "ellipsis";
5667
+ let r = t.querySelector("mint-icon"), i = r?.getAttribute("name") || "", a = t.hasAttribute("data-mint-rt-sortable") || r !== null && i !== "ellipsis";
5630
5668
  this._setClasses(t, [
5631
5669
  "text-left",
5632
5670
  "font-semibold",
@@ -5636,39 +5674,51 @@ var S = class extends HTMLElement {
5636
5674
  "py-2",
5637
5675
  "border-b",
5638
5676
  "border-gray-200",
5639
- "dark:border-mint-divider"
5640
- ]), a && t.classList.add("cursor-pointer", "bg-[#F7F7F7]", "dark:bg-mint-elevated", "hover:bg-gray-100", "dark:hover:bg-mint-hover"), n === 0 && t.classList.add("pl-6"), n === e.length - 1 && t.classList.add("pr-6");
5677
+ "dark:border-mint-divider",
5678
+ "bg-[#F7F7F7]",
5679
+ "dark:bg-mint-nav"
5680
+ ]), a && t.classList.add("cursor-pointer", "hover:bg-gray-100", "dark:hover:bg-mint-hover"), n === 0 && t.classList.add("pl-3"), n === e.length - 1 && t.classList.add("pr-3");
5681
+ let o = t.closest("table"), s = o?.closest("mint-resource-table"), c = !!s?.hasAttribute("data-mint-rt-fixed-header"), l = !!s?.hasAttribute("data-mint-rt-fixed-controls");
5682
+ if (o?.closest("[id^=\"mint-rt-vscroll-\"]") || c) {
5683
+ let e = c && l ? "top-[var(--mint-rt-fixed-controls-h,0px)]" : "top-0";
5684
+ t.classList.add("sticky", e, "z-30", "bg-[#F7F7F7]", "dark:bg-mint-nav", "shadow-sm");
5685
+ }
5641
5686
  });
5642
5687
  }
5643
- let o = e.querySelector("tbody");
5644
- if (o) {
5645
- let e = Array.from(o.querySelectorAll("tr"));
5688
+ let i = n.querySelector("tbody");
5689
+ if (i) {
5690
+ let e = Array.from(i.querySelectorAll("tr")), t = !!n.closest("[id^=\"mint-rt-vscroll-\"]") || !!n.closest("mint-resource-table")?.hasAttribute("data-mint-rt-fixed-header"), r = e.findIndex((e) => e.getAttribute("data-mint-rt-spacer") === "bottom");
5646
5691
  e.forEach((n, i) => {
5647
- let a = n.hasAttribute("data-row-clickable");
5648
- this._setClasses(n, [
5692
+ let a = n.hasAttribute("data-mint-rt-spacer"), o = n.hasAttribute("data-row-clickable");
5693
+ a || t ? this._setClasses(n, ["bg-white", "dark:bg-mint-canvas"]) : this._setClasses(n, [
5649
5694
  "bg-white",
5650
5695
  "dark:bg-mint-canvas",
5651
5696
  "border-b",
5652
5697
  "border-gray-200",
5653
5698
  "dark:border-mint-divider"
5654
- ]), a && n.classList.add("cursor-pointer", "hover:bg-gray-50", "dark:hover:bg-mint-elevated"), i === e.length - 1 && n.classList.remove("border-b");
5655
- let o = n.querySelectorAll("td");
5656
- o.forEach((e, n) => {
5657
- this._setClasses(e, [
5699
+ ]), o && !a && n.classList.add("cursor-pointer", "hover:bg-gray-50", "dark:hover:bg-mint-elevated"), !t && i === e.length - 1 && n.classList.remove("border-b");
5700
+ let s = n.querySelectorAll("td");
5701
+ s.forEach((o, c) => {
5702
+ let l = [
5658
5703
  "text-gray-900",
5659
5704
  "dark:text-gray-100",
5660
5705
  "px-3",
5661
5706
  "py-2"
5662
- ]), n === 0 && e.classList.add("pl-6"), n === o.length - 1 && e.classList.add("pr-6"), t ? this._applyMobileCell(e, r) : this._restoreCell(e);
5707
+ ];
5708
+ if (t && !a) {
5709
+ let t = n.hasAttribute("data-mint-rt-last-row"), a = r === -1 && i === e.length - 1;
5710
+ !t && !a && l.push("border-b", "border-gray-200", "dark:border-mint-divider");
5711
+ }
5712
+ this._setClasses(o, l), c === 0 && o.classList.add("pl-3"), c === s.length - 1 && o.classList.add("pr-3"), this._restoreCell(o);
5663
5713
  });
5664
5714
  });
5665
5715
  }
5666
- let s = e.querySelector("tfoot");
5667
- s && (this._setClasses(s, [
5716
+ let a = n.querySelector("tfoot");
5717
+ a && (this._setClasses(a, [
5668
5718
  "bg-[#F7F7F7]",
5669
- "dark:bg-mint-elevated",
5719
+ "dark:bg-mint-nav",
5670
5720
  "font-semibold"
5671
- ]), s.querySelectorAll("td").forEach((e) => {
5721
+ ]), a.querySelectorAll("td").forEach((e) => {
5672
5722
  this._setClasses(e, [
5673
5723
  "text-gray-900",
5674
5724
  "dark:text-gray-100",
@@ -5680,21 +5730,6 @@ var S = class extends HTMLElement {
5680
5730
  ]), this._restoreCell(e);
5681
5731
  })), this._observer && this._observeChanges();
5682
5732
  }
5683
- _applyMobileCell(e, t) {
5684
- if (e.closest("tfoot") || e.dataset.mtProcessed === "true") return;
5685
- let n = t[e.cellIndex] || "", r = {};
5686
- Array.from(e.attributes).forEach((e) => {
5687
- e.name.startsWith("data-") && e.name !== "data-original" && e.name !== "data-mt-processed" && (r[e.name] = e.value);
5688
- });
5689
- let i = e.getAttribute("data-original"), a = i === null ? e.innerHTML : i;
5690
- e.setAttribute("data-original", a), e.dataset.mtProcessed = "true", e.innerHTML = "";
5691
- let o = document.createElement("span");
5692
- o.className = "mt-label font-semibold text-gray-700 dark:text-gray-200 hidden", o.textContent = n;
5693
- let s = document.createElement("span");
5694
- s.className = "mt-value text-gray-900 dark:text-gray-100 text-right md:text-left w-full", s.innerHTML = a, e.appendChild(o), e.appendChild(s), Object.entries(r).forEach(([t, n]) => {
5695
- e.setAttribute(t, n);
5696
- });
5697
- }
5698
5733
  _restoreCell(e) {
5699
5734
  if (e.dataset.mtProcessed !== "true") return;
5700
5735
  let t = {};
@@ -5709,11 +5744,6 @@ var S = class extends HTMLElement {
5709
5744
  _setClasses(e, t) {
5710
5745
  e.className = "", t.filter(Boolean).forEach((t) => e.classList.add(...t.split(" ")));
5711
5746
  }
5712
- _ensureResponsiveStyles() {
5713
- if (document.getElementById("mint-table-responsive-style")) return;
5714
- let e = document.createElement("style");
5715
- e.id = "mint-table-responsive-style", e.textContent = "\n@media (max-width: 640px) {\n mint-table[collapse] {\n display: block;\n }\n mint-table[collapse] table {\n display: block;\n width: 100%;\n border-collapse: collapse;\n }\n mint-table[collapse] thead {\n display: none;\n }\n mint-table[collapse] tbody {\n display: block;\n width: 100%;\n }\n mint-table[collapse] tr {\n display: block;\n width: 100%;\n border-bottom: 1px solid #e5e7eb;\n padding: 0.5rem 0;\n }\n mint-table[collapse] tr:last-child {\n border-bottom: none;\n }\n mint-table[collapse] td,\n mint-table[collapse] th {\n display: flex;\n width: 100%;\n padding-top: 0.3rem !important;\n padding-bottom: 0.3rem !important;\n border: none;\n align-items: flex-start;\n justify-content: space-between;\n gap: 0.75rem;\n }\n mint-table[collapse] td .mt-label {\n display: inline-flex;\n flex: 1 1 50%;\n margin: 0;\n }\n mint-table[collapse] td .mt-value {\n display: inline-flex;\n flex: 1 1 50%;\n text-align: left;\n }\n\n /* Keep footer in normal table layout */\n mint-table[collapse] tfoot {\n display: table-footer-group;\n }\n mint-table[collapse] tfoot tr {\n display: table-row;\n border: none;\n padding: 0;\n }\n mint-table[collapse] tfoot td {\n display: table-cell;\n padding: 0.5rem 0.75rem;\n border: inherit;\n }\n}\n ", document.head.appendChild(e);
5716
- }
5717
5747
  };
5718
5748
  customElements.get("mint-table") || customElements.define("mint-table", S);
5719
5749
  //#endregion
@@ -6262,10 +6292,18 @@ customElements.get("mint-alert") || customElements.define("mint-alert", E);
6262
6292
  //#region src/components/resource-table/ResourceTable.ts
6263
6293
  var D = class extends HTMLElement {
6264
6294
  static get observedAttributes() {
6265
- return ["configuration"];
6295
+ return [
6296
+ "configuration",
6297
+ "virtual-scroll",
6298
+ "virtual-scroll-root",
6299
+ "virtual-row-height",
6300
+ "virtual-max-height",
6301
+ "fixed-header",
6302
+ "fixed-controls"
6303
+ ];
6266
6304
  }
6267
6305
  constructor() {
6268
- super(), this._configuration = null, this._rows = [], this._search = "", this._currentPage = 1, this._perPage = 15, this._totalRows = 0, this._lastPage = 0, this._offset = 0, this._rowsToShow = 15, this._loaded = !1, this._fetching = !1, this._loading = !1, this._loadingPage = null, this._fetchError = null, this._searching = !1, this._sorting = !1, this._sortingColumn = null, this._type = "provided", this._searchTimeoutId = null, this._sortTimeoutId = null, this._searchColumns = [], this._exportColumns = {}, this._columns = [], this._tableId = "", this._searchInput = null, this._tableContainer = null, this._paginationContainer = null, this._skeletonContainer = null, this._inMintCard = !1;
6306
+ super(), this._configuration = null, this._rows = [], this._search = "", this._currentPage = 1, this._perPage = 15, this._totalRows = 0, this._lastPage = 0, this._offset = 0, this._loaded = !1, this._fetching = !1, this._loading = !1, this._loadingPage = null, this._fetchError = null, this._searching = !1, this._sorting = !1, this._sortingColumn = null, this._type = "provided", this._searchTimeoutId = null, this._sortTimeoutId = null, this._searchColumns = [], this._exportColumns = {}, this._columns = [], this._tableId = "", this._searchInput = null, this._tableContainer = null, this._paginationContainer = null, this._skeletonContainer = null, this._inMintCard = !1, this._virtualBodyScrollEl = null, this._virtualScrollHandler = null, this._virtualWindowRaf = null, this._virtualLastRangeStart = -1, this._virtualLastRangeEnd = -1, this._virtualLastRangeCacheSig = "", this._virtualResizeObserver = null, this._virtualWindowResizeHandler = null, this._virtualRowCache = /* @__PURE__ */ new Map(), this._virtualRangeFetching = !1, this._mobileListMql = null, this._boundMobileListMqlListener = null, this._virtualFetchGeneration = 0, this._virtualAjaxPrefetchTimer = null, this._fixedChromeResizeObserver = null;
6269
6307
  }
6270
6308
  get inMintCard() {
6271
6309
  return this._inMintCard;
@@ -6274,19 +6312,19 @@ var D = class extends HTMLElement {
6274
6312
  return this._configuration;
6275
6313
  }
6276
6314
  set configuration(e) {
6277
- e && typeof e == "object" && !Array.isArray(e) ? (this._configuration = e, this._tableId = this._configuration.id || `mint-resource-table-${Date.now()}`, this._perPage = this._configuration.perPage || 15, this._rowsToShow = this._perPage, this._type = typeof this._configuration.data == "string" ? "ajax" : "provided", this._loaded = !1, this._currentPage = 1, this._offset = 0, this._type === "provided" && Array.isArray(this._configuration.data) && (this._rows = [...this._configuration.data], this._totalRows = this._configuration.data.length), this._initializeColumns(), this._loadColumnVisibility(), this.isConnected && this.render()) : e == null ? this._configuration = null : this._parseConfiguration();
6315
+ e && typeof e == "object" && !Array.isArray(e) ? (this._configuration = e, this._tableId = this._configuration.id || `mint-resource-table-${Date.now()}`, this._perPage = this._configuration.perPage || 15, this._type = typeof this._configuration.data == "string" ? "ajax" : "provided", this._loaded = !1, this._currentPage = 1, this._offset = 0, this._type === "provided" && Array.isArray(this._configuration.data) && (this._rows = [...this._configuration.data], this._totalRows = this._configuration.data.length), this._initializeColumns(), this.isConnected && this.render()) : e == null ? this._configuration = null : this._parseConfiguration();
6278
6316
  }
6279
6317
  connectedCallback() {
6280
- this.classList.add("box-border", "m-0", "p-0", "border-0", "align-baseline", "block", "w-full"), this._inMintCard = this.parentElement?.tagName?.toLowerCase() === "mint-card", this._configuration || this._parseConfiguration(), this._initializeColumns(), this._loadColumnVisibility(), this._loadPageFromUrl(), this._attachRowClickHandler(), this.render();
6318
+ this.classList.add("box-border", "m-0", "p-0", "border-0", "align-baseline", "block", "w-full"), this._inMintCard = this.parentElement?.tagName?.toLowerCase() === "mint-card", this._configuration || this._parseConfiguration(), this._initializeColumns(), this._loadPageFromUrl(), this._attachRowClickHandler(), this.render();
6281
6319
  }
6282
6320
  disconnectedCallback() {
6283
- this._searchTimeoutId && clearTimeout(this._searchTimeoutId), this._rowClickHandler &&= (this.removeEventListener("click", this._rowClickHandler, !0), null), this._scrollHandler &&= (window.removeEventListener("scroll", this._scrollHandler), null);
6321
+ this._searchTimeoutId && clearTimeout(this._searchTimeoutId), this._detachVirtualScroll(), this._detachFixedChromeResize(), this._detachMobileListMql(), this._rowClickHandler &&= (this.removeEventListener("click", this._rowClickHandler, !0), null), this._scrollHandler &&= (window.removeEventListener("scroll", this._scrollHandler), null);
6284
6322
  }
6285
6323
  attributeChangedCallback(e, t, n) {
6286
- e === "configuration" && t !== n && (!this._configuration || typeof n == "string") && (this._parseConfiguration(), this.render());
6324
+ e === "configuration" && t !== n ? (!this._configuration || typeof n == "string") && (this._parseConfiguration(), this.render()) : t !== n && (e === "virtual-scroll" || e === "virtual-scroll-root" || e === "virtual-row-height" || e === "virtual-max-height" || e === "fixed-header" || e === "fixed-controls") && this._configuration && this.isConnected && this.render();
6287
6325
  }
6288
6326
  refresh() {
6289
- this._configuration && (this._type === "ajax" ? this._configuration.loadMore ? (this._offset = 0, this._currentPage = 1, this._rowsToShow = this._perPage, this._rows = [], this._fetchData(void 0, !0, this._perPage, 0)) : this._fetchData(void 0, !0, this._perPage, this._offset) : this.render());
6327
+ this._configuration && (this._type === "ajax" ? this._fetchData(void 0, !0, this._perPage, this._offset) : this.render());
6290
6328
  }
6291
6329
  _parseConfiguration() {
6292
6330
  let e = this.getAttribute("configuration");
@@ -6295,39 +6333,11 @@ var D = class extends HTMLElement {
6295
6333
  return;
6296
6334
  }
6297
6335
  try {
6298
- this._configuration = JSON.parse(e), this._tableId = this._configuration.id || `mint-resource-table-${Date.now()}`, this._perPage = this._configuration.perPage || 15, this._rowsToShow = this._perPage, this._type = typeof this._configuration.data == "string" ? "ajax" : "provided", this._loaded = !1, this._currentPage = this._getPageFromUrl() || 1, this._offset = (this._currentPage - 1) * this._perPage, this._type === "provided" && Array.isArray(this._configuration.data) && (this._rows = [...this._configuration.data], this._totalRows = this._configuration.data.length), this._initializeColumns(), this._loadColumnVisibility();
6336
+ this._configuration = JSON.parse(e), this._tableId = this._configuration.id || `mint-resource-table-${Date.now()}`, this._perPage = this._configuration.perPage || 15, this._type = typeof this._configuration.data == "string" ? "ajax" : "provided", this._loaded = !1, this._currentPage = this._getPageFromUrl() || 1, this._offset = (this._currentPage - 1) * this._perPage, this._type === "provided" && Array.isArray(this._configuration.data) && (this._rows = [...this._configuration.data], this._totalRows = this._configuration.data.length), this._initializeColumns();
6299
6337
  } catch (e) {
6300
6338
  console.error("mint-resource-table: Invalid configuration JSON", e);
6301
6339
  }
6302
6340
  }
6303
- _getColumnVisibilityStorageKey() {
6304
- return `mrtc-${this._tableId}`;
6305
- }
6306
- _saveColumnVisibility() {
6307
- if (!this._configuration) return;
6308
- let e = {};
6309
- this._configuration.columns.forEach((t, n) => {
6310
- e[n] = t.hidden || !1;
6311
- });
6312
- try {
6313
- localStorage.setItem(this._getColumnVisibilityStorageKey(), JSON.stringify(e));
6314
- } catch (e) {
6315
- console.warn("Failed to save column visibility to localStorage:", e);
6316
- }
6317
- }
6318
- _loadColumnVisibility() {
6319
- if (this._configuration) try {
6320
- let e = localStorage.getItem(this._getColumnVisibilityStorageKey());
6321
- if (e) {
6322
- let t = JSON.parse(e);
6323
- this._configuration.columns.forEach((e, n) => {
6324
- t[n] !== void 0 && (e.hidden = t[n]);
6325
- });
6326
- }
6327
- } catch (e) {
6328
- console.warn("Failed to load column visibility from localStorage:", e);
6329
- }
6330
- }
6331
6341
  _initializeColumns() {
6332
6342
  this._configuration && (this._searchColumns = [], this._exportColumns = {}, this._columns = [], this._configuration.columns.forEach((e) => {
6333
6343
  e.searchable && e.data && this._searchColumns.push(e.data), e.export && e.data && (this._exportColumns[e.data] = e.label), e.data && this._columns.push(e.data);
@@ -6339,6 +6349,7 @@ var D = class extends HTMLElement {
6339
6349
  if (!i || this._fetching || this._loading) return;
6340
6350
  t && (this._fetching = !0, this._loaded ? this._updatePagination() : this.render()), this._loading = !0;
6341
6351
  let a = n || this._perPage, o = r === void 0 ? this._offset : r;
6352
+ this._virtualScrollActive() && this._type === "ajax" && o === 0 && (this._virtualFetchGeneration++, this._virtualRowCache.clear(), this._virtualInvalidate());
6342
6353
  try {
6343
6354
  let e = new URLSearchParams({
6344
6355
  perPage: a.toString(),
@@ -6352,22 +6363,28 @@ var D = class extends HTMLElement {
6352
6363
  this._configuration.headers && (t.headers = this._configuration.headers);
6353
6364
  let n = await fetch(`${i}?${e.toString()}`, t);
6354
6365
  if (!n.ok) throw Error(`HTTP error! status: ${n.status}`);
6355
- let r = await n.json(), s = r.content?.rows || [], c = r.content?.total || 0;
6356
- if (this._configuration.loadMore && o !== 0) this._rows = this._rows.concat(s);
6357
- else {
6358
- let e = s;
6359
- this._configuration.predefinedData ? (e = [...this._configuration.predefinedData, ...s], this._totalRows = c + this._configuration.predefinedData.length) : this._totalRows = c, this._rows = e;
6360
- }
6361
- let l = Math.floor(o / a) + 1;
6362
- this._configuration.loadMore || (r.content?.current_page !== void 0 && r.content.current_page === l ? this._currentPage = r.content.current_page : this._currentPage = l, this._offset = (this._currentPage - 1) * a), this._lastPage = r.content?.last_page || 1, this._fetching = !1, this._loaded = !0, this._loading = !1, this._fetchError = null, this._searching = !1;
6363
- let u = this._sorting;
6364
- if (u && this._updateSortIcons(), this._sorting = !1, this._sortingColumn = null, u && this._updateSortIcons(), this.dispatchEvent(new CustomEvent("loaded", { detail: { rows: this._rows } })), this._updateSearchIcon(), this.querySelector(`#${this._tableId}`)?.closest("table")?.querySelector("tbody")) {
6365
- if (u) {
6366
+ let r = await n.json(), s = r.content?.rows || [], c = r.content?.total || 0, l = s;
6367
+ this._configuration.predefinedData ? (l = [...this._configuration.predefinedData, ...s], this._totalRows = c + this._configuration.predefinedData.length) : this._totalRows = c, this._rows = l;
6368
+ let u = Math.floor(o / a) + 1;
6369
+ r.content?.current_page !== void 0 && r.content.current_page === u ? this._currentPage = r.content.current_page : this._currentPage = u, this._offset = (this._currentPage - 1) * a, this._lastPage = r.content?.last_page || 1, this._fetching = !1, this._loaded = !0, this._loading = !1, this._fetchError = null, this._searching = !1;
6370
+ let d = this._sorting;
6371
+ d && this._updateSortIcons(), this._sorting = !1, this._sortingColumn = null, d && this._updateSortIcons(), this.dispatchEvent(new CustomEvent("loaded", { detail: { rows: this._rows } })), this._updateSearchIcon();
6372
+ let f = `tbody[data-mint-rt-tbody="${this._tableId}"]`, p = !!this.querySelector(f);
6373
+ if (this._virtualScrollActive() && this._type === "ajax") p || this.render(), s.forEach((e, t) => {
6374
+ this._virtualRowCache.set(o + t, e);
6375
+ }), this._virtualInvalidate(), o === 0 ? queueMicrotask(() => this._scrollVirtualTableTopIntoView()) : this._scheduleVirtualWindowSync(), this._loadingPage, this._loadingPage = null, this._updatePagination(), setTimeout(() => {
6376
+ let e = this._paginationMountedRoot();
6377
+ e && e.querySelectorAll("mint-button[data-action=\"page\"]").forEach((e) => {
6378
+ "render" in e && typeof e.render == "function" && e.render();
6379
+ });
6380
+ }, 0);
6381
+ else if (this.querySelector(`#${this._tableId}`)?.closest("table")?.querySelector("tbody")) {
6382
+ if (d) {
6366
6383
  let e = this._loading, t = this._fetching;
6367
6384
  this._loading = !1, this._fetching = !1, this._updateTableBody(), this._loading = e, this._fetching = t;
6368
6385
  } else this._updateTableBody();
6369
6386
  this._loadingPage, this._loadingPage = null, this._updatePagination(), setTimeout(() => {
6370
- let e = this.querySelector("nav")?.closest(".flex.justify-end");
6387
+ let e = this._paginationMountedRoot();
6371
6388
  e && e.querySelectorAll("mint-button[data-action=\"page\"]").forEach((e) => {
6372
6389
  "render" in e && typeof e.render == "function" && e.render();
6373
6390
  });
@@ -6414,7 +6431,545 @@ var D = class extends HTMLElement {
6414
6431
  e.page = Math.ceil((t + 1) / this._perPage);
6415
6432
  }), this._currentPage > t && t > 0 && (this._currentPage = t);
6416
6433
  }
6417
- return this._configuration.loadMore ? e.slice(0, this._rowsToShow) : e.filter((e) => !this._perPage || e.page === this._currentPage);
6434
+ return e.filter((e) => !this._perPage || e.page === this._currentPage);
6435
+ }
6436
+ _getAllFilteredRowsSorted() {
6437
+ if (!this._configuration || this._type !== "provided") return [];
6438
+ let e = [...this._rows], t = this._configuration.sortBy || "id", n = this._configuration.sort || "asc";
6439
+ if (this._search) {
6440
+ let t = this._search.toLowerCase().trim().split(/\s+/);
6441
+ e = e.filter((e) => {
6442
+ let n = Object.values(e).map((e) => String(e).toLowerCase()).join(" ");
6443
+ return t.every((e) => n.includes(e));
6444
+ });
6445
+ }
6446
+ if (e.sort((e, r) => {
6447
+ let i = e[t], a = r[t];
6448
+ if (i == null && a == null) return 0;
6449
+ if (i == null) return 1;
6450
+ if (a == null) return -1;
6451
+ let o = typeof i == "number" ? i : typeof i == "string" && !isNaN(Number(i)) && i.trim() !== "" ? Number(i) : null, s = typeof a == "number" ? a : typeof a == "string" && !isNaN(Number(a)) && a.trim() !== "" ? Number(a) : null;
6452
+ if (o !== null && s !== null) {
6453
+ let e = o - s;
6454
+ return n === "asc" ? e : -e;
6455
+ }
6456
+ let c = i instanceof Date ? i : typeof i == "string" ? new Date(i) : null, l = a instanceof Date ? a : typeof a == "string" ? new Date(a) : null;
6457
+ if (c && l && !isNaN(c.getTime()) && !isNaN(l.getTime())) {
6458
+ let e = c.getTime() - l.getTime();
6459
+ return n === "asc" ? e : -e;
6460
+ }
6461
+ let u = String(i).localeCompare(String(a), void 0, {
6462
+ numeric: !0,
6463
+ sensitivity: "base"
6464
+ });
6465
+ return n === "asc" ? u : -u;
6466
+ }), this._perPage) {
6467
+ let t = Math.ceil(e.length / this._perPage);
6468
+ this._lastPage = t, e.forEach((e, t) => {
6469
+ e.page = Math.ceil((t + 1) / this._perPage);
6470
+ }), this._currentPage > t && t > 0 && (this._currentPage = t);
6471
+ }
6472
+ return e.filter((e) => !this._perPage || e.page === this._currentPage);
6473
+ }
6474
+ _virtualInvalidate() {
6475
+ this._virtualLastRangeStart = -1, this._virtualLastRangeEnd = -1, this._virtualLastRangeCacheSig = "";
6476
+ }
6477
+ _getRowDataForEventIndex(e) {
6478
+ if (this._configuration) {
6479
+ if (!this._virtualScrollActive()) return this._getRows()[e];
6480
+ if (this._type === "provided") return this._getAllFilteredRowsSorted()[e];
6481
+ if (this._type === "ajax") return this._virtualRowCache.get(e);
6482
+ }
6483
+ }
6484
+ getRowByIndex(e) {
6485
+ return this._getRowDataForEventIndex(e);
6486
+ }
6487
+ _virtualScrollActive() {
6488
+ return this._configuration ? (this.getAttribute("virtual-scroll") || "").toLowerCase().trim() === "true" : !1;
6489
+ }
6490
+ _virtualScrollRoot() {
6491
+ let e = (this.getAttribute("virtual-scroll-root") || "").toLowerCase().trim();
6492
+ return e === "table-body" || e === "body" || this._configuration?.virtualScrollRoot === "table-body" ? "table-body" : "document";
6493
+ }
6494
+ _virtualBodyScrollDisablesDocumentFixedChrome() {
6495
+ return this._virtualScrollActive() && this._virtualScrollRoot() === "table-body";
6496
+ }
6497
+ _fixedHeader() {
6498
+ if (this._virtualBodyScrollDisablesDocumentFixedChrome() || !this.hasAttribute("fixed-header")) return !1;
6499
+ let e = (this.getAttribute("fixed-header") || "").toLowerCase().trim();
6500
+ return e !== "false" && e !== "0";
6501
+ }
6502
+ _fixedControls() {
6503
+ if (this._virtualBodyScrollDisablesDocumentFixedChrome() || !this.hasAttribute("fixed-controls")) return !1;
6504
+ let e = (this.getAttribute("fixed-controls") || "").toLowerCase().trim();
6505
+ return e !== "false" && e !== "0";
6506
+ }
6507
+ _virtualRowHeightPx() {
6508
+ let e = parseInt(this.getAttribute("virtual-row-height") || "", 10);
6509
+ if (!isNaN(e) && e > 0) return e;
6510
+ let t = this._configuration?.virtualRowHeight;
6511
+ return typeof t == "number" && t > 0 ? t : 48;
6512
+ }
6513
+ _virtualRowHeightPxForSync(e) {
6514
+ let t = this._virtualRowHeightPx();
6515
+ if (!this._configuration) return t;
6516
+ if (e) {
6517
+ let e = this._mobileThumbnailColumn();
6518
+ if (e) {
6519
+ let n = this._thumbnailMobilePx(e);
6520
+ return Math.max(t, n + 36);
6521
+ }
6522
+ return Math.max(t, 80);
6523
+ }
6524
+ let n = this._mobileThumbnailColumn();
6525
+ if (n) {
6526
+ let e = this._thumbnailDesktopPx(n);
6527
+ return Math.max(t, e + 28);
6528
+ }
6529
+ return t;
6530
+ }
6531
+ _virtualMaxHeightCss() {
6532
+ let e = this.getAttribute("virtual-max-height");
6533
+ if (e && e.trim()) return e.trim();
6534
+ let t = this._configuration?.virtualMaxHeight;
6535
+ return t && String(t).trim() ? String(t).trim() : "min(70dvh, 28rem)";
6536
+ }
6537
+ _virtualColspan() {
6538
+ return this._configuration ? Math.max(1, this._configuration.columns.filter((e) => !e.hidden).length) : 1;
6539
+ }
6540
+ _ensureMobileListMql() {
6541
+ typeof window > "u" || !window.matchMedia || this._mobileListMql || (this._mobileListMql = window.matchMedia("(max-width: 767px)"), this._boundMobileListMqlListener = () => {
6542
+ this._configuration && this.isConnected && this.render();
6543
+ }, this._mobileListMql.addEventListener("change", this._boundMobileListMqlListener));
6544
+ }
6545
+ _detachMobileListMql() {
6546
+ this._mobileListMql && this._boundMobileListMqlListener && this._mobileListMql.removeEventListener("change", this._boundMobileListMqlListener), this._mobileListMql = null, this._boundMobileListMqlListener = null;
6547
+ }
6548
+ _useMobileListLayout() {
6549
+ return !!this._mobileListMql?.matches;
6550
+ }
6551
+ _paginationHostPlaceholderHtml() {
6552
+ if (!this._configuration?.perPage || this._virtualScrollActive()) return "";
6553
+ let e = this._lastPage || Math.ceil(this._rows.length / this._perPage);
6554
+ if ((this._lastPage > 0 ? this._lastPage : e) <= 1) return "";
6555
+ let t = [
6556
+ "mint-rt-pagination-host",
6557
+ "w-full min-w-0 overflow-x-auto overflow-y-hidden overscroll-x-contain",
6558
+ "flex justify-center [-webkit-overflow-scrolling:touch] md:justify-end",
6559
+ this._inMintCard ? "border-t border-gray-200 px-3.5 pb-3.5 pt-3 dark:border-mint-divider md:border-t-0 md:pt-0" : "border-t border-gray-200 px-2 py-3 dark:border-mint-divider md:border-t-0 md:py-0 md:mt-4"
6560
+ ].join(" ");
6561
+ return `<div id="mint-rt-pagination-host-${this._tableId}" data-mint-rt-pagination-wrap="" class="${t}"></div>`;
6562
+ }
6563
+ _getPaginationHostEl() {
6564
+ return this.querySelector(`#mint-rt-pagination-host-${this._tableId}`);
6565
+ }
6566
+ _paginationMountedRoot() {
6567
+ return this._getPaginationHostEl() || this.querySelector("nav[data-mint-rt-pagination-nav]")?.parentElement || this.querySelector("nav")?.closest(".flex.justify-end");
6568
+ }
6569
+ _paginationPageButtonLi(e) {
6570
+ let t = this._currentPage === e, n = this._loadingPage === e;
6571
+ return `<li class="shrink-0"><mint-button variant="solid" size="sm"${t ? " active=\"true\"" : ""}${this._loading || this._fetching ? " disabled=\"true\"" : ""}${n ? " loading=\"true\"" : ""} data-action="page" data-page="${e}">${n ? "" : `${e}`}</mint-button></li>`;
6572
+ }
6573
+ _paginationHtmlCompactMiddle(e) {
6574
+ let t = "", n = this._currentPage;
6575
+ if (e <= 5) {
6576
+ for (let n = 1; n <= e; n++) t += this._paginationPageButtonLi(n);
6577
+ return t;
6578
+ }
6579
+ let r = [...new Set([
6580
+ 1,
6581
+ e,
6582
+ n - 1,
6583
+ n,
6584
+ n + 1
6585
+ ].map((t) => Math.min(e, Math.max(1, t))))].sort((e, t) => e - t), i = 0;
6586
+ for (let e of r) i > 0 && e - i > 1 && (t += "<li class=\"shrink-0\"><span class=\"px-1 text-gray-500 dark:text-gray-400\" aria-hidden=\"true\">…</span></li>"), t += this._paginationPageButtonLi(e), i = e;
6587
+ return t;
6588
+ }
6589
+ _paginationHtmlDesktopMiddle(e) {
6590
+ let t = "", n = e >= 10, r = Math.max(1, this._currentPage - 1), i = Math.min(e, this._currentPage + 1);
6591
+ if (n) {
6592
+ for (let e = 1; e <= 3; e++) t += this._paginationPageButtonLi(e);
6593
+ let n = i <= 3, a = r >= e - 2;
6594
+ if (!n && !a) {
6595
+ r > 4 && (t += "<li class=\"shrink-0\"><span class=\"px-2\">...</span></li>");
6596
+ for (let e = r; e <= i; e++) e <= 3 || (t += this._paginationPageButtonLi(e));
6597
+ i < e - 3 && (t += "<li class=\"shrink-0\"><span class=\"px-2\">...</span></li>");
6598
+ } else (n && !a || !n && a && e - 2 > 4) && (t += "<li class=\"shrink-0\"><span class=\"px-2\">...</span></li>");
6599
+ for (let o = e - 2; o <= e; o++) o <= 3 || !n && !a && o >= r && o <= i || (t += this._paginationPageButtonLi(o));
6600
+ } else for (let n = 1; n <= e; n++) t += this._paginationPageButtonLi(n);
6601
+ return t;
6602
+ }
6603
+ _buildPaginationNavMarkup(e) {
6604
+ let t = this._currentPage === 1 || this._loading || this._fetching, n = "<nav data-mint-rt-pagination-nav=\"\" class=\"w-max max-w-none shrink-0\" aria-label=\"Pagination\">";
6605
+ n += "<ul class=\"flex flex-nowrap items-center gap-1\">", n += `<li class="shrink-0"><mint-button variant="solid" size="sm" icon="caret-left" ${t ? "disabled=\"true\"" : ""} data-action="page-prev"></mint-button></li>`, n += this._useMobileListLayout() ? this._paginationHtmlCompactMiddle(e) : this._paginationHtmlDesktopMiddle(e);
6606
+ let r = this._currentPage >= e || this._loading || this._fetching;
6607
+ return n += `<li class="shrink-0"><mint-button variant="solid" size="sm" icon="caret-right" ${r ? "disabled=\"true\"" : ""} data-action="page-next"></mint-button></li>`, n += "</ul></nav>", n;
6608
+ }
6609
+ _hasSortableColumns() {
6610
+ return !!this._configuration?.columns.some((e) => !e.hidden && e.sortable && e.data);
6611
+ }
6612
+ _getMobileSortTriggerIconName() {
6613
+ return "sort-arrows";
6614
+ }
6615
+ _mobileSortPopoverAffordanceInnerHtml(e) {
6616
+ return e === "spinner" ? "<span class=\"inline-block h-4 w-4 shrink-0 animate-spin rounded-full border-2 border-gray-300 border-t-gray-700 dark:border-gray-600 dark:border-t-gray-200\" aria-hidden=\"true\"></span>" : e === "caret-up" || e === "caret-down" ? `<mint-icon name="${e}" class="h-4 w-4 shrink-0 text-gray-500 dark:text-gray-400"></mint-icon>` : "";
6617
+ }
6618
+ _buildMobileSortPopoverInnerHtml() {
6619
+ if (!this._configuration) return "";
6620
+ let e = "<div class=\"flex w-full min-w-[11rem] flex-col gap-0.5 p-1\">";
6621
+ return this._configuration.columns.forEach((t, n) => {
6622
+ if (t.hidden || !t.sortable || !t.data) return;
6623
+ let r = t.raw ? t.label : this._escapeHtml(t.label), i = this._getSortClass(t), a = this._mobileSortPopoverAffordanceInnerHtml(i), o = ` type="button" variant="ghost" tone="neutral" size="sm" full-width="true" align="left" data-action="mobile-sort" data-column-key="${n}"`;
6624
+ e += `<mint-button${o}>`, e += "<span class=\"flex w-full min-w-0 flex-1 items-center justify-between gap-2\">", e += `<span class="min-w-0 flex-1 truncate text-left">${r}</span>`, e += `<span class="inline-flex shrink-0 items-center justify-end" data-mint-rt-mobile-sort-affordance="">${a}</span>`, e += "</span></mint-button>";
6625
+ }), e += "</div>", e;
6626
+ }
6627
+ _syncMobileSortPopoverIcons() {
6628
+ if (!this._configuration) return;
6629
+ let e = this.querySelector(`#mint-rt-mobile-sort-popover-${this._tableId}`);
6630
+ e && this._configuration.columns.forEach((t, n) => {
6631
+ if (t.hidden || !t.sortable || !t.data) return;
6632
+ let r = e.querySelector(`[data-action="mobile-sort"][data-column-key="${n}"]`);
6633
+ if (!r || r.tagName !== "MINT-BUTTON") return;
6634
+ let i = r.querySelector("[data-mint-rt-mobile-sort-affordance]");
6635
+ if (!i) return;
6636
+ let a = this._getSortClass(t);
6637
+ i.innerHTML = this._mobileSortPopoverAffordanceInnerHtml(a), i.querySelectorAll("mint-icon").forEach((e) => {
6638
+ let t = e;
6639
+ typeof t.render == "function" && t.render();
6640
+ });
6641
+ });
6642
+ }
6643
+ _closeMobileSortPopover() {
6644
+ let e = this.querySelector(`#mint-rt-mobile-sort-popover-${this._tableId}`);
6645
+ e && typeof e.close == "function" ? e.close() : e && e.removeAttribute("open");
6646
+ }
6647
+ _buildMobileSortToolbarHtml() {
6648
+ if (!this._hasSortableColumns()) return "";
6649
+ let e = `mint-rt-mobile-sort-btn-${this._tableId}`, t = `mint-rt-mobile-sort-popover-${this._tableId}`, n = this._sorting ? " loading=\"true\"" : "", r = ` icon="${this._escapeHtml(this._getMobileSortTriggerIconName())}"`, i = "<div class=\"flex shrink-0 items-center md:hidden\">";
6650
+ return i += `<mint-button id="${e}" data-mint-rt-toolbar="mobile-sort" variant="solid" tone="neutral" size="sm"${n}${r}></mint-button>`, i += `<mint-popover id="${t}" trigger-id="${e}" direction="down" padding="0">`, i += this._buildMobileSortPopoverInnerHtml(), i += "</mint-popover></div>", i;
6651
+ }
6652
+ _stripHtml(e) {
6653
+ if (!e) return "";
6654
+ let t = document.createElement("div");
6655
+ return t.innerHTML = e, (t.textContent || t.innerText || "").replace(/\s+/g, " ").trim();
6656
+ }
6657
+ _visibleDataColumns() {
6658
+ return this._configuration ? this._configuration.columns.filter((e) => !e.hidden) : [];
6659
+ }
6660
+ _mobileThumbnailColumn() {
6661
+ return this._visibleDataColumns().find((e) => e.thumbnail) || null;
6662
+ }
6663
+ _thumbnailDesktopPx(e) {
6664
+ let t = typeof e.thumbnailDesktopPx == "number" && e.thumbnailDesktopPx > 0 ? e.thumbnailDesktopPx : void 0, n = this._configuration, r = n && typeof n.thumbnailDesktopPx == "number" && n.thumbnailDesktopPx > 0 ? n.thumbnailDesktopPx : void 0;
6665
+ return Math.round(t ?? r ?? 40);
6666
+ }
6667
+ _thumbnailMobilePx(e) {
6668
+ let t = typeof e.thumbnailMobilePx == "number" && e.thumbnailMobilePx > 0 ? e.thumbnailMobilePx : void 0, n = this._configuration, r = n && typeof n.thumbnailMobilePx == "number" && n.thumbnailMobilePx > 0 ? n.thumbnailMobilePx : void 0;
6669
+ return Math.round(t ?? r ?? 56);
6670
+ }
6671
+ _wrapThumbnailDesktopBox(e, t) {
6672
+ let n = this._thumbnailDesktopPx(t);
6673
+ return `<div class="flex shrink-0 items-stretch overflow-hidden rounded-md border border-gray-200 bg-gray-100 p-0 dark:border-mint-divider dark:bg-mint-hover [&>*]:m-0 [&>*]:min-h-0 [&>*]:min-w-0 [&>*]:w-full [&>*]:max-w-full [&>*]:p-0 [&>span]:flex [&>span]:h-full [&>span]:w-full [&>span]:min-h-0 [&>span]:min-w-0 [&>span]:items-stretch [&>span]:justify-stretch [&_img]:!m-0 [&_img]:!box-border [&_img]:!block [&_img]:!h-full [&_img]:!w-full [&_img]:!min-h-0 [&_img]:!min-w-0 [&_img]:!max-h-full [&_img]:!max-w-full [&_img]:!border-0 [&_img]:!p-0 [&_img]:!rounded-none [&_img]:!object-cover [&_img]:!object-center" style="${`width:${n}px;height:${n}px;min-width:${n}px;min-height:${n}px`}">${e}</div>`;
6674
+ }
6675
+ _mobilePrimaryColumn() {
6676
+ let e = this._visibleDataColumns();
6677
+ return e.find((e) => e.primary) || e.find((e) => (e.data || typeof e.format == "function") && !e.thumbnail && !e.actions) || e[0] || null;
6678
+ }
6679
+ _mobileActionsDropdownColumn() {
6680
+ return this._visibleDataColumns().find((e) => e.actions && e.actionStyle !== "buttons") || null;
6681
+ }
6682
+ _columnPlainSummaryText(e, t) {
6683
+ if (!(!e.show || e.show(this, t)) || e.actions || e.action) return "";
6684
+ try {
6685
+ if (e.raw) {
6686
+ if (typeof e.format == "function") return this._stripHtml(e.format(this, t));
6687
+ if (e.data) return String(t[e.data] ?? "");
6688
+ } else {
6689
+ if (typeof e.format == "function") return this._stripHtml(e.format(this, t));
6690
+ if (e.data) return String(t[e.data] ?? "");
6691
+ }
6692
+ } catch {
6693
+ return "";
6694
+ }
6695
+ return "";
6696
+ }
6697
+ _buildTableCellInnerHtml(e, t, n, r = "table") {
6698
+ if (!this._configuration) return "";
6699
+ let i = n, a = "";
6700
+ if (!(!e.show || e.show(this, t))) return "";
6701
+ if (e.raw) if (e.action) {
6702
+ if (!e.action.show || e.action.show(this, t)) {
6703
+ let n = typeof e.action.label == "function" ? e.action.label(this, t) : e.action.label;
6704
+ a += `<mint-button variant="solid" data-action="column-action" data-row-index="${i}" data-column-key="${this._configuration.columns.indexOf(e)}">${this._escapeHtml(String(n))}</mint-button>`;
6705
+ }
6706
+ } else if (e.actions) if (e.actionStyle !== "buttons") {
6707
+ let n = `actions-popover-${this._tableId}-${i}`, r = `actions-button-${this._tableId}-${i}`;
6708
+ a += `<mint-button id="${r}" variant="link" icon="ellipsis">`, a += "</mint-button>", a += `<mint-popover id="${n}" trigger-id="${r}" direction="down">`, e.actions.forEach((n, r) => {
6709
+ if (!n.show || n.show(this, t)) {
6710
+ let o = typeof n.label == "function" ? n.label(this, t) : n.label;
6711
+ a += `<div class="p-2 cursor-pointer hover:bg-gray-100 dark:hover:bg-mint-hover" data-action="row-action" data-row-index="${i}" data-action-index="${r}" data-column-key="${this._configuration.columns.indexOf(e)}">${this._escapeHtml(String(o))}</div>`;
6712
+ }
6713
+ }), a += "</mint-popover>";
6714
+ } else e.actions.forEach((n, r) => {
6715
+ if (!n.show || n.show(this, t)) {
6716
+ let o = n.label ? typeof n.label == "function" ? n.label(this, t) : n.label : "", s = n.icon ? ` icon="${this._escapeHtml(n.icon)}"` : "", c = n.tone ? ` tone="${this._escapeHtml(n.tone)}"` : "";
6717
+ a += `<mint-button variant="link" class="${n.classes || ""}" data-action="row-action" data-row-index="${i}" data-action-index="${r}" data-column-key="${this._configuration.columns.indexOf(e)}"${s}${c}>`, o && (a += this._escapeHtml(String(o))), a += "</mint-button>";
6718
+ }
6719
+ });
6720
+ else typeof e.format == "function" ? a += e.format(this, t) : e.data && (a += this._escapeHtml(String(t[e.data] || "")));
6721
+ else if (e.action) (!e.action.show || e.action.show(this, t)) && (a += `<mint-button variant="solid" data-action="column-action" data-row-index="${i}" data-column-key="${this._configuration.columns.indexOf(e)}">${e.action.label}</mint-button>`);
6722
+ else if (e.actions) if (e.actionStyle !== "buttons") {
6723
+ let n = `actions-popover-${this._tableId}-${i}`, r = `actions-button-${this._tableId}-${i}`;
6724
+ a += `<mint-button id="${r}" variant="link" icon="ellipsis">`, a += "</mint-button>", a += `<mint-popover id="${n}" trigger-id="${r}" direction="down">`, e.actions.forEach((n, r) => {
6725
+ if (!n.show || n.show(this, t)) {
6726
+ let o = typeof n.label == "function" ? n.label(this, t) : n.label;
6727
+ a += `<div class="p-2 cursor-pointer hover:bg-gray-100 dark:hover:bg-mint-hover" data-action="row-action" data-row-index="${i}" data-action-index="${r}" data-column-key="${this._configuration.columns.indexOf(e)}">${this._escapeHtml(String(o))}</div>`;
6728
+ }
6729
+ }), a += "</mint-popover>";
6730
+ } else e.actions.forEach((n, r) => {
6731
+ if (!n.show || n.show(this, t)) {
6732
+ let o = n.label ? typeof n.label == "function" ? n.label(this, t) : n.label : "", s = n.icon ? ` icon="${this._escapeHtml(n.icon)}"` : "", c = n.tone ? ` tone="${this._escapeHtml(n.tone)}"` : "";
6733
+ a += `<mint-button variant="link" class="${n.classes || ""}" data-action="row-action" data-row-index="${i}" data-action-index="${r}" data-column-key="${this._configuration.columns.indexOf(e)}"${s}${c}>`, o && (a += this._escapeHtml(String(o))), a += "</mint-button>";
6734
+ }
6735
+ });
6736
+ else typeof e.format == "function" ? a += this._escapeHtml(e.format(this, t)) : e.data && (a += this._escapeHtml(String(t[e.data] || "")));
6737
+ return r === "table" && e.thumbnail && a && !e.actions && !e.action ? this._wrapThumbnailDesktopBox(a, e) : a;
6738
+ }
6739
+ _buildMobileListItemHtml(e, t, n, r = !1) {
6740
+ if (!this._configuration) return "";
6741
+ let i = t, a = typeof this._configuration.onRowClick == "function", o = this._mobileThumbnailColumn(), s = this._mobilePrimaryColumn(), c = this._mobileActionsDropdownColumn(), l = o ? this._buildTableCellInnerHtml(o, e, i, "mobile") : "", u = s ? this._buildTableCellInnerHtml(s, e, i, "mobile") : "", d = c ? this._buildTableCellInnerHtml(c, e, i, "mobile") : "", f = [];
6742
+ for (let t of this._configuration.columns) {
6743
+ if (t.hidden || o && t === o || s && t === s || c && t === c) continue;
6744
+ let n = this._columnPlainSummaryText(t, e);
6745
+ n && f.push(this._escapeHtml(n));
6746
+ }
6747
+ let p = f.join("<span class=\"text-gray-300 dark:text-gray-600\" aria-hidden=\"true\"> · </span>"), m = [
6748
+ "list-none",
6749
+ ...r ? [] : [
6750
+ "border-b",
6751
+ "border-gray-200",
6752
+ "dark:border-mint-divider"
6753
+ ],
6754
+ "bg-white",
6755
+ "dark:bg-mint-canvas",
6756
+ a ? "cursor-pointer hover:bg-gray-50 dark:hover:bg-mint-elevated" : ""
6757
+ ].filter(Boolean).join(" "), h = `<div class="flex items-center gap-3 py-3 pr-4${o ? " pl-0" : " pl-4"}">`;
6758
+ if (o) {
6759
+ let e = this._thumbnailMobilePx(o), t = `width:${e}px;height:${e}px;min-width:${e}px;min-height:${e}px`;
6760
+ h += `<div class="flex shrink-0 items-stretch overflow-hidden rounded-md border border-gray-200 bg-gray-100 p-0 dark:border-mint-divider dark:bg-mint-hover [&>*]:m-0 [&>*]:min-h-0 [&>*]:min-w-0 [&>*]:w-full [&>*]:max-w-full [&>*]:p-0 [&>span]:flex [&>span]:h-full [&>span]:w-full [&>span]:min-h-0 [&>span]:min-w-0 [&>span]:items-stretch [&>span]:justify-stretch [&_img]:!m-0 [&_img]:!box-border [&_img]:!block [&_img]:!h-full [&_img]:!w-full [&_img]:!min-h-0 [&_img]:!min-w-0 [&_img]:!max-h-full [&_img]:!max-w-full [&_img]:!border-0 [&_img]:!p-0 [&_img]:!rounded-none [&_img]:!object-cover [&_img]:!object-center" style="${t}">${l}</div>`;
6761
+ }
6762
+ h += "<div class=\"flex min-w-0 flex-1 flex-col justify-center gap-1\">", h += "<div class=\"flex items-start justify-between gap-2\">", h += `<div class="min-w-0 text-sm font-semibold leading-snug text-gray-900 dark:text-white">${u}</div>`, d && (h += `<div class="shrink-0 -mr-1">${d}</div>`), h += "</div>", p && (h += `<div class="text-xs font-normal leading-snug text-gray-500 dark:text-gray-400">${p}</div>`), h += "</div></div>";
6763
+ let g = typeof n == "number" && n > 0 ? ` style="box-sizing:border-box;min-height:${n}px;max-height:${n}px;height:${n}px;overflow:hidden"` : "";
6764
+ return `<li data-row-index="${i}" ${a ? "data-row-clickable=\"true\" " : ""}class="${m}"${g}>${h}</li>`;
6765
+ }
6766
+ _buildMobileListPlaceholderLi(e, t, n = !1) {
6767
+ let r = this._mobileThumbnailColumn(), i = r ? this._thumbnailMobilePx(r) : 56, a = `width:${i}px;height:${i}px;min-width:${i}px;min-height:${i}px`;
6768
+ return `<li data-row-index="${e}" data-mint-rt-placeholder="true" class="list-none${n ? "" : " border-b border-gray-200 dark:border-mint-divider"} bg-white dark:bg-mint-canvas" style="box-sizing:border-box;min-height:${t}px;max-height:${t}px;height:${t}px;overflow:hidden"><div class="flex h-full min-h-0 items-center gap-3 py-3 pl-0 pr-4"><div class="shrink-0 overflow-hidden rounded-md bg-gray-200 dark:bg-white/15" style="${a}"></div><div class="flex min-h-0 min-w-0 flex-1 flex-col justify-center gap-1 py-0.5"><div class="h-4 w-40 rounded bg-gray-200 dark:bg-white/15"></div><div class="h-3 w-full max-w-xs rounded bg-gray-200 dark:bg-white/15"></div></div></div></li>`;
6769
+ }
6770
+ _renderColgroupHtml() {
6771
+ if (!this._configuration) return "";
6772
+ let e = this._configuration.columns.filter((e) => !e.hidden), t = [], n = 0;
6773
+ for (let r of e) {
6774
+ let e = r.width == null ? "" : String(r.width).trim();
6775
+ e ? /^\d+(\.\d+)?$/.test(e) ? (n += parseFloat(e), t.push("px")) : t.push("lit") : t.push("flex");
6776
+ }
6777
+ let r = t.filter((e) => e === "flex").length, i = t.includes("lit"), a = "";
6778
+ r > 0 && !i && (a = n > 0 ? `width:calc((100% - ${n}px) / ${r});min-width:0` : `width:${100 / r}%;min-width:0`);
6779
+ let o = "<colgroup>";
6780
+ return e.forEach((e, n) => {
6781
+ let r = e.width == null ? "" : String(e.width).trim(), i = t[n], s = "";
6782
+ i === "px" ? s = ` style="width:${r}px;min-width:0"` : i === "lit" ? s = ` style="width:${this._escapeHtml(r)};min-width:0"` : a && (s = ` style="${a}"`), o += `<col${s} />`;
6783
+ }), o += "</colgroup>", o;
6784
+ }
6785
+ _buildDataRowHtml(e, t, n, r = !1) {
6786
+ if (!this._configuration) return "";
6787
+ let i = t, a = n, o = `box-sizing:border-box;min-height:${a}px;max-height:${a}px;height:${a}px;overflow:hidden`, s = "", c = typeof this._configuration.onRowClick == "function", l = c ? "cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800" : "", u = c ? " data-row-clickable=\"true\"" : "", d = l ? ` class="${l}"` : "";
6788
+ return s += `<tr data-row-index="${i}"${r ? " data-mint-rt-last-row=\"\"" : ""}${u}${d} style="${o}">`, this._configuration.columns.forEach((t) => {
6789
+ if (t.hidden) return;
6790
+ let n = !t.show || t.show(this, e), r = `${this._getStyle(t)}box-sizing:border-box;max-height:${a}px;overflow:hidden;vertical-align:middle;`;
6791
+ s += `<td style="${r}" class="${this._getClasses(t, !0)}">`, s += n ? this._buildTableCellInnerHtml(t, e, i) : "", s += "</td>";
6792
+ }), s += "</tr>", s;
6793
+ }
6794
+ _getVirtualRowCount() {
6795
+ return !this._virtualScrollActive() || !this._configuration ? 0 : this._type === "provided" ? this._getAllFilteredRowsSorted().length : this._type === "ajax" ? this._totalRows : 0;
6796
+ }
6797
+ _getVirtualRowAt(e) {
6798
+ return this._type === "provided" ? this._getAllFilteredRowsSorted()[e] ?? null : this._type === "ajax" && this._virtualRowCache.has(e) ? this._virtualRowCache.get(e) : null;
6799
+ }
6800
+ _buildVirtualPlaceholderRowHtml(e, t, n = !1) {
6801
+ if (!this._configuration) return "";
6802
+ let r = t, i = `box-sizing:border-box;min-height:${r}px;max-height:${r}px;height:${r}px;overflow:hidden`, a = `<tr data-row-index="${e}" data-mint-rt-placeholder="true"${n ? " data-mint-rt-last-row=\"\"" : ""} class="bg-white dark:bg-mint-canvas" style="${i}">`;
6803
+ return this._configuration.columns.forEach((e) => {
6804
+ if (e.hidden) return;
6805
+ let t = `${this._getStyle(e)}box-sizing:border-box;max-height:${r}px;height:${r}px;overflow:hidden;vertical-align:middle;line-height:0;`;
6806
+ if (a += `<td style="${t}" class="${this._getClasses(e, !0)}">`, e.thumbnail) {
6807
+ let t = this._thumbnailDesktopPx(e);
6808
+ a += `<div class="rounded-md bg-gray-200 dark:bg-white/15" style="width:${t}px;height:${t}px;max-width:100%;box-sizing:border-box"></div>`;
6809
+ } else a += "<div class=\"h-4 max-w-[95%] rounded bg-gray-200 dark:bg-white/15\"></div>";
6810
+ a += "</td>";
6811
+ }), a += "</tr>", a;
6812
+ }
6813
+ _virtualScrollStickyOverlapPx(e) {
6814
+ let t = 0;
6815
+ if (this._fixedControls()) {
6816
+ let e = this.querySelector(`#mint-rt-fixed-controls-${this._tableId}`);
6817
+ if (e) t += Math.ceil(e.getBoundingClientRect().height);
6818
+ else {
6819
+ let e = getComputedStyle(this).getPropertyValue("--mint-rt-fixed-controls-h").trim(), n = parseFloat(e);
6820
+ isNaN(n) || (t += Math.ceil(n));
6821
+ }
6822
+ }
6823
+ if (this._fixedHeader() && e) {
6824
+ let n = e.querySelector("thead");
6825
+ n && (t += Math.ceil(n.getBoundingClientRect().height));
6826
+ }
6827
+ return t;
6828
+ }
6829
+ _scrollVirtualTableTopIntoView() {
6830
+ if (!this._virtualScrollActive() || !this.isConnected) return;
6831
+ if (this._virtualScrollRoot() === "table-body") {
6832
+ let e = this._virtualBodyScrollEl?.isConnected ? this._virtualBodyScrollEl : this.querySelector(`#mint-rt-vscroll-${this._tableId}`), t = this._useMobileListLayout() && e ? e.querySelector(`ul[data-mint-rt-mobile-list="${this._tableId}"]`) : null, n = e?.querySelector("mint-table.table-section") || e?.querySelector("mint-table"), r = n?.querySelector(`#${this._tableId}`)?.closest("table") || n?.querySelector("table"), i = this._virtualScrollStickyOverlapPx(r), a = t || n;
6833
+ if (a && i > 0) {
6834
+ let e = a.getBoundingClientRect(), t = window.scrollY + e.top - i;
6835
+ window.scrollTo({
6836
+ top: Math.max(0, t),
6837
+ behavior: "auto"
6838
+ });
6839
+ }
6840
+ e && (e.scrollTop = 0, this._virtualBodyScrollEl = e, this._virtualInvalidate(), this._scheduleVirtualWindowSync());
6841
+ return;
6842
+ }
6843
+ let e = this.querySelector(`ul[data-mint-rt-mobile-list="${this._tableId}"]`), t = this.querySelector("mint-table.table-section"), n = this.querySelector(`#${this._tableId}`)?.closest("table") || t?.querySelector("table"), r = this._useMobileListLayout() && e ? e : t || n;
6844
+ if (!r) return;
6845
+ let i = this._virtualScrollStickyOverlapPx(n), a = r.getBoundingClientRect(), o = window.scrollY + a.top - i;
6846
+ window.scrollTo({
6847
+ top: Math.max(0, o),
6848
+ behavior: "auto"
6849
+ }), this._virtualInvalidate(), this._scheduleVirtualWindowSync();
6850
+ }
6851
+ _scheduleVirtualWindowSync() {
6852
+ this._virtualScrollActive() && this._virtualWindowRaf === null && (this._virtualWindowRaf = window.requestAnimationFrame(() => {
6853
+ this._virtualWindowRaf = null, this._syncVirtualWindow();
6854
+ }));
6855
+ }
6856
+ _syncVirtualWindow() {
6857
+ if (!this._virtualScrollActive() || !this._configuration) return;
6858
+ let e = this._useMobileListLayout(), t = this.querySelector(`tbody[data-mint-rt-tbody="${this._tableId}"]`), n = this.querySelector(`ul[data-mint-rt-mobile-list="${this._tableId}"]`), r = e ? n : t;
6859
+ if (!r) return;
6860
+ let i = this._getVirtualRowCount(), a = this._virtualRowHeightPxForSync(e), o = this._virtualColspan();
6861
+ if (i === 0) {
6862
+ e ? this._fetchError ? r.innerHTML = `<li class="list-none px-4 py-8 text-center text-sm text-red-500 dark:text-red-400">Failed to load data: ${this._escapeHtml(this._fetchError)}</li>` : r.innerHTML = "<li class=\"list-none px-4 py-8 text-center text-sm\">No records found.</li>" : this._fetchError ? r.innerHTML = `<tr><td colspan="${o}" class="text-center py-8 text-red-500 dark:text-red-400">Failed to load data: ${this._escapeHtml(this._fetchError)}</td></tr>` : r.innerHTML = `<tr><td colspan="${o}" class="text-center py-8">No records found.</td></tr>`, this._virtualLastRangeStart = -1, this._virtualLastRangeEnd = -1, this._virtualLastRangeCacheSig = "";
6863
+ return;
6864
+ }
6865
+ let s = 0, c = window.innerHeight;
6866
+ if (this._virtualScrollRoot() === "table-body") {
6867
+ let e = this._virtualBodyScrollEl;
6868
+ if ((!e || !e.isConnected) && (e = this.querySelector(`#mint-rt-vscroll-${this._tableId}`), this._virtualBodyScrollEl = e), !e) return;
6869
+ s = e.scrollTop, c = e.clientHeight || 400;
6870
+ } else {
6871
+ let e = r.getBoundingClientRect();
6872
+ s = Math.max(0, -e.top);
6873
+ }
6874
+ let l = Math.min(Math.max(0, Math.floor(s / a)), Math.max(0, i - 1)), u = Math.ceil(c / a) + 16, d = Math.max(0, l - 8), f = Math.min(i, l + u), p = "";
6875
+ if (this._type === "ajax") for (let e = d; e < f; e++) p += this._virtualRowCache.has(e) ? "1" : "0";
6876
+ if (d === this._virtualLastRangeStart && f === this._virtualLastRangeEnd && (this._type !== "ajax" || p === this._virtualLastRangeCacheSig)) return;
6877
+ this._virtualLastRangeStart = d, this._virtualLastRangeEnd = f, this._virtualLastRangeCacheSig = p;
6878
+ let m = d * a, h = Math.max(0, (i - f) * a), g = "";
6879
+ if (e) {
6880
+ g += `<li aria-hidden="true" class="pointer-events-none m-0 block list-none border-0 p-0" style="height:${m}px"></li>`;
6881
+ for (let e = d; e < f; e++) {
6882
+ let t = this._getVirtualRowAt(e), n = i > 0 && e === i - 1;
6883
+ t ? g += this._buildMobileListItemHtml(t, e, a, n) : g += this._buildMobileListPlaceholderLi(e, a, n);
6884
+ }
6885
+ g += `<li aria-hidden="true" class="pointer-events-none m-0 block list-none border-0 p-0" style="height:${h}px"></li>`;
6886
+ } else {
6887
+ g += `<tr data-mint-rt-spacer="top" aria-hidden="true"><td colspan="${o}" style="height:${m}px;padding:0;border:0;line-height:0;font-size:0"></td></tr>`;
6888
+ for (let e = d; e < f; e++) {
6889
+ let t = this._getVirtualRowAt(e), n = i > 0 && e === i - 1;
6890
+ t ? g += this._buildDataRowHtml(t, e, a, n) : g += this._buildVirtualPlaceholderRowHtml(e, a, n);
6891
+ }
6892
+ g += `<tr data-mint-rt-spacer="bottom" aria-hidden="true"><td colspan="${o}" style="height:${h}px;padding:0;border:0;line-height:0;font-size:0"></td></tr>`;
6893
+ }
6894
+ if (r.innerHTML = g, this.querySelectorAll(`tbody[data-mint-rt-tbody="${this._tableId}"] mint-button[data-action], ul[data-mint-rt-mobile-list="${this._tableId}"] mint-button[data-action]`).forEach((e) => {
6895
+ e.render && e.render();
6896
+ }), this._attachTableEventListeners(), this._attachRowClickHandler(), this._type === "ajax" && this._virtualScrollActive() && this._scheduleVirtualAjaxPrefetch(d, f), this._virtualScrollRoot() === "table-body" && !e) {
6897
+ let e = this._virtualBodyScrollEl;
6898
+ e?.isConnected && requestAnimationFrame(() => {
6899
+ if (!e.isConnected) return;
6900
+ let t = Math.max(0, e.scrollHeight - e.clientHeight);
6901
+ e.scrollTop > t && (e.scrollTop = t);
6902
+ });
6903
+ }
6904
+ }
6905
+ _detachVirtualScroll() {
6906
+ this._virtualScrollHandler &&= (window.removeEventListener("scroll", this._virtualScrollHandler), this._virtualBodyScrollEl?.removeEventListener("scroll", this._virtualScrollHandler), null), this._virtualWindowResizeHandler &&= (window.removeEventListener("resize", this._virtualWindowResizeHandler), null), this._virtualResizeObserver &&= (this._virtualResizeObserver.disconnect(), null), this._virtualBodyScrollEl = null, this._virtualWindowRaf !== null && (window.cancelAnimationFrame(this._virtualWindowRaf), this._virtualWindowRaf = null), this._virtualLastRangeStart = -1, this._virtualLastRangeEnd = -1, this._virtualLastRangeCacheSig = "", this._virtualAjaxPrefetchTimer !== null && (window.clearTimeout(this._virtualAjaxPrefetchTimer), this._virtualAjaxPrefetchTimer = null), this._virtualRangeFetching = !1;
6907
+ }
6908
+ _scheduleVirtualAjaxPrefetch(e, t) {
6909
+ if (this._type !== "ajax" || !this._virtualScrollActive() || !this._configuration) return;
6910
+ let n = !1;
6911
+ for (let r = e; r < t; r++) if (!this._virtualRowCache.has(r)) {
6912
+ n = !0;
6913
+ break;
6914
+ }
6915
+ if (!n) return;
6916
+ this._virtualAjaxPrefetchTimer !== null && window.clearTimeout(this._virtualAjaxPrefetchTimer);
6917
+ let r = e, i = t;
6918
+ this._virtualAjaxPrefetchTimer = window.setTimeout(() => {
6919
+ this._virtualAjaxPrefetchTimer = null, this._fetchVirtualAjaxRange(r, i - r);
6920
+ }, 60);
6921
+ }
6922
+ async _fetchVirtualAjaxRange(e, t) {
6923
+ if (!this._configuration || this._type !== "ajax" || !this._virtualScrollActive()) return;
6924
+ let n = typeof this._configuration.data == "string" ? this._configuration.data : null;
6925
+ if (!n || t <= 0 || this._virtualRangeFetching || e < 0 || e >= this._totalRows) return;
6926
+ this._virtualRangeFetching = !0;
6927
+ let r = this._virtualFetchGeneration, i = Math.min(e, Math.max(0, this._totalRows - 1)), a = Math.min(150, Math.max(this._perPage, t, 15), Math.max(1, this._totalRows - i));
6928
+ try {
6929
+ let e = new URLSearchParams({
6930
+ perPage: a.toString(),
6931
+ offset: i.toString(),
6932
+ search: this._search,
6933
+ sortBy: this._configuration.sortBy || "id",
6934
+ sort: this._configuration.sort || "asc",
6935
+ searchColumns: this._searchColumns.join(","),
6936
+ columns: this._columns.join(",")
6937
+ }), t = {};
6938
+ this._configuration.headers && (t.headers = this._configuration.headers);
6939
+ let o = await fetch(`${n}?${e.toString()}`, t);
6940
+ if (!o.ok) throw Error(`HTTP error! status: ${o.status}`);
6941
+ let s = await o.json();
6942
+ if (r !== this._virtualFetchGeneration) return;
6943
+ (s.content?.rows || []).forEach((e, t) => {
6944
+ let n = i + t;
6945
+ n < this._totalRows && this._virtualRowCache.set(n, e);
6946
+ });
6947
+ } catch (e) {
6948
+ console.error("mint-resource-table: virtual range fetch failed", e);
6949
+ } finally {
6950
+ this._virtualRangeFetching = !1, r === this._virtualFetchGeneration && (this._virtualInvalidate(), this._scheduleVirtualWindowSync());
6951
+ }
6952
+ }
6953
+ _detachFixedChromeResize() {
6954
+ this._fixedChromeResizeObserver?.disconnect(), this._fixedChromeResizeObserver = null, this.style.removeProperty("--mint-rt-fixed-controls-h");
6955
+ }
6956
+ _syncFixedControlsChromeHeight() {
6957
+ if (!this._fixedHeader() || !this._fixedControls()) return;
6958
+ this._fixedChromeResizeObserver?.disconnect(), this._fixedChromeResizeObserver = null;
6959
+ let e = this.querySelector(`#mint-rt-fixed-controls-${this._tableId}`);
6960
+ if (!e) return;
6961
+ let t = () => {
6962
+ let t = Math.ceil(e.getBoundingClientRect().height);
6963
+ this.style.setProperty("--mint-rt-fixed-controls-h", `${t}px`);
6964
+ };
6965
+ t(), this._fixedChromeResizeObserver = new ResizeObserver(t), this._fixedChromeResizeObserver.observe(e);
6966
+ }
6967
+ _attachVirtualScrollListeners() {
6968
+ if (this._detachVirtualScroll(), !this._virtualScrollActive()) return;
6969
+ let e = () => {
6970
+ this._scheduleVirtualWindowSync();
6971
+ };
6972
+ this._virtualScrollHandler = e, this._virtualScrollRoot() === "table-body" ? (this._virtualBodyScrollEl = this.querySelector(`#mint-rt-vscroll-${this._tableId}`), this._virtualBodyScrollEl?.addEventListener("scroll", e, { passive: !0 }), this._virtualBodyScrollEl && typeof ResizeObserver < "u" && (this._virtualResizeObserver = new ResizeObserver(() => this._scheduleVirtualWindowSync()), this._virtualResizeObserver.observe(this._virtualBodyScrollEl))) : window.addEventListener("scroll", e, { passive: !0 }), this._virtualWindowResizeHandler = () => this._scheduleVirtualWindowSync(), window.addEventListener("resize", this._virtualWindowResizeHandler, { passive: !0 }), this._scheduleVirtualWindowSync();
6418
6973
  }
6419
6974
  _toggleSort(e) {
6420
6975
  if (!this._configuration || !e.data || !e.sortable) return;
@@ -6422,40 +6977,53 @@ var D = class extends HTMLElement {
6422
6977
  if (this._sortTimeoutId !== null && (clearTimeout(this._sortTimeoutId), this._sortTimeoutId = null), this._sorting = !0, this._sortingColumn = e, this._updateSortIcons(), this._type === "ajax") this._sortTimeoutId = window.setTimeout(() => {
6423
6978
  if (this._sortTimeoutId = null, !this._configuration || !t || !e.sortable) return;
6424
6979
  let n = this._configuration.sort || "asc";
6425
- this._configuration.sortBy?.toLowerCase() === t.toLowerCase() && (n = n === "desc" ? "asc" : "desc"), this._configuration.sort = n, this._configuration.sortBy = t, this._updateSortIcons(), this._offset = 0, this._currentPage = 1, this._configuration.loadMore && (this._rowsToShow = this._perPage), this._fetching = !1, this._loading = !1, this._configuration.loadMore, this._fetchData(void 0, !1, this._perPage, 0);
6980
+ this._configuration.sortBy?.toLowerCase() === t.toLowerCase() && (n = n === "desc" ? "asc" : "desc"), this._configuration.sort = n, this._configuration.sortBy = t, this._updateSortIcons(), this._offset = 0, this._currentPage = 1, this._fetching = !1, this._loading = !1, this._fetchData(void 0, !1, this._perPage, 0);
6426
6981
  }, 10);
6427
6982
  else {
6428
6983
  let e = this._configuration.sort || "asc";
6429
- this._configuration.sortBy?.toLowerCase() === t.toLowerCase() && (e = e === "desc" ? "asc" : "desc"), this._configuration.sort = e, this._configuration.sortBy = t, this._currentPage = 1, this._sorting = !1, this._sortingColumn = null, this._updateSortIcons(), this.render();
6984
+ this._configuration.sortBy?.toLowerCase() === t.toLowerCase() && (e = e === "desc" ? "asc" : "desc"), this._configuration.sort = e, this._configuration.sortBy = t, this._currentPage = 1, this._sorting = !1, this._sortingColumn = null, this._updateSortIcons(), this.render(), this._virtualScrollActive() && queueMicrotask(() => this._scrollVirtualTableTopIntoView());
6430
6985
  }
6431
6986
  }
6432
6987
  _getSortClass(e) {
6433
6988
  return this._sorting && this._sortingColumn === e ? "spinner" : this._configuration?.sortBy?.toLowerCase() === e.data?.toLowerCase() ? this._configuration?.sort?.toLowerCase() === "desc" ? "caret-down" : "caret-up" : "";
6434
6989
  }
6435
6990
  _updateSortIcons() {
6436
- this._configuration && this._configuration.columns.forEach((e, t) => {
6991
+ if (!this._configuration) return;
6992
+ this._configuration.columns.forEach((e, t) => {
6437
6993
  if (!e.sortable || e.hidden) return;
6438
6994
  let n = this.querySelector(`th[data-column-key="${t}"]`);
6439
6995
  if (!n) return;
6440
- let r = n.querySelector(".ml-2.flex.items-center");
6996
+ let r = n.querySelector(":scope > div.flex.items-center");
6441
6997
  if (!r) return;
6442
- let i = r.querySelector("mint-icon"), a = r.querySelector("mint-spinner"), o = this._getSortClass(e);
6443
- if (o === "spinner") {
6444
- if (i && i.remove(), !a) {
6445
- let e = document.createElement("mint-spinner");
6446
- e.className = "w-4 h-4", r.appendChild(e);
6998
+ let i = r.querySelector(":scope > div.ml-2.flex.items-center"), a = this._getSortClass(e), o = () => {
6999
+ if (!i) {
7000
+ let e = document.createElement("div");
7001
+ e.className = "ml-2 flex items-center", r.appendChild(e), i = e;
6447
7002
  }
6448
- } else if (a && a.remove(), i) i.setAttribute("name", o), i.className = `w-4 h-4 ${o === "sort-arrows" ? "text-gray-400" : ""}`;
6449
- else {
6450
- let e = document.createElement("mint-icon");
6451
- e.setAttribute("name", o), e.className = `w-4 h-4 ${o === "sort-arrows" ? "text-gray-400" : ""}`, r.appendChild(e);
6452
- }
6453
- });
7003
+ return i;
7004
+ }, s = () => {
7005
+ i &&= (i.remove(), null);
7006
+ };
7007
+ if (a === "spinner") {
7008
+ let e = o();
7009
+ if (e.querySelector("mint-icon")?.remove(), !e.querySelector("mint-spinner")) {
7010
+ let t = document.createElement("mint-spinner");
7011
+ t.className = "w-4 h-4", e.appendChild(t);
7012
+ }
7013
+ } else if (a === "caret-up" || a === "caret-down") {
7014
+ let e = o();
7015
+ e.querySelector("mint-spinner")?.remove();
7016
+ let t = e.querySelector("mint-icon");
7017
+ t || (t = document.createElement("mint-icon"), e.appendChild(t)), t.setAttribute("name", a), t.className = "w-4 h-4";
7018
+ } else s();
7019
+ }), this._syncMobileSortPopoverIcons();
7020
+ let e = this.querySelector(`#mint-rt-mobile-sort-btn-${this._tableId}`);
7021
+ e && (e.setAttribute("icon", this._getMobileSortTriggerIconName()), this._sorting ? e.setAttribute("loading", "true") : e.removeAttribute("loading"), typeof e.render == "function" && e.render());
6454
7022
  }
6455
7023
  _showFetchingState() {}
6456
7024
  _triggerSearch() {
6457
7025
  this._searchTimeoutId && clearTimeout(this._searchTimeoutId), this._searching = !0, this._type === "ajax" && this._updateSearchIcon(), this._type !== "ajax" && (this._currentPage = 1), this._updateTableBody(), this._type !== "ajax" && this._updatePagination(), this._searchTimeoutId = window.setTimeout(() => {
6458
- this._type === "ajax" ? (this._offset = 0, this._fetchData(void 0, !1, this._perPage, 0)) : this._searching = !1;
7026
+ this._type === "ajax" ? (this._offset = 0, this._fetchData(void 0, !1, this._perPage, 0)) : (this._searching = !1, this._virtualScrollActive() && queueMicrotask(() => this._scrollVirtualTableTopIntoView()));
6459
7027
  }, 400);
6460
7028
  }
6461
7029
  _updateSearchIcon() {
@@ -6483,113 +7051,72 @@ var D = class extends HTMLElement {
6483
7051
  }
6484
7052
  _updateTableBody() {
6485
7053
  if (!this._configuration) return;
6486
- let e = this._getRows(), t = this.querySelector(`#${this._tableId}`)?.closest("table")?.querySelector("tbody");
6487
- if (!t) {
7054
+ let e = this.querySelector(`tbody[data-mint-rt-tbody="${this._tableId}"]`), t = this.querySelector(`#${this._tableId}`)?.closest("table")?.querySelector("tbody");
7055
+ if (this._virtualScrollActive() && (this._type === "provided" || this._type === "ajax")) {
7056
+ if (!(e || t)) {
7057
+ this.render();
7058
+ return;
7059
+ }
7060
+ let n = this.querySelector(`#search-${this._tableId}`), r = document.activeElement === n || n?.querySelector("input") === document.activeElement, i = this._search;
7061
+ if ((this._fetching || this._loading) && !this._loaded && !this._sorting) return;
7062
+ if (this._virtualInvalidate(), this._syncVirtualWindow(), r && n) {
7063
+ let e = n.querySelector("input") || n._element;
7064
+ e ? (e.value = i, setTimeout(() => {
7065
+ e.focus(), e.setSelectionRange(i.length, i.length);
7066
+ }, 0)) : n.value !== void 0 && (n.value = i, setTimeout(() => {
7067
+ n.focus();
7068
+ }, 0));
7069
+ }
7070
+ return;
7071
+ }
7072
+ let n = this._getRows(), r = t;
7073
+ if (!r) {
6488
7074
  this.render();
6489
7075
  return;
6490
7076
  }
6491
- let n = this.querySelector(`#search-${this._tableId}`), r = document.activeElement === n || n?.querySelector("input") === document.activeElement, i = this._search, a = "";
6492
- if (!((this._fetching || this._loading) && !this._loaded && !this._sorting) && (e.forEach((e, t) => {
6493
- let n = typeof this._configuration.onRowClick == "function", r = n ? "cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800" : "";
6494
- a += `<tr data-row-index="${t}" ${n ? "data-row-clickable=\"true\"" : ""}${r ? ` class="${r}"` : ""}>`, this._configuration.columns.forEach((n, r) => {
7077
+ let i = this.querySelector(`#search-${this._tableId}`), a = document.activeElement === i || i?.querySelector("input") === document.activeElement, o = this._search, s = "", c = "";
7078
+ if ((this._fetching || this._loading) && !this._loaded && !this._sorting) return;
7079
+ n.forEach((e, t) => {
7080
+ c += this._buildMobileListItemHtml(e, t, void 0, t === n.length - 1);
7081
+ let r = typeof this._configuration.onRowClick == "function", i = r ? "cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800" : "";
7082
+ s += `<tr data-row-index="${t}" ${r ? "data-row-clickable=\"true\"" : ""}${i ? ` class="${i}"` : ""}>`, this._configuration.columns.forEach((n) => {
6495
7083
  if (n.hidden) return;
6496
- let i = !n.show || n.show(this, e);
6497
- if (a += `<td style="${this._getStyle(n)}" class="${this._getClasses(n, !0)}">`, i) if (n.raw) if (n.action) (!n.action.show || n.action.show(this, e)) && (a += `<mint-button variant="solid" data-action="column-action" data-row-index="${t}" data-column-key="${this._configuration.columns.indexOf(n)}">${n.action.label}</mint-button>`);
6498
- else if (n.actions) if (n.actionStyle !== "buttons") {
6499
- let r = `actions-popover-${this._tableId}-${t}`, i = `actions-button-${this._tableId}-${t}`;
6500
- a += `<mint-button id="${i}" variant="link" icon="ellipsis">`, a += "</mint-button>", a += `<mint-popover id="${r}" trigger-id="${i}" direction="down">`, n.actions.forEach((r, i) => {
6501
- if (!r.show || r.show(this, e)) {
6502
- let o = typeof r.label == "function" ? r.label(this, e) : r.label;
6503
- a += `<div class="p-2 cursor-pointer hover:bg-gray-100 dark:hover:bg-mint-hover" data-action="row-action" data-row-index="${t}" data-action-index="${i}" data-column-key="${this._configuration.columns.indexOf(n)}">${o}</div>`;
6504
- }
6505
- }), a += "</mint-popover>";
6506
- } else n.actions.forEach((r, i) => {
6507
- if (!r.show || r.show(this, e)) {
6508
- let o = r.label ? typeof r.label == "function" ? r.label(this, e) : r.label : "", s = r.icon ? ` icon="${this._escapeHtml(r.icon)}"` : "", c = r.tone ? ` tone="${this._escapeHtml(r.tone)}"` : "";
6509
- a += `<mint-button variant="link" class="${r.classes || ""}" data-action="row-action" data-row-index="${t}" data-action-index="${i}" data-column-key="${this._configuration.columns.indexOf(n)}"${s}${c}>`, o && (a += this._escapeHtml(String(o))), a += "</mint-button>";
6510
- }
6511
- });
6512
- else typeof n.format == "function" ? a += n.format(this, e) : n.data && (a += this._escapeHtml(String(e[n.data] || "")));
6513
- else if (n.action) {
6514
- if (!n.action.show || n.action.show(this, e)) {
6515
- let r = typeof n.action.label == "function" ? n.action.label(this, e) : n.action.label;
6516
- a += `<mint-button variant="solid" data-action="column-action" data-row-index="${t}" data-column-key="${this._configuration.columns.indexOf(n)}">${this._escapeHtml(String(r))}</mint-button>`;
6517
- }
6518
- } else if (n.actions) if (n.actionStyle !== "buttons") {
6519
- let r = `actions-popover-${this._tableId}-${t}`, i = `actions-button-${this._tableId}-${t}`;
6520
- a += `<mint-button id="${i}" variant="link" icon="ellipsis">`, a += "</mint-button>", a += `<mint-popover id="${r}" trigger-id="${i}" direction="down">`, n.actions.forEach((r, i) => {
6521
- if (!r.show || r.show(this, e)) {
6522
- let o = typeof r.label == "function" ? r.label(this, e) : r.label;
6523
- a += `<div class="p-2 cursor-pointer hover:bg-gray-100 dark:hover:bg-mint-hover" data-action="row-action" data-row-index="${t}" data-action-index="${i}" data-column-key="${this._configuration.columns.indexOf(n)}">${o}</div>`;
6524
- }
6525
- }), a += "</mint-popover>";
6526
- } else n.actions.forEach((r, i) => {
6527
- if (!r.show || r.show(this, e)) {
6528
- let o = r.label ? typeof r.label == "function" ? r.label(this, e) : r.label : "", s = r.icon ? ` icon="${this._escapeHtml(r.icon)}"` : "", c = r.tone ? ` tone="${this._escapeHtml(r.tone)}"` : "";
6529
- a += `<mint-button variant="link" class="${r.classes || ""}" data-action="row-action" data-row-index="${t}" data-action-index="${i}" data-column-key="${this._configuration.columns.indexOf(n)}"${s}${c}>`, o && (a += this._escapeHtml(String(o))), a += "</mint-button>";
6530
- }
6531
- });
6532
- else typeof n.format == "function" ? a += this._escapeHtml(n.format(this, e)) : n.data && (a += this._escapeHtml(String(e[n.data] || "")));
6533
- a += "</td>";
6534
- }), a += "</tr>";
6535
- }), e.length === 0 && (this._fetchError ? a += `<tr><td colspan="${this._configuration.columns.filter((e) => !e.hidden).length}" class="text-center py-8 text-red-500 dark:text-red-400">Failed to load data: ${this._escapeHtml(this._fetchError)}</td></tr>` : a += `<tr><td colspan="${this._configuration.columns.filter((e) => !e.hidden).length}" class="text-center py-8">No records found.</td></tr>`), t.innerHTML = a, this._attachTableEventListeners(), this._attachRowClickHandler(), r && n)) {
6536
- let e = n.querySelector("input") || n._element;
6537
- e ? (e.value = i, setTimeout(() => {
6538
- e.focus(), e.setSelectionRange(i.length, i.length);
6539
- }, 0)) : n.value !== void 0 && (n.value = i, setTimeout(() => {
6540
- n.focus();
7084
+ let r = !n.show || n.show(this, e);
7085
+ s += `<td style="${this._getStyle(n)}" class="${this._getClasses(n, !0)}">`, r && (s += this._buildTableCellInnerHtml(n, e, t, "table")), s += "</td>";
7086
+ }), s += "</tr>";
7087
+ }), n.length === 0 && (this._fetchError ? (s += `<tr><td colspan="${this._configuration.columns.filter((e) => !e.hidden).length}" class="text-center py-8 text-red-500 dark:text-red-400">Failed to load data: ${this._escapeHtml(this._fetchError)}</td></tr>`, c += `<li class="list-none px-4 py-8 text-center text-sm text-red-500 dark:text-red-400">Failed to load data: ${this._escapeHtml(this._fetchError)}</li>`) : (s += `<tr><td colspan="${this._configuration.columns.filter((e) => !e.hidden).length}" class="text-center py-8">No records found.</td></tr>`, c += "<li class=\"list-none px-4 py-8 text-center text-sm\">No records found.</li>")), r.innerHTML = s;
7088
+ let l = this.querySelector(`ul[data-mint-rt-mobile-list="${this._tableId}"]`);
7089
+ if (l && (l.innerHTML = c), this._attachTableEventListeners(), this._attachRowClickHandler(), a && i) {
7090
+ let e = i.querySelector("input") || i._element;
7091
+ e ? (e.value = o, setTimeout(() => {
7092
+ e.focus(), e.setSelectionRange(o.length, o.length);
7093
+ }, 0)) : i.value !== void 0 && (i.value = o, setTimeout(() => {
7094
+ i.focus();
6541
7095
  }, 0));
6542
7096
  }
6543
7097
  }
6544
7098
  _updatePagination() {
6545
7099
  if (!this._configuration) return;
6546
- let e = this._lastPage || Math.ceil(this._rows.length / this._perPage);
6547
- if (!this._configuration.perPage || this._configuration.loadMore || e <= 1) {
6548
- let e = this.querySelector("nav")?.closest(".flex.justify-end");
6549
- e && e.remove();
7100
+ let e = this._lastPage || Math.ceil(this._rows.length / this._perPage), t = () => {
7101
+ let e = this.querySelector("mint-table"), t = e?.nextElementSibling;
7102
+ e && t && t.id !== `mint-rt-pagination-host-${this._tableId}` && !t.classList.contains("mint-rt-pagination-host") && t.querySelector?.("[data-action=\"page\"]") && t.remove();
7103
+ };
7104
+ if (!this._configuration.perPage || e <= 1 || this._virtualScrollActive()) {
7105
+ this._getPaginationHostEl()?.replaceChildren(), t();
6550
7106
  return;
6551
7107
  }
6552
- let t = this.querySelector("nav")?.closest(".flex.justify-end");
6553
- if (!t) {
6554
- let e = this.querySelector("mint-table");
7108
+ let n = this._getPaginationHostEl();
7109
+ if (!n) {
7110
+ let e = this.querySelector(`[data-mint-rt-mobile-list="${this._tableId}"]`) || this.querySelector("mint-table");
6555
7111
  if (!e) {
6556
7112
  this.render();
6557
7113
  return;
6558
7114
  }
6559
- t = document.createElement("div"), t.className = "flex justify-end " + (this._inMintCard ? "p-3.5" : "mt-4"), e.insertAdjacentElement("afterend", t);
7115
+ n = document.createElement("div"), n.id = `mint-rt-pagination-host-${this._tableId}`, n.setAttribute("data-mint-rt-pagination-wrap", ""), n.className = "mint-rt-pagination-host w-full min-w-0 overflow-x-auto overflow-y-hidden overscroll-x-contain flex justify-center [-webkit-overflow-scrolling:touch] md:justify-end " + (this._inMintCard ? "border-t border-gray-200 px-3.5 pb-3.5 pt-3 dark:border-mint-divider md:border-t-0 md:pt-0" : "border-t border-gray-200 px-2 py-3 dark:border-mint-divider md:border-t-0 md:py-0 md:mt-4"), e.insertAdjacentElement("afterend", n);
6560
7116
  }
6561
- let n = "<nav>";
6562
- n += "<ul class=\"flex gap-1\">";
6563
- let r = this._currentPage === 1 || this._loading || this._fetching;
6564
- n += `<li><mint-button variant="solid" size="sm" icon="caret-left" ${r ? "disabled=\"true\"" : ""} data-action="page-prev"></mint-button></li>`;
6565
- let i = e >= 10, a = Math.max(1, this._currentPage - 1), o = Math.min(e, this._currentPage + 1);
6566
- if (i) {
6567
- for (let e = 1; e <= 3; e++) {
6568
- let t = this._currentPage === e, r = this._loadingPage === e, i = t ? " active=\"true\"" : "", a = this._loading || this._fetching ? " disabled=\"true\"" : "", o = r ? " loading=\"true\"" : "", s = r ? "" : `${e}`;
6569
- n += `<li><mint-button variant="solid" size="sm"${i}${a}${o} data-action="page" data-page="${e}">${s}</mint-button></li>`;
6570
- }
6571
- let t = o <= 3, r = a >= e - 2;
6572
- if (!t && !r) {
6573
- a > 4 && (n += "<li><span class=\"px-2\">...</span></li>");
6574
- for (let e = a; e <= o; e++) {
6575
- if (e <= 3) continue;
6576
- let t = this._currentPage === e, r = this._loadingPage === e, i = t ? " active=\"true\"" : "", a = this._loading || this._fetching ? " disabled=\"true\"" : "", o = r ? " loading=\"true\"" : "", s = r ? "" : `${e}`;
6577
- n += `<li><mint-button variant="solid" size="sm"${i}${a}${o} data-action="page" data-page="${e}">${s}</mint-button></li>`;
6578
- }
6579
- o < e - 3 && (n += "<li><span class=\"px-2\">...</span></li>");
6580
- } else (t && !r || !t && r && e - 2 > 4) && (n += "<li><span class=\"px-2\">...</span></li>");
6581
- for (let i = e - 2; i <= e; i++) {
6582
- if (i <= 3 || !t && !r && i >= a && i <= o) continue;
6583
- let e = this._currentPage === i, s = this._loadingPage === i, c = e ? " active=\"true\"" : "", l = this._loading || this._fetching ? " disabled=\"true\"" : "", u = s ? " loading=\"true\"" : "", d = s ? "" : `${i}`;
6584
- n += `<li><mint-button variant="solid" size="sm"${c}${l}${u} data-action="page" data-page="${i}">${d}</mint-button></li>`;
6585
- }
6586
- } else for (let t = 1; t <= e; t++) {
6587
- let e = this._currentPage === t, r = this._loadingPage === t, i = e ? " active=\"true\"" : "", a = this._loading || this._fetching ? " disabled=\"true\"" : "", o = r ? " loading=\"true\"" : "", s = r ? "" : `${t}`;
6588
- n += `<li><mint-button variant="solid" size="sm"${i}${a}${o} data-action="page" data-page="${t}">${s}</mint-button></li>`;
6589
- }
6590
- let s = this._currentPage >= e || this._loading || this._fetching;
6591
- n += `<li><mint-button variant="solid" size="sm" icon="caret-right" ${s ? "disabled=\"true\"" : ""} data-action="page-next"></mint-button></li>`, n += "</ul>", n += "</nav>", t.innerHTML = n, setTimeout(() => {
6592
- this._attachPaginationListeners(), t.querySelectorAll("mint-button[data-action=\"page\"]").forEach((e) => {
7117
+ let r = this._buildPaginationNavMarkup(e);
7118
+ n.innerHTML = r, setTimeout(() => {
7119
+ this._attachPaginationListeners(), n.querySelectorAll("mint-button[data-action=\"page\"]").forEach((e) => {
6593
7120
  let t = e.getAttribute("data-page"), n = t && this._loadingPage === parseInt(t), r = e._button || e.querySelector("button");
6594
7121
  if (r) if (n) {
6595
7122
  let e = [], t = document.createTreeWalker(r, NodeFilter.SHOW_TEXT, null), n;
@@ -6613,14 +7140,11 @@ var D = class extends HTMLElement {
6613
7140
  let e = r.querySelector("span.mr-2");
6614
7141
  e && e.querySelector("mint-spinner") && (e.classList.remove("mr-2"), e.classList.add("mr-0"));
6615
7142
  }
6616
- }), t.querySelectorAll("mint-button[data-action=\"page-prev\"], mint-button[data-action=\"page-next\"]").forEach((e) => {
7143
+ }), n.querySelectorAll("mint-button[data-action=\"page-prev\"], mint-button[data-action=\"page-next\"]").forEach((e) => {
6617
7144
  "render" in e && typeof e.render == "function" && e.render();
6618
7145
  }), this._loadingPage !== null && !this._loading && !this._fetching && this._updatePagination();
6619
7146
  }, 0);
6620
7147
  }
6621
- _loadMore() {
6622
- this._loading || this._fetching || (this._type === "ajax" ? this._lastPage > 0 && this._currentPage < this._lastPage : this._totalRows > 0 && this._rowsToShow < this._totalRows) && (this._offset += this._perPage, this._currentPage += 1, this._rowsToShow += this._perPage, this._type === "ajax" ? this._fetchData() : this.render());
6623
- }
6624
7148
  _goToPage(e) {
6625
7149
  let t = this._lastPage || Math.ceil(this._rows.length / this._perPage);
6626
7150
  e > t && (e = t), e < 1 && (e = 1), e !== this._currentPage && (this._currentPage = e, this._offset = (e - 1) * this._perPage, this._updatePageInUrl(e), this._type === "ajax" ? (this._loadingPage = e, this._updatePagination(), this._fetchData()) : this.render());
@@ -6641,28 +7165,20 @@ var D = class extends HTMLElement {
6641
7165
  }
6642
7166
  _downloadCSV() {
6643
7167
  if (!this._configuration) return;
6644
- let e = this.querySelector("table");
7168
+ let e = this.querySelector(`#${this._tableId}`) || this.querySelector("table");
6645
7169
  if (!e) return;
6646
- let t = e.querySelectorAll("tr"), n = "data:text/csv;charset=utf-8,";
6647
- t.forEach((e) => {
6648
- let t = [];
7170
+ let t = "data:text/csv;charset=utf-8,", n = (e) => {
7171
+ let n = [];
6649
7172
  e.querySelectorAll("th, td").forEach((e) => {
6650
- let n = e.getAttribute("colspan");
6651
- if (n) for (let e = 0; e < parseInt(n) - 1; e++) t.push("");
6652
- t.push("\"" + e.textContent?.trim().replace(/"/g, "\"\"") + "\"");
6653
- }), n += t.join(",") + "\n";
6654
- });
6655
- let r = encodeURI(n), i = document.createElement("a");
7173
+ let t = e.getAttribute("colspan");
7174
+ if (t) for (let e = 0; e < parseInt(t, 10) - 1; e++) n.push("");
7175
+ n.push("\"" + e.textContent?.trim().replace(/"/g, "\"\"") + "\"");
7176
+ }), t += n.join(",") + "\n";
7177
+ };
7178
+ e.querySelectorAll("tr").forEach((e) => n(e));
7179
+ let r = encodeURI(t), i = document.createElement("a");
6656
7180
  i.setAttribute("href", r), i.setAttribute("download", `${this._configuration.export_name || this._tableId}.csv`), document.body.appendChild(i), i.click(), document.body.removeChild(i);
6657
7181
  }
6658
- _columnChange(e, t) {
6659
- t.hidden = !e.target.checked, this._saveColumnVisibility();
6660
- let n = `edit-columns-popover-${this._tableId}`, r = this.querySelector(`#${n}`), i = r?.hasAttribute("open");
6661
- this.render(), i && r && requestAnimationFrame(() => {
6662
- let e = this.querySelector(`#${n}`);
6663
- e && typeof e.open == "function" && e.open();
6664
- });
6665
- }
6666
7182
  _getStyle(e) {
6667
7183
  let t = "";
6668
7184
  return (e.nowrap || e.actions) && (t += "white-space: nowrap;"), e.offsetLeft && (t += `left: ${e.offsetLeft} !important;`), e.offsetRight && (t += `right: ${e.offsetRight} !important;`), e.width && (t += `min-width: ${e.width}px; max-width: ${e.width}px;`), t;
@@ -6671,107 +7187,102 @@ var D = class extends HTMLElement {
6671
7187
  let n = [];
6672
7188
  return e.class && n.push(e.class.trim()), e.sortable && !t && n.push("cursor-pointer"), e.stickLeft && n.push("sticky-left"), e.stickRight && n.push("sticky-right"), n.join(" ");
6673
7189
  }
7190
+ _renderTheadHtml(e, t, n = !1, r = !1) {
7191
+ if (!this._configuration) return "";
7192
+ let i = ["bg-white", "dark:bg-mint-nav"];
7193
+ e && (i.push("sticky", "z-40"), r ? i.push("top-[var(--mint-rt-fixed-controls-h,0px)]") : i.push("top-0")), t && i.push("border-b", "border-gray-200", "dark:border-mint-divider");
7194
+ let a = `<thead class="${i.join(" ")}"><tr>`;
7195
+ return this._configuration.columns.forEach((e, t) => {
7196
+ if (e.hidden) return;
7197
+ let r = n ? "" : ` width="${e.width || ""}"`, i = e.sortable ? " data-mint-rt-sortable=\"\"" : "";
7198
+ if (a += `<th${r} style="${this._getStyle(e)}" class="${this._getClasses(e)}" data-column-key="${t}"${i}>`, e.showLabel !== !1) {
7199
+ if (a += "<div class=\"flex items-center\">", a += `<div class="flex-1">${e.raw ? e.label : this._escapeHtml(e.label)}</div>`, e.sortable) {
7200
+ let t = this._getSortClass(e);
7201
+ t === "spinner" ? a += "<div class=\"ml-2 flex items-center\"><mint-spinner class=\"w-4 h-4\"></mint-spinner></div>" : (t === "caret-up" || t === "caret-down") && (a += `<div class="ml-2 flex items-center"><mint-icon name="${t}" class="w-4 h-4"></mint-icon></div>`);
7202
+ }
7203
+ a += "</div>";
7204
+ }
7205
+ a += "</th>";
7206
+ }), a += "</tr></thead>", a;
7207
+ }
6674
7208
  render() {
6675
7209
  if (!this._configuration) {
6676
7210
  this.innerHTML = "<div class=\"p-4 text-red-500\">Error: Invalid configuration</div>";
6677
7211
  return;
6678
7212
  }
6679
- let e = !this._loaded || this._rows.length > 0 || this._search.length > 0 || this._searching, t = this._getRows(), n = this._lastPage || Math.ceil(this._rows.length / this._perPage), r = "";
6680
- if (e) {
6681
- if (r += "<div class=\"flex " + (this._inMintCard ? "p-3.5" : "mb-3") + "\">", r += "<div class=\"flex-grow-1 flex-1\">", r += "<div class=\"flex gap-2 items-center\">", this._configuration.showSearch !== !1) {
6682
- let e = `search-${this._tableId}`;
6683
- r += `<mint-input id="${e}" type="search" label="" placeholder="Search..." class="flex-1" icon="search" value="${this._escapeHtml(this._search)}"></mint-input>`;
6684
- }
6685
- if (this._configuration.buttons && this._configuration.buttons.forEach((e) => {
7213
+ this._ensureMobileListMql();
7214
+ let e = String(this._configuration.id || "").trim();
7215
+ e && (this.id = e), this._detachVirtualScroll(), this._detachFixedChromeResize(), this._virtualScrollActive() || this._virtualRowCache.clear();
7216
+ let t = !this._loaded || this._rows.length > 0 || this._search.length > 0 || this._searching, n = this._getRows();
7217
+ this._lastPage || Math.ceil(this._rows.length / this._perPage);
7218
+ let r = "";
7219
+ if (t) {
7220
+ let e = this._fixedControls(), t = [
7221
+ "flex",
7222
+ "items-center",
7223
+ "min-w-0",
7224
+ this._inMintCard ? "p-3.5" : "mb-3",
7225
+ e ? "sticky top-0 z-50 bg-white dark:bg-mint-nav border-b border-gray-200 dark:border-mint-divider" : ""
7226
+ ].filter(Boolean).join(" ");
7227
+ if (r += `<div id="mint-rt-fixed-controls-${this._tableId}" class="${t}">`, r += "<div class=\"flex min-w-0 flex-1 items-center gap-2\">", r += this._buildMobileSortToolbarHtml(), this._configuration.showSearch !== !1) {
7228
+ let e = `search-${this._tableId}`, t = this._escapeHtml(this._configuration.searchPlaceholder || "Search...");
7229
+ r += `<mint-input id="${e}" type="search" label="" placeholder="${t}" class="min-w-0 flex-1" icon="search" value="${this._escapeHtml(this._search)}"></mint-input>`;
7230
+ }
7231
+ r += "<div class=\"hidden shrink-0 items-center gap-2 md:flex\">", this._configuration.buttons && this._configuration.buttons.forEach((e) => {
6686
7232
  let t = e.icon ? ` icon="${this._escapeHtml(e.icon)}"` : "", n = e.tone ? ` tone="${this._escapeHtml(e.tone)}"` : "";
6687
7233
  r += `<mint-button variant="solid" class="${e.class || ""}" data-button-type="${e.type || "custom"}"${t}${n}>`, e.label && (r += this._escapeHtml(e.label)), r += "</mint-button>";
6688
- }), r += "</div>", r += "</div>", this._configuration.editColumns !== !1 && this._configuration.columns.some((e) => !e.actions && e.editable !== !1)) {
6689
- let e = `edit-columns-popover-${this._tableId}`, t = `edit-columns-button-${this._tableId}`;
6690
- r += "<div class=\"ml-2\">", r += `<mint-button id="${t}" variant="solid" icon="edit"></mint-button>`, r += `<mint-popover id="${e}" trigger-id="${t}" direction="down">`, this._configuration.columns.forEach((e) => {
6691
- !e.actions && e.editable !== !1 && (r += "<div class=\"p-2\">", r += `<mint-checkbox label="${e.label}" ${e.hidden ? "" : "checked"} data-column-key="${this._configuration.columns.indexOf(e)}"></mint-checkbox>`, r += "</div>");
6692
- }), r += "</mint-popover>", r += "</div>";
6693
- }
6694
- r += "</div>";
7234
+ }), r += "</div>", r += "</div>", r += "</div>";
6695
7235
  }
6696
7236
  if (this._type === "ajax" && !this._loaded && !this._fetchError && !this._sorting) {
6697
- r += "<mint-table class=\"table-section" + (this._inMintCard ? " rounded-t-none" : "") + "\">", r += `<table id="${this._tableId}">`, r += "<thead><tr>", this._configuration.columns.forEach((e, t) => {
6698
- e.hidden || (r += `<th width="${e.width || ""}" style="${this._getStyle(e)}" class="${this._getClasses(e)}" data-column-key="${t}">`, e.showLabel !== !1 && (r += "<div class=\"flex items-center\">", r += `<div class="flex-1">${e.raw ? e.label : this._escapeHtml(e.label)}</div>`, e.sortable && (r += "<div class=\"ml-2 flex items-center\">", r += "<mint-icon name=\"\" class=\"w-4 h-4 text-gray-400\"></mint-icon>", r += "</div>"), r += "</div>"), r += "</th>");
6699
- }), r += "</tr></thead>", r += "<tbody>";
6700
- for (let e = 0; e < 4; e++) r += "<tr>", this._configuration.columns.forEach((e) => {
6701
- e.hidden || (r += `<td style="${this._getStyle(e)}" class="${this._getClasses(e, !0)}">`, r += "<div class=\"h-4 bg-gray-200 dark:bg-mint-hover rounded animate-pulse\"></div>", r += "</td>");
6702
- }), r += "</tr>";
6703
- if (r += "</tbody>", r += "</table>", r += "</mint-table>", this._configuration.perPage && !this._configuration.loadMore && (n > 1 || this._lastPage > 0)) {
6704
- let e = this._lastPage > 0 ? this._lastPage : n;
6705
- if (e > 1) {
6706
- r += "<div class=\"flex justify-end " + (this._inMintCard ? "p-3.5" : "mt-4") + "\">", r += "<nav>", r += "<ul class=\"flex gap-1\">", r += `<li><mint-button variant="solid" size="sm" icon="caret-left" ${this._currentPage === 1 ? "disabled=\"true\"" : ""} data-action="page-prev"></mint-button></li>`;
6707
- for (let t = 1; t <= Math.min(2, e); t++) {
6708
- let e = this._currentPage === t ? " disabled=\"true\"" : "";
6709
- r += `<li><mint-button variant="solid" size="sm"${e} data-action="page" data-page="${t}">${t}</mint-button></li>`;
6710
- }
6711
- if (e > 2 && (r += "<li><span class=\"px-2\">...</span></li>"), this._currentPage > 2 && this._currentPage < e - 1 && (r += `<li><mint-button variant="solid" size="sm" data-action="page" data-page="${this._currentPage - 1}">${this._currentPage - 1}</mint-button></li>`, r += `<li><mint-button variant="solid" size="sm" disabled="true" data-action="page" data-page="${this._currentPage}">${this._currentPage}</mint-button></li>`, r += `<li><mint-button variant="solid" size="sm" data-action="page" data-page="${this._currentPage + 1}">${this._currentPage + 1}</mint-button></li>`), e > 2) for (let t = Math.max(e - 1, this._currentPage + 2); t <= e; t++) {
6712
- let e = this._currentPage === t ? " disabled=\"true\"" : "";
6713
- r += `<li><mint-button variant="solid" size="sm"${e} data-action="page" data-page="${t}">${t}</mint-button></li>`;
6714
- }
6715
- r += `<li><mint-button variant="solid" size="sm" icon="caret-right" ${this._currentPage >= e ? "disabled=\"true\"" : ""} data-action="page-next"></mint-button></li>`, r += "</ul>", r += "</nav>", r += "</div>";
6716
- }
6717
- }
6718
- } else t.length > 0 || this._search.length > 0 || this._searching || this._fetchError ? (r += "<mint-table class=\"table-section" + (this._inMintCard ? " rounded-t-none" : "") + "\">", r += `<table id="${this._tableId}">`, r += "<thead><tr>", this._configuration.columns.forEach((e, t) => {
6719
- if (!e.hidden) {
6720
- if (r += `<th width="${e.width || ""}" style="${this._getStyle(e)}" class="${this._getClasses(e)}" data-column-key="${t}">`, e.showLabel !== !1) {
7237
+ let e = this._fixedHeader() ? " data-mint-rt-scroll-inner=\"\"" : "", t = this._fixedHeader() && this._fixedControls(), n = this._fixedHeader() ? t ? "sticky top-[var(--mint-rt-fixed-controls-h,0px)] z-40 " : "sticky top-0 z-40 " : "sticky top-0 z-20 ";
7238
+ r += "<div class=\"min-w-0\">", r += "<mint-table class=\"table-section" + (this._inMintCard ? " rounded-t-none" : "") + "\"" + e + ">", r += `<table id="${this._tableId}">`, r += "<thead class=\"" + n + "bg-white dark:bg-mint-nav border-b border-gray-200 dark:border-mint-divider\"><tr>", this._configuration.columns.forEach((e, t) => {
7239
+ if (e.hidden) return;
7240
+ let n = e.sortable ? " data-mint-rt-sortable=\"\"" : "";
7241
+ if (r += `<th width="${e.width || ""}" style="${this._getStyle(e)}" class="${this._getClasses(e)}" data-column-key="${t}"${n}>`, e.showLabel !== !1) {
6721
7242
  if (r += "<div class=\"flex items-center\">", r += `<div class="flex-1">${e.raw ? e.label : this._escapeHtml(e.label)}</div>`, e.sortable) {
6722
- r += "<div class=\"ml-2 flex items-center\">";
6723
7243
  let t = this._getSortClass(e);
6724
- t === "spinner" ? r += "<mint-spinner class=\"w-4 h-4\"></mint-spinner>" : r += `<mint-icon name="${t}" class="w-4 h-4 ${t === "sort-arrows" ? "text-gray-400" : ""}"></mint-icon>`, r += "</div>";
7244
+ t === "spinner" ? r += "<div class=\"ml-2 flex items-center\"><mint-spinner class=\"w-4 h-4\"></mint-spinner></div>" : (t === "caret-up" || t === "caret-down") && (r += `<div class="ml-2 flex items-center"><mint-icon name="${t}" class="w-4 h-4"></mint-icon></div>`);
6725
7245
  }
6726
7246
  r += "</div>";
6727
7247
  }
6728
7248
  r += "</th>";
6729
- }
6730
- }), r += "</tr></thead>", r += "<tbody>", !this._fetching && !this._loading && t.forEach((e, t) => {
6731
- let n = typeof this._configuration.onRowClick == "function", i = n ? "cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800" : "";
6732
- r += `<tr data-row-index="${t}" ${n ? "data-row-clickable=\"true\"" : ""}${i ? ` class="${i}"` : ""}>`, this._configuration.columns.forEach((n, i) => {
6733
- if (n.hidden) return;
6734
- let a = !n.show || n.show(this, e);
6735
- if (r += `<td style="${this._getStyle(n)}" class="${this._getClasses(n, !0)}">`, a) if (n.raw) if (n.action) {
6736
- if (!n.action.show || n.action.show(this, e)) {
6737
- let i = typeof n.action.label == "function" ? n.action.label(this, e) : n.action.label;
6738
- r += `<mint-button variant="solid" data-action="column-action" data-row-index="${t}" data-column-key="${this._configuration.columns.indexOf(n)}">${this._escapeHtml(String(i))}</mint-button>`;
6739
- }
6740
- } else if (n.actions) if (n.actionStyle !== "buttons") {
6741
- let i = `actions-popover-${this._tableId}-${t}`, a = `actions-button-${this._tableId}-${t}`;
6742
- r += `<mint-button id="${a}" variant="link" icon="ellipsis">`, r += "</mint-button>", r += `<mint-popover id="${i}" trigger-id="${a}" direction="down">`, n.actions.forEach((i, a) => {
6743
- if (!i.show || i.show(this, e)) {
6744
- let o = typeof i.label == "function" ? i.label(this, e) : i.label;
6745
- r += `<div class="p-2 cursor-pointer hover:bg-gray-100 dark:hover:bg-mint-hover" data-action="row-action" data-row-index="${t}" data-action-index="${a}" data-column-key="${this._configuration.columns.indexOf(n)}">${this._escapeHtml(String(o))}</div>`;
6746
- }
6747
- }), r += "</mint-popover>";
6748
- } else n.actions.forEach((i, a) => {
6749
- if (!i.show || i.show(this, e)) {
6750
- let o = i.label ? typeof i.label == "function" ? i.label(this, e) : i.label : "", s = i.icon ? ` icon="${this._escapeHtml(i.icon)}"` : "", c = i.tone ? ` tone="${this._escapeHtml(i.tone)}"` : "";
6751
- r += `<mint-button variant="link" class="${i.classes || ""}" data-action="row-action" data-row-index="${t}" data-action-index="${a}" data-column-key="${this._configuration.columns.indexOf(n)}"${s}${c}>`, o && (r += this._escapeHtml(String(o))), r += "</mint-button>";
6752
- }
6753
- });
6754
- else typeof n.format == "function" ? r += n.format(this, e) : n.data && (r += this._escapeHtml(String(e[n.data] || "")));
6755
- else if (n.action) (!n.action.show || n.action.show(this, e)) && (r += `<mint-button variant="solid" data-action="column-action" data-row-index="${t}" data-column-key="${this._configuration.columns.indexOf(n)}">${n.action.label}</mint-button>`);
6756
- else if (n.actions) if (n.actionStyle !== "buttons") {
6757
- let i = `actions-popover-${this._tableId}-${t}`, a = `actions-button-${this._tableId}-${t}`;
6758
- r += `<mint-button id="${a}" variant="link" icon="ellipsis">`, r += "</mint-button>", r += `<mint-popover id="${i}" trigger-id="${a}" direction="down">`, n.actions.forEach((i, a) => {
6759
- if (!i.show || i.show(this, e)) {
6760
- let o = typeof i.label == "function" ? i.label(this, e) : i.label;
6761
- r += `<div class="p-2 cursor-pointer hover:bg-gray-100 dark:hover:bg-mint-hover" data-action="row-action" data-row-index="${t}" data-action-index="${a}" data-column-key="${this._configuration.columns.indexOf(n)}">${this._escapeHtml(String(o))}</div>`;
6762
- }
6763
- }), r += "</mint-popover>";
6764
- } else n.actions.forEach((i, a) => {
6765
- if (!i.show || i.show(this, e)) {
6766
- let o = i.label ? typeof i.label == "function" ? i.label(this, e) : i.label : "", s = i.icon ? ` icon="${this._escapeHtml(i.icon)}"` : "", c = i.tone ? ` tone="${this._escapeHtml(i.tone)}"` : "";
6767
- r += `<mint-button variant="link" class="${i.classes || ""}" data-action="row-action" data-row-index="${t}" data-action-index="${a}" data-column-key="${this._configuration.columns.indexOf(n)}"${s}${c}>`, o && (r += this._escapeHtml(String(o))), r += "</mint-button>";
6768
- }
6769
- });
6770
- else typeof n.format == "function" ? r += this._escapeHtml(n.format(this, e)) : n.data && (r += this._escapeHtml(String(e[n.data] || "")));
6771
- r += "</td>";
7249
+ }), r += "</tr></thead>", r += "<tbody>";
7250
+ for (let e = 0; e < 4; e++) r += "<tr>", this._configuration.columns.forEach((e) => {
7251
+ if (!e.hidden) {
7252
+ if (r += `<td style="${this._getStyle(e)}" class="${this._getClasses(e, !0)}">`, e.thumbnail) {
7253
+ let t = this._thumbnailDesktopPx(e);
7254
+ r += `<div class="rounded-md bg-gray-200 dark:bg-white/15 animate-pulse" style="width:${t}px;height:${t}px;box-sizing:border-box"></div>`;
7255
+ } else r += "<div class=\"h-4 max-w-[95%] rounded bg-gray-200 dark:bg-white/15 animate-pulse\"></div>";
7256
+ r += "</td>";
7257
+ }
6772
7258
  }), r += "</tr>";
6773
- }), !this._fetching && !this._loading && t.length === 0 && (this._fetchError ? r += `<tr><td colspan="${this._configuration.columns.filter((e) => !e.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((e) => !e.hidden).length}" class="text-center py-8">No records found.</td></tr>`), r += "</tbody>", r += "</table>", this._configuration.loadMore && (this._loading || this._fetching ? (r += "<div class=\"flex justify-center " + (this._inMintCard ? "p-3.5" : "mt-4") + "\">", r += "<mint-spinner></mint-spinner>", r += "</div>") : (this._type === "ajax" ? this._lastPage > 0 && this._currentPage < this._lastPage : this._totalRows > 0 && this._rowsToShow < this._totalRows) && (r += "<div class=\"flex justify-center " + (this._inMintCard ? "p-3.5" : "mt-4") + "\">", r += "<mint-button variant=\"ghost\" data-action=\"load-more\">Load more</mint-button>", r += "</div>")), r += "</mint-table>") : r += "<slot name=\"empty\"></slot>";
6774
- this.innerHTML = r, this._updatePagination(), this.querySelectorAll("mint-button[data-action]").forEach((e) => {
7259
+ r += "</tbody>", r += "</table>", r += "</mint-table>", r += "</div>", r += this._paginationHostPlaceholderHtml();
7260
+ } else if (n.length > 0 || this._search.length > 0 || this._searching || this._fetchError) {
7261
+ let e = this._virtualScrollActive() && (this._type === "provided" || this._type === "ajax" && this._loaded && !this._fetchError), t = e && this._virtualScrollRoot() === "table-body", i = this._escapeHtml(this._virtualMaxHeightCss()), a = t || this._fixedHeader(), o = this._fixedHeader() && this._fixedControls(), s = a ? " data-mint-rt-scroll-inner=\"\"" : "", c = "table-section" + (this._inMintCard ? " rounded-t-none" : ""), l = `m-0 min-h-0 w-full list-none border-collapse overflow-x-hidden bg-white ${this._inMintCard ? "px-3.5 py-3.5" : "py-3"} dark:bg-mint-canvas md:hidden`, u = "";
7262
+ if (t) {
7263
+ let e = this._renderColgroupHtml();
7264
+ r += `<div id="mint-rt-vscroll-${this._tableId}" class="overflow-y-auto overflow-x-auto min-h-0 w-full" style="max-height: ${i}; scrollbar-gutter: stable; overscroll-behavior-x: contain; overscroll-behavior-y: none; overflow-anchor: none;">`, r += "<div class=\"hidden min-h-0 min-w-0 md:block\">", r += `<mint-table class="${c}"${s}>`, r += `<table id="${this._tableId}" class="w-full min-w-0 table-fixed">`, r += e, r += this._renderTheadHtml(!0, !0, !0, o);
7265
+ } else r += "<div class=\"hidden min-h-0 min-w-0 md:block\">", r += `<mint-table class="${c}"${s}>`, r += `<table id="${this._tableId}">`, e && (r += this._renderColgroupHtml()), r += this._renderTheadHtml(!0, !0, !!e, o);
7266
+ if (r += "<tbody" + (e ? ` data-mint-rt-tbody="${this._tableId}"` : "") + ">", !this._fetching && !this._loading && !e && n.forEach((e, t) => {
7267
+ u += this._buildMobileListItemHtml(e, t, void 0, t === n.length - 1);
7268
+ let i = typeof this._configuration.onRowClick == "function", a = i ? "cursor-pointer hover:bg-gray-50 dark:hover:bg-mint-elevated" : "";
7269
+ r += `<tr data-row-index="${t}" ${i ? "data-row-clickable=\"true\"" : ""}${a ? ` class="${a}"` : ""}>`, this._configuration.columns.forEach((n) => {
7270
+ if (n.hidden) return;
7271
+ let i = !n.show || n.show(this, e);
7272
+ r += `<td style="${this._getStyle(n)}" class="${this._getClasses(n, !0)}">`, i && (r += this._buildTableCellInnerHtml(n, e, t, "table")), r += "</td>";
7273
+ }), r += "</tr>";
7274
+ }), !this._fetching && !this._loading && n.length === 0 && !e) if (this._fetchError) {
7275
+ let e = this._configuration.columns.filter((e) => !e.hidden).length;
7276
+ r += `<tr><td colspan="${e}" class="text-center py-8 text-red-500 dark:text-red-400">Failed to load data: ${this._escapeHtml(this._fetchError)}</td></tr>`, u += `<li class="list-none px-4 py-8 text-center text-sm text-red-500 dark:text-red-400">Failed to load data: ${this._escapeHtml(this._fetchError)}</li>`;
7277
+ } else {
7278
+ let e = this._configuration.columns.filter((e) => !e.hidden).length;
7279
+ r += `<tr><td colspan="${e}" class="text-center py-8">No records found.</td></tr>`, u += "<li class=\"list-none px-4 py-8 text-center text-sm\">No records found.</li>";
7280
+ }
7281
+ r += "</tbody>", r += "</table>", r += "</mint-table>", r += "</div>", r += `<ul class="${l}" data-mint-rt-mobile-list="${this._tableId}">${e ? "" : u}</ul>`, e || (r += this._paginationHostPlaceholderHtml()), t && (r += "</div>");
7282
+ } else r += "<slot name=\"empty\"></slot>";
7283
+ this._fixedHeader() ? this.setAttribute("data-mint-rt-fixed-header", "") : this.removeAttribute("data-mint-rt-fixed-header"), this._fixedControls() ? this.setAttribute("data-mint-rt-fixed-controls", "") : this.removeAttribute("data-mint-rt-fixed-controls"), this.innerHTML = r, this._updatePagination(), this.querySelectorAll("mint-button[data-action]").forEach((e) => {
7284
+ e.render && e.render();
7285
+ }), this.querySelectorAll("mint-button[data-mint-rt-toolbar]").forEach((e) => {
6775
7286
  e.render && e.render();
6776
7287
  }), this.querySelectorAll("mint-button[data-button-type]").forEach((e) => {
6777
7288
  e.render && e.render();
@@ -6782,11 +7293,11 @@ var D = class extends HTMLElement {
6782
7293
  let e = (e) => {
6783
7294
  let t = e.target;
6784
7295
  if (t.tagName === "MINT-BUTTON" || t.tagName === "BUTTON" || t.closest("mint-button") || t.closest("button") || t.closest("mint-popover") || t.closest("[data-action]")) return;
6785
- let n = t.closest("tr[data-row-clickable=\"true\"]");
7296
+ let n = t.closest("tr[data-row-clickable=\"true\"]") || t.closest("li[data-row-clickable=\"true\"]");
6786
7297
  if (!n) return;
6787
7298
  let r = n.getAttribute("data-row-index");
6788
7299
  if (!r) return;
6789
- let i = parseInt(r), a = this._getRows()[i];
7300
+ let i = parseInt(r), a = this._getRowDataForEventIndex(i);
6790
7301
  !a || !this._configuration?.onRowClick || (this._configuration.onRowClick.length === 1 ? this._configuration.onRowClick(a) : this._configuration.onRowClick(this, a));
6791
7302
  };
6792
7303
  this.addEventListener("click", e, !0), this._rowClickHandler = e;
@@ -6811,13 +7322,13 @@ var D = class extends HTMLElement {
6811
7322
  _attachTableEventListeners() {
6812
7323
  this.querySelectorAll("[data-action=\"row-action\"]").forEach((e) => {
6813
7324
  e.addEventListener("click", () => {
6814
- let t = parseInt(e.getAttribute("data-row-index") || "0"), n = parseInt(e.getAttribute("data-action-index") || "0"), r = parseInt(e.getAttribute("data-column-key") || "0"), i = this._getRows()[t], a = this._configuration?.columns[r];
6815
- a && a.actions && a.actions[n] && a.actions[n].onClick(this, i);
7325
+ let t = parseInt(e.getAttribute("data-row-index") || "0"), n = parseInt(e.getAttribute("data-action-index") || "0"), r = parseInt(e.getAttribute("data-column-key") || "0"), i = this._getRowDataForEventIndex(t), a = this._configuration?.columns[r];
7326
+ a && a.actions && a.actions[n] && i !== void 0 && a.actions[n].onClick(this, i);
6816
7327
  });
6817
7328
  }), this.querySelectorAll("[data-action=\"column-action\"]").forEach((e) => {
6818
7329
  e.addEventListener("click", () => {
6819
- let t = parseInt(e.getAttribute("data-row-index") || "0"), n = parseInt(e.getAttribute("data-column-key") || "0"), r = this._getRows()[t], i = this._configuration?.columns[n];
6820
- i && i.action && i.action.onClick(this, r);
7330
+ let t = parseInt(e.getAttribute("data-row-index") || "0"), n = parseInt(e.getAttribute("data-column-key") || "0"), r = this._getRowDataForEventIndex(t), i = this._configuration?.columns[n];
7331
+ i && i.action && r !== void 0 && i.action.onClick(this, r);
6821
7332
  });
6822
7333
  });
6823
7334
  }
@@ -6831,39 +7342,25 @@ var D = class extends HTMLElement {
6831
7342
  this._search = e.value || t.target.value || "", this._triggerSearch();
6832
7343
  });
6833
7344
  }
6834
- if (this._attachTableEventListeners(), this._attachRowClickHandler(), this.querySelectorAll("th[data-column-key]").forEach((e) => {
7345
+ this._attachTableEventListeners(), this._attachRowClickHandler(), this.querySelectorAll("th[data-column-key]").forEach((e) => {
6835
7346
  e.addEventListener("click", () => {
6836
7347
  let t = parseInt(e.getAttribute("data-column-key") || "0"), n = this._configuration?.columns[t];
6837
7348
  n && this._toggleSort(n);
6838
7349
  });
7350
+ }), this.querySelectorAll("[data-action=\"mobile-sort\"]").forEach((e) => {
7351
+ e.addEventListener("click", (t) => {
7352
+ t.stopPropagation();
7353
+ let n = parseInt(e.getAttribute("data-column-key") || "0", 10), r = this._configuration?.columns[n];
7354
+ r && (this._closeMobileSortPopover(), this._toggleSort(r));
7355
+ });
6839
7356
  }), this.querySelectorAll("[data-button-type]").forEach((e) => {
6840
7357
  e.addEventListener("click", () => {
6841
7358
  let t = e.getAttribute("data-button-type"), n = this._configuration?.buttons?.find((e) => (e.type || "custom") === t);
6842
7359
  n && this._handleButtonClick(n);
6843
7360
  });
6844
- }), this.querySelectorAll("mint-checkbox[data-column-key]").forEach((e) => {
6845
- e.addEventListener("change", (t) => {
6846
- t.stopPropagation();
6847
- let n = parseInt(e.getAttribute("data-column-key") || "0"), r = this._configuration?.columns[n];
6848
- r && this._columnChange(t, r);
6849
- }), e.addEventListener("click", (e) => {
6850
- e.stopPropagation();
6851
- });
6852
- }), this._attachPaginationListeners(), this.querySelectorAll("[data-action=\"load-more\"]").forEach((e) => {
6853
- e.addEventListener("click", () => {
6854
- this._loadMore();
6855
- });
6856
- }), this._configuration?.loadMore) {
6857
- this._scrollHandler && window.removeEventListener("scroll", this._scrollHandler);
6858
- let e = () => {
6859
- let e = window.pageYOffset || document.documentElement.scrollTop, t = window.innerHeight;
6860
- if (document.documentElement.scrollHeight - e - t <= 100) {
6861
- let e = this._type === "ajax" ? this._lastPage > 0 && this._currentPage < this._lastPage : this._totalRows > 0 && this._rowsToShow < this._totalRows;
6862
- !this._loading && !this._fetching && e && this._loadMore();
6863
- }
6864
- };
6865
- this._scrollHandler = e, window.addEventListener("scroll", e);
6866
- }
7361
+ }), this._attachPaginationListeners(), this._virtualScrollActive() && (this._type === "provided" || this._type === "ajax") && this._attachVirtualScrollListeners(), this._fixedHeader() && this._fixedControls() && queueMicrotask(() => {
7362
+ this._syncFixedControlsChromeHeight(), requestAnimationFrame(() => this._syncFixedControlsChromeHeight());
7363
+ });
6867
7364
  }
6868
7365
  _escapeHtml(e) {
6869
7366
  let t = document.createElement("div");
@@ -6889,8 +7386,161 @@ var D = class extends HTMLElement {
6889
7386
  };
6890
7387
  customElements.get("mint-resource-table") || customElements.define("mint-resource-table", D);
6891
7388
  //#endregion
7389
+ //#region src/components/resource-table/ResourceTableContextMenu.ts
7390
+ var O = 550, k = 12, A = { passive: !0 }, j = class extends HTMLElement {
7391
+ constructor(...e) {
7392
+ super(...e), this._table = null, this._anchor = null, this._popover = null, this._menuRoot = null, this._baseId = "", this._touchTimer = null, this._touchStart = null, this._slotObserver = null, this._scrollCloseTargets = [], this._onScrollClose = () => {
7393
+ this._closePopover();
7394
+ }, this._onContextMenu = (e) => {
7395
+ let t = e, n = this._rowTargetFromEventTarget(t.target);
7396
+ n && (t.preventDefault(), this._openAtRowIndex(n.index, t.clientX, t.clientY));
7397
+ }, this._onTouchStart = (e) => {
7398
+ let t = e;
7399
+ if (!t.touches.length) return;
7400
+ let n = this._rowTargetFromEventTarget(t.target);
7401
+ if (!n) return;
7402
+ let r = t.touches[0];
7403
+ this._touchStart = {
7404
+ x: r.clientX,
7405
+ y: r.clientY,
7406
+ rowIndex: n.index
7407
+ }, this._touchTimer !== null && (window.clearTimeout(this._touchTimer), this._touchTimer = null);
7408
+ let i = this._longPressMs();
7409
+ this._touchTimer = window.setTimeout(() => {
7410
+ this._touchTimer = null, this._touchStart &&= (this._openAtRowIndex(this._touchStart.rowIndex, this._touchStart.x, this._touchStart.y), null);
7411
+ }, i);
7412
+ }, this._onTouchMove = (e) => {
7413
+ if (!this._touchStart || this._touchTimer === null) return;
7414
+ let t = e.touches[0];
7415
+ if (!t) return;
7416
+ let n = t.clientX - this._touchStart.x, r = t.clientY - this._touchStart.y;
7417
+ n * n + r * r > k * k && (this._clearTouchTimer(), this._touchStart = null);
7418
+ }, this._onTouchEnd = () => {
7419
+ this._clearTouchTimer(), this._touchStart = null;
7420
+ };
7421
+ }
7422
+ static get observedAttributes() {
7423
+ return ["for", "long-press-ms"];
7424
+ }
7425
+ connectedCallback() {
7426
+ this.classList.add("contents"), this._baseId = this.id?.trim() || `mint-rt-ctx-${Math.random().toString(36).slice(2, 10)}`, this._anchor = document.createElement("div"), this._anchor.id = `${this._baseId}-anchor`, this._anchor.setAttribute("aria-hidden", "true"), this._anchor.className = "pointer-events-none fixed z-0 h-px w-px overflow-hidden p-0 m-0 border-0 opacity-0", document.body.appendChild(this._anchor), this._popover = document.createElement("mint-popover"), this._popover.setAttribute("data-mint-rt-ctx-internal", ""), this._popover.id = `${this._baseId}-popover`, this._popover.setAttribute("trigger-id", this._anchor.id), this._popover.setAttribute("direction", "down"), this._popover.setAttribute("padding", "0"), this._popover.setAttribute("distance", "6px"), this._menuRoot = document.createElement("div"), this._menuRoot.className = "flex min-w-[11rem] flex-col gap-0.5 py-1", this._popover.appendChild(this._menuRoot), this.appendChild(this._popover), this._slotObserver = new MutationObserver(() => {
7427
+ this._hideMenuSlotSources();
7428
+ }), this._slotObserver.observe(this, { childList: !0 }), queueMicrotask(() => {
7429
+ this._hideMenuSlotSources(), this._bindTable();
7430
+ });
7431
+ }
7432
+ disconnectedCallback() {
7433
+ this._slotObserver?.disconnect(), this._slotObserver = null, this._unbindTable(), this._anchor?.remove(), this._anchor = null, this._popover?.remove(), this._popover = null, this._menuRoot = null;
7434
+ }
7435
+ attributeChangedCallback() {
7436
+ this.isConnected && this._bindTable();
7437
+ }
7438
+ _longPressMs() {
7439
+ let e = parseInt(this.getAttribute("long-press-ms") || "", 10);
7440
+ return !Number.isNaN(e) && e > 100 ? e : O;
7441
+ }
7442
+ _resolveTable() {
7443
+ let e = this.getAttribute("for")?.trim();
7444
+ if (e) {
7445
+ let t = document.getElementById(e);
7446
+ return t && t.tagName === "MINT-RESOURCE-TABLE" ? t : null;
7447
+ }
7448
+ let t = this.previousElementSibling;
7449
+ return t && t.tagName === "MINT-RESOURCE-TABLE" ? t : this.parentElement?.querySelector?.("mint-resource-table") ?? null;
7450
+ }
7451
+ _hideMenuSlotSources() {
7452
+ for (let e of Array.from(this.children)) e === this._popover || e.hasAttribute("data-mint-rt-ctx-internal") || e.setAttribute("hidden", "");
7453
+ }
7454
+ _bindTable() {
7455
+ this._unbindTable(), this._table = this._resolveTable(), this._table && (this._table.addEventListener("contextmenu", this._onContextMenu, !0), this._table.addEventListener("touchstart", this._onTouchStart, { passive: !0 }), this._table.addEventListener("touchmove", this._onTouchMove, { passive: !0 }), this._table.addEventListener("touchend", this._onTouchEnd, { passive: !0 }), this._table.addEventListener("touchcancel", this._onTouchEnd, { passive: !0 }));
7456
+ }
7457
+ _unbindTable() {
7458
+ this._closePopover(), this._table &&= (this._table.removeEventListener("contextmenu", this._onContextMenu, !0), this._table.removeEventListener("touchstart", this._onTouchStart), this._table.removeEventListener("touchmove", this._onTouchMove), this._table.removeEventListener("touchend", this._onTouchEnd), this._table.removeEventListener("touchcancel", this._onTouchEnd), null);
7459
+ }
7460
+ _rowTargetFromEventTarget(e) {
7461
+ if (!e || !this._table) return null;
7462
+ let t = e.closest?.("tr[data-row-index], li[data-row-index]");
7463
+ if (!t || !this._table.contains(t) || t.hasAttribute("data-mint-rt-spacer") || t.getAttribute("data-mint-rt-placeholder") === "true") return null;
7464
+ let n = t.getAttribute("data-row-index");
7465
+ if (n == null) return null;
7466
+ let r = parseInt(n, 10);
7467
+ return Number.isNaN(r) ? null : { index: r };
7468
+ }
7469
+ _clearTouchTimer() {
7470
+ this._touchTimer !== null && (window.clearTimeout(this._touchTimer), this._touchTimer = null);
7471
+ }
7472
+ _positionAnchor(e, t) {
7473
+ this._anchor && (this._anchor.style.left = `${Math.round(e)}px`, this._anchor.style.top = `${Math.round(t)}px`);
7474
+ }
7475
+ _slotTemplateElements() {
7476
+ return Array.from(this.children).filter((e) => e !== this._popover && e instanceof HTMLElement && !e.hasAttribute("data-mint-rt-ctx-internal"));
7477
+ }
7478
+ _elementIsScrollContainer(e) {
7479
+ let t = getComputedStyle(e);
7480
+ return t.overflowX === "auto" || t.overflowX === "scroll" || t.overflowY === "auto" || t.overflowY === "scroll";
7481
+ }
7482
+ _collectScrollCloseTargets(e) {
7483
+ let t = [], n = /* @__PURE__ */ new Set(), r = (e) => {
7484
+ !e || n.has(e) || (n.add(e), t.push(e));
7485
+ };
7486
+ r(window), e.querySelectorAll("[id^=\"mint-rt-vscroll-\"]").forEach((e) => {
7487
+ this._elementIsScrollContainer(e) && r(e);
7488
+ });
7489
+ let i = e.querySelector("mint-table");
7490
+ for (; i && i !== e;) this._elementIsScrollContainer(i) && r(i), i = i.parentElement;
7491
+ return this._elementIsScrollContainer(e) && r(e), t;
7492
+ }
7493
+ _detachScrollCloseListeners() {
7494
+ for (let e of this._scrollCloseTargets) e.removeEventListener("scroll", this._onScrollClose, A);
7495
+ this._scrollCloseTargets = [];
7496
+ }
7497
+ _attachScrollCloseListeners(e) {
7498
+ this._detachScrollCloseListeners(), this._scrollCloseTargets = this._collectScrollCloseTargets(e);
7499
+ for (let e of this._scrollCloseTargets) e.addEventListener("scroll", this._onScrollClose, A);
7500
+ }
7501
+ _closePopover() {
7502
+ if (this._detachScrollCloseListeners(), !this._popover?.hasAttribute("open")) return;
7503
+ let e = this._popover;
7504
+ typeof e.close == "function" ? e.close() : this._popover.removeAttribute("open");
7505
+ }
7506
+ _openAtRowIndex(e, t, n) {
7507
+ this._closePopover();
7508
+ let r = this._resolveTable();
7509
+ if (!r || typeof r.getRowByIndex != "function" || !this._popover || !this._menuRoot) return;
7510
+ let i = this._popover, a = this._menuRoot, o = r.getRowByIndex(e);
7511
+ if (o === void 0) return;
7512
+ let s = this._slotTemplateElements();
7513
+ if (!s.length) return;
7514
+ this._positionAnchor(t, n), a.innerHTML = "", s.forEach((t) => {
7515
+ if (t.hasAttribute("data-mint-rt-ctx-if-selection") && !(window.getSelection?.()?.toString?.()?.trim() ?? "")) return;
7516
+ let n = t.cloneNode(!0);
7517
+ n.removeAttribute("hidden"), n.addEventListener("click", (t) => {
7518
+ t.stopPropagation();
7519
+ let r = n.getAttribute("data-context-action") || n.querySelector?.("[data-context-action]")?.getAttribute("data-context-action") || "", i = window.getSelection?.()?.toString?.()?.trim() ?? "";
7520
+ this.dispatchEvent(new CustomEvent("context-action", {
7521
+ bubbles: !0,
7522
+ composed: !0,
7523
+ detail: {
7524
+ action: r,
7525
+ row: o,
7526
+ rowIndex: e,
7527
+ selectedText: i
7528
+ }
7529
+ })), this._closePopover();
7530
+ }), a.appendChild(n);
7531
+ let r = n;
7532
+ typeof r.render == "function" && queueMicrotask(() => r.render());
7533
+ }), i.removeAttribute("open"), i.offsetHeight, i.setAttribute("open", "true");
7534
+ let c = i;
7535
+ typeof c.render == "function" && queueMicrotask(() => c.render());
7536
+ let l = this._resolveTable();
7537
+ l && this._attachScrollCloseListeners(l);
7538
+ }
7539
+ };
7540
+ customElements.get("mint-resource-table-context-menu") || customElements.define("mint-resource-table-context-menu", j);
7541
+ //#endregion
6892
7542
  //#region src/components/off-canvas/OffCanvas.ts
6893
- var O = class extends HTMLElement {
7543
+ var M = class extends HTMLElement {
6894
7544
  static get observedAttributes() {
6895
7545
  return [
6896
7546
  "id",
@@ -7052,10 +7702,10 @@ var O = class extends HTMLElement {
7052
7702
  }
7053
7703
  }
7054
7704
  };
7055
- customElements.get("mint-off-canvas") || customElements.define("mint-off-canvas", O);
7705
+ customElements.get("mint-off-canvas") || customElements.define("mint-off-canvas", M);
7056
7706
  //#endregion
7057
7707
  //#region src/components/tabs/Tab.ts
7058
- var k = class extends HTMLElement {
7708
+ var N = class extends HTMLElement {
7059
7709
  static get observedAttributes() {
7060
7710
  return [
7061
7711
  "active",
@@ -7119,10 +7769,10 @@ var k = class extends HTMLElement {
7119
7769
  })));
7120
7770
  }
7121
7771
  };
7122
- customElements.get("mint-tab") || customElements.define("mint-tab", k);
7772
+ customElements.get("mint-tab") || customElements.define("mint-tab", N);
7123
7773
  //#endregion
7124
7774
  //#region src/components/tabs/TabList.ts
7125
- var A = class extends HTMLElement {
7775
+ var P = class extends HTMLElement {
7126
7776
  static get observedAttributes() {
7127
7777
  return ["position"];
7128
7778
  }
@@ -7143,10 +7793,10 @@ var A = class extends HTMLElement {
7143
7793
  this.classList.remove("flex", "inline-flex", "flex-row", "flex-col", "gap-1", "gap-2", "pb-0", "pr-0", "pl-0", "mb-0", "mr-0", "ml-0", "self-start"), this.classList.add("box-border", "m-0", "p-1", "border", "bg-gray-100", "dark:bg-mint-elevated", "dark:border-mint-divider", "border-gray-200", "w-auto", "rounded-lg", "gap-2"), e === "top" ? this.classList.add("inline-flex", "flex-row", "mb-0", "self-start") : e === "left" ? this.classList.add("flex", "flex-col", "mr-0") : e === "right" && this.classList.add("flex", "flex-col", "ml-0");
7144
7794
  }
7145
7795
  };
7146
- customElements.get("mint-tab-list") || customElements.define("mint-tab-list", A);
7796
+ customElements.get("mint-tab-list") || customElements.define("mint-tab-list", P);
7147
7797
  //#endregion
7148
7798
  //#region src/components/tabs/TabContent.ts
7149
- var j = class extends HTMLElement {
7799
+ var F = class extends HTMLElement {
7150
7800
  static get observedAttributes() {
7151
7801
  return ["id"];
7152
7802
  }
@@ -7182,10 +7832,10 @@ var j = class extends HTMLElement {
7182
7832
  }
7183
7833
  render() {}
7184
7834
  };
7185
- customElements.get("mint-tab-content") || customElements.define("mint-tab-content", j);
7835
+ customElements.get("mint-tab-content") || customElements.define("mint-tab-content", F);
7186
7836
  //#endregion
7187
7837
  //#region src/components/tabs/Tabs.ts
7188
- var M = class extends HTMLElement {
7838
+ var I = class extends HTMLElement {
7189
7839
  constructor() {
7190
7840
  super(), this._tabClickHandler = null, this._mutationObserver = null;
7191
7841
  }
@@ -7263,10 +7913,10 @@ var M = class extends HTMLElement {
7263
7913
  }), n && this.showContent(n));
7264
7914
  }
7265
7915
  };
7266
- customElements.get("mint-tabs") || customElements.define("mint-tabs", M);
7916
+ customElements.get("mint-tabs") || customElements.define("mint-tabs", I);
7267
7917
  //#endregion
7268
7918
  //#region src/components/chart/Chart.ts
7269
- var N = class e extends HTMLElement {
7919
+ var L = class e extends HTMLElement {
7270
7920
  static get observedAttributes() {
7271
7921
  return [
7272
7922
  "type",
@@ -8488,10 +9138,10 @@ var N = class e extends HTMLElement {
8488
9138
  });
8489
9139
  }
8490
9140
  };
8491
- customElements.get("mint-chart") || customElements.define("mint-chart", N);
9141
+ customElements.get("mint-chart") || customElements.define("mint-chart", L);
8492
9142
  //#endregion
8493
9143
  //#region src/components/side-navigation/SideNavigationLink.ts
8494
- var P = class extends HTMLElement {
9144
+ var R = class extends HTMLElement {
8495
9145
  constructor(...e) {
8496
9146
  super(...e), this._trigger = null, this._submenuContainer = null;
8497
9147
  }
@@ -8592,10 +9242,10 @@ var P = class extends HTMLElement {
8592
9242
  this._hasSubmenu() && !this._isSubmenuItem() ? this._buildDropdownLink() : this._buildSimpleLink();
8593
9243
  }
8594
9244
  };
8595
- customElements.get("mint-sidenav-link") || customElements.define("mint-sidenav-link", P);
9245
+ customElements.get("mint-sidenav-link") || customElements.define("mint-sidenav-link", R);
8596
9246
  //#endregion
8597
9247
  //#region src/components/side-navigation/SideNavigationLinks.ts
8598
- var F = class extends HTMLElement {
9248
+ var z = class extends HTMLElement {
8599
9249
  constructor(...e) {
8600
9250
  super(...e), this._container = null, this._title = null, this._titleLabel = null, this._titleCaret = null, this._list = null, this._titleClickHandler = null, this._listenerCounts = /* @__PURE__ */ new Map();
8601
9251
  }
@@ -8674,10 +9324,10 @@ var F = class extends HTMLElement {
8674
9324
  });
8675
9325
  }
8676
9326
  };
8677
- customElements.get("mint-sidenav-links") || customElements.define("mint-sidenav-links", F);
9327
+ customElements.get("mint-sidenav-links") || customElements.define("mint-sidenav-links", z);
8678
9328
  //#endregion
8679
9329
  //#region src/components/side-navigation/SideNavigationActionLinks.ts
8680
- var I = class extends HTMLElement {
9330
+ var B = class extends HTMLElement {
8681
9331
  static get observedAttributes() {
8682
9332
  return ["separated"];
8683
9333
  }
@@ -8694,10 +9344,10 @@ var I = class extends HTMLElement {
8694
9344
  this.className = this._isSeparated() ? "block w-full mt-2 border-t border-gray-200 pt-2 px-2 pb-2 dark:border-mint-divider" : "block w-full p-2";
8695
9345
  }
8696
9346
  };
8697
- customElements.get("mint-sidenav-action-links") || customElements.define("mint-sidenav-action-links", I);
9347
+ customElements.get("mint-sidenav-action-links") || customElements.define("mint-sidenav-action-links", B);
8698
9348
  //#endregion
8699
9349
  //#region src/components/side-navigation/SideNavigationActionMenu.ts
8700
- var L = class extends HTMLElement {
9350
+ var V = class extends HTMLElement {
8701
9351
  constructor(...e) {
8702
9352
  super(...e), this._wrapper = null, this._trigger = null, this._popover = null, this._triggerId = "";
8703
9353
  }
@@ -8739,10 +9389,10 @@ var L = class extends HTMLElement {
8739
9389
  }) : a.appendChild(this._createDefaultGroup()), this._popover.appendChild(a), this._wrapper.appendChild(this._trigger), this._wrapper.appendChild(this._popover);
8740
9390
  }
8741
9391
  };
8742
- customElements.get("mint-sidenav-action-menu") || customElements.define("mint-sidenav-action-menu", L);
9392
+ customElements.get("mint-sidenav-action-menu") || customElements.define("mint-sidenav-action-menu", V);
8743
9393
  //#endregion
8744
9394
  //#region src/components/side-navigation/SideNavigation.ts
8745
- var R = class extends HTMLElement {
9395
+ var H = class extends HTMLElement {
8746
9396
  constructor(...e) {
8747
9397
  super(...e), this._backdrop = null, this._container = null, this._header = null, this._content = null, this._footer = null, this._escapeHandler = null, this._mediaQuery = null, this._mediaListener = null;
8748
9398
  }
@@ -8873,10 +9523,10 @@ var R = class extends HTMLElement {
8873
9523
  this._ensureBackdrop(), this._ensureContainer(), this._syncShell(), this._buildUserHeader(), this._buildContent(), this._buildFooter();
8874
9524
  }
8875
9525
  };
8876
- customElements.get("mint-side-navigation") || customElements.define("mint-side-navigation", R);
9526
+ customElements.get("mint-side-navigation") || customElements.define("mint-side-navigation", H);
8877
9527
  //#endregion
8878
9528
  //#region src/components/top-navigation/TopNavigation.ts
8879
- var z = class extends HTMLElement {
9529
+ var U = class extends HTMLElement {
8880
9530
  constructor(...e) {
8881
9531
  super(...e), this._bar = null, this._menuButton = null, this._logoLink = null, this._menuClickHandler = null, this._darkModeObserver = null, this._resizeHandler = null, this._desktopSearchInput = null, this._desktopSearchShell = null, this._mobileSearchButton = null, this._searchPanel = null, this._searchPanelInput = null, this._searchResultsWrap = null, this._searchStateWrap = null, this._searchDebounceId = null, this._searchAbortController = null, this._searchOpen = !1, this._searchQuery = "", this._globalKeydownHandler = null, this._docClickHandler = null;
8882
9532
  }
@@ -9148,10 +9798,10 @@ var z = class extends HTMLElement {
9148
9798
  this._searchPanelInput && (this._searchPanelInput.placeholder = this._getSearchPlaceholder()), this._syncSearchPanelVisibility(), this._positionSearchPanel();
9149
9799
  }
9150
9800
  };
9151
- customElements.get("mint-top-navigation") || customElements.define("mint-top-navigation", z);
9801
+ customElements.get("mint-top-navigation") || customElements.define("mint-top-navigation", U);
9152
9802
  //#endregion
9153
9803
  //#region src/components/search/Search.ts
9154
- var B = class e extends HTMLElement {
9804
+ var W = class e extends HTMLElement {
9155
9805
  constructor(...e) {
9156
9806
  super(...e), this._shell = null, this._desktopInput = null, this._panel = null, this._panelInner = null, this._panelInput = null, this._panelFiltersWrap = null, this._panelFiltersMainRow = null, this._panelFiltersChips = null, this._panelFiltersShowAllWrap = null, this._panelFiltersShowAllBtn = null, this._panelFiltersMorePanel = null, this._filtersMoreOpen = !1, this._filterOverflowObserver = null, this._filterOverflowZeroWidthRetries = 0, this._desktopFilterWrap = null, this._mobileFilterWrap = null, this._resultsWrap = null, this._stateWrap = null, this._customResultsWrap = null, this._query = "", this._searchOpen = !1, this._selectedFilters = [], this._selectedFilterBackspaceArmed = !1, this._debounceId = null, this._abortController = null, this._docPointerDownHandler = null, this._globalKeydownHandler = null, this._focusOutHandler = null, this._resizeHandler = null, this._desktopShortcutHint = null, this._panelSearchBar = null;
9157
9807
  }
@@ -9739,10 +10389,10 @@ var B = class e extends HTMLElement {
9739
10389
  this._shell && (this._shell.className = e ? "relative z-[91] hidden h-10 w-full min-[1100px]:flex" : "relative z-[91] flex h-10 w-full"), this._panelSearchBar && (this._panelSearchBar.className = e ? "flex shrink-0 items-center gap-2 border-b border-gray-200 p-3 dark:border-mint-divider min-[1100px]:hidden" : "hidden");
9740
10390
  }
9741
10391
  };
9742
- customElements.get("mint-search") || customElements.define("mint-search", B);
10392
+ customElements.get("mint-search") || customElements.define("mint-search", W);
9743
10393
  //#endregion
9744
10394
  //#region src/components/bottom-navigation/BottomNavigation.ts
9745
- var V = class extends HTMLElement {
10395
+ var G = class extends HTMLElement {
9746
10396
  constructor(...e) {
9747
10397
  super(...e), this._lastScrollY = 0, this._scrollHandler = null;
9748
10398
  }
@@ -9767,10 +10417,10 @@ var V = class extends HTMLElement {
9767
10417
  this._scrollHandler &&= (window.removeEventListener("scroll", this._scrollHandler), null);
9768
10418
  }
9769
10419
  };
9770
- customElements.get("mint-bottom-navigation") || customElements.define("mint-bottom-navigation", V);
10420
+ customElements.get("mint-bottom-navigation") || customElements.define("mint-bottom-navigation", G);
9771
10421
  //#endregion
9772
10422
  //#region src/components/bottom-navigation/BottomNavItem.ts
9773
- var H = class extends HTMLElement {
10423
+ var K = class extends HTMLElement {
9774
10424
  constructor(...e) {
9775
10425
  super(...e), this._root = null;
9776
10426
  }
@@ -9812,6 +10462,6 @@ var H = class extends HTMLElement {
9812
10462
  s.className = "block w-full truncate", s.textContent = t, a.appendChild(o), a.appendChild(s), this.replaceChildren(a), this._root = a;
9813
10463
  }
9814
10464
  };
9815
- customElements.get("mint-bottom-nav-item") || customElements.define("mint-bottom-nav-item", H);
10465
+ customElements.get("mint-bottom-nav-item") || customElements.define("mint-bottom-nav-item", K);
9816
10466
  //#endregion
9817
- export { E as Alert, l as BackButton, H as BottomNavItem, V as BottomNavigation, r as Button, r as default, s as Card, N as Chart, m as Checkbox, C as Chip, g as Choice, T as Clickable, v as DatePicker, b as Dropzone, x as Form, d as Grid, n as Icon, _ as Input, c as Link, f as Modal, O as OffCanvas, u as Page, p as Popover, D as ResourceTable, B as Search, y as Select, R as SideNavigation, I as SideNavigationActionLinks, L as SideNavigationActionMenu, P as SideNavigationLink, F as SideNavigationLinks, t as Spinner, o as Stack, i as Switch, k as Tab, j as TabContent, A as TabList, S as Table, M as Tabs, w as Tags, a as Text, z as TopNavigation };
10467
+ export { E as Alert, l as BackButton, K as BottomNavItem, G as BottomNavigation, r as Button, r as default, s as Card, L as Chart, m as Checkbox, C as Chip, g as Choice, T as Clickable, v as DatePicker, b as Dropzone, x as Form, d as Grid, n as Icon, _ as Input, c as Link, f as Modal, M as OffCanvas, u as Page, p as Popover, D as ResourceTable, W as Search, y as Select, H as SideNavigation, B as SideNavigationActionLinks, V as SideNavigationActionMenu, R as SideNavigationLink, z as SideNavigationLinks, t as Spinner, o as Stack, i as Switch, N as Tab, F as TabContent, P as TabList, S as Table, I as Tabs, w as Tags, a as Text, U as TopNavigation };