{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "password-input",
  "title": "Password input",
  "description": "A password field with a button that shows or hides what was typed. Its eye rolls to the crossed eye, the caret stays where it was, and the password hides again when its form is sent or reset.",
  "dependencies": [
    "@ui-sdk/react",
    "@ui-sdk/core"
  ],
  "registryDependencies": [
    "https://kinoui.com/r/button.json",
    "https://kinoui.com/r/input.json",
    "https://kinoui.com/r/swap.json"
  ],
  "files": [
    {
      "path": "registry/components/kino/password-input.tsx",
      "content": "'use client'\n\nimport { buttonVariants } from '@/registry/components/kino/button'\nimport {\n  focusControl,\n  InputInvalidIcon,\n  inputBoxClassName,\n  inputControlClassName,\n} from '@/registry/components/kino/input'\nimport { IconPlaceholder } from '@/registry/icons/icon-placeholder'\nimport { SwapIcon } from '@/registry/lib/swap'\nimport {\n  PasswordInputControl as PasswordInputControlPrimitive,\n  PasswordInput as PasswordInputPrimitive,\n  PasswordInputToggle as PasswordInputTogglePrimitive,\n} from '@ui-sdk/react/password-input'\nimport type { ComponentProps, ReactNode } from 'react'\n\nimport { cn } from '@/lib/utils'\n\n/*\n * A password box with a button that shows or hides what was typed. ui-sdk\n * keeps the caret where it was, and hides the password again when its form\n * is sent or reset, or the page is left, so the browser never keeps it as\n * text. The button keeps one name and says whether it is pressed, and its eye\n * rolls to the crossed eye.\n */\nfunction PasswordInput({\n  className,\n  autoComplete = 'current-password',\n  toggleLabel = 'Show password',\n  children,\n  ...props\n}: Omit<ComponentProps<typeof PasswordInputPrimitive>, 'className' | 'children'> & {\n  className?: string\n  /** The default toggle's name; give each password field on a page its own, such as \"Show new password\". */\n  toggleLabel?: string\n  /** The box and the button, when you lay them out yourself; a `PasswordInputControl` and a `PasswordInputToggle` by default. */\n  children?: ReactNode\n}) {\n  return (\n    <PasswordInputPrimitive\n      autoComplete={autoComplete}\n      onPointerDown={focusControl}\n      className={cn(inputBoxClassName, 'cursor-text', className)}\n      {...props}\n    >\n      {children ?? (\n        <>\n          <PasswordInputControl />\n          <PasswordInputToggle aria-label={toggleLabel} />\n        </>\n      )}\n      <InputInvalidIcon />\n    </PasswordInputPrimitive>\n  )\n}\n\nfunction PasswordInputControl({\n  className,\n  ...props\n}: Omit<ComponentProps<typeof PasswordInputControlPrimitive>, 'className'> & {\n  className?: string\n}) {\n  return (\n    <PasswordInputControlPrimitive\n      // Edge draws an eye of its own in a password box.\n      className={cn(inputControlClassName, '[&::-ms-reveal]:hidden', className)}\n      {...props}\n    />\n  )\n}\n\n/** The button at the box's end that shows or hides the password. Name it with `aria-label`, such as \"Show password\". */\nfunction PasswordInputToggle({\n  className,\n  ...props\n}: Omit<ComponentProps<typeof PasswordInputTogglePrimitive>, 'className' | 'children'> & {\n  className?: string\n}) {\n  return (\n    <PasswordInputTogglePrimitive\n      data-variant='ghost'\n      className={cn(\n        buttonVariants({ variant: 'ghost', size: 'icon-xs' }),\n        // Muted, as the box's other icons and the Search field's clear are.\n        'text-muted-foreground order-last me-1.5',\n        className,\n      )}\n      {...props}\n    >\n      {({ visible }) => (\n        <SwapIcon\n          on={visible}\n          onIcon={\n            <IconPlaceholder\n              lucide='EyeOffIcon'\n              tabler='IconEyeOff'\n              hugeicons='ViewOffSlashIcon'\n              phosphor='EyeSlashIcon'\n              remixicon='RiEyeOffLine'\n              aria-hidden\n            />\n          }\n        >\n          <IconPlaceholder\n            lucide='EyeIcon'\n            tabler='IconEye'\n            hugeicons='ViewIcon'\n            phosphor='EyeIcon'\n            remixicon='RiEyeLine'\n            aria-hidden\n          />\n        </SwapIcon>\n      )}\n    </PasswordInputTogglePrimitive>\n  )\n}\n\nexport { PasswordInput, PasswordInputControl, PasswordInputToggle }\n",
      "type": "registry:component",
      "target": "@components/kino/password-input.tsx"
    }
  ],
  "type": "registry:component"
}