modula-ui 1.0.0

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