import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { SoftToggle, TOGGLE_TYPES } from '../Toggle';
import { SoftButton } from '../Button';
export const SoftButtonToggle = ({ className, color, isDisabled, isEmpty, isIconOnly, isSelected, label, name, onChange, toggleClassName, type, value, ...rest }) => {
    const classes = classNames('softButtonToggle', {
        'softButtonToggle--isIconOnly': isIconOnly,
        'softButtonToggle--isEmpty': isEmpty,
    }, className);
    const wrapperClasses = classNames('softButtonToggle__wrapper', {
        'softButtonToggle--isDisabled': isDisabled,
    }, toggleClassName);
    const buttonContent = isIconOnly ? '' : label;
    return (React.createElement(SoftToggle, { className: wrapperClasses, inputClassName: "softButtonToggle__input", checked: isSelected, isDisabled: isDisabled, label: label, name: name, onChange: onChange, type: type, title: label, value: value },
        React.createElement(SoftButton, Object.assign({ tabIndex: "-1" // prevents double focus from input to button
            , className: classes, color: color, disabled: isDisabled, size: isIconOnly ? 's' : undefined }, rest), buttonContent)));
};
// @ts-ignore
SoftButtonToggle.propTypes = {
    className: PropTypes.string,
    /**
     * Button label, which is also passed to `SoftToggle` as the input's label
     */
    label: PropTypes.string.isRequired,
    onChange: PropTypes.func,
    /**
     * See `SoftButton`
     */
    color: PropTypes.string,
    isDisabled: PropTypes.bool,
    /**
     * Hides the label from the button content and only displays the icon
     */
    isIconOnly: PropTypes.bool,
    /**
     * Simulates a `SoftButtonEmpty`
     */
    isEmpty: PropTypes.bool,
    /**
     * Initial state of the toggle
     */
    isSelected: PropTypes.bool,
    /**
     * Classnames to add to `SoftToggle` instead of the `SoftButton`
     */
    toggleClassName: PropTypes.string,
    /**
     * Is the button a single action or part of a group (multi)?
     * Used primarily for `SoftButtonGroup`
     */
    type: PropTypes.oneOf(TOGGLE_TYPES),
};
// @ts-ignore
SoftButtonToggle.defaultProps = {
    color: 'primary',
};
//# sourceMappingURL=SoftButtonToggle.js.map