@carbon/charts-vue 1.6.0 → 1.6.2

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/CHANGELOG.md CHANGED
@@ -3,6 +3,22 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [1.6.2](https://github.com/carbon-design-system/carbon-charts/compare/v1.6.1...v1.6.2) (2022-12-06)
7
+
8
+ **Note:** Version bump only for package @carbon/charts-vue
9
+
10
+
11
+
12
+
13
+
14
+ ## [1.6.1](https://github.com/carbon-design-system/carbon-charts/compare/v1.6.0...v1.6.1) (2022-10-20)
15
+
16
+ **Note:** Version bump only for package @carbon/charts-vue
17
+
18
+
19
+
20
+
21
+
6
22
  # [1.6.0](https://github.com/carbon-design-system/carbon-charts/compare/v1.5.8...v1.6.0) (2022-09-27)
7
23
 
8
24
  **Note:** Version bump only for package @carbon/charts-vue
@@ -20756,7 +20756,6 @@ var legend_Legend = /** @class */ (function (_super) {
20756
20756
  var truncationThreshold = tools_Tools.getProperty(truncationOptions, 'threshold');
20757
20757
  var truncationNumCharacter = tools_Tools.getProperty(truncationOptions, 'numCharacter');
20758
20758
  var addedLegendItemsText = svg.selectAll('div.legend-item p');
20759
- var self = this;
20760
20759
  // Add an ID for the checkbox to use through `aria-labelledby`
20761
20760
  addedLegendItemsText.attr('id', function (d, i) {
20762
20761
  var elementToReference = this.parentNode.querySelector('div.checkbox') ||
@@ -20783,7 +20782,7 @@ var legend_Legend = /** @class */ (function (_super) {
20783
20782
  var svg = this.getComponentContainer();
20784
20783
  var options = this.getOptions();
20785
20784
  var legendOptions = tools_Tools.getProperty(options, 'legend');
20786
- var truncationThreshold = tools_Tools.getProperty(legendOptions, 'truncation', 'threshold');
20785
+ var truncation = tools_Tools.getProperty(legendOptions, 'truncation');
20787
20786
  svg.selectAll('div.legend-item')
20788
20787
  .on('mouseover', function (event) {
20789
20788
  self.services.events.dispatchEvent(Events.Legend.ITEM_HOVER, {
@@ -20791,8 +20790,10 @@ var legend_Legend = /** @class */ (function (_super) {
20791
20790
  });
20792
20791
  var hoveredItem = src_select(this);
20793
20792
  hoveredItem.select('div.checkbox').classed('hovered', true);
20793
+ // Show tooltip if character length is greater than threshold & there is no truncation
20794
20794
  var hoveredItemData = hoveredItem.datum();
20795
- if (hoveredItemData.name.length > truncationThreshold) {
20795
+ if (hoveredItemData.name.length > truncation.threshold &&
20796
+ truncation.type !== TruncationTypes.NONE) {
20796
20797
  self.services.events.dispatchEvent(Events.Tooltip.SHOW, {
20797
20798
  event: event,
20798
20799
  hoveredElement: hoveredItem,
@@ -20801,9 +20802,14 @@ var legend_Legend = /** @class */ (function (_super) {
20801
20802
  }
20802
20803
  })
20803
20804
  .on('mousemove', function (event) {
20804
- self.services.events.dispatchEvent(Events.Tooltip.MOVE, {
20805
- event: event,
20806
- });
20805
+ // Emit tooltip move event only if tooltip is shown
20806
+ var hoveredItemData = src_select(this).datum();
20807
+ if (hoveredItemData.name.length > truncation.threshold &&
20808
+ truncation.type !== TruncationTypes.NONE) {
20809
+ self.services.events.dispatchEvent(Events.Tooltip.MOVE, {
20810
+ event: event,
20811
+ });
20812
+ }
20807
20813
  })
20808
20814
  .on('click', function () {
20809
20815
  self.services.events.dispatchEvent(Events.Legend.ITEM_CLICK, {
@@ -20816,7 +20822,12 @@ var legend_Legend = /** @class */ (function (_super) {
20816
20822
  .on('mouseout', function () {
20817
20823
  var hoveredItem = src_select(this);
20818
20824
  hoveredItem.select('div.checkbox').classed('hovered', false);
20819
- self.services.events.dispatchEvent(Events.Tooltip.HIDE);
20825
+ // Emit tooltip hide event only if tooltip is shown
20826
+ var hoveredItemData = hoveredItem.datum();
20827
+ if (hoveredItemData.name.length > truncation.threshold &&
20828
+ truncation.type !== TruncationTypes.NONE) {
20829
+ self.services.events.dispatchEvent(Events.Tooltip.HIDE);
20830
+ }
20820
20831
  self.services.events.dispatchEvent(Events.Legend.ITEM_MOUSEOUT, {
20821
20832
  hoveredElement: hoveredItem,
20822
20833
  });
@@ -20844,7 +20855,7 @@ var legend_Legend = /** @class */ (function (_super) {
20844
20855
  svg.selectAll('g.additional-item').on('mouseover', function (event) {
20845
20856
  var hoveredItem = src_select(this);
20846
20857
  var hoveredItemData = hoveredItem.datum();
20847
- if (hoveredItemData.name.length > truncationThreshold) {
20858
+ if (hoveredItemData.name.length > truncation.threshold) {
20848
20859
  self.services.events.dispatchEvent(Events.Tooltip.SHOW, {
20849
20860
  event: event,
20850
20861
  hoveredElement: hoveredItem,
@@ -36589,27 +36600,6 @@ var hover_axis_HoverAxis = /** @class */ (function (_super) {
36589
36600
  .attr('width', width + configuration_non_customizable_axis.hover.rectanglePadding * 2)
36590
36601
  .attr('height', height)
36591
36602
  .lower();
36592
- // Add keyboard event listeners to each group element
36593
- g.on('keydown', function (event) {
36594
- // Choose specific arrow key depending on the axis
36595
- if (axisPosition === AxisPositions.LEFT ||
36596
- axisPosition === AxisPositions.RIGHT) {
36597
- if (event.key && event.key === 'ArrowUp') {
36598
- self.goNext(this, event);
36599
- }
36600
- else if (event.key && event.key === 'ArrowDown') {
36601
- self.goPrevious(this, event);
36602
- }
36603
- }
36604
- else {
36605
- if (event.key && event.key === 'ArrowLeft') {
36606
- self.goPrevious(this, event);
36607
- }
36608
- else if (event.key && event.key === 'ArrowRight') {
36609
- self.goNext(this, event);
36610
- }
36611
- }
36612
- });
36613
36603
  });
36614
36604
  // Add event listeners to element group
36615
36605
  this.addEventListeners();
@@ -36698,6 +36688,35 @@ var hover_axis_HoverAxis = /** @class */ (function (_super) {
36698
36688
  element: src_select(this),
36699
36689
  datum: src_select(this).select('text').datum(),
36700
36690
  });
36691
+ })
36692
+ .on('keydown', function (event) {
36693
+ // Hide the tooltip when `Escape` is pressed, but keep focus
36694
+ if (event.key && event.key === 'Escape') {
36695
+ self.services.events.dispatchEvent(Events.Tooltip.HIDE);
36696
+ self.services.events.dispatchEvent(Events.Axis.LABEL_BLUR, {
36697
+ event: event,
36698
+ element: src_select(this),
36699
+ datum: src_select(this).select('text').datum(),
36700
+ });
36701
+ }
36702
+ // Choose specific arrow key depending on the axis
36703
+ if (axisPosition === AxisPositions.LEFT ||
36704
+ axisPosition === AxisPositions.RIGHT) {
36705
+ if (event.key && event.key === 'ArrowUp') {
36706
+ self.goNext(this, event);
36707
+ }
36708
+ else if (event.key && event.key === 'ArrowDown') {
36709
+ self.goPrevious(this, event);
36710
+ }
36711
+ }
36712
+ else {
36713
+ if (event.key && event.key === 'ArrowLeft') {
36714
+ self.goPrevious(this, event);
36715
+ }
36716
+ else if (event.key && event.key === 'ArrowRight') {
36717
+ self.goNext(this, event);
36718
+ }
36719
+ }
36701
36720
  });
36702
36721
  };
36703
36722
  // Focus on the next HTML element sibling