@djangocfg/layouts 2.1.281 → 2.1.282

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.281",
3
+ "version": "2.1.282",
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.281",
78
- "@djangocfg/centrifugo": "^2.1.281",
79
- "@djangocfg/debuger": "^2.1.281",
80
- "@djangocfg/i18n": "^2.1.281",
81
- "@djangocfg/monitor": "^2.1.281",
82
- "@djangocfg/ui-core": "^2.1.281",
83
- "@djangocfg/ui-nextjs": "^2.1.281",
84
- "@djangocfg/ui-tools": "^2.1.281",
77
+ "@djangocfg/api": "^2.1.282",
78
+ "@djangocfg/centrifugo": "^2.1.282",
79
+ "@djangocfg/debuger": "^2.1.282",
80
+ "@djangocfg/i18n": "^2.1.282",
81
+ "@djangocfg/monitor": "^2.1.282",
82
+ "@djangocfg/ui-core": "^2.1.282",
83
+ "@djangocfg/ui-nextjs": "^2.1.282",
84
+ "@djangocfg/ui-tools": "^2.1.282",
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.281",
114
- "@djangocfg/centrifugo": "^2.1.281",
115
- "@djangocfg/debuger": "^2.1.281",
116
- "@djangocfg/i18n": "^2.1.281",
117
- "@djangocfg/monitor": "^2.1.281",
118
- "@djangocfg/typescript-config": "^2.1.281",
119
- "@djangocfg/ui-core": "^2.1.281",
120
- "@djangocfg/ui-nextjs": "^2.1.281",
121
- "@djangocfg/ui-tools": "^2.1.281",
113
+ "@djangocfg/api": "^2.1.282",
114
+ "@djangocfg/centrifugo": "^2.1.282",
115
+ "@djangocfg/debuger": "^2.1.282",
116
+ "@djangocfg/i18n": "^2.1.282",
117
+ "@djangocfg/monitor": "^2.1.282",
118
+ "@djangocfg/typescript-config": "^2.1.282",
119
+ "@djangocfg/ui-core": "^2.1.282",
120
+ "@djangocfg/ui-nextjs": "^2.1.282",
121
+ "@djangocfg/ui-tools": "^2.1.282",
122
122
  "@types/node": "^24.7.2",
123
123
  "@types/react": "^19.1.0",
124
124
  "@types/react-dom": "^19.1.0",
@@ -66,9 +66,11 @@ export function NavDesktopItems({
66
66
  gap: 4,
67
67
  });
68
68
 
69
- const effectiveCount = Math.min(visibleCount, maxVisible ?? visibleCount);
69
+ const effectiveCount = measured
70
+ ? Math.min(visibleCount, maxVisible ?? visibleCount)
71
+ : (maxVisible ?? items.length);
70
72
  const primaryItems = items.slice(0, effectiveCount);
71
- const overflowItems = items.slice(effectiveCount);
73
+ const overflowItems = measured ? items.slice(effectiveCount) : [];
72
74
 
73
75
  const renderItem = (item: NavigationItem) => {
74
76
  if (item.items && item.items.length > 0) {
@@ -191,13 +193,8 @@ export function NavDesktopItems({
191
193
  ))}
192
194
  </div>
193
195
 
194
- {/* Live row — only renders items that fit (hidden until first measurement). */}
195
- <div
196
- className={cn(
197
- 'flex min-w-0 items-center gap-1',
198
- !measured && 'invisible',
199
- )}
200
- >
196
+ {/* Live row — renders all items on SSR, overflow splits after measurement. */}
197
+ <div className="flex min-w-0 items-center gap-1">
201
198
  {primaryItems.map(renderItem)}
202
199
 
203
200
  {hasOverflow && (
@@ -13,6 +13,7 @@ import React, { useMemo } from 'react';
13
13
  import { useAuth } from '@djangocfg/api/auth';
14
14
  import { useAppT } from '@djangocfg/i18n';
15
15
  import { Button } from '@djangocfg/ui-core/components';
16
+ import { useBodyScrollLock, useIsTabletOrBelow } from '@djangocfg/ui-core/hooks';
16
17
  import { cn } from '@djangocfg/ui-core/lib';
17
18
 
18
19
  import { usePathnameWithoutLocale } from '../../../hooks';
@@ -57,6 +58,8 @@ export function MobileDrawerShell(props: MobileDrawerShellProps) {
57
58
  isOpen: mobileMenuOpen,
58
59
  onClose: closeMobileMenu,
59
60
  });
61
+ const isTabletOrBelow = useIsTabletOrBelow();
62
+ useBodyScrollLock(mobileMenuOpen && isTabletOrBelow);
60
63
 
61
64
  const labels = useMemo(() => ({
62
65
  menu: t('layouts.navigation.menu'),
@@ -96,7 +99,9 @@ export function MobileDrawerShell(props: MobileDrawerShellProps) {
96
99
  )}
97
100
  <div
98
101
  className={cn(
99
- 'pointer-events-none fixed inset-x-0 z-1000 lg:hidden px-4 pb-3 sm:px-6 sm:pb-3 lg:px-8',
102
+ // Horizontal padding mirrors the navbar outer wrapper so the drawer
103
+ // panel aligns edge-to-edge with the navbar shell.
104
+ 'pointer-events-none fixed inset-x-0 z-1000 lg:hidden px-3 pb-3 sm:px-4 sm:pb-3 lg:px-6',
100
105
  )}
101
106
  style={{
102
107
  top: 'var(--public-navbar-mobile-drawer-top, 5rem)',
@@ -219,7 +219,10 @@ export function NavbarShell(props: NavbarShellProps) {
219
219
 
220
220
  const outerCls = cn(
221
221
  outerClassName,
222
- 'inset-x-0 z-50',
222
+ 'inset-x-0',
223
+ // Stay above the mobile drawer backdrop (z-[998]) and drawer (z-[1000])
224
+ // so the brand + close button remain visible and clickable.
225
+ mobileMenuOpen ? 'z-[1001]' : 'z-50',
223
226
  hideNavOnScroll && 'transition-transform duration-300 ease-in-out will-change-transform',
224
227
  hideNavOnScroll && hidden && !mobileMenuOpen && '-translate-y-full',
225
228
  );
@@ -287,6 +290,7 @@ export function NavbarShell(props: NavbarShellProps) {
287
290
  <div className={cn('flex items-center gap-4', h)}>
288
291
  <div className="min-w-0 shrink-0 flex items-center">{brandNode}</div>
289
292
  <div className="hidden isolate lg:flex min-w-0 flex-1 items-center gap-1">{desktopNavNode}</div>
293
+ <div className="flex-1 lg:hidden" />
290
294
  <div className="flex shrink-0 items-center gap-4">{actionsNode}</div>
291
295
  </div>
292
296
  );
@@ -295,6 +299,7 @@ export function NavbarShell(props: NavbarShellProps) {
295
299
  <div className={cn('flex items-center gap-4', h)}>
296
300
  <div className="shrink-0">{brandNode}</div>
297
301
  <div className="hidden isolate lg:flex min-w-0 flex-1 items-center justify-center gap-1">{desktopNavNode}</div>
302
+ <div className="flex-1 lg:hidden" />
298
303
  <div className="flex shrink-0 items-center">{actionsNode}</div>
299
304
  </div>
300
305
  );
@@ -312,6 +317,7 @@ export function NavbarShell(props: NavbarShellProps) {
312
317
  <div className="hidden isolate lg:flex min-w-0 flex-1 items-center justify-center gap-1">
313
318
  {desktopNavNode}
314
319
  </div>
320
+ <div className="flex-1 lg:hidden" />
315
321
  <div className="flex shrink-0 items-center">{actionsNode}</div>
316
322
  </div>
317
323
  );