@logickernel/frame 0.5.0 → 0.6.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/dist/index.mjs CHANGED
@@ -43,6 +43,7 @@ var SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7;
43
43
  var SIDEBAR_WIDTH = "16rem";
44
44
  var SIDEBAR_WIDTH_MOBILE = "18rem";
45
45
  var SIDEBAR_WIDTH_ICON = "3rem";
46
+ var SIDEBAR_TRANSITION_DURATION = "200ms";
46
47
  var SIDEBAR_KEYBOARD_SHORTCUT = "b";
47
48
  var SidebarContext = React2.createContext(null);
48
49
  function useSidebar() {
@@ -121,6 +122,7 @@ var SidebarProvider = React2.forwardRef(
121
122
  style: {
122
123
  "--sidebar-width": SIDEBAR_WIDTH,
123
124
  "--sidebar-width-icon": SIDEBAR_WIDTH_ICON,
125
+ "--sidebar-transition-duration": SIDEBAR_TRANSITION_DURATION,
124
126
  ...style
125
127
  },
126
128
  className: cn(
@@ -284,16 +286,29 @@ var SidebarRail = React2.forwardRef(({ className, ...props }, ref) => {
284
286
  );
285
287
  });
286
288
  SidebarRail.displayName = "SidebarRail";
287
- var SidebarInset = React2.forwardRef(({ className, ...props }, ref) => {
289
+ var SidebarInset = React2.forwardRef(({ className, style, ...props }, ref) => {
290
+ const { state, isMobile } = useSidebar();
288
291
  return /* @__PURE__ */ jsx(
289
292
  "main",
290
293
  {
291
294
  ref,
292
295
  className: cn(
293
296
  "relative flex min-h-svh flex-1 flex-col bg-background",
297
+ // Auto-adjust margin based on sidebar state using CSS variables
298
+ // Transition duration uses CSS variable for consistency
299
+ "transition-[margin-left] ease-linear",
300
+ // On mobile, no margin needed (sidebar is overlay)
301
+ // On desktop, margin-left based on sidebar state
302
+ !isMobile && state === "expanded" && "md:ml-[var(--sidebar-width)]",
303
+ !isMobile && state === "collapsed" && "md:ml-[var(--sidebar-width-icon)]",
304
+ // Keep peer-based styles for inset variant
294
305
  "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",
295
306
  className
296
307
  ),
308
+ style: {
309
+ transitionDuration: "var(--sidebar-transition-duration, 200ms)",
310
+ ...style
311
+ },
297
312
  ...props
298
313
  }
299
314
  );
@@ -1216,6 +1231,42 @@ function AppSidebar({
1216
1231
  /* @__PURE__ */ jsx(SidebarRail, {})
1217
1232
  ] });
1218
1233
  }
1234
+ function AppLayout({
1235
+ user,
1236
+ adapter,
1237
+ data,
1238
+ organizationId,
1239
+ apiBaseUrl,
1240
+ useApiNavigation,
1241
+ headerContent,
1242
+ showHeader = true,
1243
+ children
1244
+ }) {
1245
+ const isApiMode = useApiNavigation === true;
1246
+ const navigationApiBaseUrl = apiBaseUrl;
1247
+ return /* @__PURE__ */ jsxs(SidebarProvider, { children: [
1248
+ /* @__PURE__ */ jsx(
1249
+ AppSidebar,
1250
+ {
1251
+ user,
1252
+ adapter,
1253
+ data: isApiMode ? void 0 : data,
1254
+ organizationId,
1255
+ apiBaseUrl: navigationApiBaseUrl
1256
+ }
1257
+ ),
1258
+ /* @__PURE__ */ jsxs(SidebarInset, { children: [
1259
+ showHeader && /* @__PURE__ */ jsxs("header", { className: "flex h-16 shrink-0 items-center gap-2 border-b px-4", children: [
1260
+ /* @__PURE__ */ jsx(SidebarTrigger, {}),
1261
+ headerContent && /* @__PURE__ */ jsxs(Fragment, { children: [
1262
+ /* @__PURE__ */ jsx("div", { className: "h-4 w-px bg-border" }),
1263
+ headerContent
1264
+ ] })
1265
+ ] }),
1266
+ /* @__PURE__ */ jsx("main", { className: "flex flex-1 flex-col gap-4 p-4 md:p-6", children })
1267
+ ] })
1268
+ ] });
1269
+ }
1219
1270
  function createNextJSAdapter() {
1220
1271
  const NextJSLink2 = ({ href, children, className }) => /* @__PURE__ */ jsx(Link, { href, className, children });
1221
1272
  return {
@@ -1232,6 +1283,6 @@ function createNextJSAdapter() {
1232
1283
  };
1233
1284
  }
1234
1285
 
1235
- export { AppSidebar, NavMain, NavUser, SidebarInset, SidebarProvider, SidebarTrigger, TeamSwitcher, createNextJSAdapter, getIconComponent, useNavigation, useSidebar };
1286
+ export { AppLayout, AppSidebar, NavMain, NavUser, SidebarInset, SidebarProvider, SidebarTrigger, TeamSwitcher, createNextJSAdapter, getIconComponent, useNavigation, useSidebar };
1236
1287
  //# sourceMappingURL=index.mjs.map
1237
1288
  //# sourceMappingURL=index.mjs.map