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