@digigov/form 2.0.0-2a26e869 → 2.0.0-32ae417f

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 (372) hide show
  1. package/Field/FieldBase/index.js +7 -3
  2. package/Field/FieldBase.js.map +2 -2
  3. package/Field/FieldBaseContainer/index.js +37 -18
  4. package/Field/FieldBaseContainer.d.ts +1 -1
  5. package/Field/FieldBaseContainer.js.map +2 -2
  6. package/Field/FieldConditional/index.js +4 -0
  7. package/Field/FieldConditional.js.map +2 -2
  8. package/Field/index.js +15 -4
  9. package/Field/index.js.map +2 -2
  10. package/Field/types.d.ts +13 -3
  11. package/Field/utils/index.js +9 -1
  12. package/Field/utils/index.js.map +2 -2
  13. package/Field/utils/useField/index.js +14 -1
  14. package/Field/utils/useField.js.map +2 -2
  15. package/FieldArray/FieldArray.stories.d.ts +1 -0
  16. package/FieldArray/FormDialog/index.js +397 -0
  17. package/{inputs/Input/inputsInputScenarios → FieldArray/FormDialog}/package.json +1 -1
  18. package/FieldArray/FormDialog.d.ts +66 -0
  19. package/FieldArray/FormDialog.js.map +7 -0
  20. package/FieldArray/__stories__/Default.d.ts +1 -1
  21. package/FieldArray/__stories__/WithExactLength.d.ts +1 -1
  22. package/FieldArray/__stories__/WithModal.d.ts +2 -0
  23. package/FieldArray/index.d.ts +6 -0
  24. package/FieldArray/index.js +82 -24
  25. package/FieldArray/index.js.map +2 -2
  26. package/FieldObject/index.d.ts +5 -0
  27. package/FieldObject/index.js +30 -15
  28. package/FieldObject/index.js.map +2 -2
  29. package/FormBuilder/FormBuilder.stories.d.ts +2 -0
  30. package/FormBuilder/__stories__/AutoErrorGrouping.d.ts +1 -1
  31. package/FormBuilder/__stories__/Default.d.ts +1 -1
  32. package/FormBuilder/__stories__/ErrorGrouping.d.ts +1 -1
  33. package/FormBuilder/index.d.ts +1 -1
  34. package/FormBuilder/index.js +11 -7
  35. package/FormBuilder/index.js.map +2 -2
  36. package/FormContext/index.js +6 -2
  37. package/FormContext.d.ts +1 -0
  38. package/FormContext.js.map +2 -2
  39. package/MultiplicityField/MultiplicityField.stories.d.ts +2 -0
  40. package/MultiplicityField/__stories__/Default.d.ts +1 -1
  41. package/MultiplicityField/__stories__/PreviewDisplay.d.ts +1 -1
  42. package/MultiplicityField/__stories__/WithExactLength.d.ts +1 -1
  43. package/MultiplicityField/__stories__/WithMaxLength.d.ts +1 -1
  44. package/MultiplicityField/__stories__/WithMinAndMaxLength.d.ts +1 -1
  45. package/MultiplicityField/__stories__/WithMinLength.d.ts +1 -1
  46. package/MultiplicityField/add-objects/index.js +2 -0
  47. package/MultiplicityField/add-objects.js.map +2 -2
  48. package/MultiplicityField/index.js +4 -1
  49. package/MultiplicityField/index.js.map +2 -2
  50. package/MultiplicityField/types.d.ts +1 -0
  51. package/Questions/Questions.stories.d.ts +2 -0
  52. package/Questions/__stories__/Default.d.ts +1 -1
  53. package/cjs/Field/FieldBase/index.js +7 -3
  54. package/cjs/Field/FieldBase.js.map +2 -2
  55. package/cjs/Field/FieldBaseContainer/index.js +36 -17
  56. package/cjs/Field/FieldBaseContainer.js.map +3 -3
  57. package/cjs/Field/FieldConditional/index.js +4 -0
  58. package/cjs/Field/FieldConditional.js.map +2 -2
  59. package/cjs/Field/index.js +15 -4
  60. package/cjs/Field/index.js.map +2 -2
  61. package/cjs/Field/types.js.map +1 -1
  62. package/cjs/Field/utils/index.js +9 -1
  63. package/cjs/Field/utils/index.js.map +3 -3
  64. package/cjs/Field/utils/useField/index.js +14 -1
  65. package/cjs/Field/utils/useField.js.map +2 -2
  66. package/cjs/FieldArray/FormDialog/index.js +416 -0
  67. package/cjs/FieldArray/FormDialog.js.map +7 -0
  68. package/cjs/FieldArray/index.js +81 -23
  69. package/cjs/FieldArray/index.js.map +2 -2
  70. package/cjs/FieldObject/index.js +30 -15
  71. package/cjs/FieldObject/index.js.map +2 -2
  72. package/cjs/FormBuilder/index.js +11 -7
  73. package/cjs/FormBuilder/index.js.map +2 -2
  74. package/cjs/FormContext/index.js +7 -2
  75. package/cjs/FormContext.js.map +2 -2
  76. package/cjs/MultiplicityField/add-objects/index.js +2 -0
  77. package/cjs/MultiplicityField/add-objects.js.map +2 -2
  78. package/cjs/MultiplicityField/index.js +4 -1
  79. package/cjs/MultiplicityField/index.js.map +2 -2
  80. package/cjs/MultiplicityField/types.js.map +1 -1
  81. package/cjs/inputs/AutoCompleteInput/index.js +2 -1
  82. package/cjs/inputs/AutoCompleteInput/index.js.map +2 -2
  83. package/cjs/inputs/Checkboxes/index.js +3 -1
  84. package/cjs/inputs/Checkboxes/index.js.map +2 -2
  85. package/cjs/inputs/DateInput/index.js +44 -14
  86. package/cjs/inputs/DateInput/index.js.map +2 -2
  87. package/cjs/inputs/DateTimeInput/index.js +245 -0
  88. package/cjs/inputs/DateTimeInput/index.js.map +7 -0
  89. package/cjs/inputs/FileInput/index.js +68 -30
  90. package/cjs/inputs/FileInput/index.js.map +2 -2
  91. package/cjs/inputs/ImageInput/__stories__/logo.d/index.js +1 -0
  92. package/cjs/inputs/ImageInput/__stories__/logo.d.js.map +7 -0
  93. package/cjs/inputs/ImageInput/index.js +48 -11
  94. package/cjs/inputs/ImageInput/index.js.map +2 -2
  95. package/cjs/inputs/Input/index.js +8 -1
  96. package/cjs/inputs/Input/index.js.map +2 -2
  97. package/cjs/inputs/OtpInput/index.js +1 -0
  98. package/cjs/inputs/OtpInput/index.js.map +2 -2
  99. package/cjs/inputs/Radio/index.js +1 -0
  100. package/cjs/inputs/Radio/index.js.map +2 -2
  101. package/cjs/inputs/Select/index.js +9 -2
  102. package/cjs/inputs/Select/index.js.map +2 -2
  103. package/cjs/inputs/inputsScenarios/index.js +2 -2
  104. package/cjs/inputs/inputsScenarios.js.map +2 -2
  105. package/cjs/{lazy/index.js → lazy.js} +10 -1
  106. package/cjs/lazy.js.map +2 -2
  107. package/cjs/{registry/index.js → registry.js} +12 -6
  108. package/cjs/registry.js.map +2 -2
  109. package/cjs/types.js.map +1 -1
  110. package/cjs/utils/index.js +20 -6
  111. package/cjs/utils.js.map +2 -2
  112. package/cjs/validators/index.js +21 -7
  113. package/cjs/validators/index.js.map +2 -2
  114. package/cjs/validators/utils/amka/index.js +60 -0
  115. package/cjs/validators/utils/amka.js.map +7 -0
  116. package/cjs/validators/utils/date/index.js +27 -4
  117. package/cjs/validators/utils/date.js.map +2 -2
  118. package/cjs/validators/utils/datetime/index.js +245 -0
  119. package/cjs/validators/utils/datetime.js.map +7 -0
  120. package/cjs/validators/utils/file/index.js +30 -17
  121. package/cjs/validators/utils/file.js.map +2 -2
  122. package/cjs/validators/utils/index.js +8 -2
  123. package/cjs/validators/utils/index.js.map +2 -2
  124. package/index.js +1 -1
  125. package/inputs/AutoCompleteInput/AutoComplete.stories.d.ts +2 -0
  126. package/inputs/AutoCompleteInput/__stories__/Default.d.ts +1 -1
  127. package/inputs/AutoCompleteInput/__stories__/Multiple.d.ts +1 -1
  128. package/inputs/AutoCompleteInput/index.js +2 -1
  129. package/inputs/AutoCompleteInput/index.js.map +2 -2
  130. package/inputs/Checkboxes/Checkboxes.stories.d.ts +2 -0
  131. package/inputs/Checkboxes/__stories__/Conditional.d.ts +1 -1
  132. package/inputs/Checkboxes/__stories__/Default.d.ts +1 -1
  133. package/inputs/Checkboxes/__stories__/WithDivider.d.ts +1 -1
  134. package/inputs/Checkboxes/index.js +3 -1
  135. package/inputs/Checkboxes/index.js.map +2 -2
  136. package/inputs/DateInput/DateInput.stories.d.ts +6 -0
  137. package/inputs/DateInput/__stories__/Default.d.ts +1 -1
  138. package/inputs/DateInput/__stories__/WithDefaultValue.d.ts +3 -0
  139. package/inputs/DateInput/__stories__/WithInitialValue.d.ts +3 -0
  140. package/inputs/DateInput/__stories__/WithWrongDefaultValue.d.ts +3 -0
  141. package/inputs/DateInput/__stories__/WithWrongInitialValue.d.ts +3 -0
  142. package/inputs/DateInput/index.js +45 -15
  143. package/inputs/DateInput/index.js.map +2 -2
  144. package/inputs/DateTimeInput/DateTimeInput.stories.d.ts +14 -0
  145. package/inputs/DateTimeInput/__stories__/Default.d.ts +3 -0
  146. package/inputs/DateTimeInput/__stories__/WithDefaultValue.d.ts +3 -0
  147. package/inputs/DateTimeInput/__stories__/WithInitialValue.d.ts +3 -0
  148. package/inputs/DateTimeInput/__stories__/WithWrongDefaultValue.d.ts +3 -0
  149. package/inputs/DateTimeInput/__stories__/WithWrongInitialValue.d.ts +3 -0
  150. package/inputs/DateTimeInput/index.d.ts +13 -0
  151. package/inputs/DateTimeInput/index.js +215 -0
  152. package/inputs/DateTimeInput/index.js.map +7 -0
  153. package/inputs/DateTimeInput/index.test.d.ts +1 -0
  154. package/inputs/DateTimeInput/package.json +6 -0
  155. package/inputs/FileInput/FileInput.stories.d.ts +3 -0
  156. package/inputs/FileInput/__stories__/Default.d.ts +1 -1
  157. package/inputs/FileInput/__stories__/WithBorderAndLink.d.ts +3 -0
  158. package/inputs/FileInput/index.d.ts +17 -1
  159. package/inputs/FileInput/index.js +73 -32
  160. package/inputs/FileInput/index.js.map +2 -2
  161. package/inputs/ImageInput/ImageInput.stories.d.ts +4 -1
  162. package/inputs/ImageInput/__stories__/Default.d.ts +1 -1
  163. package/inputs/ImageInput/__stories__/MaxSize.d.ts +1 -1
  164. package/inputs/ImageInput/__stories__/WithInitialValues.d.ts +3 -0
  165. package/inputs/ImageInput/__stories__/WithInvalidImageDimension.d.ts +1 -1
  166. package/inputs/ImageInput/__stories__/logo.d/index.js +1 -0
  167. package/inputs/ImageInput/__stories__/logo.d/package.json +6 -0
  168. package/inputs/ImageInput/__stories__/logo.d.js.map +7 -0
  169. package/inputs/ImageInput/index.d.ts +9 -1
  170. package/inputs/ImageInput/index.js +49 -12
  171. package/inputs/ImageInput/index.js.map +2 -2
  172. package/inputs/Input/Input.stories.d.ts +4 -0
  173. package/inputs/Input/__stories__/AFM.d.ts +1 -1
  174. package/inputs/Input/__stories__/AMKA.d.ts +3 -0
  175. package/inputs/Input/__stories__/Boolean.d.ts +1 -1
  176. package/inputs/Input/__stories__/Email.d.ts +3 -0
  177. package/inputs/Input/__stories__/IBAN.d.ts +1 -1
  178. package/inputs/Input/__stories__/Integer.d.ts +1 -1
  179. package/inputs/Input/__stories__/LandlineNumber.d.ts +1 -1
  180. package/inputs/Input/__stories__/MobilePhone.d.ts +1 -1
  181. package/inputs/Input/__stories__/PhoneNumber.d.ts +1 -1
  182. package/inputs/Input/__stories__/PostalCode.d.ts +1 -1
  183. package/inputs/Input/__stories__/String.d.ts +1 -1
  184. package/inputs/Input/__stories__/StringWithTrimValidation.d.ts +1 -1
  185. package/inputs/Input/__stories__/TextWithLimit.d.ts +1 -1
  186. package/inputs/Input/index.d.ts +2 -1
  187. package/inputs/Input/index.js +8 -1
  188. package/inputs/Input/index.js.map +2 -2
  189. package/inputs/Label/Label.stories.d.ts +2 -0
  190. package/inputs/Label/__stories__/Default.d.ts +1 -1
  191. package/inputs/OtpInput/OtpInput.stories.d.ts +2 -0
  192. package/inputs/OtpInput/__stories__/Default.d.ts +1 -1
  193. package/inputs/OtpInput/index.js +1 -0
  194. package/inputs/OtpInput/index.js.map +2 -2
  195. package/inputs/Radio/Radio.stories.d.ts +2 -0
  196. package/inputs/Radio/__stories__/Conditional.d.ts +1 -1
  197. package/inputs/Radio/__stories__/Default.d.ts +1 -1
  198. package/inputs/Radio/__stories__/WithDivider.d.ts +1 -1
  199. package/inputs/Radio/index.js +1 -0
  200. package/inputs/Radio/index.js.map +2 -2
  201. package/inputs/Select/Select.stories.d.ts +2 -0
  202. package/inputs/Select/__stories__/Default.d.ts +1 -1
  203. package/inputs/Select/index.d.ts +2 -1
  204. package/inputs/Select/index.js +9 -2
  205. package/inputs/Select/index.js.map +2 -2
  206. package/inputs/inputsScenarios/index.js +2 -2
  207. package/inputs/inputsScenarios.d.ts +1 -1
  208. package/inputs/inputsScenarios.js.map +2 -2
  209. package/lazy/index.js +10 -1
  210. package/package.json +8 -8
  211. package/registry/index.js +12 -6
  212. package/src/Field/FieldBase.tsx +6 -2
  213. package/src/Field/FieldBaseContainer.tsx +68 -46
  214. package/src/Field/FieldConditional.tsx +4 -0
  215. package/src/Field/doc.mdx +202 -1
  216. package/src/Field/index.tsx +20 -5
  217. package/src/Field/types.tsx +15 -3
  218. package/src/Field/utils/index.ts +8 -0
  219. package/src/Field/utils/useField.ts +14 -2
  220. package/src/FieldArray/FieldArray.stories.js +1 -0
  221. package/src/FieldArray/FormDialog.tsx +565 -0
  222. package/src/FieldArray/__stories__/Default.tsx +2 -1
  223. package/src/FieldArray/__stories__/WithExactLength.tsx +2 -1
  224. package/src/FieldArray/__stories__/WithModal.tsx +160 -0
  225. package/src/FieldArray/index.test.tsx +8 -0
  226. package/src/FieldArray/index.tsx +112 -48
  227. package/src/FieldObject/index.tsx +39 -18
  228. package/src/FormBuilder/FormBuilder.stories.js +3 -0
  229. package/src/FormBuilder/__stories__/AutoErrorGrouping.tsx +1 -1
  230. package/src/FormBuilder/__stories__/Default.tsx +1 -1
  231. package/src/FormBuilder/__stories__/ErrorGrouping.tsx +1 -1
  232. package/src/FormBuilder/doc.mdx +9 -4
  233. package/src/FormBuilder/index.test.tsx +20 -17
  234. package/src/FormBuilder/index.tsx +12 -7
  235. package/src/FormBuilder/interaction.test.tsx +8 -0
  236. package/src/FormBuilder/scenarios.test.tsx +771 -6
  237. package/src/FormContext.tsx +5 -1
  238. package/src/MultiplicityField/MultiplicityField.stories.js +3 -0
  239. package/src/MultiplicityField/__stories__/Default.tsx +1 -1
  240. package/src/MultiplicityField/__stories__/PreviewDisplay.tsx +1 -1
  241. package/src/MultiplicityField/__stories__/WithExactLength.tsx +1 -1
  242. package/src/MultiplicityField/__stories__/WithMaxLength.tsx +1 -1
  243. package/src/MultiplicityField/__stories__/WithMinAndMaxLength.tsx +1 -1
  244. package/src/MultiplicityField/__stories__/WithMinLength.tsx +1 -1
  245. package/src/MultiplicityField/add-objects.tsx +2 -0
  246. package/src/MultiplicityField/doc.mdx +101 -83
  247. package/src/MultiplicityField/index.test.tsx +4 -0
  248. package/src/MultiplicityField/index.tsx +3 -0
  249. package/src/MultiplicityField/types.ts +1 -0
  250. package/src/Questions/Questions.stories.js +3 -0
  251. package/src/Questions/__snapshots__/index.spec.tsx.snap +2 -1
  252. package/src/Questions/__stories__/Default.tsx +1 -1
  253. package/src/Questions/doc.mdx +21 -41
  254. package/src/Questions/index.test.tsx +4 -0
  255. package/src/doc.mdx +26 -11
  256. package/src/inputs/AutoCompleteInput/AutoComplete.stories.js +3 -0
  257. package/src/inputs/AutoCompleteInput/__stories__/Default.tsx +1 -1
  258. package/src/inputs/AutoCompleteInput/__stories__/Multiple.tsx +1 -1
  259. package/src/inputs/AutoCompleteInput/index.test.tsx +4 -0
  260. package/src/inputs/AutoCompleteInput/index.tsx +1 -0
  261. package/src/inputs/Checkboxes/Checkboxes.stories.js +3 -0
  262. package/src/inputs/Checkboxes/__stories__/Conditional.tsx +1 -1
  263. package/src/inputs/Checkboxes/__stories__/Default.tsx +1 -1
  264. package/src/inputs/Checkboxes/__stories__/WithDivider.tsx +1 -1
  265. package/src/inputs/Checkboxes/index.test.tsx +4 -0
  266. package/src/inputs/Checkboxes/index.tsx +3 -5
  267. package/src/inputs/DateInput/DateInput.stories.js +7 -0
  268. package/src/inputs/DateInput/__stories__/Default.tsx +1 -1
  269. package/src/inputs/DateInput/__stories__/WithDefaultValue.tsx +26 -0
  270. package/src/inputs/DateInput/__stories__/WithInitialValue.tsx +28 -0
  271. package/src/inputs/DateInput/__stories__/WithWrongDefaultValue.tsx +26 -0
  272. package/src/inputs/DateInput/__stories__/WithWrongInitialValue.tsx +28 -0
  273. package/src/inputs/DateInput/index.test.tsx +20 -0
  274. package/src/inputs/DateInput/index.tsx +49 -14
  275. package/src/inputs/DateTimeInput/DateTimeInput.stories.js +14 -0
  276. package/src/inputs/DateTimeInput/__stories__/Default.tsx +25 -0
  277. package/src/inputs/DateTimeInput/__stories__/WithDefaultValue.tsx +26 -0
  278. package/src/inputs/DateTimeInput/__stories__/WithInitialValue.tsx +28 -0
  279. package/src/inputs/DateTimeInput/__stories__/WithWrongDefaultValue.tsx +26 -0
  280. package/src/inputs/DateTimeInput/__stories__/WithWrongInitialValue.tsx +28 -0
  281. package/src/inputs/DateTimeInput/doc.mdx +16 -0
  282. package/src/inputs/DateTimeInput/index.test.tsx +40 -0
  283. package/src/inputs/DateTimeInput/index.tsx +233 -0
  284. package/src/inputs/FileInput/FileInput.stories.js +4 -0
  285. package/src/inputs/FileInput/__stories__/Default.tsx +1 -1
  286. package/src/inputs/FileInput/__stories__/WithBorderAndLink.tsx +34 -0
  287. package/src/inputs/FileInput/index.test.tsx +8 -0
  288. package/src/inputs/FileInput/index.tsx +104 -38
  289. package/src/inputs/ImageInput/ImageInput.stories.js +5 -1
  290. package/src/inputs/ImageInput/__stories__/Default.tsx +1 -1
  291. package/src/inputs/ImageInput/__stories__/MaxSize.tsx +3 -2
  292. package/src/inputs/ImageInput/__stories__/{WithInvalidImageSize.tsx → WithInitialValues.tsx} +12 -3
  293. package/src/inputs/ImageInput/__stories__/WithInvalidImageDimension.tsx +1 -1
  294. package/src/inputs/ImageInput/__stories__/logo.d.ts +4 -0
  295. package/src/inputs/ImageInput/__stories__/logo.png +0 -0
  296. package/src/inputs/ImageInput/index.test.tsx +8 -4
  297. package/src/inputs/ImageInput/index.tsx +100 -42
  298. package/src/inputs/Input/Input.stories.js +5 -0
  299. package/src/inputs/Input/__stories__/AFM.tsx +1 -1
  300. package/src/inputs/Input/__stories__/AMKA.tsx +23 -0
  301. package/src/inputs/Input/__stories__/Boolean.tsx +1 -1
  302. package/src/inputs/Input/__stories__/Email.tsx +23 -0
  303. package/src/inputs/Input/__stories__/IBAN.tsx +1 -1
  304. package/src/inputs/Input/__stories__/Integer.tsx +1 -1
  305. package/src/inputs/Input/__stories__/LandlineNumber.tsx +1 -1
  306. package/src/inputs/Input/__stories__/MobilePhone.tsx +1 -1
  307. package/src/inputs/Input/__stories__/PhoneNumber.tsx +1 -1
  308. package/src/inputs/Input/__stories__/PostalCode.tsx +1 -1
  309. package/src/inputs/Input/__stories__/String.tsx +1 -1
  310. package/src/inputs/Input/__stories__/StringWithTrimValidation.tsx +1 -1
  311. package/src/inputs/Input/__stories__/TextWithLimit.tsx +1 -1
  312. package/src/inputs/Input/index.test.tsx +12 -0
  313. package/src/inputs/Input/index.tsx +11 -2
  314. package/src/inputs/Label/Label.stories.js +3 -0
  315. package/src/inputs/Label/__stories__/Default.tsx +1 -1
  316. package/src/inputs/Label/index.test.tsx +4 -0
  317. package/src/inputs/OtpInput/OtpInput.stories.js +3 -0
  318. package/src/inputs/OtpInput/__stories__/Default.tsx +1 -1
  319. package/src/inputs/OtpInput/index.test.tsx +4 -0
  320. package/src/inputs/OtpInput/index.tsx +1 -0
  321. package/src/inputs/Radio/Radio.stories.js +3 -0
  322. package/src/inputs/Radio/__stories__/Conditional.tsx +1 -1
  323. package/src/inputs/Radio/__stories__/Default.tsx +1 -1
  324. package/src/inputs/Radio/__stories__/WithDivider.tsx +1 -1
  325. package/src/inputs/Radio/index.test.tsx +4 -0
  326. package/src/inputs/Radio/index.tsx +1 -0
  327. package/src/inputs/Select/Select.stories.js +3 -0
  328. package/src/inputs/Select/__stories__/Default.tsx +1 -1
  329. package/src/inputs/Select/index.test.tsx +4 -0
  330. package/src/inputs/Select/index.tsx +13 -4
  331. package/src/inputs/inputsScenarios.ts +2 -2
  332. package/src/lazy.js +10 -1
  333. package/src/registry.js +12 -6
  334. package/src/types.tsx +2 -1
  335. package/src/utils.ts +27 -6
  336. package/src/validators/index.ts +30 -7
  337. package/src/validators/utils/amka.ts +39 -0
  338. package/src/validators/utils/date.ts +29 -5
  339. package/src/validators/utils/datetime.ts +228 -0
  340. package/src/validators/utils/file.ts +33 -19
  341. package/src/validators/utils/index.ts +5 -1
  342. package/types.d.ts +2 -1
  343. package/types.js.map +1 -1
  344. package/utils/index.js +20 -6
  345. package/utils.d.ts +2 -0
  346. package/utils.js.map +2 -2
  347. package/validators/index.d.ts +1 -1
  348. package/validators/index.js +26 -8
  349. package/validators/index.js.map +2 -2
  350. package/validators/utils/amka/index.js +36 -0
  351. package/validators/utils/amka/package.json +6 -0
  352. package/validators/utils/amka.d.ts +6 -0
  353. package/validators/utils/amka.js.map +7 -0
  354. package/validators/utils/date/index.js +27 -4
  355. package/validators/utils/date.d.ts +1 -1
  356. package/validators/utils/date.js.map +2 -2
  357. package/validators/utils/datetime/index.js +210 -0
  358. package/validators/utils/datetime/package.json +6 -0
  359. package/validators/utils/datetime.d.ts +9 -0
  360. package/validators/utils/datetime.js.map +7 -0
  361. package/validators/utils/file/index.js +30 -17
  362. package/validators/utils/file.js.map +2 -2
  363. package/validators/utils/index.d.ts +2 -0
  364. package/validators/utils/index.js +5 -1
  365. package/validators/utils/index.js.map +2 -2
  366. package/cjs/inputs/Input/inputsInputScenarios/index.js +0 -439
  367. package/cjs/inputs/Input/inputsInputScenarios.js.map +0 -7
  368. package/inputs/ImageInput/__stories__/WithInvalidImageSize.d.ts +0 -3
  369. package/inputs/Input/inputsInputScenarios/index.js +0 -406
  370. package/inputs/Input/inputsInputScenarios.d.ts +0 -57
  371. package/inputs/Input/inputsInputScenarios.js.map +0 -7
  372. package/src/inputs/Input/inputsInputScenarios.ts +0 -404
@@ -1,7 +1,8 @@
1
- import React, { useMemo, useState } from 'react';
1
+ import React, { useMemo, useEffect } from 'react';
2
2
  import dayjs from 'dayjs';
3
3
  import customParseFormat from 'dayjs/plugin/customParseFormat';
4
4
  import { UncontrolledFieldProps } from '@digigov/form/Field/types';
5
+ import { useFormContext } from '@digigov/form/FormContext';
5
6
  import {
6
7
  DateInputContainer,
7
8
  DateInputItem,
@@ -16,22 +17,25 @@ export interface DateInputProps extends Omit<UncontrolledFieldProps, 'extra'> {
16
17
  };
17
18
  }
18
19
 
19
- function useDate(value, onChange) {
20
+ function useDate(name, value, form) {
20
21
  const [year, month, day] = useMemo(() => {
21
22
  if (!value || value.length === 0) {
22
- onChange('');
23
23
  return ['', '', ''];
24
24
  }
25
25
  const [day, month, year] = value.split('/');
26
26
  return [year, month, day];
27
27
  }, [value]);
28
28
 
29
+ function update(value) {
30
+ form.setValue(name, value, { shouldValidate: false });
31
+ }
32
+
29
33
  function set(year, month, day) {
30
34
  const value = `${day || ''}/${month || ''}/${year || ''}`;
31
35
  if (!year && !month && !day) {
32
- onChange(null);
36
+ update('');
33
37
  } else {
34
- onChange(value);
38
+ update(value);
35
39
  }
36
40
  }
37
41
 
@@ -56,6 +60,12 @@ function useDate(value, onChange) {
56
60
  set(year, month, val);
57
61
  }
58
62
 
63
+ function trigger() {
64
+ if (form.formState.isSubmitted) {
65
+ form.trigger(name);
66
+ }
67
+ }
68
+
59
69
  return {
60
70
  day,
61
71
  month,
@@ -63,6 +73,7 @@ function useDate(value, onChange) {
63
73
  setYear,
64
74
  setMonth,
65
75
  setDay,
76
+ trigger,
66
77
  };
67
78
  }
68
79
 
@@ -82,25 +93,41 @@ const DatePart = ({ label, ...props }) => {
82
93
 
83
94
  export const DateInput = ({ name, ...props }) => {
84
95
  const { t } = useTranslation();
85
- const [initial] = useState(props.value);
86
- const value = useMemo(() => {
87
- if (initial === props.value) {
88
- return makeDate(props.value);
96
+ const form = useFormContext();
97
+
98
+ useEffect(() => {
99
+ const initialValue = form.getValues(name);
100
+ // checks if the initial value is undefined and if the default value is valid date
101
+ if (initialValue === undefined && props.defaultValue) {
102
+ form.setValue(name, makeDate(props.defaultValue), {
103
+ shouldValidate: false,
104
+ });
105
+ } else {
106
+ // checks if the initial value is a valid date
107
+ form.setValue(name, makeDate(initialValue), {
108
+ shouldValidate: false,
109
+ });
89
110
  }
90
- return props.value;
91
- }, [props.value, initial]);
111
+ }, []);
92
112
 
93
- const date = useDate(value || makeDate(props.defaultValue), props.onChange);
113
+ const value = form.getValues(name);
114
+ const date = useDate(name, value, form);
94
115
 
95
116
  return (
96
117
  <DateInputContainer>
97
118
  <DatePart
98
119
  label={t('form.label.day')}
99
120
  onChange={date.setDay}
100
- onBlur={(e) => date.setDay(e, true)}
121
+ onBlur={(e) => {
122
+ if (date.day && date.day.length === 1) {
123
+ date.setDay(e, true);
124
+ }
125
+ date.trigger();
126
+ }}
101
127
  value={date.day}
102
128
  width={2}
103
129
  name={`${name}-day`}
130
+ id={`${name}-day`}
104
131
  maxLength="2"
105
132
  disabled={props.disabled}
106
133
  aria-required={props['aria-required']}
@@ -109,10 +136,16 @@ export const DateInput = ({ name, ...props }) => {
109
136
  <DatePart
110
137
  label={t('form.label.month')}
111
138
  onChange={date.setMonth}
112
- onBlur={(e) => date.setMonth(e, true)}
139
+ onBlur={(e) => {
140
+ if (date.month && date.month.length === 1) {
141
+ date.setMonth(e, true);
142
+ }
143
+ date.trigger();
144
+ }}
113
145
  value={date.month}
114
146
  width={2}
115
147
  name={`${name}-month`}
148
+ id={`${name}-month`}
116
149
  maxLength="2"
117
150
  disabled={props.disabled}
118
151
  aria-required={props['aria-required']}
@@ -121,9 +154,11 @@ export const DateInput = ({ name, ...props }) => {
121
154
  <DatePart
122
155
  label={t('form.label.year')}
123
156
  onChange={date.setYear}
157
+ onBlur={date.trigger}
124
158
  value={date.year}
125
159
  width={4}
126
160
  name={`${name}-year`}
161
+ id={`${name}-year`}
127
162
  maxLength="4"
128
163
  disabled={props.disabled}
129
164
  aria-required={props['aria-required']}
@@ -0,0 +1,14 @@
1
+ import DateTimeInput from '@digigov/form/inputs/DateTimeInput';
2
+ import doc from './doc.mdx?raw';
3
+ export default {
4
+ title: 'Digigov Form/inputs/DateTimeInput',
5
+ component: DateTimeInput,
6
+ tags: ['autodocs'],
7
+ markdown: doc,
8
+ displayName: 'DateTimeInput',
9
+ };
10
+ export { Default } from '@digigov/form/inputs/DateTimeInput/__stories__/Default';
11
+ export { WithDefaultValue } from '@digigov/form/inputs/DateTimeInput/__stories__/WithDefaultValue';
12
+ export { WithWrongDefaultValue } from '@digigov/form/inputs/DateTimeInput/__stories__/WithWrongDefaultValue';
13
+ export { WithInitialValue } from '@digigov/form/inputs/DateTimeInput/__stories__/WithInitialValue';
14
+ export { WithWrongInitialValue } from '@digigov/form/inputs/DateTimeInput/__stories__/WithWrongInitialValue';
@@ -0,0 +1,25 @@
1
+ import React from 'react';
2
+ import FormBuilder, { Field } from '@digigov/form';
3
+ import { Button } from '@digigov/ui/form/Button';
4
+
5
+ const fields = [
6
+ {
7
+ key: 'datetime-example',
8
+ type: 'datetime',
9
+ required: true,
10
+ label: {
11
+ primary: 'Πότε εκδόθηκε το διαβατήριο σας;',
12
+ secondary: 'Για παράδειγμα, 05 11 2020',
13
+ },
14
+ } as const,
15
+ ];
16
+
17
+ export const Default = (_: any) => (
18
+ <FormBuilder onSubmit={() => console.log('kati')}>
19
+ {fields.map(({ key, ...field }) => {
20
+ return <Field {...field} name={key} key={key} />;
21
+ })}
22
+ <Button type="submit">Συνέχεια</Button>
23
+ </FormBuilder>
24
+ );
25
+ export default Default;
@@ -0,0 +1,26 @@
1
+ import React from 'react';
2
+ import FormBuilder, { Field } from '@digigov/form';
3
+ import { Button } from '@digigov/ui/form/Button';
4
+
5
+ const fields = [
6
+ {
7
+ key: 'datetime_example',
8
+ type: 'datetime',
9
+ defaultValue: '05/11/2020 13:30',
10
+ required: true,
11
+ label: {
12
+ primary: 'Πότε εκδόθηκε το διαβατήριο σας;',
13
+ secondary: 'Για παράδειγμα, 05 11 2020 13:30',
14
+ },
15
+ } as const,
16
+ ];
17
+
18
+ export const WithDefaultValue = (_: any) => (
19
+ <FormBuilder onSubmit={(data) => console.log(data)}>
20
+ {fields.map(({ key, ...field }) => {
21
+ return <Field {...field} name={key} key={key} />;
22
+ })}
23
+ <Button type="submit">Συνέχεια</Button>
24
+ </FormBuilder>
25
+ );
26
+ export default WithDefaultValue;
@@ -0,0 +1,28 @@
1
+ import React from 'react';
2
+ import FormBuilder, { Field } from '@digigov/form';
3
+ import { Button } from '@digigov/ui/form/Button';
4
+
5
+ const fields = [
6
+ {
7
+ key: 'date_example',
8
+ type: 'datetime',
9
+ required: true,
10
+ label: {
11
+ primary: 'Πότε εκδόθηκε το διαβατήριο σας;',
12
+ secondary: 'Για παράδειγμα, 05 11 2020',
13
+ },
14
+ } as const,
15
+ ];
16
+
17
+ export const WithInitialValue = (_: any) => (
18
+ <FormBuilder
19
+ initial={{ date_example: '05/01/2020 13:30' }}
20
+ onSubmit={(data) => console.log(data)}
21
+ >
22
+ {fields.map(({ key, ...field }) => {
23
+ return <Field {...field} name={key} key={key} />;
24
+ })}
25
+ <Button type="submit">Συνέχεια</Button>
26
+ </FormBuilder>
27
+ );
28
+ export default WithInitialValue;
@@ -0,0 +1,26 @@
1
+ import React from 'react';
2
+ import FormBuilder, { Field } from '@digigov/form';
3
+ import { Button } from '@digigov/ui/form/Button';
4
+
5
+ const fields = [
6
+ {
7
+ key: 'datetime_example',
8
+ type: 'datetime',
9
+ defaultValue: '5/1/2020 3:3',
10
+ required: true,
11
+ label: {
12
+ primary: 'Πότε εκδόθηκε το διαβατήριο σας;',
13
+ secondary: 'Για παράδειγμα, 05 11 2020 13:30',
14
+ },
15
+ } as const,
16
+ ];
17
+
18
+ export const WithWrongDefaultValue = (_: any) => (
19
+ <FormBuilder onSubmit={(data) => console.log(data)}>
20
+ {fields.map(({ key, ...field }) => {
21
+ return <Field {...field} name={key} key={key} />;
22
+ })}
23
+ <Button type="submit">Συνέχεια</Button>
24
+ </FormBuilder>
25
+ );
26
+ export default WithWrongDefaultValue;
@@ -0,0 +1,28 @@
1
+ import React from 'react';
2
+ import FormBuilder, { Field } from '@digigov/form';
3
+ import { Button } from '@digigov/ui/form/Button';
4
+
5
+ const fields = [
6
+ {
7
+ key: 'date_example',
8
+ type: 'datetime',
9
+ required: true,
10
+ label: {
11
+ primary: 'Πότε εκδόθηκε το διαβατήριο σας;',
12
+ secondary: 'Για παράδειγμα, 05 11 2020',
13
+ },
14
+ } as const,
15
+ ];
16
+
17
+ export const WithWrongInitialValue = (_: any) => (
18
+ <FormBuilder
19
+ initial={{ date_example: '5/1/2020 3:3' }}
20
+ onSubmit={(data) => console.log(data)}
21
+ >
22
+ {fields.map(({ key, ...field }) => {
23
+ return <Field {...field} name={key} key={key} />;
24
+ })}
25
+ <Button type="submit">Συνέχεια</Button>
26
+ </FormBuilder>
27
+ );
28
+ export default WithWrongInitialValue;
@@ -0,0 +1,16 @@
1
+ ---
2
+ title: DateTime Input
3
+ ---
4
+
5
+ # DateTime input
6
+
7
+
8
+
9
+ Input element of type `datetime` create input fields that let the user enter a date and time,
10
+ either with a textbox that validates the input or a special date picker interface.
11
+
12
+ ## How to use
13
+
14
+ ### Default
15
+
16
+ <code src="@digigov/form/inputs/DateTimeInput/__stories__/Default.tsx" />
@@ -0,0 +1,40 @@
1
+ import React from 'react';
2
+ import { test, expect } from '@playwright/experimental-ct-react';
3
+ import TestVariant from '@digigov/ui/utils/TestVariant'
4
+ import { Default } from '@digigov/form/inputs/DateTimeInput/__stories__/Default';
5
+ import { WithDefaultValue } from '@digigov/form/inputs/DateTimeInput/__stories__/WithDefaultValue';
6
+ import { WithInitialValue } from '@digigov/form/inputs/DateTimeInput/__stories__/WithInitialValue';
7
+ import { WithWrongDefaultValue } from '@digigov/form/inputs/DateTimeInput/__stories__/WithWrongDefaultValue';
8
+ import { WithWrongInitialValue } from '@digigov/form/inputs/DateTimeInput/__stories__/WithWrongInitialValue';
9
+
10
+ test('renders the All DateTimeInput variants', async ({ mount, page }) => {
11
+ await mount(
12
+
13
+ <div>
14
+ <TestVariant title="Default">
15
+ <Default />
16
+ </TestVariant>
17
+ <TestVariant title="WithDefaultValue">
18
+ <WithDefaultValue />
19
+ </TestVariant>
20
+ <TestVariant title="WithInitialValue">
21
+ <WithInitialValue />
22
+ </TestVariant>
23
+ <TestVariant title="WithWrongDefaultValue">
24
+ <WithWrongDefaultValue />
25
+ </TestVariant>
26
+ <TestVariant title="WithWrongInitialValue">
27
+ <WithWrongInitialValue />
28
+ </TestVariant>
29
+ </div>
30
+ )
31
+ await page.evaluate(() => document.fonts.ready);
32
+
33
+ // Move the mouse to the top-left corner to avoid random hover issues
34
+ await page.mouse.move(0, 0);
35
+
36
+
37
+ const screenshot = await page.screenshot({ fullPage: true, animations: 'disabled' });
38
+ expect(screenshot).toMatchSnapshot();
39
+ });
40
+
@@ -0,0 +1,233 @@
1
+ import React, { useMemo, useEffect } from 'react';
2
+ import dayjs from 'dayjs';
3
+ import customParseFormat from 'dayjs/plugin/customParseFormat';
4
+ import { UncontrolledFieldProps } from '@digigov/form/Field/types';
5
+ import { useFormContext } from '@digigov/form/FormContext';
6
+ import {
7
+ DateInputContainer,
8
+ DateInputItem,
9
+ } from '@digigov/ui/form/DateInputContainer';
10
+ import { useTranslation } from '@digigov/ui/i18n';
11
+ dayjs.extend(customParseFormat);
12
+
13
+ export interface DateTimeInputProps
14
+ extends Omit<UncontrolledFieldProps, 'extra'> {
15
+ extra?: {
16
+ max?: string;
17
+ min?: string;
18
+ };
19
+ }
20
+
21
+ function useDateTime(name, value, form) {
22
+ const [year, month, day, hours, minutes] = useMemo(() => {
23
+ if (!value || value.length === 0) {
24
+ return ['', '', '', '', ''];
25
+ }
26
+ const [datePart, timePart] = value.split(' ');
27
+ const [day, month, year] = datePart.split('/');
28
+ const [hours, minutes] = timePart ? timePart.split(':') : ['', ''];
29
+ return [year, month, day, hours, minutes];
30
+ }, [value]);
31
+
32
+ function update(value) {
33
+ form.setValue(name, value, { shouldValidate: false });
34
+ }
35
+
36
+ function set(year, month, day, hours, minutes) {
37
+ const datePart = `${day || ''}/${month || ''}/${year || ''}`;
38
+ const timePart = hours || minutes ? `${hours || ''}:${minutes || ''}` : '';
39
+ const value = timePart ? `${datePart} ${timePart}` : datePart;
40
+
41
+ if (!year && !month && !day && !hours && !minutes) {
42
+ update('');
43
+ } else {
44
+ update(value);
45
+ }
46
+ }
47
+
48
+ function setYear(evt) {
49
+ const val = evt.target.value;
50
+ set(val, month, day, hours, minutes);
51
+ }
52
+
53
+ function setMonth(evt, cast) {
54
+ let val = evt.target.value;
55
+ if (cast && val && val.length === 1) {
56
+ val = '0' + val;
57
+ }
58
+ set(year, val, day, hours, minutes);
59
+ }
60
+
61
+ function setDay(evt, cast) {
62
+ let val = evt.target.value;
63
+ if (cast && val && val.length === 1) {
64
+ val = '0' + val;
65
+ }
66
+ set(year, month, val, hours, minutes);
67
+ }
68
+
69
+ function setHours(evt, cast) {
70
+ let val = evt.target.value;
71
+ if (cast && val && val.length === 1) {
72
+ val = '0' + val;
73
+ }
74
+ set(year, month, day, val, minutes);
75
+ }
76
+
77
+ function setMinutes(evt, cast) {
78
+ let val = evt.target.value;
79
+ if (cast && val && val.length === 1) {
80
+ val = '0' + val;
81
+ }
82
+ set(year, month, day, hours, val);
83
+ }
84
+
85
+ function trigger() {
86
+ if (form.formState.isSubmitted) {
87
+ form.trigger(name);
88
+ }
89
+ }
90
+
91
+ return {
92
+ day,
93
+ month,
94
+ year,
95
+ hours,
96
+ minutes,
97
+ setYear,
98
+ setMonth,
99
+ setDay,
100
+ setHours,
101
+ setMinutes,
102
+ trigger,
103
+ };
104
+ }
105
+
106
+ const VALID_FORMATS = ['DD/MM/YYYY HH:mm', 'DD/MM/YYYY'];
107
+
108
+ const makeDateTime = (val) => {
109
+ const date = dayjs(val, VALID_FORMATS, true);
110
+ if (date.isValid()) {
111
+ return date.format('DD/MM/YYYY HH:mm');
112
+ }
113
+ return '';
114
+ };
115
+
116
+ const DateTimePart = ({ label, ...props }) => {
117
+ return <DateInputItem {...props}>{label}</DateInputItem>;
118
+ };
119
+
120
+ export const DateTimeInput = ({ name, ...props }) => {
121
+ const { t } = useTranslation();
122
+ const form = useFormContext();
123
+
124
+ useEffect(() => {
125
+ const initialValue = form.getValues(name);
126
+ // checks if the initial value is undefined and if the default value is valid date
127
+ if (initialValue === undefined && props.defaultValue) {
128
+ form.setValue(name, makeDateTime(props.defaultValue), {
129
+ shouldValidate: false,
130
+ });
131
+ } else {
132
+ // checks if the initial value is a valid date
133
+ form.setValue(name, makeDateTime(initialValue), {
134
+ shouldValidate: false,
135
+ });
136
+ }
137
+ }, []);
138
+
139
+ const value = form.getValues(name);
140
+ const dateTime = useDateTime(name, value, form);
141
+
142
+ return (
143
+ <DateInputContainer>
144
+ <DateTimePart
145
+ label={t('form.label.day')}
146
+ onChange={dateTime.setDay}
147
+ onBlur={(e) => {
148
+ if (dateTime.day && dateTime.day.length === 1) {
149
+ dateTime.setDay(e, true);
150
+ }
151
+ dateTime.trigger();
152
+ }}
153
+ value={dateTime.day}
154
+ width={2}
155
+ name={`${name}-day`}
156
+ maxLength="2"
157
+ disabled={props.disabled}
158
+ aria-required={props['aria-required']}
159
+ error={!dateTime.day ? props.error : false}
160
+ id={`${name}-day`}
161
+ />
162
+ <DateTimePart
163
+ label={t('form.label.month')}
164
+ onChange={dateTime.setMonth}
165
+ onBlur={(e) => {
166
+ if (dateTime.month && dateTime.month.length === 1) {
167
+ dateTime.setMonth(e, true);
168
+ }
169
+ dateTime.trigger();
170
+ }}
171
+ value={dateTime.month}
172
+ width={2}
173
+ name={`${name}-month`}
174
+ id={`${name}-month`}
175
+ maxLength="2"
176
+ disabled={props.disabled}
177
+ aria-required={props['aria-required']}
178
+ error={!dateTime.month ? props.error : false}
179
+ />
180
+ <DateTimePart
181
+ label={t('form.label.year')}
182
+ onChange={dateTime.setYear}
183
+ onBlur={dateTime.trigger}
184
+ value={dateTime.year}
185
+ width={4}
186
+ name={`${name}-year`}
187
+ id={`${name}-year`}
188
+ maxLength="4"
189
+ disabled={props.disabled}
190
+ aria-required={props['aria-required']}
191
+ error={!dateTime.year ? props.error : false}
192
+ />
193
+ <DateTimePart
194
+ label={t('form.label.hours')}
195
+ onChange={dateTime.setHours}
196
+ onBlur={(e) => {
197
+ if (dateTime.hours && dateTime.hours.length === 1) {
198
+ dateTime.setHours(e, true);
199
+ }
200
+ dateTime.trigger();
201
+ }}
202
+ value={dateTime.hours}
203
+ width={2}
204
+ name={`${name}-hours`}
205
+ id={`${name}-hours`}
206
+ maxLength="2"
207
+ disabled={props.disabled}
208
+ aria-required={props['aria-required']}
209
+ error={!dateTime.hours ? props.error : false}
210
+ />
211
+ <DateTimePart
212
+ label={t('form.label.minutes')}
213
+ onChange={dateTime.setMinutes}
214
+ onBlur={(e) => {
215
+ if (dateTime.minutes && dateTime.minutes.length === 1) {
216
+ dateTime.setMinutes(e, true);
217
+ }
218
+ dateTime.trigger();
219
+ }}
220
+ value={dateTime.minutes}
221
+ width={2}
222
+ name={`${name}-minutes`}
223
+ id={`${name}-minutes`}
224
+ maxLength="2"
225
+ disabled={props.disabled}
226
+ aria-required={props['aria-required']}
227
+ error={!dateTime.minutes ? props.error : false}
228
+ />
229
+ </DateInputContainer>
230
+ );
231
+ };
232
+
233
+ export default DateTimeInput;
@@ -1,7 +1,11 @@
1
1
  import FileInput from '@digigov/form/inputs/FileInput';
2
+ import doc from './doc.mdx?raw';
2
3
  export default {
3
4
  title: 'Digigov Form/inputs/FileInput',
4
5
  component: FileInput,
6
+ tags: ['autodocs'],
7
+ markdown: doc,
5
8
  displayName: 'FileInput',
6
9
  };
7
10
  export { Default } from '@digigov/form/inputs/FileInput/__stories__/Default';
11
+ export { WithBorderAndLink } from '@digigov/form/inputs/FileInput/__stories__/WithBorderAndLink';
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import FormBuilder, { Field } from '@digigov/form';
3
3
  import { Button } from '@digigov/ui/form/Button';
4
4
 
5
- export const Default = () => (
5
+ export const Default = (_: any) => (
6
6
  <FormBuilder
7
7
  onSubmit={(data) => {
8
8
  console.log(data);
@@ -0,0 +1,34 @@
1
+ import React from 'react';
2
+ import FormBuilder, { Field } from '@digigov/form';
3
+ import { Button } from '@digigov/ui/form/Button';
4
+
5
+ export const WithBorderAndLink = () => (
6
+ <FormBuilder
7
+ onSubmit={(data) => {
8
+ console.log(data);
9
+ }}
10
+ >
11
+ <Field
12
+ key={'string'}
13
+ name="file"
14
+ type="file"
15
+ required
16
+ extra={{
17
+ containerProps: {
18
+ variant: 'border',
19
+ },
20
+ uploadButtonProps: {
21
+ variant: 'link',
22
+ },
23
+ resetButtonProps: {
24
+ variant: 'link',
25
+ color: 'warning',
26
+ },
27
+ }}
28
+ label={{ primary: 'Βιογραφικό σημείωμα' }}
29
+ />
30
+ <Button>Συνέχεια</Button>
31
+ </FormBuilder>
32
+ );
33
+
34
+ export default WithBorderAndLink;
@@ -2,6 +2,7 @@ import React from 'react';
2
2
  import { test, expect } from '@playwright/experimental-ct-react';
3
3
  import TestVariant from '@digigov/ui/utils/TestVariant'
4
4
  import { Default } from '@digigov/form/inputs/FileInput/__stories__/Default';
5
+ import { WithBorderAndLink } from '@digigov/form/inputs/FileInput/__stories__/WithBorderAndLink';
5
6
 
6
7
  test('renders the All FileInput variants', async ({ mount, page }) => {
7
8
  await mount(
@@ -10,10 +11,17 @@ test('renders the All FileInput variants', async ({ mount, page }) => {
10
11
  <TestVariant title="Default">
11
12
  <Default />
12
13
  </TestVariant>
14
+ <TestVariant title="WithBorderAndLink">
15
+ <WithBorderAndLink />
16
+ </TestVariant>
13
17
  </div>
14
18
  )
15
19
  await page.evaluate(() => document.fonts.ready);
16
20
 
21
+ // Move the mouse to the top-left corner to avoid random hover issues
22
+ await page.mouse.move(0, 0);
23
+
24
+
17
25
  const screenshot = await page.screenshot({ fullPage: true, animations: 'disabled' });
18
26
  expect(screenshot).toMatchSnapshot();
19
27
  });