'use client';
import React, { forwardRef } from 'react';
import { Button } from '../../elements/Button/index.js';
import { useForm, useFormProcessing } from '../Form/context.js';
const baseClass = 'form-submit';
const FormSubmit = /*#__PURE__*/ forwardRef((props, ref)=>{
    const { buttonId: id, children, disabled: disabledFromProps, type = 'submit' } = props;
    const processing = useFormProcessing();
    const { disabled } = useForm();
    const canSave = !(disabledFromProps || processing || disabled);
    return /*#__PURE__*/ React.createElement("div", {
        className: baseClass
    }, /*#__PURE__*/ React.createElement(Button, {
        ref: ref,
        ...props,
        disabled: canSave ? undefined : true,
        id: id,
        type: type
    }, children));
});
export default FormSubmit;

//# sourceMappingURL=index.js.map