@rebasepro/core 0.1.2 → 0.2.3
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.
- package/LICENSE +1 -1
- package/dist/components/LoginView/LoginView.d.ts +1 -6
- package/dist/contexts/SnackbarProvider.d.ts +1 -1
- package/dist/hooks/data/save.d.ts +2 -2
- package/dist/hooks/data/useEntityFetch.d.ts +5 -0
- package/dist/hooks/useResolvedComponent.d.ts +1 -1
- package/dist/index.es.js +386 -309
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +436 -358
- package/dist/index.umd.js.map +1 -1
- package/package.json +23 -23
- package/src/components/AIIcon.tsx +1 -1
- package/src/components/Debug/UIReferenceView.tsx +52 -3
- package/src/components/Debug/UIStyleGuide.tsx +1 -2
- package/src/components/ErrorView.tsx +1 -2
- package/src/components/LanguageToggle.tsx +1 -9
- package/src/components/LoginView/LoginView.tsx +21 -12
- package/src/components/UserDisplay.tsx +1 -2
- package/src/components/UserSelectPopover.tsx +13 -2
- package/src/components/UserSettingsView.tsx +12 -3
- package/src/components/common/useDataTableController.tsx +2 -2
- package/src/contexts/SnackbarProvider.tsx +2 -1
- package/src/core/PluginLifecycleManager.tsx +0 -1
- package/src/core/Rebase.tsx +1 -1
- package/src/hooks/data/save.ts +4 -4
- package/src/hooks/data/useCollectionFetch.tsx +4 -4
- package/src/hooks/data/useEntityFetch.tsx +13 -3
- package/src/hooks/data/useRelationSelector.tsx +2 -2
- package/src/hooks/useResolvedComponent.tsx +7 -6
- package/src/hooks/useStudioBridge.tsx +0 -1
- package/src/locales/en.ts +8 -0
- package/src/util/icons.tsx +16 -8
- package/src/util/previews.ts +1 -1
package/src/util/icons.tsx
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import {
|
|
3
|
+
cls,
|
|
4
|
+
colorClassesMapping,
|
|
5
|
+
coolIconKeys,
|
|
6
|
+
IconColor,
|
|
7
|
+
iconKeys,
|
|
8
|
+
iconSize,
|
|
9
|
+
lucideIcons
|
|
10
|
+
} from "@rebasepro/ui";
|
|
4
11
|
import { deepEqual as equal } from "fast-equals"
|
|
5
12
|
import { hashString, slugify } from "@rebasepro/utils";
|
|
6
13
|
|
|
@@ -16,20 +23,21 @@ const iconKeysMap: Record<string, string> = iconKeys.reduce((acc: Record<string,
|
|
|
16
23
|
}, {});
|
|
17
24
|
|
|
18
25
|
function toPascalCase(str: string): string {
|
|
19
|
-
return str.split(/[-_]/).map(word => word.charAt(0).toUpperCase() + word.slice(1)).join(
|
|
26
|
+
return str.split(/[-_]/).map(word => word.charAt(0).toUpperCase() + word.slice(1)).join("");
|
|
20
27
|
}
|
|
21
28
|
|
|
22
29
|
/**
|
|
23
30
|
* Resolve a Lucide icon component by string key.
|
|
24
31
|
* Tries direct match, PascalCase conversion, and falls back to CircleAlert.
|
|
25
32
|
*/
|
|
26
|
-
function resolveIcon(iconKey: string): React.ComponentType<
|
|
27
|
-
|
|
33
|
+
function resolveIcon(iconKey: string): React.ComponentType<{ size?: number; className?: string }> | null {
|
|
34
|
+
const iconsMap = lucideIcons as Record<string, React.ComponentType<{ size?: number; className?: string }> | undefined>;
|
|
35
|
+
let icon = iconsMap[iconKey];
|
|
28
36
|
if (!icon) {
|
|
29
|
-
icon =
|
|
37
|
+
icon = iconsMap[toPascalCase(iconKey)];
|
|
30
38
|
}
|
|
31
39
|
if (!icon) {
|
|
32
|
-
icon =
|
|
40
|
+
icon = iconsMap.CircleAlert;
|
|
33
41
|
}
|
|
34
42
|
return icon ?? null;
|
|
35
43
|
}
|
|
@@ -52,7 +60,7 @@ export function getIcon(iconKey?: string | React.ReactNode,
|
|
|
52
60
|
const lowerKey = iconKey.toLowerCase();
|
|
53
61
|
const slugifiedKey = slugify(iconKey).replace(/-/g, "_");
|
|
54
62
|
|
|
55
|
-
|
|
63
|
+
const mappedKey = iconKeysMap[iconKey] || iconKeysMap[lowerKey] || iconKeysMap[slugifiedKey];
|
|
56
64
|
|
|
57
65
|
if (!mappedKey) {
|
|
58
66
|
return undefined;
|
package/src/util/previews.ts
CHANGED
|
@@ -40,7 +40,7 @@ export function getEntityPreviewKeys(
|
|
|
40
40
|
return listProperties
|
|
41
41
|
.filter(key => {
|
|
42
42
|
const prop = targetCollection.properties[key];
|
|
43
|
-
const isIdProp = prop && typeof prop === "object" && "isId" in prop && Boolean((prop as
|
|
43
|
+
const isIdProp = prop && typeof prop === "object" && "isId" in prop && Boolean((prop as { isId?: boolean }).isId);
|
|
44
44
|
return !isIdProp && key !== "id";
|
|
45
45
|
})
|
|
46
46
|
.filter(key => {
|