impact-nova 2.5.7 → 2.5.8
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 +201 -108
- 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-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 +24 -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/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/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 +19 -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/package.json +5 -1
- package/dist/lib/fiscal-calendar.d.ts +0 -62
- package/dist/lib/fiscal-calendar.js +0 -99
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import { jsx as r, jsxs as g } 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 q } from "../input/input.js";
|
|
6
|
+
import { Calendar as ee } from "../../data-display/calendar/calendar.js";
|
|
7
|
+
import { Tooltip as C, TooltipTrigger as x, TooltipContent as b } from "../../feedback/tooltip/tooltip.js";
|
|
8
|
+
import { useImpactNovaI18n as re } from "../../../i18n/use-impact-nova-i18n.js";
|
|
9
|
+
import { buildDateBoundsMatcher as te } from "../../../lib/date-bounds-matcher.js";
|
|
10
|
+
import { fiscalCalendarPassThrough as ne } from "./fiscal-pass-through.js";
|
|
11
|
+
import { DatePickerShell as oe } from "./date-picker-shell.js";
|
|
12
|
+
import { usePickerDismissActionsRef as ae, usePickerFooterDismissNudge as ie, handleReadonlyPickerKeyDown as ce, handlePickerSurfacePointerDown as se } from "./date-input-behavior.js";
|
|
13
|
+
import { formatQuarterInput as D } from "../../data-display/calendar/calendar-fiscal-labels.js";
|
|
14
|
+
import { viewMonthFromQuarter as le } from "../../data-display/calendar/calendar-quarter-utils.js";
|
|
15
|
+
const fe = t.forwardRef(
|
|
16
|
+
({
|
|
17
|
+
value: n,
|
|
18
|
+
onChange: d,
|
|
19
|
+
placeholder: Q,
|
|
20
|
+
minDate: N,
|
|
21
|
+
maxDate: S,
|
|
22
|
+
startMonth: v,
|
|
23
|
+
endMonth: A,
|
|
24
|
+
showFooter: l = !0,
|
|
25
|
+
disabled: o,
|
|
26
|
+
className: I,
|
|
27
|
+
calendarKind: M,
|
|
28
|
+
fiscalMode: O,
|
|
29
|
+
granularity: T,
|
|
30
|
+
fiscalMonthPattern: w,
|
|
31
|
+
fiscalYearStartMonth: K,
|
|
32
|
+
fiscalConfig: j,
|
|
33
|
+
showPresets: F,
|
|
34
|
+
...$
|
|
35
|
+
}, z) => {
|
|
36
|
+
const { t: a } = re(), E = Q ?? a("datePicker.selectQuarterRange"), m = t.useRef(null), y = t.useRef(null);
|
|
37
|
+
t.useImperativeHandle(z, () => m.current);
|
|
38
|
+
const [i, c] = t.useState(!1), u = t.useRef(!1), k = ae(), { footerFlashKey: H, footerFlashTarget: L, popoverHandlers: V } = ie(l, i, k, y), [P, f] = t.useState(n), [B, G] = t.useState(le(n?.from));
|
|
39
|
+
t.useEffect(() => {
|
|
40
|
+
i || f(n);
|
|
41
|
+
}, [i, n]);
|
|
42
|
+
const p = t.useCallback(() => c(!1), []), J = ne({
|
|
43
|
+
calendarKind: M,
|
|
44
|
+
fiscalMode: O,
|
|
45
|
+
granularity: T,
|
|
46
|
+
fiscalMonthPattern: w,
|
|
47
|
+
fiscalYearStartMonth: K,
|
|
48
|
+
fiscalConfig: j,
|
|
49
|
+
showPresets: F
|
|
50
|
+
}), U = (e) => {
|
|
51
|
+
const s = e && !Array.isArray(e) && ("from" in e || "to" in e) ? e : void 0;
|
|
52
|
+
f(s), l || (d?.(s), s?.to && p());
|
|
53
|
+
}, W = () => {
|
|
54
|
+
d?.(P), p();
|
|
55
|
+
}, h = () => {
|
|
56
|
+
f(n), p();
|
|
57
|
+
}, R = () => {
|
|
58
|
+
f(void 0), d?.(void 0), l || p();
|
|
59
|
+
};
|
|
60
|
+
t.useLayoutEffect(() => {
|
|
61
|
+
k.current = { onDismiss: h, resolveFlash: () => "cancel" };
|
|
62
|
+
});
|
|
63
|
+
const X = n?.from ? `${D(n.from)}${n.to ? ` – ${D(n.to)}` : ""}` : "";
|
|
64
|
+
return /* @__PURE__ */ r(
|
|
65
|
+
oe,
|
|
66
|
+
{
|
|
67
|
+
open: i,
|
|
68
|
+
disabled: o,
|
|
69
|
+
ariaLabel: a("datePicker.selectQuarterRange"),
|
|
70
|
+
onOpenChange: (e) => {
|
|
71
|
+
o || c(e);
|
|
72
|
+
},
|
|
73
|
+
onOpenAutoFocus: (e) => {
|
|
74
|
+
u.current || e.preventDefault(), u.current = !1;
|
|
75
|
+
},
|
|
76
|
+
popoverHandlers: V,
|
|
77
|
+
trigger: /* @__PURE__ */ r(
|
|
78
|
+
"div",
|
|
79
|
+
{
|
|
80
|
+
ref: y,
|
|
81
|
+
"data-component": "quarter-range-picker",
|
|
82
|
+
"data-state": i ? "open" : "closed",
|
|
83
|
+
onPointerDown: (e) => se({
|
|
84
|
+
disabled: o,
|
|
85
|
+
event: e,
|
|
86
|
+
onOpen: () => c(!0),
|
|
87
|
+
focusField: () => m.current?.focus()
|
|
88
|
+
}),
|
|
89
|
+
children: /* @__PURE__ */ r(
|
|
90
|
+
q,
|
|
91
|
+
{
|
|
92
|
+
ref: m,
|
|
93
|
+
value: X,
|
|
94
|
+
readOnly: !0,
|
|
95
|
+
onKeyDown: (e) => ce(e, {
|
|
96
|
+
disabled: o,
|
|
97
|
+
open: i,
|
|
98
|
+
onOpen: () => c(!0),
|
|
99
|
+
onCancel: h,
|
|
100
|
+
onKeyboardOpen: () => {
|
|
101
|
+
u.current = !0;
|
|
102
|
+
}
|
|
103
|
+
}),
|
|
104
|
+
onClick: () => !o && c(!0),
|
|
105
|
+
placeholder: E,
|
|
106
|
+
disabled: o,
|
|
107
|
+
"data-form-control": "input",
|
|
108
|
+
className: _("cursor-pointer", I),
|
|
109
|
+
suffix: /* @__PURE__ */ g("div", { className: "flex items-center gap-1", children: [
|
|
110
|
+
n?.from && !o ? /* @__PURE__ */ g(C, { children: [
|
|
111
|
+
/* @__PURE__ */ r(x, { 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(), R();
|
|
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(b, { variant: "tertiary", side: "top", children: a("calendar.clear") })
|
|
125
|
+
] }) : null,
|
|
126
|
+
/* @__PURE__ */ g(C, { children: [
|
|
127
|
+
/* @__PURE__ */ r(x, { asChild: !0, children: /* @__PURE__ */ r(
|
|
128
|
+
"button",
|
|
129
|
+
{
|
|
130
|
+
type: "button",
|
|
131
|
+
tabIndex: 0,
|
|
132
|
+
"data-component": "calendar-trigger",
|
|
133
|
+
"aria-label": a("datePicker.selectQuarterRange"),
|
|
134
|
+
onClick: (e) => {
|
|
135
|
+
e.stopPropagation(), o || c((s) => !s);
|
|
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(b, { variant: "tertiary", side: "top", children: a("datePicker.selectQuarterRange") })
|
|
142
|
+
] })
|
|
143
|
+
] }),
|
|
144
|
+
...$
|
|
145
|
+
}
|
|
146
|
+
)
|
|
147
|
+
}
|
|
148
|
+
),
|
|
149
|
+
children: /* @__PURE__ */ r(
|
|
150
|
+
ee,
|
|
151
|
+
{
|
|
152
|
+
pickerType: "quarter",
|
|
153
|
+
monthMode: "range",
|
|
154
|
+
selectedQuarters: P,
|
|
155
|
+
footerFlashKey: H,
|
|
156
|
+
footerFlashTarget: L,
|
|
157
|
+
onQuarterSelect: U,
|
|
158
|
+
month: B,
|
|
159
|
+
onMonthChange: G,
|
|
160
|
+
disabled: te(N, S),
|
|
161
|
+
startMonth: v,
|
|
162
|
+
endMonth: A,
|
|
163
|
+
showFooter: l,
|
|
164
|
+
onApply: W,
|
|
165
|
+
onCancel: h,
|
|
166
|
+
onClear: R,
|
|
167
|
+
...J
|
|
168
|
+
}
|
|
169
|
+
)
|
|
170
|
+
}
|
|
171
|
+
);
|
|
172
|
+
}
|
|
173
|
+
);
|
|
174
|
+
fe.displayName = "QuarterRangePicker";
|
|
175
|
+
export {
|
|
176
|
+
fe as QuarterRangePicker
|
|
177
|
+
};
|
|
@@ -1,138 +1,143 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as W, jsx as a } from "react/jsx-runtime";
|
|
2
2
|
import * as s from "react";
|
|
3
|
-
import { Cross as
|
|
3
|
+
import { Cross as be, CalendarMonth as xe } from "impact-nova-icons";
|
|
4
4
|
import { format as j } from "date-fns";
|
|
5
|
-
import { cn as
|
|
6
|
-
import { usePickerDismissActionsRef as
|
|
7
|
-
import { Input as
|
|
8
|
-
import { Popover as
|
|
9
|
-
import { Calendar as
|
|
10
|
-
import { Tooltip as
|
|
11
|
-
import { resolveWeekSelection as
|
|
12
|
-
import { useImpactNovaI18n as
|
|
13
|
-
import { getDateFnsLocale as
|
|
14
|
-
import { coerceSingleWeekApply as
|
|
15
|
-
import { buildDateBoundsMatcher as
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
5
|
+
import { cn as Te } from "../../../lib/utils.js";
|
|
6
|
+
import { usePickerDismissActionsRef as Se, usePickerFooterDismissNudge as Ee, isDateInputInvalid as Ae, resolveSingleValueDismissFlash as Ne, handlePickerSurfacePointerDown as we, resolveDateInputOnBlur as Ve, maskDateInput as Le, parseDateInput as Oe, resolveDateInputOnEnter as Me } from "./date-input-behavior.js";
|
|
7
|
+
import { Input as je } from "../input/input.js";
|
|
8
|
+
import { Popover as Be, PopoverAnchor as ze, PopoverContent as He } from "../../feedback/popover/popover.js";
|
|
9
|
+
import { Calendar as $e } from "../../data-display/calendar/calendar.js";
|
|
10
|
+
import { Tooltip as Z, TooltipTrigger as _, TooltipContent as Y } from "../../feedback/tooltip/tooltip.js";
|
|
11
|
+
import { resolveWeekSelection as Ke } from "../../../lib/fiscal-calendar/week-selection.js";
|
|
12
|
+
import { useImpactNovaI18n as qe } from "../../../i18n/use-impact-nova-i18n.js";
|
|
13
|
+
import { getDateFnsLocale as Ge } from "../../../i18n/getDateFnsLocale.js";
|
|
14
|
+
import { coerceSingleWeekApply as Je, coerceSingleWeek as Qe } from "./calendar-selection-adapters.js";
|
|
15
|
+
import { buildDateBoundsMatcher as Ue } from "../../../lib/date-bounds-matcher.js";
|
|
16
|
+
import { fiscalCalendarPassThrough as Xe } from "./fiscal-pass-through.js";
|
|
17
|
+
const F = (n, c = "MM/dd/yyyy", t) => {
|
|
18
|
+
const R = j(n.startDate, c, t ? { locale: t } : {}), b = j(n.endDate, c, t ? { locale: t } : {});
|
|
19
|
+
return `${R} - ${b}`;
|
|
20
|
+
}, g = (n, c, t) => n ? j(n.startDate, c, t ? { locale: t } : {}) : "", Ze = s.forwardRef(
|
|
20
21
|
({
|
|
21
22
|
value: n,
|
|
22
23
|
onChange: c,
|
|
23
24
|
format: t = "MM/dd/yyyy",
|
|
24
|
-
placeholder:
|
|
25
|
-
minDate:
|
|
26
|
-
maxDate:
|
|
27
|
-
startMonth:
|
|
28
|
-
endMonth:
|
|
25
|
+
placeholder: R,
|
|
26
|
+
minDate: b,
|
|
27
|
+
maxDate: ee,
|
|
28
|
+
startMonth: te,
|
|
29
|
+
endMonth: ne,
|
|
29
30
|
showFooter: l = !0,
|
|
30
|
-
|
|
31
|
-
fiscalMode:
|
|
32
|
-
|
|
31
|
+
calendarKind: I,
|
|
32
|
+
fiscalMode: x = "basic",
|
|
33
|
+
granularity: T,
|
|
33
34
|
fiscalMonthPattern: S,
|
|
34
35
|
fiscalYearStartMonth: E = 1,
|
|
36
|
+
fiscalConfig: re,
|
|
35
37
|
weekStartsOn: A = 1,
|
|
38
|
+
showPresets: se,
|
|
39
|
+
comparison: oe,
|
|
40
|
+
onComparisonChange: ie,
|
|
36
41
|
disabled: p,
|
|
37
|
-
className:
|
|
38
|
-
...
|
|
39
|
-
},
|
|
40
|
-
const { locale: B, t: D } =
|
|
41
|
-
s.useImperativeHandle(
|
|
42
|
-
const [
|
|
43
|
-
f(n), m(
|
|
44
|
-
}, [n, t,
|
|
45
|
-
m(
|
|
46
|
-
}, [u, n, t,
|
|
42
|
+
className: ce,
|
|
43
|
+
...ae
|
|
44
|
+
}, le) => {
|
|
45
|
+
const { locale: B, t: D } = qe(), i = s.useMemo(() => Ge(B), [B]), pe = R ?? D("datePicker.selectWeek"), v = I === "fiscal", N = s.useRef(null), z = s.useRef(null), C = s.useRef(!1);
|
|
46
|
+
s.useImperativeHandle(le, () => N.current);
|
|
47
|
+
const [o, H] = s.useState(!1), $ = Se(), { footerFlashKey: ue, footerFlashTarget: fe, popoverHandlers: de } = Ee(l, o, $, z), [me, w] = s.useState(!1), [u, f] = s.useState(n), [y, m] = s.useState(""), [ke, h] = s.useState(n?.startDate || /* @__PURE__ */ new Date()), De = n ? F(n, t, i) : "", K = u ? F(u, t, i) : "", V = o || me, ye = V ? y : K, q = s.useCallback(() => {
|
|
48
|
+
f(n), m(g(n, t, i)), v || h(n?.startDate || /* @__PURE__ */ new Date());
|
|
49
|
+
}, [n, t, i, v]), P = s.useCallback(() => {
|
|
50
|
+
m(g(u ?? n, t, i)), v || h((u ?? n)?.startDate || /* @__PURE__ */ new Date());
|
|
51
|
+
}, [u, n, t, i, v]);
|
|
47
52
|
s.useEffect(() => {
|
|
48
|
-
|
|
49
|
-
}, [
|
|
50
|
-
const
|
|
53
|
+
o || f(n);
|
|
54
|
+
}, [o, n]);
|
|
55
|
+
const G = s.useRef(!1);
|
|
51
56
|
s.useEffect(() => {
|
|
52
|
-
|
|
53
|
-
}, [
|
|
57
|
+
o && !G.current && P(), G.current = o;
|
|
58
|
+
}, [o, P]);
|
|
54
59
|
const d = () => {
|
|
55
|
-
|
|
60
|
+
w(!1), H(!1);
|
|
56
61
|
}, k = (e) => {
|
|
57
62
|
if (!p) {
|
|
58
63
|
if (e) {
|
|
59
|
-
|
|
64
|
+
P(), H(!0);
|
|
60
65
|
return;
|
|
61
66
|
}
|
|
62
67
|
l || d();
|
|
63
68
|
}
|
|
64
|
-
},
|
|
65
|
-
(e) =>
|
|
66
|
-
|
|
67
|
-
fiscalMode:
|
|
68
|
-
|
|
69
|
+
}, L = s.useCallback(
|
|
70
|
+
(e) => Ke(e, {
|
|
71
|
+
calendarKind: I,
|
|
72
|
+
fiscalMode: x,
|
|
73
|
+
granularity: T,
|
|
69
74
|
fiscalMonthPattern: S,
|
|
70
75
|
fiscalYearStartMonth: E,
|
|
71
76
|
weekStartsOn: A
|
|
72
77
|
}),
|
|
73
78
|
[
|
|
74
|
-
|
|
75
|
-
b,
|
|
79
|
+
I,
|
|
76
80
|
x,
|
|
81
|
+
T,
|
|
77
82
|
S,
|
|
78
83
|
E,
|
|
79
84
|
A
|
|
80
85
|
]
|
|
81
|
-
),
|
|
82
|
-
const r =
|
|
83
|
-
f(r), r && (m(
|
|
84
|
-
},
|
|
85
|
-
const r =
|
|
86
|
+
), he = (e) => {
|
|
87
|
+
const r = Qe(e);
|
|
88
|
+
f(r), r && (m(g(r, t, i)), v || h(r.startDate)), l || (c?.(r), d());
|
|
89
|
+
}, J = (e) => {
|
|
90
|
+
const r = Je(e, u);
|
|
86
91
|
c?.(r), d();
|
|
87
|
-
},
|
|
88
|
-
|
|
89
|
-
},
|
|
92
|
+
}, O = () => {
|
|
93
|
+
q(), d();
|
|
94
|
+
}, Q = () => {
|
|
90
95
|
f(void 0), m(""), c?.(void 0), l || d();
|
|
91
|
-
},
|
|
92
|
-
const r =
|
|
93
|
-
f(r), m(
|
|
94
|
-
},
|
|
95
|
-
const r =
|
|
96
|
+
}, ge = (e) => {
|
|
97
|
+
const r = L(e);
|
|
98
|
+
f(r), m(g(r, t, i)), h(e), c?.(r), d();
|
|
99
|
+
}, ve = (e) => {
|
|
100
|
+
const r = Le(e.target.value, t, y);
|
|
96
101
|
if (m(r), r === "") {
|
|
97
102
|
f(void 0), l || c?.(void 0);
|
|
98
103
|
return;
|
|
99
104
|
}
|
|
100
|
-
const { parsed:
|
|
101
|
-
if (
|
|
102
|
-
const
|
|
103
|
-
f(
|
|
105
|
+
const { parsed: M, isValid: Re } = Oe(r, t, i);
|
|
106
|
+
if (Re && M) {
|
|
107
|
+
const X = L(M);
|
|
108
|
+
f(X), h(M), l || c?.(X);
|
|
104
109
|
}
|
|
105
|
-
},
|
|
106
|
-
if (
|
|
107
|
-
const e =
|
|
110
|
+
}, Ce = () => {
|
|
111
|
+
if (w(!1), o) return;
|
|
112
|
+
const e = Ve(
|
|
108
113
|
y,
|
|
109
114
|
t,
|
|
110
|
-
|
|
111
|
-
|
|
115
|
+
g(u ?? n, t, i),
|
|
116
|
+
i
|
|
112
117
|
);
|
|
113
118
|
if (e.resetToCommitted) {
|
|
114
|
-
|
|
119
|
+
q();
|
|
115
120
|
return;
|
|
116
121
|
}
|
|
117
122
|
if (e.parsed) {
|
|
118
|
-
const r =
|
|
119
|
-
f(r), m(
|
|
123
|
+
const r = L(e.parsed);
|
|
124
|
+
f(r), m(g(r, t, i)), l || c?.(r);
|
|
120
125
|
return;
|
|
121
126
|
}
|
|
122
127
|
y || (f(void 0), l || c?.(void 0));
|
|
123
|
-
},
|
|
124
|
-
if (
|
|
125
|
-
|
|
128
|
+
}, Ie = () => {
|
|
129
|
+
if (o && l) {
|
|
130
|
+
J();
|
|
126
131
|
return;
|
|
127
132
|
}
|
|
128
|
-
const e =
|
|
133
|
+
const e = Me(y, t, i);
|
|
129
134
|
if (e.parsed) {
|
|
130
|
-
l &&
|
|
135
|
+
l && ge(e.parsed);
|
|
131
136
|
return;
|
|
132
137
|
}
|
|
133
|
-
|
|
134
|
-
},
|
|
135
|
-
() =>
|
|
138
|
+
o || (C.current = !0, k(!0));
|
|
139
|
+
}, U = De !== K, Pe = V && Ae(y, t, i), We = s.useCallback(
|
|
140
|
+
() => Ne(
|
|
136
141
|
u,
|
|
137
142
|
n,
|
|
138
143
|
(e, r) => e.startDate.getTime() === r.startDate.getTime()
|
|
@@ -140,122 +145,128 @@ const Y = (n, c = "MM/dd/yyyy", t) => {
|
|
|
140
145
|
[u, n]
|
|
141
146
|
);
|
|
142
147
|
return s.useLayoutEffect(() => {
|
|
143
|
-
|
|
144
|
-
onDismiss:
|
|
145
|
-
resolveFlash:
|
|
148
|
+
$.current = {
|
|
149
|
+
onDismiss: O,
|
|
150
|
+
resolveFlash: We
|
|
146
151
|
};
|
|
147
|
-
}), /* @__PURE__ */
|
|
148
|
-
/* @__PURE__ */ a(
|
|
152
|
+
}), /* @__PURE__ */ W(Be, { open: p ? !1 : o, onOpenChange: k, children: [
|
|
153
|
+
/* @__PURE__ */ a(ze, { asChild: !0, children: /* @__PURE__ */ a(
|
|
149
154
|
"div",
|
|
150
155
|
{
|
|
151
|
-
ref:
|
|
156
|
+
ref: z,
|
|
152
157
|
"data-component": "week-picker",
|
|
153
|
-
"data-state":
|
|
154
|
-
"data-pending":
|
|
155
|
-
onPointerDown: (e) =>
|
|
158
|
+
"data-state": o ? "open" : "closed",
|
|
159
|
+
"data-pending": U || void 0,
|
|
160
|
+
onPointerDown: (e) => we({
|
|
156
161
|
disabled: p,
|
|
157
162
|
event: e,
|
|
158
163
|
onOpen: () => k(!0),
|
|
159
164
|
focusField: () => N.current?.focus()
|
|
160
165
|
}),
|
|
161
166
|
children: /* @__PURE__ */ a(
|
|
162
|
-
|
|
167
|
+
je,
|
|
163
168
|
{
|
|
164
169
|
ref: N,
|
|
165
|
-
value:
|
|
166
|
-
onChange:
|
|
170
|
+
value: ye,
|
|
171
|
+
onChange: ve,
|
|
167
172
|
onFocus: () => {
|
|
168
|
-
p || (
|
|
173
|
+
p || (w(!0), P());
|
|
169
174
|
},
|
|
170
|
-
onBlur:
|
|
175
|
+
onBlur: Ce,
|
|
171
176
|
onClick: () => !p && k(!0),
|
|
172
177
|
onKeyDown: (e) => {
|
|
173
|
-
e.key === "Enter" && !p && (e.preventDefault(),
|
|
178
|
+
e.key === "Enter" && !p && (e.preventDefault(), Ie()), e.key === "ArrowDown" && !o && !p && (e.preventDefault(), C.current = !0, k(!0)), e.key === "Escape" && o && (e.preventDefault(), O());
|
|
174
179
|
},
|
|
175
|
-
placeholder:
|
|
180
|
+
placeholder: V ? t : pe,
|
|
176
181
|
disabled: p,
|
|
177
182
|
"data-form-control": "input",
|
|
178
|
-
className:
|
|
183
|
+
className: Te(
|
|
179
184
|
"cursor-pointer",
|
|
180
|
-
|
|
181
|
-
|
|
185
|
+
Pe ? "text-destructive" : U ? "text-content-placeholder" : "",
|
|
186
|
+
ce
|
|
182
187
|
),
|
|
183
|
-
suffix: /* @__PURE__ */
|
|
184
|
-
n && !p && /* @__PURE__ */
|
|
185
|
-
/* @__PURE__ */ a(
|
|
188
|
+
suffix: /* @__PURE__ */ W("div", { className: "flex items-center gap-1", children: [
|
|
189
|
+
n && !p && /* @__PURE__ */ W(Z, { children: [
|
|
190
|
+
/* @__PURE__ */ a(_, { asChild: !0, children: /* @__PURE__ */ a(
|
|
186
191
|
"button",
|
|
187
192
|
{
|
|
188
193
|
type: "button",
|
|
189
194
|
tabIndex: 0,
|
|
190
195
|
"aria-label": D("calendar.clear"),
|
|
191
196
|
onClick: (e) => {
|
|
192
|
-
e.stopPropagation(),
|
|
197
|
+
e.stopPropagation(), Q();
|
|
193
198
|
},
|
|
194
199
|
className: "inline-flex size-4 items-center justify-center bg-transparent border-none p-0 cursor-pointer",
|
|
195
|
-
children: /* @__PURE__ */ a(
|
|
200
|
+
children: /* @__PURE__ */ a(be, { className: "size-3 hover:text-content" })
|
|
196
201
|
}
|
|
197
202
|
) }),
|
|
198
|
-
/* @__PURE__ */ a(
|
|
203
|
+
/* @__PURE__ */ a(Y, { variant: "tertiary", side: "top", children: D("calendar.clear") })
|
|
199
204
|
] }),
|
|
200
|
-
/* @__PURE__ */
|
|
201
|
-
/* @__PURE__ */ a(
|
|
205
|
+
/* @__PURE__ */ W(Z, { children: [
|
|
206
|
+
/* @__PURE__ */ a(_, { asChild: !0, children: /* @__PURE__ */ a(
|
|
202
207
|
"button",
|
|
203
208
|
{
|
|
204
209
|
type: "button",
|
|
205
210
|
tabIndex: 0,
|
|
206
211
|
"aria-label": D("datePicker.selectWeek"),
|
|
207
212
|
onClick: (e) => {
|
|
208
|
-
e.stopPropagation(), p || (
|
|
213
|
+
e.stopPropagation(), p || (o ? d() : k(!0));
|
|
209
214
|
},
|
|
210
215
|
onKeyDown: (e) => {
|
|
211
|
-
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), e.stopPropagation(), p || (
|
|
216
|
+
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), e.stopPropagation(), p || (C.current = !0, o ? d() : k(!0)));
|
|
212
217
|
},
|
|
213
218
|
className: "inline-flex items-center justify-center bg-transparent border-none p-0 cursor-pointer",
|
|
214
|
-
children: /* @__PURE__ */ a(
|
|
219
|
+
children: /* @__PURE__ */ a(xe, { className: "h-4 w-4 text-secondary-foreground" })
|
|
215
220
|
}
|
|
216
221
|
) }),
|
|
217
|
-
/* @__PURE__ */ a(
|
|
222
|
+
/* @__PURE__ */ a(Y, { variant: "tertiary", side: "top", children: D("datePicker.selectWeek") })
|
|
218
223
|
] })
|
|
219
224
|
] }),
|
|
220
|
-
...
|
|
225
|
+
...ae
|
|
221
226
|
}
|
|
222
227
|
)
|
|
223
228
|
}
|
|
224
229
|
) }),
|
|
225
230
|
/* @__PURE__ */ a(
|
|
226
|
-
|
|
231
|
+
He,
|
|
227
232
|
{
|
|
228
233
|
className: "w-auto p-0",
|
|
229
234
|
align: "start",
|
|
230
235
|
"aria-label": D("datePicker.selectWeek"),
|
|
231
236
|
onOpenAutoFocus: (e) => {
|
|
232
|
-
|
|
237
|
+
C.current || e.preventDefault(), C.current = !1;
|
|
233
238
|
},
|
|
234
|
-
...
|
|
239
|
+
...de,
|
|
235
240
|
children: /* @__PURE__ */ a(
|
|
236
|
-
|
|
241
|
+
$e,
|
|
237
242
|
{
|
|
238
243
|
pickerType: "week",
|
|
239
244
|
weekMode: "single",
|
|
240
245
|
selectedWeeks: u,
|
|
241
|
-
footerFlashKey:
|
|
242
|
-
footerFlashTarget:
|
|
243
|
-
onWeekSelect:
|
|
244
|
-
month:
|
|
245
|
-
onMonthChange:
|
|
246
|
-
disabled:
|
|
247
|
-
startMonth:
|
|
248
|
-
endMonth:
|
|
246
|
+
footerFlashKey: ue,
|
|
247
|
+
footerFlashTarget: fe,
|
|
248
|
+
onWeekSelect: he,
|
|
249
|
+
month: ke,
|
|
250
|
+
onMonthChange: h,
|
|
251
|
+
disabled: Ue(b, ee),
|
|
252
|
+
startMonth: te,
|
|
253
|
+
endMonth: ne,
|
|
249
254
|
showFooter: l,
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
255
|
+
...Xe({
|
|
256
|
+
calendarKind: I,
|
|
257
|
+
fiscalMode: x,
|
|
258
|
+
granularity: T,
|
|
259
|
+
fiscalMonthPattern: S,
|
|
260
|
+
fiscalYearStartMonth: E,
|
|
261
|
+
fiscalConfig: re,
|
|
262
|
+
weekStartsOn: A,
|
|
263
|
+
showPresets: se,
|
|
264
|
+
comparison: oe,
|
|
265
|
+
onComparisonChange: ie
|
|
266
|
+
}),
|
|
267
|
+
onApply: J,
|
|
268
|
+
onCancel: O,
|
|
269
|
+
onClear: Q,
|
|
259
270
|
captionLayout: "dropdown"
|
|
260
271
|
}
|
|
261
272
|
)
|
|
@@ -264,7 +275,7 @@ const Y = (n, c = "MM/dd/yyyy", t) => {
|
|
|
264
275
|
] });
|
|
265
276
|
}
|
|
266
277
|
);
|
|
267
|
-
|
|
278
|
+
Ze.displayName = "WeekPicker";
|
|
268
279
|
export {
|
|
269
|
-
|
|
280
|
+
Ze as WeekPicker
|
|
270
281
|
};
|