{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "collapsible-2",
  "type": "registry:component",
  "title": "Collapsible 2",
  "description": "Collapsible 2. A collapsible is a component that allows users to show or hide content.",
  "dependencies": [
    "lucide-react"
  ],
  "registryDependencies": [
    "collapsible"
  ],
  "files": [
    {
      "path": "components/watermelon/collapsible-2.tsx",
      "type": "registry:component",
      "content": "'use client';\n\nimport { useState } from 'react';\n\nimport {\n  ChevronRightIcon,\n  FileIcon,\n  FolderIcon,\n  FolderOpenIcon,\n} from 'lucide-react';\n\nimport {\n  Collapsible,\n  CollapsibleContent,\n  CollapsibleTrigger,\n} from '@/components/base-ui/collapsible';\n\ntype FileTreeItem =\n  | {\n      name: string;\n      type: 'file';\n      children?: never;\n    }\n  | {\n      children: readonly FileTreeItem[];\n      name: string;\n      type: 'folder';\n    };\n\nconst fileTree: readonly FileTreeItem[] = [\n  {\n    name: 'src',\n    type: 'folder',\n    children: [\n      {\n        name: 'sections',\n        type: 'folder',\n        children: [\n          { name: 'hero.tsx', type: 'file' },\n          { name: 'features.tsx', type: 'file' },\n          { name: 'pricing.tsx', type: 'file' },\n        ],\n      },\n      { name: 'layout.tsx', type: 'file' },\n    ],\n  },\n  {\n    name: 'content',\n    type: 'folder',\n    children: [{ name: 'copy.md', type: 'file' }],\n  },\n  {\n    name: 'styles',\n    type: 'folder',\n    children: [{ name: 'tokens.css', type: 'file' }],\n  },\n  {\n    name: 'site.config.ts',\n    type: 'file',\n  },\n] as const;\n\ntype FileTreeProps = {\n  item: FileTreeItem;\n  level: number;\n};\n\nconst FileTree = ({ item, level }: FileTreeProps) => {\n  if (item.type === 'file') {\n    return (\n      <div\n        className=\"text-muted-foreground flex items-center gap-2 rounded-md px-2 py-1 text-sm outline-none\"\n        style={{ paddingLeft: `${level === 0 ? 1.75 : 3.25}rem` }}\n      >\n        <FileIcon className=\"size-4 shrink-0\" />\n        <span>{item.name}</span>\n      </div>\n    );\n  }\n\n  return <FolderTree item={item} level={level} />;\n};\n\ntype FolderTreeProps = {\n  item: Extract<FileTreeItem, { type: 'folder' }>;\n  level: number;\n};\n\nconst FolderTree = ({ item, level }: FolderTreeProps) => {\n  const [open, setOpen] = useState<boolean>(false);\n\n  return (\n    <Collapsible\n      open={open}\n      onOpenChange={setOpen}\n      className=\"flex flex-col gap-1\"\n      style={{ paddingLeft: `${level === 0 ? 0 : 1.5}rem` }}\n    >\n      <CollapsibleTrigger className=\"hover:bg-muted/40 flex items-center gap-2 rounded-md px-2 py-1 text-sm outline-none\">\n        <ChevronRightIcon\n          className={`size-4 shrink-0 transition-transform ${open ? 'rotate-90' : ''}`}\n        />\n        {open ? (\n          <FolderOpenIcon className=\"text-muted-foreground size-4 shrink-0\" />\n        ) : (\n          <FolderIcon className=\"text-muted-foreground size-4 shrink-0\" />\n        )}\n        <span>{item.name}</span>\n      </CollapsibleTrigger>\n      <CollapsibleContent className=\"flex flex-col gap-1\">\n        {item.children.map((child) => (\n          <FileTree\n            key={`${item.name}-${child.name}`}\n            item={child}\n            level={level + 1}\n          />\n        ))}\n      </CollapsibleContent>\n    </Collapsible>\n  );\n};\n\nconst Collapsible2 = () => {\n  return (\n    <div className=\"flex w-full max-w-56 flex-col gap-2 p-2\">\n      {fileTree.map((item) => (\n        <FileTree key={item.name} item={item} level={0} />\n      ))}\n    </div>\n  );\n};\n\nexport default Collapsible2;\n"
    }
  ]
}
