@dashadmin/dash-components 1.3.72 → 1.3.74-srcfree.1

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 (60) hide show
  1. package/package.json +24 -21
  2. package/src/components/AuditLog/AuditLog.tsx +0 -490
  3. package/src/components/AuditLog/index.ts +0 -2
  4. package/src/components/AutoCompleteArrayInput/AutoCompleteCheckBoxInput.tsx +0 -917
  5. package/src/components/AutoCompleteArrayInput/AutocompleteCheckBoxArrayInput.tsx +0 -39
  6. package/src/components/AutoCompleteArrayInputAutoSearch/AutoCompleteCheckBoxInput.tsx +0 -916
  7. package/src/components/AutoCompleteArrayInputAutoSearch/AutocompleteCheckBoxArrayAutoSearch.tsx.wip +0 -42
  8. package/src/components/AutoCompleteArrayInputAutoSearch/AutocompleteCheckBoxArrayInput.tsx +0 -44
  9. package/src/components/Json/Json.tsx +0 -312
  10. package/src/components/JsonColorSelector/JsonColorSelector.tsx +0 -1443
  11. package/src/components/JsonColorSelector/JsonColorSelector.tsx.bkup +0 -746
  12. package/src/components/JsonColorSelector/JsonColorSelectorEnhanced.tsx +0 -1135
  13. package/src/components/JsonColorSelector/JsonCssVarValues.tsx +0 -867
  14. package/src/components/JsonColorSelector/components/BasicColorSelector.tsx +0 -333
  15. package/src/components/JsonColorSelector/components/ColorEditDialog.tsx +0 -495
  16. package/src/components/JsonColorSelector/components/ColorPaletteItem.tsx +0 -80
  17. package/src/components/JsonColorSelector/components/ImageColorExtractor.tsx +0 -420
  18. package/src/components/JsonColorSelector/helpers/functions.tsx +0 -123
  19. package/src/components/JsonColorSelector/helpers/paletteDerivation.ts +0 -367
  20. package/src/components/JsonColorSelector/interfaces/interfaces.tsx +0 -22
  21. package/src/components/JsonColorSelector/useAsyncColorThief.tsx +0 -97
  22. package/src/components/ListActive/ListActive.tsx +0 -106
  23. package/src/components/ListActive/ListBoolean.tsx +0 -96
  24. package/src/components/NotificationPreferences/NotificationPreferences.tsx +0 -480
  25. package/src/components/NotificationPreferences/index.tsx +0 -2
  26. package/src/components/SearchableSelects/RASearchableSelect.tsx +0 -303
  27. package/src/components/SearchableSelects/RASearchableSelectCheckboxes.tsx +0 -617
  28. package/src/components/SearchableSelects/RASearchableSelectChips.tsx +0 -561
  29. package/src/components/SearchableSelects/RASearchableSelectChipsRecordContext.tsx +0 -366
  30. package/src/components/SearchableSelects/SearchableSelect.tsx +0 -323
  31. package/src/components/SearchableSelects/SearchableSelectCheckboxes.tsx +0 -358
  32. package/src/components/SortableDataGrid/README.md +0 -1
  33. package/src/components/SortableDataGrid/SortableDataGrid.tsx +0 -56
  34. package/src/components/SortableDataGrid/SortableDataGridBody.tsx +0 -175
  35. package/src/components/SortableDataGrid/SortableDataGridHeader.tsx +0 -171
  36. package/src/components/SortableDataGrid/SortableDataGridRow.tsx +0 -247
  37. package/src/components/Upload/SingleImageUploader.tsx +0 -55
  38. package/src/components/custom/PackageCopyMethod.tsx +0 -109
  39. package/src/components/custom/PackageRadioButtonGroup.tsx +0 -49
  40. package/src/components/dialog/Basic.tsx +0 -11
  41. package/src/components/dialog/Correct.tsx +0 -16
  42. package/src/components/dialog/Error.tsx +0 -15
  43. package/src/components/dialog/Info.tsx +0 -15
  44. package/src/components/dialog/InfoV2.tsx +0 -35
  45. package/src/components/dialog/NotFound.tsx +0 -18
  46. package/src/components/dialog/QuickSearch.tsx +0 -115
  47. package/src/components/notifications/NotificationsCenter.tsx +0 -743
  48. package/src/components/notifications/index.ts +0 -42
  49. package/src/components/tables/PaginationComponent.tsx +0 -17
  50. package/src/components/theme/AppLoadingFallback.tsx +0 -42
  51. package/src/components/theme/ErrorBoundary.tsx +0 -57
  52. package/src/components/theme/InitialLoader.tsx +0 -16
  53. package/src/components/theme/NotFound.tsx +0 -124
  54. package/src/components/theme/NotResults.tsx +0 -56
  55. package/src/hooks/useDraggable.ts +0 -11
  56. package/src/hooks/useNotifications.ts +0 -14
  57. package/src/hooks/useQuickSearch.tsx +0 -29
  58. package/src/index.tsx +0 -77
  59. package/src/styles/index.less +0 -0
  60. package/src/utils/setNativeValue.tsx +0 -23
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dashadmin/dash-components",
3
- "version": "1.3.72",
3
+ "version": "1.3.74-srcfree.1",
4
4
  "main": "dist/index.js",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -10,7 +10,8 @@
10
10
  "lint:fix": "pnpm prettier --write .",
11
11
  "check-updates": "pnpm npm-check-updates",
12
12
  "updates-packages": "pnpm npm-check-updates -u",
13
- "build": "tsup"
13
+ "build": "tsup && pnpm run build:types",
14
+ "build:types": "tsc -p tsconfig.json --declaration --emitDeclarationOnly --noEmit false --outDir dist --rootDir src --skipLibCheck || true"
14
15
  },
15
16
  "browserslist": {
16
17
  "production": [
@@ -34,17 +35,17 @@
34
35
  "@rollup/plugin-node-resolve": "latest",
35
36
  "@rollup/plugin-replace": "latest",
36
37
  "@rollup/plugin-typescript": "latest",
37
- "@dashadmin/dash-auto-admin": "1.3.72",
38
- "@dashadmin/dash-dialog": "1.3.72",
39
- "@dashadmin/dash-modal": "1.3.72",
40
- "@dashadmin/dash-utils": "1.3.72",
38
+ "@dashadmin/dash-auto-admin": "1.3.74-srcfree.1",
39
+ "@dashadmin/dash-dialog": "1.3.74-srcfree.1",
40
+ "@dashadmin/dash-modal": "1.3.74-srcfree.1",
41
+ "@dashadmin/dash-utils": "1.3.74-srcfree.1",
41
42
  "numeral": "^2.0.6",
42
43
  "react-number-format": "^5.4.4",
43
- "@dashadmin/dash-auth": "1.3.72",
44
- "@dashadmin/dash-admin-state": "1.3.72",
45
- "@dashadmin/dash-axios-hook": "1.3.72",
46
- "@dashadmin/dash-interfaces": "1.3.72",
47
- "@dashadmin/dash-styles": "1.3.72",
44
+ "@dashadmin/dash-auth": "1.3.74-srcfree.1",
45
+ "@dashadmin/dash-admin-state": "1.3.74-srcfree.1",
46
+ "@dashadmin/dash-axios-hook": "1.3.74-srcfree.1",
47
+ "@dashadmin/dash-interfaces": "1.3.74-srcfree.1",
48
+ "@dashadmin/dash-styles": "1.3.74-srcfree.1",
48
49
  "query-string": "latest",
49
50
  "react-admin": "5.15.1",
50
51
  "react-color": "^2.19.3",
@@ -72,8 +73,8 @@
72
73
  "@types/react-dom": "latest",
73
74
  "@zerollup/ts-transform-paths": "latest",
74
75
  "babel-loader": "latest",
75
- "@dashadmin/dash-eslint": "1.3.72",
76
- "@dashadmin/dash-tsconfig": "1.3.72",
76
+ "@dashadmin/dash-eslint": "1.3.74-srcfree.1",
77
+ "@dashadmin/dash-tsconfig": "1.3.74-srcfree.1",
77
78
  "eslint": "latest",
78
79
  "eslint-config-airbnb": "latest",
79
80
  "eslint-config-airbnb-typescript": "latest",
@@ -88,7 +89,7 @@
88
89
  "eslint-plugin-react": "latest",
89
90
  "eslint-plugin-react-hooks": "latest",
90
91
  "eslint-plugin-storybook": "latest",
91
- "@dashadmin/dash-prettier": "1.3.72",
92
+ "@dashadmin/dash-prettier": "1.3.74-srcfree.1",
92
93
  "query-string": "latest",
93
94
  "react-dom": "19.2.8",
94
95
  "rollup": "latest",
@@ -113,7 +114,7 @@
113
114
  "extends": "react-app"
114
115
  },
115
116
  "module": "dist/index.js",
116
- "types": "./src/index.tsx",
117
+ "types": "./dist/index.d.ts",
117
118
  "exports": {
118
119
  ".": "./dist/index.js",
119
120
  "./components/AuditLog": "./dist/components/AuditLog/index.js",
@@ -130,18 +131,20 @@
130
131
  "registry": "https://registry.npmjs.org"
131
132
  },
132
133
  "files": [
133
- "dist",
134
- "src"
134
+ "dist"
135
135
  ],
136
136
  "typesVersions": {
137
137
  "*": {
138
+ "dist/*": [
139
+ "dist/*"
140
+ ],
138
141
  "src/*": [
139
- "src/*",
140
- "src/*/index"
142
+ "dist/*",
143
+ "dist/*/index"
141
144
  ],
142
145
  "*": [
143
- "src/*",
144
- "src/*/index"
146
+ "dist/*",
147
+ "dist/*/index"
145
148
  ]
146
149
  }
147
150
  }
@@ -1,490 +0,0 @@
1
- import React, { useState, useMemo, useCallback } from "react";
2
- import { useRecordContext, useGetList, Loading } from "react-admin";
3
- import {
4
- Box,
5
- Typography,
6
- Paper,
7
- Button,
8
- Dialog,
9
- DialogTitle,
10
- DialogContent,
11
- DialogActions,
12
- IconButton,
13
- Chip,
14
- Tooltip,
15
- } from "@mui/material";
16
- import {
17
- DataGrid as MUIGrid,
18
- GridColDef,
19
- GridRowParams,
20
- GridPaginationModel,
21
- GridToolbarContainer,
22
- GridToolbarExport,
23
- } from "@mui/x-data-grid";
24
- import VisibilityIcon from "@mui/icons-material/Visibility";
25
- import CloseIcon from "@mui/icons-material/Close";
26
- import HistoryIcon from "@mui/icons-material/History";
27
-
28
- /**
29
- * AuditLog Component (Generic)
30
- *
31
- * A reusable component that displays audit logs (activity logs) for any model.
32
- * Uses Spatie Activity Log data from the backend.
33
- *
34
- * Features:
35
- * - Paginated DataGrid with sorting
36
- * - Export functionality (CSV, Print)
37
- * - JSON detail dialog for viewing full log properties
38
- * - Works with any model that has audit logging enabled
39
- *
40
- * @example
41
- * // In your schema file:
42
- * import { AuditLog } from 'dash-components';
43
- *
44
- * const myModelSchema = [
45
- * // ... other fields
46
- * {
47
- * tab: 'Audit',
48
- * attribute: 'audit_logs',
49
- * label: 'Audit Logs',
50
- * type: Array,
51
- * inList: false,
52
- * inEdit: true,
53
- * inShow: true,
54
- * inCreate: false,
55
- * readOnly: true,
56
- * custom: true,
57
- * component: AuditLog,
58
- * },
59
- * ];
60
- */
61
-
62
- /**
63
- * Props interface for the AuditLog component
64
- * Compatible with dash-auto-admin custom field components
65
- */
66
- export interface AuditLogProps {
67
- /** The resource configuration from dash-auto-admin */
68
- resourceConfig?: {
69
- model?: string;
70
- [key: string]: any;
71
- };
72
- /** The current mode: 'create', 'edit', 'view', 'list' */
73
- method?: 'create' | 'edit' | 'view' | 'list' | 'show';
74
- /** Optional custom resource path override */
75
- resource?: string;
76
- /** Any additional props */
77
- [key: string]: any;
78
- }
79
-
80
- /**
81
- * Activity log record interface from Spatie Activity Log
82
- */
83
- export interface ActivityLogRecord {
84
- id: number;
85
- log_name: string;
86
- description: string;
87
- subject_type: string | null;
88
- subject_id: number | null;
89
- causer_type: string | null;
90
- causer_id: number | null;
91
- causer_name?: string;
92
- properties: Record<string, any>;
93
- event: string | null;
94
- batch_uuid: string | null;
95
- created_at: string;
96
- updated_at: string;
97
- }
98
-
99
- interface DialogState {
100
- open: boolean;
101
- log: ActivityLogRecord | null;
102
- }
103
-
104
- /**
105
- * Custom toolbar with export functionality
106
- */
107
- const AuditToolbar: React.FC = () => {
108
- return (
109
- <GridToolbarContainer>
110
- <GridToolbarExport
111
- csvOptions={{
112
- fileName: 'audit-logs-export',
113
- delimiter: ',',
114
- utf8WithBom: true,
115
- }}
116
- printOptions={{
117
- hideFooter: true,
118
- hideToolbar: true,
119
- }}
120
- />
121
- </GridToolbarContainer>
122
- );
123
- };
124
-
125
- /**
126
- * JSON Viewer Dialog for audit log details
127
- */
128
- interface JsonDialogProps {
129
- open: boolean;
130
- log: ActivityLogRecord | null;
131
- onClose: () => void;
132
- }
133
-
134
- const AuditJsonDialog: React.FC<JsonDialogProps> = ({ open, log, onClose }) => {
135
- if (!log) return null;
136
-
137
- const formatJson = (obj: any): string => {
138
- try {
139
- return JSON.stringify(obj, null, 2);
140
- } catch {
141
- return String(obj);
142
- }
143
- };
144
-
145
- return (
146
- <Dialog
147
- open={open}
148
- onClose={onClose}
149
- maxWidth="md"
150
- fullWidth
151
- aria-labelledby="audit-log-dialog-title"
152
- >
153
- <DialogTitle id="audit-log-dialog-title">
154
- <Box
155
- sx={{
156
- display: "flex",
157
- justifyContent: "space-between",
158
- alignItems: "center"
159
- }}>
160
- <Typography variant="h6">
161
- Audit Log Details - {log.event || log.description}
162
- </Typography>
163
- <IconButton
164
- edge="end"
165
- color="inherit"
166
- onClick={onClose}
167
- aria-label="close"
168
- >
169
- <CloseIcon />
170
- </IconButton>
171
- </Box>
172
- </DialogTitle>
173
- <DialogContent dividers>
174
- <Box sx={{
175
- mb: 2
176
- }}>
177
- <Typography variant="subtitle2" color="textSecondary">
178
- Event Information
179
- </Typography>
180
- <Paper variant="outlined" sx={{ p: 2, mt: 1 }}>
181
- <Typography variant="body2">
182
- <strong>ID:</strong> {log.id}
183
- </Typography>
184
- <Typography variant="body2">
185
- <strong>Event:</strong> {log.event || 'N/A'}
186
- </Typography>
187
- <Typography variant="body2">
188
- <strong>Description:</strong> {log.description}
189
- </Typography>
190
- <Typography variant="body2">
191
- <strong>Log Name:</strong> {log.log_name}
192
- </Typography>
193
- <Typography variant="body2">
194
- <strong>Created At:</strong> {new Date(log.created_at).toLocaleString()}
195
- </Typography>
196
- {log.causer_name && (
197
- <Typography variant="body2">
198
- <strong>Changed By:</strong> {log.causer_name}
199
- </Typography>
200
- )}
201
- </Paper>
202
- </Box>
203
-
204
- <Box>
205
- <Typography variant="subtitle2" color="textSecondary">
206
- Properties (JSON)
207
- </Typography>
208
- <Paper
209
- variant="outlined"
210
- sx={{
211
- p: 2,
212
- mt: 1,
213
- bgcolor: 'grey.900',
214
- color: 'grey.100',
215
- maxHeight: 400,
216
- overflow: 'auto',
217
- }}
218
- >
219
- <pre style={{ margin: 0, whiteSpace: 'pre-wrap', wordBreak: 'break-word' }}>
220
- {formatJson(log.properties)}
221
- </pre>
222
- </Paper>
223
- </Box>
224
- </DialogContent>
225
- <DialogActions>
226
- <Button onClick={onClose} color="primary">
227
- Close
228
- </Button>
229
- </DialogActions>
230
- </Dialog>
231
- );
232
- };
233
-
234
- /**
235
- * Get event color chip based on event type
236
- */
237
- const getEventChip = (event: string | null, logName?: string): React.ReactNode => {
238
- const eventLower = (event || '').toLowerCase();
239
- let color: 'success' | 'warning' | 'error' | 'info' | 'default' = 'default';
240
-
241
- switch (eventLower) {
242
- case 'created':
243
- color = 'success';
244
- break;
245
- case 'updated':
246
- color = 'warning';
247
- break;
248
- case 'deleted':
249
- color = 'error';
250
- break;
251
- case 'restored':
252
- color = 'info';
253
- break;
254
- default:
255
- color = 'default';
256
- }
257
-
258
- return (
259
- <Chip
260
- label={event || 'N/A'}
261
- color={color}
262
- size="small"
263
- variant="outlined"
264
- />
265
- );
266
- };
267
-
268
- /**
269
- * View mode - Display audit logs as a DataGrid
270
- */
271
- const AuditLogView: React.FC<AuditLogProps> = ({ resourceConfig, resource: resourceOverride }) => {
272
- const record = useRecordContext();
273
- const [paginationModel, setPaginationModel] = useState<GridPaginationModel>({
274
- page: 0,
275
- pageSize: 10,
276
- });
277
- const [dialogState, setDialogState] = useState<DialogState>({
278
- open: false,
279
- log: null,
280
- });
281
-
282
- // Build the audit endpoint URL - uses resource override, resourceConfig model, or default
283
- const baseResource = resourceOverride || resourceConfig?.model || '';
284
- const auditResource = `${baseResource}/audit`;
285
-
286
- const { data, total, isLoading, error } = useGetList<ActivityLogRecord>(
287
- auditResource,
288
- {
289
- pagination: {
290
- page: paginationModel.page + 1,
291
- perPage: paginationModel.pageSize,
292
- },
293
- sort: { field: 'created_at', order: 'DESC' },
294
- filter: { subject_id: record?.id },
295
- },
296
- { enabled: !!record?.id, refetchOnWindowFocus: false }
297
- );
298
-
299
- const handleViewLog = useCallback((log: ActivityLogRecord) => {
300
- setDialogState({ open: true, log });
301
- }, []);
302
-
303
- const handleCloseDialog = useCallback(() => {
304
- setDialogState({ open: false, log: null });
305
- }, []);
306
-
307
- const columns: GridColDef[] = useMemo(
308
- () => [
309
- {
310
- field: 'id',
311
- headerName: 'ID',
312
- type: 'number',
313
- width: 80,
314
- },
315
- {
316
- field: 'event',
317
- headerName: 'Event',
318
- width: 120,
319
- renderCell: (params) => getEventChip(params.value),
320
- },
321
- {
322
- field: 'description',
323
- headerName: 'Description',
324
- flex: 1,
325
- minWidth: 200,
326
- },
327
- {
328
- field: 'causer_name',
329
- headerName: 'Changed By',
330
- width: 150,
331
- valueGetter: (value, row) => row.causer_name || 'System',
332
- },
333
- {
334
- field: 'created_at',
335
- headerName: 'Date',
336
- width: 180,
337
- valueFormatter: (value) =>
338
- value ? new Date(value).toLocaleString() : '',
339
- },
340
- {
341
- field: 'actions',
342
- headerName: 'Actions',
343
- type: 'actions',
344
- width: 100,
345
- getActions: (params: GridRowParams<ActivityLogRecord>) => [
346
- <Tooltip title="View Details" key="view">
347
- <IconButton
348
- size="small"
349
- onClick={() => handleViewLog(params.row)}
350
- color="primary"
351
- >
352
- <VisibilityIcon fontSize="small" />
353
- </IconButton>
354
- </Tooltip>,
355
- ],
356
- },
357
- ],
358
- [handleViewLog]
359
- );
360
-
361
- if (!record?.id) {
362
- return (
363
- <Paper variant="outlined" sx={{ p: 3, textAlign: 'center' }}>
364
- <HistoryIcon sx={{ fontSize: 48, color: 'text.secondary', mb: 1 }} />
365
- <Typography variant="body1" sx={{
366
- color: "text.secondary"
367
- }}>
368
- Save the record first to view audit logs
369
- </Typography>
370
- </Paper>
371
- );
372
- }
373
-
374
- if (isLoading) {
375
- return <Loading />;
376
- }
377
-
378
- if (error) {
379
- return (
380
- <Paper variant="outlined" sx={{ p: 2 }}>
381
- <Typography color="error">
382
- Error loading audit logs: {(error as any)?.message || 'Unknown error'}
383
- </Typography>
384
- </Paper>
385
- );
386
- }
387
-
388
- if (!data || data.length === 0) {
389
- return (
390
- <Paper variant="outlined" sx={{ p: 3, textAlign: 'center' }}>
391
- <HistoryIcon sx={{ fontSize: 48, color: 'text.secondary', mb: 1 }} />
392
- <Typography variant="body1" sx={{
393
- color: "text.secondary"
394
- }}>
395
- No audit logs available for this record
396
- </Typography>
397
- </Paper>
398
- );
399
- }
400
-
401
- return (
402
- <>
403
- <Box sx={{ width: '100%' }}>
404
- <Paper variant="outlined">
405
- <MUIGrid
406
- rows={data}
407
- columns={columns}
408
- rowCount={total || 0}
409
- loading={isLoading}
410
- pageSizeOptions={[5, 10, 25, 50]}
411
- paginationModel={paginationModel}
412
- paginationMode="server"
413
- onPaginationModelChange={setPaginationModel}
414
- disableRowSelectionOnClick
415
- autoHeight
416
- slots={{
417
- toolbar: AuditToolbar,
418
- }}
419
- sx={{
420
- '& .MuiDataGrid-cell:focus': {
421
- outline: 'none',
422
- },
423
- }}
424
- />
425
- </Paper>
426
- </Box>
427
-
428
- <AuditJsonDialog
429
- open={dialogState.open}
430
- log={dialogState.log}
431
- onClose={handleCloseDialog}
432
- />
433
- </>
434
- );
435
- };
436
-
437
- /**
438
- * Edit mode - Same as view mode for audit logs (read-only)
439
- */
440
- const AuditLogEdit: React.FC<AuditLogProps> = (props) => {
441
- return <AuditLogView {...props} />;
442
- };
443
-
444
- /**
445
- * List mode - Display placeholder (audit logs viewed in detail)
446
- */
447
- const AuditLogList: React.FC<AuditLogProps> = () => {
448
- return (
449
- <Typography variant="body2" sx={{
450
- color: "text.secondary"
451
- }}>—
452
- </Typography>
453
- );
454
- };
455
-
456
- /**
457
- * Main Component - Routes to appropriate view based on method
458
- *
459
- * @param props - Component props including resourceConfig and method
460
- * @returns The appropriate audit log view component
461
- */
462
- const AuditLog: React.FC<AuditLogProps> = (props) => {
463
- const { method } = props;
464
-
465
- switch (method) {
466
- case 'view':
467
- case 'show':
468
- return <AuditLogView {...props} />;
469
- case 'edit':
470
- return <AuditLogEdit {...props} />;
471
- case 'list':
472
- return <AuditLogList {...props} />;
473
- case 'create':
474
- // No audit logs for new records
475
- return (
476
- <Paper variant="outlined" sx={{ p: 3, textAlign: 'center' }}>
477
- <HistoryIcon sx={{ fontSize: 48, color: 'text.secondary', mb: 1 }} />
478
- <Typography variant="body1" sx={{
479
- color: "text.secondary"
480
- }}>
481
- Audit logs will be available after the record is created
482
- </Typography>
483
- </Paper>
484
- );
485
- default:
486
- return <AuditLogView {...props} />;
487
- }
488
- };
489
-
490
- export default AuditLog;
@@ -1,2 +0,0 @@
1
- export { default as AuditLog } from './AuditLog';
2
- export type { AuditLogProps, ActivityLogRecord } from './AuditLog';