sonance-brand-mcp 1.2.5 → 1.3.1

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.
Files changed (90) hide show
  1. package/dist/assets/components/alert-dialog.stories.tsx +142 -0
  2. package/dist/assets/components/alert-dialog.tsx +142 -0
  3. package/dist/assets/components/aspect-ratio.stories.tsx +67 -0
  4. package/dist/assets/components/aspect-ratio.tsx +8 -0
  5. package/dist/assets/components/avatar.tsx +64 -20
  6. package/dist/assets/components/carousel.stories.tsx +158 -0
  7. package/dist/assets/components/carousel.tsx +262 -0
  8. package/dist/assets/components/chart.stories.tsx +376 -0
  9. package/dist/assets/components/chart.tsx +384 -0
  10. package/dist/assets/components/checkbox.tsx +12 -2
  11. package/dist/assets/components/code.tsx +22 -20
  12. package/dist/assets/components/collapsible.stories.tsx +128 -0
  13. package/dist/assets/components/collapsible.tsx +10 -0
  14. package/dist/assets/components/command.stories.tsx +183 -0
  15. package/dist/assets/components/command.tsx +170 -0
  16. package/dist/assets/components/context-menu.stories.tsx +159 -0
  17. package/dist/assets/components/context-menu.tsx +218 -0
  18. package/dist/assets/components/divider.tsx +38 -35
  19. package/dist/assets/components/dropdown-menu.tsx +217 -0
  20. package/dist/assets/components/hover-card.stories.tsx +113 -0
  21. package/dist/assets/components/hover-card.tsx +35 -0
  22. package/dist/assets/components/kbd.tsx +6 -6
  23. package/dist/assets/components/menubar.stories.tsx +208 -0
  24. package/dist/assets/components/menubar.tsx +251 -0
  25. package/dist/assets/components/navigation-menu.stories.tsx +237 -0
  26. package/dist/assets/components/navigation-menu.tsx +135 -0
  27. package/dist/assets/components/resizable.stories.tsx +197 -0
  28. package/dist/assets/components/resizable.tsx +47 -0
  29. package/dist/assets/components/scroll-area.stories.tsx +123 -0
  30. package/dist/assets/components/scroll-area.tsx +48 -0
  31. package/dist/assets/components/scroll-shadow.tsx +29 -7
  32. package/dist/assets/components/separator.tsx +32 -0
  33. package/dist/assets/components/sheet.tsx +141 -0
  34. package/dist/assets/components/sidebar.stories.tsx +351 -0
  35. package/dist/assets/components/sidebar.tsx +760 -0
  36. package/dist/assets/components/toggle-group.stories.tsx +153 -0
  37. package/dist/assets/components/toggle-group.tsx +61 -0
  38. package/dist/assets/components/toggle.stories.tsx +77 -0
  39. package/dist/assets/components/toggle.tsx +46 -0
  40. package/dist/assets/components/tooltip.tsx +23 -90
  41. package/dist/assets/globals.css +30 -0
  42. package/dist/assets/logos/40th-anniversary/Sonance_40_Logo_CMYK_BEAM_BLUE_40_AND_BEAM_DARK.png +0 -0
  43. package/dist/assets/logos/Sonance logo dark mode.png +0 -0
  44. package/dist/assets/logos/Sonance logo light mode.png +0 -0
  45. package/dist/assets/logos/blaze/BlazeBySonance_Logo_Lockup_2C_Light_RGB_05162025.png +0 -0
  46. package/dist/assets/logos/blaze/BlazeBySonance_Logo_Lockup_3C_Dark_RGB_05162025.png +0 -0
  47. package/dist/assets/logos/blaze/BlazeBySonance_Logo_Lockup_White_RGB_05162025.png +0 -0
  48. package/dist/assets/logos/iport/IPORT_Sonance_LockUp_2C_Dark_RGB.png +0 -0
  49. package/dist/assets/logos/iport/IPORT_Sonance_LockUp_2C_Light_RGB.png +0 -0
  50. package/dist/assets/logos/james/James_Logo_Black_CMYK.png +0 -0
  51. package/dist/assets/logos/james/James_Logo_Black_RGB.png +0 -0
  52. package/dist/assets/logos/james/James_Logo_LtGray_CMYK.png +0 -0
  53. package/dist/assets/logos/james/James_Logo_LtGray_RGB.png +0 -0
  54. package/dist/assets/logos/james/James_Logo_Polished_RGB.png +0 -0
  55. package/dist/assets/logos/james/James_Logo_Reverse_CMYK.png +0 -0
  56. package/dist/assets/logos/james/James_Logo_Reverse_RGB.png +0 -0
  57. package/dist/assets/logos/james/James_Logo_White_CMYK.png +0 -0
  58. package/dist/assets/logos/life-is-better/Sonance_LifeisBetter_Dark_RGB.png +0 -0
  59. package/dist/assets/logos/life-is-better/Sonance_LifeisBetter_Light_RGB.png +0 -0
  60. package/dist/assets/logos/my-sonance/My.Sonance_Logo_2C_Dark_RGB.png +0 -0
  61. package/dist/assets/logos/my-sonance/My.Sonance_Logo_2C_Light_RGB.png +0 -0
  62. package/dist/assets/logos/my-sonance/My.Sonance_Logo_2C_Reverse_RGB.png +0 -0
  63. package/dist/assets/logos/my-sonance/My.Sonance_Logo_Black_RGB.png +0 -0
  64. package/dist/assets/logos/my-sonance/My.Sonance_Logo_Reverse_RGB.png +0 -0
  65. package/dist/assets/logos/sonance/Sonance_Logo_2C_Dark_RGB.png +0 -0
  66. package/dist/assets/logos/sonance/Sonance_Logo_2C_Light_RGB.png +0 -0
  67. package/dist/assets/logos/sonance/Sonance_Logo_2C_Reverse_RGB.png +0 -0
  68. package/dist/assets/logos/sonance/Sonance_Logo_Black_RGB.png +0 -0
  69. package/dist/assets/logos/sonance/Sonance_Logo_Grayscale_RGB.png +0 -0
  70. package/dist/assets/logos/sonance/Sonance_Logo_Reverse_RGB.png +0 -0
  71. package/dist/assets/logos/sonance-academy/SonanceAcademy_Logo_Dark_CMYK.png +0 -0
  72. package/dist/assets/logos/sonance-academy/SonanceAcademy_Logo_Light_CMYK.png +0 -0
  73. package/dist/assets/logos/sonance-iport/Sonance_IPORT_LockUp_3C_Dark_RGB.png +0 -0
  74. package/dist/assets/logos/sonance-iport/Sonance_IPORT_LockUp_3C_Light_RGB.png +0 -0
  75. package/dist/assets/logos/sonance-iport/Sonance_IPORT_LockUp_3C_Reverse_RGB.png +0 -0
  76. package/dist/assets/logos/sonance-iport/Sonance_IPORT_LockUp_Black_RGB.png +0 -0
  77. package/dist/assets/logos/sonance-iport/Sonance_IPORT_LockUp_Grayscale_RGB.png +0 -0
  78. package/dist/assets/logos/sonance-iport/Sonance_IPORT_LockUp_Reverse_RGB.png +0 -0
  79. package/dist/assets/logos/sonance-james/Sonance_James_Lockup_Dark.png +0 -0
  80. package/dist/assets/logos/sonance-james/Sonance_James_Lockup_Light.png +0 -0
  81. package/dist/assets/logos/sonance-james-iport/Sonance_James_IPORT_LockupStacked_Dark.png +0 -0
  82. package/dist/assets/logos/sonance-james-iport/Sonance_James_IPORT_LockupStacked_Light.png +0 -0
  83. package/dist/assets/logos/sonance-james-iport/Sonance_James_IPORT_Lockup_Dark.png +0 -0
  84. package/dist/assets/logos/sonance-james-iport/Sonance_James_IPORT_Lockup_Light.png +0 -0
  85. package/dist/assets/logos/trufig/TrufigLogo_Black.png +0 -0
  86. package/dist/assets/logos/trufig/TrufigLogo_Light.png +0 -0
  87. package/dist/assets/logos/trufig/TrufigWatermark_Black.png +0 -0
  88. package/dist/assets/logos/trufig/TrufigWatermark_Light.png +0 -0
  89. package/dist/index.js +278 -7
  90. package/package.json +1 -1
@@ -0,0 +1,760 @@
1
+ "use client"
2
+
3
+ import * as React from "react"
4
+ import { Slot } from "@radix-ui/react-slot"
5
+ import { VariantProps, cva } from "class-variance-authority"
6
+ import { PanelLeft } from "lucide-react"
7
+
8
+ import { useIsMobile } from "@/hooks/use-mobile"
9
+ import { cn } from "@/lib/utils"
10
+ import { Button } from "@/components/ui/button"
11
+ import { Input } from "@/components/ui/input"
12
+ import { Separator } from "@/components/ui/separator"
13
+ import { Sheet, SheetContent } from "@/components/ui/sheet"
14
+ import { Skeleton } from "@/components/ui/skeleton"
15
+ import {
16
+ Tooltip,
17
+ TooltipContent,
18
+ TooltipProvider,
19
+ TooltipTrigger,
20
+ } from "@/components/ui/tooltip"
21
+
22
+ const SIDEBAR_COOKIE_NAME = "sidebar:state"
23
+ const SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7
24
+ const SIDEBAR_WIDTH = "16rem"
25
+ const SIDEBAR_WIDTH_MOBILE = "18rem"
26
+ const SIDEBAR_WIDTH_ICON = "3rem"
27
+ const SIDEBAR_KEYBOARD_SHORTCUT = "b"
28
+
29
+ type SidebarContext = {
30
+ state: "expanded" | "collapsed"
31
+ open: boolean
32
+ setOpen: (open: boolean) => void
33
+ openMobile: boolean
34
+ setOpenMobile: (open: boolean) => void
35
+ isMobile: boolean
36
+ toggleSidebar: () => void
37
+ }
38
+
39
+ const SidebarContext = React.createContext<SidebarContext | null>(null)
40
+
41
+ function useSidebar() {
42
+ const context = React.useContext(SidebarContext)
43
+ if (!context) {
44
+ throw new Error("useSidebar must be used within a SidebarProvider.")
45
+ }
46
+ return context
47
+ }
48
+
49
+ const SidebarProvider = React.forwardRef<
50
+ HTMLDivElement,
51
+ React.ComponentProps<"div"> & {
52
+ defaultOpen?: boolean
53
+ open?: boolean
54
+ onOpenChange?: (open: boolean) => void
55
+ }
56
+ >(
57
+ (
58
+ {
59
+ defaultOpen = true,
60
+ open: openProp,
61
+ onOpenChange: setOpenProp,
62
+ className,
63
+ style,
64
+ children,
65
+ ...props
66
+ },
67
+ ref
68
+ ) => {
69
+ const isMobile = useIsMobile()
70
+ const [openMobile, setOpenMobile] = React.useState(false)
71
+
72
+ // This is the internal state of the sidebar.
73
+ // We use openProp and setOpenProp for control from outside the component.
74
+ const [_open, _setOpen] = React.useState(defaultOpen)
75
+ const open = openProp ?? _open
76
+ const setOpen = React.useCallback(
77
+ (value: boolean | ((value: boolean) => boolean)) => {
78
+ const openState = typeof value === "function" ? value(open) : value
79
+ if (setOpenProp) {
80
+ setOpenProp(openState)
81
+ } else {
82
+ _setOpen(openState)
83
+ }
84
+
85
+ // This sets the cookie to keep the sidebar state.
86
+ document.cookie = `${SIDEBAR_COOKIE_NAME}=${openState}; path=/; max-age=${SIDEBAR_COOKIE_MAX_AGE}`
87
+ },
88
+ [setOpenProp, open]
89
+ )
90
+
91
+ // Helper to toggle the sidebar.
92
+ const toggleSidebar = React.useCallback(() => {
93
+ return isMobile
94
+ ? setOpenMobile((open) => !open)
95
+ : setOpen((open) => !open)
96
+ }, [isMobile, setOpen, setOpenMobile])
97
+
98
+ // Adds a keyboard shortcut to toggle the sidebar.
99
+ React.useEffect(() => {
100
+ const handleKeyDown = (event: KeyboardEvent) => {
101
+ if (
102
+ event.key === SIDEBAR_KEYBOARD_SHORTCUT &&
103
+ (event.metaKey || event.ctrlKey)
104
+ ) {
105
+ event.preventDefault()
106
+ toggleSidebar()
107
+ }
108
+ }
109
+
110
+ window.addEventListener("keydown", handleKeyDown)
111
+ return () => window.removeEventListener("keydown", handleKeyDown)
112
+ }, [toggleSidebar])
113
+
114
+ const state = open ? "expanded" : "collapsed"
115
+
116
+ const contextValue = React.useMemo<SidebarContext>(
117
+ () => ({
118
+ state,
119
+ open,
120
+ setOpen,
121
+ isMobile,
122
+ openMobile,
123
+ setOpenMobile,
124
+ toggleSidebar,
125
+ }),
126
+ [state, open, setOpen, isMobile, openMobile, setOpenMobile, toggleSidebar]
127
+ )
128
+
129
+ return (
130
+ <SidebarContext.Provider value={contextValue}>
131
+ <TooltipProvider delayDuration={0}>
132
+ <div
133
+ style={
134
+ {
135
+ "--sidebar-width": SIDEBAR_WIDTH,
136
+ "--sidebar-width-icon": SIDEBAR_WIDTH_ICON,
137
+ ...style,
138
+ } as React.CSSProperties
139
+ }
140
+ className={cn(
141
+ "group/sidebar-wrapper flex min-h-svh w-full has-[[data-variant=inset]]:bg-sidebar-background",
142
+ className
143
+ )}
144
+ ref={ref}
145
+ {...props}
146
+ >
147
+ {children}
148
+ </div>
149
+ </TooltipProvider>
150
+ </SidebarContext.Provider>
151
+ )
152
+ }
153
+ )
154
+ SidebarProvider.displayName = "SidebarProvider"
155
+
156
+ const Sidebar = React.forwardRef<
157
+ HTMLDivElement,
158
+ React.ComponentProps<"div"> & {
159
+ side?: "left" | "right"
160
+ variant?: "sidebar" | "floating" | "inset"
161
+ collapsible?: "offcanvas" | "icon" | "none"
162
+ }
163
+ >(
164
+ (
165
+ {
166
+ side = "left",
167
+ variant = "sidebar",
168
+ collapsible = "offcanvas",
169
+ className,
170
+ children,
171
+ ...props
172
+ },
173
+ ref
174
+ ) => {
175
+ const { isMobile, state, openMobile, setOpenMobile } = useSidebar()
176
+
177
+ if (collapsible === "none") {
178
+ return (
179
+ <div
180
+ className={cn(
181
+ "flex h-full w-[--sidebar-width] flex-col bg-sidebar-background text-sidebar-foreground",
182
+ className
183
+ )}
184
+ ref={ref}
185
+ {...props}
186
+ >
187
+ {children}
188
+ </div>
189
+ )
190
+ }
191
+
192
+ if (isMobile) {
193
+ return (
194
+ <Sheet open={openMobile} onOpenChange={setOpenMobile} {...props}>
195
+ <SheetContent
196
+ data-sidebar="sidebar"
197
+ data-mobile="true"
198
+ className="w-[--sidebar-width] bg-sidebar-background p-0 text-sidebar-foreground [&>button]:hidden"
199
+ style={
200
+ {
201
+ "--sidebar-width": SIDEBAR_WIDTH_MOBILE,
202
+ } as React.CSSProperties
203
+ }
204
+ side={side}
205
+ >
206
+ <div className="flex h-full w-full flex-col">{children}</div>
207
+ </SheetContent>
208
+ </Sheet>
209
+ )
210
+ }
211
+
212
+ return (
213
+ <div
214
+ ref={ref}
215
+ className="group peer hidden md:block text-sidebar-foreground"
216
+ data-state={state}
217
+ data-collapsible={state === "collapsed" ? collapsible : ""}
218
+ data-variant={variant}
219
+ data-side={side}
220
+ >
221
+ {/* This is what handles the sidebar gap on desktop */}
222
+ <div
223
+ className={cn(
224
+ "duration-200 relative h-full w-[--sidebar-width] bg-transparent transition-[width] ease-linear",
225
+ "group-data-[collapsible=offcanvas]:w-0",
226
+ "group-data-[side=right]:rotate-180",
227
+ variant === "floating" || variant === "inset"
228
+ ? "group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4))]"
229
+ : "group-data-[collapsible=icon]:w-[--sidebar-width-icon]"
230
+ )}
231
+ />
232
+ <div
233
+ className={cn(
234
+ "duration-200 fixed inset-y-0 z-10 hidden h-full w-[--sidebar-width] transition-[left,right,width] ease-linear md:flex",
235
+ side === "left"
236
+ ? "left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]"
237
+ : "right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]",
238
+ // Adjust the padding for floating and inset variants.
239
+ variant === "floating" || variant === "inset"
240
+ ? "p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4)_+2px)]"
241
+ : "group-data-[collapsible=icon]:w-[--sidebar-width-icon] group-data-[side=left]:border-r group-data-[side=right]:border-l bg-sidebar-background",
242
+ className
243
+ )}
244
+ {...props}
245
+ >
246
+ <div
247
+ data-sidebar="sidebar"
248
+ className="flex h-full w-full flex-col bg-sidebar-background group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:border-sidebar-border group-data-[variant=floating]:shadow"
249
+ >
250
+ {children}
251
+ </div>
252
+ </div>
253
+ </div>
254
+ )
255
+ }
256
+ )
257
+ Sidebar.displayName = "Sidebar"
258
+
259
+ const SidebarTrigger = React.forwardRef<
260
+ React.ElementRef<typeof Button>,
261
+ React.ComponentProps<typeof Button>
262
+ >(({ className, onClick, ...props }, ref) => {
263
+ const { toggleSidebar } = useSidebar()
264
+
265
+ return (
266
+ <Button
267
+ ref={ref}
268
+ data-sidebar="trigger"
269
+ variant="ghost"
270
+ size="icon"
271
+ className={cn("h-7 w-7", className)}
272
+ onClick={(event) => {
273
+ onClick?.(event)
274
+ toggleSidebar()
275
+ }}
276
+ {...props}
277
+ >
278
+ <PanelLeft />
279
+ <span className="sr-only">Toggle Sidebar</span>
280
+ </Button>
281
+ )
282
+ })
283
+ SidebarTrigger.displayName = "SidebarTrigger"
284
+
285
+ const SidebarRail = React.forwardRef<
286
+ HTMLButtonElement,
287
+ React.ComponentProps<"button">
288
+ >(({ className, ...props }, ref) => {
289
+ const { toggleSidebar } = useSidebar()
290
+
291
+ return (
292
+ <button
293
+ ref={ref}
294
+ data-sidebar="rail"
295
+ aria-label="Toggle Sidebar"
296
+ tabIndex={-1}
297
+ onClick={toggleSidebar}
298
+ title="Toggle Sidebar"
299
+ className={cn(
300
+ "absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] hover:after:bg-sidebar-border group-data-[side=left]:-right-4 group-data-[side=right]:left-0 sm:flex",
301
+ "[[data-side=left]_&]:cursor-w-resize [[data-side=right]_&]:cursor-e-resize",
302
+ "[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize",
303
+ "group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full group-data-[collapsible=offcanvas]:hover:bg-sidebar-background",
304
+ "[[data-side=left][data-collapsible=offcanvas]_&]:-right-2",
305
+ "[[data-side=right][data-collapsible=offcanvas]_&]:-left-2",
306
+ className
307
+ )}
308
+ {...props}
309
+ />
310
+ )
311
+ })
312
+ SidebarRail.displayName = "SidebarRail"
313
+
314
+ const SidebarInset = React.forwardRef<
315
+ HTMLDivElement,
316
+ React.ComponentProps<"main">
317
+ >(({ className, ...props }, ref) => {
318
+ return (
319
+ <main
320
+ ref={ref}
321
+ className={cn(
322
+ "relative flex min-h-svh flex-1 flex-col bg-background",
323
+ "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",
324
+ className
325
+ )}
326
+ {...props}
327
+ />
328
+ )
329
+ })
330
+ SidebarInset.displayName = "SidebarInset"
331
+
332
+ const SidebarInput = React.forwardRef<
333
+ React.ElementRef<typeof Input>,
334
+ React.ComponentProps<typeof Input>
335
+ >(({ className, ...props }, ref) => {
336
+ return (
337
+ <Input
338
+ ref={ref}
339
+ data-sidebar="input"
340
+ className={cn(
341
+ "h-8 w-full bg-background shadow-none focus-visible:ring-2 focus-visible:ring-sidebar-ring",
342
+ className
343
+ )}
344
+ {...props}
345
+ />
346
+ )
347
+ })
348
+ SidebarInput.displayName = "SidebarInput"
349
+
350
+ const SidebarHeader = React.forwardRef<
351
+ HTMLDivElement,
352
+ React.ComponentProps<"div">
353
+ >(({ className, ...props }, ref) => {
354
+ return (
355
+ <div
356
+ ref={ref}
357
+ data-sidebar="header"
358
+ className={cn("flex flex-col gap-2 p-2", className)}
359
+ {...props}
360
+ />
361
+ )
362
+ })
363
+ SidebarHeader.displayName = "SidebarHeader"
364
+
365
+ const SidebarFooter = React.forwardRef<
366
+ HTMLDivElement,
367
+ React.ComponentProps<"div">
368
+ >(({ className, ...props }, ref) => {
369
+ return (
370
+ <div
371
+ ref={ref}
372
+ data-sidebar="footer"
373
+ className={cn("flex flex-col gap-2 p-2", className)}
374
+ {...props}
375
+ />
376
+ )
377
+ })
378
+ SidebarFooter.displayName = "SidebarFooter"
379
+
380
+ const SidebarSeparator = React.forwardRef<
381
+ React.ElementRef<typeof Separator>,
382
+ React.ComponentProps<typeof Separator>
383
+ >(({ className, ...props }, ref) => {
384
+ return (
385
+ <Separator
386
+ ref={ref}
387
+ data-sidebar="separator"
388
+ className={cn("mx-2 w-auto bg-sidebar-border", className)}
389
+ {...props}
390
+ />
391
+ )
392
+ })
393
+ SidebarSeparator.displayName = "SidebarSeparator"
394
+
395
+ const SidebarContent = React.forwardRef<
396
+ HTMLDivElement,
397
+ React.ComponentProps<"div">
398
+ >(({ className, ...props }, ref) => {
399
+ return (
400
+ <div
401
+ ref={ref}
402
+ data-sidebar="content"
403
+ className={cn(
404
+ "flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden group-data-[collapsible=icon]:gap-0",
405
+ className
406
+ )}
407
+ {...props}
408
+ />
409
+ )
410
+ })
411
+ SidebarContent.displayName = "SidebarContent"
412
+
413
+ const SidebarGroup = React.forwardRef<
414
+ HTMLDivElement,
415
+ React.ComponentProps<"div">
416
+ >(({ className, ...props }, ref) => {
417
+ return (
418
+ <div
419
+ ref={ref}
420
+ data-sidebar="group"
421
+ className={cn("relative flex w-full min-w-0 flex-col p-2 group-data-[collapsible=icon]:py-0", className)}
422
+ {...props}
423
+ />
424
+ )
425
+ })
426
+ SidebarGroup.displayName = "SidebarGroup"
427
+
428
+ const SidebarGroupLabel = React.forwardRef<
429
+ HTMLDivElement,
430
+ React.ComponentProps<"div"> & { asChild?: boolean }
431
+ >(({ className, asChild = false, ...props }, ref) => {
432
+ const Comp = asChild ? Slot : "div"
433
+
434
+ return (
435
+ <Comp
436
+ ref={ref}
437
+ data-sidebar="group-label"
438
+ className={cn(
439
+ "duration-200 flex h-8 shrink-0 items-center rounded-sm px-2 text-xs font-medium text-sidebar-foreground/70 outline-none ring-sidebar-ring transition-[margin,opa] ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0",
440
+ "group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0",
441
+ className
442
+ )}
443
+ {...props}
444
+ />
445
+ )
446
+ })
447
+ SidebarGroupLabel.displayName = "SidebarGroupLabel"
448
+
449
+ const SidebarGroupAction = React.forwardRef<
450
+ HTMLButtonElement,
451
+ React.ComponentProps<"button"> & { asChild?: boolean }
452
+ >(({ className, asChild = false, ...props }, ref) => {
453
+ const Comp = asChild ? Slot : "button"
454
+
455
+ return (
456
+ <Comp
457
+ ref={ref}
458
+ data-sidebar="group-action"
459
+ className={cn(
460
+ "absolute right-3 top-3.5 flex aspect-square w-5 items-center justify-center rounded-sm p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0",
461
+ // Increases the hit area of the button on mobile.
462
+ "after:absolute after:-inset-2 after:md:hidden",
463
+ "group-data-[collapsible=icon]:hidden",
464
+ className
465
+ )}
466
+ {...props}
467
+ />
468
+ )
469
+ })
470
+ SidebarGroupAction.displayName = "SidebarGroupAction"
471
+
472
+ const SidebarGroupContent = React.forwardRef<
473
+ HTMLDivElement,
474
+ React.ComponentProps<"div">
475
+ >(({ className, ...props }, ref) => (
476
+ <div
477
+ ref={ref}
478
+ data-sidebar="group-content"
479
+ className={cn("w-full text-sm", className)}
480
+ {...props}
481
+ />
482
+ ))
483
+ SidebarGroupContent.displayName = "SidebarGroupContent"
484
+
485
+ const SidebarMenu = React.forwardRef<
486
+ HTMLUListElement,
487
+ React.ComponentProps<"ul">
488
+ >(({ className, ...props }, ref) => (
489
+ <ul
490
+ ref={ref}
491
+ data-sidebar="menu"
492
+ className={cn("flex w-full min-w-0 flex-col gap-1", className)}
493
+ {...props}
494
+ />
495
+ ))
496
+ SidebarMenu.displayName = "SidebarMenu"
497
+
498
+ const SidebarMenuItem = React.forwardRef<
499
+ HTMLLIElement,
500
+ React.ComponentProps<"li">
501
+ >(({ className, ...props }, ref) => (
502
+ <li
503
+ ref={ref}
504
+ data-sidebar="menu-item"
505
+ className={cn("group/menu-item relative", className)}
506
+ {...props}
507
+ />
508
+ ))
509
+ SidebarMenuItem.displayName = "SidebarMenuItem"
510
+
511
+ const sidebarMenuButtonVariants = cva(
512
+ "peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-sm p-2 text-left text-sm outline-none ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-[[data-sidebar=menu-action]]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:!size-8 group-data-[collapsible=icon]:!p-2 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0",
513
+ {
514
+ variants: {
515
+ variant: {
516
+ default: "hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",
517
+ outline:
518
+ "bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-border))]",
519
+ },
520
+ size: {
521
+ default: "h-8 text-sm",
522
+ sm: "h-7 text-xs",
523
+ lg: "h-12 text-sm group-data-[collapsible=icon]:!p-0",
524
+ },
525
+ },
526
+ defaultVariants: {
527
+ variant: "default",
528
+ size: "default",
529
+ },
530
+ }
531
+ )
532
+
533
+ const SidebarMenuButton = React.forwardRef<
534
+ HTMLButtonElement,
535
+ React.ComponentProps<"button"> & {
536
+ asChild?: boolean
537
+ isActive?: boolean
538
+ tooltip?: string | React.ComponentProps<typeof TooltipContent>
539
+ } & VariantProps<typeof sidebarMenuButtonVariants>
540
+ >(
541
+ (
542
+ {
543
+ asChild = false,
544
+ isActive = false,
545
+ variant = "default",
546
+ size = "default",
547
+ tooltip,
548
+ className,
549
+ ...props
550
+ },
551
+ ref
552
+ ) => {
553
+ const Comp = asChild ? Slot : "button"
554
+ const { isMobile, state } = useSidebar()
555
+
556
+ const button = (
557
+ <Comp
558
+ ref={ref}
559
+ data-sidebar="menu-button"
560
+ data-size={size}
561
+ data-active={isActive}
562
+ className={cn(sidebarMenuButtonVariants({ variant, size }), className)}
563
+ {...props}
564
+ />
565
+ )
566
+
567
+ if (!tooltip || (state !== "collapsed" && !isMobile)) {
568
+ return button
569
+ }
570
+
571
+ if (typeof tooltip === "string") {
572
+ tooltip = {
573
+ children: tooltip,
574
+ }
575
+ }
576
+
577
+ return (
578
+ <Tooltip>
579
+ <TooltipTrigger asChild>{button}</TooltipTrigger>
580
+ <TooltipContent
581
+ side="right"
582
+ align="center"
583
+ hidden={state !== "collapsed" || isMobile}
584
+ {...tooltip}
585
+ />
586
+ </Tooltip>
587
+ )
588
+ }
589
+ )
590
+ SidebarMenuButton.displayName = "SidebarMenuButton"
591
+
592
+ const SidebarMenuAction = React.forwardRef<
593
+ HTMLButtonElement,
594
+ React.ComponentProps<"button"> & {
595
+ asChild?: boolean
596
+ showOnHover?: boolean
597
+ }
598
+ >(({ className, asChild = false, showOnHover = false, ...props }, ref) => {
599
+ const Comp = asChild ? Slot : "button"
600
+
601
+ return (
602
+ <Comp
603
+ ref={ref}
604
+ data-sidebar="menu-action"
605
+ className={cn(
606
+ "absolute right-1 top-1.5 flex aspect-square w-5 items-center justify-center rounded-sm p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 peer-hover/menu-button:text-sidebar-accent-foreground [&>svg]:size-4 [&>svg]:shrink-0",
607
+ // Increases the hit area of the button on mobile.
608
+ "after:absolute after:-inset-2 after:md:hidden",
609
+ "peer-data-[size=sm]/menu-button:top-1",
610
+ "peer-data-[size=default]/menu-button:top-1.5",
611
+ "peer-data-[size=lg]/menu-button:top-2.5",
612
+ "group-data-[collapsible=icon]:hidden",
613
+ showOnHover &&
614
+ "group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 peer-data-[active=true]/menu-button:text-sidebar-accent-foreground md:opacity-0",
615
+ className
616
+ )}
617
+ {...props}
618
+ />
619
+ )
620
+ })
621
+ SidebarMenuAction.displayName = "SidebarMenuAction"
622
+
623
+ const SidebarMenuBadge = React.forwardRef<
624
+ HTMLDivElement,
625
+ React.ComponentProps<"div">
626
+ >(({ className, ...props }, ref) => (
627
+ <div
628
+ ref={ref}
629
+ data-sidebar="menu-badge"
630
+ className={cn(
631
+ "absolute right-1 flex h-5 min-w-5 items-center justify-center rounded-sm px-1 text-xs font-medium tabular-nums text-sidebar-foreground select-none pointer-events-none",
632
+ "peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground",
633
+ "peer-data-[size=sm]/menu-button:top-1",
634
+ "peer-data-[size=default]/menu-button:top-1.5",
635
+ "peer-data-[size=lg]/menu-button:top-2.5",
636
+ "group-data-[collapsible=icon]:hidden",
637
+ className
638
+ )}
639
+ {...props}
640
+ />
641
+ ))
642
+ SidebarMenuBadge.displayName = "SidebarMenuBadge"
643
+
644
+ const SidebarMenuSkeleton = React.forwardRef<
645
+ HTMLDivElement,
646
+ React.ComponentProps<"div"> & {
647
+ showIcon?: boolean
648
+ }
649
+ >(({ className, showIcon = false, ...props }, ref) => {
650
+ // Random width between 50 to 90%.
651
+ const width = React.useMemo(() => {
652
+ return `${Math.floor(Math.random() * 40) + 50}%`
653
+ }, [])
654
+
655
+ return (
656
+ <div
657
+ ref={ref}
658
+ data-sidebar="menu-skeleton"
659
+ className={cn("rounded-sm h-8 flex gap-2 px-2 items-center", className)}
660
+ {...props}
661
+ >
662
+ {showIcon && (
663
+ <Skeleton
664
+ className="size-4 rounded-sm"
665
+ data-sidebar="menu-skeleton-icon"
666
+ />
667
+ )}
668
+ <Skeleton
669
+ className="h-4 flex-1 max-w-[--skeleton-width]"
670
+ data-sidebar="menu-skeleton-text"
671
+ style={
672
+ {
673
+ "--skeleton-width": width,
674
+ } as React.CSSProperties
675
+ }
676
+ />
677
+ </div>
678
+ )
679
+ })
680
+ SidebarMenuSkeleton.displayName = "SidebarMenuSkeleton"
681
+
682
+ const SidebarMenuSub = React.forwardRef<
683
+ HTMLUListElement,
684
+ React.ComponentProps<"ul">
685
+ >(({ className, ...props }, ref) => (
686
+ <ul
687
+ ref={ref}
688
+ data-sidebar="menu-sub"
689
+ className={cn(
690
+ "mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l border-sidebar-border px-2.5 py-0.5",
691
+ "group-data-[collapsible=icon]:hidden",
692
+ className
693
+ )}
694
+ {...props}
695
+ />
696
+ ))
697
+ SidebarMenuSub.displayName = "SidebarMenuSub"
698
+
699
+ const SidebarMenuSubItem = React.forwardRef<
700
+ HTMLLIElement,
701
+ React.ComponentProps<"li">
702
+ >(({ ...props }, ref) => <li ref={ref} {...props} />)
703
+ SidebarMenuSubItem.displayName = "SidebarMenuSubItem"
704
+
705
+ const SidebarMenuSubButton = React.forwardRef<
706
+ HTMLAnchorElement,
707
+ React.ComponentProps<"a"> & {
708
+ asChild?: boolean
709
+ size?: "sm" | "md"
710
+ isActive?: boolean
711
+ }
712
+ >(({ asChild = false, size = "md", isActive, className, ...props }, ref) => {
713
+ const Comp = asChild ? Slot : "a"
714
+
715
+ return (
716
+ <Comp
717
+ ref={ref}
718
+ data-sidebar="menu-sub-button"
719
+ data-size={size}
720
+ data-active={isActive}
721
+ className={cn(
722
+ "flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-sm px-2 text-sidebar-foreground outline-none ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-accent-foreground",
723
+ "data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground",
724
+ size === "sm" && "text-xs",
725
+ size === "md" && "text-sm",
726
+ "group-data-[collapsible=icon]:hidden",
727
+ className
728
+ )}
729
+ {...props}
730
+ />
731
+ )
732
+ })
733
+ SidebarMenuSubButton.displayName = "SidebarMenuSubButton"
734
+
735
+ export {
736
+ Sidebar,
737
+ SidebarContent,
738
+ SidebarFooter,
739
+ SidebarGroup,
740
+ SidebarGroupAction,
741
+ SidebarGroupContent,
742
+ SidebarGroupLabel,
743
+ SidebarHeader,
744
+ SidebarInput,
745
+ SidebarInset,
746
+ SidebarMenu,
747
+ SidebarMenuAction,
748
+ SidebarMenuBadge,
749
+ SidebarMenuButton,
750
+ SidebarMenuItem,
751
+ SidebarMenuSkeleton,
752
+ SidebarMenuSub,
753
+ SidebarMenuSubButton,
754
+ SidebarMenuSubItem,
755
+ SidebarProvider,
756
+ SidebarRail,
757
+ SidebarSeparator,
758
+ SidebarTrigger,
759
+ useSidebar,
760
+ }