@logickernel/frame 0.1.0

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 (50) hide show
  1. package/README.md +461 -0
  2. package/dist/adapters/nextjs.js +31 -0
  3. package/dist/adapters/nextjs.js.map +1 -0
  4. package/dist/adapters/nextjs.mjs +25 -0
  5. package/dist/adapters/nextjs.mjs.map +1 -0
  6. package/dist/components/AppSidebar.js +467 -0
  7. package/dist/components/AppSidebar.js.map +1 -0
  8. package/dist/components/AppSidebar.mjs +446 -0
  9. package/dist/components/AppSidebar.mjs.map +1 -0
  10. package/dist/components/NavMain.js +133 -0
  11. package/dist/components/NavMain.js.map +1 -0
  12. package/dist/components/NavMain.mjs +112 -0
  13. package/dist/components/NavMain.mjs.map +1 -0
  14. package/dist/components/NavUser.js +88 -0
  15. package/dist/components/NavUser.js.map +1 -0
  16. package/dist/components/NavUser.mjs +86 -0
  17. package/dist/components/NavUser.mjs.map +1 -0
  18. package/dist/components/TeamSwitcher.js +164 -0
  19. package/dist/components/TeamSwitcher.js.map +1 -0
  20. package/dist/components/TeamSwitcher.mjs +162 -0
  21. package/dist/components/TeamSwitcher.mjs.map +1 -0
  22. package/dist/hooks/useNavigation.d.mts +24 -0
  23. package/dist/hooks/useNavigation.d.ts +24 -0
  24. package/dist/hooks/useNavigation.js +59 -0
  25. package/dist/hooks/useNavigation.js.map +1 -0
  26. package/dist/hooks/useNavigation.mjs +57 -0
  27. package/dist/hooks/useNavigation.mjs.map +1 -0
  28. package/dist/index.d.mts +58 -0
  29. package/dist/index.d.ts +58 -0
  30. package/dist/index.js +495 -0
  31. package/dist/index.js.map +1 -0
  32. package/dist/index.mjs +465 -0
  33. package/dist/index.mjs.map +1 -0
  34. package/dist/types/index.d.mts +85 -0
  35. package/dist/types/index.d.ts +85 -0
  36. package/dist/types/index.js +4 -0
  37. package/dist/types/index.js.map +1 -0
  38. package/dist/types/index.mjs +3 -0
  39. package/dist/types/index.mjs.map +1 -0
  40. package/dist/types/ui-components.d.js +4 -0
  41. package/dist/types/ui-components.d.js.map +1 -0
  42. package/dist/types/ui-components.d.mjs +3 -0
  43. package/dist/types/ui-components.d.mjs.map +1 -0
  44. package/dist/utils/iconMapper.d.mts +16 -0
  45. package/dist/utils/iconMapper.d.ts +16 -0
  46. package/dist/utils/iconMapper.js +52 -0
  47. package/dist/utils/iconMapper.js.map +1 -0
  48. package/dist/utils/iconMapper.mjs +30 -0
  49. package/dist/utils/iconMapper.mjs.map +1 -0
  50. package/package.json +76 -0
@@ -0,0 +1,85 @@
1
+ import { LucideIcon } from 'lucide-react';
2
+ import { ComponentType, ReactNode } from 'react';
3
+
4
+ /**
5
+ * @logickernel/frame library types
6
+ * Shared types for navigation, user, and organization data
7
+ */
8
+
9
+ /**
10
+ * Navigation item for facade components
11
+ * Supports both icon components (props) and icon names (API)
12
+ */
13
+ interface NavigationItem {
14
+ title: string;
15
+ url?: string;
16
+ icon?: string | LucideIcon;
17
+ isActive?: boolean;
18
+ items?: {
19
+ title: string;
20
+ url: string;
21
+ }[];
22
+ }
23
+ /**
24
+ * Navigation configuration
25
+ */
26
+ interface NavigationConfig {
27
+ items: NavigationItem[];
28
+ organizationId?: string;
29
+ }
30
+ /**
31
+ * Sidebar data payload for props mode
32
+ * Contains organizations and navigation items
33
+ */
34
+ interface SidebarData {
35
+ organizations: Organization[];
36
+ navigationItems: NavigationItem[];
37
+ }
38
+ /**
39
+ * User data structure
40
+ */
41
+ interface User {
42
+ name: string | null;
43
+ email: string;
44
+ image: string | null;
45
+ }
46
+ /**
47
+ * Organization data structure
48
+ */
49
+ interface Organization {
50
+ id: string;
51
+ name: string;
52
+ logo?: LucideIcon | React.ComponentType<{
53
+ className?: string;
54
+ }>;
55
+ plan?: string;
56
+ }
57
+ /**
58
+ * Router interface for framework-agnostic navigation
59
+ */
60
+ interface Router {
61
+ push: (path: string) => void;
62
+ refresh?: () => void;
63
+ }
64
+ /**
65
+ * Link component props
66
+ */
67
+ interface LinkProps {
68
+ href: string;
69
+ children: ReactNode;
70
+ className?: string;
71
+ }
72
+ /**
73
+ * Framework adapter interface
74
+ * Provides router functions and components for the library
75
+ */
76
+ interface FrameworkAdapter {
77
+ usePathname: () => string;
78
+ useRouter: () => Router;
79
+ Link: ComponentType<LinkProps>;
80
+ signOut?: (options?: {
81
+ redirect?: boolean;
82
+ }) => Promise<void>;
83
+ }
84
+
85
+ export type { FrameworkAdapter, LinkProps, NavigationConfig, NavigationItem, Organization, Router, SidebarData, User };
@@ -0,0 +1,4 @@
1
+ 'use strict';
2
+
3
+ //# sourceMappingURL=index.js.map
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
@@ -0,0 +1,3 @@
1
+
2
+ //# sourceMappingURL=index.mjs.map
3
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"index.mjs"}
@@ -0,0 +1,4 @@
1
+ 'use strict';
2
+
3
+ //# sourceMappingURL=ui-components.d.js.map
4
+ //# sourceMappingURL=ui-components.d.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"ui-components.d.js"}
@@ -0,0 +1,3 @@
1
+
2
+ //# sourceMappingURL=ui-components.d.mjs.map
3
+ //# sourceMappingURL=ui-components.d.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"ui-components.d.mjs"}
@@ -0,0 +1,16 @@
1
+ import { LucideIcon } from 'lucide-react';
2
+
3
+ /**
4
+ * Icon mapper utility
5
+ * Maps icon name strings to Lucide React icon components
6
+ */
7
+
8
+ /**
9
+ * Get icon component from icon name or component
10
+ *
11
+ * @param icon - Icon name (string) or icon component
12
+ * @returns Icon component or undefined
13
+ */
14
+ declare function getIconComponent(icon?: string | LucideIcon): LucideIcon | undefined;
15
+
16
+ export { getIconComponent };
@@ -0,0 +1,16 @@
1
+ import { LucideIcon } from 'lucide-react';
2
+
3
+ /**
4
+ * Icon mapper utility
5
+ * Maps icon name strings to Lucide React icon components
6
+ */
7
+
8
+ /**
9
+ * Get icon component from icon name or component
10
+ *
11
+ * @param icon - Icon name (string) or icon component
12
+ * @returns Icon component or undefined
13
+ */
14
+ declare function getIconComponent(icon?: string | LucideIcon): LucideIcon | undefined;
15
+
16
+ export { getIconComponent };
@@ -0,0 +1,52 @@
1
+ 'use strict';
2
+
3
+ var LucideIcons = require('lucide-react');
4
+
5
+ function _interopNamespace(e) {
6
+ if (e && e.__esModule) return e;
7
+ var n = Object.create(null);
8
+ if (e) {
9
+ Object.keys(e).forEach(function (k) {
10
+ if (k !== 'default') {
11
+ var d = Object.getOwnPropertyDescriptor(e, k);
12
+ Object.defineProperty(n, k, d.get ? d : {
13
+ enumerable: true,
14
+ get: function () { return e[k]; }
15
+ });
16
+ }
17
+ });
18
+ }
19
+ n.default = e;
20
+ return Object.freeze(n);
21
+ }
22
+
23
+ var LucideIcons__namespace = /*#__PURE__*/_interopNamespace(LucideIcons);
24
+
25
+ // src/utils/iconMapper.ts
26
+ var ICON_MAP = {
27
+ Home: LucideIcons__namespace.Home,
28
+ Users: LucideIcons__namespace.Users,
29
+ GalleryVerticalEnd: LucideIcons__namespace.GalleryVerticalEnd,
30
+ Settings: LucideIcons__namespace.Settings,
31
+ CreditCard: LucideIcons__namespace.CreditCard,
32
+ Building2: LucideIcons__namespace.Building2,
33
+ Check: LucideIcons__namespace.Check,
34
+ ChevronsUpDown: LucideIcons__namespace.ChevronsUpDown,
35
+ ChevronRight: LucideIcons__namespace.ChevronRight,
36
+ BadgeCheck: LucideIcons__namespace.BadgeCheck,
37
+ LogOut: LucideIcons__namespace.LogOut
38
+ // Add more icons as needed
39
+ };
40
+ function getIconComponent(icon) {
41
+ if (!icon) {
42
+ return void 0;
43
+ }
44
+ if (typeof icon !== "string") {
45
+ return icon;
46
+ }
47
+ return ICON_MAP[icon];
48
+ }
49
+
50
+ exports.getIconComponent = getIconComponent;
51
+ //# sourceMappingURL=iconMapper.js.map
52
+ //# sourceMappingURL=iconMapper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/utils/iconMapper.ts"],"names":["LucideIcons"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAYA,IAAM,QAAA,GAAuC;AAAA,EAC3C,IAAA,EAAkBA,sBAAA,CAAA,IAAA;AAAA,EAClB,KAAA,EAAmBA,sBAAA,CAAA,KAAA;AAAA,EACnB,kBAAA,EAAgCA,sBAAA,CAAA,kBAAA;AAAA,EAChC,QAAA,EAAsBA,sBAAA,CAAA,QAAA;AAAA,EACtB,UAAA,EAAwBA,sBAAA,CAAA,UAAA;AAAA,EACxB,SAAA,EAAuBA,sBAAA,CAAA,SAAA;AAAA,EACvB,KAAA,EAAmBA,sBAAA,CAAA,KAAA;AAAA,EACnB,cAAA,EAA4BA,sBAAA,CAAA,cAAA;AAAA,EAC5B,YAAA,EAA0BA,sBAAA,CAAA,YAAA;AAAA,EAC1B,UAAA,EAAwBA,sBAAA,CAAA,UAAA;AAAA,EACxB,MAAA,EAAoBA,sBAAA,CAAA;AAAA;AAEtB,CAAA;AAQO,SAAS,iBACd,IAAA,EACwB;AACxB,EAAA,IAAI,CAAC,IAAA,EAAM;AACT,IAAA,OAAO,MAAA;AAAA,EACT;AAGA,EAAA,IAAI,OAAO,SAAS,QAAA,EAAU;AAC5B,IAAA,OAAO,IAAA;AAAA,EACT;AAGA,EAAA,OAAO,SAAS,IAAI,CAAA;AACtB","file":"iconMapper.js","sourcesContent":["/**\n * Icon mapper utility\n * Maps icon name strings to Lucide React icon components\n */\n\nimport * as LucideIcons from \"lucide-react\"\nimport type { LucideIcon } from \"lucide-react\"\n\n/**\n * Map of icon names to Lucide icon components\n * Used to convert icon name strings from API to icon components\n */\nconst ICON_MAP: Record<string, LucideIcon> = {\n Home: LucideIcons.Home,\n Users: LucideIcons.Users,\n GalleryVerticalEnd: LucideIcons.GalleryVerticalEnd,\n Settings: LucideIcons.Settings,\n CreditCard: LucideIcons.CreditCard,\n Building2: LucideIcons.Building2,\n Check: LucideIcons.Check,\n ChevronsUpDown: LucideIcons.ChevronsUpDown,\n ChevronRight: LucideIcons.ChevronRight,\n BadgeCheck: LucideIcons.BadgeCheck,\n LogOut: LucideIcons.LogOut,\n // Add more icons as needed\n}\n\n/**\n * Get icon component from icon name or component\n * \n * @param icon - Icon name (string) or icon component\n * @returns Icon component or undefined\n */\nexport function getIconComponent(\n icon?: string | LucideIcon\n): LucideIcon | undefined {\n if (!icon) {\n return undefined\n }\n\n // If it's already a component, return it\n if (typeof icon !== \"string\") {\n return icon\n }\n\n // Look up icon by name\n return ICON_MAP[icon]\n}\n\n"]}
@@ -0,0 +1,30 @@
1
+ import * as LucideIcons from 'lucide-react';
2
+
3
+ // src/utils/iconMapper.ts
4
+ var ICON_MAP = {
5
+ Home: LucideIcons.Home,
6
+ Users: LucideIcons.Users,
7
+ GalleryVerticalEnd: LucideIcons.GalleryVerticalEnd,
8
+ Settings: LucideIcons.Settings,
9
+ CreditCard: LucideIcons.CreditCard,
10
+ Building2: LucideIcons.Building2,
11
+ Check: LucideIcons.Check,
12
+ ChevronsUpDown: LucideIcons.ChevronsUpDown,
13
+ ChevronRight: LucideIcons.ChevronRight,
14
+ BadgeCheck: LucideIcons.BadgeCheck,
15
+ LogOut: LucideIcons.LogOut
16
+ // Add more icons as needed
17
+ };
18
+ function getIconComponent(icon) {
19
+ if (!icon) {
20
+ return void 0;
21
+ }
22
+ if (typeof icon !== "string") {
23
+ return icon;
24
+ }
25
+ return ICON_MAP[icon];
26
+ }
27
+
28
+ export { getIconComponent };
29
+ //# sourceMappingURL=iconMapper.mjs.map
30
+ //# sourceMappingURL=iconMapper.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/utils/iconMapper.ts"],"names":[],"mappings":";;;AAYA,IAAM,QAAA,GAAuC;AAAA,EAC3C,IAAA,EAAkB,WAAA,CAAA,IAAA;AAAA,EAClB,KAAA,EAAmB,WAAA,CAAA,KAAA;AAAA,EACnB,kBAAA,EAAgC,WAAA,CAAA,kBAAA;AAAA,EAChC,QAAA,EAAsB,WAAA,CAAA,QAAA;AAAA,EACtB,UAAA,EAAwB,WAAA,CAAA,UAAA;AAAA,EACxB,SAAA,EAAuB,WAAA,CAAA,SAAA;AAAA,EACvB,KAAA,EAAmB,WAAA,CAAA,KAAA;AAAA,EACnB,cAAA,EAA4B,WAAA,CAAA,cAAA;AAAA,EAC5B,YAAA,EAA0B,WAAA,CAAA,YAAA;AAAA,EAC1B,UAAA,EAAwB,WAAA,CAAA,UAAA;AAAA,EACxB,MAAA,EAAoB,WAAA,CAAA;AAAA;AAEtB,CAAA;AAQO,SAAS,iBACd,IAAA,EACwB;AACxB,EAAA,IAAI,CAAC,IAAA,EAAM;AACT,IAAA,OAAO,MAAA;AAAA,EACT;AAGA,EAAA,IAAI,OAAO,SAAS,QAAA,EAAU;AAC5B,IAAA,OAAO,IAAA;AAAA,EACT;AAGA,EAAA,OAAO,SAAS,IAAI,CAAA;AACtB","file":"iconMapper.mjs","sourcesContent":["/**\n * Icon mapper utility\n * Maps icon name strings to Lucide React icon components\n */\n\nimport * as LucideIcons from \"lucide-react\"\nimport type { LucideIcon } from \"lucide-react\"\n\n/**\n * Map of icon names to Lucide icon components\n * Used to convert icon name strings from API to icon components\n */\nconst ICON_MAP: Record<string, LucideIcon> = {\n Home: LucideIcons.Home,\n Users: LucideIcons.Users,\n GalleryVerticalEnd: LucideIcons.GalleryVerticalEnd,\n Settings: LucideIcons.Settings,\n CreditCard: LucideIcons.CreditCard,\n Building2: LucideIcons.Building2,\n Check: LucideIcons.Check,\n ChevronsUpDown: LucideIcons.ChevronsUpDown,\n ChevronRight: LucideIcons.ChevronRight,\n BadgeCheck: LucideIcons.BadgeCheck,\n LogOut: LucideIcons.LogOut,\n // Add more icons as needed\n}\n\n/**\n * Get icon component from icon name or component\n * \n * @param icon - Icon name (string) or icon component\n * @returns Icon component or undefined\n */\nexport function getIconComponent(\n icon?: string | LucideIcon\n): LucideIcon | undefined {\n if (!icon) {\n return undefined\n }\n\n // If it's already a component, return it\n if (typeof icon !== \"string\") {\n return icon\n }\n\n // Look up icon by name\n return ICON_MAP[icon]\n}\n\n"]}
package/package.json ADDED
@@ -0,0 +1,76 @@
1
+ {
2
+ "name": "@logickernel/frame",
3
+ "version": "0.1.0",
4
+ "description": "Shared navigation and layout components for microfrontends",
5
+ "keywords": [
6
+ "navigation",
7
+ "sidebar",
8
+ "microfrontend",
9
+ "react",
10
+ "nextjs"
11
+ ],
12
+ "author": "",
13
+ "license": "MIT",
14
+ "private": false,
15
+ "main": "./dist/index.js",
16
+ "module": "./dist/index.mjs",
17
+ "types": "./dist/index.d.ts",
18
+ "exports": {
19
+ ".": {
20
+ "types": "./dist/index.d.ts",
21
+ "import": "./dist/index.mjs",
22
+ "require": "./dist/index.js"
23
+ },
24
+ "./components/*": {
25
+ "types": "./dist/components/*.d.ts",
26
+ "import": "./dist/components/*.mjs",
27
+ "require": "./dist/components/*.js"
28
+ },
29
+ "./hooks/*": {
30
+ "types": "./dist/hooks/*.d.ts",
31
+ "import": "./dist/hooks/*.mjs",
32
+ "require": "./dist/hooks/*.js"
33
+ },
34
+ "./types": {
35
+ "types": "./dist/types/index.d.ts",
36
+ "import": "./dist/types/index.mjs",
37
+ "require": "./dist/types/index.js"
38
+ },
39
+ "./utils/*": {
40
+ "types": "./dist/utils/*.d.ts",
41
+ "import": "./dist/utils/*.mjs",
42
+ "require": "./dist/utils/*.js"
43
+ },
44
+ "./package.json": "./package.json"
45
+ },
46
+ "files": [
47
+ "dist",
48
+ "README.md"
49
+ ],
50
+ "scripts": {
51
+ "build": "tsup",
52
+ "dev": "tsup --watch",
53
+ "type-check": "tsc --noEmit",
54
+ "prepublishOnly": "npm run build"
55
+ },
56
+ "dependencies": {
57
+ "lucide-react": "^0.555.0"
58
+ },
59
+ "peerDependencies": {
60
+ "@radix-ui/react-avatar": "^1.1.11",
61
+ "@radix-ui/react-collapsible": "^1.1.12",
62
+ "@radix-ui/react-dropdown-menu": "^2.1.16",
63
+ "@radix-ui/react-slot": "^1.2.4",
64
+ "@radix-ui/react-tooltip": "^1.2.8",
65
+ "react": "^18.0.0 || ^19.0.0",
66
+ "react-dom": "^18.0.0 || ^19.0.0"
67
+ },
68
+ "devDependencies": {
69
+ "@types/node": "^20.0.0",
70
+ "@types/react": "^18.0.0 || ^19.0.0",
71
+ "@types/react-dom": "^18.0.0 || ^19.0.0",
72
+ "tsup": "^8.0.0",
73
+ "typescript": "^5.0.0"
74
+ }
75
+ }
76
+