{"version":3,"file":"index.cjs","sources":["../../../../src/components/card/index.tsx"],"sourcesContent":["import React, { type ReactElement } from \"react\";\nimport { matchChildByType, mergedCva } from \"../../utils/components\";\nimport { CardActions } from \"./actions\";\nimport { CardContent } from \"./content\";\nimport { CardTitle } from \"./title\";\n\nexport * from \"./title\";\nexport * from \"./content\";\nexport * from \"./actions\";\n\nconst rootStyles = mergedCva([\n    \"cui-bg-white\",\n    \"dark:cui-bg-black\",\n    \"cui-w-full\",\n    \"cui-rounded-xxl\",\n    \"cui-border\",\n    \"cui-border-black\",\n    \"dark:cui-border-white\",\n]);\n\nexport interface CardProps {\n    className?: {\n        root?: string;\n    };\n    children: ReactElement | ReactElement[];\n}\n\nexport const Card = ({\n    className,\n    children,\n    ...rest\n}: CardProps): ReactElement => {\n    const childrenArray = React.Children.toArray(children);\n\n    const titleChildren = childrenArray.find((child) =>\n        matchChildByType(child, CardTitle),\n    );\n    const contentChildren = childrenArray.find((child) =>\n        matchChildByType(child, CardContent),\n    );\n    const actionsChildren = childrenArray.find((child) =>\n        matchChildByType(child, CardActions),\n    );\n\n    return (\n        <div className={rootStyles({ className: className?.root })} {...rest}>\n            {titleChildren}\n            {contentChildren}\n            {actionsChildren}\n        </div>\n    );\n};\n"],"names":["mergedCva","matchChildByType","CardTitle","CardContent","CardActions"],"mappings":";;;;;;;;AAUA,MAAM,aAAaA,oBAAU,CAAA;AAAA,EACzB,cAAA;AAAA,EACA,mBAAA;AAAA,EACA,YAAA;AAAA,EACA,iBAAA;AAAA,EACA,YAAA;AAAA,EACA,kBAAA;AAAA,EACA,uBAAA;AACJ,CAAC,CAAA,CAAA;AASM,MAAM,OAAO,CAAC;AAAA,EACjB,SAAA;AAAA,EACA,QAAA;AAAA,EACA,GAAG,IAAA;AACP,CAA+B,KAAA;AAC3B,EAAA,MAAM,aAAgB,GAAA,KAAA,CAAM,QAAS,CAAA,OAAA,CAAQ,QAAQ,CAAA,CAAA;AAErD,EAAA,MAAM,gBAAgB,aAAc,CAAA,IAAA;AAAA,IAAK,CAAC,KAAA,KACtCC,2BAAiB,CAAA,KAAA,EAAOC,eAAS,CAAA;AAAA,GACrC,CAAA;AACA,EAAA,MAAM,kBAAkB,aAAc,CAAA,IAAA;AAAA,IAAK,CAAC,KAAA,KACxCD,2BAAiB,CAAA,KAAA,EAAOE,mBAAW,CAAA;AAAA,GACvC,CAAA;AACA,EAAA,MAAM,kBAAkB,aAAc,CAAA,IAAA;AAAA,IAAK,CAAC,KAAA,KACxCF,2BAAiB,CAAA,KAAA,EAAOG,mBAAW,CAAA;AAAA,GACvC,CAAA;AAEA,EAAA,uBACK,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAI,SAAW,EAAA,UAAA,CAAW,EAAE,SAAW,EAAA,SAAA,EAAW,IAAK,EAAC,CAAI,EAAA,GAAG,IAC3D,EAAA,EAAA,aAAA,EACA,iBACA,eACL,CAAA,CAAA;AAER;;;;;;;"}