import React from 'react';
import ReactDOM from 'react-dom';
import SplitButton from '..';
const { Item } = SplitButton;
const menu = ['Undo', 'Redo', 'Cut', 'Copy', 'Paste'].map(item => (React.createElement(Item, { key: item }, item)));
class CompositeSplitButton extends React.Component {
    constructor(props) {
        super(props);
        this.onSelect = val => {
            this.setState({
                visible: false,
                label: val,
            });
        };
        this.changeVisible = visible => {
            this.setState({
                visible,
            });
        };
        this.state = {
            visible: false,
            label: 'Choose Action',
        };
    }
    render() {
        const { visible, label } = this.state;
        return (React.createElement(SplitButton, { label: label, visible: visible, onVisibleChange: this.changeVisible, onItemClick: this.onSelect, type: "secondary" }, menu));
    }
}
ReactDOM.render(React.createElement(CompositeSplitButton, null), document.getElementById('split-button-demo-3'));
