create-bluecopa-react-app 1.0.4 → 1.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 (108) hide show
  1. package/README.md +47 -10
  2. package/bin/create-bluecopa-react-app.js +257 -51
  3. package/package.json +6 -5
  4. package/templates/latest/Agent.md +254 -0
  5. package/templates/latest/Dockerfile +22 -0
  6. package/templates/latest/README.md +157 -221
  7. package/templates/latest/app/app.css +134 -0
  8. package/templates/latest/app/app.tsx +46 -0
  9. package/templates/latest/app/components/app-sidebar.tsx +174 -0
  10. package/templates/latest/app/components/chart-area-interactive.tsx +290 -0
  11. package/templates/latest/app/components/data-table.tsx +807 -0
  12. package/templates/latest/app/components/nav-documents.tsx +92 -0
  13. package/templates/latest/app/components/nav-main.tsx +56 -0
  14. package/templates/latest/app/components/nav-secondary.tsx +42 -0
  15. package/templates/latest/app/components/nav-user.tsx +112 -0
  16. package/templates/latest/app/components/section-cards.tsx +102 -0
  17. package/templates/latest/app/components/site-header.tsx +19 -0
  18. package/templates/latest/app/components/ui/avatar.tsx +53 -0
  19. package/templates/latest/app/components/ui/badge.tsx +46 -0
  20. package/templates/latest/app/components/ui/breadcrumb.tsx +109 -0
  21. package/templates/latest/app/components/ui/button.tsx +58 -0
  22. package/templates/latest/app/components/ui/card.tsx +92 -0
  23. package/templates/latest/app/components/ui/chart.tsx +352 -0
  24. package/templates/latest/app/components/ui/checkbox.tsx +30 -0
  25. package/templates/latest/app/components/ui/drawer.tsx +139 -0
  26. package/templates/latest/app/components/ui/dropdown-menu.tsx +258 -0
  27. package/templates/latest/app/components/ui/input.tsx +21 -0
  28. package/templates/latest/app/components/ui/label.tsx +24 -0
  29. package/templates/latest/app/components/ui/select.tsx +183 -0
  30. package/templates/latest/app/components/ui/separator.tsx +26 -0
  31. package/templates/latest/app/components/ui/sheet.tsx +139 -0
  32. package/templates/latest/app/components/ui/sidebar.tsx +731 -0
  33. package/templates/latest/app/components/ui/skeleton.tsx +13 -0
  34. package/templates/latest/app/components/ui/sonner.tsx +23 -0
  35. package/templates/latest/app/components/ui/table.tsx +117 -0
  36. package/templates/latest/app/components/ui/tabs.tsx +66 -0
  37. package/templates/latest/app/components/ui/toggle-group.tsx +73 -0
  38. package/templates/latest/app/components/ui/toggle.tsx +47 -0
  39. package/templates/latest/app/components/ui/tooltip.tsx +59 -0
  40. package/templates/latest/app/dashboard/data.json +614 -0
  41. package/templates/latest/app/hooks/use-bluecopa-user.ts +37 -0
  42. package/templates/latest/app/hooks/use-mobile.ts +19 -0
  43. package/templates/latest/{src → app}/lib/utils.ts +1 -1
  44. package/templates/latest/app/main.tsx +12 -0
  45. package/templates/latest/app/routes/home.tsx +40 -0
  46. package/templates/latest/app/routes.tsx +15 -0
  47. package/templates/latest/{src → app}/single-spa.tsx +38 -28
  48. package/templates/latest/components.json +22 -0
  49. package/templates/latest/dist/assets/__federation_expose_App-DRwKKpS2.js +91 -0
  50. package/templates/latest/dist/assets/__federation_fn_import-CzfA7kmP.js +438 -0
  51. package/templates/latest/dist/assets/__federation_shared_react-Bp6HVBS4.js +16 -0
  52. package/templates/latest/dist/assets/__federation_shared_react-dom-BCcRGiYp.js +17 -0
  53. package/templates/latest/dist/assets/client-DgSav55y.js +12658 -0
  54. package/templates/latest/dist/assets/home-DOL6GrYV.js +54951 -0
  55. package/templates/latest/dist/assets/index-BzNimew1.js +69 -0
  56. package/templates/latest/dist/assets/index-DMFtQdNS.js +412 -0
  57. package/templates/latest/dist/assets/index-DdYpcDMk.js +60 -0
  58. package/templates/latest/dist/assets/remoteEntry.js +88 -0
  59. package/templates/latest/dist/assets/style-36A39bNN.css +3683 -0
  60. package/templates/latest/dist/avatars/shadcn.svg +6 -0
  61. package/templates/latest/dist/favicon.ico +0 -0
  62. package/templates/latest/dist/index.html +19 -0
  63. package/templates/latest/index.html +1 -1
  64. package/templates/latest/package-lock.json +1227 -3353
  65. package/templates/latest/package.json +47 -43
  66. package/templates/latest/pnpm-lock.yaml +4767 -0
  67. package/templates/latest/preview/index.html +32 -2
  68. package/templates/latest/public/avatars/shadcn.svg +6 -0
  69. package/templates/latest/public/favicon.ico +0 -0
  70. package/templates/latest/tsconfig.json +18 -11
  71. package/templates/latest/vite.config.ts +41 -41
  72. package/templates/latest/.env.example +0 -14
  73. package/templates/latest/.eslintrc.cjs +0 -42
  74. package/templates/latest/AGENT.md +0 -284
  75. package/templates/latest/clean.sh +0 -39
  76. package/templates/latest/postcss.config.cjs +0 -6
  77. package/templates/latest/public/bluecopa-logo.svg +0 -30
  78. package/templates/latest/public/favicon-32x32.png +0 -0
  79. package/templates/latest/public/favicon-96x96.png +0 -0
  80. package/templates/latest/setup.sh +0 -55
  81. package/templates/latest/src/App.tsx +0 -15
  82. package/templates/latest/src/components/layout/dashboard-header.tsx +0 -139
  83. package/templates/latest/src/components/layout/dashboard-layout.tsx +0 -29
  84. package/templates/latest/src/components/layout/sidebar.tsx +0 -54
  85. package/templates/latest/src/components/page/dashboard.tsx +0 -1506
  86. package/templates/latest/src/components/page/navbar.tsx +0 -104
  87. package/templates/latest/src/components/tables/data-grid.tsx +0 -439
  88. package/templates/latest/src/components/ui/alert.tsx +0 -59
  89. package/templates/latest/src/components/ui/avatar.tsx +0 -50
  90. package/templates/latest/src/components/ui/badge.tsx +0 -36
  91. package/templates/latest/src/components/ui/bluecopa-logo.tsx +0 -54
  92. package/templates/latest/src/components/ui/button.tsx +0 -58
  93. package/templates/latest/src/components/ui/card.tsx +0 -79
  94. package/templates/latest/src/components/ui/dropdown-menu.tsx +0 -200
  95. package/templates/latest/src/components/ui/input.tsx +0 -24
  96. package/templates/latest/src/components/ui/label.tsx +0 -23
  97. package/templates/latest/src/components/ui/select.tsx +0 -29
  98. package/templates/latest/src/hooks/use-api.ts +0 -55
  99. package/templates/latest/src/index.css +0 -59
  100. package/templates/latest/src/main.tsx +0 -13
  101. package/templates/latest/src/pages/Dashboard.tsx +0 -13
  102. package/templates/latest/src/pages/Home.tsx +0 -622
  103. package/templates/latest/src/providers/query-provider.tsx +0 -48
  104. package/templates/latest/src/types/api.ts +0 -78
  105. package/templates/latest/src/vite-env.d.ts +0 -11
  106. package/templates/latest/tailwind.config.js +0 -88
  107. package/templates/latest/tsconfig.app.json +0 -26
  108. package/templates/latest/tsconfig.node.json +0 -10
@@ -0,0 +1,92 @@
1
+ import * as React from "react"
2
+
3
+ import { cn } from "~/lib/utils"
4
+
5
+ function Card({ className, ...props }: React.ComponentProps<"div">) {
6
+ return (
7
+ <div
8
+ data-slot="card"
9
+ className={cn(
10
+ "bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",
11
+ className
12
+ )}
13
+ {...props}
14
+ />
15
+ )
16
+ }
17
+
18
+ function CardHeader({ className, ...props }: React.ComponentProps<"div">) {
19
+ return (
20
+ <div
21
+ data-slot="card-header"
22
+ className={cn(
23
+ "@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",
24
+ className
25
+ )}
26
+ {...props}
27
+ />
28
+ )
29
+ }
30
+
31
+ function CardTitle({ className, ...props }: React.ComponentProps<"div">) {
32
+ return (
33
+ <div
34
+ data-slot="card-title"
35
+ className={cn("leading-none font-semibold", className)}
36
+ {...props}
37
+ />
38
+ )
39
+ }
40
+
41
+ function CardDescription({ className, ...props }: React.ComponentProps<"div">) {
42
+ return (
43
+ <div
44
+ data-slot="card-description"
45
+ className={cn("text-muted-foreground text-sm", className)}
46
+ {...props}
47
+ />
48
+ )
49
+ }
50
+
51
+ function CardAction({ className, ...props }: React.ComponentProps<"div">) {
52
+ return (
53
+ <div
54
+ data-slot="card-action"
55
+ className={cn(
56
+ "col-start-2 row-span-2 row-start-1 self-start justify-self-end",
57
+ className
58
+ )}
59
+ {...props}
60
+ />
61
+ )
62
+ }
63
+
64
+ function CardContent({ className, ...props }: React.ComponentProps<"div">) {
65
+ return (
66
+ <div
67
+ data-slot="card-content"
68
+ className={cn("px-6", className)}
69
+ {...props}
70
+ />
71
+ )
72
+ }
73
+
74
+ function CardFooter({ className, ...props }: React.ComponentProps<"div">) {
75
+ return (
76
+ <div
77
+ data-slot="card-footer"
78
+ className={cn("flex items-center px-6 [.border-t]:pt-6", className)}
79
+ {...props}
80
+ />
81
+ )
82
+ }
83
+
84
+ export {
85
+ Card,
86
+ CardHeader,
87
+ CardFooter,
88
+ CardTitle,
89
+ CardAction,
90
+ CardDescription,
91
+ CardContent,
92
+ }
@@ -0,0 +1,352 @@
1
+ import * as React from "react"
2
+ import * as RechartsPrimitive from "recharts"
3
+
4
+ import { cn } from "~/lib/utils"
5
+
6
+ // Format: { THEME_NAME: CSS_SELECTOR }
7
+ const THEMES = { light: "", dark: ".dark" } as const
8
+
9
+ type ChartConfig = {
10
+ [k in string]: {
11
+ label?: React.ReactNode
12
+ icon?: React.ComponentType
13
+ } & (
14
+ | { color?: string; theme?: never }
15
+ | { color?: never; theme: Record<keyof typeof THEMES, string> }
16
+ )
17
+ }
18
+
19
+ type ChartContextProps = {
20
+ config: ChartConfig
21
+ }
22
+
23
+ const ChartContext = React.createContext<ChartContextProps | null>(null)
24
+
25
+ function useChart() {
26
+ const context = React.useContext(ChartContext)
27
+
28
+ if (!context) {
29
+ throw new Error("useChart must be used within a <ChartContainer />")
30
+ }
31
+
32
+ return context
33
+ }
34
+
35
+ function ChartContainer({
36
+ id,
37
+ className,
38
+ children,
39
+ config,
40
+ ...props
41
+ }: React.ComponentProps<"div"> & {
42
+ config: ChartConfig
43
+ children: React.ComponentProps<
44
+ typeof RechartsPrimitive.ResponsiveContainer
45
+ >["children"]
46
+ }) {
47
+ const uniqueId = React.useId()
48
+ const chartId = `chart-${id || uniqueId.replace(/:/g, "")}`
49
+
50
+ return (
51
+ <ChartContext.Provider value={{ config }}>
52
+ <div
53
+ data-slot="chart"
54
+ data-chart={chartId}
55
+ className={cn(
56
+ "[&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border flex aspect-video justify-center text-xs [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-hidden [&_.recharts-sector]:outline-hidden [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-surface]:outline-hidden",
57
+ className
58
+ )}
59
+ {...props}
60
+ >
61
+ <ChartStyle id={chartId} config={config} />
62
+ <RechartsPrimitive.ResponsiveContainer>
63
+ {children}
64
+ </RechartsPrimitive.ResponsiveContainer>
65
+ </div>
66
+ </ChartContext.Provider>
67
+ )
68
+ }
69
+
70
+ const ChartStyle = ({ id, config }: { id: string; config: ChartConfig }) => {
71
+ const colorConfig = Object.entries(config).filter(
72
+ ([, config]) => config.theme || config.color
73
+ )
74
+
75
+ if (!colorConfig.length) {
76
+ return null
77
+ }
78
+
79
+ return (
80
+ <style
81
+ dangerouslySetInnerHTML={{
82
+ __html: Object.entries(THEMES)
83
+ .map(
84
+ ([theme, prefix]) => `
85
+ ${prefix} [data-chart=${id}] {
86
+ ${colorConfig
87
+ .map(([key, itemConfig]) => {
88
+ const color =
89
+ itemConfig.theme?.[theme as keyof typeof itemConfig.theme] ||
90
+ itemConfig.color
91
+ return color ? ` --color-${key}: ${color};` : null
92
+ })
93
+ .join("\n")}
94
+ }
95
+ `
96
+ )
97
+ .join("\n"),
98
+ }}
99
+ />
100
+ )
101
+ }
102
+
103
+ const ChartTooltip = RechartsPrimitive.Tooltip
104
+
105
+ function ChartTooltipContent({
106
+ active,
107
+ payload,
108
+ className,
109
+ indicator = "dot",
110
+ hideLabel = false,
111
+ hideIndicator = false,
112
+ label,
113
+ labelFormatter,
114
+ labelClassName,
115
+ formatter,
116
+ color,
117
+ nameKey,
118
+ labelKey,
119
+ }: React.ComponentProps<typeof RechartsPrimitive.Tooltip> &
120
+ React.ComponentProps<"div"> & {
121
+ hideLabel?: boolean
122
+ hideIndicator?: boolean
123
+ indicator?: "line" | "dot" | "dashed"
124
+ nameKey?: string
125
+ labelKey?: string
126
+ }) {
127
+ const { config } = useChart()
128
+
129
+ const tooltipLabel = React.useMemo(() => {
130
+ if (hideLabel || !payload?.length) {
131
+ return null
132
+ }
133
+
134
+ const [item] = payload
135
+ const key = `${labelKey || item?.dataKey || item?.name || "value"}`
136
+ const itemConfig = getPayloadConfigFromPayload(config, item, key)
137
+ const value =
138
+ !labelKey && typeof label === "string"
139
+ ? config[label as keyof typeof config]?.label || label
140
+ : itemConfig?.label
141
+
142
+ if (labelFormatter) {
143
+ return (
144
+ <div className={cn("font-medium", labelClassName)}>
145
+ {labelFormatter(value, payload)}
146
+ </div>
147
+ )
148
+ }
149
+
150
+ if (!value) {
151
+ return null
152
+ }
153
+
154
+ return <div className={cn("font-medium", labelClassName)}>{value}</div>
155
+ }, [
156
+ label,
157
+ labelFormatter,
158
+ payload,
159
+ hideLabel,
160
+ labelClassName,
161
+ config,
162
+ labelKey,
163
+ ])
164
+
165
+ if (!active || !payload?.length) {
166
+ return null
167
+ }
168
+
169
+ const nestLabel = payload.length === 1 && indicator !== "dot"
170
+
171
+ return (
172
+ <div
173
+ className={cn(
174
+ "border-border/50 bg-background grid min-w-[8rem] items-start gap-1.5 rounded-lg border px-2.5 py-1.5 text-xs shadow-xl",
175
+ className
176
+ )}
177
+ >
178
+ {!nestLabel ? tooltipLabel : null}
179
+ <div className="grid gap-1.5">
180
+ {payload.map((item, index) => {
181
+ const key = `${nameKey || item.name || item.dataKey || "value"}`
182
+ const itemConfig = getPayloadConfigFromPayload(config, item, key)
183
+ const indicatorColor = color || item.payload.fill || item.color
184
+
185
+ return (
186
+ <div
187
+ key={item.dataKey}
188
+ className={cn(
189
+ "[&>svg]:text-muted-foreground flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5",
190
+ indicator === "dot" && "items-center"
191
+ )}
192
+ >
193
+ {formatter && item?.value !== undefined && item.name ? (
194
+ formatter(item.value, item.name, item, index, item.payload)
195
+ ) : (
196
+ <>
197
+ {itemConfig?.icon ? (
198
+ <itemConfig.icon />
199
+ ) : (
200
+ !hideIndicator && (
201
+ <div
202
+ className={cn(
203
+ "shrink-0 rounded-[2px] border-(--color-border) bg-(--color-bg)",
204
+ {
205
+ "h-2.5 w-2.5": indicator === "dot",
206
+ "w-1": indicator === "line",
207
+ "w-0 border-[1.5px] border-dashed bg-transparent":
208
+ indicator === "dashed",
209
+ "my-0.5": nestLabel && indicator === "dashed",
210
+ }
211
+ )}
212
+ style={
213
+ {
214
+ "--color-bg": indicatorColor,
215
+ "--color-border": indicatorColor,
216
+ } as React.CSSProperties
217
+ }
218
+ />
219
+ )
220
+ )}
221
+ <div
222
+ className={cn(
223
+ "flex flex-1 justify-between leading-none",
224
+ nestLabel ? "items-end" : "items-center"
225
+ )}
226
+ >
227
+ <div className="grid gap-1.5">
228
+ {nestLabel ? tooltipLabel : null}
229
+ <span className="text-muted-foreground">
230
+ {itemConfig?.label || item.name}
231
+ </span>
232
+ </div>
233
+ {item.value && (
234
+ <span className="text-foreground font-mono font-medium tabular-nums">
235
+ {item.value.toLocaleString()}
236
+ </span>
237
+ )}
238
+ </div>
239
+ </>
240
+ )}
241
+ </div>
242
+ )
243
+ })}
244
+ </div>
245
+ </div>
246
+ )
247
+ }
248
+
249
+ const ChartLegend = RechartsPrimitive.Legend
250
+
251
+ function ChartLegendContent({
252
+ className,
253
+ hideIcon = false,
254
+ payload,
255
+ verticalAlign = "bottom",
256
+ nameKey,
257
+ }: React.ComponentProps<"div"> &
258
+ Pick<RechartsPrimitive.LegendProps, "payload" | "verticalAlign"> & {
259
+ hideIcon?: boolean
260
+ nameKey?: string
261
+ }) {
262
+ const { config } = useChart()
263
+
264
+ if (!payload?.length) {
265
+ return null
266
+ }
267
+
268
+ return (
269
+ <div
270
+ className={cn(
271
+ "flex items-center justify-center gap-4",
272
+ verticalAlign === "top" ? "pb-3" : "pt-3",
273
+ className
274
+ )}
275
+ >
276
+ {payload.map((item) => {
277
+ const key = `${nameKey || item.dataKey || "value"}`
278
+ const itemConfig = getPayloadConfigFromPayload(config, item, key)
279
+
280
+ return (
281
+ <div
282
+ key={item.value}
283
+ className={cn(
284
+ "[&>svg]:text-muted-foreground flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3"
285
+ )}
286
+ >
287
+ {itemConfig?.icon && !hideIcon ? (
288
+ <itemConfig.icon />
289
+ ) : (
290
+ <div
291
+ className="h-2 w-2 shrink-0 rounded-[2px]"
292
+ style={{
293
+ backgroundColor: item.color,
294
+ }}
295
+ />
296
+ )}
297
+ {itemConfig?.label}
298
+ </div>
299
+ )
300
+ })}
301
+ </div>
302
+ )
303
+ }
304
+
305
+ // Helper to extract item config from a payload.
306
+ function getPayloadConfigFromPayload(
307
+ config: ChartConfig,
308
+ payload: unknown,
309
+ key: string
310
+ ) {
311
+ if (typeof payload !== "object" || payload === null) {
312
+ return undefined
313
+ }
314
+
315
+ const payloadPayload =
316
+ "payload" in payload &&
317
+ typeof payload.payload === "object" &&
318
+ payload.payload !== null
319
+ ? payload.payload
320
+ : undefined
321
+
322
+ let configLabelKey: string = key
323
+
324
+ if (
325
+ key in payload &&
326
+ typeof payload[key as keyof typeof payload] === "string"
327
+ ) {
328
+ configLabelKey = payload[key as keyof typeof payload] as string
329
+ } else if (
330
+ payloadPayload &&
331
+ key in payloadPayload &&
332
+ typeof payloadPayload[key as keyof typeof payloadPayload] === "string"
333
+ ) {
334
+ configLabelKey = payloadPayload[
335
+ key as keyof typeof payloadPayload
336
+ ] as string
337
+ }
338
+
339
+ return configLabelKey in config
340
+ ? config[configLabelKey]
341
+ : config[key as keyof typeof config]
342
+ }
343
+
344
+ export type { ChartConfig }
345
+ export {
346
+ ChartContainer,
347
+ ChartTooltip,
348
+ ChartTooltipContent,
349
+ ChartLegend,
350
+ ChartLegendContent,
351
+ ChartStyle,
352
+ }
@@ -0,0 +1,30 @@
1
+ import * as React from "react"
2
+ import * as CheckboxPrimitive from "@radix-ui/react-checkbox"
3
+ import { CheckIcon } from "lucide-react"
4
+
5
+ import { cn } from "~/lib/utils"
6
+
7
+ function Checkbox({
8
+ className,
9
+ ...props
10
+ }: React.ComponentProps<typeof CheckboxPrimitive.Root>) {
11
+ return (
12
+ <CheckboxPrimitive.Root
13
+ data-slot="checkbox"
14
+ className={cn(
15
+ "peer border-input dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",
16
+ className
17
+ )}
18
+ {...props}
19
+ >
20
+ <CheckboxPrimitive.Indicator
21
+ data-slot="checkbox-indicator"
22
+ className="flex items-center justify-center text-current transition-none"
23
+ >
24
+ <CheckIcon className="size-3.5" />
25
+ </CheckboxPrimitive.Indicator>
26
+ </CheckboxPrimitive.Root>
27
+ )
28
+ }
29
+
30
+ export { Checkbox }
@@ -0,0 +1,139 @@
1
+ import * as React from "react"
2
+ import { Drawer as DrawerPrimitive } from "vaul"
3
+
4
+ import { cn } from "~/lib/utils"
5
+
6
+ function Drawer({
7
+ ...props
8
+ }: React.ComponentProps<typeof DrawerPrimitive.Root>) {
9
+ return <DrawerPrimitive.Root data-slot="drawer" {...props} />
10
+ }
11
+
12
+ const DrawerTrigger = React.forwardRef<
13
+ React.ElementRef<typeof DrawerPrimitive.Trigger>,
14
+ React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Trigger>
15
+ >(({ ...props }, ref) => (
16
+ <DrawerPrimitive.Trigger
17
+ ref={ref}
18
+ data-slot="drawer-trigger"
19
+ {...props}
20
+ />
21
+ ))
22
+ DrawerTrigger.displayName = "DrawerTrigger"
23
+
24
+ function DrawerPortal({
25
+ ...props
26
+ }: React.ComponentProps<typeof DrawerPrimitive.Portal>) {
27
+ return <DrawerPrimitive.Portal data-slot="drawer-portal" {...props} />
28
+ }
29
+
30
+ function DrawerClose({
31
+ ...props
32
+ }: React.ComponentProps<typeof DrawerPrimitive.Close>) {
33
+ return <DrawerPrimitive.Close data-slot="drawer-close" {...props} />
34
+ }
35
+
36
+ const DrawerOverlay = React.forwardRef<
37
+ React.ElementRef<typeof DrawerPrimitive.Overlay>,
38
+ React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Overlay>
39
+ >(({ className, ...props }, ref) => (
40
+ <DrawerPrimitive.Overlay
41
+ ref={ref}
42
+ data-slot="drawer-overlay"
43
+ className={cn(
44
+ "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",
45
+ className
46
+ )}
47
+ {...props}
48
+ />
49
+ ))
50
+ DrawerOverlay.displayName = "DrawerOverlay"
51
+
52
+ function DrawerContent({
53
+ className,
54
+ children,
55
+ ...props
56
+ }: React.ComponentProps<typeof DrawerPrimitive.Content>) {
57
+ return (
58
+ <DrawerPortal data-slot="drawer-portal">
59
+ <DrawerOverlay />
60
+ <DrawerPrimitive.Content
61
+ data-slot="drawer-content"
62
+ className={cn(
63
+ "group/drawer-content bg-background fixed z-50 flex h-auto flex-col",
64
+ "data-[vaul-drawer-direction=top]:inset-x-0 data-[vaul-drawer-direction=top]:top-0 data-[vaul-drawer-direction=top]:mb-24 data-[vaul-drawer-direction=top]:max-h-[80vh] data-[vaul-drawer-direction=top]:rounded-b-lg data-[vaul-drawer-direction=top]:border-b",
65
+ "data-[vaul-drawer-direction=bottom]:inset-x-0 data-[vaul-drawer-direction=bottom]:bottom-0 data-[vaul-drawer-direction=bottom]:mt-24 data-[vaul-drawer-direction=bottom]:max-h-[80vh] data-[vaul-drawer-direction=bottom]:rounded-t-lg data-[vaul-drawer-direction=bottom]:border-t",
66
+ "data-[vaul-drawer-direction=right]:inset-y-0 data-[vaul-drawer-direction=right]:right-0 data-[vaul-drawer-direction=right]:w-3/4 data-[vaul-drawer-direction=right]:border-l data-[vaul-drawer-direction=right]:sm:max-w-sm",
67
+ "data-[vaul-drawer-direction=left]:inset-y-0 data-[vaul-drawer-direction=left]:left-0 data-[vaul-drawer-direction=left]:w-3/4 data-[vaul-drawer-direction=left]:border-r data-[vaul-drawer-direction=left]:sm:max-w-sm",
68
+ className
69
+ )}
70
+ {...props}
71
+ >
72
+ <div className="bg-muted mx-auto mt-4 hidden h-2 w-[100px] shrink-0 rounded-full group-data-[vaul-drawer-direction=bottom]/drawer-content:block" />
73
+ {children}
74
+ </DrawerPrimitive.Content>
75
+ </DrawerPortal>
76
+ )
77
+ }
78
+
79
+ function DrawerHeader({ className, ...props }: React.ComponentProps<"div">) {
80
+ return (
81
+ <div
82
+ data-slot="drawer-header"
83
+ className={cn(
84
+ "flex flex-col gap-0.5 p-4 group-data-[vaul-drawer-direction=bottom]/drawer-content:text-center group-data-[vaul-drawer-direction=top]/drawer-content:text-center md:gap-1.5 md:text-left",
85
+ className
86
+ )}
87
+ {...props}
88
+ />
89
+ )
90
+ }
91
+
92
+ function DrawerFooter({ className, ...props }: React.ComponentProps<"div">) {
93
+ return (
94
+ <div
95
+ data-slot="drawer-footer"
96
+ className={cn("mt-auto flex flex-col gap-2 p-4", className)}
97
+ {...props}
98
+ />
99
+ )
100
+ }
101
+
102
+ function DrawerTitle({
103
+ className,
104
+ ...props
105
+ }: React.ComponentProps<typeof DrawerPrimitive.Title>) {
106
+ return (
107
+ <DrawerPrimitive.Title
108
+ data-slot="drawer-title"
109
+ className={cn("text-foreground font-semibold", className)}
110
+ {...props}
111
+ />
112
+ )
113
+ }
114
+
115
+ function DrawerDescription({
116
+ className,
117
+ ...props
118
+ }: React.ComponentProps<typeof DrawerPrimitive.Description>) {
119
+ return (
120
+ <DrawerPrimitive.Description
121
+ data-slot="drawer-description"
122
+ className={cn("text-muted-foreground text-sm", className)}
123
+ {...props}
124
+ />
125
+ )
126
+ }
127
+
128
+ export {
129
+ Drawer,
130
+ DrawerPortal,
131
+ DrawerOverlay,
132
+ DrawerTrigger,
133
+ DrawerClose,
134
+ DrawerContent,
135
+ DrawerHeader,
136
+ DrawerFooter,
137
+ DrawerTitle,
138
+ DrawerDescription,
139
+ }