@codecademy/gamut-styles 17.7.1-alpha.de3fa0.0 → 17.7.1-alpha.f9625d.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.
@@ -7,7 +7,14 @@ export interface GamutProviderProps {
7
7
  useCache?: boolean;
8
8
  theme: Theme;
9
9
  variables?: Record<string, CSSObject>;
10
+ /**
11
+ * Pass a cache to the provider to override the default cache
12
+ */
10
13
  cache?: EmotionCache;
14
+ /**
15
+ * Pass a nonce to the cache to prevent CSP errors
16
+ */
17
+ nonce?: string;
11
18
  }
12
19
  export declare const GamutContext: React.Context<{
13
20
  hasGlobals?: boolean | undefined;
@@ -18,7 +18,8 @@ export const GamutProvider = _ref => {
18
18
  theme = coreTheme,
19
19
  variables,
20
20
  useGlobals = true,
21
- useCache = true
21
+ useCache = true,
22
+ nonce
22
23
  } = _ref;
23
24
  const {
24
25
  hasGlobals,
@@ -28,7 +29,9 @@ export const GamutProvider = _ref => {
28
29
  const shouldInsertGlobals = useGlobals && !hasGlobals;
29
30
 
30
31
  // Do not initialize a new cache if one has been provided as props
31
- const activeCache = useRef(shouldCreateCache && (cache ?? createEmotionCache()));
32
+ const activeCache = useRef(cache ?? createEmotionCache(nonce ? {
33
+ nonce
34
+ } : {}));
32
35
  const contextValue = {
33
36
  hasGlobals: shouldInsertGlobals,
34
37
  hasCache: shouldCreateCache
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@codecademy/gamut-styles",
3
3
  "description": "Styleguide & Component library for codecademy.com",
4
- "version": "17.7.1-alpha.de3fa0.0",
4
+ "version": "17.7.1-alpha.f9625d.0",
5
5
  "author": "Jake Hiller <jake@codecademy.com>",
6
6
  "dependencies": {
7
- "@codecademy/variance": "0.23.1-alpha.de3fa0.0",
7
+ "@codecademy/variance": "0.23.0",
8
8
  "@emotion/is-prop-valid": "^1.1.0",
9
9
  "polished": "^4.1.2"
10
10
  },
@@ -34,5 +34,5 @@
34
34
  "scripts": {
35
35
  "build": "nx build @codecademy/gamut-styles"
36
36
  },
37
- "gitHead": "e89ed7730357665598816eb2add0fb265e2d5f4e"
37
+ "gitHead": "d044220dd991d31eff5bff08b64a0c8d71fb657a"
38
38
  }