{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "signature-box",
  "title": "Signature Box",
  "description": "Signature Box from the Get IT Done design system.",
  "dependencies": [
    "lucide-react@^0.379.0"
  ],
  "registryDependencies": [
    "https://zero-design.itdone.de/r/labels-context.json",
    "https://zero-design.itdone.de/r/recipes.json",
    "https://zero-design.itdone.de/r/utils.json",
    "https://zero-design.itdone.de/r/theme.json"
  ],
  "files": [
    {
      "path": "registry/ui/signature-box.tsx",
      "content": "'use client';\n\nimport { PenLine } from 'lucide-react';\nimport * as React from 'react';\n\nimport { focusRing } from '@/lib/recipes';\nimport { cn } from '@/lib/utils';\nimport { useLabels, useLocale, usePreset } from '@/components/ui/labels-context';\n\nexport interface SignatureBoxProps extends Omit<React.HTMLAttributes<HTMLElement>, 'children' | 'onClick'> {\n  // Signer name. Its presence marks the box as signed unless `signed` says otherwise.\n  name?: string;\n  // Time of signing, shown after the name. Dates are formatted with `formatDate`.\n  signedAt?: string | Date;\n  signed?: boolean;\n  // Accessible name of the field.\n  label?: string;\n  // Text of the open (unsigned) box.\n  placeholder?: string;\n  // Makes the open box an actionable button that starts signing.\n  onSign?: () => void;\n  disabled?: boolean;\n  formatDate?: (date: Date) => string;\n}\n\nconst defaultFormat = (date: Date, locale?: string) =>\n  new Intl.DateTimeFormat(locale, { dateStyle: 'medium', timeStyle: 'short' }).format(date);\n\n// Signature field: the signer name on the signature line with the signing time, or an open dashed box.\nconst SignatureBox = React.forwardRef<HTMLElement, SignatureBoxProps>(\n  ({ className, name, signedAt, signed, label: labelProp, placeholder: placeholderProp, onSign, disabled = false, formatDate: formatDateProp, ...props }, ref) => {\n    const l = useLabels();\n    const locale = useLocale();\n    // Zero: the signed state is a pen icon, the name in the 20/28 script without underline, and a regular date.\n    const zero = usePreset() === 'zero';\n    const label = labelProp ?? l.signature;\n    const placeholder = placeholderProp ?? l.signHere;\n    const formatDate = formatDateProp ?? ((date: Date) => defaultFormat(date, locale === 'de' ? 'de-DE' : undefined));\n    const isSigned = signed ?? Boolean(name);\n    const when = signedAt instanceof Date ? formatDate(signedAt) : signedAt;\n    const shared = cn(\n      'flex w-full items-center gap-3 rounded-dialog border border-solid px-4 py-3 text-left typography-ui',\n      isSigned ? 'border-border-default bg-background' : 'border-dashed border-border-default bg-transparent',\n      className,\n    );\n\n    if (isSigned) {\n      return (\n        <div\n          ref={ref as React.Ref<HTMLDivElement>}\n          role=\"group\"\n          aria-label={label}\n          data-state=\"signed\"\n          className={shared}\n          {...(props as React.HTMLAttributes<HTMLDivElement>)}\n        >\n          {zero ? <PenLine aria-hidden=\"true\" className=\"h-icon-md w-icon-md shrink-0 text-icon-subtle\" /> : null}\n          <span\n            className={cn(\n              'min-w-0 flex-1 truncate font-serif italic text-foreground',\n              zero ? 'typography-lead' : 'border-b border-solid border-foreground text-2xl leading-7',\n            )}\n          >\n            {name}\n          </span>\n          {when ? <time className={cn('shrink-0 text-text-subtle', zero ? 'typography-ui' : 'typography-caption')}>{when}</time> : null}\n        </div>\n      );\n    }\n\n    if (onSign) {\n      return (\n        <button\n          ref={ref as React.Ref<HTMLButtonElement>}\n          type=\"button\"\n          aria-label={`${label}: ${placeholder}`}\n          disabled={disabled}\n          data-state=\"open\"\n          onClick={onSign}\n          className={cn(shared, 'cursor-pointer text-text-subtle transition-colors hover:border-border-bold hover:bg-muted disabled:cursor-not-allowed disabled:opacity-disabled', focusRing)}\n          {...(props as React.ButtonHTMLAttributes<HTMLButtonElement>)}\n        >\n          {placeholder}\n        </button>\n      );\n    }\n\n    return (\n      <div\n        ref={ref as React.Ref<HTMLDivElement>}\n        role=\"group\"\n        aria-label={label}\n        data-state=\"open\"\n        className={cn(shared, 'text-text-subtle', disabled && 'opacity-disabled')}\n        {...(props as React.HTMLAttributes<HTMLDivElement>)}\n      >\n        {placeholder}\n      </div>\n    );\n  },\n);\nSignatureBox.displayName = 'SignatureBox';\n\nexport { SignatureBox };\n",
      "type": "registry:ui"
    }
  ],
  "type": "registry:ui"
}