@ -28,6 +28,7 @@ class PrivacyDropdownMenu extends React.PureComponent {
style : PropTypes . object ,
style : PropTypes . object ,
items : PropTypes . array . isRequired ,
items : PropTypes . array . isRequired ,
value : PropTypes . string . isRequired ,
value : PropTypes . string . isRequired ,
placement : PropTypes . string . isRequired ,
onClose : PropTypes . func . isRequired ,
onClose : PropTypes . func . isRequired ,
onChange : PropTypes . func . isRequired ,
onChange : PropTypes . func . isRequired ,
} ;
} ;
@ -119,7 +120,7 @@ class PrivacyDropdownMenu extends React.PureComponent {
render ( ) {
render ( ) {
const { mounted } = this . state ;
const { mounted } = this . state ;
const { style , items , value } = this . props ;
const { style , items , placement , value } = this . props ;
return (
return (
< Motion defaultStyle = { { opacity : 0 , scaleX : 0.85 , scaleY : 0.75 } } style = { { opacity : spring ( 1 , { damping : 35 , stiffness : 400 } ) , scaleX : spring ( 1 , { damping : 35 , stiffness : 400 } ) , scaleY : spring ( 1 , { damping : 35 , stiffness : 400 } ) } } >
< Motion defaultStyle = { { opacity : 0 , scaleX : 0.85 , scaleY : 0.75 } } style = { { opacity : spring ( 1 , { damping : 35 , stiffness : 400 } ) , scaleX : spring ( 1 , { damping : 35 , stiffness : 400 } ) , scaleY : spring ( 1 , { damping : 35 , stiffness : 400 } ) } } >
@ -127,7 +128,7 @@ class PrivacyDropdownMenu extends React.PureComponent {
// It should not be transformed when mounting because the resulting
// It should not be transformed when mounting because the resulting
// size will be used to determine the coordinate of the menu by
// size will be used to determine the coordinate of the menu by
// react-overlays
// react-overlays
< div className = 'privacy-dropdown__dropdown' style = { { ... style , opacity : opacity , transform : mounted ? ` scale( ${ scaleX } , ${ scaleY } ) ` : null } } role = 'listbox' ref = { this . setRef } >
< div className = { ` privacy-dropdown__dropdown ${ placement } ` } style = { { ... style , opacity : opacity , transform : mounted ? ` scale( ${ scaleX } , ${ scaleY } ) ` : null } } role = 'listbox' ref = { this . setRef } >
{ items . map ( item => (
{ items . map ( item => (
< div role = 'option' tabIndex = '0' key = { item . value } data - index = { item . value } onKeyDown = { this . handleKeyDown } onClick = { this . handleClick } className = { classNames ( 'privacy-dropdown__option' , { active : item . value === value } ) } aria - selected = { item . value === value } ref = { item . value === value ? this . setFocusRef : null } >
< div role = 'option' tabIndex = '0' key = { item . value } data - index = { item . value } onKeyDown = { this . handleKeyDown } onClick = { this . handleClick } className = { classNames ( 'privacy-dropdown__option' , { active : item . value === value } ) } aria - selected = { item . value === value } ref = { item . value === value ? this . setFocusRef : null } >
< div className = 'privacy-dropdown__option__icon' >
< div className = 'privacy-dropdown__option__icon' >
@ -226,7 +227,7 @@ export default class PrivacyDropdown extends React.PureComponent {
const valueOption = this . options . find ( item => item . value === value ) ;
const valueOption = this . options . find ( item => item . value === value ) ;
return (
return (
< div className = { classNames ( 'privacy-dropdown' , { active : open } ) } onKeyDown = { this . handleKeyDown } >
< div className = { classNames ( 'privacy-dropdown' , placement , { active : open } ) } onKeyDown = { this . handleKeyDown } >
< div className = { classNames ( 'privacy-dropdown__value' , { active : this . options . indexOf ( valueOption ) === 0 } ) } >
< div className = { classNames ( 'privacy-dropdown__value' , { active : this . options . indexOf ( valueOption ) === 0 } ) } >
< IconButton
< IconButton
className = 'privacy-dropdown__value-icon'
className = 'privacy-dropdown__value-icon'
@ -247,6 +248,7 @@ export default class PrivacyDropdown extends React.PureComponent {
value = { value }
value = { value }
onClose = { this . handleClose }
onClose = { this . handleClose }
onChange = { this . handleChange }
onChange = { this . handleChange }
placement = { placement }
/ >
/ >
< / O v e r l a y >
< / O v e r l a y >
< / d i v >
< / d i v >