@yuno-payments/dashboard-design-system 2.2.0 → 2.2.1-beta.2

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 (54) hide show
  1. package/dist/components/atoms/checkbox/checkbox.js +16 -16
  2. package/dist/components/atoms/filter/filter-date-range.d.ts +31 -1
  3. package/dist/components/atoms/filter/filter-date-range.js +140 -144
  4. package/dist/components/atoms/filter/filter-multi-input.d.ts +11 -0
  5. package/dist/components/atoms/filter/filter-multi-input.js +42 -36
  6. package/dist/components/atoms/filter/filter-translations.d.ts +75 -0
  7. package/dist/components/atoms/filter/filter-translations.js +450 -0
  8. package/dist/components/atoms/filter/filter.d.ts +30 -0
  9. package/dist/components/atoms/filter/filter.js +191 -171
  10. package/dist/components/atoms/filter/index.d.ts +2 -2
  11. package/dist/components/atoms/filter-dropdown/filter-dropdown.d.ts +17 -2
  12. package/dist/components/atoms/filter-dropdown/filter-dropdown.js +160 -151
  13. package/dist/components/atoms/icon/directional-icons.d.ts +12 -0
  14. package/dist/components/atoms/icon/directional-icons.js +38 -0
  15. package/dist/components/atoms/icon/icon.d.ts +6 -0
  16. package/dist/components/atoms/icon/icon.js +27 -21
  17. package/dist/components/atoms/icon/index.d.ts +1 -0
  18. package/dist/components/atoms/index.d.ts +1 -1
  19. package/dist/components/atoms/radio-group/radio-group-option.js +2 -2
  20. package/dist/components/atoms/select/select.js +2 -2
  21. package/dist/components/molecules/dialog-header/dialog-header.d.ts +1 -1
  22. package/dist/components/molecules/pagination/index.d.ts +1 -0
  23. package/dist/components/molecules/pagination/page-numbers.d.ts +3 -1
  24. package/dist/components/molecules/pagination/page-numbers.js +10 -9
  25. package/dist/components/molecules/pagination/pagination-translations.d.ts +33 -0
  26. package/dist/components/molecules/pagination/pagination-translations.js +82 -0
  27. package/dist/components/molecules/pagination/pagination.d.ts +9 -0
  28. package/dist/components/molecules/pagination/pagination.js +46 -38
  29. package/dist/components/organisms/data-table/components/column-header/data-table-column-header-menu.d.ts +3 -1
  30. package/dist/components/organisms/data-table/components/column-header/data-table-column-header-menu.js +28 -27
  31. package/dist/components/organisms/data-table/components/column-header/data-table-column-header.js +44 -41
  32. package/dist/components/organisms/data-table/components/data-table-header.js +11 -12
  33. package/dist/components/organisms/data-table/components/dialogs/data-table-manage-columns-dialog.d.ts +3 -1
  34. package/dist/components/organisms/data-table/components/dialogs/data-table-manage-columns-dialog.js +45 -44
  35. package/dist/components/organisms/data-table/data-table.d.ts +27 -2
  36. package/dist/components/organisms/data-table/data-table.js +146 -134
  37. package/dist/components/organisms/data-table/data-table.types.d.ts +68 -0
  38. package/dist/components/organisms/data-table/data-table.types.js +252 -0
  39. package/dist/components/organisms/data-table/index.d.ts +2 -1
  40. package/dist/components/organisms/data-table/utils/data-table-utils.js +11 -8
  41. package/dist/dashboard-design-system.css +1 -1
  42. package/dist/index.css +1 -1
  43. package/dist/index.d.ts +2 -1
  44. package/dist/index.esm.min.js +9394 -8512
  45. package/dist/index.js +208 -202
  46. package/dist/index.umd.min.js +25 -25
  47. package/dist/lib/utils.d.ts +13 -0
  48. package/dist/lib/utils.js +34 -10
  49. package/dist/vendor/shadcn/pagination.d.ts +19 -3
  50. package/dist/vendor/shadcn/pagination.js +41 -37
  51. package/dist/vendor/shadcn/select.js +33 -33
  52. package/dist/vendor/shadcn/switch.js +1 -1
  53. package/package.json +4 -2
  54. package/registry/components-registry.json +38 -12
@@ -1,210 +1,222 @@
1
- import { j as t } from "../../../_virtual/jsx-runtime.js";
2
- import * as c from "react";
3
- import { useReactTable as Y } from "../../../node_modules/@tanstack/react-table/build/lib/index.js";
4
- import { DragDropProvider as Z } from "../../../node_modules/@dnd-kit/react/index.js";
5
- import { move as V } from "../../../node_modules/@dnd-kit/helpers/dist/index.js";
6
- import { Table as ee } from "../../../vendor/shadcn/table.js";
7
- import { cn as S } from "../../../lib/utils.js";
8
- import { DataTableLoading as oe } from "./components/states/data-table-loading.js";
9
- import { DataTableHeader as te } from "./components/data-table-header.js";
10
- import { DataTableBody as ne } from "./components/data-table-body.js";
11
- import { useDataTableColumns as re } from "./hooks/use-data-table-columns.js";
12
- import { useDataTableState as se } from "./hooks/use-data-table-state.js";
13
- import { ROW_HEIGHT_DEFAULT as ie } from "./utils/data-table-constants.js";
14
- import { getFilteredRowModel as le, getSortedRowModel as ae, getCoreRowModel as me } from "../../../node_modules/@tanstack/table-core/build/lib/index.js";
15
- import { Empty as ce } from "../../molecules/empty/empty.js";
16
- function Te({
17
- columns: b,
18
- data: l,
19
- isLoading: T = !1,
20
- empty: w,
21
- checkboxSelection: h = !1,
1
+ import { j as o } from "../../../_virtual/jsx-runtime.js";
2
+ import * as l from "react";
3
+ import { useReactTable as ee } from "../../../node_modules/@tanstack/react-table/build/lib/index.js";
4
+ import { DragDropProvider as te } from "../../../node_modules/@dnd-kit/react/index.js";
5
+ import { move as oe } from "../../../node_modules/@dnd-kit/helpers/dist/index.js";
6
+ import { Table as ne } from "../../../vendor/shadcn/table.js";
7
+ import { cn as R } from "../../../lib/utils.js";
8
+ import { getDataTableTranslations as re } from "./data-table.types.js";
9
+ import { DataTableLoading as se } from "./components/states/data-table-loading.js";
10
+ import { DataTableHeader as ie } from "./components/data-table-header.js";
11
+ import { DataTableBody as le } from "./components/data-table-body.js";
12
+ import { useDataTableColumns as ae } from "./hooks/use-data-table-columns.js";
13
+ import { useDataTableState as me } from "./hooks/use-data-table-state.js";
14
+ import { ROW_HEIGHT_DEFAULT as ce } from "./utils/data-table-constants.js";
15
+ import { getFilteredRowModel as ue, getSortedRowModel as de, getCoreRowModel as fe } from "../../../node_modules/@tanstack/table-core/build/lib/index.js";
16
+ import { Empty as ge } from "../../molecules/empty/empty.js";
17
+ function Me({
18
+ columns: h,
19
+ data: a,
20
+ isLoading: E = !1,
21
+ empty: F,
22
+ checkboxSelection: x = !1,
22
23
  rowSelection: u,
23
- onRowSelectionChange: a,
24
- enableSorting: E = !0,
25
- manualSorting: R = !1,
26
- sorting: F,
27
- onSortingChange: M,
28
- enableColumnFilters: O = !1,
24
+ onRowSelectionChange: m,
25
+ enableSorting: M = !0,
26
+ manualSorting: O = !1,
27
+ sorting: A,
28
+ onSortingChange: k,
29
+ enableColumnFilters: L = !1,
29
30
  enableColumnResizing: f = !0,
30
- columnResizeMode: N = "onChange",
31
- enableColumnPinning: k = !0,
32
- onRowClick: A,
31
+ columnResizeMode: P = "onChange",
32
+ enableColumnPinning: B = !0,
33
+ onRowClick: H,
33
34
  actions: g,
34
- height: L,
35
- rowHeight: x = ie,
36
- className: P,
37
- persistKey: B,
38
- initialSettings: H,
39
- onUpdate: I,
40
- enableColumnDragDrop: p = !1
35
+ height: I,
36
+ rowHeight: y = ce,
37
+ className: N,
38
+ persistKey: W,
39
+ initialSettings: _,
40
+ onUpdate: $,
41
+ enableColumnDragDrop: p = !1,
42
+ lang: j,
43
+ translations: D
41
44
  }) {
42
- const W = re({
43
- columns: b,
44
- checkboxSelection: h,
45
+ const C = l.useMemo(
46
+ () => ({
47
+ ...re(j),
48
+ ...D
49
+ }),
50
+ [j, D]
51
+ ), z = ae({
52
+ columns: h,
53
+ checkboxSelection: x,
45
54
  actions: g
46
55
  }), {
47
- sorting: y,
48
- setSorting: j,
49
- columnFilters: _,
50
- setColumnFilters: $,
51
- columnVisibility: z,
52
- setColumnVisibility: G,
56
+ sorting: T,
57
+ setSorting: v,
58
+ columnFilters: G,
59
+ setColumnFilters: U,
60
+ columnVisibility: q,
61
+ setColumnVisibility: J,
53
62
  rowSelection: i,
54
- setRowSelection: U,
55
- columnPinning: q,
56
- handleColumnPinningChange: J,
63
+ setRowSelection: K,
64
+ columnPinning: Q,
65
+ handleColumnPinningChange: X,
57
66
  columnOrder: d,
58
- setColumnOrder: m
59
- } = se({
60
- persistKey: B,
67
+ setColumnOrder: c
68
+ } = me({
69
+ persistKey: W,
61
70
  hasActions: !!g,
62
- externalSorting: F,
63
- onExternalSortingChange: M,
71
+ externalSorting: A,
72
+ onExternalSortingChange: k,
64
73
  externalRowSelection: u,
65
- initialSettings: H,
66
- onUpdate: I,
74
+ initialSettings: _,
75
+ onUpdate: $,
67
76
  enableColumnDragDrop: p
68
- }), r = Y({
69
- data: l,
70
- columns: W,
71
- getCoreRowModel: me(),
77
+ }), r = ee({
78
+ data: a,
79
+ columns: z,
80
+ getCoreRowModel: fe(),
72
81
  enableColumnResizing: f,
73
- columnResizeMode: N,
74
- enableColumnPinning: k,
82
+ columnResizeMode: P,
83
+ enableColumnPinning: B,
84
+ meta: {
85
+ translations: C
86
+ },
75
87
  defaultColumn: {
76
88
  enableSorting: !1,
77
89
  minSize: 50
78
90
  },
79
- ...E && {
91
+ ...M && {
80
92
  onSortingChange: (e) => {
81
- j(typeof e == "function" ? e(y) : e);
93
+ v(typeof e == "function" ? e(T) : e);
82
94
  },
83
- getSortedRowModel: ae(),
84
- manualSorting: R
95
+ getSortedRowModel: de(),
96
+ manualSorting: O
85
97
  },
86
- ...O && {
87
- onColumnFiltersChange: $,
88
- getFilteredRowModel: le()
98
+ ...L && {
99
+ onColumnFiltersChange: U,
100
+ getFilteredRowModel: ue()
89
101
  },
90
- onColumnVisibilityChange: G,
102
+ onColumnVisibilityChange: J,
91
103
  onRowSelectionChange: (e) => {
92
- const o = typeof e == "function" ? e(i) : e;
93
- if (U(o), a && u !== void 0) {
94
- const s = Object.keys(o).filter((n) => o[n]).map((n) => l[parseInt(n)]).filter(Boolean);
95
- a(o, s);
104
+ const t = typeof e == "function" ? e(i) : e;
105
+ if (K(t), m && u !== void 0) {
106
+ const s = Object.keys(t).filter((n) => t[n]).map((n) => a[parseInt(n)]).filter(Boolean);
107
+ m(t, s);
96
108
  }
97
109
  },
98
- onColumnPinningChange: J,
99
- onColumnOrderChange: m,
110
+ onColumnPinningChange: X,
111
+ onColumnOrderChange: c,
100
112
  state: {
101
- sorting: y,
102
- columnFilters: _,
103
- columnVisibility: z,
113
+ sorting: T,
114
+ columnFilters: G,
115
+ columnVisibility: q,
104
116
  rowSelection: i,
105
- columnPinning: q,
117
+ columnPinning: Q,
106
118
  columnOrder: d
107
119
  }
108
120
  });
109
- c.useEffect(() => {
110
- if (a && u === void 0) {
111
- const e = Object.keys(i).filter((o) => i[o]).map((o) => l[parseInt(o)]).filter(Boolean);
112
- a(i, e);
121
+ l.useEffect(() => {
122
+ if (m && u === void 0) {
123
+ const e = Object.keys(i).filter((t) => i[t]).map((t) => a[parseInt(t)]).filter(Boolean);
124
+ m(i, e);
113
125
  }
114
- }, [i, a, l, u]);
115
- const v = c.useRef([]), K = c.useCallback(() => {
116
- v.current = d.length > 0 ? [...d] : r.getAllLeafColumns().map((e) => e.id);
117
- }, [d, r]), Q = c.useCallback(
126
+ }, [i, m, a, u]);
127
+ const S = l.useRef([]), Y = l.useCallback(() => {
128
+ S.current = d.length > 0 ? [...d] : r.getAllLeafColumns().map((e) => e.id);
129
+ }, [d, r]), Z = l.useCallback(
118
130
  (e) => {
119
- m((o) => {
120
- const s = o.length > 0 ? o : r.getAllLeafColumns().map((C) => C.id);
121
- return V({ columns: s }, e).columns;
131
+ c((t) => {
132
+ const s = t.length > 0 ? t : r.getAllLeafColumns().map((b) => b.id);
133
+ return oe({ columns: s }, e).columns;
122
134
  });
123
135
  },
124
- [r, m]
125
- ), X = c.useCallback(
136
+ [r, c]
137
+ ), V = l.useCallback(
126
138
  (e) => {
127
- e.operation.canceled && m(v.current);
139
+ e.operation.canceled && c(S.current);
128
140
  },
129
- [m]
141
+ [c]
130
142
  );
131
- if (T)
132
- return /* @__PURE__ */ t.jsx(
133
- oe,
143
+ if (E)
144
+ return /* @__PURE__ */ o.jsx(
145
+ se,
134
146
  {
135
- columns: b,
136
- checkboxSelection: h,
147
+ columns: h,
148
+ checkboxSelection: x,
137
149
  actions: g,
138
- rowHeight: x
150
+ rowHeight: y
139
151
  }
140
152
  );
141
- if (l.length === 0) {
142
- const e = w || {}, {
143
- title: o = "No results",
144
- description: s = "No data available",
153
+ if (a.length === 0) {
154
+ const e = F || {}, {
155
+ title: t,
156
+ description: s,
145
157
  media: n,
146
- actions: C
158
+ actions: b
147
159
  } = e;
148
- return /* @__PURE__ */ t.jsx(
149
- ce,
160
+ return /* @__PURE__ */ o.jsx(
161
+ ge,
150
162
  {
151
163
  media: n,
152
- title: o,
153
- description: s,
154
- actions: C
164
+ title: t ?? C.noResults,
165
+ description: s ?? C.noDataAvailable,
166
+ actions: b
155
167
  }
156
168
  );
157
169
  }
158
- const D = /* @__PURE__ */ t.jsx("div", { className: S("yuno-data-table space-y-4", P), children: /* @__PURE__ */ t.jsx(
170
+ const w = /* @__PURE__ */ o.jsx("div", { className: R("yuno-data-table space-y-4", N), children: /* @__PURE__ */ o.jsx(
159
171
  "div",
160
172
  {
161
173
  className: "yuno-data-table rounded-md border overflow-x-auto",
162
- style: { height: L || "auto" },
163
- children: /* @__PURE__ */ t.jsxs(ee, { className: S("table-fixed"), children: [
164
- /* @__PURE__ */ t.jsx("colgroup", { children: r.getHeaderGroups()[0]?.headers.map((e) => {
165
- const o = e.column.columnDef.enableResizing === !1, s = e.column.id === "_spacer", n = e.column.getSize();
166
- return s ? /* @__PURE__ */ t.jsx("col", { style: { width: "auto" } }, e.id) : /* @__PURE__ */ t.jsx(
174
+ style: { height: I || "auto" },
175
+ children: /* @__PURE__ */ o.jsxs(ne, { className: R("table-fixed"), children: [
176
+ /* @__PURE__ */ o.jsx("colgroup", { children: r.getHeaderGroups()[0]?.headers.map((e) => {
177
+ const t = e.column.columnDef.enableResizing === !1, s = e.column.id === "_spacer", n = e.column.getSize();
178
+ return s ? /* @__PURE__ */ o.jsx("col", { style: { width: "auto" } }, e.id) : /* @__PURE__ */ o.jsx(
167
179
  "col",
168
180
  {
169
181
  style: {
170
- width: o ? `${n}px` : "auto",
171
- minWidth: o ? `${n}px` : void 0,
172
- maxWidth: o ? `${n}px` : void 0
182
+ width: t ? `${n}px` : "auto",
183
+ minWidth: t ? `${n}px` : void 0,
184
+ maxWidth: t ? `${n}px` : void 0
173
185
  }
174
186
  },
175
187
  e.id
176
188
  );
177
189
  }) }),
178
- /* @__PURE__ */ t.jsx(
179
- te,
190
+ /* @__PURE__ */ o.jsx(
191
+ ie,
180
192
  {
181
193
  table: r,
182
194
  enableColumnResizing: f,
183
195
  enableColumnDragDrop: p
184
196
  }
185
197
  ),
186
- /* @__PURE__ */ t.jsx(
187
- ne,
198
+ /* @__PURE__ */ o.jsx(
199
+ le,
188
200
  {
189
201
  table: r,
190
202
  enableColumnResizing: f,
191
- onRowClick: A,
192
- rowHeight: x
203
+ onRowClick: H,
204
+ rowHeight: y
193
205
  }
194
206
  )
195
207
  ] })
196
208
  }
197
209
  ) });
198
- return p ? /* @__PURE__ */ t.jsx(
199
- Z,
210
+ return p ? /* @__PURE__ */ o.jsx(
211
+ te,
200
212
  {
201
- onDragStart: K,
202
- onDragOver: Q,
203
- onDragEnd: X,
204
- children: D
213
+ onDragStart: Y,
214
+ onDragOver: Z,
215
+ onDragEnd: V,
216
+ children: w
205
217
  }
206
- ) : D;
218
+ ) : w;
207
219
  }
208
220
  export {
209
- Te as DataTable
221
+ Me as DataTable
210
222
  };
@@ -1,9 +1,77 @@
1
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
3
  import { EmptyProps } from '../../molecules';
4
+ /**
5
+ * Supported languages for DataTable translations
6
+ */
7
+ export type DataTableLanguage = "en" | "es" | "ja" | "ar" | "fr" | "pt" | "tr" | "ru" | "de" | "zh";
8
+ /**
9
+ * Translation strings for the DataTable column menu and dialogs.
10
+ * All fields are optional with English defaults.
11
+ */
12
+ export interface DataTableTranslations {
13
+ /** @default "Ascending" */
14
+ ascending?: string;
15
+ /** @default "Descending" */
16
+ descending?: string;
17
+ /** @default "Clear sorting" */
18
+ clearSorting?: string;
19
+ /** @default "Pin to the left" */
20
+ pinToLeft?: string;
21
+ /** @default "Pin to the right" */
22
+ pinToRight?: string;
23
+ /** @default "Unpin" */
24
+ unpin?: string;
25
+ /** @default "Hide" */
26
+ hide?: string;
27
+ /** @default "(Last column)" */
28
+ lastColumn?: string;
29
+ /** @default "Manage columns" */
30
+ manageColumns?: string;
31
+ /** @default "Hide all" */
32
+ hideAll?: string;
33
+ /** @default "Show all" */
34
+ showAll?: string;
35
+ /** @default "Search columns..." */
36
+ searchColumns?: string;
37
+ /** @default "No columns found" */
38
+ noColumnsFound?: string;
39
+ /** @default "No results" */
40
+ noResults?: string;
41
+ /** @default "No data available" */
42
+ noDataAvailable?: string;
43
+ /** @default "Sort ascending" */
44
+ sortAscending?: string;
45
+ /** @default "Sort descending" */
46
+ sortDescending?: string;
47
+ /** @default "Pinned column" */
48
+ pinnedColumn?: string;
49
+ /** @default "Menu" */
50
+ menu?: string;
51
+ /** @default "Actions" */
52
+ actions?: string;
53
+ /** @default "Select all" */
54
+ selectAll?: string;
55
+ /** @default "Select row" */
56
+ selectRow?: string;
57
+ }
58
+ /**
59
+ * Default English translations for DataTable
60
+ */
61
+ export declare const DEFAULT_DATA_TABLE_TRANSLATIONS: Required<DataTableTranslations>;
62
+ /**
63
+ * All DataTable translations by language code
64
+ */
65
+ export declare const DATA_TABLE_TRANSLATIONS: Record<DataTableLanguage, Required<DataTableTranslations>>;
66
+ /**
67
+ * Get translations for a specific language
68
+ * Falls back to English if language not found
69
+ */
70
+ export declare function getDataTableTranslations(lang?: DataTableLanguage): Required<DataTableTranslations>;
4
71
  declare module "@tanstack/react-table" {
5
72
  interface TableMeta<TData extends RowData> {
6
73
  updateData?: (rowIndex: number, columnId: string, value: unknown) => void;
74
+ translations?: Required<DataTableTranslations>;
7
75
  }
8
76
  }
9
77
  export interface DataTableActionsConfig<TData> {