@mantine/core
Version:
React components library focused on usability, accessibility and developer experience
1 lines • 1.09 kB
Source Map (JSON)
{"version":3,"file":"resolve-style.cjs","names":[],"sources":["../../../../../../src/core/styles-api/use-styles/get-style/resolve-style/resolve-style.ts"],"sourcesContent":["import { CSSProperties } from 'react';\nimport { MantineStyleProp } from '../../../../Box';\nimport { MantineTheme } from '../../../../MantineProvider';\n\ninterface ResolveStyleInput {\n style: MantineStyleProp | undefined;\n theme: MantineTheme;\n}\n\nexport function resolveStyle({ style, theme }: ResolveStyleInput): CSSProperties {\n if (Array.isArray(style)) {\n return style.reduce<Record<string, any>>(\n (acc, item) => ({ ...acc, ...resolveStyle({ style: item, theme }) }),\n {}\n );\n }\n\n if (typeof style === 'function') {\n return style(theme);\n }\n\n if (style == null) {\n return {};\n }\n\n return style;\n}\n"],"mappings":";;AASA,SAAgB,aAAa,EAAE,OAAO,SAA2C;AAC/E,KAAI,MAAM,QAAQ,MAAM,CACtB,QAAO,MAAM,QACV,KAAK,UAAU;EAAE,GAAG;EAAK,GAAG,aAAa;GAAE,OAAO;GAAM;GAAO,CAAC;EAAE,GACnE,EAAE,CACH;AAGH,KAAI,OAAO,UAAU,WACnB,QAAO,MAAM,MAAM;AAGrB,KAAI,SAAS,KACX,QAAO,EAAE;AAGX,QAAO"}