x-ui-design 0.8.40 → 0.8.43
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/usePosition.d.ts +3 -2
- package/dist/esm/types/types/popover.d.ts +0 -1
- package/dist/index.esm.js +6 -9
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +6 -9
- package/dist/index.js.map +1 -1
- package/lib/components/Popover/Popover.tsx +4 -8
- package/lib/hooks/usePosition.ts +4 -0
- package/lib/types/popover.ts +0 -1
- package/package.json +1 -1
- package/src/app/page.tsx +0 -3
|
@@ -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, onVisibleChange, getPopupContainer
|
|
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;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Placement } from "../types";
|
|
2
|
-
import { CSSProperties, RefObject } from "react";
|
|
2
|
+
import { CSSProperties, ReactNode, RefObject } from "react";
|
|
3
3
|
type TPosition = {
|
|
4
4
|
isOpen: boolean;
|
|
5
5
|
popupRef: RefObject<HTMLDivElement | null>;
|
|
@@ -7,8 +7,9 @@ type TPosition = {
|
|
|
7
7
|
getPopupContainer?: HTMLElement;
|
|
8
8
|
placement?: Placement;
|
|
9
9
|
offset?: number;
|
|
10
|
+
children?: ReactNode;
|
|
10
11
|
};
|
|
11
|
-
export declare const usePosition: ({ isOpen, offset, popupRef, placement, triggerRef, getPopupContainer, }: TPosition) => {
|
|
12
|
+
export declare const usePosition: ({ isOpen, offset, popupRef, placement, triggerRef, children, getPopupContainer, }: TPosition) => {
|
|
12
13
|
showPlacement: string;
|
|
13
14
|
dropdownPosition: CSSProperties;
|
|
14
15
|
};
|
|
@@ -10,7 +10,6 @@ export type PopoverProps = DefaultProps & {
|
|
|
10
10
|
overlayClassName?: string;
|
|
11
11
|
title?: string | ReactNode;
|
|
12
12
|
visible?: boolean;
|
|
13
|
-
controlDropdownPosition?: CSSProperties;
|
|
14
13
|
onVisibleChange?: ((open: boolean) => void) | undefined;
|
|
15
14
|
getPopupContainer?: ((node: HTMLElement) => HTMLElement) | undefined;
|
|
16
15
|
};
|
package/dist/index.esm.js
CHANGED
|
@@ -2609,6 +2609,7 @@ const usePosition = ({
|
|
|
2609
2609
|
popupRef,
|
|
2610
2610
|
placement,
|
|
2611
2611
|
triggerRef,
|
|
2612
|
+
children,
|
|
2612
2613
|
getPopupContainer
|
|
2613
2614
|
}) => {
|
|
2614
2615
|
const [showPlacement, setShowPlacement] = useState('');
|
|
@@ -2693,7 +2694,7 @@ const usePosition = ({
|
|
|
2693
2694
|
return () => {
|
|
2694
2695
|
controller.abort();
|
|
2695
2696
|
};
|
|
2696
|
-
}, [isOpen, triggerRef, getPopupContainer, dropdownPosition]);
|
|
2697
|
+
}, [isOpen, children, triggerRef, getPopupContainer, dropdownPosition]);
|
|
2697
2698
|
return {
|
|
2698
2699
|
showPlacement,
|
|
2699
2700
|
dropdownPosition: {
|
|
@@ -5545,8 +5546,7 @@ const Popover = ({
|
|
|
5545
5546
|
overlayClassName = '',
|
|
5546
5547
|
overlayStyle = {},
|
|
5547
5548
|
onVisibleChange,
|
|
5548
|
-
getPopupContainer
|
|
5549
|
-
controlDropdownPosition
|
|
5549
|
+
getPopupContainer
|
|
5550
5550
|
}) => {
|
|
5551
5551
|
const triggerRef = useRef(null);
|
|
5552
5552
|
const popupRef = useRef(null);
|
|
@@ -5561,6 +5561,7 @@ const Popover = ({
|
|
|
5561
5561
|
popupRef,
|
|
5562
5562
|
placement,
|
|
5563
5563
|
triggerRef,
|
|
5564
|
+
children,
|
|
5564
5565
|
getPopupContainer: getPopupContainer?.(triggerRef.current)
|
|
5565
5566
|
});
|
|
5566
5567
|
useEffect(() => {
|
|
@@ -5609,10 +5610,7 @@ const Popover = ({
|
|
|
5609
5610
|
return /*#__PURE__*/cloneElement(child, {
|
|
5610
5611
|
key: index,
|
|
5611
5612
|
...{
|
|
5612
|
-
style
|
|
5613
|
-
...style,
|
|
5614
|
-
...(controlDropdownPosition || {})
|
|
5615
|
-
},
|
|
5613
|
+
style,
|
|
5616
5614
|
...childProps,
|
|
5617
5615
|
ref: triggerRef,
|
|
5618
5616
|
className: `${prefixCls}-wrapper-content`
|
|
@@ -5631,8 +5629,7 @@ const Popover = ({
|
|
|
5631
5629
|
zIndex: 1000,
|
|
5632
5630
|
position: "absolute",
|
|
5633
5631
|
...overlayStyle,
|
|
5634
|
-
...dropdownPosition
|
|
5635
|
-
...(controlDropdownPosition || {})
|
|
5632
|
+
...dropdownPosition
|
|
5636
5633
|
}
|
|
5637
5634
|
}), title && /*#__PURE__*/React.createElement("div", {
|
|
5638
5635
|
className: `${prefixCls}-title`
|