{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "collapsible",
  "title": "Collapsible",
  "description": "One section that opens and closes under its title, such as nutrition facts under a recipe.",
  "registryDependencies": [
    "@ouro/lib-class-name-check",
    "@ouro/lib-cn",
    "@ouro/lib-css-panel",
    "@ouro/lib-env",
    "@ouro/lib-use-dev-messages"
  ],
  "files": [
    {
      "path": "registry/ouro/components/ouro/collapsible/collapsible-styles.ts",
      "content": "export {\n  foldClass,\n  iconClass,\n  itemClass,\n  listClass,\n  ownLook,\n  rootClass,\n  showMoreHint,\n  showMoreRootClass,\n  textClass,\n  triggerClass,\n};\n\n// Class strings and dev-message helpers for Collapsible and ShowMore, apart from the\n// components so their files export only components (React Fast Refresh). Class strings are\n// literal so the app's Tailwind finds them when it compiles.\n\n/**\n * The `Fix:` for an appearance class: the component draws its own look.\n *\n * @internal\n */\nfunction ownLook(component: string): (token: string) => string {\n  return (token) => `remove \"${token}\"; ${component} sets its own look`;\n}\n\n/**\n * The `Fix:` for an appearance class on ShowMore: text styles belong on a parent, so the\n * items inherit them; anything else is ShowMore's own look.\n *\n * @internal\n */\nfunction showMoreHint(token: string): string {\n  if (/^(text|font)-/.test(token)) return `<div className=\"${token}\"><ShowMore /></div>`;\n  return ownLook(\"ShowMore\")(token);\n}\n\n/** @internal */\nconst rootClass = \"box-border grid min-w-0 justify-items-start text-foreground\";\n\n/**\n * The title button: 44px tall on a coarse pointer, 36px from `sm` with a fine one.\n *\n * @internal\n * @claim \"The title button: 44px tall on\" registry/ouro/components/ouro/collapsible/collapsible.test.tsx verify:testExists(registry/ouro/components/ouro/collapsible/collapsible.test.tsx::Collapsible > gives the title a 44px row on a coarse pointer, or 36px otherwise)\n */\nconst triggerClass =\n  \"group/trigger press relative m-0 box-border inline-flex cursor-pointer items-center gap-2 \" +\n  \"min-h-11 sm:pointer-fine:min-h-9 px-0 py-2 rounded-ouro-md border-0 bg-transparent text-start forced-colors:border forced-colors:border-solid \" +\n  \"font-[inherit] text-base font-medium text-foreground sm:pointer-fine:text-sm \" +\n  \"select-none touch-manipulation [-webkit-tap-highlight-color:transparent] \" +\n  \"underline-offset-4 not-data-disabled:pointer-fine:hover:underline not-data-disabled:active:opacity-70 \" +\n  \"outline-ring outline-offset-2 focus-visible:outline-2 focus-visible:outline-solid \" +\n  \"data-disabled:cursor-not-allowed data-disabled:opacity-50\";\n\n/**\n * The chevron after the title: it turns over while open.\n *\n * @internal\n */\nconst iconClass =\n  \"size-4 shrink-0 text-muted-foreground transition-[rotate] duration-(--ouro-duration-base) ease-(--ouro-ease-out) \" +\n  \"group-data-panel-open/trigger:rotate-180 motion-reduce:transition-none\";\n\n/** @internal */\nconst showMoreRootClass = \"box-border grid min-w-0 justify-items-start gap-2\";\n\n/**\n * The list: no bullets or indent, so the items are the app's own rows.\n *\n * @internal\n * @claim \"The list: no bullets or indent\" registry/ouro/components/ouro/collapsible/collapsible-styles.ts verify:fileLine(registry/ouro/components/ouro/collapsible/collapsible-styles.ts, /const\\slistClass\\s=\\s\"m-0\\sbox-border\\sgrid\\sw-full\\slist-none\\sgap-0\\sp-0\"/)\n */\nconst listClass = \"m-0 box-border grid w-full list-none gap-0 p-0\";\n\n/**\n * A row. It takes focus from the script only, when it is the first one revealed and holds\n * nothing focusable, and shows the focus outline then.\n *\n * @internal\n */\nconst itemClass = \"m-0 rounded-ouro-sm p-0 outline-ring outline-offset-2 focus-visible:outline-2 focus-visible:outline-solid\";\n\n/**\n * Content folded to `--ouro-show-more-height`: once measured as too tall, its last 3rem fades\n * out (a mask, so it works on any background).\n *\n * @internal\n * @claim \"its last 3rem fades out\" registry/ouro/components/ouro/collapsible/collapsible-styles.ts verify:fileLine(registry/ouro/components/ouro/collapsible/collapsible-styles.ts, /mask-image:linear-gradient\\(to_bottom,#000_calc\\(100%-3rem\\),transparent\\)/)\n */\nconst foldClass = \"relative w-full min-w-0 data-folded:[mask-image:linear-gradient(to_bottom,#000_calc(100%-3rem),transparent)]\"; // fade-ok: fades folded text, not a picture\n\n/**\n * Text clamped to `--ouro-show-more-lines` lines while collapsed.\n *\n * @internal\n */\nconst textClass = \"m-0 w-full\";\n",
      "type": "registry:ui",
      "target": "@components/ouro/collapsible/collapsible-styles.ts"
    },
    {
      "path": "registry/ouro/components/ouro/collapsible/collapsible.tsx",
      "content": "\"use client\";\n\nimport { useId, useState, 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 { CssPanel } from \"@/registry/ouro/lib/ouro/css-panel\";\nimport { useDevWarnings } from \"@/registry/ouro/lib/ouro/use-dev-messages\";\nimport { iconClass, ownLook, rootClass, triggerClass } from \"@/registry/ouro/components/ouro/collapsible/collapsible-styles\";\n\n/** Props for {@link Collapsible}. */\nexport interface CollapsibleProps {\n  /** The title, in view whether open or closed. It is the button that opens and closes the content. */\n  title: ReactNode;\n  /** What shows while it is open. */\n  children: ReactNode;\n  /** Whether it is open, when you control it. Pair it with `onOpenChange`. */\n  open?: boolean | undefined;\n  /** Opens it first, when the component keeps its own state. */\n  defaultOpen?: boolean | undefined;\n  /** Called with the new state when the person opens or closes it. */\n  onOpenChange?: ((open: boolean) => void) | undefined;\n  /** Keeps it from opening or closing. */\n  disabled?: boolean | undefined;\n  /** Layout only: margins, width, grid placement (`mt-4`). Appearance classes warn in development. */\n  className?: string | undefined;\n  ref?: Ref<HTMLDivElement> | undefined;\n\n  /** Not a prop. The button is drawn for you from `title`: `<Collapsible title=\"Nutrition facts\">`. */\n  trigger?: { 'Use <Collapsible title=\"Nutrition facts\">': never };\n  /** Not a prop. Ouro UI uses `title`: `<Collapsible title=\"Nutrition facts\">`. */\n  label?: { 'Use <Collapsible title=\"Nutrition facts\">': never };\n  /** Not a prop. Ouro UI uses `onOpenChange`: `<Collapsible onOpenChange={(open) => …}>`. */\n  onChange?: { 'Use <Collapsible onOpenChange={(open) => ...}>': never };\n  /** Not a prop. Ouro UI uses `open`: `<Collapsible open>`. */\n  isOpen?: { 'Use <Collapsible open>': never };\n}\n\n/**\n * One section that opens and closes under its title, such as nutrition facts under a\n * recipe. The content grows to its measured height with CSS, the closed content is in the\n * server HTML and found by the page search of browsers that support `hidden=\"until-found\"`,\n * and the title is a 44px row on touch screens.\n *\n * Use `Accordion` instead for a stack of such sections. Use `ShowMore` instead to cut a long\n * list or text short behind a \"Show more\" button. Use `Dialog` or `Sheet` instead when the\n * content is a task of its own.\n *\n * @group Lists\n * @see https://ui.ouroboros.bot/docs/collapsible\n *\n * @example\n * <Collapsible title=\"Nutrition facts\">\n *   <NutritionTable />\n * </Collapsible>\n * @claim \"The content grows to its measured\" registry/ouro/components/ouro/collapsible/collapsible.test.tsx verify:testExists(registry/ouro/components/ouro/collapsible/collapsible.test.tsx::Collapsible > links the title and panel in server HTML and hydrates without a mismatch)\n * @claim \"The content grows to its measured\" registry/ouro/components/ouro/collapsible/collapsible.test.tsx verify:testExists(registry/ouro/components/ouro/collapsible/collapsible.test.tsx::Collapsible > lets the browser's page search find and open it, and hides it plainly where until-found is unsupported)\n * @claim \"The content grows to its measured\" registry/ouro/components/ouro/collapsible/collapsible.test.tsx verify:testExists(registry/ouro/components/ouro/collapsible/collapsible.test.tsx::Collapsible > gives the title a 44px row on a coarse pointer, or 36px otherwise)\n */\nexport function Collapsible(props: CollapsibleProps): JSX.Element {\n  const {\n    title,\n    children,\n    open,\n    defaultOpen,\n    onOpenChange,\n    disabled,\n    className,\n    ref,\n    // Guard props (hint types), dropped here so they never reach the DOM.\n    trigger,\n    label,\n    onChange,\n    isOpen,\n  } = props;\n  useAppearanceClassNameCheck(\n    \"Collapsible\",\n    className,\n    process.env.NODE_ENV !== \"production\" ? ownLook(\"Collapsible\") : /* istanbul ignore next @preserve -- production only */ \"\",\n  );\n  useDevWarnings(\n    \"Collapsible\",\n    process.env.NODE_ENV !== \"production\"\n      ? () => {\n          const named = typeof label === \"string\" ? (label as string) : \"Nutrition facts\";\n          return [\n            trigger !== undefined && [\"trigger is not a prop\", `<Collapsible title=\"${named}\">`],\n            label !== undefined && [\"label is not a prop\", `<Collapsible title=\"${named}\">`],\n            onChange !== undefined && [\"onChange is not a prop\", \"<Collapsible onOpenChange={(open) => …}>\"],\n            isOpen !== undefined && [\"isOpen is not a prop\", \"<Collapsible open>\"],\n          ];\n        }\n      : /* istanbul ignore next @preserve -- production only */ undefined,\n  );\n  const panelId = useId();\n  const [own, setOwn] = useState(defaultOpen === true);\n  const expanded = open ?? own;\n  const change = (next: boolean) => {\n    // Stryker disable next-line ConditionalExpression: a controlled component ignores its own state, so setting it too changes nothing visible.\n    if (open === undefined) setOwn(next);\n    onOpenChange?.(next);\n  };\n  return (\n    <div ref={ref} data-ouro=\"collapsible\" className={cn(rootClass, className)}>\n      <button\n        type=\"button\"\n        disabled={disabled}\n        aria-expanded={expanded}\n        aria-controls={expanded ? panelId : undefined}\n        // Stryker disable next-line StringLiteral: any value of a presence attribute styles the same.\n        data-disabled={disabled ? \"\" : undefined}\n        // Stryker disable next-line StringLiteral: any value of a presence attribute styles the same.\n        data-panel-open={expanded ? \"\" : undefined}\n        data-ouro-control=\"collapsible\"\n        data-ouro-part=\"trigger\"\n        className={triggerClass}\n        onClick={() => change(!expanded)}\n      >\n        {title}\n        <svg\n          aria-hidden=\"true\"\n          viewBox=\"0 0 16 16\"\n          fill=\"none\"\n          stroke=\"currentColor\"\n          strokeWidth=\"1.5\"\n          strokeLinecap=\"round\"\n          strokeLinejoin=\"round\"\n          className={iconClass}\n        >\n          <path d=\"m4 6 4 4 4-4\" />\n        </svg>\n      </button>\n      <CssPanel id={panelId} open={expanded} onFound={() => change(true)} contentClassName=\"pt-1 pb-2\" data-ouro-collapsible-panel=\"\">\n        {children}\n      </CssPanel>\n    </div>\n  );\n}\n",
      "type": "registry:ui",
      "target": "@components/ouro/collapsible/collapsible.tsx"
    }
  ],
  "docs": "One section that opens and closes under its title, such as nutrition facts under a recipe. Import: import { Collapsible } from \"@/components/ouro/collapsible/collapsible\", 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/collapsible.md Ouro UI v1.3.257.",
  "type": "registry:ui"
}