@wise/components-theming 0.0.0-experimental-1248788 → 0.0.0-experimental-1ed1574

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.
@@ -1,4 +1,4 @@
1
- import { type PropsWithChildren } from 'react';
1
+ import { PropsWithChildren } from 'react';
2
2
  import type { ScreenMode, Theming } from './const';
3
3
  export declare const ThemeContext: import("react").Context<{
4
4
  theme: Theming['theme'];
@@ -1 +1 @@
1
- {"version":3,"file":"ThemeProvider.d.ts","sourceRoot":"","sources":["../src/ThemeProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,iBAAiB,EAAkC,MAAM,OAAO,CAAC;AAG9F,OAAO,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAInD,eAAO,MAAM,YAAY;WAEZ,OAAO,CAAC,OAAO,CAAC;gBACX,UAAU;cAGhB,CAAC;AAEb,KAAK,kBAAkB,GAAG,iBAAiB,CAAC,OAAO,CAAC,GAAG;IAAE,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAE9E,eAAO,MAAM,aAAa,mEAMvB,kBAAkB,gCA6BpB,CAAC"}
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,OAAO,CAAC,OAAO,CAAC;gBACX,UAAU;cAGhB,CAAC;AAEb,KAAK,kBAAkB,GAAG,iBAAiB,CAAC,OAAO,CAAC,GAAG;IAAE,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAE9E,eAAO,MAAM,aAAa,mEAMvB,kBAAkB,gCA6BpB,CAAC"}
@@ -1,4 +1,4 @@
1
- import type { ReactNode } from 'react';
1
+ import { ReactNode } from 'react';
2
2
  type ThemedChildrenProps = {
3
3
  className?: string;
4
4
  children: ReactNode;
@@ -1 +1 @@
1
- {"version":3,"file":"ThemedChildren.d.ts","sourceRoot":"","sources":["../src/ThemedChildren.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAIvC,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
+ {"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"}
package/dist/const.d.ts CHANGED
@@ -12,8 +12,8 @@ export type ScreenMode = (typeof screenModes)[number];
12
12
  export type ScreenModeDark = (typeof screenModes)[1];
13
13
  export type PlatformTheme = (typeof platformThemes)[0];
14
14
  export type PlatformForestGreenTheme = (typeof platformThemes)[1];
15
- export declare const DEFAULT_BASE_THEME = "light";
16
- export declare const DEFAULT_SCREEN_MODE = "light";
15
+ export declare const DEFAULT_BASE_THEME: "light";
16
+ export declare const DEFAULT_SCREEN_MODE: "light";
17
17
  export type Theming = {
18
18
  theme?: ComponentTheme | BaseTheme | ExtraTheme | PlatformTheme | PlatformForestGreenTheme;
19
19
  screenMode?: ScreenMode;
@@ -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,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console.warn('Call to useTheme outside a ThemeProvider');
52
52
  }
53
53
  const {
54
- theme = DEFAULT_BASE_THEME,
54
+ theme,
55
55
  screenMode: contextScreenMode
56
56
  } = theming ?? FALLBACK_VALUES;
57
57
  const screenMode = theme === DEFAULT_BASE_THEME ? DEFAULT_SCREEN_MODE : contextScreenMode;
58
58
  return react.useMemo(() => ({
59
- theme: theme,
59
+ theme,
60
60
  screenMode,
61
61
  isModern: isThemeModern(theme),
62
62
  isForestGreenTheme: isForestGreenTheme(theme),
package/dist/index.mjs CHANGED
@@ -45,12 +45,12 @@ const useTheme = () => {
45
45
  console.warn('Call to useTheme outside a ThemeProvider');
46
46
  }
47
47
  const {
48
- theme = DEFAULT_BASE_THEME,
48
+ theme,
49
49
  screenMode: contextScreenMode
50
50
  } = theming ?? FALLBACK_VALUES;
51
51
  const screenMode = theme === DEFAULT_BASE_THEME ? DEFAULT_SCREEN_MODE : contextScreenMode;
52
52
  return useMemo(() => ({
53
- theme: theme,
53
+ theme,
54
54
  screenMode,
55
55
  isModern: isThemeModern(theme),
56
56
  isForestGreenTheme: isForestGreenTheme(theme),
@@ -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,OAAO,CAAC,OAAO,CAAC,CAAC;IACxB,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,cAwB3B,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,OAAO,CAAC,OAAO,CAAC,CAAC;IACxB,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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wise/components-theming",
3
- "version": "0.0.0-experimental-1248788",
3
+ "version": "0.0.0-experimental-1ed1574",
4
4
  "description": "Provides theming support for the Wise Design system components",
5
5
  "license": "Apache-2.0",
6
6
  "keywords": [
@@ -1,4 +1,4 @@
1
- import { createContext, type PropsWithChildren, useContext, useEffect, useMemo } from 'react';
1
+ import { createContext, PropsWithChildren, useContext, useEffect, useMemo } from 'react';
2
2
 
3
3
  import { ThemedChildren } from './ThemedChildren';
4
4
  import type { ScreenMode, Theming } from './const';
@@ -1,5 +1,5 @@
1
1
  import classNames from 'classnames';
2
- import type { ReactNode } from 'react';
2
+ import { ReactNode } from 'react';
3
3
 
4
4
  import { useTheme } from './useTheme';
5
5
 
package/src/const.ts CHANGED
@@ -16,8 +16,8 @@ export type ScreenModeDark = (typeof screenModes)[1];
16
16
  export type PlatformTheme = (typeof platformThemes)[0];
17
17
  export type PlatformForestGreenTheme = (typeof platformThemes)[1];
18
18
 
19
- export const DEFAULT_BASE_THEME = 'light';
20
- export const DEFAULT_SCREEN_MODE = 'light';
19
+ export const DEFAULT_BASE_THEME = 'light' as const;
20
+ export const DEFAULT_SCREEN_MODE = 'light' as const;
21
21
 
22
22
  export type Theming = {
23
23
  theme?: ComponentTheme | BaseTheme | ExtraTheme | PlatformTheme | PlatformForestGreenTheme;
package/src/useTheme.ts CHANGED
@@ -35,19 +35,18 @@ export const useTheme = (): ThemeHookValue => {
35
35
  console.warn('Call to useTheme outside a ThemeProvider');
36
36
  }
37
37
 
38
- const { theme = DEFAULT_BASE_THEME, screenMode: contextScreenMode } = theming ?? FALLBACK_VALUES;
38
+ const { theme, screenMode: contextScreenMode } = theming ?? FALLBACK_VALUES;
39
39
 
40
- const screenMode =
41
- theme === DEFAULT_BASE_THEME ? DEFAULT_SCREEN_MODE : (contextScreenMode as ScreenMode);
40
+ const screenMode = theme === DEFAULT_BASE_THEME ? DEFAULT_SCREEN_MODE : contextScreenMode;
42
41
 
43
42
  return useMemo(
44
43
  () => ({
45
- theme: theme as Theming['theme'],
44
+ theme,
46
45
  screenMode,
47
- isModern: isThemeModern(theme as Theming['theme']),
48
- isForestGreenTheme: isForestGreenTheme(theme as Theming['theme']),
49
- isScreenModeDark: isScreenModeDark(theme as Theming['theme'], screenMode),
50
- className: getThemeClassName(theme as Theming['theme'], screenMode),
46
+ isModern: isThemeModern(theme),
47
+ isForestGreenTheme: isForestGreenTheme(theme),
48
+ isScreenModeDark: isScreenModeDark(theme, screenMode),
49
+ className: getThemeClassName(theme, screenMode),
51
50
  }),
52
51
  [theme, screenMode],
53
52
  );