@digigov/form 0.13.2 → 1.0.0-00643e1d

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 (308) hide show
  1. package/Field/FieldBase.js +2 -2
  2. package/Field/FieldBaseContainer.js +8 -8
  3. package/Field/FieldConditional.js +2 -2
  4. package/Field/utils.js +6 -6
  5. package/FieldArray/__stories__/Default.js +2 -2
  6. package/FieldArray/__stories__/WithExactLength.js +2 -2
  7. package/FieldArray/index.js +3 -3
  8. package/FieldObject/index.d.ts +1 -1
  9. package/FieldObject/index.js +5 -5
  10. package/Fieldset/FieldsetWithContext.js +4 -4
  11. package/Fieldset/index.d.ts +1 -1
  12. package/Fieldset/index.js +2 -2
  13. package/Fieldset/types.d.ts +2 -2
  14. package/FormBuilder/FormBuilder.js +5 -5
  15. package/FormBuilder/FormBuilder.mdx +29 -44
  16. package/FormBuilder/__stories__/Default.js +2 -2
  17. package/MultiplicityField/MultiplicityField.mdx +277 -267
  18. package/MultiplicityField/__stories__/Default.js +2 -2
  19. package/MultiplicityField/__stories__/PreviewDisplay.js +9 -9
  20. package/MultiplicityField/__stories__/WithExactLength.js +2 -2
  21. package/MultiplicityField/__stories__/WithMaxLength.js +2 -2
  22. package/MultiplicityField/__stories__/WithMinAndMaxLength.js +2 -2
  23. package/MultiplicityField/__stories__/WithMinLength.js +2 -2
  24. package/MultiplicityField/add-objects.js +6 -6
  25. package/MultiplicityField/index.d.ts +2 -2
  26. package/MultiplicityField/index.js +7 -7
  27. package/Questions/Questions.js +2 -2
  28. package/Questions/Step/ReviewStep.js +8 -8
  29. package/Questions/Step/Step.js +2 -2
  30. package/Questions/Step/StepArrayReview.js +11 -11
  31. package/Questions/Step/StepDescription.js +2 -2
  32. package/Questions/Step/StepForm.d.ts +1 -1
  33. package/Questions/Step/StepForm.js +6 -6
  34. package/Questions/Step/StepTitle.d.ts +2 -2
  35. package/Questions/Step/StepTitle.js +11 -5
  36. package/Questions/Step/getAddMoreFields.d.ts +1 -1
  37. package/Questions/Step/index.d.ts +4 -4
  38. package/Questions/Step/index.js +53 -36
  39. package/Questions/__snapshots__/index.spec.tsx.snap +72 -359
  40. package/Questions/__stories__/Default.js +7 -7
  41. package/Questions/index.mdx +45 -48
  42. package/Questions/index.spec.js +2 -2
  43. package/create-simple-form.mdx +258 -237
  44. package/es/Field/FieldBase.js +1 -1
  45. package/es/Field/FieldBaseContainer.js +6 -6
  46. package/es/Field/FieldConditional.js +1 -1
  47. package/es/Field/utils.js +5 -5
  48. package/es/FieldArray/__stories__/Default.js +1 -1
  49. package/es/FieldArray/__stories__/WithExactLength.js +1 -1
  50. package/es/FieldArray/index.js +2 -2
  51. package/es/FieldObject/index.js +3 -3
  52. package/es/Fieldset/FieldsetWithContext.js +2 -2
  53. package/es/Fieldset/index.js +1 -1
  54. package/es/FormBuilder/FormBuilder.js +3 -3
  55. package/es/FormBuilder/FormBuilder.mdx +29 -44
  56. package/es/FormBuilder/__stories__/Default.js +1 -1
  57. package/es/MultiplicityField/MultiplicityField.mdx +277 -267
  58. package/es/MultiplicityField/__stories__/Default.js +1 -1
  59. package/es/MultiplicityField/__stories__/PreviewDisplay.js +8 -8
  60. package/es/MultiplicityField/__stories__/WithExactLength.js +1 -1
  61. package/es/MultiplicityField/__stories__/WithMaxLength.js +1 -1
  62. package/es/MultiplicityField/__stories__/WithMinAndMaxLength.js +1 -1
  63. package/es/MultiplicityField/__stories__/WithMinLength.js +1 -1
  64. package/es/MultiplicityField/add-objects.js +3 -3
  65. package/es/MultiplicityField/index.js +5 -5
  66. package/es/Questions/Questions.js +1 -1
  67. package/es/Questions/Step/ReviewStep.js +5 -5
  68. package/es/Questions/Step/Step.js +1 -1
  69. package/es/Questions/Step/StepArrayReview.js +7 -7
  70. package/es/Questions/Step/StepDescription.js +1 -1
  71. package/es/Questions/Step/StepForm.js +5 -5
  72. package/es/Questions/Step/StepTitle.js +9 -5
  73. package/es/Questions/Step/index.js +4 -4
  74. package/es/Questions/__snapshots__/index.spec.tsx.snap +72 -359
  75. package/es/Questions/__stories__/Default.js +5 -5
  76. package/es/Questions/index.mdx +45 -48
  77. package/es/Questions/index.spec.js +1 -1
  78. package/es/create-simple-form.mdx +258 -237
  79. package/es/index.mdx +13 -6
  80. package/es/inputs/AutoComplete/__stories__/Default.js +3 -3
  81. package/es/inputs/AutoComplete/index.js +1 -1
  82. package/es/inputs/Checkboxes/__stories__/Conditional.js +1 -1
  83. package/es/inputs/Checkboxes/__stories__/Default.js +1 -1
  84. package/es/inputs/Checkboxes/__stories__/WithDivider.js +2 -2
  85. package/es/inputs/Checkboxes/index.js +3 -3
  86. package/es/inputs/DateInput/__stories__/Default.js +1 -19
  87. package/es/inputs/DateInput/index.js +1 -1
  88. package/es/inputs/FileInput/__stories__/Default.js +1 -1
  89. package/es/inputs/FileInput/index.js +6 -6
  90. package/es/inputs/Input/__stories__/AFM.js +1 -1
  91. package/es/inputs/Input/__stories__/Boolean.js +1 -1
  92. package/es/inputs/Input/__stories__/Default.js +1 -1
  93. package/es/inputs/Input/__stories__/IBAN.js +1 -1
  94. package/es/inputs/Input/__stories__/Integer.js +1 -1
  95. package/es/inputs/Input/__stories__/MobilePhone.js +1 -1
  96. package/es/inputs/Input/__stories__/PhoneNumber.js +1 -1
  97. package/es/inputs/Input/__stories__/PostalCode.js +1 -1
  98. package/es/inputs/Input/__stories__/TextWithCharacterLimit.js +1 -1
  99. package/es/inputs/Input/index.js +1 -1
  100. package/es/inputs/Label/__stories__/Default.js +1 -1
  101. package/es/inputs/Label/index.js +3 -3
  102. package/es/inputs/OtpInput/__stories__/Default.js +1 -1
  103. package/es/inputs/OtpInput/index.js +5 -5
  104. package/es/inputs/Radio/__stories__/Conditional.js +1 -1
  105. package/es/inputs/Radio/__stories__/Default.js +2 -2
  106. package/es/inputs/Radio/__stories__/WithDivider.js +3 -3
  107. package/es/inputs/Radio/index.js +4 -4
  108. package/es/inputs/Select/__stories__/Default.js +2 -2
  109. package/es/installation.mdx +12 -16
  110. package/es/utils.js +1 -1
  111. package/es/validators/index.js +2 -2
  112. package/esm/Field/FieldBase.js +1 -1
  113. package/esm/Field/FieldBaseContainer.js +6 -6
  114. package/esm/Field/FieldConditional.js +1 -1
  115. package/esm/Field/utils.js +5 -5
  116. package/esm/FieldArray/__stories__/Default.js +1 -1
  117. package/esm/FieldArray/__stories__/WithExactLength.js +1 -1
  118. package/esm/FieldArray/index.js +2 -2
  119. package/esm/FieldObject/index.js +3 -3
  120. package/esm/Fieldset/FieldsetWithContext.js +2 -2
  121. package/esm/Fieldset/index.js +1 -1
  122. package/esm/FormBuilder/FormBuilder.js +3 -3
  123. package/esm/FormBuilder/FormBuilder.mdx +29 -44
  124. package/esm/FormBuilder/__stories__/Default.js +1 -1
  125. package/esm/MultiplicityField/MultiplicityField.mdx +277 -267
  126. package/esm/MultiplicityField/__stories__/Default.js +1 -1
  127. package/esm/MultiplicityField/__stories__/PreviewDisplay.js +8 -8
  128. package/esm/MultiplicityField/__stories__/WithExactLength.js +1 -1
  129. package/esm/MultiplicityField/__stories__/WithMaxLength.js +1 -1
  130. package/esm/MultiplicityField/__stories__/WithMinAndMaxLength.js +1 -1
  131. package/esm/MultiplicityField/__stories__/WithMinLength.js +1 -1
  132. package/esm/MultiplicityField/add-objects.js +3 -3
  133. package/esm/MultiplicityField/index.js +5 -5
  134. package/esm/Questions/Questions.js +1 -1
  135. package/esm/Questions/Step/ReviewStep.js +5 -5
  136. package/esm/Questions/Step/Step.js +1 -1
  137. package/esm/Questions/Step/StepArrayReview.js +7 -7
  138. package/esm/Questions/Step/StepDescription.js +1 -1
  139. package/esm/Questions/Step/StepForm.js +5 -5
  140. package/esm/Questions/Step/StepTitle.js +9 -5
  141. package/esm/Questions/Step/index.js +4 -4
  142. package/esm/Questions/__snapshots__/index.spec.tsx.snap +72 -359
  143. package/esm/Questions/__stories__/Default.js +5 -5
  144. package/esm/Questions/index.mdx +45 -48
  145. package/esm/Questions/index.spec.js +1 -1
  146. package/esm/create-simple-form.mdx +258 -237
  147. package/esm/index.js +1 -1
  148. package/esm/index.mdx +13 -6
  149. package/esm/inputs/AutoComplete/__stories__/Default.js +3 -3
  150. package/esm/inputs/AutoComplete/index.js +1 -1
  151. package/esm/inputs/Checkboxes/__stories__/Conditional.js +1 -1
  152. package/esm/inputs/Checkboxes/__stories__/Default.js +1 -1
  153. package/esm/inputs/Checkboxes/__stories__/WithDivider.js +2 -2
  154. package/esm/inputs/Checkboxes/index.js +3 -3
  155. package/esm/inputs/DateInput/__stories__/Default.js +1 -19
  156. package/esm/inputs/DateInput/index.js +1 -1
  157. package/esm/inputs/FileInput/__stories__/Default.js +1 -1
  158. package/esm/inputs/FileInput/index.js +6 -6
  159. package/esm/inputs/Input/__stories__/AFM.js +1 -1
  160. package/esm/inputs/Input/__stories__/Boolean.js +1 -1
  161. package/esm/inputs/Input/__stories__/Default.js +1 -1
  162. package/esm/inputs/Input/__stories__/IBAN.js +1 -1
  163. package/esm/inputs/Input/__stories__/Integer.js +1 -1
  164. package/esm/inputs/Input/__stories__/MobilePhone.js +1 -1
  165. package/esm/inputs/Input/__stories__/PhoneNumber.js +1 -1
  166. package/esm/inputs/Input/__stories__/PostalCode.js +1 -1
  167. package/esm/inputs/Input/__stories__/TextWithCharacterLimit.js +1 -1
  168. package/esm/inputs/Input/index.js +1 -1
  169. package/esm/inputs/Label/__stories__/Default.js +1 -1
  170. package/esm/inputs/Label/index.js +3 -3
  171. package/esm/inputs/OtpInput/__stories__/Default.js +1 -1
  172. package/esm/inputs/OtpInput/index.js +5 -5
  173. package/esm/inputs/Radio/__stories__/Conditional.js +1 -1
  174. package/esm/inputs/Radio/__stories__/Default.js +2 -2
  175. package/esm/inputs/Radio/__stories__/WithDivider.js +3 -3
  176. package/esm/inputs/Radio/index.js +4 -4
  177. package/esm/inputs/Select/__stories__/Default.js +2 -2
  178. package/esm/installation.mdx +12 -16
  179. package/esm/utils.js +1 -1
  180. package/esm/validators/index.js +2 -2
  181. package/index.mdx +13 -6
  182. package/inputs/AutoComplete/__stories__/Default.js +4 -4
  183. package/inputs/AutoComplete/index.d.ts +2 -2
  184. package/inputs/AutoComplete/index.js +2 -2
  185. package/inputs/Checkboxes/__stories__/Conditional.js +2 -2
  186. package/inputs/Checkboxes/__stories__/Default.js +2 -2
  187. package/inputs/Checkboxes/__stories__/WithDivider.js +3 -3
  188. package/inputs/Checkboxes/index.d.ts +1 -1
  189. package/inputs/Checkboxes/index.js +4 -4
  190. package/inputs/DateInput/__stories__/Default.js +2 -20
  191. package/inputs/DateInput/index.js +2 -2
  192. package/inputs/FileInput/__stories__/Default.js +2 -2
  193. package/inputs/FileInput/index.js +6 -6
  194. package/inputs/Input/__stories__/AFM.js +2 -2
  195. package/inputs/Input/__stories__/Boolean.js +2 -2
  196. package/inputs/Input/__stories__/Default.js +2 -2
  197. package/inputs/Input/__stories__/IBAN.js +2 -2
  198. package/inputs/Input/__stories__/Integer.js +2 -2
  199. package/inputs/Input/__stories__/MobilePhone.js +2 -2
  200. package/inputs/Input/__stories__/PhoneNumber.js +2 -2
  201. package/inputs/Input/__stories__/PostalCode.js +2 -2
  202. package/inputs/Input/__stories__/TextWithCharacterLimit.js +2 -2
  203. package/inputs/Input/index.js +1 -1
  204. package/inputs/Label/__stories__/Default.js +2 -2
  205. package/inputs/Label/index.js +4 -4
  206. package/inputs/OtpInput/__stories__/Default.js +2 -2
  207. package/inputs/OtpInput/index.js +5 -5
  208. package/inputs/Radio/__stories__/Conditional.js +2 -2
  209. package/inputs/Radio/__stories__/Default.js +3 -3
  210. package/inputs/Radio/__stories__/WithDivider.js +4 -4
  211. package/inputs/Radio/index.d.ts +1 -1
  212. package/inputs/Radio/index.js +7 -7
  213. package/inputs/Select/__stories__/Default.js +3 -3
  214. package/inputs/Select/index.d.ts +1 -1
  215. package/installation.mdx +12 -16
  216. package/package.json +5 -5
  217. package/src/Field/FieldBase.tsx +1 -1
  218. package/src/Field/FieldBaseContainer.tsx +7 -7
  219. package/src/Field/FieldConditional.tsx +1 -1
  220. package/src/Field/index.tsx +1 -1
  221. package/src/Field/utils.ts +7 -7
  222. package/src/FieldArray/FieldArray.stories.js +1 -1
  223. package/src/FieldArray/__stories__/Default.tsx +1 -1
  224. package/src/FieldArray/__stories__/WithExactLength.tsx +1 -1
  225. package/src/FieldArray/index.tsx +3 -3
  226. package/src/FieldObject/index.tsx +6 -6
  227. package/src/Fieldset/FieldsetWithContext.tsx +3 -3
  228. package/src/Fieldset/index.tsx +5 -5
  229. package/src/Fieldset/types.tsx +3 -3
  230. package/src/FormBuilder/FormBuilder.mdx +29 -44
  231. package/src/FormBuilder/FormBuilder.stories.js +1 -1
  232. package/src/FormBuilder/FormBuilder.tsx +4 -4
  233. package/src/FormBuilder/__stories__/Default.tsx +1 -1
  234. package/src/MultiplicityField/MultiplicityField.mdx +277 -267
  235. package/src/MultiplicityField/MultiplicityField.stories.js +1 -1
  236. package/src/MultiplicityField/__stories__/Default.tsx +1 -1
  237. package/src/MultiplicityField/__stories__/PreviewDisplay.tsx +18 -18
  238. package/src/MultiplicityField/__stories__/WithExactLength.tsx +1 -1
  239. package/src/MultiplicityField/__stories__/WithMaxLength.tsx +1 -1
  240. package/src/MultiplicityField/__stories__/WithMinAndMaxLength.tsx +1 -1
  241. package/src/MultiplicityField/__stories__/WithMinLength.tsx +1 -1
  242. package/src/MultiplicityField/add-objects.tsx +3 -3
  243. package/src/MultiplicityField/index.tsx +9 -9
  244. package/src/Questions/Questions.stories.js +1 -1
  245. package/src/Questions/Questions.tsx +2 -2
  246. package/src/Questions/Step/ReviewStep.tsx +6 -6
  247. package/src/Questions/Step/Step.tsx +1 -1
  248. package/src/Questions/Step/StepArrayReview.tsx +11 -11
  249. package/src/Questions/Step/StepDescription.tsx +1 -1
  250. package/src/Questions/Step/StepForm.tsx +6 -6
  251. package/src/Questions/Step/StepTitle.tsx +19 -17
  252. package/src/Questions/Step/getAddMoreFields.tsx +1 -1
  253. package/src/Questions/Step/index.ts +4 -4
  254. package/src/Questions/__snapshots__/index.spec.tsx.snap +72 -359
  255. package/src/Questions/__stories__/Default.tsx +8 -8
  256. package/src/Questions/index.mdx +45 -48
  257. package/src/Questions/index.spec.tsx +1 -1
  258. package/src/create-simple-form.mdx +258 -237
  259. package/src/index.mdx +13 -6
  260. package/src/inputs/AutoComplete/__stories__/Default.tsx +3 -3
  261. package/src/inputs/AutoComplete/index.tsx +4 -4
  262. package/src/inputs/Checkboxes/Checkboxes.stories.js +1 -1
  263. package/src/inputs/Checkboxes/__stories__/Conditional.tsx +2 -2
  264. package/src/inputs/Checkboxes/__stories__/Default.tsx +1 -1
  265. package/src/inputs/Checkboxes/__stories__/WithDivider.tsx +2 -2
  266. package/src/inputs/Checkboxes/index.tsx +4 -4
  267. package/src/inputs/DateInput/DateInput.stories.js +1 -1
  268. package/src/inputs/DateInput/__stories__/Default.tsx +1 -17
  269. package/src/inputs/DateInput/index.tsx +2 -2
  270. package/src/inputs/FileInput/FileInput.stories.js +1 -1
  271. package/src/inputs/FileInput/__stories__/Default.tsx +1 -1
  272. package/src/inputs/FileInput/index.tsx +6 -6
  273. package/src/inputs/Input/__stories__/AFM.tsx +1 -1
  274. package/src/inputs/Input/__stories__/Boolean.tsx +1 -1
  275. package/src/inputs/Input/__stories__/Default.tsx +1 -1
  276. package/src/inputs/Input/__stories__/IBAN.tsx +1 -1
  277. package/src/inputs/Input/__stories__/Integer.tsx +1 -1
  278. package/src/inputs/Input/__stories__/MobilePhone.tsx +1 -1
  279. package/src/inputs/Input/__stories__/PhoneNumber.tsx +1 -1
  280. package/src/inputs/Input/__stories__/PostalCode.tsx +1 -1
  281. package/src/inputs/Input/__stories__/TextWithCharacterLimit.tsx +1 -1
  282. package/src/inputs/Input/index.tsx +3 -3
  283. package/src/inputs/Label/Label.stories.js +1 -1
  284. package/src/inputs/Label/__stories__/Default.tsx +1 -1
  285. package/src/inputs/Label/index.tsx +4 -4
  286. package/src/inputs/OtpInput/__stories__/Default.tsx +1 -1
  287. package/src/inputs/OtpInput/index.tsx +14 -10
  288. package/src/inputs/Radio/Radio.stories.js +1 -2
  289. package/src/inputs/Radio/__stories__/Conditional.tsx +3 -3
  290. package/src/inputs/Radio/__stories__/Default.tsx +2 -2
  291. package/src/inputs/Radio/__stories__/WithDivider.tsx +3 -3
  292. package/src/inputs/Radio/index.tsx +6 -6
  293. package/src/inputs/Select/Select.stories.js +1 -1
  294. package/src/inputs/Select/__stories__/Default.tsx +2 -2
  295. package/src/inputs/Select/index.tsx +2 -2
  296. package/src/installation.mdx +12 -16
  297. package/src/types.tsx +4 -2
  298. package/src/utils.ts +1 -1
  299. package/src/validators/index.ts +10 -10
  300. package/src/validators/utils/file.ts +1 -1
  301. package/src/validators/utils/phone.ts +1 -1
  302. package/src/validators/utils/postal_code.ts +1 -1
  303. package/types.d.ts +4 -2
  304. package/validators/index.d.ts +3 -3
  305. package/validators/index.js +4 -4
  306. package/validators/utils/file.d.ts +1 -1
  307. package/validators/utils/phone.d.ts +1 -1
  308. package/validators/utils/postal_code.d.ts +1 -1
@@ -13,13 +13,13 @@ var _react = _interopRequireDefault(require("react"));
13
13
 
14
14
  var _form = _interopRequireWildcard(require("@digigov/form"));
15
15
 
16
- var _core = require("@digigov/ui/core");
16
+ var _Button = require("@digigov/ui/form/Button");
17
17
 
18
18
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
19
19
 
20
20
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
21
21
 
22
- var _ref = /*#__PURE__*/_react["default"].createElement(_core.Button, {
22
+ var _ref = /*#__PURE__*/_react["default"].createElement(_Button.Button, {
23
23
  type: "submit"
24
24
  }, "\u03A3\u03C5\u03BD\u03AD\u03C7\u03B5\u03B9\u03B1");
25
25
 
@@ -34,7 +34,7 @@ var Default = function Default() {
34
34
  type: "choice:single",
35
35
  required: true,
36
36
  label: {
37
- primary: 'Ποια ειναι η χώρα της διαμονής σας;'
37
+ primary: 'Ποιά είναι η χώρα της διαμονής σας;'
38
38
  },
39
39
  extra: {
40
40
  component: 'Select',
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
- import { FieldOptionProps } from '@digigov/form/inputs/Label';
3
2
  import { UncontrolledFieldProps } from '@digigov/form/Field/types';
3
+ import { FieldOptionProps } from '@digigov/form/inputs/Label';
4
4
  export interface SelectProps extends Omit<UncontrolledFieldProps, 'extra'> {
5
5
  extra: {
6
6
  className?: string;
package/installation.mdx CHANGED
@@ -7,39 +7,35 @@ sidebar_label: Installation
7
7
  import Tabs from '@theme/Tabs';
8
8
  import TabItem from '@theme/TabItem';
9
9
  import CodeBlock from '@theme/CodeBlock';
10
- import LeadText from "@site/src/components/LeadText";
10
+ import LeadText from '@site/src/components/LeadText';
11
11
 
12
12
  <LeadText>
13
- This page will help you install Digigov Form depending on the framework that you
14
- use and the application architecture.
13
+ This page will help you install Digigov Form depending on the framework that
14
+ you use and the application architecture.
15
15
  </LeadText>
16
16
 
17
17
  We assume that your stack uses some of the following tools.
18
18
 
19
- * React v16 or later
20
- * Nextjs or create-react-app to run your code
21
- * Digigov CSS, as a CSS import or as Tailwind plugin
19
+ - React v16 or later
20
+ - Nextjs or create-react-app to run your code
21
+ - Digigov CSS, as a CSS import or as Tailwind plugin
22
22
 
23
23
  ## Using create-digigov-app
24
24
 
25
25
  We highly recommend using `create-digigov-app`. Our scaffolder was created to save development teams time and effort. This way
26
26
  everything you need is already configured.
27
27
 
28
- If you choose to use our scaffolder tool, make sure you follow this
28
+ If you choose to use our scaffolder tool, make sure you follow this
29
29
  [guide](/docs/building-apps) first, if you haven't already done so.
30
30
 
31
31
  Then you just install the `@digigov/form` package from NPM.
32
32
 
33
33
  <Tabs>
34
34
  <TabItem value="npm" label="NPM" default>
35
- <CodeBlock>
36
- npm install @digigov/form --save
37
- </CodeBlock>
35
+ <CodeBlock>npm install @digigov/form --save</CodeBlock>
38
36
  </TabItem>
39
37
  <TabItem value="yarn" label="Yarn">
40
- <CodeBlock>
41
- yarn add @digigov/form
42
- </CodeBlock>
38
+ <CodeBlock>yarn add @digigov/form</CodeBlock>
43
39
  </TabItem>
44
40
  </Tabs>
45
41
 
@@ -48,9 +44,9 @@ Then you just install the `@digigov/form` package from NPM.
48
44
  This method is not recommended and you should proceed at your own risk. For
49
45
  Digigov Form to work properly, it is essential to do some configuration.
50
46
 
51
- * A working React application, ideally [Nextjs](https://nextjs.org/) or [Create
47
+ - A working React application, ideally [Nextjs](https://nextjs.org/) or [Create
52
48
  React App](https://create-react-app.dev/)
53
- * You should already have [installed and configured Digigov
49
+ - You should already have [installed and configured Digigov
54
50
  CSS](https://guide.services.gov.gr/docs/installation)
55
51
 
56
52
  If you meet these prerequisites, now it is time to install the dependencies.
@@ -69,4 +65,4 @@ and install `@digigov/form` and it's dependencies.
69
65
  yarn add @digigov/form @digigov/ui @digigov/react-core
70
66
  </CodeBlock>
71
67
  </TabItem>
72
- </Tabs>
68
+ </Tabs>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digigov/form",
3
- "version": "0.13.2",
3
+ "version": "1.0.0-00643e1d",
4
4
  "description": "@digigov form builder",
5
5
  "author": "GRNET Developers <devs@lists.grnet.gr>",
6
6
  "license": "BSD-2-Clause",
@@ -16,12 +16,12 @@
16
16
  "google-libphonenumber": "3.2.8",
17
17
  "dayjs": "1.10.4",
18
18
  "@hookform/resolvers": "2.9.6",
19
- "publint": "0.1.8"
19
+ "publint": "0.1.8",
20
+ "@digigov/react-icons": "1.0.0-00643e1d"
20
21
  },
21
22
  "peerDependencies": {
22
- "@digigov/ui": "0.35.5",
23
- "@digigov/react-core": "0.26.0",
24
- "@digigov/react-extensions": "0.23.5",
23
+ "@digigov/ui": "1.0.0-00643e1d",
24
+ "@digigov/react-core": "1.0.0-00643e1d",
25
25
  "clsx": "1.1.1",
26
26
  "react": "^16.8.0 || ^17.0.0",
27
27
  "react-dom": "^16.8.0 || ^17.0.0"
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
+ import { Controller } from 'react-hook-form';
2
3
  import FieldBaseContainer from '@digigov/form/Field/FieldBaseContainer';
3
4
  import { FieldBaseProps } from '@digigov/form/Field/types';
4
- import { Controller } from 'react-hook-form';
5
5
 
6
6
  export const FieldBase: React.FC<FieldBaseProps> = (props) => {
7
7
  const {
@@ -1,13 +1,13 @@
1
1
  import React from 'react';
2
+ import { FieldContainerProps } from '@digigov/form/Field/types';
3
+ import Label from '@digigov/form/inputs/Label';
4
+ import ErrorMessage from '@digigov/react-core/ErrorMessage';
2
5
  import FieldContainer from '@digigov/react-core/FieldContainer';
3
- import LabelContainer from '@digigov/react-core/LabelContainer';
4
6
  import CoreFieldset from '@digigov/react-core/Fieldset';
5
- import Hint from '@digigov/react-core/Hint';
6
7
  import FieldsetLegend from '@digigov/react-core/FieldsetLegend';
7
- import ErrorMessage from '@digigov/react-core/ErrorMessage';
8
- import { useTranslation } from '@digigov/ui/app/i18n';
9
- import { FieldContainerProps } from '@digigov/form/Field/types';
10
- import Label from '@digigov/form/inputs/Label';
8
+ import Hint from '@digigov/react-core/Hint';
9
+ import LabelContainer from '@digigov/react-core/LabelContainer';
10
+ import { useTranslation } from '@digigov/ui/i18n';
11
11
 
12
12
  export const FieldBaseContainer: React.FC<FieldContainerProps> = ({
13
13
  name,
@@ -26,7 +26,7 @@ export const FieldBaseContainer: React.FC<FieldContainerProps> = ({
26
26
  return (
27
27
  <FieldContainer error={!!error} {...layout}>
28
28
  <CoreFieldset>
29
- <FieldsetLegend size="s">{label && label.primary}</FieldsetLegend>
29
+ <FieldsetLegend size="sm">{label && label.primary}</FieldsetLegend>
30
30
  {label && label.secondary && <Hint>{t(label.secondary)}</Hint>}
31
31
  {error && (
32
32
  <ErrorMessage id={`${name}-error`}>
@@ -1,11 +1,11 @@
1
1
  import React from 'react';
2
2
  import { useWatch } from 'react-hook-form';
3
- import { evaluateFieldWithConditions } from '@digigov/form/Field/utils';
4
3
  import { FieldBase } from '@digigov/form/Field/FieldBase';
5
4
  import {
6
5
  ChildFieldMemoProps,
7
6
  FieldConditionalProps,
8
7
  } from '@digigov/form/Field/types';
8
+ import { evaluateFieldWithConditions } from '@digigov/form/Field/utils';
9
9
 
10
10
  const ChildFieldMemo = React.memo(
11
11
  function ChildField({
@@ -1,11 +1,11 @@
1
1
  import React, { useMemo } from 'react';
2
2
  import { FieldBase } from '@digigov/form/Field/FieldBase';
3
+ import FieldConditional from '@digigov/form/Field/FieldConditional';
3
4
  import {
4
5
  FieldWithCondition,
5
6
  CalculatedField,
6
7
  FieldProps,
7
8
  } from '@digigov/form/Field/types';
8
- import FieldConditional from '@digigov/form/Field/FieldConditional';
9
9
  import { useField, calculateField } from '@digigov/form/Field/utils';
10
10
  import FieldArray from '@digigov/form/FieldArray';
11
11
  import Multiplicity from '@digigov/form/MultiplicityField';
@@ -6,16 +6,16 @@ import {
6
6
  FieldWithCondition,
7
7
  UseFieldProps,
8
8
  } from '@digigov/form/Field/types';
9
- import { FieldSpec } from '@digigov/form/types';
10
-
11
- import Input from '@digigov/form/inputs/Input';
9
+ import { FormContext } from '@digigov/form/FormContext';
12
10
  import Checkboxes from '@digigov/form/inputs/Checkboxes';
13
- import Radio from '@digigov/form/inputs/Radio';
14
- import Select from '@digigov/form/inputs/Select';
15
- import FileInput from '@digigov/form/inputs/FileInput';
16
11
  import DateInput from '@digigov/form/inputs/DateInput';
12
+ import FileInput from '@digigov/form/inputs/FileInput';
13
+ import Input from '@digigov/form/inputs/Input';
17
14
  import OtpInput from '@digigov/form/inputs/OtpInput';
18
- import { FormContext } from '@digigov/form/FormContext';
15
+ import Radio from '@digigov/form/inputs/Radio';
16
+ import Select from '@digigov/form/inputs/Select';
17
+ import { FieldSpec } from '@digigov/form/types';
18
+
19
19
  const AutoComplete = lazy(() => import('@digigov/form/inputs/AutoComplete'));
20
20
 
21
21
  const FIELD_COMPONENTS: FieldComponentRegistry = {
@@ -2,7 +2,7 @@ import FieldArray from '@digigov/form/FieldArray';
2
2
  export default {
3
3
  title: 'Digigov Form/FieldArray',
4
4
  component: FieldArray,
5
- displayName: 'FieldArray'
5
+ displayName: 'FieldArray',
6
6
  };
7
7
  export * from '@digigov/form/FieldArray/__stories__/Default';
8
8
  export * from '@digigov/form/FieldArray/__stories__/WithExactLength';
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import FormBuilder, { Field, FieldSpec } from '@digigov/form';
3
- import { Button } from '@digigov/ui/core';
3
+ import { Button } from '@digigov/ui/form/Button';
4
4
 
5
5
  const fields = [
6
6
  {
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import FormBuilder, { Field, FieldSpec } from '@digigov/form';
3
- import { Button } from '@digigov/ui/core';
3
+ import { Button } from '@digigov/ui/form/Button';
4
4
 
5
5
  const fields = [
6
6
  {
@@ -1,11 +1,11 @@
1
1
  import React from 'react';
2
2
  import { ErrorOption, useFieldArray, UseFormReturn } from 'react-hook-form';
3
+ import FieldContainer from '@digigov/form/Field/FieldBaseContainer';
4
+ import { FieldProps } from '@digigov/form/Field/types';
3
5
  import FieldObject from '@digigov/form/FieldObject';
4
- import { Button, Card, Hint } from '@digigov/ui';
5
6
  import { FieldsetLabel } from '@digigov/form/Fieldset';
6
7
  import Fieldset from '@digigov/react-core/Fieldset';
7
- import { FieldProps } from '@digigov/form/Field/types';
8
- import FieldContainer from '@digigov/form/Field/FieldBaseContainer';
8
+ import { Button, Card, Hint } from '@digigov/ui';
9
9
  export interface FieldArrayProps extends FieldProps {
10
10
  control: UseFormReturn['control'];
11
11
  register: UseFormReturn['register'];
@@ -1,12 +1,12 @@
1
1
  import React, { useMemo } from 'react';
2
- import { CalculatedField, FieldProps } from '@digigov/form/Field/types';
3
- import Fieldset, { FieldsetCaption } from '@digigov/form/Fieldset';
4
- import { useTranslation } from '@digigov/ui/app/i18n';
2
+ import { ErrorOption, UseFormReturn } from 'react-hook-form';
5
3
  import { FieldBase } from '@digigov/form/Field/FieldBase';
4
+ import { CalculatedField, FieldProps } from '@digigov/form/Field/types';
6
5
  import { calculateField } from '@digigov/form/Field/utils';
7
- import { FieldsetLegend } from '@digigov/react-core';
8
- import { ErrorOption, UseFormReturn } from 'react-hook-form';
6
+ import Fieldset, { FieldsetCaption } from '@digigov/form/Fieldset';
9
7
  import { FieldSpec } from '@digigov/form/types';
8
+ import { FieldsetLegend } from '@digigov/react-core';
9
+ import { useTranslation } from '@digigov/ui/i18n';
10
10
 
11
11
  export interface FieldObjectProps extends Omit<FieldProps, 'key'> {
12
12
  control: UseFormReturn['control'];
@@ -30,7 +30,7 @@ export const FieldObject: React.FC<FieldObjectProps> = ({
30
30
  return (
31
31
  <Fieldset>
32
32
  {label?.primary && (
33
- <FieldsetLegend size="s">{t(label.primary)}</FieldsetLegend>
33
+ <FieldsetLegend size="sm">{t(label.primary)}</FieldsetLegend>
34
34
  )}
35
35
  {label?.secondary && (
36
36
  <FieldsetCaption>{t(label.secondary)}</FieldsetCaption>
@@ -1,14 +1,14 @@
1
1
  import React, { useContext, useMemo } from 'react';
2
- import { FormContext } from '@digigov/form/FormContext';
3
- import { FieldsetSpec } from '@digigov/form/types';
4
2
  import Field from '@digigov/form/Field';
5
- import { useTranslation } from '@digigov/ui/app/i18n';
6
3
  import {
7
4
  Fieldset,
8
5
  FieldsetLabel,
9
6
  FieldsetCaption,
10
7
  FieldsetBody,
11
8
  } from '@digigov/form/Fieldset/';
9
+ import { FormContext } from '@digigov/form/FormContext';
10
+ import { FieldsetSpec } from '@digigov/form/types';
11
+ import { useTranslation } from '@digigov/ui/i18n';
12
12
 
13
13
  export const FieldsetWithContext: React.FC<{ name: string }> = ({ name }) => {
14
14
  const { label, body, fields } = useFieldset(name);
@@ -1,14 +1,14 @@
1
1
  import React from 'react';
2
- import Grid from '@digigov/ui/layouts/Grid';
3
- import Fieldset from '@digigov/react-core/Fieldset';
4
- import FieldsetLegend from '@digigov/react-core/FieldsetLegend';
5
- import Hint from '@digigov/react-core/Hint';
6
- import NormalText from '@digigov/ui/typography/NormalText';
7
2
  import {
8
3
  FieldsetLabelProps,
9
4
  FieldsetCaptionProps,
10
5
  FieldsetBodyProps,
11
6
  } from '@digigov/form/Fieldset/types';
7
+ import Fieldset from '@digigov/react-core/Fieldset';
8
+ import FieldsetLegend from '@digigov/react-core/FieldsetLegend';
9
+ import Hint from '@digigov/react-core/Hint';
10
+ import Grid from '@digigov/ui/layouts/Grid';
11
+ import NormalText from '@digigov/ui/typography/NormalText';
12
12
 
13
13
  export const FieldsetLabel: React.FC<FieldsetLabelProps> = ({
14
14
  children,
@@ -1,6 +1,6 @@
1
- import { FieldsetLegendProps } from "@digigov/react-core/FieldsetLegend";
2
- import { HintProps } from "@digigov/react-core/Hint";
1
+ import { FieldsetLegendProps } from '@digigov/react-core/FieldsetLegend';
2
+ import { HintProps } from '@digigov/react-core/Hint';
3
3
 
4
4
  export interface FieldsetLabelProps extends FieldsetLegendProps {}
5
- export interface FieldsetCaptionProps extends HintProps{}
5
+ export interface FieldsetCaptionProps extends HintProps {}
6
6
  export interface FieldsetBodyProps {}
@@ -4,23 +4,25 @@ title: FormBuilder
4
4
  sidebar_label: FormBuilder
5
5
  ---
6
6
 
7
- `FormBuilder` is a React component that provides an easy way to efficiently create reusable form page. Forms are a flexible mechanism for collecting user input because there are suitable widgets for entering many different types of data, including text boxes, checkboxes, radio buttons, dropdowns and so on for submission to a server. Actually when we use `stepForm` for building step-forms all we do is to render `FormBuilder` component.
7
+ `FormBuilder` is a React component that provides an easy way to efficiently create reusable form page. Forms are a flexible mechanism for collecting user input because there are suitable widgets for entering many different types of data, including text boxes, checkboxes, radio buttons, dropdowns and so on for submission to a server. Actually when we use `stepForm` for building step-forms all we do is to render `FormBuilder` component.
8
8
 
9
- `stepForm` component:
9
+ `stepForm` component:
10
10
 
11
- <Story packageName="@digigov/form" component="FormBuilder" story="Default.tsx" />
11
+ <Story
12
+ packageName="@digigov/form"
13
+ component="FormBuilder"
14
+ story="Default.tsx"
15
+ />
12
16
 
13
17
  ### Importing and using FormBuilder Component
14
18
 
15
19
  To import `FormBuilder` component simply import it from `'@digigov/form`.
16
20
 
17
21
  ```javascript
18
-
19
- import {FormBuilder} from '@digigov/form';
20
-
22
+ import { FormBuilder } from '@digigov/form';
21
23
  ```
22
- Now you can use the current component inisde of your component
23
24
 
25
+ Now you can use the current component inisde of your component
24
26
 
25
27
  ```javascript
26
28
  import BasicLayout, {
@@ -59,33 +61,29 @@ export default function MyComponent({ props }) {
59
61
 
60
62
  `FormBuilder` component accepts several arguments as input props.
61
63
 
62
- | Name | Type | Default | Description |
63
- | ------------- | :-----------: | :-----------: | :-----------: |
64
- | children | node | | allow you to pass components as data. |
65
- | steps | array | | an array which includes each step-form format data |
66
- | name | string | | the name of the step. |
67
- | title | string | | the title from each step |
68
- | fields | array | | an array of object fields which they describe each field for each step-form |
69
- | key | string | | the key value of the input field |
70
- | label | object | | an object prop which describes the label primary and the secondary name of the field |
71
- | primary | string | | the name of te field |
72
- | required | boolean | false | describes the validation of the field |
73
- | submitButton | boolean | false | if true, it creates a button to continue to the next step |
74
- | type | string | | describes the format of each field, e.x `type:'string'` is a simple input format field |
75
-
76
-
64
+ | Name | Type | Default | Description |
65
+ | ------------ | :-----: | :-----: | :------------------------------------------------------------------------------------: |
66
+ | children | node | | allow you to pass components as data. |
67
+ | steps | array | | an array which includes each step-form format data |
68
+ | name | string | | the name of the step. |
69
+ | title | string | | the title from each step |
70
+ | fields | array | | an array of object fields which they describe each field for each step-form |
71
+ | key | string | | the key value of the input field |
72
+ | label | object | | an object prop which describes the label primary and the secondary name of the field |
73
+ | primary | string | | the name of te field |
74
+ | required | boolean | false | describes the validation of the field |
75
+ | submitButton | boolean | false | if true, it creates a button to continue to the next step |
76
+ | type | string | | describes the format of each field, e.x `type:'string'` is a simple input format field |
77
77
 
78
78
  ### Field types
79
79
 
80
80
  Below are demostrated some examples for each type of field
81
81
 
82
-
83
82
  ### FormBuilder implementation
84
83
 
85
84
  The examples above are implemented by using the code below
86
85
 
87
86
  ```javascript
88
-
89
87
  import React, { useState } from 'react';
90
88
  import BasicLayout, {
91
89
  Top,
@@ -96,15 +94,14 @@ import BasicLayout, {
96
94
  import Header, { HeaderTitle } from '@digigov/ui/app/Header';
97
95
  import GovGRLogo from '@digigov/ui/govgr/GovGRLogo';
98
96
  import GovGRFooter from '@digigov/ui/govgr/Footer';
99
- import Button from '@digigov/ui/core/Button';
100
- import PageTitle, {
101
- PageTitleSection,
97
+ import Button from '@digigov/ui/form/Button';
98
+ import PageTitleContainer, {
102
99
  PageTitleCaption,
103
100
  PageTitleHeading,
104
- } from '@digigov/ui/app/PageTitle';
105
- import BackButton from '@digigov/ui/core/Button/BackButton';
101
+ } from '@digigov/ui/app/PageTitleContainer';
102
+ import BackButton from '@digigov/ui/form/Button/BackButton';
106
103
  import FormBuilder, { Fieldset, FieldsetLabel, Field } from '@digigov/form';
107
- import { useTranslation } from '@digigov/ui/app';
104
+ import { useTranslation } from '@digigov/ui/i18n';
108
105
 
109
106
  const FIELDS = [
110
107
  {
@@ -230,12 +227,10 @@ export default function Index() {
230
227
  <Content>
231
228
  <Main className={styles.main}>
232
229
  <BackButton>{t('button.back')}</BackButton>
233
- <PageTitle>
234
- <PageTitleSection>
230
+ <PageTitleContainer>
235
231
  <PageTitleCaption>Before we start</PageTitleCaption>
236
- </PageTitleSection>
237
232
  <PageTitleHeading>Submit a form</PageTitleHeading>
238
- </PageTitle>
233
+ </PageTitleContainer>
239
234
  <FormBuilder
240
235
  fields={FIELDS}
241
236
  onSubmit={setData}
@@ -258,14 +253,4 @@ export default function Index() {
258
253
  </BasicLayout>
259
254
  );
260
255
  }
261
-
262
256
  ```
263
-
264
-
265
-
266
-
267
-
268
-
269
-
270
-
271
-
@@ -2,6 +2,6 @@ import FormBuilder from '@digigov/form/FormBuilder';
2
2
  export default {
3
3
  title: 'Digigov Form/FormBuilder',
4
4
  component: FormBuilder,
5
- displayName: 'FormBuilder'
5
+ displayName: 'FormBuilder',
6
6
  };
7
7
  export * from '@digigov/form/FormBuilder/__stories__/Default';
@@ -1,12 +1,12 @@
1
1
  /* eslint-disable @typescript-eslint/no-explicit-any */
2
2
  import React, { useCallback, useRef } from 'react';
3
3
  import { useForm } from 'react-hook-form';
4
- import { yupResolver } from '@digigov/form/utils';
5
- import { useValidationSchema } from '@digigov/form/validators';
6
- import Fieldset from '@digigov/form/Fieldset';
7
4
  import Field from '@digigov/form/Field';
8
- import { FormBaseProps, FormData, FormBuilderProps } from '@digigov/form/types';
5
+ import Fieldset from '@digigov/form/Fieldset';
9
6
  import { FormContext } from '@digigov/form/FormContext';
7
+ import { FormBaseProps, FormData, FormBuilderProps } from '@digigov/form/types';
8
+ import { yupResolver } from '@digigov/form/utils';
9
+ import { useValidationSchema } from '@digigov/form/validators';
10
10
  import { Form } from '@digigov/react-core/Form';
11
11
 
12
12
  export const FormBase = React.forwardRef(function FormBase(
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import FormBuilder, { Field } from '@digigov/form';
3
- import { Button } from '@digigov/ui/core';
3
+ import { Button } from '@digigov/ui/form/Button';
4
4
 
5
5
  const initialValues = {
6
6
  'business-title': null,