@mittwald/flow-react-components 0.2.0-alpha.679 → 0.2.0-alpha.680
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/CHANGELOG.md +6 -0
- package/dist/assets/doc-properties.json +2496 -2334
- package/dist/js/components/src/integrations/react-hook-form/components/FormAction/FormAction.mjs +19 -0
- package/dist/js/components/src/integrations/react-hook-form/components/FormAction/FormAction.mjs.map +1 -0
- package/dist/js/components/src/integrations/react-hook-form/components/FormAction/FormResetAction.mjs +35 -0
- package/dist/js/components/src/integrations/react-hook-form/components/FormAction/FormResetAction.mjs.map +1 -0
- package/dist/js/components/src/integrations/react-hook-form/components/FormAction/FormSubmitAction.mjs +45 -0
- package/dist/js/components/src/integrations/react-hook-form/components/FormAction/FormSubmitAction.mjs.map +1 -0
- package/dist/js/components/src/integrations/react-hook-form/components/FormContextProvider/FormContextProvider.mjs +5 -6
- package/dist/js/components/src/integrations/react-hook-form/components/FormContextProvider/FormContextProvider.mjs.map +1 -1
- package/dist/js/components/src/integrations/react-hook-form/components/FormContextProvider/useFormSubmitAction.mjs +23 -24
- package/dist/js/components/src/integrations/react-hook-form/components/FormContextProvider/useFormSubmitAction.mjs.map +1 -1
- package/dist/js/components/src/integrations/react-hook-form/components/FormContextProvider/useUpdateReadOnly.mjs +14 -0
- package/dist/js/components/src/integrations/react-hook-form/components/FormContextProvider/useUpdateReadOnly.mjs.map +1 -0
- package/dist/js/components/src/integrations/react-hook-form/components/ResetButton/ResetButton.mjs +2 -20
- package/dist/js/components/src/integrations/react-hook-form/components/ResetButton/ResetButton.mjs.map +1 -1
- package/dist/js/components/src/integrations/react-hook-form/components/SubmitButton/SubmitButton.mjs +3 -15
- package/dist/js/components/src/integrations/react-hook-form/components/SubmitButton/SubmitButton.mjs.map +1 -1
- package/dist/js/react-hook-form.mjs +1 -0
- package/dist/js/react-hook-form.mjs.map +1 -1
- package/dist/types/integrations/react-hook-form/components/FormAction/FormAction.d.ts +10 -0
- package/dist/types/integrations/react-hook-form/components/FormAction/FormAction.d.ts.map +1 -0
- package/dist/types/integrations/react-hook-form/components/FormAction/FormResetAction.d.ts +6 -0
- package/dist/types/integrations/react-hook-form/components/FormAction/FormResetAction.d.ts.map +1 -0
- package/dist/types/integrations/react-hook-form/components/FormAction/FormSubmitAction.d.ts +6 -0
- package/dist/types/integrations/react-hook-form/components/FormAction/FormSubmitAction.d.ts.map +1 -0
- package/dist/types/integrations/react-hook-form/components/FormAction/index.d.ts +2 -0
- package/dist/types/integrations/react-hook-form/components/FormAction/index.d.ts.map +1 -0
- package/dist/types/integrations/react-hook-form/components/FormContextProvider/FormContextProvider.d.ts +1 -2
- package/dist/types/integrations/react-hook-form/components/FormContextProvider/FormContextProvider.d.ts.map +1 -1
- package/dist/types/integrations/react-hook-form/components/FormContextProvider/useFormSubmitAction.d.ts +3 -9
- package/dist/types/integrations/react-hook-form/components/FormContextProvider/useFormSubmitAction.d.ts.map +1 -1
- package/dist/types/integrations/react-hook-form/components/FormContextProvider/useUpdateReadOnly.d.ts +8 -0
- package/dist/types/integrations/react-hook-form/components/FormContextProvider/useUpdateReadOnly.d.ts.map +1 -0
- package/dist/types/integrations/react-hook-form/components/ResetButton/ResetButton.d.ts.map +1 -1
- package/dist/types/integrations/react-hook-form/components/SubmitButton/SubmitButton.d.ts +4 -1
- package/dist/types/integrations/react-hook-form/components/SubmitButton/SubmitButton.d.ts.map +1 -1
- package/dist/types/integrations/react-hook-form/index.d.ts +1 -0
- package/dist/types/integrations/react-hook-form/index.d.ts.map +1 -1
- package/package.json +4 -4
- package/dist/js/components/src/integrations/react-hook-form/components/FormSubmitAction/FormSubmitAction.mjs +0 -17
- package/dist/js/components/src/integrations/react-hook-form/components/FormSubmitAction/FormSubmitAction.mjs.map +0 -1
- package/dist/types/integrations/react-hook-form/components/FormSubmitAction/FormSubmitAction.d.ts +0 -4
- package/dist/types/integrations/react-hook-form/components/FormSubmitAction/FormSubmitAction.d.ts.map +0 -1
- package/dist/types/integrations/react-hook-form/components/FormSubmitAction/index.d.ts +0 -2
- package/dist/types/integrations/react-hook-form/components/FormSubmitAction/index.d.ts.map +0 -1
package/dist/js/components/src/integrations/react-hook-form/components/FormAction/FormAction.mjs
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
/* */
|
|
3
|
+
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
4
|
+
import { FormResetAction } from './FormResetAction.mjs';
|
|
5
|
+
import { FormSubmitAction } from './FormSubmitAction.mjs';
|
|
6
|
+
|
|
7
|
+
const FormAction = (props) => {
|
|
8
|
+
const { children, reset, submit, ...actionProps } = props;
|
|
9
|
+
if (submit) {
|
|
10
|
+
return /* @__PURE__ */ jsx(FormSubmitAction, { ...actionProps, children });
|
|
11
|
+
}
|
|
12
|
+
if (reset) {
|
|
13
|
+
return /* @__PURE__ */ jsx(FormResetAction, { ...actionProps, children });
|
|
14
|
+
}
|
|
15
|
+
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export { FormAction, FormAction as default };
|
|
19
|
+
//# sourceMappingURL=FormAction.mjs.map
|
package/dist/js/components/src/integrations/react-hook-form/components/FormAction/FormAction.mjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormAction.mjs","sources":["../../../../../../../../src/integrations/react-hook-form/components/FormAction/FormAction.tsx"],"sourcesContent":["import type { ActionProps } from \"@/components/Action/types\";\nimport { FormResetAction } from \"@/integrations/react-hook-form/components/FormAction/FormResetAction\";\nimport FormSubmitAction from \"@/integrations/react-hook-form/components/FormAction/FormSubmitAction\";\nimport type { FC, PropsWithChildren } from \"react\";\n\ntype SupportedActionProps = Pick<ActionProps, \"showFeedback\">;\n\nexport interface FormActionProps\n extends PropsWithChildren, SupportedActionProps {\n reset?: boolean;\n submit?: boolean;\n}\n\nexport const FormAction: FC<FormActionProps> = (props) => {\n const { children, reset, submit, ...actionProps } = props;\n\n if (submit) {\n return <FormSubmitAction {...actionProps}>{children}</FormSubmitAction>;\n }\n\n if (reset) {\n return <FormResetAction {...actionProps}>{children}</FormResetAction>;\n }\n\n return <>{children}</>;\n};\n\nexport default FormAction;\n"],"names":[],"mappings":";;;;AAaO,MAAM,UAAA,GAAkC,CAAC,KAAA,KAAU;AACxD,EAAA,MAAM,EAAE,QAAA,EAAU,KAAA,EAAO,MAAA,EAAQ,GAAG,aAAY,GAAI,KAAA;AAEpD,EAAA,IAAI,MAAA,EAAQ;AACV,IAAA,uBAAO,GAAA,CAAC,gBAAA,EAAA,EAAkB,GAAG,WAAA,EAAc,QAAA,EAAS,CAAA;AAAA,EACtD;AAEA,EAAA,IAAI,KAAA,EAAO;AACT,IAAA,uBAAO,GAAA,CAAC,eAAA,EAAA,EAAiB,GAAG,WAAA,EAAc,QAAA,EAAS,CAAA;AAAA,EACrD;AAEA,EAAA,uCAAU,QAAA,EAAS,CAAA;AACrB;;;;"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
/* */
|
|
3
|
+
import { jsx } from 'react/jsx-runtime';
|
|
4
|
+
import { Action } from '../../../../components/Action/Action.mjs';
|
|
5
|
+
import 'react-aria';
|
|
6
|
+
import 'react';
|
|
7
|
+
import '@react-aria/live-announcer';
|
|
8
|
+
import { useFormContext } from '../FormContextProvider/FormContextProvider.mjs';
|
|
9
|
+
import '../../../../lib/propsContext/propsContext.mjs';
|
|
10
|
+
import { PropsContextProvider } from '../../../../lib/propsContext/components/PropsContextProvider.mjs';
|
|
11
|
+
|
|
12
|
+
const FormResetAction = (props) => {
|
|
13
|
+
const { children, ...actionProps } = props;
|
|
14
|
+
const { form, isReadOnly, id } = useFormContext();
|
|
15
|
+
const propsContext = {
|
|
16
|
+
Button: {
|
|
17
|
+
isReadOnly,
|
|
18
|
+
form: id,
|
|
19
|
+
color: "secondary",
|
|
20
|
+
variant: "soft",
|
|
21
|
+
type: "button"
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
return /* @__PURE__ */ jsx(Action, { onAction: () => form.reset(), ...actionProps, children: /* @__PURE__ */ jsx(
|
|
25
|
+
PropsContextProvider,
|
|
26
|
+
{
|
|
27
|
+
props: propsContext,
|
|
28
|
+
dependencies: [isReadOnly, id],
|
|
29
|
+
children
|
|
30
|
+
}
|
|
31
|
+
) });
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export { FormResetAction };
|
|
35
|
+
//# sourceMappingURL=FormResetAction.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormResetAction.mjs","sources":["../../../../../../../../src/integrations/react-hook-form/components/FormAction/FormResetAction.tsx"],"sourcesContent":["import Action, { type ActionProps } from \"@/components/Action\";\nimport { useFormContext } from \"@/integrations/react-hook-form/components/FormContextProvider\";\nimport { PropsContextProvider, type PropsContext } from \"@/lib/propsContext\";\nimport type { FC, PropsWithChildren } from \"react\";\n\ntype SupportedActionProps = Pick<ActionProps, \"showFeedback\">;\n\nexport const FormResetAction: FC<PropsWithChildren<SupportedActionProps>> = (\n props,\n) => {\n const { children, ...actionProps } = props;\n\n const { form, isReadOnly, id } = useFormContext();\n\n const propsContext: PropsContext = {\n Button: {\n isReadOnly,\n form: id,\n color: \"secondary\",\n variant: \"soft\",\n type: \"button\",\n },\n };\n\n return (\n <Action onAction={() => form.reset()} {...actionProps}>\n <PropsContextProvider\n props={propsContext}\n dependencies={[isReadOnly, id]}\n >\n {children}\n </PropsContextProvider>\n </Action>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;AAOO,MAAM,eAAA,GAA+D,CAC1E,KAAA,KACG;AACH,EAAA,MAAM,EAAE,QAAA,EAAU,GAAG,WAAA,EAAY,GAAI,KAAA;AAErC,EAAA,MAAM,EAAE,IAAA,EAAM,UAAA,EAAY,EAAA,KAAO,cAAA,EAAe;AAEhD,EAAA,MAAM,YAAA,GAA6B;AAAA,IACjC,MAAA,EAAQ;AAAA,MACN,UAAA;AAAA,MACA,IAAA,EAAM,EAAA;AAAA,MACN,KAAA,EAAO,WAAA;AAAA,MACP,OAAA,EAAS,MAAA;AAAA,MACT,IAAA,EAAM;AAAA;AACR,GACF;AAEA,EAAA,uBACE,GAAA,CAAC,UAAO,QAAA,EAAU,MAAM,KAAK,KAAA,EAAM,EAAI,GAAG,WAAA,EACxC,QAAA,kBAAA,GAAA;AAAA,IAAC,oBAAA;AAAA,IAAA;AAAA,MACC,KAAA,EAAO,YAAA;AAAA,MACP,YAAA,EAAc,CAAC,UAAA,EAAY,EAAE,CAAA;AAAA,MAE5B;AAAA;AAAA,GACH,EACF,CAAA;AAEJ;;;;"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
/* */
|
|
3
|
+
import { jsx } from 'react/jsx-runtime';
|
|
4
|
+
import { Action } from '../../../../components/Action/Action.mjs';
|
|
5
|
+
import { ActionBatch } from '../../../../components/Action/ActionBatch.mjs';
|
|
6
|
+
import 'react-aria';
|
|
7
|
+
import 'react';
|
|
8
|
+
import '@react-aria/live-announcer';
|
|
9
|
+
import { useFormContext } from '../FormContextProvider/FormContextProvider.mjs';
|
|
10
|
+
import { useFormSubmitAction } from '../FormContextProvider/useFormSubmitAction.mjs';
|
|
11
|
+
import '../../../../lib/propsContext/propsContext.mjs';
|
|
12
|
+
import { PropsContextProvider } from '../../../../lib/propsContext/components/PropsContextProvider.mjs';
|
|
13
|
+
|
|
14
|
+
const InnerFormSubmitAction = (props) => {
|
|
15
|
+
const { children, ...actionProps } = props;
|
|
16
|
+
const { form } = useFormContext();
|
|
17
|
+
const formSubmitAction = useFormSubmitAction(form.formState, actionProps);
|
|
18
|
+
return /* @__PURE__ */ jsx(Action, { actionModel: formSubmitAction, ...actionProps, children });
|
|
19
|
+
};
|
|
20
|
+
const FormSubmitAction = (props) => {
|
|
21
|
+
const { children, ...actionProps } = props;
|
|
22
|
+
const { onAfterSuccessFeedback, isReadOnly, id } = useFormContext();
|
|
23
|
+
const propsContext = {
|
|
24
|
+
Button: {
|
|
25
|
+
isReadOnly,
|
|
26
|
+
type: "submit",
|
|
27
|
+
form: id
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
const innerSubmitAction = /* @__PURE__ */ jsx(InnerFormSubmitAction, { ...actionProps, children: /* @__PURE__ */ jsx(
|
|
31
|
+
PropsContextProvider,
|
|
32
|
+
{
|
|
33
|
+
props: propsContext,
|
|
34
|
+
dependencies: [isReadOnly, id],
|
|
35
|
+
children
|
|
36
|
+
}
|
|
37
|
+
) });
|
|
38
|
+
if (onAfterSuccessFeedback) {
|
|
39
|
+
return /* @__PURE__ */ jsx(Action, { onAction: onAfterSuccessFeedback, children: /* @__PURE__ */ jsx(ActionBatch, { children: innerSubmitAction }) });
|
|
40
|
+
}
|
|
41
|
+
return innerSubmitAction;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export { FormSubmitAction, FormSubmitAction as default };
|
|
45
|
+
//# sourceMappingURL=FormSubmitAction.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormSubmitAction.mjs","sources":["../../../../../../../../src/integrations/react-hook-form/components/FormAction/FormSubmitAction.tsx"],"sourcesContent":["import Action, { ActionBatch, type ActionProps } from \"@/components/Action\";\nimport { useFormContext } from \"@/integrations/react-hook-form/components/FormContextProvider\";\nimport { useFormSubmitAction } from \"@/integrations/react-hook-form/components/FormContextProvider/useFormSubmitAction\";\nimport { PropsContextProvider, type PropsContext } from \"@/lib/propsContext\";\nimport type { FC, PropsWithChildren } from \"react\";\n\nconst InnerFormSubmitAction: FC<PropsWithChildren<SupportedActionProps>> = (\n props,\n) => {\n const { children, ...actionProps } = props;\n const { form } = useFormContext();\n const formSubmitAction = useFormSubmitAction(form.formState, actionProps);\n return (\n <Action actionModel={formSubmitAction} {...actionProps}>\n {children}\n </Action>\n );\n};\n\ntype SupportedActionProps = Pick<ActionProps, \"showFeedback\">;\n\nexport const FormSubmitAction: FC<PropsWithChildren<SupportedActionProps>> = (\n props,\n) => {\n const { children, ...actionProps } = props;\n\n const { onAfterSuccessFeedback, isReadOnly, id } = useFormContext();\n\n const propsContext: PropsContext = {\n Button: {\n isReadOnly,\n type: \"submit\",\n form: id,\n },\n };\n\n const innerSubmitAction = (\n <InnerFormSubmitAction {...actionProps}>\n <PropsContextProvider\n props={propsContext}\n dependencies={[isReadOnly, id]}\n >\n {children}\n </PropsContextProvider>\n </InnerFormSubmitAction>\n );\n\n if (onAfterSuccessFeedback) {\n return (\n <Action onAction={onAfterSuccessFeedback}>\n <ActionBatch>{innerSubmitAction}</ActionBatch>\n </Action>\n );\n }\n\n return innerSubmitAction;\n};\n\nexport default FormSubmitAction;\n"],"names":[],"mappings":";;;;;;;;;;;AAMA,MAAM,qBAAA,GAAqE,CACzE,KAAA,KACG;AACH,EAAA,MAAM,EAAE,QAAA,EAAU,GAAG,WAAA,EAAY,GAAI,KAAA;AACrC,EAAA,MAAM,EAAE,IAAA,EAAK,GAAI,cAAA,EAAe;AAChC,EAAA,MAAM,gBAAA,GAAmB,mBAAA,CAAoB,IAAA,CAAK,SAAA,EAAW,WAAW,CAAA;AACxE,EAAA,2BACG,MAAA,EAAA,EAAO,WAAA,EAAa,gBAAA,EAAmB,GAAG,aACxC,QAAA,EACH,CAAA;AAEJ,CAAA;AAIO,MAAM,gBAAA,GAAgE,CAC3E,KAAA,KACG;AACH,EAAA,MAAM,EAAE,QAAA,EAAU,GAAG,WAAA,EAAY,GAAI,KAAA;AAErC,EAAA,MAAM,EAAE,sBAAA,EAAwB,UAAA,EAAY,EAAA,KAAO,cAAA,EAAe;AAElE,EAAA,MAAM,YAAA,GAA6B;AAAA,IACjC,MAAA,EAAQ;AAAA,MACN,UAAA;AAAA,MACA,IAAA,EAAM,QAAA;AAAA,MACN,IAAA,EAAM;AAAA;AACR,GACF;AAEA,EAAA,MAAM,iBAAA,mBACJ,GAAA,CAAC,qBAAA,EAAA,EAAuB,GAAG,WAAA,EACzB,QAAA,kBAAA,GAAA;AAAA,IAAC,oBAAA;AAAA,IAAA;AAAA,MACC,KAAA,EAAO,YAAA;AAAA,MACP,YAAA,EAAc,CAAC,UAAA,EAAY,EAAE,CAAA;AAAA,MAE5B;AAAA;AAAA,GACH,EACF,CAAA;AAGF,EAAA,IAAI,sBAAA,EAAwB;AAC1B,IAAA,2BACG,MAAA,EAAA,EAAO,QAAA,EAAU,wBAChB,QAAA,kBAAA,GAAA,CAAC,WAAA,EAAA,EAAa,6BAAkB,CAAA,EAClC,CAAA;AAAA,EAEJ;AAEA,EAAA,OAAO,iBAAA;AACT;;;;"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { jsx } from 'react/jsx-runtime';
|
|
4
4
|
import { createContext, useContext, useState } from 'react';
|
|
5
5
|
import invariant from 'invariant';
|
|
6
|
-
import {
|
|
6
|
+
import { useUpdateReadOnly } from './useUpdateReadOnly.mjs';
|
|
7
7
|
|
|
8
8
|
const FormContext = createContext(
|
|
9
9
|
void 0
|
|
@@ -18,10 +18,9 @@ const FormContextProvider = (props) => {
|
|
|
18
18
|
} = props;
|
|
19
19
|
const [isReadOnlyState, setReadOnly] = useState(isReadOnlyProp);
|
|
20
20
|
const isReadOnly = isReadOnlyProp || isReadOnlyState;
|
|
21
|
-
|
|
22
|
-
form,
|
|
23
|
-
setReadOnly
|
|
24
|
-
onAfterSuccessFeedback
|
|
21
|
+
useUpdateReadOnly({
|
|
22
|
+
formState: form.formState,
|
|
23
|
+
setReadOnly
|
|
25
24
|
});
|
|
26
25
|
return /* @__PURE__ */ jsx(
|
|
27
26
|
FormContext,
|
|
@@ -31,7 +30,7 @@ const FormContextProvider = (props) => {
|
|
|
31
30
|
setReadOnly,
|
|
32
31
|
id,
|
|
33
32
|
form,
|
|
34
|
-
|
|
33
|
+
onAfterSuccessFeedback
|
|
35
34
|
},
|
|
36
35
|
children
|
|
37
36
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormContextProvider.mjs","sources":["../../../../../../../../src/integrations/react-hook-form/components/FormContextProvider/FormContextProvider.tsx"],"sourcesContent":["import type { FieldValues, UseFormReturn } from \"react-hook-form\";\nimport {\n createContext,\n useContext,\n useState,\n type Dispatch,\n type PropsWithChildren,\n type SetStateAction,\n} from \"react\";\nimport
|
|
1
|
+
{"version":3,"file":"FormContextProvider.mjs","sources":["../../../../../../../../src/integrations/react-hook-form/components/FormContextProvider/FormContextProvider.tsx"],"sourcesContent":["import type { FieldValues, UseFormReturn } from \"react-hook-form\";\nimport {\n createContext,\n useContext,\n useState,\n type Dispatch,\n type PropsWithChildren,\n type SetStateAction,\n} from \"react\";\nimport invariant from \"invariant\";\nimport type { AfterFormSubmitCallback } from \"@/integrations/react-hook-form/components/Form/Form\";\nimport { useUpdateReadOnly } from \"@/integrations/react-hook-form/components/FormContextProvider/useUpdateReadOnly\";\n\ninterface FormContext<F extends FieldValues> {\n form: UseFormReturn<F>;\n id: string;\n isReadOnly: boolean;\n setReadOnly: Dispatch<SetStateAction<boolean>>;\n onAfterSuccessFeedback?: AfterFormSubmitCallback;\n}\n\nexport const FormContext = createContext<FormContext<FieldValues> | undefined>(\n undefined,\n);\n\nexport interface FormContextProviderProps extends PropsWithChildren {\n form: UseFormReturn;\n id: string;\n isReadOnly?: boolean;\n onAfterSuccessFeedback?: AfterFormSubmitCallback;\n}\n\nexport const FormContextProvider = (props: FormContextProviderProps) => {\n const {\n form,\n id,\n isReadOnly: isReadOnlyProp = false,\n onAfterSuccessFeedback,\n children,\n } = props;\n const [isReadOnlyState, setReadOnly] = useState(isReadOnlyProp);\n const isReadOnly = isReadOnlyProp || isReadOnlyState;\n\n useUpdateReadOnly({\n formState: form.formState,\n setReadOnly,\n });\n\n return (\n <FormContext\n value={{\n isReadOnly,\n setReadOnly,\n id,\n form,\n onAfterSuccessFeedback,\n }}\n >\n {children}\n </FormContext>\n );\n};\n\nexport const useFormContext = <F extends FieldValues>() => {\n const ctx = useOptionalFormContext<F>();\n invariant(\n !!ctx,\n \"Could not useFormContext() outside a Form, or multiple versions of Flow installed.\",\n );\n return ctx;\n};\n\nexport const useOptionalFormContext = <F extends FieldValues>() =>\n useContext(FormContext) as FormContext<F> | undefined;\n\nexport default FormContextProvider;\n"],"names":[],"mappings":";;;;;AAqBO,MAAM,WAAA,GAAc,aAAA;AAAA,EACzB;AACF;AASO,MAAM,mBAAA,GAAsB,CAAC,KAAA,KAAoC;AACtE,EAAA,MAAM;AAAA,IACJ,IAAA;AAAA,IACA,EAAA;AAAA,IACA,YAAY,cAAA,GAAiB,KAAA;AAAA,IAC7B,sBAAA;AAAA,IACA;AAAA,GACF,GAAI,KAAA;AACJ,EAAA,MAAM,CAAC,eAAA,EAAiB,WAAW,CAAA,GAAI,SAAS,cAAc,CAAA;AAC9D,EAAA,MAAM,aAAa,cAAA,IAAkB,eAAA;AAErC,EAAA,iBAAA,CAAkB;AAAA,IAChB,WAAW,IAAA,CAAK,SAAA;AAAA,IAChB;AAAA,GACD,CAAA;AAED,EAAA,uBACE,GAAA;AAAA,IAAC,WAAA;AAAA,IAAA;AAAA,MACC,KAAA,EAAO;AAAA,QACL,UAAA;AAAA,QACA,WAAA;AAAA,QACA,EAAA;AAAA,QACA,IAAA;AAAA,QACA;AAAA,OACF;AAAA,MAEC;AAAA;AAAA,GACH;AAEJ;AAEO,MAAM,iBAAiB,MAA6B;AACzD,EAAA,MAAM,MAAM,sBAAA,EAA0B;AACtC,EAAA,SAAA;AAAA,IACE,CAAC,CAAC,GAAA;AAAA,IACF;AAAA,GACF;AACA,EAAA,OAAO,GAAA;AACT;AAEO,MAAM,sBAAA,GAAyB,MACpC,UAAA,CAAW,WAAW;;;;"}
|
|
@@ -1,36 +1,35 @@
|
|
|
1
1
|
"use client"
|
|
2
2
|
/* */
|
|
3
3
|
import { ActionModel } from '../../../../components/Action/models/ActionModel.mjs';
|
|
4
|
+
import { MutedActionError } from '../../../../components/Action/MutedActionError.mjs';
|
|
4
5
|
import { useRef, useEffect } from 'react';
|
|
5
6
|
|
|
6
|
-
const useFormSubmitAction = (
|
|
7
|
-
const {
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
|
|
7
|
+
const useFormSubmitAction = (formState, actionProps) => {
|
|
8
|
+
const { isSubmitting, isSubmitSuccessful } = formState;
|
|
9
|
+
const submitPromise = useRef(void 0);
|
|
10
|
+
const formSubmitAction = ActionModel.useNew({
|
|
11
|
+
...actionProps,
|
|
12
|
+
onAction: () => {
|
|
13
|
+
submitPromise.current = Promise.withResolvers();
|
|
14
|
+
actionProps?.onAction?.();
|
|
15
|
+
return submitPromise.current.promise;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
11
18
|
useEffect(() => {
|
|
12
|
-
const submittingDone = wasSubmitting.current && !isSubmitting;
|
|
13
|
-
wasSubmitting.current = isSubmitting;
|
|
14
19
|
if (isSubmitting) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
} else if (submittingDone) {
|
|
18
|
-
if (isSubmitSuccessful) {
|
|
19
|
-
formSubmitAction.state.onSucceeded().then(onAfterSuccessFeedback);
|
|
20
|
-
} else {
|
|
21
|
-
formSubmitAction.state.onFailed(new Error("Form submission failed"));
|
|
20
|
+
if (!formSubmitAction.state.isBusy) {
|
|
21
|
+
formSubmitAction.execute();
|
|
22
22
|
}
|
|
23
|
-
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
if (isSubmitSuccessful) {
|
|
26
|
+
submitPromise.current?.resolve();
|
|
27
|
+
return;
|
|
24
28
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
isSubmitSuccessful,
|
|
30
|
-
formSubmitAction,
|
|
31
|
-
setReadOnly,
|
|
32
|
-
onAfterSuccessFeedback
|
|
33
|
-
]);
|
|
29
|
+
submitPromise.current?.reject(
|
|
30
|
+
new MutedActionError("Form submission failed")
|
|
31
|
+
);
|
|
32
|
+
}, [isSubmitting, isSubmitSuccessful, submitPromise]);
|
|
34
33
|
return formSubmitAction;
|
|
35
34
|
};
|
|
36
35
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFormSubmitAction.mjs","sources":["../../../../../../../../src/integrations/react-hook-form/components/FormContextProvider/useFormSubmitAction.ts"],"sourcesContent":["import { ActionModel } from \"@/components/Action/models/ActionModel\";\nimport
|
|
1
|
+
{"version":3,"file":"useFormSubmitAction.mjs","sources":["../../../../../../../../src/integrations/react-hook-form/components/FormContextProvider/useFormSubmitAction.ts"],"sourcesContent":["import type { ActionProps } from \"@/components/Action\";\nimport { ActionModel } from \"@/components/Action/models/ActionModel\";\nimport { MutedActionError } from \"@/components/Action/MutedActionError\";\nimport { useEffect, useRef } from \"react\";\nimport type { FieldValues, FormState } from \"react-hook-form\";\n\nexport const useFormSubmitAction = (\n formState: FormState<FieldValues>,\n actionProps?: ActionProps,\n) => {\n const { isSubmitting, isSubmitSuccessful } = formState;\n\n const submitPromise = useRef<PromiseWithResolvers<void>>(undefined);\n\n const formSubmitAction = ActionModel.useNew({\n ...actionProps,\n onAction: () => {\n submitPromise.current = Promise.withResolvers<void>();\n actionProps?.onAction?.();\n return submitPromise.current.promise;\n },\n });\n\n useEffect(() => {\n if (isSubmitting) {\n if (!formSubmitAction.state.isBusy) {\n /**\n * Manually start execution. This happens if the form submission was\n * triggered by other means than the submit button, e.g. by pressing\n * Enter in a text field.\n */\n formSubmitAction.execute();\n }\n return;\n }\n\n if (isSubmitSuccessful) {\n submitPromise.current?.resolve();\n return;\n }\n\n submitPromise.current?.reject(\n new MutedActionError(\"Form submission failed\"),\n );\n }, [isSubmitting, isSubmitSuccessful, submitPromise]);\n\n return formSubmitAction;\n};\n"],"names":[],"mappings":";;;;AAMO,MAAM,mBAAA,GAAsB,CACjC,SAAA,EACA,WAAA,KACG;AACH,EAAA,MAAM,EAAE,YAAA,EAAc,kBAAA,EAAmB,GAAI,SAAA;AAE7C,EAAA,MAAM,aAAA,GAAgB,OAAmC,MAAS,CAAA;AAElE,EAAA,MAAM,gBAAA,GAAmB,YAAY,MAAA,CAAO;AAAA,IAC1C,GAAG,WAAA;AAAA,IACH,UAAU,MAAM;AACd,MAAA,aAAA,CAAc,OAAA,GAAU,QAAQ,aAAA,EAAoB;AACpD,MAAA,WAAA,EAAa,QAAA,IAAW;AACxB,MAAA,OAAO,cAAc,OAAA,CAAQ,OAAA;AAAA,IAC/B;AAAA,GACD,CAAA;AAED,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,IAAI,YAAA,EAAc;AAChB,MAAA,IAAI,CAAC,gBAAA,CAAiB,KAAA,CAAM,MAAA,EAAQ;AAMlC,QAAA,gBAAA,CAAiB,OAAA,EAAQ;AAAA,MAC3B;AACA,MAAA;AAAA,IACF;AAEA,IAAA,IAAI,kBAAA,EAAoB;AACtB,MAAA,aAAA,CAAc,SAAS,OAAA,EAAQ;AAC/B,MAAA;AAAA,IACF;AAEA,IAAA,aAAA,CAAc,OAAA,EAAS,MAAA;AAAA,MACrB,IAAI,iBAAiB,wBAAwB;AAAA,KAC/C;AAAA,EACF,CAAA,EAAG,CAAC,YAAA,EAAc,kBAAA,EAAoB,aAAa,CAAC,CAAA;AAEpD,EAAA,OAAO,gBAAA;AACT;;;;"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
/* */
|
|
3
|
+
import { useEffect } from 'react';
|
|
4
|
+
|
|
5
|
+
const useUpdateReadOnly = (options) => {
|
|
6
|
+
const { formState, setReadOnly } = options;
|
|
7
|
+
const { isSubmitting } = formState;
|
|
8
|
+
useEffect(() => {
|
|
9
|
+
setReadOnly(isSubmitting);
|
|
10
|
+
}, [isSubmitting, setReadOnly]);
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export { useUpdateReadOnly };
|
|
14
|
+
//# sourceMappingURL=useUpdateReadOnly.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useUpdateReadOnly.mjs","sources":["../../../../../../../../src/integrations/react-hook-form/components/FormContextProvider/useUpdateReadOnly.ts"],"sourcesContent":["import { useEffect } from \"react\";\nimport type { FieldValues, FormState } from \"react-hook-form\";\n\ninterface Options {\n formState: FormState<FieldValues>;\n setReadOnly: (isReadOnly: boolean) => void;\n}\n\nexport const useUpdateReadOnly = (options: Options) => {\n const { formState, setReadOnly } = options;\n\n const { isSubmitting } = formState;\n\n useEffect(() => {\n setReadOnly(isSubmitting);\n }, [isSubmitting, setReadOnly]);\n};\n"],"names":[],"mappings":";;AAQO,MAAM,iBAAA,GAAoB,CAAC,OAAA,KAAqB;AACrD,EAAA,MAAM,EAAE,SAAA,EAAW,WAAA,EAAY,GAAI,OAAA;AAEnC,EAAA,MAAM,EAAE,cAAa,GAAI,SAAA;AAEzB,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,WAAA,CAAY,YAAY,CAAA;AAAA,EAC1B,CAAA,EAAG,CAAC,YAAA,EAAc,WAAW,CAAC,CAAA;AAChC;;;;"}
|
package/dist/js/components/src/integrations/react-hook-form/components/ResetButton/ResetButton.mjs
CHANGED
|
@@ -2,29 +2,11 @@
|
|
|
2
2
|
/* */
|
|
3
3
|
import { jsx } from 'react/jsx-runtime';
|
|
4
4
|
import '../../../../components/Button/Button.mjs';
|
|
5
|
-
import {
|
|
5
|
+
import { FormAction } from '../FormAction/FormAction.mjs';
|
|
6
6
|
import ButtonView from '../../../../views/ButtonView.mjs';
|
|
7
7
|
|
|
8
8
|
const ResetButton = (props) => {
|
|
9
|
-
|
|
10
|
-
const formContext = useFormContext();
|
|
11
|
-
const isReadOnly = isReadOnlyProp || formContext.isReadOnly;
|
|
12
|
-
const handleOnPress = (e) => {
|
|
13
|
-
formContext.form.reset();
|
|
14
|
-
onPress?.(e);
|
|
15
|
-
};
|
|
16
|
-
return /* @__PURE__ */ jsx(
|
|
17
|
-
ButtonView,
|
|
18
|
-
{
|
|
19
|
-
color: "secondary",
|
|
20
|
-
variant: "soft",
|
|
21
|
-
...rest,
|
|
22
|
-
type: "button",
|
|
23
|
-
onPress: handleOnPress,
|
|
24
|
-
isReadOnly,
|
|
25
|
-
children
|
|
26
|
-
}
|
|
27
|
-
);
|
|
9
|
+
return /* @__PURE__ */ jsx(FormAction, { reset: true, children: /* @__PURE__ */ jsx(ButtonView, { ...props }) });
|
|
28
10
|
};
|
|
29
11
|
|
|
30
12
|
export { ResetButton };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResetButton.mjs","sources":["../../../../../../../../src/integrations/react-hook-form/components/ResetButton/ResetButton.tsx"],"sourcesContent":["import { type ButtonProps } from \"@/components/Button\";\nimport
|
|
1
|
+
{"version":3,"file":"ResetButton.mjs","sources":["../../../../../../../../src/integrations/react-hook-form/components/ResetButton/ResetButton.tsx"],"sourcesContent":["import { type ButtonProps } from \"@/components/Button\";\nimport FormAction from \"@/integrations/react-hook-form/components/FormAction\";\nimport ButtonView from \"@/views/ButtonView\";\nimport type { FC } from \"react\";\n\nexport const ResetButton: FC<ButtonProps> = (props) => {\n return (\n <FormAction reset>\n <ButtonView {...props} />\n </FormAction>\n );\n};\n\nexport default ResetButton;\n"],"names":[],"mappings":";;;;;AAKO,MAAM,WAAA,GAA+B,CAAC,KAAA,KAAU;AACrD,EAAA,uBACE,GAAA,CAAC,cAAW,KAAA,EAAK,IAAA,EACf,8BAAC,UAAA,EAAA,EAAY,GAAG,OAAO,CAAA,EACzB,CAAA;AAEJ;;;;"}
|
package/dist/js/components/src/integrations/react-hook-form/components/SubmitButton/SubmitButton.mjs
CHANGED
|
@@ -2,24 +2,12 @@
|
|
|
2
2
|
/* */
|
|
3
3
|
import { jsx } from 'react/jsx-runtime';
|
|
4
4
|
import '../../../../components/Button/Button.mjs';
|
|
5
|
-
import {
|
|
6
|
-
import { FormSubmitAction } from '../FormSubmitAction/FormSubmitAction.mjs';
|
|
5
|
+
import { FormAction } from '../FormAction/FormAction.mjs';
|
|
7
6
|
import ButtonView from '../../../../views/ButtonView.mjs';
|
|
8
7
|
|
|
9
8
|
const SubmitButton = (props) => {
|
|
10
|
-
const {
|
|
11
|
-
|
|
12
|
-
const isReadOnly = isReadOnlyProp || formContext.isReadOnly;
|
|
13
|
-
return /* @__PURE__ */ jsx(FormSubmitAction, { children: /* @__PURE__ */ jsx(
|
|
14
|
-
ButtonView,
|
|
15
|
-
{
|
|
16
|
-
...rest,
|
|
17
|
-
type: "submit",
|
|
18
|
-
form: formContext.id,
|
|
19
|
-
isReadOnly,
|
|
20
|
-
children
|
|
21
|
-
}
|
|
22
|
-
) });
|
|
9
|
+
const { showFeedback, ...buttonProps } = props;
|
|
10
|
+
return /* @__PURE__ */ jsx(FormAction, { submit: true, showFeedback, children: /* @__PURE__ */ jsx(ButtonView, { ...buttonProps }) });
|
|
23
11
|
};
|
|
24
12
|
|
|
25
13
|
export { SubmitButton };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SubmitButton.mjs","sources":["../../../../../../../../src/integrations/react-hook-form/components/SubmitButton/SubmitButton.tsx"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"SubmitButton.mjs","sources":["../../../../../../../../src/integrations/react-hook-form/components/SubmitButton/SubmitButton.tsx"],"sourcesContent":["import type { ActionProps } from \"@/components/Action\";\nimport { type ButtonProps } from \"@/components/Button\";\nimport FormAction from \"@/integrations/react-hook-form/components/FormAction\";\nimport ButtonView from \"@/views/ButtonView\";\nimport type { FC } from \"react\";\n\ntype SupportedActionProps = Pick<ActionProps, \"showFeedback\">;\n\nexport type SubmitButtonProps = ButtonProps & SupportedActionProps;\n\nexport const SubmitButton: FC<SubmitButtonProps> = (props) => {\n const { showFeedback, ...buttonProps } = props;\n return (\n <FormAction submit showFeedback={showFeedback}>\n <ButtonView {...buttonProps} />\n </FormAction>\n );\n};\n\nexport default SubmitButton;\n"],"names":[],"mappings":";;;;;AAUO,MAAM,YAAA,GAAsC,CAAC,KAAA,KAAU;AAC5D,EAAA,MAAM,EAAE,YAAA,EAAc,GAAG,WAAA,EAAY,GAAI,KAAA;AACzC,EAAA,uBACE,GAAA,CAAC,cAAW,MAAA,EAAM,IAAA,EAAC,cACjB,QAAA,kBAAA,GAAA,CAAC,UAAA,EAAA,EAAY,GAAG,WAAA,EAAa,CAAA,EAC/B,CAAA;AAEJ;;;;"}
|
|
@@ -5,4 +5,5 @@ export { Form } from './components/src/integrations/react-hook-form/components/F
|
|
|
5
5
|
export { SubmitButton } from './components/src/integrations/react-hook-form/components/SubmitButton/SubmitButton.mjs';
|
|
6
6
|
export { ResetButton } from './components/src/integrations/react-hook-form/components/ResetButton/ResetButton.mjs';
|
|
7
7
|
export { useFormContext, useOptionalFormContext } from './components/src/integrations/react-hook-form/components/FormContextProvider/FormContextProvider.mjs';
|
|
8
|
+
export { FormAction } from './components/src/integrations/react-hook-form/components/FormAction/FormAction.mjs';
|
|
8
9
|
//# sourceMappingURL=react-hook-form.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react-hook-form.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"react-hook-form.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ActionProps } from '../../../../components/Action/types';
|
|
2
|
+
import { FC, PropsWithChildren } from 'react';
|
|
3
|
+
type SupportedActionProps = Pick<ActionProps, "showFeedback">;
|
|
4
|
+
export interface FormActionProps extends PropsWithChildren, SupportedActionProps {
|
|
5
|
+
reset?: boolean;
|
|
6
|
+
submit?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare const FormAction: FC<FormActionProps>;
|
|
9
|
+
export default FormAction;
|
|
10
|
+
//# sourceMappingURL=FormAction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormAction.d.ts","sourceRoot":"","sources":["../../../../../../src/integrations/react-hook-form/components/FormAction/FormAction.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAG7D,OAAO,KAAK,EAAE,EAAE,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAEnD,KAAK,oBAAoB,GAAG,IAAI,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC;AAE9D,MAAM,WAAW,eACf,SAAQ,iBAAiB,EAAE,oBAAoB;IAC/C,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,eAAO,MAAM,UAAU,EAAE,EAAE,CAAC,eAAe,CAY1C,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ActionProps } from '../../../../components/Action';
|
|
2
|
+
import { FC, PropsWithChildren } from 'react';
|
|
3
|
+
type SupportedActionProps = Pick<ActionProps, "showFeedback">;
|
|
4
|
+
export declare const FormResetAction: FC<PropsWithChildren<SupportedActionProps>>;
|
|
5
|
+
export {};
|
|
6
|
+
//# sourceMappingURL=FormResetAction.d.ts.map
|
package/dist/types/integrations/react-hook-form/components/FormAction/FormResetAction.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormResetAction.d.ts","sourceRoot":"","sources":["../../../../../../src/integrations/react-hook-form/components/FormAction/FormResetAction.tsx"],"names":[],"mappings":"AAAA,OAAe,EAAE,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAG/D,OAAO,KAAK,EAAE,EAAE,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAEnD,KAAK,oBAAoB,GAAG,IAAI,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC;AAE9D,eAAO,MAAM,eAAe,EAAE,EAAE,CAAC,iBAAiB,CAAC,oBAAoB,CAAC,CA2BvE,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ActionProps } from '../../../../components/Action';
|
|
2
|
+
import { FC, PropsWithChildren } from 'react';
|
|
3
|
+
type SupportedActionProps = Pick<ActionProps, "showFeedback">;
|
|
4
|
+
export declare const FormSubmitAction: FC<PropsWithChildren<SupportedActionProps>>;
|
|
5
|
+
export default FormSubmitAction;
|
|
6
|
+
//# sourceMappingURL=FormSubmitAction.d.ts.map
|
package/dist/types/integrations/react-hook-form/components/FormAction/FormSubmitAction.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormSubmitAction.d.ts","sourceRoot":"","sources":["../../../../../../src/integrations/react-hook-form/components/FormAction/FormSubmitAction.tsx"],"names":[],"mappings":"AAAA,OAAe,EAAe,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAI5E,OAAO,KAAK,EAAE,EAAE,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAenD,KAAK,oBAAoB,GAAG,IAAI,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC;AAE9D,eAAO,MAAM,gBAAgB,EAAE,EAAE,CAAC,iBAAiB,CAAC,oBAAoB,CAAC,CAmCxE,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/integrations/react-hook-form/components/FormAction/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,KAAK,eAAe,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { FieldValues, UseFormReturn } from 'react-hook-form';
|
|
2
2
|
import { Dispatch, PropsWithChildren, SetStateAction } from 'react';
|
|
3
|
-
import { ActionModel } from '../../../../components/Action/models/ActionModel';
|
|
4
3
|
import { AfterFormSubmitCallback } from '../Form/Form';
|
|
5
4
|
interface FormContext<F extends FieldValues> {
|
|
6
5
|
form: UseFormReturn<F>;
|
|
7
6
|
id: string;
|
|
8
7
|
isReadOnly: boolean;
|
|
9
8
|
setReadOnly: Dispatch<SetStateAction<boolean>>;
|
|
10
|
-
|
|
9
|
+
onAfterSuccessFeedback?: AfterFormSubmitCallback;
|
|
11
10
|
}
|
|
12
11
|
export declare const FormContext: import('react').Context<FormContext<FieldValues> | undefined>;
|
|
13
12
|
export interface FormContextProviderProps extends PropsWithChildren {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormContextProvider.d.ts","sourceRoot":"","sources":["../../../../../../src/integrations/react-hook-form/components/FormContextProvider/FormContextProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAClE,OAAO,EAIL,KAAK,QAAQ,EACb,KAAK,iBAAiB,EACtB,KAAK,cAAc,EACpB,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"FormContextProvider.d.ts","sourceRoot":"","sources":["../../../../../../src/integrations/react-hook-form/components/FormContextProvider/FormContextProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAClE,OAAO,EAIL,KAAK,QAAQ,EACb,KAAK,iBAAiB,EACtB,KAAK,cAAc,EACpB,MAAM,OAAO,CAAC;AAEf,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qDAAqD,CAAC;AAGnG,UAAU,WAAW,CAAC,CAAC,SAAS,WAAW;IACzC,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,OAAO,CAAC;IACpB,WAAW,EAAE,QAAQ,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;IAC/C,sBAAsB,CAAC,EAAE,uBAAuB,CAAC;CAClD;AAED,eAAO,MAAM,WAAW,+DAEvB,CAAC;AAEF,MAAM,WAAW,wBAAyB,SAAQ,iBAAiB;IACjE,IAAI,EAAE,aAAa,CAAC;IACpB,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,sBAAsB,CAAC,EAAE,uBAAuB,CAAC;CAClD;AAED,eAAO,MAAM,mBAAmB,GAAI,OAAO,wBAAwB,4CA6BlE,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,CAAC,SAAS,WAAW,qBAOnD,CAAC;AAEF,eAAO,MAAM,sBAAsB,GAAI,CAAC,SAAS,WAAW,OAC/B,WAAW,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC;AAExD,eAAe,mBAAmB,CAAC"}
|
|
@@ -1,11 +1,5 @@
|
|
|
1
|
+
import { ActionProps } from '../../../../components/Action';
|
|
1
2
|
import { ActionModel } from '../../../../components/Action/models/ActionModel';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
interface Options {
|
|
5
|
-
form: UseFormReturn;
|
|
6
|
-
setReadOnly: (isReadOnly: boolean) => void;
|
|
7
|
-
onAfterSuccessFeedback?: AfterFormSubmitCallback;
|
|
8
|
-
}
|
|
9
|
-
export declare const useFormSubmitAction: (options: Options) => ActionModel;
|
|
10
|
-
export {};
|
|
3
|
+
import { FieldValues, FormState } from 'react-hook-form';
|
|
4
|
+
export declare const useFormSubmitAction: (formState: FormState<FieldValues>, actionProps?: ActionProps) => ActionModel;
|
|
11
5
|
//# sourceMappingURL=useFormSubmitAction.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFormSubmitAction.d.ts","sourceRoot":"","sources":["../../../../../../src/integrations/react-hook-form/components/FormContextProvider/useFormSubmitAction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"useFormSubmitAction.d.ts","sourceRoot":"","sources":["../../../../../../src/integrations/react-hook-form/components/FormContextProvider/useFormSubmitAction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAC;AAGrE,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE9D,eAAO,MAAM,mBAAmB,GAC9B,WAAW,SAAS,CAAC,WAAW,CAAC,EACjC,cAAc,WAAW,gBAuC1B,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { FieldValues, FormState } from 'react-hook-form';
|
|
2
|
+
interface Options {
|
|
3
|
+
formState: FormState<FieldValues>;
|
|
4
|
+
setReadOnly: (isReadOnly: boolean) => void;
|
|
5
|
+
}
|
|
6
|
+
export declare const useUpdateReadOnly: (options: Options) => void;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=useUpdateReadOnly.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useUpdateReadOnly.d.ts","sourceRoot":"","sources":["../../../../../../src/integrations/react-hook-form/components/FormContextProvider/useUpdateReadOnly.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE9D,UAAU,OAAO;IACf,SAAS,EAAE,SAAS,CAAC,WAAW,CAAC,CAAC;IAClC,WAAW,EAAE,CAAC,UAAU,EAAE,OAAO,KAAK,IAAI,CAAC;CAC5C;AAED,eAAO,MAAM,iBAAiB,GAAI,SAAS,OAAO,SAQjD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResetButton.d.ts","sourceRoot":"","sources":["../../../../../../src/integrations/react-hook-form/components/ResetButton/ResetButton.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAGvD,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"ResetButton.d.ts","sourceRoot":"","sources":["../../../../../../src/integrations/react-hook-form/components/ResetButton/ResetButton.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAGvD,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAEhC,eAAO,MAAM,WAAW,EAAE,EAAE,CAAC,WAAW,CAMvC,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
import { ActionProps } from '../../../../components/Action';
|
|
1
2
|
import { ButtonProps } from '../../../../components/Button';
|
|
2
3
|
import { FC } from 'react';
|
|
3
|
-
|
|
4
|
+
type SupportedActionProps = Pick<ActionProps, "showFeedback">;
|
|
5
|
+
export type SubmitButtonProps = ButtonProps & SupportedActionProps;
|
|
6
|
+
export declare const SubmitButton: FC<SubmitButtonProps>;
|
|
4
7
|
export default SubmitButton;
|
|
5
8
|
//# sourceMappingURL=SubmitButton.d.ts.map
|
package/dist/types/integrations/react-hook-form/components/SubmitButton/SubmitButton.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SubmitButton.d.ts","sourceRoot":"","sources":["../../../../../../src/integrations/react-hook-form/components/SubmitButton/SubmitButton.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"SubmitButton.d.ts","sourceRoot":"","sources":["../../../../../../src/integrations/react-hook-form/components/SubmitButton/SubmitButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAGvD,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAEhC,KAAK,oBAAoB,GAAG,IAAI,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC;AAE9D,MAAM,MAAM,iBAAiB,GAAG,WAAW,GAAG,oBAAoB,CAAC;AAEnE,eAAO,MAAM,YAAY,EAAE,EAAE,CAAC,iBAAiB,CAO9C,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -3,4 +3,5 @@ export * from './components/Form';
|
|
|
3
3
|
export * from './components/SubmitButton';
|
|
4
4
|
export * from './components/ResetButton';
|
|
5
5
|
export { useFormContext, useOptionalFormContext, } from './components/FormContextProvider';
|
|
6
|
+
export * from './components/FormAction';
|
|
6
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/integrations/react-hook-form/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC;AACzC,OAAO,EACL,cAAc,EACd,sBAAsB,GACvB,MAAM,kCAAkC,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/integrations/react-hook-form/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC;AACzC,OAAO,EACL,cAAc,EACd,sBAAsB,GACvB,MAAM,kCAAkC,CAAC;AAC1C,cAAc,yBAAyB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mittwald/flow-react-components",
|
|
3
|
-
"version": "0.2.0-alpha.
|
|
3
|
+
"version": "0.2.0-alpha.680",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A React implementation of Flow, mittwald’s design system",
|
|
6
6
|
"homepage": "https://mittwald.github.io/flow",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"dependencies": {
|
|
59
59
|
"@internationalized/string-compiler": "^3.2.6",
|
|
60
60
|
"@mittwald/password-tools-js": "3.0.0-alpha.18",
|
|
61
|
-
"@mittwald/react-tunnel": "0.2.0-alpha.
|
|
61
|
+
"@mittwald/react-tunnel": "0.2.0-alpha.680",
|
|
62
62
|
"@mittwald/react-use-promise": "^4.2.2",
|
|
63
63
|
"@react-aria/form": "^3.1.3",
|
|
64
64
|
"@react-aria/live-announcer": "^3.4.4",
|
|
@@ -104,7 +104,7 @@
|
|
|
104
104
|
"@faker-js/faker": "^10.2.0",
|
|
105
105
|
"@internationalized/date": "^3.10.1",
|
|
106
106
|
"@mittwald/flow-core": "",
|
|
107
|
-
"@mittwald/flow-design-tokens": "0.2.0-alpha.
|
|
107
|
+
"@mittwald/flow-design-tokens": "0.2.0-alpha.680",
|
|
108
108
|
"@mittwald/react-use-promise": "^4.2.2",
|
|
109
109
|
"@mittwald/remote-dom-react": "1.2.2-mittwald.10",
|
|
110
110
|
"@mittwald/typescript-config": "",
|
|
@@ -172,5 +172,5 @@
|
|
|
172
172
|
"optional": true
|
|
173
173
|
}
|
|
174
174
|
},
|
|
175
|
-
"gitHead": "
|
|
175
|
+
"gitHead": "9bc78fb1a536d45848c6a3240f0aae204cef5e4b"
|
|
176
176
|
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use client"
|
|
2
|
-
/* */
|
|
3
|
-
import { jsx } from 'react/jsx-runtime';
|
|
4
|
-
import { Action } from '../../../../components/Action/Action.mjs';
|
|
5
|
-
import 'react-aria';
|
|
6
|
-
import 'react';
|
|
7
|
-
import '@react-aria/live-announcer';
|
|
8
|
-
import { useFormContext } from '../FormContextProvider/FormContextProvider.mjs';
|
|
9
|
-
|
|
10
|
-
const FormSubmitAction = (props) => {
|
|
11
|
-
const { children } = props;
|
|
12
|
-
const action = useFormContext().formSubmitAction;
|
|
13
|
-
return /* @__PURE__ */ jsx(Action, { actionModel: action, children });
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
export { FormSubmitAction, FormSubmitAction as default };
|
|
17
|
-
//# sourceMappingURL=FormSubmitAction.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FormSubmitAction.mjs","sources":["../../../../../../../../src/integrations/react-hook-form/components/FormSubmitAction/FormSubmitAction.tsx"],"sourcesContent":["import Action from \"@/components/Action\";\nimport { useFormContext } from \"@/integrations/react-hook-form/components/FormContextProvider\";\nimport type { FC, PropsWithChildren } from \"react\";\n\nexport const FormSubmitAction: FC<PropsWithChildren> = (props) => {\n const { children } = props;\n const action = useFormContext().formSubmitAction;\n return <Action actionModel={action}>{children}</Action>;\n};\n\nexport default FormSubmitAction;\n"],"names":[],"mappings":";;;;;;;AAIO,MAAM,gBAAA,GAA0C,CAAC,KAAA,KAAU;AAChE,EAAA,MAAM,EAAE,UAAS,GAAI,KAAA;AACrB,EAAA,MAAM,MAAA,GAAS,gBAAe,CAAE,gBAAA;AAChC,EAAA,uBAAO,GAAA,CAAC,MAAA,EAAA,EAAO,WAAA,EAAa,MAAA,EAAS,QAAA,EAAS,CAAA;AAChD;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FormSubmitAction.d.ts","sourceRoot":"","sources":["../../../../../../src/integrations/react-hook-form/components/FormSubmitAction/FormSubmitAction.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAE,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAEnD,eAAO,MAAM,gBAAgB,EAAE,EAAE,CAAC,iBAAiB,CAIlD,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/integrations/react-hook-form/components/FormSubmitAction/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC"}
|