@yuno-payments/dashboard-design-system 0.0.170 → 0.0.172
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 +16 -0
- package/dist/components/atoms/accordion/accordion.d.ts +66 -0
- package/dist/components/atoms/alert/alert.d.ts +26 -1
- package/dist/components/atoms/alert/alert.js +9 -8
- package/dist/components/atoms/avatar/avatar-group.d.ts +28 -0
- package/dist/components/atoms/avatar/avatar.d.ts +25 -0
- package/dist/components/atoms/avatar/avatar.js +9 -9
- package/dist/components/atoms/badge/badge.d.ts +30 -2
- package/dist/components/atoms/badge/badge.js +27 -11
- package/dist/components/atoms/button/button.d.ts +44 -0
- package/dist/components/atoms/card/card.d.ts +137 -3
- package/dist/components/atoms/card/card.js +56 -28
- package/dist/components/atoms/checkbox/checkbox.d.ts +38 -2
- package/dist/components/atoms/checkbox/checkbox.js +61 -27
- package/dist/components/atoms/combobox/combobox.d.ts +18 -0
- package/dist/components/atoms/combobox/combobox.js +41 -41
- package/dist/components/atoms/combobox/types.d.ts +90 -1
- package/dist/components/atoms/currency-field/currency-field.d.ts +38 -0
- package/dist/components/atoms/currency-field/currency-field.js +22 -19
- package/dist/components/atoms/date-picker/date-picker.d.ts +15 -0
- package/dist/components/atoms/date-range-picker/date-range-picker.d.ts +15 -0
- package/dist/components/atoms/dots-menu/dots-menu.d.ts +16 -0
- package/dist/components/atoms/dots-menu/dots-menu.js +8 -8
- package/dist/components/atoms/dots-menu/dots-menu.types.d.ts +52 -0
- package/dist/components/atoms/dropdown-menu/dropdown-menu.d.ts +50 -0
- package/dist/components/atoms/field/field.d.ts +55 -0
- package/dist/components/atoms/field/field.js +53 -46
- package/dist/components/atoms/filter/filter-date-range.d.ts +12 -2
- package/dist/components/atoms/filter/filter-date-range.js +203 -168
- package/dist/components/atoms/filter/filter.d.ts +6 -0
- package/dist/components/atoms/filter/filter.js +91 -76
- package/dist/components/atoms/filter/index.d.ts +1 -1
- package/dist/components/atoms/filter-dropdown/filter-dropdown.d.ts +208 -2
- package/dist/components/atoms/filter-dropdown/filter-dropdown.js +214 -160
- package/dist/components/atoms/icon/aida-logo.d.ts +3 -0
- package/dist/components/atoms/icon/aida-logo.js +64 -0
- package/dist/components/atoms/icon/icon-list.d.ts +5 -0
- package/dist/components/atoms/icon/icon-list.js +394 -384
- package/dist/components/atoms/icon/icon.d.ts +29 -0
- package/dist/components/atoms/index.d.ts +3 -2
- package/dist/components/atoms/label/index.d.ts +1 -1
- package/dist/components/atoms/label/label.d.ts +11 -0
- package/dist/components/atoms/label/label.js +28 -0
- package/dist/components/atoms/link/link.d.ts +20 -0
- package/dist/components/atoms/loading/index.d.ts +1 -0
- package/dist/components/atoms/loading/loading.d.ts +39 -0
- package/dist/components/atoms/loading/loading.js +37 -0
- 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 +16 -0
- package/dist/components/atoms/multi-values-field/multi-values-field.js +109 -87
- package/dist/components/atoms/multi-values-field/multi-values-field.types.d.ts +81 -0
- package/dist/components/atoms/otp-field/otp-field.d.ts +32 -0
- package/dist/components/atoms/password-field/password-field.d.ts +23 -0
- package/dist/components/atoms/password-field/password-field.js +1 -1
- package/dist/components/atoms/progress/progress.d.ts +15 -0
- package/dist/components/atoms/protected-field/protected-field.d.ts +10 -0
- package/dist/components/atoms/protected-field/protected-field.types.d.ts +14 -0
- package/dist/components/atoms/radio-group/radio-group-option.js +11 -11
- package/dist/components/atoms/radio-group/radio-group.d.ts +50 -1
- package/dist/components/atoms/radio-group/radio-group.js +13 -12
- package/dist/components/atoms/search-field/search-field.d.ts +14 -0
- package/dist/components/atoms/search-field/search-field.js +17 -17
- package/dist/components/atoms/search-field/search-field.types.d.ts +57 -0
- package/dist/components/atoms/select/index.d.ts +2 -0
- package/dist/components/atoms/select/search-select.d.ts +22 -0
- package/dist/components/atoms/select/search-select.js +201 -0
- package/dist/components/atoms/select/select.d.ts +83 -1
- package/dist/components/atoms/select/select.js +21 -21
- package/dist/components/atoms/separator/separator.d.ts +17 -0
- package/dist/components/atoms/skeleton/index.d.ts +9 -0
- package/dist/components/atoms/switch/switch.d.ts +56 -2
- package/dist/components/atoms/switch/switch.js +64 -32
- package/dist/components/atoms/tabs/index.d.ts +16 -0
- package/dist/components/atoms/textarea/textarea.d.ts +32 -0
- package/dist/components/atoms/textarea/textarea.js +1 -1
- package/dist/components/atoms/time-picker/time-picker.d.ts +73 -2
- package/dist/components/atoms/time-picker/time-picker.js +218 -3
- package/dist/components/atoms/toaster/index.d.ts +15 -0
- package/dist/components/atoms/toggle-group/toggle-group.d.ts +26 -1
- package/dist/components/atoms/toggle-group/toggle-group.js +15 -14
- package/dist/components/atoms/tooltip/tooltip.d.ts +53 -2
- package/dist/components/atoms/typography/typography.d.ts +18 -0
- package/dist/components/molecules/breadcrumb/breadcrumb.d.ts +50 -0
- package/dist/components/molecules/breadcrumb/breadcrumb.js +17 -17
- package/dist/components/molecules/dialog-content/dialog-content.d.ts +16 -0
- package/dist/components/molecules/dialog-footer/dialog-footer.d.ts +20 -0
- package/dist/components/molecules/dialog-header/dialog-header.d.ts +31 -0
- package/dist/components/molecules/empty/empty-icon.js +6 -6
- package/dist/components/molecules/empty/empty.d.ts +16 -1
- package/dist/components/molecules/empty/empty.js +37 -34
- package/dist/components/molecules/highlight-banner/highlight-banner.d.ts +17 -0
- package/dist/components/molecules/pagination/pagination.d.ts +49 -0
- package/dist/components/organisms/data-table/components/cells/data-table-list-cell.d.ts +41 -0
- 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 +18 -0
- 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 +18 -0
- package/dist/components/organisms/data-table/components/data-table-header.d.ts +12 -0
- 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 +24 -0
- package/dist/components/organisms/data-table/components/states/data-table-loading.js +6 -6
- package/dist/components/organisms/data-table/data-table.d.ts +133 -4
- package/dist/components/organisms/data-table/data-table.js +132 -100
- package/dist/components/organisms/data-table/data-table.types.d.ts +35 -26
- package/dist/components/organisms/data-table/hooks/use-data-table-columns.js +57 -41
- package/dist/components/organisms/data-table/hooks/use-data-table-state.d.ts +8 -2
- package/dist/components/organisms/data-table/hooks/use-data-table-state.js +82 -47
- package/dist/components/organisms/data-table/utils/data-table-constants.d.ts +8 -2
- package/dist/components/organisms/data-table/utils/data-table-constants.js +16 -10
- package/dist/components/organisms/data-table/utils/data-table-styles.d.ts +1652 -0
- package/dist/components/organisms/data-table/utils/data-table-styles.js +29 -14
- package/dist/components/organisms/dialog/dialog.d.ts +67 -1
- package/dist/components/organisms/dialog/dialog.js +78 -61
- package/dist/components/organisms/index.d.ts +2 -0
- package/dist/components/organisms/sheet/sheet.d.ts +69 -0
- package/dist/components/organisms/sheet/sheet.js +34 -33
- package/dist/components/organisms/tutorial/index.d.ts +2 -0
- package/dist/components/organisms/tutorial/tutorial.d.ts +16 -0
- package/dist/components/organisms/tutorial/tutorial.js +114 -0
- package/dist/components/organisms/tutorial/tutorial.types.d.ts +15 -0
- package/dist/hooks/index.d.ts +3 -0
- package/dist/hooks/use-body-scroll-lock.d.ts +13 -0
- package/dist/hooks/use-escape-key.d.ts +14 -0
- package/dist/hooks/use-media-query.d.ts +20 -0
- package/dist/hooks/use-media-query.js +21 -0
- package/dist/index.css +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +173 -162
- package/dist/lib/notification-alert.d.ts +42 -0
- package/dist/lib/notification-alert.js +75 -0
- package/dist/node_modules/@phosphor-icons/react/dist/csr/File.es.js +8 -0
- package/dist/node_modules/@phosphor-icons/react/dist/csr/Microphone.es.js +8 -0
- package/dist/node_modules/@phosphor-icons/react/dist/csr/Stop.es.js +8 -0
- package/dist/node_modules/@phosphor-icons/react/dist/csr/Table.es.js +8 -0
- package/dist/node_modules/@phosphor-icons/react/dist/defs/File.es.js +30 -0
- package/dist/node_modules/@phosphor-icons/react/dist/defs/Microphone.es.js +36 -0
- package/dist/node_modules/@phosphor-icons/react/dist/defs/Stop.es.js +36 -0
- package/dist/node_modules/@phosphor-icons/react/dist/defs/Table.es.js +30 -0
- 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 +26 -1
- package/dist/vendor/shadcn/sonner.js +12 -8
- package/dist/vendor/shadcn/table.js +30 -30
- package/dist/vendor/shadcn/textarea.js +9 -9
- package/dist/vendor/shadcn/time-picker.d.ts +1 -2
- package/dist/vendor/shadcn/time-picker.js +17 -23
- package/dist/vendor/shadcn/toggle.js +13 -13
- package/dist/vendor/shadcn/tooltip.js +25 -15
- package/package.json +1 -1
|
@@ -1,7 +1,19 @@
|
|
|
1
1
|
import { Table } from '@tanstack/react-table';
|
|
2
|
+
/**
|
|
3
|
+
* Props for the DataTableHeader component
|
|
4
|
+
*/
|
|
2
5
|
interface DataTableHeaderProps<TData> {
|
|
6
|
+
/**
|
|
7
|
+
* TanStack Table instance
|
|
8
|
+
*/
|
|
3
9
|
table: Table<TData>;
|
|
10
|
+
/**
|
|
11
|
+
* Whether column resizing is enabled
|
|
12
|
+
*/
|
|
4
13
|
enableColumnResizing?: boolean;
|
|
5
14
|
}
|
|
15
|
+
/**
|
|
16
|
+
* Renders the table header with sortable and resizable columns
|
|
17
|
+
*/
|
|
6
18
|
export declare function DataTableHeader<TData>({ table, enableColumnResizing, }: DataTableHeaderProps<TData>): import("react/jsx-runtime").JSX.Element;
|
|
7
19
|
export {};
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { j as e } from "../../../../_virtual/jsx-runtime.js";
|
|
2
|
-
import { TableHeader as
|
|
3
|
-
import { DataTableHeaderCell as
|
|
2
|
+
import { TableHeader as i, TableRow as m } from "../../../../vendor/shadcn/table.js";
|
|
3
|
+
import { DataTableHeaderCell as o } from "./cells/data-table-header-cell.js";
|
|
4
4
|
function p({
|
|
5
|
-
table:
|
|
6
|
-
enableColumnResizing:
|
|
5
|
+
table: s,
|
|
6
|
+
enableColumnResizing: l
|
|
7
7
|
}) {
|
|
8
|
-
return /* @__PURE__ */ e.jsx(
|
|
9
|
-
|
|
8
|
+
return /* @__PURE__ */ e.jsx(i, { children: s.getHeaderGroups().map((a) => /* @__PURE__ */ e.jsx(m, { className: "bg-surface", children: a.headers.map((r) => /* @__PURE__ */ e.jsx(
|
|
9
|
+
o,
|
|
10
10
|
{
|
|
11
11
|
header: r,
|
|
12
|
-
enableColumnResizing:
|
|
12
|
+
enableColumnResizing: l ?? !1
|
|
13
13
|
},
|
|
14
14
|
r.id
|
|
15
15
|
)) }, a.id)) });
|
|
@@ -1,10 +1,34 @@
|
|
|
1
1
|
import { DataTableColumnDef, DataTableActionsConfig } from '../../data-table.types';
|
|
2
|
+
/**
|
|
3
|
+
* Props for the DataTableLoading component
|
|
4
|
+
*/
|
|
2
5
|
interface DataTableLoadingProps<TData, TValue = unknown> {
|
|
6
|
+
/**
|
|
7
|
+
* Column definitions to determine header structure
|
|
8
|
+
*/
|
|
3
9
|
columns: DataTableColumnDef<TData, TValue>[];
|
|
10
|
+
/**
|
|
11
|
+
* Number of skeleton rows to display
|
|
12
|
+
* @default 5
|
|
13
|
+
*/
|
|
4
14
|
rowsCount?: number;
|
|
15
|
+
/**
|
|
16
|
+
* Whether checkbox selection column is enabled
|
|
17
|
+
* @default false
|
|
18
|
+
*/
|
|
5
19
|
checkboxSelection?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Actions configuration to determine if actions column should be shown
|
|
22
|
+
*/
|
|
6
23
|
actions?: DataTableActionsConfig<TData>;
|
|
24
|
+
/**
|
|
25
|
+
* Fixed height for each skeleton row in pixels
|
|
26
|
+
*/
|
|
7
27
|
rowHeight?: number;
|
|
8
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* Loading state component for DataTable showing skeleton rows
|
|
31
|
+
* Displays a table structure with skeleton loaders matching the expected column layout
|
|
32
|
+
*/
|
|
9
33
|
export declare function DataTableLoading<TData, TValue = unknown>({ columns, rowsCount, checkboxSelection, actions, rowHeight, }: DataTableLoadingProps<TData, TValue>): import("react/jsx-runtime").JSX.Element;
|
|
10
34
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { j as e } from "../../../../../_virtual/jsx-runtime.js";
|
|
2
|
-
import { Table as u, TableHeader as
|
|
2
|
+
import { Table as u, TableHeader as f, TableRow as a, TableHead as x, TableBody as p, TableCell as h } from "../../../../../vendor/shadcn/table.js";
|
|
3
3
|
import { Skeleton as o } from "../../../../../vendor/shadcn/skeleton.js";
|
|
4
4
|
function j(s) {
|
|
5
5
|
return typeof s == "object" && s !== null && "title" in s && typeof s.title == "string";
|
|
@@ -13,20 +13,20 @@ function v({
|
|
|
13
13
|
rowsCount: l = 5,
|
|
14
14
|
checkboxSelection: c = !1,
|
|
15
15
|
actions: d,
|
|
16
|
-
rowHeight:
|
|
16
|
+
rowHeight: t
|
|
17
17
|
}) {
|
|
18
18
|
const n = [];
|
|
19
19
|
return c && n.push(null), s.forEach((r) => {
|
|
20
20
|
n.push(b(r));
|
|
21
21
|
}), d && n.push("Actions"), /* @__PURE__ */ e.jsx("div", { className: "space-y-4", children: /* @__PURE__ */ e.jsx("div", { className: "rounded-md border", children: /* @__PURE__ */ e.jsxs(u, { children: [
|
|
22
|
-
/* @__PURE__ */ e.jsx(
|
|
23
|
-
/* @__PURE__ */ e.jsx(p, { children: Array.from({ length: l }).map((r,
|
|
22
|
+
/* @__PURE__ */ e.jsx(f, { children: /* @__PURE__ */ e.jsx(a, { className: "bg-surface", children: n.map((r, i) => /* @__PURE__ */ e.jsx(x, { children: r ? /* @__PURE__ */ e.jsx("div", { className: "text-xs font-medium", children: r }) : /* @__PURE__ */ e.jsx(o, { className: "h-4 w-4" }) }, i)) }) }),
|
|
23
|
+
/* @__PURE__ */ e.jsx(p, { children: Array.from({ length: l }).map((r, i) => /* @__PURE__ */ e.jsx(
|
|
24
24
|
a,
|
|
25
25
|
{
|
|
26
|
-
style: { height:
|
|
26
|
+
style: { height: t ? `${t}px` : void 0 },
|
|
27
27
|
children: n.map((T, m) => /* @__PURE__ */ e.jsx(h, { children: /* @__PURE__ */ e.jsx(o, { className: "h-4 w-[80px]" }) }, m))
|
|
28
28
|
},
|
|
29
|
-
|
|
29
|
+
i
|
|
30
30
|
)) })
|
|
31
31
|
] }) }) });
|
|
32
32
|
}
|
|
@@ -1,22 +1,151 @@
|
|
|
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';
|
|
4
|
+
/**
|
|
5
|
+
* Props for the DataTable component
|
|
6
|
+
*/
|
|
3
7
|
export interface DataTableProps<TData, TValue> {
|
|
8
|
+
/**
|
|
9
|
+
* Column definitions for the table
|
|
10
|
+
*/
|
|
4
11
|
columns: DataTableColumnDef<TData, TValue>[];
|
|
12
|
+
/**
|
|
13
|
+
* Array of data to display in the table
|
|
14
|
+
*/
|
|
5
15
|
data: TData[];
|
|
16
|
+
/**
|
|
17
|
+
* Whether the table is in a loading state
|
|
18
|
+
* @default false
|
|
19
|
+
*/
|
|
6
20
|
isLoading?: boolean;
|
|
7
|
-
|
|
21
|
+
/**
|
|
22
|
+
* Configuration for the empty state when no data is available
|
|
23
|
+
*/
|
|
24
|
+
empty?: EmptyProps;
|
|
25
|
+
/**
|
|
26
|
+
* Whether to enable checkbox selection column
|
|
27
|
+
* @default false
|
|
28
|
+
*/
|
|
8
29
|
checkboxSelection?: boolean;
|
|
9
|
-
|
|
30
|
+
/**
|
|
31
|
+
* Controlled row selection state (optional)
|
|
32
|
+
* If provided, component operates in controlled mode
|
|
33
|
+
*/
|
|
34
|
+
rowSelection?: import('@tanstack/react-table').RowSelectionState;
|
|
35
|
+
/**
|
|
36
|
+
* Callback fired when row selection changes
|
|
37
|
+
* In controlled mode, you must update the rowSelection prop
|
|
38
|
+
*/
|
|
39
|
+
onRowSelectionChange?: (rowSelectionState: import('@tanstack/react-table').RowSelectionState, selectedRows: TData[]) => void;
|
|
40
|
+
/**
|
|
41
|
+
* Whether to enable column sorting
|
|
42
|
+
* @default true
|
|
43
|
+
*/
|
|
10
44
|
enableSorting?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Whether sorting is handled manually (server-side)
|
|
47
|
+
* @default false
|
|
48
|
+
*/
|
|
11
49
|
manualSorting?: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Controlled sorting state (optional)
|
|
52
|
+
* If provided, component operates in controlled mode
|
|
53
|
+
*/
|
|
54
|
+
sorting?: import('@tanstack/react-table').SortingState;
|
|
55
|
+
/**
|
|
56
|
+
* Callback when sorting changes (required for controlled mode)
|
|
57
|
+
*/
|
|
58
|
+
onSortingChange?: (sorting: import('@tanstack/react-table').SortingState) => void;
|
|
59
|
+
/**
|
|
60
|
+
* Whether to enable column filtering
|
|
61
|
+
* @default false
|
|
62
|
+
*/
|
|
12
63
|
enableColumnFilters?: boolean;
|
|
64
|
+
/**
|
|
65
|
+
* Whether to enable column resizing
|
|
66
|
+
* @default true
|
|
67
|
+
*/
|
|
13
68
|
enableColumnResizing?: boolean;
|
|
69
|
+
/**
|
|
70
|
+
* Column resize mode: 'onChange' or 'onEnd'
|
|
71
|
+
* @default 'onChange'
|
|
72
|
+
*/
|
|
14
73
|
columnResizeMode?: ColumnResizeMode;
|
|
74
|
+
/**
|
|
75
|
+
* Whether to enable column pinning
|
|
76
|
+
* @default true
|
|
77
|
+
*/
|
|
78
|
+
enableColumnPinning?: boolean;
|
|
79
|
+
/**
|
|
80
|
+
* Callback fired when a row is clicked
|
|
81
|
+
*/
|
|
15
82
|
onRowClick?: (row: TData) => void;
|
|
83
|
+
/**
|
|
84
|
+
* Configuration for actions column (always pinned to the right)
|
|
85
|
+
*/
|
|
16
86
|
actions?: DataTableActionsConfig<TData>;
|
|
87
|
+
/**
|
|
88
|
+
* Fixed height for the table container
|
|
89
|
+
*/
|
|
17
90
|
height?: string | number;
|
|
91
|
+
/**
|
|
92
|
+
* Height for each row in pixels
|
|
93
|
+
* @default 52
|
|
94
|
+
*/
|
|
18
95
|
rowHeight?: number;
|
|
96
|
+
/**
|
|
97
|
+
* Additional CSS classes for the container
|
|
98
|
+
*/
|
|
19
99
|
className?: string;
|
|
100
|
+
/**
|
|
101
|
+
* Unique key for persisting table state in localStorage
|
|
102
|
+
*/
|
|
20
103
|
persistKey?: string;
|
|
104
|
+
/**
|
|
105
|
+
* Initial settings to load (from backend/profile)
|
|
106
|
+
* Takes precedence over localStorage
|
|
107
|
+
*/
|
|
108
|
+
initialSettings?: import('./data-table.types').DataTableSettings;
|
|
109
|
+
/**
|
|
110
|
+
* Callback when table settings change (for syncing to backend)
|
|
111
|
+
*/
|
|
112
|
+
onUpdate?: (settings: import('./data-table.types').DataTableSettings) => void;
|
|
21
113
|
}
|
|
22
|
-
|
|
114
|
+
/**
|
|
115
|
+
* Advanced data table component built on TanStack Table.
|
|
116
|
+
* Features sorting, filtering, column resizing, row selection, and loading/empty states.
|
|
117
|
+
* Supports column pinning, visibility control, and state persistence.
|
|
118
|
+
*
|
|
119
|
+
* @example
|
|
120
|
+
* ```tsx
|
|
121
|
+
* // Uncontrolled selection
|
|
122
|
+
* <DataTable
|
|
123
|
+
* columns={[
|
|
124
|
+
* { accessorKey: 'name', header: 'Name' },
|
|
125
|
+
* { accessorKey: 'email', header: 'Email' }
|
|
126
|
+
* ]}
|
|
127
|
+
* data={users}
|
|
128
|
+
* checkboxSelection
|
|
129
|
+
* onRowSelectionChange={(rowSelectionState, selectedRows) => {
|
|
130
|
+
* console.log('Selected rows:', selectedRows);
|
|
131
|
+
* }}
|
|
132
|
+
* actions={{
|
|
133
|
+
* items: [{ label: 'Edit', onClick: (row) => editUser(row) }]
|
|
134
|
+
* }}
|
|
135
|
+
* />
|
|
136
|
+
*
|
|
137
|
+
* // Controlled selection
|
|
138
|
+
* const [rowSelection, setRowSelection] = useState({});
|
|
139
|
+
* <DataTable
|
|
140
|
+
* columns={columns}
|
|
141
|
+
* data={users}
|
|
142
|
+
* checkboxSelection
|
|
143
|
+
* rowSelection={rowSelection}
|
|
144
|
+
* onRowSelectionChange={(newRowSelection, selectedRows) => {
|
|
145
|
+
* setRowSelection(newRowSelection);
|
|
146
|
+
* console.log('Selected rows:', selectedRows);
|
|
147
|
+
* }}
|
|
148
|
+
* />
|
|
149
|
+
* ```
|
|
150
|
+
*/
|
|
151
|
+
export declare function DataTable<TData, TValue>({ columns, data, isLoading, empty, checkboxSelection, rowSelection: externalRowSelection, onRowSelectionChange, enableSorting, manualSorting, sorting: externalSorting, onSortingChange: externalOnSortingChange, enableColumnFilters, enableColumnResizing, columnResizeMode, enableColumnPinning, onRowClick, actions, height, rowHeight, className, persistKey, initialSettings, onUpdate, }: DataTableProps<TData, TValue>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,141 +1,173 @@
|
|
|
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 k } from "../../../node_modules/@tanstack/react-table/build/lib/index.js";
|
|
4
|
+
import { Table as U } from "../../../vendor/shadcn/table.js";
|
|
5
|
+
import { cn as x } from "../../../lib/utils.js";
|
|
6
|
+
import { DataTableLoading as q } from "./components/states/data-table-loading.js";
|
|
7
|
+
import { DataTableHeader as J } from "./components/data-table-header.js";
|
|
8
|
+
import { DataTableBody as K } from "./components/data-table-body.js";
|
|
9
|
+
import { useDataTableColumns as Q } from "./hooks/use-data-table-columns.js";
|
|
10
|
+
import { useDataTableState as X } from "./hooks/use-data-table-state.js";
|
|
11
|
+
import { ROW_HEIGHT_DEFAULT as Y } from "./utils/data-table-constants.js";
|
|
12
|
+
import { getFilteredRowModel as Z, getSortedRowModel as O, getCoreRowModel as V } from "../../../node_modules/@tanstack/table-core/build/lib/index.js";
|
|
13
|
+
import { Empty as oo } from "../../molecules/empty/empty.js";
|
|
14
|
+
function po({
|
|
15
|
+
columns: u,
|
|
16
16
|
data: s,
|
|
17
|
-
isLoading:
|
|
18
|
-
empty:
|
|
19
|
-
checkboxSelection:
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
17
|
+
isLoading: C = !1,
|
|
18
|
+
empty: y,
|
|
19
|
+
checkboxSelection: d = !1,
|
|
20
|
+
rowSelection: m,
|
|
21
|
+
onRowSelectionChange: l,
|
|
22
|
+
enableSorting: j = !0,
|
|
23
|
+
manualSorting: h = !1,
|
|
24
|
+
sorting: S,
|
|
25
|
+
onSortingChange: T,
|
|
26
|
+
enableColumnFilters: w = !1,
|
|
27
|
+
enableColumnResizing: a = !0,
|
|
28
|
+
columnResizeMode: v = "onChange",
|
|
29
|
+
enableColumnPinning: D = !0,
|
|
30
|
+
onRowClick: F,
|
|
31
|
+
actions: c,
|
|
32
|
+
height: E,
|
|
33
|
+
rowHeight: p = Y,
|
|
34
|
+
className: M,
|
|
35
|
+
persistKey: R,
|
|
36
|
+
initialSettings: N,
|
|
37
|
+
onUpdate: B
|
|
32
38
|
}) {
|
|
33
|
-
const
|
|
34
|
-
columns:
|
|
35
|
-
checkboxSelection:
|
|
36
|
-
actions:
|
|
39
|
+
const H = Q({
|
|
40
|
+
columns: u,
|
|
41
|
+
checkboxSelection: d,
|
|
42
|
+
actions: c
|
|
37
43
|
}), {
|
|
38
|
-
sorting:
|
|
39
|
-
setSorting:
|
|
40
|
-
columnFilters:
|
|
41
|
-
setColumnFilters:
|
|
42
|
-
columnVisibility:
|
|
43
|
-
setColumnVisibility:
|
|
44
|
-
rowSelection:
|
|
45
|
-
setRowSelection:
|
|
46
|
-
columnPinning:
|
|
47
|
-
handleColumnPinningChange:
|
|
48
|
-
} =
|
|
49
|
-
persistKey:
|
|
50
|
-
hasActions: !!
|
|
51
|
-
|
|
44
|
+
sorting: g,
|
|
45
|
+
setSorting: b,
|
|
46
|
+
columnFilters: I,
|
|
47
|
+
setColumnFilters: P,
|
|
48
|
+
columnVisibility: W,
|
|
49
|
+
setColumnVisibility: _,
|
|
50
|
+
rowSelection: n,
|
|
51
|
+
setRowSelection: $,
|
|
52
|
+
columnPinning: z,
|
|
53
|
+
handleColumnPinningChange: A
|
|
54
|
+
} = X({
|
|
55
|
+
persistKey: R,
|
|
56
|
+
hasActions: !!c,
|
|
57
|
+
externalSorting: S,
|
|
58
|
+
onExternalSortingChange: T,
|
|
59
|
+
externalRowSelection: m,
|
|
60
|
+
initialSettings: N,
|
|
61
|
+
onUpdate: B
|
|
62
|
+
}), f = k({
|
|
52
63
|
data: s,
|
|
53
|
-
columns:
|
|
54
|
-
getCoreRowModel:
|
|
55
|
-
enableColumnResizing:
|
|
56
|
-
columnResizeMode:
|
|
57
|
-
enableColumnPinning:
|
|
64
|
+
columns: H,
|
|
65
|
+
getCoreRowModel: V(),
|
|
66
|
+
enableColumnResizing: a,
|
|
67
|
+
columnResizeMode: v,
|
|
68
|
+
enableColumnPinning: D,
|
|
58
69
|
defaultColumn: {
|
|
59
70
|
enableSorting: !1,
|
|
60
71
|
minSize: 50
|
|
61
72
|
},
|
|
62
|
-
...
|
|
63
|
-
onSortingChange:
|
|
64
|
-
|
|
65
|
-
|
|
73
|
+
...j && {
|
|
74
|
+
onSortingChange: (o) => {
|
|
75
|
+
b(typeof o == "function" ? o(g) : o);
|
|
76
|
+
},
|
|
77
|
+
getSortedRowModel: O(),
|
|
78
|
+
manualSorting: h
|
|
66
79
|
},
|
|
67
|
-
...
|
|
68
|
-
onColumnFiltersChange:
|
|
69
|
-
getFilteredRowModel:
|
|
80
|
+
...w && {
|
|
81
|
+
onColumnFiltersChange: P,
|
|
82
|
+
getFilteredRowModel: Z()
|
|
70
83
|
},
|
|
71
|
-
onColumnVisibilityChange:
|
|
72
|
-
onRowSelectionChange:
|
|
73
|
-
|
|
84
|
+
onColumnVisibilityChange: _,
|
|
85
|
+
onRowSelectionChange: (o) => {
|
|
86
|
+
const t = typeof o == "function" ? o(n) : o;
|
|
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,
|
|
74
93
|
state: {
|
|
75
|
-
sorting:
|
|
76
|
-
columnFilters:
|
|
77
|
-
columnVisibility:
|
|
78
|
-
rowSelection:
|
|
79
|
-
columnPinning:
|
|
94
|
+
sorting: g,
|
|
95
|
+
columnFilters: I,
|
|
96
|
+
columnVisibility: W,
|
|
97
|
+
rowSelection: n,
|
|
98
|
+
columnPinning: z
|
|
80
99
|
}
|
|
81
100
|
});
|
|
82
101
|
if (L.useEffect(() => {
|
|
83
|
-
if (
|
|
84
|
-
const
|
|
85
|
-
o
|
|
102
|
+
if (l && m === void 0) {
|
|
103
|
+
const o = Object.keys(n).filter((t) => n[t]).map((t) => s[parseInt(t)]).filter(Boolean);
|
|
104
|
+
l(n, o);
|
|
86
105
|
}
|
|
87
|
-
}, [
|
|
106
|
+
}, [n, l, s, m]), C)
|
|
88
107
|
return /* @__PURE__ */ e.jsx(
|
|
89
|
-
|
|
108
|
+
q,
|
|
90
109
|
{
|
|
91
|
-
columns:
|
|
92
|
-
checkboxSelection:
|
|
93
|
-
actions:
|
|
94
|
-
rowHeight:
|
|
110
|
+
columns: u,
|
|
111
|
+
checkboxSelection: d,
|
|
112
|
+
actions: c,
|
|
113
|
+
rowHeight: p
|
|
95
114
|
}
|
|
96
115
|
);
|
|
97
116
|
if (s.length === 0) {
|
|
98
|
-
const
|
|
99
|
-
title:
|
|
100
|
-
|
|
101
|
-
media:
|
|
102
|
-
|
|
103
|
-
} =
|
|
117
|
+
const o = y || {}, {
|
|
118
|
+
title: t = "No results",
|
|
119
|
+
description: r = "No data available",
|
|
120
|
+
media: i,
|
|
121
|
+
actions: G
|
|
122
|
+
} = o;
|
|
104
123
|
return /* @__PURE__ */ e.jsx(
|
|
105
|
-
|
|
124
|
+
oo,
|
|
106
125
|
{
|
|
107
|
-
media:
|
|
108
|
-
title:
|
|
109
|
-
description:
|
|
110
|
-
actions:
|
|
126
|
+
media: i,
|
|
127
|
+
title: t,
|
|
128
|
+
description: r,
|
|
129
|
+
actions: G
|
|
111
130
|
}
|
|
112
131
|
);
|
|
113
132
|
}
|
|
114
|
-
return /* @__PURE__ */ e.jsx("div", { className:
|
|
133
|
+
return /* @__PURE__ */ e.jsx("div", { className: x("yuno-data-table space-y-4", M), children: /* @__PURE__ */ e.jsx(
|
|
115
134
|
"div",
|
|
116
135
|
{
|
|
117
136
|
className: "rounded-md border overflow-x-auto",
|
|
118
|
-
style: { height:
|
|
137
|
+
style: { height: E || "auto" },
|
|
119
138
|
children: /* @__PURE__ */ e.jsxs(
|
|
120
|
-
|
|
139
|
+
U,
|
|
121
140
|
{
|
|
122
|
-
className:
|
|
123
|
-
style: { width: "max-content", minWidth: "100%" },
|
|
141
|
+
className: x("table-fixed"),
|
|
124
142
|
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
|
+
}) }),
|
|
125
157
|
/* @__PURE__ */ e.jsx(
|
|
126
|
-
|
|
158
|
+
J,
|
|
127
159
|
{
|
|
128
|
-
table:
|
|
129
|
-
enableColumnResizing:
|
|
160
|
+
table: f,
|
|
161
|
+
enableColumnResizing: a
|
|
130
162
|
}
|
|
131
163
|
),
|
|
132
164
|
/* @__PURE__ */ e.jsx(
|
|
133
|
-
|
|
165
|
+
K,
|
|
134
166
|
{
|
|
135
|
-
table:
|
|
136
|
-
enableColumnResizing:
|
|
137
|
-
onRowClick:
|
|
138
|
-
rowHeight:
|
|
167
|
+
table: f,
|
|
168
|
+
enableColumnResizing: a,
|
|
169
|
+
onRowClick: F,
|
|
170
|
+
rowHeight: p
|
|
139
171
|
}
|
|
140
172
|
)
|
|
141
173
|
]
|
|
@@ -145,5 +177,5 @@ function ae({
|
|
|
145
177
|
) });
|
|
146
178
|
}
|
|
147
179
|
export {
|
|
148
|
-
|
|
180
|
+
po as DataTable
|
|
149
181
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { ColumnDef, RowData, SortingState, VisibilityState, ColumnFiltersState, PaginationState, Table, Column, CellContext, HeaderContext } from '@tanstack/react-table';
|
|
1
|
+
import { ColumnDef, RowData, SortingState, VisibilityState, ColumnFiltersState, PaginationState, RowSelectionState, Table, Column, CellContext, HeaderContext } from '@tanstack/react-table';
|
|
2
2
|
import { IconName } from '../../atoms/icon';
|
|
3
|
+
import { EmptyProps } from '../../molecules';
|
|
3
4
|
declare module "@tanstack/react-table" {
|
|
4
5
|
interface TableMeta<TData extends RowData> {
|
|
5
6
|
updateData?: (rowIndex: number, columnId: string, value: unknown) => void;
|
|
@@ -13,29 +14,6 @@ export interface DataTableActionsConfig<TData> {
|
|
|
13
14
|
/** Click handler for the default button (only used if render is not provided) */
|
|
14
15
|
onClick?: (row: TData) => void;
|
|
15
16
|
}
|
|
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
|
-
}
|
|
39
17
|
/**
|
|
40
18
|
* Configuration for DataTableColumnHeader component
|
|
41
19
|
*
|
|
@@ -99,13 +77,41 @@ export type DataTableColumn<TData> = ColumnDef<TData> & {
|
|
|
99
77
|
enableSorting?: boolean;
|
|
100
78
|
enableHiding?: boolean;
|
|
101
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
|
+
}
|
|
102
97
|
export interface DataTableProps<TData> {
|
|
103
98
|
columns: DataTableColumn<TData>[];
|
|
104
99
|
data: TData[];
|
|
105
100
|
isLoading?: boolean;
|
|
106
|
-
empty?:
|
|
101
|
+
empty?: EmptyProps;
|
|
107
102
|
checkboxSelection?: boolean;
|
|
108
|
-
|
|
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;
|
|
109
115
|
enablePagination?: boolean;
|
|
110
116
|
pageSize?: number;
|
|
111
117
|
pageIndex?: number;
|
|
@@ -119,12 +125,15 @@ export interface DataTableProps<TData> {
|
|
|
119
125
|
enableColumnFilters?: boolean;
|
|
120
126
|
columnFilters?: ColumnFiltersState;
|
|
121
127
|
onColumnFiltersChange?: (filters: ColumnFiltersState) => void;
|
|
128
|
+
enableColumnPinning?: boolean;
|
|
122
129
|
columnVisibility?: VisibilityState;
|
|
123
130
|
onColumnVisibilityChange?: (visibility: VisibilityState) => void;
|
|
124
131
|
onRowClick?: (row: TData) => void;
|
|
125
132
|
height?: string | number;
|
|
126
133
|
rowHeight?: number;
|
|
127
134
|
persistKey?: string;
|
|
135
|
+
initialSettings?: DataTableSettings;
|
|
136
|
+
onUpdate?: (settings: DataTableSettings) => void;
|
|
128
137
|
renderToolbar?: () => React.ReactNode;
|
|
129
138
|
renderActions?: () => React.ReactNode;
|
|
130
139
|
className?: string;
|