'use strict';

var _extends = require('../../../@babel/runtime/helpers/esm/extends.js');
var React = require('react');
var index$2 = require('../external/@radix-ui/primitive/dist/index.js');
var index = require('../../react-use-controllable-state/dist/index.js');
var index$1 = require('../external/@radix-ui/react-primitive/dist/index.js');

const $b3bbe2732c13b576$export$bea8ebba691c5813 = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
    const { pressed: pressedProp , defaultPressed: defaultPressed = false , onPressedChange: onPressedChange , ...buttonProps } = props;
    const [pressed = false, setPressed] = index.useControllableState({
        prop: pressedProp,
        onChange: onPressedChange,
        defaultProp: defaultPressed
    });
    return /*#__PURE__*/ React.createElement(index$1.Primitive.button, _extends({
        type: "button",
        "aria-pressed": pressed,
        "data-state": pressed ? 'on' : 'off',
        "data-disabled": props.disabled ? '' : undefined
    }, buttonProps, {
        ref: forwardedRef,
        onClick: index$2.composeEventHandlers(props.onClick, ()=>{
            if (!props.disabled) setPressed(!pressed);
        })
    }));
});

exports.Toggle = $b3bbe2732c13b576$export$bea8ebba691c5813;
//# sourceMappingURL=index.js.map
