{"version":3,"file":"MantineProvider.cjs","names":["localStorageColorSchemeManager","useProviderColorScheme","MantineContext","MantineThemeProvider","MantineCssVariables","MantineClasses"],"sources":["../../../src/core/MantineProvider/MantineProvider.tsx"],"sourcesContent":["import './baseline.css';\nimport './global.css';\nimport './default-css-variables.css';\n\nimport { localStorageColorSchemeManager, MantineColorSchemeManager } from './color-scheme-managers';\nimport { MantineContext, MantineStylesTransform } from './Mantine.context';\nimport { MantineClasses } from './MantineClasses';\nimport { CSSVariablesResolver, MantineCssVariables } from './MantineCssVariables';\nimport { MantineThemeProvider } from './MantineThemeProvider';\nimport type { MantineColorScheme, MantineThemeOverride } from './theme.types';\nimport { useProviderColorScheme } from './use-mantine-color-scheme';\nimport { useRespectReduceMotion } from './use-respect-reduce-motion';\n\nexport interface MantineProviderProps {\n  /** Theme override object */\n  theme?: MantineThemeOverride;\n\n  /** Used to retrieve/set color scheme value in external storage, by default uses `window.localStorage` */\n  colorSchemeManager?: MantineColorSchemeManager;\n\n  /** Default color scheme value used when `colorSchemeManager` cannot retrieve value from external storage, `light` by default */\n  defaultColorScheme?: MantineColorScheme;\n\n  /** Forces color scheme value, if set, MantineProvider ignores `colorSchemeManager` and `defaultColorScheme` */\n  forceColorScheme?: 'light' | 'dark';\n\n  /** CSS selector to which CSS variables should be added, by default variables are applied to `:root` and `:host` */\n  cssVariablesSelector?: string;\n\n  /** Determines whether theme CSS variables should be added to given `cssVariablesSelector` @default true */\n  withCssVariables?: boolean;\n\n  /** Determines whether CSS variables should be deduplicated: if CSS variable has the same value as in default theme, it is not added in the runtime. @default true. */\n  deduplicateCssVariables?: boolean;\n\n  /** Function to resolve root element to set `data-mantine-color-scheme` attribute, must return undefined on server, `() => document.documentElement` by default */\n  getRootElement?: () => HTMLElement | undefined;\n\n  /** A prefix for components static classes (for example {selector}-Text-root), `mantine` by default */\n  classNamesPrefix?: string;\n\n  /** Function to generate nonce attribute added to all generated `style` tags */\n  getStyleNonce?: () => string;\n\n  /** Function to generate CSS variables based on theme object */\n  cssVariablesResolver?: CSSVariablesResolver;\n\n  /** Determines whether components should have static classes, for example, `mantine-Button-root`. @default true */\n  withStaticClasses?: boolean;\n\n  /** Determines whether global classes should be added with `<style />` tag. Global classes are required for `hiddenFrom`/`visibleFrom` and `lightHidden`/`darkHidden` props to work. @default true. */\n  withGlobalClasses?: boolean;\n\n  /** An object to transform `styles` and `sx` props into css classes, can be used with CSS-in-JS libraries */\n  stylesTransform?: MantineStylesTransform;\n\n  /** Your application */\n  children?: React.ReactNode;\n\n  /** Environment at which the provider is used, `'test'` environment disables all transitions and portals */\n  env?: 'default' | 'test';\n}\n\nexport function MantineProvider({\n  theme,\n  children,\n  getStyleNonce,\n  withStaticClasses = true,\n  withGlobalClasses = true,\n  deduplicateCssVariables = true,\n  withCssVariables = true,\n  cssVariablesSelector,\n  classNamesPrefix = 'mantine',\n  colorSchemeManager = localStorageColorSchemeManager(),\n  defaultColorScheme = 'light',\n  getRootElement = () => document.documentElement,\n  cssVariablesResolver,\n  forceColorScheme,\n  stylesTransform,\n  env,\n}: MantineProviderProps) {\n  const { colorScheme, setColorScheme, clearColorScheme } = useProviderColorScheme({\n    defaultColorScheme,\n    forceColorScheme,\n    manager: colorSchemeManager,\n    getRootElement,\n  });\n\n  useRespectReduceMotion({\n    respectReducedMotion: theme?.respectReducedMotion || false,\n    getRootElement,\n  });\n\n  return (\n    <MantineContext\n      value={{\n        colorScheme,\n        setColorScheme,\n        clearColorScheme,\n        getRootElement,\n        classNamesPrefix,\n        getStyleNonce,\n        cssVariablesResolver,\n        cssVariablesSelector: cssVariablesSelector ?? ':root',\n        withStaticClasses,\n        stylesTransform,\n        env,\n      }}\n    >\n      <MantineThemeProvider theme={theme}>\n        {withCssVariables && (\n          <MantineCssVariables\n            cssVariablesSelector={cssVariablesSelector}\n            deduplicateCssVariables={deduplicateCssVariables}\n          />\n        )}\n        {withGlobalClasses && <MantineClasses />}\n        {children}\n      </MantineThemeProvider>\n    </MantineContext>\n  );\n}\n\nMantineProvider.displayName = '@mantine/core/MantineProvider';\n\nexport interface HeadlessMantineProviderProps {\n  /** Theme override object */\n  theme?: MantineThemeOverride;\n\n  /** Your application */\n  children?: React.ReactNode;\n\n  /** Environment at which the provider is used, `'test'` environment disables all transitions and portals */\n  env?: 'default' | 'test';\n}\n\nexport function HeadlessMantineProvider({ children, theme, env }: HeadlessMantineProviderProps) {\n  return (\n    <MantineContext\n      value={{\n        colorScheme: 'auto',\n        setColorScheme: () => {},\n        clearColorScheme: () => {},\n        getRootElement: () => document.documentElement,\n        classNamesPrefix: 'mantine',\n        cssVariablesSelector: ':root',\n        withStaticClasses: false,\n        headless: true,\n        env,\n      }}\n    >\n      <MantineThemeProvider theme={theme}>{children}</MantineThemeProvider>\n    </MantineContext>\n  );\n}\n\nHeadlessMantineProvider.displayName = '@mantine/core/HeadlessMantineProvider';\n"],"mappings":";;;;;;;;;;;;;;AA+DA,SAAgB,gBAAgB,EAC9B,OACA,UACA,eACA,oBAAoB,MACpB,oBAAoB,MACpB,0BAA0B,MAC1B,mBAAmB,MACnB,sBACA,mBAAmB,WACnB,qBAAqBA,8BAAAA,gCAAgC,EACrD,qBAAqB,SACrB,uBAAuB,SAAS,iBAChC,sBACA,kBACA,iBACA,OACuB;CACvB,MAAM,EAAE,aAAa,gBAAgB,qBAAqBC,kCAAAA,uBAAuB;EAC/E;EACA;EACA,SAAS;EACT;EACD,CAAC;AAEF,mCAAA,uBAAuB;EACrB,sBAAsB,OAAO,wBAAwB;EACrD;EACD,CAAC;AAEF,QACE,iBAAA,GAAA,kBAAA,KAACC,wBAAAA,gBAAD;EACE,OAAO;GACL;GACA;GACA;GACA;GACA;GACA;GACA;GACA,sBAAsB,wBAAwB;GAC9C;GACA;GACA;GACD;YAED,iBAAA,GAAA,kBAAA,MAACC,6BAAAA,sBAAD;GAA6B;aAA7B;IACG,oBACC,iBAAA,GAAA,kBAAA,KAACC,4BAAAA,qBAAD;KACwB;KACG;KACzB,CAAA;IAEH,qBAAqB,iBAAA,GAAA,kBAAA,KAACC,uBAAAA,gBAAD,EAAkB,CAAA;IACvC;IACoB;;EACR,CAAA;;AAIrB,gBAAgB,cAAc;AAa9B,SAAgB,wBAAwB,EAAE,UAAU,OAAO,OAAqC;AAC9F,QACE,iBAAA,GAAA,kBAAA,KAACH,wBAAAA,gBAAD;EACE,OAAO;GACL,aAAa;GACb,sBAAsB;GACtB,wBAAwB;GACxB,sBAAsB,SAAS;GAC/B,kBAAkB;GAClB,sBAAsB;GACtB,mBAAmB;GACnB,UAAU;GACV;GACD;YAED,iBAAA,GAAA,kBAAA,KAACC,6BAAAA,sBAAD;GAA6B;GAAQ;GAAgC,CAAA;EACtD,CAAA;;AAIrB,wBAAwB,cAAc"}