@yuno-payments/dashboard-design-system 0.0.166 → 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.
Files changed (161) hide show
  1. package/dist/components/atoms/access-denied-alert/access-denied-alert.d.ts +0 -16
  2. package/dist/components/atoms/accordion/accordion.d.ts +0 -66
  3. package/dist/components/atoms/alert/alert.d.ts +1 -26
  4. package/dist/components/atoms/alert/alert.js +8 -9
  5. package/dist/components/atoms/avatar/avatar-group.d.ts +0 -28
  6. package/dist/components/atoms/avatar/avatar.d.ts +0 -25
  7. package/dist/components/atoms/avatar/avatar.js +9 -9
  8. package/dist/components/atoms/badge/badge.d.ts +2 -30
  9. package/dist/components/atoms/badge/badge.js +11 -27
  10. package/dist/components/atoms/button/button.d.ts +0 -44
  11. package/dist/components/atoms/card/card.d.ts +3 -137
  12. package/dist/components/atoms/card/card.js +28 -56
  13. package/dist/components/atoms/checkbox/checkbox.d.ts +2 -38
  14. package/dist/components/atoms/checkbox/checkbox.js +27 -61
  15. package/dist/components/atoms/combobox/combobox.d.ts +0 -18
  16. package/dist/components/atoms/combobox/combobox.js +41 -41
  17. package/dist/components/atoms/combobox/types.d.ts +1 -90
  18. package/dist/components/atoms/currency-field/currency-field.d.ts +0 -38
  19. package/dist/components/atoms/currency-field/currency-field.js +19 -22
  20. package/dist/components/atoms/date-picker/date-picker.d.ts +0 -15
  21. package/dist/components/atoms/date-range-picker/date-range-picker.d.ts +0 -15
  22. package/dist/components/atoms/dots-menu/dots-menu.d.ts +0 -16
  23. package/dist/components/atoms/dots-menu/dots-menu.js +8 -8
  24. package/dist/components/atoms/dots-menu/dots-menu.types.d.ts +0 -52
  25. package/dist/components/atoms/dropdown-menu/dropdown-menu.d.ts +0 -50
  26. package/dist/components/atoms/field/field.d.ts +0 -55
  27. package/dist/components/atoms/field/field.js +46 -53
  28. package/dist/components/atoms/filter/filter-date-range.d.ts +2 -12
  29. package/dist/components/atoms/filter/filter-date-range.js +168 -203
  30. package/dist/components/atoms/filter/filter.d.ts +0 -6
  31. package/dist/components/atoms/filter/filter.js +76 -91
  32. package/dist/components/atoms/filter/index.d.ts +1 -1
  33. package/dist/components/atoms/filter-dropdown/filter-dropdown.d.ts +2 -208
  34. package/dist/components/atoms/filter-dropdown/filter-dropdown.js +160 -214
  35. package/dist/components/atoms/icon/icon-list.d.ts +0 -5
  36. package/dist/components/atoms/icon/icon-list.js +384 -394
  37. package/dist/components/atoms/icon/icon.d.ts +0 -29
  38. package/dist/components/atoms/index.d.ts +2 -3
  39. package/dist/components/atoms/label/index.d.ts +1 -1
  40. package/dist/components/atoms/link/link.d.ts +0 -20
  41. package/dist/components/atoms/multi-select/multi-select.d.ts +1 -1
  42. package/dist/components/atoms/multi-select/multi-select.js +6 -6
  43. package/dist/components/atoms/multi-values-field/multi-values-field.d.ts +0 -16
  44. package/dist/components/atoms/multi-values-field/multi-values-field.js +87 -109
  45. package/dist/components/atoms/multi-values-field/multi-values-field.types.d.ts +0 -81
  46. package/dist/components/atoms/otp-field/otp-field.d.ts +0 -32
  47. package/dist/components/atoms/password-field/password-field.d.ts +0 -23
  48. package/dist/components/atoms/password-field/password-field.js +1 -1
  49. package/dist/components/atoms/progress/progress.d.ts +0 -15
  50. package/dist/components/atoms/protected-field/protected-field.d.ts +0 -10
  51. package/dist/components/atoms/protected-field/protected-field.types.d.ts +0 -14
  52. package/dist/components/atoms/radio-group/radio-group-option.js +11 -11
  53. package/dist/components/atoms/radio-group/radio-group.d.ts +1 -50
  54. package/dist/components/atoms/radio-group/radio-group.js +12 -13
  55. package/dist/components/atoms/search-field/search-field.d.ts +0 -14
  56. package/dist/components/atoms/search-field/search-field.js +17 -17
  57. package/dist/components/atoms/search-field/search-field.types.d.ts +0 -57
  58. package/dist/components/atoms/select/index.d.ts +0 -2
  59. package/dist/components/atoms/select/select.d.ts +1 -83
  60. package/dist/components/atoms/select/select.js +21 -21
  61. package/dist/components/atoms/separator/separator.d.ts +0 -17
  62. package/dist/components/atoms/skeleton/index.d.ts +0 -9
  63. package/dist/components/atoms/switch/switch.d.ts +2 -56
  64. package/dist/components/atoms/switch/switch.js +32 -64
  65. package/dist/components/atoms/tabs/index.d.ts +0 -16
  66. package/dist/components/atoms/textarea/textarea.d.ts +0 -32
  67. package/dist/components/atoms/textarea/textarea.js +1 -1
  68. package/dist/components/atoms/time-picker/time-picker.d.ts +2 -73
  69. package/dist/components/atoms/time-picker/time-picker.js +3 -218
  70. package/dist/components/atoms/toaster/index.d.ts +0 -15
  71. package/dist/components/atoms/toggle-group/toggle-group.d.ts +1 -26
  72. package/dist/components/atoms/toggle-group/toggle-group.js +14 -15
  73. package/dist/components/atoms/tooltip/tooltip.d.ts +2 -53
  74. package/dist/components/atoms/typography/typography.d.ts +0 -18
  75. package/dist/components/molecules/breadcrumb/breadcrumb.d.ts +0 -50
  76. package/dist/components/molecules/breadcrumb/breadcrumb.js +17 -17
  77. package/dist/components/molecules/dialog-content/dialog-content.d.ts +0 -16
  78. package/dist/components/molecules/dialog-footer/dialog-footer.d.ts +0 -20
  79. package/dist/components/molecules/dialog-header/dialog-header.d.ts +0 -31
  80. package/dist/components/molecules/empty/empty-icon.js +6 -6
  81. package/dist/components/molecules/empty/empty.d.ts +1 -16
  82. package/dist/components/molecules/empty/empty.js +34 -37
  83. package/dist/components/molecules/highlight-banner/highlight-banner.d.ts +0 -17
  84. package/dist/components/molecules/pagination/pagination.d.ts +0 -49
  85. package/dist/components/organisms/data-table/components/cells/data-table-list-cell.d.ts +0 -41
  86. package/dist/components/organisms/data-table/components/column-header/data-table-column-header-content.js +1 -1
  87. package/dist/components/organisms/data-table/components/column-header/data-table-column-header-menu.js +18 -18
  88. package/dist/components/organisms/data-table/components/column-header/data-table-column-header.d.ts +0 -18
  89. package/dist/components/organisms/data-table/components/column-header/data-table-column-header.js +10 -10
  90. package/dist/components/organisms/data-table/components/data-table-body.d.ts +0 -18
  91. package/dist/components/organisms/data-table/components/data-table-header.d.ts +0 -12
  92. package/dist/components/organisms/data-table/components/data-table-header.js +7 -7
  93. package/dist/components/organisms/data-table/components/states/data-table-loading.d.ts +0 -24
  94. package/dist/components/organisms/data-table/components/states/data-table-loading.js +6 -6
  95. package/dist/components/organisms/data-table/data-table.d.ts +3 -115
  96. package/dist/components/organisms/data-table/data-table.js +104 -131
  97. package/dist/components/organisms/data-table/data-table.types.d.ts +24 -23
  98. package/dist/components/organisms/data-table/hooks/use-data-table-columns.js +41 -57
  99. package/dist/components/organisms/data-table/hooks/use-data-table-state.d.ts +2 -7
  100. package/dist/components/organisms/data-table/hooks/use-data-table-state.js +46 -80
  101. package/dist/components/organisms/data-table/utils/data-table-constants.d.ts +2 -8
  102. package/dist/components/organisms/data-table/utils/data-table-constants.js +10 -16
  103. package/dist/components/organisms/data-table/utils/data-table-styles.d.ts +0 -1652
  104. package/dist/components/organisms/data-table/utils/data-table-styles.js +14 -29
  105. package/dist/components/organisms/dialog/dialog.d.ts +1 -67
  106. package/dist/components/organisms/dialog/dialog.js +61 -78
  107. package/dist/components/organisms/index.d.ts +0 -2
  108. package/dist/components/organisms/sheet/sheet.d.ts +0 -69
  109. package/dist/components/organisms/sheet/sheet.js +33 -34
  110. package/dist/index.css +1 -1
  111. package/dist/index.d.ts +0 -2
  112. package/dist/index.js +162 -173
  113. package/dist/vendor/shadcn/avatar.js +19 -19
  114. package/dist/vendor/shadcn/badge.js +15 -15
  115. package/dist/vendor/shadcn/card.js +7 -7
  116. package/dist/vendor/shadcn/date-picker.d.ts +2 -2
  117. package/dist/vendor/shadcn/date-picker.js +1 -1
  118. package/dist/vendor/shadcn/date-range-picker.d.ts +2 -2
  119. package/dist/vendor/shadcn/date-range-picker.js +1 -1
  120. package/dist/vendor/shadcn/dialog.js +2 -2
  121. package/dist/vendor/shadcn/input-group.js +17 -17
  122. package/dist/vendor/shadcn/input.js +7 -7
  123. package/dist/vendor/shadcn/popover.js +1 -1
  124. package/dist/vendor/shadcn/select.js +2 -2
  125. package/dist/vendor/shadcn/sonner.d.ts +1 -26
  126. package/dist/vendor/shadcn/sonner.js +8 -12
  127. package/dist/vendor/shadcn/table.js +30 -30
  128. package/dist/vendor/shadcn/textarea.js +9 -9
  129. package/dist/vendor/shadcn/time-picker.d.ts +2 -1
  130. package/dist/vendor/shadcn/time-picker.js +23 -17
  131. package/dist/vendor/shadcn/toggle.js +13 -13
  132. package/dist/vendor/shadcn/tooltip.js +15 -25
  133. package/package.json +1 -1
  134. package/dist/components/atoms/icon/aida-logo.d.ts +0 -3
  135. package/dist/components/atoms/icon/aida-logo.js +0 -64
  136. package/dist/components/atoms/label/label.d.ts +0 -11
  137. package/dist/components/atoms/label/label.js +0 -28
  138. package/dist/components/atoms/loading/index.d.ts +0 -1
  139. package/dist/components/atoms/loading/loading.d.ts +0 -39
  140. package/dist/components/atoms/loading/loading.js +0 -37
  141. package/dist/components/atoms/select/search-select.d.ts +0 -22
  142. package/dist/components/atoms/select/search-select.js +0 -201
  143. package/dist/components/organisms/tutorial/index.d.ts +0 -2
  144. package/dist/components/organisms/tutorial/tutorial.d.ts +0 -16
  145. package/dist/components/organisms/tutorial/tutorial.js +0 -114
  146. package/dist/components/organisms/tutorial/tutorial.types.d.ts +0 -15
  147. package/dist/hooks/index.d.ts +0 -3
  148. package/dist/hooks/use-body-scroll-lock.d.ts +0 -13
  149. package/dist/hooks/use-escape-key.d.ts +0 -14
  150. package/dist/hooks/use-media-query.d.ts +0 -20
  151. package/dist/hooks/use-media-query.js +0 -21
  152. package/dist/lib/notification-alert.d.ts +0 -42
  153. package/dist/lib/notification-alert.js +0 -75
  154. package/dist/node_modules/@phosphor-icons/react/dist/csr/File.es.js +0 -8
  155. package/dist/node_modules/@phosphor-icons/react/dist/csr/Microphone.es.js +0 -8
  156. package/dist/node_modules/@phosphor-icons/react/dist/csr/Stop.es.js +0 -8
  157. package/dist/node_modules/@phosphor-icons/react/dist/csr/Table.es.js +0 -8
  158. package/dist/node_modules/@phosphor-icons/react/dist/defs/File.es.js +0 -30
  159. package/dist/node_modules/@phosphor-icons/react/dist/defs/Microphone.es.js +0 -36
  160. package/dist/node_modules/@phosphor-icons/react/dist/defs/Stop.es.js +0 -36
  161. package/dist/node_modules/@phosphor-icons/react/dist/defs/Table.es.js +0 -30
@@ -1,168 +1,141 @@
1
1
  import { j as e } from "../../../_virtual/jsx-runtime.js";
2
- import * as b from "react";
3
- import { useReactTable as U } from "../../../node_modules/@tanstack/react-table/build/lib/index.js";
4
- import { Table as V } from "../../../vendor/shadcn/table.js";
5
- import { cn as h } 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 Q } from "./components/data-table-body.js";
9
- import { useDataTableColumns as X } from "./hooks/use-data-table-columns.js";
10
- import { useDataTableState as Y } from "./hooks/use-data-table-state.js";
11
- import { ROW_HEIGHT_DEFAULT as Z } from "./utils/data-table-constants.js";
12
- import { getFilteredRowModel as k, getSortedRowModel as K, getCoreRowModel as O } from "../../../node_modules/@tanstack/table-core/build/lib/index.js";
13
- import { Empty as oo } from "../../molecules/empty/empty.js";
14
- function go({
15
- columns: m,
16
- data: d,
17
- isLoading: S = !1,
18
- empty: j,
19
- checkboxSelection: u = !1,
20
- selectionResetKey: c,
21
- onRowSelectionChange: l,
22
- enableSorting: w = !0,
23
- manualSorting: y = !1,
24
- sorting: T,
25
- onSortingChange: R,
26
- enableColumnFilters: D = !1,
27
- enableColumnResizing: r = !0,
28
- columnResizeMode: F = "onChange",
29
- enableColumnPinning: v = !0,
30
- onRowClick: E,
31
- actions: s,
32
- height: M,
33
- rowHeight: f = Z,
34
- className: N,
35
- persistKey: H,
36
- initialSettings: P,
37
- onUpdate: W
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,
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
38
32
  }) {
39
- const _ = X({
40
- columns: m,
41
- checkboxSelection: u,
42
- actions: s
33
+ const y = O({
34
+ columns: a,
35
+ checkboxSelection: m,
36
+ actions: l
43
37
  }), {
44
- sorting: g,
45
- setSorting: p,
46
- columnFilters: $,
47
- setColumnFilters: z,
48
- columnVisibility: A,
49
- setColumnVisibility: G,
50
- rowSelection: x,
51
- setRowSelection: C,
52
- columnPinning: L,
53
- handleColumnPinningChange: B
54
- } = Y({
55
- persistKey: H,
56
- hasActions: !!s,
57
- externalSorting: T,
58
- onExternalSortingChange: R,
59
- initialSettings: P,
60
- onUpdate: W
61
- }), i = U({
62
- data: d,
63
- columns: _,
64
- getCoreRowModel: O(),
65
- enableColumnResizing: r,
66
- columnResizeMode: F,
67
- enableColumnPinning: v,
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({
52
+ data: s,
53
+ columns: y,
54
+ getCoreRowModel: Q(),
55
+ enableColumnResizing: i,
56
+ columnResizeMode: h,
57
+ enableColumnPinning: !0,
68
58
  defaultColumn: {
69
59
  enableSorting: !1,
70
60
  minSize: 50
71
61
  },
72
- ...w && {
73
- onSortingChange: (o) => {
74
- p(typeof o == "function" ? o(g) : o);
75
- },
62
+ ...p && {
63
+ onSortingChange: S,
76
64
  getSortedRowModel: K(),
77
- manualSorting: y
65
+ manualSorting: b
78
66
  },
79
- ...D && {
80
- onColumnFiltersChange: z,
81
- getFilteredRowModel: k()
67
+ ...C && {
68
+ onColumnFiltersChange: F,
69
+ getFilteredRowModel: J()
82
70
  },
83
- onColumnVisibilityChange: G,
84
- onRowSelectionChange: C,
85
- onColumnPinningChange: B,
71
+ onColumnVisibilityChange: E,
72
+ onRowSelectionChange: N,
73
+ onColumnPinningChange: P,
86
74
  state: {
87
- sorting: g,
88
- columnFilters: $,
89
- columnVisibility: A,
90
- rowSelection: x,
91
- columnPinning: L
75
+ sorting: R,
76
+ columnFilters: D,
77
+ columnVisibility: M,
78
+ rowSelection: u,
79
+ columnPinning: v
92
80
  }
93
81
  });
94
- if (b.useEffect(() => {
95
- c !== void 0 && C({});
96
- }, [c]), b.useEffect(() => {
97
- if (l) {
98
- const o = i.getFilteredSelectedRowModel().rows.map((t) => t.original);
99
- l(o);
82
+ if (L.useEffect(() => {
83
+ if (o) {
84
+ const r = t.getFilteredSelectedRowModel().rows.map((n) => n.original);
85
+ o(r);
100
86
  }
101
- }, [x, l, i]), S)
87
+ }, [u, o, t]), c)
102
88
  return /* @__PURE__ */ e.jsx(
103
- q,
89
+ B,
104
90
  {
105
- columns: m,
106
- checkboxSelection: u,
107
- actions: s,
108
- rowHeight: f
91
+ columns: a,
92
+ checkboxSelection: m,
93
+ actions: l,
94
+ rowHeight: d
109
95
  }
110
96
  );
111
- if (d.length === 0) {
112
- const o = j || {}, {
113
- title: t = "No results",
114
- description: a = "No data available",
115
- media: n,
116
- actions: I
117
- } = o;
97
+ 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;
118
104
  return /* @__PURE__ */ e.jsx(
119
- oo,
105
+ X,
120
106
  {
121
- media: n,
122
- title: t,
123
- description: a,
124
- actions: I
107
+ media: A,
108
+ title: n,
109
+ description: V,
110
+ actions: H
125
111
  }
126
112
  );
127
113
  }
128
- return /* @__PURE__ */ e.jsx("div", { className: h("yuno-data-table space-y-4", N), children: /* @__PURE__ */ e.jsx(
114
+ return /* @__PURE__ */ e.jsx("div", { className: f("space-y-4", T), children: /* @__PURE__ */ e.jsx(
129
115
  "div",
130
116
  {
131
117
  className: "rounded-md border overflow-x-auto",
132
- style: { height: M || "auto" },
118
+ style: { height: w || "auto" },
133
119
  children: /* @__PURE__ */ e.jsxs(
134
- V,
120
+ _,
135
121
  {
136
- className: h("table-fixed"),
122
+ className: f("table-fixed"),
123
+ style: { width: "max-content", minWidth: "100%" },
137
124
  children: [
138
- /* @__PURE__ */ e.jsx("colgroup", { children: i.getHeaderGroups()[0]?.headers.map((o) => {
139
- const t = o.column.columnDef.enableResizing === !1, a = o.column.id === "_spacer", n = o.column.getSize();
140
- return a ? /* @__PURE__ */ e.jsx("col", { style: { width: "auto" } }, o.id) : /* @__PURE__ */ e.jsx(
141
- "col",
142
- {
143
- style: {
144
- width: t ? `${n}px` : "auto",
145
- minWidth: t ? `${n}px` : void 0,
146
- maxWidth: t ? `${n}px` : void 0
147
- }
148
- },
149
- o.id
150
- );
151
- }) }),
152
125
  /* @__PURE__ */ e.jsx(
153
- J,
126
+ G,
154
127
  {
155
- table: i,
156
- enableColumnResizing: r
128
+ table: t,
129
+ enableColumnResizing: i
157
130
  }
158
131
  ),
159
132
  /* @__PURE__ */ e.jsx(
160
- Q,
133
+ I,
161
134
  {
162
- table: i,
163
- enableColumnResizing: r,
164
- onRowClick: E,
165
- rowHeight: f
135
+ table: t,
136
+ enableColumnResizing: i,
137
+ onRowClick: x,
138
+ rowHeight: d
166
139
  }
167
140
  )
168
141
  ]
@@ -172,5 +145,5 @@ function go({
172
145
  ) });
173
146
  }
174
147
  export {
175
- go as DataTable
148
+ ae as DataTable
176
149
  };
@@ -1,6 +1,5 @@
1
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,30 +99,12 @@ 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?: EmptyProps;
106
+ empty?: DataTableEmptyConfig;
102
107
  checkboxSelection?: boolean;
103
- selectionResetKey?: string | number;
104
108
  onRowSelectionChange?: (selectedRows: TData[]) => void;
105
109
  enablePagination?: boolean;
106
110
  pageSize?: number;
@@ -115,15 +119,12 @@ export interface DataTableProps<TData> {
115
119
  enableColumnFilters?: boolean;
116
120
  columnFilters?: ColumnFiltersState;
117
121
  onColumnFiltersChange?: (filters: ColumnFiltersState) => void;
118
- enableColumnPinning?: boolean;
119
122
  columnVisibility?: VisibilityState;
120
123
  onColumnVisibilityChange?: (visibility: VisibilityState) => void;
121
124
  onRowClick?: (row: TData) => void;
122
125
  height?: string | number;
123
126
  rowHeight?: number;
124
127
  persistKey?: string;
125
- initialSettings?: DataTableSettings;
126
- onUpdate?: (settings: DataTableSettings) => void;
127
128
  renderToolbar?: () => React.ReactNode;
128
129
  renderActions?: () => React.ReactNode;
129
130
  className?: string;
@@ -1,82 +1,78 @@
1
- import { j as a } from "../../../../_virtual/jsx-runtime.js";
1
+ import { j as n } from "../../../../_virtual/jsx-runtime.js";
2
2
  import * as C from "react";
3
- import { Button as b } from "../../../atoms/button/button.js";
4
- import { DataTableColumnHeader as S } from "../components/column-header/data-table-column-header.js";
5
- import { isHeaderConfig as h } from "../utils/data-table-utils.js";
6
- import { COLUMN_MIN_SIZE_DEFAULT as p, CHECKBOX_COLUMN_CONFIG as c, ACTIONS_COLUMN_CONFIG as g } from "../utils/data-table-constants.js";
7
- import { Checkbox as z } from "../../../atoms/checkbox/checkbox.js";
8
- function _({
9
- columns: f,
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: l
11
+ actions: a
12
12
  }) {
13
13
  return C.useMemo(() => {
14
- let n = f.map((t) => {
15
- const { header: e, enablePinning: i = !0, ...r } = t, s = r.size !== void 0 ? { ...r, minSize: r.minSize ?? p } : r;
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
- ...s,
17
+ ...o,
18
18
  enablePinning: i,
19
- header: ({ column: o, table: m }) => /* @__PURE__ */ a.jsx(
20
- S,
19
+ header: ({ column: s, table: m }) => /* @__PURE__ */ n.jsx(
20
+ f,
21
21
  {
22
- column: o,
22
+ column: s,
23
23
  table: m,
24
24
  title: e
25
25
  }
26
26
  )
27
- } : h(e) ? {
28
- ...s,
27
+ } : S(e) ? {
28
+ ...o,
29
29
  enablePinning: i,
30
- header: ({ column: o, table: m }) => /* @__PURE__ */ a.jsx(
31
- S,
30
+ header: ({ column: s, table: m }) => /* @__PURE__ */ n.jsx(
31
+ f,
32
32
  {
33
- column: o,
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
- } : { ...s, header: e, enablePinning: i };
40
+ } : { ...o, header: e, enablePinning: i };
41
41
  });
42
- if (d && (n = [{
42
+ if (d && (l = [{
43
43
  id: "select",
44
- header: ({ table: e }) => /* @__PURE__ */ a.jsx(
45
- z,
44
+ header: ({ table: e }) => /* @__PURE__ */ n.jsx(
45
+ u,
46
46
  {
47
47
  checked: e.getIsAllPageRowsSelected() || (e.getIsSomePageRowsSelected() ? "indeterminate" : !1),
48
- onChange: (i) => e.toggleAllPageRowsSelected(i.target.checked),
48
+ onCheckedChange: (i) => e.toggleAllPageRowsSelected(!!i),
49
49
  "aria-label": "Select all"
50
50
  }
51
51
  ),
52
- cell: ({ row: e }) => /* @__PURE__ */ a.jsx(
53
- z,
52
+ cell: ({ row: e }) => /* @__PURE__ */ n.jsx(
53
+ u,
54
54
  {
55
55
  checked: e.getIsSelected(),
56
- onChange: (i) => e.toggleSelected(i.target.checked),
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
- enableResizing: !1,
64
- size: c.size,
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 }) => l.render ? /* @__PURE__ */ a.jsx(a.Fragment, { children: l.render(e.original) }) : /* @__PURE__ */ a.jsx(
72
- b,
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(), l.onClick?.(e.original);
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: g.size,
88
- minSize: g.minSize,
89
- maxSize: g.maxSize
83
+ size: c.size,
84
+ minSize: c.minSize,
85
+ maxSize: c.maxSize
90
86
  };
91
- n = [...n, t];
87
+ l = [...l, r];
92
88
  }
93
- const u = {
94
- id: "_spacer",
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
- _ as useDataTableColumns
93
+ P as useDataTableColumns
110
94
  };
@@ -1,17 +1,12 @@
1
1
  import { ColumnFiltersState, SortingState, VisibilityState, RowSelectionState, ColumnPinningState } from '@tanstack/react-table';
2
- import { DataTableSettings } from '../data-table.types';
3
2
  import * as React from "react";
4
3
  interface UseDataTableStateProps {
5
4
  persistKey?: string;
6
5
  hasActions?: boolean;
7
- externalSorting?: SortingState;
8
- onExternalSortingChange?: (sorting: SortingState) => void;
9
- initialSettings?: DataTableSettings;
10
- onUpdate?: (settings: DataTableSettings) => void;
11
6
  }
12
- export declare function useDataTableState({ persistKey, hasActions, externalSorting, onExternalSortingChange, initialSettings, onUpdate, }: UseDataTableStateProps): {
7
+ export declare function useDataTableState({ persistKey, hasActions, }: UseDataTableStateProps): {
13
8
  sorting: SortingState;
14
- setSorting: (sorting: SortingState) => void;
9
+ setSorting: React.Dispatch<React.SetStateAction<SortingState>>;
15
10
  columnFilters: ColumnFiltersState;
16
11
  setColumnFilters: React.Dispatch<React.SetStateAction<ColumnFiltersState>>;
17
12
  columnVisibility: VisibilityState;