@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 +32 -0
- package/charts-vue.common.js +94 -16
- package/charts-vue.common.js.map +1 -1
- package/charts-vue.umd.js +94 -16
- package/charts-vue.umd.js.map +1 -1
- package/charts-vue.umd.min.js +1 -1
- package/charts-vue.umd.min.js.map +1 -1
- package/package.json +2 -2
package/charts-vue.umd.js
CHANGED
|
@@ -18249,11 +18249,25 @@ var legend_Legend = /** @class */ (function (_super) {
|
|
|
18249
18249
|
hoveredElement: hoveredItem,
|
|
18250
18250
|
});
|
|
18251
18251
|
});
|
|
18252
|
-
svg.selectAll('div.legend-item div.checkbox').on('keyup', function (event
|
|
18253
|
-
if (event.key &&
|
|
18252
|
+
svg.selectAll('div.legend-item div.checkbox').on('keyup', function (event) {
|
|
18253
|
+
if (event.key && event.key === 'Tab') {
|
|
18254
|
+
// Higlight group
|
|
18255
|
+
self.services.events.dispatchEvent(Events.Legend.ITEM_HOVER, {
|
|
18256
|
+
hoveredElement: src_select(this),
|
|
18257
|
+
});
|
|
18258
|
+
}
|
|
18259
|
+
});
|
|
18260
|
+
svg.selectAll('div.legend-item div.checkbox').on('keydown', function (event, d) {
|
|
18261
|
+
if (event.key && event.key === ' ') {
|
|
18254
18262
|
event.preventDefault();
|
|
18255
18263
|
self.model.toggleDataLabel(d.name);
|
|
18256
18264
|
}
|
|
18265
|
+
else if (event.key && event.key === 'Tab') {
|
|
18266
|
+
// Unhiglight group
|
|
18267
|
+
self.services.events.dispatchEvent(Events.Legend.ITEM_MOUSEOUT, {
|
|
18268
|
+
hoveredElement: src_select(this),
|
|
18269
|
+
});
|
|
18270
|
+
}
|
|
18257
18271
|
});
|
|
18258
18272
|
svg.selectAll('g.additional-item').on('mouseover', function (event) {
|
|
18259
18273
|
var hoveredItem = src_select(this);
|
|
@@ -35389,8 +35403,9 @@ var axis_Axis = /** @class */ (function (_super) {
|
|
|
35389
35403
|
var mockTextPiece = invisibleAxisRef
|
|
35390
35404
|
.append('text')
|
|
35391
35405
|
.text('A');
|
|
35392
|
-
var averageLetterWidth_1 = mockTextPiece.node()
|
|
35393
|
-
|
|
35406
|
+
var averageLetterWidth_1 = dom_utils_DOMUtils.getSVGElementSize(mockTextPiece.node(), {
|
|
35407
|
+
useBBox: true,
|
|
35408
|
+
}).width;
|
|
35394
35409
|
var lastStartPosition_1;
|
|
35395
35410
|
// Find out whether any text nodes roughly collide
|
|
35396
35411
|
invisibleAxisRef.selectAll('g.tick').each(function () {
|
|
@@ -38565,6 +38580,7 @@ var toolbar_Toolbar = /** @class */ (function (_super) {
|
|
|
38565
38580
|
.append('div')
|
|
38566
38581
|
.attr('class', 'toolbar-control bx--overflow-menu')
|
|
38567
38582
|
.attr('role', 'button');
|
|
38583
|
+
var self_1 = this;
|
|
38568
38584
|
var allToolbarControls = enteringToolbarControls
|
|
38569
38585
|
.merge(toolbarControls)
|
|
38570
38586
|
.classed('disabled', function (d) {
|
|
@@ -38575,16 +38591,23 @@ var toolbar_Toolbar = /** @class */ (function (_super) {
|
|
|
38575
38591
|
})
|
|
38576
38592
|
.attr('aria-label', function (d) { return d.title; })
|
|
38577
38593
|
.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>"; })
|
|
38578
|
-
.each(function (d) {
|
|
38594
|
+
.each(function (d, index) {
|
|
38579
38595
|
src_select(this)
|
|
38580
38596
|
.select('button')
|
|
38581
38597
|
.on('click', !d.shouldBeDisabled() ? d.clickFunction : null)
|
|
38582
|
-
.on('
|
|
38598
|
+
.on('keydown', function (event) {
|
|
38583
38599
|
if ((event.key && event.key === 'Enter') ||
|
|
38584
38600
|
event.key === ' ') {
|
|
38585
38601
|
event.preventDefault();
|
|
38586
38602
|
d.clickFunction();
|
|
38587
38603
|
}
|
|
38604
|
+
else if (event.key && event.key === 'ArrowLeft') {
|
|
38605
|
+
self_1.focusOnPreviousEnabledToolbarItem(index);
|
|
38606
|
+
}
|
|
38607
|
+
else if (event.key &&
|
|
38608
|
+
event.key === 'ArrowRight') {
|
|
38609
|
+
self_1.focusOnNextEnabledToolbarItem(index);
|
|
38610
|
+
}
|
|
38588
38611
|
});
|
|
38589
38612
|
});
|
|
38590
38613
|
this.overflowButton = this.getComponentContainer().select("button.bx--overflow-menu__trigger#" + this.services.domUtils.generateElementIDString('control-toolbar-overflow-menu'));
|
|
@@ -38638,6 +38661,43 @@ var toolbar_Toolbar = /** @class */ (function (_super) {
|
|
|
38638
38661
|
this.services.events.dispatchEvent(Events.Toolbar.HIDE_OVERFLOW_MENU);
|
|
38639
38662
|
}
|
|
38640
38663
|
};
|
|
38664
|
+
// Toolbar controllers
|
|
38665
|
+
Toolbar.prototype.focusOnPreviousEnabledToolbarItem = function (currentItemIndex) {
|
|
38666
|
+
var buttonList = this.getToolbarButtonItems();
|
|
38667
|
+
var previousItemIndex = buttonList.length;
|
|
38668
|
+
for (var i = currentItemIndex - 1; i >= 0; i--) {
|
|
38669
|
+
var previousButtonItem = buttonList[i];
|
|
38670
|
+
if (!previousButtonItem.shouldBeDisabled()) {
|
|
38671
|
+
previousItemIndex = i;
|
|
38672
|
+
break;
|
|
38673
|
+
}
|
|
38674
|
+
}
|
|
38675
|
+
// only if previous enabled menu item found
|
|
38676
|
+
if (previousItemIndex < buttonList.length) {
|
|
38677
|
+
var previousItemNode = src_select("button#" + this.services.domUtils.generateElementIDString("control-" + buttonList[previousItemIndex].id)).node();
|
|
38678
|
+
if ('focus' in previousItemNode) {
|
|
38679
|
+
previousItemNode.focus();
|
|
38680
|
+
}
|
|
38681
|
+
}
|
|
38682
|
+
};
|
|
38683
|
+
Toolbar.prototype.focusOnNextEnabledToolbarItem = function (currentItemIndex) {
|
|
38684
|
+
var buttonList = this.getToolbarButtonItems();
|
|
38685
|
+
var nextItemIndex = -1;
|
|
38686
|
+
for (var i = currentItemIndex + 1; i < buttonList.length; i++) {
|
|
38687
|
+
var nextOverflowMenuItem = buttonList[i];
|
|
38688
|
+
if (!nextOverflowMenuItem.shouldBeDisabled()) {
|
|
38689
|
+
nextItemIndex = i;
|
|
38690
|
+
break;
|
|
38691
|
+
}
|
|
38692
|
+
}
|
|
38693
|
+
// only if next enabled menu item found
|
|
38694
|
+
if (nextItemIndex > -1) {
|
|
38695
|
+
var nextItemNode = src_select("button#" + this.services.domUtils.generateElementIDString("control-" + buttonList[nextItemIndex].id)).node();
|
|
38696
|
+
if ('focus' in nextItemNode) {
|
|
38697
|
+
nextItemNode.focus();
|
|
38698
|
+
}
|
|
38699
|
+
}
|
|
38700
|
+
};
|
|
38641
38701
|
Toolbar.prototype.focusOnPreviousEnabledMenuItem = function (currentItemIndex) {
|
|
38642
38702
|
var overflowMenuItems = this.getOverflowMenuItems();
|
|
38643
38703
|
var previousItemIndex = overflowMenuItems.length;
|
|
@@ -38684,7 +38744,7 @@ var toolbar_Toolbar = /** @class */ (function (_super) {
|
|
|
38684
38744
|
// show overflow menu
|
|
38685
38745
|
this.updateOverflowMenu(true);
|
|
38686
38746
|
// setup overflow menu item event listener
|
|
38687
|
-
var
|
|
38747
|
+
var self_2 = this;
|
|
38688
38748
|
var overflowMenuItems = this.getOverflowMenuItems();
|
|
38689
38749
|
overflowMenuItems.forEach(function (menuItem, index) {
|
|
38690
38750
|
var element = src_select("#" + _this.services.domUtils.generateElementIDString("control-" + menuItem.id));
|
|
@@ -38693,29 +38753,37 @@ var toolbar_Toolbar = /** @class */ (function (_super) {
|
|
|
38693
38753
|
// call the specified function
|
|
38694
38754
|
menuItem.clickFunction();
|
|
38695
38755
|
// hide overflow menu
|
|
38696
|
-
|
|
38756
|
+
self_2.updateOverflowMenu(false);
|
|
38697
38757
|
});
|
|
38698
|
-
element.on('
|
|
38699
|
-
if (
|
|
38758
|
+
element.on('keydown', function (keyEvent) {
|
|
38759
|
+
if (keyEvent && keyEvent.key === 'Enter') {
|
|
38700
38760
|
// call the specified function
|
|
38701
38761
|
menuItem.clickFunction();
|
|
38702
38762
|
}
|
|
38703
|
-
else if (
|
|
38763
|
+
else if (keyEvent && keyEvent.key === 'ArrowUp') {
|
|
38704
38764
|
// focus on previous menu item
|
|
38705
|
-
|
|
38765
|
+
self_2.focusOnPreviousEnabledMenuItem(index);
|
|
38706
38766
|
}
|
|
38707
|
-
else if (
|
|
38767
|
+
else if (keyEvent && keyEvent.key === 'ArrowDown') {
|
|
38708
38768
|
// focus on next menu item
|
|
38709
|
-
|
|
38769
|
+
self_2.focusOnNextEnabledMenuItem(index);
|
|
38770
|
+
}
|
|
38771
|
+
else if (keyEvent && keyEvent.key === 'Escape') {
|
|
38772
|
+
self_2.updateOverflowMenu(false);
|
|
38710
38773
|
}
|
|
38711
38774
|
// Not hide overflow menu by keyboard arrow up/down event
|
|
38775
|
+
// Prevent page from scrolling up/down
|
|
38776
|
+
keyEvent.preventDefault();
|
|
38712
38777
|
});
|
|
38713
38778
|
}
|
|
38714
38779
|
});
|
|
38715
38780
|
// default to focus on the first enabled menu item
|
|
38716
|
-
|
|
38781
|
+
self_2.focusOnNextEnabledMenuItem(-1);
|
|
38782
|
+
}
|
|
38783
|
+
// propogation should not be stopped for keyboard events
|
|
38784
|
+
if (!!event) {
|
|
38785
|
+
event.stopImmediatePropagation();
|
|
38717
38786
|
}
|
|
38718
|
-
event.stopImmediatePropagation();
|
|
38719
38787
|
};
|
|
38720
38788
|
Toolbar.prototype.getControlConfigs = function () {
|
|
38721
38789
|
var _this = this;
|
|
@@ -38748,6 +38816,16 @@ var toolbar_Toolbar = /** @class */ (function (_super) {
|
|
|
38748
38816
|
overflowMenuItemList: controlList.concat(overflowSpecificControls),
|
|
38749
38817
|
};
|
|
38750
38818
|
};
|
|
38819
|
+
Toolbar.prototype.getToolbarButtonItems = function () {
|
|
38820
|
+
var _a = this.getControlConfigs(), buttonList = _a.buttonList, overflowMenuItemList = _a.overflowMenuItemList;
|
|
38821
|
+
if (!!overflowMenuItemList) {
|
|
38822
|
+
buttonList.push(this.getOverflowButtonConfig());
|
|
38823
|
+
}
|
|
38824
|
+
if (!!buttonList) {
|
|
38825
|
+
return buttonList;
|
|
38826
|
+
}
|
|
38827
|
+
return [];
|
|
38828
|
+
};
|
|
38751
38829
|
Toolbar.prototype.getOverflowMenuItems = function () {
|
|
38752
38830
|
var overflowMenuItemList = this.getControlConfigs().overflowMenuItemList;
|
|
38753
38831
|
if (!!overflowMenuItemList) {
|