@digigov/form 2.0.0-e7d30530 → 2.0.0-eaf330f5

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 (268) hide show
  1. package/Field/FieldBase/index.js +4 -3
  2. package/Field/FieldBase.js.map +2 -2
  3. package/Field/FieldBaseContainer/index.js +19 -37
  4. package/Field/FieldBaseContainer.d.ts +1 -1
  5. package/Field/FieldBaseContainer.js.map +2 -2
  6. package/Field/FieldConditional/index.js +1 -1
  7. package/Field/FieldConditional.js.map +1 -1
  8. package/Field/index.js +1 -2
  9. package/Field/index.js.map +2 -2
  10. package/Field/types.d.ts +2 -2
  11. package/Field/utils/index.js +3 -4
  12. package/Field/utils/index.js.map +2 -2
  13. package/FieldArray/FormDialog/index.js +7 -2
  14. package/FieldArray/FormDialog.d.ts +3 -2
  15. package/FieldArray/FormDialog.js.map +2 -2
  16. package/FieldArray/__stories__/Default.d.ts +1 -1
  17. package/FieldArray/__stories__/WithExactLength.d.ts +1 -1
  18. package/FieldArray/__stories__/WithModal.d.ts +1 -1
  19. package/FieldArray/index.d.ts +1 -1
  20. package/FieldArray/index.js +88 -95
  21. package/FieldArray/index.js.map +3 -3
  22. package/FormBuilder/FormBuilder.stories.d.ts +0 -2
  23. package/FormBuilder/__stories__/AutoErrorGrouping.d.ts +1 -1
  24. package/FormBuilder/__stories__/Default.d.ts +1 -1
  25. package/FormBuilder/__stories__/ErrorGrouping.d.ts +1 -1
  26. package/FormBuilder/index.d.ts +1 -1
  27. package/FormBuilder/index.js +7 -3
  28. package/FormBuilder/index.js.map +2 -2
  29. package/FormContext/index.js +2 -6
  30. package/FormContext.d.ts +0 -1
  31. package/FormContext.js.map +2 -2
  32. package/MultiplicityField/MultiplicityField.stories.d.ts +0 -2
  33. package/MultiplicityField/__stories__/Default.d.ts +1 -1
  34. package/MultiplicityField/__stories__/PreviewDisplay.d.ts +1 -1
  35. package/MultiplicityField/__stories__/WithExactLength.d.ts +1 -1
  36. package/MultiplicityField/__stories__/WithMaxLength.d.ts +1 -1
  37. package/MultiplicityField/__stories__/WithMinAndMaxLength.d.ts +1 -1
  38. package/MultiplicityField/__stories__/WithMinLength.d.ts +1 -1
  39. package/MultiplicityField/add-objects/index.js +1 -1
  40. package/MultiplicityField/add-objects.js.map +2 -2
  41. package/MultiplicityField/index.js +2 -4
  42. package/MultiplicityField/index.js.map +2 -2
  43. package/MultiplicityField/types.d.ts +0 -1
  44. package/Questions/Questions.stories.d.ts +0 -2
  45. package/Questions/__stories__/Default.d.ts +1 -1
  46. package/cjs/Field/FieldBase/index.js +4 -3
  47. package/cjs/Field/FieldBase.js.map +2 -2
  48. package/cjs/Field/FieldBaseContainer/index.js +18 -36
  49. package/cjs/Field/FieldBaseContainer.js.map +3 -3
  50. package/cjs/Field/FieldConditional/index.js +1 -1
  51. package/cjs/Field/FieldConditional.js.map +1 -1
  52. package/cjs/Field/index.js +1 -2
  53. package/cjs/Field/index.js.map +2 -2
  54. package/cjs/Field/types.js.map +1 -1
  55. package/cjs/Field/utils/index.js +3 -4
  56. package/cjs/Field/utils/index.js.map +2 -2
  57. package/cjs/FieldArray/FormDialog/index.js +7 -2
  58. package/cjs/FieldArray/FormDialog.js.map +2 -2
  59. package/cjs/FieldArray/index.js +83 -93
  60. package/cjs/FieldArray/index.js.map +3 -3
  61. package/cjs/FormBuilder/index.js +7 -3
  62. package/cjs/FormBuilder/index.js.map +2 -2
  63. package/cjs/FormContext/index.js +2 -7
  64. package/cjs/FormContext.js.map +2 -2
  65. package/cjs/MultiplicityField/add-objects/index.js +1 -1
  66. package/cjs/MultiplicityField/add-objects.js.map +2 -2
  67. package/cjs/MultiplicityField/index.js +2 -4
  68. package/cjs/MultiplicityField/index.js.map +2 -2
  69. package/cjs/MultiplicityField/types.js.map +1 -1
  70. package/cjs/inputs/Checkboxes/index.js +1 -2
  71. package/cjs/inputs/Checkboxes/index.js.map +2 -2
  72. package/cjs/inputs/DateInput/index.js +12 -27
  73. package/cjs/inputs/DateInput/index.js.map +2 -2
  74. package/cjs/inputs/DateTimeInput/index.js +34 -55
  75. package/cjs/inputs/DateTimeInput/index.js.map +2 -2
  76. package/cjs/inputs/FileInput/index.js +26 -45
  77. package/cjs/inputs/FileInput/index.js.map +2 -2
  78. package/cjs/inputs/ImageInput/index.js +10 -41
  79. package/cjs/inputs/ImageInput/index.js.map +2 -2
  80. package/cjs/inputs/Input/inputsInputScenarios/index.js +439 -0
  81. package/cjs/inputs/Input/inputsInputScenarios.js.map +7 -0
  82. package/cjs/lazy/index.js +6 -6
  83. package/cjs/lazy.js.map +2 -2
  84. package/cjs/registry/index.js +10 -8
  85. package/cjs/registry.js.map +2 -2
  86. package/cjs/validators/index.js +10 -8
  87. package/cjs/validators/index.js.map +2 -2
  88. package/cjs/validators/utils/date/index.js +3 -21
  89. package/cjs/validators/utils/date.js.map +2 -2
  90. package/cjs/validators/utils/datetime/index.js +24 -113
  91. package/cjs/validators/utils/datetime.js.map +2 -2
  92. package/index.js +1 -1
  93. package/inputs/AutoCompleteInput/AutoComplete.stories.d.ts +0 -2
  94. package/inputs/AutoCompleteInput/__stories__/Default.d.ts +1 -1
  95. package/inputs/AutoCompleteInput/__stories__/Multiple.d.ts +1 -1
  96. package/inputs/Checkboxes/Checkboxes.stories.d.ts +0 -2
  97. package/inputs/Checkboxes/__stories__/Conditional.d.ts +1 -1
  98. package/inputs/Checkboxes/__stories__/Default.d.ts +1 -1
  99. package/inputs/Checkboxes/__stories__/WithDivider.d.ts +1 -1
  100. package/inputs/Checkboxes/index.js +1 -2
  101. package/inputs/Checkboxes/index.js.map +2 -2
  102. package/inputs/DateInput/DateInput.stories.d.ts +0 -6
  103. package/inputs/DateInput/__stories__/Default.d.ts +1 -1
  104. package/inputs/DateInput/index.js +13 -28
  105. package/inputs/DateInput/index.js.map +2 -2
  106. package/inputs/DateTimeInput/DateTimeInput.stories.d.ts +3 -10
  107. package/inputs/DateTimeInput/__stories__/Default.d.ts +1 -1
  108. package/inputs/DateTimeInput/index.js +35 -56
  109. package/inputs/DateTimeInput/index.js.map +2 -2
  110. package/inputs/FileInput/FileInput.stories.d.ts +0 -2
  111. package/inputs/FileInput/__stories__/Default.d.ts +1 -1
  112. package/inputs/FileInput/index.d.ts +1 -5
  113. package/inputs/FileInput/index.js +27 -46
  114. package/inputs/FileInput/index.js.map +2 -2
  115. package/inputs/ImageInput/ImageInput.stories.d.ts +1 -4
  116. package/inputs/ImageInput/__stories__/Default.d.ts +1 -1
  117. package/inputs/ImageInput/__stories__/MaxSize.d.ts +1 -1
  118. package/inputs/ImageInput/__stories__/WithInvalidImageDimension.d.ts +1 -1
  119. package/inputs/ImageInput/index.d.ts +1 -9
  120. package/inputs/ImageInput/index.js +11 -42
  121. package/inputs/ImageInput/index.js.map +2 -2
  122. package/inputs/Input/Input.stories.d.ts +0 -3
  123. package/inputs/Input/__stories__/AFM.d.ts +1 -1
  124. package/inputs/Input/__stories__/Boolean.d.ts +1 -1
  125. package/inputs/Input/__stories__/IBAN.d.ts +1 -1
  126. package/inputs/Input/__stories__/Integer.d.ts +1 -1
  127. package/inputs/Input/__stories__/LandlineNumber.d.ts +1 -1
  128. package/inputs/Input/__stories__/MobilePhone.d.ts +1 -1
  129. package/inputs/Input/__stories__/PhoneNumber.d.ts +1 -1
  130. package/inputs/Input/__stories__/PostalCode.d.ts +1 -1
  131. package/inputs/Input/__stories__/String.d.ts +1 -1
  132. package/inputs/Input/__stories__/StringWithTrimValidation.d.ts +1 -1
  133. package/inputs/Input/__stories__/TextWithLimit.d.ts +1 -1
  134. package/inputs/Input/inputsInputScenarios/index.js +406 -0
  135. package/inputs/{ImageInput/__stories__/logo.d → Input/inputsInputScenarios}/package.json +1 -1
  136. package/inputs/Input/inputsInputScenarios.d.ts +57 -0
  137. package/inputs/Input/inputsInputScenarios.js.map +7 -0
  138. package/inputs/Label/Label.stories.d.ts +0 -2
  139. package/inputs/Label/__stories__/Default.d.ts +1 -1
  140. package/inputs/OtpInput/OtpInput.stories.d.ts +0 -2
  141. package/inputs/OtpInput/__stories__/Default.d.ts +1 -1
  142. package/inputs/Radio/Radio.stories.d.ts +0 -2
  143. package/inputs/Radio/__stories__/Conditional.d.ts +1 -1
  144. package/inputs/Radio/__stories__/Default.d.ts +1 -1
  145. package/inputs/Radio/__stories__/WithDivider.d.ts +1 -1
  146. package/inputs/Select/Select.stories.d.ts +0 -2
  147. package/inputs/Select/__stories__/Default.d.ts +1 -1
  148. package/lazy/index.js +6 -6
  149. package/package.json +8 -8
  150. package/registry/index.js +10 -8
  151. package/src/Field/FieldBase.tsx +18 -14
  152. package/src/Field/FieldBaseContainer.tsx +51 -68
  153. package/src/Field/FieldConditional.tsx +1 -1
  154. package/src/Field/index.tsx +1 -2
  155. package/src/Field/types.tsx +2 -2
  156. package/src/Field/utils/index.ts +1 -2
  157. package/src/FieldArray/FormDialog.tsx +12 -3
  158. package/src/FieldArray/__stories__/Default.tsx +1 -1
  159. package/src/FieldArray/__stories__/WithExactLength.tsx +1 -1
  160. package/src/FieldArray/__stories__/WithModal.tsx +1 -1
  161. package/src/FieldArray/index.tsx +103 -111
  162. package/src/FormBuilder/FormBuilder.stories.js +0 -3
  163. package/src/FormBuilder/__stories__/AutoErrorGrouping.tsx +1 -1
  164. package/src/FormBuilder/__stories__/Default.tsx +1 -1
  165. package/src/FormBuilder/__stories__/ErrorGrouping.tsx +1 -1
  166. package/src/FormBuilder/index.tsx +7 -3
  167. package/src/FormBuilder/scenarios.test.tsx +1 -1
  168. package/src/FormContext.tsx +1 -5
  169. package/src/MultiplicityField/MultiplicityField.stories.js +0 -3
  170. package/src/MultiplicityField/__stories__/Default.tsx +1 -1
  171. package/src/MultiplicityField/__stories__/PreviewDisplay.tsx +1 -1
  172. package/src/MultiplicityField/__stories__/WithExactLength.tsx +1 -1
  173. package/src/MultiplicityField/__stories__/WithMaxLength.tsx +1 -1
  174. package/src/MultiplicityField/__stories__/WithMinAndMaxLength.tsx +1 -1
  175. package/src/MultiplicityField/__stories__/WithMinLength.tsx +1 -1
  176. package/src/MultiplicityField/add-objects.tsx +1 -1
  177. package/src/MultiplicityField/index.tsx +1 -3
  178. package/src/MultiplicityField/types.ts +0 -1
  179. package/src/Questions/Questions.stories.js +0 -3
  180. package/src/Questions/__stories__/Default.tsx +1 -1
  181. package/src/inputs/AutoCompleteInput/AutoComplete.stories.js +0 -3
  182. package/src/inputs/AutoCompleteInput/__stories__/Default.tsx +1 -1
  183. package/src/inputs/AutoCompleteInput/__stories__/Multiple.tsx +1 -1
  184. package/src/inputs/Checkboxes/Checkboxes.stories.js +0 -3
  185. package/src/inputs/Checkboxes/__stories__/Conditional.tsx +1 -1
  186. package/src/inputs/Checkboxes/__stories__/Default.tsx +1 -1
  187. package/src/inputs/Checkboxes/__stories__/WithDivider.tsx +1 -1
  188. package/src/inputs/Checkboxes/index.tsx +5 -4
  189. package/src/inputs/DateInput/DateInput.stories.js +0 -7
  190. package/src/inputs/DateInput/__stories__/Default.tsx +1 -1
  191. package/src/inputs/DateInput/index.test.tsx +0 -16
  192. package/src/inputs/DateInput/index.tsx +13 -31
  193. package/src/inputs/DateTimeInput/DateTimeInput.stories.js +6 -12
  194. package/src/inputs/DateTimeInput/__stories__/Default.tsx +1 -1
  195. package/src/inputs/DateTimeInput/index.test.tsx +0 -16
  196. package/src/inputs/DateTimeInput/index.tsx +35 -59
  197. package/src/inputs/FileInput/FileInput.stories.js +0 -3
  198. package/src/inputs/FileInput/__stories__/Default.tsx +1 -1
  199. package/src/inputs/FileInput/index.tsx +39 -72
  200. package/src/inputs/ImageInput/ImageInput.stories.js +1 -5
  201. package/src/inputs/ImageInput/__stories__/Default.tsx +1 -1
  202. package/src/inputs/ImageInput/__stories__/MaxSize.tsx +2 -3
  203. package/src/inputs/ImageInput/__stories__/WithInvalidImageDimension.tsx +1 -1
  204. package/src/inputs/ImageInput/index.test.tsx +0 -4
  205. package/src/inputs/ImageInput/index.tsx +48 -100
  206. package/src/inputs/Input/Input.stories.js +0 -4
  207. package/src/inputs/Input/__stories__/AFM.tsx +1 -1
  208. package/src/inputs/Input/__stories__/Boolean.tsx +1 -1
  209. package/src/inputs/Input/__stories__/IBAN.tsx +1 -1
  210. package/src/inputs/Input/__stories__/Integer.tsx +1 -1
  211. package/src/inputs/Input/__stories__/LandlineNumber.tsx +1 -1
  212. package/src/inputs/Input/__stories__/MobilePhone.tsx +1 -1
  213. package/src/inputs/Input/__stories__/PhoneNumber.tsx +1 -1
  214. package/src/inputs/Input/__stories__/PostalCode.tsx +1 -1
  215. package/src/inputs/Input/__stories__/String.tsx +1 -1
  216. package/src/inputs/Input/__stories__/StringWithTrimValidation.tsx +1 -1
  217. package/src/inputs/Input/__stories__/TextWithLimit.tsx +1 -1
  218. package/src/inputs/Input/index.test.tsx +0 -8
  219. package/src/inputs/Input/inputsInputScenarios.ts +404 -0
  220. package/src/inputs/Label/Label.stories.js +0 -3
  221. package/src/inputs/Label/__stories__/Default.tsx +1 -1
  222. package/src/inputs/OtpInput/OtpInput.stories.js +0 -3
  223. package/src/inputs/OtpInput/__stories__/Default.tsx +1 -1
  224. package/src/inputs/Radio/Radio.stories.js +0 -3
  225. package/src/inputs/Radio/__stories__/Conditional.tsx +1 -1
  226. package/src/inputs/Radio/__stories__/Default.tsx +1 -1
  227. package/src/inputs/Radio/__stories__/WithDivider.tsx +1 -1
  228. package/src/inputs/Select/Select.stories.js +0 -3
  229. package/src/inputs/Select/__stories__/Default.tsx +1 -1
  230. package/src/lazy.js +6 -6
  231. package/src/registry.js +10 -8
  232. package/src/validators/index.ts +13 -13
  233. package/src/validators/utils/date.ts +4 -23
  234. package/src/validators/utils/datetime.ts +29 -116
  235. package/validators/index.js +10 -8
  236. package/validators/index.js.map +2 -2
  237. package/validators/utils/date/index.js +3 -21
  238. package/validators/utils/date.d.ts +1 -1
  239. package/validators/utils/date.js.map +2 -2
  240. package/validators/utils/datetime/index.js +24 -113
  241. package/validators/utils/datetime.d.ts +1 -1
  242. package/validators/utils/datetime.js.map +2 -2
  243. package/cjs/inputs/ImageInput/__stories__/logo.d/index.js +0 -1
  244. package/cjs/inputs/ImageInput/__stories__/logo.d.js.map +0 -7
  245. package/inputs/DateInput/__stories__/WithDefaultValue.d.ts +0 -3
  246. package/inputs/DateInput/__stories__/WithInitialValue.d.ts +0 -3
  247. package/inputs/DateInput/__stories__/WithWrongDefaultValue.d.ts +0 -3
  248. package/inputs/DateInput/__stories__/WithWrongInitialValue.d.ts +0 -3
  249. package/inputs/DateTimeInput/__stories__/WithDefaultValue.d.ts +0 -3
  250. package/inputs/DateTimeInput/__stories__/WithInitialValue.d.ts +0 -3
  251. package/inputs/DateTimeInput/__stories__/WithWrongDefaultValue.d.ts +0 -3
  252. package/inputs/DateTimeInput/__stories__/WithWrongInitialValue.d.ts +0 -3
  253. package/inputs/ImageInput/__stories__/WithInitialValues.d.ts +0 -3
  254. package/inputs/ImageInput/__stories__/logo.d/index.js +0 -1
  255. package/inputs/ImageInput/__stories__/logo.d.js.map +0 -7
  256. package/inputs/Input/__stories__/Email.d.ts +0 -3
  257. package/src/inputs/DateInput/__stories__/WithDefaultValue.tsx +0 -26
  258. package/src/inputs/DateInput/__stories__/WithInitialValue.tsx +0 -28
  259. package/src/inputs/DateInput/__stories__/WithWrongDefaultValue.tsx +0 -26
  260. package/src/inputs/DateInput/__stories__/WithWrongInitialValue.tsx +0 -28
  261. package/src/inputs/DateTimeInput/__stories__/WithDefaultValue.tsx +0 -26
  262. package/src/inputs/DateTimeInput/__stories__/WithInitialValue.tsx +0 -28
  263. package/src/inputs/DateTimeInput/__stories__/WithWrongDefaultValue.tsx +0 -26
  264. package/src/inputs/DateTimeInput/__stories__/WithWrongInitialValue.tsx +0 -28
  265. package/src/inputs/ImageInput/__stories__/WithInitialValues.tsx +0 -45
  266. package/src/inputs/ImageInput/__stories__/logo.d.ts +0 -4
  267. package/src/inputs/ImageInput/__stories__/logo.png +0 -0
  268. package/src/inputs/Input/__stories__/Email.tsx +0 -23
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/validators/utils/datetime.ts"],
4
- "sourcesContent": ["import dayjs from 'dayjs';\nimport customParseFormat from 'dayjs/plugin/customParseFormat';\nimport { FieldSpec } from '@digigov/form/types';\nimport { ValidatorSchema } from '@digigov/form/validators/types';\n\ndayjs.extend(customParseFormat);\n\nconst VALID_DATETIME_FORMATS = ['DD/MM/YYYY HH:mm'];\nconst DATETIME_CACHE = {};\n\nconst getDateTime = (v: string) => {\n return DATETIME_CACHE[v]\n ? DATETIME_CACHE[v]\n : dayjs(v, VALID_DATETIME_FORMATS, true);\n};\n\nconst getDaysInMonth = (month: number, year: number): number => {\n return dayjs(`${year}-${month}-01`).daysInMonth(); // e.g. 29 for Feb 2024\n};\n\nconst checkPartialDateTime = (value: string) => {\n const [datePart, timePart] = value.split(' ');\n const [day, month, year] = datePart?.split('/') ?? [];\n const [hours, minutes] = timePart?.split(':') ?? [];\n\n const hasDay = Boolean(day);\n const hasMonth = Boolean(month);\n const hasYear = Boolean(year);\n const hasHours = Boolean(hours);\n const hasMinutes = Boolean(minutes);\n\n if (hasDay && !hasMonth && !hasYear && !hasHours && !hasMinutes) {\n return 'form.error.datetime.invalid_month_year_hours_minutes';\n }\n if (!hasDay && hasMonth && !hasYear && !hasHours && !hasMinutes) {\n return 'form.error.datetime.invalid_day_year_hours_minutes';\n }\n if (!hasDay && !hasMonth && hasYear && !hasHours && !hasMinutes) {\n return 'form.error.datetime.invalid_day_month_hours_minutes';\n }\n if (hasDay && hasMonth && !hasYear && !hasHours && !hasMinutes) {\n return 'form.error.datetime.invalid_year_hours_minutes';\n }\n if (hasDay && !hasMonth && hasYear && !hasHours && !hasMinutes) {\n return 'form.error.datetime.invalid_month_hours_minutes';\n }\n if (!hasDay && hasMonth && hasYear && !hasHours && !hasMinutes) {\n return 'form.error.datetime.invalid_day_hours_minutes';\n }\n if (hasDay && hasMonth && hasYear && !hasHours && !hasMinutes) {\n return 'form.error.datetime.invalid__hours_minutes';\n }\n if (hasDay && hasMonth && hasYear && hasHours && !hasMinutes) {\n return 'form.error.datetime.invalid_minutes';\n }\n if (hasDay && hasMonth && hasYear && !hasHours && hasMinutes) {\n return 'form.error.datetime.invalid_hours';\n }\n if (hasDay && !hasMonth && !hasYear && hasHours && !hasMinutes) {\n return 'form.error.datetime.invalid_month_year_minutes';\n }\n if (hasDay && !hasMonth && !hasYear && !hasHours && hasMinutes) {\n return 'form.error.datetime.invalid_month_year_hours';\n }\n if (hasDay && !hasMonth && !hasYear && hasHours && hasMinutes) {\n return 'form.error.datetime.invalid_month_year';\n }\n if (!hasDay && hasMonth && !hasYear && hasHours && !hasMinutes) {\n return 'form.error.datetime.invalid_day_year_minutes';\n }\n if (!hasDay && hasMonth && !hasYear && !hasHours && hasMinutes) {\n return 'form.error.datetime.invalid_day_year_hours';\n }\n if (!hasDay && hasMonth && !hasYear && hasHours && hasMinutes) {\n return 'form.error.datetime.invalid_day_year';\n }\n if (!hasDay && !hasMonth && hasYear && hasHours && !hasMinutes) {\n return 'form.error.datetime.invalid_day_month_minutes';\n }\n if (!hasDay && !hasMonth && hasYear && !hasHours && hasMinutes) {\n return 'form.error.datetime.invalid_day_month_hours';\n }\n if (!hasDay && !hasMonth && hasYear && hasHours && hasMinutes) {\n return 'form.error.datetime.invalid_day_month';\n }\n if (!hasDay && !hasMonth && !hasYear && hasHours && hasMinutes) {\n return 'form.error.datetime.invalid_day_month_year';\n }\n if (!hasDay && !hasMonth && !hasYear && !hasHours && hasMinutes) {\n return 'form.error.datetime.invalid_day_month_year_hours';\n }\n if (hasDay && hasMonth && !hasYear && hasHours && !hasMinutes) {\n return 'form.error.datetime.invalid_year_minutes';\n }\n if (hasDay && hasMonth && !hasYear && !hasHours && hasMinutes) {\n return 'form.error.datetime.invalid_year_hours';\n }\n if (hasDay && hasMonth && !hasYear && hasHours && hasMinutes) {\n return 'form.error.datetime.invalid_year';\n }\n if (hasDay && !hasMonth && hasYear && hasHours && !hasMinutes) {\n return 'form.error.datetime.invalid_month_minutes';\n }\n if (hasDay && !hasMonth && hasYear && !hasHours && hasMinutes) {\n return 'form.error.datetime.invalid_month_hours';\n }\n if (hasDay && !hasMonth && hasYear && hasHours && hasMinutes) {\n return 'form.error.datetime.invalid_month';\n }\n if (!hasDay && hasMonth && hasYear && hasHours && !hasMinutes) {\n return 'form.error.datetime.invalid_day_minutes';\n }\n if (!hasDay && hasMonth && hasYear && !hasHours && hasMinutes) {\n return 'form.error.datetime.invalid_day_hours';\n }\n if (!hasDay && hasMonth && hasYear && hasHours && hasMinutes) {\n return 'form.error.datetime.invalid_day';\n }\n if (!hasDay && !hasMonth && !hasYear && hasHours && !hasMinutes) {\n return 'form.error.datetime.invalid_day_month_year_minutes';\n }\n if (hasDay && hasMonth && hasYear && !hasHours && !hasMinutes) {\n return 'form.error.datetime.invalid_hours_minutes';\n }\n if (day && month) {\n const dayNum = parseInt(day);\n const monthNum = parseInt(month);\n const yearNum = parseInt(year);\n const maxDay = getDaysInMonth(monthNum, yearNum);\n if (dayNum < 1 || dayNum > maxDay) {\n return {\n key: 'form.error.datetime.invalid_day_range',\n context: {\n maxDay: maxDay,\n },\n };\n }\n if (monthNum < 1 || monthNum > 12) {\n return 'form.error.datetime.invalid_month_range';\n }\n }\n if (hours && minutes) {\n const hoursNum = parseInt(hours);\n const minutesNum = parseInt(minutes);\n if (hoursNum < 0 || hoursNum > 23) {\n return 'form.error.datetime.invalid_hours_range';\n }\n if (minutesNum < 0 || minutesNum > 59) {\n return 'form.error.datetime.invalid_minutes_range';\n }\n }\n return 'form.error.datetime.invalid';\n};\n\nexport const LATER_THAN_DATETIME_VALIDATOR = (\n field: FieldSpec\n): ValidatorSchema => {\n let minDateTime;\n const params = field.extra || {};\n if (params.min === 'now') {\n minDateTime = dayjs();\n } else {\n minDateTime = getDateTime(params.min);\n }\n return {\n name: 'later-than-datetime',\n message: {\n key: 'form.error.datetime.later_than',\n context: {\n minDateTime: minDateTime.format('DD/MM/YYYY HH:mm'),\n },\n },\n test: function (value: string) {\n if (!value) return true;\n const datetime = getDateTime(value);\n return datetime.isValid() && datetime.isAfter(minDateTime);\n },\n };\n};\n\nexport const EARLIER_THAN_DATETIME_VALIDATOR = (\n field: FieldSpec\n): ValidatorSchema => {\n let maxDateTime;\n const params = field.extra || {};\n if (params.max === 'now') {\n maxDateTime = dayjs();\n } else {\n maxDateTime = getDateTime(params.max);\n }\n return {\n name: 'earlier-than-datetime',\n message: {\n key: 'form.error.datetime.earlier_than',\n context: {\n maxDateTime: maxDateTime.format('DD/MM/YYYY HH:mm'),\n },\n },\n test: function (value: string) {\n if (!value) return true;\n const datetime = getDateTime(value);\n return datetime.isValid() && datetime.isBefore(maxDateTime);\n },\n };\n};\n\nexport const DATETIME_VALIDATOR = {\n name: 'datetime-validator',\n message: (v): string | object => {\n return checkPartialDateTime(v.value);\n },\n test: function (value: string) {\n if (!value) return true;\n const datetime = getDateTime(value);\n return datetime.isValid();\n },\n};\n"],
5
- "mappings": "AAAA,OAAO,WAAW;AAClB,OAAO,uBAAuB;AAI9B,MAAM,OAAO,iBAAiB;AAE9B,MAAM,yBAAyB,CAAC,kBAAkB;AAClD,MAAM,iBAAiB,CAAC;AAExB,MAAM,cAAc,CAAC,MAAc;AACjC,SAAO,eAAe,CAAC,IACnB,eAAe,CAAC,IAChB,MAAM,GAAG,wBAAwB,IAAI;AAC3C;AAEA,MAAM,iBAAiB,CAAC,OAAe,SAAyB;AAC9D,SAAO,MAAM,GAAG,IAAI,IAAI,KAAK,KAAK,EAAE,YAAY;AAClD;AAEA,MAAM,uBAAuB,CAAC,UAAkB;AAC9C,QAAM,CAAC,UAAU,QAAQ,IAAI,MAAM,MAAM,GAAG;AAC5C,QAAM,CAAC,KAAK,OAAO,IAAI,IAAI,UAAU,MAAM,GAAG,KAAK,CAAC;AACpD,QAAM,CAAC,OAAO,OAAO,IAAI,UAAU,MAAM,GAAG,KAAK,CAAC;AAElD,QAAM,SAAS,QAAQ,GAAG;AAC1B,QAAM,WAAW,QAAQ,K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B,MAAI;AACJ,QAAM,SAAS,MAAM,SAAS,CAAC;AAC/B,MAAI,OAAO,QAAQ,OAAO;AACxB,kBAAc,MAAM;AAAA,EACtB,OAAO;AACL,kBAAc,YAAY,OAAO,GAAG;AAAA,EACtC;AACA,SAAO;AAAA,IACL,MAAM;AAAA,IACN,SAAS;AAAA,MACP,KAAK;AAAA,MACL,SAAS;AAAA,QACP,aAAa,YAAY,OAAO,kBAAkB;AAAA,MACpD;AAAA,IACF;AAAA,IACA,MAAM,SAAU,OAAe;AAC7B,UAAI,CAAC,MAAO,QAAO;AACnB,YAAM,WAAW,YAAY,KAAK;AAClC,aAAO,SAAS,QAAQ,KAAK,SAAS,SAAS,WAAW;AAAA,IAC5D;AAAA,EACF;AACF;AAEO,MAAM,qBAAqB;AAAA,EAChC,MAAM;AAAA,EACN,SAAS,CAAC,MAAuB;AAC/B,WAAO,qBAAqB,EAAE,KAAK;AAAA,EACrC;AAAA,EACA,MAAM,SAAU,OAAe;AAC7B,QAAI,CAAC,MAAO,QAAO;AACnB,UAAM,WAAW,YAAY,KAAK;AAClC,WAAO,SAAS,QAAQ;AAAA,EAC1B;AACF;",
4
+ "sourcesContent": ["import dayjs from 'dayjs';\nimport customParseFormat from 'dayjs/plugin/customParseFormat';\nimport { FieldSpec } from '@digigov/form/types';\nimport { ValidatorSchema } from '@digigov/form/validators/types';\n\ndayjs.extend(customParseFormat);\n\nconst VALID_DATETIME_FORMATS = ['DD/MM/YYYY HH:mm'];\nconst DATETIME_CACHE = {};\n\nconst getDateTime = (v: string) => {\n return DATETIME_CACHE[v]\n ? DATETIME_CACHE[v]\n : dayjs(v, VALID_DATETIME_FORMATS, true);\n};\n\n// Function to check partial datetime completion\nconst checkPartialDateTime = (value: string) => {\n const [datePart, timePart] = value.split(' ');\n const [day, month, year] = datePart.split('/');\n const [hours, minutes] = timePart ? timePart.split(':') : [null, null];\n\n // Check date part first\n if (day && !month && !year) {\n return 'form.error.datetime.invalid_month_year';\n }\n if (!day && month && !year) {\n return 'form.error.datetime.invalid_day_year';\n }\n if (!day && !month && year) {\n return 'form.error.datetime.invalid_day_month';\n }\n if (day && month && !year) {\n return 'form.error.datetime.invalid_year';\n }\n if (day && !month && year) {\n return 'form.error.datetime.invalid_month';\n }\n if (!day && month && year) {\n return 'form.error.datetime.invalid_day';\n }\n // If date is complete, check time part\n if (day && month && year) {\n if (hours && !minutes) {\n return 'form.error.datetime.invalid_minutes';\n }\n if (!hours && minutes) {\n return 'form.error.datetime.invalid_hours';\n }\n if (!hours && !minutes) {\n return 'form.error.datetime.invalid';\n }\n if (hours && minutes) {\n const hoursNum = parseInt(hours);\n const minutesNum = parseInt(minutes);\n if (hoursNum < 0 || hoursNum > 23) {\n return 'form.error.datetime.invalid_hours_range';\n }\n if (minutesNum < 0 || minutesNum > 59) {\n return 'form.error.datetime.invalid_minutes_range';\n }\n }\n }\n\n return 'form.error.datetime.invalid';\n};\n\nexport const LATER_THAN_DATETIME_VALIDATOR = (\n field: FieldSpec\n): ValidatorSchema => {\n let minDateTime;\n const params = field.extra || {};\n if (params.min === 'now') {\n minDateTime = dayjs();\n } else {\n minDateTime = getDateTime(params.min);\n }\n return {\n name: 'later-than-datetime',\n message: {\n key: 'form.error.datetime.later_than',\n context: {\n minDateTime: minDateTime.format('DD/MM/YYYY HH:mm'),\n },\n },\n test: function (value: string) {\n if (!value) return true;\n const datetime = getDateTime(value);\n return datetime.isValid() && datetime.isAfter(minDateTime);\n },\n };\n};\n\nexport const EARLIER_THAN_DATETIME_VALIDATOR = (\n field: FieldSpec\n): ValidatorSchema => {\n let maxDateTime;\n const params = field.extra || {};\n if (params.max === 'now') {\n maxDateTime = dayjs();\n } else {\n maxDateTime = getDateTime(params.max);\n }\n return {\n name: 'earlier-than-datetime',\n message: {\n key: 'form.error.datetime.earlier_than',\n context: {\n maxDateTime: maxDateTime.format('DD/MM/YYYY HH:mm'),\n },\n },\n test: function (value: string) {\n if (!value) return true;\n const datetime = getDateTime(value);\n return datetime.isValid() && datetime.isBefore(maxDateTime);\n },\n };\n};\n\nexport const DATETIME_VALIDATOR = {\n name: 'datetime-validator',\n message: (v): string => {\n return checkPartialDateTime(v.value);\n },\n test: function (value: string) {\n if (!value) return true;\n const datetime = getDateTime(value);\n return datetime.isValid();\n },\n};\n"],
5
+ "mappings": "AAAA,OAAO,WAAW;AAClB,OAAO,uBAAuB;AAI9B,MAAM,OAAO,iBAAiB;AAE9B,MAAM,yBAAyB,CAAC,kBAAkB;AAClD,MAAM,iBAAiB,CAAC;AAExB,MAAM,cAAc,CAAC,MAAc;AACjC,SAAO,eAAe,CAAC,IACnB,eAAe,CAAC,IAChB,MAAM,GAAG,wBAAwB,IAAI;AAC3C;AAGA,MAAM,uBAAuB,CAAC,UAAkB;AAC9C,QAAM,CAAC,UAAU,QAAQ,IAAI,MAAM,MAAM,GAAG;AAC5C,QAAM,CAAC,KAAK,OAAO,IAAI,IAAI,SAAS,MAAM,GAAG;AAC7C,QAAM,CAAC,OAAO,OAAO,IAAI,WAAW,SAAS,MAAM,GAAG,IAAI,CAAC,MAAM,IAAI;AAGrE,MAAI,OAAO,CAAC,SAAS,CAAC,MAAM;AAC1B,WAAO;AAAA,EACT;AACA,MAAI,CAAC,OAAO,SAAS,CAAC,MAAM;AAC1B,WAAO;AAAA,EACT;AACA,MAAI,CAAC,OAAO,CAAC,SAAS,MAAM;AAC1B,WAAO;AAAA,EACT;AACA,MAAI,OAAO,SAAS,CAAC,MAAM;AACzB,WAAO;AAAA,EACT;AACA,MAAI,OAAO,CAAC,SAAS,MAAM;AACzB,WAAO;AAAA,EACT;AACA,MAAI,CAAC,OAAO,SAAS,MAAM;AACzB,WAAO;AAAA,EACT;AAEA,MAAI,OAAO,SAAS,MAAM;AACxB,QAAI,SAAS,CAAC,SAAS;AACrB,aAAO;AAAA,IACT;AACA,QAAI,CAAC,SAAS,SAAS;AACrB,aAAO;AAAA,IACT;AACA,QAAI,CAAC,SAAS,CAAC,SAAS;AACtB,aAAO;AAAA,IACT;AAC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F;AACF;AAEO,MAAM,qBAAqB;AAAA,EAChC,MAAM;AAAA,EACN,SAAS,CAAC,MAAc;AACtB,WAAO,qBAAqB,EAAE,KAAK;AAAA,EACrC;AAAA,EACA,MAAM,SAAU,OAAe;AAC7B,QAAI,CAAC,MAAO,QAAO;AACnB,UAAM,WAAW,YAAY,KAAK;AAClC,WAAO,SAAS,QAAQ;AAAA,EAC1B;AACF;",
6
6
  "names": []
7
7
  }
@@ -1 +0,0 @@
1
- //# sourceMappingURL=logo.d.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": [],
4
- "sourcesContent": [],
5
- "mappings": "",
6
- "names": []
7
- }
@@ -1,3 +0,0 @@
1
- import React from 'react';
2
- export declare const WithDefaultValue: (_: any) => React.JSX.Element;
3
- export default WithDefaultValue;
@@ -1,3 +0,0 @@
1
- import React from 'react';
2
- export declare const WithInitialValue: (_: any) => React.JSX.Element;
3
- export default WithInitialValue;
@@ -1,3 +0,0 @@
1
- import React from 'react';
2
- export declare const WithWrongDefaultValue: (_: any) => React.JSX.Element;
3
- export default WithWrongDefaultValue;
@@ -1,3 +0,0 @@
1
- import React from 'react';
2
- export declare const WithWrongInitialValue: (_: any) => React.JSX.Element;
3
- export default WithWrongInitialValue;
@@ -1,3 +0,0 @@
1
- import React from 'react';
2
- export declare const WithDefaultValue: (_: any) => React.JSX.Element;
3
- export default WithDefaultValue;
@@ -1,3 +0,0 @@
1
- import React from 'react';
2
- export declare const WithInitialValue: (_: any) => React.JSX.Element;
3
- export default WithInitialValue;
@@ -1,3 +0,0 @@
1
- import React from 'react';
2
- export declare const WithWrongDefaultValue: (_: any) => React.JSX.Element;
3
- export default WithWrongDefaultValue;
@@ -1,3 +0,0 @@
1
- import React from 'react';
2
- export declare const WithWrongInitialValue: (_: any) => React.JSX.Element;
3
- export default WithWrongInitialValue;
@@ -1,3 +0,0 @@
1
- import React from 'react';
2
- export declare const WithInitialValues: (_: any) => React.JSX.Element;
3
- export default WithInitialValues;
@@ -1 +0,0 @@
1
- //# sourceMappingURL=logo.d.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": [],
4
- "sourcesContent": [],
5
- "mappings": "",
6
- "names": []
7
- }
@@ -1,3 +0,0 @@
1
- import React from 'react';
2
- export declare const Email: (_: any) => React.JSX.Element;
3
- export default Email;
@@ -1,26 +0,0 @@
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: 'date',
9
- required: true,
10
- defaultValue: '05/11/2020',
11
- label: {
12
- primary: 'Πότε εκδόθηκε το διαβατήριο σας;',
13
- secondary: 'Για παράδειγμα, 05 11 2020',
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;
@@ -1,28 +0,0 @@
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: 'date',
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' }}
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;
@@ -1,26 +0,0 @@
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: 'date',
9
- required: true,
10
- defaultValue: '5/1/2020',
11
- label: {
12
- primary: 'Πότε εκδόθηκε το διαβατήριο σας;',
13
- secondary: 'Για παράδειγμα, 05 11 2020',
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;
@@ -1,28 +0,0 @@
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: 'date',
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' }}
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;
@@ -1,26 +0,0 @@
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;
@@ -1,28 +0,0 @@
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;
@@ -1,26 +0,0 @@
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;
@@ -1,28 +0,0 @@
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;
@@ -1,45 +0,0 @@
1
- import React from 'react';
2
- import FormBuilder, { Field, Fieldset } from '@digigov/form';
3
- import logo from '@digigov/form/inputs/ImageInput/__stories__/logo.png';
4
- import { FieldSpec } from '@digigov/form/types';
5
- import { Button } from '@digigov/ui/form/Button';
6
- const FIELDS: FieldSpec[] = [
7
- {
8
- key: 'image',
9
- type: 'image',
10
- required: true,
11
- label: {
12
- primary: 'Ανέβασμα φωτογραφίας',
13
- secondary:
14
- 'Οι επιτρεπόμενες διαστάσεις είναι για το ύψος από 100 μέχρι 400 και για το πλάτος από 100 μέχρι 400.',
15
- },
16
- extra: {
17
- limit: {
18
- maxHeight: 400,
19
- maxWidth: 400,
20
- minHeight: 100,
21
- minWidth: 100,
22
- },
23
- },
24
- },
25
- ];
26
-
27
- export const WithInitialValues = (_: any) => (
28
- <FormBuilder
29
- fields={FIELDS}
30
- initial={{
31
- image: { src: logo, filename: 'logo.png' },
32
- }}
33
- onSubmit={(data) => {
34
- console.log(data);
35
- }}
36
- >
37
- <Fieldset>
38
- {FIELDS.map((field) => (
39
- <Field key={field.key} name={field.key} />
40
- ))}
41
- </Fieldset>
42
- <Button type="submit">Συνέχεια</Button>
43
- </FormBuilder>
44
- );
45
- export default WithInitialValues;
@@ -1,4 +0,0 @@
1
- declare module '*.png' {
2
- const value: any;
3
- export default value;
4
- }
@@ -1,23 +0,0 @@
1
- import React from 'react';
2
- import FormBuilder, { Field } from '@digigov/form';
3
- import { Button } from '@digigov/ui/form/Button';
4
-
5
- export const Email = (_: any) => (
6
- <FormBuilder
7
- onSubmit={(data) => {
8
- console.log(data);
9
- }}
10
- >
11
- <Field
12
- key="email"
13
- name="email"
14
- type="email"
15
- label={{
16
- primary: 'Δ/νση Ηλεκτρ. Ταχυδρομείου (Ε-mail)',
17
- }}
18
- required
19
- />
20
- <Button type="submit">Συνέχεια</Button>
21
- </FormBuilder>
22
- );
23
- export default Email;