oolib 2.203.1 → 2.203.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.
|
@@ -118,6 +118,7 @@ var BarGraph = function (_a) {
|
|
|
118
118
|
var tagCategory = _a.tagCategory, index1 = _a.index1, _c = _a.showCount, showCount = _c === void 0 ? true : _c, _d = _a.showPercent, showPercent = _d === void 0 ? true : _d, onClick = _a.onClick, debug = _a.debug;
|
|
119
119
|
var containerRef = (0, react_1.useRef)();
|
|
120
120
|
var _e = (0, BarChart_1.useTrackMousePosition)({ containerRef: containerRef }), mousePosition = _e.mousePosition, isHovering = _e.isHovering;
|
|
121
|
+
var _f = (0, react_1.useState)(null), hoveredBarIndex = _f[0], setHoveredBarIndex = _f[1];
|
|
121
122
|
var truncateText = function (text, maxLength) {
|
|
122
123
|
if (maxLength === void 0) { maxLength = 30; }
|
|
123
124
|
if (!text)
|
|
@@ -127,10 +128,10 @@ var BarGraph = function (_a) {
|
|
|
127
128
|
return text.slice(0, maxLength) + '...';
|
|
128
129
|
};
|
|
129
130
|
var handleBarMouseEnter = function (index) {
|
|
130
|
-
|
|
131
|
+
setHoveredBarIndex(index);
|
|
131
132
|
};
|
|
132
133
|
var handleBarMouseLeave = function () {
|
|
133
|
-
|
|
134
|
+
setHoveredBarIndex(null);
|
|
134
135
|
};
|
|
135
136
|
var handleBarClick = function (tag) {
|
|
136
137
|
if (onClick) {
|
|
@@ -146,6 +147,7 @@ var BarGraph = function (_a) {
|
|
|
146
147
|
count: showCount ? tag.count : undefined,
|
|
147
148
|
tooltipLabel: tag.display
|
|
148
149
|
}];
|
|
150
|
+
var isHovered = isHovering && hoveredBarIndex === index;
|
|
149
151
|
return (react_1.default.createElement("div", { key: tag._id || "".concat(index1, "-").concat(index), onMouseEnter: function () { return handleBarMouseEnter(index); }, onMouseLeave: handleBarMouseLeave, onClick: function () { return handleBarClick(tag); }, style: { cursor: onClick ? 'pointer' : 'default' } },
|
|
150
152
|
react_1.default.createElement(styled_1.StyledSingleBarWrapper, { barSections: tag.barSections, debug: debug },
|
|
151
153
|
react_1.default.createElement(styled_1.StyledBar, { style: {
|
|
@@ -154,7 +156,7 @@ var BarGraph = function (_a) {
|
|
|
154
156
|
} }),
|
|
155
157
|
react_1.default.createElement(styled_1.StyledLabelWrapper, null,
|
|
156
158
|
react_1.default.createElement(__2.UI_BODY_SM, null, truncateText(tag === null || tag === void 0 ? void 0 : tag.display, 30))),
|
|
157
|
-
|
|
159
|
+
isHovered && mousePosition && (react_1.default.createElement(CustomTooltip_1.default, { active: true, payload: [tag], mousePosition: mousePosition, value: tooltipData, showPercent: showPercent })))));
|
|
158
160
|
})));
|
|
159
161
|
};
|
|
160
162
|
exports.BarGraph = BarGraph;
|