@lumx/react 3.17.1 → 3.17.3-alpha.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.d.ts +1 -1
- package/index.js +11 -8
- package/index.js.map +1 -1
- package/package.json +3 -3
- package/src/components/expansion-panel/ExpansionPanel.stories.tsx +13 -1
- package/src/components/expansion-panel/ExpansionPanel.test.tsx +21 -2
- package/src/components/expansion-panel/ExpansionPanel.tsx +12 -9
- package/src/hooks/useClickAway.tsx +5 -4
- package/src/stories/utils/initDemoShadowDOMPortal.ts +10 -0
- package/src/utils/ClickAwayProvider/ClickAwayProvider.stories.jsx +27 -7
- package/src/utils/Portal/PortalProvider.stories.jsx +11 -22
- package/utils/index.js +9 -7
- package/utils/index.js.map +1 -1
package/index.d.ts
CHANGED
|
@@ -1206,7 +1206,7 @@ declare const Dropdown: Comp<DropdownProps, HTMLDivElement>;
|
|
|
1206
1206
|
/**
|
|
1207
1207
|
* Defines the props of the component.
|
|
1208
1208
|
*/
|
|
1209
|
-
interface ExpansionPanelProps extends GenericProps, HasTheme {
|
|
1209
|
+
interface ExpansionPanelProps extends GenericProps, HasCloseMode, HasTheme {
|
|
1210
1210
|
/** Whether the expansion panel has a background. */
|
|
1211
1211
|
hasBackground?: boolean;
|
|
1212
1212
|
/** Whether the header has a divider. */
|
package/index.js
CHANGED
|
@@ -6888,7 +6888,7 @@ Dropdown.displayName = COMPONENT_NAME$10;
|
|
|
6888
6888
|
Dropdown.className = CLASSNAME$10;
|
|
6889
6889
|
Dropdown.defaultProps = DEFAULT_PROPS$O;
|
|
6890
6890
|
|
|
6891
|
-
const _excluded$14 = ["className", "children", "hasBackground", "hasHeaderDivider", "isOpen", "label", "onClose", "onOpen", "onToggleOpen", "theme", "toggleButtonProps"];
|
|
6891
|
+
const _excluded$14 = ["className", "closeMode", "children", "hasBackground", "hasHeaderDivider", "isOpen", "label", "onClose", "onOpen", "onToggleOpen", "theme", "toggleButtonProps"];
|
|
6892
6892
|
|
|
6893
6893
|
/**
|
|
6894
6894
|
* Defines the props of the component.
|
|
@@ -6907,7 +6907,9 @@ const CLASSNAME$$ = getRootClassName(COMPONENT_NAME$$);
|
|
|
6907
6907
|
/**
|
|
6908
6908
|
* Component default props.
|
|
6909
6909
|
*/
|
|
6910
|
-
const DEFAULT_PROPS$N = {
|
|
6910
|
+
const DEFAULT_PROPS$N = {
|
|
6911
|
+
closeMode: 'unmount'
|
|
6912
|
+
};
|
|
6911
6913
|
const isDragHandle = isComponent(DragHandle);
|
|
6912
6914
|
const isHeader = isComponent('header');
|
|
6913
6915
|
const isFooter = isComponent('footer');
|
|
@@ -6923,6 +6925,7 @@ const ExpansionPanel = forwardRef((props, ref) => {
|
|
|
6923
6925
|
const defaultTheme = useTheme() || Theme.light;
|
|
6924
6926
|
const {
|
|
6925
6927
|
className,
|
|
6928
|
+
closeMode = DEFAULT_PROPS$N.closeMode,
|
|
6926
6929
|
children: anyChildren,
|
|
6927
6930
|
hasBackground,
|
|
6928
6931
|
hasHeaderDivider,
|
|
@@ -6970,20 +6973,20 @@ const ExpansionPanel = forwardRef((props, ref) => {
|
|
|
6970
6973
|
}));
|
|
6971
6974
|
const wrapperRef = useRef(null);
|
|
6972
6975
|
|
|
6973
|
-
// Children visible while the open/close transition is running
|
|
6976
|
+
// Children stay visible while the open/close transition is running
|
|
6974
6977
|
const [isChildrenVisible, setChildrenVisible] = React__default.useState(isOpen);
|
|
6975
6978
|
const isOpenRef = React__default.useRef(isOpen);
|
|
6976
6979
|
React__default.useEffect(() => {
|
|
6977
|
-
if (isOpen) {
|
|
6980
|
+
if (isOpen || closeMode === 'hide') {
|
|
6978
6981
|
setChildrenVisible(true);
|
|
6979
6982
|
} else if (!IS_BROWSER) {
|
|
6980
6983
|
// Outside a browser we can't wait for the transition
|
|
6981
6984
|
setChildrenVisible(false);
|
|
6982
6985
|
}
|
|
6983
6986
|
isOpenRef.current = isOpen;
|
|
6984
|
-
}, [isOpen]);
|
|
6987
|
+
}, [closeMode, isOpen]);
|
|
6985
6988
|
|
|
6986
|
-
// Change children visibility on transition end
|
|
6989
|
+
// Change children's visibility on the transition end
|
|
6987
6990
|
React__default.useEffect(() => {
|
|
6988
6991
|
const {
|
|
6989
6992
|
current: wrapper
|
|
@@ -6992,11 +6995,11 @@ const ExpansionPanel = forwardRef((props, ref) => {
|
|
|
6992
6995
|
return undefined;
|
|
6993
6996
|
}
|
|
6994
6997
|
const onTransitionEnd = () => {
|
|
6995
|
-
setChildrenVisible(isOpenRef.current);
|
|
6998
|
+
setChildrenVisible(isOpenRef.current || closeMode === 'hide');
|
|
6996
6999
|
};
|
|
6997
7000
|
wrapper.addEventListener('transitionend', onTransitionEnd);
|
|
6998
7001
|
return () => wrapper.removeEventListener('transitionend', onTransitionEnd);
|
|
6999
|
-
}, []);
|
|
7002
|
+
}, [closeMode]);
|
|
7000
7003
|
return /*#__PURE__*/React__default.createElement("section", _extends({
|
|
7001
7004
|
ref: ref
|
|
7002
7005
|
}, forwardedProps, {
|