import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import cx from 'classnames';
import { useState } from 'react';
import Icon from '../Icon';
import IconButton from '../IconButton';
import './styles.scss';
export default function DropdownMenu({ list, className }) {
    const [open, setOpen] = useState(false);
    const getClassNames = cx('ds-dropdown-menu', className);
    const getOptionClassNames = (optionClassName, disabled) => cx('option', optionClassName, { disabled });
    return (_jsx("div", { className: getClassNames, children: _jsxs("div", { className: "menu", onClick: () => setOpen(!open), children: [_jsx(IconButton, { name: "drag_indicator", mode: "outlined", size: "small", active: open }), open && (_jsx("div", { className: "options", children: list.map((item, idx) => (_jsxs("div", { className: getOptionClassNames(item.className, item.disabled), onClick: () => item.onClick && item.onClick(), children: [item.icon && _jsx(Icon, { name: item.icon, size: "small" }), _jsx("span", { children: item.label })] }, idx.valueOf()))) }))] }) }));
}
