@mantine/core
Version:
React components library focused on usability, accessibility and developer experience
26 lines (25 loc) • 817 B
JavaScript
"use client";
import { useMantineStylesTransform } from "../../MantineProvider/Mantine.context.mjs";
//#region packages/@mantine/core/src/core/styles-api/use-styles/use-transformed-styles.ts
function useStylesTransform({ props, stylesCtx, themeName, theme }) {
const stylesTransform = useMantineStylesTransform()?.();
const getTransformedStyles = (styles) => {
if (!stylesTransform) return [];
return [...styles.map((style) => stylesTransform(style, {
props,
theme,
ctx: stylesCtx
})), ...themeName.map((n) => stylesTransform(theme.components[n]?.styles, {
props,
theme,
ctx: stylesCtx
}))].filter(Boolean);
};
return {
getTransformedStyles,
withStylesTransform: !!stylesTransform
};
}
//#endregion
export { useStylesTransform };
//# sourceMappingURL=use-transformed-styles.mjs.map