@wise/components-theming 0.0.0-experimental-62a0fe9 → 0.0.0-experimental-6528439

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.
@@ -7,6 +7,6 @@ export declare const ThemeContext: import("react").Context<{
7
7
  type ThemeProviderProps = PropsWithChildren<Theming> & {
8
8
  className?: string;
9
9
  };
10
- export declare const ThemeProvider: ({ theme, screenMode, isNotRootProvider, children, className, }: ThemeProviderProps) => import("react").JSX.Element;
10
+ export declare const ThemeProvider: ({ theme, screenMode, children, className, }: ThemeProviderProps) => import("react").JSX.Element;
11
11
  export {};
12
12
  //# sourceMappingURL=ThemeProvider.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ThemeProvider.d.ts","sourceRoot":"","sources":["../src/ThemeProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiB,iBAAiB,EAAkC,MAAM,OAAO,CAAC;AAGzF,OAAO,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAInD,eAAO,MAAM,YAAY;WAEZ,WAAW,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;gBACxB,UAAU;cAGhB,CAAC;AAEb,KAAK,kBAAkB,GAAG,iBAAiB,CAAC,OAAO,CAAC,GAAG;IAAE,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAK9E,eAAO,MAAM,aAAa,mEAMvB,kBAAkB,gCAyBpB,CAAC"}
1
+ {"version":3,"file":"ThemeProvider.d.ts","sourceRoot":"","sources":["../src/ThemeProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiB,iBAAiB,EAAW,MAAM,OAAO,CAAC;AAGlE,OAAO,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAGnD,eAAO,MAAM,YAAY;WAEZ,WAAW,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;gBACxB,UAAU;cAGhB,CAAC;AAEb,KAAK,kBAAkB,GAAG,iBAAiB,CAAC,OAAO,CAAC,GAAG;IAAE,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAE9E,eAAO,MAAM,aAAa,gDAKvB,kBAAkB,gCAQpB,CAAC"}
@@ -1,41 +1,24 @@
1
1
  'use strict';
2
2
 
3
3
  var react = require('react');
4
- var ThemedChildren = require('./ThemedChildren.js');
4
+ var ThemedLayer = require('./ThemedLayer.js');
5
5
  var _const = require('./const.js');
6
- var helpers = require('./helpers.js');
7
6
  var jsxRuntime = require('react/jsx-runtime');
8
7
 
9
8
  const ThemeContext = /*#__PURE__*/react.createContext(undefined);
10
- // RegEx to check for `np-theme-` class name
11
- const themeClass = /\bnp-theme-[a-z-]+\b/g;
12
9
  const ThemeProvider = ({
13
10
  theme = _const.DEFAULT_BASE_THEME,
14
11
  screenMode = _const.DEFAULT_SCREEN_MODE,
15
- isNotRootProvider = false,
16
12
  children,
17
13
  className = undefined
18
14
  }) => {
19
- const isContextRoot = react.useContext(ThemeContext) === undefined;
20
- // useEffect hook used to apply the theme class to the HTML element
21
- react.useEffect(() => {
22
- if (!isNotRootProvider && isContextRoot) {
23
- // Remove all the theme classes from the documentElement
24
- document.documentElement.className.match(themeClass)?.forEach(item => {
25
- document.documentElement.classList.remove(item);
26
- });
27
- helpers.getThemeClassName(theme, screenMode).split(' ').forEach(item => {
28
- document.documentElement.classList.add(item);
29
- });
30
- }
31
- }, [isNotRootProvider, isContextRoot, theme, screenMode]);
32
15
  const contextValue = react.useMemo(() => ({
33
16
  theme,
34
17
  screenMode
35
18
  }), [screenMode, theme]);
36
19
  return /*#__PURE__*/jsxRuntime.jsx(ThemeContext.Provider, {
37
20
  value: contextValue,
38
- children: /*#__PURE__*/jsxRuntime.jsx(ThemedChildren.ThemedChildren, {
21
+ children: /*#__PURE__*/jsxRuntime.jsx(ThemedLayer.ThemedLayer, {
39
22
  className: className,
40
23
  children: children
41
24
  })
@@ -1 +1 @@
1
- {"version":3,"file":"ThemeProvider.js","sources":["../src/ThemeProvider.tsx"],"sourcesContent":["import { createContext, PropsWithChildren, useContext, useEffect, useMemo } from 'react';\n\nimport { ThemedChildren } from './ThemedChildren';\nimport type { ScreenMode, Theming } from './const';\nimport { DEFAULT_BASE_THEME, DEFAULT_SCREEN_MODE } from './const';\nimport { getThemeClassName } from './helpers';\n\nexport const ThemeContext = createContext<\n | {\n theme: NonNullable<Theming['theme']>;\n screenMode: ScreenMode;\n }\n | undefined\n>(undefined);\n\ntype ThemeProviderProps = PropsWithChildren<Theming> & { className?: string };\n\n// RegEx to check for `np-theme-` class name\nconst themeClass = /\\bnp-theme-[a-z-]+\\b/g;\n\nexport const ThemeProvider = ({\n theme = DEFAULT_BASE_THEME,\n screenMode = DEFAULT_SCREEN_MODE,\n isNotRootProvider = false,\n children,\n className = undefined,\n}: ThemeProviderProps) => {\n const isContextRoot = useContext(ThemeContext) === undefined;\n\n // useEffect hook used to apply the theme class to the HTML element\n useEffect(() => {\n if (!isNotRootProvider && isContextRoot) {\n // Remove all the theme classes from the documentElement\n document.documentElement.className.match(themeClass)?.forEach((item) => {\n document.documentElement.classList.remove(item);\n });\n getThemeClassName(theme, screenMode)\n .split(' ')\n .forEach((item) => {\n document.documentElement.classList.add(item);\n });\n }\n }, [isNotRootProvider, isContextRoot, theme, screenMode]);\n\n const contextValue = useMemo(() => ({ theme, screenMode }), [screenMode, theme]);\n\n return (\n <ThemeContext.Provider value={contextValue}>\n <ThemedChildren className={className}>{children}</ThemedChildren>\n </ThemeContext.Provider>\n );\n};\n"],"names":["ThemeContext","createContext","undefined","themeClass","ThemeProvider","theme","DEFAULT_BASE_THEME","screenMode","DEFAULT_SCREEN_MODE","isNotRootProvider","children","className","isContextRoot","useContext","useEffect","document","documentElement","match","forEach","item","classList","remove","getThemeClassName","split","add","contextValue","useMemo","_jsx","Provider","value","ThemedChildren"],"mappings":";;;;;;;;MAOaA,YAAY,gBAAGC,mBAAa,CAMvCC,SAAS,EAAC;AAIZ;AACA,MAAMC,UAAU,GAAG,uBAAuB,CAAA;AAEnC,MAAMC,aAAa,GAAGA,CAAC;AAC5BC,EAAAA,KAAK,GAAGC,yBAAkB;AAC1BC,EAAAA,UAAU,GAAGC,0BAAmB;AAChCC,EAAAA,iBAAiB,GAAG,KAAK;EACzBC,QAAQ;AACRC,EAAAA,SAAS,GAAGT,SAAAA;AACO,CAAA,KAAI;AACvB,EAAA,MAAMU,aAAa,GAAGC,gBAAU,CAACb,YAAY,CAAC,KAAKE,SAAS,CAAA;AAE5D;AACAY,EAAAA,eAAS,CAAC,MAAK;AACb,IAAA,IAAI,CAACL,iBAAiB,IAAIG,aAAa,EAAE;AACvC;AACAG,MAAAA,QAAQ,CAACC,eAAe,CAACL,SAAS,CAACM,KAAK,CAACd,UAAU,CAAC,EAAEe,OAAO,CAAEC,IAAI,IAAI;QACrEJ,QAAQ,CAACC,eAAe,CAACI,SAAS,CAACC,MAAM,CAACF,IAAI,CAAC,CAAA;AACjD,OAAC,CAAC,CAAA;AACFG,MAAAA,yBAAiB,CAACjB,KAAK,EAAEE,UAAU,CAAC,CACjCgB,KAAK,CAAC,GAAG,CAAC,CACVL,OAAO,CAAEC,IAAI,IAAI;QAChBJ,QAAQ,CAACC,eAAe,CAACI,SAAS,CAACI,GAAG,CAACL,IAAI,CAAC,CAAA;AAC9C,OAAC,CAAC,CAAA;AACN,KAAA;GACD,EAAE,CAACV,iBAAiB,EAAEG,aAAa,EAAEP,KAAK,EAAEE,UAAU,CAAC,CAAC,CAAA;AAEzD,EAAA,MAAMkB,YAAY,GAAGC,aAAO,CAAC,OAAO;IAAErB,KAAK;AAAEE,IAAAA,UAAAA;AAAU,GAAE,CAAC,EAAE,CAACA,UAAU,EAAEF,KAAK,CAAC,CAAC,CAAA;AAEhF,EAAA,oBACEsB,cAAA,CAAC3B,YAAY,CAAC4B,QAAQ,EAAA;AAACC,IAAAA,KAAK,EAAEJ,YAAa;IAAAf,QAAA,eACzCiB,cAAA,CAACG,6BAAc,EAAA;AAACnB,MAAAA,SAAS,EAAEA,SAAU;AAAAD,MAAAA,QAAA,EAAEA,QAAAA;KAAyB,CAAA;AAClE,GAAuB,CAAC,CAAA;AAE5B;;;;;"}
1
+ {"version":3,"file":"ThemeProvider.js","sources":["../src/ThemeProvider.tsx"],"sourcesContent":["import { createContext, PropsWithChildren, useMemo } from 'react';\n\nimport { ThemedLayer } from './ThemedLayer';\nimport type { ScreenMode, Theming } from './const';\nimport { DEFAULT_BASE_THEME, DEFAULT_SCREEN_MODE } from './const';\n\nexport const ThemeContext = createContext<\n | {\n theme: NonNullable<Theming['theme']>;\n screenMode: ScreenMode;\n }\n | undefined\n>(undefined);\n\ntype ThemeProviderProps = PropsWithChildren<Theming> & { className?: string };\n\nexport const ThemeProvider = ({\n theme = DEFAULT_BASE_THEME,\n screenMode = DEFAULT_SCREEN_MODE,\n children,\n className = undefined,\n}: ThemeProviderProps) => {\n const contextValue = useMemo(() => ({ theme, screenMode }), [screenMode, theme]);\n\n return (\n <ThemeContext.Provider value={contextValue}>\n <ThemedLayer className={className}>{children}</ThemedLayer>\n </ThemeContext.Provider>\n );\n};\n"],"names":["ThemeContext","createContext","undefined","ThemeProvider","theme","DEFAULT_BASE_THEME","screenMode","DEFAULT_SCREEN_MODE","children","className","contextValue","useMemo","_jsx","Provider","value","ThemedLayer"],"mappings":";;;;;;;MAMaA,YAAY,gBAAGC,mBAAa,CAMvCC,SAAS,EAAC;AAIL,MAAMC,aAAa,GAAGA,CAAC;AAC5BC,EAAAA,KAAK,GAAGC,yBAAkB;AAC1BC,EAAAA,UAAU,GAAGC,0BAAmB;EAChCC,QAAQ;AACRC,EAAAA,SAAS,GAAGP,SAAAA;AACO,CAAA,KAAI;AACvB,EAAA,MAAMQ,YAAY,GAAGC,aAAO,CAAC,OAAO;IAAEP,KAAK;AAAEE,IAAAA,UAAAA;AAAU,GAAE,CAAC,EAAE,CAACA,UAAU,EAAEF,KAAK,CAAC,CAAC,CAAA;AAEhF,EAAA,oBACEQ,cAAA,CAACZ,YAAY,CAACa,QAAQ,EAAA;AAACC,IAAAA,KAAK,EAAEJ,YAAa;IAAAF,QAAA,eACzCI,cAAA,CAACG,uBAAW,EAAA;AAACN,MAAAA,SAAS,EAAEA,SAAU;AAAAD,MAAAA,QAAA,EAAEA,QAAAA;KAAsB,CAAA;AAC5D,GAAuB,CAAC,CAAA;AAE5B;;;;;"}
@@ -1,39 +1,22 @@
1
- import { createContext, useContext, useEffect, useMemo } from 'react';
2
- import { ThemedChildren } from './ThemedChildren.mjs';
1
+ import { createContext, useMemo } from 'react';
2
+ import { ThemedLayer } from './ThemedLayer.mjs';
3
3
  import { DEFAULT_BASE_THEME, DEFAULT_SCREEN_MODE } from './const.mjs';
4
- import { getThemeClassName } from './helpers.mjs';
5
4
  import { jsx } from 'react/jsx-runtime';
6
5
 
7
6
  const ThemeContext = /*#__PURE__*/createContext(undefined);
8
- // RegEx to check for `np-theme-` class name
9
- const themeClass = /\bnp-theme-[a-z-]+\b/g;
10
7
  const ThemeProvider = ({
11
8
  theme = DEFAULT_BASE_THEME,
12
9
  screenMode = DEFAULT_SCREEN_MODE,
13
- isNotRootProvider = false,
14
10
  children,
15
11
  className = undefined
16
12
  }) => {
17
- const isContextRoot = useContext(ThemeContext) === undefined;
18
- // useEffect hook used to apply the theme class to the HTML element
19
- useEffect(() => {
20
- if (!isNotRootProvider && isContextRoot) {
21
- // Remove all the theme classes from the documentElement
22
- document.documentElement.className.match(themeClass)?.forEach(item => {
23
- document.documentElement.classList.remove(item);
24
- });
25
- getThemeClassName(theme, screenMode).split(' ').forEach(item => {
26
- document.documentElement.classList.add(item);
27
- });
28
- }
29
- }, [isNotRootProvider, isContextRoot, theme, screenMode]);
30
13
  const contextValue = useMemo(() => ({
31
14
  theme,
32
15
  screenMode
33
16
  }), [screenMode, theme]);
34
17
  return /*#__PURE__*/jsx(ThemeContext.Provider, {
35
18
  value: contextValue,
36
- children: /*#__PURE__*/jsx(ThemedChildren, {
19
+ children: /*#__PURE__*/jsx(ThemedLayer, {
37
20
  className: className,
38
21
  children: children
39
22
  })
@@ -1 +1 @@
1
- {"version":3,"file":"ThemeProvider.mjs","sources":["../src/ThemeProvider.tsx"],"sourcesContent":["import { createContext, PropsWithChildren, useContext, useEffect, useMemo } from 'react';\n\nimport { ThemedChildren } from './ThemedChildren';\nimport type { ScreenMode, Theming } from './const';\nimport { DEFAULT_BASE_THEME, DEFAULT_SCREEN_MODE } from './const';\nimport { getThemeClassName } from './helpers';\n\nexport const ThemeContext = createContext<\n | {\n theme: NonNullable<Theming['theme']>;\n screenMode: ScreenMode;\n }\n | undefined\n>(undefined);\n\ntype ThemeProviderProps = PropsWithChildren<Theming> & { className?: string };\n\n// RegEx to check for `np-theme-` class name\nconst themeClass = /\\bnp-theme-[a-z-]+\\b/g;\n\nexport const ThemeProvider = ({\n theme = DEFAULT_BASE_THEME,\n screenMode = DEFAULT_SCREEN_MODE,\n isNotRootProvider = false,\n children,\n className = undefined,\n}: ThemeProviderProps) => {\n const isContextRoot = useContext(ThemeContext) === undefined;\n\n // useEffect hook used to apply the theme class to the HTML element\n useEffect(() => {\n if (!isNotRootProvider && isContextRoot) {\n // Remove all the theme classes from the documentElement\n document.documentElement.className.match(themeClass)?.forEach((item) => {\n document.documentElement.classList.remove(item);\n });\n getThemeClassName(theme, screenMode)\n .split(' ')\n .forEach((item) => {\n document.documentElement.classList.add(item);\n });\n }\n }, [isNotRootProvider, isContextRoot, theme, screenMode]);\n\n const contextValue = useMemo(() => ({ theme, screenMode }), [screenMode, theme]);\n\n return (\n <ThemeContext.Provider value={contextValue}>\n <ThemedChildren className={className}>{children}</ThemedChildren>\n </ThemeContext.Provider>\n );\n};\n"],"names":["ThemeContext","createContext","undefined","themeClass","ThemeProvider","theme","DEFAULT_BASE_THEME","screenMode","DEFAULT_SCREEN_MODE","isNotRootProvider","children","className","isContextRoot","useContext","useEffect","document","documentElement","match","forEach","item","classList","remove","getThemeClassName","split","add","contextValue","useMemo","_jsx","Provider","value","ThemedChildren"],"mappings":";;;;;;MAOaA,YAAY,gBAAGC,aAAa,CAMvCC,SAAS,EAAC;AAIZ;AACA,MAAMC,UAAU,GAAG,uBAAuB,CAAA;AAEnC,MAAMC,aAAa,GAAGA,CAAC;AAC5BC,EAAAA,KAAK,GAAGC,kBAAkB;AAC1BC,EAAAA,UAAU,GAAGC,mBAAmB;AAChCC,EAAAA,iBAAiB,GAAG,KAAK;EACzBC,QAAQ;AACRC,EAAAA,SAAS,GAAGT,SAAAA;AACO,CAAA,KAAI;AACvB,EAAA,MAAMU,aAAa,GAAGC,UAAU,CAACb,YAAY,CAAC,KAAKE,SAAS,CAAA;AAE5D;AACAY,EAAAA,SAAS,CAAC,MAAK;AACb,IAAA,IAAI,CAACL,iBAAiB,IAAIG,aAAa,EAAE;AACvC;AACAG,MAAAA,QAAQ,CAACC,eAAe,CAACL,SAAS,CAACM,KAAK,CAACd,UAAU,CAAC,EAAEe,OAAO,CAAEC,IAAI,IAAI;QACrEJ,QAAQ,CAACC,eAAe,CAACI,SAAS,CAACC,MAAM,CAACF,IAAI,CAAC,CAAA;AACjD,OAAC,CAAC,CAAA;AACFG,MAAAA,iBAAiB,CAACjB,KAAK,EAAEE,UAAU,CAAC,CACjCgB,KAAK,CAAC,GAAG,CAAC,CACVL,OAAO,CAAEC,IAAI,IAAI;QAChBJ,QAAQ,CAACC,eAAe,CAACI,SAAS,CAACI,GAAG,CAACL,IAAI,CAAC,CAAA;AAC9C,OAAC,CAAC,CAAA;AACN,KAAA;GACD,EAAE,CAACV,iBAAiB,EAAEG,aAAa,EAAEP,KAAK,EAAEE,UAAU,CAAC,CAAC,CAAA;AAEzD,EAAA,MAAMkB,YAAY,GAAGC,OAAO,CAAC,OAAO;IAAErB,KAAK;AAAEE,IAAAA,UAAAA;AAAU,GAAE,CAAC,EAAE,CAACA,UAAU,EAAEF,KAAK,CAAC,CAAC,CAAA;AAEhF,EAAA,oBACEsB,GAAA,CAAC3B,YAAY,CAAC4B,QAAQ,EAAA;AAACC,IAAAA,KAAK,EAAEJ,YAAa;IAAAf,QAAA,eACzCiB,GAAA,CAACG,cAAc,EAAA;AAACnB,MAAAA,SAAS,EAAEA,SAAU;AAAAD,MAAAA,QAAA,EAAEA,QAAAA;KAAyB,CAAA;AAClE,GAAuB,CAAC,CAAA;AAE5B;;;;"}
1
+ {"version":3,"file":"ThemeProvider.mjs","sources":["../src/ThemeProvider.tsx"],"sourcesContent":["import { createContext, PropsWithChildren, useMemo } from 'react';\n\nimport { ThemedLayer } from './ThemedLayer';\nimport type { ScreenMode, Theming } from './const';\nimport { DEFAULT_BASE_THEME, DEFAULT_SCREEN_MODE } from './const';\n\nexport const ThemeContext = createContext<\n | {\n theme: NonNullable<Theming['theme']>;\n screenMode: ScreenMode;\n }\n | undefined\n>(undefined);\n\ntype ThemeProviderProps = PropsWithChildren<Theming> & { className?: string };\n\nexport const ThemeProvider = ({\n theme = DEFAULT_BASE_THEME,\n screenMode = DEFAULT_SCREEN_MODE,\n children,\n className = undefined,\n}: ThemeProviderProps) => {\n const contextValue = useMemo(() => ({ theme, screenMode }), [screenMode, theme]);\n\n return (\n <ThemeContext.Provider value={contextValue}>\n <ThemedLayer className={className}>{children}</ThemedLayer>\n </ThemeContext.Provider>\n );\n};\n"],"names":["ThemeContext","createContext","undefined","ThemeProvider","theme","DEFAULT_BASE_THEME","screenMode","DEFAULT_SCREEN_MODE","children","className","contextValue","useMemo","_jsx","Provider","value","ThemedLayer"],"mappings":";;;;;MAMaA,YAAY,gBAAGC,aAAa,CAMvCC,SAAS,EAAC;AAIL,MAAMC,aAAa,GAAGA,CAAC;AAC5BC,EAAAA,KAAK,GAAGC,kBAAkB;AAC1BC,EAAAA,UAAU,GAAGC,mBAAmB;EAChCC,QAAQ;AACRC,EAAAA,SAAS,GAAGP,SAAAA;AACO,CAAA,KAAI;AACvB,EAAA,MAAMQ,YAAY,GAAGC,OAAO,CAAC,OAAO;IAAEP,KAAK;AAAEE,IAAAA,UAAAA;AAAU,GAAE,CAAC,EAAE,CAACA,UAAU,EAAEF,KAAK,CAAC,CAAC,CAAA;AAEhF,EAAA,oBACEQ,GAAA,CAACZ,YAAY,CAACa,QAAQ,EAAA;AAACC,IAAAA,KAAK,EAAEJ,YAAa;IAAAF,QAAA,eACzCI,GAAA,CAACG,WAAW,EAAA;AAACN,MAAAA,SAAS,EAAEA,SAAU;AAAAD,MAAAA,QAAA,EAAEA,QAAAA;KAAsB,CAAA;AAC5D,GAAuB,CAAC,CAAA;AAE5B;;;;"}
@@ -0,0 +1,8 @@
1
+ import { ReactNode } from 'react';
2
+ type ThemedLayerProps = {
3
+ className?: string;
4
+ children: ReactNode;
5
+ };
6
+ export declare const ThemedLayer: ({ className, children }: ThemedLayerProps) => import("react").JSX.Element;
7
+ export {};
8
+ //# sourceMappingURL=ThemedLayer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ThemedLayer.d.ts","sourceRoot":"","sources":["../src/ThemedLayer.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAKlC,KAAK,gBAAgB,GAAG;IAAE,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,SAAS,CAAA;CAAE,CAAC;AAEpE,eAAO,MAAM,WAAW,4BAA6B,gBAAgB,gCAKpE,CAAC"}
@@ -2,20 +2,23 @@
2
2
 
3
3
  var clsx = require('clsx');
4
4
  var useTheme = require('./useTheme.js');
5
+ var helpers = require('./helpers.js');
5
6
  var jsxRuntime = require('react/jsx-runtime');
6
7
 
7
- const ThemedChildren = ({
8
- className = undefined,
8
+ const ThemedLayer = ({
9
+ className,
9
10
  children
10
11
  }) => {
11
12
  const {
12
- className: themeClass
13
+ theme,
14
+ screenMode
13
15
  } = useTheme.useTheme();
16
+ const themeClass = helpers.getThemeClassName(theme, screenMode);
14
17
  return /*#__PURE__*/jsxRuntime.jsx("div", {
15
18
  className: clsx.clsx(themeClass, className),
16
19
  children: children
17
20
  });
18
21
  };
19
22
 
20
- exports.ThemedChildren = ThemedChildren;
21
- //# sourceMappingURL=ThemedChildren.js.map
23
+ exports.ThemedLayer = ThemedLayer;
24
+ //# sourceMappingURL=ThemedLayer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ThemedLayer.js","sources":["../src/ThemedLayer.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { ReactNode } from 'react';\n\nimport { useTheme } from './useTheme';\nimport { getThemeClassName } from './helpers';\n\ntype ThemedLayerProps = { className?: string; children: ReactNode };\n\nexport const ThemedLayer = ({ className, children }: ThemedLayerProps) => {\n const { theme, screenMode } = useTheme();\n const themeClass = getThemeClassName(theme, screenMode);\n\n return <div className={clsx(themeClass, className)}>{children}</div>;\n};\n"],"names":["ThemedLayer","className","children","theme","screenMode","useTheme","themeClass","getThemeClassName","_jsx","clsx"],"mappings":";;;;;;;AAQO,MAAMA,WAAW,GAAGA,CAAC;EAAEC,SAAS;AAAEC,EAAAA,QAAAA;AAA4B,CAAA,KAAI;EACvE,MAAM;IAAEC,KAAK;AAAEC,IAAAA,UAAAA;GAAY,GAAGC,iBAAQ,EAAE,CAAA;AACxC,EAAA,MAAMC,UAAU,GAAGC,yBAAiB,CAACJ,KAAK,EAAEC,UAAU,CAAC,CAAA;AAEvD,EAAA,oBAAOI,cAAA,CAAA,KAAA,EAAA;AAAKP,IAAAA,SAAS,EAAEQ,SAAI,CAACH,UAAU,EAAEL,SAAS,CAAE;AAAAC,IAAAA,QAAA,EAAEA,QAAAA;AAAQ,GAAM,CAAC,CAAA;AACtE;;;;"}
@@ -1,19 +1,22 @@
1
1
  import { clsx } from 'clsx';
2
2
  import { useTheme } from './useTheme.mjs';
3
+ import { getThemeClassName } from './helpers.mjs';
3
4
  import { jsx } from 'react/jsx-runtime';
4
5
 
5
- const ThemedChildren = ({
6
- className = undefined,
6
+ const ThemedLayer = ({
7
+ className,
7
8
  children
8
9
  }) => {
9
10
  const {
10
- className: themeClass
11
+ theme,
12
+ screenMode
11
13
  } = useTheme();
14
+ const themeClass = getThemeClassName(theme, screenMode);
12
15
  return /*#__PURE__*/jsx("div", {
13
16
  className: clsx(themeClass, className),
14
17
  children: children
15
18
  });
16
19
  };
17
20
 
18
- export { ThemedChildren };
19
- //# sourceMappingURL=ThemedChildren.mjs.map
21
+ export { ThemedLayer };
22
+ //# sourceMappingURL=ThemedLayer.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ThemedLayer.mjs","sources":["../src/ThemedLayer.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { ReactNode } from 'react';\n\nimport { useTheme } from './useTheme';\nimport { getThemeClassName } from './helpers';\n\ntype ThemedLayerProps = { className?: string; children: ReactNode };\n\nexport const ThemedLayer = ({ className, children }: ThemedLayerProps) => {\n const { theme, screenMode } = useTheme();\n const themeClass = getThemeClassName(theme, screenMode);\n\n return <div className={clsx(themeClass, className)}>{children}</div>;\n};\n"],"names":["ThemedLayer","className","children","theme","screenMode","useTheme","themeClass","getThemeClassName","_jsx","clsx"],"mappings":";;;;;AAQO,MAAMA,WAAW,GAAGA,CAAC;EAAEC,SAAS;AAAEC,EAAAA,QAAAA;AAA4B,CAAA,KAAI;EACvE,MAAM;IAAEC,KAAK;AAAEC,IAAAA,UAAAA;GAAY,GAAGC,QAAQ,EAAE,CAAA;AACxC,EAAA,MAAMC,UAAU,GAAGC,iBAAiB,CAACJ,KAAK,EAAEC,UAAU,CAAC,CAAA;AAEvD,EAAA,oBAAOI,GAAA,CAAA,KAAA,EAAA;AAAKP,IAAAA,SAAS,EAAEQ,IAAI,CAACH,UAAU,EAAEL,SAAS,CAAE;AAAAC,IAAAA,QAAA,EAAEA,QAAAA;AAAQ,GAAM,CAAC,CAAA;AACtE;;;;"}
package/dist/const.d.ts CHANGED
@@ -17,6 +17,7 @@ export declare const DEFAULT_SCREEN_MODE = "light";
17
17
  export type Theming = {
18
18
  theme?: ComponentTheme | BaseTheme | ExtraTheme | PlatformTheme | PlatformForestGreenTheme;
19
19
  screenMode?: ScreenMode;
20
+ /** @deprecated no-op */
20
21
  isNotRootProvider?: boolean | undefined;
21
22
  };
22
23
  //# sourceMappingURL=const.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"const.d.ts","sourceRoot":"","sources":["../src/const.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,UAAU,gCAAiC,CAAC;AACzD,eAAO,MAAM,WAAW,2CAA4C,CAAC;AACrE,eAAO,MAAM,WAAW,4BAA6B,CAAC;AACtD,eAAO,MAAM,YAAY,uDAA2C,CAAC;AACrE,eAAO,MAAM,cAAc,iDAAkD,CAAC;AAG9E,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC;AACzD,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC;AACxD,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC;AACpD,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC;AACtD,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;AACvD,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC;AACtD,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;AACrD,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC;AACvD,MAAM,MAAM,wBAAwB,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC;AAElE,eAAO,MAAM,kBAAkB,UAAU,CAAC;AAC1C,eAAO,MAAM,mBAAmB,UAAU,CAAC;AAE3C,MAAM,MAAM,OAAO,GAAG;IACpB,KAAK,CAAC,EAAE,cAAc,GAAG,SAAS,GAAG,UAAU,GAAG,aAAa,GAAG,wBAAwB,CAAC;IAC3F,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,iBAAiB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CACzC,CAAC"}
1
+ {"version":3,"file":"const.d.ts","sourceRoot":"","sources":["../src/const.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,UAAU,gCAAiC,CAAC;AACzD,eAAO,MAAM,WAAW,2CAA4C,CAAC;AACrE,eAAO,MAAM,WAAW,4BAA6B,CAAC;AACtD,eAAO,MAAM,YAAY,uDAA2C,CAAC;AACrE,eAAO,MAAM,cAAc,iDAAkD,CAAC;AAG9E,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC;AACzD,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC;AACxD,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC;AACpD,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC;AACtD,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;AACvD,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC;AACtD,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;AACrD,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC;AACvD,MAAM,MAAM,wBAAwB,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC;AAElE,eAAO,MAAM,kBAAkB,UAAU,CAAC;AAC1C,eAAO,MAAM,mBAAmB,UAAU,CAAC;AAE3C,MAAM,MAAM,OAAO,GAAG;IACpB,KAAK,CAAC,EAAE,cAAc,GAAG,SAAS,GAAG,UAAU,GAAG,aAAa,GAAG,wBAAwB,CAAC;IAC3F,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,wBAAwB;IACxB,iBAAiB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CACzC,CAAC"}
package/dist/const.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"const.js","sources":["../src/const.ts"],"sourcesContent":["// TODO: Change 'light' with 'legacy' in the future\nexport const baseThemes = ['light', 'personal'] as const;\nexport const extraThemes = ['forest-green', 'bright-green'] as const;\nexport const screenModes = ['light', 'dark'] as const;\nexport const modernThemes = [baseThemes[1], ...extraThemes] as const;\nexport const platformThemes = ['platform', 'platform--forest-green'] as const;\n\n// TODO: componentThemes returned back for backward compatibility, refactor this place in the future\nexport type ComponentTheme = (typeof baseThemes)[number];\nexport type ModernTheme = (typeof modernThemes)[number];\nexport type BaseTheme = (typeof baseThemes)[number];\nexport type ExtraTheme = (typeof extraThemes)[number];\nexport type ForestGreenTheme = (typeof extraThemes)[0];\nexport type ScreenMode = (typeof screenModes)[number];\nexport type ScreenModeDark = (typeof screenModes)[1];\nexport type PlatformTheme = (typeof platformThemes)[0];\nexport type PlatformForestGreenTheme = (typeof platformThemes)[1];\n\nexport const DEFAULT_BASE_THEME = 'light';\nexport const DEFAULT_SCREEN_MODE = 'light';\n\nexport type Theming = {\n theme?: ComponentTheme | BaseTheme | ExtraTheme | PlatformTheme | PlatformForestGreenTheme;\n screenMode?: ScreenMode;\n isNotRootProvider?: boolean | undefined;\n};\n"],"names":["baseThemes","extraThemes","screenModes","modernThemes","DEFAULT_BASE_THEME","DEFAULT_SCREEN_MODE"],"mappings":";;AAAA;MACaA,UAAU,GAAG,CAAC,OAAO,EAAE,UAAU,EAAU;MAC3CC,WAAW,GAAG,CAAC,cAAc,EAAE,cAAc,EAAU;MACvDC,WAAW,GAAG,CAAC,OAAO,EAAE,MAAM,EAAU;AAC9C,MAAMC,YAAY,GAAG,CAACH,UAAU,CAAC,CAAC,CAAC,EAAE,GAAGC,WAAW,EAAU;AAc7D,MAAMG,kBAAkB,GAAG,QAAO;AAClC,MAAMC,mBAAmB,GAAG;;;;;;;;;"}
1
+ {"version":3,"file":"const.js","sources":["../src/const.ts"],"sourcesContent":["// TODO: Change 'light' with 'legacy' in the future\nexport const baseThemes = ['light', 'personal'] as const;\nexport const extraThemes = ['forest-green', 'bright-green'] as const;\nexport const screenModes = ['light', 'dark'] as const;\nexport const modernThemes = [baseThemes[1], ...extraThemes] as const;\nexport const platformThemes = ['platform', 'platform--forest-green'] as const;\n\n// TODO: componentThemes returned back for backward compatibility, refactor this place in the future\nexport type ComponentTheme = (typeof baseThemes)[number];\nexport type ModernTheme = (typeof modernThemes)[number];\nexport type BaseTheme = (typeof baseThemes)[number];\nexport type ExtraTheme = (typeof extraThemes)[number];\nexport type ForestGreenTheme = (typeof extraThemes)[0];\nexport type ScreenMode = (typeof screenModes)[number];\nexport type ScreenModeDark = (typeof screenModes)[1];\nexport type PlatformTheme = (typeof platformThemes)[0];\nexport type PlatformForestGreenTheme = (typeof platformThemes)[1];\n\nexport const DEFAULT_BASE_THEME = 'light';\nexport const DEFAULT_SCREEN_MODE = 'light';\n\nexport type Theming = {\n theme?: ComponentTheme | BaseTheme | ExtraTheme | PlatformTheme | PlatformForestGreenTheme;\n screenMode?: ScreenMode;\n /** @deprecated no-op */\n isNotRootProvider?: boolean | undefined;\n};\n"],"names":["baseThemes","extraThemes","screenModes","modernThemes","DEFAULT_BASE_THEME","DEFAULT_SCREEN_MODE"],"mappings":";;AAAA;MACaA,UAAU,GAAG,CAAC,OAAO,EAAE,UAAU,EAAU;MAC3CC,WAAW,GAAG,CAAC,cAAc,EAAE,cAAc,EAAU;MACvDC,WAAW,GAAG,CAAC,OAAO,EAAE,MAAM,EAAU;AAC9C,MAAMC,YAAY,GAAG,CAACH,UAAU,CAAC,CAAC,CAAC,EAAE,GAAGC,WAAW,EAAU;AAc7D,MAAMG,kBAAkB,GAAG,QAAO;AAClC,MAAMC,mBAAmB,GAAG;;;;;;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"const.mjs","sources":["../src/const.ts"],"sourcesContent":["// TODO: Change 'light' with 'legacy' in the future\nexport const baseThemes = ['light', 'personal'] as const;\nexport const extraThemes = ['forest-green', 'bright-green'] as const;\nexport const screenModes = ['light', 'dark'] as const;\nexport const modernThemes = [baseThemes[1], ...extraThemes] as const;\nexport const platformThemes = ['platform', 'platform--forest-green'] as const;\n\n// TODO: componentThemes returned back for backward compatibility, refactor this place in the future\nexport type ComponentTheme = (typeof baseThemes)[number];\nexport type ModernTheme = (typeof modernThemes)[number];\nexport type BaseTheme = (typeof baseThemes)[number];\nexport type ExtraTheme = (typeof extraThemes)[number];\nexport type ForestGreenTheme = (typeof extraThemes)[0];\nexport type ScreenMode = (typeof screenModes)[number];\nexport type ScreenModeDark = (typeof screenModes)[1];\nexport type PlatformTheme = (typeof platformThemes)[0];\nexport type PlatformForestGreenTheme = (typeof platformThemes)[1];\n\nexport const DEFAULT_BASE_THEME = 'light';\nexport const DEFAULT_SCREEN_MODE = 'light';\n\nexport type Theming = {\n theme?: ComponentTheme | BaseTheme | ExtraTheme | PlatformTheme | PlatformForestGreenTheme;\n screenMode?: ScreenMode;\n isNotRootProvider?: boolean | undefined;\n};\n"],"names":["baseThemes","extraThemes","screenModes","modernThemes","DEFAULT_BASE_THEME","DEFAULT_SCREEN_MODE"],"mappings":"AAAA;MACaA,UAAU,GAAG,CAAC,OAAO,EAAE,UAAU,EAAU;MAC3CC,WAAW,GAAG,CAAC,cAAc,EAAE,cAAc,EAAU;MACvDC,WAAW,GAAG,CAAC,OAAO,EAAE,MAAM,EAAU;AAC9C,MAAMC,YAAY,GAAG,CAACH,UAAU,CAAC,CAAC,CAAC,EAAE,GAAGC,WAAW,EAAU;AAc7D,MAAMG,kBAAkB,GAAG,QAAO;AAClC,MAAMC,mBAAmB,GAAG;;;;"}
1
+ {"version":3,"file":"const.mjs","sources":["../src/const.ts"],"sourcesContent":["// TODO: Change 'light' with 'legacy' in the future\nexport const baseThemes = ['light', 'personal'] as const;\nexport const extraThemes = ['forest-green', 'bright-green'] as const;\nexport const screenModes = ['light', 'dark'] as const;\nexport const modernThemes = [baseThemes[1], ...extraThemes] as const;\nexport const platformThemes = ['platform', 'platform--forest-green'] as const;\n\n// TODO: componentThemes returned back for backward compatibility, refactor this place in the future\nexport type ComponentTheme = (typeof baseThemes)[number];\nexport type ModernTheme = (typeof modernThemes)[number];\nexport type BaseTheme = (typeof baseThemes)[number];\nexport type ExtraTheme = (typeof extraThemes)[number];\nexport type ForestGreenTheme = (typeof extraThemes)[0];\nexport type ScreenMode = (typeof screenModes)[number];\nexport type ScreenModeDark = (typeof screenModes)[1];\nexport type PlatformTheme = (typeof platformThemes)[0];\nexport type PlatformForestGreenTheme = (typeof platformThemes)[1];\n\nexport const DEFAULT_BASE_THEME = 'light';\nexport const DEFAULT_SCREEN_MODE = 'light';\n\nexport type Theming = {\n theme?: ComponentTheme | BaseTheme | ExtraTheme | PlatformTheme | PlatformForestGreenTheme;\n screenMode?: ScreenMode;\n /** @deprecated no-op */\n isNotRootProvider?: boolean | undefined;\n};\n"],"names":["baseThemes","extraThemes","screenModes","modernThemes","DEFAULT_BASE_THEME","DEFAULT_SCREEN_MODE"],"mappings":"AAAA;MACaA,UAAU,GAAG,CAAC,OAAO,EAAE,UAAU,EAAU;MAC3CC,WAAW,GAAG,CAAC,cAAc,EAAE,cAAc,EAAU;MACvDC,WAAW,GAAG,CAAC,OAAO,EAAE,MAAM,EAAU;AAC9C,MAAMC,YAAY,GAAG,CAACH,UAAU,CAAC,CAAC,CAAC,EAAE,GAAGC,WAAW,EAAU;AAc7D,MAAMG,kBAAkB,GAAG,QAAO;AAClC,MAAMC,mBAAmB,GAAG;;;;"}
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  export type { ComponentTheme, BaseTheme, ExtraTheme, ScreenMode, Theming } from './const';
2
2
  export { isThemeModern, isExtraTheme, isForestGreenTheme, isScreenModeDark, getThemeClassName, } from './helpers';
3
- export { ThemeProvider } from './ThemeProvider';
3
+ export { ThemeProvider, ThemeContext } from './ThemeProvider';
4
4
  export { useTheme } from './useTheme';
5
+ export { ThemedLayer } from './ThemedLayer';
5
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,YAAY,EAAE,cAAc,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAC1F,OAAO,EACL,aAAa,EACb,YAAY,EACZ,kBAAkB,EAClB,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,WAAW,CAAC;AAEnB,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,YAAY,EAAE,cAAc,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAC1F,OAAO,EACL,aAAa,EACb,YAAY,EACZ,kBAAkB,EAClB,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,WAAW,CAAC;AAEnB,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC"}
package/dist/index.js CHANGED
@@ -4,6 +4,7 @@
4
4
  var helpers = require('./helpers.js');
5
5
  var ThemeProvider = require('./ThemeProvider.js');
6
6
  var useTheme = require('./useTheme.js');
7
+ var ThemedLayer = require('./ThemedLayer.js');
7
8
 
8
9
 
9
10
 
@@ -12,6 +13,8 @@ exports.isExtraTheme = helpers.isExtraTheme;
12
13
  exports.isForestGreenTheme = helpers.isForestGreenTheme;
13
14
  exports.isScreenModeDark = helpers.isScreenModeDark;
14
15
  exports.isThemeModern = helpers.isThemeModern;
16
+ exports.ThemeContext = ThemeProvider.ThemeContext;
15
17
  exports.ThemeProvider = ThemeProvider.ThemeProvider;
16
18
  exports.useTheme = useTheme.useTheme;
19
+ exports.ThemedLayer = ThemedLayer.ThemedLayer;
17
20
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;"}
package/dist/index.mjs CHANGED
@@ -1,5 +1,6 @@
1
1
  'use client';
2
2
  export { getThemeClassName, isExtraTheme, isForestGreenTheme, isScreenModeDark, isThemeModern } from './helpers.mjs';
3
- export { ThemeProvider } from './ThemeProvider.mjs';
3
+ export { ThemeContext, ThemeProvider } from './ThemeProvider.mjs';
4
4
  export { useTheme } from './useTheme.mjs';
5
+ export { ThemedLayer } from './ThemedLayer.mjs';
5
6
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
1
+ {"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
@@ -2,9 +2,13 @@ import type { ScreenMode, Theming } from './const';
2
2
  interface ThemeHookValue {
3
3
  theme: NonNullable<Theming['theme']>;
4
4
  screenMode: ScreenMode;
5
+ /** @deprecated */
5
6
  isModern: boolean;
7
+ /** @deprecated */
6
8
  isForestGreenTheme: boolean;
9
+ /** @deprecated */
7
10
  isScreenModeDark: boolean;
11
+ /** @deprecated */
8
12
  className: string;
9
13
  }
10
14
  export declare const useTheme: () => ThemeHookValue;
@@ -1 +1 @@
1
- {"version":3,"file":"useTheme.d.ts","sourceRoot":"","sources":["../src/useTheme.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAInD,UAAU,cAAc;IACtB,KAAK,EAAE,WAAW,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;IACrC,UAAU,EAAE,UAAU,CAAC;IACvB,QAAQ,EAAE,OAAO,CAAC;IAClB,kBAAkB,EAAE,OAAO,CAAC;IAC5B,gBAAgB,EAAE,OAAO,CAAC;IAC1B,SAAS,EAAE,MAAM,CAAC;CACnB;AAeD,eAAO,MAAM,QAAQ,QAAO,cAuB3B,CAAC"}
1
+ {"version":3,"file":"useTheme.d.ts","sourceRoot":"","sources":["../src/useTheme.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAInD,UAAU,cAAc;IACtB,KAAK,EAAE,WAAW,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;IACrC,UAAU,EAAE,UAAU,CAAC;IACvB,kBAAkB;IAClB,QAAQ,EAAE,OAAO,CAAC;IAClB,kBAAkB;IAClB,kBAAkB,EAAE,OAAO,CAAC;IAC5B,kBAAkB;IAClB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,kBAAkB;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB;AAeD,eAAO,MAAM,QAAQ,QAAO,cAuB3B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"useTheme.js","sources":["../src/useTheme.ts"],"sourcesContent":["import { useContext, useMemo } from 'react';\n\nimport { ThemeContext } from './ThemeProvider';\nimport type { ScreenMode, Theming } from './const';\nimport { DEFAULT_BASE_THEME, DEFAULT_SCREEN_MODE } from './const';\nimport { isThemeModern, isForestGreenTheme, isScreenModeDark, getThemeClassName } from './helpers';\n\ninterface ThemeHookValue {\n theme: NonNullable<Theming['theme']>;\n screenMode: ScreenMode;\n isModern: boolean;\n isForestGreenTheme: boolean;\n isScreenModeDark: boolean;\n className: string;\n}\n\nconst FALLBACK_VALUES = {\n theme: DEFAULT_BASE_THEME,\n screenMode: DEFAULT_SCREEN_MODE,\n} as const;\n\nconst isNotProduction = () => {\n try {\n return ['localhost', 'dev-wi.se'].includes(window.location.hostname);\n } catch {\n return false;\n }\n};\n\nexport const useTheme = (): ThemeHookValue => {\n const theming = useContext(ThemeContext);\n\n if (!theming && isNotProduction()) {\n // eslint-disable-next-line no-console\n console.warn('Call to useTheme outside a ThemeProvider');\n }\n\n const { theme, screenMode: contextScreenMode } = theming ?? FALLBACK_VALUES;\n\n const screenMode = theme === DEFAULT_BASE_THEME ? DEFAULT_SCREEN_MODE : contextScreenMode;\n\n return useMemo(\n () => ({\n theme,\n screenMode,\n isModern: isThemeModern(theme),\n isForestGreenTheme: isForestGreenTheme(theme),\n isScreenModeDark: isScreenModeDark(theme, screenMode),\n className: getThemeClassName(theme, screenMode),\n }),\n [theme, screenMode],\n );\n};\n"],"names":["FALLBACK_VALUES","theme","DEFAULT_BASE_THEME","screenMode","DEFAULT_SCREEN_MODE","isNotProduction","includes","window","location","hostname","useTheme","theming","useContext","ThemeContext","console","warn","contextScreenMode","useMemo","isModern","isThemeModern","isForestGreenTheme","isScreenModeDark","className","getThemeClassName"],"mappings":";;;;;;;AAgBA,MAAMA,eAAe,GAAG;AACtBC,EAAAA,KAAK,EAAEC,yBAAkB;AACzBC,EAAAA,UAAU,EAAEC,0BAAAA;CACJ,CAAA;AAEV,MAAMC,eAAe,GAAGA,MAAK;EAC3B,IAAI;AACF,IAAA,OAAO,CAAC,WAAW,EAAE,WAAW,CAAC,CAACC,QAAQ,CAACC,MAAM,CAACC,QAAQ,CAACC,QAAQ,CAAC,CAAA;AACtE,GAAC,CAAC,MAAM;AACN,IAAA,OAAO,KAAK,CAAA;AACd,GAAA;AACF,CAAC,CAAA;AAEYC,MAAAA,QAAQ,GAAGA,MAAqB;AAC3C,EAAA,MAAMC,OAAO,GAAGC,gBAAU,CAACC,0BAAY,CAAC,CAAA;AAExC,EAAA,IAAI,CAACF,OAAO,IAAIN,eAAe,EAAE,EAAE;AACjC;AACAS,IAAAA,OAAO,CAACC,IAAI,CAAC,0CAA0C,CAAC,CAAA;AAC1D,GAAA;EAEA,MAAM;IAAEd,KAAK;AAAEE,IAAAA,UAAU,EAAEa,iBAAAA;GAAmB,GAAGL,OAAO,IAAIX,eAAe,CAAA;EAE3E,MAAMG,UAAU,GAAGF,KAAK,KAAKC,yBAAkB,GAAGE,0BAAmB,GAAGY,iBAAiB,CAAA;EAEzF,OAAOC,aAAO,CACZ,OAAO;IACLhB,KAAK;IACLE,UAAU;AACVe,IAAAA,QAAQ,EAAEC,qBAAa,CAAClB,KAAK,CAAC;AAC9BmB,IAAAA,kBAAkB,EAAEA,0BAAkB,CAACnB,KAAK,CAAC;AAC7CoB,IAAAA,gBAAgB,EAAEA,wBAAgB,CAACpB,KAAK,EAAEE,UAAU,CAAC;AACrDmB,IAAAA,SAAS,EAAEC,yBAAiB,CAACtB,KAAK,EAAEE,UAAU,CAAA;AAC/C,GAAA,CAAC,EACF,CAACF,KAAK,EAAEE,UAAU,CAAC,CACpB,CAAA;AACH;;;;"}
1
+ {"version":3,"file":"useTheme.js","sources":["../src/useTheme.ts"],"sourcesContent":["import { useContext, useMemo } from 'react';\n\nimport { ThemeContext } from './ThemeProvider';\nimport type { ScreenMode, Theming } from './const';\nimport { DEFAULT_BASE_THEME, DEFAULT_SCREEN_MODE } from './const';\nimport { isThemeModern, isForestGreenTheme, isScreenModeDark, getThemeClassName } from './helpers';\n\ninterface ThemeHookValue {\n theme: NonNullable<Theming['theme']>;\n screenMode: ScreenMode;\n /** @deprecated */\n isModern: boolean;\n /** @deprecated */\n isForestGreenTheme: boolean;\n /** @deprecated */\n isScreenModeDark: boolean;\n /** @deprecated */\n className: string;\n}\n\nconst FALLBACK_VALUES = {\n theme: DEFAULT_BASE_THEME,\n screenMode: DEFAULT_SCREEN_MODE,\n} as const;\n\nconst isNotProduction = () => {\n try {\n return ['localhost', 'dev-wi.se'].includes(window.location.hostname);\n } catch {\n return false;\n }\n};\n\nexport const useTheme = (): ThemeHookValue => {\n const theming = useContext(ThemeContext);\n\n if (!theming && isNotProduction()) {\n // eslint-disable-next-line no-console\n console.warn('Call to useTheme outside a ThemeProvider');\n }\n\n const { theme, screenMode: contextScreenMode } = theming ?? FALLBACK_VALUES;\n\n const screenMode = theme === DEFAULT_BASE_THEME ? DEFAULT_SCREEN_MODE : contextScreenMode;\n\n return useMemo(\n () => ({\n theme,\n screenMode,\n isModern: isThemeModern(theme),\n isForestGreenTheme: isForestGreenTheme(theme),\n isScreenModeDark: isScreenModeDark(theme, screenMode),\n className: getThemeClassName(theme, screenMode),\n }),\n [theme, screenMode],\n );\n};\n"],"names":["FALLBACK_VALUES","theme","DEFAULT_BASE_THEME","screenMode","DEFAULT_SCREEN_MODE","isNotProduction","includes","window","location","hostname","useTheme","theming","useContext","ThemeContext","console","warn","contextScreenMode","useMemo","isModern","isThemeModern","isForestGreenTheme","isScreenModeDark","className","getThemeClassName"],"mappings":";;;;;;;AAoBA,MAAMA,eAAe,GAAG;AACtBC,EAAAA,KAAK,EAAEC,yBAAkB;AACzBC,EAAAA,UAAU,EAAEC,0BAAAA;CACJ,CAAA;AAEV,MAAMC,eAAe,GAAGA,MAAK;EAC3B,IAAI;AACF,IAAA,OAAO,CAAC,WAAW,EAAE,WAAW,CAAC,CAACC,QAAQ,CAACC,MAAM,CAACC,QAAQ,CAACC,QAAQ,CAAC,CAAA;AACtE,GAAC,CAAC,MAAM;AACN,IAAA,OAAO,KAAK,CAAA;AACd,GAAA;AACF,CAAC,CAAA;AAEYC,MAAAA,QAAQ,GAAGA,MAAqB;AAC3C,EAAA,MAAMC,OAAO,GAAGC,gBAAU,CAACC,0BAAY,CAAC,CAAA;AAExC,EAAA,IAAI,CAACF,OAAO,IAAIN,eAAe,EAAE,EAAE;AACjC;AACAS,IAAAA,OAAO,CAACC,IAAI,CAAC,0CAA0C,CAAC,CAAA;AAC1D,GAAA;EAEA,MAAM;IAAEd,KAAK;AAAEE,IAAAA,UAAU,EAAEa,iBAAAA;GAAmB,GAAGL,OAAO,IAAIX,eAAe,CAAA;EAE3E,MAAMG,UAAU,GAAGF,KAAK,KAAKC,yBAAkB,GAAGE,0BAAmB,GAAGY,iBAAiB,CAAA;EAEzF,OAAOC,aAAO,CACZ,OAAO;IACLhB,KAAK;IACLE,UAAU;AACVe,IAAAA,QAAQ,EAAEC,qBAAa,CAAClB,KAAK,CAAC;AAC9BmB,IAAAA,kBAAkB,EAAEA,0BAAkB,CAACnB,KAAK,CAAC;AAC7CoB,IAAAA,gBAAgB,EAAEA,wBAAgB,CAACpB,KAAK,EAAEE,UAAU,CAAC;AACrDmB,IAAAA,SAAS,EAAEC,yBAAiB,CAACtB,KAAK,EAAEE,UAAU,CAAA;AAC/C,GAAA,CAAC,EACF,CAACF,KAAK,EAAEE,UAAU,CAAC,CACpB,CAAA;AACH;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"useTheme.mjs","sources":["../src/useTheme.ts"],"sourcesContent":["import { useContext, useMemo } from 'react';\n\nimport { ThemeContext } from './ThemeProvider';\nimport type { ScreenMode, Theming } from './const';\nimport { DEFAULT_BASE_THEME, DEFAULT_SCREEN_MODE } from './const';\nimport { isThemeModern, isForestGreenTheme, isScreenModeDark, getThemeClassName } from './helpers';\n\ninterface ThemeHookValue {\n theme: NonNullable<Theming['theme']>;\n screenMode: ScreenMode;\n isModern: boolean;\n isForestGreenTheme: boolean;\n isScreenModeDark: boolean;\n className: string;\n}\n\nconst FALLBACK_VALUES = {\n theme: DEFAULT_BASE_THEME,\n screenMode: DEFAULT_SCREEN_MODE,\n} as const;\n\nconst isNotProduction = () => {\n try {\n return ['localhost', 'dev-wi.se'].includes(window.location.hostname);\n } catch {\n return false;\n }\n};\n\nexport const useTheme = (): ThemeHookValue => {\n const theming = useContext(ThemeContext);\n\n if (!theming && isNotProduction()) {\n // eslint-disable-next-line no-console\n console.warn('Call to useTheme outside a ThemeProvider');\n }\n\n const { theme, screenMode: contextScreenMode } = theming ?? FALLBACK_VALUES;\n\n const screenMode = theme === DEFAULT_BASE_THEME ? DEFAULT_SCREEN_MODE : contextScreenMode;\n\n return useMemo(\n () => ({\n theme,\n screenMode,\n isModern: isThemeModern(theme),\n isForestGreenTheme: isForestGreenTheme(theme),\n isScreenModeDark: isScreenModeDark(theme, screenMode),\n className: getThemeClassName(theme, screenMode),\n }),\n [theme, screenMode],\n );\n};\n"],"names":["FALLBACK_VALUES","theme","DEFAULT_BASE_THEME","screenMode","DEFAULT_SCREEN_MODE","isNotProduction","includes","window","location","hostname","useTheme","theming","useContext","ThemeContext","console","warn","contextScreenMode","useMemo","isModern","isThemeModern","isForestGreenTheme","isScreenModeDark","className","getThemeClassName"],"mappings":";;;;;AAgBA,MAAMA,eAAe,GAAG;AACtBC,EAAAA,KAAK,EAAEC,kBAAkB;AACzBC,EAAAA,UAAU,EAAEC,mBAAAA;CACJ,CAAA;AAEV,MAAMC,eAAe,GAAGA,MAAK;EAC3B,IAAI;AACF,IAAA,OAAO,CAAC,WAAW,EAAE,WAAW,CAAC,CAACC,QAAQ,CAACC,MAAM,CAACC,QAAQ,CAACC,QAAQ,CAAC,CAAA;AACtE,GAAC,CAAC,MAAM;AACN,IAAA,OAAO,KAAK,CAAA;AACd,GAAA;AACF,CAAC,CAAA;AAEYC,MAAAA,QAAQ,GAAGA,MAAqB;AAC3C,EAAA,MAAMC,OAAO,GAAGC,UAAU,CAACC,YAAY,CAAC,CAAA;AAExC,EAAA,IAAI,CAACF,OAAO,IAAIN,eAAe,EAAE,EAAE;AACjC;AACAS,IAAAA,OAAO,CAACC,IAAI,CAAC,0CAA0C,CAAC,CAAA;AAC1D,GAAA;EAEA,MAAM;IAAEd,KAAK;AAAEE,IAAAA,UAAU,EAAEa,iBAAAA;GAAmB,GAAGL,OAAO,IAAIX,eAAe,CAAA;EAE3E,MAAMG,UAAU,GAAGF,KAAK,KAAKC,kBAAkB,GAAGE,mBAAmB,GAAGY,iBAAiB,CAAA;EAEzF,OAAOC,OAAO,CACZ,OAAO;IACLhB,KAAK;IACLE,UAAU;AACVe,IAAAA,QAAQ,EAAEC,aAAa,CAAClB,KAAK,CAAC;AAC9BmB,IAAAA,kBAAkB,EAAEA,kBAAkB,CAACnB,KAAK,CAAC;AAC7CoB,IAAAA,gBAAgB,EAAEA,gBAAgB,CAACpB,KAAK,EAAEE,UAAU,CAAC;AACrDmB,IAAAA,SAAS,EAAEC,iBAAiB,CAACtB,KAAK,EAAEE,UAAU,CAAA;AAC/C,GAAA,CAAC,EACF,CAACF,KAAK,EAAEE,UAAU,CAAC,CACpB,CAAA;AACH;;;;"}
1
+ {"version":3,"file":"useTheme.mjs","sources":["../src/useTheme.ts"],"sourcesContent":["import { useContext, useMemo } from 'react';\n\nimport { ThemeContext } from './ThemeProvider';\nimport type { ScreenMode, Theming } from './const';\nimport { DEFAULT_BASE_THEME, DEFAULT_SCREEN_MODE } from './const';\nimport { isThemeModern, isForestGreenTheme, isScreenModeDark, getThemeClassName } from './helpers';\n\ninterface ThemeHookValue {\n theme: NonNullable<Theming['theme']>;\n screenMode: ScreenMode;\n /** @deprecated */\n isModern: boolean;\n /** @deprecated */\n isForestGreenTheme: boolean;\n /** @deprecated */\n isScreenModeDark: boolean;\n /** @deprecated */\n className: string;\n}\n\nconst FALLBACK_VALUES = {\n theme: DEFAULT_BASE_THEME,\n screenMode: DEFAULT_SCREEN_MODE,\n} as const;\n\nconst isNotProduction = () => {\n try {\n return ['localhost', 'dev-wi.se'].includes(window.location.hostname);\n } catch {\n return false;\n }\n};\n\nexport const useTheme = (): ThemeHookValue => {\n const theming = useContext(ThemeContext);\n\n if (!theming && isNotProduction()) {\n // eslint-disable-next-line no-console\n console.warn('Call to useTheme outside a ThemeProvider');\n }\n\n const { theme, screenMode: contextScreenMode } = theming ?? FALLBACK_VALUES;\n\n const screenMode = theme === DEFAULT_BASE_THEME ? DEFAULT_SCREEN_MODE : contextScreenMode;\n\n return useMemo(\n () => ({\n theme,\n screenMode,\n isModern: isThemeModern(theme),\n isForestGreenTheme: isForestGreenTheme(theme),\n isScreenModeDark: isScreenModeDark(theme, screenMode),\n className: getThemeClassName(theme, screenMode),\n }),\n [theme, screenMode],\n );\n};\n"],"names":["FALLBACK_VALUES","theme","DEFAULT_BASE_THEME","screenMode","DEFAULT_SCREEN_MODE","isNotProduction","includes","window","location","hostname","useTheme","theming","useContext","ThemeContext","console","warn","contextScreenMode","useMemo","isModern","isThemeModern","isForestGreenTheme","isScreenModeDark","className","getThemeClassName"],"mappings":";;;;;AAoBA,MAAMA,eAAe,GAAG;AACtBC,EAAAA,KAAK,EAAEC,kBAAkB;AACzBC,EAAAA,UAAU,EAAEC,mBAAAA;CACJ,CAAA;AAEV,MAAMC,eAAe,GAAGA,MAAK;EAC3B,IAAI;AACF,IAAA,OAAO,CAAC,WAAW,EAAE,WAAW,CAAC,CAACC,QAAQ,CAACC,MAAM,CAACC,QAAQ,CAACC,QAAQ,CAAC,CAAA;AACtE,GAAC,CAAC,MAAM;AACN,IAAA,OAAO,KAAK,CAAA;AACd,GAAA;AACF,CAAC,CAAA;AAEYC,MAAAA,QAAQ,GAAGA,MAAqB;AAC3C,EAAA,MAAMC,OAAO,GAAGC,UAAU,CAACC,YAAY,CAAC,CAAA;AAExC,EAAA,IAAI,CAACF,OAAO,IAAIN,eAAe,EAAE,EAAE;AACjC;AACAS,IAAAA,OAAO,CAACC,IAAI,CAAC,0CAA0C,CAAC,CAAA;AAC1D,GAAA;EAEA,MAAM;IAAEd,KAAK;AAAEE,IAAAA,UAAU,EAAEa,iBAAAA;GAAmB,GAAGL,OAAO,IAAIX,eAAe,CAAA;EAE3E,MAAMG,UAAU,GAAGF,KAAK,KAAKC,kBAAkB,GAAGE,mBAAmB,GAAGY,iBAAiB,CAAA;EAEzF,OAAOC,OAAO,CACZ,OAAO;IACLhB,KAAK;IACLE,UAAU;AACVe,IAAAA,QAAQ,EAAEC,aAAa,CAAClB,KAAK,CAAC;AAC9BmB,IAAAA,kBAAkB,EAAEA,kBAAkB,CAACnB,KAAK,CAAC;AAC7CoB,IAAAA,gBAAgB,EAAEA,gBAAgB,CAACpB,KAAK,EAAEE,UAAU,CAAC;AACrDmB,IAAAA,SAAS,EAAEC,iBAAiB,CAACtB,KAAK,EAAEE,UAAU,CAAA;AAC/C,GAAA,CAAC,EACF,CAACF,KAAK,EAAEE,UAAU,CAAC,CACpB,CAAA;AACH;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wise/components-theming",
3
- "version": "0.0.0-experimental-62a0fe9",
3
+ "version": "0.0.0-experimental-6528439",
4
4
  "description": "Provides theming support for the Wise Design system components",
5
5
  "license": "Apache-2.0",
6
6
  "keywords": [
@@ -1,9 +1,8 @@
1
- import { createContext, PropsWithChildren, useContext, useEffect, useMemo } from 'react';
1
+ import { createContext, PropsWithChildren, useMemo } from 'react';
2
2
 
3
- import { ThemedChildren } from './ThemedChildren';
3
+ import { ThemedLayer } from './ThemedLayer';
4
4
  import type { ScreenMode, Theming } from './const';
5
5
  import { DEFAULT_BASE_THEME, DEFAULT_SCREEN_MODE } from './const';
6
- import { getThemeClassName } from './helpers';
7
6
 
8
7
  export const ThemeContext = createContext<
9
8
  | {
@@ -15,38 +14,17 @@ export const ThemeContext = createContext<
15
14
 
16
15
  type ThemeProviderProps = PropsWithChildren<Theming> & { className?: string };
17
16
 
18
- // RegEx to check for `np-theme-` class name
19
- const themeClass = /\bnp-theme-[a-z-]+\b/g;
20
-
21
17
  export const ThemeProvider = ({
22
18
  theme = DEFAULT_BASE_THEME,
23
19
  screenMode = DEFAULT_SCREEN_MODE,
24
- isNotRootProvider = false,
25
20
  children,
26
21
  className = undefined,
27
22
  }: ThemeProviderProps) => {
28
- const isContextRoot = useContext(ThemeContext) === undefined;
29
-
30
- // useEffect hook used to apply the theme class to the HTML element
31
- useEffect(() => {
32
- if (!isNotRootProvider && isContextRoot) {
33
- // Remove all the theme classes from the documentElement
34
- document.documentElement.className.match(themeClass)?.forEach((item) => {
35
- document.documentElement.classList.remove(item);
36
- });
37
- getThemeClassName(theme, screenMode)
38
- .split(' ')
39
- .forEach((item) => {
40
- document.documentElement.classList.add(item);
41
- });
42
- }
43
- }, [isNotRootProvider, isContextRoot, theme, screenMode]);
44
-
45
23
  const contextValue = useMemo(() => ({ theme, screenMode }), [screenMode, theme]);
46
24
 
47
25
  return (
48
26
  <ThemeContext.Provider value={contextValue}>
49
- <ThemedChildren className={className}>{children}</ThemedChildren>
27
+ <ThemedLayer className={className}>{children}</ThemedLayer>
50
28
  </ThemeContext.Provider>
51
29
  );
52
30
  };
@@ -0,0 +1,14 @@
1
+ import { clsx } from 'clsx';
2
+ import { ReactNode } from 'react';
3
+
4
+ import { useTheme } from './useTheme';
5
+ import { getThemeClassName } from './helpers';
6
+
7
+ type ThemedLayerProps = { className?: string; children: ReactNode };
8
+
9
+ export const ThemedLayer = ({ className, children }: ThemedLayerProps) => {
10
+ const { theme, screenMode } = useTheme();
11
+ const themeClass = getThemeClassName(theme, screenMode);
12
+
13
+ return <div className={clsx(themeClass, className)}>{children}</div>;
14
+ };
package/src/const.ts CHANGED
@@ -22,5 +22,6 @@ export const DEFAULT_SCREEN_MODE = 'light';
22
22
  export type Theming = {
23
23
  theme?: ComponentTheme | BaseTheme | ExtraTheme | PlatformTheme | PlatformForestGreenTheme;
24
24
  screenMode?: ScreenMode;
25
+ /** @deprecated no-op */
25
26
  isNotRootProvider?: boolean | undefined;
26
27
  };
package/src/index.ts CHANGED
@@ -9,5 +9,6 @@ export {
9
9
  getThemeClassName,
10
10
  } from './helpers';
11
11
 
12
- export { ThemeProvider } from './ThemeProvider';
12
+ export { ThemeProvider, ThemeContext } from './ThemeProvider';
13
13
  export { useTheme } from './useTheme';
14
+ export { ThemedLayer } from './ThemedLayer';
package/src/useTheme.ts CHANGED
@@ -8,9 +8,13 @@ import { isThemeModern, isForestGreenTheme, isScreenModeDark, getThemeClassName
8
8
  interface ThemeHookValue {
9
9
  theme: NonNullable<Theming['theme']>;
10
10
  screenMode: ScreenMode;
11
+ /** @deprecated */
11
12
  isModern: boolean;
13
+ /** @deprecated */
12
14
  isForestGreenTheme: boolean;
15
+ /** @deprecated */
13
16
  isScreenModeDark: boolean;
17
+ /** @deprecated */
14
18
  className: string;
15
19
  }
16
20
 
@@ -1,8 +0,0 @@
1
- import { ReactNode } from 'react';
2
- type ThemedChildrenProps = {
3
- className?: string;
4
- children: ReactNode;
5
- };
6
- export declare const ThemedChildren: ({ className, children }: ThemedChildrenProps) => import("react").JSX.Element;
7
- export {};
8
- //# sourceMappingURL=ThemedChildren.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ThemedChildren.d.ts","sourceRoot":"","sources":["../src/ThemedChildren.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAIlC,KAAK,mBAAmB,GAAG;IAAE,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,SAAS,CAAA;CAAE,CAAC;AAEvE,eAAO,MAAM,cAAc,4BAAyC,mBAAmB,gCAItF,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"ThemedChildren.js","sources":["../src/ThemedChildren.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { ReactNode } from 'react';\n\nimport { useTheme } from './useTheme';\n\ntype ThemedChildrenProps = { className?: string; children: ReactNode };\n\nexport const ThemedChildren = ({ className = undefined, children }: ThemedChildrenProps) => {\n const { className: themeClass } = useTheme();\n\n return <div className={clsx(themeClass, className)}>{children}</div>;\n};\n"],"names":["ThemedChildren","className","undefined","children","themeClass","useTheme","_jsx","clsx"],"mappings":";;;;;;AAOO,MAAMA,cAAc,GAAGA,CAAC;AAAEC,EAAAA,SAAS,GAAGC,SAAS;AAAEC,EAAAA,QAAAA;AAAQ,CAAuB,KAAI;EACzF,MAAM;AAAEF,IAAAA,SAAS,EAAEG,UAAAA;GAAY,GAAGC,iBAAQ,EAAE,CAAA;AAE5C,EAAA,oBAAOC,cAAA,CAAA,KAAA,EAAA;AAAKL,IAAAA,SAAS,EAAEM,SAAI,CAACH,UAAU,EAAEH,SAAS,CAAE;AAAAE,IAAAA,QAAA,EAAEA,QAAAA;AAAQ,GAAM,CAAC,CAAA;AACtE;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"ThemedChildren.mjs","sources":["../src/ThemedChildren.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { ReactNode } from 'react';\n\nimport { useTheme } from './useTheme';\n\ntype ThemedChildrenProps = { className?: string; children: ReactNode };\n\nexport const ThemedChildren = ({ className = undefined, children }: ThemedChildrenProps) => {\n const { className: themeClass } = useTheme();\n\n return <div className={clsx(themeClass, className)}>{children}</div>;\n};\n"],"names":["ThemedChildren","className","undefined","children","themeClass","useTheme","_jsx","clsx"],"mappings":";;;;AAOO,MAAMA,cAAc,GAAGA,CAAC;AAAEC,EAAAA,SAAS,GAAGC,SAAS;AAAEC,EAAAA,QAAAA;AAAQ,CAAuB,KAAI;EACzF,MAAM;AAAEF,IAAAA,SAAS,EAAEG,UAAAA;GAAY,GAAGC,QAAQ,EAAE,CAAA;AAE5C,EAAA,oBAAOC,GAAA,CAAA,KAAA,EAAA;AAAKL,IAAAA,SAAS,EAAEM,IAAI,CAACH,UAAU,EAAEH,SAAS,CAAE;AAAAE,IAAAA,QAAA,EAAEA,QAAAA;AAAQ,GAAM,CAAC,CAAA;AACtE;;;;"}
@@ -1,12 +0,0 @@
1
- import { clsx } from 'clsx';
2
- import { ReactNode } from 'react';
3
-
4
- import { useTheme } from './useTheme';
5
-
6
- type ThemedChildrenProps = { className?: string; children: ReactNode };
7
-
8
- export const ThemedChildren = ({ className = undefined, children }: ThemedChildrenProps) => {
9
- const { className: themeClass } = useTheme();
10
-
11
- return <div className={clsx(themeClass, className)}>{children}</div>;
12
- };