@redsift/dashboard 6.3.0 → 6.3.1

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 (3) hide show
  1. package/index.js +40 -15
  2. package/index.js.map +1 -1
  3. package/package.json +4 -4
package/index.js CHANGED
@@ -4156,6 +4156,7 @@ const useChartAsListbox = _ref => {
4156
4156
  numberOfGroups,
4157
4157
  chartRef,
4158
4158
  chart,
4159
+ labelling,
4159
4160
  orientation = 'horizontal'
4160
4161
  } = _ref;
4161
4162
  const currentIndexRef = useRef(0);
@@ -4236,7 +4237,15 @@ const useChartAsListbox = _ref => {
4236
4237
  // Add role, aria attributes and keyboard events to the group of options.
4237
4238
  chartRef.setAttribute('tabIndex', '0');
4238
4239
  chartRef.setAttribute('role', 'listbox');
4239
- chartRef.setAttribute('aria-labelledby', `id${id}__title`);
4240
+ if (labelling.ariaLabel) {
4241
+ chartRef.setAttribute('aria-label', labelling.ariaLabel);
4242
+ } else if (labelling.ariaLabelledby) {
4243
+ chartRef.setAttribute('aria-labelledby', labelling.ariaLabelledby);
4244
+ } else if (labelling.hasTitle) {
4245
+ chartRef.setAttribute('aria-labelledby', `id${id}__title`);
4246
+ } else {
4247
+ chartRef.setAttribute('aria-label', labelling.fallbackAriaLabel);
4248
+ }
4240
4249
  chartRef.setAttribute('aria-multiselectable', 'true');
4241
4250
  chartRef.setAttribute('aria-orientation', orientation);
4242
4251
  chartRef.setAttribute('aria-activedescendant', `id${id}__option-0`);
@@ -4263,7 +4272,7 @@ const useChartAsListbox = _ref => {
4263
4272
  }, [chart]);
4264
4273
  };
4265
4274
 
4266
- const _excluded$2 = ["areXLabelsRotated", "caping", "caption", "className", "data", "datagridFilter", "dimension", "group", "isDimensionArray", "isResetable", "localeText", "onFilter", "others", "setLabels", "size", "theme", "title"];
4275
+ const _excluded$2 = ["aria-label", "aria-labelledby", "areXLabelsRotated", "caping", "caption", "className", "data", "datagridFilter", "dimension", "group", "isDimensionArray", "isResetable", "localeText", "onFilter", "others", "setLabels", "size", "theme", "title"];
4267
4276
  const COMPONENT_NAME$2 = 'RedSiftHorizontalBarChart';
4268
4277
  const CLASSNAME$2 = 'redsift-horizontal-barchart';
4269
4278
  const DEFAULT_PROPS$2 = {
@@ -4273,8 +4282,7 @@ const DEFAULT_PROPS$2 = {
4273
4282
  },
4274
4283
  others: true,
4275
4284
  size: HorizontalBarChartSize.medium,
4276
- theme: HorizontalBarChartTheme.default,
4277
- title: 'Horizontal Bar Chart'
4285
+ theme: HorizontalBarChartTheme.default
4278
4286
  };
4279
4287
  const sizeToDimension$2 = size => {
4280
4288
  switch (size) {
@@ -4304,6 +4312,8 @@ const HorizontalBarChart = /*#__PURE__*/forwardRef((props, ref) => {
4304
4312
  const [groups, setGroups] = useState();
4305
4313
  const [dimensions, setDimensions] = useState();
4306
4314
  const {
4315
+ 'aria-label': ariaLabel,
4316
+ 'aria-labelledby': ariaLabelledby,
4307
4317
  areXLabelsRotated,
4308
4318
  caping,
4309
4319
  caption,
@@ -4453,15 +4463,22 @@ const HorizontalBarChart = /*#__PURE__*/forwardRef((props, ref) => {
4453
4463
  numberOfGroups: numberOfGroups || 0,
4454
4464
  chartRef: chartRef.current,
4455
4465
  chart: chart,
4466
+ labelling: {
4467
+ ariaLabel,
4468
+ ariaLabelledby,
4469
+ hasTitle: !!title,
4470
+ fallbackAriaLabel: 'Horizontal Bar Chart'
4471
+ },
4456
4472
  orientation: 'vertical'
4457
4473
  });
4458
4474
  return /*#__PURE__*/React.createElement(StyledHorizontalBarChart, _extends({}, forwardedProps, {
4459
4475
  className: classNames(HorizontalBarChart.className, className),
4460
4476
  ref: containerRef
4461
4477
  }), /*#__PURE__*/React.createElement(StyledHorizontalBarChartTitle, {
4462
- className: `${HorizontalBarChart.className}__title`,
4478
+ className: `${HorizontalBarChart.className}__title`
4479
+ }, title ? /*#__PURE__*/React.createElement("div", {
4463
4480
  id: `id${id}__title`
4464
- }, title, chart && isResetable ? /*#__PURE__*/React.createElement(Button, {
4481
+ }, title) : null, chart && isResetable ? /*#__PURE__*/React.createElement(Button, {
4465
4482
  variant: "text",
4466
4483
  size: "small",
4467
4484
  color: "primary",
@@ -7621,7 +7638,7 @@ const StyledPieChartContainer = styled.div`
7621
7638
  }
7622
7639
  `;
7623
7640
 
7624
- const _excluded$1 = ["caping", "caption", "className", "data", "datagridFilter", "isResetable", "labelVariant", "dimension", "group", "isDimensionArray", "localeText", "onFilter", "others", "setLabels", "size", "text", "middleText", "subtext", "theme", "title", "variant"];
7641
+ const _excluded$1 = ["aria-label", "aria-labelledby", "caping", "caption", "className", "data", "datagridFilter", "isResetable", "labelVariant", "dimension", "group", "isDimensionArray", "localeText", "onFilter", "others", "setLabels", "size", "text", "middleText", "subtext", "theme", "title", "variant"];
7625
7642
  const COMPONENT_NAME$1 = 'RedSiftPieChart';
7626
7643
  const CLASSNAME$1 = 'redsift-piechart';
7627
7644
  const DEFAULT_PROPS$1 = {
@@ -7633,7 +7650,6 @@ const DEFAULT_PROPS$1 = {
7633
7650
  others: true,
7634
7651
  size: PieChartSize.medium,
7635
7652
  theme: PieChartTheme.default,
7636
- title: 'Pie Chart',
7637
7653
  variant: PieChartVariant.plain
7638
7654
  };
7639
7655
  const sizeToDimension$1 = size => {
@@ -7696,6 +7712,8 @@ const PieChart = /*#__PURE__*/forwardRef((props, ref) => {
7696
7712
  const [groups, setGroups] = useState();
7697
7713
  const [dimensions, setDimensions] = useState();
7698
7714
  const {
7715
+ 'aria-label': ariaLabel,
7716
+ 'aria-labelledby': ariaLabelledby,
7699
7717
  caping,
7700
7718
  caption,
7701
7719
  className,
@@ -7836,7 +7854,13 @@ const PieChart = /*#__PURE__*/forwardRef((props, ref) => {
7836
7854
  querySelector: 'g.pie-slice',
7837
7855
  numberOfGroups: numberOfGroups || 0,
7838
7856
  chartRef: chartRef.current,
7839
- chart: chart
7857
+ chart: chart,
7858
+ labelling: {
7859
+ ariaLabel,
7860
+ ariaLabelledby,
7861
+ hasTitle: !!title,
7862
+ fallbackAriaLabel: 'Pie Chart'
7863
+ }
7840
7864
  });
7841
7865
  return /*#__PURE__*/React.createElement(StyledPieChart, _extends({}, forwardedProps, {
7842
7866
  id: id,
@@ -7845,9 +7869,10 @@ const PieChart = /*#__PURE__*/forwardRef((props, ref) => {
7845
7869
  $spaced: variant === PieChartVariant.spaced || variant === PieChartVariant.spacedDonut,
7846
7870
  $showLabels: labelVariant === PieChartLabelVariant.internal
7847
7871
  }), /*#__PURE__*/React.createElement(StyledPieChartTitle, {
7848
- className: `${PieChart.className}__title`,
7872
+ className: `${PieChart.className}__title`
7873
+ }, title ? /*#__PURE__*/React.createElement("div", {
7849
7874
  id: `id${id}__title`
7850
- }, title, chart && isResetable ? /*#__PURE__*/React.createElement(Button, {
7875
+ }, title) : null, chart && isResetable ? /*#__PURE__*/React.createElement(Button, {
7851
7876
  variant: "text",
7852
7877
  size: "small",
7853
7878
  color: "primary",
@@ -8012,8 +8037,7 @@ const DEFAULT_PROPS = {
8012
8037
  localeText: {
8013
8038
  resetLabel: 'Reset'
8014
8039
  },
8015
- size: TimeSeriesBarChartSize.medium,
8016
- title: 'Time Series Bar Chart'
8040
+ size: TimeSeriesBarChartSize.medium
8017
8041
  };
8018
8042
  const getStartDate = dates => new Date(Math.min(...dates.map(Number)));
8019
8043
  const getEndDate = dates => new Date(Math.max(...dates.map(Number)));
@@ -8296,9 +8320,10 @@ const TimeSeriesBarChart = /*#__PURE__*/forwardRef((props, ref) => {
8296
8320
  className: classNames(TimeSeriesBarChart.className, className),
8297
8321
  ref: containerRef
8298
8322
  }), /*#__PURE__*/React.createElement(StyledTimeSeriesBarChartTitle, {
8299
- className: `${TimeSeriesBarChart.className}__title`,
8323
+ className: `${TimeSeriesBarChart.className}__title`
8324
+ }, title ? /*#__PURE__*/React.createElement("div", {
8300
8325
  id: `id${id}__title`
8301
- }, title, chart && isResetable ? /*#__PURE__*/React.createElement(Button, {
8326
+ }, title) : null, chart && isResetable ? /*#__PURE__*/React.createElement(Button, {
8302
8327
  variant: "text",
8303
8328
  size: "small",
8304
8329
  color: "primary",