@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.
@@ -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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-magma/charts",
3
- "version": "13.0.1",
3
+ "version": "13.0.2-next.0",
4
4
  "license": "MIT",
5
5
  "exports": {
6
6
  ".": {
@@ -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
- document.querySelectorAll('.graph-frame ').forEach(div => {
611
- div.setAttribute('aria-label', 'Interactive chart');
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;