@djangocfg/ui-nextjs 2.1.255 → 2.1.256

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/ui-nextjs",
3
- "version": "2.1.255",
3
+ "version": "2.1.256",
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.255",
89
- "@djangocfg/i18n": "^2.1.255",
90
- "@djangocfg/nextjs": "^2.1.255",
91
- "@djangocfg/ui-core": "^2.1.255",
92
- "@djangocfg/ui-tools": "^2.1.255",
88
+ "@djangocfg/api": "^2.1.256",
89
+ "@djangocfg/i18n": "^2.1.256",
90
+ "@djangocfg/nextjs": "^2.1.256",
91
+ "@djangocfg/ui-core": "^2.1.256",
92
+ "@djangocfg/ui-tools": "^2.1.256",
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.255",
115
+ "@djangocfg/typescript-config": "^2.1.256",
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",
@@ -1,7 +1,7 @@
1
1
  "use client"
2
2
 
3
3
  import { cva, VariantProps } from 'class-variance-authority';
4
- import { PanelLeft } from 'lucide-react';
4
+ import { Menu, PanelLeft } from 'lucide-react';
5
5
  import { Link } from '../lib/navigation';
6
6
  import * as React from 'react';
7
7
 
@@ -327,10 +327,34 @@ const SidebarTrigger = React.forwardRef<
327
327
  React.ElementRef<typeof Button>,
328
328
  React.ComponentProps<typeof Button>
329
329
  >(({ className, onClick, ...props }, ref) => {
330
- const { toggleSidebar } = useSidebar()
330
+ const { toggleSidebar, openMobile } = useSidebar()
331
331
  const mod = useShortcutModLabel()
332
332
  const isMobile = useIsMobile()
333
- const hint = isMobile ? "Toggle sidebar" : `Toggle sidebar (${mod}+B)`
333
+ const desktopHint = `Toggle sidebar (${mod}+B)`
334
+
335
+ const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => {
336
+ onClick?.(event)
337
+ toggleSidebar()
338
+ }
339
+
340
+ const buttonClass = cn("h-7 w-7", className)
341
+
342
+ if (isMobile) {
343
+ return (
344
+ <Button
345
+ ref={ref}
346
+ data-sidebar="trigger"
347
+ variant="ghost"
348
+ size="icon"
349
+ className={buttonClass}
350
+ onClick={handleClick}
351
+ {...props}
352
+ >
353
+ <Menu className="h-4 w-4" />
354
+ <span className="sr-only">{openMobile ? "Close menu" : "Open menu"}</span>
355
+ </Button>
356
+ )
357
+ }
334
358
 
335
359
  return (
336
360
  <Tooltip delayDuration={400}>
@@ -340,19 +364,16 @@ const SidebarTrigger = React.forwardRef<
340
364
  data-sidebar="trigger"
341
365
  variant="ghost"
342
366
  size="icon"
343
- className={cn("h-7 w-7", className)}
344
- onClick={(event) => {
345
- onClick?.(event)
346
- toggleSidebar()
347
- }}
367
+ className={buttonClass}
368
+ onClick={handleClick}
348
369
  {...props}
349
370
  >
350
- <PanelLeft />
351
- <span className="sr-only">{hint}</span>
371
+ <PanelLeft className="h-4 w-4" />
372
+ <span className="sr-only">{desktopHint}</span>
352
373
  </Button>
353
374
  </TooltipTrigger>
354
375
  <TooltipContent side="bottom" align="center" sideOffset={6} className="max-w-[16rem]">
355
- {hint}
376
+ {desktopHint}
356
377
  </TooltipContent>
357
378
  </Tooltip>
358
379
  )