muffin-admin 3.7.3 → 3.8.0

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "muffin-admin",
3
- "version": "3.7.3",
3
+ "version": "3.8.0",
4
4
  "description": "NPM package for https://github.com/klen/muffin-admin",
5
5
  "files": [
6
6
  "src",
@@ -123,7 +123,13 @@ export function CommonPayload({ active, onClose, onHandle, schema, title }) {
123
123
  open={active}
124
124
  onClose={onClose}
125
125
  title={translate(title, { _: title })}
126
- actions={<PayloadButtons onClose={onClose} onSubmit={formHandleSubmit} />}
126
+ actions={
127
+ <PayloadButtons
128
+ onClose={onClose}
129
+ onSubmit={formHandleSubmit}
130
+ isValid={form.formState.isValid}
131
+ />
132
+ }
127
133
  >
128
134
  {inputs}
129
135
  </AdminModal>
@@ -1,15 +1,21 @@
1
1
  import { Stack } from "@mui/material"
2
2
  import { Button } from "react-admin"
3
- import { useFormContext } from "react-hook-form"
4
3
 
5
- export function PayloadButtons({ onClose, onSubmit }) {
6
- const { formState } = useFormContext()
4
+ export function PayloadButtons({
5
+ onClose,
6
+ onSubmit,
7
+ isValid = true,
8
+ }: {
9
+ onClose: () => void
10
+ onSubmit?: (e: any) => void
11
+ isValid: boolean
12
+ }) {
7
13
  return (
8
14
  <Stack direction="row" alignItems="center" justifyContent="flex-end" spacing={1}>
9
15
  <Button
10
16
  label="ra.action.confirm"
11
17
  variant="contained"
12
- disabled={!formState.isValid}
18
+ disabled={!isValid}
13
19
  size="medium"
14
20
  onClick={onSubmit}
15
21
  />