Database diagrams editor that allows you to visualize and design your DB with a single query.
TypeScript databasedbdb-migrationeditorerdmariadbmssqlmysqlpostgresqlreactreact-flowschema-migrationssqlsqlitetypescriptvisualizationxyflow
fix(select-box): fix select box issue in dialog (#840)
Guy Ben-Aharoncb2ba66233c8
diff --git a/src/components/dialog/dialog.tsx b/src/components/dialog/dialog.tsxindex 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<typeof DialogPrimitive.Content>,React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content> & {showClose?: boolean;+ showBack?: boolean;+ backButtonClassName?: string;+ blurBackground?: boolean;+ forceOverlay?: boolean;+ onBackClick?: () => void;}->(({ className, children, showClose, ...props }, ref) => (- <DialogPortal>- <DialogOverlay />- <DialogPrimitive.Content- ref={ref}- className={cn(- 'fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 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-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg',- className- )}- {...props}- >- {children}- {showClose && (- <DialogPrimitive.Close className="absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground">- <Cross2Icon className="size-4" />- <span className="sr-only">Close</span>- </DialogPrimitive.Close>- )}- </DialogPrimitive.Content>- </DialogPortal>-));+>(+ (+ {+ className,+ children,+ showClose,+ showBack,+ onBackClick,+ backButtonClassName,+ blurBackground,+ forceOverlay,+ ...props+ },+ ref+ ) => (+ <DialogPortal>+ {forceOverlay ? (+ <div+ className={cn(+ 'fixed inset-0 z-50 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0',+ {+ 'bg-black/80': !blurBackground,+ 'bg-black/30 backdrop-blur-sm': blurBackground,+ }+ )}+ data-state="open"+ />+ ) : null}+ <DialogOverlay+ className={cn({+ 'bg-black/30 backdrop-blur-sm': blurBackground,+ })}+ />+ <DialogPrimitive.Content+ ref={ref}+ className={cn(+ 'fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 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-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg',+ className+ )}+ {...props}+ >+ {children}+ {showBack && (+ <button+ onClick={() => onBackClick?.()}+ className={cn(+ 'absolute left-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground',+ backButtonClassName+ )}+ >+ <ChevronLeft className="size-4" />+ </button>+ )}+ {showClose && (+ <DialogPrimitive.Close className="absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground">+ <Cross2Icon className="size-4" />+ <span className="sr-only">Close</span>+ </DialogPrimitive.Close>+ )}+ </DialogPrimitive.Content>+ </DialogPortal>+ )+);DialogContent.displayName = DialogPrimitive.Content.displayName;const DialogHeader = ({diff --git a/src/components/select-box/select-box.tsx b/src/components/select-box/select-box.tsxindex 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<HTMLInputElement, SelectBoxProps>(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.tsxindex 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}>- <DialogContent className="flex flex-col overflow-y-auto" showClose>+ <DialogContent+ className="flex flex-col overflow-y-auto"+ showClose+ forceOverlay+ onInteractOutside={(e) => e.preventDefault()}+ ><DialogHeader><DialogTitle>{t('create_relationship_dialog.title')}