@zendeskgarden/react-theming 9.7.2 → 9.9.0

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.
@@ -9,7 +9,8 @@ import PropTypes from 'prop-types';
9
9
 
10
10
  const mediaQuery = typeof window === 'undefined' ? undefined : window.matchMedia('(prefers-color-scheme: dark)');
11
11
  const useColorScheme = (initialState, colorSchemeKey) => {
12
- const localStorage = typeof window === 'undefined' ? undefined : window.localStorage;
12
+ const localStorage =
13
+ typeof window === 'undefined' || colorSchemeKey === null ? undefined : window.localStorage;
13
14
  const getState = useCallback(_state => {
14
15
  const isSystem = _state === 'system' || _state === undefined || _state === null;
15
16
  let colorScheme;
package/dist/index.cjs.js CHANGED
@@ -24,7 +24,8 @@ var memoize__default = /*#__PURE__*/_interopDefault(memoize);
24
24
 
25
25
  const mediaQuery$1 = typeof window === 'undefined' ? undefined : window.matchMedia('(prefers-color-scheme: dark)');
26
26
  const useColorScheme$1 = (initialState, colorSchemeKey) => {
27
- const localStorage = typeof window === 'undefined' ? undefined : window.localStorage;
27
+ const localStorage =
28
+ typeof window === 'undefined' || colorSchemeKey === null ? undefined : window.localStorage;
28
29
  const getState = React.useCallback(_state => {
29
30
  const isSystem = _state === 'system' || _state === undefined || _state === null;
30
31
  let colorScheme;
@@ -184,9 +184,9 @@ export interface IColorSchemeProviderProps {
184
184
  initialColorScheme?: ColorScheme;
185
185
  /**
186
186
  * Specifies the key used to store the user's preferred color scheme in
187
- * `localStorage`
187
+ * `localStorage` or `null` to bypass local storage persistence
188
188
  */
189
- colorSchemeKey?: string;
189
+ colorSchemeKey?: string | null;
190
190
  }
191
191
  export interface IThemeProviderProps extends Partial<ThemeProviderProps<IGardenTheme>> {
192
192
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zendeskgarden/react-theming",
3
- "version": "9.7.2",
3
+ "version": "9.9.0",
4
4
  "description": "Theming utilities and components within the Garden Design System",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Zendesk Garden <garden@zendesk.com>",
@@ -47,5 +47,5 @@
47
47
  "access": "public"
48
48
  },
49
49
  "zendeskgarden:src": "src/index.ts",
50
- "gitHead": "6cef5e656fa78619c4e42af330a53014c336a259"
50
+ "gitHead": "c7fcfd1e183b61345c6d1974c8f143c66dbf10fa"
51
51
  }