UNPKG

@mantine/core

Version:

React components library focused on usability, accessibility and developer experience

76 lines (75 loc) 2.87 kB
"use client"; import { localStorageColorSchemeManager } from "./color-scheme-managers/local-storage-manager.mjs"; import { MantineContext } from "./Mantine.context.mjs"; import { useProviderColorScheme } from "./use-mantine-color-scheme/use-provider-color-scheme.mjs"; import "./baseline.mjs"; import "./global.mjs"; import "./default-css-variables.mjs"; import { MantineThemeProvider } from "./MantineThemeProvider/MantineThemeProvider.mjs"; import { MantineClasses } from "./MantineClasses/MantineClasses.mjs"; import { MantineCssVariables } from "./MantineCssVariables/MantineCssVariables.mjs"; import { useRespectReduceMotion } from "./use-respect-reduce-motion/use-respect-reduce-motion.mjs"; import { jsx, jsxs } from "react/jsx-runtime"; //#region packages/@mantine/core/src/core/MantineProvider/MantineProvider.tsx function MantineProvider({ theme, children, getStyleNonce, withStaticClasses = true, withGlobalClasses = true, deduplicateCssVariables = true, withCssVariables = true, cssVariablesSelector, classNamesPrefix = "mantine", colorSchemeManager = localStorageColorSchemeManager(), defaultColorScheme = "light", getRootElement = () => document.documentElement, cssVariablesResolver, forceColorScheme, stylesTransform, env }) { const { colorScheme, setColorScheme, clearColorScheme } = useProviderColorScheme({ defaultColorScheme, forceColorScheme, manager: colorSchemeManager, getRootElement }); useRespectReduceMotion({ respectReducedMotion: theme?.respectReducedMotion || false, getRootElement }); return /* @__PURE__ */ jsx(MantineContext, { value: { colorScheme, setColorScheme, clearColorScheme, getRootElement, classNamesPrefix, getStyleNonce, cssVariablesResolver, cssVariablesSelector: cssVariablesSelector ?? ":root", withStaticClasses, stylesTransform, env }, children: /* @__PURE__ */ jsxs(MantineThemeProvider, { theme, children: [ withCssVariables && /* @__PURE__ */ jsx(MantineCssVariables, { cssVariablesSelector, deduplicateCssVariables }), withGlobalClasses && /* @__PURE__ */ jsx(MantineClasses, {}), children ] }) }); } MantineProvider.displayName = "@mantine/core/MantineProvider"; function HeadlessMantineProvider({ children, theme, env }) { return /* @__PURE__ */ jsx(MantineContext, { value: { colorScheme: "auto", setColorScheme: () => {}, clearColorScheme: () => {}, getRootElement: () => document.documentElement, classNamesPrefix: "mantine", cssVariablesSelector: ":root", withStaticClasses: false, headless: true, env }, children: /* @__PURE__ */ jsx(MantineThemeProvider, { theme, children }) }); } HeadlessMantineProvider.displayName = "@mantine/core/HeadlessMantineProvider"; //#endregion export { HeadlessMantineProvider, MantineProvider }; //# sourceMappingURL=MantineProvider.mjs.map