@digigov/form 2.0.0-8de46296 → 2.0.0-96651090

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 (795) hide show
  1. package/Field/ErrorGroup.d.ts +15 -0
  2. package/Field/ErrorGroup.js +53 -0
  3. package/Field/FieldBase.d.ts +1 -1
  4. package/Field/FieldBase.js +77 -0
  5. package/Field/FieldBaseContainer.d.ts +2 -2
  6. package/Field/FieldBaseContainer.js +43 -0
  7. package/Field/FieldConditional.d.ts +1 -1
  8. package/Field/FieldConditional.js +45 -0
  9. package/Field/index.d.ts +1 -1
  10. package/Field/index.js +70 -68
  11. package/Field/types.d.ts +61 -11
  12. package/Field/utils/evaluateFieldWithConditions.d.ts +2 -0
  13. package/Field/utils/evaluateFieldWithConditions.js +19 -0
  14. package/Field/utils/resolveField.d.ts +3 -0
  15. package/Field/utils/resolveField.js +32 -0
  16. package/Field/utils/useField.d.ts +2 -0
  17. package/Field/utils/useField.js +47 -0
  18. package/FieldArray/BaseFieldArray.d.ts +5 -0
  19. package/FieldArray/BaseFieldArray.js +46 -0
  20. package/FieldArray/FormDialog/ArrayDisplay/ArrayContainerDisplay.d.ts +9 -0
  21. package/FieldArray/FormDialog/ArrayDisplay/ArrayContainerDisplay.js +13 -0
  22. package/FieldArray/FormDialog/ArrayDisplay/ArrayItemDisplay.d.ts +26 -0
  23. package/FieldArray/FormDialog/ArrayDisplay/ArrayItemDisplay.js +117 -0
  24. package/FieldArray/FormDialog/ArrayDisplay/ArrayItemHeader.d.ts +5 -0
  25. package/FieldArray/FormDialog/ArrayDisplay/ArrayItemHeader.js +6 -0
  26. package/FieldArray/FormDialog/ArrayDisplay/index.d.ts +15 -0
  27. package/FieldArray/FormDialog/ArrayDisplay/index.js +32 -0
  28. package/FieldArray/FormDialog/ArrayEditModal.d.ts +24 -0
  29. package/FieldArray/FormDialog/ArrayEditModal.js +138 -0
  30. package/FieldArray/FormDialog/index.d.ts +19 -0
  31. package/FieldArray/FormDialog/index.js +199 -0
  32. package/FieldArray/index.d.ts +11 -2
  33. package/FieldArray/index.js +65 -60
  34. package/FieldObject/index.d.ts +11 -3
  35. package/FieldObject/index.js +53 -52
  36. package/Fieldset/FieldsetWithContext.js +27 -0
  37. package/Fieldset/index.d.ts +2 -2
  38. package/Fieldset/index.js +18 -32
  39. package/Fieldset/types.d.ts +3 -2
  40. package/FormBuilder/index.d.ts +8 -1
  41. package/FormBuilder/index.js +239 -2
  42. package/FormContext.d.ts +3 -2
  43. package/FormContext.js +7 -0
  44. package/MultiplicityField/add-objects.d.ts +3 -2
  45. package/MultiplicityField/add-objects.js +107 -0
  46. package/MultiplicityField/index.d.ts +2 -19
  47. package/MultiplicityField/index.js +84 -106
  48. package/MultiplicityField/types.d.ts +19 -0
  49. package/Questions/Questions.d.ts +1 -1
  50. package/Questions/Questions.js +48 -0
  51. package/Questions/QuestionsContext.d.ts +1 -2
  52. package/Questions/QuestionsContext.js +10 -0
  53. package/Questions/Step/ReviewStep.js +32 -0
  54. package/Questions/Step/Step.d.ts +1 -1
  55. package/Questions/Step/Step.js +39 -0
  56. package/Questions/Step/StepArrayReview.d.ts +1 -1
  57. package/Questions/Step/StepArrayReview.js +35 -0
  58. package/Questions/Step/StepContext.d.ts +1 -2
  59. package/Questions/Step/StepContext.js +28 -0
  60. package/Questions/Step/StepDescription.d.ts +1 -1
  61. package/Questions/Step/StepDescription.js +18 -0
  62. package/Questions/Step/StepForm.d.ts +2 -2
  63. package/Questions/Step/StepForm.js +29 -0
  64. package/Questions/Step/StepQuote.d.ts +1 -1
  65. package/Questions/Step/StepQuote.js +5 -0
  66. package/Questions/Step/StepTitle.d.ts +2 -1
  67. package/Questions/Step/StepTitle.js +25 -0
  68. package/Questions/Step/getAddMoreFields.d.ts +2 -2
  69. package/Questions/Step/getAddMoreFields.js +24 -0
  70. package/Questions/Step/index.d.ts +11 -12
  71. package/Questions/Step/index.js +13 -13
  72. package/Questions/Step/types.d.ts +2 -1
  73. package/Questions/getNextStep.d.ts +1 -1
  74. package/Questions/getNextStep.js +13 -0
  75. package/Questions/index.d.ts +2 -2
  76. package/Questions/index.js +4 -3
  77. package/Questions/types.d.ts +2 -1
  78. package/hooks/useFieldFocusManager.d.ts +25 -0
  79. package/hooks/useFieldFocusManager.js +83 -0
  80. package/hooks/utils.d.ts +18 -0
  81. package/hooks/utils.js +60 -0
  82. package/index.d.ts +5 -2
  83. package/index.js +8 -4
  84. package/inputs/AutoCompleteInput/index.d.ts +5 -5
  85. package/inputs/AutoCompleteInput/index.js +42 -41
  86. package/inputs/Checkboxes/index.d.ts +7 -4
  87. package/inputs/Checkboxes/index.js +50 -91
  88. package/inputs/DateInput/index.d.ts +3 -7
  89. package/inputs/DateInput/index.js +128 -125
  90. package/inputs/DateTimeInput/index.d.ts +10 -0
  91. package/inputs/DateTimeInput/index.js +190 -0
  92. package/inputs/FileInput/index.d.ts +18 -2
  93. package/inputs/FileInput/index.js +59 -56
  94. package/inputs/ImageInput/index.d.ts +10 -2
  95. package/inputs/ImageInput/index.js +94 -74
  96. package/inputs/Input/index.d.ts +5 -2
  97. package/inputs/Input/index.js +67 -67
  98. package/inputs/Label/index.d.ts +2 -4
  99. package/inputs/Label/index.js +13 -21
  100. package/inputs/OtpInput/index.d.ts +9 -6
  101. package/inputs/OtpInput/index.js +121 -138
  102. package/inputs/Radio/index.d.ts +10 -3
  103. package/inputs/Radio/index.js +72 -56
  104. package/inputs/Select/index.d.ts +7 -4
  105. package/inputs/Select/index.js +23 -30
  106. package/inputs/index.d.ts +9 -9
  107. package/inputs/index.js +10 -9
  108. package/inputs/registry.d.ts +5 -0
  109. package/inputs/registry.js +80 -0
  110. package/internal.d.ts +5 -34
  111. package/internal.js +6 -0
  112. package/lazy.d.ts +97 -0
  113. package/lazy.js +163 -0
  114. package/package.json +12 -13
  115. package/registry.d.ts +43 -25
  116. package/registry.js +170 -0
  117. package/src/Field/ErrorGroup.tsx +84 -0
  118. package/src/Field/FieldBase.tsx +43 -24
  119. package/src/Field/FieldBaseContainer.tsx +71 -47
  120. package/src/Field/FieldConditional.tsx +10 -2
  121. package/src/Field/doc.mdx +207 -0
  122. package/src/Field/index.tsx +37 -23
  123. package/src/Field/types.tsx +92 -13
  124. package/src/Field/utils/evaluateFieldWithConditions.ts +33 -0
  125. package/src/Field/utils/resolveField.ts +58 -0
  126. package/src/Field/utils/useField.ts +68 -0
  127. package/src/FieldArray/BaseFieldArray.tsx +97 -0
  128. package/src/FieldArray/FieldArray.stories.js +4 -2
  129. package/src/FieldArray/FormDialog/ArrayDisplay/ArrayContainerDisplay.tsx +45 -0
  130. package/src/FieldArray/FormDialog/ArrayDisplay/ArrayDisplay.stories.js +14 -0
  131. package/src/FieldArray/FormDialog/ArrayDisplay/ArrayItemDisplay.tsx +337 -0
  132. package/src/FieldArray/FormDialog/ArrayDisplay/ArrayItemHeader.tsx +15 -0
  133. package/src/FieldArray/FormDialog/ArrayDisplay/__stories__/Cards.tsx +88 -0
  134. package/src/FieldArray/FormDialog/ArrayDisplay/__stories__/Default.tsx +93 -0
  135. package/src/FieldArray/FormDialog/ArrayDisplay/__stories__/ReadOnly.tsx +79 -0
  136. package/src/FieldArray/FormDialog/ArrayDisplay/__stories__/ReadOnlyCards.tsx +75 -0
  137. package/src/FieldArray/FormDialog/ArrayDisplay/__stories__/Sortable.tsx +93 -0
  138. package/src/FieldArray/FormDialog/ArrayDisplay/__stories__/SortableCards.tsx +88 -0
  139. package/src/FieldArray/FormDialog/ArrayDisplay/index.test.tsx +44 -0
  140. package/src/FieldArray/FormDialog/ArrayDisplay/index.tsx +67 -0
  141. package/src/FieldArray/FormDialog/ArrayEditModal.tsx +241 -0
  142. package/src/FieldArray/FormDialog/index.tsx +302 -0
  143. package/src/FieldArray/__stories__/CardsWithError.tsx +124 -0
  144. package/src/FieldArray/__stories__/Default.tsx +2 -1
  145. package/src/FieldArray/__stories__/WithExactLength.tsx +2 -1
  146. package/src/FieldArray/__stories__/WithModal.tsx +160 -0
  147. package/src/FieldArray/__tests__/fieldset-multiplicity.spec.tsx +271 -0
  148. package/src/FieldArray/__tests__/multiplicity-attachment.spec.tsx +280 -0
  149. package/src/FieldArray/__tests__/multiplicity-optional.spec.tsx +232 -0
  150. package/src/FieldArray/__tests__/multiplicity-required.spec.tsx +170 -0
  151. package/src/FieldArray/__tests__/nested-fieldset-multiplicity.spec.tsx +627 -0
  152. package/src/FieldArray/__tests__/preference-multiple-choice.spec.tsx +222 -0
  153. package/src/FieldArray/index.spec.tsx +355 -0
  154. package/src/FieldArray/index.test.tsx +36 -0
  155. package/src/FieldArray/index.tsx +84 -55
  156. package/src/FieldObject/index.tsx +53 -27
  157. package/src/Fieldset/FieldsetWithContext.tsx +1 -1
  158. package/src/Fieldset/index.tsx +6 -6
  159. package/src/Fieldset/types.tsx +5 -3
  160. package/src/FormBuilder/FormBuilder.stories.js +6 -1
  161. package/src/FormBuilder/__stories__/AutoErrorGrouping.tsx +63 -0
  162. package/src/FormBuilder/__stories__/Default.tsx +1 -1
  163. package/src/FormBuilder/__stories__/ErrorGrouping.tsx +43 -0
  164. package/src/FormBuilder/{FormBuilder.mdx → doc.mdx} +27 -35
  165. package/src/FormBuilder/index.test.tsx +32 -0
  166. package/src/FormBuilder/index.tsx +314 -1
  167. package/src/FormBuilder/interaction.test.tsx +40 -0
  168. package/src/FormBuilder/scenarios.test.tsx +2775 -0
  169. package/src/FormContext.tsx +7 -3
  170. package/src/MultiplicityField/MultiplicityField.stories.js +9 -6
  171. package/src/MultiplicityField/__stories__/Default.tsx +1 -1
  172. package/src/MultiplicityField/__stories__/PreviewDisplay.tsx +4 -6
  173. package/src/MultiplicityField/__stories__/WithExactLength.tsx +2 -2
  174. package/src/MultiplicityField/__stories__/WithMaxLength.tsx +2 -2
  175. package/src/MultiplicityField/__stories__/WithMinAndMaxLength.tsx +2 -2
  176. package/src/MultiplicityField/__stories__/WithMinLength.tsx +2 -2
  177. package/src/MultiplicityField/add-objects.tsx +39 -30
  178. package/{cjs/MultiplicityField/MultiplicityField.mdx → src/MultiplicityField/doc.mdx} +112 -98
  179. package/src/MultiplicityField/index.test.tsx +44 -0
  180. package/src/MultiplicityField/index.tsx +21 -31
  181. package/src/MultiplicityField/types.ts +25 -0
  182. package/src/Questions/Questions.stories.js +4 -1
  183. package/src/Questions/Questions.tsx +6 -6
  184. package/src/Questions/QuestionsContext.tsx +1 -1
  185. package/src/Questions/Step/Step.tsx +1 -1
  186. package/src/Questions/Step/StepArrayReview.tsx +3 -3
  187. package/src/Questions/Step/StepContext.tsx +1 -1
  188. package/src/Questions/Step/StepDescription.tsx +2 -1
  189. package/src/Questions/Step/StepForm.tsx +2 -2
  190. package/src/Questions/Step/StepQuote.tsx +2 -1
  191. package/src/Questions/Step/StepTitle.tsx +6 -3
  192. package/src/Questions/Step/getAddMoreFields.tsx +2 -2
  193. package/src/Questions/Step/index.ts +0 -1
  194. package/src/Questions/Step/types.tsx +2 -1
  195. package/src/Questions/__snapshots__/index.spec.tsx.snap +74 -587
  196. package/src/Questions/__stories__/Default.tsx +1 -1
  197. package/{Questions/index.mdx → src/Questions/doc.mdx} +34 -57
  198. package/src/Questions/getNextStep.tsx +1 -1
  199. package/src/Questions/index.spec.tsx +17 -5
  200. package/src/Questions/index.test.tsx +24 -0
  201. package/src/Questions/types.tsx +2 -1
  202. package/src/create-simple-form.mdx +2 -6
  203. package/src/{index.mdx → doc.mdx} +29 -18
  204. package/src/hooks/__tests__/useFieldFocusManager.spec.tsx +1079 -0
  205. package/src/hooks/__tests__/utils.spec.ts +568 -0
  206. package/src/hooks/useFieldFocusManager.ts +162 -0
  207. package/src/hooks/utils.ts +122 -0
  208. package/src/index.ts +4 -1
  209. package/src/inputs/AutoCompleteInput/AutoComplete.stories.js +5 -1
  210. package/src/inputs/AutoCompleteInput/__stories__/Default.tsx +20 -19
  211. package/src/inputs/AutoCompleteInput/__stories__/Multiple.tsx +47 -0
  212. package/src/inputs/AutoCompleteInput/doc.mdx +18 -0
  213. package/src/inputs/AutoCompleteInput/index.test.tsx +28 -0
  214. package/src/inputs/AutoCompleteInput/index.tsx +48 -33
  215. package/src/inputs/Checkboxes/Checkboxes.stories.js +6 -3
  216. package/src/inputs/Checkboxes/__stories__/Conditional.tsx +3 -4
  217. package/src/inputs/Checkboxes/__stories__/Default.tsx +1 -1
  218. package/src/inputs/Checkboxes/__stories__/WithDivider.tsx +1 -1
  219. package/src/inputs/Checkboxes/doc.mdx +23 -0
  220. package/src/inputs/Checkboxes/index.test.tsx +32 -0
  221. package/src/inputs/Checkboxes/index.tsx +106 -92
  222. package/src/inputs/DateInput/DateInput.stories.js +8 -1
  223. package/src/inputs/DateInput/__stories__/Default.tsx +17 -16
  224. package/src/inputs/DateInput/__stories__/WithDefaultValue.tsx +26 -0
  225. package/src/inputs/DateInput/__stories__/WithInitialValue.tsx +28 -0
  226. package/src/inputs/DateInput/__stories__/WithWrongDefaultValue.tsx +26 -0
  227. package/src/inputs/DateInput/__stories__/WithWrongInitialValue.tsx +28 -0
  228. package/src/inputs/DateInput/doc.mdx +16 -0
  229. package/src/inputs/DateInput/index.test.tsx +40 -0
  230. package/src/inputs/DateInput/index.tsx +77 -27
  231. package/src/inputs/DateTimeInput/DateTimeInput.stories.js +14 -0
  232. package/src/inputs/DateTimeInput/__stories__/Default.tsx +25 -0
  233. package/src/inputs/DateTimeInput/__stories__/WithDefaultValue.tsx +26 -0
  234. package/src/inputs/DateTimeInput/__stories__/WithInitialValue.tsx +28 -0
  235. package/src/inputs/DateTimeInput/__stories__/WithWrongDefaultValue.tsx +26 -0
  236. package/src/inputs/DateTimeInput/__stories__/WithWrongInitialValue.tsx +28 -0
  237. package/src/inputs/DateTimeInput/doc.mdx +16 -0
  238. package/src/inputs/DateTimeInput/index.test.tsx +40 -0
  239. package/src/inputs/DateTimeInput/index.tsx +246 -0
  240. package/src/inputs/FileInput/FileInput.stories.js +5 -1
  241. package/src/inputs/FileInput/__stories__/Default.tsx +1 -1
  242. package/src/inputs/FileInput/__stories__/WithBorderAndLink.tsx +34 -0
  243. package/src/inputs/FileInput/doc.mdx +15 -0
  244. package/src/inputs/FileInput/index.test.tsx +28 -0
  245. package/src/inputs/FileInput/index.tsx +102 -43
  246. package/src/inputs/ImageInput/ImageInput.stories.js +7 -3
  247. package/src/inputs/ImageInput/__stories__/Default.tsx +1 -1
  248. package/src/inputs/ImageInput/__stories__/{WithInvalidImageSize.tsx → MaxSize.tsx} +5 -3
  249. package/src/inputs/ImageInput/__stories__/WithInitialValues.tsx +45 -0
  250. package/src/inputs/ImageInput/__stories__/WithInvalidImageDimension.tsx +3 -1
  251. package/src/inputs/ImageInput/__stories__/logo.d.ts +4 -0
  252. package/src/inputs/ImageInput/__stories__/logo.png +0 -0
  253. package/src/inputs/ImageInput/doc.mdx +23 -0
  254. package/src/inputs/ImageInput/index.test.tsx +36 -0
  255. package/src/inputs/ImageInput/index.tsx +105 -52
  256. package/src/inputs/Input/Input.stories.js +17 -10
  257. package/src/inputs/Input/__stories__/AFM.tsx +1 -1
  258. package/src/inputs/Input/__stories__/AMKA.tsx +23 -0
  259. package/src/inputs/Input/__stories__/Boolean.tsx +1 -1
  260. package/src/inputs/Input/__stories__/Email.tsx +23 -0
  261. package/src/inputs/Input/__stories__/IBAN.tsx +1 -1
  262. package/src/inputs/Input/__stories__/Integer.tsx +1 -1
  263. package/src/inputs/Input/__stories__/LandlineNumber.tsx +3 -2
  264. package/src/inputs/Input/__stories__/MobilePhone.tsx +2 -1
  265. package/src/inputs/Input/__stories__/PhoneNumber.tsx +2 -1
  266. package/src/inputs/Input/__stories__/PostalCode.tsx +2 -1
  267. package/src/inputs/Input/__stories__/Rate.tsx +25 -0
  268. package/src/inputs/Input/__stories__/{Default.tsx → String.tsx} +2 -2
  269. package/src/inputs/Input/__stories__/StringWithTrimValidation.tsx +26 -0
  270. package/src/inputs/Input/__stories__/{TextWithCharacterLimit.tsx → TextWithLimit.tsx} +3 -2
  271. package/src/inputs/Input/doc.mdx +56 -0
  272. package/src/inputs/Input/index.test.tsx +76 -0
  273. package/src/inputs/Input/index.tsx +55 -35
  274. package/src/inputs/Label/Label.stories.js +4 -1
  275. package/src/inputs/Label/__stories__/Default.tsx +4 -2
  276. package/src/inputs/Label/doc.mdx +14 -0
  277. package/src/inputs/Label/index.test.tsx +24 -0
  278. package/src/inputs/Label/index.tsx +4 -11
  279. package/src/inputs/OtpInput/OtpInput.stories.js +4 -1
  280. package/src/inputs/OtpInput/__stories__/Default.tsx +1 -1
  281. package/src/inputs/OtpInput/doc.mdx +16 -0
  282. package/src/inputs/OtpInput/index.test.tsx +24 -0
  283. package/src/inputs/OtpInput/index.tsx +46 -35
  284. package/src/inputs/Radio/Radio.stories.js +6 -3
  285. package/src/inputs/Radio/__stories__/Conditional.tsx +5 -2
  286. package/src/inputs/Radio/__stories__/Default.tsx +1 -1
  287. package/src/inputs/Radio/__stories__/WithDivider.tsx +1 -1
  288. package/src/inputs/Radio/doc.mdx +23 -0
  289. package/src/inputs/Radio/index.test.tsx +32 -0
  290. package/src/inputs/Radio/index.tsx +93 -12
  291. package/src/inputs/Select/Select.stories.js +4 -1
  292. package/src/inputs/Select/__stories__/Default.tsx +1 -1
  293. package/src/inputs/Select/doc.mdx +13 -0
  294. package/src/inputs/Select/index.test.tsx +24 -0
  295. package/src/inputs/Select/index.tsx +22 -9
  296. package/src/inputs/registry.ts +86 -0
  297. package/src/installation.mdx +2 -5
  298. package/src/internal.ts +2 -31
  299. package/src/lazy.ts +56 -0
  300. package/src/registry.ts +179 -0
  301. package/src/types.tsx +21 -65
  302. package/src/utils.ts +67 -33
  303. package/src/validators/index.ts +138 -99
  304. package/src/validators/types.ts +1 -1
  305. package/src/validators/utils/amka.ts +39 -0
  306. package/src/validators/utils/date.ts +131 -0
  307. package/src/validators/utils/datetime.ts +222 -0
  308. package/src/validators/utils/email.ts +11 -0
  309. package/src/validators/utils/file.ts +36 -20
  310. package/src/validators/utils/iban.ts +2 -2
  311. package/src/validators/utils/image.ts +2 -2
  312. package/src/validators/utils/index.ts +15 -6
  313. package/src/validators/utils/int.ts +2 -2
  314. package/src/validators/utils/number.ts +2 -2
  315. package/src/validators/utils/otp.ts +2 -2
  316. package/src/validators/utils/phone.ts +65 -74
  317. package/src/validators/utils/postal_code.ts +3 -3
  318. package/src/validators/utils/text_limit.ts +2 -2
  319. package/src/validators/utils/uuid4.ts +2 -1
  320. package/src/validators/validators.spec.ts +6 -40
  321. package/types.d.ts +14 -37
  322. package/types.js +1 -0
  323. package/utils.d.ts +4 -1
  324. package/utils.js +56 -0
  325. package/validators/index.d.ts +6 -6
  326. package/validators/index.js +115 -180
  327. package/validators/types.d.ts +1 -1
  328. package/validators/utils/afm.js +19 -0
  329. package/validators/utils/amka.d.ts +6 -0
  330. package/validators/utils/amka.js +27 -0
  331. package/validators/utils/date.d.ts +9 -0
  332. package/validators/utils/date.js +95 -0
  333. package/validators/utils/datetime.d.ts +9 -0
  334. package/validators/utils/datetime.js +121 -0
  335. package/validators/utils/email.d.ts +5 -0
  336. package/validators/utils/email.js +10 -0
  337. package/validators/utils/file.d.ts +2 -2
  338. package/validators/utils/file.js +31 -0
  339. package/validators/utils/iban.d.ts +2 -2
  340. package/validators/utils/iban.js +104 -0
  341. package/validators/utils/image.d.ts +2 -2
  342. package/validators/utils/image.js +65 -0
  343. package/validators/utils/index.d.ts +14 -11
  344. package/validators/utils/index.js +62 -85
  345. package/validators/utils/int.d.ts +1 -1
  346. package/validators/utils/int.js +13 -0
  347. package/validators/utils/number.d.ts +1 -1
  348. package/validators/utils/number.js +12 -0
  349. package/validators/utils/otp.d.ts +2 -2
  350. package/validators/utils/otp.js +21 -0
  351. package/validators/utils/phone.d.ts +3 -3
  352. package/validators/utils/phone.js +198 -0
  353. package/validators/utils/postal_code.d.ts +3 -3
  354. package/validators/utils/postal_code.js +18 -0
  355. package/validators/utils/text_limit.d.ts +2 -2
  356. package/validators/utils/text_limit.js +34 -0
  357. package/validators/utils/uuid4.js +14 -0
  358. package/Field/FieldBase/index.js +0 -81
  359. package/Field/FieldBase/package.json +0 -6
  360. package/Field/FieldBaseContainer/index.js +0 -40
  361. package/Field/FieldBaseContainer/package.json +0 -6
  362. package/Field/FieldConditional/index.js +0 -59
  363. package/Field/FieldConditional/package.json +0 -6
  364. package/Field/index.mdx +0 -6
  365. package/Field/package.json +0 -6
  366. package/Field/types/index.js +0 -1
  367. package/Field/types/package.json +0 -6
  368. package/Field/utils/index.js +0 -153
  369. package/Field/utils/package.json +0 -6
  370. package/Field/utils.d.ts +0 -5
  371. package/FieldArray/FieldArray.stories/index.js +0 -8
  372. package/FieldArray/FieldArray.stories/package.json +0 -6
  373. package/FieldArray/FieldArray.stories.d.ts +0 -9
  374. package/FieldArray/FieldArray.stories.playwright.json +0 -353
  375. package/FieldArray/__stories__/Default/index.js +0 -88
  376. package/FieldArray/__stories__/Default/package.json +0 -6
  377. package/FieldArray/__stories__/Default.d.ts +0 -2
  378. package/FieldArray/__stories__/WithExactLength/index.js +0 -88
  379. package/FieldArray/__stories__/WithExactLength/package.json +0 -6
  380. package/FieldArray/__stories__/WithExactLength.d.ts +0 -2
  381. package/FieldArray/package.json +0 -6
  382. package/FieldObject/package.json +0 -6
  383. package/Fieldset/FieldsetWithContext/index.js +0 -35
  384. package/Fieldset/FieldsetWithContext/package.json +0 -6
  385. package/Fieldset/package.json +0 -6
  386. package/Fieldset/types/index.js +0 -1
  387. package/Fieldset/types/package.json +0 -6
  388. package/Form.stories/index.js +0 -3
  389. package/Form.stories/package.json +0 -6
  390. package/Form.stories.d.ts +0 -4
  391. package/FormBuilder/FormBuilder/index.js +0 -152
  392. package/FormBuilder/FormBuilder/package.json +0 -6
  393. package/FormBuilder/FormBuilder.d.ts +0 -5
  394. package/FormBuilder/FormBuilder.mdx +0 -256
  395. package/FormBuilder/FormBuilder.stories/index.js +0 -7
  396. package/FormBuilder/FormBuilder.stories/package.json +0 -6
  397. package/FormBuilder/FormBuilder.stories.d.ts +0 -8
  398. package/FormBuilder/FormBuilder.stories.playwright.json +0 -52
  399. package/FormBuilder/__stories__/Default/index.js +0 -26
  400. package/FormBuilder/__stories__/Default/package.json +0 -6
  401. package/FormBuilder/__stories__/Default.d.ts +0 -3
  402. package/FormBuilder/package.json +0 -6
  403. package/FormContext/index.js +0 -5
  404. package/FormContext/package.json +0 -6
  405. package/MultiplicityField/MultiplicityField.mdx +0 -590
  406. package/MultiplicityField/MultiplicityField.stories/index.js +0 -12
  407. package/MultiplicityField/MultiplicityField.stories/package.json +0 -6
  408. package/MultiplicityField/MultiplicityField.stories.d.ts +0 -13
  409. package/MultiplicityField/MultiplicityField.stories.playwright.json +0 -1370
  410. package/MultiplicityField/__stories__/Default/index.js +0 -95
  411. package/MultiplicityField/__stories__/Default/package.json +0 -6
  412. package/MultiplicityField/__stories__/Default.d.ts +0 -2
  413. package/MultiplicityField/__stories__/PreviewDisplay/index.js +0 -72
  414. package/MultiplicityField/__stories__/PreviewDisplay/package.json +0 -6
  415. package/MultiplicityField/__stories__/PreviewDisplay.d.ts +0 -2
  416. package/MultiplicityField/__stories__/WithExactLength/index.js +0 -90
  417. package/MultiplicityField/__stories__/WithExactLength/package.json +0 -6
  418. package/MultiplicityField/__stories__/WithExactLength.d.ts +0 -2
  419. package/MultiplicityField/__stories__/WithMaxLength/index.js +0 -93
  420. package/MultiplicityField/__stories__/WithMaxLength/package.json +0 -6
  421. package/MultiplicityField/__stories__/WithMaxLength.d.ts +0 -2
  422. package/MultiplicityField/__stories__/WithMinAndMaxLength/index.js +0 -94
  423. package/MultiplicityField/__stories__/WithMinAndMaxLength/package.json +0 -6
  424. package/MultiplicityField/__stories__/WithMinAndMaxLength.d.ts +0 -2
  425. package/MultiplicityField/__stories__/WithMinLength/index.js +0 -93
  426. package/MultiplicityField/__stories__/WithMinLength/package.json +0 -6
  427. package/MultiplicityField/__stories__/WithMinLength.d.ts +0 -2
  428. package/MultiplicityField/add-objects/index.js +0 -148
  429. package/MultiplicityField/add-objects/package.json +0 -6
  430. package/MultiplicityField/package.json +0 -6
  431. package/Questions/Questions/index.js +0 -75
  432. package/Questions/Questions/package.json +0 -6
  433. package/Questions/Questions.stories/index.js +0 -7
  434. package/Questions/Questions.stories/package.json +0 -6
  435. package/Questions/Questions.stories.d.ts +0 -8
  436. package/Questions/QuestionsContext/index.js +0 -11
  437. package/Questions/QuestionsContext/package.json +0 -6
  438. package/Questions/Step/ReviewStep/index.js +0 -50
  439. package/Questions/Step/ReviewStep/package.json +0 -6
  440. package/Questions/Step/Step/index.js +0 -62
  441. package/Questions/Step/Step/package.json +0 -6
  442. package/Questions/Step/StepArrayReview/index.js +0 -46
  443. package/Questions/Step/StepArrayReview/package.json +0 -6
  444. package/Questions/Step/StepContext/index.js +0 -27
  445. package/Questions/Step/StepContext/package.json +0 -6
  446. package/Questions/Step/StepDescription/index.js +0 -24
  447. package/Questions/Step/StepDescription/package.json +0 -6
  448. package/Questions/Step/StepForm/index.js +0 -44
  449. package/Questions/Step/StepForm/package.json +0 -6
  450. package/Questions/Step/StepQuote/index.js +0 -10
  451. package/Questions/Step/StepQuote/package.json +0 -6
  452. package/Questions/Step/StepTitle/index.js +0 -41
  453. package/Questions/Step/StepTitle/package.json +0 -6
  454. package/Questions/Step/getAddMoreFields/index.js +0 -21
  455. package/Questions/Step/getAddMoreFields/package.json +0 -6
  456. package/Questions/Step/package.json +0 -6
  457. package/Questions/Step/types/index.js +0 -1
  458. package/Questions/Step/types/package.json +0 -6
  459. package/Questions/__snapshots__/index.spec.tsx.snap +0 -596
  460. package/Questions/__stories__/Default/index.js +0 -102
  461. package/Questions/__stories__/Default/package.json +0 -6
  462. package/Questions/__stories__/Default.d.ts +0 -3
  463. package/Questions/getNextStep/index.js +0 -20
  464. package/Questions/getNextStep/package.json +0 -6
  465. package/Questions/index.spec/index.js +0 -59
  466. package/Questions/index.spec/package.json +0 -6
  467. package/Questions/index.spec.d.ts +0 -1
  468. package/Questions/package.json +0 -6
  469. package/Questions/types/index.js +0 -1
  470. package/Questions/types/package.json +0 -6
  471. package/cjs/Field/FieldBase/index.js +0 -88
  472. package/cjs/Field/FieldBaseContainer/index.js +0 -47
  473. package/cjs/Field/FieldConditional/index.js +0 -66
  474. package/cjs/Field/index.js +0 -80
  475. package/cjs/Field/index.mdx +0 -6
  476. package/cjs/Field/types/index.js +0 -5
  477. package/cjs/Field/utils/index.js +0 -167
  478. package/cjs/FieldArray/FieldArray.stories/index.js +0 -38
  479. package/cjs/FieldArray/FieldArray.stories.playwright.json +0 -353
  480. package/cjs/FieldArray/__stories__/Default/index.js +0 -98
  481. package/cjs/FieldArray/__stories__/WithExactLength/index.js +0 -98
  482. package/cjs/FieldArray/index.js +0 -68
  483. package/cjs/FieldObject/index.js +0 -64
  484. package/cjs/Fieldset/FieldsetWithContext/index.js +0 -45
  485. package/cjs/Fieldset/index.js +0 -44
  486. package/cjs/Fieldset/types/index.js +0 -5
  487. package/cjs/Form.stories/index.js +0 -9
  488. package/cjs/FormBuilder/FormBuilder/index.js +0 -162
  489. package/cjs/FormBuilder/FormBuilder.mdx +0 -256
  490. package/cjs/FormBuilder/FormBuilder.stories/index.js +0 -26
  491. package/cjs/FormBuilder/FormBuilder.stories.playwright.json +0 -52
  492. package/cjs/FormBuilder/__stories__/Default/index.js +0 -36
  493. package/cjs/FormBuilder/index.js +0 -8
  494. package/cjs/FormContext/index.js +0 -11
  495. package/cjs/MultiplicityField/MultiplicityField.stories/index.js +0 -86
  496. package/cjs/MultiplicityField/MultiplicityField.stories.playwright.json +0 -1370
  497. package/cjs/MultiplicityField/__stories__/Default/index.js +0 -105
  498. package/cjs/MultiplicityField/__stories__/PreviewDisplay/index.js +0 -82
  499. package/cjs/MultiplicityField/__stories__/WithExactLength/index.js +0 -100
  500. package/cjs/MultiplicityField/__stories__/WithMaxLength/index.js +0 -103
  501. package/cjs/MultiplicityField/__stories__/WithMinAndMaxLength/index.js +0 -104
  502. package/cjs/MultiplicityField/__stories__/WithMinLength/index.js +0 -103
  503. package/cjs/MultiplicityField/add-objects/index.js +0 -155
  504. package/cjs/MultiplicityField/index.js +0 -118
  505. package/cjs/Questions/Questions/index.js +0 -85
  506. package/cjs/Questions/Questions.stories/index.js +0 -26
  507. package/cjs/Questions/QuestionsContext/index.js +0 -17
  508. package/cjs/Questions/Step/ReviewStep/index.js +0 -60
  509. package/cjs/Questions/Step/Step/index.js +0 -72
  510. package/cjs/Questions/Step/StepArrayReview/index.js +0 -56
  511. package/cjs/Questions/Step/StepContext/index.js +0 -33
  512. package/cjs/Questions/Step/StepDescription/index.js +0 -34
  513. package/cjs/Questions/Step/StepForm/index.js +0 -54
  514. package/cjs/Questions/Step/StepQuote/index.js +0 -17
  515. package/cjs/Questions/Step/StepTitle/index.js +0 -51
  516. package/cjs/Questions/Step/getAddMoreFields/index.js +0 -27
  517. package/cjs/Questions/Step/index.js +0 -143
  518. package/cjs/Questions/Step/types/index.js +0 -5
  519. package/cjs/Questions/__snapshots__/index.spec.tsx.snap +0 -596
  520. package/cjs/Questions/__stories__/Default/index.js +0 -113
  521. package/cjs/Questions/getNextStep/index.js +0 -26
  522. package/cjs/Questions/index.js +0 -21
  523. package/cjs/Questions/index.mdx +0 -415
  524. package/cjs/Questions/index.spec/index.js +0 -63
  525. package/cjs/Questions/types/index.js +0 -5
  526. package/cjs/create-simple-form.mdx +0 -539
  527. package/cjs/index.js +0 -22
  528. package/cjs/index.mdx +0 -51
  529. package/cjs/inputs/AutoCompleteInput/AutoComplete.stories/index.js +0 -26
  530. package/cjs/inputs/AutoCompleteInput/__stories__/Default/index.js +0 -56
  531. package/cjs/inputs/AutoCompleteInput/index.js +0 -52
  532. package/cjs/inputs/Checkboxes/Checkboxes.stories/index.js +0 -50
  533. package/cjs/inputs/Checkboxes/Checkboxes.stories.playwright.json +0 -85
  534. package/cjs/inputs/Checkboxes/__stories__/Conditional/index.js +0 -102
  535. package/cjs/inputs/Checkboxes/__stories__/Default/index.js +0 -50
  536. package/cjs/inputs/Checkboxes/__stories__/WithDivider/index.js +0 -51
  537. package/cjs/inputs/Checkboxes/index.js +0 -101
  538. package/cjs/inputs/DateInput/DateInput.stories/index.js +0 -26
  539. package/cjs/inputs/DateInput/DateInput.stories.playwright.json +0 -72
  540. package/cjs/inputs/DateInput/__stories__/Default/index.js +0 -33
  541. package/cjs/inputs/DateInput/index.js +0 -141
  542. package/cjs/inputs/FileInput/FileInput.stories/index.js +0 -26
  543. package/cjs/inputs/FileInput/FileInput.stories.playwright.json +0 -75
  544. package/cjs/inputs/FileInput/__stories__/Default/index.js +0 -30
  545. package/cjs/inputs/FileInput/index.js +0 -68
  546. package/cjs/inputs/ImageInput/ImageInput.stories/index.js +0 -50
  547. package/cjs/inputs/ImageInput/ImageInput.stories.playwright.json +0 -77
  548. package/cjs/inputs/ImageInput/__stories__/Default/index.js +0 -38
  549. package/cjs/inputs/ImageInput/__stories__/WithInvalidImageDimension/index.js +0 -46
  550. package/cjs/inputs/ImageInput/__stories__/WithInvalidImageSize/index.js +0 -43
  551. package/cjs/inputs/ImageInput/index.js +0 -86
  552. package/cjs/inputs/Input/Input.stories/index.js +0 -134
  553. package/cjs/inputs/Input/Input.stories.playwright.json +0 -376
  554. package/cjs/inputs/Input/__stories__/AFM/index.js +0 -32
  555. package/cjs/inputs/Input/__stories__/Boolean/index.js +0 -33
  556. package/cjs/inputs/Input/__stories__/Default/index.js +0 -33
  557. package/cjs/inputs/Input/__stories__/IBAN/index.js +0 -33
  558. package/cjs/inputs/Input/__stories__/Integer/index.js +0 -41
  559. package/cjs/inputs/Input/__stories__/LandlineNumber/index.js +0 -36
  560. package/cjs/inputs/Input/__stories__/MobilePhone/index.js +0 -36
  561. package/cjs/inputs/Input/__stories__/PhoneNumber/index.js +0 -35
  562. package/cjs/inputs/Input/__stories__/PostalCode/index.js +0 -35
  563. package/cjs/inputs/Input/__stories__/TextWithCharacterLimit/index.js +0 -39
  564. package/cjs/inputs/Input/index.js +0 -76
  565. package/cjs/inputs/Input/index.mdx +0 -8
  566. package/cjs/inputs/Label/Label.stories/index.js +0 -26
  567. package/cjs/inputs/Label/Label.stories.playwright.json +0 -40
  568. package/cjs/inputs/Label/__stories__/Default/index.js +0 -37
  569. package/cjs/inputs/Label/index.js +0 -29
  570. package/cjs/inputs/OtpInput/OtpInput.stories/index.js +0 -26
  571. package/cjs/inputs/OtpInput/__stories__/Default/index.js +0 -39
  572. package/cjs/inputs/OtpInput/index.js +0 -150
  573. package/cjs/inputs/Radio/Radio.stories/index.js +0 -50
  574. package/cjs/inputs/Radio/Radio.stories.playwright.json +0 -73
  575. package/cjs/inputs/Radio/__stories__/Conditional/index.js +0 -102
  576. package/cjs/inputs/Radio/__stories__/Default/index.js +0 -55
  577. package/cjs/inputs/Radio/__stories__/WithDivider/index.js +0 -56
  578. package/cjs/inputs/Radio/index.js +0 -64
  579. package/cjs/inputs/Select/Select.stories/index.js +0 -26
  580. package/cjs/inputs/Select/Select.stories.playwright.json +0 -22
  581. package/cjs/inputs/Select/__stories__/Default/index.js +0 -61
  582. package/cjs/inputs/Select/index.js +0 -38
  583. package/cjs/inputs/index.js +0 -69
  584. package/cjs/installation.mdx +0 -68
  585. package/cjs/internal/index.js +0 -348
  586. package/cjs/registry/index.js +0 -147
  587. package/cjs/types/index.js +0 -5
  588. package/cjs/utils/index.js +0 -87
  589. package/cjs/validators/index.js +0 -193
  590. package/cjs/validators/types/index.js +0 -5
  591. package/cjs/validators/utils/afm/index.js +0 -38
  592. package/cjs/validators/utils/file/index.js +0 -51
  593. package/cjs/validators/utils/iban/index.js +0 -123
  594. package/cjs/validators/utils/image/index.js +0 -126
  595. package/cjs/validators/utils/index.js +0 -204
  596. package/cjs/validators/utils/int/index.js +0 -26
  597. package/cjs/validators/utils/number/index.js +0 -22
  598. package/cjs/validators/utils/otp/index.js +0 -32
  599. package/cjs/validators/utils/phone/index.js +0 -143
  600. package/cjs/validators/utils/postal_code/index.js +0 -34
  601. package/cjs/validators/utils/text_limit/index.js +0 -54
  602. package/cjs/validators/utils/uuid4/index.js +0 -25
  603. package/cjs/validators/validators.spec/index.js +0 -87
  604. package/create-simple-form.mdx +0 -539
  605. package/index.mdx +0 -51
  606. package/inputs/AutoCompleteInput/AutoComplete.stories/index.js +0 -7
  607. package/inputs/AutoCompleteInput/AutoComplete.stories/package.json +0 -6
  608. package/inputs/AutoCompleteInput/AutoComplete.stories.d.ts +0 -8
  609. package/inputs/AutoCompleteInput/__stories__/Default/index.js +0 -46
  610. package/inputs/AutoCompleteInput/__stories__/Default/package.json +0 -6
  611. package/inputs/AutoCompleteInput/__stories__/Default.d.ts +0 -2
  612. package/inputs/AutoCompleteInput/package.json +0 -6
  613. package/inputs/Checkboxes/Checkboxes.stories/index.js +0 -9
  614. package/inputs/Checkboxes/Checkboxes.stories/package.json +0 -6
  615. package/inputs/Checkboxes/Checkboxes.stories.d.ts +0 -10
  616. package/inputs/Checkboxes/Checkboxes.stories.playwright.json +0 -85
  617. package/inputs/Checkboxes/__stories__/Conditional/index.js +0 -92
  618. package/inputs/Checkboxes/__stories__/Conditional/package.json +0 -6
  619. package/inputs/Checkboxes/__stories__/Conditional.d.ts +0 -2
  620. package/inputs/Checkboxes/__stories__/Default/index.js +0 -40
  621. package/inputs/Checkboxes/__stories__/Default/package.json +0 -6
  622. package/inputs/Checkboxes/__stories__/Default.d.ts +0 -3
  623. package/inputs/Checkboxes/__stories__/WithDivider/index.js +0 -41
  624. package/inputs/Checkboxes/__stories__/WithDivider/package.json +0 -6
  625. package/inputs/Checkboxes/__stories__/WithDivider.d.ts +0 -3
  626. package/inputs/Checkboxes/package.json +0 -6
  627. package/inputs/DateInput/DateInput.stories/index.js +0 -7
  628. package/inputs/DateInput/DateInput.stories/package.json +0 -6
  629. package/inputs/DateInput/DateInput.stories.d.ts +0 -8
  630. package/inputs/DateInput/DateInput.stories.playwright.json +0 -72
  631. package/inputs/DateInput/__stories__/Default/index.js +0 -23
  632. package/inputs/DateInput/__stories__/Default/package.json +0 -6
  633. package/inputs/DateInput/__stories__/Default.d.ts +0 -3
  634. package/inputs/DateInput/package.json +0 -6
  635. package/inputs/FileInput/FileInput.stories/index.js +0 -7
  636. package/inputs/FileInput/FileInput.stories/package.json +0 -6
  637. package/inputs/FileInput/FileInput.stories.d.ts +0 -8
  638. package/inputs/FileInput/FileInput.stories.playwright.json +0 -75
  639. package/inputs/FileInput/__stories__/Default/index.js +0 -20
  640. package/inputs/FileInput/__stories__/Default/package.json +0 -6
  641. package/inputs/FileInput/__stories__/Default.d.ts +0 -3
  642. package/inputs/FileInput/package.json +0 -6
  643. package/inputs/ImageInput/ImageInput.stories/index.js +0 -9
  644. package/inputs/ImageInput/ImageInput.stories/package.json +0 -6
  645. package/inputs/ImageInput/ImageInput.stories.d.ts +0 -10
  646. package/inputs/ImageInput/ImageInput.stories.playwright.json +0 -77
  647. package/inputs/ImageInput/__stories__/Default/index.js +0 -28
  648. package/inputs/ImageInput/__stories__/Default/package.json +0 -6
  649. package/inputs/ImageInput/__stories__/Default.d.ts +0 -3
  650. package/inputs/ImageInput/__stories__/WithInvalidImageDimension/index.js +0 -36
  651. package/inputs/ImageInput/__stories__/WithInvalidImageDimension/package.json +0 -6
  652. package/inputs/ImageInput/__stories__/WithInvalidImageDimension.d.ts +0 -3
  653. package/inputs/ImageInput/__stories__/WithInvalidImageSize/index.js +0 -33
  654. package/inputs/ImageInput/__stories__/WithInvalidImageSize/package.json +0 -6
  655. package/inputs/ImageInput/__stories__/WithInvalidImageSize.d.ts +0 -3
  656. package/inputs/ImageInput/package.json +0 -6
  657. package/inputs/Input/Input.stories/index.js +0 -16
  658. package/inputs/Input/Input.stories/package.json +0 -6
  659. package/inputs/Input/Input.stories.d.ts +0 -17
  660. package/inputs/Input/Input.stories.playwright.json +0 -376
  661. package/inputs/Input/__stories__/AFM/index.js +0 -22
  662. package/inputs/Input/__stories__/AFM/package.json +0 -6
  663. package/inputs/Input/__stories__/AFM.d.ts +0 -3
  664. package/inputs/Input/__stories__/Boolean/index.js +0 -23
  665. package/inputs/Input/__stories__/Boolean/package.json +0 -6
  666. package/inputs/Input/__stories__/Boolean.d.ts +0 -3
  667. package/inputs/Input/__stories__/Default/index.js +0 -23
  668. package/inputs/Input/__stories__/Default/package.json +0 -6
  669. package/inputs/Input/__stories__/Default.d.ts +0 -3
  670. package/inputs/Input/__stories__/IBAN/index.js +0 -23
  671. package/inputs/Input/__stories__/IBAN/package.json +0 -6
  672. package/inputs/Input/__stories__/IBAN.d.ts +0 -3
  673. package/inputs/Input/__stories__/Integer/index.js +0 -31
  674. package/inputs/Input/__stories__/Integer/package.json +0 -6
  675. package/inputs/Input/__stories__/Integer.d.ts +0 -3
  676. package/inputs/Input/__stories__/LandlineNumber/index.js +0 -26
  677. package/inputs/Input/__stories__/LandlineNumber/package.json +0 -6
  678. package/inputs/Input/__stories__/LandlineNumber.d.ts +0 -3
  679. package/inputs/Input/__stories__/MobilePhone/index.js +0 -26
  680. package/inputs/Input/__stories__/MobilePhone/package.json +0 -6
  681. package/inputs/Input/__stories__/MobilePhone.d.ts +0 -3
  682. package/inputs/Input/__stories__/PhoneNumber/index.js +0 -25
  683. package/inputs/Input/__stories__/PhoneNumber/package.json +0 -6
  684. package/inputs/Input/__stories__/PhoneNumber.d.ts +0 -3
  685. package/inputs/Input/__stories__/PostalCode/index.js +0 -25
  686. package/inputs/Input/__stories__/PostalCode/package.json +0 -6
  687. package/inputs/Input/__stories__/PostalCode.d.ts +0 -3
  688. package/inputs/Input/__stories__/TextWithCharacterLimit/index.js +0 -29
  689. package/inputs/Input/__stories__/TextWithCharacterLimit/package.json +0 -6
  690. package/inputs/Input/__stories__/TextWithCharacterLimit.d.ts +0 -3
  691. package/inputs/Input/index.mdx +0 -8
  692. package/inputs/Input/package.json +0 -6
  693. package/inputs/Label/Label.stories/index.js +0 -7
  694. package/inputs/Label/Label.stories/package.json +0 -6
  695. package/inputs/Label/Label.stories.d.ts +0 -8
  696. package/inputs/Label/Label.stories.playwright.json +0 -40
  697. package/inputs/Label/__stories__/Default/index.js +0 -27
  698. package/inputs/Label/__stories__/Default/package.json +0 -6
  699. package/inputs/Label/__stories__/Default.d.ts +0 -3
  700. package/inputs/Label/package.json +0 -6
  701. package/inputs/OtpInput/OtpInput.stories/index.js +0 -7
  702. package/inputs/OtpInput/OtpInput.stories/package.json +0 -6
  703. package/inputs/OtpInput/OtpInput.stories.d.ts +0 -8
  704. package/inputs/OtpInput/__stories__/Default/index.js +0 -29
  705. package/inputs/OtpInput/__stories__/Default/package.json +0 -6
  706. package/inputs/OtpInput/__stories__/Default.d.ts +0 -3
  707. package/inputs/OtpInput/package.json +0 -6
  708. package/inputs/Radio/Radio.stories/index.js +0 -9
  709. package/inputs/Radio/Radio.stories/package.json +0 -6
  710. package/inputs/Radio/Radio.stories.d.ts +0 -10
  711. package/inputs/Radio/Radio.stories.playwright.json +0 -73
  712. package/inputs/Radio/__stories__/Conditional/index.js +0 -92
  713. package/inputs/Radio/__stories__/Conditional/package.json +0 -6
  714. package/inputs/Radio/__stories__/Conditional.d.ts +0 -2
  715. package/inputs/Radio/__stories__/Default/index.js +0 -45
  716. package/inputs/Radio/__stories__/Default/package.json +0 -6
  717. package/inputs/Radio/__stories__/Default.d.ts +0 -3
  718. package/inputs/Radio/__stories__/WithDivider/index.js +0 -46
  719. package/inputs/Radio/__stories__/WithDivider/package.json +0 -6
  720. package/inputs/Radio/__stories__/WithDivider.d.ts +0 -3
  721. package/inputs/Radio/package.json +0 -6
  722. package/inputs/Select/Select.stories/index.js +0 -7
  723. package/inputs/Select/Select.stories/package.json +0 -6
  724. package/inputs/Select/Select.stories.d.ts +0 -8
  725. package/inputs/Select/Select.stories.playwright.json +0 -22
  726. package/inputs/Select/__stories__/Default/index.js +0 -51
  727. package/inputs/Select/__stories__/Default/package.json +0 -6
  728. package/inputs/Select/__stories__/Default.d.ts +0 -3
  729. package/inputs/Select/package.json +0 -6
  730. package/inputs/package.json +0 -6
  731. package/installation.mdx +0 -68
  732. package/internal/index.js +0 -34
  733. package/internal/package.json +0 -6
  734. package/registry/index.js +0 -138
  735. package/registry/package.json +0 -6
  736. package/src/Field/index.mdx +0 -6
  737. package/src/Field/utils.ts +0 -191
  738. package/src/FieldArray/FieldArray.stories.playwright.json +0 -353
  739. package/src/FormBuilder/FormBuilder.stories.playwright.json +0 -52
  740. package/src/FormBuilder/FormBuilder.tsx +0 -166
  741. package/src/MultiplicityField/MultiplicityField.mdx +0 -590
  742. package/src/MultiplicityField/MultiplicityField.stories.playwright.json +0 -1370
  743. package/src/Questions/index.mdx +0 -415
  744. package/src/inputs/Checkboxes/Checkboxes.stories.playwright.json +0 -85
  745. package/src/inputs/Checkboxes/index.mdx +0 -0
  746. package/src/inputs/DateInput/DateInput.stories.playwright.json +0 -72
  747. package/src/inputs/FileInput/FileInput.stories.playwright.json +0 -75
  748. package/src/inputs/ImageInput/ImageInput.stories.playwright.json +0 -77
  749. package/src/inputs/Input/Input.stories.playwright.json +0 -376
  750. package/src/inputs/Input/index.mdx +0 -8
  751. package/src/inputs/Label/Label.stories.playwright.json +0 -40
  752. package/src/inputs/Label/index.mdx +0 -0
  753. package/src/inputs/Radio/Radio.stories.playwright.json +0 -73
  754. package/src/inputs/Radio/index.mdx +0 -0
  755. package/src/inputs/Select/Select.stories.playwright.json +0 -22
  756. package/src/registry.js +0 -145
  757. package/types/index.js +0 -1
  758. package/types/package.json +0 -6
  759. package/utils/index.js +0 -80
  760. package/utils/package.json +0 -6
  761. package/validators/package.json +0 -6
  762. package/validators/types/index.js +0 -1
  763. package/validators/types/package.json +0 -6
  764. package/validators/utils/afm/index.js +0 -31
  765. package/validators/utils/afm/package.json +0 -6
  766. package/validators/utils/file/index.js +0 -45
  767. package/validators/utils/file/package.json +0 -6
  768. package/validators/utils/iban/index.js +0 -116
  769. package/validators/utils/iban/package.json +0 -6
  770. package/validators/utils/image/index.js +0 -119
  771. package/validators/utils/image/package.json +0 -6
  772. package/validators/utils/int/index.js +0 -19
  773. package/validators/utils/int/package.json +0 -6
  774. package/validators/utils/number/index.js +0 -15
  775. package/validators/utils/number/package.json +0 -6
  776. package/validators/utils/otp/index.js +0 -25
  777. package/validators/utils/otp/package.json +0 -6
  778. package/validators/utils/package.json +0 -6
  779. package/validators/utils/phone/index.js +0 -134
  780. package/validators/utils/phone/package.json +0 -6
  781. package/validators/utils/postal_code/index.js +0 -27
  782. package/validators/utils/postal_code/package.json +0 -6
  783. package/validators/utils/text_limit/index.js +0 -47
  784. package/validators/utils/text_limit/package.json +0 -6
  785. package/validators/utils/uuid4/index.js +0 -18
  786. package/validators/utils/uuid4/package.json +0 -6
  787. package/validators/validators.spec/index.js +0 -85
  788. package/validators/validators.spec/package.json +0 -6
  789. package/validators/validators.spec.d.ts +0 -1
  790. /package/{cjs/inputs/Checkboxes/index.mdx → Field/types.js} +0 -0
  791. /package/{cjs/inputs/Label/index.mdx → Fieldset/types.js} +0 -0
  792. /package/{cjs/inputs/Radio/index.mdx → MultiplicityField/types.js} +0 -0
  793. /package/{inputs/Checkboxes/index.mdx → Questions/Step/types.js} +0 -0
  794. /package/{inputs/Label/index.mdx → Questions/types.js} +0 -0
  795. /package/{inputs/Radio/index.mdx → validators/types.js} +0 -0
@@ -1,69 +1,69 @@
1
- import _extends from "@babel/runtime/helpers/extends";
2
- import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
- var _excluded = ["name", "control", "type", "extra"];
4
- import React from 'react';
5
- import { useWatch } from 'react-hook-form';
6
- import { Hint } from '@digigov/react-core';
7
- import TextArea from '@digigov/react-core/TextArea';
8
- import TextInput from '@digigov/react-core/TextInput';
9
- import { useTranslation } from '@digigov/ui/i18n';
10
- var TYPES_MAP = {
11
- string: 'text',
12
- "int": 'text',
13
- text: 'text',
14
- date: 'date'
1
+ import react from "react";
2
+ import { useWatch } from "react-hook-form";
3
+ import { omit } from "../../utils.js";
4
+ import { TextArea } from "@digigov/ui/form/TextArea/index.js";
5
+ import { TextInput } from "@digigov/ui/form/TextInput/index.js";
6
+ import { useTranslation } from "@digigov/ui/i18n/index.js";
7
+ import { Hint } from "@digigov/ui/typography/Hint/index.js";
8
+ const TYPES_MAP = {
9
+ string: 'text',
10
+ password: 'password',
11
+ int: 'text',
12
+ rate: 'number',
13
+ text: 'text',
14
+ date: 'date'
15
15
  };
16
- export var Input = /*#__PURE__*/React.forwardRef(function WrappedInput(_ref, ref) {
17
- var name = _ref.name,
18
- control = _ref.control,
19
- type = _ref.type,
20
- extra = _ref.extra,
21
- props = _objectWithoutProperties(_ref, _excluded);
22
- // eslint-disable-next-line prefer-const
23
- var _ref2 = extra || {},
24
- _ref2$multiline = _ref2.multiline,
25
- multiline = _ref2$multiline === void 0 ? false : _ref2$multiline,
26
- rows = _ref2.rows,
27
- limit = _ref2.limit;
28
- var _ref3 = extra || {},
29
- className = _ref3.className;
30
- // if enforced to multiline use true. Derive from type otherwise.
31
- multiline = multiline === true || type === 'text';
32
- // use explicit rows value if set. Derive from multiline otherwise.
33
- rows = rows || (multiline ? 4 : 1);
34
- // translate dilosi type to HTML Input type
35
- var fieldType = TYPES_MAP[type || 'text'] || 'text';
36
- var _useTranslation = useTranslation(),
37
- t = _useTranslation.t;
38
- var currentValue = useWatch({
39
- control: control,
40
- name: name
41
- });
42
- if (multiline === true) {
43
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(TextArea, _extends({
44
- name: name,
45
- className: className,
46
- rows: rows,
47
- ref: ref
48
- }, _extends({}, props, {
49
- reset: undefined,
50
- required: undefined,
51
- type: fieldType
52
- }))), (limit === null || limit === void 0 ? void 0 : limit.max) && /*#__PURE__*/React.createElement(Hint, null, currentValue === undefined || (currentValue === null || currentValue === void 0 ? void 0 : currentValue.length) >= 0 && (currentValue === null || currentValue === void 0 ? void 0 : currentValue.length) <= (limit === null || limit === void 0 ? void 0 : limit.max) ? /*#__PURE__*/React.createElement("span", null, t('form.info.text.you_have'), ' ', /*#__PURE__*/React.createElement("b", null, !currentValue ? limit.max : (limit === null || limit === void 0 ? void 0 : limit.max) - (currentValue === null || currentValue === void 0 ? void 0 : currentValue.length)), ' ', currentValue && (limit === null || limit === void 0 ? void 0 : limit.max) - (currentValue === null || currentValue === void 0 ? void 0 : currentValue.length) === 1 ? "".concat(t('form.info.text.character')) : "".concat(t('form.info.text.characters')), ' ', t('form.info.text.remaining'), ".") : /*#__PURE__*/React.createElement("span", {
53
- style: {
54
- color: '#b60202'
55
- }
56
- }, t('form.info.text.you_have'), ' ', /*#__PURE__*/React.createElement("b", null, currentValue && (currentValue === null || currentValue === void 0 ? void 0 : currentValue.length) - (limit === null || limit === void 0 ? void 0 : limit.max)), ' ', (currentValue === null || currentValue === void 0 ? void 0 : currentValue.length) - (limit === null || limit === void 0 ? void 0 : limit.max) === 1 ? "".concat(t('form.info.text.character')) : "".concat(t('form.info.text.characters')), ' ', t('form.info.text.too_many'), ".")));
57
- } else {
58
- return /*#__PURE__*/React.createElement(TextInput, _extends({
59
- name: name,
60
- type: fieldType,
61
- className: className,
62
- ref: ref
63
- }, _extends({}, props, {
64
- reset: undefined,
65
- required: undefined
66
- })));
67
- }
16
+ const Input = /*#__PURE__*/ react.forwardRef(function({ name, control, type, extra, ...props }, ref) {
17
+ let { multiline = false, rows, limit } = extra || {};
18
+ const { className } = extra || {};
19
+ multiline = true === multiline || 'text' === type;
20
+ rows = rows || (multiline ? 4 : 1);
21
+ const fieldType = TYPES_MAP[type || 'text'] || 'text';
22
+ const { t } = useTranslation();
23
+ const currentValue = useWatch({
24
+ control,
25
+ name
26
+ });
27
+ const getRemainingChars = (currentValue, limit)=>{
28
+ if (currentValue) return limit?.max - currentValue.length;
29
+ return limit?.max;
30
+ };
31
+ const constructRemainingText = (currentValue, limit)=>{
32
+ const remainingChars = getRemainingChars(currentValue, limit);
33
+ let remainingText = 1 === Math.abs(remainingChars) ? t('form.info.text.character') : t('form.info.text.characters');
34
+ remainingText += remainingChars > 0 ? ` ${t('form.info.text.remaining')}.` : ` ${t('form.info.text.too_many')}.`;
35
+ return remainingText;
36
+ };
37
+ const transformedProps = omit(props, [
38
+ 'Field',
39
+ 'resetField'
40
+ ]);
41
+ if (true === multiline) return /*#__PURE__*/ react.createElement(react.Fragment, null, /*#__PURE__*/ react.createElement(TextArea, {
42
+ name: name,
43
+ className: className,
44
+ rows: rows,
45
+ ref: ref,
46
+ id: name,
47
+ ...transformedProps,
48
+ reset: void 0,
49
+ required: void 0,
50
+ type: fieldType
51
+ }), limit?.max && /*#__PURE__*/ react.createElement(Hint, {
52
+ display: 'flex'
53
+ }, t('form.info.text.you_have'), /*#__PURE__*/ react.createElement("strong", null, "\xa0", `${Math.abs(getRemainingChars(currentValue, limit))}`, "\xa0"), constructRemainingText(currentValue, limit)));
54
+ return /*#__PURE__*/ react.createElement(TextInput, {
55
+ name: name,
56
+ id: name,
57
+ type: fieldType,
58
+ "data-type": type,
59
+ className: className,
60
+ ref: ref,
61
+ ...transformedProps,
62
+ min: void 0,
63
+ max: void 0,
64
+ reset: void 0,
65
+ required: void 0
66
+ });
68
67
  });
69
- export default Input;
68
+ const inputs_Input = Input;
69
+ export { Input, inputs_Input as default };
@@ -1,18 +1,16 @@
1
1
  import React from 'react';
2
- import { FieldLabelProps } from '@digigov/form/types';
2
+ import type { FieldLabelProps } from '../../types.js';
3
3
  export interface FieldOptionProps {
4
4
  label?: FieldLabelProps;
5
5
  value: string;
6
6
  show?: string[];
7
7
  disabled?: boolean;
8
- selected?: () => React.FC;
8
+ selected?: () => React.ReactNode;
9
9
  divider?: string;
10
10
  }
11
11
  export interface LabelProps {
12
12
  primary?: string;
13
13
  secondary?: string;
14
- }
15
- export interface LabelProps {
16
14
  className?: string;
17
15
  value?: string;
18
16
  label?: FieldLabelProps;
@@ -1,22 +1,14 @@
1
- import React from 'react';
2
- import Hint from '@digigov/react-core/Hint';
3
- import LabelTitle from '@digigov/react-core/LabelTitle';
4
- import { useTranslation } from '@digigov/ui/i18n';
5
- export var Label = function Label(_ref) {
6
- var className = _ref.className,
7
- label = _ref.label,
8
- value = _ref.value;
9
- var _useTranslation = useTranslation(),
10
- t = _useTranslation.t;
11
- if ((!label || label && !label.primary && !label.secondary) && !value) {
12
- return null;
13
- }
14
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(LabelTitle, {
15
- className: className,
16
- size: "sm"
17
- }, label && label.primary && t(label.primary) || value), label && label.secondary && /*#__PURE__*/React.createElement(Hint, null, t(label.secondary)));
1
+ import react from "react";
2
+ import { LabelTitle } from "@digigov/ui/form/LabelContainer/index.js";
3
+ import { useTranslation } from "@digigov/ui/i18n/index.js";
4
+ import { Hint } from "@digigov/ui/typography/Hint/index.js";
5
+ const Label_Label = ({ className, label, value })=>{
6
+ const { t } = useTranslation();
7
+ if ((!label || label && !label.primary && !label.secondary) && !value) return null;
8
+ return /*#__PURE__*/ react.createElement(react.Fragment, null, /*#__PURE__*/ react.createElement(LabelTitle, {
9
+ className: className,
10
+ size: "sm"
11
+ }, label && label.primary && t(label.primary) || value), label && label.secondary && /*#__PURE__*/ react.createElement(Hint, null, t(label.secondary)));
18
12
  };
19
- Label.defaultProps = {
20
- label: {}
21
- };
22
- export default Label;
13
+ const Label = Label_Label;
14
+ export { Label_Label as Label, Label as default };
@@ -1,9 +1,12 @@
1
- /// <reference types="react" />
1
+ import React from 'react';
2
2
  export declare const RE_DIGIT: RegExp;
3
3
  export declare const REMOVE_SPACES: RegExp;
4
- export declare const OtpInput: ({ name, maxLength, ...props }: {
5
- [x: string]: any;
6
- name: any;
7
- maxLength?: number | undefined;
8
- }) => JSX.Element;
4
+ export declare function useOtp(onChange: any, maxLength: any): {
5
+ otpValues: string[];
6
+ handleOtpChange: (e: React.ChangeEvent<HTMLInputElement>, idx: number) => void;
7
+ handleKeyDown: (e: React.KeyboardEvent<HTMLInputElement>, idx: number) => void;
8
+ handleFocus: (e: React.FocusEvent<HTMLInputElement>) => void;
9
+ handlePaste: (e: React.ClipboardEvent<HTMLInputElement>) => void;
10
+ };
11
+ export declare const OtpInput: React.ForwardRefExoticComponent<Omit<Record<string, any>, "ref"> & React.RefAttributes<HTMLInputElement>>;
9
12
  export default OtpInput;
@@ -1,140 +1,123 @@
1
- import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
2
- import _objectDestructuringEmpty from "@babel/runtime/helpers/objectDestructuringEmpty";
3
- import _extends from "@babel/runtime/helpers/extends";
4
- import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
5
- import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
6
- var _excluded = ["name", "maxLength"];
7
- import React, { useState, useCallback } from 'react';
8
- import SingleCharacterInputs, { SingleCharacterInput } from '@digigov/ui/form/SingleCharacterInputs';
9
- export var RE_DIGIT = new RegExp(/^\d+$/);
10
- export var REMOVE_SPACES = new RegExp(/\s+/g);
1
+ import react, { useCallback, useState } from "react";
2
+ import SingleCharacterInputs, { SingleCharacterInput } from "@digigov/ui/form/SingleCharacterInputs/index.js";
3
+ const RE_DIGIT = new RegExp(/^\d+$/);
4
+ const REMOVE_SPACES = new RegExp(/\s+/g);
11
5
  function useOtp(onChange, maxLength) {
12
- var _useState = useState(Array(maxLength).fill('')),
13
- _useState2 = _slicedToArray(_useState, 2),
14
- otpValues = _useState2[0],
15
- setOtpValues = _useState2[1];
16
- var handleChange = useCallback(function (otp) {
17
- setOtpValues(otp);
18
- var otpValue = otp.join('');
19
- onChange(otpValue);
20
- }, [onChange]);
21
- var setOtp = function setOtp(item, idx) {
22
- var updatedOTPValues = _toConsumableArray(otpValues);
23
- if (item.length === 1 || item.length === 0) {
24
- updatedOTPValues[idx] = item[0] || '';
25
- handleChange(updatedOTPValues);
26
- } else if (item.length === maxLength) {
27
- var valueArray = item.split('').slice(0, maxLength);
28
- handleChange(valueArray);
29
- }
30
- };
31
- var setSelectionRange = useCallback(function (target) {
32
- return target.setSelectionRange(0, target.value.length);
33
- }, []);
34
- var focusToNextInput = useCallback(function (target) {
35
- var nextElement = target.nextElementSibling;
36
- if (nextElement) {
37
- nextElement.focus();
38
- }
39
- }, []);
40
- var focusToPrevInput = useCallback(function (target) {
41
- var previousElement = target.previousElementSibling;
42
- if (previousElement) {
43
- previousElement.focus();
44
- }
45
- }, []);
46
- var handleKeyDown = useCallback(function (e, idx) {
47
- var key = e.key;
48
- var target = e.target;
49
- var targetValue = target.value;
50
- setSelectionRange(target);
51
- if (key === 'ArrowRight' || key === 'ArrowDown') {
52
- e.preventDefault();
53
- return focusToNextInput(target);
54
- }
55
- if (key === 'ArrowLeft' || key === 'ArrowUp') {
56
- e.preventDefault();
57
- return focusToPrevInput(target);
58
- }
59
- if (e.key === 'Backspace' || e.key === 'Delete') {
60
- if (targetValue !== '') {
61
- targetValue = '';
62
- } else {
63
- focusToPrevInput(target);
64
- }
65
- setOtp(targetValue, idx);
66
- return e.preventDefault();
67
- }
68
- }, [setOtp, focusToPrevInput, focusToNextInput]);
69
- var handleFocus = useCallback(function (e) {
70
- var target = e.target;
71
- setSelectionRange(target);
72
- }, [setSelectionRange]);
73
- var handleOtpChange = useCallback(function (e, idx) {
74
- var target = e.target;
75
- var targetValue = target.value;
76
- var isTargetValueDigit = RE_DIGIT.test(targetValue);
77
- // We want to pass the empty string when the value is deleted
78
- // emptry string replaces the deleted value
79
- if (isTargetValueDigit || targetValue === '') {
80
- setOtp(targetValue, idx);
81
- if (target.value.length > 1) {
82
- target.blur();
83
- }
84
- focusToNextInput(target);
85
- }
86
- }, [setOtp, handleKeyDown, handleFocus]);
87
- var handlePaste = useCallback(function (e) {
88
- e.preventDefault();
89
- var pastedData = e.clipboardData.getData('text/plain').replace(REMOVE_SPACES, '');
90
- if (pastedData) {
91
- setOtp(pastedData, 0);
92
- }
93
- }, []);
94
- return {
95
- otpValues: otpValues,
96
- handleOtpChange: handleOtpChange,
97
- handleKeyDown: handleKeyDown,
98
- handleFocus: handleFocus,
99
- handlePaste: handlePaste
100
- };
101
- }
102
- var SingleCharacterInputPart = function SingleCharacterInputPart(_ref) {
103
- var props = _extends({}, (_objectDestructuringEmpty(_ref), _ref));
104
- return /*#__PURE__*/React.createElement(SingleCharacterInput, props);
105
- };
106
- export var OtpInput = function OtpInput(_ref2) {
107
- var name = _ref2.name,
108
- _ref2$maxLength = _ref2.maxLength,
109
- maxLength = _ref2$maxLength === void 0 ? 6 : _ref2$maxLength,
110
- props = _objectWithoutProperties(_ref2, _excluded);
111
- var otp = useOtp(props.onChange, maxLength);
112
- return /*#__PURE__*/React.createElement(SingleCharacterInputs, null, otp.otpValues.map(function (digit, idx) {
113
- return /*#__PURE__*/React.createElement(SingleCharacterInputPart, {
114
- name: "".concat(name, "-").concat(idx),
115
- type: "text",
116
- key: idx,
117
- autoComplete: "one-time-code",
118
- pattern: "\\d{1}",
119
- maxLength: maxLength,
120
- value: digit,
121
- disabled: props.disabled,
122
- "aria-required": props['aria-required'],
123
- onChange: function onChange(e) {
124
- return otp.handleOtpChange(e, idx);
125
- },
126
- onInput: function onInput(e) {
127
- if (e.target.value === digit) {
128
- otp.handleOtpChange(e, idx);
6
+ const [otpValues, setOtpValues] = useState(Array(maxLength).fill(''));
7
+ const handleChange = useCallback((otp)=>{
8
+ setOtpValues(otp);
9
+ const otpValue = otp.join('');
10
+ onChange(otpValue);
11
+ }, [
12
+ onChange
13
+ ]);
14
+ const setOtp = (item, idx)=>{
15
+ const updatedOTPValues = [
16
+ ...otpValues
17
+ ];
18
+ if (1 === item.length || 0 === item.length) {
19
+ updatedOTPValues[idx] = item[0] || '';
20
+ handleChange(updatedOTPValues);
21
+ } else if (item.length === maxLength) {
22
+ const valueArray = item.split('').slice(0, maxLength);
23
+ handleChange(valueArray);
24
+ }
25
+ };
26
+ const setSelectionRange = useCallback((target)=>target.setSelectionRange(0, target.value.length), []);
27
+ const focusToNextInput = useCallback((target)=>{
28
+ const nextElement = target.nextElementSibling;
29
+ if (nextElement) nextElement.focus();
30
+ }, []);
31
+ const focusToPrevInput = useCallback((target)=>{
32
+ const previousElement = target.previousElementSibling;
33
+ if (previousElement) previousElement.focus();
34
+ }, []);
35
+ const handleKeyDown = useCallback((e, idx)=>{
36
+ const { key } = e;
37
+ const target = e.target;
38
+ let targetValue = target.value;
39
+ setSelectionRange(target);
40
+ if ('ArrowRight' === key || 'ArrowDown' === key) {
41
+ e.preventDefault();
42
+ return focusToNextInput(target);
43
+ }
44
+ if ('ArrowLeft' === key || 'ArrowUp' === key) {
45
+ e.preventDefault();
46
+ return focusToPrevInput(target);
129
47
  }
130
- },
131
- onKeyDown: function onKeyDown(e) {
132
- return otp.handleKeyDown(e, idx);
133
- },
134
- onFocus: otp.handleFocus,
135
- onPaste: otp.handlePaste,
136
- error: !digit ? props.error : false
137
- });
138
- }));
139
- };
140
- export default OtpInput;
48
+ if ('Backspace' === e.key || 'Delete' === e.key) {
49
+ if ('' !== targetValue) targetValue = '';
50
+ else focusToPrevInput(target);
51
+ setOtp(targetValue, idx);
52
+ return e.preventDefault();
53
+ }
54
+ }, [
55
+ setOtp,
56
+ focusToPrevInput,
57
+ focusToNextInput
58
+ ]);
59
+ const handleFocus = useCallback((e)=>{
60
+ const { target } = e;
61
+ setSelectionRange(target);
62
+ }, [
63
+ setSelectionRange
64
+ ]);
65
+ const handleOtpChange = useCallback((e, idx)=>{
66
+ const target = e.target;
67
+ const targetValue = target.value;
68
+ const isTargetValueDigit = RE_DIGIT.test(targetValue);
69
+ if (isTargetValueDigit || '' === targetValue) {
70
+ setOtp(targetValue, idx);
71
+ if (target.value.length > 1) target.blur();
72
+ focusToNextInput(target);
73
+ }
74
+ }, [
75
+ setOtp,
76
+ handleKeyDown,
77
+ handleFocus
78
+ ]);
79
+ const handlePaste = useCallback((e)=>{
80
+ e.preventDefault();
81
+ const pastedData = e.clipboardData.getData('text/plain').replace(REMOVE_SPACES, '');
82
+ if (pastedData) setOtp(pastedData, 0);
83
+ }, []);
84
+ return {
85
+ otpValues,
86
+ handleOtpChange,
87
+ handleKeyDown,
88
+ handleFocus,
89
+ handlePaste
90
+ };
91
+ }
92
+ const SingleCharacterInputPart = /*#__PURE__*/ react.forwardRef(({ ...props }, ref)=>/*#__PURE__*/ react.createElement(SingleCharacterInput, {
93
+ ...props,
94
+ ref: ref
95
+ }));
96
+ SingleCharacterInputPart.displayName = 'SingleCharacterInputPart';
97
+ const OtpInput_OtpInput = /*#__PURE__*/ react.forwardRef(({ name, maxLength = 6, ...props }, ref)=>{
98
+ const otp = useOtp(props.onChange, maxLength);
99
+ return /*#__PURE__*/ react.createElement(SingleCharacterInputs, null, otp.otpValues.map((digit, idx)=>/*#__PURE__*/ react.createElement(SingleCharacterInputPart, {
100
+ ref: 0 === idx ? ref : null,
101
+ name: `${name}-${idx}`,
102
+ id: `${name}-${idx}`,
103
+ type: "text",
104
+ key: idx,
105
+ autoComplete: "one-time-code",
106
+ pattern: "\\d{1}",
107
+ maxLength: maxLength,
108
+ value: digit,
109
+ disabled: props.disabled,
110
+ "aria-required": props['aria-required'],
111
+ onChange: (e)=>otp.handleOtpChange(e, idx),
112
+ onInput: (e)=>{
113
+ if (e.target.value === digit) otp.handleOtpChange(e, idx);
114
+ },
115
+ onKeyDown: (e)=>otp.handleKeyDown(e, idx),
116
+ onFocus: otp.handleFocus,
117
+ onPaste: otp.handlePaste,
118
+ error: digit ? false : props.error
119
+ })));
120
+ });
121
+ OtpInput_OtpInput.displayName = 'OtpInput';
122
+ const OtpInput = OtpInput_OtpInput;
123
+ export { OtpInput_OtpInput as OtpInput, REMOVE_SPACES, RE_DIGIT, OtpInput as default, useOtp };
@@ -1,12 +1,19 @@
1
1
  import React from 'react';
2
- import { UncontrolledFieldProps } from '@digigov/form/Field/types';
3
- import { FieldOptionProps } from '@digigov/form/inputs/Label';
2
+ import type { UseFormReturn } from 'react-hook-form';
3
+ import type { UncontrolledFieldProps } from '../../Field/types.js';
4
+ import type { FieldOptionProps } from '../Label/index.js';
4
5
  export interface RadioButtonsGroupProps extends Omit<UncontrolledFieldProps, 'extra'> {
5
6
  extra: {
6
7
  className?: string;
7
- options: Array<FieldOptionProps>;
8
+ options: FieldOptionProps[];
8
9
  dense?: boolean;
9
10
  };
11
+ fieldComponent?: React.FC<Omit<UncontrolledFieldProps, 'register'>>;
12
+ resetField: UseFormReturn['resetField'];
10
13
  }
11
14
  export declare const RadioButtonsGroup: React.FC<RadioButtonsGroupProps>;
15
+ export declare const ControlledRadioButtonsGroup: React.ForwardRefExoticComponent<RadioButtonsGroupProps & {
16
+ onChange: (e: any) => void;
17
+ value: any;
18
+ } & React.RefAttributes<HTMLInputElement>>;
12
19
  export default RadioButtonsGroup;
@@ -1,57 +1,73 @@
1
- import _extends from "@babel/runtime/helpers/extends";
2
- import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
- var _excluded = ["name", "control", "register", "extra", "disabled"],
4
- _excluded2 = ["label", "value", "show", "disabled", "selected"];
5
- import React from 'react';
6
- import { useWatch } from 'react-hook-form';
7
- import { Field } from '@digigov/form';
8
- import { RadioConditional } from '@digigov/react-core';
9
- import Hint from '@digigov/react-core/Hint';
10
- import RadioContainer from '@digigov/react-core/RadioContainer';
11
- import RadioItem from '@digigov/react-core/RadioItem';
12
- import { useTranslation } from '@digigov/ui/i18n';
13
- export var RadioButtonsGroup = function RadioButtonsGroup(_ref) {
14
- var name = _ref.name,
15
- control = _ref.control,
16
- register = _ref.register,
17
- _ref$extra = _ref.extra,
18
- options = _ref$extra.options,
19
- className = _ref$extra.className,
20
- disabled = _ref.disabled,
21
- props = _objectWithoutProperties(_ref, _excluded);
22
- var currentValue = useWatch({
23
- control: control,
24
- name: name
25
- });
26
- var _useTranslation = useTranslation(),
27
- t = _useTranslation.t;
28
- return /*#__PURE__*/React.createElement(RadioContainer, {
29
- className: className,
30
- defaultValue: currentValue,
31
- id: name
32
- }, options.map(function (_ref2) {
33
- var label = _ref2.label,
34
- v = _ref2.value,
35
- show = _ref2.show,
36
- optionDisabled = _ref2.disabled,
37
- selected = _ref2.selected,
38
- option = _objectWithoutProperties(_ref2, _excluded2);
39
- return /*#__PURE__*/React.createElement("div", {
40
- key: "".concat(name, ".").concat(v)
41
- }, /*#__PURE__*/React.createElement(RadioItem, _extends({}, register(name), {
42
- value: v,
43
- disabled: disabled || optionDisabled
44
- }, option, _extends({}, props, {
45
- reset: undefined,
46
- required: undefined,
47
- 'aria-describedby': undefined,
48
- type: 'radio'
49
- })), label && label.primary && t(label.primary) || v, label && label.secondary && /*#__PURE__*/React.createElement(Hint, null, t(label.secondary))), selected && selected(), currentValue === v && show && /*#__PURE__*/React.createElement(RadioConditional, null, show.map(function (fieldName) {
50
- return /*#__PURE__*/React.createElement(Field, {
51
- name: fieldName,
52
- key: fieldName
53
- });
54
- })));
55
- }));
1
+ import react from "react";
2
+ import { useWatch } from "react-hook-form";
3
+ import { omit } from "../../utils.js";
4
+ import { RadioConditional, RadioContainer, RadioItem } from "@digigov/ui/form/RadioContainer/index.js";
5
+ import { useTranslation } from "@digigov/ui/i18n/index.js";
6
+ import { Hint } from "@digigov/ui/typography/Hint/index.js";
7
+ import { Base } from "@digigov/ui/utils/Base/index.js";
8
+ const RadioButtonsGroup = ({ name, control, register, extra: { options, className }, disabled, Field, ...props })=>{
9
+ const currentValue = useWatch({
10
+ control,
11
+ name
12
+ });
13
+ const { t } = useTranslation();
14
+ return /*#__PURE__*/ react.createElement(RadioContainer, {
15
+ className: className,
16
+ id: name
17
+ }, options.map(({ label, value: v, show, disabled: optionDisabled, selected, ...option })=>/*#__PURE__*/ react.createElement(Base, {
18
+ as: "div",
19
+ key: `${name}.${v}`
20
+ }, /*#__PURE__*/ react.createElement(RadioItem, {
21
+ ...register(name),
22
+ id: `${name}.${v}`,
23
+ value: v,
24
+ disabled: disabled || optionDisabled,
25
+ ...option,
26
+ ...omit(props, [
27
+ 'resetField'
28
+ ]),
29
+ reset: void 0,
30
+ required: void 0,
31
+ error: void 0,
32
+ 'aria-describedby': void 0,
33
+ type: 'radio'
34
+ }, label && label.primary && /*#__PURE__*/ react.createElement(Base, {
35
+ as: "span"
36
+ }, t(label.primary) || v), label && label.secondary && /*#__PURE__*/ react.createElement(Hint, null, t(label.secondary))), selected && selected(), currentValue === v && show && Field && /*#__PURE__*/ react.createElement(RadioConditional, null, show.map((fieldName)=>/*#__PURE__*/ react.createElement(Field, {
37
+ name: fieldName,
38
+ key: fieldName
39
+ }))))));
56
40
  };
57
- export default RadioButtonsGroup;
41
+ const Radio_ControlledRadioButtonsGroup = /*#__PURE__*/ react.forwardRef(function({ name, extra: { options, className }, disabled, onChange, value, Field, ...props }, ref) {
42
+ const currentValue = value;
43
+ const { t } = useTranslation();
44
+ return /*#__PURE__*/ react.createElement(RadioContainer, {
45
+ className: className,
46
+ id: name
47
+ }, options.map(({ label, value: v, show, disabled: optionDisabled, selected, ...option }, index)=>/*#__PURE__*/ react.createElement(react.Fragment, {
48
+ key: `${name}.${v}`
49
+ }, /*#__PURE__*/ react.createElement(RadioItem, {
50
+ ref: 0 === index ? ref : void 0,
51
+ onChange: (e)=>{
52
+ console.log(e);
53
+ onChange(e);
54
+ },
55
+ id: `${name}.${v}`,
56
+ value: v,
57
+ checked: currentValue === v,
58
+ disabled: disabled || optionDisabled,
59
+ ...option,
60
+ ...props,
61
+ reset: void 0,
62
+ required: void 0,
63
+ error: void 0,
64
+ Field: void 0,
65
+ 'aria-describedby': void 0,
66
+ type: 'radio'
67
+ }, label && label.primary && t(label.primary) || v, label && label.secondary && /*#__PURE__*/ react.createElement(Hint, null, t(label.secondary))), selected && selected(), currentValue === v && show && /*#__PURE__*/ react.createElement(RadioConditional, null, show.map((fieldName)=>/*#__PURE__*/ react.createElement(Field, {
68
+ name: fieldName,
69
+ key: fieldName
70
+ }))))));
71
+ });
72
+ const Radio = RadioButtonsGroup;
73
+ export { Radio_ControlledRadioButtonsGroup as ControlledRadioButtonsGroup, RadioButtonsGroup, Radio as default };