/* password-field.jsx — PasswordField + StrengthMeter (the `.pw` composite), shared by the auth * screens (auth-app.jsx) and the account menu's change-password dialog (account-menu.jsx). * Moved out of auth-app.jsx 2026-09-20, markup unchanged (the error line's class is now * `pw-err`). Wrapped in an IIFE: planner scripts share one global scope, so a top-level const * here would collide with the host page's own. Needs window.__AUTH (auth-helpers.js) for * pwRules/meterTone and password-field.css. Exports window.RadishPassword. */ (function () { const { useState, useId } = React; const REQS = [["len", "10+ characters"], ["digit", "A number"], ["symbol", "A symbol"]]; function StrengthMeter({ password }) { const A = window.__AUTH; const rules = A.pwRules(password); const tone = A.meterTone(rules.score); return ( <>
{REQS.map(([key, text]) => ( {text} {rules[key] ? " (met)" : " (not met)"} ))}
); } /* `.pw` composite: a 32px row holding a borderless input + Show/Hide. Show/Hide state is per-field. */ function PasswordField({ label, right, value, onChange, onBlur, error, placeholder, autoComplete, autoFocus, meter, inputRef }) { const id = useId(); const [show, setShow] = useState(false); return (
{right}
onChange(e.target.value)} onBlur={onBlur} />
{error ? : null} {meter && }
); } window.RadishPassword = { PasswordField, StrengthMeter }; })();