@yuno-payments/dashboard-design-system 0.0.170 → 0.0.171

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.
Files changed (161) hide show
  1. package/dist/components/atoms/access-denied-alert/access-denied-alert.d.ts +16 -0
  2. package/dist/components/atoms/accordion/accordion.d.ts +66 -0
  3. package/dist/components/atoms/alert/alert.d.ts +26 -1
  4. package/dist/components/atoms/alert/alert.js +9 -8
  5. package/dist/components/atoms/avatar/avatar-group.d.ts +28 -0
  6. package/dist/components/atoms/avatar/avatar.d.ts +25 -0
  7. package/dist/components/atoms/avatar/avatar.js +9 -9
  8. package/dist/components/atoms/badge/badge.d.ts +30 -2
  9. package/dist/components/atoms/badge/badge.js +27 -11
  10. package/dist/components/atoms/button/button.d.ts +44 -0
  11. package/dist/components/atoms/card/card.d.ts +137 -3
  12. package/dist/components/atoms/card/card.js +56 -28
  13. package/dist/components/atoms/checkbox/checkbox.d.ts +38 -2
  14. package/dist/components/atoms/checkbox/checkbox.js +61 -27
  15. package/dist/components/atoms/combobox/combobox.d.ts +18 -0
  16. package/dist/components/atoms/combobox/combobox.js +41 -41
  17. package/dist/components/atoms/combobox/types.d.ts +90 -1
  18. package/dist/components/atoms/currency-field/currency-field.d.ts +38 -0
  19. package/dist/components/atoms/currency-field/currency-field.js +22 -19
  20. package/dist/components/atoms/date-picker/date-picker.d.ts +15 -0
  21. package/dist/components/atoms/date-range-picker/date-range-picker.d.ts +15 -0
  22. package/dist/components/atoms/dots-menu/dots-menu.d.ts +16 -0
  23. package/dist/components/atoms/dots-menu/dots-menu.js +8 -8
  24. package/dist/components/atoms/dots-menu/dots-menu.types.d.ts +52 -0
  25. package/dist/components/atoms/dropdown-menu/dropdown-menu.d.ts +50 -0
  26. package/dist/components/atoms/field/field.d.ts +55 -0
  27. package/dist/components/atoms/field/field.js +53 -46
  28. package/dist/components/atoms/filter/filter-date-range.d.ts +12 -2
  29. package/dist/components/atoms/filter/filter-date-range.js +203 -168
  30. package/dist/components/atoms/filter/filter.d.ts +6 -0
  31. package/dist/components/atoms/filter/filter.js +91 -76
  32. package/dist/components/atoms/filter/index.d.ts +1 -1
  33. package/dist/components/atoms/filter-dropdown/filter-dropdown.d.ts +208 -2
  34. package/dist/components/atoms/filter-dropdown/filter-dropdown.js +214 -160
  35. package/dist/components/atoms/icon/aida-logo.d.ts +3 -0
  36. package/dist/components/atoms/icon/aida-logo.js +64 -0
  37. package/dist/components/atoms/icon/icon-list.d.ts +5 -0
  38. package/dist/components/atoms/icon/icon-list.js +394 -384
  39. package/dist/components/atoms/icon/icon.d.ts +29 -0
  40. package/dist/components/atoms/index.d.ts +3 -2
  41. package/dist/components/atoms/label/index.d.ts +1 -1
  42. package/dist/components/atoms/label/label.d.ts +11 -0
  43. package/dist/components/atoms/label/label.js +28 -0
  44. package/dist/components/atoms/link/link.d.ts +20 -0
  45. package/dist/components/atoms/loading/index.d.ts +1 -0
  46. package/dist/components/atoms/loading/loading.d.ts +39 -0
  47. package/dist/components/atoms/loading/loading.js +37 -0
  48. package/dist/components/atoms/multi-select/multi-select.d.ts +1 -1
  49. package/dist/components/atoms/multi-select/multi-select.js +6 -6
  50. package/dist/components/atoms/multi-values-field/multi-values-field.d.ts +16 -0
  51. package/dist/components/atoms/multi-values-field/multi-values-field.js +109 -87
  52. package/dist/components/atoms/multi-values-field/multi-values-field.types.d.ts +81 -0
  53. package/dist/components/atoms/otp-field/otp-field.d.ts +32 -0
  54. package/dist/components/atoms/password-field/password-field.d.ts +23 -0
  55. package/dist/components/atoms/password-field/password-field.js +1 -1
  56. package/dist/components/atoms/progress/progress.d.ts +15 -0
  57. package/dist/components/atoms/protected-field/protected-field.d.ts +10 -0
  58. package/dist/components/atoms/protected-field/protected-field.types.d.ts +14 -0
  59. package/dist/components/atoms/radio-group/radio-group-option.js +11 -11
  60. package/dist/components/atoms/radio-group/radio-group.d.ts +50 -1
  61. package/dist/components/atoms/radio-group/radio-group.js +13 -12
  62. package/dist/components/atoms/search-field/search-field.d.ts +14 -0
  63. package/dist/components/atoms/search-field/search-field.js +17 -17
  64. package/dist/components/atoms/search-field/search-field.types.d.ts +57 -0
  65. package/dist/components/atoms/select/index.d.ts +2 -0
  66. package/dist/components/atoms/select/search-select.d.ts +22 -0
  67. package/dist/components/atoms/select/search-select.js +201 -0
  68. package/dist/components/atoms/select/select.d.ts +83 -1
  69. package/dist/components/atoms/select/select.js +21 -21
  70. package/dist/components/atoms/separator/separator.d.ts +17 -0
  71. package/dist/components/atoms/skeleton/index.d.ts +9 -0
  72. package/dist/components/atoms/switch/switch.d.ts +56 -2
  73. package/dist/components/atoms/switch/switch.js +64 -32
  74. package/dist/components/atoms/tabs/index.d.ts +16 -0
  75. package/dist/components/atoms/textarea/textarea.d.ts +32 -0
  76. package/dist/components/atoms/textarea/textarea.js +1 -1
  77. package/dist/components/atoms/time-picker/time-picker.d.ts +73 -2
  78. package/dist/components/atoms/time-picker/time-picker.js +218 -3
  79. package/dist/components/atoms/toaster/index.d.ts +15 -0
  80. package/dist/components/atoms/toggle-group/toggle-group.d.ts +26 -1
  81. package/dist/components/atoms/toggle-group/toggle-group.js +15 -14
  82. package/dist/components/atoms/tooltip/tooltip.d.ts +53 -2
  83. package/dist/components/atoms/typography/typography.d.ts +18 -0
  84. package/dist/components/molecules/breadcrumb/breadcrumb.d.ts +50 -0
  85. package/dist/components/molecules/breadcrumb/breadcrumb.js +17 -17
  86. package/dist/components/molecules/dialog-content/dialog-content.d.ts +16 -0
  87. package/dist/components/molecules/dialog-footer/dialog-footer.d.ts +20 -0
  88. package/dist/components/molecules/dialog-header/dialog-header.d.ts +31 -0
  89. package/dist/components/molecules/empty/empty-icon.js +6 -6
  90. package/dist/components/molecules/empty/empty.d.ts +16 -1
  91. package/dist/components/molecules/empty/empty.js +37 -34
  92. package/dist/components/molecules/highlight-banner/highlight-banner.d.ts +17 -0
  93. package/dist/components/molecules/pagination/pagination.d.ts +49 -0
  94. package/dist/components/organisms/data-table/components/cells/data-table-list-cell.d.ts +41 -0
  95. package/dist/components/organisms/data-table/components/column-header/data-table-column-header-content.js +1 -1
  96. package/dist/components/organisms/data-table/components/column-header/data-table-column-header-menu.js +18 -18
  97. package/dist/components/organisms/data-table/components/column-header/data-table-column-header.d.ts +18 -0
  98. package/dist/components/organisms/data-table/components/column-header/data-table-column-header.js +10 -10
  99. package/dist/components/organisms/data-table/components/data-table-body.d.ts +18 -0
  100. package/dist/components/organisms/data-table/components/data-table-header.d.ts +12 -0
  101. package/dist/components/organisms/data-table/components/data-table-header.js +7 -7
  102. package/dist/components/organisms/data-table/components/states/data-table-loading.d.ts +24 -0
  103. package/dist/components/organisms/data-table/components/states/data-table-loading.js +6 -6
  104. package/dist/components/organisms/data-table/data-table.d.ts +133 -4
  105. package/dist/components/organisms/data-table/data-table.js +132 -100
  106. package/dist/components/organisms/data-table/data-table.types.d.ts +35 -26
  107. package/dist/components/organisms/data-table/hooks/use-data-table-columns.js +57 -41
  108. package/dist/components/organisms/data-table/hooks/use-data-table-state.d.ts +8 -2
  109. package/dist/components/organisms/data-table/hooks/use-data-table-state.js +82 -47
  110. package/dist/components/organisms/data-table/utils/data-table-constants.d.ts +8 -2
  111. package/dist/components/organisms/data-table/utils/data-table-constants.js +16 -10
  112. package/dist/components/organisms/data-table/utils/data-table-styles.d.ts +1652 -0
  113. package/dist/components/organisms/data-table/utils/data-table-styles.js +29 -14
  114. package/dist/components/organisms/dialog/dialog.d.ts +67 -1
  115. package/dist/components/organisms/dialog/dialog.js +78 -61
  116. package/dist/components/organisms/index.d.ts +2 -0
  117. package/dist/components/organisms/sheet/sheet.d.ts +69 -0
  118. package/dist/components/organisms/sheet/sheet.js +34 -33
  119. package/dist/components/organisms/tutorial/index.d.ts +2 -0
  120. package/dist/components/organisms/tutorial/tutorial.d.ts +16 -0
  121. package/dist/components/organisms/tutorial/tutorial.js +114 -0
  122. package/dist/components/organisms/tutorial/tutorial.types.d.ts +15 -0
  123. package/dist/hooks/index.d.ts +3 -0
  124. package/dist/hooks/use-body-scroll-lock.d.ts +13 -0
  125. package/dist/hooks/use-escape-key.d.ts +14 -0
  126. package/dist/hooks/use-media-query.d.ts +20 -0
  127. package/dist/hooks/use-media-query.js +21 -0
  128. package/dist/index.css +1 -1
  129. package/dist/index.d.ts +2 -0
  130. package/dist/index.js +173 -162
  131. package/dist/lib/notification-alert.d.ts +42 -0
  132. package/dist/lib/notification-alert.js +75 -0
  133. package/dist/node_modules/@phosphor-icons/react/dist/csr/File.es.js +8 -0
  134. package/dist/node_modules/@phosphor-icons/react/dist/csr/Microphone.es.js +8 -0
  135. package/dist/node_modules/@phosphor-icons/react/dist/csr/Stop.es.js +8 -0
  136. package/dist/node_modules/@phosphor-icons/react/dist/csr/Table.es.js +8 -0
  137. package/dist/node_modules/@phosphor-icons/react/dist/defs/File.es.js +30 -0
  138. package/dist/node_modules/@phosphor-icons/react/dist/defs/Microphone.es.js +36 -0
  139. package/dist/node_modules/@phosphor-icons/react/dist/defs/Stop.es.js +36 -0
  140. package/dist/node_modules/@phosphor-icons/react/dist/defs/Table.es.js +30 -0
  141. package/dist/vendor/shadcn/avatar.js +19 -19
  142. package/dist/vendor/shadcn/badge.js +15 -15
  143. package/dist/vendor/shadcn/card.js +7 -7
  144. package/dist/vendor/shadcn/date-picker.d.ts +2 -2
  145. package/dist/vendor/shadcn/date-picker.js +1 -1
  146. package/dist/vendor/shadcn/date-range-picker.d.ts +2 -2
  147. package/dist/vendor/shadcn/date-range-picker.js +1 -1
  148. package/dist/vendor/shadcn/dialog.js +2 -2
  149. package/dist/vendor/shadcn/input-group.js +17 -17
  150. package/dist/vendor/shadcn/input.js +7 -7
  151. package/dist/vendor/shadcn/popover.js +1 -1
  152. package/dist/vendor/shadcn/select.js +2 -2
  153. package/dist/vendor/shadcn/sonner.d.ts +26 -1
  154. package/dist/vendor/shadcn/sonner.js +12 -8
  155. package/dist/vendor/shadcn/table.js +30 -30
  156. package/dist/vendor/shadcn/textarea.js +9 -9
  157. package/dist/vendor/shadcn/time-picker.d.ts +1 -2
  158. package/dist/vendor/shadcn/time-picker.js +17 -23
  159. package/dist/vendor/shadcn/toggle.js +13 -13
  160. package/dist/vendor/shadcn/tooltip.js +25 -15
  161. 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 t, TableRow as i } from "../../../../vendor/shadcn/table.js";
3
- import { DataTableHeaderCell as m } from "./cells/data-table-header-cell.js";
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: l,
6
- enableColumnResizing: s
5
+ table: s,
6
+ enableColumnResizing: l
7
7
  }) {
8
- return /* @__PURE__ */ e.jsx(t, { children: l.getHeaderGroups().map((a) => /* @__PURE__ */ e.jsx(i, { className: "bg-neutral-50", children: a.headers.map((r) => /* @__PURE__ */ e.jsx(
9
- m,
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: s ?? !1
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 x, TableRow as a, TableHead as f, TableBody as p, TableCell as h } from "../../../../../vendor/shadcn/table.js";
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: i
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(x, { children: /* @__PURE__ */ e.jsx(a, { className: "bg-neutral-50", children: n.map((r, t) => /* @__PURE__ */ e.jsx(f, { children: r ? /* @__PURE__ */ e.jsx("div", { className: "text-xs font-medium", children: r }) : /* @__PURE__ */ e.jsx(o, { className: "h-4 w-4" }) }, t)) }) }),
23
- /* @__PURE__ */ e.jsx(p, { children: Array.from({ length: l }).map((r, t) => /* @__PURE__ */ e.jsx(
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: i ? `${i}px` : void 0 },
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
- t
29
+ i
30
30
  )) })
31
31
  ] }) }) });
32
32
  }
@@ -1,22 +1,151 @@
1
1
  import { ColumnResizeMode } from '@tanstack/react-table';
2
- import { DataTableActionsConfig, DataTableColumnDef, DataTableEmptyConfig } from './data-table.types';
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
- empty?: DataTableEmptyConfig;
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
- onRowSelectionChange?: (selectedRows: TData[]) => void;
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
- 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;
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 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,
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: 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
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 y = O({
34
- columns: a,
35
- checkboxSelection: m,
36
- actions: l
39
+ const H = Q({
40
+ columns: u,
41
+ checkboxSelection: d,
42
+ actions: c
37
43
  }), {
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({
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: y,
54
- getCoreRowModel: Q(),
55
- enableColumnResizing: i,
56
- columnResizeMode: h,
57
- enableColumnPinning: !0,
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
- ...p && {
63
- onSortingChange: S,
64
- getSortedRowModel: K(),
65
- manualSorting: b
73
+ ...j && {
74
+ onSortingChange: (o) => {
75
+ b(typeof o == "function" ? o(g) : o);
76
+ },
77
+ getSortedRowModel: O(),
78
+ manualSorting: h
66
79
  },
67
- ...C && {
68
- onColumnFiltersChange: F,
69
- getFilteredRowModel: J()
80
+ ...w && {
81
+ onColumnFiltersChange: P,
82
+ getFilteredRowModel: Z()
70
83
  },
71
- onColumnVisibilityChange: E,
72
- onRowSelectionChange: N,
73
- onColumnPinningChange: P,
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: R,
76
- columnFilters: D,
77
- columnVisibility: M,
78
- rowSelection: u,
79
- columnPinning: v
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 (o) {
84
- const r = t.getFilteredSelectedRowModel().rows.map((n) => n.original);
85
- o(r);
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
- }, [u, o, t]), c)
106
+ }, [n, l, s, m]), C)
88
107
  return /* @__PURE__ */ e.jsx(
89
- B,
108
+ q,
90
109
  {
91
- columns: a,
92
- checkboxSelection: m,
93
- actions: l,
94
- rowHeight: d
110
+ columns: u,
111
+ checkboxSelection: d,
112
+ actions: c,
113
+ rowHeight: p
95
114
  }
96
115
  );
97
116
  if (s.length === 0) {
98
- const r = g || {}, {
99
- title: n = "No results",
100
- subtitle: V = "No data available",
101
- media: A,
102
- children: H
103
- } = r;
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
- X,
124
+ oo,
106
125
  {
107
- media: A,
108
- title: n,
109
- description: V,
110
- actions: H
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: f("space-y-4", T), children: /* @__PURE__ */ e.jsx(
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: w || "auto" },
137
+ style: { height: E || "auto" },
119
138
  children: /* @__PURE__ */ e.jsxs(
120
- _,
139
+ U,
121
140
  {
122
- className: f("table-fixed"),
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
- G,
158
+ J,
127
159
  {
128
- table: t,
129
- enableColumnResizing: i
160
+ table: f,
161
+ enableColumnResizing: a
130
162
  }
131
163
  ),
132
164
  /* @__PURE__ */ e.jsx(
133
- I,
165
+ K,
134
166
  {
135
- table: t,
136
- enableColumnResizing: i,
137
- onRowClick: x,
138
- rowHeight: d
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
- ae as DataTable
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?: DataTableEmptyConfig;
101
+ empty?: EmptyProps;
107
102
  checkboxSelection?: boolean;
108
- onRowSelectionChange?: (selectedRows: TData[]) => void;
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;