UNPKG

@mantine/core

Version:

React components library focused on usability, accessibility and developer experience

1 lines 4.54 kB
{"version":3,"file":"ActionIconGroupSection.cjs","names":["createVarsResolver","getSize","getFontSize","getRadius","factory","useProps","Box","useStyles","classes"],"sources":["../../../../src/components/ActionIcon/ActionIconGroupSection/ActionIconGroupSection.tsx"],"sourcesContent":["import {\n Box,\n BoxProps,\n createVarsResolver,\n ElementProps,\n factory,\n Factory,\n getFontSize,\n getRadius,\n getSize,\n MantineGradient,\n MantineRadius,\n MantineSize,\n StylesApiProps,\n useProps,\n useStyles,\n} from '../../../core';\nimport type { ActionIconVariant } from '../ActionIcon';\nimport classes from '../ActionIcon.module.css';\n\nexport type ActionIconGroupSectionStylesNames = 'groupSection';\nexport type ActionIconGroupSectionCssVariables = {\n groupSection:\n | '--section-radius'\n | '--section-bg'\n | '--section-color'\n | '--section-bd'\n | '--section-height'\n | '--section-padding-x'\n | '--section-fz';\n};\n\nexport interface ActionIconGroupSectionProps\n extends BoxProps, StylesApiProps<ActionIconGroupSectionFactory>, ElementProps<'div'> {\n /** Key of `theme.radius` or any valid CSS value to set `border-radius` @default theme.defaultRadius */\n radius?: MantineRadius;\n\n /** Gradient values used with `variant=\"gradient\"`. @default theme.defaultGradient */\n gradient?: MantineGradient;\n\n /** If set, adjusts text color based on background color for `filled` variant */\n autoContrast?: boolean;\n\n /** Controls section `height`, `font-size` and horizontal `padding` @default 'sm' */\n size?: MantineSize | (string & {}) | number;\n}\n\nexport type ActionIconGroupSectionFactory = Factory<{\n props: ActionIconGroupSectionProps;\n ref: HTMLDivElement;\n stylesNames: ActionIconGroupSectionStylesNames;\n vars: ActionIconGroupSectionCssVariables;\n variant: ActionIconVariant;\n}>;\n\nconst varsResolver = createVarsResolver<ActionIconGroupSectionFactory>(\n (theme, { radius, color, gradient, variant, autoContrast, size }) => {\n const colors = theme.variantColorResolver({\n color: color || theme.primaryColor,\n theme,\n gradient,\n variant: variant || 'filled',\n autoContrast,\n });\n\n return {\n groupSection: {\n '--section-height': getSize(size, 'section-height'),\n '--section-padding-x': getSize(size, 'section-padding-x'),\n '--section-fz': getFontSize(size),\n '--section-radius': radius === undefined ? undefined : getRadius(radius),\n '--section-bg': color || variant ? colors.background : undefined,\n '--section-color': colors.color,\n '--section-bd': color || variant ? colors.border : undefined,\n },\n };\n }\n);\n\nexport const ActionIconGroupSection = factory<ActionIconGroupSectionFactory>((_props) => {\n const props = useProps('ActionIconGroupSection', null, _props);\n const {\n className,\n style,\n classNames,\n styles,\n unstyled,\n vars,\n variant,\n gradient,\n radius,\n autoContrast,\n attributes,\n ...others\n } = props;\n\n const getStyles = useStyles<ActionIconGroupSectionFactory>({\n name: 'ActionIconGroupSection',\n props,\n classes,\n className,\n style,\n classNames,\n styles,\n unstyled,\n attributes,\n vars,\n varsResolver,\n rootSelector: 'groupSection',\n });\n\n return <Box {...getStyles('groupSection')} variant={variant} {...others} />;\n});\n\nActionIconGroupSection.classes = classes;\nActionIconGroupSection.varsResolver = varsResolver;\nActionIconGroupSection.displayName = '@mantine/core/ActionIconGroupSection';\n"],"mappings":";;;;;;;;;;;AAuDA,MAAM,eAAeA,6BAAAA,oBAClB,OAAO,EAAE,QAAQ,OAAO,UAAU,SAAS,cAAc,WAAW;CACnE,MAAM,SAAS,MAAM,qBAAqB;EACxC,OAAO,SAAS,MAAM;EACtB;EACA;EACA,SAAS,WAAW;EACpB;EACD,CAAC;AAEF,QAAO,EACL,cAAc;EACZ,oBAAoBC,iBAAAA,QAAQ,MAAM,iBAAiB;EACnD,uBAAuBA,iBAAAA,QAAQ,MAAM,oBAAoB;EACzD,gBAAgBC,iBAAAA,YAAY,KAAK;EACjC,oBAAoB,WAAW,KAAA,IAAY,KAAA,IAAYC,iBAAAA,UAAU,OAAO;EACxE,gBAAgB,SAAS,UAAU,OAAO,aAAa,KAAA;EACvD,mBAAmB,OAAO;EAC1B,gBAAgB,SAAS,UAAU,OAAO,SAAS,KAAA;EACpD,EACF;EAEJ;AAED,MAAa,yBAAyBC,gBAAAA,SAAwC,WAAW;CACvF,MAAM,QAAQC,kBAAAA,SAAS,0BAA0B,MAAM,OAAO;CAC9D,MAAM,EACJ,WACA,OACA,YACA,QACA,UACA,MACA,SACA,UACA,QACA,cACA,YACA,GAAG,WACD;AAiBJ,QAAO,iBAAA,GAAA,kBAAA,KAACC,YAAAA,KAAD;EAAK,GAfMC,mBAAAA,UAAyC;GACzD,MAAM;GACN;GACA,SAAA,0BAAA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA,cAAc;GACf,CAAC,CAEwB,eAAe;EAAW;EAAS,GAAI;EAAU,CAAA;EAC3E;AAEF,uBAAuB,UAAUC,0BAAAA;AACjC,uBAAuB,eAAe;AACtC,uBAAuB,cAAc"}