howone 0.0.3 → 0.0.6

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