impact-nova 2.5.10 → 2.5.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/data/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-display/calendar/calendar-apply-validation.d.ts +2 -0
- package/dist/components/data-display/calendar/calendar-apply-validation.js +64 -67
- package/dist/components/data-display/calendar/calendar-available-view.d.ts +27 -0
- package/dist/components/data-display/calendar/calendar-available-view.js +85 -0
- package/dist/components/data-display/calendar/calendar-day-picker-components.d.ts +4 -2
- package/dist/components/data-display/calendar/calendar-day-picker-components.js +163 -152
- package/dist/components/data-display/calendar/calendar-day-picker-view.js +77 -76
- package/dist/components/data-display/calendar/calendar-fiscal-period-nav.d.ts +6 -0
- package/dist/components/data-display/calendar/calendar-fiscal-period-nav.js +34 -18
- package/dist/components/data-display/calendar/calendar-month-utils.d.ts +5 -0
- package/dist/components/data-display/calendar/calendar-month-utils.js +85 -64
- package/dist/components/data-display/calendar/calendar-selection-appearance.d.ts +1 -0
- package/dist/components/data-display/calendar/calendar-selection-appearance.js +31 -30
- package/dist/components/data-display/calendar/calendar-week-number-cell.d.ts +2 -1
- package/dist/components/data-display/calendar/calendar-week-number-cell.js +55 -41
- package/dist/components/data-display/calendar/calendar-year-panes.d.ts +2 -0
- package/dist/components/data-display/calendar/calendar-year-panes.js +3 -1
- package/dist/components/data-display/calendar/calendar.js +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 +403 -325
- 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/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 +46 -44
- package/dist/components/forms/date-picker/multi-week-picker.js +53 -51
- package/dist/components/forms/date-picker/multi-year-picker.js +48 -46
- package/dist/components/forms/date-picker/quarter-picker.js +46 -44
- package/dist/components/forms/date-picker/quarter-range-picker.js +45 -43
- package/dist/components/forms/date-picker/week-picker.js +68 -66
- package/dist/components/forms/date-picker/week-range-picker.js +82 -80
- package/dist/components/forms/date-picker/year-picker.js +47 -45
- package/dist/components/forms/date-picker/year-range-picker.js +47 -45
- 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 +18 -17
- package/dist/form-react/Fields/WeekRangePicker.js +22 -21
- package/dist/form-react/types/fields.types.d.ts +12 -0
- package/dist/impact-nova.css +1 -1
- package/dist/llms/rules/installation.js +1 -1
- package/dist/llms/rules/requirements.js +1 -1
- package/package.json +1 -1
|
@@ -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
|
};
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { jsxs as f, jsx as r } from "react/jsx-runtime";
|
|
2
2
|
import * as a from "react";
|
|
3
|
-
import { Cross as
|
|
4
|
-
import { format as
|
|
5
|
-
import { cn as
|
|
6
|
-
import { Input as
|
|
7
|
-
import { Popover as
|
|
8
|
-
import { Calendar as
|
|
3
|
+
import { Cross as _, CalendarMonth as ee } from "impact-nova-icons";
|
|
4
|
+
import { format as te } from "date-fns";
|
|
5
|
+
import { cn as re } from "../../../lib/utils.js";
|
|
6
|
+
import { Input as oe } from "../input/input.js";
|
|
7
|
+
import { Popover as ne, PopoverAnchor as ae, PopoverContent as se } from "../../feedback/popover/popover.js";
|
|
8
|
+
import { Calendar as ie } from "../../data-display/calendar/calendar.js";
|
|
9
9
|
import { Tooltip as P, TooltipTrigger as C, TooltipContent as k } from "../../feedback/tooltip/tooltip.js";
|
|
10
|
-
import { useImpactNovaI18n as
|
|
11
|
-
import { getDateFnsLocale as
|
|
12
|
-
import { coerceDateArrayApply as
|
|
13
|
-
import { usePickerDismissActionsRef as
|
|
14
|
-
import { buildDateBoundsMatcher as
|
|
15
|
-
import { fiscalCalendarPassThrough as
|
|
16
|
-
const
|
|
10
|
+
import { useImpactNovaI18n as ce } from "../../../i18n/use-impact-nova-i18n.js";
|
|
11
|
+
import { getDateFnsLocale as le } from "../../../i18n/getDateFnsLocale.js";
|
|
12
|
+
import { coerceDateArrayApply as pe, coerceDateArray as de } from "./calendar-selection-adapters.js";
|
|
13
|
+
import { usePickerDismissActionsRef as fe, usePickerFooterDismissNudge as me, handlePickerSurfacePointerDown as ue } from "./date-input-behavior.js";
|
|
14
|
+
import { buildDateBoundsMatcher as he } from "../../../lib/date-bounds-matcher.js";
|
|
15
|
+
import { fiscalCalendarPassThrough as ye } from "./fiscal-pass-through.js";
|
|
16
|
+
const ge = a.forwardRef(
|
|
17
17
|
({
|
|
18
18
|
value: t,
|
|
19
19
|
onChange: m,
|
|
@@ -34,60 +34,61 @@ const ye = a.forwardRef(
|
|
|
34
34
|
fiscalConfig: O,
|
|
35
35
|
showPresets: w,
|
|
36
36
|
showPeriodBoundaries: E,
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
37
|
+
autoNavigateToAvailable: v,
|
|
38
|
+
comparison: z,
|
|
39
|
+
onComparisonChange: K,
|
|
40
|
+
...q
|
|
41
|
+
}, B) => {
|
|
42
|
+
const { locale: h, t: s } = ce(), H = a.useMemo(() => le(h), [h]), V = M ?? s("datePicker.selectMultipleDates"), [i, n] = a.useState(!1), u = a.useRef(null), y = fe(), { footerFlashKey: $, footerFlashTarget: G, popoverHandlers: J } = me(l, i, y, u), [p, d] = a.useState(t);
|
|
42
43
|
a.useEffect(() => {
|
|
43
44
|
d(t);
|
|
44
45
|
}, [i, t]);
|
|
45
|
-
const
|
|
46
|
-
const c =
|
|
46
|
+
const Q = (e) => {
|
|
47
|
+
const c = de(e);
|
|
47
48
|
d(c), l || m?.(c);
|
|
48
|
-
},
|
|
49
|
-
const c =
|
|
49
|
+
}, U = (e) => {
|
|
50
|
+
const c = pe(e, p);
|
|
50
51
|
m?.(c), n(!1);
|
|
51
52
|
}, g = () => {
|
|
52
53
|
d(t), n(!1);
|
|
53
54
|
}, D = () => {
|
|
54
55
|
d(void 0), m?.(void 0), l || n(!1);
|
|
55
|
-
},
|
|
56
|
+
}, W = t && t.length > 0 ? t.length === 1 ? te(t[0], x, { locale: H }) : `${t.length} dates selected` : "", X = a.useCallback(() => {
|
|
56
57
|
const e = p?.length ?? 0, c = t?.length ?? 0;
|
|
57
58
|
return e === c && (p ?? []).every(
|
|
58
|
-
(
|
|
59
|
+
(Y, Z) => Y.getTime() === t?.[Z]?.getTime()
|
|
59
60
|
) ? "dismiss" : e > 0 ? "apply" : "cancel";
|
|
60
61
|
}, [p, t]);
|
|
61
62
|
return a.useLayoutEffect(() => {
|
|
62
63
|
y.current = {
|
|
63
64
|
onDismiss: g,
|
|
64
|
-
resolveFlash:
|
|
65
|
+
resolveFlash: X
|
|
65
66
|
};
|
|
66
|
-
}), /* @__PURE__ */ f(
|
|
67
|
+
}), /* @__PURE__ */ f(ne, { open: o ? !1 : i, onOpenChange: (e) => {
|
|
67
68
|
o || !e && l || n(e);
|
|
68
69
|
}, children: [
|
|
69
|
-
/* @__PURE__ */ r(
|
|
70
|
+
/* @__PURE__ */ r(ae, { asChild: !0, children: /* @__PURE__ */ r(
|
|
70
71
|
"div",
|
|
71
72
|
{
|
|
72
73
|
ref: u,
|
|
73
|
-
onPointerDown: (e) =>
|
|
74
|
+
onPointerDown: (e) => ue({
|
|
74
75
|
disabled: o,
|
|
75
76
|
event: e,
|
|
76
77
|
onOpen: () => n(!0),
|
|
77
78
|
focusField: () => u.current?.querySelector("input")?.focus()
|
|
78
79
|
}),
|
|
79
80
|
children: /* @__PURE__ */ r(
|
|
80
|
-
|
|
81
|
+
oe,
|
|
81
82
|
{
|
|
82
|
-
ref:
|
|
83
|
-
value:
|
|
84
|
-
placeholder:
|
|
83
|
+
ref: B,
|
|
84
|
+
value: W,
|
|
85
|
+
placeholder: V,
|
|
85
86
|
readOnly: !0,
|
|
86
87
|
disabled: o,
|
|
87
88
|
onClick: () => {
|
|
88
89
|
!o && !i && n(!0);
|
|
89
90
|
},
|
|
90
|
-
className:
|
|
91
|
+
className: re("cursor-pointer", R),
|
|
91
92
|
suffix: /* @__PURE__ */ f("div", { className: "flex items-center gap-1", children: [
|
|
92
93
|
t && t.length > 0 && !o && /* @__PURE__ */ f(P, { children: [
|
|
93
94
|
/* @__PURE__ */ r(C, { asChild: !0, children: /* @__PURE__ */ r(
|
|
@@ -100,7 +101,7 @@ const ye = a.forwardRef(
|
|
|
100
101
|
e.stopPropagation(), D();
|
|
101
102
|
},
|
|
102
103
|
className: "inline-flex size-4 items-center justify-center bg-transparent border-none p-0 cursor-pointer",
|
|
103
|
-
children: /* @__PURE__ */ r(
|
|
104
|
+
children: /* @__PURE__ */ r(_, { className: "size-3 hover:text-content" })
|
|
104
105
|
}
|
|
105
106
|
) }),
|
|
106
107
|
/* @__PURE__ */ r(k, { variant: "tertiary", side: "top", children: s("calendar.clear") })
|
|
@@ -120,42 +121,42 @@ const ye = a.forwardRef(
|
|
|
120
121
|
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), e.stopPropagation(), o || n(!i));
|
|
121
122
|
},
|
|
122
123
|
className: "inline-flex items-center justify-center bg-transparent border-none p-0 cursor-pointer",
|
|
123
|
-
children: /* @__PURE__ */ r(
|
|
124
|
+
children: /* @__PURE__ */ r(ee, { className: "h-4 w-4 text-secondary-foreground" })
|
|
124
125
|
}
|
|
125
126
|
) }),
|
|
126
127
|
/* @__PURE__ */ r(k, { variant: "tertiary", side: "top", children: s("datePicker.selectMultipleDates") })
|
|
127
128
|
] })
|
|
128
129
|
] }),
|
|
129
|
-
...
|
|
130
|
+
...q
|
|
130
131
|
}
|
|
131
132
|
)
|
|
132
133
|
}
|
|
133
134
|
) }),
|
|
134
135
|
/* @__PURE__ */ r(
|
|
135
|
-
|
|
136
|
+
se,
|
|
136
137
|
{
|
|
137
138
|
className: "w-auto p-0",
|
|
138
139
|
align: "start",
|
|
139
140
|
"aria-label": s("datePicker.selectMultipleDates"),
|
|
140
141
|
onOpenAutoFocus: (e) => e.preventDefault(),
|
|
141
|
-
...
|
|
142
|
+
...J,
|
|
142
143
|
children: /* @__PURE__ */ r(
|
|
143
|
-
|
|
144
|
+
ie,
|
|
144
145
|
{
|
|
145
146
|
mode: "multiple",
|
|
146
147
|
selected: p,
|
|
147
|
-
footerFlashKey:
|
|
148
|
-
footerFlashTarget:
|
|
149
|
-
onSelect:
|
|
150
|
-
disabled:
|
|
148
|
+
footerFlashKey: $,
|
|
149
|
+
footerFlashTarget: G,
|
|
150
|
+
onSelect: Q,
|
|
151
|
+
disabled: he(A, N),
|
|
151
152
|
startMonth: b,
|
|
152
153
|
endMonth: T,
|
|
153
154
|
showFooter: l,
|
|
154
|
-
onApply:
|
|
155
|
+
onApply: U,
|
|
155
156
|
onCancel: g,
|
|
156
157
|
onClear: D,
|
|
157
158
|
captionLayout: "dropdown",
|
|
158
|
-
...
|
|
159
|
+
...ye({
|
|
159
160
|
calendarKind: S,
|
|
160
161
|
fiscalMode: F,
|
|
161
162
|
granularity: I,
|
|
@@ -164,8 +165,9 @@ const ye = a.forwardRef(
|
|
|
164
165
|
fiscalConfig: O,
|
|
165
166
|
showPresets: w,
|
|
166
167
|
showPeriodBoundaries: E,
|
|
167
|
-
|
|
168
|
-
|
|
168
|
+
autoNavigateToAvailable: v,
|
|
169
|
+
comparison: z,
|
|
170
|
+
onComparisonChange: K
|
|
169
171
|
})
|
|
170
172
|
}
|
|
171
173
|
)
|
|
@@ -174,7 +176,7 @@ const ye = a.forwardRef(
|
|
|
174
176
|
] });
|
|
175
177
|
}
|
|
176
178
|
);
|
|
177
|
-
|
|
179
|
+
ge.displayName = "MultiDatePicker";
|
|
178
180
|
export {
|
|
179
|
-
|
|
181
|
+
ge as MultiDatePicker
|
|
180
182
|
};
|