@lumx/react 3.13.3-alpha.2 → 3.14.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.
package/index.js CHANGED
@@ -523,7 +523,6 @@ const CSS_PREFIX = 'lumx';
523
523
  * you need to update their scss counterpart as well
524
524
  */
525
525
  const DIALOG_TRANSITION_DURATION = 400;
526
- const EXPANSION_PANEL_TRANSITION_DURATION = 400;
527
526
  const NOTIFICATION_TRANSITION_DURATION = 200;
528
527
 
529
528
  /**
@@ -7180,8 +7179,33 @@ const ExpansionPanel = forwardRef((props, ref) => {
7180
7179
  }));
7181
7180
  const wrapperRef = useRef(null);
7182
7181
 
7183
- /** Hide the children at the end of the transition */
7184
- const isChildrenVisible = useTransitionVisibility(wrapperRef, !!isOpen, EXPANSION_PANEL_TRANSITION_DURATION);
7182
+ // Children visible while the open/close transition is running
7183
+ const [isChildrenVisible, setChildrenVisible] = React__default.useState(isOpen);
7184
+ const isOpenRef = React__default.useRef(isOpen);
7185
+ React__default.useEffect(() => {
7186
+ if (isOpen) {
7187
+ setChildrenVisible(true);
7188
+ } else if (!IS_BROWSER) {
7189
+ // Outside a browser we can't wait for the transition
7190
+ setChildrenVisible(false);
7191
+ }
7192
+ isOpenRef.current = isOpen;
7193
+ }, [isOpen]);
7194
+
7195
+ // Change children visibility on transition end
7196
+ React__default.useEffect(() => {
7197
+ const {
7198
+ current: wrapper
7199
+ } = wrapperRef;
7200
+ if (!IS_BROWSER || !wrapper) {
7201
+ return undefined;
7202
+ }
7203
+ const onTransitionEnd = () => {
7204
+ setChildrenVisible(isOpenRef.current);
7205
+ };
7206
+ wrapper.addEventListener('transitionend', onTransitionEnd);
7207
+ return () => wrapper.removeEventListener('transitionend', onTransitionEnd);
7208
+ }, []);
7185
7209
  return /*#__PURE__*/React__default.createElement("section", _extends({
7186
7210
  ref: ref
7187
7211
  }, forwardedProps, {
@@ -7201,10 +7225,10 @@ const ExpansionPanel = forwardRef((props, ref) => {
7201
7225
  icon: isOpen ? mdiChevronUp : mdiChevronDown,
7202
7226
  "aria-expanded": isOpen || 'false'
7203
7227
  })))), /*#__PURE__*/React__default.createElement("div", {
7204
- className: `${CLASSNAME$Z}__wrapper`
7205
- }, (isOpen || isChildrenVisible) && /*#__PURE__*/React__default.createElement("div", {
7206
- className: `${CLASSNAME$Z}__container`,
7228
+ className: `${CLASSNAME$Z}__wrapper`,
7207
7229
  ref: wrapperRef
7230
+ }, (isOpen || isChildrenVisible) && /*#__PURE__*/React__default.createElement("div", {
7231
+ className: `${CLASSNAME$Z}__container`
7208
7232
  }, /*#__PURE__*/React__default.createElement("div", {
7209
7233
  className: `${CLASSNAME$Z}__content`
7210
7234
  }, content), footer && /*#__PURE__*/React__default.createElement("div", {