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