import { useState } from 'react'; import { Check, Copy, Eye, EyeOff, Loader2 } from 'lucide-react'; import { cn } from '@/lib/utils'; import { Button } from '@/components/ui/button'; import { toast } from 'sonner'; export function CredentialField({ label, value, mono = true, breakAll = false, maskable = false, loading = false, }: { label: string; value: string; mono?: boolean; breakAll?: boolean; maskable?: boolean; loading?: boolean; }) { const [copied, setCopied] = useState(false); const [revealed, setRevealed] = useState(!maskable); const copy = () => { if (!value) return; navigator.clipboard.writeText(value); setCopied(true); toast.success(`${label} copied`); setTimeout(() => setCopied(false), 1600); }; const display = loading ? '' : revealed || !maskable ? value : '•'.repeat(Math.min(40, value.length || 40)); return (