@@ -11,10 +11,9 @@ const SelectGroup = SelectPrimitive.Group
11
11
12
12
const SelectValue = SelectPrimitive . Value
13
13
14
- const SelectTrigger = React . forwardRef <
15
- React . ElementRef < typeof SelectPrimitive . Trigger > ,
16
- React . ComponentPropsWithoutRef < typeof SelectPrimitive . Trigger >
17
- > ( ( { children, className, ...props } , ref ) => (
14
+ const SelectTrigger : React . FC <
15
+ { ref ?: React . Ref < HTMLButtonElement > } & React . ComponentProps < typeof SelectPrimitive . Trigger >
16
+ > = ( { children, className, ref, ...props } ) => (
18
17
< SelectPrimitive . Trigger
19
18
className = { cn (
20
19
'flex h-10 w-full items-center justify-between rounded border border-input bg-background px-3 py-2 text-inherit ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1' ,
@@ -28,41 +27,39 @@ const SelectTrigger = React.forwardRef<
28
27
< ChevronDown className = "h-4 w-4 opacity-50" />
29
28
</ SelectPrimitive . Icon >
30
29
</ SelectPrimitive . Trigger >
31
- ) )
32
- SelectTrigger . displayName = SelectPrimitive . Trigger . displayName
30
+ )
33
31
34
- const SelectScrollUpButton = React . forwardRef <
35
- React . ElementRef < typeof SelectPrimitive . ScrollUpButton > ,
36
- React . ComponentPropsWithoutRef < typeof SelectPrimitive . ScrollUpButton >
37
- > ( ( { className, ...props } , ref ) => (
32
+ const SelectScrollUpButton : React . FC <
33
+ { ref ?: React . Ref < HTMLDivElement > } & React . ComponentProps < typeof SelectPrimitive . ScrollUpButton >
34
+ > = ( { className, ref, ...props } ) => (
38
35
< SelectPrimitive . ScrollUpButton
39
36
className = { cn ( 'flex cursor-default items-center justify-center py-1' , className ) }
40
37
ref = { ref }
41
38
{ ...props }
42
39
>
43
40
< ChevronUp className = "h-4 w-4" />
44
41
</ SelectPrimitive . ScrollUpButton >
45
- ) )
46
- SelectScrollUpButton . displayName = SelectPrimitive . ScrollUpButton . displayName
42
+ )
47
43
48
- const SelectScrollDownButton = React . forwardRef <
49
- React . ElementRef < typeof SelectPrimitive . ScrollDownButton > ,
50
- React . ComponentPropsWithoutRef < typeof SelectPrimitive . ScrollDownButton >
51
- > ( ( { className, ...props } , ref ) => (
44
+ const SelectScrollDownButton : React . FC <
45
+ { ref ?: React . Ref < HTMLDivElement > } & React . ComponentProps <
46
+ typeof SelectPrimitive . ScrollDownButton
47
+ >
48
+ > = ( { className, ref, ...props } ) => (
52
49
< SelectPrimitive . ScrollDownButton
53
50
className = { cn ( 'flex cursor-default items-center justify-center py-1' , className ) }
54
51
ref = { ref }
55
52
{ ...props }
56
53
>
57
54
< ChevronDown className = "h-4 w-4" />
58
55
</ SelectPrimitive . ScrollDownButton >
59
- ) )
60
- SelectScrollDownButton . displayName = SelectPrimitive . ScrollDownButton . displayName
56
+ )
61
57
62
- const SelectContent = React . forwardRef <
63
- React . ElementRef < typeof SelectPrimitive . Content > ,
64
- React . ComponentPropsWithoutRef < typeof SelectPrimitive . Content >
65
- > ( ( { children, className, position = 'popper' , ...props } , ref ) => (
58
+ const SelectContent : React . FC <
59
+ {
60
+ ref ?: React . Ref < HTMLDivElement >
61
+ } & React . ComponentProps < typeof SelectPrimitive . Content >
62
+ > = ( { children, className, position = 'popper' , ref, ...props } ) => (
66
63
< SelectPrimitive . Portal >
67
64
< SelectPrimitive . Content
68
65
className = { cn (
@@ -88,25 +85,23 @@ const SelectContent = React.forwardRef<
88
85
< SelectScrollDownButton />
89
86
</ SelectPrimitive . Content >
90
87
</ SelectPrimitive . Portal >
91
- ) )
92
- SelectContent . displayName = SelectPrimitive . Content . displayName
88
+ )
93
89
94
- const SelectLabel = React . forwardRef <
95
- React . ElementRef < typeof SelectPrimitive . Label > ,
96
- React . ComponentPropsWithoutRef < typeof SelectPrimitive . Label >
97
- > ( ( { className, ...props } , ref ) => (
90
+ const SelectLabel : React . FC <
91
+ { ref ?: React . Ref < HTMLDivElement > } & React . ComponentProps < typeof SelectPrimitive . Label >
92
+ > = ( { className, ref, ...props } ) => (
98
93
< SelectPrimitive . Label
99
94
className = { cn ( 'py-1.5 pl-8 pr-2 text-sm font-semibold' , className ) }
100
95
ref = { ref }
101
96
{ ...props }
102
97
/>
103
- ) )
104
- SelectLabel . displayName = SelectPrimitive . Label . displayName
98
+ )
105
99
106
- const SelectItem = React . forwardRef <
107
- React . ElementRef < typeof SelectPrimitive . Item > ,
108
- React . ComponentPropsWithoutRef < typeof SelectPrimitive . Item >
109
- > ( ( { children, className, ...props } , ref ) => (
100
+ const SelectItem : React . FC <
101
+ { ref ?: React . Ref < HTMLDivElement > ; value : string } & React . ComponentProps <
102
+ typeof SelectPrimitive . Item
103
+ >
104
+ > = ( { children, className, ref, ...props } ) => (
110
105
< SelectPrimitive . Item
111
106
className = { cn (
112
107
'relative flex w-full cursor-default select-none items-center rounded py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50' ,
@@ -123,20 +118,17 @@ const SelectItem = React.forwardRef<
123
118
124
119
< SelectPrimitive . ItemText > { children } </ SelectPrimitive . ItemText >
125
120
</ SelectPrimitive . Item >
126
- ) )
127
- SelectItem . displayName = SelectPrimitive . Item . displayName
121
+ )
128
122
129
- const SelectSeparator = React . forwardRef <
130
- React . ElementRef < typeof SelectPrimitive . Separator > ,
131
- React . ComponentPropsWithoutRef < typeof SelectPrimitive . Separator >
132
- > ( ( { className, ...props } , ref ) => (
123
+ const SelectSeparator : React . FC <
124
+ { ref ?: React . Ref < HTMLDivElement > } & React . ComponentProps < typeof SelectPrimitive . Separator >
125
+ > = ( { className, ref, ...props } ) => (
133
126
< SelectPrimitive . Separator
134
127
className = { cn ( '-mx-1 my-1 h-px bg-muted' , className ) }
135
128
ref = { ref }
136
129
{ ...props }
137
130
/>
138
- ) )
139
- SelectSeparator . displayName = SelectPrimitive . Separator . displayName
131
+ )
140
132
141
133
export {
142
134
Select ,
0 commit comments