oolib 2.175.1 → 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
|
|
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
|
});
|
|
@@ -100,6 +103,32 @@ var Accordion = function (_a) {
|
|
|
100
103
|
] : _c;
|
|
101
104
|
var _d = (0, react_1.useState)(defaultExpanded), isExpanded = _d[0], setIsExpanded = _d[1];
|
|
102
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]);
|
|
103
132
|
return (react_1.default.createElement(StyledContainer, null,
|
|
104
133
|
react_1.default.createElement(StyledHeader, { onClick: function () { return setIsExpanded(!isExpanded); } },
|
|
105
134
|
react_1.default.createElement("div", { style: { flex: "1 0 0" } },
|
|
@@ -108,7 +137,7 @@ var Accordion = function (_a) {
|
|
|
108
137
|
react_1.default.createElement(ArrowWrapper, { isExpanded: isExpanded },
|
|
109
138
|
react_1.default.createElement(phosphor_react_1.CaretDown, { size: 16 })),
|
|
110
139
|
actionsConfig && (react_1.default.createElement(ActionMenu_1.ActionMenu, { CustomSelectComp: CustomActionMenuSelectButton, actions: actionsConfig })))),
|
|
111
|
-
react_1.default.createElement(StyledContentWrapper, { height: wrapperHeight },
|
|
140
|
+
react_1.default.createElement(StyledContentWrapper, { height: wrapperHeight, style: { overflow: accordionOverflow }, expandAnimationDuration: expandAnimationDuration },
|
|
112
141
|
react_1.default.createElement(StyledContentInnerWrapper, { ref: wrapperRef }, children))));
|
|
113
142
|
};
|
|
114
143
|
exports.Accordion = Accordion;
|