"use strict";
var __rest = (this && this.__rest) || function (s, e) {
    var t = {};
    for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
        t[p] = s[p];
    if (s != null && typeof Object.getOwnPropertySymbols === "function")
        for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
            if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
                t[p[i]] = s[p[i]];
        }
    return t;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.DataToolbarToggleButton = void 0;
const react_1 = __importDefault(require("react"));
const button_1 = require("../../../button");
const helpers_1 = require("../../../utils/helpers");
const hooks_1 = require("../../../utils/hooks");
const DataToolbarToggleButton = react_1.default.forwardRef((_a, ref) => {
    var { className, isPressed, defaultPressed = false, onPressChange, onClick } = _a, props = __rest(_a, ["className", "isPressed", "defaultPressed", "onPressChange", "onClick"]);
    const [pressed, setPressed] = (0, hooks_1.useControllableState)({
        defaultValue: defaultPressed,
        value: isPressed,
        onChange: onPressChange,
    });
    return (react_1.default.createElement(button_1.Button, Object.assign({ className: (0, helpers_1.cl)("aksel-data-toolbar__toggle-button", className), ref: ref }, props, { variant: "secondary", size: "small", "data-color": "neutral", "aria-pressed": pressed, onClick: (0, helpers_1.composeEventHandlers)(onClick, () => setPressed((oldState) => !oldState)) })));
});
exports.DataToolbarToggleButton = DataToolbarToggleButton;
exports.default = DataToolbarToggleButton;
//# sourceMappingURL=DataToolbarToggleButton.js.map