UNPKG

@mantine/core

Version:

React components library focused on usability, accessibility and developer experience

59 lines (56 loc) 2.14 kB
'use client'; import React from 'react'; import { localStorageColorSchemeManager } from './color-scheme-managers/local-storage-manager.mjs'; import { MantineContext } from './Mantine.context.mjs'; import { MantineClasses } from './MantineClasses/MantineClasses.mjs'; import { MantineCssVariables } from './MantineCssVariables/MantineCssVariables.mjs'; import { MantineThemeProvider } from './MantineThemeProvider/MantineThemeProvider.mjs'; import { suppressNextjsWarning } from './suppress-nextjs-warning.mjs'; import '@mantine/hooks'; import { useProviderColorScheme } from './use-mantine-color-scheme/use-provider-color-scheme.mjs'; import { useRespectReduceMotion } from './use-respect-reduce-motion/use-respect-reduce-motion.mjs'; suppressNextjsWarning(); function MantineProvider({ theme, children, getStyleNonce, withCssVariables = true, cssVariablesSelector = ":root", classNamesPrefix = "mantine", colorSchemeManager = localStorageColorSchemeManager(), defaultColorScheme = "light", getRootElement = () => document.documentElement, cssVariablesResolver, forceColorScheme }) { const { colorScheme, setColorScheme, clearColorScheme } = useProviderColorScheme({ defaultColorScheme, forceColorScheme, manager: colorSchemeManager, getRootElement }); useRespectReduceMotion({ respectReducedMotion: theme?.respectReducedMotion || false, getRootElement }); return /* @__PURE__ */ React.createElement( MantineContext.Provider, { value: { colorSchemeManager, colorScheme, setColorScheme, clearColorScheme, getRootElement, classNamesPrefix, getStyleNonce, cssVariablesResolver, cssVariablesSelector } }, /* @__PURE__ */ React.createElement(MantineThemeProvider, { theme }, withCssVariables && /* @__PURE__ */ React.createElement(MantineCssVariables, { cssVariablesSelector }), /* @__PURE__ */ React.createElement(MantineClasses, null), children) ); } MantineProvider.displayName = "@mantine/core/MantineProvider"; export { MantineProvider }; //# sourceMappingURL=MantineProvider.mjs.map