/** @license MIT | @cube-dev/ui-kit v0.0.0-canary-b04eed0 | Cube Dev Team */
import { useProviderProps } from "../../../../provider.js";
import { Button } from "../../../actions/Button/Button.js";
import { useFormProps } from "../Form.js";
import { forwardRef } from "react";
import { jsx } from "react/jsx-runtime";

//#region src/components/form/Form/SubmitButton/SubmitButton.tsx
function SubmitButton(props, ref) {
	const providerProps = useProviderProps({});
	props = useFormProps(props);
	const { isDisabled: isContextDisabled } = providerProps;
	props = useFormProps(props);
	const { form, isDisabled, ...otherProps } = props;
	const isSomethingDisabled = isDisabled || isContextDisabled;
	return /* @__PURE__ */ jsx(Button, {
		ref,
		type: "primary",
		htmlType: "submit",
		isLoading: form?.isSubmitting,
		isDisabled: isSomethingDisabled || form?.isSubmitting ? true : form?.isInvalid,
		...otherProps
	});
}
const _SubmitButton = forwardRef(SubmitButton);
_SubmitButton.displayName = "SubmitButton";

//#endregion
export { _SubmitButton };
//# sourceMappingURL=SubmitButton.js.map