@@ -120,6 +120,7 @@ export const Dropdown = withDropdownVariation(
120
120
} ) ;
121
121
const [ visible , setVisible ] = useState ( false ) ;
122
122
const [ offset , setOffset ] = useState < { x ?: number ; y ?: number } > ( { } ) ;
123
+ const [ direction , setDirection ] = useState < 'bottom' | 'top' > ( position . startsWith ( 'top' ) ? 'top' : 'bottom' ) ;
123
124
const [ containerHeight , setContainerHeight ] = useState < number > ( ) ;
124
125
const [ contentHeight , setContentHeight ] = useState < number > ( ) ;
125
126
@@ -191,6 +192,14 @@ export const Dropdown = withDropdownVariation(
191
192
) ;
192
193
193
194
setOffset ( { x : offsetX , y : offsetY } ) ;
195
+
196
+ if ( offsetY > 0 ) {
197
+ setDirection ( 'bottom' ) ;
198
+ }
199
+
200
+ if ( offsetY < 0 ) {
201
+ setDirection ( 'top' ) ;
202
+ }
194
203
}
195
204
196
205
setContentHeight ( height ) ;
@@ -236,8 +245,9 @@ export const Dropdown = withDropdownVariation(
236
245
< Transition
237
246
animation = { {
238
247
opacity : visible ? 1 : 0 ,
248
+ scale : visible ? 1 : 0.95 ,
239
249
} }
240
- duration = { 200 }
250
+ duration = { 150 }
241
251
>
242
252
< OverlayBox
243
253
open = { isOpen }
@@ -251,7 +261,7 @@ export const Dropdown = withDropdownVariation(
251
261
< Box
252
262
backgroundColor = "surface2"
253
263
py = { isDefined ( py ) ? py : CONTENT_PADDING }
254
- elevationLevel = { 4 }
264
+ elevationLevel = { 2 }
255
265
rounded = "md"
256
266
minWidth = { [ 280 , 280 , 240 ] }
257
267
pb = { pb }
@@ -262,11 +272,14 @@ export const Dropdown = withDropdownVariation(
262
272
animation = {
263
273
visible
264
274
? {
275
+ y : direction === 'bottom' ? 0 : 0 ,
265
276
height : contentHeight ,
266
277
}
267
- : { }
278
+ : {
279
+ y : direction === 'bottom' ? - 8 : 8 ,
280
+ }
268
281
}
269
- duration = { 200 }
282
+ duration = { 150 }
270
283
>
271
284
< Box overflow = "hidden" height = { contentHeight } >
272
285
< Box onLayout = { handleContentResize } flexShrink = { 0 } data-testid = { testId } >
@@ -295,6 +308,7 @@ export const Dropdown = withDropdownVariation(
295
308
pb = { bottomSheetPaddingBottom }
296
309
width = "100%"
297
310
maxHeight = { viewportHeight - BOTTOM_SHEET_MIN_TOP_MARGIN }
311
+ elevationLevel = { 3 }
298
312
backgroundColor = "surface2"
299
313
roundedTopLeft = "xxl"
300
314
roundedTopRight = "xxl"
0 commit comments