{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "micro-password-eye",
  "type": "registry:component",
  "title": "Password Eye",
  "description": "A password field whose eye button watches your pointer and caret, blinks open to reveal, and flips each character between dot and letter in a wave. It also warns when Caps Lock is on.",
  "author": "Hyperblur <hello@hyperblur.dev>",
  "dependencies": [],
  "registryDependencies": [],
  "categories": [
    "micro",
    "password",
    "input",
    "reveal",
    "eye",
    "form",
    "micro"
  ],
  "docs": "https://hyperblur.dev/effects/micro-password-eye",
  "files": [
    {
      "path": "registry/hyperblur/micro-password-eye.tsx",
      "type": "registry:component",
      "target": "components/hyperblur/micro-password-eye.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nexport interface MicroPasswordEyeProps\n  extends Omit<React.InputHTMLAttributes<HTMLInputElement>, \"value\" | \"defaultValue\" | \"onChange\" | \"type\" | \"size\"> {\n  label?: string;\n  value?: string;\n  defaultValue?: string;\n  revealed?: boolean;\n  defaultRevealed?: boolean;\n  accent?: string;\n  hint?: string;\n  onValueChange?: (value: string) => void;\n  onRevealedChange?: (revealed: boolean) => void;\n}\n\nconst css = `\n.hb-wf7 {\n  --hb-wf7-c: #2f7bff;\n  display: flex;\n  flex-direction: column;\n  gap: 7px;\n  width: 100%;\n  max-width: 320px;\n  box-sizing: border-box;\n  font-family: inherit;\n  color: #ededed;\n}\n.hb-wf7 *, .hb-wf7 *::before, .hb-wf7 *::after { box-sizing: border-box; }\n.hb-wf7-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }\n.hb-wf7-lb { font-size: 12.5px; font-weight: 500; color: #bdbdbd; }\n.hb-wf7-caps {\n  display: inline-flex;\n  align-items: center;\n  gap: 5px;\n  padding: 2px 7px;\n  border-radius: 999px;\n  background: rgba(255, 176, 32, 0.12);\n  color: #ffc35a;\n  font-size: 10.5px;\n  font-weight: 600;\n  opacity: 0;\n  transform: translateY(3px);\n  transition: opacity 0.2s ease, transform 0.25s cubic-bezier(0.3, 1.6, 0.5, 1);\n}\n.hb-wf7-caps[data-on=\"true\"] { opacity: 1; transform: none; }\n.hb-wf7-f {\n  position: relative;\n  display: flex;\n  align-items: center;\n  height: 44px;\n  border-radius: 12px;\n  background: #0d0d0d;\n  border: 1px solid #262626;\n  box-shadow: inset 0 1px 2px rgba(0,0,0,0.6);\n  transition: border-color 0.2s ease, box-shadow 0.2s ease;\n}\n.hb-wf7-f:focus-within { border-color: color-mix(in srgb, var(--hb-wf7-c) 70%, #262626); box-shadow: 0 0 0 3px color-mix(in srgb, var(--hb-wf7-c) 20%, transparent), inset 0 1px 2px rgba(0,0,0,0.6); }\n.hb-wf7-box { position: relative; flex: 1; min-width: 0; height: 100%; overflow: hidden; }\n.hb-wf7-in {\n  width: 100%;\n  height: 100%;\n  margin: 0;\n  padding: 0 0 0 14px;\n  border: 0;\n  background: transparent;\n  color: #ededed;\n  caret-color: var(--hb-wf7-c);\n  font-family: var(--font-mono), ui-monospace, monospace;\n  font-size: 14px;\n  letter-spacing: 0.04em;\n  outline: none;\n}\n.hb-wf7-in::placeholder { color: #555; letter-spacing: 0; font-family: inherit; }\n.hb-wf7[data-flip=\"true\"] .hb-wf7-in { color: transparent; }\n.hb-wf7-ov {\n  position: absolute;\n  left: 14px;\n  top: 0;\n  bottom: 0;\n  display: flex;\n  align-items: center;\n  pointer-events: none;\n  font-family: var(--font-mono), ui-monospace, monospace;\n  font-size: 14px;\n  letter-spacing: 0.04em;\n  white-space: pre;\n  perspective: 120px;\n}\n.hb-wf7-ch { position: relative; display: inline-block; }\n.hb-wf7-ch > span { display: inline-block; backface-visibility: hidden; }\n.hb-wf7-ch > span:last-child { position: absolute; left: 0; top: 0; width: 100%; text-align: center; }\n.hb-wf7-ov[data-to=\"text\"] .hb-wf7-ch > span:first-child { animation: hb-wf7-in 0.32s cubic-bezier(0.3, 1.4, 0.5, 1) both; animation-delay: var(--hb-wf7-d); }\n.hb-wf7-ov[data-to=\"text\"] .hb-wf7-ch > span:last-child { animation: hb-wf7-out 0.32s cubic-bezier(0.3, 1.4, 0.5, 1) both; animation-delay: var(--hb-wf7-d); }\n.hb-wf7-ov[data-to=\"dots\"] .hb-wf7-ch > span:first-child { animation: hb-wf7-out 0.32s cubic-bezier(0.3, 1.4, 0.5, 1) both; animation-delay: var(--hb-wf7-d); }\n.hb-wf7-ov[data-to=\"dots\"] .hb-wf7-ch > span:last-child { animation: hb-wf7-in 0.32s cubic-bezier(0.3, 1.4, 0.5, 1) both; animation-delay: var(--hb-wf7-d); }\n@keyframes hb-wf7-in { from { transform: rotateX(-90deg); opacity: 0; color: var(--hb-wf7-c); } to { transform: none; opacity: 1; } }\n@keyframes hb-wf7-out { from { transform: none; opacity: 1; } to { transform: rotateX(90deg); opacity: 0; } }\n.hb-wf7-eye {\n  flex: none;\n  display: grid;\n  place-items: center;\n  width: 38px;\n  height: 38px;\n  margin: 0 3px 0 6px;\n  padding: 0;\n  border: 0;\n  border-radius: 9px;\n  background: transparent;\n  color: #8a8a8a;\n  cursor: pointer;\n  transition: background 0.2s ease, color 0.2s ease, transform 0.2s cubic-bezier(0.3, 1.6, 0.5, 1);\n}\n.hb-wf7-eye:hover { background: #1a1a1a; color: #ededed; }\n.hb-wf7-eye:active { transform: scale(0.9); }\n.hb-wf7-eye:focus-visible { outline: 2px solid var(--hb-wf7-c); outline-offset: 0; }\n.hb-wf7-eye svg { width: 22px; height: 22px; overflow: visible; }\n.hb-wf7-open { transform-origin: 12px 12px; transform: scaleY(0.08); opacity: 0; transition: transform 0.28s cubic-bezier(0.3, 1.5, 0.5, 1), opacity 0.15s ease; }\n.hb-wf7-shut { transition: opacity 0.18s ease; }\n.hb-wf7[data-shown=\"true\"] .hb-wf7-open { transform: none; opacity: 1; }\n.hb-wf7[data-shown=\"true\"] .hb-wf7-shut { opacity: 0; }\n.hb-wf7[data-shown=\"true\"] .hb-wf7-eye { color: var(--hb-wf7-c); }\n.hb-wf7-pu { transition: transform 0.18s ease-out; }\n.hb-wf7-ht { font-size: 11px; color: #6f6f6f; }\n@media (prefers-reduced-motion: reduce) {\n  .hb-wf7-open, .hb-wf7-shut, .hb-wf7-pu, .hb-wf7-eye, .hb-wf7-caps, .hb-wf7-f { transition: none; }\n  .hb-wf7-ov { display: none; }\n  .hb-wf7[data-flip=\"true\"] .hb-wf7-in { color: #ededed; }\n}\n`;\n\nexport function MicroPasswordEye({\n  label = \"Password\",\n  value,\n  defaultValue = \"\",\n  revealed,\n  defaultRevealed = false,\n  accent = \"#2f7bff\",\n  hint,\n  placeholder = \"Enter your password\",\n  autoComplete = \"current-password\",\n  onValueChange,\n  onRevealedChange,\n  onKeyDown,\n  onKeyUp,\n  className = \"\",\n  style,\n  id,\n  disabled,\n  ...rest\n}: MicroPasswordEyeProps) {\n  const autoId = React.useId();\n  const inputId = id ?? `hb-wf7-${autoId.replace(/:/g, \"\")}`;\n  const [inner, setInner] = React.useState(defaultValue);\n  const [innerShown, setInnerShown] = React.useState(defaultRevealed);\n  const v = value ?? inner;\n  const shown = revealed ?? innerShown;\n  const [flip, setFlip] = React.useState<{ to: \"text\" | \"dots\"; n: number; scroll: number } | null>(null);\n  const [look, setLook] = React.useState({ x: 0, y: 0 });\n  const [caps, setCaps] = React.useState(false);\n  const rootRef = React.useRef<HTMLDivElement>(null);\n  const inputRef = React.useRef<HTMLInputElement>(null);\n  const eyeRef = React.useRef<HTMLButtonElement>(null);\n\n  React.useEffect(() => {\n    if (!flip) return;\n    const ms = Math.min(v.length, 24) * 22 + 360;\n    const t = window.setTimeout(() => setFlip(null), ms);\n    return () => window.clearTimeout(t);\n  }, [flip, v.length]);\n\n  const toggle = () => {\n    const next = !shown;\n    if (revealed === undefined) setInnerShown(next);\n    onRevealedChange?.(next);\n    if (v.length) setFlip((f) => ({ to: next ? \"text\" : \"dots\", n: (f?.n ?? 0) + 1, scroll: inputRef.current?.scrollLeft ?? 0 }));\n  };\n\n  const lookAt = (cx: number, cy: number) => {\n    const el = eyeRef.current;\n    if (!el) return;\n    const r = el.getBoundingClientRect();\n    const dx = cx - (r.left + r.width / 2);\n    const dy = cy - (r.top + r.height / 2);\n    const d = Math.hypot(dx, dy) || 1;\n    const k = Math.min(1, d / 120);\n    setLook({ x: (dx / d) * 2.4 * k, y: (dy / d) * 1.6 * k });\n  };\n\n  const lookAtCaret = () => {\n    const el = inputRef.current;\n    const eye = eyeRef.current;\n    if (!el || !eye) return;\n    const r = el.getBoundingClientRect();\n    const pos = el.selectionStart ?? v.length;\n    lookAt(r.left + 14 + pos * 9.1 - el.scrollLeft, r.top + r.height / 2);\n  };\n\n  const chars = Array.from(v);\n\n  return (\n    <div\n      ref={rootRef}\n      className={`hb-wf7 ${className}`}\n      data-shown={shown}\n      data-flip={!!flip}\n      style={{ ...style, [\"--hb-wf7-c\" as string]: accent }}\n      onPointerMove={(e) => lookAt(e.clientX, e.clientY)}\n      onPointerLeave={() => setLook({ x: 0, y: 0 })}\n    >\n      <style href=\"hb-micro-password-eye\" precedence=\"default\">\n        {css}\n      </style>\n      <div className=\"hb-wf7-top\">\n        <label className=\"hb-wf7-lb\" htmlFor={inputId}>\n          {label}\n        </label>\n        <span className=\"hb-wf7-caps\" data-on={caps} aria-live=\"polite\">\n          <svg width=\"10\" height=\"10\" viewBox=\"0 0 10 10\" fill=\"currentColor\" aria-hidden=\"true\">\n            <path d=\"M5 1l4 4.2H6.6V7H3.4V5.2H1zM3.4 8h3.2v1H3.4z\" />\n          </svg>\n          {caps ? \"Caps Lock is on\" : \"\"}\n        </span>\n      </div>\n      <div className=\"hb-wf7-f\">\n        <div className=\"hb-wf7-box\">\n          <input\n            ref={inputRef}\n            id={inputId}\n            className=\"hb-wf7-in\"\n            type={shown ? \"text\" : \"password\"}\n            value={v}\n            placeholder={placeholder}\n            autoComplete={autoComplete}\n            spellCheck={false}\n            autoCapitalize=\"off\"\n            disabled={disabled}\n            onChange={(e) => {\n              if (value === undefined) setInner(e.target.value);\n              onValueChange?.(e.target.value);\n              setFlip(null);\n              lookAtCaret();\n            }}\n            onKeyDown={(e) => {\n              onKeyDown?.(e);\n              setCaps(e.getModifierState?.(\"CapsLock\") ?? false);\n            }}\n            onKeyUp={(e) => {\n              onKeyUp?.(e);\n              setCaps(e.getModifierState?.(\"CapsLock\") ?? false);\n              lookAtCaret();\n            }}\n            {...rest}\n          />\n          {flip ? (\n            <span key={flip.n} className=\"hb-wf7-ov\" data-to={flip.to} aria-hidden=\"true\" style={{ transform: `translateX(${(-flip.scroll).toFixed(1)}px)` }}>\n              {chars.map((c, i) => (\n                <span key={i} className=\"hb-wf7-ch\" style={{ [\"--hb-wf7-d\" as string]: `${Math.min(i, 24) * 22}ms` }}>\n                  <span>{c}</span>\n                  <span>{\"•\"}</span>\n                </span>\n              ))}\n            </span>\n          ) : null}\n        </div>\n        <button\n          ref={eyeRef}\n          type=\"button\"\n          className=\"hb-wf7-eye\"\n          aria-label={shown ? \"Hide password\" : \"Show password\"}\n          aria-pressed={shown}\n          aria-controls={inputId}\n          disabled={disabled}\n          onClick={toggle}\n        >\n          <svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.7\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden=\"true\">\n            <g className=\"hb-wf7-open\">\n              <path d=\"M2.5 12c2.3-4.2 5.6-6.3 9.5-6.3s7.2 2.1 9.5 6.3c-2.3 4.2-5.6 6.3-9.5 6.3S4.8 16.2 2.5 12z\" />\n              <g className=\"hb-wf7-pu\" style={{ transform: `translate(${look.x.toFixed(2)}px,${look.y.toFixed(2)}px)` }}>\n                <circle cx=\"12\" cy=\"12\" r=\"3.4\" />\n                <circle cx=\"12\" cy=\"12\" r=\"1.3\" fill=\"currentColor\" stroke=\"none\" />\n              </g>\n            </g>\n            <g className=\"hb-wf7-shut\">\n              <path d=\"M2.5 11c2.3 3.6 5.6 5.4 9.5 5.4s7.2-1.8 9.5-5.4\" />\n              <path d=\"M6 14.6l-1.4 2M12 16.4v2.4M18 14.6l1.4 2M9 15.9l-.6 2.3M15 15.9l.6 2.3\" />\n            </g>\n          </svg>\n        </button>\n      </div>\n      {hint ? <span className=\"hb-wf7-ht\">{hint}</span> : null}\n    </div>\n  );\n}\n"
    }
  ]
}