x-ui-design 0.8.12 → 0.8.13
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/dist/esm/types/components/Popover/Popover.d.ts +1 -1
- package/dist/esm/types/types/popover.d.ts +1 -0
- package/dist/index.esm.js +10 -8
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +10 -8
- package/dist/index.js.map +1 -1
- package/lib/components/Popover/Popover.tsx +20 -16
- package/lib/types/popover.ts +1 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4909,6 +4909,7 @@ const Popover = ({
|
|
|
4909
4909
|
trigger = "click",
|
|
4910
4910
|
placement = "bottom",
|
|
4911
4911
|
open,
|
|
4912
|
+
visible,
|
|
4912
4913
|
title,
|
|
4913
4914
|
overlayClassName = '',
|
|
4914
4915
|
overlayStyle = {},
|
|
@@ -4918,8 +4919,8 @@ const Popover = ({
|
|
|
4918
4919
|
const triggerRef = React.useRef(null);
|
|
4919
4920
|
const popupRef = React.useRef(null);
|
|
4920
4921
|
const [innerOpen, setInnerOpen] = React.useState(false);
|
|
4921
|
-
const
|
|
4922
|
-
const
|
|
4922
|
+
const [hover, setHover] = React.useState(false);
|
|
4923
|
+
const isOpen = visible !== undefined ? visible : open !== undefined ? open : innerOpen;
|
|
4923
4924
|
const {
|
|
4924
4925
|
dropdownPosition,
|
|
4925
4926
|
shouldShowAbove
|
|
@@ -4932,7 +4933,8 @@ const Popover = ({
|
|
|
4932
4933
|
getPopupContainer: getPopupContainer?.(triggerRef.current)
|
|
4933
4934
|
});
|
|
4934
4935
|
const toggle = () => {
|
|
4935
|
-
|
|
4936
|
+
const newState = !isOpen;
|
|
4937
|
+
onVisibleChange ? onVisibleChange(newState) : setInnerOpen(newState);
|
|
4936
4938
|
};
|
|
4937
4939
|
const show = () => {
|
|
4938
4940
|
setHover(true);
|
|
@@ -4959,20 +4961,20 @@ const Popover = ({
|
|
|
4959
4961
|
}, /*#__PURE__*/React.createElement("div", _extends({
|
|
4960
4962
|
className: `${prefixCls}-wrapper-content`
|
|
4961
4963
|
}, childProps), children), isOpen && /*#__PURE__*/React.createElement(ConditionalWrapper, {
|
|
4962
|
-
condition: getPopupContainer
|
|
4964
|
+
condition: !!getPopupContainer,
|
|
4963
4965
|
wrapper: element => getPopupContainer ? /*#__PURE__*/reactDom.createPortal(element, getPopupContainer(popupRef.current)) : /*#__PURE__*/React.createElement(React.Fragment, null, element)
|
|
4964
4966
|
}, /*#__PURE__*/React.createElement("div", {
|
|
4965
4967
|
ref: popupRef,
|
|
4966
|
-
className: clsx(prefixCls, `${prefixCls}-${placement}`,
|
|
4968
|
+
className: clsx(prefixCls, `${prefixCls}-${placement}`, overlayClassName),
|
|
4967
4969
|
style: {
|
|
4968
|
-
zIndex:
|
|
4970
|
+
zIndex: hover ? 1000 : 1,
|
|
4969
4971
|
...overlayStyle,
|
|
4970
4972
|
position: "absolute",
|
|
4971
4973
|
...dropdownPosition
|
|
4972
4974
|
}
|
|
4973
|
-
}, title
|
|
4975
|
+
}, title && /*#__PURE__*/React.createElement("div", {
|
|
4974
4976
|
className: `${prefixCls}-title`
|
|
4975
|
-
}, title)
|
|
4977
|
+
}, title), /*#__PURE__*/React.createElement("div", {
|
|
4976
4978
|
className: `${prefixCls}-inner`
|
|
4977
4979
|
}, content), /*#__PURE__*/React.createElement("div", {
|
|
4978
4980
|
className: `${prefixCls}-arrow ${shouldShowAbove ? 'bottom' : ''}`
|