@digigov/form 0.10.8 → 0.10.9

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 (138) hide show
  1. package/CHANGELOG.md +8 -1
  2. package/Form.stories.playwright.json +0 -72
  3. package/FormBuilder/FormBuilder.mdx +1 -1
  4. package/MultiplicityField/__stories__/PreviewDisplay.js +6 -6
  5. package/Questions/__stories__/Default.js +2 -2
  6. package/Questions/index.mdx +1 -1
  7. package/es/Form.stories.playwright.json +0 -72
  8. package/es/FormBuilder/FormBuilder.mdx +1 -1
  9. package/es/MultiplicityField/__stories__/PreviewDisplay.js +6 -6
  10. package/es/Questions/__stories__/Default.js +1 -1
  11. package/es/Questions/index.mdx +1 -1
  12. package/esm/Form.stories.playwright.json +0 -72
  13. package/esm/FormBuilder/FormBuilder.mdx +1 -1
  14. package/esm/MultiplicityField/__stories__/PreviewDisplay.js +6 -6
  15. package/esm/Questions/__stories__/Default.js +1 -1
  16. package/esm/Questions/index.mdx +1 -1
  17. package/esm/index.js +1 -1
  18. package/package.json +4 -4
  19. package/src/Field/FieldBase.tsx +99 -0
  20. package/src/Field/FieldBaseContainer.tsx +57 -0
  21. package/src/Field/FieldConditional.tsx +75 -0
  22. package/src/Field/index.mdx +6 -0
  23. package/src/Field/index.tsx +92 -0
  24. package/src/Field/types.tsx +102 -0
  25. package/src/Field/utils.ts +164 -0
  26. package/src/FieldArray/FieldArray.stories.js +8 -0
  27. package/src/FieldArray/FieldArray.stories.playwright.json +353 -0
  28. package/src/FieldArray/__stories__/Default.tsx +95 -0
  29. package/src/FieldArray/__stories__/WithExactLength.tsx +95 -0
  30. package/src/FieldArray/index.tsx +83 -0
  31. package/src/FieldObject/index.tsx +92 -0
  32. package/src/Fieldset/FieldsetWithContext.tsx +41 -0
  33. package/src/Fieldset/index.tsx +40 -0
  34. package/src/Fieldset/types.tsx +6 -0
  35. package/src/Form.stories.js +5 -0
  36. package/src/Form.stories.playwright.json +71 -0
  37. package/src/FormBuilder/FormBuilder.mdx +271 -0
  38. package/src/FormBuilder/FormBuilder.stories.js +7 -0
  39. package/src/FormBuilder/FormBuilder.stories.playwright.json +52 -0
  40. package/src/FormBuilder/FormBuilder.tsx +165 -0
  41. package/src/FormBuilder/__stories__/Default.tsx +23 -0
  42. package/src/FormBuilder/index.tsx +3 -0
  43. package/src/FormContext.tsx +8 -0
  44. package/src/MultiplicityField/MultiplicityField.mdx +580 -0
  45. package/src/MultiplicityField/MultiplicityField.stories.js +12 -0
  46. package/src/MultiplicityField/MultiplicityField.stories.playwright.json +1370 -0
  47. package/src/MultiplicityField/__stories__/Default.tsx +100 -0
  48. package/src/MultiplicityField/__stories__/PreviewDisplay.tsx +160 -0
  49. package/src/MultiplicityField/__stories__/WithExactLength.tsx +99 -0
  50. package/src/MultiplicityField/__stories__/WithMaxLength.tsx +102 -0
  51. package/src/MultiplicityField/__stories__/WithMinAndMaxLength.tsx +103 -0
  52. package/src/MultiplicityField/__stories__/WithMinLength.tsx +102 -0
  53. package/src/MultiplicityField/add-objects.tsx +186 -0
  54. package/src/MultiplicityField/index.tsx +166 -0
  55. package/src/Questions/Questions.stories.js +7 -0
  56. package/src/Questions/Questions.tsx +74 -0
  57. package/src/Questions/QuestionsContext.tsx +9 -0
  58. package/src/Questions/Step/ReviewStep.tsx +63 -0
  59. package/src/Questions/Step/Step.tsx +67 -0
  60. package/src/Questions/Step/StepArrayReview.tsx +68 -0
  61. package/src/Questions/Step/StepContext.tsx +21 -0
  62. package/src/Questions/Step/StepDescription.tsx +33 -0
  63. package/src/Questions/Step/StepForm.tsx +60 -0
  64. package/src/Questions/Step/StepQuote.tsx +8 -0
  65. package/src/Questions/Step/StepTitle.tsx +60 -0
  66. package/src/Questions/Step/getAddMoreFields.tsx +28 -0
  67. package/src/Questions/Step/index.ts +13 -0
  68. package/src/Questions/Step/types.tsx +32 -0
  69. package/src/Questions/__snapshots__/index.spec.tsx.snap +887 -0
  70. package/src/Questions/__stories__/Default.tsx +130 -0
  71. package/src/Questions/getNextStep.tsx +24 -0
  72. package/src/Questions/index.mdx +418 -0
  73. package/src/Questions/index.spec.tsx +72 -0
  74. package/src/Questions/index.tsx +5 -0
  75. package/src/Questions/types.tsx +25 -0
  76. package/src/__stories__/AutoCompleteField.tsx +45 -0
  77. package/src/__stories__/IntField.tsx +38 -0
  78. package/src/create-simple-form.mdx +518 -0
  79. package/src/index.mdx +44 -0
  80. package/src/index.ts +3 -0
  81. package/src/inputs/AutoComplete/index.tsx +85 -0
  82. package/src/inputs/Checkboxes/Checkboxes.stories.js +7 -0
  83. package/src/inputs/Checkboxes/Checkboxes.stories.playwright.json +69 -0
  84. package/src/inputs/Checkboxes/__stories__/Default.tsx +39 -0
  85. package/src/inputs/Checkboxes/index.mdx +0 -0
  86. package/src/inputs/Checkboxes/index.tsx +77 -0
  87. package/src/inputs/DateInput/DateInput.stories.js +7 -0
  88. package/src/inputs/DateInput/DateInput.stories.playwright.json +72 -0
  89. package/src/inputs/DateInput/__stories__/Default.tsx +41 -0
  90. package/src/inputs/DateInput/index.tsx +130 -0
  91. package/src/inputs/FileInput/FileInput.stories.js +7 -0
  92. package/src/inputs/FileInput/FileInput.stories.playwright.json +75 -0
  93. package/src/inputs/FileInput/__stories__/Default.tsx +23 -0
  94. package/src/inputs/FileInput/index.tsx +76 -0
  95. package/src/inputs/Input/Input.stories.js +14 -0
  96. package/src/inputs/Input/Input.stories.playwright.json +376 -0
  97. package/src/inputs/Input/__stories__/AFM.tsx +24 -0
  98. package/src/inputs/Input/__stories__/Boolean.tsx +26 -0
  99. package/src/inputs/Input/__stories__/Default.tsx +25 -0
  100. package/src/inputs/Input/__stories__/IBAN.tsx +26 -0
  101. package/src/inputs/Input/__stories__/Integer.tsx +25 -0
  102. package/src/inputs/Input/__stories__/MobilePhone.tsx +24 -0
  103. package/src/inputs/Input/__stories__/PhoneNumber.tsx +24 -0
  104. package/src/inputs/Input/__stories__/PostalCode.tsx +25 -0
  105. package/src/inputs/Input/index.mdx +8 -0
  106. package/src/inputs/Input/index.tsx +62 -0
  107. package/src/inputs/Label/Label.stories.js +7 -0
  108. package/src/inputs/Label/Label.stories.playwright.json +40 -0
  109. package/src/inputs/Label/__stories__/Default.tsx +28 -0
  110. package/src/inputs/Label/index.mdx +0 -0
  111. package/src/inputs/Label/index.tsx +44 -0
  112. package/src/inputs/Radio/Radio.stories.js +7 -0
  113. package/src/inputs/Radio/Radio.stories.playwright.json +57 -0
  114. package/src/inputs/Radio/__stories__/Default.tsx +42 -0
  115. package/src/inputs/Radio/index.mdx +0 -0
  116. package/src/inputs/Radio/index.tsx +57 -0
  117. package/src/inputs/Select/Select.stories.js +7 -0
  118. package/src/inputs/Select/Select.stories.playwright.json +22 -0
  119. package/src/inputs/Select/__stories__/Default.tsx +47 -0
  120. package/src/inputs/Select/index.tsx +37 -0
  121. package/src/inputs/index.ts +7 -0
  122. package/src/installation.mdx +72 -0
  123. package/src/internal.ts +34 -0
  124. package/src/registry.js +134 -0
  125. package/src/types.tsx +110 -0
  126. package/src/utils.ts +78 -0
  127. package/src/validators/index.ts +203 -0
  128. package/src/validators/types.ts +2 -0
  129. package/src/validators/utils/afm.ts +37 -0
  130. package/src/validators/utils/file.ts +25 -0
  131. package/src/validators/utils/iban.ts +119 -0
  132. package/src/validators/utils/index.ts +94 -0
  133. package/src/validators/utils/int.ts +22 -0
  134. package/src/validators/utils/number.ts +18 -0
  135. package/src/validators/utils/phone.ts +120 -0
  136. package/src/validators/utils/postal_code.ts +33 -0
  137. package/src/validators/utils/uuid4.ts +21 -0
  138. package/src/validators/validators.spec.ts +122 -0
@@ -0,0 +1,62 @@
1
+ import React from 'react';
2
+ import TextInput from '@digigov/react-core/TextInput';
3
+ import TextArea from '@digigov/react-core/TextArea';
4
+ import { UncontrolledFieldProps } from '@digigov/form/Field/types';
5
+
6
+ const TYPES_MAP = {
7
+ string: 'text',
8
+ int: 'text',
9
+ text: 'text',
10
+ date: 'date',
11
+ };
12
+
13
+ export interface InputProps extends Omit<UncontrolledFieldProps, 'extra'> {
14
+ extra?: {
15
+ fullWidth?: boolean;
16
+ multiline?: boolean;
17
+ className?: string;
18
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
19
+ rows?: any;
20
+ };
21
+ }
22
+
23
+ export const Input: React.ExoticComponent<InputProps> = React.forwardRef(
24
+ function WrappedInput({ name, type, extra, ...props }, ref: never) {
25
+ let { multiline = false, rows } = extra || {};
26
+ const { className } = extra || {};
27
+ // if enforced to multiline use true. Derive from type otherwise.
28
+ multiline = multiline === true || type === 'text';
29
+ // use explicit rows value if set. Derive from multiline otherwise.
30
+ rows = rows || (multiline ? 4 : 1);
31
+ // translate dilosi type to HTML Input type
32
+ const fieldType = TYPES_MAP[type || 'text'] || 'text';
33
+ if (multiline === true) {
34
+ return (
35
+ <TextArea
36
+ name={name}
37
+ className={className}
38
+ rows={rows}
39
+ ref={ref}
40
+ {...{
41
+ ...props,
42
+ reset: undefined,
43
+ required: undefined,
44
+ type: fieldType,
45
+ }}
46
+ />
47
+ );
48
+ } else {
49
+ return (
50
+ <TextInput
51
+ name={name}
52
+ type={fieldType}
53
+ className={className}
54
+ ref={ref}
55
+ {...{ ...props, reset: undefined, required: undefined }}
56
+ />
57
+ );
58
+ }
59
+ }
60
+ );
61
+
62
+ export default Input;
@@ -0,0 +1,7 @@
1
+ import Label from '@digigov/form/inputs/Label';
2
+ export default {
3
+ title: 'Digigov Form/inputs/Label',
4
+ component: Label,
5
+ displayName: 'Label'
6
+ };
7
+ export * from '@digigov/form/inputs/Label/__stories__/Default';
@@ -0,0 +1,40 @@
1
+ {
2
+ "version": "4",
3
+ "stories": {
4
+ "digigov-form-inputs-label--default": {
5
+ "actionSets": [
6
+ {
7
+ "actions": [
8
+ {
9
+ "name": "click",
10
+ "args": {
11
+ "selector": "html>body>div:nth-child(5)>form>button"
12
+ }
13
+ }
14
+ ],
15
+ "id": "ooEeQHqEWAfT",
16
+ "title": "Validation"
17
+ },
18
+ {
19
+ "actions": [
20
+ {
21
+ "name": "type",
22
+ "args": {
23
+ "selector": "html>body>div:nth-child(5)>form>div>label>input",
24
+ "text": "Hello"
25
+ }
26
+ },
27
+ {
28
+ "name": "click",
29
+ "args": {
30
+ "selector": "html>body>div:nth-child(5)>form>button"
31
+ }
32
+ }
33
+ ],
34
+ "id": "q4WekeUxbs0v",
35
+ "title": "add text"
36
+ }
37
+ ]
38
+ }
39
+ }
40
+ }
@@ -0,0 +1,28 @@
1
+ import React from 'react';
2
+ import FormBuilder, { Field, Label } from '@digigov/form';
3
+ import { Button } from '@digigov/ui/core';
4
+
5
+ export const Default = () => (
6
+ <FormBuilder
7
+ onSubmit={(data) => {
8
+ debugger;
9
+ console.log(data);
10
+ }}
11
+ >
12
+ <Label
13
+ label={{
14
+ primary: 'Στοιχεία επιχείρησης',
15
+ secondary: 'Συμπληρώστε τα στοιχεία',
16
+ }}
17
+ />
18
+ <Field
19
+ key="business-title"
20
+ name="business-title"
21
+ type="string"
22
+ label={{ primary: 'Όνομα επιχείρησης' }}
23
+ required
24
+ />
25
+ <Button type="submit">Συνέχεια</Button>
26
+ </FormBuilder>
27
+ );
28
+ export default Default;
File without changes
@@ -0,0 +1,44 @@
1
+ import React from 'react';
2
+ import LabelTitle from '@digigov/react-core/LabelTitle';
3
+ import Hint from '@digigov/react-core/Hint';
4
+ import { useTranslation } from '@digigov/ui/app/i18n';
5
+ import { FieldLabelProps } from '@digigov/form/types';
6
+
7
+ export interface FieldOptionProps {
8
+ label?: FieldLabelProps;
9
+ value: string;
10
+ disabled?: boolean;
11
+ selected?: () => React.FC;
12
+ }
13
+
14
+ export interface LabelProps {
15
+ primary?: string;
16
+ secondary?: string;
17
+ }
18
+
19
+ export interface LabelProps {
20
+ className?: string;
21
+ value?: string;
22
+ label?: FieldLabelProps;
23
+ }
24
+
25
+ export const Label: React.FC<LabelProps> = ({ className, label, value }) => {
26
+ const { t } = useTranslation();
27
+ if ((!label || (label && !label.primary && !label.secondary)) && !value) {
28
+ return null;
29
+ }
30
+ return (
31
+ <>
32
+ <LabelTitle className={className} size="s">
33
+ {(label && label.primary && t(label.primary)) || value}
34
+ </LabelTitle>
35
+ {label && label.secondary && <Hint>{t(label.secondary)}</Hint>}
36
+ </>
37
+ );
38
+ };
39
+
40
+ Label.defaultProps = {
41
+ label: {},
42
+ };
43
+
44
+ export default Label;
@@ -0,0 +1,7 @@
1
+ import Radio from '@digigov/form/inputs/Radio';
2
+ export default {
3
+ title: 'Digigov Form/inputs/Radio',
4
+ component: Radio,
5
+ displayName: 'Radio'
6
+ };
7
+ export * from '@digigov/form/inputs/Radio/__stories__/Default';
@@ -0,0 +1,57 @@
1
+ {
2
+ "version": "4",
3
+ "stories": {
4
+ "digigov-form-inputs-radio--default": {
5
+ "actionSets": [
6
+ {
7
+ "actions": [
8
+ {
9
+ "name": "click",
10
+ "args": {
11
+ "selector": "html>body>div:nth-child(5)>form>button"
12
+ }
13
+ }
14
+ ],
15
+ "id": "keMAaO2G4EzT",
16
+ "title": "validation error"
17
+ },
18
+ {
19
+ "actions": [
20
+ {
21
+ "name": "keyboard.press",
22
+ "args": {
23
+ "key": "Tab"
24
+ }
25
+ },
26
+ {
27
+ "name": "keyboard.press",
28
+ "args": {
29
+ "key": "ArrowDown"
30
+ }
31
+ },
32
+ {
33
+ "name": "keyboard.press",
34
+ "args": {
35
+ "key": "ArrowDown"
36
+ }
37
+ },
38
+ {
39
+ "name": "keyboard.press",
40
+ "args": {
41
+ "key": "Tab"
42
+ }
43
+ },
44
+ {
45
+ "name": "keyboard.press",
46
+ "args": {
47
+ "key": "Enter"
48
+ }
49
+ }
50
+ ],
51
+ "id": "KOjNMdAt5T_R",
52
+ "title": "select option with keyboard and submit"
53
+ }
54
+ ]
55
+ }
56
+ }
57
+ }
@@ -0,0 +1,42 @@
1
+ import React from 'react';
2
+ import FormBuilder, { Field } from '@digigov/form';
3
+ import { Button } from '@digigov/ui/core';
4
+
5
+ export const Default = () => (
6
+ <FormBuilder
7
+ onSubmit={(data) => {
8
+ debugger;
9
+ console.log(data);
10
+ }}
11
+ >
12
+ <Field
13
+ key={'string'}
14
+ name="string"
15
+ type="choice:single"
16
+ required
17
+ label={{ primary: 'Ποια ειναι η χώρα της διαμονής σας;' }}
18
+ extra={{
19
+ options: [
20
+ {
21
+ label: { primary: 'Ελλάδα' },
22
+ value: 'greece',
23
+ },
24
+ {
25
+ label: { primary: 'Κύπρος' },
26
+ value: 'cyprus',
27
+ },
28
+ {
29
+ label: { primary: 'Χώρα της Ευρωπαϊκής Ένωσης' },
30
+ value: 'eu',
31
+ },
32
+ {
33
+ label: { primary: 'Ηνωμένες Πολιτείες της Αμερικής' },
34
+ value: 'usa',
35
+ },
36
+ ],
37
+ }}
38
+ />
39
+ <Button type="submit">Συνέχεια</Button>
40
+ </FormBuilder>
41
+ );
42
+ export default Default;
File without changes
@@ -0,0 +1,57 @@
1
+ import React from 'react';
2
+ import RadioContainer from '@digigov/react-core/RadioContainer';
3
+ import RadioItem from '@digigov/react-core/RadioItem';
4
+ import { useTranslation } from '@digigov/ui/app/i18n';
5
+ import { FieldOptionProps } from '@digigov/form/inputs/Label';
6
+ import { UncontrolledFieldProps } from '@digigov/form/Field/types';
7
+ import { useWatch } from 'react-hook-form';
8
+ import Hint from '@digigov/react-core/Hint';
9
+
10
+ export interface RadioButtonsGroupProps
11
+ extends Omit<UncontrolledFieldProps, 'extra'> {
12
+ extra: {
13
+ className?: string;
14
+ options: Array<FieldOptionProps>;
15
+ dense?: boolean;
16
+ };
17
+ }
18
+
19
+ export const RadioButtonsGroup: React.FC<RadioButtonsGroupProps> = ({
20
+ name,
21
+ control,
22
+ register,
23
+ extra: { options, className },
24
+ disabled,
25
+ ...props
26
+ }) => {
27
+ const currentValue: string | undefined = useWatch({ control, name });
28
+ const { t } = useTranslation();
29
+ return (
30
+ <RadioContainer className={className} defaultValue={currentValue} id={name}>
31
+ {options.map(
32
+ ({ label, value: v, disabled: optionDisabled, selected }) => (
33
+ <div key={`${name}.${v}`}>
34
+ <RadioItem
35
+ {...register(name)}
36
+ value={v}
37
+ disabled={disabled || optionDisabled}
38
+ {...{
39
+ ...props,
40
+ reset: undefined,
41
+ required: undefined,
42
+ 'aria-describedby': undefined,
43
+ type: 'radio',
44
+ }}
45
+ >
46
+ {(label && label.primary && t(label.primary)) || v}
47
+ {label && label.secondary && <Hint>{t(label.secondary)}</Hint>}
48
+ </RadioItem>
49
+ {selected && selected()}
50
+ </div>
51
+ )
52
+ )}
53
+ </RadioContainer>
54
+ );
55
+ };
56
+
57
+ export default RadioButtonsGroup;
@@ -0,0 +1,7 @@
1
+ import Select from '@digigov/form/inputs/Select';
2
+ export default {
3
+ title: 'Digigov Form/inputs/Select',
4
+ component: Select,
5
+ displayName: 'Select'
6
+ };
7
+ export * from '@digigov/form/inputs/Select/__stories__/Default';
@@ -0,0 +1,22 @@
1
+ {
2
+ "version": "4",
3
+ "stories": {
4
+ "digigov-form-inputs-select--default": {
5
+ "actionSets": [
6
+ {
7
+ "actions": [
8
+ {
9
+ "name": "selectHtmlOption",
10
+ "args": {
11
+ "selector": "html>body>div:nth-child(5)>form>div>label>select",
12
+ "values": "greece"
13
+ }
14
+ }
15
+ ],
16
+ "id": "nGzokC6y1_5m",
17
+ "title": "select option"
18
+ }
19
+ ]
20
+ }
21
+ }
22
+ }
@@ -0,0 +1,47 @@
1
+ import React from 'react';
2
+ import FormBuilder, { Field } from '@digigov/form';
3
+ import { Button } from '@digigov/ui/core';
4
+
5
+ export const Default = () => (
6
+ <FormBuilder
7
+ onSubmit={(data) => {
8
+ debugger;
9
+ console.log(data);
10
+ }}
11
+ >
12
+ <Field
13
+ key={'string'}
14
+ name="string"
15
+ type="choice:single"
16
+ required
17
+ label={{ primary: 'Ποια ειναι η χώρα της διαμονής σας;' }}
18
+ extra={{
19
+ component: 'Select',
20
+ options: [
21
+ {
22
+ label: { primary: '' },
23
+ value: '',
24
+ },
25
+ {
26
+ label: { primary: 'Ελλάδα' },
27
+ value: 'greece',
28
+ },
29
+ {
30
+ label: { primary: 'Κύπρος' },
31
+ value: 'cyprus',
32
+ },
33
+ {
34
+ label: { primary: 'Χώρα της Ευρωπαϊκής Ένωσης' },
35
+ value: 'eu',
36
+ },
37
+ {
38
+ label: { primary: 'Ηνωμένες Πολιτείες της Αμερικής' },
39
+ value: 'usa',
40
+ },
41
+ ],
42
+ }}
43
+ />
44
+ <Button type="submit">Συνέχεια</Button>
45
+ </FormBuilder>
46
+ );
47
+ export default Default;
@@ -0,0 +1,37 @@
1
+ import React from 'react';
2
+ import SelectContainer from '@digigov/react-core/SelectContainer';
3
+ import SelectOption from '@digigov/react-core/SelectOption';
4
+ import { FieldOptionProps } from '@digigov/form/inputs/Label';
5
+ import { UncontrolledFieldProps } from '@digigov/form/Field/types';
6
+
7
+ export interface SelectProps extends Omit<UncontrolledFieldProps, 'extra'> {
8
+ extra: {
9
+ className?: string;
10
+ options: Array<FieldOptionProps>;
11
+ };
12
+ }
13
+
14
+ export const Select: React.ExoticComponent<SelectProps> = React.forwardRef(
15
+ function WrappedSelect(
16
+ { name, extra: { options, className }, disabled, ...props },
17
+ ref: never
18
+ ) {
19
+ return (
20
+ <SelectContainer
21
+ className={className}
22
+ ref={ref}
23
+ name={name}
24
+ disabled={disabled}
25
+ {...{ ...props, reset: undefined, required: undefined }}
26
+ >
27
+ {options.map(({ value, label }) => (
28
+ <SelectOption key={value} value={value}>
29
+ {label && label.primary ? label.primary : value}
30
+ </SelectOption>
31
+ ))}
32
+ </SelectContainer>
33
+ );
34
+ }
35
+ );
36
+
37
+ export default Select;
@@ -0,0 +1,7 @@
1
+ export { default as Checkboxes } from '@digigov/form/inputs/Checkboxes';
2
+ export { default as DateInput } from '@digigov/form/inputs/DateInput';
3
+ export { default as FileInput } from '@digigov/form/inputs/FileInput';
4
+ export { default as Input } from '@digigov/form/inputs/Input';
5
+ export { default as Label } from '@digigov/form/inputs/Label';
6
+ export { default as Radio } from '@digigov/form/inputs/Radio';
7
+ export { default as Select } from '@digigov/form/inputs/Select';
@@ -0,0 +1,72 @@
1
+ ---
2
+ id: Installation
3
+ title: Installing Digigov Form
4
+ sidebar_label: Installation
5
+ ---
6
+
7
+ import Tabs from '@theme/Tabs';
8
+ import TabItem from '@theme/TabItem';
9
+ import CodeBlock from '@theme/CodeBlock';
10
+ import LeadText from "@site/src/components/LeadText";
11
+
12
+ <LeadText>
13
+ This page will help you install Digigov Form depending on the framework that you
14
+ use and the application architecture.
15
+ </LeadText>
16
+
17
+ We assume that your stack uses some of the following tools.
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
22
+
23
+ ## Using create-digigov-app
24
+
25
+ We highly recommend using `create-digigov-app`. Our scaffolder was created to save development teams time and effort. This way
26
+ everything you need is already configured.
27
+
28
+ If you choose to use our scaffolder tool, make sure you follow this
29
+ [guide](/docs/building-apps) first, if you haven't already done so.
30
+
31
+ Then you just install the `@digigov/form` package from NPM.
32
+
33
+ <Tabs>
34
+ <TabItem value="npm" label="NPM" default>
35
+ <CodeBlock>
36
+ npm install @digigov/form --save
37
+ </CodeBlock>
38
+ </TabItem>
39
+ <TabItem value="yarn" label="Yarn">
40
+ <CodeBlock>
41
+ yarn add @digigov/form
42
+ </CodeBlock>
43
+ </TabItem>
44
+ </Tabs>
45
+
46
+ ## Using custom configuration
47
+
48
+ This method is not recommended and you should proceed at your own risk. For
49
+ Digigov Form to work properly, it is essential to do some configuration.
50
+
51
+ * A working React application, ideally [Nextjs](https://nextjs.org/) or [Create
52
+ React App](https://create-react-app.dev/)
53
+ * You should already have [installed and configured Digigov
54
+ CSS](https://guide.services.gov.gr/docs/installation)
55
+
56
+ If you meet these prerequisites, now it is time to install the dependencies.
57
+
58
+ Assuming that you have not used any of the Digigov libraries before, go ahead
59
+ and install `@digigov/form` and it's dependencies.
60
+
61
+ <Tabs>
62
+ <TabItem value="npm" label="NPM" default>
63
+ <CodeBlock>
64
+ npm install @digigov/form @digigov/ui @digigov/react-core --save
65
+ </CodeBlock>
66
+ </TabItem>
67
+ <TabItem value="yarn" label="Yarn">
68
+ <CodeBlock>
69
+ yarn add @digigov/form @digigov/ui @digigov/react-core
70
+ </CodeBlock>
71
+ </TabItem>
72
+ </Tabs>
@@ -0,0 +1,34 @@
1
+ export { default as Field } from '@digigov/form/Field';
2
+ export * from '@digigov/form/Field';
3
+ export { default as FieldArray } from '@digigov/form/FieldArray';
4
+ export * from '@digigov/form/FieldArray';
5
+ export { default as FieldConditional } from '@digigov/form/Field/FieldConditional';
6
+ export * from '@digigov/form/Field/FieldConditional';
7
+ export { default as Fieldset } from '@digigov/form/Fieldset';
8
+ export * from '@digigov/form/Fieldset';
9
+ export { default as FormBuilder } from '@digigov/form/FormBuilder';
10
+ export * from '@digigov/form/FormBuilder';
11
+ export { Step } from '@digigov/form/Questions/Step';
12
+ export * from '@digigov/form/Questions/Step';
13
+ export { default as Questions } from '@digigov/form/Questions';
14
+ export * from '@digigov/form/Questions';
15
+ export { default as Checkboxes } from '@digigov/form/inputs/Checkboxes';
16
+ export * from '@digigov/form/inputs/Checkboxes';
17
+ export { default as DateInput } from '@digigov/form/inputs/DateInput';
18
+ export * from '@digigov/form/inputs/DateInput';
19
+ export { default as FileInput } from '@digigov/form/inputs/FileInput';
20
+ export * from '@digigov/form/inputs/FileInput';
21
+ export { default as Input } from '@digigov/form/inputs/Input';
22
+ export * from '@digigov/form/inputs/Input';
23
+ export { default as Label } from '@digigov/form/inputs/Label';
24
+ export * from '@digigov/form/inputs/Label';
25
+ export { default as Radio } from '@digigov/form/inputs/Radio';
26
+ export * from '@digigov/form/inputs/Radio';
27
+ export { default as Select } from '@digigov/form/inputs/Select';
28
+ export * from '@digigov/form/FormContext';
29
+ export * from '@digigov/form/inputs/Select';
30
+ export * from '@digigov/form/inputs';
31
+ export * from '@digigov/form/internal';
32
+ export * from '@digigov/form/types';
33
+ export * from '@digigov/form/utils';
34
+ export * from '@digigov/form/validators';