{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "input-group",
  "title": "Input group",
  "description": "An input or a textarea with what sits beside it: an icon, a prefix, a button or a counter, in one box.",
  "dependencies": [
    "@ui-sdk/react",
    "@ui-sdk/core",
    "class-variance-authority"
  ],
  "registryDependencies": [
    "https://kinoui.com/r/input.json",
    "https://kinoui.com/r/textarea.json",
    "https://kinoui.com/r/button.json",
    "https://kinoui.com/r/theme.json"
  ],
  "files": [
    {
      "path": "registry/components/kino/input-group.tsx",
      "content": "'use client'\n\nimport { Button } from '@/registry/components/kino/button'\nimport {\n  focusControl,\n  InputInvalidIcon,\n  InputControl,\n  inputBoxClassName,\n} from '@/registry/components/kino/input'\nimport { TextareaControl } from '@/registry/components/kino/textarea'\nimport { InputGroup as InputGroupPrimitive } from '@ui-sdk/react/input'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport type { ComponentProps, ReactNode } from 'react'\n\nimport { cn } from '@/lib/utils'\n\n/*\n * ui-sdk's Input group, as a box that holds a control and what sits beside\n * it: an icon, a prefix, a button, a counter. A press anywhere on it outside\n * a button puts the caret in the control, and the invalid mark sits before\n * what ends the row.\n */\nfunction InputGroup({\n  className,\n  children,\n  ...props\n}: Omit<ComponentProps<typeof InputGroupPrimitive>, 'className' | 'children'> & {\n  className?: string\n  children?: ReactNode\n}) {\n  return (\n    <InputGroupPrimitive\n      role='group'\n      onPointerDown={focusControl}\n      className={cn(\n        inputBoxClassName,\n        'cursor-text has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-end]]:items-stretch has-[textarea]:items-stretch',\n        'has-[textarea]:rounded-(--control-radius-capped)',\n        className,\n      )}\n      {...props}\n    >\n      {children}\n      <InputInvalidIcon className='group-has-[>[data-align=block-end]]/input:absolute group-has-[>[data-align=block-end]]/input:end-0 group-has-[>[data-align=block-end]]/input:top-2.5' />\n    </InputGroupPrimitive>\n  )\n}\n\nconst inputGroupAddonVariants = cva(\n  'text-muted-foreground flex shrink-0 items-center gap-1.5 text-sm select-none',\n  {\n    variants: {\n      align: {\n        'inline-start': 'order-first ps-(--control-padding)',\n        'inline-end':\n          'order-last pe-1.5 has-[>[data-slot=input-group-text]:last-child]:pe-(--control-padding)',\n        'block-end': 'order-last justify-end px-(--control-padding) pb-2',\n      },\n    },\n    defaultVariants: {\n      align: 'inline-start',\n    },\n  },\n)\n\nfunction InputGroupAddon({\n  className,\n  align = 'inline-start',\n  ...props\n}: Omit<\n  ComponentProps<'div'> & VariantProps<typeof inputGroupAddonVariants>,\n  'className'\n> & { className?: string }) {\n  return (\n    <div\n      data-slot='input-group-addon'\n      data-align={align}\n      className={cn(inputGroupAddonVariants({ align }), className)}\n      {...props}\n    />\n  )\n}\n\nfunction InputGroupText({ className, ...props }: ComponentProps<'span'>) {\n  return (\n    <span\n      data-slot='input-group-text'\n      className={cn('text-muted-foreground flex items-center gap-1.5 text-sm', className)}\n      {...props}\n    />\n  )\n}\n\nfunction InputGroupButton({\n  variant = 'ghost',\n  size = 'xs',\n  ...props\n}: ComponentProps<typeof Button>) {\n  return <Button data-input-group-button='' variant={variant} size={size} {...props} />\n}\n\n/**\n * How a part of the group shows and hides, such as a clear button that is\n * there once the field holds something: it fades and scales on `enter` and\n * `exit` where it is and turns back from where it is, and while hidden it is\n * gone from the tab order and from screen readers. It shows with\n * `data-shown`.\n */\nconst inputGroupPresence =\n  'transition-[opacity,scale,visibility,display] transition-discrete duration-(--motion-exit-duration) ease-(--motion-exit-easing) data-shown:duration-(--motion-enter-duration) data-shown:ease-(--motion-enter-easing) not-data-shown:invisible not-data-shown:opacity-0 motion-safe:not-data-shown:scale-95'\n\n/** After an addon at the start, the value moves up to it: for a control of your own in the group. */\nconst inputGroupBesideStart =\n  'group-has-[>[data-align=inline-start]]/input:ps-1.5 group-has-[>[data-align=inline-start]>[data-slot=input-group-text]:last-child]/input:ps-0'\n\nfunction InputGroupInput({ className, ...props }: ComponentProps<typeof InputControl>) {\n  return <InputControl className={cn(inputGroupBesideStart, className)} {...props} />\n}\n\nfunction InputGroupTextarea({\n  className,\n  ...props\n}: ComponentProps<typeof TextareaControl>) {\n  return (\n    <TextareaControl\n      className={cn('group-has-[>[data-align=block-end]]/input:pb-1', className)}\n      {...props}\n    />\n  )\n}\n\nexport {\n  InputGroup,\n  InputGroupAddon,\n  inputGroupBesideStart,\n  InputGroupButton,\n  InputGroupInput,\n  inputGroupPresence,\n  InputGroupText,\n  InputGroupTextarea,\n}\n",
      "type": "registry:component",
      "target": "@components/kino/input-group.tsx"
    }
  ],
  "type": "registry:component"
}