impact-nova 2.5.6 → 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 +82 -51
- 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 +199 -98
- package/dist/components/data-display/calendar/calendar-day-picker-view.d.ts +12 -4
- package/dist/components/data-display/calendar/calendar-day-picker-view.js +139 -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 +50 -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 +32 -12
- package/dist/components/data-display/calendar/use-calendar-state.js +371 -164
- 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/flows/guidance/guidance-error-boundary.js +22 -14
- package/dist/components/flows/guidance/guidance-layer.js +34 -32
- package/dist/components/flows/guidance/help-center/assets/whats-new-guide-icon.svg.js +4 -0
- package/dist/components/flows/guidance/help-center/filter-help-center-guides.js +10 -7
- package/dist/components/flows/guidance/help-center/guide-catalog-section.d.ts +7 -0
- package/dist/components/flows/guidance/help-center/guide-catalog-section.js +24 -0
- package/dist/components/flows/guidance/help-center/guide-catalog-utils.d.ts +3 -0
- package/dist/components/flows/guidance/help-center/guide-catalog-utils.js +19 -0
- package/dist/components/flows/guidance/help-center/guide-catalog.d.ts +1 -1
- package/dist/components/flows/guidance/help-center/guide-catalog.js +89 -79
- package/dist/components/flows/guidance/help-center/help-center-guide-labels.d.ts +6 -0
- package/dist/components/flows/guidance/help-center/help-center-guide-labels.js +33 -0
- package/dist/components/flows/guidance/help-center/help-center-guide-row.d.ts +12 -0
- package/dist/components/flows/guidance/help-center/help-center-guide-row.js +57 -0
- package/dist/components/flows/guidance/help-center/help-center-guide-type-icons.d.ts +9 -0
- package/dist/components/flows/guidance/help-center/help-center-guide-type-icons.js +114 -0
- package/dist/components/flows/guidance/help-center/help-center-header.d.ts +1 -1
- package/dist/components/flows/guidance/help-center/help-center-header.js +20 -16
- package/dist/components/flows/guidance/help-center/help-center.constants.d.ts +1 -1
- package/dist/components/flows/guidance/help-center/help-center.constants.js +1 -1
- package/dist/components/flows/guidance/help-center/help-center.d.ts +3 -1
- package/dist/components/flows/guidance/help-center/help-center.js +74 -51
- package/dist/components/flows/guidance/help-center/help-center.types.d.ts +9 -1
- package/dist/components/flows/guidance/help-center/renderHelpCenterGuideTypeIcon.d.ts +4 -0
- package/dist/components/flows/guidance/help-center/renderHelpCenterGuideTypeIcon.js +18 -0
- package/dist/components/flows/guidance/help-center.d.ts +4 -2
- package/dist/components/flows/guidance/help-center.js +23 -14
- package/dist/components/flows/guidance/hooks/useGuidanceOverlayGeometry.js +19 -17
- package/dist/components/flows/guidance/index.d.ts +1 -1
- package/dist/components/flows/guidance/renderers/announcement-renderer.d.ts +1 -1
- package/dist/components/flows/guidance/renderers/announcement-renderer.js +20 -12
- package/dist/components/flows/guidance/renderers/guidance-card-shared.d.ts +9 -11
- package/dist/components/flows/guidance/renderers/guidance-card-shared.js +124 -177
- package/dist/components/flows/guidance/renderers/guidance-renderer-shared.d.ts +1 -1
- package/dist/components/flows/guidance/renderers/guidance-renderer-shared.js +57 -72
- package/dist/components/flows/guidance/renderers/guidance-tour-overlay.js +23 -23
- package/dist/components/flows/wizard/wizard.js +41 -38
- 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/layout/horizontal-scroller/horizontal-scroller.js +35 -53
- 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 +11 -12
- 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 +22 -7
- package/dist/form-react/utils/date.utils.d.ts +3 -1
- package/dist/form-react/utils/date.utils.js +82 -53
- package/dist/i18n/defaultMessages.d.ts +29 -1
- package/dist/i18n/defaultMessages.js +54 -27
- package/dist/i18n/locales/de.js +31 -4
- package/dist/i18n/locales/es.js +31 -4
- package/dist/i18n/locales/hi.js +31 -4
- package/dist/i18n/locales/kn.js +31 -4
- 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/lib/guidance/engine/guidance-engine.d.ts +7 -5
- package/dist/lib/guidance/engine/guidance-engine.js +115 -47
- package/dist/lib/guidance/triggers/trigger-registry.js +6 -6
- package/dist/lib/guidance/types/guidance.types.d.ts +11 -1
- package/dist/llms/rules/installation.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,12 +1,12 @@
|
|
|
1
1
|
import { parse as h, isValid as D } from "date-fns";
|
|
2
2
|
import * as d from "react";
|
|
3
|
-
import { resolveRangeFooterFlashTarget as
|
|
4
|
-
import { padValidDateString as
|
|
5
|
-
function
|
|
3
|
+
import { resolveRangeFooterFlashTarget as y } from "../../data-display/calendar/calendar-footer-emphasis.js";
|
|
4
|
+
import { padValidDateString as v, maskDate as k } from "../../../lib/utils.js";
|
|
5
|
+
function I(e, t, n) {
|
|
6
6
|
return k(e, t, n);
|
|
7
7
|
}
|
|
8
8
|
function f(e, t, n) {
|
|
9
|
-
const r =
|
|
9
|
+
const r = v(e, t), s = h(r, t, /* @__PURE__ */ new Date(), n ? { locale: n } : {}), a = D(s) && r.length === t.length;
|
|
10
10
|
return {
|
|
11
11
|
padded: r,
|
|
12
12
|
parsed: a ? s : void 0,
|
|
@@ -14,7 +14,7 @@ function f(e, t, n) {
|
|
|
14
14
|
isValid: a
|
|
15
15
|
};
|
|
16
16
|
}
|
|
17
|
-
function
|
|
17
|
+
function T(e, t, n) {
|
|
18
18
|
return !e || e.length !== t.length ? !1 : !f(e, t, n).isValid;
|
|
19
19
|
}
|
|
20
20
|
function m(e, t) {
|
|
@@ -42,7 +42,10 @@ function O(e, t) {
|
|
|
42
42
|
const n = e.target;
|
|
43
43
|
return n instanceof Node ? !!t.current?.contains(n) : !1;
|
|
44
44
|
}
|
|
45
|
-
function V({
|
|
45
|
+
function V(e, t) {
|
|
46
|
+
t.disabled || (e.key === "ArrowDown" && !t.open && (e.preventDefault(), t.onKeyboardOpen?.(), t.onOpen()), e.key === "Escape" && t.open && (e.preventDefault(), t.onCancel()));
|
|
47
|
+
}
|
|
48
|
+
function b({
|
|
46
49
|
disabled: e,
|
|
47
50
|
event: t,
|
|
48
51
|
onOpen: n,
|
|
@@ -74,11 +77,11 @@ function F(e, t, n, r) {
|
|
|
74
77
|
} : void 0
|
|
75
78
|
} : {};
|
|
76
79
|
}
|
|
77
|
-
function
|
|
80
|
+
function B(e, t, n) {
|
|
78
81
|
const r = e == null, s = t == null;
|
|
79
82
|
return r && s || !r && !s && n(e, t) ? "dismiss" : r ? "cancel" : "apply";
|
|
80
83
|
}
|
|
81
|
-
function
|
|
84
|
+
function q(e) {
|
|
82
85
|
const {
|
|
83
86
|
startInput: t,
|
|
84
87
|
endInput: n,
|
|
@@ -89,18 +92,18 @@ function B(e) {
|
|
|
89
92
|
computeEffectiveRange: u,
|
|
90
93
|
rangesEqual: o
|
|
91
94
|
} = e, c = t !== r || n !== s, l = u(), p = !c && i !== void 0 ? i : l, g = !o(p, a);
|
|
92
|
-
return !c && !g ? "dismiss" :
|
|
95
|
+
return !c && !g ? "dismiss" : y(
|
|
93
96
|
c ? l : p
|
|
94
97
|
) === "apply" ? "apply" : "cancel";
|
|
95
98
|
}
|
|
96
|
-
function
|
|
99
|
+
function M() {
|
|
97
100
|
return d.useRef({
|
|
98
101
|
onDismiss: () => {
|
|
99
102
|
},
|
|
100
103
|
resolveFlash: () => "cancel"
|
|
101
104
|
});
|
|
102
105
|
}
|
|
103
|
-
function
|
|
106
|
+
function K(e, t, n, r) {
|
|
104
107
|
const [s, a] = d.useState({ key: 0, target: "cancel" }), i = d.useRef(t);
|
|
105
108
|
d.useLayoutEffect(() => {
|
|
106
109
|
i.current !== t && (i.current = t, a({ key: 0, target: "cancel" }));
|
|
@@ -152,13 +155,13 @@ function x(e, t, n) {
|
|
|
152
155
|
function H(e, t, n) {
|
|
153
156
|
return e === void 0 || t === void 0 ? { from: e, to: t, swapped: !1 } : n(e, t) <= 0 ? { from: e, to: t, swapped: !1 } : { from: t, to: e, swapped: !0 };
|
|
154
157
|
}
|
|
155
|
-
function
|
|
158
|
+
function L(e, t) {
|
|
156
159
|
return e.year * 12 + e.month - (t.year * 12 + t.month);
|
|
157
160
|
}
|
|
158
|
-
function
|
|
161
|
+
function z(e, t) {
|
|
159
162
|
return e.getTime() - t.getTime();
|
|
160
163
|
}
|
|
161
|
-
function
|
|
164
|
+
function W(e) {
|
|
162
165
|
if (!e || typeof window < "u" && window.matchMedia("(prefers-reduced-motion: reduce)").matches)
|
|
163
166
|
return;
|
|
164
167
|
const t = e.querySelector('[data-field="start"]'), n = e.querySelector('[data-field="end"]');
|
|
@@ -173,24 +176,25 @@ function z(e) {
|
|
|
173
176
|
));
|
|
174
177
|
}
|
|
175
178
|
export {
|
|
176
|
-
|
|
177
|
-
|
|
179
|
+
z as compareDates,
|
|
180
|
+
L as compareMonthSelection,
|
|
178
181
|
S as createRangePickerOpenChangeHandler,
|
|
179
182
|
N as deferRangeInputBlur,
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
+
W as flashRangeReorder,
|
|
184
|
+
b as handlePickerSurfacePointerDown,
|
|
185
|
+
V as handleReadonlyPickerKeyDown,
|
|
186
|
+
T as isDateInputInvalid,
|
|
183
187
|
O as isEventOnPickerSurface,
|
|
184
188
|
m as isFocusInsidePicker,
|
|
185
|
-
|
|
189
|
+
I as maskDateInput,
|
|
186
190
|
H as normalizeOrderedRange,
|
|
187
191
|
f as parseDateInput,
|
|
188
192
|
F as preventOutsideDismissWhenFooter,
|
|
189
193
|
P as resolveDateInputOnBlur,
|
|
190
194
|
x as resolveDateInputOnEnter,
|
|
191
195
|
X as resolveRangeFieldBlur,
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
+
q as resolveRangePickerDismissFlash,
|
|
197
|
+
B as resolveSingleValueDismissFlash,
|
|
198
|
+
M as usePickerDismissActionsRef,
|
|
199
|
+
K as usePickerFooterDismissNudge
|
|
196
200
|
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { PopoverContent } from '../../feedback/popover';
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
export interface DatePickerShellProps {
|
|
4
|
+
open: boolean;
|
|
5
|
+
disabled?: boolean | null;
|
|
6
|
+
ariaLabel: string;
|
|
7
|
+
onOpenChange: (open: boolean) => void;
|
|
8
|
+
onOpenAutoFocus?: (event: Event) => void;
|
|
9
|
+
popoverHandlers?: React.ComponentProps<typeof PopoverContent>;
|
|
10
|
+
children: React.ReactNode;
|
|
11
|
+
trigger: React.ReactNode;
|
|
12
|
+
}
|
|
13
|
+
export declare function DatePickerShell({ open, disabled, ariaLabel, onOpenChange, onOpenAutoFocus, popoverHandlers, children, trigger, }: DatePickerShellProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { jsxs as s, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
3
|
+
import { Popover as c, PopoverAnchor as m, PopoverContent as h } from "../../feedback/popover/popover.js";
|
|
4
|
+
function d({
|
|
5
|
+
open: o,
|
|
6
|
+
disabled: e,
|
|
7
|
+
ariaLabel: t,
|
|
8
|
+
onOpenChange: a,
|
|
9
|
+
onOpenAutoFocus: i,
|
|
10
|
+
popoverHandlers: l,
|
|
11
|
+
children: n,
|
|
12
|
+
trigger: p
|
|
13
|
+
}) {
|
|
14
|
+
return /* @__PURE__ */ s(c, { open: e ? !1 : o, onOpenChange: a, children: [
|
|
15
|
+
/* @__PURE__ */ r(m, { asChild: !0, children: p }),
|
|
16
|
+
/* @__PURE__ */ r(
|
|
17
|
+
h,
|
|
18
|
+
{
|
|
19
|
+
className: "w-auto p-0",
|
|
20
|
+
align: "start",
|
|
21
|
+
"aria-label": t,
|
|
22
|
+
onOpenAutoFocus: i,
|
|
23
|
+
...l,
|
|
24
|
+
children: n
|
|
25
|
+
}
|
|
26
|
+
)
|
|
27
|
+
] });
|
|
28
|
+
}
|
|
29
|
+
export {
|
|
30
|
+
d as DatePickerShell
|
|
31
|
+
};
|
|
@@ -1,69 +1,79 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsx as s, jsxs as S } from "react/jsx-runtime";
|
|
2
2
|
import * as r from "react";
|
|
3
|
-
import { Cross as
|
|
4
|
-
import { format as
|
|
5
|
-
import { cn as
|
|
6
|
-
import { usePickerDismissActionsRef as
|
|
7
|
-
import { Input as
|
|
8
|
-
import {
|
|
9
|
-
import { Calendar as Ie } from "../../data-display/calendar/calendar.js";
|
|
3
|
+
import { Cross as he, CalendarMonth as De } from "impact-nova-icons";
|
|
4
|
+
import { format as b } from "date-fns";
|
|
5
|
+
import { cn as ge } from "../../../lib/utils.js";
|
|
6
|
+
import { usePickerDismissActionsRef as ye, usePickerFooterDismissNudge as ke, isDateInputInvalid as ve, resolveSingleValueDismissFlash as Ie, handlePickerSurfacePointerDown as Ce, maskDateInput as Pe, parseDateInput as Me, resolveDateInputOnBlur as xe, resolveDateInputOnEnter as Re } from "./date-input-behavior.js";
|
|
7
|
+
import { Input as Se } from "../input/input.js";
|
|
8
|
+
import { Calendar as be } from "../../data-display/calendar/calendar.js";
|
|
10
9
|
import { Tooltip as j, TooltipTrigger as B, TooltipContent as K } from "../../feedback/tooltip/tooltip.js";
|
|
11
|
-
import { useImpactNovaI18n as
|
|
12
|
-
import { getDateFnsLocale as
|
|
13
|
-
import { createComponent as
|
|
14
|
-
import { coerceSingleDateApply as
|
|
15
|
-
import { buildDateBoundsMatcher as
|
|
16
|
-
|
|
10
|
+
import { useImpactNovaI18n as we } from "../../../i18n/use-impact-nova-i18n.js";
|
|
11
|
+
import { getDateFnsLocale as Te } from "../../../i18n/getDateFnsLocale.js";
|
|
12
|
+
import { createComponent as Ee } from "../../../lib/primitives/create-component.js";
|
|
13
|
+
import { coerceSingleDateApply as Ae, coerceSingleDate as Ne } from "./calendar-selection-adapters.js";
|
|
14
|
+
import { buildDateBoundsMatcher as Le } from "../../../lib/date-bounds-matcher.js";
|
|
15
|
+
import { fiscalCalendarPassThrough as Oe } from "./fiscal-pass-through.js";
|
|
16
|
+
import { DatePickerShell as Ve } from "./date-picker-shell.js";
|
|
17
|
+
const $e = Ee(
|
|
17
18
|
"DatePicker",
|
|
18
19
|
({
|
|
19
20
|
value: n,
|
|
20
|
-
onChange:
|
|
21
|
-
format:
|
|
21
|
+
onChange: p,
|
|
22
|
+
format: l = "MM/dd/yyyy",
|
|
22
23
|
placeholder: z,
|
|
23
24
|
minDate: H,
|
|
24
25
|
maxDate: q,
|
|
25
26
|
startMonth: G,
|
|
26
27
|
endMonth: J,
|
|
27
28
|
showFooter: a = !0,
|
|
28
|
-
weekStartsOn:
|
|
29
|
-
disabled:
|
|
29
|
+
weekStartsOn: w,
|
|
30
|
+
disabled: c,
|
|
30
31
|
className: Q,
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
32
|
+
calendarKind: U,
|
|
33
|
+
fiscalMode: W,
|
|
34
|
+
granularity: X,
|
|
35
|
+
fiscalMonthPattern: Y,
|
|
36
|
+
fiscalYearStartMonth: Z,
|
|
37
|
+
fiscalConfig: _,
|
|
38
|
+
showPresets: $,
|
|
39
|
+
comparison: F,
|
|
40
|
+
onComparisonChange: ee,
|
|
41
|
+
...te
|
|
42
|
+
}, ne) => {
|
|
43
|
+
const { locale: T, t: h } = we(), f = r.useMemo(() => Te(T), [T]), re = z ?? h("datePicker.selectDate"), g = r.useRef(null), E = r.useRef(null), C = r.useRef(null);
|
|
44
|
+
r.useImperativeHandle(ne, () => g.current);
|
|
45
|
+
const [i, A] = r.useState(!1), N = ye(), { footerFlashKey: ie, footerFlashTarget: oe, popoverHandlers: se } = ke(a, i, N, E), y = r.useRef(!1), [x, o] = r.useState(null), k = n ? b(n, l, { locale: f }) : "", d = x?.input ?? k, P = i ? x?.pending ?? n : n, ce = x?.viewMonth ?? n ?? /* @__PURE__ */ new Date(), u = r.useCallback(() => {
|
|
46
|
+
o(null), A(!1);
|
|
37
47
|
}, []), m = (e) => {
|
|
38
|
-
if (!
|
|
48
|
+
if (!c) {
|
|
39
49
|
if (e) {
|
|
40
|
-
|
|
50
|
+
o({
|
|
41
51
|
input: k,
|
|
42
52
|
pending: n,
|
|
43
53
|
viewMonth: n ?? /* @__PURE__ */ new Date()
|
|
44
|
-
}),
|
|
54
|
+
}), A(!0);
|
|
45
55
|
return;
|
|
46
56
|
}
|
|
47
|
-
|
|
57
|
+
u();
|
|
48
58
|
}
|
|
49
59
|
};
|
|
50
60
|
r.useEffect(() => {
|
|
51
|
-
g.current &&
|
|
61
|
+
g.current && C.current !== null && (g.current.setSelectionRange(C.current, C.current), C.current = null);
|
|
52
62
|
}, [d]);
|
|
53
|
-
const
|
|
54
|
-
const t =
|
|
55
|
-
|
|
63
|
+
const le = (e) => {
|
|
64
|
+
const t = Ne(e), D = t ? b(t, l, { locale: f }) : "";
|
|
65
|
+
o(
|
|
56
66
|
(v) => v ? { ...v, pending: t, input: D, viewMonth: t ?? v.viewMonth } : null
|
|
57
|
-
), t && !a && (
|
|
58
|
-
},
|
|
59
|
-
const t =
|
|
60
|
-
|
|
61
|
-
},
|
|
62
|
-
|
|
63
|
-
},
|
|
64
|
-
|
|
67
|
+
), t && !a && (p?.(t), u());
|
|
68
|
+
}, L = (e) => {
|
|
69
|
+
const t = Ae(e, P);
|
|
70
|
+
p?.(t), u();
|
|
71
|
+
}, R = () => {
|
|
72
|
+
u();
|
|
73
|
+
}, O = () => {
|
|
74
|
+
p?.(void 0), a ? o(
|
|
65
75
|
(e) => e ? { ...e, pending: void 0, input: "" } : null
|
|
66
|
-
) :
|
|
76
|
+
) : u();
|
|
67
77
|
}, M = r.useCallback(
|
|
68
78
|
() => ({
|
|
69
79
|
input: k,
|
|
@@ -71,59 +81,59 @@ const Ge = xe(
|
|
|
71
81
|
viewMonth: n ?? /* @__PURE__ */ new Date()
|
|
72
82
|
}),
|
|
73
83
|
[k, n]
|
|
74
|
-
),
|
|
75
|
-
const t =
|
|
76
|
-
if (
|
|
77
|
-
|
|
84
|
+
), ae = (e) => {
|
|
85
|
+
const t = Pe(e.target.value, l, d);
|
|
86
|
+
if (o((I) => ({ ...I ?? M(), input: t })), t === "") {
|
|
87
|
+
o((I) => ({ ...I ?? M(), input: "", pending: void 0 })), a || p?.(void 0);
|
|
78
88
|
return;
|
|
79
89
|
}
|
|
80
|
-
const { parsed: D, isValid: v } =
|
|
81
|
-
v && D && (
|
|
82
|
-
...
|
|
90
|
+
const { parsed: D, isValid: v } = Me(t, l, f);
|
|
91
|
+
v && D && (o((I) => ({
|
|
92
|
+
...I ?? M(),
|
|
83
93
|
input: t,
|
|
84
94
|
pending: D,
|
|
85
95
|
viewMonth: D
|
|
86
|
-
})), a ||
|
|
87
|
-
},
|
|
96
|
+
})), a || p?.(D));
|
|
97
|
+
}, ue = r.useCallback(
|
|
88
98
|
(e) => {
|
|
89
|
-
|
|
99
|
+
p?.(e), u();
|
|
90
100
|
},
|
|
91
|
-
[
|
|
92
|
-
),
|
|
101
|
+
[p, u]
|
|
102
|
+
), pe = () => {
|
|
93
103
|
if (i) return;
|
|
94
|
-
const e =
|
|
104
|
+
const e = xe(
|
|
95
105
|
d,
|
|
96
|
-
|
|
106
|
+
l,
|
|
97
107
|
k,
|
|
98
108
|
f
|
|
99
109
|
);
|
|
100
110
|
if (e.resetToCommitted) {
|
|
101
|
-
|
|
111
|
+
o(null);
|
|
102
112
|
return;
|
|
103
113
|
}
|
|
104
114
|
if (e.parsed) {
|
|
105
|
-
|
|
115
|
+
o((t) => ({
|
|
106
116
|
...t ?? M(),
|
|
107
117
|
input: e.display,
|
|
108
118
|
pending: e.parsed,
|
|
109
119
|
viewMonth: e.parsed
|
|
110
|
-
})), a || (
|
|
120
|
+
})), a || (p?.(e.parsed), o(null));
|
|
111
121
|
return;
|
|
112
122
|
}
|
|
113
|
-
|
|
114
|
-
},
|
|
123
|
+
o(null);
|
|
124
|
+
}, fe = () => {
|
|
115
125
|
if (i && a) {
|
|
116
|
-
|
|
126
|
+
L();
|
|
117
127
|
return;
|
|
118
128
|
}
|
|
119
|
-
const e =
|
|
129
|
+
const e = Re(d, l, f);
|
|
120
130
|
if (e.parsed) {
|
|
121
|
-
a &&
|
|
131
|
+
a && ue(e.parsed);
|
|
122
132
|
return;
|
|
123
133
|
}
|
|
124
134
|
i || (y.current = !0, m(!0));
|
|
125
|
-
},
|
|
126
|
-
() =>
|
|
135
|
+
}, V = (n ? b(n, l, { locale: f }) : "") !== d, de = ve(d, l, f), me = r.useCallback(
|
|
136
|
+
() => Ie(
|
|
127
137
|
P,
|
|
128
138
|
n,
|
|
129
139
|
(e, t) => e.getTime() === t.getTime()
|
|
@@ -132,111 +142,121 @@ const Ge = xe(
|
|
|
132
142
|
);
|
|
133
143
|
return r.useLayoutEffect(() => {
|
|
134
144
|
N.current = {
|
|
135
|
-
onDismiss:
|
|
136
|
-
resolveFlash:
|
|
145
|
+
onDismiss: R,
|
|
146
|
+
resolveFlash: me
|
|
137
147
|
};
|
|
138
|
-
}), /* @__PURE__ */
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
148
|
+
}), /* @__PURE__ */ s(
|
|
149
|
+
Ve,
|
|
150
|
+
{
|
|
151
|
+
open: i,
|
|
152
|
+
disabled: c,
|
|
153
|
+
ariaLabel: h("datePicker.selectDate"),
|
|
154
|
+
onOpenChange: m,
|
|
155
|
+
onOpenAutoFocus: (e) => {
|
|
156
|
+
y.current || e.preventDefault(), y.current = !1;
|
|
157
|
+
},
|
|
158
|
+
popoverHandlers: se,
|
|
159
|
+
trigger: /* @__PURE__ */ s(
|
|
160
|
+
"div",
|
|
161
|
+
{
|
|
162
|
+
ref: E,
|
|
163
|
+
"data-component": "date-picker",
|
|
164
|
+
"data-state": i ? "open" : "closed",
|
|
165
|
+
"data-pending": V || void 0,
|
|
166
|
+
onPointerDown: (e) => Ce({
|
|
167
|
+
disabled: c,
|
|
168
|
+
event: e,
|
|
169
|
+
onOpen: () => m(!0),
|
|
170
|
+
focusField: () => g.current?.focus()
|
|
171
|
+
}),
|
|
172
|
+
children: /* @__PURE__ */ s(
|
|
173
|
+
Se,
|
|
174
|
+
{
|
|
175
|
+
ref: g,
|
|
176
|
+
value: d,
|
|
177
|
+
onChange: ae,
|
|
178
|
+
onBlur: pe,
|
|
179
|
+
onClick: () => !c && m(!0),
|
|
180
|
+
onKeyDown: (e) => {
|
|
181
|
+
e.key === "Enter" && !c && (e.preventDefault(), fe()), e.key === "ArrowDown" && !i && !c && (e.preventDefault(), y.current = !0, m(!0)), e.key === "Escape" && i && (e.preventDefault(), R());
|
|
182
|
+
},
|
|
183
|
+
placeholder: i ? l : re,
|
|
184
|
+
disabled: c,
|
|
185
|
+
"data-form-control": "input",
|
|
186
|
+
className: ge(
|
|
187
|
+
"cursor-pointer",
|
|
188
|
+
de ? "text-destructive" : V ? "text-content-placeholder" : "",
|
|
189
|
+
Q
|
|
190
|
+
),
|
|
191
|
+
suffix: /* @__PURE__ */ S("div", { className: "flex items-center gap-1", children: [
|
|
192
|
+
n && !c && /* @__PURE__ */ S(j, { children: [
|
|
193
|
+
/* @__PURE__ */ s(B, { asChild: !0, children: /* @__PURE__ */ s(
|
|
194
|
+
"button",
|
|
195
|
+
{
|
|
196
|
+
type: "button",
|
|
197
|
+
tabIndex: 0,
|
|
198
|
+
"aria-label": h("calendar.clear"),
|
|
199
|
+
onClick: (e) => {
|
|
200
|
+
e.stopPropagation(), O();
|
|
201
|
+
},
|
|
202
|
+
className: "inline-flex size-4 items-center justify-center bg-transparent border-none p-0 cursor-pointer",
|
|
203
|
+
children: /* @__PURE__ */ s(he, { className: "size-3 hover:text-content" })
|
|
204
|
+
}
|
|
205
|
+
) }),
|
|
206
|
+
/* @__PURE__ */ s(K, { variant: "tertiary", side: "top", children: h("calendar.clear") })
|
|
207
|
+
] }),
|
|
208
|
+
/* @__PURE__ */ S(j, { children: [
|
|
209
|
+
/* @__PURE__ */ s(B, { asChild: !0, children: /* @__PURE__ */ s("button", { type: "button", tabIndex: 0, "aria-label": h("datePicker.selectDate"), onClick: (e) => {
|
|
210
|
+
e.stopPropagation(), c || (i ? u() : m(!0));
|
|
211
|
+
}, onKeyDown: (e) => {
|
|
212
|
+
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), e.stopPropagation(), c || (y.current = !0, i ? u() : m(!0)));
|
|
213
|
+
}, className: "inline-flex items-center justify-center bg-transparent border-none p-0 cursor-pointer", children: /* @__PURE__ */ s(De, { className: "h-4 w-4 text-secondary-foreground" }) }) }),
|
|
214
|
+
/* @__PURE__ */ s(K, { variant: "tertiary", side: "top", children: h("datePicker.selectDate") })
|
|
215
|
+
] })
|
|
187
216
|
] }),
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
{
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
onCancel: b,
|
|
230
|
-
onClear: V,
|
|
231
|
-
captionLayout: "dropdown",
|
|
232
|
-
...S !== void 0 ? { weekStartsOn: S } : {}
|
|
233
|
-
}
|
|
234
|
-
)
|
|
235
|
-
}
|
|
236
|
-
)
|
|
237
|
-
] });
|
|
217
|
+
...te
|
|
218
|
+
}
|
|
219
|
+
)
|
|
220
|
+
}
|
|
221
|
+
),
|
|
222
|
+
children: /* @__PURE__ */ s(
|
|
223
|
+
be,
|
|
224
|
+
{
|
|
225
|
+
mode: "single",
|
|
226
|
+
selected: P,
|
|
227
|
+
footerFlashKey: ie,
|
|
228
|
+
footerFlashTarget: oe,
|
|
229
|
+
onSelect: le,
|
|
230
|
+
month: ce,
|
|
231
|
+
onMonthChange: (e) => o(
|
|
232
|
+
(t) => t ? { ...t, viewMonth: e } : null
|
|
233
|
+
),
|
|
234
|
+
disabled: Le(H, q),
|
|
235
|
+
startMonth: G,
|
|
236
|
+
endMonth: J,
|
|
237
|
+
showFooter: a,
|
|
238
|
+
onApply: L,
|
|
239
|
+
onCancel: R,
|
|
240
|
+
onClear: O,
|
|
241
|
+
captionLayout: "dropdown",
|
|
242
|
+
...w !== void 0 ? { weekStartsOn: w } : {},
|
|
243
|
+
...Oe({
|
|
244
|
+
calendarKind: U,
|
|
245
|
+
fiscalMode: W,
|
|
246
|
+
granularity: X,
|
|
247
|
+
fiscalMonthPattern: Y,
|
|
248
|
+
fiscalYearStartMonth: Z,
|
|
249
|
+
fiscalConfig: _,
|
|
250
|
+
showPresets: $,
|
|
251
|
+
comparison: F,
|
|
252
|
+
onComparisonChange: ee
|
|
253
|
+
})
|
|
254
|
+
}
|
|
255
|
+
)
|
|
256
|
+
}
|
|
257
|
+
);
|
|
238
258
|
}
|
|
239
259
|
);
|
|
240
260
|
export {
|
|
241
|
-
|
|
261
|
+
$e as DatePicker
|
|
242
262
|
};
|