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,17 +1,17 @@
|
|
|
1
1
|
import { jsxs as d, jsx as n } from "react/jsx-runtime";
|
|
2
2
|
import * as s from "react";
|
|
3
|
-
import { Cross as
|
|
4
|
-
import { cn as
|
|
5
|
-
import { Input as
|
|
6
|
-
import { Popover as
|
|
7
|
-
import { Calendar as
|
|
3
|
+
import { Cross as Z, CalendarMonth as _ } from "impact-nova-icons";
|
|
4
|
+
import { cn as ee } from "../../../lib/utils.js";
|
|
5
|
+
import { Input as te } from "../input/input.js";
|
|
6
|
+
import { Popover as ne, PopoverAnchor as re, PopoverContent as oe } from "../../feedback/popover/popover.js";
|
|
7
|
+
import { Calendar as se } from "../../data-display/calendar/calendar.js";
|
|
8
8
|
import { Tooltip as D, TooltipTrigger as b, TooltipContent as x } from "../../feedback/tooltip/tooltip.js";
|
|
9
|
-
import { useImpactNovaI18n as
|
|
10
|
-
import { coerceMonthArrayApply as
|
|
11
|
-
import { usePickerDismissActionsRef as
|
|
12
|
-
import { buildDateBoundsMatcher as
|
|
13
|
-
import { fiscalCalendarPassThrough as
|
|
14
|
-
const
|
|
9
|
+
import { useImpactNovaI18n as ie } from "../../../i18n/use-impact-nova-i18n.js";
|
|
10
|
+
import { coerceMonthArrayApply as ce, coerceMonthArray as ae } from "./calendar-selection-adapters.js";
|
|
11
|
+
import { usePickerDismissActionsRef as le, usePickerFooterDismissNudge as pe, handlePickerSurfacePointerDown as fe } from "./date-input-behavior.js";
|
|
12
|
+
import { buildDateBoundsMatcher as de } from "../../../lib/date-bounds-matcher.js";
|
|
13
|
+
import { fiscalCalendarPassThrough as he } from "./fiscal-pass-through.js";
|
|
14
|
+
const ue = s.forwardRef(
|
|
15
15
|
({
|
|
16
16
|
value: t,
|
|
17
17
|
onChange: h,
|
|
@@ -31,27 +31,28 @@ const he = s.forwardRef(
|
|
|
31
31
|
fiscalConfig: E,
|
|
32
32
|
showPresets: F,
|
|
33
33
|
showPeriodBoundaries: K,
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
34
|
+
autoNavigateToAvailable: z,
|
|
35
|
+
comparison: L,
|
|
36
|
+
onComparisonChange: V,
|
|
37
|
+
...$
|
|
38
|
+
}, q) => {
|
|
39
|
+
const { t: i } = ie(), B = A ?? i("datePicker.selectMultipleMonths"), [c, o] = s.useState(!1), u = s.useRef(!1), m = s.useRef(null), g = le(), { footerFlashKey: H, footerFlashTarget: G, popoverHandlers: J } = pe(l, c, g, m), [p, f] = s.useState(t);
|
|
39
40
|
s.useEffect(() => {
|
|
40
41
|
f(t);
|
|
41
42
|
}, [c, t]);
|
|
42
|
-
const
|
|
43
|
-
const a =
|
|
43
|
+
const Q = (e) => {
|
|
44
|
+
const a = ae(e);
|
|
44
45
|
f(a), l || h?.(a);
|
|
45
|
-
},
|
|
46
|
-
const a =
|
|
46
|
+
}, U = (e) => {
|
|
47
|
+
const a = ce(e, p);
|
|
47
48
|
h?.(a), o(!1);
|
|
48
49
|
}, M = () => {
|
|
49
50
|
f(t), o(!1);
|
|
50
51
|
}, P = () => {
|
|
51
52
|
f(void 0), h?.(void 0), l || o(!1);
|
|
52
|
-
},
|
|
53
|
+
}, W = t && t.length > 0 ? t.length === 1 ? `${t[0].month + 1}/${t[0].year}` : i("datePicker.monthsSelected", { count: t.length }) : "", X = (e) => {
|
|
53
54
|
r || !e && l || o(e);
|
|
54
|
-
},
|
|
55
|
+
}, Y = s.useCallback(() => {
|
|
55
56
|
const e = p?.length ?? 0, a = t?.length ?? 0;
|
|
56
57
|
return e === a && (p ?? []).every(
|
|
57
58
|
(C, k) => C.month === t?.[k]?.month && C.year === t?.[k]?.year
|
|
@@ -60,31 +61,31 @@ const he = s.forwardRef(
|
|
|
60
61
|
return s.useLayoutEffect(() => {
|
|
61
62
|
g.current = {
|
|
62
63
|
onDismiss: M,
|
|
63
|
-
resolveFlash:
|
|
64
|
+
resolveFlash: Y
|
|
64
65
|
};
|
|
65
|
-
}), /* @__PURE__ */ d(
|
|
66
|
-
/* @__PURE__ */ n(
|
|
66
|
+
}), /* @__PURE__ */ d(ne, { open: r ? !1 : c, onOpenChange: X, children: [
|
|
67
|
+
/* @__PURE__ */ n(re, { asChild: !0, children: /* @__PURE__ */ n(
|
|
67
68
|
"div",
|
|
68
69
|
{
|
|
69
70
|
ref: m,
|
|
70
|
-
onPointerDown: (e) =>
|
|
71
|
+
onPointerDown: (e) => fe({
|
|
71
72
|
disabled: r,
|
|
72
73
|
event: e,
|
|
73
74
|
onOpen: () => o(!0),
|
|
74
75
|
focusField: () => m.current?.querySelector("input")?.focus()
|
|
75
76
|
}),
|
|
76
77
|
children: /* @__PURE__ */ n(
|
|
77
|
-
|
|
78
|
+
te,
|
|
78
79
|
{
|
|
79
|
-
ref:
|
|
80
|
-
value:
|
|
81
|
-
placeholder:
|
|
80
|
+
ref: q,
|
|
81
|
+
value: W,
|
|
82
|
+
placeholder: B,
|
|
82
83
|
readOnly: !0,
|
|
83
84
|
disabled: r,
|
|
84
85
|
onClick: () => {
|
|
85
86
|
!r && !c && o(!0);
|
|
86
87
|
},
|
|
87
|
-
className:
|
|
88
|
+
className: ee("cursor-pointer", S),
|
|
88
89
|
suffix: /* @__PURE__ */ d("div", { className: "flex items-center gap-1", children: [
|
|
89
90
|
t && t.length > 0 && !r && /* @__PURE__ */ d(D, { children: [
|
|
90
91
|
/* @__PURE__ */ n(b, { asChild: !0, children: /* @__PURE__ */ n(
|
|
@@ -97,7 +98,7 @@ const he = s.forwardRef(
|
|
|
97
98
|
e.stopPropagation(), P();
|
|
98
99
|
},
|
|
99
100
|
className: "inline-flex size-4 items-center justify-center bg-transparent border-none p-0 cursor-pointer",
|
|
100
|
-
children: /* @__PURE__ */ n(
|
|
101
|
+
children: /* @__PURE__ */ n(Z, { className: "size-3 hover:text-content" })
|
|
101
102
|
}
|
|
102
103
|
) }),
|
|
103
104
|
/* @__PURE__ */ n(x, { variant: "tertiary", side: "top", children: i("calendar.clear") })
|
|
@@ -117,19 +118,19 @@ const he = s.forwardRef(
|
|
|
117
118
|
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), e.stopPropagation(), r || (u.current = !0, o(!c)));
|
|
118
119
|
},
|
|
119
120
|
className: "inline-flex items-center justify-center bg-transparent border-none p-0 cursor-pointer",
|
|
120
|
-
children: /* @__PURE__ */ n(
|
|
121
|
+
children: /* @__PURE__ */ n(_, { className: "h-4 w-4 text-secondary-foreground" })
|
|
121
122
|
}
|
|
122
123
|
) }),
|
|
123
124
|
/* @__PURE__ */ n(x, { variant: "tertiary", side: "top", children: i("datePicker.selectMultipleMonths") })
|
|
124
125
|
] })
|
|
125
126
|
] }),
|
|
126
|
-
|
|
127
|
+
...$
|
|
127
128
|
}
|
|
128
129
|
)
|
|
129
130
|
}
|
|
130
131
|
) }),
|
|
131
132
|
/* @__PURE__ */ n(
|
|
132
|
-
|
|
133
|
+
oe,
|
|
133
134
|
{
|
|
134
135
|
className: "w-auto p-0",
|
|
135
136
|
align: "start",
|
|
@@ -137,26 +138,26 @@ const he = s.forwardRef(
|
|
|
137
138
|
onOpenAutoFocus: (e) => {
|
|
138
139
|
u.current || e.preventDefault(), u.current = !1;
|
|
139
140
|
},
|
|
140
|
-
...
|
|
141
|
+
...J,
|
|
141
142
|
children: /* @__PURE__ */ n(
|
|
142
|
-
|
|
143
|
+
se,
|
|
143
144
|
{
|
|
144
145
|
pickerType: "month",
|
|
145
146
|
monthMode: "multiple",
|
|
146
147
|
selectedMonths: p,
|
|
147
|
-
footerFlashKey:
|
|
148
|
-
footerFlashTarget:
|
|
149
|
-
onMonthSelect:
|
|
150
|
-
disabled:
|
|
148
|
+
footerFlashKey: H,
|
|
149
|
+
footerFlashTarget: G,
|
|
150
|
+
onMonthSelect: Q,
|
|
151
|
+
disabled: de(y, N),
|
|
151
152
|
startMonth: R,
|
|
152
153
|
endMonth: T,
|
|
153
154
|
defaultMonth: y,
|
|
154
155
|
showFooter: l,
|
|
155
|
-
onApply:
|
|
156
|
+
onApply: U,
|
|
156
157
|
onCancel: M,
|
|
157
158
|
onClear: P,
|
|
158
159
|
captionLayout: "dropdown",
|
|
159
|
-
...
|
|
160
|
+
...he({
|
|
160
161
|
calendarKind: I,
|
|
161
162
|
fiscalMode: O,
|
|
162
163
|
granularity: j,
|
|
@@ -165,8 +166,9 @@ const he = s.forwardRef(
|
|
|
165
166
|
fiscalConfig: E,
|
|
166
167
|
showPresets: F,
|
|
167
168
|
showPeriodBoundaries: K,
|
|
168
|
-
|
|
169
|
-
|
|
169
|
+
autoNavigateToAvailable: z,
|
|
170
|
+
comparison: L,
|
|
171
|
+
onComparisonChange: V
|
|
170
172
|
})
|
|
171
173
|
}
|
|
172
174
|
)
|
|
@@ -175,7 +177,7 @@ const he = s.forwardRef(
|
|
|
175
177
|
] });
|
|
176
178
|
}
|
|
177
179
|
);
|
|
178
|
-
|
|
180
|
+
ue.displayName = "MultiMonthPicker";
|
|
179
181
|
export {
|
|
180
|
-
|
|
182
|
+
ue as MultiMonthPicker
|
|
181
183
|
};
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { jsx as r, jsxs as g } from "react/jsx-runtime";
|
|
2
2
|
import * as n from "react";
|
|
3
|
-
import { Cross as
|
|
4
|
-
import { cn as
|
|
5
|
-
import { Input as
|
|
6
|
-
import { Calendar as
|
|
3
|
+
import { Cross as Z, CalendarMonth as _ } from "impact-nova-icons";
|
|
4
|
+
import { cn as $ } from "../../../lib/utils.js";
|
|
5
|
+
import { Input as ee } from "../input/input.js";
|
|
6
|
+
import { Calendar as te } from "../../data-display/calendar/calendar.js";
|
|
7
7
|
import { Tooltip as M, TooltipTrigger as x, TooltipContent as b } 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 { formatQuarterInput as
|
|
14
|
-
import { viewMonthFromQuarter as
|
|
15
|
-
const
|
|
8
|
+
import { useImpactNovaI18n as re } from "../../../i18n/use-impact-nova-i18n.js";
|
|
9
|
+
import { buildDateBoundsMatcher as ne } from "../../../lib/date-bounds-matcher.js";
|
|
10
|
+
import { fiscalCalendarPassThrough as oe } from "./fiscal-pass-through.js";
|
|
11
|
+
import { DatePickerShell as ae } from "./date-picker-shell.js";
|
|
12
|
+
import { usePickerDismissActionsRef as ie, usePickerFooterDismissNudge as ce, handleReadonlyPickerKeyDown as se, handlePickerSurfacePointerDown as le } from "./date-input-behavior.js";
|
|
13
|
+
import { formatQuarterInput as pe } from "../../data-display/calendar/calendar-fiscal-labels.js";
|
|
14
|
+
import { viewMonthFromQuarter as ue } from "../../data-display/calendar/calendar-quarter-utils.js";
|
|
15
|
+
const fe = n.forwardRef(
|
|
16
16
|
({
|
|
17
17
|
value: t,
|
|
18
18
|
onChange: u,
|
|
@@ -32,15 +32,16 @@ const ue = n.forwardRef(
|
|
|
32
32
|
fiscalConfig: K,
|
|
33
33
|
showPresets: j,
|
|
34
34
|
showPeriodBoundaries: F,
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
35
|
+
autoNavigateToAvailable: z,
|
|
36
|
+
...E
|
|
37
|
+
}, H) => {
|
|
38
|
+
const { t: a } = re(), L = R ?? a("datePicker.selectMultipleQuarters"), f = n.useRef(null), y = n.useRef(null);
|
|
39
|
+
n.useImperativeHandle(H, () => f.current);
|
|
40
|
+
const [i, c] = n.useState(!1), d = n.useRef(!1), k = ie(), { footerFlashKey: V, footerFlashTarget: q, popoverHandlers: B } = ce(s, i, k, y), [P, l] = n.useState(t), [G, J] = n.useState(ue(t?.[0]));
|
|
40
41
|
n.useEffect(() => {
|
|
41
42
|
i || l(t);
|
|
42
43
|
}, [i, t]);
|
|
43
|
-
const m = n.useCallback(() => c(!1), []),
|
|
44
|
+
const m = n.useCallback(() => c(!1), []), U = oe({
|
|
44
45
|
calendarKind: I,
|
|
45
46
|
fiscalMode: O,
|
|
46
47
|
granularity: T,
|
|
@@ -48,11 +49,12 @@ const ue = n.forwardRef(
|
|
|
48
49
|
fiscalYearStartMonth: v,
|
|
49
50
|
fiscalConfig: K,
|
|
50
51
|
showPresets: j,
|
|
51
|
-
showPeriodBoundaries: F
|
|
52
|
-
|
|
52
|
+
showPeriodBoundaries: F,
|
|
53
|
+
autoNavigateToAvailable: z
|
|
54
|
+
}), W = (e) => {
|
|
53
55
|
const p = Array.isArray(e) && e.length > 0 ? e : void 0;
|
|
54
56
|
l(p), s || u?.(p);
|
|
55
|
-
},
|
|
57
|
+
}, X = () => {
|
|
56
58
|
u?.(P), m();
|
|
57
59
|
}, h = () => {
|
|
58
60
|
l(t), m();
|
|
@@ -62,9 +64,9 @@ const ue = n.forwardRef(
|
|
|
62
64
|
n.useLayoutEffect(() => {
|
|
63
65
|
k.current = { onDismiss: h, resolveFlash: () => "cancel" };
|
|
64
66
|
});
|
|
65
|
-
const
|
|
67
|
+
const Y = t && t.length > 0 ? t.length === 1 ? pe(t[0]) : a("datePicker.quartersSelected", { count: t.length }) : "";
|
|
66
68
|
return /* @__PURE__ */ r(
|
|
67
|
-
|
|
69
|
+
ae,
|
|
68
70
|
{
|
|
69
71
|
open: i,
|
|
70
72
|
disabled: o,
|
|
@@ -75,26 +77,26 @@ const ue = n.forwardRef(
|
|
|
75
77
|
onOpenAutoFocus: (e) => {
|
|
76
78
|
d.current || e.preventDefault(), d.current = !1;
|
|
77
79
|
},
|
|
78
|
-
popoverHandlers:
|
|
80
|
+
popoverHandlers: B,
|
|
79
81
|
trigger: /* @__PURE__ */ r(
|
|
80
82
|
"div",
|
|
81
83
|
{
|
|
82
84
|
ref: y,
|
|
83
85
|
"data-component": "multi-quarter-picker",
|
|
84
86
|
"data-state": i ? "open" : "closed",
|
|
85
|
-
onPointerDown: (e) =>
|
|
87
|
+
onPointerDown: (e) => le({
|
|
86
88
|
disabled: o,
|
|
87
89
|
event: e,
|
|
88
90
|
onOpen: () => c(!0),
|
|
89
91
|
focusField: () => f.current?.focus()
|
|
90
92
|
}),
|
|
91
93
|
children: /* @__PURE__ */ r(
|
|
92
|
-
|
|
94
|
+
ee,
|
|
93
95
|
{
|
|
94
96
|
ref: f,
|
|
95
|
-
value:
|
|
97
|
+
value: Y,
|
|
96
98
|
readOnly: !0,
|
|
97
|
-
onKeyDown: (e) =>
|
|
99
|
+
onKeyDown: (e) => se(e, {
|
|
98
100
|
disabled: o,
|
|
99
101
|
open: i,
|
|
100
102
|
onOpen: () => c(!0),
|
|
@@ -104,10 +106,10 @@ const ue = n.forwardRef(
|
|
|
104
106
|
}
|
|
105
107
|
}),
|
|
106
108
|
onClick: () => !o && c(!0),
|
|
107
|
-
placeholder:
|
|
109
|
+
placeholder: L,
|
|
108
110
|
disabled: o,
|
|
109
111
|
"data-form-control": "input",
|
|
110
|
-
className:
|
|
112
|
+
className: $("cursor-pointer", A),
|
|
111
113
|
suffix: /* @__PURE__ */ g("div", { className: "flex items-center gap-1", children: [
|
|
112
114
|
t && t.length > 0 && !o ? /* @__PURE__ */ g(M, { children: [
|
|
113
115
|
/* @__PURE__ */ r(x, { asChild: !0, children: /* @__PURE__ */ r(
|
|
@@ -120,7 +122,7 @@ const ue = n.forwardRef(
|
|
|
120
122
|
e.stopPropagation(), C();
|
|
121
123
|
},
|
|
122
124
|
className: "inline-flex size-4 items-center justify-center border-none bg-transparent p-0",
|
|
123
|
-
children: /* @__PURE__ */ r(
|
|
125
|
+
children: /* @__PURE__ */ r(Z, { className: "size-3 hover:text-content" })
|
|
124
126
|
}
|
|
125
127
|
) }),
|
|
126
128
|
/* @__PURE__ */ r(b, { variant: "tertiary", side: "top", children: a("calendar.clear") })
|
|
@@ -137,43 +139,43 @@ const ue = n.forwardRef(
|
|
|
137
139
|
e.stopPropagation(), o || c((p) => !p);
|
|
138
140
|
},
|
|
139
141
|
className: "inline-flex items-center justify-center border-none bg-transparent p-0",
|
|
140
|
-
children: /* @__PURE__ */ r(
|
|
142
|
+
children: /* @__PURE__ */ r(_, { className: "h-4 w-4 text-secondary-foreground" })
|
|
141
143
|
}
|
|
142
144
|
) }),
|
|
143
145
|
/* @__PURE__ */ r(b, { variant: "tertiary", side: "top", children: a("datePicker.selectMultipleQuarters") })
|
|
144
146
|
] })
|
|
145
147
|
] }),
|
|
146
|
-
...
|
|
148
|
+
...E
|
|
147
149
|
}
|
|
148
150
|
)
|
|
149
151
|
}
|
|
150
152
|
),
|
|
151
153
|
children: /* @__PURE__ */ r(
|
|
152
|
-
|
|
154
|
+
te,
|
|
153
155
|
{
|
|
154
156
|
pickerType: "quarter",
|
|
155
157
|
monthMode: "multiple",
|
|
156
158
|
selectedQuarters: P,
|
|
157
|
-
footerFlashKey:
|
|
158
|
-
footerFlashTarget:
|
|
159
|
-
onQuarterSelect:
|
|
160
|
-
month:
|
|
161
|
-
onMonthChange:
|
|
162
|
-
disabled:
|
|
159
|
+
footerFlashKey: V,
|
|
160
|
+
footerFlashTarget: q,
|
|
161
|
+
onQuarterSelect: W,
|
|
162
|
+
month: G,
|
|
163
|
+
onMonthChange: J,
|
|
164
|
+
disabled: ne(D, Q),
|
|
163
165
|
startMonth: N,
|
|
164
166
|
endMonth: S,
|
|
165
167
|
showFooter: s,
|
|
166
|
-
onApply:
|
|
168
|
+
onApply: X,
|
|
167
169
|
onCancel: h,
|
|
168
170
|
onClear: C,
|
|
169
|
-
...
|
|
171
|
+
...U
|
|
170
172
|
}
|
|
171
173
|
)
|
|
172
174
|
}
|
|
173
175
|
);
|
|
174
176
|
}
|
|
175
177
|
);
|
|
176
|
-
|
|
178
|
+
fe.displayName = "MultiQuarterPicker";
|
|
177
179
|
export {
|
|
178
|
-
|
|
180
|
+
fe as MultiQuarterPicker
|
|
179
181
|
};
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import { jsxs as u, jsx as r } from "react/jsx-runtime";
|
|
2
2
|
import * as n from "react";
|
|
3
|
-
import { Cross as
|
|
3
|
+
import { Cross as ne, CalendarMonth as oe } from "impact-nova-icons";
|
|
4
4
|
import { format as b } from "date-fns";
|
|
5
|
-
import { cn as
|
|
6
|
-
import { Input as
|
|
7
|
-
import { Popover as
|
|
8
|
-
import { Calendar as
|
|
5
|
+
import { cn as se } from "../../../lib/utils.js";
|
|
6
|
+
import { Input as ae } from "../input/input.js";
|
|
7
|
+
import { Popover as ie, PopoverAnchor as ce, PopoverContent as le } from "../../feedback/popover/popover.js";
|
|
8
|
+
import { Calendar as pe } from "../../data-display/calendar/calendar.js";
|
|
9
9
|
import { Tooltip as x, TooltipTrigger as A, TooltipContent as M } from "../../feedback/tooltip/tooltip.js";
|
|
10
|
-
import { useImpactNovaI18n as
|
|
11
|
-
import { getDateFnsLocale as
|
|
12
|
-
import { coerceWeekArrayApply as
|
|
13
|
-
import { usePickerDismissActionsRef as
|
|
14
|
-
import { buildDateBoundsMatcher as
|
|
15
|
-
import { fiscalCalendarPassThrough as
|
|
16
|
-
const
|
|
10
|
+
import { useImpactNovaI18n as de } from "../../../i18n/use-impact-nova-i18n.js";
|
|
11
|
+
import { getDateFnsLocale as fe } from "../../../i18n/getDateFnsLocale.js";
|
|
12
|
+
import { coerceWeekArrayApply as me, coerceWeekArray as ue } from "./calendar-selection-adapters.js";
|
|
13
|
+
import { usePickerDismissActionsRef as he, usePickerFooterDismissNudge as ye, handlePickerSurfacePointerDown as ke } from "./date-input-behavior.js";
|
|
14
|
+
import { buildDateBoundsMatcher as ge } from "../../../lib/date-bounds-matcher.js";
|
|
15
|
+
import { fiscalCalendarPassThrough as Pe } from "./fiscal-pass-through.js";
|
|
16
|
+
const Ce = (t, a = "MM/dd/yyyy", i) => {
|
|
17
17
|
const h = b(t.startDate, a, i ? { locale: i } : {}), y = b(t.endDate, a, i ? { locale: i } : {});
|
|
18
18
|
return `${h} - ${y}`;
|
|
19
|
-
},
|
|
19
|
+
}, De = n.forwardRef(
|
|
20
20
|
({
|
|
21
21
|
value: t,
|
|
22
22
|
onChange: a,
|
|
@@ -36,62 +36,63 @@ const Pe = (t, a = "MM/dd/yyyy", i) => {
|
|
|
36
36
|
weekStartsOn: j = 1,
|
|
37
37
|
showPresets: F,
|
|
38
38
|
showPeriodBoundaries: E,
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
autoNavigateToAvailable: K,
|
|
40
|
+
comparison: $,
|
|
41
|
+
onComparisonChange: z,
|
|
41
42
|
disabled: o,
|
|
42
|
-
className:
|
|
43
|
-
...
|
|
44
|
-
},
|
|
45
|
-
const { locale: P, t: c } =
|
|
43
|
+
className: V,
|
|
44
|
+
...q
|
|
45
|
+
}, B) => {
|
|
46
|
+
const { locale: P, t: c } = de(), H = n.useMemo(() => fe(P), [P]), G = h ?? c("datePicker.selectWeeks"), [l, s] = n.useState(!1), k = n.useRef(!1), g = n.useRef(null), C = he(), { footerFlashKey: J, footerFlashTarget: Q, popoverHandlers: U } = ye(d, l, C, g), [f, m] = n.useState(t);
|
|
46
47
|
n.useEffect(() => {
|
|
47
48
|
m(t);
|
|
48
49
|
}, [l, t]);
|
|
49
|
-
const
|
|
50
|
-
const p =
|
|
50
|
+
const X = (e) => {
|
|
51
|
+
const p = ue(e);
|
|
51
52
|
m(p), d || a?.(p);
|
|
52
|
-
},
|
|
53
|
-
const p =
|
|
53
|
+
}, Y = (e) => {
|
|
54
|
+
const p = me(e, f);
|
|
54
55
|
a?.(p), s(!1);
|
|
55
56
|
}, D = () => {
|
|
56
57
|
m(t), s(!1);
|
|
57
58
|
}, W = () => {
|
|
58
59
|
m(void 0), a?.(void 0), d || s(!1);
|
|
59
|
-
},
|
|
60
|
+
}, Z = t && t.length > 0 ? t.length === 1 ? Ce(t[0], i, H) : `${t.length} weeks selected` : "", _ = (e) => {
|
|
60
61
|
o || !e && d || s(e);
|
|
61
|
-
},
|
|
62
|
+
}, ee = n.useCallback(() => {
|
|
62
63
|
const e = f?.length ?? 0, p = t?.length ?? 0;
|
|
63
64
|
return e === p && (f ?? []).every(
|
|
64
|
-
(
|
|
65
|
+
(te, re) => te.startDate.getTime() === t?.[re]?.startDate.getTime()
|
|
65
66
|
) ? "dismiss" : e > 0 ? "apply" : "cancel";
|
|
66
67
|
}, [f, t]);
|
|
67
68
|
return n.useLayoutEffect(() => {
|
|
68
69
|
C.current = {
|
|
69
70
|
onDismiss: D,
|
|
70
|
-
resolveFlash:
|
|
71
|
+
resolveFlash: ee
|
|
71
72
|
};
|
|
72
|
-
}), /* @__PURE__ */ u(
|
|
73
|
-
/* @__PURE__ */ r(
|
|
73
|
+
}), /* @__PURE__ */ u(ie, { open: o ? !1 : l, onOpenChange: _, children: [
|
|
74
|
+
/* @__PURE__ */ r(ce, { asChild: !0, children: /* @__PURE__ */ r(
|
|
74
75
|
"div",
|
|
75
76
|
{
|
|
76
77
|
ref: g,
|
|
77
|
-
onPointerDown: (e) =>
|
|
78
|
+
onPointerDown: (e) => ke({
|
|
78
79
|
disabled: o,
|
|
79
80
|
event: e,
|
|
80
81
|
onOpen: () => s(!0),
|
|
81
82
|
focusField: () => g.current?.querySelector("input")?.focus()
|
|
82
83
|
}),
|
|
83
84
|
children: /* @__PURE__ */ r(
|
|
84
|
-
|
|
85
|
+
ae,
|
|
85
86
|
{
|
|
86
|
-
ref:
|
|
87
|
-
value:
|
|
88
|
-
placeholder:
|
|
87
|
+
ref: B,
|
|
88
|
+
value: Z,
|
|
89
|
+
placeholder: G,
|
|
89
90
|
readOnly: !0,
|
|
90
91
|
disabled: o,
|
|
91
92
|
onClick: () => {
|
|
92
93
|
!o && !l && s(!0);
|
|
93
94
|
},
|
|
94
|
-
className:
|
|
95
|
+
className: se("cursor-pointer", V),
|
|
95
96
|
suffix: /* @__PURE__ */ u("div", { className: "flex items-center gap-1", children: [
|
|
96
97
|
t && t.length > 0 && !o && /* @__PURE__ */ u(x, { children: [
|
|
97
98
|
/* @__PURE__ */ r(A, { asChild: !0, children: /* @__PURE__ */ r(
|
|
@@ -104,7 +105,7 @@ const Pe = (t, a = "MM/dd/yyyy", i) => {
|
|
|
104
105
|
e.stopPropagation(), W();
|
|
105
106
|
},
|
|
106
107
|
className: "inline-flex size-4 items-center justify-center bg-transparent border-none p-0 cursor-pointer",
|
|
107
|
-
children: /* @__PURE__ */ r(
|
|
108
|
+
children: /* @__PURE__ */ r(ne, { className: "size-3 hover:text-content" })
|
|
108
109
|
}
|
|
109
110
|
) }),
|
|
110
111
|
/* @__PURE__ */ r(M, { variant: "tertiary", side: "top", children: c("calendar.clear") })
|
|
@@ -124,19 +125,19 @@ const Pe = (t, a = "MM/dd/yyyy", i) => {
|
|
|
124
125
|
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), e.stopPropagation(), o || (k.current = !0, s(!l)));
|
|
125
126
|
},
|
|
126
127
|
className: "inline-flex items-center justify-center bg-transparent border-none p-0 cursor-pointer",
|
|
127
|
-
children: /* @__PURE__ */ r(
|
|
128
|
+
children: /* @__PURE__ */ r(oe, { className: "h-4 w-4 text-secondary-foreground" })
|
|
128
129
|
}
|
|
129
130
|
) }),
|
|
130
131
|
/* @__PURE__ */ r(M, { variant: "tertiary", side: "top", children: c("datePicker.selectWeeks") })
|
|
131
132
|
] })
|
|
132
133
|
] }),
|
|
133
|
-
...
|
|
134
|
+
...q
|
|
134
135
|
}
|
|
135
136
|
)
|
|
136
137
|
}
|
|
137
138
|
) }),
|
|
138
139
|
/* @__PURE__ */ r(
|
|
139
|
-
|
|
140
|
+
le,
|
|
140
141
|
{
|
|
141
142
|
className: "w-auto p-0",
|
|
142
143
|
align: "start",
|
|
@@ -144,21 +145,21 @@ const Pe = (t, a = "MM/dd/yyyy", i) => {
|
|
|
144
145
|
onOpenAutoFocus: (e) => {
|
|
145
146
|
k.current || e.preventDefault(), k.current = !1;
|
|
146
147
|
},
|
|
147
|
-
...
|
|
148
|
+
...U,
|
|
148
149
|
children: /* @__PURE__ */ r(
|
|
149
|
-
|
|
150
|
+
pe,
|
|
150
151
|
{
|
|
151
152
|
pickerType: "week",
|
|
152
153
|
weekMode: "multiple",
|
|
153
154
|
selectedWeeks: f,
|
|
154
|
-
footerFlashKey:
|
|
155
|
-
footerFlashTarget:
|
|
156
|
-
onWeekSelect:
|
|
157
|
-
disabled:
|
|
155
|
+
footerFlashKey: J,
|
|
156
|
+
footerFlashTarget: Q,
|
|
157
|
+
onWeekSelect: X,
|
|
158
|
+
disabled: ge(y, N),
|
|
158
159
|
startMonth: T,
|
|
159
160
|
endMonth: R,
|
|
160
161
|
showFooter: d,
|
|
161
|
-
...
|
|
162
|
+
...Pe({
|
|
162
163
|
calendarKind: S,
|
|
163
164
|
fiscalMode: v,
|
|
164
165
|
granularity: w,
|
|
@@ -168,10 +169,11 @@ const Pe = (t, a = "MM/dd/yyyy", i) => {
|
|
|
168
169
|
weekStartsOn: j,
|
|
169
170
|
showPresets: F,
|
|
170
171
|
showPeriodBoundaries: E,
|
|
171
|
-
|
|
172
|
-
|
|
172
|
+
autoNavigateToAvailable: K,
|
|
173
|
+
comparison: $,
|
|
174
|
+
onComparisonChange: z
|
|
173
175
|
}),
|
|
174
|
-
onApply:
|
|
176
|
+
onApply: Y,
|
|
175
177
|
onCancel: D,
|
|
176
178
|
onClear: W,
|
|
177
179
|
captionLayout: "dropdown"
|
|
@@ -182,7 +184,7 @@ const Pe = (t, a = "MM/dd/yyyy", i) => {
|
|
|
182
184
|
] });
|
|
183
185
|
}
|
|
184
186
|
);
|
|
185
|
-
|
|
187
|
+
De.displayName = "MultiWeekPicker";
|
|
186
188
|
export {
|
|
187
|
-
|
|
189
|
+
De as MultiWeekPicker
|
|
188
190
|
};
|