@react-magma/charts 13.0.1 → 13.0.2-next.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/charts.js +8 -6
- package/dist/charts.js.map +1 -1
- package/dist/charts.modern.module.js +8 -6
- package/dist/charts.modern.module.js.map +1 -1
- package/dist/charts.umd.js +8 -6
- package/dist/charts.umd.js.map +1 -1
- package/dist/components/CarbonChart/CarbonChart.d.ts +4 -0
- package/package.json +1 -1
- package/src/components/CarbonChart/CarbonChart.tsx +10 -4
|
@@ -38,5 +38,9 @@ export interface CarbonChartProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
38
38
|
* Type of Chart: area, bar, donut, line, etc.
|
|
39
39
|
*/
|
|
40
40
|
type: CarbonChartType;
|
|
41
|
+
/**
|
|
42
|
+
* Text for the aria-label attribute for main SVG container, if provided
|
|
43
|
+
*/
|
|
44
|
+
ariaLabel?: string;
|
|
41
45
|
}
|
|
42
46
|
export declare const CarbonChart: React.ForwardRefExoticComponent<CarbonChartProps & React.RefAttributes<HTMLDivElement>>;
|
package/package.json
CHANGED
|
@@ -64,6 +64,10 @@ export interface CarbonChartProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
64
64
|
* Type of Chart: area, bar, donut, line, etc.
|
|
65
65
|
*/
|
|
66
66
|
type: CarbonChartType;
|
|
67
|
+
/**
|
|
68
|
+
* Text for the aria-label attribute for main SVG container, if provided
|
|
69
|
+
*/
|
|
70
|
+
ariaLabel?: string;
|
|
67
71
|
}
|
|
68
72
|
|
|
69
73
|
const CarbonChartWrapper = styled.div<{
|
|
@@ -361,7 +365,6 @@ const CarbonChartWrapper = styled.div<{
|
|
|
361
365
|
margin: 0;
|
|
362
366
|
min-width: ${props => props.theme.spaceScale.spacing13};
|
|
363
367
|
overflow: hidden;
|
|
364
|
-
padding:;
|
|
365
368
|
position: relative;
|
|
366
369
|
right: ${props => props.theme.spaceScale.spacing04};
|
|
367
370
|
text-align: center;
|
|
@@ -539,6 +542,7 @@ export const CarbonChart = React.forwardRef<HTMLDivElement, CarbonChartProps>(
|
|
|
539
542
|
type,
|
|
540
543
|
dataSet,
|
|
541
544
|
options,
|
|
545
|
+
ariaLabel,
|
|
542
546
|
...rest
|
|
543
547
|
} = props;
|
|
544
548
|
const theme = React.useContext(ThemeContext);
|
|
@@ -607,9 +611,11 @@ export const CarbonChart = React.forwardRef<HTMLDivElement, CarbonChartProps>(
|
|
|
607
611
|
|
|
608
612
|
// Adding aria-label to main SVG container
|
|
609
613
|
React.useEffect(() => {
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
614
|
+
if (ariaLabel) {
|
|
615
|
+
document.querySelectorAll('.graph-frame ').forEach(div => {
|
|
616
|
+
div.setAttribute('aria-label', ariaLabel);
|
|
617
|
+
});
|
|
618
|
+
}
|
|
613
619
|
});
|
|
614
620
|
|
|
615
621
|
const groupsLength = Object.keys(buildColors()).length;
|