@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.
- package/Field/FieldBase.js +2 -2
- package/Field/FieldBaseContainer.js +8 -8
- package/Field/FieldConditional.js +2 -2
- package/Field/utils.js +6 -6
- package/FieldArray/__stories__/Default.js +2 -2
- package/FieldArray/__stories__/WithExactLength.js +2 -2
- package/FieldArray/index.js +3 -3
- package/FieldObject/index.d.ts +1 -1
- package/FieldObject/index.js +5 -5
- package/Fieldset/FieldsetWithContext.js +4 -4
- package/Fieldset/index.d.ts +1 -1
- package/Fieldset/index.js +2 -2
- package/Fieldset/types.d.ts +2 -2
- package/FormBuilder/FormBuilder.js +5 -5
- package/FormBuilder/FormBuilder.mdx +29 -44
- package/FormBuilder/__stories__/Default.js +2 -2
- package/MultiplicityField/MultiplicityField.mdx +277 -267
- package/MultiplicityField/__stories__/Default.js +2 -2
- package/MultiplicityField/__stories__/PreviewDisplay.js +9 -9
- package/MultiplicityField/__stories__/WithExactLength.js +2 -2
- package/MultiplicityField/__stories__/WithMaxLength.js +2 -2
- package/MultiplicityField/__stories__/WithMinAndMaxLength.js +2 -2
- package/MultiplicityField/__stories__/WithMinLength.js +2 -2
- package/MultiplicityField/add-objects.js +6 -6
- package/MultiplicityField/index.d.ts +2 -2
- package/MultiplicityField/index.js +7 -7
- package/Questions/Questions.js +2 -2
- package/Questions/Step/ReviewStep.js +8 -8
- package/Questions/Step/Step.js +2 -2
- package/Questions/Step/StepArrayReview.js +11 -11
- package/Questions/Step/StepDescription.js +2 -2
- package/Questions/Step/StepForm.d.ts +1 -1
- package/Questions/Step/StepForm.js +6 -6
- package/Questions/Step/StepTitle.d.ts +2 -2
- package/Questions/Step/StepTitle.js +11 -5
- package/Questions/Step/getAddMoreFields.d.ts +1 -1
- package/Questions/Step/index.d.ts +4 -4
- package/Questions/Step/index.js +53 -36
- package/Questions/__snapshots__/index.spec.tsx.snap +72 -359
- package/Questions/__stories__/Default.js +7 -7
- package/Questions/index.mdx +45 -48
- package/Questions/index.spec.js +2 -2
- package/create-simple-form.mdx +258 -237
- package/es/Field/FieldBase.js +1 -1
- package/es/Field/FieldBaseContainer.js +6 -6
- package/es/Field/FieldConditional.js +1 -1
- package/es/Field/utils.js +5 -5
- package/es/FieldArray/__stories__/Default.js +1 -1
- package/es/FieldArray/__stories__/WithExactLength.js +1 -1
- package/es/FieldArray/index.js +2 -2
- package/es/FieldObject/index.js +3 -3
- package/es/Fieldset/FieldsetWithContext.js +2 -2
- package/es/Fieldset/index.js +1 -1
- package/es/FormBuilder/FormBuilder.js +3 -3
- package/es/FormBuilder/FormBuilder.mdx +29 -44
- package/es/FormBuilder/__stories__/Default.js +1 -1
- package/es/MultiplicityField/MultiplicityField.mdx +277 -267
- package/es/MultiplicityField/__stories__/Default.js +1 -1
- package/es/MultiplicityField/__stories__/PreviewDisplay.js +8 -8
- package/es/MultiplicityField/__stories__/WithExactLength.js +1 -1
- package/es/MultiplicityField/__stories__/WithMaxLength.js +1 -1
- package/es/MultiplicityField/__stories__/WithMinAndMaxLength.js +1 -1
- package/es/MultiplicityField/__stories__/WithMinLength.js +1 -1
- package/es/MultiplicityField/add-objects.js +3 -3
- package/es/MultiplicityField/index.js +5 -5
- package/es/Questions/Questions.js +1 -1
- package/es/Questions/Step/ReviewStep.js +5 -5
- package/es/Questions/Step/Step.js +1 -1
- package/es/Questions/Step/StepArrayReview.js +7 -7
- package/es/Questions/Step/StepDescription.js +1 -1
- package/es/Questions/Step/StepForm.js +5 -5
- package/es/Questions/Step/StepTitle.js +9 -5
- package/es/Questions/Step/index.js +4 -4
- package/es/Questions/__snapshots__/index.spec.tsx.snap +72 -359
- package/es/Questions/__stories__/Default.js +5 -5
- package/es/Questions/index.mdx +45 -48
- package/es/Questions/index.spec.js +1 -1
- package/es/create-simple-form.mdx +258 -237
- package/es/index.mdx +13 -6
- package/es/inputs/AutoComplete/__stories__/Default.js +3 -3
- package/es/inputs/AutoComplete/index.js +1 -1
- package/es/inputs/Checkboxes/__stories__/Conditional.js +1 -1
- package/es/inputs/Checkboxes/__stories__/Default.js +1 -1
- package/es/inputs/Checkboxes/__stories__/WithDivider.js +2 -2
- package/es/inputs/Checkboxes/index.js +3 -3
- package/es/inputs/DateInput/__stories__/Default.js +1 -19
- package/es/inputs/DateInput/index.js +1 -1
- package/es/inputs/FileInput/__stories__/Default.js +1 -1
- package/es/inputs/FileInput/index.js +6 -6
- package/es/inputs/Input/__stories__/AFM.js +1 -1
- package/es/inputs/Input/__stories__/Boolean.js +1 -1
- package/es/inputs/Input/__stories__/Default.js +1 -1
- package/es/inputs/Input/__stories__/IBAN.js +1 -1
- package/es/inputs/Input/__stories__/Integer.js +1 -1
- package/es/inputs/Input/__stories__/MobilePhone.js +1 -1
- package/es/inputs/Input/__stories__/PhoneNumber.js +1 -1
- package/es/inputs/Input/__stories__/PostalCode.js +1 -1
- package/es/inputs/Input/__stories__/TextWithCharacterLimit.js +1 -1
- package/es/inputs/Input/index.js +1 -1
- package/es/inputs/Label/__stories__/Default.js +1 -1
- package/es/inputs/Label/index.js +3 -3
- package/es/inputs/OtpInput/__stories__/Default.js +1 -1
- package/es/inputs/OtpInput/index.js +5 -5
- package/es/inputs/Radio/__stories__/Conditional.js +1 -1
- package/es/inputs/Radio/__stories__/Default.js +2 -2
- package/es/inputs/Radio/__stories__/WithDivider.js +3 -3
- package/es/inputs/Radio/index.js +4 -4
- package/es/inputs/Select/__stories__/Default.js +2 -2
- package/es/installation.mdx +12 -16
- package/es/utils.js +1 -1
- package/es/validators/index.js +2 -2
- package/esm/Field/FieldBase.js +1 -1
- package/esm/Field/FieldBaseContainer.js +6 -6
- package/esm/Field/FieldConditional.js +1 -1
- package/esm/Field/utils.js +5 -5
- package/esm/FieldArray/__stories__/Default.js +1 -1
- package/esm/FieldArray/__stories__/WithExactLength.js +1 -1
- package/esm/FieldArray/index.js +2 -2
- package/esm/FieldObject/index.js +3 -3
- package/esm/Fieldset/FieldsetWithContext.js +2 -2
- package/esm/Fieldset/index.js +1 -1
- package/esm/FormBuilder/FormBuilder.js +3 -3
- package/esm/FormBuilder/FormBuilder.mdx +29 -44
- package/esm/FormBuilder/__stories__/Default.js +1 -1
- package/esm/MultiplicityField/MultiplicityField.mdx +277 -267
- package/esm/MultiplicityField/__stories__/Default.js +1 -1
- package/esm/MultiplicityField/__stories__/PreviewDisplay.js +8 -8
- package/esm/MultiplicityField/__stories__/WithExactLength.js +1 -1
- package/esm/MultiplicityField/__stories__/WithMaxLength.js +1 -1
- package/esm/MultiplicityField/__stories__/WithMinAndMaxLength.js +1 -1
- package/esm/MultiplicityField/__stories__/WithMinLength.js +1 -1
- package/esm/MultiplicityField/add-objects.js +3 -3
- package/esm/MultiplicityField/index.js +5 -5
- package/esm/Questions/Questions.js +1 -1
- package/esm/Questions/Step/ReviewStep.js +5 -5
- package/esm/Questions/Step/Step.js +1 -1
- package/esm/Questions/Step/StepArrayReview.js +7 -7
- package/esm/Questions/Step/StepDescription.js +1 -1
- package/esm/Questions/Step/StepForm.js +5 -5
- package/esm/Questions/Step/StepTitle.js +9 -5
- package/esm/Questions/Step/index.js +4 -4
- package/esm/Questions/__snapshots__/index.spec.tsx.snap +72 -359
- package/esm/Questions/__stories__/Default.js +5 -5
- package/esm/Questions/index.mdx +45 -48
- package/esm/Questions/index.spec.js +1 -1
- package/esm/create-simple-form.mdx +258 -237
- package/esm/index.js +1 -1
- package/esm/index.mdx +13 -6
- package/esm/inputs/AutoComplete/__stories__/Default.js +3 -3
- package/esm/inputs/AutoComplete/index.js +1 -1
- package/esm/inputs/Checkboxes/__stories__/Conditional.js +1 -1
- package/esm/inputs/Checkboxes/__stories__/Default.js +1 -1
- package/esm/inputs/Checkboxes/__stories__/WithDivider.js +2 -2
- package/esm/inputs/Checkboxes/index.js +3 -3
- package/esm/inputs/DateInput/__stories__/Default.js +1 -19
- package/esm/inputs/DateInput/index.js +1 -1
- package/esm/inputs/FileInput/__stories__/Default.js +1 -1
- package/esm/inputs/FileInput/index.js +6 -6
- package/esm/inputs/Input/__stories__/AFM.js +1 -1
- package/esm/inputs/Input/__stories__/Boolean.js +1 -1
- package/esm/inputs/Input/__stories__/Default.js +1 -1
- package/esm/inputs/Input/__stories__/IBAN.js +1 -1
- package/esm/inputs/Input/__stories__/Integer.js +1 -1
- package/esm/inputs/Input/__stories__/MobilePhone.js +1 -1
- package/esm/inputs/Input/__stories__/PhoneNumber.js +1 -1
- package/esm/inputs/Input/__stories__/PostalCode.js +1 -1
- package/esm/inputs/Input/__stories__/TextWithCharacterLimit.js +1 -1
- package/esm/inputs/Input/index.js +1 -1
- package/esm/inputs/Label/__stories__/Default.js +1 -1
- package/esm/inputs/Label/index.js +3 -3
- package/esm/inputs/OtpInput/__stories__/Default.js +1 -1
- package/esm/inputs/OtpInput/index.js +5 -5
- package/esm/inputs/Radio/__stories__/Conditional.js +1 -1
- package/esm/inputs/Radio/__stories__/Default.js +2 -2
- package/esm/inputs/Radio/__stories__/WithDivider.js +3 -3
- package/esm/inputs/Radio/index.js +4 -4
- package/esm/inputs/Select/__stories__/Default.js +2 -2
- package/esm/installation.mdx +12 -16
- package/esm/utils.js +1 -1
- package/esm/validators/index.js +2 -2
- package/index.mdx +13 -6
- package/inputs/AutoComplete/__stories__/Default.js +4 -4
- package/inputs/AutoComplete/index.d.ts +2 -2
- package/inputs/AutoComplete/index.js +2 -2
- package/inputs/Checkboxes/__stories__/Conditional.js +2 -2
- package/inputs/Checkboxes/__stories__/Default.js +2 -2
- package/inputs/Checkboxes/__stories__/WithDivider.js +3 -3
- package/inputs/Checkboxes/index.d.ts +1 -1
- package/inputs/Checkboxes/index.js +4 -4
- package/inputs/DateInput/__stories__/Default.js +2 -20
- package/inputs/DateInput/index.js +2 -2
- package/inputs/FileInput/__stories__/Default.js +2 -2
- package/inputs/FileInput/index.js +6 -6
- package/inputs/Input/__stories__/AFM.js +2 -2
- package/inputs/Input/__stories__/Boolean.js +2 -2
- package/inputs/Input/__stories__/Default.js +2 -2
- package/inputs/Input/__stories__/IBAN.js +2 -2
- package/inputs/Input/__stories__/Integer.js +2 -2
- package/inputs/Input/__stories__/MobilePhone.js +2 -2
- package/inputs/Input/__stories__/PhoneNumber.js +2 -2
- package/inputs/Input/__stories__/PostalCode.js +2 -2
- package/inputs/Input/__stories__/TextWithCharacterLimit.js +2 -2
- package/inputs/Input/index.js +1 -1
- package/inputs/Label/__stories__/Default.js +2 -2
- package/inputs/Label/index.js +4 -4
- package/inputs/OtpInput/__stories__/Default.js +2 -2
- package/inputs/OtpInput/index.js +5 -5
- package/inputs/Radio/__stories__/Conditional.js +2 -2
- package/inputs/Radio/__stories__/Default.js +3 -3
- package/inputs/Radio/__stories__/WithDivider.js +4 -4
- package/inputs/Radio/index.d.ts +1 -1
- package/inputs/Radio/index.js +7 -7
- package/inputs/Select/__stories__/Default.js +3 -3
- package/inputs/Select/index.d.ts +1 -1
- package/installation.mdx +12 -16
- package/package.json +5 -5
- package/src/Field/FieldBase.tsx +1 -1
- package/src/Field/FieldBaseContainer.tsx +7 -7
- package/src/Field/FieldConditional.tsx +1 -1
- package/src/Field/index.tsx +1 -1
- package/src/Field/utils.ts +7 -7
- package/src/FieldArray/FieldArray.stories.js +1 -1
- package/src/FieldArray/__stories__/Default.tsx +1 -1
- package/src/FieldArray/__stories__/WithExactLength.tsx +1 -1
- package/src/FieldArray/index.tsx +3 -3
- package/src/FieldObject/index.tsx +6 -6
- package/src/Fieldset/FieldsetWithContext.tsx +3 -3
- package/src/Fieldset/index.tsx +5 -5
- package/src/Fieldset/types.tsx +3 -3
- package/src/FormBuilder/FormBuilder.mdx +29 -44
- package/src/FormBuilder/FormBuilder.stories.js +1 -1
- package/src/FormBuilder/FormBuilder.tsx +4 -4
- package/src/FormBuilder/__stories__/Default.tsx +1 -1
- package/src/MultiplicityField/MultiplicityField.mdx +277 -267
- package/src/MultiplicityField/MultiplicityField.stories.js +1 -1
- package/src/MultiplicityField/__stories__/Default.tsx +1 -1
- package/src/MultiplicityField/__stories__/PreviewDisplay.tsx +18 -18
- package/src/MultiplicityField/__stories__/WithExactLength.tsx +1 -1
- package/src/MultiplicityField/__stories__/WithMaxLength.tsx +1 -1
- package/src/MultiplicityField/__stories__/WithMinAndMaxLength.tsx +1 -1
- package/src/MultiplicityField/__stories__/WithMinLength.tsx +1 -1
- package/src/MultiplicityField/add-objects.tsx +3 -3
- package/src/MultiplicityField/index.tsx +9 -9
- package/src/Questions/Questions.stories.js +1 -1
- package/src/Questions/Questions.tsx +2 -2
- package/src/Questions/Step/ReviewStep.tsx +6 -6
- package/src/Questions/Step/Step.tsx +1 -1
- package/src/Questions/Step/StepArrayReview.tsx +11 -11
- package/src/Questions/Step/StepDescription.tsx +1 -1
- package/src/Questions/Step/StepForm.tsx +6 -6
- package/src/Questions/Step/StepTitle.tsx +19 -17
- package/src/Questions/Step/getAddMoreFields.tsx +1 -1
- package/src/Questions/Step/index.ts +4 -4
- package/src/Questions/__snapshots__/index.spec.tsx.snap +72 -359
- package/src/Questions/__stories__/Default.tsx +8 -8
- package/src/Questions/index.mdx +45 -48
- package/src/Questions/index.spec.tsx +1 -1
- package/src/create-simple-form.mdx +258 -237
- package/src/index.mdx +13 -6
- package/src/inputs/AutoComplete/__stories__/Default.tsx +3 -3
- package/src/inputs/AutoComplete/index.tsx +4 -4
- package/src/inputs/Checkboxes/Checkboxes.stories.js +1 -1
- package/src/inputs/Checkboxes/__stories__/Conditional.tsx +2 -2
- package/src/inputs/Checkboxes/__stories__/Default.tsx +1 -1
- package/src/inputs/Checkboxes/__stories__/WithDivider.tsx +2 -2
- package/src/inputs/Checkboxes/index.tsx +4 -4
- package/src/inputs/DateInput/DateInput.stories.js +1 -1
- package/src/inputs/DateInput/__stories__/Default.tsx +1 -17
- package/src/inputs/DateInput/index.tsx +2 -2
- package/src/inputs/FileInput/FileInput.stories.js +1 -1
- package/src/inputs/FileInput/__stories__/Default.tsx +1 -1
- package/src/inputs/FileInput/index.tsx +6 -6
- package/src/inputs/Input/__stories__/AFM.tsx +1 -1
- package/src/inputs/Input/__stories__/Boolean.tsx +1 -1
- package/src/inputs/Input/__stories__/Default.tsx +1 -1
- package/src/inputs/Input/__stories__/IBAN.tsx +1 -1
- package/src/inputs/Input/__stories__/Integer.tsx +1 -1
- package/src/inputs/Input/__stories__/MobilePhone.tsx +1 -1
- package/src/inputs/Input/__stories__/PhoneNumber.tsx +1 -1
- package/src/inputs/Input/__stories__/PostalCode.tsx +1 -1
- package/src/inputs/Input/__stories__/TextWithCharacterLimit.tsx +1 -1
- package/src/inputs/Input/index.tsx +3 -3
- package/src/inputs/Label/Label.stories.js +1 -1
- package/src/inputs/Label/__stories__/Default.tsx +1 -1
- package/src/inputs/Label/index.tsx +4 -4
- package/src/inputs/OtpInput/__stories__/Default.tsx +1 -1
- package/src/inputs/OtpInput/index.tsx +14 -10
- package/src/inputs/Radio/Radio.stories.js +1 -2
- package/src/inputs/Radio/__stories__/Conditional.tsx +3 -3
- package/src/inputs/Radio/__stories__/Default.tsx +2 -2
- package/src/inputs/Radio/__stories__/WithDivider.tsx +3 -3
- package/src/inputs/Radio/index.tsx +6 -6
- package/src/inputs/Select/Select.stories.js +1 -1
- package/src/inputs/Select/__stories__/Default.tsx +2 -2
- package/src/inputs/Select/index.tsx +2 -2
- package/src/installation.mdx +12 -16
- package/src/types.tsx +4 -2
- package/src/utils.ts +1 -1
- package/src/validators/index.ts +10 -10
- package/src/validators/utils/file.ts +1 -1
- package/src/validators/utils/phone.ts +1 -1
- package/src/validators/utils/postal_code.ts +1 -1
- package/types.d.ts +4 -2
- package/validators/index.d.ts +3 -3
- package/validators/index.js +4 -4
- package/validators/utils/file.d.ts +1 -1
- package/validators/utils/phone.d.ts +1 -1
- package/validators/utils/postal_code.d.ts +1 -1
package/src/index.mdx
CHANGED
|
@@ -4,12 +4,19 @@ title: Digigov Form
|
|
|
4
4
|
sidebar_label: Introduction to Digigov Form
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
import LeadText from
|
|
7
|
+
import LeadText from '@site/src/components/LeadText';
|
|
8
8
|
|
|
9
|
-
<LeadText>
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
<LeadText>
|
|
10
|
+
Digigov Form is an off-the-shelf solution for managing web forms using
|
|
11
|
+
Reactjs. It supports flexible and multi-step forms and easy-to-use validation.
|
|
12
|
+
This page will guide you through everything you need to create accessible and
|
|
13
|
+
dynamic forms that can handle all sorts of user inputs.
|
|
14
|
+
</LeadText>
|
|
15
|
+
|
|
16
|
+
<img
|
|
17
|
+
src="/img/form.svg"
|
|
18
|
+
style={{ margin: '3rem 0', maxWidth: '450px', width: '60%' }}
|
|
19
|
+
/>
|
|
13
20
|
|
|
14
21
|
## Before we start
|
|
15
22
|
|
|
@@ -22,7 +29,7 @@ Finally, we also offer an easy way to spread your forms across multiple pages or
|
|
|
22
29
|
steps and still be able to gather data in a single serialized object that you
|
|
23
30
|
will be able to save via an JSON API.
|
|
24
31
|
|
|
25
|
-
## Overview
|
|
32
|
+
## Overview
|
|
26
33
|
|
|
27
34
|
The `@digigov/form` NPM package contains React components and validators. The
|
|
28
35
|
library uses basic, semantically correct HTML5 input fields.
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React, { Suspense } from 'react';
|
|
2
|
-
import FormBuilder from '@digigov/form/FormBuilder';
|
|
3
2
|
import { Field } from '@digigov/form/Field';
|
|
3
|
+
import FormBuilder from '@digigov/form/FormBuilder';
|
|
4
4
|
import { FieldSpec } from '@digigov/form/types';
|
|
5
|
-
import
|
|
6
|
-
import
|
|
5
|
+
import { results } from '@digigov/ui/form/AutoComplete/utils';
|
|
6
|
+
import Button from '@digigov/ui/form/Button';
|
|
7
7
|
const fields: FieldSpec[] = [
|
|
8
8
|
{
|
|
9
9
|
key: 'autocomplete',
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React, { useCallback } from 'react';
|
|
2
|
-
import UIAutoComplete, {
|
|
3
|
-
AutoCompleteProps as UIAutoCompleteProps,
|
|
4
|
-
} from '@digigov/ui/admin/AutoComplete';
|
|
5
|
-
import { FieldOptionProps } from '@digigov/form/inputs/Label';
|
|
6
2
|
import { ControlledFieldProps } from '@digigov/form/Field/types';
|
|
3
|
+
import { FieldOptionProps } from '@digigov/form/inputs/Label';
|
|
7
4
|
import { Hint } from '@digigov/react-core';
|
|
5
|
+
import UIAutoComplete, {
|
|
6
|
+
AutoCompleteProps as UIAutoCompleteProps,
|
|
7
|
+
} from '@digigov/ui/form/AutoComplete';
|
|
8
8
|
|
|
9
9
|
export interface AutoCompleteExtra
|
|
10
10
|
extends Omit<
|
|
@@ -2,7 +2,7 @@ import Checkboxes from '@digigov/form/inputs/Checkboxes';
|
|
|
2
2
|
export default {
|
|
3
3
|
title: 'Digigov Form/inputs/Checkboxes',
|
|
4
4
|
component: Checkboxes,
|
|
5
|
-
displayName: 'Checkboxes'
|
|
5
|
+
displayName: 'Checkboxes',
|
|
6
6
|
};
|
|
7
7
|
export * from '@digigov/form/inputs/Checkboxes/__stories__/Default';
|
|
8
8
|
export * from '@digigov/form/inputs/Checkboxes/__stories__/WithDivider';
|
|
@@ -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/
|
|
3
|
+
import { Button } from '@digigov/ui/form/Button';
|
|
4
4
|
|
|
5
5
|
const fields: FieldSpec[] = [
|
|
6
6
|
{
|
|
@@ -60,7 +60,7 @@ const fields: FieldSpec[] = [
|
|
|
60
60
|
{
|
|
61
61
|
key: 'auth_form',
|
|
62
62
|
type: 'choice:multiple',
|
|
63
|
-
required:true,
|
|
63
|
+
required: true,
|
|
64
64
|
label: {
|
|
65
65
|
primary: 'Επιλέξτε μέθοδο πιστοποίησης',
|
|
66
66
|
secondary:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import FormBuilder, { Field } from '@digigov/form';
|
|
3
|
-
import { Button } from '@digigov/ui/
|
|
3
|
+
import { Button } from '@digigov/ui/form/Button';
|
|
4
4
|
|
|
5
5
|
export const WithDivider = () => (
|
|
6
6
|
<FormBuilder
|
|
@@ -27,7 +27,7 @@ export const WithDivider = () => (
|
|
|
27
27
|
{
|
|
28
28
|
label: { primary: 'Αισθάνομαι κούραση' },
|
|
29
29
|
value: 'fatigue',
|
|
30
|
-
|
|
30
|
+
dividerText: 'ή',
|
|
31
31
|
},
|
|
32
32
|
],
|
|
33
33
|
}}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { Field } from '@digigov/form';
|
|
3
3
|
import { ControlledFieldProps } from '@digigov/form/Field/types';
|
|
4
|
-
import {
|
|
4
|
+
import { FieldOptionProps } from '@digigov/form/inputs/Label';
|
|
5
|
+
import { CheckboxConditional } from '@digigov/react-core';
|
|
5
6
|
import CoreCheckboxes from '@digigov/react-core/Checkbox';
|
|
6
7
|
import CheckboxItem from '@digigov/react-core/CheckboxItem';
|
|
7
8
|
import Hint from '@digigov/react-core/Hint';
|
|
8
|
-
import {
|
|
9
|
-
import { CheckboxConditional } from '@digigov/react-core';
|
|
9
|
+
import { useTranslation } from '@digigov/ui/i18n';
|
|
10
10
|
|
|
11
11
|
export interface CheckboxesProps
|
|
12
12
|
extends Omit<ControlledFieldProps, 'extra' | 'value'> {
|
|
@@ -2,6 +2,6 @@ import DateInput from '@digigov/form/inputs/DateInput';
|
|
|
2
2
|
export default {
|
|
3
3
|
title: 'Digigov Form/inputs/DateInput',
|
|
4
4
|
component: DateInput,
|
|
5
|
-
displayName: 'DateInput'
|
|
5
|
+
displayName: 'DateInput',
|
|
6
6
|
};
|
|
7
7
|
export * from '@digigov/form/inputs/DateInput/__stories__/Default';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import FormBuilder, { Field } from '@digigov/form';
|
|
3
|
-
import { Button } from '@digigov/ui/
|
|
3
|
+
import { Button } from '@digigov/ui/form/Button';
|
|
4
4
|
|
|
5
5
|
export const Default = () => (
|
|
6
6
|
<FormBuilder
|
|
@@ -17,22 +17,6 @@ export const Default = () => (
|
|
|
17
17
|
primary: 'Πότε εκδόθηκε το διαβατήριο σας;',
|
|
18
18
|
secondary: 'Για παράδειγμα, 05 11 2020',
|
|
19
19
|
}}
|
|
20
|
-
extra={{
|
|
21
|
-
options: [
|
|
22
|
-
{
|
|
23
|
-
label: { primary: 'Έχω συνάχι' },
|
|
24
|
-
value: 'runny-nose',
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
label: { primary: 'Έχω πυρετό' },
|
|
28
|
-
value: 'fever',
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
label: { primary: 'Αισθάνομαι κούραση' },
|
|
32
|
-
value: 'fatigue',
|
|
33
|
-
},
|
|
34
|
-
],
|
|
35
|
-
}}
|
|
36
20
|
/>
|
|
37
21
|
<Button type="submit">Συνέχεια</Button>
|
|
38
22
|
</FormBuilder>
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React, { useMemo, useState } from 'react';
|
|
2
|
-
import { UncontrolledFieldProps } from '@digigov/form/Field/types';
|
|
3
2
|
import dayjs from 'dayjs';
|
|
4
3
|
import customParseFormat from 'dayjs/plugin/customParseFormat';
|
|
5
|
-
import {
|
|
4
|
+
import { UncontrolledFieldProps } from '@digigov/form/Field/types';
|
|
6
5
|
import DateInputContainer from '@digigov/react-core/DateInputContainer';
|
|
7
6
|
import CoreDateInputItem from '@digigov/react-core/DateInputItem';
|
|
7
|
+
import { useTranslation } from '@digigov/ui/i18n';
|
|
8
8
|
dayjs.extend(customParseFormat);
|
|
9
9
|
|
|
10
10
|
export interface DateInputProps extends Omit<UncontrolledFieldProps, 'extra'> {
|
|
@@ -2,6 +2,6 @@ import FileInput from '@digigov/form/inputs/FileInput';
|
|
|
2
2
|
export default {
|
|
3
3
|
title: 'Digigov Form/inputs/FileInput',
|
|
4
4
|
component: FileInput,
|
|
5
|
-
displayName: 'FileInput'
|
|
5
|
+
displayName: 'FileInput',
|
|
6
6
|
};
|
|
7
7
|
export * from '@digigov/form/inputs/FileInput/__stories__/Default';
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
2
|
import { UncontrolledFieldProps } from '@digigov/form/Field/types';
|
|
3
|
-
import { useTranslation } from '@digigov/ui/app/i18n';
|
|
4
|
-
import Paragraph from '@digigov/ui/typography/Paragraph';
|
|
5
|
-
import CoreHint from '@digigov/react-core/Hint';
|
|
6
|
-
import Button from '@digigov/ui/core/Button';
|
|
7
|
-
import FileUploadContainer from '@digigov/react-core/FileUploadContainer';
|
|
8
3
|
import FileUpload from '@digigov/react-core/FileUpload';
|
|
4
|
+
import FileUploadContainer from '@digigov/react-core/FileUploadContainer';
|
|
5
|
+
import CoreHint from '@digigov/react-core/Hint';
|
|
6
|
+
import Button from '@digigov/ui/form/Button';
|
|
7
|
+
import { useTranslation } from '@digigov/ui/i18n';
|
|
8
|
+
import Paragraph from '@digigov/ui/typography/Paragraph';
|
|
9
9
|
export interface FileInputProps extends Omit<UncontrolledFieldProps, 'extra'> {
|
|
10
10
|
extra?: {
|
|
11
11
|
className?: string;
|
|
@@ -34,7 +34,7 @@ export const FileInput: React.FC<any> = React.forwardRef(function FileInput(
|
|
|
34
34
|
};
|
|
35
35
|
return (
|
|
36
36
|
<>
|
|
37
|
-
<FileUploadContainer
|
|
37
|
+
<FileUploadContainer hasFiles={files && files.length > 0}>
|
|
38
38
|
{files?.length ? (
|
|
39
39
|
<>
|
|
40
40
|
<Paragraph>
|
|
@@ -4,7 +4,7 @@ import TextArea from '@digigov/react-core/TextArea';
|
|
|
4
4
|
import { Hint } from '@digigov/react-core';
|
|
5
5
|
import { UncontrolledFieldProps } from '@digigov/form/Field/types';
|
|
6
6
|
import { useWatch } from 'react-hook-form';
|
|
7
|
-
import { useTranslation } from '@digigov/ui/
|
|
7
|
+
import { useTranslation } from '@digigov/ui/i18n';
|
|
8
8
|
|
|
9
9
|
const TYPES_MAP = {
|
|
10
10
|
string: 'text',
|
|
@@ -58,8 +58,8 @@ export const Input: React.ExoticComponent<InputProps> = React.forwardRef(
|
|
|
58
58
|
{limit?.max && (
|
|
59
59
|
<Hint>
|
|
60
60
|
{currentValue === undefined ||
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
(currentValue?.length >= 0 &&
|
|
62
|
+
currentValue?.length <= limit?.max) ? (
|
|
63
63
|
<span>
|
|
64
64
|
{t('form.info.text.you_have')}{' '}
|
|
65
65
|
<b>
|
|
@@ -1,8 +1,8 @@
|
|
|
1
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
2
|
import { FieldLabelProps } from '@digigov/form/types';
|
|
3
|
+
import Hint from '@digigov/react-core/Hint';
|
|
4
|
+
import LabelTitle from '@digigov/react-core/LabelTitle';
|
|
5
|
+
import { useTranslation } from '@digigov/ui/i18n';
|
|
6
6
|
|
|
7
7
|
export interface FieldOptionProps {
|
|
8
8
|
label?: FieldLabelProps;
|
|
@@ -31,7 +31,7 @@ export const Label: React.FC<LabelProps> = ({ className, label, value }) => {
|
|
|
31
31
|
}
|
|
32
32
|
return (
|
|
33
33
|
<>
|
|
34
|
-
<LabelTitle className={className} size="
|
|
34
|
+
<LabelTitle className={className} size="sm">
|
|
35
35
|
{(label && label.primary && t(label.primary)) || value}
|
|
36
36
|
</LabelTitle>
|
|
37
37
|
{label && label.secondary && <Hint>{t(label.secondary)}</Hint>}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import FormBuilder, { Field, Fieldset } from '@digigov/form';
|
|
3
|
-
import { Button } from '@digigov/ui/core';
|
|
4
3
|
import { FieldSpec } from '@digigov/form/types';
|
|
4
|
+
import { Button } from '@digigov/ui/form/Button';
|
|
5
5
|
const FIELDS: FieldSpec[] = [
|
|
6
6
|
{
|
|
7
7
|
key: 'otp',
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useState, useCallback } from 'react';
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
} from '@digigov/ui/
|
|
2
|
+
import SingleCharacterInputs, {
|
|
3
|
+
SingleCharacterInput,
|
|
4
|
+
} from '@digigov/ui/form/SingleCharacterInputs';
|
|
5
5
|
|
|
6
6
|
export const RE_DIGIT = new RegExp(/^\d+$/);
|
|
7
7
|
export const REMOVE_SPACES = new RegExp(/\s+/g);
|
|
@@ -83,7 +83,7 @@ function useOtp(onChange, maxLength) {
|
|
|
83
83
|
const handleOtpChange = useCallback(
|
|
84
84
|
(e: React.ChangeEvent<HTMLInputElement>, idx: number) => {
|
|
85
85
|
const target = e.target;
|
|
86
|
-
|
|
86
|
+
const targetValue = target.value;
|
|
87
87
|
const isTargetValueDigit = RE_DIGIT.test(targetValue);
|
|
88
88
|
// We want to pass the empty string when the value is deleted
|
|
89
89
|
// emptry string replaces the deleted value
|
|
@@ -119,16 +119,16 @@ function useOtp(onChange, maxLength) {
|
|
|
119
119
|
};
|
|
120
120
|
}
|
|
121
121
|
|
|
122
|
-
const
|
|
123
|
-
return <
|
|
122
|
+
const SingleCharacterInputPart = ({ ...props }) => {
|
|
123
|
+
return <SingleCharacterInput {...props} />;
|
|
124
124
|
};
|
|
125
125
|
|
|
126
126
|
export const OtpInput = function OtpInput({ name, maxLength = 6, ...props }) {
|
|
127
127
|
const otp = useOtp(props.onChange, maxLength);
|
|
128
128
|
return (
|
|
129
|
-
<
|
|
129
|
+
<SingleCharacterInputs>
|
|
130
130
|
{otp.otpValues.map((digit, idx) => (
|
|
131
|
-
<
|
|
131
|
+
<SingleCharacterInputPart
|
|
132
132
|
name={`${name}-${idx}`}
|
|
133
133
|
type="text"
|
|
134
134
|
key={idx}
|
|
@@ -139,14 +139,18 @@ export const OtpInput = function OtpInput({ name, maxLength = 6, ...props }) {
|
|
|
139
139
|
disabled={props.disabled}
|
|
140
140
|
aria-required={props['aria-required']}
|
|
141
141
|
onChange={(e) => otp.handleOtpChange(e, idx)}
|
|
142
|
-
onInput={(e) => {
|
|
142
|
+
onInput={(e) => {
|
|
143
|
+
if (e.target.value === digit) {
|
|
144
|
+
otp.handleOtpChange(e, idx);
|
|
145
|
+
}
|
|
146
|
+
}}
|
|
143
147
|
onKeyDown={(e) => otp.handleKeyDown(e, idx)}
|
|
144
148
|
onFocus={otp.handleFocus}
|
|
145
149
|
onPaste={otp.handlePaste}
|
|
146
150
|
error={!digit ? props.error : false}
|
|
147
151
|
/>
|
|
148
152
|
))}
|
|
149
|
-
</
|
|
153
|
+
</SingleCharacterInputs>
|
|
150
154
|
);
|
|
151
155
|
};
|
|
152
156
|
|
|
@@ -2,9 +2,8 @@ import Radio from '@digigov/form/inputs/Radio';
|
|
|
2
2
|
export default {
|
|
3
3
|
title: 'Digigov Form/inputs/Radio',
|
|
4
4
|
component: Radio,
|
|
5
|
-
displayName: 'Radio'
|
|
5
|
+
displayName: 'Radio',
|
|
6
6
|
};
|
|
7
7
|
export * from '@digigov/form/inputs/Radio/__stories__/Default';
|
|
8
8
|
export * from '@digigov/form/inputs/Radio/__stories__/WithDivider';
|
|
9
9
|
export * from '@digigov/form/inputs/Radio/__stories__/Conditional';
|
|
10
|
-
|
|
@@ -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/
|
|
3
|
+
import { Button } from '@digigov/ui/form/Button';
|
|
4
4
|
|
|
5
5
|
const fields: FieldSpec[] = [
|
|
6
6
|
{
|
|
@@ -57,7 +57,7 @@ const fields: FieldSpec[] = [
|
|
|
57
57
|
{
|
|
58
58
|
key: 'auth_form',
|
|
59
59
|
type: 'choice:single',
|
|
60
|
-
required:true,
|
|
60
|
+
required: true,
|
|
61
61
|
label: {
|
|
62
62
|
primary: 'Επιλέξτε μέθοδο πιστοποίησης',
|
|
63
63
|
secondary:
|
|
@@ -94,4 +94,4 @@ export const Conditional = () => (
|
|
|
94
94
|
<Field key="auth_form" name="auth_form" />
|
|
95
95
|
<Button type="submit">Συνέχεια</Button>
|
|
96
96
|
</FormBuilder>
|
|
97
|
-
);
|
|
97
|
+
);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import FormBuilder, { Field } from '@digigov/form';
|
|
3
|
-
import { Button } from '@digigov/ui/
|
|
3
|
+
import { Button } from '@digigov/ui/form/Button';
|
|
4
4
|
|
|
5
5
|
export const Default = () => (
|
|
6
6
|
<FormBuilder
|
|
@@ -13,7 +13,7 @@ export const Default = () => (
|
|
|
13
13
|
name="string"
|
|
14
14
|
type="choice:single"
|
|
15
15
|
required
|
|
16
|
-
label={{ primary: '
|
|
16
|
+
label={{ primary: 'Ποιά είναι η χώρα της διαμονής σας;' }}
|
|
17
17
|
extra={{
|
|
18
18
|
options: [
|
|
19
19
|
{
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import FormBuilder, { Field } from '@digigov/form';
|
|
3
|
-
import { Button } from '@digigov/ui/
|
|
3
|
+
import { Button } from '@digigov/ui/form/Button';
|
|
4
4
|
|
|
5
5
|
export const WithDivider = () => (
|
|
6
6
|
<FormBuilder
|
|
@@ -13,7 +13,7 @@ export const WithDivider = () => (
|
|
|
13
13
|
name="string"
|
|
14
14
|
type="choice:single"
|
|
15
15
|
required
|
|
16
|
-
label={{ primary: '
|
|
16
|
+
label={{ primary: 'Ποιά είναι η χώρα της διαμονής σας;' }}
|
|
17
17
|
extra={{
|
|
18
18
|
options: [
|
|
19
19
|
{
|
|
@@ -31,7 +31,7 @@ export const WithDivider = () => (
|
|
|
31
31
|
{
|
|
32
32
|
label: { primary: 'Ηνωμένες Πολιτείες της Αμερικής' },
|
|
33
33
|
value: 'usa',
|
|
34
|
-
|
|
34
|
+
dividerText: 'ή',
|
|
35
35
|
},
|
|
36
36
|
],
|
|
37
37
|
}}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
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
2
|
import { useWatch } from 'react-hook-form';
|
|
8
|
-
import Hint from '@digigov/react-core/Hint';
|
|
9
3
|
import { Field } from '@digigov/form';
|
|
4
|
+
import { UncontrolledFieldProps } from '@digigov/form/Field/types';
|
|
5
|
+
import { FieldOptionProps } from '@digigov/form/inputs/Label';
|
|
10
6
|
import { RadioConditional } from '@digigov/react-core';
|
|
7
|
+
import Hint from '@digigov/react-core/Hint';
|
|
8
|
+
import RadioContainer from '@digigov/react-core/RadioContainer';
|
|
9
|
+
import RadioItem from '@digigov/react-core/RadioItem';
|
|
10
|
+
import { useTranslation } from '@digigov/ui/i18n';
|
|
11
11
|
|
|
12
12
|
export interface RadioButtonsGroupProps
|
|
13
13
|
extends Omit<UncontrolledFieldProps, 'extra'> {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import FormBuilder, { Field } from '@digigov/form';
|
|
3
|
-
import { Button } from '@digigov/ui/
|
|
3
|
+
import { Button } from '@digigov/ui/form/Button';
|
|
4
4
|
|
|
5
5
|
export const Default = () => (
|
|
6
6
|
<FormBuilder
|
|
@@ -13,7 +13,7 @@ export const Default = () => (
|
|
|
13
13
|
name="string"
|
|
14
14
|
type="choice:single"
|
|
15
15
|
required
|
|
16
|
-
label={{ primary: '
|
|
16
|
+
label={{ primary: 'Ποιά είναι η χώρα της διαμονής σας;' }}
|
|
17
17
|
extra={{
|
|
18
18
|
component: 'Select',
|
|
19
19
|
options: [
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { UncontrolledFieldProps } from '@digigov/form/Field/types';
|
|
3
|
+
import { FieldOptionProps } from '@digigov/form/inputs/Label';
|
|
2
4
|
import SelectContainer from '@digigov/react-core/SelectContainer';
|
|
3
5
|
import SelectOption from '@digigov/react-core/SelectOption';
|
|
4
|
-
import { FieldOptionProps } from '@digigov/form/inputs/Label';
|
|
5
|
-
import { UncontrolledFieldProps } from '@digigov/form/Field/types';
|
|
6
6
|
|
|
7
7
|
export interface SelectProps extends Omit<UncontrolledFieldProps, 'extra'> {
|
|
8
8
|
extra: {
|