diff --git a/web/app/components/base/ui/dialog/index.tsx b/web/app/components/base/ui/dialog/index.tsx index b4b5f728b6..605fccee09 100644 --- a/web/app/components/base/ui/dialog/index.tsx +++ b/web/app/components/base/ui/dialog/index.tsx @@ -21,12 +21,14 @@ type DialogContentProps = { children: React.ReactNode className?: string overlayClassName?: string + closable?: boolean } export function DialogContent({ children, className, overlayClassName, + closable = false, }: DialogContentProps) { return ( @@ -39,11 +41,16 @@ export function DialogContent({ /> + {closable && ( + + + + )} {children} diff --git a/web/app/components/base/ui/select/index.tsx b/web/app/components/base/ui/select/index.tsx index adc4a70b58..d894cf0ded 100644 --- a/web/app/components/base/ui/select/index.tsx +++ b/web/app/components/base/ui/select/index.tsx @@ -12,11 +12,22 @@ export const SelectGroup = BaseSelect.Group export const SelectGroupLabel = BaseSelect.GroupLabel export const SelectSeparator = BaseSelect.Separator +type SelectTriggerProps = React.ComponentPropsWithoutRef & { + clearable?: boolean + onClear?: () => void + loading?: boolean +} + export function SelectTrigger({ className, children, + clearable = false, + onClear, + loading = false, ...props -}: React.ComponentPropsWithoutRef) { +}: SelectTriggerProps) { + const showClear = clearable && !loading + return ( {children} - - - + {loading + ? ( + + + + ) + : showClear + ? ( + { + e.stopPropagation() + onClear?.() + }} + onMouseDown={(e) => { + e.stopPropagation() + }} + > + + + ) + : ( + + + + )} ) } @@ -77,6 +113,7 @@ export function SelectContent({ align={align} sideOffset={sideOffset} alignOffset={alignOffset} + alignItemWithTrigger={false} className={cn('z-50 outline-none', className)} {...positionerProps} > diff --git a/web/app/components/base/ui/tooltip/index.tsx b/web/app/components/base/ui/tooltip/index.tsx index c4f18140e1..1a41cc0f56 100644 --- a/web/app/components/base/ui/tooltip/index.tsx +++ b/web/app/components/base/ui/tooltip/index.tsx @@ -42,6 +42,7 @@ export function TooltipContent({