@appdirect/design-system 0.0.11 → 0.0.13

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 (120) hide show
  1. package/README.md +84 -6
  2. package/dist/Buttons/ActionIcon.js +14 -0
  3. package/dist/Buttons/Button.js +66 -0
  4. package/dist/Buttons/CloseButton.js +48 -0
  5. package/dist/Buttons/index.js +13 -0
  6. package/dist/Combobox/AutocompleteClearable.js +36 -0
  7. package/dist/Combobox/Combobox.js +28 -0
  8. package/dist/Combobox/Multiselect.js +31 -0
  9. package/dist/Combobox/SearchableSelect.js +43 -0
  10. package/dist/Combobox/Select.js +72 -0
  11. package/dist/Combobox/index.js +10 -0
  12. package/dist/ComplexComponents/DashboardWidget/DashboardWidget.js +96 -0
  13. package/dist/ComplexComponents/DashboardWidget/index.js +1 -0
  14. package/dist/ComplexComponents/DataTable/CustomBottomToolbar/index.js +82 -0
  15. package/dist/ComplexComponents/DataTable/CustomBottomToolbar/utils.js +23 -0
  16. package/dist/ComplexComponents/DataTable/CustomToolbarAlertBannerContent/index.js +23 -0
  17. package/dist/ComplexComponents/DataTable/CustomTopToolbar/DateRangeSelectorFilter/index.js +230 -0
  18. package/dist/ComplexComponents/DataTable/CustomTopToolbar/FilterChip.js +30 -0
  19. package/dist/ComplexComponents/DataTable/CustomTopToolbar/FilterSystem/DateRangeFilter.js +12 -0
  20. package/dist/ComplexComponents/DataTable/CustomTopToolbar/FilterSystem/FilterRenderer.js +32 -0
  21. package/dist/ComplexComponents/DataTable/CustomTopToolbar/FilterSystem/FilterSystem.js +90 -0
  22. package/dist/ComplexComponents/DataTable/CustomTopToolbar/FilterSystem/MultiSelectFilter.js +43 -0
  23. package/dist/ComplexComponents/DataTable/CustomTopToolbar/FilterSystem/SingleSelectFilter.js +30 -0
  24. package/dist/ComplexComponents/DataTable/CustomTopToolbar/FilterSystem/index.js +39 -0
  25. package/dist/ComplexComponents/DataTable/CustomTopToolbar/FilterSystem/types.js +9 -0
  26. package/dist/ComplexComponents/DataTable/CustomTopToolbar/ResultCount/index.js +31 -0
  27. package/dist/ComplexComponents/DataTable/CustomTopToolbar/SearchFilter.js +42 -0
  28. package/dist/ComplexComponents/DataTable/CustomTopToolbar/SelectFilter.js +21 -0
  29. package/dist/ComplexComponents/DataTable/CustomTopToolbar/index.js +410 -0
  30. package/dist/ComplexComponents/DataTable/DataTable.js +405 -0
  31. package/dist/ComplexComponents/DataTable/ErrorOverlay/index.js +9 -0
  32. package/dist/ComplexComponents/DataTable/SortableHeaderCell/index.js +27 -0
  33. package/dist/ComplexComponents/DataTable/index.js +1 -0
  34. package/dist/ComplexComponents/DataTable/translations/en.js +99 -0
  35. package/dist/ComplexComponents/DataTable/translations/index.js +17 -0
  36. package/dist/ComplexComponents/KeyInsight/KeyInsights.js +176 -0
  37. package/dist/ComplexComponents/KeyInsight/index.js +1 -0
  38. package/dist/ComplexComponents/NameValue/NameValue.js +94 -0
  39. package/dist/ComplexComponents/NameValue/NameValueItem.js +59 -0
  40. package/dist/ComplexComponents/NameValue/index.js +2 -0
  41. package/dist/ComplexComponents/PageContentHeader/PageContentHeader.js +92 -0
  42. package/dist/ComplexComponents/PageContentHeader/index.js +1 -0
  43. package/dist/ComplexComponents/Placeholder/Placeholder.js +51 -0
  44. package/dist/ComplexComponents/Placeholder/index.js +1 -0
  45. package/dist/ComplexComponents/Slat/Slat.js +53 -0
  46. package/dist/ComplexComponents/Slat/index.js +1 -0
  47. package/dist/ComplexComponents/Utilities/CopyButton.js +45 -0
  48. package/dist/ComplexComponents/Utilities/index.js +1 -0
  49. package/dist/DataDisplay/Alert.js +77 -0
  50. package/dist/DataDisplay/Avatar.js +157 -0
  51. package/dist/DataDisplay/Badge.js +78 -0
  52. package/dist/DataDisplay/Card.js +100 -0
  53. package/dist/DataDisplay/Chip.js +36 -0
  54. package/dist/DataDisplay/Indicator.js +59 -0
  55. package/dist/DataDisplay/List.js +60 -0
  56. package/dist/DataDisplay/Pill.js +81 -0
  57. package/dist/DataDisplay/Progress.js +42 -0
  58. package/dist/DataDisplay/Table.js +38 -0
  59. package/dist/DataDisplay/ThemeIcon.js +31 -0
  60. package/dist/DataDisplay/index.js +18 -0
  61. package/dist/Inputs/Checkbox.js +62 -0
  62. package/dist/Inputs/ColorInput.js +48 -0
  63. package/dist/Inputs/DropZone.js +12 -0
  64. package/dist/Inputs/FileInput.js +77 -0
  65. package/dist/Inputs/NumberInput.js +49 -0
  66. package/dist/Inputs/Radio.js +55 -0
  67. package/dist/Inputs/RadioGroup.js +59 -0
  68. package/dist/Inputs/SegmentedControl.js +50 -0
  69. package/dist/Inputs/Slider.js +50 -0
  70. package/dist/Inputs/SliderWithLabel.js +32 -0
  71. package/dist/Inputs/Switch.js +47 -0
  72. package/dist/Inputs/TextArea.js +50 -0
  73. package/dist/Inputs/TextInput.js +87 -0
  74. package/dist/Inputs/index.js +27 -0
  75. package/dist/Layout/Box.js +39 -0
  76. package/dist/Layout/Center.js +11 -0
  77. package/dist/Layout/Container.js +11 -0
  78. package/dist/Layout/Flex.js +12 -0
  79. package/dist/Layout/Grid.js +13 -0
  80. package/dist/Layout/Group.js +14 -0
  81. package/dist/Layout/Inline.js +46 -0
  82. package/dist/Layout/SimpleGrid.js +14 -0
  83. package/dist/Layout/Stack.js +45 -0
  84. package/dist/Layout/index.js +10 -0
  85. package/dist/Misc/Divider.js +8 -0
  86. package/dist/Misc/Paper.js +24 -0
  87. package/dist/Misc/index.js +10 -0
  88. package/dist/Navigation/Breadcrumb.js +60 -0
  89. package/dist/Navigation/NavLink.js +28 -0
  90. package/dist/Navigation/Stepper.js +8 -0
  91. package/dist/Navigation/Tabs.js +22 -0
  92. package/dist/Navigation/index.js +9 -0
  93. package/dist/Overlays/Drawer.js +63 -0
  94. package/dist/Overlays/Menu.js +85 -0
  95. package/dist/Overlays/Modal.js +61 -0
  96. package/dist/Overlays/Popover.js +118 -0
  97. package/dist/Overlays/Tooltip.js +71 -0
  98. package/dist/Overlays/index.js +12 -0
  99. package/dist/Shell/AppShellLayout.js +13 -0
  100. package/dist/Shell/HeaderBar.js +8 -0
  101. package/dist/Shell/SidebarNav.js +9 -0
  102. package/dist/Shell/SidebarNavLink.js +17 -0
  103. package/dist/Shell/SingleColumnLayout.js +11 -0
  104. package/dist/Shell/TertiaryColumnLayout.js +12 -0
  105. package/dist/Shell/index.js +6 -0
  106. package/dist/Typography/Code.js +8 -0
  107. package/dist/Typography/Kbd.js +58 -0
  108. package/dist/Typography/Text.js +8 -0
  109. package/dist/Typography/Title.js +11 -0
  110. package/dist/Typography/index.js +12 -0
  111. package/dist/config.js +202 -0
  112. package/dist/contracts/index.json +1 -1
  113. package/dist/css/mantine.css +2 -2
  114. package/dist/hooks/useTableHandlers.js +136 -0
  115. package/dist/hooks/useTableRenderFunctions.js +164 -0
  116. package/dist/hooks/useTableState.js +70 -0
  117. package/dist/index.js +162 -0
  118. package/dist/stories/index.json +1 -1
  119. package/dist/types.js +127 -0
  120. package/package.json +9 -6
@@ -0,0 +1,405 @@
1
+ 'use client';
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import React, { useMemo } from 'react';
4
+ import { useMantineReactTable, MantineReactTable, } from 'mantine-react-table-open';
5
+ import { useTableState } from '../../hooks/useTableState.js';
6
+ import { useTableHandlers } from '../../hooks/useTableHandlers.js';
7
+ import { useTableRenderFunctions } from '../../hooks/useTableRenderFunctions.js';
8
+ // ========================== CONSTANTS ==========================
9
+ /**
10
+ * Default values for various table configuration options
11
+ * Centralized to ensure consistency and easy modification
12
+ */
13
+ const DEFAULT_VALUES = {
14
+ /** Default number of rows per page */
15
+ PAGE_SIZE: 10,
16
+ /** Default table density (row height) - 'xs' is most compact */
17
+ DENSITY: 'xs',
18
+ /** Default locale for internationalization */
19
+ LOCALE: 'en',
20
+ /** Default total count when not provided */
21
+ TOTAL_COUNT: 0,
22
+ /** Default result count (deprecated) */
23
+ RESULT_COUNT: 0,
24
+ };
25
+ /**
26
+ * Feature flags that control which table features are enabled by default
27
+ * Can be overridden by props but provide sensible defaults
28
+ */
29
+ const FEATURE_FLAGS = {
30
+ /** Enable filters panel by default */
31
+ SHOW_FILTERS: true,
32
+ /** Enable global search by default */
33
+ SHOW_SEARCH: true,
34
+ /** Enable density toggle by default */
35
+ SHOW_DENSITY_TOGGLE: true,
36
+ /** Enable fullscreen toggle by default */
37
+ SHOW_FULL_SCREEN_TOGGLE: true,
38
+ };
39
+ // ========================== CUSTOM HOOKS ==========================
40
+ /**
41
+ * DataTable Component
42
+ *
43
+ * A powerful, feature-rich data table component built on top of Mantine React Table.
44
+ * Supports pagination, sorting, filtering, row selection, density controls, and more.
45
+ * Perfect for displaying large datasets with complex interaction requirements.
46
+ *
47
+ * @example
48
+ * // Basic usage with minimal configuration
49
+ * const userData = [
50
+ * { id: '1', name: 'John Doe', email: 'john@example.com', status: 'Active' },
51
+ * { id: '2', name: 'Jane Smith', email: 'jane@example.com', status: 'Inactive' },
52
+ * ];
53
+ *
54
+ * const columns = [
55
+ * { accessorKey: 'name', header: 'Name' },
56
+ * { accessorKey: 'email', header: 'Email' },
57
+ * { accessorKey: 'status', header: 'Status' },
58
+ * ];
59
+ *
60
+ * <DataTable
61
+ * data={userData}
62
+ * columns={columns}
63
+ * />
64
+ *
65
+ * @example
66
+ * // Advanced usage with pagination and filtering
67
+ * const [tableData, setTableData] = useState([]);
68
+ * const [pagination, setPagination] = useState({ pageIndex: 0, pageSize: 10 });
69
+ * const [filters, setFilters] = useState({});
70
+ * const [isLoading, setIsLoading] = useState(false);
71
+ *
72
+ * // Fetch data when pagination or filters change
73
+ * useEffect(() => {
74
+ * fetchData(pagination, filters);
75
+ * }, [pagination, filters]);
76
+ *
77
+ * <DataTable
78
+ * data={tableData}
79
+ * columns={columns}
80
+ * isLoading={isLoading}
81
+ * totalCount={1000}
82
+ * defaultPageSize={20}
83
+ * filtersState={filters}
84
+ * onPaginationChange={setPagination}
85
+ * onFiltersChange={setFilters}
86
+ * pageInfo={{
87
+ * hasNextPage: true,
88
+ * hasPreviousPage: false,
89
+ * startCursor: 'cursor-start',
90
+ * endCursor: 'cursor-end'
91
+ * }}
92
+ * />
93
+ *
94
+ * @example
95
+ * // With row selection and custom actions
96
+ * const [selectedRows, setSelectedRows] = useState({});
97
+ *
98
+ * const handleRowSelection = (rowSelection) => {
99
+ * setSelectedRows(rowSelection);
100
+ * console.log('Selected rows:', Object.keys(rowSelection));
101
+ * };
102
+ *
103
+ * const handleBulkAction = () => {
104
+ * const selectedIds = Object.keys(selectedRows);
105
+ * // Perform bulk action on selected rows
106
+ * };
107
+ *
108
+ * <DataTable
109
+ * data={tableData}
110
+ * columns={columns}
111
+ * onRowSelectionChange={handleRowSelection}
112
+ * // Custom toolbar actions will appear when rows are selected
113
+ * />
114
+ *
115
+ * @example
116
+ * // Error handling and retry functionality
117
+ * const [error, setError] = useState(null);
118
+ * const [isError, setIsError] = useState(false);
119
+ *
120
+ * const handleRetry = () => {
121
+ * setError(null);
122
+ * setIsError(false);
123
+ * // Retry data fetching logic
124
+ * fetchData();
125
+ * };
126
+ *
127
+ * <DataTable
128
+ * data={tableData}
129
+ * columns={columns}
130
+ * isError={isError}
131
+ * error={error}
132
+ * onRetry={handleRetry}
133
+ * />
134
+ *
135
+ * @example
136
+ * // Customized table features and styling
137
+ * <DataTable
138
+ * data={tableData}
139
+ * columns={columns}
140
+ * defaultDensity="md"
141
+ * showFilters={true}
142
+ * showSearch={true}
143
+ * showDensityToggle={true}
144
+ * showFullScreenToggle={false}
145
+ * locale="en-US"
146
+ * mantineTableContainerProps={{
147
+ * style: { maxHeight: '600px' }
148
+ * }}
149
+ * mantinePaperProps={{
150
+ * shadow: 'md',
151
+ * radius: 'md'
152
+ * }}
153
+ * />
154
+ *
155
+ * @example
156
+ * // Dynamic columns with conditional rendering
157
+ * const columns = useMemo(() => [
158
+ * { accessorKey: 'name', header: 'Name', enableSorting: true },
159
+ * { accessorKey: 'email', header: 'Email', enableColumnFilter: true },
160
+ * {
161
+ * accessorKey: 'status',
162
+ * header: () => <Text fw="bold">Status</Text>,
163
+ * size: 120,
164
+ * enableSorting: false
165
+ * },
166
+ * {
167
+ * accessorKey: 'actions',
168
+ * header: 'Actions',
169
+ * enableSorting: false,
170
+ * enableColumnFilter: false,
171
+ * Cell: ({ row }) => (
172
+ * <Inline>
173
+ * <Button size="xs" onClick={() => handleEdit(row.original)}>
174
+ * Edit
175
+ * </Button>
176
+ * <Button size="xs" color="red" onClick={() => handleDelete(row.original)}>
177
+ * Delete
178
+ * </Button>
179
+ * </Inline>
180
+ * )
181
+ * }
182
+ * ], []);
183
+ *
184
+ * <DataTable
185
+ * data={tableData}
186
+ * columns={columns}
187
+ * onSortChange={(field, direction) => {
188
+ * console.log(`Sorting ${field} in ${direction} order`);
189
+ * }}
190
+ * />
191
+ */
192
+ export function DataTable({
193
+ // ==================== DATA PROPS ====================
194
+ data, columns, totalCount = DEFAULT_VALUES.TOTAL_COUNT,
195
+ // ==================== LOADING AND ERROR STATES ====================
196
+ isLoading = false, isError = false, error, onRetry,
197
+ // ==================== PAGINATION PROPS ====================
198
+ pageInfo, onPaginationChange, defaultPageSize = DEFAULT_VALUES.PAGE_SIZE,
199
+ // ==================== SELECTION PROPS ====================
200
+ onRowSelectionChange,
201
+ // ==================== UI STATE PROPS ====================
202
+ onDensityChange, defaultDensity = DEFAULT_VALUES.DENSITY,
203
+ // ==================== SORTING PROPS ====================
204
+ onSortChange,
205
+ // ==================== FILTER PROPS ====================
206
+ filtersState = {}, onFiltersChange = () => { }, locale = DEFAULT_VALUES.LOCALE,
207
+ // ==================== FEATURE TOGGLES ====================
208
+ showFilters = FEATURE_FLAGS.SHOW_FILTERS, showSearch = FEATURE_FLAGS.SHOW_SEARCH, showDensityToggle = FEATURE_FLAGS.SHOW_DENSITY_TOGGLE, showFullScreenToggle = FEATURE_FLAGS.SHOW_FULL_SCREEN_TOGGLE,
209
+ // ==================== STYLE CUSTOMIZATION ====================
210
+ mantineTableContainerProps = {}, mantinePaperProps = {},
211
+ // ==================== DEPRECATED/UNUSED PROPS ====================
212
+ resultCount = DEFAULT_VALUES.RESULT_COUNT, }) {
213
+ // ==================== HOOK INITIALIZATION ====================
214
+ /** Initialize table state management */
215
+ const tableState = useTableState(defaultPageSize, defaultDensity);
216
+ /** Initialize event handlers with proper memoization */
217
+ const handlers = useTableHandlers(tableState, {
218
+ onPaginationChange,
219
+ onRowSelectionChange,
220
+ onDensityChange,
221
+ onSortChange,
222
+ });
223
+ /** Initialize render functions with all required dependencies */
224
+ const renderFunctions = useTableRenderFunctions({
225
+ filtersState,
226
+ locale,
227
+ onFiltersChange,
228
+ data,
229
+ showFilters,
230
+ isLoading,
231
+ totalCount,
232
+ pageInfo,
233
+ error,
234
+ onRetry,
235
+ }, { numberOfSelectedRows: tableState.numberOfSelectedRows }, { handleClearSelection: handlers.handleClearSelection });
236
+ // ==================== TABLE CONFIGURATION ====================
237
+ /**
238
+ * Memoized table configuration object
239
+ * Contains all options, state, and handlers for Mantine React Table
240
+ */
241
+ const tableConfig = useMemo(() => ({
242
+ // ==================== CORE DATA AND COLUMNS ====================
243
+ columns,
244
+ data,
245
+ /** Use the 'id' field from each row for unique identification (enables proper selection tracking) */
246
+ getRowId: (row) => row.id,
247
+ // ==================== FEATURE ENABLEMENT ====================
248
+ /** Enable row selection with checkboxes */
249
+ enableRowSelection: true,
250
+ /** Allow multiple rows to be selected simultaneously */
251
+ enableMultiRowSelection: true,
252
+ /** Show select all checkbox in header */
253
+ enableSelectAll: true,
254
+ /** Enable column-specific filtering */
255
+ enableColumnFilters: true,
256
+ /** Enable column sorting */
257
+ enableSorting: true,
258
+ /** Allow users to resize columns */
259
+ enableColumnResizing: true,
260
+ /** Keep header visible when scrolling */
261
+ enableStickyHeader: true,
262
+ /** Show density toggle button */
263
+ enableDensityToggle: showDensityToggle,
264
+ /** Show fullscreen toggle button */
265
+ enableFullScreenToggle: showFullScreenToggle,
266
+ /** Enable pagination controls */
267
+ enablePagination: true,
268
+ /** Disable built-in row actions (we handle them manually) */
269
+ enableRowActions: false,
270
+ /** Disable individual column actions - we'll use a custom column visibility button */
271
+ enableColumnActions: false,
272
+ /** Enable column hiding feature */
273
+ enableHiding: true,
274
+ /** Use manual pagination (parent handles data slicing) */
275
+ manualPagination: true,
276
+ // ==================== DATA AND STATE ====================
277
+ /** Total number of rows across all pages */
278
+ rowCount: totalCount,
279
+ /** Initial state with pinned actions column */
280
+ initialState: {
281
+ columnPinning: {
282
+ right: ['actions'],
283
+ },
284
+ },
285
+ /** Current state object passed to Mantine React Table */
286
+ state: {
287
+ pagination: tableState.pagination,
288
+ rowSelection: tableState.rowSelection,
289
+ density: tableState.density,
290
+ isLoading,
291
+ showAlertBanner: tableState.showAlertBanner,
292
+ },
293
+ // ==================== LAYOUT CONFIGURATION ====================
294
+ /** Use grid layout for better column control */
295
+ layoutMode: 'grid',
296
+ /** Configure display columns (selection, etc.) */
297
+ displayColumnDefOptions: {
298
+ 'mrt-row-select': {
299
+ size: 40, // Minimal width for checkbox
300
+ grow: false, // Don't grow this column
301
+ },
302
+ },
303
+ /** Enable column pinning to keep actions column fixed */
304
+ enablePinning: true,
305
+ // ==================== EVENT HANDLERS ====================
306
+ /** Handle pagination changes (page navigation, page size changes) */
307
+ onPaginationChange: handlers.handlePaginationChange,
308
+ /** Handle row selection changes */
309
+ onRowSelectionChange: handlers.handleRowSelectionChange,
310
+ /** Handle density changes */
311
+ onDensityChange: handlers.handleDensityChange,
312
+ /** Handle sorting changes */
313
+ onSortingChange: handlers.handleSortingChange,
314
+ // ==================== RENDER FUNCTIONS ====================
315
+ /** Custom top toolbar with filters and actions */
316
+ renderTopToolbar: renderFunctions.renderTopToolbar,
317
+ /** Custom bottom toolbar with pagination */
318
+ renderBottomToolbar: renderFunctions.renderBottomToolbar,
319
+ /** Custom alert banner for selection state */
320
+ renderToolbarAlertBannerContent: renderFunctions.renderToolbarAlertBannerContent,
321
+ /** Custom empty state with error handling */
322
+ renderEmptyRowsFallback: renderFunctions.renderEmptyRowsFallback,
323
+ /** Custom header cell renderer */
324
+ mantineTableHeadCellProps: renderFunctions.renderTableHeadCell,
325
+ // ==================== ACCESSIBILITY AND STYLING ====================
326
+ /** Accessibility props for select all checkbox */
327
+ mantineSelectAllCheckboxProps: {
328
+ 'aria-label': 'Select all rows on this page',
329
+ },
330
+ /** Accessibility props for individual row checkboxes */
331
+ mantineSelectCheckboxProps: {
332
+ 'aria-label': 'Select row',
333
+ },
334
+ /** Table styling options */
335
+ mantineTableProps: {
336
+ striped: true, // Alternating row colors
337
+ highlightOnHover: true, // Highlight rows on hover
338
+ withColumnBorders: false, // No vertical borders between columns
339
+ },
340
+ /** Header row styling */
341
+ mantineTableHeadRowProps: {
342
+ style: {
343
+ borderBottom: '2px solid var(--ad-color-border-subtle)',
344
+ },
345
+ },
346
+ /** Body cell styling */
347
+ mantineTableBodyCellProps: {
348
+ style: {
349
+ padding: 'var(--mantine-spacing-xs)',
350
+ },
351
+ },
352
+ /** Alert banner styling */
353
+ mantineToolbarAlertBannerProps: {
354
+ color: 'blue',
355
+ },
356
+ /** Table container styling */
357
+ mantineTableContainerProps: {
358
+ style: {
359
+ backgroundColor: 'var(--ad-color-bg-default)',
360
+ },
361
+ ...mantineTableContainerProps, // Allow prop overrides
362
+ },
363
+ /** Paper wrapper styling */
364
+ mantinePaperProps: {
365
+ style: {
366
+ backgroundColor: 'var(--ad-color-bg-default)',
367
+ },
368
+ ...mantinePaperProps, // Allow prop overrides
369
+ },
370
+ }), [
371
+ // ==================== MEMOIZATION DEPENDENCIES ====================
372
+ // Core data dependencies
373
+ columns,
374
+ data,
375
+ showDensityToggle,
376
+ showFullScreenToggle,
377
+ totalCount,
378
+ isLoading,
379
+ // State dependencies
380
+ tableState.pagination,
381
+ tableState.rowSelection,
382
+ tableState.density,
383
+ tableState.showAlertBanner,
384
+ // Handler dependencies
385
+ handlers.handlePaginationChange,
386
+ handlers.handleRowSelectionChange,
387
+ handlers.handleDensityChange,
388
+ handlers.handleSortingChange,
389
+ // Render function dependencies
390
+ renderFunctions.renderTopToolbar,
391
+ renderFunctions.renderBottomToolbar,
392
+ renderFunctions.renderToolbarAlertBannerContent,
393
+ renderFunctions.renderEmptyRowsFallback,
394
+ renderFunctions.renderTableHeadCell,
395
+ // Style customization dependencies
396
+ mantineTableContainerProps,
397
+ mantinePaperProps,
398
+ ]);
399
+ // ==================== COMPONENT INITIALIZATION ====================
400
+ /** Initialize the Mantine React Table instance with our configuration */
401
+ const table = useMantineReactTable(tableConfig);
402
+ // ==================== RENDER ====================
403
+ /** Render the table component */
404
+ return _jsx(MantineReactTable, { table: table });
405
+ }
@@ -0,0 +1,9 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import React from "react";
3
+ import { Stack, Text } from "@mantine/core";
4
+ import { Button } from '../../../Buttons/Button.js';
5
+ import { translate } from '../translations/index.js';
6
+ const ErrorOverlay = ({ error, onRetry }) => {
7
+ return (_jsxs(Stack, { align: "center", justify: "center", h: 200, children: [_jsx(Text, { size: "lg", fw: 500, children: translate("table.error.title") }), _jsx(Text, { size: "sm", c: "dimmed", children: error || translate("table.error.default") }), onRetry && (_jsx(Button, { variant: "default", onClick: onRetry, children: translate("table.error.retry") }))] }));
8
+ };
9
+ export default ErrorOverlay;
@@ -0,0 +1,27 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import React from "react";
3
+ import { UnstyledButton, Text, Center, rem } from '@mantine/core';
4
+ import { Inline } from '../../../index.js';
5
+ import { IconArrowUp, IconArrowDown, IconArrowsSort } from '@tabler/icons-react';
6
+ import { translate } from '../translations/index.js';
7
+ const SortableHeaderCell = ({ label, sortDirection = null, onSort, isSortable = true, }) => {
8
+ const renderSortIcon = () => {
9
+ if (!isSortable)
10
+ return null;
11
+ switch (sortDirection) {
12
+ case 'asc':
13
+ return _jsx(IconArrowUp, { style: { width: rem(16), height: rem(16) }, stroke: 1.5 });
14
+ case 'desc':
15
+ return _jsx(IconArrowDown, { style: { width: rem(16), height: rem(16) }, stroke: 1.5 });
16
+ default:
17
+ return _jsx(IconArrowsSort, { style: { width: rem(16), height: rem(16) }, stroke: 1.5 });
18
+ }
19
+ };
20
+ const directionText = sortDirection ? translate(`table.sort.${sortDirection}`) : translate("table.sort.none");
21
+ const ariaLabel = translate("table.sort.aria", {
22
+ column: label,
23
+ direction: directionText
24
+ });
25
+ return (_jsx(UnstyledButton, { onClick: isSortable ? onSort : undefined, disabled: !isSortable, "aria-label": ariaLabel, children: _jsxs(Inline, { justify: "space-between", children: [_jsx(Text, { fw: 500, fz: "sm", children: label }), _jsx(Center, { children: renderSortIcon() })] }) }));
26
+ };
27
+ export default SortableHeaderCell;
@@ -0,0 +1 @@
1
+ export { DataTable } from './DataTable.js';
@@ -0,0 +1,99 @@
1
+ const translations = {
2
+ // Result count translations
3
+ "table.filters.result.count.many": "{count} results",
4
+ "table.filters.result.count.one": "1 result",
5
+ "table.filters.result.count.loading": "Loading results...",
6
+ // Total count translations (no filters active)
7
+ "table.filters.result.count.total.many": "{count} records",
8
+ "table.filters.result.count.total.one": "1 record",
9
+ // Filtered count translations (filters active)
10
+ "table.filters.result.count.filtered.many": "{count} records",
11
+ "table.filters.result.count.filtered.one": "1 record",
12
+ "table.filters.result.count.filtered.none": "0 records",
13
+ // Filter translations
14
+ "table.filters.toggle.aria": "Toggle filters panel",
15
+ "table.filters.clear.filters": "Clear filters",
16
+ "table.filters.chip.date.range.label": "{startDate} - {endDate}",
17
+ "table.filters.date.range.week": "This week",
18
+ "table.filters.date.range.month": "This month",
19
+ "table.filters.date.range.quarter": "This quarter",
20
+ "table.filters.date.range.custom": "Custom",
21
+ "table.filters.date.range.select": "Select a date",
22
+ "table.filters.applied.on": "Applied On",
23
+ "table.filters.city": "City",
24
+ "table.filters.city.atlanta": "Atlanta",
25
+ "table.filters.city.austin": "Austin",
26
+ "table.filters.city.boston": "Boston",
27
+ "table.filters.city.charlotte": "Charlotte",
28
+ "table.filters.city.chicago": "Chicago",
29
+ "table.filters.city.columbus": "Columbus",
30
+ "table.filters.city.denver": "Denver",
31
+ "table.filters.city.detroit": "Detroit",
32
+ "table.filters.city.indianapolis": "Indianapolis",
33
+ "table.filters.city.las.vegas": "Las Vegas",
34
+ "table.filters.city.los.angeles": "Los Angeles",
35
+ "table.filters.city.miami": "Miami",
36
+ "table.filters.city.nashville": "Nashville",
37
+ "table.filters.city.new.york": "New York",
38
+ "table.filters.city.orlando": "Orlando",
39
+ "table.filters.city.phoenix": "Phoenix",
40
+ "table.filters.city.portland": "Portland",
41
+ "table.filters.city.san.francisco": "San Francisco",
42
+ "table.filters.city.seattle": "Seattle",
43
+ "table.filters.city.tampa": "Tampa",
44
+ "table.filters.show.all": "Show all",
45
+ "table.filters.placeholder.all": "All",
46
+ "table.filters.placeholder.select.more": "Select more",
47
+ "table.search.placeholder": "Search...",
48
+ // FilterSystem translations
49
+ "table.filters.system.validation.max.exceeded": "Maximum {maxFilters} filters allowed, but {filterCount} provided",
50
+ "table.filters.system.validation.duplicate.ids": "Duplicate filter IDs found: {duplicateIds}",
51
+ "table.filters.system.validation.missing.id": "Filter missing required \"id\" field",
52
+ "table.filters.system.validation.missing.label": "Filter \"{filterId}\" missing label",
53
+ "table.filters.system.validation.title": "Filter Configuration Error",
54
+ "table.filters.system.overflow.warning": "Only first {maxFilters} filters shown. {hiddenCount} filters hidden.",
55
+ "table.filters.system.clear.aria": "Clear {filterLabel}",
56
+ // Generic filter placeholders
57
+ "table.filters.placeholder.select.option": "Select an option",
58
+ "table.filters.placeholder.select.options": "Select options",
59
+ "table.filters.placeholder.date.range": "Select date range",
60
+ // Example filter labels (for demonstration)
61
+ "table.filters.label.status": "Status",
62
+ "table.filters.label.department": "Department",
63
+ "table.filters.label.skills": "Skills",
64
+ "table.filters.label.date.applied": "Date Applied",
65
+ "table.filters.label.last.login": "Last Login",
66
+ // Example filter options
67
+ "table.filters.status.active": "Active",
68
+ "table.filters.status.inactive": "Inactive",
69
+ "table.filters.status.pending": "Pending",
70
+ "table.filters.status.suspended": "Suspended",
71
+ "table.filters.department.engineering": "Engineering",
72
+ "table.filters.department.sales": "Sales",
73
+ "table.filters.department.marketing": "Marketing",
74
+ "table.filters.department.hr": "Human Resources",
75
+ "table.filters.skills.javascript": "JavaScript",
76
+ "table.filters.skills.typescript": "TypeScript",
77
+ "table.filters.skills.react": "React",
78
+ "table.filters.skills.node": "Node.js",
79
+ "table.filters.skills.python": "Python",
80
+ // Sort translations
81
+ "table.sort.aria": "Sort {column} {direction}",
82
+ "table.sort.asc": "ascending",
83
+ "table.sort.desc": "descending",
84
+ "table.sort.none": "none",
85
+ // Pagination translations
86
+ "table.pagination.showing": "Showing {start}-{end} of {total}",
87
+ "table.pagination.page": "Page {current} of {total}",
88
+ "table.rows.per.page": "Rows per page",
89
+ "table.row.count": "Showing {start}-{end} of {total}",
90
+ // Error translations
91
+ "table.error.title": "Unable to load table",
92
+ "table.error.default": "Something went wrong while loading data.",
93
+ "table.error.retry": "Try again",
94
+ // Selection translations
95
+ "table.selected.rows": "{count} rows selected",
96
+ "table.selected.row": "1 row selected",
97
+ "table.clear.selection": "Clear selection",
98
+ };
99
+ export { translations };
@@ -0,0 +1,17 @@
1
+ import { translations } from './en.js';
2
+ export const translate = (key, params) => {
3
+ const translation = translations[key];
4
+ if (!translation) {
5
+ console.warn('translate - No translation found for key:', key);
6
+ return key;
7
+ }
8
+ if (!params) {
9
+ return translation;
10
+ }
11
+ let result = translation;
12
+ for (const [paramKey, value] of Object.entries(params)) {
13
+ result = result.replace(`{${paramKey}}`, String(value));
14
+ }
15
+ return result;
16
+ };
17
+ export { translations };