@yuno-payments/dashboard-design-system 0.0.75 → 0.0.76
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.
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { ColumnResizeMode } from '@tanstack/react-table';
|
|
2
|
-
import { DataTableActionsConfig, DataTableColumnDef
|
|
2
|
+
import { DataTableActionsConfig, DataTableColumnDef } from './data-table.types';
|
|
3
|
+
import { EmptyProps } from '../../molecules';
|
|
3
4
|
export interface DataTableProps<TData, TValue> {
|
|
4
5
|
columns: DataTableColumnDef<TData, TValue>[];
|
|
5
6
|
data: TData[];
|
|
6
7
|
isLoading?: boolean;
|
|
7
|
-
empty?:
|
|
8
|
+
empty?: EmptyProps;
|
|
8
9
|
checkboxSelection?: boolean;
|
|
9
10
|
onRowSelectionChange?: (selectedRows: TData[]) => void;
|
|
10
11
|
enableSorting?: boolean;
|
|
@@ -2,7 +2,7 @@ import { j as e } from "../../../_virtual/jsx-runtime.js";
|
|
|
2
2
|
import * as L from "react";
|
|
3
3
|
import { useReactTable as W } from "../../../node_modules/@tanstack/react-table/build/lib/index.js";
|
|
4
4
|
import { Table as _ } from "../../../vendor/shadcn/table.js";
|
|
5
|
-
import { cn as
|
|
5
|
+
import { cn as u } from "../../../lib/utils.js";
|
|
6
6
|
import { DataTableLoading as B } from "./components/states/data-table-loading.js";
|
|
7
7
|
import { DataTableHeader as G } from "./components/data-table-header.js";
|
|
8
8
|
import { DataTableBody as I } from "./components/data-table-body.js";
|
|
@@ -19,12 +19,12 @@ function ae({
|
|
|
19
19
|
checkboxSelection: m = !1,
|
|
20
20
|
onRowSelectionChange: o,
|
|
21
21
|
enableSorting: p = !0,
|
|
22
|
-
manualSorting:
|
|
23
|
-
enableColumnFilters:
|
|
22
|
+
manualSorting: C = !1,
|
|
23
|
+
enableColumnFilters: b = !1,
|
|
24
24
|
enableColumnResizing: i = !0,
|
|
25
25
|
columnResizeMode: h = "onChange",
|
|
26
26
|
onRowClick: x,
|
|
27
|
-
actions:
|
|
27
|
+
actions: n,
|
|
28
28
|
height: w,
|
|
29
29
|
rowHeight: d = q,
|
|
30
30
|
className: T,
|
|
@@ -33,7 +33,7 @@ function ae({
|
|
|
33
33
|
const y = O({
|
|
34
34
|
columns: a,
|
|
35
35
|
checkboxSelection: m,
|
|
36
|
-
actions:
|
|
36
|
+
actions: n
|
|
37
37
|
}), {
|
|
38
38
|
sorting: R,
|
|
39
39
|
setSorting: S,
|
|
@@ -41,13 +41,13 @@ function ae({
|
|
|
41
41
|
setColumnFilters: F,
|
|
42
42
|
columnVisibility: M,
|
|
43
43
|
setColumnVisibility: E,
|
|
44
|
-
rowSelection:
|
|
44
|
+
rowSelection: f,
|
|
45
45
|
setRowSelection: N,
|
|
46
46
|
columnPinning: v,
|
|
47
47
|
handleColumnPinningChange: P
|
|
48
48
|
} = U({
|
|
49
49
|
persistKey: j,
|
|
50
|
-
hasActions: !!
|
|
50
|
+
hasActions: !!n
|
|
51
51
|
}), t = W({
|
|
52
52
|
data: s,
|
|
53
53
|
columns: y,
|
|
@@ -62,9 +62,9 @@ function ae({
|
|
|
62
62
|
...p && {
|
|
63
63
|
onSortingChange: S,
|
|
64
64
|
getSortedRowModel: K(),
|
|
65
|
-
manualSorting:
|
|
65
|
+
manualSorting: C
|
|
66
66
|
},
|
|
67
|
-
...
|
|
67
|
+
...b && {
|
|
68
68
|
onColumnFiltersChange: F,
|
|
69
69
|
getFilteredRowModel: J()
|
|
70
70
|
},
|
|
@@ -75,43 +75,43 @@ function ae({
|
|
|
75
75
|
sorting: R,
|
|
76
76
|
columnFilters: D,
|
|
77
77
|
columnVisibility: M,
|
|
78
|
-
rowSelection:
|
|
78
|
+
rowSelection: f,
|
|
79
79
|
columnPinning: v
|
|
80
80
|
}
|
|
81
81
|
});
|
|
82
82
|
if (L.useEffect(() => {
|
|
83
83
|
if (o) {
|
|
84
|
-
const r = t.getFilteredSelectedRowModel().rows.map((
|
|
84
|
+
const r = t.getFilteredSelectedRowModel().rows.map((l) => l.original);
|
|
85
85
|
o(r);
|
|
86
86
|
}
|
|
87
|
-
}, [
|
|
87
|
+
}, [f, o, t]), c)
|
|
88
88
|
return /* @__PURE__ */ e.jsx(
|
|
89
89
|
B,
|
|
90
90
|
{
|
|
91
91
|
columns: a,
|
|
92
92
|
checkboxSelection: m,
|
|
93
|
-
actions:
|
|
93
|
+
actions: n,
|
|
94
94
|
rowHeight: d
|
|
95
95
|
}
|
|
96
96
|
);
|
|
97
97
|
if (s.length === 0) {
|
|
98
98
|
const r = g || {}, {
|
|
99
|
-
title:
|
|
100
|
-
|
|
99
|
+
title: l = "No results",
|
|
100
|
+
description: V = "No data available",
|
|
101
101
|
media: A,
|
|
102
|
-
|
|
102
|
+
actions: H
|
|
103
103
|
} = r;
|
|
104
104
|
return /* @__PURE__ */ e.jsx(
|
|
105
105
|
X,
|
|
106
106
|
{
|
|
107
107
|
media: A,
|
|
108
|
-
title:
|
|
108
|
+
title: l,
|
|
109
109
|
description: V,
|
|
110
110
|
actions: H
|
|
111
111
|
}
|
|
112
112
|
);
|
|
113
113
|
}
|
|
114
|
-
return /* @__PURE__ */ e.jsx("div", { className:
|
|
114
|
+
return /* @__PURE__ */ e.jsx("div", { className: u("space-y-4", T), children: /* @__PURE__ */ e.jsx(
|
|
115
115
|
"div",
|
|
116
116
|
{
|
|
117
117
|
className: "rounded-md border overflow-x-auto",
|
|
@@ -119,7 +119,7 @@ function ae({
|
|
|
119
119
|
children: /* @__PURE__ */ e.jsxs(
|
|
120
120
|
_,
|
|
121
121
|
{
|
|
122
|
-
className:
|
|
122
|
+
className: u("table-fixed"),
|
|
123
123
|
style: { width: "max-content", minWidth: "100%" },
|
|
124
124
|
children: [
|
|
125
125
|
/* @__PURE__ */ e.jsx(
|
|
@@ -14,29 +14,6 @@ export interface DataTableActionsConfig<TData> {
|
|
|
14
14
|
/** Click handler for the default button (only used if render is not provided) */
|
|
15
15
|
onClick?: (row: TData) => void;
|
|
16
16
|
}
|
|
17
|
-
/**
|
|
18
|
-
* Configuration for DataTable empty state
|
|
19
|
-
*
|
|
20
|
-
* @example
|
|
21
|
-
* ```tsx
|
|
22
|
-
* {
|
|
23
|
-
* title: "No results",
|
|
24
|
-
* subtitle: "No data available",
|
|
25
|
-
* media: <EmptyIcon name="Wallet" />,
|
|
26
|
-
* children: <Button>Create</Button>
|
|
27
|
-
* }
|
|
28
|
-
* ```
|
|
29
|
-
*/
|
|
30
|
-
export interface DataTableEmptyConfig {
|
|
31
|
-
/** Title text displayed prominently */
|
|
32
|
-
title?: string;
|
|
33
|
-
/** Optional subtitle/description text displayed below the title */
|
|
34
|
-
subtitle?: string;
|
|
35
|
-
/** Media content to display (icon, image, or any ReactNode). Use EmptyIcon component for styled icons. */
|
|
36
|
-
media?: React.ReactNode;
|
|
37
|
-
/** Optional actions (buttons, links, or any ReactNode) displayed below the description */
|
|
38
|
-
children?: React.ReactNode;
|
|
39
|
-
}
|
|
40
17
|
/**
|
|
41
18
|
* Configuration for DataTableColumnHeader component
|
|
42
19
|
*
|