UNPKG

@chakra-ui/card

Version:

React component used to group related content

1 lines 2.15 kB
{"version":3,"sources":["../src/card.tsx"],"sourcesContent":["import { cx } from \"@chakra-ui/shared-utils\"\nimport {\n forwardRef,\n HTMLChakraProps,\n ThemingProps,\n chakra,\n omitThemingProps,\n useMultiStyleConfig,\n SystemProps,\n} from \"@chakra-ui/system\"\nimport { CardStylesProvider } from \"./card-context\"\n\nexport type CardOptions = {\n /**\n * The flex direction of the card\n */\n direction?: SystemProps[\"flexDirection\"]\n /**\n * The flex alignment of the card\n */\n align?: SystemProps[\"alignItems\"]\n /**\n * The flex distribution of the card\n */\n justify?: SystemProps[\"justifyContent\"]\n}\n\nexport interface CardProps\n extends HTMLChakraProps<\"div\">,\n CardOptions,\n ThemingProps<\"Card\"> {}\n\nexport const Card = forwardRef<CardProps, \"div\">(function Card(props, ref) {\n const {\n className,\n children,\n direction = \"column\",\n justify,\n align,\n ...rest\n } = omitThemingProps(props)\n\n const styles = useMultiStyleConfig(\"Card\", props)\n\n return (\n <chakra.div\n ref={ref}\n className={cx(\"chakra-card\", className)}\n __css={{\n display: \"flex\",\n flexDirection: direction,\n justifyContent: justify,\n alignItems: align,\n position: \"relative\",\n minWidth: 0,\n wordWrap: \"break-word\",\n ...styles.container,\n }}\n {...rest}\n >\n <CardStylesProvider value={styles}>{children}</CardStylesProvider>\n </chakra.div>\n )\n})\n"],"mappings":";;;;;;AAAA,SAAS,UAAU;AACnB;AAAA,EACE;AAAA,EAGA;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AAmDD;AA5BC,IAAM,OAAO,WAA6B,SAASA,MAAK,OAAO,KAAK;AACzE,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA,YAAY;AAAA,IACZ;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EACL,IAAI,iBAAiB,KAAK;AAE1B,QAAM,SAAS,oBAAoB,QAAQ,KAAK;AAEhD,SACE;AAAA,IAAC,OAAO;AAAA,IAAP;AAAA,MACC;AAAA,MACA,WAAW,GAAG,eAAe,SAAS;AAAA,MACtC,OAAO;AAAA,QACL,SAAS;AAAA,QACT,eAAe;AAAA,QACf,gBAAgB;AAAA,QAChB,YAAY;AAAA,QACZ,UAAU;AAAA,QACV,UAAU;AAAA,QACV,UAAU;AAAA,QACV,GAAG,OAAO;AAAA,MACZ;AAAA,MACC,GAAG;AAAA,MAEJ,8BAAC,sBAAmB,OAAO,QAAS,UAAS;AAAA;AAAA,EAC/C;AAEJ,CAAC;","names":["Card"]}