UNPKG

2.14 kBJavaScriptView Raw
1'use client';
2import React from 'react';
3import { localStorageColorSchemeManager } from './color-scheme-managers/local-storage-manager.mjs';
4import { MantineContext } from './Mantine.context.mjs';
5import { MantineClasses } from './MantineClasses/MantineClasses.mjs';
6import { MantineCssVariables } from './MantineCssVariables/MantineCssVariables.mjs';
7import { MantineThemeProvider } from './MantineThemeProvider/MantineThemeProvider.mjs';
8import { suppressNextjsWarning } from './suppress-nextjs-warning.mjs';
9import '@mantine/hooks';
10import { useProviderColorScheme } from './use-mantine-color-scheme/use-provider-color-scheme.mjs';
11import { useRespectReduceMotion } from './use-respect-reduce-motion/use-respect-reduce-motion.mjs';
12
13suppressNextjsWarning();
14function MantineProvider({
15 theme,
16 children,
17 getStyleNonce,
18 withCssVariables = true,
19 cssVariablesSelector = ":root",
20 classNamesPrefix = "mantine",
21 colorSchemeManager = localStorageColorSchemeManager(),
22 defaultColorScheme = "light",
23 getRootElement = () => document.documentElement,
24 cssVariablesResolver,
25 forceColorScheme
26}) {
27 const { colorScheme, setColorScheme, clearColorScheme } = useProviderColorScheme({
28 defaultColorScheme,
29 forceColorScheme,
30 manager: colorSchemeManager,
31 getRootElement
32 });
33 useRespectReduceMotion({
34 respectReducedMotion: theme?.respectReducedMotion || false,
35 getRootElement
36 });
37 return /* @__PURE__ */ React.createElement(
38 MantineContext.Provider,
39 {
40 value: {
41 colorSchemeManager,
42 colorScheme,
43 setColorScheme,
44 clearColorScheme,
45 getRootElement,
46 classNamesPrefix,
47 getStyleNonce,
48 cssVariablesResolver,
49 cssVariablesSelector
50 }
51 },
52 /* @__PURE__ */ React.createElement(MantineThemeProvider, { theme }, withCssVariables && /* @__PURE__ */ React.createElement(MantineCssVariables, { cssVariablesSelector }), /* @__PURE__ */ React.createElement(MantineClasses, null), children)
53 );
54}
55MantineProvider.displayName = "@mantine/core/MantineProvider";
56
57export { MantineProvider };
58//# sourceMappingURL=MantineProvider.mjs.map