@mantine/core 7.0.0-beta.0 → 7.0.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/cjs/components/Grid/GridCol/GridCol.js +10 -2
  2. package/cjs/components/Grid/GridCol/GridCol.js.map +1 -1
  3. package/cjs/components/Grid/GridCol/GridColVariables.js.map +1 -1
  4. package/cjs/components/Menu/Menu.js +2 -0
  5. package/cjs/components/Menu/Menu.js.map +1 -1
  6. package/cjs/components/MultiSelect/MultiSelect.js +8 -4
  7. package/cjs/components/MultiSelect/MultiSelect.js.map +1 -1
  8. package/cjs/components/NumberInput/NumberInput.js +5 -1
  9. package/cjs/components/NumberInput/NumberInput.js.map +1 -1
  10. package/cjs/components/PasswordInput/PasswordInput.js.map +1 -1
  11. package/cjs/components/Select/Select.js +8 -4
  12. package/cjs/components/Select/Select.js.map +1 -1
  13. package/cjs/components/TagsInput/TagsInput.js +8 -4
  14. package/cjs/components/TagsInput/TagsInput.js.map +1 -1
  15. package/cjs/core/MantineProvider/ColorSchemeScript/ColorSchemeScript.js +14 -10
  16. package/cjs/core/MantineProvider/ColorSchemeScript/ColorSchemeScript.js.map +1 -1
  17. package/cjs/core/MantineProvider/MantineProvider.js +3 -1
  18. package/cjs/core/MantineProvider/MantineProvider.js.map +1 -1
  19. package/cjs/core/MantineProvider/use-mantine-color-scheme/use-mantine-color-scheme.js +9 -1
  20. package/cjs/core/MantineProvider/use-mantine-color-scheme/use-mantine-color-scheme.js.map +1 -1
  21. package/cjs/core/MantineProvider/use-mantine-color-scheme/use-provider-color-scheme.js +15 -6
  22. package/cjs/core/MantineProvider/use-mantine-color-scheme/use-provider-color-scheme.js.map +1 -1
  23. package/esm/components/Grid/GridCol/GridCol.js +10 -2
  24. package/esm/components/Grid/GridCol/GridCol.js.map +1 -1
  25. package/esm/components/Grid/GridCol/GridColVariables.js.map +1 -1
  26. package/esm/components/Menu/Menu.js +2 -0
  27. package/esm/components/Menu/Menu.js.map +1 -1
  28. package/esm/components/MultiSelect/MultiSelect.js +8 -4
  29. package/esm/components/MultiSelect/MultiSelect.js.map +1 -1
  30. package/esm/components/NumberInput/NumberInput.js +5 -1
  31. package/esm/components/NumberInput/NumberInput.js.map +1 -1
  32. package/esm/components/PasswordInput/PasswordInput.js.map +1 -1
  33. package/esm/components/Select/Select.js +8 -4
  34. package/esm/components/Select/Select.js.map +1 -1
  35. package/esm/components/TagsInput/TagsInput.js +8 -4
  36. package/esm/components/TagsInput/TagsInput.js.map +1 -1
  37. package/esm/core/MantineProvider/ColorSchemeScript/ColorSchemeScript.js +14 -10
  38. package/esm/core/MantineProvider/ColorSchemeScript/ColorSchemeScript.js.map +1 -1
  39. package/esm/core/MantineProvider/MantineProvider.js +3 -1
  40. package/esm/core/MantineProvider/MantineProvider.js.map +1 -1
  41. package/esm/core/MantineProvider/use-mantine-color-scheme/use-mantine-color-scheme.js +10 -2
  42. package/esm/core/MantineProvider/use-mantine-color-scheme/use-mantine-color-scheme.js.map +1 -1
  43. package/esm/core/MantineProvider/use-mantine-color-scheme/use-provider-color-scheme.js +15 -6
  44. package/esm/core/MantineProvider/use-mantine-color-scheme/use-provider-color-scheme.js.map +1 -1
  45. package/lib/components/Grid/GridCol/GridColVariables.d.ts +4 -1
  46. package/lib/components/Input/use-input-props.d.ts +13 -13
  47. package/lib/components/Menu/Menu.d.ts +10 -0
  48. package/lib/components/NavLink/NavLink.d.ts +1 -1
  49. package/lib/components/PasswordInput/PasswordInput.d.ts +2 -2
  50. package/lib/core/MantineProvider/ColorSchemeScript/ColorSchemeScript.d.ts +2 -1
  51. package/lib/core/MantineProvider/MantineProvider.d.ts +3 -1
  52. package/lib/core/MantineProvider/use-mantine-color-scheme/use-computed-color-scheme.d.ts +1 -1
  53. package/lib/core/MantineProvider/use-mantine-color-scheme/use-mantine-color-scheme.d.ts +1 -0
  54. package/lib/core/MantineProvider/use-mantine-color-scheme/use-provider-color-scheme.d.ts +2 -1
  55. package/package.json +3 -2
@@ -1 +1 @@
1
- {"version":3,"file":"MantineProvider.js","sources":["../../../src/core/MantineProvider/MantineProvider.tsx"],"sourcesContent":["import './global.css';\nimport React from 'react';\nimport { suppressNextjsWarning } from './suppress-nextjs-warning';\nimport { MantineCssVariables, CSSVariablesResolver } from './MantineCssVariables';\nimport { MantineThemeProvider } from './MantineThemeProvider';\nimport type { MantineColorScheme, MantineThemeOverride } from './theme.types';\nimport { MantineClasses } from './MantineClasses';\nimport { localStorageColorSchemeManager, MantineColorSchemeManager } from './color-scheme-managers';\nimport { MantineContext } from './Mantine.context';\nimport { useProviderColorScheme } from './use-mantine-color-scheme';\nimport { useRespectReduceMotion } from './use-respect-reduce-motion';\n\nsuppressNextjsWarning();\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, `auto` by default */\n defaultColorScheme?: MantineColorScheme;\n\n /** CSS selector to which CSS variables should be added, `:root` by default */\n cssVariablesSelector?: string;\n\n /** Determines whether theme CSS variables should be added to given `cssVariablesSelector`, `true` by default */\n withCssVariables?: 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 /** Your application */\n children?: React.ReactNode;\n}\n\nexport function MantineProvider({\n theme,\n children,\n getStyleNonce,\n withCssVariables = true,\n cssVariablesSelector = ':root',\n classNamesPrefix = 'mantine',\n colorSchemeManager = localStorageColorSchemeManager(),\n defaultColorScheme = 'auto',\n getRootElement = () => document.documentElement,\n cssVariablesResolver,\n}: MantineProviderProps) {\n const { colorScheme, setColorScheme, clearColorScheme } = useProviderColorScheme({\n defaultColorScheme,\n manager: colorSchemeManager,\n getRootElement,\n });\n\n useRespectReduceMotion({\n respectReducedMotion: theme?.respectReducedMotion || false,\n getRootElement,\n });\n\n return (\n <MantineContext.Provider\n value={{\n colorSchemeManager,\n colorScheme,\n setColorScheme,\n clearColorScheme,\n getRootElement,\n classNamesPrefix,\n getStyleNonce,\n cssVariablesResolver,\n cssVariablesSelector,\n }}\n >\n <MantineThemeProvider theme={theme}>\n {withCssVariables && <MantineCssVariables cssVariablesSelector={cssVariablesSelector} />}\n <MantineClasses />\n {children}\n </MantineThemeProvider>\n </MantineContext.Provider>\n );\n}\n\nMantineProvider.displayName = '@mantine/core/MantineProvider';\n"],"names":[],"mappings":";;;;;;;;;;AAUA,qBAAqB,EAAE,CAAC;AACjB,SAAS,eAAe,CAAC;AAChC,EAAE,KAAK;AACP,EAAE,QAAQ;AACV,EAAE,aAAa;AACf,EAAE,gBAAgB,GAAG,IAAI;AACzB,EAAE,oBAAoB,GAAG,OAAO;AAChC,EAAE,gBAAgB,GAAG,SAAS;AAC9B,EAAE,kBAAkB,GAAG,8BAA8B,EAAE;AACvD,EAAE,kBAAkB,GAAG,MAAM;AAC7B,EAAE,cAAc,GAAG,MAAM,QAAQ,CAAC,eAAe;AACjD,EAAE,oBAAoB;AACtB,CAAC,EAAE;AACH,EAAE,MAAM,EAAE,WAAW,EAAE,cAAc,EAAE,gBAAgB,EAAE,GAAG,sBAAsB,CAAC;AACnF,IAAI,kBAAkB;AACtB,IAAI,OAAO,EAAE,kBAAkB;AAC/B,IAAI,cAAc;AAClB,GAAG,CAAC,CAAC;AACL,EAAE,sBAAsB,CAAC;AACzB,IAAI,oBAAoB,EAAE,CAAC,KAAK,IAAI,IAAI,GAAG,KAAK,CAAC,GAAG,KAAK,CAAC,oBAAoB,KAAK,KAAK;AACxF,IAAI,cAAc;AAClB,GAAG,CAAC,CAAC;AACL,EAAE,uBAAuB,KAAK,CAAC,aAAa;AAC5C,IAAI,cAAc,CAAC,QAAQ;AAC3B,IAAI;AACJ,MAAM,KAAK,EAAE;AACb,QAAQ,kBAAkB;AAC1B,QAAQ,WAAW;AACnB,QAAQ,cAAc;AACtB,QAAQ,gBAAgB;AACxB,QAAQ,cAAc;AACtB,QAAQ,gBAAgB;AACxB,QAAQ,aAAa;AACrB,QAAQ,oBAAoB;AAC5B,QAAQ,oBAAoB;AAC5B,OAAO;AACP,KAAK;AACL,oBAAoB,KAAK,CAAC,aAAa,CAAC,oBAAoB,EAAE,EAAE,KAAK,EAAE,EAAE,gBAAgB,oBAAoB,KAAK,CAAC,aAAa,CAAC,mBAAmB,EAAE,EAAE,oBAAoB,EAAE,CAAC,kBAAkB,KAAK,CAAC,aAAa,CAAC,cAAc,EAAE,IAAI,CAAC,EAAE,QAAQ,CAAC;AACrP,GAAG,CAAC;AACJ,CAAC;AACD,eAAe,CAAC,WAAW,GAAG,+BAA+B;;;;"}
1
+ {"version":3,"file":"MantineProvider.js","sources":["../../../src/core/MantineProvider/MantineProvider.tsx"],"sourcesContent":["import './global.css';\nimport React from 'react';\nimport { suppressNextjsWarning } from './suppress-nextjs-warning';\nimport { MantineCssVariables, CSSVariablesResolver } from './MantineCssVariables';\nimport { MantineThemeProvider } from './MantineThemeProvider';\nimport type { MantineColorScheme, MantineThemeOverride } from './theme.types';\nimport { MantineClasses } from './MantineClasses';\nimport { localStorageColorSchemeManager, MantineColorSchemeManager } from './color-scheme-managers';\nimport { MantineContext } from './Mantine.context';\nimport { useProviderColorScheme } from './use-mantine-color-scheme';\nimport { useRespectReduceMotion } from './use-respect-reduce-motion';\n\nsuppressNextjsWarning();\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, `auto` 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, `:root` by default */\n cssVariablesSelector?: string;\n\n /** Determines whether theme CSS variables should be added to given `cssVariablesSelector`, `true` by default */\n withCssVariables?: 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 /** Your application */\n children?: React.ReactNode;\n}\n\nexport function MantineProvider({\n theme,\n children,\n getStyleNonce,\n withCssVariables = true,\n cssVariablesSelector = ':root',\n classNamesPrefix = 'mantine',\n colorSchemeManager = localStorageColorSchemeManager(),\n defaultColorScheme = 'auto',\n getRootElement = () => document.documentElement,\n cssVariablesResolver,\n forceColorScheme,\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.Provider\n value={{\n colorSchemeManager,\n colorScheme,\n setColorScheme,\n clearColorScheme,\n getRootElement,\n classNamesPrefix,\n getStyleNonce,\n cssVariablesResolver,\n cssVariablesSelector,\n }}\n >\n <MantineThemeProvider theme={theme}>\n {withCssVariables && <MantineCssVariables cssVariablesSelector={cssVariablesSelector} />}\n <MantineClasses />\n {children}\n </MantineThemeProvider>\n </MantineContext.Provider>\n );\n}\n\nMantineProvider.displayName = '@mantine/core/MantineProvider';\n"],"names":[],"mapp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B,EAAE,CAAC,kBAAkB,KAAK,CAAC,aAAa,CAAC,cAAc,EAAE,IAAI,CAAC,EAAE,QAAQ,CAAC;AACrP,GAAG,CAAC;AACJ,CAAC;AACD,eAAe,CAAC,WAAW,GAAG,+BAA+B;;;;"}
@@ -1,4 +1,5 @@
1
- import { useRef, useContext, useEffect } from 'react';
1
+ import { useRef, useContext, useCallback, useEffect } from 'react';
2
+ import { useColorScheme } from '@mantine/hooks';
2
3
  import { MantineContext } from '../Mantine.context.js';
3
4
 
4
5
  function disableTransition() {
@@ -34,6 +35,12 @@ function useMantineColorScheme() {
34
35
  (_a = clearStylesRef.current) == null ? void 0 : _a.call(clearStylesRef);
35
36
  }, 10);
36
37
  };
38
+ const osColorScheme = useColorScheme("light", { getInitialValueInEffect: false });
39
+ const computedColorScheme = ctx.colorScheme === "auto" ? osColorScheme : ctx.colorScheme;
40
+ const toggleColorScheme = useCallback(
41
+ () => setColorScheme(computedColorScheme === "light" ? "dark" : "light"),
42
+ [setColorScheme, computedColorScheme]
43
+ );
37
44
  useEffect(
38
45
  () => () => {
39
46
  var _a;
@@ -45,7 +52,8 @@ function useMantineColorScheme() {
45
52
  return {
46
53
  colorScheme: ctx.colorScheme,
47
54
  setColorScheme,
48
- clearColorScheme
55
+ clearColorScheme,
56
+ toggleColorScheme
49
57
  };
50
58
  }
51
59
 
@@ -1 +1 @@
1
- {"version":3,"file":"use-mantine-color-scheme.js","sources":["../../../../src/core/MantineProvider/use-mantine-color-scheme/use-mantine-color-scheme.ts"],"sourcesContent":["import { useContext, useEffect, useRef } from 'react';\nimport { MantineContext } from '../Mantine.context';\nimport { MantineColorScheme } from '../theme.types';\n\nfunction disableTransition() {\n const style = document.createElement('style');\n style.innerHTML = '*, *::before, *::after {transition: none !important;}';\n style.setAttribute('data-mantine-disable-transition', 'true');\n document.head.appendChild(style);\n const clear = () =>\n document\n .querySelectorAll('[data-mantine-disable-transition]')\n .forEach((element) => element.remove());\n return clear;\n}\n\nexport function useMantineColorScheme() {\n const clearStylesRef = useRef<() => void>();\n const timeoutRef = useRef<number>();\n const ctx = useContext(MantineContext);\n\n if (!ctx) {\n throw new Error('[@mantine/core] MantineProvider was not found in tree');\n }\n\n const setColorScheme = (value: MantineColorScheme) => {\n ctx.setColorScheme(value);\n clearStylesRef.current = disableTransition();\n window.clearTimeout(timeoutRef.current);\n timeoutRef.current = window.setTimeout(() => {\n clearStylesRef.current?.();\n }, 10);\n };\n\n const clearColorScheme = () => {\n ctx.clearColorScheme();\n clearStylesRef.current = disableTransition();\n window.clearTimeout(timeoutRef.current);\n timeoutRef.current = window.setTimeout(() => {\n clearStylesRef.current?.();\n }, 10);\n };\n\n useEffect(\n () => () => {\n clearStylesRef.current?.();\n window.clearTimeout(timeoutRef.current);\n },\n []\n );\n\n return {\n colorScheme: ctx.colorScheme,\n setColorScheme,\n clearColorScheme,\n };\n}\n"],"names":[],"mappings":";;;AAEA,SAAS,iBAAiB,GAAG;AAC7B,EAAE,MAAM,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;AAChD,EAAE,KAAK,CAAC,SAAS,GAAG,uDAAuD,CAAC;AAC5E,EAAE,KAAK,CAAC,YAAY,CAAC,iCAAiC,EAAE,MAAM,CAAC,CAAC;AAChE,EAAE,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;AACnC,EAAE,MAAM,KAAK,GAAG,MAAM,QAAQ,CAAC,gBAAgB,CAAC,mCAAmC,CAAC,CAAC,OAAO,CAAC,CAAC,OAAO,KAAK,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;AAC5H,EAAE,OAAO,KAAK,CAAC;AACf,CAAC;AACM,SAAS,qBAAqB,GAAG;AACxC,EAAE,MAAM,cAAc,GAAG,MAAM,EAAE,CAAC;AAClC,EAAE,MAAM,UAAU,GAAG,MAAM,EAAE,CAAC;AAC9B,EAAE,MAAM,GAAG,GAAG,UAAU,CAAC,cAAc,CAAC,CAAC;AACzC,EA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AAG,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;AAC/E,MAAM,MAAM,CAAC,YAAY,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;AAC9C,KAAK;AACL,IAAI,EAAE;AACN,GAAG,CAAC;AACJ,EAAE,OAAO;AACT,IAAI,WAAW,EAAE,GAAG,CAAC,WAAW;AAChC,IAAI,cAAc;AAClB,IAAI,gBAAgB;AACpB,GAAG,CAAC;AACJ;;;;"}
1
+ {"version":3,"file":"use-mantine-color-scheme.js","sources":["../../../../src/core/MantineProvider/use-mantine-color-scheme/use-mantine-color-scheme.ts"],"sourcesContent":["import { useCallback, useContext, useEffect, useRef } from 'react';\nimport { useColorScheme } from '@mantine/hooks';\nimport { MantineContext } from '../Mantine.context';\nimport { MantineColorScheme } from '../theme.types';\n\nfunction disableTransition() {\n const style = document.createElement('style');\n style.innerHTML = '*, *::before, *::after {transition: none !important;}';\n style.setAttribute('data-mantine-disable-transition', 'true');\n document.head.appendChild(style);\n const clear = () =>\n document\n .querySelectorAll('[data-mantine-disable-transition]')\n .forEach((element) => element.remove());\n return clear;\n}\n\nexport function useMantineColorScheme() {\n const clearStylesRef = useRef<() => void>();\n const timeoutRef = useRef<number>();\n const ctx = useContext(MantineContext);\n\n if (!ctx) {\n throw new Error('[@mantine/core] MantineProvider was not found in tree');\n }\n\n const setColorScheme = (value: MantineColorScheme) => {\n ctx.setColorScheme(value);\n clearStylesRef.current = disableTransition();\n window.clearTimeout(timeoutRef.current);\n timeoutRef.current = window.setTimeout(() => {\n clearStylesRef.current?.();\n }, 10);\n };\n\n const clearColorScheme = () => {\n ctx.clearColorScheme();\n clearStylesRef.current = disableTransition();\n window.clearTimeout(timeoutRef.current);\n timeoutRef.current = window.setTimeout(() => {\n clearStylesRef.current?.();\n }, 10);\n };\n\n const osColorScheme = useColorScheme('light', { getInitialValueInEffect: false });\n const computedColorScheme = ctx.colorScheme === 'auto' ? osColorScheme : ctx.colorScheme;\n\n const toggleColorScheme = useCallback(\n () => setColorScheme(computedColorScheme === 'light' ? 'dark' : 'light'),\n [setColorScheme, computedColorScheme]\n );\n\n useEffect(\n () => () => {\n clearStylesRef.current?.();\n window.clearTimeout(timeoutRef.current);\n },\n []\n );\n\n return {\n colorScheme: ctx.colorScheme,\n setColorScheme,\n clearColorScheme,\n toggleColorScheme,\n };\n}\n"],"names":[],"mappings":";;;;AAGA,SAAS,iBAAiB,GAAG;AAC7B,EAAE,MAAM,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;AAChD,EAAE,KAAK,CAAC,SAAS,GAAG,uDAAuD,CAAC;AAC5E,EAAE,KAAK,CAAC,YAAY,CAAC,iCAAiC,EAAE,MAAM,CAAC,CAAC;AAChE,EAAE,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;AACnC,EAAE,MAAM,KAAK,GAAG,MAAM,QAAQ,CAAC,gBAAgB,CAAC,mCAAmC,CAAC,CAAC,OAAO,CAAC,CAAC,OAAO,KAAK,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;AAC5H,EAAE,OAAO,KAAK,CAAC;AACf,CAAC;AACM,SAAS,qBAAqB,GAAG;AACxC,EAAE,MAAM,cAAc,GAAG,MAAM,EAAE,CAAC;AAClC,EAAE,MAAM,UAAU,GAAG,MAAM,EAAE,CAAC;AAC9B,EAAE,MAAM,GAAG,GAAG,UAAU,CAAC,cAAc,CAAC,CAAC;AACzC,EAAE,IAAI,CAAC,GAAG,EAAE;AACZ,IAAI,MAAM,IAAI,KAAK,CAAC,uDAAuD,CAAC,CAAC;AAC7E,GAAG;AACH,EAAE,MAAM,cAAc,GAAG,CAAC,KAAK,KAAK;AACpC,IAAI,GAAG,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;AAC9B,IAAI,cAAc,CAAC,OAAO,GAAG,iBAAiB,EAAE,CAAC;AACjD,IAAI,MAAM,CAAC,YAAY,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;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AC,EAAE,GAAG,cAAc,CAAC,OAAO,KAAK,IAAI,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;AAC/E,MAAM,MAAM,CAAC,YAAY,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;AAC9C,KAAK;AACL,IAAI,EAAE;AACN,GAAG,CAAC;AACJ,EAAE,OAAO;AACT,IAAI,WAAW,EAAE,GAAG,CAAC,WAAW;AAChC,IAAI,cAAc;AAClB,IAAI,gBAAgB;AACpB,IAAI,iBAAiB;AACrB,GAAG,CAAC;AACJ;;;;"}
@@ -9,17 +9,21 @@ function setColorSchemeAttribute(colorScheme, getRootElement) {
9
9
  function useProviderColorScheme({
10
10
  manager,
11
11
  defaultColorScheme,
12
- getRootElement
12
+ getRootElement,
13
+ forceColorScheme
13
14
  }) {
14
15
  const media = useRef();
15
16
  const [value, setValue] = useState(() => manager.get(defaultColorScheme));
17
+ const colorSchemeValue = forceColorScheme || value;
16
18
  const setColorScheme = useCallback(
17
19
  (colorScheme) => {
18
- setValue(colorScheme);
19
- setColorSchemeAttribute(colorScheme, getRootElement);
20
- manager.set(colorScheme);
20
+ if (!forceColorScheme) {
21
+ setColorSchemeAttribute(colorScheme, getRootElement);
22
+ setValue(colorScheme);
23
+ manager.set(colorScheme);
24
+ }
21
25
  },
22
- [manager.set, value]
26
+ [manager.set, colorSchemeValue, forceColorScheme]
23
27
  );
24
28
  const clearColorScheme = useCallback(() => {
25
29
  setValue(defaultColorScheme);
@@ -35,6 +39,11 @@ function useProviderColorScheme({
35
39
  }, []);
36
40
  useEffect(() => {
37
41
  var _a;
42
+ if (forceColorScheme) {
43
+ setColorSchemeAttribute(forceColorScheme, getRootElement);
44
+ return () => {
45
+ };
46
+ }
38
47
  media.current = window.matchMedia("(prefers-color-scheme: dark)");
39
48
  const listener = (event) => {
40
49
  if (value === "auto") {
@@ -47,7 +56,7 @@ function useProviderColorScheme({
47
56
  return (_a2 = media.current) == null ? void 0 : _a2.removeEventListener("change", listener);
48
57
  };
49
58
  }, [value]);
50
- return { colorScheme: value, setColorScheme, clearColorScheme };
59
+ return { colorScheme: colorSchemeValue, setColorScheme, clearColorScheme };
51
60
  }
52
61
 
53
62
  export { useProviderColorScheme };
@@ -1 +1 @@
1
- {"version":3,"file":"use-provider-color-scheme.js","sources":["../../../../src/core/MantineProvider/use-mantine-color-scheme/use-provider-color-scheme.ts"],"sourcesContent":["import { useCallback, useEffect, useRef, useState } from 'react';\nimport { useIsomorphicEffect } from '@mantine/hooks';\nimport type { MantineColorSchemeManager } from '../color-scheme-managers';\nimport type { MantineColorScheme } from '../theme.types';\n\nfunction setColorSchemeAttribute(\n colorScheme: MantineColorScheme,\n getRootElement: () => HTMLElement | undefined\n) {\n const computedColorScheme =\n colorScheme !== 'auto'\n ? colorScheme\n : window.matchMedia('(prefers-color-scheme: dark)').matches\n ? 'dark'\n : 'light';\n getRootElement()?.setAttribute('data-mantine-color-scheme', computedColorScheme);\n}\n\ntype MediaQueryCallback = (event: { matches: boolean; media: string }) => void;\n\ninterface UseProviderColorSchemeOptions {\n manager: MantineColorSchemeManager;\n defaultColorScheme: MantineColorScheme;\n getRootElement(): HTMLElement | undefined;\n}\n\nexport function useProviderColorScheme({\n manager,\n defaultColorScheme,\n getRootElement,\n}: UseProviderColorSchemeOptions) {\n const media = useRef<MediaQueryList>();\n const [value, setValue] = useState(() => manager.get(defaultColorScheme));\n\n const setColorScheme = useCallback(\n (colorScheme: MantineColorScheme) => {\n setValue(colorScheme);\n setColorSchemeAttribute(colorScheme, getRootElement);\n manager.set(colorScheme);\n },\n [manager.set, value]\n );\n\n const clearColorScheme = useCallback(() => {\n setValue(defaultColorScheme);\n setColorSchemeAttribute(defaultColorScheme, getRootElement);\n manager.clear();\n }, [manager.clear, defaultColorScheme]);\n\n useEffect(() => {\n manager.subscribe(setColorScheme);\n return manager.unsubscribe;\n }, [manager.subscribe, manager.unsubscribe]);\n\n useIsomorphicEffect(() => {\n setColorSchemeAttribute(manager.get(defaultColorScheme), getRootElement);\n }, []);\n\n useEffect(() => {\n media.current = window.matchMedia('(prefers-color-scheme: dark)');\n const listener: MediaQueryCallback = (event) => {\n if (value === 'auto') {\n setColorSchemeAttribute(event.matches ? 'dark' : 'light', getRootElement);\n }\n };\n\n media.current?.addEventListener('change', listener);\n return () => media.current?.removeEventListener('change', listener);\n }, [value]);\n\n return { colorScheme: value, setColorScheme, clearColorScheme };\n}\n"],"names":[],"mappings":";;;AAEA,SAAS,uBAAuB,CAAC,WAAW,EAAE,cAAc,EAAE;AAC9D,EAAE,IAAI,EAAE,CAAC;AACT,EAAE,MAAM,mBAAmB,GAAG,WAAW,KAAK,MAAM,GAAG,WAAW,GAAG,MAAM,CAAC,UAAU,CAAC,8BAA8B,CAAC,CAAC,OAAO,GAAG,MAAM,GAAG,OAAO,CAAC;AAClJ,EAAE,CAAC,EAAE,GAAG,cAAc,EAAE,KAAK,IAAI,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC,YAAY,CAAC,2BAA2B,EAAE,mBAAmB,CAAC,CAAC;AAC/G,CAAC;AACM,SAAS,sBAAsB,CAAC;AACvC,EAAE,OAAO;AACT,EAAE,kBAAkB;AACpB,EAAE,cAAc;AAChB,CAAC,EAAE;AACH,EAAE,MAAM,KAAK,GAAG,MAAM,EAAE,CAAC;AACzB,EAAE,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,MAAM,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC,CAAC;AAC5E,EAAE,MAAM,cAAc,GAAG,WAAW;AACpC,IAAI,CAAC,WAAW,KAAK;AACrB,MAAM,QAAQ,CAAC,WAAW,CAAC,CAAC;AAC5B,MAAM,uBAAuB,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC;AAC3D,MAAM,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;AAC/B,KAAK;AACL,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,KAAK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,OAAO,CAAC,GAAG,GAAG,KAAK,CAAC,OAAO,KAAK,IAAI,GAAG,KAAK,CAAC,GAAG,GAAG,CAAC,mBAAmB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;AAClG,KAAK,CAAC;AACN,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;AACd,EAAE,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,CAAC;AAClE;;;;"}
1
+ {"version":3,"file":"use-provider-color-scheme.js","sources":["../../../../src/core/MantineProvider/use-mantine-color-scheme/use-provider-color-scheme.ts"],"sourcesContent":["import { useCallback, useEffect, useRef, useState } from 'react';\nimport { useIsomorphicEffect } from '@mantine/hooks';\nimport type { MantineColorSchemeManager } from '../color-scheme-managers';\nimport type { MantineColorScheme } from '../theme.types';\n\nfunction setColorSchemeAttribute(\n colorScheme: MantineColorScheme,\n getRootElement: () => HTMLElement | undefined\n) {\n const computedColorScheme =\n colorScheme !== 'auto'\n ? colorScheme\n : window.matchMedia('(prefers-color-scheme: dark)').matches\n ? 'dark'\n : 'light';\n getRootElement()?.setAttribute('data-mantine-color-scheme', computedColorScheme);\n}\n\ntype MediaQueryCallback = (event: { matches: boolean; media: string }) => void;\n\ninterface UseProviderColorSchemeOptions {\n manager: MantineColorSchemeManager;\n defaultColorScheme: MantineColorScheme;\n forceColorScheme: 'light' | 'dark' | undefined;\n getRootElement(): HTMLElement | undefined;\n}\n\nexport function useProviderColorScheme({\n manager,\n defaultColorScheme,\n getRootElement,\n forceColorScheme,\n}: UseProviderColorSchemeOptions) {\n const media = useRef<MediaQueryList>();\n const [value, setValue] = useState(() => manager.get(defaultColorScheme));\n const colorSchemeValue = forceColorScheme || value;\n\n const setColorScheme = useCallback(\n (colorScheme: MantineColorScheme) => {\n if (!forceColorScheme) {\n setColorSchemeAttribute(colorScheme, getRootElement);\n setValue(colorScheme);\n manager.set(colorScheme);\n }\n },\n [manager.set, colorSchemeValue, forceColorScheme]\n );\n\n const clearColorScheme = useCallback(() => {\n setValue(defaultColorScheme);\n setColorSchemeAttribute(defaultColorScheme, getRootElement);\n manager.clear();\n }, [manager.clear, defaultColorScheme]);\n\n useEffect(() => {\n manager.subscribe(setColorScheme);\n return manager.unsubscribe;\n }, [manager.subscribe, manager.unsubscribe]);\n\n useIsomorphicEffect(() => {\n setColorSchemeAttribute(manager.get(defaultColorScheme), getRootElement);\n }, []);\n\n useEffect(() => {\n if (forceColorScheme) {\n setColorSchemeAttribute(forceColorScheme, getRootElement);\n return () => {};\n }\n\n media.current = window.matchMedia('(prefers-color-scheme: dark)');\n const listener: MediaQueryCallback = (event) => {\n if (value === 'auto') {\n setColorSchemeAttribute(event.matches ? 'dark' : 'light', getRootElement);\n }\n };\n\n media.current?.addEventListener('change', listener);\n return () => media.current?.removeEventListener('change', listener);\n }, [value]);\n\n return { colorScheme: colorSchemeValue, setColorScheme, clearColorScheme };\n}\n"],"names":[],"mappings":";;;AAEA,SAAS,uBAAuB,CAAC,WAAW,EAAE,cAAc,EAAE;AAC9D,EAAE,IAAI,EAAE,CAAC;AACT,EAAE,MAAM,mBAAmB,GAAG,WAAW,KAAK,MAAM,GAAG,WAAW,GAAG,MAAM,CAAC,UAAU,CAAC,8BAA8B,CAAC,CAAC,OAAO,GAAG,MAAM,GAAG,OAAO,CAAC;AAClJ,EAAE,CAAC,EAAE,GAAG,cAAc,EAAE,KAAK,IAAI,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC,YAAY,CAAC,2BAA2B,EAAE,mBAAmB,CAAC,CAAC;AAC/G,CAAC;AACM,SAAS,sBAAsB,CAAC;AACvC,EAAE,OAAO;AACT,EAAE,kBAAkB;AACpB,EAAE,cAAc;AAChB,EAAE,gBAAgB;AAClB,CAAC,EAAE;AACH,EAAE,MAAM,KAAK,GAAG,MAAM,EAAE,CAAC;AACzB,EAAE,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,MAAM,OAAO,CAAC,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B,CAAC,gBAAgB,EAAE,cAAc,CAAC,CAAC;AAChE,MAAM,OAAO,MAAM;AACnB,OAAO,CAAC;AACR,KAAK;AACL,IAAI,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC,UAAU,CAAC,8BAA8B,CAAC,CAAC;AACtE,IAAI,MAAM,QAAQ,GAAG,CAAC,KAAK,KAAK;AAChC,MAAM,IAAI,KAAK,KAAK,MAAM,EAAE;AAC5B,QAAQ,uBAAuB,CAAC,KAAK,CAAC,OAAO,GAAG,MAAM,GAAG,OAAO,EAAE,cAAc,CAAC,CAAC;AAClF,OAAO;AACP,KAAK,CAAC;AACN,IAAI,CAAC,EAAE,GAAG,KAAK,CAAC,OAAO,KAAK,IAAI,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;AACpF,IAAI,OAAO,MAAM;AACjB,MAAM,IAAI,GAAG,CAAC;AACd,MAAM,OAAO,CAAC,GAAG,GAAG,KAAK,CAAC,OAAO,KAAK,IAAI,GAAG,KAAK,CAAC,GAAG,GAAG,CAAC,mBAAmB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;AAClG,KAAK,CAAC;AACN,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;AACd,EAAE,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,cAAc,EAAE,gBAAgB,EAAE,CAAC;AAC7E;;;;"}
@@ -1,6 +1,9 @@
1
1
  import type { GridColProps } from './GridCol';
2
- interface GridColVariablesProps extends GridColProps {
2
+ interface GridColVariablesProps {
3
3
  selector: string;
4
+ span: GridColProps['span'] | undefined;
5
+ order?: GridColProps['order'] | undefined;
6
+ offset?: GridColProps['offset'] | undefined;
4
7
  }
5
8
  export declare function GridColVariables({ span, order, offset, selector }: GridColVariablesProps): import("react/jsx-runtime").JSX.Element;
6
9
  export {};
@@ -10,17 +10,18 @@ interface BaseProps extends __BaseInputProps, BoxProps, StylesApiProps<{
10
10
  __stylesApiProps?: Record<string, any>;
11
11
  id?: string;
12
12
  }
13
- export declare function useInputProps<T extends BaseProps, U extends Partial<T>>(component: string, defaultProps: U, _props: T): Omit<T & { [Key in Extract<keyof T, never>]-?: {}[Key] | NonNullable<T[Key]>; }, "size" | "className" | "style" | "label" | "variant" | "styles" | "id" | "unstyled" | "classNames" | "vars" | "required" | "error" | "description" | "__staticSelector" | "__stylesApiProps" | "withAsterisk" | "labelProps" | "descriptionProps" | "errorProps" | "inputContainer" | "inputWrapperOrder" | "wrapperProps"> & {
13
+ export declare function useInputProps<T extends BaseProps, U extends Partial<T>>(component: string, defaultProps: U, _props: T): Omit<T & { [Key in Extract<keyof T, never>]-?: {}[Key] | NonNullable<T[Key]>; }, "style" | "label" | "variant" | "id" | "unstyled" | "classNames" | "styles" | "vars" | "className" | "__staticSelector" | "required" | "description" | "error" | "size" | "withAsterisk" | "labelProps" | "descriptionProps" | "errorProps" | "inputContainer" | "inputWrapperOrder" | "wrapperProps" | "__stylesApiProps"> & {
14
14
  classNames: Partial<Record<string, string>> | ((theme: import("../../core").MantineTheme, props: any, ctx: unknown) => Partial<Record<string, string>>) | undefined;
15
15
  styles: Partial<Record<string, import("react").CSSProperties>> | ((theme: import("../../core").MantineTheme, props: any, ctx: unknown) => Partial<Record<string, import("react").CSSProperties>>) | undefined;
16
16
  unstyled: boolean | undefined;
17
17
  wrapperProps: {
18
- color?: string | undefined;
19
- className: string | undefined;
20
18
  style: import("../../core").MantineStyleProp;
21
19
  slot?: string | undefined;
22
20
  title?: string | undefined;
23
21
  children?: import("react").ReactNode;
22
+ dir?: string | undefined;
23
+ onChange?: import("react").FormEventHandler<HTMLDivElement> | undefined;
24
+ id?: string | undefined;
24
25
  key?: import("react").Key | null | undefined;
25
26
  defaultChecked?: boolean | undefined;
26
27
  defaultValue?: string | number | readonly string[] | undefined;
@@ -28,12 +29,11 @@ export declare function useInputProps<T extends BaseProps, U extends Partial<T>>
28
29
  suppressHydrationWarning?: boolean | undefined;
29
30
  accessKey?: string | undefined;
30
31
  autoFocus?: boolean | undefined;
32
+ className: string | undefined;
31
33
  contentEditable?: "inherit" | (boolean | "true" | "false") | undefined;
32
34
  contextMenu?: string | undefined;
33
- dir?: string | undefined;
34
35
  draggable?: (boolean | "true" | "false") | undefined;
35
36
  hidden?: boolean | undefined;
36
- id?: string | undefined;
37
37
  lang?: string | undefined;
38
38
  nonce?: string | undefined;
39
39
  placeholder?: string | undefined;
@@ -56,6 +56,7 @@ export declare function useInputProps<T extends BaseProps, U extends Partial<T>>
56
56
  autoCapitalize?: string | undefined;
57
57
  autoCorrect?: string | undefined;
58
58
  autoSave?: string | undefined;
59
+ color?: string | undefined;
59
60
  itemProp?: string | undefined;
60
61
  itemScope?: boolean | undefined;
61
62
  itemType?: string | undefined;
@@ -68,7 +69,7 @@ export declare function useInputProps<T extends BaseProps, U extends Partial<T>>
68
69
  is?: string | undefined;
69
70
  'aria-activedescendant'?: string | undefined;
70
71
  'aria-atomic'?: (boolean | "true" | "false") | undefined;
71
- 'aria-autocomplete'?: "none" | "inline" | "list" | "both" | undefined;
72
+ 'aria-autocomplete'?: "list" | "none" | "inline" | "both" | undefined;
72
73
  'aria-braillelabel'?: string | undefined;
73
74
  'aria-brailleroledescription'?: string | undefined;
74
75
  'aria-busy'?: (boolean | "true" | "false") | undefined;
@@ -78,7 +79,7 @@ export declare function useInputProps<T extends BaseProps, U extends Partial<T>>
78
79
  'aria-colindextext'?: string | undefined;
79
80
  'aria-colspan'?: number | undefined;
80
81
  'aria-controls'?: string | undefined;
81
- 'aria-current'?: boolean | "time" | "true" | "false" | "page" | "step" | "location" | "date" | undefined;
82
+ 'aria-current'?: boolean | "time" | "true" | "step" | "false" | "page" | "location" | "date" | undefined;
82
83
  'aria-describedby'?: string | undefined;
83
84
  'aria-description'?: string | undefined;
84
85
  'aria-details'?: string | undefined;
@@ -88,7 +89,7 @@ export declare function useInputProps<T extends BaseProps, U extends Partial<T>>
88
89
  'aria-expanded'?: (boolean | "true" | "false") | undefined;
89
90
  'aria-flowto'?: string | undefined;
90
91
  'aria-grabbed'?: (boolean | "true" | "false") | undefined;
91
- 'aria-haspopup'?: boolean | "dialog" | "menu" | "grid" | "true" | "false" | "listbox" | "tree" | undefined;
92
+ 'aria-haspopup'?: boolean | "dialog" | "menu" | "true" | "grid" | "false" | "listbox" | "tree" | undefined;
92
93
  'aria-hidden'?: (boolean | "true" | "false") | undefined;
93
94
  'aria-invalid'?: boolean | "true" | "false" | "grammar" | "spelling" | undefined;
94
95
  'aria-keyshortcuts'?: string | undefined;
@@ -105,7 +106,7 @@ export declare function useInputProps<T extends BaseProps, U extends Partial<T>>
105
106
  'aria-posinset'?: number | undefined;
106
107
  'aria-pressed'?: boolean | "true" | "false" | "mixed" | undefined;
107
108
  'aria-readonly'?: (boolean | "true" | "false") | undefined;
108
- 'aria-relevant'?: "text" | "additions" | "additions removals" | "additions text" | "all" | "removals" | "removals additions" | "removals text" | "text additions" | "text removals" | undefined;
109
+ 'aria-relevant'?: "text" | "all" | "additions" | "additions removals" | "additions text" | "removals" | "removals additions" | "removals text" | "text additions" | "text removals" | undefined;
109
110
  'aria-required'?: (boolean | "true" | "false") | undefined;
110
111
  'aria-roledescription'?: string | undefined;
111
112
  'aria-rowcount'?: number | undefined;
@@ -138,7 +139,6 @@ export declare function useInputProps<T extends BaseProps, U extends Partial<T>>
138
139
  onFocusCapture?: import("react").FocusEventHandler<HTMLDivElement> | undefined;
139
140
  onBlur?: import("react").FocusEventHandler<HTMLDivElement> | undefined;
140
141
  onBlurCapture?: import("react").FocusEventHandler<HTMLDivElement> | undefined;
141
- onChange?: import("react").FormEventHandler<HTMLDivElement> | undefined;
142
142
  onChangeCapture?: import("react").FormEventHandler<HTMLDivElement> | undefined;
143
143
  onBeforeInput?: import("react").FormEventHandler<HTMLDivElement> | undefined;
144
144
  onBeforeInputCapture?: import("react").FormEventHandler<HTMLDivElement> | undefined;
@@ -296,9 +296,9 @@ export declare function useInputProps<T extends BaseProps, U extends Partial<T>>
296
296
  descriptionProps: Record<string, any> | undefined;
297
297
  unstyled: boolean | undefined;
298
298
  styles: Partial<Record<string, import("react").CSSProperties>> | ((theme: import("../../core").MantineTheme, props: any, ctx: unknown) => Partial<Record<string, import("react").CSSProperties>>) | undefined;
299
- size: import("../../core").MantineSize | (string & {}) | undefined;
299
+ size: (string & {}) | import("../../core").MantineSize | undefined;
300
300
  inputContainer: ((children: import("react").ReactNode) => import("react").ReactNode) | undefined;
301
- inputWrapperOrder: ("input" | "label" | "error" | "description")[] | undefined;
301
+ inputWrapperOrder: ("input" | "label" | "description" | "error")[] | undefined;
302
302
  withAsterisk: boolean | undefined;
303
303
  variant: string | undefined;
304
304
  } & BoxProps;
@@ -307,7 +307,7 @@ export declare function useInputProps<T extends BaseProps, U extends Partial<T>>
307
307
  classNames: Partial<Record<string, string>> | ((theme: import("../../core").MantineTheme, props: any, ctx: unknown) => Partial<Record<string, string>>) | undefined;
308
308
  styles: Partial<Record<string, import("react").CSSProperties>> | ((theme: import("../../core").MantineTheme, props: any, ctx: unknown) => Partial<Record<string, import("react").CSSProperties>>) | undefined;
309
309
  unstyled: boolean | undefined;
310
- size: import("../../core").MantineSize | (string & {}) | undefined;
310
+ size: (string & {}) | import("../../core").MantineSize | undefined;
311
311
  __staticSelector: string | undefined;
312
312
  __stylesApiProps: Record<string, any>;
313
313
  error: import("react").ReactNode;
@@ -42,6 +42,16 @@ export interface MenuProps extends __PopoverProps, StylesApiProps<MenuFactory> {
42
42
  }
43
43
  export declare function Menu(_props: MenuProps): import("react/jsx-runtime").JSX.Element;
44
44
  export declare namespace Menu {
45
+ var extend: (input: import("../../core/factory/factory").ExtendsRootComponent<{
46
+ props: MenuProps;
47
+ ref: HTMLDivElement;
48
+ stylesNames: MenuStylesNames;
49
+ }>) => import("../../core/factory/factory").ExtendsRootComponent<{
50
+ props: MenuProps;
51
+ ref: HTMLDivElement;
52
+ stylesNames: MenuStylesNames;
53
+ }>;
54
+ var classes: Record<string, string>;
45
55
  var displayName: string;
46
56
  var Item: (<C = "button">(props: import("../../core/factory/create-polymorphic-component").PolymorphicComponentProps<C, import("./MenuItem/MenuItem").MenuItemProps>) => React.ReactElement<any, string | React.JSXElementConstructor<any>>) & Omit<React.FunctionComponent<(import("./MenuItem/MenuItem").MenuItemProps & {
47
57
  component?: any;
@@ -48,7 +48,7 @@ export type NavLinkFactory = PolymorphicFactory<{
48
48
  }>;
49
49
  export declare const NavLink: (<C = "a">(props: import("../../core/factory/create-polymorphic-component").PolymorphicComponentProps<C, NavLinkProps>) => React.ReactElement<any, string | React.JSXElementConstructor<any>>) & Omit<React.FunctionComponent<(NavLinkProps & {
50
50
  component?: any;
51
- } & Omit<Omit<any, "ref">, keyof NavLinkProps | "component"> & {
51
+ } & Omit<Omit<any, "ref">, "component" | keyof NavLinkProps> & {
52
52
  ref?: any;
53
53
  }) | (NavLinkProps & {
54
54
  component: React.ElementType<any>;
@@ -1,8 +1,8 @@
1
1
  import React from 'react';
2
2
  import { StylesApiProps, ElementProps, Factory } from '../../core';
3
3
  import { InputBaseProps } from '../InputBase';
4
- import { InputVariant } from '../Input';
5
- export type PasswordInputStylesNames = 'root' | 'visibilityToggle' | 'innerInput';
4
+ import { InputVariant, __InputStylesNames } from '../Input';
5
+ export type PasswordInputStylesNames = 'root' | 'visibilityToggle' | 'innerInput' | __InputStylesNames;
6
6
  export type PasswordInputCssVariables = {
7
7
  root: '--psi-icon-size' | '--psi-button-size';
8
8
  };
@@ -1,7 +1,8 @@
1
1
  import React from 'react';
2
2
  import type { MantineColorScheme } from '../theme.types';
3
3
  export interface ColorSchemeScriptProps extends React.ComponentPropsWithoutRef<'script'> {
4
+ forceColorScheme?: 'light' | 'dark';
4
5
  defaultColorScheme?: MantineColorScheme;
5
6
  localStorageKey?: string;
6
7
  }
7
- export declare function ColorSchemeScript({ defaultColorScheme, localStorageKey, ...others }: ColorSchemeScriptProps): import("react/jsx-runtime").JSX.Element;
8
+ export declare function ColorSchemeScript({ defaultColorScheme, localStorageKey, forceColorScheme, ...others }: ColorSchemeScriptProps): import("react/jsx-runtime").JSX.Element;
@@ -10,6 +10,8 @@ export interface MantineProviderProps {
10
10
  colorSchemeManager?: MantineColorSchemeManager;
11
11
  /** Default color scheme value used when `colorSchemeManager` cannot retrieve value from external storage, `auto` by default */
12
12
  defaultColorScheme?: MantineColorScheme;
13
+ /** Forces color scheme value, if set, MantineProvider ignores `colorSchemeManager` and `defaultColorScheme` */
14
+ forceColorScheme?: 'light' | 'dark';
13
15
  /** CSS selector to which CSS variables should be added, `:root` by default */
14
16
  cssVariablesSelector?: string;
15
17
  /** Determines whether theme CSS variables should be added to given `cssVariablesSelector`, `true` by default */
@@ -25,7 +27,7 @@ export interface MantineProviderProps {
25
27
  /** Your application */
26
28
  children?: React.ReactNode;
27
29
  }
28
- export declare function MantineProvider({ theme, children, getStyleNonce, withCssVariables, cssVariablesSelector, classNamesPrefix, colorSchemeManager, defaultColorScheme, getRootElement, cssVariablesResolver, }: MantineProviderProps): import("react/jsx-runtime").JSX.Element;
30
+ export declare function MantineProvider({ theme, children, getStyleNonce, withCssVariables, cssVariablesSelector, classNamesPrefix, colorSchemeManager, defaultColorScheme, getRootElement, cssVariablesResolver, forceColorScheme, }: MantineProviderProps): import("react/jsx-runtime").JSX.Element;
29
31
  export declare namespace MantineProvider {
30
32
  var displayName: string;
31
33
  }
@@ -1,2 +1,2 @@
1
1
  import { UseMediaQueryOptions } from '@mantine/hooks';
2
- export declare function useComputedColorScheme(defaultValue: 'light' | 'dark', options?: UseMediaQueryOptions): "dark" | "light";
2
+ export declare function useComputedColorScheme(defaultValue: 'light' | 'dark', options?: UseMediaQueryOptions): "light" | "dark";
@@ -3,4 +3,5 @@ export declare function useMantineColorScheme(): {
3
3
  colorScheme: MantineColorScheme;
4
4
  setColorScheme: (value: MantineColorScheme) => void;
5
5
  clearColorScheme: () => void;
6
+ toggleColorScheme: () => void;
6
7
  };
@@ -3,9 +3,10 @@ import type { MantineColorScheme } from '../theme.types';
3
3
  interface UseProviderColorSchemeOptions {
4
4
  manager: MantineColorSchemeManager;
5
5
  defaultColorScheme: MantineColorScheme;
6
+ forceColorScheme: 'light' | 'dark' | undefined;
6
7
  getRootElement(): HTMLElement | undefined;
7
8
  }
8
- export declare function useProviderColorScheme({ manager, defaultColorScheme, getRootElement, }: UseProviderColorSchemeOptions): {
9
+ export declare function useProviderColorScheme({ manager, defaultColorScheme, getRootElement, forceColorScheme, }: UseProviderColorSchemeOptions): {
9
10
  colorScheme: MantineColorScheme;
10
11
  setColorScheme: (colorScheme: MantineColorScheme) => void;
11
12
  clearColorScheme: () => void;
package/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "@mantine/core",
3
3
  "description": "React components library focused on usability, accessibility and developer experience",
4
- "version": "7.0.0-beta.0",
4
+ "version": "7.0.0-beta.1",
5
5
  "types": "./lib/index.d.ts",
6
+ "module": "./esm/index.js",
6
7
  "exports": {
7
8
  ".": {
8
9
  "import": "./esm/index.js",
@@ -35,7 +36,7 @@
35
36
  "design"
36
37
  ],
37
38
  "peerDependencies": {
38
- "@mantine/hooks": "7.0.0-beta.0",
39
+ "@mantine/hooks": "7.0.0-beta.1",
39
40
  "react": "^18.2.0",
40
41
  "react-dom": "^18.2.0"
41
42
  },