import React from 'react'; import * as SelectPrimitive from '@radix-ui/react-select'; import { HiChevronDown } from 'react-icons/hi'; import { BsCheck2 } from 'react-icons/bs'; import { classNames } from '@/utils'; const Select = ({ children, ...props }: SelectPrimitive.SelectProps) => { return {children}; }; const SelectGroup = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef >(({ children, ...props }, ref) => { return ( {children} ); }); SelectGroup.displayName = SelectPrimitive.SelectGroup.displayName; const SelectValue = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef >(({ children, className, ...props }, ref) => { return ( {children} ); }); SelectValue.displayName = SelectPrimitive.SelectValue.displayName; interface SelectTriggerProps extends React.ComponentPropsWithoutRef { chevronDown?: boolean; } const SelectTrigger = React.forwardRef, SelectTriggerProps>( ({ className, children, chevronDown = true, ...props }, ref) => ( {children} {chevronDown && ( )} ) ); SelectTrigger.displayName = SelectPrimitive.Trigger.displayName; const SelectContent = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef >(({ className, sideOffset = -40, children, position = 'popper', ...props }, ref) => ( {children} )); SelectContent.displayName = SelectPrimitive.Content.displayName; const SelectLabel = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef >(({ className, children, ...props }, ref) => ( {children} )); SelectLabel.displayName = SelectPrimitive.Label.displayName; interface SelectItemProps extends React.ComponentPropsWithoutRef { showCheck?: boolean; } const SelectItem = React.forwardRef, SelectItemProps>( ({ className, children, showCheck = true, ...props }, ref) => ( {showCheck && ( )} {children} ) ); SelectItem.displayName = SelectPrimitive.Item.displayName; const SelectSeparator = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef >(({ className, children, ...props }, ref) => ( {children} )); SelectSeparator.displayName = SelectPrimitive.Separator.displayName; Select.Group = SelectGroup; Select.Value = SelectValue; Select.Trigger = SelectTrigger; Select.Content = SelectContent; Select.Label = SelectLabel; Select.Item = SelectItem; Select.ItemIndicator = SelectPrimitive.ItemIndicator; Select.ItemText = SelectPrimitive.ItemText; Select.Separator = SelectSeparator; Select.Portal = SelectPrimitive.Portal; Select.ScrollUpButton = SelectPrimitive.ScrollUpButton; Select.ScrollDownButton = SelectPrimitive.ScrollDownButton; Select.Viewport = SelectPrimitive.Viewport; Select.Icon = SelectPrimitive.Icon; Select.Arrow = SelectPrimitive.Arrow; Select.displayName = SelectPrimitive.Select.displayName; export default Select;