@dbcdk/react-components 0.0.179 → 0.0.180

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/README.md CHANGED
@@ -108,15 +108,16 @@ instead of `useTheme()`:
108
108
  import { useGetActiveTheme } from '@dbcdk/react-components/client'
109
109
 
110
110
  export function ThemeBadge() {
111
- const { theme, colorScheme } = useGetActiveTheme()
111
+ const { theme, colorScheme, themeKey } = useGetActiveTheme()
112
112
 
113
- return <span>{theme} / {colorScheme}</span>
113
+ return <span>{themeKey ?? `${theme} / ${colorScheme}`}</span>
114
114
  }
115
115
  ```
116
116
 
117
117
  `useGetActiveTheme()` is intentionally read-only and takes no options. It
118
118
  reports the current active theme state as established by `ThemeScript`,
119
- persisted storage, or another mounted theme control.
119
+ persisted storage, or another mounted theme control. `themeKey` is only set
120
+ when both `theme` and `colorScheme` are resolved, and is otherwise `null`.
120
121
 
121
122
  ---
122
123
 
@@ -7,7 +7,8 @@ var useTheme = require('./useTheme');
7
7
  function useGetActiveTheme() {
8
8
  const { theme } = useTheme.useTheme();
9
9
  const { colorScheme } = useColorScheme.useColorScheme();
10
- return { theme, colorScheme };
10
+ const themeKey = theme && colorScheme ? `${theme}-${colorScheme}` : null;
11
+ return { theme, colorScheme, themeKey };
11
12
  }
12
13
 
13
14
  exports.useGetActiveTheme = useGetActiveTheme;
@@ -4,5 +4,6 @@ export type { ColorScheme, ThemeId };
4
4
  export interface UseGetActiveThemeResult {
5
5
  theme: ThemeId | null;
6
6
  colorScheme: ColorScheme | null;
7
+ themeKey: string | null;
7
8
  }
8
9
  export declare function useGetActiveTheme(): UseGetActiveThemeResult;
@@ -5,7 +5,8 @@ import { useTheme } from './useTheme';
5
5
  function useGetActiveTheme() {
6
6
  const { theme } = useTheme();
7
7
  const { colorScheme } = useColorScheme();
8
- return { theme, colorScheme };
8
+ const themeKey = theme && colorScheme ? `${theme}-${colorScheme}` : null;
9
+ return { theme, colorScheme, themeKey };
9
10
  }
10
11
 
11
12
  export { useGetActiveTheme };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dbcdk/react-components",
3
- "version": "0.0.179",
3
+ "version": "0.0.180",
4
4
  "description": "Reusable React components for DBC projects",
5
5
  "license": "ISC",
6
6
  "author": "",