muffin-admin 3.7.2 → 3.7.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -79,5 +79,5 @@ export function CommonPayload({ active, onClose, onHandle, schema, title }) {
79
79
  },
80
80
  record: {},
81
81
  });
82
- return (_jsx(AdminModal, { maxWidth: "sm", open: active, onClose: onClose, title: translate(title, { _: title }), children: _jsx(FormProvider, Object.assign({}, form, { children: _jsx(FormGroupsProvider, { children: _jsxs("form", { onSubmit: formHandleSubmit, children: [inputs, _jsx(PayloadButtons, { onClose: onClose })] }) }) })) }));
82
+ return (_jsx(FormProvider, Object.assign({}, form, { children: _jsx(FormGroupsProvider, { children: _jsx(AdminModal, { maxWidth: "sm", open: active, onClose: onClose, title: translate(title, { _: title }), actions: _jsx(PayloadButtons, { onClose: onClose, onSubmit: formHandleSubmit, isValid: form.formState.isValid }), children: inputs }) }) })));
83
83
  }
@@ -1,3 +1,5 @@
1
- export declare function PayloadButtons({ onClose }: {
2
- onClose: any;
1
+ export declare function PayloadButtons({ onClose, onSubmit, isValid, }: {
2
+ onClose: () => void;
3
+ onSubmit?: (e: any) => void;
4
+ isValid: boolean;
3
5
  }): import("react/jsx-runtime").JSX.Element;
@@ -1,8 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Stack } from "@mui/material";
3
3
  import { Button } from "react-admin";
4
- import { useFormContext } from "react-hook-form";
5
- export function PayloadButtons({ onClose }) {
6
- const { formState } = useFormContext();
7
- return (_jsxs(Stack, { direction: "row", alignItems: "center", justifyContent: "flex-end", spacing: 1, children: [_jsx(Button, { type: "submit", label: "ra.action.confirm", variant: "contained", disabled: !formState.isValid, size: "medium" }), _jsx(Button, { label: "ra.action.cancel", variant: "outlined", size: "medium", onClick: onClose })] }));
4
+ export function PayloadButtons({ onClose, onSubmit, isValid = true, }) {
5
+ return (_jsxs(Stack, { direction: "row", alignItems: "center", justifyContent: "flex-end", spacing: 1, children: [_jsx(Button, { label: "ra.action.confirm", variant: "contained", disabled: !isValid, size: "medium", onClick: onSubmit }), _jsx(Button, { label: "ra.action.cancel", variant: "outlined", size: "medium", onClick: onClose })] }));
8
6
  }