lkd-web-kit 0.4.5 → 0.4.6
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.
|
@@ -7,14 +7,18 @@ const jsxRuntime = require('react/jsx-runtime');
|
|
|
7
7
|
const core = require('@mantine/core');
|
|
8
8
|
const reactHookForm = require('react-hook-form');
|
|
9
9
|
|
|
10
|
-
const FormButtonSubmit = ({
|
|
10
|
+
const FormButtonSubmit = ({
|
|
11
|
+
disabled,
|
|
12
|
+
disabledWhenSuccess,
|
|
13
|
+
...props
|
|
14
|
+
}) => {
|
|
11
15
|
const {
|
|
12
16
|
formState: { isSubmitting, isSubmitSuccessful }
|
|
13
17
|
} = reactHookForm.useFormContext();
|
|
14
18
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
15
19
|
core.Button,
|
|
16
20
|
{
|
|
17
|
-
disabled: disabled ?? (isSubmitSuccessful &&
|
|
21
|
+
disabled: disabled ?? (isSubmitSuccessful && disabledWhenSuccess),
|
|
18
22
|
loading: isSubmitting,
|
|
19
23
|
type: "submit",
|
|
20
24
|
...props
|
|
@@ -3,14 +3,18 @@ import { jsx } from 'react/jsx-runtime';
|
|
|
3
3
|
import { Button } from '@mantine/core';
|
|
4
4
|
import { useFormContext } from 'react-hook-form';
|
|
5
5
|
|
|
6
|
-
const FormButtonSubmit = ({
|
|
6
|
+
const FormButtonSubmit = ({
|
|
7
|
+
disabled,
|
|
8
|
+
disabledWhenSuccess,
|
|
9
|
+
...props
|
|
10
|
+
}) => {
|
|
7
11
|
const {
|
|
8
12
|
formState: { isSubmitting, isSubmitSuccessful }
|
|
9
13
|
} = useFormContext();
|
|
10
14
|
return /* @__PURE__ */ jsx(
|
|
11
15
|
Button,
|
|
12
16
|
{
|
|
13
|
-
disabled: disabled ?? (isSubmitSuccessful &&
|
|
17
|
+
disabled: disabled ?? (isSubmitSuccessful && disabledWhenSuccess),
|
|
14
18
|
loading: isSubmitting,
|
|
15
19
|
type: "submit",
|
|
16
20
|
...props
|
package/dist/index.d.ts
CHANGED
|
@@ -106,7 +106,7 @@ export declare const Form: <T extends FieldValues, TContext = any, TT extends T
|
|
|
106
106
|
|
|
107
107
|
export declare function formatBytes(bytes: number, decimals?: number): string;
|
|
108
108
|
|
|
109
|
-
export declare const FormButtonSubmit: ({ disabled, ...props }: FormButtonSubmitProps) => JSX.Element;
|
|
109
|
+
export declare const FormButtonSubmit: ({ disabled, disabledWhenSuccess, ...props }: FormButtonSubmitProps) => JSX.Element;
|
|
110
110
|
|
|
111
111
|
export declare interface FormButtonSubmitProps extends ButtonProps, ElementProps<'button', keyof ButtonProps> {
|
|
112
112
|
disabledWhenSuccess?: boolean;
|