"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Toggle = void 0;
const tslib_1 = require("tslib");
const React = tslib_1.__importStar(require("react"));
const Icon_1 = require("../Icon");
const join_1 = tslib_1.__importDefault(require("../utils/join"));
const Toggle = ({ onPressedChange, pressed, icon, children, ...rest }) => {
    const baseClassName = 'ab-Toggle';
    return (React.createElement("button", { ...rest, className: (0, join_1.default)(baseClassName, pressed && `${baseClassName}--pressed`), onClick: () => onPressedChange(!pressed) },
        icon && React.createElement(Icon_1.IconComponent, { icon: { name: icon } }),
        children));
};
exports.Toggle = Toggle;
