@mantine/core
Version:
React components library focused on usability, accessibility and developer experience
26 lines (25 loc) • 858 B
JavaScript
"use client";
const require_Mantine_context = require("../../MantineProvider/Mantine.context.cjs");
//#region packages/@mantine/core/src/core/styles-api/use-styles/use-transformed-styles.ts
function useStylesTransform({ props, stylesCtx, themeName, theme }) {
const stylesTransform = require_Mantine_context.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
exports.useStylesTransform = useStylesTransform;
//# sourceMappingURL=use-transformed-styles.cjs.map