@yuno-payments/dashboard-design-system 0.0.167 → 0.0.170
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/access-denied-alert/access-denied-alert.d.ts +0 -16
- package/dist/components/atoms/accordion/accordion.d.ts +0 -66
- package/dist/components/atoms/alert/alert.d.ts +1 -26
- package/dist/components/atoms/alert/alert.js +8 -9
- package/dist/components/atoms/avatar/avatar-group.d.ts +0 -28
- package/dist/components/atoms/avatar/avatar.d.ts +0 -25
- package/dist/components/atoms/avatar/avatar.js +9 -9
- package/dist/components/atoms/badge/badge.d.ts +2 -30
- package/dist/components/atoms/badge/badge.js +11 -27
- package/dist/components/atoms/button/button.d.ts +0 -44
- package/dist/components/atoms/card/card.d.ts +3 -137
- package/dist/components/atoms/card/card.js +28 -56
- package/dist/components/atoms/checkbox/checkbox.d.ts +2 -38
- package/dist/components/atoms/checkbox/checkbox.js +27 -61
- package/dist/components/atoms/combobox/combobox.d.ts +0 -18
- package/dist/components/atoms/combobox/combobox.js +41 -41
- package/dist/components/atoms/combobox/types.d.ts +1 -90
- package/dist/components/atoms/currency-field/currency-field.d.ts +0 -38
- package/dist/components/atoms/currency-field/currency-field.js +19 -22
- package/dist/components/atoms/date-picker/date-picker.d.ts +0 -15
- package/dist/components/atoms/date-range-picker/date-range-picker.d.ts +0 -15
- package/dist/components/atoms/dots-menu/dots-menu.d.ts +0 -16
- package/dist/components/atoms/dots-menu/dots-menu.js +8 -8
- package/dist/components/atoms/dots-menu/dots-menu.types.d.ts +0 -52
- package/dist/components/atoms/dropdown-menu/dropdown-menu.d.ts +0 -50
- package/dist/components/atoms/field/field.d.ts +0 -55
- package/dist/components/atoms/field/field.js +46 -53
- package/dist/components/atoms/filter/filter-date-range.d.ts +2 -12
- package/dist/components/atoms/filter/filter-date-range.js +168 -203
- package/dist/components/atoms/filter/filter.d.ts +0 -6
- package/dist/components/atoms/filter/filter.js +76 -91
- package/dist/components/atoms/filter/index.d.ts +1 -1
- package/dist/components/atoms/filter-dropdown/filter-dropdown.d.ts +2 -208
- package/dist/components/atoms/filter-dropdown/filter-dropdown.js +160 -214
- package/dist/components/atoms/icon/icon-list.d.ts +0 -5
- package/dist/components/atoms/icon/icon-list.js +384 -394
- package/dist/components/atoms/icon/icon.d.ts +0 -29
- package/dist/components/atoms/index.d.ts +2 -3
- package/dist/components/atoms/label/index.d.ts +1 -1
- package/dist/components/atoms/link/link.d.ts +0 -20
- package/dist/components/atoms/multi-select/multi-select.d.ts +1 -1
- package/dist/components/atoms/multi-select/multi-select.js +6 -6
- package/dist/components/atoms/multi-values-field/multi-values-field.d.ts +0 -16
- package/dist/components/atoms/multi-values-field/multi-values-field.js +87 -109
- package/dist/components/atoms/multi-values-field/multi-values-field.types.d.ts +0 -81
- package/dist/components/atoms/otp-field/otp-field.d.ts +0 -32
- package/dist/components/atoms/password-field/password-field.d.ts +0 -23
- package/dist/components/atoms/password-field/password-field.js +1 -1
- package/dist/components/atoms/progress/progress.d.ts +0 -15
- package/dist/components/atoms/protected-field/protected-field.d.ts +0 -10
- package/dist/components/atoms/protected-field/protected-field.types.d.ts +0 -14
- package/dist/components/atoms/radio-group/radio-group-option.js +11 -11
- package/dist/components/atoms/radio-group/radio-group.d.ts +1 -50
- package/dist/components/atoms/radio-group/radio-group.js +12 -13
- package/dist/components/atoms/search-field/search-field.d.ts +0 -14
- package/dist/components/atoms/search-field/search-field.js +17 -17
- package/dist/components/atoms/search-field/search-field.types.d.ts +0 -57
- package/dist/components/atoms/select/index.d.ts +0 -2
- package/dist/components/atoms/select/select.d.ts +1 -83
- package/dist/components/atoms/select/select.js +21 -21
- package/dist/components/atoms/separator/separator.d.ts +0 -17
- package/dist/components/atoms/skeleton/index.d.ts +0 -9
- package/dist/components/atoms/switch/switch.d.ts +2 -56
- package/dist/components/atoms/switch/switch.js +32 -64
- package/dist/components/atoms/tabs/index.d.ts +0 -16
- package/dist/components/atoms/textarea/textarea.d.ts +0 -32
- package/dist/components/atoms/textarea/textarea.js +1 -1
- package/dist/components/atoms/time-picker/time-picker.d.ts +2 -73
- package/dist/components/atoms/time-picker/time-picker.js +3 -218
- package/dist/components/atoms/toaster/index.d.ts +0 -15
- package/dist/components/atoms/toggle-group/toggle-group.d.ts +1 -26
- package/dist/components/atoms/toggle-group/toggle-group.js +14 -15
- package/dist/components/atoms/tooltip/tooltip.d.ts +2 -53
- package/dist/components/atoms/typography/typography.d.ts +0 -18
- package/dist/components/molecules/breadcrumb/breadcrumb.d.ts +0 -50
- package/dist/components/molecules/breadcrumb/breadcrumb.js +17 -17
- package/dist/components/molecules/dialog-content/dialog-content.d.ts +0 -16
- package/dist/components/molecules/dialog-footer/dialog-footer.d.ts +0 -20
- package/dist/components/molecules/dialog-header/dialog-header.d.ts +0 -31
- package/dist/components/molecules/empty/empty-icon.js +6 -6
- package/dist/components/molecules/empty/empty.d.ts +1 -16
- package/dist/components/molecules/empty/empty.js +34 -37
- package/dist/components/molecules/highlight-banner/highlight-banner.d.ts +0 -17
- package/dist/components/molecules/pagination/pagination.d.ts +0 -49
- package/dist/components/organisms/data-table/components/cells/data-table-list-cell.d.ts +0 -41
- package/dist/components/organisms/data-table/components/column-header/data-table-column-header-content.js +1 -1
- package/dist/components/organisms/data-table/components/column-header/data-table-column-header-menu.js +18 -18
- package/dist/components/organisms/data-table/components/column-header/data-table-column-header.d.ts +0 -18
- package/dist/components/organisms/data-table/components/column-header/data-table-column-header.js +10 -10
- package/dist/components/organisms/data-table/components/data-table-body.d.ts +0 -18
- package/dist/components/organisms/data-table/components/data-table-header.d.ts +0 -12
- package/dist/components/organisms/data-table/components/data-table-header.js +7 -7
- package/dist/components/organisms/data-table/components/states/data-table-loading.d.ts +0 -24
- package/dist/components/organisms/data-table/components/states/data-table-loading.js +6 -6
- package/dist/components/organisms/data-table/data-table.d.ts +4 -133
- package/dist/components/organisms/data-table/data-table.js +100 -132
- package/dist/components/organisms/data-table/data-table.types.d.ts +26 -35
- package/dist/components/organisms/data-table/hooks/use-data-table-columns.js +41 -57
- package/dist/components/organisms/data-table/hooks/use-data-table-state.d.ts +2 -8
- package/dist/components/organisms/data-table/hooks/use-data-table-state.js +47 -82
- package/dist/components/organisms/data-table/utils/data-table-constants.d.ts +2 -8
- package/dist/components/organisms/data-table/utils/data-table-constants.js +10 -16
- package/dist/components/organisms/data-table/utils/data-table-styles.d.ts +0 -1652
- package/dist/components/organisms/data-table/utils/data-table-styles.js +14 -29
- package/dist/components/organisms/dialog/dialog.d.ts +1 -67
- package/dist/components/organisms/dialog/dialog.js +61 -78
- package/dist/components/organisms/index.d.ts +0 -2
- package/dist/components/organisms/sheet/sheet.d.ts +0 -69
- package/dist/components/organisms/sheet/sheet.js +33 -34
- package/dist/index.css +1 -1
- package/dist/index.d.ts +0 -2
- package/dist/index.js +162 -173
- package/dist/vendor/shadcn/avatar.js +19 -19
- package/dist/vendor/shadcn/badge.js +15 -15
- package/dist/vendor/shadcn/card.js +7 -7
- package/dist/vendor/shadcn/date-picker.d.ts +2 -2
- package/dist/vendor/shadcn/date-picker.js +1 -1
- package/dist/vendor/shadcn/date-range-picker.d.ts +2 -2
- package/dist/vendor/shadcn/date-range-picker.js +1 -1
- package/dist/vendor/shadcn/dialog.js +2 -2
- package/dist/vendor/shadcn/input-group.js +17 -17
- package/dist/vendor/shadcn/input.js +7 -7
- package/dist/vendor/shadcn/popover.js +1 -1
- package/dist/vendor/shadcn/select.js +2 -2
- package/dist/vendor/shadcn/sonner.d.ts +1 -26
- package/dist/vendor/shadcn/sonner.js +8 -12
- package/dist/vendor/shadcn/table.js +30 -30
- package/dist/vendor/shadcn/textarea.js +9 -9
- package/dist/vendor/shadcn/time-picker.d.ts +2 -1
- package/dist/vendor/shadcn/time-picker.js +23 -17
- package/dist/vendor/shadcn/toggle.js +13 -13
- package/dist/vendor/shadcn/tooltip.js +15 -25
- 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/components/atoms/label/label.d.ts +0 -11
- package/dist/components/atoms/label/label.js +0 -28
- package/dist/components/atoms/loading/index.d.ts +0 -1
- package/dist/components/atoms/loading/loading.d.ts +0 -39
- package/dist/components/atoms/loading/loading.js +0 -37
- package/dist/components/atoms/select/search-select.d.ts +0 -22
- package/dist/components/atoms/select/search-select.js +0 -201
- package/dist/components/organisms/tutorial/index.d.ts +0 -2
- package/dist/components/organisms/tutorial/tutorial.d.ts +0 -16
- package/dist/components/organisms/tutorial/tutorial.js +0 -114
- package/dist/components/organisms/tutorial/tutorial.types.d.ts +0 -15
- package/dist/hooks/index.d.ts +0 -3
- package/dist/hooks/use-body-scroll-lock.d.ts +0 -13
- package/dist/hooks/use-escape-key.d.ts +0 -14
- package/dist/hooks/use-media-query.d.ts +0 -20
- package/dist/hooks/use-media-query.js +0 -21
- package/dist/lib/notification-alert.d.ts +0 -42
- package/dist/lib/notification-alert.js +0 -75
- package/dist/node_modules/@phosphor-icons/react/dist/csr/File.es.js +0 -8
- package/dist/node_modules/@phosphor-icons/react/dist/csr/Microphone.es.js +0 -8
- package/dist/node_modules/@phosphor-icons/react/dist/csr/Stop.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/Microphone.es.js +0 -36
- package/dist/node_modules/@phosphor-icons/react/dist/defs/Stop.es.js +0 -36
- package/dist/node_modules/@phosphor-icons/react/dist/defs/Table.es.js +0 -30
|
@@ -1,173 +1,141 @@
|
|
|
1
1
|
import { j as e } from "../../../_virtual/jsx-runtime.js";
|
|
2
2
|
import * as L from "react";
|
|
3
|
-
import { useReactTable as
|
|
4
|
-
import { Table as
|
|
5
|
-
import { cn as
|
|
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
|
|
15
|
-
columns:
|
|
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
|
+
import { cn as f } from "../../../lib/utils.js";
|
|
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
|
+
columns: a,
|
|
16
16
|
data: s,
|
|
17
|
-
isLoading:
|
|
18
|
-
empty:
|
|
19
|
-
checkboxSelection:
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
height: E,
|
|
33
|
-
rowHeight: p = Y,
|
|
34
|
-
className: M,
|
|
35
|
-
persistKey: R,
|
|
36
|
-
initialSettings: N,
|
|
37
|
-
onUpdate: B
|
|
17
|
+
isLoading: c = !1,
|
|
18
|
+
empty: g,
|
|
19
|
+
checkboxSelection: m = !1,
|
|
20
|
+
onRowSelectionChange: o,
|
|
21
|
+
enableSorting: p = !0,
|
|
22
|
+
manualSorting: b = !1,
|
|
23
|
+
enableColumnFilters: C = !1,
|
|
24
|
+
enableColumnResizing: i = !0,
|
|
25
|
+
columnResizeMode: h = "onChange",
|
|
26
|
+
onRowClick: x,
|
|
27
|
+
actions: l,
|
|
28
|
+
height: w,
|
|
29
|
+
rowHeight: d = q,
|
|
30
|
+
className: T,
|
|
31
|
+
persistKey: j
|
|
38
32
|
}) {
|
|
39
|
-
const
|
|
40
|
-
columns:
|
|
41
|
-
checkboxSelection:
|
|
42
|
-
actions:
|
|
33
|
+
const y = O({
|
|
34
|
+
columns: a,
|
|
35
|
+
checkboxSelection: m,
|
|
36
|
+
actions: l
|
|
43
37
|
}), {
|
|
44
|
-
sorting:
|
|
45
|
-
setSorting:
|
|
46
|
-
columnFilters:
|
|
47
|
-
setColumnFilters:
|
|
48
|
-
columnVisibility:
|
|
49
|
-
setColumnVisibility:
|
|
50
|
-
rowSelection:
|
|
51
|
-
setRowSelection:
|
|
52
|
-
columnPinning:
|
|
53
|
-
handleColumnPinningChange:
|
|
54
|
-
} =
|
|
55
|
-
persistKey:
|
|
56
|
-
hasActions: !!
|
|
57
|
-
|
|
58
|
-
onExternalSortingChange: T,
|
|
59
|
-
externalRowSelection: m,
|
|
60
|
-
initialSettings: N,
|
|
61
|
-
onUpdate: B
|
|
62
|
-
}), f = k({
|
|
38
|
+
sorting: R,
|
|
39
|
+
setSorting: S,
|
|
40
|
+
columnFilters: D,
|
|
41
|
+
setColumnFilters: F,
|
|
42
|
+
columnVisibility: M,
|
|
43
|
+
setColumnVisibility: E,
|
|
44
|
+
rowSelection: u,
|
|
45
|
+
setRowSelection: N,
|
|
46
|
+
columnPinning: v,
|
|
47
|
+
handleColumnPinningChange: P
|
|
48
|
+
} = U({
|
|
49
|
+
persistKey: j,
|
|
50
|
+
hasActions: !!l
|
|
51
|
+
}), t = W({
|
|
63
52
|
data: s,
|
|
64
|
-
columns:
|
|
65
|
-
getCoreRowModel:
|
|
66
|
-
enableColumnResizing:
|
|
67
|
-
columnResizeMode:
|
|
68
|
-
enableColumnPinning:
|
|
53
|
+
columns: y,
|
|
54
|
+
getCoreRowModel: Q(),
|
|
55
|
+
enableColumnResizing: i,
|
|
56
|
+
columnResizeMode: h,
|
|
57
|
+
enableColumnPinning: !0,
|
|
69
58
|
defaultColumn: {
|
|
70
59
|
enableSorting: !1,
|
|
71
60
|
minSize: 50
|
|
72
61
|
},
|
|
73
|
-
...
|
|
74
|
-
onSortingChange:
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
getSortedRowModel: O(),
|
|
78
|
-
manualSorting: h
|
|
62
|
+
...p && {
|
|
63
|
+
onSortingChange: S,
|
|
64
|
+
getSortedRowModel: K(),
|
|
65
|
+
manualSorting: b
|
|
79
66
|
},
|
|
80
|
-
...
|
|
81
|
-
onColumnFiltersChange:
|
|
82
|
-
getFilteredRowModel:
|
|
67
|
+
...C && {
|
|
68
|
+
onColumnFiltersChange: F,
|
|
69
|
+
getFilteredRowModel: J()
|
|
83
70
|
},
|
|
84
|
-
onColumnVisibilityChange:
|
|
85
|
-
onRowSelectionChange:
|
|
86
|
-
|
|
87
|
-
if ($(t), l && m !== void 0) {
|
|
88
|
-
const r = Object.keys(t).filter((i) => t[i]).map((i) => s[parseInt(i)]).filter(Boolean);
|
|
89
|
-
l(t, r);
|
|
90
|
-
}
|
|
91
|
-
},
|
|
92
|
-
onColumnPinningChange: A,
|
|
71
|
+
onColumnVisibilityChange: E,
|
|
72
|
+
onRowSelectionChange: N,
|
|
73
|
+
onColumnPinningChange: P,
|
|
93
74
|
state: {
|
|
94
|
-
sorting:
|
|
95
|
-
columnFilters:
|
|
96
|
-
columnVisibility:
|
|
97
|
-
rowSelection:
|
|
98
|
-
columnPinning:
|
|
75
|
+
sorting: R,
|
|
76
|
+
columnFilters: D,
|
|
77
|
+
columnVisibility: M,
|
|
78
|
+
rowSelection: u,
|
|
79
|
+
columnPinning: v
|
|
99
80
|
}
|
|
100
81
|
});
|
|
101
82
|
if (L.useEffect(() => {
|
|
102
|
-
if (
|
|
103
|
-
const
|
|
104
|
-
|
|
83
|
+
if (o) {
|
|
84
|
+
const r = t.getFilteredSelectedRowModel().rows.map((n) => n.original);
|
|
85
|
+
o(r);
|
|
105
86
|
}
|
|
106
|
-
}, [
|
|
87
|
+
}, [u, o, t]), c)
|
|
107
88
|
return /* @__PURE__ */ e.jsx(
|
|
108
|
-
|
|
89
|
+
B,
|
|
109
90
|
{
|
|
110
|
-
columns:
|
|
111
|
-
checkboxSelection:
|
|
112
|
-
actions:
|
|
113
|
-
rowHeight:
|
|
91
|
+
columns: a,
|
|
92
|
+
checkboxSelection: m,
|
|
93
|
+
actions: l,
|
|
94
|
+
rowHeight: d
|
|
114
95
|
}
|
|
115
96
|
);
|
|
116
97
|
if (s.length === 0) {
|
|
117
|
-
const
|
|
118
|
-
title:
|
|
119
|
-
|
|
120
|
-
media:
|
|
121
|
-
|
|
122
|
-
} =
|
|
98
|
+
const r = g || {}, {
|
|
99
|
+
title: n = "No results",
|
|
100
|
+
subtitle: V = "No data available",
|
|
101
|
+
media: A,
|
|
102
|
+
children: H
|
|
103
|
+
} = r;
|
|
123
104
|
return /* @__PURE__ */ e.jsx(
|
|
124
|
-
|
|
105
|
+
X,
|
|
125
106
|
{
|
|
126
|
-
media:
|
|
127
|
-
title:
|
|
128
|
-
description:
|
|
129
|
-
actions:
|
|
107
|
+
media: A,
|
|
108
|
+
title: n,
|
|
109
|
+
description: V,
|
|
110
|
+
actions: H
|
|
130
111
|
}
|
|
131
112
|
);
|
|
132
113
|
}
|
|
133
|
-
return /* @__PURE__ */ e.jsx("div", { className:
|
|
114
|
+
return /* @__PURE__ */ e.jsx("div", { className: f("space-y-4", T), children: /* @__PURE__ */ e.jsx(
|
|
134
115
|
"div",
|
|
135
116
|
{
|
|
136
117
|
className: "rounded-md border overflow-x-auto",
|
|
137
|
-
style: { height:
|
|
118
|
+
style: { height: w || "auto" },
|
|
138
119
|
children: /* @__PURE__ */ e.jsxs(
|
|
139
|
-
|
|
120
|
+
_,
|
|
140
121
|
{
|
|
141
|
-
className:
|
|
122
|
+
className: f("table-fixed"),
|
|
123
|
+
style: { width: "max-content", minWidth: "100%" },
|
|
142
124
|
children: [
|
|
143
|
-
/* @__PURE__ */ e.jsx("colgroup", { children: f.getHeaderGroups()[0]?.headers.map((o) => {
|
|
144
|
-
const t = o.column.columnDef.enableResizing === !1, r = o.column.id === "_spacer", i = o.column.getSize();
|
|
145
|
-
return r ? /* @__PURE__ */ e.jsx("col", { style: { width: "auto" } }, o.id) : /* @__PURE__ */ e.jsx(
|
|
146
|
-
"col",
|
|
147
|
-
{
|
|
148
|
-
style: {
|
|
149
|
-
width: t ? `${i}px` : "auto",
|
|
150
|
-
minWidth: t ? `${i}px` : void 0,
|
|
151
|
-
maxWidth: t ? `${i}px` : void 0
|
|
152
|
-
}
|
|
153
|
-
},
|
|
154
|
-
o.id
|
|
155
|
-
);
|
|
156
|
-
}) }),
|
|
157
125
|
/* @__PURE__ */ e.jsx(
|
|
158
|
-
|
|
126
|
+
G,
|
|
159
127
|
{
|
|
160
|
-
table:
|
|
161
|
-
enableColumnResizing:
|
|
128
|
+
table: t,
|
|
129
|
+
enableColumnResizing: i
|
|
162
130
|
}
|
|
163
131
|
),
|
|
164
132
|
/* @__PURE__ */ e.jsx(
|
|
165
|
-
|
|
133
|
+
I,
|
|
166
134
|
{
|
|
167
|
-
table:
|
|
168
|
-
enableColumnResizing:
|
|
169
|
-
onRowClick:
|
|
170
|
-
rowHeight:
|
|
135
|
+
table: t,
|
|
136
|
+
enableColumnResizing: i,
|
|
137
|
+
onRowClick: x,
|
|
138
|
+
rowHeight: d
|
|
171
139
|
}
|
|
172
140
|
)
|
|
173
141
|
]
|
|
@@ -177,5 +145,5 @@ function po({
|
|
|
177
145
|
) });
|
|
178
146
|
}
|
|
179
147
|
export {
|
|
180
|
-
|
|
148
|
+
ae as DataTable
|
|
181
149
|
};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { ColumnDef, RowData, SortingState, VisibilityState, ColumnFiltersState, PaginationState,
|
|
1
|
+
import { ColumnDef, RowData, SortingState, VisibilityState, ColumnFiltersState, PaginationState, Table, Column, CellContext, HeaderContext } from '@tanstack/react-table';
|
|
2
2
|
import { IconName } from '../../atoms/icon';
|
|
3
|
-
import { EmptyProps } from '../../molecules';
|
|
4
3
|
declare module "@tanstack/react-table" {
|
|
5
4
|
interface TableMeta<TData extends RowData> {
|
|
6
5
|
updateData?: (rowIndex: number, columnId: string, value: unknown) => void;
|
|
@@ -14,6 +13,29 @@ export interface DataTableActionsConfig<TData> {
|
|
|
14
13
|
/** Click handler for the default button (only used if render is not provided) */
|
|
15
14
|
onClick?: (row: TData) => void;
|
|
16
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* Configuration for DataTable empty state
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```tsx
|
|
21
|
+
* {
|
|
22
|
+
* title: "No results",
|
|
23
|
+
* subtitle: "No data available",
|
|
24
|
+
* media: <EmptyIcon name="Wallet" />,
|
|
25
|
+
* children: <Button>Create</Button>
|
|
26
|
+
* }
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export interface DataTableEmptyConfig {
|
|
30
|
+
/** Title text displayed prominently */
|
|
31
|
+
title?: string;
|
|
32
|
+
/** Optional subtitle/description text displayed below the title */
|
|
33
|
+
subtitle?: string;
|
|
34
|
+
/** Media content to display (icon, image, or any ReactNode). Use EmptyIcon component for styled icons. */
|
|
35
|
+
media?: React.ReactNode;
|
|
36
|
+
/** Optional actions (buttons, links, or any ReactNode) displayed below the description */
|
|
37
|
+
children?: React.ReactNode;
|
|
38
|
+
}
|
|
17
39
|
/**
|
|
18
40
|
* Configuration for DataTableColumnHeader component
|
|
19
41
|
*
|
|
@@ -77,41 +99,13 @@ export type DataTableColumn<TData> = ColumnDef<TData> & {
|
|
|
77
99
|
enableSorting?: boolean;
|
|
78
100
|
enableHiding?: boolean;
|
|
79
101
|
};
|
|
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
102
|
export interface DataTableProps<TData> {
|
|
98
103
|
columns: DataTableColumn<TData>[];
|
|
99
104
|
data: TData[];
|
|
100
105
|
isLoading?: boolean;
|
|
101
|
-
empty?:
|
|
106
|
+
empty?: DataTableEmptyConfig;
|
|
102
107
|
checkboxSelection?: boolean;
|
|
103
|
-
|
|
104
|
-
* Controlled row selection state (optional)
|
|
105
|
-
* If provided, component operates in controlled mode
|
|
106
|
-
*/
|
|
107
|
-
rowSelection?: RowSelectionState;
|
|
108
|
-
/**
|
|
109
|
-
* Callback fired when row selection changes
|
|
110
|
-
* In controlled mode, you must update the rowSelection prop
|
|
111
|
-
* @param rowSelectionState - Object with row indices as keys (e.g., { "0": true, "2": true })
|
|
112
|
-
* @param selectedRows - Array of actual row data objects
|
|
113
|
-
*/
|
|
114
|
-
onRowSelectionChange?: (rowSelectionState: RowSelectionState, selectedRows: TData[]) => void;
|
|
108
|
+
onRowSelectionChange?: (selectedRows: TData[]) => void;
|
|
115
109
|
enablePagination?: boolean;
|
|
116
110
|
pageSize?: number;
|
|
117
111
|
pageIndex?: number;
|
|
@@ -125,15 +119,12 @@ export interface DataTableProps<TData> {
|
|
|
125
119
|
enableColumnFilters?: boolean;
|
|
126
120
|
columnFilters?: ColumnFiltersState;
|
|
127
121
|
onColumnFiltersChange?: (filters: ColumnFiltersState) => void;
|
|
128
|
-
enableColumnPinning?: boolean;
|
|
129
122
|
columnVisibility?: VisibilityState;
|
|
130
123
|
onColumnVisibilityChange?: (visibility: VisibilityState) => void;
|
|
131
124
|
onRowClick?: (row: TData) => void;
|
|
132
125
|
height?: string | number;
|
|
133
126
|
rowHeight?: number;
|
|
134
127
|
persistKey?: string;
|
|
135
|
-
initialSettings?: DataTableSettings;
|
|
136
|
-
onUpdate?: (settings: DataTableSettings) => void;
|
|
137
128
|
renderToolbar?: () => React.ReactNode;
|
|
138
129
|
renderActions?: () => React.ReactNode;
|
|
139
130
|
className?: string;
|
|
@@ -1,82 +1,78 @@
|
|
|
1
|
-
import { j as
|
|
1
|
+
import { j as n } from "../../../../_virtual/jsx-runtime.js";
|
|
2
2
|
import * as C from "react";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
function
|
|
9
|
-
columns:
|
|
3
|
+
import { DataTableColumnHeader as f } from "../components/column-header/data-table-column-header.js";
|
|
4
|
+
import { isHeaderConfig as S } from "../utils/data-table-utils.js";
|
|
5
|
+
import { ACTIONS_COLUMN_CONFIG as c } from "../utils/data-table-constants.js";
|
|
6
|
+
import { Checkbox as u } from "../../../atoms/checkbox/checkbox.js";
|
|
7
|
+
import { Button as h } from "../../../atoms/button/button.js";
|
|
8
|
+
function P({
|
|
9
|
+
columns: g,
|
|
10
10
|
checkboxSelection: d = !1,
|
|
11
|
-
actions:
|
|
11
|
+
actions: a
|
|
12
12
|
}) {
|
|
13
13
|
return C.useMemo(() => {
|
|
14
|
-
let
|
|
15
|
-
const { header: e, enablePinning: i = !0, ...
|
|
14
|
+
let l = g.map((r) => {
|
|
15
|
+
const { header: e, enablePinning: i = !0, ...t } = r, o = t.size !== void 0 ? { ...t, minSize: t.minSize ?? t.size } : t;
|
|
16
16
|
return typeof e == "string" ? {
|
|
17
|
-
...
|
|
17
|
+
...o,
|
|
18
18
|
enablePinning: i,
|
|
19
|
-
header: ({ column:
|
|
20
|
-
|
|
19
|
+
header: ({ column: s, table: m }) => /* @__PURE__ */ n.jsx(
|
|
20
|
+
f,
|
|
21
21
|
{
|
|
22
|
-
column:
|
|
22
|
+
column: s,
|
|
23
23
|
table: m,
|
|
24
24
|
title: e
|
|
25
25
|
}
|
|
26
26
|
)
|
|
27
|
-
} :
|
|
28
|
-
...
|
|
27
|
+
} : S(e) ? {
|
|
28
|
+
...o,
|
|
29
29
|
enablePinning: i,
|
|
30
|
-
header: ({ column:
|
|
31
|
-
|
|
30
|
+
header: ({ column: s, table: m }) => /* @__PURE__ */ n.jsx(
|
|
31
|
+
f,
|
|
32
32
|
{
|
|
33
|
-
column:
|
|
33
|
+
column: s,
|
|
34
34
|
table: m,
|
|
35
35
|
title: e.title,
|
|
36
36
|
info: e.info,
|
|
37
37
|
className: e.className
|
|
38
38
|
}
|
|
39
39
|
)
|
|
40
|
-
} : { ...
|
|
40
|
+
} : { ...o, header: e, enablePinning: i };
|
|
41
41
|
});
|
|
42
|
-
if (d && (
|
|
42
|
+
if (d && (l = [{
|
|
43
43
|
id: "select",
|
|
44
|
-
header: ({ table: e }) => /* @__PURE__ */
|
|
45
|
-
|
|
44
|
+
header: ({ table: e }) => /* @__PURE__ */ n.jsx(
|
|
45
|
+
u,
|
|
46
46
|
{
|
|
47
47
|
checked: e.getIsAllPageRowsSelected() || (e.getIsSomePageRowsSelected() ? "indeterminate" : !1),
|
|
48
|
-
|
|
48
|
+
onCheckedChange: (i) => e.toggleAllPageRowsSelected(!!i),
|
|
49
49
|
"aria-label": "Select all"
|
|
50
50
|
}
|
|
51
51
|
),
|
|
52
|
-
cell: ({ row: e }) => /* @__PURE__ */
|
|
53
|
-
|
|
52
|
+
cell: ({ row: e }) => /* @__PURE__ */ n.jsx(
|
|
53
|
+
u,
|
|
54
54
|
{
|
|
55
55
|
checked: e.getIsSelected(),
|
|
56
|
-
|
|
56
|
+
onCheckedChange: (i) => e.toggleSelected(!!i),
|
|
57
57
|
"aria-label": "Select row"
|
|
58
58
|
}
|
|
59
59
|
),
|
|
60
60
|
enableSorting: !1,
|
|
61
61
|
enableHiding: !1,
|
|
62
|
-
enablePinning: !1
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
minSize: c.minSize,
|
|
66
|
-
maxSize: c.maxSize
|
|
67
|
-
}, ...n]), l) {
|
|
68
|
-
const t = {
|
|
62
|
+
enablePinning: !1
|
|
63
|
+
}, ...l]), a) {
|
|
64
|
+
const r = {
|
|
69
65
|
id: "actions",
|
|
70
66
|
header: "",
|
|
71
|
-
cell: ({ row: e }) =>
|
|
72
|
-
|
|
67
|
+
cell: ({ row: e }) => a.render ? /* @__PURE__ */ n.jsx(n.Fragment, { children: a.render(e.original) }) : /* @__PURE__ */ n.jsx(
|
|
68
|
+
h,
|
|
73
69
|
{
|
|
74
70
|
variant: "ghost",
|
|
75
71
|
size: "icon",
|
|
76
72
|
startIcon: "Eye",
|
|
77
73
|
"aria-label": "Actions",
|
|
78
74
|
onClick: (i) => {
|
|
79
|
-
i.stopPropagation(),
|
|
75
|
+
i.stopPropagation(), a.onClick?.(e.original);
|
|
80
76
|
}
|
|
81
77
|
}
|
|
82
78
|
),
|
|
@@ -84,27 +80,15 @@ function _({
|
|
|
84
80
|
enableHiding: !1,
|
|
85
81
|
enablePinning: !1,
|
|
86
82
|
enableResizing: !1,
|
|
87
|
-
size:
|
|
88
|
-
minSize:
|
|
89
|
-
maxSize:
|
|
83
|
+
size: c.size,
|
|
84
|
+
minSize: c.minSize,
|
|
85
|
+
maxSize: c.maxSize
|
|
90
86
|
};
|
|
91
|
-
|
|
87
|
+
l = [...l, r];
|
|
92
88
|
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
header: "",
|
|
96
|
-
cell: () => null,
|
|
97
|
-
enableSorting: !1,
|
|
98
|
-
enableHiding: !1,
|
|
99
|
-
enablePinning: !1,
|
|
100
|
-
enableResizing: !1,
|
|
101
|
-
size: 100,
|
|
102
|
-
// Arbitrary value, colgroup will override with auto
|
|
103
|
-
minSize: 0
|
|
104
|
-
};
|
|
105
|
-
return n = [...n, u], n;
|
|
106
|
-
}, [d, l, f]);
|
|
89
|
+
return l;
|
|
90
|
+
}, [d, a, g]);
|
|
107
91
|
}
|
|
108
92
|
export {
|
|
109
|
-
|
|
93
|
+
P as useDataTableColumns
|
|
110
94
|
};
|
|
@@ -1,18 +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
|
-
externalRowSelection?: RowSelectionState;
|
|
10
|
-
initialSettings?: DataTableSettings;
|
|
11
|
-
onUpdate?: (settings: DataTableSettings) => void;
|
|
12
6
|
}
|
|
13
|
-
export declare function useDataTableState({ persistKey, hasActions,
|
|
7
|
+
export declare function useDataTableState({ persistKey, hasActions, }: UseDataTableStateProps): {
|
|
14
8
|
sorting: SortingState;
|
|
15
|
-
setSorting:
|
|
9
|
+
setSorting: React.Dispatch<React.SetStateAction<SortingState>>;
|
|
16
10
|
columnFilters: ColumnFiltersState;
|
|
17
11
|
setColumnFilters: React.Dispatch<React.SetStateAction<ColumnFiltersState>>;
|
|
18
12
|
columnVisibility: VisibilityState;
|