vite-shadcn-ui-cli 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.
- package/README.md +52 -0
- package/components.json +21 -0
- package/eslint.config.js +28 -0
- package/index.html +13 -0
- package/package.json +55 -0
- package/postcss.config.js +6 -0
- package/public/vite.svg +1 -0
- package/src/App.css +5 -0
- package/src/App.tsx +14 -0
- package/src/assets/react.svg +1 -0
- package/src/components/ui/accordion.tsx +58 -0
- package/src/components/ui/alert-dialog.tsx +141 -0
- package/src/components/ui/alert.tsx +59 -0
- package/src/components/ui/aspect-ratio.tsx +7 -0
- package/src/components/ui/avatar.tsx +50 -0
- package/src/components/ui/badge.tsx +36 -0
- package/src/components/ui/breadcrumb.tsx +115 -0
- package/src/components/ui/button.tsx +57 -0
- package/src/components/ui/calendar.tsx +66 -0
- package/src/components/ui/card.tsx +79 -0
- package/src/components/ui/carousel.tsx +262 -0
- package/src/components/ui/chart.tsx +365 -0
- package/src/components/ui/checkbox.tsx +30 -0
- package/src/components/ui/collapsible.tsx +11 -0
- package/src/components/ui/command.tsx +155 -0
- package/src/components/ui/context-menu.tsx +200 -0
- package/src/components/ui/dialog.tsx +122 -0
- package/src/components/ui/drawer.tsx +118 -0
- package/src/components/ui/dropdown-menu.tsx +200 -0
- package/src/components/ui/form.tsx +178 -0
- package/src/components/ui/hover-card.tsx +29 -0
- package/src/components/ui/input-otp.tsx +71 -0
- package/src/components/ui/input.tsx +25 -0
- package/src/components/ui/label.tsx +26 -0
- package/src/components/ui/menubar.tsx +236 -0
- package/src/components/ui/navigation-menu.tsx +128 -0
- package/src/components/ui/pagination.tsx +67 -0
- package/src/components/ui/popover.tsx +31 -0
- package/src/components/ui/progress.tsx +28 -0
- package/src/components/ui/radio-group.tsx +44 -0
- package/src/components/ui/resizable.tsx +45 -0
- package/src/components/ui/scroll-area.tsx +48 -0
- package/src/components/ui/select.tsx +160 -0
- package/src/components/ui/separator.tsx +31 -0
- package/src/components/ui/sheet.tsx +140 -0
- package/src/components/ui/skeleton.tsx +15 -0
- package/src/components/ui/slider.tsx +28 -0
- package/src/components/ui/sonner.tsx +31 -0
- package/src/components/ui/switch.tsx +29 -0
- package/src/components/ui/table.tsx +117 -0
- package/src/components/ui/tabs.tsx +55 -0
- package/src/components/ui/textarea.tsx +24 -0
- package/src/components/ui/toast.tsx +129 -0
- package/src/components/ui/toaster.tsx +35 -0
- package/src/components/ui/toggle-group.tsx +61 -0
- package/src/components/ui/toggle.tsx +45 -0
- package/src/components/ui/tooltip.tsx +30 -0
- package/src/index.css +93 -0
- package/src/lib/utils.ts +6 -0
- package/src/main.tsx +10 -0
- package/src/vite-env.d.ts +1 -0
- package/tailwind.config.js +57 -0
- package/tsconfig.app.json +32 -0
- package/tsconfig.json +17 -0
- package/tsconfig.node.json +24 -0
- package/vite.config.ts +12 -0
@@ -0,0 +1,365 @@
|
|
1
|
+
"use client"
|
2
|
+
|
3
|
+
import * as React from "react"
|
4
|
+
import * as RechartsPrimitive from "recharts"
|
5
|
+
|
6
|
+
import { cn } from "@/lib/utils"
|
7
|
+
|
8
|
+
// Format: { THEME_NAME: CSS_SELECTOR }
|
9
|
+
const THEMES = { light: "", dark: ".dark" } as const
|
10
|
+
|
11
|
+
export type ChartConfig = {
|
12
|
+
[k in string]: {
|
13
|
+
label?: React.ReactNode
|
14
|
+
icon?: React.ComponentType
|
15
|
+
} & (
|
16
|
+
| { color?: string; theme?: never }
|
17
|
+
| { color?: never; theme: Record<keyof typeof THEMES, string> }
|
18
|
+
)
|
19
|
+
}
|
20
|
+
|
21
|
+
type ChartContextProps = {
|
22
|
+
config: ChartConfig
|
23
|
+
}
|
24
|
+
|
25
|
+
const ChartContext = React.createContext<ChartContextProps | null>(null)
|
26
|
+
|
27
|
+
function useChart() {
|
28
|
+
const context = React.useContext(ChartContext)
|
29
|
+
|
30
|
+
if (!context) {
|
31
|
+
throw new Error("useChart must be used within a <ChartContainer />")
|
32
|
+
}
|
33
|
+
|
34
|
+
return context
|
35
|
+
}
|
36
|
+
|
37
|
+
const ChartContainer = React.forwardRef<
|
38
|
+
HTMLDivElement,
|
39
|
+
React.ComponentProps<"div"> & {
|
40
|
+
config: ChartConfig
|
41
|
+
children: React.ComponentProps<
|
42
|
+
typeof RechartsPrimitive.ResponsiveContainer
|
43
|
+
>["children"]
|
44
|
+
}
|
45
|
+
>(({ id, className, children, config, ...props }, ref) => {
|
46
|
+
const uniqueId = React.useId()
|
47
|
+
const chartId = `chart-${id || uniqueId.replace(/:/g, "")}`
|
48
|
+
|
49
|
+
return (
|
50
|
+
<ChartContext.Provider value={{ config }}>
|
51
|
+
<div
|
52
|
+
data-chart={chartId}
|
53
|
+
ref={ref}
|
54
|
+
className={cn(
|
55
|
+
"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-none [&_.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[stroke='#fff']]:stroke-transparent [&_.recharts-sector]:outline-none [&_.recharts-surface]:outline-none",
|
56
|
+
className
|
57
|
+
)}
|
58
|
+
{...props}
|
59
|
+
>
|
60
|
+
<ChartStyle id={chartId} config={config} />
|
61
|
+
<RechartsPrimitive.ResponsiveContainer>
|
62
|
+
{children}
|
63
|
+
</RechartsPrimitive.ResponsiveContainer>
|
64
|
+
</div>
|
65
|
+
</ChartContext.Provider>
|
66
|
+
)
|
67
|
+
})
|
68
|
+
ChartContainer.displayName = "Chart"
|
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
|
+
const ChartTooltipContent = React.forwardRef<
|
106
|
+
HTMLDivElement,
|
107
|
+
React.ComponentProps<typeof RechartsPrimitive.Tooltip> &
|
108
|
+
React.ComponentProps<"div"> & {
|
109
|
+
hideLabel?: boolean
|
110
|
+
hideIndicator?: boolean
|
111
|
+
indicator?: "line" | "dot" | "dashed"
|
112
|
+
nameKey?: string
|
113
|
+
labelKey?: string
|
114
|
+
}
|
115
|
+
>(
|
116
|
+
(
|
117
|
+
{
|
118
|
+
active,
|
119
|
+
payload,
|
120
|
+
className,
|
121
|
+
indicator = "dot",
|
122
|
+
hideLabel = false,
|
123
|
+
hideIndicator = false,
|
124
|
+
label,
|
125
|
+
labelFormatter,
|
126
|
+
labelClassName,
|
127
|
+
formatter,
|
128
|
+
color,
|
129
|
+
nameKey,
|
130
|
+
labelKey,
|
131
|
+
},
|
132
|
+
ref
|
133
|
+
) => {
|
134
|
+
const { config } = useChart()
|
135
|
+
|
136
|
+
const tooltipLabel = React.useMemo(() => {
|
137
|
+
if (hideLabel || !payload?.length) {
|
138
|
+
return null
|
139
|
+
}
|
140
|
+
|
141
|
+
const [item] = payload
|
142
|
+
const key = `${labelKey || item.dataKey || item.name || "value"}`
|
143
|
+
const itemConfig = getPayloadConfigFromPayload(config, item, key)
|
144
|
+
const value =
|
145
|
+
!labelKey && typeof label === "string"
|
146
|
+
? config[label as keyof typeof config]?.label || label
|
147
|
+
: itemConfig?.label
|
148
|
+
|
149
|
+
if (labelFormatter) {
|
150
|
+
return (
|
151
|
+
<div className={cn("font-medium", labelClassName)}>
|
152
|
+
{labelFormatter(value, payload)}
|
153
|
+
</div>
|
154
|
+
)
|
155
|
+
}
|
156
|
+
|
157
|
+
if (!value) {
|
158
|
+
return null
|
159
|
+
}
|
160
|
+
|
161
|
+
return <div className={cn("font-medium", labelClassName)}>{value}</div>
|
162
|
+
}, [
|
163
|
+
label,
|
164
|
+
labelFormatter,
|
165
|
+
payload,
|
166
|
+
hideLabel,
|
167
|
+
labelClassName,
|
168
|
+
config,
|
169
|
+
labelKey,
|
170
|
+
])
|
171
|
+
|
172
|
+
if (!active || !payload?.length) {
|
173
|
+
return null
|
174
|
+
}
|
175
|
+
|
176
|
+
const nestLabel = payload.length === 1 && indicator !== "dot"
|
177
|
+
|
178
|
+
return (
|
179
|
+
<div
|
180
|
+
ref={ref}
|
181
|
+
className={cn(
|
182
|
+
"grid min-w-[8rem] items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl",
|
183
|
+
className
|
184
|
+
)}
|
185
|
+
>
|
186
|
+
{!nestLabel ? tooltipLabel : null}
|
187
|
+
<div className="grid gap-1.5">
|
188
|
+
{payload.map((item, index) => {
|
189
|
+
const key = `${nameKey || item.name || item.dataKey || "value"}`
|
190
|
+
const itemConfig = getPayloadConfigFromPayload(config, item, key)
|
191
|
+
const indicatorColor = color || item.payload.fill || item.color
|
192
|
+
|
193
|
+
return (
|
194
|
+
<div
|
195
|
+
key={item.dataKey}
|
196
|
+
className={cn(
|
197
|
+
"flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground",
|
198
|
+
indicator === "dot" && "items-center"
|
199
|
+
)}
|
200
|
+
>
|
201
|
+
{formatter && item?.value !== undefined && item.name ? (
|
202
|
+
formatter(item.value, item.name, item, index, item.payload)
|
203
|
+
) : (
|
204
|
+
<>
|
205
|
+
{itemConfig?.icon ? (
|
206
|
+
<itemConfig.icon />
|
207
|
+
) : (
|
208
|
+
!hideIndicator && (
|
209
|
+
<div
|
210
|
+
className={cn(
|
211
|
+
"shrink-0 rounded-[2px] border-[--color-border] bg-[--color-bg]",
|
212
|
+
{
|
213
|
+
"h-2.5 w-2.5": indicator === "dot",
|
214
|
+
"w-1": indicator === "line",
|
215
|
+
"w-0 border-[1.5px] border-dashed bg-transparent":
|
216
|
+
indicator === "dashed",
|
217
|
+
"my-0.5": nestLabel && indicator === "dashed",
|
218
|
+
}
|
219
|
+
)}
|
220
|
+
style={
|
221
|
+
{
|
222
|
+
"--color-bg": indicatorColor,
|
223
|
+
"--color-border": indicatorColor,
|
224
|
+
} as React.CSSProperties
|
225
|
+
}
|
226
|
+
/>
|
227
|
+
)
|
228
|
+
)}
|
229
|
+
<div
|
230
|
+
className={cn(
|
231
|
+
"flex flex-1 justify-between leading-none",
|
232
|
+
nestLabel ? "items-end" : "items-center"
|
233
|
+
)}
|
234
|
+
>
|
235
|
+
<div className="grid gap-1.5">
|
236
|
+
{nestLabel ? tooltipLabel : null}
|
237
|
+
<span className="text-muted-foreground">
|
238
|
+
{itemConfig?.label || item.name}
|
239
|
+
</span>
|
240
|
+
</div>
|
241
|
+
{item.value && (
|
242
|
+
<span className="font-mono font-medium tabular-nums text-foreground">
|
243
|
+
{item.value.toLocaleString()}
|
244
|
+
</span>
|
245
|
+
)}
|
246
|
+
</div>
|
247
|
+
</>
|
248
|
+
)}
|
249
|
+
</div>
|
250
|
+
)
|
251
|
+
})}
|
252
|
+
</div>
|
253
|
+
</div>
|
254
|
+
)
|
255
|
+
}
|
256
|
+
)
|
257
|
+
ChartTooltipContent.displayName = "ChartTooltip"
|
258
|
+
|
259
|
+
const ChartLegend = RechartsPrimitive.Legend
|
260
|
+
|
261
|
+
const ChartLegendContent = React.forwardRef<
|
262
|
+
HTMLDivElement,
|
263
|
+
React.ComponentProps<"div"> &
|
264
|
+
Pick<RechartsPrimitive.LegendProps, "payload" | "verticalAlign"> & {
|
265
|
+
hideIcon?: boolean
|
266
|
+
nameKey?: string
|
267
|
+
}
|
268
|
+
>(
|
269
|
+
(
|
270
|
+
{ className, hideIcon = false, payload, verticalAlign = "bottom", nameKey },
|
271
|
+
ref
|
272
|
+
) => {
|
273
|
+
const { config } = useChart()
|
274
|
+
|
275
|
+
if (!payload?.length) {
|
276
|
+
return null
|
277
|
+
}
|
278
|
+
|
279
|
+
return (
|
280
|
+
<div
|
281
|
+
ref={ref}
|
282
|
+
className={cn(
|
283
|
+
"flex items-center justify-center gap-4",
|
284
|
+
verticalAlign === "top" ? "pb-3" : "pt-3",
|
285
|
+
className
|
286
|
+
)}
|
287
|
+
>
|
288
|
+
{payload.map((item) => {
|
289
|
+
const key = `${nameKey || item.dataKey || "value"}`
|
290
|
+
const itemConfig = getPayloadConfigFromPayload(config, item, key)
|
291
|
+
|
292
|
+
return (
|
293
|
+
<div
|
294
|
+
key={item.value}
|
295
|
+
className={cn(
|
296
|
+
"flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground"
|
297
|
+
)}
|
298
|
+
>
|
299
|
+
{itemConfig?.icon && !hideIcon ? (
|
300
|
+
<itemConfig.icon />
|
301
|
+
) : (
|
302
|
+
<div
|
303
|
+
className="h-2 w-2 shrink-0 rounded-[2px]"
|
304
|
+
style={{
|
305
|
+
backgroundColor: item.color,
|
306
|
+
}}
|
307
|
+
/>
|
308
|
+
)}
|
309
|
+
{itemConfig?.label}
|
310
|
+
</div>
|
311
|
+
)
|
312
|
+
})}
|
313
|
+
</div>
|
314
|
+
)
|
315
|
+
}
|
316
|
+
)
|
317
|
+
ChartLegendContent.displayName = "ChartLegend"
|
318
|
+
|
319
|
+
// Helper to extract item config from a payload.
|
320
|
+
function getPayloadConfigFromPayload(
|
321
|
+
config: ChartConfig,
|
322
|
+
payload: unknown,
|
323
|
+
key: string
|
324
|
+
) {
|
325
|
+
if (typeof payload !== "object" || payload === null) {
|
326
|
+
return undefined
|
327
|
+
}
|
328
|
+
|
329
|
+
const payloadPayload =
|
330
|
+
"payload" in payload &&
|
331
|
+
typeof payload.payload === "object" &&
|
332
|
+
payload.payload !== null
|
333
|
+
? payload.payload
|
334
|
+
: undefined
|
335
|
+
|
336
|
+
let configLabelKey: string = key
|
337
|
+
|
338
|
+
if (
|
339
|
+
key in payload &&
|
340
|
+
typeof payload[key as keyof typeof payload] === "string"
|
341
|
+
) {
|
342
|
+
configLabelKey = payload[key as keyof typeof payload] as string
|
343
|
+
} else if (
|
344
|
+
payloadPayload &&
|
345
|
+
key in payloadPayload &&
|
346
|
+
typeof payloadPayload[key as keyof typeof payloadPayload] === "string"
|
347
|
+
) {
|
348
|
+
configLabelKey = payloadPayload[
|
349
|
+
key as keyof typeof payloadPayload
|
350
|
+
] as string
|
351
|
+
}
|
352
|
+
|
353
|
+
return configLabelKey in config
|
354
|
+
? config[configLabelKey]
|
355
|
+
: config[key as keyof typeof config]
|
356
|
+
}
|
357
|
+
|
358
|
+
export {
|
359
|
+
ChartContainer,
|
360
|
+
ChartTooltip,
|
361
|
+
ChartTooltipContent,
|
362
|
+
ChartLegend,
|
363
|
+
ChartLegendContent,
|
364
|
+
ChartStyle,
|
365
|
+
}
|
@@ -0,0 +1,30 @@
|
|
1
|
+
"use client"
|
2
|
+
|
3
|
+
import * as React from "react"
|
4
|
+
import * as CheckboxPrimitive from "@radix-ui/react-checkbox"
|
5
|
+
import { Check } from "lucide-react"
|
6
|
+
|
7
|
+
import { cn } from "@/lib/utils"
|
8
|
+
|
9
|
+
const Checkbox = React.forwardRef<
|
10
|
+
React.ElementRef<typeof CheckboxPrimitive.Root>,
|
11
|
+
React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root>
|
12
|
+
>(({ className, ...props }, ref) => (
|
13
|
+
<CheckboxPrimitive.Root
|
14
|
+
ref={ref}
|
15
|
+
className={cn(
|
16
|
+
"peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",
|
17
|
+
className
|
18
|
+
)}
|
19
|
+
{...props}
|
20
|
+
>
|
21
|
+
<CheckboxPrimitive.Indicator
|
22
|
+
className={cn("flex items-center justify-center text-current")}
|
23
|
+
>
|
24
|
+
<Check className="h-4 w-4" />
|
25
|
+
</CheckboxPrimitive.Indicator>
|
26
|
+
</CheckboxPrimitive.Root>
|
27
|
+
))
|
28
|
+
Checkbox.displayName = CheckboxPrimitive.Root.displayName
|
29
|
+
|
30
|
+
export { Checkbox }
|
@@ -0,0 +1,11 @@
|
|
1
|
+
"use client"
|
2
|
+
|
3
|
+
import * as CollapsiblePrimitive from "@radix-ui/react-collapsible"
|
4
|
+
|
5
|
+
const Collapsible = CollapsiblePrimitive.Root
|
6
|
+
|
7
|
+
const CollapsibleTrigger = CollapsiblePrimitive.CollapsibleTrigger
|
8
|
+
|
9
|
+
const CollapsibleContent = CollapsiblePrimitive.CollapsibleContent
|
10
|
+
|
11
|
+
export { Collapsible, CollapsibleTrigger, CollapsibleContent }
|
@@ -0,0 +1,155 @@
|
|
1
|
+
"use client"
|
2
|
+
|
3
|
+
import * as React from "react"
|
4
|
+
import { type DialogProps } from "@radix-ui/react-dialog"
|
5
|
+
import { Command as CommandPrimitive } from "cmdk"
|
6
|
+
import { Search } from "lucide-react"
|
7
|
+
|
8
|
+
import { cn } from "@/lib/utils"
|
9
|
+
import { Dialog, DialogContent } from "@/components/ui/dialog"
|
10
|
+
|
11
|
+
const Command = React.forwardRef<
|
12
|
+
React.ElementRef<typeof CommandPrimitive>,
|
13
|
+
React.ComponentPropsWithoutRef<typeof CommandPrimitive>
|
14
|
+
>(({ className, ...props }, ref) => (
|
15
|
+
<CommandPrimitive
|
16
|
+
ref={ref}
|
17
|
+
className={cn(
|
18
|
+
"flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",
|
19
|
+
className
|
20
|
+
)}
|
21
|
+
{...props}
|
22
|
+
/>
|
23
|
+
))
|
24
|
+
Command.displayName = CommandPrimitive.displayName
|
25
|
+
|
26
|
+
interface CommandDialogProps extends DialogProps {}
|
27
|
+
|
28
|
+
const CommandDialog = ({ children, ...props }: CommandDialogProps) => {
|
29
|
+
return (
|
30
|
+
<Dialog {...props}>
|
31
|
+
<DialogContent className="overflow-hidden p-0 shadow-lg">
|
32
|
+
<Command className="[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5">
|
33
|
+
{children}
|
34
|
+
</Command>
|
35
|
+
</DialogContent>
|
36
|
+
</Dialog>
|
37
|
+
)
|
38
|
+
}
|
39
|
+
|
40
|
+
const CommandInput = React.forwardRef<
|
41
|
+
React.ElementRef<typeof CommandPrimitive.Input>,
|
42
|
+
React.ComponentPropsWithoutRef<typeof CommandPrimitive.Input>
|
43
|
+
>(({ className, ...props }, ref) => (
|
44
|
+
<div className="flex items-center border-b px-3" cmdk-input-wrapper="">
|
45
|
+
<Search className="mr-2 h-4 w-4 shrink-0 opacity-50" />
|
46
|
+
<CommandPrimitive.Input
|
47
|
+
ref={ref}
|
48
|
+
className={cn(
|
49
|
+
"flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",
|
50
|
+
className
|
51
|
+
)}
|
52
|
+
{...props}
|
53
|
+
/>
|
54
|
+
</div>
|
55
|
+
))
|
56
|
+
|
57
|
+
CommandInput.displayName = CommandPrimitive.Input.displayName
|
58
|
+
|
59
|
+
const CommandList = React.forwardRef<
|
60
|
+
React.ElementRef<typeof CommandPrimitive.List>,
|
61
|
+
React.ComponentPropsWithoutRef<typeof CommandPrimitive.List>
|
62
|
+
>(({ className, ...props }, ref) => (
|
63
|
+
<CommandPrimitive.List
|
64
|
+
ref={ref}
|
65
|
+
className={cn("max-h-[300px] overflow-y-auto overflow-x-hidden", className)}
|
66
|
+
{...props}
|
67
|
+
/>
|
68
|
+
))
|
69
|
+
|
70
|
+
CommandList.displayName = CommandPrimitive.List.displayName
|
71
|
+
|
72
|
+
const CommandEmpty = React.forwardRef<
|
73
|
+
React.ElementRef<typeof CommandPrimitive.Empty>,
|
74
|
+
React.ComponentPropsWithoutRef<typeof CommandPrimitive.Empty>
|
75
|
+
>((props, ref) => (
|
76
|
+
<CommandPrimitive.Empty
|
77
|
+
ref={ref}
|
78
|
+
className="py-6 text-center text-sm"
|
79
|
+
{...props}
|
80
|
+
/>
|
81
|
+
))
|
82
|
+
|
83
|
+
CommandEmpty.displayName = CommandPrimitive.Empty.displayName
|
84
|
+
|
85
|
+
const CommandGroup = React.forwardRef<
|
86
|
+
React.ElementRef<typeof CommandPrimitive.Group>,
|
87
|
+
React.ComponentPropsWithoutRef<typeof CommandPrimitive.Group>
|
88
|
+
>(({ className, ...props }, ref) => (
|
89
|
+
<CommandPrimitive.Group
|
90
|
+
ref={ref}
|
91
|
+
className={cn(
|
92
|
+
"overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",
|
93
|
+
className
|
94
|
+
)}
|
95
|
+
{...props}
|
96
|
+
/>
|
97
|
+
))
|
98
|
+
|
99
|
+
CommandGroup.displayName = CommandPrimitive.Group.displayName
|
100
|
+
|
101
|
+
const CommandSeparator = React.forwardRef<
|
102
|
+
React.ElementRef<typeof CommandPrimitive.Separator>,
|
103
|
+
React.ComponentPropsWithoutRef<typeof CommandPrimitive.Separator>
|
104
|
+
>(({ className, ...props }, ref) => (
|
105
|
+
<CommandPrimitive.Separator
|
106
|
+
ref={ref}
|
107
|
+
className={cn("-mx-1 h-px bg-border", className)}
|
108
|
+
{...props}
|
109
|
+
/>
|
110
|
+
))
|
111
|
+
CommandSeparator.displayName = CommandPrimitive.Separator.displayName
|
112
|
+
|
113
|
+
const CommandItem = React.forwardRef<
|
114
|
+
React.ElementRef<typeof CommandPrimitive.Item>,
|
115
|
+
React.ComponentPropsWithoutRef<typeof CommandPrimitive.Item>
|
116
|
+
>(({ className, ...props }, ref) => (
|
117
|
+
<CommandPrimitive.Item
|
118
|
+
ref={ref}
|
119
|
+
className={cn(
|
120
|
+
"relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected='true']:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50",
|
121
|
+
className
|
122
|
+
)}
|
123
|
+
{...props}
|
124
|
+
/>
|
125
|
+
))
|
126
|
+
|
127
|
+
CommandItem.displayName = CommandPrimitive.Item.displayName
|
128
|
+
|
129
|
+
const CommandShortcut = ({
|
130
|
+
className,
|
131
|
+
...props
|
132
|
+
}: React.HTMLAttributes<HTMLSpanElement>) => {
|
133
|
+
return (
|
134
|
+
<span
|
135
|
+
className={cn(
|
136
|
+
"ml-auto text-xs tracking-widest text-muted-foreground",
|
137
|
+
className
|
138
|
+
)}
|
139
|
+
{...props}
|
140
|
+
/>
|
141
|
+
)
|
142
|
+
}
|
143
|
+
CommandShortcut.displayName = "CommandShortcut"
|
144
|
+
|
145
|
+
export {
|
146
|
+
Command,
|
147
|
+
CommandDialog,
|
148
|
+
CommandInput,
|
149
|
+
CommandList,
|
150
|
+
CommandEmpty,
|
151
|
+
CommandGroup,
|
152
|
+
CommandItem,
|
153
|
+
CommandShortcut,
|
154
|
+
CommandSeparator,
|
155
|
+
}
|