{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "checkbox-cards",
  "title": "Checkbox cards",
  "description": "Any number of options, each a card with a title, a description and room for a price or an icon. Ticked, the card fades to grey and its empty box gives way to a check that wipes in; cleared, both fade back.",
  "dependencies": [
    "@ui-sdk/react",
    "@ui-sdk/core"
  ],
  "registryDependencies": [
    "https://kinoui.com/r/checkbox.json",
    "https://kinoui.com/r/choice.json"
  ],
  "files": [
    {
      "path": "registry/components/kino/checkbox-cards.tsx",
      "content": "'use client'\n\nimport { CheckboxMark } from '@/registry/components/kino/checkbox'\nimport {\n  ChoiceCardContext,\n  choiceCardBoxClassName,\n  choiceCardCheckedClassName,\n  choiceCardClassName,\n  choiceCardDescriptionClassName,\n  choiceCardMarkClassName,\n  choiceCardTitleClassName,\n  choiceCheckboxCornerClassName,\n  choicePressHandlers,\n} from '@/registry/lib/choice'\nimport {\n  Checkbox as CheckboxPrimitive,\n  CheckboxGroup as CheckboxGroupPrimitive,\n} from '@ui-sdk/react/checkbox'\nimport { type ComponentProps, type ReactNode, use, useId } from 'react'\n\nimport { cn } from '@/lib/utils'\n\n/*\n * Several options, each a card: add-ons, notification channels. The card is\n * a label around its checkbox, so a press anywhere on it ticks the box.\n * Ticked, the card fades to grey and its box gives way to a check that wipes\n * in; cleared, both fade back.\n */\n\nfunction CheckboxCards<T extends string = string>({\n  className,\n  ...props\n}: Omit<ComponentProps<typeof CheckboxGroupPrimitive<T>>, 'className'> & {\n  className?: string\n}) {\n  return (\n    <CheckboxGroupPrimitive<T>\n      className={cn(\n        // Columns at least 14rem wide, as many as fit, so the cards wrap from a phone to a wide page.\n        'relative isolate grid grid-cols-[repeat(auto-fit,minmax(min(100%,14rem),1fr))] gap-3',\n        className,\n      )}\n      {...props}\n    />\n  )\n}\n\ntype CheckboxProps = ComponentProps<typeof CheckboxPrimitive>\n\n/** One option's card. Its props go to its checkbox, the `CheckboxCardIndicator` inside it, and `className` to the card. */\nfunction CheckboxCard({\n  className,\n  children,\n  ...props\n}: Omit<CheckboxProps, 'className' | 'children'> & {\n  className?: string\n  children?: ReactNode\n}) {\n  const id = useId()\n  return (\n    <label\n      data-slot='checkbox-card'\n      data-choice-card=''\n      className={cn(choiceCardClassName, className)}\n    >\n      <ChoiceCardContext\n        value={{ title: `${id}-title`, description: `${id}-description`, control: props }}\n      >\n        {children}\n      </ChoiceCardContext>\n    </label>\n  )\n}\n\n/** The card's checkbox, named by the card's title and described by its description: an empty box, and once ticked a check that wipes in. */\nfunction CheckboxCardIndicator({ className }: { className?: string }) {\n  const { title, description, control } = use(ChoiceCardContext)\n  const { onKeyDown, onKeyUp, onBlur, ...props } = control as CheckboxProps\n  return (\n    <CheckboxPrimitive\n      aria-labelledby={title}\n      aria-describedby={description}\n      className={cn(\n        choiceCardBoxClassName,\n        choiceCardCheckedClassName,\n        choiceCheckboxCornerClassName,\n        'group/checkbox relative inline-flex',\n        className,\n      )}\n      {...choicePressHandlers({ onKeyDown, onKeyUp, onBlur })}\n      {...props}\n    >\n      <CheckboxMark className={choiceCardMarkClassName} />\n    </CheckboxPrimitive>\n  )\n}\n\nfunction CheckboxCardTitle({ className, ...props }: ComponentProps<'div'>) {\n  const { title } = use(ChoiceCardContext)\n  return (\n    <div\n      data-slot='checkbox-card-title'\n      id={title}\n      className={cn(choiceCardTitleClassName, className)}\n      {...props}\n    />\n  )\n}\n\nfunction CheckboxCardDescription({ className, ...props }: ComponentProps<'div'>) {\n  const { description } = use(ChoiceCardContext)\n  return (\n    <div\n      data-slot='checkbox-card-description'\n      id={description}\n      className={cn(choiceCardDescriptionClassName, className)}\n      {...props}\n    />\n  )\n}\n\nexport {\n  CheckboxCard,\n  CheckboxCardDescription,\n  CheckboxCardIndicator,\n  CheckboxCards,\n  CheckboxCardTitle,\n}\n",
      "type": "registry:component",
      "target": "@components/kino/checkbox-cards.tsx"
    }
  ],
  "type": "registry:component"
}