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,22 +1,22 @@
|
|
|
1
1
|
import { jsx as l, jsxs as F } from "react/jsx-runtime";
|
|
2
2
|
import * as o from "react";
|
|
3
|
-
import { Cross as
|
|
4
|
-
import { cn as
|
|
5
|
-
import { usePickerDismissActionsRef as
|
|
6
|
-
import { Input as
|
|
7
|
-
import { Calendar as
|
|
3
|
+
import { Cross as ke, CalendarMonth as De } from "impact-nova-icons";
|
|
4
|
+
import { cn as Me } from "../../../lib/utils.js";
|
|
5
|
+
import { usePickerDismissActionsRef as Pe, usePickerFooterDismissNudge as Ie, isDateInputInvalid as $, resolveSingleValueDismissFlash as Se, compareMonthSelection as Ce, handlePickerEscapeKeyDown as xe, handlePickerSurfacePointerDown as Re, maskDateInput as be, parseDateInput as we, resolveDateInputOnEnter as Fe, resolveDateInputOnBlur as Ee } from "./date-input-behavior.js";
|
|
6
|
+
import { Input as Ne } from "../input/input.js";
|
|
7
|
+
import { Calendar as Te } from "../../data-display/calendar/calendar.js";
|
|
8
8
|
import { Tooltip as v, TooltipTrigger as q, TooltipContent as G } from "../../feedback/tooltip/tooltip.js";
|
|
9
|
-
import { useImpactNovaI18n as
|
|
10
|
-
import { coerceSingleMonthApply as
|
|
11
|
-
import { buildDateBoundsMatcher as
|
|
12
|
-
import { fiscalCalendarPassThrough as
|
|
13
|
-
import { DatePickerShell as
|
|
14
|
-
import { looksLikeFiscalPeriodInput as E, monthSelectionFromFiscalInput as N, formatFiscalPeriod as
|
|
15
|
-
import { resolveFiscalConfig as
|
|
9
|
+
import { useImpactNovaI18n as Ae } from "../../../i18n/use-impact-nova-i18n.js";
|
|
10
|
+
import { coerceSingleMonthApply as Oe, coerceSingleMonth as Ve } from "./calendar-selection-adapters.js";
|
|
11
|
+
import { buildDateBoundsMatcher as Be } from "../../../lib/date-bounds-matcher.js";
|
|
12
|
+
import { fiscalCalendarPassThrough as je } from "./fiscal-pass-through.js";
|
|
13
|
+
import { DatePickerShell as Ke } from "./date-picker-shell.js";
|
|
14
|
+
import { looksLikeFiscalPeriodInput as E, monthSelectionFromFiscalInput as N, formatFiscalPeriod as Le } from "./fiscal-period-format.js";
|
|
15
|
+
import { resolveFiscalConfig as Ye } from "../../data-display/calendar/calendar-config.js";
|
|
16
16
|
const y = (t) => {
|
|
17
|
-
const s =
|
|
17
|
+
const s = Le(t);
|
|
18
18
|
return s || `${(t.month + 1).toString().padStart(2, "0")}/${t.year}`;
|
|
19
|
-
},
|
|
19
|
+
}, ze = o.forwardRef(
|
|
20
20
|
({
|
|
21
21
|
value: t,
|
|
22
22
|
onChange: s,
|
|
@@ -37,10 +37,11 @@ const y = (t) => {
|
|
|
37
37
|
fiscalConfig: B,
|
|
38
38
|
showPresets: ee,
|
|
39
39
|
showPeriodBoundaries: te,
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
40
|
+
autoNavigateToAvailable: ne,
|
|
41
|
+
...re
|
|
42
|
+
}, oe) => {
|
|
43
|
+
const { t: d } = Ae(), ie = T ?? d("datePicker.selectMonth"), C = o.useRef(null), j = o.useRef(null);
|
|
44
|
+
o.useImperativeHandle(oe, () => C.current);
|
|
44
45
|
const [r, K] = o.useState(!1), u = o.useCallback(() => {
|
|
45
46
|
K(!1);
|
|
46
47
|
}, []), h = (e) => {
|
|
@@ -51,23 +52,23 @@ const y = (t) => {
|
|
|
51
52
|
}
|
|
52
53
|
u();
|
|
53
54
|
}
|
|
54
|
-
}, L =
|
|
55
|
+
}, L = Pe(), { footerFlashKey: se, footerFlashTarget: ce, popoverHandlers: ae } = Ie(p, r, L, j), [M, i] = o.useState(t), [c, a] = o.useState(t ? y(t) : ""), [le, P] = o.useState(t ? new Date(t.year, t.month) : /* @__PURE__ */ new Date());
|
|
55
56
|
o.useEffect(() => {
|
|
56
57
|
r || (a(t ? y(t) : ""), i(t));
|
|
57
58
|
}, [r, t]), o.useEffect(() => {
|
|
58
59
|
r && (i(t), P(t ? new Date(t.year, t.month) : /* @__PURE__ */ new Date()), a(t ? y(t) : ""));
|
|
59
60
|
}, [r, t]);
|
|
60
|
-
const
|
|
61
|
-
const n =
|
|
61
|
+
const pe = (e) => {
|
|
62
|
+
const n = Ve(e);
|
|
62
63
|
i(n), n && a(y(n)), p || (s?.(n), u());
|
|
63
64
|
}, Y = (e) => {
|
|
64
|
-
const n =
|
|
65
|
+
const n = Oe(e, M);
|
|
65
66
|
s?.(n), u();
|
|
66
67
|
}, x = () => {
|
|
67
68
|
i(t), a(t ? y(t) : ""), u();
|
|
68
69
|
}, z = () => {
|
|
69
70
|
i(void 0), a(""), s?.(void 0), p || u();
|
|
70
|
-
},
|
|
71
|
+
}, fe = je({
|
|
71
72
|
calendarKind: S,
|
|
72
73
|
fiscalMode: A,
|
|
73
74
|
granularity: _,
|
|
@@ -75,14 +76,15 @@ const y = (t) => {
|
|
|
75
76
|
fiscalYearStartMonth: V,
|
|
76
77
|
fiscalConfig: B,
|
|
77
78
|
showPresets: ee,
|
|
78
|
-
showPeriodBoundaries: te
|
|
79
|
-
|
|
79
|
+
showPeriodBoundaries: te,
|
|
80
|
+
autoNavigateToAvailable: ne
|
|
81
|
+
}), R = Ye({
|
|
80
82
|
fiscalConfig: B,
|
|
81
83
|
calendarKind: S,
|
|
82
84
|
fiscalMode: A,
|
|
83
85
|
fiscalMonthPattern: O,
|
|
84
86
|
fiscalYearStartMonth: V
|
|
85
|
-
}), b = S === "fiscal", g = "MM/yyyy", k = t ? y(t) : "", D = o.useRef(!1),
|
|
87
|
+
}), b = S === "fiscal", g = "MM/yyyy", k = t ? y(t) : "", D = o.useRef(!1), ue = (e) => {
|
|
86
88
|
const n = e.target.value;
|
|
87
89
|
if (b && E(n)) {
|
|
88
90
|
a(n);
|
|
@@ -90,17 +92,17 @@ const y = (t) => {
|
|
|
90
92
|
m && (i(m), P(new Date(m.year, m.month, 1)), p || s?.(m));
|
|
91
93
|
return;
|
|
92
94
|
}
|
|
93
|
-
const w =
|
|
95
|
+
const w = be(n, g, c);
|
|
94
96
|
if (a(w), w === "") {
|
|
95
97
|
i(void 0), p || s?.(void 0);
|
|
96
98
|
return;
|
|
97
99
|
}
|
|
98
|
-
const { parsed: I, isValid:
|
|
99
|
-
if (
|
|
100
|
+
const { parsed: I, isValid: ge } = we(w, g);
|
|
101
|
+
if (ge && I) {
|
|
100
102
|
const m = { month: I.getMonth(), year: I.getFullYear() };
|
|
101
103
|
i(m), P(I), p || s?.(m);
|
|
102
104
|
}
|
|
103
|
-
},
|
|
105
|
+
}, me = () => {
|
|
104
106
|
if (r) return;
|
|
105
107
|
if (b && E(c)) {
|
|
106
108
|
const n = N(c, R);
|
|
@@ -111,7 +113,7 @@ const y = (t) => {
|
|
|
111
113
|
a(k), i(t);
|
|
112
114
|
return;
|
|
113
115
|
}
|
|
114
|
-
const e =
|
|
116
|
+
const e = Ee(c, g, k);
|
|
115
117
|
if (e.resetToCommitted) {
|
|
116
118
|
a(k), i(t);
|
|
117
119
|
return;
|
|
@@ -122,12 +124,12 @@ const y = (t) => {
|
|
|
122
124
|
return;
|
|
123
125
|
}
|
|
124
126
|
a(k), i(t);
|
|
125
|
-
},
|
|
127
|
+
}, de = () => {
|
|
126
128
|
if (r && p) {
|
|
127
129
|
Y();
|
|
128
130
|
return;
|
|
129
131
|
}
|
|
130
|
-
const e =
|
|
132
|
+
const e = Fe(c, g);
|
|
131
133
|
if (e.parsed) {
|
|
132
134
|
const n = {
|
|
133
135
|
month: e.parsed.getMonth(),
|
|
@@ -137,21 +139,21 @@ const y = (t) => {
|
|
|
137
139
|
return;
|
|
138
140
|
}
|
|
139
141
|
r || (D.current = !0, h(!0));
|
|
140
|
-
}, H = k !== c,
|
|
141
|
-
() =>
|
|
142
|
+
}, H = k !== c, he = b ? E(c) ? N(c, R) == null && c !== "" : $(c, g) : $(c, g), ye = o.useCallback(
|
|
143
|
+
() => Se(
|
|
142
144
|
M,
|
|
143
145
|
t,
|
|
144
|
-
(e, n) =>
|
|
146
|
+
(e, n) => Ce(e, n) === 0
|
|
145
147
|
),
|
|
146
148
|
[M, t]
|
|
147
149
|
);
|
|
148
150
|
return o.useLayoutEffect(() => {
|
|
149
151
|
L.current = {
|
|
150
152
|
onDismiss: x,
|
|
151
|
-
resolveFlash:
|
|
153
|
+
resolveFlash: ye
|
|
152
154
|
};
|
|
153
155
|
}), /* @__PURE__ */ l(
|
|
154
|
-
|
|
156
|
+
Ke,
|
|
155
157
|
{
|
|
156
158
|
open: r,
|
|
157
159
|
disabled: f,
|
|
@@ -160,7 +162,7 @@ const y = (t) => {
|
|
|
160
162
|
onOpenAutoFocus: (e) => {
|
|
161
163
|
D.current || e.preventDefault(), D.current = !1;
|
|
162
164
|
},
|
|
163
|
-
popoverHandlers:
|
|
165
|
+
popoverHandlers: ae,
|
|
164
166
|
trigger: /* @__PURE__ */ l(
|
|
165
167
|
"div",
|
|
166
168
|
{
|
|
@@ -168,31 +170,31 @@ const y = (t) => {
|
|
|
168
170
|
"data-component": "month-picker",
|
|
169
171
|
"data-state": r ? "open" : "closed",
|
|
170
172
|
"data-pending": H || void 0,
|
|
171
|
-
onPointerDown: (e) =>
|
|
173
|
+
onPointerDown: (e) => Re({
|
|
172
174
|
disabled: f,
|
|
173
175
|
event: e,
|
|
174
176
|
onOpen: () => h(!0),
|
|
175
177
|
focusField: () => C.current?.focus()
|
|
176
178
|
}),
|
|
177
179
|
children: /* @__PURE__ */ l(
|
|
178
|
-
|
|
180
|
+
Ne,
|
|
179
181
|
{
|
|
180
182
|
ref: C,
|
|
181
183
|
value: c,
|
|
182
|
-
onChange:
|
|
184
|
+
onChange: ue,
|
|
183
185
|
onBlur: (e) => {
|
|
184
|
-
|
|
186
|
+
me(), Z?.(e);
|
|
185
187
|
},
|
|
186
188
|
onClick: () => !f && h(!0),
|
|
187
189
|
onKeyDown: (e) => {
|
|
188
|
-
e.key === "Enter" && !f && (e.preventDefault(),
|
|
190
|
+
e.key === "Enter" && !f && (e.preventDefault(), de()), e.key === "ArrowDown" && !r && !f && (e.preventDefault(), D.current = !0, h(!0)), e.key === "Escape" && r && xe(e, { open: r, onCancel: x });
|
|
189
191
|
},
|
|
190
|
-
placeholder: r ? d("datePicker.monthYearFormat") :
|
|
192
|
+
placeholder: r ? d("datePicker.monthYearFormat") : ie,
|
|
191
193
|
disabled: f,
|
|
192
194
|
"data-form-control": "input",
|
|
193
|
-
className:
|
|
195
|
+
className: Me(
|
|
194
196
|
"cursor-pointer",
|
|
195
|
-
|
|
197
|
+
he ? "text-destructive" : H ? "text-content-placeholder" : "",
|
|
196
198
|
X
|
|
197
199
|
),
|
|
198
200
|
suffix: /* @__PURE__ */ F("div", { className: "flex items-center gap-1", children: [
|
|
@@ -207,7 +209,7 @@ const y = (t) => {
|
|
|
207
209
|
e.stopPropagation(), z();
|
|
208
210
|
},
|
|
209
211
|
className: "inline-flex size-4 items-center justify-center bg-transparent border-none p-0 cursor-pointer",
|
|
210
|
-
children: /* @__PURE__ */ l(
|
|
212
|
+
children: /* @__PURE__ */ l(ke, { className: "size-3 hover:text-content" })
|
|
211
213
|
}
|
|
212
214
|
) }),
|
|
213
215
|
/* @__PURE__ */ l(G, { variant: "tertiary", side: "top", children: d("calendar.clear") })
|
|
@@ -227,43 +229,43 @@ const y = (t) => {
|
|
|
227
229
|
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), e.stopPropagation(), f || (D.current = !0, r ? u() : h(!0)));
|
|
228
230
|
},
|
|
229
231
|
className: "inline-flex items-center justify-center bg-transparent border-none p-0 cursor-pointer",
|
|
230
|
-
children: /* @__PURE__ */ l(
|
|
232
|
+
children: /* @__PURE__ */ l(De, { className: "h-4 w-4 text-secondary-foreground" })
|
|
231
233
|
}
|
|
232
234
|
) }),
|
|
233
235
|
/* @__PURE__ */ l(G, { variant: "tertiary", side: "top", children: d("datePicker.selectMonth") })
|
|
234
236
|
] })
|
|
235
237
|
] }),
|
|
236
|
-
...
|
|
238
|
+
...re
|
|
237
239
|
}
|
|
238
240
|
)
|
|
239
241
|
}
|
|
240
242
|
),
|
|
241
243
|
children: /* @__PURE__ */ l(
|
|
242
|
-
|
|
244
|
+
Te,
|
|
243
245
|
{
|
|
244
246
|
pickerType: "month",
|
|
245
247
|
monthMode: "single",
|
|
246
248
|
selectedMonths: M,
|
|
247
|
-
footerFlashKey:
|
|
248
|
-
footerFlashTarget:
|
|
249
|
-
onMonthSelect:
|
|
250
|
-
month:
|
|
249
|
+
footerFlashKey: se,
|
|
250
|
+
footerFlashTarget: ce,
|
|
251
|
+
onMonthSelect: pe,
|
|
252
|
+
month: le,
|
|
251
253
|
onMonthChange: P,
|
|
252
|
-
disabled:
|
|
254
|
+
disabled: Be(J, Q),
|
|
253
255
|
startMonth: U,
|
|
254
256
|
endMonth: W,
|
|
255
257
|
showFooter: p,
|
|
256
258
|
onApply: Y,
|
|
257
259
|
onCancel: x,
|
|
258
260
|
onClear: z,
|
|
259
|
-
...
|
|
261
|
+
...fe
|
|
260
262
|
}
|
|
261
263
|
)
|
|
262
264
|
}
|
|
263
265
|
);
|
|
264
266
|
}
|
|
265
267
|
);
|
|
266
|
-
|
|
268
|
+
ze.displayName = "MonthPicker";
|
|
267
269
|
export {
|
|
268
|
-
|
|
270
|
+
ze as MonthPicker
|
|
269
271
|
};
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import { jsx as u, jsxs as D } from "react/jsx-runtime";
|
|
2
2
|
import * as s from "react";
|
|
3
|
-
import { Cross as
|
|
3
|
+
import { Cross as Je, CalendarMonth as Qe } from "impact-nova-icons";
|
|
4
4
|
import { cn as z } from "../../../lib/utils.js";
|
|
5
|
-
import { usePickerDismissActionsRef as
|
|
6
|
-
import { useFieldChrome as
|
|
7
|
-
import { Popover as
|
|
8
|
-
import { Calendar as
|
|
5
|
+
import { usePickerDismissActionsRef as Ue, usePickerFooterDismissNudge as We, createRangePickerOpenChangeHandler as Xe, parseDateInput as H, normalizeOrderedRange as ee, compareMonthSelection as V, flashRangeReorder as te, isDateInputInvalid as re, resolveRangeFieldBlur as A, resolveRangePickerDismissFlash as Ze, handlePickerEscapeKeyDown as oe, handlePickerSurfacePointerDown as _e, deferRangeInputBlur as Fe, maskDateInput as ne, resolveDateInputOnBlur as O } from "./date-input-behavior.js";
|
|
6
|
+
import { useFieldChrome as et } from "../../../lib/primitives/use-field-chrome.js";
|
|
7
|
+
import { Popover as tt, PopoverAnchor as rt, PopoverContent as ot } from "../../feedback/popover/popover.js";
|
|
8
|
+
import { Calendar as nt } from "../../data-display/calendar/calendar.js";
|
|
9
9
|
import { Tooltip as se, TooltipTrigger as ie, TooltipContent as ae } from "../../feedback/tooltip/tooltip.js";
|
|
10
|
-
import { useImpactNovaI18n as
|
|
11
|
-
import { coerceMonthRangeApply as
|
|
12
|
-
import { buildDateBoundsMatcher as
|
|
13
|
-
import { fiscalCalendarPassThrough as
|
|
14
|
-
import { formatFiscalPeriod as
|
|
10
|
+
import { useImpactNovaI18n as st } from "../../../i18n/use-impact-nova-i18n.js";
|
|
11
|
+
import { coerceMonthRangeApply as it, isMonthRangeSelection as at } from "./calendar-selection-adapters.js";
|
|
12
|
+
import { buildDateBoundsMatcher as ct } from "../../../lib/date-bounds-matcher.js";
|
|
13
|
+
import { fiscalCalendarPassThrough as ft } from "./fiscal-pass-through.js";
|
|
14
|
+
import { formatFiscalPeriod as dt } from "./fiscal-period-format.js";
|
|
15
15
|
const h = (t, n = "MM/YYYY") => {
|
|
16
|
-
const E =
|
|
16
|
+
const E = dt(t);
|
|
17
17
|
if (E) return E;
|
|
18
18
|
const k = (t.month + 1).toString().padStart(2, "0");
|
|
19
19
|
return n === "YYYY/MM" ? `${t.year}/${k}` : `${k}/${t.year}`;
|
|
20
20
|
};
|
|
21
|
-
function
|
|
21
|
+
function lt(t, n) {
|
|
22
22
|
if (!t && !n) return !0;
|
|
23
23
|
if (!t || !n) return !1;
|
|
24
24
|
const E = t.from === void 0 && n.from === void 0 || t.from !== void 0 && n.from !== void 0 && V(t.from, n.from) === 0, k = t.to === void 0 && n.to === void 0 || t.to !== void 0 && n.to !== void 0 && V(t.to, n.to) === 0;
|
|
@@ -27,7 +27,7 @@ function dt(t, n) {
|
|
|
27
27
|
function b(t) {
|
|
28
28
|
return { month: t.getMonth(), year: t.getFullYear() };
|
|
29
29
|
}
|
|
30
|
-
const
|
|
30
|
+
const mt = s.forwardRef(
|
|
31
31
|
({
|
|
32
32
|
value: t,
|
|
33
33
|
onChange: n,
|
|
@@ -46,8 +46,8 @@ const lt = s.forwardRef(
|
|
|
46
46
|
helperText: he,
|
|
47
47
|
helperTextPosition: ge = "absolute",
|
|
48
48
|
required: Me,
|
|
49
|
-
prefix:
|
|
50
|
-
prefixClick:
|
|
49
|
+
prefix: pt,
|
|
50
|
+
prefixClick: ut,
|
|
51
51
|
displayFormat: i = "MM/YYYY",
|
|
52
52
|
calendarKind: Re,
|
|
53
53
|
fiscalMode: ye,
|
|
@@ -57,11 +57,12 @@ const lt = s.forwardRef(
|
|
|
57
57
|
fiscalConfig: Ce,
|
|
58
58
|
showPresets: Ye,
|
|
59
59
|
showPeriodBoundaries: Pe,
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
60
|
+
autoNavigateToAvailable: be,
|
|
61
|
+
comparison: we,
|
|
62
|
+
onComparisonChange: Ie,
|
|
63
|
+
...De
|
|
64
|
+
}, Ee) => {
|
|
65
|
+
const L = me ?? pe, Se = et({
|
|
65
66
|
label: ue,
|
|
66
67
|
helperText: he,
|
|
67
68
|
helperTextPosition: ge,
|
|
@@ -69,17 +70,17 @@ const lt = s.forwardRef(
|
|
|
69
70
|
required: Me,
|
|
70
71
|
disabled: c ?? void 0,
|
|
71
72
|
rootClassName: "w-full min-w-[240px]"
|
|
72
|
-
}), { t: C } =
|
|
73
|
+
}), { t: C } = st(), K = s.useRef(null), G = s.useRef(null), J = s.useRef(null), S = s.useRef(null), j = s.useRef(null), l = s.useMemo(
|
|
73
74
|
() => i === "YYYY/MM" ? "yyyy/MM" : "MM/yyyy",
|
|
74
75
|
[i]
|
|
75
76
|
);
|
|
76
|
-
s.useImperativeHandle(
|
|
77
|
-
const [f, M] = s.useState(!1), Q =
|
|
77
|
+
s.useImperativeHandle(Ee, () => K.current);
|
|
78
|
+
const [f, M] = s.useState(!1), Q = Ue(), { footerFlashKey: Te, footerFlashTarget: Be, popoverHandlers: Ne } = We(g, f, Q, J), I = s.useRef(!1), [d, R] = s.useState(t), [p, v] = s.useState(t?.from ? h(t.from, i) : ""), [y, x] = s.useState(t?.to ? h(t.to, i) : ""), [Ae, w] = s.useState(() => t?.from ? new Date(t.from.year, t.from.month, 1) : k || /* @__PURE__ */ new Date());
|
|
78
79
|
s.useEffect(() => {
|
|
79
80
|
v(t?.from ? h(t.from, i) : ""), x(t?.to ? h(t.to, i) : ""), R(t);
|
|
80
81
|
}, [t, i]);
|
|
81
|
-
const
|
|
82
|
-
(e) =>
|
|
82
|
+
const Oe = s.useCallback(
|
|
83
|
+
(e) => Xe({
|
|
83
84
|
disabled: c ?? void 0,
|
|
84
85
|
showFooter: g,
|
|
85
86
|
containerRef: S,
|
|
@@ -95,17 +96,17 @@ const lt = s.forwardRef(
|
|
|
95
96
|
}
|
|
96
97
|
U.current = f;
|
|
97
98
|
}, [f, p, l, d?.from, t?.from, k]);
|
|
98
|
-
const
|
|
99
|
-
const r =
|
|
99
|
+
const Ve = (e) => {
|
|
100
|
+
const r = at(e) ? e : void 0;
|
|
100
101
|
R(r), r?.from && v(h(r.from, i)), r?.to && x(h(r.to, i)), !g && r?.from && r?.to && (r.from.month !== r.to.month || r.from.year !== r.to.year) && (n?.(r), M(!1));
|
|
101
102
|
}, W = (e) => {
|
|
102
|
-
const r =
|
|
103
|
+
const r = it(e, d), o = ee(r?.from, r?.to, V);
|
|
103
104
|
o.swapped && (o.from && v(h(o.from, i)), o.to && x(h(o.to, i)), R({ from: o.from, to: o.to }), te(S.current)), n?.({ from: o.from, to: o.to }), M(!1);
|
|
104
105
|
}, B = () => {
|
|
105
106
|
R(t), v(t?.from ? h(t.from, i) : ""), x(t?.to ? h(t.to, i) : ""), M(!1);
|
|
106
107
|
}, $ = () => {
|
|
107
108
|
R(void 0), v(""), x(""), n?.(void 0), g || M(!1);
|
|
108
|
-
},
|
|
109
|
+
}, Ke = (e) => {
|
|
109
110
|
const r = ne(e.target.value, l, p);
|
|
110
111
|
if (v(r), r === "") {
|
|
111
112
|
const m = { from: void 0, to: d?.to };
|
|
@@ -117,7 +118,7 @@ const lt = s.forwardRef(
|
|
|
117
118
|
const T = { from: b(o), to: d?.to };
|
|
118
119
|
R(T), w(o), g || n?.(T);
|
|
119
120
|
}
|
|
120
|
-
},
|
|
121
|
+
}, je = (e) => {
|
|
121
122
|
const r = ne(e.target.value, l, y);
|
|
122
123
|
if (x(r), r === "") {
|
|
123
124
|
const m = { from: d?.from, to: void 0 };
|
|
@@ -132,7 +133,7 @@ const lt = s.forwardRef(
|
|
|
132
133
|
}, N = s.useCallback((e, r) => {
|
|
133
134
|
const o = ee(e, r, V);
|
|
134
135
|
return o.swapped && (o.from && v(h(o.from, i)), o.to && x(h(o.to, i)), te(S.current)), { from: o.from, to: o.to };
|
|
135
|
-
}, [i]),
|
|
136
|
+
}, [i]), $e = () => {
|
|
136
137
|
const e = O(p, l, Y), r = O(y, l, P);
|
|
137
138
|
e.resetToCommitted ? v(Y) : e.parsed && v(e.display), r.resetToCommitted ? x(P) : r.parsed && x(r.display);
|
|
138
139
|
let o = e.parsed ? b(e.parsed) : d?.from, a = r.parsed ? b(r.parsed) : d?.to;
|
|
@@ -141,7 +142,7 @@ const lt = s.forwardRef(
|
|
|
141
142
|
R(m), n?.(m);
|
|
142
143
|
} else !p && !y && (R(void 0), n?.(void 0));
|
|
143
144
|
}, X = () => {
|
|
144
|
-
|
|
145
|
+
Fe(
|
|
145
146
|
S,
|
|
146
147
|
j,
|
|
147
148
|
() => {
|
|
@@ -160,19 +161,19 @@ const lt = s.forwardRef(
|
|
|
160
161
|
}
|
|
161
162
|
if (!f) {
|
|
162
163
|
if (g) {
|
|
163
|
-
|
|
164
|
+
$e();
|
|
164
165
|
return;
|
|
165
166
|
}
|
|
166
167
|
const e = O(p, l, Y), r = O(y, l, P);
|
|
167
168
|
if (e.parsed || r.parsed) return;
|
|
168
169
|
I.current = !0, M(!0);
|
|
169
170
|
}
|
|
170
|
-
}, Y = t?.from ? h(t.from, i) : "", P = t?.to ? h(t.to, i) : "",
|
|
171
|
+
}, Y = t?.from ? h(t.from, i) : "", P = t?.to ? h(t.to, i) : "", ze = p !== Y, He = y !== P, qe = re(p, l), Le = re(y, l), _ = C("datePicker.startMonth"), F = C("datePicker.endMonth"), Ge = s.useCallback(() => {
|
|
171
172
|
const e = A(p, l, Y), r = A(y, l, P);
|
|
172
173
|
let o = e.parsed ? b(e.parsed) : e.resetToCommitted ? t?.from : d?.from, a = r.parsed ? b(r.parsed) : r.resetToCommitted ? t?.to : d?.to;
|
|
173
174
|
o && a && ({ from: o, to: a } = N(o, a));
|
|
174
175
|
const m = o || a ? { from: o, to: a } : void 0;
|
|
175
|
-
return
|
|
176
|
+
return Ze({
|
|
176
177
|
startInput: p,
|
|
177
178
|
endInput: y,
|
|
178
179
|
committedStart: Y,
|
|
@@ -180,7 +181,7 @@ const lt = s.forwardRef(
|
|
|
180
181
|
committedRange: t,
|
|
181
182
|
pendingRange: d,
|
|
182
183
|
computeEffectiveRange: () => m,
|
|
183
|
-
rangesEqual:
|
|
184
|
+
rangesEqual: lt
|
|
184
185
|
});
|
|
185
186
|
}, [
|
|
186
187
|
p,
|
|
@@ -195,7 +196,7 @@ const lt = s.forwardRef(
|
|
|
195
196
|
return s.useLayoutEffect(() => {
|
|
196
197
|
Q.current = {
|
|
197
198
|
onDismiss: B,
|
|
198
|
-
resolveFlash:
|
|
199
|
+
resolveFlash: Ge
|
|
199
200
|
};
|
|
200
201
|
}), /* @__PURE__ */ u(
|
|
201
202
|
"div",
|
|
@@ -203,14 +204,14 @@ const lt = s.forwardRef(
|
|
|
203
204
|
ref: J,
|
|
204
205
|
"data-component": "month-range-picker",
|
|
205
206
|
"data-disabled": c || void 0,
|
|
206
|
-
children:
|
|
207
|
-
/* @__PURE__ */ D(
|
|
208
|
-
/* @__PURE__ */ u(
|
|
207
|
+
children: Se.wrapControl(
|
|
208
|
+
/* @__PURE__ */ D(tt, { open: c ? !1 : f, onOpenChange: Oe, children: [
|
|
209
|
+
/* @__PURE__ */ u(rt, { asChild: !0, children: /* @__PURE__ */ D(
|
|
209
210
|
"div",
|
|
210
211
|
{
|
|
211
212
|
ref: S,
|
|
212
213
|
"data-state": f ? "open" : "closed",
|
|
213
|
-
onPointerDown: (e) =>
|
|
214
|
+
onPointerDown: (e) => _e({
|
|
214
215
|
disabled: c,
|
|
215
216
|
event: e,
|
|
216
217
|
onOpen: () => M(!0),
|
|
@@ -234,7 +235,7 @@ const lt = s.forwardRef(
|
|
|
234
235
|
ref: K,
|
|
235
236
|
type: "text",
|
|
236
237
|
value: p,
|
|
237
|
-
onChange:
|
|
238
|
+
onChange: Ke,
|
|
238
239
|
onBlur: X,
|
|
239
240
|
onClick: () => !c && M(!0),
|
|
240
241
|
onKeyDown: (e) => {
|
|
@@ -246,9 +247,9 @@ const lt = s.forwardRef(
|
|
|
246
247
|
"data-field": "start",
|
|
247
248
|
className: z(
|
|
248
249
|
"flex-1 min-w-0 bg-transparent p-0 text-sm font-medium outline-none placeholder:font-medium placeholder:text-content-empty disabled:cursor-not-allowed disabled:opacity-50",
|
|
249
|
-
|
|
250
|
+
qe ? "text-destructive" : ze ? "text-content-placeholder" : ""
|
|
250
251
|
),
|
|
251
|
-
...
|
|
252
|
+
...De
|
|
252
253
|
}
|
|
253
254
|
),
|
|
254
255
|
/* @__PURE__ */ u(
|
|
@@ -257,7 +258,7 @@ const lt = s.forwardRef(
|
|
|
257
258
|
ref: G,
|
|
258
259
|
type: "text",
|
|
259
260
|
value: y,
|
|
260
|
-
onChange:
|
|
261
|
+
onChange: je,
|
|
261
262
|
onBlur: X,
|
|
262
263
|
onClick: () => !c && M(!0),
|
|
263
264
|
onKeyDown: (e) => {
|
|
@@ -269,7 +270,7 @@ const lt = s.forwardRef(
|
|
|
269
270
|
"data-field": "end",
|
|
270
271
|
className: z(
|
|
271
272
|
"flex-1 min-w-0 bg-transparent p-0 text-sm font-medium outline-none placeholder:font-medium placeholder:text-content-empty disabled:cursor-not-allowed disabled:opacity-50",
|
|
272
|
-
|
|
273
|
+
Le ? "text-destructive" : He ? "text-content-placeholder" : ""
|
|
273
274
|
)
|
|
274
275
|
}
|
|
275
276
|
)
|
|
@@ -289,7 +290,7 @@ const lt = s.forwardRef(
|
|
|
289
290
|
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), e.stopPropagation(), $());
|
|
290
291
|
},
|
|
291
292
|
className: "inline-flex size-4 items-center justify-center bg-transparent border-none p-0 cursor-pointer",
|
|
292
|
-
children: /* @__PURE__ */ u(
|
|
293
|
+
children: /* @__PURE__ */ u(Je, { className: "size-3 hover:text-content text-content-icon" })
|
|
293
294
|
}
|
|
294
295
|
) }),
|
|
295
296
|
/* @__PURE__ */ u(ae, { variant: "tertiary", side: "top", children: C("calendar.clear") })
|
|
@@ -299,7 +300,7 @@ const lt = s.forwardRef(
|
|
|
299
300
|
e.stopPropagation(), c || M(!f);
|
|
300
301
|
}, onKeyDown: (e) => {
|
|
301
302
|
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), e.stopPropagation(), c || (I.current = !0, M(!f)));
|
|
302
|
-
}, className: "inline-flex items-center justify-center bg-transparent border-none p-0 cursor-pointer", children: /* @__PURE__ */ u(
|
|
303
|
+
}, className: "inline-flex items-center justify-center bg-transparent border-none p-0 cursor-pointer", children: /* @__PURE__ */ u(Qe, { className: "h-4 w-4 text-secondary-foreground" }) }) }),
|
|
303
304
|
/* @__PURE__ */ u(ae, { variant: "tertiary", side: "top", children: C("datePicker.selectMonthRange") })
|
|
304
305
|
] })
|
|
305
306
|
] })
|
|
@@ -307,7 +308,7 @@ const lt = s.forwardRef(
|
|
|
307
308
|
}
|
|
308
309
|
) }),
|
|
309
310
|
/* @__PURE__ */ u(
|
|
310
|
-
|
|
311
|
+
ot,
|
|
311
312
|
{
|
|
312
313
|
ref: j,
|
|
313
314
|
className: "w-auto p-0",
|
|
@@ -316,26 +317,26 @@ const lt = s.forwardRef(
|
|
|
316
317
|
onOpenAutoFocus: (e) => {
|
|
317
318
|
I.current || e.preventDefault(), I.current = !1;
|
|
318
319
|
},
|
|
319
|
-
...
|
|
320
|
+
...Ne,
|
|
320
321
|
children: /* @__PURE__ */ u(
|
|
321
|
-
|
|
322
|
+
nt,
|
|
322
323
|
{
|
|
323
324
|
pickerType: "month",
|
|
324
325
|
monthMode: "range",
|
|
325
326
|
selectedMonths: d,
|
|
326
|
-
footerFlashKey:
|
|
327
|
-
footerFlashTarget:
|
|
328
|
-
onMonthSelect:
|
|
329
|
-
month:
|
|
327
|
+
footerFlashKey: Te,
|
|
328
|
+
footerFlashTarget: Be,
|
|
329
|
+
onMonthSelect: Ve,
|
|
330
|
+
month: Ae,
|
|
330
331
|
onMonthChange: w,
|
|
331
|
-
disabled:
|
|
332
|
+
disabled: ct(k, ce),
|
|
332
333
|
startMonth: fe,
|
|
333
334
|
endMonth: de,
|
|
334
335
|
showFooter: g,
|
|
335
336
|
onApply: W,
|
|
336
337
|
onCancel: B,
|
|
337
338
|
onClear: $,
|
|
338
|
-
...
|
|
339
|
+
...ft({
|
|
339
340
|
calendarKind: Re,
|
|
340
341
|
fiscalMode: ye,
|
|
341
342
|
granularity: ke,
|
|
@@ -344,8 +345,9 @@ const lt = s.forwardRef(
|
|
|
344
345
|
fiscalConfig: Ce,
|
|
345
346
|
showPresets: Ye,
|
|
346
347
|
showPeriodBoundaries: Pe,
|
|
347
|
-
|
|
348
|
-
|
|
348
|
+
autoNavigateToAvailable: be,
|
|
349
|
+
comparison: we,
|
|
350
|
+
onComparisonChange: Ie
|
|
349
351
|
})
|
|
350
352
|
}
|
|
351
353
|
)
|
|
@@ -357,7 +359,7 @@ const lt = s.forwardRef(
|
|
|
357
359
|
);
|
|
358
360
|
}
|
|
359
361
|
);
|
|
360
|
-
|
|
362
|
+
mt.displayName = "MonthRangePicker";
|
|
361
363
|
export {
|
|
362
|
-
|
|
364
|
+
mt as MonthRangePicker
|
|
363
365
|
};
|