@oppulence/design-system 1.0.2

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