{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "signature-pad",
  "title": "Signature Pad",
  "description": "A shadcn-style signature pad component built with Ark UI primitives.",
  "dependencies": ["@ark-ui/react", "lucide-react", "class-variance-authority"],
  "registryDependencies": ["button"],
  "files": [
    {
      "path": "src/components/ui/signature-pad.tsx",
      "content": "\"use client\";\n\nimport {\n  SignaturePad as SignaturePadPrimitive,\n  useSignaturePad,\n  useSignaturePadContext,\n} from \"@ark-ui/react/signature-pad\";\nimport type { VariantProps } from \"class-variance-authority\";\nimport { XIcon } from \"lucide-react\";\nimport type { ComponentProps, CSSProperties } from \"react\";\nimport { buttonVariants } from \"@/components/ui/button\";\nimport { cn } from \"@/lib/utils\";\n\nexport type SignaturePadOwnProps = {\n  /** Canvas width in CSS pixels. Default 20rem. */\n  width?: string | number;\n  /** Canvas height in CSS pixels. Default 10rem. */\n  height?: string | number;\n};\n\nconst layoutStyle = ({\n  width = \"20rem\",\n  height = \"10rem\",\n}: SignaturePadOwnProps): CSSProperties =>\n  ({\n    \"--signature-pad-width\": typeof width === \"number\" ? `${width}px` : width,\n    \"--signature-pad-height\":\n      typeof height === \"number\" ? `${height}px` : height,\n  }) as CSSProperties;\n\nexport type SignaturePadProps = ComponentProps<\n  typeof SignaturePadPrimitive.Root\n> &\n  SignaturePadOwnProps;\n\nexport const SignaturePad = ({\n  className,\n  width,\n  height,\n  style,\n  ...props\n}: SignaturePadProps) => (\n  <SignaturePadPrimitive.Root\n    className={cn(\n      \"flex w-full max-w-full flex-col gap-1.5 text-foreground\",\n      \"w-(--signature-pad-width)\",\n      \"data-disabled:opacity-50 data-disabled:grayscale\",\n      className,\n    )}\n    data-slot=\"signature-pad\"\n    style={{ ...layoutStyle({ width, height }), ...style }}\n    {...props}\n  />\n);\n\nexport type SignaturePadLabelProps = ComponentProps<\n  typeof SignaturePadPrimitive.Label\n>;\n\nexport const SignaturePadLabel = ({\n  className,\n  ...props\n}: SignaturePadLabelProps) => (\n  <SignaturePadPrimitive.Label\n    className={cn(\n      \"text-sm font-medium text-foreground leading-none select-none\",\n      className,\n    )}\n    data-slot=\"signature-pad-label\"\n    {...props}\n  />\n);\n\nexport type SignaturePadControlProps = ComponentProps<\n  typeof SignaturePadPrimitive.Control\n>;\n\nexport const SignaturePadControl = ({\n  className,\n  ...props\n}: SignaturePadControlProps) => (\n  <SignaturePadPrimitive.Control\n    className={cn(\n      \"relative flex min-h-(--signature-pad-height) min-w-0 flex-col overflow-hidden rounded-lg border border-border bg-muted/40\",\n      \"data-disabled:cursor-not-allowed\",\n      className,\n    )}\n    data-slot=\"signature-pad-control\"\n    {...props}\n  />\n);\n\nexport type SignaturePadSegmentProps = ComponentProps<\n  typeof SignaturePadPrimitive.Segment\n>;\n\nexport const SignaturePadSegment = ({\n  className,\n  ...props\n}: SignaturePadSegmentProps) => (\n  <SignaturePadPrimitive.Segment\n    className={cn(\n      \"h-full min-h-(--signature-pad-height) w-full touch-none text-foreground\",\n      // Ark's SignaturePad renders filled paths; use fill to avoid the \"double stroke\" look.\n      \"[&_path]:fill-current [&_path]:stroke-none\",\n      \"focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset focus-visible:outline-none\",\n      className,\n    )}\n    data-slot=\"signature-pad-segment\"\n    {...props}\n  />\n);\n\nexport type SignaturePadClearTriggerProps =\n  SignaturePadPrimitive.ClearTriggerProps & VariantProps<typeof buttonVariants>;\n\nexport const SignaturePadClearTrigger = ({\n  className,\n  variant = \"ghost\",\n  size = \"icon-sm\",\n  ...props\n}: SignaturePadClearTriggerProps) => (\n  <SignaturePadPrimitive.ClearTrigger\n    className={cn(\n      buttonVariants({ variant, size }),\n      \"absolute top-2 right-2\",\n      className,\n    )}\n    data-slot=\"signature-pad-clear-trigger\"\n    {...props}\n  />\n);\n\nexport type SignaturePadGuideProps = ComponentProps<\n  typeof SignaturePadPrimitive.Guide\n>;\n\nexport const SignaturePadGuide = ({\n  className,\n  ...props\n}: SignaturePadGuideProps) => (\n  <SignaturePadPrimitive.Guide\n    className={cn(\n      \"pointer-events-none absolute right-6 bottom-6 left-6 border-border border-dashed border-b\",\n      className,\n    )}\n    data-slot=\"signature-pad-guide\"\n    {...props}\n  />\n);\n\nexport type SignaturePadHiddenInputProps = ComponentProps<\n  typeof SignaturePadPrimitive.HiddenInput\n>;\n\nexport const SignaturePadHiddenInput = ({\n  className,\n  ...props\n}: SignaturePadHiddenInputProps) => (\n  <SignaturePadPrimitive.HiddenInput\n    className={cn(className)}\n    data-slot=\"signature-pad-hidden-input\"\n    {...props}\n  />\n);\n\nexport type SignaturePadRootProviderProps = ComponentProps<\n  typeof SignaturePadPrimitive.RootProvider\n> &\n  SignaturePadOwnProps;\n\nexport const SignaturePadRootProvider = ({\n  className,\n  width,\n  height,\n  style,\n  ...props\n}: SignaturePadRootProviderProps) => (\n  <SignaturePadPrimitive.RootProvider\n    className={cn(\n      \"flex w-full max-w-full flex-col gap-1.5 text-foreground\",\n      \"w-(--signature-pad-width)\",\n      \"data-disabled:opacity-50 data-disabled:grayscale\",\n      className,\n    )}\n    data-slot=\"signature-pad-provider\"\n    style={{ ...layoutStyle({ width, height }), ...style }}\n    {...props}\n  />\n);\n\nexport const SignaturePadContext = SignaturePadPrimitive.Context;\n\nexport type SignaturePadFieldProps = Omit<\n  SignaturePadControlProps,\n  \"children\"\n> & {\n  /** Content shown inside the clear button (usually an icon). */\n  children?: SignaturePadClearTriggerProps[\"children\"];\n  /** Hide the dashed guide line. */\n  hideGuide?: boolean;\n  /** Extra props for the clear trigger. */\n  clearTriggerProps?: Omit<SignaturePadClearTriggerProps, \"children\">;\n  /** Extra props for the segment. */\n  segmentProps?: SignaturePadSegmentProps;\n  /** Extra props for the guide. */\n  guideProps?: SignaturePadGuideProps;\n};\n\nexport const SignaturePadField = ({\n  className,\n  children,\n  hideGuide,\n  clearTriggerProps,\n  segmentProps,\n  guideProps,\n  ...controlProps\n}: SignaturePadFieldProps) => (\n  <SignaturePadControl className={className} {...controlProps}>\n    <SignaturePadSegment {...segmentProps} />\n    <SignaturePadClearTrigger\n      aria-label=\"Clear signature\"\n      type=\"button\"\n      {...clearTriggerProps}\n    >\n      {children ?? <XIcon className=\"size-4\" />}\n    </SignaturePadClearTrigger>\n    {hideGuide ? null : <SignaturePadGuide {...guideProps} />}\n  </SignaturePadControl>\n);\n\nexport type {\n  SignaturePadDrawDetails,\n  SignaturePadDrawEndDetails,\n  SignaturePadDrawingOptions,\n} from \"@ark-ui/react/signature-pad\";\nexport { useSignaturePad, useSignaturePadContext };\n",
      "type": "registry:ui",
      "target": "src/components/ui/signature-pad.tsx"
    }
  ],
  "type": "registry:ui"
}
