@codecademy/gamut-styles 17.12.2-alpha.fbf911.0 → 17.13.1-alpha.435fe1.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/Background.d.ts +10 -1
- package/dist/Background.js +9 -1
- package/package.json +2 -2
package/dist/Background.d.ts
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
import { ComponentProps } from 'react';
|
|
2
|
-
import { ColorMode, Colors } from './ColorMode';
|
|
2
|
+
import { ColorAlias, ColorMode, ColorModeShape, Colors } from './ColorMode';
|
|
3
3
|
export interface BackgroundProps extends Omit<ComponentProps<typeof ColorMode>, 'mode' | 'alwaysSetVariables' | 'bg'> {
|
|
4
4
|
bg: Colors;
|
|
5
5
|
}
|
|
6
|
+
/**
|
|
7
|
+
* Type guard that checks whether a color is a semantic alias in the given mode
|
|
8
|
+
* (e.g. "text", "primary") rather than a raw theme color key.
|
|
9
|
+
*
|
|
10
|
+
* @param mode - The color mode shape to check against
|
|
11
|
+
* @param color - The color key to test
|
|
12
|
+
* @returns `true` if `color` is a key in `mode` (i.e. a ColorAlias)
|
|
13
|
+
*/
|
|
14
|
+
export declare const isColorAlias: (mode: ColorModeShape, color: Colors) => color is ColorAlias;
|
|
6
15
|
export declare const Background: import("react").ForwardRefExoticComponent<Omit<BackgroundProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
package/dist/Background.js
CHANGED
|
@@ -2,7 +2,15 @@ import { getContrast } from 'polished';
|
|
|
2
2
|
import { forwardRef, useCallback, useMemo } from 'react';
|
|
3
3
|
import { ColorMode, useColorModes } from './ColorMode';
|
|
4
4
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Type guard that checks whether a color is a semantic alias in the given mode
|
|
7
|
+
* (e.g. "text", "primary") rather than a raw theme color key.
|
|
8
|
+
*
|
|
9
|
+
* @param mode - The color mode shape to check against
|
|
10
|
+
* @param color - The color key to test
|
|
11
|
+
* @returns `true` if `color` is a key in `mode` (i.e. a ColorAlias)
|
|
12
|
+
*/
|
|
13
|
+
export const isColorAlias = (mode, color) => {
|
|
6
14
|
return Object.keys(mode).includes(color);
|
|
7
15
|
};
|
|
8
16
|
export const Background = /*#__PURE__*/forwardRef(({
|
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.
|
|
4
|
+
"version": "17.13.1-alpha.435fe1.0",
|
|
5
5
|
"author": "Jake Hiller <jake@codecademy.com>",
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@codecademy/variance": "0.26.1-alpha.
|
|
7
|
+
"@codecademy/variance": "0.26.1-alpha.435fe1.0",
|
|
8
8
|
"@emotion/is-prop-valid": "^1.1.0",
|
|
9
9
|
"framer-motion": "^11.18.0",
|
|
10
10
|
"get-nonce": "^1.0.0",
|