11'use client' ;
22
3- import * as React from 'react' ;
4- import { type DialogProps } from '@radix-ui/react-dialog' ;
3+ import { Dialog , DialogContent , type DialogProps } from '@radix-ui/react-dialog' ;
54import { Command as CommandPrimitive } from 'cmdk' ;
65import { Search } from 'lucide-react' ;
7-
6+ import { ComponentPropsWithoutRef , ElementRef , forwardRef , HTMLAttributes } from 'react' ;
87import { cn } from '../../lib/utils' ;
9- import { Dialog , DialogContent } from './dialog' ;
108
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- ) ) ;
9+ const Command = forwardRef < ElementRef < typeof CommandPrimitive > , ComponentPropsWithoutRef < typeof CommandPrimitive > > (
10+ ( { className, ...props } , ref ) => (
11+ < CommandPrimitive
12+ ref = { ref }
13+ className = { cn (
14+ 'flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground' ,
15+ className
16+ ) }
17+ { ...props }
18+ />
19+ )
20+ ) ;
2421Command . displayName = CommandPrimitive . displayName ;
2522
2623const CommandDialog = ( { children, ...props } : DialogProps ) => {
@@ -35,9 +32,9 @@ const CommandDialog = ({ children, ...props }: DialogProps) => {
3532 ) ;
3633} ;
3734
38- const CommandInput = React . forwardRef <
39- React . ElementRef < typeof CommandPrimitive . Input > ,
40- React . ComponentPropsWithoutRef < typeof CommandPrimitive . Input >
35+ const CommandInput = forwardRef <
36+ ElementRef < typeof CommandPrimitive . Input > ,
37+ ComponentPropsWithoutRef < typeof CommandPrimitive . Input >
4138> ( ( { className, ...props } , ref ) => (
4239 < div className = 'flex items-center border-b px-3' { ...{ 'cmdk-input-wrapper' : '' } } >
4340 < Search className = 'mr-2 h-4 w-4 shrink-0 opacity-50' />
@@ -54,9 +51,9 @@ const CommandInput = React.forwardRef<
5451
5552CommandInput . displayName = CommandPrimitive . Input . displayName ;
5653
57- const CommandList = React . forwardRef <
58- React . ElementRef < typeof CommandPrimitive . List > ,
59- React . ComponentPropsWithoutRef < typeof CommandPrimitive . List >
54+ const CommandList = forwardRef <
55+ ElementRef < typeof CommandPrimitive . List > ,
56+ ComponentPropsWithoutRef < typeof CommandPrimitive . List >
6057> ( ( { className, ...props } , ref ) => (
6158 < CommandPrimitive . List
6259 ref = { ref }
@@ -67,16 +64,16 @@ const CommandList = React.forwardRef<
6764
6865CommandList . displayName = CommandPrimitive . List . displayName ;
6966
70- const CommandEmpty = React . forwardRef <
71- React . ElementRef < typeof CommandPrimitive . Empty > ,
72- React . ComponentPropsWithoutRef < typeof CommandPrimitive . Empty >
67+ const CommandEmpty = forwardRef <
68+ ElementRef < typeof CommandPrimitive . Empty > ,
69+ ComponentPropsWithoutRef < typeof CommandPrimitive . Empty >
7370> ( ( props , ref ) => < CommandPrimitive . Empty ref = { ref } className = 'py-6 text-center text-sm' { ...props } /> ) ;
7471
7572CommandEmpty . displayName = CommandPrimitive . Empty . displayName ;
7673
77- const CommandGroup = React . forwardRef <
78- React . ElementRef < typeof CommandPrimitive . Group > ,
79- React . ComponentPropsWithoutRef < typeof CommandPrimitive . Group >
74+ const CommandGroup = forwardRef <
75+ ElementRef < typeof CommandPrimitive . Group > ,
76+ ComponentPropsWithoutRef < typeof CommandPrimitive . Group >
8077> ( ( { className, ...props } , ref ) => (
8178 < CommandPrimitive . Group
8279 ref = { ref }
@@ -90,17 +87,17 @@ const CommandGroup = React.forwardRef<
9087
9188CommandGroup . displayName = CommandPrimitive . Group . displayName ;
9289
93- const CommandSeparator = React . forwardRef <
94- React . ElementRef < typeof CommandPrimitive . Separator > ,
95- React . ComponentPropsWithoutRef < typeof CommandPrimitive . Separator >
90+ const CommandSeparator = forwardRef <
91+ ElementRef < typeof CommandPrimitive . Separator > ,
92+ ComponentPropsWithoutRef < typeof CommandPrimitive . Separator >
9693> ( ( { className, ...props } , ref ) => (
9794 < CommandPrimitive . Separator ref = { ref } className = { cn ( '-mx-1 h-px bg-border' , className ) } { ...props } />
9895) ) ;
9996CommandSeparator . displayName = CommandPrimitive . Separator . displayName ;
10097
101- const CommandItem = React . forwardRef <
102- React . ElementRef < typeof CommandPrimitive . Item > ,
103- React . ComponentPropsWithoutRef < typeof CommandPrimitive . Item >
98+ const CommandItem = forwardRef <
99+ ElementRef < typeof CommandPrimitive . Item > ,
100+ ComponentPropsWithoutRef < typeof CommandPrimitive . Item >
104101> ( ( { className, ...props } , ref ) => (
105102 < CommandPrimitive . Item
106103 ref = { ref }
@@ -114,19 +111,19 @@ const CommandItem = React.forwardRef<
114111
115112CommandItem . displayName = CommandPrimitive . Item . displayName ;
116113
117- const CommandShortcut = ( { className, ...props } : React . HTMLAttributes < HTMLSpanElement > ) => {
114+ const CommandShortcut = ( { className, ...props } : HTMLAttributes < HTMLSpanElement > ) => {
118115 return < span className = { cn ( 'ms-auto text-xs tracking-widest text-muted-foreground' , className ) } { ...props } /> ;
119116} ;
120117CommandShortcut . displayName = 'CommandShortcut' ;
121118
122119export {
123120 Command ,
124121 CommandDialog ,
125- CommandInput ,
126- CommandList ,
127122 CommandEmpty ,
128123 CommandGroup ,
124+ CommandInput ,
129125 CommandItem ,
130- CommandShortcut ,
126+ CommandList ,
131127 CommandSeparator ,
128+ CommandShortcut ,
132129} ;
0 commit comments