@lumx/react 3.13.3-alpha.1 → 3.13.3-alpha.2
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/index.js +6 -20
- package/index.js.map +1 -1
- package/package.json +3 -3
- package/src/components/expansion-panel/ExpansionPanel.tsx +8 -21
package/index.js
CHANGED
|
@@ -7157,13 +7157,13 @@ const ExpansionPanel = forwardRef((props, ref) => {
|
|
|
7157
7157
|
}, label);
|
|
7158
7158
|
const toggleOpen = event => {
|
|
7159
7159
|
const shouldOpen = !isOpen;
|
|
7160
|
-
if (
|
|
7160
|
+
if (onOpen && shouldOpen) {
|
|
7161
7161
|
onOpen(event);
|
|
7162
7162
|
}
|
|
7163
|
-
if (
|
|
7163
|
+
if (onClose && !shouldOpen) {
|
|
7164
7164
|
onClose(event);
|
|
7165
7165
|
}
|
|
7166
|
-
if (
|
|
7166
|
+
if (onToggleOpen) {
|
|
7167
7167
|
onToggleOpen(shouldOpen, event);
|
|
7168
7168
|
}
|
|
7169
7169
|
};
|
|
@@ -7182,16 +7182,6 @@ const ExpansionPanel = forwardRef((props, ref) => {
|
|
|
7182
7182
|
|
|
7183
7183
|
/** Hide the children at the end of the transition */
|
|
7184
7184
|
const isChildrenVisible = useTransitionVisibility(wrapperRef, !!isOpen, EXPANSION_PANEL_TRANSITION_DURATION);
|
|
7185
|
-
|
|
7186
|
-
// Switch max height on/off to activate the CSS transition (updates when children changes).
|
|
7187
|
-
const [maxHeight, setMaxHeight] = useState('0');
|
|
7188
|
-
useEffect(() => {
|
|
7189
|
-
const height = isOpen ? get(wrapperRef.current, 'offsetHeight', 0) : 0;
|
|
7190
|
-
setMaxHeight(`${height}px`);
|
|
7191
|
-
}, [isOpen]);
|
|
7192
|
-
const onTransitionEnd = React__default.useCallback(() => {
|
|
7193
|
-
setMaxHeight(undefined);
|
|
7194
|
-
}, []);
|
|
7195
7185
|
return /*#__PURE__*/React__default.createElement("section", _extends({
|
|
7196
7186
|
ref: ref
|
|
7197
7187
|
}, forwardedProps, {
|
|
@@ -7210,13 +7200,9 @@ const ExpansionPanel = forwardRef((props, ref) => {
|
|
|
7210
7200
|
emphasis: Emphasis.low,
|
|
7211
7201
|
icon: isOpen ? mdiChevronUp : mdiChevronDown,
|
|
7212
7202
|
"aria-expanded": isOpen || 'false'
|
|
7213
|
-
})))),
|
|
7214
|
-
className: `${CLASSNAME$Z}__wrapper
|
|
7215
|
-
|
|
7216
|
-
maxHeight
|
|
7217
|
-
},
|
|
7218
|
-
onTransitionEnd: onTransitionEnd
|
|
7219
|
-
}, /*#__PURE__*/React__default.createElement("div", {
|
|
7203
|
+
})))), /*#__PURE__*/React__default.createElement("div", {
|
|
7204
|
+
className: `${CLASSNAME$Z}__wrapper`
|
|
7205
|
+
}, (isOpen || isChildrenVisible) && /*#__PURE__*/React__default.createElement("div", {
|
|
7220
7206
|
className: `${CLASSNAME$Z}__container`,
|
|
7221
7207
|
ref: wrapperRef
|
|
7222
7208
|
}, /*#__PURE__*/React__default.createElement("div", {
|