@dnb/eufemia 10.48.0 → 10.49.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (159) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/cjs/components/height-animation/HeightAnimationInstance.d.ts +1 -0
  3. package/cjs/components/height-animation/HeightAnimationInstance.js +13 -6
  4. package/cjs/components/height-animation/HeightAnimationInstance.js.map +1 -1
  5. package/cjs/extensions/forms/DataContext/Context.d.ts +6 -4
  6. package/cjs/extensions/forms/DataContext/Context.js +1 -2
  7. package/cjs/extensions/forms/DataContext/Context.js.map +1 -1
  8. package/cjs/extensions/forms/DataContext/FieldBoundary/FieldBoundaryContext.d.ts +4 -0
  9. package/cjs/extensions/forms/DataContext/FieldBoundary/FieldBoundaryContext.js.map +1 -1
  10. package/cjs/extensions/forms/DataContext/FieldBoundary/FieldBoundaryProvider.js +13 -4
  11. package/cjs/extensions/forms/DataContext/FieldBoundary/FieldBoundaryProvider.js.map +1 -1
  12. package/cjs/extensions/forms/DataContext/Provider/Provider.d.ts +0 -4
  13. package/cjs/extensions/forms/DataContext/Provider/Provider.js +27 -28
  14. package/cjs/extensions/forms/DataContext/Provider/Provider.js.map +1 -1
  15. package/cjs/extensions/forms/Form/Isolation/Isolation.js +5 -4
  16. package/cjs/extensions/forms/Form/Isolation/Isolation.js.map +1 -1
  17. package/cjs/extensions/forms/Iterate/Array/Array.js +12 -6
  18. package/cjs/extensions/forms/Iterate/Array/Array.js.map +1 -1
  19. package/cjs/extensions/forms/Iterate/Array/ArrayDocs.js +6 -1
  20. package/cjs/extensions/forms/Iterate/Array/ArrayDocs.js.map +1 -1
  21. package/cjs/extensions/forms/Iterate/Array/ArrayItemArea.d.ts +1 -1
  22. package/cjs/extensions/forms/Iterate/Array/ArrayItemArea.js.map +1 -1
  23. package/cjs/extensions/forms/Iterate/Array/types.d.ts +1 -0
  24. package/cjs/extensions/forms/Iterate/Array/types.js.map +1 -1
  25. package/cjs/extensions/forms/Iterate/EditContainer/DoneButton.js +0 -1
  26. package/cjs/extensions/forms/Iterate/EditContainer/DoneButton.js.map +1 -1
  27. package/cjs/extensions/forms/Iterate/PushButton/PushButton.js +19 -7
  28. package/cjs/extensions/forms/Iterate/PushButton/PushButton.js.map +1 -1
  29. package/cjs/extensions/forms/Iterate/PushContainer/OpenButton.js +18 -2
  30. package/cjs/extensions/forms/Iterate/PushContainer/OpenButton.js.map +1 -1
  31. package/cjs/extensions/forms/Iterate/PushContainer/PushContainer.d.ts +2 -1
  32. package/cjs/extensions/forms/Iterate/PushContainer/PushContainer.js.map +1 -1
  33. package/cjs/extensions/forms/Iterate/PushContainer/PushContainerDocs.js +5 -0
  34. package/cjs/extensions/forms/Iterate/PushContainer/PushContainerDocs.js.map +1 -1
  35. package/cjs/extensions/forms/Iterate/RemoveButton/RemoveButton.js +3 -5
  36. package/cjs/extensions/forms/Iterate/RemoveButton/RemoveButton.js.map +1 -1
  37. package/cjs/extensions/forms/Wizard/Step/Step.d.ts +1 -1
  38. package/cjs/extensions/forms/Wizard/Step/Step.js.map +1 -1
  39. package/cjs/extensions/forms/hooks/useFieldProps.js +20 -14
  40. package/cjs/extensions/forms/hooks/useFieldProps.js.map +1 -1
  41. package/cjs/shared/Eufemia.d.ts +1 -1
  42. package/cjs/shared/Eufemia.js +2 -2
  43. package/cjs/shared/Eufemia.js.map +1 -1
  44. package/cjs/style/core/scopes.scss +1 -1
  45. package/cjs/style/dnb-ui-basis.css +1 -1
  46. package/cjs/style/dnb-ui-basis.min.css +1 -1
  47. package/cjs/style/dnb-ui-body.css +1 -1
  48. package/cjs/style/dnb-ui-body.min.css +1 -1
  49. package/cjs/style/dnb-ui-core.css +1 -1
  50. package/cjs/style/dnb-ui-core.min.css +1 -1
  51. package/components/height-animation/HeightAnimationInstance.d.ts +1 -0
  52. package/components/height-animation/HeightAnimationInstance.js +13 -6
  53. package/components/height-animation/HeightAnimationInstance.js.map +1 -1
  54. package/es/components/height-animation/HeightAnimationInstance.d.ts +1 -0
  55. package/es/components/height-animation/HeightAnimationInstance.js +13 -6
  56. package/es/components/height-animation/HeightAnimationInstance.js.map +1 -1
  57. package/es/extensions/forms/DataContext/Context.d.ts +6 -4
  58. package/es/extensions/forms/DataContext/Context.js +1 -2
  59. package/es/extensions/forms/DataContext/Context.js.map +1 -1
  60. package/es/extensions/forms/DataContext/FieldBoundary/FieldBoundaryContext.d.ts +4 -0
  61. package/es/extensions/forms/DataContext/FieldBoundary/FieldBoundaryContext.js.map +1 -1
  62. package/es/extensions/forms/DataContext/FieldBoundary/FieldBoundaryProvider.js +13 -4
  63. package/es/extensions/forms/DataContext/FieldBoundary/FieldBoundaryProvider.js.map +1 -1
  64. package/es/extensions/forms/DataContext/Provider/Provider.d.ts +0 -4
  65. package/es/extensions/forms/DataContext/Provider/Provider.js +27 -26
  66. package/es/extensions/forms/DataContext/Provider/Provider.js.map +1 -1
  67. package/es/extensions/forms/Form/Isolation/Isolation.js +5 -4
  68. package/es/extensions/forms/Form/Isolation/Isolation.js.map +1 -1
  69. package/es/extensions/forms/Iterate/Array/Array.js +14 -8
  70. package/es/extensions/forms/Iterate/Array/Array.js.map +1 -1
  71. package/es/extensions/forms/Iterate/Array/ArrayDocs.js +6 -1
  72. package/es/extensions/forms/Iterate/Array/ArrayDocs.js.map +1 -1
  73. package/es/extensions/forms/Iterate/Array/ArrayItemArea.d.ts +1 -1
  74. package/es/extensions/forms/Iterate/Array/ArrayItemArea.js.map +1 -1
  75. package/es/extensions/forms/Iterate/Array/types.d.ts +1 -0
  76. package/es/extensions/forms/Iterate/Array/types.js.map +1 -1
  77. package/es/extensions/forms/Iterate/EditContainer/DoneButton.js +0 -1
  78. package/es/extensions/forms/Iterate/EditContainer/DoneButton.js.map +1 -1
  79. package/es/extensions/forms/Iterate/PushButton/PushButton.js +20 -8
  80. package/es/extensions/forms/Iterate/PushButton/PushButton.js.map +1 -1
  81. package/es/extensions/forms/Iterate/PushContainer/OpenButton.js +19 -3
  82. package/es/extensions/forms/Iterate/PushContainer/OpenButton.js.map +1 -1
  83. package/es/extensions/forms/Iterate/PushContainer/PushContainer.d.ts +2 -1
  84. package/es/extensions/forms/Iterate/PushContainer/PushContainer.js.map +1 -1
  85. package/es/extensions/forms/Iterate/PushContainer/PushContainerDocs.js +5 -0
  86. package/es/extensions/forms/Iterate/PushContainer/PushContainerDocs.js.map +1 -1
  87. package/es/extensions/forms/Iterate/RemoveButton/RemoveButton.js +4 -6
  88. package/es/extensions/forms/Iterate/RemoveButton/RemoveButton.js.map +1 -1
  89. package/es/extensions/forms/Wizard/Step/Step.d.ts +1 -1
  90. package/es/extensions/forms/Wizard/Step/Step.js.map +1 -1
  91. package/es/extensions/forms/hooks/useFieldProps.js +20 -14
  92. package/es/extensions/forms/hooks/useFieldProps.js.map +1 -1
  93. package/es/shared/Eufemia.d.ts +1 -1
  94. package/es/shared/Eufemia.js +2 -2
  95. package/es/shared/Eufemia.js.map +1 -1
  96. package/es/style/core/scopes.scss +1 -1
  97. package/es/style/dnb-ui-basis.css +1 -1
  98. package/es/style/dnb-ui-basis.min.css +1 -1
  99. package/es/style/dnb-ui-body.css +1 -1
  100. package/es/style/dnb-ui-body.min.css +1 -1
  101. package/es/style/dnb-ui-core.css +1 -1
  102. package/es/style/dnb-ui-core.min.css +1 -1
  103. package/esm/dnb-ui-basis.min.mjs +1 -1
  104. package/esm/dnb-ui-components.min.mjs +1 -1
  105. package/esm/dnb-ui-elements.min.mjs +1 -1
  106. package/esm/dnb-ui-extensions.min.mjs +2 -2
  107. package/esm/dnb-ui-lib.min.mjs +1 -1
  108. package/extensions/forms/DataContext/Context.d.ts +6 -4
  109. package/extensions/forms/DataContext/Context.js +1 -2
  110. package/extensions/forms/DataContext/Context.js.map +1 -1
  111. package/extensions/forms/DataContext/FieldBoundary/FieldBoundaryContext.d.ts +4 -0
  112. package/extensions/forms/DataContext/FieldBoundary/FieldBoundaryContext.js.map +1 -1
  113. package/extensions/forms/DataContext/FieldBoundary/FieldBoundaryProvider.js +13 -4
  114. package/extensions/forms/DataContext/FieldBoundary/FieldBoundaryProvider.js.map +1 -1
  115. package/extensions/forms/DataContext/Provider/Provider.d.ts +0 -4
  116. package/extensions/forms/DataContext/Provider/Provider.js +27 -26
  117. package/extensions/forms/DataContext/Provider/Provider.js.map +1 -1
  118. package/extensions/forms/Form/Isolation/Isolation.js +5 -4
  119. package/extensions/forms/Form/Isolation/Isolation.js.map +1 -1
  120. package/extensions/forms/Iterate/Array/Array.js +14 -8
  121. package/extensions/forms/Iterate/Array/Array.js.map +1 -1
  122. package/extensions/forms/Iterate/Array/ArrayDocs.js +6 -1
  123. package/extensions/forms/Iterate/Array/ArrayDocs.js.map +1 -1
  124. package/extensions/forms/Iterate/Array/ArrayItemArea.d.ts +1 -1
  125. package/extensions/forms/Iterate/Array/ArrayItemArea.js.map +1 -1
  126. package/extensions/forms/Iterate/Array/types.d.ts +1 -0
  127. package/extensions/forms/Iterate/Array/types.js.map +1 -1
  128. package/extensions/forms/Iterate/EditContainer/DoneButton.js +0 -1
  129. package/extensions/forms/Iterate/EditContainer/DoneButton.js.map +1 -1
  130. package/extensions/forms/Iterate/PushButton/PushButton.js +20 -8
  131. package/extensions/forms/Iterate/PushButton/PushButton.js.map +1 -1
  132. package/extensions/forms/Iterate/PushContainer/OpenButton.js +19 -3
  133. package/extensions/forms/Iterate/PushContainer/OpenButton.js.map +1 -1
  134. package/extensions/forms/Iterate/PushContainer/PushContainer.d.ts +2 -1
  135. package/extensions/forms/Iterate/PushContainer/PushContainer.js.map +1 -1
  136. package/extensions/forms/Iterate/PushContainer/PushContainerDocs.js +5 -0
  137. package/extensions/forms/Iterate/PushContainer/PushContainerDocs.js.map +1 -1
  138. package/extensions/forms/Iterate/RemoveButton/RemoveButton.js +4 -6
  139. package/extensions/forms/Iterate/RemoveButton/RemoveButton.js.map +1 -1
  140. package/extensions/forms/Wizard/Step/Step.d.ts +1 -1
  141. package/extensions/forms/Wizard/Step/Step.js.map +1 -1
  142. package/extensions/forms/hooks/useFieldProps.js +20 -14
  143. package/extensions/forms/hooks/useFieldProps.js.map +1 -1
  144. package/package.json +1 -1
  145. package/shared/Eufemia.d.ts +1 -1
  146. package/shared/Eufemia.js +2 -2
  147. package/shared/Eufemia.js.map +1 -1
  148. package/style/core/scopes.scss +1 -1
  149. package/style/dnb-ui-basis.css +1 -1
  150. package/style/dnb-ui-basis.min.css +1 -1
  151. package/style/dnb-ui-body.css +1 -1
  152. package/style/dnb-ui-body.min.css +1 -1
  153. package/style/dnb-ui-core.css +1 -1
  154. package/style/dnb-ui-core.min.css +1 -1
  155. package/umd/dnb-ui-basis.min.js +1 -1
  156. package/umd/dnb-ui-components.min.js +1 -1
  157. package/umd/dnb-ui-elements.min.js +1 -1
  158. package/umd/dnb-ui-extensions.min.js +2 -2
  159. package/umd/dnb-ui-lib.min.js +1 -1
@@ -5,6 +5,9 @@ import { Props as ProviderProps } from './Provider';
5
5
  type HandleSubmitProps = {
6
6
  formElement?: HTMLFormElement;
7
7
  };
8
+ export type MountOptions = {
9
+ isMounted?: boolean;
10
+ };
8
11
  export type EventListenerCall = {
9
12
  path?: Path;
10
13
  type?: 'onSubmit' | 'onPathChange';
@@ -58,8 +61,7 @@ export interface ContextState {
58
61
  hasFieldError: (path: Path) => boolean;
59
62
  setFieldState: (path: Path, fieldState: SubmitState) => void;
60
63
  setFieldError: (path: Path, error: Error | FormError) => void;
61
- handleMountField: (path: Path) => void;
62
- handleUnMountField: (path: Path) => void;
64
+ setMountedFieldState: (path: Path, options: MountOptions) => void;
63
65
  setFormState?: (state: SubmitState) => void;
64
66
  setSubmitState?: (state: EventStateObject) => void;
65
67
  addOnChangeHandler?: (callback: OnChange) => void;
@@ -70,13 +72,13 @@ export interface ContextState {
70
72
  skipErrorCheck?: boolean;
71
73
  }) => void;
72
74
  setFieldEventListener?: (path: EventListenerCall['path'], type: EventListenerCall['type'], callback: EventListenerCall['callback']) => void;
73
- setHasVisibleError?: (path: Path, hasError: boolean) => void;
75
+ setVisibleError?: (path: Path, hasError: boolean) => void;
74
76
  setFieldProps?: (path: Path, props: unknown) => void;
75
77
  setValueProps?: (path: Path, props: unknown) => void;
76
78
  setHandleSubmit?: (callback: HandleSubmitCallback) => void;
77
79
  fieldPropsRef?: React.MutableRefObject<Record<string, FieldProps>>;
78
80
  valuePropsRef?: React.MutableRefObject<Record<string, ValueProps>>;
79
- mountedFieldPathsRef?: React.MutableRefObject<Path[]>;
81
+ mountedFieldsRef?: React.MutableRefObject<Record<Path, MountOptions>>;
80
82
  showAllErrors: boolean;
81
83
  hasVisibleError: boolean;
82
84
  formState: SubmitState;
@@ -19,8 +19,7 @@ export const defaultContextState = {
19
19
  setSubmitState: () => null,
20
20
  handleSubmitCall: () => null,
21
21
  setShowAllErrors: () => null,
22
- handleMountField: () => null,
23
- handleUnMountField: () => null,
22
+ setMountedFieldState: () => null,
24
23
  hasErrors: () => false,
25
24
  hasFieldState: () => false,
26
25
  hasFieldError: () => false,
@@ -1 +1 @@
1
- {"version":3,"file":"Context.js","names":["React","makeAjvInstance","defaultContextState","hasContext","data","undefined","schema","submitState","handlePathChange","handlePathChangeUnvalidated","updateDataValue","setData","validateData","handleSubmit","scrollToTop","showAllErrors","hasVisibleError","formState","setFormState","setSubmitState","handleSubmitCall","setShowAllErrors","handleMountField","handleUnMountField","hasErrors","hasFieldState","hasFieldError","setFieldState","setFieldError","ajvInstance","contextErrorMessages","isInsideFormElement","props","Context","createContext"],"sources":["../../../../../src/extensions/forms/DataContext/Context.ts"],"sourcesContent":["import React from 'react'\nimport { Ajv, makeAjvInstance } from '../utils/ajv'\nimport {\n AllJSONSchemaVersions,\n CustomErrorMessagesWithPaths,\n SubmitState,\n Path,\n EventStateObject,\n EventReturnWithStateObject,\n Identifier,\n FieldProps,\n FormError,\n ValueProps,\n OnChange,\n} from '../types'\nimport { Props as ProviderProps } from './Provider'\n\ntype HandleSubmitProps = {\n formElement?: HTMLFormElement\n}\n\nexport type EventListenerCall = {\n path?: Path\n type?: 'onSubmit' | 'onPathChange'\n callback: (params?: { value: unknown }) => void | Promise<void | Error>\n}\n\nexport type FilterDataHandler<Data> = (\n data: Data,\n filter: FilterData\n) => Partial<Data>\nexport type FilterDataHandlerCallback<R> = (\n parameters: FilterDataHandlerParameters\n) => R\nexport type FilterDataHandlerParameters =\n FilterDataPathConditionParameters & {\n path: Path\n }\nexport type FilterDataPathCondition<Data = unknown> = (\n parameters: FilterDataPathConditionParameters<Data>\n) => boolean | undefined\nexport type FilterDataPathConditionParameters<Data = unknown> = {\n value: unknown\n props: FieldProps\n data: Data\n internal: {\n error: Error | undefined\n }\n}\nexport type FilterDataPathObject<Data> = Record<\n Path,\n FilterDataPathCondition<Data> | boolean | undefined\n>\nexport type FilterData<Data = unknown> =\n | FilterDataPathObject<Data>\n | FilterDataHandlerCallback<boolean | undefined>\nexport type TransformData = FilterDataHandlerCallback<unknown>\nexport type HandleSubmitCallback = ({\n preventSubmit,\n}: {\n preventSubmit: () => void\n}) => void\n\nexport interface ContextState {\n id?: Identifier\n hasContext: boolean\n /** The dataset for the form / form wizard */\n data: any\n internalDataRef?: React.MutableRefObject<any>\n /** Should the form validate data before submitting? */\n errors?: Record<string, Error>\n /** Will set autoComplete=\"on\" on each nested Field.String and Field.Number */\n autoComplete?: boolean\n handlePathChange: (\n path: Path,\n value?: any\n ) =>\n | EventReturnWithStateObject\n | unknown\n | Promise<EventReturnWithStateObject | unknown>\n handlePathChangeUnvalidated: (path: Path, value: any) => void\n updateDataValue: (path: Path, value: any) => void\n setData: (data: any) => void\n clearData?: () => void\n mutateDataHandler?: (data: any, mutate: TransformData) => any\n filterDataHandler?: (data: any, filter: FilterData) => any\n validateData: () => void\n handleSubmit: (props?: HandleSubmitProps) => any\n scrollToTop: () => void\n setShowAllErrors: (showAllErrors: boolean) => void\n hasErrors: () => boolean\n hasFieldState: (state: SubmitState) => boolean\n hasFieldError: (path: Path) => boolean\n setFieldState: (path: Path, fieldState: SubmitState) => void\n setFieldError: (path: Path, error: Error | FormError) => void\n handleMountField: (path: Path) => void\n handleUnMountField: (path: Path) => void\n setFormState?: (state: SubmitState) => void\n setSubmitState?: (state: EventStateObject) => void\n addOnChangeHandler?: (callback: OnChange) => void\n handleSubmitCall: ({\n onSubmit,\n enableAsyncBehavior,\n skipFieldValidation,\n skipErrorCheck,\n }: {\n onSubmit: () =>\n | EventReturnWithStateObject\n | void\n | Promise<EventReturnWithStateObject | void>\n enableAsyncBehavior: boolean\n skipFieldValidation?: boolean\n skipErrorCheck?: boolean\n }) => void\n setFieldEventListener?: (\n path: EventListenerCall['path'],\n type: EventListenerCall['type'],\n callback: EventListenerCall['callback']\n ) => void\n setHasVisibleError?: (path: Path, hasError: boolean) => void\n setFieldProps?: (path: Path, props: unknown) => void\n setValueProps?: (path: Path, props: unknown) => void\n setHandleSubmit?: (callback: HandleSubmitCallback) => void\n fieldPropsRef?: React.MutableRefObject<Record<string, FieldProps>>\n valuePropsRef?: React.MutableRefObject<Record<string, ValueProps>>\n mountedFieldPathsRef?: React.MutableRefObject<Path[]>\n showAllErrors: boolean\n hasVisibleError: boolean\n formState: SubmitState\n ajvInstance: Ajv\n contextErrorMessages: CustomErrorMessagesWithPaths\n schema: AllJSONSchemaVersions\n path?: Path\n disabled?: boolean\n required?: boolean\n submitState: Partial<EventStateObject>\n isInsideFormElement?: boolean\n prerenderFieldProps?: boolean\n props: ProviderProps<unknown>\n}\n\nexport const defaultContextState: ContextState = {\n hasContext: false,\n data: undefined,\n schema: undefined,\n submitState: undefined,\n handlePathChange: () => null,\n handlePathChangeUnvalidated: () => null,\n updateDataValue: () => null,\n setData: () => null,\n validateData: () => null,\n handleSubmit: () => null,\n scrollToTop: () => null,\n showAllErrors: false,\n hasVisibleError: false,\n formState: undefined,\n setFormState: () => null,\n setSubmitState: () => null,\n handleSubmitCall: () => null,\n setShowAllErrors: () => null,\n handleMountField: () => null,\n handleUnMountField: () => null,\n hasErrors: () => false,\n hasFieldState: () => false,\n hasFieldError: () => false,\n setFieldState: () => null,\n setFieldError: () => null,\n ajvInstance: makeAjvInstance(),\n contextErrorMessages: undefined,\n isInsideFormElement: false,\n props: null,\n}\n\nconst Context = React.createContext<ContextState>(defaultContextState)\n\nexport default Context\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAAcC,eAAe,QAAQ,cAAc;AA4InD,OAAO,MAAMC,mBAAiC,GAAG;EAC/CC,UAAU,EAAE,KAAK;EACjBC,IAAI,EAAEC,SAAS;EACfC,MAAM,EAAED,SAAS;EACjBE,WAAW,EAAEF,SAAS;EACtBG,gBAAgB,EAAEA,CAAA,KAAM,IAAI;EAC5BC,2BAA2B,EAAEA,CAAA,KAAM,IAAI;EACvCC,eAAe,EAAEA,CAAA,KAAM,IAAI;EAC3BC,OAAO,EAAEA,CAAA,KAAM,IAAI;EACnBC,YAAY,EAAEA,CAAA,KAAM,IAAI;EACxBC,YAAY,EAAEA,CAAA,KAAM,IAAI;EACxBC,WAAW,EAAEA,CAAA,KAAM,IAAI;EACvBC,aAAa,EAAE,KAAK;EACpBC,eAAe,EAAE,KAAK;EACtBC,SAAS,EAAEZ,SAAS;EACpBa,YAAY,EAAEA,CAAA,KAAM,IAAI;EACxBC,cAAc,EAAEA,CAAA,KAAM,IAAI;EAC1BC,gBAAgB,EAAEA,CAAA,KAAM,IAAI;EAC5BC,gBAAgB,EAAEA,CAAA,KAAM,IAAI;EAC5BC,gBAAgB,EAAEA,CAAA,KAAM,IAAI;EAC5BC,kBAAkB,EAAEA,CAAA,KAAM,IAAI;EAC9BC,SAAS,EAAEA,CAAA,KAAM,KAAK;EACtBC,aAAa,EAAEA,CAAA,KAAM,KAAK;EAC1BC,aAAa,EAAEA,CAAA,KAAM,KAAK;EAC1BC,aAAa,EAAEA,CAAA,KAAM,IAAI;EACzBC,aAAa,EAAEA,CAAA,KAAM,IAAI;EACzBC,WAAW,EAAE5B,eAAe,CAAC,CAAC;EAC9B6B,oBAAoB,EAAEzB,SAAS;EAC/B0B,mBAAmB,EAAE,KAAK;EAC1BC,KAAK,EAAE;AACT,CAAC;AAED,MAAMC,OAAO,GAAGjC,KAAK,CAACkC,aAAa,CAAehC,mBAAmB,CAAC;AAEtE,eAAe+B,OAAO"}
1
+ {"version":3,"file":"Context.js","names":["React","makeAjvInstance","defaultContextState","hasContext","data","undefined","schema","submitState","handlePathChange","handlePathChangeUnvalidated","updateDataValue","setData","validateData","handleSubmit","scrollToTop","showAllErrors","hasVisibleError","formState","setFormState","setSubmitState","handleSubmitCall","setShowAllErrors","setMountedFieldState","hasErrors","hasFieldState","hasFieldError","setFieldState","setFieldError","ajvInstance","contextErrorMessages","isInsideFormElement","props","Context","createContext"],"sources":["../../../../../src/extensions/forms/DataContext/Context.ts"],"sourcesContent":["import React from 'react'\nimport { Ajv, makeAjvInstance } from '../utils/ajv'\nimport {\n AllJSONSchemaVersions,\n CustomErrorMessagesWithPaths,\n SubmitState,\n Path,\n EventStateObject,\n EventReturnWithStateObject,\n Identifier,\n FieldProps,\n FormError,\n ValueProps,\n OnChange,\n} from '../types'\nimport { Props as ProviderProps } from './Provider'\n\ntype HandleSubmitProps = {\n formElement?: HTMLFormElement\n}\n\nexport type MountOptions = {\n isMounted?: boolean\n}\n\nexport type EventListenerCall = {\n path?: Path\n type?: 'onSubmit' | 'onPathChange'\n callback: (params?: { value: unknown }) => void | Promise<void | Error>\n}\n\nexport type FilterDataHandler<Data> = (\n data: Data,\n filter: FilterData\n) => Partial<Data>\nexport type FilterDataHandlerCallback<R> = (\n parameters: FilterDataHandlerParameters\n) => R\nexport type FilterDataHandlerParameters =\n FilterDataPathConditionParameters & {\n path: Path\n }\nexport type FilterDataPathCondition<Data = unknown> = (\n parameters: FilterDataPathConditionParameters<Data>\n) => boolean | undefined\nexport type FilterDataPathConditionParameters<Data = unknown> = {\n value: unknown\n props: FieldProps\n data: Data\n internal: {\n error: Error | undefined\n }\n}\nexport type FilterDataPathObject<Data> = Record<\n Path,\n FilterDataPathCondition<Data> | boolean | undefined\n>\nexport type FilterData<Data = unknown> =\n | FilterDataPathObject<Data>\n | FilterDataHandlerCallback<boolean | undefined>\nexport type TransformData = FilterDataHandlerCallback<unknown>\nexport type HandleSubmitCallback = ({\n preventSubmit,\n}: {\n preventSubmit: () => void\n}) => void\n\nexport interface ContextState {\n id?: Identifier\n hasContext: boolean\n /** The dataset for the form / form wizard */\n data: any\n internalDataRef?: React.MutableRefObject<any>\n /** Should the form validate data before submitting? */\n errors?: Record<string, Error>\n /** Will set autoComplete=\"on\" on each nested Field.String and Field.Number */\n autoComplete?: boolean\n handlePathChange: (\n path: Path,\n value?: any\n ) =>\n | EventReturnWithStateObject\n | unknown\n | Promise<EventReturnWithStateObject | unknown>\n handlePathChangeUnvalidated: (path: Path, value: any) => void\n updateDataValue: (path: Path, value: any) => void\n setData: (data: any) => void\n clearData?: () => void\n mutateDataHandler?: (data: any, mutate: TransformData) => any\n filterDataHandler?: (data: any, filter: FilterData) => any\n validateData: () => void\n handleSubmit: (props?: HandleSubmitProps) => any\n scrollToTop: () => void\n setShowAllErrors: (showAllErrors: boolean) => void\n hasErrors: () => boolean\n hasFieldState: (state: SubmitState) => boolean\n hasFieldError: (path: Path) => boolean\n setFieldState: (path: Path, fieldState: SubmitState) => void\n setFieldError: (path: Path, error: Error | FormError) => void\n setMountedFieldState: (path: Path, options: MountOptions) => void\n setFormState?: (state: SubmitState) => void\n setSubmitState?: (state: EventStateObject) => void\n addOnChangeHandler?: (callback: OnChange) => void\n handleSubmitCall: ({\n onSubmit,\n enableAsyncBehavior,\n skipFieldValidation,\n skipErrorCheck,\n }: {\n onSubmit: () =>\n | EventReturnWithStateObject\n | void\n | Promise<EventReturnWithStateObject | void>\n enableAsyncBehavior: boolean\n skipFieldValidation?: boolean\n skipErrorCheck?: boolean\n }) => void\n setFieldEventListener?: (\n path: EventListenerCall['path'],\n type: EventListenerCall['type'],\n callback: EventListenerCall['callback']\n ) => void\n setVisibleError?: (path: Path, hasError: boolean) => void\n setFieldProps?: (path: Path, props: unknown) => void\n setValueProps?: (path: Path, props: unknown) => void\n setHandleSubmit?: (callback: HandleSubmitCallback) => void\n fieldPropsRef?: React.MutableRefObject<Record<string, FieldProps>>\n valuePropsRef?: React.MutableRefObject<Record<string, ValueProps>>\n mountedFieldsRef?: React.MutableRefObject<Record<Path, MountOptions>>\n showAllErrors: boolean\n hasVisibleError: boolean\n formState: SubmitState\n ajvInstance: Ajv\n contextErrorMessages: CustomErrorMessagesWithPaths\n schema: AllJSONSchemaVersions\n path?: Path\n disabled?: boolean\n required?: boolean\n submitState: Partial<EventStateObject>\n isInsideFormElement?: boolean\n prerenderFieldProps?: boolean\n props: ProviderProps<unknown>\n}\n\nexport const defaultContextState: ContextState = {\n hasContext: false,\n data: undefined,\n schema: undefined,\n submitState: undefined,\n handlePathChange: () => null,\n handlePathChangeUnvalidated: () => null,\n updateDataValue: () => null,\n setData: () => null,\n validateData: () => null,\n handleSubmit: () => null,\n scrollToTop: () => null,\n showAllErrors: false,\n hasVisibleError: false,\n formState: undefined,\n setFormState: () => null,\n setSubmitState: () => null,\n handleSubmitCall: () => null,\n setShowAllErrors: () => null,\n setMountedFieldState: () => null,\n hasErrors: () => false,\n hasFieldState: () => false,\n hasFieldError: () => false,\n setFieldState: () => null,\n setFieldError: () => null,\n ajvInstance: makeAjvInstance(),\n contextErrorMessages: undefined,\n isInsideFormElement: false,\n props: null,\n}\n\nconst Context = React.createContext<ContextState>(defaultContextState)\n\nexport default Context\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAAcC,eAAe,QAAQ,cAAc;AA+InD,OAAO,MAAMC,mBAAiC,GAAG;EAC/CC,UAAU,EAAE,KAAK;EACjBC,IAAI,EAAEC,SAAS;EACfC,MAAM,EAAED,SAAS;EACjBE,WAAW,EAAEF,SAAS;EACtBG,gBAAgB,EAAEA,CAAA,KAAM,IAAI;EAC5BC,2BAA2B,EAAEA,CAAA,KAAM,IAAI;EACvCC,eAAe,EAAEA,CAAA,KAAM,IAAI;EAC3BC,OAAO,EAAEA,CAAA,KAAM,IAAI;EACnBC,YAAY,EAAEA,CAAA,KAAM,IAAI;EACxBC,YAAY,EAAEA,CAAA,KAAM,IAAI;EACxBC,WAAW,EAAEA,CAAA,KAAM,IAAI;EACvBC,aAAa,EAAE,KAAK;EACpBC,eAAe,EAAE,KAAK;EACtBC,SAAS,EAAEZ,SAAS;EACpBa,YAAY,EAAEA,CAAA,KAAM,IAAI;EACxBC,cAAc,EAAEA,CAAA,KAAM,IAAI;EAC1BC,gBAAgB,EAAEA,CAAA,KAAM,IAAI;EAC5BC,gBAAgB,EAAEA,CAAA,KAAM,IAAI;EAC5BC,oBAAoB,EAAEA,CAAA,KAAM,IAAI;EAChCC,SAAS,EAAEA,CAAA,KAAM,KAAK;EACtBC,aAAa,EAAEA,CAAA,KAAM,KAAK;EAC1BC,aAAa,EAAEA,CAAA,KAAM,KAAK;EAC1BC,aAAa,EAAEA,CAAA,KAAM,IAAI;EACzBC,aAAa,EAAEA,CAAA,KAAM,IAAI;EACzBC,WAAW,EAAE3B,eAAe,CAAC,CAAC;EAC9B4B,oBAAoB,EAAExB,SAAS;EAC/ByB,mBAAmB,EAAE,KAAK;EAC1BC,KAAK,EAAE;AACT,CAAC;AAED,MAAMC,OAAO,GAAGhC,KAAK,CAACiC,aAAa,CAAe/B,mBAAmB,CAAC;AAEtE,eAAe8B,OAAO"}
@@ -30,6 +30,10 @@ export interface FieldBoundaryContextState {
30
30
  * To set the local error state.
31
31
  */
32
32
  setFieldError?: (path: Path, error: Error) => void;
33
+ /**
34
+ * To set the local visible error state.
35
+ */
36
+ setVisibleError?: (path: Path, hasError: boolean) => void;
33
37
  }
34
38
  declare const FieldBoundaryContext: React.Context<FieldBoundaryContextState>;
35
39
  export default FieldBoundaryContext;
@@ -1 +1 @@
1
- {"version":3,"file":"FieldBoundaryContext.js","names":["React","FieldBoundaryContext","createContext","undefined"],"sources":["../../../../../../src/extensions/forms/DataContext/FieldBoundary/FieldBoundaryContext.ts"],"sourcesContent":["import React from 'react'\nimport { Path } from '../../types'\n\nexport interface FieldBoundaryContextState {\n /**\n * Will be set to true when one or more nested fields are in error state.\n */\n hasError?: boolean\n\n /**\n * Will be set to true when the inherited data context has submit errors and the `hasError` has errors as well.\n */\n hasSubmitError?: boolean\n\n /**\n * Will be set to true when a nested field contains a visible error.\n */\n hasVisibleError?: boolean\n\n /**\n * Contains the nested field errors.\n */\n errorsRef?: React.RefObject<unknown>\n\n /**\n * Will be set to true when the boundary context error state should be shown.\n * Support a number to ensure we can renew hooks each time we get a new value.\n */\n showBoundaryErrors?: boolean | number\n\n /**\n * To set the boundary context error state.\n */\n setShowBoundaryErrors?: (\n showBoundaryErrors: FieldBoundaryContextState['showBoundaryErrors']\n ) => void\n\n /**\n * To set the local error state.\n */\n setFieldError?: (path: Path, error: Error) => void\n}\n\nconst FieldBoundaryContext = React.createContext<\n FieldBoundaryContextState | undefined\n>(undefined)\n\nexport default FieldBoundaryContext\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AA2CzB,MAAMC,oBAAoB,GAAGD,KAAK,CAACE,aAAa,CAE9CC,SAAS,CAAC;AAEZ,eAAeF,oBAAoB"}
1
+ {"version":3,"file":"FieldBoundaryContext.js","names":["React","FieldBoundaryContext","createContext","undefined"],"sources":["../../../../../../src/extensions/forms/DataContext/FieldBoundary/FieldBoundaryContext.ts"],"sourcesContent":["import React from 'react'\nimport { Path } from '../../types'\n\nexport interface FieldBoundaryContextState {\n /**\n * Will be set to true when one or more nested fields are in error state.\n */\n hasError?: boolean\n\n /**\n * Will be set to true when the inherited data context has submit errors and the `hasError` has errors as well.\n */\n hasSubmitError?: boolean\n\n /**\n * Will be set to true when a nested field contains a visible error.\n */\n hasVisibleError?: boolean\n\n /**\n * Contains the nested field errors.\n */\n errorsRef?: React.RefObject<unknown>\n\n /**\n * Will be set to true when the boundary context error state should be shown.\n * Support a number to ensure we can renew hooks each time we get a new value.\n */\n showBoundaryErrors?: boolean | number\n\n /**\n * To set the boundary context error state.\n */\n setShowBoundaryErrors?: (\n showBoundaryErrors: FieldBoundaryContextState['showBoundaryErrors']\n ) => void\n\n /**\n * To set the local error state.\n */\n setFieldError?: (path: Path, error: Error) => void\n\n /**\n * To set the local visible error state.\n */\n setVisibleError?: (path: Path, hasError: boolean) => void\n}\n\nconst FieldBoundaryContext = React.createContext<\n FieldBoundaryContextState | undefined\n>(undefined)\n\nexport default FieldBoundaryContext\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AAgDzB,MAAMC,oBAAoB,GAAGD,KAAK,CAACE,aAAa,CAE9CC,SAAS,CAAC;AAEZ,eAAeF,oBAAoB"}
@@ -11,8 +11,7 @@ export default function FieldBoundaryProvider(props) {
11
11
  } = props;
12
12
  const [, forceUpdate] = useReducer(() => ({}), {});
13
13
  const {
14
- showAllErrors,
15
- hasVisibleError
14
+ showAllErrors
16
15
  } = useContext(DataContext);
17
16
  const onPathErrorRef = useRef(onPathError);
18
17
  onPathErrorRef.current = onPathError;
@@ -31,6 +30,15 @@ export default function FieldBoundaryProvider(props) {
31
30
  forceUpdate();
32
31
  (_onPathErrorRef$curre = onPathErrorRef.current) === null || _onPathErrorRef$curre === void 0 ? void 0 : _onPathErrorRef$curre.call(onPathErrorRef, path, error);
33
32
  }, []);
33
+ const hasVisibleErrorRef = useRef({});
34
+ const setVisibleError = useCallback((path, hasError) => {
35
+ if (hasError) {
36
+ hasVisibleErrorRef.current[path] = hasError;
37
+ } else {
38
+ delete hasVisibleErrorRef.current[path];
39
+ }
40
+ forceUpdate();
41
+ }, []);
34
42
  const setShowBoundaryErrors = useCallback(showBoundaryErrors => {
35
43
  showBoundaryErrorsRef.current = showBoundaryErrors;
36
44
  forceUpdate();
@@ -38,11 +46,12 @@ export default function FieldBoundaryProvider(props) {
38
46
  const context = {
39
47
  hasError,
40
48
  hasSubmitError,
41
- hasVisibleError,
49
+ hasVisibleError: Object.keys(hasVisibleErrorRef.current).length > 0,
42
50
  errorsRef,
43
51
  showBoundaryErrors: showBoundaryErrorsRef.current,
44
52
  setShowBoundaryErrors,
45
- setFieldError
53
+ setFieldError,
54
+ setVisibleError
46
55
  };
47
56
  return React.createElement(FieldBoundaryContext.Provider, {
48
57
  value: context
@@ -1 +1 @@
1
- {"version":3,"file":"FieldBoundaryProvider.js","names":["React","useCallback","useContext","useReducer","useRef","FieldBoundaryContext","DataContext","FieldBoundaryProvider","props","showErrors","onPathError","children","forceUpdate","showAllErrors","hasVisibleError","onPathErrorRef","current","errorsRef","showBoundaryErrorsRef","hasError","Object","keys","length","hasSubmitError","setFieldError","path","error","_onPathErrorRef$curre","_errorsRef$current","call","setShowBoundaryErrors","showBoundaryErrors","context","createElement","Provider","value"],"sources":["../../../../../../src/extensions/forms/DataContext/FieldBoundary/FieldBoundaryProvider.tsx"],"sourcesContent":["import React, { useCallback, useContext, useReducer, useRef } from 'react'\nimport FieldBoundaryContext, {\n FieldBoundaryContextState,\n} from './FieldBoundaryContext'\nimport DataContext from '../Context'\nimport { Path } from '../../types'\n\nexport type Props = {\n showErrors?: boolean\n onPathError?: (path: Path, error: Error) => void\n children: React.ReactNode\n}\n\nexport default function FieldBoundaryProvider(props: Props) {\n const { showErrors = false, onPathError = null, children } = props\n const [, forceUpdate] = useReducer(() => ({}), {})\n const { showAllErrors, hasVisibleError } = useContext(DataContext)\n\n const onPathErrorRef = useRef(onPathError)\n onPathErrorRef.current = onPathError\n const errorsRef = useRef<Record<Path, boolean>>({})\n const showBoundaryErrorsRef =\n useRef<FieldBoundaryContextState['showBoundaryErrors']>(showErrors)\n const hasError = Object.keys(errorsRef.current).length > 0\n const hasSubmitError = showAllErrors && hasError\n\n const setFieldError = useCallback((path: Path, error: Error) => {\n if (error) {\n errorsRef.current[path] = !!error\n } else {\n delete errorsRef.current?.[path]\n }\n forceUpdate()\n onPathErrorRef.current?.(path, error)\n }, [])\n\n const setShowBoundaryErrors: FieldBoundaryContextState['setShowBoundaryErrors'] =\n useCallback((showBoundaryErrors) => {\n showBoundaryErrorsRef.current = showBoundaryErrors\n forceUpdate()\n }, [])\n\n const context: FieldBoundaryContextState = {\n hasError,\n hasSubmitError,\n hasVisibleError,\n errorsRef,\n showBoundaryErrors: showBoundaryErrorsRef.current,\n setShowBoundaryErrors,\n setFieldError,\n }\n\n return (\n <FieldBoundaryContext.Provider value={context}>\n {children}\n </FieldBoundaryContext.Provider>\n )\n}\n"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,WAAW,EAAEC,UAAU,EAAEC,UAAU,EAAEC,MAAM,QAAQ,OAAO;AAC1E,OAAOC,oBAAoB,MAEpB,wBAAwB;AAC/B,OAAOC,WAAW,MAAM,YAAY;AASpC,eAAe,SAASC,qBAAqBA,CAACC,KAAY,EAAE;EAC1D,MAAM;IAAEC,UAAU,GAAG,KAAK;IAAEC,WAAW,GAAG,IAAI;IAAEC;EAAS,CAAC,GAAGH,KAAK;EAClE,MAAM,GAAGI,WAAW,CAAC,GAAGT,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;EAClD,MAAM;IAAEU,aAAa;IAAEC;EAAgB,CAAC,GAAGZ,UAAU,CAACI,WAAW,CAAC;EAElE,MAAMS,cAAc,GAAGX,MAAM,CAACM,WAAW,CAAC;EAC1CK,cAAc,CAACC,OAAO,GAAGN,WAAW;EACpC,MAAMO,SAAS,GAAGb,MAAM,CAAwB,CAAC,CAAC,CAAC;EACnD,MAAMc,qBAAqB,GACzBd,MAAM,CAAkDK,UAAU,CAAC;EACrE,MAAMU,QAAQ,GAAGC,MAAM,CAACC,IAAI,CAACJ,SAAS,CAACD,OAAO,CAAC,CAACM,MAAM,GAAG,CAAC;EAC1D,MAAMC,cAAc,GAAGV,aAAa,IAAIM,QAAQ;EAEhD,MAAMK,aAAa,GAAGvB,WAAW,CAAC,CAACwB,IAAU,EAAEC,KAAY,KAAK;IAAA,IAAAC,qBAAA;IAC9D,IAAID,KAAK,EAAE;MACTT,SAAS,CAACD,OAAO,CAACS,IAAI,CAAC,GAAG,CAAC,CAACC,KAAK;IACnC,CAAC,MAAM;MAAA,IAAAE,kBAAA;MACL,CAAAA,kBAAA,GAAOX,SAAS,CAACD,OAAO,cAAAY,kBAAA,qBAAxB,OAAOA,kBAAA,CAAoBH,IAAI,CAAC;IAClC;IACAb,WAAW,CAAC,CAAC;IACb,CAAAe,qBAAA,GAAAZ,cAAc,CAACC,OAAO,cAAAW,qBAAA,uBAAtBA,qBAAA,CAAAE,IAAA,CAAAd,cAAc,EAAWU,IAAI,EAAEC,KAAK,CAAC;EACvC,CAAC,EAAE,EAAE,CAAC;EAEN,MAAMI,qBAAyE,GAC7E7B,WAAW,CAAE8B,kBAAkB,IAAK;IAClCb,qBAAqB,CAACF,OAAO,GAAGe,kBAAkB;IAClDnB,WAAW,CAAC,CAAC;EACf,CAAC,EAAE,EAAE,CAAC;EAER,MAAMoB,OAAkC,GAAG;IACzCb,QAAQ;IACRI,cAAc;IACdT,eAAe;IACfG,SAAS;IACTc,kBAAkB,EAAEb,qBAAqB,CAACF,OAAO;IACjDc,qBAAqB;IACrBN;EACF,CAAC;EAED,OACExB,KAAA,CAAAiC,aAAA,CAAC5B,oBAAoB,CAAC6B,QAAQ;IAACC,KAAK,EAAEH;EAAQ,GAC3CrB,QAC4B,CAAC;AAEpC"}
1
+ {"version":3,"file":"FieldBoundaryProvider.js","names":["React","useCallback","useContext","useReducer","useRef","FieldBoundaryContext","DataContext","FieldBoundaryProvider","props","showErrors","onPathError","children","forceUpdate","showAllErrors","onPathErrorRef","current","errorsRef","showBoundaryErrorsRef","hasError","Object","keys","length","hasSubmitError","setFieldError","path","error","_onPathErrorRef$curre","_errorsRef$current","call","hasVisibleErrorRef","setVisibleError","setShowBoundaryErrors","showBoundaryErrors","context","hasVisibleError","createElement","Provider","value"],"sources":["../../../../../../src/extensions/forms/DataContext/FieldBoundary/FieldBoundaryProvider.tsx"],"sourcesContent":["import React, { useCallback, useContext, useReducer, useRef } from 'react'\nimport FieldBoundaryContext, {\n FieldBoundaryContextState,\n} from './FieldBoundaryContext'\nimport DataContext from '../Context'\nimport { Path } from '../../types'\n\nexport type Props = {\n showErrors?: boolean\n onPathError?: (path: Path, error: Error) => void\n children: React.ReactNode\n}\n\nexport default function FieldBoundaryProvider(props: Props) {\n const { showErrors = false, onPathError = null, children } = props\n const [, forceUpdate] = useReducer(() => ({}), {})\n const { showAllErrors } = useContext(DataContext)\n\n const onPathErrorRef = useRef(onPathError)\n onPathErrorRef.current = onPathError\n const errorsRef = useRef<Record<Path, boolean>>({})\n const showBoundaryErrorsRef =\n useRef<FieldBoundaryContextState['showBoundaryErrors']>(showErrors)\n const hasError = Object.keys(errorsRef.current).length > 0\n const hasSubmitError = showAllErrors && hasError\n\n const setFieldError = useCallback((path: Path, error: Error) => {\n if (error) {\n errorsRef.current[path] = !!error\n } else {\n delete errorsRef.current?.[path]\n }\n forceUpdate()\n onPathErrorRef.current?.(path, error)\n }, [])\n\n const hasVisibleErrorRef = useRef<Record<Path, boolean>>({})\n const setVisibleError = useCallback((path: Path, hasError: boolean) => {\n if (hasError) {\n hasVisibleErrorRef.current[path] = hasError\n } else {\n delete hasVisibleErrorRef.current[path]\n }\n forceUpdate()\n }, [])\n\n const setShowBoundaryErrors: FieldBoundaryContextState['setShowBoundaryErrors'] =\n useCallback((showBoundaryErrors) => {\n showBoundaryErrorsRef.current = showBoundaryErrors\n forceUpdate()\n }, [])\n\n const context: FieldBoundaryContextState = {\n hasError,\n hasSubmitError,\n hasVisibleError: Object.keys(hasVisibleErrorRef.current).length > 0,\n errorsRef,\n showBoundaryErrors: showBoundaryErrorsRef.current,\n setShowBoundaryErrors,\n setFieldError,\n setVisibleError,\n }\n\n return (\n <FieldBoundaryContext.Provider value={context}>\n {children}\n </FieldBoundaryContext.Provider>\n )\n}\n"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,WAAW,EAAEC,UAAU,EAAEC,UAAU,EAAEC,MAAM,QAAQ,OAAO;AAC1E,OAAOC,oBAAoB,MAEpB,wBAAwB;AAC/B,OAAOC,WAAW,MAAM,YAAY;AASpC,eAAe,SAASC,qBAAqBA,CAACC,KAAY,EAAE;EAC1D,MAAM;IAAEC,UAAU,GAAG,KAAK;IAAEC,WAAW,GAAG,IAAI;IAAEC;EAAS,CAAC,GAAGH,KAAK;EAClE,MAAM,GAAGI,WAAW,CAAC,GAAGT,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;EAClD,MAAM;IAAEU;EAAc,CAAC,GAAGX,UAAU,CAACI,WAAW,CAAC;EAEjD,MAAMQ,cAAc,GAAGV,MAAM,CAACM,WAAW,CAAC;EAC1CI,cAAc,CAACC,OAAO,GAAGL,WAAW;EACpC,MAAMM,SAAS,GAAGZ,MAAM,CAAwB,CAAC,CAAC,CAAC;EACnD,MAAMa,qBAAqB,GACzBb,MAAM,CAAkDK,UAAU,CAAC;EACrE,MAAMS,QAAQ,GAAGC,MAAM,CAACC,IAAI,CAACJ,SAAS,CAACD,OAAO,CAAC,CAACM,MAAM,GAAG,CAAC;EAC1D,MAAMC,cAAc,GAAGT,aAAa,IAAIK,QAAQ;EAEhD,MAAMK,aAAa,GAAGtB,WAAW,CAAC,CAACuB,IAAU,EAAEC,KAAY,KAAK;IAAA,IAAAC,qBAAA;IAC9D,IAAID,KAAK,EAAE;MACTT,SAAS,CAACD,OAAO,CAACS,IAAI,CAAC,GAAG,CAAC,CAACC,KAAK;IACnC,CAAC,MAAM;MAAA,IAAAE,kBAAA;MACL,CAAAA,kBAAA,GAAOX,SAAS,CAACD,OAAO,cAAAY,kBAAA,qBAAxB,OAAOA,kBAAA,CAAoBH,IAAI,CAAC;IAClC;IACAZ,WAAW,CAAC,CAAC;IACb,CAAAc,qBAAA,GAAAZ,cAAc,CAACC,OAAO,cAAAW,qBAAA,uBAAtBA,qBAAA,CAAAE,IAAA,CAAAd,cAAc,EAAWU,IAAI,EAAEC,KAAK,CAAC;EACvC,CAAC,EAAE,EAAE,CAAC;EAEN,MAAMI,kBAAkB,GAAGzB,MAAM,CAAwB,CAAC,CAAC,CAAC;EAC5D,MAAM0B,eAAe,GAAG7B,WAAW,CAAC,CAACuB,IAAU,EAAEN,QAAiB,KAAK;IACrE,IAAIA,QAAQ,EAAE;MACZW,kBAAkB,CAACd,OAAO,CAACS,IAAI,CAAC,GAAGN,QAAQ;IAC7C,CAAC,MAAM;MACL,OAAOW,kBAAkB,CAACd,OAAO,CAACS,IAAI,CAAC;IACzC;IACAZ,WAAW,CAAC,CAAC;EACf,CAAC,EAAE,EAAE,CAAC;EAEN,MAAMmB,qBAAyE,GAC7E9B,WAAW,CAAE+B,kBAAkB,IAAK;IAClCf,qBAAqB,CAACF,OAAO,GAAGiB,kBAAkB;IAClDpB,WAAW,CAAC,CAAC;EACf,CAAC,EAAE,EAAE,CAAC;EAER,MAAMqB,OAAkC,GAAG;IACzCf,QAAQ;IACRI,cAAc;IACdY,eAAe,EAAEf,MAAM,CAACC,IAAI,CAACS,kBAAkB,CAACd,OAAO,CAAC,CAACM,MAAM,GAAG,CAAC;IACnEL,SAAS;IACTgB,kBAAkB,EAAEf,qBAAqB,CAACF,OAAO;IACjDgB,qBAAqB;IACrBR,aAAa;IACbO;EACF,CAAC;EAED,OACE9B,KAAA,CAAAmC,aAAA,CAAC9B,oBAAoB,CAAC+B,QAAQ;IAACC,KAAK,EAAEJ;EAAQ,GAC3CtB,QAC4B,CAAC;AAEpC"}
@@ -110,8 +110,4 @@ export interface Props<Data extends JsonObject> extends IsolationProviderProps<D
110
110
  children: React.ReactNode;
111
111
  }
112
112
  export default function Provider<Data extends JsonObject>(props: Props<Data>): import("react/jsx-runtime").JSX.Element;
113
- type PathList = string[];
114
- export declare function addListPath(paths: PathList, path: Path): PathList;
115
- export declare function removeListPath(paths: PathList, path: Path): PathList;
116
113
  export declare const clearedData: Readonly<{}>;
117
- export {};
@@ -62,7 +62,7 @@ export default function Provider(props) {
62
62
  }
63
63
  const translation = useTranslation().Field;
64
64
  const ajvRef = useRef(makeAjvInstance(ajvInstance));
65
- const mountedFieldPathsRef = useRef([]);
65
+ const mountedFieldsRef = useRef({});
66
66
  const hasVisibleErrorRef = useRef({});
67
67
  const errorsRef = useRef();
68
68
  const showAllErrorsRef = useRef(false);
@@ -70,7 +70,7 @@ export default function Provider(props) {
70
70
  showAllErrorsRef.current = showAllErrors;
71
71
  forceUpdate();
72
72
  }, []);
73
- const setHasVisibleError = useCallback((path, hasError) => {
73
+ const setVisibleError = useCallback((path, hasError) => {
74
74
  if (hasError) {
75
75
  hasVisibleErrorRef.current[path] = hasError;
76
76
  } else {
@@ -125,14 +125,20 @@ export default function Provider(props) {
125
125
  return Boolean(state === 'error' ? ((_errorsRef$current = errorsRef.current) === null || _errorsRef$current === void 0 ? void 0 : _errorsRef$current[path]) instanceof Error || fieldErrorRef.current[path] instanceof Error : fieldStateRef.current[path] === state);
126
126
  }, []);
127
127
  const hasFieldState = useCallback(state => {
128
- return mountedFieldPathsRef.current.some(path => {
129
- return checkFieldStateFor(path, state);
130
- });
128
+ for (const path in mountedFieldsRef.current) {
129
+ if (checkFieldStateFor(path, state)) {
130
+ return true;
131
+ }
132
+ }
133
+ return false;
131
134
  }, [checkFieldStateFor]);
132
135
  const hasFieldError = useCallback(path => {
133
- return mountedFieldPathsRef.current.some(p => {
134
- return p === path && checkFieldStateFor(p, 'error');
135
- });
136
+ for (const p in mountedFieldsRef.current) {
137
+ if (p === path && checkFieldStateFor(path, 'error')) {
138
+ return true;
139
+ }
140
+ }
141
+ return false;
136
142
  }, [checkFieldStateFor]);
137
143
  const hasErrors = useCallback(() => {
138
144
  return hasFieldState('error');
@@ -261,7 +267,8 @@ export default function Provider(props) {
261
267
  }, []);
262
268
  const hasFieldWithAsyncValidator = useCallback(() => {
263
269
  for (const path in fieldPropsRef.current) {
264
- if (mountedFieldPathsRef.current.includes(path)) {
270
+ var _mountedFieldsRef$cur;
271
+ if ((_mountedFieldsRef$cur = mountedFieldsRef.current[path]) !== null && _mountedFieldsRef$cur !== void 0 && _mountedFieldsRef$cur.isMounted) {
265
272
  const props = fieldPropsRef.current[path];
266
273
  if (isAsync(props.validator) || isAsync(props.onBlurValidator)) {
267
274
  return true;
@@ -440,11 +447,12 @@ export default function Provider(props) {
440
447
  changeHandlerStackRef.current.push(callback);
441
448
  }
442
449
  }, []);
443
- const handleMountField = useCallback(path => {
444
- mountedFieldPathsRef.current = addListPath(mountedFieldPathsRef.current, path);
445
- }, []);
446
- const handleUnMountField = useCallback(path => {
447
- mountedFieldPathsRef.current = removeListPath(mountedFieldPathsRef.current, path);
450
+ const setMountedFieldState = useCallback((path, options) => {
451
+ if (!mountedFieldsRef.current[path]) {
452
+ mountedFieldsRef.current[path] = _objectSpread({}, options);
453
+ } else {
454
+ Object.assign(mountedFieldsRef.current[path], options);
455
+ }
448
456
  }, []);
449
457
  const scrollToTop = useCallback(() => {
450
458
  if (typeof window !== 'undefined') {
@@ -480,12 +488,13 @@ export default function Provider(props) {
480
488
  }
481
489
  if (!skipFieldValidation) {
482
490
  for (const item of fieldEventListenersRef.current) {
491
+ var _mountedFieldsRef$cur2;
483
492
  const {
484
493
  path,
485
494
  type,
486
495
  callback
487
496
  } = item;
488
- if (type === 'onSubmit' && mountedFieldPathsRef.current.includes(path)) {
497
+ if (type === 'onSubmit' && (_mountedFieldsRef$cur2 = mountedFieldsRef.current[path]) !== null && _mountedFieldsRef$cur2 !== void 0 && _mountedFieldsRef$cur2.isMounted) {
489
498
  if (asyncBehaviorIsEnabled) {
490
499
  await callback();
491
500
  } else {
@@ -540,7 +549,6 @@ export default function Provider(props) {
540
549
  onSubmitRequest === null || onSubmitRequest === void 0 ? void 0 : onSubmitRequest();
541
550
  setShowAllErrors(true);
542
551
  }
543
- return internalDataRef.current;
544
552
  }, [clearData, hasErrors, hasFieldState, hasFieldWithAsyncValidator, isolate, onCommit, onSubmitRequest, setFormState, setShowAllErrors, setSubmitState]);
545
553
  const handleSubmitListenersRef = useRef([]);
546
554
  const setHandleSubmit = useCallback(callback => {
@@ -664,13 +672,12 @@ export default function Provider(props) {
664
672
  handlePathChange,
665
673
  handlePathChangeUnvalidated,
666
674
  handleSubmit,
667
- handleMountField,
668
- handleUnMountField,
675
+ setMountedFieldState,
669
676
  handleSubmitCall,
670
677
  setFormState,
671
678
  setSubmitState,
672
679
  setShowAllErrors,
673
- setHasVisibleError,
680
+ setVisibleError,
674
681
  setFieldEventListener,
675
682
  setFieldState,
676
683
  setFieldError,
@@ -699,7 +706,7 @@ export default function Provider(props) {
699
706
  hasVisibleError: Object.keys(hasVisibleErrorRef.current).length > 0,
700
707
  fieldPropsRef,
701
708
  valuePropsRef,
702
- mountedFieldPathsRef,
709
+ mountedFieldsRef,
703
710
  ajvInstance: ajvRef.current,
704
711
  id,
705
712
  data: internalDataRef.current,
@@ -721,12 +728,6 @@ export default function Provider(props) {
721
728
  translations: translations ? translations : undefined
722
729
  }, children));
723
730
  }
724
- export function addListPath(paths, path) {
725
- return paths.includes(path) ? paths : paths.concat(path);
726
- }
727
- export function removeListPath(paths, path) {
728
- return paths.filter(thisPath => thisPath !== path);
729
- }
730
731
  function useFormStatusBuffer(props) {
731
732
  const {
732
733
  formState,