@fuf-stack/uniform 1.28.0 → 1.28.1

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 (144) hide show
  1. package/README.md +6 -35
  2. package/dist/Checkboxes/index.d.mts +11 -13
  3. package/dist/Checkboxes/index.d.mts.map +1 -1
  4. package/dist/Checkboxes/index.mjs +2 -4
  5. package/dist/Checkboxes/index.mjs.map +1 -1
  6. package/dist/DatePicker/index.d.mts +21 -23
  7. package/dist/DatePicker/index.d.mts.map +1 -1
  8. package/dist/DatePicker/index.mjs +3 -6
  9. package/dist/DatePicker/index.mjs.map +1 -1
  10. package/dist/FieldArray/index.d.mts +2 -8
  11. package/dist/FieldArray/index.d.mts.map +1 -1
  12. package/dist/FieldArray/index.mjs +12 -22
  13. package/dist/FieldArray/index.mjs.map +1 -1
  14. package/dist/FieldCard/index.d.mts +0 -2
  15. package/dist/FieldCard/index.d.mts.map +1 -1
  16. package/dist/FieldCard/index.mjs +5 -8
  17. package/dist/FieldCard/index.mjs.map +1 -1
  18. package/dist/{FieldCopyTestIdButton-9xTF-DBW.mjs → FieldCopyTestIdButton-Y9SfvaM9.mjs} +3 -5
  19. package/dist/{FieldCopyTestIdButton-9xTF-DBW.mjs.map → FieldCopyTestIdButton-Y9SfvaM9.mjs.map} +1 -1
  20. package/dist/{FieldValidationError-ByRoIxaM.mjs → FieldValidationError-BcUV0r1I.mjs} +3 -5
  21. package/dist/{FieldValidationError-ByRoIxaM.mjs.map → FieldValidationError-BcUV0r1I.mjs.map} +1 -1
  22. package/dist/Form/index.d.mts +2 -4
  23. package/dist/Form/index.d.mts.map +1 -1
  24. package/dist/Form/index.mjs +5 -8
  25. package/dist/Form/index.mjs.map +1 -1
  26. package/dist/{FormContext-CB7Glm02.mjs → FormContext-B8G_Xxd6.mjs} +49 -14
  27. package/dist/FormContext-B8G_Xxd6.mjs.map +1 -0
  28. package/dist/FormContext-BnNJYZOo.d.mts +124 -0
  29. package/dist/FormContext-BnNJYZOo.d.mts.map +1 -0
  30. package/dist/Grid/index.d.mts +0 -2
  31. package/dist/Grid/index.d.mts.map +1 -1
  32. package/dist/Grid/index.mjs +1 -2
  33. package/dist/{Grid-CTs-Rb9G.mjs → Grid-Us2JFczS.mjs} +3 -5
  34. package/dist/{Grid-CTs-Rb9G.mjs.map → Grid-Us2JFczS.mjs.map} +1 -1
  35. package/dist/Input/index.d.mts +14 -16
  36. package/dist/Input/index.d.mts.map +1 -1
  37. package/dist/Input/index.mjs +3 -6
  38. package/dist/Input/index.mjs.map +1 -1
  39. package/dist/RadioBoxes/index.d.mts +17 -21
  40. package/dist/RadioBoxes/index.d.mts.map +1 -1
  41. package/dist/RadioBoxes/index.mjs +3 -6
  42. package/dist/RadioBoxes/index.mjs.map +1 -1
  43. package/dist/RadioTabs/index.d.mts +46 -48
  44. package/dist/RadioTabs/index.d.mts.map +1 -1
  45. package/dist/RadioTabs/index.mjs +2 -4
  46. package/dist/RadioTabs/index.mjs.map +1 -1
  47. package/dist/Radios/index.d.mts +15 -17
  48. package/dist/Radios/index.d.mts.map +1 -1
  49. package/dist/Radios/index.mjs +2 -4
  50. package/dist/Radios/index.mjs.map +1 -1
  51. package/dist/Select/index.d.mts +22 -24
  52. package/dist/Select/index.d.mts.map +1 -1
  53. package/dist/Select/index.mjs +4 -7
  54. package/dist/Select/index.mjs.map +1 -1
  55. package/dist/Slider/index.d.mts +38 -40
  56. package/dist/Slider/index.d.mts.map +1 -1
  57. package/dist/Slider/index.mjs +2 -4
  58. package/dist/Slider/index.mjs.map +1 -1
  59. package/dist/SubmitButton/index.d.mts +0 -2
  60. package/dist/SubmitButton/index.d.mts.map +1 -1
  61. package/dist/SubmitButton/index.mjs +2 -4
  62. package/dist/SubmitButton/index.mjs.map +1 -1
  63. package/dist/Switch/index.d.mts +17 -19
  64. package/dist/Switch/index.d.mts.map +1 -1
  65. package/dist/Switch/index.mjs +2 -4
  66. package/dist/Switch/index.mjs.map +1 -1
  67. package/dist/SwitchBox/index.d.mts +39 -41
  68. package/dist/SwitchBox/index.d.mts.map +1 -1
  69. package/dist/SwitchBox/index.mjs +2 -4
  70. package/dist/SwitchBox/index.mjs.map +1 -1
  71. package/dist/TextArea/index.d.mts +11 -13
  72. package/dist/TextArea/index.d.mts.map +1 -1
  73. package/dist/TextArea/index.mjs +2 -4
  74. package/dist/TextArea/index.mjs.map +1 -1
  75. package/dist/Time/index.d.mts +11 -13
  76. package/dist/Time/index.d.mts.map +1 -1
  77. package/dist/Time/index.mjs +3 -6
  78. package/dist/Time/index.mjs.map +1 -1
  79. package/dist/helpers/index.d.mts +0 -6
  80. package/dist/helpers/index.d.mts.map +1 -1
  81. package/dist/helpers/index.mjs +3 -6
  82. package/dist/helpers/index.mjs.map +1 -1
  83. package/dist/hooks/useClientValidation/index.d.mts +0 -2
  84. package/dist/hooks/useClientValidation/index.d.mts.map +1 -1
  85. package/dist/hooks/useClientValidation/index.mjs +3 -5
  86. package/dist/hooks/useController/index.d.mts +1 -2
  87. package/dist/hooks/useController/index.mjs +2 -4
  88. package/dist/hooks/useFormContext/index.d.mts +2 -3
  89. package/dist/hooks/useFormContext/index.mjs +2 -4
  90. package/dist/hooks/useInput/index.mjs +2 -4
  91. package/dist/hooks/useInputValueDebounce/index.d.mts +2 -4
  92. package/dist/hooks/useInputValueDebounce/index.d.mts.map +1 -1
  93. package/dist/hooks/useInputValueDebounce/index.mjs +3 -5
  94. package/dist/hooks/useInputValueDebounce/index.mjs.map +1 -1
  95. package/dist/hooks/useInputValueTransform/index.d.mts +1 -1
  96. package/dist/hooks/useInputValueTransform/index.mjs +2 -4
  97. package/dist/hooks/useUniformField/index.d.mts +2 -100
  98. package/dist/hooks/useUniformField/index.mjs +9 -11
  99. package/dist/hooks/useUniformField/index.mjs.map +1 -1
  100. package/dist/hooks/useUniformFieldArray/index.d.mts +23 -49
  101. package/dist/hooks/useUniformFieldArray/index.d.mts.map +1 -1
  102. package/dist/hooks/useUniformFieldArray/index.mjs +3 -5
  103. package/dist/hooks/useUniformFieldArray/index.mjs.map +1 -1
  104. package/dist/hooks/useWatchFormReset/index.d.mts +0 -2
  105. package/dist/hooks/useWatchFormReset/index.d.mts.map +1 -1
  106. package/dist/hooks/useWatchFormReset/index.mjs +3 -5
  107. package/dist/hooks/useWatchUserChange/index.d.mts +2 -4
  108. package/dist/hooks/useWatchUserChange/index.d.mts.map +1 -1
  109. package/dist/hooks/useWatchUserChange/index.mjs +3 -5
  110. package/dist/hooks/useWatchUserChange/index.mjs.map +1 -1
  111. package/dist/index-DaiTW5Bl.d.mts +99 -0
  112. package/dist/index-DaiTW5Bl.d.mts.map +1 -0
  113. package/dist/partials/FieldCopyTestIdButton/index.d.mts +0 -2
  114. package/dist/partials/FieldCopyTestIdButton/index.d.mts.map +1 -1
  115. package/dist/partials/FieldCopyTestIdButton/index.mjs +1 -2
  116. package/dist/partials/FieldValidationError/index.d.mts +0 -2
  117. package/dist/partials/FieldValidationError/index.d.mts.map +1 -1
  118. package/dist/partials/FieldValidationError/index.mjs +1 -2
  119. package/dist/{useController-BBSbeKbn.mjs → useController-CJjMqXU5.mjs} +3 -4
  120. package/dist/{useController-BBSbeKbn.mjs.map → useController-CJjMqXU5.mjs.map} +1 -1
  121. package/dist/{useController-DcK2YHbw.d.mts → useController-CdFEp-Wa.d.mts} +2 -4
  122. package/dist/useController-CdFEp-Wa.d.mts.map +1 -0
  123. package/dist/{useFormContext-DNb_B8LQ.mjs → useFormContext-BEjPBdzb.mjs} +3 -4
  124. package/dist/useFormContext-BEjPBdzb.mjs.map +1 -0
  125. package/dist/useFormContext-BhPzFXwF.d.mts +45 -0
  126. package/dist/useFormContext-BhPzFXwF.d.mts.map +1 -0
  127. package/dist/useInput-NPbS4w_n.mjs +1 -0
  128. package/dist/{useInputValueTransform-DJ5zkqSy.mjs → useInputValueTransform-D44BLp1Z.mjs} +2 -3
  129. package/dist/{useInputValueTransform-DJ5zkqSy.mjs.map → useInputValueTransform-D44BLp1Z.mjs.map} +1 -1
  130. package/dist/{useInputValueTransform-LOaEim7k.d.mts → useInputValueTransform-cevZBrIN.d.mts} +3 -5
  131. package/dist/useInputValueTransform-cevZBrIN.d.mts.map +1 -0
  132. package/package.json +9 -9
  133. package/dist/FormContext-CB7Glm02.mjs.map +0 -1
  134. package/dist/FormContext-CsFiNvuJ.d.mts +0 -19
  135. package/dist/FormContext-CsFiNvuJ.d.mts.map +0 -1
  136. package/dist/hooks/useUniformField/index.d.mts.map +0 -1
  137. package/dist/index-CAdGtKE_.d.mts +0 -1
  138. package/dist/index-CwJo1b4Z.d.mts +0 -1
  139. package/dist/useController-DcK2YHbw.d.mts.map +0 -1
  140. package/dist/useFormContext-BegmYvGA.d.mts +0 -66
  141. package/dist/useFormContext-BegmYvGA.d.mts.map +0 -1
  142. package/dist/useFormContext-DNb_B8LQ.mjs.map +0 -1
  143. package/dist/useInput-C0aJaAGe.mjs +0 -2
  144. package/dist/useInputValueTransform-LOaEim7k.d.mts.map +0 -1
@@ -0,0 +1,45 @@
1
+ import { n as UniformContext } from "./FormContext-BnNJYZOo.mjs";
2
+ import { ContextType } from "react";
3
+ import { FieldError, FieldValues, Path, UseFormReturn } from "react-hook-form";
4
+ import { VetoInstance } from "@fuf-stack/veto";
5
+ /** Schema check whether a field is required or optional */
6
+ declare const checkFieldIsRequired: (validation: VetoInstance, path: string[]) => boolean;
7
+ /** Field state returned by the enhanced `getFieldState` */
8
+ interface UniformFieldState {
9
+ /** Validation errors for the field from the Uniform validation schema */
10
+ error: FieldError[] | undefined;
11
+ /** Whether the field has validation errors */
12
+ invalid: boolean;
13
+ /** Whether the field value differs from its default value */
14
+ isDirty: boolean;
15
+ /** Whether the field has been touched */
16
+ isTouched: boolean;
17
+ /** Whether the field is currently being validated */
18
+ isValidating: boolean;
19
+ /** Whether the validation schema requires the field */
20
+ required: boolean;
21
+ /** Generated HTML data-testid for the field */
22
+ testId: string;
23
+ }
24
+ /**
25
+ * Return type of `useFormContext`.
26
+ *
27
+ * Declared explicitly so the published declarations only reference types that
28
+ * react-hook-form exports from its package root.
29
+ */
30
+ type UseFormContextReturn<TFieldValues extends FieldValues = FieldValues, TContext = any, TTransformedValues = TFieldValues> = Omit<UseFormReturn<TFieldValues, TContext, TTransformedValues>, 'getFieldState'> & ContextType<typeof UniformContext> & {
31
+ getFieldState: (name: Path<TFieldValues>, testId?: string) => UniformFieldState;
32
+ };
33
+ /**
34
+ * Custom hook that extends react-hook-form's useFormContext to add validation and state management.
35
+ *
36
+ * Key features:
37
+ * - Enhanced `getFieldState` that includes validation schema-based "required" status and testId generation
38
+ * - Automatic conversion of form values via `getValues`, `watch`, and `subscribe`:
39
+ * - Unwraps flat array wrappers (`{ __FLAT__: value }` → `value`)
40
+ * - Converts nullish string markers (`__NULL__` → `null`, `__FALSE__` → `false`, `__ZERO__` → `0`)
41
+ * - Filters out empty/null values
42
+ */
43
+ declare const useFormContext$1: <TFieldValues extends FieldValues = FieldValues, TContext = any, TTransformedValues = TFieldValues>() => UseFormContextReturn<TFieldValues, TContext, TTransformedValues>;
44
+ export { useFormContext$1 as i, UseFormContextReturn as n, checkFieldIsRequired as r, UniformFieldState as t };
45
+ //# sourceMappingURL=useFormContext-BhPzFXwF.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useFormContext-BhPzFXwF.d.mts","names":["useFormContext"],"sources":["../src/hooks/useFormContext/useFormContext.ts"],"mappings":";;;;;cAkBa,uBACX,YAAY,cACZ;;UA0De;;EAEf,OAAO;;EAEP;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;;;;;;;KASU,qBACV,qBAAqB,cAAc,aACnC,gBACA,qBAAqB,gBACnB,KACF,cAAc,cAAc,UAAU,wCAGtC,mBAAmB;EACjB,gBACE,MAAM,KAAK,eACX,oBACG;;;;;;;;;;;;cAaIA,mBACX,qBAAqB,cAAc,aACnC,gBACA,qBAAqB,mBAClB,qBAAqB,cAAc,UAAU"}
@@ -0,0 +1 @@
1
+ export { useInput as t } from "@heroui/input";
@@ -1,5 +1,5 @@
1
1
  import { useCallback } from "react";
2
- //#region src/hooks/useInputValueTransform/useInputValueTransform.ts
2
+ // src/hooks/useInputValueTransform/useInputValueTransform.ts
3
3
  /**
4
4
  * Custom hook providing utility functions for value transformations between display and form values.
5
5
  *
@@ -104,7 +104,6 @@ const useInputValueTransform = ({ type, transform }) => {
104
104
  }, [type, transform])
105
105
  };
106
106
  };
107
- //#endregion
108
107
  export { useInputValueTransform as t };
109
108
 
110
- //# sourceMappingURL=useInputValueTransform-DJ5zkqSy.mjs.map
109
+ //# sourceMappingURL=useInputValueTransform-D44BLp1Z.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"useInputValueTransform-DJ5zkqSy.mjs","names":[],"sources":["../src/hooks/useInputValueTransform/useInputValueTransform.ts"],"sourcesContent":["import { useCallback } from 'react';\n\nexport interface InputValueTransform<TDisplay = unknown> {\n /** Transforms the form value to display value (e.g., 1000 → \"$1,000\" or 'a' → ['a']) */\n toDisplayValue: (value: unknown) => TDisplay;\n /** Transforms the display value to form value (e.g., \"$1,000\" → 1000 or ['a'] → 'a') */\n toFormValue: (value: TDisplay) => unknown;\n}\n\nexport interface UseInputValueTransformOptions<TDisplay = unknown> {\n /** Input type for special number handling */\n type?: 'text' | 'number' | 'password';\n /** Value transformation functions */\n transform?: InputValueTransform<TDisplay>;\n}\n\nexport interface UseInputValueTransformReturn<TDisplay = unknown> {\n /** Converts any form value to display value */\n toDisplayValue: (formValue: unknown) => TDisplay;\n /** Converts any display value to form value */\n toFormValue: (displayValue: TDisplay) => unknown;\n}\n\n/**\n * Custom hook providing utility functions for value transformations between display and form values.\n *\n * This hook provides pure conversion functions without any state management. It's useful for:\n * - Currency formatting ($1,000 display vs 1000 stored)\n * - Number inputs with special handling\n * - Date formatting (MM/DD/YYYY display vs ISO date stored)\n * - Phone number formatting ((555) 123-4567 display vs 5551234567 stored)\n * - Array/Object transformations (single value ↔ array, nested structures)\n *\n * **Key Features:**\n * - Pure conversion functions (no state)\n * - Generic support for any data type (strings, numbers, arrays, objects)\n * - Special number input handling (empty string preservation)\n * - Bidirectional value transformations\n * - Memoized functions for performance\n *\n * @param options Configuration for value transformation\n * @returns Pure conversion utility functions\n *\n * @example\n * ```tsx\n * // Currency formatting\n * const currencyTransform = {\n * toDisplayValue: (val) => val ? `$${Number(val).toLocaleString()}` : '',\n * toFormValue: (val) => parseFloat(val.replace(/[$,]/g, '')) || 0\n * };\n *\n * const { toDisplayValue, toFormValue } = useInputValueTransform({\n * transform: currencyTransform\n * });\n *\n * const displayVal = toDisplayValue(1000); // \"$1,000\"\n * const formVal = toFormValue(\"$1,500\"); // 1500\n * ```\n *\n * @example\n * ```tsx\n * // Number input (no transforms needed)\n * const { toDisplayValue, toFormValue } = useInputValueTransform({\n * type: 'number'\n * });\n *\n * // Handles empty string → empty string (not NaN)\n * // Handles \"123\" → 123 (string to number conversion)\n * ```\n *\n * @example\n * ```tsx\n * // Array to single value (for single checkbox)\n * const singleValueTransform = {\n * toDisplayValue: (val: string[]) => val?.[0] || '',\n * toFormValue: (val: string) => val ? [val] : []\n * };\n *\n * const { toDisplayValue, toFormValue } = useInputValueTransform({\n * transform: singleValueTransform\n * });\n *\n * const displayVal = toDisplayValue(['option1']); // \"option1\"\n * const formVal = toFormValue(\"option2\"); // [\"option2\"]\n * ```\n *\n * @example\n * ```tsx\n * // Integration with debouncing\n * const MyInput = ({ field, transform }) => {\n * const transform = useInputValueTransform({ transform });\n *\n * const { onChange, onBlur, value } = useInputValueDebounce({\n * ...transform,\n * debounceDelay: 300,\n * name: 'fieldName',\n * onBlur: field.onBlur,\n * onChange: field.onChange,\n * value: field.value,\n * });\n *\n * return <input value={value} onChange={onChange} onBlur={onBlur} />;\n * };\n * ```\n */\nexport const useInputValueTransform = <TDisplay = unknown>({\n type,\n transform,\n}: UseInputValueTransformOptions<TDisplay>): UseInputValueTransformReturn<TDisplay> => {\n /**\n * Converts any form value to display value\n */\n const toDisplayValue = useCallback(\n (formValue: unknown): TDisplay => {\n if (transform?.toDisplayValue) {\n return transform.toDisplayValue(formValue);\n }\n\n // For number type, convert valid strings to numbers for display\n if (type === 'number') {\n if (formValue === '') {\n return '' as TDisplay;\n }\n const numValue = Number(formValue);\n return (Number.isNaN(numValue) ? formValue : numValue) as TDisplay;\n }\n\n // Default: pass through (handles primitives, arrays, objects, etc.)\n return (formValue ?? '') as TDisplay;\n },\n [type, transform],\n );\n\n /**\n * Converts any display value to form value\n */\n const toFormValue = useCallback(\n (displayValue: TDisplay): unknown => {\n if (transform?.toFormValue) {\n return transform.toFormValue(displayValue);\n }\n\n // For number type, convert strings to numbers\n if (type === 'number') {\n if (displayValue === '') {\n return '';\n }\n const numValue = Number(displayValue);\n return Number.isNaN(numValue) ? displayValue : numValue;\n }\n\n // Default: pass through (handles primitives, arrays, objects, etc.)\n return displayValue;\n },\n [type, transform],\n );\n\n return {\n toDisplayValue,\n toFormValue,\n };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyGA,MAAa,0BAA8C,EACzD,MACA,gBACqF;CAiDrF,OAAO;EACL,gBA9CqB,aACpB,cAAiC;GAChC,IAAI,WAAW,gBACb,OAAO,UAAU,eAAe,SAAS;GAI3C,IAAI,SAAS,UAAU;IACrB,IAAI,cAAc,IAChB,OAAO;IAET,MAAM,WAAW,OAAO,SAAS;IACjC,OAAQ,OAAO,MAAM,QAAQ,IAAI,YAAY;GAC/C;GAGA,OAAQ,aAAa;EACvB,GACA,CAAC,MAAM,SAAS,CA4BH;EACb,aAvBkB,aACjB,iBAAoC;GACnC,IAAI,WAAW,aACb,OAAO,UAAU,YAAY,YAAY;GAI3C,IAAI,SAAS,UAAU;IACrB,IAAI,iBAAiB,IACnB,OAAO;IAET,MAAM,WAAW,OAAO,YAAY;IACpC,OAAO,OAAO,MAAM,QAAQ,IAAI,eAAe;GACjD;GAGA,OAAO;EACT,GACA,CAAC,MAAM,SAAS,CAKN;CACZ;AACF"}
1
+ {"version":3,"file":"useInputValueTransform-D44BLp1Z.mjs","names":[],"sources":["../src/hooks/useInputValueTransform/useInputValueTransform.ts"],"sourcesContent":["import { useCallback } from 'react';\n\nexport interface InputValueTransform<TDisplay = unknown> {\n /** Transforms the form value to display value (e.g., 1000 → \"$1,000\" or 'a' → ['a']) */\n toDisplayValue: (value: unknown) => TDisplay;\n /** Transforms the display value to form value (e.g., \"$1,000\" → 1000 or ['a'] → 'a') */\n toFormValue: (value: TDisplay) => unknown;\n}\n\nexport interface UseInputValueTransformOptions<TDisplay = unknown> {\n /** Value transformation functions */\n transform?: InputValueTransform<TDisplay>;\n /** Input type for special number handling */\n type?: 'text' | 'number' | 'password';\n}\n\nexport interface UseInputValueTransformReturn<TDisplay = unknown> {\n /** Converts any form value to display value */\n toDisplayValue: (formValue: unknown) => TDisplay;\n /** Converts any display value to form value */\n toFormValue: (displayValue: TDisplay) => unknown;\n}\n\n/**\n * Custom hook providing utility functions for value transformations between display and form values.\n *\n * This hook provides pure conversion functions without any state management. It's useful for:\n * - Currency formatting ($1,000 display vs 1000 stored)\n * - Number inputs with special handling\n * - Date formatting (MM/DD/YYYY display vs ISO date stored)\n * - Phone number formatting ((555) 123-4567 display vs 5551234567 stored)\n * - Array/Object transformations (single value ↔ array, nested structures)\n *\n * **Key Features:**\n * - Pure conversion functions (no state)\n * - Generic support for any data type (strings, numbers, arrays, objects)\n * - Special number input handling (empty string preservation)\n * - Bidirectional value transformations\n * - Memoized functions for performance\n *\n * @param options Configuration for value transformation\n * @returns Pure conversion utility functions\n *\n * @example\n * ```tsx\n * // Currency formatting\n * const currencyTransform = {\n * toDisplayValue: (val) => val ? `$${Number(val).toLocaleString()}` : '',\n * toFormValue: (val) => parseFloat(val.replace(/[$,]/g, '')) || 0\n * };\n *\n * const { toDisplayValue, toFormValue } = useInputValueTransform({\n * transform: currencyTransform\n * });\n *\n * const displayVal = toDisplayValue(1000); // \"$1,000\"\n * const formVal = toFormValue(\"$1,500\"); // 1500\n * ```\n *\n * @example\n * ```tsx\n * // Number input (no transforms needed)\n * const { toDisplayValue, toFormValue } = useInputValueTransform({\n * type: 'number'\n * });\n *\n * // Handles empty string → empty string (not NaN)\n * // Handles \"123\" → 123 (string to number conversion)\n * ```\n *\n * @example\n * ```tsx\n * // Array to single value (for single checkbox)\n * const singleValueTransform = {\n * toDisplayValue: (val: string[]) => val?.[0] || '',\n * toFormValue: (val: string) => val ? [val] : []\n * };\n *\n * const { toDisplayValue, toFormValue } = useInputValueTransform({\n * transform: singleValueTransform\n * });\n *\n * const displayVal = toDisplayValue(['option1']); // \"option1\"\n * const formVal = toFormValue(\"option2\"); // [\"option2\"]\n * ```\n *\n * @example\n * ```tsx\n * // Integration with debouncing\n * const MyInput = ({ field, transform }) => {\n * const transform = useInputValueTransform({ transform });\n *\n * const { onChange, onBlur, value } = useInputValueDebounce({\n * ...transform,\n * debounceDelay: 300,\n * name: 'fieldName',\n * onBlur: field.onBlur,\n * onChange: field.onChange,\n * value: field.value,\n * });\n *\n * return <input value={value} onChange={onChange} onBlur={onBlur} />;\n * };\n * ```\n */\nexport const useInputValueTransform = <TDisplay = unknown>({\n type,\n transform,\n}: UseInputValueTransformOptions<TDisplay>): UseInputValueTransformReturn<TDisplay> => {\n /**\n * Converts any form value to display value\n */\n const toDisplayValue = useCallback(\n (formValue: unknown): TDisplay => {\n if (transform?.toDisplayValue) {\n return transform.toDisplayValue(formValue);\n }\n\n // For number type, convert valid strings to numbers for display\n if (type === 'number') {\n if (formValue === '') {\n return '' as TDisplay;\n }\n const numValue = Number(formValue);\n return (Number.isNaN(numValue) ? formValue : numValue) as TDisplay;\n }\n\n // Default: pass through (handles primitives, arrays, objects, etc.)\n return (formValue ?? '') as TDisplay;\n },\n [type, transform],\n );\n\n /**\n * Converts any display value to form value\n */\n const toFormValue = useCallback(\n (displayValue: TDisplay): unknown => {\n if (transform?.toFormValue) {\n return transform.toFormValue(displayValue);\n }\n\n // For number type, convert strings to numbers\n if (type === 'number') {\n if (displayValue === '') {\n return '';\n }\n const numValue = Number(displayValue);\n return Number.isNaN(numValue) ? displayValue : numValue;\n }\n\n // Default: pass through (handles primitives, arrays, objects, etc.)\n return displayValue;\n },\n [type, transform],\n );\n\n return {\n toDisplayValue,\n toFormValue,\n };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyGA,MAAa,0BAA8C,EACzD,MACA,gBACqF;CAiDrF,OAAO;EACL,gBA9CqB,aACpB,cAAiC;GAChC,IAAI,WAAW,gBACb,OAAO,UAAU,eAAe,SAAS;GAI3C,IAAI,SAAS,UAAU;IACrB,IAAI,cAAc,IAChB,OAAO;IAET,MAAM,WAAW,OAAO,SAAS;IACjC,OAAQ,OAAO,MAAM,QAAQ,IAAI,YAAY;GAC/C;GAGA,OAAQ,aAAa;EACvB,GACA,CAAC,MAAM,SAAS,CA4BH;EACb,aAvBkB,aACjB,iBAAoC;GACnC,IAAI,WAAW,aACb,OAAO,UAAU,YAAY,YAAY;GAI3C,IAAI,SAAS,UAAU;IACrB,IAAI,iBAAiB,IACnB,OAAO;IAET,MAAM,WAAW,OAAO,YAAY;IACpC,OAAO,OAAO,MAAM,QAAQ,IAAI,eAAe;GACjD;GAGA,OAAO;EACT,GACA,CAAC,MAAM,SAAS,CAKN;CACZ;AACF"}
@@ -1,4 +1,3 @@
1
- //#region src/hooks/useInputValueTransform/useInputValueTransform.d.ts
2
1
  interface InputValueTransform<TDisplay = unknown> {
3
2
  /** Transforms the form value to display value (e.g., 1000 → "$1,000" or 'a' → ['a']) */
4
3
  toDisplayValue: (value: unknown) => TDisplay;
@@ -6,10 +5,10 @@ interface InputValueTransform<TDisplay = unknown> {
6
5
  toFormValue: (value: TDisplay) => unknown;
7
6
  }
8
7
  interface UseInputValueTransformOptions<TDisplay = unknown> {
9
- /** Input type for special number handling */
10
- type?: 'text' | 'number' | 'password';
11
8
  /** Value transformation functions */
12
9
  transform?: InputValueTransform<TDisplay>;
10
+ /** Input type for special number handling */
11
+ type?: 'text' | 'number' | 'password';
13
12
  }
14
13
  interface UseInputValueTransformReturn<TDisplay = unknown> {
15
14
  /** Converts any form value to display value */
@@ -100,6 +99,5 @@ interface UseInputValueTransformReturn<TDisplay = unknown> {
100
99
  * ```
101
100
  */
102
101
  declare const useInputValueTransform: <TDisplay = unknown>({ type, transform }: UseInputValueTransformOptions<TDisplay>) => UseInputValueTransformReturn<TDisplay>;
103
- //#endregion
104
102
  export { useInputValueTransform as i, UseInputValueTransformOptions as n, UseInputValueTransformReturn as r, InputValueTransform as t };
105
- //# sourceMappingURL=useInputValueTransform-LOaEim7k.d.mts.map
103
+ //# sourceMappingURL=useInputValueTransform-cevZBrIN.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useInputValueTransform-cevZBrIN.d.mts","names":[],"sources":["../src/hooks/useInputValueTransform/useInputValueTransform.ts"],"mappings":"A,UAEiB,oBAAoB;;EAEnC,iBAAiB,mBAAmB;;EAEpC,cAAc,OAAO;;UAGN,8BAA8B;;EAE7C,YAAY,oBAAoB;;EAEhC;;UAGe,6BAA6B;;EAE5C,iBAAiB,uBAAuB;;EAExC,cAAc,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAqFjB,yBAA0B,sBAAoB,MAAA,aAGxD,8BAA8B,cAAY,6BAA6B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fuf-stack/uniform",
3
- "version": "1.28.0",
3
+ "version": "1.28.1",
4
4
  "description": "fuf react form library",
5
5
  "author": "Fröhlich ∧ Frei",
6
6
  "homepage": "https://github.com/fuf-stack/pixels#readme",
@@ -70,8 +70,8 @@
70
70
  "@dnd-kit/utilities": "3.2.2",
71
71
  "@fuf-stack/pixel-motion": "1.4.0",
72
72
  "@fuf-stack/pixel-utils": "1.4.1",
73
- "@fuf-stack/pixels": "1.14.1",
74
- "@fuf-stack/veto": "1.11.0",
73
+ "@fuf-stack/pixels": "1.15.0",
74
+ "@fuf-stack/veto": "1.11.1",
75
75
  "@heroui/button": "2.2.32",
76
76
  "@heroui/checkbox": "2.3.32",
77
77
  "@heroui/date-input": "2.3.32",
@@ -88,16 +88,16 @@
88
88
  "@react-aria/visually-hidden": "3.9.1",
89
89
  "debug": "4.4.3",
90
90
  "framer-motion": "12.43.0",
91
- "react-hook-form": "7.81.0",
91
+ "react-hook-form": "7.91.0",
92
92
  "react-icons": "5.7.0",
93
93
  "react-select": "5.10.2"
94
94
  },
95
95
  "devDependencies": {
96
96
  "@types/debug": "4.1.13",
97
- "@types/react": "19.2.18",
98
- "@types/react-dom": "19.2.7",
99
- "react": "19.2.8",
100
- "react-dom": "19.2.8"
97
+ "@types/react": "19.3.0",
98
+ "@types/react-dom": "19.3.0",
99
+ "react": "19.3.1",
100
+ "react-dom": "19.3.1"
101
101
  },
102
- "gitHead": "708bd806bdd1b51ac4204899d559586820a09c26"
102
+ "gitHead": "fa0ef48d2005686a8a7166028d9c75262b6ad071"
103
103
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"FormContext-CB7Glm02.mjs","names":["FormProvider","HookFormProvider"],"sources":["../src/Form/subcomponents/SensitiveFields.tsx","../src/Form/subcomponents/FormResolver.ts","../src/Form/subcomponents/FormContext.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\n\nimport {\n createContext,\n useContext,\n useLayoutEffect,\n useSyncExternalStore,\n} from 'react';\n\n/**\n * Diagnostic redaction for explicitly registered form paths.\n *\n * Flow:\n * 1. FormProvider creates one registry for its form and supplies it through context.\n * 2. useUniformField calls useSensitiveField for declared password inputs and\n * fields marked sensitive. This module does not infer secrets from names,\n * inspect the DOM, or search strings for password-like content.\n * 3. Field layout effects register their paths before the provider marks the\n * initial registry ready. The debug viewer waits for that ready signal.\n * 4. The viewer and Uniform's debug logger redact diagnostic copies using the\n * same registry. JSON copy actions receive the viewer's redacted data too.\n *\n * This is protection against accidental disclosure in Uniform diagnostics,\n * not encryption or a boundary against browser inspection. Real values remain\n * available to inputs, validation, submission, and application callbacks.\n * Application logging and secrets embedded in unrelated paths/custom messages\n * are outside this path-based redaction mechanism.\n */\n\n// A fixed placeholder avoids exposing the secret's content, type, or length.\nconst REDACTED = '[REDACTED]';\n\n/**\n * Build a diagnostic copy with each registered field replaced by [REDACTED].\n *\n * Matching a field masks its entire subtree. For validation errors, that also\n * removes error metadata/messages beneath that field, which may contain input.\n * The source object is never changed: redacting form state itself would corrupt\n * validation and the values ultimately delivered to onSubmit.\n *\n * Paths use React Hook Form dot notation, with numeric bracket indices accepted\n * as well. Normalization removes Uniform's __FLAT__ transport wrapper so the\n * same registration covers raw form data and normalized/submitted array values.\n *\n * Traversal covers arrays and plain objects. Non-data instances such as dates\n * and DOM refs are preserved unless their path or an ancestor is sensitive.\n * This is deliberately not a general-purpose serializer or secret detector.\n *\n * @param data - Form values or errors destined for Uniform diagnostics\n * @param paths - Sensitive field paths registered for this form\n * @returns A diagnostic copy with registered fields replaced, or the unchanged\n * primitive/non-data instance when no traversal is necessary\n */\nexport const redactDebugData = (\n data: unknown,\n paths: readonly string[],\n): unknown => {\n const sensitivePaths = new Set(\n paths.map((path) => {\n return path\n .replace(/\\[(\\d+)\\]/g, '.$1')\n .split('.')\n .filter((part) => {\n return part !== '__FLAT__';\n })\n .join('.');\n }),\n );\n // Track only the current recursion's ancestors. This breaks traversal cycles\n // without reusing a differently redacted copy at another field path.\n const copies = new WeakMap<object, unknown>();\n const visit = (value: unknown, path: string): unknown => {\n // Check before descending or returning an object reference: a sensitive\n // field must be replaced wholesale, even when its value is an object.\n if (sensitivePaths.has(path)) {\n return REDACTED;\n }\n if (!value || typeof value !== 'object') {\n return value;\n }\n const existing = copies.get(value);\n if (existing) {\n return existing;\n }\n if (Array.isArray(value)) {\n const copy: unknown[] = [];\n copies.set(value, copy);\n value.forEach((item, index) => {\n copy[index] = visit(item, path ? `${path}.${index}` : String(index));\n });\n copies.delete(value);\n return copy;\n }\n // Preserve non-data objects, such as dates and refs in non-sensitive errors.\n const prototype: unknown = Object.getPrototypeOf(value);\n if (prototype !== Object.prototype && prototype !== null) {\n return value;\n }\n const copy: Record<string, unknown> = {};\n copies.set(value, copy);\n Object.entries(value as Record<string, unknown>).forEach(([key, entry]) => {\n // Define an own property rather than assigning through __proto__ or any\n // inherited setter when copying arbitrary form-data keys.\n Object.defineProperty(copy, key, {\n value: visit(entry, path ? `${path}.${key}` : key),\n enumerable: true,\n writable: true,\n configurable: true,\n });\n });\n // Cache only ancestors for cycle handling: shared objects at other paths\n // need their own redaction pass because sensitivity belongs to the path.\n copies.delete(value);\n return copy;\n };\n return visit(data, '');\n};\n\n/**\n * Create an isolated, append-only sensitivity registry for one form instance.\n *\n * Only field paths and readiness are stored here; the registry does not retain\n * password values. Paths intentionally survive input unmounts, resets, and a\n * later sensitive=false declaration because RHF can retain the original value.\n * A new form instance gets a fresh registry; there is no cross-form path sharing.\n *\n * Snapshot objects stay referentially stable until metadata actually changes.\n * useSyncExternalStore depends on that stability to avoid repeated renders.\n */\nexport const createSensitiveFields = () => {\n let snapshot: { paths: readonly string[]; ready: boolean } = {\n paths: [],\n ready: false,\n };\n const listeners = new Set<() => void>();\n const notify = () => {\n listeners.forEach((listener) => {\n listener();\n });\n };\n return {\n /** Return the current stable metadata snapshot, without reading form values. */\n getSnapshot: () => {\n return snapshot;\n },\n /** Subscribe to metadata changes; cleanup removes the listener, not paths. */\n subscribe: (listener: () => void) => {\n listeners.add(listener);\n return () => {\n listeners.delete(listener);\n };\n },\n /** Mark a path once; duplicate registrations and Strict Mode repeats are safe. */\n register: (name: string) => {\n if (snapshot.paths.includes(name)) {\n return;\n }\n // RHF retains values for unmounted fields. Retain their sensitivity for\n // the form's lifetime too, so hiding an input never reveals its secret.\n snapshot = { ...snapshot, paths: [...snapshot.paths, name] };\n notify();\n },\n /** Allow the debug viewer to render after initial field registration finishes. */\n ready: () => {\n if (snapshot.ready) {\n return;\n }\n snapshot = { ...snapshot, ready: true };\n notify();\n },\n /** Use the latest paths for logs, even while the debug viewer is closed. */\n redact: (data: unknown) => {\n return redactDebugData(data, snapshot.paths);\n },\n };\n};\n\ntype SensitiveFields = ReturnType<typeof createSensitiveFields>;\n// An immutable-in-practice empty fallback supports isolated viewer tests and\n// consumers without this provider. useSensitiveField never writes to it, so it\n// cannot leak registrations between unrelated forms or component tests.\nconst defaultSensitiveFields = createSensitiveFields();\ndefaultSensitiveFields.ready();\nconst SensitiveFieldsContext = createContext<SensitiveFields | undefined>(\n undefined,\n);\n\n/**\n * Supply the form-owned registry and release the initial debug-render gate.\n *\n * React runs descendant layout effects before this provider's layout effect,\n * so initially mounted fields register before ready becomes true. The viewer\n * must not render raw values while ready is false, even if debug mode was\n * restored from localStorage before the form's first render.\n */\nexport const SensitiveFieldsProvider = ({\n children,\n registry,\n}: {\n children: ReactNode;\n registry: SensitiveFields;\n}) => {\n // Child layout effects register initial fields before debug data is shown.\n useLayoutEffect(() => {\n registry.ready();\n }, [registry]);\n return (\n <SensitiveFieldsContext.Provider value={registry}>\n {children}\n </SensitiveFieldsContext.Provider>\n );\n};\n\n/**\n * Register a field's sensitivity as declared by its renderer/shared field hook.\n *\n * Registration happens during commit, not render, so abandoned React renders\n * cannot mutate the registry. Layout timing makes new registrations available\n * before paint. Password detection uses the declared input type in\n * useUniformField, so toggling the rendered type to text does not reveal debug\n * values. Once registered, a path is never downgraded within this form instance.\n *\n * @param name - The field path used for form registration\n * @param sensitive - Whether the renderer declares this field sensitive\n */\nexport const useSensitiveField = (name: string, sensitive: boolean) => {\n const registry = useContext(SensitiveFieldsContext);\n useLayoutEffect(() => {\n if (sensitive) {\n registry?.register(name);\n }\n }, [registry, name, sensitive]);\n};\n\n/**\n * Observe sensitivity metadata for rendering diagnostic copies.\n *\n * This subscription contains neither passwords nor RHF's mutable value objects.\n * The debug viewer keeps its existing value subscription and applies these paths\n * when handing values/errors to Json; getValues and onSubmit stay untouched.\n * Callers must honor ready before exposing an initial diagnostic payload.\n */\nexport const useSensitiveDebug = () => {\n const registry = useContext(SensitiveFieldsContext) ?? defaultSensitiveFields;\n // Subscribe only to stable metadata snapshots, not RHF's mutable value objects.\n return useSyncExternalStore(\n registry.subscribe,\n registry.getSnapshot,\n registry.getSnapshot,\n );\n};\n","import type {\n VetoFormattedError,\n VetoInstance,\n VetoTypeAny,\n} from '@fuf-stack/veto';\nimport type { FieldValues } from 'react-hook-form';\n\nimport { useCallback, useMemo, useState } from 'react';\n\nimport { and, veto } from '@fuf-stack/veto';\n\nimport { toValidationFormat } from '../../helpers';\n\n/**\n * Hook that manages client validation schemas state.\n *\n * Provides a centralized way to add/remove dynamic validation schemas\n * that can be combined with base form validation.\n *\n * @returns Object with client validation state and memoized setter function\n */\nexport const useClientValidationManager = () => {\n // Client validation schemas state\n const [clientValidationSchemas, setClientValidationSchemas] = useState<\n Record<string, VetoTypeAny>\n >({});\n\n // Memoized function to set/clear client validation schema\n const setClientValidationSchema = useMemo(() => {\n return (key: string, schema: VetoTypeAny | null) => {\n // update client validation schemas\n setClientValidationSchemas((prev) => {\n // if no schema and no existing client validation schema for this key, do nothing\n if (!prev[key] && !schema) {\n return prev;\n }\n // if no schema, remove the client validation schema for this key\n if (!schema) {\n const { [key]: _removed, ...rest } = prev;\n return rest;\n }\n // if schema, add or update the client validation schema for this key\n return { ...prev, [key]: schema };\n });\n };\n }, []);\n\n return {\n clientValidationSchemas,\n setClientValidationSchema,\n };\n};\n\n/**\n * Hook that creates an extended validation instance combining base Veto validation with dynamic client validation.\n *\n * @param baseValidation - Optional base Veto validation schema\n * @returns Combined validation instance and client schema setter\n */\nexport const useExtendedValidation = (baseValidation?: VetoInstance) => {\n // Setup client validation schemas\n const { clientValidationSchemas, setClientValidationSchema } =\n useClientValidationManager();\n\n // Create a stable dependency array from the client validation schemas\n const clientSchemaValues = useMemo<VetoTypeAny[]>(\n () => {\n const keys = Object.keys(clientValidationSchemas).sort();\n return keys\n .map((key) => {\n return clientValidationSchemas[key];\n })\n .filter((schema): schema is VetoTypeAny => {\n return Boolean(schema);\n });\n },\n // Include the object identity to react to schema instance updates with same shape\n [clientValidationSchemas],\n );\n\n // Memoized extended validation instance\n const extendedValidation = useMemo(\n () => {\n const hasBaseValidation = !!baseValidation;\n const hasClientSchemas = clientSchemaValues.length > 0;\n\n // If no base validation and no client schemas, return undefined\n if (!hasBaseValidation && !hasClientSchemas) {\n return undefined;\n }\n\n // If no client schemas, return base validation\n if (!hasClientSchemas) {\n return baseValidation;\n }\n\n // Combine client validation schemas\n const clientSchemasCombined =\n clientSchemaValues.reduce<VetoTypeAny | null>(\n (combined, clientSchema) => {\n return combined ? and(combined, clientSchema) : clientSchema;\n },\n null,\n );\n\n // return combined validation\n if (baseValidation && clientSchemasCombined) {\n // Put client validation first so dynamic/domain-specific messages\n // are returned before generic base validation errors.\n const baseSchema = baseValidation.schema as VetoTypeAny;\n return veto(and(clientSchemasCombined, baseSchema));\n }\n\n // If we only have client schemas, return them as a veto instance\n if (clientSchemasCombined) {\n return veto(clientSchemasCombined);\n }\n\n // This should not happen due to the conditions above, but just in case\n return baseValidation;\n },\n // Recompute when validation schema instances change\n [baseValidation, clientSchemaValues],\n );\n\n return {\n extendedValidation,\n setClientValidationSchema,\n };\n};\n\n/**\n * Render state for formatted validation errors produced by the resolver.\n *\n * `errors` is the value exposed through Uniform context. `hash` is the stable\n * comparison key used to avoid re-rendering context consumers when validation\n * returns an equivalent error object with a new identity.\n */\ninterface ValidationErrorsState {\n /** Formatted validation errors exposed to Uniform consumers. */\n errors: VetoFormattedError | undefined;\n /** JSON hash of `errors`, used as a cheap equality signal. */\n hash: string | undefined;\n}\n\n/**\n * Creates a React Hook Form resolver from an extended validation instance and\n * stores its latest formatted Veto errors as React state.\n *\n * Keeping the resolver errors in state lets Uniform context consumers re-render\n * when validation output changes, while the hash prevents repeated validations\n * with equivalent errors from causing unnecessary updates.\n *\n * @param extendedValidation - Extended validation instance from useExtendedValidation\n * @returns Resolver function plus the latest validation errors and their hash\n */\nexport const useFormResolver = (extendedValidation?: VetoInstance) => {\n // Keep the latest resolver errors in React state so Uniform context consumers\n // re-render when validation output changes. The paired hash lets us skip the\n // state update when a resolver run returns equivalent errors.\n const [validationErrorsState, setValidationErrorsState] =\n useState<ValidationErrorsState>({\n errors: undefined,\n hash: undefined,\n });\n\n /**\n * Updates resolver error state only when the formatted validation result\n * actually changes. Veto/RHF may create new error objects for equivalent\n * validation output, so the hash is the guard against avoidable context\n * refreshes.\n */\n const updateValidationErrors = useCallback(\n (errors: VetoFormattedError | undefined): void => {\n const nextHash = JSON.stringify(errors);\n\n setValidationErrorsState((current) => {\n if (current.hash === nextHash) {\n return current;\n }\n\n return {\n errors,\n hash: nextHash,\n };\n });\n },\n [],\n );\n\n // Memoized resolver function for React Hook Form\n const resolver = useMemo(() => {\n if (!extendedValidation) {\n return undefined;\n }\n\n return async (values: FieldValues) => {\n const validationValues = toValidationFormat(values) ?? {};\n const result = await extendedValidation.validateAsync(validationValues);\n updateValidationErrors(result.errors ?? undefined);\n\n // Transform veto result to React Hook Form format\n return {\n values: result.data ?? {},\n errors: result.errors ?? {},\n };\n };\n }, [extendedValidation, updateValidationErrors]);\n\n return {\n resolver,\n validationErrors: validationErrorsState.errors,\n validationErrorsHash: validationErrorsState.hash,\n };\n};\n","import type {\n VetoFormattedError,\n VetoInstance,\n VetoTypeAny,\n} from '@fuf-stack/veto';\nimport type { BaseSyntheticEvent, ReactNode } from 'react';\nimport type { FieldValues, Path, SubmitHandler } from 'react-hook-form';\n\nimport React, { useCallback, useMemo, useRef, useState } from 'react';\nimport { FormProvider as HookFormProvider, useForm } from 'react-hook-form';\n\nimport createDebug from 'debug';\n\nimport { useLocalStorage } from '@fuf-stack/pixels';\n\nimport { toFormFormat, toSubmitFormat } from '../../helpers';\nimport { useExtendedValidation, useFormResolver } from './FormResolver';\nimport {\n createSensitiveFields,\n SensitiveFieldsProvider,\n} from './SensitiveFields';\n\nconst debug = createDebug('uniform:FormContext');\n\ntype DebugMode = 'debug' | 'debug-testids' | 'off' | 'disabled';\n\nexport interface DebugModeSettings {\n /** disable form debug completely */\n disable?: boolean;\n /** custom localStorage key to save debug mode state */\n localStorageKey?: string;\n}\n\n/** Listener function that gets called when a form reset is triggered */\nexport type FormResetListener = () => void;\n\n/**\n * Listener function that gets called when a field changes due to user input\n */\nexport type UserChangeListener<TFieldValues extends object = object> = (\n fieldName: Path<TFieldValues>,\n value: unknown,\n) => void;\n\nconst DEBUG_MODE_LOCAL_STORAGE_KEY_DEFAULT = 'uniform:debug-mode';\n\n/**\n * The `UniformContext` provides control over the form's submission behavior and may optionally include\n * a Veto validation schema for form validation.\n *\n * Specifically, this context offers:\n * 1. **Form Submission Control**: The `preventSubmit` function allows components to enable or disable\n * form submissions.\n * 2. **Optional Validation Schema**: The `validation` property may hold a Veto validation schema instance\n * that can be used to validate form fields and handle validation logic.\n * 3. **Client Validation**: The `setClientValidationSchema` function allows setting dynamic client-side\n * validation schemas that complement the base Veto validation.\n * 4. **User Change Tracking**: The `userChange` property provides a pub/sub system for tracking\n * user-initiated field changes (typing, clicking, selecting) - NOT programmatic changes like\n * form.reset() or form.setValue(). Used by the `useWatchUserChange` hook to enable reactive\n * field dependencies.\n * 5. **Form Reset Tracking**: The `formReset` property provides a pub/sub system for tracking\n * programmatic form resets triggered via the wrapped `reset()` from `useFormContext`.\n * Used by hooks like `useWatchFormReset` to run reset-specific normalization logic.\n *\n * This context is useful for components that need to interact with or control the form submission state,\n * or access the validation schema for managing form validation logic.\n *\n * IMPORTANT: Context Singleton Pattern for HMR (Hot Module Replacement)\n * =====================================================================\n *\n * We use a global window variable to ensure only ONE context instance exists across\n * hot module reloads during development. This is critical because:\n *\n * **The Problem:**\n * When using Vite/Storybook with Fast Refresh (HMR), editing this file causes it to\n * be re-evaluated. Each re-evaluation runs `React.createContext()` again, creating a\n * NEW context instance. This leads to \"context instance mismatch\":\n *\n * 1. FormProvider (provider) loads and uses context instance A\n * 2. File is edited, HMR triggers\n * 3. SubmitButton (consumer) hot-reloads and imports context instance B\n * 4. Provider writes to instance A, Consumer reads from instance B\n * 5. Result: Consumer sees default values (triggerSubmit = () => undefined)\n * 6. Clicking submit does nothing because it calls the empty default function\n *\n * **The Solution:**\n * By storing the context in `window.__UNIFORM_CONTEXT__`, we ensure:\n * - First load: Create context and store in window\n * - Subsequent HMRs: Reuse the same context from window\n * - All components always reference the SAME context instance\n * - Provider and consumers can properly communicate\n *\n * **Why This Is Safe:**\n * - Only affects development (production has no HMR)\n * - Context type never changes (same interface)\n * - React handles cleanup on unmount normally\n * - No memory leaks (context is lightweight)\n *\n * Without this pattern, you'd need to restart the dev server after every edit\n * to FormContext.tsx to ensure all components use the same context instance.\n */\n\n// Define the context type\ninterface UniformContextType {\n /** Form debug mode enabled or not */\n debugMode: DebugMode;\n /** settings for form debug mode */\n debugModeSettings?: DebugModeSettings;\n /** Form reset tracking (programmatic reset calls) */\n formReset: {\n /**\n * Subscribe to programmatic form resets.\n * Returns an unsubscribe function.\n */\n subscribe: (listener: FormResetListener) => () => void;\n /**\n * Notify all subscribers about a programmatic form reset.\n * Called from useFormContext when reset() is invoked.\n */\n notify: () => void;\n };\n /** Function to update if the form can currently be submitted */\n preventSubmit: (prevent: boolean) => void;\n /** Setter to enable or disable form debug mode */\n setDebugMode: (debugMode: DebugMode) => void;\n /** Function to trigger form submit programmatically */\n triggerSubmit: (e?: BaseSyntheticEvent) => Promise<void> | void;\n /** User change tracking (user input only, not programmatic changes) */\n userChange: {\n /**\n * Subscribe to user field changes.\n * Returns an unsubscribe function.\n */\n subscribe: (listener: UserChangeListener) => () => void;\n /**\n * Notify all subscribers about a user field change.\n * Called from useController when user interacts with a field.\n */\n notify: (fieldName: string, value: unknown) => void;\n };\n /** Form validation configuration */\n validation: {\n /** Base validation schema instance (without client validation) */\n baseInstance?: VetoInstance;\n /** Veto validation schema instance for form validation */\n instance?: VetoInstance;\n /** Current validation errors in form */\n errors?: VetoFormattedError;\n /** Function to set client validation schema for a specific key */\n setClientValidationSchema: (\n key: string,\n schema: VetoTypeAny | null,\n ) => void;\n };\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nif (!(window as any).__UNIFORM_CONTEXT__) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (window as any).__UNIFORM_CONTEXT__ = React.createContext<UniformContextType>(\n {\n debugMode: 'off',\n formReset: {\n subscribe: () => {\n return () => {\n return undefined;\n };\n },\n notify: () => {\n return undefined;\n },\n },\n preventSubmit: () => {\n return undefined;\n },\n setDebugMode: () => {\n return undefined;\n },\n triggerSubmit: () => {\n return undefined;\n },\n userChange: {\n subscribe: () => {\n return () => {\n return undefined;\n };\n },\n notify: () => {\n return undefined;\n },\n },\n validation: {\n setClientValidationSchema: () => {\n return undefined;\n },\n },\n },\n );\n debug('Creating new UniformContext instance');\n} else {\n debug(\n 'Reusing existing UniformContext instance from window.__UNIFORM_CONTEXT__',\n );\n}\n\n// Export the singleton context instance from window\n// This ensures all imports get the same context, even after HMR\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const UniformContext = (window as any)\n .__UNIFORM_CONTEXT__ as React.Context<UniformContextType>;\n\ndebug('UniformContext exported', {\n contextExists: !!UniformContext,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n windowContextExists: !!(window as any).__UNIFORM_CONTEXT__,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n contextsMatch: UniformContext === (window as any).__UNIFORM_CONTEXT__,\n});\n\n// Define props for the internal FormProvider component\ninterface FormProviderProps {\n /** children form render function */\n children: (childProps: {\n handleSubmit: (e?: BaseSyntheticEvent) => Promise<void>;\n isValid: boolean;\n }) => ReactNode;\n /** settings for form debug mode */\n debugModeSettings?: DebugModeSettings;\n /** initial form values */\n initialValues?: FieldValues;\n /** form submit handler */\n onSubmit: SubmitHandler<FieldValues>;\n /** Veto validation schema instance */\n validation?: VetoInstance;\n /** when the validation should be triggered */\n validationTrigger: 'onChange' | 'onBlur' | 'onSubmit' | 'onTouched' | 'all';\n}\n\n/**\n * FormProvider component provides:\n * - Veto validation schema context\n * - Resolver-backed validation error state\n * - Client validation schema management\n * - Submit handler with automatic data conversion and submission control with preventSubmit\n * - Form Debug Mode state\n * - Form reset pub/sub notifications (`formReset`)\n * - User change pub/sub notifications (`userChange`)\n * - React Hook Form context\n */\nconst FormProvider: React.FC<FormProviderProps> = ({\n children,\n debugModeSettings = undefined,\n initialValues = undefined,\n onSubmit,\n validation: baseValidation = undefined,\n validationTrigger,\n}) => {\n const sensitiveFields = useMemo(() => {\n return createSensitiveFields();\n }, []);\n\n // Form Debug mode state is handled in the form context\n const [debugMode, setDebugMode] = useLocalStorage<DebugMode>(\n debugModeSettings?.localStorageKey ?? DEBUG_MODE_LOCAL_STORAGE_KEY_DEFAULT,\n 'off',\n );\n\n // Create extended validation combining base + client validations\n const { extendedValidation, setClientValidationSchema } =\n useExtendedValidation(baseValidation);\n\n // Create resolver from extended validation + reactive validation error state\n const { resolver, validationErrors, validationErrorsHash } =\n useFormResolver(extendedValidation);\n\n // Initialize react hook form with the resolver\n const methods = useForm({\n defaultValues: initialValues ? toFormFormat(initialValues) : initialValues,\n // set rhf mode\n // see: https://react-hook-form.com/docs/useform#mode\n mode: validationTrigger,\n resolver,\n });\n\n // Get isValid from React Hook Form's formState\n const isValid = methods.formState?.isValid;\n\n // Control if the form can currently be submitted\n const [preventSubmit, setPreventSubmit] = useState(false);\n\n // Form reset listener registry (stored in ref to avoid re-renders)\n const formResetListenersRef = useRef<Set<FormResetListener>>(new Set());\n\n // Subscribe to form reset notifications\n const subscribeFormReset = useCallback(\n (listener: FormResetListener): (() => void) => {\n formResetListenersRef.current.add(listener);\n return () => {\n formResetListenersRef.current.delete(listener);\n };\n },\n [],\n );\n\n // Notify all subscribers about a programmatic form reset\n const notifyFormReset = useCallback((): void => {\n formResetListenersRef.current.forEach((listener) => {\n listener();\n });\n }, []);\n\n // User change listener registry (stored in ref to avoid re-renders)\n const userChangeListenersRef = useRef<Set<UserChangeListener>>(new Set());\n\n // Subscribe to user changes\n const subscribeUserChange = useCallback(\n (listener: UserChangeListener): (() => void) => {\n userChangeListenersRef.current.add(listener);\n // Return cleanup function to unsubscribe\n return () => {\n userChangeListenersRef.current.delete(listener);\n };\n },\n [],\n );\n\n // Notify all subscribers about user change\n const notifyUserChange = useCallback(\n (fieldName: string, value: unknown): void => {\n // Notify all registered listeners\n userChangeListenersRef.current.forEach((listener) => {\n listener(fieldName as Path<object>, value);\n });\n },\n [],\n );\n\n // Create submit handler with automatic data conversion\n // eslint-disable-next-line consistent-return\n const handleSubmit = async (e?: React.BaseSyntheticEvent) => {\n debug('handleSubmit called', {\n preventSubmit,\n formStateIsValid: methods.formState.isValid,\n validationErrors: sensitiveFields.redact(methods.formState.errors),\n validationTrigger,\n formValues: sensitiveFields.redact(methods.getValues()),\n });\n\n // only prevent submit when form state is valid, because otherwise\n // submit will only trigger validation and add errors / focus invalid fields\n if (methods.formState.isValid && preventSubmit) {\n debug('⛔ Form submit PREVENTED', {\n formStateIsValid: methods.formState.isValid,\n preventSubmit,\n });\n console.warn(\n '[FormProvider] form submit was prevented because preventSubmit is true...',\n );\n e?.preventDefault();\n return Promise.resolve();\n }\n\n debug('✓ Form submit ALLOWED', {\n formStateIsValid: methods.formState.isValid,\n preventSubmit,\n reason: !methods.formState.isValid\n ? 'Form is invalid (will trigger validation and show errors)'\n : 'Form is valid and preventSubmit is false',\n });\n\n // Convert form data to submission format:\n // - Unwrap flat array wrappers and convert markers\n // - Remove empty strings, nulls, empty arrays, and empty objects\n const wrappedOnSubmit = (data: FieldValues, event?: BaseSyntheticEvent) => {\n const submitData = toSubmitFormat(data) ?? {};\n debug('onSubmit callback called', {\n submitData: sensitiveFields.redact(submitData),\n });\n return onSubmit(submitData, event);\n };\n\n await methods.handleSubmit(wrappedOnSubmit)(e);\n\n debug('handleSubmit completed');\n };\n\n // Memoize the context value so consumers only re-render when context-relevant\n // state changes, including resolver-backed validation errors.\n const contextValue = useMemo(\n () => {\n return {\n // set debugMode to disabled when debugModeSettings.disable is true\n // otherwise use current debug mode from localStorage\n debugMode: debugModeSettings?.disable ? 'disabled' : debugMode,\n preventSubmit: (prevent: boolean) => {\n debug('preventSubmit called', {\n previousValue: preventSubmit,\n newValue: prevent,\n formStateIsValid: methods.formState.isValid,\n validationErrors: sensitiveFields.redact(methods.formState.errors),\n });\n setPreventSubmit(prevent);\n },\n setClientValidationSchema,\n setDebugMode,\n triggerSubmit: handleSubmit,\n formReset: {\n subscribe: subscribeFormReset,\n notify: notifyFormReset,\n },\n userChange: {\n subscribe: subscribeUserChange,\n notify: notifyUserChange,\n },\n validation: {\n baseInstance: baseValidation,\n instance: extendedValidation,\n errors: validationErrors,\n setClientValidationSchema,\n },\n };\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [debugMode, debugModeSettings?.disable, validationErrorsHash],\n );\n\n return (\n <SensitiveFieldsProvider registry={sensitiveFields}>\n <UniformContext.Provider value={contextValue}>\n {/* Spread all hook form props into HookFormProvider */}\n <HookFormProvider {...methods}>\n {children({ handleSubmit, isValid })}\n </HookFormProvider>\n </UniformContext.Provider>\n </SensitiveFieldsProvider>\n );\n};\n\nexport default FormProvider;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BA,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;AAuBjB,MAAa,mBACX,MACA,UACY;CACZ,MAAM,iBAAiB,IAAI,IACzB,MAAM,KAAK,SAAS;EAClB,OAAO,KACJ,QAAQ,cAAc,KAAK,CAAC,CAC5B,MAAM,GAAG,CAAC,CACV,QAAQ,SAAS;GAChB,OAAO,SAAS;EAClB,CAAC,CAAC,CACD,KAAK,GAAG;CACb,CAAC,CACH;CAGA,MAAM,yBAAS,IAAI,QAAyB;CAC5C,MAAM,SAAS,OAAgB,SAA0B;EAGvD,IAAI,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A,QAAQ,CAAC,QAAQ,UAAU,UACvB,8DACA;EACN,CAAC;EAKD,MAAM,mBAAmB,MAAmB,UAA+B;GACzE,MAAM,aAAa,eAAe,IAAI,KAAK,CAAC;GAC5C,MAAM,4BAA4B,EAChC,YAAY,gBAAgB,OAAO,UAAU,EAC/C,CAAC;GACD,OAAO,SAAS,YAAY,KAAK;EACnC;EAEA,MAAM,QAAQ,aAAa,eAAe,CAAC,CAAC,CAAC;EAE7C,MAAM,wBAAwB;CAChC;CAIA,MAAM,eAAe,cACb;EACJ,OAAO;GAGL,WAAW,mBAAmB,UAAU,aAAa;GACrD,gBAAgB,YAAqB;IACnC,MAAM,wBAAwB;KAC5B,eAAe;KACf,UAAU;KACV,kBAAkB,QAAQ,UAAU;KACpC,kBAAkB,gBAAgB,OAAO,QAAQ,UAAU,MAAM;IACnE,CAAC;IACD,iBAAiB,OAAO;GAC1B;GACA;GACA;GACA,eAAe;GACf,WAAW;IACT,WAAW;IACX,QAAQ;GACV;GACA,YAAY;IACV,WAAW;IACX,QAAQ;GACV;GACA,YAAY;IACV,cAAc;IACd,UAAU;IACV,QAAQ;IACR;GACF;EACF;CACF,GAEA;EAAC;EAAW,mBAAmB;EAAS;CAAoB,CAC9D;CAEA,OACE,oBAAC,yBAAD;EAAyB,UAAU;EACjC,UAAA,oBAAC,eAAe,UAAhB;GAAyB,OAAO;GAE9B,UAAA,oBAACC,cAAD;IAAkB,GAAI;IACnB,UAAA,SAAS;KAAE;KAAc;IAAQ,CAAC;GACnB,CAAA;EACK,CAAA;CACF,CAAA;AAE7B"}
@@ -1,19 +0,0 @@
1
- import React, { ReactNode } from "react";
2
- import { FieldValues, Path, SubmitHandler } from "react-hook-form";
3
- import { VetoFormattedError, VetoInstance, VetoTypeAny } from "@fuf-stack/veto";
4
- //#region src/Form/subcomponents/FormContext.d.ts
5
- interface DebugModeSettings {
6
- /** disable form debug completely */
7
- disable?: boolean;
8
- /** custom localStorage key to save debug mode state */
9
- localStorageKey?: string;
10
- }
11
- /** Listener function that gets called when a form reset is triggered */
12
- type FormResetListener = () => void;
13
- /**
14
- * Listener function that gets called when a field changes due to user input
15
- */
16
- type UserChangeListener<TFieldValues extends object = object> = (fieldName: Path<TFieldValues>, value: unknown) => void;
17
- //#endregion
18
- export { FormResetListener as n, UserChangeListener as r, DebugModeSettings as t };
19
- //# sourceMappingURL=FormContext-CsFiNvuJ.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"FormContext-CsFiNvuJ.d.mts","names":[],"sources":["../src/Form/subcomponents/FormContext.tsx"],"mappings":";;;;UA0BiB;;EAEf;;EAEA;;;KAIU;;;;KAKA,mBAAmB,yCAC7B,WAAW,KAAK,eAChB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../../../src/hooks/useUniformField/useUniformField.tsx"],"mappings":";;;;;;;iBAiBiB,sBACf,qBAAqB,cAAc,aACnC;;EAGA,MAAM,KAAK;;EAEX;;EAEA;;EAEA;;EAEA,QAAQ;;EAER;;EAEA;;EAEA,YAAY,oBAAoB;;EAEhC;;iBAGe,sBACf,qBAAqB,cAAc;;EAGnC;;EAEA,SAAS,kBAAkB,iBAAe;;EAE1C,WAAW,kBAAkB,iBAAe;;EAE5C;;EAEA;;EAEA,OAAO;;EAEP,cAAc;;EAEd,OAAO,kBAAkB,gBAAc;;EAEvC,sBAAsB,kBAAkB;;EAExC,uBAAuB,kBAAkB;;EAEzC,eAAe,kBAAkB;;EAEjC,WAAW,kBAAkB,iBAAe;;EAE5C;;EAEA,OAAO;;EAEP,QAAQ,kBAAkB,gBAAc;;EAExC,UAAU,kBAAkB,gBAAc;;EAE1C,KAAK,kBAAkB,gBAAc;;EAErC;;EAEA,YAAY,kBAAkB,iBAAe;;EAE7C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBA+BW,kBACX,qBAAqB,cAAc,aACnC,oBAEA,QAAQ,sBAAsB,cAAc,cAC3C,sBAAsB"}
@@ -1 +0,0 @@
1
- import "./useController-DcK2YHbw.mjs";
@@ -1 +0,0 @@
1
- import "./useFormContext-BegmYvGA.mjs";
@@ -1 +0,0 @@
1
- {"version":3,"file":"useController-DcK2YHbw.d.mts","names":[],"sources":["../src/hooks/useController/useController.ts"],"mappings":";;KAaY,qBAAmB,wCAC7B,mBAAsB;UAEP,oBAAoB;EACnC,OAAO,KAAK,sBAAsB;IAGhC,cAAc;IACd;;EAEF,WAAW,mBAAmB;EAC9B,YAAY;;;;;;;;;;;;;;;;;;;cAoBD,kBAAiB,sCAC5B,OAAO,qBAAmB,kBACzB,oBAAoB"}
@@ -1,66 +0,0 @@
1
- import { n as FormResetListener, r as UserChangeListener, t as DebugModeSettings } from "./FormContext-CsFiNvuJ.mjs";
2
- import { FieldError, FieldValues, Path } from "react-hook-form";
3
- import { VetoFormattedError, VetoInstance } from "@fuf-stack/veto";
4
- //#region src/hooks/useFormContext/useFormContext.d.ts
5
- /** Schema check whether a field is required or optional */
6
- declare const checkFieldIsRequired: (validation: VetoInstance, path: string[]) => boolean;
7
- /**
8
- * Custom hook that extends react-hook-form's useFormContext to add validation and state management.
9
- *
10
- * Key features:
11
- * - Enhanced `getFieldState` that includes validation schema-based "required" status and testId generation
12
- * - Automatic conversion of form values via `getValues`, `watch`, and `subscribe`:
13
- * - Unwraps flat array wrappers (`{ __FLAT__: value }` → `value`)
14
- * - Converts nullish string markers (`__NULL__` → `null`, `__FALSE__` → `false`, `__ZERO__` → `0`)
15
- * - Filters out empty/null values
16
- */
17
- declare const useFormContext$1: <TFieldValues extends FieldValues = FieldValues, TContext = any, TTransformedValues = TFieldValues>() => {
18
- formState: import("react-hook-form").FormState<TFieldValues>;
19
- getFieldState: (name: Path<TFieldValues>, testId?: string) => {
20
- error: FieldError[] | undefined;
21
- invalid: boolean;
22
- required: boolean;
23
- testId: string;
24
- isDirty: boolean;
25
- isTouched: boolean;
26
- isValidating: boolean;
27
- };
28
- getValues: import("react-hook-form").UseFormGetValues<TFieldValues>;
29
- reset: import("react-hook-form").UseFormReset<TFieldValues>;
30
- subscribe: import("react-hook-form").UseFormSubscribe<TFieldValues>;
31
- watch: import("react-hook-form").UseFormWatch<TFieldValues>;
32
- debugMode: "debug" | "debug-testids" | "off" | "disabled";
33
- debugModeSettings?: DebugModeSettings;
34
- formReset: {
35
- subscribe: (listener: FormResetListener) => () => void;
36
- notify: () => void;
37
- };
38
- preventSubmit: (prevent: boolean) => void;
39
- setDebugMode: (debugMode: "debug" | "debug-testids" | "off" | "disabled") => void;
40
- triggerSubmit: (e?: import("react").BaseSyntheticEvent) => Promise<void> | void;
41
- userChange: {
42
- subscribe: (listener: UserChangeListener) => () => void;
43
- notify: (fieldName: string, value: unknown) => void;
44
- };
45
- validation: {
46
- baseInstance?: VetoInstance;
47
- instance?: VetoInstance;
48
- errors?: VetoFormattedError;
49
- setClientValidationSchema: (key: string, schema: import("@fuf-stack/veto").VetoTypeAny | null) => void;
50
- };
51
- setError: import("react-hook-form").UseFormSetError<TFieldValues>;
52
- clearErrors: import("react-hook-form").UseFormClearErrors<TFieldValues>;
53
- setValue: import("react-hook-form").UseFormSetValue<TFieldValues>;
54
- setValues: import("react-hook-form").UseFormSetValues<TFieldValues>;
55
- trigger: import("react-hook-form").UseFormTrigger<TFieldValues>;
56
- resetField: import("react-hook-form").UseFormResetField<TFieldValues>;
57
- resetDefaultValues: import("react-hook-form").UseFormResetDefaultValues<TFieldValues>;
58
- handleSubmit: import("react-hook-form").UseFormHandleSubmit<TFieldValues, TTransformedValues>;
59
- unregister: import("react-hook-form").UseFormUnregister<TFieldValues>;
60
- control: import("react-hook-form").Control<TFieldValues, TContext, TTransformedValues>;
61
- register: import("react-hook-form").UseFormRegister<TFieldValues>;
62
- setFocus: import("react-hook-form").UseFormSetFocus<TFieldValues>;
63
- };
64
- //#endregion
65
- export { useFormContext$1 as n, checkFieldIsRequired as t };
66
- //# sourceMappingURL=useFormContext-BegmYvGA.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useFormContext-BegmYvGA.d.mts","names":[],"sources":["../src/hooks/useFormContext/useFormContext.ts"],"mappings":";;;;;cAYa,uBACX,YAAY,cACZ;;;;;;;;;;;cAmEW,mBACX,qBAAqB,cAAc,aACnC,gBACA,qBAAqB;;EAoCQ,gBAAA,MAAA,KAAK,eAAa;;;;;;;;;;;;;;;;;;;;;EA4B7B,gBAAA,oBAAC,uBAAA;;0BAAA;;;;IAeH,eAAA;IAEJ,WAAC;IAGC,SAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"useFormContext-DNb_B8LQ.mjs","names":["useFormContext","useHookFormContext"],"sources":["../src/hooks/useFormContext/useFormContext.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n\nimport type { VetoFormattedError, VetoInstance } from '@fuf-stack/veto';\nimport type { FieldError, FieldValues, Path } from 'react-hook-form';\n\nimport { useContext } from 'react';\nimport { useFormContext as useHookFormContext } from 'react-hook-form';\n\nimport { UniformContext } from '../../Form/subcomponents/FormContext';\nimport { flatArrayKey, nameToTestId, toValidationFormat } from '../../helpers';\n\n/** Schema check whether a field is required or optional */\nexport const checkFieldIsRequired = (\n validation: VetoInstance,\n path: string[],\n): boolean => {\n // Handle flat array paths: strip the flatArrayKey to check the array element schema\n // e.g., ['arrayField', '0', '__FLAT__'] -> check schema at ['arrayField', '0']\n const checkPath =\n path[path.length - 1] === flatArrayKey ? path.slice(0, -1) : path;\n\n const checkRequired = (schema: any) => {\n // arrays ...\n if (schema.type === 'array') {\n // ... if array is optional or nullable it is not required\n if (schema.isOptional || schema.isNullable) {\n return false;\n }\n // ... otherwise arrays are required (display logic wise -> no asterisk in the label)\n return true;\n }\n\n // all other fields are required if they are\n // not optional and not nullable\n return !schema.isOptional && !schema.isNullable;\n };\n\n return validation.checkSchemaPath(checkRequired, checkPath);\n};\n\n/**\n * Resolve validation errors for a given field path.\n *\n * Traverses a nested `VetoFormattedError` structure using a dotted path\n * (for example: \"user.address.0.street\") and returns the matching\n * `FieldError[]` if present. If no error exists at the path, returns\n * `undefined`.\n *\n * @param errors - The formatted validation errors from Uniform's context\n * @param name - The dotted field path to resolve\n * @returns An array of `FieldError` entries for the field, or `undefined`\n */\nconst getValidationErrorsByName = (\n errors: VetoFormattedError,\n name: string,\n) => {\n // Traverse nested error structure; ignore flat array wrapper key\n const keys = name.split('.').filter((k) => {\n return k !== flatArrayKey;\n });\n let current: unknown = errors;\n keys.forEach((key) => {\n if (current && typeof current === 'object') {\n current = (current as Record<string, unknown>)[key];\n } else {\n current = undefined;\n }\n });\n return current as FieldError[] | undefined;\n};\n\n/**\n * Custom hook that extends react-hook-form's useFormContext to add validation and state management.\n *\n * Key features:\n * - Enhanced `getFieldState` that includes validation schema-based \"required\" status and testId generation\n * - Automatic conversion of form values via `getValues`, `watch`, and `subscribe`:\n * - Unwraps flat array wrappers (`{ __FLAT__: value }` → `value`)\n * - Converts nullish string markers (`__NULL__` → `null`, `__FALSE__` → `false`, `__ZERO__` → `0`)\n * - Filters out empty/null values\n */\nexport const useFormContext = <\n TFieldValues extends FieldValues = FieldValues,\n TContext = any,\n TTransformedValues = TFieldValues,\n>() => {\n const {\n formState,\n // some methods that will be enhanced below\n getFieldState: getFieldStateOrig,\n getValues: getValuesOrig,\n watch: watchOrig,\n subscribe: subscribeOrig,\n reset: resetOrig,\n // the rest of the methods pass through unchanged\n ...otherMethods\n } = useHookFormContext<TFieldValues, TContext, TTransformedValues>();\n\n const uniformContext = useContext(UniformContext);\n\n /**\n * Wrap react-hook-form's `reset` so the uniform context is notified about\n * programmatic resets. Field components (e.g. FieldArray) use this signal to\n * normalize their state on reset instead of inferring it from field contents.\n */\n const notifyReset = uniformContext?.formReset?.notify;\n const reset = ((...args: Parameters<typeof resetOrig>) => {\n resetOrig(...args);\n notifyReset?.();\n }) as typeof resetOrig;\n\n /**\n * Updated getFieldState method which returns:\n * - Whether the field is required by checking the validation schema\n * - Existing field state information (errors, etc.)\n * - A testId generated from the field name (with flat array keys removed and slugified)\n *\n * @param name - The field path (string or array)\n * @param testId - Optional explicit testId. If provided, will be slugified. If not provided, generated from name.\n */\n const getFieldState = (name: Path<TFieldValues>, testId?: string) => {\n const fieldPath =\n typeof name === 'string' ? name.replace(/\\[\\d+\\]/g, '').split('.') : name;\n\n // Use base validation instance for checking \"required\" status\n // Client validation often uses .nullish() which would incorrectly mark fields as optional\n const validationInstance =\n uniformContext?.validation.baseInstance ??\n uniformContext?.validation.instance;\n\n // Check if the field is required using the validation schema\n const required = validationInstance\n ? checkFieldIsRequired(validationInstance, fieldPath)\n : false;\n\n const error = getValidationErrorsByName(\n uniformContext?.validation.errors ?? {},\n name,\n );\n\n // Get everything but the error from the original field state\n const fieldState = getFieldStateOrig(name, formState);\n\n return {\n ...fieldState,\n error,\n invalid: !!error,\n required,\n testId: nameToTestId(testId ?? name),\n };\n };\n\n /**\n * Wrap form value accessor methods to automatically convert from internal storage format\n * to component-friendly format:\n *\n * - Unwrap flat array wrappers: `{ __FLAT__: value }` → `value`\n * - Convert nullish string markers: `__NULL__` → `null`, `__FALSE__` → `false`, `__ZERO__` → `0`\n * - Filter out empty/null values: fields with converted null/empty values are removed entirely\n *\n * This ensures components receive clean, predictable data without needing to handle\n * the internal nullish string conversion system or flat array wrapping manually.\n */\n const getValues = ((...args: any[]) => {\n const result = (getValuesOrig as any)(...args);\n return toValidationFormat(result);\n }) as typeof getValuesOrig;\n\n const watch = ((...args: any[]) => {\n const result = (watchOrig as any)(...args);\n return toValidationFormat(result);\n }) as typeof watchOrig;\n\n const subscribe = ((...args: any[]) => {\n // For subscribe, we need to wrap the callback to convert the values property\n const [options] = args;\n if (options?.callback) {\n const originalCallback = options.callback;\n const wrappedOptions = {\n ...options,\n callback: (subscribeFormState: any) => {\n // Convert the values property if it exists\n const convertedFormState = {\n ...subscribeFormState,\n ...(subscribeFormState.values && {\n values: toValidationFormat(subscribeFormState.values),\n }),\n };\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return originalCallback(convertedFormState);\n },\n };\n return subscribeOrig(wrappedOptions);\n }\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return (subscribeOrig as any)(...args);\n }) as typeof subscribeOrig;\n\n return {\n ...otherMethods,\n ...uniformContext,\n formState,\n getFieldState,\n getValues,\n reset,\n subscribe,\n watch,\n };\n};\n"],"mappings":";;;;;;AAYA,MAAa,wBACX,YACA,SACY;CAGZ,MAAM,YACJ,KAAK,KAAK,SAAS,OAAA,aAAsB,KAAK,MAAM,GAAG,EAAE,IAAI;CAE/D,MAAM,iBAAiB,WAAgB;EAErC,IAAI,OAAO,SAAS,SAAS;GAE3B,IAAI,OAAO,cAAc,OAAO,YAC9B,OAAO;GAGT,OAAO;EACT;EAIA,OAAO,CAAC,OAAO,cAAc,CAAC,OAAO;CACvC;CAEA,OAAO,WAAW,gBAAgB,eAAe,SAAS;AAC5D;;;;;;;;;;;;;AAcA,MAAM,6BACJ,QACA,SACG;CAEH,MAAM,OAAO,KAAK,MAAM,GAAG,CAAC,CAAC,QAAQ,MAAM;EACzC,OAAO,MAAM;CACf,CAAC;CACD,IAAI,UAAmB;CACvB,KAAK,SAAS,QAAQ;EACpB,IAAI,WAAW,OAAO,YAAY,UAChC,UAAW,QAAoC;OAE/C,UAAU,KAAA;CAEd,CAAC;CACD,OAAO;AACT;;;;;;;;;;;AAYA,MAAaA,yBAIN;CACL,MAAM,EACJ,WAEA,eAAe,mBACf,WAAW,eACX,OAAO,WACP,WAAW,eACX,OAAO,WAEP,GAAG,iBACDC,eAA+D;CAEnE,MAAM,iBAAiB,WAAW,cAAc;;;;;;CAOhD,MAAM,cAAc,gBAAgB,WAAW;CAC/C,MAAM,UAAU,GAAG,SAAuC;EACxD,UAAU,GAAG,IAAI;EACjB,cAAc;CAChB;;;;;;;;;;CAWA,MAAM,iBAAiB,MAA0B,WAAoB;EACnE,MAAM,YACJ,OAAO,SAAS,WAAW,KAAK,QAAQ,YAAY,EAAE,CAAC,CAAC,MAAM,GAAG,IAAI;EAIvE,MAAM,qBACJ,gBAAgB,WAAW,gBAC3B,gBAAgB,WAAW;EAG7B,MAAM,WAAW,qBACb,qBAAqB,oBAAoB,SAAS,IAClD;EAEJ,MAAM,QAAQ,0BACZ,gBAAgB,WAAW,UAAU,CAAC,GACtC,IACF;EAKA,OAAO;GACL,GAHiB,kBAAkB,MAAM,SAG7B;GACZ;GACA,SAAS,CAAC,CAAC;GACX;GACA,QAAQ,aAAa,UAAU,IAAI;EACrC;CACF;;;;;;;;;;;;CAaA,MAAM,cAAc,GAAG,SAAgB;EACrC,MAAM,SAAU,cAAsB,GAAG,IAAI;EAC7C,OAAO,mBAAmB,MAAM;CAClC;CAEA,MAAM,UAAU,GAAG,SAAgB;EACjC,MAAM,SAAU,UAAkB,GAAG,IAAI;EACzC,OAAO,mBAAmB,MAAM;CAClC;CAEA,MAAM,cAAc,GAAG,SAAgB;EAErC,MAAM,CAAC,WAAW;EAClB,IAAI,SAAS,UAAU;GACrB,MAAM,mBAAmB,QAAQ;GACjC,MAAM,iBAAiB;IACrB,GAAG;IACH,WAAW,uBAA4B;KAErC,MAAM,qBAAqB;MACzB,GAAG;MACH,GAAI,mBAAmB,UAAU,EAC/B,QAAQ,mBAAmB,mBAAmB,MAAM,EACtD;KACF;KAEA,OAAO,iBAAiB,kBAAkB;IAC5C;GACF;GACA,OAAO,cAAc,cAAc;EACrC;EAEA,OAAQ,cAAsB,GAAG,IAAI;CACvC;CAEA,OAAO;EACL,GAAG;EACH,GAAG;EACH;EACA;EACA;EACA;EACA;EACA;CACF;AACF"}
@@ -1,2 +0,0 @@
1
- import { useInput } from "@heroui/input";
2
- export { useInput as t };
@@ -1 +0,0 @@
1
- {"version":3,"file":"useInputValueTransform-LOaEim7k.d.mts","names":[],"sources":["../src/hooks/useInputValueTransform/useInputValueTransform.ts"],"mappings":";UAEiB,oBAAoB;;EAEnC,iBAAiB,mBAAmB;;EAEpC,cAAc,OAAO;;UAGN,8BAA8B;;EAE7C;;EAEA,YAAY,oBAAoB;;UAGjB,6BAA6B;;EAE5C,iBAAiB,uBAAuB;;EAExC,cAAc,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAqFjB,yBAA0B,sBAAoB,MAAA,aAGxD,8BAA8B,cAAY,6BAA6B"}