{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "auth38",
  "title": "Pattern Lock Unlock",
  "description": "Full-height pattern unlock screen with a tappable 3x3 dot grid that draws connecting lines as dots are selected, plus clear and unlock controls. Perfect for app lock screens and quick re-authentication.",
  "dependencies": [
    "clsx",
    "tailwind-merge",
    "lucide-react"
  ],
  "registryDependencies": [
    "button"
  ],
  "files": [
    {
      "path": "registry/auth38/auth38.tsx",
      "content": "\"use client\";\n\nimport Link from \"next/link\";\nimport { useState } from \"react\";\nimport { Button } from \"@/components/ui/button\";\nimport { cn } from \"@/lib/utils\";\n\ninterface Auth38Props {\n  heading?: string;\n  description?: string;\n  minLength?: number;\n  labels?: {\n    clear?: string;\n  };\n  unlockButton?: {\n    label: string;\n    href: string;\n  };\n  forgotPrompt?: {\n    text: string;\n    linkLabel: string;\n    href: string;\n  };\n  className?: string;\n}\n\nexport const auth38Demo: Auth38Props = {\n  heading: \"Draw your pattern\",\n  description: \"Connect at least 4 dots to unlock your account.\",\n  minLength: 4,\n  labels: {\n    clear: \"Clear\",\n  },\n  unlockButton: {\n    label: \"Unlock\",\n    href: \"https://beste.co\",\n  },\n  forgotPrompt: {\n    text: \"Forgot your pattern?\",\n    linkLabel: \"Reset it\",\n    href: \"https://beste.co\",\n  },\n};\n\nconst GRID = 3;\nconst STEP = 80;\nconst CANVAS = GRID * STEP;\n\nfunction dotCenter(index: number) {\n  return {\n    x: (index % GRID) * STEP + STEP / 2,\n    y: Math.floor(index / GRID) * STEP + STEP / 2,\n  };\n}\n\nexport function Auth38({\n  heading,\n  description,\n  minLength = 4,\n  labels = {},\n  unlockButton,\n  forgotPrompt,\n  className,\n}: Auth38Props) {\n  const [selected, setSelected] = useState<number[]>([]);\n\n  const { clear: clearLabel } = labels;\n\n  const select = (index: number) =>\n    setSelected((prev) => (prev.includes(index) ? prev : [...prev, index]));\n  const clear = () => setSelected([]);\n\n  const canUnlock = selected.length >= minLength;\n\n  return (\n    <section\n      className={cn(\n        \"flex min-h-screen items-center justify-center px-4 py-16 md:py-24 w-full\",\n        className\n      )}\n    >\n      <div className=\"w-full max-w-sm text-center\">\n        {heading && (\n          <h1 className=\"text-2xl font-bold md:text-3xl\">{heading}</h1>\n        )}\n        {description && (\n          <p className=\"mx-auto mt-2 max-w-xs text-base text-muted-foreground\">\n            {description}\n          </p>\n        )}\n\n        <div\n          className=\"relative mx-auto mt-10\"\n          style={{ width: CANVAS, height: CANVAS }}\n        >\n          <svg\n            viewBox={`0 0 ${CANVAS} ${CANVAS}`}\n            className=\"pointer-events-none absolute inset-0 size-full text-primary\"\n            aria-hidden=\"true\"\n          >\n            {selected.length > 1 && (\n              <polyline\n                points={selected\n                  .map((index) => {\n                    const center = dotCenter(index);\n                    return `${center.x},${center.y}`;\n                  })\n                  .join(\" \")}\n                fill=\"none\"\n                stroke=\"currentColor\"\n                strokeWidth=\"4\"\n                strokeLinecap=\"round\"\n                strokeLinejoin=\"round\"\n              />\n            )}\n          </svg>\n\n          {Array.from({ length: GRID * GRID }).map((_, index) => {\n            const center = dotCenter(index);\n            const isActive = selected.includes(index);\n            return (\n              <button\n                key={index}\n                type=\"button\"\n                onClick={() => select(index)}\n                aria-pressed={isActive}\n                style={{ left: `${center.x}px`, top: `${center.y}px` }}\n                className=\"absolute flex size-14 -translate-x-1/2 -translate-y-1/2 items-center justify-center rounded-full focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\"\n              >\n                <span\n                  className={cn(\n                    \"rounded-full transition-all\",\n                    isActive\n                      ? \"size-5 bg-primary ring-4 ring-primary/20\"\n                      : \"size-3.5 bg-muted-foreground/30\"\n                  )}\n                />\n              </button>\n            );\n          })}\n        </div>\n\n        <div className=\"mt-10 flex flex-col gap-3\">\n          {unlockButton && (\n            <Button\n              size=\"lg\"\n              className=\"w-full\"\n              disabled={!canUnlock}\n              asChild={canUnlock}\n            >\n              {canUnlock ? (\n                <Link href={unlockButton.href}>{unlockButton.label}</Link>\n              ) : (\n                unlockButton.label\n              )}\n            </Button>\n          )}\n          {clearLabel && (\n            <Button\n              type=\"button\"\n              variant=\"ghost\"\n              size=\"lg\"\n              className=\"w-full\"\n              onClick={clear}\n              disabled={selected.length === 0}\n            >\n              {clearLabel}\n            </Button>\n          )}\n        </div>\n\n        {forgotPrompt && (\n          <p className=\"mt-6 text-sm text-muted-foreground\">\n            {forgotPrompt.text}{\" \"}\n            <Link\n              href={forgotPrompt.href}\n              className=\"font-medium text-foreground hover:underline\"\n            >\n              {forgotPrompt.linkLabel}\n            </Link>\n          </p>\n        )}\n      </div>\n    </section>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/beste/block/auth38.tsx"
    }
  ],
  "type": "registry:block"
}