import React from 'react';
import DropdownPopupItem from './Item';
import { AppDropdownWrapperDiv } from './styled';
const AppDropdown = (props, ref) => {
    const { list, value, onClick, uniqueFields, style } = props;
    const attrs = {};
    if (Object.keys(ref).length) {
        attrs.ref = ref;
    }
    return (React.createElement(AppDropdownWrapperDiv, Object.assign({ style: style }, attrs), list &&
        list.map((item) => (React.createElement(DropdownPopupItem, Object.assign({}, item, { key: item.id || Math.random(), isActive: !!(item.value && item.value === value), onClick: onClick || item.onClick, uniqueField: uniqueFields ? uniqueFields[item.id] : '' }))))));
};
export default AppDropdown;
