{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "collapsible-styled",
  "title": "Collapsible essentials",
  "description": "Styled collapsible: the essentials set. 5 decorative collapsible variations (SimpleCollapsible, CardCollapsible, GhostCollapsible, PlusCollapsible, PreviewCollapsible) on the ai2 token system, powered by framer-motion, reduced-motion aware and sized sm to xl. Part of the free styled layer.",
  "dependencies": [
    "motion@^12.42.2",
    "lucide-react@^1.23.0"
  ],
  "registryDependencies": [
    "@ai2/tokens"
  ],
  "files": [
    {
      "path": "registry/ai2/styled/collapsible-styled.tsx",
      "content": "\"use client\"\n\nimport * as React from \"react\"\nimport { ChevronDown, Plus } from \"lucide-react\"\nimport { AnimatePresence, motion, useReducedMotion } from \"motion/react\"\n\nimport { cn } from \"@/lib/utils\"\n\n/* Collapsible family: 5 decorative single-section collapsibles. Every export is a complete collapsible: one trigger plus one expanding body, a button with aria-expanded, a framer height auto animation. Works controlled (open/onOpenChange) and uncontrolled (defaultOpen). Colour comes ONLY from tokens. Alpha via color-mix. Opening and closing are instant under reduced-motion. Size = padding plus the text scale. Renders without props too. */\n\nexport type StyledSize = \"sm\" | \"md\" | \"lg\" | \"xl\"\n\ninterface StyledCollapsibleProps {\n  className?: string\n  size?: StyledSize\n  title?: React.ReactNode\n  children?: React.ReactNode\n  open?: boolean\n  defaultOpen?: boolean\n  onOpenChange?: (o: boolean) => void\n}\n\nconst headerPad: Record<StyledSize, string> = {\n  sm: \"px-3 py-2.5 text-sm\",\n  md: \"px-4 py-3 text-sm\",\n  lg: \"px-5 py-4 text-base\",\n  xl: \"px-6 py-5 text-lg\",\n}\n\nconst bodyPad: Record<StyledSize, string> = {\n  sm: \"px-3 pb-2.5 text-sm\",\n  md: \"px-4 pb-3 text-sm\",\n  lg: \"px-5 pb-4 text-base\",\n  xl: \"px-6 pb-5 text-base\",\n}\n\nconst iconSize: Record<StyledSize, string> = {\n  sm: \"size-4\",\n  md: \"size-4\",\n  lg: \"size-5\",\n  xl: \"size-5\",\n}\n\nconst hoverTint =\n  \"hover:bg-[color-mix(in_oklab,var(--color-foreground)_5%,transparent)]\"\n\nconst headerBase =\n  \"flex w-full items-center justify-between gap-3 text-left font-medium outline-none transition-colors focus-visible:ring-[3px] focus-visible:ring-ring/50\"\n\nconst defaultTitle = \"What is included?\"\n\nconst defaultChildren =\n  \"Every plan ships the full component library, semantic tokens, and lifetime updates for the tier you own. Add any component with a single CLI command and keep the files fully editable.\"\n\n/* Controlled and uncontrolled open state in a single hook. */\nfunction useControllableOpen({\n  open,\n  defaultOpen,\n  onOpenChange,\n}: {\n  open?: boolean\n  defaultOpen?: boolean\n  onOpenChange?: (o: boolean) => void\n}) {\n  const isControlled = open !== undefined\n  const [internal, setInternal] = React.useState<boolean>(defaultOpen ?? false)\n  const current = isControlled ? (open as boolean) : internal\n  const toggle = React.useCallback(() => {\n    const next = !current\n    if (!isControlled) setInternal(next)\n    onOpenChange?.(next)\n  }, [current, isControlled, onOpenChange])\n  return { isOpen: current, toggle }\n}\n\nfunction Panel({\n  isOpen,\n  size,\n  children,\n}: {\n  isOpen: boolean\n  size: StyledSize\n  children: React.ReactNode\n}) {\n  const reduce = useReducedMotion()\n  return (\n    <AnimatePresence initial={false}>\n      {isOpen && (\n        <motion.div\n          key=\"panel\"\n          initial={reduce ? false : { height: 0, opacity: 0 }}\n          animate={{ height: \"auto\", opacity: 1 }}\n          exit={reduce ? { height: 0, opacity: 0 } : { height: 0, opacity: 0 }}\n          transition={\n            reduce ? { duration: 0 } : { duration: 0.25, ease: [0.4, 0, 0.2, 1] }\n          }\n          className=\"overflow-hidden\"\n        >\n          <div className={cn(bodyPad[size], \"text-muted-foreground\")}>\n            {children}\n          </div>\n        </motion.div>\n      )}\n    </AnimatePresence>\n  )\n}\n\nfunction Chevron({ isOpen, size }: { isOpen: boolean; size: StyledSize }) {\n  const reduce = useReducedMotion()\n  return (\n    <motion.span\n      aria-hidden\n      className=\"shrink-0 text-muted-foreground\"\n      animate={{ rotate: isOpen ? 180 : 0 }}\n      transition={reduce ? { duration: 0 } : { duration: 0.2 }}\n    >\n      <ChevronDown className={iconSize[size]} />\n    </motion.span>\n  )\n}\n\n/* Arti ikonu: acikken 45 derece doner ve x'e donusur. */\nfunction PlusMark({ isOpen, size }: { isOpen: boolean; size: StyledSize }) {\n  const reduce = useReducedMotion()\n  return (\n    <motion.span\n      aria-hidden\n      className=\"shrink-0 text-muted-foreground\"\n      animate={{ rotate: isOpen ? 45 : 0 }}\n      transition={reduce ? { duration: 0 } : { duration: 0.2 }}\n    >\n      <Plus className={iconSize[size]} />\n    </motion.span>\n  )\n}\n\n/* Simple: temiz cerceveli tek bolum, chevron doner. */\nexport function SimpleCollapsible({\n  className,\n  size = \"md\",\n  title = defaultTitle,\n  children = defaultChildren,\n  open,\n  defaultOpen,\n  onOpenChange,\n}: StyledCollapsibleProps) {\n  const { isOpen, toggle } = useControllableOpen({ open, defaultOpen, onOpenChange })\n  return (\n    <div\n      data-slot=\"styled-collapsible\"\n      className={cn(\n        \"overflow-hidden rounded-xl border border-border bg-background\",\n        className\n      )}\n    >\n      <button\n        type=\"button\"\n        aria-expanded={isOpen}\n        onClick={toggle}\n        className={cn(headerBase, headerPad[size], hoverTint)}\n      >\n        {title}\n        <Chevron isOpen={isOpen} size={size} />\n      </button>\n      <Panel isOpen={isOpen} size={size}>\n        {children}\n      </Panel>\n    </div>\n  )\n}\n\n/* Card: token kart; baslik satiri + genisleyen govde, acikken hafif ayirici. */\nexport function CardCollapsible({\n  className,\n  size = \"md\",\n  title = defaultTitle,\n  children = defaultChildren,\n  open,\n  defaultOpen,\n  onOpenChange,\n}: StyledCollapsibleProps) {\n  const { isOpen, toggle } = useControllableOpen({ open, defaultOpen, onOpenChange })\n  return (\n    <div\n      data-slot=\"styled-collapsible\"\n      className={cn(\n        \"overflow-hidden rounded-xl border border-border bg-surface-2 shadow-sm\",\n        className\n      )}\n    >\n      <button\n        type=\"button\"\n        aria-expanded={isOpen}\n        onClick={toggle}\n        className={cn(\n          headerBase,\n          headerPad[size],\n          \"hover:bg-[color-mix(in_oklab,var(--color-foreground)_4%,transparent)]\"\n        )}\n      >\n        {title}\n        <Chevron isOpen={isOpen} size={size} />\n      </button>\n      <div\n        className={cn(\n          \"border-t border-border transition-opacity\",\n          isOpen ? \"opacity-100\" : \"opacity-0\"\n        )}\n        aria-hidden={!isOpen}\n      />\n      <Panel isOpen={isOpen} size={size}>\n        {children}\n      </Panel>\n    </div>\n  )\n}\n\n/* Ghost: no frame, minimal; only a chevron + a hover token tint. */\nexport function GhostCollapsible({\n  className,\n  size = \"md\",\n  title = defaultTitle,\n  children = defaultChildren,\n  open,\n  defaultOpen,\n  onOpenChange,\n}: StyledCollapsibleProps) {\n  const { isOpen, toggle } = useControllableOpen({ open, defaultOpen, onOpenChange })\n  return (\n    <div data-slot=\"styled-collapsible\" className={cn(\"flex flex-col\", className)}>\n      <button\n        type=\"button\"\n        aria-expanded={isOpen}\n        onClick={toggle}\n        className={cn(headerBase, headerPad[size], \"rounded-lg\", hoverTint)}\n      >\n        {title}\n        <Chevron isOpen={isOpen} size={size} />\n      </button>\n      <Panel isOpen={isOpen} size={size}>\n        {children}\n      </Panel>\n    </div>\n  )\n}\n\n/* Plus: token arti ikonu, acikken doner ve x'e donusur. */\nexport function PlusCollapsible({\n  className,\n  size = \"md\",\n  title = defaultTitle,\n  children = defaultChildren,\n  open,\n  defaultOpen,\n  onOpenChange,\n}: StyledCollapsibleProps) {\n  const { isOpen, toggle } = useControllableOpen({ open, defaultOpen, onOpenChange })\n  return (\n    <div\n      data-slot=\"styled-collapsible\"\n      className={cn(\n        \"overflow-hidden rounded-xl border border-border bg-background\",\n        className\n      )}\n    >\n      <button\n        type=\"button\"\n        aria-expanded={isOpen}\n        onClick={toggle}\n        className={cn(headerBase, headerPad[size], hoverTint)}\n      >\n        {title}\n        <PlusMark isOpen={isOpen} size={size} />\n      </button>\n      <Panel isOpen={isOpen} size={size}>\n        {children}\n      </Panel>\n    </div>\n  )\n}\n\n/* Preview: it always shows a single-line truncated preview, \"Show more\" opens the\n   full content and \"Show less\" closes it. */\nexport function PreviewCollapsible({\n  className,\n  size = \"md\",\n  title = defaultTitle,\n  children = defaultChildren,\n  open,\n  defaultOpen,\n  onOpenChange,\n}: StyledCollapsibleProps) {\n  const { isOpen, toggle } = useControllableOpen({ open, defaultOpen, onOpenChange })\n  return (\n    <div\n      data-slot=\"styled-collapsible\"\n      className={cn(\n        \"overflow-hidden rounded-xl border border-border bg-background\",\n        className\n      )}\n    >\n      <div className={cn(headerPad[size], \"font-medium\")}>{title}</div>\n      {!isOpen && (\n        <div className={cn(bodyPad[size], \"pt-0 truncate text-muted-foreground\")}>\n          {children}\n        </div>\n      )}\n      <Panel isOpen={isOpen} size={size}>\n        {children}\n      </Panel>\n      <div className={cn(bodyPad[size], \"pt-0\")}>\n        <button\n          type=\"button\"\n          aria-expanded={isOpen}\n          onClick={toggle}\n          className={cn(\n            \"inline-flex items-center gap-1 rounded-md font-medium text-foreground outline-none transition-colors focus-visible:ring-[3px] focus-visible:ring-ring/50 hover:text-muted-foreground\"\n          )}\n        >\n          {isOpen ? \"Show less\" : \"Show more\"}\n          <Chevron isOpen={isOpen} size={size} />\n        </button>\n      </div>\n    </div>\n  )\n}\n",
      "type": "registry:component",
      "target": "components/ui/collapsible-styled.tsx"
    }
  ],
  "categories": [
    "styled",
    "collapsible"
  ],
  "type": "registry:component"
}