@djangocfg/ui-nextjs 2.1.252 → 2.1.254
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 +6 -3
- package/package.json +7 -7
- package/src/components/sidebar.tsx +34 -24
package/README.md
CHANGED
|
@@ -26,7 +26,7 @@ Peer dependencies: `next`, `next-intl`, `react`, `tailwindcss`.
|
|
|
26
26
|
|
|
27
27
|
```
|
|
28
28
|
@djangocfg/ui-nextjs
|
|
29
|
-
├── Re-exports everything from @djangocfg/ui-core (
|
|
29
|
+
├── Re-exports everything from @djangocfg/ui-core (components + hooks)
|
|
30
30
|
├── + Next.js locale-aware components (11)
|
|
31
31
|
├── + Navigation hooks (useNavigation, useRouter, usePathname)
|
|
32
32
|
├── + Browser storage hooks (2)
|
|
@@ -49,7 +49,7 @@ All components from `@djangocfg/ui-core` are re-exported.
|
|
|
49
49
|
|-----------|-------------|
|
|
50
50
|
| `NextLink` | Locale-aware link wrapper |
|
|
51
51
|
| `NextButtonLink` | Button-styled locale-aware link with variants |
|
|
52
|
-
| `Sidebar` | Locale-aware
|
|
52
|
+
| `Sidebar` | Locale-aware collapsible sidebar; `SidebarTrigger` shows an OS-aware tooltip (`⌘+B` / `Ctrl+B`); `SidebarMenuButton` accepts `tooltip` for icon-rail hints |
|
|
53
53
|
| `Breadcrumb` | Locale-aware breadcrumbs |
|
|
54
54
|
| `BreadcrumbNavigation` | High-level breadcrumb component |
|
|
55
55
|
| `NavigationMenu` | Locale-aware navigation menu |
|
|
@@ -91,12 +91,15 @@ function MyComponent() {
|
|
|
91
91
|
}
|
|
92
92
|
```
|
|
93
93
|
|
|
94
|
-
### From ui-core (
|
|
94
|
+
### From ui-core (re-exported)
|
|
95
|
+
|
|
96
|
+
All hooks from `@djangocfg/ui-core/hooks` are available. Common examples:
|
|
95
97
|
|
|
96
98
|
| Hook | Description |
|
|
97
99
|
|------|-------------|
|
|
98
100
|
| `useMediaQuery` | Responsive breakpoints |
|
|
99
101
|
| `useIsMobile` | Mobile detection |
|
|
102
|
+
| `useShortcutModLabel` | `⌘` vs `Ctrl` labels for shortcut tooltips |
|
|
100
103
|
| `useCopy` | Copy to clipboard |
|
|
101
104
|
| `useCountdown` | Countdown timer |
|
|
102
105
|
| `useDebounce` | Debounce values |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@djangocfg/ui-nextjs",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.254",
|
|
4
4
|
"description": "Next.js UI component library with Radix UI primitives, Tailwind CSS styling, charts, and form components",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ui-components",
|
|
@@ -85,11 +85,11 @@
|
|
|
85
85
|
"check": "tsc --noEmit"
|
|
86
86
|
},
|
|
87
87
|
"peerDependencies": {
|
|
88
|
-
"@djangocfg/api": "^2.1.
|
|
89
|
-
"@djangocfg/i18n": "^2.1.
|
|
90
|
-
"@djangocfg/nextjs": "^2.1.
|
|
91
|
-
"@djangocfg/ui-core": "^2.1.
|
|
92
|
-
"@djangocfg/ui-tools": "^2.1.
|
|
88
|
+
"@djangocfg/api": "^2.1.254",
|
|
89
|
+
"@djangocfg/i18n": "^2.1.254",
|
|
90
|
+
"@djangocfg/nextjs": "^2.1.254",
|
|
91
|
+
"@djangocfg/ui-core": "^2.1.254",
|
|
92
|
+
"@djangocfg/ui-tools": "^2.1.254",
|
|
93
93
|
"@types/react": "^19.1.0",
|
|
94
94
|
"@types/react-dom": "^19.1.0",
|
|
95
95
|
"consola": "^3.4.2",
|
|
@@ -112,7 +112,7 @@
|
|
|
112
112
|
"react-chartjs-2": "^5.3.0"
|
|
113
113
|
},
|
|
114
114
|
"devDependencies": {
|
|
115
|
-
"@djangocfg/typescript-config": "^2.1.
|
|
115
|
+
"@djangocfg/typescript-config": "^2.1.254",
|
|
116
116
|
"@radix-ui/react-dropdown-menu": "^2.1.16",
|
|
117
117
|
"@radix-ui/react-slot": "^1.2.4",
|
|
118
118
|
"@types/node": "^24.7.2",
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
TooltipProvider,
|
|
21
21
|
TooltipTrigger,
|
|
22
22
|
} from '@djangocfg/ui-core/components';
|
|
23
|
-
import { useIsMobile } from '@djangocfg/ui-core/hooks';
|
|
23
|
+
import { useIsMobile, useShortcutModLabel } from '@djangocfg/ui-core/hooks';
|
|
24
24
|
import { cn } from '@djangocfg/ui-core/lib';
|
|
25
25
|
import { Slot } from '@radix-ui/react-slot';
|
|
26
26
|
|
|
@@ -300,7 +300,7 @@ const Sidebar = React.forwardRef<
|
|
|
300
300
|
"relative flex h-full w-full flex-col overflow-hidden text-sidebar-foreground",
|
|
301
301
|
variant === "floating"
|
|
302
302
|
? "rounded-lg border border-sidebar-border bg-sidebar shadow"
|
|
303
|
-
: "bg-
|
|
303
|
+
: "bg-sidebar",
|
|
304
304
|
)}
|
|
305
305
|
>
|
|
306
306
|
{/* Full-height vertical accent on the seam (gradient runs top → bottom, not along X) */}
|
|
@@ -328,23 +328,33 @@ const SidebarTrigger = React.forwardRef<
|
|
|
328
328
|
React.ComponentProps<typeof Button>
|
|
329
329
|
>(({ className, onClick, ...props }, ref) => {
|
|
330
330
|
const { toggleSidebar } = useSidebar()
|
|
331
|
+
const mod = useShortcutModLabel()
|
|
332
|
+
const isMobile = useIsMobile()
|
|
333
|
+
const hint = isMobile ? "Toggle sidebar" : `Toggle sidebar (${mod}+B)`
|
|
331
334
|
|
|
332
335
|
return (
|
|
333
|
-
<
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
336
|
+
<Tooltip delayDuration={400}>
|
|
337
|
+
<TooltipTrigger asChild>
|
|
338
|
+
<Button
|
|
339
|
+
ref={ref}
|
|
340
|
+
data-sidebar="trigger"
|
|
341
|
+
variant="ghost"
|
|
342
|
+
size="icon"
|
|
343
|
+
className={cn("h-7 w-7", className)}
|
|
344
|
+
onClick={(event) => {
|
|
345
|
+
onClick?.(event)
|
|
346
|
+
toggleSidebar()
|
|
347
|
+
}}
|
|
348
|
+
{...props}
|
|
349
|
+
>
|
|
350
|
+
<PanelLeft />
|
|
351
|
+
<span className="sr-only">{hint}</span>
|
|
352
|
+
</Button>
|
|
353
|
+
</TooltipTrigger>
|
|
354
|
+
<TooltipContent side="bottom" align="center" sideOffset={6} className="max-w-[16rem]">
|
|
355
|
+
{hint}
|
|
356
|
+
</TooltipContent>
|
|
357
|
+
</Tooltip>
|
|
348
358
|
)
|
|
349
359
|
})
|
|
350
360
|
SidebarTrigger.displayName = "SidebarTrigger"
|
|
@@ -523,7 +533,8 @@ const SidebarGroupLabel = React.forwardRef<
|
|
|
523
533
|
data-sidebar="group-label"
|
|
524
534
|
className={cn(
|
|
525
535
|
"flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-semibold text-muted-foreground uppercase tracking-wider outline-none ring-sidebar-ring transition-[margin,opacity] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0",
|
|
526
|
-
|
|
536
|
+
// Collapsed rail: label is visually hidden but was still hit-testing; -mt-8 overlaps the last nav row.
|
|
537
|
+
"group-data-[state=collapsed]:group-data-[collapsible=icon]:pointer-events-none group-data-[state=collapsed]:group-data-[collapsible=icon]:-mt-8 group-data-[state=collapsed]:group-data-[collapsible=icon]:opacity-0",
|
|
527
538
|
className
|
|
528
539
|
)}
|
|
529
540
|
{...props}
|
|
@@ -678,11 +689,8 @@ const SidebarMenuButton = React.forwardRef<
|
|
|
678
689
|
return buttonContent
|
|
679
690
|
}
|
|
680
691
|
|
|
681
|
-
|
|
682
|
-
tooltip
|
|
683
|
-
children: tooltip,
|
|
684
|
-
}
|
|
685
|
-
}
|
|
692
|
+
const tooltipContentProps: React.ComponentProps<typeof TooltipContent> =
|
|
693
|
+
typeof tooltip === "string" ? { children: tooltip } : { ...tooltip }
|
|
686
694
|
|
|
687
695
|
return (
|
|
688
696
|
<Tooltip>
|
|
@@ -690,8 +698,10 @@ const SidebarMenuButton = React.forwardRef<
|
|
|
690
698
|
<TooltipContent
|
|
691
699
|
side="right"
|
|
692
700
|
align="center"
|
|
701
|
+
sideOffset={8}
|
|
702
|
+
avoidCollisions={false}
|
|
693
703
|
hidden={state !== "collapsed" || isMobile}
|
|
694
|
-
{...
|
|
704
|
+
{...tooltipContentProps}
|
|
695
705
|
/>
|
|
696
706
|
</Tooltip>
|
|
697
707
|
)
|