oolib 2.213.5 → 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.
Files changed (62) hide show
  1. package/dist/index.d.ts +0 -6
  2. package/dist/index.js +2 -14
  3. package/dist/stories/v2/components/Accordion.stories.js +0 -1
  4. package/package.json +1 -1
  5. package/dist/stories/v2/components/DataVizAccordion.stories.d.ts +0 -7
  6. package/dist/stories/v2/components/DataVizAccordion.stories.js +0 -141
  7. package/dist/stories/v2/components/visualization/BarChart.stories.d.ts +0 -23
  8. package/dist/stories/v2/components/visualization/BarChart.stories.js +0 -251
  9. package/dist/stories/v2/components/visualization/BarGraphCollection.stories.d.ts +0 -19
  10. package/dist/stories/v2/components/visualization/BarGraphCollection.stories.js +0 -1190
  11. package/dist/stories/v2/components/visualization/HeatMapGrid.stories.d.ts +0 -18
  12. package/dist/stories/v2/components/visualization/HeatMapGrid.stories.js +0 -204
  13. package/dist/stories/v2/components/visualization/PieChart.stories.d.ts +0 -7
  14. package/dist/stories/v2/components/visualization/PieChart.stories.js +0 -79
  15. package/dist/stories/v2/components/visualization/configs/props1.d.ts +0 -102
  16. package/dist/stories/v2/components/visualization/configs/props1.js +0 -70
  17. package/dist/stories/v2/components/visualization/configs/props2.d.ts +0 -45
  18. package/dist/stories/v2/components/visualization/configs/props2.js +0 -2962
  19. package/dist/stories/v2/components/visualization/vizPlayground.stories.d.ts +0 -7
  20. package/dist/stories/v2/components/visualization/vizPlayground.stories.js +0 -55
  21. package/dist/v2/components/DataVizAccordion/index.d.ts +0 -13
  22. package/dist/v2/components/DataVizAccordion/index.js +0 -60
  23. package/dist/v2/components/dataviz/BarChart/_base_barchart_ui_configs.d.ts +0 -19
  24. package/dist/v2/components/dataviz/BarChart/_base_barchart_ui_configs.js +0 -25
  25. package/dist/v2/components/dataviz/BarChart/comps/CustomTooltip/OptimizedTooltip.d.ts +0 -8
  26. package/dist/v2/components/dataviz/BarChart/comps/CustomTooltip/OptimizedTooltip.js +0 -118
  27. package/dist/v2/components/dataviz/BarChart/comps/CustomTooltip/index.d.ts +0 -15
  28. package/dist/v2/components/dataviz/BarChart/comps/CustomTooltip/index.js +0 -120
  29. package/dist/v2/components/dataviz/BarChart/comps/CustomizedLabel/index.d.ts +0 -29
  30. package/dist/v2/components/dataviz/BarChart/comps/CustomizedLabel/index.js +0 -73
  31. package/dist/v2/components/dataviz/BarChart/comps/Legend/index.d.ts +0 -12
  32. package/dist/v2/components/dataviz/BarChart/comps/Legend/index.js +0 -35
  33. package/dist/v2/components/dataviz/BarChart/comps/LegendTooltipGlyph/index.d.ts +0 -7
  34. package/dist/v2/components/dataviz/BarChart/comps/LegendTooltipGlyph/index.js +0 -18
  35. package/dist/v2/components/dataviz/BarChart/comps/TruncatedSVGText/index.d.ts +0 -7
  36. package/dist/v2/components/dataviz/BarChart/comps/TruncatedSVGText/index.js +0 -66
  37. package/dist/v2/components/dataviz/BarChart/index.d.ts +0 -45
  38. package/dist/v2/components/dataviz/BarChart/index.js +0 -383
  39. package/dist/v2/components/dataviz/BarGraphCollection/index.d.ts +0 -24
  40. package/dist/v2/components/dataviz/BarGraphCollection/index.js +0 -162
  41. package/dist/v2/components/dataviz/BarGraphCollection/styled.d.ts +0 -9
  42. package/dist/v2/components/dataviz/BarGraphCollection/styled.js +0 -92
  43. package/dist/v2/components/dataviz/BarGraphCollection/utils/useGetDimensions.d.ts +0 -2
  44. package/dist/v2/components/dataviz/BarGraphCollection/utils/useGetDimensions.js +0 -60
  45. package/dist/v2/components/dataviz/BarGraphCollection/utils/usePrepareData.d.ts +0 -11
  46. package/dist/v2/components/dataviz/BarGraphCollection/utils/usePrepareData.js +0 -76
  47. package/dist/v2/components/dataviz/HeatMapGrid/index.d.ts +0 -19
  48. package/dist/v2/components/dataviz/HeatMapGrid/index.js +0 -232
  49. package/dist/v2/components/dataviz/HeatMapGrid/utils/mapValueToColor.d.ts +0 -20
  50. package/dist/v2/components/dataviz/HeatMapGrid/utils/mapValueToColor.js +0 -45
  51. package/dist/v2/components/dataviz/HeatMapGrid/utils/useAxisMeasure.d.ts +0 -6
  52. package/dist/v2/components/dataviz/HeatMapGrid/utils/useAxisMeasure.js +0 -53
  53. package/dist/v2/components/dataviz/HeatMapGrid/utils/useFader.d.ts +0 -6
  54. package/dist/v2/components/dataviz/HeatMapGrid/utils/useFader.js +0 -36
  55. package/dist/v2/components/dataviz/HeatMapGrid/utils/usePrepareHeatMapData.d.ts +0 -33
  56. package/dist/v2/components/dataviz/HeatMapGrid/utils/usePrepareHeatMapData.js +0 -122
  57. package/dist/v2/components/dataviz/PieChart/index.d.ts +0 -21
  58. package/dist/v2/components/dataviz/PieChart/index.js +0 -186
  59. package/dist/v2/components/dataviz/types.d.ts +0 -13
  60. package/dist/v2/components/dataviz/types.js +0 -2
  61. package/dist/v2/components/dataviz/utils/usePrepareData.d.ts +0 -21
  62. package/dist/v2/components/dataviz/utils/usePrepareData.js +0 -213
@@ -1,7 +0,0 @@
1
- declare namespace _default {
2
- let title: string;
3
- let parameters: {};
4
- }
5
- export default _default;
6
- export function _Playground(args: any): React.JSX.Element;
7
- import React from "react";
@@ -1,55 +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
- var __importDefault = (this && this.__importDefault) || function (mod) {
14
- return (mod && mod.__esModule) ? mod : { "default": mod };
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- exports._Playground = void 0;
18
- var react_1 = __importDefault(require("react"));
19
- var PieChart_1 = require("../../../../v2/components/dataviz/PieChart");
20
- var HeatMapGrid_1 = require("../../../../v2/components/dataviz/HeatMapGrid");
21
- var BarChart_1 = require("../../../../v2/components/dataviz/BarChart");
22
- var BarGraphCollection_1 = require("../../../../v2/components/dataviz/BarGraphCollection");
23
- var __1 = require("../../../..");
24
- var props1_1 = require("./configs/props1");
25
- var props2_1 = require("./configs/props2");
26
- exports.default = {
27
- title: "Oolib V 2.0/Visualization/VIZ PLayground",
28
- parameters: {},
29
- };
30
- var WrapperComp = function (_a) {
31
- var children = _a.children;
32
- return react_1.default.createElement("div", { style: { border: "1px solid ".concat(__1.colors2.grey20), padding: '10px', borderRadius: "8px" } }, children);
33
- };
34
- var _Playground = function (args) {
35
- var colors = ["#5C80FF", "#FFA800", "#00BC8F", "#5C51CE"];
36
- var handleBarClick = function (name) {
37
- console.log("Bar clicked: ".concat(name));
38
- };
39
- return (react_1.default.createElement("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: "20px", padding: '20px' } },
40
- react_1.default.createElement(WrapperComp, null,
41
- react_1.default.createElement(PieChart_1.PieChart, __assign({}, props1_1.chartProps1, { style: { height: "500px" } }))),
42
- react_1.default.createElement(WrapperComp, null,
43
- react_1.default.createElement(HeatMapGrid_1.HeatMapGrid, __assign({}, props1_1.chartProps1, { style: { height: "500px" } }))),
44
- react_1.default.createElement(WrapperComp, null),
45
- react_1.default.createElement(WrapperComp, null,
46
- react_1.default.createElement(BarChart_1.BarChart, __assign({}, props1_1.chartProps1, { style: { height: "500px" } }))),
47
- react_1.default.createElement(WrapperComp, null,
48
- react_1.default.createElement(PieChart_1.PieChart, __assign({}, props2_1.heaMapGridProps2, { style: { height: "500px" } }))),
49
- react_1.default.createElement(WrapperComp, null,
50
- react_1.default.createElement(HeatMapGrid_1.HeatMapGrid, __assign({}, props2_1.heaMapGridProps2, { style: { height: "500px" } }))),
51
- react_1.default.createElement(WrapperComp, null),
52
- react_1.default.createElement(WrapperComp, null,
53
- react_1.default.createElement(BarChart_1.BarChart, __assign({}, props2_1.heaMapGridProps2, { style: { height: "500px" } })))));
54
- };
55
- exports._Playground = _Playground;
@@ -1,13 +0,0 @@
1
- import React from "react";
2
- import { BarChartProps } from "../dataviz/BarChart";
3
- type ChartOptionConfig = {
4
- display: string;
5
- comp: 'PieChart' | 'BarChart';
6
- props: BarChartProps;
7
- };
8
- interface DataVizAccordionProps extends BarChartProps {
9
- title?: string;
10
- chartOptions: ChartOptionConfig[];
11
- }
12
- export declare const DataVizAccordion: React.FC<DataVizAccordionProps>;
13
- export {};
@@ -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
- var __rest = (this && this.__rest) || function (s, e) {
14
- var t = {};
15
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
16
- t[p] = s[p];
17
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
18
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
19
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
20
- t[p[i]] = s[p[i]];
21
- }
22
- return t;
23
- };
24
- var __importDefault = (this && this.__importDefault) || function (mod) {
25
- return (mod && mod.__esModule) ? mod : { "default": mod };
26
- };
27
- Object.defineProperty(exports, "__esModule", { value: true });
28
- exports.DataVizAccordion = void 0;
29
- var react_1 = __importDefault(require("react"));
30
- var react_2 = require("react");
31
- var BarChart_1 = require("../dataviz/BarChart");
32
- var PieChart_1 = require("../dataviz/PieChart");
33
- var Accordion_1 = require("../Accordion");
34
- var DataVizAccordion = function (_a) {
35
- var title = _a.title, _b = _a.chartOptions, chartOptions = _b === void 0 ? [] : _b, props = __rest(_a, ["title", "chartOptions"]);
36
- var ChartComps = {
37
- PieChart: {
38
- comp: PieChart_1.PieChart,
39
- wrapperStyle: {}
40
- },
41
- BarChart: {
42
- comp: BarChart_1.BarChart,
43
- wrapperStyle: { padding: "0 1rem 0.6rem 1rem" }
44
- },
45
- };
46
- var _c = (0, react_2.useState)(chartOptions[0]), activeCompConfig = _c[0], setActiveCompConfig = _c[1];
47
- var genActiveChartComp = function (activeCompConfig) {
48
- var ActiveChartComp = ChartComps[activeCompConfig.comp].comp;
49
- var wrapperStyle = ChartComps[activeCompConfig.comp].wrapperStyle;
50
- return (react_1.default.createElement("div", { style: __assign({ padding: "0 1.6rem 1rem 1.6rem" }, (wrapperStyle || {})) },
51
- react_1.default.createElement(ActiveChartComp, __assign({}, props, activeCompConfig.props))));
52
- };
53
- return (react_1.default.createElement(Accordion_1.Accordion, { key: JSON.stringify(activeCompConfig), title: title, actionsConfig: chartOptions.length > 1 && chartOptions.map(function (d) { return ({
54
- display: d.display,
55
- onClick: function () {
56
- return setActiveCompConfig(d);
57
- },
58
- }); }) }, genActiveChartComp(activeCompConfig)));
59
- };
60
- exports.DataVizAccordion = DataVizAccordion;
@@ -1,19 +0,0 @@
1
- export interface BaseBarChartUIConfigs {
2
- barHeight: number;
3
- labelToBarGap: number;
4
- labelHeight: number;
5
- gapBetweenTwoLabels: number;
6
- labelToNextBarGap: number;
7
- barRadius: number;
8
- gapBetweenBarSections: number;
9
- hoverRectStrokeWidth: number;
10
- marginLeft: number;
11
- marginRight: number;
12
- gapBetweenBarsInGroup: number;
13
- }
14
- /**
15
- * if any changes are being made to the spacing and such of
16
- this comps design, all these properties need to be carefully
17
- observed and tweaked to ensure no ui has gotten warped due to sideeffects
18
- */
19
- export declare const _base_barchart_ui_configs: BaseBarChartUIConfigs;
@@ -1,25 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports._base_barchart_ui_configs = void 0;
4
- /**
5
- * if any changes are being made to the spacing and such of
6
- this comps design, all these properties need to be carefully
7
- observed and tweaked to ensure no ui has gotten warped due to sideeffects
8
- */
9
- exports._base_barchart_ui_configs = {
10
- //4 of these compose a single bar section
11
- barHeight: 10,
12
- labelToBarGap: 6,
13
- labelHeight: 16.5667,
14
- gapBetweenTwoLabels: 2,
15
- labelToNextBarGap: 14,
16
- //other bar section related properties
17
- barRadius: 2,
18
- gapBetweenBarSections: 0,
19
- hoverRectStrokeWidth: 1,
20
- //overall chart margin
21
- marginLeft: 6,
22
- marginRight: 6,
23
- //grouped bar chart related properties
24
- gapBetweenBarsInGroup: 3,
25
- };
@@ -1,8 +0,0 @@
1
- import React from "react";
2
- import { TooltipProps } from "recharts";
3
- interface OptimizedTooltipProps extends TooltipProps<number, string> {
4
- showPercent?: boolean;
5
- breakdownCategoryName?: string;
6
- }
7
- declare const OptimizedTooltip: React.FC<OptimizedTooltipProps>;
8
- export default OptimizedTooltip;
@@ -1,118 +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
- var __importDefault = (this && this.__importDefault) || function (mod) {
40
- return (mod && mod.__esModule) ? mod : { "default": mod };
41
- };
42
- Object.defineProperty(exports, "__esModule", { value: true });
43
- var react_1 = __importStar(require("react"));
44
- var styled_components_1 = __importDefault(require("styled-components"));
45
- var __1 = require("../../../../../..");
46
- var Typo2_1 = require("../../../../Typo2");
47
- var LegendTooltipGlyph_1 = require("../LegendTooltipGlyph");
48
- var UI_CAPTION_DF_WITH_LINE_CLAMP = (0, styled_components_1.default)(Typo2_1.UI_CAPTION_DF)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n /* ", " */\n"], ["\n /* ", " */\n"])), function (_a) {
49
- var clampT = _a.clampT;
50
- return (clampT ? (0, __1.clampText)(3) : "");
51
- });
52
- var OptimizedTooltip = (0, react_1.memo)(function (_a) {
53
- var _b, _c;
54
- var active = _a.active, payload = _a.payload, label = _a.label, _d = _a.showPercent, showPercent = _d === void 0 ? false : _d, breakdownCategoryName = _a.breakdownCategoryName;
55
- // Early return for better performance
56
- if (!active || !(payload === null || payload === void 0 ? void 0 : payload.length))
57
- return null;
58
- // Transform payload data to match your original tooltip structure
59
- var value = ((_c = (_b = payload === null || payload === void 0 ? void 0 : payload[0]) === null || _b === void 0 ? void 0 : _b.payload) === null || _c === void 0 ? void 0 : _c.map(function (entry) {
60
- return {
61
- barColor: entry.labels.barColor,
62
- percentage: entry.labels.percentage || 0,
63
- count: entry.labels.count,
64
- tooltipLabel: entry.labels.tooltipLabel,
65
- name: entry.labels.name,
66
- };
67
- })) || [];
68
- var style = {
69
- backgroundColor: __1.colors2.black,
70
- color: __1.colors2.white,
71
- border: "1px solid ".concat(__1.colors2.grey10),
72
- borderRadius: "6px",
73
- padding: "8px",
74
- boxShadow: "0px 4px 10px 0px rgba(0, 0, 0, 0.12)",
75
- zIndex: 100000,
76
- width: "max-content",
77
- maxWidth: "300px",
78
- maxHeight: "500px",
79
- overflow: "auto",
80
- display: "flex",
81
- flexDirection: "column",
82
- gap: "1rem",
83
- fontSize: "12px",
84
- };
85
- return (react_1.default.createElement(react_1.Fragment, null,
86
- react_1.default.createElement("div", { style: style },
87
- breakdownCategoryName && (react_1.default.createElement(Typo2_1.UI_CAPTION_BOLD_DF, null, breakdownCategoryName)),
88
- react_1.default.createElement("div", { style: {
89
- display: "grid",
90
- gridTemplateColumns: showPercent ? "auto auto auto" : "auto auto",
91
- gap: "0.6rem",
92
- } },
93
- react_1.default.createElement("div", { style: { display: "flex", flexDirection: "column", gap: "1rem" } }, value.map(function (entry, index) { return (react_1.default.createElement("div", { key: index },
94
- react_1.default.createElement("div", { style: {
95
- display: "flex",
96
- alignItems: "center",
97
- gap: "0.6rem",
98
- } },
99
- react_1.default.createElement(LegendTooltipGlyph_1.LegendTooltipGlyph, { color: entry.barColor }),
100
- react_1.default.createElement(Typo2_1.UI_CAPTION_BOLD_DF, null, showPercent
101
- ? entry.percentage + "%"
102
- : entry.count || "0")))); })),
103
- showPercent && (react_1.default.createElement("div", { style: {
104
- display: "flex",
105
- flexDirection: "column",
106
- gap: "1rem",
107
- } }, value.map(function (entry, index) { return (react_1.default.createElement("div", { key: index },
108
- react_1.default.createElement(Typo2_1.UI_CAPTION_DF, null, entry.count || "0"))); }))),
109
- react_1.default.createElement("div", { style: {
110
- paddingLeft: "0.8rem",
111
- display: "flex",
112
- flexDirection: "column",
113
- gap: "1rem",
114
- } }, value.map(function (entry, index) { return (react_1.default.createElement("div", { key: index },
115
- react_1.default.createElement(UI_CAPTION_DF_WITH_LINE_CLAMP, null, entry.tooltipLabel))); }))))));
116
- });
117
- exports.default = OptimizedTooltip;
118
- var templateObject_1;
@@ -1,15 +0,0 @@
1
- import React from "react";
2
- import { TooltipProps } from "recharts";
3
- import { CountVizLabels } from "../../../types";
4
- interface CustomTooltipProps extends TooltipProps<number, string> {
5
- value?: CountVizLabels[];
6
- showPercent?: boolean;
7
- activeBar?: string;
8
- breakdownCategoryName?: string;
9
- mousePosition?: {
10
- x: number;
11
- y: number;
12
- };
13
- }
14
- declare const CustomTooltip: React.FC<CustomTooltipProps>;
15
- export default CustomTooltip;
@@ -1,120 +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
- var __importDefault = (this && this.__importDefault) || function (mod) {
40
- return (mod && mod.__esModule) ? mod : { "default": mod };
41
- };
42
- Object.defineProperty(exports, "__esModule", { value: true });
43
- var react_1 = __importStar(require("react"));
44
- var styled_components_1 = __importDefault(require("styled-components"));
45
- var __1 = require("../../../../../..");
46
- var Typo2_1 = require("../../../../Typo2");
47
- var LegendTooltipGlyph_1 = require("../LegendTooltipGlyph");
48
- var UI_CAPTION_DF_WITH_LINE_CLAMP = (0, styled_components_1.default)(Typo2_1.UI_CAPTION_DF)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n \n /* ", " */\n"], ["\n \n /* ", " */\n"])), function (_a) {
49
- var clampT = _a.clampT;
50
- return clampT ? (0, __1.clampText)(3) : '';
51
- });
52
- var CustomTooltip = function (props) {
53
- var value = props.value, showPercent = props.showPercent, mousePosition = props.mousePosition, activeBar = props.activeBar, breakdownCategoryName = props.breakdownCategoryName;
54
- var isActive = props.active; //activeBar && value?.[0]?.name === activeBar
55
- var tooltipWrapperRef = (0, react_1.useRef)(null);
56
- var calcTooltipTop = function (_a) {
57
- var _b, _c;
58
- var tooltipWrapperRef = _a.tooltipWrapperRef, mousePosY = _a.mousePosY;
59
- var windowHeight = window.innerHeight;
60
- var tooltipWrapperBottom = (_c = (_b = tooltipWrapperRef === null || tooltipWrapperRef === void 0 ? void 0 : tooltipWrapperRef.current) === null || _b === void 0 ? void 0 : _b.getBoundingClientRect()) === null || _c === void 0 ? void 0 : _c.bottom;
61
- if (tooltipWrapperBottom && tooltipWrapperBottom > windowHeight) {
62
- var topNegativeOffset = tooltipWrapperBottom - windowHeight;
63
- return mousePosY - topNegativeOffset - 5; // plus 5 so that the bottom of the tooltip doesnt touch the bottom of the screen
64
- }
65
- else {
66
- return mousePosY;
67
- }
68
- };
69
- // Calculate position - align with the right side of the bars
70
- var style = {
71
- position: "fixed",
72
- left: "".concat((mousePosition === null || mousePosition === void 0 ? void 0 : mousePosition.x) || 0, "px"),
73
- top: "".concat(calcTooltipTop({ tooltipWrapperRef: tooltipWrapperRef, mousePosY: (mousePosition === null || mousePosition === void 0 ? void 0 : mousePosition.y) || 0 }), "px"),
74
- transform: "translate(10px, 10px)", // Offset from cursor and center vertically
75
- backgroundColor: __1.colors2.black,
76
- color: __1.colors2.white,
77
- border: "1px solid ".concat(__1.colors2.grey10),
78
- borderRadius: "6px",
79
- padding: "8px",
80
- boxShadow: "0px 4px 10px 0px rgba(0, 0, 0, 0.12)",
81
- zIndex: 100000,
82
- width: "max-content",
83
- maxWidth: "300px",
84
- maxHeight: "500px",
85
- overflow: "auto",
86
- display: "flex",
87
- flexDirection: "column",
88
- gap: "1rem",
89
- // pointerEvents: "none", // Add this to prevent tooltip from interfering with mouse events
90
- };
91
- if (!isActive)
92
- return null;
93
- return (react_1.default.createElement(react_1.Fragment, null,
94
- react_1.default.createElement("div", { ref: tooltipWrapperRef, style: style },
95
- breakdownCategoryName && react_1.default.createElement(Typo2_1.UI_CAPTION_BOLD_DF, null, breakdownCategoryName),
96
- react_1.default.createElement("div", { style: {
97
- display: "grid",
98
- gridTemplateColumns: showPercent ? "auto auto auto" : "auto auto",
99
- gap: "0.6rem",
100
- } },
101
- react_1.default.createElement("div", { style: { display: "flex", flexDirection: "column", gap: "1rem" } }, value.map(function (entry, index) { return (react_1.default.createElement("div", { key: "count-".concat(entry.name, "-").concat(index) },
102
- react_1.default.createElement("div", { style: {
103
- display: "flex",
104
- alignItems: "center",
105
- gap: "0.6rem",
106
- } },
107
- react_1.default.createElement(LegendTooltipGlyph_1.LegendTooltipGlyph, { color: entry.barColor }),
108
- react_1.default.createElement(Typo2_1.UI_CAPTION_BOLD_DF, null, showPercent ? entry.percentage + "%" : entry.count || "0")))); })),
109
- showPercent && (react_1.default.createElement("div", { style: { display: "flex", flexDirection: "column", gap: "1rem" } }, value.map(function (entry, index) { return (react_1.default.createElement("div", { key: "percent-".concat(entry.name, "-").concat(index) },
110
- react_1.default.createElement(Typo2_1.UI_CAPTION_DF, { key: index }, entry.count || "0"))); }))),
111
- react_1.default.createElement("div", { style: {
112
- paddingLeft: "0.8rem",
113
- display: "flex",
114
- flexDirection: "column",
115
- gap: "1rem",
116
- } }, value.map(function (entry, index) { return (react_1.default.createElement("div", { key: "label-".concat(entry.name, "-").concat(index) },
117
- react_1.default.createElement(UI_CAPTION_DF_WITH_LINE_CLAMP, null, entry.tooltipLabel))); }))))));
118
- };
119
- exports.default = CustomTooltip;
120
- var templateObject_1;
@@ -1,29 +0,0 @@
1
- import React from "react";
2
- import { DebugControls } from "../..";
3
- import { CountVizLabels } from "../../../types";
4
- import { BaseBarChartUIConfigs } from "../../_base_barchart_ui_configs";
5
- export type CustomizedLabelValue = CountVizLabels | CountVizLabels[];
6
- interface CustomizedLabelProps {
7
- y?: number | string;
8
- width?: number | string;
9
- height?: number | string;
10
- value?: CustomizedLabelValue;
11
- showPercent: boolean;
12
- showCount: boolean;
13
- opacity: number;
14
- activeBar?: string;
15
- breakdownDisplayType?: 'grouped' | 'stacked';
16
- _base_barchart_ui_configs: BaseBarChartUIConfigs;
17
- _debug_controls: DebugControls;
18
- TOT_HEIGHT_SINGLE_BAR_SECTION: number;
19
- TOT_HEIGHT_STACKED_BAR_SECTION: number;
20
- TOT_HEIGHT_GROUPED_BAR_SECTION: number;
21
- CALC_SINGLE_BAR_SECTION_Y_POS: (index: number) => number;
22
- CALC_STACKED_BAR_SECTION_Y_POS: (index: number) => number;
23
- showSumOfBreakdownValues?: boolean;
24
- onMouseOver?: (e: React.MouseEvent<SVGRectElement, MouseEvent>, v: CustomizedLabelValue) => void;
25
- onMouseOut?: (e: React.MouseEvent<SVGRectElement, MouseEvent>, v: CustomizedLabelValue) => void;
26
- onMouseDown?: (e: React.MouseEvent<SVGRectElement, MouseEvent>, v: CustomizedLabelValue) => void;
27
- }
28
- export declare const CustomizedLabel: ({ y, width, height, value, showPercent, showCount, opacity, _base_barchart_ui_configs, _debug_controls, onMouseOver, onMouseOut, onMouseDown, activeBar, TOT_HEIGHT_SINGLE_BAR_SECTION, TOT_HEIGHT_STACKED_BAR_SECTION, TOT_HEIGHT_GROUPED_BAR_SECTION, CALC_SINGLE_BAR_SECTION_Y_POS, CALC_STACKED_BAR_SECTION_Y_POS, breakdownDisplayType, showSumOfBreakdownValues, }: CustomizedLabelProps) => React.JSX.Element;
29
- export {};
@@ -1,73 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.CustomizedLabel = void 0;
7
- var react_1 = __importDefault(require("react"));
8
- var themes_1 = require("../../../../../themes");
9
- var CustomizedLabel = function (_a) {
10
- var y = _a.y, width = _a.width, height = _a.height, value = _a.value, showPercent = _a.showPercent, showCount = _a.showCount, opacity = _a.opacity, _base_barchart_ui_configs = _a._base_barchart_ui_configs, _debug_controls = _a._debug_controls, onMouseOver = _a.onMouseOver, onMouseOut = _a.onMouseOut, onMouseDown = _a.onMouseDown, activeBar = _a.activeBar, TOT_HEIGHT_SINGLE_BAR_SECTION = _a.TOT_HEIGHT_SINGLE_BAR_SECTION, TOT_HEIGHT_STACKED_BAR_SECTION = _a.TOT_HEIGHT_STACKED_BAR_SECTION, TOT_HEIGHT_GROUPED_BAR_SECTION = _a.TOT_HEIGHT_GROUPED_BAR_SECTION, CALC_SINGLE_BAR_SECTION_Y_POS = _a.CALC_SINGLE_BAR_SECTION_Y_POS, CALC_STACKED_BAR_SECTION_Y_POS = _a.CALC_STACKED_BAR_SECTION_Y_POS, breakdownDisplayType = _a.breakdownDisplayType, _b = _a.showSumOfBreakdownValues, showSumOfBreakdownValues = _b === void 0 ? false : _b;
11
- if (!value)
12
- return null;
13
- var yOffset = -(_base_barchart_ui_configs.labelToBarGap + (_base_barchart_ui_configs.barHeight / 2));
14
- var xOffsetRelative = 10;
15
- var isBreakdown = Array.isArray(value);
16
- var name = isBreakdown ? value[0].name : value.name;
17
- var formatValue = function () {
18
- if (isBreakdown) {
19
- var values_1 = value;
20
- if (showSumOfBreakdownValues) {
21
- var valueKey_1 = showPercent ? 'percentage' : 'count';
22
- var suffixFunction = function (value) {
23
- return showPercent ? value.toFixed(1) + '%' : value;
24
- };
25
- var totValue = suffixFunction(values_1.reduce(function (acc, b) { return acc + b[valueKey_1]; }, 0));
26
- return totValue;
27
- }
28
- else { //only used while showing the summarized data as a stacked bar
29
- return values_1.map(function (v, index) { return (react_1.default.createElement("tspan", { key: index, fill: v.textColor, className: "UI_BODY_BOLD_SM" },
30
- showPercent ? v.percentage.toFixed(1) + '%' : v.count,
31
- index < values_1.length - 1 && (react_1.default.createElement("tspan", { fill: themes_1.colors.grey80 }, " + ")))); });
32
- }
33
- }
34
- else {
35
- var singleValue = value;
36
- return showPercent
37
- ? singleValue.percentage + "%"
38
- : singleValue.count;
39
- }
40
- };
41
- var getCount = function () {
42
- if (isBreakdown) {
43
- return value.reduce(function (sum, v) { return sum + v.count; }, 0);
44
- }
45
- else {
46
- return value.count;
47
- }
48
- };
49
- return (react_1.default.createElement("g", null,
50
- (isBreakdown && !showSumOfBreakdownValues) && //meaning if its a breakdown and we are showing values as v1 + v2 + v3 which occupies too much space and hence we need double line
51
- react_1.default.createElement("text", { className: "UI_BODY_SM", opacity: opacity, x: _base_barchart_ui_configs.marginLeft, dy: y - (_base_barchart_ui_configs.labelToBarGap + _base_barchart_ui_configs.labelHeight + _base_barchart_ui_configs.gapBetweenTwoLabels), fill: themes_1.colors.grey80, textAnchor: "start" }, name),
52
- react_1.default.createElement("text", { opacity: opacity, x: _base_barchart_ui_configs.marginLeft, dy: y - (_base_barchart_ui_configs.labelToBarGap), fill: themes_1.colors.grey80, textAnchor: "start", className: "UI_BODY_BOLD_SM" },
53
- formatValue(),
54
- showPercent && !isBreakdown && (react_1.default.createElement("tspan", { className: "UI_BODY_SM", dx: xOffsetRelative, fill: themes_1.colors.grey80 }, getCount())),
55
- (isBreakdown && !showSumOfBreakdownValues) ? null : react_1.default.createElement("tspan", { className: "UI_BODY_SM", dx: xOffsetRelative, fill: themes_1.colors.grey80 }, name)),
56
- react_1.default.createElement("rect", { style: onMouseDown ? { cursor: 'pointer' } : {}, onMouseDown: function (e) { return onMouseDown === null || onMouseDown === void 0 ? void 0 : onMouseDown(e, value); }, onMouseOver: function (e) {
57
- onMouseOver === null || onMouseOver === void 0 ? void 0 : onMouseOver(e, value);
58
- }, onMouseOut: function (e) {
59
- onMouseOut === null || onMouseOut === void 0 ? void 0 : onMouseOut(e, value);
60
- }, x: _base_barchart_ui_configs.hoverRectStrokeWidth, y: (!isBreakdown || showSumOfBreakdownValues)
61
- ? _base_barchart_ui_configs.hoverRectStrokeWidth + CALC_SINGLE_BAR_SECTION_Y_POS(value.dataIndex)
62
- : breakdownDisplayType === 'stacked'
63
- ? _base_barchart_ui_configs.hoverRectStrokeWidth + CALC_STACKED_BAR_SECTION_Y_POS(value[0].dataIndex)
64
- : breakdownDisplayType === 'grouped' &&
65
- _base_barchart_ui_configs.hoverRectStrokeWidth + (TOT_HEIGHT_GROUPED_BAR_SECTION + _base_barchart_ui_configs.gapBetweenBarSections) * value[0].dataIndex, width: "calc(100% - ".concat(_base_barchart_ui_configs.hoverRectStrokeWidth * 2, "px)"), height: (!isBreakdown || showSumOfBreakdownValues)
66
- ? TOT_HEIGHT_SINGLE_BAR_SECTION
67
- : breakdownDisplayType === 'stacked'
68
- ? TOT_HEIGHT_STACKED_BAR_SECTION
69
- : breakdownDisplayType === 'grouped' &&
70
- TOT_HEIGHT_GROUPED_BAR_SECTION, opacity: _debug_controls.mouseEventDetectorOpacity ||
71
- (activeBar === name ? 1 : 0), stroke: themes_1.colors.grey30, rx: 5, ry: 5, strokeWidth: "".concat(_base_barchart_ui_configs.hoverRectStrokeWidth, "px"), fillOpacity: _debug_controls.mouseEventDetectorOpacity })));
72
- };
73
- exports.CustomizedLabel = CustomizedLabel;
@@ -1,12 +0,0 @@
1
- import React from "react";
2
- interface LegendData {
3
- color: string;
4
- text: string;
5
- }
6
- interface LegendProps {
7
- data: LegendData[];
8
- label?: string;
9
- orientation?: "vertical" | "horizontal";
10
- }
11
- export declare const Legend: React.FC<LegendProps>;
12
- export {};
@@ -1,35 +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
- var __importDefault = (this && this.__importDefault) || function (mod) {
14
- return (mod && mod.__esModule) ? mod : { "default": mod };
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.Legend = void 0;
18
- var react_1 = __importDefault(require("react"));
19
- var __1 = require("../../../../../..");
20
- var Typo2_1 = require("../../../../Typo2");
21
- var LegendTooltipGlyph_1 = require("../LegendTooltipGlyph");
22
- var Legend = function (_a) {
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))", maxHeight: orientation === 'vertical' ? '100%' : '150px', overflow: 'auto' }) },
25
- label && orientation === 'vertical' && (react_1.default.createElement("div", { style: { paddingBottom: "8px" } },
26
- react_1.default.createElement(Typo2_1.UI_CAPTION_BOLD_DF, null, label))),
27
- react_1.default.createElement("div", { style: __assign(__assign({ display: "flex", flexDirection: orientation === "vertical" ? "column" : "row" }, (orientation === 'horizontal' ? { flexWrap: 'wrap' } : {})), { gap: "8px" }) },
28
- label && orientation === 'horizontal' && (react_1.default.createElement(Typo2_1.UI_CAPTION_BOLD_DF, null, label)),
29
- data.map(function (d, index) {
30
- return (react_1.default.createElement("div", { key: index, style: { display: "flex", alignItems: "center", gap: "6px" } },
31
- react_1.default.createElement(LegendTooltipGlyph_1.LegendTooltipGlyph, { color: d.color }),
32
- react_1.default.createElement(Typo2_1.UI_CAPTION_DF, null, d.text)));
33
- }))));
34
- };
35
- exports.Legend = Legend;
@@ -1,7 +0,0 @@
1
- import React from "react";
2
- interface LegendTooltipGlyphProps {
3
- color: string;
4
- size?: number;
5
- }
6
- export declare const LegendTooltipGlyph: React.FC<LegendTooltipGlyphProps>;
7
- export {};
@@ -1,18 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.LegendTooltipGlyph = void 0;
7
- var react_1 = __importDefault(require("react"));
8
- var LegendTooltipGlyph = function (_a) {
9
- var color = _a.color, _b = _a.size, size = _b === void 0 ? 10 : _b;
10
- return (react_1.default.createElement("div", { style: {
11
- width: size + 'px',
12
- height: size + 'px',
13
- borderRadius: "50%",
14
- backgroundColor: color,
15
- flexShrink: 0
16
- } }));
17
- };
18
- exports.LegendTooltipGlyph = LegendTooltipGlyph;
@@ -1,7 +0,0 @@
1
- import React from "react";
2
- export declare const TruncatedSVGText: ({ text, textContainerRef, widthRef, widthOffset }: {
3
- text: any;
4
- textContainerRef: any;
5
- widthRef: any;
6
- widthOffset?: number;
7
- }) => React.JSX.Element;