@serendie/ui 2.1.2 → 2.1.3-dev.202509030422

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 (107) hide show
  1. package/dist/client.js +67 -65
  2. package/dist/components/Accordion/Accordion.d.ts +1 -1
  3. package/dist/components/Avatar/Avatar.d.ts +1 -1
  4. package/dist/components/Banner/Banner.d.ts +1 -1
  5. package/dist/components/BottomNavigation/BottomNavigationItem.d.ts +1 -1
  6. package/dist/components/Button/Button.d.ts +2 -2
  7. package/dist/components/DatePicker/DatePicker.d.ts +13 -0
  8. package/dist/components/DatePicker/DatePicker.js +203 -0
  9. package/dist/components/DatePicker/index.d.ts +1 -0
  10. package/dist/components/DatePicker/index.js +4 -0
  11. package/dist/components/DatePicker/styles.d.ts +1 -0
  12. package/dist/components/DatePicker/styles.js +224 -0
  13. package/dist/components/IconButton/IconButton.d.ts +3 -3
  14. package/dist/components/List/ListItem.d.ts +1 -1
  15. package/dist/components/ModalDialog/ModalDialog.d.ts +1 -1
  16. package/dist/components/NotificationBadge/NotificationBadge.d.ts +1 -1
  17. package/dist/components/Pagination/Pagination.d.ts +1 -1
  18. package/dist/components/Search/Search.d.ts +1 -1
  19. package/dist/components/Select/Select.d.ts +3 -2
  20. package/dist/components/Switch/Switch.d.ts +1 -1
  21. package/dist/components/Tabs/Tabs.d.ts +1 -1
  22. package/dist/components/TextField/TextField.js +59 -156
  23. package/dist/components/Toast/Toast.d.ts +1 -1
  24. package/dist/components/TopAppBar/TopAppBar.d.ts +1 -1
  25. package/dist/index.d.ts +1 -0
  26. package/dist/index.js +67 -65
  27. package/dist/node_modules/@ark-ui/react/dist/components/date-picker/date-picker-content.js +15 -0
  28. package/dist/node_modules/@ark-ui/react/dist/components/date-picker/date-picker-context.js +5 -0
  29. package/dist/node_modules/@ark-ui/react/dist/components/date-picker/date-picker-control.js +13 -0
  30. package/dist/node_modules/@ark-ui/react/dist/components/date-picker/date-picker-input.js +14 -0
  31. package/dist/node_modules/@ark-ui/react/dist/components/date-picker/date-picker-label.js +13 -0
  32. package/dist/node_modules/@ark-ui/react/dist/components/date-picker/date-picker-month-select.js +13 -0
  33. package/dist/node_modules/@ark-ui/react/dist/components/date-picker/date-picker-next-trigger.js +14 -0
  34. package/dist/node_modules/@ark-ui/react/dist/components/date-picker/date-picker-positioner.js +14 -0
  35. package/dist/node_modules/@ark-ui/react/dist/components/date-picker/date-picker-prev-trigger.js +14 -0
  36. package/dist/node_modules/@ark-ui/react/dist/components/date-picker/date-picker-root.js +55 -0
  37. package/dist/node_modules/@ark-ui/react/dist/components/date-picker/date-picker-table-body.js +14 -0
  38. package/dist/node_modules/@ark-ui/react/dist/components/date-picker/date-picker-table-cell-trigger.js +19 -0
  39. package/dist/node_modules/@ark-ui/react/dist/components/date-picker/date-picker-table-cell.js +26 -0
  40. package/dist/node_modules/@ark-ui/react/dist/components/date-picker/date-picker-table-head.js +14 -0
  41. package/dist/node_modules/@ark-ui/react/dist/components/date-picker/date-picker-table-header.js +14 -0
  42. package/dist/node_modules/@ark-ui/react/dist/components/date-picker/date-picker-table-row.js +14 -0
  43. package/dist/node_modules/@ark-ui/react/dist/components/date-picker/date-picker-table.js +16 -0
  44. package/dist/node_modules/@ark-ui/react/dist/components/date-picker/date-picker-trigger.js +13 -0
  45. package/dist/node_modules/@ark-ui/react/dist/components/date-picker/date-picker-view-control.js +14 -0
  46. package/dist/node_modules/@ark-ui/react/dist/components/date-picker/date-picker-view.js +23 -0
  47. package/dist/node_modules/@ark-ui/react/dist/components/date-picker/date-picker-year-select.js +13 -0
  48. package/dist/node_modules/@ark-ui/react/dist/components/date-picker/date-picker.anatomy.js +5 -0
  49. package/dist/node_modules/@ark-ui/react/dist/components/date-picker/use-date-picker-context.js +10 -0
  50. package/dist/node_modules/@ark-ui/react/dist/components/date-picker/use-date-picker-table-cell-props-context.js +10 -0
  51. package/dist/node_modules/@ark-ui/react/dist/components/date-picker/use-date-picker-table-props-context.js +10 -0
  52. package/dist/node_modules/@ark-ui/react/dist/components/date-picker/use-date-picker-view-props-context.js +12 -0
  53. package/dist/node_modules/@ark-ui/react/dist/components/date-picker/use-date-picker.js +18 -0
  54. package/dist/node_modules/@ark-ui/react/dist/components/factory.js +11 -12
  55. package/dist/node_modules/@ark-ui/react/dist/components/menu/menu-root.js +5 -4
  56. package/dist/node_modules/@ark-ui/react/dist/utils/use-event.js +0 -1
  57. package/dist/node_modules/@floating-ui/core/dist/floating-ui.core.js +36 -36
  58. package/dist/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +238 -235
  59. package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js +88 -83
  60. package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +68 -67
  61. package/dist/node_modules/@internationalized/date/dist/CalendarDate.js +178 -0
  62. package/dist/node_modules/@internationalized/date/dist/DateFormatter.js +99 -0
  63. package/dist/node_modules/@internationalized/date/dist/GregorianCalendar.js +98 -0
  64. package/dist/node_modules/@internationalized/date/dist/conversion.js +135 -0
  65. package/dist/node_modules/@internationalized/date/dist/manipulation.js +205 -0
  66. package/dist/node_modules/@internationalized/date/dist/queries.js +202 -0
  67. package/dist/node_modules/@internationalized/date/dist/string.js +27 -0
  68. package/dist/node_modules/@internationalized/date/dist/utils.js +6 -0
  69. package/dist/node_modules/@internationalized/date/dist/weekStartData.js +100 -0
  70. package/dist/node_modules/@swc/helpers/esm/_check_private_redeclaration.js +7 -0
  71. package/dist/node_modules/@swc/helpers/esm/_class_private_field_init.js +7 -0
  72. package/dist/node_modules/@zag-js/anatomy/dist/index.js +15 -14
  73. package/dist/node_modules/@zag-js/aria-hidden/dist/index.js +23 -23
  74. package/dist/node_modules/@zag-js/collection/dist/index.js +102 -71
  75. package/dist/node_modules/@zag-js/combobox/dist/index.js +482 -426
  76. package/dist/node_modules/@zag-js/date-picker/dist/index.js +1820 -0
  77. package/dist/node_modules/@zag-js/date-utils/dist/index.js +366 -0
  78. package/dist/node_modules/@zag-js/dialog/dist/index.js +66 -64
  79. package/dist/node_modules/@zag-js/dismissable/dist/index.js +94 -69
  80. package/dist/node_modules/@zag-js/dom-query/dist/index.js +359 -300
  81. package/dist/node_modules/@zag-js/live-region/dist/index.js +39 -0
  82. package/dist/node_modules/@zag-js/menu/dist/index.js +357 -340
  83. package/dist/node_modules/@zag-js/popper/dist/index.js +123 -120
  84. package/dist/node_modules/@zag-js/presence/dist/index.js +17 -17
  85. package/dist/node_modules/@zag-js/radio-group/dist/index.js +118 -117
  86. package/dist/node_modules/@zag-js/react/dist/index.js +124 -121
  87. package/dist/node_modules/@zag-js/select/dist/index.js +211 -197
  88. package/dist/node_modules/@zag-js/toast/dist/index.js +73 -71
  89. package/dist/node_modules/@zag-js/tooltip/dist/index.js +31 -30
  90. package/dist/node_modules/@zag-js/utils/dist/index.js +150 -104
  91. package/dist/preset.d.ts +3 -1
  92. package/dist/recipes/index.d.ts +3 -2
  93. package/dist/recipes/index.js +5 -2
  94. package/dist/recipes/textFieldRecipe.d.ts +6 -0
  95. package/dist/recipes/textFieldRecipe.js +107 -0
  96. package/dist/styled-system/css/cva.js +43 -38
  97. package/dist/styled-system/recipes/create-recipe.js +37 -0
  98. package/dist/styled-system/recipes/text-field-recipe.js +61 -0
  99. package/dist/styles.css +1 -1
  100. package/package.json +3 -3
  101. package/styled-system/recipes/create-recipe.js +82 -0
  102. package/styled-system/recipes/index.d.ts +2 -0
  103. package/styled-system/recipes/index.js +1 -0
  104. package/styled-system/recipes/text-field-recipe.d.ts +28 -0
  105. package/styled-system/recipes/text-field-recipe.js +72 -0
  106. package/dist/node_modules/@zag-js/store/dist/index.js +0 -131
  107. package/dist/node_modules/proxy-compare/dist/index.js +0 -7
@@ -0,0 +1,1820 @@
1
+ import { createAnatomy as Qe } from "../../anatomy/dist/index.js";
2
+ import { isEqualDay as De, isWeekend as ze, isToday as et } from "../../../@internationalized/date/dist/queries.js";
3
+ import { DateFormatter as te } from "../../../@internationalized/date/dist/DateFormatter.js";
4
+ import { getWeekDays as tt, getDateRangePreset as pe, getDecadeRange as ae, constrainValue as F, getTodayDate as U, getMonthFormatter as he, getDaysInWeek as at, isDateOutsideRange as $, getDayFormatter as nt, getUnitDuration as ot, isDateEqual as C, isDateUnavailable as we, getMonthNames as st, getYearsRange as rt, getMonthDays as it, getEndDate as lt, alignDate as Ce, getPreviousSection as ct, getNextSection as ut, getPreviousPage as dt, getNextPage as gt, formatSelectedDate as vt, isNextRangeInvalid as ft, isPreviousRangeInvalid as Vt, parseDateString as mt, getAdjustedDateFn as yt } from "../../date-utils/dist/index.js";
5
+ import { getNativeEvent as Tt, dataAttr as u, ariaAttr as w, getEventKey as St, isComposingEvent as Et, queryAll as bt, setElementValue as j, raf as M, query as Dt, restoreTextSelection as pt, disableTextSelection as ht } from "../../dom-query/dist/index.js";
6
+ import { getPlacementStyles as wt, getPlacement as Ct } from "../../popper/dist/index.js";
7
+ import { chunk as Pe, isValueWithinRange as Oe, match as Q, clampValue as Pt } from "../../utils/dist/index.js";
8
+ import { createMachine as Ot, createGuards as It } from "../../core/dist/index.js";
9
+ import { trackDismissableElement as Rt } from "../../dismissable/dist/index.js";
10
+ import { createLiveRegion as xt } from "../../live-region/dist/index.js";
11
+ import { createProps as H } from "../../types/dist/index.js";
12
+ var At = Qe("date-picker").parts(
13
+ "clearTrigger",
14
+ "content",
15
+ "control",
16
+ "input",
17
+ "label",
18
+ "monthSelect",
19
+ "nextTrigger",
20
+ "positioner",
21
+ "presetTrigger",
22
+ "prevTrigger",
23
+ "rangeText",
24
+ "root",
25
+ "table",
26
+ "tableBody",
27
+ "tableCell",
28
+ "tableCellTrigger",
29
+ "tableHead",
30
+ "tableHeader",
31
+ "tableRow",
32
+ "trigger",
33
+ "view",
34
+ "viewControl",
35
+ "viewTrigger",
36
+ "yearSelect"
37
+ ), v = At.build(), Lt = (e, t) => {
38
+ var a, n;
39
+ return ((n = (a = e.ids) == null ? void 0 : a.label) == null ? void 0 : n.call(a, t)) ?? `datepicker:${e.id}:label:${t}`;
40
+ }, kt = (e) => {
41
+ var t;
42
+ return ((t = e.ids) == null ? void 0 : t.root) ?? `datepicker:${e.id}`;
43
+ }, Nt = (e, t) => {
44
+ var a, n;
45
+ return ((n = (a = e.ids) == null ? void 0 : a.table) == null ? void 0 : n.call(a, t)) ?? `datepicker:${e.id}:table:${t}`;
46
+ }, de = (e) => {
47
+ var t;
48
+ return ((t = e.ids) == null ? void 0 : t.content) ?? `datepicker:${e.id}:content`;
49
+ }, ue = (e, t) => {
50
+ var a, n;
51
+ return ((n = (a = e.ids) == null ? void 0 : a.cellTrigger) == null ? void 0 : n.call(a, t)) ?? `datepicker:${e.id}:cell-trigger:${t}`;
52
+ }, Ft = (e, t) => {
53
+ var a, n;
54
+ return ((n = (a = e.ids) == null ? void 0 : a.prevTrigger) == null ? void 0 : n.call(a, t)) ?? `datepicker:${e.id}:prev:${t}`;
55
+ }, Mt = (e, t) => {
56
+ var a, n;
57
+ return ((n = (a = e.ids) == null ? void 0 : a.nextTrigger) == null ? void 0 : n.call(a, t)) ?? `datepicker:${e.id}:next:${t}`;
58
+ }, Bt = (e, t) => {
59
+ var a, n;
60
+ return ((n = (a = e.ids) == null ? void 0 : a.viewTrigger) == null ? void 0 : n.call(a, t)) ?? `datepicker:${e.id}:view:${t}`;
61
+ }, Le = (e) => {
62
+ var t;
63
+ return ((t = e.ids) == null ? void 0 : t.clearTrigger) ?? `datepicker:${e.id}:clear`;
64
+ }, ke = (e) => {
65
+ var t;
66
+ return ((t = e.ids) == null ? void 0 : t.control) ?? `datepicker:${e.id}:control`;
67
+ }, Ie = (e, t) => {
68
+ var a, n;
69
+ return ((n = (a = e.ids) == null ? void 0 : a.input) == null ? void 0 : n.call(a, t)) ?? `datepicker:${e.id}:input:${t}`;
70
+ }, Ne = (e) => {
71
+ var t;
72
+ return ((t = e.ids) == null ? void 0 : t.trigger) ?? `datepicker:${e.id}:trigger`;
73
+ }, Fe = (e) => {
74
+ var t;
75
+ return ((t = e.ids) == null ? void 0 : t.positioner) ?? `datepicker:${e.id}:positioner`;
76
+ }, Me = (e) => {
77
+ var t;
78
+ return ((t = e.ids) == null ? void 0 : t.monthSelect) ?? `datepicker:${e.id}:month-select`;
79
+ }, Be = (e) => {
80
+ var t;
81
+ return ((t = e.ids) == null ? void 0 : t.yearSelect) ?? `datepicker:${e.id}:year-select`;
82
+ }, Re = (e, t) => Dt(z(e), `[data-part=table-cell-trigger][data-view=${t}][data-focus]:not([data-outside-range])`), xe = (e) => e.getById(Ne(e)), z = (e) => e.getById(de(e)), Y = (e) => bt($e(e), "[data-part=input]"), $t = (e) => e.getById(Be(e)), Ut = (e) => e.getById(Me(e)), Ht = (e) => e.getById(Le(e)), Wt = (e) => e.getById(Fe(e)), $e = (e) => e.getById(ke(e));
83
+ function ge(e) {
84
+ const [t, a] = e;
85
+ return !t || !a || t.compare(a) <= 0 ? e : [a, t];
86
+ }
87
+ function B(e, t) {
88
+ const [a, n] = t;
89
+ return !a || !n ? !1 : a.compare(e) <= 0 && n.compare(e) >= 0;
90
+ }
91
+ function q(e) {
92
+ return e.slice().sort((t, a) => t.compare(a));
93
+ }
94
+ function Yt(e) {
95
+ return Q(e, {
96
+ year: "calendar decade",
97
+ month: "calendar year",
98
+ day: "calendar month"
99
+ });
100
+ }
101
+ var Gt = {
102
+ day: "dd",
103
+ month: "mm",
104
+ year: "yyyy"
105
+ };
106
+ function _t(e) {
107
+ return new te(e).formatToParts(/* @__PURE__ */ new Date()).map((t) => Gt[t.type] ?? t.value).join("");
108
+ }
109
+ var Ue = (e, t) => e ? /\d/.test(e) || e === t || e.length !== 1 : !0, Ae = (e) => !Number.isNaN(e.day) && !Number.isNaN(e.month) && !Number.isNaN(e.year), Kt = (e, t) => e.split("").filter((a) => Ue(a, t)).join("");
110
+ function Zt(e) {
111
+ const n = new Intl.DateTimeFormat(e).formatToParts(/* @__PURE__ */ new Date()).find((s) => s.type === "literal");
112
+ return n ? n.value : "/";
113
+ }
114
+ var jt = {
115
+ dayCell(e) {
116
+ return e.unavailable ? `Not available. ${e.formattedDate}` : e.selected ? `Selected date. ${e.formattedDate}` : `Choose ${e.formattedDate}`;
117
+ },
118
+ trigger(e) {
119
+ return e ? "Close calendar" : "Open calendar";
120
+ },
121
+ viewTrigger(e) {
122
+ return Q(e, {
123
+ year: "Switch to month view",
124
+ month: "Switch to day view",
125
+ day: "Switch to year view"
126
+ });
127
+ },
128
+ presetTrigger(e) {
129
+ return Array.isArray(e) ? `select ${e[0].toString()} to ${e[1].toString()}` : `select ${e}`;
130
+ },
131
+ prevTrigger(e) {
132
+ return Q(e, {
133
+ year: "Switch to previous decade",
134
+ month: "Switch to previous year",
135
+ day: "Switch to previous month"
136
+ });
137
+ },
138
+ nextTrigger(e) {
139
+ return Q(e, {
140
+ year: "Switch to next decade",
141
+ month: "Switch to next year",
142
+ day: "Switch to next month"
143
+ });
144
+ },
145
+ // TODO: Revisit this
146
+ placeholder() {
147
+ return { day: "dd", month: "mm", year: "yyyy" };
148
+ },
149
+ content: "calendar",
150
+ monthSelect: "Select month",
151
+ yearSelect: "Select year",
152
+ clearTrigger: "Clear selected dates"
153
+ };
154
+ function A(e, t) {
155
+ return e ? e === "day" ? 0 : e === "month" ? 1 : 2 : t || 0;
156
+ }
157
+ function ve(e) {
158
+ return e === 0 ? "day" : e === 1 ? "month" : "year";
159
+ }
160
+ function fe(e, t, a) {
161
+ return ve(
162
+ Pt(A(e, 0), A(t, 0), A(a, 2))
163
+ );
164
+ }
165
+ function qt(e, t) {
166
+ return A(e, 0) > A(t, 0);
167
+ }
168
+ function Xt(e, t) {
169
+ return A(e, 0) < A(t, 0);
170
+ }
171
+ function Jt(e, t, a) {
172
+ const n = A(e, 0) + 1;
173
+ return fe(ve(n), t, a);
174
+ }
175
+ function Qt(e, t, a) {
176
+ const n = A(e, 0) - 1;
177
+ return fe(ve(n), t, a);
178
+ }
179
+ var zt = ["day", "month", "year"];
180
+ function ea(e) {
181
+ zt.forEach((t) => e(t));
182
+ }
183
+ function va(e, t) {
184
+ const { state: a, context: n, prop: s, send: l, computed: d, scope: g } = e, D = n.get("startValue"), G = d("endValue"), p = n.get("value"), f = n.get("focusedValue"), R = n.get("hoveredValue"), I = R ? ge([p[0], R]) : [], T = s("disabled"), _ = s("readOnly"), ne = d("isInteractive"), S = s("min"), E = s("max"), b = s("locale"), y = s("timeZone"), oe = s("startOfWeek"), He = a.matches("focused"), L = a.matches("open"), k = s("selectionMode") === "range", Ve = s("isDateUnavailable"), se = n.get("currentPlacement"), We = wt({
185
+ ...s("positioning"),
186
+ placement: se
187
+ }), me = Zt(b), x = { ...jt, ...s("translations") };
188
+ function re(r = D) {
189
+ const o = s("fixedWeeks") ? 6 : void 0;
190
+ return it(r, b, o, oe);
191
+ }
192
+ function ye(r = {}) {
193
+ const { format: o } = r;
194
+ return st(b, o).map((i, c) => {
195
+ const V = c + 1, P = f.set({ month: V }), h = $(P, S, E);
196
+ return { label: i, value: V, disabled: h };
197
+ });
198
+ }
199
+ function Ye() {
200
+ return rt({ from: (S == null ? void 0 : S.year) ?? 1900, to: (E == null ? void 0 : E.year) ?? 2100 }).map((o) => ({
201
+ label: o.toString(),
202
+ value: o,
203
+ disabled: !Oe(o, S == null ? void 0 : S.year, E == null ? void 0 : E.year)
204
+ }));
205
+ }
206
+ function Ge(r) {
207
+ return ae(f.year).map((i) => ({ label: i.toString(), value: i }));
208
+ }
209
+ function ie(r) {
210
+ return we(r, Ve, b, S, E);
211
+ }
212
+ function Te(r) {
213
+ const o = D ?? U(y);
214
+ l({ type: "FOCUS.SET", value: o.set({ month: r }) });
215
+ }
216
+ function Se(r) {
217
+ const o = D ?? U(y);
218
+ l({ type: "FOCUS.SET", value: o.set({ year: r }) });
219
+ }
220
+ function K(r) {
221
+ const { value: o, disabled: i } = r, c = f.set({ year: o }), V = {
222
+ focused: f.year === r.value,
223
+ selectable: Oe(o, S == null ? void 0 : S.year, E == null ? void 0 : E.year),
224
+ selected: !!p.find((P) => P.year === o),
225
+ valueText: o.toString(),
226
+ inRange: k && (B(c, p) || B(c, I)),
227
+ value: c,
228
+ get disabled() {
229
+ return i || !V.selectable;
230
+ }
231
+ };
232
+ return V;
233
+ }
234
+ function Z(r) {
235
+ const { value: o, disabled: i } = r, c = f.set({ month: o }), V = he(b, y), P = {
236
+ focused: f.month === r.value,
237
+ selectable: !$(c, S, E),
238
+ selected: !!p.find((h) => h.month === o && h.year === f.year),
239
+ valueText: V.format(c.toDate(y)),
240
+ inRange: k && (B(c, p) || B(c, I)),
241
+ value: c,
242
+ get disabled() {
243
+ return i || !P.selectable;
244
+ }
245
+ };
246
+ return P;
247
+ }
248
+ function le(r) {
249
+ const { value: o, disabled: i, visibleRange: c = d("visibleRange") } = r, V = nt(b, y), P = ot(d("visibleDuration")), h = s("outsideDaySelectable"), N = c.start.add(P).subtract({ days: 1 }), Ee = $(o, c.start, N), Ke = k && B(o, p), Ze = k && C(o, p[0]), je = k && C(o, p[1]), ce = k && I.length > 0, be = ce && B(o, I), qe = ce && C(o, I[0]), Xe = ce && C(o, I[1]), W = {
250
+ invalid: $(o, S, E),
251
+ disabled: i || !h && Ee || $(o, S, E),
252
+ selected: p.some((Je) => C(o, Je)),
253
+ unavailable: we(o, Ve, b, S, E) && !i,
254
+ outsideRange: Ee,
255
+ today: et(o, y),
256
+ weekend: ze(o, b),
257
+ formattedDate: V.format(o.toDate(y)),
258
+ get focused() {
259
+ return C(o, f) && (!W.outsideRange || h);
260
+ },
261
+ get ariaLabel() {
262
+ return x.dayCell(W);
263
+ },
264
+ get selectable() {
265
+ return !W.disabled && !W.unavailable;
266
+ },
267
+ // Range states
268
+ inRange: Ke || be,
269
+ firstInRange: Ze,
270
+ lastInRange: je,
271
+ // Preview range states
272
+ inHoveredRange: be,
273
+ firstInHoveredRange: qe,
274
+ lastInHoveredRange: Xe
275
+ };
276
+ return W;
277
+ }
278
+ function _e(r) {
279
+ const { view: o = "day", id: i } = r;
280
+ return [o, i].filter(Boolean).join(" ");
281
+ }
282
+ return {
283
+ focused: He,
284
+ open: L,
285
+ inline: !!s("inline"),
286
+ view: n.get("view"),
287
+ getRangePresetValue(r) {
288
+ return pe(r, b, y);
289
+ },
290
+ getDaysInWeek(r, o = D) {
291
+ return at(r, o, b, oe);
292
+ },
293
+ getOffset(r) {
294
+ const o = D.add(r), i = G.add(r), c = he(b, y);
295
+ return {
296
+ visibleRange: { start: o, end: i },
297
+ weeks: re(o),
298
+ visibleRangeText: {
299
+ start: c.format(o.toDate(y)),
300
+ end: c.format(i.toDate(y))
301
+ }
302
+ };
303
+ },
304
+ getMonthWeeks: re,
305
+ isUnavailable: ie,
306
+ weeks: re(),
307
+ weekDays: tt(U(y), oe, y, b),
308
+ visibleRangeText: d("visibleRangeText"),
309
+ value: p,
310
+ valueAsDate: p.map((r) => r.toDate(y)),
311
+ valueAsString: d("valueAsString"),
312
+ focusedValue: f,
313
+ focusedValueAsDate: f == null ? void 0 : f.toDate(y),
314
+ focusedValueAsString: s("format")(f, { locale: b, timeZone: y }),
315
+ visibleRange: d("visibleRange"),
316
+ selectToday() {
317
+ const r = F(U(y), S, E);
318
+ l({ type: "VALUE.SET", value: r });
319
+ },
320
+ setValue(r) {
321
+ const o = r.map((i) => F(i, S, E));
322
+ l({ type: "VALUE.SET", value: o });
323
+ },
324
+ clearValue() {
325
+ l({ type: "VALUE.CLEAR" });
326
+ },
327
+ setFocusedValue(r) {
328
+ l({ type: "FOCUS.SET", value: r });
329
+ },
330
+ setOpen(r) {
331
+ s("inline") || a.matches("open") === r || l({ type: r ? "OPEN" : "CLOSE" });
332
+ },
333
+ focusMonth: Te,
334
+ focusYear: Se,
335
+ getYears: Ye,
336
+ getMonths: ye,
337
+ getYearsGrid(r = {}) {
338
+ const { columns: o = 1 } = r;
339
+ return Pe(Ge(), o);
340
+ },
341
+ getDecade() {
342
+ const r = ae(f.year);
343
+ return { start: r.at(0), end: r.at(-1) };
344
+ },
345
+ getMonthsGrid(r = {}) {
346
+ const { columns: o = 1, format: i } = r;
347
+ return Pe(ye({ format: i }), o);
348
+ },
349
+ format(r, o = { month: "long", year: "numeric" }) {
350
+ return new te(b, o).format(r.toDate(y));
351
+ },
352
+ setView(r) {
353
+ l({ type: "VIEW.SET", view: r });
354
+ },
355
+ goToNext() {
356
+ l({ type: "GOTO.NEXT", view: n.get("view") });
357
+ },
358
+ goToPrev() {
359
+ l({ type: "GOTO.PREV", view: n.get("view") });
360
+ },
361
+ getRootProps() {
362
+ return t.element({
363
+ ...v.root.attrs,
364
+ dir: s("dir"),
365
+ id: kt(g),
366
+ "data-state": L ? "open" : "closed",
367
+ "data-disabled": u(T),
368
+ "data-readonly": u(_)
369
+ });
370
+ },
371
+ getLabelProps(r = {}) {
372
+ const { index: o = 0 } = r;
373
+ return t.label({
374
+ ...v.label.attrs,
375
+ id: Lt(g, o),
376
+ dir: s("dir"),
377
+ htmlFor: Ie(g, o),
378
+ "data-state": L ? "open" : "closed",
379
+ "data-index": o,
380
+ "data-disabled": u(T),
381
+ "data-readonly": u(_)
382
+ });
383
+ },
384
+ getControlProps() {
385
+ return t.element({
386
+ ...v.control.attrs,
387
+ dir: s("dir"),
388
+ id: ke(g),
389
+ "data-disabled": u(T)
390
+ });
391
+ },
392
+ getRangeTextProps() {
393
+ return t.element({
394
+ ...v.rangeText.attrs,
395
+ dir: s("dir")
396
+ });
397
+ },
398
+ getContentProps() {
399
+ return t.element({
400
+ ...v.content.attrs,
401
+ hidden: !L,
402
+ dir: s("dir"),
403
+ "data-state": L ? "open" : "closed",
404
+ "data-placement": se,
405
+ "data-inline": u(s("inline")),
406
+ id: de(g),
407
+ tabIndex: -1,
408
+ role: "application",
409
+ "aria-roledescription": "datepicker",
410
+ "aria-label": x.content
411
+ });
412
+ },
413
+ getTableProps(r = {}) {
414
+ const { view: o = "day", columns: i = o === "day" ? 7 : 4 } = r, c = _e(r);
415
+ return t.element({
416
+ ...v.table.attrs,
417
+ role: "grid",
418
+ "data-columns": i,
419
+ "aria-roledescription": Yt(o),
420
+ id: Nt(g, c),
421
+ "aria-readonly": w(_),
422
+ "aria-disabled": w(T),
423
+ "aria-multiselectable": w(s("selectionMode") !== "single"),
424
+ "data-view": o,
425
+ dir: s("dir"),
426
+ tabIndex: -1,
427
+ onKeyDown(V) {
428
+ if (V.defaultPrevented) return;
429
+ const h = {
430
+ Enter() {
431
+ o === "day" && ie(f) || o === "month" && !Z({ value: f.month }).selectable || o === "year" && !K({ value: f.year }).selectable || l({ type: "TABLE.ENTER", view: o, columns: i, focus: !0 });
432
+ },
433
+ ArrowLeft() {
434
+ l({ type: "TABLE.ARROW_LEFT", view: o, columns: i, focus: !0 });
435
+ },
436
+ ArrowRight() {
437
+ l({ type: "TABLE.ARROW_RIGHT", view: o, columns: i, focus: !0 });
438
+ },
439
+ ArrowUp() {
440
+ l({ type: "TABLE.ARROW_UP", view: o, columns: i, focus: !0 });
441
+ },
442
+ ArrowDown() {
443
+ l({ type: "TABLE.ARROW_DOWN", view: o, columns: i, focus: !0 });
444
+ },
445
+ PageUp(N) {
446
+ l({ type: "TABLE.PAGE_UP", larger: N.shiftKey, view: o, columns: i, focus: !0 });
447
+ },
448
+ PageDown(N) {
449
+ l({ type: "TABLE.PAGE_DOWN", larger: N.shiftKey, view: o, columns: i, focus: !0 });
450
+ },
451
+ Home() {
452
+ l({ type: "TABLE.HOME", view: o, columns: i, focus: !0 });
453
+ },
454
+ End() {
455
+ l({ type: "TABLE.END", view: o, columns: i, focus: !0 });
456
+ }
457
+ }[St(V, {
458
+ dir: s("dir")
459
+ })];
460
+ h && (h(V), V.preventDefault(), V.stopPropagation());
461
+ },
462
+ onPointerLeave() {
463
+ l({ type: "TABLE.POINTER_LEAVE" });
464
+ },
465
+ onPointerDown() {
466
+ l({ type: "TABLE.POINTER_DOWN", view: o });
467
+ },
468
+ onPointerUp() {
469
+ l({ type: "TABLE.POINTER_UP", view: o });
470
+ }
471
+ });
472
+ },
473
+ getTableHeadProps(r = {}) {
474
+ const { view: o = "day" } = r;
475
+ return t.element({
476
+ ...v.tableHead.attrs,
477
+ "aria-hidden": !0,
478
+ dir: s("dir"),
479
+ "data-view": o,
480
+ "data-disabled": u(T)
481
+ });
482
+ },
483
+ getTableHeaderProps(r = {}) {
484
+ const { view: o = "day" } = r;
485
+ return t.element({
486
+ ...v.tableHeader.attrs,
487
+ dir: s("dir"),
488
+ "data-view": o,
489
+ "data-disabled": u(T)
490
+ });
491
+ },
492
+ getTableBodyProps(r = {}) {
493
+ const { view: o = "day" } = r;
494
+ return t.element({
495
+ ...v.tableBody.attrs,
496
+ "data-view": o,
497
+ "data-disabled": u(T)
498
+ });
499
+ },
500
+ getTableRowProps(r = {}) {
501
+ const { view: o = "day" } = r;
502
+ return t.element({
503
+ ...v.tableRow.attrs,
504
+ "aria-disabled": w(T),
505
+ "data-disabled": u(T),
506
+ "data-view": o
507
+ });
508
+ },
509
+ getDayTableCellState: le,
510
+ getDayTableCellProps(r) {
511
+ const { value: o } = r, i = le(r);
512
+ return t.element({
513
+ ...v.tableCell.attrs,
514
+ role: "gridcell",
515
+ "aria-disabled": w(!i.selectable),
516
+ "aria-selected": i.selected || i.inRange,
517
+ "aria-invalid": w(i.invalid),
518
+ "aria-current": i.today ? "date" : void 0,
519
+ "data-value": o.toString()
520
+ });
521
+ },
522
+ getDayTableCellTriggerProps(r) {
523
+ const { value: o } = r, i = le(r);
524
+ return t.element({
525
+ ...v.tableCellTrigger.attrs,
526
+ id: ue(g, o.toString()),
527
+ role: "button",
528
+ dir: s("dir"),
529
+ tabIndex: i.focused ? 0 : -1,
530
+ "aria-label": i.ariaLabel,
531
+ "aria-disabled": w(!i.selectable),
532
+ "aria-invalid": w(i.invalid),
533
+ "data-disabled": u(!i.selectable),
534
+ "data-selected": u(i.selected),
535
+ "data-value": o.toString(),
536
+ "data-view": "day",
537
+ "data-today": u(i.today),
538
+ "data-focus": u(i.focused),
539
+ "data-unavailable": u(i.unavailable),
540
+ "data-range-start": u(i.firstInRange),
541
+ "data-range-end": u(i.lastInRange),
542
+ "data-in-range": u(i.inRange),
543
+ "data-outside-range": u(i.outsideRange),
544
+ "data-weekend": u(i.weekend),
545
+ "data-in-hover-range": u(i.inHoveredRange),
546
+ "data-hover-range-start": u(i.firstInHoveredRange),
547
+ "data-hover-range-end": u(i.lastInHoveredRange),
548
+ onClick(c) {
549
+ c.defaultPrevented || i.selectable && l({ type: "CELL.CLICK", cell: "day", value: o });
550
+ },
551
+ onPointerMove: k ? (c) => {
552
+ if (c.pointerType === "touch" || !i.selectable) return;
553
+ const V = c.currentTarget.ownerDocument.activeElement !== c.currentTarget;
554
+ R && De(o, R) || l({ type: "CELL.POINTER_MOVE", cell: "day", value: o, focus: V });
555
+ } : void 0
556
+ });
557
+ },
558
+ getMonthTableCellState: Z,
559
+ getMonthTableCellProps(r) {
560
+ const { value: o, columns: i } = r, c = Z(r);
561
+ return t.element({
562
+ ...v.tableCell.attrs,
563
+ dir: s("dir"),
564
+ colSpan: i,
565
+ role: "gridcell",
566
+ "aria-selected": w(c.selected || c.inRange),
567
+ "data-selected": u(c.selected),
568
+ "aria-disabled": w(!c.selectable),
569
+ "data-value": o
570
+ });
571
+ },
572
+ getMonthTableCellTriggerProps(r) {
573
+ const { value: o } = r, i = Z(r);
574
+ return t.element({
575
+ ...v.tableCellTrigger.attrs,
576
+ dir: s("dir"),
577
+ role: "button",
578
+ id: ue(g, o.toString()),
579
+ "data-selected": u(i.selected),
580
+ "aria-disabled": w(!i.selectable),
581
+ "data-disabled": u(!i.selectable),
582
+ "data-focus": u(i.focused),
583
+ "data-in-range": u(i.inRange),
584
+ "aria-label": i.valueText,
585
+ "data-view": "month",
586
+ "data-value": o,
587
+ tabIndex: i.focused ? 0 : -1,
588
+ onClick(c) {
589
+ c.defaultPrevented || i.selectable && l({ type: "CELL.CLICK", cell: "month", value: o });
590
+ },
591
+ onPointerMove: k ? (c) => {
592
+ if (c.pointerType === "touch" || !i.selectable) return;
593
+ const V = c.currentTarget.ownerDocument.activeElement !== c.currentTarget;
594
+ R && i.value && De(i.value, R) || l({ type: "CELL.POINTER_MOVE", cell: "month", value: i.value, focus: V });
595
+ } : void 0
596
+ });
597
+ },
598
+ getYearTableCellState: K,
599
+ getYearTableCellProps(r) {
600
+ const { value: o, columns: i } = r, c = K(r);
601
+ return t.element({
602
+ ...v.tableCell.attrs,
603
+ dir: s("dir"),
604
+ colSpan: i,
605
+ role: "gridcell",
606
+ "aria-selected": w(c.selected),
607
+ "data-selected": u(c.selected),
608
+ "aria-disabled": w(!c.selectable),
609
+ "data-value": o
610
+ });
611
+ },
612
+ getYearTableCellTriggerProps(r) {
613
+ const { value: o } = r, i = K(r);
614
+ return t.element({
615
+ ...v.tableCellTrigger.attrs,
616
+ dir: s("dir"),
617
+ role: "button",
618
+ id: ue(g, o.toString()),
619
+ "data-selected": u(i.selected),
620
+ "data-focus": u(i.focused),
621
+ "data-in-range": u(i.inRange),
622
+ "aria-disabled": w(!i.selectable),
623
+ "data-disabled": u(!i.selectable),
624
+ "aria-label": i.valueText,
625
+ "data-value": o,
626
+ "data-view": "year",
627
+ tabIndex: i.focused ? 0 : -1,
628
+ onClick(c) {
629
+ c.defaultPrevented || i.selectable && l({ type: "CELL.CLICK", cell: "year", value: o });
630
+ }
631
+ });
632
+ },
633
+ getNextTriggerProps(r = {}) {
634
+ const { view: o = "day" } = r, i = T || !d("isNextVisibleRangeValid");
635
+ return t.button({
636
+ ...v.nextTrigger.attrs,
637
+ dir: s("dir"),
638
+ id: Mt(g, o),
639
+ type: "button",
640
+ "aria-label": x.nextTrigger(o),
641
+ disabled: i,
642
+ "data-disabled": u(i),
643
+ onClick(c) {
644
+ c.defaultPrevented || l({ type: "GOTO.NEXT", view: o });
645
+ }
646
+ });
647
+ },
648
+ getPrevTriggerProps(r = {}) {
649
+ const { view: o = "day" } = r, i = T || !d("isPrevVisibleRangeValid");
650
+ return t.button({
651
+ ...v.prevTrigger.attrs,
652
+ dir: s("dir"),
653
+ id: Ft(g, o),
654
+ type: "button",
655
+ "aria-label": x.prevTrigger(o),
656
+ disabled: i,
657
+ "data-disabled": u(i),
658
+ onClick(c) {
659
+ c.defaultPrevented || l({ type: "GOTO.PREV", view: o });
660
+ }
661
+ });
662
+ },
663
+ getClearTriggerProps() {
664
+ return t.button({
665
+ ...v.clearTrigger.attrs,
666
+ id: Le(g),
667
+ dir: s("dir"),
668
+ type: "button",
669
+ "aria-label": x.clearTrigger,
670
+ hidden: !p.length,
671
+ onClick(r) {
672
+ r.defaultPrevented || l({ type: "VALUE.CLEAR" });
673
+ }
674
+ });
675
+ },
676
+ getTriggerProps() {
677
+ return t.button({
678
+ ...v.trigger.attrs,
679
+ id: Ne(g),
680
+ dir: s("dir"),
681
+ type: "button",
682
+ "data-placement": se,
683
+ "aria-label": x.trigger(L),
684
+ "aria-controls": de(g),
685
+ "data-state": L ? "open" : "closed",
686
+ "aria-haspopup": "grid",
687
+ disabled: T,
688
+ onClick(r) {
689
+ r.defaultPrevented || ne && l({ type: "TRIGGER.CLICK" });
690
+ }
691
+ });
692
+ },
693
+ getViewProps(r = {}) {
694
+ const { view: o = "day" } = r;
695
+ return t.element({
696
+ ...v.view.attrs,
697
+ "data-view": o,
698
+ hidden: n.get("view") !== o
699
+ });
700
+ },
701
+ getViewTriggerProps(r = {}) {
702
+ const { view: o = "day" } = r;
703
+ return t.button({
704
+ ...v.viewTrigger.attrs,
705
+ "data-view": o,
706
+ dir: s("dir"),
707
+ id: Bt(g, o),
708
+ type: "button",
709
+ disabled: T,
710
+ "aria-label": x.viewTrigger(o),
711
+ onClick(i) {
712
+ i.defaultPrevented || ne && l({ type: "VIEW.TOGGLE", src: "viewTrigger" });
713
+ }
714
+ });
715
+ },
716
+ getViewControlProps(r = {}) {
717
+ const { view: o = "day" } = r;
718
+ return t.element({
719
+ ...v.viewControl.attrs,
720
+ "data-view": o,
721
+ dir: s("dir")
722
+ });
723
+ },
724
+ getInputProps(r = {}) {
725
+ const { index: o = 0, fixOnBlur: i = !0 } = r;
726
+ return t.input({
727
+ ...v.input.attrs,
728
+ id: Ie(g, o),
729
+ autoComplete: "off",
730
+ autoCorrect: "off",
731
+ spellCheck: "false",
732
+ dir: s("dir"),
733
+ name: s("name"),
734
+ "data-index": o,
735
+ "data-state": L ? "open" : "closed",
736
+ readOnly: _,
737
+ disabled: T,
738
+ placeholder: s("placeholder") || _t(b),
739
+ defaultValue: d("valueAsString")[o],
740
+ onBeforeInput(c) {
741
+ const { data: V } = Tt(c);
742
+ Ue(V, me) || c.preventDefault();
743
+ },
744
+ onFocus() {
745
+ l({ type: "INPUT.FOCUS", index: o });
746
+ },
747
+ onBlur(c) {
748
+ const V = c.currentTarget.value.trim();
749
+ l({ type: "INPUT.BLUR", value: V, index: o, fixOnBlur: i });
750
+ },
751
+ onKeyDown(c) {
752
+ if (c.defaultPrevented || !ne) return;
753
+ const P = {
754
+ Enter(h) {
755
+ Et(h) || ie(f) || h.currentTarget.value.trim() !== "" && l({ type: "INPUT.ENTER", value: h.currentTarget.value, index: o });
756
+ }
757
+ }[c.key];
758
+ P && (P(c), c.preventDefault());
759
+ },
760
+ onInput(c) {
761
+ const V = c.currentTarget.value;
762
+ l({ type: "INPUT.CHANGE", value: Kt(V, me), index: o });
763
+ }
764
+ });
765
+ },
766
+ getMonthSelectProps() {
767
+ return t.select({
768
+ ...v.monthSelect.attrs,
769
+ id: Me(g),
770
+ "aria-label": x.monthSelect,
771
+ disabled: T,
772
+ dir: s("dir"),
773
+ defaultValue: D.month,
774
+ onChange(r) {
775
+ Te(Number(r.currentTarget.value));
776
+ }
777
+ });
778
+ },
779
+ getYearSelectProps() {
780
+ return t.select({
781
+ ...v.yearSelect.attrs,
782
+ id: Be(g),
783
+ disabled: T,
784
+ "aria-label": x.yearSelect,
785
+ dir: s("dir"),
786
+ defaultValue: D.year,
787
+ onChange(r) {
788
+ Se(Number(r.currentTarget.value));
789
+ }
790
+ });
791
+ },
792
+ getPositionerProps() {
793
+ return t.element({
794
+ id: Fe(g),
795
+ ...v.positioner.attrs,
796
+ dir: s("dir"),
797
+ style: We.floating
798
+ });
799
+ },
800
+ getPresetTriggerProps(r) {
801
+ const o = Array.isArray(r.value) ? r.value : pe(r.value, b, y), i = o.map((c) => c.toDate(y).toDateString());
802
+ return t.button({
803
+ ...v.presetTrigger.attrs,
804
+ "aria-label": x.presetTrigger(i),
805
+ type: "button",
806
+ onClick(c) {
807
+ c.defaultPrevented || l({ type: "PRESET.CLICK", value: o });
808
+ }
809
+ });
810
+ }
811
+ };
812
+ }
813
+ var { and: O } = It();
814
+ function ta(e, t) {
815
+ if ((e == null ? void 0 : e.length) !== (t == null ? void 0 : t.length)) return !1;
816
+ const a = Math.max(e.length, t.length);
817
+ for (let n = 0; n < a; n++)
818
+ if (!C(e[n], t[n])) return !1;
819
+ return !0;
820
+ }
821
+ function X(e, t) {
822
+ return e.map((a) => t("format")(a, { locale: t("locale"), timeZone: t("timeZone") }));
823
+ }
824
+ var fa = Ot({
825
+ props({ props: e }) {
826
+ const t = e.locale || "en-US", a = e.timeZone || "UTC", n = e.selectionMode || "single", s = e.numOfMonths || 1, l = e.defaultValue ? q(e.defaultValue).map((f) => F(f, e.min, e.max)) : void 0, d = e.value ? q(e.value).map((f) => F(f, e.min, e.max)) : void 0;
827
+ let g = e.focusedValue || e.defaultFocusedValue || (d == null ? void 0 : d[0]) || (l == null ? void 0 : l[0]) || U(a);
828
+ g = F(g, e.min, e.max);
829
+ const D = "day", G = "year", p = fe(e.view || D, D, G);
830
+ return {
831
+ locale: t,
832
+ numOfMonths: s,
833
+ timeZone: a,
834
+ selectionMode: n,
835
+ defaultView: p,
836
+ minView: D,
837
+ maxView: G,
838
+ outsideDaySelectable: !1,
839
+ closeOnSelect: !0,
840
+ format(f, { locale: R, timeZone: I }) {
841
+ return new te(R, { timeZone: I, day: "2-digit", month: "2-digit", year: "numeric" }).format(f.toDate(I));
842
+ },
843
+ parse(f, { locale: R, timeZone: I }) {
844
+ return mt(f, R, I);
845
+ },
846
+ ...e,
847
+ focusedValue: typeof e.focusedValue > "u" ? void 0 : g,
848
+ defaultFocusedValue: g,
849
+ value: d,
850
+ defaultValue: l ?? [],
851
+ positioning: {
852
+ placement: "bottom",
853
+ ...e.positioning
854
+ }
855
+ };
856
+ },
857
+ initialState({ prop: e }) {
858
+ return e("open") || e("defaultOpen") || e("inline") ? "open" : "idle";
859
+ },
860
+ refs() {
861
+ return {
862
+ announcer: void 0
863
+ };
864
+ },
865
+ context({ prop: e, bindable: t, getContext: a }) {
866
+ return {
867
+ focusedValue: t(() => ({
868
+ defaultValue: e("defaultFocusedValue"),
869
+ value: e("focusedValue"),
870
+ isEqual: C,
871
+ hash: (n) => n.toString(),
872
+ sync: !0,
873
+ onChange(n) {
874
+ var D;
875
+ const s = a(), l = s.get("view"), d = s.get("value"), g = X(d, e);
876
+ (D = e("onFocusChange")) == null || D({ value: d, valueAsString: g, view: l, focusedValue: n });
877
+ }
878
+ })),
879
+ value: t(() => ({
880
+ defaultValue: e("defaultValue"),
881
+ value: e("value"),
882
+ isEqual: ta,
883
+ hash: (n) => n.map((s) => s.toString()).join(","),
884
+ onChange(n) {
885
+ var d;
886
+ const s = a(), l = X(n, e);
887
+ (d = e("onValueChange")) == null || d({ value: n, valueAsString: l, view: s.get("view") });
888
+ }
889
+ })),
890
+ inputValue: t(() => ({
891
+ defaultValue: ""
892
+ })),
893
+ activeIndex: t(() => ({
894
+ defaultValue: 0,
895
+ sync: !0
896
+ })),
897
+ hoveredValue: t(() => ({
898
+ defaultValue: null,
899
+ isEqual: (n, s) => s !== null && n !== null && C(n, s)
900
+ })),
901
+ view: t(() => ({
902
+ defaultValue: e("defaultView"),
903
+ value: e("view"),
904
+ onChange(n) {
905
+ var s;
906
+ (s = e("onViewChange")) == null || s({ view: n });
907
+ }
908
+ })),
909
+ startValue: t(() => {
910
+ const n = e("focusedValue") || e("defaultFocusedValue");
911
+ return {
912
+ defaultValue: Ce(n, "start", { months: e("numOfMonths") }, e("locale")),
913
+ isEqual: C,
914
+ hash: (s) => s.toString()
915
+ };
916
+ }),
917
+ currentPlacement: t(() => ({
918
+ defaultValue: void 0
919
+ })),
920
+ restoreFocus: t(() => ({
921
+ defaultValue: !1
922
+ }))
923
+ };
924
+ },
925
+ computed: {
926
+ isInteractive: ({ prop: e }) => !e("disabled") && !e("readOnly"),
927
+ visibleDuration: ({ prop: e }) => ({ months: e("numOfMonths") }),
928
+ endValue: ({ context: e, computed: t }) => lt(e.get("startValue"), t("visibleDuration")),
929
+ visibleRange: ({ context: e, computed: t }) => ({ start: e.get("startValue"), end: t("endValue") }),
930
+ visibleRangeText({ context: e, prop: t, computed: a }) {
931
+ const n = t("timeZone"), s = new te(t("locale"), { month: "long", year: "numeric", timeZone: n }), l = s.format(e.get("startValue").toDate(n)), d = s.format(a("endValue").toDate(n)), g = t("selectionMode") === "range" ? `${l} - ${d}` : l;
932
+ return { start: l, end: d, formatted: g };
933
+ },
934
+ isPrevVisibleRangeValid: ({ context: e, prop: t }) => !Vt(e.get("startValue"), t("min"), t("max")),
935
+ isNextVisibleRangeValid: ({ prop: e, computed: t }) => !ft(t("endValue"), e("min"), e("max")),
936
+ valueAsString: ({ context: e, prop: t }) => X(e.get("value"), t)
937
+ },
938
+ effects: ["setupLiveRegion"],
939
+ watch({ track: e, prop: t, context: a, action: n, computed: s }) {
940
+ e([() => t("locale")], () => {
941
+ n(["setStartValue"]);
942
+ }), e([() => a.hash("focusedValue")], () => {
943
+ n(["setStartValue", "focusActiveCellIfNeeded", "setHoveredValueIfKeyboard"]);
944
+ }), e([() => a.hash("startValue")], () => {
945
+ n(["syncMonthSelectElement", "syncYearSelectElement"]);
946
+ }), e([() => a.get("inputValue")], () => {
947
+ n(["syncInputValue"]);
948
+ }), e([() => a.hash("value")], () => {
949
+ n(["syncInputElement"]);
950
+ }), e([() => s("valueAsString").toString()], () => {
951
+ n(["announceValueText"]);
952
+ }), e([() => a.get("view")], () => {
953
+ n(["focusActiveCell"]);
954
+ }), e([() => t("open")], () => {
955
+ n(["toggleVisibility"]);
956
+ });
957
+ },
958
+ on: {
959
+ "VALUE.SET": {
960
+ actions: ["setDateValue", "setFocusedDate"]
961
+ },
962
+ "VIEW.SET": {
963
+ actions: ["setView"]
964
+ },
965
+ "FOCUS.SET": {
966
+ actions: ["setFocusedDate"]
967
+ },
968
+ "VALUE.CLEAR": {
969
+ actions: ["clearDateValue", "clearFocusedDate", "focusFirstInputElement"]
970
+ },
971
+ "INPUT.CHANGE": [
972
+ {
973
+ guard: "isInputValueEmpty",
974
+ actions: ["setInputValue", "clearDateValue", "clearFocusedDate"]
975
+ },
976
+ {
977
+ actions: ["setInputValue", "focusParsedDate"]
978
+ }
979
+ ],
980
+ "INPUT.ENTER": {
981
+ actions: ["focusParsedDate", "selectFocusedDate"]
982
+ },
983
+ "INPUT.FOCUS": {
984
+ actions: ["setActiveIndex"]
985
+ },
986
+ "INPUT.BLUR": [
987
+ {
988
+ guard: "shouldFixOnBlur",
989
+ actions: ["setActiveIndexToStart", "selectParsedDate"]
990
+ },
991
+ {
992
+ actions: ["setActiveIndexToStart"]
993
+ }
994
+ ],
995
+ "PRESET.CLICK": [
996
+ {
997
+ guard: "isOpenControlled",
998
+ actions: ["setDateValue", "setFocusedDate", "invokeOnClose"]
999
+ },
1000
+ {
1001
+ target: "focused",
1002
+ actions: ["setDateValue", "setFocusedDate", "focusInputElement"]
1003
+ }
1004
+ ],
1005
+ "GOTO.NEXT": [
1006
+ {
1007
+ guard: "isYearView",
1008
+ actions: ["focusNextDecade", "announceVisibleRange"]
1009
+ },
1010
+ {
1011
+ guard: "isMonthView",
1012
+ actions: ["focusNextYear", "announceVisibleRange"]
1013
+ },
1014
+ {
1015
+ actions: ["focusNextPage"]
1016
+ }
1017
+ ],
1018
+ "GOTO.PREV": [
1019
+ {
1020
+ guard: "isYearView",
1021
+ actions: ["focusPreviousDecade", "announceVisibleRange"]
1022
+ },
1023
+ {
1024
+ guard: "isMonthView",
1025
+ actions: ["focusPreviousYear", "announceVisibleRange"]
1026
+ },
1027
+ {
1028
+ actions: ["focusPreviousPage"]
1029
+ }
1030
+ ]
1031
+ },
1032
+ states: {
1033
+ idle: {
1034
+ tags: ["closed"],
1035
+ on: {
1036
+ "CONTROLLED.OPEN": {
1037
+ target: "open",
1038
+ actions: ["focusFirstSelectedDate", "focusActiveCell"]
1039
+ },
1040
+ "TRIGGER.CLICK": [
1041
+ {
1042
+ guard: "isOpenControlled",
1043
+ actions: ["invokeOnOpen"]
1044
+ },
1045
+ {
1046
+ target: "open",
1047
+ actions: ["focusFirstSelectedDate", "focusActiveCell", "invokeOnOpen"]
1048
+ }
1049
+ ],
1050
+ OPEN: [
1051
+ {
1052
+ guard: "isOpenControlled",
1053
+ actions: ["invokeOnOpen"]
1054
+ },
1055
+ {
1056
+ target: "open",
1057
+ actions: ["focusFirstSelectedDate", "focusActiveCell", "invokeOnOpen"]
1058
+ }
1059
+ ]
1060
+ }
1061
+ },
1062
+ focused: {
1063
+ tags: ["closed"],
1064
+ on: {
1065
+ "CONTROLLED.OPEN": {
1066
+ target: "open",
1067
+ actions: ["focusFirstSelectedDate", "focusActiveCell"]
1068
+ },
1069
+ "TRIGGER.CLICK": [
1070
+ {
1071
+ guard: "isOpenControlled",
1072
+ actions: ["invokeOnOpen"]
1073
+ },
1074
+ {
1075
+ target: "open",
1076
+ actions: ["focusFirstSelectedDate", "focusActiveCell", "invokeOnOpen"]
1077
+ }
1078
+ ],
1079
+ OPEN: [
1080
+ {
1081
+ guard: "isOpenControlled",
1082
+ actions: ["invokeOnOpen"]
1083
+ },
1084
+ {
1085
+ target: "open",
1086
+ actions: ["focusFirstSelectedDate", "focusActiveCell", "invokeOnOpen"]
1087
+ }
1088
+ ]
1089
+ }
1090
+ },
1091
+ open: {
1092
+ tags: ["open"],
1093
+ effects: ["trackDismissableElement", "trackPositioning"],
1094
+ exit: ["clearHoveredDate", "resetView"],
1095
+ on: {
1096
+ "CONTROLLED.CLOSE": [
1097
+ {
1098
+ guard: O("shouldRestoreFocus", "isInteractOutsideEvent"),
1099
+ target: "focused",
1100
+ actions: ["focusTriggerElement"]
1101
+ },
1102
+ {
1103
+ guard: "shouldRestoreFocus",
1104
+ target: "focused",
1105
+ actions: ["focusInputElement"]
1106
+ },
1107
+ {
1108
+ target: "idle"
1109
+ }
1110
+ ],
1111
+ "CELL.CLICK": [
1112
+ {
1113
+ guard: "isAboveMinView",
1114
+ actions: ["setFocusedValueForView", "setPreviousView"]
1115
+ },
1116
+ {
1117
+ guard: O("isRangePicker", "hasSelectedRange"),
1118
+ actions: ["setActiveIndexToStart", "resetSelection", "setActiveIndexToEnd"]
1119
+ },
1120
+ // === Grouped transitions (based on `closeOnSelect` and `isOpenControlled`) ===
1121
+ {
1122
+ guard: O("isRangePicker", "isSelectingEndDate", "closeOnSelect", "isOpenControlled"),
1123
+ actions: [
1124
+ "setFocusedDate",
1125
+ "setSelectedDate",
1126
+ "setActiveIndexToStart",
1127
+ "clearHoveredDate",
1128
+ "invokeOnClose",
1129
+ "setRestoreFocus"
1130
+ ]
1131
+ },
1132
+ {
1133
+ guard: O("isRangePicker", "isSelectingEndDate", "closeOnSelect"),
1134
+ target: "focused",
1135
+ actions: [
1136
+ "setFocusedDate",
1137
+ "setSelectedDate",
1138
+ "setActiveIndexToStart",
1139
+ "clearHoveredDate",
1140
+ "invokeOnClose",
1141
+ "focusInputElement"
1142
+ ]
1143
+ },
1144
+ {
1145
+ guard: O("isRangePicker", "isSelectingEndDate"),
1146
+ actions: ["setFocusedDate", "setSelectedDate", "setActiveIndexToStart", "clearHoveredDate"]
1147
+ },
1148
+ // ===
1149
+ {
1150
+ guard: "isRangePicker",
1151
+ actions: ["setFocusedDate", "setSelectedDate", "setActiveIndexToEnd"]
1152
+ },
1153
+ {
1154
+ guard: "isMultiPicker",
1155
+ actions: ["setFocusedDate", "toggleSelectedDate"]
1156
+ },
1157
+ // === Grouped transitions (based on `closeOnSelect` and `isOpenControlled`) ===
1158
+ {
1159
+ guard: O("closeOnSelect", "isOpenControlled"),
1160
+ actions: ["setFocusedDate", "setSelectedDate", "invokeOnClose"]
1161
+ },
1162
+ {
1163
+ guard: "closeOnSelect",
1164
+ target: "focused",
1165
+ actions: ["setFocusedDate", "setSelectedDate", "invokeOnClose", "focusInputElement"]
1166
+ },
1167
+ {
1168
+ actions: ["setFocusedDate", "setSelectedDate"]
1169
+ }
1170
+ // ===
1171
+ ],
1172
+ "CELL.POINTER_MOVE": {
1173
+ guard: O("isRangePicker", "isSelectingEndDate"),
1174
+ actions: ["setHoveredDate", "setFocusedDate"]
1175
+ },
1176
+ "TABLE.POINTER_LEAVE": {
1177
+ guard: "isRangePicker",
1178
+ actions: ["clearHoveredDate"]
1179
+ },
1180
+ "TABLE.POINTER_DOWN": {
1181
+ actions: ["disableTextSelection"]
1182
+ },
1183
+ "TABLE.POINTER_UP": {
1184
+ actions: ["enableTextSelection"]
1185
+ },
1186
+ "TABLE.ESCAPE": [
1187
+ {
1188
+ guard: "isOpenControlled",
1189
+ actions: ["focusFirstSelectedDate", "invokeOnClose"]
1190
+ },
1191
+ {
1192
+ target: "focused",
1193
+ actions: ["focusFirstSelectedDate", "invokeOnClose", "focusTriggerElement"]
1194
+ }
1195
+ ],
1196
+ "TABLE.ENTER": [
1197
+ {
1198
+ guard: "isAboveMinView",
1199
+ actions: ["setPreviousView"]
1200
+ },
1201
+ {
1202
+ guard: O("isRangePicker", "hasSelectedRange"),
1203
+ actions: ["setActiveIndexToStart", "clearDateValue", "setSelectedDate", "setActiveIndexToEnd"]
1204
+ },
1205
+ // === Grouped transitions (based on `closeOnSelect` and `isOpenControlled`) ===
1206
+ {
1207
+ guard: O("isRangePicker", "isSelectingEndDate", "closeOnSelect", "isOpenControlled"),
1208
+ actions: ["setSelectedDate", "setActiveIndexToStart", "clearHoveredDate", "invokeOnClose"]
1209
+ },
1210
+ {
1211
+ guard: O("isRangePicker", "isSelectingEndDate", "closeOnSelect"),
1212
+ target: "focused",
1213
+ actions: [
1214
+ "setSelectedDate",
1215
+ "setActiveIndexToStart",
1216
+ "clearHoveredDate",
1217
+ "invokeOnClose",
1218
+ "focusInputElement"
1219
+ ]
1220
+ },
1221
+ {
1222
+ guard: O("isRangePicker", "isSelectingEndDate"),
1223
+ actions: ["setSelectedDate", "setActiveIndexToStart", "clearHoveredDate"]
1224
+ },
1225
+ // ===
1226
+ {
1227
+ guard: "isRangePicker",
1228
+ actions: ["setSelectedDate", "setActiveIndexToEnd", "focusNextDay"]
1229
+ },
1230
+ {
1231
+ guard: "isMultiPicker",
1232
+ actions: ["toggleSelectedDate"]
1233
+ },
1234
+ // === Grouped transitions (based on `closeOnSelect` and `isOpenControlled`) ===
1235
+ {
1236
+ guard: O("closeOnSelect", "isOpenControlled"),
1237
+ actions: ["selectFocusedDate", "invokeOnClose"]
1238
+ },
1239
+ {
1240
+ guard: "closeOnSelect",
1241
+ target: "focused",
1242
+ actions: ["selectFocusedDate", "invokeOnClose", "focusInputElement"]
1243
+ },
1244
+ {
1245
+ actions: ["selectFocusedDate"]
1246
+ }
1247
+ // ===
1248
+ ],
1249
+ "TABLE.ARROW_RIGHT": [
1250
+ {
1251
+ guard: "isMonthView",
1252
+ actions: ["focusNextMonth"]
1253
+ },
1254
+ {
1255
+ guard: "isYearView",
1256
+ actions: ["focusNextYear"]
1257
+ },
1258
+ {
1259
+ actions: ["focusNextDay", "setHoveredDate"]
1260
+ }
1261
+ ],
1262
+ "TABLE.ARROW_LEFT": [
1263
+ {
1264
+ guard: "isMonthView",
1265
+ actions: ["focusPreviousMonth"]
1266
+ },
1267
+ {
1268
+ guard: "isYearView",
1269
+ actions: ["focusPreviousYear"]
1270
+ },
1271
+ {
1272
+ actions: ["focusPreviousDay"]
1273
+ }
1274
+ ],
1275
+ "TABLE.ARROW_UP": [
1276
+ {
1277
+ guard: "isMonthView",
1278
+ actions: ["focusPreviousMonthColumn"]
1279
+ },
1280
+ {
1281
+ guard: "isYearView",
1282
+ actions: ["focusPreviousYearColumn"]
1283
+ },
1284
+ {
1285
+ actions: ["focusPreviousWeek"]
1286
+ }
1287
+ ],
1288
+ "TABLE.ARROW_DOWN": [
1289
+ {
1290
+ guard: "isMonthView",
1291
+ actions: ["focusNextMonthColumn"]
1292
+ },
1293
+ {
1294
+ guard: "isYearView",
1295
+ actions: ["focusNextYearColumn"]
1296
+ },
1297
+ {
1298
+ actions: ["focusNextWeek"]
1299
+ }
1300
+ ],
1301
+ "TABLE.PAGE_UP": {
1302
+ actions: ["focusPreviousSection"]
1303
+ },
1304
+ "TABLE.PAGE_DOWN": {
1305
+ actions: ["focusNextSection"]
1306
+ },
1307
+ "TABLE.HOME": [
1308
+ {
1309
+ guard: "isMonthView",
1310
+ actions: ["focusFirstMonth"]
1311
+ },
1312
+ {
1313
+ guard: "isYearView",
1314
+ actions: ["focusFirstYear"]
1315
+ },
1316
+ {
1317
+ actions: ["focusSectionStart"]
1318
+ }
1319
+ ],
1320
+ "TABLE.END": [
1321
+ {
1322
+ guard: "isMonthView",
1323
+ actions: ["focusLastMonth"]
1324
+ },
1325
+ {
1326
+ guard: "isYearView",
1327
+ actions: ["focusLastYear"]
1328
+ },
1329
+ {
1330
+ actions: ["focusSectionEnd"]
1331
+ }
1332
+ ],
1333
+ "TRIGGER.CLICK": [
1334
+ {
1335
+ guard: "isOpenControlled",
1336
+ actions: ["invokeOnClose"]
1337
+ },
1338
+ {
1339
+ target: "focused",
1340
+ actions: ["invokeOnClose"]
1341
+ }
1342
+ ],
1343
+ "VIEW.TOGGLE": {
1344
+ actions: ["setNextView"]
1345
+ },
1346
+ INTERACT_OUTSIDE: [
1347
+ {
1348
+ guard: "isOpenControlled",
1349
+ actions: ["setActiveIndexToStart", "invokeOnClose"]
1350
+ },
1351
+ {
1352
+ guard: "shouldRestoreFocus",
1353
+ target: "focused",
1354
+ actions: ["setActiveIndexToStart", "invokeOnClose", "focusTriggerElement"]
1355
+ },
1356
+ {
1357
+ target: "idle",
1358
+ actions: ["setActiveIndexToStart", "invokeOnClose"]
1359
+ }
1360
+ ],
1361
+ CLOSE: [
1362
+ {
1363
+ guard: "isOpenControlled",
1364
+ actions: ["setActiveIndexToStart", "invokeOnClose"]
1365
+ },
1366
+ {
1367
+ target: "idle",
1368
+ actions: ["setActiveIndexToStart", "invokeOnClose"]
1369
+ }
1370
+ ]
1371
+ }
1372
+ }
1373
+ },
1374
+ implementations: {
1375
+ guards: {
1376
+ isAboveMinView: ({ context: e, prop: t }) => qt(e.get("view"), t("minView")),
1377
+ isDayView: ({ context: e, event: t }) => (t.view || e.get("view")) === "day",
1378
+ isMonthView: ({ context: e, event: t }) => (t.view || e.get("view")) === "month",
1379
+ isYearView: ({ context: e, event: t }) => (t.view || e.get("view")) === "year",
1380
+ isRangePicker: ({ prop: e }) => e("selectionMode") === "range",
1381
+ hasSelectedRange: ({ context: e }) => e.get("value").length === 2,
1382
+ isMultiPicker: ({ prop: e }) => e("selectionMode") === "multiple",
1383
+ shouldRestoreFocus: ({ context: e }) => !!e.get("restoreFocus"),
1384
+ isSelectingEndDate: ({ context: e }) => e.get("activeIndex") === 1,
1385
+ closeOnSelect: ({ prop: e }) => !!e("closeOnSelect"),
1386
+ isOpenControlled: ({ prop: e }) => e("open") != null || !!e("inline"),
1387
+ isInteractOutsideEvent: ({ event: e }) => {
1388
+ var t;
1389
+ return ((t = e.previousEvent) == null ? void 0 : t.type) === "INTERACT_OUTSIDE";
1390
+ },
1391
+ isInputValueEmpty: ({ event: e }) => e.value.trim() === "",
1392
+ shouldFixOnBlur: ({ event: e }) => !!e.fixOnBlur
1393
+ },
1394
+ effects: {
1395
+ trackPositioning({ context: e, prop: t, scope: a }) {
1396
+ if (t("inline")) return;
1397
+ e.get("currentPlacement") || e.set("currentPlacement", t("positioning").placement);
1398
+ const n = $e(a);
1399
+ return Ct(n, () => Wt(a), {
1400
+ ...t("positioning"),
1401
+ defer: !0,
1402
+ onComplete(l) {
1403
+ e.set("currentPlacement", l.placement);
1404
+ }
1405
+ });
1406
+ },
1407
+ setupLiveRegion({ scope: e, refs: t }) {
1408
+ const a = e.getDoc();
1409
+ return t.set("announcer", xt({ level: "assertive", document: a })), () => {
1410
+ var n, s;
1411
+ return (s = (n = t.get("announcer")) == null ? void 0 : n.destroy) == null ? void 0 : s.call(n);
1412
+ };
1413
+ },
1414
+ trackDismissableElement({ scope: e, send: t, context: a, prop: n }) {
1415
+ return n("inline") ? void 0 : Rt(() => z(e), {
1416
+ defer: !0,
1417
+ exclude: [...Y(e), xe(e), Ht(e)],
1418
+ onInteractOutside(l) {
1419
+ a.set("restoreFocus", !l.detail.focusable);
1420
+ },
1421
+ onDismiss() {
1422
+ t({ type: "INTERACT_OUTSIDE" });
1423
+ },
1424
+ onEscapeKeyDown(l) {
1425
+ l.preventDefault(), t({ type: "TABLE.ESCAPE", src: "dismissable" });
1426
+ }
1427
+ });
1428
+ }
1429
+ },
1430
+ actions: {
1431
+ setNextView({ context: e, prop: t }) {
1432
+ const a = Jt(e.get("view"), t("minView"), t("maxView"));
1433
+ e.set("view", a);
1434
+ },
1435
+ setPreviousView({ context: e, prop: t }) {
1436
+ const a = Qt(e.get("view"), t("minView"), t("maxView"));
1437
+ e.set("view", a);
1438
+ },
1439
+ setView({ context: e, event: t }) {
1440
+ e.set("view", t.view);
1441
+ },
1442
+ setRestoreFocus({ context: e }) {
1443
+ e.set("restoreFocus", !0);
1444
+ },
1445
+ announceValueText({ context: e, prop: t, refs: a }) {
1446
+ var s;
1447
+ const n = e.get("value").map((l) => vt(l, null, t("locale"), t("timeZone")));
1448
+ (s = a.get("announcer")) == null || s.announce(n.join(","), 3e3);
1449
+ },
1450
+ announceVisibleRange({ computed: e, refs: t }) {
1451
+ var n;
1452
+ const { formatted: a } = e("visibleRangeText");
1453
+ (n = t.get("announcer")) == null || n.announce(a);
1454
+ },
1455
+ disableTextSelection({ scope: e }) {
1456
+ ht({ target: z(e), doc: e.getDoc() });
1457
+ },
1458
+ enableTextSelection({ scope: e }) {
1459
+ pt({ doc: e.getDoc(), target: z(e) });
1460
+ },
1461
+ focusFirstSelectedDate(e) {
1462
+ const { context: t } = e;
1463
+ t.get("value").length && m(e, t.get("value")[0]);
1464
+ },
1465
+ syncInputElement({ scope: e, computed: t }) {
1466
+ M(() => {
1467
+ Y(e).forEach((n, s) => {
1468
+ j(n, t("valueAsString")[s] || "");
1469
+ });
1470
+ });
1471
+ },
1472
+ setFocusedDate(e) {
1473
+ const { event: t } = e, a = Array.isArray(t.value) ? t.value[0] : t.value;
1474
+ m(e, a);
1475
+ },
1476
+ setFocusedValueForView(e) {
1477
+ const { context: t, event: a } = e;
1478
+ m(e, t.get("focusedValue").set({ [t.get("view")]: a.value }));
1479
+ },
1480
+ focusNextMonth(e) {
1481
+ const { context: t } = e;
1482
+ m(e, t.get("focusedValue").add({ months: 1 }));
1483
+ },
1484
+ focusPreviousMonth(e) {
1485
+ const { context: t } = e;
1486
+ m(e, t.get("focusedValue").subtract({ months: 1 }));
1487
+ },
1488
+ setDateValue({ context: e, event: t, prop: a }) {
1489
+ if (!Array.isArray(t.value)) return;
1490
+ const n = t.value.map((s) => F(s, a("min"), a("max")));
1491
+ e.set("value", n);
1492
+ },
1493
+ clearDateValue({ context: e }) {
1494
+ e.set("value", []);
1495
+ },
1496
+ setSelectedDate(e) {
1497
+ const { context: t, event: a } = e, n = Array.from(t.get("value"));
1498
+ n[t.get("activeIndex")] = ee(e, a.value ?? t.get("focusedValue")), t.set("value", ge(n));
1499
+ },
1500
+ resetSelection(e) {
1501
+ const { context: t, event: a } = e, n = ee(e, a.value ?? t.get("focusedValue"));
1502
+ t.set("value", [n]);
1503
+ },
1504
+ toggleSelectedDate(e) {
1505
+ const { context: t, event: a } = e, n = ee(e, a.value ?? t.get("focusedValue")), s = t.get("value").findIndex((l) => C(l, n));
1506
+ if (s === -1) {
1507
+ const l = [...t.get("value"), n];
1508
+ t.set("value", q(l));
1509
+ } else {
1510
+ const l = Array.from(t.get("value"));
1511
+ l.splice(s, 1), t.set("value", q(l));
1512
+ }
1513
+ },
1514
+ setHoveredDate({ context: e, event: t }) {
1515
+ e.set("hoveredValue", t.value);
1516
+ },
1517
+ clearHoveredDate({ context: e }) {
1518
+ e.set("hoveredValue", null);
1519
+ },
1520
+ selectFocusedDate({ context: e, computed: t }) {
1521
+ const a = Array.from(e.get("value")), n = e.get("activeIndex");
1522
+ a[n] = e.get("focusedValue").copy(), e.set("value", ge(a));
1523
+ const s = t("valueAsString");
1524
+ e.set("inputValue", s[n]);
1525
+ },
1526
+ focusPreviousDay(e) {
1527
+ const { context: t } = e, a = t.get("focusedValue").subtract({ days: 1 });
1528
+ m(e, a);
1529
+ },
1530
+ focusNextDay(e) {
1531
+ const { context: t } = e, a = t.get("focusedValue").add({ days: 1 });
1532
+ m(e, a);
1533
+ },
1534
+ focusPreviousWeek(e) {
1535
+ const { context: t } = e, a = t.get("focusedValue").subtract({ weeks: 1 });
1536
+ m(e, a);
1537
+ },
1538
+ focusNextWeek(e) {
1539
+ const { context: t } = e, a = t.get("focusedValue").add({ weeks: 1 });
1540
+ m(e, a);
1541
+ },
1542
+ focusNextPage(e) {
1543
+ const { context: t, computed: a, prop: n } = e, s = gt(
1544
+ t.get("focusedValue"),
1545
+ t.get("startValue"),
1546
+ a("visibleDuration"),
1547
+ n("locale"),
1548
+ n("min"),
1549
+ n("max")
1550
+ );
1551
+ J(e, s);
1552
+ },
1553
+ focusPreviousPage(e) {
1554
+ const { context: t, computed: a, prop: n } = e, s = dt(
1555
+ t.get("focusedValue"),
1556
+ t.get("startValue"),
1557
+ a("visibleDuration"),
1558
+ n("locale"),
1559
+ n("min"),
1560
+ n("max")
1561
+ );
1562
+ J(e, s);
1563
+ },
1564
+ focusSectionStart(e) {
1565
+ const { context: t } = e;
1566
+ m(e, t.get("startValue").copy());
1567
+ },
1568
+ focusSectionEnd(e) {
1569
+ const { computed: t } = e;
1570
+ m(e, t("endValue").copy());
1571
+ },
1572
+ focusNextSection(e) {
1573
+ const { context: t, event: a, computed: n, prop: s } = e, l = ut(
1574
+ t.get("focusedValue"),
1575
+ t.get("startValue"),
1576
+ a.larger,
1577
+ n("visibleDuration"),
1578
+ s("locale"),
1579
+ s("min"),
1580
+ s("max")
1581
+ );
1582
+ l && J(e, l);
1583
+ },
1584
+ focusPreviousSection(e) {
1585
+ const { context: t, event: a, computed: n, prop: s } = e, l = ct(
1586
+ t.get("focusedValue"),
1587
+ t.get("startValue"),
1588
+ a.larger,
1589
+ n("visibleDuration"),
1590
+ s("locale"),
1591
+ s("min"),
1592
+ s("max")
1593
+ );
1594
+ l && J(e, l);
1595
+ },
1596
+ focusNextYear(e) {
1597
+ const { context: t } = e, a = t.get("focusedValue").add({ years: 1 });
1598
+ m(e, a);
1599
+ },
1600
+ focusPreviousYear(e) {
1601
+ const { context: t } = e, a = t.get("focusedValue").subtract({ years: 1 });
1602
+ m(e, a);
1603
+ },
1604
+ focusNextDecade(e) {
1605
+ const { context: t } = e, a = t.get("focusedValue").add({ years: 10 });
1606
+ m(e, a);
1607
+ },
1608
+ focusPreviousDecade(e) {
1609
+ const { context: t } = e, a = t.get("focusedValue").subtract({ years: 10 });
1610
+ m(e, a);
1611
+ },
1612
+ clearFocusedDate(e) {
1613
+ const { prop: t } = e;
1614
+ m(e, U(t("timeZone")));
1615
+ },
1616
+ focusPreviousMonthColumn(e) {
1617
+ const { context: t, event: a } = e, n = t.get("focusedValue").subtract({ months: a.columns });
1618
+ m(e, n);
1619
+ },
1620
+ focusNextMonthColumn(e) {
1621
+ const { context: t, event: a } = e, n = t.get("focusedValue").add({ months: a.columns });
1622
+ m(e, n);
1623
+ },
1624
+ focusPreviousYearColumn(e) {
1625
+ const { context: t, event: a } = e, n = t.get("focusedValue").subtract({ years: a.columns });
1626
+ m(e, n);
1627
+ },
1628
+ focusNextYearColumn(e) {
1629
+ const { context: t, event: a } = e, n = t.get("focusedValue").add({ years: a.columns });
1630
+ m(e, n);
1631
+ },
1632
+ focusFirstMonth(e) {
1633
+ const { context: t } = e, a = t.get("focusedValue").set({ month: 1 });
1634
+ m(e, a);
1635
+ },
1636
+ focusLastMonth(e) {
1637
+ const { context: t } = e, a = t.get("focusedValue").set({ month: 12 });
1638
+ m(e, a);
1639
+ },
1640
+ focusFirstYear(e) {
1641
+ const { context: t } = e, a = ae(t.get("focusedValue").year), n = t.get("focusedValue").set({ year: a[0] });
1642
+ m(e, n);
1643
+ },
1644
+ focusLastYear(e) {
1645
+ const { context: t } = e, a = ae(t.get("focusedValue").year), n = t.get("focusedValue").set({ year: a[a.length - 1] });
1646
+ m(e, n);
1647
+ },
1648
+ setActiveIndex({ context: e, event: t }) {
1649
+ e.set("activeIndex", t.index);
1650
+ },
1651
+ setActiveIndexToEnd({ context: e }) {
1652
+ e.set("activeIndex", 1);
1653
+ },
1654
+ setActiveIndexToStart({ context: e }) {
1655
+ e.set("activeIndex", 0);
1656
+ },
1657
+ focusActiveCell({ scope: e, context: t }) {
1658
+ M(() => {
1659
+ var n;
1660
+ const a = t.get("view");
1661
+ (n = Re(e, a)) == null || n.focus({ preventScroll: !0 });
1662
+ });
1663
+ },
1664
+ focusActiveCellIfNeeded({ scope: e, context: t, event: a }) {
1665
+ a.focus && M(() => {
1666
+ var s;
1667
+ const n = t.get("view");
1668
+ (s = Re(e, n)) == null || s.focus({ preventScroll: !0 });
1669
+ });
1670
+ },
1671
+ setHoveredValueIfKeyboard({ context: e, event: t, prop: a }) {
1672
+ !t.type.startsWith("TABLE.ARROW") || a("selectionMode") !== "range" || e.get("activeIndex") === 0 || e.set("hoveredValue", e.get("focusedValue").copy());
1673
+ },
1674
+ focusTriggerElement({ scope: e }) {
1675
+ M(() => {
1676
+ var t;
1677
+ (t = xe(e)) == null || t.focus({ preventScroll: !0 });
1678
+ });
1679
+ },
1680
+ focusFirstInputElement({ scope: e }) {
1681
+ M(() => {
1682
+ const [t] = Y(e);
1683
+ t == null || t.focus({ preventScroll: !0 });
1684
+ });
1685
+ },
1686
+ focusInputElement({ scope: e }) {
1687
+ M(() => {
1688
+ const t = Y(e), a = t.findLastIndex((l) => l.value !== ""), n = Math.max(a, 0), s = t[n];
1689
+ s == null || s.focus({ preventScroll: !0 }), s == null || s.setSelectionRange(s.value.length, s.value.length);
1690
+ });
1691
+ },
1692
+ syncMonthSelectElement({ scope: e, context: t }) {
1693
+ const a = Ut(e);
1694
+ j(a, t.get("startValue").month.toString());
1695
+ },
1696
+ syncYearSelectElement({ scope: e, context: t }) {
1697
+ const a = $t(e);
1698
+ j(a, t.get("startValue").year.toString());
1699
+ },
1700
+ setInputValue({ context: e, event: t }) {
1701
+ e.get("activeIndex") === t.index && e.set("inputValue", t.value);
1702
+ },
1703
+ syncInputValue({ scope: e, context: t, event: a }) {
1704
+ queueMicrotask(() => {
1705
+ const n = Y(e), s = a.index ?? t.get("activeIndex");
1706
+ j(n[s], t.get("inputValue"));
1707
+ });
1708
+ },
1709
+ focusParsedDate(e) {
1710
+ const { event: t, prop: a } = e;
1711
+ if (t.index == null) return;
1712
+ const s = a("parse")(t.value, { locale: a("locale"), timeZone: a("timeZone") });
1713
+ !s || !Ae(s) || m(e, s);
1714
+ },
1715
+ selectParsedDate({ context: e, event: t, prop: a }) {
1716
+ if (t.index == null) return;
1717
+ let s = a("parse")(t.value, { locale: a("locale"), timeZone: a("timeZone") });
1718
+ if ((!s || !Ae(s)) && t.value && (s = e.get("focusedValue").copy()), !s) return;
1719
+ s = F(s, a("min"), a("max"));
1720
+ const l = Array.from(e.get("value"));
1721
+ l[t.index] = s, e.set("value", l);
1722
+ const d = X(l, a);
1723
+ e.set("inputValue", d[t.index]);
1724
+ },
1725
+ resetView({ context: e }) {
1726
+ e.set("view", e.initial("view"));
1727
+ },
1728
+ setStartValue({ context: e, computed: t, prop: a }) {
1729
+ const n = e.get("focusedValue");
1730
+ if (!$(n, e.get("startValue"), t("endValue"))) return;
1731
+ const l = Ce(n, "start", { months: a("numOfMonths") }, a("locale"));
1732
+ e.set("startValue", l);
1733
+ },
1734
+ invokeOnOpen({ prop: e }) {
1735
+ var t;
1736
+ e("inline") || (t = e("onOpenChange")) == null || t({ open: !0 });
1737
+ },
1738
+ invokeOnClose({ prop: e }) {
1739
+ var t;
1740
+ e("inline") || (t = e("onOpenChange")) == null || t({ open: !1 });
1741
+ },
1742
+ toggleVisibility({ event: e, send: t, prop: a }) {
1743
+ t({ type: a("open") ? "CONTROLLED.OPEN" : "CONTROLLED.CLOSE", previousEvent: e });
1744
+ }
1745
+ }
1746
+ }
1747
+ }), ee = (e, t) => {
1748
+ const { context: a, prop: n } = e, s = a.get("view");
1749
+ let l = typeof t == "number" ? a.get("focusedValue").set({ [s]: t }) : t;
1750
+ return ea((d) => {
1751
+ Xt(d, n("minView")) && (l = l.set({ [d]: d === "day" ? 1 : 0 }));
1752
+ }), l;
1753
+ };
1754
+ function m(e, t) {
1755
+ const { context: a, prop: n, computed: s } = e;
1756
+ if (!t) return;
1757
+ const l = ee(e, t);
1758
+ if (C(a.get("focusedValue"), l)) return;
1759
+ const g = yt(s("visibleDuration"), n("locale"), n("min"), n("max"))({
1760
+ focusedDate: l,
1761
+ startDate: a.get("startValue")
1762
+ });
1763
+ a.set("startValue", g.startDate), a.set("focusedValue", g.focusedDate);
1764
+ }
1765
+ function J(e, t) {
1766
+ const { context: a } = e;
1767
+ a.set("startValue", t.startDate);
1768
+ const n = a.get("focusedValue");
1769
+ C(n, t.focusedDate) || a.set("focusedValue", t.focusedDate);
1770
+ }
1771
+ H()([
1772
+ "closeOnSelect",
1773
+ "dir",
1774
+ "disabled",
1775
+ "fixedWeeks",
1776
+ "focusedValue",
1777
+ "format",
1778
+ "parse",
1779
+ "placeholder",
1780
+ "getRootNode",
1781
+ "id",
1782
+ "ids",
1783
+ "inline",
1784
+ "isDateUnavailable",
1785
+ "locale",
1786
+ "max",
1787
+ "min",
1788
+ "name",
1789
+ "numOfMonths",
1790
+ "onFocusChange",
1791
+ "onOpenChange",
1792
+ "onValueChange",
1793
+ "onViewChange",
1794
+ "open",
1795
+ "defaultOpen",
1796
+ "positioning",
1797
+ "readOnly",
1798
+ "selectionMode",
1799
+ "startOfWeek",
1800
+ "timeZone",
1801
+ "translations",
1802
+ "value",
1803
+ "defaultView",
1804
+ "defaultValue",
1805
+ "view",
1806
+ "defaultFocusedValue",
1807
+ "outsideDaySelectable",
1808
+ "minView",
1809
+ "maxView"
1810
+ ]);
1811
+ H()(["index", "fixOnBlur"]);
1812
+ H()(["value"]);
1813
+ H()(["columns", "id", "view"]);
1814
+ H()(["disabled", "value", "columns"]);
1815
+ H()(["view"]);
1816
+ export {
1817
+ At as anatomy,
1818
+ va as connect,
1819
+ fa as machine
1820
+ };