oolib 2.213.4 → 2.214.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/dist/components/EmptyStates/config/index.js +12 -0
- package/dist/components/LoadersAndProgress/LoaderOverlay/index.js +1 -1
- package/dist/index.d.ts +0 -6
- package/dist/index.js +2 -14
- package/dist/stories/v2/components/Accordion.stories.js +0 -1
- package/package.json +1 -1
- package/dist/stories/v2/components/DataVizAccordion.stories.d.ts +0 -7
- package/dist/stories/v2/components/DataVizAccordion.stories.js +0 -141
- package/dist/stories/v2/components/visualization/BarChart.stories.d.ts +0 -23
- package/dist/stories/v2/components/visualization/BarChart.stories.js +0 -251
- package/dist/stories/v2/components/visualization/BarGraphCollection.stories.d.ts +0 -19
- package/dist/stories/v2/components/visualization/BarGraphCollection.stories.js +0 -1190
- package/dist/stories/v2/components/visualization/HeatMapGrid.stories.d.ts +0 -18
- package/dist/stories/v2/components/visualization/HeatMapGrid.stories.js +0 -204
- package/dist/stories/v2/components/visualization/PieChart.stories.d.ts +0 -7
- package/dist/stories/v2/components/visualization/PieChart.stories.js +0 -79
- package/dist/stories/v2/components/visualization/configs/props1.d.ts +0 -102
- package/dist/stories/v2/components/visualization/configs/props1.js +0 -70
- package/dist/stories/v2/components/visualization/configs/props2.d.ts +0 -45
- package/dist/stories/v2/components/visualization/configs/props2.js +0 -2962
- package/dist/stories/v2/components/visualization/vizPlayground.stories.d.ts +0 -7
- package/dist/stories/v2/components/visualization/vizPlayground.stories.js +0 -55
- package/dist/v2/components/DataVizAccordion/index.d.ts +0 -13
- package/dist/v2/components/DataVizAccordion/index.js +0 -60
- package/dist/v2/components/dataviz/BarChart/_base_barchart_ui_configs.d.ts +0 -19
- package/dist/v2/components/dataviz/BarChart/_base_barchart_ui_configs.js +0 -25
- package/dist/v2/components/dataviz/BarChart/comps/CustomTooltip/OptimizedTooltip.d.ts +0 -8
- package/dist/v2/components/dataviz/BarChart/comps/CustomTooltip/OptimizedTooltip.js +0 -118
- package/dist/v2/components/dataviz/BarChart/comps/CustomTooltip/index.d.ts +0 -15
- package/dist/v2/components/dataviz/BarChart/comps/CustomTooltip/index.js +0 -120
- package/dist/v2/components/dataviz/BarChart/comps/CustomizedLabel/index.d.ts +0 -29
- package/dist/v2/components/dataviz/BarChart/comps/CustomizedLabel/index.js +0 -73
- package/dist/v2/components/dataviz/BarChart/comps/Legend/index.d.ts +0 -12
- package/dist/v2/components/dataviz/BarChart/comps/Legend/index.js +0 -35
- package/dist/v2/components/dataviz/BarChart/comps/LegendTooltipGlyph/index.d.ts +0 -7
- package/dist/v2/components/dataviz/BarChart/comps/LegendTooltipGlyph/index.js +0 -18
- package/dist/v2/components/dataviz/BarChart/comps/TruncatedSVGText/index.d.ts +0 -7
- package/dist/v2/components/dataviz/BarChart/comps/TruncatedSVGText/index.js +0 -66
- package/dist/v2/components/dataviz/BarChart/index.d.ts +0 -45
- package/dist/v2/components/dataviz/BarChart/index.js +0 -383
- package/dist/v2/components/dataviz/BarGraphCollection/index.d.ts +0 -24
- package/dist/v2/components/dataviz/BarGraphCollection/index.js +0 -162
- package/dist/v2/components/dataviz/BarGraphCollection/styled.d.ts +0 -9
- package/dist/v2/components/dataviz/BarGraphCollection/styled.js +0 -92
- package/dist/v2/components/dataviz/BarGraphCollection/utils/useGetDimensions.d.ts +0 -2
- package/dist/v2/components/dataviz/BarGraphCollection/utils/useGetDimensions.js +0 -60
- package/dist/v2/components/dataviz/BarGraphCollection/utils/usePrepareData.d.ts +0 -11
- package/dist/v2/components/dataviz/BarGraphCollection/utils/usePrepareData.js +0 -76
- package/dist/v2/components/dataviz/HeatMapGrid/index.d.ts +0 -19
- package/dist/v2/components/dataviz/HeatMapGrid/index.js +0 -232
- package/dist/v2/components/dataviz/HeatMapGrid/utils/mapValueToColor.d.ts +0 -20
- package/dist/v2/components/dataviz/HeatMapGrid/utils/mapValueToColor.js +0 -45
- package/dist/v2/components/dataviz/HeatMapGrid/utils/useAxisMeasure.d.ts +0 -6
- package/dist/v2/components/dataviz/HeatMapGrid/utils/useAxisMeasure.js +0 -53
- package/dist/v2/components/dataviz/HeatMapGrid/utils/useFader.d.ts +0 -6
- package/dist/v2/components/dataviz/HeatMapGrid/utils/useFader.js +0 -36
- package/dist/v2/components/dataviz/HeatMapGrid/utils/usePrepareHeatMapData.d.ts +0 -33
- package/dist/v2/components/dataviz/HeatMapGrid/utils/usePrepareHeatMapData.js +0 -122
- package/dist/v2/components/dataviz/PieChart/index.d.ts +0 -21
- package/dist/v2/components/dataviz/PieChart/index.js +0 -186
- package/dist/v2/components/dataviz/types.d.ts +0 -13
- package/dist/v2/components/dataviz/types.js +0 -2
- package/dist/v2/components/dataviz/utils/usePrepareData.d.ts +0 -21
- package/dist/v2/components/dataviz/utils/usePrepareData.js +0 -213
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
-
};
|
|
38
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.BarGraph = exports.BarGraphCollection = exports.BAR_GAP = exports.DEFAULT_SINGLE_BAR_WIDTH = exports.BAR_GRAPH_HEIGHT = void 0;
|
|
40
|
-
var react_1 = __importStar(require("react"));
|
|
41
|
-
var __1 = require("../../../..");
|
|
42
|
-
var __2 = require("../../../..");
|
|
43
|
-
var styled_1 = require("./styled");
|
|
44
|
-
var useGetDimensions_1 = require("./utils/useGetDimensions");
|
|
45
|
-
// import { __GetContentTypeConfigNew } from "../../../../../utils/getters/gettersV2";
|
|
46
|
-
var CustomTooltip_1 = __importDefault(require("../BarChart/comps/CustomTooltip"));
|
|
47
|
-
var usePrepareData_1 = require("./utils/usePrepareData");
|
|
48
|
-
var BarChart_1 = require("../BarChart");
|
|
49
|
-
var grey5 = __1.colors2.grey5;
|
|
50
|
-
exports.BAR_GRAPH_HEIGHT = 250;
|
|
51
|
-
exports.DEFAULT_SINGLE_BAR_WIDTH = 24;
|
|
52
|
-
exports.BAR_GAP = 0.3;
|
|
53
|
-
var BarGraphCollection = function (_a) {
|
|
54
|
-
var originalData = _a.data, valuePath = _a.valuePath, _b = _a.labelPath, labelPath = _b === void 0 ? "display" : _b, _c = _a.tooltipLabelsMapping, tooltipLabelsMapping = _c === void 0 ? {} : _c, onClick = _a.onClick, _d = _a.showCount, showCount = _d === void 0 ? true : _d, _e = _a.showPercent, showPercent = _e === void 0 ? true : _e, groupBy = _a.groupBy, totalDataCount = _a.totalDataCount, debug = _a.debug
|
|
55
|
-
// tooltipLabelsPath,
|
|
56
|
-
// colorIdx = 0,
|
|
57
|
-
// summarizeAfterIdx = 5,
|
|
58
|
-
// breakdownDisplayType = "grouped"
|
|
59
|
-
;
|
|
60
|
-
var containerRef = (0, react_1.useRef)();
|
|
61
|
-
var _f = (0, react_1.useState)(0), containerWidth = _f[0], setContainerWidth = _f[1];
|
|
62
|
-
var highestCount = originalData === null || originalData === void 0 ? void 0 : originalData.reduce(function (highest, item) { return item.value > highest ? item.value : highest; }, 0);
|
|
63
|
-
var transformedData = (0, react_1.useMemo)(function () {
|
|
64
|
-
return (0, usePrepareData_1.usePrepareData)({ data: originalData, valuePath: valuePath, labelPath: labelPath, tooltipLabelsMapping: tooltipLabelsMapping, groupBy: groupBy });
|
|
65
|
-
}, [originalData, valuePath, labelPath, tooltipLabelsMapping, groupBy]);
|
|
66
|
-
var data = (0, useGetDimensions_1.useGetDimensions)(transformedData, exports.BAR_GRAPH_HEIGHT, containerWidth, totalDataCount, highestCount);
|
|
67
|
-
(0, react_1.useEffect)(function () {
|
|
68
|
-
var handleResize = function () {
|
|
69
|
-
var _a, _b;
|
|
70
|
-
setContainerWidth((_b = (_a = containerRef === null || containerRef === void 0 ? void 0 : containerRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect()) === null || _b === void 0 ? void 0 : _b.width);
|
|
71
|
-
};
|
|
72
|
-
handleResize();
|
|
73
|
-
window.addEventListener("resize", handleResize);
|
|
74
|
-
return function () { return window.removeEventListener("resize", handleResize); };
|
|
75
|
-
}, [transformedData]);
|
|
76
|
-
if ((data === null || data === void 0 ? void 0 : data.length) === 0) {
|
|
77
|
-
return null;
|
|
78
|
-
}
|
|
79
|
-
var barDivisions = (0, useGetDimensions_1.divideBarIntoEqualParts)(highestCount);
|
|
80
|
-
return (react_1.default.createElement(styled_1.StyledBarGraphContainer, { style: { width: "auto" }, ref: containerRef },
|
|
81
|
-
react_1.default.createElement("div", { style: { position: "absolute", left: 50, height: "".concat(exports.BAR_GRAPH_HEIGHT, "px"), width: "20px" } },
|
|
82
|
-
react_1.default.createElement(styled_1.YAxisLabels, null, (0, styled_1.generateYAxisValues)(barDivisions).map(function (value, index) { return (react_1.default.createElement(__2.UI_BODY_SM, { key: index }, String(value))); }))),
|
|
83
|
-
react_1.default.createElement(styled_1.StyledBarGraphCollectionWrapper, { style: {
|
|
84
|
-
width: "auto",
|
|
85
|
-
gap: "".concat(exports.BAR_GAP, "rem"),
|
|
86
|
-
overflowX: "auto"
|
|
87
|
-
} }, data === null || data === void 0 ? void 0 : data.map(function (tagCategory, index1) {
|
|
88
|
-
var categoryTitle = (tagCategory === null || tagCategory === void 0 ? void 0 : tagCategory.tagCategory) ? (tagCategory.tagCategory.charAt(0).toUpperCase() + tagCategory.tagCategory.slice(1)) : undefined;
|
|
89
|
-
// __GetContentTypeConfigNew(tagCategory.tagCategory)?.general?.content?.title ||
|
|
90
|
-
return (react_1.default.createElement("div", { key: "".concat(index1, "-").concat(tagCategory.tagCategory), style: {
|
|
91
|
-
display: "flex",
|
|
92
|
-
flexDirection: "column",
|
|
93
|
-
gap: "".concat(exports.BAR_GAP, "rem"),
|
|
94
|
-
height: "".concat(exports.BAR_GRAPH_HEIGHT + 50, "px"),
|
|
95
|
-
marginBottom: "0.6rem"
|
|
96
|
-
} },
|
|
97
|
-
react_1.default.createElement(exports.BarGraph, { tagCategory: tagCategory, index1: index1, showCount: showCount, showPercent: showPercent, onClick: onClick, debug: debug, highestCount: highestCount }),
|
|
98
|
-
categoryTitle && react_1.default.createElement("div", { title: categoryTitle, style: {
|
|
99
|
-
width: "".concat(tagCategory === null || tagCategory === void 0 ? void 0 : tagCategory.width, "px"),
|
|
100
|
-
background: grey5,
|
|
101
|
-
borderRadius: "2px",
|
|
102
|
-
padding: "0.8rem",
|
|
103
|
-
maxHeight: "50px",
|
|
104
|
-
overflow: "hidden"
|
|
105
|
-
} },
|
|
106
|
-
react_1.default.createElement(__2.UI_BODY_SEMIBOLD_SM, null,
|
|
107
|
-
react_1.default.createElement("p", { style: {
|
|
108
|
-
whiteSpace: "nowrap",
|
|
109
|
-
overflow: "hidden",
|
|
110
|
-
textOverflow: "ellipsis",
|
|
111
|
-
maxWidth: "100%"
|
|
112
|
-
} }, categoryTitle)))));
|
|
113
|
-
}))));
|
|
114
|
-
};
|
|
115
|
-
exports.BarGraphCollection = BarGraphCollection;
|
|
116
|
-
var BarGraph = function (_a) {
|
|
117
|
-
var _b;
|
|
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
|
-
var containerRef = (0, react_1.useRef)();
|
|
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];
|
|
122
|
-
var truncateText = function (text, maxLength) {
|
|
123
|
-
if (maxLength === void 0) { maxLength = 30; }
|
|
124
|
-
if (!text)
|
|
125
|
-
return '';
|
|
126
|
-
if (text.length <= maxLength)
|
|
127
|
-
return text;
|
|
128
|
-
return text.slice(0, maxLength) + '...';
|
|
129
|
-
};
|
|
130
|
-
var handleBarMouseEnter = function (index) {
|
|
131
|
-
setHoveredBarIndex(index);
|
|
132
|
-
};
|
|
133
|
-
var handleBarMouseLeave = function () {
|
|
134
|
-
setHoveredBarIndex(null);
|
|
135
|
-
};
|
|
136
|
-
var handleBarClick = function (tag) {
|
|
137
|
-
if (onClick) {
|
|
138
|
-
onClick(tag.display);
|
|
139
|
-
}
|
|
140
|
-
};
|
|
141
|
-
return (react_1.default.createElement(styled_1.StyledBarGraphWrapper, { ref: containerRef, style: {
|
|
142
|
-
height: "".concat(exports.BAR_GRAPH_HEIGHT, "px"),
|
|
143
|
-
gap: "".concat(exports.BAR_GAP, "rem"),
|
|
144
|
-
} }, (_b = tagCategory === null || tagCategory === void 0 ? void 0 : tagCategory.tagSpecificCount) === null || _b === void 0 ? void 0 : _b.map(function (tag, index) {
|
|
145
|
-
var tooltipData = [{
|
|
146
|
-
percentage: showPercent ? tag.percentage : undefined,
|
|
147
|
-
count: showCount ? tag.count : undefined,
|
|
148
|
-
tooltipLabel: tag.display
|
|
149
|
-
}];
|
|
150
|
-
var isHovered = isHovering && hoveredBarIndex === index;
|
|
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' } },
|
|
152
|
-
react_1.default.createElement(styled_1.StyledSingleBarWrapper, { barSections: tag.barSections, debug: debug },
|
|
153
|
-
react_1.default.createElement(styled_1.StyledBar, { style: {
|
|
154
|
-
height: "".concat(tag.height, "px"),
|
|
155
|
-
width: "".concat(tag.width, "px")
|
|
156
|
-
} }),
|
|
157
|
-
react_1.default.createElement(styled_1.StyledLabelWrapper, null,
|
|
158
|
-
react_1.default.createElement(__2.UI_BODY_SM, null, truncateText(tag === null || tag === void 0 ? void 0 : tag.display, 30))),
|
|
159
|
-
isHovered && mousePosition && (react_1.default.createElement(CustomTooltip_1.default, { active: true, payload: [tag], mousePosition: mousePosition, value: tooltipData, showPercent: showPercent })))));
|
|
160
|
-
})));
|
|
161
|
-
};
|
|
162
|
-
exports.BarGraph = BarGraph;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export const CONTAINER_PADDING: 10;
|
|
2
|
-
export const StyledBarGraphContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
3
|
-
export const StyledBarGraphCollectionWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
4
|
-
export const StyledBarGraphWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
5
|
-
export const StyledSingleBarWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
6
|
-
export const StyledBar: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
7
|
-
export const StyledLabelWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
8
|
-
export const YAxisLabels: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
9
|
-
export function generateYAxisValues(barDivisions: any): any[];
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
3
|
-
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
4
|
-
return cooked;
|
|
5
|
-
};
|
|
6
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
7
|
-
if (k2 === undefined) k2 = k;
|
|
8
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
9
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
10
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
11
|
-
}
|
|
12
|
-
Object.defineProperty(o, k2, desc);
|
|
13
|
-
}) : (function(o, m, k, k2) {
|
|
14
|
-
if (k2 === undefined) k2 = k;
|
|
15
|
-
o[k2] = m[k];
|
|
16
|
-
}));
|
|
17
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
18
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
19
|
-
}) : function(o, v) {
|
|
20
|
-
o["default"] = v;
|
|
21
|
-
});
|
|
22
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
23
|
-
var ownKeys = function(o) {
|
|
24
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
25
|
-
var ar = [];
|
|
26
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
27
|
-
return ar;
|
|
28
|
-
};
|
|
29
|
-
return ownKeys(o);
|
|
30
|
-
};
|
|
31
|
-
return function (mod) {
|
|
32
|
-
if (mod && mod.__esModule) return mod;
|
|
33
|
-
var result = {};
|
|
34
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
35
|
-
__setModuleDefault(result, mod);
|
|
36
|
-
return result;
|
|
37
|
-
};
|
|
38
|
-
})();
|
|
39
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
-
exports.generateYAxisValues = exports.YAxisLabels = exports.StyledLabelWrapper = exports.StyledBar = exports.StyledSingleBarWrapper = exports.StyledBarGraphWrapper = exports.StyledBarGraphCollectionWrapper = exports.StyledBarGraphContainer = exports.CONTAINER_PADDING = void 0;
|
|
41
|
-
var styled_components_1 = __importStar(require("styled-components"));
|
|
42
|
-
var __1 = require("../../../..");
|
|
43
|
-
exports.CONTAINER_PADDING = 10;
|
|
44
|
-
var barColor = __1.colors2.secondaryContainer; // temp color
|
|
45
|
-
var grey5 = __1.colors2.grey5;
|
|
46
|
-
exports.StyledBarGraphContainer = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n padding: ", "px;\n padding-bottom: 0.4rem; // UI scroll bar bottom space \n overflow-x: auto;\n background-color: white;\n border-radius: 8px;\n"], ["\n padding: ", "px;\n padding-bottom: 0.4rem; // UI scroll bar bottom space \n overflow-x: auto;\n background-color: white;\n border-radius: 8px;\n"])), exports.CONTAINER_PADDING);
|
|
47
|
-
exports.StyledBarGraphCollectionWrapper = styled_components_1.default.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n display: flex;\n"], ["\n display: flex;\n"])));
|
|
48
|
-
exports.StyledBarGraphWrapper = styled_components_1.default.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n display: flex;\n position: relative;\n\n "], ["\n display: flex;\n position: relative;\n\n "])));
|
|
49
|
-
var generateDebugLines = function (barSections, debug) {
|
|
50
|
-
if (!debug)
|
|
51
|
-
return '';
|
|
52
|
-
var lines = [];
|
|
53
|
-
for (var i = 1; i <= barSections; i++) {
|
|
54
|
-
lines.push('linear-gradient(to right, #383838 0%, #383838 100%)');
|
|
55
|
-
}
|
|
56
|
-
var positions = [];
|
|
57
|
-
for (var i = 0; i <= barSections; i++) {
|
|
58
|
-
var position = (100 / barSections) * i;
|
|
59
|
-
positions.push("0 ".concat(position, "%"));
|
|
60
|
-
}
|
|
61
|
-
return "\n &::before {\n content: '';\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n background-image: ".concat(lines.join(', '), ";\n background-size: ").concat(Array(barSections).fill('100% 1px').join(', '), ";\n background-position: ").concat(positions.join(', '), ";\n background-repeat: no-repeat;\n pointer-events: none;\n z-index: 0;\n }\n ");
|
|
62
|
-
};
|
|
63
|
-
exports.StyledSingleBarWrapper = styled_components_1.default.div(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n height: 100%;\n display: flex;\n align-items: flex-end;\n position: relative;\n cursor: pointer;\n border-radius: 2px;\n\n &:hover {\n background-color: ", ";\n }\n\n ", "\n \n > * {\n position: relative;\n z-index: 1;\n }\n"], ["\n height: 100%;\n display: flex;\n align-items: flex-end;\n position: relative;\n cursor: pointer;\n border-radius: 2px;\n\n &:hover {\n background-color: ", ";\n }\n\n ", "\n \n > * {\n position: relative;\n z-index: 1;\n }\n"])), grey5, function (_a) {
|
|
64
|
-
var barSections = _a.barSections, debug = _a.debug;
|
|
65
|
-
return generateDebugLines(barSections, debug);
|
|
66
|
-
});
|
|
67
|
-
exports.StyledBar = styled_components_1.default.div(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n border-radius: 2px;\n background-color: ", ";\n color: ", ";\n position: relative;\n ", ";\n"], ["\n border-radius: 2px;\n background-color: ", ";\n color: ", ";\n position: relative;\n ", ";\n"])), barColor, __1.colors2.onSecondary, (0, __1.transition)("width"));
|
|
68
|
-
exports.StyledLabelWrapper = styled_components_1.default.div(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n position: absolute;\n transform: rotate(-90deg);\n transform-origin: left top;\n bottom: 0;\n left: calc(50% - 8px); // 10px for font\n text-wrap: nowrap;\n display: flex;\n"], ["\n position: absolute;\n transform: rotate(-90deg);\n transform-origin: left top;\n bottom: 0;\n left: calc(50% - 8px); // 10px for font\n text-wrap: nowrap;\n display: flex;\n"])));
|
|
69
|
-
exports.YAxisLabels = styled_components_1.default.div(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n height: inherit;\n display: flex;\n\n flex-direction: column-reverse;\n justify-content: space-between;\n\n color: ", ";\n z-index: 100;\n"], ["\n height: inherit;\n display: flex;\n\n flex-direction: column-reverse;\n justify-content: space-between;\n\n color: ", ";\n z-index: 100;\n"])), __1.colors2.grey50);
|
|
70
|
-
var generateYAxisValues = function (barDivisions) {
|
|
71
|
-
// For 5 labels, we want to divide the range into 4 equal parts
|
|
72
|
-
var numLabels = 5;
|
|
73
|
-
var step = barDivisions / (numLabels - 1);
|
|
74
|
-
var values = [];
|
|
75
|
-
for (var i = 0; i < numLabels; i++) {
|
|
76
|
-
values.push(Math.round(step * i));
|
|
77
|
-
}
|
|
78
|
-
// Ensure the last value is exactly barDivisions to avoid rounding errors
|
|
79
|
-
values[values.length - 1] = barDivisions;
|
|
80
|
-
var uniqueValues = [];
|
|
81
|
-
var seen = new Set();
|
|
82
|
-
for (var _i = 0, values_1 = values; _i < values_1.length; _i++) {
|
|
83
|
-
var value = values_1[_i];
|
|
84
|
-
if (!seen.has(value)) {
|
|
85
|
-
uniqueValues.push(value);
|
|
86
|
-
seen.add(value);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
return uniqueValues;
|
|
90
|
-
};
|
|
91
|
-
exports.generateYAxisValues = generateYAxisValues;
|
|
92
|
-
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7;
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
exports.useGetDimensions = exports.divideBarIntoEqualParts = void 0;
|
|
15
|
-
var __1 = require("..");
|
|
16
|
-
var styled_1 = require("../styled");
|
|
17
|
-
var divideBarIntoEqualParts = function (num) {
|
|
18
|
-
if (num <= 100)
|
|
19
|
-
return num;
|
|
20
|
-
if (num <= 200)
|
|
21
|
-
return 200;
|
|
22
|
-
if (num <= 500)
|
|
23
|
-
return 500;
|
|
24
|
-
if (num <= 1000)
|
|
25
|
-
return 1000;
|
|
26
|
-
var magnitude = Math.pow(10, Math.floor(Math.log10(num)));
|
|
27
|
-
return Math.ceil(num / magnitude) * magnitude;
|
|
28
|
-
};
|
|
29
|
-
exports.divideBarIntoEqualParts = divideBarIntoEqualParts;
|
|
30
|
-
var useGetDimensions = function (data, maxHeight, containerWidth, totalDataCount, highestCount) {
|
|
31
|
-
var singleBarWidth;
|
|
32
|
-
var totalBars = data === null || data === void 0 ? void 0 : data.reduce(function (total, tagCategory) {
|
|
33
|
-
var _a;
|
|
34
|
-
return total += (_a = tagCategory.tagSpecificCount) === null || _a === void 0 ? void 0 : _a.length;
|
|
35
|
-
}, 0);
|
|
36
|
-
var totalGapSpace = (totalBars - 1) * Math.floor(__1.BAR_GAP * 10); // BAR GAP, example 0.3 converted 3Px
|
|
37
|
-
var availableWidthForBars = (containerWidth - totalGapSpace) - (styled_1.CONTAINER_PADDING * 2); // CONTAINER_PADDING Left right 10 * 10 = 20
|
|
38
|
-
// const defaultWidthForBars = (totalBars - 1) * DEFAULT_SINGLE_BAR_WIDTH - (CONTAINER_PADDING * 2);
|
|
39
|
-
var dynamicBarWidth = availableWidthForBars / totalBars;
|
|
40
|
-
singleBarWidth = Math.max(dynamicBarWidth, __1.DEFAULT_SINGLE_BAR_WIDTH);
|
|
41
|
-
// Calculate the ceiling value for the highest count
|
|
42
|
-
var barSections = (0, exports.divideBarIntoEqualParts)(highestCount);
|
|
43
|
-
return data === null || data === void 0 ? void 0 : data.map(function (category) {
|
|
44
|
-
// total count for this category
|
|
45
|
-
var total = category.tagSpecificCount.reduce(function (sum, tag) { return sum + tag.count; }, 0);
|
|
46
|
-
var barsInCategory = category.tagSpecificCount.length;
|
|
47
|
-
var gapsInCategory = Math.max(0, barsInCategory - 1); // One less gap than bars
|
|
48
|
-
var categoryTotalWidth = (barsInCategory * singleBarWidth) + (gapsInCategory * Math.floor(__1.BAR_GAP * 10));
|
|
49
|
-
// percentage to each tag
|
|
50
|
-
return __assign(__assign({}, category), { width: categoryTotalWidth, tagSpecificCount: category.tagSpecificCount.map(function (tag) {
|
|
51
|
-
// Original percentage relative to total dataset
|
|
52
|
-
var percentage = Number((tag.count / (totalDataCount || total) * 100).toFixed(1));
|
|
53
|
-
// New height calculation relative to highest count and ceiling
|
|
54
|
-
// This creates a "zoomed in" effect where bars are more visible
|
|
55
|
-
var relativeHeight = Math.round((tag.count / barSections) * maxHeight);
|
|
56
|
-
return __assign({ percentage: percentage, height: relativeHeight, width: singleBarWidth, barSections: barSections }, tag);
|
|
57
|
-
}) });
|
|
58
|
-
});
|
|
59
|
-
};
|
|
60
|
-
exports.useGetDimensions = useGetDimensions;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export function usePrepareData({ data, valuePath, labelPath, tooltipLabelsMapping, groupBy }: {
|
|
2
|
-
data: any;
|
|
3
|
-
valuePath: any;
|
|
4
|
-
labelPath: any;
|
|
5
|
-
tooltipLabelsMapping: any;
|
|
6
|
-
groupBy: any;
|
|
7
|
-
}): {
|
|
8
|
-
tagCategory: any;
|
|
9
|
-
totalCountOfAllTagsWithin: any;
|
|
10
|
-
tagSpecificCount: any;
|
|
11
|
-
}[];
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.usePrepareData = void 0;
|
|
4
|
-
var _EXPORTS_1 = require("../../../../../utils/_EXPORTS");
|
|
5
|
-
var usePrepareData = function (_a) {
|
|
6
|
-
var data = _a.data, valuePath = _a.valuePath, labelPath = _a.labelPath, tooltipLabelsMapping = _a.tooltipLabelsMapping, groupBy = _a.groupBy;
|
|
7
|
-
// Check if it's breakdown data (array of valuePaths) or simple data
|
|
8
|
-
var isBreakdown = Array.isArray(valuePath);
|
|
9
|
-
if (!isBreakdown) {
|
|
10
|
-
// If groupBy is specified, group the data by that field
|
|
11
|
-
if (groupBy && data.length > 0 && groupBy in data[0]) {
|
|
12
|
-
// Group data by the specified field
|
|
13
|
-
var groupedData_1 = {};
|
|
14
|
-
data.forEach(function (item) {
|
|
15
|
-
var groupKey = (0, _EXPORTS_1.getVal)(item, groupBy) || 'Uncategorized';
|
|
16
|
-
if (!groupedData_1[groupKey]) {
|
|
17
|
-
groupedData_1[groupKey] = {
|
|
18
|
-
items: [],
|
|
19
|
-
totalCount: 0
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
var count = (0, _EXPORTS_1.getVal)(item, valuePath) || 0;
|
|
23
|
-
groupedData_1[groupKey].items.push({
|
|
24
|
-
tagId: (0, _EXPORTS_1.getVal)(item, labelPath),
|
|
25
|
-
display: (0, _EXPORTS_1.getVal)(item, labelPath),
|
|
26
|
-
_id: Math.random().toString(36).substr(2, 9),
|
|
27
|
-
count: count
|
|
28
|
-
});
|
|
29
|
-
groupedData_1[groupKey].totalCount += count;
|
|
30
|
-
});
|
|
31
|
-
// Convert grouped data to the expected format
|
|
32
|
-
return Object.entries(groupedData_1).map(function (_a) {
|
|
33
|
-
var key = _a[0], value = _a[1];
|
|
34
|
-
return ({
|
|
35
|
-
tagCategory: key,
|
|
36
|
-
totalCountOfAllTagsWithin: value.totalCount,
|
|
37
|
-
tagSpecificCount: value.items
|
|
38
|
-
});
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
else {
|
|
42
|
-
// Simple case - single category with single values
|
|
43
|
-
return [{
|
|
44
|
-
tagCategory: undefined,
|
|
45
|
-
totalCountOfAllTagsWithin: data.reduce(function (sum, item) { return sum + ((0, _EXPORTS_1.getVal)(item, valuePath) || 0); }, 0),
|
|
46
|
-
tagSpecificCount: data.map(function (item) { return ({
|
|
47
|
-
tagId: (0, _EXPORTS_1.getVal)(item, labelPath),
|
|
48
|
-
display: (0, _EXPORTS_1.getVal)(item, labelPath),
|
|
49
|
-
_id: Math.random().toString(36).substr(2, 9),
|
|
50
|
-
count: (0, _EXPORTS_1.getVal)(item, valuePath) || 0
|
|
51
|
-
}); })
|
|
52
|
-
}];
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
else {
|
|
56
|
-
// For breakdown case, we'll create categories based on the valuePath items
|
|
57
|
-
// Each valuePath becomes a category
|
|
58
|
-
return valuePath.map(function (path, pathIndex) {
|
|
59
|
-
var categoryName = (tooltipLabelsMapping === null || tooltipLabelsMapping === void 0 ? void 0 : tooltipLabelsMapping[path]) || path;
|
|
60
|
-
var totalCount = data.reduce(function (sum, item) { return sum + ((0, _EXPORTS_1.getVal)(item, path) || 0); }, 0);
|
|
61
|
-
return {
|
|
62
|
-
tagCategory: categoryName,
|
|
63
|
-
totalCountOfAllTagsWithin: totalCount,
|
|
64
|
-
tagSpecificCount: data
|
|
65
|
-
.map(function (item) { return ({
|
|
66
|
-
tagId: (0, _EXPORTS_1.getVal)(item, labelPath),
|
|
67
|
-
display: (0, _EXPORTS_1.getVal)(item, labelPath),
|
|
68
|
-
_id: "".concat(pathIndex, "-").concat((0, _EXPORTS_1.getVal)(item, labelPath)),
|
|
69
|
-
count: (0, _EXPORTS_1.getVal)(item, path) || 0
|
|
70
|
-
}); })
|
|
71
|
-
.filter(function (tag) { return tag.count > 0; }) // Only include items with values
|
|
72
|
-
};
|
|
73
|
-
}).filter(function (category) { return category.tagSpecificCount.length > 0; }); // Only include categories with items
|
|
74
|
-
}
|
|
75
|
-
};
|
|
76
|
-
exports.usePrepareData = usePrepareData;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import React, { CSSProperties } from "react";
|
|
2
|
-
export interface HeatMapGridProps {
|
|
3
|
-
data: any;
|
|
4
|
-
valuePath: string | string[];
|
|
5
|
-
tooltipLabelsMapping: {
|
|
6
|
-
[key: string]: string;
|
|
7
|
-
};
|
|
8
|
-
tooltipLabelsPath: string | string[];
|
|
9
|
-
labelPath: string;
|
|
10
|
-
onClick?: (name: string) => void;
|
|
11
|
-
valueSuffix?: string;
|
|
12
|
-
showCount?: boolean;
|
|
13
|
-
showPercent?: boolean;
|
|
14
|
-
breakdownDisplayType?: "grouped" | "stacked";
|
|
15
|
-
colorIdx?: number;
|
|
16
|
-
summarizeAfterIdx?: number;
|
|
17
|
-
style?: CSSProperties;
|
|
18
|
-
}
|
|
19
|
-
export declare const HeatMapGrid: React.FC<HeatMapGridProps>;
|