{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "lib-slot",
  "type": "registry:lib",
  "title": "lib/slot",
  "description": "자식 요소 하나에 props 와 className 을 합쳐서 넘깁니다 (asChild · 아이콘 슬롯).",
  "registryDependencies": [
    "@atom/lib-cn"
  ],
  "files": [
    {
      "path": "poc/design-system/implement/src/lib/slot.tsx",
      "content": "import { type HTMLAttributes, type ReactElement, type ReactNode, cloneElement, isValidElement } from \"react\";\nimport { cn } from \"./cn\";\n\n/**\n * 자식 요소 하나에 props 와 className 을 합쳐서 넘깁니다 (asChild · 아이콘 슬롯).\n * 자식이 요소가 아니면(문자열 등) span 으로 감쌉니다.\n */\nexport function Slot({ children, className, ...props }: HTMLAttributes<HTMLElement> & { children?: ReactNode }) {\n  if (!isValidElement(children)) {\n    return (\n      <span {...props} className={className}>\n        {children}\n      </span>\n    );\n  }\n  const child = children as ReactElement<HTMLAttributes<HTMLElement>>;\n  return cloneElement(child, {\n    ...props,\n    ...child.props,\n    className: cn(className, child.props.className),\n  });\n}\n",
      "type": "registry:lib",
      "target": "components/lib/slot.tsx"
    }
  ],
  "categories": [
    "internal"
  ],
  "meta": {
    "version": "0.1.0"
  }
}
