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