@mittwald/flow-react-components 0.2.0-alpha.710 → 0.2.0-alpha.711

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.
Files changed (34) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/assets/doc-properties.json +1522 -1495
  3. package/dist/js/components/src/integrations/react-hook-form/components/Form/Form.mjs +8 -0
  4. package/dist/js/components/src/integrations/react-hook-form/components/Form/Form.mjs.map +1 -1
  5. package/dist/js/components/src/integrations/react-hook-form/components/FormContextProvider/FormContextProvider.mjs +4 -2
  6. package/dist/js/components/src/integrations/react-hook-form/components/FormContextProvider/FormContextProvider.mjs.map +1 -1
  7. package/dist/js/components/src/integrations/react-hook-form/components/FormRootError/FormRootError.mjs +16 -0
  8. package/dist/js/components/src/integrations/react-hook-form/components/FormRootError/FormRootError.mjs.map +1 -0
  9. package/dist/js/components/src/integrations/react-hook-form/components/FormRootError/useFormRootErrorController.mjs +17 -0
  10. package/dist/js/components/src/integrations/react-hook-form/components/FormRootError/useFormRootErrorController.mjs.map +1 -0
  11. package/dist/js/components/src/integrations/react-hook-form/components/FormRootError/useMountedFormRootErrorComponent.mjs +17 -0
  12. package/dist/js/components/src/integrations/react-hook-form/components/FormRootError/useMountedFormRootErrorComponent.mjs.map +1 -0
  13. package/dist/js/components/src/integrations/react-hook-form/lib/FormRootError.mjs +13 -0
  14. package/dist/js/components/src/integrations/react-hook-form/lib/FormRootError.mjs.map +1 -0
  15. package/dist/js/react-hook-form.mjs +1 -0
  16. package/dist/js/react-hook-form.mjs.map +1 -1
  17. package/dist/types/integrations/react-hook-form/components/Form/Form.d.ts.map +1 -1
  18. package/dist/types/integrations/react-hook-form/components/Form/stories/Form.stories.d.ts +1 -0
  19. package/dist/types/integrations/react-hook-form/components/Form/stories/Form.stories.d.ts.map +1 -1
  20. package/dist/types/integrations/react-hook-form/components/FormContextProvider/FormContextProvider.d.ts +3 -0
  21. package/dist/types/integrations/react-hook-form/components/FormContextProvider/FormContextProvider.d.ts.map +1 -1
  22. package/dist/types/integrations/react-hook-form/components/FormRootError/FormRootError.d.ts +4 -0
  23. package/dist/types/integrations/react-hook-form/components/FormRootError/FormRootError.d.ts.map +1 -0
  24. package/dist/types/integrations/react-hook-form/components/FormRootError/index.d.ts +3 -0
  25. package/dist/types/integrations/react-hook-form/components/FormRootError/index.d.ts.map +1 -0
  26. package/dist/types/integrations/react-hook-form/components/FormRootError/useFormRootErrorController.d.ts +7 -0
  27. package/dist/types/integrations/react-hook-form/components/FormRootError/useFormRootErrorController.d.ts.map +1 -0
  28. package/dist/types/integrations/react-hook-form/components/FormRootError/useMountedFormRootErrorComponent.d.ts +2 -0
  29. package/dist/types/integrations/react-hook-form/components/FormRootError/useMountedFormRootErrorComponent.d.ts.map +1 -0
  30. package/dist/types/integrations/react-hook-form/index.d.ts +1 -0
  31. package/dist/types/integrations/react-hook-form/index.d.ts.map +1 -1
  32. package/dist/types/integrations/react-hook-form/lib/FormRootError.d.ts +6 -0
  33. package/dist/types/integrations/react-hook-form/lib/FormRootError.d.ts.map +1 -0
  34. package/package.json +4 -4
@@ -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":"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"}
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":"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"}
@@ -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":";;;;;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
+ {"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;;;;"}
@@ -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;;;;"}
@@ -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":";;;;;;;"}
@@ -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,EACX,aAAa,EACb,aAAa,EACd,MAAM,iBAAiB,CAAC;AAGzB,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,2CAsF9D;AAED,eAAe,IAAI,CAAC"}
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
@@ -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;AAuBvD,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"}
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;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
+ {"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"}
@@ -0,0 +1,4 @@
1
+ import { FC } from 'react';
2
+ export declare const FormRootError: FC;
3
+ export default FormRootError;
4
+ //# sourceMappingURL=FormRootError.d.ts.map
@@ -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,3 @@
1
+ export * from './FormRootError';
2
+ export { default } from './FormRootError';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -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,2 @@
1
+ export declare const useMountedFormRootErrorComponent: () => void;
2
+ //# sourceMappingURL=useMountedFormRootErrorComponent.d.ts.map
@@ -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,6 @@
1
+ import { FieldError } from 'react-hook-form';
2
+ export declare class FormRootError extends Error {
3
+ readonly type: string;
4
+ constructor(fieldError: FieldError);
5
+ }
6
+ //# sourceMappingURL=FormRootError.d.ts.map
@@ -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.710",
3
+ "version": "0.2.0-alpha.711",
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.710",
61
+ "@mittwald/react-tunnel": "0.2.0-alpha.711",
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.710",
107
+ "@mittwald/flow-design-tokens": "0.2.0-alpha.711",
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": "46e20d97be466f4e01cb1a877e2288a19a0a1e02"
175
+ "gitHead": "e859ca3a596887be8eec1e0461e60b6a174e8da3"
176
176
  }