x-ui-design 0.9.67 → 0.9.68
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/hooks/usePopupPosition.d.ts +1 -2
- package/dist/esm/types/types/popover.d.ts +0 -1
- package/dist/index.esm.js +3 -7
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +3 -7
- package/dist/index.js.map +1 -1
- package/lib/components/Popover/Popover.tsx +0 -2
- package/lib/hooks/usePopupPosition.ts +2 -5
- package/lib/types/popover.ts +0 -1
- package/package.json +1 -1
- package/src/app/page.tsx +8 -202
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { PopoverProps } from "../../types/popover";
|
|
3
3
|
import './style.css';
|
|
4
|
-
declare const Popover: ({ prefixCls, content, children, trigger, placement, open, visible, title, style, overlayClassName, overlayStyle,
|
|
4
|
+
declare const Popover: ({ prefixCls, content, children, trigger, placement, open, visible, title, style, overlayClassName, overlayStyle, onVisibleChange, getPopupContainer }: PopoverProps) => React.JSX.Element;
|
|
5
5
|
export default Popover;
|
|
@@ -8,9 +8,8 @@ type TPopupPosition = {
|
|
|
8
8
|
placement?: Placement;
|
|
9
9
|
popupContainer?: HTMLElement | null;
|
|
10
10
|
useTargetWidth?: boolean;
|
|
11
|
-
listenPopoverPositions?: CSSProperties;
|
|
12
11
|
};
|
|
13
|
-
export declare const usePopupPosition: ({ open, setOpen, popupRef, targetRef, placement, popupContainer, useTargetWidth,
|
|
12
|
+
export declare const usePopupPosition: ({ open, setOpen, popupRef, targetRef, placement, popupContainer, useTargetWidth, }: TPopupPosition) => {
|
|
14
13
|
_placement: Placement;
|
|
15
14
|
popupStyle: CSSProperties;
|
|
16
15
|
};
|
package/dist/index.esm.js
CHANGED
|
@@ -2627,8 +2627,7 @@ const usePopupPosition = ({
|
|
|
2627
2627
|
targetRef,
|
|
2628
2628
|
placement,
|
|
2629
2629
|
popupContainer,
|
|
2630
|
-
useTargetWidth
|
|
2631
|
-
listenPopoverPositions
|
|
2630
|
+
useTargetWidth
|
|
2632
2631
|
}) => {
|
|
2633
2632
|
const [_placement, _setPlacement] = useState(placement ?? "bottomLeft");
|
|
2634
2633
|
const [popupPosition, setPopupPosition] = useState({});
|
|
@@ -2664,7 +2663,7 @@ const usePopupPosition = ({
|
|
|
2664
2663
|
}
|
|
2665
2664
|
const popupRect = popupRef.current?.getBoundingClientRect();
|
|
2666
2665
|
if (popupRect) {
|
|
2667
|
-
if (popupRect?.width < OFFSET) {
|
|
2666
|
+
if (popupRect?.width < OFFSET || !targetRef.current) {
|
|
2668
2667
|
setOpen(false);
|
|
2669
2668
|
setPopupPosition({});
|
|
2670
2669
|
const timeout = setTimeout(() => {
|
|
@@ -2801,13 +2800,12 @@ const usePopupPosition = ({
|
|
|
2801
2800
|
controller.abort();
|
|
2802
2801
|
setPopupPosition({});
|
|
2803
2802
|
};
|
|
2804
|
-
}, [open, targetRef,
|
|
2803
|
+
}, [open, targetRef, calculatePosition]);
|
|
2805
2804
|
return {
|
|
2806
2805
|
_placement,
|
|
2807
2806
|
popupStyle: {
|
|
2808
2807
|
zIndex: 10000,
|
|
2809
2808
|
position: "absolute",
|
|
2810
|
-
// transition: '1s ease',
|
|
2811
2809
|
opacity: Object.keys(popupPosition).length ? 1 : 0,
|
|
2812
2810
|
...popupPosition
|
|
2813
2811
|
}
|
|
@@ -5671,7 +5669,6 @@ const Popover = ({
|
|
|
5671
5669
|
style = {},
|
|
5672
5670
|
overlayClassName = '',
|
|
5673
5671
|
overlayStyle = {},
|
|
5674
|
-
listenPopoverPositions,
|
|
5675
5672
|
onVisibleChange,
|
|
5676
5673
|
getPopupContainer
|
|
5677
5674
|
}) => {
|
|
@@ -5688,7 +5685,6 @@ const Popover = ({
|
|
|
5688
5685
|
placement,
|
|
5689
5686
|
open: isOpen,
|
|
5690
5687
|
setOpen: setInnerOpen,
|
|
5691
|
-
listenPopoverPositions,
|
|
5692
5688
|
popupContainer: getPopupContainer?.(targetRef.current)
|
|
5693
5689
|
});
|
|
5694
5690
|
useEffect(() => {
|