'use client'; import { useId, useState } from 'react'; import { IconEye, IconEyeOff, IconLock } from '../Icons'; /** * One password input for every place the admin sets one: subpage, album, * journal entry and site password (#690). * * The save routes store passwords as scrypt hashes (lib/admin/passwordHashing.ts), * so a saved password comes back as `scrypt:…`. That value is never put into * the input: showing it would invite editing a hash, and saving an edited hash * would lock the page with the hash string. Instead the field reads * "Protected", with Change and Remove. * * A plaintext value from a hand-written file is shown in the input as before; * the next save stores it hashed. */ export default function PasswordField({ value, onChange, placeholder = 'Leave empty for public access', disabled, label, id: idProp, }: { value: string | undefined; /** `undefined` removes the password. */ onChange: (value: string | undefined) => void; placeholder?: string; disabled?: boolean; /** Accessible name when there is no visible