@rebasepro/core 0.1.2 → 0.2.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.
@@ -1,6 +1,13 @@
1
1
  import React from "react";
2
- import { coolIconKeys, iconKeys, iconSize, IconColor, colorClassesMapping, cls } from "@rebasepro/ui";
3
- import { icons as lucideIcons } from "lucide-react";
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<any> | null {
27
- let icon = (lucideIcons as any)[iconKey];
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 = (lucideIcons as any)[toPascalCase(iconKey)];
37
+ icon = iconsMap[toPascalCase(iconKey)];
30
38
  }
31
39
  if (!icon) {
32
- icon = (lucideIcons as any).CircleAlert;
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
- let mappedKey = iconKeysMap[iconKey] || iconKeysMap[lowerKey] || iconKeysMap[slugifiedKey];
63
+ const mappedKey = iconKeysMap[iconKey] || iconKeysMap[lowerKey] || iconKeysMap[slugifiedKey];
56
64
 
57
65
  if (!mappedKey) {
58
66
  return undefined;
@@ -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 unknown as { isId?: boolean }).isId);
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 => {