@digigov/form 0.11.1 → 0.12.1
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/CHANGELOG.md +8 -1
- package/Questions/Step/StepTitle.d.ts +1 -0
- package/Questions/Step/StepTitle.js +5 -4
- package/Questions/Step/types.d.ts +1 -0
- package/Questions/__stories__/Default.js +6 -1
- package/es/Questions/Step/StepTitle.js +5 -5
- package/es/Questions/__stories__/Default.js +6 -1
- package/esm/Questions/Step/StepTitle.js +5 -5
- package/esm/Questions/__stories__/Default.js +6 -1
- package/esm/index.js +1 -1
- package/package.json +4 -4
- package/src/Questions/Step/StepTitle.tsx +5 -3
- package/src/Questions/Step/types.tsx +1 -0
- package/src/Questions/__stories__/Default.tsx +4 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
# Change Log - @digigov/form
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Tue, 16 May 2023 13:42:28 GMT and should not be manually modified.
|
|
4
|
+
|
|
5
|
+
## 0.12.0
|
|
6
|
+
Tue, 16 May 2023 13:42:28 GMT
|
|
7
|
+
|
|
8
|
+
### Minor changes
|
|
9
|
+
|
|
10
|
+
- Add customisation options for back buttons in Questions and Step components
|
|
4
11
|
|
|
5
12
|
## 0.11.1
|
|
6
13
|
Thu, 11 May 2023 10:48:56 GMT
|
|
@@ -29,18 +29,17 @@ var StepTitleHeading = function StepTitleHeading(props) {
|
|
|
29
29
|
|
|
30
30
|
exports.StepTitleHeading = StepTitleHeading;
|
|
31
31
|
|
|
32
|
-
var _ref2 = /*#__PURE__*/_react["default"].createElement(_BackButton["default"], null, "\u03A0\u03AF\u03C3\u03C9");
|
|
33
|
-
|
|
34
32
|
var StepTitleBase = function StepTitleBase(_ref) {
|
|
35
33
|
var caption = _ref.caption,
|
|
36
34
|
step = _ref.step,
|
|
37
35
|
title = _ref.title,
|
|
36
|
+
backButton = _ref.backButton,
|
|
38
37
|
children = _ref.children;
|
|
39
38
|
|
|
40
39
|
var _useTranslation = (0, _i18n.useTranslation)(),
|
|
41
40
|
t = _useTranslation.t;
|
|
42
41
|
|
|
43
|
-
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null,
|
|
42
|
+
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_BackButton["default"], null, backButton || t('back.button')), /*#__PURE__*/_react["default"].createElement(_PageTitle["default"], null, children || /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_PageTitle.PageTitleSection, null, /*#__PURE__*/_react["default"].createElement(_PageTitle.PageTitleCaption, null, caption && t(caption)), step && /*#__PURE__*/_react["default"].createElement(_PageTitle.PageTitleCaption, null, step)), /*#__PURE__*/_react["default"].createElement(StepTitleHeading, null, title && t(title)))));
|
|
44
43
|
};
|
|
45
44
|
/**
|
|
46
45
|
* The StepTitle component accepts a title, a caption and a step indicator
|
|
@@ -54,9 +53,11 @@ var StepTitle = function StepTitle(props) {
|
|
|
54
53
|
var _useContext = (0, _react.useContext)(_StepContext.StepContext),
|
|
55
54
|
caption = _useContext.caption,
|
|
56
55
|
title = _useContext.title,
|
|
57
|
-
step = _useContext.step
|
|
56
|
+
step = _useContext.step,
|
|
57
|
+
backButton = _useContext.backButton;
|
|
58
58
|
|
|
59
59
|
return /*#__PURE__*/_react["default"].createElement(StepTitleBase, {
|
|
60
|
+
backButton: backButton,
|
|
60
61
|
caption: caption,
|
|
61
62
|
step: step,
|
|
62
63
|
title: title
|
|
@@ -35,6 +35,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
35
35
|
var steps = [{
|
|
36
36
|
name: 'age',
|
|
37
37
|
title: 'What is your age?',
|
|
38
|
+
backButton: 'Back',
|
|
38
39
|
fields: [{
|
|
39
40
|
key: 'age',
|
|
40
41
|
type: 'int',
|
|
@@ -46,6 +47,7 @@ var steps = [{
|
|
|
46
47
|
}, {
|
|
47
48
|
name: 'citizen-underage',
|
|
48
49
|
title: 'Are you a student?',
|
|
50
|
+
backButton: 'Back',
|
|
49
51
|
fields: [{
|
|
50
52
|
key: 'citizen-underage-student',
|
|
51
53
|
type: 'radio',
|
|
@@ -65,6 +67,7 @@ var steps = [{
|
|
|
65
67
|
}, {
|
|
66
68
|
name: 'citizen-adult',
|
|
67
69
|
title: 'Are you currently employed?',
|
|
70
|
+
backButton: 'Back',
|
|
68
71
|
fields: [{
|
|
69
72
|
key: 'citizen-adult-employed',
|
|
70
73
|
type: 'radio',
|
|
@@ -107,7 +110,9 @@ var _ref3 = /*#__PURE__*/_react["default"].createElement(_Questions.Step, {
|
|
|
107
110
|
|
|
108
111
|
var _ref4 = /*#__PURE__*/_react["default"].createElement(_Questions.Step, {
|
|
109
112
|
name: "citizen-adult"
|
|
110
|
-
}, /*#__PURE__*/_react["default"].createElement(_Questions.StepTitle,
|
|
113
|
+
}, /*#__PURE__*/_react["default"].createElement(_Questions.StepTitle, {
|
|
114
|
+
backButton: "\u03A0\u03AF\u03C3\u03C9"
|
|
115
|
+
}), /*#__PURE__*/_react["default"].createElement(_Questions.StepForm, {
|
|
111
116
|
submitButton: true
|
|
112
117
|
}, /*#__PURE__*/_react["default"].createElement(_form.Field, {
|
|
113
118
|
key: "citizen-adult-employed",
|
|
@@ -6,19 +6,17 @@ import { useTranslation } from '@digigov/ui/app/i18n';
|
|
|
6
6
|
export var StepTitleHeading = function StepTitleHeading(props) {
|
|
7
7
|
return /*#__PURE__*/React.createElement(PageTitleHeading, null, props.children);
|
|
8
8
|
};
|
|
9
|
-
|
|
10
|
-
var _ref2 = /*#__PURE__*/React.createElement(BackButton, null, "\u03A0\u03AF\u03C3\u03C9");
|
|
11
|
-
|
|
12
9
|
export var StepTitleBase = function StepTitleBase(_ref) {
|
|
13
10
|
var caption = _ref.caption,
|
|
14
11
|
step = _ref.step,
|
|
15
12
|
title = _ref.title,
|
|
13
|
+
backButton = _ref.backButton,
|
|
16
14
|
children = _ref.children;
|
|
17
15
|
|
|
18
16
|
var _useTranslation = useTranslation(),
|
|
19
17
|
t = _useTranslation.t;
|
|
20
18
|
|
|
21
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null,
|
|
19
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(BackButton, null, backButton || t('back.button')), /*#__PURE__*/React.createElement(PageTitle, null, children || /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(PageTitleSection, null, /*#__PURE__*/React.createElement(PageTitleCaption, null, caption && t(caption)), step && /*#__PURE__*/React.createElement(PageTitleCaption, null, step)), /*#__PURE__*/React.createElement(StepTitleHeading, null, title && t(title)))));
|
|
22
20
|
};
|
|
23
21
|
/**
|
|
24
22
|
* The StepTitle component accepts a title, a caption and a step indicator
|
|
@@ -29,9 +27,11 @@ export var StepTitle = function StepTitle(props) {
|
|
|
29
27
|
var _useContext = useContext(StepContext),
|
|
30
28
|
caption = _useContext.caption,
|
|
31
29
|
title = _useContext.title,
|
|
32
|
-
step = _useContext.step
|
|
30
|
+
step = _useContext.step,
|
|
31
|
+
backButton = _useContext.backButton;
|
|
33
32
|
|
|
34
33
|
return /*#__PURE__*/React.createElement(StepTitleBase, {
|
|
34
|
+
backButton: backButton,
|
|
35
35
|
caption: caption,
|
|
36
36
|
step: step,
|
|
37
37
|
title: title
|
|
@@ -10,6 +10,7 @@ import { Field } from '@digigov/form';
|
|
|
10
10
|
var steps = [{
|
|
11
11
|
name: 'age',
|
|
12
12
|
title: 'What is your age?',
|
|
13
|
+
backButton: 'Back',
|
|
13
14
|
fields: [{
|
|
14
15
|
key: 'age',
|
|
15
16
|
type: 'int',
|
|
@@ -21,6 +22,7 @@ var steps = [{
|
|
|
21
22
|
}, {
|
|
22
23
|
name: 'citizen-underage',
|
|
23
24
|
title: 'Are you a student?',
|
|
25
|
+
backButton: 'Back',
|
|
24
26
|
fields: [{
|
|
25
27
|
key: 'citizen-underage-student',
|
|
26
28
|
type: 'radio',
|
|
@@ -40,6 +42,7 @@ var steps = [{
|
|
|
40
42
|
}, {
|
|
41
43
|
name: 'citizen-adult',
|
|
42
44
|
title: 'Are you currently employed?',
|
|
45
|
+
backButton: 'Back',
|
|
43
46
|
fields: [{
|
|
44
47
|
key: 'citizen-adult-employed',
|
|
45
48
|
type: 'radio',
|
|
@@ -82,7 +85,9 @@ var _ref3 = /*#__PURE__*/React.createElement(Step, {
|
|
|
82
85
|
|
|
83
86
|
var _ref4 = /*#__PURE__*/React.createElement(Step, {
|
|
84
87
|
name: "citizen-adult"
|
|
85
|
-
}, /*#__PURE__*/React.createElement(StepTitle,
|
|
88
|
+
}, /*#__PURE__*/React.createElement(StepTitle, {
|
|
89
|
+
backButton: "\u03A0\u03AF\u03C3\u03C9"
|
|
90
|
+
}), /*#__PURE__*/React.createElement(StepForm, {
|
|
86
91
|
submitButton: true
|
|
87
92
|
}, /*#__PURE__*/React.createElement(Field, {
|
|
88
93
|
key: "citizen-adult-employed",
|
|
@@ -6,19 +6,17 @@ import { useTranslation } from '@digigov/ui/app/i18n';
|
|
|
6
6
|
export var StepTitleHeading = function StepTitleHeading(props) {
|
|
7
7
|
return /*#__PURE__*/React.createElement(PageTitleHeading, null, props.children);
|
|
8
8
|
};
|
|
9
|
-
|
|
10
|
-
var _ref2 = /*#__PURE__*/React.createElement(BackButton, null, "\u03A0\u03AF\u03C3\u03C9");
|
|
11
|
-
|
|
12
9
|
export var StepTitleBase = function StepTitleBase(_ref) {
|
|
13
10
|
var caption = _ref.caption,
|
|
14
11
|
step = _ref.step,
|
|
15
12
|
title = _ref.title,
|
|
13
|
+
backButton = _ref.backButton,
|
|
16
14
|
children = _ref.children;
|
|
17
15
|
|
|
18
16
|
var _useTranslation = useTranslation(),
|
|
19
17
|
t = _useTranslation.t;
|
|
20
18
|
|
|
21
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null,
|
|
19
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(BackButton, null, backButton || t('back.button')), /*#__PURE__*/React.createElement(PageTitle, null, children || /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(PageTitleSection, null, /*#__PURE__*/React.createElement(PageTitleCaption, null, caption && t(caption)), step && /*#__PURE__*/React.createElement(PageTitleCaption, null, step)), /*#__PURE__*/React.createElement(StepTitleHeading, null, title && t(title)))));
|
|
22
20
|
};
|
|
23
21
|
/**
|
|
24
22
|
* The StepTitle component accepts a title, a caption and a step indicator
|
|
@@ -29,9 +27,11 @@ export var StepTitle = function StepTitle(props) {
|
|
|
29
27
|
var _useContext = useContext(StepContext),
|
|
30
28
|
caption = _useContext.caption,
|
|
31
29
|
title = _useContext.title,
|
|
32
|
-
step = _useContext.step
|
|
30
|
+
step = _useContext.step,
|
|
31
|
+
backButton = _useContext.backButton;
|
|
33
32
|
|
|
34
33
|
return /*#__PURE__*/React.createElement(StepTitleBase, {
|
|
34
|
+
backButton: backButton,
|
|
35
35
|
caption: caption,
|
|
36
36
|
step: step,
|
|
37
37
|
title: title
|
|
@@ -10,6 +10,7 @@ import { Field } from '@digigov/form';
|
|
|
10
10
|
var steps = [{
|
|
11
11
|
name: 'age',
|
|
12
12
|
title: 'What is your age?',
|
|
13
|
+
backButton: 'Back',
|
|
13
14
|
fields: [{
|
|
14
15
|
key: 'age',
|
|
15
16
|
type: 'int',
|
|
@@ -21,6 +22,7 @@ var steps = [{
|
|
|
21
22
|
}, {
|
|
22
23
|
name: 'citizen-underage',
|
|
23
24
|
title: 'Are you a student?',
|
|
25
|
+
backButton: 'Back',
|
|
24
26
|
fields: [{
|
|
25
27
|
key: 'citizen-underage-student',
|
|
26
28
|
type: 'radio',
|
|
@@ -40,6 +42,7 @@ var steps = [{
|
|
|
40
42
|
}, {
|
|
41
43
|
name: 'citizen-adult',
|
|
42
44
|
title: 'Are you currently employed?',
|
|
45
|
+
backButton: 'Back',
|
|
43
46
|
fields: [{
|
|
44
47
|
key: 'citizen-adult-employed',
|
|
45
48
|
type: 'radio',
|
|
@@ -82,7 +85,9 @@ var _ref3 = /*#__PURE__*/React.createElement(Step, {
|
|
|
82
85
|
|
|
83
86
|
var _ref4 = /*#__PURE__*/React.createElement(Step, {
|
|
84
87
|
name: "citizen-adult"
|
|
85
|
-
}, /*#__PURE__*/React.createElement(StepTitle,
|
|
88
|
+
}, /*#__PURE__*/React.createElement(StepTitle, {
|
|
89
|
+
backButton: "\u03A0\u03AF\u03C3\u03C9"
|
|
90
|
+
}), /*#__PURE__*/React.createElement(StepForm, {
|
|
86
91
|
submitButton: true
|
|
87
92
|
}, /*#__PURE__*/React.createElement(Field, {
|
|
88
93
|
key: "citizen-adult-employed",
|
package/esm/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@digigov/form",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.1",
|
|
4
4
|
"description": "@digigov form builder",
|
|
5
5
|
"author": "GRNET Developers <devs@lists.grnet.gr>",
|
|
6
6
|
"license": "BSD-2-Clause",
|
|
@@ -19,9 +19,9 @@
|
|
|
19
19
|
"publint": "0.1.8"
|
|
20
20
|
},
|
|
21
21
|
"peerDependencies": {
|
|
22
|
-
"@digigov/ui": "0.
|
|
23
|
-
"@digigov/react-core": "0.
|
|
24
|
-
"@digigov/react-extensions": "0.
|
|
22
|
+
"@digigov/ui": "0.33.0",
|
|
23
|
+
"@digigov/react-core": "0.24.0",
|
|
24
|
+
"@digigov/react-extensions": "0.22.0",
|
|
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"
|
|
@@ -11,6 +11,7 @@ import { useTranslation } from '@digigov/ui/app/i18n';
|
|
|
11
11
|
|
|
12
12
|
export interface StepTitleInterface {
|
|
13
13
|
title?: string;
|
|
14
|
+
backButton?: string;
|
|
14
15
|
caption?: string;
|
|
15
16
|
step?: string;
|
|
16
17
|
}
|
|
@@ -23,12 +24,13 @@ export const StepTitleBase: React.FC<StepTitleInterface> = ({
|
|
|
23
24
|
caption,
|
|
24
25
|
step,
|
|
25
26
|
title,
|
|
27
|
+
backButton,
|
|
26
28
|
children,
|
|
27
29
|
}): React.ReactElement => {
|
|
28
30
|
const { t } = useTranslation();
|
|
29
31
|
return (
|
|
30
32
|
<>
|
|
31
|
-
<BackButton
|
|
33
|
+
<BackButton>{backButton || t('back.button')}</BackButton>
|
|
32
34
|
<PageTitle>
|
|
33
35
|
{children || (
|
|
34
36
|
<>
|
|
@@ -49,9 +51,9 @@ export const StepTitleBase: React.FC<StepTitleInterface> = ({
|
|
|
49
51
|
* about the Step asked to the User
|
|
50
52
|
*/
|
|
51
53
|
export const StepTitle: React.FC<StepTitleInterface> = (props) => {
|
|
52
|
-
const { caption, title, step } = useContext(StepContext);
|
|
54
|
+
const { caption, title, step, backButton } = useContext(StepContext);
|
|
53
55
|
return (
|
|
54
|
-
<StepTitleBase caption={caption} step={step} title={title}>
|
|
56
|
+
<StepTitleBase backButton={backButton} caption={caption} step={step} title={title}>
|
|
55
57
|
{props.children}
|
|
56
58
|
</StepTitleBase>
|
|
57
59
|
);
|
|
@@ -17,6 +17,7 @@ const steps = [
|
|
|
17
17
|
{
|
|
18
18
|
name: 'age',
|
|
19
19
|
title: 'What is your age?',
|
|
20
|
+
backButton: 'Back',
|
|
20
21
|
fields: [
|
|
21
22
|
{
|
|
22
23
|
key: 'age',
|
|
@@ -31,6 +32,7 @@ const steps = [
|
|
|
31
32
|
{
|
|
32
33
|
name: 'citizen-underage',
|
|
33
34
|
title: 'Are you a student?',
|
|
35
|
+
backButton: 'Back',
|
|
34
36
|
fields: [
|
|
35
37
|
{
|
|
36
38
|
key: 'citizen-underage-student',
|
|
@@ -52,6 +54,7 @@ const steps = [
|
|
|
52
54
|
{
|
|
53
55
|
name: 'citizen-adult',
|
|
54
56
|
title: 'Are you currently employed?',
|
|
57
|
+
backButton: 'Back',
|
|
55
58
|
fields: [
|
|
56
59
|
{
|
|
57
60
|
key: 'citizen-adult-employed',
|
|
@@ -109,7 +112,7 @@ export function Default() {
|
|
|
109
112
|
</StepForm>
|
|
110
113
|
</Step>
|
|
111
114
|
<Step name="citizen-adult">
|
|
112
|
-
<StepTitle />
|
|
115
|
+
<StepTitle backButton="Πίσω" />
|
|
113
116
|
<StepForm submitButton={true}>
|
|
114
117
|
<Field
|
|
115
118
|
key="citizen-adult-employed"
|