react-admin-crud-manager 1.0.1 → 1.0.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 (33) hide show
  1. package/README.md +12 -1
  2. package/dist/index.cjs.js +62 -0
  3. package/dist/index.cjs.js.map +1 -0
  4. package/dist/index.es.js +2871 -0
  5. package/dist/index.es.js.map +1 -0
  6. package/dist/style.css +1 -0
  7. package/package.json +9 -4
  8. package/src/components/Button/Button.jsx +0 -85
  9. package/src/components/Chip/Chip.jsx +0 -71
  10. package/src/components/CrudPage.jsx +0 -532
  11. package/src/components/Details/Details.jsx +0 -134
  12. package/src/components/Filter/FilterDrawer.jsx +0 -99
  13. package/src/components/Form/Form.jsx +0 -51
  14. package/src/components/Form/components/Checkbox.jsx +0 -119
  15. package/src/components/Form/components/ImagePicker.jsx +0 -128
  16. package/src/components/Form/components/Input.jsx +0 -71
  17. package/src/components/Form/components/InputLabel.jsx +0 -12
  18. package/src/components/Form/components/PhoneInput.jsx +0 -221
  19. package/src/components/Form/components/RenderFields.jsx +0 -181
  20. package/src/components/Form/components/Select.jsx +0 -191
  21. package/src/components/Form/components/Switch.jsx +0 -64
  22. package/src/components/Form/components/TextArea.jsx +0 -31
  23. package/src/components/Form/components/TinyEditor.jsx +0 -113
  24. package/src/components/Loader/Spinner.jsx +0 -21
  25. package/src/components/Modal/Modal.jsx +0 -152
  26. package/src/components/Table/Table.jsx +0 -554
  27. package/src/components/Table/components/ImagePreview.jsx +0 -58
  28. package/src/components/Table/components/TableSkeleton.jsx +0 -39
  29. package/src/data/countries.js +0 -252
  30. package/src/data/teams.js +0 -130
  31. package/src/index.css +0 -170
  32. package/src/index.js +0 -11
  33. package/src/lib/utils.js +0 -74
package/src/lib/utils.js DELETED
@@ -1,74 +0,0 @@
1
- // ======= Format Date : Jan 15, 2024 =======
2
-
3
- export const formatDate = (dateString, format = "DD MMM YYYY") => {
4
- if (!dateString) return "N/A";
5
-
6
- const date = new Date(dateString);
7
- if (isNaN(date)) return "Invalid Date";
8
-
9
- const pad = (n) => String(n).padStart(2, "0");
10
-
11
- const map = {
12
- YYYY: date.getFullYear(),
13
- YY: String(date.getFullYear()).slice(-2),
14
-
15
- MMMM: date.toLocaleString("en-US", { month: "long" }),
16
- MMM: date.toLocaleString("en-US", { month: "short" }),
17
- MM: pad(date.getMonth() + 1),
18
- M: date.getMonth() + 1,
19
-
20
- DD: pad(date.getDate()),
21
- D: date.getDate(),
22
-
23
- dddd: date.toLocaleString("en-US", { weekday: "long" }),
24
- ddd: date.toLocaleString("en-US", { weekday: "short" }),
25
-
26
- HH: pad(date.getHours()),
27
- hh: pad(date.getHours() % 12 || 12),
28
-
29
- mm: pad(date.getMinutes()),
30
- ss: pad(date.getSeconds()),
31
-
32
- A: date.getHours() >= 12 ? "PM" : "AM",
33
- };
34
-
35
- return format.replace(
36
- /YYYY|YY|MMMM|MMM|MM|M|DD|D|dddd|ddd|HH|hh|mm|ss|A/g,
37
- (token) => map[token],
38
- );
39
- };
40
-
41
- // =========== Local Search function ===========
42
- export const searchLocalData = (data, searchTerm, searchKeys = []) => {
43
- if (!searchTerm?.trim()) return data;
44
-
45
- const lowerSearchTerm = searchTerm.toLowerCase();
46
-
47
- const extractValues = (obj) => {
48
- if (obj == null) return [];
49
- if (typeof obj === "object") {
50
- return Object.values(obj).flatMap(extractValues);
51
- }
52
- return [String(obj)];
53
- };
54
-
55
- return data.filter((item) => {
56
- let valuesToSearch = [];
57
-
58
- // ✅ If specific keys are provided → search only in those keys
59
- if (searchKeys.length > 0) {
60
- searchKeys.forEach((key) => {
61
- if (item[key] !== undefined) {
62
- valuesToSearch.push(...extractValues(item[key]));
63
- }
64
- });
65
- } else {
66
- // ✅ Otherwise → search in entire object
67
- valuesToSearch = extractValues(item);
68
- }
69
-
70
- return valuesToSearch.some((val) =>
71
- val.toLowerCase().includes(lowerSearchTerm),
72
- );
73
- });
74
- };