impact-nova 2.5.9 → 2.5.11
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/components/data/data-table/column-runtime-state-guard.js +42 -42
- package/dist/components/data/data-table/data-table-column-tree-cache.d.ts +15 -0
- package/dist/components/data/data-table/data-table-column-tree-cache.js +109 -80
- package/dist/components/data/data-table/use-data-table-column-list-sync.js +65 -62
- package/dist/components/data-display/calendar/calendar-apply-validation.d.ts +2 -0
- package/dist/components/data-display/calendar/calendar-apply-validation.js +64 -67
- package/dist/components/data-display/calendar/calendar-available-view.d.ts +27 -0
- package/dist/components/data-display/calendar/calendar-available-view.js +85 -0
- package/dist/components/data-display/calendar/calendar-day-picker-classnames.d.ts +6 -1
- package/dist/components/data-display/calendar/calendar-day-picker-classnames.js +31 -23
- package/dist/components/data-display/calendar/calendar-day-picker-components.d.ts +5 -2
- package/dist/components/data-display/calendar/calendar-day-picker-components.js +210 -167
- package/dist/components/data-display/calendar/calendar-day-picker-view.d.ts +3 -2
- package/dist/components/data-display/calendar/calendar-day-picker-view.js +126 -124
- package/dist/components/data-display/calendar/calendar-fiscal-period-nav.d.ts +6 -0
- package/dist/components/data-display/calendar/calendar-fiscal-period-nav.js +34 -18
- package/dist/components/data-display/calendar/calendar-month-utils.d.ts +5 -0
- package/dist/components/data-display/calendar/calendar-month-utils.js +85 -64
- package/dist/components/data-display/calendar/calendar-padding-week.utils.d.ts +5 -1
- package/dist/components/data-display/calendar/calendar-padding-week.utils.js +20 -16
- package/dist/components/data-display/calendar/calendar-selection-appearance.d.ts +1 -0
- package/dist/components/data-display/calendar/calendar-selection-appearance.js +31 -30
- package/dist/components/data-display/calendar/calendar-week-number-cell.d.ts +3 -1
- package/dist/components/data-display/calendar/calendar-week-number-cell.js +68 -53
- package/dist/components/data-display/calendar/calendar-week-utils.d.ts +6 -0
- package/dist/components/data-display/calendar/calendar-week-utils.js +51 -47
- package/dist/components/data-display/calendar/calendar-year-panes.d.ts +2 -0
- package/dist/components/data-display/calendar/calendar-year-panes.js +3 -1
- package/dist/components/data-display/calendar/calendar.js +170 -165
- package/dist/components/data-display/calendar/calendar.types.d.ts +7 -0
- package/dist/components/data-display/calendar/use-calendar-day-picker-config.d.ts +5 -2
- package/dist/components/data-display/calendar/use-calendar-day-picker-config.js +86 -76
- package/dist/components/data-display/calendar/use-calendar-state.d.ts +3 -1
- package/dist/components/data-display/calendar/use-calendar-state.js +403 -325
- package/dist/components/feedback/dialog/dialog.js +12 -12
- package/dist/components/feedback/sheet/sheet.js +22 -22
- package/dist/components/forms/date-picker/calendar-selection-adapters.d.ts +2 -0
- package/dist/components/forms/date-picker/calendar-selection-adapters.js +36 -31
- package/dist/components/forms/date-picker/date-input-behavior.d.ts +10 -0
- package/dist/components/forms/date-picker/date-input-behavior.js +111 -90
- package/dist/components/forms/date-picker/date-picker.js +74 -70
- package/dist/components/forms/date-picker/date-picker.types.d.ts +7 -0
- package/dist/components/forms/date-picker/date-range-picker.js +148 -144
- package/dist/components/forms/date-picker/fiscal-pass-through.d.ts +2 -0
- package/dist/components/forms/date-picker/fiscal-pass-through.js +4 -2
- package/dist/components/forms/date-picker/month-picker.js +84 -80
- package/dist/components/forms/date-picker/month-range-picker.js +147 -143
- package/dist/components/forms/date-picker/multi-date-picker.js +53 -49
- package/dist/components/forms/date-picker/multi-month-picker.js +51 -47
- package/dist/components/forms/date-picker/multi-quarter-picker.js +48 -44
- package/dist/components/forms/date-picker/multi-week-picker.js +55 -51
- package/dist/components/forms/date-picker/multi-year-picker.js +50 -46
- package/dist/components/forms/date-picker/picker-story-layout.d.ts +2 -0
- package/dist/components/forms/date-picker/quarter-picker.js +48 -44
- package/dist/components/forms/date-picker/quarter-range-picker.js +47 -43
- package/dist/components/forms/date-picker/week-picker.js +86 -82
- package/dist/components/forms/date-picker/week-range-picker.js +171 -164
- package/dist/components/forms/date-picker/year-picker.js +49 -45
- package/dist/components/forms/date-picker/year-range-picker.js +49 -45
- package/dist/components/forms/select/components/SelectMenuPanel.js +3 -2
- package/dist/components/forms/select/select.js +1 -0
- package/dist/form-react/Fields/DateInputField.js +51 -50
- package/dist/form-react/Fields/DateRangeField.js +14 -13
- package/dist/form-react/Fields/MonthRangeField.js +29 -28
- package/dist/form-react/Fields/MultiMonthPickerField.js +13 -12
- package/dist/form-react/Fields/MultiWeekPickerField.js +18 -17
- package/dist/form-react/Fields/WeekRangePicker.js +48 -48
- package/dist/form-react/types/fields.types.d.ts +14 -0
- package/dist/impact-nova.css +1 -1
- package/dist/lib/overlay/overlay-portal-context.js +16 -16
- package/dist/llms/rules/installation.js +1 -1
- package/dist/llms/rules/requirements.js +1 -1
- package/package.json +1 -1
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { jsx as r, jsxs as g } from "react/jsx-runtime";
|
|
2
2
|
import * as t from "react";
|
|
3
|
-
import { Cross as
|
|
4
|
-
import { cn as
|
|
5
|
-
import { Input as
|
|
6
|
-
import { Calendar as
|
|
3
|
+
import { Cross as _, CalendarMonth as q } from "impact-nova-icons";
|
|
4
|
+
import { cn as ee } from "../../../lib/utils.js";
|
|
5
|
+
import { Input as re } from "../input/input.js";
|
|
6
|
+
import { Calendar as te } from "../../data-display/calendar/calendar.js";
|
|
7
7
|
import { Tooltip as C, TooltipTrigger as x, TooltipContent as b } from "../../feedback/tooltip/tooltip.js";
|
|
8
|
-
import { useImpactNovaI18n as
|
|
9
|
-
import { buildDateBoundsMatcher as
|
|
10
|
-
import { fiscalCalendarPassThrough as
|
|
11
|
-
import { DatePickerShell as
|
|
12
|
-
import { usePickerDismissActionsRef as
|
|
8
|
+
import { useImpactNovaI18n as ne } from "../../../i18n/use-impact-nova-i18n.js";
|
|
9
|
+
import { buildDateBoundsMatcher as oe } from "../../../lib/date-bounds-matcher.js";
|
|
10
|
+
import { fiscalCalendarPassThrough as ae } from "./fiscal-pass-through.js";
|
|
11
|
+
import { DatePickerShell as ie } from "./date-picker-shell.js";
|
|
12
|
+
import { usePickerDismissActionsRef as ce, usePickerFooterDismissNudge as se, handleReadonlyPickerKeyDown as le, handlePickerSurfacePointerDown as fe } from "./date-input-behavior.js";
|
|
13
13
|
import { formatQuarterInput as D } from "../../data-display/calendar/calendar-fiscal-labels.js";
|
|
14
|
-
import { viewMonthFromQuarter as
|
|
15
|
-
const
|
|
14
|
+
import { viewMonthFromQuarter as pe } from "../../data-display/calendar/calendar-quarter-utils.js";
|
|
15
|
+
const de = t.forwardRef(
|
|
16
16
|
({
|
|
17
17
|
value: n,
|
|
18
18
|
onChange: d,
|
|
@@ -31,26 +31,30 @@ const fe = t.forwardRef(
|
|
|
31
31
|
fiscalYearStartMonth: K,
|
|
32
32
|
fiscalConfig: j,
|
|
33
33
|
showPresets: F,
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
const
|
|
34
|
+
showPeriodBoundaries: $,
|
|
35
|
+
autoNavigateToAvailable: z,
|
|
36
|
+
...E
|
|
37
|
+
}, H) => {
|
|
38
|
+
const { t: a } = ne(), L = Q ?? a("datePicker.selectQuarterRange"), m = t.useRef(null), y = t.useRef(null);
|
|
39
|
+
t.useImperativeHandle(H, () => m.current);
|
|
40
|
+
const [i, c] = t.useState(!1), u = t.useRef(!1), k = ce(), { footerFlashKey: V, footerFlashTarget: B, popoverHandlers: G } = se(l, i, k, y), [P, f] = t.useState(n), [J, U] = t.useState(pe(n?.from));
|
|
39
41
|
t.useEffect(() => {
|
|
40
42
|
i || f(n);
|
|
41
43
|
}, [i, n]);
|
|
42
|
-
const p = t.useCallback(() => c(!1), []),
|
|
44
|
+
const p = t.useCallback(() => c(!1), []), W = ae({
|
|
43
45
|
calendarKind: M,
|
|
44
46
|
fiscalMode: O,
|
|
45
47
|
granularity: T,
|
|
46
48
|
fiscalMonthPattern: w,
|
|
47
49
|
fiscalYearStartMonth: K,
|
|
48
50
|
fiscalConfig: j,
|
|
49
|
-
showPresets: F
|
|
50
|
-
|
|
51
|
+
showPresets: F,
|
|
52
|
+
showPeriodBoundaries: $,
|
|
53
|
+
autoNavigateToAvailable: z
|
|
54
|
+
}), X = (e) => {
|
|
51
55
|
const s = e && !Array.isArray(e) && ("from" in e || "to" in e) ? e : void 0;
|
|
52
56
|
f(s), l || (d?.(s), s?.to && p());
|
|
53
|
-
},
|
|
57
|
+
}, Y = () => {
|
|
54
58
|
d?.(P), p();
|
|
55
59
|
}, h = () => {
|
|
56
60
|
f(n), p();
|
|
@@ -60,9 +64,9 @@ const fe = t.forwardRef(
|
|
|
60
64
|
t.useLayoutEffect(() => {
|
|
61
65
|
k.current = { onDismiss: h, resolveFlash: () => "cancel" };
|
|
62
66
|
});
|
|
63
|
-
const
|
|
67
|
+
const Z = n?.from ? `${D(n.from)}${n.to ? ` – ${D(n.to)}` : ""}` : "";
|
|
64
68
|
return /* @__PURE__ */ r(
|
|
65
|
-
|
|
69
|
+
ie,
|
|
66
70
|
{
|
|
67
71
|
open: i,
|
|
68
72
|
disabled: o,
|
|
@@ -73,26 +77,26 @@ const fe = t.forwardRef(
|
|
|
73
77
|
onOpenAutoFocus: (e) => {
|
|
74
78
|
u.current || e.preventDefault(), u.current = !1;
|
|
75
79
|
},
|
|
76
|
-
popoverHandlers:
|
|
80
|
+
popoverHandlers: G,
|
|
77
81
|
trigger: /* @__PURE__ */ r(
|
|
78
82
|
"div",
|
|
79
83
|
{
|
|
80
84
|
ref: y,
|
|
81
85
|
"data-component": "quarter-range-picker",
|
|
82
86
|
"data-state": i ? "open" : "closed",
|
|
83
|
-
onPointerDown: (e) =>
|
|
87
|
+
onPointerDown: (e) => fe({
|
|
84
88
|
disabled: o,
|
|
85
89
|
event: e,
|
|
86
90
|
onOpen: () => c(!0),
|
|
87
91
|
focusField: () => m.current?.focus()
|
|
88
92
|
}),
|
|
89
93
|
children: /* @__PURE__ */ r(
|
|
90
|
-
|
|
94
|
+
re,
|
|
91
95
|
{
|
|
92
96
|
ref: m,
|
|
93
|
-
value:
|
|
97
|
+
value: Z,
|
|
94
98
|
readOnly: !0,
|
|
95
|
-
onKeyDown: (e) =>
|
|
99
|
+
onKeyDown: (e) => le(e, {
|
|
96
100
|
disabled: o,
|
|
97
101
|
open: i,
|
|
98
102
|
onOpen: () => c(!0),
|
|
@@ -102,10 +106,10 @@ const fe = t.forwardRef(
|
|
|
102
106
|
}
|
|
103
107
|
}),
|
|
104
108
|
onClick: () => !o && c(!0),
|
|
105
|
-
placeholder:
|
|
109
|
+
placeholder: L,
|
|
106
110
|
disabled: o,
|
|
107
111
|
"data-form-control": "input",
|
|
108
|
-
className:
|
|
112
|
+
className: ee("cursor-pointer", I),
|
|
109
113
|
suffix: /* @__PURE__ */ g("div", { className: "flex items-center gap-1", children: [
|
|
110
114
|
n?.from && !o ? /* @__PURE__ */ g(C, { children: [
|
|
111
115
|
/* @__PURE__ */ r(x, { asChild: !0, children: /* @__PURE__ */ r(
|
|
@@ -118,7 +122,7 @@ const fe = t.forwardRef(
|
|
|
118
122
|
e.stopPropagation(), R();
|
|
119
123
|
},
|
|
120
124
|
className: "inline-flex size-4 items-center justify-center border-none bg-transparent p-0",
|
|
121
|
-
children: /* @__PURE__ */ r(
|
|
125
|
+
children: /* @__PURE__ */ r(_, { className: "size-3 hover:text-content" })
|
|
122
126
|
}
|
|
123
127
|
) }),
|
|
124
128
|
/* @__PURE__ */ r(b, { variant: "tertiary", side: "top", children: a("calendar.clear") })
|
|
@@ -135,43 +139,43 @@ const fe = t.forwardRef(
|
|
|
135
139
|
e.stopPropagation(), o || c((s) => !s);
|
|
136
140
|
},
|
|
137
141
|
className: "inline-flex items-center justify-center border-none bg-transparent p-0",
|
|
138
|
-
children: /* @__PURE__ */ r(
|
|
142
|
+
children: /* @__PURE__ */ r(q, { className: "h-4 w-4 text-secondary-foreground" })
|
|
139
143
|
}
|
|
140
144
|
) }),
|
|
141
145
|
/* @__PURE__ */ r(b, { variant: "tertiary", side: "top", children: a("datePicker.selectQuarterRange") })
|
|
142
146
|
] })
|
|
143
147
|
] }),
|
|
144
|
-
|
|
148
|
+
...E
|
|
145
149
|
}
|
|
146
150
|
)
|
|
147
151
|
}
|
|
148
152
|
),
|
|
149
153
|
children: /* @__PURE__ */ r(
|
|
150
|
-
|
|
154
|
+
te,
|
|
151
155
|
{
|
|
152
156
|
pickerType: "quarter",
|
|
153
157
|
monthMode: "range",
|
|
154
158
|
selectedQuarters: P,
|
|
155
|
-
footerFlashKey:
|
|
156
|
-
footerFlashTarget:
|
|
157
|
-
onQuarterSelect:
|
|
158
|
-
month:
|
|
159
|
-
onMonthChange:
|
|
160
|
-
disabled:
|
|
159
|
+
footerFlashKey: V,
|
|
160
|
+
footerFlashTarget: B,
|
|
161
|
+
onQuarterSelect: X,
|
|
162
|
+
month: J,
|
|
163
|
+
onMonthChange: U,
|
|
164
|
+
disabled: oe(N, S),
|
|
161
165
|
startMonth: v,
|
|
162
166
|
endMonth: A,
|
|
163
167
|
showFooter: l,
|
|
164
|
-
onApply:
|
|
168
|
+
onApply: Y,
|
|
165
169
|
onCancel: h,
|
|
166
170
|
onClear: R,
|
|
167
|
-
...
|
|
171
|
+
...W
|
|
168
172
|
}
|
|
169
173
|
)
|
|
170
174
|
}
|
|
171
175
|
);
|
|
172
176
|
}
|
|
173
177
|
);
|
|
174
|
-
|
|
178
|
+
de.displayName = "QuarterRangePicker";
|
|
175
179
|
export {
|
|
176
|
-
|
|
180
|
+
de as QuarterRangePicker
|
|
177
181
|
};
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import { jsxs as W, jsx as a } from "react/jsx-runtime";
|
|
2
2
|
import * as s from "react";
|
|
3
|
-
import { Cross as
|
|
3
|
+
import { Cross as Te, CalendarMonth as Ee } from "impact-nova-icons";
|
|
4
4
|
import { format as j } from "date-fns";
|
|
5
|
-
import { cn as
|
|
6
|
-
import { usePickerDismissActionsRef as
|
|
7
|
-
import { Input as
|
|
8
|
-
import { Popover as
|
|
9
|
-
import { Calendar as
|
|
5
|
+
import { cn as Se } from "../../../lib/utils.js";
|
|
6
|
+
import { usePickerDismissActionsRef as Ae, usePickerFooterDismissNudge as Ne, isDateInputInvalid as we, resolveSingleValueDismissFlash as Ve, handlePickerEscapeKeyDown as Le, handlePickerSurfacePointerDown as Oe, resolveDateInputOnBlur as Me, maskDateInput as je, parseDateInput as Be, resolveDateInputOnEnter as ze } from "./date-input-behavior.js";
|
|
7
|
+
import { Input as He } from "../input/input.js";
|
|
8
|
+
import { Popover as Ke, PopoverAnchor as $e, PopoverContent as qe } from "../../feedback/popover/popover.js";
|
|
9
|
+
import { Calendar as Ge } from "../../data-display/calendar/calendar.js";
|
|
10
10
|
import { Tooltip as Z, TooltipTrigger as _, TooltipContent as Y } from "../../feedback/tooltip/tooltip.js";
|
|
11
|
-
import { resolveWeekSelection as
|
|
12
|
-
import { useImpactNovaI18n as
|
|
13
|
-
import { getDateFnsLocale as
|
|
14
|
-
import { coerceSingleWeekApply as
|
|
15
|
-
import { buildDateBoundsMatcher as
|
|
16
|
-
import { fiscalCalendarPassThrough as
|
|
11
|
+
import { resolveWeekSelection as Je } from "../../../lib/fiscal-calendar/week-selection.js";
|
|
12
|
+
import { useImpactNovaI18n as Qe } from "../../../i18n/use-impact-nova-i18n.js";
|
|
13
|
+
import { getDateFnsLocale as Ue } from "../../../i18n/getDateFnsLocale.js";
|
|
14
|
+
import { coerceSingleWeekApply as Xe, coerceSingleWeek as Ze } from "./calendar-selection-adapters.js";
|
|
15
|
+
import { buildDateBoundsMatcher as _e } from "../../../lib/date-bounds-matcher.js";
|
|
16
|
+
import { fiscalCalendarPassThrough as Ye } from "./fiscal-pass-through.js";
|
|
17
17
|
const F = (n, c = "MM/dd/yyyy", t) => {
|
|
18
18
|
const R = j(n.startDate, c, t ? { locale: t } : {}), b = j(n.endDate, c, t ? { locale: t } : {});
|
|
19
19
|
return `${R} - ${b}`;
|
|
20
|
-
}, g = (n, c, t) => n ? j(n.startDate, c, t ? { locale: t } : {}) : "",
|
|
20
|
+
}, g = (n, c, t) => n ? j(n.startDate, c, t ? { locale: t } : {}) : "", Fe = s.forwardRef(
|
|
21
21
|
({
|
|
22
22
|
value: n,
|
|
23
23
|
onChange: c,
|
|
@@ -31,24 +31,26 @@ const F = (n, c = "MM/dd/yyyy", t) => {
|
|
|
31
31
|
calendarKind: I,
|
|
32
32
|
fiscalMode: x = "basic",
|
|
33
33
|
granularity: T,
|
|
34
|
-
fiscalMonthPattern:
|
|
35
|
-
fiscalYearStartMonth:
|
|
34
|
+
fiscalMonthPattern: E,
|
|
35
|
+
fiscalYearStartMonth: S = 1,
|
|
36
36
|
fiscalConfig: re,
|
|
37
37
|
weekStartsOn: A = 1,
|
|
38
38
|
showPresets: se,
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
showPeriodBoundaries: oe,
|
|
40
|
+
autoNavigateToAvailable: ie,
|
|
41
|
+
comparison: ce,
|
|
42
|
+
onComparisonChange: ae,
|
|
41
43
|
disabled: p,
|
|
42
|
-
className:
|
|
43
|
-
...
|
|
44
|
-
},
|
|
45
|
-
const { locale: B, t: D } =
|
|
46
|
-
s.useImperativeHandle(
|
|
47
|
-
const [o, H] = s.useState(!1),
|
|
48
|
-
f(n), m(g(n, t, i)),
|
|
49
|
-
}, [n, t, i,
|
|
50
|
-
m(g(u ?? n, t, i)),
|
|
51
|
-
}, [u, n, t, i,
|
|
44
|
+
className: le,
|
|
45
|
+
...pe
|
|
46
|
+
}, ue) => {
|
|
47
|
+
const { locale: B, t: D } = Qe(), i = s.useMemo(() => Ue(B), [B]), fe = R ?? D("datePicker.selectWeek"), C = I === "fiscal", N = s.useRef(null), z = s.useRef(null), v = s.useRef(!1);
|
|
48
|
+
s.useImperativeHandle(ue, () => N.current);
|
|
49
|
+
const [o, H] = s.useState(!1), K = Ae(), { footerFlashKey: de, footerFlashTarget: me, popoverHandlers: ke } = Ne(l, o, K, z), [De, w] = s.useState(!1), [u, f] = s.useState(n), [y, m] = s.useState(""), [ye, h] = s.useState(n?.startDate || /* @__PURE__ */ new Date()), he = n ? F(n, t, i) : "", $ = u ? F(u, t, i) : "", V = o || De, ge = V ? y : $, q = s.useCallback(() => {
|
|
50
|
+
f(n), m(g(n, t, i)), C || h(n?.startDate || /* @__PURE__ */ new Date());
|
|
51
|
+
}, [n, t, i, C]), P = s.useCallback(() => {
|
|
52
|
+
m(g(u ?? n, t, i)), C || h((u ?? n)?.startDate || /* @__PURE__ */ new Date());
|
|
53
|
+
}, [u, n, t, i, C]);
|
|
52
54
|
s.useEffect(() => {
|
|
53
55
|
o || f(n);
|
|
54
56
|
}, [o, n]);
|
|
@@ -67,49 +69,49 @@ const F = (n, c = "MM/dd/yyyy", t) => {
|
|
|
67
69
|
l || d();
|
|
68
70
|
}
|
|
69
71
|
}, L = s.useCallback(
|
|
70
|
-
(e) =>
|
|
72
|
+
(e) => Je(e, {
|
|
71
73
|
calendarKind: I,
|
|
72
74
|
fiscalMode: x,
|
|
73
75
|
granularity: T,
|
|
74
|
-
fiscalMonthPattern:
|
|
75
|
-
fiscalYearStartMonth:
|
|
76
|
+
fiscalMonthPattern: E,
|
|
77
|
+
fiscalYearStartMonth: S,
|
|
76
78
|
weekStartsOn: A
|
|
77
79
|
}),
|
|
78
80
|
[
|
|
79
81
|
I,
|
|
80
82
|
x,
|
|
81
83
|
T,
|
|
82
|
-
S,
|
|
83
84
|
E,
|
|
85
|
+
S,
|
|
84
86
|
A
|
|
85
87
|
]
|
|
86
|
-
),
|
|
87
|
-
const r =
|
|
88
|
-
f(r), r && (m(g(r, t, i)),
|
|
88
|
+
), Ce = (e) => {
|
|
89
|
+
const r = Ze(e);
|
|
90
|
+
f(r), r && (m(g(r, t, i)), C || h(r.startDate)), l || (c?.(r), d());
|
|
89
91
|
}, J = (e) => {
|
|
90
|
-
const r =
|
|
92
|
+
const r = Xe(e, u);
|
|
91
93
|
c?.(r), d();
|
|
92
94
|
}, O = () => {
|
|
93
95
|
q(), d();
|
|
94
96
|
}, Q = () => {
|
|
95
97
|
f(void 0), m(""), c?.(void 0), l || d();
|
|
96
|
-
},
|
|
98
|
+
}, ve = (e) => {
|
|
97
99
|
const r = L(e);
|
|
98
100
|
f(r), m(g(r, t, i)), h(e), c?.(r), d();
|
|
99
|
-
},
|
|
100
|
-
const r =
|
|
101
|
+
}, Ie = (e) => {
|
|
102
|
+
const r = je(e.target.value, t, y);
|
|
101
103
|
if (m(r), r === "") {
|
|
102
104
|
f(void 0), l || c?.(void 0);
|
|
103
105
|
return;
|
|
104
106
|
}
|
|
105
|
-
const { parsed: M, isValid:
|
|
106
|
-
if (
|
|
107
|
+
const { parsed: M, isValid: xe } = Be(r, t, i);
|
|
108
|
+
if (xe && M) {
|
|
107
109
|
const X = L(M);
|
|
108
110
|
f(X), h(M), l || c?.(X);
|
|
109
111
|
}
|
|
110
|
-
},
|
|
112
|
+
}, Pe = () => {
|
|
111
113
|
if (w(!1), o) return;
|
|
112
|
-
const e =
|
|
114
|
+
const e = Me(
|
|
113
115
|
y,
|
|
114
116
|
t,
|
|
115
117
|
g(u ?? n, t, i),
|
|
@@ -125,19 +127,19 @@ const F = (n, c = "MM/dd/yyyy", t) => {
|
|
|
125
127
|
return;
|
|
126
128
|
}
|
|
127
129
|
y || (f(void 0), l || c?.(void 0));
|
|
128
|
-
},
|
|
130
|
+
}, We = () => {
|
|
129
131
|
if (o && l) {
|
|
130
132
|
J();
|
|
131
133
|
return;
|
|
132
134
|
}
|
|
133
|
-
const e =
|
|
135
|
+
const e = ze(y, t, i);
|
|
134
136
|
if (e.parsed) {
|
|
135
|
-
l &&
|
|
137
|
+
l && ve(e.parsed);
|
|
136
138
|
return;
|
|
137
139
|
}
|
|
138
|
-
o || (
|
|
139
|
-
}, U =
|
|
140
|
-
() =>
|
|
140
|
+
o || (v.current = !0, k(!0));
|
|
141
|
+
}, U = he !== $, Re = V && we(y, t, i), be = s.useCallback(
|
|
142
|
+
() => Ve(
|
|
141
143
|
u,
|
|
142
144
|
n,
|
|
143
145
|
(e, r) => e.startDate.getTime() === r.startDate.getTime()
|
|
@@ -145,45 +147,45 @@ const F = (n, c = "MM/dd/yyyy", t) => {
|
|
|
145
147
|
[u, n]
|
|
146
148
|
);
|
|
147
149
|
return s.useLayoutEffect(() => {
|
|
148
|
-
|
|
150
|
+
K.current = {
|
|
149
151
|
onDismiss: O,
|
|
150
|
-
resolveFlash:
|
|
152
|
+
resolveFlash: be
|
|
151
153
|
};
|
|
152
|
-
}), /* @__PURE__ */ W(
|
|
153
|
-
/* @__PURE__ */ a(
|
|
154
|
+
}), /* @__PURE__ */ W(Ke, { open: p ? !1 : o, onOpenChange: k, children: [
|
|
155
|
+
/* @__PURE__ */ a($e, { asChild: !0, children: /* @__PURE__ */ a(
|
|
154
156
|
"div",
|
|
155
157
|
{
|
|
156
158
|
ref: z,
|
|
157
159
|
"data-component": "week-picker",
|
|
158
160
|
"data-state": o ? "open" : "closed",
|
|
159
161
|
"data-pending": U || void 0,
|
|
160
|
-
onPointerDown: (e) =>
|
|
162
|
+
onPointerDown: (e) => Oe({
|
|
161
163
|
disabled: p,
|
|
162
164
|
event: e,
|
|
163
165
|
onOpen: () => k(!0),
|
|
164
166
|
focusField: () => N.current?.focus()
|
|
165
167
|
}),
|
|
166
168
|
children: /* @__PURE__ */ a(
|
|
167
|
-
|
|
169
|
+
He,
|
|
168
170
|
{
|
|
169
171
|
ref: N,
|
|
170
|
-
value:
|
|
171
|
-
onChange:
|
|
172
|
+
value: ge,
|
|
173
|
+
onChange: Ie,
|
|
172
174
|
onFocus: () => {
|
|
173
175
|
p || (w(!0), P());
|
|
174
176
|
},
|
|
175
|
-
onBlur:
|
|
177
|
+
onBlur: Pe,
|
|
176
178
|
onClick: () => !p && k(!0),
|
|
177
179
|
onKeyDown: (e) => {
|
|
178
|
-
e.key === "Enter" && !p && (e.preventDefault(),
|
|
180
|
+
e.key === "Enter" && !p && (e.preventDefault(), We()), e.key === "ArrowDown" && !o && !p && (e.preventDefault(), v.current = !0, k(!0)), e.key === "Escape" && o && Le(e, { open: o, onCancel: O });
|
|
179
181
|
},
|
|
180
|
-
placeholder: V ? t :
|
|
182
|
+
placeholder: V ? t : fe,
|
|
181
183
|
disabled: p,
|
|
182
184
|
"data-form-control": "input",
|
|
183
|
-
className:
|
|
185
|
+
className: Se(
|
|
184
186
|
"cursor-pointer",
|
|
185
|
-
|
|
186
|
-
|
|
187
|
+
Re ? "text-destructive" : U ? "text-content-placeholder" : "",
|
|
188
|
+
le
|
|
187
189
|
),
|
|
188
190
|
suffix: /* @__PURE__ */ W("div", { className: "flex items-center gap-1", children: [
|
|
189
191
|
n && !p && /* @__PURE__ */ W(Z, { children: [
|
|
@@ -197,7 +199,7 @@ const F = (n, c = "MM/dd/yyyy", t) => {
|
|
|
197
199
|
e.stopPropagation(), Q();
|
|
198
200
|
},
|
|
199
201
|
className: "inline-flex size-4 items-center justify-center bg-transparent border-none p-0 cursor-pointer",
|
|
200
|
-
children: /* @__PURE__ */ a(
|
|
202
|
+
children: /* @__PURE__ */ a(Te, { className: "size-3 hover:text-content" })
|
|
201
203
|
}
|
|
202
204
|
) }),
|
|
203
205
|
/* @__PURE__ */ a(Y, { variant: "tertiary", side: "top", children: D("calendar.clear") })
|
|
@@ -213,56 +215,58 @@ const F = (n, c = "MM/dd/yyyy", t) => {
|
|
|
213
215
|
e.stopPropagation(), p || (o ? d() : k(!0));
|
|
214
216
|
},
|
|
215
217
|
onKeyDown: (e) => {
|
|
216
|
-
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), e.stopPropagation(), p || (
|
|
218
|
+
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), e.stopPropagation(), p || (v.current = !0, o ? d() : k(!0)));
|
|
217
219
|
},
|
|
218
220
|
className: "inline-flex items-center justify-center bg-transparent border-none p-0 cursor-pointer",
|
|
219
|
-
children: /* @__PURE__ */ a(
|
|
221
|
+
children: /* @__PURE__ */ a(Ee, { className: "h-4 w-4 text-secondary-foreground" })
|
|
220
222
|
}
|
|
221
223
|
) }),
|
|
222
224
|
/* @__PURE__ */ a(Y, { variant: "tertiary", side: "top", children: D("datePicker.selectWeek") })
|
|
223
225
|
] })
|
|
224
226
|
] }),
|
|
225
|
-
...
|
|
227
|
+
...pe
|
|
226
228
|
}
|
|
227
229
|
)
|
|
228
230
|
}
|
|
229
231
|
) }),
|
|
230
232
|
/* @__PURE__ */ a(
|
|
231
|
-
|
|
233
|
+
qe,
|
|
232
234
|
{
|
|
233
235
|
className: "w-auto p-0",
|
|
234
236
|
align: "start",
|
|
235
237
|
"aria-label": D("datePicker.selectWeek"),
|
|
236
238
|
onOpenAutoFocus: (e) => {
|
|
237
|
-
|
|
239
|
+
v.current || e.preventDefault(), v.current = !1;
|
|
238
240
|
},
|
|
239
|
-
...
|
|
241
|
+
...ke,
|
|
240
242
|
children: /* @__PURE__ */ a(
|
|
241
|
-
|
|
243
|
+
Ge,
|
|
242
244
|
{
|
|
243
245
|
pickerType: "week",
|
|
244
246
|
weekMode: "single",
|
|
245
247
|
selectedWeeks: u,
|
|
246
|
-
footerFlashKey:
|
|
247
|
-
footerFlashTarget:
|
|
248
|
-
onWeekSelect:
|
|
249
|
-
month:
|
|
248
|
+
footerFlashKey: de,
|
|
249
|
+
footerFlashTarget: me,
|
|
250
|
+
onWeekSelect: Ce,
|
|
251
|
+
month: ye,
|
|
250
252
|
onMonthChange: h,
|
|
251
|
-
disabled:
|
|
253
|
+
disabled: _e(b, ee),
|
|
252
254
|
startMonth: te,
|
|
253
255
|
endMonth: ne,
|
|
254
256
|
showFooter: l,
|
|
255
|
-
...
|
|
257
|
+
...Ye({
|
|
256
258
|
calendarKind: I,
|
|
257
259
|
fiscalMode: x,
|
|
258
260
|
granularity: T,
|
|
259
|
-
fiscalMonthPattern:
|
|
260
|
-
fiscalYearStartMonth:
|
|
261
|
+
fiscalMonthPattern: E,
|
|
262
|
+
fiscalYearStartMonth: S,
|
|
261
263
|
fiscalConfig: re,
|
|
262
264
|
weekStartsOn: A,
|
|
263
265
|
showPresets: se,
|
|
264
|
-
|
|
265
|
-
|
|
266
|
+
showPeriodBoundaries: oe,
|
|
267
|
+
autoNavigateToAvailable: ie,
|
|
268
|
+
comparison: ce,
|
|
269
|
+
onComparisonChange: ae
|
|
266
270
|
}),
|
|
267
271
|
onApply: J,
|
|
268
272
|
onCancel: O,
|
|
@@ -275,7 +279,7 @@ const F = (n, c = "MM/dd/yyyy", t) => {
|
|
|
275
279
|
] });
|
|
276
280
|
}
|
|
277
281
|
);
|
|
278
|
-
|
|
282
|
+
Fe.displayName = "WeekPicker";
|
|
279
283
|
export {
|
|
280
|
-
|
|
284
|
+
Fe as WeekPicker
|
|
281
285
|
};
|