{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "password-input",
  "title": "Password input",
  "description": "A password field with a key to show or hide it.",
  "dependencies": [
    "@ui-sdk/react@0.1.0-beta.5",
    "lucide-react@1.73.0"
  ],
  "registryDependencies": [
    "https://www.cyberspec.dev/r/cyber.json"
  ],
  "files": [
    {
      "path": "registry/cyber/ui/password-input.tsx",
      "content": "\"use client\"\n\nimport * as React from \"react\"\nimport { Field, FieldDescription, FieldError, FieldLabel } from \"@ui-sdk/react/field\"\nimport { PasswordInput as SdkPasswordInput, PasswordInputControl, PasswordInputToggle } from \"@ui-sdk/react/password-input\"\nimport { Eye, EyeOff, KeyRound } from \"lucide-react\"\nimport \"@/registry/cyber/ui/cyber/password-input.css\"\n\n// A secret in the kit's field box, with an eye key beside it that shows and\n// hides what's typed. Shown, the text switches to the mono face, where 0 and\n// O, and 1 and l, can be told apart. A CAPS tag lights over the box while\n// Caps Lock is on.\n//\n// - `hint` describes the field; `error` marks it invalid with a message.\n// - `toggleLabel` names the eye key. It says what the key does and stays the\n//   same in both states; whether it's pressed carries the rest.\n// - `placeholder` goes to the input. Everything else goes to the SDK root:\n//   `value`, `onValueChange`, `visible`, `defaultVisible`, `name`,\n//   `required`, `readOnly`, `autoComplete`, a `controller`.\nfunction PasswordInput({\n  label,\n  hint,\n  error,\n  toggleLabel = `Show ${label.toLowerCase()}`,\n  placeholder,\n  disabled,\n  required,\n  ...props\n}: Omit<React.ComponentProps<typeof SdkPasswordInput>, \"children\"> & {\n  label: string\n  hint?: React.ReactNode\n  error?: string\n  toggleLabel?: string\n  placeholder?: string\n}) {\n  return (\n    <Field data-kit=\"field\" disabled={disabled} invalid={error ? true : undefined}>\n      <SdkPasswordInput data-kit=\"password-input\" required={required} {...props}>\n        {(state) => (\n          <>\n            <div data-kit=\"password-input-head\">\n              <FieldLabel data-kit=\"label\">{label}</FieldLabel>\n              <span data-kit=\"password-input-tags\" aria-hidden>\n                {state.capsLock && <span data-kit=\"password-input-caps\">CAPS</span>}\n                {required && <span data-kit=\"password-input-tag\">REQ</span>}\n              </span>\n            </div>\n            <div data-kit=\"password-input-row\">\n              <div data-kit=\"control\" data-frame=\"br\" data-frame-focus=\"within\">\n                <span data-kit=\"password-input-tick\" aria-hidden />\n                <span data-kit=\"control-icon\" aria-hidden>\n                  <KeyRound />\n                </span>\n                <PasswordInputControl data-kit=\"password-input-control\" placeholder={placeholder} />\n              </div>\n              {/* On while shown, so its sound is the one a latch makes: the\n                  page's listener reads it before the press lands. */}\n              <PasswordInputToggle\n                data-kit=\"password-input-toggle\"\n                data-frame=\"br\"\n                data-press-flash=\"\"\n                data-sfx={state.visible ? \"off\" : \"on\"}\n                aria-label={toggleLabel}\n              >\n                {state.visible ? <EyeOff aria-hidden /> : <Eye aria-hidden />}\n              </PasswordInputToggle>\n            </div>\n            {/* The CAPS tag, for a screen reader: said once as it turns on. */}\n            <span data-sr-only role=\"status\">\n              {state.capsLock ? \"Caps Lock is on.\" : \"\"}\n            </span>\n          </>\n        )}\n      </SdkPasswordInput>\n      {hint && <FieldDescription data-kit=\"hint\">{hint}</FieldDescription>}\n      {error ? (\n        <FieldError data-kit=\"field-error\" match>\n          {error}\n        </FieldError>\n      ) : (\n        <FieldError data-kit=\"field-error\" />\n      )}\n    </Field>\n  )\n}\n\nexport { PasswordInput }\n",
      "type": "registry:ui",
      "target": "@ui/password-input.tsx"
    },
    {
      "path": "registry/cyber/ui/cyber/password-input.css",
      "content": "@layer ui-sdk, cyber.tokens, cyber.base, cyber.ui, cyber.blocks, cyber.fx, cyber.a11y;\n\n/* A password input is the shared field box (field.css) with an eye key\n   standing beside it, rather than inside it: the key is a frame of its own,\n   so its focus ring is its own and never reads as the box's. */\n@layer cyber.ui {\n  /* The SDK's root: the label's row over the box and its key. */\n  [data-skin=\"cyber\"] [data-kit=\"password-input\"] {\n    position: relative;\n    display: grid;\n    gap: 6px;\n    min-width: 0;\n  }\n\n  [data-skin=\"cyber\"] [data-kit=\"password-input-head\"] {\n    display: flex;\n    align-items: baseline;\n    justify-content: space-between;\n    gap: 12px;\n    min-width: 0;\n\n    & [data-kit=\"label\"][data-disabled] {\n      color: var(--cy-ink-mute);\n    }\n  }\n\n  [data-skin=\"cyber\"] [data-kit=\"password-input-tags\"] {\n    flex: none;\n    display: flex;\n    align-items: center;\n    gap: 6px;\n    font-family: var(--cy-mono);\n    font-size: 9px;\n    letter-spacing: 0.08em;\n    line-height: 1;\n  }\n\n  /* REQ: printed, so \"required\" doesn't rest on an asterisk's color. */\n  [data-skin=\"cyber\"] [data-kit=\"password-input-tag\"] {\n    color: var(--cy-ink-mute);\n  }\n\n  /* CAPS: a warning, so it's the flag color, solid, and a word. */\n  [data-skin=\"cyber\"] [data-kit=\"password-input-caps\"] {\n    padding: 2px 4px 1px;\n    font-weight: 700;\n    color: var(--cy-on-solid);\n    background: var(--cy-flag);\n    animation: var(--cy-fx-in) 200ms var(--cy-ease-snap) backwards;\n  }\n\n  [data-skin=\"cyber\"] [data-kit=\"password-input-row\"] {\n    display: flex;\n    gap: 4px;\n    min-width: 0;\n  }\n\n  /* The secret is set in the mono face either way. Hidden, its dots are\n     heavier than the display face's and sit apart, so they can be counted;\n     shown, 0 and O, and 1 and l, can be told apart. */\n  [data-skin=\"cyber\"] [data-kit=\"password-input-control\"] {\n    font-family: var(--cy-mono);\n    font-size: var(--cy-text-sm);\n    letter-spacing: 0.14em;\n\n    /* The box shows focus for the input (data-frame-focus=\"within\"), so the\n       input's own ring is cut off rather than drawn twice. */\n    clip-path: inset(0);\n\n    &[data-visible] {\n      letter-spacing: 0.02em;\n    }\n\n    &::placeholder {\n      font-family: var(--cy-font);\n      font-size: var(--cy-text-md);\n      letter-spacing: 0.01em;\n    }\n\n    /* The browser's own reveal glyph would double the kit's key. */\n    &::-ms-reveal {\n      display: none;\n    }\n  }\n\n  /* A segment of the box's leading edge, as on a text field: the signal\n     color once the field holds something, the flag color when what it holds\n     is wrong. */\n  [data-skin=\"cyber\"] [data-kit=\"password-input-tick\"] {\n    position: absolute;\n    inset-block: 9px;\n    inset-inline-start: -1px;\n    width: 3px;\n    background: transparent;\n    pointer-events: none;\n    transition: background-color var(--cy-t) var(--cy-ease-snap);\n\n    [data-kit=\"password-input\"][data-filled] & {\n      background: var(--cy-signal);\n    }\n    [data-kit=\"control\"]:has([aria-invalid=\"true\"]) > & {\n      background: var(--cy-flag);\n    }\n    [data-kit=\"password-input\"][data-disabled] & {\n      background: transparent;\n    }\n  }\n\n  /* The eye key: square, the box's height. Up while the secret is hidden;\n     latched (the lit fill, the brighter ink, and a struck-through eye) while\n     it's shown. */\n  [data-skin=\"cyber\"] [data-kit=\"password-input-toggle\"] {\n    --frame-cut: var(--cy-cut-sm);\n    --frame-line: var(--cy-line-ctl);\n    --frame-fill: var(--cy-panel);\n\n    flex: none;\n    display: grid;\n    place-items: center;\n    width: var(--cy-h);\n    min-height: var(--cy-h);\n    padding: 0;\n    color: var(--cy-ink);\n    cursor: pointer;\n    transition:\n      background-color var(--cy-t-fast) linear,\n      border-color var(--cy-t-fast) linear,\n      color var(--cy-t-fast) linear;\n\n    & svg {\n      width: 16px;\n      height: 16px;\n    }\n\n    @media (hover: hover) {\n      &:hover:not([data-disabled]) {\n        --frame-line: var(--cy-line-hot);\n        --frame-fill: var(--cy-fill-hover);\n      }\n    }\n\n    &:is(:active, [data-visible]):not([data-disabled]) {\n      --frame-line: var(--cy-line-hot);\n      --frame-fill: var(--cy-fill-active);\n      color: var(--cy-ink-hi);\n    }\n\n    &[data-disabled] {\n      --frame-line: var(--cy-line-deco);\n      --frame-image: repeating-linear-gradient(135deg, transparent 0 5px, var(--cy-line-deco) 5px 6px);\n      color: var(--cy-ink-mute);\n      cursor: not-allowed;\n    }\n  }\n}\n",
      "type": "registry:file",
      "target": "@ui/cyber/password-input.css"
    }
  ],
  "type": "registry:ui"
}
