react-admin-crud-manager 1.1.0 → 1.1.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 (40) hide show
  1. package/dist/index.cjs.js +5 -5
  2. package/dist/index.cjs.js.map +1 -1
  3. package/dist/index.es.js +31 -31
  4. package/dist/index.es.js.map +1 -1
  5. package/dist/types/OptionalSnackbarProvider.d.ts +6 -0
  6. package/dist/types/components/Button/Button.d.ts +11 -0
  7. package/dist/types/components/Chip/Chip.d.ts +8 -0
  8. package/dist/types/components/CrudPage.d.ts +4 -0
  9. package/dist/types/components/Details/Details.d.ts +12 -0
  10. package/dist/types/components/Details/components/CardGroup.d.ts +6 -0
  11. package/dist/types/components/Details/components/DetailRow.d.ts +6 -0
  12. package/dist/types/components/Details/components/GroupRow.d.ts +6 -0
  13. package/dist/types/components/Filter/FilterDrawer.d.ts +17 -0
  14. package/dist/types/components/Form/Form.d.ts +21 -0
  15. package/dist/types/components/Form/components/AudioPicker.d.ts +18 -0
  16. package/dist/types/components/Form/components/Checkbox.d.ts +19 -0
  17. package/dist/types/components/Form/components/ImageCropperModal.d.ts +12 -0
  18. package/dist/types/components/Form/components/ImagePicker.d.ts +19 -0
  19. package/dist/types/components/Form/components/Input.d.ts +18 -0
  20. package/dist/types/components/Form/components/InputLabel.d.ts +8 -0
  21. package/dist/types/components/Form/components/PhoneInput.d.ts +15 -0
  22. package/dist/types/components/Form/components/Radio.d.ts +17 -0
  23. package/dist/types/components/Form/components/RenderFields.d.ts +42 -0
  24. package/dist/types/components/Form/components/Select.d.ts +25 -0
  25. package/dist/types/components/Form/components/Switch.d.ts +13 -0
  26. package/dist/types/components/Form/components/TextArea.d.ts +9 -0
  27. package/dist/types/components/Form/components/TinyEditor.d.ts +20 -0
  28. package/dist/types/components/Form/components/VideoPicker.d.ts +18 -0
  29. package/dist/types/components/Loader/Spinner.d.ts +7 -0
  30. package/dist/types/components/Modal/Modal.d.ts +20 -0
  31. package/dist/types/components/Table/Table.d.ts +10 -0
  32. package/dist/types/components/Table/components/ImagePreview.d.ts +8 -0
  33. package/dist/types/components/Table/components/SortDropdown.d.ts +13 -0
  34. package/dist/types/components/Table/components/TableSkeleton.d.ts +6 -0
  35. package/dist/types/components/Table/utils/sortUtils.d.ts +58 -0
  36. package/dist/types/data/countries.d.ts +6 -0
  37. package/dist/types/index.d.ts +2 -0
  38. package/dist/types/lib/utils.d.ts +2 -0
  39. package/dist/types/types/crudtypes.d.ts +217 -0
  40. package/package.json +6 -2
@@ -0,0 +1,217 @@
1
+ import { type ReactNode } from "react";
2
+ export interface CrudPageProps {
3
+ config: Config;
4
+ }
5
+ export interface Option {
6
+ value: string | number | boolean;
7
+ label: string;
8
+ color?: string;
9
+ }
10
+ export interface ActionButton {
11
+ type: string;
12
+ label: string;
13
+ color?: string;
14
+ variant?: string;
15
+ className?: string;
16
+ disabled?: boolean;
17
+ onClick?: (event: React.MouseEvent, item: any) => void | Promise<any>;
18
+ }
19
+ export interface MenuAction {
20
+ title: string;
21
+ type: string;
22
+ variant?: string;
23
+ icon?: ReactNode;
24
+ }
25
+ export interface TableHead {
26
+ key: string;
27
+ title?: string;
28
+ type?: string;
29
+ imageKey?: string;
30
+ titleKey?: string;
31
+ subtitleKey?: string;
32
+ onClickDetails?: boolean;
33
+ variant?: string;
34
+ chipOptions?: Option[];
35
+ defaultColor?: string;
36
+ className?: string;
37
+ format?: string;
38
+ menuList?: MenuAction[];
39
+ }
40
+ export interface FormField {
41
+ key: string;
42
+ label?: string;
43
+ type?: string;
44
+ options?: any[];
45
+ placeholder?: string;
46
+ rows?: number;
47
+ inputClass?: string;
48
+ search?: boolean;
49
+ accept?: string;
50
+ text?: string;
51
+ required?: boolean;
52
+ minLength?: number;
53
+ dragDrop?: boolean;
54
+ parentClass?: string;
55
+ countriesList?: boolean;
56
+ defaultCountry?: string;
57
+ multiple?: boolean;
58
+ dropdownMaxHeight?: number;
59
+ editorKey?: string;
60
+ fontFamily?: string;
61
+ disabled?: boolean;
62
+ negativeNumberAllow?: boolean;
63
+ defaultValue?: any;
64
+ renderCondition?: (formData: Record<string, any>) => boolean;
65
+ pattern?: string;
66
+ renderType?: string;
67
+ cropImage?: boolean;
68
+ aspectRatio?: number;
69
+ dependencyKey?: string;
70
+ mask?: string;
71
+ maskApplyOnValue?: boolean;
72
+ maxSize?: number;
73
+ [key: string]: any;
74
+ }
75
+ export interface ViewField {
76
+ key?: string;
77
+ label?: string;
78
+ type?: string;
79
+ imageKey?: string;
80
+ titleKey?: string;
81
+ subtitleKey?: string;
82
+ blockClass?: string;
83
+ icon?: ReactNode;
84
+ variant?: string;
85
+ chipOptions?: Option[];
86
+ defaultColor?: string;
87
+ className?: string;
88
+ format?: string;
89
+ }
90
+ export interface SearchConfig {
91
+ enabled?: boolean;
92
+ useServerSideSearch?: boolean;
93
+ searchKeys?: string[];
94
+ }
95
+ export interface PaginationConfig {
96
+ enabled?: boolean;
97
+ useServerSidePagination?: boolean;
98
+ }
99
+ export interface FilterConfig {
100
+ enabled?: boolean;
101
+ useServerSideFilters?: boolean;
102
+ }
103
+ export interface SortChangePayload {
104
+ value: string;
105
+ option: {
106
+ value: string;
107
+ label: string;
108
+ key: string;
109
+ order: string;
110
+ type?: string;
111
+ } | null;
112
+ key: string;
113
+ order: string;
114
+ type: string;
115
+ }
116
+ export interface SortConfig {
117
+ enabled?: boolean;
118
+ useServerSideSorting?: boolean;
119
+ options?: Array<{
120
+ value: string;
121
+ label: string;
122
+ key: string;
123
+ order: string;
124
+ type?: string;
125
+ }>;
126
+ fields?: string[];
127
+ defaultValue?: string;
128
+ autoGenerate?: boolean;
129
+ clearLabel?: string;
130
+ onChange?: (payload: SortChangePayload) => void;
131
+ }
132
+ export interface TableConfig {
133
+ table_head: TableHead[];
134
+ search?: SearchConfig;
135
+ pagination?: PaginationConfig;
136
+ filter?: FilterConfig;
137
+ sort?: SortConfig;
138
+ }
139
+ export interface ModalConfig {
140
+ addModal?: {
141
+ title: string;
142
+ size?: string;
143
+ formClass?: string;
144
+ formFields?: FormField[];
145
+ handleSubmit: (formData: Record<string, any>) => Promise<{
146
+ newObject: any;
147
+ message?: string;
148
+ }>;
149
+ actionButtons?: ActionButton[];
150
+ icon?: ReactNode;
151
+ };
152
+ editModal?: {
153
+ title: string;
154
+ size?: string;
155
+ formClass?: string;
156
+ formFields?: FormField[];
157
+ handleSubmit: (formData: Record<string, any>, item: any) => Promise<{
158
+ newObject: any;
159
+ targetObject: any;
160
+ message?: string;
161
+ }>;
162
+ actionButtons?: ActionButton[];
163
+ icon?: ReactNode;
164
+ };
165
+ deleteModal?: {
166
+ title: string;
167
+ size?: string;
168
+ confirmText?: string;
169
+ referenceKey?: string;
170
+ actionButtons?: ActionButton[];
171
+ icon?: ReactNode;
172
+ };
173
+ viewModal?: {
174
+ title: string;
175
+ size?: string;
176
+ component?: React.ComponentType<{
177
+ data: any;
178
+ }>;
179
+ fields?: ViewField[];
180
+ footer?: {
181
+ cancelButton?: boolean;
182
+ cancelText?: string;
183
+ };
184
+ icon?: ReactNode;
185
+ };
186
+ }
187
+ export interface FilterConfigProps {
188
+ fields?: FormField[];
189
+ }
190
+ export interface Config {
191
+ title: string;
192
+ description?: string;
193
+ buttonText?: string;
194
+ fetchData: (params: {
195
+ search: string;
196
+ rows_per_page: number;
197
+ current_page: number;
198
+ sort_by: string;
199
+ sort_order: string;
200
+ [key: string]: any;
201
+ }) => Promise<{
202
+ data: any[];
203
+ pagination: any;
204
+ }>;
205
+ fetchRowDetails?: (item: any) => Promise<any>;
206
+ isStaticData?: boolean;
207
+ tableConfig: TableConfig;
208
+ modalConfig?: ModalConfig;
209
+ filterConfig?: FilterConfigProps;
210
+ }
211
+ export interface ServerSidePaginationData {
212
+ search: string;
213
+ rows_per_page: number;
214
+ current_page: number;
215
+ sort_by: string;
216
+ sort_order: string;
217
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-admin-crud-manager",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "description": "A reusable React CRUD admin template with modular components.",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.es.js",
@@ -8,7 +8,8 @@
8
8
  "exports": {
9
9
  ".": {
10
10
  "import": "./dist/index.es.js",
11
- "require": "./dist/index.cjs.js"
11
+ "require": "./dist/index.cjs.js",
12
+ "types": "./dist/types/index.d.ts"
12
13
  },
13
14
  "./dist/tailwind.css": "./dist/tailwind.css"
14
15
  },
@@ -36,6 +37,8 @@
36
37
  "scripts": {
37
38
  "dev": "vite",
38
39
  "build": "vite build && node build-css.js",
40
+ "build:types": "tsc --emitDeclarationOnly",
41
+ "build:all": "npm run build && npm run build:types",
39
42
  "preview": "vite preview"
40
43
  },
41
44
  "dependencies": {
@@ -53,6 +56,7 @@
53
56
  },
54
57
  "devDependencies": {
55
58
  "@types/react": "^19.2.14",
59
+ "@types/react-dom": "^19.2.3",
56
60
  "@vitejs/plugin-react": "^4.2.1",
57
61
  "autoprefixer": "10.4.15",
58
62
  "tailwindcss": "3.3.3",