monobill-mintui 0.3.30 → 0.3.32

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
@@ -1,5 +1,5 @@
1
- import { g as G } from "./caret-right-DsNN5Epe.js";
2
- class K extends HTMLElement {
1
+ import { g as X } from "./caret-right-DsNN5Epe.js";
2
+ class Z extends HTMLElement {
3
3
  constructor() {
4
4
  super(), this._darkModeObserver = null;
5
5
  }
@@ -86,8 +86,8 @@ class K extends HTMLElement {
86
86
  this.innerHTML = l.trim();
87
87
  }
88
88
  }
89
- customElements.get("mint-spinner") || customElements.define("mint-spinner", K);
90
- class X extends HTMLElement {
89
+ customElements.get("mint-spinner") || customElements.define("mint-spinner", Z);
90
+ class Q extends HTMLElement {
91
91
  constructor() {
92
92
  super(), this._darkModeObserver = null;
93
93
  }
@@ -139,7 +139,7 @@ class X extends HTMLElement {
139
139
  this.innerHTML = "", this.style.maskImage = "", this.style.webkitMaskImage = "", this.style.backgroundColor = "";
140
140
  return;
141
141
  }
142
- const e = G(t);
142
+ const e = X(t);
143
143
  if (!e) {
144
144
  console.warn(`Icon "${t}" not found. Make sure you've imported the icon: import '@monobill-mintui/icon/icons/${t}'`), this.innerHTML = "", this.style.maskImage = "", this.style.webkitMaskImage = "", this.style.backgroundColor = "";
145
145
  return;
@@ -166,8 +166,8 @@ class X extends HTMLElement {
166
166
  }
167
167
  }
168
168
  }
169
- customElements.get("mint-icon") || customElements.define("mint-icon", X);
170
- const W = class W extends HTMLElement {
169
+ customElements.get("mint-icon") || customElements.define("mint-icon", Q);
170
+ const V = class V extends HTMLElement {
171
171
  constructor() {
172
172
  super(), this._button = null, this._clickHandler = null, this._isHandlingClick = !1, this._handleMouseDown = () => {
173
173
  this._button && !this.isDisabled() && !this.isLoading() && this._button.classList.add("mint-button-active");
@@ -187,7 +187,7 @@ const W = class W extends HTMLElement {
187
187
  return ["variant", "tone", "disabled", "loading", "button-type", "type", "full-width", "icon-position", "icon", "active"];
188
188
  }
189
189
  connectedCallback() {
190
- if (!W._activeShadowStyleInjected) {
190
+ if (!V._activeShadowStyleInjected) {
191
191
  const t = document.createElement("style");
192
192
  t.textContent = `
193
193
  mint-button .mint-button-active {
@@ -200,7 +200,7 @@ const W = class W extends HTMLElement {
200
200
  mint-button[data-variant="link"] .mint-button-active {
201
201
  box-shadow: none !important;
202
202
  }
203
- `, document.head.appendChild(t), W._activeShadowStyleInjected = !0;
203
+ `, document.head.appendChild(t), V._activeShadowStyleInjected = !0;
204
204
  }
205
205
  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");
206
206
  }
@@ -772,12 +772,12 @@ const W = class W extends HTMLElement {
772
772
  _.push(g);
773
773
  continue;
774
774
  }
775
- const b = g;
776
- b.tagName !== "MINT-SPINNER" && !b.querySelector("mint-spinner") && g !== r && !b.hasAttribute("slot") && !(b.className === "mr-2" && b.querySelector("mint-spinner")) && _.push(g);
775
+ const v = g;
776
+ v.tagName !== "MINT-SPINNER" && !v.querySelector("mint-spinner") && g !== r && !v.hasAttribute("slot") && !(v.className === "mr-2" && v.querySelector("mint-spinner")) && _.push(g);
777
777
  }
778
778
  if (_.length > 0) {
779
- o = document.createElement("span"), o.className = "mint-button-content inline-flex items-center", _.forEach((b) => {
780
- o.appendChild(b);
779
+ o = document.createElement("span"), o.className = "mint-button-content inline-flex items-center", _.forEach((v) => {
780
+ o.appendChild(v);
781
781
  });
782
782
  const g = (u = this._button.querySelector("mint-spinner")) == null ? void 0 : u.parentElement;
783
783
  r && a === "left" ? g ? (g.insertAdjacentElement("afterend", r), r.insertAdjacentElement("afterend", o)) : (this._button.insertBefore(r, this._button.firstChild), r.insertAdjacentElement("afterend", o)) : r && a === "right" ? g ? (g.insertAdjacentElement("afterend", o), o.insertAdjacentElement("afterend", r)) : (this._button.insertBefore(o, this._button.firstChild), o.insertAdjacentElement("afterend", r)) : g ? g.insertAdjacentElement("afterend", o) : this._button.insertBefore(o, this._button.firstChild);
@@ -832,10 +832,10 @@ const W = class W extends HTMLElement {
832
832
  });
833
833
  }
834
834
  };
835
- W._activeShadowStyleInjected = !1;
836
- let Y = W;
837
- customElements.get("mint-button") || customElements.define("mint-button", Y);
838
- class Z extends HTMLElement {
835
+ V._activeShadowStyleInjected = !1;
836
+ let U = V;
837
+ customElements.get("mint-button") || customElements.define("mint-button", U);
838
+ class tt extends HTMLElement {
839
839
  constructor() {
840
840
  super(), this._button = null, this._checked = !1;
841
841
  }
@@ -988,6 +988,13 @@ class Z extends HTMLElement {
988
988
  }
989
989
  handleToggle(t) {
990
990
  this.isDisabled() || (this.checked = !this._checked, this.dispatchEvent(
991
+ new CustomEvent("input", {
992
+ detail: { checked: this._checked },
993
+ bubbles: !0,
994
+ cancelable: !0,
995
+ composed: !0
996
+ })
997
+ ), this.dispatchEvent(
991
998
  new CustomEvent("change", {
992
999
  detail: { checked: this._checked },
993
1000
  bubbles: !0,
@@ -1036,8 +1043,8 @@ class Z extends HTMLElement {
1036
1043
  t && e ? (i || (i = document.createElement("div"), i.className = "mint-switch-error mt-1 text-xs text-red-600 dark:text-red-400", this.appendChild(i)), i.textContent = e) : i && i.remove(), this._button && (this._button.className = this.getSwitchClasses());
1037
1044
  }
1038
1045
  }
1039
- customElements.get("mint-switch") || customElements.define("mint-switch", Z);
1040
- class Q extends HTMLElement {
1046
+ customElements.get("mint-switch") || customElements.define("mint-switch", tt);
1047
+ class et extends HTMLElement {
1041
1048
  // Store classes set via class attribute
1042
1049
  constructor() {
1043
1050
  super(), this._darkModeObserver = null, this._userClasses = /* @__PURE__ */ new Set();
@@ -1147,8 +1154,8 @@ class Q extends HTMLElement {
1147
1154
  this.style.setProperty("font-size", o);
1148
1155
  }
1149
1156
  }
1150
- customElements.get("mint-text") || customElements.define("mint-text", Q);
1151
- class tt extends HTMLElement {
1157
+ customElements.get("mint-text") || customElements.define("mint-text", et);
1158
+ class it extends HTMLElement {
1152
1159
  constructor() {
1153
1160
  super(), this._childObserver = null;
1154
1161
  }
@@ -1253,8 +1260,8 @@ class tt extends HTMLElement {
1253
1260
  });
1254
1261
  }
1255
1262
  }
1256
- customElements.get("mint-stack") || customElements.define("mint-stack", tt);
1257
- class et extends HTMLElement {
1263
+ customElements.get("mint-stack") || customElements.define("mint-stack", it);
1264
+ class st extends HTMLElement {
1258
1265
  constructor() {
1259
1266
  super(), this._headingElement = null;
1260
1267
  }
@@ -1285,8 +1292,8 @@ class et extends HTMLElement {
1285
1292
  t ? (this._headingElement || (this._headingElement = document.createElement("mint-text"), this._headingElement.setAttribute("size", "sub-heading"), this.insertBefore(this._headingElement, this.firstChild)), this._headingElement.textContent = t) : this._headingElement && this._headingElement.parentNode && (this._headingElement.remove(), this._headingElement = null);
1286
1293
  }
1287
1294
  }
1288
- customElements.get("mint-card") || customElements.define("mint-card", et);
1289
- class it extends HTMLElement {
1295
+ customElements.get("mint-card") || customElements.define("mint-card", st);
1296
+ class rt extends HTMLElement {
1290
1297
  constructor() {
1291
1298
  super(), this._link = null, this._contentObserver = null;
1292
1299
  }
@@ -1352,8 +1359,8 @@ class it extends HTMLElement {
1352
1359
  });
1353
1360
  }
1354
1361
  }
1355
- customElements.get("mint-link") || customElements.define("mint-link", it);
1356
- class st extends HTMLElement {
1362
+ customElements.get("mint-link") || customElements.define("mint-link", rt);
1363
+ class nt extends HTMLElement {
1357
1364
  constructor() {
1358
1365
  super(), this._button = null;
1359
1366
  }
@@ -1411,8 +1418,8 @@ class st extends HTMLElement {
1411
1418
  this._button || (this._button = document.createElement("mint-button"), this._button.setAttribute("variant", "neutral"), this._button.setAttribute("icon", "arrow-left"), this._button.addEventListener("click", (t) => this.handleClick(t)), this.appendChild(this._button));
1412
1419
  }
1413
1420
  }
1414
- customElements.get("mint-back-button") || customElements.define("mint-back-button", st);
1415
- class rt extends HTMLElement {
1421
+ customElements.get("mint-back-button") || customElements.define("mint-back-button", nt);
1422
+ class at extends HTMLElement {
1416
1423
  constructor() {
1417
1424
  super(), this._pageContainer = null, this._header = null, this._titleElement = null, this._headingText = null, this._actionsSlot = null, this._bodySlot = null, this._darkModeObserver = null, this._backButton = null, this._backButtonHandler = null;
1418
1425
  }
@@ -1488,8 +1495,8 @@ class rt extends HTMLElement {
1488
1495
  this._backButtonHandler && (this.removeEventListener("back", this._backButtonHandler, !0), this._backButtonHandler = null);
1489
1496
  }
1490
1497
  }
1491
- customElements.get("mint-page") || customElements.define("mint-page", rt);
1492
- class nt extends HTMLElement {
1498
+ customElements.get("mint-page") || customElements.define("mint-page", at);
1499
+ class ot extends HTMLElement {
1493
1500
  static get observedAttributes() {
1494
1501
  return ["columns", "sm", "md", "lg", "xl", "gap"];
1495
1502
  }
@@ -1542,8 +1549,8 @@ class nt extends HTMLElement {
1542
1549
  });
1543
1550
  }
1544
1551
  }
1545
- customElements.get("mint-grid") || customElements.define("mint-grid", nt);
1546
- class at extends HTMLElement {
1552
+ customElements.get("mint-grid") || customElements.define("mint-grid", ot);
1553
+ class lt extends HTMLElement {
1547
1554
  constructor() {
1548
1555
  super(), this._overlay = null, this._modal = null, this._header = null, this._headingSlot = null, this._bodySlot = null, this._actionsSlot = null, this._closeButton = null, this._darkModeObserver = null;
1549
1556
  }
@@ -1638,8 +1645,8 @@ class at extends HTMLElement {
1638
1645
  }, 200);
1639
1646
  }
1640
1647
  }
1641
- customElements.get("mint-modal") || customElements.define("mint-modal", at);
1642
- class ot extends HTMLElement {
1648
+ customElements.get("mint-modal") || customElements.define("mint-modal", lt);
1649
+ class ct extends HTMLElement {
1643
1650
  constructor() {
1644
1651
  super(), this._overlay = null, this._popover = null, this._triggerElement = null, this._darkModeObserver = null, this._clickOutsideHandler = null, this._triggerClickHandler = null, this._triggerHoverEnterHandler = null, this._triggerHoverLeaveHandler = null, this._popoverHoverEnterHandler = null, this._popoverHoverLeaveHandler = null, this._hoverCloseTimeout = null, this._scrollHandler = null, this._resizeHandler = null;
1645
1652
  }
@@ -1887,8 +1894,8 @@ class ot extends HTMLElement {
1887
1894
  });
1888
1895
  }
1889
1896
  }
1890
- customElements.get("mint-popover") || customElements.define("mint-popover", ot);
1891
- class lt extends HTMLElement {
1897
+ customElements.get("mint-popover") || customElements.define("mint-popover", ct);
1898
+ class ht extends HTMLElement {
1892
1899
  constructor() {
1893
1900
  super(), this._checkbox = null, this._checked = !1, this._clickHandler = null, this._changeHandler = null, this._mousedownHandler = null, this._mouseupHandler = null, this._mouseleaveHandler = null, this._touchstartHandler = null, this._touchendHandler = null, this._focusHandler = null, this._blurHandler = null;
1894
1901
  }
@@ -2023,7 +2030,12 @@ class lt extends HTMLElement {
2023
2030
  }
2024
2031
  setupEventListeners() {
2025
2032
  this.removeEventListeners(), this._checkbox && (this._changeHandler = (t) => {
2026
- t.stopPropagation(), this._checked = this._checkbox.checked, this._checked ? this.hasAttribute("checked") || this.setAttribute("checked", "") : this.hasAttribute("checked") && this.removeAttribute("checked"), this.updateVisualState();
2033
+ t.stopPropagation(), this._checked = this._checkbox.checked, this._checked ? this.hasAttribute("checked") || this.setAttribute("checked", "") : this.hasAttribute("checked") && this.removeAttribute("checked"), this.updateVisualState(), this.dispatchEvent(new CustomEvent("input", {
2034
+ detail: { checked: this._checked, value: this.getValue() },
2035
+ bubbles: !0,
2036
+ cancelable: !0,
2037
+ composed: !0
2038
+ }));
2027
2039
  const e = new CustomEvent("change", {
2028
2040
  detail: { checked: this._checked, value: this.getValue() },
2029
2041
  bubbles: !0,
@@ -2073,7 +2085,12 @@ class lt extends HTMLElement {
2073
2085
  }
2074
2086
  toggle() {
2075
2087
  if (this._checkbox && !this.isDisabled()) {
2076
- this._checkbox.checked = !this._checked, this._checked = this._checkbox.checked, this._checked ? this.hasAttribute("checked") || this.setAttribute("checked", "") : this.hasAttribute("checked") && this.removeAttribute("checked"), this.updateVisualState();
2088
+ this._checkbox.checked = !this._checked, this._checked = this._checkbox.checked, this._checked ? this.hasAttribute("checked") || this.setAttribute("checked", "") : this.hasAttribute("checked") && this.removeAttribute("checked"), this.updateVisualState(), this.dispatchEvent(new CustomEvent("input", {
2089
+ detail: { checked: this._checked },
2090
+ bubbles: !0,
2091
+ cancelable: !0,
2092
+ composed: !0
2093
+ }));
2077
2094
  const t = new CustomEvent("change", {
2078
2095
  detail: { checked: this._checked },
2079
2096
  bubbles: !0,
@@ -2106,8 +2123,8 @@ class lt extends HTMLElement {
2106
2123
  n && (n.className = `mint-checkbox-wrapper ${this.getCheckboxClasses()}`);
2107
2124
  }
2108
2125
  }
2109
- customElements.get("mint-checkbox") || customElements.define("mint-checkbox", lt);
2110
- class ct extends HTMLElement {
2126
+ customElements.get("mint-checkbox") || customElements.define("mint-checkbox", ht);
2127
+ class dt extends HTMLElement {
2111
2128
  constructor() {
2112
2129
  super(), this._radio = null, this._checked = !1, this._changeHandler = null, this._clickHandler = null, this._focusHandler = null, this._blurHandler = null, this._keydownHandler = null;
2113
2130
  }
@@ -2347,8 +2364,8 @@ class ct extends HTMLElement {
2347
2364
  }
2348
2365
  }
2349
2366
  }
2350
- customElements.get("mint-choice-option") || customElements.define("mint-choice-option", ct);
2351
- class ht extends HTMLElement {
2367
+ customElements.get("mint-choice-option") || customElements.define("mint-choice-option", dt);
2368
+ class ut extends HTMLElement {
2352
2369
  constructor() {
2353
2370
  super(), this._optionsContainer = null;
2354
2371
  }
@@ -2356,7 +2373,21 @@ class ht extends HTMLElement {
2356
2373
  return ["label", "name", "info", "error", "error-message", "id", "disabled", "required", "loading"];
2357
2374
  }
2358
2375
  connectedCallback() {
2359
- this.classList.add("box-border", "m-0", "p-0", "border-0", "block", "w-full"), this.render();
2376
+ this.classList.add("box-border", "m-0", "p-0", "border-0", "block", "w-full"), this.render(), this.addEventListener("choice-change", (t) => {
2377
+ var s;
2378
+ const i = ((s = t.detail) == null ? void 0 : s.value) || this.getValue();
2379
+ this.dispatchEvent(new CustomEvent("input", {
2380
+ detail: { value: i },
2381
+ bubbles: !0,
2382
+ cancelable: !0,
2383
+ composed: !0
2384
+ })), this.dispatchEvent(new CustomEvent("change", {
2385
+ detail: { value: i },
2386
+ bubbles: !0,
2387
+ cancelable: !0,
2388
+ composed: !0
2389
+ }));
2390
+ });
2360
2391
  }
2361
2392
  disconnectedCallback() {
2362
2393
  }
@@ -2470,8 +2501,8 @@ class ht extends HTMLElement {
2470
2501
  t && e ? (i || (i = document.createElement("div"), i.className = "mint-choice-error mt-1 text-xs text-red-600 dark:text-red-400", this.appendChild(i)), i.textContent = e) : i && i.remove();
2471
2502
  }
2472
2503
  }
2473
- customElements.get("mint-choice") || customElements.define("mint-choice", ht);
2474
- class dt extends HTMLElement {
2504
+ customElements.get("mint-choice") || customElements.define("mint-choice", ut);
2505
+ class pt extends HTMLElement {
2475
2506
  constructor() {
2476
2507
  super(), this._input = null, this._textarea = null, this._element = null, this._wrapper = null, this._icon = null, this._colorPicker = null, this._colorTextInput = null, this._colorContainer = null, this._colorPickerWrapper = null, this._numberSpinnerContainer = null, this._numberIncrementButton = null, this._numberDecrementButton = null, this._focusHandler = null, this._blurHandler = null, this._clickHandler = null, this._clickOutsideHandler = null;
2477
2508
  }
@@ -2603,52 +2634,52 @@ class dt extends HTMLElement {
2603
2634
  return this.hasAttribute("loading");
2604
2635
  }
2605
2636
  render() {
2606
- var b, v, x, S;
2637
+ var v, b, k, A;
2607
2638
  this.getType();
2608
2639
  const t = this._getNormalizedType(), e = this._isTextarea(), i = this._isMoney(), s = this._isColor(), n = this.getPlaceholder(), r = this.isDisabled(), a = this.isReadonly(), o = this.isRequired(), l = this.getId(), c = this.getName(), d = this.getAttribute("value") || (s ? "#000000" : ""), u = this.getRows(), h = this.getIcon(), f = this.getLabel(), p = this.getInfo(), m = this.isLoading();
2609
2640
  if (this._renderSkeleton(m), s) {
2610
2641
  this._input && (this._input.remove(), this._input = null), this._textarea && (this._textarea.remove(), this._textarea = null), this._wrapper || (this._wrapper = document.createElement("div"), this._wrapper.className = "relative w-full", this.appendChild(this._wrapper)), this._colorContainer && (this._colorContainer.remove(), this._colorContainer = null), this._colorPickerWrapper && !s && (this._colorPickerWrapper.remove(), this._colorPickerWrapper = null), this._colorPickerWrapper || (this._colorPickerWrapper = document.createElement("div"), this._colorPickerWrapper.className = "mint-color-picker-wrapper absolute left-[.65rem] top-1/2 -translate-y-1/2 w-6 h-6 rounded cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500", this._colorPickerWrapper.style.backgroundColor = d || "#000000", this._wrapper.appendChild(this._colorPickerWrapper), this._colorPicker = document.createElement("input"), this._colorPicker.type = "color", this._colorPicker.className = "absolute inset-0 w-full h-full opacity-0 cursor-pointer", this._colorPicker.style.cssText = "position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; z-index: 10; pointer-events: auto; margin: 0; padding: 0; border: none;", this._colorPickerWrapper.appendChild(this._colorPicker), this._focusHandler = (y) => {
2611
2642
  this._colorPickerWrapper && this._colorPicker && this._colorPicker.matches(":focus-visible") && requestAnimationFrame(() => {
2612
- var E;
2613
- this._colorPicker && this._colorPicker.matches(":focus-visible") && ((E = this._colorPickerWrapper) == null || E.classList.add("ring-2", "ring-offset-1", "ring-gray-400", "dark:ring-gray-500"));
2643
+ var x;
2644
+ this._colorPicker && this._colorPicker.matches(":focus-visible") && ((x = this._colorPickerWrapper) == null || x.classList.add("ring-2", "ring-offset-1", "ring-gray-400", "dark:ring-gray-500"));
2614
2645
  });
2615
2646
  }, this._blurHandler = () => {
2616
2647
  this._colorPickerWrapper && this._colorPickerWrapper.classList.remove("ring-2", "ring-offset-1", "ring-gray-400", "dark:ring-gray-500");
2617
2648
  }, this._colorPicker.addEventListener("focus", this._focusHandler), this._colorPicker.addEventListener("blur", this._blurHandler), this._colorPicker.addEventListener("input", () => {
2618
- var E;
2619
- const y = ((E = this._colorPicker) == null ? void 0 : E.value) || "#000000";
2649
+ var x;
2650
+ const y = ((x = this._colorPicker) == null ? void 0 : x.value) || "#000000";
2620
2651
  this._colorPickerWrapper && (this._colorPickerWrapper.style.backgroundColor = y), this._colorTextInput && (this._colorTextInput.value = y), this.setAttribute("value", y), this.dispatchEvent(new CustomEvent("input", {
2621
2652
  detail: { value: y },
2622
2653
  bubbles: !0,
2623
2654
  cancelable: !0
2624
2655
  }));
2625
2656
  }), this._colorPicker.addEventListener("change", () => {
2626
- var E;
2627
- const y = ((E = this._colorPicker) == null ? void 0 : E.value) || "#000000";
2657
+ var x;
2658
+ const y = ((x = this._colorPicker) == null ? void 0 : x.value) || "#000000";
2628
2659
  this._colorPickerWrapper && (this._colorPickerWrapper.style.backgroundColor = y), this.setAttribute("value", y), this.dispatchEvent(new CustomEvent("change", {
2629
2660
  detail: { value: y },
2630
2661
  bubbles: !0,
2631
2662
  cancelable: !0
2632
2663
  }));
2633
2664
  })), this._colorTextInput || (this._colorTextInput = document.createElement("input"), this._colorTextInput.type = "text", this._colorTextInput.className = this.getInputClasses(), this._colorTextInput.placeholder = n || "#000000", this._colorTextInput.pattern = "^#[0-9A-Fa-f]{6}$", this._wrapper.appendChild(this._colorTextInput), this._colorTextInput.addEventListener("input", () => {
2634
- var E;
2635
- const y = ((E = this._colorTextInput) == null ? void 0 : E.value) || "";
2665
+ var x;
2666
+ const y = ((x = this._colorTextInput) == null ? void 0 : x.value) || "";
2636
2667
  /^#[0-9A-Fa-f]{6}$/.test(y) && (this._colorPicker && (this._colorPicker.value = y), this.setAttribute("value", y), this.dispatchEvent(new CustomEvent("input", {
2637
2668
  detail: { value: y },
2638
2669
  bubbles: !0,
2639
2670
  cancelable: !0
2640
2671
  })));
2641
2672
  }), this._colorTextInput.addEventListener("blur", () => {
2642
- var E, I;
2643
- const y = ((E = this._colorTextInput) == null ? void 0 : E.value) || "";
2673
+ var x, T;
2674
+ const y = ((x = this._colorTextInput) == null ? void 0 : x.value) || "";
2644
2675
  /^#[0-9A-Fa-f]{6}$/.test(y) ? (this._colorPicker && (this._colorPicker.value = y), this.setAttribute("value", y)) : this._colorPicker && this._colorTextInput && (this._colorTextInput.value = this._colorPicker.value), this.dispatchEvent(new CustomEvent("change", {
2645
- detail: { value: ((I = this._colorPicker) == null ? void 0 : I.value) || "#000000" },
2676
+ detail: { value: ((T = this._colorPicker) == null ? void 0 : T.value) || "#000000" },
2646
2677
  bubbles: !0,
2647
2678
  cancelable: !0
2648
2679
  }));
2649
2680
  }));
2650
- const k = d || "#000000";
2651
- if (this._colorPicker && this._colorPicker.value !== k && (this._colorPicker.value = k), this._colorPickerWrapper && (this._colorPickerWrapper.style.backgroundColor = k), this._colorTextInput && this._colorTextInput.value !== k && (this._colorTextInput.value = k), this._colorPicker && (this._colorPicker.disabled = r), this._colorPickerWrapper && (r ? (this._colorPickerWrapper.classList.add("opacity-40", "cursor-not-allowed"), this._colorPickerWrapper.classList.remove("cursor-pointer")) : (this._colorPickerWrapper.classList.remove("opacity-40", "cursor-not-allowed"), this._colorPickerWrapper.classList.add("cursor-pointer"))), this._colorTextInput && (this._colorTextInput.disabled = r, this._colorTextInput.readOnly = a, this._colorTextInput.required = o), this._colorTextInput) {
2681
+ const E = d || "#000000";
2682
+ if (this._colorPicker && this._colorPicker.value !== E && (this._colorPicker.value = E), this._colorPickerWrapper && (this._colorPickerWrapper.style.backgroundColor = E), this._colorTextInput && this._colorTextInput.value !== E && (this._colorTextInput.value = E), this._colorPicker && (this._colorPicker.disabled = r), this._colorPickerWrapper && (r ? (this._colorPickerWrapper.classList.add("opacity-40", "cursor-not-allowed"), this._colorPickerWrapper.classList.remove("cursor-pointer")) : (this._colorPickerWrapper.classList.remove("opacity-40", "cursor-not-allowed"), this._colorPickerWrapper.classList.add("cursor-pointer"))), this._colorTextInput && (this._colorTextInput.disabled = r, this._colorTextInput.readOnly = a, this._colorTextInput.required = o), this._colorTextInput) {
2652
2683
  const y = this._colorTextInput;
2653
2684
  l ? y.id = l : y.removeAttribute("id"), c ? y.name = c : y.removeAttribute("name"), y.setAttribute("aria-invalid", this.hasError() ? "true" : "false"), this._element = y;
2654
2685
  }
@@ -2658,20 +2689,20 @@ class dt extends HTMLElement {
2658
2689
  if (this._wrapper || (this._wrapper = document.createElement("div"), this._wrapper.className = "relative w-full", this.appendChild(this._wrapper)), this._colorContainer && (this._colorContainer.remove(), this._colorContainer = null, this._colorPicker = null, this._colorTextInput = null), this._colorPickerWrapper && !s && (this._colorPickerWrapper.remove(), this._colorPickerWrapper = null, this._colorPicker = null, this._colorTextInput = null), h && !e ? this._icon ? this._icon.setAttribute("name", h) : (this._icon = document.createElement("mint-icon"), this._icon.setAttribute("name", h), this._icon.className = "absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400 dark:text-gray-500 pointer-events-none", this._wrapper.appendChild(this._icon)) : this._icon && (this._icon.remove(), this._icon = null), this._isNumber() && !e) {
2659
2690
  if (!this._numberSpinnerContainer) {
2660
2691
  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";
2661
- const k = document.createElement("mint-icon");
2662
- k.setAttribute("name", "caret-up"), k.className = "w-[1rem] h-[1rem]", this._numberIncrementButton.appendChild(k), 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";
2692
+ const E = document.createElement("mint-icon");
2693
+ E.setAttribute("name", "caret-up"), E.className = "w-[1rem] h-[1rem]", this._numberIncrementButton.appendChild(E), 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";
2663
2694
  const y = document.createElement("mint-icon");
2664
- y.setAttribute("name", "caret-down"), y.className = "w-[1rem] h-[1rem]", this._numberDecrementButton.appendChild(y), this._numberSpinnerContainer.appendChild(this._numberDecrementButton), this._numberIncrementButton.addEventListener("click", (E) => {
2665
- if (E.preventDefault(), E.stopPropagation(), this._input && !this._input.disabled && !this._input.readOnly) {
2666
- const I = parseFloat(this._input.value) || 0, V = parseFloat(this._input.step) || 1, O = this._input.min ? parseFloat(this._input.min) : void 0, F = this._input.max ? parseFloat(this._input.max) : void 0;
2667
- let D = I + V;
2668
- F !== void 0 && D > F && (D = F), O !== void 0 && D < O && (D = O), this._input.value = D.toString(), this.setAttribute("value", D.toString()), this._input.dispatchEvent(new Event("input", { bubbles: !0 })), this._input.dispatchEvent(new Event("change", { bubbles: !0 }));
2695
+ y.setAttribute("name", "caret-down"), y.className = "w-[1rem] h-[1rem]", this._numberDecrementButton.appendChild(y), this._numberSpinnerContainer.appendChild(this._numberDecrementButton), this._numberIncrementButton.addEventListener("click", (x) => {
2696
+ if (x.preventDefault(), x.stopPropagation(), this._input && !this._input.disabled && !this._input.readOnly) {
2697
+ const T = parseFloat(this._input.value) || 0, R = parseFloat(this._input.step) || 1, P = this._input.min ? parseFloat(this._input.min) : void 0, O = this._input.max ? parseFloat(this._input.max) : void 0;
2698
+ let H = T + R;
2699
+ O !== void 0 && H > O && (H = O), P !== void 0 && H < P && (H = P), this._input.value = H.toString(), this.setAttribute("value", H.toString()), this._input.dispatchEvent(new Event("input", { bubbles: !0 })), this._input.dispatchEvent(new Event("change", { bubbles: !0 }));
2669
2700
  }
2670
- }), this._numberDecrementButton.addEventListener("click", (E) => {
2671
- if (E.preventDefault(), E.stopPropagation(), this._input && !this._input.disabled && !this._input.readOnly) {
2672
- const I = parseFloat(this._input.value) || 0, V = parseFloat(this._input.step) || 1, O = this._input.min ? parseFloat(this._input.min) : void 0, F = this._input.max ? parseFloat(this._input.max) : void 0;
2673
- let D = I - V;
2674
- O !== void 0 && D < O && (D = O), F !== void 0 && D > F && (D = F), this._input.value = D.toString(), this.setAttribute("value", D.toString()), this._input.dispatchEvent(new Event("input", { bubbles: !0 })), this._input.dispatchEvent(new Event("change", { bubbles: !0 }));
2701
+ }), this._numberDecrementButton.addEventListener("click", (x) => {
2702
+ if (x.preventDefault(), x.stopPropagation(), this._input && !this._input.disabled && !this._input.readOnly) {
2703
+ const T = parseFloat(this._input.value) || 0, R = parseFloat(this._input.step) || 1, P = this._input.min ? parseFloat(this._input.min) : void 0, O = this._input.max ? parseFloat(this._input.max) : void 0;
2704
+ let H = T - R;
2705
+ P !== void 0 && H < P && (H = P), O !== void 0 && H > O && (H = O), this._input.value = H.toString(), this.setAttribute("value", H.toString()), this._input.dispatchEvent(new Event("input", { bubbles: !0 })), this._input.dispatchEvent(new Event("change", { bubbles: !0 }));
2675
2706
  }
2676
2707
  });
2677
2708
  }
@@ -2679,28 +2710,28 @@ class dt extends HTMLElement {
2679
2710
  } else this._numberSpinnerContainer && (this._numberSpinnerContainer.remove(), this._numberSpinnerContainer = null, this._numberIncrementButton = null, this._numberDecrementButton = null);
2680
2711
  if (e) {
2681
2712
  if (this._input && (this._input.remove(), this._input = null), this._textarea || (this._textarea = document.createElement("textarea"), this._wrapper.appendChild(this._textarea), this.setupEventListeners()), this._element = this._textarea, this._textarea.placeholder = n, this._textarea.disabled = r, this._textarea.readOnly = a, this._textarea.required = o, this._textarea.rows = u, this._textarea.setAttribute("aria-invalid", this.hasError() ? "true" : "false"), d !== this._textarea.value && (this._textarea.value = d), l ? this._textarea.id = l : this._textarea.removeAttribute("id"), c ? this._textarea.name = c : this._textarea.removeAttribute("name"), this._textarea.className = this.getInputClasses(), this.firstChild && this.firstChild !== this._wrapper && this.firstChild.nodeType === Node.TEXT_NODE) {
2682
- const k = this.firstChild.textContent;
2683
- k && !this._textarea.value && (this._textarea.value = k.trim()), this.removeChild(this.firstChild);
2713
+ const E = this.firstChild.textContent;
2714
+ E && !this._textarea.value && (this._textarea.value = E.trim()), this.removeChild(this.firstChild);
2684
2715
  }
2685
2716
  } else if (this._textarea && (this._textarea.remove(), this._textarea = null), this._input || (this._input = document.createElement("input"), this._wrapper.appendChild(this._input), this.setupEventListeners()), this._element = this._input, this._input.type = t, this._input.placeholder = n, this._input.disabled = r, this._input.readOnly = a, this._input.required = o, this._input.setAttribute("aria-invalid", this.hasError() ? "true" : "false"), i ? (this._input.inputMode = "decimal", this._input.pattern = "[0-9]*\\.?[0-9]*") : (this._input.removeAttribute("inputmode"), this._input.removeAttribute("pattern")), d !== this._input.value && (this._input.value = d), l ? this._input.id = l : this._input.removeAttribute("id"), c ? this._input.name = c : this._input.removeAttribute("name"), this._input.className = this.getInputClasses(), this.firstChild && this.firstChild !== this._wrapper && this.firstChild.nodeType === Node.TEXT_NODE) {
2686
- const k = this.firstChild.textContent;
2687
- k && !this._input.value && (this._input.value = k.trim()), this.removeChild(this.firstChild);
2717
+ const E = this.firstChild.textContent;
2718
+ E && !this._input.value && (this._input.value = E.trim()), this.removeChild(this.firstChild);
2688
2719
  }
2689
2720
  let g = this.querySelector(".mint-input-label-container");
2690
2721
  if (f || p) {
2691
2722
  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));
2692
- let k = g.querySelector(".mint-input-label");
2723
+ let E = g.querySelector(".mint-input-label");
2693
2724
  if (f) {
2694
- k || (k = document.createElement("label"), k.className = "mint-input-label text-sm font-medium text-gray-900 dark:text-gray-100 select-none", g.insertBefore(k, g.firstChild)), k.textContent = f;
2695
- const E = l || ((b = this._element) == null ? void 0 : b.id) || ((v = this._colorTextInput) == null ? void 0 : v.id) || ((x = this._input) == null ? void 0 : x.id) || ((S = this._textarea) == null ? void 0 : S.id);
2696
- if (E)
2697
- k.setAttribute("for", E);
2725
+ E || (E = document.createElement("label"), E.className = "mint-input-label text-sm font-medium text-gray-900 dark:text-gray-100 select-none", g.insertBefore(E, g.firstChild)), E.textContent = f;
2726
+ const x = l || ((v = this._element) == null ? void 0 : v.id) || ((b = this._colorTextInput) == null ? void 0 : b.id) || ((k = this._input) == null ? void 0 : k.id) || ((A = this._textarea) == null ? void 0 : A.id);
2727
+ if (x)
2728
+ E.setAttribute("for", x);
2698
2729
  else {
2699
- const I = `mint-input-${Math.random().toString(36).substr(2, 9)}`;
2700
- this._element ? this._element.id = I : this._colorTextInput ? this._colorTextInput.id = I : this._input ? this._input.id = I : this._textarea && (this._textarea.id = I), k.setAttribute("for", I);
2730
+ const T = `mint-input-${Math.random().toString(36).substr(2, 9)}`;
2731
+ this._element ? this._element.id = T : this._colorTextInput ? this._colorTextInput.id = T : this._input ? this._input.id = T : this._textarea && (this._textarea.id = T), E.setAttribute("for", T);
2701
2732
  }
2702
- r ? k.classList.add("opacity-40") : k.classList.remove("opacity-40");
2703
- } else k && k.remove();
2733
+ r ? E.classList.add("opacity-40") : E.classList.remove("opacity-40");
2734
+ } else E && E.remove();
2704
2735
  let y = g.querySelector(".mint-input-info");
2705
2736
  p ? (y || (y = document.createElement("span"), y.className = "mint-input-info text-xs text-gray-500 dark:text-gray-400 select-none", g.appendChild(y)), y.textContent = p, r ? y.classList.add("opacity-40") : y.classList.remove("opacity-40")) : y && y.remove();
2706
2737
  } else g && g.remove();
@@ -2762,13 +2793,13 @@ class dt extends HTMLElement {
2762
2793
  e && (e.style.display = "none"), this._element && (this._element.style.opacity = "1", this._element.style.pointerEvents = "auto"), this._colorTextInput && (this._colorTextInput.style.opacity = "1", this._colorTextInput.style.pointerEvents = "auto");
2763
2794
  }
2764
2795
  }
2765
- customElements.get("mint-input") || customElements.define("mint-input", dt);
2766
- class ut extends HTMLElement {
2796
+ customElements.get("mint-input") || customElements.define("mint-input", pt);
2797
+ class ft extends HTMLElement {
2767
2798
  constructor() {
2768
2799
  super(), this._input = null, this._textInput = null, this._popover = null, this._calendarContainer = null, this._iconButton = null, this._hiddenInput = null, this._startPartInputs = [], this._endPartInputs = [], this._displayEl = null, this._inputsWrapperEl = null, this._fieldsContainer = null, this._resetHandler = null, this._isInputMode = !1, this._currentMonth = (/* @__PURE__ */ new Date()).getMonth(), this._currentYear = (/* @__PURE__ */ new Date()).getFullYear(), this._viewMode = "calendar", this._selectedStartDate = null, this._selectedEndDate = null, this._isRange = !1, this._popoverObserver = null, this._focusTrapHandler = null, this._escapeHandler = null;
2769
2800
  }
2770
2801
  static get observedAttributes() {
2771
- return ["value", "label", "info", "disabled", "id", "name", "required", "readonly", "format", "min", "max", "range", "shortcuts", "display-format", "error", "error-message", "loading"];
2802
+ return ["value", "label", "info", "disabled", "id", "name", "required", "readonly", "format", "min", "max", "range", "shortcuts", "display-format", "error", "error-message", "loading", "selection-mode", "week-start-day"];
2772
2803
  }
2773
2804
  connectedCallback() {
2774
2805
  this.classList.add("box-border", "m-0", "p-0", "border-0", "align-baseline", "inline-block"), this.render(), this._setupPopoverWithRetry(), this._attachFormResetListener();
@@ -2841,6 +2872,23 @@ class ut extends HTMLElement {
2841
2872
  getMax() {
2842
2873
  return this.getAttribute("max") || "";
2843
2874
  }
2875
+ getSelectionMode() {
2876
+ const t = this.getAttribute("selection-mode");
2877
+ return t === "week" || t === "month" ? t : "day";
2878
+ }
2879
+ getWeekStartDay() {
2880
+ var i;
2881
+ const t = (i = this.getAttribute("week-start-day")) == null ? void 0 : i.toLowerCase();
2882
+ return {
2883
+ sunday: 0,
2884
+ monday: 1,
2885
+ tuesday: 2,
2886
+ wednesday: 3,
2887
+ thursday: 4,
2888
+ friday: 5,
2889
+ saturday: 6
2890
+ }[t || "sunday"] ?? 0;
2891
+ }
2844
2892
  getDisplayFormat() {
2845
2893
  return this.getAttribute("display-format") || "F j, Y";
2846
2894
  }
@@ -2993,17 +3041,17 @@ class ut extends HTMLElement {
2993
3041
  return i.length >= 2 ? [i[0], i.slice(1).join("-")] : [t];
2994
3042
  }
2995
3043
  _parseValue(t) {
2996
- const e = this.getFormat(), i = this._getFormatTokens(e);
2997
- if (this._isRange) {
2998
- const [s, n] = this._splitRangeInput(t, e), r = s ? this._parseDateString(s, e) : null, a = n ? this._parseDateString(n, e) : null;
2999
- if (r && a) {
3000
- const [o, l] = r <= a ? [r, a] : [a, r];
3001
- this._selectedStartDate = o, this._selectedEndDate = l, this._currentMonth = o.getMonth(), this._currentYear = o.getFullYear();
3002
- } else r && (this._selectedStartDate = r, this._selectedEndDate = null, this._currentMonth = r.getMonth(), this._currentYear = r.getFullYear());
3044
+ const e = this.getFormat(), i = this._getFormatTokens(e), s = this.getSelectionMode();
3045
+ if (this._isRange || s === "week" || s === "month") {
3046
+ const [r, a] = this._splitRangeInput(t, e), o = r ? this._parseDateString(r, e) : null, l = a ? this._parseDateString(a, e) : null;
3047
+ if (o && l) {
3048
+ const [c, d] = o <= l ? [o, l] : [l, o];
3049
+ this._selectedStartDate = c, this._selectedEndDate = d, this._currentMonth = c.getMonth(), this._currentYear = c.getFullYear();
3050
+ } else o && (this._selectedStartDate = o, this._selectedEndDate = null, this._currentMonth = o.getMonth(), this._currentYear = o.getFullYear());
3003
3051
  this._applyDateToParts(this._selectedStartDate, this._startPartInputs, i, e), this._applyDateToParts(this._selectedEndDate, this._endPartInputs, i, e);
3004
3052
  } else {
3005
- const s = this._parseDateString(t, e);
3006
- s && !isNaN(s.getTime()) ? (this._selectedStartDate = s, this._selectedEndDate = null, this._currentMonth = s.getMonth(), this._currentYear = s.getFullYear(), this._applyDateToParts(s, this._startPartInputs, i, e)) : this._applyDateToParts(null, this._startPartInputs, i, e);
3053
+ const r = this._parseDateString(t, e);
3054
+ r && !isNaN(r.getTime()) ? (this._selectedStartDate = r, this._selectedEndDate = null, this._currentMonth = r.getMonth(), this._currentYear = r.getFullYear(), this._applyDateToParts(r, this._startPartInputs, i, e)) : this._applyDateToParts(null, this._startPartInputs, i, e);
3007
3055
  }
3008
3056
  this._syncHiddenInput(), this._updateDisplayText();
3009
3057
  }
@@ -3012,23 +3060,23 @@ class ut extends HTMLElement {
3012
3060
  if (i.test(t)) {
3013
3061
  const m = t.split(i).filter((g) => g.length > 0), _ = e.split(/[\/\-\.\s]+/).filter((g) => g.length > 0);
3014
3062
  if (m.length === _.length) {
3015
- let g = 0, b = 0, v = 0;
3016
- for (let x = 0; x < _.length; x++) {
3017
- const S = _[x].toLowerCase(), k = m[x];
3018
- if (S.includes("d"))
3019
- g = parseInt(k, 10);
3020
- else if (S.includes("m"))
3021
- b = parseInt(k, 10) - 1;
3022
- else if (S.includes("y")) {
3023
- let y = parseInt(k, 10);
3024
- const E = S.length, I = k.length;
3025
- I === 2 && E === 4 ? y = Math.floor((/* @__PURE__ */ new Date()).getFullYear() / 100) * 100 + y : I === 2 && E === 2 && (y = Math.floor((/* @__PURE__ */ new Date()).getFullYear() / 100) * 100 + y), v = y;
3063
+ let g = 0, v = 0, b = 0;
3064
+ for (let k = 0; k < _.length; k++) {
3065
+ const A = _[k].toLowerCase(), E = m[k];
3066
+ if (A.includes("d"))
3067
+ g = parseInt(E, 10);
3068
+ else if (A.includes("m"))
3069
+ v = parseInt(E, 10) - 1;
3070
+ else if (A.includes("y")) {
3071
+ let y = parseInt(E, 10);
3072
+ const x = A.length, T = E.length;
3073
+ T === 2 && x === 4 ? y = Math.floor((/* @__PURE__ */ new Date()).getFullYear() / 100) * 100 + y : T === 2 && x === 2 && (y = Math.floor((/* @__PURE__ */ new Date()).getFullYear() / 100) * 100 + y), b = y;
3026
3074
  }
3027
3075
  }
3028
- if (g && b >= 0 && b <= 11 && v) {
3029
- const x = new Date(v, b, g);
3030
- if (!isNaN(x.getTime()) && x.getDate() === g && x.getMonth() === b && x.getFullYear() === v)
3031
- return x;
3076
+ if (g && v >= 0 && v <= 11 && b) {
3077
+ const k = new Date(b, v, g);
3078
+ if (!isNaN(k.getTime()) && k.getDate() === g && k.getMonth() === v && k.getFullYear() === b)
3079
+ return k;
3032
3080
  }
3033
3081
  }
3034
3082
  }
@@ -3051,10 +3099,10 @@ class ut extends HTMLElement {
3051
3099
  if (g.length === 0) return null;
3052
3100
  u = parseInt(g, 10) - 1, f += g.length;
3053
3101
  } else if (m.char === "y") {
3054
- const _ = r.lastIndexOf("y") - r.indexOf("y") + 1, g = n.substr(f), b = Math.min(_, g.length), v = g.substr(0, b);
3055
- if (v.length === 0) return null;
3056
- let x = parseInt(v, 10);
3057
- b === 2 && _ === 4 ? x = Math.floor((/* @__PURE__ */ new Date()).getFullYear() / 100) * 100 + x : b === 2 && _ === 2 && (x = Math.floor((/* @__PURE__ */ new Date()).getFullYear() / 100) * 100 + x), h = x, f += b;
3102
+ const _ = r.lastIndexOf("y") - r.indexOf("y") + 1, g = n.substr(f), v = Math.min(_, g.length), b = g.substr(0, v);
3103
+ if (b.length === 0) return null;
3104
+ let k = parseInt(b, 10);
3105
+ v === 2 && _ === 4 ? k = Math.floor((/* @__PURE__ */ new Date()).getFullYear() / 100) * 100 + k : v === 2 && _ === 2 && (k = Math.floor((/* @__PURE__ */ new Date()).getFullYear() / 100) * 100 + k), h = k, f += v;
3058
3106
  }
3059
3107
  if (!d || u < 0 || u > 11 || !h) return null;
3060
3108
  const p = new Date(h, u, d);
@@ -3124,54 +3172,54 @@ class ut extends HTMLElement {
3124
3172
  return i !== null && !isNaN(i.getTime());
3125
3173
  }
3126
3174
  render() {
3127
- const t = this.isLoading(), e = this.getLabel(), i = this.getInfo(), s = this.getValue(), n = this.isDisabled(), r = this.isReadonly(), a = this.isRequired(), o = this.getId(), l = this.getName(), c = this.getFormat(), d = this.hasError(), u = this.getErrorMessage();
3128
- this._isRange = this.isRange(), this._input || (this._input = document.createElement("div"), this._input.className = "relative w-full", this.appendChild(this._input));
3129
- let h = this.querySelector(".mint-date-picker-label-container");
3175
+ const t = this.isLoading(), e = this.getLabel(), i = this.getInfo(), s = this.getValue(), n = this.isDisabled(), r = this.isReadonly(), a = this.isRequired(), o = this.getId(), l = this.getName(), c = this.getFormat(), d = this.hasError(), u = this.getErrorMessage(), h = this.getSelectionMode();
3176
+ this._isRange = this.isRange() || h === "week" || h === "month", this._input || (this._input = document.createElement("div"), this._input.className = "relative w-full", this.appendChild(this._input));
3177
+ let f = this.querySelector(".mint-date-picker-label-container");
3130
3178
  if (e || i) {
3131
- h || (h = document.createElement("div"), h.className = "mint-date-picker-label-container flex flex-col gap-0.5 mb-[.25rem]", this.contains(this._input) ? this.insertBefore(h, this._input) : this.appendChild(h));
3132
- let b = h.querySelector(".mint-date-picker-label");
3133
- e ? (b || (b = document.createElement("label"), b.className = "mint-date-picker-label text-sm font-medium text-gray-900 dark:text-gray-100 select-none", h.insertBefore(b, h.firstChild)), b.textContent = e, o && this._textInput && b.setAttribute("for", o)) : b && b.remove();
3134
- let v = h.querySelector(".mint-date-picker-info");
3135
- i ? (v || (v = document.createElement("span"), v.className = "mint-date-picker-info text-xs text-gray-500 dark:text-gray-400 select-none", h.appendChild(v)), v.textContent = i) : v && v.remove();
3136
- } else h && h.remove();
3179
+ f || (f = document.createElement("div"), f.className = "mint-date-picker-label-container flex flex-col gap-0.5 mb-[.25rem]", this.contains(this._input) ? this.insertBefore(f, this._input) : this.appendChild(f));
3180
+ let b = f.querySelector(".mint-date-picker-label");
3181
+ e ? (b || (b = document.createElement("label"), b.className = "mint-date-picker-label text-sm font-medium text-gray-900 dark:text-gray-100 select-none", f.insertBefore(b, f.firstChild)), b.textContent = e, o && this._textInput && b.setAttribute("for", o)) : b && b.remove();
3182
+ let k = f.querySelector(".mint-date-picker-info");
3183
+ i ? (k || (k = document.createElement("span"), k.className = "mint-date-picker-info text-xs text-gray-500 dark:text-gray-400 select-none", f.appendChild(k)), k.textContent = i) : k && k.remove();
3184
+ } else f && f.remove();
3137
3185
  this._hiddenInput || (this._hiddenInput = document.createElement("input"), this._hiddenInput.type = "hidden", this._hiddenInput.value = s || "", this._textInput = this._hiddenInput, this._input.appendChild(this._hiddenInput)), o && (this._hiddenInput.id = o), l && (this._hiddenInput.name = l), this._hiddenInput.value = s || "", this._hiddenInput.setAttribute("aria-invalid", d ? "true" : "false");
3138
- let f = this._input.querySelector(".mint-date-fields");
3139
- f || (f = document.createElement("div"), this._input.appendChild(f)), this._fieldsContainer = f, this._applyErrorVisuals(d, u, n), f.innerHTML = "", this._displayEl = document.createElement("div");
3140
- const p = r ? "select-text" : "select-none";
3141
- 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", () => {
3186
+ let p = this._input.querySelector(".mint-date-fields");
3187
+ p || (p = document.createElement("div"), this._input.appendChild(p)), this._fieldsContainer = p, this._applyErrorVisuals(d, u, n), p.innerHTML = "", this._displayEl = document.createElement("div");
3188
+ const m = r ? "select-text" : "select-none";
3189
+ this._displayEl.className = `flex-1 text-gray-900 dark:text-white ${r ? "cursor-default" : "cursor-text"} ${m} focus:outline-none`, this._displayEl.tabIndex = n || r ? -1 : 0, this._displayEl.addEventListener("click", () => {
3142
3190
  n || r || this._enterInputMode();
3143
3191
  }), this._displayEl.addEventListener("keydown", (b) => {
3144
3192
  n || r || (b.key === "Enter" || b.key === " ") && (b.preventDefault(), this._enterInputMode());
3145
3193
  }), this._inputsWrapperEl = document.createElement("div"), this._inputsWrapperEl.className = "flex items-center gap-1 w-full";
3146
- const m = this._getFormatTokens(c);
3194
+ const _ = this._getFormatTokens(c);
3147
3195
  this._startPartInputs = [], this._endPartInputs = [];
3148
- const _ = (b) => {
3149
- const v = document.createDocumentFragment();
3150
- return m.forEach((x) => {
3151
- if (x.type === "sep") {
3152
- const S = document.createElement("span");
3153
- S.textContent = x.value, S.className = "text-gray-400 dark:text-gray-500 select-none", v.appendChild(S);
3196
+ const g = (b) => {
3197
+ const k = document.createDocumentFragment();
3198
+ return _.forEach((A) => {
3199
+ if (A.type === "sep") {
3200
+ const E = document.createElement("span");
3201
+ E.textContent = A.value, E.className = "text-gray-400 dark:text-gray-500 select-none", k.appendChild(E);
3154
3202
  } else {
3155
- const S = x.part === "d" ? "dd" : x.part === "m" ? "mm" : x.len === 2 ? "yy" : "yyyy", k = this._createPartInput(x.len, S, n, r, a);
3156
- b === "start" ? this._startPartInputs.push(k) : this._endPartInputs.push(k), v.appendChild(k);
3203
+ const E = A.part === "d" ? "dd" : A.part === "m" ? "mm" : A.len === 2 ? "yy" : "yyyy", y = this._createPartInput(A.len, E, n, r, a);
3204
+ b === "start" ? this._startPartInputs.push(y) : this._endPartInputs.push(y), k.appendChild(y);
3157
3205
  }
3158
- }), v;
3206
+ }), k;
3159
3207
  };
3160
- if (this._inputsWrapperEl.appendChild(_("start")), this._isRange) {
3208
+ if (this._inputsWrapperEl.appendChild(g("start")), this._isRange) {
3161
3209
  const b = document.createElement("span");
3162
- b.textContent = " - ", b.className = "text-gray-400 dark:text-gray-500 select-none", this._inputsWrapperEl.appendChild(b), this._inputsWrapperEl.appendChild(_("end"));
3210
+ b.textContent = " - ", b.className = "text-gray-400 dark:text-gray-500 select-none", this._inputsWrapperEl.appendChild(b), this._inputsWrapperEl.appendChild(g("end"));
3163
3211
  }
3164
- const g = document.createElement("div");
3165
- 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), f.appendChild(g), f.addEventListener("click", () => {
3212
+ const v = document.createElement("div");
3213
+ if (v.className = "flex flex-col w-full", this._displayEl.style.display = this._isInputMode ? "none" : "flex", this._inputsWrapperEl.style.display = this._isInputMode ? "flex" : "none", v.appendChild(this._displayEl), v.appendChild(this._inputsWrapperEl), p.appendChild(v), p.addEventListener("click", () => {
3166
3214
  this._isInputMode || n || r || this._enterInputMode();
3167
- }), this._attachPartInputHandlers(this._startPartInputs, m, f), this._isRange && this._attachPartInputHandlers(this._endPartInputs, m, f), this._parseValue(s), this._syncHiddenInput(), this._updateDisplayText(), this._iconButton)
3215
+ }), this._attachPartInputHandlers(this._startPartInputs, _, p), this._isRange && this._attachPartInputHandlers(this._endPartInputs, _, p), this._parseValue(s), this._syncHiddenInput(), this._updateDisplayText(), this._iconButton)
3168
3216
  this._iconButton.disabled = n || r, !n && !r ? this._iconButton.tabIndex = 0 : this._iconButton.tabIndex = -1;
3169
3217
  else {
3170
3218
  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";
3171
3219
  const b = `date-icon-${Math.random().toString(36).substr(2, 9)}`;
3172
3220
  this._iconButton.id = b;
3173
- const v = document.createElement("mint-icon");
3174
- v.setAttribute("name", "calendar"), v.className = "w-4 h-4 pointer-events-none", this._iconButton.appendChild(v), this._iconButton.addEventListener("click", () => {
3221
+ const k = document.createElement("mint-icon");
3222
+ k.setAttribute("name", "calendar"), k.className = "w-4 h-4 pointer-events-none", this._iconButton.appendChild(k), this._iconButton.addEventListener("click", () => {
3175
3223
  n || r || this._enterInputMode();
3176
3224
  }), this._input.prepend(this._iconButton), this._iconButton.disabled = n || r;
3177
3225
  }
@@ -3215,26 +3263,26 @@ class ut extends HTMLElement {
3215
3263
  return t;
3216
3264
  }
3217
3265
  _handleBlur(t) {
3218
- const e = this.getFormat();
3266
+ const e = this.getFormat(), i = this.getSelectionMode(), s = this._isRange || i === "week" || i === "month";
3219
3267
  if (!t) {
3220
3268
  this.setValue(""), this._updateDisplayText();
3221
3269
  return;
3222
3270
  }
3223
- if (this._isRange) {
3224
- const [i, s] = this._splitRangeInput(t, e), n = i ? this._parseDateString(i, e) : null, r = s ? this._parseDateString(s, e) : null;
3225
- if (n && r) {
3226
- const [a, o] = n <= r ? [n, r] : [r, n], l = this._formatDate(a, e), c = this._formatDate(o, e), d = `${l} - ${c}`;
3227
- this.setValue(d), this._applyDateToParts(a, this._startPartInputs, this._getFormatTokens(e), e), this._applyDateToParts(o, this._endPartInputs, this._getFormatTokens(e), e), this._selectedStartDate = a, this._selectedEndDate = o, this._currentMonth = a.getMonth(), this._currentYear = a.getFullYear();
3228
- } else if (n) {
3229
- const a = this._formatDate(n, e);
3230
- this.setValue(a), this._applyDateToParts(n, this._startPartInputs, this._getFormatTokens(e), e), this._applyDateToParts(null, this._endPartInputs, this._getFormatTokens(e), e), this._selectedStartDate = n, this._selectedEndDate = null, this._currentMonth = n.getMonth(), this._currentYear = n.getFullYear();
3271
+ if (s) {
3272
+ const [n, r] = this._splitRangeInput(t, e), a = n ? this._parseDateString(n, e) : null, o = r ? this._parseDateString(r, e) : null;
3273
+ if (a && o) {
3274
+ const [l, c] = a <= o ? [a, o] : [o, a], d = this._formatDate(l, e), u = this._formatDate(c, e), h = `${d} - ${u}`;
3275
+ this.setValue(h), this._applyDateToParts(l, this._startPartInputs, this._getFormatTokens(e), e), this._applyDateToParts(c, this._endPartInputs, this._getFormatTokens(e), e), this._selectedStartDate = l, this._selectedEndDate = c, this._currentMonth = l.getMonth(), this._currentYear = l.getFullYear();
3276
+ } else if (a) {
3277
+ const l = this._formatDate(a, e);
3278
+ this.setValue(l), this._applyDateToParts(a, this._startPartInputs, this._getFormatTokens(e), e), this._applyDateToParts(null, this._endPartInputs, this._getFormatTokens(e), e), this._selectedStartDate = a, this._selectedEndDate = null, this._currentMonth = a.getMonth(), this._currentYear = a.getFullYear();
3231
3279
  } else
3232
3280
  this.setValue(""), this._applyDateToParts(null, this._startPartInputs, this._getFormatTokens(e), e), this._applyDateToParts(null, this._endPartInputs, this._getFormatTokens(e), e), this._selectedStartDate = null, this._selectedEndDate = null;
3233
3281
  } else if (this._validateDateString(t, e)) {
3234
- const i = this._parseDateString(t, e);
3235
- if (i) {
3236
- const s = this._formatDate(i, e);
3237
- this.setValue(s), this._applyDateToParts(i, this._startPartInputs, this._getFormatTokens(e), e), this._selectedStartDate = i, this._selectedEndDate = null, this._currentMonth = i.getMonth(), this._currentYear = i.getFullYear();
3282
+ const n = this._parseDateString(t, e);
3283
+ if (n) {
3284
+ const r = this._formatDate(n, e);
3285
+ this.setValue(r), this._applyDateToParts(n, this._startPartInputs, this._getFormatTokens(e), e), this._selectedStartDate = n, this._selectedEndDate = null, this._currentMonth = n.getMonth(), this._currentYear = n.getFullYear();
3238
3286
  }
3239
3287
  } else
3240
3288
  this.setValue(""), this._applyDateToParts(null, this._startPartInputs, this._getFormatTokens(e), e), this._selectedStartDate = null, this._selectedEndDate = null;
@@ -3327,78 +3375,78 @@ class ut extends HTMLElement {
3327
3375
  }
3328
3376
  _buildCalendarView() {
3329
3377
  if (!this._calendarContainer) return;
3330
- const t = this._getDaysInMonth(this._currentMonth, this._currentYear), e = this._getFirstDayOfMonth(this._currentMonth, this._currentYear), i = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], s = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], n = this.getShortcuts(), r = n.length > 0;
3331
- this._calendarContainer.className = r ? "mint-date-calendar bg-white dark:bg-gray-800 rounded-lg p-4 w-[18rem] md:w-auto md:min-w-[28rem]" : "mint-date-calendar bg-white dark:bg-gray-800 rounded-lg p-4 w-[18rem] md:min-w-[18rem]";
3332
- const a = document.createElement("div");
3333
- a.className = "flex flex-col md:flex-row md:gap-6 md:items-start";
3334
- const o = document.createElement("div");
3335
- o.className = "flex-1 min-w-0";
3378
+ const t = this._getDaysInMonth(this._currentMonth, this._currentYear), e = this._getFirstDayOfMonth(this._currentMonth, this._currentYear), i = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], s = this.getWeekStartDay(), n = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], r = [...n.slice(s), ...n.slice(0, s)], a = this.getShortcuts(), o = a.length > 0;
3379
+ this._calendarContainer.className = o ? "mint-date-calendar bg-white dark:bg-gray-800 rounded-lg p-4 w-[18rem] md:w-auto md:min-w-[28rem]" : "mint-date-calendar bg-white dark:bg-gray-800 rounded-lg p-4 w-[18rem] md:min-w-[18rem]";
3336
3380
  const l = document.createElement("div");
3337
- l.className = "flex items-center justify-between mb-4";
3338
- const c = document.createElement("button");
3339
- 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");
3340
- const d = document.createElement("mint-icon");
3341
- d.setAttribute("name", "caret-left"), d.className = "w-4 h-4", c.appendChild(d), c.addEventListener("click", () => {
3381
+ l.className = "flex flex-col md:flex-row md:gap-6 md:items-start";
3382
+ const c = document.createElement("div");
3383
+ c.className = "flex-1 min-w-0";
3384
+ const d = document.createElement("div");
3385
+ d.className = "flex items-center justify-between mb-4";
3386
+ const u = document.createElement("button");
3387
+ 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");
3388
+ const h = document.createElement("mint-icon");
3389
+ h.setAttribute("name", "caret-left"), h.className = "w-4 h-4", u.appendChild(h), u.addEventListener("click", () => {
3342
3390
  this._currentMonth === 0 ? (this._currentMonth = 11, this._currentYear--) : this._currentMonth--, this._buildCalendar();
3343
- }), l.appendChild(c);
3344
- const u = document.createElement("div");
3345
- u.className = "flex items-center gap-2";
3346
- const h = document.createElement("button");
3347
- h.type = "button", h.tabIndex = 0, h.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", h.setAttribute("data-keep-popover-open", "true"), h.textContent = i[this._currentMonth], h.addEventListener("click", () => {
3391
+ }), d.appendChild(u);
3392
+ const f = document.createElement("div");
3393
+ f.className = "flex items-center gap-2";
3394
+ const p = document.createElement("button");
3395
+ p.type = "button", p.tabIndex = 0, p.className = "text-sm font-medium text-gray-900 dark:text-gray-100 hover:text-gray-600 dark:hover:text-gray-300 transition-colors flex items-center focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-gray-400 dark:focus-visible:ring-gray-500", p.setAttribute("data-keep-popover-open", "true"), p.textContent = i[this._currentMonth], p.addEventListener("click", () => {
3348
3396
  this._viewMode = "month", this._buildCalendar();
3349
- }), u.appendChild(h);
3350
- const f = document.createElement("button");
3351
- 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", () => {
3397
+ }), f.appendChild(p);
3398
+ const m = document.createElement("button");
3399
+ 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", () => {
3352
3400
  this._viewMode = "year", this._buildCalendar();
3353
- }), u.appendChild(f), l.appendChild(u);
3354
- const p = document.createElement("button");
3355
- 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");
3356
- const m = document.createElement("mint-icon");
3357
- m.setAttribute("name", "caret-right"), m.className = "w-4 h-4", p.appendChild(m), p.addEventListener("click", () => {
3401
+ }), f.appendChild(m), d.appendChild(f);
3402
+ const _ = document.createElement("button");
3403
+ _.type = "button", _.tabIndex = 0, _.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", _.setAttribute("data-keep-popover-open", "true");
3404
+ const g = document.createElement("mint-icon");
3405
+ g.setAttribute("name", "caret-right"), g.className = "w-4 h-4", _.appendChild(g), _.addEventListener("click", () => {
3358
3406
  this._currentMonth === 11 ? (this._currentMonth = 0, this._currentYear++) : this._currentMonth++, this._buildCalendar();
3359
- }), l.appendChild(p);
3360
- const _ = document.createElement("div");
3361
- _.className = "grid grid-cols-7 mb-2", s.forEach((w) => {
3362
- const T = document.createElement("div");
3363
- T.className = "text-xs font-medium text-gray-500 dark:text-gray-400 text-center py-1", T.textContent = w, _.appendChild(T);
3407
+ }), d.appendChild(_);
3408
+ const v = document.createElement("div");
3409
+ v.className = "grid grid-cols-7 mb-2", r.forEach((w) => {
3410
+ const I = document.createElement("div");
3411
+ I.className = "text-xs font-medium text-gray-500 dark:text-gray-400 text-center py-1", I.textContent = w, v.appendChild(I);
3364
3412
  });
3365
- const g = document.createElement("div");
3366
- g.className = "grid grid-cols-7";
3367
- const b = this.getMin() ? this._parseDateString(this.getMin(), this.getFormat()) : null, v = this.getMax() ? this._parseDateString(this.getMax(), this.getFormat()) : null, x = this._currentMonth === 0 ? 11 : this._currentMonth - 1, S = this._currentMonth === 0 ? this._currentYear - 1 : this._currentYear, k = this._getDaysInMonth(x, S), y = this._currentMonth === 11 ? 0 : this._currentMonth + 1, E = this._currentMonth === 11 ? this._currentYear + 1 : this._currentYear, I = e + t, F = Math.ceil(I / 7) * 7 - I, D = (w, T, A) => {
3368
- const R = this._isToday(w), $ = this._isDateSelected(w), q = this._isDateInRange(w), P = b && w < b || v && w > v;
3369
- let N = "rounded-md";
3413
+ const b = document.createElement("div");
3414
+ b.className = "grid grid-cols-7";
3415
+ const k = this.getMin() ? this._parseDateString(this.getMin(), this.getFormat()) : null, A = this.getMax() ? this._parseDateString(this.getMax(), this.getFormat()) : null, E = this._currentMonth === 0 ? 11 : this._currentMonth - 1, y = this._currentMonth === 0 ? this._currentYear - 1 : this._currentYear, x = this._getDaysInMonth(E, y), T = this._currentMonth === 11 ? 0 : this._currentMonth + 1, R = this._currentMonth === 11 ? this._currentYear + 1 : this._currentYear, P = e + t, J = Math.ceil(P / 7) * 7 - P, j = (w, I, S) => {
3416
+ const W = this._isToday(w), $ = this._isDateSelected(w), q = this._isDateInRange(w), F = k && w < k || A && w > A;
3417
+ let M = "rounded-md";
3370
3418
  if (this._isRange && this._selectedStartDate && this._selectedEndDate) {
3371
- const H = this._isSameDate(w, this._selectedStartDate), L = this._isSameDate(w, this._selectedEndDate);
3372
- H && L ? N = "rounded-md" : H ? N = "rounded-l-md" : L ? N = "rounded-r-md" : q && (N = "rounded-none");
3373
- } else $ && !this._isRange && (N = "rounded-md");
3374
- const M = document.createElement("button");
3375
- M.type = "button", M.disabled = !!P, M.tabIndex = P ? -1 : 0;
3376
- let B = `w-full h-8 ${N} 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`;
3377
- return A ? B += $ ? " bg-slate-800 dark:bg-slate-600 text-white" : q ? " bg-slate-100 dark:bg-slate-700 text-slate-800 dark:text-slate-200" : R ? " 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" : B += $ ? " bg-slate-800 dark:bg-slate-600 text-white" : q ? " bg-slate-100 dark:bg-slate-700 text-slate-800 dark:text-slate-200" : " text-gray-400 dark:text-gray-500 hover:bg-gray-100 dark:hover:bg-gray-700", B += P ? " opacity-40 cursor-not-allowed" : "", M.className = B, M.textContent = T.toString(), P || M.addEventListener("click", () => {
3419
+ const D = this._isSameDate(w, this._selectedStartDate), L = this._isSameDate(w, this._selectedEndDate);
3420
+ D && L ? M = "rounded-md" : D ? M = "rounded-l-md" : L ? M = "rounded-r-md" : q && (M = "rounded-none");
3421
+ } else $ && !this._isRange && (M = "rounded-md");
3422
+ const N = document.createElement("button");
3423
+ N.type = "button", N.disabled = !!F, N.tabIndex = F ? -1 : 0;
3424
+ let B = `w-full h-8 ${M} 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`;
3425
+ return S ? B += $ ? " bg-slate-800 dark:bg-slate-600 text-white" : q ? " bg-slate-100 dark:bg-slate-700 text-slate-800 dark:text-slate-200" : W ? " 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" : B += $ ? " bg-slate-800 dark:bg-slate-600 text-white" : q ? " bg-slate-100 dark:bg-slate-700 text-slate-800 dark:text-slate-200" : " text-gray-400 dark:text-gray-500 hover:bg-gray-100 dark:hover:bg-gray-700", B += F ? " opacity-40 cursor-not-allowed" : "", N.className = B, N.textContent = I.toString(), F || N.addEventListener("click", () => {
3378
3426
  this._handleDateClick(w);
3379
- }), M;
3427
+ }), N;
3380
3428
  };
3381
3429
  for (let w = e - 1; w >= 0; w--) {
3382
- const T = k - w, A = new Date(S, x, T), R = D(A, T, !1);
3383
- g.appendChild(R);
3430
+ const I = x - w, S = new Date(y, E, I), W = j(S, I, !1);
3431
+ b.appendChild(W);
3384
3432
  }
3385
3433
  for (let w = 1; w <= t; w++) {
3386
- const T = new Date(this._currentYear, this._currentMonth, w), A = D(T, w, !0);
3387
- g.appendChild(A);
3434
+ const I = new Date(this._currentYear, this._currentMonth, w), S = j(I, w, !0);
3435
+ b.appendChild(S);
3388
3436
  }
3389
- for (let w = 1; w <= F; w++) {
3390
- const T = new Date(E, y, w), A = D(T, w, !1);
3391
- g.appendChild(A);
3437
+ for (let w = 1; w <= J; w++) {
3438
+ const I = new Date(R, T, w), S = j(I, w, !1);
3439
+ b.appendChild(S);
3392
3440
  }
3393
- if (r) {
3441
+ if (o) {
3394
3442
  const w = document.createElement("div");
3395
3443
  w.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";
3396
- const T = document.createElement("div");
3397
- T.className = "relative md:relative md:flex-1 md:min-h-0";
3398
- const A = document.createElement("div");
3399
- A.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", A.style.scrollbarWidth = "none", A.style.msOverflowStyle = "none", A.style.setProperty("-webkit-overflow-scrolling", "touch");
3400
- const R = document.createElement("style");
3401
- R.textContent = `
3444
+ const I = document.createElement("div");
3445
+ I.className = "relative md:relative md:flex-1 md:min-h-0";
3446
+ const S = document.createElement("div");
3447
+ S.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", S.style.scrollbarWidth = "none", S.style.msOverflowStyle = "none", S.style.setProperty("-webkit-overflow-scrolling", "touch");
3448
+ const W = document.createElement("style");
3449
+ W.textContent = `
3402
3450
  .mint-date-shortcuts-row::-webkit-scrollbar {
3403
3451
  display: none;
3404
3452
  }
@@ -3422,37 +3470,37 @@ class ut extends HTMLElement {
3422
3470
  background: rgba(255, 255, 255, 0.2);
3423
3471
  }
3424
3472
  }
3425
- `, A.classList.add("mint-date-shortcuts-row"), document.head.querySelector("style[data-mint-date-shortcuts]") || (R.setAttribute("data-mint-date-shortcuts", "true"), document.head.appendChild(R));
3473
+ `, S.classList.add("mint-date-shortcuts-row"), document.head.querySelector("style[data-mint-date-shortcuts]") || (W.setAttribute("data-mint-date-shortcuts", "true"), document.head.appendChild(W));
3426
3474
  const $ = document.createElement("div");
3427
- $.className = "absolute left-0 top-0 bottom-0 w-8 pointer-events-none z-10 bg-gradient-to-r from-white dark:from-gray-800 to-transparent opacity-0 transition-opacity duration-200 md:hidden", T.appendChild($);
3475
+ $.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", I.appendChild($);
3428
3476
  const q = document.createElement("div");
3429
- q.className = "absolute right-0 top-0 bottom-0 w-8 pointer-events-none z-10 bg-gradient-to-l from-white dark:from-gray-800 to-transparent opacity-100 transition-opacity duration-200 md:hidden", T.appendChild(q);
3430
- const P = document.createElement("div");
3431
- P.className = "hidden md:block absolute top-0 left-0 right-0 h-8 pointer-events-none z-10 bg-gradient-to-b from-white dark:from-gray-800 to-transparent opacity-0 transition-opacity duration-200", T.appendChild(P);
3432
- const N = document.createElement("div");
3433
- N.className = "hidden md:block absolute bottom-0 left-0 right-0 h-8 pointer-events-none z-10 bg-gradient-to-t from-white dark:from-gray-800 to-transparent opacity-100 transition-opacity duration-200", T.appendChild(N);
3434
- const M = () => {
3477
+ q.className = "absolute right-0 top-0 bottom-0 w-8 pointer-events-none z-10 bg-gradient-to-l from-white dark:from-gray-800 to-transparent opacity-100 transition-opacity duration-200 md:hidden", I.appendChild(q);
3478
+ const F = document.createElement("div");
3479
+ F.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", I.appendChild(F);
3480
+ const M = document.createElement("div");
3481
+ M.className = "hidden md:block absolute bottom-0 left-0 right-0 h-8 pointer-events-none z-10 bg-gradient-to-t from-white dark:from-gray-800 to-transparent opacity-100 transition-opacity duration-200", I.appendChild(M);
3482
+ const N = () => {
3435
3483
  if (window.innerWidth >= 768) {
3436
- const H = A.scrollTop, L = A.scrollHeight, z = A.clientHeight;
3437
- H > 0 ? P.style.opacity = "1" : P.style.opacity = "0", H + z < L - 1 ? N.style.opacity = "1" : N.style.opacity = "0", $.style.opacity = "0", q.style.opacity = "0";
3484
+ const D = S.scrollTop, L = S.scrollHeight, z = S.clientHeight;
3485
+ D > 0 ? F.style.opacity = "1" : F.style.opacity = "0", D + z < L - 1 ? M.style.opacity = "1" : M.style.opacity = "0", $.style.opacity = "0", q.style.opacity = "0";
3438
3486
  } else {
3439
- const H = A.scrollLeft, L = A.scrollWidth, z = A.clientWidth;
3440
- H > 0 ? $.style.opacity = "1" : $.style.opacity = "0", H + z < L - 1 ? q.style.opacity = "1" : q.style.opacity = "0", P.style.opacity = "0", N.style.opacity = "0";
3487
+ const D = S.scrollLeft, L = S.scrollWidth, z = S.clientWidth;
3488
+ D > 0 ? $.style.opacity = "1" : $.style.opacity = "0", D + z < L - 1 ? q.style.opacity = "1" : q.style.opacity = "0", F.style.opacity = "0", M.style.opacity = "0";
3441
3489
  }
3442
3490
  };
3443
- A.addEventListener("scroll", M), window.addEventListener("resize", M), setTimeout(M, 0), n.forEach((B) => {
3444
- const H = document.createElement("button");
3445
- 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 = B.label, H.setAttribute("data-keep-popover-open", "true"), H.addEventListener("click", () => {
3491
+ S.addEventListener("scroll", N), window.addEventListener("resize", N), setTimeout(N, 0), a.forEach((B) => {
3492
+ const D = document.createElement("button");
3493
+ D.type = "button", D.tabIndex = 0, D.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", D.textContent = B.label, D.setAttribute("data-keep-popover-open", "true"), D.addEventListener("click", () => {
3446
3494
  const L = B.action();
3447
3495
  if (L) {
3448
3496
  if (this._isRange && "start" in L && "end" in L) {
3449
3497
  this._selectedStartDate = L.start, this._selectedEndDate = L.end;
3450
- const z = this.getFormat(), j = this._formatDate(L.start, z), U = this._formatDate(L.end, z), J = `${j} - ${U}`;
3451
- this.setValue(J), this._currentMonth = L.start.getMonth(), this._currentYear = L.start.getFullYear();
3498
+ const z = this.getFormat(), Y = this._formatDate(L.start, z), G = this._formatDate(L.end, z), K = `${Y} - ${G}`;
3499
+ this.setValue(K), this._currentMonth = L.start.getMonth(), this._currentYear = L.start.getFullYear();
3452
3500
  } else if (L instanceof Date) {
3453
3501
  this._selectedStartDate = L, this._selectedEndDate = null;
3454
- const z = this.getFormat(), j = this._formatDate(L, z);
3455
- this.setValue(j), this._currentMonth = L.getMonth(), this._currentYear = L.getFullYear();
3502
+ const z = this.getFormat(), Y = this._formatDate(L, z);
3503
+ this.setValue(Y), this._currentMonth = L.getMonth(), this._currentYear = L.getFullYear();
3456
3504
  }
3457
3505
  this._buildCalendar(), this._popover && typeof this._popover.close == "function" && this._popover.close(), this.dispatchEvent(new CustomEvent("input", {
3458
3506
  detail: { value: this.getValue() },
@@ -3464,10 +3512,10 @@ class ut extends HTMLElement {
3464
3512
  cancelable: !0
3465
3513
  }));
3466
3514
  }
3467
- }), A.appendChild(H);
3468
- }), T.appendChild(A), w.appendChild(T), a.appendChild(w);
3515
+ }), S.appendChild(D);
3516
+ }), I.appendChild(S), w.appendChild(I), l.appendChild(w);
3469
3517
  }
3470
- o.appendChild(l), o.appendChild(_), o.appendChild(g), a.appendChild(o), this._calendarContainer.appendChild(a);
3518
+ c.appendChild(d), c.appendChild(v), c.appendChild(b), l.appendChild(c), this._calendarContainer.appendChild(l);
3471
3519
  }
3472
3520
  _buildMonthView() {
3473
3521
  if (!this._calendarContainer) return;
@@ -3533,17 +3581,20 @@ class ut extends HTMLElement {
3533
3581
  return new Date(e, t + 1, 0).getDate();
3534
3582
  }
3535
3583
  _getFirstDayOfMonth(t, e) {
3536
- return new Date(e, t, 1).getDay();
3584
+ const i = this.getWeekStartDay(), s = new Date(e, t, 1).getDay();
3585
+ return s >= i ? s - i : 7 - (i - s);
3537
3586
  }
3538
3587
  _isToday(t) {
3539
3588
  const e = /* @__PURE__ */ new Date();
3540
3589
  return t.getDate() === e.getDate() && t.getMonth() === e.getMonth() && t.getFullYear() === e.getFullYear();
3541
3590
  }
3542
3591
  _isDateSelected(t) {
3543
- return this._isRange ? this._selectedStartDate !== null && this._isSameDate(t, this._selectedStartDate) || this._selectedEndDate !== null && this._isSameDate(t, this._selectedEndDate) : this._selectedStartDate !== null && this._isSameDate(t, this._selectedStartDate);
3592
+ const e = this.getSelectionMode();
3593
+ return this._isRange || e === "week" || e === "month" ? this._selectedStartDate && this._selectedEndDate ? this._isSameDate(t, this._selectedStartDate) || this._isSameDate(t, this._selectedEndDate) : !1 : this._selectedStartDate !== null && this._isSameDate(t, this._selectedStartDate);
3544
3594
  }
3545
3595
  _isDateInRange(t) {
3546
- return !this._isRange || !this._selectedStartDate || !this._selectedEndDate ? !1 : t >= this._selectedStartDate && t <= this._selectedEndDate;
3596
+ const e = this.getSelectionMode();
3597
+ return (this._isRange || e === "week" || e === "month") && this._selectedStartDate && this._selectedEndDate ? t >= this._selectedStartDate && t <= this._selectedEndDate : !1;
3547
3598
  }
3548
3599
  _hasIncompleteRange() {
3549
3600
  return this._isRange && this._selectedStartDate !== null && this._selectedEndDate === null;
@@ -3551,20 +3602,36 @@ class ut extends HTMLElement {
3551
3602
  _isSameDate(t, e) {
3552
3603
  return t.getDate() === e.getDate() && t.getMonth() === e.getMonth() && t.getFullYear() === e.getFullYear();
3553
3604
  }
3605
+ _getWeekStart(t) {
3606
+ const e = this.getWeekStartDay(), i = t.getDay();
3607
+ let s;
3608
+ i >= e ? s = i - e : s = 7 - (e - i);
3609
+ const n = new Date(t);
3610
+ return n.setDate(t.getDate() - s), n.setHours(0, 0, 0, 0), n;
3611
+ }
3612
+ _getWeekEnd(t) {
3613
+ const e = this._getWeekStart(t), i = new Date(e);
3614
+ return i.setDate(e.getDate() + 6), i.setHours(23, 59, 59, 999), i;
3615
+ }
3616
+ _getMonthStart(t) {
3617
+ const e = new Date(t.getFullYear(), t.getMonth(), 1);
3618
+ return e.setHours(0, 0, 0, 0), e;
3619
+ }
3620
+ _getMonthEnd(t) {
3621
+ const e = new Date(t.getFullYear(), t.getMonth() + 1, 0);
3622
+ return e.setHours(23, 59, 59, 999), e;
3623
+ }
3554
3624
  _handleDateClick(t) {
3555
- const e = this.getFormat();
3556
- if (this._isRange) {
3557
- if (!this._selectedStartDate || this._selectedStartDate && this._selectedEndDate ? (this._selectedStartDate = t, this._selectedEndDate = null) : this._selectedStartDate && !this._selectedEndDate && (t < this._selectedStartDate ? (this._selectedEndDate = this._selectedStartDate, this._selectedStartDate = t) : this._selectedEndDate = t), this._selectedStartDate && this._selectedEndDate) {
3558
- const i = this._formatDate(this._selectedStartDate, e), s = this._formatDate(this._selectedEndDate, e), n = `${i} - ${s}`;
3559
- this.setValue(n), this._textInput && (this._textInput.value = n), this._popover && typeof this._popover.close == "function" && this._popover.close();
3560
- } else if (this._selectedStartDate) {
3561
- const i = this._formatDate(this._selectedStartDate, e);
3562
- this.setValue(i), this._textInput && (this._textInput.value = i);
3563
- }
3625
+ const e = this.getFormat(), i = this.getSelectionMode();
3626
+ let s, n;
3627
+ if (i === "week" ? (s = this._getWeekStart(t), n = this._getWeekEnd(t)) : i === "month" ? (s = this._getMonthStart(t), n = this._getMonthEnd(t)) : (s = t, n = t), this.isRange() || i === "week" || i === "month") {
3628
+ this._selectedStartDate = s, this._selectedEndDate = n;
3629
+ const a = this._formatDate(this._selectedStartDate, e), o = this._formatDate(this._selectedEndDate, e), l = `${a} - ${o}`;
3630
+ this.setValue(l), this._textInput && (this._textInput.value = l), this._popover && typeof this._popover.close == "function" && this._popover.close();
3564
3631
  } else {
3565
- this._selectedStartDate = t;
3566
- const i = this._formatDate(t, e);
3567
- this.setValue(i), this._textInput && (this._textInput.value = i), this._popover && typeof this._popover.close == "function" && this._popover.close();
3632
+ this._selectedStartDate = s, this._selectedEndDate = null;
3633
+ const a = this._formatDate(s, e);
3634
+ this.setValue(a), this._textInput && (this._textInput.value = a), this._popover && typeof this._popover.close == "function" && this._popover.close();
3568
3635
  }
3569
3636
  this._buildCalendar(), this._updateDisplayText(), this._exitInputMode(), this.dispatchEvent(new CustomEvent("input", {
3570
3637
  detail: { value: this.getValue() },
@@ -3579,9 +3646,9 @@ class ut extends HTMLElement {
3579
3646
  // Display mode helpers
3580
3647
  _updateDisplayText() {
3581
3648
  if (!this._displayEl) return;
3582
- const t = this.getDisplayFormat();
3583
- let e = "";
3584
- this._isRange ? this._selectedStartDate && this._selectedEndDate ? e = `${this._formatDatePhp(this._selectedStartDate, t)} - ${this._formatDatePhp(this._selectedEndDate, t)}` : this._selectedStartDate && (e = this._formatDatePhp(this._selectedStartDate, t)) : this._selectedStartDate && (e = this._formatDatePhp(this._selectedStartDate, t)), e ? (this._displayEl.textContent = e, this._displayEl.classList.remove("text-gray-400", "dark:text-gray-500"), this._displayEl.classList.add("text-gray-900", "dark:text-white")) : (this._displayEl.textContent = "Select date", this._displayEl.classList.add("text-gray-400", "dark:text-gray-500"), this._displayEl.classList.remove("text-gray-900", "dark:text-white")), this._displayEl && this._inputsWrapperEl && (this._displayEl.style.display = this._isInputMode ? "none" : "flex", this._inputsWrapperEl.style.display = this._isInputMode ? "flex" : "none");
3649
+ const t = this.getDisplayFormat(), e = this.getSelectionMode(), i = this._isRange || e === "week" || e === "month";
3650
+ let s = "";
3651
+ i ? this._selectedStartDate && this._selectedEndDate ? s = `${this._formatDatePhp(this._selectedStartDate, t)} - ${this._formatDatePhp(this._selectedEndDate, t)}` : this._selectedStartDate && (s = this._formatDatePhp(this._selectedStartDate, t)) : this._selectedStartDate && (s = this._formatDatePhp(this._selectedStartDate, t)), s ? (this._displayEl.textContent = s, this._displayEl.classList.remove("text-gray-400", "dark:text-gray-500"), this._displayEl.classList.add("text-gray-900", "dark:text-white")) : (this._displayEl.textContent = "Select date", this._displayEl.classList.add("text-gray-400", "dark:text-gray-500"), this._displayEl.classList.remove("text-gray-900", "dark:text-white")), this._displayEl && this._inputsWrapperEl && (this._displayEl.style.display = this._isInputMode ? "none" : "flex", this._inputsWrapperEl.style.display = this._isInputMode ? "flex" : "none");
3585
3652
  }
3586
3653
  _enterInputMode() {
3587
3654
  if (!this._isInputMode && !(this.isReadonly() || this.isDisabled()) && (this._isInputMode = !0, this._displayEl && this._inputsWrapperEl && (this._displayEl.style.display = "none", this._inputsWrapperEl.style.display = "flex"), this._startPartInputs.length > 0)) {
@@ -3660,8 +3727,8 @@ class ut extends HTMLElement {
3660
3727
  this._focusTrapHandler && (document.removeEventListener("keydown", this._focusTrapHandler, !0), this._focusTrapHandler = null), this._escapeHandler && (document.removeEventListener("keydown", this._escapeHandler, !0), this._escapeHandler = null);
3661
3728
  }
3662
3729
  }
3663
- customElements.get("mint-date-picker") || customElements.define("mint-date-picker", ut);
3664
- class pt extends HTMLElement {
3730
+ customElements.get("mint-date-picker") || customElements.define("mint-date-picker", ft);
3731
+ class mt extends HTMLElement {
3665
3732
  constructor() {
3666
3733
  super(), this._select = null, this._wrapper = null, this._caretUpIcon = null, this._caretDownIcon = null, this._changeHandler = null;
3667
3734
  }
@@ -3788,7 +3855,12 @@ class pt extends HTMLElement {
3788
3855
  }
3789
3856
  if (this._select.value = o || "", this._changeHandler && this._select && this._select.removeEventListener("change", this._changeHandler), this._changeHandler = (h) => {
3790
3857
  const p = h.target.value;
3791
- p ? this.setAttribute("value", p) : this.removeAttribute("value"), this.dispatchEvent(new CustomEvent("change", {
3858
+ p ? this.setAttribute("value", p) : this.removeAttribute("value"), this.dispatchEvent(new CustomEvent("input", {
3859
+ detail: { value: p },
3860
+ bubbles: !0,
3861
+ cancelable: !0,
3862
+ composed: !0
3863
+ })), this.dispatchEvent(new CustomEvent("change", {
3792
3864
  detail: { value: p },
3793
3865
  bubbles: !0,
3794
3866
  cancelable: !0,
@@ -3827,8 +3899,8 @@ class pt extends HTMLElement {
3827
3899
  t && e ? (i || (i = document.createElement("div"), i.className = "mint-select-error mt-1 text-xs text-red-600 dark:text-red-400", this.appendChild(i)), i.textContent = e) : i && i.remove();
3828
3900
  }
3829
3901
  }
3830
- customElements.get("mint-select") || customElements.define("mint-select", pt);
3831
- class ft extends HTMLElement {
3902
+ customElements.get("mint-select") || customElements.define("mint-select", mt);
3903
+ class gt extends HTMLElement {
3832
3904
  constructor() {
3833
3905
  super(), this._dropzone = null, this._fileInput = null, this._previewContainer = null, this._isDragging = !1, this._wasDragging = !1, this._isUpdatingFiles = !1, this._listenersInitialized = !1, this._selectedFiles = [], this._previewUrls = [], this._resetHandler = null;
3834
3906
  }
@@ -4152,8 +4224,8 @@ class ft extends HTMLElement {
4152
4224
  );
4153
4225
  }
4154
4226
  }
4155
- customElements.get("mint-dropzone") || customElements.define("mint-dropzone", ft);
4156
- class mt extends HTMLElement {
4227
+ customElements.get("mint-dropzone") || customElements.define("mint-dropzone", gt);
4228
+ class _t extends HTMLElement {
4157
4229
  constructor() {
4158
4230
  super(), this._form = null, this._submitHandler = null, this._hostSubmitHandler = null, this._errors = {}, this._fieldBlurHandlers = /* @__PURE__ */ new Map(), this._fieldChangeHandlers = /* @__PURE__ */ new Map(), this._observer = null, this._formData = null, this._headers = null, this._buttonStates = /* @__PURE__ */ new Map(), this._reactiveDataProxy = null, this._reactiveDataObserver = null, this._lastDataSnapshot = null;
4159
4231
  }
@@ -4351,28 +4423,28 @@ class mt extends HTMLElement {
4351
4423
  m.open(s || "POST", l, !0), Object.entries(o).forEach(([_, g]) => m.setRequestHeader(_, g)), m.onload = async function() {
4352
4424
  const { status: _, responseText: g } = m;
4353
4425
  if (_ >= 200 && _ < 300) {
4354
- let b = g;
4426
+ let v = g;
4355
4427
  try {
4356
- b = JSON.parse(g);
4428
+ v = JSON.parse(g);
4357
4429
  } catch {
4358
4430
  }
4359
4431
  try {
4360
- const v = { status: _, ok: !0, data: b }, x = await c._applySuccessInterceptors(v);
4361
- f(x);
4362
- } catch (v) {
4363
- p(v);
4432
+ const b = { status: _, ok: !0, data: v }, k = await c._applySuccessInterceptors(b);
4433
+ f(k);
4434
+ } catch (b) {
4435
+ p(b);
4364
4436
  }
4365
4437
  } else {
4366
- let b = g;
4438
+ let v = g;
4367
4439
  try {
4368
- b = JSON.parse(g);
4440
+ v = JSON.parse(g);
4369
4441
  } catch {
4370
4442
  }
4371
4443
  try {
4372
- const v = { status: _, data: b, response: { status: _, data: b } }, x = await c._applyErrorInterceptors(v);
4373
- p(x);
4374
- } catch (v) {
4375
- p(v);
4444
+ const b = { status: _, data: v, response: { status: _, data: v } }, k = await c._applyErrorInterceptors(b);
4445
+ p(k);
4446
+ } catch (b) {
4447
+ p(b);
4376
4448
  }
4377
4449
  }
4378
4450
  }, m.onerror = async function() {
@@ -5023,7 +5095,7 @@ class mt extends HTMLElement {
5023
5095
  this._reactiveDataObserver !== null && (cancelAnimationFrame(this._reactiveDataObserver), this._reactiveDataObserver = null), this._reactiveDataProxy = null, this._lastDataSnapshot = null;
5024
5096
  }
5025
5097
  }
5026
- customElements.get("mint-form") || customElements.define("mint-form", mt);
5098
+ customElements.get("mint-form") || customElements.define("mint-form", _t);
5027
5099
  typeof window < "u" && (window.mintForm = window.mintForm || {
5028
5100
  defaults: {
5029
5101
  headers: {
@@ -5041,7 +5113,7 @@ typeof window < "u" && (window.mintForm = window.mintForm || {
5041
5113
  rejected: t
5042
5114
  }), window.mintForm.interceptors.response.handlers.length - 1;
5043
5115
  }));
5044
- class gt extends HTMLElement {
5116
+ class bt extends HTMLElement {
5045
5117
  constructor() {
5046
5118
  super(...arguments), this._observer = null;
5047
5119
  }
@@ -5252,8 +5324,8 @@ class gt extends HTMLElement {
5252
5324
  `, document.head.appendChild(t);
5253
5325
  }
5254
5326
  }
5255
- customElements.get("mint-table") || customElements.define("mint-table", gt);
5256
- class _t extends HTMLElement {
5327
+ customElements.get("mint-table") || customElements.define("mint-table", bt);
5328
+ class vt extends HTMLElement {
5257
5329
  constructor() {
5258
5330
  super(...arguments), this._root = null, this._textWrap = null, this._dismissBtn = null, this._clickHandler = null;
5259
5331
  }
@@ -5328,8 +5400,8 @@ class _t extends HTMLElement {
5328
5400
  }, t.addEventListener("click", this._clickHandler), this._dismissBtn = t;
5329
5401
  }
5330
5402
  }
5331
- customElements.get("mint-chip") || customElements.define("mint-chip", _t);
5332
- class bt extends HTMLElement {
5403
+ customElements.get("mint-chip") || customElements.define("mint-chip", vt);
5404
+ class yt extends HTMLElement {
5333
5405
  constructor() {
5334
5406
  super(...arguments), this._container = null, this._chipsWrap = null, this._input = null, this._tags = [], this._placeholder = "Add tag", this._dragIndex = null, this._dragChip = null, this._isPointerDragging = !1, this._pointerMoveHandler = null, this._pointerUpHandler = null;
5335
5407
  }
@@ -5652,8 +5724,8 @@ class bt extends HTMLElement {
5652
5724
  }
5653
5725
  }
5654
5726
  }
5655
- customElements.get("mint-tags") || customElements.define("mint-tags", bt);
5656
- class vt extends HTMLElement {
5727
+ customElements.get("mint-tags") || customElements.define("mint-tags", yt);
5728
+ class kt extends HTMLElement {
5657
5729
  constructor() {
5658
5730
  super(...arguments), this._clickHandler = null, this._keydownHandler = null;
5659
5731
  }
@@ -5709,8 +5781,8 @@ class vt extends HTMLElement {
5709
5781
  t === "disabled" && (i !== null ? (this.classList.remove("cursor-pointer"), this.classList.add("opacity-50", "cursor-not-allowed"), this.setAttribute("aria-disabled", "true")) : (this.classList.remove("opacity-50", "cursor-not-allowed"), this.classList.add("cursor-pointer"), this.removeAttribute("aria-disabled")));
5710
5782
  }
5711
5783
  }
5712
- customElements.get("mint-clickable") || customElements.define("mint-clickable", vt);
5713
- class yt extends HTMLElement {
5784
+ customElements.get("mint-clickable") || customElements.define("mint-clickable", kt);
5785
+ class Et extends HTMLElement {
5714
5786
  constructor() {
5715
5787
  super(), this._headingElement = null, this._iconElement = null, this._dismissButton = null, this._headerWrapper = null, this._bodyWrapper = null, this._dismissHandler = null;
5716
5788
  }
@@ -5825,8 +5897,8 @@ class yt extends HTMLElement {
5825
5897
  }), this.appendChild(this._headerWrapper), this.appendChild(this._bodyWrapper);
5826
5898
  }
5827
5899
  }
5828
- customElements.get("mint-alert") || customElements.define("mint-alert", yt);
5829
- class kt extends HTMLElement {
5900
+ customElements.get("mint-alert") || customElements.define("mint-alert", Et);
5901
+ class xt extends HTMLElement {
5830
5902
  constructor() {
5831
5903
  super(), this._configuration = null, this._rows = [], this._search = "", this._currentPage = 1, this._perPage = 15, this._totalRows = 0, this._lastPage = 0, this._offset = 0, this._rowsToShow = 15, this._loaded = !1, this._fetching = !1, this._loading = !1, this._fetchError = null, this._searching = !1, this._sorting = !1, this._sortingColumn = null, this._type = "provided", this._searchTimeoutId = null, this._sortTimeoutId = null, this._searchColumns = [], this._exportColumns = {}, this._columns = [], this._tableId = "", this._searchInput = null, this._tableContainer = null, this._paginationContainer = null, this._skeletonContainer = null, this._inMintCard = !1;
5832
5904
  }
@@ -5930,20 +6002,20 @@ class kt extends HTMLElement {
5930
6002
  const g = await fetch(`${n}?${m.toString()}`, _);
5931
6003
  if (!g.ok)
5932
6004
  throw new Error(`HTTP error! status: ${g.status}`);
5933
- const b = await g.json(), v = ((o = b.content) == null ? void 0 : o.rows) || [], x = ((l = b.content) == null ? void 0 : l.total) || 0;
6005
+ const v = await g.json(), b = ((o = v.content) == null ? void 0 : o.rows) || [], k = ((l = v.content) == null ? void 0 : l.total) || 0;
5934
6006
  if (this._configuration.loadMore && a !== 0)
5935
- this._rows = this._rows.concat(v);
6007
+ this._rows = this._rows.concat(b);
5936
6008
  else {
5937
- let E = v;
5938
- this._configuration.predefinedData ? (E = [...this._configuration.predefinedData, ...v], this._totalRows = x + this._configuration.predefinedData.length) : this._totalRows = x, this._rows = E;
6009
+ let x = b;
6010
+ this._configuration.predefinedData ? (x = [...this._configuration.predefinedData, ...b], this._totalRows = k + this._configuration.predefinedData.length) : this._totalRows = k, this._rows = x;
5939
6011
  }
5940
- const S = Math.floor(a / r) + 1;
5941
- this._configuration.loadMore || (((c = b.content) == null ? void 0 : c.current_page) !== void 0 && b.content.current_page === S ? this._currentPage = b.content.current_page : this._currentPage = S, this._offset = (this._currentPage - 1) * r), this._lastPage = ((d = b.content) == null ? void 0 : d.last_page) || 1, this._fetching = !1, this._loaded = !0, this._loading = !1, this._fetchError = null, this._searching = !1;
5942
- const k = this._sorting;
5943
- if (k && this._updateSortIcons(), this._sorting = !1, this._sortingColumn = null, k && this._updateSortIcons(), this.dispatchEvent(new CustomEvent("loaded", { detail: { rows: this._rows } })), this._updateSearchIcon(), (h = (u = this.querySelector(`#${this._tableId}`)) == null ? void 0 : u.closest("table")) == null ? void 0 : h.querySelector("tbody")) {
5944
- if (k) {
5945
- const E = this._loading, I = this._fetching;
5946
- this._loading = !1, this._fetching = !1, this._updateTableBody(), this._loading = E, this._fetching = I;
6012
+ const A = Math.floor(a / r) + 1;
6013
+ this._configuration.loadMore || (((c = v.content) == null ? void 0 : c.current_page) !== void 0 && v.content.current_page === A ? this._currentPage = v.content.current_page : this._currentPage = A, this._offset = (this._currentPage - 1) * r), this._lastPage = ((d = v.content) == null ? void 0 : d.last_page) || 1, this._fetching = !1, this._loaded = !0, this._loading = !1, this._fetchError = null, this._searching = !1;
6014
+ const E = this._sorting;
6015
+ if (E && this._updateSortIcons(), this._sorting = !1, this._sortingColumn = null, E && this._updateSortIcons(), this.dispatchEvent(new CustomEvent("loaded", { detail: { rows: this._rows } })), this._updateSearchIcon(), (h = (u = this.querySelector(`#${this._tableId}`)) == null ? void 0 : u.closest("table")) == null ? void 0 : h.querySelector("tbody")) {
6016
+ if (E) {
6017
+ const x = this._loading, T = this._fetching;
6018
+ this._loading = !1, this._fetching = !1, this._updateTableBody(), this._loading = x, this._fetching = T;
5947
6019
  } else
5948
6020
  this._updateTableBody();
5949
6021
  this._updatePagination();
@@ -6084,17 +6156,17 @@ class kt extends HTMLElement {
6084
6156
  else if (h.actions)
6085
6157
  if (h.actionStyle !== "buttons") {
6086
6158
  const m = `actions-popover-${this._tableId}-${c}`, _ = `actions-button-${this._tableId}-${c}`;
6087
- r += `<mint-button id="${_}" variant="link" icon="ellipsis">`, r += "</mint-button>", r += `<mint-popover id="${m}" trigger-id="${_}" direction="down">`, h.actions.forEach((g, b) => {
6159
+ r += `<mint-button id="${_}" variant="link" icon="ellipsis">`, r += "</mint-button>", r += `<mint-popover id="${m}" trigger-id="${_}" direction="down">`, h.actions.forEach((g, v) => {
6088
6160
  if (!g.show || g.show(this, l)) {
6089
- const v = typeof g.label == "function" ? g.label(this, l) : g.label;
6090
- r += `<div class="p-2 cursor-pointer hover:bg-gray-100 dark:hover:bg-gray-700" data-action="row-action" data-row-index="${c}" data-action-index="${b}" data-column-key="${this._configuration.columns.indexOf(h)}">${v}</div>`;
6161
+ const b = typeof g.label == "function" ? g.label(this, l) : g.label;
6162
+ r += `<div class="p-2 cursor-pointer hover:bg-gray-100 dark:hover:bg-gray-700" data-action="row-action" data-row-index="${c}" data-action-index="${v}" data-column-key="${this._configuration.columns.indexOf(h)}">${b}</div>`;
6091
6163
  }
6092
6164
  }), r += "</mint-popover>";
6093
6165
  } else
6094
6166
  h.actions.forEach((m, _) => {
6095
6167
  if (!m.show || m.show(this, l)) {
6096
- const g = m.label ? typeof m.label == "function" ? m.label(this, l) : m.label : "", b = m.icon ? ` icon="${this._escapeHtml(m.icon)}"` : "", v = m.tone ? ` tone="${this._escapeHtml(m.tone)}"` : "";
6097
- r += `<mint-button variant="link" class="${m.classes || ""}" data-action="row-action" data-row-index="${c}" data-action-index="${_}" data-column-key="${this._configuration.columns.indexOf(h)}"${b}${v}>`, g && (r += this._escapeHtml(String(g))), r += "</mint-button>";
6168
+ const g = m.label ? typeof m.label == "function" ? m.label(this, l) : m.label : "", v = m.icon ? ` icon="${this._escapeHtml(m.icon)}"` : "", b = m.tone ? ` tone="${this._escapeHtml(m.tone)}"` : "";
6169
+ r += `<mint-button variant="link" class="${m.classes || ""}" data-action="row-action" data-row-index="${c}" data-action-index="${_}" data-column-key="${this._configuration.columns.indexOf(h)}"${v}${b}>`, g && (r += this._escapeHtml(String(g))), r += "</mint-button>";
6098
6170
  }
6099
6171
  });
6100
6172
  else typeof h.format == "function" ? r += h.format(this, l) : h.data && (r += this._escapeHtml(String(l[h.data] || "")));
@@ -6106,17 +6178,17 @@ class kt extends HTMLElement {
6106
6178
  } else if (h.actions)
6107
6179
  if (h.actionStyle !== "buttons") {
6108
6180
  const m = `actions-popover-${this._tableId}-${c}`, _ = `actions-button-${this._tableId}-${c}`;
6109
- r += `<mint-button id="${_}" variant="link" icon="ellipsis">`, r += "</mint-button>", r += `<mint-popover id="${m}" trigger-id="${_}" direction="down">`, h.actions.forEach((g, b) => {
6181
+ r += `<mint-button id="${_}" variant="link" icon="ellipsis">`, r += "</mint-button>", r += `<mint-popover id="${m}" trigger-id="${_}" direction="down">`, h.actions.forEach((g, v) => {
6110
6182
  if (!g.show || g.show(this, l)) {
6111
- const v = typeof g.label == "function" ? g.label(this, l) : g.label;
6112
- r += `<div class="p-2 cursor-pointer hover:bg-gray-100 dark:hover:bg-gray-700" data-action="row-action" data-row-index="${c}" data-action-index="${b}" data-column-key="${this._configuration.columns.indexOf(h)}">${v}</div>`;
6183
+ const b = typeof g.label == "function" ? g.label(this, l) : g.label;
6184
+ r += `<div class="p-2 cursor-pointer hover:bg-gray-100 dark:hover:bg-gray-700" data-action="row-action" data-row-index="${c}" data-action-index="${v}" data-column-key="${this._configuration.columns.indexOf(h)}">${b}</div>`;
6113
6185
  }
6114
6186
  }), r += "</mint-popover>";
6115
6187
  } else
6116
6188
  h.actions.forEach((m, _) => {
6117
6189
  if (!m.show || m.show(this, l)) {
6118
- const g = m.label ? typeof m.label == "function" ? m.label(this, l) : m.label : "", b = m.icon ? ` icon="${this._escapeHtml(m.icon)}"` : "", v = m.tone ? ` tone="${this._escapeHtml(m.tone)}"` : "";
6119
- r += `<mint-button variant="link" class="${m.classes || ""}" data-action="row-action" data-row-index="${c}" data-action-index="${_}" data-column-key="${this._configuration.columns.indexOf(h)}"${b}${v}>`, g && (r += this._escapeHtml(String(g))), r += "</mint-button>";
6190
+ const g = m.label ? typeof m.label == "function" ? m.label(this, l) : m.label : "", v = m.icon ? ` icon="${this._escapeHtml(m.icon)}"` : "", b = m.tone ? ` tone="${this._escapeHtml(m.tone)}"` : "";
6191
+ r += `<mint-button variant="link" class="${m.classes || ""}" data-action="row-action" data-row-index="${c}" data-action-index="${_}" data-column-key="${this._configuration.columns.indexOf(h)}"${v}${b}>`, g && (r += this._escapeHtml(String(g))), r += "</mint-button>";
6120
6192
  }
6121
6193
  });
6122
6194
  else typeof h.format == "function" ? r += this._escapeHtml(h.format(this, l)) : h.data && (r += this._escapeHtml(String(l[h.data] || "")));
@@ -6461,33 +6533,33 @@ class kt extends HTMLElement {
6461
6533
  return e.textContent = t, e.innerHTML;
6462
6534
  }
6463
6535
  }
6464
- customElements.get("mint-resource-table") || customElements.define("mint-resource-table", kt);
6536
+ customElements.get("mint-resource-table") || customElements.define("mint-resource-table", xt);
6465
6537
  export {
6466
- yt as Alert,
6467
- st as BackButton,
6468
- Y as Button,
6469
- et as Card,
6470
- lt as Checkbox,
6471
- _t as Chip,
6472
- ht as Choice,
6473
- vt as Clickable,
6474
- ut as DatePicker,
6475
- ft as Dropzone,
6476
- mt as Form,
6477
- nt as Grid,
6478
- X as Icon,
6479
- dt as Input,
6480
- it as Link,
6481
- at as Modal,
6482
- rt as Page,
6483
- ot as Popover,
6484
- kt as ResourceTable,
6485
- pt as Select,
6486
- K as Spinner,
6487
- tt as Stack,
6488
- Z as Switch,
6489
- gt as Table,
6490
- bt as Tags,
6491
- Q as Text,
6492
- Y as default
6538
+ Et as Alert,
6539
+ nt as BackButton,
6540
+ U as Button,
6541
+ st as Card,
6542
+ ht as Checkbox,
6543
+ vt as Chip,
6544
+ ut as Choice,
6545
+ kt as Clickable,
6546
+ ft as DatePicker,
6547
+ gt as Dropzone,
6548
+ _t as Form,
6549
+ ot as Grid,
6550
+ Q as Icon,
6551
+ pt as Input,
6552
+ rt as Link,
6553
+ lt as Modal,
6554
+ at as Page,
6555
+ ct as Popover,
6556
+ xt as ResourceTable,
6557
+ mt as Select,
6558
+ Z as Spinner,
6559
+ it as Stack,
6560
+ tt as Switch,
6561
+ bt as Table,
6562
+ yt as Tags,
6563
+ et as Text,
6564
+ U as default
6493
6565
  };