@logickernel/frame 0.6.0 → 0.8.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.
- package/README.md +0 -2
- package/dist/index.d.mts +14 -9
- package/dist/index.d.ts +14 -9
- package/dist/index.js +11 -23
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +11 -23
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -479,9 +479,7 @@ For cross-origin requests, use the full API URL:
|
|
|
479
479
|
```typescript
|
|
480
480
|
<AppSidebar
|
|
481
481
|
user={user}
|
|
482
|
-
organizations={organizations}
|
|
483
482
|
organizationId={orgId}
|
|
484
|
-
useApiNavigation={true}
|
|
485
483
|
apiBaseUrl="https://kernel.example.com/api"
|
|
486
484
|
/>
|
|
487
485
|
```
|
package/dist/index.d.mts
CHANGED
|
@@ -111,12 +111,6 @@ interface AppLayoutProps {
|
|
|
111
111
|
organizationId?: string;
|
|
112
112
|
/** Custom API base URL (API mode only, defaults to "/api" which constructs "/api/navigation/{organizationId}") */
|
|
113
113
|
apiBaseUrl?: string;
|
|
114
|
-
/** Enable API mode - library will fetch navigation from API */
|
|
115
|
-
useApiNavigation?: boolean;
|
|
116
|
-
/** Custom header content (breadcrumbs, actions, etc.) */
|
|
117
|
-
headerContent?: ReactNode;
|
|
118
|
-
/** Show/hide default header (default: true) */
|
|
119
|
-
showHeader?: boolean;
|
|
120
114
|
/** Children to render in the main content area */
|
|
121
115
|
children: ReactNode;
|
|
122
116
|
}
|
|
@@ -168,18 +162,29 @@ declare function AppSidebar({ user, adapter: externalAdapter, data, organization
|
|
|
168
162
|
* This component wraps AppSidebar and SidebarInset in SidebarProvider and provides
|
|
169
163
|
* a default header with sidebar trigger. It handles all layout concerns internally.
|
|
170
164
|
*
|
|
165
|
+
* Navigation mode is determined automatically:
|
|
166
|
+
* - If `data` prop is provided, uses props mode
|
|
167
|
+
* - If `data` is not provided, automatically uses API mode (fetches from API)
|
|
168
|
+
*
|
|
171
169
|
* @example
|
|
172
170
|
* ```tsx
|
|
171
|
+
* // API mode (no data prop)
|
|
172
|
+
* <AppLayout
|
|
173
|
+
* user={user}
|
|
174
|
+
* >
|
|
175
|
+
* {children}
|
|
176
|
+
* </AppLayout>
|
|
177
|
+
*
|
|
178
|
+
* // Props mode (with data prop)
|
|
173
179
|
* <AppLayout
|
|
174
180
|
* user={user}
|
|
175
|
-
*
|
|
176
|
-
* headerContent={<Breadcrumb>...</Breadcrumb>}
|
|
181
|
+
* data={{ organizations: [...], navigationItems: [...] }}
|
|
177
182
|
* >
|
|
178
183
|
* {children}
|
|
179
184
|
* </AppLayout>
|
|
180
185
|
* ```
|
|
181
186
|
*/
|
|
182
|
-
declare function AppLayout({ user, adapter, data, organizationId, apiBaseUrl,
|
|
187
|
+
declare function AppLayout({ user, adapter, data, organizationId, apiBaseUrl, children, }: AppLayoutProps): react_jsx_runtime.JSX.Element;
|
|
183
188
|
|
|
184
189
|
interface NavMainProps {
|
|
185
190
|
items: NavigationItem[];
|
package/dist/index.d.ts
CHANGED
|
@@ -111,12 +111,6 @@ interface AppLayoutProps {
|
|
|
111
111
|
organizationId?: string;
|
|
112
112
|
/** Custom API base URL (API mode only, defaults to "/api" which constructs "/api/navigation/{organizationId}") */
|
|
113
113
|
apiBaseUrl?: string;
|
|
114
|
-
/** Enable API mode - library will fetch navigation from API */
|
|
115
|
-
useApiNavigation?: boolean;
|
|
116
|
-
/** Custom header content (breadcrumbs, actions, etc.) */
|
|
117
|
-
headerContent?: ReactNode;
|
|
118
|
-
/** Show/hide default header (default: true) */
|
|
119
|
-
showHeader?: boolean;
|
|
120
114
|
/** Children to render in the main content area */
|
|
121
115
|
children: ReactNode;
|
|
122
116
|
}
|
|
@@ -168,18 +162,29 @@ declare function AppSidebar({ user, adapter: externalAdapter, data, organization
|
|
|
168
162
|
* This component wraps AppSidebar and SidebarInset in SidebarProvider and provides
|
|
169
163
|
* a default header with sidebar trigger. It handles all layout concerns internally.
|
|
170
164
|
*
|
|
165
|
+
* Navigation mode is determined automatically:
|
|
166
|
+
* - If `data` prop is provided, uses props mode
|
|
167
|
+
* - If `data` is not provided, automatically uses API mode (fetches from API)
|
|
168
|
+
*
|
|
171
169
|
* @example
|
|
172
170
|
* ```tsx
|
|
171
|
+
* // API mode (no data prop)
|
|
172
|
+
* <AppLayout
|
|
173
|
+
* user={user}
|
|
174
|
+
* >
|
|
175
|
+
* {children}
|
|
176
|
+
* </AppLayout>
|
|
177
|
+
*
|
|
178
|
+
* // Props mode (with data prop)
|
|
173
179
|
* <AppLayout
|
|
174
180
|
* user={user}
|
|
175
|
-
*
|
|
176
|
-
* headerContent={<Breadcrumb>...</Breadcrumb>}
|
|
181
|
+
* data={{ organizations: [...], navigationItems: [...] }}
|
|
177
182
|
* >
|
|
178
183
|
* {children}
|
|
179
184
|
* </AppLayout>
|
|
180
185
|
* ```
|
|
181
186
|
*/
|
|
182
|
-
declare function AppLayout({ user, adapter, data, organizationId, apiBaseUrl,
|
|
187
|
+
declare function AppLayout({ user, adapter, data, organizationId, apiBaseUrl, children, }: AppLayoutProps): react_jsx_runtime.JSX.Element;
|
|
183
188
|
|
|
184
189
|
interface NavMainProps {
|
|
185
190
|
items: NavigationItem[];
|
package/dist/index.js
CHANGED
|
@@ -322,21 +322,20 @@ var SidebarInset = React2__namespace.forwardRef(({ className, style, ...props },
|
|
|
322
322
|
ref,
|
|
323
323
|
className: cn(
|
|
324
324
|
"relative flex min-h-svh flex-1 flex-col bg-background",
|
|
325
|
-
// Auto-adjust margin based on sidebar state
|
|
325
|
+
// Auto-adjust margin based on sidebar state
|
|
326
326
|
// Transition duration uses CSS variable for consistency
|
|
327
|
-
"transition-[margin-left] ease-linear",
|
|
327
|
+
"transition-[margin-left] duration-200 ease-linear",
|
|
328
328
|
// On mobile, no margin needed (sidebar is overlay)
|
|
329
|
-
// On desktop, margin-left based on sidebar state
|
|
330
|
-
|
|
331
|
-
|
|
329
|
+
// On desktop, margin-left based on sidebar state:
|
|
330
|
+
// - Expanded: ml-64 (256px / 16rem)
|
|
331
|
+
// - Collapsed: ml-12 (48px / 3rem)
|
|
332
|
+
!isMobile && state === "expanded" && "md:ml-64",
|
|
333
|
+
!isMobile && state === "collapsed" && "md:ml-12",
|
|
332
334
|
// Keep peer-based styles for inset variant
|
|
333
335
|
"peer-data-[variant=inset]:min-h-[calc(100svh-theme(spacing.4))] md:peer-data-[variant=inset]:m-2 md:peer-data-[state=collapsed]:peer-data-[variant=inset]:ml-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow",
|
|
334
336
|
className
|
|
335
337
|
),
|
|
336
|
-
style
|
|
337
|
-
transitionDuration: "var(--sidebar-transition-duration, 200ms)",
|
|
338
|
-
...style
|
|
339
|
-
},
|
|
338
|
+
style,
|
|
340
339
|
...props
|
|
341
340
|
}
|
|
342
341
|
);
|
|
@@ -1265,32 +1264,21 @@ function AppLayout({
|
|
|
1265
1264
|
data,
|
|
1266
1265
|
organizationId,
|
|
1267
1266
|
apiBaseUrl,
|
|
1268
|
-
useApiNavigation,
|
|
1269
|
-
headerContent,
|
|
1270
|
-
showHeader = true,
|
|
1271
1267
|
children
|
|
1272
1268
|
}) {
|
|
1273
|
-
const isApiMode = useApiNavigation === true;
|
|
1274
|
-
const navigationApiBaseUrl = apiBaseUrl;
|
|
1275
1269
|
return /* @__PURE__ */ jsxRuntime.jsxs(SidebarProvider, { children: [
|
|
1276
1270
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1277
1271
|
AppSidebar,
|
|
1278
1272
|
{
|
|
1279
1273
|
user,
|
|
1280
1274
|
adapter,
|
|
1281
|
-
data
|
|
1275
|
+
data,
|
|
1282
1276
|
organizationId,
|
|
1283
|
-
apiBaseUrl
|
|
1277
|
+
apiBaseUrl
|
|
1284
1278
|
}
|
|
1285
1279
|
),
|
|
1286
1280
|
/* @__PURE__ */ jsxRuntime.jsxs(SidebarInset, { children: [
|
|
1287
|
-
|
|
1288
|
-
/* @__PURE__ */ jsxRuntime.jsx(SidebarTrigger, {}),
|
|
1289
|
-
headerContent && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1290
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-4 w-px bg-border" }),
|
|
1291
|
-
headerContent
|
|
1292
|
-
] })
|
|
1293
|
-
] }),
|
|
1281
|
+
/* @__PURE__ */ jsxRuntime.jsx(SidebarTrigger, {}),
|
|
1294
1282
|
/* @__PURE__ */ jsxRuntime.jsx("main", { className: "flex flex-1 flex-col gap-4 p-4 md:p-6", children })
|
|
1295
1283
|
] })
|
|
1296
1284
|
] });
|