1
- "use client" ;
1
+ "use client"
2
2
3
- import { type DialogProps } from "@radix-ui/ react-dialog" ;
4
- import { MagnifyingGlassIcon } from "@radix-ui/react-icons" ;
5
- import { Command as CommandPrimitive } from "cmdk" ;
6
- import * as React from "react" ;
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
7
8
- import { cn } from "src/utils" ;
9
- import { Dialog , DialogContent } from "./dialog" ;
8
+ import { cn } from "src"
9
+ import { Dialog , DialogContent } from "src"
10
10
11
11
const Command = React . forwardRef <
12
12
React . ElementRef < typeof CommandPrimitive > ,
@@ -20,12 +20,10 @@ const Command = React.forwardRef<
20
20
) }
21
21
{ ...props }
22
22
/>
23
- ) ) ;
24
- Command . displayName = CommandPrimitive . displayName ;
23
+ ) )
24
+ Command . displayName = CommandPrimitive . displayName
25
25
26
- interface CommandDialogProps extends DialogProps { }
27
-
28
- const CommandDialog = ( { children, ...props } : CommandDialogProps ) => {
26
+ const CommandDialog = ( { children, ...props } : DialogProps ) => {
29
27
return (
30
28
< Dialog { ...props } >
31
29
< DialogContent className = "overflow-hidden p-0" >
@@ -34,15 +32,15 @@ const CommandDialog = ({ children, ...props }: CommandDialogProps) => {
34
32
</ Command >
35
33
</ DialogContent >
36
34
</ Dialog >
37
- ) ;
38
- } ;
35
+ )
36
+ }
39
37
40
38
const CommandInput = React . forwardRef <
41
39
React . ElementRef < typeof CommandPrimitive . Input > ,
42
40
React . ComponentPropsWithoutRef < typeof CommandPrimitive . Input >
43
41
> ( ( { className, ...props } , ref ) => (
44
42
< div className = "flex items-center border-b px-3" cmdk-input-wrapper = "" >
45
- < MagnifyingGlassIcon className = "mr-2 h-4 w-4 shrink-0 opacity-50" />
43
+ < Search className = "mr-2 h-4 w-4 shrink-0 opacity-50" />
46
44
< CommandPrimitive . Input
47
45
ref = { ref }
48
46
className = { cn (
@@ -52,9 +50,9 @@ const CommandInput = React.forwardRef<
52
50
{ ...props }
53
51
/>
54
52
</ div >
55
- ) ) ;
53
+ ) )
56
54
57
- CommandInput . displayName = CommandPrimitive . Input . displayName ;
55
+ CommandInput . displayName = CommandPrimitive . Input . displayName
58
56
59
57
const CommandList = React . forwardRef <
60
58
React . ElementRef < typeof CommandPrimitive . List > ,
@@ -65,9 +63,9 @@ const CommandList = React.forwardRef<
65
63
className = { cn ( "max-h-[300px] overflow-y-auto overflow-x-hidden" , className ) }
66
64
{ ...props }
67
65
/>
68
- ) ) ;
66
+ ) )
69
67
70
- CommandList . displayName = CommandPrimitive . List . displayName ;
68
+ CommandList . displayName = CommandPrimitive . List . displayName
71
69
72
70
const CommandEmpty = React . forwardRef <
73
71
React . ElementRef < typeof CommandPrimitive . Empty > ,
@@ -78,9 +76,9 @@ const CommandEmpty = React.forwardRef<
78
76
className = "py-6 text-center text-sm"
79
77
{ ...props }
80
78
/>
81
- ) ) ;
79
+ ) )
82
80
83
- CommandEmpty . displayName = CommandPrimitive . Empty . displayName ;
81
+ CommandEmpty . displayName = CommandPrimitive . Empty . displayName
84
82
85
83
const CommandGroup = React . forwardRef <
86
84
React . ElementRef < typeof CommandPrimitive . Group > ,
@@ -94,9 +92,9 @@ const CommandGroup = React.forwardRef<
94
92
) }
95
93
{ ...props }
96
94
/>
97
- ) ) ;
95
+ ) )
98
96
99
- CommandGroup . displayName = CommandPrimitive . Group . displayName ;
97
+ CommandGroup . displayName = CommandPrimitive . Group . displayName
100
98
101
99
const CommandSeparator = React . forwardRef <
102
100
React . ElementRef < typeof CommandPrimitive . Separator > ,
@@ -107,8 +105,8 @@ const CommandSeparator = React.forwardRef<
107
105
className = { cn ( "-mx-1 h-px bg-border" , className ) }
108
106
{ ...props }
109
107
/>
110
- ) ) ;
111
- CommandSeparator . displayName = CommandPrimitive . Separator . displayName ;
108
+ ) )
109
+ CommandSeparator . displayName = CommandPrimitive . Separator . displayName
112
110
113
111
const CommandItem = React . forwardRef <
114
112
React . ElementRef < typeof CommandPrimitive . Item > ,
@@ -117,15 +115,14 @@ const CommandItem = React.forwardRef<
117
115
< CommandPrimitive . Item
118
116
ref = { ref }
119
117
className = { cn (
120
- 'relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none aria-selected:bg-accent aria-selected:text-accent-foreground data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50' ,
121
- props . disabled ? 'opacity-50 pointer-events-none' : '' ,
118
+ "relative flex cursor-default gap-2 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 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0" ,
122
119
className
123
120
) }
124
121
{ ...props }
125
122
/>
126
- ) ) ;
123
+ ) )
127
124
128
- CommandItem . displayName = CommandPrimitive . Item . displayName ;
125
+ CommandItem . displayName = CommandPrimitive . Item . displayName
129
126
130
127
const CommandShortcut = ( {
131
128
className,
@@ -139,18 +136,18 @@ const CommandShortcut = ({
139
136
) }
140
137
{ ...props }
141
138
/>
142
- ) ;
143
- } ;
144
- CommandShortcut . displayName = "CommandShortcut" ;
139
+ )
140
+ }
141
+ CommandShortcut . displayName = "CommandShortcut"
145
142
146
143
export {
147
144
Command ,
148
145
CommandDialog ,
146
+ CommandInput ,
147
+ CommandList ,
149
148
CommandEmpty ,
150
149
CommandGroup ,
151
- CommandInput ,
152
150
CommandItem ,
153
- CommandList ,
154
- CommandSeparator ,
155
151
CommandShortcut ,
156
- } ;
152
+ CommandSeparator ,
153
+ }
0 commit comments