@react-aria/overlays 3.7.0 → 3.7.4
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/main.js +916 -1161
- package/dist/main.js.map +1 -1
- package/dist/module.js +916 -1115
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts +5 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +9 -9
- package/src/calculatePosition.ts +12 -4
- package/src/useCloseOnScroll.ts +3 -2
- package/src/useOverlayPosition.ts +12 -4
- package/src/useOverlayTrigger.ts +1 -1
|
@@ -42,7 +42,12 @@ interface AriaPositionProps extends PositionProps {
|
|
|
42
42
|
*/
|
|
43
43
|
shouldUpdatePosition?: boolean,
|
|
44
44
|
/** Handler that is called when the overlay should close. */
|
|
45
|
-
onClose?: () => void
|
|
45
|
+
onClose?: () => void,
|
|
46
|
+
/**
|
|
47
|
+
* The maxHeight specified for the overlay element.
|
|
48
|
+
* By default, it will take all space up to the current viewport height.
|
|
49
|
+
*/
|
|
50
|
+
maxHeight?: number
|
|
46
51
|
}
|
|
47
52
|
|
|
48
53
|
interface PositionAria {
|
|
@@ -77,7 +82,8 @@ export function useOverlayPosition(props: AriaPositionProps): PositionAria {
|
|
|
77
82
|
crossOffset = 0,
|
|
78
83
|
shouldUpdatePosition = true,
|
|
79
84
|
isOpen = true,
|
|
80
|
-
onClose
|
|
85
|
+
onClose,
|
|
86
|
+
maxHeight
|
|
81
87
|
} = props;
|
|
82
88
|
let [position, setPosition] = useState<PositionResult>({
|
|
83
89
|
position: {},
|
|
@@ -99,7 +105,8 @@ export function useOverlayPosition(props: AriaPositionProps): PositionAria {
|
|
|
99
105
|
offset,
|
|
100
106
|
crossOffset,
|
|
101
107
|
isOpen,
|
|
102
|
-
direction
|
|
108
|
+
direction,
|
|
109
|
+
maxHeight
|
|
103
110
|
];
|
|
104
111
|
|
|
105
112
|
let updatePosition = useCallback(() => {
|
|
@@ -117,7 +124,8 @@ export function useOverlayPosition(props: AriaPositionProps): PositionAria {
|
|
|
117
124
|
shouldFlip,
|
|
118
125
|
boundaryElement,
|
|
119
126
|
offset,
|
|
120
|
-
crossOffset
|
|
127
|
+
crossOffset,
|
|
128
|
+
maxHeight
|
|
121
129
|
})
|
|
122
130
|
);
|
|
123
131
|
}, deps);
|
package/src/useOverlayTrigger.ts
CHANGED
|
@@ -40,7 +40,7 @@ export function useOverlayTrigger(props: OverlayTriggerProps, state: OverlayTrig
|
|
|
40
40
|
// Backward compatibility. Share state close function with useOverlayPosition so it can close on scroll
|
|
41
41
|
// without forcing users to pass onClose.
|
|
42
42
|
useEffect(() => {
|
|
43
|
-
if (ref.current) {
|
|
43
|
+
if (ref && ref.current) {
|
|
44
44
|
onCloseMap.set(ref.current, state.close);
|
|
45
45
|
}
|
|
46
46
|
});
|