@tpc-mare/mare-ui-components-react 0.1.4 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/dist/accordion/Accordion.d.ts +2 -0
  2. package/dist/accordion/Accordion.types.d.ts +20 -0
  3. package/dist/accordion/index.d.ts +2 -0
  4. package/dist/accordion/index.js +4 -0
  5. package/dist/checkbox/index.js +1 -1
  6. package/dist/combobox/index.js +1 -1
  7. package/dist/date-picker/DatePicker.d.ts +3 -0
  8. package/dist/date-picker/DatePicker.types.d.ts +52 -0
  9. package/dist/date-picker/index.d.ts +2 -0
  10. package/dist/date-picker/index.js +4 -0
  11. package/dist/dialog/index.js +1 -1
  12. package/dist/drawer/index.js +1 -1
  13. package/dist/index/index.d.ts +12 -0
  14. package/dist/index/index.js +59 -46
  15. package/dist/paginator/Paginator.d.ts +2 -0
  16. package/dist/paginator/Paginator.types.d.ts +21 -0
  17. package/dist/paginator/index.d.ts +2 -0
  18. package/dist/paginator/index.js +4 -0
  19. package/dist/panel-menu/PanelMenu.d.ts +2 -0
  20. package/dist/panel-menu/PanelMenu.types.d.ts +12 -0
  21. package/dist/panel-menu/index.d.ts +2 -0
  22. package/dist/panel-menu/index.js +4 -0
  23. package/dist/search-field/index.js +1 -1
  24. package/dist/select-field/index.js +1 -1
  25. package/dist/shared/Accordion-E6aTw9ir.js +63 -0
  26. package/dist/shared/{Checkbox-DsM70wQl.js → Checkbox-fis7v2xS.js} +12 -12
  27. package/dist/shared/{Combobox-DeUG_muZ.js → Combobox-DK6nHqAL.js} +1 -1
  28. package/dist/shared/DatePicker-CF9y6eAm.js +856 -0
  29. package/dist/shared/{DialogFooter-DLWy6Mln.js → DialogFooter-BwEB19v9.js} +1 -1
  30. package/dist/shared/{DrawerFooter-DvUgumx0.js → DrawerFooter-C0SLP8KU.js} +1 -1
  31. package/dist/shared/Paginator-CcN6wND7.js +164 -0
  32. package/dist/shared/PanelMenu-Ch4NsZD_.js +123 -0
  33. package/dist/shared/{SearchField-CgDz_s1O.js → SearchField-DuA4ZkBL.js} +1 -1
  34. package/dist/shared/{SelectField-BSTmWjYy.js → SelectField-DNlX8uuG.js} +1 -1
  35. package/dist/shared/Snackbar-C29nLHO9.js +100 -0
  36. package/dist/shared/Stepper-BYRV6yan.js +110 -0
  37. package/dist/shared/icons-Dfn6EUcz.js +46 -0
  38. package/dist/shared/icons.d.ts +6 -0
  39. package/dist/shared/useMediaQuery.d.ts +5 -0
  40. package/dist/snackbar/Snackbar.d.ts +3 -0
  41. package/dist/snackbar/Snackbar.types.d.ts +42 -0
  42. package/dist/snackbar/index.d.ts +2 -0
  43. package/dist/snackbar/index.js +5 -0
  44. package/dist/stepper/Stepper.d.ts +2 -0
  45. package/dist/stepper/Stepper.types.d.ts +18 -0
  46. package/dist/stepper/index.d.ts +2 -0
  47. package/dist/stepper/index.js +4 -0
  48. package/dist/styles.css +1 -1
  49. package/dist/utilities-standalone.css +1 -0
  50. package/package.json +4 -6
  51. package/dist/shared/icons-DeVfnVLm.js +0 -37
@@ -0,0 +1,856 @@
1
+ import { jsxs as u, jsx as l, Fragment as ne } from "react/jsx-runtime";
2
+ import { useState as er, useEffect as rr, useMemo as oe } from "react";
3
+ import { DatePickerRoot as ar, DatePickerLabel as tr, DatePickerControl as nr, DatePickerTrigger as or, DatePickerContext as le, DatePickerClearTrigger as lr, DatePickerPositioner as ir, DatePickerContent as cr, DatePickerView as j, DatePickerViewControl as sr, DatePickerPrevTrigger as mr, DatePickerViewTrigger as dr, DatePickerRangeText as ie, DatePickerNextTrigger as ur, DatePickerTable as $e, DatePickerTableHead as hr, DatePickerTableRow as G, DatePickerTableHeader as fr, DatePickerTableBody as ge, DatePickerTableCell as be, DatePickerTableCellTrigger as xe } from "@ark-ui/react/date-picker";
4
+ import { Portal as yr } from "@ark-ui/react/portal";
5
+ import { h as pr, b as $r, d as gr, e as br } from "./icons-Dfn6EUcz.js";
6
+ function O(e, r) {
7
+ return e - r * Math.floor(e / r);
8
+ }
9
+ const we = 1721426;
10
+ function N(e, r, a, t) {
11
+ r = K(e, r);
12
+ let n = r - 1, o = -2;
13
+ return a <= 2 ? o = 0 : Y(r) && (o = -1), we - 1 + 365 * n + Math.floor(n / 4) - Math.floor(n / 100) + Math.floor(n / 400) + Math.floor((367 * a - 362) / 12 + o + t);
14
+ }
15
+ function Y(e) {
16
+ return e % 4 === 0 && (e % 100 !== 0 || e % 400 === 0);
17
+ }
18
+ function K(e, r) {
19
+ return e === "BC" ? 1 - r : r;
20
+ }
21
+ function xr(e) {
22
+ let r = "AD";
23
+ return e <= 0 && (r = "BC", e = 1 - e), [
24
+ r,
25
+ e
26
+ ];
27
+ }
28
+ const wr = {
29
+ standard: [
30
+ 31,
31
+ 28,
32
+ 31,
33
+ 30,
34
+ 31,
35
+ 30,
36
+ 31,
37
+ 31,
38
+ 30,
39
+ 31,
40
+ 30,
41
+ 31
42
+ ],
43
+ leapyear: [
44
+ 31,
45
+ 29,
46
+ 31,
47
+ 30,
48
+ 31,
49
+ 30,
50
+ 31,
51
+ 31,
52
+ 30,
53
+ 31,
54
+ 30,
55
+ 31
56
+ ]
57
+ };
58
+ class P {
59
+ fromJulianDay(r) {
60
+ let a = r, t = a - we, n = Math.floor(t / 146097), o = O(t, 146097), i = Math.floor(o / 36524), m = O(o, 36524), d = Math.floor(m / 1461), h = O(m, 1461), g = Math.floor(h / 365), A = n * 400 + i * 100 + d * 4 + g + (i !== 4 && g !== 4 ? 1 : 0), [y, p] = xr(A), M = a - N(y, p, 1, 1), b = 2;
61
+ a < N(y, p, 3, 1) ? b = 0 : Y(p) && (b = 1);
62
+ let I = Math.floor(((M + b) * 12 + 373) / 367), B = a - N(y, p, I, 1) + 1;
63
+ return new v(y, p, I, B);
64
+ }
65
+ toJulianDay(r) {
66
+ return N(r.era, r.year, r.month, r.day);
67
+ }
68
+ getDaysInMonth(r) {
69
+ return wr[Y(r.year) ? "leapyear" : "standard"][r.month - 1];
70
+ }
71
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
72
+ getMonthsInYear(r) {
73
+ return 12;
74
+ }
75
+ getDaysInYear(r) {
76
+ return Y(r.year) ? 366 : 365;
77
+ }
78
+ getMaximumMonthsInYear() {
79
+ return 12;
80
+ }
81
+ getMaximumDaysInMonth() {
82
+ return 31;
83
+ }
84
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
85
+ getYearsInEra(r) {
86
+ return 9999;
87
+ }
88
+ getEras() {
89
+ return [
90
+ "BC",
91
+ "AD"
92
+ ];
93
+ }
94
+ isInverseEra(r) {
95
+ return r.era === "BC";
96
+ }
97
+ balanceDate(r) {
98
+ r.year <= 0 && (r.era = r.era === "BC" ? "AD" : "BC", r.year = 1 - r.year);
99
+ }
100
+ constructor() {
101
+ this.identifier = "gregory";
102
+ }
103
+ }
104
+ function Mr(e, r) {
105
+ return e.isEqual?.(r) ?? r.isEqual?.(e) ?? e.identifier === r.identifier;
106
+ }
107
+ function Me(e, r) {
108
+ return e.calendar.toJulianDay(e) - r.calendar.toJulianDay(r);
109
+ }
110
+ function Dr(e, r) {
111
+ return ce(e) - ce(r);
112
+ }
113
+ function ce(e) {
114
+ return e.hour * 36e5 + e.minute * 6e4 + e.second * 1e3 + e.millisecond;
115
+ }
116
+ let L = null, kr = !1;
117
+ function Z() {
118
+ return L == null && (L = new Intl.DateTimeFormat().resolvedOptions().timeZone), L;
119
+ }
120
+ function De() {
121
+ return kr;
122
+ }
123
+ function se(e) {
124
+ e = X(e, new P());
125
+ let r = K(e.era, e.year);
126
+ return ke(r, e.month, e.day, e.hour, e.minute, e.second, e.millisecond);
127
+ }
128
+ function ke(e, r, a, t, n, o, i) {
129
+ let m = /* @__PURE__ */ new Date();
130
+ return m.setUTCHours(t, n, o, i), m.setUTCFullYear(e, r - 1, a), m.getTime();
131
+ }
132
+ function me(e, r) {
133
+ if (r === "UTC") return 0;
134
+ if (e > 0 && r === Z() && !De()) return new Date(e).getTimezoneOffset() * -6e4;
135
+ let { year: a, month: t, day: n, hour: o, minute: i, second: m } = ve(e, r);
136
+ return ke(a, t, n, o, i, m, 0) - Math.floor(e / 1e3) * 1e3;
137
+ }
138
+ const de = /* @__PURE__ */ new Map();
139
+ function ve(e, r) {
140
+ let a = de.get(r);
141
+ a || (a = new Intl.DateTimeFormat("en-US", {
142
+ timeZone: r,
143
+ hour12: !1,
144
+ era: "short",
145
+ year: "numeric",
146
+ month: "numeric",
147
+ day: "numeric",
148
+ hour: "numeric",
149
+ minute: "numeric",
150
+ second: "numeric"
151
+ }), de.set(r, a));
152
+ let t = a.formatToParts(new Date(e)), n = {};
153
+ for (let o of t) o.type !== "literal" && (n[o.type] = o.value);
154
+ return {
155
+ // Firefox returns B instead of BC... https://bugzilla.mozilla.org/show_bug.cgi?id=1752253
156
+ year: n.era === "BC" || n.era === "B" ? -n.year + 1 : +n.year,
157
+ month: +n.month,
158
+ day: +n.day,
159
+ hour: n.hour === "24" ? 0 : +n.hour,
160
+ minute: +n.minute,
161
+ second: +n.second
162
+ };
163
+ }
164
+ const ue = 864e5;
165
+ function vr(e, r, a, t) {
166
+ return (a === t ? [
167
+ a
168
+ ] : [
169
+ a,
170
+ t
171
+ ]).filter((o) => Tr(e, r, o));
172
+ }
173
+ function Tr(e, r, a) {
174
+ let t = ve(a, r);
175
+ return e.year === t.year && e.month === t.month && e.day === t.day && e.hour === t.hour && e.minute === t.minute && e.second === t.second;
176
+ }
177
+ function Ir(e, r, a = "compatible") {
178
+ let t = Ie(e);
179
+ if (r === "UTC") return se(t);
180
+ if (r === Z() && a === "compatible" && !De()) {
181
+ t = X(t, new P());
182
+ let d = /* @__PURE__ */ new Date(), h = K(t.era, t.year);
183
+ return d.setFullYear(h, t.month - 1, t.day), d.setHours(t.hour, t.minute, t.second, t.millisecond), d.getTime();
184
+ }
185
+ let n = se(t), o = me(n - ue, r), i = me(n + ue, r), m = vr(t, r, n - o, n - i);
186
+ if (m.length === 1) return m[0];
187
+ if (m.length > 1) switch (a) {
188
+ // 'compatible' means 'earlier' for "fall back" transitions
189
+ case "compatible":
190
+ case "earlier":
191
+ return m[0];
192
+ case "later":
193
+ return m[m.length - 1];
194
+ case "reject":
195
+ throw new RangeError("Multiple possible absolute times found");
196
+ }
197
+ switch (a) {
198
+ case "earlier":
199
+ return Math.min(n - o, n - i);
200
+ // 'compatible' means 'later' for "spring forward" transitions
201
+ case "compatible":
202
+ case "later":
203
+ return Math.max(n - o, n - i);
204
+ case "reject":
205
+ throw new RangeError("No such absolute time found");
206
+ }
207
+ }
208
+ function Te(e, r, a = "compatible") {
209
+ return new Date(Ir(e, r, a));
210
+ }
211
+ function Ie(e, r) {
212
+ let a = 0, t = 0, n = 0, o = 0;
213
+ if ("timeZone" in e) ({ hour: a, minute: t, second: n, millisecond: o } = e);
214
+ else if ("hour" in e && !r) return e;
215
+ return r && ({ hour: a, minute: t, second: n, millisecond: o } = r), new T(e.calendar, e.era, e.year, e.month, e.day, a, t, n, o);
216
+ }
217
+ function X(e, r) {
218
+ if (Mr(e.calendar, r)) return e;
219
+ let a = r.fromJulianDay(e.calendar.toJulianDay(e)), t = e.copy();
220
+ return t.calendar = r, t.era = a.era, t.year = a.year, t.month = a.month, t.day = a.day, x(t), t;
221
+ }
222
+ function ee(e, r) {
223
+ let a = e.copy(), t = "hour" in a ? Pr(a, r) : 0;
224
+ W(a, r.years || 0), a.calendar.balanceYearMonth && a.calendar.balanceYearMonth(a, e), a.month += r.months || 0, Q(a), Ne(a), a.day += (r.weeks || 0) * 7, a.day += r.days || 0, a.day += t, Nr(a), a.calendar.balanceDate && a.calendar.balanceDate(a), a.year < 1 && (a.year = 1, a.month = 1, a.day = 1);
225
+ let n = a.calendar.getYearsInEra(a);
226
+ if (a.year > n) {
227
+ let i = a.calendar.isInverseEra?.(a);
228
+ a.year = n, a.month = i ? 1 : a.calendar.getMonthsInYear(a), a.day = i ? 1 : a.calendar.getDaysInMonth(a);
229
+ }
230
+ a.month < 1 && (a.month = 1, a.day = 1);
231
+ let o = a.calendar.getMonthsInYear(a);
232
+ return a.month > o && (a.month = o, a.day = a.calendar.getDaysInMonth(a)), a.day = Math.max(1, Math.min(a.calendar.getDaysInMonth(a), a.day)), a;
233
+ }
234
+ function W(e, r) {
235
+ e.calendar.isInverseEra?.(e) && (r = -r), e.year += r;
236
+ }
237
+ function Q(e) {
238
+ for (; e.month < 1; )
239
+ W(e, -1), e.month += e.calendar.getMonthsInYear(e);
240
+ let r = 0;
241
+ for (; e.month > (r = e.calendar.getMonthsInYear(e)); )
242
+ e.month -= r, W(e, 1);
243
+ }
244
+ function Nr(e) {
245
+ for (; e.day < 1; )
246
+ e.month--, Q(e), e.day += e.calendar.getDaysInMonth(e);
247
+ for (; e.day > e.calendar.getDaysInMonth(e); )
248
+ e.day -= e.calendar.getDaysInMonth(e), e.month++, Q(e);
249
+ }
250
+ function Ne(e) {
251
+ e.month = Math.max(1, Math.min(e.calendar.getMonthsInYear(e), e.month)), e.day = Math.max(1, Math.min(e.calendar.getDaysInMonth(e), e.day));
252
+ }
253
+ function x(e) {
254
+ e.calendar.constrainDate && e.calendar.constrainDate(e), e.year = Math.max(1, Math.min(e.calendar.getYearsInEra(e), e.year)), Ne(e);
255
+ }
256
+ function Cr(e) {
257
+ let r = {};
258
+ for (let a in e) typeof e[a] == "number" && (r[a] = -e[a]);
259
+ return r;
260
+ }
261
+ function Ce(e, r) {
262
+ return ee(e, Cr(r));
263
+ }
264
+ function Se(e, r) {
265
+ let a = e.copy();
266
+ return r.era != null && (a.era = r.era), r.year != null && (a.year = r.year), r.month != null && (a.month = r.month), r.day != null && (a.day = r.day), x(a), a;
267
+ }
268
+ function Sr(e, r) {
269
+ let a = e.copy();
270
+ return r.hour != null && (a.hour = r.hour), r.minute != null && (a.minute = r.minute), r.second != null && (a.second = r.second), r.millisecond != null && (a.millisecond = r.millisecond), Er(a), a;
271
+ }
272
+ function Yr(e) {
273
+ e.second += Math.floor(e.millisecond / 1e3), e.millisecond = C(e.millisecond, 1e3), e.minute += Math.floor(e.second / 60), e.second = C(e.second, 60), e.hour += Math.floor(e.minute / 60), e.minute = C(e.minute, 60);
274
+ let r = Math.floor(e.hour / 24);
275
+ return e.hour = C(e.hour, 24), r;
276
+ }
277
+ function Er(e) {
278
+ e.millisecond = Math.max(0, Math.min(e.millisecond, 1e3)), e.second = Math.max(0, Math.min(e.second, 59)), e.minute = Math.max(0, Math.min(e.minute, 59)), e.hour = Math.max(0, Math.min(e.hour, 23));
279
+ }
280
+ function C(e, r) {
281
+ let a = e % r;
282
+ return a < 0 && (a += r), a;
283
+ }
284
+ function Pr(e, r) {
285
+ return e.hour += r.hours || 0, e.minute += r.minutes || 0, e.second += r.seconds || 0, e.millisecond += r.milliseconds || 0, Yr(e);
286
+ }
287
+ function Ye(e, r, a, t) {
288
+ let n = e.copy();
289
+ switch (r) {
290
+ case "era": {
291
+ let o = e.calendar.getEras(), i = o.indexOf(e.era);
292
+ if (i < 0) throw new Error("Invalid era: " + e.era);
293
+ i = f(i, a, 0, o.length - 1, t?.round), n.era = o[i], x(n);
294
+ break;
295
+ }
296
+ case "year":
297
+ n.calendar.isInverseEra?.(n) && (a = -a), n.year = f(e.year, a, -1 / 0, 9999, t?.round), n.year === -1 / 0 && (n.year = 1), n.calendar.balanceYearMonth && n.calendar.balanceYearMonth(n, e);
298
+ break;
299
+ case "month":
300
+ n.month = f(e.month, a, 1, e.calendar.getMonthsInYear(e), t?.round);
301
+ break;
302
+ case "day":
303
+ n.day = f(e.day, a, 1, e.calendar.getDaysInMonth(e), t?.round);
304
+ break;
305
+ default:
306
+ throw new Error("Unsupported field " + r);
307
+ }
308
+ return e.calendar.balanceDate && e.calendar.balanceDate(n), x(n), n;
309
+ }
310
+ function Vr(e, r, a, t) {
311
+ let n = e.copy();
312
+ switch (r) {
313
+ case "hour": {
314
+ let o = e.hour, i = 0, m = 23;
315
+ if (t?.hourCycle === 12) {
316
+ let d = o >= 12;
317
+ i = d ? 12 : 0, m = d ? 23 : 11;
318
+ }
319
+ n.hour = f(o, a, i, m, t?.round);
320
+ break;
321
+ }
322
+ case "minute":
323
+ n.minute = f(e.minute, a, 0, 59, t?.round);
324
+ break;
325
+ case "second":
326
+ n.second = f(e.second, a, 0, 59, t?.round);
327
+ break;
328
+ case "millisecond":
329
+ n.millisecond = f(e.millisecond, a, 0, 999, t?.round);
330
+ break;
331
+ default:
332
+ throw new Error("Unsupported field " + r);
333
+ }
334
+ return n;
335
+ }
336
+ function f(e, r, a, t, n = !1) {
337
+ if (n) {
338
+ e += Math.sign(r), e < a && (e = t);
339
+ let o = Math.abs(r);
340
+ r > 0 ? e = Math.ceil(e / o) * o : e = Math.floor(e / o) * o, e > t && (e = a);
341
+ } else
342
+ e += r, e < a ? e = t - (a - e - 1) : e > t && (e = a + (e - t - 1));
343
+ return e;
344
+ }
345
+ function Ar(e) {
346
+ return `${String(e.hour).padStart(2, "0")}:${String(e.minute).padStart(2, "0")}:${String(e.second).padStart(2, "0")}${e.millisecond ? String(e.millisecond / 1e3).slice(1) : ""}`;
347
+ }
348
+ function Ee(e) {
349
+ let r = X(e, new P()), a;
350
+ return r.era === "BC" ? a = r.year === 1 ? "0000" : "-" + String(Math.abs(1 - r.year)).padStart(6, "00") : a = String(r.year).padStart(4, "0"), `${a}-${String(r.month).padStart(2, "0")}-${String(r.day).padStart(2, "0")}`;
351
+ }
352
+ function Br(e) {
353
+ return `${Ee(e)}T${Ar(e)}`;
354
+ }
355
+ function Pe(e) {
356
+ let r = typeof e[0] == "object" ? e.shift() : new P(), a;
357
+ if (typeof e[0] == "string") a = e.shift();
358
+ else {
359
+ let i = r.getEras();
360
+ a = i[i.length - 1];
361
+ }
362
+ let t = e.shift(), n = e.shift(), o = e.shift();
363
+ return [
364
+ r,
365
+ a,
366
+ t,
367
+ n,
368
+ o
369
+ ];
370
+ }
371
+ class v {
372
+ // This prevents TypeScript from allowing other types with the same fields to match.
373
+ // i.e. a ZonedDateTime should not be be passable to a parameter that expects CalendarDate.
374
+ // If that behavior is desired, use the AnyCalendarDate interface instead.
375
+ // @ts-ignore
376
+ #e;
377
+ constructor(...r) {
378
+ let [a, t, n, o, i] = Pe(r);
379
+ this.calendar = a, this.era = t, this.year = n, this.month = o, this.day = i, x(this);
380
+ }
381
+ /** Returns a copy of this date. */
382
+ copy() {
383
+ return this.era ? new v(this.calendar, this.era, this.year, this.month, this.day) : new v(this.calendar, this.year, this.month, this.day);
384
+ }
385
+ /** Returns a new `CalendarDate` with the given duration added to it. */
386
+ add(r) {
387
+ return ee(this, r);
388
+ }
389
+ /** Returns a new `CalendarDate` with the given duration subtracted from it. */
390
+ subtract(r) {
391
+ return Ce(this, r);
392
+ }
393
+ /**
394
+ * Returns a new `CalendarDate` with the given fields set to the provided values. Other fields
395
+ * will be constrained accordingly.
396
+ */
397
+ set(r) {
398
+ return Se(this, r);
399
+ }
400
+ /**
401
+ * Returns a new `CalendarDate` with the given field adjusted by a specified amount.
402
+ * When the resulting value reaches the limits of the field, it wraps around.
403
+ */
404
+ cycle(r, a, t) {
405
+ return Ye(this, r, a, t);
406
+ }
407
+ /**
408
+ * Converts the date to a native JavaScript Date object, with the time set to midnight in the
409
+ * given time zone.
410
+ */
411
+ toDate(r) {
412
+ return Te(this, r);
413
+ }
414
+ /** Converts the date to an ISO 8601 formatted string. */
415
+ toString() {
416
+ return Ee(this);
417
+ }
418
+ /**
419
+ * Compares this date with another. A negative result indicates that this date is before the given
420
+ * one, and a positive date indicates that it is after.
421
+ */
422
+ compare(r) {
423
+ return Me(this, r);
424
+ }
425
+ }
426
+ class T {
427
+ // This prevents TypeScript from allowing other types with the same fields to match.
428
+ // @ts-ignore
429
+ #e;
430
+ constructor(...r) {
431
+ let [a, t, n, o, i] = Pe(r);
432
+ this.calendar = a, this.era = t, this.year = n, this.month = o, this.day = i, this.hour = r.shift() || 0, this.minute = r.shift() || 0, this.second = r.shift() || 0, this.millisecond = r.shift() || 0, x(this);
433
+ }
434
+ /** Returns a copy of this date. */
435
+ copy() {
436
+ return this.era ? new T(this.calendar, this.era, this.year, this.month, this.day, this.hour, this.minute, this.second, this.millisecond) : new T(this.calendar, this.year, this.month, this.day, this.hour, this.minute, this.second, this.millisecond);
437
+ }
438
+ /** Returns a new `CalendarDateTime` with the given duration added to it. */
439
+ add(r) {
440
+ return ee(this, r);
441
+ }
442
+ /** Returns a new `CalendarDateTime` with the given duration subtracted from it. */
443
+ subtract(r) {
444
+ return Ce(this, r);
445
+ }
446
+ /**
447
+ * Returns a new `CalendarDateTime` with the given fields set to the provided values. Other fields
448
+ * will be constrained accordingly.
449
+ */
450
+ set(r) {
451
+ return Se(Sr(this, r), r);
452
+ }
453
+ /**
454
+ * Returns a new `CalendarDateTime` with the given field adjusted by a specified amount.
455
+ * When the resulting value reaches the limits of the field, it wraps around.
456
+ */
457
+ cycle(r, a, t) {
458
+ switch (r) {
459
+ case "era":
460
+ case "year":
461
+ case "month":
462
+ case "day":
463
+ return Ye(this, r, a, t);
464
+ default:
465
+ return Vr(this, r, a, t);
466
+ }
467
+ }
468
+ /** Converts the date to a native JavaScript Date object in the given time zone. */
469
+ toDate(r, a) {
470
+ return Te(this, r, a);
471
+ }
472
+ /** Converts the date to an ISO 8601 formatted string. */
473
+ toString() {
474
+ return Br(this);
475
+ }
476
+ /**
477
+ * Compares this date with another. A negative result indicates that this date is before the given
478
+ * one, and a positive date indicates that it is after.
479
+ */
480
+ compare(r) {
481
+ let a = Me(this, r);
482
+ return a === 0 ? Dr(this, Ie(r)) : a;
483
+ }
484
+ }
485
+ function Rr(e) {
486
+ const [r, a] = er(
487
+ () => typeof window < "u" && window.matchMedia(e).matches
488
+ );
489
+ return rr(() => {
490
+ const t = window.matchMedia(e), n = () => {
491
+ a(t.matches);
492
+ };
493
+ return n(), t.addEventListener("change", n), () => {
494
+ t.removeEventListener("change", n);
495
+ };
496
+ }, [e]), r;
497
+ }
498
+ const Fr = "(min-width: 640px)", Hr = "mare:relative mare:flex mare:flex-col mare:gap-1.5 mare:w-full", _r = "mare:tpc-typography-label-s mare:text-weak mare:mb-0.5 mare:block", jr = "mare:relative mare:flex mare:items-center mare:w-full", Or = "mare:absolute mare:left-3 mare:top-1/2 mare:-translate-y-1/2 mare:flex mare:items-center mare:pointer-events-none mare:text-weak mare:[&>svg]:size-5", Lr = "mare:absolute mare:right-3 mare:top-1/2 mare:-translate-y-1/2 mare:flex mare:items-center mare:text-weak mare:hover:text-default mare:cursor-pointer mare:[&>svg]:size-4", Ur = {
499
+ medium: "mare:h-12",
500
+ small: "mare:h-10"
501
+ }, zr = (e) => `
502
+ mare:w-full mare:pl-10 mare:pr-9 mare:flex mare:items-center mare:text-left mare:truncate
503
+ mare:tpc-typography-body-m mare:text-default
504
+ mare:border mare:border-strong mare:rounded-input
505
+ mare:outline-none mare:transition-all mare:duration-100 mare:bg-transparent
506
+ mare:cursor-pointer
507
+ mare:focus-visible:outline-solid mare:focus-visible:outline-2 mare:focus-visible:outline-accent mare:focus-visible:-outline-offset-2
508
+ mare:data-[invalid]:outline-solid mare:data-[invalid]:outline-2 mare:data-[invalid]:outline-danger mare:data-[invalid]:-outline-offset-2
509
+ mare:ark-disabled:text-disabled mare:ark-disabled:border-disabled-default mare:ark-disabled:cursor-not-allowed
510
+ ${Ur[e]}
511
+ `, Jr = "mare:text-weak", he = () => `
512
+ mare:z-1103 mare:flex mare:flex-col mare:gap-4 mare:p-4
513
+ mare:bg-raised mare:rounded-tpc-dialog mare:border mare:border-default
514
+ mare:shadow-[0_10px_15px_-3px_rgba(0,0,0,0.10),0_4px_6px_-2px_rgba(0,0,0,0.05)]
515
+ mare:not-ark-inline:ark-open:[animation:mare-menu-enter_150ms_ease-out]
516
+ mare:not-ark-inline:ark-closed:[animation:mare-menu-exit_100ms_ease-in]
517
+ mare:ark-inline:shadow-none mare:ark-inline:border-none mare:ark-inline:p-0
518
+ mare:min-w-90
519
+ `, qr = "mare:flex mare:flex-col mare:sm:flex-row mare:gap-6 mare:sm:gap-10", U = "mare:flex mare:flex-col mare:gap-3 mare:[&[hidden]]:hidden", Gr = "mare:flex mare:items-center mare:justify-between mare:gap-2", Wr = `
520
+ mare:inline-flex mare:items-center mare:justify-center mare:size-8 mare:rounded-full
521
+ mare:text-default mare:cursor-pointer mare:[&>svg]:size-5
522
+ mare:hover:bg-neutral-weak
523
+ mare:focus-visible:outline-solid mare:focus-visible:outline-1 mare:focus-visible:outline-offset-2 mare:focus-visible:outline-accent
524
+ mare:ark-disabled:opacity-40 mare:ark-disabled:cursor-not-allowed mare:ark-disabled:hover:bg-transparent
525
+ `, fe = Wr, Qr = `
526
+ mare:inline-flex mare:items-center mare:gap-1 mare:px-2 mare:py-1 mare:rounded-md
527
+ mare:tpc-typography-label-m mare:text-default mare:cursor-pointer
528
+ mare:hover:bg-neutral-weak
529
+ `, Kr = "mare:inline-flex mare:items-center mare:gap-1 mare:px-2 mare:py-1 mare:tpc-typography-label-m mare:text-default", Ve = "mare:w-full mare:border-collapse", Zr = "mare:tpc-typography-body-s mare:text-default mare:pb-1 mare:font-normal", Ae = "mare:p-0.5 mare:text-center", Be = `
530
+ mare:inline-flex mare:items-center mare:justify-center mare:cursor-pointer mare:rounded-full
531
+ mare:tpc-typography-label-s mare:text-default
532
+ mare:hover:bg-neutral-weak
533
+ mare:ark-focus:outline-solid mare:ark-focus:outline-1 mare:ark-focus:outline-offset-2 mare:ark-focus:outline-accent
534
+ mare:ark-disabled:text-disabled mare:ark-disabled:pointer-events-none
535
+ mare:ark-unavailable:text-disabled mare:ark-unavailable:line-through mare:ark-unavailable:pointer-events-none
536
+ mare:ark-outside-range:text-weak
537
+ mare:ark-today:font-medium mare:ark-today:text-accent
538
+ mare:ark-selected:bg-accent mare:ark-selected:text-on-accent mare:ark-selected:hover:bg-accent
539
+ mare:ark-in-range-only:rounded-none mare:ark-in-range-only:bg-accent-weak mare:ark-in-range-only:text-accent
540
+ mare:ark-range-start:rounded-l-full mare:ark-range-start:rounded-r-none mare:ark-range-start:bg-accent mare:ark-range-start:text-on-accent
541
+ mare:ark-range-end:rounded-r-full mare:ark-range-end:rounded-l-none mare:ark-range-end:bg-accent mare:ark-range-end:text-on-accent
542
+ mare:ark-range-single:rounded-full
543
+ `, Xr = (e) => `
544
+ ${Be} mare:w-10 mare:flex-col mare:gap-0.5
545
+ ${e ? "mare:h-14 mare:rounded-2xl mare:pt-1" : "mare:h-10"}
546
+ `, ea = `${Be} mare:w-full mare:h-10`, ra = {
547
+ positive: "mare:text-positive",
548
+ negative: "mare:text-weak"
549
+ }, aa = "mare:tpc-typography-body-xxs mare:w-full mare:text-center mare:min-h-3.5", ta = "mare:flex mare:items-center mare:justify-between mare:pt-3 mare:border-t mare:border-default", na = "mare:flex mare:items-center mare:gap-2 mare:pt-3 mare:border-t mare:border-default", oa = "mare:tpc-typography-label-s mare:text-weak", la = `
550
+ mare:tpc-typography-body-m mare:text-default mare:bg-transparent
551
+ mare:border mare:border-strong mare:rounded-input mare:px-3 mare:h-10
552
+ mare:outline-none
553
+ mare:focus-visible:outline-solid mare:focus-visible:outline-2 mare:focus-visible:outline-accent mare:focus-visible:-outline-offset-2
554
+ `, w = (e) => String(e).padStart(2, "0"), V = (e) => `${e.getFullYear()}-${w(e.getMonth())}-${w(e.getDate())}`, ia = (e) => new Map(e.map((r) => [V(r.date), r])), ca = (e, r) => e.size === 0 ? null : e.get(V(r))?.price ?? 0, sa = (e, r) => e.get(V(r))?.positive ?? !1, ma = (e, r) => e.get(V(r))?.disabled ?? !1, da = (e, r) => {
555
+ const a = new Date(e);
556
+ return a.setHours(r.hour, r.minute, r.second, 0), a;
557
+ }, ua = (e, r, a) => {
558
+ let t = e.getTime();
559
+ return r && (t = Math.max(t, r.getTime())), a && (t = Math.min(t, a.getTime())), t === e.getTime() ? e : new Date(t);
560
+ }, ha = (e, r) => e && r ? 2 : 1, z = (e) => `${w(e.getDate())}/${w(e.getMonth() + 1)}/${e.getFullYear()}`, fa = (e) => `${w(e.getHours())}:${w(e.getMinutes())}`, E = Z();
561
+ function S(e, r) {
562
+ return r ? new T(
563
+ e.getFullYear(),
564
+ e.getMonth() + 1,
565
+ e.getDate(),
566
+ e.getHours(),
567
+ e.getMinutes(),
568
+ e.getSeconds()
569
+ ) : new v(
570
+ e.getFullYear(),
571
+ e.getMonth() + 1,
572
+ e.getDate()
573
+ );
574
+ }
575
+ const J = (e) => e.toDate(E);
576
+ function ya({ day: e, hasPrices: r, priceMap: a, currency: t }) {
577
+ const n = e.toDate(E), o = r ? ca(a, n) : null;
578
+ return /* @__PURE__ */ u(
579
+ xe,
580
+ {
581
+ className: Xr(r),
582
+ children: [
583
+ /* @__PURE__ */ l("span", { children: e.day }),
584
+ o !== null && /* @__PURE__ */ u(
585
+ "span",
586
+ {
587
+ className: `${aa} ${ra[sa(a, n) ? "positive" : "negative"]}`,
588
+ children: [
589
+ t,
590
+ o
591
+ ]
592
+ }
593
+ )
594
+ ]
595
+ }
596
+ );
597
+ }
598
+ function q({ navigation: e }) {
599
+ return /* @__PURE__ */ u(sr, { className: Gr, children: [
600
+ e && /* @__PURE__ */ l(mr, { className: fe, children: /* @__PURE__ */ l(gr, {}) }),
601
+ e ? /* @__PURE__ */ l(dr, { className: Qr, children: /* @__PURE__ */ l(ie, {}) }) : /* @__PURE__ */ l("span", { className: Kr, children: /* @__PURE__ */ l(ie, {}) }),
602
+ e && /* @__PURE__ */ l(ur, { className: fe, children: /* @__PURE__ */ l(br, {}) })
603
+ ] });
604
+ }
605
+ function ye({
606
+ weeks: e,
607
+ weekDays: r,
608
+ visibleRange: a,
609
+ hasPrices: t,
610
+ priceMap: n,
611
+ currency: o
612
+ }) {
613
+ return /* @__PURE__ */ u($e, { className: Ve, children: [
614
+ /* @__PURE__ */ l(hr, { children: /* @__PURE__ */ l(G, { children: r.map((i, m) => /* @__PURE__ */ l(
615
+ fr,
616
+ {
617
+ className: Zr,
618
+ children: i.short
619
+ },
620
+ m
621
+ )) }) }),
622
+ /* @__PURE__ */ l(ge, { children: e.map((i, m) => /* @__PURE__ */ l(G, { children: i.map((d, h) => /* @__PURE__ */ l(
623
+ be,
624
+ {
625
+ value: d,
626
+ visibleRange: a,
627
+ className: Ae,
628
+ children: /* @__PURE__ */ l(
629
+ ya,
630
+ {
631
+ day: d,
632
+ hasPrices: t,
633
+ priceMap: n,
634
+ currency: o
635
+ }
636
+ )
637
+ },
638
+ h
639
+ )) }, m)) })
640
+ ] });
641
+ }
642
+ function pe({
643
+ cells: e
644
+ }) {
645
+ return /* @__PURE__ */ l($e, { className: Ve, children: /* @__PURE__ */ l(ge, { children: e.map((r, a) => /* @__PURE__ */ l(G, { children: r.map((t) => /* @__PURE__ */ l(
646
+ be,
647
+ {
648
+ value: t.value,
649
+ className: Ae,
650
+ children: /* @__PURE__ */ l(
651
+ xe,
652
+ {
653
+ className: ea,
654
+ children: t.label
655
+ }
656
+ )
657
+ },
658
+ t.value
659
+ )) }, a)) }) });
660
+ }
661
+ function wa({
662
+ value: e = null,
663
+ onValueChange: r,
664
+ selectionMode: a = "single",
665
+ size: t = "medium",
666
+ label: n,
667
+ placeholder: o = "dd/mm/yyyy",
668
+ disabled: i = !1,
669
+ invalid: m = !1,
670
+ minDate: d,
671
+ maxDate: h,
672
+ navigation: g = !0,
673
+ doubleMonth: A = !1,
674
+ inline: y = !1,
675
+ clearable: p = !0,
676
+ prices: M = [],
677
+ currency: b = "$",
678
+ locale: I,
679
+ showTime: B = !1,
680
+ timeOnly: D = !1,
681
+ showSeconds: re = !1,
682
+ footer: R,
683
+ leadingIcon: Re,
684
+ portalContainer: Fe,
685
+ onOpenChange: He,
686
+ onVisibleMonthsChange: _e
687
+ }) {
688
+ const je = Rr(Fr), $ = B || D, ae = ha(je, A), Oe = !D && ae === 2, F = oe(() => ia(M), [M]), H = M.length > 0, Le = oe(() => e == null ? [] : (Array.isArray(e) ? e : [e]).filter(
689
+ (s) => s != null
690
+ ).map((s) => S(s, $)), [e, $]), Ue = (c) => {
691
+ const s = c.value.map((k) => J(k));
692
+ if (a === "range") {
693
+ r?.(
694
+ s.length === 0 ? null : [s[0] ?? null, s[1] ?? null]
695
+ );
696
+ return;
697
+ }
698
+ r?.(s[0] ?? null);
699
+ }, ze = (c, s) => {
700
+ const [k, _, Qe = 0] = s.split(":").map(Number), Ke = c.valueAsDate[0] ?? /* @__PURE__ */ new Date(), Ze = da(Ke, { hour: k, minute: _, second: Qe }), Xe = ua(Ze, d, h);
701
+ c.setValue([S(Xe, !0)]);
702
+ }, Je = (c) => /* @__PURE__ */ u(
703
+ j,
704
+ {
705
+ view: "day",
706
+ className: U,
707
+ children: [
708
+ /* @__PURE__ */ l(q, { navigation: g }),
709
+ /* @__PURE__ */ u("div", { className: qr, children: [
710
+ /* @__PURE__ */ l(
711
+ ye,
712
+ {
713
+ weeks: c.weeks,
714
+ weekDays: c.weekDays,
715
+ hasPrices: H,
716
+ priceMap: F,
717
+ currency: b
718
+ }
719
+ ),
720
+ Oe && (() => {
721
+ const s = c.getOffset({ months: 1 });
722
+ return /* @__PURE__ */ l(
723
+ ye,
724
+ {
725
+ weeks: s.weeks,
726
+ weekDays: c.weekDays,
727
+ visibleRange: s.visibleRange,
728
+ hasPrices: H,
729
+ priceMap: F,
730
+ currency: b
731
+ }
732
+ );
733
+ })()
734
+ ] })
735
+ ]
736
+ }
737
+ ), qe = (c) => /* @__PURE__ */ u(
738
+ j,
739
+ {
740
+ view: "month",
741
+ className: U,
742
+ children: [
743
+ /* @__PURE__ */ l(q, { navigation: g }),
744
+ /* @__PURE__ */ l(
745
+ pe,
746
+ {
747
+ cells: c.getMonthsGrid({
748
+ columns: 4,
749
+ format: "short"
750
+ })
751
+ }
752
+ )
753
+ ]
754
+ }
755
+ ), Ge = (c) => /* @__PURE__ */ u(
756
+ j,
757
+ {
758
+ view: "year",
759
+ className: U,
760
+ children: [
761
+ /* @__PURE__ */ l(q, { navigation: g }),
762
+ /* @__PURE__ */ l(pe, { cells: c.getYearsGrid({ columns: 4 }) })
763
+ ]
764
+ }
765
+ ), We = (c) => {
766
+ const s = c.valueAsDate.at(0), k = s ? `${String(s.getHours()).padStart(2, "0")}:${String(s.getMinutes()).padStart(2, "0")}${re ? `:${String(s.getSeconds()).padStart(2, "0")}` : ""}` : "";
767
+ return /* @__PURE__ */ u("div", { className: na, children: [
768
+ /* @__PURE__ */ l("span", { className: oa, children: "Hora" }),
769
+ /* @__PURE__ */ l(
770
+ "input",
771
+ {
772
+ type: "time",
773
+ step: re ? 1 : void 0,
774
+ value: k,
775
+ disabled: i,
776
+ className: la,
777
+ onChange: (_) => {
778
+ ze(c, _.target.value);
779
+ }
780
+ }
781
+ )
782
+ ] });
783
+ }, te = /* @__PURE__ */ l(le, { children: (c) => /* @__PURE__ */ u(ne, { children: [
784
+ !D && Je(c),
785
+ !D && qe(c),
786
+ !D && Ge(c),
787
+ $ && We(c),
788
+ R && /* @__PURE__ */ l("div", { className: ta, children: R({
789
+ close: () => {
790
+ c.setOpen(!1);
791
+ },
792
+ clear: () => {
793
+ c.clearValue();
794
+ }
795
+ }) })
796
+ ] }) });
797
+ return /* @__PURE__ */ u(
798
+ ar,
799
+ {
800
+ className: Hr,
801
+ selectionMode: a,
802
+ value: Le,
803
+ onValueChange: Ue,
804
+ disabled: i,
805
+ invalid: m,
806
+ inline: y,
807
+ timeZone: E,
808
+ numOfMonths: ae,
809
+ min: d ? S(d, $) : void 0,
810
+ max: h ? S(h, $) : void 0,
811
+ locale: I,
812
+ closeOnSelect: !R && !$,
813
+ isDateUnavailable: H ? (c) => ma(F, c.toDate(E)) : void 0,
814
+ onOpenChange: (c) => He?.(c.open),
815
+ onVisibleRangeChange: (c) => _e?.([
816
+ J(c.visibleRange.start),
817
+ J(c.visibleRange.end)
818
+ ]),
819
+ children: [
820
+ n && /* @__PURE__ */ l(tr, { className: _r, children: n }),
821
+ y ? /* @__PURE__ */ l("div", { className: he(), children: te }) : /* @__PURE__ */ u(ne, { children: [
822
+ /* @__PURE__ */ u(nr, { className: jr, children: [
823
+ /* @__PURE__ */ l("span", { className: Or, children: Re ?? /* @__PURE__ */ l(pr, {}) }),
824
+ /* @__PURE__ */ l(
825
+ or,
826
+ {
827
+ className: zr(t),
828
+ children: /* @__PURE__ */ l(le, { children: (c) => {
829
+ const s = c.valueAsDate;
830
+ return s.length === 0 ? /* @__PURE__ */ l("span", { className: Jr, children: o }) : a === "range" ? /* @__PURE__ */ u("span", { children: [
831
+ z(s[0]),
832
+ s[1] ? ` - ${z(s[1])}` : ""
833
+ ] }) : /* @__PURE__ */ u("span", { children: [
834
+ z(s[0]),
835
+ $ ? ` ${fa(s[0])}` : ""
836
+ ] });
837
+ } })
838
+ }
839
+ ),
840
+ p && /* @__PURE__ */ l(
841
+ lr,
842
+ {
843
+ className: Lr,
844
+ children: /* @__PURE__ */ l($r, {})
845
+ }
846
+ )
847
+ ] }),
848
+ /* @__PURE__ */ l(yr, { container: Fe, children: /* @__PURE__ */ l(ir, { children: /* @__PURE__ */ l(cr, { className: he(), children: te }) }) })
849
+ ] })
850
+ ]
851
+ }
852
+ );
853
+ }
854
+ export {
855
+ wa as D
856
+ };