{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "control-section",
  "title": "Control section",
  "description": "a fold in a panel · closed, it still says how many controls inside are changed",
  "dependencies": [
    "cn@^0.5.2",
    "lucide-react@^1.52.0"
  ],
  "registryDependencies": [
    "@halftone-web/control-row",
    "@halftone-web/kit-setup"
  ],
  "files": [
    {
      "path": "components/controls/section.tsx",
      "content": "'use client';\nimport { cn } from 'cn';\nimport { ChevronRightIcon } from 'lucide-react';\nimport * as React from 'react';\nimport { OffDefaultMark } from '@/components/controls/control-row';\n\n/**\n * A fold in a control panel: a heading that opens and closes its controls. Closed, it still says how many of them are\n * off their default, in words beside the mark.\n */\nexport function ControlSection({\n  title,\n  defaultOpen = true,\n  open: openProp,\n  onOpenChange,\n  edited = 0,\n  actions,\n  className,\n  children,\n}: {\n  title: string;\n  defaultOpen?: boolean;\n  open?: boolean;\n  onOpenChange?: (open: boolean) => void;\n  /** How many controls inside are off their default. */\n  edited?: number;\n  /** Buttons at the end of the heading (a section's own reset). */\n  actions?: React.ReactNode;\n  className?: string;\n  children: React.ReactNode;\n}) {\n  const [own, setOwn] = React.useState(defaultOpen);\n  const open = openProp ?? own;\n  const bodyId = React.useId();\n  const toggle = () => {\n    setOwn(!open);\n    onOpenChange?.(!open);\n  };\n  return (\n    <section className={cn('flex min-w-0 flex-col', className)}>\n      <div className=\"flex min-h-8 items-center gap-2\">\n        <button\n          type=\"button\"\n          aria-expanded={open}\n          aria-controls={bodyId}\n          onClick={toggle}\n          className=\"text-foreground hover:bg-accent focus-visible:ring-ring/50 -mx-1 flex min-w-0 flex-1 items-center gap-1.5 rounded-md px-1 py-1 text-left text-xs font-semibold outline-none focus-visible:ring-[3px]\">\n          <ChevronRightIcon aria-hidden className={cn('text-muted-foreground size-3.5 shrink-0 motion-safe:transition-transform motion-safe:duration-fast', open && 'rotate-90')} />\n          <span className=\"truncate\">{title}</span>\n          {edited ? (\n            <span className=\"text-muted-foreground ml-auto flex shrink-0 items-center gap-1.5 font-medium\">\n              <OffDefaultMark />\n              {edited} changed\n            </span>\n          ) : null}\n        </button>\n        {actions}\n      </div>\n      <div id={bodyId} hidden={!open} className=\"flex flex-col gap-3 pt-2 pb-1\">\n        {children}\n      </div>\n    </section>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/controls/section.tsx"
    }
  ],
  "meta": {
    "exports": [
      "ControlSection"
    ],
    "api": "<ControlSection title defaultOpen? edited? actions?>…</ControlSection>"
  },
  "categories": [
    "controls"
  ],
  "type": "registry:component"
}