From cb2ba66233c8c04e2d963cf2d210499d8512a268 Mon Sep 17 00:00:00 2001 From: Guy Ben-Aharon Date: Sun, 10 Aug 2025 14:06:09 +0300 Subject: [PATCH] fix(select-box): fix select box issue in dialog (#840) --- src/components/dialog/dialog.tsx | 90 ++++++++++++++----- src/components/select-box/select-box.tsx | 4 + .../create-relationship-dialog.tsx | 8 +- 3 files changed, 80 insertions(+), 22 deletions(-) diff --git a/src/components/dialog/dialog.tsx b/src/components/dialog/dialog.tsx index 94fc7134..ea3aa6bb 100644 --- a/src/components/dialog/dialog.tsx +++ b/src/components/dialog/dialog.tsx @@ -4,6 +4,7 @@ import { Cross2Icon } from '@radix-ui/react-icons'; import { cn } from '@/lib/utils'; import { ScrollArea } from '../scroll-area/scroll-area'; +import { ChevronLeft } from 'lucide-react'; const Dialog = DialogPrimitive.Root; @@ -32,28 +33,75 @@ const DialogContent = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef & { showClose?: boolean; + showBack?: boolean; + backButtonClassName?: string; + blurBackground?: boolean; + forceOverlay?: boolean; + onBackClick?: () => void; } ->(({ className, children, showClose, ...props }, ref) => ( - - - - {children} - {showClose && ( - - - Close - - )} - - -)); +>( + ( + { + className, + children, + showClose, + showBack, + onBackClick, + backButtonClassName, + blurBackground, + forceOverlay, + ...props + }, + ref + ) => ( + + {forceOverlay ? ( +
+ ) : null} + + + {children} + {showBack && ( + + )} + {showClose && ( + + + Close + + )} + + + ) +); DialogContent.displayName = DialogPrimitive.Content.displayName; const DialogHeader = ({ diff --git a/src/components/select-box/select-box.tsx b/src/components/select-box/select-box.tsx index bc5743c2..0130f502 100644 --- a/src/components/select-box/select-box.tsx +++ b/src/components/select-box/select-box.tsx @@ -94,6 +94,10 @@ export const SelectBox = React.forwardRef( setOpen?.(isOpen); setIsOpen(isOpen); + if (isOpen) { + setSearchTerm(''); + } + setTimeout(() => (document.body.style.pointerEvents = ''), 500); }, [setOpen] diff --git a/src/dialogs/create-relationship-dialog/create-relationship-dialog.tsx b/src/dialogs/create-relationship-dialog/create-relationship-dialog.tsx index 79a4e569..701faec3 100644 --- a/src/dialogs/create-relationship-dialog/create-relationship-dialog.tsx +++ b/src/dialogs/create-relationship-dialog/create-relationship-dialog.tsx @@ -218,8 +218,14 @@ export const CreateRelationshipDialog: React.FC< closeCreateRelationshipDialog(); } }} + modal={false} > - + e.preventDefault()} + > {t('create_relationship_dialog.title')}