monobill-mintui 0.3.52 → 0.3.53
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/date-picker/DatePicker.d.ts.map +1 -1
- package/dist/index.cjs +7 -7
- package/dist/index.js +324 -319
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -148,10 +148,10 @@ class Q extends HTMLElement {
|
|
|
148
148
|
}
|
|
149
149
|
const i = this.closest("mint-button") || ((o = this.parentElement) == null ? void 0 : o.closest("mint-button")), s = this.closest("mint-switch") || ((c = this.parentElement) == null ? void 0 : c.closest("mint-switch")), n = this.closest("mint-select") || ((d = this.parentElement) == null ? void 0 : d.closest("mint-select"));
|
|
150
150
|
if (!Array.from(this.classList).some(
|
|
151
|
-
(
|
|
151
|
+
(u) => u.startsWith("w-") || u.startsWith("h-")
|
|
152
152
|
) && !n) {
|
|
153
|
-
let
|
|
154
|
-
s ?
|
|
153
|
+
let u;
|
|
154
|
+
s ? u = "w-3 h-3" : i ? u = "w-5 h-5" : u = "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"), u.split(" ").forEach((h) => {
|
|
155
155
|
h && this.classList.add(h);
|
|
156
156
|
});
|
|
157
157
|
}
|
|
@@ -169,7 +169,7 @@ class Q extends HTMLElement {
|
|
|
169
169
|
}
|
|
170
170
|
}
|
|
171
171
|
customElements.get("mint-icon") || customElements.define("mint-icon", Q);
|
|
172
|
-
const
|
|
172
|
+
const j = class j extends HTMLElement {
|
|
173
173
|
constructor() {
|
|
174
174
|
super(), this._button = null, this._clickHandler = null, this._isHandlingClick = !1, this._handleMouseDown = () => {
|
|
175
175
|
this._button && !this.isDisabled() && !this.isLoading() && this._button.classList.add("mint-button-active");
|
|
@@ -189,7 +189,7 @@ const W = class W extends HTMLElement {
|
|
|
189
189
|
return ["variant", "tone", "disabled", "loading", "button-type", "type", "full-width", "icon-position", "icon", "active"];
|
|
190
190
|
}
|
|
191
191
|
connectedCallback() {
|
|
192
|
-
if (!
|
|
192
|
+
if (!j._activeShadowStyleInjected) {
|
|
193
193
|
const t = document.createElement("style");
|
|
194
194
|
t.textContent = `
|
|
195
195
|
mint-button .mint-button-active {
|
|
@@ -202,7 +202,7 @@ const W = class W extends HTMLElement {
|
|
|
202
202
|
mint-button[data-variant="link"] .mint-button-active {
|
|
203
203
|
box-shadow: none !important;
|
|
204
204
|
}
|
|
205
|
-
`, document.head.appendChild(t),
|
|
205
|
+
`, document.head.appendChild(t), j._activeShadowStyleInjected = !0;
|
|
206
206
|
}
|
|
207
207
|
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");
|
|
208
208
|
}
|
|
@@ -729,7 +729,7 @@ const W = class W extends HTMLElement {
|
|
|
729
729
|
return this.isFullWidth() && l.push("w-full"), l.join(" ");
|
|
730
730
|
}
|
|
731
731
|
render() {
|
|
732
|
-
var d,
|
|
732
|
+
var d, u, h, f, p, m;
|
|
733
733
|
const t = this.isDisabled() || this.isLoading(), e = this.getType();
|
|
734
734
|
if (!this._button) {
|
|
735
735
|
for (this._button = document.createElement("button"); this.firstChild; )
|
|
@@ -763,7 +763,7 @@ const W = class W extends HTMLElement {
|
|
|
763
763
|
g || a === "left" ? b ? b.insertAdjacentElement("afterend", r) : this._button.insertBefore(r, l) : l.insertAdjacentElement("afterend", r);
|
|
764
764
|
} else if (r && (g || a === "left") && r.nextSibling !== l) {
|
|
765
765
|
r.remove();
|
|
766
|
-
const b = (
|
|
766
|
+
const b = (p = this._button.querySelector("mint-spinner")) == null ? void 0 : p.parentElement;
|
|
767
767
|
b ? b.insertAdjacentElement("afterend", r) : this._button.insertBefore(r, l);
|
|
768
768
|
} else r && !g && a === "right" && r.previousSibling !== l && (r.remove(), l.insertAdjacentElement("afterend", r));
|
|
769
769
|
} else {
|
|
@@ -773,14 +773,14 @@ const W = class W extends HTMLElement {
|
|
|
773
773
|
g.push(b);
|
|
774
774
|
continue;
|
|
775
775
|
}
|
|
776
|
-
const
|
|
777
|
-
|
|
776
|
+
const v = b;
|
|
777
|
+
v.tagName !== "MINT-SPINNER" && !v.querySelector("mint-spinner") && b !== r && !v.hasAttribute("slot") && !(v.className === "mr-2" && v.querySelector("mint-spinner")) && g.push(b);
|
|
778
778
|
}
|
|
779
779
|
if (g.length > 0) {
|
|
780
|
-
l = document.createElement("span"), l.className = "mint-button-content inline-flex items-center", g.forEach((
|
|
781
|
-
l.appendChild(
|
|
780
|
+
l = document.createElement("span"), l.className = "mint-button-content inline-flex items-center", g.forEach((v) => {
|
|
781
|
+
l.appendChild(v);
|
|
782
782
|
});
|
|
783
|
-
const b = (
|
|
783
|
+
const b = (u = this._button.querySelector("mint-spinner")) == null ? void 0 : u.parentElement;
|
|
784
784
|
r && a === "left" ? b ? (b.insertAdjacentElement("afterend", r), r.insertAdjacentElement("afterend", l)) : (this._button.insertBefore(r, this._button.firstChild), r.insertAdjacentElement("afterend", l)) : r && a === "right" ? b ? (b.insertAdjacentElement("afterend", l), l.insertAdjacentElement("afterend", r)) : (this._button.insertBefore(l, this._button.firstChild), l.insertAdjacentElement("afterend", r)) : b ? b.insertAdjacentElement("afterend", l) : this._button.insertBefore(l, this._button.firstChild);
|
|
785
785
|
} else if (r && r.tagName === "MINT-ICON" && !r.parentElement) {
|
|
786
786
|
const b = (h = this._button.querySelector("mint-spinner")) == null ? void 0 : h.parentElement;
|
|
@@ -833,9 +833,9 @@ const W = class W extends HTMLElement {
|
|
|
833
833
|
});
|
|
834
834
|
}
|
|
835
835
|
};
|
|
836
|
-
|
|
837
|
-
let
|
|
838
|
-
customElements.get("mint-button") || customElements.define("mint-button",
|
|
836
|
+
j._activeShadowStyleInjected = !1;
|
|
837
|
+
let G = j;
|
|
838
|
+
customElements.get("mint-button") || customElements.define("mint-button", G);
|
|
839
839
|
class tt extends HTMLElement {
|
|
840
840
|
constructor() {
|
|
841
841
|
super(), this._button = null, this._checked = !1;
|
|
@@ -987,8 +987,8 @@ class tt extends HTMLElement {
|
|
|
987
987
|
let f = h.querySelector("mint-icon");
|
|
988
988
|
f || (f = document.createElement("mint-icon"), h.appendChild(f)), f.setAttribute("name", r);
|
|
989
989
|
} else d && d.remove();
|
|
990
|
-
let
|
|
991
|
-
n ? (
|
|
990
|
+
let u = this.querySelector(".mint-switch-info");
|
|
991
|
+
n ? (u || (u = document.createElement("span"), u.className = "mint-switch-info text-xs text-gray-500 dark:text-gray-400 select-none mt-1 block", l && l.parentElement === this ? this.insertBefore(u, l.nextSibling) : this.appendChild(u)), u.textContent = n, this.isDisabled() ? u.classList.add("opacity-40") : u.classList.remove("opacity-40")) : u && u.remove(), this._renderErrorState(), this._renderSkeleton(t);
|
|
992
992
|
}
|
|
993
993
|
setupEventListeners() {
|
|
994
994
|
this._button && this._button.addEventListener("click", this.handleToggle.bind(this));
|
|
@@ -2074,23 +2074,23 @@ class ht extends HTMLElement {
|
|
|
2074
2074
|
}, r.addEventListener("click", c._wrapperClickHandler));
|
|
2075
2075
|
let d = r.querySelector("mint-icon");
|
|
2076
2076
|
d || (d = document.createElement("mint-icon"), d.setAttribute("name", "check"), d.className = "w-3.5 h-3.5 text-white pointer-events-none absolute inset-0 m-auto", d.style.transition = "opacity 200ms ease-out, transform 200ms ease-out", d.style.zIndex = "1", r.appendChild(d)), this.updateVisualState();
|
|
2077
|
-
let
|
|
2077
|
+
let u = this.querySelector(".mint-checkbox-label-container");
|
|
2078
2078
|
const h = this.querySelector(".mint-checkbox-container");
|
|
2079
2079
|
if (e || i) {
|
|
2080
|
-
|
|
2081
|
-
let f =
|
|
2082
|
-
e ? (f || (f = document.createElement("span"), f.className = "mint-checkbox-label text-sm font-medium text-gray-900 dark:text-gray-100 cursor-pointer select-none",
|
|
2083
|
-
let
|
|
2084
|
-
if (i ? (
|
|
2085
|
-
|
|
2080
|
+
u ? h && u.parentElement !== h && h.appendChild(u) : (u = document.createElement("div"), u.className = "mint-checkbox-label-container flex flex-col gap-0.5 flex-1", h ? h.appendChild(u) : this.appendChild(u));
|
|
2081
|
+
let f = u.querySelector(".mint-checkbox-label");
|
|
2082
|
+
e ? (f || (f = document.createElement("span"), f.className = "mint-checkbox-label text-sm font-medium text-gray-900 dark:text-gray-100 cursor-pointer select-none", u.insertBefore(f, u.firstChild)), f.textContent = e, s ? f.classList.add("opacity-40") : f.classList.remove("opacity-40")) : f && f.remove();
|
|
2083
|
+
let p = u.querySelector(".mint-checkbox-info");
|
|
2084
|
+
if (i ? (p || (p = document.createElement("span"), p.className = "mint-checkbox-info text-xs text-gray-500 dark:text-gray-400 cursor-pointer select-none", u.appendChild(p)), p.textContent = i, s ? p.classList.add("opacity-40") : p.classList.remove("opacity-40")) : p && p.remove(), s)
|
|
2085
|
+
u.style.cursor = "default", u._clickHandler && (u.removeEventListener("click", u._clickHandler), u._clickHandler = null);
|
|
2086
2086
|
else {
|
|
2087
|
-
|
|
2088
|
-
const m =
|
|
2089
|
-
m &&
|
|
2087
|
+
u.style.cursor = "pointer";
|
|
2088
|
+
const m = u._clickHandler;
|
|
2089
|
+
m && u.removeEventListener("click", m), u._clickHandler = (g) => {
|
|
2090
2090
|
this._checkbox && (g.target === this._checkbox || this._checkbox.contains(g.target) || g.composedPath().includes(this._checkbox)) || this.toggle();
|
|
2091
|
-
},
|
|
2091
|
+
}, u.addEventListener("click", u._clickHandler);
|
|
2092
2092
|
}
|
|
2093
|
-
} else
|
|
2093
|
+
} else u && u.remove();
|
|
2094
2094
|
this._renderErrorState(), this._renderSkeleton(t);
|
|
2095
2095
|
}
|
|
2096
2096
|
setupEventListeners() {
|
|
@@ -2267,19 +2267,19 @@ class dt extends HTMLElement {
|
|
|
2267
2267
|
}, this.addEventListener("click", this._clickHandler));
|
|
2268
2268
|
}
|
|
2269
2269
|
render() {
|
|
2270
|
-
var
|
|
2270
|
+
var p;
|
|
2271
2271
|
const t = this.isLoading(), e = this.isDisabled(), i = this.getValue(), s = this.closest("mint-choice"), n = (s == null ? void 0 : s.getAttribute("name")) || "";
|
|
2272
2272
|
let r = "";
|
|
2273
2273
|
const a = this.querySelector(".mint-choice-option-label");
|
|
2274
2274
|
if (a)
|
|
2275
|
-
r = ((
|
|
2275
|
+
r = ((p = a.textContent) == null ? void 0 : p.trim()) || "";
|
|
2276
2276
|
else {
|
|
2277
2277
|
const m = this.querySelector(".mint-choice-option-label-container");
|
|
2278
2278
|
Array.from(this.childNodes).forEach((g) => {
|
|
2279
2279
|
var b;
|
|
2280
2280
|
if (g !== m && g.nodeType === Node.TEXT_NODE) {
|
|
2281
|
-
const
|
|
2282
|
-
|
|
2281
|
+
const v = (b = g.textContent) == null ? void 0 : b.trim();
|
|
2282
|
+
v && (r += v);
|
|
2283
2283
|
}
|
|
2284
2284
|
});
|
|
2285
2285
|
}
|
|
@@ -2303,9 +2303,9 @@ class dt extends HTMLElement {
|
|
|
2303
2303
|
this._radio = document.createElement("input"), this._radio.type = "radio", this._radio.className = "sr-only", this._radio.style.position = "absolute", this._radio.style.width = "1px", this._radio.style.height = "1px", this._radio.style.padding = "0", this._radio.style.margin = "-1px", this._radio.style.overflow = "hidden", this._radio.style.clip = "rect(0, 0, 0, 0)", this._radio.style.whiteSpace = "nowrap", this._radio.style.border = "0", o.appendChild(this._radio), this._changeHandler = (g) => {
|
|
2304
2304
|
const b = this._checked;
|
|
2305
2305
|
this._checked = this._radio.checked, this._checked ? this.setAttribute("checked", "true") : this.removeAttribute("checked"), this._updateVisualState(), this._updateGroupState();
|
|
2306
|
-
const
|
|
2307
|
-
b !== this._checked &&
|
|
2308
|
-
|
|
2306
|
+
const v = this.closest("mint-choice");
|
|
2307
|
+
b !== this._checked && v && setTimeout(() => {
|
|
2308
|
+
v.dispatchEvent(new CustomEvent("choice-change", {
|
|
2309
2309
|
detail: { checked: this._checked, value: this.getValue() },
|
|
2310
2310
|
bubbles: !0,
|
|
2311
2311
|
cancelable: !0
|
|
@@ -2328,14 +2328,14 @@ class dt extends HTMLElement {
|
|
|
2328
2328
|
this._radio.name = n, this._radio.value = i, this._radio.checked !== this._checked ? (this._checked = this._radio.checked, this._checked ? this.setAttribute("checked", "true") : this.setAttribute("checked", "false")) : this._radio.checked = this._checked, this._radio.disabled = e, e ? this._radio.setAttribute("tabindex", "-1") : this._radio.removeAttribute("tabindex"), r ? this._radio.setAttribute("aria-label", r) : this._radio.removeAttribute("aria-label"), o.querySelectorAll(".mint-choice-option-indicator").forEach((m, g) => {
|
|
2329
2329
|
g > 0 && m.remove();
|
|
2330
2330
|
});
|
|
2331
|
-
let
|
|
2332
|
-
|
|
2331
|
+
let u = o.querySelector(".mint-choice-option-indicator");
|
|
2332
|
+
u || (u = document.createElement("div"), u.className = "mint-choice-option-indicator", o.appendChild(u)), u.className = "mint-choice-option-indicator w-2 h-2 rounded-full bg-white transition-all duration-200 pointer-events-none", u.style.position = "absolute", u.style.top = "50%", u.style.left = "50%", u.style.transform = this._checked ? "translate(-50%, -50%) scale(1)" : "translate(-50%, -50%) scale(0)", u.style.opacity = this._checked ? "1" : "0", this._updateVisualState(), this._renderSkeleton(t);
|
|
2333
2333
|
const h = this.getInfo();
|
|
2334
2334
|
let f = this.querySelector(".mint-choice-option-label-container");
|
|
2335
2335
|
if (r || h) {
|
|
2336
2336
|
f || (f = document.createElement("div"), f.className = "mint-choice-option-label-container flex flex-col gap-0.5", this.appendChild(f), Array.from(this.childNodes).forEach((b) => {
|
|
2337
|
-
var
|
|
2338
|
-
b.nodeType === Node.TEXT_NODE && ((
|
|
2337
|
+
var v;
|
|
2338
|
+
b.nodeType === Node.TEXT_NODE && ((v = b.textContent) != null && v.trim()) && b !== f && (b.textContent = "");
|
|
2339
2339
|
}));
|
|
2340
2340
|
let m = f.querySelector(".mint-choice-option-label");
|
|
2341
2341
|
r ? (m || (m = document.createElement("span"), m.className = "mint-choice-option-label", f.appendChild(m)), m.className = `mint-choice-option-label text-sm text-gray-900 dark:text-gray-100 ${e ? "opacity-40" : ""}`, m.textContent = r) : m && m.remove();
|
|
@@ -2761,9 +2761,9 @@ class pt extends HTMLElement {
|
|
|
2761
2761
|
return this.getAttribute("loading") === "true";
|
|
2762
2762
|
}
|
|
2763
2763
|
render() {
|
|
2764
|
-
var
|
|
2764
|
+
var v, _, k, S;
|
|
2765
2765
|
this.getType();
|
|
2766
|
-
const t = this._getNormalizedType(), e = this._isTextarea(), i = this._isMoney(), s = this._isColor(), n = this.getPlaceholder(), r = this.isDisabled(), a = this.isReadonly(), l = this.isRequired(), o = this.getId(), c = this.getName(), d = this.getAttribute("value") || (s ? "#000000" : ""),
|
|
2766
|
+
const t = this._getNormalizedType(), e = this._isTextarea(), i = this._isMoney(), s = this._isColor(), n = this.getPlaceholder(), r = this.isDisabled(), a = this.isReadonly(), l = this.isRequired(), o = this.getId(), c = this.getName(), d = this.getAttribute("value") || (s ? "#000000" : ""), u = this.getRows(), h = this.getIcon(), f = this.getLabel(), p = this.getInfo(), m = this.isLoading();
|
|
2767
2767
|
if (this._renderSkeleton(m), s) {
|
|
2768
2768
|
this._input && (this._input.remove(), this._input = null), this._textarea && (this._textarea.remove(), this._textarea = null), this._wrapper || (this._wrapper = document.createElement("div"), this._wrapper.className = "relative w-full", this.appendChild(this._wrapper)), this._colorContainer && (this._colorContainer.remove(), this._colorContainer = null), this._colorPickerWrapper && !s && (this._colorPickerWrapper.remove(), this._colorPickerWrapper = null), this._colorPickerWrapper || (this._colorPickerWrapper = document.createElement("div"), this._colorPickerWrapper.className = "mint-color-picker-wrapper absolute left-[.65rem] top-1/2 -translate-y-1/2 w-6 h-6 rounded cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500", this._colorPickerWrapper.style.backgroundColor = d || "#000000", this._wrapper.appendChild(this._colorPickerWrapper), this._colorPicker = document.createElement("input"), this._colorPicker.type = "color", this._colorPicker.className = "absolute inset-0 w-full h-full opacity-0 cursor-pointer", this._colorPicker.style.cssText = "position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; z-index: 10; pointer-events: auto; margin: 0; padding: 0; border: none;", this._colorPickerWrapper.appendChild(this._colorPicker), this._focusHandler = (y) => {
|
|
2769
2769
|
this._colorPickerWrapper && this._colorPicker && this._colorPicker.matches(":focus-visible") && requestAnimationFrame(() => {
|
|
@@ -2797,10 +2797,10 @@ class pt extends HTMLElement {
|
|
|
2797
2797
|
cancelable: !0
|
|
2798
2798
|
})));
|
|
2799
2799
|
}), this._colorTextInput.addEventListener("blur", () => {
|
|
2800
|
-
var x,
|
|
2800
|
+
var x, A;
|
|
2801
2801
|
const y = ((x = this._colorTextInput) == null ? void 0 : x.value) || "";
|
|
2802
2802
|
/^#[0-9A-Fa-f]{6}$/.test(y) ? (this._colorPicker && (this._colorPicker.value = y), this.setAttribute("value", y)) : this._colorPicker && this._colorTextInput && (this._colorTextInput.value = this._colorPicker.value), this.dispatchEvent(new CustomEvent("change", {
|
|
2803
|
-
detail: { value: ((
|
|
2803
|
+
detail: { value: ((A = this._colorPicker) == null ? void 0 : A.value) || "#000000" },
|
|
2804
2804
|
bubbles: !0,
|
|
2805
2805
|
cancelable: !0
|
|
2806
2806
|
}));
|
|
@@ -2821,22 +2821,22 @@ class pt extends HTMLElement {
|
|
|
2821
2821
|
const y = document.createElement("mint-icon");
|
|
2822
2822
|
y.setAttribute("name", "caret-down"), y.className = "w-[1rem] h-[1rem]", this._numberDecrementButton.appendChild(y), this._numberSpinnerContainer.appendChild(this._numberDecrementButton), this._numberIncrementButton.addEventListener("click", (x) => {
|
|
2823
2823
|
if (x.preventDefault(), x.stopPropagation(), this._input && !this._input.disabled && !this._input.readOnly) {
|
|
2824
|
-
const
|
|
2825
|
-
let
|
|
2826
|
-
|
|
2824
|
+
const A = parseFloat(this._input.value) || 0, O = parseFloat(this._input.step) || 1, M = this._input.min ? parseFloat(this._input.min) : void 0, N = this._input.max ? parseFloat(this._input.max) : void 0;
|
|
2825
|
+
let D = A + O;
|
|
2826
|
+
N !== void 0 && D > N && (D = N), M !== void 0 && D < M && (D = M), this._input.value = D.toString(), this.setAttribute("value", D.toString()), this._input.dispatchEvent(new Event("input", { bubbles: !0 })), this._input.dispatchEvent(new Event("change", { bubbles: !0 }));
|
|
2827
2827
|
}
|
|
2828
2828
|
}), this._numberDecrementButton.addEventListener("click", (x) => {
|
|
2829
2829
|
if (x.preventDefault(), x.stopPropagation(), this._input && !this._input.disabled && !this._input.readOnly) {
|
|
2830
|
-
const
|
|
2831
|
-
let
|
|
2832
|
-
|
|
2830
|
+
const A = parseFloat(this._input.value) || 0, O = parseFloat(this._input.step) || 1, M = this._input.min ? parseFloat(this._input.min) : void 0, N = this._input.max ? parseFloat(this._input.max) : void 0;
|
|
2831
|
+
let D = A - O;
|
|
2832
|
+
M !== void 0 && D < M && (D = M), N !== void 0 && D > N && (D = N), this._input.value = D.toString(), this.setAttribute("value", D.toString()), this._input.dispatchEvent(new Event("input", { bubbles: !0 })), this._input.dispatchEvent(new Event("change", { bubbles: !0 }));
|
|
2833
2833
|
}
|
|
2834
2834
|
});
|
|
2835
2835
|
}
|
|
2836
2836
|
this._numberIncrementButton && (this._numberIncrementButton.disabled = r || a), this._numberDecrementButton && (this._numberDecrementButton.disabled = r || a);
|
|
2837
2837
|
} else this._numberSpinnerContainer && (this._numberSpinnerContainer.remove(), this._numberSpinnerContainer = null, this._numberIncrementButton = null, this._numberDecrementButton = null);
|
|
2838
2838
|
if (e) {
|
|
2839
|
-
if (this._input && (this._input.remove(), this._input = null), this._textarea || (this._textarea = document.createElement("textarea"), this._wrapper.appendChild(this._textarea), this.setupEventListeners()), this._element = this._textarea, this._textarea.placeholder = n, this._textarea.disabled = r, this._textarea.readOnly = a, this._textarea.required = l, this._textarea.rows =
|
|
2839
|
+
if (this._input && (this._input.remove(), this._input = null), this._textarea || (this._textarea = document.createElement("textarea"), this._wrapper.appendChild(this._textarea), this.setupEventListeners()), this._element = this._textarea, this._textarea.placeholder = n, this._textarea.disabled = r, this._textarea.readOnly = a, this._textarea.required = l, this._textarea.rows = u, this._textarea.setAttribute("aria-invalid", this.hasError() ? "true" : "false"), d !== this._textarea.value && (this._textarea.value = d), o ? this._textarea.id = o : this._textarea.removeAttribute("id"), c ? this._textarea.name = c : this._textarea.removeAttribute("name"), this._textarea.className = this.getInputClasses(), this.firstChild && this.firstChild !== this._wrapper && this.firstChild.nodeType === Node.TEXT_NODE) {
|
|
2840
2840
|
const E = this.firstChild.textContent;
|
|
2841
2841
|
E && !this._textarea.value && (this._textarea.value = E.trim()), this.removeChild(this.firstChild);
|
|
2842
2842
|
}
|
|
@@ -2845,22 +2845,22 @@ class pt extends HTMLElement {
|
|
|
2845
2845
|
E && !this._input.value && (this._input.value = E.trim()), this.removeChild(this.firstChild);
|
|
2846
2846
|
}
|
|
2847
2847
|
let b = this.querySelector(".mint-input-label-container");
|
|
2848
|
-
if (f ||
|
|
2848
|
+
if (f || p) {
|
|
2849
2849
|
b || (b = document.createElement("div"), b.className = "mint-input-label-container flex flex-col gap-0.5 mb-[.25rem]", this._wrapper && this._wrapper.parentElement === this ? this.insertBefore(b, this._wrapper) : this.insertBefore(b, this.firstChild));
|
|
2850
2850
|
let E = b.querySelector(".mint-input-label");
|
|
2851
2851
|
if (f) {
|
|
2852
2852
|
E || (E = document.createElement("label"), E.className = "mint-input-label text-sm font-medium text-gray-900 dark:text-gray-100 select-none", b.insertBefore(E, b.firstChild)), E.textContent = f;
|
|
2853
|
-
const x = o || ((
|
|
2853
|
+
const x = o || ((v = this._element) == null ? void 0 : v.id) || ((_ = this._colorTextInput) == null ? void 0 : _.id) || ((k = this._input) == null ? void 0 : k.id) || ((S = this._textarea) == null ? void 0 : S.id);
|
|
2854
2854
|
if (x)
|
|
2855
2855
|
E.setAttribute("for", x);
|
|
2856
2856
|
else {
|
|
2857
|
-
const
|
|
2858
|
-
this._element ? this._element.id =
|
|
2857
|
+
const A = `mint-input-${Math.random().toString(36).substr(2, 9)}`;
|
|
2858
|
+
this._element ? this._element.id = A : this._colorTextInput ? this._colorTextInput.id = A : this._input ? this._input.id = A : this._textarea && (this._textarea.id = A), E.setAttribute("for", A);
|
|
2859
2859
|
}
|
|
2860
2860
|
r ? E.classList.add("opacity-40") : E.classList.remove("opacity-40");
|
|
2861
2861
|
} else E && E.remove();
|
|
2862
2862
|
let y = b.querySelector(".mint-input-info");
|
|
2863
|
-
|
|
2863
|
+
p ? (y || (y = document.createElement("span"), y.className = "mint-input-info text-xs text-gray-500 dark:text-gray-400 select-none", b.appendChild(y)), y.textContent = p, r ? y.classList.add("opacity-40") : y.classList.remove("opacity-40")) : y && y.remove();
|
|
2864
2864
|
} else b && b.remove();
|
|
2865
2865
|
this._renderErrorState(), this._renderSkeleton(m);
|
|
2866
2866
|
}
|
|
@@ -3027,7 +3027,10 @@ class ft extends HTMLElement {
|
|
|
3027
3027
|
}
|
|
3028
3028
|
getMode() {
|
|
3029
3029
|
const t = this.getAttribute("mode");
|
|
3030
|
-
|
|
3030
|
+
if (t === "month" || t === "year")
|
|
3031
|
+
return t;
|
|
3032
|
+
const e = this.getFormat().toLowerCase(), i = e.includes("d"), s = e.includes("m");
|
|
3033
|
+
return !i && !s ? "year" : !i && s ? "month" : "default";
|
|
3031
3034
|
}
|
|
3032
3035
|
getWeekStartDay() {
|
|
3033
3036
|
var i;
|
|
@@ -3177,13 +3180,13 @@ class ft extends HTMLElement {
|
|
|
3177
3180
|
const l = a.relatedTarget, o = l && (this._startPartInputs.includes(l) || this._endPartInputs.includes(l));
|
|
3178
3181
|
setTimeout(() => {
|
|
3179
3182
|
var d;
|
|
3180
|
-
if (!(this._startPartInputs.some((
|
|
3181
|
-
const
|
|
3183
|
+
if (!(this._startPartInputs.some((u) => u === document.activeElement) || this._endPartInputs.some((u) => u === document.activeElement)) && (o || this._handleBlur(((d = this._hiddenInput) == null ? void 0 : d.value) || ""), this._exitInputMode(), !o && this._hiddenInput)) {
|
|
3184
|
+
const u = new FocusEvent("blur", {
|
|
3182
3185
|
bubbles: !0,
|
|
3183
3186
|
cancelable: !0,
|
|
3184
3187
|
relatedTarget: a.relatedTarget
|
|
3185
3188
|
});
|
|
3186
|
-
this._hiddenInput.dispatchEvent(
|
|
3189
|
+
this._hiddenInput.dispatchEvent(u);
|
|
3187
3190
|
}
|
|
3188
3191
|
}, 0);
|
|
3189
3192
|
});
|
|
@@ -3211,25 +3214,26 @@ class ft extends HTMLElement {
|
|
|
3211
3214
|
_parseDateString(t, e) {
|
|
3212
3215
|
const i = /[\/\-\.\s]+/;
|
|
3213
3216
|
if (i.test(t)) {
|
|
3214
|
-
const
|
|
3215
|
-
if (
|
|
3216
|
-
let
|
|
3217
|
-
for (let
|
|
3218
|
-
const
|
|
3219
|
-
if (
|
|
3220
|
-
|
|
3221
|
-
else if (
|
|
3222
|
-
|
|
3223
|
-
else if (
|
|
3224
|
-
let
|
|
3225
|
-
const
|
|
3226
|
-
|
|
3217
|
+
const v = t.split(i).filter((k) => k.length > 0), _ = e.split(/[\/\-\.\s]+/).filter((k) => k.length > 0);
|
|
3218
|
+
if (v.length === _.length) {
|
|
3219
|
+
let k = 0, S = 0, E = 0;
|
|
3220
|
+
for (let A = 0; A < _.length; A++) {
|
|
3221
|
+
const O = _[A].toLowerCase(), M = v[A];
|
|
3222
|
+
if (O.includes("d"))
|
|
3223
|
+
k = parseInt(M, 10);
|
|
3224
|
+
else if (O.includes("m"))
|
|
3225
|
+
S = parseInt(M, 10) - 1;
|
|
3226
|
+
else if (O.includes("y")) {
|
|
3227
|
+
let N = parseInt(M, 10);
|
|
3228
|
+
const D = O.length, Y = M.length;
|
|
3229
|
+
Y === 2 && D === 4 ? N = Math.floor((/* @__PURE__ */ new Date()).getFullYear() / 100) * 100 + N : Y === 2 && D === 2 && (N = Math.floor((/* @__PURE__ */ new Date()).getFullYear() / 100) * 100 + N), E = N;
|
|
3227
3230
|
}
|
|
3228
3231
|
}
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
|
|
3232
|
+
const y = _.some((A) => A.toLowerCase().includes("d")), x = _.some((A) => A.toLowerCase().includes("m"));
|
|
3233
|
+
if (y || (k = 1), x || (S = 0), S >= 0 && S <= 11 && E) {
|
|
3234
|
+
const A = new Date(E, S, k);
|
|
3235
|
+
if (!isNaN(A.getTime()))
|
|
3236
|
+
return y && A.getDate() !== k || A.getMonth() !== S || A.getFullYear() !== E ? null : A;
|
|
3233
3237
|
}
|
|
3234
3238
|
}
|
|
3235
3239
|
}
|
|
@@ -3239,27 +3243,28 @@ class ft extends HTMLElement {
|
|
|
3239
3243
|
{ char: "d", index: a },
|
|
3240
3244
|
{ char: "m", index: l },
|
|
3241
3245
|
{ char: "y", index: o }
|
|
3242
|
-
].sort((
|
|
3243
|
-
let d = 0,
|
|
3246
|
+
].sort((v, _) => v.index - _.index);
|
|
3247
|
+
let d = 0, u = 0, h = 0, f = 0;
|
|
3244
3248
|
r.length, n.length;
|
|
3245
|
-
for (const
|
|
3246
|
-
if (
|
|
3247
|
-
const
|
|
3248
|
-
if (
|
|
3249
|
-
d = parseInt(
|
|
3250
|
-
} else if (
|
|
3251
|
-
const
|
|
3252
|
-
if (
|
|
3253
|
-
|
|
3254
|
-
} else if (
|
|
3255
|
-
const
|
|
3256
|
-
if (
|
|
3257
|
-
let
|
|
3258
|
-
|
|
3249
|
+
for (const v of c)
|
|
3250
|
+
if (v.char === "d") {
|
|
3251
|
+
const _ = r.lastIndexOf("d") - r.indexOf("d") + 1, k = n.substr(f, _);
|
|
3252
|
+
if (k.length === 0) return null;
|
|
3253
|
+
d = parseInt(k, 10), f += k.length;
|
|
3254
|
+
} else if (v.char === "m") {
|
|
3255
|
+
const _ = r.lastIndexOf("m") - r.indexOf("m") + 1, k = n.substr(f, _);
|
|
3256
|
+
if (k.length === 0) return null;
|
|
3257
|
+
u = parseInt(k, 10) - 1, f += k.length;
|
|
3258
|
+
} else if (v.char === "y") {
|
|
3259
|
+
const _ = r.lastIndexOf("y") - r.indexOf("y") + 1, k = n.substr(f), S = Math.min(_, k.length), E = k.substr(0, S);
|
|
3260
|
+
if (E.length === 0) return null;
|
|
3261
|
+
let y = parseInt(E, 10);
|
|
3262
|
+
S === 2 && _ === 4 ? y = Math.floor((/* @__PURE__ */ new Date()).getFullYear() / 100) * 100 + y : S === 2 && _ === 2 && (y = Math.floor((/* @__PURE__ */ new Date()).getFullYear() / 100) * 100 + y), h = y, f += S;
|
|
3259
3263
|
}
|
|
3260
|
-
|
|
3261
|
-
|
|
3262
|
-
|
|
3264
|
+
const p = e.toLowerCase(), m = p.includes("d"), g = p.includes("m");
|
|
3265
|
+
if (m || (d = 1), g || (u = 0), u < 0 || u > 11 || !h) return null;
|
|
3266
|
+
const b = new Date(h, u, d);
|
|
3267
|
+
return isNaN(b.getTime()) || m && b.getDate() !== d || b.getMonth() !== u || b.getFullYear() !== h ? null : b;
|
|
3263
3268
|
}
|
|
3264
3269
|
_formatDate(t, e) {
|
|
3265
3270
|
const i = t.getDate(), s = t.getMonth() + 1, n = t.getFullYear(), r = e.toLowerCase();
|
|
@@ -3269,114 +3274,114 @@ class ft extends HTMLElement {
|
|
|
3269
3274
|
// PHP-style formatter for display mode
|
|
3270
3275
|
_formatDatePhp(t, e) {
|
|
3271
3276
|
const i = t.getDate(), s = t.getMonth() + 1, n = t.getFullYear(), r = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], a = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], l = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], o = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], c = (h, f = 2) => h.toString().padStart(f, "0"), d = (h) => {
|
|
3272
|
-
const f = h % 10,
|
|
3273
|
-
return f === 1 &&
|
|
3277
|
+
const f = h % 10, p = h % 100;
|
|
3278
|
+
return f === 1 && p !== 11 ? "st" : f === 2 && p !== 12 ? "nd" : f === 3 && p !== 13 ? "rd" : "th";
|
|
3274
3279
|
};
|
|
3275
|
-
let
|
|
3280
|
+
let u = "";
|
|
3276
3281
|
for (let h = 0; h < e.length; h++) {
|
|
3277
3282
|
const f = e[h];
|
|
3278
3283
|
if (f === "\\" && h + 1 < e.length) {
|
|
3279
|
-
|
|
3284
|
+
u += e[h + 1], h++;
|
|
3280
3285
|
continue;
|
|
3281
3286
|
}
|
|
3282
3287
|
switch (f) {
|
|
3283
3288
|
case "Y":
|
|
3284
|
-
|
|
3289
|
+
u += n.toString();
|
|
3285
3290
|
break;
|
|
3286
3291
|
case "y":
|
|
3287
|
-
|
|
3292
|
+
u += n.toString().slice(-2);
|
|
3288
3293
|
break;
|
|
3289
3294
|
case "m":
|
|
3290
|
-
|
|
3295
|
+
u += c(s);
|
|
3291
3296
|
break;
|
|
3292
3297
|
case "n":
|
|
3293
|
-
|
|
3298
|
+
u += s.toString();
|
|
3294
3299
|
break;
|
|
3295
3300
|
case "M":
|
|
3296
|
-
|
|
3301
|
+
u += o[s - 1];
|
|
3297
3302
|
break;
|
|
3298
3303
|
case "F":
|
|
3299
|
-
|
|
3304
|
+
u += l[s - 1];
|
|
3300
3305
|
break;
|
|
3301
3306
|
case "d":
|
|
3302
|
-
|
|
3307
|
+
u += c(i);
|
|
3303
3308
|
break;
|
|
3304
3309
|
case "j":
|
|
3305
|
-
|
|
3310
|
+
u += i.toString();
|
|
3306
3311
|
break;
|
|
3307
3312
|
case "D":
|
|
3308
|
-
|
|
3313
|
+
u += a[t.getDay()];
|
|
3309
3314
|
break;
|
|
3310
3315
|
case "l":
|
|
3311
|
-
|
|
3316
|
+
u += r[t.getDay()];
|
|
3312
3317
|
break;
|
|
3313
3318
|
case "S":
|
|
3314
|
-
|
|
3319
|
+
u += d(i);
|
|
3315
3320
|
break;
|
|
3316
3321
|
default:
|
|
3317
|
-
|
|
3322
|
+
u += f;
|
|
3318
3323
|
break;
|
|
3319
3324
|
}
|
|
3320
3325
|
}
|
|
3321
|
-
return
|
|
3326
|
+
return u;
|
|
3322
3327
|
}
|
|
3323
3328
|
_validateDateString(t, e) {
|
|
3324
3329
|
const i = this._parseDateString(t, e);
|
|
3325
3330
|
return i !== null && !isNaN(i.getTime());
|
|
3326
3331
|
}
|
|
3327
3332
|
render() {
|
|
3328
|
-
const t = this.isLoading(), e = this.getLabel(), i = this.getInfo(), s = this.getValue(), n = this.isDisabled(), r = this.isReadonly(), a = this.isRequired(), l = this.getId(), o = this.getName(), c = this.getFormat(), d = this.hasError(),
|
|
3333
|
+
const t = this.isLoading(), e = this.getLabel(), i = this.getInfo(), s = this.getValue(), n = this.isDisabled(), r = this.isReadonly(), a = this.isRequired(), l = this.getId(), o = this.getName(), c = this.getFormat(), d = this.hasError(), u = this.getErrorMessage(), h = this.getSelectionMode();
|
|
3329
3334
|
this._isRange = this.isRange() || h === "week" || h === "month", this._input || (this._input = document.createElement("div"), this._input.className = "relative w-full", this.appendChild(this._input));
|
|
3330
3335
|
let f = this.querySelector(".mint-date-picker-label-container");
|
|
3331
3336
|
if (e || i) {
|
|
3332
3337
|
f || (f = document.createElement("div"), f.className = "mint-date-picker-label-container flex flex-col gap-0.5 mb-[.25rem]", this.contains(this._input) ? this.insertBefore(f, this._input) : this.appendChild(f));
|
|
3333
|
-
let
|
|
3334
|
-
e ? (
|
|
3338
|
+
let _ = f.querySelector(".mint-date-picker-label");
|
|
3339
|
+
e ? (_ || (_ = document.createElement("label"), _.className = "mint-date-picker-label text-sm font-medium text-gray-900 dark:text-gray-100 select-none", f.insertBefore(_, f.firstChild)), _.textContent = e, l && this._textInput && _.setAttribute("for", l)) : _ && _.remove();
|
|
3335
3340
|
let k = f.querySelector(".mint-date-picker-info");
|
|
3336
3341
|
i ? (k || (k = document.createElement("span"), k.className = "mint-date-picker-info text-xs text-gray-500 dark:text-gray-400 select-none", f.appendChild(k)), k.textContent = i) : k && k.remove();
|
|
3337
3342
|
} else f && f.remove();
|
|
3338
3343
|
this._hiddenInput || (this._hiddenInput = document.createElement("input"), this._hiddenInput.type = "hidden", this._hiddenInput.value = s || "", this._textInput = this._hiddenInput, this._input.appendChild(this._hiddenInput)), l && (this._hiddenInput.id = l), o && (this._hiddenInput.name = o), this._hiddenInput.value = s || "", this._hiddenInput.setAttribute("aria-invalid", d ? "true" : "false");
|
|
3339
|
-
let
|
|
3340
|
-
|
|
3344
|
+
let p = this._input.querySelector(".mint-date-fields");
|
|
3345
|
+
p || (p = document.createElement("div"), this._input.appendChild(p)), this._fieldsContainer = p, this._applyErrorVisuals(d, u, n), p.innerHTML = "", this._displayEl = document.createElement("div");
|
|
3341
3346
|
const m = r ? "select-text" : "select-none";
|
|
3342
3347
|
this._displayEl.className = `flex-1 text-gray-900 dark:text-white ${r ? "cursor-default" : "cursor-text"} ${m} focus:outline-none`, this._displayEl.tabIndex = n || r ? -1 : 0, this._displayEl.addEventListener("click", () => {
|
|
3343
3348
|
n || r || this._enterInputMode();
|
|
3344
|
-
}), this._displayEl.addEventListener("keydown", (
|
|
3345
|
-
n || r || (
|
|
3349
|
+
}), this._displayEl.addEventListener("keydown", (_) => {
|
|
3350
|
+
n || r || (_.key === "Enter" || _.key === " ") && (_.preventDefault(), this._enterInputMode());
|
|
3346
3351
|
}), this._inputsWrapperEl = document.createElement("div"), this._inputsWrapperEl.className = "flex items-center gap-1 w-full";
|
|
3347
3352
|
const g = this._getFormatTokens(c);
|
|
3348
3353
|
this._startPartInputs = [], this._endPartInputs = [];
|
|
3349
|
-
const b = (
|
|
3354
|
+
const b = (_) => {
|
|
3350
3355
|
const k = document.createDocumentFragment();
|
|
3351
|
-
return g.forEach((
|
|
3352
|
-
if (
|
|
3356
|
+
return g.forEach((S) => {
|
|
3357
|
+
if (S.type === "sep") {
|
|
3353
3358
|
const E = document.createElement("span");
|
|
3354
|
-
E.textContent =
|
|
3359
|
+
E.textContent = S.value, E.className = "text-gray-400 dark:text-gray-500 select-none", k.appendChild(E);
|
|
3355
3360
|
} else {
|
|
3356
|
-
const E =
|
|
3357
|
-
|
|
3361
|
+
const E = S.part === "d" ? "dd" : S.part === "m" ? "mm" : S.len === 2 ? "yy" : "yyyy", y = this._createPartInput(S.len, E, n, r, a);
|
|
3362
|
+
_ === "start" ? this._startPartInputs.push(y) : this._endPartInputs.push(y), k.appendChild(y);
|
|
3358
3363
|
}
|
|
3359
3364
|
}), k;
|
|
3360
3365
|
};
|
|
3361
3366
|
if (this._inputsWrapperEl.appendChild(b("start")), this._isRange) {
|
|
3362
|
-
const
|
|
3363
|
-
|
|
3367
|
+
const _ = document.createElement("span");
|
|
3368
|
+
_.textContent = " - ", _.className = "text-gray-400 dark:text-gray-500 select-none", this._inputsWrapperEl.appendChild(_), this._inputsWrapperEl.appendChild(b("end"));
|
|
3364
3369
|
}
|
|
3365
|
-
const
|
|
3366
|
-
if (
|
|
3370
|
+
const v = document.createElement("div");
|
|
3371
|
+
if (v.className = "flex flex-col w-full", this._displayEl.style.display = this._isInputMode ? "none" : "flex", this._inputsWrapperEl.style.display = this._isInputMode ? "flex" : "none", v.appendChild(this._displayEl), v.appendChild(this._inputsWrapperEl), p.appendChild(v), p.addEventListener("click", () => {
|
|
3367
3372
|
this._isInputMode || n || r || this._enterInputMode();
|
|
3368
|
-
}), this._attachPartInputHandlers(this._startPartInputs, g,
|
|
3373
|
+
}), this._attachPartInputHandlers(this._startPartInputs, g, p), this._isRange && this._attachPartInputHandlers(this._endPartInputs, g, p), this._parseValue(s), this._syncHiddenInput(), this._updateDisplayText(), this._iconButton)
|
|
3369
3374
|
this._iconButton.disabled = n || r, !n && !r ? this._iconButton.tabIndex = 0 : this._iconButton.tabIndex = -1;
|
|
3370
3375
|
else {
|
|
3371
3376
|
this._iconButton = document.createElement("button"), this._iconButton.type = "button", this._iconButton.tabIndex = 0, this._iconButton.className = "absolute left-2 top-[.55rem] text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 cursor-pointer z-10 focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500 pointer-events-auto disabled:opacity-40 disabled:cursor-not-allowed flex items-center justify-center rounded-sm";
|
|
3372
|
-
const
|
|
3373
|
-
this._iconButton.id =
|
|
3377
|
+
const _ = `date-icon-${Math.random().toString(36).substr(2, 9)}`;
|
|
3378
|
+
this._iconButton.id = _;
|
|
3374
3379
|
const k = document.createElement("mint-icon");
|
|
3375
3380
|
k.setAttribute("name", "calendar"), k.className = "w-4 h-4 pointer-events-none", this._iconButton.appendChild(k), this._iconButton.addEventListener("click", () => {
|
|
3376
3381
|
n || r || this._enterInputMode();
|
|
3377
3382
|
}), this._input.prepend(this._iconButton), this._iconButton.disabled = n || r;
|
|
3378
3383
|
}
|
|
3379
|
-
this._renderErrorState(d,
|
|
3384
|
+
this._renderErrorState(d, u), this._renderSkeleton(t);
|
|
3380
3385
|
}
|
|
3381
3386
|
_renderErrorState(t, e) {
|
|
3382
3387
|
let i = this.querySelector(".mint-date-picker-error");
|
|
@@ -3424,7 +3429,7 @@ class ft extends HTMLElement {
|
|
|
3424
3429
|
if (s) {
|
|
3425
3430
|
const [n, r] = this._splitRangeInput(t, e), a = n ? this._parseDateString(n, e) : null, l = r ? this._parseDateString(r, e) : null;
|
|
3426
3431
|
if (a && l) {
|
|
3427
|
-
const [o, c] = a <= l ? [a, l] : [l, a], d = this._formatDate(o, e),
|
|
3432
|
+
const [o, c] = a <= l ? [a, l] : [l, a], d = this._formatDate(o, e), u = this._formatDate(c, e), h = `${d} - ${u}`;
|
|
3428
3433
|
this.setValue(h), this._applyDateToParts(o, this._startPartInputs, this._getFormatTokens(e), e), this._applyDateToParts(c, this._endPartInputs, this._getFormatTokens(e), e), this._selectedStartDate = o, this._selectedEndDate = c, this._currentMonth = o.getMonth(), this._currentYear = o.getFullYear();
|
|
3429
3434
|
} else if (a) {
|
|
3430
3435
|
const o = this._formatDate(a, e);
|
|
@@ -3540,19 +3545,19 @@ class ft extends HTMLElement {
|
|
|
3540
3545
|
c.className = "flex-1 min-w-0";
|
|
3541
3546
|
const d = document.createElement("div");
|
|
3542
3547
|
d.className = "flex items-center justify-between mb-4";
|
|
3543
|
-
const
|
|
3544
|
-
|
|
3548
|
+
const u = document.createElement("button");
|
|
3549
|
+
u.type = "button", u.tabIndex = 0, u.className = "p-1 rounded hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-600 dark:text-gray-300 transition-colors flex items-center focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500", u.setAttribute("data-keep-popover-open", "true");
|
|
3545
3550
|
const h = document.createElement("mint-icon");
|
|
3546
|
-
h.setAttribute("name", "caret-left"), h.className = "w-4 h-4",
|
|
3551
|
+
h.setAttribute("name", "caret-left"), h.className = "w-4 h-4", u.appendChild(h), u.addEventListener("click", () => {
|
|
3547
3552
|
this._currentMonth === 0 ? (this._currentMonth = 11, this._currentYear--) : this._currentMonth--, this._buildCalendar();
|
|
3548
|
-
}), d.appendChild(
|
|
3553
|
+
}), d.appendChild(u);
|
|
3549
3554
|
const f = document.createElement("div");
|
|
3550
3555
|
f.className = "flex items-center gap-2";
|
|
3551
|
-
const
|
|
3552
|
-
|
|
3556
|
+
const p = document.createElement("button");
|
|
3557
|
+
p.type = "button", p.tabIndex = 0, p.className = "text-sm font-medium text-gray-900 dark:text-gray-100 hover:text-gray-600 dark:hover:text-gray-300 transition-colors flex items-center focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500", p.setAttribute("data-keep-popover-open", "true"), p.textContent = i[this._currentMonth], p.addEventListener("click", () => {
|
|
3553
3558
|
const C = this.getMode();
|
|
3554
3559
|
C !== "month" && C !== "year" && (this._viewMode = "month", this._buildCalendar());
|
|
3555
|
-
}), f.appendChild(
|
|
3560
|
+
}), f.appendChild(p);
|
|
3556
3561
|
const m = document.createElement("button");
|
|
3557
3562
|
m.type = "button", m.tabIndex = 0, m.className = "text-sm font-medium text-gray-900 dark:text-gray-100 hover:text-gray-600 dark:hover:text-gray-300 transition-colors flex items-center focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500", m.setAttribute("data-keep-popover-open", "true"), m.textContent = String(this._currentYear), m.addEventListener("click", () => {
|
|
3558
3563
|
this.getMode() !== "year" && (this._viewMode = "year", this._buildCalendar());
|
|
@@ -3563,46 +3568,46 @@ class ft extends HTMLElement {
|
|
|
3563
3568
|
b.setAttribute("name", "caret-right"), b.className = "w-4 h-4", g.appendChild(b), g.addEventListener("click", () => {
|
|
3564
3569
|
this._currentMonth === 11 ? (this._currentMonth = 0, this._currentYear++) : this._currentMonth++, this._buildCalendar();
|
|
3565
3570
|
}), d.appendChild(g);
|
|
3566
|
-
const _ = document.createElement("div");
|
|
3567
|
-
_.className = "grid grid-cols-7 mb-2", r.forEach((C) => {
|
|
3568
|
-
const I = document.createElement("div");
|
|
3569
|
-
I.className = "text-xs font-medium text-gray-500 dark:text-gray-400 text-center py-1", I.textContent = C, _.appendChild(I);
|
|
3570
|
-
});
|
|
3571
3571
|
const v = document.createElement("div");
|
|
3572
|
-
v.className = "grid grid-cols-7"
|
|
3573
|
-
|
|
3574
|
-
|
|
3575
|
-
|
|
3572
|
+
v.className = "grid grid-cols-7 mb-2", r.forEach((C) => {
|
|
3573
|
+
const T = document.createElement("div");
|
|
3574
|
+
T.className = "text-xs font-medium text-gray-500 dark:text-gray-400 text-center py-1", T.textContent = C, v.appendChild(T);
|
|
3575
|
+
});
|
|
3576
|
+
const _ = document.createElement("div");
|
|
3577
|
+
_.className = "grid grid-cols-7";
|
|
3578
|
+
const k = this.getMin() ? this._parseDateString(this.getMin(), this.getFormat()) : null, S = this.getMax() ? this._parseDateString(this.getMax(), this.getFormat()) : null, E = this._currentMonth === 0 ? 11 : this._currentMonth - 1, y = this._currentMonth === 0 ? this._currentYear - 1 : this._currentYear, x = this._getDaysInMonth(E, y), A = this._currentMonth === 11 ? 0 : this._currentMonth + 1, O = this._currentMonth === 11 ? this._currentYear + 1 : this._currentYear, M = e + t, Y = Math.ceil(M / 7) * 7 - M, W = (C, T, L) => {
|
|
3579
|
+
const V = this._isToday(C), $ = this._isDateSelected(C), B = this._isDateInRange(C), q = k && C < k || S && C > S;
|
|
3580
|
+
let P = "rounded-md";
|
|
3576
3581
|
if (this._isRange && this._selectedStartDate && this._selectedEndDate) {
|
|
3577
|
-
const
|
|
3578
|
-
|
|
3579
|
-
} else
|
|
3580
|
-
const
|
|
3581
|
-
|
|
3582
|
-
let
|
|
3583
|
-
return
|
|
3582
|
+
const H = this._isSameDate(C, this._selectedStartDate), I = this._isSameDate(C, this._selectedEndDate);
|
|
3583
|
+
H && I ? P = "rounded-md" : H ? P = "rounded-l-md" : I ? P = "rounded-r-md" : B && (P = "rounded-none");
|
|
3584
|
+
} else $ && !this._isRange && (P = "rounded-md");
|
|
3585
|
+
const F = document.createElement("button");
|
|
3586
|
+
F.type = "button", F.disabled = !!q, F.tabIndex = q ? -1 : 0;
|
|
3587
|
+
let z = `w-full h-8 ${P} border-0 text-sm font-medium transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500`;
|
|
3588
|
+
return L ? z += $ ? " bg-slate-800 dark:bg-slate-600 text-white" : B ? " bg-slate-100 dark:bg-slate-700 text-slate-800 dark:text-slate-200" : V ? " text-gray-900 dark:text-gray-100 font-semibold" : " text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700" : z += $ ? " bg-slate-800 dark:bg-slate-600 text-white" : B ? " bg-slate-100 dark:bg-slate-700 text-slate-800 dark:text-slate-200" : " text-gray-400 dark:text-gray-500 hover:bg-gray-100 dark:hover:bg-gray-700", z += q ? " opacity-40 cursor-not-allowed" : "", F.className = z, F.textContent = T.toString(), q || F.addEventListener("click", () => {
|
|
3584
3589
|
this._handleDateClick(C);
|
|
3585
|
-
}),
|
|
3590
|
+
}), F;
|
|
3586
3591
|
};
|
|
3587
3592
|
for (let C = e - 1; C >= 0; C--) {
|
|
3588
|
-
const
|
|
3589
|
-
|
|
3593
|
+
const T = x - C, L = new Date(y, E, T), V = W(L, T, !1);
|
|
3594
|
+
_.appendChild(V);
|
|
3590
3595
|
}
|
|
3591
3596
|
for (let C = 1; C <= t; C++) {
|
|
3592
|
-
const
|
|
3593
|
-
|
|
3597
|
+
const T = new Date(this._currentYear, this._currentMonth, C), L = W(T, C, !0);
|
|
3598
|
+
_.appendChild(L);
|
|
3594
3599
|
}
|
|
3595
|
-
for (let C = 1; C <=
|
|
3596
|
-
const
|
|
3597
|
-
|
|
3600
|
+
for (let C = 1; C <= Y; C++) {
|
|
3601
|
+
const T = new Date(O, A, C), L = W(T, C, !1);
|
|
3602
|
+
_.appendChild(L);
|
|
3598
3603
|
}
|
|
3599
3604
|
if (l) {
|
|
3600
3605
|
const C = document.createElement("div");
|
|
3601
3606
|
C.className = "mb-4 pb-4 border-b border-gray-200 dark:border-gray-700 md:mb-0 md:pb-0 md:border-b-0 md:border-r md:border-r-gray-200 dark:md:border-r-gray-700 md:pr-6 md:mr-0 md:w-32 md:flex-shrink-0 md:h-full md:flex md:flex-col";
|
|
3602
|
-
const
|
|
3603
|
-
|
|
3604
|
-
const
|
|
3605
|
-
|
|
3607
|
+
const T = document.createElement("div");
|
|
3608
|
+
T.className = "relative md:relative md:flex-1 md:min-h-0";
|
|
3609
|
+
const L = document.createElement("div");
|
|
3610
|
+
L.className = "flex gap-2 overflow-x-auto pb-1 md:flex-col md:overflow-x-visible md:overflow-y-auto md:pb-0 md:gap-2", L.style.scrollbarWidth = "none", L.style.msOverflowStyle = "none", L.style.setProperty("-webkit-overflow-scrolling", "touch");
|
|
3606
3611
|
const V = document.createElement("style");
|
|
3607
3612
|
V.textContent = `
|
|
3608
3613
|
.mint-date-shortcuts-row::-webkit-scrollbar {
|
|
@@ -3628,37 +3633,37 @@ class ft extends HTMLElement {
|
|
|
3628
3633
|
background: rgba(255, 255, 255, 0.2);
|
|
3629
3634
|
}
|
|
3630
3635
|
}
|
|
3631
|
-
`,
|
|
3632
|
-
const
|
|
3633
|
-
|
|
3636
|
+
`, L.classList.add("mint-date-shortcuts-row"), document.head.querySelector("style[data-mint-date-shortcuts]") || (V.setAttribute("data-mint-date-shortcuts", "true"), document.head.appendChild(V));
|
|
3637
|
+
const $ = document.createElement("div");
|
|
3638
|
+
$.className = "absolute left-0 top-0 bottom-0 w-8 pointer-events-none z-10 bg-gradient-to-r from-white dark:from-gray-800 to-transparent opacity-0 transition-opacity duration-200 md:hidden", T.appendChild($);
|
|
3639
|
+
const B = document.createElement("div");
|
|
3640
|
+
B.className = "absolute right-0 top-0 bottom-0 w-8 pointer-events-none z-10 bg-gradient-to-l from-white dark:from-gray-800 to-transparent opacity-100 transition-opacity duration-200 md:hidden", T.appendChild(B);
|
|
3634
3641
|
const q = document.createElement("div");
|
|
3635
|
-
q.className = "absolute
|
|
3636
|
-
const
|
|
3637
|
-
|
|
3638
|
-
const
|
|
3639
|
-
M.className = "hidden md:block absolute bottom-0 left-0 right-0 h-8 pointer-events-none z-10 bg-gradient-to-t from-white dark:from-gray-800 to-transparent opacity-100 transition-opacity duration-200", I.appendChild(M);
|
|
3640
|
-
const N = () => {
|
|
3642
|
+
q.className = "hidden md:block absolute top-0 left-0 right-0 h-8 pointer-events-none z-10 bg-gradient-to-b from-white dark:from-gray-800 to-transparent opacity-0 transition-opacity duration-200", T.appendChild(q);
|
|
3643
|
+
const P = document.createElement("div");
|
|
3644
|
+
P.className = "hidden md:block absolute bottom-0 left-0 right-0 h-8 pointer-events-none z-10 bg-gradient-to-t from-white dark:from-gray-800 to-transparent opacity-100 transition-opacity duration-200", T.appendChild(P);
|
|
3645
|
+
const F = () => {
|
|
3641
3646
|
if (window.innerWidth >= 768) {
|
|
3642
|
-
const
|
|
3643
|
-
|
|
3647
|
+
const H = L.scrollTop, I = L.scrollHeight, R = L.clientHeight;
|
|
3648
|
+
H > 0 ? q.style.opacity = "1" : q.style.opacity = "0", H + R < I - 1 ? P.style.opacity = "1" : P.style.opacity = "0", $.style.opacity = "0", B.style.opacity = "0";
|
|
3644
3649
|
} else {
|
|
3645
|
-
const
|
|
3646
|
-
|
|
3650
|
+
const H = L.scrollLeft, I = L.scrollWidth, R = L.clientWidth;
|
|
3651
|
+
H > 0 ? $.style.opacity = "1" : $.style.opacity = "0", H + R < I - 1 ? B.style.opacity = "1" : B.style.opacity = "0", q.style.opacity = "0", P.style.opacity = "0";
|
|
3647
3652
|
}
|
|
3648
3653
|
};
|
|
3649
|
-
|
|
3650
|
-
const
|
|
3651
|
-
|
|
3652
|
-
const
|
|
3653
|
-
if (
|
|
3654
|
-
if (this._isRange && "start" in
|
|
3655
|
-
this._selectedStartDate =
|
|
3656
|
-
const
|
|
3657
|
-
this.setValue(X), this._currentMonth =
|
|
3658
|
-
} else if (
|
|
3659
|
-
this._selectedStartDate =
|
|
3660
|
-
const
|
|
3661
|
-
this.setValue(
|
|
3654
|
+
L.addEventListener("scroll", F), window.addEventListener("resize", F), setTimeout(F, 0), a.forEach((z) => {
|
|
3655
|
+
const H = document.createElement("button");
|
|
3656
|
+
H.type = "button", H.tabIndex = 0, H.className = "px-3 py-1.5 text-xs font-medium rounded-md bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-600 transition-colors whitespace-nowrap flex-shrink-0 md:w-full md:text-left focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500", H.textContent = z.label, H.setAttribute("data-keep-popover-open", "true"), H.addEventListener("click", () => {
|
|
3657
|
+
const I = z.action();
|
|
3658
|
+
if (I) {
|
|
3659
|
+
if (this._isRange && "start" in I && "end" in I) {
|
|
3660
|
+
this._selectedStartDate = I.start, this._selectedEndDate = I.end;
|
|
3661
|
+
const R = this.getFormat(), U = this._formatDate(I.start, R), J = this._formatDate(I.end, R), X = `${U} - ${J}`;
|
|
3662
|
+
this.setValue(X), this._currentMonth = I.start.getMonth(), this._currentYear = I.start.getFullYear();
|
|
3663
|
+
} else if (I instanceof Date) {
|
|
3664
|
+
this._selectedStartDate = I, this._selectedEndDate = null;
|
|
3665
|
+
const R = this.getFormat(), U = this._formatDate(I, R);
|
|
3666
|
+
this.setValue(U), this._currentMonth = I.getMonth(), this._currentYear = I.getFullYear();
|
|
3662
3667
|
}
|
|
3663
3668
|
this._buildCalendar(), this._popover && typeof this._popover.close == "function" && this._popover.close(), this.dispatchEvent(new CustomEvent("input", {
|
|
3664
3669
|
detail: { value: this.getValue() },
|
|
@@ -3670,10 +3675,10 @@ class ft extends HTMLElement {
|
|
|
3670
3675
|
cancelable: !0
|
|
3671
3676
|
}));
|
|
3672
3677
|
}
|
|
3673
|
-
}),
|
|
3674
|
-
}),
|
|
3678
|
+
}), L.appendChild(H);
|
|
3679
|
+
}), T.appendChild(L), C.appendChild(T), o.appendChild(C);
|
|
3675
3680
|
}
|
|
3676
|
-
c.appendChild(d), c.appendChild(
|
|
3681
|
+
c.appendChild(d), c.appendChild(v), c.appendChild(_), o.appendChild(c), this._calendarContainer.appendChild(o);
|
|
3677
3682
|
}
|
|
3678
3683
|
_buildMonthView() {
|
|
3679
3684
|
if (!this._calendarContainer) return;
|
|
@@ -3699,10 +3704,10 @@ class ft extends HTMLElement {
|
|
|
3699
3704
|
l.className = "grid grid-cols-3 gap-2", t.forEach((o, c) => {
|
|
3700
3705
|
const d = document.createElement("button");
|
|
3701
3706
|
d.type = "button", d.tabIndex = 0, d.setAttribute("data-keep-popover-open", "true");
|
|
3702
|
-
const
|
|
3703
|
-
d.className = `p-2 rounded text-sm font-medium transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500 ${
|
|
3707
|
+
const u = this._currentMonth === c;
|
|
3708
|
+
d.className = `p-2 rounded text-sm font-medium transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500 ${u ? "bg-slate-800 dark:bg-slate-600 text-white" : "text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700"}`, d.textContent = o, d.addEventListener("click", () => {
|
|
3704
3709
|
if (this.getMode() === "month") {
|
|
3705
|
-
const f = new Date(this._currentYear, c, 1),
|
|
3710
|
+
const f = new Date(this._currentYear, c, 1), p = this.getFormat(), m = this._formatDate(f, p);
|
|
3706
3711
|
this.setValue(m), this._selectedStartDate = f, this._selectedEndDate = null, this._currentMonth = c, this.dispatchEvent(new CustomEvent("input", {
|
|
3707
3712
|
detail: { value: this.getValue() },
|
|
3708
3713
|
bubbles: !0,
|
|
@@ -3740,11 +3745,11 @@ class ft extends HTMLElement {
|
|
|
3740
3745
|
for (let c = t; c <= e; c++) {
|
|
3741
3746
|
const d = document.createElement("button");
|
|
3742
3747
|
d.type = "button", d.tabIndex = 0, d.setAttribute("data-keep-popover-open", "true");
|
|
3743
|
-
const
|
|
3744
|
-
d.className = `p-2 rounded text-sm font-medium transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500 ${
|
|
3748
|
+
const u = this._currentYear === c;
|
|
3749
|
+
d.className = `p-2 rounded text-sm font-medium transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500 ${u ? "bg-slate-800 dark:bg-slate-600 text-white" : "text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700"}`, d.textContent = String(c), d.addEventListener("click", () => {
|
|
3745
3750
|
const h = this.getMode();
|
|
3746
3751
|
if (h === "year") {
|
|
3747
|
-
const f = new Date(c, 0, 1),
|
|
3752
|
+
const f = new Date(c, 0, 1), p = this.getFormat(), m = this._formatDate(f, p);
|
|
3748
3753
|
this.setValue(m), this._selectedStartDate = f, this._selectedEndDate = null, this._currentYear = c, this._currentMonth = 0, this.dispatchEvent(new CustomEvent("input", {
|
|
3749
3754
|
detail: { value: this.getValue() },
|
|
3750
3755
|
bubbles: !0,
|
|
@@ -4075,28 +4080,28 @@ class mt extends HTMLElement {
|
|
|
4075
4080
|
h.appendChild(f), this.appendChild(h);
|
|
4076
4081
|
}
|
|
4077
4082
|
this._wrapper = document.createElement("div"), this._wrapper.className = "relative w-full", this.appendChild(this._wrapper), this._select = document.createElement("select"), this._select.className = this.getSelectClasses(), r && (this._select.id = r), a && (this._select.name = a), o && (this._select.disabled = !0), c && (this._select.multiple = !0), this._select.setAttribute("aria-invalid", d ? "true" : "false");
|
|
4078
|
-
const
|
|
4079
|
-
if (
|
|
4083
|
+
const u = i.length > 0 ? i : e;
|
|
4084
|
+
if (u.length > 0 && u.forEach((h) => {
|
|
4080
4085
|
this._select.appendChild(h);
|
|
4081
4086
|
}), this._select.options.length === 0) {
|
|
4082
4087
|
const h = document.createElement("option");
|
|
4083
4088
|
h.value = "", h.textContent = "Select an option", h.disabled = !0, h.selected = !0, this._select.appendChild(h);
|
|
4084
4089
|
}
|
|
4085
4090
|
if (this._select.value = l || "", this._changeHandler && this._select && this._select.removeEventListener("change", this._changeHandler), this._changeHandler = (h) => {
|
|
4086
|
-
const
|
|
4087
|
-
(this.getAttribute("value") || "") !==
|
|
4091
|
+
const p = h.target.value;
|
|
4092
|
+
(this.getAttribute("value") || "") !== p && (p ? this.setAttribute("value", p) : this.removeAttribute("value"));
|
|
4088
4093
|
const g = new Event("input", {
|
|
4089
4094
|
bubbles: !0,
|
|
4090
4095
|
cancelable: !0,
|
|
4091
4096
|
composed: !0
|
|
4092
4097
|
});
|
|
4093
4098
|
this.dispatchEvent(g), this.dispatchEvent(new CustomEvent("input", {
|
|
4094
|
-
detail: { value:
|
|
4099
|
+
detail: { value: p },
|
|
4095
4100
|
bubbles: !0,
|
|
4096
4101
|
cancelable: !0,
|
|
4097
4102
|
composed: !0
|
|
4098
4103
|
})), this.dispatchEvent(new CustomEvent("change", {
|
|
4099
|
-
detail: { value:
|
|
4104
|
+
detail: { value: p },
|
|
4100
4105
|
bubbles: !0,
|
|
4101
4106
|
cancelable: !0,
|
|
4102
4107
|
composed: !0
|
|
@@ -4105,7 +4110,7 @@ class mt extends HTMLElement {
|
|
|
4105
4110
|
const h = this.getAttribute("value") || this.value || "";
|
|
4106
4111
|
this._select && h && requestAnimationFrame(() => {
|
|
4107
4112
|
this._select && Array.from(this._select.options).some(
|
|
4108
|
-
(
|
|
4113
|
+
(p) => p.value === h
|
|
4109
4114
|
) && this._select.value !== h && (this._select.value = h);
|
|
4110
4115
|
});
|
|
4111
4116
|
}), this._optionObserver.observe(this._select, {
|
|
@@ -4246,14 +4251,14 @@ class gt extends HTMLElement {
|
|
|
4246
4251
|
render() {
|
|
4247
4252
|
const t = this.isLoading(), e = this.getLabel(), i = this.getAccept(), s = this.isMultiple(), n = this.isDisabled(), r = this.getWidth(), a = this.getHeight(), l = this.getName(), o = this.hasError(), c = this.getErrorMessage();
|
|
4248
4253
|
this._dropzone || (this._dropzone = document.createElement("div"), this.appendChild(this._dropzone)), this._updateDragStateClass(), this._dropzone.setAttribute("aria-invalid", o ? "true" : "false"), n ? (this._dropzone.setAttribute("tabindex", "-1"), this._dropzone.removeAttribute("role")) : (this._dropzone.setAttribute("tabindex", "0"), this._dropzone.setAttribute("role", "button"), this._dropzone.setAttribute("aria-label", e || "File upload dropzone")), this._dropzone.style.width = r, this._dropzone.style.height = a, this._dropzone.style.minWidth = r, this._dropzone.style.minHeight = a, this._fileInput || (this._fileInput = document.createElement("input"), this._fileInput.type = "file", this._fileInput.style.display = "none", this._fileInput.setAttribute("tabindex", "-1"), this._fileInput.setAttribute("aria-hidden", "true"), this._dropzone.appendChild(this._fileInput)), this._fileInput.accept = i, this._fileInput.multiple = s, this._fileInput.disabled = n, l ? this._fileInput.name = l : this._fileInput.removeAttribute("name"), this._fileInput.setAttribute("aria-invalid", o ? "true" : "false");
|
|
4249
|
-
const d = this._dropzone.querySelector(".mint-dropzone-icon"),
|
|
4250
|
-
d && d.remove(),
|
|
4254
|
+
const d = this._dropzone.querySelector(".mint-dropzone-icon"), u = this._dropzone.querySelector(".mint-dropzone-label");
|
|
4255
|
+
d && d.remove(), u && u.remove();
|
|
4251
4256
|
const h = document.createElement("div");
|
|
4252
4257
|
h.className = "mint-dropzone-icon flex items-center justify-center mt-2 mb-2 flex-shrink-0";
|
|
4253
4258
|
const f = document.createElement("mint-icon");
|
|
4254
4259
|
if (f.setAttribute("name", "upload"), f.className = "w-12 h-12 text-gray-400 dark:text-gray-500", h.appendChild(f), this._dropzone.appendChild(h), e) {
|
|
4255
|
-
const
|
|
4256
|
-
|
|
4260
|
+
const p = document.createElement("div");
|
|
4261
|
+
p.className = "mint-dropzone-label text-sm font-medium text-gray-600 dark:text-gray-400 text-center px-4 flex-shrink-0", p.textContent = e, this._dropzone.appendChild(p);
|
|
4257
4262
|
}
|
|
4258
4263
|
this.setupEventListeners(), this._renderErrorState(o, c), this._renderPreviews(), this._renderSkeleton(t);
|
|
4259
4264
|
}
|
|
@@ -4411,21 +4416,21 @@ class gt extends HTMLElement {
|
|
|
4411
4416
|
e.className = "mint-dropzone-previews w-full flex flex-col gap-2 max-h-48 overflow-y-auto overflow-x-hidden px-2 pb-2", this._selectedFiles.forEach((o, c) => {
|
|
4412
4417
|
const d = document.createElement("div");
|
|
4413
4418
|
if (d.className = "flex items-center gap-3 p-2 rounded border border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-900", o.type.startsWith("image/")) {
|
|
4414
|
-
const
|
|
4415
|
-
|
|
4419
|
+
const p = document.createElement("img");
|
|
4420
|
+
p.className = "w-12 h-12 object-cover rounded border border-gray-200 dark:border-gray-700";
|
|
4416
4421
|
const m = URL.createObjectURL(o);
|
|
4417
|
-
this._previewUrls.push(m),
|
|
4422
|
+
this._previewUrls.push(m), p.src = m, d.appendChild(p);
|
|
4418
4423
|
} else {
|
|
4419
|
-
const
|
|
4420
|
-
|
|
4424
|
+
const p = document.createElement("mint-icon");
|
|
4425
|
+
p.setAttribute("name", "attach"), p.className = "w-5 h-5 text-gray-500 dark:text-gray-300", d.appendChild(p);
|
|
4421
4426
|
}
|
|
4422
|
-
const
|
|
4423
|
-
|
|
4427
|
+
const u = document.createElement("div");
|
|
4428
|
+
u.className = "flex-1 text-sm text-gray-800 dark:text-gray-100 truncate", u.textContent = o.name, d.appendChild(u);
|
|
4424
4429
|
const h = document.createElement("button");
|
|
4425
4430
|
h.type = "button", h.className = "text-gray-500 hover:bg-red-100 dark:hover:bg-red-900/30 transition-colors flex items-center justify-center w-6 h-6 rounded-full";
|
|
4426
4431
|
const f = document.createElement("mint-icon");
|
|
4427
|
-
f.setAttribute("name", "close"), f.className = "w-4 h-4", h.appendChild(f), h.addEventListener("click", (
|
|
4428
|
-
|
|
4432
|
+
f.setAttribute("name", "close"), f.className = "w-4 h-4", h.appendChild(f), h.addEventListener("click", (p) => {
|
|
4433
|
+
p.preventDefault(), p.stopPropagation(), this._removeFileAt(c);
|
|
4429
4434
|
}), d.appendChild(h), e.appendChild(d);
|
|
4430
4435
|
});
|
|
4431
4436
|
const i = this.hasError(), s = this._isDragging;
|
|
@@ -4623,7 +4628,7 @@ class bt extends HTMLElement {
|
|
|
4623
4628
|
}
|
|
4624
4629
|
}
|
|
4625
4630
|
async _submitData(t, e) {
|
|
4626
|
-
var d,
|
|
4631
|
+
var d, u, h;
|
|
4627
4632
|
const i = this.getAttribute("action"), s = this.getAttribute("method"), n = this.getAttribute("enctype") || "application/x-www-form-urlencoded";
|
|
4628
4633
|
if (!i)
|
|
4629
4634
|
return { status: 0, ok: !0, data: { values: e } };
|
|
@@ -4631,10 +4636,10 @@ class bt extends HTMLElement {
|
|
|
4631
4636
|
let a = null;
|
|
4632
4637
|
const l = {};
|
|
4633
4638
|
let o = i;
|
|
4634
|
-
if (typeof window < "u" && ((h = (
|
|
4639
|
+
if (typeof window < "u" && ((h = (u = (d = window.mintForm) == null ? void 0 : d.defaults) == null ? void 0 : u.headers) != null && h.common) && Object.assign(l, window.mintForm.defaults.headers.common), this._headers && Object.assign(l, this._headers), s === "GET") {
|
|
4635
4640
|
const f = new URLSearchParams();
|
|
4636
|
-
t.forEach((
|
|
4637
|
-
|
|
4641
|
+
t.forEach((p, m) => {
|
|
4642
|
+
p instanceof File || f.append(m, String(p));
|
|
4638
4643
|
}), o += (i.includes("?") ? "&" : "?") + f.toString();
|
|
4639
4644
|
} else if (n === "multipart/form-data" || r)
|
|
4640
4645
|
a = t;
|
|
@@ -4642,8 +4647,8 @@ class bt extends HTMLElement {
|
|
|
4642
4647
|
a = JSON.stringify(e), l["Content-Type"] = "application/json";
|
|
4643
4648
|
else {
|
|
4644
4649
|
const f = new URLSearchParams();
|
|
4645
|
-
t.forEach((
|
|
4646
|
-
|
|
4650
|
+
t.forEach((p, m) => {
|
|
4651
|
+
p instanceof File || f.append(m, String(p));
|
|
4647
4652
|
}), a = f, l["Content-Type"] = "application/x-www-form-urlencoded";
|
|
4648
4653
|
}
|
|
4649
4654
|
if (typeof fetch == "function")
|
|
@@ -4652,10 +4657,10 @@ class bt extends HTMLElement {
|
|
|
4652
4657
|
method: s || "POST",
|
|
4653
4658
|
body: s === "GET" ? null : a,
|
|
4654
4659
|
headers: l
|
|
4655
|
-
}),
|
|
4656
|
-
let m =
|
|
4660
|
+
}), p = await f.text().catch(() => "");
|
|
4661
|
+
let m = p;
|
|
4657
4662
|
try {
|
|
4658
|
-
m = JSON.parse(
|
|
4663
|
+
m = JSON.parse(p);
|
|
4659
4664
|
} catch {
|
|
4660
4665
|
}
|
|
4661
4666
|
if (!f.ok) {
|
|
@@ -4667,41 +4672,41 @@ class bt extends HTMLElement {
|
|
|
4667
4672
|
} catch (f) {
|
|
4668
4673
|
if (f.response)
|
|
4669
4674
|
throw f;
|
|
4670
|
-
const
|
|
4675
|
+
const p = {
|
|
4671
4676
|
status: f.status || 0,
|
|
4672
4677
|
data: f.data || f.message || "Network error",
|
|
4673
4678
|
response: { status: f.status || 0, data: f.data || f.message || "Network error" }
|
|
4674
4679
|
};
|
|
4675
|
-
throw await this._applyErrorInterceptors(
|
|
4680
|
+
throw await this._applyErrorInterceptors(p);
|
|
4676
4681
|
}
|
|
4677
4682
|
const c = this;
|
|
4678
|
-
return await new Promise(async (f,
|
|
4683
|
+
return await new Promise(async (f, p) => {
|
|
4679
4684
|
const m = new XMLHttpRequest();
|
|
4680
4685
|
m.open(s || "POST", o, !0), Object.entries(l).forEach(([g, b]) => m.setRequestHeader(g, b)), m.onload = async function() {
|
|
4681
4686
|
const { status: g, responseText: b } = m;
|
|
4682
4687
|
if (g >= 200 && g < 300) {
|
|
4683
|
-
let
|
|
4688
|
+
let v = b;
|
|
4684
4689
|
try {
|
|
4685
|
-
|
|
4690
|
+
v = JSON.parse(b);
|
|
4686
4691
|
} catch {
|
|
4687
4692
|
}
|
|
4688
4693
|
try {
|
|
4689
|
-
const
|
|
4694
|
+
const _ = { status: g, ok: !0, data: v }, k = await c._applySuccessInterceptors(_);
|
|
4690
4695
|
f(k);
|
|
4691
|
-
} catch (
|
|
4692
|
-
|
|
4696
|
+
} catch (_) {
|
|
4697
|
+
p(_);
|
|
4693
4698
|
}
|
|
4694
4699
|
} else {
|
|
4695
|
-
let
|
|
4700
|
+
let v = b;
|
|
4696
4701
|
try {
|
|
4697
|
-
|
|
4702
|
+
v = JSON.parse(b);
|
|
4698
4703
|
} catch {
|
|
4699
4704
|
}
|
|
4700
4705
|
try {
|
|
4701
|
-
const
|
|
4702
|
-
|
|
4703
|
-
} catch (
|
|
4704
|
-
|
|
4706
|
+
const _ = { status: g, data: v, response: { status: g, data: v } }, k = await c._applyErrorInterceptors(_);
|
|
4707
|
+
p(k);
|
|
4708
|
+
} catch (_) {
|
|
4709
|
+
p(_);
|
|
4705
4710
|
}
|
|
4706
4711
|
}
|
|
4707
4712
|
}, m.onerror = async function() {
|
|
@@ -4711,9 +4716,9 @@ class bt extends HTMLElement {
|
|
|
4711
4716
|
data: m.responseText || "Network error",
|
|
4712
4717
|
response: { status: m.status || 0, data: m.responseText || "Network error" }
|
|
4713
4718
|
}, b = await c._applyErrorInterceptors(g);
|
|
4714
|
-
|
|
4719
|
+
p(b);
|
|
4715
4720
|
} catch (g) {
|
|
4716
|
-
|
|
4721
|
+
p(g);
|
|
4717
4722
|
}
|
|
4718
4723
|
}, m.send(s === "GET" ? null : a);
|
|
4719
4724
|
});
|
|
@@ -4758,7 +4763,7 @@ class bt extends HTMLElement {
|
|
|
4758
4763
|
const o = Array.from(l);
|
|
4759
4764
|
e[a] && Array.isArray(e[a]) ? o.forEach((c) => {
|
|
4760
4765
|
e[a].some(
|
|
4761
|
-
(
|
|
4766
|
+
(u) => u.name === c.name && u.size === c.size && u.lastModified === c.lastModified
|
|
4762
4767
|
) || e[a].push(c);
|
|
4763
4768
|
}) : e[a] = o;
|
|
4764
4769
|
}
|
|
@@ -5118,8 +5123,8 @@ class bt extends HTMLElement {
|
|
|
5118
5123
|
if (!n) return;
|
|
5119
5124
|
const r = this._getFieldName(n);
|
|
5120
5125
|
if (!r || !this._collectValidationRules()[r]) return;
|
|
5121
|
-
const l = this._extractFieldValue([n]), o = l != null && (typeof l == "string" ? l.trim() !== "" : l instanceof FileList || Array.isArray(l) ? l.length > 0 : !0), c = n.hasAttribute("data-mint-form-error") || s instanceof HTMLElement && (s.hasAttribute("aria-invalid") || s.closest("[data-mint-form-error]")), d = !!n.closest("mint-tags"),
|
|
5122
|
-
(o || c || d ||
|
|
5126
|
+
const l = this._extractFieldValue([n]), o = l != null && (typeof l == "string" ? l.trim() !== "" : l instanceof FileList || Array.isArray(l) ? l.length > 0 : !0), c = n.hasAttribute("data-mint-form-error") || s instanceof HTMLElement && (s.hasAttribute("aria-invalid") || s.closest("[data-mint-form-error]")), d = !!n.closest("mint-tags"), u = n.tagName === "MINT-CHECKBOX" || n.tagName === "MINT-SWITCH" || n.tagName === "MINT-CHOICE" || s instanceof HTMLElement && (s.closest("mint-checkbox, mint-switch, mint-choice") || s.closest("mint-choice-option")), h = n.tagName === "MINT-DATE-PICKER" || s instanceof HTMLElement && s.closest("mint-date-picker");
|
|
5127
|
+
(o || c || d || u || h) && setTimeout(() => {
|
|
5123
5128
|
this._validateField(r);
|
|
5124
5129
|
}, 0);
|
|
5125
5130
|
};
|
|
@@ -5436,7 +5441,7 @@ class _t extends HTMLElement {
|
|
|
5436
5441
|
]);
|
|
5437
5442
|
const o = r.querySelectorAll("th");
|
|
5438
5443
|
o.forEach((c, d) => {
|
|
5439
|
-
const
|
|
5444
|
+
const u = c.querySelector("mint-icon"), h = (u == null ? void 0 : u.getAttribute("name")) || "", f = u !== null && h !== "ellipsis";
|
|
5440
5445
|
this._setClasses(c, [
|
|
5441
5446
|
"text-left",
|
|
5442
5447
|
"font-semibold",
|
|
@@ -5454,22 +5459,22 @@ class _t extends HTMLElement {
|
|
|
5454
5459
|
if (a) {
|
|
5455
5460
|
const o = Array.from(a.querySelectorAll("tr"));
|
|
5456
5461
|
o.forEach((c, d) => {
|
|
5457
|
-
const
|
|
5462
|
+
const u = c.hasAttribute("data-row-clickable");
|
|
5458
5463
|
this._setClasses(c, [
|
|
5459
5464
|
"bg-white",
|
|
5460
5465
|
"dark:bg-gray-900",
|
|
5461
5466
|
"border-b",
|
|
5462
5467
|
"border-gray-200",
|
|
5463
5468
|
"dark:border-gray-700"
|
|
5464
|
-
]),
|
|
5469
|
+
]), u && c.classList.add("cursor-pointer", "hover:bg-gray-50", "dark:hover:bg-gray-800", "transition-colors"), d === o.length - 1 && c.classList.remove("border-b");
|
|
5465
5470
|
const h = c.querySelectorAll("td");
|
|
5466
|
-
h.forEach((f,
|
|
5471
|
+
h.forEach((f, p) => {
|
|
5467
5472
|
this._setClasses(f, [
|
|
5468
5473
|
"text-gray-900",
|
|
5469
5474
|
"dark:text-gray-100",
|
|
5470
5475
|
"px-3",
|
|
5471
5476
|
"py-2"
|
|
5472
|
-
]),
|
|
5477
|
+
]), p === 0 && f.classList.add("pl-6"), p === h.length - 1 && f.classList.add("pr-6"), e ? this._applyMobileCell(f, s) : this._restoreCell(f);
|
|
5473
5478
|
});
|
|
5474
5479
|
});
|
|
5475
5480
|
}
|
|
@@ -6245,7 +6250,7 @@ class xt extends HTMLElement {
|
|
|
6245
6250
|
}), this._configuration.sortBy || (this._configuration.sortBy = "id"), this._configuration.sort || (this._configuration.sort = "asc"));
|
|
6246
6251
|
}
|
|
6247
6252
|
async _fetchData(t, e = !0, i, s) {
|
|
6248
|
-
var l, o, c, d,
|
|
6253
|
+
var l, o, c, d, u, h, f, p;
|
|
6249
6254
|
if (!this._configuration) return;
|
|
6250
6255
|
const n = t || (typeof this._configuration.data == "string" ? this._configuration.data : null);
|
|
6251
6256
|
if (!n || this._fetching || this._loading)
|
|
@@ -6266,27 +6271,27 @@ class xt extends HTMLElement {
|
|
|
6266
6271
|
const b = await fetch(`${n}?${m.toString()}`, g);
|
|
6267
6272
|
if (!b.ok)
|
|
6268
6273
|
throw new Error(`HTTP error! status: ${b.status}`);
|
|
6269
|
-
const
|
|
6274
|
+
const v = await b.json(), _ = ((l = v.content) == null ? void 0 : l.rows) || [], k = ((o = v.content) == null ? void 0 : o.total) || 0;
|
|
6270
6275
|
if (this._configuration.loadMore && a !== 0)
|
|
6271
|
-
this._rows = this._rows.concat(
|
|
6276
|
+
this._rows = this._rows.concat(_);
|
|
6272
6277
|
else {
|
|
6273
|
-
let x =
|
|
6274
|
-
this._configuration.predefinedData ? (x = [...this._configuration.predefinedData, ...
|
|
6278
|
+
let x = _;
|
|
6279
|
+
this._configuration.predefinedData ? (x = [...this._configuration.predefinedData, ..._], this._totalRows = k + this._configuration.predefinedData.length) : this._totalRows = k, this._rows = x;
|
|
6275
6280
|
}
|
|
6276
|
-
const
|
|
6277
|
-
this._configuration.loadMore || (((c =
|
|
6281
|
+
const S = Math.floor(a / r) + 1;
|
|
6282
|
+
this._configuration.loadMore || (((c = v.content) == null ? void 0 : c.current_page) !== void 0 && v.content.current_page === S ? this._currentPage = v.content.current_page : this._currentPage = S, this._offset = (this._currentPage - 1) * r), this._lastPage = ((d = v.content) == null ? void 0 : d.last_page) || 1, this._fetching = !1, this._loaded = !0, this._loading = !1, this._fetchError = null, this._searching = !1;
|
|
6278
6283
|
const E = this._sorting;
|
|
6279
|
-
if (E && this._updateSortIcons(), this._sorting = !1, this._sortingColumn = null, E && this._updateSortIcons(), this.dispatchEvent(new CustomEvent("loaded", { detail: { rows: this._rows } })), this._updateSearchIcon(), (h = (
|
|
6284
|
+
if (E && this._updateSortIcons(), this._sorting = !1, this._sortingColumn = null, E && this._updateSortIcons(), this.dispatchEvent(new CustomEvent("loaded", { detail: { rows: this._rows } })), this._updateSearchIcon(), (h = (u = this.querySelector(`#${this._tableId}`)) == null ? void 0 : u.closest("table")) == null ? void 0 : h.querySelector("tbody")) {
|
|
6280
6285
|
if (E) {
|
|
6281
|
-
const x = this._loading,
|
|
6282
|
-
this._loading = !1, this._fetching = !1, this._updateTableBody(), this._loading = x, this._fetching =
|
|
6286
|
+
const x = this._loading, A = this._fetching;
|
|
6287
|
+
this._loading = !1, this._fetching = !1, this._updateTableBody(), this._loading = x, this._fetching = A;
|
|
6283
6288
|
} else
|
|
6284
6289
|
this._updateTableBody();
|
|
6285
6290
|
this._updatePagination();
|
|
6286
6291
|
} else
|
|
6287
6292
|
this.render();
|
|
6288
6293
|
} catch (m) {
|
|
6289
|
-
this._fetching = !1, this._loading = !1, this._loaded = !0, this._searching = !1, this._fetchError = m instanceof Error ? m.message : "Failed to fetch data", console.error("mint-resource-table: Error fetching data", m), this._updateSearchIcon(), ((
|
|
6294
|
+
this._fetching = !1, this._loading = !1, this._loaded = !0, this._searching = !1, this._fetchError = m instanceof Error ? m.message : "Failed to fetch data", console.error("mint-resource-table: Error fetching data", m), this._updateSearchIcon(), ((p = (f = this.querySelector(`#${this._tableId}`)) == null ? void 0 : f.closest("table")) == null ? void 0 : p.querySelector("tbody")) ? (this._updateTableBody(), this._updatePagination()) : this.render();
|
|
6290
6295
|
}
|
|
6291
6296
|
}
|
|
6292
6297
|
_getRows() {
|
|
@@ -6317,8 +6322,8 @@ class xt extends HTMLElement {
|
|
|
6317
6322
|
const h = c.getTime() - d.getTime();
|
|
6318
6323
|
return i === "asc" ? h : -h;
|
|
6319
6324
|
}
|
|
6320
|
-
const
|
|
6321
|
-
return i === "asc" ?
|
|
6325
|
+
const u = String(r).localeCompare(String(a), void 0, { numeric: !0, sensitivity: "base" });
|
|
6326
|
+
return i === "asc" ? u : -u;
|
|
6322
6327
|
}), this._perPage) {
|
|
6323
6328
|
const s = Math.ceil(t.length / this._perPage);
|
|
6324
6329
|
this._lastPage = s, t.forEach((n, r) => {
|
|
@@ -6409,28 +6414,28 @@ class xt extends HTMLElement {
|
|
|
6409
6414
|
const i = this.querySelector(`#search-${this._tableId}`), s = document.activeElement === i || (i == null ? void 0 : i.querySelector("input")) === document.activeElement, n = this._search;
|
|
6410
6415
|
let r = "";
|
|
6411
6416
|
if (!((this._fetching || this._loading) && !this._sorting) && (t.forEach((o, c) => {
|
|
6412
|
-
const d = typeof this._configuration.onRowClick == "function",
|
|
6413
|
-
r += `<tr data-row-index="${c}" ${d ? 'data-row-clickable="true"' : ""}${
|
|
6417
|
+
const d = typeof this._configuration.onRowClick == "function", u = d ? "cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors" : "";
|
|
6418
|
+
r += `<tr data-row-index="${c}" ${d ? 'data-row-clickable="true"' : ""}${u ? ` class="${u}"` : ""}>`, this._configuration.columns.forEach((h, f) => {
|
|
6414
6419
|
if (h.hidden) return;
|
|
6415
|
-
const
|
|
6416
|
-
if (r += `<td style="${this._getStyle(h)}" class="${this._getClasses(h, !0)}">`,
|
|
6420
|
+
const p = !h.show || h.show(this, o);
|
|
6421
|
+
if (r += `<td style="${this._getStyle(h)}" class="${this._getClasses(h, !0)}">`, p)
|
|
6417
6422
|
if (h.raw)
|
|
6418
6423
|
if (h.action)
|
|
6419
6424
|
(!h.action.show || h.action.show(this, o)) && (r += `<mint-button variant="solid" data-action="column-action" data-row-index="${c}" data-column-key="${this._configuration.columns.indexOf(h)}">${h.action.label}</mint-button>`);
|
|
6420
6425
|
else if (h.actions)
|
|
6421
6426
|
if (h.actionStyle !== "buttons") {
|
|
6422
6427
|
const m = `actions-popover-${this._tableId}-${c}`, g = `actions-button-${this._tableId}-${c}`;
|
|
6423
|
-
r += `<mint-button id="${g}" variant="link" icon="ellipsis">`, r += "</mint-button>", r += `<mint-popover id="${m}" trigger-id="${g}" direction="down">`, h.actions.forEach((b,
|
|
6428
|
+
r += `<mint-button id="${g}" variant="link" icon="ellipsis">`, r += "</mint-button>", r += `<mint-popover id="${m}" trigger-id="${g}" direction="down">`, h.actions.forEach((b, v) => {
|
|
6424
6429
|
if (!b.show || b.show(this, o)) {
|
|
6425
|
-
const
|
|
6426
|
-
r += `<div class="p-2 cursor-pointer hover:bg-gray-100 dark:hover:bg-gray-700" data-action="row-action" data-row-index="${c}" data-action-index="${
|
|
6430
|
+
const _ = typeof b.label == "function" ? b.label(this, o) : b.label;
|
|
6431
|
+
r += `<div class="p-2 cursor-pointer hover:bg-gray-100 dark:hover:bg-gray-700" data-action="row-action" data-row-index="${c}" data-action-index="${v}" data-column-key="${this._configuration.columns.indexOf(h)}">${_}</div>`;
|
|
6427
6432
|
}
|
|
6428
6433
|
}), r += "</mint-popover>";
|
|
6429
6434
|
} else
|
|
6430
6435
|
h.actions.forEach((m, g) => {
|
|
6431
6436
|
if (!m.show || m.show(this, o)) {
|
|
6432
|
-
const b = m.label ? typeof m.label == "function" ? m.label(this, o) : m.label : "",
|
|
6433
|
-
r += `<mint-button variant="link" class="${m.classes || ""}" data-action="row-action" data-row-index="${c}" data-action-index="${g}" data-column-key="${this._configuration.columns.indexOf(h)}"${
|
|
6437
|
+
const b = m.label ? typeof m.label == "function" ? m.label(this, o) : m.label : "", v = m.icon ? ` icon="${this._escapeHtml(m.icon)}"` : "", _ = m.tone ? ` tone="${this._escapeHtml(m.tone)}"` : "";
|
|
6438
|
+
r += `<mint-button variant="link" class="${m.classes || ""}" data-action="row-action" data-row-index="${c}" data-action-index="${g}" data-column-key="${this._configuration.columns.indexOf(h)}"${v}${_}>`, b && (r += this._escapeHtml(String(b))), r += "</mint-button>";
|
|
6434
6439
|
}
|
|
6435
6440
|
});
|
|
6436
6441
|
else typeof h.format == "function" ? r += h.format(this, o) : h.data && (r += this._escapeHtml(String(o[h.data] || "")));
|
|
@@ -6442,17 +6447,17 @@ class xt extends HTMLElement {
|
|
|
6442
6447
|
} else if (h.actions)
|
|
6443
6448
|
if (h.actionStyle !== "buttons") {
|
|
6444
6449
|
const m = `actions-popover-${this._tableId}-${c}`, g = `actions-button-${this._tableId}-${c}`;
|
|
6445
|
-
r += `<mint-button id="${g}" variant="link" icon="ellipsis">`, r += "</mint-button>", r += `<mint-popover id="${m}" trigger-id="${g}" direction="down">`, h.actions.forEach((b,
|
|
6450
|
+
r += `<mint-button id="${g}" variant="link" icon="ellipsis">`, r += "</mint-button>", r += `<mint-popover id="${m}" trigger-id="${g}" direction="down">`, h.actions.forEach((b, v) => {
|
|
6446
6451
|
if (!b.show || b.show(this, o)) {
|
|
6447
|
-
const
|
|
6448
|
-
r += `<div class="p-2 cursor-pointer hover:bg-gray-100 dark:hover:bg-gray-700" data-action="row-action" data-row-index="${c}" data-action-index="${
|
|
6452
|
+
const _ = typeof b.label == "function" ? b.label(this, o) : b.label;
|
|
6453
|
+
r += `<div class="p-2 cursor-pointer hover:bg-gray-100 dark:hover:bg-gray-700" data-action="row-action" data-row-index="${c}" data-action-index="${v}" data-column-key="${this._configuration.columns.indexOf(h)}">${_}</div>`;
|
|
6449
6454
|
}
|
|
6450
6455
|
}), r += "</mint-popover>";
|
|
6451
6456
|
} else
|
|
6452
6457
|
h.actions.forEach((m, g) => {
|
|
6453
6458
|
if (!m.show || m.show(this, o)) {
|
|
6454
|
-
const b = m.label ? typeof m.label == "function" ? m.label(this, o) : m.label : "",
|
|
6455
|
-
r += `<mint-button variant="link" class="${m.classes || ""}" data-action="row-action" data-row-index="${c}" data-action-index="${g}" data-column-key="${this._configuration.columns.indexOf(h)}"${
|
|
6459
|
+
const b = m.label ? typeof m.label == "function" ? m.label(this, o) : m.label : "", v = m.icon ? ` icon="${this._escapeHtml(m.icon)}"` : "", _ = m.tone ? ` tone="${this._escapeHtml(m.tone)}"` : "";
|
|
6460
|
+
r += `<mint-button variant="link" class="${m.classes || ""}" data-action="row-action" data-row-index="${c}" data-action-index="${g}" data-column-key="${this._configuration.columns.indexOf(h)}"${v}${_}>`, b && (r += this._escapeHtml(String(b))), r += "</mint-button>";
|
|
6456
6461
|
}
|
|
6457
6462
|
});
|
|
6458
6463
|
else typeof h.format == "function" ? r += this._escapeHtml(h.format(this, o)) : h.data && (r += this._escapeHtml(String(o[h.data] || "")));
|
|
@@ -6629,8 +6634,8 @@ class xt extends HTMLElement {
|
|
|
6629
6634
|
const l = typeof this._configuration.onRowClick == "function", o = l ? "cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors" : "";
|
|
6630
6635
|
s += `<tr data-row-index="${a}" ${l ? 'data-row-clickable="true"' : ""}${o ? ` class="${o}"` : ""}>`, this._configuration.columns.forEach((c, d) => {
|
|
6631
6636
|
if (c.hidden) return;
|
|
6632
|
-
const
|
|
6633
|
-
if (s += `<td style="${this._getStyle(c)}" class="${this._getClasses(c, !0)}">`,
|
|
6637
|
+
const u = !c.show || c.show(this, r);
|
|
6638
|
+
if (s += `<td style="${this._getStyle(c)}" class="${this._getClasses(c, !0)}">`, u)
|
|
6634
6639
|
if (c.raw)
|
|
6635
6640
|
if (c.action) {
|
|
6636
6641
|
if (!c.action.show || c.action.show(this, r)) {
|
|
@@ -6640,17 +6645,17 @@ class xt extends HTMLElement {
|
|
|
6640
6645
|
} else if (c.actions)
|
|
6641
6646
|
if (c.actionStyle !== "buttons") {
|
|
6642
6647
|
const h = `actions-popover-${this._tableId}-${a}`, f = `actions-button-${this._tableId}-${a}`;
|
|
6643
|
-
s += `<mint-button id="${f}" variant="link" icon="ellipsis">`, s += "</mint-button>", s += `<mint-popover id="${h}" trigger-id="${f}" direction="down">`, c.actions.forEach((
|
|
6644
|
-
if (!
|
|
6645
|
-
const g = typeof
|
|
6648
|
+
s += `<mint-button id="${f}" variant="link" icon="ellipsis">`, s += "</mint-button>", s += `<mint-popover id="${h}" trigger-id="${f}" direction="down">`, c.actions.forEach((p, m) => {
|
|
6649
|
+
if (!p.show || p.show(this, r)) {
|
|
6650
|
+
const g = typeof p.label == "function" ? p.label(this, r) : p.label;
|
|
6646
6651
|
s += `<div class="p-2 cursor-pointer hover:bg-gray-100 dark:hover:bg-gray-700" data-action="row-action" data-row-index="${a}" data-action-index="${m}" data-column-key="${this._configuration.columns.indexOf(c)}">${this._escapeHtml(String(g))}</div>`;
|
|
6647
6652
|
}
|
|
6648
6653
|
}), s += "</mint-popover>";
|
|
6649
6654
|
} else
|
|
6650
6655
|
c.actions.forEach((h, f) => {
|
|
6651
6656
|
if (!h.show || h.show(this, r)) {
|
|
6652
|
-
const
|
|
6653
|
-
s += `<mint-button variant="link" class="${h.classes || ""}" data-action="row-action" data-row-index="${a}" data-action-index="${f}" data-column-key="${this._configuration.columns.indexOf(c)}"${m}${g}>`,
|
|
6657
|
+
const p = h.label ? typeof h.label == "function" ? h.label(this, r) : h.label : "", m = h.icon ? ` icon="${this._escapeHtml(h.icon)}"` : "", g = h.tone ? ` tone="${this._escapeHtml(h.tone)}"` : "";
|
|
6658
|
+
s += `<mint-button variant="link" class="${h.classes || ""}" data-action="row-action" data-row-index="${a}" data-action-index="${f}" data-column-key="${this._configuration.columns.indexOf(c)}"${m}${g}>`, p && (s += this._escapeHtml(String(p))), s += "</mint-button>";
|
|
6654
6659
|
}
|
|
6655
6660
|
});
|
|
6656
6661
|
else typeof c.format == "function" ? s += c.format(this, r) : c.data && (s += this._escapeHtml(String(r[c.data] || "")));
|
|
@@ -6659,17 +6664,17 @@ class xt extends HTMLElement {
|
|
|
6659
6664
|
else if (c.actions)
|
|
6660
6665
|
if (c.actionStyle !== "buttons") {
|
|
6661
6666
|
const h = `actions-popover-${this._tableId}-${a}`, f = `actions-button-${this._tableId}-${a}`;
|
|
6662
|
-
s += `<mint-button id="${f}" variant="link" icon="ellipsis">`, s += "</mint-button>", s += `<mint-popover id="${h}" trigger-id="${f}" direction="down">`, c.actions.forEach((
|
|
6663
|
-
if (!
|
|
6664
|
-
const g = typeof
|
|
6667
|
+
s += `<mint-button id="${f}" variant="link" icon="ellipsis">`, s += "</mint-button>", s += `<mint-popover id="${h}" trigger-id="${f}" direction="down">`, c.actions.forEach((p, m) => {
|
|
6668
|
+
if (!p.show || p.show(this, r)) {
|
|
6669
|
+
const g = typeof p.label == "function" ? p.label(this, r) : p.label;
|
|
6665
6670
|
s += `<div class="p-2 cursor-pointer hover:bg-gray-100 dark:hover:bg-gray-700" data-action="row-action" data-row-index="${a}" data-action-index="${m}" data-column-key="${this._configuration.columns.indexOf(c)}">${this._escapeHtml(String(g))}</div>`;
|
|
6666
6671
|
}
|
|
6667
6672
|
}), s += "</mint-popover>";
|
|
6668
6673
|
} else
|
|
6669
6674
|
c.actions.forEach((h, f) => {
|
|
6670
6675
|
if (!h.show || h.show(this, r)) {
|
|
6671
|
-
const
|
|
6672
|
-
s += `<mint-button variant="link" class="${h.classes || ""}" data-action="row-action" data-row-index="${a}" data-action-index="${f}" data-column-key="${this._configuration.columns.indexOf(c)}"${m}${g}>`,
|
|
6676
|
+
const p = h.label ? typeof h.label == "function" ? h.label(this, r) : h.label : "", m = h.icon ? ` icon="${this._escapeHtml(h.icon)}"` : "", g = h.tone ? ` tone="${this._escapeHtml(h.tone)}"` : "";
|
|
6677
|
+
s += `<mint-button variant="link" class="${h.classes || ""}" data-action="row-action" data-row-index="${a}" data-action-index="${f}" data-column-key="${this._configuration.columns.indexOf(c)}"${m}${g}>`, p && (s += this._escapeHtml(String(p))), s += "</mint-button>";
|
|
6673
6678
|
}
|
|
6674
6679
|
});
|
|
6675
6680
|
else typeof c.format == "function" ? s += this._escapeHtml(c.format(this, r)) : c.data && (s += this._escapeHtml(String(r[c.data] || "")));
|
|
@@ -6846,34 +6851,34 @@ class wt extends HTMLElement {
|
|
|
6846
6851
|
const r = this._getPositionClasses(s, n);
|
|
6847
6852
|
this._offCanvas.className = r;
|
|
6848
6853
|
let a = this._offCanvas.querySelector(".off-canvas-content");
|
|
6849
|
-
if (a || (a = document.createElement("div"), a.className = "off-canvas-content bg-white dark:bg-gray-900 dark:border dark:border-gray-700 shadow-xl flex flex-col pointer-events-auto transition-all duration-300 ease-out", a.style.transform = this._getTransformValue(s, !1), this._offCanvas.appendChild(a)), i ? this._animateEnter() : this._animateExit(), Array.from(a.classList).forEach((
|
|
6850
|
-
(
|
|
6854
|
+
if (a || (a = document.createElement("div"), a.className = "off-canvas-content bg-white dark:bg-gray-900 dark:border dark:border-gray-700 shadow-xl flex flex-col pointer-events-auto transition-all duration-300 ease-out", a.style.transform = this._getTransformValue(s, !1), this._offCanvas.appendChild(a)), i ? this._animateEnter() : this._animateExit(), Array.from(a.classList).forEach((p) => {
|
|
6855
|
+
(p.startsWith("w-") || p.startsWith("max-w-")) && a.classList.remove(p);
|
|
6851
6856
|
}), a.classList.remove("h-full", "max-h-[90vh]", "max-h-screen"), n)
|
|
6852
6857
|
a.classList.add("w-full", "h-full");
|
|
6853
6858
|
else {
|
|
6854
|
-
const
|
|
6855
|
-
s === "top" || s === "bottom" ? a.classList.add("w-full", "max-h-[90vh]") : a.classList.add(
|
|
6859
|
+
const p = this.getWidth();
|
|
6860
|
+
s === "top" || s === "bottom" ? a.classList.add("w-full", "max-h-[90vh]") : a.classList.add(p, "h-full");
|
|
6856
6861
|
}
|
|
6857
6862
|
this._header || (this._header = document.createElement("div"), this._header.className = "flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-700 flex-shrink-0", a.appendChild(this._header)), this._headingSlot || (this._headingSlot = document.createElement("div"), this._headingSlot.className = "flex-1", this._headingSlot.setAttribute("slot", "heading"), this._header.appendChild(this._headingSlot));
|
|
6858
6863
|
let o = this._headingSlot.querySelector("mint-text");
|
|
6859
6864
|
e ? (o || (o = document.createElement("mint-text"), o.setAttribute("size", "sub-heading"), o.setAttribute("bold", "true"), this._headingSlot.appendChild(o)), o.textContent = e) : o && o.remove(), Array.from(this.children).filter(
|
|
6860
|
-
(
|
|
6861
|
-
).forEach((
|
|
6862
|
-
this._headingSlot &&
|
|
6865
|
+
(p) => p !== this._overlay && p !== this._offCanvas && p !== this._headingSlot && p.getAttribute("slot") === "heading"
|
|
6866
|
+
).forEach((p) => {
|
|
6867
|
+
this._headingSlot && p.parentElement !== this._headingSlot && this._headingSlot.appendChild(p);
|
|
6863
6868
|
}), this._closeButton || (this._closeButton = document.createElement("mint-button"), this._closeButton.setAttribute("variant", "ghost"), this._closeButton.setAttribute("icon", "close"), this._closeButton.addEventListener("click", () => this.close()), this._header.appendChild(this._closeButton)), this._bodySlot || (this._bodySlot = document.createElement("div"), this._bodySlot.className = "flex-1 overflow-y-auto p-4", this._bodySlot.setAttribute("slot", "body"), a.appendChild(this._bodySlot)), Array.from(this.children).filter(
|
|
6864
|
-
(
|
|
6865
|
-
).forEach((
|
|
6866
|
-
this._bodySlot &&
|
|
6869
|
+
(p) => p !== this._overlay && p !== this._offCanvas && p !== this._bodySlot && p.getAttribute("slot") === "body"
|
|
6870
|
+
).forEach((p) => {
|
|
6871
|
+
this._bodySlot && p.parentElement !== this._bodySlot && this._bodySlot.appendChild(p);
|
|
6867
6872
|
}), this._actionsSlot || (this._actionsSlot = document.createElement("div"), this._actionsSlot.className = "p-4 border-t border-gray-200 dark:border-gray-700 flex-shrink-0", this._actionsSlot.setAttribute("slot", "actions"), a.appendChild(this._actionsSlot));
|
|
6868
|
-
let
|
|
6869
|
-
|
|
6870
|
-
(
|
|
6871
|
-
).forEach((
|
|
6872
|
-
Array.from(
|
|
6873
|
-
g.parentElement !==
|
|
6874
|
-
}),
|
|
6875
|
-
}), Array.from(this.children).forEach((
|
|
6876
|
-
|
|
6873
|
+
let u = this._actionsSlot.querySelector("mint-stack");
|
|
6874
|
+
u || (u = document.createElement("mint-stack"), u.setAttribute("direction", "horizontal"), u.className = "justify-end", this._actionsSlot.appendChild(u)), Array.from(this.children).filter(
|
|
6875
|
+
(p) => p !== this._overlay && p !== this._offCanvas && p !== this._actionsSlot && p.getAttribute("slot") === "actions"
|
|
6876
|
+
).forEach((p) => {
|
|
6877
|
+
Array.from(p.children).forEach((g) => {
|
|
6878
|
+
g.parentElement !== u && u.appendChild(g);
|
|
6879
|
+
}), p.parentElement && p.remove();
|
|
6880
|
+
}), Array.from(this.children).forEach((p) => {
|
|
6881
|
+
p !== this._overlay && p !== this._offCanvas && p.getAttribute("slot") !== "heading" && p.getAttribute("slot") !== "body" && p.getAttribute("slot") !== "actions" && p !== this._headingSlot && p !== this._bodySlot && p !== this._actionsSlot && p.parentElement !== this._bodySlot && this._bodySlot.appendChild(p);
|
|
6877
6882
|
}), this._updateBackgroundColor();
|
|
6878
6883
|
}
|
|
6879
6884
|
_getPositionClasses(t, e) {
|
|
@@ -7247,7 +7252,7 @@ customElements.get("mint-tabs") || customElements.define("mint-tabs", Lt);
|
|
|
7247
7252
|
export {
|
|
7248
7253
|
Et as Alert,
|
|
7249
7254
|
nt as BackButton,
|
|
7250
|
-
|
|
7255
|
+
G as Button,
|
|
7251
7256
|
st as Card,
|
|
7252
7257
|
ht as Checkbox,
|
|
7253
7258
|
vt as Chip,
|
|
@@ -7276,5 +7281,5 @@ export {
|
|
|
7276
7281
|
Lt as Tabs,
|
|
7277
7282
|
yt as Tags,
|
|
7278
7283
|
et as Text,
|
|
7279
|
-
|
|
7284
|
+
G as default
|
|
7280
7285
|
};
|