monobill-mintui 0.2.98 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -35,8 +35,8 @@ class O extends HTMLElement {
35
35
  const e = this.getSize(), t = this.getAttribute("size") || "default", i = !!(this.style.width && this.style.height), s = this.getAttribute("data-button-variant"), n = document.documentElement.classList.contains("dark");
36
36
  let r;
37
37
  if (i) {
38
- const h = this.getAttribute("data-button-tone") || "neutral";
39
- s === "solid" ? h === "neutral" ? r = n ? "#ffffff" : "#0f172a" : r = "#ffffff" : r = n ? "#ffffff" : "#0f172a";
38
+ const c = this.getAttribute("data-button-tone") || "neutral";
39
+ s === "solid" ? c === "neutral" ? r = n ? "#ffffff" : "#0f172a" : r = "#ffffff" : r = n ? "#ffffff" : "#0f172a";
40
40
  } else
41
41
  r = n ? "#e2e8f0" : "#0f172a";
42
42
  const a = t === "large" ? "2" : "4", l = !!(this.style.width && this.style.height), o = `
@@ -118,39 +118,51 @@ class B extends HTMLElement {
118
118
  getName() {
119
119
  return this.getAttribute("name") || "";
120
120
  }
121
- getIconUrl() {
122
- var t;
123
- const e = (t = document.querySelector('meta[name="mint-icon-base-url"]')) == null ? void 0 : t.getAttribute("content");
124
- return e ? e === "local" ? `/icons/${this.getName()}.svg` : e === "cdn" ? `https://assets.gomonobill.com/mintui/icons/${this.getName()}.svg` : `${e.endsWith("/") ? e : `${e}/`}${this.getName()}.svg` : `https://assets.gomonobill.com/mintui/icons/${this.getName()}.svg`;
121
+ generateSVGMarkup(e) {
122
+ let t;
123
+ return e.fill && e.strokeWidth ? t = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="${e.viewBox}" fill="none" stroke="currentColor" stroke-width="${e.strokeWidth}" stroke-linecap="${e.strokeLinecap || "round"}" stroke-linejoin="${e.strokeLinejoin || "round"}">
124
+ <path d="${e.path}" />
125
+ </svg>` : e.fill ? e.viewBox === "0 0 512 512" ? t = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor">
126
+ <g transform="scale(0.046875)">
127
+ <path d="${e.path}" />
128
+ </g>
129
+ </svg>` : t = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="${e.viewBox}" fill="currentColor">
130
+ <path d="${e.path}" />
131
+ </svg>` : t = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="${e.viewBox}" fill="none" stroke="currentColor" stroke-width="${e.strokeWidth || "2"}" stroke-linecap="${e.strokeLinecap || "round"}" stroke-linejoin="${e.strokeLinejoin || "round"}">
132
+ <path d="${e.path}" />
133
+ </svg>`, t;
125
134
  }
126
135
  render() {
127
- var l, o, h;
136
+ var o, c, h;
128
137
  const e = this.getName();
129
138
  if (!e) {
130
- this.innerHTML = "", this.style.maskImage = "", this.style.webkitMaskImage = "";
139
+ this.innerHTML = "", this.style.maskImage = "", this.style.webkitMaskImage = "", this.style.backgroundColor = "";
131
140
  return;
132
141
  }
133
- if (!q(e)) {
134
- console.warn(`Icon "${e}" not found. Make sure you've imported the icon: import '@monobill-mintui/icon/icons/${e}'`), this.innerHTML = "", this.style.maskImage = "", this.style.webkitMaskImage = "";
142
+ const t = q(e);
143
+ if (!t) {
144
+ console.warn(`Icon "${e}" not found. Make sure you've imported the icon: import '@monobill-mintui/icon/icons/${e}'`), this.innerHTML = "", this.style.maskImage = "", this.style.webkitMaskImage = "", this.style.backgroundColor = "";
135
145
  return;
136
146
  }
137
- const i = this.closest("mint-button") || ((l = this.parentElement) == null ? void 0 : l.closest("mint-button")), s = this.closest("mint-switch") || ((o = this.parentElement) == null ? void 0 : o.closest("mint-switch")), n = this.closest("mint-select") || ((h = this.parentElement) == null ? void 0 : h.closest("mint-select"));
147
+ 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") || ((h = this.parentElement) == null ? void 0 : h.closest("mint-select"));
138
148
  if (!Array.from(this.classList).some(
139
- (c) => c.startsWith("w-") || c.startsWith("h-")
149
+ (d) => d.startsWith("w-") || d.startsWith("h-")
140
150
  ) && !n) {
141
- let c;
142
- s ? c = "w-3 h-3" : i ? c = "w-5 h-5" : c = "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"), c.split(" ").forEach((m) => {
143
- m && this.classList.add(m);
151
+ let d;
152
+ s ? d = "w-3 h-3" : i ? d = "w-5 h-5" : d = "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"), d.split(" ").forEach((u) => {
153
+ u && this.classList.add(u);
144
154
  });
145
155
  }
146
- const a = this.getIconUrl();
147
- if (this.style.maskImage = `url(${a})`, this.style.webkitMaskImage = `url(${a})`, this.style.maskSize = "contain", this.style.webkitMaskSize = "contain", this.style.maskRepeat = "no-repeat", this.style.webkitMaskRepeat = "no-repeat", this.style.maskPosition = "center", this.style.webkitMaskPosition = "center", this.style.aspectRatio = "1 / 1", this.style.backgroundColor = "currentColor", this.innerHTML = "", s)
156
+ const a = this.generateSVGMarkup(t);
157
+ this.innerHTML = a, this.style.maskImage = "", this.style.webkitMaskImage = "", this.style.maskSize = "", this.style.webkitMaskSize = "", this.style.maskRepeat = "", this.style.webkitMaskRepeat = "", this.style.maskPosition = "", this.style.webkitMaskPosition = "", this.style.backgroundColor = "", this.style.aspectRatio = "1 / 1";
158
+ const l = this.querySelector("svg");
159
+ if (l && (l.style.width = "100%", l.style.height = "100%"), s)
148
160
  this.classList.remove("text-gray-100", "text-gray-900"), this.classList.add("text-gray-900");
149
161
  else if (i)
150
162
  this.classList.remove("text-gray-100", "text-gray-900");
151
163
  else {
152
- const m = document.documentElement.classList.contains("dark") ? "text-gray-100" : "text-gray-900";
153
- this.classList.remove("text-gray-100", "text-gray-900"), this.classList.add(m);
164
+ const u = document.documentElement.classList.contains("dark") ? "text-gray-100" : "text-gray-900";
165
+ this.classList.remove("text-gray-100", "text-gray-900"), this.classList.add(u);
154
166
  }
155
167
  }
156
168
  }
@@ -172,7 +184,7 @@ class z extends HTMLElement {
172
184
  };
173
185
  }
174
186
  static get observedAttributes() {
175
- return ["variant", "tone", "disabled", "loading", "button-type", "type", "full-width", "icon-position", "icon"];
187
+ return ["variant", "tone", "disabled", "loading", "button-type", "type", "full-width", "icon-position", "icon", "active"];
176
188
  }
177
189
  connectedCallback() {
178
190
  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");
@@ -202,6 +214,17 @@ class z extends HTMLElement {
202
214
  isFullWidth() {
203
215
  return this.hasAttribute("full-width");
204
216
  }
217
+ isActive() {
218
+ const e = this.getAttribute("active");
219
+ return !(e === null || e === "false" || e === "0");
220
+ }
221
+ // Convenience property for programmatic usage: button.active = true/false
222
+ get active() {
223
+ return this.isActive();
224
+ }
225
+ set active(e) {
226
+ e ? this.setAttribute("active", "true") : this.removeAttribute("active");
227
+ }
205
228
  getIconPosition() {
206
229
  return this.getAttribute("icon-position") || "left";
207
230
  }
@@ -225,6 +248,151 @@ class z extends HTMLElement {
225
248
  }
226
249
  return !0;
227
250
  }
251
+ getActiveStateClasses() {
252
+ const e = this.getVariant(), t = this.getTone(), i = `${e}-${t}`;
253
+ return {
254
+ "solid-action": [
255
+ "!bg-slate-900",
256
+ "!shadow-[inset_0_2px_4px_rgba(0,0,0,0.3)]",
257
+ "dark:!bg-slate-700",
258
+ "hover:!bg-slate-900",
259
+ // Override hover to match active
260
+ "dark:hover:!bg-slate-700",
261
+ "hover:!shadow-[inset_0_2px_4px_rgba(0,0,0,0.3)]"
262
+ // Override hover shadow with inset
263
+ ],
264
+ "solid-neutral": [
265
+ "!bg-gray-100",
266
+ "!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]",
267
+ "dark:!bg-gray-800",
268
+ "hover:!bg-gray-100",
269
+ // Override hover to match active
270
+ "dark:hover:!bg-gray-800",
271
+ "hover:!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]"
272
+ // Override hover shadow with inset
273
+ ],
274
+ "solid-info": [
275
+ "!bg-blue-900",
276
+ "!shadow-[inset_0_2px_4px_rgba(0,0,0,0.3)]",
277
+ "dark:!bg-blue-700",
278
+ "hover:!bg-blue-900",
279
+ // Override hover to match active
280
+ "dark:hover:!bg-blue-700",
281
+ "hover:!shadow-[inset_0_2px_4px_rgba(0,0,0,0.3)]"
282
+ // Override hover shadow with inset
283
+ ],
284
+ "solid-warning": [
285
+ "!bg-amber-900",
286
+ "!shadow-[inset_0_2px_4px_rgba(0,0,0,0.3)]",
287
+ "dark:!bg-amber-700",
288
+ "hover:!bg-amber-900",
289
+ // Override hover to match active
290
+ "dark:hover:!bg-amber-700",
291
+ "hover:!shadow-[inset_0_2px_4px_rgba(0,0,0,0.3)]"
292
+ // Override hover shadow with inset
293
+ ],
294
+ "solid-danger": [
295
+ "!bg-red-900",
296
+ "!shadow-[inset_0_2px_4px_rgba(0,0,0,0.3)]",
297
+ "dark:!bg-red-700",
298
+ "hover:!bg-red-900",
299
+ // Override hover to match active
300
+ "dark:hover:!bg-red-700",
301
+ "hover:!shadow-[inset_0_2px_4px_rgba(0,0,0,0.3)]"
302
+ // Override hover shadow with inset
303
+ ],
304
+ "ghost-action": [
305
+ "!bg-gray-100",
306
+ "!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]",
307
+ "dark:!bg-gray-800",
308
+ "hover:!bg-gray-100",
309
+ // Override hover to match active
310
+ "dark:hover:!bg-gray-800",
311
+ "hover:!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]"
312
+ // Override hover shadow
313
+ ],
314
+ "ghost-neutral": [
315
+ "!bg-gray-50",
316
+ "!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]",
317
+ "dark:!bg-gray-800",
318
+ "!text-gray-900",
319
+ "dark:!text-white",
320
+ "hover:!bg-gray-50",
321
+ // Override hover to match active
322
+ "dark:hover:!bg-gray-800",
323
+ "hover:!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]",
324
+ // Override hover shadow
325
+ "hover:!text-gray-900",
326
+ // Override hover text color
327
+ "dark:hover:!text-white"
328
+ ],
329
+ "ghost-info": [
330
+ "!bg-gray-100",
331
+ "!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]",
332
+ "dark:!bg-gray-800",
333
+ "hover:!bg-gray-100",
334
+ // Override hover to match active
335
+ "dark:hover:!bg-gray-800",
336
+ "hover:!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]"
337
+ // Override hover shadow
338
+ ],
339
+ "ghost-warning": [
340
+ "!bg-gray-100",
341
+ "!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]",
342
+ "dark:!bg-gray-800",
343
+ "hover:!bg-gray-100",
344
+ // Override hover to match active
345
+ "dark:hover:!bg-gray-800",
346
+ "hover:!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]"
347
+ // Override hover shadow
348
+ ],
349
+ "ghost-danger": [
350
+ "!bg-gray-100",
351
+ "!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]",
352
+ "dark:!bg-gray-800",
353
+ "hover:!bg-gray-100",
354
+ // Override hover to match active
355
+ "dark:hover:!bg-gray-800",
356
+ "hover:!shadow-[inset_0_2px_4px_rgba(0,0,0,0.1)]"
357
+ // Override hover shadow
358
+ ],
359
+ "link-action": [
360
+ "!text-slate-900",
361
+ "dark:!text-slate-300",
362
+ "hover:!text-slate-900",
363
+ // Override hover to match active
364
+ "dark:hover:!text-slate-300"
365
+ ],
366
+ "link-neutral": [
367
+ "!text-gray-950",
368
+ "dark:!text-gray-200",
369
+ "hover:!text-gray-950",
370
+ // Override hover to match active
371
+ "dark:hover:!text-gray-200"
372
+ ],
373
+ "link-info": [
374
+ "!text-blue-900",
375
+ "dark:!text-blue-200",
376
+ "hover:!text-blue-900",
377
+ // Override hover to match active
378
+ "dark:hover:!text-blue-200"
379
+ ],
380
+ "link-warning": [
381
+ "!text-amber-900",
382
+ "dark:!text-amber-200",
383
+ "hover:!text-amber-900",
384
+ // Override hover to match active
385
+ "dark:hover:!text-amber-200"
386
+ ],
387
+ "link-danger": [
388
+ "!text-red-900",
389
+ "dark:!text-red-200",
390
+ "hover:!text-red-900",
391
+ // Override hover to match active
392
+ "dark:hover:!text-red-200"
393
+ ]
394
+ }[i] || [];
395
+ }
228
396
  getButtonClasses() {
229
397
  const e = this.isIconOnly(), t = this.getVariant(), i = [
230
398
  "inline-flex",
@@ -235,7 +403,7 @@ class z extends HTMLElement {
235
403
  // All buttons have rounded corners
236
404
  "box-border",
237
405
  // Ensure border is included in size calculation
238
- ...e ? ["p-1.5", "aspect-square", "w-[2rem]", "h-[2rem]"] : ["px-3.5", "py-1.5", "min-h-[2rem]"],
406
+ ...e ? ["p-1.5", "aspect-square", "w-[2.25rem]", "h-[2.25rem]"] : ["px-3.5", "py-1.5", "min-h-[2.25rem]"],
239
407
  // Square for icon-only, normal padding otherwise
240
408
  "text-sm",
241
409
  "transition-all",
@@ -538,10 +706,14 @@ class z extends HTMLElement {
538
706
  ...i,
539
707
  ...a
540
708
  ];
709
+ if (this.isActive()) {
710
+ const o = this.getActiveStateClasses();
711
+ l.push(...o), l.push("[&>*]:scale-95");
712
+ }
541
713
  return this.isFullWidth() && l.push("w-full"), l.join(" ");
542
714
  }
543
715
  render() {
544
- var h, c, m, d, f;
716
+ var c, h, d, u, m;
545
717
  const e = this.isDisabled() || this.isLoading(), t = this.getType();
546
718
  if (!this._button) {
547
719
  for (this._button = document.createElement("button"); this.firstChild; )
@@ -554,12 +726,12 @@ class z extends HTMLElement {
554
726
  if (i)
555
727
  i.setAttribute("data-button-variant", this.getVariant()), i.setAttribute("data-button-tone", this.getTone()), "render" in i && typeof i.render == "function" && i.render();
556
728
  else {
557
- const u = document.createElement("span");
558
- u.className = "mr-2 inline-flex items-center";
559
- const p = document.createElement("mint-spinner");
560
- p.setAttribute("size", "default"), p.setAttribute("data-button-variant", this.getVariant()), p.setAttribute("data-button-tone", this.getTone()), p.style.width = "0.875rem", p.style.height = "0.875rem", u.appendChild(p), this._button.insertBefore(u, this._button.firstChild);
729
+ const p = document.createElement("span");
730
+ p.className = "mr-2 inline-flex items-center";
731
+ const f = document.createElement("mint-spinner");
732
+ f.setAttribute("size", "default"), f.setAttribute("data-button-variant", this.getVariant()), f.setAttribute("data-button-tone", this.getTone()), f.style.width = "0.875rem", f.style.height = "0.875rem", p.appendChild(f), this._button.insertBefore(p, this._button.firstChild);
561
733
  }
562
- else i && ((h = i.parentElement) == null || h.remove());
734
+ else i && ((c = i.parentElement) == null || c.remove());
563
735
  for (; this.firstChild && this.firstChild !== this._button; )
564
736
  this._button.appendChild(this.firstChild);
565
737
  const s = this.getIcon();
@@ -568,34 +740,34 @@ class z extends HTMLElement {
568
740
  const r = this.getIconPosition();
569
741
  let a = this._button.querySelector(".mint-button-content");
570
742
  if (a) {
571
- const u = n && n.tagName === "MINT-ICON";
743
+ const p = n && n.tagName === "MINT-ICON";
572
744
  if (n && !n.parentElement) {
573
- const p = (d = this._button.querySelector("mint-spinner")) == null ? void 0 : d.parentElement;
574
- u || r === "left" ? p ? p.insertAdjacentElement("afterend", n) : this._button.insertBefore(n, a) : a.insertAdjacentElement("afterend", n);
575
- } else if (n && (u || r === "left") && n.nextSibling !== a) {
745
+ const f = (u = this._button.querySelector("mint-spinner")) == null ? void 0 : u.parentElement;
746
+ p || r === "left" ? f ? f.insertAdjacentElement("afterend", n) : this._button.insertBefore(n, a) : a.insertAdjacentElement("afterend", n);
747
+ } else if (n && (p || r === "left") && n.nextSibling !== a) {
576
748
  n.remove();
577
- const p = (f = this._button.querySelector("mint-spinner")) == null ? void 0 : f.parentElement;
578
- p ? p.insertAdjacentElement("afterend", n) : this._button.insertBefore(n, a);
579
- } else n && !u && r === "right" && n.previousSibling !== a && (n.remove(), a.insertAdjacentElement("afterend", n));
749
+ const f = (m = this._button.querySelector("mint-spinner")) == null ? void 0 : m.parentElement;
750
+ f ? f.insertAdjacentElement("afterend", n) : this._button.insertBefore(n, a);
751
+ } else n && !p && r === "right" && n.previousSibling !== a && (n.remove(), a.insertAdjacentElement("afterend", n));
580
752
  } else {
581
- const u = [];
582
- for (let p = this._button.firstChild; p; p = p.nextSibling) {
583
- if (p.nodeType !== Node.ELEMENT_NODE) {
584
- u.push(p);
753
+ const p = [];
754
+ for (let f = this._button.firstChild; f; f = f.nextSibling) {
755
+ if (f.nodeType !== Node.ELEMENT_NODE) {
756
+ p.push(f);
585
757
  continue;
586
758
  }
587
- const _ = p;
588
- _.tagName !== "MINT-SPINNER" && !_.querySelector("mint-spinner") && p !== n && !_.hasAttribute("slot") && !(_.className === "mr-2" && _.querySelector("mint-spinner")) && u.push(p);
759
+ const b = f;
760
+ b.tagName !== "MINT-SPINNER" && !b.querySelector("mint-spinner") && f !== n && !b.hasAttribute("slot") && !(b.className === "mr-2" && b.querySelector("mint-spinner")) && p.push(f);
589
761
  }
590
- if (u.length > 0) {
591
- a = document.createElement("span"), a.className = "mint-button-content inline-flex items-center", u.forEach((_) => {
592
- a.appendChild(_);
762
+ if (p.length > 0) {
763
+ a = document.createElement("span"), a.className = "mint-button-content inline-flex items-center", p.forEach((b) => {
764
+ a.appendChild(b);
593
765
  });
594
- const p = (c = this._button.querySelector("mint-spinner")) == null ? void 0 : c.parentElement;
595
- n && r === "left" ? p ? (p.insertAdjacentElement("afterend", n), n.insertAdjacentElement("afterend", a)) : (this._button.insertBefore(n, this._button.firstChild), n.insertAdjacentElement("afterend", a)) : n && r === "right" ? p ? (p.insertAdjacentElement("afterend", a), a.insertAdjacentElement("afterend", n)) : (this._button.insertBefore(a, this._button.firstChild), a.insertAdjacentElement("afterend", n)) : p ? p.insertAdjacentElement("afterend", a) : this._button.insertBefore(a, this._button.firstChild);
766
+ const f = (h = this._button.querySelector("mint-spinner")) == null ? void 0 : h.parentElement;
767
+ n && r === "left" ? f ? (f.insertAdjacentElement("afterend", n), n.insertAdjacentElement("afterend", a)) : (this._button.insertBefore(n, this._button.firstChild), n.insertAdjacentElement("afterend", a)) : n && r === "right" ? f ? (f.insertAdjacentElement("afterend", a), a.insertAdjacentElement("afterend", n)) : (this._button.insertBefore(a, this._button.firstChild), a.insertAdjacentElement("afterend", n)) : f ? f.insertAdjacentElement("afterend", a) : this._button.insertBefore(a, this._button.firstChild);
596
768
  } else if (n && n.tagName === "MINT-ICON" && !n.parentElement) {
597
- const p = (m = this._button.querySelector("mint-spinner")) == null ? void 0 : m.parentElement;
598
- p ? p.insertAdjacentElement("afterend", n) : this._button.insertBefore(n, this._button.firstChild);
769
+ const f = (d = this._button.querySelector("mint-spinner")) == null ? void 0 : d.parentElement;
770
+ f ? f.insertAdjacentElement("afterend", n) : this._button.insertBefore(n, this._button.firstChild);
599
771
  }
600
772
  }
601
773
  const l = this.isIconOnly();
@@ -775,17 +947,17 @@ class W extends HTMLElement {
775
947
  this._button ? this._button.parentElement !== l && l.appendChild(this._button) : (this._button = document.createElement("button"), l.appendChild(this._button), this.setupEventListeners());
776
948
  let o = l.querySelector(".mint-switch-label");
777
949
  s ? (o || (o = document.createElement("label"), o.className = "mint-switch-label text-sm font-medium text-gray-900 dark:text-gray-100 select-none", this._button && this._button.parentElement === l ? l.insertBefore(o, this._button.nextSibling) : l.appendChild(o)), o.textContent = s, o.setAttribute("for", a), this.isDisabled() ? o.classList.add("opacity-40") : o.classList.remove("opacity-40")) : o && o.remove(), this._button.className = t, this._button.disabled = this.isDisabled(), this._button.id = a, this._button.setAttribute("aria-checked", String(this._checked)), this._button.setAttribute("aria-label", s || "Toggle switch"), this._button.setAttribute("role", "switch"), this._button.type = "button";
778
- let h = this._button.querySelector("span");
779
- h || (h = document.createElement("span"), this._button.appendChild(h)), h.className = i;
780
- const c = h.querySelector("span");
950
+ let c = this._button.querySelector("span");
951
+ c || (c = document.createElement("span"), this._button.appendChild(c)), c.className = i;
952
+ const h = c.querySelector("span");
781
953
  if (r) {
782
- let d = c;
783
- d || (d = document.createElement("span"), d.className = this.getIconClasses(), h.appendChild(d));
784
- let f = d.querySelector("mint-icon");
785
- f || (f = document.createElement("mint-icon"), d.appendChild(f)), f.setAttribute("name", r);
786
- } else c && c.remove();
787
- let m = this.querySelector(".mint-switch-info");
788
- n ? (m || (m = document.createElement("span"), m.className = "mint-switch-info text-xs text-gray-500 dark:text-gray-400 select-none mt-1 block", l && l.parentElement === this ? this.insertBefore(m, l.nextSibling) : this.appendChild(m)), m.textContent = n, this.isDisabled() ? m.classList.add("opacity-40") : m.classList.remove("opacity-40")) : m && m.remove(), this._renderErrorState(), this._renderSkeleton(e);
954
+ let u = h;
955
+ u || (u = document.createElement("span"), u.className = this.getIconClasses(), c.appendChild(u));
956
+ let m = u.querySelector("mint-icon");
957
+ m || (m = document.createElement("mint-icon"), u.appendChild(m)), m.setAttribute("name", r);
958
+ } else h && h.remove();
959
+ let d = this.querySelector(".mint-switch-info");
960
+ n ? (d || (d = document.createElement("span"), d.className = "mint-switch-info text-xs text-gray-500 dark:text-gray-400 select-none mt-1 block", l && l.parentElement === this ? this.insertBefore(d, l.nextSibling) : this.appendChild(d)), d.textContent = n, this.isDisabled() ? d.classList.add("opacity-40") : d.classList.remove("opacity-40")) : d && d.remove(), this._renderErrorState(), this._renderSkeleton(e);
789
961
  }
790
962
  setupEventListeners() {
791
963
  this._button && this._button.addEventListener("click", this.handleToggle.bind(this));
@@ -1087,7 +1259,7 @@ class j extends HTMLElement {
1087
1259
  );
1088
1260
  }
1089
1261
  render() {
1090
- this.classList.add("rounded-lg", "shadow", "bg-white", "dark:bg-gray-800", "border", "border-gray-200", "dark:border-gray-700", "overflow-hidden", "transition-colors", "duration-200"), this.hasPaddingClass() || this.classList.add("p-6");
1262
+ this.classList.add("rounded-lg", "shadow", "bg-white", "dark:bg-gray-800", "border", "border-gray-200", "dark:border-gray-700", "overflow-hidden", "transition-colors", "duration-200", "mb-6"), this.hasPaddingClass() || this.classList.add("p-4");
1091
1263
  const e = this.getHeading();
1092
1264
  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);
1093
1265
  }
@@ -1384,31 +1556,31 @@ class J extends HTMLElement {
1384
1556
  render() {
1385
1557
  const e = this.getId(), t = this.getHeading(), i = this.isOpen();
1386
1558
  if (e && (this.id = e), this._overlay || (this._overlay = document.createElement("div"), this._overlay.className = "fixed inset-0 bg-black bg-opacity-50 transition-opacity duration-200 z-40", this._overlay.addEventListener("click", () => this.close()), this.appendChild(this._overlay)), this._modal || (this._modal = document.createElement("div"), this._modal.className = "fixed inset-0 flex items-center justify-center p-2 pointer-events-none z-50", this.appendChild(this._modal)), i) {
1387
- let c = this._modal.querySelector(".modal-content");
1388
- c || (c = document.createElement("div"), c.className = "modal-content bg-white dark:bg-gray-800 rounded-lg shadow-xl max-w-2xl w-full max-h-[90vh] flex flex-col pointer-events-auto transition-all duration-200 ease-out transform", this._modal.appendChild(c)), this._animateEnter();
1559
+ let h = this._modal.querySelector(".modal-content");
1560
+ h || (h = document.createElement("div"), h.className = "modal-content bg-white dark:bg-gray-800 rounded-lg shadow-xl max-w-2xl w-full max-h-[90vh] flex flex-col pointer-events-auto transition-all duration-200 ease-out transform", this._modal.appendChild(h)), this._animateEnter();
1389
1561
  } else
1390
1562
  this._animateExit();
1391
1563
  let s = this._modal.querySelector(".modal-content");
1392
1564
  s || (s = document.createElement("div"), s.className = "modal-content bg-white dark:bg-gray-800 rounded-lg shadow-xl max-w-2xl w-full max-h-[90vh] flex flex-col pointer-events-auto transition-all duration-200 ease-out transform", this._modal.appendChild(s)), this._header || (this._header = document.createElement("div"), this._header.className = "flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-700", s.appendChild(this._header)), this._headingSlot || (this._headingSlot = document.createElement("div"), this._headingSlot.className = "flex-1", this._headingSlot.setAttribute("slot", "heading"), this._header.appendChild(this._headingSlot));
1393
1565
  let n = this._headingSlot.querySelector("mint-text");
1394
1566
  t ? (n || (n = document.createElement("mint-text"), n.setAttribute("size", "sub-heading"), n.setAttribute("bold", ""), this._headingSlot.appendChild(n)), n.textContent = t) : n && n.remove(), Array.from(this.children).filter(
1395
- (c) => c !== this._overlay && c !== this._modal && c !== this._headingSlot && c.getAttribute("slot") === "heading"
1396
- ).forEach((c) => {
1397
- this._headingSlot && c.parentElement !== this._headingSlot && this._headingSlot.appendChild(c);
1567
+ (h) => h !== this._overlay && h !== this._modal && h !== this._headingSlot && h.getAttribute("slot") === "heading"
1568
+ ).forEach((h) => {
1569
+ this._headingSlot && h.parentElement !== this._headingSlot && this._headingSlot.appendChild(h);
1398
1570
  }), this._closeButton || (this._closeButton = document.createElement("mint-button"), this._closeButton.setAttribute("variant", "ghost"), this._closeButton.setAttribute("icon", "close"), this._closeButton.addEventListener("click", () => this.close()), this._header.appendChild(this._closeButton)), this._bodySlot || (this._bodySlot = document.createElement("div"), this._bodySlot.className = "flex-1 overflow-y-auto p-4", this._bodySlot.setAttribute("slot", "body"), s.appendChild(this._bodySlot)), Array.from(this.children).filter(
1399
- (c) => c !== this._overlay && c !== this._modal && c !== this._bodySlot && c.getAttribute("slot") === "body"
1400
- ).forEach((c) => {
1401
- this._bodySlot && c.parentElement !== this._bodySlot && this._bodySlot.appendChild(c);
1571
+ (h) => h !== this._overlay && h !== this._modal && h !== this._bodySlot && h.getAttribute("slot") === "body"
1572
+ ).forEach((h) => {
1573
+ this._bodySlot && h.parentElement !== this._bodySlot && this._bodySlot.appendChild(h);
1402
1574
  }), this._actionsSlot || (this._actionsSlot = document.createElement("div"), this._actionsSlot.className = "p-4 border-t border-gray-200 dark:border-gray-700", this._actionsSlot.setAttribute("slot", "actions"), s.appendChild(this._actionsSlot));
1403
1575
  let l = this._actionsSlot.querySelector("mint-stack");
1404
1576
  l || (l = document.createElement("mint-stack"), l.setAttribute("direction", "horizontal"), l.className = "justify-end", this._actionsSlot.appendChild(l)), Array.from(this.children).filter(
1405
- (c) => c !== this._overlay && c !== this._modal && c !== this._actionsSlot && c.getAttribute("slot") === "actions"
1406
- ).forEach((c) => {
1407
- Array.from(c.children).forEach((d) => {
1408
- d.parentElement !== l && l.appendChild(d);
1409
- }), c.parentElement && c.remove();
1410
- }), Array.from(this.children).forEach((c) => {
1411
- c !== this._overlay && c !== this._modal && c.getAttribute("slot") !== "heading" && c.getAttribute("slot") !== "body" && c.getAttribute("slot") !== "actions" && c !== this._headingSlot && c !== this._bodySlot && c !== this._actionsSlot && c.parentElement !== this._bodySlot && this._bodySlot.appendChild(c);
1577
+ (h) => h !== this._overlay && h !== this._modal && h !== this._actionsSlot && h.getAttribute("slot") === "actions"
1578
+ ).forEach((h) => {
1579
+ Array.from(h.children).forEach((u) => {
1580
+ u.parentElement !== l && l.appendChild(u);
1581
+ }), h.parentElement && h.remove();
1582
+ }), Array.from(this.children).forEach((h) => {
1583
+ h !== this._overlay && h !== this._modal && h.getAttribute("slot") !== "heading" && h.getAttribute("slot") !== "body" && h.getAttribute("slot") !== "actions" && h !== this._headingSlot && h !== this._bodySlot && h !== this._actionsSlot && h.parentElement !== this._bodySlot && this._bodySlot.appendChild(h);
1412
1584
  }), this._updateBackgroundColor();
1413
1585
  }
1414
1586
  _updateBackgroundColor() {
@@ -1558,38 +1730,38 @@ class X extends HTMLElement {
1558
1730
  if (!t) return { top: 0, left: 0, direction: "down" };
1559
1731
  this.classList.contains("hidden") && (this.classList.remove("hidden"), this._popover.style.visibility = "hidden");
1560
1732
  const s = t.getBoundingClientRect(), n = window.innerWidth, r = window.innerHeight, a = 8;
1561
- let l = this.getDirection(), o = 0, h = 0;
1733
+ let l = this.getDirection(), o = 0, c = 0;
1562
1734
  switch (l) {
1563
1735
  case "down":
1564
- if (o = e.bottom + a, h = e.left + e.width / 2 - s.width / 2, o + s.height > r) {
1565
- const c = e.top - s.height - a;
1566
- c >= 0 ? (l = "up", o = c) : (o = Math.max(0, r - s.height - a), o + s.height > r && (o = 0));
1736
+ if (o = e.bottom + a, c = e.left + e.width / 2 - s.width / 2, o + s.height > r) {
1737
+ const h = e.top - s.height - a;
1738
+ h >= 0 ? (l = "up", o = h) : (o = Math.max(0, r - s.height - a), o + s.height > r && (o = 0));
1567
1739
  }
1568
- h < 0 && (h = a), h + s.width > n && (h = Math.max(a, n - s.width - a), h + s.width > n && (h = n - s.width));
1740
+ c < 0 && (c = a), c + s.width > n && (c = Math.max(a, n - s.width - a), c + s.width > n && (c = n - s.width));
1569
1741
  break;
1570
1742
  case "up":
1571
- if (o = e.top - s.height - a, h = e.left + e.width / 2 - s.width / 2, o < 0) {
1572
- const c = e.bottom + a;
1573
- c + s.height <= r ? (l = "down", o = c) : (o = Math.min(r - s.height - a, r - s.height), o < 0 && (o = r - s.height));
1743
+ if (o = e.top - s.height - a, c = e.left + e.width / 2 - s.width / 2, o < 0) {
1744
+ const h = e.bottom + a;
1745
+ h + s.height <= r ? (l = "down", o = h) : (o = Math.min(r - s.height - a, r - s.height), o < 0 && (o = r - s.height));
1574
1746
  }
1575
- h < 0 && (h = a), h + s.width > n && (h = Math.max(a, n - s.width - a), h + s.width > n && (h = n - s.width));
1747
+ c < 0 && (c = a), c + s.width > n && (c = Math.max(a, n - s.width - a), c + s.width > n && (c = n - s.width));
1576
1748
  break;
1577
1749
  case "right":
1578
- if (o = e.top + e.height / 2 - s.height / 2, h = e.right + a, h + s.width > n) {
1579
- const c = e.left - s.width - a;
1580
- c >= 0 ? (l = "left", h = c) : (h = Math.max(0, n - s.width - a), h + s.width > n && (h = n - s.width));
1750
+ if (o = e.top + e.height / 2 - s.height / 2, c = e.right + a, c + s.width > n) {
1751
+ const h = e.left - s.width - a;
1752
+ h >= 0 ? (l = "left", c = h) : (c = Math.max(0, n - s.width - a), c + s.width > n && (c = n - s.width));
1581
1753
  }
1582
1754
  o < 0 && (o = a), o + s.height > r && (o = Math.max(a, r - s.height - a), o + s.height > r && (o = r - s.height));
1583
1755
  break;
1584
1756
  case "left":
1585
- if (o = e.top + e.height / 2 - s.height / 2, h = e.left - s.width - a, h < 0) {
1586
- const c = e.right + a;
1587
- c + s.width <= n ? (l = "right", h = c) : (h = Math.min(n - s.width - a, n - s.width), h < 0 && (h = 0));
1757
+ if (o = e.top + e.height / 2 - s.height / 2, c = e.left - s.width - a, c < 0) {
1758
+ const h = e.right + a;
1759
+ h + s.width <= n ? (l = "right", c = h) : (c = Math.min(n - s.width - a, n - s.width), c < 0 && (c = 0));
1588
1760
  }
1589
1761
  o < 0 && (o = a), o + s.height > r && (o = Math.max(a, r - s.height - a), o + s.height > r && (o = r - s.height));
1590
1762
  break;
1591
1763
  }
1592
- return { top: o, left: h, direction: l };
1764
+ return { top: o, left: c, direction: l };
1593
1765
  }
1594
1766
  render() {
1595
1767
  const e = this.getId(), t = this.isOpen(), i = this.getPadding();
@@ -1790,26 +1962,30 @@ class K extends HTMLElement {
1790
1962
  const l = this.getName();
1791
1963
  l ? this._checkbox.name = l : this._checkbox.removeAttribute("name");
1792
1964
  const o = this.getValue();
1793
- o ? this._checkbox.value = o : this._checkbox.removeAttribute("value"), t ? this._checkbox.setAttribute("aria-label", t) : this._checkbox.removeAttribute("aria-label"), r.className = `mint-checkbox-wrapper ${this.getCheckboxClasses()}`, r.style.pointerEvents = "none", this._checkbox.style.pointerEvents = "auto";
1965
+ o ? this._checkbox.value = o : this._checkbox.removeAttribute("value"), t ? this._checkbox.setAttribute("aria-label", t) : this._checkbox.removeAttribute("aria-label"), r.className = `mint-checkbox-wrapper ${this.getCheckboxClasses()}`, r.style.cursor = "pointer", r.style.pointerEvents = "auto", this._checkbox.style.pointerEvents = "auto";
1966
+ const c = r;
1967
+ c._wrapperClickHandler || (c._wrapperClickHandler = (m) => {
1968
+ m.target === r && !s && (m.preventDefault(), m.stopPropagation(), this.toggle());
1969
+ }, r.addEventListener("click", c._wrapperClickHandler));
1794
1970
  let h = r.querySelector("mint-icon");
1795
1971
  h || (h = document.createElement("mint-icon"), h.setAttribute("name", "check"), h.className = "w-3.5 h-3.5 text-white pointer-events-none absolute inset-0 m-auto", h.style.transition = "opacity 200ms ease-out, transform 200ms ease-out", h.style.zIndex = "1", r.appendChild(h)), this.updateVisualState();
1796
- let c = this.querySelector(".mint-checkbox-label-container");
1797
- const m = this.querySelector(".mint-checkbox-container");
1972
+ let d = this.querySelector(".mint-checkbox-label-container");
1973
+ const u = this.querySelector(".mint-checkbox-container");
1798
1974
  if (t || i) {
1799
- c ? m && c.parentElement !== m && m.appendChild(c) : (c = document.createElement("div"), c.className = "mint-checkbox-label-container flex flex-col gap-0.5 flex-1", m ? m.appendChild(c) : this.appendChild(c));
1800
- let d = c.querySelector(".mint-checkbox-label");
1801
- t ? (d || (d = document.createElement("span"), d.className = "mint-checkbox-label text-sm font-medium text-gray-900 dark:text-gray-100 cursor-pointer select-none", c.insertBefore(d, c.firstChild)), d.textContent = t, s ? d.classList.add("opacity-40") : d.classList.remove("opacity-40")) : d && d.remove();
1802
- let f = c.querySelector(".mint-checkbox-info");
1803
- if (i ? (f || (f = document.createElement("span"), f.className = "mint-checkbox-info text-xs text-gray-500 dark:text-gray-400 cursor-pointer select-none", c.appendChild(f)), f.textContent = i, s ? f.classList.add("opacity-40") : f.classList.remove("opacity-40")) : f && f.remove(), s)
1804
- c.style.cursor = "default", c._clickHandler && (c.removeEventListener("click", c._clickHandler), c._clickHandler = null);
1975
+ d ? u && d.parentElement !== u && u.appendChild(d) : (d = document.createElement("div"), d.className = "mint-checkbox-label-container flex flex-col gap-0.5 flex-1", u ? u.appendChild(d) : this.appendChild(d));
1976
+ let m = d.querySelector(".mint-checkbox-label");
1977
+ t ? (m || (m = document.createElement("span"), m.className = "mint-checkbox-label text-sm font-medium text-gray-900 dark:text-gray-100 cursor-pointer select-none", d.insertBefore(m, d.firstChild)), m.textContent = t, s ? m.classList.add("opacity-40") : m.classList.remove("opacity-40")) : m && m.remove();
1978
+ let p = d.querySelector(".mint-checkbox-info");
1979
+ 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", d.appendChild(p)), p.textContent = i, s ? p.classList.add("opacity-40") : p.classList.remove("opacity-40")) : p && p.remove(), s)
1980
+ d.style.cursor = "default", d._clickHandler && (d.removeEventListener("click", d._clickHandler), d._clickHandler = null);
1805
1981
  else {
1806
- c.style.cursor = "pointer";
1807
- const u = c._clickHandler;
1808
- u && c.removeEventListener("click", u), c._clickHandler = (p) => {
1809
- this._checkbox && (p.target === this._checkbox || this._checkbox.contains(p.target) || p.composedPath().includes(this._checkbox)) || this.toggle();
1810
- }, c.addEventListener("click", c._clickHandler);
1982
+ d.style.cursor = "pointer";
1983
+ const f = d._clickHandler;
1984
+ f && d.removeEventListener("click", f), d._clickHandler = (b) => {
1985
+ this._checkbox && (b.target === this._checkbox || this._checkbox.contains(b.target) || b.composedPath().includes(this._checkbox)) || this.toggle();
1986
+ }, d.addEventListener("click", d._clickHandler);
1811
1987
  }
1812
- } else c && c.remove();
1988
+ } else d && d.remove();
1813
1989
  this._renderErrorState(), this._renderSkeleton(e);
1814
1990
  }
1815
1991
  setupEventListeners() {
@@ -1852,6 +2028,11 @@ class K extends HTMLElement {
1852
2028
  }
1853
2029
  removeEventListeners() {
1854
2030
  this._checkbox && (this._changeHandler && (this._checkbox.removeEventListener("change", this._changeHandler), this._changeHandler = null), this._mousedownHandler && (this._checkbox.removeEventListener("mousedown", this._mousedownHandler), this._mousedownHandler = null), this._mouseupHandler && (this._checkbox.removeEventListener("mouseup", this._mouseupHandler), this._mouseupHandler = null), this._mouseleaveHandler && (this._checkbox.removeEventListener("mouseleave", this._mouseleaveHandler), this._mouseleaveHandler = null), this._touchstartHandler && (this._checkbox.removeEventListener("touchstart", this._touchstartHandler), this._touchstartHandler = null), this._touchendHandler && (this._checkbox.removeEventListener("touchend", this._touchendHandler), this._touchendHandler = null), this._focusHandler && (this._checkbox.removeEventListener("focus", this._focusHandler), this._focusHandler = null), this._blurHandler && (this._checkbox.removeEventListener("blur", this._blurHandler), this._blurHandler = null));
2031
+ const e = this.querySelector(".mint-checkbox-wrapper");
2032
+ if (e) {
2033
+ const t = e;
2034
+ t._wrapperClickHandler && (e.removeEventListener("click", t._wrapperClickHandler), t._wrapperClickHandler = null);
2035
+ }
1855
2036
  }
1856
2037
  updateVisualState() {
1857
2038
  const e = this.querySelector(".mint-checkbox-wrapper"), t = e == null ? void 0 : e.querySelector("mint-icon");
@@ -1951,69 +2132,69 @@ class Z extends HTMLElement {
1951
2132
  }, this.addEventListener("click", this._clickHandler));
1952
2133
  }
1953
2134
  render() {
1954
- var f;
2135
+ var m;
1955
2136
  const e = this.isLoading(), t = this.isDisabled(), i = this.getValue(), s = this.closest("mint-choice"), n = (s == null ? void 0 : s.getAttribute("name")) || "";
1956
2137
  let r = "";
1957
2138
  const a = this.querySelector(".mint-choice-option-label");
1958
- a ? r = ((f = a.textContent) == null ? void 0 : f.trim()) || "" : Array.from(this.childNodes).forEach((u) => {
1959
- var p;
1960
- if (u.nodeType === Node.TEXT_NODE) {
1961
- const _ = (p = u.textContent) == null ? void 0 : p.trim();
1962
- _ && (r += _);
2139
+ a ? r = ((m = a.textContent) == null ? void 0 : m.trim()) || "" : Array.from(this.childNodes).forEach((p) => {
2140
+ var f;
2141
+ if (p.nodeType === Node.TEXT_NODE) {
2142
+ const b = (f = p.textContent) == null ? void 0 : f.trim();
2143
+ b && (r += b);
1963
2144
  }
1964
2145
  });
1965
2146
  const l = this.querySelectorAll(".mint-choice-option-wrapper");
1966
2147
  let o = null;
1967
- if (l.length > 0 && (this._radio && (o = Array.from(l).find((u) => u.contains(this._radio))), o || (o = l[0]), l.forEach((u, p) => {
1968
- u !== o && u.remove();
1969
- })), o || (o = document.createElement("div"), o.className = "mint-choice-option-wrapper", o.style.position = "relative", this.insertBefore(o, this.firstChild)), o.className = `mint-choice-option-wrapper ${this._getWrapperClasses()}`, o.style.position = "relative", this.querySelectorAll('input[type="radio"]').forEach((u) => {
1970
- u !== this._radio && u.remove();
2148
+ if (l.length > 0 && (this._radio && (o = Array.from(l).find((p) => p.contains(this._radio))), o || (o = l[0]), l.forEach((p, f) => {
2149
+ p !== o && p.remove();
2150
+ })), o || (o = document.createElement("div"), o.className = "mint-choice-option-wrapper", o.style.position = "relative", this.insertBefore(o, this.firstChild)), o.className = `mint-choice-option-wrapper ${this._getWrapperClasses()}`, o.style.position = "relative", this.querySelectorAll('input[type="radio"]').forEach((p) => {
2151
+ p !== this._radio && p.remove();
1971
2152
  }), this._radio)
1972
- this._radio.parentElement !== o && o.appendChild(this._radio), this._radio && this._changeHandler && (this._radio.removeEventListener("change", this._changeHandler), this._radio.addEventListener("change", this._changeHandler)), this._radio && (this._focusHandler || (this._focusHandler = (u) => {
1973
- const p = this.querySelector(".mint-choice-option-wrapper");
1974
- p && !this.isDisabled() && p.classList.add("ring-2", "ring-offset-1", "ring-gray-400", "dark:ring-gray-500");
2153
+ this._radio.parentElement !== o && o.appendChild(this._radio), this._radio && this._changeHandler && (this._radio.removeEventListener("change", this._changeHandler), this._radio.addEventListener("change", this._changeHandler)), this._radio && (this._focusHandler || (this._focusHandler = (p) => {
2154
+ const f = this.querySelector(".mint-choice-option-wrapper");
2155
+ f && !this.isDisabled() && f.classList.add("ring-2", "ring-offset-1", "ring-gray-400", "dark:ring-gray-500");
1975
2156
  }), this._blurHandler || (this._blurHandler = () => {
1976
- const u = this.querySelector(".mint-choice-option-wrapper");
1977
- u && u.classList.remove("ring-2", "ring-offset-1", "ring-gray-400", "dark:ring-gray-500");
1978
- }), this._keydownHandler || (this._keydownHandler = (u) => {
1979
- this.isDisabled() || (u.key === "ArrowDown" || u.key === "ArrowRight" ? (u.preventDefault(), this._focusNextOption()) : (u.key === "ArrowUp" || u.key === "ArrowLeft") && (u.preventDefault(), this._focusPreviousOption()));
2157
+ const p = this.querySelector(".mint-choice-option-wrapper");
2158
+ p && p.classList.remove("ring-2", "ring-offset-1", "ring-gray-400", "dark:ring-gray-500");
2159
+ }), this._keydownHandler || (this._keydownHandler = (p) => {
2160
+ this.isDisabled() || (p.key === "ArrowDown" || p.key === "ArrowRight" ? (p.preventDefault(), this._focusNextOption()) : (p.key === "ArrowUp" || p.key === "ArrowLeft") && (p.preventDefault(), this._focusPreviousOption()));
1980
2161
  }), this._radio.removeEventListener("focus", this._focusHandler), this._radio.removeEventListener("blur", this._blurHandler), this._radio.removeEventListener("keydown", this._keydownHandler), this._radio.addEventListener("focus", this._focusHandler), this._radio.addEventListener("blur", this._blurHandler), this._radio.addEventListener("keydown", this._keydownHandler));
1981
2162
  else {
1982
- 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 = (p) => {
1983
- const _ = this._checked;
2163
+ 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 = (f) => {
2164
+ const b = this._checked;
1984
2165
  this._checked = this._radio.checked, this._checked ? this.setAttribute("checked", "") : this.removeAttribute("checked"), this._updateVisualState(), this._updateGroupState();
1985
- const b = this.closest("mint-choice");
1986
- _ !== this._checked && b && setTimeout(() => {
1987
- b.dispatchEvent(new CustomEvent("choice-change", {
2166
+ const g = this.closest("mint-choice");
2167
+ b !== this._checked && g && setTimeout(() => {
2168
+ g.dispatchEvent(new CustomEvent("choice-change", {
1988
2169
  detail: { checked: this._checked, value: this.getValue() },
1989
2170
  bubbles: !0,
1990
2171
  cancelable: !0
1991
2172
  }));
1992
2173
  }, 0);
1993
2174
  }, this._radio.addEventListener("change", this._changeHandler);
1994
- const u = () => {
2175
+ const p = () => {
1995
2176
  this._radio && this._radio.checked !== this._checked && (this._checked = this._radio.checked, this._checked ? this.setAttribute("checked", "") : this.removeAttribute("checked"), this._updateVisualState(), this._updateGroupState());
1996
2177
  };
1997
- this._radio.addEventListener("click", u), this._focusHandler = (p) => {
1998
- const _ = this.querySelector(".mint-choice-option-wrapper");
1999
- _ && !this.isDisabled() && _.classList.add("ring-2", "ring-offset-1", "ring-gray-400", "dark:ring-gray-500");
2178
+ this._radio.addEventListener("click", p), this._focusHandler = (f) => {
2179
+ const b = this.querySelector(".mint-choice-option-wrapper");
2180
+ b && !this.isDisabled() && b.classList.add("ring-2", "ring-offset-1", "ring-gray-400", "dark:ring-gray-500");
2000
2181
  }, this._radio.addEventListener("focus", this._focusHandler), this._blurHandler = () => {
2001
- const p = this.querySelector(".mint-choice-option-wrapper");
2002
- p && p.classList.remove("ring-2", "ring-offset-1", "ring-gray-400", "dark:ring-gray-500");
2003
- }, this._radio.addEventListener("blur", this._blurHandler), this._keydownHandler = (p) => {
2004
- this.isDisabled() || (p.key === "ArrowDown" || p.key === "ArrowRight" ? (p.preventDefault(), this._focusNextOption()) : (p.key === "ArrowUp" || p.key === "ArrowLeft") && (p.preventDefault(), this._focusPreviousOption()));
2182
+ const f = this.querySelector(".mint-choice-option-wrapper");
2183
+ f && f.classList.remove("ring-2", "ring-offset-1", "ring-gray-400", "dark:ring-gray-500");
2184
+ }, this._radio.addEventListener("blur", this._blurHandler), this._keydownHandler = (f) => {
2185
+ this.isDisabled() || (f.key === "ArrowDown" || f.key === "ArrowRight" ? (f.preventDefault(), this._focusNextOption()) : (f.key === "ArrowUp" || f.key === "ArrowLeft") && (f.preventDefault(), this._focusPreviousOption()));
2005
2186
  }, this._radio.addEventListener("keydown", this._keydownHandler);
2006
2187
  }
2007
- this._radio.name = n, this._radio.value = i, this._radio.checked !== this._checked ? (this._checked = this._radio.checked, this._checked ? this.hasAttribute("checked") || this.setAttribute("checked", "") : this.hasAttribute("checked") && this.removeAttribute("checked")) : this._radio.checked = this._checked, this._radio.disabled = t, t ? 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((u, p) => {
2008
- p > 0 && u.remove();
2188
+ this._radio.name = n, this._radio.value = i, this._radio.checked !== this._checked ? (this._checked = this._radio.checked, this._checked ? this.hasAttribute("checked") || this.setAttribute("checked", "") : this.hasAttribute("checked") && this.removeAttribute("checked")) : this._radio.checked = this._checked, this._radio.disabled = t, t ? 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((p, f) => {
2189
+ f > 0 && p.remove();
2009
2190
  });
2010
- let m = o.querySelector(".mint-choice-option-indicator");
2011
- m || (m = document.createElement("div"), m.className = "mint-choice-option-indicator", o.appendChild(m)), m.className = "mint-choice-option-indicator w-2 h-2 rounded-full bg-white transition-all duration-200 pointer-events-none", m.style.position = "absolute", m.style.top = "50%", m.style.left = "50%", m.style.transform = this._checked ? "translate(-50%, -50%) scale(1)" : "translate(-50%, -50%) scale(0)", m.style.opacity = this._checked ? "1" : "0", this._updateVisualState(), this._renderSkeleton(e);
2012
- let d = this.querySelector(".mint-choice-option-label");
2013
- r && (d || (d = document.createElement("span"), d.className = "mint-choice-option-label", this.appendChild(d), Array.from(this.childNodes).forEach((u) => {
2014
- var p;
2015
- u.nodeType === Node.TEXT_NODE && ((p = u.textContent) != null && p.trim()) && (u.textContent = "");
2016
- })), d.className = `mint-choice-option-label text-sm text-gray-900 dark:text-gray-100 ${t ? "opacity-40" : ""}`, d.textContent = r), t ? (this.classList.add("cursor-not-allowed"), this.classList.remove("cursor-pointer")) : (this.classList.add("cursor-pointer"), this.classList.remove("cursor-not-allowed")), this._updateVisualState();
2191
+ let d = o.querySelector(".mint-choice-option-indicator");
2192
+ d || (d = document.createElement("div"), d.className = "mint-choice-option-indicator", o.appendChild(d)), d.className = "mint-choice-option-indicator w-2 h-2 rounded-full bg-white transition-all duration-200 pointer-events-none", d.style.position = "absolute", d.style.top = "50%", d.style.left = "50%", d.style.transform = this._checked ? "translate(-50%, -50%) scale(1)" : "translate(-50%, -50%) scale(0)", d.style.opacity = this._checked ? "1" : "0", this._updateVisualState(), this._renderSkeleton(e);
2193
+ let u = this.querySelector(".mint-choice-option-label");
2194
+ r && (u || (u = document.createElement("span"), u.className = "mint-choice-option-label", this.appendChild(u), Array.from(this.childNodes).forEach((p) => {
2195
+ var f;
2196
+ p.nodeType === Node.TEXT_NODE && ((f = p.textContent) != null && f.trim()) && (p.textContent = "");
2197
+ })), u.className = `mint-choice-option-label text-sm text-gray-900 dark:text-gray-100 ${t ? "opacity-40" : ""}`, u.textContent = r), t ? (this.classList.add("cursor-not-allowed"), this.classList.remove("cursor-pointer")) : (this.classList.add("cursor-pointer"), this.classList.remove("cursor-not-allowed")), this._updateVisualState();
2017
2198
  }
2018
2199
  _getWrapperClasses() {
2019
2200
  const e = this.isDisabled(), t = [
@@ -2218,8 +2399,8 @@ class Q extends HTMLElement {
2218
2399
  r || (r = document.createElement("div"), r.className = "mint-choice-label-container flex flex-col gap-0.5 mb-2", this.insertBefore(r, this.firstChild));
2219
2400
  let o = r.querySelector(".mint-choice-label");
2220
2401
  t ? (o || (o = document.createElement("label"), o.className = "mint-choice-label text-sm font-medium text-gray-900 dark:text-gray-100 select-none", r.insertBefore(o, r.firstChild)), o.textContent = t, o.setAttribute("for", s), n ? o.classList.add("opacity-40") : o.classList.remove("opacity-40")) : o && o.remove();
2221
- let h = r.querySelector(".mint-choice-info");
2222
- i ? (h || (h = document.createElement("span"), h.className = "mint-choice-info text-xs text-gray-500 dark:text-gray-400 select-none", r.appendChild(h)), h.textContent = i, n ? h.classList.add("opacity-40") : h.classList.remove("opacity-40")) : h && h.remove();
2402
+ let c = r.querySelector(".mint-choice-info");
2403
+ i ? (c || (c = document.createElement("span"), c.className = "mint-choice-info text-xs text-gray-500 dark:text-gray-400 select-none", r.appendChild(c)), c.textContent = i, n ? c.classList.add("opacity-40") : c.classList.remove("opacity-40")) : c && c.remove();
2223
2404
  } else r && r.remove();
2224
2405
  let a = this.querySelector(".mint-choice-options-wrapper");
2225
2406
  if (!a) {
@@ -2265,7 +2446,7 @@ class ee extends HTMLElement {
2265
2446
  return ["type", "placeholder", "value", "disabled", "id", "name", "required", "readonly", "rows", "icon", "label", "info", "error", "error-message", "loading"];
2266
2447
  }
2267
2448
  connectedCallback() {
2268
- this.classList.add("box-border", "m-0", "p-0", "border-0", "align-baseline", "inline-block"), this.getLabel() || console.error('mint-input: The "label" attribute is required. Please provide a label for the input.'), this.render();
2449
+ this.classList.add("box-border", "m-0", "p-0", "border-0", "align-baseline", "inline-block"), this.render();
2269
2450
  }
2270
2451
  disconnectedCallback() {
2271
2452
  this.removeEventListeners();
@@ -2391,9 +2572,9 @@ class ee extends HTMLElement {
2391
2572
  render() {
2392
2573
  var y, x, k, E;
2393
2574
  this.getType();
2394
- const e = this._getNormalizedType(), t = this._isTextarea(), i = this._isMoney(), s = this._isColor(), n = this.getPlaceholder(), r = this.isDisabled(), a = this.isReadonly(), l = this.isRequired(), o = this.getId(), h = this.getName(), c = this.getAttribute("value") || (s ? "#000000" : ""), m = this.getRows(), d = this.getIcon(), f = this.getLabel(), u = this.getInfo(), p = this.isLoading();
2395
- if (this._renderSkeleton(p), s) {
2396
- 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 = c || "#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 = (v) => {
2575
+ const e = this._getNormalizedType(), t = 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(), h = this.getAttribute("value") || (s ? "#000000" : ""), d = this.getRows(), u = this.getIcon(), m = this.getLabel(), p = this.getInfo(), f = this.isLoading();
2576
+ if (this._renderSkeleton(f), s) {
2577
+ this._input && (this._input.remove(), this._input = null), this._textarea && (this._textarea.remove(), this._textarea = null), this._wrapper || (this._wrapper = document.createElement("div"), this._wrapper.className = "relative w-full", this.appendChild(this._wrapper)), this._colorContainer && (this._colorContainer.remove(), this._colorContainer = null), this._colorPickerWrapper && !s && (this._colorPickerWrapper.remove(), this._colorPickerWrapper = null), this._colorPickerWrapper || (this._colorPickerWrapper = document.createElement("div"), this._colorPickerWrapper.className = "mint-color-picker-wrapper absolute left-[.65rem] top-1/2 -translate-y-1/2 w-6 h-6 rounded cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500", this._colorPickerWrapper.style.backgroundColor = h || "#000000", this._wrapper.appendChild(this._colorPickerWrapper), this._colorPicker = document.createElement("input"), this._colorPicker.type = "color", this._colorPicker.className = "absolute inset-0 w-full h-full opacity-0 cursor-pointer", this._colorPicker.style.cssText = "position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; z-index: 10; pointer-events: auto; margin: 0; padding: 0; border: none;", this._colorPickerWrapper.appendChild(this._colorPicker), this._focusHandler = (v) => {
2397
2578
  this._colorPickerWrapper && this._colorPicker && this._colorPicker.matches(":focus-visible") && requestAnimationFrame(() => {
2398
2579
  var C;
2399
2580
  this._colorPicker && this._colorPicker.matches(":focus-visible") && ((C = this._colorPickerWrapper) == null || C.classList.add("ring-2", "ring-offset-1", "ring-gray-400", "dark:ring-gray-500"));
@@ -2433,64 +2614,64 @@ class ee extends HTMLElement {
2433
2614
  cancelable: !0
2434
2615
  }));
2435
2616
  }));
2436
- const g = c || "#000000";
2437
- if (this._colorPicker && this._colorPicker.value !== g && (this._colorPicker.value = g), this._colorPickerWrapper && (this._colorPickerWrapper.style.backgroundColor = g), this._colorTextInput && this._colorTextInput.value !== g && (this._colorTextInput.value = g), this._colorPicker && (this._colorPicker.disabled = r), this._colorPickerWrapper && (r ? (this._colorPickerWrapper.classList.add("opacity-40", "cursor-not-allowed"), this._colorPickerWrapper.classList.remove("cursor-pointer")) : (this._colorPickerWrapper.classList.remove("opacity-40", "cursor-not-allowed"), this._colorPickerWrapper.classList.add("cursor-pointer"))), this._colorTextInput && (this._colorTextInput.disabled = r, this._colorTextInput.readOnly = a, this._colorTextInput.required = l), this._colorTextInput) {
2617
+ const _ = h || "#000000";
2618
+ if (this._colorPicker && this._colorPicker.value !== _ && (this._colorPicker.value = _), this._colorPickerWrapper && (this._colorPickerWrapper.style.backgroundColor = _), this._colorTextInput && this._colorTextInput.value !== _ && (this._colorTextInput.value = _), this._colorPicker && (this._colorPicker.disabled = r), this._colorPickerWrapper && (r ? (this._colorPickerWrapper.classList.add("opacity-40", "cursor-not-allowed"), this._colorPickerWrapper.classList.remove("cursor-pointer")) : (this._colorPickerWrapper.classList.remove("opacity-40", "cursor-not-allowed"), this._colorPickerWrapper.classList.add("cursor-pointer"))), this._colorTextInput && (this._colorTextInput.disabled = r, this._colorTextInput.readOnly = a, this._colorTextInput.required = l), this._colorTextInput) {
2438
2619
  const v = this._colorTextInput;
2439
- o ? v.id = o : v.removeAttribute("id"), h ? v.name = h : v.removeAttribute("name"), v.setAttribute("aria-invalid", this.hasError() ? "true" : "false"), this._element = v;
2620
+ o ? v.id = o : v.removeAttribute("id"), c ? v.name = c : v.removeAttribute("name"), v.setAttribute("aria-invalid", this.hasError() ? "true" : "false"), this._element = v;
2440
2621
  }
2441
2622
  this._renderErrorState();
2442
2623
  return;
2443
2624
  }
2444
- if (this._wrapper || (this._wrapper = document.createElement("div"), this._wrapper.className = "relative w-full", this.appendChild(this._wrapper)), this._colorContainer && (this._colorContainer.remove(), this._colorContainer = null, this._colorPicker = null, this._colorTextInput = null), this._colorPickerWrapper && !s && (this._colorPickerWrapper.remove(), this._colorPickerWrapper = null, this._colorPicker = null, this._colorTextInput = null), d && !t ? this._icon ? this._icon.setAttribute("name", d) : (this._icon = document.createElement("mint-icon"), this._icon.setAttribute("name", d), this._icon.className = "absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400 dark:text-gray-500 pointer-events-none", this._wrapper.appendChild(this._icon)) : this._icon && (this._icon.remove(), this._icon = null), this._isNumber() && !t) {
2625
+ if (this._wrapper || (this._wrapper = document.createElement("div"), this._wrapper.className = "relative w-full", this.appendChild(this._wrapper)), this._colorContainer && (this._colorContainer.remove(), this._colorContainer = null, this._colorPicker = null, this._colorTextInput = null), this._colorPickerWrapper && !s && (this._colorPickerWrapper.remove(), this._colorPickerWrapper = null, this._colorPicker = null, this._colorTextInput = null), u && !t ? this._icon ? this._icon.setAttribute("name", u) : (this._icon = document.createElement("mint-icon"), this._icon.setAttribute("name", u), this._icon.className = "absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400 dark:text-gray-500 pointer-events-none", this._wrapper.appendChild(this._icon)) : this._icon && (this._icon.remove(), this._icon = null), this._isNumber() && !t) {
2445
2626
  if (!this._numberSpinnerContainer) {
2446
2627
  this._numberSpinnerContainer = document.createElement("div"), this._numberSpinnerContainer.className = "absolute right-1 top-1/2 -translate-y-1/2 flex flex-col h-8 pointer-events-none", this._wrapper.appendChild(this._numberSpinnerContainer), this._numberIncrementButton = document.createElement("button"), this._numberIncrementButton.type = "button", this._numberIncrementButton.className = "flex items-center justify-center w-5 h-4 text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 disabled:opacity-40 disabled:cursor-not-allowed transition-colors pointer-events-auto bg-gray-100 dark:bg-gray-600 active:bg-gray-200 dark:active:bg-gray-500 rounded";
2447
- const g = document.createElement("mint-icon");
2448
- g.setAttribute("name", "caret-up"), g.className = "w-[1rem] h-[1rem]", this._numberIncrementButton.appendChild(g), this._numberSpinnerContainer.appendChild(this._numberIncrementButton), this._numberDecrementButton = document.createElement("button"), this._numberDecrementButton.type = "button", this._numberDecrementButton.className = "flex items-center justify-center w-5 h-4 text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 disabled:opacity-40 disabled:cursor-not-allowed transition-colors pointer-events-auto bg-gray-100 dark:bg-gray-600 active:bg-gray-200 dark:active:bg-gray-500 rounded";
2628
+ const _ = document.createElement("mint-icon");
2629
+ _.setAttribute("name", "caret-up"), _.className = "w-[1rem] h-[1rem]", this._numberIncrementButton.appendChild(_), this._numberSpinnerContainer.appendChild(this._numberIncrementButton), this._numberDecrementButton = document.createElement("button"), this._numberDecrementButton.type = "button", this._numberDecrementButton.className = "flex items-center justify-center w-5 h-4 text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 disabled:opacity-40 disabled:cursor-not-allowed transition-colors pointer-events-auto bg-gray-100 dark:bg-gray-600 active:bg-gray-200 dark:active:bg-gray-500 rounded";
2449
2630
  const v = document.createElement("mint-icon");
2450
2631
  v.setAttribute("name", "caret-down"), v.className = "w-[1rem] h-[1rem]", this._numberDecrementButton.appendChild(v), this._numberSpinnerContainer.appendChild(this._numberDecrementButton), this._numberIncrementButton.addEventListener("click", (C) => {
2451
2632
  if (C.preventDefault(), C.stopPropagation(), this._input && !this._input.disabled && !this._input.readOnly) {
2452
- const A = parseFloat(this._input.value) || 0, D = parseFloat(this._input.step) || 1, S = this._input.min ? parseFloat(this._input.min) : void 0, T = this._input.max ? parseFloat(this._input.max) : void 0;
2633
+ const A = parseFloat(this._input.value) || 0, D = parseFloat(this._input.step) || 1, S = this._input.min ? parseFloat(this._input.min) : void 0, I = this._input.max ? parseFloat(this._input.max) : void 0;
2453
2634
  let L = A + D;
2454
- T !== void 0 && L > T && (L = T), S !== void 0 && L < S && (L = S), this._input.value = L.toString(), this.setAttribute("value", L.toString()), this._input.dispatchEvent(new Event("input", { bubbles: !0 })), this._input.dispatchEvent(new Event("change", { bubbles: !0 }));
2635
+ I !== void 0 && L > I && (L = I), S !== void 0 && L < S && (L = S), this._input.value = L.toString(), this.setAttribute("value", L.toString()), this._input.dispatchEvent(new Event("input", { bubbles: !0 })), this._input.dispatchEvent(new Event("change", { bubbles: !0 }));
2455
2636
  }
2456
2637
  }), this._numberDecrementButton.addEventListener("click", (C) => {
2457
2638
  if (C.preventDefault(), C.stopPropagation(), this._input && !this._input.disabled && !this._input.readOnly) {
2458
- const A = parseFloat(this._input.value) || 0, D = parseFloat(this._input.step) || 1, S = this._input.min ? parseFloat(this._input.min) : void 0, T = this._input.max ? parseFloat(this._input.max) : void 0;
2639
+ const A = parseFloat(this._input.value) || 0, D = parseFloat(this._input.step) || 1, S = this._input.min ? parseFloat(this._input.min) : void 0, I = this._input.max ? parseFloat(this._input.max) : void 0;
2459
2640
  let L = A - D;
2460
- S !== void 0 && L < S && (L = S), T !== void 0 && L > T && (L = T), this._input.value = L.toString(), this.setAttribute("value", L.toString()), this._input.dispatchEvent(new Event("input", { bubbles: !0 })), this._input.dispatchEvent(new Event("change", { bubbles: !0 }));
2641
+ S !== void 0 && L < S && (L = S), I !== void 0 && L > I && (L = I), this._input.value = L.toString(), this.setAttribute("value", L.toString()), this._input.dispatchEvent(new Event("input", { bubbles: !0 })), this._input.dispatchEvent(new Event("change", { bubbles: !0 }));
2461
2642
  }
2462
2643
  });
2463
2644
  }
2464
2645
  this._numberIncrementButton && (this._numberIncrementButton.disabled = r || a), this._numberDecrementButton && (this._numberDecrementButton.disabled = r || a);
2465
2646
  } else this._numberSpinnerContainer && (this._numberSpinnerContainer.remove(), this._numberSpinnerContainer = null, this._numberIncrementButton = null, this._numberDecrementButton = null);
2466
2647
  if (t) {
2467
- 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 = m, this._textarea.setAttribute("aria-invalid", this.hasError() ? "true" : "false"), c !== this._textarea.value && (this._textarea.value = c), o ? this._textarea.id = o : this._textarea.removeAttribute("id"), h ? this._textarea.name = h : this._textarea.removeAttribute("name"), this._textarea.className = this.getInputClasses(), this.firstChild && this.firstChild !== this._wrapper && this.firstChild.nodeType === Node.TEXT_NODE) {
2468
- const g = this.firstChild.textContent;
2469
- g && !this._textarea.value && (this._textarea.value = g.trim()), this.removeChild(this.firstChild);
2648
+ 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 = d, this._textarea.setAttribute("aria-invalid", this.hasError() ? "true" : "false"), h !== this._textarea.value && (this._textarea.value = h), 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) {
2649
+ const _ = this.firstChild.textContent;
2650
+ _ && !this._textarea.value && (this._textarea.value = _.trim()), this.removeChild(this.firstChild);
2470
2651
  }
2471
- } else if (this._textarea && (this._textarea.remove(), this._textarea = null), this._input || (this._input = document.createElement("input"), this._wrapper.appendChild(this._input), this.setupEventListeners()), this._element = this._input, this._input.type = e, this._input.placeholder = n, this._input.disabled = r, this._input.readOnly = a, this._input.required = l, this._input.setAttribute("aria-invalid", this.hasError() ? "true" : "false"), i ? (this._input.inputMode = "decimal", this._input.pattern = "[0-9]*\\.?[0-9]*") : (this._input.removeAttribute("inputmode"), this._input.removeAttribute("pattern")), c !== this._input.value && (this._input.value = c), o ? this._input.id = o : this._input.removeAttribute("id"), h ? this._input.name = h : this._input.removeAttribute("name"), this._input.className = this.getInputClasses(), this.firstChild && this.firstChild !== this._wrapper && this.firstChild.nodeType === Node.TEXT_NODE) {
2472
- const g = this.firstChild.textContent;
2473
- g && !this._input.value && (this._input.value = g.trim()), this.removeChild(this.firstChild);
2652
+ } else if (this._textarea && (this._textarea.remove(), this._textarea = null), this._input || (this._input = document.createElement("input"), this._wrapper.appendChild(this._input), this.setupEventListeners()), this._element = this._input, this._input.type = e, this._input.placeholder = n, this._input.disabled = r, this._input.readOnly = a, this._input.required = l, this._input.setAttribute("aria-invalid", this.hasError() ? "true" : "false"), i ? (this._input.inputMode = "decimal", this._input.pattern = "[0-9]*\\.?[0-9]*") : (this._input.removeAttribute("inputmode"), this._input.removeAttribute("pattern")), h !== this._input.value && (this._input.value = h), o ? this._input.id = o : this._input.removeAttribute("id"), c ? this._input.name = c : this._input.removeAttribute("name"), this._input.className = this.getInputClasses(), this.firstChild && this.firstChild !== this._wrapper && this.firstChild.nodeType === Node.TEXT_NODE) {
2653
+ const _ = this.firstChild.textContent;
2654
+ _ && !this._input.value && (this._input.value = _.trim()), this.removeChild(this.firstChild);
2474
2655
  }
2475
- let b = this.querySelector(".mint-input-label-container");
2476
- if (f || u) {
2477
- 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));
2478
- let g = b.querySelector(".mint-input-label");
2479
- if (f) {
2480
- g || (g = document.createElement("label"), g.className = "mint-input-label text-sm font-medium text-gray-900 dark:text-gray-100 select-none", b.insertBefore(g, b.firstChild)), g.textContent = f;
2656
+ let g = this.querySelector(".mint-input-label-container");
2657
+ if (m || p) {
2658
+ g || (g = document.createElement("div"), g.className = "mint-input-label-container flex flex-col gap-0.5 mb-[.25rem]", this._wrapper && this._wrapper.parentElement === this ? this.insertBefore(g, this._wrapper) : this.insertBefore(g, this.firstChild));
2659
+ let _ = g.querySelector(".mint-input-label");
2660
+ if (m) {
2661
+ _ || (_ = document.createElement("label"), _.className = "mint-input-label text-sm font-medium text-gray-900 dark:text-gray-100 select-none", g.insertBefore(_, g.firstChild)), _.textContent = m;
2481
2662
  const C = o || ((y = this._element) == null ? void 0 : y.id) || ((x = this._colorTextInput) == null ? void 0 : x.id) || ((k = this._input) == null ? void 0 : k.id) || ((E = this._textarea) == null ? void 0 : E.id);
2482
2663
  if (C)
2483
- g.setAttribute("for", C);
2664
+ _.setAttribute("for", C);
2484
2665
  else {
2485
2666
  const A = `mint-input-${Math.random().toString(36).substr(2, 9)}`;
2486
- this._element ? this._element.id = A : this._colorTextInput ? this._colorTextInput.id = A : this._input ? this._input.id = A : this._textarea && (this._textarea.id = A), g.setAttribute("for", A);
2667
+ this._element ? this._element.id = A : this._colorTextInput ? this._colorTextInput.id = A : this._input ? this._input.id = A : this._textarea && (this._textarea.id = A), _.setAttribute("for", A);
2487
2668
  }
2488
- r ? g.classList.add("opacity-40") : g.classList.remove("opacity-40");
2489
- } else g && g.remove();
2490
- let v = b.querySelector(".mint-input-info");
2491
- u ? (v || (v = document.createElement("span"), v.className = "mint-input-info text-xs text-gray-500 dark:text-gray-400 select-none", b.appendChild(v)), v.textContent = u, r ? v.classList.add("opacity-40") : v.classList.remove("opacity-40")) : v && v.remove();
2492
- } else b && b.remove();
2493
- this._renderErrorState(), this._renderSkeleton(p);
2669
+ r ? _.classList.add("opacity-40") : _.classList.remove("opacity-40");
2670
+ } else _ && _.remove();
2671
+ let v = g.querySelector(".mint-input-info");
2672
+ p ? (v || (v = document.createElement("span"), v.className = "mint-input-info text-xs text-gray-500 dark:text-gray-400 select-none", g.appendChild(v)), v.textContent = p, r ? v.classList.add("opacity-40") : v.classList.remove("opacity-40")) : v && v.remove();
2673
+ } else g && g.remove();
2674
+ this._renderErrorState(), this._renderSkeleton(f);
2494
2675
  }
2495
2676
  _renderErrorState() {
2496
2677
  const e = this.hasError(), t = this.getErrorMessage();
@@ -2758,17 +2939,17 @@ class te extends HTMLElement {
2758
2939
  }), s.addEventListener("keydown", (a) => {
2759
2940
  a.key === "Backspace" && s.selectionStart === 0 && s.selectionEnd === 0 && this._focusPrev(e, n), a.key === "ArrowLeft" && s.selectionStart === 0 && s.selectionEnd === 0 && (this._focusPrev(e, n), a.preventDefault()), a.key === "ArrowRight" && s.selectionStart === s.value.length && s.selectionEnd === s.value.length && (this._focusNext(e, n), a.preventDefault());
2760
2941
  }), s.addEventListener("blur", (a) => {
2761
- var h, c;
2942
+ var c, h;
2762
2943
  this._syncHiddenInput();
2763
2944
  const l = a.relatedTarget;
2764
- l && (this.contains(l) || (h = this._popover) != null && h.contains(l) || this._calendarContainer && this._calendarContainer.contains(l)) || (this._handleBlur(((c = this._hiddenInput) == null ? void 0 : c.value) || ""), this._exitInputMode(), setTimeout(() => {
2945
+ l && (this.contains(l) || (c = this._popover) != null && c.contains(l) || this._calendarContainer && this._calendarContainer.contains(l)) || (this._handleBlur(((h = this._hiddenInput) == null ? void 0 : h.value) || ""), this._exitInputMode(), setTimeout(() => {
2765
2946
  if (this._hiddenInput) {
2766
- const m = new FocusEvent("blur", {
2947
+ const d = new FocusEvent("blur", {
2767
2948
  bubbles: !0,
2768
2949
  cancelable: !0,
2769
2950
  relatedTarget: a.relatedTarget
2770
2951
  });
2771
- this._hiddenInput.dispatchEvent(m);
2952
+ this._hiddenInput.dispatchEvent(d);
2772
2953
  }
2773
2954
  }, 0));
2774
2955
  });
@@ -2796,55 +2977,55 @@ class te extends HTMLElement {
2796
2977
  _parseDateString(e, t) {
2797
2978
  const i = /[\/\-\.\s]+/;
2798
2979
  if (i.test(e)) {
2799
- const p = e.split(i).filter((b) => b.length > 0), _ = t.split(/[\/\-\.\s]+/).filter((b) => b.length > 0);
2800
- if (p.length === _.length) {
2801
- let b = 0, y = 0, x = 0;
2802
- for (let k = 0; k < _.length; k++) {
2803
- const E = _[k].toLowerCase(), g = p[k];
2980
+ const f = e.split(i).filter((g) => g.length > 0), b = t.split(/[\/\-\.\s]+/).filter((g) => g.length > 0);
2981
+ if (f.length === b.length) {
2982
+ let g = 0, y = 0, x = 0;
2983
+ for (let k = 0; k < b.length; k++) {
2984
+ const E = b[k].toLowerCase(), _ = f[k];
2804
2985
  if (E.includes("d"))
2805
- b = parseInt(g, 10);
2986
+ g = parseInt(_, 10);
2806
2987
  else if (E.includes("m"))
2807
- y = parseInt(g, 10) - 1;
2988
+ y = parseInt(_, 10) - 1;
2808
2989
  else if (E.includes("y")) {
2809
- let v = parseInt(g, 10);
2810
- const C = E.length, A = g.length;
2990
+ let v = parseInt(_, 10);
2991
+ const C = E.length, A = _.length;
2811
2992
  A === 2 && C === 4 ? v = Math.floor((/* @__PURE__ */ new Date()).getFullYear() / 100) * 100 + v : A === 2 && C === 2 && (v = Math.floor((/* @__PURE__ */ new Date()).getFullYear() / 100) * 100 + v), x = v;
2812
2993
  }
2813
2994
  }
2814
- if (b && y >= 0 && y <= 11 && x) {
2815
- const k = new Date(x, y, b);
2816
- if (!isNaN(k.getTime()) && k.getDate() === b && k.getMonth() === y && k.getFullYear() === x)
2995
+ if (g && y >= 0 && y <= 11 && x) {
2996
+ const k = new Date(x, y, g);
2997
+ if (!isNaN(k.getTime()) && k.getDate() === g && k.getMonth() === y && k.getFullYear() === x)
2817
2998
  return k;
2818
2999
  }
2819
3000
  }
2820
3001
  }
2821
3002
  const n = e.replace(/[\/\-\.]/g, ""), r = t.replace(/[\/\-\.]/g, "").toLowerCase();
2822
3003
  let a = r.indexOf("d"), l = r.indexOf("m"), o = r.indexOf("y");
2823
- const h = [
3004
+ const c = [
2824
3005
  { char: "d", index: a },
2825
3006
  { char: "m", index: l },
2826
3007
  { char: "y", index: o }
2827
- ].sort((p, _) => p.index - _.index);
2828
- let c = 0, m = 0, d = 0, f = 0;
3008
+ ].sort((f, b) => f.index - b.index);
3009
+ let h = 0, d = 0, u = 0, m = 0;
2829
3010
  r.length, n.length;
2830
- for (const p of h)
2831
- if (p.char === "d") {
2832
- const _ = r.lastIndexOf("d") - r.indexOf("d") + 1, b = n.substr(f, _);
2833
- if (b.length === 0) return null;
2834
- c = parseInt(b, 10), f += b.length;
2835
- } else if (p.char === "m") {
2836
- const _ = r.lastIndexOf("m") - r.indexOf("m") + 1, b = n.substr(f, _);
2837
- if (b.length === 0) return null;
2838
- m = parseInt(b, 10) - 1, f += b.length;
2839
- } else if (p.char === "y") {
2840
- const _ = r.lastIndexOf("y") - r.indexOf("y") + 1, b = n.substr(f), y = Math.min(_, b.length), x = b.substr(0, y);
3011
+ for (const f of c)
3012
+ if (f.char === "d") {
3013
+ const b = r.lastIndexOf("d") - r.indexOf("d") + 1, g = n.substr(m, b);
3014
+ if (g.length === 0) return null;
3015
+ h = parseInt(g, 10), m += g.length;
3016
+ } else if (f.char === "m") {
3017
+ const b = r.lastIndexOf("m") - r.indexOf("m") + 1, g = n.substr(m, b);
3018
+ if (g.length === 0) return null;
3019
+ d = parseInt(g, 10) - 1, m += g.length;
3020
+ } else if (f.char === "y") {
3021
+ const b = r.lastIndexOf("y") - r.indexOf("y") + 1, g = n.substr(m), y = Math.min(b, g.length), x = g.substr(0, y);
2841
3022
  if (x.length === 0) return null;
2842
3023
  let k = parseInt(x, 10);
2843
- y === 2 && _ === 4 ? k = Math.floor((/* @__PURE__ */ new Date()).getFullYear() / 100) * 100 + k : y === 2 && _ === 2 && (k = Math.floor((/* @__PURE__ */ new Date()).getFullYear() / 100) * 100 + k), d = k, f += y;
3024
+ y === 2 && b === 4 ? k = Math.floor((/* @__PURE__ */ new Date()).getFullYear() / 100) * 100 + k : y === 2 && b === 2 && (k = Math.floor((/* @__PURE__ */ new Date()).getFullYear() / 100) * 100 + k), u = k, m += y;
2844
3025
  }
2845
- if (!c || m < 0 || m > 11 || !d) return null;
2846
- const u = new Date(d, m, c);
2847
- return isNaN(u.getTime()) || u.getDate() !== c || u.getMonth() !== m || u.getFullYear() !== d ? null : u;
3026
+ if (!h || d < 0 || d > 11 || !u) return null;
3027
+ const p = new Date(u, d, h);
3028
+ return isNaN(p.getTime()) || p.getDate() !== h || p.getMonth() !== d || p.getFullYear() !== u ? null : p;
2848
3029
  }
2849
3030
  _formatDate(e, t) {
2850
3031
  const i = e.getDate(), s = e.getMonth() + 1, n = e.getFullYear(), r = t.toLowerCase();
@@ -2853,104 +3034,104 @@ class te extends HTMLElement {
2853
3034
  }
2854
3035
  // PHP-style formatter for display mode
2855
3036
  _formatDatePhp(e, t) {
2856
- const i = e.getDate(), s = e.getMonth() + 1, n = e.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"], h = (d, f = 2) => d.toString().padStart(f, "0"), c = (d) => {
2857
- const f = d % 10, u = d % 100;
2858
- return f === 1 && u !== 11 ? "st" : f === 2 && u !== 12 ? "nd" : f === 3 && u !== 13 ? "rd" : "th";
3037
+ const i = e.getDate(), s = e.getMonth() + 1, n = e.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 = (u, m = 2) => u.toString().padStart(m, "0"), h = (u) => {
3038
+ const m = u % 10, p = u % 100;
3039
+ return m === 1 && p !== 11 ? "st" : m === 2 && p !== 12 ? "nd" : m === 3 && p !== 13 ? "rd" : "th";
2859
3040
  };
2860
- let m = "";
2861
- for (let d = 0; d < t.length; d++) {
2862
- const f = t[d];
2863
- if (f === "\\" && d + 1 < t.length) {
2864
- m += t[d + 1], d++;
3041
+ let d = "";
3042
+ for (let u = 0; u < t.length; u++) {
3043
+ const m = t[u];
3044
+ if (m === "\\" && u + 1 < t.length) {
3045
+ d += t[u + 1], u++;
2865
3046
  continue;
2866
3047
  }
2867
- switch (f) {
3048
+ switch (m) {
2868
3049
  case "Y":
2869
- m += n.toString();
3050
+ d += n.toString();
2870
3051
  break;
2871
3052
  case "y":
2872
- m += n.toString().slice(-2);
3053
+ d += n.toString().slice(-2);
2873
3054
  break;
2874
3055
  case "m":
2875
- m += h(s);
3056
+ d += c(s);
2876
3057
  break;
2877
3058
  case "n":
2878
- m += s.toString();
3059
+ d += s.toString();
2879
3060
  break;
2880
3061
  case "M":
2881
- m += o[s - 1];
3062
+ d += o[s - 1];
2882
3063
  break;
2883
3064
  case "F":
2884
- m += l[s - 1];
3065
+ d += l[s - 1];
2885
3066
  break;
2886
3067
  case "d":
2887
- m += h(i);
3068
+ d += c(i);
2888
3069
  break;
2889
3070
  case "j":
2890
- m += i.toString();
3071
+ d += i.toString();
2891
3072
  break;
2892
3073
  case "D":
2893
- m += a[e.getDay()];
3074
+ d += a[e.getDay()];
2894
3075
  break;
2895
3076
  case "l":
2896
- m += r[e.getDay()];
3077
+ d += r[e.getDay()];
2897
3078
  break;
2898
3079
  case "S":
2899
- m += c(i);
3080
+ d += h(i);
2900
3081
  break;
2901
3082
  default:
2902
- m += f;
3083
+ d += m;
2903
3084
  break;
2904
3085
  }
2905
3086
  }
2906
- return m;
3087
+ return d;
2907
3088
  }
2908
3089
  _validateDateString(e, t) {
2909
3090
  const i = this._parseDateString(e, t);
2910
3091
  return i !== null && !isNaN(i.getTime());
2911
3092
  }
2912
3093
  render() {
2913
- const e = this.isLoading(), t = this.getLabel(), i = this.getInfo(), s = this.getValue(), n = this.isDisabled(), r = this.isReadonly(), a = this.isRequired(), l = this.getId(), o = this.getName(), h = this.getFormat(), c = this.hasError(), m = this.getErrorMessage();
3094
+ const e = this.isLoading(), t = 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(), h = this.hasError(), d = this.getErrorMessage();
2914
3095
  this._isRange = this.isRange(), this._input || (this._input = document.createElement("div"), this._input.className = "relative w-full", this.appendChild(this._input));
2915
- let d = this.querySelector(".mint-date-picker-label-container");
3096
+ let u = this.querySelector(".mint-date-picker-label-container");
2916
3097
  if (t || i) {
2917
- d || (d = document.createElement("div"), d.className = "mint-date-picker-label-container flex flex-col gap-0.5 mb-[.25rem]", this.contains(this._input) ? this.insertBefore(d, this._input) : this.appendChild(d));
2918
- let y = d.querySelector(".mint-date-picker-label");
2919
- t ? (y || (y = document.createElement("label"), y.className = "mint-date-picker-label text-sm font-medium text-gray-900 dark:text-gray-100 select-none", d.insertBefore(y, d.firstChild)), y.textContent = t, l && this._textInput && y.setAttribute("for", l)) : y && y.remove();
2920
- let x = d.querySelector(".mint-date-picker-info");
2921
- i ? (x || (x = document.createElement("span"), x.className = "mint-date-picker-info text-xs text-gray-500 dark:text-gray-400 select-none", d.appendChild(x)), x.textContent = i) : x && x.remove();
2922
- } else d && d.remove();
2923
- 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", c ? "true" : "false");
2924
- let f = this._input.querySelector(".mint-date-fields");
2925
- f || (f = document.createElement("div"), this._input.appendChild(f)), this._fieldsContainer = f, this._applyErrorVisuals(c, m, n), f.innerHTML = "", this._displayEl = document.createElement("div");
2926
- const u = r ? "select-text" : "select-none";
2927
- this._displayEl.className = `flex-1 text-gray-900 dark:text-white ${r ? "cursor-default" : "cursor-text"} ${u} focus:outline-none`, this._displayEl.tabIndex = n || r ? -1 : 0, this._displayEl.addEventListener("click", () => {
3098
+ u || (u = document.createElement("div"), u.className = "mint-date-picker-label-container flex flex-col gap-0.5 mb-[.25rem]", this.contains(this._input) ? this.insertBefore(u, this._input) : this.appendChild(u));
3099
+ let y = u.querySelector(".mint-date-picker-label");
3100
+ t ? (y || (y = document.createElement("label"), y.className = "mint-date-picker-label text-sm font-medium text-gray-900 dark:text-gray-100 select-none", u.insertBefore(y, u.firstChild)), y.textContent = t, l && this._textInput && y.setAttribute("for", l)) : y && y.remove();
3101
+ let x = u.querySelector(".mint-date-picker-info");
3102
+ i ? (x || (x = document.createElement("span"), x.className = "mint-date-picker-info text-xs text-gray-500 dark:text-gray-400 select-none", u.appendChild(x)), x.textContent = i) : x && x.remove();
3103
+ } else u && u.remove();
3104
+ 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", h ? "true" : "false");
3105
+ let m = this._input.querySelector(".mint-date-fields");
3106
+ m || (m = document.createElement("div"), this._input.appendChild(m)), this._fieldsContainer = m, this._applyErrorVisuals(h, d, n), m.innerHTML = "", this._displayEl = document.createElement("div");
3107
+ const p = r ? "select-text" : "select-none";
3108
+ this._displayEl.className = `flex-1 text-gray-900 dark:text-white ${r ? "cursor-default" : "cursor-text"} ${p} focus:outline-none`, this._displayEl.tabIndex = n || r ? -1 : 0, this._displayEl.addEventListener("click", () => {
2928
3109
  n || r || this._enterInputMode();
2929
3110
  }), this._displayEl.addEventListener("keydown", (y) => {
2930
3111
  n || r || (y.key === "Enter" || y.key === " ") && (y.preventDefault(), this._enterInputMode());
2931
3112
  }), this._inputsWrapperEl = document.createElement("div"), this._inputsWrapperEl.className = "flex items-center gap-1 w-full";
2932
- const p = this._getFormatTokens(h);
3113
+ const f = this._getFormatTokens(c);
2933
3114
  this._startPartInputs = [], this._endPartInputs = [];
2934
- const _ = (y) => {
3115
+ const b = (y) => {
2935
3116
  const x = document.createDocumentFragment();
2936
- return p.forEach((k) => {
3117
+ return f.forEach((k) => {
2937
3118
  if (k.type === "sep") {
2938
3119
  const E = document.createElement("span");
2939
3120
  E.textContent = k.value, E.className = "text-gray-400 dark:text-gray-500 select-none", x.appendChild(E);
2940
3121
  } else {
2941
- const E = k.part === "d" ? "dd" : k.part === "m" ? "mm" : k.len === 2 ? "yy" : "yyyy", g = this._createPartInput(k.len, E, n, r, a);
2942
- y === "start" ? this._startPartInputs.push(g) : this._endPartInputs.push(g), x.appendChild(g);
3122
+ const E = k.part === "d" ? "dd" : k.part === "m" ? "mm" : k.len === 2 ? "yy" : "yyyy", _ = this._createPartInput(k.len, E, n, r, a);
3123
+ y === "start" ? this._startPartInputs.push(_) : this._endPartInputs.push(_), x.appendChild(_);
2943
3124
  }
2944
3125
  }), x;
2945
3126
  };
2946
- if (this._inputsWrapperEl.appendChild(_("start")), this._isRange) {
3127
+ if (this._inputsWrapperEl.appendChild(b("start")), this._isRange) {
2947
3128
  const y = document.createElement("span");
2948
- y.textContent = " - ", y.className = "text-gray-400 dark:text-gray-500 select-none", this._inputsWrapperEl.appendChild(y), this._inputsWrapperEl.appendChild(_("end"));
3129
+ y.textContent = " - ", y.className = "text-gray-400 dark:text-gray-500 select-none", this._inputsWrapperEl.appendChild(y), this._inputsWrapperEl.appendChild(b("end"));
2949
3130
  }
2950
- const b = document.createElement("div");
2951
- if (b.className = "flex flex-col w-full", this._displayEl.style.display = this._isInputMode ? "none" : "flex", this._inputsWrapperEl.style.display = this._isInputMode ? "flex" : "none", b.appendChild(this._displayEl), b.appendChild(this._inputsWrapperEl), f.appendChild(b), f.addEventListener("click", () => {
3131
+ const g = document.createElement("div");
3132
+ if (g.className = "flex flex-col w-full", this._displayEl.style.display = this._isInputMode ? "none" : "flex", this._inputsWrapperEl.style.display = this._isInputMode ? "flex" : "none", g.appendChild(this._displayEl), g.appendChild(this._inputsWrapperEl), m.appendChild(g), m.addEventListener("click", () => {
2952
3133
  this._isInputMode || n || r || this._enterInputMode();
2953
- }), this._attachPartInputHandlers(this._startPartInputs, p, f), this._isRange && this._attachPartInputHandlers(this._endPartInputs, p, f), this._parseValue(s), this._syncHiddenInput(), this._updateDisplayText(), this._iconButton)
3134
+ }), this._attachPartInputHandlers(this._startPartInputs, f, m), this._isRange && this._attachPartInputHandlers(this._endPartInputs, f, m), this._parseValue(s), this._syncHiddenInput(), this._updateDisplayText(), this._iconButton)
2954
3135
  this._iconButton.disabled = n || r, !n && !r ? this._iconButton.tabIndex = 0 : this._iconButton.tabIndex = -1;
2955
3136
  else {
2956
3137
  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";
@@ -2961,7 +3142,7 @@ class te extends HTMLElement {
2961
3142
  n || r || this._enterInputMode();
2962
3143
  }), this._input.prepend(this._iconButton), this._iconButton.disabled = n || r;
2963
3144
  }
2964
- this._renderErrorState(c, m), this._renderSkeleton(e);
3145
+ this._renderErrorState(h, d), this._renderSkeleton(e);
2965
3146
  }
2966
3147
  _renderErrorState(e, t) {
2967
3148
  let i = this.querySelector(".mint-date-picker-error");
@@ -3009,8 +3190,8 @@ class te extends HTMLElement {
3009
3190
  if (this._isRange) {
3010
3191
  const [i, s] = this._splitRangeInput(e, t), n = i ? this._parseDateString(i, t) : null, r = s ? this._parseDateString(s, t) : null;
3011
3192
  if (n && r) {
3012
- const [a, l] = n <= r ? [n, r] : [r, n], o = this._formatDate(a, t), h = this._formatDate(l, t), c = `${o} - ${h}`;
3013
- this.setValue(c), this._applyDateToParts(a, this._startPartInputs, this._getFormatTokens(t), t), this._applyDateToParts(l, this._endPartInputs, this._getFormatTokens(t), t), this._selectedStartDate = a, this._selectedEndDate = l, this._currentMonth = a.getMonth(), this._currentYear = a.getFullYear();
3193
+ const [a, l] = n <= r ? [n, r] : [r, n], o = this._formatDate(a, t), c = this._formatDate(l, t), h = `${o} - ${c}`;
3194
+ this.setValue(h), this._applyDateToParts(a, this._startPartInputs, this._getFormatTokens(t), t), this._applyDateToParts(l, this._endPartInputs, this._getFormatTokens(t), t), this._selectedStartDate = a, this._selectedEndDate = l, this._currentMonth = a.getMonth(), this._currentYear = a.getFullYear();
3014
3195
  } else if (n) {
3015
3196
  const a = this._formatDate(n, t);
3016
3197
  this.setValue(a), this._applyDateToParts(n, this._startPartInputs, this._getFormatTokens(t), t), this._applyDateToParts(null, this._endPartInputs, this._getFormatTokens(t), t), this._selectedStartDate = n, this._selectedEndDate = null, this._currentMonth = n.getMonth(), this._currentYear = n.getFullYear();
@@ -3121,59 +3302,59 @@ class te extends HTMLElement {
3121
3302
  l.className = "flex-1 min-w-0";
3122
3303
  const o = document.createElement("div");
3123
3304
  o.className = "flex items-center justify-between mb-4";
3124
- const h = document.createElement("button");
3125
- h.type = "button", h.tabIndex = 0, h.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", h.setAttribute("data-keep-popover-open", "true");
3126
- const c = document.createElement("mint-icon");
3127
- c.setAttribute("name", "caret-left"), c.className = "w-4 h-4", h.appendChild(c), h.addEventListener("click", () => {
3305
+ const c = document.createElement("button");
3306
+ c.type = "button", c.tabIndex = 0, c.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", c.setAttribute("data-keep-popover-open", "true");
3307
+ const h = document.createElement("mint-icon");
3308
+ h.setAttribute("name", "caret-left"), h.className = "w-4 h-4", c.appendChild(h), c.addEventListener("click", () => {
3128
3309
  this._currentMonth === 0 ? (this._currentMonth = 11, this._currentYear--) : this._currentMonth--, this._buildCalendar();
3129
- }), o.appendChild(h);
3130
- const m = document.createElement("div");
3131
- m.className = "flex items-center gap-2";
3132
- const d = document.createElement("button");
3133
- d.type = "button", d.tabIndex = 0, d.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", d.setAttribute("data-keep-popover-open", "true"), d.textContent = i[this._currentMonth], d.addEventListener("click", () => {
3310
+ }), o.appendChild(c);
3311
+ const d = document.createElement("div");
3312
+ d.className = "flex items-center gap-2";
3313
+ const u = document.createElement("button");
3314
+ u.type = "button", u.tabIndex = 0, u.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", u.setAttribute("data-keep-popover-open", "true"), u.textContent = i[this._currentMonth], u.addEventListener("click", () => {
3134
3315
  this._viewMode = "month", this._buildCalendar();
3135
- }), m.appendChild(d);
3136
- const f = document.createElement("button");
3137
- f.type = "button", f.tabIndex = 0, f.className = "text-sm font-medium text-gray-900 dark:text-gray-100 hover:text-gray-600 dark:hover:text-gray-300 transition-colors flex items-center focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500", f.setAttribute("data-keep-popover-open", "true"), f.textContent = String(this._currentYear), f.addEventListener("click", () => {
3316
+ }), d.appendChild(u);
3317
+ const m = document.createElement("button");
3318
+ 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", () => {
3138
3319
  this._viewMode = "year", this._buildCalendar();
3139
- }), m.appendChild(f), o.appendChild(m);
3140
- const u = document.createElement("button");
3141
- 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");
3142
- const p = document.createElement("mint-icon");
3143
- p.setAttribute("name", "caret-right"), p.className = "w-4 h-4", u.appendChild(p), u.addEventListener("click", () => {
3320
+ }), d.appendChild(m), o.appendChild(d);
3321
+ const p = document.createElement("button");
3322
+ p.type = "button", p.tabIndex = 0, p.className = "p-1 rounded hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-600 dark:text-gray-300 transition-colors flex items-center focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500", p.setAttribute("data-keep-popover-open", "true");
3323
+ const f = document.createElement("mint-icon");
3324
+ f.setAttribute("name", "caret-right"), f.className = "w-4 h-4", p.appendChild(f), p.addEventListener("click", () => {
3144
3325
  this._currentMonth === 11 ? (this._currentMonth = 0, this._currentYear++) : this._currentMonth++, this._buildCalendar();
3145
- }), o.appendChild(u);
3146
- const _ = document.createElement("div");
3147
- _.className = "grid grid-cols-7 mb-2", s.forEach((k) => {
3326
+ }), o.appendChild(p);
3327
+ const b = document.createElement("div");
3328
+ b.className = "grid grid-cols-7 mb-2", s.forEach((k) => {
3148
3329
  const E = document.createElement("div");
3149
- E.className = "text-xs font-medium text-gray-500 dark:text-gray-400 text-center py-1", E.textContent = k, _.appendChild(E);
3330
+ E.className = "text-xs font-medium text-gray-500 dark:text-gray-400 text-center py-1", E.textContent = k, b.appendChild(E);
3150
3331
  });
3151
- const b = document.createElement("div");
3152
- b.className = "grid grid-cols-7";
3332
+ const g = document.createElement("div");
3333
+ g.className = "grid grid-cols-7";
3153
3334
  for (let k = 0; k < t; k++) {
3154
3335
  const E = document.createElement("div");
3155
- E.className = "w-8 h-8", b.appendChild(E);
3336
+ E.className = "w-8 h-8", g.appendChild(E);
3156
3337
  }
3157
3338
  const y = this.getMin() ? this._parseDateString(this.getMin(), this.getFormat()) : null, x = this.getMax() ? this._parseDateString(this.getMax(), this.getFormat()) : null;
3158
3339
  for (let k = 1; k <= e; k++) {
3159
- const E = new Date(this._currentYear, this._currentMonth, k), g = this._isToday(E), v = this._isDateSelected(E), C = this._isDateInRange(E), A = y && E < y || x && E > x;
3340
+ const E = new Date(this._currentYear, this._currentMonth, k), _ = this._isToday(E), v = this._isDateSelected(E), C = this._isDateInRange(E), A = y && E < y || x && E > x;
3160
3341
  let D = "rounded-md";
3161
3342
  if (this._isRange && this._selectedStartDate && this._selectedEndDate) {
3162
- const T = this._isSameDate(E, this._selectedStartDate), L = this._isSameDate(E, this._selectedEndDate);
3163
- T && L ? D = "rounded-md" : T ? D = "rounded-l-md" : L ? D = "rounded-r-md" : C && (D = "rounded-none");
3343
+ const I = this._isSameDate(E, this._selectedStartDate), L = this._isSameDate(E, this._selectedEndDate);
3344
+ I && L ? D = "rounded-md" : I ? D = "rounded-l-md" : L ? D = "rounded-r-md" : C && (D = "rounded-none");
3164
3345
  } else v && !this._isRange && (D = "rounded-md");
3165
3346
  const S = document.createElement("button");
3166
- S.type = "button", S.disabled = !!A, S.tabIndex = A ? -1 : 0, S.className = `w-full h-8 ${D} 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 ${v ? "bg-slate-800 dark:bg-slate-600 text-white" : C ? "bg-slate-100 dark:bg-slate-700 text-slate-800 dark:text-slate-200" : g ? "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"} ${A ? "opacity-40 cursor-not-allowed" : ""}`, S.textContent = k.toString(), A || S.addEventListener("click", () => {
3347
+ S.type = "button", S.disabled = !!A, S.tabIndex = A ? -1 : 0, S.className = `w-full h-8 ${D} 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 ${v ? "bg-slate-800 dark:bg-slate-600 text-white" : C ? "bg-slate-100 dark:bg-slate-700 text-slate-800 dark:text-slate-200" : _ ? "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"} ${A ? "opacity-40 cursor-not-allowed" : ""}`, S.textContent = k.toString(), A || S.addEventListener("click", () => {
3167
3348
  this._handleDateClick(E);
3168
- }), b.appendChild(S);
3349
+ }), g.appendChild(S);
3169
3350
  }
3170
3351
  if (r) {
3171
3352
  const k = document.createElement("div");
3172
3353
  k.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";
3173
3354
  const E = document.createElement("div");
3174
3355
  E.className = "relative md:relative md:flex-1 md:min-h-0";
3175
- const g = document.createElement("div");
3176
- g.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", g.style.scrollbarWidth = "none", g.style.msOverflowStyle = "none", g.style.setProperty("-webkit-overflow-scrolling", "touch");
3356
+ const _ = document.createElement("div");
3357
+ _.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", _.style.scrollbarWidth = "none", _.style.msOverflowStyle = "none", _.style.setProperty("-webkit-overflow-scrolling", "touch");
3177
3358
  const v = document.createElement("style");
3178
3359
  v.textContent = `
3179
3360
  .mint-date-shortcuts-row::-webkit-scrollbar {
@@ -3199,7 +3380,7 @@ class te extends HTMLElement {
3199
3380
  background: rgba(255, 255, 255, 0.2);
3200
3381
  }
3201
3382
  }
3202
- `, g.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));
3383
+ `, _.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));
3203
3384
  const C = document.createElement("div");
3204
3385
  C.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", E.appendChild(C);
3205
3386
  const A = document.createElement("div");
@@ -3208,28 +3389,28 @@ class te extends HTMLElement {
3208
3389
  D.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", E.appendChild(D);
3209
3390
  const S = document.createElement("div");
3210
3391
  S.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", E.appendChild(S);
3211
- const T = () => {
3392
+ const I = () => {
3212
3393
  if (window.innerWidth >= 768) {
3213
- const H = g.scrollTop, I = g.scrollHeight, N = g.clientHeight;
3214
- H > 0 ? D.style.opacity = "1" : D.style.opacity = "0", H + N < I - 1 ? S.style.opacity = "1" : S.style.opacity = "0", C.style.opacity = "0", A.style.opacity = "0";
3394
+ const H = _.scrollTop, T = _.scrollHeight, N = _.clientHeight;
3395
+ H > 0 ? D.style.opacity = "1" : D.style.opacity = "0", H + N < T - 1 ? S.style.opacity = "1" : S.style.opacity = "0", C.style.opacity = "0", A.style.opacity = "0";
3215
3396
  } else {
3216
- const H = g.scrollLeft, I = g.scrollWidth, N = g.clientWidth;
3217
- H > 0 ? C.style.opacity = "1" : C.style.opacity = "0", H + N < I - 1 ? A.style.opacity = "1" : A.style.opacity = "0", D.style.opacity = "0", S.style.opacity = "0";
3397
+ const H = _.scrollLeft, T = _.scrollWidth, N = _.clientWidth;
3398
+ H > 0 ? C.style.opacity = "1" : C.style.opacity = "0", H + N < T - 1 ? A.style.opacity = "1" : A.style.opacity = "0", D.style.opacity = "0", S.style.opacity = "0";
3218
3399
  }
3219
3400
  };
3220
- g.addEventListener("scroll", T), window.addEventListener("resize", T), setTimeout(T, 0), n.forEach((L) => {
3401
+ _.addEventListener("scroll", I), window.addEventListener("resize", I), setTimeout(I, 0), n.forEach((L) => {
3221
3402
  const H = document.createElement("button");
3222
3403
  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 = L.label, H.setAttribute("data-keep-popover-open", "true"), H.addEventListener("click", () => {
3223
- const I = L.action();
3224
- if (I) {
3225
- if (this._isRange && "start" in I && "end" in I) {
3226
- this._selectedStartDate = I.start, this._selectedEndDate = I.end;
3227
- const N = this.getFormat(), M = this._formatDate(I.start, N), F = this._formatDate(I.end, N), P = `${M} - ${F}`;
3228
- this.setValue(P), this._currentMonth = I.start.getMonth(), this._currentYear = I.start.getFullYear();
3229
- } else if (I instanceof Date) {
3230
- this._selectedStartDate = I, this._selectedEndDate = null;
3231
- const N = this.getFormat(), M = this._formatDate(I, N);
3232
- this.setValue(M), this._currentMonth = I.getMonth(), this._currentYear = I.getFullYear();
3404
+ const T = L.action();
3405
+ if (T) {
3406
+ if (this._isRange && "start" in T && "end" in T) {
3407
+ this._selectedStartDate = T.start, this._selectedEndDate = T.end;
3408
+ const N = this.getFormat(), M = this._formatDate(T.start, N), F = this._formatDate(T.end, N), P = `${M} - ${F}`;
3409
+ this.setValue(P), this._currentMonth = T.start.getMonth(), this._currentYear = T.start.getFullYear();
3410
+ } else if (T instanceof Date) {
3411
+ this._selectedStartDate = T, this._selectedEndDate = null;
3412
+ const N = this.getFormat(), M = this._formatDate(T, N);
3413
+ this.setValue(M), this._currentMonth = T.getMonth(), this._currentYear = T.getFullYear();
3233
3414
  }
3234
3415
  this._buildCalendar(), this._popover && typeof this._popover.close == "function" && this._popover.close(), this.dispatchEvent(new CustomEvent("input", {
3235
3416
  detail: { value: this.getValue() },
@@ -3241,10 +3422,10 @@ class te extends HTMLElement {
3241
3422
  cancelable: !0
3242
3423
  }));
3243
3424
  }
3244
- }), g.appendChild(H);
3245
- }), E.appendChild(g), k.appendChild(E), a.appendChild(k);
3425
+ }), _.appendChild(H);
3426
+ }), E.appendChild(_), k.appendChild(E), a.appendChild(k);
3246
3427
  }
3247
- l.appendChild(o), l.appendChild(_), l.appendChild(b), a.appendChild(l), this._calendarContainer.appendChild(a);
3428
+ l.appendChild(o), l.appendChild(b), l.appendChild(g), a.appendChild(l), this._calendarContainer.appendChild(a);
3248
3429
  }
3249
3430
  _buildMonthView() {
3250
3431
  if (!this._calendarContainer) return;
@@ -3267,13 +3448,13 @@ class te extends HTMLElement {
3267
3448
  this._currentYear++, this._buildCalendar();
3268
3449
  }), t.appendChild(r);
3269
3450
  const l = document.createElement("div");
3270
- l.className = "grid grid-cols-3 gap-2", e.forEach((o, h) => {
3271
- const c = document.createElement("button");
3272
- c.type = "button", c.tabIndex = 0, c.setAttribute("data-keep-popover-open", "true");
3273
- const m = this._currentMonth === h;
3274
- c.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 ${m ? "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"}`, c.textContent = o, c.addEventListener("click", () => {
3275
- this._currentMonth = h, this._viewMode = "calendar", this._buildCalendar();
3276
- }), l.appendChild(c);
3451
+ l.className = "grid grid-cols-3 gap-2", e.forEach((o, c) => {
3452
+ const h = document.createElement("button");
3453
+ h.type = "button", h.tabIndex = 0, h.setAttribute("data-keep-popover-open", "true");
3454
+ const d = this._currentMonth === c;
3455
+ h.className = `p-2 rounded text-sm font-medium transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500 ${d ? "bg-slate-800 dark:bg-slate-600 text-white" : "text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700"}`, h.textContent = o, h.addEventListener("click", () => {
3456
+ this._currentMonth = c, this._viewMode = "calendar", this._buildCalendar();
3457
+ }), l.appendChild(h);
3277
3458
  }), this._calendarContainer.appendChild(t), this._calendarContainer.appendChild(l);
3278
3459
  }
3279
3460
  _buildYearView() {
@@ -3296,13 +3477,13 @@ class te extends HTMLElement {
3296
3477
  }), i.appendChild(a);
3297
3478
  const o = document.createElement("div");
3298
3479
  o.className = "grid grid-cols-3 gap-2";
3299
- for (let h = e; h <= t; h++) {
3300
- const c = document.createElement("button");
3301
- c.type = "button", c.tabIndex = 0, c.setAttribute("data-keep-popover-open", "true");
3302
- const m = this._currentYear === h;
3303
- c.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 ${m ? "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"}`, c.textContent = String(h), c.addEventListener("click", () => {
3304
- this._currentYear = h, this._viewMode = "calendar", this._buildCalendar();
3305
- }), o.appendChild(c);
3480
+ for (let c = e; c <= t; c++) {
3481
+ const h = document.createElement("button");
3482
+ h.type = "button", h.tabIndex = 0, h.setAttribute("data-keep-popover-open", "true");
3483
+ const d = this._currentYear === c;
3484
+ h.className = `p-2 rounded text-sm font-medium transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500 ${d ? "bg-slate-800 dark:bg-slate-600 text-white" : "text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700"}`, h.textContent = String(c), h.addEventListener("click", () => {
3485
+ this._currentYear = c, this._viewMode = "calendar", this._buildCalendar();
3486
+ }), o.appendChild(h);
3306
3487
  }
3307
3488
  this._calendarContainer.appendChild(i), this._calendarContainer.appendChild(o);
3308
3489
  }
@@ -3541,45 +3722,45 @@ class ie extends HTMLElement {
3541
3722
  }
3542
3723
  render() {
3543
3724
  const e = this.isLoading(), t = [];
3544
- this._select && Array.from(this._select.children).forEach((d) => {
3545
- (d.tagName === "OPTION" || d.tagName === "OPTGROUP") && t.push(d.cloneNode(!0));
3725
+ this._select && Array.from(this._select.children).forEach((u) => {
3726
+ (u.tagName === "OPTION" || u.tagName === "OPTGROUP") && t.push(u.cloneNode(!0));
3546
3727
  });
3547
- const i = Array.from(this.children).filter((d) => d.tagName === "OPTION" || d.tagName === "OPTGROUP").map((d) => d.cloneNode(!0));
3728
+ const i = Array.from(this.children).filter((u) => u.tagName === "OPTION" || u.tagName === "OPTGROUP").map((u) => u.cloneNode(!0));
3548
3729
  for (; this.firstChild; )
3549
3730
  this.removeChild(this.firstChild);
3550
3731
  this._wrapper = null, this._select = null;
3551
- const s = this.getLabel(), n = this.getInfo(), r = this.getId(), a = this.getName(), l = this.getValue(), o = this.isDisabled(), h = this.isMultiple(), c = this.hasError();
3732
+ const s = this.getLabel(), n = this.getInfo(), r = this.getId(), a = this.getName(), l = this.getValue(), o = this.isDisabled(), c = this.isMultiple(), h = this.hasError();
3552
3733
  if (s) {
3553
- const d = document.createElement("label");
3554
- d.className = "block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1", r && d.setAttribute("for", r);
3555
- const f = document.createTextNode(s);
3556
- d.appendChild(f), this.appendChild(d);
3734
+ const u = document.createElement("label");
3735
+ u.className = "block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1", r && u.setAttribute("for", r);
3736
+ const m = document.createTextNode(s);
3737
+ u.appendChild(m), this.appendChild(u);
3557
3738
  }
3558
- 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), h && (this._select.multiple = !0), this._select.setAttribute("aria-invalid", c ? "true" : "false");
3559
- const m = t.length > 0 ? t : i;
3560
- if (m.length > 0 && m.forEach((d) => {
3561
- this._select.appendChild(d);
3739
+ 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", h ? "true" : "false");
3740
+ const d = t.length > 0 ? t : i;
3741
+ if (d.length > 0 && d.forEach((u) => {
3742
+ this._select.appendChild(u);
3562
3743
  }), this._select.options.length === 0) {
3563
- const d = document.createElement("option");
3564
- d.value = "", d.textContent = "Select an option", d.disabled = !0, d.selected = !0, this._select.appendChild(d);
3744
+ const u = document.createElement("option");
3745
+ u.value = "", u.textContent = "Select an option", u.disabled = !0, u.selected = !0, this._select.appendChild(u);
3565
3746
  }
3566
- if (this._select.value = l || "", this._changeHandler && this._select && this._select.removeEventListener("change", this._changeHandler), this._changeHandler = (d) => {
3567
- const u = d.target.value;
3568
- u ? this.setAttribute("value", u) : this.removeAttribute("value"), this.dispatchEvent(new CustomEvent("change", {
3569
- detail: { value: u },
3747
+ if (this._select.value = l || "", this._changeHandler && this._select && this._select.removeEventListener("change", this._changeHandler), this._changeHandler = (u) => {
3748
+ const p = u.target.value;
3749
+ p ? this.setAttribute("value", p) : this.removeAttribute("value"), this.dispatchEvent(new CustomEvent("change", {
3750
+ detail: { value: p },
3570
3751
  bubbles: !0,
3571
3752
  cancelable: !0,
3572
3753
  composed: !0
3573
3754
  }));
3574
- }, this._select.addEventListener("change", this._changeHandler), this._wrapper.appendChild(this._select), h)
3755
+ }, this._select.addEventListener("change", this._changeHandler), this._wrapper.appendChild(this._select), c)
3575
3756
  this._caretUpIcon = null, this._caretDownIcon = null;
3576
3757
  else {
3577
- const d = document.createElement("div");
3578
- d.className = "absolute right-2 top-1/2 -translate-y-1/2 pointer-events-none z-10 flex flex-col", this._caretUpIcon = document.createElement("mint-icon"), this._caretUpIcon.setAttribute("name", "caret-up"), this._caretUpIcon.className = "w-[.9em] h-[.9em] text-gray-400 dark:text-gray-500 mb-[-.2rem]", d.appendChild(this._caretUpIcon), this._caretDownIcon = document.createElement("mint-icon"), this._caretDownIcon.setAttribute("name", "caret-down"), this._caretDownIcon.className = "w-[.9em] h-[.9em] text-gray-400 dark:text-gray-500 mt-[-.2rem]", d.appendChild(this._caretDownIcon), this._wrapper.appendChild(d);
3758
+ const u = document.createElement("div");
3759
+ u.className = "absolute right-2 top-1/2 -translate-y-1/2 pointer-events-none z-10 flex flex-col", this._caretUpIcon = document.createElement("mint-icon"), this._caretUpIcon.setAttribute("name", "caret-up"), this._caretUpIcon.className = "w-[.9em] h-[.9em] text-gray-400 dark:text-gray-500 mb-[-.2rem]", u.appendChild(this._caretUpIcon), this._caretDownIcon = document.createElement("mint-icon"), this._caretDownIcon.setAttribute("name", "caret-down"), this._caretDownIcon.className = "w-[.9em] h-[.9em] text-gray-400 dark:text-gray-500 mt-[-.2rem]", u.appendChild(this._caretDownIcon), this._wrapper.appendChild(u);
3579
3760
  }
3580
3761
  if (n) {
3581
- const d = document.createElement("div");
3582
- d.className = "mt-1 text-xs text-gray-500 dark:text-gray-400", d.textContent = n, this.appendChild(d);
3762
+ const u = document.createElement("div");
3763
+ u.className = "mt-1 text-xs text-gray-500 dark:text-gray-400", u.textContent = n, this.appendChild(u);
3583
3764
  }
3584
3765
  this._renderErrorState(), this._renderSkeleton(e);
3585
3766
  }
@@ -3704,18 +3885,18 @@ class se extends HTMLElement {
3704
3885
  return this.hasAttribute("loading");
3705
3886
  }
3706
3887
  render() {
3707
- const e = this.isLoading(), t = this.getLabel(), i = this.getAccept(), s = this.isMultiple(), n = this.isDisabled(), r = this.getWidth(), a = this.getHeight(), l = this.getName(), o = this.hasError(), h = this.getErrorMessage();
3888
+ const e = this.isLoading(), t = 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();
3708
3889
  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", t || "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");
3709
- const c = this._dropzone.querySelector(".mint-dropzone-icon"), m = this._dropzone.querySelector(".mint-dropzone-label");
3710
- c && c.remove(), m && m.remove();
3711
- const d = document.createElement("div");
3712
- d.className = "mint-dropzone-icon flex items-center justify-center mt-2 mb-2 flex-shrink-0";
3713
- const f = document.createElement("mint-icon");
3714
- if (f.setAttribute("name", "upload"), f.className = "w-12 h-12 text-gray-400 dark:text-gray-500", d.appendChild(f), this._dropzone.appendChild(d), t) {
3715
- const u = document.createElement("div");
3716
- u.className = "mint-dropzone-label text-sm font-medium text-gray-600 dark:text-gray-400 text-center px-4 flex-shrink-0", u.textContent = t, this._dropzone.appendChild(u);
3890
+ const h = this._dropzone.querySelector(".mint-dropzone-icon"), d = this._dropzone.querySelector(".mint-dropzone-label");
3891
+ h && h.remove(), d && d.remove();
3892
+ const u = document.createElement("div");
3893
+ u.className = "mint-dropzone-icon flex items-center justify-center mt-2 mb-2 flex-shrink-0";
3894
+ const m = document.createElement("mint-icon");
3895
+ if (m.setAttribute("name", "upload"), m.className = "w-12 h-12 text-gray-400 dark:text-gray-500", u.appendChild(m), this._dropzone.appendChild(u), t) {
3896
+ const p = document.createElement("div");
3897
+ 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 = t, this._dropzone.appendChild(p);
3717
3898
  }
3718
- this.setupEventListeners(), this._renderErrorState(o, h), this._renderPreviews(), this._renderSkeleton(e);
3899
+ this.setupEventListeners(), this._renderErrorState(o, c), this._renderPreviews(), this._renderSkeleton(e);
3719
3900
  }
3720
3901
  _updateDragState() {
3721
3902
  this._dropzone && this._updateDragStateClass();
@@ -3868,25 +4049,25 @@ class se extends HTMLElement {
3868
4049
  const e = document.createElement("div");
3869
4050
  e.className = "mint-dropzone-previews-wrapper mt-3 w-full relative max-h-48";
3870
4051
  const t = document.createElement("div");
3871
- t.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, h) => {
3872
- const c = document.createElement("div");
3873
- if (c.className = "flex items-center gap-3 p-2 rounded border border-gray-200 dark:border-gray-600 bg-gray-50 dark:bg-gray-800", o.type.startsWith("image/")) {
3874
- const u = document.createElement("img");
3875
- u.className = "w-12 h-12 object-cover rounded border border-gray-200 dark:border-gray-700";
3876
- const p = URL.createObjectURL(o);
3877
- this._previewUrls.push(p), u.src = p, c.appendChild(u);
4052
+ t.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) => {
4053
+ const h = document.createElement("div");
4054
+ if (h.className = "flex items-center gap-3 p-2 rounded border border-gray-200 dark:border-gray-600 bg-gray-50 dark:bg-gray-800", o.type.startsWith("image/")) {
4055
+ const p = document.createElement("img");
4056
+ p.className = "w-12 h-12 object-cover rounded border border-gray-200 dark:border-gray-700";
4057
+ const f = URL.createObjectURL(o);
4058
+ this._previewUrls.push(f), p.src = f, h.appendChild(p);
3878
4059
  } else {
3879
- const u = document.createElement("mint-icon");
3880
- u.setAttribute("name", "attach"), u.className = "w-5 h-5 text-gray-500 dark:text-gray-300", c.appendChild(u);
4060
+ const p = document.createElement("mint-icon");
4061
+ p.setAttribute("name", "attach"), p.className = "w-5 h-5 text-gray-500 dark:text-gray-300", h.appendChild(p);
3881
4062
  }
3882
- const m = document.createElement("div");
3883
- m.className = "flex-1 text-sm text-gray-800 dark:text-gray-100 truncate", m.textContent = o.name, c.appendChild(m);
3884
- const d = document.createElement("button");
3885
- d.type = "button", d.className = "text-gray-500 hover:bg-red-100 dark:hover:bg-red-900/30 transition-colors flex items-center justify-center w-6 h-6 rounded-full";
3886
- const f = document.createElement("mint-icon");
3887
- f.setAttribute("name", "close"), f.className = "w-4 h-4", d.appendChild(f), d.addEventListener("click", (u) => {
3888
- u.preventDefault(), u.stopPropagation(), this._removeFileAt(h);
3889
- }), c.appendChild(d), t.appendChild(c);
4063
+ const d = document.createElement("div");
4064
+ d.className = "flex-1 text-sm text-gray-800 dark:text-gray-100 truncate", d.textContent = o.name, h.appendChild(d);
4065
+ const u = document.createElement("button");
4066
+ u.type = "button", u.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";
4067
+ const m = document.createElement("mint-icon");
4068
+ m.setAttribute("name", "close"), m.className = "w-4 h-4", u.appendChild(m), u.addEventListener("click", (p) => {
4069
+ p.preventDefault(), p.stopPropagation(), this._removeFileAt(c);
4070
+ }), h.appendChild(u), t.appendChild(h);
3890
4071
  });
3891
4072
  const i = this.hasError(), s = this._isDragging;
3892
4073
  let n = "from-white dark:from-gray-700";
@@ -3896,8 +4077,8 @@ class se extends HTMLElement {
3896
4077
  const a = document.createElement("div");
3897
4078
  a.className = `absolute bottom-0 left-0 right-0 h-4 pointer-events-none z-10 bg-gradient-to-t ${n} to-transparent opacity-100 transition-opacity duration-200`, e.appendChild(a);
3898
4079
  const l = () => {
3899
- const o = t.scrollTop, h = t.scrollHeight, c = t.clientHeight;
3900
- o > 0 ? r.style.opacity = "1" : r.style.opacity = "0", o + c < h - 1 ? a.style.opacity = "1" : a.style.opacity = "0";
4080
+ const o = t.scrollTop, c = t.scrollHeight, h = t.clientHeight;
4081
+ o > 0 ? r.style.opacity = "1" : r.style.opacity = "0", o + h < c - 1 ? a.style.opacity = "1" : a.style.opacity = "0";
3901
4082
  };
3902
4083
  l(), t.addEventListener("scroll", l), e.appendChild(t), this._previewContainer = e, this._dropzone.appendChild(e), this._updateDragStateClass();
3903
4084
  }
@@ -4074,99 +4255,99 @@ class re extends HTMLElement {
4074
4255
  }
4075
4256
  }
4076
4257
  async _submitData(e, t) {
4077
- var c, m, d;
4258
+ var h, d, u;
4078
4259
  const i = this.getAttribute("action"), s = this.getAttribute("method"), n = this.getAttribute("enctype") || "application/x-www-form-urlencoded";
4079
4260
  if (!i)
4080
4261
  return { status: 0, ok: !0, data: { values: t } };
4081
- const r = Array.from(e.values()).some((f) => f instanceof File);
4262
+ const r = Array.from(e.values()).some((m) => m instanceof File);
4082
4263
  let a = null;
4083
4264
  const l = {};
4084
4265
  let o = i;
4085
- if (typeof window < "u" && ((d = (m = (c = window.mintForm) == null ? void 0 : c.defaults) == null ? void 0 : m.headers) != null && d.common) && Object.assign(l, window.mintForm.defaults.headers.common), this._headers && Object.assign(l, this._headers), s === "GET") {
4086
- const f = new URLSearchParams();
4087
- e.forEach((u, p) => {
4088
- u instanceof File || f.append(p, String(u));
4089
- }), o += (i.includes("?") ? "&" : "?") + f.toString();
4266
+ if (typeof window < "u" && ((u = (d = (h = window.mintForm) == null ? void 0 : h.defaults) == null ? void 0 : d.headers) != null && u.common) && Object.assign(l, window.mintForm.defaults.headers.common), this._headers && Object.assign(l, this._headers), s === "GET") {
4267
+ const m = new URLSearchParams();
4268
+ e.forEach((p, f) => {
4269
+ p instanceof File || m.append(f, String(p));
4270
+ }), o += (i.includes("?") ? "&" : "?") + m.toString();
4090
4271
  } else if (n === "multipart/form-data" || r)
4091
4272
  a = e;
4092
4273
  else if (n === "application/json")
4093
4274
  a = JSON.stringify(t), l["Content-Type"] = "application/json";
4094
4275
  else {
4095
- const f = new URLSearchParams();
4096
- e.forEach((u, p) => {
4097
- u instanceof File || f.append(p, String(u));
4098
- }), a = f, l["Content-Type"] = "application/x-www-form-urlencoded";
4276
+ const m = new URLSearchParams();
4277
+ e.forEach((p, f) => {
4278
+ p instanceof File || m.append(f, String(p));
4279
+ }), a = m, l["Content-Type"] = "application/x-www-form-urlencoded";
4099
4280
  }
4100
4281
  if (typeof fetch == "function")
4101
4282
  try {
4102
- const f = await fetch(o, {
4283
+ const m = await fetch(o, {
4103
4284
  method: s || "POST",
4104
4285
  body: s === "GET" ? null : a,
4105
4286
  headers: l
4106
- }), u = await f.text().catch(() => "");
4107
- let p = u;
4287
+ }), p = await m.text().catch(() => "");
4288
+ let f = p;
4108
4289
  try {
4109
- p = JSON.parse(u);
4290
+ f = JSON.parse(p);
4110
4291
  } catch {
4111
4292
  }
4112
- if (!f.ok) {
4113
- const b = { status: f.status, data: p, response: { status: f.status, data: p } };
4114
- throw await this._applyErrorInterceptors(b);
4293
+ if (!m.ok) {
4294
+ const g = { status: m.status, data: f, response: { status: m.status, data: f } };
4295
+ throw await this._applyErrorInterceptors(g);
4115
4296
  }
4116
- const _ = { status: f.status, ok: f.ok, data: p };
4117
- return await this._applySuccessInterceptors(_);
4118
- } catch (f) {
4119
- if (f.response)
4120
- throw f;
4121
- const u = {
4122
- status: f.status || 0,
4123
- data: f.data || f.message || "Network error",
4124
- response: { status: f.status || 0, data: f.data || f.message || "Network error" }
4297
+ const b = { status: m.status, ok: m.ok, data: f };
4298
+ return await this._applySuccessInterceptors(b);
4299
+ } catch (m) {
4300
+ if (m.response)
4301
+ throw m;
4302
+ const p = {
4303
+ status: m.status || 0,
4304
+ data: m.data || m.message || "Network error",
4305
+ response: { status: m.status || 0, data: m.data || m.message || "Network error" }
4125
4306
  };
4126
- throw await this._applyErrorInterceptors(u);
4307
+ throw await this._applyErrorInterceptors(p);
4127
4308
  }
4128
- const h = this;
4129
- return await new Promise(async (f, u) => {
4130
- const p = new XMLHttpRequest();
4131
- p.open(s || "POST", o, !0), Object.entries(l).forEach(([_, b]) => p.setRequestHeader(_, b)), p.onload = async function() {
4132
- const { status: _, responseText: b } = p;
4133
- if (_ >= 200 && _ < 300) {
4134
- let y = b;
4309
+ const c = this;
4310
+ return await new Promise(async (m, p) => {
4311
+ const f = new XMLHttpRequest();
4312
+ f.open(s || "POST", o, !0), Object.entries(l).forEach(([b, g]) => f.setRequestHeader(b, g)), f.onload = async function() {
4313
+ const { status: b, responseText: g } = f;
4314
+ if (b >= 200 && b < 300) {
4315
+ let y = g;
4135
4316
  try {
4136
- y = JSON.parse(b);
4317
+ y = JSON.parse(g);
4137
4318
  } catch {
4138
4319
  }
4139
4320
  try {
4140
- const x = { status: _, ok: !0, data: y }, k = await h._applySuccessInterceptors(x);
4141
- f(k);
4321
+ const x = { status: b, ok: !0, data: y }, k = await c._applySuccessInterceptors(x);
4322
+ m(k);
4142
4323
  } catch (x) {
4143
- u(x);
4324
+ p(x);
4144
4325
  }
4145
4326
  } else {
4146
- let y = b;
4327
+ let y = g;
4147
4328
  try {
4148
- y = JSON.parse(b);
4329
+ y = JSON.parse(g);
4149
4330
  } catch {
4150
4331
  }
4151
4332
  try {
4152
- const x = { status: _, data: y, response: { status: _, data: y } }, k = await h._applyErrorInterceptors(x);
4153
- u(k);
4333
+ const x = { status: b, data: y, response: { status: b, data: y } }, k = await c._applyErrorInterceptors(x);
4334
+ p(k);
4154
4335
  } catch (x) {
4155
- u(x);
4336
+ p(x);
4156
4337
  }
4157
4338
  }
4158
- }, p.onerror = async function() {
4339
+ }, f.onerror = async function() {
4159
4340
  try {
4160
- const _ = {
4161
- status: p.status || 0,
4162
- data: p.responseText || "Network error",
4163
- response: { status: p.status || 0, data: p.responseText || "Network error" }
4164
- }, b = await h._applyErrorInterceptors(_);
4165
- u(b);
4166
- } catch (_) {
4167
- u(_);
4341
+ const b = {
4342
+ status: f.status || 0,
4343
+ data: f.responseText || "Network error",
4344
+ response: { status: f.status || 0, data: f.responseText || "Network error" }
4345
+ }, g = await c._applyErrorInterceptors(b);
4346
+ p(g);
4347
+ } catch (b) {
4348
+ p(b);
4168
4349
  }
4169
- }, p.send(s === "GET" ? null : a);
4350
+ }, f.send(s === "GET" ? null : a);
4170
4351
  });
4171
4352
  }
4172
4353
  async _applySuccessInterceptors(e) {
@@ -4207,10 +4388,10 @@ class re extends HTMLElement {
4207
4388
  const l = r.files;
4208
4389
  if (l.length > 0) {
4209
4390
  const o = Array.from(l);
4210
- t[a] && Array.isArray(t[a]) ? o.forEach((h) => {
4391
+ t[a] && Array.isArray(t[a]) ? o.forEach((c) => {
4211
4392
  t[a].some(
4212
- (m) => m.name === h.name && m.size === h.size && m.lastModified === h.lastModified
4213
- ) || t[a].push(h);
4393
+ (d) => d.name === c.name && d.size === c.size && d.lastModified === c.lastModified
4394
+ ) || t[a].push(c);
4214
4395
  }) : t[a] = o;
4215
4396
  }
4216
4397
  }
@@ -4220,7 +4401,7 @@ class re extends HTMLElement {
4220
4401
  const l = Array.from(r.files);
4221
4402
  t[a] && Array.isArray(t[a]) ? l.forEach((o) => {
4222
4403
  t[a].some(
4223
- (c) => c.name === o.name && c.size === o.size && c.lastModified === o.lastModified
4404
+ (h) => h.name === o.name && h.size === o.size && h.lastModified === o.lastModified
4224
4405
  ) || t[a].push(o);
4225
4406
  }) : t[a] = l;
4226
4407
  }
@@ -4229,7 +4410,7 @@ class re extends HTMLElement {
4229
4410
  if (a) {
4230
4411
  let l = [];
4231
4412
  if (typeof r.tags < "u" ? l = r.tags : typeof r.getTags == "function" && (l = r.getTags()), Array.isArray(l) && l.length > 0) {
4232
- const o = l.map((h) => typeof h == "string" ? h : (h == null ? void 0 : h.value) || (h == null ? void 0 : h.label) || "").filter((h) => h.trim() !== "");
4413
+ const o = l.map((c) => typeof c == "string" ? c : (c == null ? void 0 : c.value) || (c == null ? void 0 : c.label) || "").filter((c) => c.trim() !== "");
4233
4414
  t[a] = o;
4234
4415
  } else
4235
4416
  t[a] = [];
@@ -4556,8 +4737,8 @@ class re extends HTMLElement {
4556
4737
  if (!n) return;
4557
4738
  const r = this._getFieldName(n);
4558
4739
  if (!r || !this._collectValidationRules()[r]) return;
4559
- const l = this._extractFieldValue([n]), o = l != null && (typeof l == "string" ? l.trim() !== "" : l instanceof FileList || Array.isArray(l) ? l.length > 0 : !0), h = n.hasAttribute("data-mint-form-error") || s instanceof HTMLElement && (s.hasAttribute("aria-invalid") || s.closest("[data-mint-form-error]")), c = !!n.closest("mint-tags"), m = n.tagName === "MINT-CHECKBOX" || n.tagName === "MINT-SWITCH" || n.tagName === "MINT-CHOICE" || s instanceof HTMLElement && (s.closest("mint-checkbox, mint-switch, mint-choice") || s.closest("mint-choice-option")), d = n.tagName === "MINT-DATE-PICKER" || s instanceof HTMLElement && s.closest("mint-date-picker");
4560
- (o || h || c || m || d) && setTimeout(() => {
4740
+ 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]")), h = !!n.closest("mint-tags"), d = 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")), u = n.tagName === "MINT-DATE-PICKER" || s instanceof HTMLElement && s.closest("mint-date-picker");
4741
+ (o || c || h || d || u) && setTimeout(() => {
4561
4742
  this._validateField(r);
4562
4743
  }, 0);
4563
4744
  };
@@ -4566,38 +4747,38 @@ class re extends HTMLElement {
4566
4747
  const s = i.target;
4567
4748
  if (!s) return;
4568
4749
  if (i.type === "tags-change" && s.tagName === "MINT-TAGS") {
4569
- const h = s, c = this._getFieldName(h);
4570
- if (!c || !this._collectValidationRules()[c]) return;
4750
+ const c = s, h = this._getFieldName(c);
4751
+ if (!h || !this._collectValidationRules()[h]) return;
4571
4752
  setTimeout(() => {
4572
- this._validateField(c);
4753
+ this._validateField(h);
4573
4754
  }, 0);
4574
4755
  return;
4575
4756
  }
4576
4757
  if (s instanceof HTMLSelectElement || s.tagName === "MINT-SELECT" || s.closest("mint-select")) {
4577
- const h = this._findFieldElement(s);
4578
- if (!h) return;
4579
- const c = this._getFieldName(h);
4580
- if (!c || !this._collectValidationRules()[c]) return;
4758
+ const c = this._findFieldElement(s);
4759
+ if (!c) return;
4760
+ const h = this._getFieldName(c);
4761
+ if (!h || !this._collectValidationRules()[h]) return;
4581
4762
  setTimeout(() => {
4582
- this._validateField(c);
4763
+ this._validateField(h);
4583
4764
  }, 0);
4584
4765
  return;
4585
4766
  }
4586
4767
  if (i.type === "choice-change" && s.tagName === "MINT-CHOICE") {
4587
- const h = s, c = this._getFieldName(h);
4588
- if (!c || !this._collectValidationRules()[c]) return;
4768
+ const c = s, h = this._getFieldName(c);
4769
+ if (!h || !this._collectValidationRules()[h]) return;
4589
4770
  setTimeout(() => {
4590
- this._validateField(c);
4771
+ this._validateField(h);
4591
4772
  }, 0);
4592
4773
  return;
4593
4774
  }
4594
4775
  if (s instanceof HTMLInputElement && s.type === "checkbox" || s.tagName === "MINT-CHECKBOX" || s.tagName === "MINT-SWITCH" || s.closest("mint-checkbox, mint-switch")) {
4595
- const h = this._findFieldElement(s);
4596
- if (!h) return;
4597
- const c = this._getFieldName(h);
4598
- if (!c || !this._collectValidationRules()[c]) return;
4776
+ const c = this._findFieldElement(s);
4777
+ if (!c) return;
4778
+ const h = this._getFieldName(c);
4779
+ if (!h || !this._collectValidationRules()[h]) return;
4599
4780
  setTimeout(() => {
4600
- this._validateField(c);
4781
+ this._validateField(h);
4601
4782
  }, 0);
4602
4783
  return;
4603
4784
  }
@@ -4787,11 +4968,7 @@ class ne extends HTMLElement {
4787
4968
  "align-baseline",
4788
4969
  "block",
4789
4970
  "w-full",
4790
- "overflow-x-auto",
4791
- "border",
4792
- "border-gray-200",
4793
- "rounded-lg",
4794
- "dark:border-gray-700"
4971
+ "overflow-x-auto"
4795
4972
  ), this.hasAttribute("collapse") && !this.hasAttribute("scroll") && this._ensureResponsiveStyles(), this._observeChanges(), this._applyStyles(), requestAnimationFrame(() => {
4796
4973
  this._applyStyles(), setTimeout(() => this._applyStyles(), 0);
4797
4974
  });
@@ -4819,52 +4996,56 @@ class ne extends HTMLElement {
4819
4996
  const t = this.hasAttribute("collapse") && !this.hasAttribute("scroll"), i = this.hasAttribute("scroll");
4820
4997
  i ? this.classList.add("relative") : this.classList.remove("relative");
4821
4998
  const s = [], n = e.querySelector("thead tr");
4822
- n && n.querySelectorAll("th").forEach((h) => s.push((h.textContent || "").trim())), this._setClasses(e, [
4999
+ n && n.querySelectorAll("th").forEach((c) => s.push((c.textContent || "").trim())), this._setClasses(e, [
4823
5000
  "w-full",
4824
5001
  i ? "min-w-[1200px]" : "",
4825
5002
  "border-collapse",
4826
5003
  "text-sm",
4827
5004
  "font-medium",
4828
- "rounded-lg",
4829
- "border-2",
4830
- "border-gray-200",
4831
- "dark:border-gray-700",
4832
5005
  "overflow-hidden"
4833
5006
  ]);
4834
5007
  const r = e.querySelector("thead");
4835
- r && (this._setClasses(r, [
4836
- "bg-[#F7F7F7]",
4837
- "dark:bg-gray-800"
4838
- ]), r.querySelectorAll("th").forEach((h) => {
4839
- this._setClasses(h, [
4840
- "text-left",
4841
- "font-semibold",
4842
- "text-gray-900",
4843
- "dark:text-white",
4844
- "px-3",
4845
- "py-2",
4846
- "border-b",
4847
- "border-gray-200",
4848
- "dark:border-gray-700"
5008
+ if (r) {
5009
+ this._setClasses(r, [
5010
+ "bg-[#F7F7F7]",
5011
+ "dark:bg-gray-800"
4849
5012
  ]);
4850
- }));
5013
+ const o = r.querySelectorAll("th");
5014
+ o.forEach((c, h) => {
5015
+ const d = c.querySelector("mint-icon"), u = (d == null ? void 0 : d.getAttribute("name")) || "", m = d !== null && u !== "ellipsis";
5016
+ this._setClasses(c, [
5017
+ "text-left",
5018
+ "font-semibold",
5019
+ "text-gray-900",
5020
+ "dark:text-white",
5021
+ "px-3",
5022
+ "py-2",
5023
+ "border-b",
5024
+ "border-gray-200",
5025
+ "dark:border-gray-700"
5026
+ ]), m && c.classList.add("cursor-pointer", "hover:bg-gray-100", "dark:hover:bg-gray-700", "transition-colors"), h === 0 && c.classList.add("pl-6"), h === o.length - 1 && c.classList.add("pr-6");
5027
+ });
5028
+ }
4851
5029
  const a = e.querySelector("tbody");
4852
5030
  if (a) {
4853
5031
  const o = Array.from(a.querySelectorAll("tr"));
4854
- o.forEach((h, c) => {
4855
- this._setClasses(h, [
5032
+ o.forEach((c, h) => {
5033
+ const d = c.hasAttribute("data-row-clickable");
5034
+ this._setClasses(c, [
4856
5035
  "bg-white",
4857
5036
  "dark:bg-gray-900",
4858
5037
  "border-b",
4859
5038
  "border-gray-200",
4860
5039
  "dark:border-gray-700"
4861
- ]), c === o.length - 1 && h.classList.remove("border-b"), h.querySelectorAll("td").forEach((d) => {
4862
- this._setClasses(d, [
5040
+ ]), d && c.classList.add("cursor-pointer", "hover:bg-gray-50", "dark:hover:bg-gray-800", "transition-colors"), h === o.length - 1 && c.classList.remove("border-b");
5041
+ const u = c.querySelectorAll("td");
5042
+ u.forEach((m, p) => {
5043
+ this._setClasses(m, [
4863
5044
  "text-gray-900",
4864
5045
  "dark:text-gray-100",
4865
5046
  "px-3",
4866
5047
  "py-2"
4867
- ]), t ? this._applyMobileCell(d, s) : this._restoreCell(d);
5048
+ ]), p === 0 && m.classList.add("pl-6"), p === u.length - 1 && m.classList.add("pr-6"), t ? this._applyMobileCell(m, s) : this._restoreCell(m);
4868
5049
  });
4869
5050
  });
4870
5051
  }
@@ -4873,8 +5054,8 @@ class ne extends HTMLElement {
4873
5054
  "bg-[#F7F7F7]",
4874
5055
  "dark:bg-gray-800",
4875
5056
  "font-semibold"
4876
- ]), l.querySelectorAll("td").forEach((h) => {
4877
- this._setClasses(h, [
5057
+ ]), l.querySelectorAll("td").forEach((c) => {
5058
+ this._setClasses(c, [
4878
5059
  "text-gray-900",
4879
5060
  "dark:text-gray-100",
4880
5061
  "px-3",
@@ -4882,22 +5063,34 @@ class ne extends HTMLElement {
4882
5063
  "border-t",
4883
5064
  "border-gray-200",
4884
5065
  "dark:border-gray-700"
4885
- ]), this._restoreCell(h);
5066
+ ]), this._restoreCell(c);
4886
5067
  })), this._observer && this._observeChanges();
4887
5068
  }
4888
5069
  _applyMobileCell(e, t) {
4889
5070
  if (e.closest("tfoot") || e.dataset.mtProcessed === "true") return;
4890
- const i = t[e.cellIndex] || "", s = e.getAttribute("data-original"), n = s !== null ? s : e.innerHTML;
4891
- e.setAttribute("data-original", n), e.dataset.mtProcessed = "true", e.innerHTML = "";
4892
- const r = document.createElement("span");
4893
- r.className = "mt-label font-semibold text-gray-700 dark:text-gray-200 hidden", r.textContent = i;
5071
+ const i = t[e.cellIndex] || "", s = {};
5072
+ Array.from(e.attributes).forEach((o) => {
5073
+ o.name.startsWith("data-") && o.name !== "data-original" && o.name !== "data-mt-processed" && (s[o.name] = o.value);
5074
+ });
5075
+ const n = e.getAttribute("data-original"), r = n !== null ? n : e.innerHTML;
5076
+ e.setAttribute("data-original", r), e.dataset.mtProcessed = "true", e.innerHTML = "";
4894
5077
  const a = document.createElement("span");
4895
- a.className = "mt-value text-gray-900 dark:text-gray-100 text-right md:text-left w-full", a.innerHTML = n, e.appendChild(r), e.appendChild(a);
5078
+ a.className = "mt-label font-semibold text-gray-700 dark:text-gray-200 hidden", a.textContent = i;
5079
+ const l = document.createElement("span");
5080
+ l.className = "mt-value text-gray-900 dark:text-gray-100 text-right md:text-left w-full", l.innerHTML = r, e.appendChild(a), e.appendChild(l), Object.entries(s).forEach(([o, c]) => {
5081
+ e.setAttribute(o, c);
5082
+ });
4896
5083
  }
4897
5084
  _restoreCell(e) {
4898
5085
  if (e.dataset.mtProcessed !== "true") return;
4899
- const t = e.getAttribute("data-original") || "";
4900
- e.dataset.mtProcessed = "", e.innerHTML = t;
5086
+ const t = {};
5087
+ Array.from(e.attributes).forEach((s) => {
5088
+ s.name.startsWith("data-") && s.name !== "data-original" && s.name !== "data-mt-processed" && (t[s.name] = s.value);
5089
+ });
5090
+ const i = e.getAttribute("data-original") || "";
5091
+ e.dataset.mtProcessed = "", e.innerHTML = i, Object.entries(t).forEach(([s, n]) => {
5092
+ e.setAttribute(s, n);
5093
+ });
4901
5094
  }
4902
5095
  _setClasses(e, t) {
4903
5096
  e.className = "", t.filter(Boolean).forEach((i) => e.classList.add(...i.split(" ")));
@@ -5165,10 +5358,10 @@ class oe extends HTMLElement {
5165
5358
  "transition-colors",
5166
5359
  "duration-200"
5167
5360
  ];
5168
- this._container.className = o.join(" "), this._chipsWrap = document.createElement("div"), this._chipsWrap.className = "flex flex-wrap items-center gap-2", this._chipsWrap.addEventListener("dragover", (h) => {
5169
- this.hasAttribute("sortable") && h.preventDefault();
5170
- }), this._chipsWrap.addEventListener("drop", (h) => {
5171
- this.hasAttribute("sortable") && h.preventDefault();
5361
+ this._container.className = o.join(" "), this._chipsWrap = document.createElement("div"), this._chipsWrap.className = "flex flex-wrap items-center gap-2", this._chipsWrap.addEventListener("dragover", (c) => {
5362
+ this.hasAttribute("sortable") && c.preventDefault();
5363
+ }), this._chipsWrap.addEventListener("drop", (c) => {
5364
+ this.hasAttribute("sortable") && c.preventDefault();
5172
5365
  }), this._input = document.createElement("input"), this._input.type = "text", this._input.placeholder = this._placeholder, this._input.className = [
5173
5366
  "min-w-[6rem]",
5174
5367
  "flex-1",
@@ -5181,8 +5374,8 @@ class oe extends HTMLElement {
5181
5374
  "placeholder:text-gray-400",
5182
5375
  "dark:placeholder:text-gray-500",
5183
5376
  "p-1.5"
5184
- ].join(" "), this._input.addEventListener("keydown", (h) => {
5185
- h.key === "Enter" && (h.preventDefault(), this._addFromInput());
5377
+ ].join(" "), this._input.addEventListener("keydown", (c) => {
5378
+ c.key === "Enter" && (c.preventDefault(), this._addFromInput());
5186
5379
  }), this._container.appendChild(this._chipsWrap), this.appendChild(this._container);
5187
5380
  }
5188
5381
  if (this._container) {