@djangocfg/layouts 2.1.292 → 2.1.294

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@djangocfg/layouts",
3
- "version": "2.1.292",
3
+ "version": "2.1.294",
4
4
  "description": "Simple, straightforward layout components for Next.js - import and use with props",
5
5
  "keywords": [
6
6
  "layouts",
@@ -74,14 +74,14 @@
74
74
  "check": "tsc --noEmit"
75
75
  },
76
76
  "peerDependencies": {
77
- "@djangocfg/api": "^2.1.292",
78
- "@djangocfg/centrifugo": "^2.1.292",
79
- "@djangocfg/debuger": "^2.1.292",
80
- "@djangocfg/i18n": "^2.1.292",
81
- "@djangocfg/monitor": "^2.1.292",
82
- "@djangocfg/ui-core": "^2.1.292",
83
- "@djangocfg/ui-nextjs": "^2.1.292",
84
- "@djangocfg/ui-tools": "^2.1.292",
77
+ "@djangocfg/api": "^2.1.294",
78
+ "@djangocfg/centrifugo": "^2.1.294",
79
+ "@djangocfg/debuger": "^2.1.294",
80
+ "@djangocfg/i18n": "^2.1.294",
81
+ "@djangocfg/monitor": "^2.1.294",
82
+ "@djangocfg/ui-core": "^2.1.294",
83
+ "@djangocfg/ui-nextjs": "^2.1.294",
84
+ "@djangocfg/ui-tools": "^2.1.294",
85
85
  "@hookform/resolvers": "^5.2.2",
86
86
  "consola": "^3.4.2",
87
87
  "lucide-react": "^0.545.0",
@@ -110,15 +110,15 @@
110
110
  "uuid": "^11.1.0"
111
111
  },
112
112
  "devDependencies": {
113
- "@djangocfg/api": "^2.1.292",
114
- "@djangocfg/centrifugo": "^2.1.292",
115
- "@djangocfg/debuger": "^2.1.292",
116
- "@djangocfg/i18n": "^2.1.292",
117
- "@djangocfg/monitor": "^2.1.292",
118
- "@djangocfg/typescript-config": "^2.1.292",
119
- "@djangocfg/ui-core": "^2.1.292",
120
- "@djangocfg/ui-nextjs": "^2.1.292",
121
- "@djangocfg/ui-tools": "^2.1.292",
113
+ "@djangocfg/api": "^2.1.294",
114
+ "@djangocfg/centrifugo": "^2.1.294",
115
+ "@djangocfg/debuger": "^2.1.294",
116
+ "@djangocfg/i18n": "^2.1.294",
117
+ "@djangocfg/monitor": "^2.1.294",
118
+ "@djangocfg/typescript-config": "^2.1.294",
119
+ "@djangocfg/ui-core": "^2.1.294",
120
+ "@djangocfg/ui-nextjs": "^2.1.294",
121
+ "@djangocfg/ui-tools": "^2.1.294",
122
122
  "@types/node": "^24.7.2",
123
123
  "@types/react": "^19.1.0",
124
124
  "@types/react-dom": "^19.1.0",
@@ -48,6 +48,7 @@ import { AuthProvider } from '@djangocfg/api/auth';
48
48
  import { CentrifugoProvider } from '@djangocfg/centrifugo';
49
49
  import { Toaster, TooltipProvider } from '@djangocfg/ui-core/components';
50
50
  import { DialogProvider } from '@djangocfg/ui-core/lib/dialog-service';
51
+ import { NextRouterAdapter } from '@djangocfg/ui-core/adapters/nextjs';
51
52
  import { ThemeProvider } from '@djangocfg/ui-nextjs/theme';
52
53
  import { ThemeStyleBridge } from '../../theme/ThemeStyleBridge';
53
54
  import { ErrorBoundary } from '../../components/errors/ErrorBoundary';
@@ -117,6 +118,14 @@ export function BaseApp({
117
118
  storageKey={theme?.storageKey}
118
119
  >
119
120
  <ThemeStyleBridge style={theme?.style} />
121
+ {/*
122
+ * NextRouterAdapter wires @djangocfg/ui-core router hooks
123
+ * (useNavigate, useQueryState, etc.) to next/navigation so
124
+ * server components, route loaders, and prefetch fire
125
+ * correctly. Placed near the top so every provider below
126
+ * (Auth, Centrifugo, anything that may navigate) gets it.
127
+ */}
128
+ <NextRouterAdapter>
120
129
  <DialogProvider>
121
130
  <TooltipProvider>
122
131
  <SWRConfig
@@ -182,6 +191,7 @@ export function BaseApp({
182
191
  </SWRConfig>
183
192
  </TooltipProvider>
184
193
  </DialogProvider>
194
+ </NextRouterAdapter>
185
195
  </ThemeProvider>
186
196
  );
187
197
 
@@ -70,6 +70,7 @@ Three variants. All share the same core props (below); only the chrome differs.
70
70
  | `actionsTrailingSlot` | `ReactNode` | — | Arbitrary node after the mobile toggle. |
71
71
  | `navbarPosition` | `'sticky' \| 'fixed' \| 'static'` | `'sticky'` | |
72
72
  | `navbarHeight` | `'sm' \| 'md' \| 'lg'` | `'md'` | `py-2` / `py-3.5` / `py-5`. |
73
+ | `insetX` | `'none' \| 'xs' \| 'sm' \| 'md' \| 'lg' \| string` | `'sm'` | Horizontal inset of the inner row. Token → responsive `px-*`; pass any Tailwind class to override. |
73
74
  | `navLayout` | `'default' \| 'brand-left' \| 'centered' \| 'split'` | `'default'` | Desktop arrangement. |
74
75
  | `hideNavOnScroll` | `boolean` | `false` | Slide up on scroll-down, back on scroll-up. |
75
76
  | `transparent` | `boolean` | `false` (Minimal: `true`) | Transparent at top, opaque after `transparentThreshold`. |
@@ -20,6 +20,7 @@ export type {
20
20
  PublicNavbarShellConfig,
21
21
  PublicNavLayout,
22
22
  PublicNavbarHeight,
23
+ PublicNavbarInsetX,
23
24
  PublicDesktopDropdownRenderer,
24
25
  PublicDesktopDropdownRenderProps,
25
26
  } from './navbarTypes';
@@ -33,6 +33,21 @@ export type PublicNavLayout = 'default' | 'brand-left' | 'centered' | 'split';
33
33
  */
34
34
  export type PublicNavbarHeight = 'sm' | 'md' | 'lg';
35
35
 
36
+ /**
37
+ * Horizontal inset between the navbar's outer edge and its inner row
38
+ * (brand + nav + actions). Tuned per breakpoint so wide screens get a
39
+ * bit more breathing room than mobile.
40
+ *
41
+ * - `none` → no padding (edge-to-edge, e.g. embedded app shells)
42
+ * - `xs` → `px-2 sm:px-3 lg:px-4`
43
+ * - `sm` → `px-3 sm:px-4 lg:px-6` (default — symmetric, compact)
44
+ * - `md` → `px-4 sm:px-6 lg:px-8`
45
+ * - `lg` → `px-6 sm:px-8 lg:px-12`
46
+ *
47
+ * Pass a string instead to use any Tailwind class (escape hatch).
48
+ */
49
+ export type PublicNavbarInsetX = 'none' | 'xs' | 'sm' | 'md' | 'lg' | (string & {});
50
+
36
51
  export interface PublicNavbarSurface {
37
52
  variant: PublicNavbarVariant;
38
53
  position: PublicNavbarPosition;
@@ -16,6 +16,7 @@ import { NavbarShell } from '../../shared';
16
16
  import type {
17
17
  PublicDesktopDropdownRenderer,
18
18
  PublicNavbarHeight,
19
+ PublicNavbarInsetX,
19
20
  PublicNavbarPosition,
20
21
  PublicNavbarShellConfig,
21
22
  PublicNavLayout,
@@ -39,6 +40,8 @@ export interface FloatingNavbarConfig {
39
40
  navLayout?: PublicNavLayout;
40
41
  /** @default 'md' */
41
42
  navbarHeight?: PublicNavbarHeight;
43
+ /** Horizontal inset of the inner row. @default 'sm' */
44
+ insetX?: PublicNavbarInsetX;
42
45
  /** @default false */
43
46
  hideNavOnScroll?: boolean;
44
47
  /** @default false */
@@ -102,6 +105,7 @@ export function FloatingNavbar({ config }: FloatingNavbarProps) {
102
105
  desktopMaxPrimaryItems={config.desktopMaxPrimaryItems}
103
106
  navLayout={config.navLayout}
104
107
  navbarHeight={config.navbarHeight}
108
+ insetX={config.insetX}
105
109
  hideNavOnScroll={config.hideNavOnScroll}
106
110
  transparent={config.transparent}
107
111
  transparentThreshold={config.transparentThreshold}
@@ -15,6 +15,7 @@ import { NavbarShell } from '../../shared';
15
15
  import type {
16
16
  PublicDesktopDropdownRenderer,
17
17
  PublicNavbarHeight,
18
+ PublicNavbarInsetX,
18
19
  PublicNavbarPosition,
19
20
  PublicNavbarShellConfig,
20
21
  PublicNavLayout,
@@ -38,6 +39,8 @@ export interface FlushNavbarConfig {
38
39
  navLayout?: PublicNavLayout;
39
40
  /** @default 'md' */
40
41
  navbarHeight?: PublicNavbarHeight;
42
+ /** Horizontal inset of the inner row. @default 'sm' */
43
+ insetX?: PublicNavbarInsetX;
41
44
  /** @default false */
42
45
  hideNavOnScroll?: boolean;
43
46
  /** @default false */
@@ -98,6 +101,7 @@ export function FlushNavbar({ config }: FlushNavbarProps) {
98
101
  desktopMaxPrimaryItems={config.desktopMaxPrimaryItems}
99
102
  navLayout={config.navLayout}
100
103
  navbarHeight={config.navbarHeight}
104
+ insetX={config.insetX}
101
105
  hideNavOnScroll={config.hideNavOnScroll}
102
106
  transparent={config.transparent}
103
107
  transparentThreshold={config.transparentThreshold}
@@ -22,6 +22,7 @@ import { NavbarShell, type NavbarActionsContext } from '../../shared';
22
22
  import type {
23
23
  PublicDesktopDropdownRenderer,
24
24
  PublicNavbarHeight,
25
+ PublicNavbarInsetX,
25
26
  PublicNavbarPosition,
26
27
  PublicNavLayout,
27
28
  } from '../../navbarTypes';
@@ -52,6 +53,8 @@ export interface MinimalNavbarConfig {
52
53
  navLayout?: PublicNavLayout;
53
54
  /** @default 'md' */
54
55
  navbarHeight?: PublicNavbarHeight;
56
+ /** Horizontal inset of the inner row. @default 'sm' */
57
+ insetX?: PublicNavbarInsetX;
55
58
  /** @default false */
56
59
  hideNavOnScroll?: boolean;
57
60
  /**
@@ -160,6 +163,7 @@ export function MinimalNavbar({ config }: MinimalNavbarProps) {
160
163
  desktopMaxPrimaryItems={config.desktopMaxPrimaryItems}
161
164
  navLayout={config.navLayout}
162
165
  navbarHeight={config.navbarHeight}
166
+ insetX={config.insetX}
163
167
  hideNavOnScroll={config.hideNavOnScroll}
164
168
  transparent={transparent}
165
169
  transparentThreshold={config.transparentThreshold}
@@ -37,6 +37,7 @@ import {
37
37
  import type {
38
38
  PublicDesktopDropdownRenderer,
39
39
  PublicNavbarHeight,
40
+ PublicNavbarInsetX,
40
41
  PublicNavbarPosition,
41
42
  PublicNavbarVariant,
42
43
  PublicNavLayout,
@@ -57,6 +58,20 @@ const heightCls: Record<PublicNavbarHeight, string> = {
57
58
  lg: 'py-5',
58
59
  };
59
60
 
61
+ /** Token → Tailwind class for the inner-row horizontal padding. */
62
+ const insetXCls: Record<'none' | 'xs' | 'sm' | 'md' | 'lg', string> = {
63
+ none: '',
64
+ xs: 'px-2 sm:px-3 lg:px-4',
65
+ sm: 'px-3 sm:px-4 lg:px-6',
66
+ md: 'px-4 sm:px-6 lg:px-8',
67
+ lg: 'px-6 sm:px-8 lg:px-12',
68
+ };
69
+
70
+ function resolveInsetX(value: PublicNavbarInsetX | undefined): string {
71
+ if (!value) return insetXCls.sm;
72
+ return value in insetXCls ? insetXCls[value as keyof typeof insetXCls] : value;
73
+ }
74
+
60
75
  interface ShapeInputs {
61
76
  /** true at scrollY >= threshold */
62
77
  scrolled: boolean;
@@ -85,7 +100,11 @@ export interface NavbarShellProps {
85
100
  // ── Layout ────────────────────────────────────────────────────────────────
86
101
  navLayout?: PublicNavLayout;
87
102
  navbarHeight?: PublicNavbarHeight;
88
- /** Inner padding for the row container. */
103
+ /** Horizontal inset between outer edge and the inner row.
104
+ * @default 'sm' */
105
+ insetX?: PublicNavbarInsetX;
106
+ /** Full override for the row container (escape hatch).
107
+ * When set, wins over `insetX`. */
89
108
  innerPadding?: string;
90
109
 
91
110
  // ── Scroll behavior ───────────────────────────────────────────────────────
@@ -159,7 +178,8 @@ export function NavbarShell(props: NavbarShellProps) {
159
178
  desktopMaxPrimaryItems: desktopMaxPrimaryItemsProp,
160
179
  navLayout = 'default',
161
180
  navbarHeight = 'md',
162
- innerPadding = 'w-full pl-6 pr-3 sm:px-4 lg:px-6',
181
+ insetX,
182
+ innerPadding,
163
183
  hideNavOnScroll = false,
164
184
  transparent = false,
165
185
  transparentThreshold = 40,
@@ -324,10 +344,12 @@ export function NavbarShell(props: NavbarShellProps) {
324
344
  }
325
345
  })();
326
346
 
347
+ const innerPaddingCls = innerPadding ?? cn('w-full', resolveInsetX(insetX));
348
+
327
349
  return (
328
350
  <div ref={navOuterRef} className={outerCls}>
329
351
  <nav className={cn(shapeClassName, surfaceCls)}>
330
- <div className={innerPadding}>{row}</div>
352
+ <div className={innerPaddingCls}>{row}</div>
331
353
  </nav>
332
354
  </div>
333
355
  );