{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "input-group",
  "type": "registry:ui",
  "title": "Input Group",
  "description": "The input-group primitive.",
  "dependencies": [],
  "registryDependencies": [
    "https://ui.klarhimmel.com/r/theme.json",
    "https://ui.klarhimmel.com/r/utils.json"
  ],
  "files": [
    {
      "path": "src/ui/input-group.tsx",
      "type": "registry:file",
      "target": "components/klarhimmel/ui/input-group.tsx",
      "content": "import { forwardRef, type ButtonHTMLAttributes, type HTMLAttributes, type InputHTMLAttributes, type ReactNode } from 'react';\nimport { cn } from '../lib/utils';\n\n/**\n * One field made of parts: a prefix or suffix (a currency, a domain, an icon), the input, and a button. The parts share one\n * border and one focus ring. Name the field with a Field label or aria-label on the input; the group only draws the frame.\n */\nexport function InputGroup({ invalid, disabled, className, children, ...rest }: { invalid?: boolean; disabled?: boolean; className?: string; children: ReactNode } & Omit<HTMLAttributes<HTMLDivElement>, 'children'>) {\n  return (\n    <div\n      role=\"group\"\n      data-invalid={invalid ? 'true' : undefined}\n      data-disabled={disabled ? 'true' : undefined}\n      className={cn(\n        'flex min-h-11 w-full items-stretch overflow-hidden rounded-kh border border-kh-line-strong bg-kh-surface text-kh-body text-kh-ink shadow-kh-1 transition-[border-color] duration-(--kh-dur)',\n        'focus-within:outline-2 focus-within:outline-offset-0 focus-within:outline-(--kh-focus) hover:border-kh-muted',\n        'data-[invalid=true]:border-kh-danger data-[disabled=true]:cursor-not-allowed data-[disabled=true]:bg-kh-surface-2 data-[disabled=true]:text-kh-muted',\n        className,\n      )}\n      {...rest}\n    >\n      {children}\n    </div>\n  );\n}\n\n/** Text or an icon beside the input. Text is read by assistive tech in order, so write it as part of the question (\"https://\", \"kr\"). An icon passed alone is decorative. */\nexport function InputGroupAddon({ align = 'start', className, children }: { align?: 'start' | 'end'; className?: string; children: ReactNode }) {\n  return (\n    <span\n      className={cn(\n        'flex shrink-0 items-center gap-1.5 bg-kh-surface-2 px-3 text-kh-small text-kh-muted [&_svg]:size-4',\n        align === 'start' ? 'border-r border-kh-line' : 'border-l border-kh-line',\n        className,\n      )}\n    >\n      {children}\n    </span>\n  );\n}\n\n/** The input inside a group: no frame of its own. */\nexport const InputGroupInput = forwardRef<HTMLInputElement, InputHTMLAttributes<HTMLInputElement>>(function InputGroupInput({ className, ...rest }, ref) {\n  return <input ref={ref} className={cn('min-w-0 flex-1 bg-transparent px-3 text-kh-body text-kh-ink outline-none placeholder:text-kh-muted disabled:cursor-not-allowed', className)} {...rest} />;\n});\n\n/** A button inside a group. Give an icon-only one an aria-label. */\nexport const InputGroupButton = forwardRef<HTMLButtonElement, ButtonHTMLAttributes<HTMLButtonElement>>(function InputGroupButton({ className, type = 'button', ...rest }, ref) {\n  return (\n    <button\n      ref={ref}\n      type={type}\n      className={cn(\n        'inline-flex min-w-11 shrink-0 items-center justify-center gap-1.5 border-l border-kh-line bg-kh-surface px-3 text-kh-small font-medium text-kh-ink-2 transition-colors duration-(--kh-dur) [&_svg]:size-4',\n        'hover:bg-kh-surface-2 hover:text-kh-ink focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-(--kh-focus) disabled:pointer-events-none disabled:opacity-50',\n        className,\n      )}\n      {...rest}\n    />\n  );\n});\n"
    }
  ]
}
