@yuno-payments/dashboard-design-system 0.0.135 → 0.0.137
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/atoms/filter/filter-date-range.js +136 -87
- package/dist/components/atoms/filter/filter.js +9 -9
- package/dist/components/atoms/filter-dropdown/filter-dropdown.js +84 -87
- package/dist/components/atoms/icon/icon-list.d.ts +0 -3
- package/dist/components/atoms/icon/icon-list.js +392 -398
- package/dist/components/atoms/multi-values-field/multi-values-field.js +28 -28
- package/dist/components/atoms/radio-group/radio-group-option.js +7 -7
- package/dist/components/atoms/search-field/search-field.js +9 -9
- package/dist/components/atoms/switch/switch.js +13 -13
- package/dist/components/molecules/empty/empty-icon.js +6 -6
- package/dist/components/organisms/data-table/data-table.d.ts +1 -19
- package/dist/components/organisms/data-table/data-table.js +88 -98
- package/dist/components/organisms/data-table/data-table.types.d.ts +0 -19
- package/dist/components/organisms/data-table/hooks/use-data-table-state.d.ts +2 -7
- package/dist/components/organisms/data-table/hooks/use-data-table-state.js +46 -80
- package/dist/components/organisms/data-table/utils/data-table-constants.d.ts +2 -2
- package/dist/components/organisms/data-table/utils/data-table-constants.js +11 -11
- package/dist/index.css +1 -1
- package/dist/vendor/shadcn/badge.js +17 -17
- package/dist/vendor/shadcn/card.js +7 -7
- package/dist/vendor/shadcn/input.js +7 -7
- package/dist/vendor/shadcn/table.js +18 -18
- package/package.json +1 -1
- package/dist/components/atoms/icon/aida-logo.d.ts +0 -3
- package/dist/components/atoms/icon/aida-logo.js +0 -64
- package/dist/node_modules/@phosphor-icons/react/dist/csr/File.es.js +0 -8
- package/dist/node_modules/@phosphor-icons/react/dist/csr/Table.es.js +0 -8
- package/dist/node_modules/@phosphor-icons/react/dist/defs/File.es.js +0 -30
- package/dist/node_modules/@phosphor-icons/react/dist/defs/Table.es.js +0 -30
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { j as
|
|
1
|
+
import { j as o } from "../../../_virtual/jsx-runtime.js";
|
|
2
2
|
import { forwardRef as q, useId as z, useState as g } from "react";
|
|
3
3
|
import { cn as b } from "../../../lib/utils.js";
|
|
4
4
|
import { Field as G, FieldLabel as H, FieldDescription as J, FieldError as K } from "../../../vendor/shadcn/field.js";
|
|
5
5
|
import { Badge as O } from "../badge/badge.js";
|
|
6
6
|
const Q = q(
|
|
7
7
|
({
|
|
8
|
-
value:
|
|
8
|
+
value: n = [],
|
|
9
9
|
onChange: d,
|
|
10
|
-
label:
|
|
10
|
+
label: y,
|
|
11
11
|
description: c,
|
|
12
|
-
error:
|
|
12
|
+
error: w,
|
|
13
13
|
placeholder: j = "Type and press Enter...",
|
|
14
14
|
disabled: u = !1,
|
|
15
15
|
id: v,
|
|
@@ -23,14 +23,14 @@ const Q = q(
|
|
|
23
23
|
orientation: N = "vertical",
|
|
24
24
|
className: $
|
|
25
25
|
}, C) => {
|
|
26
|
-
const T = z(),
|
|
26
|
+
const T = z(), t = v || T, m = !!w, [x, E] = g(""), [R, F] = g(!1), [h, i] = g(""), s = (e) => {
|
|
27
27
|
const r = e.trim();
|
|
28
28
|
if (r !== "") {
|
|
29
|
-
if (f &&
|
|
29
|
+
if (f && n.length >= f) {
|
|
30
30
|
i(`Maximum ${f} items allowed`);
|
|
31
31
|
return;
|
|
32
32
|
}
|
|
33
|
-
if (!D &&
|
|
33
|
+
if (!D && n.includes(r)) {
|
|
34
34
|
i("Duplicate values are not allowed");
|
|
35
35
|
return;
|
|
36
36
|
}
|
|
@@ -43,46 +43,46 @@ const Q = q(
|
|
|
43
43
|
return;
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
|
-
i(""), d([...
|
|
46
|
+
i(""), d([...n, r]), E("");
|
|
47
47
|
}
|
|
48
48
|
}, M = (e) => {
|
|
49
|
-
d(
|
|
49
|
+
d(n.filter((r) => r !== e)), i("");
|
|
50
50
|
}, P = (e) => {
|
|
51
51
|
const r = e.currentTarget.value;
|
|
52
|
-
e.key === "Enter" && p.includes("Enter") ? (e.preventDefault(), s(r)) : e.key === "Tab" && p.includes("Tab") ? r.trim() !== "" && (e.preventDefault(), s(r)) : (e.key === "," || e.key === ",") && p.includes("Comma") ? (e.preventDefault(), s(r)) : e.key === "Backspace" && r === "" &&
|
|
52
|
+
e.key === "Enter" && p.includes("Enter") ? (e.preventDefault(), s(r)) : e.key === "Tab" && p.includes("Tab") ? r.trim() !== "" && (e.preventDefault(), s(r)) : (e.key === "," || e.key === ",") && p.includes("Comma") ? (e.preventDefault(), s(r)) : e.key === "Backspace" && r === "" && n.length > 0 && d(n.slice(0, -1));
|
|
53
53
|
}, A = (e) => {
|
|
54
54
|
E(e.target.value), i("");
|
|
55
55
|
}, L = () => {
|
|
56
56
|
F(!0);
|
|
57
57
|
}, S = () => {
|
|
58
|
-
F(!1), B &&
|
|
58
|
+
F(!1), B && x.trim() !== "" && s(x);
|
|
59
59
|
}, X = (e, r) => {
|
|
60
60
|
e.preventDefault(), e.stopPropagation(), M(r);
|
|
61
|
-
}, a =
|
|
62
|
-
return /* @__PURE__ */
|
|
61
|
+
}, a = w || h;
|
|
62
|
+
return /* @__PURE__ */ o.jsxs(
|
|
63
63
|
G,
|
|
64
64
|
{
|
|
65
65
|
orientation: N,
|
|
66
66
|
"data-invalid": m,
|
|
67
67
|
className: b("w-full", $),
|
|
68
68
|
children: [
|
|
69
|
-
|
|
70
|
-
/* @__PURE__ */
|
|
71
|
-
/* @__PURE__ */
|
|
69
|
+
y && /* @__PURE__ */ o.jsx(H, { htmlFor: t, children: y }),
|
|
70
|
+
/* @__PURE__ */ o.jsxs("div", { className: "flex flex-col gap-2 flex-1", children: [
|
|
71
|
+
/* @__PURE__ */ o.jsxs(
|
|
72
72
|
"div",
|
|
73
73
|
{
|
|
74
74
|
className: b(
|
|
75
|
-
"font-normal file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex min-h-9 w-full min-w-0 rounded-md border bg-
|
|
75
|
+
"font-normal file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex min-h-9 w-full min-w-0 rounded-md border bg-background px-3 py-1.5 text-base shadow-xs transition-[color,box-shadow] outline-none disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 text-sm",
|
|
76
76
|
"flex-wrap gap-1.5 items-center",
|
|
77
77
|
R && "border-ring ring-ring/50 ring-[3px]",
|
|
78
|
-
(m ||
|
|
78
|
+
(m || h) && "border-destructive ring-destructive/20 dark:ring-destructive/40",
|
|
79
79
|
u && "opacity-50 cursor-not-allowed"
|
|
80
80
|
),
|
|
81
81
|
onClick: () => {
|
|
82
|
-
u || document.getElementById(
|
|
82
|
+
u || document.getElementById(t)?.focus();
|
|
83
83
|
},
|
|
84
84
|
children: [
|
|
85
|
-
|
|
85
|
+
n.map((e, r) => /* @__PURE__ */ o.jsx(
|
|
86
86
|
O,
|
|
87
87
|
{
|
|
88
88
|
variant: I,
|
|
@@ -96,34 +96,34 @@ const Q = q(
|
|
|
96
96
|
},
|
|
97
97
|
`${e}-${r}`
|
|
98
98
|
)),
|
|
99
|
-
/* @__PURE__ */
|
|
99
|
+
/* @__PURE__ */ o.jsx(
|
|
100
100
|
"input",
|
|
101
101
|
{
|
|
102
102
|
ref: C,
|
|
103
|
-
id:
|
|
103
|
+
id: t,
|
|
104
104
|
name: V,
|
|
105
105
|
type: "text",
|
|
106
|
-
value:
|
|
106
|
+
value: x,
|
|
107
107
|
onChange: A,
|
|
108
108
|
onKeyDown: P,
|
|
109
109
|
onFocus: L,
|
|
110
110
|
onBlur: S,
|
|
111
|
-
placeholder:
|
|
111
|
+
placeholder: n.length === 0 ? j : "",
|
|
112
112
|
disabled: u,
|
|
113
113
|
className: b(
|
|
114
114
|
"flex-1 min-w-[120px] outline-none bg-transparent border-none shadow-none p-0 h-6",
|
|
115
115
|
"placeholder:text-muted-foreground",
|
|
116
116
|
"disabled:cursor-not-allowed"
|
|
117
117
|
),
|
|
118
|
-
"aria-invalid": m || !!
|
|
119
|
-
"aria-describedby": c || a ? `${
|
|
118
|
+
"aria-invalid": m || !!h,
|
|
119
|
+
"aria-describedby": c || a ? `${t}-description` : void 0
|
|
120
120
|
}
|
|
121
121
|
)
|
|
122
122
|
]
|
|
123
123
|
}
|
|
124
124
|
),
|
|
125
|
-
c && !a && /* @__PURE__ */
|
|
126
|
-
a && /* @__PURE__ */
|
|
125
|
+
c && !a && /* @__PURE__ */ o.jsx(J, { id: `${t}-description`, children: c }),
|
|
126
|
+
a && /* @__PURE__ */ o.jsx(K, { id: `${t}-description`, children: a })
|
|
127
127
|
] })
|
|
128
128
|
]
|
|
129
129
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { j as r } from "../../../_virtual/jsx-runtime.js";
|
|
2
2
|
import { RadioGroupItem as d } from "../../../vendor/shadcn/radio-group.js";
|
|
3
|
-
import { cn as
|
|
4
|
-
import { Label as
|
|
3
|
+
import { cn as a } from "../../../lib/utils.js";
|
|
4
|
+
import { Label as l } from "../../../vendor/shadcn/label.js";
|
|
5
5
|
const o = ({
|
|
6
6
|
option: e,
|
|
7
7
|
radioId: s,
|
|
@@ -17,15 +17,15 @@ const o = ({
|
|
|
17
17
|
value: e.value,
|
|
18
18
|
id: s,
|
|
19
19
|
disabled: e.disabled,
|
|
20
|
-
className: "size-3.5 data-[state=unchecked]:bg-
|
|
20
|
+
className: "size-3.5 data-[state=unchecked]:bg-background border-border cursor-pointer"
|
|
21
21
|
}
|
|
22
22
|
),
|
|
23
23
|
t ? /* @__PURE__ */ r.jsxs(r.Fragment, { children: [
|
|
24
24
|
/* @__PURE__ */ r.jsx(
|
|
25
|
-
|
|
25
|
+
l,
|
|
26
26
|
{
|
|
27
27
|
htmlFor: s,
|
|
28
|
-
className:
|
|
28
|
+
className: a(
|
|
29
29
|
"cursor-pointer",
|
|
30
30
|
e.disabled && "text-muted-foreground"
|
|
31
31
|
),
|
|
@@ -35,10 +35,10 @@ const o = ({
|
|
|
35
35
|
e.description && /* @__PURE__ */ r.jsx("p", { className: "text-sm text-muted-foreground ml-auto", children: e.description })
|
|
36
36
|
] }) : /* @__PURE__ */ r.jsxs("div", { className: "flex flex-col gap-1.5 flex-1", children: [
|
|
37
37
|
/* @__PURE__ */ r.jsx(
|
|
38
|
-
|
|
38
|
+
l,
|
|
39
39
|
{
|
|
40
40
|
htmlFor: s,
|
|
41
|
-
className:
|
|
41
|
+
className: a(
|
|
42
42
|
"cursor-pointer",
|
|
43
43
|
e.disabled && "text-muted-foreground"
|
|
44
44
|
),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { j as t } from "../../../_virtual/jsx-runtime.js";
|
|
2
|
-
import { forwardRef as U, useId as Y, useState as
|
|
2
|
+
import { forwardRef as U, useId as Y, useState as n, useRef as V, useEffect as z } from "react";
|
|
3
3
|
import { cn as r } from "../../../lib/utils.js";
|
|
4
4
|
import { Input as Z } from "../../../vendor/shadcn/input.js";
|
|
5
5
|
import { Icon as w } from "../icon/icon.js";
|
|
@@ -28,7 +28,7 @@ const P = D("flex gap-2 w-full", {
|
|
|
28
28
|
}), te = U(
|
|
29
29
|
({
|
|
30
30
|
placeholder: F = "Search...",
|
|
31
|
-
onSearch:
|
|
31
|
+
onSearch: l,
|
|
32
32
|
limitSearch: y = 10,
|
|
33
33
|
persistKey: c = "",
|
|
34
34
|
value: m = "",
|
|
@@ -43,15 +43,15 @@ const P = D("flex gap-2 w-full", {
|
|
|
43
43
|
inputProps: h,
|
|
44
44
|
...E
|
|
45
45
|
}, i) => {
|
|
46
|
-
const M = Y(), u = O || h?.id || M, b = !!a, [o, d] =
|
|
46
|
+
const M = Y(), u = O || h?.id || M, b = !!a, [o, d] = n(m), [f, R] = n(() => {
|
|
47
47
|
if (c) {
|
|
48
48
|
const e = localStorage.getItem(`${c}_searchfield`);
|
|
49
49
|
return e ? JSON.parse(e) : [];
|
|
50
50
|
}
|
|
51
51
|
return [];
|
|
52
|
-
}), [C, L] =
|
|
52
|
+
}), [C, L] = n([]), [B, v] = n(!1), [J, I] = n(!1), g = V(null), _ = V(null), G = (e) => {
|
|
53
53
|
const s = e.target.value;
|
|
54
|
-
d(s), (s === "" || H) &&
|
|
54
|
+
d(s), (s === "" || H) && l(s);
|
|
55
55
|
}, W = (e) => {
|
|
56
56
|
e.key === "Enter" && o !== "" && S();
|
|
57
57
|
}, S = () => {
|
|
@@ -65,11 +65,11 @@ const P = D("flex gap-2 w-full", {
|
|
|
65
65
|
R(k), c && localStorage.setItem(
|
|
66
66
|
`${c}_searchfield`,
|
|
67
67
|
JSON.stringify(k)
|
|
68
|
-
),
|
|
68
|
+
), l(o);
|
|
69
69
|
}, X = () => {
|
|
70
|
-
d(""),
|
|
70
|
+
d(""), l(""), g.current?.focus();
|
|
71
71
|
}, q = (e) => {
|
|
72
|
-
d(e),
|
|
72
|
+
d(e), l(e), v(!1), g.current?.focus();
|
|
73
73
|
}, A = () => {
|
|
74
74
|
v(!0);
|
|
75
75
|
}, Q = () => {
|
|
@@ -124,7 +124,7 @@ const P = D("flex gap-2 w-full", {
|
|
|
124
124
|
size: "sm",
|
|
125
125
|
onClick: S,
|
|
126
126
|
className: r(
|
|
127
|
-
"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground",
|
|
127
|
+
"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground dark:text-foreground",
|
|
128
128
|
!x && "cursor-pointer hover:text-foreground transition-colors"
|
|
129
129
|
)
|
|
130
130
|
}
|
|
@@ -5,18 +5,18 @@ import { cn as n } from "../../../lib/utils.js";
|
|
|
5
5
|
import { Label as y } from "../../../vendor/shadcn/label.js";
|
|
6
6
|
const N = j(
|
|
7
7
|
({
|
|
8
|
-
label:
|
|
8
|
+
label: c,
|
|
9
9
|
description: o,
|
|
10
|
-
side:
|
|
10
|
+
side: i = "left",
|
|
11
11
|
variant: l = "default",
|
|
12
|
-
id:
|
|
12
|
+
id: d,
|
|
13
13
|
name: t,
|
|
14
14
|
onChange: a,
|
|
15
|
-
className:
|
|
16
|
-
switchClassName:
|
|
17
|
-
...
|
|
15
|
+
className: f,
|
|
16
|
+
switchClassName: m,
|
|
17
|
+
...x
|
|
18
18
|
}, p) => {
|
|
19
|
-
const h = v(), r =
|
|
19
|
+
const h = v(), r = d || t || h, u = (s) => {
|
|
20
20
|
if (!a) return;
|
|
21
21
|
a({
|
|
22
22
|
target: {
|
|
@@ -42,17 +42,17 @@ const N = j(
|
|
|
42
42
|
ref: p,
|
|
43
43
|
id: r,
|
|
44
44
|
name: t,
|
|
45
|
-
className: n("cursor-pointer",
|
|
45
|
+
className: n("cursor-pointer", m),
|
|
46
46
|
onCheckedChange: u,
|
|
47
|
-
...
|
|
47
|
+
...x
|
|
48
48
|
}
|
|
49
49
|
), w = n(
|
|
50
50
|
"flex gap-3 items-start",
|
|
51
51
|
{
|
|
52
|
-
"flex-row-reverse":
|
|
53
|
-
"bg-
|
|
52
|
+
"flex-row-reverse": i === "right",
|
|
53
|
+
"bg-background box-border justify-start p-4 rounded-lg border shadow-xs": l === "box"
|
|
54
54
|
},
|
|
55
|
-
|
|
55
|
+
f
|
|
56
56
|
);
|
|
57
57
|
return /* @__PURE__ */ e.jsxs("div", { className: w, children: [
|
|
58
58
|
g,
|
|
@@ -62,7 +62,7 @@ const N = j(
|
|
|
62
62
|
{
|
|
63
63
|
htmlFor: r,
|
|
64
64
|
className: "text-sm leading-[18.39px] cursor-pointer",
|
|
65
|
-
children:
|
|
65
|
+
children: c
|
|
66
66
|
}
|
|
67
67
|
),
|
|
68
68
|
o && /* @__PURE__ */ e.jsx("p", { className: "text-sm text-muted-foreground", children: o })
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { j as o } from "../../../_virtual/jsx-runtime.js";
|
|
2
2
|
import "react";
|
|
3
|
-
import { Icon as
|
|
4
|
-
function
|
|
3
|
+
import { Icon as t } from "../../atoms/icon/icon.js";
|
|
4
|
+
function d({
|
|
5
5
|
name: r,
|
|
6
|
-
size:
|
|
7
|
-
className:
|
|
6
|
+
size: m = "xl",
|
|
7
|
+
className: n,
|
|
8
8
|
children: s
|
|
9
9
|
}) {
|
|
10
|
-
return /* @__PURE__ */ o.jsx("div", { className: "p-4 bg-
|
|
10
|
+
return /* @__PURE__ */ o.jsx("div", { className: "p-4 bg-background rounded-lg shadow-sm", children: s || /* @__PURE__ */ o.jsx(t, { name: r, size: m, className: n }) });
|
|
11
11
|
}
|
|
12
12
|
export {
|
|
13
|
-
|
|
13
|
+
d as EmptyIcon
|
|
14
14
|
};
|
|
@@ -41,15 +41,6 @@ export interface DataTableProps<TData, TValue> {
|
|
|
41
41
|
* @default false
|
|
42
42
|
*/
|
|
43
43
|
manualSorting?: boolean;
|
|
44
|
-
/**
|
|
45
|
-
* Controlled sorting state (optional)
|
|
46
|
-
* If provided, component operates in controlled mode
|
|
47
|
-
*/
|
|
48
|
-
sorting?: import('@tanstack/react-table').SortingState;
|
|
49
|
-
/**
|
|
50
|
-
* Callback when sorting changes (required for controlled mode)
|
|
51
|
-
*/
|
|
52
|
-
onSortingChange?: (sorting: import('@tanstack/react-table').SortingState) => void;
|
|
53
44
|
/**
|
|
54
45
|
* Whether to enable column filtering
|
|
55
46
|
* @default false
|
|
@@ -90,15 +81,6 @@ export interface DataTableProps<TData, TValue> {
|
|
|
90
81
|
* Unique key for persisting table state in localStorage
|
|
91
82
|
*/
|
|
92
83
|
persistKey?: string;
|
|
93
|
-
/**
|
|
94
|
-
* Initial settings to load (from backend/profile)
|
|
95
|
-
* Takes precedence over localStorage
|
|
96
|
-
*/
|
|
97
|
-
initialSettings?: import('./data-table.types').DataTableSettings;
|
|
98
|
-
/**
|
|
99
|
-
* Callback when table settings change (for syncing to backend)
|
|
100
|
-
*/
|
|
101
|
-
onUpdate?: (settings: import('./data-table.types').DataTableSettings) => void;
|
|
102
84
|
}
|
|
103
85
|
/**
|
|
104
86
|
* Advanced data table component built on TanStack Table.
|
|
@@ -121,4 +103,4 @@ export interface DataTableProps<TData, TValue> {
|
|
|
121
103
|
* />
|
|
122
104
|
* ```
|
|
123
105
|
*/
|
|
124
|
-
export declare function DataTable<TData, TValue>({ columns, data, isLoading, empty, checkboxSelection, onRowSelectionChange, enableSorting, manualSorting,
|
|
106
|
+
export declare function DataTable<TData, TValue>({ columns, data, isLoading, empty, checkboxSelection, onRowSelectionChange, enableSorting, manualSorting, enableColumnFilters, enableColumnResizing, columnResizeMode, onRowClick, actions, height, rowHeight, className, persistKey, }: DataTableProps<TData, TValue>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,150 +1,140 @@
|
|
|
1
|
-
import { j as
|
|
2
|
-
import * as
|
|
3
|
-
import { useReactTable as
|
|
4
|
-
import { Table as
|
|
1
|
+
import { j as e } from "../../../_virtual/jsx-runtime.js";
|
|
2
|
+
import * as L from "react";
|
|
3
|
+
import { useReactTable as W } from "../../../node_modules/@tanstack/react-table/build/lib/index.js";
|
|
4
|
+
import { Table as _ } from "../../../vendor/shadcn/table.js";
|
|
5
5
|
import { cn as u } from "../../../lib/utils.js";
|
|
6
|
-
import { DataTableLoading as
|
|
7
|
-
import { DataTableHeader as
|
|
8
|
-
import { DataTableBody as
|
|
9
|
-
import { useDataTableColumns as
|
|
10
|
-
import { useDataTableState as
|
|
11
|
-
import { ROW_HEIGHT_DEFAULT as
|
|
12
|
-
import { getFilteredRowModel as
|
|
13
|
-
import { Empty as
|
|
14
|
-
function
|
|
6
|
+
import { DataTableLoading as B } from "./components/states/data-table-loading.js";
|
|
7
|
+
import { DataTableHeader as G } from "./components/data-table-header.js";
|
|
8
|
+
import { DataTableBody as I } from "./components/data-table-body.js";
|
|
9
|
+
import { useDataTableColumns as O } from "./hooks/use-data-table-columns.js";
|
|
10
|
+
import { useDataTableState as U } from "./hooks/use-data-table-state.js";
|
|
11
|
+
import { ROW_HEIGHT_DEFAULT as q } from "./utils/data-table-constants.js";
|
|
12
|
+
import { getFilteredRowModel as J, getSortedRowModel as K, getCoreRowModel as Q } from "../../../node_modules/@tanstack/table-core/build/lib/index.js";
|
|
13
|
+
import { Empty as X } from "../../molecules/empty/empty.js";
|
|
14
|
+
function ae({
|
|
15
15
|
columns: a,
|
|
16
16
|
data: s,
|
|
17
|
-
isLoading:
|
|
18
|
-
empty:
|
|
17
|
+
isLoading: c = !1,
|
|
18
|
+
empty: g,
|
|
19
19
|
checkboxSelection: m = !1,
|
|
20
|
-
onRowSelectionChange:
|
|
21
|
-
enableSorting:
|
|
22
|
-
manualSorting:
|
|
23
|
-
|
|
24
|
-
onSortingChange: w,
|
|
25
|
-
enableColumnFilters: y = !1,
|
|
20
|
+
onRowSelectionChange: o,
|
|
21
|
+
enableSorting: p = !0,
|
|
22
|
+
manualSorting: C = !1,
|
|
23
|
+
enableColumnFilters: b = !1,
|
|
26
24
|
enableColumnResizing: i = !0,
|
|
27
|
-
columnResizeMode:
|
|
28
|
-
onRowClick:
|
|
29
|
-
actions:
|
|
30
|
-
height:
|
|
31
|
-
rowHeight: d =
|
|
32
|
-
className:
|
|
33
|
-
persistKey:
|
|
34
|
-
initialSettings: F,
|
|
35
|
-
onUpdate: M
|
|
25
|
+
columnResizeMode: h = "onChange",
|
|
26
|
+
onRowClick: x,
|
|
27
|
+
actions: n,
|
|
28
|
+
height: w,
|
|
29
|
+
rowHeight: d = q,
|
|
30
|
+
className: T,
|
|
31
|
+
persistKey: j
|
|
36
32
|
}) {
|
|
37
|
-
const
|
|
33
|
+
const y = O({
|
|
38
34
|
columns: a,
|
|
39
35
|
checkboxSelection: m,
|
|
40
|
-
actions:
|
|
36
|
+
actions: n
|
|
41
37
|
}), {
|
|
42
|
-
sorting:
|
|
43
|
-
setSorting:
|
|
44
|
-
columnFilters:
|
|
45
|
-
setColumnFilters:
|
|
46
|
-
columnVisibility:
|
|
47
|
-
setColumnVisibility:
|
|
48
|
-
rowSelection:
|
|
49
|
-
setRowSelection:
|
|
50
|
-
columnPinning:
|
|
51
|
-
handleColumnPinningChange:
|
|
52
|
-
} =
|
|
53
|
-
persistKey:
|
|
54
|
-
hasActions: !!
|
|
55
|
-
|
|
56
|
-
onExternalSortingChange: w,
|
|
57
|
-
initialSettings: F,
|
|
58
|
-
onUpdate: M
|
|
59
|
-
}), t = U({
|
|
38
|
+
sorting: R,
|
|
39
|
+
setSorting: S,
|
|
40
|
+
columnFilters: D,
|
|
41
|
+
setColumnFilters: F,
|
|
42
|
+
columnVisibility: M,
|
|
43
|
+
setColumnVisibility: E,
|
|
44
|
+
rowSelection: f,
|
|
45
|
+
setRowSelection: N,
|
|
46
|
+
columnPinning: v,
|
|
47
|
+
handleColumnPinningChange: P
|
|
48
|
+
} = U({
|
|
49
|
+
persistKey: j,
|
|
50
|
+
hasActions: !!n
|
|
51
|
+
}), t = W({
|
|
60
52
|
data: s,
|
|
61
|
-
columns:
|
|
62
|
-
getCoreRowModel:
|
|
53
|
+
columns: y,
|
|
54
|
+
getCoreRowModel: Q(),
|
|
63
55
|
enableColumnResizing: i,
|
|
64
|
-
columnResizeMode:
|
|
56
|
+
columnResizeMode: h,
|
|
65
57
|
enableColumnPinning: !0,
|
|
66
58
|
defaultColumn: {
|
|
67
59
|
enableSorting: !1,
|
|
68
60
|
minSize: 50
|
|
69
61
|
},
|
|
70
|
-
...
|
|
71
|
-
onSortingChange:
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
getSortedRowModel: $(),
|
|
75
|
-
manualSorting: h
|
|
62
|
+
...p && {
|
|
63
|
+
onSortingChange: S,
|
|
64
|
+
getSortedRowModel: K(),
|
|
65
|
+
manualSorting: C
|
|
76
66
|
},
|
|
77
|
-
...
|
|
78
|
-
onColumnFiltersChange:
|
|
79
|
-
getFilteredRowModel:
|
|
67
|
+
...b && {
|
|
68
|
+
onColumnFiltersChange: F,
|
|
69
|
+
getFilteredRowModel: J()
|
|
80
70
|
},
|
|
81
|
-
onColumnVisibilityChange:
|
|
82
|
-
onRowSelectionChange:
|
|
83
|
-
onColumnPinningChange:
|
|
71
|
+
onColumnVisibilityChange: E,
|
|
72
|
+
onRowSelectionChange: N,
|
|
73
|
+
onColumnPinningChange: P,
|
|
84
74
|
state: {
|
|
85
|
-
sorting:
|
|
86
|
-
columnFilters:
|
|
87
|
-
columnVisibility:
|
|
88
|
-
rowSelection:
|
|
89
|
-
columnPinning:
|
|
75
|
+
sorting: R,
|
|
76
|
+
columnFilters: D,
|
|
77
|
+
columnVisibility: M,
|
|
78
|
+
rowSelection: f,
|
|
79
|
+
columnPinning: v
|
|
90
80
|
}
|
|
91
81
|
});
|
|
92
|
-
if (
|
|
93
|
-
if (
|
|
94
|
-
const
|
|
95
|
-
|
|
82
|
+
if (L.useEffect(() => {
|
|
83
|
+
if (o) {
|
|
84
|
+
const r = t.getFilteredSelectedRowModel().rows.map((l) => l.original);
|
|
85
|
+
o(r);
|
|
96
86
|
}
|
|
97
|
-
}, [
|
|
98
|
-
return /* @__PURE__ */
|
|
99
|
-
|
|
87
|
+
}, [f, o, t]), c)
|
|
88
|
+
return /* @__PURE__ */ e.jsx(
|
|
89
|
+
B,
|
|
100
90
|
{
|
|
101
91
|
columns: a,
|
|
102
92
|
checkboxSelection: m,
|
|
103
|
-
actions:
|
|
93
|
+
actions: n,
|
|
104
94
|
rowHeight: d
|
|
105
95
|
}
|
|
106
96
|
);
|
|
107
97
|
if (s.length === 0) {
|
|
108
|
-
const
|
|
98
|
+
const r = g || {}, {
|
|
109
99
|
title: l = "No results",
|
|
110
|
-
description:
|
|
111
|
-
media:
|
|
112
|
-
actions:
|
|
113
|
-
} =
|
|
114
|
-
return /* @__PURE__ */
|
|
115
|
-
|
|
100
|
+
description: V = "No data available",
|
|
101
|
+
media: A,
|
|
102
|
+
actions: H
|
|
103
|
+
} = r;
|
|
104
|
+
return /* @__PURE__ */ e.jsx(
|
|
105
|
+
X,
|
|
116
106
|
{
|
|
117
|
-
media:
|
|
107
|
+
media: A,
|
|
118
108
|
title: l,
|
|
119
|
-
description:
|
|
120
|
-
actions:
|
|
109
|
+
description: V,
|
|
110
|
+
actions: H
|
|
121
111
|
}
|
|
122
112
|
);
|
|
123
113
|
}
|
|
124
|
-
return /* @__PURE__ */
|
|
114
|
+
return /* @__PURE__ */ e.jsx("div", { className: u("space-y-4", T), children: /* @__PURE__ */ e.jsx(
|
|
125
115
|
"div",
|
|
126
116
|
{
|
|
127
117
|
className: "rounded-md border overflow-x-auto",
|
|
128
|
-
style: { height:
|
|
129
|
-
children: /* @__PURE__ */
|
|
130
|
-
|
|
118
|
+
style: { height: w || "auto" },
|
|
119
|
+
children: /* @__PURE__ */ e.jsxs(
|
|
120
|
+
_,
|
|
131
121
|
{
|
|
132
122
|
className: u("table-fixed"),
|
|
133
123
|
style: { width: "max-content", minWidth: "100%" },
|
|
134
124
|
children: [
|
|
135
|
-
/* @__PURE__ */
|
|
136
|
-
|
|
125
|
+
/* @__PURE__ */ e.jsx(
|
|
126
|
+
G,
|
|
137
127
|
{
|
|
138
128
|
table: t,
|
|
139
129
|
enableColumnResizing: i
|
|
140
130
|
}
|
|
141
131
|
),
|
|
142
|
-
/* @__PURE__ */
|
|
143
|
-
|
|
132
|
+
/* @__PURE__ */ e.jsx(
|
|
133
|
+
I,
|
|
144
134
|
{
|
|
145
135
|
table: t,
|
|
146
136
|
enableColumnResizing: i,
|
|
147
|
-
onRowClick:
|
|
137
|
+
onRowClick: x,
|
|
148
138
|
rowHeight: d
|
|
149
139
|
}
|
|
150
140
|
)
|
|
@@ -155,5 +145,5 @@ function fe({
|
|
|
155
145
|
) });
|
|
156
146
|
}
|
|
157
147
|
export {
|
|
158
|
-
|
|
148
|
+
ae as DataTable
|
|
159
149
|
};
|
|
@@ -77,23 +77,6 @@ export type DataTableColumn<TData> = ColumnDef<TData> & {
|
|
|
77
77
|
enableSorting?: boolean;
|
|
78
78
|
enableHiding?: boolean;
|
|
79
79
|
};
|
|
80
|
-
/**
|
|
81
|
-
* Settings structure compatible with TableV2 format
|
|
82
|
-
* Used for initialSettings and onUpdate callback
|
|
83
|
-
*/
|
|
84
|
-
export interface DataTableSettings {
|
|
85
|
-
hide?: string[];
|
|
86
|
-
show?: string[];
|
|
87
|
-
width?: {
|
|
88
|
-
[key: string]: number;
|
|
89
|
-
};
|
|
90
|
-
pinnedColumns?: {
|
|
91
|
-
right: string[];
|
|
92
|
-
left: string[];
|
|
93
|
-
};
|
|
94
|
-
order?: string[];
|
|
95
|
-
sorting?: SortingState;
|
|
96
|
-
}
|
|
97
80
|
export interface DataTableProps<TData> {
|
|
98
81
|
columns: DataTableColumn<TData>[];
|
|
99
82
|
data: TData[];
|
|
@@ -120,8 +103,6 @@ export interface DataTableProps<TData> {
|
|
|
120
103
|
height?: string | number;
|
|
121
104
|
rowHeight?: number;
|
|
122
105
|
persistKey?: string;
|
|
123
|
-
initialSettings?: DataTableSettings;
|
|
124
|
-
onUpdate?: (settings: DataTableSettings) => void;
|
|
125
106
|
renderToolbar?: () => React.ReactNode;
|
|
126
107
|
renderActions?: () => React.ReactNode;
|
|
127
108
|
className?: string;
|
|
@@ -1,17 +1,12 @@
|
|
|
1
1
|
import { ColumnFiltersState, SortingState, VisibilityState, RowSelectionState, ColumnPinningState } from '@tanstack/react-table';
|
|
2
|
-
import { DataTableSettings } from '../data-table.types';
|
|
3
2
|
import * as React from "react";
|
|
4
3
|
interface UseDataTableStateProps {
|
|
5
4
|
persistKey?: string;
|
|
6
5
|
hasActions?: boolean;
|
|
7
|
-
externalSorting?: SortingState;
|
|
8
|
-
onExternalSortingChange?: (sorting: SortingState) => void;
|
|
9
|
-
initialSettings?: DataTableSettings;
|
|
10
|
-
onUpdate?: (settings: DataTableSettings) => void;
|
|
11
6
|
}
|
|
12
|
-
export declare function useDataTableState({ persistKey, hasActions,
|
|
7
|
+
export declare function useDataTableState({ persistKey, hasActions, }: UseDataTableStateProps): {
|
|
13
8
|
sorting: SortingState;
|
|
14
|
-
setSorting:
|
|
9
|
+
setSorting: React.Dispatch<React.SetStateAction<SortingState>>;
|
|
15
10
|
columnFilters: ColumnFiltersState;
|
|
16
11
|
setColumnFilters: React.Dispatch<React.SetStateAction<ColumnFiltersState>>;
|
|
17
12
|
columnVisibility: VisibilityState;
|