@fuf-stack/uniform 1.16.0 → 1.17.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 (163) hide show
  1. package/dist/Checkboxes/index.d.cts +1 -1
  2. package/dist/Checkboxes/index.d.ts +1 -1
  3. package/dist/FieldArray/index.d.cts +1 -1
  4. package/dist/FieldArray/index.d.ts +1 -1
  5. package/dist/FieldCard/index.cjs +1 -1
  6. package/dist/FieldCard/index.d.cts +1 -1
  7. package/dist/FieldCard/index.d.ts +1 -1
  8. package/dist/FieldCard/index.js +1 -1
  9. package/dist/{FieldCard-DcMORXZR.cjs → FieldCard-38ZBBWyE.cjs} +52 -8
  10. package/dist/FieldCard-38ZBBWyE.cjs.map +1 -0
  11. package/dist/{FieldCard-DZSiMFoO.js → FieldCard-7XiCb6jZ.js} +52 -8
  12. package/dist/FieldCard-7XiCb6jZ.js.map +1 -0
  13. package/dist/Grid/index.d.cts +1 -1
  14. package/dist/Grid/index.d.ts +1 -1
  15. package/dist/Input/index.d.cts +1 -1
  16. package/dist/Input/index.d.ts +1 -1
  17. package/dist/RadioBoxes/index.d.cts +1 -1
  18. package/dist/RadioBoxes/index.d.ts +1 -1
  19. package/dist/RadioTabs/index.d.ts +1 -1
  20. package/dist/Radios/index.d.cts +1 -1
  21. package/dist/Radios/index.d.ts +1 -1
  22. package/dist/Select/index.d.cts +1 -1
  23. package/dist/Select/index.d.ts +1 -1
  24. package/dist/Slider/index.d.cts +1 -1
  25. package/dist/Slider/index.d.ts +1 -1
  26. package/dist/SubmitButton/index.d.cts +1 -1
  27. package/dist/SubmitButton/index.d.ts +1 -1
  28. package/dist/Switch/index.d.cts +1 -1
  29. package/dist/Switch/index.d.ts +1 -1
  30. package/dist/SwitchBox/index.d.cts +1 -1
  31. package/dist/SwitchBox/index.d.ts +1 -1
  32. package/dist/TextArea/index.d.cts +1 -1
  33. package/dist/TextArea/index.d.ts +1 -1
  34. package/dist/helpers/index.d.cts +186 -2
  35. package/dist/helpers/index.d.cts.map +1 -0
  36. package/dist/helpers/index.d.ts +186 -2
  37. package/dist/helpers/index.d.ts.map +1 -0
  38. package/dist/hooks/useClientValidation/index.d.cts +1 -1
  39. package/dist/hooks/useClientValidation/index.d.ts +1 -1
  40. package/dist/hooks/useController/index.d.cts +1 -1
  41. package/dist/hooks/useController/index.d.ts +2 -1
  42. package/dist/hooks/useFormContext/index.d.cts +1 -1
  43. package/dist/hooks/useFormContext/index.d.ts +1 -1
  44. package/dist/hooks/useUniformField/index.d.cts +1 -1
  45. package/dist/hooks/useUniformField/index.d.ts +3 -3
  46. package/dist/hooks/useUniformFieldArray/index.d.cts +1 -1
  47. package/dist/hooks/useUniformFieldArray/index.d.ts +4 -24
  48. package/dist/hooks/useWatchUserChange/index.d.cts +1 -1
  49. package/dist/hooks/useWatchUserChange/index.d.ts +1 -1
  50. package/dist/{index-BZrLB2p0.d.cts → index-796vjEop.d.ts} +34 -34
  51. package/dist/index-796vjEop.d.ts.map +1 -0
  52. package/dist/{index-2SVlCM0Y.d.cts → index-B62CWrcm.d.ts} +21 -21
  53. package/dist/index-B62CWrcm.d.ts.map +1 -0
  54. package/dist/{index-DS4AP9pV.d.ts → index-BD9y--o2.d.cts} +6 -6
  55. package/dist/{index-DymdaDrj.d.cts.map → index-BD9y--o2.d.cts.map} +1 -1
  56. package/dist/{index-BbA9HcNa.d.cts → index-BFLKkqA3.d.ts} +3 -3
  57. package/dist/{index-CCeHSmIe.d.ts.map → index-BFLKkqA3.d.ts.map} +1 -1
  58. package/dist/{index-CJ90vm9t.d.ts → index-BV_YDI6g.d.ts} +6 -6
  59. package/dist/{index-CJ90vm9t.d.ts.map → index-BV_YDI6g.d.ts.map} +1 -1
  60. package/dist/{index-CCeHSmIe.d.ts → index-BW9EUWZE.d.cts} +2 -2
  61. package/dist/{index-BbA9HcNa.d.cts.map → index-BW9EUWZE.d.cts.map} +1 -1
  62. package/dist/{index-DymdaDrj.d.cts → index-B_1td56I.d.ts} +6 -6
  63. package/dist/{index-DS4AP9pV.d.ts.map → index-B_1td56I.d.ts.map} +1 -1
  64. package/dist/{index-noH6pESQ.d.ts → index-BgXr1v45.d.cts} +34 -34
  65. package/dist/index-BgXr1v45.d.cts.map +1 -0
  66. package/dist/{index-tIGuHSXb.d.ts → index-C3CvgmJw.d.ts} +4 -4
  67. package/dist/{index-tIGuHSXb.d.ts.map → index-C3CvgmJw.d.ts.map} +1 -1
  68. package/dist/{index-B2IL9Zt7.d.cts → index-C4-1V8jn.d.ts} +3 -3
  69. package/dist/{index-CPcJGZVS.d.ts.map → index-C4-1V8jn.d.ts.map} +1 -1
  70. package/dist/{index-D-ucmG60.d.ts → index-CB00FCyi.d.ts} +21 -21
  71. package/dist/index-CB00FCyi.d.ts.map +1 -0
  72. package/dist/index-CFBmva_r.d.ts +1 -0
  73. package/dist/index-COwP53Gx.d.ts +278 -0
  74. package/dist/{index-CRYEKT3o.d.ts.map → index-COwP53Gx.d.ts.map} +1 -1
  75. package/dist/{index-Ct2YYfiU.d.cts → index-CUy2EDqc.d.cts} +6 -6
  76. package/dist/{index-Ct2YYfiU.d.cts.map → index-CUy2EDqc.d.cts.map} +1 -1
  77. package/dist/{index-CpVfOXNv.d.cts → index-CbAh0Kfo.d.cts} +3 -3
  78. package/dist/{index-CpVfOXNv.d.cts.map → index-CbAh0Kfo.d.cts.map} +1 -1
  79. package/dist/{index-FHPC_VE1.d.ts → index-Cj-PU3Ck.d.ts} +35 -35
  80. package/dist/{index-FHPC_VE1.d.ts.map → index-Cj-PU3Ck.d.ts.map} +1 -1
  81. package/dist/{index-CdXOAPMb.d.ts → index-CrxSEKKb.d.cts} +48 -48
  82. package/dist/index-CrxSEKKb.d.cts.map +1 -0
  83. package/dist/{index-DYErnCVV.d.cts → index-D3RMbKbP.d.cts} +36 -36
  84. package/dist/{index-DYErnCVV.d.cts.map → index-D3RMbKbP.d.cts.map} +1 -1
  85. package/dist/{index-DaBgwR1t.d.cts → index-DAeb_8Q4.d.cts} +21 -21
  86. package/dist/{index-DaBgwR1t.d.cts.map → index-DAeb_8Q4.d.cts.map} +1 -1
  87. package/dist/{index-CPcJGZVS.d.ts → index-DEJghucW.d.cts} +3 -3
  88. package/dist/{index-B2IL9Zt7.d.cts.map → index-DEJghucW.d.cts.map} +1 -1
  89. package/dist/{index-lot50R9R.d.ts → index-DJbdReTK.d.ts} +3 -3
  90. package/dist/{index-lot50R9R.d.ts.map → index-DJbdReTK.d.ts.map} +1 -1
  91. package/dist/{index-CZ5EIIjq.d.cts → index-DTURD6sl.d.cts} +6 -6
  92. package/dist/{index-CZ5EIIjq.d.cts.map → index-DTURD6sl.d.cts.map} +1 -1
  93. package/dist/{index-BKCiuwim.d.cts → index-DebErIUS.d.ts} +48 -48
  94. package/dist/{index-CdXOAPMb.d.ts.map → index-DebErIUS.d.ts.map} +1 -1
  95. package/dist/{index-D5rTKWm9.d.cts → index-DfGCI-K_.d.cts} +99 -99
  96. package/dist/index-DfGCI-K_.d.cts.map +1 -0
  97. package/dist/{index-Djc5tmi3.d.ts → index-DjDR6FpI.d.ts} +36 -36
  98. package/dist/{index-Djc5tmi3.d.ts.map → index-DjDR6FpI.d.ts.map} +1 -1
  99. package/dist/{index-PU5WNOH9.d.cts → index-DsyY9X04.d.cts} +3 -3
  100. package/dist/{index-PU5WNOH9.d.cts.map → index-DsyY9X04.d.cts.map} +1 -1
  101. package/dist/{index-BuX42Bbd.d.ts → index-DxfiwbJb.d.cts} +18 -6
  102. package/dist/index-DxfiwbJb.d.cts.map +1 -0
  103. package/dist/{index-DubKudrE.d.ts → index-Dy0m4FQj.d.ts} +6 -6
  104. package/dist/{index-DubKudrE.d.ts.map → index-Dy0m4FQj.d.ts.map} +1 -1
  105. package/dist/{index-BDvr4eaz.d.ts → index-Y8XsRdxS.d.cts} +21 -21
  106. package/dist/{index-2SVlCM0Y.d.cts.map → index-Y8XsRdxS.d.cts.map} +1 -1
  107. package/dist/{index-DW1uBiAf.d.cts → index-gWYaaO6O.d.ts} +18 -6
  108. package/dist/index-gWYaaO6O.d.ts.map +1 -0
  109. package/dist/index-lQ_hGQ08.d.cts +1 -0
  110. package/dist/{index-hacHTzh4.d.cts → index-nVYabHcT.d.cts} +33 -33
  111. package/dist/{index-hacHTzh4.d.cts.map → index-nVYabHcT.d.cts.map} +1 -1
  112. package/dist/{index-CVY05bZf.d.ts → index-pE9osud2.d.ts} +3 -3
  113. package/dist/{index-CVY05bZf.d.ts.map → index-pE9osud2.d.ts.map} +1 -1
  114. package/dist/index.cjs +1 -1
  115. package/dist/index.d.cts +22 -22
  116. package/dist/index.d.ts +24 -23
  117. package/dist/index.js +1 -1
  118. package/dist/partials/FieldCopyTestIdButton/index.d.cts +1 -1
  119. package/dist/partials/FieldCopyTestIdButton/index.d.ts +1 -1
  120. package/dist/partials/FieldValidationError/index.d.cts +1 -1
  121. package/dist/partials/FieldValidationError/index.d.ts +1 -1
  122. package/dist/{useClientValidation-Bv0yxTyV.d.ts → useClientValidation-Bg0q3Axc.d.ts} +1 -1
  123. package/dist/{useClientValidation-Bv0yxTyV.d.ts.map → useClientValidation-Bg0q3Axc.d.ts.map} +1 -1
  124. package/dist/{useClientValidation-DSMw7f-t.d.cts → useClientValidation-BvPDQmf6.d.cts} +1 -1
  125. package/dist/{useClientValidation-DSMw7f-t.d.cts.map → useClientValidation-BvPDQmf6.d.cts.map} +1 -1
  126. package/dist/{useController-Co8wbo-Y.d.ts → useController-BJ2SBdky.d.ts} +1 -1
  127. package/dist/{useController-Co8wbo-Y.d.ts.map → useController-BJ2SBdky.d.ts.map} +1 -1
  128. package/dist/{useController-B-DhUPpA.d.cts → useController-C6Pg9T_3.d.cts} +1 -1
  129. package/dist/{useController-B-DhUPpA.d.cts.map → useController-C6Pg9T_3.d.cts.map} +1 -1
  130. package/dist/{useFormContext-DDx8LD8e.d.ts → useFormContext-B2TS6xq0.d.ts} +3 -3
  131. package/dist/useFormContext-B2TS6xq0.d.ts.map +1 -0
  132. package/dist/{useFormContext-oEivkWtB.d.cts → useFormContext-n3WYgGkW.d.cts} +19 -19
  133. package/dist/useFormContext-n3WYgGkW.d.cts.map +1 -0
  134. package/dist/{useUniformField-q3GCAV85.d.ts → useUniformField-CXSaAVTt.d.ts} +3 -3
  135. package/dist/{useUniformField-q3GCAV85.d.ts.map → useUniformField-CXSaAVTt.d.ts.map} +1 -1
  136. package/dist/{useUniformField-DFXQO9dw.d.cts → useUniformField-ETnay_UI.d.cts} +3 -3
  137. package/dist/{useUniformField-DFXQO9dw.d.cts.map → useUniformField-ETnay_UI.d.cts.map} +1 -1
  138. package/dist/{useUniformFieldArray-B3smveBW.d.cts → useUniformFieldArray-4pUdrWYT.d.cts} +14 -14
  139. package/dist/{useUniformFieldArray-B3smveBW.d.cts.map → useUniformFieldArray-4pUdrWYT.d.cts.map} +1 -1
  140. package/dist/{useUniformFieldArray-CmACueEO.d.ts → useUniformFieldArray-COtgcAnp.d.ts} +3 -3
  141. package/dist/{useUniformFieldArray-CmACueEO.d.ts.map → useUniformFieldArray-COtgcAnp.d.ts.map} +1 -1
  142. package/dist/{useWatchUserChange-JMU-vN92.d.ts → useWatchUserChange-DX6gUHvM.d.ts} +1 -1
  143. package/dist/{useWatchUserChange-JMU-vN92.d.ts.map → useWatchUserChange-DX6gUHvM.d.ts.map} +1 -1
  144. package/dist/{useWatchUserChange-DahNCPDG.d.cts → useWatchUserChange-cI5-j6M4.d.cts} +1 -1
  145. package/dist/{useWatchUserChange-DahNCPDG.d.cts.map → useWatchUserChange-cI5-j6M4.d.cts.map} +1 -1
  146. package/package.json +2 -2
  147. package/dist/FieldCard-DZSiMFoO.js.map +0 -1
  148. package/dist/FieldCard-DcMORXZR.cjs.map +0 -1
  149. package/dist/index-BDvr4eaz.d.ts.map +0 -1
  150. package/dist/index-BKCiuwim.d.cts.map +0 -1
  151. package/dist/index-BPjrrFuM.d.ts +0 -186
  152. package/dist/index-BPjrrFuM.d.ts.map +0 -1
  153. package/dist/index-BTr_gid3.d.cts +0 -186
  154. package/dist/index-BTr_gid3.d.cts.map +0 -1
  155. package/dist/index-BZrLB2p0.d.cts.map +0 -1
  156. package/dist/index-BuX42Bbd.d.ts.map +0 -1
  157. package/dist/index-CRYEKT3o.d.ts +0 -278
  158. package/dist/index-D-ucmG60.d.ts.map +0 -1
  159. package/dist/index-D5rTKWm9.d.cts.map +0 -1
  160. package/dist/index-DW1uBiAf.d.cts.map +0 -1
  161. package/dist/index-noH6pESQ.d.ts.map +0 -1
  162. package/dist/useFormContext-DDx8LD8e.d.ts.map +0 -1
  163. package/dist/useFormContext-oEivkWtB.d.cts.map +0 -1
@@ -1,2 +1,186 @@
1
- import { a as toFormFormat, c as createOptionValueConverter, i as nameToTestId, n as fromNullishString, o as toNullishString, r as isValueEmpty, s as toValidationFormat, t as flatArrayKey } from "../index-BTr_gid3.cjs";
2
- export { createOptionValueConverter, flatArrayKey, fromNullishString, isValueEmpty, nameToTestId, toFormFormat, toNullishString, toValidationFormat };
1
+ //#region src/helpers/createOptionValueConverter/createOptionValueConverter.d.ts
2
+ /**
3
+ * Creates a converter function that preserves the original type (string, number, or boolean)
4
+ * of option values when converting from string keys back to their original type.
5
+ *
6
+ * This is useful for radio/select components where the underlying UI library
7
+ * uses string keys internally, but we want to preserve number/boolean values in the form state.
8
+ *
9
+ * @param options - Array of options with a value property that can be string, number, or boolean
10
+ * @returns An object with:
11
+ * - `convertToOriginalType`: Function to convert a string key back to its original type
12
+ * - `numberValueKeys`: Set of string representations of number values (for internal use)
13
+ * - `booleanValueKeys`: Map of string representations to boolean values (for internal use)
14
+ */
15
+ declare const createOptionValueConverter: <T extends {
16
+ value: string | number | boolean;
17
+ }>(options: T[]) => {
18
+ booleanValueKeys: Map<string, boolean>;
19
+ convertToOriginalType: (key: string | number | boolean) => string | number | boolean;
20
+ numberValueKeys: Set<string>;
21
+ };
22
+ //#endregion
23
+ //#region src/helpers/nullishFields/nullishFields.d.ts
24
+ /** Key used to wrap flat array elements when converting to form format */
25
+ declare const flatArrayKey = "__FLAT__";
26
+ /**
27
+ * Checks if a value is considered "empty" for validation display purposes.
28
+ *
29
+ * Used by useUniformField to determine when to show validation errors.
30
+ * Empty values don't trigger immediate error display (user must interact first).
31
+ *
32
+ * Handles:
33
+ * - Primitives: null, undefined, ''
34
+ * - Marker strings: __NULL__, __FALSE__, __ZERO__ (converted via fromNullishString)
35
+ * - Empty arrays: []
36
+ * - Objects with all empty values: {a: null, b: ''}
37
+ * - Flat array wrappers: {__FLAT__: null} or {__FLAT__: ''}
38
+ *
39
+ * @param value - The value to check (will be converted via fromNullishString first)
40
+ * @returns true if the value is empty
41
+ *
42
+ * @example
43
+ * isValueEmpty(null) // true
44
+ * isValueEmpty('') // true
45
+ * isValueEmpty('__NULL__') // true (marker string)
46
+ * isValueEmpty([]) // true (empty array)
47
+ * isValueEmpty({a: null}) // true (object with all empty values)
48
+ * isValueEmpty({__FLAT__: null}) // true (flat array wrapper with empty value)
49
+ * isValueEmpty({__FLAT__: ''}) // true
50
+ * isValueEmpty('hello') // false
51
+ * isValueEmpty([1, 2]) // false
52
+ * isValueEmpty({a: 'value'}) // false
53
+ * isValueEmpty({__FLAT__: 'value'}) // false
54
+ */
55
+ declare const isValueEmpty: (value: unknown) => boolean;
56
+ /**
57
+ * Converts marker strings back to their original values when processing arrays
58
+ */
59
+ declare const fromNullishString: (value: unknown) => unknown;
60
+ /**
61
+ * Converts null/falsy values to marker strings for JSON processing
62
+ */
63
+ declare const toNullishString: (value: unknown) => unknown;
64
+ /**
65
+ * Converts field values to a format suitable for forms by:
66
+ * - Wrapping arrays of primitives as objects using the flatArrayKey `__FLAT__`
67
+ * to satisfy RHF's requirement that array fields contain objects
68
+ * - Removing empty strings and null values from objects
69
+ *
70
+ * This conversion is required because React Hook Form does not support arrays with
71
+ * flat values (string, number, boolean, null). Array fields must contain objects.
72
+ * We work around this by wrapping primitive entries: `{ __FLAT__: <value> }`.
73
+ *
74
+ * @example
75
+ * const fields = {
76
+ * name: 'John',
77
+ * scores: [0, null, 75, false],
78
+ * scoresDetailed: [
79
+ * { score: 1 },
80
+ * { score: null },
81
+ * { score: 0 },
82
+ * { score: false },
83
+ * { score: '' },
84
+ * ],
85
+ * contact: {
86
+ * email: '',
87
+ * phone: null,
88
+ * address: '123 Main St'
89
+ * }
90
+ * };
91
+ *
92
+ * // Result:
93
+ * {
94
+ * name: 'John',
95
+ * scores: [
96
+ * { __FLAT__: 0 },
97
+ * { __FLAT__: null },
98
+ * { __FLAT__: 75 },
99
+ * { __FLAT__: false }
100
+ * ],
101
+ * // Arrays of objects are left as objects; empty/null properties are removed
102
+ * scoresDetailed: [
103
+ * { score: 1 },
104
+ * {}, // null score removed
105
+ * { score: 0 },
106
+ * { score: false },
107
+ * {}, // empty string removed
108
+ * ],
109
+ * contact: {
110
+ * address: '123 Main St'
111
+ * }
112
+ * }
113
+ */
114
+ declare const toFormFormat: (fields: Record<string, unknown>) => Record<string, unknown>;
115
+ /**
116
+ * Converts form state to a format suitable for validation by:
117
+ * - Unwrapping flat array wrappers `{ __FLAT__: <value> }` back to primitives
118
+ * - Converting legacy string markers (__NULL__, __FALSE__, __ZERO__) back to their original values
119
+ * - Removing fields whose converted value is empty string or null
120
+ * - Removing empty arrays
121
+ *
122
+ * @example
123
+ * const formState = {
124
+ * name: 'John',
125
+ * scores: [
126
+ * { __FLAT__: 75 },
127
+ * { __FLAT__: 0 },
128
+ * { __FLAT__: null },
129
+ * { __FLAT__: false }
130
+ * ],
131
+ * emptyArray: [],
132
+ * scoresDetailed: [
133
+ * { score: 1 },
134
+ * {},
135
+ * { score: 0 },
136
+ * { score: false },
137
+ * {},
138
+ * ],
139
+ * contact: {
140
+ * address: '123 Main St',
141
+ * fax: null
142
+ * }
143
+ * };
144
+ *
145
+ * // Result:
146
+ * {
147
+ * name: 'John',
148
+ * scores: [75, 0, null, false],
149
+ * // emptyArray is removed
150
+ * // Objects inside arrays remain objects; empty entries remain empty objects
151
+ * scoresDetailed: [
152
+ * { score: 1 },
153
+ * {},
154
+ * { score: 0 },
155
+ * { score: false },
156
+ * {},
157
+ * ],
158
+ * contact: {
159
+ * address: '123 Main St'
160
+ * }
161
+ * }
162
+ */
163
+ declare const toValidationFormat: (formState: Record<string, unknown> | null | undefined) => Record<string, unknown> | null | undefined;
164
+ /**
165
+ * Converts a field name to a testId by removing flat array key segments and slugifying.
166
+ * Removes all occurrences of `flatArrayKey` from the field name and applies slugify transformation.
167
+ *
168
+ * This is used to generate stable testIds for form fields that don't include
169
+ * the internal `__FLAT__` marker used for flat arrays.
170
+ *
171
+ * @param name - The field name as a string (e.g., 'tags.0.__FLAT__') or array path (e.g., ['tags', '0', '__FLAT__'])
172
+ * @returns The slugified field name with all flat array key segments removed (e.g., 'tags_0')
173
+ *
174
+ * @example
175
+ * ```ts
176
+ * nameToTestId('tags.0.__FLAT__') // => 'tags_0'
177
+ * nameToTestId('array.0.__FLAT__') // => 'array_0'
178
+ * nameToTestId('nested.array.0.__FLAT__.field') // => 'nested_array_0_field'
179
+ * nameToTestId('simple.field') // => 'simple_field'
180
+ * nameToTestId(['tags', '0', '__FLAT__']) // => 'tags_0'
181
+ * ```
182
+ */
183
+ declare const nameToTestId: (name: string | readonly string[]) => string;
184
+ //#endregion
185
+ export { createOptionValueConverter, flatArrayKey, fromNullishString, isValueEmpty, nameToTestId, toFormFormat, toNullishString, toValidationFormat };
186
+ //# sourceMappingURL=index.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../../src/helpers/createOptionValueConverter/createOptionValueConverter.ts","../../src/helpers/nullishFields/nullishFields.ts"],"sourcesContent":[],"mappings":";;AAeA;;;;;;;;ACZA;AAsCA;AA0BA;AAsCA;AA6Ea,cDvKA,0BC+LgC,EAAA,CAAA,UAAA;EAmDhC,KAAA,EAAA,MAAA,GAAA,MA6EZ,GAAA,OAAA;AAqBD,CAAA,CAAA,CAAA,OAAa,EDjVF,CCiVE,EAAA,EAAA,GAsBZ;;;;;;;;AD1WY,cCZA,YAAA,GD8DZ,UAAA;;;;;;;;AC9DD;AAsCA;AA0BA;AAsCA;AA6EA;AA2EA;AAkGA;;;;;;;;;;;;;;;;cA1Ta;;;;cA0BA;;;;cAsCA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA6EA,uBAAwB,4BAwBE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAmD1B,gCACA,+CACV;;;;;;;;;;;;;;;;;;;;cAgGU"}
@@ -1,2 +1,186 @@
1
- import { a as toFormFormat, c as createOptionValueConverter, i as nameToTestId, n as fromNullishString, o as toNullishString, r as isValueEmpty, s as toValidationFormat, t as flatArrayKey } from "../index-BPjrrFuM.js";
2
- export { createOptionValueConverter, flatArrayKey, fromNullishString, isValueEmpty, nameToTestId, toFormFormat, toNullishString, toValidationFormat };
1
+ //#region src/helpers/createOptionValueConverter/createOptionValueConverter.d.ts
2
+ /**
3
+ * Creates a converter function that preserves the original type (string, number, or boolean)
4
+ * of option values when converting from string keys back to their original type.
5
+ *
6
+ * This is useful for radio/select components where the underlying UI library
7
+ * uses string keys internally, but we want to preserve number/boolean values in the form state.
8
+ *
9
+ * @param options - Array of options with a value property that can be string, number, or boolean
10
+ * @returns An object with:
11
+ * - `convertToOriginalType`: Function to convert a string key back to its original type
12
+ * - `numberValueKeys`: Set of string representations of number values (for internal use)
13
+ * - `booleanValueKeys`: Map of string representations to boolean values (for internal use)
14
+ */
15
+ declare const createOptionValueConverter: <T extends {
16
+ value: string | number | boolean;
17
+ }>(options: T[]) => {
18
+ booleanValueKeys: Map<string, boolean>;
19
+ convertToOriginalType: (key: string | number | boolean) => string | number | boolean;
20
+ numberValueKeys: Set<string>;
21
+ };
22
+ //#endregion
23
+ //#region src/helpers/nullishFields/nullishFields.d.ts
24
+ /** Key used to wrap flat array elements when converting to form format */
25
+ declare const flatArrayKey = "__FLAT__";
26
+ /**
27
+ * Checks if a value is considered "empty" for validation display purposes.
28
+ *
29
+ * Used by useUniformField to determine when to show validation errors.
30
+ * Empty values don't trigger immediate error display (user must interact first).
31
+ *
32
+ * Handles:
33
+ * - Primitives: null, undefined, ''
34
+ * - Marker strings: __NULL__, __FALSE__, __ZERO__ (converted via fromNullishString)
35
+ * - Empty arrays: []
36
+ * - Objects with all empty values: {a: null, b: ''}
37
+ * - Flat array wrappers: {__FLAT__: null} or {__FLAT__: ''}
38
+ *
39
+ * @param value - The value to check (will be converted via fromNullishString first)
40
+ * @returns true if the value is empty
41
+ *
42
+ * @example
43
+ * isValueEmpty(null) // true
44
+ * isValueEmpty('') // true
45
+ * isValueEmpty('__NULL__') // true (marker string)
46
+ * isValueEmpty([]) // true (empty array)
47
+ * isValueEmpty({a: null}) // true (object with all empty values)
48
+ * isValueEmpty({__FLAT__: null}) // true (flat array wrapper with empty value)
49
+ * isValueEmpty({__FLAT__: ''}) // true
50
+ * isValueEmpty('hello') // false
51
+ * isValueEmpty([1, 2]) // false
52
+ * isValueEmpty({a: 'value'}) // false
53
+ * isValueEmpty({__FLAT__: 'value'}) // false
54
+ */
55
+ declare const isValueEmpty: (value: unknown) => boolean;
56
+ /**
57
+ * Converts marker strings back to their original values when processing arrays
58
+ */
59
+ declare const fromNullishString: (value: unknown) => unknown;
60
+ /**
61
+ * Converts null/falsy values to marker strings for JSON processing
62
+ */
63
+ declare const toNullishString: (value: unknown) => unknown;
64
+ /**
65
+ * Converts field values to a format suitable for forms by:
66
+ * - Wrapping arrays of primitives as objects using the flatArrayKey `__FLAT__`
67
+ * to satisfy RHF's requirement that array fields contain objects
68
+ * - Removing empty strings and null values from objects
69
+ *
70
+ * This conversion is required because React Hook Form does not support arrays with
71
+ * flat values (string, number, boolean, null). Array fields must contain objects.
72
+ * We work around this by wrapping primitive entries: `{ __FLAT__: <value> }`.
73
+ *
74
+ * @example
75
+ * const fields = {
76
+ * name: 'John',
77
+ * scores: [0, null, 75, false],
78
+ * scoresDetailed: [
79
+ * { score: 1 },
80
+ * { score: null },
81
+ * { score: 0 },
82
+ * { score: false },
83
+ * { score: '' },
84
+ * ],
85
+ * contact: {
86
+ * email: '',
87
+ * phone: null,
88
+ * address: '123 Main St'
89
+ * }
90
+ * };
91
+ *
92
+ * // Result:
93
+ * {
94
+ * name: 'John',
95
+ * scores: [
96
+ * { __FLAT__: 0 },
97
+ * { __FLAT__: null },
98
+ * { __FLAT__: 75 },
99
+ * { __FLAT__: false }
100
+ * ],
101
+ * // Arrays of objects are left as objects; empty/null properties are removed
102
+ * scoresDetailed: [
103
+ * { score: 1 },
104
+ * {}, // null score removed
105
+ * { score: 0 },
106
+ * { score: false },
107
+ * {}, // empty string removed
108
+ * ],
109
+ * contact: {
110
+ * address: '123 Main St'
111
+ * }
112
+ * }
113
+ */
114
+ declare const toFormFormat: (fields: Record<string, unknown>) => Record<string, unknown>;
115
+ /**
116
+ * Converts form state to a format suitable for validation by:
117
+ * - Unwrapping flat array wrappers `{ __FLAT__: <value> }` back to primitives
118
+ * - Converting legacy string markers (__NULL__, __FALSE__, __ZERO__) back to their original values
119
+ * - Removing fields whose converted value is empty string or null
120
+ * - Removing empty arrays
121
+ *
122
+ * @example
123
+ * const formState = {
124
+ * name: 'John',
125
+ * scores: [
126
+ * { __FLAT__: 75 },
127
+ * { __FLAT__: 0 },
128
+ * { __FLAT__: null },
129
+ * { __FLAT__: false }
130
+ * ],
131
+ * emptyArray: [],
132
+ * scoresDetailed: [
133
+ * { score: 1 },
134
+ * {},
135
+ * { score: 0 },
136
+ * { score: false },
137
+ * {},
138
+ * ],
139
+ * contact: {
140
+ * address: '123 Main St',
141
+ * fax: null
142
+ * }
143
+ * };
144
+ *
145
+ * // Result:
146
+ * {
147
+ * name: 'John',
148
+ * scores: [75, 0, null, false],
149
+ * // emptyArray is removed
150
+ * // Objects inside arrays remain objects; empty entries remain empty objects
151
+ * scoresDetailed: [
152
+ * { score: 1 },
153
+ * {},
154
+ * { score: 0 },
155
+ * { score: false },
156
+ * {},
157
+ * ],
158
+ * contact: {
159
+ * address: '123 Main St'
160
+ * }
161
+ * }
162
+ */
163
+ declare const toValidationFormat: (formState: Record<string, unknown> | null | undefined) => Record<string, unknown> | null | undefined;
164
+ /**
165
+ * Converts a field name to a testId by removing flat array key segments and slugifying.
166
+ * Removes all occurrences of `flatArrayKey` from the field name and applies slugify transformation.
167
+ *
168
+ * This is used to generate stable testIds for form fields that don't include
169
+ * the internal `__FLAT__` marker used for flat arrays.
170
+ *
171
+ * @param name - The field name as a string (e.g., 'tags.0.__FLAT__') or array path (e.g., ['tags', '0', '__FLAT__'])
172
+ * @returns The slugified field name with all flat array key segments removed (e.g., 'tags_0')
173
+ *
174
+ * @example
175
+ * ```ts
176
+ * nameToTestId('tags.0.__FLAT__') // => 'tags_0'
177
+ * nameToTestId('array.0.__FLAT__') // => 'array_0'
178
+ * nameToTestId('nested.array.0.__FLAT__.field') // => 'nested_array_0_field'
179
+ * nameToTestId('simple.field') // => 'simple_field'
180
+ * nameToTestId(['tags', '0', '__FLAT__']) // => 'tags_0'
181
+ * ```
182
+ */
183
+ declare const nameToTestId: (name: string | readonly string[]) => string;
184
+ //#endregion
185
+ export { createOptionValueConverter, flatArrayKey, fromNullishString, isValueEmpty, nameToTestId, toFormFormat, toNullishString, toValidationFormat };
186
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../../src/helpers/createOptionValueConverter/createOptionValueConverter.ts","../../src/helpers/nullishFields/nullishFields.ts"],"sourcesContent":[],"mappings":";;AAeA;;;;;;;;ACZA;AAsCA;AA0BA;AAsCA;AA6Ea,cDvKA,0BC+LgC,EAAA,CAAA,UAAA;EAmDhC,KAAA,EAAA,MAAA,GAAA,MA6EZ,GAAA,OAAA;AAqBD,CAAA,CAAA,CAAA,OAAa,EDjVF,CCiVE,EAAA,EAAA,GAsBZ;;;;;;;;AD1WY,cCZA,YAAA,GD8DZ,UAAA;;;;;;;;AC9DD;AAsCA;AA0BA;AAsCA;AA6EA;AA2EA;AAkGA;;;;;;;;;;;;;;;;cA1Ta;;;;cA0BA;;;;cAsCA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA6EA,uBAAwB,4BAwBE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAmD1B,gCACA,+CACV;;;;;;;;;;;;;;;;;;;;cAgGU"}
@@ -1,2 +1,2 @@
1
- import { n as useClientValidation, t as clientValidationSchemaByName } from "../../useClientValidation-DSMw7f-t.cjs";
1
+ import { n as useClientValidation, t as clientValidationSchemaByName } from "../../useClientValidation-BvPDQmf6.cjs";
2
2
  export { clientValidationSchemaByName, useClientValidation };
@@ -1,2 +1,2 @@
1
- import { n as useClientValidation, t as clientValidationSchemaByName } from "../../useClientValidation-Bv0yxTyV.js";
1
+ import { n as useClientValidation, t as clientValidationSchemaByName } from "../../useClientValidation-Bg0q3Axc.js";
2
2
  export { clientValidationSchemaByName, useClientValidation };
@@ -1,2 +1,2 @@
1
- import { n as UseControllerReturn, r as useController, t as UseControllerProps } from "../../useController-B-DhUPpA.cjs";
1
+ import { n as UseControllerReturn, r as useController, t as UseControllerProps } from "../../useController-C6Pg9T_3.cjs";
2
2
  export { UseControllerProps, UseControllerReturn, useController };
@@ -1,2 +1,3 @@
1
- import { n as UseControllerReturn, r as useController, t as UseControllerProps } from "../../useController-Co8wbo-Y.js";
1
+ import { n as UseControllerReturn, r as useController, t as UseControllerProps } from "../../useController-BJ2SBdky.js";
2
+ import "../../index-CFBmva_r.js";
2
3
  export { UseControllerProps, UseControllerReturn, useController };
@@ -1,2 +1,2 @@
1
- import { n as useFormContext, t as checkFieldIsRequired } from "../../useFormContext-oEivkWtB.cjs";
1
+ import { n as useFormContext, t as checkFieldIsRequired } from "../../useFormContext-n3WYgGkW.cjs";
2
2
  export { checkFieldIsRequired, useFormContext };
@@ -1,4 +1,4 @@
1
1
  import "../../FormContext-C2_WMi_v.js";
2
- import { n as useFormContext, t as checkFieldIsRequired } from "../../useFormContext-DDx8LD8e.js";
2
+ import { n as useFormContext, t as checkFieldIsRequired } from "../../useFormContext-B2TS6xq0.js";
3
3
  import "../../index-BRLjimYW.js";
4
4
  export { checkFieldIsRequired, useFormContext };
@@ -1,2 +1,2 @@
1
- import { n as UseUniformFieldReturn, r as useUniformField, t as UseUniformFieldParams } from "../../useUniformField-DFXQO9dw.cjs";
1
+ import { n as UseUniformFieldReturn, r as useUniformField, t as UseUniformFieldParams } from "../../useUniformField-ETnay_UI.cjs";
2
2
  export { UseUniformFieldParams, UseUniformFieldReturn, useUniformField };
@@ -1,6 +1,6 @@
1
1
  import "../../FormContext-C2_WMi_v.js";
2
- import "../../useController-Co8wbo-Y.js";
3
- import "../../useFormContext-DDx8LD8e.js";
2
+ import "../../useController-BJ2SBdky.js";
3
+ import "../../useFormContext-B2TS6xq0.js";
4
4
  import "../../useInput-BCdeYOOg.js";
5
- import { n as UseUniformFieldReturn, r as useUniformField, t as UseUniformFieldParams } from "../../useUniformField-q3GCAV85.js";
5
+ import { n as UseUniformFieldReturn, r as useUniformField, t as UseUniformFieldParams } from "../../useUniformField-CXSaAVTt.js";
6
6
  export { UseUniformFieldParams, UseUniformFieldReturn, useUniformField };
@@ -1,2 +1,2 @@
1
- import { n as useUniformFieldArray, t as UseUniformFieldArrayProps } from "../../useUniformFieldArray-B3smveBW.cjs";
1
+ import { n as useUniformFieldArray, t as UseUniformFieldArrayProps } from "../../useUniformFieldArray-4pUdrWYT.cjs";
2
2
  export { UseUniformFieldArrayProps, useUniformFieldArray };
@@ -1,27 +1,7 @@
1
- import "../../index-DubKudrE.js";
2
- import "../../index-CJ90vm9t.js";
3
- import "../../index-BuX42Bbd.js";
4
1
  import "../../FormContext-C2_WMi_v.js";
5
- import "../../index-aHcGnXHf.js";
6
- import "../../index-CCeHSmIe.js";
7
- import "../../index-D-ucmG60.js";
8
- import "../../index-FHPC_VE1.js";
9
- import "../../index-tIGuHSXb.js";
10
- import "../../index-noH6pESQ.js";
11
- import "../../index-CRYEKT3o.js";
12
- import "../../index-CdXOAPMb.js";
13
- import "../../index-CVY05bZf.js";
14
- import "../../index-Djc5tmi3.js";
15
- import "../../index-DS4AP9pV.js";
16
- import "../../index-BDvr4eaz.js";
17
- import "../../useClientValidation-Bv0yxTyV.js";
18
- import "../../useController-Co8wbo-Y.js";
19
- import "../../useFormContext-DDx8LD8e.js";
2
+ import "../../useController-BJ2SBdky.js";
3
+ import "../../index-CFBmva_r.js";
4
+ import "../../useFormContext-B2TS6xq0.js";
20
5
  import "../../index-BRLjimYW.js";
21
- import "../../useInput-BCdeYOOg.js";
22
- import "../../useUniformField-q3GCAV85.js";
23
- import "../../index-lot50R9R.js";
24
- import "../../index-CPcJGZVS.js";
25
- import "../../useWatchUserChange-JMU-vN92.js";
26
- import { n as useUniformFieldArray, t as UseUniformFieldArrayProps } from "../../useUniformFieldArray-CmACueEO.js";
6
+ import { n as useUniformFieldArray, t as UseUniformFieldArrayProps } from "../../useUniformFieldArray-COtgcAnp.js";
27
7
  export { UseUniformFieldArrayProps, useUniformFieldArray };
@@ -1,2 +1,2 @@
1
- import { n as useWatchUserChange, t as UseWatchUserChangeOptions } from "../../useWatchUserChange-DahNCPDG.cjs";
1
+ import { n as useWatchUserChange, t as UseWatchUserChangeOptions } from "../../useWatchUserChange-cI5-j6M4.cjs";
2
2
  export { UseWatchUserChangeOptions, useWatchUserChange };
@@ -1,2 +1,2 @@
1
- import { n as useWatchUserChange, t as UseWatchUserChangeOptions } from "../../useWatchUserChange-JMU-vN92.js";
1
+ import { n as useWatchUserChange, t as UseWatchUserChangeOptions } from "../../useWatchUserChange-DX6gUHvM.js";
2
2
  export { UseWatchUserChangeOptions, useWatchUserChange };
@@ -1,34 +1,34 @@
1
- import * as tailwind_variants45 from "tailwind-variants";
2
1
  import { TVClassName, TVProps } from "@fuf-stack/pixel-utils";
3
2
  import { ReactElement, ReactNode } from "react";
3
+ import * as tailwind_variants245 from "tailwind-variants";
4
4
 
5
5
  //#region src/Radios/Radios.d.ts
6
- declare const radiosVariants: tailwind_variants45.TVReturnType<{
6
+ declare const radiosVariants: tailwind_variants245.TVReturnType<{
7
7
  [key: string]: {
8
- [key: string]: tailwind_variants45.ClassValue | {
9
- base?: tailwind_variants45.ClassValue;
10
- label?: tailwind_variants45.ClassValue;
11
- itemBase?: tailwind_variants45.ClassValue;
12
- itemControl?: tailwind_variants45.ClassValue;
13
- itemDescription?: tailwind_variants45.ClassValue;
14
- itemLabel?: tailwind_variants45.ClassValue;
15
- itemLabelWrapper?: tailwind_variants45.ClassValue;
16
- itemWrapper?: tailwind_variants45.ClassValue;
17
- wrapper?: tailwind_variants45.ClassValue;
8
+ [key: string]: tailwind_variants245.ClassValue | {
9
+ base?: tailwind_variants245.ClassValue;
10
+ label?: tailwind_variants245.ClassValue;
11
+ wrapper?: tailwind_variants245.ClassValue;
12
+ itemBase?: tailwind_variants245.ClassValue;
13
+ itemControl?: tailwind_variants245.ClassValue;
14
+ itemDescription?: tailwind_variants245.ClassValue;
15
+ itemLabel?: tailwind_variants245.ClassValue;
16
+ itemLabelWrapper?: tailwind_variants245.ClassValue;
17
+ itemWrapper?: tailwind_variants245.ClassValue;
18
18
  };
19
19
  };
20
20
  } | {
21
21
  [x: string]: {
22
- [x: string]: tailwind_variants45.ClassValue | {
23
- base?: tailwind_variants45.ClassValue;
24
- label?: tailwind_variants45.ClassValue;
25
- itemBase?: tailwind_variants45.ClassValue;
26
- itemControl?: tailwind_variants45.ClassValue;
27
- itemDescription?: tailwind_variants45.ClassValue;
28
- itemLabel?: tailwind_variants45.ClassValue;
29
- itemLabelWrapper?: tailwind_variants45.ClassValue;
30
- itemWrapper?: tailwind_variants45.ClassValue;
31
- wrapper?: tailwind_variants45.ClassValue;
22
+ [x: string]: tailwind_variants245.ClassValue | {
23
+ base?: tailwind_variants245.ClassValue;
24
+ label?: tailwind_variants245.ClassValue;
25
+ wrapper?: tailwind_variants245.ClassValue;
26
+ itemBase?: tailwind_variants245.ClassValue;
27
+ itemControl?: tailwind_variants245.ClassValue;
28
+ itemDescription?: tailwind_variants245.ClassValue;
29
+ itemLabel?: tailwind_variants245.ClassValue;
30
+ itemLabelWrapper?: tailwind_variants245.ClassValue;
31
+ itemWrapper?: tailwind_variants245.ClassValue;
32
32
  };
33
33
  };
34
34
  } | {}, {
@@ -43,16 +43,16 @@ declare const radiosVariants: tailwind_variants45.TVReturnType<{
43
43
  wrapper: string;
44
44
  }, undefined, {
45
45
  [key: string]: {
46
- [key: string]: tailwind_variants45.ClassValue | {
47
- base?: tailwind_variants45.ClassValue;
48
- label?: tailwind_variants45.ClassValue;
49
- itemBase?: tailwind_variants45.ClassValue;
50
- itemControl?: tailwind_variants45.ClassValue;
51
- itemDescription?: tailwind_variants45.ClassValue;
52
- itemLabel?: tailwind_variants45.ClassValue;
53
- itemLabelWrapper?: tailwind_variants45.ClassValue;
54
- itemWrapper?: tailwind_variants45.ClassValue;
55
- wrapper?: tailwind_variants45.ClassValue;
46
+ [key: string]: tailwind_variants245.ClassValue | {
47
+ base?: tailwind_variants245.ClassValue;
48
+ label?: tailwind_variants245.ClassValue;
49
+ wrapper?: tailwind_variants245.ClassValue;
50
+ itemBase?: tailwind_variants245.ClassValue;
51
+ itemControl?: tailwind_variants245.ClassValue;
52
+ itemDescription?: tailwind_variants245.ClassValue;
53
+ itemLabel?: tailwind_variants245.ClassValue;
54
+ itemLabelWrapper?: tailwind_variants245.ClassValue;
55
+ itemWrapper?: tailwind_variants245.ClassValue;
56
56
  };
57
57
  };
58
58
  } | {}, {
@@ -65,7 +65,7 @@ declare const radiosVariants: tailwind_variants45.TVReturnType<{
65
65
  itemWrapper: string;
66
66
  label: string;
67
67
  wrapper: string;
68
- }, tailwind_variants45.TVReturnType<unknown, {
68
+ }, tailwind_variants245.TVReturnType<unknown, {
69
69
  base: string;
70
70
  itemBase: string;
71
71
  itemControl: string;
@@ -120,4 +120,4 @@ declare const Radios: ({
120
120
  }: RadiosProps) => ReactElement;
121
121
  //#endregion
122
122
  export { RadiosProps as n, Radios as t };
123
- //# sourceMappingURL=index-BZrLB2p0.d.cts.map
123
+ //# sourceMappingURL=index-796vjEop.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-796vjEop.d.ts","names":[],"sources":["../src/Radios/Radios.tsx"],"sourcesContent":[],"mappings":";;;;;cAaa,qCAAc;;mBAgBzB,oBAAA,CAAA,UAAA;MAhBW,IAAA,CAAA,iCAgBX;MAAA,KAAA,CAAA,iCAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAhByB;EAAA,KAAA,EAAA,MAAA;EAkBtB,OAAA,EAAA,MAAY;AAAU,CAAA,EAAA,SACtB,EAAA;EAEY,CAAA,GAAA,EAAA,MAAA,CAAA,EAAW;IAaX,CAAA,GAAA,EAAA,MAAY,CAAA,oCAAA;MAIf,IAAA,CAAA,iCAAA;MAMJ,KAAA,CAAA,iCAAA;MAIC,OAAA,CAAA,iCAAA;MAd0B,QAAA,CAAA,iCAAA;MAAY,WAAA,CAAA,iCAAA;MAsB3C,eAkFL,CAAA,iCAAA;MAlFe,SAAA,CAAA,iCAAA;MAAA,gBAAA,CAAA,iCAAA;MAAA,WAAA,CAAA,iCAAA;IAAA,CAAA;EAMb,CAAA;CAAc,GAAA,CAAA,CAAA,EAAA;EA4EhB,IAAA,EAAA,MAAA;;;;;;;;;;;;;;;;;;;;KAxHI,YAAA,GAAe,eAAe;KAC9B,SAAA,GAAY,mBAAmB;UAEnB,WAAA;;;;UAIP;;SAED;;;;;;UAOQ,WAAA,SAAoB;;;;cAIvB;;;;;;UAMJ;;;;WAIC;;;;;;;cAQL;;;;;;GAMH,gBAAc"}