fix: cannot click dropdown appearance (#4750)

This commit is contained in:
Faisal Amir 2025-02-27 11:28:07 +07:00 committed by GitHub
parent 6a0fb09610
commit aa26e45c22
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 14 additions and 2 deletions

View File

@ -11,10 +11,13 @@ type Props = {
open?: boolean open?: boolean
block?: boolean block?: boolean
value?: string value?: string
side?: 'top' | 'right' | 'bottom' | 'left'
position?: 'item-aligned' | 'popper'
placeholder?: string placeholder?: string
disabled?: boolean disabled?: boolean
containerPortal?: HTMLDivElement | undefined | null containerPortal?: HTMLDivElement | undefined | null
className?: string className?: string
sideOffset?: number
onValueChange?: (value: string) => void onValueChange?: (value: string) => void
onOpenChange?: (open: boolean) => void onOpenChange?: (open: boolean) => void
} }
@ -26,7 +29,10 @@ const Select = ({
disabled, disabled,
containerPortal, containerPortal,
block, block,
sideOffset,
position,
className, className,
side,
open, open,
onValueChange, onValueChange,
onOpenChange, onOpenChange,
@ -52,7 +58,12 @@ const Select = ({
</SelectPrimitive.Trigger> </SelectPrimitive.Trigger>
<SelectPrimitive.Portal container={containerPortal}> <SelectPrimitive.Portal container={containerPortal}>
<SelectPrimitive.Content className="select__content"> <SelectPrimitive.Content
side={side}
position={position}
sideOffset={sideOffset}
className="select__content"
>
<SelectPrimitive.Viewport className="select__viewport"> <SelectPrimitive.Viewport className="select__viewport">
{options && {options &&
options.map((item, i) => { options.map((item, i) => {
@ -79,7 +90,6 @@ const Select = ({
) )
})} })}
</SelectPrimitive.Viewport> </SelectPrimitive.Viewport>
<SelectPrimitive.Arrow />
</SelectPrimitive.Content> </SelectPrimitive.Content>
</SelectPrimitive.Portal> </SelectPrimitive.Portal>
</SelectPrimitive.Root> </SelectPrimitive.Root>

View File

@ -84,6 +84,8 @@ export default function AppearanceOptions() {
</p> </p>
</div> </div>
<Select <Select
position="popper"
sideOffset={4}
value={selectedIdTheme} value={selectedIdTheme}
options={themeOptions} options={themeOptions}
onValueChange={(e) => handleClickTheme(e)} onValueChange={(e) => handleClickTheme(e)}