impact-nova 2.5.7 → 2.5.9
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/ag-grid-react/ag-grid.types.d.ts +2 -2
- package/dist/components/data/ag-grid-react/headers/components/date-filter-picker.d.ts +4 -2
- package/dist/components/data/ag-grid-react/headers/header-search-input.js +65 -65
- package/dist/components/data/ag-grid-react/headers/utils/date-utils.js +55 -48
- package/dist/components/data-display/calendar/calendar-apply-validation.d.ts +4 -2
- package/dist/components/data-display/calendar/calendar-apply-validation.js +80 -61
- package/dist/components/data-display/calendar/calendar-config.d.ts +13 -5
- package/dist/components/data-display/calendar/calendar-config.js +31 -20
- package/dist/components/data-display/calendar/calendar-day-button.js +43 -35
- package/dist/components/data-display/calendar/calendar-day-hover.d.ts +8 -0
- package/dist/components/data-display/calendar/calendar-day-hover.js +20 -0
- package/dist/components/data-display/calendar/calendar-day-picker-classnames.d.ts +8 -1
- package/dist/components/data-display/calendar/calendar-day-picker-classnames.js +40 -20
- package/dist/components/data-display/calendar/calendar-day-picker-components.d.ts +12 -1
- package/dist/components/data-display/calendar/calendar-day-picker-components.js +196 -102
- package/dist/components/data-display/calendar/calendar-day-picker-view.d.ts +11 -3
- package/dist/components/data-display/calendar/calendar-day-picker-view.js +136 -92
- package/dist/components/data-display/calendar/calendar-fiscal-labels.d.ts +38 -0
- package/dist/components/data-display/calendar/calendar-fiscal-labels.js +90 -0
- package/dist/components/data-display/calendar/calendar-fiscal-period-nav.d.ts +16 -0
- package/dist/components/data-display/calendar/calendar-fiscal-period-nav.js +41 -0
- package/dist/components/data-display/calendar/calendar-footer-summary.d.ts +13 -4
- package/dist/components/data-display/calendar/calendar-footer-summary.js +101 -50
- package/dist/components/data-display/calendar/calendar-footer.d.ts +16 -7
- package/dist/components/data-display/calendar/calendar-footer.js +88 -66
- package/dist/components/data-display/calendar/calendar-gregorian-presets.d.ts +2 -0
- package/dist/components/data-display/calendar/calendar-gregorian-presets.js +26 -0
- package/dist/components/data-display/calendar/calendar-interval-caption.d.ts +1 -0
- package/dist/components/data-display/calendar/calendar-interval-caption.js +10 -0
- package/dist/components/data-display/calendar/calendar-interval-utils.d.ts +23 -0
- package/dist/components/data-display/calendar/calendar-interval-utils.js +154 -0
- package/dist/components/data-display/calendar/calendar-month-panes.d.ts +5 -1
- package/dist/components/data-display/calendar/calendar-month-panes.js +9 -7
- package/dist/components/data-display/calendar/calendar-month-picker-panel.d.ts +5 -1
- package/dist/components/data-display/calendar/calendar-month-picker-panel.js +76 -77
- package/dist/components/data-display/calendar/calendar-month-utils.d.ts +2 -0
- package/dist/components/data-display/calendar/calendar-month-utils.js +69 -60
- package/dist/components/data-display/calendar/calendar-padding-week.utils.d.ts +15 -0
- package/dist/components/data-display/calendar/calendar-padding-week.utils.js +22 -3
- package/dist/components/data-display/calendar/calendar-panel-context.d.ts +1 -1
- package/dist/components/data-display/calendar/calendar-period-cell.d.ts +18 -0
- package/dist/components/data-display/calendar/calendar-period-cell.js +89 -0
- package/dist/components/data-display/calendar/calendar-period-keyboard.d.ts +2 -0
- package/dist/components/data-display/calendar/calendar-period-keyboard.js +18 -0
- package/dist/components/data-display/calendar/calendar-preset-strip.d.ts +6 -0
- package/dist/components/data-display/calendar/calendar-preset-strip.js +26 -0
- package/dist/components/data-display/calendar/calendar-quarter-panes.d.ts +24 -0
- package/dist/components/data-display/calendar/calendar-quarter-panes.js +115 -0
- package/dist/components/data-display/calendar/calendar-quarter-utils.d.ts +19 -0
- package/dist/components/data-display/calendar/calendar-quarter-utils.js +95 -0
- package/dist/components/data-display/calendar/calendar-selection-appearance.d.ts +38 -0
- package/dist/components/data-display/calendar/calendar-selection-appearance.js +72 -0
- package/dist/components/data-display/calendar/calendar-selection.d.ts +20 -0
- package/dist/components/data-display/calendar/calendar-selection.js +31 -0
- package/dist/components/data-display/calendar/calendar-week-number-cell.d.ts +6 -1
- package/dist/components/data-display/calendar/calendar-week-number-cell.js +53 -38
- package/dist/components/data-display/calendar/calendar-week-number-header.d.ts +4 -0
- package/dist/components/data-display/calendar/calendar-week-number-header.js +15 -0
- package/dist/components/data-display/calendar/calendar-week-utils.d.ts +11 -3
- package/dist/components/data-display/calendar/calendar-week-utils.js +49 -42
- package/dist/components/data-display/calendar/calendar-year-panes.d.ts +18 -0
- package/dist/components/data-display/calendar/calendar-year-panes.js +98 -0
- package/dist/components/data-display/calendar/calendar-year-utils.d.ts +17 -0
- package/dist/components/data-display/calendar/calendar-year-utils.js +75 -0
- package/dist/components/data-display/calendar/calendar.d.ts +1 -1
- package/dist/components/data-display/calendar/calendar.js +303 -181
- package/dist/components/data-display/calendar/calendar.types.d.ts +53 -16
- package/dist/components/data-display/calendar/fiscal-period-caption-select.d.ts +7 -0
- package/dist/components/data-display/calendar/fiscal-period-caption-select.js +63 -0
- package/dist/components/data-display/calendar/index.d.ts +1 -1
- package/dist/components/data-display/calendar/use-calendar-day-picker-config.d.ts +12 -2
- package/dist/components/data-display/calendar/use-calendar-day-picker-config.js +92 -62
- package/dist/components/data-display/calendar/use-calendar-state.d.ts +31 -11
- package/dist/components/data-display/calendar/use-calendar-state.js +370 -163
- package/dist/components/data-display/calendar/use-fiscal-calendar.d.ts +5 -0
- package/dist/components/data-display/calendar/use-fiscal-calendar.js +25 -0
- package/dist/components/feedback/tooltip/overflow-tooltip.js +57 -57
- package/dist/components/forms/date-picker/date-input-behavior.d.ts +7 -0
- package/dist/components/forms/date-picker/date-input-behavior.js +28 -24
- package/dist/components/forms/date-picker/date-picker-shell.d.ts +13 -0
- package/dist/components/forms/date-picker/date-picker-shell.js +31 -0
- package/dist/components/forms/date-picker/date-picker.js +187 -167
- package/dist/components/forms/date-picker/date-picker.types.d.ts +90 -43
- package/dist/components/forms/date-picker/date-range-picker.js +273 -224
- package/dist/components/forms/date-picker/fiscal-pass-through.d.ts +13 -0
- package/dist/components/forms/date-picker/fiscal-pass-through.js +17 -0
- package/dist/components/forms/date-picker/fiscal-period-format.d.ts +9 -0
- package/dist/components/forms/date-picker/fiscal-period-format.js +50 -0
- package/dist/components/forms/date-picker/index.d.ts +12 -0
- package/dist/components/forms/date-picker/index.js +19 -7
- package/dist/components/forms/date-picker/month-picker.js +225 -182
- package/dist/components/forms/date-picker/month-range-picker.js +134 -110
- package/dist/components/forms/date-picker/multi-date-picker.js +77 -56
- package/dist/components/forms/date-picker/multi-month-picker.js +78 -57
- package/dist/components/forms/date-picker/multi-quarter-picker.d.ts +3 -0
- package/dist/components/forms/date-picker/multi-quarter-picker.js +177 -0
- package/dist/components/forms/date-picker/multi-week-picker.js +81 -70
- package/dist/components/forms/date-picker/multi-year-picker.d.ts +3 -0
- package/dist/components/forms/date-picker/multi-year-picker.js +179 -0
- package/dist/components/forms/date-picker/quarter-picker.d.ts +3 -0
- package/dist/components/forms/date-picker/quarter-picker.js +176 -0
- package/dist/components/forms/date-picker/quarter-range-picker.d.ts +3 -0
- package/dist/components/forms/date-picker/quarter-range-picker.js +177 -0
- package/dist/components/forms/date-picker/week-picker.js +148 -137
- package/dist/components/forms/date-picker/week-range-picker.js +216 -205
- package/dist/components/forms/date-picker/year-picker.d.ts +3 -0
- package/dist/components/forms/date-picker/year-picker.js +176 -0
- package/dist/components/forms/date-picker/year-range-picker.d.ts +3 -0
- package/dist/components/forms/date-picker/year-range-picker.js +179 -0
- package/dist/components/forms/smart-input/smart-input.js +106 -85
- package/dist/components/forms/smart-input/smart-input.types.d.ts +5 -0
- package/dist/components/forms/textarea/textarea.js +29 -28
- package/dist/components/forms/textarea/textarea.types.d.ts +1 -0
- package/dist/form-react/Fields/DateInputField.js +63 -58
- package/dist/form-react/Fields/DateRangeField.js +42 -37
- package/dist/form-react/Fields/MonthRangeField.js +50 -45
- package/dist/form-react/Fields/MultiWeekPickerField.js +7 -7
- package/dist/form-react/Fields/TextField.js +25 -24
- package/dist/form-react/Fields/WeekRangePicker.js +44 -45
- package/dist/form-react/components/FieldRenderer.js +21 -23
- package/dist/form-react/registry/defaultFieldRegistrations.d.ts +9 -1
- package/dist/form-react/registry/defaultFieldRegistrations.js +27 -36
- package/dist/form-react/registry/resolveFieldComponent.d.ts +3 -2
- package/dist/form-react/registry/resolveFieldComponent.js +9 -133
- package/dist/form-react/types/fields.types.d.ts +25 -4
- package/dist/form-react/utils/date.utils.d.ts +1 -1
- package/dist/form-react/utils/date.utils.js +38 -38
- package/dist/i18n/defaultMessages.d.ts +19 -1
- package/dist/i18n/defaultMessages.js +37 -20
- package/dist/i18n/locales/de.js +18 -1
- package/dist/i18n/locales/es.js +18 -1
- package/dist/i18n/locales/hi.js +18 -1
- package/dist/i18n/locales/kn.js +18 -1
- package/dist/impact-nova-components.css +379 -3
- package/dist/impact-nova.css +1 -1
- package/dist/index.js +528 -516
- package/dist/lib/fiscal-calendar/build-year.d.ts +8 -0
- package/dist/lib/fiscal-calendar/build-year.js +173 -0
- package/dist/lib/fiscal-calendar/civil-date.d.ts +21 -0
- package/dist/lib/fiscal-calendar/civil-date.js +94 -0
- package/dist/lib/fiscal-calendar/index.d.ts +10 -0
- package/dist/lib/fiscal-calendar/index.js +40 -0
- package/dist/lib/fiscal-calendar/lookup.d.ts +4 -0
- package/dist/lib/fiscal-calendar/lookup.js +70 -0
- package/dist/lib/fiscal-calendar/presets.d.ts +8 -0
- package/dist/lib/fiscal-calendar/presets.js +99 -0
- package/dist/lib/fiscal-calendar/selection.d.ts +18 -0
- package/dist/lib/fiscal-calendar/selection.js +32 -0
- package/dist/lib/fiscal-calendar/types.d.ts +145 -0
- package/dist/lib/fiscal-calendar/types.js +10 -0
- package/dist/lib/fiscal-calendar/week-selection.d.ts +22 -0
- package/dist/lib/fiscal-calendar/week-selection.js +107 -0
- package/dist/llms/rules/best-practices.js +1 -1
- package/dist/llms/rules/installation.js +1 -1
- package/dist/llms/rules/real-world-patterns.js +1 -1
- package/dist/llms/rules/requirements.js +1 -1
- package/package.json +5 -1
- package/dist/lib/fiscal-calendar.d.ts +0 -62
- package/dist/lib/fiscal-calendar.js +0 -99
|
@@ -1,116 +1,121 @@
|
|
|
1
|
-
import { jsxs as
|
|
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 te, CalendarMonth as re } 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 ne } from "../../../lib/utils.js";
|
|
6
|
+
import { Input as oe } from "../input/input.js";
|
|
7
|
+
import { Popover as se, PopoverAnchor as ae, PopoverContent as ie } from "../../feedback/popover/popover.js";
|
|
8
|
+
import { Calendar as ce } 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
|
-
|
|
16
|
-
|
|
10
|
+
import { useImpactNovaI18n as le } from "../../../i18n/use-impact-nova-i18n.js";
|
|
11
|
+
import { getDateFnsLocale as pe } from "../../../i18n/getDateFnsLocale.js";
|
|
12
|
+
import { coerceWeekArrayApply as de, coerceWeekArray as fe } from "./calendar-selection-adapters.js";
|
|
13
|
+
import { usePickerDismissActionsRef as me, usePickerFooterDismissNudge as ue, handlePickerSurfacePointerDown as he } from "./date-input-behavior.js";
|
|
14
|
+
import { buildDateBoundsMatcher as ye } from "../../../lib/date-bounds-matcher.js";
|
|
15
|
+
import { fiscalCalendarPassThrough as ke } from "./fiscal-pass-through.js";
|
|
16
|
+
const ge = (t, a = "MM/dd/yyyy", i) => {
|
|
17
|
+
const h = b(t.startDate, a, i ? { locale: i } : {}), y = b(t.endDate, a, i ? { locale: i } : {});
|
|
17
18
|
return `${h} - ${y}`;
|
|
18
|
-
},
|
|
19
|
+
}, Pe = n.forwardRef(
|
|
19
20
|
({
|
|
20
21
|
value: t,
|
|
21
22
|
onChange: a,
|
|
22
|
-
format:
|
|
23
|
+
format: i = "MM/dd/yyyy",
|
|
23
24
|
placeholder: h,
|
|
24
25
|
minDate: y,
|
|
25
26
|
maxDate: N,
|
|
26
27
|
startMonth: T,
|
|
27
28
|
endMonth: R,
|
|
28
29
|
showFooter: d = !0,
|
|
29
|
-
|
|
30
|
-
fiscalMode:
|
|
31
|
-
|
|
30
|
+
calendarKind: S,
|
|
31
|
+
fiscalMode: v = "basic",
|
|
32
|
+
granularity: w,
|
|
32
33
|
fiscalMonthPattern: I,
|
|
33
34
|
fiscalYearStartMonth: L = 1,
|
|
34
|
-
|
|
35
|
+
fiscalConfig: O,
|
|
36
|
+
weekStartsOn: j = 1,
|
|
37
|
+
showPresets: F,
|
|
38
|
+
comparison: E,
|
|
39
|
+
onComparisonChange: K,
|
|
35
40
|
disabled: o,
|
|
36
|
-
className:
|
|
37
|
-
...
|
|
38
|
-
},
|
|
39
|
-
const { locale: P, t:
|
|
41
|
+
className: $,
|
|
42
|
+
...z
|
|
43
|
+
}, V) => {
|
|
44
|
+
const { locale: P, t: c } = le(), q = n.useMemo(() => pe(P), [P]), B = h ?? c("datePicker.selectWeeks"), [l, s] = n.useState(!1), k = n.useRef(!1), g = n.useRef(null), C = me(), { footerFlashKey: H, footerFlashTarget: G, popoverHandlers: J } = ue(d, l, C, g), [f, m] = n.useState(t);
|
|
40
45
|
n.useEffect(() => {
|
|
41
|
-
|
|
46
|
+
m(t);
|
|
42
47
|
}, [l, t]);
|
|
43
|
-
const
|
|
44
|
-
const p =
|
|
45
|
-
|
|
46
|
-
},
|
|
47
|
-
const p =
|
|
48
|
+
const Q = (e) => {
|
|
49
|
+
const p = fe(e);
|
|
50
|
+
m(p), d || a?.(p);
|
|
51
|
+
}, U = (e) => {
|
|
52
|
+
const p = de(e, f);
|
|
48
53
|
a?.(p), s(!1);
|
|
49
54
|
}, D = () => {
|
|
50
|
-
|
|
55
|
+
m(t), s(!1);
|
|
51
56
|
}, W = () => {
|
|
52
|
-
|
|
53
|
-
},
|
|
57
|
+
m(void 0), a?.(void 0), d || s(!1);
|
|
58
|
+
}, X = t && t.length > 0 ? t.length === 1 ? ge(t[0], i, q) : `${t.length} weeks selected` : "", Y = (e) => {
|
|
54
59
|
o || !e && d || s(e);
|
|
55
|
-
},
|
|
60
|
+
}, Z = n.useCallback(() => {
|
|
56
61
|
const e = f?.length ?? 0, p = t?.length ?? 0;
|
|
57
62
|
return e === p && (f ?? []).every(
|
|
58
|
-
(
|
|
63
|
+
(_, ee) => _.startDate.getTime() === t?.[ee]?.startDate.getTime()
|
|
59
64
|
) ? "dismiss" : e > 0 ? "apply" : "cancel";
|
|
60
65
|
}, [f, t]);
|
|
61
66
|
return n.useLayoutEffect(() => {
|
|
62
67
|
C.current = {
|
|
63
68
|
onDismiss: D,
|
|
64
|
-
resolveFlash:
|
|
69
|
+
resolveFlash: Z
|
|
65
70
|
};
|
|
66
|
-
}), /* @__PURE__ */
|
|
67
|
-
/* @__PURE__ */ r(
|
|
71
|
+
}), /* @__PURE__ */ u(se, { open: o ? !1 : l, onOpenChange: Y, children: [
|
|
72
|
+
/* @__PURE__ */ r(ae, { asChild: !0, children: /* @__PURE__ */ r(
|
|
68
73
|
"div",
|
|
69
74
|
{
|
|
70
75
|
ref: g,
|
|
71
|
-
onPointerDown: (e) =>
|
|
76
|
+
onPointerDown: (e) => he({
|
|
72
77
|
disabled: o,
|
|
73
78
|
event: e,
|
|
74
79
|
onOpen: () => s(!0),
|
|
75
80
|
focusField: () => g.current?.querySelector("input")?.focus()
|
|
76
81
|
}),
|
|
77
82
|
children: /* @__PURE__ */ r(
|
|
78
|
-
|
|
83
|
+
oe,
|
|
79
84
|
{
|
|
80
|
-
ref:
|
|
81
|
-
value:
|
|
82
|
-
placeholder:
|
|
85
|
+
ref: V,
|
|
86
|
+
value: X,
|
|
87
|
+
placeholder: B,
|
|
83
88
|
readOnly: !0,
|
|
84
89
|
disabled: o,
|
|
85
90
|
onClick: () => {
|
|
86
91
|
!o && !l && s(!0);
|
|
87
92
|
},
|
|
88
|
-
className:
|
|
89
|
-
suffix: /* @__PURE__ */
|
|
90
|
-
t && t.length > 0 && !o && /* @__PURE__ */
|
|
93
|
+
className: ne("cursor-pointer", $),
|
|
94
|
+
suffix: /* @__PURE__ */ u("div", { className: "flex items-center gap-1", children: [
|
|
95
|
+
t && t.length > 0 && !o && /* @__PURE__ */ u(x, { children: [
|
|
91
96
|
/* @__PURE__ */ r(A, { asChild: !0, children: /* @__PURE__ */ r(
|
|
92
97
|
"button",
|
|
93
98
|
{
|
|
94
99
|
type: "button",
|
|
95
100
|
tabIndex: 0,
|
|
96
|
-
"aria-label":
|
|
101
|
+
"aria-label": c("calendar.clear"),
|
|
97
102
|
onClick: (e) => {
|
|
98
103
|
e.stopPropagation(), W();
|
|
99
104
|
},
|
|
100
105
|
className: "inline-flex size-4 items-center justify-center bg-transparent border-none p-0 cursor-pointer",
|
|
101
|
-
children: /* @__PURE__ */ r(
|
|
106
|
+
children: /* @__PURE__ */ r(te, { className: "size-3 hover:text-content" })
|
|
102
107
|
}
|
|
103
108
|
) }),
|
|
104
|
-
/* @__PURE__ */ r(M, { variant: "tertiary", side: "top", children:
|
|
109
|
+
/* @__PURE__ */ r(M, { variant: "tertiary", side: "top", children: c("calendar.clear") })
|
|
105
110
|
] }),
|
|
106
|
-
/* @__PURE__ */
|
|
111
|
+
/* @__PURE__ */ u(x, { children: [
|
|
107
112
|
/* @__PURE__ */ r(A, { asChild: !0, children: /* @__PURE__ */ r(
|
|
108
113
|
"button",
|
|
109
114
|
{
|
|
110
115
|
type: "button",
|
|
111
116
|
tabIndex: 0,
|
|
112
117
|
"data-component": "calendar-trigger",
|
|
113
|
-
"aria-label":
|
|
118
|
+
"aria-label": c("datePicker.selectWeeks"),
|
|
114
119
|
onPointerDown: (e) => {
|
|
115
120
|
e.preventDefault(), e.stopPropagation(), o || s(!l);
|
|
116
121
|
},
|
|
@@ -118,47 +123,53 @@ const ue = (t, a = "MM/dd/yyyy", c) => {
|
|
|
118
123
|
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), e.stopPropagation(), o || (k.current = !0, s(!l)));
|
|
119
124
|
},
|
|
120
125
|
className: "inline-flex items-center justify-center bg-transparent border-none p-0 cursor-pointer",
|
|
121
|
-
children: /* @__PURE__ */ r(
|
|
126
|
+
children: /* @__PURE__ */ r(re, { className: "h-4 w-4 text-secondary-foreground" })
|
|
122
127
|
}
|
|
123
128
|
) }),
|
|
124
|
-
/* @__PURE__ */ r(M, { variant: "tertiary", side: "top", children:
|
|
129
|
+
/* @__PURE__ */ r(M, { variant: "tertiary", side: "top", children: c("datePicker.selectWeeks") })
|
|
125
130
|
] })
|
|
126
131
|
] }),
|
|
127
|
-
...
|
|
132
|
+
...z
|
|
128
133
|
}
|
|
129
134
|
)
|
|
130
135
|
}
|
|
131
136
|
) }),
|
|
132
137
|
/* @__PURE__ */ r(
|
|
133
|
-
|
|
138
|
+
ie,
|
|
134
139
|
{
|
|
135
140
|
className: "w-auto p-0",
|
|
136
141
|
align: "start",
|
|
137
|
-
"aria-label":
|
|
142
|
+
"aria-label": c("datePicker.selectWeeks"),
|
|
138
143
|
onOpenAutoFocus: (e) => {
|
|
139
144
|
k.current || e.preventDefault(), k.current = !1;
|
|
140
145
|
},
|
|
141
|
-
...
|
|
146
|
+
...J,
|
|
142
147
|
children: /* @__PURE__ */ r(
|
|
143
|
-
|
|
148
|
+
ce,
|
|
144
149
|
{
|
|
145
150
|
pickerType: "week",
|
|
146
151
|
weekMode: "multiple",
|
|
147
152
|
selectedWeeks: f,
|
|
148
|
-
footerFlashKey:
|
|
149
|
-
footerFlashTarget:
|
|
150
|
-
onWeekSelect:
|
|
151
|
-
disabled:
|
|
153
|
+
footerFlashKey: H,
|
|
154
|
+
footerFlashTarget: G,
|
|
155
|
+
onWeekSelect: Q,
|
|
156
|
+
disabled: ye(y, N),
|
|
152
157
|
startMonth: T,
|
|
153
158
|
endMonth: R,
|
|
154
159
|
showFooter: d,
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
160
|
+
...ke({
|
|
161
|
+
calendarKind: S,
|
|
162
|
+
fiscalMode: v,
|
|
163
|
+
granularity: w,
|
|
164
|
+
fiscalMonthPattern: I,
|
|
165
|
+
fiscalYearStartMonth: L,
|
|
166
|
+
fiscalConfig: O,
|
|
167
|
+
weekStartsOn: j,
|
|
168
|
+
showPresets: F,
|
|
169
|
+
comparison: E,
|
|
170
|
+
onComparisonChange: K
|
|
171
|
+
}),
|
|
172
|
+
onApply: U,
|
|
162
173
|
onCancel: D,
|
|
163
174
|
onClear: W,
|
|
164
175
|
captionLayout: "dropdown"
|
|
@@ -169,7 +180,7 @@ const ue = (t, a = "MM/dd/yyyy", c) => {
|
|
|
169
180
|
] });
|
|
170
181
|
}
|
|
171
182
|
);
|
|
172
|
-
|
|
183
|
+
Pe.displayName = "MultiWeekPicker";
|
|
173
184
|
export {
|
|
174
|
-
|
|
185
|
+
Pe as MultiWeekPicker
|
|
175
186
|
};
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { jsx as r, jsxs as y } from "react/jsx-runtime";
|
|
2
|
+
import * as n from "react";
|
|
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
|
+
import { Tooltip as M, TooltipTrigger as x, TooltipContent as R } from "../../feedback/tooltip/tooltip.js";
|
|
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 se, handleReadonlyPickerKeyDown as ce, handlePickerSurfacePointerDown as le } from "./date-input-behavior.js";
|
|
13
|
+
import { formatYearInput as pe } from "../../data-display/calendar/calendar-fiscal-labels.js";
|
|
14
|
+
import { viewMonthFromYear as fe } from "../../data-display/calendar/calendar-year-utils.js";
|
|
15
|
+
const de = n.forwardRef(
|
|
16
|
+
({
|
|
17
|
+
value: t,
|
|
18
|
+
onChange: f,
|
|
19
|
+
placeholder: D,
|
|
20
|
+
minDate: Y,
|
|
21
|
+
maxDate: N,
|
|
22
|
+
startMonth: S,
|
|
23
|
+
endMonth: A,
|
|
24
|
+
showFooter: c = !0,
|
|
25
|
+
disabled: o,
|
|
26
|
+
className: I,
|
|
27
|
+
calendarKind: O,
|
|
28
|
+
fiscalMode: T,
|
|
29
|
+
granularity: w,
|
|
30
|
+
fiscalMonthPattern: v,
|
|
31
|
+
fiscalYearStartMonth: K,
|
|
32
|
+
fiscalConfig: g,
|
|
33
|
+
showPresets: j,
|
|
34
|
+
showIntervalCaption: F = !1,
|
|
35
|
+
...L
|
|
36
|
+
}, z) => {
|
|
37
|
+
const { t: a } = re(), E = D ?? a("datePicker.selectMultipleYears"), H = g?.fyLabel ?? "fy-long", d = n.useRef(null), k = n.useRef(null);
|
|
38
|
+
n.useImperativeHandle(z, () => d.current);
|
|
39
|
+
const [i, s] = n.useState(!1), u = n.useRef(!1), P = ie(), { footerFlashKey: V, footerFlashTarget: B, popoverHandlers: q } = se(c, i, P, k), [C, l] = n.useState(t), [G, J] = n.useState(fe(t?.[0]));
|
|
40
|
+
n.useEffect(() => {
|
|
41
|
+
i || l(t);
|
|
42
|
+
}, [i, t]);
|
|
43
|
+
const m = n.useCallback(() => s(!1), []), Q = oe({
|
|
44
|
+
calendarKind: O,
|
|
45
|
+
fiscalMode: T,
|
|
46
|
+
granularity: w,
|
|
47
|
+
fiscalMonthPattern: v,
|
|
48
|
+
fiscalYearStartMonth: K,
|
|
49
|
+
fiscalConfig: g,
|
|
50
|
+
showPresets: j
|
|
51
|
+
}), U = (e) => {
|
|
52
|
+
const p = Array.isArray(e) && e.length > 0 ? e : void 0;
|
|
53
|
+
l(p), c || f?.(p);
|
|
54
|
+
}, W = () => {
|
|
55
|
+
f?.(C), m();
|
|
56
|
+
}, h = () => {
|
|
57
|
+
l(t), m();
|
|
58
|
+
}, b = () => {
|
|
59
|
+
l(void 0), f?.(void 0), c || m();
|
|
60
|
+
};
|
|
61
|
+
n.useLayoutEffect(() => {
|
|
62
|
+
P.current = { onDismiss: h, resolveFlash: () => "cancel" };
|
|
63
|
+
});
|
|
64
|
+
const X = t && t.length > 0 ? t.length === 1 ? pe(t[0], H) : a("datePicker.yearsSelected", { count: t.length }) : "";
|
|
65
|
+
return /* @__PURE__ */ r(
|
|
66
|
+
ae,
|
|
67
|
+
{
|
|
68
|
+
open: i,
|
|
69
|
+
disabled: o,
|
|
70
|
+
ariaLabel: a("datePicker.selectMultipleYears"),
|
|
71
|
+
onOpenChange: (e) => {
|
|
72
|
+
o || s(e);
|
|
73
|
+
},
|
|
74
|
+
onOpenAutoFocus: (e) => {
|
|
75
|
+
u.current || e.preventDefault(), u.current = !1;
|
|
76
|
+
},
|
|
77
|
+
popoverHandlers: q,
|
|
78
|
+
trigger: /* @__PURE__ */ r(
|
|
79
|
+
"div",
|
|
80
|
+
{
|
|
81
|
+
ref: k,
|
|
82
|
+
"data-component": "multi-year-picker",
|
|
83
|
+
"data-state": i ? "open" : "closed",
|
|
84
|
+
onPointerDown: (e) => le({
|
|
85
|
+
disabled: o,
|
|
86
|
+
event: e,
|
|
87
|
+
onOpen: () => s(!0),
|
|
88
|
+
focusField: () => d.current?.focus()
|
|
89
|
+
}),
|
|
90
|
+
children: /* @__PURE__ */ r(
|
|
91
|
+
ee,
|
|
92
|
+
{
|
|
93
|
+
ref: d,
|
|
94
|
+
value: X,
|
|
95
|
+
readOnly: !0,
|
|
96
|
+
onKeyDown: (e) => ce(e, {
|
|
97
|
+
disabled: o,
|
|
98
|
+
open: i,
|
|
99
|
+
onOpen: () => s(!0),
|
|
100
|
+
onCancel: h,
|
|
101
|
+
onKeyboardOpen: () => {
|
|
102
|
+
u.current = !0;
|
|
103
|
+
}
|
|
104
|
+
}),
|
|
105
|
+
onClick: () => !o && s(!0),
|
|
106
|
+
placeholder: E,
|
|
107
|
+
disabled: o,
|
|
108
|
+
"data-form-control": "input",
|
|
109
|
+
className: $("cursor-pointer", I),
|
|
110
|
+
suffix: /* @__PURE__ */ y("div", { className: "flex items-center gap-1", children: [
|
|
111
|
+
t && t.length > 0 && !o ? /* @__PURE__ */ y(M, { children: [
|
|
112
|
+
/* @__PURE__ */ r(x, { asChild: !0, children: /* @__PURE__ */ r(
|
|
113
|
+
"button",
|
|
114
|
+
{
|
|
115
|
+
type: "button",
|
|
116
|
+
tabIndex: 0,
|
|
117
|
+
"aria-label": a("calendar.clear"),
|
|
118
|
+
onClick: (e) => {
|
|
119
|
+
e.stopPropagation(), b();
|
|
120
|
+
},
|
|
121
|
+
className: "inline-flex size-4 items-center justify-center border-none bg-transparent p-0",
|
|
122
|
+
children: /* @__PURE__ */ r(Z, { className: "size-3 hover:text-content" })
|
|
123
|
+
}
|
|
124
|
+
) }),
|
|
125
|
+
/* @__PURE__ */ r(R, { variant: "tertiary", side: "top", children: a("calendar.clear") })
|
|
126
|
+
] }) : null,
|
|
127
|
+
/* @__PURE__ */ y(M, { children: [
|
|
128
|
+
/* @__PURE__ */ r(x, { asChild: !0, children: /* @__PURE__ */ r(
|
|
129
|
+
"button",
|
|
130
|
+
{
|
|
131
|
+
type: "button",
|
|
132
|
+
tabIndex: 0,
|
|
133
|
+
"data-component": "calendar-trigger",
|
|
134
|
+
"aria-label": a("datePicker.selectMultipleYears"),
|
|
135
|
+
onClick: (e) => {
|
|
136
|
+
e.stopPropagation(), o || s((p) => !p);
|
|
137
|
+
},
|
|
138
|
+
className: "inline-flex items-center justify-center border-none bg-transparent p-0",
|
|
139
|
+
children: /* @__PURE__ */ r(_, { className: "h-4 w-4 text-secondary-foreground" })
|
|
140
|
+
}
|
|
141
|
+
) }),
|
|
142
|
+
/* @__PURE__ */ r(R, { variant: "tertiary", side: "top", children: a("datePicker.selectMultipleYears") })
|
|
143
|
+
] })
|
|
144
|
+
] }),
|
|
145
|
+
...L
|
|
146
|
+
}
|
|
147
|
+
)
|
|
148
|
+
}
|
|
149
|
+
),
|
|
150
|
+
children: /* @__PURE__ */ r(
|
|
151
|
+
te,
|
|
152
|
+
{
|
|
153
|
+
pickerType: "year",
|
|
154
|
+
yearMode: "multiple",
|
|
155
|
+
selectedYear: C,
|
|
156
|
+
footerFlashKey: V,
|
|
157
|
+
footerFlashTarget: B,
|
|
158
|
+
onYearSelect: U,
|
|
159
|
+
month: G,
|
|
160
|
+
onMonthChange: J,
|
|
161
|
+
disabled: ne(Y, N),
|
|
162
|
+
startMonth: S,
|
|
163
|
+
endMonth: A,
|
|
164
|
+
showFooter: c,
|
|
165
|
+
onApply: W,
|
|
166
|
+
onCancel: h,
|
|
167
|
+
onClear: b,
|
|
168
|
+
showIntervalCaption: F,
|
|
169
|
+
...Q
|
|
170
|
+
}
|
|
171
|
+
)
|
|
172
|
+
}
|
|
173
|
+
);
|
|
174
|
+
}
|
|
175
|
+
);
|
|
176
|
+
de.displayName = "MultiYearPicker";
|
|
177
|
+
export {
|
|
178
|
+
de as MultiYearPicker
|
|
179
|
+
};
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import { jsx as r, jsxs as y } from "react/jsx-runtime";
|
|
2
|
+
import * as t from "react";
|
|
3
|
+
import { Cross as Y, CalendarMonth as Z } from "impact-nova-icons";
|
|
4
|
+
import { cn as _ } from "../../../lib/utils.js";
|
|
5
|
+
import { Input as $ } from "../input/input.js";
|
|
6
|
+
import { Calendar as q } from "../../data-display/calendar/calendar.js";
|
|
7
|
+
import { Tooltip as x, TooltipTrigger as b, TooltipContent as R } from "../../feedback/tooltip/tooltip.js";
|
|
8
|
+
import { useImpactNovaI18n as ee } from "../../../i18n/use-impact-nova-i18n.js";
|
|
9
|
+
import { buildDateBoundsMatcher as re } from "../../../lib/date-bounds-matcher.js";
|
|
10
|
+
import { fiscalCalendarPassThrough as te } from "./fiscal-pass-through.js";
|
|
11
|
+
import { DatePickerShell as ne } from "./date-picker-shell.js";
|
|
12
|
+
import { usePickerDismissActionsRef as oe, usePickerFooterDismissNudge as ae, handleReadonlyPickerKeyDown as ie, handlePickerSurfacePointerDown as ce } from "./date-input-behavior.js";
|
|
13
|
+
import { formatQuarterInput as se } from "../../data-display/calendar/calendar-fiscal-labels.js";
|
|
14
|
+
import { viewMonthFromQuarter as le } from "../../data-display/calendar/calendar-quarter-utils.js";
|
|
15
|
+
const pe = t.forwardRef(
|
|
16
|
+
({
|
|
17
|
+
value: n,
|
|
18
|
+
onChange: u,
|
|
19
|
+
placeholder: D,
|
|
20
|
+
minDate: Q,
|
|
21
|
+
maxDate: v,
|
|
22
|
+
startMonth: N,
|
|
23
|
+
endMonth: S,
|
|
24
|
+
showFooter: s = !0,
|
|
25
|
+
disabled: o,
|
|
26
|
+
className: A,
|
|
27
|
+
calendarKind: I,
|
|
28
|
+
fiscalMode: O,
|
|
29
|
+
granularity: T,
|
|
30
|
+
fiscalMonthPattern: w,
|
|
31
|
+
fiscalYearStartMonth: M,
|
|
32
|
+
fiscalConfig: K,
|
|
33
|
+
showPresets: j,
|
|
34
|
+
...F
|
|
35
|
+
}, z) => {
|
|
36
|
+
const { t: a } = ee(), E = D ?? a("datePicker.selectQuarter"), d = t.useRef(null), k = t.useRef(null);
|
|
37
|
+
t.useImperativeHandle(z, () => d.current);
|
|
38
|
+
const [i, c] = t.useState(!1), P = oe(), { footerFlashKey: H, footerFlashTarget: L, popoverHandlers: V } = ae(s, i, P, k), m = t.useRef(!1), [g, l] = t.useState(n), [B, G] = t.useState(le(n));
|
|
39
|
+
t.useEffect(() => {
|
|
40
|
+
i || l(n);
|
|
41
|
+
}, [i, n]);
|
|
42
|
+
const p = t.useCallback(() => c(!1), []), J = te({
|
|
43
|
+
calendarKind: I,
|
|
44
|
+
fiscalMode: O,
|
|
45
|
+
granularity: T,
|
|
46
|
+
fiscalMonthPattern: w,
|
|
47
|
+
fiscalYearStartMonth: M,
|
|
48
|
+
fiscalConfig: K,
|
|
49
|
+
showPresets: j
|
|
50
|
+
}), U = (e) => {
|
|
51
|
+
const f = e && !Array.isArray(e) && !("from" in e) && !("to" in e) ? e : void 0;
|
|
52
|
+
l(f), s || (u?.(f), p());
|
|
53
|
+
}, W = () => {
|
|
54
|
+
u?.(g), p();
|
|
55
|
+
}, h = () => {
|
|
56
|
+
l(n), p();
|
|
57
|
+
}, C = () => {
|
|
58
|
+
l(void 0), u?.(void 0), s || p();
|
|
59
|
+
};
|
|
60
|
+
t.useLayoutEffect(() => {
|
|
61
|
+
P.current = { onDismiss: h, resolveFlash: () => "cancel" };
|
|
62
|
+
});
|
|
63
|
+
const X = n ? se(n) : "";
|
|
64
|
+
return /* @__PURE__ */ r(
|
|
65
|
+
ne,
|
|
66
|
+
{
|
|
67
|
+
open: i,
|
|
68
|
+
disabled: o,
|
|
69
|
+
ariaLabel: a("datePicker.selectQuarter"),
|
|
70
|
+
onOpenChange: (e) => {
|
|
71
|
+
o || c(e);
|
|
72
|
+
},
|
|
73
|
+
onOpenAutoFocus: (e) => {
|
|
74
|
+
m.current || e.preventDefault(), m.current = !1;
|
|
75
|
+
},
|
|
76
|
+
popoverHandlers: V,
|
|
77
|
+
trigger: /* @__PURE__ */ r(
|
|
78
|
+
"div",
|
|
79
|
+
{
|
|
80
|
+
ref: k,
|
|
81
|
+
"data-component": "quarter-picker",
|
|
82
|
+
"data-state": i ? "open" : "closed",
|
|
83
|
+
onPointerDown: (e) => ce({
|
|
84
|
+
disabled: o,
|
|
85
|
+
event: e,
|
|
86
|
+
onOpen: () => c(!0),
|
|
87
|
+
focusField: () => d.current?.focus()
|
|
88
|
+
}),
|
|
89
|
+
children: /* @__PURE__ */ r(
|
|
90
|
+
$,
|
|
91
|
+
{
|
|
92
|
+
ref: d,
|
|
93
|
+
value: X,
|
|
94
|
+
readOnly: !0,
|
|
95
|
+
onKeyDown: (e) => ie(e, {
|
|
96
|
+
disabled: o,
|
|
97
|
+
open: i,
|
|
98
|
+
onOpen: () => c(!0),
|
|
99
|
+
onCancel: h,
|
|
100
|
+
onKeyboardOpen: () => {
|
|
101
|
+
m.current = !0;
|
|
102
|
+
}
|
|
103
|
+
}),
|
|
104
|
+
onClick: () => !o && c(!0),
|
|
105
|
+
placeholder: E,
|
|
106
|
+
disabled: o,
|
|
107
|
+
"data-form-control": "input",
|
|
108
|
+
className: _("cursor-pointer", A),
|
|
109
|
+
suffix: /* @__PURE__ */ y("div", { className: "flex items-center gap-1", children: [
|
|
110
|
+
n && !o ? /* @__PURE__ */ y(x, { children: [
|
|
111
|
+
/* @__PURE__ */ r(b, { asChild: !0, children: /* @__PURE__ */ r(
|
|
112
|
+
"button",
|
|
113
|
+
{
|
|
114
|
+
type: "button",
|
|
115
|
+
tabIndex: 0,
|
|
116
|
+
"aria-label": a("calendar.clear"),
|
|
117
|
+
onClick: (e) => {
|
|
118
|
+
e.stopPropagation(), C();
|
|
119
|
+
},
|
|
120
|
+
className: "inline-flex size-4 items-center justify-center border-none bg-transparent p-0",
|
|
121
|
+
children: /* @__PURE__ */ r(Y, { className: "size-3 hover:text-content" })
|
|
122
|
+
}
|
|
123
|
+
) }),
|
|
124
|
+
/* @__PURE__ */ r(R, { variant: "tertiary", side: "top", children: a("calendar.clear") })
|
|
125
|
+
] }) : null,
|
|
126
|
+
/* @__PURE__ */ y(x, { children: [
|
|
127
|
+
/* @__PURE__ */ r(b, { asChild: !0, children: /* @__PURE__ */ r(
|
|
128
|
+
"button",
|
|
129
|
+
{
|
|
130
|
+
type: "button",
|
|
131
|
+
tabIndex: 0,
|
|
132
|
+
"data-component": "calendar-trigger",
|
|
133
|
+
"aria-label": a("datePicker.selectQuarter"),
|
|
134
|
+
onClick: (e) => {
|
|
135
|
+
e.stopPropagation(), o || c((f) => !f);
|
|
136
|
+
},
|
|
137
|
+
className: "inline-flex items-center justify-center border-none bg-transparent p-0",
|
|
138
|
+
children: /* @__PURE__ */ r(Z, { className: "h-4 w-4 text-secondary-foreground" })
|
|
139
|
+
}
|
|
140
|
+
) }),
|
|
141
|
+
/* @__PURE__ */ r(R, { variant: "tertiary", side: "top", children: a("datePicker.selectQuarter") })
|
|
142
|
+
] })
|
|
143
|
+
] }),
|
|
144
|
+
...F
|
|
145
|
+
}
|
|
146
|
+
)
|
|
147
|
+
}
|
|
148
|
+
),
|
|
149
|
+
children: /* @__PURE__ */ r(
|
|
150
|
+
q,
|
|
151
|
+
{
|
|
152
|
+
pickerType: "quarter",
|
|
153
|
+
selectedQuarters: g,
|
|
154
|
+
footerFlashKey: H,
|
|
155
|
+
footerFlashTarget: L,
|
|
156
|
+
onQuarterSelect: U,
|
|
157
|
+
month: B,
|
|
158
|
+
onMonthChange: G,
|
|
159
|
+
disabled: re(Q, v),
|
|
160
|
+
startMonth: N,
|
|
161
|
+
endMonth: S,
|
|
162
|
+
showFooter: s,
|
|
163
|
+
onApply: W,
|
|
164
|
+
onCancel: h,
|
|
165
|
+
onClear: C,
|
|
166
|
+
...J
|
|
167
|
+
}
|
|
168
|
+
)
|
|
169
|
+
}
|
|
170
|
+
);
|
|
171
|
+
}
|
|
172
|
+
);
|
|
173
|
+
pe.displayName = "QuarterPicker";
|
|
174
|
+
export {
|
|
175
|
+
pe as QuarterPicker
|
|
176
|
+
};
|