monobill-mintui 0.5.4 → 0.5.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/card/Card.d.ts.map +1 -1
- package/dist/components/chart/Chart.d.ts.map +1 -1
- package/dist/components/chip/Chip.d.ts +1 -0
- package/dist/components/chip/Chip.d.ts.map +1 -1
- package/dist/components/icon/icons/barcode.d.ts.map +1 -1
- package/dist/components/icon/icons/basket.d.ts.map +1 -1
- package/dist/components/icon/icons/check.d.ts.map +1 -1
- package/dist/components/icon/icons/close.d.ts.map +1 -1
- package/dist/components/icon/icons/desktop-screen.d.ts +3 -0
- package/dist/components/icon/icons/desktop-screen.d.ts.map +1 -0
- package/dist/components/icon/icons/globe.d.ts +3 -0
- package/dist/components/icon/icons/globe.d.ts.map +1 -0
- package/dist/components/icon/icons/index.cjs +3 -3
- package/dist/components/icon/icons/index.d.ts +2 -0
- package/dist/components/icon/icons/index.d.ts.map +1 -1
- package/dist/components/icon/icons/index.js +76 -53
- package/dist/components/icon/icons/plus.d.ts.map +1 -1
- package/dist/components/icon/icons/remove.d.ts.map +1 -1
- package/dist/components/input/Input.d.ts +8 -0
- package/dist/components/input/Input.d.ts.map +1 -1
- package/dist/components/popover/Popover.d.ts +2 -0
- package/dist/components/popover/Popover.d.ts.map +1 -1
- package/dist/components/search/Search.d.ts +117 -0
- package/dist/components/search/Search.d.ts.map +1 -0
- package/dist/components/search/index.d.ts +3 -0
- package/dist/components/search/index.d.ts.map +1 -0
- package/dist/components/top-navigation/TopNavigation.d.ts.map +1 -1
- package/dist/icons/basket.svg +3 -0
- package/dist/icons/building.svg +3 -0
- package/dist/icons/buildings.svg +3 -0
- package/dist/icons/bullhorn.svg +3 -0
- package/dist/icons/chart-bar.svg +3 -0
- package/dist/icons/chart-line.svg +3 -0
- package/dist/icons/desktop-screen.svg +3 -0
- package/dist/icons/dollar-sign.svg +2 -2
- package/dist/icons/eye.svg +3 -0
- package/dist/icons/globe.svg +3 -0
- package/dist/icons/line-chart.svg +3 -0
- package/dist/index.cjs +7 -7
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +646 -70
- package/dist/{search-Dva9OynX.js → search-CzN2cZZy.js} +6 -3
- package/dist/search-DDVJFS8d.cjs +1 -0
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/dist/search-IX9dFYhI.cjs +0 -1
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { m as e } from "./search-
|
|
1
|
+
import { m as e } from "./search-CzN2cZZy.js";
|
|
2
2
|
//#region src/components/spinner/Spinner.ts
|
|
3
3
|
var t = class extends HTMLElement {
|
|
4
4
|
static get observedAttributes() {
|
|
@@ -1227,7 +1227,7 @@ var s = class extends HTMLElement {
|
|
|
1227
1227
|
return Array.from(this.classList).some((e) => /^p-\d+|^px-|^py-|^pt-|^pb-|^pl-|^pr-/.test(e));
|
|
1228
1228
|
}
|
|
1229
1229
|
render() {
|
|
1230
|
-
this.classList.add("rounded-lg", "shadow", "bg-white", "dark:bg-mint-elevated", "border", "border-gray-200", "dark:border-mint-divider"
|
|
1230
|
+
this.classList.add("rounded-lg", "shadow", "bg-white", "dark:bg-mint-elevated", "border", "border-gray-200", "dark:border-mint-divider"), this.hasPaddingClass() || this.classList.add("p-4");
|
|
1231
1231
|
let e = this.getHeading();
|
|
1232
1232
|
e ? (this._headingElement || (this._headingElement = document.createElement("mint-text"), this._headingElement.setAttribute("size", "sub-heading"), this.insertBefore(this._headingElement, this.firstChild)), this._headingElement.textContent = e) : this._headingElement && this._headingElement.parentNode && (this._headingElement.remove(), this._headingElement = null);
|
|
1233
1233
|
}
|
|
@@ -1406,7 +1406,7 @@ var u = class extends HTMLElement {
|
|
|
1406
1406
|
}), this._updateBackgroundColor();
|
|
1407
1407
|
}
|
|
1408
1408
|
_applyContainerClasses() {
|
|
1409
|
-
this._pageContainer && (this._pageContainer.classList.add("p-
|
|
1409
|
+
this._pageContainer && (this._pageContainer.classList.add("p-5"), this.getAttribute("containered") === "true" ? this._pageContainer.classList.add("max-w-6xl", "mx-auto", "w-full") : this._pageContainer.classList.remove("max-w-6xl", "mx-auto", "w-full"));
|
|
1410
1410
|
}
|
|
1411
1411
|
_updateBackgroundColor() {
|
|
1412
1412
|
this._pageContainer && (document.documentElement.classList.contains("dark") ? (this._pageContainer.classList.remove("bg-gray-20"), this._pageContainer.classList.add("bg-mint-canvas")) : (this._pageContainer.classList.remove("bg-mint-canvas"), this._pageContainer.classList.add("bg-gray-20")));
|
|
@@ -1603,7 +1603,8 @@ var p = class extends HTMLElement {
|
|
|
1603
1603
|
"open",
|
|
1604
1604
|
"trigger-id",
|
|
1605
1605
|
"padding",
|
|
1606
|
-
"hover"
|
|
1606
|
+
"hover",
|
|
1607
|
+
"distance"
|
|
1607
1608
|
];
|
|
1608
1609
|
}
|
|
1609
1610
|
constructor() {
|
|
@@ -1671,6 +1672,21 @@ var p = class extends HTMLElement {
|
|
|
1671
1672
|
getTriggerId() {
|
|
1672
1673
|
return this.getAttribute("trigger-id") || "";
|
|
1673
1674
|
}
|
|
1675
|
+
getDistance() {
|
|
1676
|
+
return (this.getAttribute("distance") || "").trim();
|
|
1677
|
+
}
|
|
1678
|
+
_getDistancePx() {
|
|
1679
|
+
let e = this.getDistance();
|
|
1680
|
+
if (!e) return 8;
|
|
1681
|
+
let t = e.match(/^(-?\d*\.?\d+)\s*(px|rem)$/i);
|
|
1682
|
+
if (!t) return 8;
|
|
1683
|
+
let n = parseFloat(t[1]), r = t[2].toLowerCase();
|
|
1684
|
+
if (!Number.isFinite(n)) return 8;
|
|
1685
|
+
let i = Math.max(0, n);
|
|
1686
|
+
if (r === "px") return i;
|
|
1687
|
+
let a = parseFloat(getComputedStyle(document.documentElement).fontSize || "16");
|
|
1688
|
+
return i * (Number.isFinite(a) ? a : 16);
|
|
1689
|
+
}
|
|
1674
1690
|
isHoverEnabled() {
|
|
1675
1691
|
return this.getAttribute("hover") === "true";
|
|
1676
1692
|
}
|
|
@@ -1741,41 +1757,41 @@ var p = class extends HTMLElement {
|
|
|
1741
1757
|
direction: "down"
|
|
1742
1758
|
};
|
|
1743
1759
|
this.classList.contains("hidden") && (this.classList.remove("hidden"), this._popover.style.visibility = "hidden");
|
|
1744
|
-
let n = t.getBoundingClientRect(), r = window.innerWidth, i = window.innerHeight, a = this.
|
|
1745
|
-
switch (
|
|
1760
|
+
let n = t.getBoundingClientRect(), r = window.innerWidth, i = window.innerHeight, a = this._getDistancePx(), o = this.getDirection(), s = 0, c = 0;
|
|
1761
|
+
switch (o) {
|
|
1746
1762
|
case "down":
|
|
1747
|
-
if (
|
|
1748
|
-
let t = e.top - n.height -
|
|
1749
|
-
t >= 0 ? (
|
|
1763
|
+
if (s = e.bottom + a, c = e.left + e.width / 2 - n.width / 2, s + n.height > i) {
|
|
1764
|
+
let t = e.top - n.height - a;
|
|
1765
|
+
t >= 0 ? (o = "up", s = t) : (s = Math.max(0, i - n.height - a), s + n.height > i && (s = 0));
|
|
1750
1766
|
}
|
|
1751
|
-
|
|
1767
|
+
c < 0 && (c = a), c + n.width > r && (c = Math.max(a, r - n.width - a), c + n.width > r && (c = r - n.width));
|
|
1752
1768
|
break;
|
|
1753
1769
|
case "up":
|
|
1754
|
-
if (
|
|
1755
|
-
let t = e.bottom +
|
|
1756
|
-
t + n.height <= i ? (
|
|
1770
|
+
if (s = e.top - n.height - a, c = e.left + e.width / 2 - n.width / 2, s < 0) {
|
|
1771
|
+
let t = e.bottom + a;
|
|
1772
|
+
t + n.height <= i ? (o = "down", s = t) : (s = Math.min(i - n.height - a, i - n.height), s < 0 && (s = i - n.height));
|
|
1757
1773
|
}
|
|
1758
|
-
|
|
1774
|
+
c < 0 && (c = a), c + n.width > r && (c = Math.max(a, r - n.width - a), c + n.width > r && (c = r - n.width));
|
|
1759
1775
|
break;
|
|
1760
1776
|
case "right":
|
|
1761
|
-
if (
|
|
1762
|
-
let t = e.left - n.width -
|
|
1763
|
-
t >= 0 ? (
|
|
1777
|
+
if (s = e.top + e.height / 2 - n.height / 2, c = e.right + a, c + n.width > r) {
|
|
1778
|
+
let t = e.left - n.width - a;
|
|
1779
|
+
t >= 0 ? (o = "left", c = t) : (c = Math.max(0, r - n.width - a), c + n.width > r && (c = r - n.width));
|
|
1764
1780
|
}
|
|
1765
|
-
|
|
1781
|
+
s < 0 && (s = a), s + n.height > i && (s = Math.max(a, i - n.height - a), s + n.height > i && (s = i - n.height));
|
|
1766
1782
|
break;
|
|
1767
1783
|
case "left":
|
|
1768
|
-
if (
|
|
1769
|
-
let t = e.right +
|
|
1770
|
-
t + n.width <= r ? (
|
|
1784
|
+
if (s = e.top + e.height / 2 - n.height / 2, c = e.left - n.width - a, c < 0) {
|
|
1785
|
+
let t = e.right + a;
|
|
1786
|
+
t + n.width <= r ? (o = "right", c = t) : (c = Math.min(r - n.width - a, r - n.width), c < 0 && (c = 0));
|
|
1771
1787
|
}
|
|
1772
|
-
|
|
1788
|
+
s < 0 && (s = a), s + n.height > i && (s = Math.max(a, i - n.height - a), s + n.height > i && (s = i - n.height));
|
|
1773
1789
|
break;
|
|
1774
1790
|
}
|
|
1775
1791
|
return {
|
|
1776
|
-
top:
|
|
1777
|
-
left:
|
|
1778
|
-
direction:
|
|
1792
|
+
top: s,
|
|
1793
|
+
left: c,
|
|
1794
|
+
direction: o
|
|
1779
1795
|
};
|
|
1780
1796
|
}
|
|
1781
1797
|
render() {
|
|
@@ -2587,13 +2603,13 @@ var _ = class extends HTMLElement {
|
|
|
2587
2603
|
];
|
|
2588
2604
|
}
|
|
2589
2605
|
constructor() {
|
|
2590
|
-
super(), this._input = null, this._textarea = null, this._element = null, this._wrapper = null, this._icon = null, this._colorPicker = null, this._colorTextInput = null, this._colorContainer = null, this._colorPickerWrapper = null, this._numberSpinnerContainer = null, this._numberIncrementButton = null, this._numberDecrementButton = null, this._focusHandler = null, this._blurHandler = null, this._clickHandler = null, this._clickOutsideHandler = null;
|
|
2606
|
+
super(), this._input = null, this._textarea = null, this._element = null, this._wrapper = null, this._icon = null, this._prependSlotContainer = null, this._appendSlotContainer = null, this._colorPicker = null, this._colorTextInput = null, this._colorContainer = null, this._colorPickerWrapper = null, this._numberSpinnerContainer = null, this._numberIncrementButton = null, this._numberDecrementButton = null, this._slotResizeObserver = null, this._slotMutationObserver = null, this._focusHandler = null, this._blurHandler = null, this._clickHandler = null, this._clickOutsideHandler = null;
|
|
2591
2607
|
}
|
|
2592
2608
|
connectedCallback() {
|
|
2593
2609
|
this.classList.add("box-border", "m-0", "p-0", "border-0", "align-baseline", "inline-block"), this.render();
|
|
2594
2610
|
}
|
|
2595
2611
|
disconnectedCallback() {
|
|
2596
|
-
this.removeEventListeners();
|
|
2612
|
+
this.removeEventListeners(), this._slotResizeObserver &&= (this._slotResizeObserver.disconnect(), null), this._slotMutationObserver &&= (this._slotMutationObserver.disconnect(), null);
|
|
2597
2613
|
}
|
|
2598
2614
|
attributeChangedCallback(e, t, n) {
|
|
2599
2615
|
if (t !== n) {
|
|
@@ -2635,7 +2651,7 @@ var _ = class extends HTMLElement {
|
|
|
2635
2651
|
return this.getAttribute("placeholder") || "";
|
|
2636
2652
|
}
|
|
2637
2653
|
getValue() {
|
|
2638
|
-
return this._isColor() ? this.
|
|
2654
|
+
return this._isColor() ? this._colorTextInput ? this._colorTextInput.value : this._colorPicker ? this._colorPicker.value : this.getAttribute("value") || "#000000" : this._element ? this._element.value : this.getAttribute("value") || "";
|
|
2639
2655
|
}
|
|
2640
2656
|
set value(e) {
|
|
2641
2657
|
try {
|
|
@@ -2680,13 +2696,14 @@ var _ = class extends HTMLElement {
|
|
|
2680
2696
|
return this.getAttribute("info") || "";
|
|
2681
2697
|
}
|
|
2682
2698
|
getInputClasses() {
|
|
2683
|
-
let e = this._isTextarea(), t = !!this.getIcon(), n = this.
|
|
2699
|
+
let e = this._isTextarea(), t = !!this.getIcon(), n = this.querySelector("[slot=\"prepend\"]") !== null, r = this.querySelector("[slot=\"append\"]") !== null, i = this._isColor(), a = this._isNumber(), o = this.hasError(), s = [
|
|
2684
2700
|
"w-full",
|
|
2685
|
-
t || n ? "pl-10" : "px-3.5",
|
|
2686
|
-
t ||
|
|
2701
|
+
t || i || n ? "pl-10" : "px-3.5",
|
|
2702
|
+
r ? "pr-10" : t || i ? "pr-3.5" : a ? "pr-10" : "",
|
|
2687
2703
|
e ? "py-2" : "py-1.5",
|
|
2688
2704
|
e ? "min-h-[6rem]" : "min-h-[2rem]",
|
|
2689
|
-
"text-
|
|
2705
|
+
"text-base",
|
|
2706
|
+
"min-[1100px]:text-sm",
|
|
2690
2707
|
"font-medium",
|
|
2691
2708
|
"rounded-lg",
|
|
2692
2709
|
"box-border",
|
|
@@ -2700,18 +2717,59 @@ var _ = class extends HTMLElement {
|
|
|
2700
2717
|
"disabled:cursor-not-allowed",
|
|
2701
2718
|
"readonly:cursor-default",
|
|
2702
2719
|
e ? "resize-y" : "",
|
|
2703
|
-
|
|
2704
|
-
],
|
|
2720
|
+
a ? "[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none" : ""
|
|
2721
|
+
], c = ["border-2", o ? "border-red-300 dark:border-red-300" : "border-gray-200 dark:border-mint-divider"], l = [
|
|
2705
2722
|
"focus-visible:ring-2",
|
|
2706
2723
|
"focus-visible:ring-offset-1",
|
|
2707
|
-
|
|
2724
|
+
o ? "focus-visible:ring-red-400 dark:focus-visible:ring-red-500" : "focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500"
|
|
2708
2725
|
];
|
|
2709
2726
|
return [
|
|
2710
|
-
...
|
|
2711
|
-
...
|
|
2712
|
-
...
|
|
2727
|
+
...s,
|
|
2728
|
+
...c,
|
|
2729
|
+
...l
|
|
2713
2730
|
].filter(Boolean).join(" ");
|
|
2714
2731
|
}
|
|
2732
|
+
_syncSlotAdornments(e, t) {
|
|
2733
|
+
if (!this._wrapper || e || this._isColor()) {
|
|
2734
|
+
this._prependSlotContainer &&= (this._prependSlotContainer.remove(), null), this._appendSlotContainer &&= (this._appendSlotContainer.remove(), null), this._clearAdornmentPadding();
|
|
2735
|
+
return;
|
|
2736
|
+
}
|
|
2737
|
+
this._prependSlotContainer || (this._prependSlotContainer = document.createElement("div"), this._prependSlotContainer.className = "mint-input-prepend-slot absolute top-1/2 z-[1] flex -translate-y-1/2 items-center gap-1.5 text-gray-500 dark:text-gray-400 pointer-events-auto", this._wrapper.appendChild(this._prependSlotContainer)), this._appendSlotContainer || (this._appendSlotContainer = document.createElement("div"), this._appendSlotContainer.className = "mint-input-append-slot absolute right-3 top-1/2 z-[1] flex -translate-y-1/2 items-center gap-1.5 text-gray-500 dark:text-gray-400 pointer-events-auto", this._wrapper.appendChild(this._appendSlotContainer)), this._prependSlotContainer.classList.remove("left-3", "left-10"), this._prependSlotContainer.classList.add(t ? "left-10" : "left-3");
|
|
2738
|
+
let n = Array.from(this.querySelectorAll("[slot=\"prepend\"]")), r = Array.from(this.querySelectorAll("[slot=\"append\"]"));
|
|
2739
|
+
this._prependSlotContainer.replaceChildren(), this._appendSlotContainer.replaceChildren(), n.forEach((e) => this._prependSlotContainer.appendChild(e)), r.forEach((e) => this._appendSlotContainer.appendChild(e)), this._prependSlotContainer.classList.toggle("hidden", n.length === 0), this._appendSlotContainer.classList.toggle("hidden", r.length === 0), this._ensureSlotObservers(), this._applyAdornmentPadding(t);
|
|
2740
|
+
}
|
|
2741
|
+
_clearAdornmentPadding() {
|
|
2742
|
+
this._element && (this._element.style.removeProperty("padding-left"), this._element.style.removeProperty("padding-right")), this._colorTextInput && (this._colorTextInput.style.removeProperty("padding-left"), this._colorTextInput.style.removeProperty("padding-right"));
|
|
2743
|
+
}
|
|
2744
|
+
_applyAdornmentPadding(e) {
|
|
2745
|
+
this._element && requestAnimationFrame(() => {
|
|
2746
|
+
if (this._element) {
|
|
2747
|
+
if (this._prependSlotContainer && !this._prependSlotContainer.classList.contains("hidden")) {
|
|
2748
|
+
let t = (e ? 40 : 12) + this._prependSlotContainer.offsetWidth + 8;
|
|
2749
|
+
this._element.style.paddingLeft = `${t}px`;
|
|
2750
|
+
} else this._element.style.removeProperty("padding-left");
|
|
2751
|
+
if (this._appendSlotContainer && !this._appendSlotContainer.classList.contains("hidden")) {
|
|
2752
|
+
let e = 12 + this._appendSlotContainer.offsetWidth + 8;
|
|
2753
|
+
this._element.style.paddingRight = `${e}px`;
|
|
2754
|
+
} else this._element.style.removeProperty("padding-right");
|
|
2755
|
+
}
|
|
2756
|
+
});
|
|
2757
|
+
}
|
|
2758
|
+
_ensureSlotObservers() {
|
|
2759
|
+
!this._prependSlotContainer && !this._appendSlotContainer || (this._slotResizeObserver ||= new ResizeObserver(() => {
|
|
2760
|
+
this._applyAdornmentPadding(!!this.getIcon());
|
|
2761
|
+
}), this._slotResizeObserver.disconnect(), this._prependSlotContainer && this._slotResizeObserver.observe(this._prependSlotContainer), this._appendSlotContainer && this._slotResizeObserver.observe(this._appendSlotContainer), this._slotMutationObserver ||= new MutationObserver(() => {
|
|
2762
|
+
this._applyAdornmentPadding(!!this.getIcon());
|
|
2763
|
+
}), this._slotMutationObserver.disconnect(), this._prependSlotContainer && this._slotMutationObserver.observe(this._prependSlotContainer, {
|
|
2764
|
+
childList: !0,
|
|
2765
|
+
subtree: !0,
|
|
2766
|
+
characterData: !0
|
|
2767
|
+
}), this._appendSlotContainer && this._slotMutationObserver.observe(this._appendSlotContainer, {
|
|
2768
|
+
childList: !0,
|
|
2769
|
+
subtree: !0,
|
|
2770
|
+
characterData: !0
|
|
2771
|
+
}));
|
|
2772
|
+
}
|
|
2715
2773
|
isLoading() {
|
|
2716
2774
|
return this.getAttribute("loading") === "true";
|
|
2717
2775
|
}
|
|
@@ -2779,7 +2837,7 @@ var _ = class extends HTMLElement {
|
|
|
2779
2837
|
} else t && t.remove();
|
|
2780
2838
|
return;
|
|
2781
2839
|
}
|
|
2782
|
-
if (this._wrapper || (this._wrapper = document.createElement("div"), this._wrapper.className = "relative w-full", this.appendChild(this._wrapper)), this._colorContainer && (this._colorContainer.remove(), this._colorContainer = null, this._colorPicker = null, this._colorTextInput = null), this._colorPickerWrapper && !r && (this._colorPickerWrapper.remove(), this._colorPickerWrapper = null, this._colorPicker = null, this._colorTextInput = null), f && !t ? this._icon ? this._icon.setAttribute("name", f) : (this._icon = document.createElement("mint-icon"), this._icon.setAttribute("name", f), this._icon.className = "absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400 dark:text-gray-500 pointer-events-none", this._wrapper.appendChild(this._icon)) : this._icon &&= (this._icon.remove(), null), this._isNumber() && !t) {
|
|
2840
|
+
if (this._wrapper || (this._wrapper = document.createElement("div"), this._wrapper.className = "relative w-full", this.appendChild(this._wrapper)), this._colorContainer && (this._colorContainer.remove(), this._colorContainer = null, this._colorPicker = null, this._colorTextInput = null), this._colorPickerWrapper && !r && (this._colorPickerWrapper.remove(), this._colorPickerWrapper = null, this._colorPicker = null, this._colorTextInput = null), f && !t ? this._icon ? this._icon.setAttribute("name", f) : (this._icon = document.createElement("mint-icon"), this._icon.setAttribute("name", f), this._icon.className = "absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400 dark:text-gray-500 pointer-events-none", this._wrapper.appendChild(this._icon)) : this._icon &&= (this._icon.remove(), null), this._syncSlotAdornments(t, !!f), this._isNumber() && !t) {
|
|
2783
2841
|
if (!this._numberSpinnerContainer) {
|
|
2784
2842
|
this._numberSpinnerContainer = document.createElement("div"), this._numberSpinnerContainer.className = "absolute right-1 top-1/2 -translate-y-1/2 flex flex-col h-8 pointer-events-none", this._wrapper.appendChild(this._numberSpinnerContainer), this._numberIncrementButton = document.createElement("button"), this._numberIncrementButton.type = "button", this._numberIncrementButton.className = "flex items-center justify-center w-5 h-4 text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 disabled:opacity-40 disabled:cursor-not-allowed pointer-events-auto bg-gray-100 dark:bg-mint-hover active:bg-gray-200 dark:active:bg-mint-elevated rounded";
|
|
2785
2843
|
let e = document.createElement("mint-icon");
|
|
@@ -2825,7 +2883,7 @@ var _ = class extends HTMLElement {
|
|
|
2825
2883
|
let t = g.querySelector(".mint-input-info");
|
|
2826
2884
|
m ? (t || (t = document.createElement("span"), t.className = "mint-input-info text-xs text-gray-500 dark:text-gray-400 select-none", g.appendChild(t)), t.textContent = m, a ? t.classList.add("opacity-40") : t.classList.remove("opacity-40")) : t && t.remove();
|
|
2827
2885
|
} else g && g.remove();
|
|
2828
|
-
this._renderErrorState(), this._renderSkeleton(h);
|
|
2886
|
+
this._syncSlotAdornments(t, !!f), this._renderErrorState(), this._renderSkeleton(h);
|
|
2829
2887
|
}
|
|
2830
2888
|
_renderErrorState() {
|
|
2831
2889
|
let e = this.hasError(), t = this.getErrorMessage(), n = this.querySelector(".mint-input-error");
|
|
@@ -5685,7 +5743,8 @@ var C = class extends HTMLElement {
|
|
|
5685
5743
|
}
|
|
5686
5744
|
this._root.appendChild(this._textWrap), this.appendChild(this._root);
|
|
5687
5745
|
}
|
|
5688
|
-
this.getAttribute("dismissable")
|
|
5746
|
+
let e = this.getAttribute("dismissable");
|
|
5747
|
+
e === "" || e === "true" || this.hasAttribute("dismissable") ? (this._dismissBtn || this._createDismissBtn(), this._dismissBtn && !this._dismissBtn.isConnected && this._root?.appendChild(this._dismissBtn)) : this._dismissBtn && this._dismissBtn.parentElement === this._root && this._dismissBtn.remove();
|
|
5689
5748
|
}
|
|
5690
5749
|
_createDismissBtn() {
|
|
5691
5750
|
let e = document.createElement("button");
|
|
@@ -5712,10 +5771,13 @@ var C = class extends HTMLElement {
|
|
|
5712
5771
|
].join(" ");
|
|
5713
5772
|
let t = document.createElement("mint-icon");
|
|
5714
5773
|
t.setAttribute("name", "close"), t.className = "w-3 h-3", e.appendChild(t), this._clickHandler = (e) => {
|
|
5715
|
-
e.stopPropagation(), this.dispatchEvent(new CustomEvent("
|
|
5774
|
+
e.stopPropagation(), this.dispatchEvent(new CustomEvent("dismiss", {
|
|
5716
5775
|
bubbles: !0,
|
|
5717
5776
|
composed: !0
|
|
5718
|
-
}))
|
|
5777
|
+
})), this.dispatchEvent(new CustomEvent("dismissed", {
|
|
5778
|
+
bubbles: !0,
|
|
5779
|
+
composed: !0
|
|
5780
|
+
})), this.remove();
|
|
5719
5781
|
}, e.addEventListener("click", this._clickHandler), this._dismissBtn = e;
|
|
5720
5782
|
}
|
|
5721
5783
|
};
|
|
@@ -7236,14 +7298,14 @@ var N = class e extends HTMLElement {
|
|
|
7236
7298
|
values: null,
|
|
7237
7299
|
dataHash: ""
|
|
7238
7300
|
}, this._renderScheduled = !1, this._datasetVisibility = /* @__PURE__ */ new Map(), this._widthValue = "100%", this._heightValue = 400, this._defaultColors = [
|
|
7239
|
-
"#
|
|
7240
|
-
"#
|
|
7241
|
-
"#
|
|
7242
|
-
"#
|
|
7243
|
-
"#
|
|
7244
|
-
"#
|
|
7245
|
-
"#
|
|
7246
|
-
"#
|
|
7301
|
+
"#2563eb",
|
|
7302
|
+
"#3b82f6",
|
|
7303
|
+
"#0d9488",
|
|
7304
|
+
"#7c3aed",
|
|
7305
|
+
"#d97706",
|
|
7306
|
+
"#059669",
|
|
7307
|
+
"#dc2626",
|
|
7308
|
+
"#c026d3"
|
|
7247
7309
|
], this._legendHeight = 0, this._rotatedLabelHeight = 0;
|
|
7248
7310
|
}
|
|
7249
7311
|
connectedCallback() {
|
|
@@ -8124,7 +8186,7 @@ var N = class e extends HTMLElement {
|
|
|
8124
8186
|
let i = this._getDatasetColor(t, r), a = -f / 2 + (u + d) * p;
|
|
8125
8187
|
p++, t.data.forEach((o) => {
|
|
8126
8188
|
let s = this._scaleXForBarChart(o.x, e), c = this._scaleY(o.y, e), l = e.y + e.height - c, d = s + a, f = document.createElementNS("http://www.w3.org/2000/svg", "rect");
|
|
8127
|
-
f.setAttribute("x", d.toString()), f.setAttribute("y", c.toString()), f.setAttribute("width", u.toString()), f.setAttribute("height", l.toString()), f.setAttribute("fill", i), f.setAttribute("rx", "2"), f.setAttribute("class", "chart-bar"), f.setAttribute("data-dataset", r.toString()), f.setAttribute("data-x", String(o.x)), f.setAttribute("data-y", o.y.toString()), f.setAttribute("data-name", t.name), f.style.cursor = "pointer", this._showTooltip &&
|
|
8189
|
+
f.setAttribute("x", d.toString()), f.setAttribute("y", c.toString()), f.setAttribute("width", u.toString()), f.setAttribute("height", l.toString()), f.setAttribute("fill", i), f.setAttribute("rx", "2"), f.setAttribute("class", "chart-bar"), f.setAttribute("data-dataset", r.toString()), f.setAttribute("data-x", String(o.x)), f.setAttribute("data-y", o.y.toString()), f.setAttribute("data-name", t.name), f.style.cursor = "pointer", this._showTooltip && f.addEventListener("mouseenter", (e) => {
|
|
8128
8190
|
let t = this._getAllDatasetsAtX(o.x), n = `<strong>${o.x}</strong><br/>`;
|
|
8129
8191
|
t.forEach((e) => {
|
|
8130
8192
|
n += `<div style="display: flex; align-items: center; gap: 6px; margin-top: 4px;">
|
|
@@ -8132,9 +8194,7 @@ var N = class e extends HTMLElement {
|
|
|
8132
8194
|
<span>${e.name}: ${e.formattedValue}</span>
|
|
8133
8195
|
</div>`;
|
|
8134
8196
|
}), this._showTooltipAt(e.clientX, e.clientY, n);
|
|
8135
|
-
}),
|
|
8136
|
-
this._hideTooltip();
|
|
8137
|
-
})), n.appendChild(f);
|
|
8197
|
+
}), n.appendChild(f);
|
|
8138
8198
|
});
|
|
8139
8199
|
}), t.appendChild(n), this._svg.appendChild(t);
|
|
8140
8200
|
}
|
|
@@ -9041,25 +9101,25 @@ var z = class extends HTMLElement {
|
|
|
9041
9101
|
let e = document.createElement("span");
|
|
9042
9102
|
e.className = "text-sm font-semibold text-gray-400 dark:text-gray-500", e.textContent = "Logo", this._logoLink.appendChild(e);
|
|
9043
9103
|
}
|
|
9044
|
-
let n = this.
|
|
9045
|
-
if (
|
|
9104
|
+
let n = Array.from(this.querySelectorAll("[slot=\"center\"]")), r = n.length > 0, i = this._isSearchEnabled() && !r, a = this._bar.querySelector("[data-mint-topnav-center]");
|
|
9105
|
+
if (a || (a = document.createElement("div"), a.setAttribute("data-mint-topnav-center", "true"), this._bar.appendChild(a)), a.className = r ? "min-w-0 flex-1 px-2 min-[1100px]:flex min-[1100px]:justify-center min-[1100px]:px-4" : "max-[1099.98px]:hidden min-[1100px]:flex min-[1100px]:min-w-0 min-[1100px]:flex-1 min-[1100px]:justify-center min-[1100px]:px-4", a.classList.toggle("min-[1100px]:hidden", !i && !r), r && (a.replaceChildren(...n), this._closeSearch()), i && !this._desktopSearchInput) {
|
|
9046
9106
|
let e = document.createElement("div");
|
|
9047
9107
|
e.className = "relative w-full max-w-xl rounded-xl border border-gray-300 bg-gray-50 px-3 py-2 dark:border-mint-divider dark:bg-mint-hover", this._desktopSearchShell = e;
|
|
9048
9108
|
let t = document.createElement("mint-icon");
|
|
9049
9109
|
t.setAttribute("name", "search"), t.className = "absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-gray-500 dark:text-gray-400", this._desktopSearchInput = document.createElement("input"), this._desktopSearchInput.type = "search", this._desktopSearchInput.className = "w-full bg-transparent pl-6 pr-20 text-sm text-gray-900 outline-none placeholder:text-gray-500 dark:text-gray-100 dark:placeholder:text-gray-400", this._desktopSearchInput.placeholder = this._getSearchPlaceholder(), this._desktopSearchInput.addEventListener("focus", () => this._openSearch(!1)), this._desktopSearchInput.addEventListener("input", (e) => this._scheduleSearch(e.target.value));
|
|
9050
9110
|
let n = document.createElement("span");
|
|
9051
|
-
n.className = "absolute right-3 top-1/2 -translate-y-1/2 text-xs text-gray-500 dark:text-gray-400", n.textContent = "⌘K", e.appendChild(t), e.appendChild(this._desktopSearchInput), e.appendChild(n),
|
|
9111
|
+
n.className = "absolute right-3 top-1/2 -translate-y-1/2 text-xs text-gray-500 dark:text-gray-400", n.textContent = "⌘K", e.appendChild(t), e.appendChild(this._desktopSearchInput), e.appendChild(n), a.appendChild(e);
|
|
9052
9112
|
}
|
|
9053
|
-
this._desktopSearchInput && (this._desktopSearchInput.placeholder = this._getSearchPlaceholder(), this._desktopSearchShell = this._desktopSearchInput.closest("div"), this._syncDesktopSearchOpenState());
|
|
9054
|
-
let
|
|
9055
|
-
|
|
9056
|
-
let
|
|
9057
|
-
if (
|
|
9113
|
+
i && this._desktopSearchInput && (this._desktopSearchInput.placeholder = this._getSearchPlaceholder(), this._desktopSearchShell = this._desktopSearchInput.closest("div"), this._syncDesktopSearchOpenState());
|
|
9114
|
+
let o = this._bar.querySelector("[data-mint-topnav-mobile-spacer]");
|
|
9115
|
+
o || (o = document.createElement("div"), o.setAttribute("data-mint-topnav-mobile-spacer", "true"), o.className = "min-w-0 flex-1 min-[1100px]:hidden", this._bar.appendChild(o));
|
|
9116
|
+
let s = Array.from(this.querySelectorAll("[slot=\"actions\"]")), c = this._bar.querySelector("[data-mint-topnav-actions]");
|
|
9117
|
+
if (c || (c = document.createElement("div"), c.setAttribute("data-mint-topnav-actions", "true"), c.className = "flex shrink-0 items-center gap-2", this._bar.appendChild(c)), i && !this._mobileSearchButton) {
|
|
9058
9118
|
this._mobileSearchButton = document.createElement("button"), this._mobileSearchButton.type = "button", this._mobileSearchButton.className = "inline-flex h-10 w-10 shrink-0 cursor-pointer items-center justify-center rounded-lg border border-transparent text-gray-700 hover:bg-black/5 min-[1100px]:hidden dark:text-gray-200 dark:hover:bg-white/10", this._mobileSearchButton.setAttribute("aria-label", "Open search");
|
|
9059
9119
|
let e = document.createElement("mint-icon");
|
|
9060
|
-
e.setAttribute("name", "search"), e.className = "h-5 w-5", this._mobileSearchButton.appendChild(e), this._mobileSearchButton.addEventListener("click", () => this._openSearch(!0)),
|
|
9120
|
+
e.setAttribute("name", "search"), e.className = "h-5 w-5", this._mobileSearchButton.appendChild(e), this._mobileSearchButton.addEventListener("click", () => this._openSearch(!0)), c.insertBefore(this._mobileSearchButton, c.firstChild);
|
|
9061
9121
|
}
|
|
9062
|
-
if (this._mobileSearchButton && this._mobileSearchButton.classList.toggle("hidden", !
|
|
9122
|
+
if (this._mobileSearchButton && this._mobileSearchButton.classList.toggle("hidden", !i), c.replaceChildren(...s), i && this._mobileSearchButton && !s.includes(this._mobileSearchButton) && c.insertBefore(this._mobileSearchButton, c.firstChild), i && !this._searchPanel) {
|
|
9063
9123
|
this._searchPanel = document.createElement("div"), this._searchPanel.className = "fixed left-0 right-0 top-14 z-[90] hidden p-3 min-[1100px]:p-0";
|
|
9064
9124
|
let e = document.createElement("div");
|
|
9065
9125
|
e.className = "mx-auto w-full rounded-2xl border border-gray-200 bg-white shadow-xl dark:border-mint-divider dark:bg-mint-elevated min-[1100px]:rounded-t-none";
|
|
@@ -9084,8 +9144,524 @@ var z = class extends HTMLElement {
|
|
|
9084
9144
|
};
|
|
9085
9145
|
customElements.get("mint-top-navigation") || customElements.define("mint-top-navigation", z);
|
|
9086
9146
|
//#endregion
|
|
9087
|
-
//#region src/components/
|
|
9147
|
+
//#region src/components/search/Search.ts
|
|
9088
9148
|
var B = class extends HTMLElement {
|
|
9149
|
+
constructor(...e) {
|
|
9150
|
+
super(...e), this._shell = null, this._desktopInput = null, this._panel = null, this._panelInner = null, this._panelInput = null, this._panelFiltersWrap = null, 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;
|
|
9151
|
+
}
|
|
9152
|
+
static get observedAttributes() {
|
|
9153
|
+
return [
|
|
9154
|
+
"endpoint",
|
|
9155
|
+
"search-param",
|
|
9156
|
+
"placeholder",
|
|
9157
|
+
"filters",
|
|
9158
|
+
"filter-param",
|
|
9159
|
+
"open-shortcut",
|
|
9160
|
+
"open-shortcut-hint",
|
|
9161
|
+
"collapse-on-mobile"
|
|
9162
|
+
];
|
|
9163
|
+
}
|
|
9164
|
+
connectedCallback() {
|
|
9165
|
+
this.classList.add("relative", "block", "w-full", "max-w-xl"), this._attachGlobalHandlers(), this._attachFocusOutHandler(), this._attachResizeHandler(), this.render();
|
|
9166
|
+
}
|
|
9167
|
+
disconnectedCallback() {
|
|
9168
|
+
this._docPointerDownHandler &&= (document.removeEventListener("pointerdown", this._docPointerDownHandler, !0), null), this._globalKeydownHandler &&= (document.removeEventListener("keydown", this._globalKeydownHandler), null), this._resizeHandler &&= (window.removeEventListener("resize", this._resizeHandler), null), this._focusOutHandler &&= (this.removeEventListener("focusout", this._focusOutHandler, !0), null), this._cancelDebounce(), this._abortSearch();
|
|
9169
|
+
}
|
|
9170
|
+
attributeChangedCallback(e, t, n) {
|
|
9171
|
+
t !== n && this.render();
|
|
9172
|
+
}
|
|
9173
|
+
_getEndpoint() {
|
|
9174
|
+
return (this.getAttribute("endpoint") || "").trim();
|
|
9175
|
+
}
|
|
9176
|
+
_getSearchParam() {
|
|
9177
|
+
return (this.getAttribute("search-param") || "q").trim() || "q";
|
|
9178
|
+
}
|
|
9179
|
+
_getPlaceholder() {
|
|
9180
|
+
return this.getAttribute("placeholder") || "Search";
|
|
9181
|
+
}
|
|
9182
|
+
_getFilterParam() {
|
|
9183
|
+
return (this.getAttribute("filter-param") || "").trim();
|
|
9184
|
+
}
|
|
9185
|
+
_getFilterOptions() {
|
|
9186
|
+
return (this.getAttribute("filters") || "").split(",").map((e) => e.trim()).filter(Boolean);
|
|
9187
|
+
}
|
|
9188
|
+
_hasSelectedFilters() {
|
|
9189
|
+
return this._selectedFilters.length > 0;
|
|
9190
|
+
}
|
|
9191
|
+
_getFilterParamValue() {
|
|
9192
|
+
return this._selectedFilters.join(",");
|
|
9193
|
+
}
|
|
9194
|
+
_getFilterChipLabelText() {
|
|
9195
|
+
return this._selectedFilters.join(", ");
|
|
9196
|
+
}
|
|
9197
|
+
_getCondensedFilterChipLabel(e = 22) {
|
|
9198
|
+
if (!this._hasSelectedFilters()) return "";
|
|
9199
|
+
let [t = ""] = this._selectedFilters, n = this._selectedFilters.length - 1, r = Math.max(8, e - 2), i = t;
|
|
9200
|
+
if (n <= 0) return i.length <= r ? i : `${i.slice(0, Math.max(1, r - 3))}...`;
|
|
9201
|
+
let a = `${t}, and ${n} more`;
|
|
9202
|
+
return a.length <= r ? a : `${a.slice(0, Math.max(1, r - 3))}...`;
|
|
9203
|
+
}
|
|
9204
|
+
_isMobileViewport() {
|
|
9205
|
+
return window.matchMedia("(max-width: 1099.98px)").matches;
|
|
9206
|
+
}
|
|
9207
|
+
_collapseOnMobile() {
|
|
9208
|
+
let e = this.getAttribute("collapse-on-mobile");
|
|
9209
|
+
if (e === null) return !1;
|
|
9210
|
+
let t = e.trim().toLowerCase();
|
|
9211
|
+
return !(t === "false" || t === "0" || t === "off" || t === "none");
|
|
9212
|
+
}
|
|
9213
|
+
_primarySearchInput() {
|
|
9214
|
+
return this._isMobileViewport() && this._collapseOnMobile() ? this._panelInput : this._desktopInput;
|
|
9215
|
+
}
|
|
9216
|
+
_isApplePlatform() {
|
|
9217
|
+
return typeof navigator > "u" ? !1 : /Mac|iPhone|iPad|iPod/i.test(navigator.platform) || /Mac OS/i.test(navigator.userAgent);
|
|
9218
|
+
}
|
|
9219
|
+
_parseOpenShortcut() {
|
|
9220
|
+
let e = (this.getAttribute("open-shortcut") ?? "mod+k").trim().toLowerCase();
|
|
9221
|
+
if (!e || e === "none" || e === "false" || e === "off") return {
|
|
9222
|
+
disabled: !0,
|
|
9223
|
+
wantMod: !1,
|
|
9224
|
+
wantMeta: !1,
|
|
9225
|
+
wantCtrl: !1,
|
|
9226
|
+
wantAlt: !1,
|
|
9227
|
+
wantShift: !1,
|
|
9228
|
+
key: ""
|
|
9229
|
+
};
|
|
9230
|
+
let t = e.split("+").map((e) => e.trim()).filter(Boolean);
|
|
9231
|
+
if (t.length === 0) return {
|
|
9232
|
+
disabled: !0,
|
|
9233
|
+
wantMod: !1,
|
|
9234
|
+
wantMeta: !1,
|
|
9235
|
+
wantCtrl: !1,
|
|
9236
|
+
wantAlt: !1,
|
|
9237
|
+
wantShift: !1,
|
|
9238
|
+
key: ""
|
|
9239
|
+
};
|
|
9240
|
+
let n = t[t.length - 1], r = new Set(t.slice(0, -1).map((e) => e.toLowerCase()));
|
|
9241
|
+
return {
|
|
9242
|
+
disabled: !1,
|
|
9243
|
+
wantMod: r.has("mod"),
|
|
9244
|
+
wantMeta: r.has("meta") || r.has("cmd") || r.has("super"),
|
|
9245
|
+
wantCtrl: r.has("ctrl") || r.has("control"),
|
|
9246
|
+
wantAlt: r.has("alt"),
|
|
9247
|
+
wantShift: r.has("shift"),
|
|
9248
|
+
key: n.toLowerCase()
|
|
9249
|
+
};
|
|
9250
|
+
}
|
|
9251
|
+
_eventKeyMatchesShortcutKey(e, t) {
|
|
9252
|
+
let n = t.toLowerCase();
|
|
9253
|
+
return (e.key.length, e.key.toLowerCase()) === n;
|
|
9254
|
+
}
|
|
9255
|
+
_openShortcutMatches(e) {
|
|
9256
|
+
let t = this._parseOpenShortcut();
|
|
9257
|
+
return t.disabled || !t.key || e.repeat || !this._eventKeyMatchesShortcutKey(e, t.key) || t.wantShift !== e.shiftKey || t.wantAlt !== e.altKey ? !1 : t.wantMod || t.wantMeta || t.wantCtrl ? !(t.wantMod && !(e.metaKey || e.ctrlKey) || t.wantMeta && !e.metaKey || t.wantCtrl && !e.ctrlKey) : !!t.wantAlt;
|
|
9258
|
+
}
|
|
9259
|
+
_getOpenShortcutHintText() {
|
|
9260
|
+
let e = this.getAttribute("open-shortcut-hint");
|
|
9261
|
+
if (e === "none" || e === "false") return "";
|
|
9262
|
+
if (e !== null && e.trim() !== "") return e.trim();
|
|
9263
|
+
let t = this._parseOpenShortcut();
|
|
9264
|
+
if (t.disabled) return "";
|
|
9265
|
+
let n = this._isApplePlatform(), r = [];
|
|
9266
|
+
t.wantMod && r.push(n ? "⌘" : "Ctrl"), t.wantMeta && !t.wantMod && r.push(n ? "⌘" : "Meta"), t.wantCtrl && !t.wantMod && r.push("Ctrl"), t.wantAlt && r.push("Alt"), t.wantShift && r.push("Shift");
|
|
9267
|
+
let i = t.key.length === 1 ? t.key.toUpperCase() : t.key;
|
|
9268
|
+
return i ? t.wantMod && !t.wantMeta && !t.wantCtrl && !t.wantAlt && !t.wantShift && t.key.length === 1 ? `${n ? "⌘" : "Ctrl+"}${i}` : [...r, i].join("+") : "";
|
|
9269
|
+
}
|
|
9270
|
+
_attachGlobalHandlers() {
|
|
9271
|
+
this._globalKeydownHandler || (this._globalKeydownHandler = (e) => {
|
|
9272
|
+
if (this._openShortcutMatches(e)) {
|
|
9273
|
+
e.preventDefault(), this._openSearch(!0);
|
|
9274
|
+
return;
|
|
9275
|
+
}
|
|
9276
|
+
e.key.toLowerCase() === "escape" && this._searchOpen && this._closeSearch();
|
|
9277
|
+
}, document.addEventListener("keydown", this._globalKeydownHandler)), this._docPointerDownHandler || (this._docPointerDownHandler = (e) => {
|
|
9278
|
+
if (!this._searchOpen) return;
|
|
9279
|
+
let t = e.composedPath();
|
|
9280
|
+
this._shell && t.includes(this._shell) || this._panelInner && t.includes(this._panelInner) || this._closeSearch();
|
|
9281
|
+
}, document.addEventListener("pointerdown", this._docPointerDownHandler, !0));
|
|
9282
|
+
}
|
|
9283
|
+
_attachResizeHandler() {
|
|
9284
|
+
this._resizeHandler || (this._resizeHandler = () => {
|
|
9285
|
+
this._syncPanelVisibility();
|
|
9286
|
+
}, window.addEventListener("resize", this._resizeHandler, { passive: !0 }));
|
|
9287
|
+
}
|
|
9288
|
+
_attachFocusOutHandler() {
|
|
9289
|
+
this._focusOutHandler || (this._focusOutHandler = (e) => {
|
|
9290
|
+
if (!this._searchOpen) return;
|
|
9291
|
+
let t = e.relatedTarget;
|
|
9292
|
+
t && (this._shell && this._shell.contains(t) || this._panelInner && this._panelInner.contains(t) || this._closeSearch());
|
|
9293
|
+
}, this.addEventListener("focusout", this._focusOutHandler, !0));
|
|
9294
|
+
}
|
|
9295
|
+
_emitSearchOpenChange() {
|
|
9296
|
+
this.dispatchEvent(new CustomEvent("search-open-change", {
|
|
9297
|
+
detail: { open: this._searchOpen },
|
|
9298
|
+
bubbles: !0,
|
|
9299
|
+
composed: !0
|
|
9300
|
+
}));
|
|
9301
|
+
}
|
|
9302
|
+
_openSearch(e = !1) {
|
|
9303
|
+
this._getEndpoint() && (this._searchOpen || (this._searchOpen = !0, this._syncPanelVisibility(), this._emitSearchOpenChange(), e && this._primarySearchInput()?.focus()));
|
|
9304
|
+
}
|
|
9305
|
+
_closeSearch() {
|
|
9306
|
+
this._searchOpen && (this._searchOpen = !1, this._syncPanelVisibility(), this._emitSearchOpenChange());
|
|
9307
|
+
}
|
|
9308
|
+
_syncPanelVisibility() {
|
|
9309
|
+
if (!this._panel) return;
|
|
9310
|
+
let e = this._panelLayoutBaseClass();
|
|
9311
|
+
this._panel.className = this._searchOpen ? e : `${e} hidden`, this._shell && (this._shell.classList.toggle("rounded-b-none", this._searchOpen), this._shell.classList.toggle("border-b-transparent", this._searchOpen)), this._positionPanel();
|
|
9312
|
+
}
|
|
9313
|
+
_panelLayoutBaseClass() {
|
|
9314
|
+
return !this._isMobileViewport() || !this._collapseOnMobile() ? "absolute left-0 right-0 top-full z-[90] p-0 -mt-[9px]" : "fixed left-0 right-0 top-12 z-[90] p-3";
|
|
9315
|
+
}
|
|
9316
|
+
_positionPanel() {
|
|
9317
|
+
this._panel && (!this._isMobileViewport() || !this._collapseOnMobile()) && (this._panel.style.left = "", this._panel.style.right = "", this._panel.style.top = "", this._panel.style.width = "", this._panel.style.maxWidth = "", this._panel.style.transform = "");
|
|
9318
|
+
}
|
|
9319
|
+
_setQuery(e) {
|
|
9320
|
+
let t = this._query;
|
|
9321
|
+
this._query = e, e !== t && (this._selectedFilterBackspaceArmed = !1), this._desktopInput && (this._desktopInput.value = e), this._panelInput && (this._panelInput.value = e);
|
|
9322
|
+
}
|
|
9323
|
+
_cancelDebounce() {
|
|
9324
|
+
this._debounceId !== null && (window.clearTimeout(this._debounceId), this._debounceId = null);
|
|
9325
|
+
}
|
|
9326
|
+
_abortSearch() {
|
|
9327
|
+
this._abortController &&= (this._abortController.abort(), null);
|
|
9328
|
+
}
|
|
9329
|
+
_normalizeResults(e) {
|
|
9330
|
+
return ((e) => {
|
|
9331
|
+
if (Array.isArray(e)) return e;
|
|
9332
|
+
if (!e || typeof e != "object") return [];
|
|
9333
|
+
let t = e;
|
|
9334
|
+
for (let e of [
|
|
9335
|
+
"results",
|
|
9336
|
+
"items",
|
|
9337
|
+
"data",
|
|
9338
|
+
"products"
|
|
9339
|
+
]) {
|
|
9340
|
+
let n = t[e];
|
|
9341
|
+
if (Array.isArray(n)) return n;
|
|
9342
|
+
}
|
|
9343
|
+
return [];
|
|
9344
|
+
})(e).map((e) => {
|
|
9345
|
+
let t = e || {};
|
|
9346
|
+
return {
|
|
9347
|
+
title: String(t.title || t.name || t.label || t.email || t.id || "").trim() || "Untitled",
|
|
9348
|
+
subtitle: String(t.description || t.category || t.username || "").trim(),
|
|
9349
|
+
parent: String(t.parent || t.type || t.entity || t.kind || t.category || "").trim() || void 0
|
|
9350
|
+
};
|
|
9351
|
+
}).slice(0, 8);
|
|
9352
|
+
}
|
|
9353
|
+
_emitResultsChange(e, t) {
|
|
9354
|
+
let n = this._hasSelectedFilters() ? this._getFilterParamValue() : null;
|
|
9355
|
+
this.dispatchEvent(new CustomEvent("search-results-change", {
|
|
9356
|
+
detail: {
|
|
9357
|
+
query: this._query,
|
|
9358
|
+
filter: n,
|
|
9359
|
+
filters: [...this._selectedFilters],
|
|
9360
|
+
results: e,
|
|
9361
|
+
raw: t ?? null
|
|
9362
|
+
},
|
|
9363
|
+
bubbles: !0,
|
|
9364
|
+
composed: !0
|
|
9365
|
+
}));
|
|
9366
|
+
}
|
|
9367
|
+
_emitFilterChange() {
|
|
9368
|
+
let e = this._hasSelectedFilters() ? this._getFilterParamValue() : null;
|
|
9369
|
+
this.dispatchEvent(new CustomEvent("search-filter-change", {
|
|
9370
|
+
detail: {
|
|
9371
|
+
query: this._query,
|
|
9372
|
+
filter: e,
|
|
9373
|
+
filters: [...this._selectedFilters]
|
|
9374
|
+
},
|
|
9375
|
+
bubbles: !0,
|
|
9376
|
+
composed: !0
|
|
9377
|
+
}));
|
|
9378
|
+
}
|
|
9379
|
+
_renderState(e) {
|
|
9380
|
+
if (this._customResultsWrap && this._customResultsWrap.childElementCount > 0) {
|
|
9381
|
+
this._stateWrap && this._stateWrap.classList.add("hidden"), this._resultsWrap && this._resultsWrap.classList.add("hidden");
|
|
9382
|
+
return;
|
|
9383
|
+
}
|
|
9384
|
+
this._stateWrap && (this._stateWrap.textContent = e, this._stateWrap.classList.remove("hidden"), this._resultsWrap && (this._resultsWrap.classList.remove("hidden"), this._resultsWrap.innerHTML = ""));
|
|
9385
|
+
}
|
|
9386
|
+
_renderResults(e) {
|
|
9387
|
+
if (this._customResultsWrap && this._customResultsWrap.childElementCount > 0) {
|
|
9388
|
+
this._stateWrap && this._stateWrap.classList.add("hidden"), this._resultsWrap && this._resultsWrap.classList.add("hidden");
|
|
9389
|
+
return;
|
|
9390
|
+
}
|
|
9391
|
+
if (!(!this._resultsWrap || !this._stateWrap)) {
|
|
9392
|
+
if (this._resultsWrap.innerHTML = "", e.length === 0) {
|
|
9393
|
+
this._renderState("No results found");
|
|
9394
|
+
return;
|
|
9395
|
+
}
|
|
9396
|
+
this._stateWrap.classList.add("hidden");
|
|
9397
|
+
for (let t of e) {
|
|
9398
|
+
let e = document.createElement("button");
|
|
9399
|
+
e.type = "button", e.className = "flex w-full cursor-pointer items-start gap-3 rounded-lg px-3 py-2 text-left hover:bg-gray-100 dark:hover:bg-white/10";
|
|
9400
|
+
let n = document.createElement("mint-icon");
|
|
9401
|
+
n.setAttribute("name", "search"), n.className = "mt-0.5 h-4 w-4 text-gray-500 dark:text-gray-400";
|
|
9402
|
+
let r = document.createElement("div");
|
|
9403
|
+
r.className = "min-w-0";
|
|
9404
|
+
let i = document.createElement("div");
|
|
9405
|
+
if (i.className = "truncate text-sm font-semibold text-gray-900 dark:text-gray-100", i.textContent = t.title, r.appendChild(i), t.subtitle) {
|
|
9406
|
+
let e = document.createElement("div");
|
|
9407
|
+
e.className = "truncate text-xs text-gray-500 dark:text-gray-400", e.textContent = t.subtitle, r.appendChild(e);
|
|
9408
|
+
}
|
|
9409
|
+
e.appendChild(n), e.appendChild(r), e.addEventListener("keydown", (t) => {
|
|
9410
|
+
if (t.key === "ArrowDown") {
|
|
9411
|
+
t.preventDefault(), this._moveFocusInResults(e, 1);
|
|
9412
|
+
return;
|
|
9413
|
+
}
|
|
9414
|
+
if (t.key === "ArrowUp") {
|
|
9415
|
+
t.preventDefault(), this._moveFocusInResults(e, -1);
|
|
9416
|
+
return;
|
|
9417
|
+
}
|
|
9418
|
+
}), e.addEventListener("click", () => {
|
|
9419
|
+
let e = this._hasSelectedFilters() ? this._getFilterParamValue() : null;
|
|
9420
|
+
this.dispatchEvent(new CustomEvent("search-select", {
|
|
9421
|
+
detail: {
|
|
9422
|
+
query: this._query,
|
|
9423
|
+
filter: e,
|
|
9424
|
+
filters: [...this._selectedFilters],
|
|
9425
|
+
result: t
|
|
9426
|
+
},
|
|
9427
|
+
bubbles: !0,
|
|
9428
|
+
composed: !0
|
|
9429
|
+
})), this._closeSearch();
|
|
9430
|
+
}), this._resultsWrap.appendChild(e);
|
|
9431
|
+
}
|
|
9432
|
+
}
|
|
9433
|
+
}
|
|
9434
|
+
_fetchSearchResults(e) {
|
|
9435
|
+
let t = this._getEndpoint();
|
|
9436
|
+
if (!t) return;
|
|
9437
|
+
let n = e.trim();
|
|
9438
|
+
if (!n) {
|
|
9439
|
+
this._emitResultsChange([]), this._renderState("Start typing to search");
|
|
9440
|
+
return;
|
|
9441
|
+
}
|
|
9442
|
+
this._abortSearch(), this._abortController = new AbortController(), this._renderState("Searching...");
|
|
9443
|
+
let r = new URLSearchParams();
|
|
9444
|
+
r.set(this._getSearchParam(), n);
|
|
9445
|
+
let i = this._getFilterParam();
|
|
9446
|
+
i && this._hasSelectedFilters() && r.set(i, this._getFilterParamValue());
|
|
9447
|
+
let a = t.includes("{query}") ? t.replace("{query}", encodeURIComponent(n)) : `${t}${t.includes("?") ? "&" : "?"}${r.toString()}`;
|
|
9448
|
+
fetch(a, { signal: this._abortController.signal }).then((e) => {
|
|
9449
|
+
if (!e.ok) throw Error(`Request failed: ${e.status}`);
|
|
9450
|
+
return e.json();
|
|
9451
|
+
}).then((e) => {
|
|
9452
|
+
let t = this._normalizeResults(e);
|
|
9453
|
+
this._emitResultsChange(t, e), this._renderResults(t);
|
|
9454
|
+
}).catch((e) => {
|
|
9455
|
+
e?.name !== "AbortError" && (this._emitResultsChange([]), this._renderState("Unable to load results"));
|
|
9456
|
+
});
|
|
9457
|
+
}
|
|
9458
|
+
_scheduleSearch(e) {
|
|
9459
|
+
this._setQuery(e), this._cancelDebounce(), this._debounceId = window.setTimeout(() => this._fetchSearchResults(e), 220);
|
|
9460
|
+
}
|
|
9461
|
+
_getNativeInputValue(e) {
|
|
9462
|
+
if (!e) return "";
|
|
9463
|
+
let t = e.querySelector("input, textarea");
|
|
9464
|
+
return t ? t.value || "" : e.value || "";
|
|
9465
|
+
}
|
|
9466
|
+
_getCurrentInputValue() {
|
|
9467
|
+
let e = document.activeElement;
|
|
9468
|
+
return e && this._desktopInput && this._desktopInput.contains(e) ? this._getNativeInputValue(this._desktopInput) : e && this._panelInput && this._panelInput.contains(e) ? this._getNativeInputValue(this._panelInput) : this._getNativeInputValue(this._primarySearchInput());
|
|
9469
|
+
}
|
|
9470
|
+
_applyFilterSelectionChange() {
|
|
9471
|
+
let e = this._getCurrentInputValue();
|
|
9472
|
+
if (this._setQuery(e), this._emitFilterChange(), this.render(), e.trim()) {
|
|
9473
|
+
this._scheduleSearch(e);
|
|
9474
|
+
return;
|
|
9475
|
+
}
|
|
9476
|
+
this._cancelDebounce(), this._abortSearch(), this._emitResultsChange([]), this._renderState("Start typing to search");
|
|
9477
|
+
}
|
|
9478
|
+
_clearAllSelectedFilters() {
|
|
9479
|
+
this._selectedFilters = [], this._selectedFilterBackspaceArmed = !1, this._applyFilterSelectionChange();
|
|
9480
|
+
}
|
|
9481
|
+
_popLastSelectedFilter() {
|
|
9482
|
+
this._selectedFilters.length !== 0 && (this._selectedFilters.pop(), this._selectedFilterBackspaceArmed = !1, this._applyFilterSelectionChange());
|
|
9483
|
+
}
|
|
9484
|
+
_focusActiveInput() {
|
|
9485
|
+
let e = this._primarySearchInput();
|
|
9486
|
+
e && requestAnimationFrame(() => {
|
|
9487
|
+
e.focus();
|
|
9488
|
+
});
|
|
9489
|
+
}
|
|
9490
|
+
_getFilterChipElements() {
|
|
9491
|
+
return this._panelFiltersWrap ? Array.from(this._panelFiltersWrap.querySelectorAll("mint-chip")) : [];
|
|
9492
|
+
}
|
|
9493
|
+
_getResultFocusableElements() {
|
|
9494
|
+
let e = this._customResultsWrap && !this._customResultsWrap.classList.contains("hidden") ? this._customResultsWrap : this._resultsWrap;
|
|
9495
|
+
return e ? Array.from(e.querySelectorAll("button:not([disabled]), [href], [tabindex]:not([tabindex=\"-1\"]), input:not([disabled]), select:not([disabled]), textarea:not([disabled])")) : [];
|
|
9496
|
+
}
|
|
9497
|
+
_focusFirstChipOrResult(e = !1) {
|
|
9498
|
+
let t = this._getFilterChipElements(), n = this._getResultFocusableElements();
|
|
9499
|
+
if (!e) {
|
|
9500
|
+
(t[0] || n[0])?.focus();
|
|
9501
|
+
return;
|
|
9502
|
+
}
|
|
9503
|
+
(n[n.length - 1] || t[t.length - 1])?.focus();
|
|
9504
|
+
}
|
|
9505
|
+
_moveFocusInResults(e, t) {
|
|
9506
|
+
let n = this._getResultFocusableElements();
|
|
9507
|
+
if (n.length === 0) return;
|
|
9508
|
+
let r = n.indexOf(e);
|
|
9509
|
+
if (r === -1) return;
|
|
9510
|
+
let i = n[r + t];
|
|
9511
|
+
if (i) {
|
|
9512
|
+
i.focus();
|
|
9513
|
+
return;
|
|
9514
|
+
}
|
|
9515
|
+
if (t === -1) {
|
|
9516
|
+
let e = this._getFilterChipElements(), t = e[e.length - 1];
|
|
9517
|
+
t ? t.focus() : this._focusActiveInput();
|
|
9518
|
+
}
|
|
9519
|
+
}
|
|
9520
|
+
_renderSelectedFilter() {
|
|
9521
|
+
let e = (e) => {
|
|
9522
|
+
if (!e || (e.innerHTML = "", !this._hasSelectedFilters())) return;
|
|
9523
|
+
let t = document.createElement("mint-chip");
|
|
9524
|
+
t.setAttribute("dismissable", ""), t.title = this._getFilterChipLabelText();
|
|
9525
|
+
let n = this._getCondensedFilterChipLabel();
|
|
9526
|
+
t.classList.add("max-w-[min(20rem,85vw)]", "whitespace-nowrap", "overflow-hidden", "text-ellipsis", "text-xs", "px-2", "py-0.5"), t.style.fontSize = "0.75rem", t.style.padding = "0.125rem 0.375rem", t.style.height = "1.375rem", t.style.lineHeight = "1", t.style.whiteSpace = "nowrap", t.style.overflow = "hidden", t.style.textOverflow = "ellipsis", this._selectedFilterBackspaceArmed && t.classList.add("ring-2", "ring-brand-400", "dark:ring-brand-300"), t.textContent = n, t.addEventListener("dismiss", (e) => {
|
|
9527
|
+
e.stopPropagation(), this._clearAllSelectedFilters();
|
|
9528
|
+
}), e.appendChild(t);
|
|
9529
|
+
};
|
|
9530
|
+
e(this._desktopFilterWrap), e(this._mobileFilterWrap);
|
|
9531
|
+
}
|
|
9532
|
+
_bindInputHandlers(e) {
|
|
9533
|
+
let t = () => {
|
|
9534
|
+
this._scheduleSearch(this._getNativeInputValue(e));
|
|
9535
|
+
};
|
|
9536
|
+
e.addEventListener("focusin", () => this._openSearch(!1)), e.addEventListener("input", t), e.addEventListener("search", t), e.addEventListener("change", t), e.addEventListener("keydown", (t) => {
|
|
9537
|
+
if (t.key === "ArrowDown") {
|
|
9538
|
+
this._searchOpen || this._openSearch(!1), t.preventDefault(), this._focusFirstChipOrResult(!1);
|
|
9539
|
+
return;
|
|
9540
|
+
}
|
|
9541
|
+
if (t.key === "ArrowUp") {
|
|
9542
|
+
this._searchOpen || this._openSearch(!1), t.preventDefault(), this._focusFirstChipOrResult(!0);
|
|
9543
|
+
return;
|
|
9544
|
+
}
|
|
9545
|
+
if (t.key === "Tab" && !t.shiftKey && this._searchOpen) {
|
|
9546
|
+
let e = this._getFilterChipElements(), n = this._getResultFocusableElements();
|
|
9547
|
+
if (e.length > 0 || n.length > 0) {
|
|
9548
|
+
t.preventDefault(), this._focusFirstChipOrResult(!1);
|
|
9549
|
+
return;
|
|
9550
|
+
}
|
|
9551
|
+
}
|
|
9552
|
+
if (t.key !== "Backspace") return;
|
|
9553
|
+
let n = this._getNativeInputValue(e);
|
|
9554
|
+
if (n !== this._query && this._setQuery(n), !(n.length > 0) && this._hasSelectedFilters()) {
|
|
9555
|
+
if (!this._selectedFilterBackspaceArmed) {
|
|
9556
|
+
t.preventDefault(), this._selectedFilterBackspaceArmed = !0, this._renderSelectedFilter();
|
|
9557
|
+
return;
|
|
9558
|
+
}
|
|
9559
|
+
t.preventDefault(), this._popLastSelectedFilter();
|
|
9560
|
+
}
|
|
9561
|
+
});
|
|
9562
|
+
}
|
|
9563
|
+
openSearch(e = !0) {
|
|
9564
|
+
this._openSearch(e);
|
|
9565
|
+
}
|
|
9566
|
+
closeSearch() {
|
|
9567
|
+
this._closeSearch();
|
|
9568
|
+
}
|
|
9569
|
+
toggleSearch(e = !0) {
|
|
9570
|
+
if (this._searchOpen) {
|
|
9571
|
+
this._closeSearch();
|
|
9572
|
+
return;
|
|
9573
|
+
}
|
|
9574
|
+
this._openSearch(e);
|
|
9575
|
+
}
|
|
9576
|
+
isSearchOpen() {
|
|
9577
|
+
return this._searchOpen;
|
|
9578
|
+
}
|
|
9579
|
+
render() {
|
|
9580
|
+
let e = this._getEndpoint();
|
|
9581
|
+
if (this.classList.toggle("hidden", !e), !e) return;
|
|
9582
|
+
if (!this._shell) {
|
|
9583
|
+
this._shell = document.createElement("div"), this._shell.className = "relative z-[91] flex h-10 w-full", this._desktopFilterWrap = document.createElement("div"), this._desktopFilterWrap.className = "inline-flex shrink-0 max-w-[8.5rem]", this._desktopFilterWrap.setAttribute("slot", "prepend"), this._desktopInput = document.createElement("mint-input"), this._desktopInput.setAttribute("type", "search"), this._desktopInput.setAttribute("icon", "search"), this._desktopInput.className = "h-full min-w-0 flex-1";
|
|
9584
|
+
let e = document.createElement("span");
|
|
9585
|
+
e.className = "shrink-0 text-xs text-gray-500 dark:text-gray-400", e.setAttribute("slot", "append"), this._desktopShortcutHint = e, this._bindInputHandlers(this._desktopInput), this._desktopInput.appendChild(this._desktopFilterWrap), this._desktopInput.appendChild(e), this._shell.appendChild(this._desktopInput), this.appendChild(this._shell);
|
|
9586
|
+
}
|
|
9587
|
+
if (!this._panel) {
|
|
9588
|
+
this._panel = document.createElement("div"), this._panel.className = "absolute left-0 right-0 top-full z-[90] hidden p-0 -mt-[9px]";
|
|
9589
|
+
let e = document.createElement("div");
|
|
9590
|
+
e.className = "mx-auto flex max-h-[calc(100dvh-4rem)] w-full flex-col overflow-hidden rounded-2xl border border-gray-200 bg-white shadow-xl dark:border-mint-divider dark:bg-mint-elevated min-[1100px]:rounded-t-none min-[1100px]:border-t-0", this._panelInner = e;
|
|
9591
|
+
let t = document.createElement("div");
|
|
9592
|
+
this._panelSearchBar = t, t.className = "hidden", this._mobileFilterWrap = document.createElement("div"), this._mobileFilterWrap.className = "inline-flex shrink-0 max-w-[8.5rem]", this._mobileFilterWrap.setAttribute("slot", "prepend"), this._panelInput = document.createElement("mint-input"), this._panelInput.setAttribute("type", "search"), this._panelInput.className = "min-w-0 flex-1", this._bindInputHandlers(this._panelInput), this._panelInput.appendChild(this._mobileFilterWrap), t.appendChild(this._panelInput), this._panelFiltersWrap = document.createElement("div"), this._panelFiltersWrap.className = "flex shrink-0 flex-wrap gap-2 px-3 pb-3 pt-5", this._customResultsWrap = document.createElement("div"), this._customResultsWrap.className = "min-h-0 flex-1 overflow-y-auto px-2 pb-2", this._stateWrap = document.createElement("div"), this._stateWrap.className = "px-4 pb-4 text-sm text-gray-500 dark:text-gray-400", this._stateWrap.textContent = "Start typing to search", this._resultsWrap = document.createElement("div"), this._resultsWrap.className = "min-h-0 flex-1 overflow-y-auto px-2 pb-2", e.appendChild(t), e.appendChild(this._panelFiltersWrap), e.appendChild(this._customResultsWrap), e.appendChild(this._stateWrap), e.appendChild(this._resultsWrap), this._panel.appendChild(e), this.appendChild(this._panel);
|
|
9593
|
+
}
|
|
9594
|
+
let t = this._hasSelectedFilters() ? "" : this._getPlaceholder();
|
|
9595
|
+
if (this._desktopInput && this._desktopInput.setAttribute("placeholder", t), this._panelInput && this._panelInput.setAttribute("placeholder", t), this._desktopShortcutHint) {
|
|
9596
|
+
let e = this._getOpenShortcutHintText();
|
|
9597
|
+
this._desktopShortcutHint.textContent = e, this._desktopShortcutHint.classList.toggle("hidden", !e);
|
|
9598
|
+
}
|
|
9599
|
+
if (this._panelFiltersWrap) {
|
|
9600
|
+
let e = this._getFilterOptions();
|
|
9601
|
+
this._selectedFilters = this._selectedFilters.filter((t) => e.includes(t));
|
|
9602
|
+
let t = e.length > 0;
|
|
9603
|
+
this._panelFiltersWrap.classList.toggle("hidden", !t), this._stateWrap?.classList.toggle("pt-4", !t), this._resultsWrap?.classList.toggle("pt-4", !t), this._customResultsWrap?.classList.toggle("pt-5", !t), this._panelFiltersWrap.innerHTML = "";
|
|
9604
|
+
for (let t of e) {
|
|
9605
|
+
let e = document.createElement("mint-chip"), n = this._selectedFilters.includes(t);
|
|
9606
|
+
if (n && e.classList.add("ring-2", "ring-brand-400", "dark:ring-brand-300"), e.classList.add("cursor-pointer", "focus-visible:outline-none", "focus-visible:ring-2", "focus-visible:ring-brand-400", "inline-flex", "items-center", "gap-1"), n) {
|
|
9607
|
+
let n = document.createElement("span");
|
|
9608
|
+
n.textContent = t;
|
|
9609
|
+
let r = document.createElement("mint-icon");
|
|
9610
|
+
r.setAttribute("name", "close"), r.className = "h-4 w-4 ml-2 shrink-0", r.setAttribute("aria-hidden", "true"), e.append(n, r);
|
|
9611
|
+
} else e.textContent = t;
|
|
9612
|
+
e.tabIndex = 0, e.setAttribute("role", "button"), e.setAttribute("aria-label", n ? `Remove filter ${t}` : `Filter by ${t}`), e.addEventListener("pointerdown", (e) => {
|
|
9613
|
+
e.preventDefault();
|
|
9614
|
+
});
|
|
9615
|
+
let r = (e) => {
|
|
9616
|
+
e && e.stopPropagation();
|
|
9617
|
+
let n = this._selectedFilters.indexOf(t);
|
|
9618
|
+
n >= 0 ? this._selectedFilters.splice(n, 1) : this._selectedFilters.push(t), this._selectedFilterBackspaceArmed = !1, this._emitFilterChange(), this._renderSelectedFilter(), this.render(), this._query.trim() && this._scheduleSearch(this._query), this._focusActiveInput();
|
|
9619
|
+
};
|
|
9620
|
+
e.addEventListener("click", (e) => r(e)), e.addEventListener("keydown", (t) => {
|
|
9621
|
+
let n = this._getFilterChipElements(), i = n.indexOf(e);
|
|
9622
|
+
if (t.key === "Enter" || t.key === " ") {
|
|
9623
|
+
t.preventDefault(), r(t);
|
|
9624
|
+
return;
|
|
9625
|
+
}
|
|
9626
|
+
if (t.key === "ArrowRight") {
|
|
9627
|
+
t.preventDefault();
|
|
9628
|
+
let e = n[i + 1];
|
|
9629
|
+
e && e.focus();
|
|
9630
|
+
return;
|
|
9631
|
+
}
|
|
9632
|
+
if (t.key === "ArrowLeft") {
|
|
9633
|
+
t.preventDefault();
|
|
9634
|
+
let e = n[i - 1];
|
|
9635
|
+
e ? e.focus() : this._focusActiveInput();
|
|
9636
|
+
return;
|
|
9637
|
+
}
|
|
9638
|
+
if (t.key === "ArrowDown") {
|
|
9639
|
+
t.preventDefault(), this._getResultFocusableElements()[0]?.focus();
|
|
9640
|
+
return;
|
|
9641
|
+
}
|
|
9642
|
+
if (t.key === "ArrowUp") {
|
|
9643
|
+
t.preventDefault(), this._focusActiveInput();
|
|
9644
|
+
return;
|
|
9645
|
+
}
|
|
9646
|
+
}), this._panelFiltersWrap.appendChild(e);
|
|
9647
|
+
}
|
|
9648
|
+
}
|
|
9649
|
+
if (this._customResultsWrap) {
|
|
9650
|
+
Array.from(this.children).filter((e) => e === this._shell || e === this._panel ? !1 : e.getAttribute("slot") === "results").forEach((e) => this._customResultsWrap.appendChild(e));
|
|
9651
|
+
let e = this._customResultsWrap.childElementCount > 0;
|
|
9652
|
+
this._customResultsWrap.classList.toggle("hidden", !e), e ? (this._stateWrap?.classList.add("hidden"), this._resultsWrap?.classList.add("hidden")) : this._resultsWrap?.classList.remove("hidden");
|
|
9653
|
+
}
|
|
9654
|
+
this._renderSelectedFilter(), this._syncResponsiveChrome(), this._syncPanelVisibility();
|
|
9655
|
+
}
|
|
9656
|
+
_syncResponsiveChrome() {
|
|
9657
|
+
let e = this._collapseOnMobile();
|
|
9658
|
+
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");
|
|
9659
|
+
}
|
|
9660
|
+
};
|
|
9661
|
+
customElements.get("mint-search") || customElements.define("mint-search", B);
|
|
9662
|
+
//#endregion
|
|
9663
|
+
//#region src/components/bottom-navigation/BottomNavigation.ts
|
|
9664
|
+
var V = class extends HTMLElement {
|
|
9089
9665
|
constructor(...e) {
|
|
9090
9666
|
super(...e), this._lastScrollY = 0, this._scrollHandler = null;
|
|
9091
9667
|
}
|
|
@@ -9110,10 +9686,10 @@ var B = class extends HTMLElement {
|
|
|
9110
9686
|
this._scrollHandler &&= (window.removeEventListener("scroll", this._scrollHandler), null);
|
|
9111
9687
|
}
|
|
9112
9688
|
};
|
|
9113
|
-
customElements.get("mint-bottom-navigation") || customElements.define("mint-bottom-navigation",
|
|
9689
|
+
customElements.get("mint-bottom-navigation") || customElements.define("mint-bottom-navigation", V);
|
|
9114
9690
|
//#endregion
|
|
9115
9691
|
//#region src/components/bottom-navigation/BottomNavItem.ts
|
|
9116
|
-
var
|
|
9692
|
+
var H = class extends HTMLElement {
|
|
9117
9693
|
constructor(...e) {
|
|
9118
9694
|
super(...e), this._root = null;
|
|
9119
9695
|
}
|
|
@@ -9155,6 +9731,6 @@ var V = class extends HTMLElement {
|
|
|
9155
9731
|
s.className = "block w-full truncate", s.textContent = t, a.appendChild(o), a.appendChild(s), this.replaceChildren(a), this._root = a;
|
|
9156
9732
|
}
|
|
9157
9733
|
};
|
|
9158
|
-
customElements.get("mint-bottom-nav-item") || customElements.define("mint-bottom-nav-item",
|
|
9734
|
+
customElements.get("mint-bottom-nav-item") || customElements.define("mint-bottom-nav-item", H);
|
|
9159
9735
|
//#endregion
|
|
9160
|
-
export { E as Alert, l as BackButton,
|
|
9736
|
+
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 };
|