@codecademy/gamut-styles 16.0.0-alpha.18a7d7.0 → 16.0.0-alpha.20ae90.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,23 @@
1
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
3
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
4
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
6
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
7
+ import { Provider as UniqueIdGeneratorProvider } from '@inline-svg-unique-id/react';
8
+ import { Fragment as _Fragment } from "react/jsx-runtime";
9
+ import { jsx as _jsx } from "react/jsx-runtime";
10
+ export var UniqueIdProvider = function UniqueIdProvider(_ref) {
11
+ var _ref$useUniqueIconIds = _ref.useUniqueIconIds,
12
+ useUniqueIconIds = _ref$useUniqueIconIds === void 0 ? true : _ref$useUniqueIconIds,
13
+ children = _ref.children;
14
+ if (!useUniqueIconIds) /*#__PURE__*/_jsx(_Fragment, {
15
+ children: children
16
+ });
17
+ for (var _len = arguments.length, rest = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
18
+ rest[_key - 1] = arguments[_key];
19
+ }
20
+ return /*#__PURE__*/_jsx(UniqueIdGeneratorProvider, _objectSpread(_objectSpread({}, rest), {}, {
21
+ children: children
22
+ }));
23
+ };
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.18a7d7.0",
4
+ "version": "16.0.0-alpha.20ae90.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": "a7c2ec3e6fc7d2ec4aff79c4a590f2366ffc91a6"
45
+ "gitHead": "929afb126feff2eb0a29bc30eba3eddbecab37e2"
45
46
  }