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
|
@@ -8,10 +8,6 @@ export declare const DataTable: ({ children, className }: {
|
|
|
8
8
|
children: React.ReactNode;
|
|
9
9
|
className?: string;
|
|
10
10
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
-
/**
|
|
12
|
-
* DataTable Content
|
|
13
|
-
* Wraps AgGridWrapper and captures the API reference.
|
|
14
|
-
*/
|
|
15
11
|
export declare function DataTableContent<TData>(props: AgGridWrapperProps<TData> & {
|
|
16
12
|
className?: string;
|
|
17
13
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,87 +1,121 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { AgGridWrapper as
|
|
4
|
-
import { cn as
|
|
5
|
-
import { DataTableContext as
|
|
6
|
-
import { DATA_TABLE_SCOPED_SHEET_HOST_MIN_HEIGHT_PX as
|
|
7
|
-
|
|
1
|
+
import { jsx as c, jsxs as C } from "react/jsx-runtime";
|
|
2
|
+
import { useState as s, useRef as E, useCallback as A, useMemo as H, useEffect as _ } from "react";
|
|
3
|
+
import { AgGridWrapper as O } from "../ag-grid-react/index.js";
|
|
4
|
+
import { cn as y } from "../../../lib/utils.js";
|
|
5
|
+
import { DataTableContext as D, useDataTable as P } from "./data-table-context.js";
|
|
6
|
+
import { DATA_TABLE_SCOPED_SHEET_HOST_MIN_HEIGHT_PX as F } from "./data-table-constants.js";
|
|
7
|
+
import { AG_GRID_VALUE_FORMATTERS as N } from "../ag-grid-react/value-formatters.js";
|
|
8
|
+
const R = {
|
|
8
9
|
default: 46,
|
|
9
10
|
compact: 30,
|
|
10
11
|
comfort: 52
|
|
11
|
-
},
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
}, G = (o) => {
|
|
13
|
+
if (o)
|
|
14
|
+
return o.map((e) => {
|
|
15
|
+
if ("children" in e && e.children)
|
|
16
|
+
return {
|
|
17
|
+
...e,
|
|
18
|
+
children: G(e.children)
|
|
19
|
+
};
|
|
20
|
+
const t = e;
|
|
21
|
+
return !t.valueFormatter && (t.type === "numericColumn" || t.type === "number") ? {
|
|
22
|
+
...t,
|
|
23
|
+
valueFormatter: N.number
|
|
24
|
+
} : t;
|
|
25
|
+
});
|
|
26
|
+
}, W = ({
|
|
27
|
+
children: o,
|
|
28
|
+
className: e
|
|
14
29
|
}) => {
|
|
15
|
-
const [
|
|
16
|
-
|
|
17
|
-
}, []),
|
|
18
|
-
|
|
19
|
-
}, []),
|
|
30
|
+
const [t, d] = s(null), [r, u] = s(null), [n, p] = s("medium"), [f, h] = s("full"), [a, m] = s("default"), [g, x] = s(!1), l = E(0), T = A((S) => {
|
|
31
|
+
l.current = Math.max(0, l.current + S), x(l.current > 0);
|
|
32
|
+
}, []), b = A((S) => {
|
|
33
|
+
d(S);
|
|
34
|
+
}, []), v = {
|
|
20
35
|
small: "12px",
|
|
21
36
|
medium: "14px",
|
|
22
37
|
large: "16px"
|
|
23
|
-
}[
|
|
24
|
-
return /* @__PURE__ */
|
|
25
|
-
gridApi:
|
|
26
|
-
registerApi:
|
|
27
|
-
sheetTarget:
|
|
28
|
-
setSheetTarget:
|
|
29
|
-
scopedSheetOpen:
|
|
38
|
+
}[n], i = `${R[a]}px`;
|
|
39
|
+
return /* @__PURE__ */ c(D.Provider, { value: {
|
|
40
|
+
gridApi: t,
|
|
41
|
+
registerApi: b,
|
|
42
|
+
sheetTarget: r,
|
|
43
|
+
setSheetTarget: u,
|
|
44
|
+
scopedSheetOpen: g,
|
|
30
45
|
registerScopedSheetDepth: T,
|
|
31
|
-
fontSize:
|
|
46
|
+
fontSize: n,
|
|
32
47
|
setFontSize: p,
|
|
33
|
-
numericFormat:
|
|
48
|
+
numericFormat: f,
|
|
34
49
|
setNumericFormat: h,
|
|
35
|
-
rowHeight:
|
|
36
|
-
setRowHeight:
|
|
37
|
-
}, children: /* @__PURE__ */
|
|
50
|
+
rowHeight: a,
|
|
51
|
+
setRowHeight: m
|
|
52
|
+
}, children: /* @__PURE__ */ c(
|
|
38
53
|
"div",
|
|
39
54
|
{
|
|
40
55
|
"data-component": "data-table",
|
|
41
|
-
className:
|
|
56
|
+
className: y("flex flex-col w-full min-h-0 rounded-[inherit]", e),
|
|
42
57
|
style: {
|
|
43
|
-
"--ag-font-size":
|
|
44
|
-
"--ag-row-height":
|
|
58
|
+
"--ag-font-size": v,
|
|
59
|
+
"--ag-row-height": i
|
|
45
60
|
},
|
|
46
|
-
children:
|
|
61
|
+
children: o
|
|
47
62
|
}
|
|
48
63
|
) });
|
|
64
|
+
}, w = {
|
|
65
|
+
full: "full_no",
|
|
66
|
+
k: "thou",
|
|
67
|
+
m: "mil",
|
|
68
|
+
b: "bil"
|
|
49
69
|
};
|
|
50
|
-
function
|
|
70
|
+
function X(o) {
|
|
51
71
|
const {
|
|
52
|
-
registerApi:
|
|
53
|
-
setSheetTarget:
|
|
54
|
-
rowHeight:
|
|
55
|
-
gridApi:
|
|
56
|
-
scopedSheetOpen:
|
|
57
|
-
|
|
72
|
+
registerApi: e,
|
|
73
|
+
setSheetTarget: t,
|
|
74
|
+
rowHeight: d,
|
|
75
|
+
gridApi: r,
|
|
76
|
+
scopedSheetOpen: u,
|
|
77
|
+
numericFormat: n
|
|
78
|
+
} = P(), { className: p, onGridReady: f, rowHeight: h, context: a, columnDefs: m, ...g } = o, x = R[d], l = h ?? x, T = H(() => G(m), [m]), b = H(() => ({
|
|
79
|
+
...a,
|
|
80
|
+
formatType: w[n]
|
|
81
|
+
}), [a, n]);
|
|
58
82
|
_(() => {
|
|
59
|
-
|
|
60
|
-
}, [
|
|
61
|
-
|
|
62
|
-
|
|
83
|
+
r?.resetRowHeights();
|
|
84
|
+
}, [d, r]), _(() => {
|
|
85
|
+
if (r) {
|
|
86
|
+
const i = r.getGridOption("context") || {};
|
|
87
|
+
r.setGridOption("context", {
|
|
88
|
+
...i,
|
|
89
|
+
formatType: w[n]
|
|
90
|
+
}), r.refreshCells({ force: !0 });
|
|
91
|
+
}
|
|
92
|
+
}, [n, r]);
|
|
93
|
+
const v = (i) => {
|
|
94
|
+
e(i.api), f?.(i);
|
|
63
95
|
};
|
|
64
|
-
return /* @__PURE__ */
|
|
96
|
+
return /* @__PURE__ */ C(
|
|
65
97
|
"div",
|
|
66
98
|
{
|
|
67
|
-
className:
|
|
99
|
+
className: y(
|
|
68
100
|
"relative flex-1 min-h-0 w-full bg-canvas-elevated rounded-b-[inherit] grid-rounded-bottom",
|
|
69
|
-
|
|
101
|
+
p
|
|
70
102
|
),
|
|
71
|
-
style:
|
|
103
|
+
style: u ? { minHeight: F } : void 0,
|
|
72
104
|
children: [
|
|
73
|
-
/* @__PURE__ */
|
|
74
|
-
|
|
105
|
+
/* @__PURE__ */ c(
|
|
106
|
+
O,
|
|
75
107
|
{
|
|
76
|
-
...
|
|
77
|
-
|
|
78
|
-
|
|
108
|
+
...g,
|
|
109
|
+
columnDefs: T,
|
|
110
|
+
rowHeight: l,
|
|
111
|
+
onGridReady: v,
|
|
112
|
+
context: b
|
|
79
113
|
}
|
|
80
114
|
),
|
|
81
|
-
/* @__PURE__ */
|
|
115
|
+
/* @__PURE__ */ c(
|
|
82
116
|
"div",
|
|
83
117
|
{
|
|
84
|
-
ref:
|
|
118
|
+
ref: t,
|
|
85
119
|
className: "absolute inset-0 pointer-events-none z-[39] flex overflow-x-hidden overflow-y-visible"
|
|
86
120
|
}
|
|
87
121
|
)
|
|
@@ -89,12 +123,12 @@ function k(t) {
|
|
|
89
123
|
}
|
|
90
124
|
);
|
|
91
125
|
}
|
|
92
|
-
const
|
|
93
|
-
children:
|
|
94
|
-
className:
|
|
95
|
-
}) => /* @__PURE__ */
|
|
126
|
+
const U = ({
|
|
127
|
+
children: o,
|
|
128
|
+
className: e
|
|
129
|
+
}) => /* @__PURE__ */ c("div", { "data-component": "data-table-toolbar", className: y("flex items-center justify-between px-4 py-3 shrink-0 bg-canvas-elevated rounded-t-[inherit]", e), children: o });
|
|
96
130
|
export {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
131
|
+
W as DataTable,
|
|
132
|
+
X as DataTableContent,
|
|
133
|
+
U as DataTableToolbar
|
|
100
134
|
};
|
|
@@ -1,120 +1,129 @@
|
|
|
1
|
-
import { jsxs as C, jsx as
|
|
1
|
+
import { jsxs as C, jsx as c } from "react/jsx-runtime";
|
|
2
2
|
import * as o from "react";
|
|
3
|
-
import { X as
|
|
4
|
-
import { CalendarMonth as
|
|
5
|
-
import { format as
|
|
6
|
-
import { cn as
|
|
7
|
-
import { Input as
|
|
8
|
-
import { Popover as
|
|
3
|
+
import { X as Y } from "lucide-react";
|
|
4
|
+
import { CalendarMonth as Z } from "../../../icons/index.js";
|
|
5
|
+
import { format as u, isValid as x, parse as I } from "date-fns";
|
|
6
|
+
import { cn as _, padValidDateString as $, maskDate as F } from "../../../lib/utils.js";
|
|
7
|
+
import { Input as ee } from "../input.js";
|
|
8
|
+
import { Popover as te, PopoverTrigger as ne, PopoverContent as re } from "../popover.js";
|
|
9
9
|
import { Calendar as oe } from "../calendar.js";
|
|
10
|
-
import { Tooltip as
|
|
11
|
-
import { getDateFnsLocale as
|
|
12
|
-
import { useImpactNovaI18n as
|
|
10
|
+
import { Tooltip as M, TooltipTrigger as T, TooltipContent as A } from "../tooltip.js";
|
|
11
|
+
import { getDateFnsLocale as ce } from "../../../i18n/getDateFnsLocale.js";
|
|
12
|
+
import { useImpactNovaI18n as ie } from "../../../i18n/ImpactNovaI18nContext.js";
|
|
13
13
|
const le = o.forwardRef(
|
|
14
14
|
({
|
|
15
|
-
value:
|
|
16
|
-
onChange:
|
|
15
|
+
value: t,
|
|
16
|
+
onChange: f,
|
|
17
17
|
format: n = "MM/dd/yyyy",
|
|
18
|
-
placeholder:
|
|
18
|
+
placeholder: E,
|
|
19
19
|
minDate: L,
|
|
20
|
-
maxDate:
|
|
21
|
-
startMonth:
|
|
22
|
-
endMonth:
|
|
20
|
+
maxDate: j,
|
|
21
|
+
startMonth: K,
|
|
22
|
+
endMonth: O,
|
|
23
23
|
showFooter: d = !0,
|
|
24
|
-
disabled:
|
|
24
|
+
disabled: R,
|
|
25
25
|
className: B,
|
|
26
|
-
...
|
|
27
|
-
},
|
|
28
|
-
const { locale:
|
|
29
|
-
o.useImperativeHandle(
|
|
30
|
-
const [
|
|
26
|
+
...H
|
|
27
|
+
}, X) => {
|
|
28
|
+
const { locale: b, t: m } = ie(), i = o.useMemo(() => ce(b), [b]), q = E ?? m("datePicker.selectDate"), g = o.useRef(null), y = o.useRef(null);
|
|
29
|
+
o.useImperativeHandle(X, () => g.current);
|
|
30
|
+
const [r, l] = o.useState(!1), D = o.useRef(!1), [N, a] = o.useState(t), [s, p] = o.useState(t ? u(t, n, { locale: i }) : ""), [z, w] = o.useState(t || /* @__PURE__ */ new Date());
|
|
31
31
|
o.useEffect(() => {
|
|
32
|
-
|
|
32
|
+
g.current && y.current !== null && (g.current.setSelectionRange(y.current, y.current), y.current = null);
|
|
33
33
|
}, [s]), o.useEffect(() => {
|
|
34
|
-
|
|
35
|
-
}, [
|
|
36
|
-
|
|
37
|
-
}, [
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
},
|
|
41
|
-
|
|
42
|
-
},
|
|
43
|
-
|
|
44
|
-
},
|
|
45
|
-
|
|
46
|
-
},
|
|
47
|
-
const h =
|
|
48
|
-
if (
|
|
49
|
-
|
|
34
|
+
r || (p(t ? u(t, n, { locale: i }) : ""), a(t));
|
|
35
|
+
}, [t, n, r, i]), o.useEffect(() => {
|
|
36
|
+
r && (a(t), w(t || /* @__PURE__ */ new Date()));
|
|
37
|
+
}, [r, t]);
|
|
38
|
+
const G = (e) => {
|
|
39
|
+
a(e), e && p(u(e, n, { locale: i })), d || (f?.(e), l(!1));
|
|
40
|
+
}, J = (e) => {
|
|
41
|
+
f?.(e !== void 0 ? e : N), l(!1);
|
|
42
|
+
}, S = () => {
|
|
43
|
+
a(t), p(t ? u(t, n, { locale: i }) : ""), l(!1);
|
|
44
|
+
}, V = () => {
|
|
45
|
+
a(void 0), p(""), f?.(void 0), d || l(!1);
|
|
46
|
+
}, Q = (e) => {
|
|
47
|
+
const h = e.target.value, k = F(h, n, s);
|
|
48
|
+
if (p(k), k === "") {
|
|
49
|
+
a(void 0), d || f?.(void 0);
|
|
50
50
|
return;
|
|
51
51
|
}
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
},
|
|
55
|
-
if (
|
|
56
|
-
const
|
|
57
|
-
!
|
|
58
|
-
},
|
|
59
|
-
return /* @__PURE__ */ C(
|
|
60
|
-
/* @__PURE__ */
|
|
61
|
-
|
|
52
|
+
const P = I(k, n, /* @__PURE__ */ new Date(), { locale: i });
|
|
53
|
+
x(P) && k.length === n.length && (a(P), w(P), d || f?.(P));
|
|
54
|
+
}, U = () => {
|
|
55
|
+
if (r) return;
|
|
56
|
+
const e = $(s, n), h = I(e, n, /* @__PURE__ */ new Date(), { locale: i });
|
|
57
|
+
!x(h) || e.length !== n.length ? (p(t ? u(t, n, { locale: i }) : ""), a(t)) : (p(e), d || f?.(h));
|
|
58
|
+
}, v = (t ? u(t, n, { locale: i }) : "") !== s, W = s.length === n.length && !x(I(s, n, /* @__PURE__ */ new Date(), { locale: i }));
|
|
59
|
+
return /* @__PURE__ */ C(te, { open: r, onOpenChange: l, children: [
|
|
60
|
+
/* @__PURE__ */ c(ne, { asChild: !0, children: /* @__PURE__ */ c("div", { "data-component": "date-picker", "data-state": r ? "open" : "closed", "data-pending": v || void 0, children: /* @__PURE__ */ c(
|
|
61
|
+
ee,
|
|
62
62
|
{
|
|
63
|
-
ref:
|
|
63
|
+
ref: g,
|
|
64
64
|
value: s,
|
|
65
|
-
onChange:
|
|
66
|
-
onBlur:
|
|
67
|
-
onClick: (
|
|
68
|
-
|
|
69
|
-
|
|
65
|
+
onChange: Q,
|
|
66
|
+
onBlur: U,
|
|
67
|
+
onClick: (e) => r && e.stopPropagation(),
|
|
68
|
+
onKeyDown: (e) => {
|
|
69
|
+
(e.key === "Enter" || e.key === "ArrowDown") && !r && (e.preventDefault(), D.current = !0, l(!0)), e.key === "Escape" && r && (e.preventDefault(), S());
|
|
70
|
+
},
|
|
71
|
+
placeholder: r ? n : q,
|
|
72
|
+
disabled: R,
|
|
70
73
|
"data-form-control": "input",
|
|
71
|
-
className:
|
|
74
|
+
className: _(
|
|
72
75
|
"cursor-pointer",
|
|
73
|
-
|
|
76
|
+
W ? "text-destructive" : v ? "text-content-muted" : "",
|
|
74
77
|
B
|
|
75
78
|
),
|
|
76
79
|
suffix: /* @__PURE__ */ C("div", { className: "flex items-center gap-1", children: [
|
|
77
|
-
|
|
78
|
-
/* @__PURE__ */
|
|
79
|
-
|
|
80
|
+
t && !R && /* @__PURE__ */ C(M, { children: [
|
|
81
|
+
/* @__PURE__ */ c(T, { asChild: !0, children: /* @__PURE__ */ c(
|
|
82
|
+
Y,
|
|
80
83
|
{
|
|
81
84
|
className: "h-4 w-4 cursor-pointer hover:text-content",
|
|
82
|
-
onClick: (
|
|
83
|
-
|
|
85
|
+
onClick: (e) => {
|
|
86
|
+
e.stopPropagation(), V();
|
|
84
87
|
}
|
|
85
88
|
}
|
|
86
89
|
) }),
|
|
87
|
-
/* @__PURE__ */
|
|
90
|
+
/* @__PURE__ */ c(A, { variant: "tertiary", side: "top", children: m("calendar.clear") })
|
|
88
91
|
] }),
|
|
89
|
-
/* @__PURE__ */ C(
|
|
90
|
-
/* @__PURE__ */
|
|
91
|
-
|
|
92
|
+
/* @__PURE__ */ C(M, { children: [
|
|
93
|
+
/* @__PURE__ */ c(T, { asChild: !0, children: /* @__PURE__ */ c("button", { type: "button", tabIndex: 0, "aria-label": m("datePicker.selectDate"), onClick: (e) => {
|
|
94
|
+
e.stopPropagation(), l(!r);
|
|
95
|
+
}, onKeyDown: (e) => {
|
|
96
|
+
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), e.stopPropagation(), D.current = !0, l(!r));
|
|
97
|
+
}, className: "inline-flex items-center justify-center bg-transparent border-none p-0 cursor-pointer", children: /* @__PURE__ */ c(Z, { className: "h-4 w-4 text-secondary-foreground" }) }) }),
|
|
98
|
+
/* @__PURE__ */ c(A, { variant: "tertiary", side: "top", children: m("datePicker.selectDate") })
|
|
92
99
|
] })
|
|
93
100
|
] }),
|
|
94
|
-
...
|
|
101
|
+
...H
|
|
95
102
|
}
|
|
96
103
|
) }) }),
|
|
97
|
-
/* @__PURE__ */
|
|
98
|
-
|
|
104
|
+
/* @__PURE__ */ c(
|
|
105
|
+
re,
|
|
99
106
|
{
|
|
100
107
|
className: "w-auto p-0",
|
|
101
108
|
align: "start",
|
|
102
|
-
onOpenAutoFocus: (
|
|
103
|
-
|
|
109
|
+
onOpenAutoFocus: (e) => {
|
|
110
|
+
D.current || e.preventDefault(), D.current = !1;
|
|
111
|
+
},
|
|
112
|
+
children: /* @__PURE__ */ c(
|
|
104
113
|
oe,
|
|
105
114
|
{
|
|
106
115
|
mode: "single",
|
|
107
|
-
selected:
|
|
108
|
-
onSelect:
|
|
109
|
-
month:
|
|
110
|
-
onMonthChange:
|
|
111
|
-
disabled: { before: L, after:
|
|
112
|
-
startMonth:
|
|
113
|
-
endMonth:
|
|
116
|
+
selected: N,
|
|
117
|
+
onSelect: G,
|
|
118
|
+
month: z,
|
|
119
|
+
onMonthChange: w,
|
|
120
|
+
disabled: { before: L, after: j },
|
|
121
|
+
startMonth: K,
|
|
122
|
+
endMonth: O,
|
|
114
123
|
showFooter: d,
|
|
115
|
-
onApply:
|
|
116
|
-
onCancel:
|
|
117
|
-
onClear:
|
|
124
|
+
onApply: J,
|
|
125
|
+
onCancel: S,
|
|
126
|
+
onClear: V,
|
|
118
127
|
captionLayout: "dropdown"
|
|
119
128
|
}
|
|
120
129
|
)
|