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
|
@@ -2,113 +2,120 @@ import { jsxs as k, jsx as s } from "react/jsx-runtime";
|
|
|
2
2
|
import * as o from "react";
|
|
3
3
|
import { Cross as _, CalendarMonth as ee } from "impact-nova-icons";
|
|
4
4
|
import { cn as te } from "../../../lib/utils.js";
|
|
5
|
-
import { usePickerDismissActionsRef as ne, usePickerFooterDismissNudge as re, isDateInputInvalid as oe,
|
|
6
|
-
import { Input as
|
|
7
|
-
import { Popover as
|
|
8
|
-
import { Calendar as
|
|
9
|
-
import { Tooltip as E, TooltipTrigger as
|
|
10
|
-
import { useImpactNovaI18n as
|
|
11
|
-
import { coerceSingleMonthApply as
|
|
12
|
-
import { buildDateBoundsMatcher as
|
|
13
|
-
const u = (
|
|
5
|
+
import { usePickerDismissActionsRef as ne, usePickerFooterDismissNudge as re, isDateInputInvalid as oe, resolveSingleValueDismissFlash as se, compareMonthSelection as ie, resolveDateInputOnBlur as ae, maskDateInput as ce, parseDateInput as le, resolveDateInputOnEnter as pe } from "./date-input-behavior.js";
|
|
6
|
+
import { Input as fe } from "../input/input.js";
|
|
7
|
+
import { Popover as de, PopoverAnchor as me, PopoverContent as ue } from "../../feedback/popover/popover.js";
|
|
8
|
+
import { Calendar as he } from "../../data-display/calendar/calendar.js";
|
|
9
|
+
import { Tooltip as E, TooltipTrigger as V, TooltipContent as b } from "../../feedback/tooltip/tooltip.js";
|
|
10
|
+
import { useImpactNovaI18n as ye } from "../../../i18n/use-impact-nova-i18n.js";
|
|
11
|
+
import { coerceSingleMonthApply as Me, coerceSingleMonth as ge } from "./calendar-selection-adapters.js";
|
|
12
|
+
import { buildDateBoundsMatcher as De } from "../../../lib/date-bounds-matcher.js";
|
|
13
|
+
const u = (t) => `${(t.month + 1).toString().padStart(2, "0")}/${t.year}`, ke = o.forwardRef(
|
|
14
14
|
({
|
|
15
|
-
value:
|
|
15
|
+
value: t,
|
|
16
16
|
onChange: p,
|
|
17
|
-
placeholder:
|
|
18
|
-
minDate:
|
|
17
|
+
placeholder: v,
|
|
18
|
+
minDate: w,
|
|
19
19
|
maxDate: B,
|
|
20
20
|
startMonth: O,
|
|
21
21
|
endMonth: Y,
|
|
22
22
|
showFooter: i = !0,
|
|
23
23
|
disabled: f,
|
|
24
24
|
className: j,
|
|
25
|
-
...
|
|
26
|
-
},
|
|
27
|
-
const { t: d } =
|
|
28
|
-
o.useImperativeHandle(
|
|
29
|
-
const [r, c] = o.useState(!1), R = ne(), { footerFlashKey: H, footerFlashTarget: $, popoverHandlers: L } = re(i, r, R,
|
|
25
|
+
...F
|
|
26
|
+
}, K) => {
|
|
27
|
+
const { t: d } = ye(), z = v ?? d("datePicker.selectMonth"), C = o.useRef(null), P = o.useRef(null);
|
|
28
|
+
o.useImperativeHandle(K, () => C.current);
|
|
29
|
+
const [r, c] = o.useState(!1), R = ne(), { footerFlashKey: H, footerFlashTarget: $, popoverHandlers: L } = re(i, r, R, P), [y, a] = o.useState(t), [m, l] = o.useState(t ? u(t) : ""), [q, I] = o.useState(t ? new Date(t.year, t.month) : /* @__PURE__ */ new Date());
|
|
30
30
|
o.useEffect(() => {
|
|
31
|
-
r || (l(
|
|
32
|
-
}, [r,
|
|
33
|
-
r && (a(
|
|
34
|
-
}, [r,
|
|
35
|
-
const G = (
|
|
36
|
-
const n =
|
|
31
|
+
r || (l(t ? u(t) : ""), a(t));
|
|
32
|
+
}, [r, t]), o.useEffect(() => {
|
|
33
|
+
r && (a(t), I(t ? new Date(t.year, t.month) : /* @__PURE__ */ new Date()), l(t ? u(t) : ""));
|
|
34
|
+
}, [r, t]);
|
|
35
|
+
const G = (e) => {
|
|
36
|
+
const n = ge(e);
|
|
37
37
|
a(n), n && l(u(n)), i || (p?.(n), c(!1));
|
|
38
|
-
}, x = (
|
|
39
|
-
const n =
|
|
38
|
+
}, x = (e) => {
|
|
39
|
+
const n = Me(e, y);
|
|
40
40
|
p?.(n), c(!1);
|
|
41
|
-
},
|
|
42
|
-
a(
|
|
41
|
+
}, S = () => {
|
|
42
|
+
a(t), l(t ? u(t) : ""), c(!1);
|
|
43
43
|
}, A = () => {
|
|
44
44
|
a(void 0), l(""), p?.(void 0), i || c(!1);
|
|
45
|
-
},
|
|
46
|
-
const n =
|
|
45
|
+
}, h = "MM/yyyy", M = t ? u(t) : "", g = o.useRef(!1), J = (e) => {
|
|
46
|
+
const n = ce(e.target.value, h, m);
|
|
47
47
|
if (l(n), n === "") {
|
|
48
48
|
a(void 0), i || p?.(void 0);
|
|
49
49
|
return;
|
|
50
50
|
}
|
|
51
|
-
const { parsed: D, isValid: Z } =
|
|
51
|
+
const { parsed: D, isValid: Z } = le(n, h);
|
|
52
52
|
if (Z && D) {
|
|
53
53
|
const T = { month: D.getMonth(), year: D.getFullYear() };
|
|
54
54
|
a(T), I(D), i || p?.(T);
|
|
55
55
|
}
|
|
56
56
|
}, Q = () => {
|
|
57
57
|
if (r) return;
|
|
58
|
-
const
|
|
59
|
-
if (
|
|
60
|
-
l(M), a(
|
|
58
|
+
const e = ae(m, h, M);
|
|
59
|
+
if (e.resetToCommitted) {
|
|
60
|
+
l(M), a(t);
|
|
61
61
|
return;
|
|
62
62
|
}
|
|
63
|
-
if (
|
|
64
|
-
const n = { month:
|
|
65
|
-
l(
|
|
63
|
+
if (e.parsed) {
|
|
64
|
+
const n = { month: e.parsed.getMonth(), year: e.parsed.getFullYear() };
|
|
65
|
+
l(e.display), a(n), i || p?.(n);
|
|
66
66
|
return;
|
|
67
67
|
}
|
|
68
|
-
l(M), a(
|
|
68
|
+
l(M), a(t);
|
|
69
69
|
}, U = () => {
|
|
70
70
|
if (r && i) {
|
|
71
71
|
x();
|
|
72
72
|
return;
|
|
73
73
|
}
|
|
74
|
-
const
|
|
75
|
-
if (
|
|
74
|
+
const e = pe(m, h);
|
|
75
|
+
if (e.parsed) {
|
|
76
76
|
const n = {
|
|
77
|
-
month:
|
|
78
|
-
year:
|
|
77
|
+
month: e.parsed.getMonth(),
|
|
78
|
+
year: e.parsed.getFullYear()
|
|
79
79
|
};
|
|
80
80
|
i && (p?.(n), c(!1));
|
|
81
81
|
return;
|
|
82
82
|
}
|
|
83
83
|
r || (g.current = !0, c(!0));
|
|
84
|
-
}, N = M !== m, W = oe(m,
|
|
84
|
+
}, N = M !== m, W = oe(m, h), X = o.useCallback(
|
|
85
|
+
() => se(
|
|
86
|
+
y,
|
|
87
|
+
t,
|
|
88
|
+
(e, n) => ie(e, n) === 0
|
|
89
|
+
),
|
|
90
|
+
[y, t]
|
|
91
|
+
);
|
|
85
92
|
return o.useLayoutEffect(() => {
|
|
86
93
|
R.current = {
|
|
87
|
-
onDismiss:
|
|
94
|
+
onDismiss: S,
|
|
88
95
|
resolveFlash: X
|
|
89
96
|
};
|
|
90
|
-
}), /* @__PURE__ */ k(
|
|
91
|
-
f || !
|
|
97
|
+
}), /* @__PURE__ */ k(de, { open: f ? !1 : r, onOpenChange: (e) => {
|
|
98
|
+
f || !e && i || c(e);
|
|
92
99
|
}, children: [
|
|
93
|
-
/* @__PURE__ */ s(
|
|
100
|
+
/* @__PURE__ */ s(me, { asChild: !0, children: /* @__PURE__ */ s(
|
|
94
101
|
"div",
|
|
95
102
|
{
|
|
96
|
-
ref:
|
|
103
|
+
ref: P,
|
|
97
104
|
"data-component": "month-picker",
|
|
98
105
|
"data-state": r ? "open" : "closed",
|
|
99
106
|
"data-pending": N || void 0,
|
|
100
107
|
children: /* @__PURE__ */ s(
|
|
101
|
-
|
|
108
|
+
fe,
|
|
102
109
|
{
|
|
103
|
-
ref:
|
|
110
|
+
ref: C,
|
|
104
111
|
value: m,
|
|
105
112
|
onChange: J,
|
|
106
113
|
onBlur: Q,
|
|
107
114
|
onClick: () => !f && c(!0),
|
|
108
|
-
onKeyDown: (
|
|
109
|
-
|
|
115
|
+
onKeyDown: (e) => {
|
|
116
|
+
e.key === "Enter" && !f && (e.preventDefault(), U()), e.key === "ArrowDown" && !r && !f && (e.preventDefault(), g.current = !0, c(!0)), e.key === "Escape" && r && (e.preventDefault(), S());
|
|
110
117
|
},
|
|
111
|
-
placeholder: r ? d("datePicker.monthYearFormat") :
|
|
118
|
+
placeholder: r ? d("datePicker.monthYearFormat") : z,
|
|
112
119
|
disabled: f,
|
|
113
120
|
"data-form-control": "input",
|
|
114
121
|
className: te(
|
|
@@ -117,59 +124,59 @@ const u = (e) => `${(e.month + 1).toString().padStart(2, "0")}/${e.year}`, De =
|
|
|
117
124
|
j
|
|
118
125
|
),
|
|
119
126
|
suffix: /* @__PURE__ */ k("div", { className: "flex items-center gap-1", children: [
|
|
120
|
-
|
|
121
|
-
/* @__PURE__ */ s(
|
|
127
|
+
t && !f && /* @__PURE__ */ k(E, { children: [
|
|
128
|
+
/* @__PURE__ */ s(V, { asChild: !0, children: /* @__PURE__ */ s(
|
|
122
129
|
"button",
|
|
123
130
|
{
|
|
124
131
|
type: "button",
|
|
125
132
|
tabIndex: 0,
|
|
126
133
|
"aria-label": d("calendar.clear"),
|
|
127
|
-
onClick: (
|
|
128
|
-
|
|
134
|
+
onClick: (e) => {
|
|
135
|
+
e.stopPropagation(), A();
|
|
129
136
|
},
|
|
130
137
|
className: "inline-flex size-4 items-center justify-center bg-transparent border-none p-0 cursor-pointer",
|
|
131
138
|
children: /* @__PURE__ */ s(_, { className: "size-3 hover:text-content" })
|
|
132
139
|
}
|
|
133
140
|
) }),
|
|
134
|
-
/* @__PURE__ */ s(
|
|
141
|
+
/* @__PURE__ */ s(b, { variant: "tertiary", side: "top", children: d("calendar.clear") })
|
|
135
142
|
] }),
|
|
136
143
|
/* @__PURE__ */ k(E, { children: [
|
|
137
|
-
/* @__PURE__ */ s(
|
|
138
|
-
/* @__PURE__ */ s(
|
|
144
|
+
/* @__PURE__ */ s(V, { asChild: !0, children: /* @__PURE__ */ s(ee, { className: "h-4 w-4 text-secondary-foreground" }) }),
|
|
145
|
+
/* @__PURE__ */ s(b, { variant: "tertiary", side: "top", children: d("datePicker.selectMonth") })
|
|
139
146
|
] })
|
|
140
147
|
] }),
|
|
141
|
-
...
|
|
148
|
+
...F
|
|
142
149
|
}
|
|
143
150
|
)
|
|
144
151
|
}
|
|
145
152
|
) }),
|
|
146
153
|
/* @__PURE__ */ s(
|
|
147
|
-
|
|
154
|
+
ue,
|
|
148
155
|
{
|
|
149
156
|
className: "w-auto p-0",
|
|
150
157
|
align: "start",
|
|
151
158
|
"aria-label": d("datePicker.selectMonth"),
|
|
152
|
-
onOpenAutoFocus: (
|
|
153
|
-
g.current ||
|
|
159
|
+
onOpenAutoFocus: (e) => {
|
|
160
|
+
g.current || e.preventDefault(), g.current = !1;
|
|
154
161
|
},
|
|
155
162
|
...L,
|
|
156
163
|
children: /* @__PURE__ */ s(
|
|
157
|
-
|
|
164
|
+
he,
|
|
158
165
|
{
|
|
159
166
|
pickerType: "month",
|
|
160
167
|
monthMode: "single",
|
|
161
|
-
selectedMonths:
|
|
168
|
+
selectedMonths: y,
|
|
162
169
|
footerFlashKey: H,
|
|
163
170
|
footerFlashTarget: $,
|
|
164
171
|
onMonthSelect: G,
|
|
165
172
|
month: q,
|
|
166
173
|
onMonthChange: I,
|
|
167
|
-
disabled:
|
|
174
|
+
disabled: De(w, B),
|
|
168
175
|
startMonth: O,
|
|
169
176
|
endMonth: Y,
|
|
170
177
|
showFooter: i,
|
|
171
178
|
onApply: x,
|
|
172
|
-
onCancel:
|
|
179
|
+
onCancel: S,
|
|
173
180
|
onClear: A
|
|
174
181
|
}
|
|
175
182
|
)
|
|
@@ -178,7 +185,7 @@ const u = (e) => `${(e.month + 1).toString().padStart(2, "0")}/${e.year}`, De =
|
|
|
178
185
|
] });
|
|
179
186
|
}
|
|
180
187
|
);
|
|
181
|
-
|
|
188
|
+
ke.displayName = "MonthPicker";
|
|
182
189
|
export {
|
|
183
|
-
|
|
190
|
+
ke as MonthPicker
|
|
184
191
|
};
|
|
@@ -33,7 +33,7 @@ const Ze = s.forwardRef(
|
|
|
33
33
|
startMonth: ae,
|
|
34
34
|
endMonth: ce,
|
|
35
35
|
showFooter: g = !0,
|
|
36
|
-
disabled:
|
|
36
|
+
disabled: f,
|
|
37
37
|
className: fe,
|
|
38
38
|
error: de,
|
|
39
39
|
isError: le,
|
|
@@ -53,75 +53,75 @@ const Ze = s.forwardRef(
|
|
|
53
53
|
helperTextPosition: ue,
|
|
54
54
|
error: q,
|
|
55
55
|
required: he,
|
|
56
|
-
disabled:
|
|
56
|
+
disabled: f ?? void 0,
|
|
57
57
|
rootClassName: "w-full min-w-[240px]"
|
|
58
|
-
}), { t: x } = Je(), L = s.useRef(null), ye = s.useRef(null), G = s.useRef(null), S = s.useRef(null), K = s.useRef(null),
|
|
58
|
+
}), { t: x } = Je(), L = s.useRef(null), ye = s.useRef(null), G = s.useRef(null), S = s.useRef(null), K = s.useRef(null), d = s.useMemo(
|
|
59
59
|
() => i === "YYYY/MM" ? "yyyy/MM" : "MM/yyyy",
|
|
60
60
|
[i]
|
|
61
61
|
);
|
|
62
62
|
s.useImperativeHandle(Me, () => L.current);
|
|
63
|
-
const [m, M] = s.useState(!1), J = Ve(), { footerFlashKey: ke, footerFlashTarget: ve, popoverHandlers: xe } = Oe(g, m, J, G), w = s.useRef(!1), [
|
|
63
|
+
const [m, M] = s.useState(!1), J = Ve(), { footerFlashKey: ke, footerFlashTarget: ve, popoverHandlers: xe } = Oe(g, m, J, G), w = s.useRef(!1), [c, R] = s.useState(t), [p, k] = s.useState(t?.from ? h(t.from, i) : ""), [y, v] = s.useState(t?.to ? h(t.to, i) : ""), [Ye, P] = s.useState(() => t?.from ? new Date(t.from.year, t.from.month, 1) : b || /* @__PURE__ */ new Date());
|
|
64
64
|
s.useEffect(() => {
|
|
65
65
|
k(t?.from ? h(t.from, i) : ""), v(t?.to ? h(t.to, i) : ""), R(t);
|
|
66
66
|
}, [t, i]);
|
|
67
67
|
const Ce = s.useCallback(
|
|
68
68
|
(e) => Ke({
|
|
69
|
-
disabled:
|
|
69
|
+
disabled: f ?? void 0,
|
|
70
70
|
showFooter: g,
|
|
71
71
|
containerRef: S,
|
|
72
72
|
popoverContentRef: K,
|
|
73
73
|
setOpen: M
|
|
74
74
|
})(e),
|
|
75
|
-
[
|
|
75
|
+
[f, g]
|
|
76
76
|
), Q = s.useRef(!1);
|
|
77
77
|
s.useEffect(() => {
|
|
78
78
|
if (m && !Q.current) {
|
|
79
|
-
const e = z(p,
|
|
80
|
-
e.parsed ? P(e.parsed) :
|
|
79
|
+
const e = z(p, d);
|
|
80
|
+
e.parsed ? P(e.parsed) : c?.from ? P(new Date(c.from.year, c.from.month, 1)) : t?.from ? P(new Date(t.from.year, t.from.month, 1)) : b && P(b);
|
|
81
81
|
}
|
|
82
82
|
Q.current = m;
|
|
83
|
-
}, [m, p,
|
|
83
|
+
}, [m, p, d, c?.from, t?.from, b]);
|
|
84
84
|
const be = (e) => {
|
|
85
85
|
const r = Ue(e) ? e : void 0;
|
|
86
86
|
R(r), r?.from && k(h(r.from, i)), r?.to && v(h(r.to, i)), !g && r?.from && r?.to && (r.from.month !== r.to.month || r.from.year !== r.to.year) && (n?.(r), M(!1));
|
|
87
87
|
}, U = (e) => {
|
|
88
|
-
const r = Qe(e,
|
|
88
|
+
const r = Qe(e, c), o = F(r?.from, r?.to, O);
|
|
89
89
|
o.swapped && (o.from && k(h(o.from, i)), o.to && v(h(o.to, i)), R({ from: o.from, to: o.to }), ee(S.current)), n?.({ from: o.from, to: o.to }), M(!1);
|
|
90
90
|
}, B = () => {
|
|
91
91
|
R(t), k(t?.from ? h(t.from, i) : ""), v(t?.to ? h(t.to, i) : ""), M(!1);
|
|
92
92
|
}, j = () => {
|
|
93
93
|
R(void 0), k(""), v(""), n?.(void 0), g || M(!1);
|
|
94
94
|
}, Ie = (e) => {
|
|
95
|
-
const r = re(e.target.value,
|
|
95
|
+
const r = re(e.target.value, d, p);
|
|
96
96
|
if (k(r), r === "") {
|
|
97
|
-
const l = { from: void 0, to:
|
|
97
|
+
const l = { from: void 0, to: c?.to };
|
|
98
98
|
R(l), g || n?.(l);
|
|
99
99
|
return;
|
|
100
100
|
}
|
|
101
|
-
const { parsed: o, isValid: a } = z(r,
|
|
101
|
+
const { parsed: o, isValid: a } = z(r, d);
|
|
102
102
|
if (a && o) {
|
|
103
|
-
const T = { from: I(o), to:
|
|
103
|
+
const T = { from: I(o), to: c?.to };
|
|
104
104
|
R(T), P(o), g || n?.(T);
|
|
105
105
|
}
|
|
106
106
|
}, Pe = (e) => {
|
|
107
|
-
const r = re(e.target.value,
|
|
107
|
+
const r = re(e.target.value, d, y);
|
|
108
108
|
if (v(r), r === "") {
|
|
109
|
-
const l = { from:
|
|
109
|
+
const l = { from: c?.from, to: void 0 };
|
|
110
110
|
R(l), g || n?.(l);
|
|
111
111
|
return;
|
|
112
112
|
}
|
|
113
|
-
const { parsed: o, isValid: a } = z(r,
|
|
113
|
+
const { parsed: o, isValid: a } = z(r, d);
|
|
114
114
|
if (a && o) {
|
|
115
|
-
const l = I(o), T = { from:
|
|
115
|
+
const l = I(o), T = { from: c?.from, to: l };
|
|
116
116
|
R(T), P(o), g || n?.(T);
|
|
117
117
|
}
|
|
118
118
|
}, N = s.useCallback((e, r) => {
|
|
119
119
|
const o = F(e, r, O);
|
|
120
120
|
return o.swapped && (o.from && k(h(o.from, i)), o.to && v(h(o.to, i)), ee(S.current)), { from: o.from, to: o.to };
|
|
121
121
|
}, [i]), we = () => {
|
|
122
|
-
const e = V(p,
|
|
122
|
+
const e = V(p, d, Y), r = V(y, d, C);
|
|
123
123
|
e.resetToCommitted ? k(Y) : e.parsed && k(e.display), r.resetToCommitted ? v(C) : r.parsed && v(r.display);
|
|
124
|
-
let o = e.parsed ? I(e.parsed) :
|
|
124
|
+
let o = e.parsed ? I(e.parsed) : c?.from, a = r.parsed ? I(r.parsed) : c?.to;
|
|
125
125
|
if ({ from: o, to: a } = N(o, a), o || a) {
|
|
126
126
|
const l = { from: o, to: a };
|
|
127
127
|
R(l), n?.(l);
|
|
@@ -131,9 +131,9 @@ const Ze = s.forwardRef(
|
|
|
131
131
|
S,
|
|
132
132
|
K,
|
|
133
133
|
() => {
|
|
134
|
-
const e = A(p,
|
|
134
|
+
const e = A(p, d, Y), r = A(y, d, C);
|
|
135
135
|
e.resetToCommitted ? k(Y) : e.parsed && k(e.display), r.resetToCommitted ? v(C) : r.parsed && v(r.display);
|
|
136
|
-
let o = e.parsed ? I(e.parsed) : e.resetToCommitted ? t?.from :
|
|
136
|
+
let o = e.parsed ? I(e.parsed) : e.resetToCommitted ? t?.from : c?.from, a = r.parsed ? I(r.parsed) : r.resetToCommitted ? t?.to : c?.to;
|
|
137
137
|
o && a && ({ from: o, to: a } = N(o, a));
|
|
138
138
|
const l = o || a ? { from: o, to: a } : void 0;
|
|
139
139
|
R(l), g || (l ? n?.(l) : !p && !y && n?.(void 0));
|
|
@@ -149,13 +149,13 @@ const Ze = s.forwardRef(
|
|
|
149
149
|
we();
|
|
150
150
|
return;
|
|
151
151
|
}
|
|
152
|
-
const e = V(p,
|
|
152
|
+
const e = V(p, d, Y), r = V(y, d, C);
|
|
153
153
|
if (e.parsed || r.parsed) return;
|
|
154
154
|
w.current = !0, M(!0);
|
|
155
155
|
}
|
|
156
|
-
}, Y = t?.from ? h(t.from, i) : "", C = t?.to ? h(t.to, i) : "", De = p !== Y, Ee = y !== C, Se = te(p,
|
|
157
|
-
const e = A(p,
|
|
158
|
-
let o = e.parsed ? I(e.parsed) : e.resetToCommitted ? t?.from :
|
|
156
|
+
}, Y = t?.from ? h(t.from, i) : "", C = t?.to ? h(t.to, i) : "", De = p !== Y, Ee = y !== C, Se = te(p, d), Te = te(y, d), Z = x("datePicker.startMonth"), _ = x("datePicker.endMonth"), Be = s.useCallback(() => {
|
|
157
|
+
const e = A(p, d, Y), r = A(y, d, C);
|
|
158
|
+
let o = e.parsed ? I(e.parsed) : e.resetToCommitted ? t?.from : c?.from, a = r.parsed ? I(r.parsed) : r.resetToCommitted ? t?.to : c?.to;
|
|
159
159
|
o && a && ({ from: o, to: a } = N(o, a));
|
|
160
160
|
const l = o || a ? { from: o, to: a } : void 0;
|
|
161
161
|
return je({
|
|
@@ -164,6 +164,7 @@ const Ze = s.forwardRef(
|
|
|
164
164
|
committedStart: Y,
|
|
165
165
|
committedEnd: C,
|
|
166
166
|
committedRange: t,
|
|
167
|
+
pendingRange: c,
|
|
167
168
|
computeEffectiveRange: () => l,
|
|
168
169
|
rangesEqual: Xe
|
|
169
170
|
});
|
|
@@ -173,8 +174,8 @@ const Ze = s.forwardRef(
|
|
|
173
174
|
Y,
|
|
174
175
|
C,
|
|
175
176
|
t,
|
|
177
|
+
c,
|
|
176
178
|
d,
|
|
177
|
-
f,
|
|
178
179
|
N
|
|
179
180
|
]);
|
|
180
181
|
return s.useLayoutEffect(() => {
|
|
@@ -187,9 +188,9 @@ const Ze = s.forwardRef(
|
|
|
187
188
|
{
|
|
188
189
|
ref: G,
|
|
189
190
|
"data-component": "month-range-picker",
|
|
190
|
-
"data-disabled":
|
|
191
|
+
"data-disabled": f || void 0,
|
|
191
192
|
children: Re.wrapControl(
|
|
192
|
-
/* @__PURE__ */ D(He, { open:
|
|
193
|
+
/* @__PURE__ */ D(He, { open: f ? !1 : m, onOpenChange: Ce, children: [
|
|
193
194
|
/* @__PURE__ */ u(qe, { asChild: !0, children: /* @__PURE__ */ D(
|
|
194
195
|
"div",
|
|
195
196
|
{
|
|
@@ -199,7 +200,7 @@ const Ze = s.forwardRef(
|
|
|
199
200
|
"flex w-full items-center justify-between gap-2 rounded-md border bg-canvas-elevated px-3 text-sm shadow-sm transition-colors hover:border-brand disabled:cursor-not-allowed disabled:bg-disabled-surface disabled:text-disabled-foreground disabled:border-stroke",
|
|
200
201
|
q ? "border-destructive hover:border-destructive" : "border-field",
|
|
201
202
|
H === "sm" ? "h-6" : H === "md" ? "h-[28px]" : "h-8",
|
|
202
|
-
|
|
203
|
+
f && "pointer-events-none opacity-100 bg-disabled-surface border-stroke text-disabled-foreground hover:border-stroke",
|
|
203
204
|
"cursor-pointer",
|
|
204
205
|
fe
|
|
205
206
|
),
|
|
@@ -213,12 +214,12 @@ const Ze = s.forwardRef(
|
|
|
213
214
|
value: p,
|
|
214
215
|
onChange: Ie,
|
|
215
216
|
onBlur: W,
|
|
216
|
-
onClick: () => !
|
|
217
|
+
onClick: () => !f && M(!0),
|
|
217
218
|
onKeyDown: (e) => {
|
|
218
|
-
e.key === "Enter" && !
|
|
219
|
+
e.key === "Enter" && !f && (e.preventDefault(), X()), e.key === "ArrowDown" && !m && !f && (e.preventDefault(), w.current = !0, M(!0)), e.key === "Escape" && m && (e.preventDefault(), B());
|
|
219
220
|
},
|
|
220
221
|
placeholder: m ? i === "YYYY/MM" ? "YYYY/MM" : x("datePicker.monthYearFormat") : Z,
|
|
221
|
-
disabled: !!
|
|
222
|
+
disabled: !!f,
|
|
222
223
|
"aria-label": Z,
|
|
223
224
|
"data-field": "start",
|
|
224
225
|
className: $(
|
|
@@ -236,12 +237,12 @@ const Ze = s.forwardRef(
|
|
|
236
237
|
value: y,
|
|
237
238
|
onChange: Pe,
|
|
238
239
|
onBlur: W,
|
|
239
|
-
onClick: () => !
|
|
240
|
+
onClick: () => !f && M(!0),
|
|
240
241
|
onKeyDown: (e) => {
|
|
241
|
-
e.key === "Enter" && !
|
|
242
|
+
e.key === "Enter" && !f && (e.preventDefault(), X()), e.key === "ArrowDown" && !m && !f && (e.preventDefault(), w.current = !0, M(!0)), e.key === "Escape" && m && (e.preventDefault(), B());
|
|
242
243
|
},
|
|
243
244
|
placeholder: m ? i === "YYYY/MM" ? "YYYY/MM" : x("datePicker.monthYearFormat") : _,
|
|
244
|
-
disabled: !!
|
|
245
|
+
disabled: !!f,
|
|
245
246
|
"aria-label": _,
|
|
246
247
|
"data-field": "end",
|
|
247
248
|
className: $(
|
|
@@ -252,7 +253,7 @@ const Ze = s.forwardRef(
|
|
|
252
253
|
)
|
|
253
254
|
] }),
|
|
254
255
|
/* @__PURE__ */ D("div", { className: "flex items-center gap-1 shrink-0", children: [
|
|
255
|
-
t?.from && !
|
|
256
|
+
t?.from && !f && /* @__PURE__ */ D(oe, { children: [
|
|
256
257
|
/* @__PURE__ */ u(ne, { asChild: !0, children: /* @__PURE__ */ u(
|
|
257
258
|
"button",
|
|
258
259
|
{
|
|
@@ -273,9 +274,9 @@ const Ze = s.forwardRef(
|
|
|
273
274
|
] }),
|
|
274
275
|
/* @__PURE__ */ D(oe, { children: [
|
|
275
276
|
/* @__PURE__ */ u(ne, { asChild: !0, children: /* @__PURE__ */ u("button", { type: "button", tabIndex: 0, "aria-label": x("datePicker.selectMonthRange"), onClick: (e) => {
|
|
276
|
-
e.stopPropagation(),
|
|
277
|
+
e.stopPropagation(), f || M(!m);
|
|
277
278
|
}, onKeyDown: (e) => {
|
|
278
|
-
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), e.stopPropagation(),
|
|
279
|
+
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), e.stopPropagation(), f || (w.current = !0, M(!m)));
|
|
279
280
|
}, className: "inline-flex items-center justify-center bg-transparent border-none p-0 cursor-pointer", children: /* @__PURE__ */ u(Ae, { className: "h-4 w-4 text-secondary-foreground" }) }) }),
|
|
280
281
|
/* @__PURE__ */ u(se, { variant: "tertiary", side: "top", children: x("datePicker.selectMonthRange") })
|
|
281
282
|
] })
|
|
@@ -299,7 +300,7 @@ const Ze = s.forwardRef(
|
|
|
299
300
|
{
|
|
300
301
|
pickerType: "month",
|
|
301
302
|
monthMode: "range",
|
|
302
|
-
selectedMonths:
|
|
303
|
+
selectedMonths: c,
|
|
303
304
|
footerFlashKey: ke,
|
|
304
305
|
footerFlashTarget: ve,
|
|
305
306
|
onMonthSelect: be,
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { jsxs as m, jsx as r } from "react/jsx-runtime";
|
|
2
2
|
import * as o from "react";
|
|
3
|
-
import { Cross as
|
|
4
|
-
import { format as
|
|
5
|
-
import { cn as
|
|
6
|
-
import { Input as
|
|
7
|
-
import { Popover as
|
|
8
|
-
import { Calendar as
|
|
3
|
+
import { Cross as $, CalendarMonth as q } from "impact-nova-icons";
|
|
4
|
+
import { format as G } from "date-fns";
|
|
5
|
+
import { cn as J } from "../../../lib/utils.js";
|
|
6
|
+
import { Input as Q } from "../input/input.js";
|
|
7
|
+
import { Popover as U, PopoverAnchor as W, PopoverContent as X } from "../../feedback/popover/popover.js";
|
|
8
|
+
import { Calendar as Y } from "../../data-display/calendar/calendar.js";
|
|
9
9
|
import { Tooltip as D, TooltipTrigger as P, TooltipContent as k } from "../../feedback/tooltip/tooltip.js";
|
|
10
|
-
import { useImpactNovaI18n as
|
|
11
|
-
import { getDateFnsLocale as
|
|
12
|
-
import { coerceDateArrayApply as
|
|
13
|
-
import { usePickerDismissActionsRef as
|
|
14
|
-
import { buildDateBoundsMatcher as
|
|
15
|
-
const
|
|
10
|
+
import { useImpactNovaI18n as Z } from "../../../i18n/use-impact-nova-i18n.js";
|
|
11
|
+
import { getDateFnsLocale as _ } from "../../../i18n/getDateFnsLocale.js";
|
|
12
|
+
import { coerceDateArrayApply as w, coerceDateArray as ee } from "./calendar-selection-adapters.js";
|
|
13
|
+
import { usePickerDismissActionsRef as te, usePickerFooterDismissNudge as re } from "./date-input-behavior.js";
|
|
14
|
+
import { buildDateBoundsMatcher as oe } from "../../../lib/date-bounds-matcher.js";
|
|
15
|
+
const ne = o.forwardRef(
|
|
16
16
|
({
|
|
17
17
|
value: e,
|
|
18
18
|
onChange: f,
|
|
@@ -27,36 +27,36 @@ const se = o.forwardRef(
|
|
|
27
27
|
className: R,
|
|
28
28
|
...L
|
|
29
29
|
}, v) => {
|
|
30
|
-
const { locale: u, t: i } =
|
|
30
|
+
const { locale: u, t: i } = Z(), F = o.useMemo(() => _(u), [u]), I = M ?? i("datePicker.selectMultipleDates"), [p, c] = o.useState(!1), h = o.useRef(null), y = te(), { footerFlashKey: S, footerFlashTarget: j, popoverHandlers: O } = re(s, p, y, h), [l, d] = o.useState(e);
|
|
31
31
|
o.useEffect(() => {
|
|
32
32
|
d(e);
|
|
33
33
|
}, [p, e]);
|
|
34
34
|
const z = (t) => {
|
|
35
|
-
const n =
|
|
35
|
+
const n = ee(t);
|
|
36
36
|
d(n), s || f?.(n);
|
|
37
37
|
}, E = (t) => {
|
|
38
|
-
const n =
|
|
38
|
+
const n = w(t, l);
|
|
39
39
|
f?.(n), c(!1);
|
|
40
40
|
}, g = () => {
|
|
41
41
|
d(e), c(!1);
|
|
42
42
|
}, C = () => {
|
|
43
43
|
d(void 0), f?.(void 0), s || c(!1);
|
|
44
|
-
}, B = e && e.length > 0 ? e.length === 1 ?
|
|
45
|
-
const t = l?.length ?? 0, n = e?.length ?? 0
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
44
|
+
}, B = e && e.length > 0 ? e.length === 1 ? G(e[0], A, { locale: F }) : `${e.length} dates selected` : "", H = o.useCallback(() => {
|
|
45
|
+
const t = l?.length ?? 0, n = e?.length ?? 0;
|
|
46
|
+
return t === n && (l ?? []).every(
|
|
47
|
+
(K, V) => K.getTime() === e?.[V]?.getTime()
|
|
48
|
+
) ? "dismiss" : t > 0 ? "apply" : "cancel";
|
|
49
49
|
}, [l, e]);
|
|
50
50
|
return o.useLayoutEffect(() => {
|
|
51
51
|
y.current = {
|
|
52
52
|
onDismiss: g,
|
|
53
53
|
resolveFlash: H
|
|
54
54
|
};
|
|
55
|
-
}), /* @__PURE__ */ m(
|
|
55
|
+
}), /* @__PURE__ */ m(U, { open: a ? !1 : p, onOpenChange: (t) => {
|
|
56
56
|
a || !t && s || c(t);
|
|
57
57
|
}, children: [
|
|
58
|
-
/* @__PURE__ */ r(
|
|
59
|
-
|
|
58
|
+
/* @__PURE__ */ r(W, { asChild: !0, children: /* @__PURE__ */ r("div", { ref: h, children: /* @__PURE__ */ r(
|
|
59
|
+
Q,
|
|
60
60
|
{
|
|
61
61
|
ref: v,
|
|
62
62
|
value: B,
|
|
@@ -66,7 +66,7 @@ const se = o.forwardRef(
|
|
|
66
66
|
onClick: () => {
|
|
67
67
|
!a && !p && c(!0);
|
|
68
68
|
},
|
|
69
|
-
className:
|
|
69
|
+
className: J("cursor-pointer", R),
|
|
70
70
|
suffix: /* @__PURE__ */ m("div", { className: "flex items-center gap-1", children: [
|
|
71
71
|
e && e.length > 0 && !a && /* @__PURE__ */ m(D, { children: [
|
|
72
72
|
/* @__PURE__ */ r(P, { asChild: !0, children: /* @__PURE__ */ r(
|
|
@@ -79,13 +79,13 @@ const se = o.forwardRef(
|
|
|
79
79
|
t.stopPropagation(), C();
|
|
80
80
|
},
|
|
81
81
|
className: "inline-flex size-4 items-center justify-center bg-transparent border-none p-0 cursor-pointer",
|
|
82
|
-
children: /* @__PURE__ */ r(
|
|
82
|
+
children: /* @__PURE__ */ r($, { className: "size-3 hover:text-content" })
|
|
83
83
|
}
|
|
84
84
|
) }),
|
|
85
85
|
/* @__PURE__ */ r(k, { variant: "tertiary", side: "top", children: i("calendar.clear") })
|
|
86
86
|
] }),
|
|
87
87
|
/* @__PURE__ */ m(D, { children: [
|
|
88
|
-
/* @__PURE__ */ r(P, { asChild: !0, children: /* @__PURE__ */ r(
|
|
88
|
+
/* @__PURE__ */ r(P, { asChild: !0, children: /* @__PURE__ */ r(q, { className: "h-4 w-4 text-secondary-foreground" }) }),
|
|
89
89
|
/* @__PURE__ */ r(k, { variant: "tertiary", side: "top", children: i("datePicker.selectMultipleDates") })
|
|
90
90
|
] })
|
|
91
91
|
] }),
|
|
@@ -93,7 +93,7 @@ const se = o.forwardRef(
|
|
|
93
93
|
}
|
|
94
94
|
) }) }),
|
|
95
95
|
/* @__PURE__ */ r(
|
|
96
|
-
|
|
96
|
+
X,
|
|
97
97
|
{
|
|
98
98
|
className: "w-auto p-0",
|
|
99
99
|
align: "start",
|
|
@@ -101,14 +101,14 @@ const se = o.forwardRef(
|
|
|
101
101
|
onOpenAutoFocus: (t) => t.preventDefault(),
|
|
102
102
|
...O,
|
|
103
103
|
children: /* @__PURE__ */ r(
|
|
104
|
-
|
|
104
|
+
Y,
|
|
105
105
|
{
|
|
106
106
|
mode: "multiple",
|
|
107
107
|
selected: l,
|
|
108
108
|
footerFlashKey: S,
|
|
109
109
|
footerFlashTarget: j,
|
|
110
110
|
onSelect: z,
|
|
111
|
-
disabled:
|
|
111
|
+
disabled: oe(x, N),
|
|
112
112
|
startMonth: T,
|
|
113
113
|
endMonth: b,
|
|
114
114
|
showFooter: s,
|
|
@@ -123,7 +123,7 @@ const se = o.forwardRef(
|
|
|
123
123
|
] });
|
|
124
124
|
}
|
|
125
125
|
);
|
|
126
|
-
|
|
126
|
+
ne.displayName = "MultiDatePicker";
|
|
127
127
|
export {
|
|
128
|
-
|
|
128
|
+
ne as MultiDatePicker
|
|
129
129
|
};
|