import { Modal, type ModalProps, Popover } from "@mantine/core"; import { useDisclosure } from "@mantine/hooks"; import { IconBug } from "@tabler/icons-react"; import { ScrollArea } from "radix-ui"; import { Fragment, forwardRef, useImperativeHandle } from "react"; import { TbX } from "react-icons/tb"; import { twMerge } from "tailwind-merge"; import { Button } from "../buttons/Button"; import { IconButton } from "../buttons/IconButton"; import { JsonViewer } from "../code/JsonViewer"; export type Modal2Ref = { open: () => void; close: () => void; }; export type Modal2Props = Omit & { opened?: boolean; onClose?: () => void; }; export const Modal2 = forwardRef( ( { classNames, children, opened: initialOpened, closeOnClickOutside = false, ...props }, ref ) => { const [opened, { open, close }] = useDisclosure(initialOpened); useImperativeHandle(ref, () => ({ open, close })); return ( {children} ); } ); export const ModalTitle = ({ path, onClose }: { path: string[]; onClose: () => void }) => { return (
{path.map((p, i) => { const last = i + 1 === path.length; return ( {p} {!last && /} ); })}
); }; export const ModalBody = ({ children, className }: { children?: any; className?: string }) => (
{children}
); export const ModalFooter = ({ next, prev, nextLabel = "Next", prevLabel = "Back", debug }: { next: any; prev: any; nextLabel?: string; prevLabel?: string; debug?: any; }) => { const [opened, handlers] = useDisclosure(false); return (
{debug && ( )}
); };