import * as React from 'react';
import { IconComponent } from '../Icon';
import join from '../utils/join';
export const Toggle = ({ onPressedChange, pressed, icon, children, ...rest }) => {
    const baseClassName = 'ab-Toggle';
    return (React.createElement("button", { ...rest, className: join(baseClassName, pressed && `${baseClassName}--pressed`), onClick: () => onPressedChange(!pressed) },
        icon && React.createElement(IconComponent, { icon: { name: icon } }),
        children));
};
