import { useRef } from 'react'; import { Box, Typography } from '@mui/material'; import ColorizeOutlinedIcon from '@mui/icons-material/ColorizeOutlined'; interface ColorPickerInputProps { label: string; required?: boolean; value: string; onChange: (hex: string) => void; } export function ColorPickerInput({ label, required, value, onChange }: ColorPickerInputProps) { const inputRef = useRef(null); const displayValue = value || '#000000'; const borderColor = value ? `color-mix(in srgb, ${value} 53%, transparent)` : 'rgba(255,255,255,0.12)'; const bgColor = value ? `color-mix(in srgb, ${value} 15%, #ffffff)` : 'rgba(255,255,255,0.04)'; const openPicker = () => inputRef.current?.click(); return ( {label} {required && ( * )} {value ? value.toUpperCase() : '—'} onChange(e.target.value.toUpperCase())} aria-label={`${label} color picker`} style={{ position: 'absolute', width: 0, height: 0, opacity: 0, pointerEvents: 'none', }} /> ); }