"use client"; import { useId, type CSSProperties, type InputHTMLAttributes, type PointerEvent, type ReactNode } from "react"; type GlowInputProps = Omit, "className"> & { /** Field name. Shown above the box. */ label: string; /** Keep the label for screen readers only. */ hideLabel?: boolean; /** Icon at the start of the box (an svg works best). */ icon?: ReactNode; /** Small help text under the field. */ hint?: string; /** Two glow colours: [start, end]. */ colors?: [string, string]; /** Wrapper look (width etc.). */ className?: string; }; /* GlowInput: the border lights up under the pointer as you hover, and the whole edge glows in a gradient once the field has focus. */ export function GlowInput({ label, hideLabel = false, icon, hint, colors = ["#a78bfa", "#22d3ee"], className = "w-full max-w-sm", id, ...rest }: GlowInputProps) { const autoId = useId(); const inputId = id ?? autoId; const hintId = `${inputId}-hint`; const track = (e: PointerEvent) => { const r = e.currentTarget.getBoundingClientRect(); e.currentTarget.style.setProperty("--gx", `${e.clientX - r.left}px`); e.currentTarget.style.setProperty("--gy", `${e.clientY - r.top}px`); }; const fade = "transition-opacity duration-300 motion-reduce:transition-none"; const gradient = "linear-gradient(90deg, var(--g1), var(--g2))"; return (
{icon && ( {icon} )}
{hint && (

{hint}

)}
); }