@codecademy/gamut 68.2.0-alpha.a8fc55.0 → 68.2.1-alpha.610ec2.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.
Files changed (41) hide show
  1. package/dist/BarChart/BarChartProvider.d.ts +19 -0
  2. package/dist/BarChart/BarChartProvider.js +27 -0
  3. package/dist/BarChart/BarRow/ValueLabelsContent.d.ts +7 -0
  4. package/dist/BarChart/BarRow/ValueLabelsContent.js +34 -0
  5. package/dist/BarChart/BarRow/elements.d.ts +959 -0
  6. package/dist/BarChart/BarRow/elements.js +110 -0
  7. package/dist/BarChart/BarRow/index.d.ts +6 -0
  8. package/dist/BarChart/BarRow/index.js +231 -0
  9. package/dist/BarChart/SortSelect/index.d.ts +15 -0
  10. package/dist/BarChart/SortSelect/index.js +18 -0
  11. package/dist/BarChart/index.d.ts +4 -0
  12. package/dist/BarChart/index.js +136 -0
  13. package/dist/BarChart/layout/GridLines.d.ts +3 -0
  14. package/dist/BarChart/layout/GridLines.js +69 -0
  15. package/dist/BarChart/layout/LabelSpacer.d.ts +6 -0
  16. package/dist/BarChart/layout/LabelSpacer.js +56 -0
  17. package/dist/BarChart/layout/ScaleChartHeader.d.ts +3 -0
  18. package/dist/BarChart/layout/ScaleChartHeader.js +87 -0
  19. package/dist/BarChart/shared/elements.d.ts +7 -0
  20. package/dist/BarChart/shared/elements.js +12 -0
  21. package/dist/BarChart/shared/styles.d.ts +4 -0
  22. package/dist/BarChart/shared/styles.js +4 -0
  23. package/dist/BarChart/shared/translations.d.ts +69 -0
  24. package/dist/BarChart/shared/translations.js +57 -0
  25. package/dist/BarChart/shared/types.d.ts +100 -0
  26. package/dist/BarChart/shared/types.js +1 -0
  27. package/dist/BarChart/utils/hooks.d.ts +89 -0
  28. package/dist/BarChart/utils/hooks.js +281 -0
  29. package/dist/BarChart/utils/index.d.ts +56 -0
  30. package/dist/BarChart/utils/index.js +122 -0
  31. package/dist/ConnectedForm/utils.d.ts +1 -1
  32. package/dist/DataList/Tables/Rows/TableHeaderRow.js +49 -53
  33. package/dist/Form/SelectDropdown/styles.d.ts +1 -1
  34. package/dist/Form/elements/Form.d.ts +1 -1
  35. package/dist/Form/elements/FormGroupLabel.js +2 -2
  36. package/dist/Form/inputs/Select.js +6 -5
  37. package/dist/List/elements.d.ts +9 -1
  38. package/dist/List/elements.js +9 -7
  39. package/dist/index.d.ts +1 -0
  40. package/dist/index.js +1 -0
  41. package/package.json +6 -6
@@ -0,0 +1,19 @@
1
+ /// <reference types="react" />
2
+ import { BarChartTranslations } from './shared/translations';
3
+ import { BarChartStyles, MaxScaleValue } from './shared/types';
4
+ export interface BarChartContextProps {
5
+ maxScaleValue: MaxScaleValue;
6
+ scaleInterval: number;
7
+ unit: string;
8
+ styleConfig: Required<BarChartStyles>;
9
+ animate: boolean;
10
+ widestCategoryLabelWidth: number | null;
11
+ setWidestCategoryLabelWidth: (width: number) => void;
12
+ widestTotalValueLabelWidth: number | null;
13
+ setWidestTotalValueLabelWidth: (width: number) => void;
14
+ isMeasuring: boolean;
15
+ translations: BarChartTranslations;
16
+ }
17
+ export declare const defaultStyleConfig: Required<BarChartStyles>;
18
+ export declare const BarChartContext: import("react").Context<BarChartContextProps>;
19
+ export declare const BarChartProvider: import("react").Provider<BarChartContextProps>;
@@ -0,0 +1,27 @@
1
+ import { createContext } from 'react';
2
+ import { defaultBarChartTranslations } from './shared/translations';
3
+ export const defaultStyleConfig = {
4
+ textColor: 'text',
5
+ seriesOneBarColor: 'text',
6
+ seriesTwoBarColor: 'primary',
7
+ seriesOneLabel: 'text-secondary',
8
+ seriesTwoLabel: 'primary'
9
+ };
10
+ export const BarChartContext = /*#__PURE__*/createContext({
11
+ maxScaleValue: 100,
12
+ scaleInterval: 10,
13
+ unit: '',
14
+ styleConfig: defaultStyleConfig,
15
+ animate: false,
16
+ widestCategoryLabelWidth: null,
17
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
18
+ setWidestCategoryLabelWidth: () => {},
19
+ widestTotalValueLabelWidth: null,
20
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
21
+ setWidestTotalValueLabelWidth: () => {
22
+ // No-op: default context value
23
+ },
24
+ isMeasuring: true,
25
+ translations: defaultBarChartTranslations
26
+ });
27
+ export const BarChartProvider = BarChartContext.Provider;
@@ -0,0 +1,7 @@
1
+ import { BarChartStyles } from '../shared/types';
2
+ export type ValueLabelsContentProps = {
3
+ seriesOneFormatted: string;
4
+ displayValueFormatted: string;
5
+ isStacked: boolean;
6
+ } & Pick<Required<BarChartStyles>, 'seriesOneLabel' | 'seriesTwoLabel'>;
7
+ export declare const ValueLabelsContent: ({ seriesOneFormatted, displayValueFormatted, isStacked, seriesOneLabel, seriesTwoLabel, }: ValueLabelsContentProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,34 @@
1
+ import { MiniArrowRightIcon } from '@codecademy/gamut-icons';
2
+ import { Text } from '../../Typography';
3
+ import { iconPadding } from '../shared/styles';
4
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
5
+ const valueLabelProps = {
6
+ height: 'fit-content',
7
+ lineHeight: 'title',
8
+ variant: 'p-small',
9
+ whiteSpace: 'nowrap'
10
+ };
11
+ export const ValueLabelsContent = ({
12
+ seriesOneFormatted,
13
+ displayValueFormatted,
14
+ isStacked,
15
+ seriesOneLabel,
16
+ seriesTwoLabel
17
+ }) => /*#__PURE__*/_jsxs(_Fragment, {
18
+ children: [isStacked && /*#__PURE__*/_jsxs(_Fragment, {
19
+ children: [/*#__PURE__*/_jsx(Text, {
20
+ color: seriesOneLabel,
21
+ ...valueLabelProps,
22
+ children: seriesOneFormatted
23
+ }), /*#__PURE__*/_jsx(MiniArrowRightIcon, {
24
+ color: seriesOneLabel,
25
+ mx: iconPadding,
26
+ size: 16
27
+ })]
28
+ }), /*#__PURE__*/_jsx(Text, {
29
+ color: isStacked ? seriesTwoLabel : seriesOneLabel,
30
+ fontWeight: isStacked ? 'bold' : 'normal',
31
+ ...valueLabelProps,
32
+ children: displayValueFormatted
33
+ })]
34
+ });