"use client"; import { RiCalculatorFill, RiCalculatorLine } from "@remixicon/react"; import * as React from "react"; import Calculator from "@/components/calculadora/calculator"; import { Button, buttonVariants } from "@/components/ui/button"; import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogTrigger, } from "@/components/ui/dialog"; import { Tooltip, TooltipContent, TooltipTrigger, } from "@/components/ui/tooltip"; import { cn } from "@/lib/utils/ui"; import { useDraggableDialog } from "./use-draggable-dialog"; type Variant = React.ComponentProps["variant"]; type Size = React.ComponentProps["size"]; type CalculatorDialogButtonProps = { variant?: Variant; size?: Size; className?: string; children?: React.ReactNode; withTooltip?: boolean; onSelectValue?: (value: string) => void; }; export function CalculatorDialogContent({ open, onSelectValue, }: { open: boolean; onSelectValue?: (value: string) => void; }) { const { dragHandleProps, contentRefCallback, resetPosition } = useDraggableDialog(); React.useEffect(() => { if (!open) { resetPosition(); } }, [open, resetPosition]); return ( e.preventDefault()} onPointerDownOutside={(e) => e.preventDefault()} onFocusOutside={(e) => e.preventDefault()} onInteractOutside={(e) => e.preventDefault()} > Calculadora ); } export function CalculatorDialogButton({ variant = "ghost", size = "sm", className, children, withTooltip = false, onSelectValue, }: CalculatorDialogButtonProps) { const [open, setOpen] = React.useState(false); const handleSelectValue = onSelectValue ? (value: string) => { onSelectValue(value); setOpen(false); } : undefined; if (withTooltip) { return ( Calculadora ); } return ( ); }