impact-nova 2.5.10 → 2.5.12
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-display/calendar/calendar-apply-validation.d.ts +2 -0
- package/dist/components/data-display/calendar/calendar-apply-validation.js +64 -67
- package/dist/components/data-display/calendar/calendar-available-view.d.ts +27 -0
- package/dist/components/data-display/calendar/calendar-available-view.js +85 -0
- package/dist/components/data-display/calendar/calendar-config.js +1 -1
- package/dist/components/data-display/calendar/calendar-day-picker-components.d.ts +4 -2
- package/dist/components/data-display/calendar/calendar-day-picker-components.js +234 -164
- package/dist/components/data-display/calendar/calendar-day-picker-view.js +77 -76
- package/dist/components/data-display/calendar/calendar-fiscal-day-cell.d.ts +9 -0
- package/dist/components/data-display/calendar/calendar-fiscal-day-cell.js +45 -0
- package/dist/components/data-display/calendar/calendar-fiscal-period-nav.d.ts +6 -0
- package/dist/components/data-display/calendar/calendar-fiscal-period-nav.js +34 -18
- package/dist/components/data-display/calendar/calendar-footer.js +21 -21
- package/dist/components/data-display/calendar/calendar-injected-week-row.d.ts +5 -0
- package/dist/components/data-display/calendar/calendar-injected-week-row.js +92 -0
- package/dist/components/data-display/calendar/calendar-leading-week.utils.d.ts +16 -0
- package/dist/components/data-display/calendar/calendar-leading-week.utils.js +51 -0
- package/dist/components/data-display/calendar/calendar-month-picker-panel.js +50 -49
- package/dist/components/data-display/calendar/calendar-month-utils.d.ts +5 -0
- package/dist/components/data-display/calendar/calendar-month-utils.js +85 -64
- package/dist/components/data-display/calendar/calendar-orphan-week.d.ts +23 -0
- package/dist/components/data-display/calendar/calendar-padding-week.utils.d.ts +3 -1
- package/dist/components/data-display/calendar/calendar-padding-week.utils.js +7 -5
- package/dist/components/data-display/calendar/calendar-period-cell.js +45 -46
- package/dist/components/data-display/calendar/calendar-quarter-panes.js +33 -31
- package/dist/components/data-display/calendar/calendar-selection-appearance.d.ts +10 -0
- package/dist/components/data-display/calendar/calendar-selection-appearance.js +53 -39
- package/dist/components/data-display/calendar/calendar-selection.d.ts +25 -0
- package/dist/components/data-display/calendar/calendar-selection.js +52 -23
- package/dist/components/data-display/calendar/calendar-week-number-cell.d.ts +2 -1
- package/dist/components/data-display/calendar/calendar-week-number-cell.js +59 -45
- package/dist/components/data-display/calendar/calendar-week-utils.d.ts +13 -3
- package/dist/components/data-display/calendar/calendar-week-utils.js +59 -50
- package/dist/components/data-display/calendar/calendar-year-panes.d.ts +3 -0
- package/dist/components/data-display/calendar/calendar-year-panes.js +53 -49
- package/dist/components/data-display/calendar/calendar.js +146 -143
- package/dist/components/data-display/calendar/calendar.types.d.ts +5 -0
- package/dist/components/data-display/calendar/use-calendar-day-picker-config.d.ts +2 -1
- package/dist/components/data-display/calendar/use-calendar-day-picker-config.js +79 -74
- package/dist/components/data-display/calendar/use-calendar-state.d.ts +3 -1
- package/dist/components/data-display/calendar/use-calendar-state.js +403 -325
- package/dist/components/forms/date-picker/date-picker.js +60 -58
- package/dist/components/forms/date-picker/date-picker.types.d.ts +5 -0
- package/dist/components/forms/date-picker/date-range-picker.js +66 -64
- package/dist/components/forms/date-picker/fiscal-pass-through.d.ts +1 -0
- package/dist/components/forms/date-picker/fiscal-pass-through.js +3 -2
- package/dist/components/forms/date-picker/fiscal-picker-fixtures.d.ts +17 -0
- package/dist/components/forms/date-picker/month-picker.js +61 -59
- package/dist/components/forms/date-picker/month-range-picker.js +63 -61
- package/dist/components/forms/date-picker/multi-date-picker.js +51 -49
- package/dist/components/forms/date-picker/multi-month-picker.js +49 -47
- package/dist/components/forms/date-picker/multi-quarter-picker.js +51 -47
- package/dist/components/forms/date-picker/multi-week-picker.js +53 -51
- package/dist/components/forms/date-picker/multi-year-picker.js +53 -49
- package/dist/components/forms/date-picker/quarter-picker.js +51 -47
- package/dist/components/forms/date-picker/quarter-range-picker.js +50 -46
- package/dist/components/forms/date-picker/week-picker.js +68 -66
- package/dist/components/forms/date-picker/week-range-picker.js +82 -80
- package/dist/components/forms/date-picker/year-picker.js +52 -48
- package/dist/components/forms/date-picker/year-range-picker.js +52 -48
- package/dist/form-react/Fields/DateInputField.js +51 -50
- package/dist/form-react/Fields/DateRangeField.js +14 -13
- package/dist/form-react/Fields/MonthRangeField.js +29 -28
- package/dist/form-react/Fields/MultiMonthPickerField.js +13 -12
- package/dist/form-react/Fields/MultiWeekPickerField.js +35 -27
- package/dist/form-react/Fields/WeekRangePicker.js +33 -32
- package/dist/form-react/types/fields.types.d.ts +14 -0
- package/dist/impact-nova-components.css +13 -6
- package/dist/impact-nova.css +1 -1
- package/dist/lib/fiscal-calendar/week-selection.js +2 -2
- package/dist/llms/rules/installation.js +1 -1
- package/dist/llms/rules/requirements.js +1 -1
- package/package.json +1 -1
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
import { jsx as u, jsxs as W } from "react/jsx-runtime";
|
|
2
2
|
import * as c from "react";
|
|
3
|
-
import { Cross as
|
|
3
|
+
import { Cross as et, CalendarMonth as tt } from "impact-nova-icons";
|
|
4
4
|
import { format as g } from "date-fns";
|
|
5
5
|
import { cn as Q } from "../../../lib/utils.js";
|
|
6
|
-
import { usePickerDismissActionsRef as
|
|
7
|
-
import { useFieldChrome as
|
|
8
|
-
import { Popover as
|
|
9
|
-
import { Calendar as
|
|
10
|
-
import { buildDateBoundsMatcher as
|
|
6
|
+
import { usePickerDismissActionsRef as rt, usePickerFooterDismissNudge as ot, createRangePickerOpenChangeHandler as nt, parseDateInput as U, normalizeOrderedRange as st, compareDates as it, flashRangeReorder as ct, isDateInputInvalid as ce, resolveRangeFieldBlur as L, resolveRangePickerDismissFlash as lt, handlePickerEscapeKeyDown as le, handlePickerSurfacePointerDown as at, deferRangeInputBlur as ft, maskDateInput as ae, resolveDateInputOnBlur as j } from "./date-input-behavior.js";
|
|
7
|
+
import { useFieldChrome as dt } from "../../../lib/primitives/use-field-chrome.js";
|
|
8
|
+
import { Popover as pt, PopoverAnchor as mt, PopoverContent as ut } from "../../feedback/popover/popover.js";
|
|
9
|
+
import { Calendar as gt } from "../../data-display/calendar/calendar.js";
|
|
10
|
+
import { buildDateBoundsMatcher as kt } from "../../../lib/date-bounds-matcher.js";
|
|
11
11
|
import { Tooltip as fe, TooltipTrigger as de, TooltipContent as pe } from "../../feedback/tooltip/tooltip.js";
|
|
12
|
-
import { resolveWeekSelection as
|
|
13
|
-
import { useImpactNovaI18n as
|
|
14
|
-
import { getDateFnsLocale as
|
|
15
|
-
import { coerceWeekRangeApply as
|
|
16
|
-
import { fiscalCalendarPassThrough as
|
|
12
|
+
import { resolveWeekSelection as Rt } from "../../../lib/fiscal-calendar/week-selection.js";
|
|
13
|
+
import { useImpactNovaI18n as ht } from "../../../i18n/use-impact-nova-i18n.js";
|
|
14
|
+
import { getDateFnsLocale as Dt } from "../../../i18n/getDateFnsLocale.js";
|
|
15
|
+
import { coerceWeekRangeApply as yt, isWeekRangeSelection as vt } from "./calendar-selection-adapters.js";
|
|
16
|
+
import { fiscalCalendarPassThrough as xt } from "./fiscal-pass-through.js";
|
|
17
17
|
const x = (t) => t?.from ? t.to ? t.to.endDate : t.from.endDate : void 0, S = (t) => t?.from ? { from: t.from, to: t.to } : void 0;
|
|
18
18
|
function me(t, l) {
|
|
19
19
|
return !t && !l ? !0 : !t || !l ? !1 : t.startDate.getTime() === l.startDate.getTime();
|
|
20
20
|
}
|
|
21
|
-
function
|
|
21
|
+
function Ct(t, l) {
|
|
22
22
|
return !t && !l ? !0 : !t || !l ? !1 : me(t.from, l.from) && me(t.to, l.to);
|
|
23
23
|
}
|
|
24
|
-
const
|
|
24
|
+
const bt = c.forwardRef(
|
|
25
25
|
({
|
|
26
26
|
value: t,
|
|
27
27
|
onChange: l,
|
|
@@ -41,40 +41,41 @@ const Ct = c.forwardRef(
|
|
|
41
41
|
weekStartsOn: M = 1,
|
|
42
42
|
showPresets: ye,
|
|
43
43
|
showPeriodBoundaries: ve,
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
autoNavigateToAvailable: xe,
|
|
45
|
+
comparison: Ce,
|
|
46
|
+
onComparisonChange: be,
|
|
46
47
|
disabled: d,
|
|
47
|
-
className:
|
|
48
|
-
error:
|
|
49
|
-
isError:
|
|
48
|
+
className: we,
|
|
49
|
+
error: Ie,
|
|
50
|
+
isError: Te,
|
|
50
51
|
size: X,
|
|
51
|
-
label:
|
|
52
|
-
helperText:
|
|
53
|
-
helperTextPosition:
|
|
54
|
-
required:
|
|
55
|
-
prefix:
|
|
56
|
-
prefixClick:
|
|
57
|
-
...
|
|
58
|
-
},
|
|
59
|
-
const Z =
|
|
60
|
-
label:
|
|
61
|
-
helperText:
|
|
62
|
-
helperTextPosition:
|
|
52
|
+
label: Ee,
|
|
53
|
+
helperText: Pe,
|
|
54
|
+
helperTextPosition: We = "absolute",
|
|
55
|
+
required: Se,
|
|
56
|
+
prefix: wt,
|
|
57
|
+
prefixClick: It,
|
|
58
|
+
...Be
|
|
59
|
+
}, Ne) => {
|
|
60
|
+
const Z = Ie ?? Te, Ve = dt({
|
|
61
|
+
label: Ee,
|
|
62
|
+
helperText: Pe,
|
|
63
|
+
helperTextPosition: We,
|
|
63
64
|
error: Z,
|
|
64
|
-
required:
|
|
65
|
+
required: Se,
|
|
65
66
|
disabled: d ?? void 0,
|
|
66
67
|
rootClassName: "w-full min-w-[240px]"
|
|
67
|
-
}), { locale: _, t: T } =
|
|
68
|
-
c.useImperativeHandle(
|
|
69
|
-
const [p, R] = c.useState(!1), ee =
|
|
68
|
+
}), { locale: _, t: T } = ht(), s = c.useMemo(() => Dt(_), [_]), $ = ue ?? T("datePicker.selectWeekRange"), V = N === "fiscal", G = c.useRef(null), Y = c.useRef(null), F = c.useRef(null), A = c.useRef(null), J = c.useRef(null);
|
|
69
|
+
c.useImperativeHandle(Ne, () => G.current);
|
|
70
|
+
const [p, R] = c.useState(!1), ee = rt(), { footerFlashKey: Ae, footerFlashTarget: Oe, popoverHandlers: Le } = ot(k, p, ee, F), E = c.useRef(!1), [a, h] = c.useState(t), [m, D] = c.useState(t?.from ? g(t.from.startDate, n, { locale: s }) : ""), [y, v] = c.useState(x(t) ? g(x(t), n, { locale: s }) : ""), [je, P] = c.useState(t?.from?.startDate || /* @__PURE__ */ new Date()), qe = t?.from?.startDate.getTime(), ze = x(t)?.getTime(), te = c.useRef(t);
|
|
70
71
|
c.useEffect(() => {
|
|
71
72
|
te.current = t;
|
|
72
73
|
}), c.useEffect(() => {
|
|
73
74
|
const e = te.current;
|
|
74
75
|
D(e?.from ? g(e.from.startDate, n, { locale: s }) : ""), v(x(e) ? g(x(e), n, { locale: s }) : ""), h(e);
|
|
75
|
-
}, [
|
|
76
|
-
const
|
|
77
|
-
(e) =>
|
|
76
|
+
}, [qe, ze, n, s]);
|
|
77
|
+
const He = c.useCallback(
|
|
78
|
+
(e) => nt({
|
|
78
79
|
disabled: d ?? void 0,
|
|
79
80
|
showFooter: k,
|
|
80
81
|
containerRef: A,
|
|
@@ -90,11 +91,11 @@ const Ct = c.forwardRef(
|
|
|
90
91
|
}
|
|
91
92
|
re.current = p;
|
|
92
93
|
}, [p, m, n, s, a?.from, t?.from, V]);
|
|
93
|
-
const
|
|
94
|
-
const r =
|
|
94
|
+
const Ke = (e) => {
|
|
95
|
+
const r = vt(e) ? e : void 0;
|
|
95
96
|
h(r), r?.from ? (D(g(r.from.startDate, n, { locale: s })), v(g(x(r), n, { locale: s }))) : (D(""), v("")), !k && r?.from && r?.to && r.from.startDate.getTime() !== r.to.startDate.getTime() && (l?.(r), R(!1));
|
|
96
97
|
}, C = c.useCallback(
|
|
97
|
-
(e) =>
|
|
98
|
+
(e) => Rt(e, {
|
|
98
99
|
calendarKind: N,
|
|
99
100
|
fiscalMode: q,
|
|
100
101
|
granularity: z,
|
|
@@ -111,20 +112,20 @@ const Ct = c.forwardRef(
|
|
|
111
112
|
M
|
|
112
113
|
]
|
|
113
114
|
), B = c.useCallback((e, r) => {
|
|
114
|
-
const o =
|
|
115
|
+
const o = st(
|
|
115
116
|
e,
|
|
116
117
|
r,
|
|
117
|
-
(i, f) =>
|
|
118
|
+
(i, f) => it(i.startDate, f.startDate)
|
|
118
119
|
);
|
|
119
|
-
return o.swapped && (o.from && D(g(o.from.startDate, n, { locale: s })), o.to && v(g(x({ from: o.from, to: o.to }), n, { locale: s })),
|
|
120
|
+
return o.swapped && (o.from && D(g(o.from.startDate, n, { locale: s })), o.to && v(g(x({ from: o.from, to: o.to }), n, { locale: s })), ct(A.current)), { from: o.from, to: o.to };
|
|
120
121
|
}, [n, s]), oe = (e) => {
|
|
121
|
-
const r =
|
|
122
|
+
const r = yt(e, S(a)), o = B(r?.from, r?.to), i = o.from ? { from: o.from, to: o.to } : void 0;
|
|
122
123
|
h(i), l?.(i), R(!1);
|
|
123
124
|
}, O = () => {
|
|
124
125
|
h(t), D(t?.from ? g(t.from.startDate, n, { locale: s }) : ""), v(x(t) ? g(x(t), n, { locale: s }) : ""), R(!1);
|
|
125
126
|
}, ne = () => {
|
|
126
127
|
h(void 0), D(""), v(""), l?.(void 0), k || R(!1);
|
|
127
|
-
},
|
|
128
|
+
}, Me = (e) => {
|
|
128
129
|
const r = ae(e.target.value, n, m);
|
|
129
130
|
if (D(r), r === "") {
|
|
130
131
|
const f = { to: a?.to };
|
|
@@ -136,7 +137,7 @@ const Ct = c.forwardRef(
|
|
|
136
137
|
const I = { from: C(o), to: a?.to };
|
|
137
138
|
h(I), a?.to && v(g(x(I), n, { locale: s })), V || P(o), k || l?.(S(I));
|
|
138
139
|
}
|
|
139
|
-
},
|
|
140
|
+
}, Ge = (e) => {
|
|
140
141
|
const r = ae(e.target.value, n, y);
|
|
141
142
|
if (v(r), r === "") {
|
|
142
143
|
const f = { from: a?.from };
|
|
@@ -148,7 +149,7 @@ const Ct = c.forwardRef(
|
|
|
148
149
|
const f = C(o), I = { from: a?.from, to: f };
|
|
149
150
|
h(I), a?.from && D(g(a.from.startDate, n, { locale: s })), V || P(o), k || l?.(S(I));
|
|
150
151
|
}
|
|
151
|
-
},
|
|
152
|
+
}, Je = () => {
|
|
152
153
|
const e = j(m, n, b, s), r = j(y, n, w, s);
|
|
153
154
|
e.resetToCommitted ? D(b) : e.parsed && D(e.display), r.resetToCommitted ? v(w) : r.parsed && v(r.display);
|
|
154
155
|
let o = e.parsed ? C(e.parsed) : a?.from, i = r.parsed ? C(r.parsed) : a?.to;
|
|
@@ -156,7 +157,7 @@ const Ct = c.forwardRef(
|
|
|
156
157
|
const f = o ? { from: o, to: i } : void 0;
|
|
157
158
|
f ? (h(f), l?.(f)) : !m && !y && (h(void 0), l?.(void 0));
|
|
158
159
|
}, se = () => {
|
|
159
|
-
|
|
160
|
+
ft(
|
|
160
161
|
A,
|
|
161
162
|
J,
|
|
162
163
|
() => {
|
|
@@ -175,19 +176,19 @@ const Ct = c.forwardRef(
|
|
|
175
176
|
}
|
|
176
177
|
if (!p) {
|
|
177
178
|
if (k) {
|
|
178
|
-
|
|
179
|
+
Je();
|
|
179
180
|
return;
|
|
180
181
|
}
|
|
181
182
|
const e = j(m, n, b, s), r = j(y, n, w, s);
|
|
182
183
|
if (e.parsed || r.parsed) return;
|
|
183
184
|
E.current = !0, R(!0);
|
|
184
185
|
}
|
|
185
|
-
}, b = t?.from ? g(t.from.startDate, n, { locale: s }) : "", w = x(t) ? g(x(t), n, { locale: s }) : "",
|
|
186
|
+
}, b = t?.from ? g(t.from.startDate, n, { locale: s }) : "", w = x(t) ? g(x(t), n, { locale: s }) : "", Qe = b !== m, Ue = w !== y, Xe = ce(m, n, s), Ze = ce(y, n, s), _e = "Start Date", $e = "End Date", Ye = c.useCallback(() => {
|
|
186
187
|
const e = L(m, n, b, s), r = L(y, n, w, s);
|
|
187
188
|
let o = e.parsed ? C(e.parsed) : e.resetToCommitted ? t?.from : a?.from, i = r.parsed ? C(r.parsed) : r.resetToCommitted ? t?.to : a?.to;
|
|
188
189
|
o && i && ({ from: o, to: i } = B(o, i));
|
|
189
190
|
const f = o || i ? { from: o, to: i } : void 0;
|
|
190
|
-
return
|
|
191
|
+
return lt({
|
|
191
192
|
startInput: m,
|
|
192
193
|
endInput: y,
|
|
193
194
|
committedStart: b,
|
|
@@ -195,7 +196,7 @@ const Ct = c.forwardRef(
|
|
|
195
196
|
committedRange: t,
|
|
196
197
|
pendingRange: S(a),
|
|
197
198
|
computeEffectiveRange: () => f,
|
|
198
|
-
rangesEqual: (I,
|
|
199
|
+
rangesEqual: (I, Fe) => Ct(I, Fe)
|
|
199
200
|
});
|
|
200
201
|
}, [
|
|
201
202
|
m,
|
|
@@ -212,7 +213,7 @@ const Ct = c.forwardRef(
|
|
|
212
213
|
return c.useLayoutEffect(() => {
|
|
213
214
|
ee.current = {
|
|
214
215
|
onDismiss: O,
|
|
215
|
-
resolveFlash:
|
|
216
|
+
resolveFlash: Ye
|
|
216
217
|
};
|
|
217
218
|
}), /* @__PURE__ */ u(
|
|
218
219
|
"div",
|
|
@@ -220,14 +221,14 @@ const Ct = c.forwardRef(
|
|
|
220
221
|
ref: F,
|
|
221
222
|
"data-component": "week-range-picker",
|
|
222
223
|
"data-disabled": d || void 0,
|
|
223
|
-
children:
|
|
224
|
-
/* @__PURE__ */ W(
|
|
225
|
-
/* @__PURE__ */ u(
|
|
224
|
+
children: Ve.wrapControl(
|
|
225
|
+
/* @__PURE__ */ W(pt, { open: d ? !1 : p, onOpenChange: He, children: [
|
|
226
|
+
/* @__PURE__ */ u(mt, { asChild: !0, children: /* @__PURE__ */ W(
|
|
226
227
|
"div",
|
|
227
228
|
{
|
|
228
229
|
ref: A,
|
|
229
230
|
"data-state": p ? "open" : "closed",
|
|
230
|
-
onPointerDown: (e) =>
|
|
231
|
+
onPointerDown: (e) => at({
|
|
231
232
|
disabled: d,
|
|
232
233
|
event: e,
|
|
233
234
|
onOpen: () => R(!0),
|
|
@@ -241,7 +242,7 @@ const Ct = c.forwardRef(
|
|
|
241
242
|
X === "sm" ? "h-6" : X === "md" ? "h-[28px]" : "h-8",
|
|
242
243
|
d && "pointer-events-none opacity-100 bg-disabled-surface border-stroke text-disabled-foreground hover:border-stroke",
|
|
243
244
|
"cursor-pointer",
|
|
244
|
-
|
|
245
|
+
we
|
|
245
246
|
),
|
|
246
247
|
children: [
|
|
247
248
|
/* @__PURE__ */ W("div", { className: "flex items-center gap-4 flex-1 min-w-0", children: [
|
|
@@ -251,7 +252,7 @@ const Ct = c.forwardRef(
|
|
|
251
252
|
ref: G,
|
|
252
253
|
type: "text",
|
|
253
254
|
value: m,
|
|
254
|
-
onChange:
|
|
255
|
+
onChange: Me,
|
|
255
256
|
onBlur: se,
|
|
256
257
|
onClick: () => !d && R(!0),
|
|
257
258
|
onKeyDown: (e) => {
|
|
@@ -259,13 +260,13 @@ const Ct = c.forwardRef(
|
|
|
259
260
|
},
|
|
260
261
|
placeholder: p ? n : $,
|
|
261
262
|
disabled: !!d,
|
|
262
|
-
"aria-label":
|
|
263
|
+
"aria-label": _e,
|
|
263
264
|
"data-field": "start",
|
|
264
265
|
className: Q(
|
|
265
266
|
"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",
|
|
266
|
-
|
|
267
|
+
Xe ? "text-destructive" : Qe ? "text-content-placeholder" : ""
|
|
267
268
|
),
|
|
268
|
-
...
|
|
269
|
+
...Be
|
|
269
270
|
}
|
|
270
271
|
),
|
|
271
272
|
/* @__PURE__ */ u(
|
|
@@ -274,7 +275,7 @@ const Ct = c.forwardRef(
|
|
|
274
275
|
ref: Y,
|
|
275
276
|
type: "text",
|
|
276
277
|
value: y,
|
|
277
|
-
onChange:
|
|
278
|
+
onChange: Ge,
|
|
278
279
|
onBlur: se,
|
|
279
280
|
onClick: () => !d && R(!0),
|
|
280
281
|
onKeyDown: (e) => {
|
|
@@ -282,11 +283,11 @@ const Ct = c.forwardRef(
|
|
|
282
283
|
},
|
|
283
284
|
placeholder: p ? n : $,
|
|
284
285
|
disabled: !!d,
|
|
285
|
-
"aria-label":
|
|
286
|
+
"aria-label": $e,
|
|
286
287
|
"data-field": "end",
|
|
287
288
|
className: Q(
|
|
288
289
|
"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",
|
|
289
|
-
|
|
290
|
+
Ze ? "text-destructive" : Ue ? "text-content-placeholder" : ""
|
|
290
291
|
)
|
|
291
292
|
}
|
|
292
293
|
)
|
|
@@ -303,7 +304,7 @@ const Ct = c.forwardRef(
|
|
|
303
304
|
e.stopPropagation(), ne();
|
|
304
305
|
},
|
|
305
306
|
className: "inline-flex size-4 items-center justify-center bg-transparent border-none p-0 cursor-pointer",
|
|
306
|
-
children: /* @__PURE__ */ u(
|
|
307
|
+
children: /* @__PURE__ */ u(et, { className: "size-3 hover:text-content text-content-icon" })
|
|
307
308
|
}
|
|
308
309
|
) }),
|
|
309
310
|
/* @__PURE__ */ u(pe, { variant: "tertiary", side: "top", children: T("calendar.clear") })
|
|
@@ -313,7 +314,7 @@ const Ct = c.forwardRef(
|
|
|
313
314
|
e.stopPropagation(), d || R(!p);
|
|
314
315
|
}, onKeyDown: (e) => {
|
|
315
316
|
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), e.stopPropagation(), d || (E.current = !0, R(!p)));
|
|
316
|
-
}, className: "inline-flex items-center justify-center bg-transparent border-none p-0 cursor-pointer", children: /* @__PURE__ */ u(
|
|
317
|
+
}, className: "inline-flex items-center justify-center bg-transparent border-none p-0 cursor-pointer", children: /* @__PURE__ */ u(tt, { className: "h-4 w-4 text-secondary-foreground" }) }) }),
|
|
317
318
|
/* @__PURE__ */ u(pe, { variant: "tertiary", side: "top", children: T("datePicker.selectWeekRange") })
|
|
318
319
|
] })
|
|
319
320
|
] })
|
|
@@ -321,7 +322,7 @@ const Ct = c.forwardRef(
|
|
|
321
322
|
}
|
|
322
323
|
) }),
|
|
323
324
|
/* @__PURE__ */ u(
|
|
324
|
-
|
|
325
|
+
ut,
|
|
325
326
|
{
|
|
326
327
|
ref: J,
|
|
327
328
|
className: "w-auto p-0",
|
|
@@ -330,23 +331,23 @@ const Ct = c.forwardRef(
|
|
|
330
331
|
onOpenAutoFocus: (e) => {
|
|
331
332
|
E.current || e.preventDefault(), E.current = !1;
|
|
332
333
|
},
|
|
333
|
-
...
|
|
334
|
+
...Le,
|
|
334
335
|
children: /* @__PURE__ */ u(
|
|
335
|
-
|
|
336
|
+
gt,
|
|
336
337
|
{
|
|
337
338
|
pickerType: "week",
|
|
338
339
|
weekMode: "range",
|
|
339
340
|
selectedWeeks: S(a),
|
|
340
|
-
footerFlashKey:
|
|
341
|
-
footerFlashTarget:
|
|
342
|
-
onWeekSelect:
|
|
343
|
-
month:
|
|
341
|
+
footerFlashKey: Ae,
|
|
342
|
+
footerFlashTarget: Oe,
|
|
343
|
+
onWeekSelect: Ke,
|
|
344
|
+
month: je,
|
|
344
345
|
onMonthChange: P,
|
|
345
|
-
disabled:
|
|
346
|
+
disabled: kt(ge, ke),
|
|
346
347
|
startMonth: Re,
|
|
347
348
|
endMonth: he,
|
|
348
349
|
showFooter: k,
|
|
349
|
-
...
|
|
350
|
+
...xt({
|
|
350
351
|
calendarKind: N,
|
|
351
352
|
fiscalMode: q,
|
|
352
353
|
granularity: z,
|
|
@@ -356,8 +357,9 @@ const Ct = c.forwardRef(
|
|
|
356
357
|
weekStartsOn: M,
|
|
357
358
|
showPresets: ye,
|
|
358
359
|
showPeriodBoundaries: ve,
|
|
359
|
-
|
|
360
|
-
|
|
360
|
+
autoNavigateToAvailable: xe,
|
|
361
|
+
comparison: Ce,
|
|
362
|
+
onComparisonChange: be
|
|
361
363
|
}),
|
|
362
364
|
onApply: oe,
|
|
363
365
|
onCancel: O,
|
|
@@ -373,7 +375,7 @@ const Ct = c.forwardRef(
|
|
|
373
375
|
);
|
|
374
376
|
}
|
|
375
377
|
);
|
|
376
|
-
|
|
378
|
+
bt.displayName = "WeekRangePicker";
|
|
377
379
|
export {
|
|
378
|
-
|
|
380
|
+
bt as WeekRangePicker
|
|
379
381
|
};
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { jsx as r, jsxs as y } from "react/jsx-runtime";
|
|
2
2
|
import * as t from "react";
|
|
3
|
-
import { Cross as
|
|
4
|
-
import { cn as
|
|
5
|
-
import { Input as
|
|
6
|
-
import { Calendar as
|
|
3
|
+
import { Cross as _, CalendarMonth as $ } from "impact-nova-icons";
|
|
4
|
+
import { cn as ee } from "../../../lib/utils.js";
|
|
5
|
+
import { Input as re } from "../input/input.js";
|
|
6
|
+
import { Calendar as te } from "../../data-display/calendar/calendar.js";
|
|
7
7
|
import { Tooltip as x, TooltipTrigger as R, TooltipContent as D } from "../../feedback/tooltip/tooltip.js";
|
|
8
|
-
import { useImpactNovaI18n as
|
|
9
|
-
import { buildDateBoundsMatcher as
|
|
10
|
-
import { fiscalCalendarPassThrough as
|
|
11
|
-
import { DatePickerShell as
|
|
12
|
-
import { usePickerDismissActionsRef as
|
|
13
|
-
import { formatYearInput as
|
|
14
|
-
import { viewMonthFromYear as
|
|
15
|
-
const
|
|
8
|
+
import { useImpactNovaI18n as ne } from "../../../i18n/use-impact-nova-i18n.js";
|
|
9
|
+
import { buildDateBoundsMatcher as oe } from "../../../lib/date-bounds-matcher.js";
|
|
10
|
+
import { fiscalCalendarPassThrough as ae } from "./fiscal-pass-through.js";
|
|
11
|
+
import { DatePickerShell as ie } from "./date-picker-shell.js";
|
|
12
|
+
import { usePickerDismissActionsRef as ce, usePickerFooterDismissNudge as se, handleReadonlyPickerKeyDown as le, handlePickerSurfacePointerDown as pe } from "./date-input-behavior.js";
|
|
13
|
+
import { formatYearInput as fe } from "../../data-display/calendar/calendar-fiscal-labels.js";
|
|
14
|
+
import { viewMonthFromYear as de } from "../../data-display/calendar/calendar-year-utils.js";
|
|
15
|
+
const me = t.forwardRef(
|
|
16
16
|
({
|
|
17
17
|
value: n,
|
|
18
18
|
onChange: d,
|
|
@@ -30,30 +30,34 @@ const fe = t.forwardRef(
|
|
|
30
30
|
fiscalMonthPattern: M,
|
|
31
31
|
fiscalYearStartMonth: K,
|
|
32
32
|
fiscalConfig: k,
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
const
|
|
33
|
+
weekStartsOn: j,
|
|
34
|
+
showPresets: F,
|
|
35
|
+
showPeriodBoundaries: L,
|
|
36
|
+
autoNavigateToAvailable: z,
|
|
37
|
+
showIntervalCaption: E = !1,
|
|
38
|
+
...H
|
|
39
|
+
}, V) => {
|
|
40
|
+
const { t: a } = ne(), B = Y ?? a("datePicker.selectYear"), m = t.useRef(null), P = t.useRef(null);
|
|
41
|
+
t.useImperativeHandle(V, () => m.current);
|
|
42
|
+
const [i, c] = t.useState(!1), u = t.useRef(!1), g = ce(), { footerFlashKey: q, footerFlashTarget: G, popoverHandlers: J } = se(s, i, g, P), [C, l] = t.useState(n), [Q, U] = t.useState(de(n));
|
|
41
43
|
t.useEffect(() => {
|
|
42
44
|
i || l(n);
|
|
43
45
|
}, [i, n]);
|
|
44
|
-
const p = t.useCallback(() => c(!1), []),
|
|
46
|
+
const p = t.useCallback(() => c(!1), []), W = ae({
|
|
45
47
|
calendarKind: O,
|
|
46
48
|
fiscalMode: T,
|
|
47
49
|
granularity: w,
|
|
48
50
|
fiscalMonthPattern: M,
|
|
49
51
|
fiscalYearStartMonth: K,
|
|
50
52
|
fiscalConfig: k,
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
53
|
+
weekStartsOn: j,
|
|
54
|
+
showPresets: F,
|
|
55
|
+
showPeriodBoundaries: L,
|
|
56
|
+
autoNavigateToAvailable: z
|
|
57
|
+
}), X = (e) => {
|
|
54
58
|
const f = e && !Array.isArray(e) && !("from" in e) && !("to" in e) ? e : void 0;
|
|
55
59
|
l(f), s || (d?.(f), p());
|
|
56
|
-
},
|
|
60
|
+
}, Z = () => {
|
|
57
61
|
d?.(C), p();
|
|
58
62
|
}, h = () => {
|
|
59
63
|
l(n), p();
|
|
@@ -63,7 +67,7 @@ const fe = t.forwardRef(
|
|
|
63
67
|
return t.useLayoutEffect(() => {
|
|
64
68
|
g.current = { onDismiss: h, resolveFlash: () => "cancel" };
|
|
65
69
|
}), /* @__PURE__ */ r(
|
|
66
|
-
|
|
70
|
+
ie,
|
|
67
71
|
{
|
|
68
72
|
open: i,
|
|
69
73
|
disabled: o,
|
|
@@ -74,26 +78,26 @@ const fe = t.forwardRef(
|
|
|
74
78
|
onOpenAutoFocus: (e) => {
|
|
75
79
|
u.current || e.preventDefault(), u.current = !1;
|
|
76
80
|
},
|
|
77
|
-
popoverHandlers:
|
|
81
|
+
popoverHandlers: J,
|
|
78
82
|
trigger: /* @__PURE__ */ r(
|
|
79
83
|
"div",
|
|
80
84
|
{
|
|
81
85
|
ref: P,
|
|
82
86
|
"data-component": "year-picker",
|
|
83
87
|
"data-state": i ? "open" : "closed",
|
|
84
|
-
onPointerDown: (e) =>
|
|
88
|
+
onPointerDown: (e) => pe({
|
|
85
89
|
disabled: o,
|
|
86
90
|
event: e,
|
|
87
91
|
onOpen: () => c(!0),
|
|
88
92
|
focusField: () => m.current?.focus()
|
|
89
93
|
}),
|
|
90
94
|
children: /* @__PURE__ */ r(
|
|
91
|
-
|
|
95
|
+
re,
|
|
92
96
|
{
|
|
93
97
|
ref: m,
|
|
94
|
-
value: n ?
|
|
98
|
+
value: n ? fe(n, k?.fyLabel ?? "fy-long") : "",
|
|
95
99
|
readOnly: !0,
|
|
96
|
-
onKeyDown: (e) =>
|
|
100
|
+
onKeyDown: (e) => le(e, {
|
|
97
101
|
disabled: o,
|
|
98
102
|
open: i,
|
|
99
103
|
onOpen: () => c(!0),
|
|
@@ -103,10 +107,10 @@ const fe = t.forwardRef(
|
|
|
103
107
|
}
|
|
104
108
|
}),
|
|
105
109
|
onClick: () => !o && c(!0),
|
|
106
|
-
placeholder:
|
|
110
|
+
placeholder: B,
|
|
107
111
|
disabled: o,
|
|
108
112
|
"data-form-control": "input",
|
|
109
|
-
className:
|
|
113
|
+
className: ee("cursor-pointer", I),
|
|
110
114
|
suffix: /* @__PURE__ */ y("div", { className: "flex items-center gap-1", children: [
|
|
111
115
|
n && !o ? /* @__PURE__ */ y(x, { children: [
|
|
112
116
|
/* @__PURE__ */ r(R, { asChild: !0, children: /* @__PURE__ */ r(
|
|
@@ -119,7 +123,7 @@ const fe = t.forwardRef(
|
|
|
119
123
|
e.stopPropagation(), b();
|
|
120
124
|
},
|
|
121
125
|
className: "inline-flex size-4 items-center justify-center border-none bg-transparent p-0",
|
|
122
|
-
children: /* @__PURE__ */ r(
|
|
126
|
+
children: /* @__PURE__ */ r(_, { className: "size-3 hover:text-content" })
|
|
123
127
|
}
|
|
124
128
|
) }),
|
|
125
129
|
/* @__PURE__ */ r(D, { variant: "tertiary", side: "top", children: a("calendar.clear") })
|
|
@@ -136,43 +140,43 @@ const fe = t.forwardRef(
|
|
|
136
140
|
e.stopPropagation(), o || c((f) => !f);
|
|
137
141
|
},
|
|
138
142
|
className: "inline-flex items-center justify-center border-none bg-transparent p-0",
|
|
139
|
-
children: /* @__PURE__ */ r(
|
|
143
|
+
children: /* @__PURE__ */ r($, { className: "h-4 w-4 text-secondary-foreground" })
|
|
140
144
|
}
|
|
141
145
|
) }),
|
|
142
146
|
/* @__PURE__ */ r(D, { variant: "tertiary", side: "top", children: a("datePicker.selectYear") })
|
|
143
147
|
] })
|
|
144
148
|
] }),
|
|
145
|
-
...
|
|
149
|
+
...H
|
|
146
150
|
}
|
|
147
151
|
)
|
|
148
152
|
}
|
|
149
153
|
),
|
|
150
154
|
children: /* @__PURE__ */ r(
|
|
151
|
-
|
|
155
|
+
te,
|
|
152
156
|
{
|
|
153
157
|
pickerType: "year",
|
|
154
158
|
selectedYear: C,
|
|
155
|
-
footerFlashKey:
|
|
156
|
-
footerFlashTarget:
|
|
157
|
-
onYearSelect:
|
|
158
|
-
month:
|
|
159
|
-
onMonthChange:
|
|
160
|
-
disabled:
|
|
159
|
+
footerFlashKey: q,
|
|
160
|
+
footerFlashTarget: G,
|
|
161
|
+
onYearSelect: X,
|
|
162
|
+
month: Q,
|
|
163
|
+
onMonthChange: U,
|
|
164
|
+
disabled: oe(v, N),
|
|
161
165
|
startMonth: S,
|
|
162
166
|
endMonth: A,
|
|
163
167
|
showFooter: s,
|
|
164
|
-
onApply:
|
|
168
|
+
onApply: Z,
|
|
165
169
|
onCancel: h,
|
|
166
170
|
onClear: b,
|
|
167
|
-
showIntervalCaption:
|
|
168
|
-
...
|
|
171
|
+
showIntervalCaption: E,
|
|
172
|
+
...W
|
|
169
173
|
}
|
|
170
174
|
)
|
|
171
175
|
}
|
|
172
176
|
);
|
|
173
177
|
}
|
|
174
178
|
);
|
|
175
|
-
|
|
179
|
+
me.displayName = "YearPicker";
|
|
176
180
|
export {
|
|
177
|
-
|
|
181
|
+
me as YearPicker
|
|
178
182
|
};
|