@nocobase/portal-template-default 1.0.0

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 (123) hide show
  1. package/.env.example +10 -0
  2. package/Dockerfile +36 -0
  3. package/README.MD +50 -0
  4. package/components.json +25 -0
  5. package/eslint.config.js +28 -0
  6. package/index.html +39 -0
  7. package/package.json +84 -0
  8. package/pnpm-workspace.yaml +2 -0
  9. package/public/favicon.ico +0 -0
  10. package/public/logo-dark.png +0 -0
  11. package/public/logo-mark-dark.png +0 -0
  12. package/public/logo-mark.png +0 -0
  13. package/public/logo.png +0 -0
  14. package/src/App.css +158 -0
  15. package/src/App.tsx +151 -0
  16. package/src/components/app-shell/brand.tsx +70 -0
  17. package/src/components/app-shell/breadcrumb.tsx +81 -0
  18. package/src/components/app-shell/document-title-handler.tsx +169 -0
  19. package/src/components/app-shell/error-component.tsx +134 -0
  20. package/src/components/app-shell/header.tsx +127 -0
  21. package/src/components/app-shell/layout.tsx +39 -0
  22. package/src/components/app-shell/loading-overlay.tsx +36 -0
  23. package/src/components/app-shell/sidebar.tsx +351 -0
  24. package/src/components/app-shell/user-avatar.tsx +42 -0
  25. package/src/components/app-shell/user-info.tsx +53 -0
  26. package/src/components/auth/auth-layout.tsx +82 -0
  27. package/src/components/auth/forgot-password-form.tsx +58 -0
  28. package/src/components/auth/input-password.tsx +38 -0
  29. package/src/components/auth/sign-in-form.tsx +111 -0
  30. package/src/components/auth/sign-up-form.tsx +127 -0
  31. package/src/components/data-table/data-table-filter.tsx +994 -0
  32. package/src/components/data-table/data-table-pagination.tsx +146 -0
  33. package/src/components/data-table/data-table-sorter.tsx +47 -0
  34. package/src/components/data-table/data-table.tsx +321 -0
  35. package/src/components/notifications/toaster.tsx +23 -0
  36. package/src/components/notifications/undoable-notification.tsx +84 -0
  37. package/src/components/notifications/use-notification-provider.tsx +62 -0
  38. package/src/components/resources/buttons/clone.tsx +81 -0
  39. package/src/components/resources/buttons/create.tsx +70 -0
  40. package/src/components/resources/buttons/delete.tsx +113 -0
  41. package/src/components/resources/buttons/edit.tsx +81 -0
  42. package/src/components/resources/buttons/list.tsx +70 -0
  43. package/src/components/resources/buttons/refresh.tsx +81 -0
  44. package/src/components/resources/buttons/show.tsx +81 -0
  45. package/src/components/resources/status-badge.tsx +37 -0
  46. package/src/components/resources/views/create-view.tsx +81 -0
  47. package/src/components/resources/views/edit-view.tsx +104 -0
  48. package/src/components/resources/views/list-view.tsx +86 -0
  49. package/src/components/resources/views/show-view.tsx +108 -0
  50. package/src/components/theme/theme-provider.tsx +71 -0
  51. package/src/components/theme/theme-select.tsx +97 -0
  52. package/src/components/theme/theme-toggle.tsx +66 -0
  53. package/src/components/ui/accordion.tsx +72 -0
  54. package/src/components/ui/alert-dialog.tsx +185 -0
  55. package/src/components/ui/alert.tsx +76 -0
  56. package/src/components/ui/aspect-ratio.tsx +22 -0
  57. package/src/components/ui/avatar.tsx +107 -0
  58. package/src/components/ui/badge.tsx +52 -0
  59. package/src/components/ui/breadcrumb.tsx +125 -0
  60. package/src/components/ui/button.tsx +58 -0
  61. package/src/components/ui/calendar.tsx +221 -0
  62. package/src/components/ui/card.tsx +103 -0
  63. package/src/components/ui/carousel.tsx +240 -0
  64. package/src/components/ui/chart.tsx +373 -0
  65. package/src/components/ui/checkbox.tsx +29 -0
  66. package/src/components/ui/collapsible.tsx +19 -0
  67. package/src/components/ui/command.tsx +192 -0
  68. package/src/components/ui/context-menu.tsx +271 -0
  69. package/src/components/ui/dialog.tsx +160 -0
  70. package/src/components/ui/drawer.tsx +226 -0
  71. package/src/components/ui/dropdown-menu.tsx +268 -0
  72. package/src/components/ui/form.tsx +174 -0
  73. package/src/components/ui/hover-card.tsx +49 -0
  74. package/src/components/ui/input-group.tsx +158 -0
  75. package/src/components/ui/input-otp.tsx +87 -0
  76. package/src/components/ui/input.tsx +20 -0
  77. package/src/components/ui/label.tsx +18 -0
  78. package/src/components/ui/menubar.tsx +278 -0
  79. package/src/components/ui/navigation-menu.tsx +168 -0
  80. package/src/components/ui/pagination.tsx +130 -0
  81. package/src/components/ui/popover.tsx +91 -0
  82. package/src/components/ui/progress.tsx +81 -0
  83. package/src/components/ui/radio-group.tsx +38 -0
  84. package/src/components/ui/resizable.tsx +48 -0
  85. package/src/components/ui/scroll-area.tsx +55 -0
  86. package/src/components/ui/select.tsx +199 -0
  87. package/src/components/ui/separator.tsx +25 -0
  88. package/src/components/ui/sheet.tsx +136 -0
  89. package/src/components/ui/sidebar.tsx +723 -0
  90. package/src/components/ui/skeleton.tsx +13 -0
  91. package/src/components/ui/slider.tsx +52 -0
  92. package/src/components/ui/sonner.tsx +47 -0
  93. package/src/components/ui/switch.tsx +32 -0
  94. package/src/components/ui/table.tsx +114 -0
  95. package/src/components/ui/tabs.tsx +82 -0
  96. package/src/components/ui/textarea.tsx +18 -0
  97. package/src/components/ui/toggle-group.tsx +87 -0
  98. package/src/components/ui/toggle.tsx +43 -0
  99. package/src/components/ui/tooltip.tsx +66 -0
  100. package/src/hooks/use-mobile.ts +19 -0
  101. package/src/index.tsx +17 -0
  102. package/src/lib/utils.ts +19 -0
  103. package/src/pages/blog-posts/create.tsx +177 -0
  104. package/src/pages/blog-posts/edit.tsx +197 -0
  105. package/src/pages/blog-posts/index.ts +4 -0
  106. package/src/pages/blog-posts/list.tsx +131 -0
  107. package/src/pages/blog-posts/show.tsx +81 -0
  108. package/src/pages/categories/create.tsx +73 -0
  109. package/src/pages/categories/edit.tsx +73 -0
  110. package/src/pages/categories/index.ts +4 -0
  111. package/src/pages/categories/list.tsx +86 -0
  112. package/src/pages/categories/show.tsx +37 -0
  113. package/src/pages/forgot-password/index.tsx +6 -0
  114. package/src/pages/forgotPassword/index.tsx +5 -0
  115. package/src/pages/login/index.tsx +5 -0
  116. package/src/pages/register/index.tsx +5 -0
  117. package/src/providers/auth.ts +204 -0
  118. package/src/providers/constants.ts +75 -0
  119. package/src/providers/data.ts +232 -0
  120. package/src/vite-env.d.ts +1 -0
  121. package/tsconfig.json +25 -0
  122. package/tsconfig.node.json +21 -0
  123. package/vite.config.ts +74 -0
@@ -0,0 +1,373 @@
1
+ "use client"
2
+
3
+ import * as React from "react"
4
+ import * as RechartsPrimitive from "recharts"
5
+ import type { TooltipValueType } from "recharts"
6
+
7
+ import { cn } from "@/lib/utils"
8
+
9
+ // Format: { THEME_NAME: CSS_SELECTOR }
10
+ const THEMES = { light: "", dark: ".dark" } as const
11
+
12
+ const INITIAL_DIMENSION = { width: 320, height: 200 } as const
13
+ type TooltipNameType = number | string
14
+
15
+ export type ChartConfig = Record<
16
+ string,
17
+ {
18
+ label?: React.ReactNode
19
+ icon?: React.ComponentType
20
+ } & (
21
+ | { color?: string; theme?: never }
22
+ | { color?: never; theme: Record<keyof typeof THEMES, string> }
23
+ )
24
+ >
25
+
26
+ type ChartContextProps = {
27
+ config: ChartConfig
28
+ }
29
+
30
+ const ChartContext = React.createContext<ChartContextProps | null>(null)
31
+
32
+ function useChart() {
33
+ const context = React.useContext(ChartContext)
34
+
35
+ if (!context) {
36
+ throw new Error("useChart must be used within a <ChartContainer />")
37
+ }
38
+
39
+ return context
40
+ }
41
+
42
+ function ChartContainer({
43
+ id,
44
+ className,
45
+ children,
46
+ config,
47
+ initialDimension = INITIAL_DIMENSION,
48
+ ...props
49
+ }: React.ComponentProps<"div"> & {
50
+ config: ChartConfig
51
+ children: React.ComponentProps<
52
+ typeof RechartsPrimitive.ResponsiveContainer
53
+ >["children"]
54
+ initialDimension?: {
55
+ width: number
56
+ height: number
57
+ }
58
+ }) {
59
+ const uniqueId = React.useId()
60
+ const chartId = `chart-${id ?? uniqueId.replace(/:/g, "")}`
61
+
62
+ return (
63
+ <ChartContext.Provider value={{ config }}>
64
+ <div
65
+ data-slot="chart"
66
+ data-chart={chartId}
67
+ className={cn(
68
+ "flex aspect-video justify-center text-xs [&_.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-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-hidden [&_.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 [&_.recharts-sector]:outline-hidden [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-surface]:outline-hidden",
69
+ className
70
+ )}
71
+ {...props}
72
+ >
73
+ <ChartStyle id={chartId} config={config} />
74
+ <RechartsPrimitive.ResponsiveContainer
75
+ initialDimension={initialDimension}
76
+ >
77
+ {children}
78
+ </RechartsPrimitive.ResponsiveContainer>
79
+ </div>
80
+ </ChartContext.Provider>
81
+ )
82
+ }
83
+
84
+ const ChartStyle = ({ id, config }: { id: string; config: ChartConfig }) => {
85
+ const colorConfig = Object.entries(config).filter(
86
+ ([, config]) => config.theme ?? config.color
87
+ )
88
+
89
+ if (!colorConfig.length) {
90
+ return null
91
+ }
92
+
93
+ return (
94
+ <style
95
+ dangerouslySetInnerHTML={{
96
+ __html: Object.entries(THEMES)
97
+ .map(
98
+ ([theme, prefix]) => `
99
+ ${prefix} [data-chart=${id}] {
100
+ ${colorConfig
101
+ .map(([key, itemConfig]) => {
102
+ const color =
103
+ itemConfig.theme?.[theme as keyof typeof itemConfig.theme] ??
104
+ itemConfig.color
105
+ return color ? ` --color-${key}: ${color};` : null
106
+ })
107
+ .join("\n")}
108
+ }
109
+ `
110
+ )
111
+ .join("\n"),
112
+ }}
113
+ />
114
+ )
115
+ }
116
+
117
+ const ChartTooltip = RechartsPrimitive.Tooltip
118
+
119
+ function ChartTooltipContent({
120
+ active,
121
+ payload,
122
+ className,
123
+ indicator = "dot",
124
+ hideLabel = false,
125
+ hideIndicator = false,
126
+ label,
127
+ labelFormatter,
128
+ labelClassName,
129
+ formatter,
130
+ color,
131
+ nameKey,
132
+ labelKey,
133
+ }: React.ComponentProps<typeof RechartsPrimitive.Tooltip> &
134
+ React.ComponentProps<"div"> & {
135
+ hideLabel?: boolean
136
+ hideIndicator?: boolean
137
+ indicator?: "line" | "dot" | "dashed"
138
+ nameKey?: string
139
+ labelKey?: string
140
+ } & Omit<
141
+ RechartsPrimitive.DefaultTooltipContentProps<
142
+ TooltipValueType,
143
+ TooltipNameType
144
+ >,
145
+ "accessibilityLayer"
146
+ >) {
147
+ const { config } = useChart()
148
+
149
+ const tooltipLabel = React.useMemo(() => {
150
+ if (hideLabel || !payload?.length) {
151
+ return null
152
+ }
153
+
154
+ const [item] = payload
155
+ const key = `${labelKey ?? item?.dataKey ?? item?.name ?? "value"}`
156
+ const itemConfig = getPayloadConfigFromPayload(config, item, key)
157
+ const value =
158
+ !labelKey && typeof label === "string"
159
+ ? (config[label]?.label ?? label)
160
+ : itemConfig?.label
161
+
162
+ if (labelFormatter) {
163
+ return (
164
+ <div className={cn("font-medium", labelClassName)}>
165
+ {labelFormatter(value, payload)}
166
+ </div>
167
+ )
168
+ }
169
+
170
+ if (!value) {
171
+ return null
172
+ }
173
+
174
+ return <div className={cn("font-medium", labelClassName)}>{value}</div>
175
+ }, [
176
+ label,
177
+ labelFormatter,
178
+ payload,
179
+ hideLabel,
180
+ labelClassName,
181
+ config,
182
+ labelKey,
183
+ ])
184
+
185
+ if (!active || !payload?.length) {
186
+ return null
187
+ }
188
+
189
+ const nestLabel = payload.length === 1 && indicator !== "dot"
190
+
191
+ return (
192
+ <div
193
+ className={cn(
194
+ "grid min-w-32 items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl",
195
+ className
196
+ )}
197
+ >
198
+ {!nestLabel ? tooltipLabel : null}
199
+ <div className="grid gap-1.5">
200
+ {payload
201
+ .filter((item) => item.type !== "none")
202
+ .map((item, index) => {
203
+ const key = `${nameKey ?? item.name ?? item.dataKey ?? "value"}`
204
+ const itemConfig = getPayloadConfigFromPayload(config, item, key)
205
+ const indicatorColor = color ?? item.payload?.fill ?? item.color
206
+
207
+ return (
208
+ <div
209
+ key={index}
210
+ className={cn(
211
+ "flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground",
212
+ indicator === "dot" && "items-center"
213
+ )}
214
+ >
215
+ {formatter && item?.value !== undefined && item.name ? (
216
+ formatter(item.value, item.name, item, index, item.payload)
217
+ ) : (
218
+ <>
219
+ {itemConfig?.icon ? (
220
+ <itemConfig.icon />
221
+ ) : (
222
+ !hideIndicator && (
223
+ <div
224
+ className={cn(
225
+ "shrink-0 rounded-[2px] border-(--color-border) bg-(--color-bg)",
226
+ {
227
+ "h-2.5 w-2.5": indicator === "dot",
228
+ "w-1": indicator === "line",
229
+ "w-0 border-[1.5px] border-dashed bg-transparent":
230
+ indicator === "dashed",
231
+ "my-0.5": nestLabel && indicator === "dashed",
232
+ }
233
+ )}
234
+ style={
235
+ {
236
+ "--color-bg": indicatorColor,
237
+ "--color-border": indicatorColor,
238
+ } as React.CSSProperties
239
+ }
240
+ />
241
+ )
242
+ )}
243
+ <div
244
+ className={cn(
245
+ "flex flex-1 justify-between leading-none",
246
+ nestLabel ? "items-end" : "items-center"
247
+ )}
248
+ >
249
+ <div className="grid gap-1.5">
250
+ {nestLabel ? tooltipLabel : null}
251
+ <span className="text-muted-foreground">
252
+ {itemConfig?.label ?? item.name}
253
+ </span>
254
+ </div>
255
+ {item.value != null && (
256
+ <span className="font-mono font-medium text-foreground tabular-nums">
257
+ {typeof item.value === "number"
258
+ ? item.value.toLocaleString()
259
+ : String(item.value)}
260
+ </span>
261
+ )}
262
+ </div>
263
+ </>
264
+ )}
265
+ </div>
266
+ )
267
+ })}
268
+ </div>
269
+ </div>
270
+ )
271
+ }
272
+
273
+ const ChartLegend = RechartsPrimitive.Legend
274
+
275
+ function ChartLegendContent({
276
+ className,
277
+ hideIcon = false,
278
+ payload,
279
+ verticalAlign = "bottom",
280
+ nameKey,
281
+ }: React.ComponentProps<"div"> & {
282
+ hideIcon?: boolean
283
+ nameKey?: string
284
+ } & RechartsPrimitive.DefaultLegendContentProps) {
285
+ const { config } = useChart()
286
+
287
+ if (!payload?.length) {
288
+ return null
289
+ }
290
+
291
+ return (
292
+ <div
293
+ className={cn(
294
+ "flex items-center justify-center gap-4",
295
+ verticalAlign === "top" ? "pb-3" : "pt-3",
296
+ className
297
+ )}
298
+ >
299
+ {payload
300
+ .filter((item) => item.type !== "none")
301
+ .map((item, index) => {
302
+ const key = `${nameKey ?? item.dataKey ?? "value"}`
303
+ const itemConfig = getPayloadConfigFromPayload(config, item, key)
304
+
305
+ return (
306
+ <div
307
+ key={index}
308
+ className={cn(
309
+ "flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground"
310
+ )}
311
+ >
312
+ {itemConfig?.icon && !hideIcon ? (
313
+ <itemConfig.icon />
314
+ ) : (
315
+ <div
316
+ className="h-2 w-2 shrink-0 rounded-[2px]"
317
+ style={{
318
+ backgroundColor: item.color,
319
+ }}
320
+ />
321
+ )}
322
+ {itemConfig?.label}
323
+ </div>
324
+ )
325
+ })}
326
+ </div>
327
+ )
328
+ }
329
+
330
+ function getPayloadConfigFromPayload(
331
+ config: ChartConfig,
332
+ payload: unknown,
333
+ key: string
334
+ ) {
335
+ if (typeof payload !== "object" || payload === null) {
336
+ return undefined
337
+ }
338
+
339
+ const payloadPayload =
340
+ "payload" in payload &&
341
+ typeof payload.payload === "object" &&
342
+ payload.payload !== null
343
+ ? payload.payload
344
+ : undefined
345
+
346
+ let configLabelKey: string = key
347
+
348
+ if (
349
+ key in payload &&
350
+ typeof payload[key as keyof typeof payload] === "string"
351
+ ) {
352
+ configLabelKey = payload[key as keyof typeof payload] as string
353
+ } else if (
354
+ payloadPayload &&
355
+ key in payloadPayload &&
356
+ typeof payloadPayload[key as keyof typeof payloadPayload] === "string"
357
+ ) {
358
+ configLabelKey = payloadPayload[
359
+ key as keyof typeof payloadPayload
360
+ ] as string
361
+ }
362
+
363
+ return configLabelKey in config ? config[configLabelKey] : config[key]
364
+ }
365
+
366
+ export {
367
+ ChartContainer,
368
+ ChartTooltip,
369
+ ChartTooltipContent,
370
+ ChartLegend,
371
+ ChartLegendContent,
372
+ ChartStyle,
373
+ }
@@ -0,0 +1,29 @@
1
+ "use client"
2
+
3
+ import { Checkbox as CheckboxPrimitive } from "@base-ui/react/checkbox"
4
+
5
+ import { cn } from "@/lib/utils"
6
+ import { CheckIcon } from "lucide-react"
7
+
8
+ function Checkbox({ className, ...props }: CheckboxPrimitive.Root.Props) {
9
+ return (
10
+ <CheckboxPrimitive.Root
11
+ data-slot="checkbox"
12
+ className={cn(
13
+ "peer relative flex size-4 shrink-0 items-center justify-center rounded-[4px] border border-input transition-colors outline-none group-has-disabled/field:opacity-50 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground dark:data-checked:bg-primary",
14
+ className
15
+ )}
16
+ {...props}
17
+ >
18
+ <CheckboxPrimitive.Indicator
19
+ data-slot="checkbox-indicator"
20
+ className="grid place-content-center text-current transition-none [&>svg]:size-3.5"
21
+ >
22
+ <CheckIcon
23
+ />
24
+ </CheckboxPrimitive.Indicator>
25
+ </CheckboxPrimitive.Root>
26
+ )
27
+ }
28
+
29
+ export { Checkbox }
@@ -0,0 +1,19 @@
1
+ import { Collapsible as CollapsiblePrimitive } from "@base-ui/react/collapsible"
2
+
3
+ function Collapsible({ ...props }: CollapsiblePrimitive.Root.Props) {
4
+ return <CollapsiblePrimitive.Root data-slot="collapsible" {...props} />
5
+ }
6
+
7
+ function CollapsibleTrigger({ ...props }: CollapsiblePrimitive.Trigger.Props) {
8
+ return (
9
+ <CollapsiblePrimitive.Trigger data-slot="collapsible-trigger" {...props} />
10
+ )
11
+ }
12
+
13
+ function CollapsibleContent({ ...props }: CollapsiblePrimitive.Panel.Props) {
14
+ return (
15
+ <CollapsiblePrimitive.Panel data-slot="collapsible-content" {...props} />
16
+ )
17
+ }
18
+
19
+ export { Collapsible, CollapsibleTrigger, CollapsibleContent }
@@ -0,0 +1,192 @@
1
+ import * as React from "react"
2
+ import { Combobox as ComboboxPrimitive } from "@base-ui/react/combobox"
3
+
4
+ import { cn } from "@/lib/utils"
5
+ import {
6
+ Dialog,
7
+ DialogContent,
8
+ DialogDescription,
9
+ DialogHeader,
10
+ DialogTitle,
11
+ } from "@/components/ui/dialog"
12
+ import { InputGroup, InputGroupAddon } from "@/components/ui/input-group"
13
+ import { SearchIcon } from "lucide-react"
14
+
15
+ type CommandProps<Value> = ComboboxPrimitive.Root.Props<Value> & {
16
+ className?: string
17
+ }
18
+
19
+ function Command<Value>({ className, children, ...props }: CommandProps<Value>) {
20
+ return (
21
+ <ComboboxPrimitive.Root
22
+ inline
23
+ open
24
+ autoHighlight
25
+ value={null}
26
+ {...props}
27
+ >
28
+ <div
29
+ data-slot="command"
30
+ className={cn(
31
+ "flex size-full flex-col overflow-hidden rounded-xl! bg-popover p-1 text-popover-foreground",
32
+ className
33
+ )}
34
+ >
35
+ {children}
36
+ </div>
37
+ </ComboboxPrimitive.Root>
38
+ )
39
+ }
40
+
41
+ function CommandDialog({
42
+ title = "Command Palette",
43
+ description = "Search for a command to run...",
44
+ children,
45
+ className,
46
+ showCloseButton = false,
47
+ ...props
48
+ }: Omit<React.ComponentProps<typeof Dialog>, "children"> & {
49
+ title?: string
50
+ description?: string
51
+ className?: string
52
+ showCloseButton?: boolean
53
+ children: React.ReactNode
54
+ }) {
55
+ return (
56
+ <Dialog {...props}>
57
+ <DialogHeader className="sr-only">
58
+ <DialogTitle>{title}</DialogTitle>
59
+ <DialogDescription>{description}</DialogDescription>
60
+ </DialogHeader>
61
+ <DialogContent
62
+ className={cn(
63
+ "top-1/3 translate-y-0 overflow-hidden rounded-xl! p-0",
64
+ className
65
+ )}
66
+ showCloseButton={showCloseButton}
67
+ >
68
+ {children}
69
+ </DialogContent>
70
+ </Dialog>
71
+ )
72
+ }
73
+
74
+ function CommandInput({
75
+ className,
76
+ ...props
77
+ }: ComboboxPrimitive.Input.Props) {
78
+ return (
79
+ <div data-slot="command-input-wrapper" className="p-1 pb-0">
80
+ <InputGroup className="h-8! rounded-lg! border-input/30 bg-input/30 shadow-none! *:data-[slot=input-group-addon]:pl-2!">
81
+ <ComboboxPrimitive.Input
82
+ data-slot="command-input"
83
+ className={cn(
84
+ "w-full text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50",
85
+ className
86
+ )}
87
+ {...props}
88
+ />
89
+ <InputGroupAddon>
90
+ <SearchIcon className="size-4 shrink-0 opacity-50" />
91
+ </InputGroupAddon>
92
+ </InputGroup>
93
+ </div>
94
+ )
95
+ }
96
+
97
+ function CommandList({
98
+ className,
99
+ ...props
100
+ }: ComboboxPrimitive.List.Props) {
101
+ return (
102
+ <ComboboxPrimitive.List
103
+ data-slot="command-list"
104
+ className={cn(
105
+ "no-scrollbar max-h-72 scroll-py-1 overflow-x-hidden overflow-y-auto outline-none",
106
+ className
107
+ )}
108
+ {...props}
109
+ />
110
+ )
111
+ }
112
+
113
+ function CommandEmpty({
114
+ className,
115
+ ...props
116
+ }: ComboboxPrimitive.Empty.Props) {
117
+ return (
118
+ <ComboboxPrimitive.Empty
119
+ data-slot="command-empty"
120
+ className={cn("py-6 text-center text-sm", className)}
121
+ {...props}
122
+ />
123
+ )
124
+ }
125
+
126
+ function CommandGroup({
127
+ className,
128
+ ...props
129
+ }: ComboboxPrimitive.Group.Props) {
130
+ return (
131
+ <ComboboxPrimitive.Group
132
+ data-slot="command-group"
133
+ className={cn("overflow-hidden p-1 text-foreground", className)}
134
+ {...props}
135
+ />
136
+ )
137
+ }
138
+
139
+ function CommandSeparator({
140
+ className,
141
+ ...props
142
+ }: React.ComponentProps<"div">) {
143
+ return (
144
+ <div
145
+ data-slot="command-separator"
146
+ role="separator"
147
+ className={cn("-mx-1 h-px bg-border", className)}
148
+ {...props}
149
+ />
150
+ )
151
+ }
152
+
153
+ function CommandItem({
154
+ className,
155
+ ...props
156
+ }: ComboboxPrimitive.Item.Props) {
157
+ return (
158
+ <ComboboxPrimitive.Item
159
+ data-slot="command-item"
160
+ className={cn(
161
+ "group/command-item relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none in-data-[slot=dialog-content]:rounded-lg! data-disabled:pointer-events-none data-disabled:opacity-50 data-highlighted:bg-muted data-highlighted:text-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
162
+ className
163
+ )}
164
+ {...props}
165
+ />
166
+ )
167
+ }
168
+
169
+ function CommandShortcut({
170
+ className,
171
+ ...props
172
+ }: React.ComponentProps<"span">) {
173
+ return (
174
+ <span
175
+ data-slot="command-shortcut"
176
+ className={cn("ml-auto text-xs tracking-widest text-muted-foreground", className)}
177
+ {...props}
178
+ />
179
+ )
180
+ }
181
+
182
+ export {
183
+ Command,
184
+ CommandDialog,
185
+ CommandInput,
186
+ CommandList,
187
+ CommandEmpty,
188
+ CommandGroup,
189
+ CommandItem,
190
+ CommandShortcut,
191
+ CommandSeparator,
192
+ }