monobill-mintui 0.6.651 → 0.6.653

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. package/bin/component-dependencies.json +9 -0
  2. package/dist/components/chunks/date-picker-BQsCoKaK.js +1282 -0
  3. package/dist/components/chunks/date-picker-tm5Oc92c.js +1 -0
  4. package/dist/components/chunks/{input-CdsHKiuL.js → input-DcglGwsR.js} +1 -1
  5. package/dist/components/chunks/{input-BhptfvVH.js → input-awdYlp-G.js} +1 -1
  6. package/dist/components/chunks/{popover-BRi53qYL.js → popover-FdMS4yAD.js} +1 -1
  7. package/dist/components/chunks/{popover-PNIdAt8C.js → popover-wGdggZ-a.js} +1 -1
  8. package/dist/components/chunks/{table-ty0Sgdpv.js → table-B9e-cnAC.js} +1 -1
  9. package/dist/components/chunks/{table-odOvGji2.js → table-vjF3q3J5.js} +1 -1
  10. package/dist/components/chunks/time-picker-Cq3qzkDb.js +1 -0
  11. package/dist/components/chunks/time-picker-S0bc0BPU.js +360 -0
  12. package/dist/components/date-picker/DatePicker.d.ts +5 -0
  13. package/dist/components/date-picker/DatePicker.d.ts.map +1 -1
  14. package/dist/components/date-picker/browser.js +2 -1270
  15. package/dist/components/date-picker/index.cjs +1 -1
  16. package/dist/components/date-picker/index.js +2 -1270
  17. package/dist/components/datetime-picker/DateTimePicker.d.ts +44 -0
  18. package/dist/components/datetime-picker/DateTimePicker.d.ts.map +1 -0
  19. package/dist/components/datetime-picker/browser.js +261 -0
  20. package/dist/components/datetime-picker/index.cjs +1 -0
  21. package/dist/components/datetime-picker/index.d.ts +4 -0
  22. package/dist/components/datetime-picker/index.d.ts.map +1 -0
  23. package/dist/components/datetime-picker/index.js +249 -0
  24. package/dist/components/form/Form.d.ts.map +1 -1
  25. package/dist/components/form/browser.js +9 -8
  26. package/dist/components/form/index.cjs +1 -1
  27. package/dist/components/form/index.js +9 -8
  28. package/dist/components/input/browser.js +1 -1
  29. package/dist/components/input/index.cjs +1 -1
  30. package/dist/components/input/index.js +1 -1
  31. package/dist/components/link/browser.js +1 -1
  32. package/dist/components/link/index.cjs +1 -1
  33. package/dist/components/link/index.js +1 -1
  34. package/dist/components/navigation/browser.js +2 -2
  35. package/dist/components/navigation/index.cjs +1 -1
  36. package/dist/components/navigation/index.js +2 -2
  37. package/dist/components/popover/browser.js +1 -1
  38. package/dist/components/popover/index.cjs +1 -1
  39. package/dist/components/popover/index.js +1 -1
  40. package/dist/components/resource-table/browser.js +6 -6
  41. package/dist/components/resource-table/index.cjs +1 -1
  42. package/dist/components/resource-table/index.js +6 -6
  43. package/dist/components/scroll-fade/browser.js +1 -1
  44. package/dist/components/scroll-fade/index.cjs +1 -1
  45. package/dist/components/scroll-fade/index.js +1 -1
  46. package/dist/components/search/Search.d.ts.map +1 -1
  47. package/dist/components/search/browser.js +3 -3
  48. package/dist/components/search/index.cjs +1 -1
  49. package/dist/components/search/index.js +3 -3
  50. package/dist/components/select/browser.js +1 -1
  51. package/dist/components/select/index.cjs +1 -1
  52. package/dist/components/select/index.js +1 -1
  53. package/dist/components/side-navigation/browser.js +4 -4
  54. package/dist/components/side-navigation/index.cjs +1 -1
  55. package/dist/components/side-navigation/index.js +4 -4
  56. package/dist/components/sortable/browser.js +1 -1
  57. package/dist/components/sortable/index.cjs +1 -1
  58. package/dist/components/sortable/index.js +1 -1
  59. package/dist/components/table/browser.js +1 -1
  60. package/dist/components/table/index.cjs +1 -1
  61. package/dist/components/table/index.js +1 -1
  62. package/dist/components/tags/browser.js +1 -1
  63. package/dist/components/tags/index.cjs +1 -1
  64. package/dist/components/tags/index.js +1 -1
  65. package/dist/components/time-picker/TimePicker.d.ts +1 -0
  66. package/dist/components/time-picker/TimePicker.d.ts.map +1 -1
  67. package/dist/components/time-picker/browser.js +2 -347
  68. package/dist/components/time-picker/index.cjs +1 -1
  69. package/dist/components/time-picker/index.js +2 -347
  70. package/dist/components/tree/browser.js +2 -2
  71. package/dist/components/tree/index.cjs +1 -1
  72. package/dist/components/tree/index.js +2 -2
  73. package/dist/datetime-picker.css +3 -0
  74. package/dist/index.cjs +3 -3
  75. package/dist/index.css +10 -1
  76. package/dist/index.d.ts +1 -0
  77. package/dist/index.js +957 -697
  78. package/dist/navigation-search.json +7 -0
  79. package/dist/theme.css +5 -0
  80. package/dist/time-picker.css +1 -1
  81. package/package.json +10 -1
  82. /package/dist/components/chunks/{ScrollFade-DIKawLYD.js → ScrollFade-D1FPF6ZS.js} +0 -0
  83. /package/dist/components/chunks/{ScrollFade-Br6QSd_-.js → ScrollFade-DT2Br2g7.js} +0 -0
  84. /package/dist/components/chunks/{caret-down-DRrCYUv0.js → caret-down-DGeJj0xv.js} +0 -0
  85. /package/dist/components/chunks/{caret-down-BU-Ee_JS.js → caret-down-DJvCrCjc.js} +0 -0
  86. /package/dist/components/chunks/{caret-right-BzeJ0Fw3.js → caret-right-BcZ9bOhS.js} +0 -0
  87. /package/dist/components/chunks/{caret-right-Bh7uMg-Y.js → caret-right-CgIVfus7.js} +0 -0
  88. /package/dist/components/chunks/{link-BsC3zT_I.js → link-BjbBJpI6.js} +0 -0
  89. /package/dist/components/chunks/{link-dTjSvr4E.js → link-CU-gTgir.js} +0 -0
  90. /package/dist/components/chunks/{search-v06eZL4m.js → search--bcFMYMP.js} +0 -0
  91. /package/dist/components/chunks/{search-CTAGy5ab.js → search-Cixhf7hA.js} +0 -0
  92. /package/dist/components/chunks/{sortable-B1nMJBah.js → sortable-CNlF0_gv.js} +0 -0
  93. /package/dist/components/chunks/{sortable-CXM-7eyL.js → sortable-CVK48xj1.js} +0 -0
@@ -0,0 +1,44 @@
1
+ import '../date-picker/index';
2
+ import '../time-picker/index';
3
+ import '../text/index';
4
+ import '../icon/index';
5
+ /** A date-first composite that submits a local ISO datetime value. */
6
+ declare class MintDateTimePicker extends HTMLElement {
7
+ static get observedAttributes(): string[];
8
+ private _datePicker;
9
+ private _timePicker;
10
+ private _content;
11
+ private _popoverContent;
12
+ private _popoverObserver;
13
+ private _hiddenInput;
14
+ private _dateValue;
15
+ private _timeValue;
16
+ private _dateStageComplete;
17
+ private _ready;
18
+ private _writingValue;
19
+ private _displayControlBound;
20
+ connectedCallback(): void;
21
+ attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
22
+ get value(): string;
23
+ set value(value: string);
24
+ getValue(): string;
25
+ setValue(value: string): void;
26
+ private _parseDate;
27
+ private _formatDate;
28
+ private _readValue;
29
+ private _toISODate;
30
+ private _syncValue;
31
+ private _syncState;
32
+ private render;
33
+ private _getPopover;
34
+ private _getPopoverContent;
35
+ private _waitForPopover;
36
+ private _bindCombinedDisplayControl;
37
+ private _openTimeStage;
38
+ private _renderTimeStage;
39
+ private _syncCombinedDisplay;
40
+ private _getFormattedDate;
41
+ private _formatTime;
42
+ }
43
+ export default MintDateTimePicker;
44
+ //# sourceMappingURL=DateTimePicker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DateTimePicker.d.ts","sourceRoot":"","sources":["../../../src/components/datetime-picker/DateTimePicker.ts"],"names":[],"mappings":"AACA,OAAO,sBAAsB,CAAA;AAC7B,OAAO,sBAAsB,CAAA;AAC7B,OAAO,eAAe,CAAA;AACtB,OAAO,eAAe,CAAA;AAEtB,sEAAsE;AACtE,cAAM,kBAAmB,SAAQ,WAAW;IAC1C,MAAM,KAAK,kBAAkB,IAAI,MAAM,EAAE,CAExC;IAED,OAAO,CAAC,WAAW,CAA2B;IAC9C,OAAO,CAAC,WAAW,CAA2B;IAC9C,OAAO,CAAC,QAAQ,CAA2B;IAC3C,OAAO,CAAC,eAAe,CAA2B;IAClD,OAAO,CAAC,gBAAgB,CAAgC;IACxD,OAAO,CAAC,YAAY,CAAgC;IACpD,OAAO,CAAC,UAAU,CAAK;IACvB,OAAO,CAAC,UAAU,CAAK;IACvB,OAAO,CAAC,kBAAkB,CAAQ;IAClC,OAAO,CAAC,MAAM,CAAQ;IACtB,OAAO,CAAC,aAAa,CAAQ;IAC7B,OAAO,CAAC,oBAAoB,CAAQ;IAEpC,iBAAiB,IAAI,IAAI;IAOzB,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAc9F,IAAI,KAAK,IAAI,MAAM,CAA4C;IAC/D,IAAI,KAAK,CAAC,KAAK,EAAE,MAAM,EAAgC;IACvD,QAAQ,IAAI,MAAM;IAClB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAU7B,OAAO,CAAC,UAAU;IA2BlB,OAAO,CAAC,WAAW;IAMnB,OAAO,CAAC,UAAU;IAQlB,OAAO,CAAC,UAAU;IAMlB,OAAO,CAAC,UAAU;IAelB,OAAO,CAAC,UAAU;IAWlB,OAAO,CAAC,MAAM;IAgDd,OAAO,CAAC,WAAW;IAUnB,OAAO,CAAC,kBAAkB;IAK1B,OAAO,CAAC,eAAe;IA8BvB,OAAO,CAAC,2BAA2B;IAoBnC,OAAO,CAAC,cAAc;IAOtB,OAAO,CAAC,gBAAgB;IAoCxB,OAAO,CAAC,oBAAoB;IAS5B,OAAO,CAAC,iBAAiB;IAKzB,OAAO,CAAC,WAAW;CAWpB;AAGD,eAAe,kBAAkB,CAAA"}
@@ -0,0 +1,261 @@
1
+
2
+ const __mintLoadStyle = (key, url) => {
3
+ if (typeof document === 'undefined') return
4
+ const href = new URL(url, import.meta.url).href
5
+ if ([...document.querySelectorAll('link[rel="stylesheet"]')].some(link => link.href === href)) return
6
+ if (document.querySelector('style[data-mint-ui-style="' + key + '"]') || document.querySelector('link[data-mint-ui-style="' + key + '"]')) return
7
+ const link = document.createElement('link')
8
+ link.rel = 'stylesheet'
9
+ link.href = href
10
+ link.dataset.mintUiStyle = key
11
+ document.head.append(link)
12
+ }
13
+ __mintLoadStyle('theme', '../../theme.css')
14
+ __mintLoadStyle('date-picker', '../../date-picker.css')
15
+ __mintLoadStyle('input', '../../input.css')
16
+ __mintLoadStyle('icon', '../../icon.css')
17
+ __mintLoadStyle('popover', '../../popover.css')
18
+ __mintLoadStyle('stack', '../../stack.css')
19
+ __mintLoadStyle('time-picker', '../../time-picker.css')
20
+ __mintLoadStyle('text', '../../text.css')
21
+ __mintLoadStyle('datetime-picker', '../../datetime-picker.css')
22
+ import "../chunks/icon-Cxv9k3CY.js";
23
+ import { t as e } from "../chunks/register-element-BFYmIynH.js";
24
+ import "../chunks/text-Bmfl6CxJ.js";
25
+ import "../chunks/date-picker-BQsCoKaK.js";
26
+ import "../chunks/time-picker-S0bc0BPU.js";
27
+ //#region src/components/datetime-picker/DateTimePicker.ts
28
+ var t = class extends HTMLElement {
29
+ constructor(...e) {
30
+ super(...e), this._datePicker = null, this._timePicker = null, this._content = null, this._popoverContent = null, this._popoverObserver = null, this._hiddenInput = null, this._dateValue = "", this._timeValue = "", this._dateStageComplete = !1, this._ready = !1, this._writingValue = !1, this._displayControlBound = !1;
31
+ }
32
+ static get observedAttributes() {
33
+ return [
34
+ "value",
35
+ "label",
36
+ "info",
37
+ "name",
38
+ "required",
39
+ "disabled",
40
+ "readonly",
41
+ "format",
42
+ "display-format",
43
+ "min",
44
+ "max",
45
+ "shortcuts",
46
+ "hours",
47
+ "minutes",
48
+ "seconds",
49
+ "error",
50
+ "error-message"
51
+ ];
52
+ }
53
+ connectedCallback() {
54
+ this.classList.add("mint-datetime-picker"), this._readValue(this.getAttribute("value") || ""), this.render(), this._ready = !0;
55
+ }
56
+ attributeChangedCallback(e, t, n) {
57
+ if (!(t === n || !this._ready || e === "value" && this._writingValue)) {
58
+ if (e === "value") {
59
+ this._readValue(n || ""), this.render();
60
+ return;
61
+ }
62
+ if (e === "error" || e === "error-message") {
63
+ this._syncState();
64
+ return;
65
+ }
66
+ this.render();
67
+ }
68
+ }
69
+ get value() {
70
+ return this.getAttribute("value") || "";
71
+ }
72
+ set value(e) {
73
+ this.setValue(e || "");
74
+ }
75
+ getValue() {
76
+ return this.getAttribute("value") || "";
77
+ }
78
+ setValue(e) {
79
+ this._readValue(e), this._writingValue = !0, e ? this.setAttribute("value", e) : this.removeAttribute("value"), this._writingValue = !1, this.render(), this._syncState();
80
+ }
81
+ _parseDate(e, t) {
82
+ let n = e.match(/^(\d{4})-(\d{2})-(\d{2})/);
83
+ if (n) return new Date(Number(n[1]), Number(n[2]) - 1, Number(n[3]));
84
+ let r = {
85
+ yyyy: "(\\d{4})",
86
+ yy: "(\\d{2})",
87
+ Y: "(\\d{4})",
88
+ y: "(\\d{2})",
89
+ mm: "(\\d{1,2})",
90
+ m: "(\\d{1,2})",
91
+ n: "(\\d{1,2})",
92
+ dd: "(\\d{1,2})",
93
+ d: "(\\d{1,2})",
94
+ j: "(\\d{1,2})",
95
+ M: "([A-Za-z]+)",
96
+ F: "([A-Za-z]+)"
97
+ }, i = Object.keys(r).sort((e, t) => t.length - e.length), a = [], o = "^";
98
+ for (let e = 0; e < t.length;) {
99
+ let n = i.find((n) => t.startsWith(n, e));
100
+ n ? (o += r[n], a.push(n), e += n.length) : (o += t[e].replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), e++);
101
+ }
102
+ let s = e.match(RegExp(`${o}$`, "i"));
103
+ if (!s) return null;
104
+ let c = 2e3, l = 1, u = 1;
105
+ a.forEach((e, t) => {
106
+ let n = s[t + 1];
107
+ if (e === "Y" || e === "yyyy") c = Number(n);
108
+ else if (e === "y" || e === "yy") c = Number(n) + 2e3;
109
+ else if (e === "m" || e === "mm" || e === "n") l = Number(n);
110
+ else if (e === "d" || e === "dd" || e === "j") u = Number(n);
111
+ else if (e === "M" || e === "F") {
112
+ let e = (/* @__PURE__ */ new Date(`${n} 1, 2000`)).getMonth();
113
+ Number.isNaN(e) || (l = e + 1);
114
+ }
115
+ });
116
+ let d = new Date(c, l - 1, u);
117
+ return d.getFullYear() === c && d.getMonth() === l - 1 && d.getDate() === u ? d : null;
118
+ }
119
+ _formatDate(e, t) {
120
+ let n = (e) => String(e).padStart(2, "0"), r = {
121
+ Y: String(e.getFullYear()),
122
+ yyyy: String(e.getFullYear()),
123
+ yy: String(e.getFullYear()).slice(-2),
124
+ y: String(e.getFullYear()).slice(-2),
125
+ mm: n(e.getMonth() + 1),
126
+ m: n(e.getMonth() + 1),
127
+ n: String(e.getMonth() + 1),
128
+ dd: n(e.getDate()),
129
+ d: n(e.getDate()),
130
+ j: String(e.getDate()),
131
+ M: e.toLocaleString(void 0, { month: "short" }),
132
+ F: e.toLocaleString(void 0, { month: "long" })
133
+ };
134
+ return t.replace(/yyyy|yy|mm|dd|Y|y|m|n|d|j|M|F/g, (e) => r[e]);
135
+ }
136
+ _readValue(e) {
137
+ let [t = "", n = ""] = e.split(/[T ]/), r = this._parseDate(t, this.getAttribute("format") || "mm/dd/yyyy");
138
+ this._dateValue = r ? this._formatDate(r, this.getAttribute("format") || "mm/dd/yyyy") : "", this._timeValue = n || "", this._dateStageComplete = !!r;
139
+ }
140
+ _toISODate() {
141
+ let e = this._parseDate(this._dateValue, this.getAttribute("format") || "mm/dd/yyyy");
142
+ return e ? `${e.getFullYear()}-${String(e.getMonth() + 1).padStart(2, "0")}-${String(e.getDate()).padStart(2, "0")}` : "";
143
+ }
144
+ _syncValue(e = !1) {
145
+ let t = this._toISODate(), n = this._timeValue, r = t && n ? `${t}T${n}` : "";
146
+ this._writingValue = !0, r ? this.setAttribute("value", r) : this.removeAttribute("value"), this._writingValue = !1, this._hiddenInput && (this._hiddenInput.value = r), e && r && (this.dispatchEvent(new Event("input", {
147
+ bubbles: !0,
148
+ composed: !0
149
+ })), this.dispatchEvent(new CustomEvent("change", {
150
+ detail: { value: r },
151
+ bubbles: !0,
152
+ composed: !0
153
+ })));
154
+ }
155
+ _syncState() {
156
+ this._datePicker && (this._datePicker.setAttribute("value", this._dateValue), this._datePicker.setAttribute("error", this.getAttribute("error") || "false"), this._datePicker.setAttribute("error-message", this.getAttribute("error-message") || ""), this._timePicker?.setAttribute("error", this.getAttribute("error") || "false"), this._timePicker?.setAttribute("error-message", this.getAttribute("error-message") || ""), this._hiddenInput && (this._hiddenInput.value = this.getValue()), this._syncCombinedDisplay());
157
+ }
158
+ render() {
159
+ let e = this.getAttribute("label") || "", t = this.getAttribute("info") || "", n = this.getAttribute("format") || "mm/dd/yyyy", r = this.getAttribute("disabled") === "true", i = this.getAttribute("readonly") === "true";
160
+ this._displayControlBound = !1;
161
+ let a = document.createElement("mint-date-picker");
162
+ a.setAttribute("class", "mint-datetime-picker-date"), a.setAttribute("keep-open-on-select", "true"), a.setAttribute("format", n), a.setAttribute("value", this._dateValue), a.setAttribute("label", e), a.setAttribute("info", t), a.setAttribute("display-format", this.getAttribute("display-format") || "F j, Y");
163
+ for (let e of [
164
+ "min",
165
+ "max",
166
+ "shortcuts"
167
+ ]) this.hasAttribute(e) && a.setAttribute(e, this.getAttribute(e) || "");
168
+ r && a.setAttribute("disabled", "true"), i && a.setAttribute("readonly", "true"), this.hasAttribute("required") && a.setAttribute("required", this.getAttribute("required") || "true"), this.hasAttribute("error") && a.setAttribute("error", this.getAttribute("error") || "false"), this.hasAttribute("error-message") && a.setAttribute("error-message", this.getAttribute("error-message") || ""), a.addEventListener("change", (e) => {
169
+ e.stopPropagation();
170
+ let t = e.detail?.value || a.value || "";
171
+ this._parseDate(t, n) && (this._dateValue = t, this._dateStageComplete = !0, this._syncValue(!1), this._syncCombinedDisplay(), this._openTimeStage());
172
+ }), this._datePicker = a, this._bindCombinedDisplayControl();
173
+ let o = document.createElement("div");
174
+ o.className = "mint-datetime-picker-content", this._content = o, this.innerHTML = "", this.appendChild(o), o.appendChild(a), this._hiddenInput = document.createElement("input"), this._hiddenInput.type = "hidden", this._hiddenInput.name = this.getAttribute("name") || "", this._hiddenInput.value = this.getValue(), this.appendChild(this._hiddenInput), this._waitForPopover();
175
+ }
176
+ _getPopover() {
177
+ let e = this._datePicker, t = e?.getPopoverElement?.() || e?._popover;
178
+ if (t) return t;
179
+ let n = e?.querySelector?.(".mint-date-picker-icon-button")?.id;
180
+ return n ? document.querySelector(`mint-popover[trigger-id="${CSS.escape(n)}"]`) : null;
181
+ }
182
+ _getPopoverContent(e) {
183
+ return e.querySelector(".popover-content") || e;
184
+ }
185
+ _waitForPopover(e = 0) {
186
+ let t = this._getPopover();
187
+ if (!t) {
188
+ e < 120 && requestAnimationFrame(() => this._waitForPopover(e + 1));
189
+ return;
190
+ }
191
+ if (this._popoverContent = this._datePicker?.getPopoverContentElement?.() || this._getPopoverContent(t), this._bindCombinedDisplayControl(), this._syncCombinedDisplay(), this._popoverObserver?.disconnect(), this._popoverObserver = new MutationObserver(() => {
192
+ if (t.getAttribute("open") === "true") {
193
+ let e = this._datePicker;
194
+ typeof e?.refreshCalendar == "function" ? e.refreshCalendar() : e?._buildCalendar?.();
195
+ }
196
+ }), this._popoverObserver.observe(t, {
197
+ attributes: !0,
198
+ attributeFilter: ["open"]
199
+ }), t.getAttribute("open") === "true") {
200
+ let e = this._datePicker;
201
+ typeof e?.refreshCalendar == "function" ? e.refreshCalendar() : e?._buildCalendar?.();
202
+ }
203
+ }
204
+ _bindCombinedDisplayControl() {
205
+ if (this._displayControlBound || !this._datePicker) return;
206
+ this._displayControlBound = !0;
207
+ let e = (e) => {
208
+ if (!e.target?.closest(".mint-date-picker-field") || this.getAttribute("disabled") === "true" || this.getAttribute("readonly") === "true" || e instanceof KeyboardEvent && e.key !== "Enter" && e.key !== " ") return;
209
+ e.preventDefault(), e.stopImmediatePropagation();
210
+ let t = this._getPopover();
211
+ t?.open ? t.open() : t?.setAttribute("open", "true");
212
+ };
213
+ this._datePicker.addEventListener("click", e, !0), this._datePicker.addEventListener("keydown", e, !0);
214
+ }
215
+ _openTimeStage() {
216
+ queueMicrotask(() => this._renderTimeStage());
217
+ }
218
+ _renderTimeStage() {
219
+ if (!this._popoverContent || !this._dateStageComplete) return;
220
+ let e = document.createElement("div");
221
+ e.className = "mint-datetime-picker-panel";
222
+ let t = document.createElement("button");
223
+ t.type = "button", t.className = "mint-datetime-picker-time-heading", t.setAttribute("aria-label", `Change date, ${this._dateValue}`), t.textContent = this._getFormattedDate(), t.addEventListener("click", () => {
224
+ let e = this._datePicker;
225
+ typeof e?.refreshCalendar == "function" ? e.refreshCalendar() : e?._buildCalendar?.();
226
+ });
227
+ let n = document.createElement("mint-time-picker"), r = this.getAttribute("disabled") === "true", i = this.getAttribute("readonly") === "true";
228
+ n.setAttribute("inline", "true"), n.setAttribute("value", this._timeValue || "09:00"), n.setAttribute("label", "");
229
+ for (let e of [
230
+ "hours",
231
+ "minutes",
232
+ "seconds"
233
+ ]) this.hasAttribute(e) && n.setAttribute(e, this.getAttribute(e) || "");
234
+ r && n.setAttribute("disabled", "true"), i && n.setAttribute("readonly", "true"), n.addEventListener("change", () => {
235
+ this._timeValue = n.getValue?.() || n.getAttribute("value") || "", this._syncValue(!0), this._syncCombinedDisplay();
236
+ }), n.addEventListener("change", (e) => e.stopPropagation()), n.addEventListener("input", (e) => e.stopPropagation()), this._timePicker = n, e.appendChild(t), e.appendChild(n), this._popoverContent.replaceChildren(e);
237
+ }
238
+ _syncCombinedDisplay() {
239
+ let e = this._datePicker?.getDisplayElement?.() || this._datePicker?.querySelector(".mint-date-picker-display");
240
+ if (!e || !this._dateValue) return;
241
+ let t = this._getFormattedDate();
242
+ e.textContent = this._timeValue ? `${t} · ${this._formatTime(this._timeValue)}` : t, e.setAttribute("aria-label", `${this.getAttribute("label") || "Date and time"}: ${e.textContent}`);
243
+ }
244
+ _getFormattedDate() {
245
+ let e = this._parseDate(this._dateValue, this.getAttribute("format") || "mm/dd/yyyy");
246
+ return e ? this._formatDate(e, this.getAttribute("display-format") || "F j, Y") : this._dateValue;
247
+ }
248
+ _formatTime(e) {
249
+ let [t = "00", n = "00", r] = e.split(":"), i = Number(t), a = this.getAttribute("hours") !== "false", o = this.getAttribute("minutes") !== "false", s = this.getAttribute("seconds") === "true";
250
+ if (!a) return [o ? n : "", s ? r || "00" : ""].filter(Boolean).join(":");
251
+ let c = i % 12 || 12;
252
+ return `${[
253
+ String(c),
254
+ o ? n : "",
255
+ s ? r || "00" : ""
256
+ ].filter(Boolean).join(":")} ${i >= 12 ? "pm" : "am"}`;
257
+ }
258
+ };
259
+ customElements.get("mint-datetime-picker") || e("mint-datetime-picker", t);
260
+ //#endregion
261
+ export { t as default };
@@ -0,0 +1 @@
1
+ require(`../chunks/icon-rvYvpQ_h.js`);const e=require(`../chunks/register-element-tCL_F1YI.js`);require(`../chunks/text-Cpl5ljSe.js`),require(`../chunks/date-picker-tm5Oc92c.js`),require(`../chunks/time-picker-Cq3qzkDb.js`);var t=class extends HTMLElement{constructor(...e){super(...e),this._datePicker=null,this._timePicker=null,this._content=null,this._popoverContent=null,this._popoverObserver=null,this._hiddenInput=null,this._dateValue=``,this._timeValue=``,this._dateStageComplete=!1,this._ready=!1,this._writingValue=!1,this._displayControlBound=!1}static get observedAttributes(){return[`value`,`label`,`info`,`name`,`required`,`disabled`,`readonly`,`format`,`display-format`,`min`,`max`,`shortcuts`,`hours`,`minutes`,`seconds`,`error`,`error-message`]}connectedCallback(){this.classList.add(`mint-datetime-picker`),this._readValue(this.getAttribute(`value`)||``),this.render(),this._ready=!0}attributeChangedCallback(e,t,n){if(!(t===n||!this._ready||e===`value`&&this._writingValue)){if(e===`value`){this._readValue(n||``),this.render();return}if(e===`error`||e===`error-message`){this._syncState();return}this.render()}}get value(){return this.getAttribute(`value`)||``}set value(e){this.setValue(e||``)}getValue(){return this.getAttribute(`value`)||``}setValue(e){this._readValue(e),this._writingValue=!0,e?this.setAttribute(`value`,e):this.removeAttribute(`value`),this._writingValue=!1,this.render(),this._syncState()}_parseDate(e,t){let n=e.match(/^(\d{4})-(\d{2})-(\d{2})/);if(n)return new Date(Number(n[1]),Number(n[2])-1,Number(n[3]));let r={yyyy:`(\\d{4})`,yy:`(\\d{2})`,Y:`(\\d{4})`,y:`(\\d{2})`,mm:`(\\d{1,2})`,m:`(\\d{1,2})`,n:`(\\d{1,2})`,dd:`(\\d{1,2})`,d:`(\\d{1,2})`,j:`(\\d{1,2})`,M:`([A-Za-z]+)`,F:`([A-Za-z]+)`},i=Object.keys(r).sort((e,t)=>t.length-e.length),a=[],o=`^`;for(let e=0;e<t.length;){let n=i.find(n=>t.startsWith(n,e));n?(o+=r[n],a.push(n),e+=n.length):(o+=t[e].replace(/[.*+?^${}()|[\]\\]/g,`\\$&`),e++)}let s=e.match(RegExp(`${o}$`,`i`));if(!s)return null;let c=2e3,l=1,u=1;a.forEach((e,t)=>{let n=s[t+1];if(e===`Y`||e===`yyyy`)c=Number(n);else if(e===`y`||e===`yy`)c=Number(n)+2e3;else if(e===`m`||e===`mm`||e===`n`)l=Number(n);else if(e===`d`||e===`dd`||e===`j`)u=Number(n);else if(e===`M`||e===`F`){let e=new Date(`${n} 1, 2000`).getMonth();Number.isNaN(e)||(l=e+1)}});let d=new Date(c,l-1,u);return d.getFullYear()===c&&d.getMonth()===l-1&&d.getDate()===u?d:null}_formatDate(e,t){let n=e=>String(e).padStart(2,`0`),r={Y:String(e.getFullYear()),yyyy:String(e.getFullYear()),yy:String(e.getFullYear()).slice(-2),y:String(e.getFullYear()).slice(-2),mm:n(e.getMonth()+1),m:n(e.getMonth()+1),n:String(e.getMonth()+1),dd:n(e.getDate()),d:n(e.getDate()),j:String(e.getDate()),M:e.toLocaleString(void 0,{month:`short`}),F:e.toLocaleString(void 0,{month:`long`})};return t.replace(/yyyy|yy|mm|dd|Y|y|m|n|d|j|M|F/g,e=>r[e])}_readValue(e){let[t=``,n=``]=e.split(/[T ]/),r=this._parseDate(t,this.getAttribute(`format`)||`mm/dd/yyyy`);this._dateValue=r?this._formatDate(r,this.getAttribute(`format`)||`mm/dd/yyyy`):``,this._timeValue=n||``,this._dateStageComplete=!!r}_toISODate(){let e=this._parseDate(this._dateValue,this.getAttribute(`format`)||`mm/dd/yyyy`);return e?`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`:``}_syncValue(e=!1){let t=this._toISODate(),n=this._timeValue,r=t&&n?`${t}T${n}`:``;this._writingValue=!0,r?this.setAttribute(`value`,r):this.removeAttribute(`value`),this._writingValue=!1,this._hiddenInput&&(this._hiddenInput.value=r),e&&r&&(this.dispatchEvent(new Event(`input`,{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent(`change`,{detail:{value:r},bubbles:!0,composed:!0})))}_syncState(){this._datePicker&&(this._datePicker.setAttribute(`value`,this._dateValue),this._datePicker.setAttribute(`error`,this.getAttribute(`error`)||`false`),this._datePicker.setAttribute(`error-message`,this.getAttribute(`error-message`)||``),this._timePicker?.setAttribute(`error`,this.getAttribute(`error`)||`false`),this._timePicker?.setAttribute(`error-message`,this.getAttribute(`error-message`)||``),this._hiddenInput&&(this._hiddenInput.value=this.getValue()),this._syncCombinedDisplay())}render(){let e=this.getAttribute(`label`)||``,t=this.getAttribute(`info`)||``,n=this.getAttribute(`format`)||`mm/dd/yyyy`,r=this.getAttribute(`disabled`)===`true`,i=this.getAttribute(`readonly`)===`true`;this._displayControlBound=!1;let a=document.createElement(`mint-date-picker`);a.setAttribute(`class`,`mint-datetime-picker-date`),a.setAttribute(`keep-open-on-select`,`true`),a.setAttribute(`format`,n),a.setAttribute(`value`,this._dateValue),a.setAttribute(`label`,e),a.setAttribute(`info`,t),a.setAttribute(`display-format`,this.getAttribute(`display-format`)||`F j, Y`);for(let e of[`min`,`max`,`shortcuts`])this.hasAttribute(e)&&a.setAttribute(e,this.getAttribute(e)||``);r&&a.setAttribute(`disabled`,`true`),i&&a.setAttribute(`readonly`,`true`),this.hasAttribute(`required`)&&a.setAttribute(`required`,this.getAttribute(`required`)||`true`),this.hasAttribute(`error`)&&a.setAttribute(`error`,this.getAttribute(`error`)||`false`),this.hasAttribute(`error-message`)&&a.setAttribute(`error-message`,this.getAttribute(`error-message`)||``),a.addEventListener(`change`,e=>{e.stopPropagation();let t=e.detail?.value||a.value||``;this._parseDate(t,n)&&(this._dateValue=t,this._dateStageComplete=!0,this._syncValue(!1),this._syncCombinedDisplay(),this._openTimeStage())}),this._datePicker=a,this._bindCombinedDisplayControl();let o=document.createElement(`div`);o.className=`mint-datetime-picker-content`,this._content=o,this.innerHTML=``,this.appendChild(o),o.appendChild(a),this._hiddenInput=document.createElement(`input`),this._hiddenInput.type=`hidden`,this._hiddenInput.name=this.getAttribute(`name`)||``,this._hiddenInput.value=this.getValue(),this.appendChild(this._hiddenInput),this._waitForPopover()}_getPopover(){let e=this._datePicker,t=e?.getPopoverElement?.()||e?._popover;if(t)return t;let n=e?.querySelector?.(`.mint-date-picker-icon-button`)?.id;return n?document.querySelector(`mint-popover[trigger-id="${CSS.escape(n)}"]`):null}_getPopoverContent(e){return e.querySelector(`.popover-content`)||e}_waitForPopover(e=0){let t=this._getPopover();if(!t){e<120&&requestAnimationFrame(()=>this._waitForPopover(e+1));return}if(this._popoverContent=this._datePicker?.getPopoverContentElement?.()||this._getPopoverContent(t),this._bindCombinedDisplayControl(),this._syncCombinedDisplay(),this._popoverObserver?.disconnect(),this._popoverObserver=new MutationObserver(()=>{if(t.getAttribute(`open`)===`true`){let e=this._datePicker;typeof e?.refreshCalendar==`function`?e.refreshCalendar():e?._buildCalendar?.()}}),this._popoverObserver.observe(t,{attributes:!0,attributeFilter:[`open`]}),t.getAttribute(`open`)===`true`){let e=this._datePicker;typeof e?.refreshCalendar==`function`?e.refreshCalendar():e?._buildCalendar?.()}}_bindCombinedDisplayControl(){if(this._displayControlBound||!this._datePicker)return;this._displayControlBound=!0;let e=e=>{if(!e.target?.closest(`.mint-date-picker-field`)||this.getAttribute(`disabled`)===`true`||this.getAttribute(`readonly`)===`true`||e instanceof KeyboardEvent&&e.key!==`Enter`&&e.key!==` `)return;e.preventDefault(),e.stopImmediatePropagation();let t=this._getPopover();t?.open?t.open():t?.setAttribute(`open`,`true`)};this._datePicker.addEventListener(`click`,e,!0),this._datePicker.addEventListener(`keydown`,e,!0)}_openTimeStage(){queueMicrotask(()=>this._renderTimeStage())}_renderTimeStage(){if(!this._popoverContent||!this._dateStageComplete)return;let e=document.createElement(`div`);e.className=`mint-datetime-picker-panel`;let t=document.createElement(`button`);t.type=`button`,t.className=`mint-datetime-picker-time-heading`,t.setAttribute(`aria-label`,`Change date, ${this._dateValue}`),t.textContent=this._getFormattedDate(),t.addEventListener(`click`,()=>{let e=this._datePicker;typeof e?.refreshCalendar==`function`?e.refreshCalendar():e?._buildCalendar?.()});let n=document.createElement(`mint-time-picker`),r=this.getAttribute(`disabled`)===`true`,i=this.getAttribute(`readonly`)===`true`;n.setAttribute(`inline`,`true`),n.setAttribute(`value`,this._timeValue||`09:00`),n.setAttribute(`label`,``);for(let e of[`hours`,`minutes`,`seconds`])this.hasAttribute(e)&&n.setAttribute(e,this.getAttribute(e)||``);r&&n.setAttribute(`disabled`,`true`),i&&n.setAttribute(`readonly`,`true`),n.addEventListener(`change`,()=>{this._timeValue=n.getValue?.()||n.getAttribute(`value`)||``,this._syncValue(!0),this._syncCombinedDisplay()}),n.addEventListener(`change`,e=>e.stopPropagation()),n.addEventListener(`input`,e=>e.stopPropagation()),this._timePicker=n,e.appendChild(t),e.appendChild(n),this._popoverContent.replaceChildren(e)}_syncCombinedDisplay(){let e=this._datePicker?.getDisplayElement?.()||this._datePicker?.querySelector(`.mint-date-picker-display`);if(!e||!this._dateValue)return;let t=this._getFormattedDate();e.textContent=this._timeValue?`${t} · ${this._formatTime(this._timeValue)}`:t,e.setAttribute(`aria-label`,`${this.getAttribute(`label`)||`Date and time`}: ${e.textContent}`)}_getFormattedDate(){let e=this._parseDate(this._dateValue,this.getAttribute(`format`)||`mm/dd/yyyy`);return e?this._formatDate(e,this.getAttribute(`display-format`)||`F j, Y`):this._dateValue}_formatTime(e){let[t=`00`,n=`00`,r]=e.split(`:`),i=Number(t),a=this.getAttribute(`hours`)!==`false`,o=this.getAttribute(`minutes`)!==`false`,s=this.getAttribute(`seconds`)===`true`;if(!a)return[o?n:``,s?r||`00`:``].filter(Boolean).join(`:`);let c=i%12||12;return`${[String(c),o?n:``,s?r||`00`:``].filter(Boolean).join(`:`)} ${i>=12?`pm`:`am`}`}};customElements.get(`mint-datetime-picker`)||e.t(`mint-datetime-picker`,t),module.exports=t;
@@ -0,0 +1,4 @@
1
+ import './styles.css';
2
+ import './DateTimePicker';
3
+ export { default } from './DateTimePicker';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/datetime-picker/index.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,CAAA;AACrB,OAAO,kBAAkB,CAAA;AAEzB,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA"}
@@ -0,0 +1,249 @@
1
+ import '../../theme.css'
2
+ import '../../date-picker.css'
3
+ import '../../input.css'
4
+ import '../../icon.css'
5
+ import '../../popover.css'
6
+ import '../../stack.css'
7
+ import '../../time-picker.css'
8
+ import '../../text.css'
9
+ import '../../datetime-picker.css'
10
+ import "../chunks/icon-Cxv9k3CY.js";
11
+ import { t as e } from "../chunks/register-element-BFYmIynH.js";
12
+ import "../chunks/text-Bmfl6CxJ.js";
13
+ import "../chunks/date-picker-BQsCoKaK.js";
14
+ import "../chunks/time-picker-S0bc0BPU.js";
15
+ //#region src/components/datetime-picker/DateTimePicker.ts
16
+ var t = class extends HTMLElement {
17
+ constructor(...e) {
18
+ super(...e), this._datePicker = null, this._timePicker = null, this._content = null, this._popoverContent = null, this._popoverObserver = null, this._hiddenInput = null, this._dateValue = "", this._timeValue = "", this._dateStageComplete = !1, this._ready = !1, this._writingValue = !1, this._displayControlBound = !1;
19
+ }
20
+ static get observedAttributes() {
21
+ return [
22
+ "value",
23
+ "label",
24
+ "info",
25
+ "name",
26
+ "required",
27
+ "disabled",
28
+ "readonly",
29
+ "format",
30
+ "display-format",
31
+ "min",
32
+ "max",
33
+ "shortcuts",
34
+ "hours",
35
+ "minutes",
36
+ "seconds",
37
+ "error",
38
+ "error-message"
39
+ ];
40
+ }
41
+ connectedCallback() {
42
+ this.classList.add("mint-datetime-picker"), this._readValue(this.getAttribute("value") || ""), this.render(), this._ready = !0;
43
+ }
44
+ attributeChangedCallback(e, t, n) {
45
+ if (!(t === n || !this._ready || e === "value" && this._writingValue)) {
46
+ if (e === "value") {
47
+ this._readValue(n || ""), this.render();
48
+ return;
49
+ }
50
+ if (e === "error" || e === "error-message") {
51
+ this._syncState();
52
+ return;
53
+ }
54
+ this.render();
55
+ }
56
+ }
57
+ get value() {
58
+ return this.getAttribute("value") || "";
59
+ }
60
+ set value(e) {
61
+ this.setValue(e || "");
62
+ }
63
+ getValue() {
64
+ return this.getAttribute("value") || "";
65
+ }
66
+ setValue(e) {
67
+ this._readValue(e), this._writingValue = !0, e ? this.setAttribute("value", e) : this.removeAttribute("value"), this._writingValue = !1, this.render(), this._syncState();
68
+ }
69
+ _parseDate(e, t) {
70
+ let n = e.match(/^(\d{4})-(\d{2})-(\d{2})/);
71
+ if (n) return new Date(Number(n[1]), Number(n[2]) - 1, Number(n[3]));
72
+ let r = {
73
+ yyyy: "(\\d{4})",
74
+ yy: "(\\d{2})",
75
+ Y: "(\\d{4})",
76
+ y: "(\\d{2})",
77
+ mm: "(\\d{1,2})",
78
+ m: "(\\d{1,2})",
79
+ n: "(\\d{1,2})",
80
+ dd: "(\\d{1,2})",
81
+ d: "(\\d{1,2})",
82
+ j: "(\\d{1,2})",
83
+ M: "([A-Za-z]+)",
84
+ F: "([A-Za-z]+)"
85
+ }, i = Object.keys(r).sort((e, t) => t.length - e.length), a = [], o = "^";
86
+ for (let e = 0; e < t.length;) {
87
+ let n = i.find((n) => t.startsWith(n, e));
88
+ n ? (o += r[n], a.push(n), e += n.length) : (o += t[e].replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), e++);
89
+ }
90
+ let s = e.match(RegExp(`${o}$`, "i"));
91
+ if (!s) return null;
92
+ let c = 2e3, l = 1, u = 1;
93
+ a.forEach((e, t) => {
94
+ let n = s[t + 1];
95
+ if (e === "Y" || e === "yyyy") c = Number(n);
96
+ else if (e === "y" || e === "yy") c = Number(n) + 2e3;
97
+ else if (e === "m" || e === "mm" || e === "n") l = Number(n);
98
+ else if (e === "d" || e === "dd" || e === "j") u = Number(n);
99
+ else if (e === "M" || e === "F") {
100
+ let e = (/* @__PURE__ */ new Date(`${n} 1, 2000`)).getMonth();
101
+ Number.isNaN(e) || (l = e + 1);
102
+ }
103
+ });
104
+ let d = new Date(c, l - 1, u);
105
+ return d.getFullYear() === c && d.getMonth() === l - 1 && d.getDate() === u ? d : null;
106
+ }
107
+ _formatDate(e, t) {
108
+ let n = (e) => String(e).padStart(2, "0"), r = {
109
+ Y: String(e.getFullYear()),
110
+ yyyy: String(e.getFullYear()),
111
+ yy: String(e.getFullYear()).slice(-2),
112
+ y: String(e.getFullYear()).slice(-2),
113
+ mm: n(e.getMonth() + 1),
114
+ m: n(e.getMonth() + 1),
115
+ n: String(e.getMonth() + 1),
116
+ dd: n(e.getDate()),
117
+ d: n(e.getDate()),
118
+ j: String(e.getDate()),
119
+ M: e.toLocaleString(void 0, { month: "short" }),
120
+ F: e.toLocaleString(void 0, { month: "long" })
121
+ };
122
+ return t.replace(/yyyy|yy|mm|dd|Y|y|m|n|d|j|M|F/g, (e) => r[e]);
123
+ }
124
+ _readValue(e) {
125
+ let [t = "", n = ""] = e.split(/[T ]/), r = this._parseDate(t, this.getAttribute("format") || "mm/dd/yyyy");
126
+ this._dateValue = r ? this._formatDate(r, this.getAttribute("format") || "mm/dd/yyyy") : "", this._timeValue = n || "", this._dateStageComplete = !!r;
127
+ }
128
+ _toISODate() {
129
+ let e = this._parseDate(this._dateValue, this.getAttribute("format") || "mm/dd/yyyy");
130
+ return e ? `${e.getFullYear()}-${String(e.getMonth() + 1).padStart(2, "0")}-${String(e.getDate()).padStart(2, "0")}` : "";
131
+ }
132
+ _syncValue(e = !1) {
133
+ let t = this._toISODate(), n = this._timeValue, r = t && n ? `${t}T${n}` : "";
134
+ this._writingValue = !0, r ? this.setAttribute("value", r) : this.removeAttribute("value"), this._writingValue = !1, this._hiddenInput && (this._hiddenInput.value = r), e && r && (this.dispatchEvent(new Event("input", {
135
+ bubbles: !0,
136
+ composed: !0
137
+ })), this.dispatchEvent(new CustomEvent("change", {
138
+ detail: { value: r },
139
+ bubbles: !0,
140
+ composed: !0
141
+ })));
142
+ }
143
+ _syncState() {
144
+ this._datePicker && (this._datePicker.setAttribute("value", this._dateValue), this._datePicker.setAttribute("error", this.getAttribute("error") || "false"), this._datePicker.setAttribute("error-message", this.getAttribute("error-message") || ""), this._timePicker?.setAttribute("error", this.getAttribute("error") || "false"), this._timePicker?.setAttribute("error-message", this.getAttribute("error-message") || ""), this._hiddenInput && (this._hiddenInput.value = this.getValue()), this._syncCombinedDisplay());
145
+ }
146
+ render() {
147
+ let e = this.getAttribute("label") || "", t = this.getAttribute("info") || "", n = this.getAttribute("format") || "mm/dd/yyyy", r = this.getAttribute("disabled") === "true", i = this.getAttribute("readonly") === "true";
148
+ this._displayControlBound = !1;
149
+ let a = document.createElement("mint-date-picker");
150
+ a.setAttribute("class", "mint-datetime-picker-date"), a.setAttribute("keep-open-on-select", "true"), a.setAttribute("format", n), a.setAttribute("value", this._dateValue), a.setAttribute("label", e), a.setAttribute("info", t), a.setAttribute("display-format", this.getAttribute("display-format") || "F j, Y");
151
+ for (let e of [
152
+ "min",
153
+ "max",
154
+ "shortcuts"
155
+ ]) this.hasAttribute(e) && a.setAttribute(e, this.getAttribute(e) || "");
156
+ r && a.setAttribute("disabled", "true"), i && a.setAttribute("readonly", "true"), this.hasAttribute("required") && a.setAttribute("required", this.getAttribute("required") || "true"), this.hasAttribute("error") && a.setAttribute("error", this.getAttribute("error") || "false"), this.hasAttribute("error-message") && a.setAttribute("error-message", this.getAttribute("error-message") || ""), a.addEventListener("change", (e) => {
157
+ e.stopPropagation();
158
+ let t = e.detail?.value || a.value || "";
159
+ this._parseDate(t, n) && (this._dateValue = t, this._dateStageComplete = !0, this._syncValue(!1), this._syncCombinedDisplay(), this._openTimeStage());
160
+ }), this._datePicker = a, this._bindCombinedDisplayControl();
161
+ let o = document.createElement("div");
162
+ o.className = "mint-datetime-picker-content", this._content = o, this.innerHTML = "", this.appendChild(o), o.appendChild(a), this._hiddenInput = document.createElement("input"), this._hiddenInput.type = "hidden", this._hiddenInput.name = this.getAttribute("name") || "", this._hiddenInput.value = this.getValue(), this.appendChild(this._hiddenInput), this._waitForPopover();
163
+ }
164
+ _getPopover() {
165
+ let e = this._datePicker, t = e?.getPopoverElement?.() || e?._popover;
166
+ if (t) return t;
167
+ let n = e?.querySelector?.(".mint-date-picker-icon-button")?.id;
168
+ return n ? document.querySelector(`mint-popover[trigger-id="${CSS.escape(n)}"]`) : null;
169
+ }
170
+ _getPopoverContent(e) {
171
+ return e.querySelector(".popover-content") || e;
172
+ }
173
+ _waitForPopover(e = 0) {
174
+ let t = this._getPopover();
175
+ if (!t) {
176
+ e < 120 && requestAnimationFrame(() => this._waitForPopover(e + 1));
177
+ return;
178
+ }
179
+ if (this._popoverContent = this._datePicker?.getPopoverContentElement?.() || this._getPopoverContent(t), this._bindCombinedDisplayControl(), this._syncCombinedDisplay(), this._popoverObserver?.disconnect(), this._popoverObserver = new MutationObserver(() => {
180
+ if (t.getAttribute("open") === "true") {
181
+ let e = this._datePicker;
182
+ typeof e?.refreshCalendar == "function" ? e.refreshCalendar() : e?._buildCalendar?.();
183
+ }
184
+ }), this._popoverObserver.observe(t, {
185
+ attributes: !0,
186
+ attributeFilter: ["open"]
187
+ }), t.getAttribute("open") === "true") {
188
+ let e = this._datePicker;
189
+ typeof e?.refreshCalendar == "function" ? e.refreshCalendar() : e?._buildCalendar?.();
190
+ }
191
+ }
192
+ _bindCombinedDisplayControl() {
193
+ if (this._displayControlBound || !this._datePicker) return;
194
+ this._displayControlBound = !0;
195
+ let e = (e) => {
196
+ if (!e.target?.closest(".mint-date-picker-field") || this.getAttribute("disabled") === "true" || this.getAttribute("readonly") === "true" || e instanceof KeyboardEvent && e.key !== "Enter" && e.key !== " ") return;
197
+ e.preventDefault(), e.stopImmediatePropagation();
198
+ let t = this._getPopover();
199
+ t?.open ? t.open() : t?.setAttribute("open", "true");
200
+ };
201
+ this._datePicker.addEventListener("click", e, !0), this._datePicker.addEventListener("keydown", e, !0);
202
+ }
203
+ _openTimeStage() {
204
+ queueMicrotask(() => this._renderTimeStage());
205
+ }
206
+ _renderTimeStage() {
207
+ if (!this._popoverContent || !this._dateStageComplete) return;
208
+ let e = document.createElement("div");
209
+ e.className = "mint-datetime-picker-panel";
210
+ let t = document.createElement("button");
211
+ t.type = "button", t.className = "mint-datetime-picker-time-heading", t.setAttribute("aria-label", `Change date, ${this._dateValue}`), t.textContent = this._getFormattedDate(), t.addEventListener("click", () => {
212
+ let e = this._datePicker;
213
+ typeof e?.refreshCalendar == "function" ? e.refreshCalendar() : e?._buildCalendar?.();
214
+ });
215
+ let n = document.createElement("mint-time-picker"), r = this.getAttribute("disabled") === "true", i = this.getAttribute("readonly") === "true";
216
+ n.setAttribute("inline", "true"), n.setAttribute("value", this._timeValue || "09:00"), n.setAttribute("label", "");
217
+ for (let e of [
218
+ "hours",
219
+ "minutes",
220
+ "seconds"
221
+ ]) this.hasAttribute(e) && n.setAttribute(e, this.getAttribute(e) || "");
222
+ r && n.setAttribute("disabled", "true"), i && n.setAttribute("readonly", "true"), n.addEventListener("change", () => {
223
+ this._timeValue = n.getValue?.() || n.getAttribute("value") || "", this._syncValue(!0), this._syncCombinedDisplay();
224
+ }), n.addEventListener("change", (e) => e.stopPropagation()), n.addEventListener("input", (e) => e.stopPropagation()), this._timePicker = n, e.appendChild(t), e.appendChild(n), this._popoverContent.replaceChildren(e);
225
+ }
226
+ _syncCombinedDisplay() {
227
+ let e = this._datePicker?.getDisplayElement?.() || this._datePicker?.querySelector(".mint-date-picker-display");
228
+ if (!e || !this._dateValue) return;
229
+ let t = this._getFormattedDate();
230
+ e.textContent = this._timeValue ? `${t} · ${this._formatTime(this._timeValue)}` : t, e.setAttribute("aria-label", `${this.getAttribute("label") || "Date and time"}: ${e.textContent}`);
231
+ }
232
+ _getFormattedDate() {
233
+ let e = this._parseDate(this._dateValue, this.getAttribute("format") || "mm/dd/yyyy");
234
+ return e ? this._formatDate(e, this.getAttribute("display-format") || "F j, Y") : this._dateValue;
235
+ }
236
+ _formatTime(e) {
237
+ let [t = "00", n = "00", r] = e.split(":"), i = Number(t), a = this.getAttribute("hours") !== "false", o = this.getAttribute("minutes") !== "false", s = this.getAttribute("seconds") === "true";
238
+ if (!a) return [o ? n : "", s ? r || "00" : ""].filter(Boolean).join(":");
239
+ let c = i % 12 || 12;
240
+ return `${[
241
+ String(c),
242
+ o ? n : "",
243
+ s ? r || "00" : ""
244
+ ].filter(Boolean).join(":")} ${i >= 12 ? "pm" : "am"}`;
245
+ }
246
+ };
247
+ customElements.get("mint-datetime-picker") || e("mint-datetime-picker", t);
248
+ //#endregion
249
+ export { t as default };
@@ -1 +1 @@
1
- {"version":3,"file":"Form.d.ts","sourceRoot":"","sources":["../../../src/components/form/Form.ts"],"names":[],"mappings":"AAOA,cAAM,QAAS,SAAQ,WAAW;IAChC,MAAM,KAAK,kBAAkB,IAAI,MAAM,EAAE,CAExC;IAED,OAAO,CAAC,KAAK,CAA+B;IAC5C,OAAO,CAAC,cAAc,CAAoC;IAC1D,OAAO,CAAC,kBAAkB,CAAoC;IAC9D,OAAO,CAAC,OAAO,CAA6B;IAC5C,OAAO,CAAC,kBAAkB,CAAkD;IAC5E,OAAO,CAAC,oBAAoB,CAAkD;IAC9E,OAAO,CAAC,SAAS,CAAgC;IACjD,OAAO,CAAC,SAAS,CAAmC;IACpD,OAAO,CAAC,QAAQ,CAAsC;IACtD,OAAO,CAAC,aAAa,CAAuE;IAC5F,uFAAuF;IACvF,OAAO,CAAC,yBAAyB,CAAkC;IACnE,OAAO,CAAC,2BAA2B,CAGhC;IACH,OAAO,CAAC,0BAA0B,CAAkE;IACpG,OAAO,CAAC,4BAA4B,CAAwC;IAC5E,OAAO,CAAC,kBAAkB,CAAY;IACtC,OAAO,CAAC,qBAAqB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