'use client' import { useEffect, useRef, type ReactNode } from 'react' import { X } from 'lucide-react' export const salaryButton = 'inline-flex min-h-11 items-center justify-center gap-2 rounded-lg px-4 text-sm font-semibold transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#5a9ce6] disabled:cursor-not-allowed disabled:opacity-50' export const salarySecondary = `${salaryButton} border border-[#cbd5e1] bg-white text-[#334155] hover:bg-[#f1f5f9]` export const salaryPrimary = `${salaryButton} bg-[#0050cb] text-white hover:bg-[#003fa3]` export const salaryDanger = `${salaryButton} text-[#b42318] hover:bg-[#fff4f2]` export const salaryInput = 'min-h-11 w-full min-w-0 rounded-lg border border-[#cbd5e1] bg-white px-3 py-2 text-base text-[#101828] outline-none focus:border-[#0050cb] focus:ring-2 focus:ring-[#cce3ff] aria-[invalid=true]:border-[#b42318] disabled:bg-[#f1f5f9] sm:text-sm' export function SalaryConfigurationDialog({ title, busy, children, onClose, wide = false }: { title: string; busy?: boolean; children: ReactNode; onClose: () => void; wide?: boolean }) { const ref = useRef(null) const previous = useRef(typeof document !== 'undefined' && document.activeElement instanceof HTMLElement ? document.activeElement : null) useEffect(() => { const dialog = ref.current! dialog.showModal(); const overflow = document.body.style.overflow; document.body.style.overflow = 'hidden' return () => { dialog.close(); document.body.style.overflow = overflow; if (previous.current?.isConnected) previous.current.focus() } }, []) return { event.preventDefault(); if (!busy) onClose() }} onClick={event => { if (event.target === event.currentTarget && !busy) onClose() }} className={`m-auto max-h-[calc(100dvh-24px)] w-[calc(100%-24px)] overflow-y-auto rounded-lg bg-white p-0 text-[#101828] shadow-xl backdrop:bg-[#101828]/50 ${wide ? 'max-w-5xl' : 'max-w-lg'}`}>

{title}

{children}
}