@codecademy/gamut-styles 16.0.0-alpha.b81ea9.0 → 16.0.0-alpha.cef563.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.
@@ -3,6 +3,7 @@ import { EmotionCache, Theme } from '@emotion/react';
3
3
  import * as React from 'react';
4
4
  export interface GamutProviderProps {
5
5
  children?: React.ReactNode;
6
+ useIcons?: boolean;
6
7
  useGlobals?: boolean;
7
8
  useCache?: boolean;
8
9
  theme: Theme;
@@ -5,6 +5,7 @@ import { createEmotionCache } from './cache';
5
5
  import { Reboot, Typography } from './globals';
6
6
  import { Variables } from './globals/Variables';
7
7
  import { coreTheme } from './themes/core';
8
+ import { UniqueIdProvider } from './UniqueIdProvider';
8
9
  import { jsx as _jsx } from "react/jsx-runtime";
9
10
  import { Fragment as _Fragment } from "react/jsx-runtime";
10
11
  import { jsxs as _jsxs } from "react/jsx-runtime";
@@ -22,7 +23,9 @@ export var GamutProvider = function GamutProvider(_ref) {
22
23
  _ref$useGlobals = _ref.useGlobals,
23
24
  useGlobals = _ref$useGlobals === void 0 ? true : _ref$useGlobals,
24
25
  _ref$useCache = _ref.useCache,
25
- useCache = _ref$useCache === void 0 ? true : _ref$useCache;
26
+ useCache = _ref$useCache === void 0 ? true : _ref$useCache,
27
+ _ref$useIcons = _ref.useIcons,
28
+ useIcons = _ref$useIcons === void 0 ? true : _ref$useIcons;
26
29
  var _useContext = useContext(GamutContext),
27
30
  hasGlobals = _useContext.hasGlobals,
28
31
  hasCache = _useContext.hasCache;
@@ -49,7 +52,10 @@ export var GamutProvider = function GamutProvider(_ref) {
49
52
  value: activeCache.current,
50
53
  children: [globals, /*#__PURE__*/_jsx(ThemeProvider, {
51
54
  theme: theme,
52
- children: children
55
+ children: /*#__PURE__*/_jsx(UniqueIdProvider, {
56
+ useUniqueIconIds: useIcons,
57
+ children: children
58
+ })
53
59
  })]
54
60
  })
55
61
  });
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ import { ProviderProps } from '@inline-svg-unique-id/react';
3
+ export interface UniqueIdProviderProps extends ProviderProps {
4
+ useUniqueIconIds?: boolean;
5
+ }
6
+ export declare const UniqueIdProvider: React.FC<UniqueIdProviderProps>;
@@ -0,0 +1,15 @@
1
+ import { Provider as UniqueIdGeneratorProvider } from '@inline-svg-unique-id/react';
2
+ import { Fragment as _Fragment } from "react/jsx-runtime";
3
+ import { jsx as _jsx } from "react/jsx-runtime";
4
+ export var UniqueIdProvider = function UniqueIdProvider(_ref) {
5
+ var _ref$useUniqueIconIds = _ref.useUniqueIconIds,
6
+ useUniqueIconIds = _ref$useUniqueIconIds === void 0 ? true : _ref$useUniqueIconIds,
7
+ children = _ref.children;
8
+ if (!useUniqueIconIds) /*#__PURE__*/_jsx(_Fragment, {
9
+ children: children
10
+ });
11
+ return /*#__PURE__*/_jsx(UniqueIdGeneratorProvider, {
12
+ idPrefix: "custom-prefix",
13
+ children: children
14
+ });
15
+ };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@codecademy/gamut-styles",
3
3
  "description": "Styleguide & Component library for codecademy.com",
4
- "version": "16.0.0-alpha.b81ea9.0",
4
+ "version": "16.0.0-alpha.cef563.0",
5
5
  "author": "Jake Hiller <jake@codecademy.com>",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -29,6 +29,7 @@
29
29
  "@emotion/cache": "^11.4.0",
30
30
  "@emotion/react": "^11.4.0",
31
31
  "@emotion/styled": "^11.3.0",
32
+ "@inline-svg-unique-id/react": "^1.2.3",
32
33
  "lodash": "^4.17.5",
33
34
  "react": "^17.0.2 || ^18.2.0",
34
35
  "stylis": "^4.0.7"
@@ -41,5 +42,5 @@
41
42
  "publishConfig": {
42
43
  "access": "public"
43
44
  },
44
- "gitHead": "425fbe0689bf193c04b857b2154302b43a2c934c"
45
+ "gitHead": "e6aa918eee5efd8a4f91ebe17a68e32d073beb09"
45
46
  }