@@ -9,7 +9,7 @@ import {useCombinedRefs} from './hooks/useCombinedRefs'
99
1010type StyledOverlayProps = {
1111 width ?: keyof typeof widthMap
12- height ?: string
12+ height ?: keyof typeof heightMap
1313 visibility ?: 'visible' | 'hidden'
1414}
1515
@@ -39,7 +39,7 @@ const StyledOverlay = styled.div<StyledOverlayProps & SystemCommonProps & System
3939 position: absolute;
4040 min-width: 192px;
4141 max-width: 640px;
42- height: ${ props => props . height } ;
42+ height: ${ props => heightMap [ props . height || 'auto' ] } ;
4343 width: ${ props => widthMap [ props . width || 'auto' ] } ;
4444 border-radius: 12px;
4545 overflow: hidden;
@@ -69,9 +69,8 @@ export type OverlayProps = {
6969 onClickOutside : ( e : TouchOrMouseEvent ) => void
7070 onEscape : ( e : KeyboardEvent ) => void
7171 visibility ?: 'visible' | 'hidden'
72- height ?: keyof typeof heightMap
7372 [ additionalKey : string ] : unknown
74- } & Omit < ComponentProps < typeof StyledOverlay > , 'height' | ' visibility' | keyof SystemPositionProps >
73+ } & Omit < ComponentProps < typeof StyledOverlay > , 'visibility' | keyof SystemPositionProps >
7574
7675/**
7776 * An `Overlay` is a flexible floating surface, used to display transient content such as menus,
@@ -96,7 +95,7 @@ const Overlay = React.forwardRef<HTMLDivElement, OverlayProps>(
9695 ignoreClickRefs,
9796 onEscape,
9897 visibility,
99- height : heightKey ,
98+ height,
10099 ...rest
101100 } ,
102101 forwardedRef
@@ -114,11 +113,10 @@ const Overlay = React.forwardRef<HTMLDivElement, OverlayProps>(
114113 } )
115114
116115 useEffect ( ( ) => {
117- if ( heightKey === 'initial' && combinedRef . current ?. clientHeight ) {
116+ if ( height === 'initial' && combinedRef . current ?. clientHeight ) {
118117 combinedRef . current . style . height = `${ combinedRef . current . clientHeight } px`
119118 }
120- } , [ heightKey , combinedRef ] )
121- const height = heightMap [ heightKey || 'auto' ]
119+ } , [ height , combinedRef ] )
122120
123121 return (
124122 < Portal >
0 commit comments