@codecademy/gamut 67.6.1-alpha.1bf8a5.0 → 67.6.1-alpha.74920d.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/BarChart/Bar/elements.d.ts +1392 -0
- package/dist/BarChart/Bar/elements.js +59 -0
- package/dist/BarChart/Bar/index.d.ts +1 -0
- package/dist/BarChart/Bar/index.js +2 -0
- package/dist/BarChart/BarChartProvider.d.ts +33 -0
- package/dist/BarChart/BarChartProvider.js +39 -0
- package/dist/BarChart/BarRow.d.ts +6 -0
- package/dist/BarChart/BarRow.js +179 -0
- package/dist/BarChart/GridLines.d.ts +5 -0
- package/dist/BarChart/GridLines.js +57 -0
- package/dist/BarChart/ScaleChartHeader.d.ts +10 -0
- package/dist/BarChart/ScaleChartHeader.js +65 -0
- package/dist/BarChart/index.d.ts +4 -0
- package/dist/BarChart/index.js +68 -0
- package/dist/BarChart/types.d.ts +56 -0
- package/dist/BarChart/types.js +1 -0
- package/dist/BarChart/utils/index.d.ts +72 -0
- package/dist/BarChart/utils/index.js +144 -0
- package/dist/ConnectedForm/ConnectedFormGroup.d.ts +0 -5
- package/dist/ConnectedForm/ConnectedFormGroup.js +1 -1
- package/dist/Form/elements/FormGroupLabel.js +2 -8
- package/dist/GridForm/GridFormInputGroup/__fixtures__/renderers.d.ts +0 -4
- package/dist/GridForm/types.d.ts +0 -5
- package/dist/Tip/InfoTip/InfoTipButton.js +2 -5
- package/dist/Tip/InfoTip/elements.d.ts +12 -0
- package/dist/Tip/InfoTip/elements.js +9 -0
- package/dist/Tip/InfoTip/index.d.ts +0 -18
- package/dist/Tip/InfoTip/index.js +66 -37
- package/dist/Tip/__tests__/helpers.d.ts +26 -5
- package/dist/Tip/shared/FloatingTip.js +3 -3
- package/dist/Tip/shared/InlineTip.js +1 -4
- package/dist/Tip/shared/types.d.ts +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { ColorAlias } from '@codecademy/gamut-styles';
|
|
2
|
+
import { GamutIconProps } from '@codecademy/gamut-icons';
|
|
3
|
+
import { HTMLProps } from 'react';
|
|
4
|
+
import { ButtonProps } from '../Button';
|
|
5
|
+
type BarChartAriaLabel = {
|
|
6
|
+
'aria-label': string;
|
|
7
|
+
'aria-labelledby'?: never;
|
|
8
|
+
};
|
|
9
|
+
type BarChartAriaLabelledBy = {
|
|
10
|
+
'aria-label'?: never;
|
|
11
|
+
'aria-labelledby': string;
|
|
12
|
+
};
|
|
13
|
+
type BarChartLabel = BarChartAriaLabel | BarChartAriaLabelledBy;
|
|
14
|
+
export type BarChartStyles = {
|
|
15
|
+
/** Color for text labels. Defaults to 'text' */
|
|
16
|
+
textColor?: ColorAlias;
|
|
17
|
+
/** Color for the foreground/progress bar. Defaults to 'feedback-warning' */
|
|
18
|
+
foregroundBarColor?: ColorAlias;
|
|
19
|
+
/** Color for the background/total bar. Defaults to 'paleBlue' */
|
|
20
|
+
backgroundBarColor?: ColorAlias;
|
|
21
|
+
};
|
|
22
|
+
export type BarProps = {
|
|
23
|
+
/** Label displayed on the y-axis for this bar */
|
|
24
|
+
yLabel: string;
|
|
25
|
+
/** The foreground/progress bar value (always shown) */
|
|
26
|
+
seriesOneValue: number;
|
|
27
|
+
/** The background/total bar value (optional - creates stacked effect when provided) */
|
|
28
|
+
seriesTwoValue?: number;
|
|
29
|
+
/** Optional icon to display next to the label */
|
|
30
|
+
icon?: React.ComponentType<GamutIconProps>;
|
|
31
|
+
/** Click handler - makes row interactive as a button */
|
|
32
|
+
onClick?: ButtonProps['onClick'];
|
|
33
|
+
/** Link href - makes row interactive as an anchor */
|
|
34
|
+
href?: HTMLProps<HTMLAnchorElement>['href'];
|
|
35
|
+
};
|
|
36
|
+
export type BarChartProps = BarChartLabel & {
|
|
37
|
+
/** Whether to animate bars on mount */
|
|
38
|
+
animate?: boolean;
|
|
39
|
+
/** Array of bar data to render */
|
|
40
|
+
barValues: BarProps[];
|
|
41
|
+
/** Maximum value for the x-axis scale */
|
|
42
|
+
maxRange: number;
|
|
43
|
+
/** Minimum value for the x-axis scale (usually 0) */
|
|
44
|
+
minRange: number;
|
|
45
|
+
/** Sort order for bars */
|
|
46
|
+
order?: 'ascending' | 'descending';
|
|
47
|
+
/** Property to sort bars by */
|
|
48
|
+
sortBy?: 'label' | 'value' | 'none';
|
|
49
|
+
/** Unit label to display (e.g., "XP") */
|
|
50
|
+
unit?: string;
|
|
51
|
+
/** Style configuration for colors */
|
|
52
|
+
styleConfig?: BarChartStyles;
|
|
53
|
+
/** Interval for x-axis scale markers */
|
|
54
|
+
xScale?: number;
|
|
55
|
+
};
|
|
56
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { BarProps, BarChartProps } from '../types';
|
|
2
|
+
export declare const numDigits: ({ num }: {
|
|
3
|
+
num: number;
|
|
4
|
+
}) => number;
|
|
5
|
+
export declare const columnBaseSize: ({ experience }: {
|
|
6
|
+
experience?: number | undefined;
|
|
7
|
+
}) => {
|
|
8
|
+
sm: number;
|
|
9
|
+
md: number;
|
|
10
|
+
lg: number;
|
|
11
|
+
xl: number;
|
|
12
|
+
};
|
|
13
|
+
export declare const calculatePercent: ({ value, total }: {
|
|
14
|
+
value: number;
|
|
15
|
+
total: number;
|
|
16
|
+
}) => number;
|
|
17
|
+
export declare const calculateBarWidth: ({ value, minRange, maxRange, }: {
|
|
18
|
+
value: number;
|
|
19
|
+
minRange: number;
|
|
20
|
+
maxRange: number;
|
|
21
|
+
}) => number;
|
|
22
|
+
export declare const calculateTicksAndRange: ({ maxTicks, minPoint, maxPoint, }: {
|
|
23
|
+
maxTicks: number;
|
|
24
|
+
minPoint: number;
|
|
25
|
+
maxPoint: number;
|
|
26
|
+
}) => [number, number, number];
|
|
27
|
+
/**
|
|
28
|
+
* Returns a "nice" number approximately equal to range
|
|
29
|
+
* Rounds the number if round = true
|
|
30
|
+
* Takes the ceiling if round = false.
|
|
31
|
+
* A nice number is a simple decimal number, for example if a number is 1234, a nice number would be 1000 or 2000.
|
|
32
|
+
*/
|
|
33
|
+
export declare const niceNum: ({ range, roundDown }: {
|
|
34
|
+
range: number;
|
|
35
|
+
roundDown: boolean;
|
|
36
|
+
}) => number;
|
|
37
|
+
export declare const getPercentDiff: ({ v1, v2 }: {
|
|
38
|
+
v1: number;
|
|
39
|
+
v2: number;
|
|
40
|
+
}) => number;
|
|
41
|
+
export declare const formatNumberUS: ({ num }: {
|
|
42
|
+
num: number;
|
|
43
|
+
}) => string;
|
|
44
|
+
export declare const formatNumberUSCompact: ({ num }: {
|
|
45
|
+
num: number;
|
|
46
|
+
}) => string;
|
|
47
|
+
/**
|
|
48
|
+
* Sort bars based on sortBy and order configuration
|
|
49
|
+
*/
|
|
50
|
+
export declare const sortBars: ({ bars, sortBy, order, }: {
|
|
51
|
+
bars: BarProps[];
|
|
52
|
+
sortBy: BarChartProps['sortBy'];
|
|
53
|
+
order: BarChartProps['order'];
|
|
54
|
+
}) => BarProps[];
|
|
55
|
+
/**
|
|
56
|
+
* Generates an accessible summary of the bar values
|
|
57
|
+
*/
|
|
58
|
+
export declare const getValuesSummary: ({ yLabel, seriesOneValue, seriesTwoValue, unit, }: {
|
|
59
|
+
yLabel: string;
|
|
60
|
+
seriesOneValue: number;
|
|
61
|
+
seriesTwoValue?: number | undefined;
|
|
62
|
+
unit: string;
|
|
63
|
+
}) => string;
|
|
64
|
+
/**
|
|
65
|
+
* Calculates the value for a given label position
|
|
66
|
+
*/
|
|
67
|
+
export declare const getLabel: ({ labelCount, labelIndex, min, max, }: {
|
|
68
|
+
labelCount: number;
|
|
69
|
+
labelIndex: number;
|
|
70
|
+
min: number;
|
|
71
|
+
max: number;
|
|
72
|
+
}) => number;
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
export const numDigits = ({
|
|
2
|
+
num
|
|
3
|
+
}) => {
|
|
4
|
+
return Math.max(Math.floor(Math.log10(Math.abs(num))), 0) + 1;
|
|
5
|
+
};
|
|
6
|
+
export const columnBaseSize = ({
|
|
7
|
+
experience = 3
|
|
8
|
+
}) => {
|
|
9
|
+
const digits = numDigits({
|
|
10
|
+
num: experience
|
|
11
|
+
});
|
|
12
|
+
return {
|
|
13
|
+
sm: digits > 4 ? 5 : 4,
|
|
14
|
+
md: digits > 4 ? 5 : 4,
|
|
15
|
+
lg: digits > 4 ? 4 : 5,
|
|
16
|
+
xl: digits > 4 ? 5 : 4
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
export const calculatePercent = ({
|
|
20
|
+
value,
|
|
21
|
+
total
|
|
22
|
+
}) => {
|
|
23
|
+
return value / total * 100;
|
|
24
|
+
};
|
|
25
|
+
export const calculateBarWidth = ({
|
|
26
|
+
value,
|
|
27
|
+
minRange,
|
|
28
|
+
maxRange
|
|
29
|
+
}) => {
|
|
30
|
+
const range = maxRange - minRange;
|
|
31
|
+
const adjustedValue = value - minRange;
|
|
32
|
+
return Math.floor(calculatePercent({
|
|
33
|
+
value: adjustedValue,
|
|
34
|
+
total: range
|
|
35
|
+
}));
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
// Calculate tick spacing and nice minimum and maximum data points on the axis.
|
|
39
|
+
|
|
40
|
+
export const calculateTicksAndRange = ({
|
|
41
|
+
maxTicks,
|
|
42
|
+
minPoint,
|
|
43
|
+
maxPoint
|
|
44
|
+
}) => {
|
|
45
|
+
const range = niceNum({
|
|
46
|
+
range: maxPoint - minPoint,
|
|
47
|
+
roundDown: false
|
|
48
|
+
});
|
|
49
|
+
const tickSpacing = niceNum({
|
|
50
|
+
range: range / (maxTicks - 1),
|
|
51
|
+
roundDown: true
|
|
52
|
+
});
|
|
53
|
+
const niceMin = Math.floor(minPoint / tickSpacing) * tickSpacing;
|
|
54
|
+
const niceMax = Math.ceil(maxPoint / tickSpacing) * tickSpacing;
|
|
55
|
+
const tickCount = range / tickSpacing;
|
|
56
|
+
return [tickCount, niceMin, niceMax];
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Returns a "nice" number approximately equal to range
|
|
61
|
+
* Rounds the number if round = true
|
|
62
|
+
* Takes the ceiling if round = false.
|
|
63
|
+
* A nice number is a simple decimal number, for example if a number is 1234, a nice number would be 1000 or 2000.
|
|
64
|
+
*/
|
|
65
|
+
export const niceNum = ({
|
|
66
|
+
range,
|
|
67
|
+
roundDown
|
|
68
|
+
}) => {
|
|
69
|
+
const exponent = Math.floor(Math.log10(range));
|
|
70
|
+
const fraction = range / 10 ** exponent;
|
|
71
|
+
let niceFraction;
|
|
72
|
+
if (roundDown) {
|
|
73
|
+
if (fraction < 1.5) niceFraction = 1;else if (fraction < 3) niceFraction = 2;else if (fraction < 7) niceFraction = 5;else niceFraction = 10;
|
|
74
|
+
} else if (fraction <= 1) niceFraction = 1;else if (fraction <= 2) niceFraction = 2;else if (fraction <= 5) niceFraction = 5;else niceFraction = 10;
|
|
75
|
+
return niceFraction * 10 ** exponent;
|
|
76
|
+
};
|
|
77
|
+
export const getPercentDiff = ({
|
|
78
|
+
v1,
|
|
79
|
+
v2
|
|
80
|
+
}) => {
|
|
81
|
+
return Math.abs(v1 - v2) / ((v1 + v2) / 2) * 100;
|
|
82
|
+
};
|
|
83
|
+
export const formatNumberUS = ({
|
|
84
|
+
num
|
|
85
|
+
}) => Intl.NumberFormat('en').format(num);
|
|
86
|
+
export const formatNumberUSCompact = ({
|
|
87
|
+
num
|
|
88
|
+
}) => Intl.NumberFormat('en', {
|
|
89
|
+
notation: 'compact',
|
|
90
|
+
compactDisplay: 'short'
|
|
91
|
+
}).format(num);
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Sort bars based on sortBy and order configuration
|
|
95
|
+
*/
|
|
96
|
+
export const sortBars = ({
|
|
97
|
+
bars,
|
|
98
|
+
sortBy,
|
|
99
|
+
order
|
|
100
|
+
}) => {
|
|
101
|
+
if (sortBy === 'none' || !sortBy) {
|
|
102
|
+
return bars;
|
|
103
|
+
}
|
|
104
|
+
const sorted = [...bars].sort((a, b) => {
|
|
105
|
+
if (sortBy === 'label') {
|
|
106
|
+
return a.yLabel.localeCompare(b.yLabel);
|
|
107
|
+
}
|
|
108
|
+
// sortBy === 'value' - use seriesTwoValue if available, otherwise seriesOneValue
|
|
109
|
+
const aValue = a.seriesTwoValue ?? a.seriesOneValue;
|
|
110
|
+
const bValue = b.seriesTwoValue ?? b.seriesOneValue;
|
|
111
|
+
return aValue - bValue;
|
|
112
|
+
});
|
|
113
|
+
return order === 'descending' ? sorted.reverse() : sorted;
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Generates an accessible summary of the bar values
|
|
118
|
+
*/
|
|
119
|
+
export const getValuesSummary = ({
|
|
120
|
+
yLabel,
|
|
121
|
+
seriesOneValue,
|
|
122
|
+
seriesTwoValue,
|
|
123
|
+
unit
|
|
124
|
+
}) => {
|
|
125
|
+
if (seriesTwoValue !== undefined) {
|
|
126
|
+
const gained = seriesOneValue;
|
|
127
|
+
return `${gained} ${unit} gained - now at ${seriesTwoValue} ${unit} in ${yLabel} category`;
|
|
128
|
+
}
|
|
129
|
+
return `${seriesOneValue} ${unit} in ${yLabel} category`;
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Calculates the value for a given label position
|
|
134
|
+
*/
|
|
135
|
+
export const getLabel = ({
|
|
136
|
+
labelCount,
|
|
137
|
+
labelIndex,
|
|
138
|
+
min,
|
|
139
|
+
max
|
|
140
|
+
}) => {
|
|
141
|
+
if (labelCount <= 1) return max;
|
|
142
|
+
const incrementalDecimal = labelIndex / (labelCount - 1);
|
|
143
|
+
return Math.floor(min + incrementalDecimal * (max - min));
|
|
144
|
+
};
|
|
@@ -8,11 +8,6 @@ export interface ConnectedFormGroupBaseProps extends Omit<FormGroupProps, 'label
|
|
|
8
8
|
name: string;
|
|
9
9
|
label: React.ReactNode;
|
|
10
10
|
required?: boolean;
|
|
11
|
-
/**
|
|
12
|
-
* InfoTip to display next to the field label. String labels automatically
|
|
13
|
-
* label the InfoTip button. For ReactNode labels, provide `ariaLabel` or
|
|
14
|
-
* set `labelledByFieldLabel: true` to ensure the InfoTip is accessible.
|
|
15
|
-
*/
|
|
16
11
|
infotip?: InfoTipProps;
|
|
17
12
|
}
|
|
18
13
|
export interface ConnectedFormGroupProps<T extends ConnectedField> extends SubmitContextProps, ConnectedFormGroupBaseProps {
|
|
@@ -13,7 +13,7 @@ const ErrorAnchor = /*#__PURE__*/_styled(Anchor, {
|
|
|
13
13
|
label: "ErrorAnchor"
|
|
14
14
|
})(css({
|
|
15
15
|
color: 'feedback-error'
|
|
16
|
-
}), process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,
|
|
16
|
+
}), process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9Db25uZWN0ZWRGb3JtL0Nvbm5lY3RlZEZvcm1Hcm91cC50c3giXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBa0JvQiIsImZpbGUiOiIuLi8uLi9zcmMvQ29ubmVjdGVkRm9ybS9Db25uZWN0ZWRGb3JtR3JvdXAudHN4Iiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgY3NzIH0gZnJvbSAnQGNvZGVjYWRlbXkvZ2FtdXQtc3R5bGVzJztcbmltcG9ydCBzdHlsZWQgZnJvbSAnQGVtb3Rpb24vc3R5bGVkJztcbmltcG9ydCB7IHVzZUVmZmVjdCB9IGZyb20gJ3JlYWN0JztcbmltcG9ydCAqIGFzIFJlYWN0IGZyb20gJ3JlYWN0JztcblxuaW1wb3J0IHtcbiAgRm9ybUVycm9yLFxuICBGb3JtR3JvdXAsXG4gIEZvcm1Hcm91cExhYmVsLFxuICBGb3JtR3Jv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XtzaG93RXJyb3J9XG4gICAgICAgIGRpc2FibGVkPXtkaXNhYmxlZH1cbiAgICAgICAgbmFtZT17bmFtZX1cbiAgICAgIC8+XG4gICAgICB7Y2hpbGRyZW59XG4gICAgICB7c2hvd0Vycm9yICYmIChcbiAgICAgICAgPEZvcm1FcnJvclxuICAgICAgICAgIGFyaWEtbGl2ZT17aXNGaXJzdEVycm9yID8gJ2Fzc2VydGl2ZScgOiAnb2ZmJ31cbiAgICAgICAgICBpZD17ZXJyb3JJZH1cbiAgICAgICAgICByb2xlPXtpc0ZpcnN0RXJyb3IgPyAnYWxlcnQnIDogJ3N0YXR1cyd9XG4gICAgICAgICAgdmFyaWFudD17ZXJyb3JUeXBlfVxuICAgICAgICA+XG4gICAgICAgICAgPE1hcmtkb3duXG4gICAgICAgICAgICBpbmxpbmVcbiAgICAgICAgICAgIG92ZXJyaWRlcz17e1xuICAgICAgICAgICAgICBhOiB7XG4gICAgICAgICAgICAgICAgYWxsb3dlZEF0dHJpYnV0ZXM6IFsnaHJlZicsICd0YXJnZXQnXSxcbiAgICAgICAgICAgICAgICBjb21wb25lbnQ6IEVycm9yQW5jaG9yLFxuICAgICAgICAgICAgICAgIHByb2Nlc3NOb2RlOiAoXG4gICAgICAgICAgICAgICAgICBub2RlOiB1bmtub3duLFxuICAgICAgICAgICAgICAgICAgcHJvcHM6IHsgb25DbGljaz86ICgpID0+IHZvaWQgfVxuICAgICAgICAgICAgICAgICkgPT4gPEVycm9yQW5jaG9yIHsuLi5wcm9wc30gLz4sXG4gICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICB9fVxuICAgICAgICAgICAgc2tpcERlZmF1bHRPdmVycmlkZXM9e3sgYTogdHJ1ZSB9fVxuICAgICAgICAgICAgc3BhY2luZz1cIm5vbmVcIlxuICAgICAgICAgICAgdGV4dD17dGV4dEVycm9yfVxuICAgICAgICAgIC8+XG4gICAgICAgIDwvRm9ybUVycm9yPlxuICAgICAgKX1cbiAgICA8L0Zvcm1Hcm91cD5cbiAgKTtcbn1cbiJdfQ== */");
|
|
17
17
|
export function ConnectedFormGroup({
|
|
18
18
|
customError,
|
|
19
19
|
children,
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import _styled from "@emotion/styled/base";
|
|
2
2
|
import { states, variant } from '@codecademy/gamut-styles';
|
|
3
|
-
import { useId } from 'react';
|
|
4
3
|
import * as React from 'react';
|
|
5
4
|
import { FlexBox } from '../..';
|
|
6
5
|
import { InfoTip } from '../../Tip/InfoTip';
|
|
@@ -31,7 +30,7 @@ const labelStates = states({
|
|
|
31
30
|
const Label = /*#__PURE__*/_styled("label", {
|
|
32
31
|
target: "e1t0n89n0",
|
|
33
32
|
label: "Label"
|
|
34
|
-
})(labelSizeVariants, labelStates, process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,
|
|
33
|
+
})(labelSizeVariants, labelStates, process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9Gb3JtL2VsZW1lbnRzL0Zvcm1Hcm91cExhYmVsLnRzeCJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFtRGMiLCJmaWxlIjoiLi4vLi4vLi4vc3JjL0Zvcm0vZWxlbWVudHMvRm9ybUdyb3VwTGFiZWwudHN4Iiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgc3RhdGVzLCB2YXJpYW50IH0gZnJvbSAnQGNvZGVjYWRlbXkvZ2FtdXQtc3R5bGVzJztcbmltcG9ydCB7IFN0eWxlUHJvcHMgfSBmcm9tICdAY29kZWNhZGVteS92YXJpYW5jZSc7XG5pbXBvcnQgc3R5bGVkIGZyb20gJ0BlbW90aW9uL3N0eWxlZCc7XG5pbXBvcnQgeyBIVE1MQXR0cmlidXRlcyB9IGZyb20gJ3JlYWN0JztcbmltcG9ydCAqIGFzIFJlYWN0IGZyb20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ICBkaXNhYmxlZCxcbiAgaHRtbEZvcixcbiAgaW5mb3RpcCxcbiAgaXNTb2xvRmllbGQsXG4gIHJlcXVpcmVkLFxuICBzaXplLFxuICAuLi5yZXN0XG59KSA9PiB7XG4gIHJldHVybiAoXG4gICAgPEZsZXhCb3gganVzdGlmeUNvbnRlbnQ9XCJzcGFjZS1iZXR3ZWVuXCIgbWI9ezR9PlxuICAgICAgPExhYmVsXG4gICAgICAgIHsuLi5yZXN0fVxuICAgICAgICBhcz17aHRtbEZvciA/ICdsYWJlbCcgOiAnZGl2J31cbiAgICAgICAgY2xhc3NOYW1lPXtjbGFzc05hbWV9XG4gICAgICAgIGRpc2FibGVkPXtkaXNhYmxlZH1cbiAgICAgICAgaHRtbEZvcj17aHRtbEZvcn1cbiAgICAgICAgc2l6ZT17c2l6ZX1cbiAgICAgID5cbiAgICAgICAge2NoaWxkcmVufVxuICAgICAgICB7IWlzU29sb0ZpZWxkICYmXG4gICAgICAgICAgKHJlcXVpcmVkID8gKFxuICAgICAgICAgICAgPFRleHQgYXJpYS1oaWRkZW4gYXM9XCJzcGFuXCI+XG4gICAgICAgICAgICAgICpcbiAgICAgICAgICAgIDwvVGV4dD5cbiAgICAgICAgICApIDogKFxuICAgICAgICAgICAgJ1xcdTAwQTAob3B0aW9uYWwpJ1xuICAgICAgICAgICkpfVxuICAgICAgPC9MYWJlbD5cbiAgICAgIHtpbmZvdGlwICYmIDxJbmZvVGlwIHsuLi5pbmZvdGlwfSAvPn1cbiAgICA8L0ZsZXhCb3g+XG4gICk7XG59O1xuIl19 */");
|
|
35
34
|
export const FormGroupLabel = ({
|
|
36
35
|
children,
|
|
37
36
|
className,
|
|
@@ -43,9 +42,6 @@ export const FormGroupLabel = ({
|
|
|
43
42
|
size,
|
|
44
43
|
...rest
|
|
45
44
|
}) => {
|
|
46
|
-
const labelId = useId();
|
|
47
|
-
const isStringLabel = typeof children === 'string';
|
|
48
|
-
const shouldLabelInfoTip = (isStringLabel || infotip?.labelledByFieldLabel) && !infotip?.ariaLabel && !infotip?.ariaLabelledby;
|
|
49
45
|
return /*#__PURE__*/_jsxs(FlexBox, {
|
|
50
46
|
justifyContent: "space-between",
|
|
51
47
|
mb: 4,
|
|
@@ -55,7 +51,6 @@ export const FormGroupLabel = ({
|
|
|
55
51
|
className: className,
|
|
56
52
|
disabled: disabled,
|
|
57
53
|
htmlFor: htmlFor,
|
|
58
|
-
id: infotip && shouldLabelInfoTip ? labelId : undefined,
|
|
59
54
|
size: size,
|
|
60
55
|
children: [children, !isSoloField && (required ? /*#__PURE__*/_jsx(Text, {
|
|
61
56
|
"aria-hidden": true,
|
|
@@ -63,8 +58,7 @@ export const FormGroupLabel = ({
|
|
|
63
58
|
children: "*"
|
|
64
59
|
}) : '\u00A0(optional)')]
|
|
65
60
|
}), infotip && /*#__PURE__*/_jsx(InfoTip, {
|
|
66
|
-
...infotip
|
|
67
|
-
ariaLabelledby: shouldLabelInfoTip ? labelId : infotip.ariaLabelledby
|
|
61
|
+
...infotip
|
|
68
62
|
})]
|
|
69
63
|
});
|
|
70
64
|
};
|
|
@@ -21,10 +21,6 @@ export declare const getComponent: (componentName: string) => {
|
|
|
21
21
|
};
|
|
22
22
|
type GridFormInputGroupTestComponentProps = GridFormInputGroupProps & {
|
|
23
23
|
mode?: 'onSubmit' | 'onChange';
|
|
24
|
-
externalLabel?: {
|
|
25
|
-
id: string;
|
|
26
|
-
text: string;
|
|
27
|
-
};
|
|
28
24
|
};
|
|
29
25
|
export declare const GridFormInputGroupTestComponent: React.FC<GridFormInputGroupTestComponentProps>;
|
|
30
26
|
export {};
|
package/dist/GridForm/types.d.ts
CHANGED
|
@@ -25,11 +25,6 @@ export type BaseFormField<Value> = {
|
|
|
25
25
|
* HTML id to use instead of the name.
|
|
26
26
|
*/
|
|
27
27
|
id?: string;
|
|
28
|
-
/**
|
|
29
|
-
* InfoTip to display next to the field label. String labels automatically
|
|
30
|
-
* label the InfoTip button. For ReactNode labels, provide `ariaLabel` or
|
|
31
|
-
* set `labelledByFieldLabel: true` to ensure the InfoTip is accessible.
|
|
32
|
-
*/
|
|
33
28
|
infotip?: InfoTipProps;
|
|
34
29
|
isSoloField?: boolean;
|
|
35
30
|
name: string;
|
|
@@ -8,17 +8,14 @@ export const InfoTipButton = /*#__PURE__*/forwardRef(({
|
|
|
8
8
|
active,
|
|
9
9
|
children,
|
|
10
10
|
emphasis,
|
|
11
|
-
'aria-label': ariaLabel,
|
|
12
|
-
'aria-labelledby': ariaLabelledby,
|
|
13
11
|
...props
|
|
14
12
|
}, ref) => {
|
|
15
13
|
const Icon = emphasis === 'high' ? MiniInfoCircleIcon : MiniInfoOutlineIcon;
|
|
16
14
|
return /*#__PURE__*/_jsxs(InfoTipButtonBase, {
|
|
17
|
-
...props,
|
|
18
15
|
active: active,
|
|
19
16
|
"aria-expanded": active,
|
|
20
|
-
"aria-label":
|
|
21
|
-
|
|
17
|
+
"aria-label": "Show information",
|
|
18
|
+
...props,
|
|
22
19
|
ref: ref,
|
|
23
20
|
children: [Icon && /*#__PURE__*/_jsx(Icon, {
|
|
24
21
|
"aria-hidden": true,
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const ScreenreaderNavigableText: import("@emotion/styled").StyledComponent<(((Omit<{
|
|
3
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
4
|
+
as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
|
|
5
|
+
} & import("../..").TextTruncateProps & Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "slot" | "style" | "title" | "dir" | "children" | "className" | "aria-hidden" | "onAnimationStart" | "onDragStart" | "onDragEnd" | "onDrag" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "autoFocus" | "contentEditable" | "contextMenu" | "draggable" | "hidden" | "id" | "lang" | "nonce" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "content" | "datatype" | "inlist" | "prefix" | "property" | "rel" | "resource" | "rev" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-braillelabel" | "aria-brailleroledescription" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colindextext" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-description" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "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-rowindextext" | "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" | "onResize" | "onResizeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDragCapture" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "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" | "onPointerLeave" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | keyof import("react").ClassAttributes<HTMLSpanElement>>, "ref"> | Omit<{
|
|
6
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
7
|
+
as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
|
|
8
|
+
} & import("../..").TextNoTruncateProps & Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "slot" | "style" | "title" | "dir" | "children" | "className" | "aria-hidden" | "onAnimationStart" | "onDragStart" | "onDragEnd" | "onDrag" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "autoFocus" | "contentEditable" | "contextMenu" | "draggable" | "hidden" | "id" | "lang" | "nonce" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "content" | "datatype" | "inlist" | "prefix" | "property" | "rel" | "resource" | "rev" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-braillelabel" | "aria-brailleroledescription" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colindextext" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-description" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "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-rowindextext" | "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" | "onResize" | "onResizeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDragCapture" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "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" | "onPointerLeave" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | keyof import("react").ClassAttributes<HTMLSpanElement>>, "ref">) & import("react").RefAttributes<HTMLSpanElement>) & {
|
|
9
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
10
|
+
}) & {
|
|
11
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
12
|
+
}, {}, {}>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import _styled from "@emotion/styled/base";
|
|
2
|
+
import { css } from '@codecademy/gamut-styles';
|
|
3
|
+
import { Text } from '../../Typography';
|
|
4
|
+
export const ScreenreaderNavigableText = /*#__PURE__*/_styled(Text, {
|
|
5
|
+
target: "e1rvjfdo0",
|
|
6
|
+
label: "ScreenreaderNavigableText"
|
|
7
|
+
})(css({
|
|
8
|
+
position: 'absolute'
|
|
9
|
+
}), process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9UaXAvSW5mb1RpcC9lbGVtZW50cy50c3giXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBS3lDIiwiZmlsZSI6Ii4uLy4uLy4uL3NyYy9UaXAvSW5mb1RpcC9lbGVtZW50cy50c3giLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBjc3MgfSBmcm9tICdAY29kZWNhZGVteS9nYW11dC1zdHlsZXMnO1xuaW1wb3J0IHN0eWxlZCBmcm9tICdAZW1vdGlvbi9zdHlsZWQnO1xuXG5pbXBvcnQgeyBUZXh0IH0gZnJvbSAnLi4vLi4vVHlwb2dyYXBoeSc7XG5cbmV4cG9ydCBjb25zdCBTY3JlZW5yZWFkZXJOYXZpZ2FibGVUZXh0ID0gc3R5bGVkKFRleHQpKFxuICBjc3MoeyBwb3NpdGlvbjogJ2Fic29sdXRlJyB9KVxuKTtcbiJdfQ== */");
|
|
@@ -2,25 +2,7 @@
|
|
|
2
2
|
import { TipBaseAlignment, TipBaseProps } from '../shared/types';
|
|
3
3
|
export type InfoTipProps = TipBaseProps & {
|
|
4
4
|
alignment?: TipBaseAlignment;
|
|
5
|
-
/**
|
|
6
|
-
* Accessible label for the InfoTip button. Its recommended to provide either `ariaLabel` or `ariaLabelledby`.
|
|
7
|
-
*/
|
|
8
|
-
ariaLabel?: string;
|
|
9
|
-
/**
|
|
10
|
-
* ID of an element that labels the InfoTip button. Its recommended to provide either `ariaLabel` or `ariaLabelledby`.
|
|
11
|
-
*/
|
|
12
|
-
ariaLabelledby?: string;
|
|
13
|
-
/**
|
|
14
|
-
* Accessible role description for the InfoTip button. Useful for translation.
|
|
15
|
-
* @default "More information button"
|
|
16
|
-
*/
|
|
17
|
-
ariaRoleDescription?: string;
|
|
18
5
|
emphasis?: 'low' | 'high';
|
|
19
|
-
/**
|
|
20
|
-
* When true, the InfoTip button will be labelled by the form field's label element.
|
|
21
|
-
* This is automatic for string labels, but can be opted into for ReactNode labels.
|
|
22
|
-
*/
|
|
23
|
-
labelledByFieldLabel?: boolean;
|
|
24
6
|
/**
|
|
25
7
|
* Called when the info tip is clicked - the onClick function is called after the DOM updates and the tip is mounted.
|
|
26
8
|
*/
|