@mantine/core
Version:
React components library focused on usability, accessibility and developer experience
1 lines • 1.17 kB
Source Map (JSON)
{"version":3,"file":"resolve-styles.cjs","names":[],"sources":["../../../../../../src/core/styles-api/use-styles/get-style/resolve-styles/resolve-styles.ts"],"sourcesContent":["import type { MantineTheme } from '../../../../MantineProvider';\nimport type { _Styles } from '../get-style';\n\nexport interface ResolveStylesInput {\n theme: MantineTheme;\n styles: _Styles | _Styles[];\n props: Record<string, any>;\n stylesCtx: Record<string, any> | undefined;\n}\n\nexport function resolveStyles({ theme, styles, props, stylesCtx }: ResolveStylesInput) {\n const arrayStyles = Array.isArray(styles) ? styles : [styles];\n const result: Record<string, any> = {};\n\n for (const style of arrayStyles) {\n if (typeof style === 'function') {\n Object.assign(result, style(theme, props, stylesCtx));\n } else if (style) {\n Object.assign(result, style);\n }\n }\n\n return result;\n}\n"],"mappings":";;AAUA,SAAgB,cAAc,EAAE,OAAO,QAAQ,OAAO,aAAiC;CACrF,MAAM,cAAc,MAAM,QAAQ,OAAO,GAAG,SAAS,CAAC,OAAO;CAC7D,MAAM,SAA8B,EAAE;AAEtC,MAAK,MAAM,SAAS,YAClB,KAAI,OAAO,UAAU,WACnB,QAAO,OAAO,QAAQ,MAAM,OAAO,OAAO,UAAU,CAAC;UAC5C,MACT,QAAO,OAAO,QAAQ,MAAM;AAIhC,QAAO"}