@codecademy/gamut 68.0.1-alpha.4fa3a1.0 → 68.0.1-alpha.7afb48.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.
|
@@ -15,6 +15,5 @@ export interface BarChartContextProps {
|
|
|
15
15
|
isMeasuring: boolean;
|
|
16
16
|
translations: BarChartTranslations;
|
|
17
17
|
}
|
|
18
|
-
export declare const defaultStyleConfig: Required<BarChartStyles>;
|
|
19
18
|
export declare const BarChartContext: import("react").Context<BarChartContextProps>;
|
|
20
19
|
export declare const BarChartProvider: import("react").Provider<BarChartContextProps>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { createContext } from 'react';
|
|
2
2
|
import { defaultBarChartTranslations } from './shared/translations';
|
|
3
|
-
|
|
3
|
+
const defaultStyleConfig = {
|
|
4
4
|
textColor: 'text',
|
|
5
|
-
foregroundBarColor: '
|
|
6
|
-
backgroundBarColor: 'primary',
|
|
5
|
+
foregroundBarColor: 'feedback-warning',
|
|
6
|
+
backgroundBarColor: 'background-primary',
|
|
7
7
|
seriesOneLabel: 'text-secondary',
|
|
8
8
|
seriesTwoLabel: 'primary'
|
|
9
9
|
};
|
|
@@ -198,8 +198,8 @@ export const BarRow = /*#__PURE__*/forwardRef(({
|
|
|
198
198
|
animate: animate ? {
|
|
199
199
|
width: bgWidthStr
|
|
200
200
|
} : undefined,
|
|
201
|
-
bg:
|
|
202
|
-
borderColor:
|
|
201
|
+
bg: backgroundBarColor,
|
|
202
|
+
borderColor: backgroundBorderColor,
|
|
203
203
|
"data-testid": "background-bar",
|
|
204
204
|
initial: animate ? {
|
|
205
205
|
width: '0%'
|
|
@@ -24,13 +24,13 @@ type BarChartLabel = BarChartAriaLabel | BarChartAriaLabelledBy;
|
|
|
24
24
|
export type BarChartStyles = {
|
|
25
25
|
/** Color for text labels. Defaults to 'text' */
|
|
26
26
|
textColor?: ColorAlias;
|
|
27
|
-
/** Color for the foreground/progress bar. Defaults to '
|
|
27
|
+
/** Color for the foreground/progress bar. Defaults to 'feedback-warning' */
|
|
28
28
|
foregroundBarColor?: ColorAlias;
|
|
29
|
-
/** Color for the background/total bar. Defaults to '
|
|
29
|
+
/** Color for the background/total bar. Defaults to 'paleBlue' */
|
|
30
30
|
backgroundBarColor?: ColorAlias;
|
|
31
|
-
/** Color for the series one label (first right label when stacked, or displayValue when not stacked). Defaults to 'text
|
|
31
|
+
/** Color for the series one label (first right label when stacked, or displayValue when not stacked). Defaults to 'text' */
|
|
32
32
|
seriesOneLabel?: ColorAlias;
|
|
33
|
-
/** Color for the series two label (displayValue when stacked). Defaults to '
|
|
33
|
+
/** Color for the series two label (displayValue when stacked). Defaults to 'text' */
|
|
34
34
|
seriesTwoLabel?: ColorAlias;
|
|
35
35
|
};
|
|
36
36
|
type BarPropsBase = {
|
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
import { useColorModes } from '@codecademy/gamut-styles';
|
|
2
2
|
import { getContrast } from 'polished';
|
|
3
3
|
import { useCallback, useContext, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
4
|
-
import { BarChartContext
|
|
4
|
+
import { BarChartContext } from '../BarChartProvider';
|
|
5
5
|
import { calculatePositionPercent, getLabel, sortBars } from './index';
|
|
6
|
+
const defaultStyleConfig = {
|
|
7
|
+
textColor: 'text',
|
|
8
|
+
foregroundBarColor: 'feedback-warning',
|
|
9
|
+
backgroundBarColor: 'background-primary',
|
|
10
|
+
seriesOneLabel: 'text-secondary',
|
|
11
|
+
seriesTwoLabel: 'primary'
|
|
12
|
+
};
|
|
13
|
+
|
|
6
14
|
/**
|
|
7
15
|
* Hook that calculates label positions for a given range and count
|
|
8
16
|
* Returns an array of { value, positionPercent } objects
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codecademy/gamut",
|
|
3
3
|
"description": "Styleguide & Component library for Codecademy",
|
|
4
|
-
"version": "68.0.1-alpha.
|
|
4
|
+
"version": "68.0.1-alpha.7afb48.0",
|
|
5
5
|
"author": "Codecademy Engineering <dev@codecademy.com>",
|
|
6
6
|
"dependencies": {
|
|
7
7
|
"@codecademy/gamut-icons": "9.54.2",
|
|
@@ -56,5 +56,5 @@
|
|
|
56
56
|
"dist/**/[A-Z]**/[A-Z]*.js",
|
|
57
57
|
"dist/**/[A-Z]**/index.js"
|
|
58
58
|
],
|
|
59
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "e22c45da3f896669cfb2269e9b75a5f32fa764b5"
|
|
60
60
|
}
|