@digigov/form 0.13.2 → 1.0.0-rc
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 +25 -37
- 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 +8 -8
- 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 +10 -10
- 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.js +2 -2
- package/Questions/Step/getAddMoreFields.d.ts +1 -1
- package/Questions/__snapshots__/index.spec.tsx.snap +5 -5
- package/Questions/__stories__/Default.js +6 -6
- package/Questions/index.mdx +41 -44
- 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 +25 -37
- 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 +7 -7
- 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 +6 -6
- package/es/Questions/Step/StepDescription.js +1 -1
- package/es/Questions/Step/StepForm.js +5 -5
- package/es/Questions/Step/StepTitle.js +2 -2
- package/es/Questions/__snapshots__/index.spec.tsx.snap +5 -5
- package/es/Questions/__stories__/Default.js +4 -4
- package/es/Questions/index.mdx +41 -44
- 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 +1 -1
- package/es/inputs/Checkboxes/index.js +3 -3
- package/es/inputs/DateInput/__stories__/Default.js +1 -1
- package/es/inputs/DateInput/index.js +1 -1
- package/es/inputs/FileInput/__stories__/Default.js +1 -1
- package/es/inputs/FileInput/index.js +5 -5
- 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 +1 -1
- package/es/inputs/Radio/__stories__/Conditional.js +1 -1
- package/es/inputs/Radio/__stories__/Default.js +1 -1
- package/es/inputs/Radio/__stories__/WithDivider.js +1 -1
- package/es/inputs/Radio/index.js +4 -4
- package/es/inputs/Select/__stories__/Default.js +1 -1
- 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 +25 -37
- 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 +7 -7
- 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 +6 -6
- package/esm/Questions/Step/StepDescription.js +1 -1
- package/esm/Questions/Step/StepForm.js +5 -5
- package/esm/Questions/Step/StepTitle.js +2 -2
- package/esm/Questions/__snapshots__/index.spec.tsx.snap +5 -5
- package/esm/Questions/__stories__/Default.js +4 -4
- package/esm/Questions/index.mdx +41 -44
- 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 +1 -1
- package/esm/inputs/Checkboxes/index.js +3 -3
- package/esm/inputs/DateInput/__stories__/Default.js +1 -1
- package/esm/inputs/DateInput/index.js +1 -1
- package/esm/inputs/FileInput/__stories__/Default.js +1 -1
- package/esm/inputs/FileInput/index.js +5 -5
- 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 +1 -1
- package/esm/inputs/Radio/__stories__/Conditional.js +1 -1
- package/esm/inputs/Radio/__stories__/Default.js +1 -1
- package/esm/inputs/Radio/__stories__/WithDivider.js +1 -1
- package/esm/inputs/Radio/index.js +4 -4
- package/esm/inputs/Select/__stories__/Default.js +1 -1
- 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 +2 -2
- package/inputs/Checkboxes/index.d.ts +1 -1
- package/inputs/Checkboxes/index.js +4 -4
- package/inputs/DateInput/__stories__/Default.js +2 -2
- package/inputs/DateInput/index.js +2 -2
- package/inputs/FileInput/__stories__/Default.js +2 -2
- package/inputs/FileInput/index.js +5 -5
- 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 +1 -1
- package/inputs/Radio/__stories__/Conditional.js +2 -2
- package/inputs/Radio/__stories__/Default.js +2 -2
- package/inputs/Radio/__stories__/WithDivider.js +2 -2
- package/inputs/Radio/index.d.ts +1 -1
- package/inputs/Radio/index.js +7 -7
- package/inputs/Select/__stories__/Default.js +2 -2
- 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 +25 -37
- 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 +14 -14
- 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 +9 -9
- package/src/Questions/Step/StepDescription.tsx +1 -1
- package/src/Questions/Step/StepForm.tsx +6 -6
- package/src/Questions/Step/StepTitle.tsx +8 -3
- package/src/Questions/Step/getAddMoreFields.tsx +1 -1
- package/src/Questions/__snapshots__/index.spec.tsx.snap +5 -5
- package/src/Questions/__stories__/Default.tsx +4 -4
- package/src/Questions/index.mdx +41 -44
- 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 -1
- 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 +5 -5
- 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 +7 -3
- 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 +1 -1
- package/src/inputs/Radio/__stories__/WithDivider.tsx +2 -2
- package/src/inputs/Radio/index.tsx +6 -6
- package/src/inputs/Select/Select.stories.js +1 -1
- package/src/inputs/Select/__stories__/Default.tsx +1 -1
- 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
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import React from 'react';
|
|
3
|
+
import Label from '@digigov/form/inputs/Label';
|
|
4
|
+
import ErrorMessage from '@digigov/react-core/ErrorMessage';
|
|
3
5
|
import FieldContainer from '@digigov/react-core/FieldContainer';
|
|
4
|
-
import LabelContainer from '@digigov/react-core/LabelContainer';
|
|
5
6
|
import CoreFieldset from '@digigov/react-core/Fieldset';
|
|
6
|
-
import Hint from '@digigov/react-core/Hint';
|
|
7
7
|
import FieldsetLegend from '@digigov/react-core/FieldsetLegend';
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
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
|
export var FieldBaseContainer = function FieldBaseContainer(_ref) {
|
|
12
12
|
var name = _ref.name,
|
|
13
13
|
wrapper = _ref.wrapper,
|
|
@@ -26,7 +26,7 @@ export var FieldBaseContainer = function FieldBaseContainer(_ref) {
|
|
|
26
26
|
return /*#__PURE__*/React.createElement(FieldContainer, _extends({
|
|
27
27
|
error: !!error
|
|
28
28
|
}, layout), /*#__PURE__*/React.createElement(CoreFieldset, null, /*#__PURE__*/React.createElement(FieldsetLegend, {
|
|
29
|
-
size: "
|
|
29
|
+
size: "sm"
|
|
30
30
|
}, label && label.primary), label && label.secondary && /*#__PURE__*/React.createElement(Hint, null, t(label.secondary)), error && /*#__PURE__*/React.createElement(ErrorMessage, {
|
|
31
31
|
id: "".concat(name, "-error")
|
|
32
32
|
}, t(errorMessage, errorContext)), children));
|
|
@@ -2,8 +2,8 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
2
2
|
import _extends from "@babel/runtime/helpers/extends";
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { useWatch } from 'react-hook-form';
|
|
5
|
-
import { evaluateFieldWithConditions } from '@digigov/form/Field/utils';
|
|
6
5
|
import { FieldBase } from '@digigov/form/Field/FieldBase';
|
|
6
|
+
import { evaluateFieldWithConditions } from '@digigov/form/Field/utils';
|
|
7
7
|
var ChildFieldMemo = /*#__PURE__*/React.memo(function ChildField(_ref) {
|
|
8
8
|
var dependencies = _ref.dependencies,
|
|
9
9
|
field = _ref.field,
|
package/es/Field/utils.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import { lazy, useContext, useMemo } from 'react';
|
|
3
|
-
import
|
|
3
|
+
import { FormContext } from '@digigov/form/FormContext';
|
|
4
4
|
import Checkboxes from '@digigov/form/inputs/Checkboxes';
|
|
5
|
-
import Radio from '@digigov/form/inputs/Radio';
|
|
6
|
-
import Select from '@digigov/form/inputs/Select';
|
|
7
|
-
import FileInput from '@digigov/form/inputs/FileInput';
|
|
8
5
|
import DateInput from '@digigov/form/inputs/DateInput';
|
|
6
|
+
import FileInput from '@digigov/form/inputs/FileInput';
|
|
7
|
+
import Input from '@digigov/form/inputs/Input';
|
|
9
8
|
import OtpInput from '@digigov/form/inputs/OtpInput';
|
|
10
|
-
import
|
|
9
|
+
import Radio from '@digigov/form/inputs/Radio';
|
|
10
|
+
import Select from '@digigov/form/inputs/Select';
|
|
11
11
|
var AutoComplete = /*#__PURE__*/lazy(function () {
|
|
12
12
|
return import('@digigov/form/inputs/AutoComplete');
|
|
13
13
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import FormBuilder, { Field } from '@digigov/form';
|
|
4
|
-
import { Button } from '@digigov/ui/
|
|
4
|
+
import { Button } from '@digigov/ui/form/Button';
|
|
5
5
|
var fields = [{
|
|
6
6
|
key: 'string',
|
|
7
7
|
type: 'string',
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import FormBuilder, { Field } from '@digigov/form';
|
|
4
|
-
import { Button } from '@digigov/ui/
|
|
4
|
+
import { Button } from '@digigov/ui/form/Button';
|
|
5
5
|
var fields = [{
|
|
6
6
|
key: 'string',
|
|
7
7
|
type: 'string',
|
package/es/FieldArray/index.js
CHANGED
|
@@ -3,11 +3,11 @@ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProper
|
|
|
3
3
|
var _excluded = ["name", "register", "control", "formState", "error", "layout", "label"];
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import { useFieldArray } from 'react-hook-form';
|
|
6
|
+
import FieldContainer from '@digigov/form/Field/FieldBaseContainer';
|
|
6
7
|
import FieldObject from '@digigov/form/FieldObject';
|
|
7
|
-
import { Button, Card, Hint } from '@digigov/ui';
|
|
8
8
|
import { FieldsetLabel } from '@digigov/form/Fieldset';
|
|
9
9
|
import Fieldset from '@digigov/react-core/Fieldset';
|
|
10
|
-
import
|
|
10
|
+
import { Button, Card, Hint } from '@digigov/ui';
|
|
11
11
|
export var FieldArray = function FieldArray(_ref) {
|
|
12
12
|
var _customField$extra, _customField$extra$la, _customField$extra4, _customField$extra4$l;
|
|
13
13
|
|
package/es/FieldObject/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import React, { useMemo } from 'react';
|
|
3
|
-
import Fieldset, { FieldsetCaption } from '@digigov/form/Fieldset';
|
|
4
|
-
import { useTranslation } from '@digigov/ui/app/i18n';
|
|
5
3
|
import { FieldBase } from '@digigov/form/Field/FieldBase';
|
|
6
4
|
import { calculateField } from '@digigov/form/Field/utils';
|
|
5
|
+
import Fieldset, { FieldsetCaption } from '@digigov/form/Fieldset';
|
|
7
6
|
import { FieldsetLegend } from '@digigov/react-core';
|
|
7
|
+
import { useTranslation } from '@digigov/ui/i18n';
|
|
8
8
|
export var FieldObject = function FieldObject(_ref) {
|
|
9
9
|
var name = _ref.name,
|
|
10
10
|
label = _ref.label,
|
|
@@ -18,7 +18,7 @@ export var FieldObject = function FieldObject(_ref) {
|
|
|
18
18
|
t = _useTranslation.t;
|
|
19
19
|
|
|
20
20
|
return /*#__PURE__*/React.createElement(Fieldset, null, (label === null || label === void 0 ? void 0 : label.primary) && /*#__PURE__*/React.createElement(FieldsetLegend, {
|
|
21
|
-
size: "
|
|
21
|
+
size: "sm"
|
|
22
22
|
}, t(label.primary)), (label === null || label === void 0 ? void 0 : label.secondary) && /*#__PURE__*/React.createElement(FieldsetCaption, null, t(label.secondary)), extra === null || extra === void 0 ? void 0 : extra.fields.map(function (field) {
|
|
23
23
|
return /*#__PURE__*/React.createElement(FieldObjectItem, {
|
|
24
24
|
key: "".concat(name, ".").concat(field.key),
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React, { useContext, useMemo } from 'react';
|
|
2
|
-
import { FormContext } from '@digigov/form/FormContext';
|
|
3
2
|
import Field from '@digigov/form/Field';
|
|
4
|
-
import { useTranslation } from '@digigov/ui/app/i18n';
|
|
5
3
|
import { Fieldset, FieldsetLabel, FieldsetCaption, FieldsetBody } from '@digigov/form/Fieldset/';
|
|
4
|
+
import { FormContext } from '@digigov/form/FormContext';
|
|
5
|
+
import { useTranslation } from '@digigov/ui/i18n';
|
|
6
6
|
export var FieldsetWithContext = function FieldsetWithContext(_ref) {
|
|
7
7
|
var name = _ref.name;
|
|
8
8
|
|
package/es/Fieldset/index.js
CHANGED
|
@@ -3,10 +3,10 @@ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProper
|
|
|
3
3
|
var _excluded = ["children"],
|
|
4
4
|
_excluded2 = ["children"];
|
|
5
5
|
import React from 'react';
|
|
6
|
-
import Grid from '@digigov/ui/layouts/Grid';
|
|
7
6
|
import Fieldset from '@digigov/react-core/Fieldset';
|
|
8
7
|
import FieldsetLegend from '@digigov/react-core/FieldsetLegend';
|
|
9
8
|
import Hint from '@digigov/react-core/Hint';
|
|
9
|
+
import Grid from '@digigov/ui/layouts/Grid';
|
|
10
10
|
import NormalText from '@digigov/ui/typography/NormalText';
|
|
11
11
|
export var FieldsetLabel = function FieldsetLabel(_ref) {
|
|
12
12
|
var children = _ref.children,
|
|
@@ -7,11 +7,11 @@ var _excluded = ["onSubmit", "children", "registerField", "fieldsMap", "fieldset
|
|
|
7
7
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
8
8
|
import React, { useCallback, useRef } from 'react';
|
|
9
9
|
import { useForm } from 'react-hook-form';
|
|
10
|
-
import { yupResolver } from '@digigov/form/utils';
|
|
11
|
-
import { useValidationSchema } from '@digigov/form/validators';
|
|
12
|
-
import Fieldset from '@digigov/form/Fieldset';
|
|
13
10
|
import Field from '@digigov/form/Field';
|
|
11
|
+
import Fieldset from '@digigov/form/Fieldset';
|
|
14
12
|
import { FormContext } from '@digigov/form/FormContext';
|
|
13
|
+
import { yupResolver } from '@digigov/form/utils';
|
|
14
|
+
import { useValidationSchema } from '@digigov/form/validators';
|
|
15
15
|
import { Form } from '@digigov/react-core/Form';
|
|
16
16
|
export var FormBase = /*#__PURE__*/React.forwardRef(function FormBase(_ref, ref) {
|
|
17
17
|
var onSubmit = _ref.onSubmit,
|
|
@@ -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
|
|
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
|
|
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
|
|
63
|
-
|
|
|
64
|
-
| children
|
|
65
|
-
| steps
|
|
66
|
-
| name
|
|
67
|
-
| title
|
|
68
|
-
| fields
|
|
69
|
-
| key
|
|
70
|
-
| label
|
|
71
|
-
| primary | string
|
|
72
|
-
| required
|
|
73
|
-
| submitButton
|
|
74
|
-
| type
|
|
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,15 @@ 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/
|
|
97
|
+
import Button from '@digigov/ui/form/Button';
|
|
100
98
|
import PageTitle, {
|
|
101
99
|
PageTitleSection,
|
|
102
100
|
PageTitleCaption,
|
|
103
101
|
PageTitleHeading,
|
|
104
102
|
} from '@digigov/ui/app/PageTitle';
|
|
105
|
-
import BackButton from '@digigov/ui/
|
|
103
|
+
import BackButton from '@digigov/ui/form/Button/BackButton';
|
|
106
104
|
import FormBuilder, { Fieldset, FieldsetLabel, Field } from '@digigov/form';
|
|
107
|
-
import { useTranslation } from '@digigov/ui/
|
|
105
|
+
import { useTranslation } from '@digigov/ui/i18n';
|
|
108
106
|
|
|
109
107
|
const FIELDS = [
|
|
110
108
|
{
|
|
@@ -258,14 +256,4 @@ export default function Index() {
|
|
|
258
256
|
</BasicLayout>
|
|
259
257
|
);
|
|
260
258
|
}
|
|
261
|
-
|
|
262
259
|
```
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|