{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "item-group",
  "title": "ItemGroup",
  "description": "A list of `Item` rows, with an optional label that names it, lines between the rows, and what to show when it is empty.",
  "registryDependencies": [
    "@ouro/lib-class-name-check",
    "@ouro/lib-cn",
    "@ouro/lib-env",
    "@ouro/lib-use-dev-messages"
  ],
  "files": [
    {
      "path": "registry/ouro/components/ouro/item/item-group.tsx",
      "content": "\"use client\";\n\nimport { Children, isValidElement, type HTMLAttributes, type JSX, type ReactNode, type Ref, useId } from \"react\";\nimport { useAppearanceClassNameCheck } from \"@/registry/ouro/lib/ouro/class-name-check\";\nimport { cn } from \"@/registry/ouro/lib/ouro/cn\";\nimport { useDevWarnings } from \"@/registry/ouro/lib/ouro/use-dev-messages\";\n\n/** The props ItemGroup adds to the div attributes it passes through. */\nexport interface ItemGroupOwnProps {\n  /**\n   * A short label above the list that also names it for screen readers: \"Bearer\n   * credentials\". Without one, name the list with `aria-label`.\n   */\n  label?: string | undefined;\n  /**\n   * The rows: `Item`s. Each one becomes a list item.\n   *\n   * @claim \"Each one becomes a list item\" registry/ouro/components/ouro/item/item-group.test.tsx verify:testExists(registry/ouro/components/ouro/item/item-group.test.tsx::ItemGroup > is a list labelled by its label, with each Item a list item)\n   */\n  children?: ReactNode;\n  /**\n   * What to show in place of the list when there are no rows: a sentence, or an `Empty`.\n   *\n   * @claim \"What to show in place of\" registry/ouro/components/ouro/item/item-group.test.tsx verify:testExists(registry/ouro/components/ouro/item/item-group.test.tsx::ItemGroup > shows empty, outside any list, when there are no rows)\n   * @claim \"What to show in place of\" registry/ouro/components/ouro/item/item-group.test.tsx verify:testExists(registry/ouro/components/ouro/item/item-group.test.tsx::ItemGroup > renders nothing for the list with no rows and no empty)\n   */\n  empty?: ReactNode;\n  /**\n   * `divided` draws a line between rows; `outline` frames them in a bordered surface and\n   * pads them, as in a settings screen; `plain` has neither.\n   * @default \"divided\"\n   */\n  variant?: \"divided\" | \"outline\" | \"plain\" | (string & { 'Use \"divided\", \"outline\" or \"plain\"': never }) | undefined;\n  /** Renders an ordered list (`<ol>`), for rows whose order means something, such as steps. */\n  ordered?: boolean | undefined;\n  /** Layout only: margins, width, grid placement (`mt-4`). Appearance classes warn in development; use `variant`. */\n  className?: string | undefined;\n  ref?: Ref<HTMLDivElement> | undefined;\n\n  /** Not a prop. Ouro UI uses `label`: `<ItemGroup label=\"Bearer credentials\">`. */\n  title?: { 'Use <ItemGroup label=\"Bearer credentials\">': never };\n  /** Not a prop. ItemGroup takes Items as children: `{rows.map((row) => <Item key={row.id} title={row.name} />)}`. */\n  items?: { \"Use children: {rows.map((row) => <Item key={row.id} title={row.name} />)}\": never };\n  /** Not a prop. Lines between rows are the default, `variant=\"divided\"`. */\n  divided?: { 'Use <ItemGroup variant=\"divided\">': never };\n}\n\n/** Props for {@link ItemGroup}: its own props and the div attributes it passes through. */\nexport type ItemGroupProps = Omit<HTMLAttributes<HTMLDivElement>, keyof ItemGroupOwnProps> & ItemGroupOwnProps;\n\n// The group sets its Items' frame: no outline of their own, and padding in an outlined group.\n// A row a person chooses keeps its padding and corners in a divided or plain group, so its selected colour has room.\nconst choosable = \"[&_[data-ouro=item][data-choosable]]:rounded-ouro-lg [&_[data-ouro=item][data-choosable]]:px-3\";\nconst variants = {\n  divided:\n    \"[&>li:not(:last-child)]:border-b [&>li]:border-border [&_[data-ouro=item]]:rounded-none [&_[data-ouro=item]]:border-0 [&_[data-ouro=item]]:px-0 \" +\n    choosable,\n  outline:\n    \"rounded-ouro-xl border border-border bg-card text-card-foreground overflow-hidden [&>li:not(:last-child)]:border-b [&>li]:border-border \" +\n    \"[&_[data-ouro=item]]:rounded-none [&_[data-ouro=item]]:border-0 [&_[data-ouro=item]]:px-4\",\n  plain: `[&_[data-ouro=item]]:rounded-none [&_[data-ouro=item]]:border-0 [&_[data-ouro=item]]:px-0 ${choosable}`,\n} as const;\n\n/**\n * A list of `Item` rows, with an optional label that names it, lines between the rows, and\n * what to show when it is empty. It wraps each Item in an `<li>`, so screen readers count\n * the rows.\n *\n * Use `Stack` instead to space out content that is not a list of rows, and a grid of\n * `Card`s for larger tiles.\n *\n * @group Lists\n * @see https://ui.ouroboros.bot/docs/item-group\n *\n * @example\n * <ItemGroup label=\"Bearer credentials\" empty=\"No active bearer credentials.\">\n *   {credentials.map((credential) => (\n *     <Item key={credential.id} title={credential.name} description={credential.scopes} actions={<Button>Revoke</Button>} />\n *   ))}\n * </ItemGroup>\n * @claim \"It wraps each Item in an\" registry/ouro/components/ouro/item/item-group.test.tsx verify:testExists(registry/ouro/components/ouro/item/item-group.test.tsx::ItemGroup > is a list labelled by its label, with each Item a list item)\n */\nexport function ItemGroup(props: ItemGroupProps): JSX.Element {\n  const { label, children, empty, variant: variantProp = \"divided\", ordered, className, title, items, divided, ...rest } = props;\n  const labelId = useId();\n  const variant = Object.hasOwn(variants, variantProp) ? (variantProp as keyof typeof variants) : \"divided\";\n  const rows = Children.toArray(children);\n  useAppearanceClassNameCheck(\n    \"ItemGroup\",\n    className,\n    process.env.NODE_ENV !== \"production\" ? '<ItemGroup variant=\"outline\">' : /* istanbul ignore next @preserve -- production only */ \"\",\n  );\n  useDevWarnings(\n    \"ItemGroup\",\n    process.env.NODE_ENV !== \"production\"\n      ? () => [\n          !label &&\n            !rest[\"aria-label\"] &&\n            !rest[\"aria-labelledby\"] && [\n              \"the list has no name\",\n              '<ItemGroup label=\"Bearer credentials\">, or aria-label=\"…\" to name it without showing a label',\n            ],\n          variant !== variantProp && [\n            `variant=\"${String(variantProp)}\" is not a variant; use \"divided\", \"outline\", \"plain\"`,\n            '<ItemGroup variant=\"divided\">',\n          ],\n          title !== undefined && [\"title is not a prop\", `<ItemGroup label=\"${String(title)}\">`],\n          items !== undefined && [\n            \"items is not a prop; ItemGroup takes Items as children\",\n            \"<ItemGroup>{rows.map((row) => <Item key={row.id} title={row.name} />)}</ItemGroup>\",\n          ],\n          divided !== undefined && [\"divided is not a prop\", '<ItemGroup variant=\"divided\">'],\n          rows.some((row) => isValidElement<{ as?: unknown }>(row) && row.props.as === \"li\") && [\n            '<Item as=\"li\"> puts a list item inside the list item ItemGroup already wraps each row in',\n            '<Item title=\"…\"> without as',\n          ],\n        ]\n      : /* istanbul ignore next @preserve -- production only */ undefined,\n  );\n  const { \"aria-label\": ariaLabel, \"aria-labelledby\": ariaLabelledBy, ...wrapper } = rest;\n  const List = ordered ? \"ol\" : \"ul\";\n  return (\n    <div {...wrapper} data-ouro=\"item-group\" className={cn(\"group/item-group flex min-w-0 flex-col gap-2\", className)}>\n      {label && (\n        // Lined up with the rows' text when they keep padding to show a selected row.\n        <div id={labelId} className={cn(\"text-sm font-medium text-muted-foreground\", variant !== \"outline\" && \"group-has-[[data-choosable]]/item-group:px-3\")}>\n          {label}\n        </div>\n      )}\n      {rows.length > 0 ? (\n        <List\n          aria-label={ariaLabel}\n          aria-labelledby={label ? labelId : ariaLabelledBy}\n          className={cn(\"m-0 flex list-none flex-col p-0\", variants[variant])}\n        >\n          {rows.map((row, index) => (\n            <li key={isValidElement(row) ? row.key : index} className=\"m-0 min-w-0 p-0\">\n              {row}\n            </li>\n          ))}\n        </List>\n      ) : (\n        empty && <div className=\"text-sm text-muted-foreground\">{empty}</div>\n      )}\n    </div>\n  );\n}\n",
      "type": "registry:ui",
      "target": "@components/ouro/item/item-group.tsx"
    }
  ],
  "docs": "A list of `Item` rows, with an optional label that names it, lines between the rows, and what to show when it is empty. Import: import { ItemGroup } from \"@/components/ouro/item/item-group\", with @/components replaced by your components alias (aliases.components in components.json, such as ~/components). Also installed: the helpers it imports in lib/ouro. Needs ouro-base in your stylesheet: add that item once per app, from the same place as this one, if you have not. Docs: https://ui.ouroboros.bot/docs/item-group.md Ouro UI v1.3.257.",
  "type": "registry:ui"
}