@digigov/form 2.0.0-834daea4 → 2.0.0-87b6232d

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 (562) hide show
  1. package/Field/ErrorGroup/index.js +48 -0
  2. package/{Form.stories → Field/ErrorGroup}/package.json +1 -1
  3. package/Field/ErrorGroup.d.ts +15 -0
  4. package/Field/ErrorGroup.js.map +7 -0
  5. package/Field/FieldBase/index.js +38 -25
  6. package/Field/FieldBase.js.map +2 -2
  7. package/Field/FieldBaseContainer/index.js +5 -3
  8. package/Field/FieldBaseContainer.js.map +2 -2
  9. package/Field/FieldConditional/index.js +4 -0
  10. package/Field/FieldConditional.js.map +2 -2
  11. package/Field/index.js +14 -4
  12. package/Field/index.js.map +2 -2
  13. package/Field/types.d.ts +20 -10
  14. package/Field/utils/index.js +8 -1
  15. package/Field/utils/index.js.map +2 -2
  16. package/Field/utils/useField/index.js +14 -1
  17. package/Field/utils/useField.js.map +2 -2
  18. package/FieldArray/FieldArray.stories.d.ts +1 -0
  19. package/FieldArray/FormDialog/index.js +402 -0
  20. package/{Questions/Questions.stories → FieldArray/FormDialog}/package.json +1 -1
  21. package/FieldArray/FormDialog.d.ts +67 -0
  22. package/FieldArray/FormDialog.js.map +7 -0
  23. package/FieldArray/__stories__/WithModal.d.ts +2 -0
  24. package/FieldArray/index.d.ts +6 -0
  25. package/FieldArray/index.js +97 -46
  26. package/FieldArray/index.js.map +3 -3
  27. package/FieldObject/index.d.ts +5 -0
  28. package/FieldObject/index.js +30 -15
  29. package/FieldObject/index.js.map +2 -2
  30. package/FormBuilder/FormBuilder.stories.d.ts +2 -0
  31. package/FormBuilder/__stories__/AutoErrorGrouping.d.ts +3 -0
  32. package/FormBuilder/__stories__/ErrorGrouping.d.ts +3 -0
  33. package/FormBuilder/index.js +93 -6
  34. package/FormBuilder/index.js.map +2 -2
  35. package/FormBuilder/interaction.test.d.ts +1 -0
  36. package/FormContext.js.map +2 -2
  37. package/MultiplicityField/add-objects/index.js +6 -2
  38. package/MultiplicityField/add-objects.js.map +2 -2
  39. package/MultiplicityField/index.js +2 -0
  40. package/MultiplicityField/index.js.map +2 -2
  41. package/MultiplicityField/types.d.ts +1 -2
  42. package/Questions/Questions/index.js +5 -4
  43. package/Questions/Questions.js.map +2 -2
  44. package/Questions/Step/StepArrayReview.js.map +2 -2
  45. package/cjs/Field/ErrorGroup/index.js +82 -0
  46. package/cjs/Field/ErrorGroup.js.map +7 -0
  47. package/cjs/Field/FieldBase/index.js +37 -24
  48. package/cjs/Field/FieldBase.js.map +2 -2
  49. package/cjs/Field/FieldBaseContainer/index.js +5 -3
  50. package/cjs/Field/FieldBaseContainer.js.map +2 -2
  51. package/cjs/Field/FieldConditional/index.js +4 -0
  52. package/cjs/Field/FieldConditional.js.map +2 -2
  53. package/cjs/Field/index.js +14 -4
  54. package/cjs/Field/index.js.map +2 -2
  55. package/cjs/Field/types.js.map +1 -1
  56. package/cjs/Field/utils/index.js +8 -1
  57. package/cjs/Field/utils/index.js.map +3 -3
  58. package/cjs/Field/utils/useField/index.js +14 -1
  59. package/cjs/Field/utils/useField.js.map +2 -2
  60. package/cjs/FieldArray/FormDialog/index.js +421 -0
  61. package/cjs/FieldArray/FormDialog.js.map +7 -0
  62. package/cjs/FieldArray/index.js +92 -44
  63. package/cjs/FieldArray/index.js.map +3 -3
  64. package/cjs/FieldObject/index.js +30 -15
  65. package/cjs/FieldObject/index.js.map +2 -2
  66. package/cjs/FormBuilder/index.js +92 -5
  67. package/cjs/FormBuilder/index.js.map +2 -2
  68. package/cjs/FormContext/index.js +2 -2
  69. package/cjs/FormContext.js.map +3 -3
  70. package/cjs/MultiplicityField/add-objects/index.js +6 -2
  71. package/cjs/MultiplicityField/add-objects.js.map +2 -2
  72. package/cjs/MultiplicityField/index.js +2 -0
  73. package/cjs/MultiplicityField/index.js.map +2 -2
  74. package/cjs/MultiplicityField/types.js.map +1 -1
  75. package/cjs/Questions/Questions/index.js +5 -4
  76. package/cjs/Questions/Questions.js.map +2 -2
  77. package/cjs/Questions/Step/StepArrayReview.js.map +2 -2
  78. package/cjs/inputs/AutoCompleteInput/index.js +4 -3
  79. package/cjs/inputs/AutoCompleteInput/index.js.map +2 -2
  80. package/cjs/inputs/Checkboxes/index.js +2 -1
  81. package/cjs/inputs/Checkboxes/index.js.map +2 -2
  82. package/cjs/inputs/DateInput/index.js +27 -12
  83. package/cjs/inputs/DateInput/index.js.map +2 -2
  84. package/cjs/inputs/DateTimeInput/index.js +224 -0
  85. package/cjs/inputs/DateTimeInput/index.js.map +7 -0
  86. package/cjs/inputs/FileInput/index.js +50 -31
  87. package/cjs/inputs/FileInput/index.js.map +2 -2
  88. package/cjs/inputs/ImageInput/index.js +8 -2
  89. package/cjs/inputs/ImageInput/index.js.map +2 -2
  90. package/cjs/inputs/Input/index.js +9 -2
  91. package/cjs/inputs/Input/index.js.map +2 -2
  92. package/cjs/inputs/Input/inputsInputScenarios.js.map +2 -2
  93. package/cjs/inputs/Label/index.js.map +2 -2
  94. package/cjs/inputs/OtpInput/index.js +1 -0
  95. package/cjs/inputs/OtpInput/index.js.map +2 -2
  96. package/cjs/inputs/Radio/index.js +1 -0
  97. package/cjs/inputs/Radio/index.js.map +2 -2
  98. package/cjs/inputs/Select/index.js +9 -2
  99. package/cjs/inputs/Select/index.js.map +2 -2
  100. package/cjs/inputs/inputsScenarios/index.js +6 -12
  101. package/cjs/inputs/inputsScenarios.js.map +2 -2
  102. package/cjs/lazy/index.js +48 -38
  103. package/cjs/lazy.js.map +3 -3
  104. package/cjs/locales/el.js.map +1 -1
  105. package/cjs/registry/index.js +70 -60
  106. package/cjs/registry.js.map +3 -3
  107. package/cjs/types.js.map +1 -1
  108. package/cjs/utils/index.js +22 -7
  109. package/cjs/utils.js.map +2 -2
  110. package/cjs/validators/index.js +58 -27
  111. package/cjs/validators/index.js.map +2 -2
  112. package/cjs/validators/utils/amka/index.js +60 -0
  113. package/cjs/validators/utils/amka.js.map +7 -0
  114. package/cjs/validators/utils/datetime/index.js +151 -0
  115. package/cjs/validators/utils/datetime.js.map +7 -0
  116. package/cjs/validators/utils/file/index.js +30 -17
  117. package/cjs/validators/utils/file.js.map +2 -2
  118. package/cjs/validators/utils/index.js +8 -2
  119. package/cjs/validators/utils/index.js.map +2 -2
  120. package/cjs/validators/utils/int/index.js +1 -1
  121. package/cjs/validators/utils/int.js.map +2 -2
  122. package/cjs/validators/utils/number/index.js +1 -1
  123. package/cjs/validators/utils/number.js.map +2 -2
  124. package/cjs/validators/utils/phone.js.map +2 -2
  125. package/cjs/validators/utils/postal_code.js.map +1 -1
  126. package/cjs/validators/utils/uuid4.js.map +2 -2
  127. package/index.js +1 -1
  128. package/inputs/AutoCompleteInput/index.d.ts +1 -1
  129. package/inputs/AutoCompleteInput/index.js +4 -3
  130. package/inputs/AutoCompleteInput/index.js.map +2 -2
  131. package/inputs/Checkboxes/index.d.ts +1 -1
  132. package/inputs/Checkboxes/index.js +2 -1
  133. package/inputs/Checkboxes/index.js.map +2 -2
  134. package/inputs/DateInput/index.d.ts +1 -2
  135. package/inputs/DateInput/index.js +27 -12
  136. package/inputs/DateInput/index.js.map +2 -2
  137. package/inputs/DateTimeInput/DateTimeInput.stories.d.ts +7 -0
  138. package/inputs/DateTimeInput/__stories__/Default.d.ts +3 -0
  139. package/inputs/DateTimeInput/index.d.ts +13 -0
  140. package/inputs/DateTimeInput/index.js +194 -0
  141. package/inputs/DateTimeInput/index.js.map +7 -0
  142. package/inputs/DateTimeInput/index.test.d.ts +1 -0
  143. package/inputs/{Input/Input.stories → DateTimeInput}/package.json +1 -1
  144. package/inputs/FileInput/FileInput.stories.d.ts +1 -0
  145. package/inputs/FileInput/__stories__/WithBorderAndLink.d.ts +3 -0
  146. package/inputs/FileInput/index.d.ts +12 -0
  147. package/inputs/FileInput/index.js +55 -33
  148. package/inputs/FileInput/index.js.map +2 -2
  149. package/inputs/ImageInput/index.js +8 -2
  150. package/inputs/ImageInput/index.js.map +2 -2
  151. package/inputs/Input/Input.stories.d.ts +2 -0
  152. package/inputs/Input/__stories__/AMKA.d.ts +3 -0
  153. package/inputs/Input/__stories__/StringWithTrimValidation.d.ts +3 -0
  154. package/inputs/Input/index.d.ts +2 -1
  155. package/inputs/Input/index.js +9 -2
  156. package/inputs/Input/index.js.map +2 -2
  157. package/inputs/Input/inputsInputScenarios.js.map +2 -2
  158. package/inputs/Label/index.d.ts +0 -2
  159. package/inputs/Label/index.js.map +2 -2
  160. package/inputs/OtpInput/index.js +1 -0
  161. package/inputs/OtpInput/index.js.map +2 -2
  162. package/inputs/Radio/index.d.ts +1 -1
  163. package/inputs/Radio/index.js +1 -0
  164. package/inputs/Radio/index.js.map +2 -2
  165. package/inputs/Select/index.d.ts +3 -2
  166. package/inputs/Select/index.js +13 -3
  167. package/inputs/Select/index.js.map +2 -2
  168. package/inputs/inputsScenarios/index.js +6 -12
  169. package/inputs/inputsScenarios.d.ts +1 -1
  170. package/inputs/inputsScenarios.js.map +2 -2
  171. package/lazy/index.js +77 -71
  172. package/locales/el.js.map +1 -1
  173. package/package.json +5 -5
  174. package/registry/index.js +116 -107
  175. package/src/Field/ErrorGroup.tsx +84 -0
  176. package/src/Field/FieldBase.tsx +55 -36
  177. package/src/Field/FieldBaseContainer.tsx +11 -7
  178. package/src/Field/FieldConditional.tsx +6 -2
  179. package/src/Field/doc.mdx +202 -1
  180. package/src/Field/index.tsx +19 -5
  181. package/src/Field/types.tsx +22 -10
  182. package/src/Field/utils/index.ts +7 -0
  183. package/src/Field/utils/useField.ts +14 -2
  184. package/src/FieldArray/FieldArray.stories.js +1 -0
  185. package/src/FieldArray/FormDialog.tsx +574 -0
  186. package/src/FieldArray/__stories__/Default.tsx +1 -0
  187. package/src/FieldArray/__stories__/WithExactLength.tsx +1 -0
  188. package/src/FieldArray/__stories__/WithModal.tsx +160 -0
  189. package/src/FieldArray/index.test.tsx +8 -0
  190. package/src/FieldArray/index.tsx +116 -60
  191. package/src/FieldObject/index.tsx +39 -18
  192. package/src/FormBuilder/FormBuilder.stories.js +2 -0
  193. package/src/FormBuilder/__stories__/AutoErrorGrouping.tsx +63 -0
  194. package/src/FormBuilder/__stories__/ErrorGrouping.tsx +43 -0
  195. package/src/FormBuilder/doc.mdx +9 -4
  196. package/src/FormBuilder/index.test.tsx +12 -0
  197. package/src/FormBuilder/index.tsx +103 -9
  198. package/src/FormBuilder/interaction.test.tsx +40 -0
  199. package/src/FormBuilder/scenarios.test.tsx +124 -10
  200. package/src/FormContext.tsx +1 -2
  201. package/src/MultiplicityField/add-objects.tsx +6 -3
  202. package/src/MultiplicityField/doc.mdx +101 -83
  203. package/src/MultiplicityField/index.test.tsx +4 -0
  204. package/src/MultiplicityField/index.tsx +2 -0
  205. package/src/MultiplicityField/types.ts +1 -2
  206. package/src/Questions/Questions.tsx +4 -4
  207. package/src/Questions/Step/StepArrayReview.tsx +1 -1
  208. package/src/Questions/__snapshots__/index.spec.tsx.snap +12 -10
  209. package/src/Questions/doc.mdx +21 -41
  210. package/src/Questions/index.spec.tsx +14 -2
  211. package/src/Questions/index.test.tsx +4 -0
  212. package/src/doc.mdx +26 -11
  213. package/src/inputs/AutoCompleteInput/__stories__/Default.tsx +2 -10
  214. package/src/inputs/AutoCompleteInput/__stories__/Multiple.tsx +1 -7
  215. package/src/inputs/AutoCompleteInput/index.test.tsx +4 -0
  216. package/src/inputs/AutoCompleteInput/index.tsx +4 -5
  217. package/src/inputs/Checkboxes/index.test.tsx +4 -0
  218. package/src/inputs/Checkboxes/index.tsx +3 -4
  219. package/src/inputs/DateInput/__stories__/Default.tsx +7 -12
  220. package/src/inputs/DateInput/index.test.tsx +4 -0
  221. package/src/inputs/DateInput/index.tsx +28 -11
  222. package/src/inputs/DateTimeInput/DateTimeInput.stories.js +8 -0
  223. package/src/inputs/DateTimeInput/__stories__/Default.tsx +25 -0
  224. package/src/inputs/DateTimeInput/doc.mdx +16 -0
  225. package/src/inputs/DateTimeInput/index.test.tsx +24 -0
  226. package/src/inputs/DateTimeInput/index.tsx +209 -0
  227. package/src/inputs/FileInput/FileInput.stories.js +1 -0
  228. package/src/inputs/FileInput/__stories__/WithBorderAndLink.tsx +34 -0
  229. package/src/inputs/FileInput/index.test.tsx +8 -0
  230. package/src/inputs/FileInput/index.tsx +56 -23
  231. package/src/inputs/ImageInput/ImageInput.stories.js +0 -1
  232. package/src/inputs/ImageInput/__stories__/MaxSize.tsx +2 -2
  233. package/src/inputs/ImageInput/index.test.tsx +4 -4
  234. package/src/inputs/ImageInput/index.tsx +8 -5
  235. package/src/inputs/Input/Input.stories.js +2 -0
  236. package/src/inputs/Input/__stories__/AMKA.tsx +23 -0
  237. package/src/inputs/Input/__stories__/LandlineNumber.tsx +2 -1
  238. package/src/inputs/Input/__stories__/MobilePhone.tsx +1 -0
  239. package/src/inputs/Input/__stories__/PhoneNumber.tsx +1 -0
  240. package/src/inputs/Input/__stories__/PostalCode.tsx +1 -0
  241. package/src/inputs/Input/__stories__/StringWithTrimValidation.tsx +26 -0
  242. package/src/inputs/Input/__stories__/TextWithLimit.tsx +1 -0
  243. package/src/inputs/Input/index.test.tsx +8 -0
  244. package/src/inputs/Input/index.tsx +12 -3
  245. package/src/inputs/Input/inputsInputScenarios.ts +244 -245
  246. package/src/inputs/Label/index.test.tsx +4 -0
  247. package/src/inputs/Label/index.tsx +0 -3
  248. package/src/inputs/OtpInput/index.test.tsx +4 -0
  249. package/src/inputs/OtpInput/index.tsx +3 -1
  250. package/src/inputs/Radio/index.test.tsx +4 -0
  251. package/src/inputs/Radio/index.tsx +2 -1
  252. package/src/inputs/Select/index.test.tsx +4 -0
  253. package/src/inputs/Select/index.tsx +18 -6
  254. package/src/inputs/inputsScenarios.ts +36 -42
  255. package/src/lazy.js +77 -68
  256. package/src/locales/el.ts +1 -1
  257. package/src/registry.js +108 -100
  258. package/src/types.tsx +4 -3
  259. package/src/utils.ts +29 -8
  260. package/src/validators/index.ts +104 -32
  261. package/src/validators/utils/amka.ts +39 -0
  262. package/src/validators/utils/datetime.ts +130 -0
  263. package/src/validators/utils/file.ts +33 -17
  264. package/src/validators/utils/index.ts +5 -1
  265. package/src/validators/utils/int.ts +1 -1
  266. package/src/validators/utils/number.ts +1 -1
  267. package/src/validators/utils/phone.ts +1 -1
  268. package/src/validators/utils/postal_code.ts +1 -1
  269. package/src/validators/utils/uuid4.ts +2 -1
  270. package/src/validators/validators.spec.ts +3 -3
  271. package/types.d.ts +4 -3
  272. package/types.js.map +1 -1
  273. package/utils/index.js +22 -7
  274. package/utils.d.ts +2 -0
  275. package/utils.js.map +2 -2
  276. package/validators/index.d.ts +1 -1
  277. package/validators/index.js +63 -28
  278. package/validators/index.js.map +2 -2
  279. package/validators/utils/amka/index.js +36 -0
  280. package/{FieldArray/FieldArray.stories → validators/utils/amka}/package.json +1 -1
  281. package/validators/utils/amka.d.ts +6 -0
  282. package/validators/utils/amka.js.map +7 -0
  283. package/validators/utils/datetime/index.js +116 -0
  284. package/validators/utils/datetime/package.json +6 -0
  285. package/validators/utils/datetime.d.ts +9 -0
  286. package/validators/utils/datetime.js.map +7 -0
  287. package/validators/utils/file/index.js +30 -17
  288. package/validators/utils/file.js.map +2 -2
  289. package/validators/utils/index.d.ts +2 -0
  290. package/validators/utils/index.js +5 -1
  291. package/validators/utils/index.js.map +2 -2
  292. package/validators/utils/int/index.js +1 -1
  293. package/validators/utils/int.js.map +2 -2
  294. package/validators/utils/number/index.js +1 -1
  295. package/validators/utils/number.js.map +2 -2
  296. package/validators/utils/phone.d.ts +1 -1
  297. package/validators/utils/phone.js.map +2 -2
  298. package/validators/utils/postal_code.d.ts +1 -1
  299. package/validators/utils/postal_code.js.map +1 -1
  300. package/validators/utils/uuid4.js.map +2 -2
  301. package/FieldArray/FieldArray.stories/index.js +0 -14
  302. package/FieldArray/FieldArray.stories.js.map +0 -7
  303. package/FieldArray/__stories__/Default/index.js +0 -95
  304. package/FieldArray/__stories__/Default/package.json +0 -6
  305. package/FieldArray/__stories__/Default.js.map +0 -7
  306. package/FieldArray/__stories__/WithExactLength/index.js +0 -95
  307. package/FieldArray/__stories__/WithExactLength/package.json +0 -6
  308. package/FieldArray/__stories__/WithExactLength.js.map +0 -7
  309. package/Form.stories/index.js +0 -7
  310. package/Form.stories.js.map +0 -7
  311. package/FormBuilder/FormBuilder.stories/index.js +0 -12
  312. package/FormBuilder/FormBuilder.stories/package.json +0 -6
  313. package/FormBuilder/FormBuilder.stories.js.map +0 -7
  314. package/FormBuilder/__stories__/Default/index.js +0 -32
  315. package/FormBuilder/__stories__/Default/package.json +0 -6
  316. package/FormBuilder/__stories__/Default.js.map +0 -7
  317. package/MultiplicityField/MultiplicityField.stories/index.js +0 -22
  318. package/MultiplicityField/MultiplicityField.stories/package.json +0 -6
  319. package/MultiplicityField/MultiplicityField.stories.js.map +0 -7
  320. package/MultiplicityField/__stories__/Default/index.js +0 -100
  321. package/MultiplicityField/__stories__/Default/package.json +0 -6
  322. package/MultiplicityField/__stories__/Default.js.map +0 -7
  323. package/MultiplicityField/__stories__/PreviewDisplay/index.js +0 -70
  324. package/MultiplicityField/__stories__/PreviewDisplay/package.json +0 -6
  325. package/MultiplicityField/__stories__/PreviewDisplay.js.map +0 -7
  326. package/MultiplicityField/__stories__/WithExactLength/index.js +0 -97
  327. package/MultiplicityField/__stories__/WithExactLength/package.json +0 -6
  328. package/MultiplicityField/__stories__/WithExactLength.js.map +0 -7
  329. package/MultiplicityField/__stories__/WithMaxLength/index.js +0 -100
  330. package/MultiplicityField/__stories__/WithMaxLength/package.json +0 -6
  331. package/MultiplicityField/__stories__/WithMaxLength.js.map +0 -7
  332. package/MultiplicityField/__stories__/WithMinAndMaxLength/index.js +0 -101
  333. package/MultiplicityField/__stories__/WithMinAndMaxLength/package.json +0 -6
  334. package/MultiplicityField/__stories__/WithMinAndMaxLength.js.map +0 -7
  335. package/MultiplicityField/__stories__/WithMinLength/index.js +0 -100
  336. package/MultiplicityField/__stories__/WithMinLength/package.json +0 -6
  337. package/MultiplicityField/__stories__/WithMinLength.js.map +0 -7
  338. package/Questions/Questions.stories/index.js +0 -12
  339. package/Questions/Questions.stories.js.map +0 -7
  340. package/Questions/__stories__/Default/index.js +0 -108
  341. package/Questions/__stories__/Default/package.json +0 -6
  342. package/Questions/__stories__/Default.js.map +0 -7
  343. package/cjs/FieldArray/FieldArray.stories/index.js +0 -48
  344. package/cjs/FieldArray/FieldArray.stories.js.map +0 -7
  345. package/cjs/FieldArray/__stories__/Default/index.js +0 -128
  346. package/cjs/FieldArray/__stories__/Default.js.map +0 -7
  347. package/cjs/FieldArray/__stories__/WithExactLength/index.js +0 -128
  348. package/cjs/FieldArray/__stories__/WithExactLength.js.map +0 -7
  349. package/cjs/Form.stories/index.js +0 -26
  350. package/cjs/Form.stories.js.map +0 -7
  351. package/cjs/FormBuilder/FormBuilder.stories/index.js +0 -45
  352. package/cjs/FormBuilder/FormBuilder.stories.js.map +0 -7
  353. package/cjs/FormBuilder/__stories__/Default/index.js +0 -65
  354. package/cjs/FormBuilder/__stories__/Default.js.map +0 -7
  355. package/cjs/MultiplicityField/MultiplicityField.stories/index.js +0 -60
  356. package/cjs/MultiplicityField/MultiplicityField.stories.js.map +0 -7
  357. package/cjs/MultiplicityField/__stories__/Default/index.js +0 -133
  358. package/cjs/MultiplicityField/__stories__/Default.js.map +0 -7
  359. package/cjs/MultiplicityField/__stories__/PreviewDisplay/index.js +0 -86
  360. package/cjs/MultiplicityField/__stories__/PreviewDisplay.js.map +0 -7
  361. package/cjs/MultiplicityField/__stories__/WithExactLength/index.js +0 -130
  362. package/cjs/MultiplicityField/__stories__/WithExactLength.js.map +0 -7
  363. package/cjs/MultiplicityField/__stories__/WithMaxLength/index.js +0 -133
  364. package/cjs/MultiplicityField/__stories__/WithMaxLength.js.map +0 -7
  365. package/cjs/MultiplicityField/__stories__/WithMinAndMaxLength/index.js +0 -134
  366. package/cjs/MultiplicityField/__stories__/WithMinAndMaxLength.js.map +0 -7
  367. package/cjs/MultiplicityField/__stories__/WithMinLength/index.js +0 -133
  368. package/cjs/MultiplicityField/__stories__/WithMinLength.js.map +0 -7
  369. package/cjs/Questions/Questions.stories/index.js +0 -45
  370. package/cjs/Questions/Questions.stories.js.map +0 -7
  371. package/cjs/Questions/__stories__/Default/index.js +0 -136
  372. package/cjs/Questions/__stories__/Default.js.map +0 -7
  373. package/cjs/inputs/AutoCompleteInput/AutoComplete.stories/index.js +0 -48
  374. package/cjs/inputs/AutoCompleteInput/AutoComplete.stories.js.map +0 -7
  375. package/cjs/inputs/AutoCompleteInput/__stories__/Default/index.js +0 -83
  376. package/cjs/inputs/AutoCompleteInput/__stories__/Default.js.map +0 -7
  377. package/cjs/inputs/AutoCompleteInput/__stories__/Multiple/index.js +0 -83
  378. package/cjs/inputs/AutoCompleteInput/__stories__/Multiple.js.map +0 -7
  379. package/cjs/inputs/Checkboxes/Checkboxes.stories/index.js +0 -51
  380. package/cjs/inputs/Checkboxes/Checkboxes.stories.js.map +0 -7
  381. package/cjs/inputs/Checkboxes/__stories__/Conditional/index.js +0 -133
  382. package/cjs/inputs/Checkboxes/__stories__/Conditional.js.map +0 -7
  383. package/cjs/inputs/Checkboxes/__stories__/Default/index.js +0 -77
  384. package/cjs/inputs/Checkboxes/__stories__/Default.js.map +0 -7
  385. package/cjs/inputs/Checkboxes/__stories__/WithDivider/index.js +0 -78
  386. package/cjs/inputs/Checkboxes/__stories__/WithDivider.js.map +0 -7
  387. package/cjs/inputs/DateInput/DateInput.stories/index.js +0 -45
  388. package/cjs/inputs/DateInput/DateInput.stories.js.map +0 -7
  389. package/cjs/inputs/DateInput/__stories__/Default/index.js +0 -61
  390. package/cjs/inputs/DateInput/__stories__/Default.js.map +0 -7
  391. package/cjs/inputs/FileInput/FileInput.stories/index.js +0 -45
  392. package/cjs/inputs/FileInput/FileInput.stories.js.map +0 -7
  393. package/cjs/inputs/FileInput/__stories__/Default/index.js +0 -61
  394. package/cjs/inputs/FileInput/__stories__/Default.js.map +0 -7
  395. package/cjs/inputs/ImageInput/ImageInput.stories/index.js +0 -51
  396. package/cjs/inputs/ImageInput/ImageInput.stories.js.map +0 -7
  397. package/cjs/inputs/ImageInput/__stories__/Default/index.js +0 -63
  398. package/cjs/inputs/ImageInput/__stories__/Default.js.map +0 -7
  399. package/cjs/inputs/ImageInput/__stories__/MaxSize/index.js +0 -69
  400. package/cjs/inputs/ImageInput/__stories__/MaxSize.js.map +0 -7
  401. package/cjs/inputs/ImageInput/__stories__/WithInvalidImageDimension/index.js +0 -72
  402. package/cjs/inputs/ImageInput/__stories__/WithInvalidImageDimension.js.map +0 -7
  403. package/cjs/inputs/ImageInput/__stories__/WithInvalidImageSize/index.js +0 -68
  404. package/cjs/inputs/ImageInput/__stories__/WithInvalidImageSize.js.map +0 -7
  405. package/cjs/inputs/Input/Input.stories/index.js +0 -72
  406. package/cjs/inputs/Input/Input.stories.js.map +0 -7
  407. package/cjs/inputs/Input/__stories__/AFM/index.js +0 -63
  408. package/cjs/inputs/Input/__stories__/AFM.js.map +0 -7
  409. package/cjs/inputs/Input/__stories__/Boolean/index.js +0 -64
  410. package/cjs/inputs/Input/__stories__/Boolean.js.map +0 -7
  411. package/cjs/inputs/Input/__stories__/IBAN/index.js +0 -64
  412. package/cjs/inputs/Input/__stories__/IBAN.js.map +0 -7
  413. package/cjs/inputs/Input/__stories__/Integer/index.js +0 -78
  414. package/cjs/inputs/Input/__stories__/Integer.js.map +0 -7
  415. package/cjs/inputs/Input/__stories__/LandlineNumber/index.js +0 -67
  416. package/cjs/inputs/Input/__stories__/LandlineNumber.js.map +0 -7
  417. package/cjs/inputs/Input/__stories__/MobilePhone/index.js +0 -67
  418. package/cjs/inputs/Input/__stories__/MobilePhone.js.map +0 -7
  419. package/cjs/inputs/Input/__stories__/PhoneNumber/index.js +0 -66
  420. package/cjs/inputs/Input/__stories__/PhoneNumber.js.map +0 -7
  421. package/cjs/inputs/Input/__stories__/PostalCode/index.js +0 -64
  422. package/cjs/inputs/Input/__stories__/PostalCode.js.map +0 -7
  423. package/cjs/inputs/Input/__stories__/String/index.js +0 -64
  424. package/cjs/inputs/Input/__stories__/String.js.map +0 -7
  425. package/cjs/inputs/Input/__stories__/TextWithLimit/index.js +0 -64
  426. package/cjs/inputs/Input/__stories__/TextWithLimit.js.map +0 -7
  427. package/cjs/inputs/Label/Label.stories/index.js +0 -45
  428. package/cjs/inputs/Label/Label.stories.js.map +0 -7
  429. package/cjs/inputs/Label/__stories__/Default/index.js +0 -72
  430. package/cjs/inputs/Label/__stories__/Default.js.map +0 -7
  431. package/cjs/inputs/OtpInput/OtpInput.stories/index.js +0 -45
  432. package/cjs/inputs/OtpInput/OtpInput.stories.js.map +0 -7
  433. package/cjs/inputs/OtpInput/__stories__/Default/index.js +0 -64
  434. package/cjs/inputs/OtpInput/__stories__/Default.js.map +0 -7
  435. package/cjs/inputs/Radio/Radio.stories/index.js +0 -51
  436. package/cjs/inputs/Radio/Radio.stories.js.map +0 -7
  437. package/cjs/inputs/Radio/__stories__/Conditional/index.js +0 -133
  438. package/cjs/inputs/Radio/__stories__/Conditional.js.map +0 -7
  439. package/cjs/inputs/Radio/__stories__/Default/index.js +0 -81
  440. package/cjs/inputs/Radio/__stories__/Default.js.map +0 -7
  441. package/cjs/inputs/Radio/__stories__/WithDivider/index.js +0 -82
  442. package/cjs/inputs/Radio/__stories__/WithDivider.js.map +0 -7
  443. package/cjs/inputs/Select/Select.stories/index.js +0 -45
  444. package/cjs/inputs/Select/Select.stories.js.map +0 -7
  445. package/cjs/inputs/Select/__stories__/Default/index.js +0 -86
  446. package/cjs/inputs/Select/__stories__/Default.js.map +0 -7
  447. package/inputs/AutoCompleteInput/AutoComplete.stories/index.js +0 -14
  448. package/inputs/AutoCompleteInput/AutoComplete.stories/package.json +0 -6
  449. package/inputs/AutoCompleteInput/AutoComplete.stories.js.map +0 -7
  450. package/inputs/AutoCompleteInput/__stories__/Default/index.js +0 -50
  451. package/inputs/AutoCompleteInput/__stories__/Default/package.json +0 -6
  452. package/inputs/AutoCompleteInput/__stories__/Default.js.map +0 -7
  453. package/inputs/AutoCompleteInput/__stories__/Multiple/index.js +0 -50
  454. package/inputs/AutoCompleteInput/__stories__/Multiple/package.json +0 -6
  455. package/inputs/AutoCompleteInput/__stories__/Multiple.js.map +0 -7
  456. package/inputs/Checkboxes/Checkboxes.stories/index.js +0 -16
  457. package/inputs/Checkboxes/Checkboxes.stories/package.json +0 -6
  458. package/inputs/Checkboxes/Checkboxes.stories.js.map +0 -7
  459. package/inputs/Checkboxes/__stories__/Conditional/index.js +0 -100
  460. package/inputs/Checkboxes/__stories__/Conditional/package.json +0 -6
  461. package/inputs/Checkboxes/__stories__/Conditional.js.map +0 -7
  462. package/inputs/Checkboxes/__stories__/Default/index.js +0 -44
  463. package/inputs/Checkboxes/__stories__/Default/package.json +0 -6
  464. package/inputs/Checkboxes/__stories__/Default.js.map +0 -7
  465. package/inputs/Checkboxes/__stories__/WithDivider/index.js +0 -45
  466. package/inputs/Checkboxes/__stories__/WithDivider/package.json +0 -6
  467. package/inputs/Checkboxes/__stories__/WithDivider.js.map +0 -7
  468. package/inputs/DateInput/DateInput.stories/index.js +0 -12
  469. package/inputs/DateInput/DateInput.stories/package.json +0 -6
  470. package/inputs/DateInput/DateInput.stories.js.map +0 -7
  471. package/inputs/DateInput/__stories__/Default/index.js +0 -28
  472. package/inputs/DateInput/__stories__/Default/package.json +0 -6
  473. package/inputs/DateInput/__stories__/Default.js.map +0 -7
  474. package/inputs/FileInput/FileInput.stories/index.js +0 -12
  475. package/inputs/FileInput/FileInput.stories/package.json +0 -6
  476. package/inputs/FileInput/FileInput.stories.js.map +0 -7
  477. package/inputs/FileInput/__stories__/Default/index.js +0 -28
  478. package/inputs/FileInput/__stories__/Default/package.json +0 -6
  479. package/inputs/FileInput/__stories__/Default.js.map +0 -7
  480. package/inputs/ImageInput/ImageInput.stories/index.js +0 -16
  481. package/inputs/ImageInput/ImageInput.stories/package.json +0 -6
  482. package/inputs/ImageInput/ImageInput.stories.js.map +0 -7
  483. package/inputs/ImageInput/__stories__/Default/index.js +0 -30
  484. package/inputs/ImageInput/__stories__/Default/package.json +0 -6
  485. package/inputs/ImageInput/__stories__/Default.js.map +0 -7
  486. package/inputs/ImageInput/__stories__/MaxSize/index.js +0 -36
  487. package/inputs/ImageInput/__stories__/MaxSize/package.json +0 -6
  488. package/inputs/ImageInput/__stories__/MaxSize.js.map +0 -7
  489. package/inputs/ImageInput/__stories__/WithInvalidImageDimension/index.js +0 -39
  490. package/inputs/ImageInput/__stories__/WithInvalidImageDimension/package.json +0 -6
  491. package/inputs/ImageInput/__stories__/WithInvalidImageDimension.js.map +0 -7
  492. package/inputs/ImageInput/__stories__/WithInvalidImageSize/index.js +0 -35
  493. package/inputs/ImageInput/__stories__/WithInvalidImageSize/package.json +0 -6
  494. package/inputs/ImageInput/__stories__/WithInvalidImageSize.d.ts +0 -3
  495. package/inputs/ImageInput/__stories__/WithInvalidImageSize.js.map +0 -7
  496. package/inputs/Input/Input.stories/index.js +0 -30
  497. package/inputs/Input/Input.stories.js.map +0 -7
  498. package/inputs/Input/__stories__/AFM/index.js +0 -30
  499. package/inputs/Input/__stories__/AFM/package.json +0 -6
  500. package/inputs/Input/__stories__/AFM.js.map +0 -7
  501. package/inputs/Input/__stories__/Boolean/index.js +0 -31
  502. package/inputs/Input/__stories__/Boolean/package.json +0 -6
  503. package/inputs/Input/__stories__/Boolean.js.map +0 -7
  504. package/inputs/Input/__stories__/IBAN/index.js +0 -31
  505. package/inputs/Input/__stories__/IBAN/package.json +0 -6
  506. package/inputs/Input/__stories__/IBAN.js.map +0 -7
  507. package/inputs/Input/__stories__/Integer/index.js +0 -45
  508. package/inputs/Input/__stories__/Integer/package.json +0 -6
  509. package/inputs/Input/__stories__/Integer.js.map +0 -7
  510. package/inputs/Input/__stories__/LandlineNumber/index.js +0 -34
  511. package/inputs/Input/__stories__/LandlineNumber/package.json +0 -6
  512. package/inputs/Input/__stories__/LandlineNumber.js.map +0 -7
  513. package/inputs/Input/__stories__/MobilePhone/index.js +0 -34
  514. package/inputs/Input/__stories__/MobilePhone/package.json +0 -6
  515. package/inputs/Input/__stories__/MobilePhone.js.map +0 -7
  516. package/inputs/Input/__stories__/PhoneNumber/index.js +0 -33
  517. package/inputs/Input/__stories__/PhoneNumber/package.json +0 -6
  518. package/inputs/Input/__stories__/PhoneNumber.js.map +0 -7
  519. package/inputs/Input/__stories__/PostalCode/index.js +0 -31
  520. package/inputs/Input/__stories__/PostalCode/package.json +0 -6
  521. package/inputs/Input/__stories__/PostalCode.js.map +0 -7
  522. package/inputs/Input/__stories__/String/index.js +0 -31
  523. package/inputs/Input/__stories__/String/package.json +0 -6
  524. package/inputs/Input/__stories__/String.js.map +0 -7
  525. package/inputs/Input/__stories__/TextWithLimit/index.js +0 -31
  526. package/inputs/Input/__stories__/TextWithLimit/package.json +0 -6
  527. package/inputs/Input/__stories__/TextWithLimit.js.map +0 -7
  528. package/inputs/Label/Label.stories/index.js +0 -12
  529. package/inputs/Label/Label.stories/package.json +0 -6
  530. package/inputs/Label/Label.stories.js.map +0 -7
  531. package/inputs/Label/__stories__/Default/index.js +0 -39
  532. package/inputs/Label/__stories__/Default/package.json +0 -6
  533. package/inputs/Label/__stories__/Default.js.map +0 -7
  534. package/inputs/OtpInput/OtpInput.stories/index.js +0 -12
  535. package/inputs/OtpInput/OtpInput.stories/package.json +0 -6
  536. package/inputs/OtpInput/OtpInput.stories.js.map +0 -7
  537. package/inputs/OtpInput/__stories__/Default/index.js +0 -31
  538. package/inputs/OtpInput/__stories__/Default/package.json +0 -6
  539. package/inputs/OtpInput/__stories__/Default.js.map +0 -7
  540. package/inputs/Radio/Radio.stories/index.js +0 -16
  541. package/inputs/Radio/Radio.stories/package.json +0 -6
  542. package/inputs/Radio/Radio.stories.js.map +0 -7
  543. package/inputs/Radio/__stories__/Conditional/index.js +0 -100
  544. package/inputs/Radio/__stories__/Conditional/package.json +0 -6
  545. package/inputs/Radio/__stories__/Conditional.js.map +0 -7
  546. package/inputs/Radio/__stories__/Default/index.js +0 -48
  547. package/inputs/Radio/__stories__/Default/package.json +0 -6
  548. package/inputs/Radio/__stories__/Default.js.map +0 -7
  549. package/inputs/Radio/__stories__/WithDivider/index.js +0 -49
  550. package/inputs/Radio/__stories__/WithDivider/package.json +0 -6
  551. package/inputs/Radio/__stories__/WithDivider.js.map +0 -7
  552. package/inputs/Select/Select.stories/index.js +0 -12
  553. package/inputs/Select/Select.stories/package.json +0 -6
  554. package/inputs/Select/Select.stories.js.map +0 -7
  555. package/inputs/Select/__stories__/Default/index.js +0 -53
  556. package/inputs/Select/__stories__/Default/package.json +0 -6
  557. package/inputs/Select/__stories__/Default.js.map +0 -7
  558. package/lazy.d.ts +0 -81
  559. package/lazy.js.map +0 -7
  560. package/registry.d.ts +0 -71
  561. package/registry.js.map +0 -7
  562. package/src/inputs/ImageInput/__stories__/WithInvalidImageSize.tsx +0 -36
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/Field/index.tsx"],
4
- "sourcesContent": ["import React, { useMemo } from 'react';\nimport { FieldBase } from '@digigov/form/Field/FieldBase';\nimport FieldConditional from '@digigov/form/Field/FieldConditional';\nimport {\n FieldWithCondition,\n CalculatedField,\n FieldProps,\n} from '@digigov/form/Field/types';\nimport {\n FIELD_COMPONENTS,\n ALTERNATIVE_COMPONENTS,\n} from '@digigov/form/Field/utils';\nimport { calculateField } from '@digigov/form/Field/utils/calculateField';\nimport { useField } from '@digigov/form/Field/utils/useField';\nimport FieldArray from '@digigov/form/FieldArray';\nimport Multiplicity from '@digigov/form/MultiplicityField';\nexport const Field: React.FC<FieldProps> = ({\n name,\n disabled,\n children,\n ...customField\n}) => {\n const {\n field,\n control,\n register,\n reset,\n error,\n componentRegistry,\n formState,\n setValue,\n getValues,\n unregister,\n trigger,\n clearErrors,\n } = useField(name, customField?.type ? customField : null);\n const calculatedField: CalculatedField = useMemo(\n () =>\n calculateField(\n children,\n field,\n {\n ...FIELD_COMPONENTS,\n ...componentRegistry,\n },\n ALTERNATIVE_COMPONENTS\n ),\n [field]\n );\n\n if (calculatedField.condition) {\n return (\n <FieldConditional\n control={control}\n reset={reset}\n register={register}\n field={calculatedField as FieldWithCondition}\n error={error}\n Field={Field}\n />\n );\n }\n if (calculatedField.type === 'array' && !calculatedField.multiplicity) {\n calculatedField.name = name;\n return (\n <FieldArray\n control={control}\n register={register}\n error={error}\n formState={formState}\n Field={Field}\n {...calculatedField}\n />\n );\n }\n if (\n calculatedField.type === 'array' &&\n calculatedField.multiplicity === true\n ) {\n calculatedField.name = name;\n return (\n <Multiplicity\n control={control}\n register={register}\n trigger={trigger}\n clearErrors={clearErrors}\n error={error}\n formState={formState}\n setValue={setValue}\n getValues={getValues}\n unregister={unregister}\n Field={Field}\n {...calculatedField}\n />\n );\n }\n return (\n <FieldBase\n {...calculatedField}\n name={name}\n disabled={disabled}\n control={control}\n register={register}\n reset={reset}\n error={error}\n Field={Field}\n />\n );\n};\n\nexport default Field;\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA+B;AAC/B,uBAA0B;AAC1B,8BAA6B;AAM7B,mBAGO;AACP,4BAA+B;AAC/B,sBAAyB;AACzB,wBAAuB;AACvB,+BAAyB;AAClB,MAAM,QAA8B,CAAC;AAAA,EAC1C;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAM;AACJ,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,QAAI,0BAAS,MAAM,aAAa,OAAO,cAAc,IAAI;AACzD,QAAM,sBAAmC;AAAA,IACvC,UACE;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,QACE,GAAG;AAAA,QACH,GAAG;AAAA,MACL;AAAA,MACA;AAAA,IACF;AAAA,IACF,CAAC,KAAK;AAAA,EACR;AAEA,MAAI,gBAAgB,WAAW;AAC7B,WACE,6BAAAA,QAAA;AAAA,MAAC,wBAAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA;AAAA,QACA;AAAA,QACA,OAAO;AAAA,QACP;AAAA,QACA;AAAA;AAAA,IACF;AAAA,EAEJ;AACA,MAAI,gBAAgB,SAAS,WAAW,CAAC,gBAAgB,cAAc;AACrE,oBAAgB,OAAO;AACvB,WACE,6BAAAD,QAAA;AAAA,MAAC,kBAAAE;AAAA,MAAA;AAAA,QACC;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACC,GAAG;AAAA;AAAA,IACN;AAAA,EAEJ;AACA,MACE,gBAAgB,SAAS,WACzB,gBAAgB,iBAAiB,MACjC;AACA,oBAAgB,OAAO;AACvB,WACE,6BAAAF,QAAA;AAAA,MAAC,yBAAAG;AAAA,MAAA;AAAA,QACC;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACC,GAAG;AAAA;AAAA,IACN;AAAA,EAEJ;AACA,SACE,6BAAAH,QAAA;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAAA,EACF;AAEJ;AAEA,IAAO,gBAAQ;",
4
+ "sourcesContent": ["import React, { useMemo } from 'react';\nimport { FieldBase } from '@digigov/form/Field/FieldBase';\nimport FieldConditional from '@digigov/form/Field/FieldConditional';\nimport {\n FieldWithCondition,\n CalculatedField,\n FieldProps,\n} from '@digigov/form/Field/types';\nimport {\n FIELD_COMPONENTS,\n ALTERNATIVE_COMPONENTS,\n} from '@digigov/form/Field/utils';\nimport { calculateField } from '@digigov/form/Field/utils/calculateField';\nimport { useField } from '@digigov/form/Field/utils/useField';\nimport FieldArray from '@digigov/form/FieldArray';\nimport Multiplicity from '@digigov/form/MultiplicityField';\nexport const Field: React.FC<FieldProps> = ({\n name,\n children,\n ...customField\n}) => {\n const {\n field,\n control,\n register,\n reset,\n resetField,\n error,\n componentRegistry,\n formState,\n setValue,\n getValues,\n unregister,\n trigger,\n clearErrors,\n } = useField(name, customField?.type ? customField : null);\n const calculatedField: CalculatedField = useMemo(\n () =>\n calculateField(\n children,\n field,\n {\n ...FIELD_COMPONENTS,\n ...componentRegistry,\n },\n ALTERNATIVE_COMPONENTS\n ),\n [field]\n );\n if (calculatedField.condition) {\n return (\n <FieldConditional\n control={control}\n reset={reset}\n resetField={resetField}\n register={register}\n field={calculatedField as FieldWithCondition}\n error={error}\n Field={Field}\n />\n );\n }\n if (calculatedField.type === 'array' && !calculatedField.multiplicity) {\n calculatedField.name = name;\n return (\n <FieldArray\n control={control}\n trigger={trigger}\n register={register}\n clearErrors={clearErrors}\n error={\n formState.isSubmitted && !formState.isSubmitting ? error : undefined\n }\n getValues={getValues}\n setValue={setValue}\n formState={formState}\n Field={Field}\n reset={reset}\n resetField={resetField}\n {...calculatedField}\n />\n );\n }\n if (\n calculatedField.type === 'array' &&\n calculatedField.multiplicity === true\n ) {\n calculatedField.name = name;\n return (\n <Multiplicity\n control={control}\n register={register}\n trigger={trigger}\n clearErrors={clearErrors}\n error={error}\n formState={formState}\n setValue={setValue}\n getValues={getValues}\n unregister={unregister}\n Field={Field}\n {...calculatedField}\n />\n );\n }\n const editable =\n customField.editable === false || customField.disabled === true\n ? false\n : true;\n const customError = error ? error : formState?.errors[name];\n return (\n <FieldBase\n {...calculatedField}\n editable={editable}\n name={name}\n control={control}\n register={register}\n reset={reset}\n resetField={resetField}\n error={customError}\n Field={Field}\n />\n );\n};\n\nexport default Field;\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA+B;AAC/B,uBAA0B;AAC1B,8BAA6B;AAM7B,mBAGO;AACP,4BAA+B;AAC/B,sBAAyB;AACzB,wBAAuB;AACvB,+BAAyB;AAClB,MAAM,QAA8B,CAAC;AAAA,EAC1C;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAM;AACJ,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,QAAI,0BAAS,MAAM,aAAa,OAAO,cAAc,IAAI;AACzD,QAAM,sBAAmC;AAAA,IACvC,UACE;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,QACE,GAAG;AAAA,QACH,GAAG;AAAA,MACL;AAAA,MACA;AAAA,IACF;AAAA,IACF,CAAC,KAAK;AAAA,EACR;AACA,MAAI,gBAAgB,WAAW;AAC7B,WACE,6BAAAA,QAAA;AAAA,MAAC,wBAAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA,OAAO;AAAA,QACP;AAAA,QACA;AAAA;AAAA,IACF;AAAA,EAEJ;AACA,MAAI,gBAAgB,SAAS,WAAW,CAAC,gBAAgB,cAAc;AACrE,oBAAgB,OAAO;AACvB,WACE,6BAAAD,QAAA;AAAA,MAAC,kBAAAE;AAAA,MAAA;AAAA,QACC;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA,OACE,UAAU,eAAe,CAAC,UAAU,eAAe,QAAQ;AAAA,QAE7D;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACC,GAAG;AAAA;AAAA,IACN;AAAA,EAEJ;AACA,MACE,gBAAgB,SAAS,WACzB,gBAAgB,iBAAiB,MACjC;AACA,oBAAgB,OAAO;AACvB,WACE,6BAAAF,QAAA;AAAA,MAAC,yBAAAG;AAAA,MAAA;AAAA,QACC;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACC,GAAG;AAAA;AAAA,IACN;AAAA,EAEJ;AACA,QAAM,WACJ,YAAY,aAAa,SAAS,YAAY,aAAa,OACvD,QACA;AACN,QAAM,cAAc,QAAQ,QAAQ,WAAW,OAAO,IAAI;AAC1D,SACE,6BAAAH,QAAA;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,OAAO;AAAA,MACP;AAAA;AAAA,EACF;AAEJ;AAEA,IAAO,gBAAQ;",
6
6
  "names": ["React", "FieldConditional", "FieldArray", "Multiplicity"]
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/Field/types.tsx"],
4
- "sourcesContent": ["import React from 'react';\nimport { ErrorOption, UseFormReturn, UseFormProps } from 'react-hook-form';\nimport { ValidatorSchema } from '@digigov/form/validators/types';\nimport { GridProps } from '@digigov/ui/layouts/Grid';\n\nexport type FieldLabelProps = {\n primary?: string;\n secondary?: string;\n hint?: string;\n};\n\nexport interface FieldSpec {\n key: string; // !TODO rename key to name;\n type?:\n | 'int'\n | 'string'\n | 'text'\n | 'boolean'\n | 'email'\n | 'uuid4'\n | 'choice:multiple'\n | 'choice:single'\n | 'mobile_phone'\n | 'date'\n | 'otp'\n | 'afm'\n | 'iban'\n | 'file'\n | 'image'\n | 'postal_code'\n | 'phone_number'\n | 'array'\n | 'object';\n component?: any;\n maxLength?: number;\n condition?: Record<string, FieldCondition>;\n controlled?: boolean;\n label?: FieldLabelProps;\n extra?: {\n [key: string]: any;\n };\n editable?: boolean;\n required?: boolean;\n enabled?: boolean;\n disabled?: boolean;\n layout?: Record<\n string,\n | GridProps['xs']\n | GridProps['sm']\n | GridProps['md']\n | GridProps['lg']\n | GridProps['xl']\n >;\n validators?: ValidatorSchema[];\n wrapper?: 'label' | 'fieldset';\n maxWidth?: string;\n maxHeight?: string;\n width?: string;\n}\n\nexport interface FieldCondition {\n is: string | string[] | number | number[] | boolean | boolean[];\n then?: Partial<FieldSpec>;\n else?: Partial<FieldSpec>;\n}\nexport interface ChildFieldMemoProps extends FieldConditionalProps {\n dependencies: FormData;\n}\nexport type FormData = UseFormProps['defaultValues'];\n\nexport interface FieldWithCondition extends Omit<CalculatedField, 'condition'> {\n condition: Record<string, FieldCondition>;\n}\n\nexport interface FieldConditionalProps {\n field: FieldWithCondition;\n control: UseFormReturn['control'];\n register: UseFormReturn['register'];\n reset: UseFormReturn['reset'];\n error?: ErrorOption;\n Field: React.FC<FieldProps>;\n}\n\nexport type FieldComponentItem = {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n component: any;\n controlled?: boolean;\n wrapper?: FieldSpec['wrapper'];\n};\n\nexport interface FieldContainerProps {\n name?: FieldSpec['key'];\n layout?: FieldSpec['layout'];\n label?: FieldSpec['label'];\n error?: ErrorOption | Record<string, any>;\n children?: React.ReactNode;\n wrapper?: FieldSpec['wrapper'];\n}\n\nexport type FieldComponentRegistry = Record<string, FieldComponentItem>;\n\nexport type OmittedFieldSpec = Omit<FieldSpec, 'component'>;\n\nexport type UnknownValue = never | never[];\n\nexport interface ControlledFieldProps {\n type?: string;\n value: UnknownValue;\n onChange: (v: UnknownValue) => void;\n defaultValue?: UnknownValue;\n onBlur?: (e: Event) => void;\n extra?: never;\n error?: boolean;\n name?: string;\n disabled?: boolean;\n Field: React.FC<FieldProps>;\n}\n\nexport interface UncontrolledFieldProps {\n name: string;\n register: FieldBaseProps['register'];\n control?: FieldBaseProps['control'];\n error?: boolean;\n extra?: Record<string, never>;\n type?: string;\n disabled?: boolean;\n Field: React.FC<FieldProps>;\n}\n\nexport interface CalculatedField extends OmittedFieldSpec {\n name: string;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n component: any;\n defaultValue?: never;\n error?: ErrorOption;\n wrapper?: FieldComponentItem['wrapper'];\n multiplicity?: boolean;\n}\n\nexport interface FieldBaseProps extends CalculatedField {\n control: UseFormReturn['control'];\n register: UseFormReturn['register'];\n reset: UseFormReturn['reset'];\n Field: React.FC<FieldProps>;\n}\n\nexport interface FieldProps extends FieldSpec {\n name: string;\n children?: React.ReactNode;\n}\n\nexport interface UseFieldProps {\n field: FieldSpec;\n control: FieldBaseProps['control'];\n register: FieldBaseProps['register'];\n reset: FieldBaseProps['reset'];\n watch: UseFormReturn['watch'];\n formState: UseFormReturn['formState'];\n getFieldState: UseFormReturn['getFieldState'];\n setValue: UseFormReturn['setValue'];\n getValues: UseFormReturn['getValues'];\n unregister: UseFormReturn['unregister'];\n trigger: UseFormReturn['trigger'];\n clearErrors: UseFormReturn['clearErrors'];\n error?: ErrorOption;\n componentRegistry?: FieldComponentRegistry;\n}\n"],
4
+ "sourcesContent": ["import React from 'react';\nimport { ErrorOption, UseFormReturn, UseFormProps } from 'react-hook-form';\nimport { ValidatorSchema } from '@digigov/form/validators/types';\nimport { FieldsetLegendProps } from '@digigov/ui/form/FieldContainer';\nimport { GridProps } from '@digigov/ui/layouts/Grid';\n\nexport interface FieldLabelProps {\n primary?: string;\n secondary?: string;\n hint?: string;\n}\n\nexport interface FieldSpec {\n key: string; // !TODO rename key to name;\n type?:\n | 'int'\n | 'string'\n | 'text'\n | 'boolean'\n | 'email'\n | 'uuid4'\n | 'choice:multiple'\n | 'choice:single'\n | 'mobile_phone'\n | 'date'\n | 'datetime'\n | 'otp'\n | 'afm'\n | 'amka'\n | 'iban'\n | 'file'\n | 'image'\n | 'postal_code'\n | 'phone_number'\n | 'array'\n | 'object';\n trim?: boolean;\n component?: any;\n autoComplete?: string;\n placeholder?: string;\n maxLength?: number;\n condition?: Record<string, FieldCondition>;\n controlled?: boolean;\n label?: FieldLabelProps;\n extra?: Record<string, any>;\n editable?: boolean;\n variant?: 'inline' | 'dialog';\n required?: boolean;\n enabled?: boolean;\n disabled?: boolean; // TODO: keep disabled or editable\n layout?: Record<\n string,\n | GridProps['xs']\n | GridProps['sm']\n | GridProps['md']\n | GridProps['lg']\n | GridProps['xl']\n >;\n validators?: ValidatorSchema[];\n wrapper?: 'label' | 'fieldset';\n maxWidth?: string;\n maxHeight?: string;\n width?: string;\n}\n\nexport interface FieldCondition {\n is: string | string[] | number | number[] | boolean | boolean[];\n then?: Partial<FieldSpec>;\n else?: Partial<FieldSpec>;\n}\nexport interface ChildFieldMemoProps extends FieldConditionalProps {\n dependencies: FormData;\n}\nexport type FormData = UseFormProps['defaultValues'];\n\nexport interface FieldWithCondition extends Omit<CalculatedField, 'condition'> {\n condition: Record<string, FieldCondition>;\n}\n\nexport interface FieldConditionalProps {\n field: FieldWithCondition;\n control: UseFormReturn['control'];\n register: UseFormReturn['register'];\n reset: UseFormReturn['reset'];\n resetField: UseFormReturn['resetField'];\n error?: ErrorOption;\n Field: React.FC<FieldProps>;\n}\n\nexport interface FieldComponentItem {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n component: any;\n controlled?: boolean;\n wrapper?: FieldSpec['wrapper'];\n}\n\nexport interface FieldContainerProps {\n name?: FieldSpec['key'];\n register: FieldBaseProps['register'];\n layout?: FieldSpec['layout'];\n label?: FieldSpec['label'];\n error?: ErrorOption | Record<string, any>;\n hasError?: boolean;\n children?: React.ReactNode;\n controlled?: boolean;\n wrapper?: FieldSpec['wrapper'];\n labelSize?: FieldsetLegendProps['size'];\n}\n\nexport type FieldComponentRegistry = Record<string, FieldComponentItem>;\n\nexport type OmittedFieldSpec = Omit<FieldSpec, 'component'>;\n\nexport type UnknownValue = never | never[];\n\nexport interface ControlledFieldProps {\n type?: string;\n value: UnknownValue;\n onChange: (v: UnknownValue) => void;\n defaultValue?: UnknownValue;\n onBlur?: (e: Event) => void;\n extra?: never;\n error?: boolean;\n name?: string;\n disabled?: boolean;\n Field?: React.FC<FieldProps>;\n}\n\nexport interface UncontrolledFieldProps {\n name: string;\n register: FieldBaseProps['register'];\n control?: FieldBaseProps['control'];\n error?: boolean;\n extra?: Record<string, never>;\n type?: string;\n disabled?: boolean;\n Field: React.FC<FieldProps>;\n}\n\nexport interface CalculatedField extends OmittedFieldSpec {\n name: string;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n component: any;\n defaultValue?: never;\n error?: ErrorOption;\n wrapper?: FieldComponentItem['wrapper'];\n multiplicity?: boolean;\n}\n\nexport interface FieldBaseProps extends CalculatedField {\n control: UseFormReturn['control'];\n register: UseFormReturn['register'];\n reset: UseFormReturn['reset'];\n resetField: UseFormReturn['resetField'];\n Field?: React.FC<FieldProps>;\n}\n\nexport interface FieldProps extends FieldSpec {\n name: string;\n children?: React.ReactNode;\n}\n\nexport interface UseFieldProps {\n field: FieldSpec;\n control: FieldBaseProps['control'];\n register: FieldBaseProps['register'];\n reset: FieldBaseProps['reset'];\n resetField: FieldBaseProps['resetField'];\n watch: UseFormReturn['watch'];\n formState: UseFormReturn['formState'];\n getFieldState: UseFormReturn['getFieldState'];\n setValue: UseFormReturn['setValue'];\n getValues: UseFormReturn['getValues'];\n unregister: UseFormReturn['unregister'];\n trigger: UseFormReturn['trigger'];\n clearErrors: UseFormReturn['clearErrors'];\n error?: ErrorOption;\n componentRegistry?: FieldComponentRegistry;\n}\n"],
5
5
  "mappings": ";;;;;;;;;;;;;AAAA;AAAA;",
6
6
  "names": []
7
7
  }
@@ -35,6 +35,7 @@ module.exports = __toCommonJS(utils_exports);
35
35
  var import_AutoCompleteInput = __toESM(require("@digigov/form/inputs/AutoCompleteInput"));
36
36
  var import_Checkboxes = __toESM(require("@digigov/form/inputs/Checkboxes"));
37
37
  var import_DateInput = __toESM(require("@digigov/form/inputs/DateInput"));
38
+ var import_DateTimeInput = __toESM(require("@digigov/form/inputs/DateTimeInput"));
38
39
  var import_FileInput = __toESM(require("@digigov/form/inputs/FileInput"));
39
40
  var import_ImageInput = __toESM(require("@digigov/form/inputs/ImageInput"));
40
41
  var import_Input = __toESM(require("@digigov/form/inputs/Input"));
@@ -50,7 +51,8 @@ const FIELD_COMPONENTS = {
50
51
  },
51
52
  file: {
52
53
  wrapper: "fieldset",
53
- component: import_FileInput.default
54
+ component: import_FileInput.default,
55
+ controlled: true
54
56
  },
55
57
  image: {
56
58
  wrapper: "fieldset",
@@ -61,6 +63,11 @@ const FIELD_COMPONENTS = {
61
63
  controlled: true,
62
64
  component: import_DateInput.default
63
65
  },
66
+ datetime: {
67
+ wrapper: "fieldset",
68
+ controlled: true,
69
+ component: import_DateTimeInput.default
70
+ },
64
71
  otp: {
65
72
  wrapper: "fieldset",
66
73
  controlled: true,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/Field/utils/index.ts"],
4
- "sourcesContent": ["import { FieldComponentRegistry } from '@digigov/form/Field/types';\nimport AutoCompleteInput from '@digigov/form/inputs/AutoCompleteInput';\nimport Checkboxes from '@digigov/form/inputs/Checkboxes';\nimport DateInput from '@digigov/form/inputs/DateInput';\nimport FileInput from '@digigov/form/inputs/FileInput';\nimport ImageInput from '@digigov/form/inputs/ImageInput';\nimport Input from '@digigov/form/inputs/Input';\nimport OtpInput from '@digigov/form/inputs/OtpInput';\nimport Radio, { ControlledRadioButtonsGroup } from '@digigov/form/inputs/Radio';\nimport Select from '@digigov/form/inputs/Select';\n\nexport const FIELD_COMPONENTS: FieldComponentRegistry = {\n text: {\n component: Input,\n },\n string: {\n component: Input,\n },\n file: {\n wrapper: 'fieldset',\n component: FileInput,\n },\n image: {\n wrapper: 'fieldset',\n component: ImageInput,\n },\n date: {\n wrapper: 'fieldset',\n controlled: true,\n component: DateInput,\n },\n otp: {\n wrapper: 'fieldset',\n controlled: true,\n component: OtpInput,\n },\n 'choice:multiple': {\n wrapper: 'fieldset',\n controlled: true,\n component: Checkboxes,\n },\n 'choice:single': {\n wrapper: 'fieldset',\n controlled: false,\n component: Radio,\n },\n};\n\nexport const ALTERNATIVE_COMPONENTS: FieldComponentRegistry = {\n Select: {\n component: Select,\n controlled: false,\n },\n AutoComplete: {\n component: AutoCompleteInput,\n controlled: true,\n wrapper: 'fieldset',\n },\n};\n\nexport const CONTROLLED_FIELD_COMPONENTS: FieldComponentRegistry = {\n ...FIELD_COMPONENTS,\n 'choice:single': {\n wrapper: 'fieldset',\n controlled: true,\n component: ControlledRadioButtonsGroup,\n },\n text: {\n component: Input,\n controlled: true,\n },\n string: {\n component: Input,\n controlled: true,\n },\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,+BAA8B;AAC9B,wBAAuB;AACvB,uBAAsB;AACtB,uBAAsB;AACtB,wBAAuB;AACvB,mBAAkB;AAClB,sBAAqB;AACrB,mBAAmD;AACnD,oBAAmB;AAEZ,MAAM,mBAA2C;AAAA,EACtD,MAAM;AAAA,IACJ,WAAW,aAAAA;AAAA,EACb;AAAA,EACA,QAAQ;AAAA,IACN,WAAW,aAAAA;AAAA,EACb;AAAA,EACA,MAAM;AAAA,IACJ,SAAS;AAAA,IACT,WAAW,iBAAAC;AAAA,EACb;AAAA,EACA,OAAO;AAAA,IACL,SAAS;AAAA,IACT,WAAW,kBAAAC;AAAA,EACb;AAAA,EACA,MAAM;AAAA,IACJ,SAAS;AAAA,IACT,YAAY;AAAA,IACZ,WAAW,iBAAAC;AAAA,EACb;AAAA,EACA,KAAK;AAAA,IACH,SAAS;AAAA,IACT,YAAY;AAAA,IACZ,WAAW,gBAAAC;AAAA,EACb;AAAA,EACA,mBAAmB;AAAA,IACjB,SAAS;AAAA,IACT,YAAY;AAAA,IACZ,WAAW,kBAAAC;AAAA,EACb;AAAA,EACA,iBAAiB;AAAA,IACf,SAAS;AAAA,IACT,YAAY;AAAA,IACZ,WAAW,aAAAC;AAAA,EACb;AACF;AAEO,MAAM,yBAAiD;AAAA,EAC5D,QAAQ;AAAA,IACN,WAAW,cAAAC;AAAA,IACX,YAAY;AAAA,EACd;AAAA,EACA,cAAc;AAAA,IACZ,WAAW,yBAAAC;AAAA,IACX,YAAY;AAAA,IACZ,SAAS;AAAA,EACX;AACF;AAEO,MAAM,8BAAsD;AAAA,EACjE,GAAG;AAAA,EACH,iBAAiB;AAAA,IACf,SAAS;AAAA,IACT,YAAY;AAAA,IACZ,WAAW;AAAA,EACb;AAAA,EACA,MAAM;AAAA,IACJ,WAAW,aAAAR;AAAA,IACX,YAAY;AAAA,EACd;AAAA,EACA,QAAQ;AAAA,IACN,WAAW,aAAAA;AAAA,IACX,YAAY;AAAA,EACd;AACF;",
6
- "names": ["Input", "FileInput", "ImageInput", "DateInput", "OtpInput", "Checkboxes", "Radio", "Select", "AutoCompleteInput"]
4
+ "sourcesContent": ["import { FieldComponentRegistry } from '@digigov/form/Field/types';\nimport AutoCompleteInput from '@digigov/form/inputs/AutoCompleteInput';\nimport Checkboxes from '@digigov/form/inputs/Checkboxes';\nimport DateInput from '@digigov/form/inputs/DateInput';\nimport DateTimeInput from '@digigov/form/inputs/DateTimeInput';\nimport FileInput from '@digigov/form/inputs/FileInput';\nimport ImageInput from '@digigov/form/inputs/ImageInput';\nimport Input from '@digigov/form/inputs/Input';\nimport OtpInput from '@digigov/form/inputs/OtpInput';\nimport Radio, { ControlledRadioButtonsGroup } from '@digigov/form/inputs/Radio';\nimport Select from '@digigov/form/inputs/Select';\n\nexport const FIELD_COMPONENTS: FieldComponentRegistry = {\n text: {\n component: Input,\n },\n string: {\n component: Input,\n },\n file: {\n wrapper: 'fieldset',\n component: FileInput,\n controlled: true,\n },\n image: {\n wrapper: 'fieldset',\n component: ImageInput,\n },\n date: {\n wrapper: 'fieldset',\n controlled: true,\n component: DateInput,\n },\n datetime: {\n wrapper: 'fieldset',\n controlled: true,\n component: DateTimeInput,\n },\n otp: {\n wrapper: 'fieldset',\n controlled: true,\n component: OtpInput,\n },\n 'choice:multiple': {\n wrapper: 'fieldset',\n controlled: true,\n component: Checkboxes,\n },\n 'choice:single': {\n wrapper: 'fieldset',\n controlled: false,\n component: Radio,\n },\n};\n\nexport const ALTERNATIVE_COMPONENTS: FieldComponentRegistry = {\n Select: {\n component: Select,\n controlled: false,\n },\n AutoComplete: {\n component: AutoCompleteInput,\n controlled: true,\n wrapper: 'fieldset',\n },\n};\n\nexport const CONTROLLED_FIELD_COMPONENTS: FieldComponentRegistry = {\n ...FIELD_COMPONENTS,\n 'choice:single': {\n wrapper: 'fieldset',\n controlled: true,\n component: ControlledRadioButtonsGroup,\n },\n text: {\n component: Input,\n controlled: true,\n },\n string: {\n component: Input,\n controlled: true,\n },\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,+BAA8B;AAC9B,wBAAuB;AACvB,uBAAsB;AACtB,2BAA0B;AAC1B,uBAAsB;AACtB,wBAAuB;AACvB,mBAAkB;AAClB,sBAAqB;AACrB,mBAAmD;AACnD,oBAAmB;AAEZ,MAAM,mBAA2C;AAAA,EACtD,MAAM;AAAA,IACJ,WAAW,aAAAA;AAAA,EACb;AAAA,EACA,QAAQ;AAAA,IACN,WAAW,aAAAA;AAAA,EACb;AAAA,EACA,MAAM;AAAA,IACJ,SAAS;AAAA,IACT,WAAW,iBAAAC;AAAA,IACX,YAAY;AAAA,EACd;AAAA,EACA,OAAO;AAAA,IACL,SAAS;AAAA,IACT,WAAW,kBAAAC;AAAA,EACb;AAAA,EACA,MAAM;AAAA,IACJ,SAAS;AAAA,IACT,YAAY;AAAA,IACZ,WAAW,iBAAAC;AAAA,EACb;AAAA,EACA,UAAU;AAAA,IACR,SAAS;AAAA,IACT,YAAY;AAAA,IACZ,WAAW,qBAAAC;AAAA,EACb;AAAA,EACA,KAAK;AAAA,IACH,SAAS;AAAA,IACT,YAAY;AAAA,IACZ,WAAW,gBAAAC;AAAA,EACb;AAAA,EACA,mBAAmB;AAAA,IACjB,SAAS;AAAA,IACT,YAAY;AAAA,IACZ,WAAW,kBAAAC;AAAA,EACb;AAAA,EACA,iBAAiB;AAAA,IACf,SAAS;AAAA,IACT,YAAY;AAAA,IACZ,WAAW,aAAAC;AAAA,EACb;AACF;AAEO,MAAM,yBAAiD;AAAA,EAC5D,QAAQ;AAAA,IACN,WAAW,cAAAC;AAAA,IACX,YAAY;AAAA,EACd;AAAA,EACA,cAAc;AAAA,IACZ,WAAW,yBAAAC;AAAA,IACX,YAAY;AAAA,IACZ,SAAS;AAAA,EACX;AACF;AAEO,MAAM,8BAAsD;AAAA,EACjE,GAAG;AAAA,EACH,iBAAiB;AAAA,IACf,SAAS;AAAA,IACT,YAAY;AAAA,IACZ,WAAW;AAAA,EACb;AAAA,EACA,MAAM;AAAA,IACJ,WAAW,aAAAT;AAAA,IACX,YAAY;AAAA,EACd;AAAA,EACA,QAAQ;AAAA,IACN,WAAW,aAAAA;AAAA,IACX,YAAY;AAAA,EACd;AACF;",
6
+ "names": ["Input", "FileInput", "ImageInput", "DateInput", "DateTimeInput", "OtpInput", "Checkboxes", "Radio", "Select", "AutoCompleteInput"]
7
7
  }
@@ -28,6 +28,7 @@ const useField = (name, customField) => {
28
28
  control,
29
29
  register,
30
30
  reset,
31
+ resetField,
31
32
  trigger,
32
33
  clearErrors,
33
34
  errors,
@@ -46,6 +47,17 @@ const useField = (name, customField) => {
46
47
  https://devs.pages.grnet.gr/digigov/digigov-sdk/sdk-docs/forms/create-simple-form/
47
48
  `);
48
49
  }
50
+ let error = errors[name];
51
+ const nameIndexRegex = name.match(/^\[*(.*?)\.(\d+)\]*$/);
52
+ if (nameIndexRegex) {
53
+ const [, fieldArrayName, indexStr] = nameIndexRegex;
54
+ error = errors[fieldArrayName]?.[Number(indexStr)];
55
+ }
56
+ const nestedNameIndexRegex = name.match(/^\[*(.*?)\.(\d+)\.(.*?)\]*$/);
57
+ if (nestedNameIndexRegex) {
58
+ const [, fieldArrayName, indexStr, fieldItemName] = nestedNameIndexRegex;
59
+ error = errors[fieldArrayName]?.[Number(indexStr)]?.[fieldItemName];
60
+ }
49
61
  (0, import_react.useMemo)(
50
62
  () => customField?.type && registerField({ ...customField, key: name }),
51
63
  [customField, name, registerField]
@@ -55,6 +67,7 @@ const useField = (name, customField) => {
55
67
  control,
56
68
  register,
57
69
  reset,
70
+ resetField,
58
71
  trigger,
59
72
  watch,
60
73
  componentRegistry,
@@ -64,7 +77,7 @@ const useField = (name, customField) => {
64
77
  getValues,
65
78
  unregister,
66
79
  formState,
67
- error: errors[name]
80
+ error
68
81
  };
69
82
  };
70
83
  // Annotate the CommonJS export names for ESM import in node:
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/Field/utils/useField.ts"],
4
- "sourcesContent": ["import { useContext, useMemo } from 'react';\nimport { FieldSpec, UseFieldProps } from '@digigov/form/Field/types';\nimport { FormContext } from '@digigov/form/FormContext';\n\nexport const useField = (\n name: string,\n customField: FieldSpec | null\n): UseFieldProps => {\n const {\n fieldsMap,\n control,\n register,\n reset,\n trigger,\n clearErrors,\n errors,\n registerField,\n watch,\n componentRegistry,\n getFieldState,\n setValue,\n getValues,\n unregister,\n formState,\n } = useContext(FormContext);\n\n if (!registerField) {\n throw new Error(`\n You can't use the Field component without wrapping it in FormBuilder.\n https://devs.pages.grnet.gr/digigov/digigov-sdk/sdk-docs/forms/create-simple-form/\n `);\n }\n\n useMemo(\n () => customField?.type && registerField({ ...customField, key: name }),\n [customField, name, registerField]\n );\n return {\n field: customField || fieldsMap[name],\n control,\n register,\n reset,\n trigger,\n watch,\n componentRegistry,\n getFieldState,\n setValue,\n clearErrors,\n getValues,\n unregister,\n formState,\n error: errors[name],\n };\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAoC;AAEpC,yBAA4B;AAErB,MAAM,WAAW,CACtB,MACA,gBACkB;AAClB,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,QAAI,yBAAW,8BAAW;AAE1B,MAAI,CAAC,eAAe;AAClB,UAAM,IAAI,MAAM;AAAA;AAAA;AAAA,KAGf;AAAA,EACH;AAEA;AAAA,IACE,MAAM,aAAa,QAAQ,cAAc,EAAE,GAAG,aAAa,KAAK,KAAK,CAAC;AAAA,IACtE,CAAC,aAAa,MAAM,aAAa;AAAA,EACnC;AACA,SAAO;AAAA,IACL,OAAO,eAAe,UAAU,IAAI;AAAA,IACpC;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,OAAO,OAAO,IAAI;AAAA,EACpB;AACF;",
4
+ "sourcesContent": ["import { useContext, useMemo } from 'react';\nimport { FieldSpec, UseFieldProps } from '@digigov/form/Field/types';\nimport { FormContext } from '@digigov/form/FormContext';\n\nexport const useField = (\n name: string,\n customField: FieldSpec | null\n): UseFieldProps => {\n const {\n fieldsMap,\n control,\n register,\n reset,\n resetField,\n trigger,\n clearErrors,\n errors,\n registerField,\n watch,\n componentRegistry,\n getFieldState,\n setValue,\n getValues,\n unregister,\n formState,\n } = useContext(FormContext);\n if (!registerField) {\n throw new Error(`\n You can't use the Field component without wrapping it in FormBuilder.\n https://devs.pages.grnet.gr/digigov/digigov-sdk/sdk-docs/forms/create-simple-form/\n `);\n }\n let error = errors[name];\n\n const nameIndexRegex = name.match(/^\\[*(.*?)\\.(\\d+)\\]*$/);\n if (nameIndexRegex) {\n const [, fieldArrayName, indexStr] = nameIndexRegex;\n error = errors[fieldArrayName]?.[Number(indexStr)];\n }\n const nestedNameIndexRegex = name.match(/^\\[*(.*?)\\.(\\d+)\\.(.*?)\\]*$/);\n if (nestedNameIndexRegex) {\n const [, fieldArrayName, indexStr, fieldItemName] = nestedNameIndexRegex;\n error = errors[fieldArrayName]?.[Number(indexStr)]?.[fieldItemName];\n }\n useMemo(\n () => customField?.type && registerField({ ...customField, key: name }),\n [customField, name, registerField]\n );\n return {\n field: customField || fieldsMap[name],\n control,\n register,\n reset,\n resetField,\n trigger,\n watch,\n componentRegistry,\n getFieldState,\n setValue,\n clearErrors,\n getValues,\n unregister,\n formState,\n error,\n };\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAoC;AAEpC,yBAA4B;AAErB,MAAM,WAAW,CACtB,MACA,gBACkB;AAClB,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,QAAI,yBAAW,8BAAW;AAC1B,MAAI,CAAC,eAAe;AAClB,UAAM,IAAI,MAAM;AAAA;AAAA;AAAA,KAGf;AAAA,EACH;AACA,MAAI,QAAQ,OAAO,IAAI;AAEvB,QAAM,iBAAiB,KAAK,MAAM,sBAAsB;AACxD,MAAI,gBAAgB;AAClB,UAAM,CAAC,EAAE,gBAAgB,QAAQ,IAAI;AACrC,YAAQ,OAAO,cAAc,IAAI,OAAO,QAAQ,CAAC;AAAA,EACnD;AACA,QAAM,uBAAuB,KAAK,MAAM,6BAA6B;AACrE,MAAI,sBAAsB;AACxB,UAAM,CAAC,EAAE,gBAAgB,UAAU,aAAa,IAAI;AACpD,YAAQ,OAAO,cAAc,IAAI,OAAO,QAAQ,CAAC,IAAI,aAAa;AAAA,EACpE;AACA;AAAA,IACE,MAAM,aAAa,QAAQ,cAAc,EAAE,GAAG,aAAa,KAAK,KAAK,CAAC;AAAA,IACtE,CAAC,aAAa,MAAM,aAAa;AAAA,EACnC;AACA,SAAO;AAAA,IACL,OAAO,eAAe,UAAU,IAAI;AAAA,IACpC;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1,421 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+ var FormDialog_exports = {};
29
+ __export(FormDialog_exports, {
30
+ ArrayItemDisplay: () => ArrayItemDisplay,
31
+ ArrayItemHeader: () => ArrayItemHeader,
32
+ ArrayItemModal: () => ArrayItemModal,
33
+ FormDialog: () => FormDialog,
34
+ default: () => FormDialog_default
35
+ });
36
+ module.exports = __toCommonJS(FormDialog_exports);
37
+ var import_react = __toESM(require("react"));
38
+ var import_react_hook_form = require("react-hook-form");
39
+ var import_FieldObject = require("@digigov/form/FieldObject");
40
+ var import_Fieldset = require("@digigov/form/Fieldset");
41
+ var import_Modal = require("@digigov/ui/app/Modal");
42
+ var import_content = require("@digigov/ui/content");
43
+ var import_Button = require("@digigov/ui/form/Button");
44
+ var import_layouts = require("@digigov/ui/layouts");
45
+ var import_Heading = __toESM(require("@digigov/ui/typography/Heading"));
46
+ var import_Hint = require("@digigov/ui/typography/Hint");
47
+ const FormDialog = import_react.default.forwardRef(
48
+ function FormDialog2({
49
+ name,
50
+ trigger,
51
+ register,
52
+ control,
53
+ formState,
54
+ error,
55
+ getValues,
56
+ Field,
57
+ reset,
58
+ sortable,
59
+ ...customField
60
+ }, ref) {
61
+ const [isAppending, setIsAppending] = (0, import_react.useState)(false);
62
+ const [currentIndex, setCurrentIndex] = (0, import_react.useState)(0);
63
+ const { fields, append, remove, update, move } = (0, import_react_hook_form.useFieldArray)({
64
+ control,
65
+ name
66
+ });
67
+ const { open, close, registerModal } = (0, import_Modal.useModal)();
68
+ const currentLength = fields.length > 0 ? fields.length - 1 : fields.length;
69
+ const currentName = isAppending ? `${name}.${currentLength}` : `${name}.${currentIndex}`;
70
+ (0, import_react.useEffect)(() => {
71
+ if (isAppending) {
72
+ setCurrentIndex(currentLength);
73
+ open(`modal-${name}`);
74
+ }
75
+ }, [isAppending]);
76
+ const valuesRef = (0, import_react.useRef)(null);
77
+ if (!error) {
78
+ const values2 = getValues(currentName);
79
+ if (typeof values2 === "object") {
80
+ valuesRef.current = { ...values2 };
81
+ } else {
82
+ valuesRef.current = values2;
83
+ }
84
+ }
85
+ const values = getValues(name);
86
+ const ofField = {
87
+ ...customField.extra?.of,
88
+ name: currentName
89
+ };
90
+ const defaultValue = getValues(currentName) || ofField.defaultValue;
91
+ const noValuesCommitted = fields.length === 0 || fields.length === 1 && isAppending;
92
+ const titleNumber = customField.extra?.label.object.titleNumbering ? `${currentLength + 1}` : "";
93
+ return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, noValuesCommitted && /* @__PURE__ */ import_react.default.createElement(import_Hint.Hint, { ...customField.extra?.label.object?.nothing_added_props }, customField.extra?.label.object?.nothing_added), /* @__PURE__ */ import_react.default.createElement(
94
+ ArrayItemModal,
95
+ {
96
+ title: customField.extra?.label.object.title && `${customField.extra?.label.object.title} ${titleNumber}`,
97
+ hint: customField.label?.secondary,
98
+ name,
99
+ defaultValue,
100
+ currentName,
101
+ editOrAppend: async () => {
102
+ const hasNoErrors = await trigger(
103
+ ofField.type === "object" ? ofField.extra.fields.map(({ key }) => `${currentName}.${key}`) : currentName
104
+ );
105
+ if (!hasNoErrors) {
106
+ update(currentIndex, valuesRef.current);
107
+ }
108
+ if (hasNoErrors) {
109
+ const newValues = getValues(currentName);
110
+ if (isAppending) {
111
+ setIsAppending(false);
112
+ }
113
+ if (newValues === "") {
114
+ remove(currentIndex);
115
+ } else {
116
+ update(currentIndex, newValues);
117
+ }
118
+ close();
119
+ }
120
+ },
121
+ cancel: () => {
122
+ if (isAppending) {
123
+ setIsAppending(false);
124
+ remove(currentIndex);
125
+ close();
126
+ return;
127
+ }
128
+ update(currentIndex, valuesRef.current);
129
+ reset(void 0, {
130
+ keepTouched: true,
131
+ keepDefaultValues: true,
132
+ keepIsValid: true,
133
+ keepIsSubmitted: true,
134
+ keepValues: true
135
+ });
136
+ close();
137
+ },
138
+ type: isAppending ? "append" : "edit",
139
+ appendLabel: customField.extra?.label.object.append.label,
140
+ appendProps: customField.extra?.label.object.append.props,
141
+ editLabel: customField.extra?.label.object.edit.label,
142
+ editProps: customField.extra?.label.object.edit.props,
143
+ cancelLabel: customField.extra?.label.object.cancel.label,
144
+ cancelProps: customField.extra?.label.object.cancel.props,
145
+ control,
146
+ ...registerModal(`modal-${name}`)
147
+ },
148
+ /* @__PURE__ */ import_react.default.createElement(import_Fieldset.Fieldset, null, ofField?.type === "object" ? /* @__PURE__ */ import_react.default.createElement(
149
+ import_FieldObject.FieldObject,
150
+ {
151
+ defaultValue: defaultValue || void 0,
152
+ error: error && error[currentIndex],
153
+ formState,
154
+ register,
155
+ control,
156
+ ...ofField,
157
+ key: currentName,
158
+ Field
159
+ }
160
+ ) : /* @__PURE__ */ import_react.default.createElement(
161
+ Field,
162
+ {
163
+ name: currentName,
164
+ ...ofField,
165
+ error: error && error[currentIndex],
166
+ key: currentName
167
+ }
168
+ ))
169
+ ), !noValuesCommitted && /* @__PURE__ */ import_react.default.createElement(import_content.TableContainer, { ...customField.extra?.tableContainer }, /* @__PURE__ */ import_react.default.createElement(
170
+ import_content.Table,
171
+ {
172
+ ref,
173
+ verticalAlign: customField.extra?.verticalAlign
174
+ },
175
+ !customField.extra?.noHeader && !noValuesCommitted && ofField?.extra && values?.length > 0 && /* @__PURE__ */ import_react.default.createElement(
176
+ ArrayItemHeader,
177
+ {
178
+ tableCellActionsLabel: customField.extra?.tableCellActionsLabel,
179
+ labels: ofField.type === "object" ? ofField.extra.fields.map(({ label }) => label.primary) : [ofField.label.primary],
180
+ disabled: customField?.editable === false
181
+ }
182
+ ),
183
+ /* @__PURE__ */ import_react.default.createElement(import_content.TableBody, null, !noValuesCommitted && values?.map?.((field, index) => {
184
+ return /* @__PURE__ */ import_react.default.createElement(
185
+ ArrayItemDisplay,
186
+ {
187
+ key: index,
188
+ name: `${name}.${index}`,
189
+ index,
190
+ isFirst: index === 0,
191
+ isLast: index === values.length - 1,
192
+ data: field,
193
+ edit: () => {
194
+ setCurrentIndex(index);
195
+ open(`modal-${name}`);
196
+ },
197
+ stackProps: customField?.extra?.stackProps,
198
+ wordBreak: customField?.extra?.wordBreak,
199
+ valueDisplay: customField?.extra?.valueDisplay,
200
+ remove: () => {
201
+ remove(index);
202
+ },
203
+ border: customField.extra?.border,
204
+ move,
205
+ sortable,
206
+ disabledEdit: sortable ? true : customField.extra?.noEdit ?? false,
207
+ disabledDelete: customField.extra?.noDelete ?? false,
208
+ disabled: customField?.editable === false
209
+ }
210
+ );
211
+ }))
212
+ )), customField.extra?.editVariant !== "display" && /* @__PURE__ */ import_react.default.createElement(
213
+ "div",
214
+ {
215
+ className: customField.extra?.label.object?.addButtonVariant === "link" ? "px-2 py-2 bg-gray-200 border-t border-b border-gray-400" : ""
216
+ },
217
+ /* @__PURE__ */ import_react.default.createElement(
218
+ import_Button.Button,
219
+ {
220
+ type: "button",
221
+ name: `${name}-add-object`,
222
+ color: "secondary",
223
+ variant: customField.extra?.label.object?.addButtonVariant,
224
+ onClick: (ev) => {
225
+ ev.preventDefault();
226
+ if (customField?.extra?.of?.type === "object") {
227
+ append({});
228
+ } else {
229
+ append("");
230
+ }
231
+ setCurrentIndex(currentLength + 1);
232
+ setIsAppending(true);
233
+ },
234
+ disabled: customField?.editable === false || customField.extra?.editVariant === "noinput" || fields.length >= (customField.extra?.max ?? Number.MAX_VALUE)
235
+ },
236
+ customField.extra?.label.object?.add
237
+ )
238
+ ));
239
+ }
240
+ );
241
+ const ArrayItemModal = import_react.default.forwardRef(function ArrayItemModal2({
242
+ type,
243
+ currentName,
244
+ title,
245
+ hint,
246
+ defaultValue,
247
+ editOrAppend,
248
+ cancel,
249
+ control,
250
+ addTitle,
251
+ editLabel,
252
+ editProps,
253
+ appendLabel,
254
+ appendProps,
255
+ cancelLabel,
256
+ cancelProps,
257
+ children,
258
+ ...props
259
+ }, ref) {
260
+ const value = (0, import_react_hook_form.useWatch)({
261
+ control,
262
+ name: currentName,
263
+ defaultValue
264
+ });
265
+ const disabled = value === void 0 || value === null || value === "";
266
+ return /* @__PURE__ */ import_react.default.createElement(
267
+ import_Modal.Modal,
268
+ {
269
+ ...props,
270
+ ref,
271
+ "aria-labelledby": "modal-label"
272
+ },
273
+ /* @__PURE__ */ import_react.default.createElement(import_Modal.ModalHeading, { id: "modal-label" }, title ? title : type === "edit" ? "\u0395\u03C0\u03B5\u03BE\u03B5\u03C1\u03B3\u03B1\u03C3\u03AF\u03B1" : addTitle || "\u03A0\u03C1\u03BF\u03C3\u03B8\u03AE\u03BA\u03B7"),
274
+ /* @__PURE__ */ import_react.default.createElement(import_Modal.ModalContent, null, hint && /* @__PURE__ */ import_react.default.createElement(import_Hint.Hint, null, hint), children),
275
+ /* @__PURE__ */ import_react.default.createElement(import_Modal.ModalAction, null, type === "edit" ? /* @__PURE__ */ import_react.default.createElement(
276
+ import_Button.Button,
277
+ {
278
+ color: "secondary",
279
+ ...editProps,
280
+ type: "button",
281
+ onClick: (e) => {
282
+ e.preventDefault();
283
+ editOrAppend();
284
+ },
285
+ disabled
286
+ },
287
+ editLabel || "\u0391\u03C0\u03BF\u03B8\u03AE\u03BA\u03B5\u03C5\u03C3\u03B7"
288
+ ) : /* @__PURE__ */ import_react.default.createElement(
289
+ import_Button.Button,
290
+ {
291
+ color: "primary",
292
+ ...appendProps,
293
+ type: "button",
294
+ onClick: (e) => {
295
+ e.preventDefault();
296
+ editOrAppend();
297
+ },
298
+ disabled
299
+ },
300
+ appendLabel || "\u03A0\u03C1\u03BF\u03C3\u03B8\u03AE\u03BA\u03B7"
301
+ ), /* @__PURE__ */ import_react.default.createElement(
302
+ import_Button.Button,
303
+ {
304
+ variant: "link",
305
+ type: "button",
306
+ ...cancelProps,
307
+ onClick: (e) => {
308
+ e.preventDefault();
309
+ cancel();
310
+ }
311
+ },
312
+ cancelLabel || "\u0391\u03BA\u03CD\u03C1\u03C9\u03C3\u03B7"
313
+ ))
314
+ );
315
+ });
316
+ const ArrayItemHeader = ({
317
+ labels,
318
+ disabled,
319
+ tableCellActionsLabel
320
+ }) => {
321
+ return /* @__PURE__ */ import_react.default.createElement(import_content.TableHead, null, /* @__PURE__ */ import_react.default.createElement(import_content.TableRow, null, labels.map((label, index) => {
322
+ return /* @__PURE__ */ import_react.default.createElement(import_content.TableHeadCell, { key: index }, label);
323
+ }), !disabled && /* @__PURE__ */ import_react.default.createElement(import_content.TableHeadCell, null, tableCellActionsLabel ?? `\u0395\u03BD\u03AD\u03C1\u03B3\u03B5\u03B9\u03B5\u03C2`)));
324
+ };
325
+ const ArrayItemDisplay = ({
326
+ name,
327
+ data,
328
+ edit,
329
+ remove,
330
+ disabledEdit,
331
+ disabledDelete,
332
+ disabled,
333
+ sortable,
334
+ index,
335
+ isFirst,
336
+ isLast,
337
+ move,
338
+ valueDisplay,
339
+ border = true,
340
+ wordBreak = "break-all",
341
+ stackProps = {
342
+ spacing: 4,
343
+ alignItems: "flex-end",
344
+ justifyContent: "flex-end",
345
+ direction: "column"
346
+ }
347
+ }) => {
348
+ if (data === void 0 || data === null) {
349
+ return null;
350
+ }
351
+ if (Object.keys(data).length === 0 || Object.keys(data).length === 1 && data.id) {
352
+ return null;
353
+ }
354
+ delete data.id;
355
+ const values = typeof data === "string" ? [data] : Object.values(data || {});
356
+ const borderVariant = border === false || sortable ? "none" : "border";
357
+ return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(import_content.TableRow, null, values?.map?.((value, valueIndex) => {
358
+ return /* @__PURE__ */ import_react.default.createElement(
359
+ import_content.TableDataCell,
360
+ {
361
+ key: valueIndex,
362
+ variant: borderVariant,
363
+ wordBreak,
364
+ pb: sortable ? 0 : void 0,
365
+ pt: sortable ? 4 : void 0
366
+ },
367
+ sortable && valueIndex === 0 && /* @__PURE__ */ import_react.default.createElement(import_Heading.default, { size: "sm", className: "mb-2" }, "\u0395\u03C0\u03B9\u03BB\u03BF\u03B3\u03AE #", index + 1),
368
+ value?.name || (Array.isArray(value) ? value.join("\n") : valueDisplay ? valueDisplay(value) : value) || ""
369
+ );
370
+ }), disabled === true || disabledEdit === true && disabledDelete === true ? null : /* @__PURE__ */ import_react.default.createElement(import_content.TableDataCell, { variant: borderVariant }, /* @__PURE__ */ import_react.default.createElement(import_layouts.Stack, { ...stackProps }, disabledEdit !== true && /* @__PURE__ */ import_react.default.createElement(
371
+ import_Button.Button,
372
+ {
373
+ variant: "link",
374
+ type: "button",
375
+ onClick: () => {
376
+ edit(name);
377
+ }
378
+ },
379
+ "\u0395\u03C0\u03B5\u03BE\u03B5\u03C1\u03B3\u03B1\u03C3\u03AF\u03B1"
380
+ ), disabledDelete !== true && /* @__PURE__ */ import_react.default.createElement(
381
+ import_Button.Button,
382
+ {
383
+ variant: "link",
384
+ type: "button",
385
+ onClick: () => remove(name)
386
+ },
387
+ "\u0394\u03B9\u03B1\u03B3\u03C1\u03B1\u03C6\u03AE"
388
+ )))), sortable && /* @__PURE__ */ import_react.default.createElement(import_content.TableRow, null, /* @__PURE__ */ import_react.default.createElement(
389
+ import_content.TableDataCell,
390
+ {
391
+ variant: isLast ? "none" : "border",
392
+ colSpan: disabled === true || disabledEdit === true && disabledDelete === true ? values.length : values.length + 1
393
+ },
394
+ sortable && !disabled && !(isFirst && isLast) && /* @__PURE__ */ import_react.default.createElement(import_layouts.Grid, { xs: 12, mt: 2 }, "\u039C\u03B5\u03C4\u03B1\u03BA\u03AF\u03BD\u03B7\u03C3\u03B7", " ", !isFirst && /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, "\u03C0\u03C1\u03BF\u03C2 \u03C4\u03B1", " ", /* @__PURE__ */ import_react.default.createElement(
395
+ import_Button.Button,
396
+ {
397
+ type: "button",
398
+ variant: "link",
399
+ onClick: () => move(index, index - 1)
400
+ },
401
+ "\u03C0\u03AC\u03BD\u03C9"
402
+ )), !isFirst && !isLast && " \u03AE ", !isLast && /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, "\u03C0\u03C1\u03BF\u03C2 \u03C4\u03B1", " ", /* @__PURE__ */ import_react.default.createElement(
403
+ import_Button.Button,
404
+ {
405
+ type: "button",
406
+ variant: "link",
407
+ onClick: () => move(index, index + 1)
408
+ },
409
+ "\u03BA\u03AC\u03C4\u03C9"
410
+ )))
411
+ )));
412
+ };
413
+ var FormDialog_default = FormDialog;
414
+ // Annotate the CommonJS export names for ESM import in node:
415
+ 0 && (module.exports = {
416
+ ArrayItemDisplay,
417
+ ArrayItemHeader,
418
+ ArrayItemModal,
419
+ FormDialog
420
+ });
421
+ //# sourceMappingURL=FormDialog.js.map