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