oolib 2.175.2 → 2.175.3

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.
@@ -52,7 +52,10 @@ var StyledContainer = styled_components_1.default.div(templateObject_1 || (templ
52
52
  var StyledHeader = styled_components_1.default.button(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n width: 100%;\n padding: 1rem 1.6rem;\n text-align: left;\n background: none;\n border: none;\n cursor: pointer;\n display: flex;\n align-items: center;\n"], ["\n width: 100%;\n padding: 1rem 1.6rem;\n text-align: left;\n background: none;\n border: none;\n cursor: pointer;\n display: flex;\n align-items: center;\n"])));
53
53
  var StyledRightHeaderSection = styled_components_1.default.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n"], ["\n display: flex;\n align-items: center;\n"])));
54
54
  var ArrowWrapper = styled_components_1.default.button(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n border: none;\n background: none;\n cursor: pointer;\n width: 2rem;\n display: flex;\n align-items: center;\n justify-content: center;\n transform: rotate(", "deg);\n ", ";\n"], ["\n border: none;\n background: none;\n cursor: pointer;\n width: 2rem;\n display: flex;\n align-items: center;\n justify-content: center;\n transform: rotate(", "deg);\n ", ";\n"])), function (props) { return (props.isExpanded ? 0 : 180); }, (0, mixins_1.transition)("transform"));
55
- var StyledContentWrapper = styled_components_1.default.div(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n display: flex;\n align-items: flex-end;\n \n ", "\n height: ", ";\n"], ["\n display: flex;\n align-items: flex-end;\n \n ", "\n height: ", ";\n"])), (0, mixins_1.transition)("height"), function (_a) {
55
+ var StyledContentWrapper = styled_components_1.default.div(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n display: flex;\n align-items: flex-end;\n \n ", "\n height: ", ";\n"], ["\n display: flex;\n align-items: flex-end;\n \n ", "\n height: ", ";\n"])), function (_a) {
56
+ var expandAnimationDuration = _a.expandAnimationDuration;
57
+ return (0, mixins_1.transition)("height ".concat(expandAnimationDuration / 1000, "s ease-out"));
58
+ }, function (_a) {
56
59
  var height = _a.height;
57
60
  return height;
58
61
  });
@@ -88,9 +91,7 @@ var useCalculateWrapperHeight = function (_a) {
88
91
  });
89
92
  };
90
93
  var Accordion = function (_a) {
91
- var title = _a.title, children = _a.children, _b = _a.defaultExpanded, defaultExpanded = _b === void 0 ? true : _b, _c = _a.accordionOverflow, accordionOverflow = _c === void 0 ? 'hidden' : _c, //in some cases we need to toggle the overflow to let a tooltip stick out and show for example (in DataVizAccordion)
92
- _d = _a.actionsConfig, //in some cases we need to toggle the overflow to let a tooltip stick out and show for example (in DataVizAccordion)
93
- actionsConfig = _d === void 0 ? [
94
+ var title = _a.title, children = _a.children, _b = _a.defaultExpanded, defaultExpanded = _b === void 0 ? true : _b, _c = _a.actionsConfig, actionsConfig = _c === void 0 ? [
94
95
  {
95
96
  display: "Grouped",
96
97
  onClick: function () { return console.log("grouped"); },
@@ -99,9 +100,35 @@ var Accordion = function (_a) {
99
100
  display: "Stacked",
100
101
  onClick: function () { return console.log("stacked"); },
101
102
  },
102
- ] : _d;
103
- var _e = (0, react_1.useState)(defaultExpanded), isExpanded = _e[0], setIsExpanded = _e[1];
104
- var _f = useCalculateWrapperHeight({ isExpanded: isExpanded }), wrapperRef = _f.wrapperRef, wrapperHeight = _f.wrapperHeight;
103
+ ] : _c;
104
+ var _d = (0, react_1.useState)(defaultExpanded), isExpanded = _d[0], setIsExpanded = _d[1];
105
+ var _e = useCalculateWrapperHeight({ isExpanded: isExpanded }), wrapperRef = _e.wrapperRef, wrapperHeight = _e.wrapperHeight;
106
+ var expandAnimationDuration = 300;
107
+ //helps to make the accordionOverflow visible once its open,
108
+ //for scenarios where a data viz tooltip needs to stick out
109
+ var _f = (0, react_1.useState)("hidden"), accordionOverflow = _f[0], setAccordionOverflow = _f[1];
110
+ (0, react_1.useEffect)(function () {
111
+ var timeoutId;
112
+ if (isExpanded) {
113
+ // Set timeout for making content visible after animation
114
+ timeoutId = setTimeout(function () {
115
+ // Double check if still expanded before setting to visible
116
+ if (isExpanded) {
117
+ setAccordionOverflow("visible");
118
+ }
119
+ }, expandAnimationDuration);
120
+ }
121
+ else {
122
+ // Immediately set to hidden when closing
123
+ setAccordionOverflow("hidden");
124
+ }
125
+ // Cleanup function to clear timeout if component updates/unmounts
126
+ return function () {
127
+ if (timeoutId) {
128
+ clearTimeout(timeoutId);
129
+ }
130
+ };
131
+ }, [isExpanded, expandAnimationDuration]);
105
132
  return (react_1.default.createElement(StyledContainer, null,
106
133
  react_1.default.createElement(StyledHeader, { onClick: function () { return setIsExpanded(!isExpanded); } },
107
134
  react_1.default.createElement("div", { style: { flex: "1 0 0" } },
@@ -110,7 +137,7 @@ var Accordion = function (_a) {
110
137
  react_1.default.createElement(ArrowWrapper, { isExpanded: isExpanded },
111
138
  react_1.default.createElement(phosphor_react_1.CaretDown, { size: 16 })),
112
139
  actionsConfig && (react_1.default.createElement(ActionMenu_1.ActionMenu, { CustomSelectComp: CustomActionMenuSelectButton, actions: actionsConfig })))),
113
- react_1.default.createElement(StyledContentWrapper, { height: wrapperHeight, style: { overflow: accordionOverflow } },
140
+ react_1.default.createElement(StyledContentWrapper, { height: wrapperHeight, style: { overflow: accordionOverflow }, expandAnimationDuration: expandAnimationDuration },
114
141
  react_1.default.createElement(StyledContentInnerWrapper, { ref: wrapperRef }, children))));
115
142
  };
116
143
  exports.Accordion = Accordion;
@@ -1,10 +1,9 @@
1
- import React, { Dispatch, SetStateAction } from 'react';
1
+ import React from 'react';
2
2
  import { TooltipProps } from 'recharts';
3
3
  import { LabelData } from '../CustomizedLabel';
4
4
  interface CustomTooltipProps extends TooltipProps<number, string> {
5
5
  value?: LabelData[];
6
6
  showPercent?: boolean;
7
- setAccordionOverflow?: Dispatch<SetStateAction<string>>;
8
7
  }
9
8
  declare const CustomTooltip: React.FC<CustomTooltipProps>;
10
9
  export default CustomTooltip;
@@ -1,44 +1,14 @@
1
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
- })();
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
35
5
  Object.defineProperty(exports, "__esModule", { value: true });
36
- var react_1 = __importStar(require("react"));
6
+ var react_1 = __importDefault(require("react"));
37
7
  var Typo2_1 = require("../../../Typo2");
38
8
  var __1 = require("../../../../..");
39
9
  var CustomTooltip = function (props) {
40
10
  var _a, _b;
41
- var active = props.active, payload = props.payload, value = props.value, showPercent = props.showPercent, setAccordionOverflow = props.setAccordionOverflow;
11
+ var active = props.active, payload = props.payload, value = props.value, showPercent = props.showPercent;
42
12
  if (!active || !payload || !payload.length)
43
13
  return null;
44
14
  // Calculate position - align with the right side of the bars
@@ -59,10 +29,6 @@ var CustomTooltip = function (props) {
59
29
  flexDirection: 'column',
60
30
  gap: '0.5rem'
61
31
  };
62
- (0, react_1.useEffect)(function () {
63
- setAccordionOverflow && setAccordionOverflow('visible');
64
- return function () { return setAccordionOverflow && setAccordionOverflow('hidden'); };
65
- }, []);
66
32
  return (react_1.default.createElement("div", { style: style }, value.map(function (entry, index) { return (react_1.default.createElement("div", { key: index, style: {
67
33
  display: 'flex',
68
34
  alignItems: 'center',
@@ -1,4 +1,4 @@
1
- import React, { Dispatch, SetStateAction } from "react";
1
+ import React from "react";
2
2
  export interface BaseConfigs {
3
3
  barHeight: number;
4
4
  labelToBarGap: number;
@@ -29,6 +29,5 @@ export interface BarChartProps {
29
29
  showPercent?: boolean;
30
30
  breakdownDisplayType?: "grouped" | "stacked";
31
31
  colorIdx?: number;
32
- setAccordionOverflow?: Dispatch<SetStateAction<string>>;
33
32
  }
34
33
  export declare const BarChart: React.FC<BarChartProps>;
@@ -194,7 +194,7 @@ var barConfigs = {
194
194
  },
195
195
  };
196
196
  var BarChart = function (_a) {
197
- var _data = _a.data, valuePath = _a.valuePath, tooltipLabelsMapping = _a.tooltipLabelsMapping, tooltipLabelsPath = _a.tooltipLabelsPath, _b = _a.labelPath, labelPath = _b === void 0 ? "name" : _b, onClick = _a.onClick, _c = _a.breakdownDisplayType, breakdownDisplayType = _c === void 0 ? "grouped" : _c, _d = _a.showCount, showCount = _d === void 0 ? true : _d, _e = _a.showPercent, showPercent = _e === void 0 ? true : _e, _f = _a.colorIdx, colorIdx = _f === void 0 ? 0 : _f, setAccordionOverflow = _a.setAccordionOverflow;
197
+ var _data = _a.data, valuePath = _a.valuePath, tooltipLabelsMapping = _a.tooltipLabelsMapping, tooltipLabelsPath = _a.tooltipLabelsPath, _b = _a.labelPath, labelPath = _b === void 0 ? "name" : _b, onClick = _a.onClick, _c = _a.breakdownDisplayType, breakdownDisplayType = _c === void 0 ? "grouped" : _c, _d = _a.showCount, showCount = _d === void 0 ? true : _d, _e = _a.showPercent, showPercent = _e === void 0 ? true : _e, _f = _a.colorIdx, colorIdx = _f === void 0 ? 0 : _f;
198
198
  var isBreakdown = Array.isArray(valuePath);
199
199
  var data = usePrepareData({
200
200
  _data: _data,
@@ -272,7 +272,7 @@ var BarChart = function (_a) {
272
272
  // god knows why the dataindex gets stored against props.label.
273
273
  // this is some internal recharts thing for tooltips specifically.
274
274
  // we dont do this.
275
- value: (_a = data[props.label]) === null || _a === void 0 ? void 0 : _a.map(function (item, idx) { return (__assign(__assign({}, item.labels), { color: colors_1.dataVizColors[(colorIdx + idx) % colors_1.dataVizColors.length] })); }), setAccordionOverflow: setAccordionOverflow })));
275
+ value: (_a = data[props.label]) === null || _a === void 0 ? void 0 : _a.map(function (item, idx) { return (__assign(__assign({}, item.labels), { color: colors_1.dataVizColors[(colorIdx + idx) % colors_1.dataVizColors.length] })); }) })));
276
276
  }, cursor: false, allowEscapeViewBox: { x: true, y: true } })),
277
277
  isBreakdown
278
278
  ? data[0].map(function (_, stackIndex) {
@@ -44,18 +44,17 @@ var DataVizAccordion = function (_a) {
44
44
  },
45
45
  };
46
46
  var _c = (0, react_2.useState)(chartOptions[0]), activeCompConfig = _c[0], setActiveCompConfig = _c[1];
47
- var genActiveChartComp = function (activeCompConfig, setAccordionOverflow) {
47
+ var genActiveChartComp = function (activeCompConfig) {
48
48
  var ActiveChartComp = ChartComps[activeCompConfig.comp].comp;
49
49
  var wrapperStyle = ChartComps[activeCompConfig.comp].wrapperStyle;
50
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, { setAccordionOverflow: setAccordionOverflow }))));
51
+ react_1.default.createElement(ActiveChartComp, __assign({}, props, activeCompConfig.props))));
52
52
  };
53
- var _d = (0, react_2.useState)('hidden'), accordionOverflow = _d[0], setAccordionOverflow = _d[1];
54
- return (react_1.default.createElement(Accordion_1.Accordion, { key: JSON.stringify(activeCompConfig), title: title, accordionOverflow: accordionOverflow, actionsConfig: chartOptions.length > 1 && chartOptions.map(function (d) { return ({
53
+ return (react_1.default.createElement(Accordion_1.Accordion, { key: JSON.stringify(activeCompConfig), title: title, actionsConfig: chartOptions.length > 1 && chartOptions.map(function (d) { return ({
55
54
  display: d.display,
56
55
  onClick: function () {
57
56
  return setActiveCompConfig(d);
58
57
  },
59
- }); }) }, genActiveChartComp(activeCompConfig, setAccordionOverflow)));
58
+ }); }) }, genActiveChartComp(activeCompConfig)));
60
59
  };
61
60
  exports.DataVizAccordion = DataVizAccordion;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oolib",
3
- "version": "2.175.2",
3
+ "version": "2.175.3",
4
4
  "description": " OKE Component Library",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",