UNPKG

@mantine/core

Version:

React components library focused on usability, accessibility and developer experience

1 lines 1.98 kB
{"version":3,"file":"CardSection.cjs","names":["polymorphicFactory","useProps","useCardContext","Box","classes"],"sources":["../../../../src/components/Card/CardSection/CardSection.tsx"],"sourcesContent":["import {\n Box,\n BoxProps,\n CompoundStylesApiProps,\n polymorphicFactory,\n PolymorphicFactory,\n useProps,\n} from '../../../core';\nimport { useCardContext } from '../Card.context';\nimport classes from '../Card.module.css';\n\nexport type CardSectionStylesNames = 'section';\n\nexport interface CardSectionProps extends BoxProps, CompoundStylesApiProps<CardSectionFactory> {\n /** Adds border to the root element */\n withBorder?: boolean;\n\n /** If set, the section inherits padding from the parent `Card` */\n inheritPadding?: boolean;\n}\n\nexport type CardSectionFactory = PolymorphicFactory<{\n props: CardSectionProps;\n defaultRef: HTMLDivElement;\n defaultComponent: 'div';\n stylesNames: CardSectionStylesNames;\n compound: true;\n}>;\n\nexport const CardSection = polymorphicFactory<CardSectionFactory>((_props) => {\n const props = useProps('CardSection', null, _props);\n const { classNames, className, style, styles, vars, withBorder, inheritPadding, mod, ...others } =\n props;\n const ctx = useCardContext();\n\n return (\n <Box\n mod={[{ 'with-border': withBorder, 'inherit-padding': inheritPadding }, mod]}\n {...ctx.getStyles('section', { className, style, styles, classNames })}\n {...others}\n />\n );\n});\n\nCardSection.classes = classes;\nCardSection.displayName = '@mantine/core/CardSection';\n"],"mappings":";;;;;;;;;AA6BA,MAAa,cAAcA,4BAAAA,oBAAwC,WAAW;CAE5E,MAAM,EAAE,YAAY,WAAW,OAAO,QAAQ,MAAM,YAAY,gBAAgB,KAAK,GAAG,WAD1EC,kBAAAA,SAAS,eAAe,MAAM,OAAO;CAGnD,MAAM,MAAMC,qBAAAA,gBAAgB;AAE5B,QACE,iBAAA,GAAA,kBAAA,KAACC,YAAAA,KAAD;EACE,KAAK,CAAC;GAAE,eAAe;GAAY,mBAAmB;GAAgB,EAAE,IAAI;EAC5E,GAAI,IAAI,UAAU,WAAW;GAAE;GAAW;GAAO;GAAQ;GAAY,CAAC;EACtE,GAAI;EACJ,CAAA;EAEJ;AAEF,YAAY,UAAUC,oBAAAA;AACtB,YAAY,cAAc"}