oolib 2.195.1 → 2.195.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/dist/stories/v2/components/BarChart.stories.js +1 -1
- package/dist/v2/components/dataviz/BarChart/comps/CustomTooltip/index.js +3 -4
- package/dist/v2/components/dataviz/BarChart/comps/Legend/index.js +1 -1
- package/dist/v2/components/dataviz/BarChart/comps/LegendTooltipGlyph/index.js +1 -0
- package/dist/v2/components/dataviz/BarChart/index.d.ts +0 -1
- package/dist/v2/components/dataviz/BarChart/index.js +8 -10
- package/package.json +1 -1
|
@@ -41,7 +41,7 @@ var BarChart = function (args) {
|
|
|
41
41
|
};
|
|
42
42
|
return (react_1.default.createElement("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: "20px", padding: '20px' } },
|
|
43
43
|
react_1.default.createElement("div", { style: { border: '1px solid black', padding: '10px' } },
|
|
44
|
-
react_1.default.createElement(BarChart_1.BarChart, { showPercent: args.showPercent, data: [
|
|
44
|
+
react_1.default.createElement(BarChart_1.BarChart, { overflowAfterHeight: 300, showPercent: args.showPercent, data: [
|
|
45
45
|
{
|
|
46
46
|
display: "Logged In Once",
|
|
47
47
|
stack1: 45, stack2: 23, stack3: 67, stack4: 12, stack5: 89,
|
|
@@ -59,9 +59,8 @@ var UI_CAPTION_DF_WITH_LINE_CLAMP = (0, styled_components_1.default)(Typo2_1.UI_
|
|
|
59
59
|
return clampT ? (0, __1.clampText)(3) : '';
|
|
60
60
|
});
|
|
61
61
|
var CustomTooltip = function (props) {
|
|
62
|
-
var _a;
|
|
63
62
|
var value = props.value, showPercent = props.showPercent, mousePosition = props.mousePosition, activeBar = props.activeBar, breakdownCategoryName = props.breakdownCategoryName;
|
|
64
|
-
var isActive = activeBar &&
|
|
63
|
+
var isActive = props.active; //activeBar && value?.[0]?.name === activeBar
|
|
65
64
|
var tooltipWrapperRef = (0, react_1.useRef)(null);
|
|
66
65
|
var calcTooltipTop = function (_a) {
|
|
67
66
|
var _b, _c;
|
|
@@ -99,8 +98,8 @@ var CustomTooltip = function (props) {
|
|
|
99
98
|
// pointerEvents: "none", // Add this to prevent tooltip from interfering with mouse events
|
|
100
99
|
};
|
|
101
100
|
var tooltipLabelLengthRefs = (0, react_1.useRef)([]);
|
|
102
|
-
var
|
|
103
|
-
var
|
|
101
|
+
var _a = (0, react_1.useState)([]), rowHeights = _a[0], setRowHeights = _a[1];
|
|
102
|
+
var _b = (0, react_1.useState)((value === null || value === void 0 ? void 0 : value.map(function (v) { return true; })) || []), tooltipTextClampStates = _b[0], setTooltipTextClampStates = _b[1];
|
|
104
103
|
(0, react_1.useEffect)(function () {
|
|
105
104
|
if (!tooltipTextClampStates) {
|
|
106
105
|
setTooltipTextClampStates(value === null || value === void 0 ? void 0 : value.map(function (v) { return true; }));
|
|
@@ -21,7 +21,7 @@ var Typo2_1 = require("../../../../Typo2");
|
|
|
21
21
|
var LegendTooltipGlyph_1 = require("../LegendTooltipGlyph");
|
|
22
22
|
var Legend = function (_a) {
|
|
23
23
|
var data = _a.data, label = _a.label, _b = _a.orientation, orientation = _b === void 0 ? "vertical" : _b;
|
|
24
|
-
return (react_1.default.createElement("div", { style: __assign(__assign({}, (orientation === 'vertical' ? { maxWidth: '200px' } : {})), { padding: "12px", borderRadius: '8px', border: "1px solid ".concat(__1.colors2.grey5), background: "linear-gradient(to bottom, hsla(0, 0%, 96%, 1), hsla(0, 0%, 100%, 0))" }) },
|
|
24
|
+
return (react_1.default.createElement("div", { style: __assign(__assign({}, (orientation === 'vertical' ? { maxWidth: '200px' } : {})), { padding: "12px", borderRadius: '8px', border: "1px solid ".concat(__1.colors2.grey5), background: "linear-gradient(to bottom, hsla(0, 0%, 96%, 1), hsla(0, 0%, 100%, 0))", maxHeight: orientation === 'vertical' ? '100%' : '150px', overflow: 'scroll' }) },
|
|
25
25
|
label && orientation === 'vertical' && (react_1.default.createElement("div", { style: { paddingBottom: "8px" } },
|
|
26
26
|
react_1.default.createElement(Typo2_1.UI_CAPTION_BOLD_DF, null, label))),
|
|
27
27
|
react_1.default.createElement("div", { style: __assign(__assign({ display: "flex", flexDirection: orientation === "vertical" ? "column" : "row" }, (orientation === 'horizontal' ? { flexWrap: 'wrap' } : {})), { gap: "8px" }) },
|
|
@@ -27,7 +27,6 @@ export interface BarChartProps {
|
|
|
27
27
|
breakdownDisplayType?: BreakdownDisplayType;
|
|
28
28
|
colorIdx?: number;
|
|
29
29
|
summarizeAfterIdx?: number;
|
|
30
|
-
overflowAfterHeight?: number;
|
|
31
30
|
style?: React.CSSProperties;
|
|
32
31
|
}
|
|
33
32
|
export declare const BarChart: React.FC<BarChartProps>;
|
|
@@ -214,7 +214,7 @@ var renderBar = function (_a) {
|
|
|
214
214
|
};
|
|
215
215
|
var useDecideLegendOrientation = function (options) {
|
|
216
216
|
if (options === void 0) { options = {}; }
|
|
217
|
-
var _a = options.widthThreshold, widthThreshold = _a === void 0 ?
|
|
217
|
+
var _a = options.widthThreshold, widthThreshold = _a === void 0 ? 600 : _a;
|
|
218
218
|
var vizWrapperRef = (0, react_1.useRef)(null);
|
|
219
219
|
var _b = (0, react_1.useState)('horizontal'), orientation = _b[0], setOrientation = _b[1];
|
|
220
220
|
(0, react_1.useEffect)(function () {
|
|
@@ -306,11 +306,9 @@ var FadeGradientWhenScroll = function (_a) {
|
|
|
306
306
|
var BarChart = function (_a) {
|
|
307
307
|
var _data = _a.data, valuePath = _a.valuePath, _b = _a.style, style = _b === void 0 ? {} : _b, tooltipLabelsMapping = _a.tooltipLabelsMapping, tooltipLabelsPath = _a.tooltipLabelsPath, breakdownCategoryName = _a.breakdownCategoryName, // basically, if lets say tagCat1 is broken down by tagCat2. then tagCat2's display would be this property
|
|
308
308
|
_c = _a.labelPath, // basically, if lets say tagCat1 is broken down by tagCat2. then tagCat2's display would be this property
|
|
309
|
-
labelPath = _c === void 0 ? "name" : _c, onClick = _a.onClick, _d = _a.breakdownDisplayType, breakdownDisplayType = _d === void 0 ? "grouped" : _d, _e = _a.showCount, showCount = _e === void 0 ? true : _e, _f = _a.showPercent, showPercent = _f === void 0 ? true : _f, _g = _a.colorIdx, colorIdx = _g === void 0 ? 0 : _g, _h = _a.summarizeAfterIdx, summarizeAfterIdx = _h === void 0 ? undefined : _h
|
|
310
|
-
_j = _a.overflowAfterHeight, //if a number is defined, then from that 'index' onwards, bars will be compressed into a single bar with a tooltip explaining distribution
|
|
311
|
-
overflowAfterHeight = _j === void 0 ? 550 : _j;
|
|
309
|
+
labelPath = _c === void 0 ? "name" : _c, onClick = _a.onClick, _d = _a.breakdownDisplayType, breakdownDisplayType = _d === void 0 ? "grouped" : _d, _e = _a.showCount, showCount = _e === void 0 ? true : _e, _f = _a.showPercent, showPercent = _f === void 0 ? true : _f, _g = _a.colorIdx, colorIdx = _g === void 0 ? 0 : _g, _h = _a.summarizeAfterIdx, summarizeAfterIdx = _h === void 0 ? undefined : _h;
|
|
312
310
|
var isBreakdown = Array.isArray(valuePath);
|
|
313
|
-
var
|
|
311
|
+
var _j = (0, usePrepareData_1.usePrepareData)({
|
|
314
312
|
_data: _data,
|
|
315
313
|
labelPath: labelPath,
|
|
316
314
|
valuePath: valuePath,
|
|
@@ -320,16 +318,16 @@ var BarChart = function (_a) {
|
|
|
320
318
|
showPercent: showPercent,
|
|
321
319
|
summarizeAfterIdx: summarizeAfterIdx,
|
|
322
320
|
colorIdx: colorIdx
|
|
323
|
-
}), data =
|
|
324
|
-
var
|
|
321
|
+
}), data = _j.data, dataMaxValue = _j.dataMaxValue, dataToSummarize = _j.dataToSummarize;
|
|
322
|
+
var _k = useDecideLegendOrientation({
|
|
325
323
|
widthThreshold: 500
|
|
326
|
-
}), vizWrapperRef =
|
|
327
|
-
var
|
|
324
|
+
}), vizWrapperRef = _k.vizWrapperRef, orientation = _k.orientation;
|
|
325
|
+
var _l = (0, react_1.useState)(undefined), activeBar = _l[0], setActiveBar = _l[1];
|
|
328
326
|
var mousePosition = (0, exports.useTrackMousePosition)().mousePosition;
|
|
329
327
|
// menu options for grouped and stacked
|
|
330
328
|
if (data.length === 0)
|
|
331
329
|
return react_1.default.createElement("div", null, "No data available");
|
|
332
|
-
return (react_1.default.createElement("div", { ref: vizWrapperRef, style: __assign(__assign({}, style), { width: "100%", background: _debug_controls.chartWrapperBgColor, display: 'flex', gap: '8px', flexDirection: orientation === 'vertical' ? 'row' : 'column', position: 'relative',
|
|
330
|
+
return (react_1.default.createElement("div", { ref: vizWrapperRef, style: __assign(__assign({}, style), { width: "100%", background: _debug_controls.chartWrapperBgColor, display: 'flex', gap: '8px', flexDirection: orientation === 'vertical' ? 'row' : 'column', position: 'relative', overflow: 'scroll' }) },
|
|
333
331
|
react_1.default.createElement("div", { style: { flexGrow: 1, position: 'relative' } },
|
|
334
332
|
react_1.default.createElement(BarChartRenderer, { data: data, dataToSummarize: dataToSummarize, isBreakdown: isBreakdown, breakdownDisplayType: breakdownDisplayType, showSumOfBreakdownValues: false, showPercent: showPercent, showCount: showCount, activeBar: activeBar, setActiveBar: setActiveBar, onClick: onClick, mousePosition: mousePosition, dataMaxValue: dataMaxValue, breakdownCategoryName: breakdownCategoryName }),
|
|
335
333
|
dataToSummarize && (react_1.default.createElement(BarChartRenderer, { data: dataToSummarize,
|