@digigov/form 0.10.5 → 0.10.7

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 (661) hide show
  1. package/.eslintrc.js +3 -0
  2. package/.prettierrc.js +3 -0
  3. package/CHANGELOG.json +1392 -0
  4. package/CHANGELOG.md +13 -1
  5. package/coverage/clover.xml +859 -0
  6. package/coverage/coverage-final.json +51 -0
  7. package/coverage/lcov-report/base.css +224 -0
  8. package/coverage/lcov-report/block-navigation.js +87 -0
  9. package/coverage/lcov-report/favicon.png +0 -0
  10. package/coverage/lcov-report/index.html +386 -0
  11. package/coverage/lcov-report/prettify.css +1 -0
  12. package/coverage/lcov-report/prettify.js +2 -0
  13. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  14. package/coverage/lcov-report/sorter.js +196 -0
  15. package/coverage/lcov-report/src/Field/FieldBase.tsx.html +379 -0
  16. package/coverage/lcov-report/src/Field/FieldConditional.tsx.html +310 -0
  17. package/coverage/lcov-report/src/Field/FieldContainer.tsx.html +256 -0
  18. package/coverage/lcov-report/src/Field/index.html +176 -0
  19. package/coverage/lcov-report/src/Field/index.tsx.html +352 -0
  20. package/coverage/lcov-report/src/Field/utils.ts.html +559 -0
  21. package/coverage/lcov-report/src/FieldArray/index.html +116 -0
  22. package/coverage/lcov-report/src/FieldArray/index.tsx.html +319 -0
  23. package/coverage/lcov-report/src/FieldObject/index.html +116 -0
  24. package/coverage/lcov-report/src/FieldObject/index.tsx.html +364 -0
  25. package/coverage/lcov-report/src/Fieldset/index.html +116 -0
  26. package/coverage/lcov-report/src/Fieldset/index.tsx.html +202 -0
  27. package/coverage/lcov-report/src/FormBuilder/FormBuilder.tsx.html +580 -0
  28. package/coverage/lcov-report/src/FormBuilder/index.html +131 -0
  29. package/coverage/lcov-report/src/FormBuilder/index.tsx.html +94 -0
  30. package/coverage/lcov-report/src/FormContext.tsx.html +109 -0
  31. package/coverage/lcov-report/src/MultiplicityField/add-objects.tsx.html +637 -0
  32. package/coverage/lcov-report/src/MultiplicityField/index.html +131 -0
  33. package/coverage/lcov-report/src/MultiplicityField/index.tsx.html +580 -0
  34. package/coverage/lcov-report/src/Questions/Questions.tsx.html +307 -0
  35. package/coverage/lcov-report/src/Questions/QuestionsContext.tsx.html +112 -0
  36. package/coverage/lcov-report/src/Questions/Step/ReviewStep.tsx.html +274 -0
  37. package/coverage/lcov-report/src/Questions/Step/Step.tsx.html +286 -0
  38. package/coverage/lcov-report/src/Questions/Step/StepArrayReview.tsx.html +289 -0
  39. package/coverage/lcov-report/src/Questions/Step/StepContext.tsx.html +148 -0
  40. package/coverage/lcov-report/src/Questions/Step/StepDescription.tsx.html +184 -0
  41. package/coverage/lcov-report/src/Questions/Step/StepForm.tsx.html +265 -0
  42. package/coverage/lcov-report/src/Questions/Step/StepQuote.tsx.html +109 -0
  43. package/coverage/lcov-report/src/Questions/Step/StepTitle.tsx.html +265 -0
  44. package/coverage/lcov-report/src/Questions/Step/getAddMoreFields.tsx.html +169 -0
  45. package/coverage/lcov-report/src/Questions/Step/index.html +266 -0
  46. package/coverage/lcov-report/src/Questions/Step/index.ts.html +124 -0
  47. package/coverage/lcov-report/src/Questions/Step/types.tsx.html +181 -0
  48. package/coverage/lcov-report/src/Questions/getNextStep.tsx.html +157 -0
  49. package/coverage/lcov-report/src/Questions/index.html +161 -0
  50. package/coverage/lcov-report/src/Questions/index.tsx.html +100 -0
  51. package/coverage/lcov-report/src/index.html +176 -0
  52. package/coverage/lcov-report/src/index.ts.html +94 -0
  53. package/coverage/lcov-report/src/inputs/Checkboxes/index.html +116 -0
  54. package/coverage/lcov-report/src/inputs/Checkboxes/index.tsx.html +307 -0
  55. package/coverage/lcov-report/src/inputs/DateInput/index.html +116 -0
  56. package/coverage/lcov-report/src/inputs/DateInput/index.tsx.html +475 -0
  57. package/coverage/lcov-report/src/inputs/FileInput/index.html +116 -0
  58. package/coverage/lcov-report/src/inputs/FileInput/index.tsx.html +313 -0
  59. package/coverage/lcov-report/src/inputs/Input/index.html +116 -0
  60. package/coverage/lcov-report/src/inputs/Input/index.tsx.html +271 -0
  61. package/coverage/lcov-report/src/inputs/Label/index.html +116 -0
  62. package/coverage/lcov-report/src/inputs/Label/index.tsx.html +217 -0
  63. package/coverage/lcov-report/src/inputs/Radio/index.html +116 -0
  64. package/coverage/lcov-report/src/inputs/Radio/index.tsx.html +256 -0
  65. package/coverage/lcov-report/src/inputs/Select/index.html +116 -0
  66. package/coverage/lcov-report/src/inputs/Select/index.tsx.html +196 -0
  67. package/coverage/lcov-report/src/inputs/index.html +116 -0
  68. package/coverage/lcov-report/src/inputs/index.ts.html +106 -0
  69. package/coverage/lcov-report/src/internal.ts.html +184 -0
  70. package/coverage/lcov-report/src/types.tsx.html +406 -0
  71. package/coverage/lcov-report/src/utils.ts.html +319 -0
  72. package/coverage/lcov-report/src/validators/index.html +116 -0
  73. package/coverage/lcov-report/src/validators/index.ts.html +694 -0
  74. package/coverage/lcov-report/src/validators/utils/afm.ts.html +196 -0
  75. package/coverage/lcov-report/src/validators/utils/file.ts.html +160 -0
  76. package/coverage/lcov-report/src/validators/utils/iban.ts.html +442 -0
  77. package/coverage/lcov-report/src/validators/utils/index.html +236 -0
  78. package/coverage/lcov-report/src/validators/utils/index.ts.html +367 -0
  79. package/coverage/lcov-report/src/validators/utils/int.ts.html +151 -0
  80. package/coverage/lcov-report/src/validators/utils/number.ts.html +139 -0
  81. package/coverage/lcov-report/src/validators/utils/phone.ts.html +445 -0
  82. package/coverage/lcov-report/src/validators/utils/postal_code.ts.html +184 -0
  83. package/coverage/lcov-report/src/validators/utils/uuid4.ts.html +148 -0
  84. package/coverage/lcov.info +1969 -0
  85. package/dist/CHANGELOG.md +432 -0
  86. package/{Field → dist/Field}/FieldBase.d.ts +0 -0
  87. package/{Field → dist/Field}/FieldBase.js +3 -3
  88. package/dist/Field/FieldBaseContainer.d.ts +4 -0
  89. package/{Field/FieldContainer.js → dist/Field/FieldBaseContainer.js} +10 -10
  90. package/{Field → dist/Field}/FieldConditional.d.ts +0 -0
  91. package/{Field → dist/Field}/FieldConditional.js +0 -0
  92. package/{Field → dist/Field}/index.d.ts +0 -0
  93. package/{Field → dist/Field}/index.js +0 -0
  94. package/{Field → dist/Field}/index.mdx +0 -0
  95. package/{Field → dist/Field}/types.d.ts +0 -0
  96. package/{Field → dist/Field}/types.js +0 -0
  97. package/{Field → dist/Field}/utils.d.ts +0 -0
  98. package/{Field → dist/Field}/utils.js +0 -0
  99. package/{FieldArray → dist/FieldArray}/FieldArray.stories.d.ts +0 -0
  100. package/{FieldArray → dist/FieldArray}/FieldArray.stories.js +0 -0
  101. package/{FieldArray → dist/FieldArray}/FieldArray.stories.playwright.json +0 -0
  102. package/{FieldArray → dist/FieldArray}/__stories__/Default.d.ts +0 -0
  103. package/{FieldArray → dist/FieldArray}/__stories__/Default.js +0 -0
  104. package/{FieldArray → dist/FieldArray}/__stories__/WithExactLength.d.ts +0 -0
  105. package/{FieldArray → dist/FieldArray}/__stories__/WithExactLength.js +0 -0
  106. package/{FieldArray → dist/FieldArray}/index.d.ts +0 -0
  107. package/{FieldArray → dist/FieldArray}/index.js +2 -2
  108. package/{FieldObject → dist/FieldObject}/index.d.ts +0 -0
  109. package/{FieldObject → dist/FieldObject}/index.js +0 -0
  110. package/{Fieldset → dist/Fieldset}/FieldsetWithContext.d.ts +0 -0
  111. package/{Fieldset → dist/Fieldset}/FieldsetWithContext.js +0 -0
  112. package/{Fieldset → dist/Fieldset}/index.d.ts +2 -1
  113. package/{Fieldset → dist/Fieldset}/index.js +8 -9
  114. package/{Fieldset → dist/Fieldset}/types.d.ts +0 -0
  115. package/{Fieldset → dist/Fieldset}/types.js +0 -0
  116. package/{Form.stories.d.ts → dist/Form.stories.d.ts} +0 -0
  117. package/{Form.stories.js → dist/Form.stories.js} +0 -0
  118. package/{Form.stories.playwright.json → dist/Form.stories.playwright.json} +0 -0
  119. package/{FormBuilder → dist/FormBuilder}/FormBuilder.d.ts +0 -0
  120. package/{FormBuilder → dist/FormBuilder}/FormBuilder.js +0 -0
  121. package/{FormBuilder → dist/FormBuilder}/FormBuilder.mdx +0 -0
  122. package/{FormBuilder → dist/FormBuilder}/FormBuilder.stories.d.ts +0 -0
  123. package/{FormBuilder → dist/FormBuilder}/FormBuilder.stories.js +0 -0
  124. package/{FormBuilder → dist/FormBuilder}/FormBuilder.stories.playwright.json +0 -0
  125. package/{FormBuilder → dist/FormBuilder}/__stories__/Default.d.ts +0 -0
  126. package/{FormBuilder → dist/FormBuilder}/__stories__/Default.js +0 -0
  127. package/{FormBuilder → dist/FormBuilder}/index.d.ts +0 -0
  128. package/{FormBuilder → dist/FormBuilder}/index.js +0 -0
  129. package/{FormContext.d.ts → dist/FormContext.d.ts} +0 -0
  130. package/{FormContext.js → dist/FormContext.js} +0 -0
  131. package/{LICENSE → dist/LICENSE} +0 -0
  132. package/{MultiplicityField → dist/MultiplicityField}/MultiplicityField.mdx +0 -0
  133. package/{MultiplicityField → dist/MultiplicityField}/MultiplicityField.stories.d.ts +0 -0
  134. package/{MultiplicityField → dist/MultiplicityField}/MultiplicityField.stories.js +0 -0
  135. package/{MultiplicityField → dist/MultiplicityField}/MultiplicityField.stories.playwright.json +0 -0
  136. package/{MultiplicityField → dist/MultiplicityField}/__stories__/Default.d.ts +0 -0
  137. package/{MultiplicityField → dist/MultiplicityField}/__stories__/Default.js +0 -0
  138. package/{MultiplicityField → dist/MultiplicityField}/__stories__/PreviewDisplay.d.ts +0 -0
  139. package/{MultiplicityField → dist/MultiplicityField}/__stories__/PreviewDisplay.js +0 -0
  140. package/{MultiplicityField → dist/MultiplicityField}/__stories__/WithExactLength.d.ts +0 -0
  141. package/{MultiplicityField → dist/MultiplicityField}/__stories__/WithExactLength.js +0 -0
  142. package/{MultiplicityField → dist/MultiplicityField}/__stories__/WithMaxLength.d.ts +0 -0
  143. package/{MultiplicityField → dist/MultiplicityField}/__stories__/WithMaxLength.js +0 -0
  144. package/{MultiplicityField → dist/MultiplicityField}/__stories__/WithMinAndMaxLength.d.ts +0 -0
  145. package/{MultiplicityField → dist/MultiplicityField}/__stories__/WithMinAndMaxLength.js +0 -0
  146. package/{MultiplicityField → dist/MultiplicityField}/__stories__/WithMinLength.d.ts +0 -0
  147. package/{MultiplicityField → dist/MultiplicityField}/__stories__/WithMinLength.js +0 -0
  148. package/{MultiplicityField → dist/MultiplicityField}/add-objects.d.ts +0 -0
  149. package/{MultiplicityField → dist/MultiplicityField}/add-objects.js +0 -0
  150. package/{MultiplicityField → dist/MultiplicityField}/index.d.ts +0 -0
  151. package/{MultiplicityField → dist/MultiplicityField}/index.js +2 -2
  152. package/{Questions → dist/Questions}/Questions.d.ts +0 -0
  153. package/{Questions → dist/Questions}/Questions.js +0 -0
  154. package/{Questions → dist/Questions}/QuestionsContext.d.ts +0 -0
  155. package/{Questions → dist/Questions}/QuestionsContext.js +0 -0
  156. package/{Questions → dist/Questions}/Step/ReviewStep.d.ts +0 -0
  157. package/{Questions → dist/Questions}/Step/ReviewStep.js +0 -0
  158. package/{Questions → dist/Questions}/Step/Step.d.ts +0 -0
  159. package/{Questions → dist/Questions}/Step/Step.js +0 -0
  160. package/{Questions → dist/Questions}/Step/StepArrayReview.d.ts +0 -0
  161. package/{Questions → dist/Questions}/Step/StepArrayReview.js +0 -0
  162. package/{Questions → dist/Questions}/Step/StepContext.d.ts +0 -0
  163. package/{Questions → dist/Questions}/Step/StepContext.js +0 -0
  164. package/{Questions → dist/Questions}/Step/StepDescription.d.ts +0 -0
  165. package/{Questions → dist/Questions}/Step/StepDescription.js +0 -0
  166. package/{Questions → dist/Questions}/Step/StepForm.d.ts +0 -0
  167. package/{Questions → dist/Questions}/Step/StepForm.js +0 -0
  168. package/{Questions → dist/Questions}/Step/StepQuote.d.ts +0 -0
  169. package/{Questions → dist/Questions}/Step/StepQuote.js +0 -0
  170. package/{Questions → dist/Questions}/Step/StepTitle.d.ts +0 -0
  171. package/{Questions → dist/Questions}/Step/StepTitle.js +0 -0
  172. package/{Questions → dist/Questions}/Step/getAddMoreFields.d.ts +0 -0
  173. package/{Questions → dist/Questions}/Step/getAddMoreFields.js +0 -0
  174. package/{Questions → dist/Questions}/Step/index.d.ts +0 -0
  175. package/{Questions → dist/Questions}/Step/index.js +0 -0
  176. package/{Questions → dist/Questions}/Step/types.d.ts +0 -0
  177. package/{Questions → dist/Questions}/Step/types.js +0 -0
  178. package/{Questions → dist/Questions}/__snapshots__/index.spec.tsx.snap +0 -0
  179. package/{Questions → dist/Questions}/getNextStep.d.ts +0 -0
  180. package/{Questions → dist/Questions}/getNextStep.js +0 -0
  181. package/{Questions → dist/Questions}/index.d.ts +0 -0
  182. package/{Questions → dist/Questions}/index.js +0 -0
  183. package/{Questions → dist/Questions}/index.mdx +0 -0
  184. package/{Questions → dist/Questions}/index.spec.d.ts +0 -0
  185. package/{Questions → dist/Questions}/index.spec.js +0 -0
  186. package/{Questions → dist/Questions}/types.d.ts +0 -0
  187. package/{Questions → dist/Questions}/types.js +0 -0
  188. package/{es/inputs/Checkboxes/index.mdx → dist/README.md} +0 -0
  189. package/{__stories__ → dist/__stories__}/AutoCompleteField.d.ts +0 -0
  190. package/{__stories__ → dist/__stories__}/AutoCompleteField.js +0 -0
  191. package/{__stories__ → dist/__stories__}/IntField.d.ts +0 -0
  192. package/{__stories__ → dist/__stories__}/IntField.js +0 -0
  193. package/{create-simple-form.mdx → dist/create-simple-form.mdx} +0 -0
  194. package/{es → dist/es}/Field/FieldBase.js +3 -3
  195. package/{esm/Field/FieldContainer.js → dist/es/Field/FieldBaseContainer.js} +7 -7
  196. package/{es → dist/es}/Field/FieldConditional.js +0 -0
  197. package/{es → dist/es}/Field/index.js +0 -0
  198. package/{es → dist/es}/Field/index.mdx +0 -0
  199. package/{es → dist/es}/Field/types.js +0 -0
  200. package/{es → dist/es}/Field/utils.js +0 -0
  201. package/{es → dist/es}/FieldArray/FieldArray.stories.js +0 -0
  202. package/{es → dist/es}/FieldArray/FieldArray.stories.playwright.json +0 -0
  203. package/{es → dist/es}/FieldArray/__stories__/Default.js +0 -0
  204. package/{es → dist/es}/FieldArray/__stories__/WithExactLength.js +0 -0
  205. package/{esm → dist/es}/FieldArray/index.js +1 -1
  206. package/{es → dist/es}/FieldObject/index.js +0 -0
  207. package/{es → dist/es}/Fieldset/FieldsetWithContext.js +0 -0
  208. package/{esm → dist/es}/Fieldset/index.js +2 -5
  209. package/{es → dist/es}/Fieldset/types.js +0 -0
  210. package/{es → dist/es}/Form.stories.js +0 -0
  211. package/{es → dist/es}/Form.stories.playwright.json +0 -0
  212. package/{es → dist/es}/FormBuilder/FormBuilder.js +0 -0
  213. package/{es → dist/es}/FormBuilder/FormBuilder.mdx +0 -0
  214. package/{es → dist/es}/FormBuilder/FormBuilder.stories.js +0 -0
  215. package/{es → dist/es}/FormBuilder/FormBuilder.stories.playwright.json +0 -0
  216. package/{es → dist/es}/FormBuilder/__stories__/Default.js +0 -0
  217. package/{es → dist/es}/FormBuilder/index.js +0 -0
  218. package/{es → dist/es}/FormContext.js +0 -0
  219. package/{es → dist/es}/MultiplicityField/MultiplicityField.mdx +0 -0
  220. package/{es → dist/es}/MultiplicityField/MultiplicityField.stories.js +0 -0
  221. package/{es → dist/es}/MultiplicityField/MultiplicityField.stories.playwright.json +0 -0
  222. package/{es → dist/es}/MultiplicityField/__stories__/Default.js +0 -0
  223. package/{es → dist/es}/MultiplicityField/__stories__/PreviewDisplay.js +0 -0
  224. package/{es → dist/es}/MultiplicityField/__stories__/WithExactLength.js +0 -0
  225. package/{es → dist/es}/MultiplicityField/__stories__/WithMaxLength.js +0 -0
  226. package/{es → dist/es}/MultiplicityField/__stories__/WithMinAndMaxLength.js +0 -0
  227. package/{es → dist/es}/MultiplicityField/__stories__/WithMinLength.js +0 -0
  228. package/{es → dist/es}/MultiplicityField/add-objects.js +0 -0
  229. package/{esm → dist/es}/MultiplicityField/index.js +1 -1
  230. package/{es → dist/es}/Questions/Questions.js +0 -0
  231. package/{es → dist/es}/Questions/QuestionsContext.js +0 -0
  232. package/{es → dist/es}/Questions/Step/ReviewStep.js +0 -0
  233. package/{es → dist/es}/Questions/Step/Step.js +0 -0
  234. package/{es → dist/es}/Questions/Step/StepArrayReview.js +0 -0
  235. package/{es → dist/es}/Questions/Step/StepContext.js +0 -0
  236. package/{es → dist/es}/Questions/Step/StepDescription.js +0 -0
  237. package/{es → dist/es}/Questions/Step/StepForm.js +0 -0
  238. package/{es → dist/es}/Questions/Step/StepQuote.js +0 -0
  239. package/{es → dist/es}/Questions/Step/StepTitle.js +0 -0
  240. package/{es → dist/es}/Questions/Step/getAddMoreFields.js +0 -0
  241. package/{es → dist/es}/Questions/Step/index.js +0 -0
  242. package/{es → dist/es}/Questions/Step/types.js +0 -0
  243. package/{es → dist/es}/Questions/__snapshots__/index.spec.tsx.snap +0 -0
  244. package/{es → dist/es}/Questions/getNextStep.js +0 -0
  245. package/{es → dist/es}/Questions/index.js +0 -0
  246. package/{es → dist/es}/Questions/index.mdx +0 -0
  247. package/{es → dist/es}/Questions/index.spec.js +0 -0
  248. package/{es → dist/es}/Questions/types.js +0 -0
  249. package/{es → dist/es}/__stories__/AutoCompleteField.js +0 -0
  250. package/{es → dist/es}/__stories__/IntField.js +0 -0
  251. package/{es → dist/es}/create-simple-form.mdx +0 -0
  252. package/{es → dist/es}/index.js +0 -0
  253. package/{es → dist/es}/index.mdx +0 -0
  254. package/{es → dist/es}/inputs/AutoComplete/index.js +0 -0
  255. package/{es → dist/es}/inputs/Checkboxes/Checkboxes.stories.js +0 -0
  256. package/{es → dist/es}/inputs/Checkboxes/Checkboxes.stories.playwright.json +0 -0
  257. package/{es → dist/es}/inputs/Checkboxes/__stories__/Default.js +0 -0
  258. package/{es → dist/es}/inputs/Checkboxes/index.js +0 -0
  259. package/{es/inputs/Label → dist/es/inputs/Checkboxes}/index.mdx +0 -0
  260. package/{es → dist/es}/inputs/DateInput/DateInput.stories.js +0 -0
  261. package/{es → dist/es}/inputs/DateInput/DateInput.stories.playwright.json +0 -0
  262. package/{es → dist/es}/inputs/DateInput/__stories__/Default.js +0 -0
  263. package/{esm → dist/es}/inputs/DateInput/index.js +2 -2
  264. package/{es → dist/es}/inputs/FileInput/FileInput.stories.js +0 -0
  265. package/{es → dist/es}/inputs/FileInput/FileInput.stories.playwright.json +0 -0
  266. package/{es → dist/es}/inputs/FileInput/__stories__/Default.js +0 -0
  267. package/{es → dist/es}/inputs/FileInput/index.js +0 -0
  268. package/{es → dist/es}/inputs/Input/Input.stories.js +0 -0
  269. package/{es → dist/es}/inputs/Input/Input.stories.playwright.json +0 -0
  270. package/{es → dist/es}/inputs/Input/__stories__/AFM.js +0 -0
  271. package/{es → dist/es}/inputs/Input/__stories__/Boolean.js +0 -0
  272. package/{es → dist/es}/inputs/Input/__stories__/Default.js +0 -0
  273. package/{es → dist/es}/inputs/Input/__stories__/IBAN.js +0 -0
  274. package/{es → dist/es}/inputs/Input/__stories__/Integer.js +0 -0
  275. package/{es → dist/es}/inputs/Input/__stories__/MobilePhone.js +0 -0
  276. package/{es → dist/es}/inputs/Input/__stories__/PhoneNumber.js +0 -0
  277. package/{es → dist/es}/inputs/Input/__stories__/PostalCode.js +0 -0
  278. package/{es → dist/es}/inputs/Input/index.js +0 -0
  279. package/{es → dist/es}/inputs/Input/index.mdx +0 -0
  280. package/{es → dist/es}/inputs/Label/Label.stories.js +0 -0
  281. package/{es → dist/es}/inputs/Label/Label.stories.playwright.json +0 -0
  282. package/{es → dist/es}/inputs/Label/__stories__/Default.js +0 -0
  283. package/{es → dist/es}/inputs/Label/index.js +0 -0
  284. package/{es/inputs/Radio → dist/es/inputs/Label}/index.mdx +0 -0
  285. package/{es → dist/es}/inputs/Radio/Radio.stories.js +0 -0
  286. package/{es → dist/es}/inputs/Radio/Radio.stories.playwright.json +0 -0
  287. package/{es → dist/es}/inputs/Radio/__stories__/Default.js +0 -0
  288. package/{es → dist/es}/inputs/Radio/index.js +2 -2
  289. package/{esm/inputs/Checkboxes → dist/es/inputs/Radio}/index.mdx +0 -0
  290. package/{es → dist/es}/inputs/Select/Select.stories.js +0 -0
  291. package/{es → dist/es}/inputs/Select/Select.stories.playwright.json +0 -0
  292. package/{es → dist/es}/inputs/Select/__stories__/Default.js +0 -0
  293. package/{esm → dist/es}/inputs/Select/index.js +2 -2
  294. package/{es → dist/es}/inputs/index.js +0 -0
  295. package/{es → dist/es}/installation.mdx +0 -0
  296. package/{es → dist/es}/internal.js +0 -0
  297. package/{esm → dist/es}/registry.js +2 -2
  298. package/{es → dist/es}/types.js +0 -0
  299. package/{es → dist/es}/utils.js +0 -0
  300. package/{es → dist/es}/validators/index.js +0 -0
  301. package/{es → dist/es}/validators/types.js +0 -0
  302. package/{es → dist/es}/validators/utils/afm.js +0 -0
  303. package/{es → dist/es}/validators/utils/file.js +0 -0
  304. package/{es → dist/es}/validators/utils/iban.js +0 -0
  305. package/{es → dist/es}/validators/utils/index.js +0 -0
  306. package/{es → dist/es}/validators/utils/int.js +0 -0
  307. package/{es → dist/es}/validators/utils/number.js +0 -0
  308. package/{es → dist/es}/validators/utils/phone.js +0 -0
  309. package/{es → dist/es}/validators/utils/postal_code.js +0 -0
  310. package/{es → dist/es}/validators/utils/uuid4.js +0 -0
  311. package/{es → dist/es}/validators/validators.spec.js +0 -0
  312. package/{esm → dist/esm}/Field/FieldBase.js +3 -3
  313. package/{es/Field/FieldContainer.js → dist/esm/Field/FieldBaseContainer.js} +7 -7
  314. package/{esm → dist/esm}/Field/FieldConditional.js +0 -0
  315. package/{esm → dist/esm}/Field/index.js +0 -0
  316. package/{esm → dist/esm}/Field/index.mdx +0 -0
  317. package/{esm → dist/esm}/Field/types.js +0 -0
  318. package/{esm → dist/esm}/Field/utils.js +0 -0
  319. package/{esm → dist/esm}/FieldArray/FieldArray.stories.js +0 -0
  320. package/{esm → dist/esm}/FieldArray/FieldArray.stories.playwright.json +0 -0
  321. package/{esm → dist/esm}/FieldArray/__stories__/Default.js +0 -0
  322. package/{esm → dist/esm}/FieldArray/__stories__/WithExactLength.js +0 -0
  323. package/{es → dist/esm}/FieldArray/index.js +1 -1
  324. package/{esm → dist/esm}/FieldObject/index.js +0 -0
  325. package/{esm → dist/esm}/Fieldset/FieldsetWithContext.js +0 -0
  326. package/{es → dist/esm}/Fieldset/index.js +2 -5
  327. package/{esm → dist/esm}/Fieldset/types.js +0 -0
  328. package/{esm → dist/esm}/Form.stories.js +0 -0
  329. package/{esm → dist/esm}/Form.stories.playwright.json +0 -0
  330. package/{esm → dist/esm}/FormBuilder/FormBuilder.js +0 -0
  331. package/{esm → dist/esm}/FormBuilder/FormBuilder.mdx +0 -0
  332. package/{esm → dist/esm}/FormBuilder/FormBuilder.stories.js +0 -0
  333. package/{esm → dist/esm}/FormBuilder/FormBuilder.stories.playwright.json +0 -0
  334. package/{esm → dist/esm}/FormBuilder/__stories__/Default.js +0 -0
  335. package/{esm → dist/esm}/FormBuilder/index.js +0 -0
  336. package/{esm → dist/esm}/FormContext.js +0 -0
  337. package/{esm → dist/esm}/MultiplicityField/MultiplicityField.mdx +0 -0
  338. package/{esm → dist/esm}/MultiplicityField/MultiplicityField.stories.js +0 -0
  339. package/{esm → dist/esm}/MultiplicityField/MultiplicityField.stories.playwright.json +0 -0
  340. package/{esm → dist/esm}/MultiplicityField/__stories__/Default.js +0 -0
  341. package/{esm → dist/esm}/MultiplicityField/__stories__/PreviewDisplay.js +0 -0
  342. package/{esm → dist/esm}/MultiplicityField/__stories__/WithExactLength.js +0 -0
  343. package/{esm → dist/esm}/MultiplicityField/__stories__/WithMaxLength.js +0 -0
  344. package/{esm → dist/esm}/MultiplicityField/__stories__/WithMinAndMaxLength.js +0 -0
  345. package/{esm → dist/esm}/MultiplicityField/__stories__/WithMinLength.js +0 -0
  346. package/{esm → dist/esm}/MultiplicityField/add-objects.js +0 -0
  347. package/{es → dist/esm}/MultiplicityField/index.js +1 -1
  348. package/{esm → dist/esm}/Questions/Questions.js +0 -0
  349. package/{esm → dist/esm}/Questions/QuestionsContext.js +0 -0
  350. package/{esm → dist/esm}/Questions/Step/ReviewStep.js +0 -0
  351. package/{esm → dist/esm}/Questions/Step/Step.js +0 -0
  352. package/{esm → dist/esm}/Questions/Step/StepArrayReview.js +0 -0
  353. package/{esm → dist/esm}/Questions/Step/StepContext.js +0 -0
  354. package/{esm → dist/esm}/Questions/Step/StepDescription.js +0 -0
  355. package/{esm → dist/esm}/Questions/Step/StepForm.js +0 -0
  356. package/{esm → dist/esm}/Questions/Step/StepQuote.js +0 -0
  357. package/{esm → dist/esm}/Questions/Step/StepTitle.js +0 -0
  358. package/{esm → dist/esm}/Questions/Step/getAddMoreFields.js +0 -0
  359. package/{esm → dist/esm}/Questions/Step/index.js +0 -0
  360. package/{esm → dist/esm}/Questions/Step/types.js +0 -0
  361. package/{esm → dist/esm}/Questions/__snapshots__/index.spec.tsx.snap +0 -0
  362. package/{esm → dist/esm}/Questions/getNextStep.js +0 -0
  363. package/{esm → dist/esm}/Questions/index.js +0 -0
  364. package/{esm → dist/esm}/Questions/index.mdx +0 -0
  365. package/{esm → dist/esm}/Questions/index.spec.js +0 -0
  366. package/{esm → dist/esm}/Questions/types.js +0 -0
  367. package/{esm → dist/esm}/__stories__/AutoCompleteField.js +0 -0
  368. package/{esm → dist/esm}/__stories__/IntField.js +0 -0
  369. package/{esm → dist/esm}/create-simple-form.mdx +0 -0
  370. package/{esm → dist/esm}/index.js +1 -1
  371. package/{esm → dist/esm}/index.mdx +0 -0
  372. package/{esm → dist/esm}/inputs/AutoComplete/index.js +0 -0
  373. package/{esm → dist/esm}/inputs/Checkboxes/Checkboxes.stories.js +0 -0
  374. package/{esm → dist/esm}/inputs/Checkboxes/Checkboxes.stories.playwright.json +0 -0
  375. package/{esm → dist/esm}/inputs/Checkboxes/__stories__/Default.js +0 -0
  376. package/{esm → dist/esm}/inputs/Checkboxes/index.js +0 -0
  377. package/{esm/inputs/Label → dist/esm/inputs/Checkboxes}/index.mdx +0 -0
  378. package/{esm → dist/esm}/inputs/DateInput/DateInput.stories.js +0 -0
  379. package/{esm → dist/esm}/inputs/DateInput/DateInput.stories.playwright.json +0 -0
  380. package/{esm → dist/esm}/inputs/DateInput/__stories__/Default.js +0 -0
  381. package/{es → dist/esm}/inputs/DateInput/index.js +2 -2
  382. package/{esm → dist/esm}/inputs/FileInput/FileInput.stories.js +0 -0
  383. package/{esm → dist/esm}/inputs/FileInput/FileInput.stories.playwright.json +0 -0
  384. package/{esm → dist/esm}/inputs/FileInput/__stories__/Default.js +0 -0
  385. package/{esm → dist/esm}/inputs/FileInput/index.js +0 -0
  386. package/{esm → dist/esm}/inputs/Input/Input.stories.js +0 -0
  387. package/{esm → dist/esm}/inputs/Input/Input.stories.playwright.json +0 -0
  388. package/{esm → dist/esm}/inputs/Input/__stories__/AFM.js +0 -0
  389. package/{esm → dist/esm}/inputs/Input/__stories__/Boolean.js +0 -0
  390. package/{esm → dist/esm}/inputs/Input/__stories__/Default.js +0 -0
  391. package/{esm → dist/esm}/inputs/Input/__stories__/IBAN.js +0 -0
  392. package/{esm → dist/esm}/inputs/Input/__stories__/Integer.js +0 -0
  393. package/{esm → dist/esm}/inputs/Input/__stories__/MobilePhone.js +0 -0
  394. package/{esm → dist/esm}/inputs/Input/__stories__/PhoneNumber.js +0 -0
  395. package/{esm → dist/esm}/inputs/Input/__stories__/PostalCode.js +0 -0
  396. package/{esm → dist/esm}/inputs/Input/index.js +0 -0
  397. package/{esm → dist/esm}/inputs/Input/index.mdx +0 -0
  398. package/{esm → dist/esm}/inputs/Label/Label.stories.js +0 -0
  399. package/{esm → dist/esm}/inputs/Label/Label.stories.playwright.json +0 -0
  400. package/{esm → dist/esm}/inputs/Label/__stories__/Default.js +0 -0
  401. package/{esm → dist/esm}/inputs/Label/index.js +0 -0
  402. package/{esm/inputs/Radio → dist/esm/inputs/Label}/index.mdx +0 -0
  403. package/{esm → dist/esm}/inputs/Radio/Radio.stories.js +0 -0
  404. package/{esm → dist/esm}/inputs/Radio/Radio.stories.playwright.json +0 -0
  405. package/{esm → dist/esm}/inputs/Radio/__stories__/Default.js +0 -0
  406. package/{esm → dist/esm}/inputs/Radio/index.js +2 -2
  407. package/{inputs/Checkboxes → dist/esm/inputs/Radio}/index.mdx +0 -0
  408. package/{esm → dist/esm}/inputs/Select/Select.stories.js +0 -0
  409. package/{esm → dist/esm}/inputs/Select/Select.stories.playwright.json +0 -0
  410. package/{esm → dist/esm}/inputs/Select/__stories__/Default.js +0 -0
  411. package/{es → dist/esm}/inputs/Select/index.js +2 -2
  412. package/{esm → dist/esm}/inputs/index.js +0 -0
  413. package/{esm → dist/esm}/installation.mdx +0 -0
  414. package/{esm → dist/esm}/internal.js +0 -0
  415. package/{es → dist/esm}/registry.js +2 -2
  416. package/{esm → dist/esm}/types.js +0 -0
  417. package/{esm → dist/esm}/utils.js +0 -0
  418. package/{esm → dist/esm}/validators/index.js +0 -0
  419. package/{esm → dist/esm}/validators/types.js +0 -0
  420. package/{esm → dist/esm}/validators/utils/afm.js +0 -0
  421. package/{esm → dist/esm}/validators/utils/file.js +0 -0
  422. package/{esm → dist/esm}/validators/utils/iban.js +0 -0
  423. package/{esm → dist/esm}/validators/utils/index.js +0 -0
  424. package/{esm → dist/esm}/validators/utils/int.js +0 -0
  425. package/{esm → dist/esm}/validators/utils/number.js +0 -0
  426. package/{esm → dist/esm}/validators/utils/phone.js +0 -0
  427. package/{esm → dist/esm}/validators/utils/postal_code.js +0 -0
  428. package/{esm → dist/esm}/validators/utils/uuid4.js +0 -0
  429. package/{esm → dist/esm}/validators/validators.spec.js +0 -0
  430. package/{index.d.ts → dist/index.d.ts} +0 -0
  431. package/{index.js → dist/index.js} +0 -0
  432. package/{index.mdx → dist/index.mdx} +0 -0
  433. package/{inputs → dist/inputs}/AutoComplete/index.d.ts +0 -0
  434. package/{inputs → dist/inputs}/AutoComplete/index.js +0 -0
  435. package/{inputs → dist/inputs}/Checkboxes/Checkboxes.stories.d.ts +0 -0
  436. package/{inputs → dist/inputs}/Checkboxes/Checkboxes.stories.js +0 -0
  437. package/{inputs → dist/inputs}/Checkboxes/Checkboxes.stories.playwright.json +0 -0
  438. package/{inputs → dist/inputs}/Checkboxes/__stories__/Default.d.ts +0 -0
  439. package/{inputs → dist/inputs}/Checkboxes/__stories__/Default.js +0 -0
  440. package/{inputs → dist/inputs}/Checkboxes/index.d.ts +0 -0
  441. package/{inputs → dist/inputs}/Checkboxes/index.js +0 -0
  442. package/{inputs/Label → dist/inputs/Checkboxes}/index.mdx +0 -0
  443. package/{inputs → dist/inputs}/DateInput/DateInput.stories.d.ts +0 -0
  444. package/{inputs → dist/inputs}/DateInput/DateInput.stories.js +0 -0
  445. package/{inputs → dist/inputs}/DateInput/DateInput.stories.playwright.json +0 -0
  446. package/{inputs → dist/inputs}/DateInput/__stories__/Default.d.ts +0 -0
  447. package/{inputs → dist/inputs}/DateInput/__stories__/Default.js +0 -0
  448. package/{inputs → dist/inputs}/DateInput/index.d.ts +0 -0
  449. package/{inputs → dist/inputs}/DateInput/index.js +2 -2
  450. package/{inputs → dist/inputs}/FileInput/FileInput.stories.d.ts +0 -0
  451. package/{inputs → dist/inputs}/FileInput/FileInput.stories.js +0 -0
  452. package/{inputs → dist/inputs}/FileInput/FileInput.stories.playwright.json +0 -0
  453. package/{inputs → dist/inputs}/FileInput/__stories__/Default.d.ts +0 -0
  454. package/{inputs → dist/inputs}/FileInput/__stories__/Default.js +0 -0
  455. package/{inputs → dist/inputs}/FileInput/index.d.ts +0 -0
  456. package/{inputs → dist/inputs}/FileInput/index.js +0 -0
  457. package/{inputs → dist/inputs}/Input/Input.stories.d.ts +0 -0
  458. package/{inputs → dist/inputs}/Input/Input.stories.js +0 -0
  459. package/{inputs → dist/inputs}/Input/Input.stories.playwright.json +0 -0
  460. package/{inputs → dist/inputs}/Input/__stories__/AFM.d.ts +0 -0
  461. package/{inputs → dist/inputs}/Input/__stories__/AFM.js +0 -0
  462. package/{inputs → dist/inputs}/Input/__stories__/Boolean.d.ts +0 -0
  463. package/{inputs → dist/inputs}/Input/__stories__/Boolean.js +0 -0
  464. package/{inputs → dist/inputs}/Input/__stories__/Default.d.ts +0 -0
  465. package/{inputs → dist/inputs}/Input/__stories__/Default.js +0 -0
  466. package/{inputs → dist/inputs}/Input/__stories__/IBAN.d.ts +0 -0
  467. package/{inputs → dist/inputs}/Input/__stories__/IBAN.js +0 -0
  468. package/{inputs → dist/inputs}/Input/__stories__/Integer.d.ts +0 -0
  469. package/{inputs → dist/inputs}/Input/__stories__/Integer.js +0 -0
  470. package/{inputs → dist/inputs}/Input/__stories__/MobilePhone.d.ts +0 -0
  471. package/{inputs → dist/inputs}/Input/__stories__/MobilePhone.js +0 -0
  472. package/{inputs → dist/inputs}/Input/__stories__/PhoneNumber.d.ts +0 -0
  473. package/{inputs → dist/inputs}/Input/__stories__/PhoneNumber.js +0 -0
  474. package/{inputs → dist/inputs}/Input/__stories__/PostalCode.d.ts +0 -0
  475. package/{inputs → dist/inputs}/Input/__stories__/PostalCode.js +0 -0
  476. package/{inputs → dist/inputs}/Input/index.d.ts +0 -0
  477. package/{inputs → dist/inputs}/Input/index.js +0 -0
  478. package/{inputs → dist/inputs}/Input/index.mdx +0 -0
  479. package/{inputs → dist/inputs}/Label/Label.stories.d.ts +0 -0
  480. package/{inputs → dist/inputs}/Label/Label.stories.js +0 -0
  481. package/{inputs → dist/inputs}/Label/Label.stories.playwright.json +0 -0
  482. package/{inputs → dist/inputs}/Label/__stories__/Default.d.ts +0 -0
  483. package/{inputs → dist/inputs}/Label/__stories__/Default.js +0 -0
  484. package/{inputs → dist/inputs}/Label/index.d.ts +0 -0
  485. package/{inputs → dist/inputs}/Label/index.js +0 -0
  486. package/{inputs/Radio → dist/inputs/Label}/index.mdx +0 -0
  487. package/{inputs → dist/inputs}/Radio/Radio.stories.d.ts +0 -0
  488. package/{inputs → dist/inputs}/Radio/Radio.stories.js +0 -0
  489. package/{inputs → dist/inputs}/Radio/Radio.stories.playwright.json +0 -0
  490. package/{inputs → dist/inputs}/Radio/__stories__/Default.d.ts +0 -0
  491. package/{inputs → dist/inputs}/Radio/__stories__/Default.js +0 -0
  492. package/{inputs → dist/inputs}/Radio/index.d.ts +0 -0
  493. package/{inputs → dist/inputs}/Radio/index.js +2 -2
  494. package/dist/inputs/Radio/index.mdx +0 -0
  495. package/{inputs → dist/inputs}/Select/Select.stories.d.ts +0 -0
  496. package/{inputs → dist/inputs}/Select/Select.stories.js +0 -0
  497. package/{inputs → dist/inputs}/Select/Select.stories.playwright.json +0 -0
  498. package/{inputs → dist/inputs}/Select/__stories__/Default.d.ts +0 -0
  499. package/{inputs → dist/inputs}/Select/__stories__/Default.js +0 -0
  500. package/{inputs → dist/inputs}/Select/index.d.ts +0 -0
  501. package/{inputs → dist/inputs}/Select/index.js +2 -2
  502. package/{inputs → dist/inputs}/index.d.ts +0 -0
  503. package/{inputs → dist/inputs}/index.js +0 -0
  504. package/{installation.mdx → dist/installation.mdx} +0 -0
  505. package/{internal.d.ts → dist/internal.d.ts} +0 -0
  506. package/{internal.js → dist/internal.js} +0 -0
  507. package/dist/package.json +31 -0
  508. package/{registry.d.ts → dist/registry.d.ts} +1 -1
  509. package/{registry.js → dist/registry.js} +3 -3
  510. package/{types.d.ts → dist/types.d.ts} +0 -0
  511. package/{types.js → dist/types.js} +0 -0
  512. package/{utils.d.ts → dist/utils.d.ts} +0 -0
  513. package/{utils.js → dist/utils.js} +0 -0
  514. package/{validators → dist/validators}/index.d.ts +0 -0
  515. package/{validators → dist/validators}/index.js +0 -0
  516. package/{validators → dist/validators}/types.d.ts +0 -0
  517. package/{validators → dist/validators}/types.js +0 -0
  518. package/{validators → dist/validators}/utils/afm.d.ts +0 -0
  519. package/{validators → dist/validators}/utils/afm.js +0 -0
  520. package/{validators → dist/validators}/utils/file.d.ts +0 -0
  521. package/{validators → dist/validators}/utils/file.js +0 -0
  522. package/{validators → dist/validators}/utils/iban.d.ts +0 -0
  523. package/{validators → dist/validators}/utils/iban.js +0 -0
  524. package/{validators → dist/validators}/utils/index.d.ts +0 -0
  525. package/{validators → dist/validators}/utils/index.js +0 -0
  526. package/{validators → dist/validators}/utils/int.d.ts +0 -0
  527. package/{validators → dist/validators}/utils/int.js +0 -0
  528. package/{validators → dist/validators}/utils/number.d.ts +0 -0
  529. package/{validators → dist/validators}/utils/number.js +0 -0
  530. package/{validators → dist/validators}/utils/phone.d.ts +0 -0
  531. package/{validators → dist/validators}/utils/phone.js +0 -0
  532. package/{validators → dist/validators}/utils/postal_code.d.ts +0 -0
  533. package/{validators → dist/validators}/utils/postal_code.js +0 -0
  534. package/{validators → dist/validators}/utils/uuid4.d.ts +0 -0
  535. package/{validators → dist/validators}/utils/uuid4.js +0 -0
  536. package/{validators → dist/validators}/validators.spec.d.ts +0 -0
  537. package/{validators → dist/validators}/validators.spec.js +0 -0
  538. package/docs/index.mdx +6 -0
  539. package/form.build.log +16 -0
  540. package/package.json +31 -10
  541. package/src/Field/FieldBase.tsx +99 -0
  542. package/src/Field/FieldBaseContainer.tsx +57 -0
  543. package/src/Field/FieldConditional.tsx +75 -0
  544. package/src/Field/index.mdx +6 -0
  545. package/src/Field/index.tsx +92 -0
  546. package/src/Field/types.tsx +102 -0
  547. package/src/Field/utils.ts +164 -0
  548. package/src/FieldArray/FieldArray.stories.js +7 -0
  549. package/src/FieldArray/FieldArray.stories.playwright.json +353 -0
  550. package/src/FieldArray/__stories__/Default.tsx +95 -0
  551. package/src/FieldArray/__stories__/WithExactLength.tsx +95 -0
  552. package/src/FieldArray/index.tsx +83 -0
  553. package/src/FieldObject/index.tsx +92 -0
  554. package/src/Fieldset/FieldsetWithContext.tsx +41 -0
  555. package/src/Fieldset/index.tsx +40 -0
  556. package/src/Fieldset/types.tsx +6 -0
  557. package/src/Form.stories.js +5 -0
  558. package/src/Form.stories.playwright.json +143 -0
  559. package/src/FormBuilder/FormBuilder.mdx +271 -0
  560. package/src/FormBuilder/FormBuilder.stories.js +6 -0
  561. package/src/FormBuilder/FormBuilder.stories.playwright.json +52 -0
  562. package/src/FormBuilder/FormBuilder.tsx +165 -0
  563. package/src/FormBuilder/__stories__/Default.tsx +23 -0
  564. package/src/FormBuilder/index.tsx +3 -0
  565. package/src/FormContext.tsx +8 -0
  566. package/src/MultiplicityField/MultiplicityField.mdx +580 -0
  567. package/src/MultiplicityField/MultiplicityField.stories.js +11 -0
  568. package/src/MultiplicityField/MultiplicityField.stories.playwright.json +1370 -0
  569. package/src/MultiplicityField/__stories__/Default.tsx +100 -0
  570. package/src/MultiplicityField/__stories__/PreviewDisplay.tsx +160 -0
  571. package/src/MultiplicityField/__stories__/WithExactLength.tsx +99 -0
  572. package/src/MultiplicityField/__stories__/WithMaxLength.tsx +102 -0
  573. package/src/MultiplicityField/__stories__/WithMinAndMaxLength.tsx +103 -0
  574. package/src/MultiplicityField/__stories__/WithMinLength.tsx +102 -0
  575. package/src/MultiplicityField/add-objects.tsx +186 -0
  576. package/src/MultiplicityField/index.tsx +166 -0
  577. package/src/Questions/Questions.tsx +74 -0
  578. package/src/Questions/QuestionsContext.tsx +9 -0
  579. package/src/Questions/Step/ReviewStep.tsx +63 -0
  580. package/src/Questions/Step/Step.tsx +67 -0
  581. package/src/Questions/Step/StepArrayReview.tsx +68 -0
  582. package/src/Questions/Step/StepContext.tsx +21 -0
  583. package/src/Questions/Step/StepDescription.tsx +33 -0
  584. package/src/Questions/Step/StepForm.tsx +60 -0
  585. package/src/Questions/Step/StepQuote.tsx +8 -0
  586. package/src/Questions/Step/StepTitle.tsx +60 -0
  587. package/src/Questions/Step/getAddMoreFields.tsx +28 -0
  588. package/src/Questions/Step/index.ts +13 -0
  589. package/src/Questions/Step/types.tsx +32 -0
  590. package/src/Questions/__snapshots__/index.spec.tsx.snap +887 -0
  591. package/src/Questions/getNextStep.tsx +24 -0
  592. package/src/Questions/index.mdx +13 -0
  593. package/src/Questions/index.spec.tsx +72 -0
  594. package/src/Questions/index.tsx +5 -0
  595. package/src/Questions/types.tsx +25 -0
  596. package/src/__stories__/AutoCompleteField.tsx +45 -0
  597. package/src/__stories__/IntField.tsx +38 -0
  598. package/src/create-simple-form.mdx +518 -0
  599. package/src/index.mdx +44 -0
  600. package/src/index.ts +3 -0
  601. package/src/inputs/AutoComplete/index.tsx +85 -0
  602. package/src/inputs/Checkboxes/Checkboxes.stories.js +6 -0
  603. package/src/inputs/Checkboxes/Checkboxes.stories.playwright.json +69 -0
  604. package/src/inputs/Checkboxes/__stories__/Default.tsx +39 -0
  605. package/src/inputs/Checkboxes/index.mdx +0 -0
  606. package/src/inputs/Checkboxes/index.tsx +77 -0
  607. package/src/inputs/DateInput/DateInput.stories.js +6 -0
  608. package/src/inputs/DateInput/DateInput.stories.playwright.json +72 -0
  609. package/src/inputs/DateInput/__stories__/Default.tsx +41 -0
  610. package/src/inputs/DateInput/index.tsx +130 -0
  611. package/src/inputs/FileInput/FileInput.stories.js +6 -0
  612. package/src/inputs/FileInput/FileInput.stories.playwright.json +75 -0
  613. package/src/inputs/FileInput/__stories__/Default.tsx +23 -0
  614. package/src/inputs/FileInput/index.tsx +76 -0
  615. package/src/inputs/Input/Input.stories.js +13 -0
  616. package/src/inputs/Input/Input.stories.playwright.json +376 -0
  617. package/src/inputs/Input/__stories__/AFM.tsx +24 -0
  618. package/src/inputs/Input/__stories__/Boolean.tsx +26 -0
  619. package/src/inputs/Input/__stories__/Default.tsx +25 -0
  620. package/src/inputs/Input/__stories__/IBAN.tsx +26 -0
  621. package/src/inputs/Input/__stories__/Integer.tsx +25 -0
  622. package/src/inputs/Input/__stories__/MobilePhone.tsx +24 -0
  623. package/src/inputs/Input/__stories__/PhoneNumber.tsx +24 -0
  624. package/src/inputs/Input/__stories__/PostalCode.tsx +25 -0
  625. package/src/inputs/Input/index.mdx +8 -0
  626. package/src/inputs/Input/index.tsx +62 -0
  627. package/src/inputs/Label/Label.stories.js +6 -0
  628. package/src/inputs/Label/Label.stories.playwright.json +40 -0
  629. package/src/inputs/Label/__stories__/Default.tsx +28 -0
  630. package/src/inputs/Label/index.mdx +0 -0
  631. package/src/inputs/Label/index.tsx +44 -0
  632. package/src/inputs/Radio/Radio.stories.js +6 -0
  633. package/src/inputs/Radio/Radio.stories.playwright.json +57 -0
  634. package/src/inputs/Radio/__stories__/Default.tsx +42 -0
  635. package/src/inputs/Radio/index.mdx +0 -0
  636. package/src/inputs/Radio/index.tsx +57 -0
  637. package/src/inputs/Select/Select.stories.js +6 -0
  638. package/src/inputs/Select/Select.stories.playwright.json +22 -0
  639. package/src/inputs/Select/__stories__/Default.tsx +47 -0
  640. package/src/inputs/Select/index.tsx +37 -0
  641. package/src/inputs/index.ts +7 -0
  642. package/src/installation.mdx +72 -0
  643. package/src/internal.ts +34 -0
  644. package/src/registry.js +134 -0
  645. package/src/types.tsx +110 -0
  646. package/src/utils.ts +78 -0
  647. package/src/validators/index.ts +203 -0
  648. package/src/validators/types.ts +2 -0
  649. package/src/validators/utils/afm.ts +37 -0
  650. package/src/validators/utils/file.ts +25 -0
  651. package/src/validators/utils/iban.ts +119 -0
  652. package/src/validators/utils/index.ts +94 -0
  653. package/src/validators/utils/int.ts +22 -0
  654. package/src/validators/utils/number.ts +18 -0
  655. package/src/validators/utils/phone.ts +120 -0
  656. package/src/validators/utils/postal_code.ts +33 -0
  657. package/src/validators/utils/uuid4.ts +21 -0
  658. package/src/validators/validators.spec.ts +122 -0
  659. package/tsconfig.json +14 -0
  660. package/tsconfig.production.json +49 -0
  661. package/Field/FieldContainer.d.ts +0 -4
@@ -0,0 +1,186 @@
1
+ /* eslint-disable react/prop-types */
2
+ import React, { useEffect, useMemo } from 'react';
3
+ // import { FormBuilderProps } from '@digigov/form';
4
+ import Button from '@digigov/ui/core/Button';
5
+ import Fieldset from '@digigov/react-core/Fieldset';
6
+ import RadioConditional from '@digigov/react-core/RadioConditional';
7
+ import {
8
+ ErrorOption,
9
+ FieldArrayWithId,
10
+ UseFieldArrayReturn,
11
+ useWatch,
12
+ } from 'react-hook-form';
13
+ import { FieldBase } from '@digigov/form/Field/FieldBase';
14
+ import { CalculatedField } from '@digigov/form/Field/types';
15
+ import { calculateField, useField } from '@digigov/form/Field/utils';
16
+ import FieldObject from '@digigov/form/FieldObject';
17
+ import {
18
+ MultiplicityProps,
19
+ StashedObject,
20
+ } from '@digigov/form/MultiplicityField';
21
+ import { FieldSpec } from '@digigov/form/types';
22
+ export interface AddObjectsProps
23
+ extends Omit<MultiplicityProps, 'key' | 'component'> {
24
+ fields: FieldArrayWithId[];
25
+ error?: ErrorOption;
26
+ append: UseFieldArrayReturn['append'];
27
+ remove: UseFieldArrayReturn['remove'];
28
+ stashedObjects: StashedObject[];
29
+ onStash: (arg0: StashedObject) => void;
30
+ }
31
+
32
+ export const AddObjects: React.FC<AddObjectsProps> = ({
33
+ name,
34
+ fields,
35
+ formState,
36
+ extra,
37
+ append,
38
+ remove,
39
+ trigger,
40
+ clearErrors,
41
+ children,
42
+ setValue,
43
+ stashedObjects,
44
+ getValues,
45
+ onStash,
46
+ error,
47
+ }) => {
48
+ const currentIndex = fields.length > 0 ? fields.length - 1 : fields.length;
49
+ const currentName = `${name}.${currentIndex}`;
50
+ const radioField: FieldSpec = {
51
+ key: 'needs-more',
52
+ type: 'choice:single',
53
+ label: {
54
+ primary: extra?.label.question.title,
55
+ },
56
+ required: true,
57
+ validators: [
58
+ {
59
+ name: 'is-locked',
60
+ message: 'form.error.needs-more',
61
+ test: (data) => {
62
+ return data === 'no';
63
+ },
64
+ },
65
+ ],
66
+ extra: {
67
+ options: [
68
+ {
69
+ label: { primary: extra?.label.question.yes },
70
+ value: 'yes',
71
+ selected: function RadioSelected() {
72
+ return (
73
+ <RadioConditional
74
+ hidden={
75
+ needsMore !== 'yes' ||
76
+ (extra?.max && extra?.max - stashedObjects.length === 0)
77
+ }
78
+ >
79
+ {needsMore === 'yes' && fields.length > 0 && (
80
+ <>
81
+ <FieldObject
82
+ name={currentName}
83
+ error={error && error[currentIndex]}
84
+ register={register}
85
+ formState={formState}
86
+ control={control}
87
+ {...extra?.of}
88
+ label={
89
+ extra?.label.question.objectLabel || extra?.of.label
90
+ }
91
+ />
92
+ <Button
93
+ color="secondary"
94
+ onClick={async (e) => {
95
+ e.preventDefault();
96
+ const nestedFields = extra?.of.extra.fields.map(
97
+ (f) => `${currentName}.${f.key}`
98
+ );
99
+ const result = await trigger(nestedFields);
100
+ result && setValue('needs-more', '');
101
+ result && onStash(getValues(currentName));
102
+ }}
103
+ >
104
+ {extra?.label.object.add}
105
+ </Button>
106
+ </>
107
+ )}
108
+ </RadioConditional>
109
+ );
110
+ },
111
+ },
112
+ {
113
+ label: { primary: extra?.label.question.no },
114
+ value: 'no',
115
+ },
116
+ ],
117
+ },
118
+ };
119
+
120
+ const { field, control, register, reset, error: needsMoreError } = useField(
121
+ radioField.key,
122
+ radioField?.type ? radioField : null
123
+ );
124
+
125
+ const calculatedField: CalculatedField = useMemo(
126
+ () => calculateField(children, field),
127
+ [field]
128
+ );
129
+ const needsMore = useWatch({ name: field.key, control });
130
+
131
+ useEffect(() => {
132
+ if (needsMore === 'yes') {
133
+ append({ afm: '', firstName: '', lastName: '' });
134
+ }
135
+ if (needsMore === 'no' && stashedObjects.length < fields.length) {
136
+ remove(currentIndex);
137
+ }
138
+ if (needsMore === '') clearErrors('needs-more');
139
+ }, [needsMore]);
140
+
141
+ // TODO: Refactor types so that label is always required, the following
142
+ // assignment is a temp fix for typescript build to run
143
+ calculatedField.label = calculatedField.label || {};
144
+ if (extra?.length) {
145
+ calculatedField.label.secondary = `Έχετε προσθέσει ${
146
+ stashedObjects.length
147
+ } εγγραφές και σας απομένουν ακόμα ${
148
+ extra.length - stashedObjects.length
149
+ } εγγραφές.`;
150
+ } else if (extra?.min && extra?.max) {
151
+ calculatedField.label.secondary = `Το πεδίο πρέπει να έχει ακόμα ${
152
+ extra?.min - stashedObjects.length
153
+ } και το μέγιστο ${
154
+ extra?.max
155
+ } εγγραφές. Προσθέστε μια ακόμα επιλέγοντας την απάντηση «Ναι» στην επόμενη ερώτηση.`;
156
+ } else if (extra?.min) {
157
+ calculatedField.label.secondary = `Το πεδίο πρέπει να έχει ακόμα ${
158
+ extra?.min - stashedObjects.length
159
+ } εγγραφές. Προσθέστε μια ακόμα επιλέγοντας την απάντηση «Ναι» στην επόμενη ερώτηση.`;
160
+ } else if (extra?.max) {
161
+ calculatedField.label.secondary = ` Έχετε προσθέσει ${
162
+ stashedObjects.length
163
+ } εγγραφές και σας απομένουν ${
164
+ extra.max - stashedObjects.length
165
+ } επιπλέον εγγραφές.`;
166
+ }
167
+ return (
168
+ <Fieldset>
169
+ <FieldBase
170
+ {...calculatedField}
171
+ name={calculatedField.key}
172
+ control={control}
173
+ register={register}
174
+ reset={reset}
175
+ error={
176
+ extra?.max - stashedObjects.length === 0 ||
177
+ extra?.length - stashedObjects.length === 0
178
+ ? error
179
+ : needsMoreError
180
+ }
181
+ />
182
+ </Fieldset>
183
+ );
184
+ };
185
+
186
+ export default AddObjects;
@@ -0,0 +1,166 @@
1
+ import React, { useState } from 'react';
2
+ import { ControlledFieldProps } from '@digigov/form/Field/types';
3
+ import {
4
+ Card,
5
+ CardText,
6
+ CardAction,
7
+ Button,
8
+ Heading,
9
+ CardHeading,
10
+ } from '@digigov/react-core';
11
+ import { FieldSpec } from '@digigov/form';
12
+ import AddObjects from '@digigov/form/MultiplicityField/add-objects';
13
+ import { ErrorOption, useFieldArray, UseFormReturn } from 'react-hook-form';
14
+ import FieldObject from '@digigov/form/FieldObject';
15
+ import FieldContainer from '@digigov/form/Field/FieldBaseContainer';
16
+
17
+ export interface MultiplicityProps
18
+ extends Omit<ControlledFieldProps, 'value' | 'onChange' | 'error' | 'extra'> {
19
+ name: string;
20
+ control: UseFormReturn['control'];
21
+ register: UseFormReturn['register'];
22
+ trigger: UseFormReturn['trigger'];
23
+ clearErrors: UseFormReturn['clearErrors'];
24
+ formState: UseFormReturn['formState'];
25
+ setValue: UseFormReturn['setValue'];
26
+ getValues: UseFormReturn['getValues'];
27
+ unregister: UseFormReturn['unregister'];
28
+ error?: ErrorOption;
29
+ extra?: Record<string, any>;
30
+ label?: FieldSpec['label'];
31
+ layout?: FieldSpec['layout'];
32
+ }
33
+
34
+ export type StashedObject = Record<string, any>;
35
+
36
+ // epeidh einai forwardRef to ref mas to dinei xwrista apo ta props
37
+ export const Multiplicity: React.FC<MultiplicityProps> = ({
38
+ extra,
39
+ name,
40
+ control,
41
+ error,
42
+ register,
43
+ trigger,
44
+ clearErrors,
45
+ formState,
46
+ label,
47
+ layout,
48
+ setValue,
49
+ getValues,
50
+ unregister,
51
+ }) => {
52
+ const { fields, append, remove } = useFieldArray({
53
+ control,
54
+ name,
55
+ });
56
+ const [stashedObjects, setStashedObjects] = useState<StashedObject[]>([]);
57
+ const handleStash = (data) => {
58
+ setStashedObjects([...stashedObjects, data]);
59
+ };
60
+ const handleDelete = (index) => {
61
+ remove(index);
62
+ // creating a new array to maintain immutability
63
+ const newStashedObjects = [...stashedObjects];
64
+ newStashedObjects.splice(index, 1);
65
+ setStashedObjects(newStashedObjects);
66
+ };
67
+ return (
68
+ <FieldContainer
69
+ label={label}
70
+ layout={layout}
71
+ error={
72
+ formState.isSubmitted && !formState.isSubmitting && error?.message
73
+ ? error
74
+ : undefined
75
+ }
76
+ wrapper="fieldset"
77
+ name={name}
78
+ >
79
+ {stashedObjects.length > 0 ? (
80
+ <div>
81
+ <Heading size="m">{extra?.label.object.title_added}</Heading>
82
+ {stashedObjects.map((_Object, index) => {
83
+ return (
84
+ <ListObject
85
+ key={`${name}.${index}`}
86
+ index={index}
87
+ name={name}
88
+ extra={extra}
89
+ control={control}
90
+ register={register}
91
+ formState={formState}
92
+ onDelete={handleDelete}
93
+ />
94
+ );
95
+ })}
96
+ </div>
97
+ ) : (
98
+ ''
99
+ )}
100
+ <AddObjects
101
+ name={name}
102
+ register={register}
103
+ control={control}
104
+ fields={fields}
105
+ formState={formState}
106
+ error={error}
107
+ stashedObjects={stashedObjects}
108
+ extra={extra}
109
+ append={append}
110
+ remove={remove}
111
+ onStash={handleStash}
112
+ setValue={setValue}
113
+ getValues={getValues}
114
+ unregister={unregister}
115
+ trigger={trigger}
116
+ clearErrors={clearErrors}
117
+ />
118
+ </FieldContainer>
119
+ );
120
+ };
121
+
122
+ export default Multiplicity;
123
+
124
+ export interface ListObjectProps {
125
+ index: number;
126
+ name: string;
127
+ control: UseFormReturn['control'];
128
+ register: UseFormReturn['register'];
129
+ formState: UseFormReturn['formState'];
130
+ onDelete: (index: number) => void;
131
+ extra?: Record<string, any>;
132
+ }
133
+
134
+ export const ListObject: React.FC<ListObjectProps> = ({
135
+ index,
136
+ name,
137
+ extra,
138
+ control,
139
+ register,
140
+ onDelete,
141
+ formState,
142
+ // onEdit,
143
+ }) => {
144
+ const currentName = `${name}.${index}`;
145
+ return (
146
+ <Card variant={extra?.border && 'border'}>
147
+ <CardHeading>
148
+ {extra?.label.object.title} #{index + 1}
149
+ </CardHeading>
150
+ <CardText>
151
+ <FieldObject
152
+ name={currentName}
153
+ formState={formState}
154
+ register={register}
155
+ control={control}
156
+ {...extra?.of}
157
+ />
158
+ </CardText>
159
+ <CardAction>
160
+ <Button type="button" variant="link" onClick={() => onDelete(index)}>
161
+ {extra?.label.object.delete}
162
+ </Button>
163
+ </CardAction>
164
+ </Card>
165
+ );
166
+ };
@@ -0,0 +1,74 @@
1
+ import React, { useState, useEffect } from 'react';
2
+ import { StepInterface } from '@digigov/form/Questions/Step/types';
3
+ import { QuestionsInterface } from '@digigov/form/Questions/types';
4
+ import { QuestionsContext } from '@digigov/form/Questions/QuestionsContext';
5
+ import { getNextStep } from '@digigov/form/Questions/getNextStep';
6
+
7
+ const isBrowser = typeof window !== 'undefined';
8
+
9
+ /**
10
+ * The Question component accepts question data as props
11
+ * uses composable components to provide a wholesome UX
12
+ *
13
+ */
14
+ export const Questions: React.FC<QuestionsInterface> = ({
15
+ name,
16
+ steps,
17
+ initialData = {},
18
+ onChange,
19
+ onSubmit,
20
+ onActiveStep,
21
+ forceStepName,
22
+ localDraft = false,
23
+ children,
24
+ }) => {
25
+ const [currentStep, setCurrentStep] = useState<StepInterface>({ name: '' });
26
+ useEffect(() => {
27
+ if (!forceStepName) {
28
+ setCurrentStep(steps[0]);
29
+ }
30
+ }, [forceStepName, steps]);
31
+ useEffect(() => {
32
+ if (forceStepName !== currentStep.name) {
33
+ const forceStep = steps.find(({ name }) => name === forceStepName);
34
+ forceStep && setCurrentStep(forceStep);
35
+ }
36
+ }, [forceStepName]);
37
+ const localData =
38
+ isBrowser && localDraft && window.localStorage.getItem(`questions-${name}`);
39
+ const [data, setData] = useState(
40
+ (localData && JSON.parse(localData)) || initialData
41
+ );
42
+ const submitStep = (stepName, stepData): void => {
43
+ data[stepName] = stepData;
44
+ if (localDraft) {
45
+ isBrowser &&
46
+ window.localStorage.setItem(`questions-${name}`, JSON.stringify(data));
47
+ }
48
+ if (onChange) {
49
+ onChange && onChange(data);
50
+ }
51
+ setData(data);
52
+ const nextStep = getNextStep(currentStep, steps, data);
53
+ if (nextStep) {
54
+ onActiveStep && onActiveStep(nextStep);
55
+ setCurrentStep(nextStep);
56
+ } else {
57
+ onSubmit(data);
58
+ }
59
+ };
60
+
61
+ return (
62
+ <QuestionsContext.Provider
63
+ value={{
64
+ steps,
65
+ currentStep,
66
+ submitStep,
67
+ data,
68
+ onActiveStep,
69
+ }}
70
+ >
71
+ {children}
72
+ </QuestionsContext.Provider>
73
+ );
74
+ };
@@ -0,0 +1,9 @@
1
+ import { createContext } from 'react';
2
+ import { QuestionsContextInterface } from '@digigov/form/Questions/types';
3
+
4
+ const defaultStep = { name: '' };
5
+ export const QuestionsContext = createContext<QuestionsContextInterface>({
6
+ currentStep: defaultStep,
7
+ steps: [],
8
+ submitStep: () => null,
9
+ });
@@ -0,0 +1,63 @@
1
+ import React, { useContext } from 'react';
2
+ import {
3
+ SummaryList,
4
+ SummaryListItem,
5
+ SummaryListItemKey,
6
+ SummaryListItemValue,
7
+ SummaryListItemAction,
8
+ } from '@digigov/ui/core/SummaryList';
9
+ import Title from '@digigov/ui/typography/Title';
10
+ import { Button } from '@digigov/ui/core';
11
+ import { QuestionsContext } from '@digigov/form/Questions/QuestionsContext';
12
+ import { StepTitleBase } from '@digigov/form/Questions/Step/StepTitle';
13
+ import { StepContext } from '@digigov/form/Questions/Step/StepContext';
14
+ import { useTranslation } from '@digigov/ui/app/i18n';
15
+
16
+ export const ReviewStep = (): React.ReactElement => {
17
+ const { t } = useTranslation();
18
+ const { submitStep, title } = useContext(StepContext);
19
+ const { data, steps, onActiveStep } = useContext(QuestionsContext);
20
+ const filledSteps = steps.filter((step) => !!data[step.name]);
21
+ return (
22
+ <>
23
+ <StepTitleBase title={title || 'Review answers'}></StepTitleBase>
24
+ {filledSteps.map((step) => {
25
+ return (
26
+ <div key={step.name}>
27
+ <Title size={'md'}>{step.title}</Title>
28
+ <SummaryList>
29
+ {Object.keys(data[step.name]).map((dataKey) => {
30
+ return (
31
+ <SummaryListItem key={dataKey}>
32
+ <SummaryListItemKey>
33
+ {
34
+ step.fields.find(({ key }) => key === dataKey).label
35
+ .primary
36
+ }
37
+ </SummaryListItemKey>
38
+ <SummaryListItemValue>
39
+ {data[step.name][dataKey]}
40
+ </SummaryListItemValue>
41
+ <SummaryListItemAction>
42
+ <a
43
+ style={{ cursor: 'pointer' }}
44
+ onClick={(): void => onActiveStep && onActiveStep(step)}
45
+ >
46
+ {t('button.edit')}
47
+ </a>
48
+ </SummaryListItemAction>
49
+ </SummaryListItem>
50
+ );
51
+ })}
52
+ </SummaryList>
53
+ </div>
54
+ );
55
+ })}
56
+ <Button onClick={(): void => submitStep && submitStep()}>
57
+ {t('button.submit')}
58
+ </Button>
59
+ </>
60
+ );
61
+ };
62
+
63
+ export default ReviewStep;
@@ -0,0 +1,67 @@
1
+ import React, { useContext, useState } from 'react';
2
+ import { QuestionsContext } from '@digigov/form/Questions/QuestionsContext';
3
+ import { StepContext } from '@digigov/form/Questions/Step/StepContext';
4
+ import { StepArrayReview } from '@digigov/form/Questions/Step/StepArrayReview';
5
+ import { StepInterface } from '@digigov/form/Questions/Step/types';
6
+
7
+ /**
8
+ * The Step component accepts Step data as props
9
+ * uses composable components to provide a wholesome UX
10
+ *
11
+ */
12
+ export const Step: React.FC<StepInterface> = (props) => {
13
+ // or return all Questions and currentStepName
14
+ // or return a specific Step object
15
+ const { currentStep, submitStep, data } = useContext(QuestionsContext);
16
+
17
+ const [stepData, setStepData] = useState<Record<string, any>[]>([]);
18
+ const [reviewActive, setReviewActive] = useState(false);
19
+
20
+ const handleArraySubmit = (_name: string, data: any): void => {
21
+ setStepData([...stepData, data]);
22
+ setReviewActive(true);
23
+ };
24
+
25
+ const handleArrayDeleteItem = (deleteIndex: number): void => {
26
+ const nextStepData = stepData.filter((_item, stepIndex) => {
27
+ return stepIndex !== deleteIndex;
28
+ });
29
+ setStepData(nextStepData);
30
+ if (nextStepData.length === 0) {
31
+ setReviewActive(false);
32
+ }
33
+ };
34
+
35
+ const handleArrayReviewStep = (data): void => {
36
+ if (data.addMore === 'yes') {
37
+ setReviewActive(false);
38
+ } else if (data.addMore === 'no') {
39
+ submitStep(currentStep.name, stepData);
40
+ }
41
+ };
42
+ if (!currentStep || props.name !== currentStep.name) return null;
43
+
44
+ // then provide the currentStep object
45
+ return (
46
+ <StepContext.Provider
47
+ value={{
48
+ ...currentStep,
49
+ submitStep:
50
+ currentStep.type === 'array' ? handleArraySubmit : submitStep,
51
+ initial: data[props.name],
52
+ }}
53
+ >
54
+ {reviewActive ? (
55
+ <StepArrayReview
56
+ array={stepData}
57
+ handleSubmit={handleArrayReviewStep}
58
+ handleDelete={handleArrayDeleteItem}
59
+ />
60
+ ) : (
61
+ props.children
62
+ )}
63
+ </StepContext.Provider>
64
+ );
65
+ };
66
+
67
+ export default Step;
@@ -0,0 +1,68 @@
1
+ import React, { useContext } from 'react';
2
+ import { QuestionsContext } from '@digigov/form/Questions/QuestionsContext';
3
+ import PageTitle, { PageTitleHeading } from '@digigov/ui/app/PageTitle';
4
+ import Button from '@digigov/ui/core/Button';
5
+ import FormBuilder from '@digigov/form/FormBuilder';
6
+ import { FieldSpec } from '@digigov/form/types';
7
+ import { Field } from '@digigov/form/Field';
8
+ import { Fieldset } from '@digigov/form/Fieldset';
9
+ import Label from '@digigov/form/inputs/Label';
10
+ import {
11
+ SummaryList,
12
+ SummaryListItem,
13
+ SummaryListItemKey,
14
+ SummaryListItemValue,
15
+ SummaryListItemAction,
16
+ } from '@digigov/ui/core/SummaryList';
17
+ import { useTranslation } from '@digigov/ui/app/i18n';
18
+ import { StepArrayReviewInterface } from '@digigov/form/Questions/Step/types';
19
+ import { getAddMoreFields } from '@digigov/form/Questions/Step/getAddMoreFields';
20
+
21
+ export const StepArrayReview: React.FC<StepArrayReviewInterface> = (props) => {
22
+ const { t } = useTranslation();
23
+ const { currentStep } = useContext(QuestionsContext);
24
+ const fields = getAddMoreFields(currentStep);
25
+ const primaryField =
26
+ currentStep.fields.find(
27
+ (field: { key: any }) => field.key === currentStep.review?.primaryFieldKey
28
+ ) || {};
29
+ return (
30
+ <>
31
+ <PageTitle>
32
+ <PageTitleHeading>
33
+ {currentStep.review?.title && t(currentStep.review?.title)}
34
+ </PageTitleHeading>
35
+ </PageTitle>
36
+ <SummaryList>
37
+ {props.array.map(
38
+ (item: { [x: string]: React.ReactNode }, idx: number) => (
39
+ <SummaryListItem key={idx}>
40
+ <SummaryListItemKey>
41
+ {t(primaryField.label.primary)}
42
+ </SummaryListItemKey>
43
+ <SummaryListItemValue>
44
+ {item[primaryField.key]}
45
+ </SummaryListItemValue>
46
+ <SummaryListItemAction
47
+ onClick={(): void => props.handleDelete(idx)}
48
+ >
49
+ {t('button.delete')}
50
+ </SummaryListItemAction>
51
+ </SummaryListItem>
52
+ )
53
+ )}
54
+ </SummaryList>
55
+ <FormBuilder key="addmore" fields={fields} onSubmit={props.handleSubmit}>
56
+ <Fieldset>
57
+ <Label label={currentStep.review?.addMore.title} />
58
+ {fields.map((field: FieldSpec) => (
59
+ <Field key={field.key} name={field.key} />
60
+ ))}
61
+ </Fieldset>
62
+ <Button type="submit">{t('button.submit')}</Button>
63
+ </FormBuilder>
64
+ </>
65
+ );
66
+ };
67
+
68
+ export default StepArrayReview;
@@ -0,0 +1,21 @@
1
+ import { createContext } from 'react';
2
+ import { StepInterface } from '@digigov/form/Questions/Step/types';
3
+
4
+ export const StepContext = createContext<StepInterface>({
5
+ name: '',
6
+ fields: [],
7
+ initial: [],
8
+ errorLabels: [],
9
+ submitStep: '',
10
+ review: {
11
+ title: '',
12
+ primaryFieldKey: '',
13
+ addMore: {
14
+ title: { primary: '' },
15
+ answers: { positive: { primary: 'Yes' }, negative: { primary: 'No' } },
16
+ },
17
+ },
18
+ type: 'object',
19
+ });
20
+
21
+ export default StepContext;
@@ -0,0 +1,33 @@
1
+ import React, { useContext } from 'react';
2
+ import { StepContext } from '@digigov/form/Questions/Step/StepContext';
3
+ import Paragraph, { ParagraphProps } from '@digigov/ui/typography/Paragraph';
4
+ import { useTranslation } from '@digigov/ui/app/i18n';
5
+
6
+ export interface StepDescriptionInterface extends ParagraphProps {
7
+ description?: string;
8
+ }
9
+
10
+ export const StepDescriptionBase: React.FC<StepDescriptionInterface> = ({
11
+ children,
12
+ description,
13
+ ...props
14
+ }) => {
15
+ const { t } = useTranslation();
16
+ return (
17
+ <Paragraph {...props}>
18
+ {children || (description && t(description))}
19
+ </Paragraph>
20
+ );
21
+ };
22
+
23
+ export const StepDescription: React.FC<StepDescriptionInterface> = (props) => {
24
+ const { description: descriptionContext } = useContext(StepContext);
25
+ const description = props.description || descriptionContext;
26
+ return (
27
+ <StepDescriptionBase description={description} {...props}>
28
+ {props.children}
29
+ </StepDescriptionBase>
30
+ );
31
+ };
32
+
33
+ export default StepDescription;