impact-nova 1.6.2 → 1.6.3
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/ui/accordion-nested-list/accordion-nested-list.js +7 -7
- package/dist/components/ui/accordion.d.ts +0 -1
- package/dist/components/ui/accordion.js +30 -33
- package/dist/components/ui/ag-grid-react/index.js +38 -35
- package/dist/components/ui/ag-grid-react/process-backend-columndefs.js +10 -10
- package/dist/components/ui/ag-grid-react/value-formatters.js +18 -18
- package/dist/components/ui/calendar.js +255 -247
- package/dist/components/ui/data-table/data-table.d.ts +0 -4
- package/dist/components/ui/data-table/data-table.js +94 -60
- package/dist/components/ui/date-picker/date-picker.js +90 -81
- package/dist/components/ui/date-picker/date-range-picker.js +144 -130
- package/dist/components/ui/date-picker/week-range-picker.js +157 -143
- package/dist/components/ui/filter-strip/filter-summary.js +161 -234
- package/dist/components/ui/filter-strip/filter-tag-list.js +97 -124
- package/dist/components/ui/horizontal-scroller/horizontal-scroller.js +29 -29
- package/dist/components/ui/select/select.js +521 -493
- package/dist/components/ui/sheet.js +71 -94
- package/dist/impact-nova.css +1 -1
- package/package.json +1 -1
|
@@ -1,219 +1,233 @@
|
|
|
1
1
|
import { jsxs as h, jsx as s } from "react/jsx-runtime";
|
|
2
|
-
import * as
|
|
3
|
-
import { X as
|
|
4
|
-
import { CalendarMonth as
|
|
5
|
-
import { format as l, isValid as
|
|
6
|
-
import { cn as
|
|
7
|
-
import { Popover as
|
|
8
|
-
import { Calendar as
|
|
9
|
-
import { Tooltip as
|
|
10
|
-
import { resolveWeekSelection as
|
|
11
|
-
import { getDateFnsLocale as
|
|
12
|
-
import { useImpactNovaI18n as
|
|
13
|
-
const
|
|
2
|
+
import * as c from "react";
|
|
3
|
+
import { X as ye } from "lucide-react";
|
|
4
|
+
import { CalendarMonth as Re, Info as ve } from "../../../icons/index.js";
|
|
5
|
+
import { format as l, isValid as P, parse as S } from "date-fns";
|
|
6
|
+
import { cn as N, padValidDateString as U, maskDate as Z } from "../../../lib/utils.js";
|
|
7
|
+
import { Popover as Pe, PopoverTrigger as Se, PopoverContent as Ne } from "../popover.js";
|
|
8
|
+
import { Calendar as Ce } from "../calendar.js";
|
|
9
|
+
import { Tooltip as $, TooltipTrigger as Y, TooltipContent as _ } from "../tooltip.js";
|
|
10
|
+
import { resolveWeekSelection as Ie } from "../../../lib/fiscal-calendar.js";
|
|
11
|
+
import { getDateFnsLocale as Ee } from "../../../i18n/getDateFnsLocale.js";
|
|
12
|
+
import { useImpactNovaI18n as We } from "../../../i18n/ImpactNovaI18nContext.js";
|
|
13
|
+
const a = (t) => t?.from ? t.to ? t.to.endDate : t.from.endDate : void 0, Ve = c.forwardRef(
|
|
14
14
|
({
|
|
15
|
-
value:
|
|
16
|
-
onChange:
|
|
17
|
-
format:
|
|
18
|
-
placeholder:
|
|
19
|
-
minDate:
|
|
20
|
-
maxDate:
|
|
21
|
-
startMonth:
|
|
22
|
-
endMonth:
|
|
23
|
-
showFooter:
|
|
24
|
-
calendarType:
|
|
25
|
-
fiscalMode:
|
|
26
|
-
selectionMode:
|
|
27
|
-
fiscalMonthPattern:
|
|
15
|
+
value: t,
|
|
16
|
+
onChange: k,
|
|
17
|
+
format: n = "MM/dd/yyyy",
|
|
18
|
+
placeholder: F,
|
|
19
|
+
minDate: ee,
|
|
20
|
+
maxDate: te,
|
|
21
|
+
startMonth: ne,
|
|
22
|
+
endMonth: oe,
|
|
23
|
+
showFooter: D = !0,
|
|
24
|
+
calendarType: A = "calendar",
|
|
25
|
+
fiscalMode: L = "basic",
|
|
26
|
+
selectionMode: j = "week",
|
|
27
|
+
fiscalMonthPattern: K,
|
|
28
28
|
fiscalYearStartMonth: M = 1,
|
|
29
|
-
weekStartsOn:
|
|
30
|
-
disabled:
|
|
31
|
-
className:
|
|
32
|
-
isError:
|
|
33
|
-
size:
|
|
34
|
-
label:
|
|
35
|
-
helperText:
|
|
36
|
-
required:
|
|
37
|
-
prefix:
|
|
38
|
-
prefixClick:
|
|
39
|
-
...
|
|
40
|
-
},
|
|
41
|
-
const { locale:
|
|
42
|
-
|
|
43
|
-
const [
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}, [
|
|
47
|
-
|
|
48
|
-
}, [
|
|
49
|
-
const
|
|
50
|
-
d(
|
|
51
|
-
},
|
|
52
|
-
|
|
53
|
-
},
|
|
54
|
-
d(
|
|
55
|
-
},
|
|
56
|
-
d(void 0), f(""), p(""),
|
|
57
|
-
}, W = (
|
|
58
|
-
calendarType:
|
|
59
|
-
fiscalMode:
|
|
60
|
-
selectionMode:
|
|
61
|
-
fiscalMonthPattern:
|
|
29
|
+
weekStartsOn: B = 1,
|
|
30
|
+
disabled: y,
|
|
31
|
+
className: re,
|
|
32
|
+
isError: C,
|
|
33
|
+
size: O,
|
|
34
|
+
label: z,
|
|
35
|
+
helperText: H,
|
|
36
|
+
required: le,
|
|
37
|
+
prefix: Te,
|
|
38
|
+
prefixClick: Ae,
|
|
39
|
+
...se
|
|
40
|
+
}, ce) => {
|
|
41
|
+
const { locale: X, t: E } = We(), o = c.useMemo(() => Ee(X), [X]), q = F ?? E("datePicker.selectWeekRange"), G = c.useRef(null), ae = c.useRef(null);
|
|
42
|
+
c.useRef(null), c.useRef(null), c.useImperativeHandle(ce, () => G.current);
|
|
43
|
+
const [r, g] = c.useState(!1), I = c.useRef(!1), [w, d] = c.useState(t), [R, f] = c.useState(t?.from ? l(t.from.startDate, n, { locale: o }) : ""), [v, p] = c.useState(a(t) ? l(a(t), n, { locale: o }) : ""), [ie, V] = c.useState(t?.from?.startDate || /* @__PURE__ */ new Date());
|
|
44
|
+
c.useEffect(() => {
|
|
45
|
+
r || (f(t?.from ? l(t.from.startDate, n, { locale: o }) : ""), p(a(t) ? l(a(t), n, { locale: o }) : ""), d(t));
|
|
46
|
+
}, [t, n, r, o]), c.useEffect(() => {
|
|
47
|
+
r && (d(t), f(t?.from ? l(t.from.startDate, n, { locale: o }) : ""), p(a(t) ? l(a(t), n, { locale: o }) : ""), V(t?.from?.startDate || /* @__PURE__ */ new Date()));
|
|
48
|
+
}, [r, t, n, o]);
|
|
49
|
+
const de = (e) => {
|
|
50
|
+
d(e), e?.from ? (f(l(e.from.startDate, n, { locale: o })), p(l(a(e), n, { locale: o }))) : (f(""), p("")), !D && e?.from && e?.to && e.from.startDate.getTime() !== e.to.startDate.getTime() && (k?.(e), g(!1));
|
|
51
|
+
}, fe = (e) => {
|
|
52
|
+
k?.(e !== void 0 ? e : w), g(!1);
|
|
53
|
+
}, T = () => {
|
|
54
|
+
d(t), f(t?.from ? l(t.from.startDate, n, { locale: o }) : ""), p(a(t) ? l(a(t), n, { locale: o }) : ""), g(!1);
|
|
55
|
+
}, J = () => {
|
|
56
|
+
d(void 0), f(""), p(""), k?.(void 0), D || g(!1);
|
|
57
|
+
}, W = (e) => Ie(e, {
|
|
58
|
+
calendarType: A,
|
|
59
|
+
fiscalMode: L,
|
|
60
|
+
selectionMode: j,
|
|
61
|
+
fiscalMonthPattern: K,
|
|
62
62
|
fiscalYearStartMonth: M,
|
|
63
|
-
weekStartsOn:
|
|
64
|
-
}),
|
|
65
|
-
const
|
|
63
|
+
weekStartsOn: B
|
|
64
|
+
}), pe = (e) => {
|
|
65
|
+
const x = e.target.value, i = Z(x, n, R);
|
|
66
66
|
if (f(i), i === "") {
|
|
67
67
|
const u = { from: void 0, to: w?.to };
|
|
68
|
-
d(u),
|
|
68
|
+
d(u), D || k?.(u);
|
|
69
69
|
return;
|
|
70
70
|
}
|
|
71
|
-
const m =
|
|
72
|
-
if (
|
|
71
|
+
const m = S(i, n, /* @__PURE__ */ new Date(), { locale: o });
|
|
72
|
+
if (P(m) && i.length === n.length) {
|
|
73
73
|
const b = { from: W(m), to: w?.to };
|
|
74
|
-
d(b), p(l(
|
|
74
|
+
d(b), p(l(a(b), n, { locale: o })), D || k?.(b);
|
|
75
75
|
}
|
|
76
|
-
},
|
|
77
|
-
const
|
|
76
|
+
}, me = (e) => {
|
|
77
|
+
const x = e.target.value, i = Z(x, n, v);
|
|
78
78
|
if (p(i), i === "") {
|
|
79
79
|
const u = { from: w?.from, to: void 0 };
|
|
80
|
-
d(u),
|
|
80
|
+
d(u), D || k?.(u);
|
|
81
81
|
return;
|
|
82
82
|
}
|
|
83
|
-
const m =
|
|
84
|
-
if (
|
|
83
|
+
const m = S(i, n, /* @__PURE__ */ new Date(), { locale: o });
|
|
84
|
+
if (P(m) && i.length === n.length) {
|
|
85
85
|
const u = W(m), b = { from: w?.from, to: u };
|
|
86
|
-
d(b), w?.from && f(l(w.from.startDate,
|
|
86
|
+
d(b), w?.from && f(l(w.from.startDate, n, { locale: o })), m && V(m), D || k?.(b);
|
|
87
87
|
}
|
|
88
|
-
},
|
|
89
|
-
if (
|
|
90
|
-
const
|
|
88
|
+
}, Q = () => {
|
|
89
|
+
if (r) return;
|
|
90
|
+
const e = U(R, n), x = U(v, n), i = S(e, n, /* @__PURE__ */ new Date(), { locale: o }), m = S(x, n, /* @__PURE__ */ new Date(), { locale: o }), u = P(i) && e.length === n.length, b = P(m) && x.length === n.length;
|
|
91
91
|
if (!u || !b)
|
|
92
|
-
f(
|
|
93
|
-
else if (f(
|
|
92
|
+
f(t?.from ? l(t.from.startDate, n, { locale: o }) : ""), p(a(t) ? l(a(t), n, { locale: o }) : ""), d(t);
|
|
93
|
+
else if (f(e), p(x), !D) {
|
|
94
94
|
const we = W(i), be = W(m);
|
|
95
|
-
|
|
95
|
+
k?.({ from: we, to: be });
|
|
96
96
|
}
|
|
97
|
-
},
|
|
98
|
-
return /* @__PURE__ */ h("div", { className: "flex w-full min-w-[240px] flex-col gap-[6px]", "data-component": "week-range-picker", "data-disabled":
|
|
97
|
+
}, ue = t?.from ? l(t.from.startDate, n, { locale: o }) : "", he = a(t) ? l(a(t), n, { locale: o }) : "", ge = ue !== R, xe = he !== v, ke = R.length === n.length && !P(S(R, n, /* @__PURE__ */ new Date(), { locale: o })), De = v.length === n.length && !P(S(v, n, /* @__PURE__ */ new Date(), { locale: o }));
|
|
98
|
+
return /* @__PURE__ */ h("div", { className: "flex w-full min-w-[240px] flex-col gap-[6px]", "data-component": "week-range-picker", "data-disabled": y || void 0, children: [
|
|
99
99
|
/* @__PURE__ */ h("div", { className: "flex flex-col gap-[6px]", children: [
|
|
100
|
-
|
|
100
|
+
z && /* @__PURE__ */ h(
|
|
101
101
|
"label",
|
|
102
102
|
{
|
|
103
|
-
className:
|
|
103
|
+
className: N(
|
|
104
104
|
"text-xs font-medium leading-[18px] text-content-tertiary",
|
|
105
|
-
|
|
106
|
-
|
|
105
|
+
y && "opacity-70",
|
|
106
|
+
C && "text-destructive"
|
|
107
107
|
),
|
|
108
108
|
children: [
|
|
109
|
-
|
|
109
|
+
z,
|
|
110
110
|
" ",
|
|
111
|
-
|
|
111
|
+
le && /* @__PURE__ */ s("span", { className: "text-destructive", children: "*" })
|
|
112
112
|
]
|
|
113
113
|
}
|
|
114
114
|
),
|
|
115
|
-
/* @__PURE__ */ h(
|
|
116
|
-
/* @__PURE__ */ s(
|
|
115
|
+
/* @__PURE__ */ h(Pe, { open: r, onOpenChange: g, children: [
|
|
116
|
+
/* @__PURE__ */ s(Se, { asChild: !0, children: /* @__PURE__ */ h(
|
|
117
117
|
"div",
|
|
118
118
|
{
|
|
119
|
-
"data-state":
|
|
120
|
-
className:
|
|
119
|
+
"data-state": r ? "open" : "closed",
|
|
120
|
+
className: N(
|
|
121
121
|
"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",
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
122
|
+
C ? "border-destructive hover:border-destructive" : "border-field",
|
|
123
|
+
O === "sm" ? "h-6" : O === "md" ? "h-[28px]" : "h-8",
|
|
124
|
+
y && "pointer-events-none opacity-100 bg-disabled-surface border-stroke text-disabled-foreground hover:border-stroke",
|
|
125
125
|
"cursor-pointer",
|
|
126
|
-
|
|
126
|
+
re
|
|
127
127
|
),
|
|
128
128
|
children: [
|
|
129
129
|
/* @__PURE__ */ h("div", { className: "flex items-center gap-4 flex-1 min-w-0", children: [
|
|
130
130
|
/* @__PURE__ */ s(
|
|
131
131
|
"input",
|
|
132
132
|
{
|
|
133
|
-
ref:
|
|
133
|
+
ref: G,
|
|
134
134
|
type: "text",
|
|
135
|
-
value:
|
|
136
|
-
onChange:
|
|
137
|
-
onBlur:
|
|
138
|
-
onClick: (
|
|
139
|
-
|
|
140
|
-
|
|
135
|
+
value: R,
|
|
136
|
+
onChange: pe,
|
|
137
|
+
onBlur: Q,
|
|
138
|
+
onClick: (e) => r && e.stopPropagation(),
|
|
139
|
+
onKeyDown: (e) => {
|
|
140
|
+
(e.key === "Enter" || e.key === "ArrowDown") && !r && (e.preventDefault(), I.current = !0, g(!0)), e.key === "Escape" && r && (e.preventDefault(), T());
|
|
141
|
+
},
|
|
142
|
+
placeholder: r ? n : q,
|
|
143
|
+
disabled: !!y,
|
|
144
|
+
"aria-label": "Start Date",
|
|
141
145
|
"data-field": "start",
|
|
142
|
-
className:
|
|
146
|
+
className: N(
|
|
143
147
|
"flex-1 min-w-0 bg-transparent p-0 text-sm font-medium outline-none placeholder:font-medium placeholder:text-content-empty disabled:cursor-not-allowed disabled:opacity-50",
|
|
144
|
-
|
|
148
|
+
ke ? "text-destructive" : ge ? "text-content-muted" : ""
|
|
145
149
|
),
|
|
146
|
-
...
|
|
150
|
+
...se
|
|
147
151
|
}
|
|
148
152
|
),
|
|
149
153
|
/* @__PURE__ */ s(
|
|
150
154
|
"input",
|
|
151
155
|
{
|
|
152
|
-
ref:
|
|
156
|
+
ref: ae,
|
|
153
157
|
type: "text",
|
|
154
|
-
value:
|
|
155
|
-
onChange:
|
|
156
|
-
onBlur:
|
|
157
|
-
onClick: (
|
|
158
|
-
|
|
159
|
-
|
|
158
|
+
value: v,
|
|
159
|
+
onChange: me,
|
|
160
|
+
onBlur: Q,
|
|
161
|
+
onClick: (e) => r && e.stopPropagation(),
|
|
162
|
+
onKeyDown: (e) => {
|
|
163
|
+
(e.key === "Enter" || e.key === "ArrowDown") && !r && (e.preventDefault(), I.current = !0, g(!0)), e.key === "Escape" && r && (e.preventDefault(), T());
|
|
164
|
+
},
|
|
165
|
+
placeholder: r ? n : q,
|
|
166
|
+
disabled: !!y,
|
|
167
|
+
"aria-label": "End Date",
|
|
160
168
|
"data-field": "end",
|
|
161
|
-
className:
|
|
169
|
+
className: N(
|
|
162
170
|
"flex-1 min-w-0 bg-transparent p-0 text-sm font-medium outline-none placeholder:font-medium placeholder:text-content-empty disabled:cursor-not-allowed disabled:opacity-50",
|
|
163
|
-
|
|
171
|
+
De ? "text-destructive" : xe ? "text-content-muted" : ""
|
|
164
172
|
)
|
|
165
173
|
}
|
|
166
174
|
)
|
|
167
175
|
] }),
|
|
168
176
|
/* @__PURE__ */ h("div", { className: "flex items-center gap-1 shrink-0", children: [
|
|
169
|
-
|
|
170
|
-
/* @__PURE__ */ s(
|
|
171
|
-
|
|
177
|
+
t?.from && !y && /* @__PURE__ */ h($, { children: [
|
|
178
|
+
/* @__PURE__ */ s(Y, { asChild: !0, children: /* @__PURE__ */ s(
|
|
179
|
+
ye,
|
|
172
180
|
{
|
|
173
181
|
className: "h-4 w-4 cursor-pointer hover:text-content text-content-muted",
|
|
174
|
-
onClick: (
|
|
175
|
-
|
|
182
|
+
onClick: (e) => {
|
|
183
|
+
e.stopPropagation(), J();
|
|
176
184
|
}
|
|
177
185
|
}
|
|
178
186
|
) }),
|
|
179
|
-
/* @__PURE__ */ s(
|
|
187
|
+
/* @__PURE__ */ s(_, { variant: "tertiary", side: "top", children: E("calendar.clear") })
|
|
180
188
|
] }),
|
|
181
|
-
/* @__PURE__ */ h(
|
|
182
|
-
/* @__PURE__ */ s(
|
|
183
|
-
|
|
189
|
+
/* @__PURE__ */ h($, { children: [
|
|
190
|
+
/* @__PURE__ */ s(Y, { asChild: !0, children: /* @__PURE__ */ s("button", { type: "button", tabIndex: 0, "aria-label": E("datePicker.selectWeekRange"), onClick: (e) => {
|
|
191
|
+
e.stopPropagation(), g(!r);
|
|
192
|
+
}, onKeyDown: (e) => {
|
|
193
|
+
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), e.stopPropagation(), I.current = !0, g(!r));
|
|
194
|
+
}, className: "inline-flex items-center justify-center bg-transparent border-none p-0 cursor-pointer", children: /* @__PURE__ */ s(Re, { className: "h-4 w-4 text-secondary-foreground" }) }) }),
|
|
195
|
+
/* @__PURE__ */ s(_, { variant: "tertiary", side: "top", children: E("datePicker.selectWeekRange") })
|
|
184
196
|
] })
|
|
185
197
|
] })
|
|
186
198
|
]
|
|
187
199
|
}
|
|
188
200
|
) }),
|
|
189
201
|
/* @__PURE__ */ s(
|
|
190
|
-
|
|
202
|
+
Ne,
|
|
191
203
|
{
|
|
192
204
|
className: "w-auto p-0",
|
|
193
205
|
align: "start",
|
|
194
|
-
onOpenAutoFocus: (
|
|
206
|
+
onOpenAutoFocus: (e) => {
|
|
207
|
+
I.current || e.preventDefault(), I.current = !1;
|
|
208
|
+
},
|
|
195
209
|
children: /* @__PURE__ */ s(
|
|
196
|
-
|
|
210
|
+
Ce,
|
|
197
211
|
{
|
|
198
212
|
pickerType: "week",
|
|
199
213
|
weekMode: "range",
|
|
200
214
|
selectedWeeks: w,
|
|
201
|
-
onWeekSelect:
|
|
202
|
-
month:
|
|
215
|
+
onWeekSelect: de,
|
|
216
|
+
month: ie,
|
|
203
217
|
onMonthChange: V,
|
|
204
|
-
disabled: { before:
|
|
205
|
-
startMonth:
|
|
206
|
-
endMonth:
|
|
207
|
-
showFooter:
|
|
208
|
-
calendarType:
|
|
209
|
-
fiscalMode:
|
|
210
|
-
selectionMode:
|
|
211
|
-
fiscalMonthPattern:
|
|
218
|
+
disabled: { before: ee, after: te },
|
|
219
|
+
startMonth: ne,
|
|
220
|
+
endMonth: oe,
|
|
221
|
+
showFooter: D,
|
|
222
|
+
calendarType: A,
|
|
223
|
+
fiscalMode: L,
|
|
224
|
+
selectionMode: j,
|
|
225
|
+
fiscalMonthPattern: K,
|
|
212
226
|
fiscalYearStartMonth: M,
|
|
213
|
-
weekStartsOn:
|
|
214
|
-
onApply:
|
|
215
|
-
onCancel:
|
|
216
|
-
onClear:
|
|
227
|
+
weekStartsOn: B,
|
|
228
|
+
onApply: fe,
|
|
229
|
+
onCancel: T,
|
|
230
|
+
onClear: J,
|
|
217
231
|
captionLayout: "dropdown"
|
|
218
232
|
}
|
|
219
233
|
)
|
|
@@ -221,16 +235,16 @@ const c = (e) => e?.from ? e.to ? e.to.endDate : e.from.endDate : void 0, Ve = r
|
|
|
221
235
|
)
|
|
222
236
|
] })
|
|
223
237
|
] }),
|
|
224
|
-
|
|
225
|
-
!
|
|
238
|
+
H && /* @__PURE__ */ h("div", { className: N("flex items-center gap-[6px]", C && "text-destructive"), children: [
|
|
239
|
+
!C && /* @__PURE__ */ s(ve, { size: 10, className: "shrink-0 text-content-muted" }),
|
|
226
240
|
/* @__PURE__ */ s(
|
|
227
241
|
"p",
|
|
228
242
|
{
|
|
229
|
-
className:
|
|
243
|
+
className: N(
|
|
230
244
|
"text-[10px] leading-4 text-navigation-muted",
|
|
231
|
-
|
|
245
|
+
C && "text-destructive"
|
|
232
246
|
),
|
|
233
|
-
children:
|
|
247
|
+
children: H
|
|
234
248
|
}
|
|
235
249
|
)
|
|
236
250
|
] })
|