@codecademy/gamut-styles 16.1.2 → 16.1.3-alpha.187436.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/package.json +3 -7
- package/dist/AssetProvider.d.ts +0 -3
- package/dist/AssetProvider.js +0 -23
- package/dist/Background.d.ts +0 -6
- package/dist/Background.js +0 -86
- package/dist/ColorMode.d.ts +0 -1278
- package/dist/ColorMode.js +0 -145
- package/dist/GamutProvider.d.ts +0 -16
- package/dist/GamutProvider.js +0 -64
- package/dist/cache/createEmotionCache.d.ts +0 -4
- package/dist/cache/createEmotionCache.js +0 -40
- package/dist/cache/index.d.ts +0 -1
- package/dist/cache/index.js +0 -1
- package/dist/cache/stylisPlugins/focusVisible.d.ts +0 -2
- package/dist/cache/stylisPlugins/focusVisible.js +0 -9
- package/dist/cache/stylisPlugins/index.d.ts +0 -1
- package/dist/cache/stylisPlugins/index.js +0 -1
- package/dist/globals/Reboot.d.ts +0 -2
- package/dist/globals/Reboot.js +0 -9
- package/dist/globals/Typography.d.ts +0 -2
- package/dist/globals/Typography.js +0 -25
- package/dist/globals/Variables.d.ts +0 -5
- package/dist/globals/Variables.js +0 -31
- package/dist/globals/index.d.ts +0 -2
- package/dist/globals/index.js +0 -2
- package/dist/index.d.ts +0 -13
- package/dist/index.js +0 -13
- package/dist/remoteAssets/fonts.d.ts +0 -26
- package/dist/remoteAssets/fonts.js +0 -31
- package/dist/styles/boxShadow.d.ts +0 -26
- package/dist/styles/boxShadow.js +0 -45
- package/dist/styles/fontSmoothing.d.ts +0 -29
- package/dist/styles/fontSmoothing.js +0 -29
- package/dist/styles/index.d.ts +0 -7
- package/dist/styles/index.js +0 -7
- package/dist/styles/noSelect.d.ts +0 -1
- package/dist/styles/noSelect.js +0 -11
- package/dist/styles/pxRem.d.ts +0 -1
- package/dist/styles/pxRem.js +0 -4
- package/dist/styles/responsive.d.ts +0 -6
- package/dist/styles/responsive.js +0 -14
- package/dist/styles/screenReaderOnly.d.ts +0 -2
- package/dist/styles/screenReaderOnly.js +0 -20
- package/dist/styles/transitionConcat.d.ts +0 -3
- package/dist/styles/transitionConcat.js +0 -7
- package/dist/themes/admin.d.ts +0 -874
- package/dist/themes/admin.js +0 -15
- package/dist/themes/core.d.ts +0 -472
- package/dist/themes/core.js +0 -111
- package/dist/themes/index.d.ts +0 -3
- package/dist/themes/index.js +0 -3
- package/dist/themes/platform.d.ts +0 -1019
- package/dist/themes/platform.js +0 -73
- package/dist/typings/theme.d.ts +0 -6
- package/dist/utilities/index.d.ts +0 -1
- package/dist/utilities/index.js +0 -1
- package/dist/utilities/themed.d.ts +0 -14
- package/dist/utilities/themed.js +0 -17
- package/dist/variables/colors.d.ts +0 -193
- package/dist/variables/colors.js +0 -149
- package/dist/variables/deprecated-colors.d.ts +0 -156
- package/dist/variables/deprecated-colors.js +0 -155
- package/dist/variables/elements.d.ts +0 -11
- package/dist/variables/elements.js +0 -11
- package/dist/variables/index.d.ts +0 -7
- package/dist/variables/index.js +0 -8
- package/dist/variables/responsive.d.ts +0 -19
- package/dist/variables/responsive.js +0 -21
- package/dist/variables/spacing.d.ts +0 -13
- package/dist/variables/spacing.js +0 -14
- package/dist/variables/timing.d.ts +0 -10
- package/dist/variables/timing.js +0 -10
- package/dist/variables/typography.d.ts +0 -32
- package/dist/variables/typography.js +0 -33
- package/dist/variance/config.d.ts +0 -1002
- package/dist/variance/config.js +0 -471
- package/dist/variance/index.d.ts +0 -3
- package/dist/variance/index.js +0 -4
- package/dist/variance/props.d.ts +0 -1865
- package/dist/variance/props.js +0 -23
- package/dist/variance/utils.d.ts +0 -29
- package/dist/variance/utils.js +0 -43
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.1.
|
|
4
|
+
"version": "16.1.3-alpha.187436.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.21.0",
|
|
24
|
+
"@codecademy/variance": "0.21.1-alpha.187436.0",
|
|
25
25
|
"@emotion/is-prop-valid": "^1.1.0",
|
|
26
26
|
"polished": "^4.1.2"
|
|
27
27
|
},
|
|
@@ -33,13 +33,9 @@
|
|
|
33
33
|
"react": "^17.0.2 || ^18.2.0",
|
|
34
34
|
"stylis": "^4.0.7"
|
|
35
35
|
},
|
|
36
|
-
"devDependencies": {
|
|
37
|
-
"@emotion/jest": "^11.3.0",
|
|
38
|
-
"component-test-setup": "^0.3.1"
|
|
39
|
-
},
|
|
40
36
|
"license": "MIT",
|
|
41
37
|
"publishConfig": {
|
|
42
38
|
"access": "public"
|
|
43
39
|
},
|
|
44
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "25fdee2557622798d089488b96934207d3c4800c"
|
|
45
41
|
}
|
package/dist/AssetProvider.d.ts
DELETED
package/dist/AssetProvider.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { webFonts } from './remoteAssets/fonts';
|
|
2
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
4
|
-
export var createFontLinks = function createFontLinks() {
|
|
5
|
-
return webFonts.flatMap(function (_ref) {
|
|
6
|
-
var filePath = _ref.filePath,
|
|
7
|
-
extensions = _ref.extensions;
|
|
8
|
-
return extensions.map(function (ext) {
|
|
9
|
-
return /*#__PURE__*/_jsx("link", {
|
|
10
|
-
rel: "preload",
|
|
11
|
-
href: "".concat(filePath, ".").concat(ext),
|
|
12
|
-
crossOrigin: "anonymous",
|
|
13
|
-
as: "font",
|
|
14
|
-
type: "font/".concat(ext)
|
|
15
|
-
}, "".concat(filePath, "-").concat(ext));
|
|
16
|
-
});
|
|
17
|
-
});
|
|
18
|
-
};
|
|
19
|
-
export var AssetProvider = function AssetProvider() {
|
|
20
|
-
return /*#__PURE__*/_jsx(_Fragment, {
|
|
21
|
-
children: createFontLinks()
|
|
22
|
-
});
|
|
23
|
-
};
|
package/dist/Background.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { ComponentProps } from 'react';
|
|
2
|
-
import { ColorMode, Colors } from './ColorMode';
|
|
3
|
-
export interface BackgroundProps extends Omit<ComponentProps<typeof ColorMode>, 'mode' | 'alwaysSetVariables' | 'bg'> {
|
|
4
|
-
bg: Colors;
|
|
5
|
-
}
|
|
6
|
-
export declare const Background: import("react").ForwardRefExoticComponent<Pick<BackgroundProps, "style" | "p" | "slot" | "title" | "as" | "dir" | "id" | "key" | "color" | "background" | "property" | "alignContent" | "alignItems" | "alignSelf" | "backgroundImage" | "backgroundPosition" | "backgroundRepeat" | "backgroundSize" | "bottom" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridColumnEnd" | "gridColumnStart" | "gridRowEnd" | "gridRowStart" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "inset" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "opacity" | "order" | "overflowX" | "overflowY" | "position" | "right" | "rowGap" | "top" | "translate" | "verticalAlign" | "width" | "zIndex" | "border" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderStyle" | "borderTop" | "borderWidth" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "overflow" | "hidden" | "variables" | "children" | "theme" | "dimensions" | "textColor" | "bg" | "borderColorX" | "borderColorY" | "borderColorLeft" | "borderColorRight" | "borderColorTop" | "borderColorBottom" | "px" | "py" | "pt" | "pb" | "pr" | "pl" | "m" | "mx" | "my" | "mt" | "mb" | "mr" | "ml" | "borderX" | "borderY" | "borderWidthX" | "borderWidthY" | "borderWidthLeft" | "borderWidthRight" | "borderWidthTop" | "borderWidthBottom" | "borderRadiusLeft" | "borderRadiusTop" | "borderRadiusBottom" | "borderRadiusRight" | "borderRadiusTopLeft" | "borderRadiusTopRight" | "borderRadiusBottomRight" | "borderRadiusBottomLeft" | "borderStyleX" | "borderStyleY" | "borderStyleLeft" | "borderStyleRight" | "borderStyleTop" | "borderStyleBottom" | "className" | "prefix" | "lang" | "role" | "tabIndex" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "draggable" | "placeholder" | "spellCheck" | "radioGroup" | "about" | "datatype" | "inlist" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is"> & import("react").RefAttributes<HTMLDivElement>>;
|
package/dist/Background.js
DELETED
|
@@ -1,86 +0,0 @@
|
|
|
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
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
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."); }
|
|
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); }
|
|
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; }
|
|
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; } }
|
|
12
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
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; }
|
|
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; }
|
|
15
|
-
import { getContrast } from 'polished';
|
|
16
|
-
import { forwardRef, useCallback, useMemo } from 'react';
|
|
17
|
-
import { ColorMode, useColorModes } from './ColorMode';
|
|
18
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
19
|
-
var isColorAlias = function isColorAlias(mode, color) {
|
|
20
|
-
return Object.keys(mode).includes(color);
|
|
21
|
-
};
|
|
22
|
-
export var Background = /*#__PURE__*/forwardRef(function Background(_ref, ref) {
|
|
23
|
-
var bg = _ref.bg,
|
|
24
|
-
rest = _objectWithoutProperties(_ref, ["bg"]);
|
|
25
|
-
var _useColorModes = useColorModes(),
|
|
26
|
-
_useColorModes2 = _slicedToArray(_useColorModes, 4),
|
|
27
|
-
active = _useColorModes2[0],
|
|
28
|
-
activeColors = _useColorModes2[1],
|
|
29
|
-
modes = _useColorModes2[2],
|
|
30
|
-
getColorValue = _useColorModes2[3];
|
|
31
|
-
/** If a color alias was used then look up the true color key from the active mode */
|
|
32
|
-
var trueColor = useMemo(function () {
|
|
33
|
-
if (isColorAlias(activeColors, bg)) {
|
|
34
|
-
return activeColors[bg];
|
|
35
|
-
}
|
|
36
|
-
return bg;
|
|
37
|
-
}, [bg, activeColors]);
|
|
38
|
-
var getTextContrast = useCallback(function (foreground) {
|
|
39
|
-
return getContrast(getColorValue(foreground), getColorValue(trueColor));
|
|
40
|
-
}, [trueColor, getColorValue]);
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* This compares the contrast of the selected background color
|
|
44
|
-
* and each color modes body text and returns the mode that has
|
|
45
|
-
* the highest contrast standard. This is not perfect as it is
|
|
46
|
-
* probable that certain color modes will never be reachable if
|
|
47
|
-
* there are more than 2 color modes.
|
|
48
|
-
*
|
|
49
|
-
* This does not guarantee a level of A/AA/AA compliance.
|
|
50
|
-
*/
|
|
51
|
-
|
|
52
|
-
var accessibleMode = useMemo(function () {
|
|
53
|
-
var activeMode = modes[active],
|
|
54
|
-
otherModes = _objectWithoutProperties(modes, [active].map(_toPropertyKey));
|
|
55
|
-
var possibleModes = Object.entries(otherModes);
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Reduce all remaining modes to the mode key with the highest contrast
|
|
59
|
-
* value.
|
|
60
|
-
*
|
|
61
|
-
* TODO: Add a tiebreaker. This could possibly have other dimensions as
|
|
62
|
-
* it will likely fail to return a mode outside of the lightest and
|
|
63
|
-
* darkest versions.
|
|
64
|
-
*/
|
|
65
|
-
var _possibleModes$reduce = possibleModes.reduce(function (_ref2, _ref3) {
|
|
66
|
-
var _ref4 = _slicedToArray(_ref2, 2),
|
|
67
|
-
prevMode = _ref4[0],
|
|
68
|
-
prevContrast = _ref4[1];
|
|
69
|
-
var _ref5 = _slicedToArray(_ref3, 2),
|
|
70
|
-
mode = _ref5[0],
|
|
71
|
-
text = _ref5[1].text;
|
|
72
|
-
var contrast = getTextContrast(text);
|
|
73
|
-
|
|
74
|
-
// Keep the higher contrast mode.
|
|
75
|
-
return contrast > prevContrast ? [mode, contrast] : [prevMode, prevContrast];
|
|
76
|
-
}, [active, getTextContrast(activeMode.text)]),
|
|
77
|
-
_possibleModes$reduce2 = _slicedToArray(_possibleModes$reduce, 1),
|
|
78
|
-
highestContrastMode = _possibleModes$reduce2[0];
|
|
79
|
-
return highestContrastMode;
|
|
80
|
-
}, [modes, active, getTextContrast]);
|
|
81
|
-
return /*#__PURE__*/_jsx(ColorMode, _objectSpread(_objectSpread({}, rest), {}, {
|
|
82
|
-
mode: accessibleMode,
|
|
83
|
-
bg: bg,
|
|
84
|
-
ref: ref
|
|
85
|
-
}));
|
|
86
|
-
});
|