oolib 2.188.8 → 2.189.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 (31) hide show
  1. package/dist/components/Dropdowns/DropdownMulti/index.js +2 -0
  2. package/dist/components/Dropdowns/DropdownSingle/index.js +6 -1
  3. package/dist/index.d.ts +1 -1
  4. package/dist/index.js +1 -1
  5. package/dist/stories/v2/components/Accordion.stories.js +1 -1
  6. package/dist/stories/v2/components/BarChart.stories.js +70 -43
  7. package/dist/stories/v2/components/HeatMapGrid.stories.d.ts +17 -0
  8. package/dist/stories/v2/components/HeatMapGrid.stories.js +107 -0
  9. package/dist/v2/components/DataVizAccordion/index.d.ts +1 -1
  10. package/dist/v2/components/DataVizAccordion/index.js +1 -1
  11. package/dist/v2/components/Dropdowns/DropdownMulti/index.js +2 -0
  12. package/dist/v2/components/Dropdowns/DropdownSingle/index.js +6 -1
  13. package/dist/v2/components/dataviz/BarChart/_base_barchart_ui_configs.d.ts +18 -0
  14. package/dist/v2/components/dataviz/BarChart/_base_barchart_ui_configs.js +24 -0
  15. package/dist/v2/components/{BarChart → dataviz/BarChart}/comps/CustomTooltip/index.d.ts +4 -4
  16. package/dist/v2/components/dataviz/BarChart/comps/CustomTooltip/index.js +161 -0
  17. package/dist/v2/components/{BarChart → dataviz/BarChart}/comps/CustomizedLabel/index.d.ts +7 -12
  18. package/dist/v2/components/{BarChart → dataviz/BarChart}/comps/CustomizedLabel/index.js +22 -12
  19. package/dist/v2/components/{BarChart → dataviz/BarChart}/index.d.ts +12 -14
  20. package/dist/v2/components/dataviz/BarChart/index.js +276 -0
  21. package/dist/v2/components/dataviz/HeatMapGrid/index.d.ts +21 -0
  22. package/dist/v2/components/dataviz/HeatMapGrid/index.js +230 -0
  23. package/dist/v2/components/dataviz/types.d.ts +12 -0
  24. package/dist/v2/components/dataviz/types.js +2 -0
  25. package/dist/v2/components/dataviz/utils/usePrepareData.d.ts +20 -0
  26. package/dist/v2/components/dataviz/utils/usePrepareData.js +116 -0
  27. package/package.json +1 -1
  28. package/dist/v2/components/BarChart/comps/CustomTooltip/index.js +0 -50
  29. package/dist/v2/components/BarChart/index.js +0 -294
  30. /package/dist/v2/components/{BarChart → dataviz/BarChart}/comps/TruncatedSVGText/index.d.ts +0 -0
  31. /package/dist/v2/components/{BarChart → dataviz/BarChart}/comps/TruncatedSVGText/index.js +0 -0
@@ -103,6 +103,8 @@ function DropdownMulti(_a) {
103
103
  }, [
104
104
  JSON.stringify(optionsProp), //we need this cuz options change from 'loading' to actual options in some cases
105
105
  // showOptions
106
+ optionsFn === null || optionsFn === void 0 ? void 0 : optionsFn.fn,
107
+ optionsFn === null || optionsFn === void 0 ? void 0 : optionsFn.args,
106
108
  value
107
109
  ]);
108
110
  options = (0, react_1.useMemo)(function () {
@@ -129,7 +129,12 @@ function DropdownSingle(_a) {
129
129
  searchFieldsConfig: searchFieldsConfig,
130
130
  setFilteredOptionsInParent: setFilteredOptionsInParent,
131
131
  });
132
- }, [optionsProp, optionsFn === null || optionsFn === void 0 ? void 0 : optionsFn.fn, searchString]);
132
+ }, [
133
+ optionsProp,
134
+ optionsFn === null || optionsFn === void 0 ? void 0 : optionsFn.fn,
135
+ optionsFn === null || optionsFn === void 0 ? void 0 : optionsFn.args,
136
+ searchString
137
+ ]);
133
138
  var genSelectTagsInput = function (ops) {
134
139
  if (ops === void 0) { ops = {}; }
135
140
  return (react_1.default.createElement(SelectTagsInput_1.SelectTagsInput, { id: id, value: value, invert: invert, handleSelect: handleSelect, searchString: searchString, setSearchString: setSearchString, single_multi: 'single', placeholder: placeholder, S: S, disabled: disabled, showOptions: showOptions, S: S, style: ops.style
package/dist/index.d.ts CHANGED
@@ -70,7 +70,7 @@ export { TabBarStyle1 as TabBarV2 } from "./v2/components/TabBar";
70
70
  export { default as MetaBlockV2 } from "./v2/components/MetaBlock";
71
71
  export { DateRangePicker as DateRangePickerV2 } from "./v2/components/DateRangePicker";
72
72
  export { HomeCover as HomeCoverV2 } from "./v2/components/HomeCover";
73
- export { BarChart } from "./v2/components/BarChart";
73
+ export { BarChart } from "./v2/components/dataviz/BarChart";
74
74
  export { DataVizAccordion } from "./v2/components/DataVizAccordion";
75
75
  export { Accordion as AccordionV2 } from "./v2/components/Accordion";
76
76
  export { CheckboxList } from "./v2/components/RadioAndCheckbox/comps/CheckboxList";
package/dist/index.js CHANGED
@@ -232,7 +232,7 @@ Object.defineProperty(exports, "DateRangePickerV2", { enumerable: true, get: fun
232
232
  var HomeCover_2 = require("./v2/components/HomeCover");
233
233
  Object.defineProperty(exports, "HomeCoverV2", { enumerable: true, get: function () { return HomeCover_2.HomeCover; } });
234
234
  //V2 data viz comps
235
- var BarChart_1 = require("./v2/components/BarChart");
235
+ var BarChart_1 = require("./v2/components/dataviz/BarChart");
236
236
  Object.defineProperty(exports, "BarChart", { enumerable: true, get: function () { return BarChart_1.BarChart; } });
237
237
  var DataVizAccordion_1 = require("./v2/components/DataVizAccordion");
238
238
  Object.defineProperty(exports, "DataVizAccordion", { enumerable: true, get: function () { return DataVizAccordion_1.DataVizAccordion; } });
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.BarChart = void 0;
7
7
  var react_1 = __importDefault(require("react"));
8
- var BarChart_1 = require("../../../v2/components/BarChart");
8
+ var BarChart_1 = require("../../../v2/components/dataviz/BarChart");
9
9
  var Accordion_1 = require("../../../v2/components/Accordion");
10
10
  // import BarChartDocs from './BarChart.mdx'
11
11
  exports.default = {
@@ -5,8 +5,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.BarChart = void 0;
7
7
  var react_1 = __importDefault(require("react"));
8
- var BarChart_1 = require("../../../v2/components/BarChart");
8
+ var BarChart_1 = require("../../../v2/components/dataviz/BarChart");
9
9
  var BarChart_mdx_1 = __importDefault(require("./BarChart.mdx"));
10
+ var CustomTooltip_1 = __importDefault(require("../../../v2/components/dataviz/BarChart/comps/CustomTooltip"));
10
11
  exports.default = {
11
12
  title: "Oolib V 2.0/components/BarChart",
12
13
  argTypes: {
@@ -117,59 +118,85 @@ var BarChart = function (args) {
117
118
  react_1.default.createElement("div", { style: { display: "flex", flexDirection: "column", gap: "40px" } },
118
119
  react_1.default.createElement(BarChart_1.BarChart, { data: [
119
120
  {
120
- display: "Logged In Once",
121
- // stack1: 60,
122
- stack2: 20,
123
- stack3: 40,
124
- stack4: 10,
125
- stack5: 40,
126
- stack6: 10,
121
+ display: "Logged In Once During the First Week of Registration and Completed the Basic Profile Section Without Abandoning the Process",
122
+ stack1: 60
127
123
  },
128
124
  {
129
- display: "Registered Users",
130
- stack1: 100,
131
- stack2: 50,
132
- stack3: 10,
133
- stack4: 15,
134
- stack5: 40,
135
- stack6: 10,
125
+ display: "Registered Users Who Successfully Verified Their Email Address and Set Up Two-Factor Authentication for Enhanced Account Security",
126
+ stack1: 100
136
127
  },
137
128
  {
138
- display: "Created Profile",
139
- stack1: 20,
140
- stack2: 5,
141
- stack3: 10,
142
- stack4: 15,
143
- stack5: 40,
144
- stack6: 10,
129
+ display: "Created Profile With All Recommended Fields Including Biography, Education History, Work Experience, and Personal Interests",
130
+ stack1: 20
145
131
  },
146
132
  {
147
- display: "Wrote at least 3 story",
148
- stack1: 8,
149
- stack2: 2,
150
- stack3: 1,
151
- stack4: 1,
152
- stack5: 40,
153
- stack6: 10,
133
+ display: "Wrote at least 3 stories With Over 2,000 Words Each and Received More Than 50 Positive Engagements from Other Community Members",
134
+ stack1: 8
154
135
  },
155
136
  {
156
- display: "Created Profile again",
157
- stack1: 20,
158
- stack2: 5,
159
- stack3: 10,
160
- stack4: 15,
161
- stack5: 40,
162
- stack6: 10,
137
+ display: "Created Profile again After Deleting Their Previous One Due to Privacy Concerns or Desire to Start Fresh with New Information",
138
+ stack1: 20
163
139
  },
164
140
  {
165
- display: "Wrote at least 1 story",
166
- stack1: 8,
167
- stack2: 2,
168
- stack3: 1,
169
- stack4: 1,
170
- stack5: 40,
171
- stack6: 10,
141
+ display: "Wrote at least 1 story That Was Featured on the Homepage and Remained in the Top Trending Section for More Than 48 Hours",
142
+ stack1: 8
143
+ },
144
+ {
145
+ display: "Completed Onboarding Including All Optional Tutorials and Achieved a Perfect Score on the Platform Knowledge Assessment Test",
146
+ stack1: 78
147
+ },
148
+ {
149
+ display: "Added Payment Method and Set Up Recurring Billing for Premium Subscription Without Encountering Any Technical Issues During Checkout",
150
+ stack1: 42
151
+ },
152
+ {
153
+ display: "Made First Purchase Within 24 Hours of Creating Their Account and Left a Five-Star Review for the Product or Service",
154
+ stack1: 35
155
+ },
156
+ {
157
+ display: "Referred a Friend Through the Official Referral Program and Both Received the Maximum Possible Bonus Credits as a Result",
158
+ stack1: 27
159
+ },
160
+ {
161
+ display: "Participated in the Annual User Satisfaction Survey and Provided Detailed Feedback on Potential Platform Improvements",
162
+ stack1: 54
172
163
  },
164
+ {
165
+ display: "Downloaded the Mobile Application on Multiple Devices and Enabled Cross-Platform Synchronization for Seamless User Experience",
166
+ stack1: 89
167
+ },
168
+ {
169
+ display: "Configured Advanced Notification Preferences to Receive Real-Time Alerts for Specific Activities Relevant to Their Interests",
170
+ stack1: 31
171
+ },
172
+ {
173
+ display: "Successfully Recovered Account After Forgetting Password by Following the Secure Password Reset Protocol Without Support Assistance",
174
+ stack1: 46
175
+ },
176
+ {
177
+ display: "Achieved Gold Tier Status in the Loyalty Program by Consistently Engaging with the Platform for More Than Six Consecutive Months",
178
+ stack1: 15
179
+ },
180
+ {
181
+ display: "Converted From Free Trial to Paid Subscription Before the Trial Period Ended and Opted for the Annual Payment Plan with Auto-Renewal",
182
+ stack1: 67
183
+ },
184
+ {
185
+ display: "Customized Their Dashboard Layout to Optimize Workflow Efficiency Based on Their Unique Usage Patterns and Preferences",
186
+ stack1: 72
187
+ },
188
+ {
189
+ display: "Signed Up for Beta Testing Program and Provided Valuable Feedback on Experimental Features Before General Public Release",
190
+ stack1: 19
191
+ },
192
+ {
193
+ display: "Linked All Available Social Media Accounts to Enable Cross-Platform Sharing and Enhanced Social Networking Capabilities",
194
+ stack1: 38
195
+ },
196
+ {
197
+ display: "Reported a Critical Bug That Was Subsequently Fixed in the Next Software Update and Received Official Recognition for the Contribution",
198
+ stack1: 5
199
+ }
173
200
  ], plotDataPoint: "percentage" // This can be changed to count
174
201
  ,
175
202
  // valuePath={["stack1", "stack2", "stack3", "stack4", "stack5", "stack6"]}
@@ -0,0 +1,17 @@
1
+ declare namespace _default {
2
+ let title: string;
3
+ namespace argTypes {
4
+ namespace showPercent {
5
+ let control: string;
6
+ let description: string;
7
+ let defaultValue: boolean;
8
+ }
9
+ }
10
+ namespace args {
11
+ let showPercent_1: boolean;
12
+ export { showPercent_1 as showPercent };
13
+ }
14
+ }
15
+ export default _default;
16
+ export function HeatMapGrid(args: any): React.JSX.Element;
17
+ import React from "react";
@@ -0,0 +1,107 @@
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.HeatMapGrid = void 0;
7
+ var react_1 = __importDefault(require("react"));
8
+ var HeatMapGrid_1 = require("../../../v2/components/dataviz/HeatMapGrid");
9
+ exports.default = {
10
+ title: "Oolib V 2.0/components/HeatMapGrid",
11
+ argTypes: {
12
+ showPercent: {
13
+ control: 'boolean',
14
+ description: 'Toggle percentage display',
15
+ defaultValue: true,
16
+ }
17
+ },
18
+ args: {
19
+ showPercent: true,
20
+ },
21
+ };
22
+ var HeatMapGrid = function (args) {
23
+ var colors = ["#5C80FF", "#FFA800", "#00BC8F", "#5C51CE"];
24
+ var handleCellClick = function (name) {
25
+ console.log("cell clicked: ".concat(name));
26
+ };
27
+ return (react_1.default.createElement("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: "20px" } },
28
+ react_1.default.createElement("div", null,
29
+ react_1.default.createElement(HeatMapGrid_1.HeatMapGrid, { showPercent: args.showPercent, data: [
30
+ {
31
+ display: "Logged In Once",
32
+ stack1: 60,
33
+ stack2: 20,
34
+ stack3: 40,
35
+ stack4: 10,
36
+ stack5: 40,
37
+ stack6: 10,
38
+ stack2Display: 'Labels Path Stack 2 Display'
39
+ },
40
+ {
41
+ display: "Registered Users",
42
+ stack1: 100,
43
+ stack2: 50,
44
+ stack3: 10,
45
+ stack4: 15,
46
+ stack5: 40,
47
+ stack6: 10,
48
+ },
49
+ {
50
+ display: "Created Profile",
51
+ stack1: 20,
52
+ stack2: 5,
53
+ stack3: 10,
54
+ stack4: 15,
55
+ stack5: 40,
56
+ stack6: 10,
57
+ },
58
+ {
59
+ display: "Wrote at least 3 story",
60
+ stack1: 8,
61
+ stack2: 2,
62
+ stack3: 1,
63
+ stack4: 1,
64
+ stack5: 40,
65
+ stack6: 10,
66
+ },
67
+ {
68
+ display: "Created Profile again",
69
+ stack1: 20,
70
+ stack2: 5,
71
+ stack3: 10,
72
+ stack4: 15,
73
+ stack5: 40,
74
+ stack6: 10,
75
+ },
76
+ {
77
+ display: "Wrote at least 1 story",
78
+ stack1: 8,
79
+ stack2: 2,
80
+ stack3: 1,
81
+ stack4: 1,
82
+ stack5: 40,
83
+ stack6: 10,
84
+ },
85
+ ], plotDataPoint: "percentage" // This can be changed to count
86
+ , valuePath: [
87
+ "stack1",
88
+ "stack2",
89
+ "stack3",
90
+ "stack4",
91
+ "stack5",
92
+ "stack6",
93
+ ], tooltipLabelsMapping: {
94
+ stack1: 'Stack 1',
95
+ stack2: 'Stack 2',
96
+ stack3: 'Stack 3',
97
+ stack4: 'Stack 4',
98
+ stack5: 'Stack 5',
99
+ stack6: 'Stack 6',
100
+ },
101
+ // valuePath="stack1"
102
+ labelPath: "display", title: "This is a Heat Map Grid", onClick: handleCellClick, colorIdx: 2 })),
103
+ react_1.default.createElement("div", null,
104
+ react_1.default.createElement("div", { style: { display: "flex", flexDirection: "column", gap: "40px" } },
105
+ react_1.default.createElement("div", { style: { height: '500px', background: 'aqua' } })))));
106
+ };
107
+ exports.HeatMapGrid = HeatMapGrid;
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import { BarChartProps } from "../BarChart";
2
+ import { BarChartProps } from "../dataviz/BarChart";
3
3
  type ChartOptionConfig = {
4
4
  display: string;
5
5
  comp: 'PieChart' | 'BarChart';
@@ -28,7 +28,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
28
28
  exports.DataVizAccordion = void 0;
29
29
  var react_1 = __importDefault(require("react"));
30
30
  var react_2 = require("react");
31
- var BarChart_1 = require("../BarChart");
31
+ var BarChart_1 = require("../dataviz/BarChart");
32
32
  var PieChart_1 = require("../PieChart");
33
33
  var Accordion_1 = require("../Accordion");
34
34
  var DataVizAccordion = function (_a) {
@@ -103,6 +103,8 @@ function DropdownMulti(_a) {
103
103
  }, [
104
104
  JSON.stringify(optionsProp), //we need this cuz options change from 'loading' to actual options in some cases
105
105
  // showOptions
106
+ optionsFn === null || optionsFn === void 0 ? void 0 : optionsFn.fn,
107
+ optionsFn === null || optionsFn === void 0 ? void 0 : optionsFn.args,
106
108
  value
107
109
  ]);
108
110
  options = (0, react_1.useMemo)(function () {
@@ -129,7 +129,12 @@ function DropdownSingle(_a) {
129
129
  searchFieldsConfig: searchFieldsConfig,
130
130
  setFilteredOptionsInParent: setFilteredOptionsInParent,
131
131
  });
132
- }, [optionsProp, optionsFn === null || optionsFn === void 0 ? void 0 : optionsFn.fn, searchString]);
132
+ }, [
133
+ optionsProp,
134
+ optionsFn === null || optionsFn === void 0 ? void 0 : optionsFn.fn,
135
+ optionsFn === null || optionsFn === void 0 ? void 0 : optionsFn.args,
136
+ searchString
137
+ ]);
133
138
  var genSelectTagsInput = function (ops) {
134
139
  if (ops === void 0) { ops = {}; }
135
140
  return (react_1.default.createElement(SelectTagsInput_1.SelectTagsInput, { id: id, value: value, invert: invert, handleSelect: handleSelect, searchString: searchString, setSearchString: setSearchString, single_multi: 'single', placeholder: placeholder, S: S, disabled: disabled, showOptions: showOptions, S: S, style: ops.style
@@ -0,0 +1,18 @@
1
+ export interface BaseBarChartUIConfigs {
2
+ barHeight: number;
3
+ labelToBarGap: number;
4
+ labelHeight: number;
5
+ labelToNextBarGap: number;
6
+ barRadius: number;
7
+ gapBetweenBarSections: number;
8
+ hoverRectStrokeWidth: number;
9
+ marginLeft: number;
10
+ marginRight: number;
11
+ gapBetweenBarsInGroup: number;
12
+ }
13
+ /**
14
+ * if any changes are being made to the spacing and such of
15
+ this comps design, all these properties need to be carefully
16
+ observed and tweaked to ensure no ui has gotten warped due to sideeffects
17
+ */
18
+ export declare const _base_barchart_ui_configs: BaseBarChartUIConfigs;
@@ -0,0 +1,24 @@
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
+ labelToNextBarGap: 14,
15
+ //other bar section related properties
16
+ barRadius: 2,
17
+ gapBetweenBarSections: 0,
18
+ hoverRectStrokeWidth: 1,
19
+ //overall chart margin
20
+ marginLeft: 6,
21
+ marginRight: 6,
22
+ //grouped bar chart related properties
23
+ gapBetweenBarsInGroup: 3,
24
+ };
@@ -1,8 +1,8 @@
1
- import React from 'react';
2
- import { TooltipProps } from 'recharts';
3
- import { LabelData } from '../CustomizedLabel';
1
+ import React from "react";
2
+ import { TooltipProps } from "recharts";
3
+ import { CountVizLabels } from "../../../types";
4
4
  interface CustomTooltipProps extends TooltipProps<number, string> {
5
- value?: LabelData[];
5
+ value?: CountVizLabels[];
6
6
  showPercent?: boolean;
7
7
  mousePosition?: {
8
8
  x: number;
@@ -0,0 +1,161 @@
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 __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
40
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
41
+ if (ar || !(i in from)) {
42
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
43
+ ar[i] = from[i];
44
+ }
45
+ }
46
+ return to.concat(ar || Array.prototype.slice.call(from));
47
+ };
48
+ var __importDefault = (this && this.__importDefault) || function (mod) {
49
+ return (mod && mod.__esModule) ? mod : { "default": mod };
50
+ };
51
+ Object.defineProperty(exports, "__esModule", { value: true });
52
+ var react_1 = __importStar(require("react"));
53
+ var styled_components_1 = __importDefault(require("styled-components"));
54
+ var __1 = require("../../../../../..");
55
+ var Typo2_1 = require("../../../../Typo2");
56
+ 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) {
57
+ var clampT = _a.clampT;
58
+ return clampT ? (0, __1.clampText)(3) : '';
59
+ });
60
+ var CustomTooltip = function (props) {
61
+ var active = props.active, value = props.value, showPercent = props.showPercent, mousePosition = props.mousePosition;
62
+ var tooltipWrapperRef = (0, react_1.useRef)(null);
63
+ var calcTooltipTop = function (_a) {
64
+ var _b, _c;
65
+ var tooltipWrapperRef = _a.tooltipWrapperRef, mousePosY = _a.mousePosY;
66
+ var windowHeight = window.innerHeight;
67
+ 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;
68
+ if (tooltipWrapperBottom && tooltipWrapperBottom > windowHeight) {
69
+ var topNegativeOffset = tooltipWrapperBottom - windowHeight;
70
+ return mousePosY - topNegativeOffset - 5; // plus 5 so that the bottom of the tooltip doesnt touch the bottom of the screen
71
+ }
72
+ else {
73
+ return mousePosY;
74
+ }
75
+ };
76
+ // Calculate position - align with the right side of the bars
77
+ var style = {
78
+ position: "fixed",
79
+ left: "".concat((mousePosition === null || mousePosition === void 0 ? void 0 : mousePosition.x) || 0, "px"),
80
+ top: "".concat(calcTooltipTop({ tooltipWrapperRef: tooltipWrapperRef, mousePosY: (mousePosition === null || mousePosition === void 0 ? void 0 : mousePosition.y) || 0 }), "px"),
81
+ transform: "translate(10px, 10px)", // Offset from cursor and center vertically
82
+ backgroundColor: __1.colors2.black,
83
+ color: __1.colors2.white,
84
+ border: "1px solid ".concat(__1.colors2.grey10),
85
+ borderRadius: "6px",
86
+ padding: "8px",
87
+ boxShadow: "0px 4px 10px 0px rgba(0, 0, 0, 0.12)",
88
+ zIndex: 100000,
89
+ width: "max-content",
90
+ maxWidth: "300px",
91
+ maxHeight: "500px",
92
+ overflow: "auto",
93
+ display: "flex",
94
+ flexDirection: "column",
95
+ gap: "1rem",
96
+ // pointerEvents: "none", // Add this to prevent tooltip from interfering with mouse events
97
+ };
98
+ var tooltipLabelLengthRefs = (0, react_1.useRef)([]);
99
+ var _a = (0, react_1.useState)([]), rowHeights = _a[0], setRowHeights = _a[1];
100
+ 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];
101
+ (0, react_1.useEffect)(function () {
102
+ if (!tooltipTextClampStates) {
103
+ setTooltipTextClampStates(value === null || value === void 0 ? void 0 : value.map(function (v) { return true; }));
104
+ }
105
+ }, [value]);
106
+ (0, react_1.useEffect)(function () {
107
+ // console.log({ tooltipLabelLengthRefs });
108
+ var rowHeightsToSet = tooltipLabelLengthRefs.current.map(function (ref) {
109
+ var _a;
110
+ var heightOfLabelText = (_a = ref === null || ref === void 0 ? void 0 : ref.getBoundingClientRect()) === null || _a === void 0 ? void 0 : _a.height;
111
+ // console.log({heightOfLabelText})
112
+ return heightOfLabelText || null;
113
+ });
114
+ setRowHeights(rowHeightsToSet);
115
+ }, [tooltipTextClampStates.join()]);
116
+ if (!active)
117
+ return null;
118
+ return (react_1.default.createElement(react_1.Fragment, null,
119
+ react_1.default.createElement("div", { ref: tooltipWrapperRef, style: style },
120
+ react_1.default.createElement("div", { style: {
121
+ display: "grid",
122
+ gridTemplateColumns: showPercent ? "auto auto auto" : "auto auto",
123
+ gap: "0.6rem",
124
+ } },
125
+ react_1.default.createElement("div", { style: { display: "flex", flexDirection: "column", gap: "1rem" } }, value.map(function (entry, index) { return (react_1.default.createElement("div", { style: { height: rowHeights[index] ? rowHeights[index] + "px" : "auto" } },
126
+ react_1.default.createElement("div", { style: {
127
+ display: "flex",
128
+ alignItems: "center",
129
+ gap: "0.6rem",
130
+ } },
131
+ react_1.default.createElement("div", { key: index, style: {
132
+ width: "1.2rem",
133
+ height: "1.2rem",
134
+ borderRadius: "50%",
135
+ backgroundColor: entry.color,
136
+ } }),
137
+ react_1.default.createElement(Typo2_1.UI_CAPTION_BOLD_DF, { key: index }, showPercent ? entry.percentage + "%" : entry.count || "0")))); })),
138
+ showPercent && (react_1.default.createElement("div", { style: { display: "flex", flexDirection: "column", gap: "1rem" } }, value.map(function (entry, index) { return (react_1.default.createElement("div", { style: {
139
+ height: rowHeights[index]
140
+ ? rowHeights[index] + "px"
141
+ : "auto",
142
+ } },
143
+ react_1.default.createElement(Typo2_1.UI_CAPTION_DF, { key: index }, entry.count || "0"))); }))),
144
+ react_1.default.createElement("div", { style: {
145
+ paddingLeft: "0.8rem",
146
+ display: "flex",
147
+ flexDirection: "column",
148
+ gap: "1rem",
149
+ } }, value.map(function (entry, index) { return (react_1.default.createElement("div", { onMouseOver: function () { return setTooltipTextClampStates(function (prev) {
150
+ var newState = __spreadArray([], prev, true);
151
+ newState[index] = false;
152
+ return newState;
153
+ }); }, onMouseOut: function () { return setTooltipTextClampStates(function (prev) {
154
+ var newState = __spreadArray([], prev, true);
155
+ newState[index] = true;
156
+ return newState;
157
+ }); }, ref: function (el) { return (tooltipLabelLengthRefs.current[index] = el); } },
158
+ react_1.default.createElement(UI_CAPTION_DF_WITH_LINE_CLAMP, { clampT: tooltipTextClampStates[index], key: index }, entry.tooltipLabel))); }))))));
159
+ };
160
+ exports.default = CustomTooltip;
161
+ var templateObject_1;
@@ -1,14 +1,8 @@
1
1
  import React from "react";
2
- import { BaseConfigs, DebugControls } from "../..";
3
- export interface LabelData {
4
- percentage: number;
5
- count: number;
6
- name: string;
7
- dataIndex: number;
8
- color: string;
9
- tooltipLabel?: string;
10
- }
11
- export type CustomizedLabelValue = LabelData | LabelData[];
2
+ import { DebugControls } from "../..";
3
+ import { CountVizLabels } from "../../../types";
4
+ import { BaseBarChartUIConfigs } from "../../_base_barchart_ui_configs";
5
+ export type CustomizedLabelValue = CountVizLabels | CountVizLabels[];
12
6
  interface CustomizedLabelProps {
13
7
  y?: number | string;
14
8
  width?: number | string;
@@ -19,14 +13,15 @@ interface CustomizedLabelProps {
19
13
  opacity: number;
20
14
  activeBar?: string;
21
15
  breakdownDisplayType?: 'grouped' | 'stacked';
22
- _base_configs: BaseConfigs;
16
+ _base_barchart_ui_configs: BaseBarChartUIConfigs;
23
17
  _debug_controls: DebugControls;
24
18
  TOT_HEIGHT_SINGLE_BAR_SECTION: number;
25
19
  TOT_HEIGHT_GROUPED_BAR_SECTION: number;
26
20
  CALC_SINGLE_BAR_SECTION_Y_POS: (index: number) => number;
21
+ showSumOfBreakdownValues?: boolean;
27
22
  onMouseOver?: (e: React.MouseEvent<SVGRectElement, MouseEvent>, v: CustomizedLabelValue) => void;
28
23
  onMouseOut?: (e: React.MouseEvent<SVGRectElement, MouseEvent>, v: CustomizedLabelValue) => void;
29
24
  onMouseDown?: (e: React.MouseEvent<SVGRectElement, MouseEvent>, v: CustomizedLabelValue) => void;
30
25
  }
31
- export declare const CustomizedLabel: ({ y, width, height, value, showPercent, showCount, opacity, _base_configs, _debug_controls, onMouseOver, onMouseOut, onMouseDown, activeBar, TOT_HEIGHT_SINGLE_BAR_SECTION, TOT_HEIGHT_GROUPED_BAR_SECTION, CALC_SINGLE_BAR_SECTION_Y_POS, breakdownDisplayType }: CustomizedLabelProps) => React.JSX.Element;
26
+ 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_GROUPED_BAR_SECTION, CALC_SINGLE_BAR_SECTION_Y_POS, breakdownDisplayType, showSumOfBreakdownValues }: CustomizedLabelProps) => React.JSX.Element;
32
27
  export {};