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