{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "description-list",
  "title": "DescriptionList",
  "description": "One thing's details as pairs of a term and its value: a recipe's prep time and servings, an order's date and total, an account's email.",
  "registryDependencies": [
    "@ouro/lib-class-name-check",
    "@ouro/lib-cn",
    "@ouro/lib-env",
    "@ouro/lib-use-dev-messages"
  ],
  "files": [
    {
      "path": "registry/ouro/components/ouro/description-list/description-list.tsx",
      "content": "\"use client\";\n\nimport { Fragment, type HTMLAttributes, type JSX, type ReactNode, type Ref } from \"react\";\nimport { useAppearanceClassNameCheck } from \"@/registry/ouro/lib/ouro/class-name-check\";\nimport { cn } from \"@/registry/ouro/lib/ouro/cn\";\nimport { useDevWarnings, type DevWarning } from \"@/registry/ouro/lib/ouro/use-dev-messages\";\n\n/** One pair in a {@link DescriptionList}: what it is, and its value. */\nexport interface DescriptionListItem {\n  /** What the details describe: \"Prep time\", \"Email\". */\n  term: ReactNode;\n  /** The value: text, a link, a badge. */\n  details: ReactNode;\n\n  /** Not a prop. Ouro UI uses `term`: `{ term: \"Prep time\", details: \"20 minutes\" }`. */\n  label?: { 'Use term: \"Prep time\"': never };\n  /** Not a prop. Ouro UI uses `details`: `{ term: \"Prep time\", details: \"20 minutes\" }`. */\n  value?: { 'Use details: \"20 minutes\"': never };\n  /** Not a prop. Ouro UI uses `details`: `{ term: \"Prep time\", details: \"20 minutes\" }`. */\n  description?: { 'Use details: \"20 minutes\"': never };\n}\n\n/** The props DescriptionList adds to the `<dl>` attributes it passes through. */\nexport interface DescriptionListOwnProps {\n  /** The pairs, in order: `{ term, details }`. */\n  items: readonly DescriptionListItem[];\n  /**\n   * While the list itself is narrower than this, each term sits above its details, as on a\n   * phone or in a narrow sheet; from it up, the terms form a column beside them. `sm` is\n   * 28rem (448px), `md` 32rem (512px). The list's own width decides, not the window's, so a\n   * list in a side sheet stacks on a wide screen too.\n   * @default \"sm\"\n   * @claim \"While the list itself is narrower\" registry/ouro/components/ouro/description-list/description-list.test.tsx verify:testExists(registry/ouro/components/ouro/description-list/description-list.test.tsx::DescriptionList > puts each term beside its details in a list 28rem wide or more, in one shared column of terms)\n   * @claim \"While the list itself is narrower\" registry/ouro/components/ouro/description-list/description-list.test.tsx verify:testExists(registry/ouro/components/ouro/description-list/description-list.test.tsx::DescriptionList > stacks each term above its details in a list narrower than 28rem, however wide the window)\n   * @claim \"`sm` is 28rem (448px), `md`\" registry/ouro/components/ouro/description-list/description-list.test.tsx verify:testExists(registry/ouro/components/ouro/description-list/description-list.test.tsx::DescriptionList > stacks below 32rem with stackBelow=md)\n   */\n  stackBelow?: \"sm\" | \"md\" | (string & { 'Use \"sm\" (448px) or \"md\" (512px)': never }) | undefined;\n  /** Layout only: margins, width (`mt-6`, `max-w-2xl`). Appearance classes warn in development. */\n  className?: string | undefined;\n  ref?: Ref<HTMLDListElement> | undefined;\n\n  /** Not a prop. Ouro UI uses `items`: `<DescriptionList items={[{ term, details }]}>`. */\n  data?: { \"Use items={[{ term: ..., details: ... }]}\": never };\n  /** Not a prop. The list comes from `items`: `<DescriptionList items={[{ term, details }]}>`. */\n  children?: { \"Use items={[{ term: ..., details: ... }]}\": never };\n}\n\n/** Props for {@link DescriptionList}: its own props and the `<dl>` attributes it passes through. */\nexport type DescriptionListProps = Omit<HTMLAttributes<HTMLDListElement>, keyof DescriptionListOwnProps> & DescriptionListOwnProps;\n\n// The list is a size container, so its own width, not the window's, decides the layout. Its\n// columns read a variable, so an app's grid-cols-* class still wins; stacked, each term and its\n// details span both columns. Stacked, a line runs above each term; side by side, above each\n// term and its details.\nconst layouts = {\n  sm: {\n    root: \"@container grid-cols-(--ouro-dl-cols) [--ouro-dl-cols:min(40%,14rem)_minmax(0,1fr)]\",\n    term: \"col-span-full @md:col-span-1 pt-3 pb-1 @md:py-3 first:pt-0 @md:first:pt-0\",\n    details: \"col-span-full @md:col-span-1 pb-3 @md:border-t @md:border-border @md:py-3 @md:nth-2:border-t-0 @md:nth-2:pt-0\",\n  },\n  md: {\n    root: \"@container grid-cols-(--ouro-dl-cols) [--ouro-dl-cols:min(40%,14rem)_minmax(0,1fr)]\",\n    term: \"col-span-full @lg:col-span-1 pt-3 pb-1 @lg:py-3 first:pt-0 @lg:first:pt-0\",\n    details: \"col-span-full @lg:col-span-1 pb-3 @lg:border-t @lg:border-border @lg:py-3 @lg:nth-2:border-t-0 @lg:nth-2:pt-0\",\n  },\n} as const;\n\nfunction itemWarnings(items: readonly DescriptionListItem[]): DevWarning[] {\n  return items.flatMap((item): DevWarning[] => [\n    item.label !== undefined && [\"an item's label is not a prop\", `{ term: \"${String(item.label)}\", details: … }`],\n    item.value !== undefined && [\"an item's value is not a prop\", `{ term: …, details: \"${String(item.value)}\" }`],\n    item.description !== undefined && [\"an item's description is not a prop\", `{ term: …, details: \"${String(item.description)}\" }`],\n  ]);\n}\n\n/**\n * One thing's details as pairs of a term and its value: a recipe's prep time and servings,\n * an order's date and total, an account's email. In a narrow space, a phone or a side sheet,\n * each term sits above its details; once the list is 28rem wide the terms form a column beside\n * them, with a line between the pairs. It takes the width it is given.\n *\n * Use `Table` instead to compare many things across the same columns, and `ItemGroup` for\n * a list of things a person opens or acts on.\n *\n * @group Display\n * @see https://ui.ouroboros.bot/docs/description-list\n *\n * @example\n * <DescriptionList\n *   items={[\n *     { term: \"Prep time\", details: \"20 minutes\" },\n *     { term: \"Cook time\", details: \"4 hours\" },\n *     { term: \"Serves\", details: \"6\" },\n *   ]}\n * />\n * @claim \"In a narrow space, a phone\" registry/ouro/components/ouro/description-list/description-list.test.tsx verify:testExists(registry/ouro/components/ouro/description-list/description-list.test.tsx::DescriptionList > puts each term beside its details in a list 28rem wide or more, in one shared column of terms)\n * @claim \"In a narrow space, a phone\" registry/ouro/components/ouro/description-list/description-list.test.tsx verify:testExists(registry/ouro/components/ouro/description-list/description-list.test.tsx::DescriptionList > stacks each term above its details in a list narrower than 28rem, however wide the window)\n * @claim \"In a narrow space, a phone\" registry/ouro/components/ouro/description-list/description-list.test.tsx verify:testExists(registry/ouro/components/ouro/description-list/description-list.test.tsx::DescriptionList > stacks each term above its details on a phone)\n * @claim \"It takes the width it is\" registry/ouro/components/ouro/description-list/description-list.test.tsx verify:testExists(registry/ouro/components/ouro/description-list/description-list.test.tsx::DescriptionList > takes the width it is given in a row, as a size container must)\n */\nexport function DescriptionList(props: DescriptionListProps): JSX.Element {\n  const { items: itemsProp, stackBelow: stackBelowProp = \"sm\", className, data, children, ...rest } = props;\n  const items = itemsProp ?? [];\n  const stackBelow = stackBelowProp === \"md\" ? \"md\" : \"sm\";\n  useAppearanceClassNameCheck(\n    \"DescriptionList\",\n    className,\n    process.env.NODE_ENV !== \"production\"\n      ? 'pass styled content in details, such as <Text size=\"lg\">'\n      : /* istanbul ignore next @preserve -- production only */ \"\",\n  );\n  useDevWarnings(\n    \"DescriptionList\",\n    process.env.NODE_ENV !== \"production\"\n      ? () => [\n          data !== undefined && [\"data is not a prop\", \"<DescriptionList items={[{ term: …, details: … }]}>\"],\n          itemsProp === undefined &&\n            data === undefined && [\"items is required; it holds the pairs\", '<DescriptionList items={[{ term: \"Prep time\", details: \"20 minutes\" }]}>'],\n          children !== undefined && [\n            \"children are not rendered; the list comes from items\",\n            '<DescriptionList items={[{ term: \"Prep time\", details: \"20 minutes\" }]}>',\n          ],\n          stackBelow !== stackBelowProp && [\n            `stackBelow=\"${String(stackBelowProp)}\" is not a breakpoint; use \"sm\", \"md\"`,\n            '<DescriptionList stackBelow=\"sm\">',\n          ],\n          ...itemWarnings(items),\n        ]\n      : /* istanbul ignore next @preserve -- production only */ undefined,\n  );\n  const layout = layouts[stackBelow];\n  return (\n    <dl {...rest} data-ouro=\"description-list\" className={cn(\"[@layer_ouro-reset]:m-0 grid w-full min-w-0 text-base pointer-fine:text-sm\", layout.root, className)}>\n      {items.map((item, index) => {\n        // A guessed `label` or `value` still shows, beside its development message.\n        const loose = item as unknown as { label?: ReactNode; value?: ReactNode; description?: ReactNode };\n        return (\n          <Fragment key={index}>\n            <dt className={cn(\"m-0 border-t border-border font-normal text-muted-foreground wrap-break-word first:border-t-0\", layout.term)}>{item.term ?? loose.label}</dt>\n            <dd className={cn(\"m-0 text-foreground wrap-break-word\", layout.details)}>{item.details ?? loose.value ?? loose.description}</dd>\n          </Fragment>\n        );\n      })}\n    </dl>\n  );\n}\n",
      "type": "registry:ui",
      "target": "@components/ouro/description-list/description-list.tsx"
    }
  ],
  "docs": "One thing's details as pairs of a term and its value: a recipe's prep time and servings, an order's date and total, an account's email. Import: import { DescriptionList } from \"@/components/ouro/description-list/description-list\", 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/description-list.md Ouro UI v1.3.257.",
  "type": "registry:ui"
}