@digigov/form 2.0.0-6452adf3 → 2.0.0-66d7c5e2

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 (889) hide show
  1. package/Field/ErrorGroup/index.js +48 -0
  2. package/{Form.stories → Field/ErrorGroup}/package.json +1 -1
  3. package/Field/ErrorGroup.d.ts +15 -0
  4. package/Field/ErrorGroup.js.map +7 -0
  5. package/Field/FieldBase/index.js +37 -26
  6. package/Field/FieldBase.d.ts +1 -1
  7. package/Field/FieldBase.js.map +2 -2
  8. package/Field/FieldBaseContainer/index.js +37 -17
  9. package/Field/FieldBaseContainer.d.ts +2 -2
  10. package/Field/FieldBaseContainer.js.map +2 -2
  11. package/Field/FieldConditional/index.js +4 -0
  12. package/Field/FieldConditional.d.ts +1 -1
  13. package/Field/FieldConditional.js.map +2 -2
  14. package/Field/index.d.ts +1 -1
  15. package/Field/index.js +29 -28
  16. package/Field/index.js.map +2 -2
  17. package/Field/types.d.ts +31 -19
  18. package/Field/utils/evaluateFieldWithConditions.d.ts +2 -2
  19. package/Field/utils/evaluateFieldWithConditions.js.map +2 -2
  20. package/Field/utils/resolveField/index.js +35 -0
  21. package/{Questions/Questions.stories → Field/utils/resolveField}/package.json +1 -1
  22. package/Field/utils/resolveField.d.ts +3 -0
  23. package/Field/utils/resolveField.js.map +7 -0
  24. package/Field/utils/useField/index.js +17 -2
  25. package/Field/utils/useField.d.ts +1 -1
  26. package/Field/utils/useField.js.map +2 -2
  27. package/FieldArray/BaseFieldArray/index.js +76 -0
  28. package/FieldArray/BaseFieldArray/package.json +6 -0
  29. package/FieldArray/BaseFieldArray.d.ts +5 -0
  30. package/FieldArray/BaseFieldArray.js.map +7 -0
  31. package/FieldArray/FieldArray.stories.d.ts +2 -0
  32. package/FieldArray/FormDialog/ArrayDisplay/ArrayContainerDisplay/index.js +23 -0
  33. package/FieldArray/FormDialog/ArrayDisplay/ArrayContainerDisplay/package.json +6 -0
  34. package/FieldArray/FormDialog/ArrayDisplay/ArrayContainerDisplay.d.ts +9 -0
  35. package/FieldArray/FormDialog/ArrayDisplay/ArrayContainerDisplay.js.map +7 -0
  36. package/FieldArray/FormDialog/ArrayDisplay/ArrayDisplay.stories.d.ts +13 -0
  37. package/FieldArray/FormDialog/ArrayDisplay/ArrayItemDisplay/index.js +184 -0
  38. package/FieldArray/FormDialog/ArrayDisplay/ArrayItemDisplay/package.json +6 -0
  39. package/FieldArray/FormDialog/ArrayDisplay/ArrayItemDisplay.d.ts +26 -0
  40. package/FieldArray/FormDialog/ArrayDisplay/ArrayItemDisplay.js.map +7 -0
  41. package/FieldArray/FormDialog/ArrayDisplay/ArrayItemHeader/index.js +11 -0
  42. package/FieldArray/FormDialog/ArrayDisplay/ArrayItemHeader/package.json +6 -0
  43. package/FieldArray/FormDialog/ArrayDisplay/ArrayItemHeader.d.ts +5 -0
  44. package/FieldArray/FormDialog/ArrayDisplay/ArrayItemHeader.js.map +7 -0
  45. package/FieldArray/FormDialog/ArrayDisplay/__stories__/Cards.d.ts +2 -0
  46. package/FieldArray/FormDialog/ArrayDisplay/__stories__/Default.d.ts +2 -0
  47. package/FieldArray/FormDialog/ArrayDisplay/__stories__/ReadOnly.d.ts +2 -0
  48. package/FieldArray/FormDialog/ArrayDisplay/__stories__/ReadOnlyCards.d.ts +2 -0
  49. package/FieldArray/FormDialog/ArrayDisplay/__stories__/Sortable.d.ts +2 -0
  50. package/FieldArray/FormDialog/ArrayDisplay/__stories__/SortableCards.d.ts +2 -0
  51. package/FieldArray/FormDialog/ArrayDisplay/index.d.ts +15 -0
  52. package/FieldArray/FormDialog/ArrayDisplay/index.js +57 -0
  53. package/FieldArray/FormDialog/ArrayDisplay/index.js.map +7 -0
  54. package/{inputs/DateInput/DateInput.stories → FieldArray/FormDialog/ArrayDisplay}/package.json +1 -1
  55. package/FieldArray/FormDialog/ArrayEditModal/index.js +158 -0
  56. package/{inputs/Checkboxes/Checkboxes.stories → FieldArray/FormDialog/ArrayEditModal}/package.json +1 -1
  57. package/FieldArray/FormDialog/ArrayEditModal.d.ts +26 -0
  58. package/FieldArray/FormDialog/ArrayEditModal.js.map +7 -0
  59. package/FieldArray/FormDialog/index.d.ts +19 -0
  60. package/FieldArray/FormDialog/index.js +231 -0
  61. package/FieldArray/FormDialog/index.js.map +7 -0
  62. package/{inputs/inputsScenarios → FieldArray/FormDialog}/package.json +1 -1
  63. package/FieldArray/__stories__/CardsWithError.d.ts +15 -0
  64. package/FieldArray/__stories__/Default.d.ts +1 -1
  65. package/FieldArray/__stories__/WithExactLength.d.ts +1 -1
  66. package/FieldArray/__stories__/WithModal.d.ts +2 -0
  67. package/FieldArray/index.d.ts +10 -2
  68. package/FieldArray/index.js +60 -43
  69. package/FieldArray/index.js.map +2 -2
  70. package/FieldObject/index.d.ts +8 -3
  71. package/FieldObject/index.js +32 -24
  72. package/FieldObject/index.js.map +2 -2
  73. package/Fieldset/FieldsetWithContext.js.map +1 -1
  74. package/Fieldset/index.d.ts +1 -1
  75. package/Fieldset/index.js.map +1 -1
  76. package/Fieldset/types.d.ts +2 -2
  77. package/FormBuilder/FormBuilder.stories.d.ts +4 -0
  78. package/FormBuilder/__stories__/AutoErrorGrouping.d.ts +3 -0
  79. package/FormBuilder/__stories__/Default.d.ts +1 -1
  80. package/FormBuilder/__stories__/ErrorGrouping.d.ts +3 -0
  81. package/FormBuilder/index.d.ts +2 -2
  82. package/FormBuilder/index.js +189 -80
  83. package/FormBuilder/index.js.map +2 -2
  84. package/FormContext/index.js +6 -2
  85. package/FormContext.d.ts +3 -2
  86. package/FormContext.js.map +2 -2
  87. package/MultiplicityField/MultiplicityField.stories.d.ts +2 -0
  88. package/MultiplicityField/__stories__/Default.d.ts +1 -1
  89. package/MultiplicityField/__stories__/PreviewDisplay.d.ts +1 -1
  90. package/MultiplicityField/__stories__/WithExactLength.d.ts +1 -1
  91. package/MultiplicityField/__stories__/WithMaxLength.d.ts +1 -1
  92. package/MultiplicityField/__stories__/WithMinAndMaxLength.d.ts +1 -1
  93. package/MultiplicityField/__stories__/WithMinLength.d.ts +1 -1
  94. package/MultiplicityField/add-objects/index.js +16 -21
  95. package/MultiplicityField/add-objects.d.ts +1 -1
  96. package/MultiplicityField/add-objects.js.map +2 -2
  97. package/MultiplicityField/index.d.ts +2 -2
  98. package/MultiplicityField/index.js +5 -1
  99. package/MultiplicityField/index.js.map +2 -2
  100. package/MultiplicityField/types.d.ts +3 -3
  101. package/Questions/Questions/index.js +5 -4
  102. package/Questions/Questions.d.ts +1 -1
  103. package/Questions/Questions.js.map +2 -2
  104. package/Questions/Questions.stories.d.ts +2 -0
  105. package/Questions/QuestionsContext.d.ts +1 -1
  106. package/Questions/QuestionsContext.js.map +1 -1
  107. package/Questions/Step/Step.d.ts +1 -1
  108. package/Questions/Step/Step.js.map +1 -1
  109. package/Questions/Step/StepArrayReview.d.ts +1 -1
  110. package/Questions/Step/StepArrayReview.js.map +2 -2
  111. package/Questions/Step/StepContext.d.ts +1 -1
  112. package/Questions/Step/StepContext.js.map +1 -1
  113. package/Questions/Step/StepDescription.d.ts +1 -1
  114. package/Questions/Step/StepDescription.js.map +2 -2
  115. package/Questions/Step/StepForm.d.ts +2 -2
  116. package/Questions/Step/StepForm.js.map +1 -1
  117. package/Questions/Step/StepQuote.d.ts +1 -1
  118. package/Questions/Step/StepQuote.js.map +2 -2
  119. package/Questions/Step/StepTitle.d.ts +1 -1
  120. package/Questions/Step/StepTitle.js.map +2 -2
  121. package/Questions/Step/getAddMoreFields.d.ts +2 -2
  122. package/Questions/Step/getAddMoreFields.js.map +1 -1
  123. package/Questions/Step/types.d.ts +1 -1
  124. package/Questions/__stories__/Default.d.ts +1 -1
  125. package/Questions/getNextStep.d.ts +1 -1
  126. package/Questions/getNextStep.js.map +1 -1
  127. package/Questions/types.d.ts +1 -1
  128. package/cjs/Field/ErrorGroup/index.js +82 -0
  129. package/cjs/Field/ErrorGroup.js.map +7 -0
  130. package/cjs/Field/FieldBase/index.js +36 -25
  131. package/cjs/Field/FieldBase.js.map +2 -2
  132. package/cjs/Field/FieldBaseContainer/index.js +36 -16
  133. package/cjs/Field/FieldBaseContainer.js.map +3 -3
  134. package/cjs/Field/FieldConditional/index.js +4 -0
  135. package/cjs/Field/FieldConditional.js.map +2 -2
  136. package/cjs/Field/index.js +29 -25
  137. package/cjs/Field/index.js.map +2 -2
  138. package/cjs/Field/types.js.map +1 -1
  139. package/cjs/Field/utils/evaluateFieldWithConditions.js.map +2 -2
  140. package/cjs/Field/utils/resolveField/index.js +55 -0
  141. package/cjs/Field/utils/resolveField.js.map +7 -0
  142. package/cjs/Field/utils/useField/index.js +17 -2
  143. package/cjs/Field/utils/useField.js.map +2 -2
  144. package/cjs/FieldArray/BaseFieldArray/index.js +109 -0
  145. package/cjs/FieldArray/BaseFieldArray.js.map +7 -0
  146. package/cjs/{FormBuilder/__stories__/Default → FieldArray/FormDialog/ArrayDisplay/ArrayContainerDisplay}/index.js +22 -31
  147. package/cjs/FieldArray/FormDialog/ArrayDisplay/ArrayContainerDisplay.js.map +7 -0
  148. package/cjs/FieldArray/FormDialog/ArrayDisplay/ArrayItemDisplay/index.js +209 -0
  149. package/cjs/FieldArray/FormDialog/ArrayDisplay/ArrayItemDisplay.js.map +7 -0
  150. package/cjs/{FormBuilder/FormBuilder.stories → FieldArray/FormDialog/ArrayDisplay/ArrayItemHeader}/index.js +12 -13
  151. package/cjs/FieldArray/FormDialog/ArrayDisplay/ArrayItemHeader.js.map +7 -0
  152. package/cjs/FieldArray/FormDialog/ArrayDisplay/index.js +90 -0
  153. package/cjs/FieldArray/FormDialog/ArrayDisplay/index.js.map +7 -0
  154. package/cjs/FieldArray/FormDialog/ArrayEditModal/index.js +186 -0
  155. package/cjs/FieldArray/FormDialog/ArrayEditModal.js.map +7 -0
  156. package/cjs/FieldArray/FormDialog/index.js +258 -0
  157. package/cjs/FieldArray/FormDialog/index.js.map +7 -0
  158. package/cjs/FieldArray/index.js +59 -42
  159. package/cjs/FieldArray/index.js.map +3 -3
  160. package/cjs/FieldObject/index.js +32 -21
  161. package/cjs/FieldObject/index.js.map +2 -2
  162. package/cjs/Fieldset/FieldsetWithContext.js.map +1 -1
  163. package/cjs/Fieldset/index.js.map +1 -1
  164. package/cjs/Fieldset/types.js.map +1 -1
  165. package/cjs/FormBuilder/index.js +191 -82
  166. package/cjs/FormBuilder/index.js.map +3 -3
  167. package/cjs/FormContext/index.js +9 -4
  168. package/cjs/FormContext.js.map +3 -3
  169. package/cjs/MultiplicityField/add-objects/index.js +15 -15
  170. package/cjs/MultiplicityField/add-objects.js.map +2 -2
  171. package/cjs/MultiplicityField/index.js +5 -1
  172. package/cjs/MultiplicityField/index.js.map +2 -2
  173. package/cjs/MultiplicityField/types.js.map +1 -1
  174. package/cjs/Questions/Questions/index.js +5 -4
  175. package/cjs/Questions/Questions.js.map +2 -2
  176. package/cjs/Questions/QuestionsContext.js.map +1 -1
  177. package/cjs/Questions/Step/Step.js.map +1 -1
  178. package/cjs/Questions/Step/StepArrayReview.js.map +2 -2
  179. package/cjs/Questions/Step/StepContext.js.map +1 -1
  180. package/cjs/Questions/Step/StepDescription.js.map +2 -2
  181. package/cjs/Questions/Step/StepForm.js.map +1 -1
  182. package/cjs/Questions/Step/StepQuote.js.map +2 -2
  183. package/cjs/Questions/Step/StepTitle.js.map +2 -2
  184. package/cjs/Questions/Step/getAddMoreFields.js.map +1 -1
  185. package/cjs/Questions/Step/types.js.map +1 -1
  186. package/cjs/Questions/getNextStep.js.map +1 -1
  187. package/cjs/Questions/types.js.map +1 -1
  188. package/cjs/hooks/useFieldFocusManager/index.js +135 -0
  189. package/cjs/hooks/useFieldFocusManager.js.map +7 -0
  190. package/cjs/hooks/utils/index.js +98 -0
  191. package/cjs/hooks/utils.js.map +7 -0
  192. package/cjs/inputs/AutoCompleteInput/index.js +4 -3
  193. package/cjs/inputs/AutoCompleteInput/index.js.map +2 -2
  194. package/cjs/inputs/Checkboxes/index.js +67 -61
  195. package/cjs/inputs/Checkboxes/index.js.map +2 -2
  196. package/cjs/inputs/DateInput/index.js +57 -22
  197. package/cjs/inputs/DateInput/index.js.map +2 -2
  198. package/cjs/inputs/DateTimeInput/index.js +250 -0
  199. package/cjs/inputs/DateTimeInput/index.js.map +7 -0
  200. package/cjs/inputs/FileInput/index.js +68 -30
  201. package/cjs/inputs/FileInput/index.js.map +2 -2
  202. package/cjs/inputs/ImageInput/__stories__/logo.d/index.js +1 -0
  203. package/cjs/inputs/ImageInput/__stories__/logo.d.js.map +7 -0
  204. package/cjs/inputs/ImageInput/index.js +48 -11
  205. package/cjs/inputs/ImageInput/index.js.map +2 -2
  206. package/cjs/inputs/Input/index.js +55 -49
  207. package/cjs/inputs/Input/index.js.map +2 -2
  208. package/cjs/inputs/Label/index.js.map +2 -2
  209. package/cjs/inputs/OtpInput/index.js +36 -30
  210. package/cjs/inputs/OtpInput/index.js.map +2 -2
  211. package/cjs/inputs/Radio/index.js +6 -4
  212. package/cjs/inputs/Radio/index.js.map +3 -3
  213. package/cjs/inputs/Select/index.js +9 -2
  214. package/cjs/inputs/Select/index.js.map +2 -2
  215. package/cjs/{Field/utils → inputs/registry}/index.js +13 -5
  216. package/cjs/inputs/registry.js.map +7 -0
  217. package/cjs/lazy/index.js +54 -40
  218. package/cjs/lazy.js.map +3 -3
  219. package/cjs/registry/index.js +85 -63
  220. package/cjs/registry.js.map +3 -3
  221. package/cjs/types.js.map +1 -1
  222. package/cjs/utils/index.js +22 -7
  223. package/cjs/utils.js.map +2 -2
  224. package/cjs/validators/index.js +56 -24
  225. package/cjs/validators/index.js.map +2 -2
  226. package/cjs/validators/types.js.map +1 -1
  227. package/cjs/validators/utils/amka/index.js +60 -0
  228. package/cjs/validators/utils/amka.js.map +7 -0
  229. package/cjs/validators/utils/date/index.js +26 -3
  230. package/cjs/validators/utils/date.js.map +2 -2
  231. package/cjs/validators/utils/datetime/index.js +245 -0
  232. package/cjs/validators/utils/datetime.js.map +7 -0
  233. package/cjs/{Form.stories → validators/utils/email}/index.js +20 -7
  234. package/cjs/validators/utils/email.js.map +7 -0
  235. package/cjs/validators/utils/file/index.js +30 -17
  236. package/cjs/validators/utils/file.js.map +2 -2
  237. package/cjs/validators/utils/iban.js.map +1 -1
  238. package/cjs/validators/utils/image.js.map +1 -1
  239. package/cjs/validators/utils/index.js +8 -2
  240. package/cjs/validators/utils/index.js.map +2 -2
  241. package/cjs/validators/utils/int/index.js +1 -1
  242. package/cjs/validators/utils/int.js.map +2 -2
  243. package/cjs/validators/utils/number/index.js +1 -1
  244. package/cjs/validators/utils/number.js.map +2 -2
  245. package/cjs/validators/utils/otp.js.map +1 -1
  246. package/cjs/validators/utils/phone.js.map +2 -2
  247. package/cjs/validators/utils/postal_code.js.map +1 -1
  248. package/cjs/validators/utils/text_limit.js.map +1 -1
  249. package/cjs/validators/utils/uuid4.js.map +2 -2
  250. package/hooks/useFieldFocusManager/index.js +116 -0
  251. package/hooks/useFieldFocusManager/package.json +6 -0
  252. package/hooks/useFieldFocusManager.d.ts +25 -0
  253. package/hooks/useFieldFocusManager.js.map +7 -0
  254. package/hooks/utils/index.js +73 -0
  255. package/{Field → hooks}/utils/package.json +1 -1
  256. package/hooks/utils.d.ts +18 -0
  257. package/hooks/utils.js.map +7 -0
  258. package/index.js +1 -1
  259. package/inputs/AutoCompleteInput/AutoComplete.stories.d.ts +2 -0
  260. package/inputs/AutoCompleteInput/__stories__/Default.d.ts +1 -1
  261. package/inputs/AutoCompleteInput/__stories__/Multiple.d.ts +1 -1
  262. package/inputs/AutoCompleteInput/index.d.ts +4 -4
  263. package/inputs/AutoCompleteInput/index.js +5 -6
  264. package/inputs/AutoCompleteInput/index.js.map +2 -2
  265. package/inputs/Checkboxes/Checkboxes.stories.d.ts +2 -0
  266. package/inputs/Checkboxes/__stories__/Conditional.d.ts +1 -1
  267. package/inputs/Checkboxes/__stories__/Default.d.ts +1 -1
  268. package/inputs/Checkboxes/__stories__/WithDivider.d.ts +1 -1
  269. package/inputs/Checkboxes/index.d.ts +4 -4
  270. package/inputs/Checkboxes/index.js +67 -61
  271. package/inputs/Checkboxes/index.js.map +2 -2
  272. package/inputs/DateInput/DateInput.stories.d.ts +6 -0
  273. package/inputs/DateInput/__stories__/Default.d.ts +1 -1
  274. package/inputs/DateInput/__stories__/WithDefaultValue.d.ts +3 -0
  275. package/inputs/DateInput/__stories__/WithInitialValue.d.ts +3 -0
  276. package/inputs/DateInput/__stories__/WithWrongDefaultValue.d.ts +3 -0
  277. package/inputs/DateInput/__stories__/WithWrongInitialValue.d.ts +3 -0
  278. package/inputs/DateInput/index.d.ts +2 -6
  279. package/inputs/DateInput/index.js +58 -23
  280. package/inputs/DateInput/index.js.map +2 -2
  281. package/inputs/DateTimeInput/DateTimeInput.stories.d.ts +14 -0
  282. package/inputs/DateTimeInput/__stories__/Default.d.ts +3 -0
  283. package/inputs/DateTimeInput/__stories__/WithDefaultValue.d.ts +3 -0
  284. package/inputs/DateTimeInput/__stories__/WithInitialValue.d.ts +3 -0
  285. package/inputs/DateTimeInput/__stories__/WithWrongDefaultValue.d.ts +3 -0
  286. package/inputs/DateTimeInput/__stories__/WithWrongInitialValue.d.ts +3 -0
  287. package/inputs/DateTimeInput/index.d.ts +10 -0
  288. package/inputs/DateTimeInput/index.js +220 -0
  289. package/inputs/DateTimeInput/index.js.map +7 -0
  290. package/inputs/DateTimeInput/package.json +6 -0
  291. package/inputs/FileInput/FileInput.stories.d.ts +3 -0
  292. package/inputs/FileInput/__stories__/Default.d.ts +1 -1
  293. package/inputs/FileInput/__stories__/WithBorderAndLink.d.ts +3 -0
  294. package/inputs/FileInput/index.d.ts +18 -2
  295. package/inputs/FileInput/index.js +69 -31
  296. package/inputs/FileInput/index.js.map +2 -2
  297. package/inputs/ImageInput/ImageInput.stories.d.ts +4 -1
  298. package/inputs/ImageInput/__stories__/Default.d.ts +1 -1
  299. package/inputs/ImageInput/__stories__/MaxSize.d.ts +1 -1
  300. package/inputs/ImageInput/__stories__/WithInitialValues.d.ts +3 -0
  301. package/inputs/ImageInput/__stories__/WithInvalidImageDimension.d.ts +1 -1
  302. package/inputs/ImageInput/__stories__/logo.d/index.js +1 -0
  303. package/inputs/{DateInput/__stories__/Default → ImageInput/__stories__/logo.d}/package.json +1 -1
  304. package/inputs/ImageInput/__stories__/logo.d.js.map +7 -0
  305. package/inputs/ImageInput/index.d.ts +10 -2
  306. package/inputs/ImageInput/index.js +49 -12
  307. package/inputs/ImageInput/index.js.map +2 -2
  308. package/inputs/Input/Input.stories.d.ts +5 -0
  309. package/inputs/Input/__stories__/AFM.d.ts +1 -1
  310. package/inputs/Input/__stories__/AMKA.d.ts +3 -0
  311. package/inputs/Input/__stories__/Boolean.d.ts +1 -1
  312. package/inputs/Input/__stories__/Email.d.ts +3 -0
  313. package/inputs/Input/__stories__/IBAN.d.ts +1 -1
  314. package/inputs/Input/__stories__/Integer.d.ts +1 -1
  315. package/inputs/Input/__stories__/LandlineNumber.d.ts +1 -1
  316. package/inputs/Input/__stories__/MobilePhone.d.ts +1 -1
  317. package/inputs/Input/__stories__/PhoneNumber.d.ts +1 -1
  318. package/inputs/Input/__stories__/PostalCode.d.ts +1 -1
  319. package/inputs/Input/__stories__/String.d.ts +1 -1
  320. package/inputs/Input/__stories__/StringWithTrimValidation.d.ts +3 -0
  321. package/inputs/Input/__stories__/TextWithLimit.d.ts +1 -1
  322. package/inputs/Input/index.d.ts +4 -3
  323. package/inputs/Input/index.js +55 -49
  324. package/inputs/Input/index.js.map +2 -2
  325. package/inputs/Label/Label.stories.d.ts +2 -0
  326. package/inputs/Label/__stories__/Default.d.ts +1 -1
  327. package/inputs/Label/index.d.ts +1 -3
  328. package/inputs/Label/index.js.map +2 -2
  329. package/inputs/OtpInput/OtpInput.stories.d.ts +2 -0
  330. package/inputs/OtpInput/__stories__/Default.d.ts +1 -1
  331. package/inputs/OtpInput/index.d.ts +1 -5
  332. package/inputs/OtpInput/index.js +36 -30
  333. package/inputs/OtpInput/index.js.map +2 -2
  334. package/inputs/Radio/Radio.stories.d.ts +2 -0
  335. package/inputs/Radio/__stories__/Conditional.d.ts +1 -1
  336. package/inputs/Radio/__stories__/Default.d.ts +1 -1
  337. package/inputs/Radio/__stories__/WithDivider.d.ts +1 -1
  338. package/inputs/Radio/index.d.ts +5 -5
  339. package/inputs/Radio/index.js +6 -4
  340. package/inputs/Radio/index.js.map +3 -3
  341. package/inputs/Select/Select.stories.d.ts +2 -0
  342. package/inputs/Select/__stories__/Default.d.ts +1 -1
  343. package/inputs/Select/index.d.ts +5 -4
  344. package/inputs/Select/index.js +13 -3
  345. package/inputs/Select/index.js.map +2 -2
  346. package/{Field/utils → inputs/registry}/index.js +10 -2
  347. package/{locales/el → inputs/registry}/package.json +1 -1
  348. package/{Field/utils/index.d.ts → inputs/registry.d.ts} +2 -1
  349. package/inputs/registry.js.map +7 -0
  350. package/lazy/index.js +80 -70
  351. package/package.json +8 -8
  352. package/registry/index.js +129 -108
  353. package/src/Field/ErrorGroup.tsx +84 -0
  354. package/src/Field/FieldBase.tsx +40 -26
  355. package/src/Field/FieldBaseContainer.tsx +70 -46
  356. package/src/Field/FieldConditional.tsx +7 -3
  357. package/src/Field/doc.mdx +202 -1
  358. package/src/Field/index.tsx +32 -37
  359. package/src/Field/types.tsx +53 -41
  360. package/src/Field/utils/evaluateFieldWithConditions.ts +5 -2
  361. package/src/Field/utils/resolveField.ts +58 -0
  362. package/src/Field/utils/useField.ts +17 -3
  363. package/src/FieldArray/BaseFieldArray.tsx +97 -0
  364. package/src/FieldArray/FieldArray.stories.js +2 -0
  365. package/src/FieldArray/FormDialog/ArrayDisplay/ArrayContainerDisplay.tsx +45 -0
  366. package/src/FieldArray/FormDialog/ArrayDisplay/ArrayDisplay.stories.js +14 -0
  367. package/src/FieldArray/FormDialog/ArrayDisplay/ArrayItemDisplay.tsx +335 -0
  368. package/src/FieldArray/FormDialog/ArrayDisplay/ArrayItemHeader.tsx +15 -0
  369. package/src/FieldArray/FormDialog/ArrayDisplay/__stories__/Cards.tsx +88 -0
  370. package/src/FieldArray/FormDialog/ArrayDisplay/__stories__/Default.tsx +93 -0
  371. package/src/FieldArray/FormDialog/ArrayDisplay/__stories__/ReadOnly.tsx +79 -0
  372. package/src/FieldArray/FormDialog/ArrayDisplay/__stories__/ReadOnlyCards.tsx +75 -0
  373. package/src/FieldArray/FormDialog/ArrayDisplay/__stories__/Sortable.tsx +93 -0
  374. package/src/FieldArray/FormDialog/ArrayDisplay/__stories__/SortableCards.tsx +88 -0
  375. package/src/FieldArray/FormDialog/ArrayDisplay/index.test.tsx +44 -0
  376. package/src/FieldArray/FormDialog/ArrayDisplay/index.tsx +67 -0
  377. package/src/FieldArray/FormDialog/ArrayEditModal.tsx +243 -0
  378. package/src/FieldArray/FormDialog/index.tsx +299 -0
  379. package/src/FieldArray/__stories__/CardsWithError.tsx +124 -0
  380. package/src/FieldArray/__stories__/Default.tsx +2 -1
  381. package/src/FieldArray/__stories__/WithExactLength.tsx +2 -1
  382. package/src/FieldArray/__stories__/WithModal.tsx +160 -0
  383. package/src/FieldArray/__tests__/fieldset-multiplicity.spec.tsx +271 -0
  384. package/src/FieldArray/__tests__/multiplicity-attachment.spec.tsx +280 -0
  385. package/src/FieldArray/__tests__/multiplicity-required.spec.tsx +131 -0
  386. package/src/FieldArray/__tests__/nested-fieldset-multiplicity.spec.tsx +627 -0
  387. package/src/FieldArray/__tests__/preference-multiple-choice.spec.tsx +222 -0
  388. package/src/FieldArray/index.spec.tsx +355 -0
  389. package/src/FieldArray/index.test.tsx +12 -0
  390. package/src/FieldArray/index.tsx +78 -61
  391. package/src/FieldObject/index.tsx +43 -30
  392. package/src/Fieldset/FieldsetWithContext.tsx +1 -1
  393. package/src/Fieldset/index.tsx +1 -1
  394. package/src/Fieldset/types.tsx +2 -2
  395. package/src/FormBuilder/FormBuilder.stories.js +5 -0
  396. package/src/FormBuilder/__stories__/AutoErrorGrouping.tsx +63 -0
  397. package/src/FormBuilder/__stories__/Default.tsx +1 -1
  398. package/src/FormBuilder/__stories__/ErrorGrouping.tsx +43 -0
  399. package/src/FormBuilder/doc.mdx +9 -4
  400. package/src/FormBuilder/index.test.tsx +12 -0
  401. package/src/FormBuilder/index.tsx +226 -90
  402. package/src/FormBuilder/interaction.test.tsx +40 -0
  403. package/src/FormBuilder/scenarios.test.tsx +1003 -130
  404. package/src/FormContext.tsx +7 -3
  405. package/src/MultiplicityField/MultiplicityField.stories.js +3 -0
  406. package/src/MultiplicityField/__stories__/Default.tsx +1 -1
  407. package/src/MultiplicityField/__stories__/PreviewDisplay.tsx +1 -1
  408. package/src/MultiplicityField/__stories__/WithExactLength.tsx +1 -1
  409. package/src/MultiplicityField/__stories__/WithMaxLength.tsx +1 -1
  410. package/src/MultiplicityField/__stories__/WithMinAndMaxLength.tsx +1 -1
  411. package/src/MultiplicityField/__stories__/WithMinLength.tsx +1 -1
  412. package/src/MultiplicityField/add-objects.tsx +18 -24
  413. package/src/MultiplicityField/doc.mdx +101 -83
  414. package/src/MultiplicityField/index.test.tsx +4 -0
  415. package/src/MultiplicityField/index.tsx +7 -2
  416. package/src/MultiplicityField/types.ts +6 -3
  417. package/src/Questions/Questions.stories.js +3 -0
  418. package/src/Questions/Questions.tsx +6 -6
  419. package/src/Questions/QuestionsContext.tsx +1 -1
  420. package/src/Questions/Step/Step.tsx +1 -1
  421. package/src/Questions/Step/StepArrayReview.tsx +3 -3
  422. package/src/Questions/Step/StepContext.tsx +1 -1
  423. package/src/Questions/Step/StepDescription.tsx +2 -1
  424. package/src/Questions/Step/StepForm.tsx +2 -2
  425. package/src/Questions/Step/StepQuote.tsx +2 -1
  426. package/src/Questions/Step/StepTitle.tsx +2 -1
  427. package/src/Questions/Step/getAddMoreFields.tsx +2 -2
  428. package/src/Questions/Step/types.tsx +1 -1
  429. package/src/Questions/__snapshots__/index.spec.tsx.snap +3 -1
  430. package/src/Questions/__stories__/Default.tsx +1 -1
  431. package/src/Questions/doc.mdx +21 -41
  432. package/src/Questions/getNextStep.tsx +1 -1
  433. package/src/Questions/index.spec.tsx +14 -2
  434. package/src/Questions/index.test.tsx +4 -0
  435. package/src/Questions/types.tsx +1 -1
  436. package/src/doc.mdx +26 -11
  437. package/src/hooks/__tests__/useFieldFocusManager.spec.tsx +1079 -0
  438. package/src/hooks/__tests__/utils.spec.ts +568 -0
  439. package/src/hooks/useFieldFocusManager.ts +162 -0
  440. package/src/hooks/utils.ts +122 -0
  441. package/src/inputs/AutoCompleteInput/AutoComplete.stories.js +3 -0
  442. package/src/inputs/AutoCompleteInput/__stories__/Default.tsx +3 -11
  443. package/src/inputs/AutoCompleteInput/__stories__/Multiple.tsx +2 -8
  444. package/src/inputs/AutoCompleteInput/index.test.tsx +4 -0
  445. package/src/inputs/AutoCompleteInput/index.tsx +8 -11
  446. package/src/inputs/Checkboxes/Checkboxes.stories.js +3 -0
  447. package/src/inputs/Checkboxes/__stories__/Conditional.tsx +1 -1
  448. package/src/inputs/Checkboxes/__stories__/Default.tsx +1 -1
  449. package/src/inputs/Checkboxes/__stories__/WithDivider.tsx +1 -1
  450. package/src/inputs/Checkboxes/index.test.tsx +4 -0
  451. package/src/inputs/Checkboxes/index.tsx +96 -90
  452. package/src/inputs/DateInput/DateInput.stories.js +7 -0
  453. package/src/inputs/DateInput/__stories__/Default.tsx +8 -13
  454. package/src/inputs/DateInput/__stories__/WithDefaultValue.tsx +26 -0
  455. package/src/inputs/DateInput/__stories__/WithInitialValue.tsx +28 -0
  456. package/src/inputs/DateInput/__stories__/WithWrongDefaultValue.tsx +26 -0
  457. package/src/inputs/DateInput/__stories__/WithWrongInitialValue.tsx +28 -0
  458. package/src/inputs/DateInput/index.test.tsx +20 -0
  459. package/src/inputs/DateInput/index.tsx +71 -23
  460. package/src/inputs/DateTimeInput/DateTimeInput.stories.js +14 -0
  461. package/src/inputs/DateTimeInput/__stories__/Default.tsx +25 -0
  462. package/src/inputs/DateTimeInput/__stories__/WithDefaultValue.tsx +26 -0
  463. package/src/inputs/DateTimeInput/__stories__/WithInitialValue.tsx +28 -0
  464. package/src/inputs/DateTimeInput/__stories__/WithWrongDefaultValue.tsx +26 -0
  465. package/src/inputs/DateTimeInput/__stories__/WithWrongInitialValue.tsx +28 -0
  466. package/src/inputs/DateTimeInput/doc.mdx +16 -0
  467. package/src/inputs/DateTimeInput/index.test.tsx +40 -0
  468. package/src/inputs/DateTimeInput/index.tsx +246 -0
  469. package/src/inputs/FileInput/FileInput.stories.js +4 -0
  470. package/src/inputs/FileInput/__stories__/Default.tsx +1 -1
  471. package/src/inputs/FileInput/__stories__/WithBorderAndLink.tsx +34 -0
  472. package/src/inputs/FileInput/index.test.tsx +8 -0
  473. package/src/inputs/FileInput/index.tsx +105 -37
  474. package/src/inputs/ImageInput/ImageInput.stories.js +5 -2
  475. package/src/inputs/ImageInput/__stories__/Default.tsx +1 -1
  476. package/src/inputs/ImageInput/__stories__/MaxSize.tsx +5 -4
  477. package/src/inputs/ImageInput/__stories__/{WithInvalidImageSize.tsx → WithInitialValues.tsx} +12 -3
  478. package/src/inputs/ImageInput/__stories__/WithInvalidImageDimension.tsx +1 -1
  479. package/src/inputs/ImageInput/__stories__/logo.d.ts +4 -0
  480. package/src/inputs/ImageInput/__stories__/logo.png +0 -0
  481. package/src/inputs/ImageInput/index.test.tsx +8 -4
  482. package/src/inputs/ImageInput/index.tsx +98 -43
  483. package/src/inputs/Input/Input.stories.js +6 -0
  484. package/src/inputs/Input/__stories__/AFM.tsx +1 -1
  485. package/src/inputs/Input/__stories__/AMKA.tsx +23 -0
  486. package/src/inputs/Input/__stories__/Boolean.tsx +1 -1
  487. package/src/inputs/Input/__stories__/Email.tsx +23 -0
  488. package/src/inputs/Input/__stories__/IBAN.tsx +1 -1
  489. package/src/inputs/Input/__stories__/Integer.tsx +1 -1
  490. package/src/inputs/Input/__stories__/LandlineNumber.tsx +3 -2
  491. package/src/inputs/Input/__stories__/MobilePhone.tsx +2 -1
  492. package/src/inputs/Input/__stories__/PhoneNumber.tsx +2 -1
  493. package/src/inputs/Input/__stories__/PostalCode.tsx +2 -1
  494. package/src/inputs/Input/__stories__/String.tsx +1 -1
  495. package/src/inputs/Input/__stories__/StringWithTrimValidation.tsx +26 -0
  496. package/src/inputs/Input/__stories__/TextWithLimit.tsx +2 -1
  497. package/src/inputs/Input/index.test.tsx +16 -0
  498. package/src/inputs/Input/index.tsx +81 -70
  499. package/src/inputs/Label/Label.stories.js +3 -0
  500. package/src/inputs/Label/__stories__/Default.tsx +1 -1
  501. package/src/inputs/Label/index.test.tsx +4 -0
  502. package/src/inputs/Label/index.tsx +1 -4
  503. package/src/inputs/OtpInput/OtpInput.stories.js +3 -0
  504. package/src/inputs/OtpInput/__stories__/Default.tsx +1 -1
  505. package/src/inputs/OtpInput/index.test.tsx +4 -0
  506. package/src/inputs/OtpInput/index.tsx +45 -34
  507. package/src/inputs/Radio/Radio.stories.js +3 -0
  508. package/src/inputs/Radio/__stories__/Conditional.tsx +1 -1
  509. package/src/inputs/Radio/__stories__/Default.tsx +1 -1
  510. package/src/inputs/Radio/__stories__/WithDivider.tsx +1 -1
  511. package/src/inputs/Radio/index.test.tsx +4 -0
  512. package/src/inputs/Radio/index.tsx +31 -22
  513. package/src/inputs/Select/Select.stories.js +3 -0
  514. package/src/inputs/Select/__stories__/Default.tsx +1 -1
  515. package/src/inputs/Select/index.test.tsx +4 -0
  516. package/src/inputs/Select/index.tsx +20 -8
  517. package/src/{Field/utils/index.ts → inputs/registry.ts} +11 -1
  518. package/src/lazy.js +80 -67
  519. package/src/registry.js +122 -102
  520. package/src/types.tsx +16 -7
  521. package/src/utils.ts +32 -10
  522. package/src/validators/index.ts +110 -34
  523. package/src/validators/types.ts +1 -1
  524. package/src/validators/utils/amka.ts +39 -0
  525. package/src/validators/utils/date.ts +30 -6
  526. package/src/validators/utils/datetime.ts +222 -0
  527. package/src/validators/utils/email.ts +11 -0
  528. package/src/validators/utils/file.ts +35 -19
  529. package/src/validators/utils/iban.ts +2 -2
  530. package/src/validators/utils/image.ts +2 -2
  531. package/src/validators/utils/index.ts +7 -3
  532. package/src/validators/utils/int.ts +2 -2
  533. package/src/validators/utils/number.ts +2 -2
  534. package/src/validators/utils/otp.ts +2 -2
  535. package/src/validators/utils/phone.ts +3 -3
  536. package/src/validators/utils/postal_code.ts +3 -3
  537. package/src/validators/utils/text_limit.ts +2 -2
  538. package/src/validators/utils/uuid4.ts +2 -1
  539. package/src/validators/validators.spec.ts +3 -3
  540. package/types.d.ts +12 -6
  541. package/types.js.map +1 -1
  542. package/utils/index.js +22 -7
  543. package/utils.d.ts +3 -1
  544. package/utils.js.map +2 -2
  545. package/validators/index.d.ts +6 -6
  546. package/validators/index.js +61 -25
  547. package/validators/index.js.map +2 -2
  548. package/validators/types.d.ts +1 -1
  549. package/validators/utils/amka/index.js +36 -0
  550. package/validators/utils/amka/package.json +6 -0
  551. package/validators/utils/amka.d.ts +6 -0
  552. package/validators/utils/amka.js.map +7 -0
  553. package/validators/utils/date/index.js +26 -3
  554. package/validators/utils/date.d.ts +3 -3
  555. package/validators/utils/date.js.map +2 -2
  556. package/validators/utils/datetime/index.js +210 -0
  557. package/validators/utils/datetime/package.json +6 -0
  558. package/validators/utils/datetime.d.ts +9 -0
  559. package/validators/utils/datetime.js.map +7 -0
  560. package/validators/utils/email/index.js +16 -0
  561. package/validators/utils/email/package.json +6 -0
  562. package/validators/utils/email.d.ts +5 -0
  563. package/validators/utils/email.js.map +7 -0
  564. package/validators/utils/file/index.js +30 -17
  565. package/validators/utils/file.d.ts +2 -2
  566. package/validators/utils/file.js.map +2 -2
  567. package/validators/utils/iban.d.ts +2 -2
  568. package/validators/utils/iban.js.map +1 -1
  569. package/validators/utils/image.d.ts +2 -2
  570. package/validators/utils/image.js.map +1 -1
  571. package/validators/utils/index.d.ts +4 -2
  572. package/validators/utils/index.js +5 -1
  573. package/validators/utils/index.js.map +2 -2
  574. package/validators/utils/int/index.js +1 -1
  575. package/validators/utils/int.d.ts +1 -1
  576. package/validators/utils/int.js.map +2 -2
  577. package/validators/utils/number/index.js +1 -1
  578. package/validators/utils/number.d.ts +1 -1
  579. package/validators/utils/number.js.map +2 -2
  580. package/validators/utils/otp.d.ts +2 -2
  581. package/validators/utils/otp.js.map +1 -1
  582. package/validators/utils/phone.d.ts +3 -3
  583. package/validators/utils/phone.js.map +2 -2
  584. package/validators/utils/postal_code.d.ts +3 -3
  585. package/validators/utils/postal_code.js.map +1 -1
  586. package/validators/utils/text_limit.d.ts +2 -2
  587. package/validators/utils/text_limit.js.map +1 -1
  588. package/validators/utils/uuid4.js.map +2 -2
  589. package/Field/utils/calculateField/index.js +0 -27
  590. package/Field/utils/calculateField/package.json +0 -6
  591. package/Field/utils/calculateField.d.ts +0 -2
  592. package/Field/utils/calculateField.js.map +0 -7
  593. package/Field/utils/index.js.map +0 -7
  594. package/FieldArray/FieldArray.stories/index.js +0 -14
  595. package/FieldArray/FieldArray.stories/package.json +0 -6
  596. package/FieldArray/FieldArray.stories.js.map +0 -7
  597. package/FieldArray/__stories__/Default/index.js +0 -95
  598. package/FieldArray/__stories__/Default/package.json +0 -6
  599. package/FieldArray/__stories__/Default.js.map +0 -7
  600. package/FieldArray/__stories__/WithExactLength/index.js +0 -95
  601. package/FieldArray/__stories__/WithExactLength/package.json +0 -6
  602. package/FieldArray/__stories__/WithExactLength.js.map +0 -7
  603. package/Form.stories/index.js +0 -7
  604. package/Form.stories.js.map +0 -7
  605. package/FormBuilder/FormBuilder.stories/index.js +0 -12
  606. package/FormBuilder/FormBuilder.stories/package.json +0 -6
  607. package/FormBuilder/FormBuilder.stories.js.map +0 -7
  608. package/FormBuilder/__stories__/Default/index.js +0 -32
  609. package/FormBuilder/__stories__/Default/package.json +0 -6
  610. package/FormBuilder/__stories__/Default.js.map +0 -7
  611. package/FormBuilder/index.test.d.ts +0 -1
  612. package/FormBuilder/scenarios.test.d.ts +0 -88
  613. package/MultiplicityField/MultiplicityField.stories/index.js +0 -22
  614. package/MultiplicityField/MultiplicityField.stories/package.json +0 -6
  615. package/MultiplicityField/MultiplicityField.stories.js.map +0 -7
  616. package/MultiplicityField/__stories__/Default/index.js +0 -100
  617. package/MultiplicityField/__stories__/Default/package.json +0 -6
  618. package/MultiplicityField/__stories__/Default.js.map +0 -7
  619. package/MultiplicityField/__stories__/PreviewDisplay/index.js +0 -70
  620. package/MultiplicityField/__stories__/PreviewDisplay/package.json +0 -6
  621. package/MultiplicityField/__stories__/PreviewDisplay.js.map +0 -7
  622. package/MultiplicityField/__stories__/WithExactLength/index.js +0 -97
  623. package/MultiplicityField/__stories__/WithExactLength/package.json +0 -6
  624. package/MultiplicityField/__stories__/WithExactLength.js.map +0 -7
  625. package/MultiplicityField/__stories__/WithMaxLength/index.js +0 -100
  626. package/MultiplicityField/__stories__/WithMaxLength/package.json +0 -6
  627. package/MultiplicityField/__stories__/WithMaxLength.js.map +0 -7
  628. package/MultiplicityField/__stories__/WithMinAndMaxLength/index.js +0 -101
  629. package/MultiplicityField/__stories__/WithMinAndMaxLength/package.json +0 -6
  630. package/MultiplicityField/__stories__/WithMinAndMaxLength.js.map +0 -7
  631. package/MultiplicityField/__stories__/WithMinLength/index.js +0 -100
  632. package/MultiplicityField/__stories__/WithMinLength/package.json +0 -6
  633. package/MultiplicityField/__stories__/WithMinLength.js.map +0 -7
  634. package/MultiplicityField/index.test.d.ts +0 -1
  635. package/Questions/Questions.stories/index.js +0 -12
  636. package/Questions/Questions.stories.js.map +0 -7
  637. package/Questions/__stories__/Default/index.js +0 -108
  638. package/Questions/__stories__/Default/package.json +0 -6
  639. package/Questions/__stories__/Default.js.map +0 -7
  640. package/Questions/index.spec.d.ts +0 -1
  641. package/Questions/index.test.d.ts +0 -1
  642. package/cjs/Field/utils/calculateField/index.js +0 -50
  643. package/cjs/Field/utils/calculateField.js.map +0 -7
  644. package/cjs/Field/utils/index.js.map +0 -7
  645. package/cjs/FieldArray/FieldArray.stories/index.js +0 -48
  646. package/cjs/FieldArray/FieldArray.stories.js.map +0 -7
  647. package/cjs/FieldArray/__stories__/Default/index.js +0 -128
  648. package/cjs/FieldArray/__stories__/Default.js.map +0 -7
  649. package/cjs/FieldArray/__stories__/WithExactLength/index.js +0 -128
  650. package/cjs/FieldArray/__stories__/WithExactLength.js.map +0 -7
  651. package/cjs/Form.stories.js.map +0 -7
  652. package/cjs/FormBuilder/FormBuilder.stories.js.map +0 -7
  653. package/cjs/FormBuilder/__stories__/Default.js.map +0 -7
  654. package/cjs/MultiplicityField/MultiplicityField.stories/index.js +0 -60
  655. package/cjs/MultiplicityField/MultiplicityField.stories.js.map +0 -7
  656. package/cjs/MultiplicityField/__stories__/Default/index.js +0 -133
  657. package/cjs/MultiplicityField/__stories__/Default.js.map +0 -7
  658. package/cjs/MultiplicityField/__stories__/PreviewDisplay/index.js +0 -86
  659. package/cjs/MultiplicityField/__stories__/PreviewDisplay.js.map +0 -7
  660. package/cjs/MultiplicityField/__stories__/WithExactLength/index.js +0 -130
  661. package/cjs/MultiplicityField/__stories__/WithExactLength.js.map +0 -7
  662. package/cjs/MultiplicityField/__stories__/WithMaxLength/index.js +0 -133
  663. package/cjs/MultiplicityField/__stories__/WithMaxLength.js.map +0 -7
  664. package/cjs/MultiplicityField/__stories__/WithMinAndMaxLength/index.js +0 -134
  665. package/cjs/MultiplicityField/__stories__/WithMinAndMaxLength.js.map +0 -7
  666. package/cjs/MultiplicityField/__stories__/WithMinLength/index.js +0 -133
  667. package/cjs/MultiplicityField/__stories__/WithMinLength.js.map +0 -7
  668. package/cjs/Questions/Questions.stories/index.js +0 -45
  669. package/cjs/Questions/Questions.stories.js.map +0 -7
  670. package/cjs/Questions/__stories__/Default/index.js +0 -136
  671. package/cjs/Questions/__stories__/Default.js.map +0 -7
  672. package/cjs/inputs/AutoCompleteInput/AutoComplete.stories/index.js +0 -48
  673. package/cjs/inputs/AutoCompleteInput/AutoComplete.stories.js.map +0 -7
  674. package/cjs/inputs/AutoCompleteInput/__stories__/Default/index.js +0 -83
  675. package/cjs/inputs/AutoCompleteInput/__stories__/Default.js.map +0 -7
  676. package/cjs/inputs/AutoCompleteInput/__stories__/Multiple/index.js +0 -83
  677. package/cjs/inputs/AutoCompleteInput/__stories__/Multiple.js.map +0 -7
  678. package/cjs/inputs/Checkboxes/Checkboxes.stories/index.js +0 -51
  679. package/cjs/inputs/Checkboxes/Checkboxes.stories.js.map +0 -7
  680. package/cjs/inputs/Checkboxes/__stories__/Conditional/index.js +0 -133
  681. package/cjs/inputs/Checkboxes/__stories__/Conditional.js.map +0 -7
  682. package/cjs/inputs/Checkboxes/__stories__/Default/index.js +0 -77
  683. package/cjs/inputs/Checkboxes/__stories__/Default.js.map +0 -7
  684. package/cjs/inputs/Checkboxes/__stories__/WithDivider/index.js +0 -78
  685. package/cjs/inputs/Checkboxes/__stories__/WithDivider.js.map +0 -7
  686. package/cjs/inputs/DateInput/DateInput.stories/index.js +0 -45
  687. package/cjs/inputs/DateInput/DateInput.stories.js.map +0 -7
  688. package/cjs/inputs/DateInput/__stories__/Default/index.js +0 -61
  689. package/cjs/inputs/DateInput/__stories__/Default.js.map +0 -7
  690. package/cjs/inputs/FileInput/FileInput.stories/index.js +0 -45
  691. package/cjs/inputs/FileInput/FileInput.stories.js.map +0 -7
  692. package/cjs/inputs/FileInput/__stories__/Default/index.js +0 -61
  693. package/cjs/inputs/FileInput/__stories__/Default.js.map +0 -7
  694. package/cjs/inputs/ImageInput/ImageInput.stories/index.js +0 -51
  695. package/cjs/inputs/ImageInput/ImageInput.stories.js.map +0 -7
  696. package/cjs/inputs/ImageInput/__stories__/Default/index.js +0 -63
  697. package/cjs/inputs/ImageInput/__stories__/Default.js.map +0 -7
  698. package/cjs/inputs/ImageInput/__stories__/MaxSize/index.js +0 -69
  699. package/cjs/inputs/ImageInput/__stories__/MaxSize.js.map +0 -7
  700. package/cjs/inputs/ImageInput/__stories__/WithInvalidImageDimension/index.js +0 -72
  701. package/cjs/inputs/ImageInput/__stories__/WithInvalidImageDimension.js.map +0 -7
  702. package/cjs/inputs/ImageInput/__stories__/WithInvalidImageSize/index.js +0 -68
  703. package/cjs/inputs/ImageInput/__stories__/WithInvalidImageSize.js.map +0 -7
  704. package/cjs/inputs/Input/Input.stories/index.js +0 -72
  705. package/cjs/inputs/Input/Input.stories.js.map +0 -7
  706. package/cjs/inputs/Input/__stories__/AFM/index.js +0 -63
  707. package/cjs/inputs/Input/__stories__/AFM.js.map +0 -7
  708. package/cjs/inputs/Input/__stories__/Boolean/index.js +0 -64
  709. package/cjs/inputs/Input/__stories__/Boolean.js.map +0 -7
  710. package/cjs/inputs/Input/__stories__/IBAN/index.js +0 -64
  711. package/cjs/inputs/Input/__stories__/IBAN.js.map +0 -7
  712. package/cjs/inputs/Input/__stories__/Integer/index.js +0 -78
  713. package/cjs/inputs/Input/__stories__/Integer.js.map +0 -7
  714. package/cjs/inputs/Input/__stories__/LandlineNumber/index.js +0 -67
  715. package/cjs/inputs/Input/__stories__/LandlineNumber.js.map +0 -7
  716. package/cjs/inputs/Input/__stories__/MobilePhone/index.js +0 -67
  717. package/cjs/inputs/Input/__stories__/MobilePhone.js.map +0 -7
  718. package/cjs/inputs/Input/__stories__/PhoneNumber/index.js +0 -66
  719. package/cjs/inputs/Input/__stories__/PhoneNumber.js.map +0 -7
  720. package/cjs/inputs/Input/__stories__/PostalCode/index.js +0 -64
  721. package/cjs/inputs/Input/__stories__/PostalCode.js.map +0 -7
  722. package/cjs/inputs/Input/__stories__/String/index.js +0 -64
  723. package/cjs/inputs/Input/__stories__/String.js.map +0 -7
  724. package/cjs/inputs/Input/__stories__/TextWithLimit/index.js +0 -64
  725. package/cjs/inputs/Input/__stories__/TextWithLimit.js.map +0 -7
  726. package/cjs/inputs/Input/inputsInputScenarios/index.js +0 -439
  727. package/cjs/inputs/Input/inputsInputScenarios.js.map +0 -7
  728. package/cjs/inputs/Label/Label.stories/index.js +0 -45
  729. package/cjs/inputs/Label/Label.stories.js.map +0 -7
  730. package/cjs/inputs/Label/__stories__/Default/index.js +0 -72
  731. package/cjs/inputs/Label/__stories__/Default.js.map +0 -7
  732. package/cjs/inputs/OtpInput/OtpInput.stories/index.js +0 -45
  733. package/cjs/inputs/OtpInput/OtpInput.stories.js.map +0 -7
  734. package/cjs/inputs/OtpInput/__stories__/Default/index.js +0 -64
  735. package/cjs/inputs/OtpInput/__stories__/Default.js.map +0 -7
  736. package/cjs/inputs/Radio/Radio.stories/index.js +0 -51
  737. package/cjs/inputs/Radio/Radio.stories.js.map +0 -7
  738. package/cjs/inputs/Radio/__stories__/Conditional/index.js +0 -133
  739. package/cjs/inputs/Radio/__stories__/Conditional.js.map +0 -7
  740. package/cjs/inputs/Radio/__stories__/Default/index.js +0 -81
  741. package/cjs/inputs/Radio/__stories__/Default.js.map +0 -7
  742. package/cjs/inputs/Radio/__stories__/WithDivider/index.js +0 -82
  743. package/cjs/inputs/Radio/__stories__/WithDivider.js.map +0 -7
  744. package/cjs/inputs/Select/Select.stories/index.js +0 -45
  745. package/cjs/inputs/Select/Select.stories.js.map +0 -7
  746. package/cjs/inputs/Select/__stories__/Default/index.js +0 -86
  747. package/cjs/inputs/Select/__stories__/Default.js.map +0 -7
  748. package/cjs/inputs/inputsScenarios/index.js +0 -539
  749. package/cjs/inputs/inputsScenarios.js.map +0 -7
  750. package/cjs/locales/el/index.js +0 -35
  751. package/cjs/locales/el.js.map +0 -7
  752. package/inputs/AutoCompleteInput/AutoComplete.stories/index.js +0 -14
  753. package/inputs/AutoCompleteInput/AutoComplete.stories/package.json +0 -6
  754. package/inputs/AutoCompleteInput/AutoComplete.stories.js.map +0 -7
  755. package/inputs/AutoCompleteInput/__stories__/Default/index.js +0 -50
  756. package/inputs/AutoCompleteInput/__stories__/Default/package.json +0 -6
  757. package/inputs/AutoCompleteInput/__stories__/Default.js.map +0 -7
  758. package/inputs/AutoCompleteInput/__stories__/Multiple/index.js +0 -50
  759. package/inputs/AutoCompleteInput/__stories__/Multiple/package.json +0 -6
  760. package/inputs/AutoCompleteInput/__stories__/Multiple.js.map +0 -7
  761. package/inputs/AutoCompleteInput/index.test.d.ts +0 -1
  762. package/inputs/Checkboxes/Checkboxes.stories/index.js +0 -16
  763. package/inputs/Checkboxes/Checkboxes.stories.js.map +0 -7
  764. package/inputs/Checkboxes/__stories__/Conditional/index.js +0 -100
  765. package/inputs/Checkboxes/__stories__/Conditional/package.json +0 -6
  766. package/inputs/Checkboxes/__stories__/Conditional.js.map +0 -7
  767. package/inputs/Checkboxes/__stories__/Default/index.js +0 -44
  768. package/inputs/Checkboxes/__stories__/Default/package.json +0 -6
  769. package/inputs/Checkboxes/__stories__/Default.js.map +0 -7
  770. package/inputs/Checkboxes/__stories__/WithDivider/index.js +0 -45
  771. package/inputs/Checkboxes/__stories__/WithDivider/package.json +0 -6
  772. package/inputs/Checkboxes/__stories__/WithDivider.js.map +0 -7
  773. package/inputs/Checkboxes/index.test.d.ts +0 -1
  774. package/inputs/DateInput/DateInput.stories/index.js +0 -12
  775. package/inputs/DateInput/DateInput.stories.js.map +0 -7
  776. package/inputs/DateInput/__stories__/Default/index.js +0 -28
  777. package/inputs/DateInput/__stories__/Default.js.map +0 -7
  778. package/inputs/DateInput/index.test.d.ts +0 -1
  779. package/inputs/FileInput/FileInput.stories/index.js +0 -12
  780. package/inputs/FileInput/FileInput.stories/package.json +0 -6
  781. package/inputs/FileInput/FileInput.stories.js.map +0 -7
  782. package/inputs/FileInput/__stories__/Default/index.js +0 -28
  783. package/inputs/FileInput/__stories__/Default/package.json +0 -6
  784. package/inputs/FileInput/__stories__/Default.js.map +0 -7
  785. package/inputs/FileInput/index.test.d.ts +0 -1
  786. package/inputs/ImageInput/ImageInput.stories/index.js +0 -16
  787. package/inputs/ImageInput/ImageInput.stories/package.json +0 -6
  788. package/inputs/ImageInput/ImageInput.stories.js.map +0 -7
  789. package/inputs/ImageInput/__stories__/Default/index.js +0 -30
  790. package/inputs/ImageInput/__stories__/Default/package.json +0 -6
  791. package/inputs/ImageInput/__stories__/Default.js.map +0 -7
  792. package/inputs/ImageInput/__stories__/MaxSize/index.js +0 -36
  793. package/inputs/ImageInput/__stories__/MaxSize/package.json +0 -6
  794. package/inputs/ImageInput/__stories__/MaxSize.js.map +0 -7
  795. package/inputs/ImageInput/__stories__/WithInvalidImageDimension/index.js +0 -39
  796. package/inputs/ImageInput/__stories__/WithInvalidImageDimension/package.json +0 -6
  797. package/inputs/ImageInput/__stories__/WithInvalidImageDimension.js.map +0 -7
  798. package/inputs/ImageInput/__stories__/WithInvalidImageSize/index.js +0 -35
  799. package/inputs/ImageInput/__stories__/WithInvalidImageSize/package.json +0 -6
  800. package/inputs/ImageInput/__stories__/WithInvalidImageSize.d.ts +0 -3
  801. package/inputs/ImageInput/__stories__/WithInvalidImageSize.js.map +0 -7
  802. package/inputs/ImageInput/index.test.d.ts +0 -1
  803. package/inputs/Input/Input.stories/index.js +0 -30
  804. package/inputs/Input/Input.stories/package.json +0 -6
  805. package/inputs/Input/Input.stories.js.map +0 -7
  806. package/inputs/Input/__stories__/AFM/index.js +0 -30
  807. package/inputs/Input/__stories__/AFM/package.json +0 -6
  808. package/inputs/Input/__stories__/AFM.js.map +0 -7
  809. package/inputs/Input/__stories__/Boolean/index.js +0 -31
  810. package/inputs/Input/__stories__/Boolean/package.json +0 -6
  811. package/inputs/Input/__stories__/Boolean.js.map +0 -7
  812. package/inputs/Input/__stories__/IBAN/index.js +0 -31
  813. package/inputs/Input/__stories__/IBAN/package.json +0 -6
  814. package/inputs/Input/__stories__/IBAN.js.map +0 -7
  815. package/inputs/Input/__stories__/Integer/index.js +0 -45
  816. package/inputs/Input/__stories__/Integer/package.json +0 -6
  817. package/inputs/Input/__stories__/Integer.js.map +0 -7
  818. package/inputs/Input/__stories__/LandlineNumber/index.js +0 -34
  819. package/inputs/Input/__stories__/LandlineNumber/package.json +0 -6
  820. package/inputs/Input/__stories__/LandlineNumber.js.map +0 -7
  821. package/inputs/Input/__stories__/MobilePhone/index.js +0 -34
  822. package/inputs/Input/__stories__/MobilePhone/package.json +0 -6
  823. package/inputs/Input/__stories__/MobilePhone.js.map +0 -7
  824. package/inputs/Input/__stories__/PhoneNumber/index.js +0 -33
  825. package/inputs/Input/__stories__/PhoneNumber/package.json +0 -6
  826. package/inputs/Input/__stories__/PhoneNumber.js.map +0 -7
  827. package/inputs/Input/__stories__/PostalCode/index.js +0 -31
  828. package/inputs/Input/__stories__/PostalCode/package.json +0 -6
  829. package/inputs/Input/__stories__/PostalCode.js.map +0 -7
  830. package/inputs/Input/__stories__/String/index.js +0 -31
  831. package/inputs/Input/__stories__/String/package.json +0 -6
  832. package/inputs/Input/__stories__/String.js.map +0 -7
  833. package/inputs/Input/__stories__/TextWithLimit/index.js +0 -31
  834. package/inputs/Input/__stories__/TextWithLimit/package.json +0 -6
  835. package/inputs/Input/__stories__/TextWithLimit.js.map +0 -7
  836. package/inputs/Input/index.test.d.ts +0 -1
  837. package/inputs/Input/inputsInputScenarios/index.js +0 -406
  838. package/inputs/Input/inputsInputScenarios/package.json +0 -6
  839. package/inputs/Input/inputsInputScenarios.d.ts +0 -57
  840. package/inputs/Input/inputsInputScenarios.js.map +0 -7
  841. package/inputs/Label/Label.stories/index.js +0 -12
  842. package/inputs/Label/Label.stories/package.json +0 -6
  843. package/inputs/Label/Label.stories.js.map +0 -7
  844. package/inputs/Label/__stories__/Default/index.js +0 -39
  845. package/inputs/Label/__stories__/Default/package.json +0 -6
  846. package/inputs/Label/__stories__/Default.js.map +0 -7
  847. package/inputs/Label/index.test.d.ts +0 -1
  848. package/inputs/OtpInput/OtpInput.stories/index.js +0 -12
  849. package/inputs/OtpInput/OtpInput.stories/package.json +0 -6
  850. package/inputs/OtpInput/OtpInput.stories.js.map +0 -7
  851. package/inputs/OtpInput/__stories__/Default/index.js +0 -31
  852. package/inputs/OtpInput/__stories__/Default/package.json +0 -6
  853. package/inputs/OtpInput/__stories__/Default.js.map +0 -7
  854. package/inputs/OtpInput/index.test.d.ts +0 -1
  855. package/inputs/Radio/Radio.stories/index.js +0 -16
  856. package/inputs/Radio/Radio.stories/package.json +0 -6
  857. package/inputs/Radio/Radio.stories.js.map +0 -7
  858. package/inputs/Radio/__stories__/Conditional/index.js +0 -100
  859. package/inputs/Radio/__stories__/Conditional/package.json +0 -6
  860. package/inputs/Radio/__stories__/Conditional.js.map +0 -7
  861. package/inputs/Radio/__stories__/Default/index.js +0 -48
  862. package/inputs/Radio/__stories__/Default/package.json +0 -6
  863. package/inputs/Radio/__stories__/Default.js.map +0 -7
  864. package/inputs/Radio/__stories__/WithDivider/index.js +0 -49
  865. package/inputs/Radio/__stories__/WithDivider/package.json +0 -6
  866. package/inputs/Radio/__stories__/WithDivider.js.map +0 -7
  867. package/inputs/Radio/index.test.d.ts +0 -1
  868. package/inputs/Select/Select.stories/index.js +0 -12
  869. package/inputs/Select/Select.stories/package.json +0 -6
  870. package/inputs/Select/Select.stories.js.map +0 -7
  871. package/inputs/Select/__stories__/Default/index.js +0 -53
  872. package/inputs/Select/__stories__/Default/package.json +0 -6
  873. package/inputs/Select/__stories__/Default.js.map +0 -7
  874. package/inputs/Select/index.test.d.ts +0 -1
  875. package/inputs/inputsScenarios/index.js +0 -505
  876. package/inputs/inputsScenarios.d.ts +0 -296
  877. package/inputs/inputsScenarios.js.map +0 -7
  878. package/lazy.d.ts +0 -80
  879. package/lazy.js.map +0 -7
  880. package/locales/el/index.js +0 -6
  881. package/locales/el.d.ts +0 -2
  882. package/locales/el.js.map +0 -7
  883. package/registry.d.ts +0 -71
  884. package/registry.js.map +0 -7
  885. package/src/Field/utils/calculateField.ts +0 -49
  886. package/src/inputs/Input/inputsInputScenarios.ts +0 -405
  887. package/src/inputs/inputsScenarios.ts +0 -502
  888. package/src/locales/el.ts +0 -3
  889. /package/{FieldArray/index.test.d.ts → hooks/__tests__/utils.spec.d.ts} +0 -0
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/validators/utils/iban.ts"],
4
- "sourcesContent": ["import { FieldSpec } from '@digigov/form/types';\nimport { ValidatorSchema } from '@digigov/form/validators/types';\nexport function validateIban(value: string, countryCode: string): boolean {\n value = value.replace(/\\s/g, '').replace(/-/g, '');\n if (value.match(/^[0-9]*$/i)) {\n // this is for greek iban without the country code\n if (value.length !== 25) {\n return false;\n }\n } else {\n value = value.toUpperCase();\n if (countryCode) {\n if (!value.startsWith(countryCode.toUpperCase())) {\n return false;\n }\n if (value.length === ibanCountryCodesLengths[countryCode.toUpperCase()]) {\n return true;\n }\n }\n if (value.length !== 27) {\n // this is for greek iban\n return false;\n }\n }\n return true;\n}\n\nexport const IBAN_VALIDATOR = (field: FieldSpec): ValidatorSchema => {\n const countryCode = field?.extra?.country;\n return {\n name: 'iban-validator',\n message: 'form.error.iban',\n test: (value: string): boolean => {\n if (!value) {\n return true;\n }\n return validateIban(value, countryCode);\n },\n };\n};\n\nconst ibanCountryCodesLengths = {\n AD: 24,\n AT: 20,\n AZ: 28,\n BH: 22,\n BY: 28,\n BE: 16,\n BA: 20,\n BR: 29,\n BG: 22,\n CR: 22,\n HR: 21,\n CY: 28,\n CZ: 24,\n DK: 18,\n DO: 28,\n EG: 29,\n SV: 28,\n EE: 20,\n FO: 18,\n FI: 18,\n FR: 27,\n GE: 22,\n DE: 22,\n GI: 23,\n GR: 27,\n GL: 18,\n GT: 28,\n VA: 22,\n HU: 28,\n IS: 26,\n IQ: 23,\n IE: 22,\n IL: 23,\n IT: 27,\n JO: 30,\n KZ: 20,\n XK: 20,\n KW: 30,\n LV: 21,\n LB: 28,\n LI: 21,\n LT: 20,\n LU: 20,\n MT: 31,\n MR: 27,\n MU: 30,\n MD: 24,\n MC: 27,\n ME: 22,\n NL: 18,\n MK: 19,\n NO: 15,\n PK: 24,\n PS: 29,\n PL: 28,\n PT: 25,\n QA: 29,\n RO: 24,\n LC: 32,\n SM: 27,\n ST: 25,\n SA: 24,\n RS: 22,\n SC: 31,\n SK: 24,\n SI: 19,\n ES: 24,\n SE: 24,\n CH: 21,\n TL: 23,\n TN: 24,\n TR: 26,\n UA: 29,\n AE: 23,\n GB: 22,\n VG: 24,\n};\n"],
4
+ "sourcesContent": ["import type { FieldSpec } from '@digigov/form/types';\nimport type { ValidatorSchema } from '@digigov/form/validators/types';\nexport function validateIban(value: string, countryCode: string): boolean {\n value = value.replace(/\\s/g, '').replace(/-/g, '');\n if (value.match(/^[0-9]*$/i)) {\n // this is for greek iban without the country code\n if (value.length !== 25) {\n return false;\n }\n } else {\n value = value.toUpperCase();\n if (countryCode) {\n if (!value.startsWith(countryCode.toUpperCase())) {\n return false;\n }\n if (value.length === ibanCountryCodesLengths[countryCode.toUpperCase()]) {\n return true;\n }\n }\n if (value.length !== 27) {\n // this is for greek iban\n return false;\n }\n }\n return true;\n}\n\nexport const IBAN_VALIDATOR = (field: FieldSpec): ValidatorSchema => {\n const countryCode = field?.extra?.country;\n return {\n name: 'iban-validator',\n message: 'form.error.iban',\n test: (value: string): boolean => {\n if (!value) {\n return true;\n }\n return validateIban(value, countryCode);\n },\n };\n};\n\nconst ibanCountryCodesLengths = {\n AD: 24,\n AT: 20,\n AZ: 28,\n BH: 22,\n BY: 28,\n BE: 16,\n BA: 20,\n BR: 29,\n BG: 22,\n CR: 22,\n HR: 21,\n CY: 28,\n CZ: 24,\n DK: 18,\n DO: 28,\n EG: 29,\n SV: 28,\n EE: 20,\n FO: 18,\n FI: 18,\n FR: 27,\n GE: 22,\n DE: 22,\n GI: 23,\n GR: 27,\n GL: 18,\n GT: 28,\n VA: 22,\n HU: 28,\n IS: 26,\n IQ: 23,\n IE: 22,\n IL: 23,\n IT: 27,\n JO: 30,\n KZ: 20,\n XK: 20,\n KW: 30,\n LV: 21,\n LB: 28,\n LI: 21,\n LT: 20,\n LU: 20,\n MT: 31,\n MR: 27,\n MU: 30,\n MD: 24,\n MC: 27,\n ME: 22,\n NL: 18,\n MK: 19,\n NO: 15,\n PK: 24,\n PS: 29,\n PL: 28,\n PT: 25,\n QA: 29,\n RO: 24,\n LC: 32,\n SM: 27,\n ST: 25,\n SA: 24,\n RS: 22,\n SC: 31,\n SK: 24,\n SI: 19,\n ES: 24,\n SE: 24,\n CH: 21,\n TL: 23,\n TN: 24,\n TR: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;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACN;",
6
6
  "names": []
7
7
  }
@@ -1,3 +1,3 @@
1
- import { FieldSpec } from '@digigov/form/types';
2
- import { ValidatorSchema } from '@digigov/form/validators/types';
1
+ import type { FieldSpec } from '@digigov/form/types';
2
+ import type { ValidatorSchema } from '@digigov/form/validators/types';
3
3
  export declare const IMAGE_DIMENSION_VALIDATOR: (field: FieldSpec) => ValidatorSchema;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/validators/utils/image.ts"],
4
- "sourcesContent": ["import { FieldSpec } from '@digigov/form/types';\nimport { ValidatorSchema } from '@digigov/form/validators/types';\n\nconst DEFAULT_IMAGE_MAX_HEIGHT_SIZE = 2000;\nconst DEFAULT_IMAGE_MAX_WIDTH_SIZE = 2000;\nconst DEFAULT_IMAGE_MIN_HEIGHT_SIZE = 100;\nconst DEFAULT_IMAGE_MIN_WIDTH_SIZE = 100;\n\nfunction getImageDimensions(\n file: File\n): Promise<{ width: number; height: number }> {\n return new Promise((resolve, reject) => {\n const reader = new FileReader();\n reader.onload = (event) => {\n const img = new Image();\n img.onload = () => {\n resolve({ width: img.width, height: img.height });\n };\n img.onerror = reject;\n const result = event?.target?.result;\n if (result && typeof result === 'string') {\n img.src = result;\n } else {\n reject(new Error('Invalid file format'));\n }\n };\n reader.onerror = reject;\n reader.readAsDataURL(file);\n });\n}\n\nexport const IMAGE_DIMENSION_VALIDATOR = (\n field: FieldSpec\n): ValidatorSchema => ({\n name: 'image-dimension-validator',\n message: (value: any) => {\n const minHeight =\n field?.extra?.limit?.minHeight || DEFAULT_IMAGE_MIN_HEIGHT_SIZE;\n const minWidth =\n field?.extra?.limit?.minWidth || DEFAULT_IMAGE_MIN_WIDTH_SIZE;\n const maxHeight =\n field?.extra?.limit?.maxHeight || DEFAULT_IMAGE_MAX_HEIGHT_SIZE;\n const maxWidth =\n field?.extra?.limit?.maxWidth || DEFAULT_IMAGE_MAX_WIDTH_SIZE;\n if (!value || value.length === 0) {\n return {\n name: 'image-validator',\n message: 'form.error.required',\n };\n } else {\n return {\n key: 'form.error.image.image_dimension_size',\n context: {\n maxHeight: maxHeight,\n maxWidth: maxWidth,\n minHeight: minHeight,\n minWidth: minWidth,\n },\n };\n }\n },\n test: async (value: File[]): Promise<boolean> => {\n if (!value || value.length === 0) {\n return true;\n }\n const file = value[0];\n const { width, height } = await getImageDimensions(file);\n const maxHeight =\n field?.extra?.limit?.maxHeight || DEFAULT_IMAGE_MAX_HEIGHT_SIZE;\n const maxWidth =\n field?.extra?.limit?.maxWidth || DEFAULT_IMAGE_MAX_WIDTH_SIZE;\n const minHeight =\n field?.extra?.limit?.minHeight || DEFAULT_IMAGE_MIN_HEIGHT_SIZE;\n const minWidth =\n field?.extra?.limit?.minWidth || DEFAULT_IMAGE_MIN_WIDTH_SIZE;\n if (!file) {\n return true;\n }\n try {\n if (height > maxHeight || width > maxWidth) {\n return false;\n }\n if (height < minHeight || width < minWidth) {\n return false;\n }\n return true;\n } catch (error) {\n console.error('Error getting image dimensions:', error);\n return false; // Return false in case of an error.\n }\n },\n});\n"],
4
+ "sourcesContent": ["import type { FieldSpec } from '@digigov/form/types';\nimport type { ValidatorSchema } from '@digigov/form/validators/types';\n\nconst DEFAULT_IMAGE_MAX_HEIGHT_SIZE = 2000;\nconst DEFAULT_IMAGE_MAX_WIDTH_SIZE = 2000;\nconst DEFAULT_IMAGE_MIN_HEIGHT_SIZE = 100;\nconst DEFAULT_IMAGE_MIN_WIDTH_SIZE = 100;\n\nfunction getImageDimensions(\n file: File\n): Promise<{ width: number; height: number }> {\n return new Promise((resolve, reject) => {\n const reader = new FileReader();\n reader.onload = (event) => {\n const img = new Image();\n img.onload = () => {\n resolve({ width: img.width, height: img.height });\n };\n img.onerror = reject;\n const result = event?.target?.result;\n if (result && typeof result === 'string') {\n img.src = result;\n } else {\n reject(new Error('Invalid file format'));\n }\n };\n reader.onerror = reject;\n reader.readAsDataURL(file);\n });\n}\n\nexport const IMAGE_DIMENSION_VALIDATOR = (\n field: FieldSpec\n): ValidatorSchema => ({\n name: 'image-dimension-validator',\n message: (value: any) => {\n const minHeight =\n field?.extra?.limit?.minHeight || DEFAULT_IMAGE_MIN_HEIGHT_SIZE;\n const minWidth =\n field?.extra?.limit?.minWidth || DEFAULT_IMAGE_MIN_WIDTH_SIZE;\n const maxHeight =\n field?.extra?.limit?.maxHeight || DEFAULT_IMAGE_MAX_HEIGHT_SIZE;\n const maxWidth =\n field?.extra?.limit?.maxWidth || DEFAULT_IMAGE_MAX_WIDTH_SIZE;\n if (!value || value.length === 0) {\n return {\n name: 'image-validator',\n message: 'form.error.required',\n };\n } else {\n return {\n key: 'form.error.image.image_dimension_size',\n context: {\n maxHeight: maxHeight,\n maxWidth: maxWidth,\n minHeight: minHeight,\n minWidth: minWidth,\n },\n };\n }\n },\n test: async (value: File[]): Promise<boolean> => {\n if (!value || value.length === 0) {\n return true;\n }\n const file = value[0];\n const { width, height } = await getImageDimensions(file);\n const maxHeight =\n field?.extra?.limit?.maxHeight || DEFAULT_IMAGE_MAX_HEIGHT_SIZE;\n const maxWidth =\n field?.extra?.limit?.maxWidth || DEFAULT_IMAGE_MAX_WIDTH_SIZE;\n const minHeight =\n field?.extra?.limit?.minHeight || DEFAULT_IMAGE_MIN_HEIGHT_SIZE;\n const minWidth =\n field?.extra?.limit?.minWidth || DEFAULT_IMAGE_MIN_WIDTH_SIZE;\n if (!file) {\n return true;\n }\n try {\n if (height > maxHeight || width > maxWidth) {\n return false;\n }\n if (height < minHeight || width < minWidth) {\n return false;\n }\n return true;\n } catch (error) {\n console.error('Error getting image dimensions:', error);\n return false; // Return false in case of an error.\n }\n },\n});\n"],
5
5
  "mappings": "AAGA,MAAM,gCAAgC;AACtC,MAAM,+BAA+B;AACrC,MAAM,gCAAgC;AACtC,MAAM,+BAA+B;AAErC,SAAS,mBACP,MAC4C;AAC5C,SAAO,IAAI,QAAQ,CAAC,SAAS,WAAW;AACtC,UAAM,SAAS,IAAI,WAAW;AAC9B,WAAO,SAAS,CAAC,UAAU;AACzB,YAAM,MAAM,IAAI,MAAM;AACtB,UAAI,SAAS,MAAM;AACjB,gBAAQ,EAAE,OAAO,IAAI,OAAO,QAAQ,IAAI,OAAO,CAAC;AAAA,MAClD;AACA,UAAI,UAAU;AACd,YAAM,SAAS,OAAO,QAAQ;AAC9B,UAAI,UAAU,OAAO,WAAW,UAAU;AACxC,YAAI,MAAM;AAAA,MACZ,OAAO;AACL,e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AA,EACF;AACF;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,8 @@
1
1
  import * as yup from 'yup';
2
- import { FieldSpec } from '@digigov/form/types';
3
- import { ValidatorSchema } from '@digigov/form/validators/types';
2
+ import type { FieldSpec } from '@digigov/form/types';
3
+ import type { ValidatorSchema } from '@digigov/form/validators/types';
4
4
  export * from '@digigov/form/validators/utils/afm';
5
+ export * from '@digigov/form/validators/utils/amka';
5
6
  export * from '@digigov/form/validators/utils/file';
6
7
  export * from '@digigov/form/validators/utils/iban';
7
8
  export * from '@digigov/form/validators/utils/otp';
@@ -11,6 +12,7 @@ export * from '@digigov/form/validators/utils/postal_code';
11
12
  export * from '@digigov/form/validators/utils/uuid4';
12
13
  export * from '@digigov/form/validators/utils/text_limit';
13
14
  export * from '@digigov/form/validators/utils/date';
15
+ export * from '@digigov/form/validators/utils/datetime';
14
16
  export declare function getYupField(field: FieldSpec, yupTypeMap: Record<string, any>): any;
15
17
  export declare function computeShape(fields: FieldSpec[], yupTypeMap: Record<string, ValidatorSchema>, validatorRegistry: Record<string, ValidatorSchema[]> | undefined): {};
16
18
  export declare function getYupObjectShape(fields: FieldSpec[] | any, yupTypeMap: Record<string, any>, validatorRegistry?: Record<string, ValidatorSchema[]>): yup.ObjectSchema<{
@@ -1,5 +1,6 @@
1
1
  import * as yup from "yup";
2
2
  export * from "@digigov/form/validators/utils/afm";
3
+ export * from "@digigov/form/validators/utils/amka";
3
4
  export * from "@digigov/form/validators/utils/file";
4
5
  export * from "@digigov/form/validators/utils/iban";
5
6
  export * from "@digigov/form/validators/utils/otp";
@@ -9,6 +10,7 @@ export * from "@digigov/form/validators/utils/postal_code";
9
10
  export * from "@digigov/form/validators/utils/uuid4";
10
11
  export * from "@digigov/form/validators/utils/text_limit";
11
12
  export * from "@digigov/form/validators/utils/date";
13
+ export * from "@digigov/form/validators/utils/datetime";
12
14
  function getYupField(field, yupTypeMap) {
13
15
  const yupField = yupTypeMap[field?.type || "string"] || yupTypeMap["string"];
14
16
  return yupField(field);
@@ -81,7 +83,9 @@ function getYupObjectShape(fields, yupTypeMap, validatorRegistry) {
81
83
  }
82
84
  return yup.lazy(function() {
83
85
  const fieldSchemas = computeShape(
84
- Object.values(fields.current),
86
+ Object.values(fields.current).filter(
87
+ (f) => !f.key.includes(".")
88
+ ),
85
89
  yupTypeMap,
86
90
  validatorRegistry
87
91
  );
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/validators/utils/index.ts"],
4
- "sourcesContent": ["import * as yup from 'yup';\nimport { FieldSpec } from '@digigov/form/types';\nimport { ValidatorSchema } from '@digigov/form/validators/types';\n\nexport * from '@digigov/form/validators/utils/afm';\nexport * from '@digigov/form/validators/utils/file';\nexport * from '@digigov/form/validators/utils/iban';\nexport * from '@digigov/form/validators/utils/otp';\nexport * from '@digigov/form/validators/utils/image';\nexport * from '@digigov/form/validators/utils/phone';\nexport * from '@digigov/form/validators/utils/postal_code';\nexport * from '@digigov/form/validators/utils/uuid4';\nexport * from '@digigov/form/validators/utils/text_limit';\nexport * from '@digigov/form/validators/utils/date';\n\nexport function getYupField(field: FieldSpec, yupTypeMap: Record<string, any>) {\n const yupField = yupTypeMap[field?.type || 'string'] || yupTypeMap['string'];\n return yupField(field);\n}\nexport function computeShape(\n fields: FieldSpec[],\n yupTypeMap: Record<string, ValidatorSchema>,\n validatorRegistry: Record<string, ValidatorSchema[]> | undefined\n) {\n const fieldSchemas = {};\n const objectFields: Record<string, FieldSpec[]> = {};\n fields.forEach((field) => {\n let yupField = getYupField(field, yupTypeMap);\n if (field.condition) {\n for (const key in field.condition) {\n let then: any, otherwise: any;\n if (field.condition[key].then) {\n if (field.condition[key].then?.required === false) {\n then = yupField.nullable();\n } else if (field.condition[key].then?.required === true) {\n then = yupField.nullable().required('form.error.required');\n }\n }\n if (field.condition[key].else) {\n if (field.condition[key].else?.required === false) {\n otherwise = yupField.nullable();\n } else if (field.condition[key].else?.required === true) {\n otherwise = yupField.nullable().required('form.error.required');\n }\n }\n if (then || otherwise) {\n yupField = yupField.when(key, {\n is: (val) => {\n //@ts-ignore\n const is = field.condition[key].is;\n if (is === val || (Array.isArray(val) && val.includes(is))) {\n return true;\n } else {\n return false;\n }\n },\n then,\n otherwise,\n });\n }\n }\n } else if (field.required) {\n yupField = yupField.nullable().required('form.error.required');\n }\n if (validatorRegistry && field.type && validatorRegistry[field.type]) {\n validatorRegistry[field.type].forEach((validator: any) => {\n yupField = yupField.test(validator);\n });\n }\n if (field.validators) {\n field.validators.forEach((validator) => {\n yupField = yupField.test(validator);\n });\n }\n fieldSchemas[field.key] = yupField;\n });\n for (const objectKey in objectFields) {\n fieldSchemas[objectKey] = getYupObjectShape(\n objectFields[objectKey],\n yupTypeMap,\n validatorRegistry\n );\n }\n return fieldSchemas;\n}\n\nexport function getYupObjectShape(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n fields: FieldSpec[] | any,\n yupTypeMap: Record<string, any>,\n validatorRegistry?: Record<string, ValidatorSchema[]>\n) {\n if (!fields.current) {\n const fieldSchemas = computeShape(fields, yupTypeMap, validatorRegistry);\n return yup.object().shape(fieldSchemas);\n }\n\n return yup.lazy(function () {\n const fieldSchemas = computeShape(\n Object.values(fields.current),\n yupTypeMap,\n validatorRegistry\n );\n return yup.object().shape(fieldSchemas);\n });\n}\n"],
5
- "mappings": "AAAA,YAAY,SAAS;AAIrB,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AAEP,SAAS,YAAY,OAAkB,YAAiC;AAC7E,QAAM,WAAW,WAAW,OAAO,QAAQ,QAAQ,KAAK,WAAW,QAAQ;AAC3E,SAAO,SAAS,KAAK;AACvB;AACO,SAAS,aACd,QACA,YACA,mBACA;AACA,QAAM,eAAe,CAAC;AACtB,QAAM,eAA4C,CAAC;AACnD,SAAO,QAAQ,CAAC,UAAU;AACxB,QAAI,WAAW,YAA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CAAC,cAAc;AACtC,mBAAW,SAAS,KAAK,SAAS;AAAA,MACpC,CAAC;AAAA,IACH;AACA,iBAAa,MAAM,GAAG,IAAI;AAAA,EAC5B,CAAC;AACD,aAAW,aAAa,cAAc;AACpC,iBAAa,SAAS,IAAI;AAAA,MACxB,aAAa,SAAS;AAAA,MACtB;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACA,SAAO;AACT;AAEO,SAAS,kBAEd,QACA,YACA,mBACA;AACA,MAAI,CAAC,OAAO,SAAS;AACnB,UAAM,eAAe,aAAa,QAAQ,YAAY,iBAAiB;AACvE,WAAO,IAAI,OAAO,EAAE,MAAM,YAAY;AAAA,EACxC;AAEA,SAAO,IAAI,KAAK,WAAY;AAC1B,UAAM,eAAe;AAAA,MACnB,OAAO,OAAO,OAAO,OAAO;AAAA,MAC5B;AAAA,MACA;AAAA,IACF;AACA,WAAO,IAAI,OAAO,EAAE,MAAM,YAAY;AAAA,EACxC,CAAC;AACH;",
4
+ "sourcesContent": ["import * as yup from 'yup';\nimport type { FieldSpec } from '@digigov/form/types';\nimport type { ValidatorSchema } from '@digigov/form/validators/types';\n\nexport * from '@digigov/form/validators/utils/afm';\nexport * from '@digigov/form/validators/utils/amka';\nexport * from '@digigov/form/validators/utils/file';\nexport * from '@digigov/form/validators/utils/iban';\nexport * from '@digigov/form/validators/utils/otp';\nexport * from '@digigov/form/validators/utils/image';\nexport * from '@digigov/form/validators/utils/phone';\nexport * from '@digigov/form/validators/utils/postal_code';\nexport * from '@digigov/form/validators/utils/uuid4';\nexport * from '@digigov/form/validators/utils/text_limit';\nexport * from '@digigov/form/validators/utils/date';\nexport * from '@digigov/form/validators/utils/datetime';\n\nexport function getYupField(field: FieldSpec, yupTypeMap: Record<string, any>) {\n const yupField = yupTypeMap[field?.type || 'string'] || yupTypeMap['string'];\n return yupField(field);\n}\nexport function computeShape(\n fields: FieldSpec[],\n yupTypeMap: Record<string, ValidatorSchema>,\n validatorRegistry: Record<string, ValidatorSchema[]> | undefined\n) {\n const fieldSchemas = {};\n const objectFields: Record<string, FieldSpec[]> = {};\n fields.forEach((field) => {\n let yupField = getYupField(field, yupTypeMap);\n if (field.condition) {\n for (const key in field.condition) {\n let then: any, otherwise: any;\n if (field.condition[key].then) {\n if (field.condition[key].then?.required === false) {\n then = yupField.nullable();\n } else if (field.condition[key].then?.required === true) {\n then = yupField.nullable().required('form.error.required');\n }\n }\n if (field.condition[key].else) {\n if (field.condition[key].else?.required === false) {\n otherwise = yupField.nullable();\n } else if (field.condition[key].else?.required === true) {\n otherwise = yupField.nullable().required('form.error.required');\n }\n }\n if (then || otherwise) {\n yupField = yupField.when(key, {\n is: (val) => {\n //@ts-ignore\n const is = field.condition[key].is;\n if (is === val || (Array.isArray(val) && val.includes(is))) {\n return true;\n } else {\n return false;\n }\n },\n then,\n otherwise,\n });\n }\n }\n } else if (field.required) {\n yupField = yupField.nullable().required('form.error.required');\n }\n if (validatorRegistry && field.type && validatorRegistry[field.type]) {\n validatorRegistry[field.type].forEach((validator: any) => {\n yupField = yupField.test(validator);\n });\n }\n if (field.validators) {\n field.validators.forEach((validator) => {\n yupField = yupField.test(validator);\n });\n }\n fieldSchemas[field.key] = yupField;\n });\n for (const objectKey in objectFields) {\n fieldSchemas[objectKey] = getYupObjectShape(\n objectFields[objectKey],\n yupTypeMap,\n validatorRegistry\n );\n }\n return fieldSchemas;\n}\n\nexport function getYupObjectShape(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n fields: FieldSpec[] | any,\n yupTypeMap: Record<string, any>,\n validatorRegistry?: Record<string, ValidatorSchema[]>\n) {\n if (!fields.current) {\n const fieldSchemas = computeShape(fields, yupTypeMap, validatorRegistry);\n return yup.object().shape(fieldSchemas);\n }\n\n return yup.lazy(function () {\n const fieldSchemas = computeShape(\n Object.values(fields.current).filter(\n (f: FieldSpec) => !f.key.includes('.')\n ) as FieldSpec[],\n yupTypeMap,\n validatorRegistry\n );\n return yup.object().shape(fieldSchemas);\n });\n}\n"],
5
+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;AAAA,cACT,OAAO;AACL,uBAAO;AAAA,cACT;AAAA,YACF;AAAA,YACA;AAAA,YACA;AAAA,UACF,CAAC;AAAA,QACH;AAAA,MACF;AAAA,IACF,WAAW,MAAM,UAAU;AACzB,iBAAW,SAAS,SAAS,EAAE,SAAS,qBAAqB;AAAA,IAC/D;AACA,QAAI,qBAAqB,MAAM,QAAQ,kBAAkB,MAAM,IAAI,GAAG;AACpE,wBAAkB,MAAM,IAAI,EAAE,QAAQ,CAAC,cAAmB;AACxD,mBAAW,SAAS,KAAK,SAAS;AAAA,MACpC,CAAC;AAAA,IACH;AACA,QAAI,MAAM,YAAY;AACpB,YAAM,WAAW,QAAQ,CAAC,cAAc;AACtC,mBAAW,SAAS,KAAK,SAAS;AAAA,MACpC,CAAC;AAAA,IACH;AACA,iBAAa,MAAM,GAAG,IAAI;AAAA,EAC5B,CAAC;AACD,aAAW,aAAa,cAAc;AACpC,iBAAa,SAAS,IAAI;AAAA,MACxB,aAAa,SAAS;AAAA,MACtB;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACA,SAAO;AACT;AAEO,SAAS,kBAEd,QACA,YACA,mBACA;AACA,MAAI,CAAC,OAAO,SAAS;AACnB,UAAM,eAAe,aAAa,QAAQ,YAAY,iBAAiB;AACvE,WAAO,IAAI,OAAO,EAAE,MAAM,YAAY;AAAA,EACxC;AAEA,SAAO,IAAI,KAAK,WAAY;AAC1B,UAAM,eAAe;AAAA,MACnB,OAAO,OAAO,OAAO,OAAO,EAAE;AAAA,QAC5B,CAAC,MAAiB,CAAC,EAAE,IAAI,SAAS,GAAG;AAAA,MACvC;AAAA,MACA;AAAA,MACA;AAAA,IACF;AACA,WAAO,IAAI,OAAO,EAAE,MAAM,YAAY;AAAA,EACxC,CAAC;AACH;",
6
6
  "names": []
7
7
  }
@@ -10,7 +10,7 @@ const INT_VALIDATOR = () => {
10
10
  name: "int-validator",
11
11
  message: "form.error.positive_integer_number",
12
12
  test: (value) => {
13
- if (value === null) {
13
+ if (value === void 0) {
14
14
  return true;
15
15
  }
16
16
  return validateIntNumber(value);
@@ -1,3 +1,3 @@
1
- import { ValidatorSchema } from '@digigov/form/validators/types';
1
+ import type { ValidatorSchema } from '@digigov/form/validators/types';
2
2
  export declare function validateIntNumber(number: number): boolean;
3
3
  export declare const INT_VALIDATOR: () => ValidatorSchema;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/validators/utils/int.ts"],
4
- "sourcesContent": ["import { ValidatorSchema } from '@digigov/form/validators/types';\n\nexport function validateIntNumber(number: number): boolean {\n if (number === undefined) {\n return false;\n } else {\n return Number.isInteger(number) && Number(number) > 0;\n }\n}\n\nexport const INT_VALIDATOR = (): ValidatorSchema => {\n return {\n name: 'int-validator',\n message: 'form.error.positive_integer_number',\n test: (value: number): boolean => {\n if (value === null) {\n return true;\n }\n return validateIntNumber(value);\n },\n };\n};\n"],
5
- "mappings": "AAEO,SAAS,kBAAkB,QAAyB;AACzD,MAAI,WAAW,QAAW;AACxB,WAAO;AAAA,EACT,OAAO;AACL,WAAO,OAAO,UAAU,MAAM,KAAK,OAAO,MAAM,IAAI;AAAA,EACtD;AACF;AAEO,MAAM,gBAAgB,MAAuB;AAClD,SAAO;AAAA,IACL,MAAM;AAAA,IACN,SAAS;AAAA,IACT,MAAM,CAAC,UAA2B;AAChC,UAAI,UAAU,MAAM;AAClB,eAAO;AAAA,MACT;AACA,aAAO,kBAAkB,KAAK;AAAA,IAChC;AAAA,EACF;AACF;",
4
+ "sourcesContent": ["import type { ValidatorSchema } from '@digigov/form/validators/types';\n\nexport function validateIntNumber(number: number): boolean {\n if (number === undefined) {\n return false;\n } else {\n return Number.isInteger(number) && Number(number) > 0;\n }\n}\n\nexport const INT_VALIDATOR = (): ValidatorSchema => {\n return {\n name: 'int-validator',\n message: 'form.error.positive_integer_number',\n test: (value: number): boolean => {\n if (value === undefined) {\n return true;\n }\n return validateIntNumber(value);\n },\n };\n};\n"],
5
+ "mappings": "AAEO,SAAS,kBAAkB,QAAyB;AACzD,MAAI,WAAW,QAAW;AACxB,WAAO;AAAA,EACT,OAAO;AACL,WAAO,OAAO,UAAU,MAAM,KAAK,OAAO,MAAM,IAAI;AAAA,EACtD;AACF;AAEO,MAAM,gBAAgB,MAAuB;AAClD,SAAO;AAAA,IACL,MAAM;AAAA,IACN,SAAS;AAAA,IACT,MAAM,CAAC,UAA2B;AAChC,UAAI,UAAU,QAAW;AACvB,eAAO;AAAA,MACT;AACA,aAAO,kBAAkB,KAAK;AAAA,IAChC;AAAA,EACF;AACF;",
6
6
  "names": []
7
7
  }
@@ -6,7 +6,7 @@ const NUMBER_VALIDATOR = () => {
6
6
  name: "number-validator",
7
7
  message: "form.error.number",
8
8
  test: (value) => {
9
- if (value === null) {
9
+ if (value === void 0) {
10
10
  return true;
11
11
  }
12
12
  return validateNumber(value);
@@ -1,3 +1,3 @@
1
- import { ValidatorSchema } from '@digigov/form/validators/types';
1
+ import type { ValidatorSchema } from '@digigov/form/validators/types';
2
2
  export declare function validateNumber(number: number): boolean;
3
3
  export declare const NUMBER_VALIDATOR: () => ValidatorSchema;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/validators/utils/number.ts"],
4
- "sourcesContent": ["import { ValidatorSchema } from '@digigov/form/validators/types';\n\nexport function validateNumber(number: number): boolean {\n return !Number.isNaN(number);\n}\n\nexport const NUMBER_VALIDATOR = (): ValidatorSchema => {\n return {\n name: 'number-validator',\n message: 'form.error.number',\n test: (value: number): boolean => {\n if (value === null) {\n return true;\n }\n return validateNumber(value);\n },\n };\n};\n"],
5
- "mappings": "AAEO,SAAS,eAAe,QAAyB;AACtD,SAAO,CAAC,OAAO,MAAM,MAAM;AAC7B;AAEO,MAAM,mBAAmB,MAAuB;AACrD,SAAO;AAAA,IACL,MAAM;AAAA,IACN,SAAS;AAAA,IACT,MAAM,CAAC,UAA2B;AAChC,UAAI,UAAU,MAAM;AAClB,eAAO;AAAA,MACT;AACA,aAAO,eAAe,KAAK;AAAA,IAC7B;AAAA,EACF;AACF;",
4
+ "sourcesContent": ["import type { ValidatorSchema } from '@digigov/form/validators/types';\n\nexport function validateNumber(number: number): boolean {\n return !Number.isNaN(number);\n}\n\nexport const NUMBER_VALIDATOR = (): ValidatorSchema => {\n return {\n name: 'number-validator',\n message: 'form.error.number',\n test: (value: number): boolean => {\n if (value === undefined) {\n return true;\n }\n return validateNumber(value);\n },\n };\n};\n"],
5
+ "mappings": "AAEO,SAAS,eAAe,QAAyB;AACtD,SAAO,CAAC,OAAO,MAAM,MAAM;AAC7B;AAEO,MAAM,mBAAmB,MAAuB;AACrD,SAAO;AAAA,IACL,MAAM;AAAA,IACN,SAAS;AAAA,IACT,MAAM,CAAC,UAA2B;AAChC,UAAI,UAAU,QAAW;AACvB,eAAO;AAAA,MACT;AACA,aAAO,eAAe,KAAK;AAAA,IAC7B;AAAA,EACF;AACF;",
6
6
  "names": []
7
7
  }
@@ -1,4 +1,4 @@
1
- import { FieldSpec } from '@digigov/form/types';
2
- import { ValidatorSchema } from '@digigov/form/validators/types';
1
+ import type { FieldSpec } from '@digigov/form/types';
2
+ import type { ValidatorSchema } from '@digigov/form/validators/types';
3
3
  export declare function validateOtp(value: string, maxLength: number): boolean;
4
4
  export declare const OTP_VALIDATOR: (field: FieldSpec) => ValidatorSchema;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/validators/utils/otp.ts"],
4
- "sourcesContent": ["import { FieldSpec } from '@digigov/form/types';\nimport { ValidatorSchema } from '@digigov/form/validators/types';\nexport function validateOtp(value: string, maxLength: number): boolean {\n if (value.length === maxLength) {\n return true;\n } else {\n return false;\n }\n}\n\nexport const OTP_VALIDATOR = (field: FieldSpec): ValidatorSchema => {\n const maxLength = field?.maxLength;\n return {\n name: 'otp-validator',\n message: {\n key: 'form.error.otp.less_than',\n context: {\n maxLength: field?.maxLength,\n },\n },\n test: (value: string): boolean => {\n if (!value) {\n return true;\n }\n return validateOtp(value, maxLength as number);\n },\n };\n};\n"],
4
+ "sourcesContent": ["import type { FieldSpec } from '@digigov/form/types';\nimport type { ValidatorSchema } from '@digigov/form/validators/types';\nexport function validateOtp(value: string, maxLength: number): boolean {\n if (value.length === maxLength) {\n return true;\n } else {\n return false;\n }\n}\n\nexport const OTP_VALIDATOR = (field: FieldSpec): ValidatorSchema => {\n const maxLength = field?.maxLength;\n return {\n name: 'otp-validator',\n message: {\n key: 'form.error.otp.less_than',\n context: {\n maxLength: field?.maxLength,\n },\n },\n test: (value: string): boolean => {\n if (!value) {\n return true;\n }\n return validateOtp(value, maxLength as number);\n },\n };\n};\n"],
5
5
  "mappings": "AAEO,SAAS,YAAY,OAAe,WAA4B;AACrE,MAAI,MAAM,WAAW,WAAW;AAC9B,WAAO;AAAA,EACT,OAAO;AACL,WAAO;AAAA,EACT;AACF;AAEO,MAAM,gBAAgB,CAAC,UAAsC;AAClE,QAAM,YAAY,OAAO;AACzB,SAAO;AAAA,IACL,MAAM;AAAA,IACN,SAAS;AAAA,MACP,KAAK;AAAA,MACL,SAAS;AAAA,QACP,WAAW,OAAO;AAAA,MACpB;AAAA,IACF;AAAA,IACA,MAAM,CAAC,UAA2B;AAChC,UAAI,CAAC,OAAO;AACV,eAAO;AAAA,MACT;AACA,aAAO,YAAY,OAAO,SAAmB;AAAA,IAC/C;AAAA,EACF;AACF;",
6
6
  "names": []
7
7
  }
@@ -1,8 +1,8 @@
1
- import { FieldSpec } from '@digigov/form/types';
2
- import { ValidatorSchema } from '@digigov/form/validators/types';
1
+ import type { FieldSpec } from '@digigov/form/types';
2
+ import type { ValidatorSchema } from '@digigov/form/validators/types';
3
3
  export type PhoneNumberType = 'landline' | 'mobile' | null;
4
4
  export declare function discoverPhoneType(phoneNumber: string, config: any): string;
5
- export declare function validatePhoneNumber(phoneNumber: string, countries?: Array<string>, typeOfPhoneNumber?: PhoneNumberType): boolean;
5
+ export declare function validatePhoneNumber(phoneNumber: string, countries?: string[], typeOfPhoneNumber?: PhoneNumberType): boolean;
6
6
  export declare const MOBILE_PHONE_VALIDATOR: {
7
7
  name: string;
8
8
  message: string;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/validators/utils/phone.ts"],
4
- "sourcesContent": ["import { FieldSpec } from '@digigov/form/types';\nimport { ValidatorSchema } from '@digigov/form/validators/types';\n\nexport type PhoneNumberType = 'landline' | 'mobile' | null;\n// add more countries from here libphonenumber-js/metadata.full.json\nconst countryPhoneData = {\n GR: [\n '30',\n '00',\n '5005000\\\\d{3}|8\\\\d{9,11}|(?:[269]\\\\d|70)\\\\d{8}',\n [10, 11, 12],\n [\n ['(\\\\d{2})(\\\\d{4})(\\\\d{4})', '$1 $2 $3', ['21|7']],\n [\n '(\\\\d{4})(\\\\d{6})',\n '$1 $2',\n ['2(?:2|3[2-57-9]|4[2-469]|5[2-59]|6[2-9]|7[2-69]|8[2-49])|5'],\n ],\n ['(\\\\d{3})(\\\\d{3})(\\\\d{4})', '$1 $2 $3', ['[2689]']],\n ['(\\\\d{3})(\\\\d{3,4})(\\\\d{5})', '$1 $2 $3', ['8']],\n ],\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n [\n [\n '2(?:1\\\\d\\\\d|2(?:2[1-46-9]|[36][1-8]|4[1-7]|5[1-4]|7[1-5]|[89][1-9])|3(?:1\\\\d|2[1-57]|[35][1-3]|4[13]|7[1-7]|8[124-6]|9[1-79])|4(?:1\\\\d|2[1-8]|3[1-4]|4[13-5]|6[1-578]|9[1-5])|5(?:1\\\\d|[29][1-4]|3[1-5]|4[124]|5[1-6])|6(?:1\\\\d|[269][1-6]|3[1245]|4[1-7]|5[13-9]|7[14]|8[1-5])|7(?:1\\\\d|2[1-5]|3[1-6]|4[1-7]|5[1-57]|6[135]|9[125-7])|8(?:1\\\\d|2[1-5]|[34][1-4]|9[1-57]))\\\\d{6}',\n [10],\n ],\n ['68[57-9]\\\\d{7}|(?:69|94)\\\\d{8}', [10]],\n ['800\\\\d{7,9}'],\n ['90[19]\\\\d{7}', [10]],\n ['70\\\\d{8}', [10]],\n 0,\n ['5005000\\\\d{3}', [10]],\n 0,\n 0,\n ['8(?:0[16]|12|[27]5|50)\\\\d{7}', [10]],\n ],\n ],\n};\n\nfunction expandPhoneNumberStructure(compressed) {\n const countries = Object.keys(compressed);\n const expanded: any = {};\n for (const country of countries) {\n expanded[country] = {\n fixedLine: {\n possibleLengths: {\n _national: compressed[country][3].map(String),\n },\n nationalNumberPattern: compressed[country][11][0][0],\n },\n mobile: {\n nationalNumberPattern: compressed[country][11][1][0],\n },\n tollFree: {\n nationalNumberPattern: compressed[country][11][2][0],\n },\n premiumRate: {\n nationalNumberPattern: compressed[country][11][3][0],\n },\n sharedCost: {\n nationalNumberPattern: compressed[country][11][9][0],\n },\n personalNumber: {\n nationalNumberPattern: compressed[country][11][4][0],\n },\n uan: {\n nationalNumberPattern: compressed[country][11][6][0],\n },\n id: country,\n countryCode: compressed[country][0],\n internationalPrefix: compressed[country][1],\n };\n }\n return expanded;\n}\nconst PHONENUMBER_SPEC = expandPhoneNumberStructure(countryPhoneData);\nexport function discoverPhoneType(phoneNumber: string, config: any): string {\n const cleanNumber = phoneNumber\n .replace(/\\D/g, '')\n .replace(/\\s/g, '')\n .replace(/^\\+/, '')\n .replace(new RegExp('^' + config.internationalPrefix, ''), '')\n .replace(new RegExp('^' + config.countryCode, ''), '');\n const categories = {\n landline: config.fixedLine,\n mobile: config.mobile,\n 'toll-free': config.tollFree,\n 'premium-rate': config.premiumRate,\n };\n\n for (const [categoryName, categoryDetails] of Object.entries(categories)) {\n const pattern = new RegExp(\n '^(' + categoryDetails.nationalNumberPattern.replace(/\\s/g, '') + ')$',\n ''\n );\n if (cleanNumber.match(pattern)) {\n return categoryName; // Returns the category name if the number matches the pattern\n }\n }\n\n // If no category matches, return 'Unknown'\n return 'unknown';\n}\nfunction getNumberType(phoneNumber: string, country: string) {\n const spec = PHONENUMBER_SPEC[country.toUpperCase()];\n if (!spec) {\n throw new Error(`Country ${country} is not supported`);\n }\n const type = discoverPhoneType(phoneNumber, spec);\n return type;\n}\n\nfunction isPhoneNumberValid(\n phoneNumber: string,\n countries: string[],\n types = ['mobile', 'landline']\n) {\n return countries.some((country) => {\n const numberType = getNumberType(phoneNumber, country);\n if (numberType && types.includes(numberType)) {\n return true;\n }\n return false;\n });\n}\nfunction isNumberOfType(phoneNumber: string, country: string, type: string) {\n const numberType = getNumberType(phoneNumber, country);\n if (numberType === type) {\n return true;\n }\n return false;\n}\nexport function validatePhoneNumber(\n phoneNumber: string,\n countries: Array<string> = ['gr'],\n typeOfPhoneNumber?: PhoneNumberType\n): boolean {\n if (!countries || countries.length === 0) {\n return true;\n }\n return isPhoneNumberValid(\n phoneNumber,\n countries,\n typeOfPhoneNumber ? [typeOfPhoneNumber] : undefined\n );\n}\n\nfunction validateMobile(value): boolean {\n return isNumberOfType(value, 'gr', 'mobile');\n}\n\nexport const MOBILE_PHONE_VALIDATOR = {\n name: 'mobile-phone-validator',\n message: 'form.error.mobile_phone',\n test: (value): boolean => {\n if (value) {\n return validateMobile(value);\n }\n return true;\n },\n};\n\nexport const PHONE_NUMBER_VALIDATOR = (field: FieldSpec): ValidatorSchema => {\n const countryCodes = field?.extra?.countries;\n const typeOfPhone: PhoneNumberType | null = field?.extra?.phoneType;\n return {\n name: 'phone-number-validator',\n message: (): string => {\n if (typeOfPhone === 'mobile') {\n return 'form.error.mobile_phone';\n }\n if (typeOfPhone === 'landline') {\n return 'form.error.landline';\n } else {\n return 'form.error.phone_number';\n }\n },\n test: (value: string): boolean => {\n if (!value) {\n return true;\n }\n return validatePhoneNumber(value, countryCodes, typeOfPhone);\n },\n };\n};\n"],
5
- "mappings": "AAKA,MAAM,mBAAmB;AAAA,EACvB,IAAI;AAAA,IACF;AAAA,IACA;AAAA,IACA;AAAA,IACA,CAAC,IAAI,IAAI,EAAE;AAAA,IACX;AAAA,MACE,CAAC,4BAA4B,YAAY,C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UAA2B;AAChC,UAAI,CAAC,OAAO;AACV,eAAO;AAAA,MACT;AACA,aAAO,oBAAoB,OAAO,cAAc,WAAW;AAAA,IAC7D;AAAA,EACF;AACF;",
4
+ "sourcesContent": ["import type { FieldSpec } from '@digigov/form/types';\nimport type { ValidatorSchema } from '@digigov/form/validators/types';\n\nexport type PhoneNumberType = 'landline' | 'mobile' | null;\n// add more countries from here libphonenumber-js/metadata.full.json\nconst countryPhoneData = {\n GR: [\n '30',\n '00',\n '5005000\\\\d{3}|8\\\\d{9,11}|(?:[269]\\\\d|70)\\\\d{8}',\n [10, 11, 12],\n [\n ['(\\\\d{2})(\\\\d{4})(\\\\d{4})', '$1 $2 $3', ['21|7']],\n [\n '(\\\\d{4})(\\\\d{6})',\n '$1 $2',\n ['2(?:2|3[2-57-9]|4[2-469]|5[2-59]|6[2-9]|7[2-69]|8[2-49])|5'],\n ],\n ['(\\\\d{3})(\\\\d{3})(\\\\d{4})', '$1 $2 $3', ['[2689]']],\n ['(\\\\d{3})(\\\\d{3,4})(\\\\d{5})', '$1 $2 $3', ['8']],\n ],\n 0,\n 0,\n 0,\n 0,\n 0,\n 0,\n [\n [\n '2(?:1\\\\d\\\\d|2(?:2[1-46-9]|[36][1-8]|4[1-7]|5[1-4]|7[1-5]|[89][1-9])|3(?:1\\\\d|2[1-57]|[35][1-3]|4[13]|7[1-7]|8[124-6]|9[1-79])|4(?:1\\\\d|2[1-8]|3[1-4]|4[13-5]|6[1-578]|9[1-5])|5(?:1\\\\d|[29][1-4]|3[1-5]|4[124]|5[1-6])|6(?:1\\\\d|[269][1-6]|3[1245]|4[1-7]|5[13-9]|7[14]|8[1-5])|7(?:1\\\\d|2[1-5]|3[1-6]|4[1-7]|5[1-57]|6[135]|9[125-7])|8(?:1\\\\d|2[1-5]|[34][1-4]|9[1-57]))\\\\d{6}',\n [10],\n ],\n ['68[57-9]\\\\d{7}|(?:69|94)\\\\d{8}', [10]],\n ['800\\\\d{7,9}'],\n ['90[19]\\\\d{7}', [10]],\n ['70\\\\d{8}', [10]],\n 0,\n ['5005000\\\\d{3}', [10]],\n 0,\n 0,\n ['8(?:0[16]|12|[27]5|50)\\\\d{7}', [10]],\n ],\n ],\n};\n\nfunction expandPhoneNumberStructure(compressed) {\n const countries = Object.keys(compressed);\n const expanded: any = {};\n for (const country of countries) {\n expanded[country] = {\n fixedLine: {\n possibleLengths: {\n _national: compressed[country][3].map(String),\n },\n nationalNumberPattern: compressed[country][11][0][0],\n },\n mobile: {\n nationalNumberPattern: compressed[country][11][1][0],\n },\n tollFree: {\n nationalNumberPattern: compressed[country][11][2][0],\n },\n premiumRate: {\n nationalNumberPattern: compressed[country][11][3][0],\n },\n sharedCost: {\n nationalNumberPattern: compressed[country][11][9][0],\n },\n personalNumber: {\n nationalNumberPattern: compressed[country][11][4][0],\n },\n uan: {\n nationalNumberPattern: compressed[country][11][6][0],\n },\n id: country,\n countryCode: compressed[country][0],\n internationalPrefix: compressed[country][1],\n };\n }\n return expanded;\n}\nconst PHONENUMBER_SPEC = expandPhoneNumberStructure(countryPhoneData);\nexport function discoverPhoneType(phoneNumber: string, config: any): string {\n const cleanNumber = phoneNumber\n .replace(/\\D/g, '')\n .replace(/\\s/g, '')\n .replace(/^\\+/, '')\n .replace(new RegExp('^' + config.internationalPrefix, ''), '')\n .replace(new RegExp('^' + config.countryCode, ''), '');\n const categories = {\n landline: config.fixedLine,\n mobile: config.mobile,\n 'toll-free': config.tollFree,\n 'premium-rate': config.premiumRate,\n };\n\n for (const [categoryName, categoryDetails] of Object.entries(categories)) {\n const pattern = new RegExp(\n '^(' + categoryDetails.nationalNumberPattern.replace(/\\s/g, '') + ')$',\n ''\n );\n if (cleanNumber.match(pattern)) {\n return categoryName; // Returns the category name if the number matches the pattern\n }\n }\n\n // If no category matches, return 'Unknown'\n return 'unknown';\n}\nfunction getNumberType(phoneNumber: string, country: string) {\n const spec = PHONENUMBER_SPEC[country.toUpperCase()];\n if (!spec) {\n throw new Error(`Country ${country} is not supported`);\n }\n const type = discoverPhoneType(phoneNumber, spec);\n return type;\n}\n\nfunction isPhoneNumberValid(\n phoneNumber: string,\n countries: string[],\n types = ['mobile', 'landline']\n) {\n return countries.some((country) => {\n const numberType = getNumberType(phoneNumber, country);\n if (numberType && types.includes(numberType)) {\n return true;\n }\n return false;\n });\n}\nfunction isNumberOfType(phoneNumber: string, country: string, type: string) {\n const numberType = getNumberType(phoneNumber, country);\n if (numberType === type) {\n return true;\n }\n return false;\n}\nexport function validatePhoneNumber(\n phoneNumber: string,\n countries: string[] = ['gr'],\n typeOfPhoneNumber?: PhoneNumberType\n): boolean {\n if (!countries || countries.length === 0) {\n return true;\n }\n return isPhoneNumberValid(\n phoneNumber,\n countries,\n typeOfPhoneNumber ? [typeOfPhoneNumber] : undefined\n );\n}\n\nfunction validateMobile(value): boolean {\n return isNumberOfType(value, 'gr', 'mobile');\n}\n\nexport const MOBILE_PHONE_VALIDATOR = {\n name: 'mobile-phone-validator',\n message: 'form.error.mobile_phone',\n test: (value): boolean => {\n if (value) {\n return validateMobile(value);\n }\n return true;\n },\n};\n\nexport const PHONE_NUMBER_VALIDATOR = (field: FieldSpec): ValidatorSchema => {\n const countryCodes = field?.extra?.countries;\n const typeOfPhone: PhoneNumberType | null = field?.extra?.phoneType;\n return {\n name: 'phone-number-validator',\n message: (): string => {\n if (typeOfPhone === 'mobile') {\n return 'form.error.mobile_phone';\n }\n if (typeOfPhone === 'landline') {\n return 'form.error.landline';\n } else {\n return 'form.error.phone_number';\n }\n },\n test: (value: string): boolean => {\n if (!value) {\n return true;\n }\n return validatePhoneNumber(value, countryCodes, typeOfPhone);\n },\n };\n};\n"],
5
+ "mappings": "AAKA,MAAM,mBAAmB;AAAA,EACvB,IAAI;AAAA,IACF;AAAA,IACA;AAAA,IACA;AAAA,IACA,CAAC,IAAI,IAAI,EAAE;AAAA,IACX;AAAA,MACE,CAAC,4BAA4B,YAAY,CAAC,MAAM,CAAC;AAAA,MACjD;AAAA,QACE;AAAA,QACA;A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T;AACA,aAAO,oBAAoB,OAAO,cAAc,WAAW;AAAA,IAC7D;AAAA,EACF;AACF;",
6
6
  "names": []
7
7
  }
@@ -1,4 +1,4 @@
1
- import { FieldSpec } from '@digigov/form/types';
2
- import { ValidatorSchema } from '@digigov/form/validators/types';
3
- export declare function validatePostalCode(number: string, countries: Array<string>): boolean;
1
+ import type { FieldSpec } from '@digigov/form/types';
2
+ import type { ValidatorSchema } from '@digigov/form/validators/types';
3
+ export declare function validatePostalCode(number: string, countries: string[]): boolean;
4
4
  export declare const POSTALCODE_VALIDATOR: (field: FieldSpec) => ValidatorSchema;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/validators/utils/postal_code.ts"],
4
- "sourcesContent": ["import { FieldSpec } from '@digigov/form/types';\nimport { ValidatorSchema } from '@digigov/form/validators/types';\n\nconst CODE_REGEX = /^[12345678][0-9]{4}$/;\nexport function validatePostalCode(\n number: string,\n countries: Array<string>\n): boolean {\n if (!countries) {\n return false;\n } else {\n if (countries.length === 1 && countries[0].toUpperCase() === 'GR') {\n // Greek postal code must be 5 digits long and shouldn't start with 0 or 9.\n return CODE_REGEX.test(number);\n } else {\n return true;\n }\n }\n}\n\nexport const POSTALCODE_VALIDATOR = (field: FieldSpec): ValidatorSchema => {\n const countryCode = field?.extra?.countries;\n return {\n name: 'postal-code-validator',\n message: 'form.error.postalCode',\n test: (value: string): boolean => {\n if (!value) {\n return true;\n }\n return validatePostalCode(value, countryCode);\n },\n };\n};\n"],
4
+ "sourcesContent": ["import type { FieldSpec } from '@digigov/form/types';\nimport type { ValidatorSchema } from '@digigov/form/validators/types';\n\nconst CODE_REGEX = /^[12345678][0-9]{4}$/;\nexport function validatePostalCode(\n number: string,\n countries: string[]\n): boolean {\n if (!countries) {\n return false;\n } else {\n if (countries.length === 1 && countries[0].toUpperCase() === 'GR') {\n // Greek postal code must be 5 digits long and shouldn't start with 0 or 9.\n return CODE_REGEX.test(number);\n } else {\n return true;\n }\n }\n}\n\nexport const POSTALCODE_VALIDATOR = (field: FieldSpec): ValidatorSchema => {\n const countryCode = field?.extra?.countries;\n return {\n name: 'postal-code-validator',\n message: 'form.error.postalCode',\n test: (value: string): boolean => {\n if (!value) {\n return true;\n }\n return validatePostalCode(value, countryCode);\n },\n };\n};\n"],
5
5
  "mappings": "AAGA,MAAM,aAAa;AACZ,SAAS,mBACd,QACA,WACS;AACT,MAAI,CAAC,WAAW;AACd,WAAO;AAAA,EACT,OAAO;AACL,QAAI,UAAU,WAAW,KAAK,UAAU,CAAC,EAAE,YAAY,MAAM,MAAM;AAEjE,aAAO,WAAW,KAAK,MAAM;AAAA,IAC/B,OAAO;AACL,aAAO;AAAA,IACT;AAAA,EACF;AACF;AAEO,MAAM,uBAAuB,CAAC,UAAsC;AACzE,QAAM,cAAc,OAAO,OAAO;AAClC,SAAO;AAAA,IACL,MAAM;AAAA,IACN,SAAS;AAAA,IACT,MAAM,CAAC,UAA2B;AAChC,UAAI,CAAC,OAAO;AACV,eAAO;AAAA,MACT;AACA,aAAO,mBAAmB,OAAO,WAAW;AAAA,IAC9C;AAAA,EACF;AACF;",
6
6
  "names": []
7
7
  }
@@ -1,4 +1,4 @@
1
- import { FieldSpec } from '@digigov/form/types';
2
- import { ValidatorSchema } from '@digigov/form/validators/types';
1
+ import type { FieldSpec } from '@digigov/form/types';
2
+ import type { ValidatorSchema } from '@digigov/form/validators/types';
3
3
  export declare function validateText(value: string, min: number, max: number): boolean;
4
4
  export declare const TEXT_LIMIT_VALIDATOR: (field: FieldSpec) => ValidatorSchema;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/validators/utils/text_limit.ts"],
4
- "sourcesContent": ["import { FieldSpec } from '@digigov/form/types';\nimport { ValidatorSchema } from '@digigov/form/validators/types';\n\nexport function validateText(value: string, min: number, max: number): boolean {\n let validator;\n if (min || max) {\n if (value.length < min || value.length > max) {\n return (validator = false);\n } else {\n return (validator = true);\n }\n }\n return validator;\n}\n\nexport const TEXT_LIMIT_VALIDATOR = (field: FieldSpec): ValidatorSchema => {\n const min: number = field?.extra?.limit?.min;\n const max: number = field?.extra?.limit?.max;\n return {\n name: 'text-limit-validator',\n message: (v: any): any => {\n if (min || max) {\n if (v.value.length < min) {\n return {\n key: 'form.error.text.less_than',\n context: { min: field?.extra?.limit?.min },\n };\n }\n if (v.value.length > max) {\n return {\n key: 'form.error.text.more_than',\n context: { max: field?.extra?.limit?.max },\n };\n }\n }\n },\n test: (value: string): boolean => {\n if (!value) {\n return true;\n }\n return validateText(value, min as number, max as number);\n },\n };\n};\n"],
4
+ "sourcesContent": ["import type { FieldSpec } from '@digigov/form/types';\nimport type { ValidatorSchema } from '@digigov/form/validators/types';\n\nexport function validateText(value: string, min: number, max: number): boolean {\n let validator;\n if (min || max) {\n if (value.length < min || value.length > max) {\n return (validator = false);\n } else {\n return (validator = true);\n }\n }\n return validator;\n}\n\nexport const TEXT_LIMIT_VALIDATOR = (field: FieldSpec): ValidatorSchema => {\n const min: number = field?.extra?.limit?.min;\n const max: number = field?.extra?.limit?.max;\n return {\n name: 'text-limit-validator',\n message: (v: any): any => {\n if (min || max) {\n if (v.value.length < min) {\n return {\n key: 'form.error.text.less_than',\n context: { min: field?.extra?.limit?.min },\n };\n }\n if (v.value.length > max) {\n return {\n key: 'form.error.text.more_than',\n context: { max: field?.extra?.limit?.max },\n };\n }\n }\n },\n test: (value: string): boolean => {\n if (!value) {\n return true;\n }\n return validateText(value, min as number, max as number);\n },\n };\n};\n"],
5
5
  "mappings": "AAGO,SAAS,aAAa,OAAe,KAAa,KAAsB;AAC7E,MAAI;AACJ,MAAI,OAAO,KAAK;AACd,QAAI,MAAM,SAAS,OAAO,MAAM,SAAS,KAAK;AAC5C,aAAQ,YAAY;AAAA,IACtB,OAAO;AACL,aAAQ,YAAY;AAAA,IACtB;AAAA,EACF;AACA,SAAO;AACT;AAEO,MAAM,uBAAuB,CAAC,UAAsC;AACzE,QAAM,MAAc,OAAO,OAAO,OAAO;AACzC,QAAM,MAAc,OAAO,OAAO,OAAO;AACzC,SAAO;AAAA,IACL,MAAM;AAAA,IACN,SAAS,CAAC,MAAgB;AACxB,UAAI,OAAO,KAAK;AACd,YAAI,EAAE,MAAM,SAAS,KAAK;AACxB,iBAAO;AAAA,YACL,KAAK;AAAA,YACL,SAAS,EAAE,KAAK,OAAO,OAAO,OAAO,IAAI;AAAA,UAC3C;AAAA,QACF;AACA,YAAI,EAAE,MAAM,SAAS,KAAK;AACxB,iBAAO;AAAA,YACL,KAAK;AAAA,YACL,SAAS,EAAE,KAAK,OAAO,OAAO,OAAO,IAAI;AAAA,UAC3C;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,IACA,MAAM,CAAC,UAA2B;AAChC,UAAI,CAAC,OAAO;AACV,eAAO;AAAA,MACT;AACA,aAAO,aAAa,OAAO,KAAe,GAAa;AAAA,IACzD;AAAA,EACF;AACF;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/validators/utils/uuid4.ts"],
4
- "sourcesContent": ["const UUID4_PATTERN = /^[0-9A-F]{8}-[0-9A-F]{4}-[4][0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i;\n\nexport function validateUUID4(uuid4: string): boolean {\n if (uuid4.length !== 36) {\n // This uuid4 should be 36 characters long\n return false;\n }\n\n return UUID4_PATTERN.test(uuid4);\n}\n\nexport const UUID4_VALIDATOR = {\n name: 'uuid4-validator',\n message: 'form.error.uuid4',\n test: (value): boolean => {\n if (value) {\n return validateUUID4(value);\n }\n return true;\n },\n};\n"],
5
- "mappings": "AAAA,MAAM,gBAAgB;AAEf,SAAS,cAAc,OAAwB;AACpD,MAAI,MAAM,WAAW,IAAI;AAEvB,WAAO;AAAA,EACT;AAEA,SAAO,cAAc,KAAK,KAAK;AACjC;AAEO,MAAM,kBAAkB;AAAA,EAC7B,MAAM;AAAA,EACN,SAAS;AAAA,EACT,MAAM,CAAC,UAAmB;AACxB,QAAI,OAAO;AACT,aAAO,cAAc,KAAK;AAAA,IAC5B;AACA,WAAO;AAAA,EACT;AACF;",
4
+ "sourcesContent": ["const UUID4_PATTERN =\n /^[0-9A-F]{8}-[0-9A-F]{4}-[4][0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i;\n\nexport function validateUUID4(uuid4: string): boolean {\n if (uuid4.length !== 36) {\n // This uuid4 should be 36 characters long\n return false;\n }\n\n return UUID4_PATTERN.test(uuid4);\n}\n\nexport const UUID4_VALIDATOR = {\n name: 'uuid4-validator',\n message: 'form.error.uuid4',\n test: (value): boolean => {\n if (value) {\n return validateUUID4(value);\n }\n return true;\n },\n};\n"],
5
+ "mappings": "AAAA,MAAM,gBACJ;AAEK,SAAS,cAAc,OAAwB;AACpD,MAAI,MAAM,WAAW,IAAI;AAEvB,WAAO;AAAA,EACT;AAEA,SAAO,cAAc,KAAK,KAAK;AACjC;AAEO,MAAM,kBAAkB;AAAA,EAC7B,MAAM;AAAA,EACN,SAAS;AAAA,EACT,MAAM,CAAC,UAAmB;AACxB,QAAI,OAAO;AACT,aAAO,cAAc,KAAK;AAAA,IAC5B;AACA,WAAO;AAAA,EACT;AACF;",
6
6
  "names": []
7
7
  }
@@ -1,27 +0,0 @@
1
- function calculateField(children, field, fieldComponentRegistry, alternativeComponents) {
2
- const calculatedField = { ...field };
3
- if (children) {
4
- calculatedField.component = children;
5
- calculatedField.controlled = true;
6
- } else if (typeof field.component === "function") {
7
- } else if (!field.component && !field.type) {
8
- calculatedField.component = fieldComponentRegistry.string.component;
9
- calculatedField.controlled = fieldComponentRegistry.string?.controlled || false;
10
- } else if (typeof field?.extra?.component === "string" && alternativeComponents[field.extra.component]) {
11
- calculatedField.controlled = alternativeComponents[field.extra.component]?.controlled || false;
12
- calculatedField.component = alternativeComponents[field.extra.component].component;
13
- calculatedField.wrapper = alternativeComponents[field.extra.component].wrapper;
14
- } else if (!field.component && field.type && fieldComponentRegistry[field.type]) {
15
- calculatedField.component = fieldComponentRegistry[field.type].component;
16
- calculatedField.wrapper = fieldComponentRegistry[field.type].wrapper;
17
- calculatedField.controlled = fieldComponentRegistry[field.type]?.controlled || false;
18
- } else {
19
- calculatedField.component = fieldComponentRegistry.string.component;
20
- calculatedField.controlled = fieldComponentRegistry.string?.controlled || false;
21
- }
22
- return calculatedField;
23
- }
24
- export {
25
- calculateField
26
- };
27
- //# sourceMappingURL=calculateField.js.map
@@ -1,6 +0,0 @@
1
- {
2
- "sideEffects": false,
3
- "module": "./index.js",
4
- "types": "./index.d.ts",
5
- "main": "../../../cjs/Field/utils/calculateField/index.js"
6
- }
@@ -1,2 +0,0 @@
1
- import { FieldProps, FieldSpec, FieldComponentRegistry, CalculatedField } from '@digigov/form/Field/types';
2
- export declare function calculateField(children: FieldProps['children'], field: FieldSpec, fieldComponentRegistry: FieldComponentRegistry, alternativeComponents: FieldComponentRegistry): CalculatedField;
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/Field/utils/calculateField.ts"],
4
- "sourcesContent": ["import {\n FieldProps,\n FieldSpec,\n FieldComponentRegistry,\n CalculatedField,\n} from '@digigov/form/Field/types';\n\nexport function calculateField(\n children: FieldProps['children'],\n field: FieldSpec,\n fieldComponentRegistry: FieldComponentRegistry,\n alternativeComponents: FieldComponentRegistry\n): CalculatedField {\n const calculatedField = { ...field };\n if (children) {\n calculatedField.component = children;\n calculatedField.controlled = true;\n } else if (typeof field.component === 'function') {\n // leave as is\n } else if (!field.component && !field.type) {\n calculatedField.component = fieldComponentRegistry.string.component;\n calculatedField.controlled =\n fieldComponentRegistry.string?.controlled || false;\n } else if (\n typeof field?.extra?.component === 'string' &&\n alternativeComponents[field.extra.component]\n ) {\n calculatedField.controlled =\n alternativeComponents[field.extra.component]?.controlled || false;\n calculatedField.component =\n alternativeComponents[field.extra.component].component;\n calculatedField.wrapper =\n alternativeComponents[field.extra.component].wrapper;\n } else if (\n !field.component &&\n field.type &&\n fieldComponentRegistry[field.type]\n ) {\n calculatedField.component = fieldComponentRegistry[field.type].component;\n calculatedField.wrapper = fieldComponentRegistry[field.type].wrapper;\n calculatedField.controlled =\n fieldComponentRegistry[field.type]?.controlled || false;\n } else {\n calculatedField.component = fieldComponentRegistry.string.component;\n calculatedField.controlled =\n fieldComponentRegistry.string?.controlled || false;\n }\n return calculatedField as CalculatedField;\n}\n"],
5
- "mappings": "AAOO,SAAS,eACd,UACA,OACA,wBACA,uBACiB;AACjB,QAAM,kBAAkB,EAAE,GAAG,MAAM;AACnC,MAAI,UAAU;AACZ,oBAAgB,YAAY;AAC5B,oBAAgB,aAAa;AAAA,EAC/B,WAAW,OAAO,MAAM,cAAc,YAAY;AAAA,EAElD,WAAW,CAAC,MAAM,aAAa,CAAC,MAAM,MAAM;AAC1C,oBAAgB,YAAY,uBAAuB,OAAO;AAC1D,oBAAgB,aACd,uBAAuB,QAAQ,cAAc;AAAA,EACjD,WACE,OAAO,OAAO,OAAO,cAAc,YACnC,sBAAsB,MAAM,MAAM,SAAS,GAC3C;AACA,oBAAgB,aACd,sBAAsB,MAAM,MAAM,SAAS,GAAG,cAAc;AAC9D,oBAAgB,YACd,sBAAsB,MAAM,MAAM,SAAS,EAAE;AAC/C,oBAAgB,UACd,sBAAsB,MAAM,MAAM,SAAS,EAAE;AAAA,EACjD,WACE,CAAC,MAAM,aACP,MAAM,QACN,uBAAuB,MAAM,IAAI,GACjC;AACA,oBAAgB,YAAY,uBAAuB,MAAM,IAAI,EAAE;AAC/D,oBAAgB,UAAU,uBAAuB,MAAM,IAAI,EAAE;AAC7D,oBAAgB,aACd,uBAAuB,MAAM,IAAI,GAAG,cAAc;AAAA,EACtD,OAAO;AACL,oBAAgB,YAAY,uBAAuB,OAAO;AAC1D,oBAAgB,aACd,uBAAuB,QAAQ,cAAc;AAAA,EACjD;AACA,SAAO;AACT;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/Field/utils/index.ts"],
4
- "sourcesContent": ["import { FieldComponentRegistry } from '@digigov/form/Field/types';\nimport AutoCompleteInput from '@digigov/form/inputs/AutoCompleteInput';\nimport Checkboxes from '@digigov/form/inputs/Checkboxes';\nimport DateInput from '@digigov/form/inputs/DateInput';\nimport FileInput from '@digigov/form/inputs/FileInput';\nimport ImageInput from '@digigov/form/inputs/ImageInput';\nimport Input from '@digigov/form/inputs/Input';\nimport OtpInput from '@digigov/form/inputs/OtpInput';\nimport Radio, { ControlledRadioButtonsGroup } from '@digigov/form/inputs/Radio';\nimport Select from '@digigov/form/inputs/Select';\n\nexport const FIELD_COMPONENTS: FieldComponentRegistry = {\n text: {\n component: Input,\n },\n string: {\n component: Input,\n },\n file: {\n wrapper: 'fieldset',\n component: FileInput,\n },\n image: {\n wrapper: 'fieldset',\n component: ImageInput,\n },\n date: {\n wrapper: 'fieldset',\n controlled: true,\n component: DateInput,\n },\n otp: {\n wrapper: 'fieldset',\n controlled: true,\n component: OtpInput,\n },\n 'choice:multiple': {\n wrapper: 'fieldset',\n controlled: true,\n component: Checkboxes,\n },\n 'choice:single': {\n wrapper: 'fieldset',\n controlled: false,\n component: Radio,\n },\n};\n\nexport const ALTERNATIVE_COMPONENTS: FieldComponentRegistry = {\n Select: {\n component: Select,\n controlled: false,\n },\n AutoComplete: {\n component: AutoCompleteInput,\n controlled: true,\n wrapper: 'fieldset',\n },\n};\n\nexport const CONTROLLED_FIELD_COMPONENTS: FieldComponentRegistry = {\n ...FIELD_COMPONENTS,\n 'choice:single': {\n wrapper: 'fieldset',\n controlled: true,\n component: ControlledRadioButtonsGroup,\n },\n text: {\n component: Input,\n controlled: true,\n },\n string: {\n component: Input,\n controlled: true,\n },\n};\n"],
5
- "mappings": "AACA,OAAO,uBAAuB;AAC9B,OAAO,gBAAgB;AACvB,OAAO,eAAe;AACtB,OAAO,eAAe;AACtB,OAAO,gBAAgB;AACvB,OAAO,WAAW;AAClB,OAAO,cAAc;AACrB,OAAO,SAAS,mCAAmC;AACnD,OAAO,YAAY;AAEZ,MAAM,mBAA2C;AAAA,EACtD,MAAM;AAAA,IACJ,WAAW;AAAA,EACb;AAAA,EACA,QAAQ;AAAA,IACN,WAAW;AAAA,EACb;AAAA,EACA,MAAM;AAAA,IACJ,SAAS;AAAA,IACT,WAAW;AAAA,EACb;AAAA,EACA,OAAO;AAAA,IACL,SAAS;AAAA,IACT,WAAW;AAAA,EACb;AAAA,EACA,MAAM;AAAA,IACJ,SAAS;AAAA,IACT,YAAY;AAAA,IACZ,WAAW;AAAA,EACb;AAAA,EACA,KAAK;AAAA,IACH,SAAS;AAAA,IACT,YAAY;AAAA,IACZ,WAAW;AAAA,EACb;AAAA,EACA,mBAAmB;AAAA,IACjB,SAAS;AAAA,IACT,YAAY;AAAA,IACZ,WAAW;AAAA,EACb;AAAA,EACA,iBAAiB;AAAA,IACf,SAAS;AAAA,IACT,YAAY;AAAA,IACZ,WAAW;AAAA,EACb;AACF;AAEO,MAAM,yBAAiD;AAAA,EAC5D,QAAQ;AAAA,IACN,WAAW;AAAA,IACX,YAAY;AAAA,EACd;AAAA,EACA,cAAc;AAAA,IACZ,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,SAAS;AAAA,EACX;AACF;AAEO,MAAM,8BAAsD;AAAA,EACjE,GAAG;AAAA,EACH,iBAAiB;AAAA,IACf,SAAS;AAAA,IACT,YAAY;AAAA,IACZ,WAAW;AAAA,EACb;AAAA,EACA,MAAM;AAAA,IACJ,WAAW;AAAA,IACX,YAAY;AAAA,EACd;AAAA,EACA,QAAQ;AAAA,IACN,WAAW;AAAA,IACX,YAAY;AAAA,EACd;AACF;",
6
- "names": []
7
- }
@@ -1,14 +0,0 @@
1
- import FieldArray from "@digigov/form/FieldArray";
2
- var FieldArray_stories_default = {
3
- title: "Digigov Form/FieldArray",
4
- component: FieldArray,
5
- displayName: "FieldArray"
6
- };
7
- import { Default } from "@digigov/form/FieldArray/__stories__/Default";
8
- import { WithExactLength } from "@digigov/form/FieldArray/__stories__/WithExactLength";
9
- export {
10
- Default,
11
- WithExactLength,
12
- FieldArray_stories_default as default
13
- };
14
- //# sourceMappingURL=FieldArray.stories.js.map
@@ -1,6 +0,0 @@
1
- {
2
- "sideEffects": false,
3
- "module": "./index.js",
4
- "types": "./index.d.ts",
5
- "main": "../../cjs/FieldArray/FieldArray.stories/index.js"
6
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/FieldArray/FieldArray.stories.js"],
4
- "sourcesContent": ["import FieldArray from '@digigov/form/FieldArray';\nexport default {\n title: 'Digigov Form/FieldArray',\n component: FieldArray,\n displayName: 'FieldArray',\n};\nexport { Default } from '@digigov/form/FieldArray/__stories__/Default';\nexport { WithExactLength } from '@digigov/form/FieldArray/__stories__/WithExactLength';\n"],
5
- "mappings": "AAAA,OAAO,gBAAgB;AACvB,IAAO,6BAAQ;AAAA,EACb,OAAO;AAAA,EACP,WAAW;AAAA,EACX,aAAa;AACf;AACA,SAAS,eAAe;AACxB,SAAS,uBAAuB;",
6
- "names": []
7
- }
@@ -1,95 +0,0 @@
1
- import React from "react";
2
- import FormBuilder, { Field } from "@digigov/form";
3
- import { Button } from "@digigov/ui/form/Button";
4
- const fields = [
5
- {
6
- key: "string",
7
- type: "string",
8
- label: {
9
- primary: "\u03A0\u03B5\u03B4\u03AF\u03BF \u03BA\u03B5\u03B9\u03BC\u03AD\u03BD\u03BF\u03C5",
10
- secondary: "\u03A4\u03BF multiplicity field \u03B5\u03AF\u03BD\u03B1\u03B9 \u03AD\u03BD\u03B1 \u03C0\u03B5\u03B4\u03AF\u03BF \u03BF\u03C0\u03CC\u03C4\u03B5 \u03C6\u03B1\u03AF\u03BD\u03B5\u03C4\u03B1\u03B9 \u03BA\u03B1\u03B9 \u03B5\u03AF\u03BD\u03B1\u03B9 \u03BC\u03AD\u03C1\u03BF\u03C2 \u03C4\u03B7\u03C2 \u03C6\u03CC\u03C1\u03BC\u03B1\u03C2"
11
- }
12
- },
13
- {
14
- key: "multiplicity",
15
- type: "array",
16
- label: {
17
- primary: "\u03A3\u03C5\u03BD\u03C5\u03C0\u03BF\u03B3\u03C1\u03AC\u03C6\u03BF\u03BD\u03C4\u03B5\u03C2",
18
- secondary: "\u039F\u03B9 \u03C3\u03C5\u03BD\u03C5\u03C0\u03BF\u03B3\u03C1\u03AC\u03C6\u03BF\u03BD\u03C4\u03B5\u03C2 \u03B5\u03AF\u03BD\u03B1\u03B9 \u03AC\u03BD\u03B8\u03C1\u03C9\u03C0\u03BF\u03B9 \u03C3\u03B1\u03BD \u03BA\u03B1\u03B9 \u03B5\u03BC\u03AC\u03C2"
19
- },
20
- extra: {
21
- label: {
22
- object: {
23
- title: "\u03A3\u03C5\u03BD\u03C5\u03C0\u03BF\u03B3\u03C1\u03AC\u03C6\u03BF\u03BD\u03C4\u03B1\u03C2",
24
- add: "\u03A0\u03C1\u03BF\u03C3\u03B8\u03AE\u03BA\u03B7 \u03C3\u03C5\u03BD\u03C5\u03C0\u03BF\u03B3\u03C1\u03AC\u03C6\u03BF\u03BD\u03C4\u03B1",
25
- delete: "\u0391\u03C6\u03B1\u03AF\u03C1\u03B5\u03C3\u03B7 \u03C3\u03C5\u03BD\u03C5\u03C0\u03BF\u03B3\u03C1\u03AC\u03C6\u03BF\u03BD\u03C4\u03BF\u03C2"
26
- },
27
- question: {
28
- title: "\u0398\u03AD\u03BB\u03B5\u03C4\u03B5 \u03BD\u03B1 \u03C0\u03C1\u03BF\u03C3\u03B8\u03AD\u03C3\u03B5\u03C4\u03B5 \u03B5\u03C0\u03B9\u03C0\u03BB\u03AD\u03BF\u03BD \u03C3\u03C5\u03BD\u03C5\u03C0\u03BF\u03B3\u03C1\u03AC\u03C6\u03BF\u03BD\u03C4\u03B5\u03C2;",
29
- objectLabel: {
30
- primary: "\u03A0\u03C1\u03BF\u03C3\u03B8\u03AE\u03BA\u03B7 \u03BD\u03AD\u03BF\u03C5 \u03C3\u03C5\u03BD\u03C5\u03C0\u03BF\u03B3\u03C1\u03AC\u03C6\u03BF\u03BD\u03C4\u03B1",
31
- secondary: "\u03A3\u03C5\u03BC\u03C0\u03BB\u03B7\u03C1\u03CE\u03C3\u03C4\u03B5 \u03C4\u03B1 \u03C3\u03C4\u03BF\u03B9\u03C7\u03B5\u03AF\u03B1 \u03BA\u03B1\u03B9 \u03BC\u03B5\u03C4\u03AC \u03C0\u03B1\u03C4\u03AE\u03C3\u03C4\u03B5 \xAB\u03A0\u03C1\u03BF\u03C3\u03B8\u03AE\u03BA\u03B7\xBB"
32
- },
33
- yes: "\u039D\u03B1\u03B9",
34
- no: "\u038C\u03C7\u03B9"
35
- }
36
- },
37
- min: 2,
38
- max: 4,
39
- of: {
40
- type: "object",
41
- extra: {
42
- fields: [
43
- {
44
- key: "afm",
45
- type: "afm",
46
- required: true,
47
- label: { primary: "\u0391\u03A6\u039C" }
48
- },
49
- {
50
- key: "firstName",
51
- required: true,
52
- type: "string",
53
- label: {
54
- primary: "\u038C\u03BD\u03BF\u03BC\u03B1"
55
- }
56
- },
57
- {
58
- key: "lastName",
59
- required: true,
60
- type: "string",
61
- label: {
62
- primary: "\u0395\u03C0\u03CE\u03BD\u03C5\u03BC\u03BF"
63
- }
64
- }
65
- ]
66
- }
67
- }
68
- }
69
- },
70
- {
71
- key: "phonenumber",
72
- type: "phone_number",
73
- required: true,
74
- label: {
75
- primary: "\u03A3\u03C4\u03B1\u03B8\u03B5\u03C1\u03CC \u03C4\u03B7\u03BB\u03AD\u03C6\u03C9\u03BD\u03BF",
76
- secondary: "\u03A3\u03C5\u03BC\u03C0\u03BB\u03B7\u03C1\u03CE\u03C3\u03C4\u03B5 \u03C4\u03BF\u03BD \u03B1\u03C1\u03B9\u03B8\u03BC\u03CC \u03C4\u03B7\u03BB\u03B5\u03C6\u03CE\u03BD\u03BF\u03C5"
77
- }
78
- }
79
- ];
80
- const Default = () => /* @__PURE__ */ React.createElement(
81
- FormBuilder,
82
- {
83
- onSubmit: (data) => {
84
- console.log(data);
85
- }
86
- },
87
- /* @__PURE__ */ React.createElement(Field, { name: "string", ...fields[0] }),
88
- /* @__PURE__ */ React.createElement(Field, { name: "multiplicity", ...fields[1] }),
89
- /* @__PURE__ */ React.createElement(Field, { name: "phonenumber", ...fields[2] }),
90
- /* @__PURE__ */ React.createElement(Button, null, "\u03A3\u03C5\u03BD\u03AD\u03C7\u03B5\u03B9\u03B1")
91
- );
92
- export {
93
- Default
94
- };
95
- //# sourceMappingURL=Default.js.map
@@ -1,6 +0,0 @@
1
- {
2
- "sideEffects": false,
3
- "module": "./index.js",
4
- "types": "./index.d.ts",
5
- "main": "../../../cjs/FieldArray/__stories__/Default/index.js"
6
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/FieldArray/__stories__/Default.tsx"],
4
- "sourcesContent": ["import React from 'react';\nimport FormBuilder, { Field, FieldSpec } from '@digigov/form';\nimport { Button } from '@digigov/ui/form/Button';\n\nconst fields = [\n {\n key: 'string',\n type: 'string',\n label: {\n primary: '\u03A0\u03B5\u03B4\u03AF\u03BF \u03BA\u03B5\u03B9\u03BC\u03AD\u03BD\u03BF\u03C5',\n secondary:\n '\u03A4\u03BF multiplicity field \u03B5\u03AF\u03BD\u03B1\u03B9 \u03AD\u03BD\u03B1 \u03C0\u03B5\u03B4\u03AF\u03BF \u03BF\u03C0\u03CC\u03C4\u03B5 \u03C6\u03B1\u03AF\u03BD\u03B5\u03C4\u03B1\u03B9 \u03BA\u03B1\u03B9 \u03B5\u03AF\u03BD\u03B1\u03B9 \u03BC\u03AD\u03C1\u03BF\u03C2 \u03C4\u03B7\u03C2 \u03C6\u03CC\u03C1\u03BC\u03B1\u03C2',\n },\n },\n {\n key: 'multiplicity',\n type: 'array',\n label: {\n primary: '\u03A3\u03C5\u03BD\u03C5\u03C0\u03BF\u03B3\u03C1\u03AC\u03C6\u03BF\u03BD\u03C4\u03B5\u03C2',\n secondary: '\u039F\u03B9 \u03C3\u03C5\u03BD\u03C5\u03C0\u03BF\u03B3\u03C1\u03AC\u03C6\u03BF\u03BD\u03C4\u03B5\u03C2 \u03B5\u03AF\u03BD\u03B1\u03B9 \u03AC\u03BD\u03B8\u03C1\u03C9\u03C0\u03BF\u03B9 \u03C3\u03B1\u03BD \u03BA\u03B1\u03B9 \u03B5\u03BC\u03AC\u03C2',\n },\n extra: {\n label: {\n object: {\n title: '\u03A3\u03C5\u03BD\u03C5\u03C0\u03BF\u03B3\u03C1\u03AC\u03C6\u03BF\u03BD\u03C4\u03B1\u03C2',\n add: '\u03A0\u03C1\u03BF\u03C3\u03B8\u03AE\u03BA\u03B7 \u03C3\u03C5\u03BD\u03C5\u03C0\u03BF\u03B3\u03C1\u03AC\u03C6\u03BF\u03BD\u03C4\u03B1',\n delete: '\u0391\u03C6\u03B1\u03AF\u03C1\u03B5\u03C3\u03B7 \u03C3\u03C5\u03BD\u03C5\u03C0\u03BF\u03B3\u03C1\u03AC\u03C6\u03BF\u03BD\u03C4\u03BF\u03C2',\n },\n question: {\n title: '\u0398\u03AD\u03BB\u03B5\u03C4\u03B5 \u03BD\u03B1 \u03C0\u03C1\u03BF\u03C3\u03B8\u03AD\u03C3\u03B5\u03C4\u03B5 \u03B5\u03C0\u03B9\u03C0\u03BB\u03AD\u03BF\u03BD \u03C3\u03C5\u03BD\u03C5\u03C0\u03BF\u03B3\u03C1\u03AC\u03C6\u03BF\u03BD\u03C4\u03B5\u03C2;',\n objectLabel: {\n primary: '\u03A0\u03C1\u03BF\u03C3\u03B8\u03AE\u03BA\u03B7 \u03BD\u03AD\u03BF\u03C5 \u03C3\u03C5\u03BD\u03C5\u03C0\u03BF\u03B3\u03C1\u03AC\u03C6\u03BF\u03BD\u03C4\u03B1',\n secondary: '\u03A3\u03C5\u03BC\u03C0\u03BB\u03B7\u03C1\u03CE\u03C3\u03C4\u03B5 \u03C4\u03B1 \u03C3\u03C4\u03BF\u03B9\u03C7\u03B5\u03AF\u03B1 \u03BA\u03B1\u03B9 \u03BC\u03B5\u03C4\u03AC \u03C0\u03B1\u03C4\u03AE\u03C3\u03C4\u03B5 \u00AB\u03A0\u03C1\u03BF\u03C3\u03B8\u03AE\u03BA\u03B7\u00BB',\n },\n yes: '\u039D\u03B1\u03B9',\n no: '\u038C\u03C7\u03B9',\n },\n },\n min: 2,\n max: 4,\n of: {\n type: 'object',\n extra: {\n fields: [\n {\n key: 'afm',\n type: 'afm',\n required: true,\n label: { primary: '\u0391\u03A6\u039C' },\n },\n {\n key: 'firstName',\n required: true,\n type: 'string',\n label: {\n primary: '\u038C\u03BD\u03BF\u03BC\u03B1',\n },\n },\n {\n key: 'lastName',\n required: true,\n type: 'string',\n label: {\n primary: '\u0395\u03C0\u03CE\u03BD\u03C5\u03BC\u03BF',\n },\n },\n ],\n },\n },\n },\n },\n {\n key: 'phonenumber',\n type: 'phone_number',\n required: true,\n label: {\n primary: '\u03A3\u03C4\u03B1\u03B8\u03B5\u03C1\u03CC \u03C4\u03B7\u03BB\u03AD\u03C6\u03C9\u03BD\u03BF',\n secondary: '\u03A3\u03C5\u03BC\u03C0\u03BB\u03B7\u03C1\u03CE\u03C3\u03C4\u03B5 \u03C4\u03BF\u03BD \u03B1\u03C1\u03B9\u03B8\u03BC\u03CC \u03C4\u03B7\u03BB\u03B5\u03C6\u03CE\u03BD\u03BF\u03C5',\n },\n },\n] as FieldSpec[];\n\nexport const Default = () => (\n <FormBuilder\n onSubmit={(data) => {\n console.log(data);\n }}\n >\n <Field name=\"string\" {...fields[0]} />\n <Field name=\"multiplicity\" {...fields[1]} />\n <Field name=\"phonenumber\" {...fields[2]} />\n <Button>\u03A3\u03C5\u03BD\u03AD\u03C7\u03B5\u03B9\u03B1</Button>\n </FormBuilder>\n);\n"],
5
- "mappings": "AAAA,OAAO,WAAW;AAClB,OAAO,eAAe,aAAwB;AAC9C,SAAS,cAAc;AAEvB,MAAM,SAAS;AAAA,EACb;AAAA,IACE,KAAK;AAAA,IACL,MAAM;AAAA,IACN,OAAO;A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