@carbon/charts-vue 0.51.1 → 0.52.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/CHANGELOG.md CHANGED
@@ -3,6 +3,38 @@
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
+ # [0.52.0](https://github.com/carbon-design-system/carbon-charts/compare/v0.51.4...v0.52.0) (2021-11-18)
7
+
8
+ **Note:** Version bump only for package @carbon/charts-vue
9
+
10
+
11
+
12
+
13
+
14
+ ## [0.51.4](https://github.com/carbon-design-system/carbon-charts/compare/v0.51.3...v0.51.4) (2021-11-16)
15
+
16
+ **Note:** Version bump only for package @carbon/charts-vue
17
+
18
+
19
+
20
+
21
+
22
+ ## [0.51.3](https://github.com/carbon-design-system/carbon-charts/compare/v0.51.2...v0.51.3) (2021-11-03)
23
+
24
+ **Note:** Version bump only for package @carbon/charts-vue
25
+
26
+
27
+
28
+
29
+
30
+ ## [0.51.2](https://github.com/carbon-design-system/carbon-charts/compare/v0.51.1...v0.51.2) (2021-11-02)
31
+
32
+ **Note:** Version bump only for package @carbon/charts-vue
33
+
34
+
35
+
36
+
37
+
6
38
  ## [0.51.1](https://github.com/carbon-design-system/carbon-charts/compare/v0.51.0...v0.51.1) (2021-11-02)
7
39
 
8
40
  **Note:** Version bump only for package @carbon/charts-vue
@@ -18240,11 +18240,25 @@ var legend_Legend = /** @class */ (function (_super) {
18240
18240
  hoveredElement: hoveredItem,
18241
18241
  });
18242
18242
  });
18243
- svg.selectAll('div.legend-item div.checkbox').on('keyup', function (event, d) {
18244
- if (event.key && (event.key === 'Enter' || event.key === ' ')) {
18243
+ svg.selectAll('div.legend-item div.checkbox').on('keyup', function (event) {
18244
+ if (event.key && event.key === 'Tab') {
18245
+ // Higlight group
18246
+ self.services.events.dispatchEvent(Events.Legend.ITEM_HOVER, {
18247
+ hoveredElement: src_select(this),
18248
+ });
18249
+ }
18250
+ });
18251
+ svg.selectAll('div.legend-item div.checkbox').on('keydown', function (event, d) {
18252
+ if (event.key && event.key === ' ') {
18245
18253
  event.preventDefault();
18246
18254
  self.model.toggleDataLabel(d.name);
18247
18255
  }
18256
+ else if (event.key && event.key === 'Tab') {
18257
+ // Unhiglight group
18258
+ self.services.events.dispatchEvent(Events.Legend.ITEM_MOUSEOUT, {
18259
+ hoveredElement: src_select(this),
18260
+ });
18261
+ }
18248
18262
  });
18249
18263
  svg.selectAll('g.additional-item').on('mouseover', function (event) {
18250
18264
  var hoveredItem = src_select(this);
@@ -35380,8 +35394,9 @@ var axis_Axis = /** @class */ (function (_super) {
35380
35394
  var mockTextPiece = invisibleAxisRef
35381
35395
  .append('text')
35382
35396
  .text('A');
35383
- var averageLetterWidth_1 = mockTextPiece.node().getBBox()
35384
- .width;
35397
+ var averageLetterWidth_1 = dom_utils_DOMUtils.getSVGElementSize(mockTextPiece.node(), {
35398
+ useBBox: true,
35399
+ }).width;
35385
35400
  var lastStartPosition_1;
35386
35401
  // Find out whether any text nodes roughly collide
35387
35402
  invisibleAxisRef.selectAll('g.tick').each(function () {
@@ -38556,6 +38571,7 @@ var toolbar_Toolbar = /** @class */ (function (_super) {
38556
38571
  .append('div')
38557
38572
  .attr('class', 'toolbar-control bx--overflow-menu')
38558
38573
  .attr('role', 'button');
38574
+ var self_1 = this;
38559
38575
  var allToolbarControls = enteringToolbarControls
38560
38576
  .merge(toolbarControls)
38561
38577
  .classed('disabled', function (d) {
@@ -38566,16 +38582,23 @@ var toolbar_Toolbar = /** @class */ (function (_super) {
38566
38582
  })
38567
38583
  .attr('aria-label', function (d) { return d.title; })
38568
38584
  .html(function (d) { return "\n\t\t\t<button\n\t\t\t\tclass=\"bx--overflow-menu__trigger\"\n\t\t\t\taria-haspopup=\"true\" aria-expanded=\"false\" id=\"" + _this.services.domUtils.generateElementIDString("control-" + d.id) + "\" aria-label=\"" + d.title + "\">\n\t\t\t\t<svg focusable=\"false\" preserveAspectRatio=\"xMidYMid meet\" style=\"will-change: transform; width: " + (d.iconWidth !== undefined ? d.iconWidth : '20px') + "; height: " + (d.iconWidth !== undefined ? d.iconHeight : '20px') + "\" xmlns=\"http://www.w3.org/2000/svg\" class=\"bx--overflow-menu__icon\" viewBox=\"0 0 32 32\" aria-hidden=\"true\">\n\t\t\t\t\t" + d.iconSVGContent + "\n\t\t\t\t</svg>\n\t\t\t</button>"; })
38569
- .each(function (d) {
38585
+ .each(function (d, index) {
38570
38586
  src_select(this)
38571
38587
  .select('button')
38572
38588
  .on('click', !d.shouldBeDisabled() ? d.clickFunction : null)
38573
- .on('keyup', function (event) {
38589
+ .on('keydown', function (event) {
38574
38590
  if ((event.key && event.key === 'Enter') ||
38575
38591
  event.key === ' ') {
38576
38592
  event.preventDefault();
38577
38593
  d.clickFunction();
38578
38594
  }
38595
+ else if (event.key && event.key === 'ArrowLeft') {
38596
+ self_1.focusOnPreviousEnabledToolbarItem(index);
38597
+ }
38598
+ else if (event.key &&
38599
+ event.key === 'ArrowRight') {
38600
+ self_1.focusOnNextEnabledToolbarItem(index);
38601
+ }
38579
38602
  });
38580
38603
  });
38581
38604
  this.overflowButton = this.getComponentContainer().select("button.bx--overflow-menu__trigger#" + this.services.domUtils.generateElementIDString('control-toolbar-overflow-menu'));
@@ -38629,6 +38652,43 @@ var toolbar_Toolbar = /** @class */ (function (_super) {
38629
38652
  this.services.events.dispatchEvent(Events.Toolbar.HIDE_OVERFLOW_MENU);
38630
38653
  }
38631
38654
  };
38655
+ // Toolbar controllers
38656
+ Toolbar.prototype.focusOnPreviousEnabledToolbarItem = function (currentItemIndex) {
38657
+ var buttonList = this.getToolbarButtonItems();
38658
+ var previousItemIndex = buttonList.length;
38659
+ for (var i = currentItemIndex - 1; i >= 0; i--) {
38660
+ var previousButtonItem = buttonList[i];
38661
+ if (!previousButtonItem.shouldBeDisabled()) {
38662
+ previousItemIndex = i;
38663
+ break;
38664
+ }
38665
+ }
38666
+ // only if previous enabled menu item found
38667
+ if (previousItemIndex < buttonList.length) {
38668
+ var previousItemNode = src_select("button#" + this.services.domUtils.generateElementIDString("control-" + buttonList[previousItemIndex].id)).node();
38669
+ if ('focus' in previousItemNode) {
38670
+ previousItemNode.focus();
38671
+ }
38672
+ }
38673
+ };
38674
+ Toolbar.prototype.focusOnNextEnabledToolbarItem = function (currentItemIndex) {
38675
+ var buttonList = this.getToolbarButtonItems();
38676
+ var nextItemIndex = -1;
38677
+ for (var i = currentItemIndex + 1; i < buttonList.length; i++) {
38678
+ var nextOverflowMenuItem = buttonList[i];
38679
+ if (!nextOverflowMenuItem.shouldBeDisabled()) {
38680
+ nextItemIndex = i;
38681
+ break;
38682
+ }
38683
+ }
38684
+ // only if next enabled menu item found
38685
+ if (nextItemIndex > -1) {
38686
+ var nextItemNode = src_select("button#" + this.services.domUtils.generateElementIDString("control-" + buttonList[nextItemIndex].id)).node();
38687
+ if ('focus' in nextItemNode) {
38688
+ nextItemNode.focus();
38689
+ }
38690
+ }
38691
+ };
38632
38692
  Toolbar.prototype.focusOnPreviousEnabledMenuItem = function (currentItemIndex) {
38633
38693
  var overflowMenuItems = this.getOverflowMenuItems();
38634
38694
  var previousItemIndex = overflowMenuItems.length;
@@ -38675,7 +38735,7 @@ var toolbar_Toolbar = /** @class */ (function (_super) {
38675
38735
  // show overflow menu
38676
38736
  this.updateOverflowMenu(true);
38677
38737
  // setup overflow menu item event listener
38678
- var self_1 = this;
38738
+ var self_2 = this;
38679
38739
  var overflowMenuItems = this.getOverflowMenuItems();
38680
38740
  overflowMenuItems.forEach(function (menuItem, index) {
38681
38741
  var element = src_select("#" + _this.services.domUtils.generateElementIDString("control-" + menuItem.id));
@@ -38684,29 +38744,37 @@ var toolbar_Toolbar = /** @class */ (function (_super) {
38684
38744
  // call the specified function
38685
38745
  menuItem.clickFunction();
38686
38746
  // hide overflow menu
38687
- self_1.updateOverflowMenu(false);
38747
+ self_2.updateOverflowMenu(false);
38688
38748
  });
38689
- element.on('keyup', function () {
38690
- if (event.key === 'Enter') {
38749
+ element.on('keydown', function (keyEvent) {
38750
+ if (keyEvent && keyEvent.key === 'Enter') {
38691
38751
  // call the specified function
38692
38752
  menuItem.clickFunction();
38693
38753
  }
38694
- else if (event.key === 'ArrowUp') {
38754
+ else if (keyEvent && keyEvent.key === 'ArrowUp') {
38695
38755
  // focus on previous menu item
38696
- self_1.focusOnPreviousEnabledMenuItem(index);
38756
+ self_2.focusOnPreviousEnabledMenuItem(index);
38697
38757
  }
38698
- else if (event.key === 'ArrowDown') {
38758
+ else if (keyEvent && keyEvent.key === 'ArrowDown') {
38699
38759
  // focus on next menu item
38700
- self_1.focusOnNextEnabledMenuItem(index);
38760
+ self_2.focusOnNextEnabledMenuItem(index);
38761
+ }
38762
+ else if (keyEvent && keyEvent.key === 'Escape') {
38763
+ self_2.updateOverflowMenu(false);
38701
38764
  }
38702
38765
  // Not hide overflow menu by keyboard arrow up/down event
38766
+ // Prevent page from scrolling up/down
38767
+ keyEvent.preventDefault();
38703
38768
  });
38704
38769
  }
38705
38770
  });
38706
38771
  // default to focus on the first enabled menu item
38707
- self_1.focusOnNextEnabledMenuItem(-1);
38772
+ self_2.focusOnNextEnabledMenuItem(-1);
38773
+ }
38774
+ // propogation should not be stopped for keyboard events
38775
+ if (!!event) {
38776
+ event.stopImmediatePropagation();
38708
38777
  }
38709
- event.stopImmediatePropagation();
38710
38778
  };
38711
38779
  Toolbar.prototype.getControlConfigs = function () {
38712
38780
  var _this = this;
@@ -38739,6 +38807,16 @@ var toolbar_Toolbar = /** @class */ (function (_super) {
38739
38807
  overflowMenuItemList: controlList.concat(overflowSpecificControls),
38740
38808
  };
38741
38809
  };
38810
+ Toolbar.prototype.getToolbarButtonItems = function () {
38811
+ var _a = this.getControlConfigs(), buttonList = _a.buttonList, overflowMenuItemList = _a.overflowMenuItemList;
38812
+ if (!!overflowMenuItemList) {
38813
+ buttonList.push(this.getOverflowButtonConfig());
38814
+ }
38815
+ if (!!buttonList) {
38816
+ return buttonList;
38817
+ }
38818
+ return [];
38819
+ };
38742
38820
  Toolbar.prototype.getOverflowMenuItems = function () {
38743
38821
  var overflowMenuItemList = this.getControlConfigs().overflowMenuItemList;
38744
38822
  if (!!overflowMenuItemList) {