@codecademy/gamut-styles 14.2.5 → 14.2.6-alpha.2d69f5.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.
- package/dist/AssetProvider.js +2 -2
- package/dist/Background.js +19 -42
- package/dist/ColorMode.js +31 -51
- package/dist/GamutProvider.d.ts +1 -0
- package/dist/GamutProvider.js +12 -16
- package/dist/cache/createEmotionCache.d.ts +1 -1
- package/dist/cache/createEmotionCache.js +6 -15
- package/dist/cache/stylisPlugins/focusVisible.js +0 -1
- package/dist/globals/Typography.js +9 -9
- package/dist/globals/Variables.js +7 -14
- package/dist/styles/boxShadow.d.ts +1 -1
- package/dist/styles/boxShadow.js +9 -16
- package/dist/styles/noSelect.d.ts +1 -1
- package/dist/styles/noSelect.js +0 -1
- package/dist/styles/screenReaderOnly.d.ts +2 -2
- package/dist/styles/screenReaderOnly.js +0 -1
- package/dist/themes/core.js +1 -0
- package/dist/themes/platform.js +1 -0
- package/dist/utilities/themed.js +1 -0
- package/dist/variables/colors.js +5 -4
- package/dist/variables/deprecated-colors.js +10 -6
- package/dist/variables/elements.js +0 -1
- package/dist/variables/index.js +2 -2
- package/dist/variables/responsive.js +0 -2
- package/dist/variance/config.js +4 -6
- package/dist/variance/props.js +3 -3
- package/dist/variance/utils.js +2 -8
- package/package.json +5 -6
package/dist/AssetProvider.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { Helmet } from 'react-helmet';
|
|
1
|
+
import { Helmet } from 'react-helmet-async';
|
|
2
2
|
import { webFonts } from './remoteAssets/fonts';
|
|
3
3
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
4
|
export var createFontLinks = function createFontLinks() {
|
|
5
5
|
return webFonts.flatMap(function (_ref) {
|
|
6
6
|
var filePath = _ref.filePath,
|
|
7
|
-
|
|
7
|
+
extensions = _ref.extensions;
|
|
8
8
|
return extensions.map(function (ext) {
|
|
9
9
|
return /*#__PURE__*/_jsx("link", {
|
|
10
10
|
rel: "preload",
|
package/dist/Background.js
CHANGED
|
@@ -1,63 +1,44 @@
|
|
|
1
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
|
-
|
|
3
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; }
|
|
4
|
-
|
|
5
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; }
|
|
6
|
-
|
|
7
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
8
|
-
|
|
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; }
|
|
9
5
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
10
|
-
|
|
11
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); }
|
|
12
|
-
|
|
13
7
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
14
|
-
|
|
15
8
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
16
|
-
|
|
17
9
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
18
|
-
|
|
19
10
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
20
|
-
|
|
21
|
-
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
22
|
-
|
|
11
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0) { ; } } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
23
12
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
24
|
-
|
|
25
13
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
26
|
-
|
|
27
14
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
28
|
-
|
|
29
15
|
import { getContrast } from 'polished';
|
|
30
16
|
import { forwardRef, useCallback, useMemo } from 'react';
|
|
31
17
|
import { ColorMode, useColorModes } from './ColorMode';
|
|
32
18
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
33
|
-
|
|
34
19
|
var isColorAlias = function isColorAlias(mode, color) {
|
|
35
20
|
return Object.keys(mode).includes(color);
|
|
36
21
|
};
|
|
37
|
-
|
|
38
22
|
export var Background = /*#__PURE__*/forwardRef(function Background(_ref, ref) {
|
|
39
23
|
var bg = _ref.bg,
|
|
40
|
-
|
|
41
|
-
|
|
24
|
+
rest = _objectWithoutProperties(_ref, ["bg"]);
|
|
42
25
|
var _useColorModes = useColorModes(),
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
26
|
+
_useColorModes2 = _slicedToArray(_useColorModes, 4),
|
|
27
|
+
active = _useColorModes2[0],
|
|
28
|
+
activeColors = _useColorModes2[1],
|
|
29
|
+
modes = _useColorModes2[2],
|
|
30
|
+
getColorValue = _useColorModes2[3];
|
|
48
31
|
/** If a color alias was used then look up the true color key from the active mode */
|
|
49
|
-
|
|
50
|
-
|
|
51
32
|
var trueColor = useMemo(function () {
|
|
52
33
|
if (isColorAlias(activeColors, bg)) {
|
|
53
34
|
return activeColors[bg];
|
|
54
35
|
}
|
|
55
|
-
|
|
56
36
|
return bg;
|
|
57
37
|
}, [bg, activeColors]);
|
|
58
38
|
var getTextContrast = useCallback(function (foreground) {
|
|
59
39
|
return getContrast(getColorValue(foreground), getColorValue(trueColor));
|
|
60
40
|
}, [trueColor, getColorValue]);
|
|
41
|
+
|
|
61
42
|
/**
|
|
62
43
|
* This compares the contrast of the selected background color
|
|
63
44
|
* and each color modes body text and returns the mode that has
|
|
@@ -70,9 +51,9 @@ export var Background = /*#__PURE__*/forwardRef(function Background(_ref, ref) {
|
|
|
70
51
|
|
|
71
52
|
var accessibleMode = useMemo(function () {
|
|
72
53
|
var activeMode = modes[active],
|
|
73
|
-
|
|
74
|
-
|
|
54
|
+
otherModes = _objectWithoutProperties(modes, [active].map(_toPropertyKey));
|
|
75
55
|
var possibleModes = Object.entries(otherModes);
|
|
56
|
+
|
|
76
57
|
/**
|
|
77
58
|
* Reduce all remaining modes to the mode key with the highest contrast
|
|
78
59
|
* value.
|
|
@@ -81,23 +62,19 @@ export var Background = /*#__PURE__*/forwardRef(function Background(_ref, ref) {
|
|
|
81
62
|
* it will likelyfail to return a mode outside of the lighest and
|
|
82
63
|
* darkest versions.
|
|
83
64
|
*/
|
|
84
|
-
|
|
85
65
|
var _possibleModes$reduce = possibleModes.reduce(function (_ref2, _ref3) {
|
|
86
|
-
|
|
66
|
+
var _ref4 = _slicedToArray(_ref2, 2),
|
|
87
67
|
prevMode = _ref4[0],
|
|
88
68
|
prevContrast = _ref4[1];
|
|
89
|
-
|
|
90
|
-
var _ref5 = _slicedToArray(_ref3, 2),
|
|
69
|
+
var _ref5 = _slicedToArray(_ref3, 2),
|
|
91
70
|
mode = _ref5[0],
|
|
92
71
|
text = _ref5[1].text;
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
highestContrastMode = _possibleModes$reduce2[0];
|
|
100
|
-
|
|
72
|
+
var contrast = getTextContrast(text);
|
|
73
|
+
// Keep the higher contrast mode.
|
|
74
|
+
return contrast > prevContrast ? [mode, contrast] : [prevMode, prevContrast];
|
|
75
|
+
}, [active, getTextContrast(activeMode.text)]),
|
|
76
|
+
_possibleModes$reduce2 = _slicedToArray(_possibleModes$reduce, 1),
|
|
77
|
+
highestContrastMode = _possibleModes$reduce2[0];
|
|
101
78
|
return highestContrastMode;
|
|
102
79
|
}, [modes, active, getTextContrast]);
|
|
103
80
|
return /*#__PURE__*/_jsx(ColorMode, _objectSpread(_objectSpread({}, rest), {}, {
|
package/dist/ColorMode.js
CHANGED
|
@@ -1,29 +1,19 @@
|
|
|
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); }
|
|
1
2
|
import _styled from "@emotion/styled/base";
|
|
2
|
-
|
|
3
3
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
4
|
-
|
|
5
4
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
6
|
-
|
|
7
5
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
8
|
-
|
|
9
6
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
10
|
-
|
|
11
7
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
12
|
-
|
|
13
8
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
14
|
-
|
|
15
|
-
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
16
|
-
|
|
9
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0) { ; } } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
17
10
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
18
|
-
|
|
19
11
|
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; }
|
|
20
|
-
|
|
21
12
|
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; }
|
|
22
|
-
|
|
23
|
-
function
|
|
24
|
-
|
|
13
|
+
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; }
|
|
14
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
15
|
+
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); }
|
|
25
16
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
26
|
-
|
|
27
17
|
import { serializeTokens, variance } from '@codecademy/variance';
|
|
28
18
|
import { ThemeProvider, useTheme } from '@emotion/react';
|
|
29
19
|
import { mapValues, pick } from 'lodash';
|
|
@@ -34,7 +24,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
34
24
|
export var providerProps = variance.compose(layout, color, grid, flex, positioning, space, border, background);
|
|
35
25
|
export var modeColorProps = function modeColorProps(_ref) {
|
|
36
26
|
var theme = _ref.theme,
|
|
37
|
-
|
|
27
|
+
mode = _ref.mode;
|
|
38
28
|
if (!theme || !mode || mode === (theme === null || theme === void 0 ? void 0 : theme.mode)) return {};
|
|
39
29
|
var colors = theme.colors;
|
|
40
30
|
return serializeTokens(mapValues(theme === null || theme === void 0 ? void 0 : theme.modes[mode], function (color) {
|
|
@@ -46,44 +36,37 @@ var BackgroundCurrentContext = /*#__PURE__*/createContext({
|
|
|
46
36
|
});
|
|
47
37
|
export function useColorModes() {
|
|
48
38
|
var bgCurrent = useContext(BackgroundCurrentContext);
|
|
49
|
-
|
|
50
39
|
var _ref2 = useTheme() || {},
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
40
|
+
mode = _ref2.mode,
|
|
41
|
+
modes = _ref2.modes,
|
|
42
|
+
getColorValue = _ref2._getColorValue;
|
|
55
43
|
var modesCopy = _objectSpread({}, modes);
|
|
56
|
-
|
|
57
44
|
if (bgCurrent['background-current'] && modesCopy[mode]['background-current'] !== bgCurrent['background-current']) {
|
|
58
45
|
/* sets the color to the copy of our modes object, and casts the type as the default color values for background-current.
|
|
59
46
|
we could potentially alter the Merge type utility function from createTheme, but since 'background-current' is the only exception to the type-merging rule and this is the only place we override, this seems to be a more straightforward + lower-risk solution.
|
|
60
47
|
*/
|
|
48
|
+
|
|
61
49
|
modesCopy[mode]['background-current'] = bgCurrent['background-current'];
|
|
62
50
|
}
|
|
63
|
-
|
|
64
51
|
return [mode, modesCopy === null || modesCopy === void 0 ? void 0 : modesCopy[mode], modes, getColorValue];
|
|
65
52
|
}
|
|
66
53
|
export function useCurrentMode(mode) {
|
|
67
54
|
var _useColorModes = useColorModes(),
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
55
|
+
_useColorModes2 = _slicedToArray(_useColorModes, 1),
|
|
56
|
+
activeMode = _useColorModes2[0];
|
|
71
57
|
return mode !== null && mode !== void 0 ? mode : activeMode;
|
|
72
58
|
}
|
|
73
59
|
export function usePrefersDarkMode() {
|
|
74
60
|
var _useState = useState(false),
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
61
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
62
|
+
prefersDarkMode = _useState2[0],
|
|
63
|
+
setPrefersDarkMode = _useState2[1];
|
|
79
64
|
useEffect(function () {
|
|
80
65
|
function onChange(event) {
|
|
81
66
|
setPrefersDarkMode(event.matches);
|
|
82
67
|
}
|
|
83
|
-
|
|
84
68
|
if (window && 'matchMedia' in window) {
|
|
85
69
|
var mq = window.matchMedia('(prefers-color-scheme: dark)');
|
|
86
|
-
|
|
87
70
|
if (mq && 'addEventListener' in mq) {
|
|
88
71
|
setPrefersDarkMode(mq.matches);
|
|
89
72
|
mq.addEventListener('change', onChange);
|
|
@@ -106,39 +89,37 @@ export var VariableProvider = /*#__PURE__*/_styled('div', _extends({}, {
|
|
|
106
89
|
}), providerProps, process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9Db2xvck1vZGUudHN4Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQW9JZ0MiLCJmaWxlIjoiLi4vc3JjL0NvbG9yTW9kZS50c3giLCJzb3VyY2VzQ29udGVudCI6WyJpbXB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+XG4gICAgKTtcbiAgfVxuXG4gIHJldHVybiAoXG4gICAgPFRoZW1lUHJvdmlkZXIgdGhlbWU9e3sgbW9kZSB9fT5cbiAgICAgIDxWYXJpYWJsZVByb3ZpZGVyXG4gICAgICAgIHsuLi5yZXN0fVxuICAgICAgICB2YXJpYWJsZXM9e3ZhcmlhYmxlc31cbiAgICAgICAgYmc9e2NvbnRleHRCZ31cbiAgICAgICAgcmVmPXtyZWZ9XG4gICAgICAvPlxuICAgIDwvVGhlbWVQcm92aWRlcj5cbiAgKTtcbn0pO1xuIl19 */");
|
|
107
90
|
export var ColorMode = /*#__PURE__*/forwardRef(function ColorMode(_ref4, ref) {
|
|
108
91
|
var preference = _ref4.mode,
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
92
|
+
alwaysSetVariables = _ref4.alwaysSetVariables,
|
|
93
|
+
bg = _ref4.bg,
|
|
94
|
+
rest = _objectWithoutProperties(_ref4, ["mode", "alwaysSetVariables", "bg"]);
|
|
113
95
|
// checks if the user has set 'system' as their color mode preference
|
|
114
96
|
// then sets the color mode
|
|
115
97
|
var prefersDarkMode = usePrefersDarkMode();
|
|
116
98
|
var mode = preference === 'system' ? prefersDarkMode ? 'dark' : 'light' : preference;
|
|
117
99
|
var theme = useTheme();
|
|
118
100
|
var modes = theme.modes,
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
var contextBg = bg ? 'background-current' : undefined;
|
|
101
|
+
active = theme.mode,
|
|
102
|
+
colors = theme.colors;
|
|
103
|
+
var contextBg = bg ? 'background-current' : undefined;
|
|
122
104
|
|
|
105
|
+
// This makes sure the background-current context is always set to the correct color + not the semantic color name.
|
|
123
106
|
var currentParentBg = useContext(BackgroundCurrentContext);
|
|
124
107
|
var bgCurrent = bg === 'background-current' ? currentParentBg['background-current'] ? currentParentBg['background-current'] : modes[active]['background-current'] : bg;
|
|
108
|
+
|
|
125
109
|
/** Serialize color variables for the current mode
|
|
126
110
|
* 1. If all variables are required add all mode variables to the current context
|
|
127
111
|
* 2. If the user has specified a background color - set that color to the current-bg
|
|
128
112
|
* 3. If not
|
|
129
113
|
*/
|
|
130
|
-
|
|
131
114
|
var _useMemo = useMemo(function () {
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
variables = _useMemo.variables;
|
|
141
|
-
|
|
115
|
+
return serializeTokens(mapValues(modes[mode], function (color, key) {
|
|
116
|
+
if (key === 'background-current' && typeof bg !== 'undefined') {
|
|
117
|
+
return colors[bg];
|
|
118
|
+
}
|
|
119
|
+
return colors[color];
|
|
120
|
+
}), 'color', theme);
|
|
121
|
+
}, [colors, mode, modes, theme, bg]),
|
|
122
|
+
variables = _useMemo.variables;
|
|
142
123
|
if (active === mode) {
|
|
143
124
|
var vars = alwaysSetVariables ? variables : pick(variables, ['--color-background-current']);
|
|
144
125
|
return /*#__PURE__*/_jsx(BackgroundCurrentContext.Provider, {
|
|
@@ -152,7 +133,6 @@ export var ColorMode = /*#__PURE__*/forwardRef(function ColorMode(_ref4, ref) {
|
|
|
152
133
|
}))
|
|
153
134
|
});
|
|
154
135
|
}
|
|
155
|
-
|
|
156
136
|
return /*#__PURE__*/_jsx(ThemeProvider, {
|
|
157
137
|
theme: {
|
|
158
138
|
mode: mode
|
package/dist/GamutProvider.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { CSSObject } from '@codecademy/variance';
|
|
|
2
2
|
import { EmotionCache, Theme } from '@emotion/react';
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
export interface GamutProviderProps {
|
|
5
|
+
children?: React.ReactNode;
|
|
5
6
|
useGlobals?: boolean;
|
|
6
7
|
useCache?: boolean;
|
|
7
8
|
theme: Theme;
|
package/dist/GamutProvider.js
CHANGED
|
@@ -15,28 +15,26 @@ export var GamutContext = /*#__PURE__*/React.createContext({
|
|
|
15
15
|
GamutContext.displayName = 'GamutContext';
|
|
16
16
|
export var GamutProvider = function GamutProvider(_ref) {
|
|
17
17
|
var children = _ref.children,
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
18
|
+
cache = _ref.cache,
|
|
19
|
+
_ref$theme = _ref.theme,
|
|
20
|
+
theme = _ref$theme === void 0 ? coreTheme : _ref$theme,
|
|
21
|
+
variables = _ref.variables,
|
|
22
|
+
_ref$useGlobals = _ref.useGlobals,
|
|
23
|
+
useGlobals = _ref$useGlobals === void 0 ? true : _ref$useGlobals,
|
|
24
|
+
_ref$useCache = _ref.useCache,
|
|
25
|
+
useCache = _ref$useCache === void 0 ? true : _ref$useCache;
|
|
27
26
|
var _useContext = useContext(GamutContext),
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
hasGlobals = _useContext.hasGlobals,
|
|
28
|
+
hasCache = _useContext.hasCache;
|
|
31
29
|
var shouldCreateCache = useCache && !hasCache;
|
|
32
|
-
var shouldInsertGlobals = useGlobals && !hasGlobals;
|
|
30
|
+
var shouldInsertGlobals = useGlobals && !hasGlobals;
|
|
33
31
|
|
|
32
|
+
// Do not initialize a new cache if one has been provided as props
|
|
34
33
|
var activeCache = useRef(shouldCreateCache && (cache !== null && cache !== void 0 ? cache : createEmotionCache()));
|
|
35
34
|
var contextValue = {
|
|
36
35
|
hasGlobals: shouldInsertGlobals,
|
|
37
36
|
hasCache: shouldCreateCache
|
|
38
37
|
};
|
|
39
|
-
|
|
40
38
|
var globals = shouldInsertGlobals && /*#__PURE__*/_jsxs(_Fragment, {
|
|
41
39
|
children: [/*#__PURE__*/_jsx(Typography, {}), /*#__PURE__*/_jsx(Reboot, {}), /*#__PURE__*/_jsx(Variables, {
|
|
42
40
|
variables: theme._variables
|
|
@@ -44,7 +42,6 @@ export var GamutProvider = function GamutProvider(_ref) {
|
|
|
44
42
|
variables: variables
|
|
45
43
|
})]
|
|
46
44
|
});
|
|
47
|
-
|
|
48
45
|
if (activeCache.current) {
|
|
49
46
|
return /*#__PURE__*/_jsx(GamutContext.Provider, {
|
|
50
47
|
value: contextValue,
|
|
@@ -57,7 +54,6 @@ export var GamutProvider = function GamutProvider(_ref) {
|
|
|
57
54
|
})
|
|
58
55
|
});
|
|
59
56
|
}
|
|
60
|
-
|
|
61
57
|
return /*#__PURE__*/_jsxs(GamutContext.Provider, {
|
|
62
58
|
value: contextValue,
|
|
63
59
|
children: [globals, /*#__PURE__*/_jsx(ThemeProvider, {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { Options } from '@emotion/cache';
|
|
2
2
|
export declare const EMOTION_KEY = "gamut";
|
|
3
3
|
export declare const EMOTION_CONTAINER = "emotion-styles";
|
|
4
|
-
export declare const createEmotionCache: (overrides?: Partial<Options> | undefined) => import("@emotion/
|
|
4
|
+
export declare const createEmotionCache: (overrides?: Partial<Options> | undefined) => import("@emotion/utils").EmotionCache;
|
|
@@ -1,44 +1,35 @@
|
|
|
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); }
|
|
1
2
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
2
|
-
|
|
3
3
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
|
-
|
|
5
4
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
6
|
-
|
|
7
5
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
8
|
-
|
|
9
6
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
10
|
-
|
|
11
7
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
12
|
-
|
|
13
8
|
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; }
|
|
14
|
-
|
|
15
9
|
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; }
|
|
16
|
-
|
|
17
|
-
function
|
|
18
|
-
|
|
10
|
+
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; }
|
|
11
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
12
|
+
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); }
|
|
19
13
|
import createCache from '@emotion/cache';
|
|
20
14
|
import { prefixer } from 'stylis';
|
|
21
15
|
import { focusVisible } from './stylisPlugins';
|
|
22
16
|
export var EMOTION_KEY = 'gamut';
|
|
23
17
|
export var EMOTION_CONTAINER = 'emotion-styles';
|
|
24
|
-
|
|
25
18
|
var getEmotionNode = function getEmotionNode() {
|
|
26
19
|
if (typeof document === 'undefined') {
|
|
27
20
|
return;
|
|
28
21
|
}
|
|
29
|
-
|
|
30
22
|
var node = document.getElementById(EMOTION_CONTAINER);
|
|
31
23
|
if (node) return node;
|
|
32
24
|
node = document.createElement('div');
|
|
33
|
-
node.setAttribute('id', EMOTION_CONTAINER);
|
|
25
|
+
node.setAttribute('id', EMOTION_CONTAINER);
|
|
34
26
|
|
|
27
|
+
// if this has not been created add it to the DOM at the top of the body
|
|
35
28
|
document.getElementsByTagName('body')[0].prepend(node);
|
|
36
29
|
return node;
|
|
37
30
|
};
|
|
38
|
-
|
|
39
31
|
export var createEmotionCache = function createEmotionCache(overrides) {
|
|
40
32
|
var _overrides$container, _overrides$stylisPlug;
|
|
41
|
-
|
|
42
33
|
return createCache(_objectSpread(_objectSpread({
|
|
43
34
|
key: EMOTION_KEY,
|
|
44
35
|
speedy: process.env.NODE_ENV !== 'development',
|
|
@@ -3,17 +3,17 @@ import { webFonts } from '../remoteAssets/fonts';
|
|
|
3
3
|
import { coreTheme as theme } from '../themes';
|
|
4
4
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
5
|
var fontSize = theme.fontSize,
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
spacing = theme.spacing,
|
|
7
|
+
fontWeight = theme.fontWeight,
|
|
8
|
+
lineHeight = theme.lineHeight;
|
|
9
9
|
var typographyGlobals = /*#__PURE__*/css(webFonts.map(function (_ref) {
|
|
10
10
|
var name = _ref.name,
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
11
|
+
_ref$style = _ref.style,
|
|
12
|
+
style = _ref$style === void 0 ? 'normal' : _ref$style,
|
|
13
|
+
_ref$weight = _ref.weight,
|
|
14
|
+
weight = _ref$weight === void 0 ? 'normal' : _ref$weight,
|
|
15
|
+
extensions = _ref.extensions,
|
|
16
|
+
filePath = _ref.filePath;
|
|
17
17
|
return /*#__PURE__*/css("@font-face{font-display:swap;font-family:'", name, "';font-style:", style, ";font-weight:", weight, ";src:", extensions.map(function (ext) {
|
|
18
18
|
return "url(\"".concat(filePath, ".").concat(ext, "\") format(\"").concat(ext, "\")");
|
|
19
19
|
}).join(', '), ";};label:typographyGlobals;" + (process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9nbG9iYWxzL1R5cG9ncmFwaHkudHN4Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQWVhIiwiZmlsZSI6Ii4uLy4uL3NyYy9nbG9iYWxzL1R5cG9ncmFwaHkudHN4Iiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgY3NzLCBHbG9iYWwgfSBmcm9tICdAZW1vdGlvbi9yZWFjdCc7XG5cbmltcG9ydCB7IHdlYkZvbnRzIH0gZnJvbSAnLi4vcmVtb3RlQXNzZXRzL2ZvbnRzJztcbmltcG9ydCB7IGNvcmVUaGVtZSBhcyB0aGVtZSB9IGZyb20gJy4uL3RoZW1lcyc7XG5cbmNvbnN0IHsgZm9udFNpemUsIHNwYWNpbmcsIGZvbnRXZWlnaHQsIGxpbmVIZWlnaHQgfSA9IHRoZW1lO1xuXG5jb25zdCB0eXBvZ3JhcGh5R2xvYmFscyA9IGNzc2BcbiAgJHt3ZWJGb250cy5tYXAoXG4gICAgKHtcbiAgICAgIG5hbWUsXG4gICAgICBzdHlsZSA9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uICAgIGZvbnQtc2l6ZTogJHtmb250U2l6ZVsxNF19O1xuICAgIGZvbnQtd2VpZ2h0OiAke2ZvbnRXZWlnaHQuYmFzZX07XG4gIH1cbmA7XG5cbmV4cG9ydCBjb25zdCBUeXBvZ3JhcGh5ID0gKCkgPT4gPEdsb2JhbCBzdHlsZXM9e3R5cG9ncmFwaHlHbG9iYWxzfSAvPjtcbiJdfQ== */"));
|
|
@@ -1,35 +1,28 @@
|
|
|
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); }
|
|
1
2
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
-
|
|
3
3
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
|
-
|
|
5
4
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
6
|
-
|
|
7
5
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
8
|
-
|
|
9
|
-
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
10
|
-
|
|
6
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0) { ; } } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
11
7
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
12
|
-
|
|
13
|
-
function
|
|
14
|
-
|
|
8
|
+
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; }
|
|
9
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
10
|
+
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); }
|
|
15
11
|
import { css, Global } from '@emotion/react';
|
|
16
12
|
import * as React from 'react';
|
|
17
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
18
14
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
19
|
-
|
|
20
15
|
var scopeVariables = function scopeVariables(vars) {
|
|
21
16
|
var scope = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ':root';
|
|
22
17
|
return /*#__PURE__*/css(_defineProperty({}, scope, vars), ";label:scopeVariables;" + (process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9nbG9iYWxzL1ZhcmlhYmxlcy50c3giXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBS0UiLCJmaWxlIjoiLi4vLi4vc3JjL2dsb2JhbHMvVmFyaWFibGVzLnRzeCIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IENTU09iamVjdCB9IGZyb20gJ0Bjb2RlY2FkZW15L3ZhcmlhbmNlJztcbmltcG9ydCB7IGNzcywgR2xvYmFsIH0gZnJvbSAnQGVtb3Rpb24vcmVhY3QnO1xuaW1wb3J0ICogYXMgUmVhY3QgZnJvbSAncmVhY3QnO1xuXG5jb25zdCBzY29wZVZhcmlhYmxlcyA9ICh2YXJzOiBDU1NPYmplY3QsIHNjb3BlID0gJzpyb290JykgPT5cbiAgY3NzKHsgW3Njb3BlXTogdmFycyB9KTtcblxuZXhwb3J0IGNvbnN0IFZhcmlhYmxlczogUmVhY3QuRkM8e1xuICB2YXJpYWJsZXM6IFJlY29yZDxzdHJpbmcsIENTU09iamVjdD47XG59PiA9ICh7IHZhcmlhYmxlcyB9KSA9PiB7XG4gIHJldHVybiAoXG4gICAgPD5cbiAgICAgIHtPYmplY3QuZW50cmllcyh2YXJpYWJsZXMpLm1hcCgoW2tleSwgdmFyc10pID0+IChcbiAgICAgICAgPEdsb2JhbCBrZXk9e2tleX0gc3R5bGVzPXtzY29wZVZhcmlhYmxlcyh2YXJzKX0gLz5cbiAgICAgICkpfVxuICAgIDwvPlxuICApO1xufTtcbiJdfQ== */"));
|
|
23
18
|
};
|
|
24
|
-
|
|
25
19
|
export var Variables = function Variables(_ref) {
|
|
26
20
|
var variables = _ref.variables;
|
|
27
21
|
return /*#__PURE__*/_jsx(_Fragment, {
|
|
28
22
|
children: Object.entries(variables).map(function (_ref2) {
|
|
29
23
|
var _ref3 = _slicedToArray(_ref2, 2),
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
24
|
+
key = _ref3[0],
|
|
25
|
+
vars = _ref3[1];
|
|
33
26
|
return /*#__PURE__*/_jsx(Global, {
|
|
34
27
|
styles: scopeVariables(vars)
|
|
35
28
|
}, key);
|
|
@@ -22,5 +22,5 @@ declare const shadowsForDepth: {
|
|
|
22
22
|
};
|
|
23
23
|
};
|
|
24
24
|
export declare const createShadow: (depth: ShadowDepth) => string;
|
|
25
|
-
export declare const boxShadow: (depth?: ShadowDepth) => import("@emotion/
|
|
25
|
+
export declare const boxShadow: (depth?: ShadowDepth) => import("@emotion/utils").SerializedStyles;
|
|
26
26
|
export {};
|
package/dist/styles/boxShadow.js
CHANGED
|
@@ -1,15 +1,9 @@
|
|
|
1
1
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
-
|
|
3
2
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
|
-
|
|
5
3
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
6
|
-
|
|
7
4
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
8
|
-
|
|
9
|
-
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
10
|
-
|
|
5
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0) { ; } } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
11
6
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
12
|
-
|
|
13
7
|
import { css } from '@emotion/react';
|
|
14
8
|
var shadowsForDepth = {
|
|
15
9
|
1: {
|
|
@@ -35,15 +29,14 @@ var shadowsForDepth = {
|
|
|
35
29
|
};
|
|
36
30
|
export var createShadow = function createShadow(depth) {
|
|
37
31
|
var _shadowsForDepth$dept = shadowsForDepth[depth],
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
32
|
+
_shadowsForDepth$dept2 = _slicedToArray(_shadowsForDepth$dept.offsets, 4),
|
|
33
|
+
o1 = _shadowsForDepth$dept2[0],
|
|
34
|
+
o2 = _shadowsForDepth$dept2[1],
|
|
35
|
+
o3 = _shadowsForDepth$dept2[2],
|
|
36
|
+
o4 = _shadowsForDepth$dept2[3],
|
|
37
|
+
_shadowsForDepth$dept3 = _slicedToArray(_shadowsForDepth$dept.shades, 2),
|
|
38
|
+
s1 = _shadowsForDepth$dept3[0],
|
|
39
|
+
s2 = _shadowsForDepth$dept3[1];
|
|
47
40
|
return " 0 ".concat(o1, "px ").concat(o2, "px rgba(0, 0, 0, ").concat(s1, "),\n 0 ").concat(o3, "px ").concat(o4, "px rgba(0, 0, 0, ").concat(s2, ")");
|
|
48
41
|
};
|
|
49
42
|
export var boxShadow = function boxShadow() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const noSelect: import("@emotion/
|
|
1
|
+
export declare const noSelect: import("@emotion/utils").SerializedStyles;
|
package/dist/styles/noSelect.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
|
|
2
|
-
|
|
3
2
|
import { css } from '@emotion/react';
|
|
4
3
|
export var noSelect = process.env.NODE_ENV === "production" ? {
|
|
5
4
|
name: "1ui1tha-noSelect",
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const screenReaderOnly: import("@emotion/
|
|
2
|
-
export declare const screenReaderOnlyFocusable: import("@emotion/
|
|
1
|
+
export declare const screenReaderOnly: import("@emotion/utils").SerializedStyles;
|
|
2
|
+
export declare const screenReaderOnlyFocusable: import("@emotion/utils").SerializedStyles;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
|
|
2
|
-
|
|
3
2
|
import { css } from '@emotion/react';
|
|
4
3
|
export var screenReaderOnly = process.env.NODE_ENV === "production" ? {
|
|
5
4
|
name: "ut38oz-screenReaderOnly",
|
package/dist/themes/core.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { createTheme } from '@codecademy/variance';
|
|
2
2
|
import { corePalette, elements, fontFamily, fontSize, fontWeight, lineHeight, mediaQueries, spacing } from '../variables';
|
|
3
|
+
|
|
3
4
|
/**
|
|
4
5
|
* @description This is the core theme that all other Codecademy themes are extended from
|
|
5
6
|
* and is the only theme that gamut components are typed to. This ensures that gamut components
|
package/dist/themes/platform.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { createTheme } from '@codecademy/variance';
|
|
2
2
|
import { platformPalette } from '../variables';
|
|
3
3
|
import { coreTheme } from './core';
|
|
4
|
+
|
|
4
5
|
/**
|
|
5
6
|
* @description This is an extended theme for the learning environment with an expanded set of tokens
|
|
6
7
|
* That are not needed for the rest of the application.
|
package/dist/utilities/themed.js
CHANGED
package/dist/variables/colors.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
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); }
|
|
1
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; }
|
|
2
|
-
|
|
3
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
|
-
|
|
5
|
-
function
|
|
6
|
-
|
|
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
7
|
import { flattenScale } from '@codecademy/variance';
|
|
8
8
|
import { rgba } from 'polished';
|
|
9
9
|
/**
|
|
@@ -105,6 +105,7 @@ export var trueColors = {
|
|
|
105
105
|
white: white
|
|
106
106
|
};
|
|
107
107
|
export var corePalette = _objectSpread(_objectSpread(_objectSpread({}, flattenScale(coreSwatches)), flattenScale(effects)), trueColors);
|
|
108
|
+
|
|
108
109
|
/**
|
|
109
110
|
* Platform Colors
|
|
110
111
|
*/
|
|
@@ -1,24 +1,24 @@
|
|
|
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); }
|
|
1
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; }
|
|
2
|
-
|
|
3
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
|
-
|
|
5
|
-
function
|
|
6
|
-
|
|
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
7
|
import { flattenScale } from '@codecademy/variance';
|
|
8
8
|
import { corePalette } from './colors';
|
|
9
9
|
var black = corePalette.black,
|
|
10
|
-
|
|
10
|
+
white = corePalette.white;
|
|
11
11
|
/**
|
|
12
12
|
* @deprecated
|
|
13
13
|
* Using these variables directly is no longer supported.
|
|
14
14
|
*
|
|
15
15
|
* Please use [`theme.colors`](https://gamut.codecademy.com/storybook/?path=/docs/foundations-theme--colors#standard-colors)
|
|
16
16
|
*/
|
|
17
|
-
|
|
18
17
|
export var interactiveColors = {
|
|
19
18
|
dark: corePalette.hyper,
|
|
20
19
|
light: corePalette.yellow
|
|
21
20
|
};
|
|
21
|
+
|
|
22
22
|
/**
|
|
23
23
|
* @deprecated
|
|
24
24
|
* Using these variables directly is no longer supported.
|
|
@@ -36,6 +36,7 @@ export var editorColors = {
|
|
|
36
36
|
red: '#ea6c8b',
|
|
37
37
|
yellow: '#ffe083'
|
|
38
38
|
};
|
|
39
|
+
|
|
39
40
|
/**
|
|
40
41
|
* @deprecated
|
|
41
42
|
* Using these variables directly is no longer supported.
|
|
@@ -60,6 +61,7 @@ export var platformColors = {
|
|
|
60
61
|
'900': '#15141f'
|
|
61
62
|
}
|
|
62
63
|
};
|
|
64
|
+
|
|
63
65
|
/**
|
|
64
66
|
* @deprecated
|
|
65
67
|
* Using these variables directly is no longer supported.
|
|
@@ -115,6 +117,7 @@ export var swatches = {
|
|
|
115
117
|
'900': '#19191a'
|
|
116
118
|
}
|
|
117
119
|
};
|
|
120
|
+
|
|
118
121
|
/**
|
|
119
122
|
* @deprecated
|
|
120
123
|
* Using these variables directly is no longer supported.
|
|
@@ -141,6 +144,7 @@ var trueColors = {
|
|
|
141
144
|
black: black,
|
|
142
145
|
white: white
|
|
143
146
|
};
|
|
147
|
+
|
|
144
148
|
/**
|
|
145
149
|
* @deprecated
|
|
146
150
|
* Using these variables directly is no longer supported.
|
package/dist/variables/index.js
CHANGED
|
@@ -3,6 +3,6 @@ export * from './responsive';
|
|
|
3
3
|
export * from './spacing';
|
|
4
4
|
export * from './typography';
|
|
5
5
|
export * from './timing';
|
|
6
|
-
export * from './elements';
|
|
7
|
-
|
|
6
|
+
export * from './elements';
|
|
7
|
+
// Deprecated variables
|
|
8
8
|
export * from './deprecated-colors';
|
|
@@ -5,11 +5,9 @@ export var breakpoints = {
|
|
|
5
5
|
lg: '1200px',
|
|
6
6
|
xl: '1440px'
|
|
7
7
|
};
|
|
8
|
-
|
|
9
8
|
var createMediaQuery = function createMediaQuery(size, direction) {
|
|
10
9
|
return "@media only screen and (".concat(direction, "-width: ").concat(breakpoints[size], ")");
|
|
11
10
|
};
|
|
12
|
-
|
|
13
11
|
export var mediaQueries = {
|
|
14
12
|
xs: createMediaQuery('xs', 'min'),
|
|
15
13
|
sm: createMediaQuery('sm', 'min'),
|
package/dist/variance/config.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
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); }
|
|
1
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; }
|
|
2
|
-
|
|
3
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
|
-
|
|
5
|
-
function
|
|
6
|
-
|
|
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
7
|
import { transformSize } from '@codecademy/variance';
|
|
8
8
|
export var color = {
|
|
9
9
|
color: {
|
|
@@ -173,7 +173,6 @@ var selfAlignments = {
|
|
|
173
173
|
property: 'gridArea'
|
|
174
174
|
}
|
|
175
175
|
};
|
|
176
|
-
|
|
177
176
|
var alignments = _objectSpread({
|
|
178
177
|
justifyContent: {
|
|
179
178
|
property: 'justifyContent'
|
|
@@ -188,7 +187,6 @@ var alignments = _objectSpread({
|
|
|
188
187
|
property: 'alignContent'
|
|
189
188
|
}
|
|
190
189
|
}, selfAlignments);
|
|
191
|
-
|
|
192
190
|
var flexItems = {
|
|
193
191
|
flexBasis: {
|
|
194
192
|
property: 'flexBasis'
|
package/dist/variance/props.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { variance } from '@codecademy/variance';
|
|
2
2
|
import * as PROPERTIES from './config';
|
|
3
|
-
/** General Prop Groups */
|
|
4
3
|
|
|
4
|
+
/** General Prop Groups */
|
|
5
5
|
export var typography = variance.create(PROPERTIES.typography);
|
|
6
6
|
export var grid = variance.create(PROPERTIES.grid);
|
|
7
7
|
export var flex = variance.create(PROPERTIES.flex);
|
|
@@ -12,12 +12,12 @@ export var color = variance.create(PROPERTIES.color);
|
|
|
12
12
|
export var shadow = variance.create(PROPERTIES.shadows);
|
|
13
13
|
export var space = variance.create(PROPERTIES.space);
|
|
14
14
|
export var border = variance.create(PROPERTIES.border);
|
|
15
|
-
/** Sub Groups */
|
|
16
15
|
|
|
16
|
+
/** Sub Groups */
|
|
17
17
|
export var padding = variance.create(PROPERTIES.padding);
|
|
18
18
|
export var margin = variance.create(PROPERTIES.margin);
|
|
19
|
-
/** CSS */
|
|
20
19
|
|
|
20
|
+
/** CSS */
|
|
21
21
|
export var css = variance.createCss(PROPERTIES.all);
|
|
22
22
|
export var variant = variance.createVariant(PROPERTIES.all);
|
|
23
23
|
export var states = variance.createStates(PROPERTIES.all);
|
package/dist/variance/utils.js
CHANGED
|
@@ -1,23 +1,17 @@
|
|
|
1
1
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
2
|
-
|
|
3
2
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
|
-
|
|
5
3
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
6
|
-
|
|
7
4
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
8
|
-
|
|
9
5
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
10
|
-
|
|
11
6
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
12
|
-
|
|
13
7
|
import isPropValid from '@emotion/is-prop-valid';
|
|
14
8
|
import { all as allProps } from './config';
|
|
15
9
|
var allPropnames = ['mode', 'variant'].concat(_toConsumableArray(Object.keys(allProps)));
|
|
10
|
+
|
|
16
11
|
/**
|
|
17
12
|
* Emotion will not attempt to forward all system props - so this pre filters all possible exceptions to search agains
|
|
18
13
|
* props like `color` and `width`.
|
|
19
14
|
*/
|
|
20
|
-
|
|
21
15
|
var validPropnames = allPropnames.filter(isPropValid);
|
|
22
16
|
export function createStyledOptions() {
|
|
23
17
|
var additional = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
@@ -29,6 +23,7 @@ export function createStyledOptions() {
|
|
|
29
23
|
}
|
|
30
24
|
};
|
|
31
25
|
}
|
|
26
|
+
|
|
32
27
|
/**
|
|
33
28
|
* @description
|
|
34
29
|
* This object can be passed to the second argument of `styled('div', styledOptions)` or be called as a function to filter additional prop names
|
|
@@ -45,5 +40,4 @@ export function createStyledOptions() {
|
|
|
45
40
|
* styled(Box)()
|
|
46
41
|
*
|
|
47
42
|
*/
|
|
48
|
-
|
|
49
43
|
export var styledOptions = Object.assign(createStyledOptions, createStyledOptions());
|
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": "14.2.
|
|
4
|
+
"version": "14.2.6-alpha.2d69f5.0",
|
|
5
5
|
"author": "Jake Hiller <jake@codecademy.com>",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"url": "git@github.com:Codecademy/gamut.git"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@codecademy/variance": "0.20.
|
|
24
|
+
"@codecademy/variance": "0.20.6-alpha.2d69f5.0",
|
|
25
25
|
"@emotion/is-prop-valid": "^1.1.0",
|
|
26
26
|
"polished": "^4.1.2"
|
|
27
27
|
},
|
|
@@ -30,18 +30,17 @@
|
|
|
30
30
|
"@emotion/react": "^11.4.0",
|
|
31
31
|
"@emotion/styled": "^11.3.0",
|
|
32
32
|
"lodash": "^4.17.5",
|
|
33
|
-
"react": "
|
|
34
|
-
"react-helmet": "^
|
|
33
|
+
"react": "^17.0.2 || ^18.2.0",
|
|
34
|
+
"react-helmet-async": "^1.3.0",
|
|
35
35
|
"stylis": "^4.0.7"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@emotion/jest": "^11.3.0",
|
|
39
|
-
"@types/react-helmet": "^6.1.0",
|
|
40
39
|
"component-test-setup": "^0.3.1"
|
|
41
40
|
},
|
|
42
41
|
"license": "MIT",
|
|
43
42
|
"publishConfig": {
|
|
44
43
|
"access": "public"
|
|
45
44
|
},
|
|
46
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "b646576c8af36b23f5e1796868581e75bbd36708"
|
|
47
46
|
}
|