braid-ui 1.0.98 → 1.0.99

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