@mirohq/design-system-theme-provider 0.2.16 → 0.2.18
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.
- package/dist/main.js.map +1 -1
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts +2 -2
- package/package.json +3 -3
package/dist/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.js","sources":["../src/theme-provider.tsx"],"sourcesContent":["import type { PropsWithChildren } from 'react'\nimport
|
|
1
|
+
{"version":3,"file":"main.js","sources":["../src/theme-provider.tsx"],"sourcesContent":["import type { PropsWithChildren } from 'react'\nimport React from 'react'\nimport { createTheme, stitchesCssRoot } from '@mirohq/design-system-stitches'\nimport { useTheme } from '@mirohq/design-system-use-theme'\nimport type { Theme } from '@mirohq/design-system-themes'\n\ninterface ThemesProp {\n [Key: string]: Partial<Theme>\n}\n\nexport interface ThemeProviderProps<Themes extends ThemesProp = ThemesProp> {\n /**\n * The default theme to use if no theme is provided.\n */\n defaultTheme?: keyof Themes\n\n /**\n * Theme config for all available themes.\n */\n themes?: Themes\n}\n\nexport const ThemeProvider = <Themes extends ThemesProp = ThemesProp>({\n defaultTheme,\n themes,\n children,\n}: PropsWithChildren<ThemeProviderProps<Themes>>): JSX.Element => {\n let themeToUse = ''\n const { theme } = useTheme()\n\n const defaultThemeExists =\n defaultTheme !== undefined && themes?.[defaultTheme] !== undefined\n\n const currentThemeExists = theme != null && themes?.[theme] !== undefined\n\n if (!currentThemeExists && defaultThemeExists) {\n console.warn('Set theme not found, setting the default theme.')\n themeToUse = defaultTheme.toString()\n }\n\n if (!defaultThemeExists && theme == null) {\n console.warn(\n 'Default theme not found, falling back to the Miro Design System basics.'\n )\n }\n\n if (currentThemeExists) {\n themeToUse = theme\n }\n\n const classNameTheme =\n (currentThemeExists || defaultThemeExists) && themeToUse !== ''\n ? createTheme(themes[themeToUse])\n : ''\n\n return (\n <div\n data-theme-provider\n className={`${stitchesC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,MACnB,SAAW,EAAA,EAAA,CAAG,MAAgB,CAAAC,oCAAA,CAAA,SAAA,EAAS,GAAI,CAAA,CAAA,MAAA,CAAA,cAAA,CAAA;AAAA,MAE1C,QAAA;AAAA,KAAA;AAAA,GACH,CAAA;AAEJ;;;;"}
|
package/dist/module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.js","sources":["../src/theme-provider.tsx"],"sourcesContent":["import type { PropsWithChildren } from 'react'\nimport
|
|
1
|
+
{"version":3,"file":"module.js","sources":["../src/theme-provider.tsx"],"sourcesContent":["import type { PropsWithChildren } from 'react'\nimport React from 'react'\nimport { createTheme, stitchesCssRoot } from '@mirohq/design-system-stitches'\nimport { useTheme } from '@mirohq/design-system-use-theme'\nimport type { Theme } from '@mirohq/design-system-themes'\n\ninterface ThemesProp {\n [Key: string]: Partial<Theme>\n}\n\nexport interface ThemeProviderProps<Themes extends ThemesProp = ThemesProp> {\n /**\n * The default theme to use if no theme is provided.\n */\n defaultTheme?: keyof Themes\n\n /**\n * Theme config for all available themes.\n */\n themes?: Themes\n}\n\nexport const ThemeProvider = <Themes extends ThemesProp = ThemesProp>({\n defaultTheme,\n themes,\n children,\n}: PropsWithChildren<ThemeProviderProps<Themes>>): JSX.Element => {\n let themeToUse = ''\n const { theme } = useTheme()\n\n const defaultThemeExists =\n defaultTheme !== undefined && themes?.[defaultTheme] !== undefined\n\n const currentThemeExists = theme != null && themes?.[theme] !== undefined\n\n if (!currentThemeExists && defaultThemeExists) {\n console.warn('Set theme not found, setting the default theme.')\n themeToUse = defaultTheme.toString()\n }\n\n if (!defaultThemeExists && theme == null) {\n console.warn(\n 'Default theme not found, falling back to the Miro Design System basics.'\n )\n }\n\n if (currentThemeExists) {\n themeToUse = theme\n }\n\n const classNameTheme =\n (currentThemeExists || defaultThemeExists) && themeToUse !== ''\n ? createTheme(themes[themeToUse])\n : ''\n\n return (\n <div\n data-theme-provider\n className={`${stitchesCssRoot.className} ${classNameTheme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AAA,EAAS,GAAI,CAAA,CAAA,MAAA,CAAA,cAAA,CAAA;AAAA,MAE1C,QAAA;AAAA,KAAA;AAAA,GACH,CAAA;AAEJ;;;;"}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { PropsWithChildren } from 'react';
|
|
2
|
-
import
|
|
2
|
+
import { Theme } from '@mirohq/design-system-themes';
|
|
3
3
|
|
|
4
4
|
interface ThemesProp {
|
|
5
|
-
[Key: string]: Partial<
|
|
5
|
+
[Key: string]: Partial<Theme>;
|
|
6
6
|
}
|
|
7
7
|
interface ThemeProviderProps<Themes extends ThemesProp = ThemesProp> {
|
|
8
8
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mirohq/design-system-theme-provider",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.18",
|
|
4
4
|
"author": "Miro",
|
|
5
5
|
"source": "src/index.ts",
|
|
6
6
|
"main": "dist/main.js",
|
|
@@ -25,9 +25,9 @@
|
|
|
25
25
|
"react": "^16.14 || ^17 || ^18"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@mirohq/design-system-stitches": "^2.3.
|
|
29
|
-
"@mirohq/design-system-themes": "^0.1.17",
|
|
28
|
+
"@mirohq/design-system-stitches": "^2.3.6",
|
|
30
29
|
"@mirohq/design-system-types": "^0.6.0",
|
|
30
|
+
"@mirohq/design-system-themes": "^0.2.1",
|
|
31
31
|
"@mirohq/design-system-use-theme": "^0.2.8"
|
|
32
32
|
},
|
|
33
33
|
"scripts": {
|