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,30 +1,30 @@
|
|
|
1
1
|
import { jsx as h, jsxs as T } from "react/jsx-runtime";
|
|
2
2
|
import * as c from "react";
|
|
3
|
-
import { Cross as
|
|
3
|
+
import { Cross as ot, CalendarMonth as rt } from "impact-nova-icons";
|
|
4
4
|
import { format as y } from "date-fns";
|
|
5
5
|
import { cn as G } from "../../../lib/utils.js";
|
|
6
|
-
import { usePickerDismissActionsRef as
|
|
7
|
-
import { useFieldChrome as
|
|
8
|
-
import { Popover as
|
|
9
|
-
import { Calendar as
|
|
6
|
+
import { usePickerDismissActionsRef as nt, usePickerFooterDismissNudge as st, createRangePickerOpenChangeHandler as it, parseDateInput as J, normalizeOrderedRange as lt, flashRangeReorder as at, isDateInputInvalid as ie, resolveRangeFieldBlur as V, resolveRangePickerDismissFlash as ct, handlePickerEscapeKeyDown as le, handlePickerSurfacePointerDown as ft, compareDates as Q, deferRangeInputBlur as dt, maskDateInput as ae, resolveDateInputOnBlur as O } from "./date-input-behavior.js";
|
|
7
|
+
import { useFieldChrome as pt } from "../../../lib/primitives/use-field-chrome.js";
|
|
8
|
+
import { Popover as ut, PopoverAnchor as mt, PopoverContent as gt } from "../../feedback/popover/popover.js";
|
|
9
|
+
import { Calendar as vt } from "../../data-display/calendar/calendar.js";
|
|
10
10
|
import { Tooltip as ce, TooltipTrigger as fe, TooltipContent as de } from "../../feedback/tooltip/tooltip.js";
|
|
11
|
-
import { useImpactNovaI18n as
|
|
12
|
-
import { getDateFnsLocale as
|
|
13
|
-
import { coerceDateRangeApply as
|
|
14
|
-
import { buildDateBoundsMatcher as
|
|
15
|
-
import { fiscalCalendarPassThrough as
|
|
11
|
+
import { useImpactNovaI18n as ht } from "../../../i18n/use-impact-nova-i18n.js";
|
|
12
|
+
import { getDateFnsLocale as yt } from "../../../i18n/getDateFnsLocale.js";
|
|
13
|
+
import { coerceDateRangeApply as Rt, coerceDateRange as Dt } from "./calendar-selection-adapters.js";
|
|
14
|
+
import { buildDateBoundsMatcher as kt } from "../../../lib/date-bounds-matcher.js";
|
|
15
|
+
import { fiscalCalendarPassThrough as xt } from "./fiscal-pass-through.js";
|
|
16
16
|
import { isDateRangeArray as I } from "../../data-display/calendar/calendar-interval-utils.js";
|
|
17
17
|
function pe(i) {
|
|
18
18
|
if (i)
|
|
19
19
|
return I(i) ? i[i.length - 1] : i;
|
|
20
20
|
}
|
|
21
|
-
function
|
|
21
|
+
function Ct(i, f) {
|
|
22
22
|
if (!i && !f) return !0;
|
|
23
23
|
if (!i || !f) return !1;
|
|
24
24
|
const r = !i.from && !f.from || i.from && f.from && Q(i.from, f.from) === 0, M = !i.to && !f.to || i.to && f.to && Q(i.to, f.to) === 0;
|
|
25
25
|
return !!(r && M);
|
|
26
26
|
}
|
|
27
|
-
const
|
|
27
|
+
const Pt = c.forwardRef(
|
|
28
28
|
({
|
|
29
29
|
value: i,
|
|
30
30
|
onChange: f,
|
|
@@ -41,8 +41,8 @@ const Ct = c.forwardRef(
|
|
|
41
41
|
label: ye,
|
|
42
42
|
helperText: Re,
|
|
43
43
|
helperTextPosition: De = "absolute",
|
|
44
|
-
prefix:
|
|
45
|
-
prefixClick:
|
|
44
|
+
prefix: bt,
|
|
45
|
+
prefixClick: It,
|
|
46
46
|
isError: ke,
|
|
47
47
|
error: xe,
|
|
48
48
|
size: W,
|
|
@@ -56,13 +56,14 @@ const Ct = c.forwardRef(
|
|
|
56
56
|
fiscalConfig: Be,
|
|
57
57
|
showPresets: Se,
|
|
58
58
|
showPeriodBoundaries: Ne,
|
|
59
|
-
|
|
60
|
-
|
|
59
|
+
autoNavigateToAvailable: Ae,
|
|
60
|
+
comparison: Ve,
|
|
61
|
+
onComparisonChange: Oe,
|
|
61
62
|
mode: K = "range",
|
|
62
63
|
onRangesChange: j,
|
|
63
|
-
...
|
|
64
|
-
},
|
|
65
|
-
const { locale: X, t: b } =
|
|
64
|
+
...Me
|
|
65
|
+
}, Ke) => {
|
|
66
|
+
const { locale: X, t: b } = ht(), n = c.useMemo(() => yt(X), [X]), Y = M ?? b("datePicker.startDate"), Z = ue ?? b("datePicker.endDate"), _ = xe ?? ke, je = pt({
|
|
66
67
|
label: ye,
|
|
67
68
|
helperText: Re,
|
|
68
69
|
helperTextPosition: De,
|
|
@@ -71,18 +72,18 @@ const Ct = c.forwardRef(
|
|
|
71
72
|
disabled: d ?? void 0,
|
|
72
73
|
rootClassName: "w-full min-w-[240px]"
|
|
73
74
|
}), L = c.useRef(null), $ = c.useRef(null), F = c.useRef(null), N = c.useRef(null), q = c.useRef(null);
|
|
74
|
-
c.useImperativeHandle(
|
|
75
|
-
const l = pe(i), [p, m] = c.useState(!1), ee =
|
|
75
|
+
c.useImperativeHandle(Ke, () => L.current);
|
|
76
|
+
const l = pe(i), [p, m] = c.useState(!1), ee = nt(), { footerFlashKey: Le, footerFlashTarget: qe, popoverHandlers: ze } = st(g, p, ee, F), E = c.useRef(!1), [u, R] = c.useState(l), [te, B] = c.useState(
|
|
76
77
|
I(i) ? i : void 0
|
|
77
|
-
), [
|
|
78
|
+
), [He, z] = c.useState(
|
|
78
79
|
I(i) ? i : void 0
|
|
79
|
-
), [v, k] = c.useState(l?.from ? y(l.from, r, { locale: n }) : ""), [D, x] = c.useState(l?.to ? y(l.to, r, { locale: n }) : ""), [
|
|
80
|
+
), [v, k] = c.useState(l?.from ? y(l.from, r, { locale: n }) : ""), [D, x] = c.useState(l?.to ? y(l.to, r, { locale: n }) : ""), [Ge, w] = c.useState(l?.from || /* @__PURE__ */ new Date()), C = l?.from ? y(l.from, r, { locale: n }) : "", P = l?.to ? y(l.to, r, { locale: n }) : "";
|
|
80
81
|
c.useEffect(() => {
|
|
81
82
|
const e = pe(i);
|
|
82
83
|
k(e?.from ? y(e.from, r, { locale: n }) : ""), x(e?.to ? y(e.to, r, { locale: n }) : ""), R(e), B(I(i) ? i : void 0), z(I(i) ? i : void 0);
|
|
83
84
|
}, [i, r, n]);
|
|
84
|
-
const
|
|
85
|
-
(e) =>
|
|
85
|
+
const Je = c.useCallback(
|
|
86
|
+
(e) => it({
|
|
86
87
|
disabled: d ?? void 0,
|
|
87
88
|
showFooter: g,
|
|
88
89
|
containerRef: N,
|
|
@@ -98,18 +99,18 @@ const Ct = c.forwardRef(
|
|
|
98
99
|
}
|
|
99
100
|
oe.current = p;
|
|
100
101
|
}, [p, v, r, n, u?.from, l?.from]);
|
|
101
|
-
const
|
|
102
|
+
const Qe = (e) => {
|
|
102
103
|
if (I(e)) {
|
|
103
104
|
B(e);
|
|
104
105
|
const o = e[e.length - 1];
|
|
105
106
|
R(o), o?.from && k(y(o.from, r, { locale: n })), o?.to && x(y(o.to, r, { locale: n })), !g && e.every((s) => s.from && s.to) && (j?.(e), f?.(o), m(!1));
|
|
106
107
|
return;
|
|
107
108
|
}
|
|
108
|
-
const t =
|
|
109
|
+
const t = Dt(e);
|
|
109
110
|
R(t), t?.from && k(y(t.from, r, { locale: n })), t?.to && x(y(t.to, r, { locale: n })), g || t?.from && t?.to && t.from.getTime() !== t.to.getTime() && (f?.(t), m(!1));
|
|
110
111
|
}, S = c.useCallback((e, t) => {
|
|
111
|
-
const o =
|
|
112
|
-
return o.swapped && (o.from && k(y(o.from, r, { locale: n })), o.to && x(y(o.to, r, { locale: n })),
|
|
112
|
+
const o = lt(e, t, Q);
|
|
113
|
+
return o.swapped && (o.from && k(y(o.from, r, { locale: n })), o.to && x(y(o.to, r, { locale: n })), at(N.current)), { from: o.from, to: o.to };
|
|
113
114
|
}, [r, n]), re = (e) => {
|
|
114
115
|
if (K === "multi-range") {
|
|
115
116
|
const s = I(e) ? e : te;
|
|
@@ -118,15 +119,15 @@ const Ct = c.forwardRef(
|
|
|
118
119
|
f?.(a), z(s), m(!1);
|
|
119
120
|
return;
|
|
120
121
|
}
|
|
121
|
-
let t =
|
|
122
|
+
let t = Rt(e, u);
|
|
122
123
|
t?.from && !t.to && (t = { from: t.from, to: t.from });
|
|
123
124
|
const o = S(t?.from, t?.to);
|
|
124
125
|
R({ from: o.from, to: o.to }), f?.({ from: o.from, to: o.to }), m(!1);
|
|
125
126
|
}, A = () => {
|
|
126
|
-
R(l), B(
|
|
127
|
+
R(l), B(He), k(l?.from ? y(l.from, r, { locale: n }) : ""), x(l?.to ? y(l.to, r, { locale: n }) : ""), m(!1);
|
|
127
128
|
}, H = () => {
|
|
128
129
|
R(void 0), B(void 0), z(void 0), k(""), x(""), f?.(void 0), j?.(void 0), g || m(!1);
|
|
129
|
-
},
|
|
130
|
+
}, Ue = (e) => {
|
|
130
131
|
const t = ae(e.target.value, r, v);
|
|
131
132
|
if (k(t), t === "") {
|
|
132
133
|
const a = { from: void 0, to: u?.to };
|
|
@@ -138,7 +139,7 @@ const Ct = c.forwardRef(
|
|
|
138
139
|
const a = { from: o, to: u?.to };
|
|
139
140
|
R(a), w(o), g || f?.(a);
|
|
140
141
|
}
|
|
141
|
-
},
|
|
142
|
+
}, We = (e) => {
|
|
142
143
|
const t = ae(e.target.value, r, D);
|
|
143
144
|
if (x(t), t === "") {
|
|
144
145
|
const a = { from: u?.from, to: void 0 };
|
|
@@ -151,7 +152,7 @@ const Ct = c.forwardRef(
|
|
|
151
152
|
R(a), w(o), g || f?.(a);
|
|
152
153
|
}
|
|
153
154
|
}, ne = () => {
|
|
154
|
-
|
|
155
|
+
dt(
|
|
155
156
|
N,
|
|
156
157
|
q,
|
|
157
158
|
() => {
|
|
@@ -163,7 +164,7 @@ const Ct = c.forwardRef(
|
|
|
163
164
|
R(a), g || (a ? f?.(a) : !v && !D && f?.(void 0));
|
|
164
165
|
}
|
|
165
166
|
);
|
|
166
|
-
},
|
|
167
|
+
}, Xe = () => {
|
|
167
168
|
const e = O(v, r, C, n), t = O(D, r, P, n);
|
|
168
169
|
e.resetToCommitted ? k(C) : e.parsed && k(e.display), t.resetToCommitted ? x(P) : t.parsed && x(t.display);
|
|
169
170
|
let o = e.parsed ?? u?.from ?? l?.from, s = t.parsed ?? u?.to ?? l?.to;
|
|
@@ -177,19 +178,19 @@ const Ct = c.forwardRef(
|
|
|
177
178
|
}
|
|
178
179
|
if (!p) {
|
|
179
180
|
if (g) {
|
|
180
|
-
|
|
181
|
+
Xe();
|
|
181
182
|
return;
|
|
182
183
|
}
|
|
183
184
|
const e = O(v, r, C, n), t = O(D, r, P, n);
|
|
184
185
|
if (e.parsed || t.parsed) return;
|
|
185
186
|
E.current = !0, m(!0);
|
|
186
187
|
}
|
|
187
|
-
},
|
|
188
|
+
}, Ye = v !== C, Ze = D !== P, _e = ie(v, r, n), $e = ie(D, r, n), Fe = c.useCallback(() => {
|
|
188
189
|
const e = V(v, r, C, n), t = V(D, r, P, n);
|
|
189
190
|
let o = e.parsed ? e.parsed : e.resetToCommitted ? l?.from : u?.from, s = t.parsed ? t.parsed : t.resetToCommitted ? l?.to : u?.to;
|
|
190
191
|
o && s && ({ from: o, to: s } = S(o, s));
|
|
191
192
|
const a = o || s ? { from: o, to: s } : void 0;
|
|
192
|
-
return
|
|
193
|
+
return ct({
|
|
193
194
|
startInput: v,
|
|
194
195
|
endInput: D,
|
|
195
196
|
committedStart: C,
|
|
@@ -197,7 +198,7 @@ const Ct = c.forwardRef(
|
|
|
197
198
|
committedRange: i,
|
|
198
199
|
pendingRange: u,
|
|
199
200
|
computeEffectiveRange: () => a,
|
|
200
|
-
rangesEqual: (
|
|
201
|
+
rangesEqual: (et, tt) => Ct(et, tt)
|
|
201
202
|
});
|
|
202
203
|
}, [
|
|
203
204
|
v,
|
|
@@ -215,7 +216,7 @@ const Ct = c.forwardRef(
|
|
|
215
216
|
return c.useLayoutEffect(() => {
|
|
216
217
|
ee.current = {
|
|
217
218
|
onDismiss: A,
|
|
218
|
-
resolveFlash:
|
|
219
|
+
resolveFlash: Fe
|
|
219
220
|
};
|
|
220
221
|
}), /* @__PURE__ */ h(
|
|
221
222
|
"div",
|
|
@@ -223,14 +224,14 @@ const Ct = c.forwardRef(
|
|
|
223
224
|
ref: F,
|
|
224
225
|
"data-component": "date-range-picker",
|
|
225
226
|
"data-disabled": d || void 0,
|
|
226
|
-
children:
|
|
227
|
-
/* @__PURE__ */ T(
|
|
228
|
-
/* @__PURE__ */ h(
|
|
227
|
+
children: je.wrapControl(
|
|
228
|
+
/* @__PURE__ */ T(ut, { open: d ? !1 : p, onOpenChange: Je, children: [
|
|
229
|
+
/* @__PURE__ */ h(mt, { asChild: !0, children: /* @__PURE__ */ T(
|
|
229
230
|
"div",
|
|
230
231
|
{
|
|
231
232
|
ref: N,
|
|
232
233
|
"data-state": p ? "open" : "closed",
|
|
233
|
-
onPointerDown: (e) =>
|
|
234
|
+
onPointerDown: (e) => ft({
|
|
234
235
|
disabled: d,
|
|
235
236
|
event: e,
|
|
236
237
|
onOpen: () => m(!0),
|
|
@@ -254,7 +255,7 @@ const Ct = c.forwardRef(
|
|
|
254
255
|
ref: L,
|
|
255
256
|
type: "text",
|
|
256
257
|
value: v,
|
|
257
|
-
onChange:
|
|
258
|
+
onChange: Ue,
|
|
258
259
|
onBlur: ne,
|
|
259
260
|
onClick: () => !d && m(!0),
|
|
260
261
|
onKeyDown: (e) => {
|
|
@@ -266,9 +267,9 @@ const Ct = c.forwardRef(
|
|
|
266
267
|
"data-field": "start",
|
|
267
268
|
className: G(
|
|
268
269
|
"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",
|
|
269
|
-
|
|
270
|
+
_e ? "text-destructive" : Ye ? "text-content-placeholder" : ""
|
|
270
271
|
),
|
|
271
|
-
...
|
|
272
|
+
...Me
|
|
272
273
|
}
|
|
273
274
|
),
|
|
274
275
|
/* @__PURE__ */ h(
|
|
@@ -277,7 +278,7 @@ const Ct = c.forwardRef(
|
|
|
277
278
|
ref: $,
|
|
278
279
|
type: "text",
|
|
279
280
|
value: D,
|
|
280
|
-
onChange:
|
|
281
|
+
onChange: We,
|
|
281
282
|
onBlur: ne,
|
|
282
283
|
onClick: () => !d && m(!0),
|
|
283
284
|
onKeyDown: (e) => {
|
|
@@ -289,7 +290,7 @@ const Ct = c.forwardRef(
|
|
|
289
290
|
"data-field": "end",
|
|
290
291
|
className: G(
|
|
291
292
|
"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",
|
|
292
|
-
|
|
293
|
+
$e ? "text-destructive" : Ze ? "text-content-placeholder" : ""
|
|
293
294
|
)
|
|
294
295
|
}
|
|
295
296
|
)
|
|
@@ -309,7 +310,7 @@ const Ct = c.forwardRef(
|
|
|
309
310
|
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), e.stopPropagation(), H());
|
|
310
311
|
},
|
|
311
312
|
className: "inline-flex size-4 items-center justify-center bg-transparent border-none p-0 cursor-pointer",
|
|
312
|
-
children: /* @__PURE__ */ h(
|
|
313
|
+
children: /* @__PURE__ */ h(ot, { className: "size-3 hover:text-content text-content-icon" })
|
|
313
314
|
}
|
|
314
315
|
) }),
|
|
315
316
|
/* @__PURE__ */ h(de, { variant: "tertiary", side: "top", children: b("calendar.clear") })
|
|
@@ -319,7 +320,7 @@ const Ct = c.forwardRef(
|
|
|
319
320
|
e.stopPropagation(), d || m(!p);
|
|
320
321
|
}, onKeyDown: (e) => {
|
|
321
322
|
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), e.stopPropagation(), d || (E.current = !0, m(!p)));
|
|
322
|
-
}, className: "inline-flex items-center justify-center bg-transparent border-none p-0 cursor-pointer", children: /* @__PURE__ */ h(
|
|
323
|
+
}, className: "inline-flex items-center justify-center bg-transparent border-none p-0 cursor-pointer", children: /* @__PURE__ */ h(rt, { className: "h-4 w-4 text-secondary-foreground" }) }) }),
|
|
323
324
|
/* @__PURE__ */ h(de, { variant: "tertiary", side: "top", children: b("datePicker.selectMonthRange") })
|
|
324
325
|
] })
|
|
325
326
|
] })
|
|
@@ -327,7 +328,7 @@ const Ct = c.forwardRef(
|
|
|
327
328
|
}
|
|
328
329
|
) }),
|
|
329
330
|
/* @__PURE__ */ h(
|
|
330
|
-
|
|
331
|
+
gt,
|
|
331
332
|
{
|
|
332
333
|
ref: q,
|
|
333
334
|
className: "w-auto p-0",
|
|
@@ -336,18 +337,18 @@ const Ct = c.forwardRef(
|
|
|
336
337
|
onOpenAutoFocus: (e) => {
|
|
337
338
|
E.current || e.preventDefault(), E.current = !1;
|
|
338
339
|
},
|
|
339
|
-
...
|
|
340
|
+
...ze,
|
|
340
341
|
children: /* @__PURE__ */ h(
|
|
341
|
-
|
|
342
|
+
vt,
|
|
342
343
|
{
|
|
343
344
|
mode: K,
|
|
344
345
|
selected: K === "multi-range" ? te : u,
|
|
345
|
-
footerFlashKey:
|
|
346
|
-
footerFlashTarget:
|
|
347
|
-
onSelect:
|
|
348
|
-
month:
|
|
346
|
+
footerFlashKey: Le,
|
|
347
|
+
footerFlashTarget: qe,
|
|
348
|
+
onSelect: Qe,
|
|
349
|
+
month: Ge,
|
|
349
350
|
onMonthChange: w,
|
|
350
|
-
disabled:
|
|
351
|
+
disabled: kt(me, ge),
|
|
351
352
|
startMonth: ve,
|
|
352
353
|
endMonth: he,
|
|
353
354
|
showFooter: g,
|
|
@@ -357,7 +358,7 @@ const Ct = c.forwardRef(
|
|
|
357
358
|
onRangesChange: B,
|
|
358
359
|
captionLayout: "dropdown",
|
|
359
360
|
...U !== void 0 ? { weekStartsOn: U } : {},
|
|
360
|
-
...
|
|
361
|
+
...xt({
|
|
361
362
|
calendarKind: be,
|
|
362
363
|
fiscalMode: Ie,
|
|
363
364
|
granularity: Ee,
|
|
@@ -366,8 +367,9 @@ const Ct = c.forwardRef(
|
|
|
366
367
|
fiscalConfig: Be,
|
|
367
368
|
showPresets: Se,
|
|
368
369
|
showPeriodBoundaries: Ne,
|
|
369
|
-
|
|
370
|
-
|
|
370
|
+
autoNavigateToAvailable: Ae,
|
|
371
|
+
comparison: Ve,
|
|
372
|
+
onComparisonChange: Oe
|
|
371
373
|
})
|
|
372
374
|
}
|
|
373
375
|
)
|
|
@@ -379,7 +381,7 @@ const Ct = c.forwardRef(
|
|
|
379
381
|
);
|
|
380
382
|
}
|
|
381
383
|
);
|
|
382
|
-
|
|
384
|
+
Pt.displayName = "DateRangePicker";
|
|
383
385
|
export {
|
|
384
|
-
|
|
386
|
+
Pt as DateRangePicker
|
|
385
387
|
};
|
|
@@ -2,6 +2,7 @@ import { FiscalPickerProps } from './date-picker.types';
|
|
|
2
2
|
export declare function fiscalCalendarPassThrough(props: FiscalPickerProps): {
|
|
3
3
|
showPresets: boolean | undefined;
|
|
4
4
|
showPeriodBoundaries: boolean | undefined;
|
|
5
|
+
autoNavigateToAvailable: boolean | undefined;
|
|
5
6
|
comparison: "prior-fy" | undefined;
|
|
6
7
|
onComparisonChange: ((value: import('../../..').YoYComparison | undefined) => void) | undefined;
|
|
7
8
|
weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | undefined;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
function
|
|
1
|
+
function e(a) {
|
|
2
2
|
return {
|
|
3
3
|
calendarKind: a.calendarKind,
|
|
4
4
|
fiscalMode: a.fiscalMode,
|
|
@@ -9,10 +9,11 @@ function n(a) {
|
|
|
9
9
|
...a.weekStartsOn !== void 0 ? { weekStartsOn: a.weekStartsOn } : {},
|
|
10
10
|
showPresets: a.showPresets,
|
|
11
11
|
showPeriodBoundaries: a.showPeriodBoundaries,
|
|
12
|
+
autoNavigateToAvailable: a.autoNavigateToAvailable,
|
|
12
13
|
comparison: a.comparison,
|
|
13
14
|
onComparisonChange: a.onComparisonChange
|
|
14
15
|
};
|
|
15
16
|
}
|
|
16
17
|
export {
|
|
17
|
-
|
|
18
|
+
e as fiscalCalendarPassThrough
|
|
18
19
|
};
|
|
@@ -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
|
};
|