11import * as React from "react" ;
2- import * as SelectPrimitive from "@radix-ui/react-select" ;
2+ import {
3+ Content ,
4+ Icon ,
5+ Item ,
6+ ItemIndicator ,
7+ ItemText ,
8+ Portal ,
9+ Root ,
10+ ScrollDownButton ,
11+ ScrollUpButton ,
12+ Trigger ,
13+ Value ,
14+ Viewport
15+ } from "@radix-ui/react-select" ;
316import { Check , ChevronDown , ChevronUp , ChevronsUpDown } from "lucide-react" ;
417import { twMerge } from "tailwind-merge" ;
518
6- const Select = SelectPrimitive . Root ;
19+ const Select = Root ;
720
8- const SelectGroup = SelectPrimitive . Group ;
9-
10- const SelectValue = SelectPrimitive . Value ;
21+ const SelectValue = Value ;
1122
1223const SelectTrigger = React . forwardRef <
13- React . ElementRef < typeof SelectPrimitive . Trigger > ,
14- React . ComponentPropsWithoutRef < typeof SelectPrimitive . Trigger >
24+ React . ElementRef < typeof Trigger > ,
25+ React . ComponentPropsWithoutRef < typeof Trigger >
1526> ( ( { className, children, ...props } , ref ) => (
16- < SelectPrimitive . Trigger
27+ < Trigger
1728 ref = { ref }
1829 className = { twMerge (
1930 "flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1" ,
@@ -22,47 +33,47 @@ const SelectTrigger = React.forwardRef<
2233 { ...props }
2334 >
2435 { children }
25- < SelectPrimitive . Icon asChild >
36+ < Icon asChild >
2637 < ChevronsUpDown className = "h-4 w-4 opacity-50" />
27- </ SelectPrimitive . Icon >
28- </ SelectPrimitive . Trigger >
38+ </ Icon >
39+ </ Trigger >
2940) ) ;
30- SelectTrigger . displayName = SelectPrimitive . Trigger . displayName ;
41+ SelectTrigger . displayName = Trigger . displayName ;
3142
3243const SelectScrollUpButton = React . forwardRef <
33- React . ElementRef < typeof SelectPrimitive . ScrollUpButton > ,
34- React . ComponentPropsWithoutRef < typeof SelectPrimitive . ScrollUpButton >
44+ React . ElementRef < typeof ScrollUpButton > ,
45+ React . ComponentPropsWithoutRef < typeof ScrollUpButton >
3546> ( ( { className, ...props } , ref ) => (
36- < SelectPrimitive . ScrollUpButton
47+ < ScrollUpButton
3748 ref = { ref }
3849 className = { twMerge ( "flex cursor-default items-center justify-center py-1" , className ) }
3950 { ...props }
4051 >
4152 < ChevronUp />
42- </ SelectPrimitive . ScrollUpButton >
53+ </ ScrollUpButton >
4354) ) ;
44- SelectScrollUpButton . displayName = SelectPrimitive . ScrollUpButton . displayName ;
55+ SelectScrollUpButton . displayName = ScrollUpButton . displayName ;
4556
4657const SelectScrollDownButton = React . forwardRef <
47- React . ElementRef < typeof SelectPrimitive . ScrollDownButton > ,
48- React . ComponentPropsWithoutRef < typeof SelectPrimitive . ScrollDownButton >
58+ React . ElementRef < typeof ScrollDownButton > ,
59+ React . ComponentPropsWithoutRef < typeof ScrollDownButton >
4960> ( ( { className, ...props } , ref ) => (
50- < SelectPrimitive . ScrollDownButton
61+ < ScrollDownButton
5162 ref = { ref }
5263 className = { twMerge ( "flex cursor-default items-center justify-center py-1" , className ) }
5364 { ...props }
5465 >
5566 < ChevronDown />
56- </ SelectPrimitive . ScrollDownButton >
67+ </ ScrollDownButton >
5768) ) ;
58- SelectScrollDownButton . displayName = SelectPrimitive . ScrollDownButton . displayName ;
69+ SelectScrollDownButton . displayName = ScrollDownButton . displayName ;
5970
6071const SelectContent = React . forwardRef <
61- React . ElementRef < typeof SelectPrimitive . Content > ,
62- React . ComponentPropsWithoutRef < typeof SelectPrimitive . Content >
72+ React . ElementRef < typeof Content > ,
73+ React . ComponentPropsWithoutRef < typeof Content >
6374> ( ( { className, children, position = "popper" , ...props } , ref ) => (
64- < SelectPrimitive . Portal >
65- < SelectPrimitive . Content
75+ < Portal >
76+ < Content
6677 ref = { ref }
6778 className = { twMerge (
6879 "relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2" ,
@@ -74,68 +85,40 @@ const SelectContent = React.forwardRef<
7485 { ...props }
7586 >
7687 < SelectScrollUpButton />
77- < SelectPrimitive . Viewport
88+ < Viewport
7889 className = { twMerge (
7990 "p-1" ,
8091 position === "popper" &&
8192 "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"
8293 ) }
8394 >
8495 { children }
85- </ SelectPrimitive . Viewport >
96+ </ Viewport >
8697 < SelectScrollDownButton />
87- </ SelectPrimitive . Content >
88- </ SelectPrimitive . Portal >
89- ) ) ;
90- SelectContent . displayName = SelectPrimitive . Content . displayName ;
91-
92- const SelectLabel = React . forwardRef <
93- React . ElementRef < typeof SelectPrimitive . Label > ,
94- React . ComponentPropsWithoutRef < typeof SelectPrimitive . Label >
95- > ( ( { className, ...props } , ref ) => (
96- < SelectPrimitive . Label ref = { ref } className = { twMerge ( "px-2 py-1.5 text-sm font-semibold" , className ) } { ...props } />
98+ </ Content >
99+ </ Portal >
97100) ) ;
98- SelectLabel . displayName = SelectPrimitive . Label . displayName ;
101+ SelectContent . displayName = Content . displayName ;
99102
100- const SelectItem = React . forwardRef <
101- React . ElementRef < typeof SelectPrimitive . Item > ,
102- React . ComponentPropsWithoutRef < typeof SelectPrimitive . Item >
103- > ( ( { className, children, ...props } , ref ) => (
104- < SelectPrimitive . Item
105- ref = { ref }
106- className = { twMerge (
107- "relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50" ,
108- className
109- ) }
110- { ...props }
111- >
112- < span className = "absolute right-2 flex h-3.5 w-3.5 items-center justify-center" >
113- < SelectPrimitive . ItemIndicator >
114- < Check className = "h-4 w-4" />
115- </ SelectPrimitive . ItemIndicator >
116- </ span >
117- < SelectPrimitive . ItemText > { children } </ SelectPrimitive . ItemText >
118- </ SelectPrimitive . Item >
119- ) ) ;
120- SelectItem . displayName = SelectPrimitive . Item . displayName ;
121-
122- const SelectSeparator = React . forwardRef <
123- React . ElementRef < typeof SelectPrimitive . Separator > ,
124- React . ComponentPropsWithoutRef < typeof SelectPrimitive . Separator >
125- > ( ( { className, ...props } , ref ) => (
126- < SelectPrimitive . Separator ref = { ref } className = { twMerge ( "-mx-1 my-1 h-px bg-muted" , className ) } { ...props } />
127- ) ) ;
128- SelectSeparator . displayName = SelectPrimitive . Separator . displayName ;
103+ const SelectItem = React . forwardRef < React . ElementRef < typeof Item > , React . ComponentPropsWithoutRef < typeof Item > > (
104+ ( { className, children, ...props } , ref ) => (
105+ < Item
106+ ref = { ref }
107+ className = { twMerge (
108+ "relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50" ,
109+ className
110+ ) }
111+ { ...props }
112+ >
113+ < span className = "absolute right-2 flex h-3.5 w-3.5 items-center justify-center" >
114+ < ItemIndicator >
115+ < Check className = "h-4 w-4" />
116+ </ ItemIndicator >
117+ </ span >
118+ < ItemText > { children } </ ItemText >
119+ </ Item >
120+ )
121+ ) ;
122+ SelectItem . displayName = Item . displayName ;
129123
130- export {
131- Select ,
132- SelectGroup ,
133- SelectValue ,
134- SelectTrigger ,
135- SelectContent ,
136- SelectLabel ,
137- SelectItem ,
138- SelectSeparator ,
139- SelectScrollUpButton ,
140- SelectScrollDownButton
141- } ;
124+ export { Select , SelectValue , SelectTrigger , SelectContent , SelectItem } ;
0 commit comments