@mittwald/flow-react-components 0.2.0-alpha.710 → 0.2.0-alpha.712
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 +12 -0
- package/dist/assets/doc-properties.json +3649 -3622
- package/dist/js/components/src/components/Action/AbortActionError.mjs +19 -0
- package/dist/js/components/src/components/Action/AbortActionError.mjs.map +1 -0
- package/dist/js/components/src/components/Action/lib/abortAction.mjs +10 -0
- package/dist/js/components/src/components/Action/lib/abortAction.mjs.map +1 -0
- package/dist/js/components/src/components/Action/models/ActionExecution.mjs +3 -3
- package/dist/js/components/src/components/Action/models/ActionExecution.mjs.map +1 -1
- package/dist/js/components/src/integrations/react-hook-form/components/Form/Form.mjs +8 -0
- package/dist/js/components/src/integrations/react-hook-form/components/Form/Form.mjs.map +1 -1
- package/dist/js/components/src/integrations/react-hook-form/components/FormContextProvider/FormContextProvider.mjs +4 -2
- 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 +7 -3
- 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/FormRootError/FormRootError.mjs +16 -0
- package/dist/js/components/src/integrations/react-hook-form/components/FormRootError/FormRootError.mjs.map +1 -0
- package/dist/js/components/src/integrations/react-hook-form/components/FormRootError/useFormRootErrorController.mjs +17 -0
- package/dist/js/components/src/integrations/react-hook-form/components/FormRootError/useFormRootErrorController.mjs.map +1 -0
- package/dist/js/components/src/integrations/react-hook-form/components/FormRootError/useMountedFormRootErrorComponent.mjs +17 -0
- package/dist/js/components/src/integrations/react-hook-form/components/FormRootError/useMountedFormRootErrorComponent.mjs.map +1 -0
- package/dist/js/components/src/integrations/react-hook-form/lib/FormRootError.mjs +13 -0
- package/dist/js/components/src/integrations/react-hook-form/lib/FormRootError.mjs.map +1 -0
- package/dist/js/default.mjs +2 -1
- package/dist/js/default.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/components/Action/AbortActionError.d.ts +6 -0
- package/dist/types/components/Action/AbortActionError.d.ts.map +1 -0
- package/dist/types/components/Action/index.d.ts +2 -1
- package/dist/types/components/Action/index.d.ts.map +1 -1
- package/dist/types/components/Action/lib/abortAction.d.ts +2 -0
- package/dist/types/components/Action/lib/abortAction.d.ts.map +1 -0
- package/dist/types/integrations/react-hook-form/components/Form/Form.d.ts.map +1 -1
- package/dist/types/integrations/react-hook-form/components/Form/stories/Form.stories.d.ts +1 -0
- package/dist/types/integrations/react-hook-form/components/Form/stories/Form.stories.d.ts.map +1 -1
- package/dist/types/integrations/react-hook-form/components/FormContextProvider/FormContextProvider.d.ts +3 -0
- 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.map +1 -1
- package/dist/types/integrations/react-hook-form/components/FormRootError/FormRootError.d.ts +4 -0
- package/dist/types/integrations/react-hook-form/components/FormRootError/FormRootError.d.ts.map +1 -0
- package/dist/types/integrations/react-hook-form/components/FormRootError/index.d.ts +3 -0
- package/dist/types/integrations/react-hook-form/components/FormRootError/index.d.ts.map +1 -0
- package/dist/types/integrations/react-hook-form/components/FormRootError/useFormRootErrorController.d.ts +7 -0
- package/dist/types/integrations/react-hook-form/components/FormRootError/useFormRootErrorController.d.ts.map +1 -0
- package/dist/types/integrations/react-hook-form/components/FormRootError/useMountedFormRootErrorComponent.d.ts +2 -0
- package/dist/types/integrations/react-hook-form/components/FormRootError/useMountedFormRootErrorComponent.d.ts.map +1 -0
- 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/dist/types/integrations/react-hook-form/lib/FormRootError.d.ts +6 -0
- package/dist/types/integrations/react-hook-form/lib/FormRootError.d.ts.map +1 -0
- package/package.json +4 -4
- package/dist/js/components/src/components/Action/MutedActionError.mjs +0 -19
- package/dist/js/components/src/components/Action/MutedActionError.mjs.map +0 -1
- package/dist/types/components/Action/MutedActionError.d.ts +0 -6
- package/dist/types/components/Action/MutedActionError.d.ts.map +0 -1
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
/* */
|
|
3
|
+
class AbortActionError extends Error {
|
|
4
|
+
constructor(message) {
|
|
5
|
+
super(message);
|
|
6
|
+
this.name = "AbortActionError";
|
|
7
|
+
}
|
|
8
|
+
static isAbortActionError(error) {
|
|
9
|
+
return error instanceof AbortActionError;
|
|
10
|
+
}
|
|
11
|
+
static rethrowIfNotAborted(error) {
|
|
12
|
+
if (!AbortActionError.isAbortActionError(error)) {
|
|
13
|
+
throw error;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export { AbortActionError };
|
|
19
|
+
//# sourceMappingURL=AbortActionError.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AbortActionError.mjs","sources":["../../../../../../src/components/Action/AbortActionError.ts"],"sourcesContent":["export class AbortActionError extends Error {\n public constructor(message?: string) {\n super(message);\n this.name = \"AbortActionError\";\n }\n\n public static isAbortActionError(error: unknown): error is AbortActionError {\n return error instanceof AbortActionError;\n }\n\n public static rethrowIfNotAborted(error: unknown): void {\n if (!AbortActionError.isAbortActionError(error)) {\n throw error;\n }\n }\n}\n"],"names":[],"mappings":"AAAO,MAAM,yBAAyB,KAAA,CAAM;AAAA,EACnC,YAAY,OAAA,EAAkB;AACnC,IAAA,KAAA,CAAM,OAAO,CAAA;AACb,IAAA,IAAA,CAAK,IAAA,GAAO,kBAAA;AAAA,EACd;AAAA,EAEA,OAAc,mBAAmB,KAAA,EAA2C;AAC1E,IAAA,OAAO,KAAA,YAAiB,gBAAA;AAAA,EAC1B;AAAA,EAEA,OAAc,oBAAoB,KAAA,EAAsB;AACtD,IAAA,IAAI,CAAC,gBAAA,CAAiB,kBAAA,CAAmB,KAAK,CAAA,EAAG;AAC/C,MAAA,MAAM,KAAA;AAAA,IACR;AAAA,EACF;AACF;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"abortAction.mjs","sources":["../../../../../../../src/components/Action/lib/abortAction.ts"],"sourcesContent":["import { AbortActionError } from \"@/components/Action/AbortActionError\";\n\nexport const abortAction: (message?: string) => never = (message) => {\n throw new AbortActionError(message);\n};\n"],"names":[],"mappings":";;AAEO,MAAM,WAAA,GAA2C,CAAC,OAAA,KAAY;AACnE,EAAA,MAAM,IAAI,iBAAiB,OAAO,CAAA;AACpC;;;;"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/* */
|
|
3
3
|
import { ActionExecutionBatch } from './ActionExecutionBatch.mjs';
|
|
4
4
|
import { callFunctionsInOrder } from '../../../lib/promises/callFunctionsInOrder.mjs';
|
|
5
|
-
import {
|
|
5
|
+
import { AbortActionError } from '../AbortActionError.mjs';
|
|
6
6
|
|
|
7
7
|
class ActionExecution {
|
|
8
8
|
action;
|
|
@@ -18,11 +18,11 @@ class ActionExecution {
|
|
|
18
18
|
const maybePromise = executeBatchedActions(...args);
|
|
19
19
|
if (maybePromise instanceof Promise) {
|
|
20
20
|
maybePromise.catch((error) => {
|
|
21
|
-
|
|
21
|
+
AbortActionError.rethrowIfNotAborted(error);
|
|
22
22
|
});
|
|
23
23
|
}
|
|
24
24
|
} catch (error) {
|
|
25
|
-
|
|
25
|
+
AbortActionError.rethrowIfNotAborted(error);
|
|
26
26
|
}
|
|
27
27
|
};
|
|
28
28
|
getBatchedActions = () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionExecution.mjs","sources":["../../../../../../../src/components/Action/models/ActionExecution.tsx"],"sourcesContent":["import type { ActionModel } from \"@/components/Action/models/ActionModel\";\nimport { ActionExecutionBatch } from \"@/components/Action/models/ActionExecutionBatch\";\nimport { callFunctionsInOrder } from \"@/lib/promises/callFunctionsInOrder\";\nimport {
|
|
1
|
+
{"version":3,"file":"ActionExecution.mjs","sources":["../../../../../../../src/components/Action/models/ActionExecution.tsx"],"sourcesContent":["import type { ActionModel } from \"@/components/Action/models/ActionModel\";\nimport { ActionExecutionBatch } from \"@/components/Action/models/ActionExecutionBatch\";\nimport { callFunctionsInOrder } from \"@/lib/promises/callFunctionsInOrder\";\nimport { AbortActionError } from \"@/components/Action/AbortActionError\";\n\nexport class ActionExecution {\n private readonly action: ActionModel;\n\n public constructor(action: ActionModel) {\n this.action = action;\n }\n\n public execute = (...args: unknown[]): void => {\n const batches = this.getBatchedActions();\n\n const executeBatchedActions = callFunctionsInOrder(\n batches.map((b) => b.executeBatch.bind(b)),\n );\n\n try {\n const maybePromise = executeBatchedActions(...args);\n if (maybePromise instanceof Promise) {\n maybePromise.catch((error) => {\n AbortActionError.rethrowIfNotAborted(error);\n });\n }\n } catch (error) {\n AbortActionError.rethrowIfNotAborted(error);\n }\n };\n\n private getBatchedActions = (): ActionExecutionBatch[] => {\n let currentAction: ActionModel | undefined = this.action;\n\n const batches: ActionExecutionBatch[] = [];\n let currentBatch: ActionExecutionBatch = new ActionExecutionBatch(\n this.action,\n );\n\n let skipCount = 0;\n\n while (currentAction) {\n const { onAction, break: $break, skip } = currentAction.actionProps;\n\n if (currentAction.needsConfirmation) {\n currentBatch.addAction(currentAction);\n break;\n }\n\n if (skip) {\n skipCount = skip === true ? 1 : skip;\n currentAction = currentAction.parentAction;\n continue;\n }\n\n if (skipCount > 0) {\n currentAction = currentAction.parentAction;\n skipCount--;\n continue;\n }\n\n if ($break) {\n break;\n }\n\n if (onAction) {\n currentBatch.addAction(currentAction);\n } else {\n batches.push(currentBatch);\n currentBatch = new ActionExecutionBatch(this.action);\n currentBatch.addAction(currentAction);\n }\n\n currentAction = currentAction.parentAction;\n }\n\n batches.push(currentBatch);\n return batches;\n };\n}\n"],"names":[],"mappings":";;;;AAKO,MAAM,eAAA,CAAgB;AAAA,EACV,MAAA;AAAA,EAEV,YAAY,MAAA,EAAqB;AACtC,IAAA,IAAA,CAAK,MAAA,GAAS,MAAA;AAAA,EAChB;AAAA,EAEO,OAAA,GAAU,IAAI,IAAA,KAA0B;AAC7C,IAAA,MAAM,OAAA,GAAU,KAAK,iBAAA,EAAkB;AAEvC,IAAA,MAAM,qBAAA,GAAwB,oBAAA;AAAA,MAC5B,OAAA,CAAQ,IAAI,CAAC,CAAA,KAAM,EAAE,YAAA,CAAa,IAAA,CAAK,CAAC,CAAC;AAAA,KAC3C;AAEA,IAAA,IAAI;AACF,MAAA,MAAM,YAAA,GAAe,qBAAA,CAAsB,GAAG,IAAI,CAAA;AAClD,MAAA,IAAI,wBAAwB,OAAA,EAAS;AACnC,QAAA,YAAA,CAAa,KAAA,CAAM,CAAC,KAAA,KAAU;AAC5B,UAAA,gBAAA,CAAiB,oBAAoB,KAAK,CAAA;AAAA,QAC5C,CAAC,CAAA;AAAA,MACH;AAAA,IACF,SAAS,KAAA,EAAO;AACd,MAAA,gBAAA,CAAiB,oBAAoB,KAAK,CAAA;AAAA,IAC5C;AAAA,EACF,CAAA;AAAA,EAEQ,oBAAoB,MAA8B;AACxD,IAAA,IAAI,gBAAyC,IAAA,CAAK,MAAA;AAElD,IAAA,MAAM,UAAkC,EAAC;AACzC,IAAA,IAAI,eAAqC,IAAI,oBAAA;AAAA,MAC3C,IAAA,CAAK;AAAA,KACP;AAEA,IAAA,IAAI,SAAA,GAAY,CAAA;AAEhB,IAAA,OAAO,aAAA,EAAe;AACpB,MAAA,MAAM,EAAE,QAAA,EAAU,KAAA,EAAO,MAAA,EAAQ,IAAA,KAAS,aAAA,CAAc,WAAA;AAExD,MAAA,IAAI,cAAc,iBAAA,EAAmB;AACnC,QAAA,YAAA,CAAa,UAAU,aAAa,CAAA;AACpC,QAAA;AAAA,MACF;AAEA,MAAA,IAAI,IAAA,EAAM;AACR,QAAA,SAAA,GAAY,IAAA,KAAS,OAAO,CAAA,GAAI,IAAA;AAChC,QAAA,aAAA,GAAgB,aAAA,CAAc,YAAA;AAC9B,QAAA;AAAA,MACF;AAEA,MAAA,IAAI,YAAY,CAAA,EAAG;AACjB,QAAA,aAAA,GAAgB,aAAA,CAAc,YAAA;AAC9B,QAAA,SAAA,EAAA;AACA,QAAA;AAAA,MACF;AAEA,MAAA,IAAI,MAAA,EAAQ;AACV,QAAA;AAAA,MACF;AAEA,MAAA,IAAI,QAAA,EAAU;AACZ,QAAA,YAAA,CAAa,UAAU,aAAa,CAAA;AAAA,MACtC,CAAA,MAAO;AACL,QAAA,OAAA,CAAQ,KAAK,YAAY,CAAA;AACzB,QAAA,YAAA,GAAe,IAAI,oBAAA,CAAqB,IAAA,CAAK,MAAM,CAAA;AACnD,QAAA,YAAA,CAAa,UAAU,aAAa,CAAA;AAAA,MACtC;AAEA,MAAA,aAAA,GAAgB,aAAA,CAAc,YAAA;AAAA,IAChC;AAEA,IAAA,OAAA,CAAQ,KAAK,YAAY,CAAA;AACzB,IAAA,OAAO,OAAA;AAAA,EACT,CAAA;AACF;;;;"}
|
|
@@ -10,6 +10,8 @@ import { useId, useMemo, useRef } from 'react';
|
|
|
10
10
|
import { useModalController } from '../../../../lib/controller/overlay/useModalController.mjs';
|
|
11
11
|
import '../../../../lib/controller/overlay/context.mjs';
|
|
12
12
|
import { FormProvider } from 'react-hook-form';
|
|
13
|
+
import { useFormRootErrorController } from '../FormRootError/useFormRootErrorController.mjs';
|
|
14
|
+
import { FormRootError } from '../../lib/FormRootError.mjs';
|
|
13
15
|
|
|
14
16
|
const DefaultFormComponent = (p) => /* @__PURE__ */ jsx("form", { ...p });
|
|
15
17
|
function Form(props) {
|
|
@@ -29,6 +31,7 @@ function Form(props) {
|
|
|
29
31
|
const FormComponent = useMemo(() => formComponent, [formId]);
|
|
30
32
|
const afterSubmitCallback = useRef(void 0);
|
|
31
33
|
const { isSubmitting, isValidating, isDirty } = form.formState;
|
|
34
|
+
const rootErrorController = useFormRootErrorController();
|
|
32
35
|
const autoResetOptions = typeof autoReset === "boolean" ? { onAfterModalClose: autoReset } : autoReset;
|
|
33
36
|
const modalController = useModalController();
|
|
34
37
|
modalController.useUpdateOptions({
|
|
@@ -43,6 +46,10 @@ function Form(props) {
|
|
|
43
46
|
if (typeof result === "function") {
|
|
44
47
|
afterSubmitCallback.current = result;
|
|
45
48
|
}
|
|
49
|
+
const rootError = form.getFieldState("root")?.error;
|
|
50
|
+
if (rootError && !rootErrorController.errorComponentMounted) {
|
|
51
|
+
throw new FormRootError(rootError);
|
|
52
|
+
}
|
|
46
53
|
};
|
|
47
54
|
const handleSubmit = (e) => {
|
|
48
55
|
const formEvent = e && "nativeEvent" in e ? e : void 0;
|
|
@@ -74,6 +81,7 @@ function Form(props) {
|
|
|
74
81
|
isReadOnly,
|
|
75
82
|
id: formId,
|
|
76
83
|
onAfterSuccessFeedback,
|
|
84
|
+
rootErrorController,
|
|
77
85
|
children: /* @__PURE__ */ jsx(
|
|
78
86
|
FormComponent,
|
|
79
87
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Form.mjs","sources":["../../../../../../../../src/integrations/react-hook-form/components/Form/Form.tsx"],"sourcesContent":["import ConfirmUnsavedChangesModal from \"@/components/Modal/components/ConfirmUnsavedChangesModal\";\nimport { useHotkeySubmit } from \"@/integrations/react-hook-form/components/Form/useHotkeySubmit\";\nimport { FormContextProvider } from \"@/integrations/react-hook-form/components/FormContextProvider/FormContextProvider\";\nimport { flags } from \"@/integrations/react-hook-form/flags\";\nimport { useModalController } from \"@/lib/controller\";\nimport {\n type ComponentProps,\n type FC,\n type FormEvent,\n type FormEventHandler,\n type PropsWithChildren,\n type Ref,\n useId,\n useMemo,\n useRef,\n} from \"react\";\nimport type {\n FieldValues,\n SubmitHandler,\n UseFormReturn,\n} from \"react-hook-form\";\nimport { FormProvider as RhfFormContextProvider } from \"react-hook-form\";\n\nexport type FormOnSubmitHandler<F extends FieldValues> = SubmitHandler<F>;\n\nexport type AfterFormSubmitCallback = (...unknownArgs: unknown[]) => unknown;\n\nexport interface FormAutoResetOptions {\n onAfterModalClose?: boolean;\n}\n\ntype FormComponentType = FC<\n PropsWithChildren<{\n id: string;\n onSubmit?: FormEventHandler | FormOnSubmitHandler<never>;\n ref?: Ref<HTMLFormElement>;\n }>\n>;\n\nexport interface FormProps<F extends FieldValues>\n extends Omit<ComponentProps<\"form\">, \"onSubmit\">, PropsWithChildren {\n form: UseFormReturn<F>;\n onSubmit: FormOnSubmitHandler<F>;\n formComponent?: FC<Omit<FormComponentType, \"ref\">>;\n isReadOnly?: boolean;\n autoReset?: FormAutoResetOptions | boolean;\n}\n\nconst DefaultFormComponent: FormComponentType = (p) => <form {...p} />;\n\nexport function Form<F extends FieldValues>(props: FormProps<F>) {\n const {\n form,\n children,\n onSubmit,\n formComponent = DefaultFormComponent,\n isReadOnly,\n ref,\n id: idProp,\n autoReset = true,\n ...formProps\n } = props;\n\n const newFormId = useId();\n const formId = idProp ?? newFormId;\n const FormComponent = useMemo(() => formComponent, [formId]);\n const afterSubmitCallback = useRef<AfterFormSubmitCallback>(undefined);\n const { isSubmitting, isValidating, isDirty } = form.formState;\n\n const autoResetOptions =\n typeof autoReset === \"boolean\"\n ? { onAfterModalClose: autoReset }\n : autoReset;\n\n const modalController = useModalController();\n modalController.useUpdateOptions({\n confirmOnClose:\n flags.requireCloseModalConfirmationOnUnsavedChanges && isDirty,\n onClose: () => {\n if (autoResetOptions?.onAfterModalClose) {\n form.reset();\n }\n },\n });\n\n const handleSubmitResult = (result: unknown) => {\n if (typeof result === \"function\") {\n afterSubmitCallback.current = result as AfterFormSubmitCallback;\n }\n };\n\n const handleSubmit = (e?: FormEvent | F) => {\n const formEvent = e && \"nativeEvent\" in e ? (e as FormEvent) : undefined;\n formEvent?.stopPropagation();\n if (isSubmitting || isValidating) {\n return;\n }\n modalController.confirmClose();\n return form.handleSubmit((values, event) => {\n const submitResult = onSubmit(values, event);\n if (submitResult instanceof Promise) {\n return submitResult.then(handleSubmitResult);\n }\n handleSubmitResult(submitResult);\n })(formEvent);\n };\n\n const onAfterSuccessFeedback = () => {\n afterSubmitCallback.current?.();\n };\n\n const refWithHotkeySubmit = useHotkeySubmit({\n ref,\n handleSubmit,\n });\n\n return (\n <RhfFormContextProvider {...form}>\n <FormContextProvider\n form={form as UseFormReturn}\n isReadOnly={isReadOnly}\n id={formId}\n onAfterSuccessFeedback={onAfterSuccessFeedback}\n >\n <FormComponent\n {...formProps}\n ref={refWithHotkeySubmit}\n id={formId}\n onSubmit={handleSubmit}\n >\n {children}\n </FormComponent>\n </FormContextProvider>\n <ConfirmUnsavedChangesModal />\n </RhfFormContextProvider>\n );\n}\n\nexport default Form;\n"],"names":["RhfFormContextProvider"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Form.mjs","sources":["../../../../../../../../src/integrations/react-hook-form/components/Form/Form.tsx"],"sourcesContent":["import ConfirmUnsavedChangesModal from \"@/components/Modal/components/ConfirmUnsavedChangesModal\";\nimport { useHotkeySubmit } from \"@/integrations/react-hook-form/components/Form/useHotkeySubmit\";\nimport { FormContextProvider } from \"@/integrations/react-hook-form/components/FormContextProvider/FormContextProvider\";\nimport { flags } from \"@/integrations/react-hook-form/flags\";\nimport { useModalController } from \"@/lib/controller\";\nimport {\n type ComponentProps,\n type FC,\n type FormEvent,\n type FormEventHandler,\n type PropsWithChildren,\n type Ref,\n useId,\n useMemo,\n useRef,\n} from \"react\";\nimport type {\n FieldValues,\n Path,\n SubmitHandler,\n UseFormReturn,\n} from \"react-hook-form\";\nimport { FormProvider as RhfFormContextProvider } from \"react-hook-form\";\nimport { useFormRootErrorController } from \"../FormRootError/useFormRootErrorController\";\nimport { FormRootError } from \"../../lib/FormRootError\";\n\nexport type FormOnSubmitHandler<F extends FieldValues> = SubmitHandler<F>;\n\nexport type AfterFormSubmitCallback = (...unknownArgs: unknown[]) => unknown;\n\nexport interface FormAutoResetOptions {\n onAfterModalClose?: boolean;\n}\n\ntype FormComponentType = FC<\n PropsWithChildren<{\n id: string;\n onSubmit?: FormEventHandler | FormOnSubmitHandler<never>;\n ref?: Ref<HTMLFormElement>;\n }>\n>;\n\nexport interface FormProps<F extends FieldValues>\n extends Omit<ComponentProps<\"form\">, \"onSubmit\">, PropsWithChildren {\n form: UseFormReturn<F>;\n onSubmit: FormOnSubmitHandler<F>;\n formComponent?: FC<Omit<FormComponentType, \"ref\">>;\n isReadOnly?: boolean;\n autoReset?: FormAutoResetOptions | boolean;\n}\n\nconst DefaultFormComponent: FormComponentType = (p) => <form {...p} />;\n\nexport function Form<F extends FieldValues>(props: FormProps<F>) {\n const {\n form,\n children,\n onSubmit,\n formComponent = DefaultFormComponent,\n isReadOnly,\n ref,\n id: idProp,\n autoReset = true,\n ...formProps\n } = props;\n\n const newFormId = useId();\n const formId = idProp ?? newFormId;\n const FormComponent = useMemo(() => formComponent, [formId]);\n const afterSubmitCallback = useRef<AfterFormSubmitCallback>(undefined);\n const { isSubmitting, isValidating, isDirty } = form.formState;\n const rootErrorController = useFormRootErrorController();\n\n const autoResetOptions =\n typeof autoReset === \"boolean\"\n ? { onAfterModalClose: autoReset }\n : autoReset;\n\n const modalController = useModalController();\n modalController.useUpdateOptions({\n confirmOnClose:\n flags.requireCloseModalConfirmationOnUnsavedChanges && isDirty,\n onClose: () => {\n if (autoResetOptions?.onAfterModalClose) {\n form.reset();\n }\n },\n });\n\n const handleSubmitResult = (result: unknown) => {\n if (typeof result === \"function\") {\n afterSubmitCallback.current = result as AfterFormSubmitCallback;\n }\n const rootError = form.getFieldState(\"root\" as Path<F>)?.error;\n if (rootError && !rootErrorController.errorComponentMounted) {\n throw new FormRootError(rootError);\n }\n };\n\n const handleSubmit = (e?: FormEvent | F) => {\n const formEvent = e && \"nativeEvent\" in e ? (e as FormEvent) : undefined;\n formEvent?.stopPropagation();\n if (isSubmitting || isValidating) {\n return;\n }\n modalController.confirmClose();\n return form.handleSubmit((values, event) => {\n const submitResult = onSubmit(values, event);\n if (submitResult instanceof Promise) {\n return submitResult.then(handleSubmitResult);\n }\n handleSubmitResult(submitResult);\n })(formEvent);\n };\n\n const onAfterSuccessFeedback = () => {\n afterSubmitCallback.current?.();\n };\n\n const refWithHotkeySubmit = useHotkeySubmit({\n ref,\n handleSubmit,\n });\n\n return (\n <RhfFormContextProvider {...form}>\n <FormContextProvider\n form={form as UseFormReturn}\n isReadOnly={isReadOnly}\n id={formId}\n onAfterSuccessFeedback={onAfterSuccessFeedback}\n rootErrorController={rootErrorController}\n >\n <FormComponent\n {...formProps}\n ref={refWithHotkeySubmit}\n id={formId}\n onSubmit={handleSubmit}\n >\n {children}\n </FormComponent>\n </FormContextProvider>\n <ConfirmUnsavedChangesModal />\n </RhfFormContextProvider>\n );\n}\n\nexport default Form;\n"],"names":["RhfFormContextProvider"],"mappings":";;;;;;;;;;;;;AAmDA,MAAM,uBAA0C,CAAC,CAAA,qBAAM,GAAA,CAAC,MAAA,EAAA,EAAM,GAAG,CAAA,EAAG,CAAA;AAE7D,SAAS,KAA4B,KAAA,EAAqB;AAC/D,EAAA,MAAM;AAAA,IACJ,IAAA;AAAA,IACA,QAAA;AAAA,IACA,QAAA;AAAA,IACA,aAAA,GAAgB,oBAAA;AAAA,IAChB,UAAA;AAAA,IACA,GAAA;AAAA,IACA,EAAA,EAAI,MAAA;AAAA,IACJ,SAAA,GAAY,IAAA;AAAA,IACZ,GAAG;AAAA,GACL,GAAI,KAAA;AAEJ,EAAA,MAAM,YAAY,KAAA,EAAM;AACxB,EAAA,MAAM,SAAS,MAAA,IAAU,SAAA;AACzB,EAAA,MAAM,gBAAgB,OAAA,CAAQ,MAAM,aAAA,EAAe,CAAC,MAAM,CAAC,CAAA;AAC3D,EAAA,MAAM,mBAAA,GAAsB,OAAgC,MAAS,CAAA;AACrE,EAAA,MAAM,EAAE,YAAA,EAAc,YAAA,EAAc,OAAA,KAAY,IAAA,CAAK,SAAA;AACrD,EAAA,MAAM,sBAAsB,0BAAA,EAA2B;AAEvD,EAAA,MAAM,mBACJ,OAAO,SAAA,KAAc,YACjB,EAAE,iBAAA,EAAmB,WAAU,GAC/B,SAAA;AAEN,EAAA,MAAM,kBAAkB,kBAAA,EAAmB;AAC3C,EAAA,eAAA,CAAgB,gBAAA,CAAiB;AAAA,IAC/B,cAAA,EACE,MAAM,6CAAA,IAAiD,OAAA;AAAA,IACzD,SAAS,MAAM;AACb,MAAA,IAAI,kBAAkB,iBAAA,EAAmB;AACvC,QAAA,IAAA,CAAK,KAAA,EAAM;AAAA,MACb;AAAA,IACF;AAAA,GACD,CAAA;AAED,EAAA,MAAM,kBAAA,GAAqB,CAAC,MAAA,KAAoB;AAC9C,IAAA,IAAI,OAAO,WAAW,UAAA,EAAY;AAChC,MAAA,mBAAA,CAAoB,OAAA,GAAU,MAAA;AAAA,IAChC;AACA,IAAA,MAAM,SAAA,GAAY,IAAA,CAAK,aAAA,CAAc,MAAiB,CAAA,EAAG,KAAA;AACzD,IAAA,IAAI,SAAA,IAAa,CAAC,mBAAA,CAAoB,qBAAA,EAAuB;AAC3D,MAAA,MAAM,IAAI,cAAc,SAAS,CAAA;AAAA,IACnC;AAAA,EACF,CAAA;AAEA,EAAA,MAAM,YAAA,GAAe,CAAC,CAAA,KAAsB;AAC1C,IAAA,MAAM,SAAA,GAAY,CAAA,IAAK,aAAA,IAAiB,CAAA,GAAK,CAAA,GAAkB,MAAA;AAC/D,IAAA,SAAA,EAAW,eAAA,EAAgB;AAC3B,IAAA,IAAI,gBAAgB,YAAA,EAAc;AAChC,MAAA;AAAA,IACF;AACA,IAAA,eAAA,CAAgB,YAAA,EAAa;AAC7B,IAAA,OAAO,IAAA,CAAK,YAAA,CAAa,CAAC,MAAA,EAAQ,KAAA,KAAU;AAC1C,MAAA,MAAM,YAAA,GAAe,QAAA,CAAS,MAAA,EAAQ,KAAK,CAAA;AAC3C,MAAA,IAAI,wBAAwB,OAAA,EAAS;AACnC,QAAA,OAAO,YAAA,CAAa,KAAK,kBAAkB,CAAA;AAAA,MAC7C;AACA,MAAA,kBAAA,CAAmB,YAAY,CAAA;AAAA,IACjC,CAAC,EAAE,SAAS,CAAA;AAAA,EACd,CAAA;AAEA,EAAA,MAAM,yBAAyB,MAAM;AACnC,IAAA,mBAAA,CAAoB,OAAA,IAAU;AAAA,EAChC,CAAA;AAEA,EAAA,MAAM,sBAAsB,eAAA,CAAgB;AAAA,IAC1C,GAAA;AAAA,IACA;AAAA,GACD,CAAA;AAED,EAAA,uBACE,IAAA,CAACA,YAAA,EAAA,EAAwB,GAAG,IAAA,EAC1B,QAAA,EAAA;AAAA,oBAAA,GAAA;AAAA,MAAC,mBAAA;AAAA,MAAA;AAAA,QACC,IAAA;AAAA,QACA,UAAA;AAAA,QACA,EAAA,EAAI,MAAA;AAAA,QACJ,sBAAA;AAAA,QACA,mBAAA;AAAA,QAEA,QAAA,kBAAA,GAAA;AAAA,UAAC,aAAA;AAAA,UAAA;AAAA,YACE,GAAG,SAAA;AAAA,YACJ,GAAA,EAAK,mBAAA;AAAA,YACL,EAAA,EAAI,MAAA;AAAA,YACJ,QAAA,EAAU,YAAA;AAAA,YAET;AAAA;AAAA;AACH;AAAA,KACF;AAAA,wBACC,0BAAA,EAAA,EAA2B;AAAA,GAAA,EAC9B,CAAA;AAEJ;;;;"}
|
|
@@ -14,7 +14,8 @@ const FormContextProvider = (props) => {
|
|
|
14
14
|
id,
|
|
15
15
|
isReadOnly: isReadOnlyProp = false,
|
|
16
16
|
onAfterSuccessFeedback,
|
|
17
|
-
children
|
|
17
|
+
children,
|
|
18
|
+
rootErrorController
|
|
18
19
|
} = props;
|
|
19
20
|
const [isReadOnlyState, setReadOnly] = useState(isReadOnlyProp);
|
|
20
21
|
const isReadOnly = isReadOnlyProp || isReadOnlyState;
|
|
@@ -30,7 +31,8 @@ const FormContextProvider = (props) => {
|
|
|
30
31
|
setReadOnly,
|
|
31
32
|
id,
|
|
32
33
|
form,
|
|
33
|
-
onAfterSuccessFeedback
|
|
34
|
+
onAfterSuccessFeedback,
|
|
35
|
+
rootErrorController
|
|
34
36
|
},
|
|
35
37
|
children
|
|
36
38
|
}
|
|
@@ -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 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":";;;;;
|
|
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\";\nimport { type FormRootErrorController } from \"../FormRootError/useFormRootErrorController\";\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 rootErrorController: FormRootErrorController;\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 rootErrorController: FormRootErrorController;\n}\n\nexport const FormContextProvider = (props: FormContextProviderProps) => {\n const {\n form,\n id,\n isReadOnly: isReadOnlyProp = false,\n onAfterSuccessFeedback,\n children,\n rootErrorController,\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 rootErrorController,\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":";;;;;AAuBO,MAAM,WAAA,GAAc,aAAA;AAAA,EACzB;AACF;AAUO,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,QAAA;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,sBAAA;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,8 +1,12 @@
|
|
|
1
1
|
"use client"
|
|
2
2
|
/* */
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
3
|
+
import '../../../../components/Action/Action.mjs';
|
|
4
|
+
import { AbortActionError } from '../../../../components/Action/AbortActionError.mjs';
|
|
5
|
+
import 'react/jsx-runtime';
|
|
6
|
+
import 'react-aria';
|
|
5
7
|
import { useRef, useEffect } from 'react';
|
|
8
|
+
import '@react-aria/live-announcer';
|
|
9
|
+
import { ActionModel } from '../../../../components/Action/models/ActionModel.mjs';
|
|
6
10
|
|
|
7
11
|
const useFormSubmitAction = (formState, actionProps) => {
|
|
8
12
|
const { isSubmitting, isSubmitSuccessful } = formState;
|
|
@@ -27,7 +31,7 @@ const useFormSubmitAction = (formState, actionProps) => {
|
|
|
27
31
|
return;
|
|
28
32
|
}
|
|
29
33
|
submitPromise.current?.reject(
|
|
30
|
-
new
|
|
34
|
+
new AbortActionError("Form submission failed")
|
|
31
35
|
);
|
|
32
36
|
}, [isSubmitting, isSubmitSuccessful, submitPromise]);
|
|
33
37
|
return formSubmitAction;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFormSubmitAction.mjs","sources":["../../../../../../../../src/integrations/react-hook-form/components/FormContextProvider/useFormSubmitAction.ts"],"sourcesContent":["import type
|
|
1
|
+
{"version":3,"file":"useFormSubmitAction.mjs","sources":["../../../../../../../../src/integrations/react-hook-form/components/FormContextProvider/useFormSubmitAction.ts"],"sourcesContent":["import { AbortActionError, type ActionProps } from \"@/components/Action\";\nimport { ActionModel } from \"@/components/Action/models/ActionModel\";\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 AbortActionError(\"Form submission failed\"),\n );\n }, [isSubmitting, isSubmitSuccessful, submitPromise]);\n\n return formSubmitAction;\n};\n"],"names":[],"mappings":";;;;;;;;AAKO,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,16 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
/* */
|
|
3
|
+
import { jsx } from 'react/jsx-runtime';
|
|
4
|
+
import { useFormContext } from '../FormContextProvider/FormContextProvider.mjs';
|
|
5
|
+
import FieldErrorView from '../../../../views/FieldErrorView.mjs';
|
|
6
|
+
import { useMountedFormRootErrorComponent } from './useMountedFormRootErrorComponent.mjs';
|
|
7
|
+
|
|
8
|
+
const FormRootError = () => {
|
|
9
|
+
const form = useFormContext().form;
|
|
10
|
+
useMountedFormRootErrorComponent();
|
|
11
|
+
const error = form.formState.errors.root;
|
|
12
|
+
return /* @__PURE__ */ jsx(FieldErrorView, { children: error?.message });
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export { FormRootError };
|
|
16
|
+
//# sourceMappingURL=FormRootError.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormRootError.mjs","sources":["../../../../../../../../src/integrations/react-hook-form/components/FormRootError/FormRootError.tsx"],"sourcesContent":["import type { FC } from \"react\";\nimport { useFormContext } from \"../FormContextProvider\";\nimport FieldErrorView from \"@/views/FieldErrorView\";\nimport { useMountedFormRootErrorComponent } from \"./useMountedFormRootErrorComponent\";\n\nexport const FormRootError: FC = () => {\n const form = useFormContext().form;\n useMountedFormRootErrorComponent();\n const error = form.formState.errors.root;\n return <FieldErrorView>{error?.message}</FieldErrorView>;\n};\n\nexport default FormRootError;\n"],"names":[],"mappings":";;;;;AAKO,MAAM,gBAAoB,MAAM;AACrC,EAAA,MAAM,IAAA,GAAO,gBAAe,CAAE,IAAA;AAC9B,EAAA,gCAAA,EAAiC;AACjC,EAAA,MAAM,KAAA,GAAQ,IAAA,CAAK,SAAA,CAAU,MAAA,CAAO,IAAA;AACpC,EAAA,uBAAO,GAAA,CAAC,cAAA,EAAA,EAAgB,QAAA,EAAA,KAAA,EAAO,OAAA,EAAQ,CAAA;AACzC;;;;"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
/* */
|
|
3
|
+
import { useState, useMemo } from 'react';
|
|
4
|
+
|
|
5
|
+
const useFormRootErrorController = () => {
|
|
6
|
+
const [errorComponentMounted, updateErrorComponentMounted] = useState(false);
|
|
7
|
+
return useMemo(
|
|
8
|
+
() => ({
|
|
9
|
+
errorComponentMounted,
|
|
10
|
+
updateErrorComponentMounted
|
|
11
|
+
}),
|
|
12
|
+
[errorComponentMounted, updateErrorComponentMounted]
|
|
13
|
+
);
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export { useFormRootErrorController };
|
|
17
|
+
//# sourceMappingURL=useFormRootErrorController.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFormRootErrorController.mjs","sources":["../../../../../../../../src/integrations/react-hook-form/components/FormRootError/useFormRootErrorController.ts"],"sourcesContent":["import { useMemo, useState, type Dispatch, type SetStateAction } from \"react\";\n\nexport interface FormRootErrorController {\n errorComponentMounted: boolean;\n updateErrorComponentMounted: Dispatch<SetStateAction<boolean>>;\n}\n\nexport const useFormRootErrorController = (): FormRootErrorController => {\n const [errorComponentMounted, updateErrorComponentMounted] = useState(false);\n\n return useMemo(\n () => ({\n errorComponentMounted,\n updateErrorComponentMounted,\n }),\n [errorComponentMounted, updateErrorComponentMounted],\n );\n};\n"],"names":[],"mappings":";;AAOO,MAAM,6BAA6B,MAA+B;AACvE,EAAA,MAAM,CAAC,qBAAA,EAAuB,2BAA2B,CAAA,GAAI,SAAS,KAAK,CAAA;AAE3E,EAAA,OAAO,OAAA;AAAA,IACL,OAAO;AAAA,MACL,qBAAA;AAAA,MACA;AAAA,KACF,CAAA;AAAA,IACA,CAAC,uBAAuB,2BAA2B;AAAA,GACrD;AACF;;;;"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
/* */
|
|
3
|
+
import { useEffect } from 'react';
|
|
4
|
+
import { useFormContext } from '../FormContextProvider/FormContextProvider.mjs';
|
|
5
|
+
|
|
6
|
+
const useMountedFormRootErrorComponent = () => {
|
|
7
|
+
const controller = useFormContext().rootErrorController;
|
|
8
|
+
useEffect(() => {
|
|
9
|
+
controller.updateErrorComponentMounted(true);
|
|
10
|
+
return () => {
|
|
11
|
+
controller.updateErrorComponentMounted(false);
|
|
12
|
+
};
|
|
13
|
+
}, [controller]);
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export { useMountedFormRootErrorComponent };
|
|
17
|
+
//# sourceMappingURL=useMountedFormRootErrorComponent.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useMountedFormRootErrorComponent.mjs","sources":["../../../../../../../../src/integrations/react-hook-form/components/FormRootError/useMountedFormRootErrorComponent.ts"],"sourcesContent":["import { useEffect } from \"react\";\nimport { useFormContext } from \"../FormContextProvider\";\n\nexport const useMountedFormRootErrorComponent = () => {\n const controller = useFormContext().rootErrorController;\n\n useEffect(() => {\n controller.updateErrorComponentMounted(true);\n return () => {\n controller.updateErrorComponentMounted(false);\n };\n }, [controller]);\n};\n"],"names":[],"mappings":";;;AAGO,MAAM,mCAAmC,MAAM;AACpD,EAAA,MAAM,UAAA,GAAa,gBAAe,CAAE,mBAAA;AAEpC,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,UAAA,CAAW,4BAA4B,IAAI,CAAA;AAC3C,IAAA,OAAO,MAAM;AACX,MAAA,UAAA,CAAW,4BAA4B,KAAK,CAAA;AAAA,IAC9C,CAAA;AAAA,EACF,CAAA,EAAG,CAAC,UAAU,CAAC,CAAA;AACjB;;;;"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
/* */
|
|
3
|
+
class FormRootError extends Error {
|
|
4
|
+
type;
|
|
5
|
+
constructor(fieldError) {
|
|
6
|
+
super(fieldError.message);
|
|
7
|
+
this.name = "FormRootError";
|
|
8
|
+
this.type = fieldError.type;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export { FormRootError };
|
|
13
|
+
//# sourceMappingURL=FormRootError.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormRootError.mjs","sources":["../../../../../../../src/integrations/react-hook-form/lib/FormRootError.ts"],"sourcesContent":["import type { FieldError } from \"react-hook-form\";\n\nexport class FormRootError extends Error {\n public readonly type: string;\n\n public constructor(fieldError: FieldError) {\n super(fieldError.message);\n this.name = \"FormRootError\";\n this.type = fieldError.type;\n }\n}\n"],"names":[],"mappings":"AAEO,MAAM,sBAAsB,KAAA,CAAM;AAAA,EACvB,IAAA;AAAA,EAET,YAAY,UAAA,EAAwB;AACzC,IAAA,KAAA,CAAM,WAAW,OAAO,CAAA;AACxB,IAAA,IAAA,CAAK,IAAA,GAAO,eAAA;AACZ,IAAA,IAAA,CAAK,OAAO,UAAA,CAAW,IAAA;AAAA,EACzB;AACF;;;;"}
|
package/dist/js/default.mjs
CHANGED
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
export { AccentBox } from './components/src/components/AccentBox/AccentBox.mjs';
|
|
4
4
|
export { Accordion } from './components/src/components/Accordion/Accordion.mjs';
|
|
5
5
|
export { Action } from './components/src/components/Action/Action.mjs';
|
|
6
|
-
export {
|
|
6
|
+
export { AbortActionError } from './components/src/components/Action/AbortActionError.mjs';
|
|
7
|
+
export { abortAction } from './components/src/components/Action/lib/abortAction.mjs';
|
|
7
8
|
export { ActionBatch } from './components/src/components/Action/ActionBatch.mjs';
|
|
8
9
|
export { useAriaAnnounceSuspense } from './components/src/components/Action/lib/ariaLive.mjs';
|
|
9
10
|
export { ActionGroup } from './components/src/components/ActionGroup/ActionGroup.mjs';
|
package/dist/js/default.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"default.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"default.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -4,6 +4,7 @@ export { Field, typedField } from './components/src/integrations/react-hook-form
|
|
|
4
4
|
export { Form } from './components/src/integrations/react-hook-form/components/Form/Form.mjs';
|
|
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
|
+
export { FormRootError } from './components/src/integrations/react-hook-form/components/FormRootError/FormRootError.mjs';
|
|
7
8
|
export { useFormContext, useOptionalFormContext } from './components/src/integrations/react-hook-form/components/FormContextProvider/FormContextProvider.mjs';
|
|
8
9
|
export { FormAction } from './components/src/integrations/react-hook-form/components/FormAction/FormAction.mjs';
|
|
9
10
|
export { flags } from './components/src/integrations/react-hook-form/flags.mjs';
|
|
@@ -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 @@
|
|
|
1
|
+
{"version":3,"file":"AbortActionError.d.ts","sourceRoot":"","sources":["../../../../src/components/Action/AbortActionError.ts"],"names":[],"mappings":"AAAA,qBAAa,gBAAiB,SAAQ,KAAK;gBACtB,OAAO,CAAC,EAAE,MAAM;WAKrB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,gBAAgB;WAI7D,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI;CAKxD"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { Action } from './Action';
|
|
2
|
-
export {
|
|
2
|
+
export { AbortActionError } from './AbortActionError';
|
|
3
|
+
export { abortAction } from './lib/abortAction';
|
|
3
4
|
export { ActionBatch } from './ActionBatch';
|
|
4
5
|
export * from './types';
|
|
5
6
|
export { default } from './Action';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/Action/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACnC,OAAO,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/Action/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACnC,OAAO,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"abortAction.d.ts","sourceRoot":"","sources":["../../../../../src/components/Action/lib/abortAction.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,WAAW,EAAE,CAAC,OAAO,CAAC,EAAE,MAAM,KAAK,KAE/C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Form.d.ts","sourceRoot":"","sources":["../../../../../../src/integrations/react-hook-form/components/Form/Form.tsx"],"names":[],"mappings":"AAKA,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,EAAE,EAEP,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,GAAG,EAIT,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EACV,WAAW,
|
|
1
|
+
{"version":3,"file":"Form.d.ts","sourceRoot":"","sources":["../../../../../../src/integrations/react-hook-form/components/Form/Form.tsx"],"names":[],"mappings":"AAKA,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,EAAE,EAEP,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,GAAG,EAIT,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EACV,WAAW,EAEX,aAAa,EACb,aAAa,EACd,MAAM,iBAAiB,CAAC;AAKzB,MAAM,MAAM,mBAAmB,CAAC,CAAC,SAAS,WAAW,IAAI,aAAa,CAAC,CAAC,CAAC,CAAC;AAE1E,MAAM,MAAM,uBAAuB,GAAG,CAAC,GAAG,WAAW,EAAE,OAAO,EAAE,KAAK,OAAO,CAAC;AAE7E,MAAM,WAAW,oBAAoB;IACnC,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED,KAAK,iBAAiB,GAAG,EAAE,CACzB,iBAAiB,CAAC;IAChB,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,CAAC,EAAE,gBAAgB,GAAG,mBAAmB,CAAC,KAAK,CAAC,CAAC;IACzD,GAAG,CAAC,EAAE,GAAG,CAAC,eAAe,CAAC,CAAC;CAC5B,CAAC,CACH,CAAC;AAEF,MAAM,WAAW,SAAS,CAAC,CAAC,SAAS,WAAW,CAC9C,SAAQ,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,UAAU,CAAC,EAAE,iBAAiB;IACnE,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC;IACvB,QAAQ,EAAE,mBAAmB,CAAC,CAAC,CAAC,CAAC;IACjC,aAAa,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,iBAAiB,EAAE,KAAK,CAAC,CAAC,CAAC;IACnD,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,SAAS,CAAC,EAAE,oBAAoB,GAAG,OAAO,CAAC;CAC5C;AAID,wBAAgB,IAAI,CAAC,CAAC,SAAS,WAAW,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC,2CA4F9D;AAED,eAAe,IAAI,CAAC"}
|
|
@@ -9,4 +9,5 @@ export declare const WithHandledSubmitError: Story;
|
|
|
9
9
|
export declare const WithUnhandledSubmitError: Story;
|
|
10
10
|
export declare const WithUnhandledSubmitErrorSync: Story;
|
|
11
11
|
export declare const WithValidationError: Story;
|
|
12
|
+
export declare const WithRootError: Story;
|
|
12
13
|
//# sourceMappingURL=Form.stories.d.ts.map
|
package/dist/types/integrations/react-hook-form/components/Form/stories/Form.stories.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Form.stories.d.ts","sourceRoot":"","sources":["../../../../../../../src/integrations/react-hook-form/components/Form/stories/Form.stories.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,IAAI,EAAE,MAAM,qDAAqD,CAAC;AAE3E,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"Form.stories.d.ts","sourceRoot":"","sources":["../../../../../../../src/integrations/react-hook-form/components/Form/stories/Form.stories.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,IAAI,EAAE,MAAM,qDAAqD,CAAC;AAE3E,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAwBvD,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,IAAI,CA2B3B,CAAC;AAEF,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,OAAO,EAAE,KAAU,CAAC;AAEjC,eAAO,MAAM,QAAQ,EAAE,KAAsC,CAAC;AAE9D,eAAO,MAAM,sBAAsB,EAAE,KAgCpC,CAAC;AAEF,eAAO,MAAM,wBAAwB,EAAE,KAwBtC,CAAC;AAEF,eAAO,MAAM,4BAA4B,EAAE,KAwB1C,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,KAgCjC,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,KAmC3B,CAAC"}
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { FieldValues, UseFormReturn } from 'react-hook-form';
|
|
2
2
|
import { Dispatch, PropsWithChildren, SetStateAction } from 'react';
|
|
3
3
|
import { AfterFormSubmitCallback } from '../Form/Form';
|
|
4
|
+
import { FormRootErrorController } from '../FormRootError/useFormRootErrorController';
|
|
4
5
|
interface FormContext<F extends FieldValues> {
|
|
5
6
|
form: UseFormReturn<F>;
|
|
6
7
|
id: string;
|
|
7
8
|
isReadOnly: boolean;
|
|
8
9
|
setReadOnly: Dispatch<SetStateAction<boolean>>;
|
|
9
10
|
onAfterSuccessFeedback?: AfterFormSubmitCallback;
|
|
11
|
+
rootErrorController: FormRootErrorController;
|
|
10
12
|
}
|
|
11
13
|
export declare const FormContext: import('react').Context<FormContext<FieldValues> | undefined>;
|
|
12
14
|
export interface FormContextProviderProps extends PropsWithChildren {
|
|
@@ -14,6 +16,7 @@ export interface FormContextProviderProps extends PropsWithChildren {
|
|
|
14
16
|
id: string;
|
|
15
17
|
isReadOnly?: boolean;
|
|
16
18
|
onAfterSuccessFeedback?: AfterFormSubmitCallback;
|
|
19
|
+
rootErrorController: FormRootErrorController;
|
|
17
20
|
}
|
|
18
21
|
export declare const FormContextProvider: (props: FormContextProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
19
22
|
export declare const useFormContext: <F extends FieldValues>() => FormContext<F>;
|
|
@@ -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;AAEf,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qDAAqD,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;AAEnG,OAAO,EAAE,KAAK,uBAAuB,EAAE,MAAM,6CAA6C,CAAC;AAE3F,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;IACjD,mBAAmB,EAAE,uBAAuB,CAAC;CAC9C;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;IACjD,mBAAmB,EAAE,uBAAuB,CAAC;CAC9C;AAED,eAAO,MAAM,mBAAmB,GAAI,OAAO,wBAAwB,4CA+BlE,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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFormSubmitAction.d.ts","sourceRoot":"","sources":["../../../../../../src/integrations/react-hook-form/components/FormContextProvider/useFormSubmitAction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"useFormSubmitAction.d.ts","sourceRoot":"","sources":["../../../../../../src/integrations/react-hook-form/components/FormContextProvider/useFormSubmitAction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACzE,OAAO,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAC;AAErE,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"}
|
package/dist/types/integrations/react-hook-form/components/FormRootError/FormRootError.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormRootError.d.ts","sourceRoot":"","sources":["../../../../../../src/integrations/react-hook-form/components/FormRootError/FormRootError.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAKhC,eAAO,MAAM,aAAa,EAAE,EAK3B,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/integrations/react-hook-form/components/FormRootError/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Dispatch, SetStateAction } from 'react';
|
|
2
|
+
export interface FormRootErrorController {
|
|
3
|
+
errorComponentMounted: boolean;
|
|
4
|
+
updateErrorComponentMounted: Dispatch<SetStateAction<boolean>>;
|
|
5
|
+
}
|
|
6
|
+
export declare const useFormRootErrorController: () => FormRootErrorController;
|
|
7
|
+
//# sourceMappingURL=useFormRootErrorController.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFormRootErrorController.d.ts","sourceRoot":"","sources":["../../../../../../src/integrations/react-hook-form/components/FormRootError/useFormRootErrorController.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,QAAQ,EAAE,KAAK,cAAc,EAAE,MAAM,OAAO,CAAC;AAE9E,MAAM,WAAW,uBAAuB;IACtC,qBAAqB,EAAE,OAAO,CAAC;IAC/B,2BAA2B,EAAE,QAAQ,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;CAChE;AAED,eAAO,MAAM,0BAA0B,QAAO,uBAU7C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useMountedFormRootErrorComponent.d.ts","sourceRoot":"","sources":["../../../../../../src/integrations/react-hook-form/components/FormRootError/useMountedFormRootErrorComponent.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,gCAAgC,YAS5C,CAAC"}
|
|
@@ -2,6 +2,7 @@ export * from './components/Field';
|
|
|
2
2
|
export * from './components/Form';
|
|
3
3
|
export * from './components/SubmitButton';
|
|
4
4
|
export * from './components/ResetButton';
|
|
5
|
+
export * from './components/FormRootError';
|
|
5
6
|
export { useFormContext, useOptionalFormContext, } from './components/FormContextProvider';
|
|
6
7
|
export * from './components/FormAction';
|
|
7
8
|
export { flags } from './flags';
|
|
@@ -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;AAC1C,cAAc,yBAAyB,CAAC;AACxC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,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,cAAc,4BAA4B,CAAC;AAC3C,OAAO,EACL,cAAc,EACd,sBAAsB,GACvB,MAAM,kCAAkC,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormRootError.d.ts","sourceRoot":"","sources":["../../../../../src/integrations/react-hook-form/lib/FormRootError.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD,qBAAa,aAAc,SAAQ,KAAK;IACtC,SAAgB,IAAI,EAAE,MAAM,CAAC;gBAEV,UAAU,EAAE,UAAU;CAK1C"}
|
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.712",
|
|
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.712",
|
|
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.712",
|
|
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": "d8a29bc80fb5abda5195ee2174546904e0b02100"
|
|
176
176
|
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use client"
|
|
2
|
-
/* */
|
|
3
|
-
class MutedActionError extends Error {
|
|
4
|
-
constructor(message) {
|
|
5
|
-
super(message);
|
|
6
|
-
this.name = "MutedActionError";
|
|
7
|
-
}
|
|
8
|
-
static isMutedActionError(error) {
|
|
9
|
-
return error instanceof MutedActionError;
|
|
10
|
-
}
|
|
11
|
-
static rethrowIfNotMuted(error) {
|
|
12
|
-
if (!MutedActionError.isMutedActionError(error)) {
|
|
13
|
-
throw error;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export { MutedActionError };
|
|
19
|
-
//# sourceMappingURL=MutedActionError.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MutedActionError.mjs","sources":["../../../../../../src/components/Action/MutedActionError.ts"],"sourcesContent":["export class MutedActionError extends Error {\n public constructor(message?: string) {\n super(message);\n this.name = \"MutedActionError\";\n }\n\n public static isMutedActionError(error: unknown): error is MutedActionError {\n return error instanceof MutedActionError;\n }\n\n public static rethrowIfNotMuted(error: unknown): void {\n if (!MutedActionError.isMutedActionError(error)) {\n throw error;\n }\n }\n}\n"],"names":[],"mappings":"AAAO,MAAM,yBAAyB,KAAA,CAAM;AAAA,EACnC,YAAY,OAAA,EAAkB;AACnC,IAAA,KAAA,CAAM,OAAO,CAAA;AACb,IAAA,IAAA,CAAK,IAAA,GAAO,kBAAA;AAAA,EACd;AAAA,EAEA,OAAc,mBAAmB,KAAA,EAA2C;AAC1E,IAAA,OAAO,KAAA,YAAiB,gBAAA;AAAA,EAC1B;AAAA,EAEA,OAAc,kBAAkB,KAAA,EAAsB;AACpD,IAAA,IAAI,CAAC,gBAAA,CAAiB,kBAAA,CAAmB,KAAK,CAAA,EAAG;AAC/C,MAAA,MAAM,KAAA;AAAA,IACR;AAAA,EACF;AACF;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MutedActionError.d.ts","sourceRoot":"","sources":["../../../../src/components/Action/MutedActionError.ts"],"names":[],"mappings":"AAAA,qBAAa,gBAAiB,SAAQ,KAAK;gBACtB,OAAO,CAAC,EAAE,MAAM;WAKrB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,gBAAgB;WAI7D,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI;CAKtD"}
|