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