@mirohq/design-system-theme-provider 0.2.13 → 0.2.14
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 +9 -9
- package/dist/main.js.map +1 -1
- package/dist/module.js +9 -5
- package/dist/module.js.map +1 -1
- package/package.json +5 -5
package/dist/main.js
CHANGED
|
@@ -2,14 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
6
6
|
var designSystemStitches = require('@mirohq/design-system-stitches');
|
|
7
7
|
var designSystemUseTheme = require('@mirohq/design-system-use-theme');
|
|
8
8
|
|
|
9
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
10
|
-
|
|
11
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
12
|
-
|
|
13
9
|
const ThemeProvider = ({
|
|
14
10
|
defaultTheme,
|
|
15
11
|
themes,
|
|
@@ -32,10 +28,14 @@ const ThemeProvider = ({
|
|
|
32
28
|
themeToUse = theme;
|
|
33
29
|
}
|
|
34
30
|
const classNameTheme = (currentThemeExists || defaultThemeExists) && themeToUse !== "" ? designSystemStitches.createTheme(themes[themeToUse]) : "";
|
|
35
|
-
return /* @__PURE__ */
|
|
36
|
-
"
|
|
37
|
-
|
|
38
|
-
|
|
31
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
32
|
+
"div",
|
|
33
|
+
{
|
|
34
|
+
"data-theme-provider": true,
|
|
35
|
+
className: "".concat(designSystemStitches.stitchesCssRoot.className, " ").concat(classNameTheme),
|
|
36
|
+
children
|
|
37
|
+
}
|
|
38
|
+
);
|
|
39
39
|
};
|
|
40
40
|
|
|
41
41
|
exports.ThemeProvider = ThemeProvider;
|
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 type * as themes from '@mirohq/design-system-themes'\nimport React from 'react'\nimport { createTheme, stitchesCssRoot } from '@mirohq/design-system-stitches'\nimport { useTheme } from '@mirohq/design-system-use-theme'\n\ninterface ThemesProp {\n [Key: string]: Partial<typeof themes.base>\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}`}\n >\n {children}\n </div>\n )\n}\n"],"names":["useTheme","createTheme","
|
|
1
|
+
{"version":3,"file":"main.js","sources":["../src/theme-provider.tsx"],"sourcesContent":["import type { PropsWithChildren } from 'react'\nimport type * as themes from '@mirohq/design-system-themes'\nimport React from 'react'\nimport { createTheme, stitchesCssRoot } from '@mirohq/design-system-stitches'\nimport { useTheme } from '@mirohq/design-system-use-theme'\n\ninterface ThemesProp {\n [Key: string]: Partial<typeof themes.base>\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}`}\n >\n {children}\n </div>\n )\n}\n"],"names":["useTheme","createTheme","jsx","stitchesCssRoot"],"mappings":";;;;;;;;AAsBO,MAAM,gBAAgB,CAAyC;AAAA,EACpE,YAAA;AAAA,EACA,MAAA;AAAA,EACA,QAAA;AACF,CAAkE,KAAA;AAChE,EAAA,IAAI,UAAa,GAAA,EAAA,CAAA;AACjB,EAAM,MAAA,EAAE,KAAM,EAAA,GAAIA,6BAAS,EAAA,CAAA;AAE3B,EAAA,MAAM,kBACJ,GAAA,YAAA,KAAiB,KAAa,CAAA,IAAA,CAAA,MAAA,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,MAAA,CAAS,YAAkB,CAAA,MAAA,KAAA,CAAA,CAAA;AAE3D,EAAA,MAAM,kBAAqB,GAAA,KAAA,IAAS,IAAQ,IAAA,CAAA,MAAA,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,MAAA,CAAS,KAAW,CAAA,MAAA,KAAA,CAAA,CAAA;AAEhE,EAAI,IAAA,CAAC,sBAAsB,kBAAoB,EAAA;AAC7C,IAAA,OAAA,CAAQ,KAAK,iDAAiD,CAAA,CAAA;AAC9D,IAAA,UAAA,GAAa,aAAa,QAAS,EAAA,CAAA;AAAA,GACrC;AAEA,EAAI,IAAA,CAAC,kBAAsB,IAAA,KAAA,IAAS,IAAM,EAAA;AACxC,IAAQ,OAAA,CAAA,IAAA;AAAA,MACN,yEAAA;AAAA,KACF,CAAA;AAAA,GACF;AAEA,EAAA,IAAI,kBAAoB,EAAA;AACtB,IAAa,UAAA,GAAA,KAAA,CAAA;AAAA,GACf;AAEA,EAAM,MAAA,cAAA,GAAA,CACH,sBAAsB,kBAAuB,KAAA,UAAA,KAAe,KACzDC,gCAAY,CAAA,MAAA,CAAO,UAAU,CAAC,CAC9B,GAAA,EAAA,CAAA;AAEN,EACE,uBAAAC,cAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,qBAAmB,EAAA,IAAA;AAAA,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
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { createTheme, stitchesCssRoot } from '@mirohq/design-system-stitches';
|
|
3
3
|
import { useTheme } from '@mirohq/design-system-use-theme';
|
|
4
4
|
|
|
@@ -24,10 +24,14 @@ const ThemeProvider = ({
|
|
|
24
24
|
themeToUse = theme;
|
|
25
25
|
}
|
|
26
26
|
const classNameTheme = (currentThemeExists || defaultThemeExists) && themeToUse !== "" ? createTheme(themes[themeToUse]) : "";
|
|
27
|
-
return /* @__PURE__ */
|
|
28
|
-
"
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
return /* @__PURE__ */ jsx(
|
|
28
|
+
"div",
|
|
29
|
+
{
|
|
30
|
+
"data-theme-provider": true,
|
|
31
|
+
className: "".concat(stitchesCssRoot.className, " ").concat(classNameTheme),
|
|
32
|
+
children
|
|
33
|
+
}
|
|
34
|
+
);
|
|
31
35
|
};
|
|
32
36
|
|
|
33
37
|
export { ThemeProvider };
|
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 type * as themes from '@mirohq/design-system-themes'\nimport React from 'react'\nimport { createTheme, stitchesCssRoot } from '@mirohq/design-system-stitches'\nimport { useTheme } from '@mirohq/design-system-use-theme'\n\ninterface ThemesProp {\n [Key: string]: Partial<typeof themes.base>\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}`}\n >\n {children}\n </div>\n )\n}\n"],"names":[],"mappings":";;;;AAsBO,MAAM,gBAAgB,CAAyC;AAAA,EACpE,YAAA;AAAA,EACA,MAAA;AAAA,EACA,QAAA;AACF,CAAkE,KAAA;AAChE,EAAA,IAAI,UAAa,GAAA,EAAA,CAAA;AACjB,EAAM,MAAA,EAAE,KAAM,EAAA,GAAI,QAAS,EAAA,CAAA;AAE3B,EAAA,MAAM,kBACJ,GAAA,YAAA,KAAiB,KAAa,CAAA,IAAA,CAAA,MAAA,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,MAAA,CAAS,YAAkB,CAAA,MAAA,KAAA,CAAA,CAAA;AAE3D,EAAA,MAAM,kBAAqB,GAAA,KAAA,IAAS,IAAQ,IAAA,CAAA,MAAA,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,MAAA,CAAS,KAAW,CAAA,MAAA,KAAA,CAAA,CAAA;AAEhE,EAAI,IAAA,CAAC,sBAAsB,kBAAoB,EAAA;AAC7C,IAAA,OAAA,CAAQ,KAAK,iDAAiD,CAAA,CAAA;AAC9D,IAAA,UAAA,GAAa,aAAa,QAAS,EAAA,CAAA;AAAA,GACrC;AAEA,EAAI,IAAA,CAAC,kBAAsB,IAAA,KAAA,IAAS,IAAM,EAAA;AACxC,IAAQ,OAAA,CAAA,IAAA;AAAA,MACN,yEAAA;AAAA,KACF,CAAA;AAAA,GACF;AAEA,EAAA,IAAI,kBAAoB,EAAA;AACtB,IAAa,UAAA,GAAA,KAAA,CAAA;AAAA,GACf;AAEA,EAAM,MAAA,cAAA,GAAA,CACH,sBAAsB,kBAAuB,KAAA,UAAA,KAAe,KACzD,WAAY,CAAA,MAAA,CAAO,
|
|
1
|
+
{"version":3,"file":"module.js","sources":["../src/theme-provider.tsx"],"sourcesContent":["import type { PropsWithChildren } from 'react'\nimport type * as themes from '@mirohq/design-system-themes'\nimport React from 'react'\nimport { createTheme, stitchesCssRoot } from '@mirohq/design-system-stitches'\nimport { useTheme } from '@mirohq/design-system-use-theme'\n\ninterface ThemesProp {\n [Key: string]: Partial<typeof themes.base>\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}`}\n >\n {children}\n </div>\n )\n}\n"],"names":[],"mappings":";;;;AAsBO,MAAM,gBAAgB,CAAyC;AAAA,EACpE,YAAA;AAAA,EACA,MAAA;AAAA,EACA,QAAA;AACF,CAAkE,KAAA;AAChE,EAAA,IAAI,UAAa,GAAA,EAAA,CAAA;AACjB,EAAM,MAAA,EAAE,KAAM,EAAA,GAAI,QAAS,EAAA,CAAA;AAE3B,EAAA,MAAM,kBACJ,GAAA,YAAA,KAAiB,KAAa,CAAA,IAAA,CAAA,MAAA,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,MAAA,CAAS,YAAkB,CAAA,MAAA,KAAA,CAAA,CAAA;AAE3D,EAAA,MAAM,kBAAqB,GAAA,KAAA,IAAS,IAAQ,IAAA,CAAA,MAAA,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,MAAA,CAAS,KAAW,CAAA,MAAA,KAAA,CAAA,CAAA;AAEhE,EAAI,IAAA,CAAC,sBAAsB,kBAAoB,EAAA;AAC7C,IAAA,OAAA,CAAQ,KAAK,iDAAiD,CAAA,CAAA;AAC9D,IAAA,UAAA,GAAa,aAAa,QAAS,EAAA,CAAA;AAAA,GACrC;AAEA,EAAI,IAAA,CAAC,kBAAsB,IAAA,KAAA,IAAS,IAAM,EAAA;AACxC,IAAQ,OAAA,CAAA,IAAA;AAAA,MACN,yEAAA;AAAA,KACF,CAAA;AAAA,GACF;AAEA,EAAA,IAAI,kBAAoB,EAAA;AACtB,IAAa,UAAA,GAAA,KAAA,CAAA;AAAA,GACf;AAEA,EAAM,MAAA,cAAA,GAAA,CACH,sBAAsB,kBAAuB,KAAA,UAAA,KAAe,KACzD,WAAY,CAAA,MAAA,CAAO,UAAU,CAAC,CAC9B,GAAA,EAAA,CAAA;AAEN,EACE,uBAAA,GAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,qBAAmB,EAAA,IAAA;AAAA,MACnB,SAAW,EAAA,EAAA,CAAG,MAAgB,CAAA,eAAA,CAAA,SAAA,EAAS,GAAI,CAAA,CAAA,MAAA,CAAA,cAAA,CAAA;AAAA,MAE1C,QAAA;AAAA,KAAA;AAAA,GACH,CAAA;AAEJ;;;;"}
|
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.14",
|
|
4
4
|
"author": "Miro",
|
|
5
5
|
"source": "src/index.ts",
|
|
6
6
|
"main": "dist/main.js",
|
|
@@ -25,10 +25,10 @@
|
|
|
25
25
|
"react": "^16.14 || ^17 || ^18"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@mirohq/design-system-stitches": "^2.3.
|
|
29
|
-
"@mirohq/design-system-
|
|
30
|
-
"@mirohq/design-system-types": "^0.
|
|
31
|
-
"@mirohq/design-system-
|
|
28
|
+
"@mirohq/design-system-stitches": "^2.3.4",
|
|
29
|
+
"@mirohq/design-system-use-theme": "^0.2.6",
|
|
30
|
+
"@mirohq/design-system-types": "^0.6.0",
|
|
31
|
+
"@mirohq/design-system-themes": "^0.1.17"
|
|
32
32
|
},
|
|
33
33
|
"scripts": {
|
|
34
34
|
"build": "rollup -c ../../../rollup.config.js",
|