@digigov/form 0.10.6 → 0.10.8

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 (85) hide show
  1. package/CHANGELOG.md +15 -1
  2. package/Field/FieldBase.js +3 -3
  3. package/Field/FieldBaseContainer.d.ts +4 -0
  4. package/Field/{FieldContainer.js → FieldBaseContainer.js} +10 -10
  5. package/FieldArray/FieldArray.stories.d.ts +1 -0
  6. package/FieldArray/FieldArray.stories.js +2 -1
  7. package/FieldArray/index.js +2 -2
  8. package/Fieldset/index.d.ts +2 -1
  9. package/Fieldset/index.js +8 -9
  10. package/FormBuilder/FormBuilder.stories.d.ts +1 -0
  11. package/FormBuilder/FormBuilder.stories.js +2 -1
  12. package/MultiplicityField/MultiplicityField.stories.d.ts +1 -0
  13. package/MultiplicityField/MultiplicityField.stories.js +2 -1
  14. package/MultiplicityField/index.js +2 -2
  15. package/Questions/Questions.stories.d.ts +8 -0
  16. package/Questions/Questions.stories.js +31 -0
  17. package/Questions/__stories__/Default.d.ts +2 -0
  18. package/Questions/__stories__/Default.js +130 -0
  19. package/Questions/index.mdx +411 -6
  20. package/es/Field/FieldBase.js +3 -3
  21. package/es/Field/{FieldContainer.js → FieldBaseContainer.js} +7 -7
  22. package/es/FieldArray/FieldArray.stories.js +2 -1
  23. package/es/FieldArray/index.js +1 -1
  24. package/es/Fieldset/index.js +2 -5
  25. package/es/FormBuilder/FormBuilder.stories.js +2 -1
  26. package/es/MultiplicityField/MultiplicityField.stories.js +2 -1
  27. package/es/MultiplicityField/index.js +1 -1
  28. package/es/Questions/Questions.stories.js +7 -0
  29. package/es/Questions/__stories__/Default.js +103 -0
  30. package/es/Questions/index.mdx +411 -6
  31. package/es/inputs/Checkboxes/Checkboxes.stories.js +2 -1
  32. package/es/inputs/DateInput/DateInput.stories.js +2 -1
  33. package/es/inputs/DateInput/index.js +2 -2
  34. package/es/inputs/FileInput/FileInput.stories.js +2 -1
  35. package/es/inputs/Input/Input.stories.js +2 -1
  36. package/es/inputs/Label/Label.stories.js +2 -1
  37. package/es/inputs/Radio/Radio.stories.js +2 -1
  38. package/es/inputs/Radio/index.js +2 -2
  39. package/es/inputs/Select/Select.stories.js +2 -1
  40. package/es/inputs/Select/index.js +2 -2
  41. package/es/registry.js +2 -2
  42. package/esm/Field/FieldBase.js +3 -3
  43. package/esm/Field/{FieldContainer.js → FieldBaseContainer.js} +7 -7
  44. package/esm/FieldArray/FieldArray.stories.js +2 -1
  45. package/esm/FieldArray/index.js +1 -1
  46. package/esm/Fieldset/index.js +2 -5
  47. package/esm/FormBuilder/FormBuilder.stories.js +2 -1
  48. package/esm/MultiplicityField/MultiplicityField.stories.js +2 -1
  49. package/esm/MultiplicityField/index.js +1 -1
  50. package/esm/Questions/Questions.stories.js +7 -0
  51. package/esm/Questions/__stories__/Default.js +103 -0
  52. package/esm/Questions/index.mdx +411 -6
  53. package/esm/index.js +1 -1
  54. package/esm/inputs/Checkboxes/Checkboxes.stories.js +2 -1
  55. package/esm/inputs/DateInput/DateInput.stories.js +2 -1
  56. package/esm/inputs/DateInput/index.js +2 -2
  57. package/esm/inputs/FileInput/FileInput.stories.js +2 -1
  58. package/esm/inputs/Input/Input.stories.js +2 -1
  59. package/esm/inputs/Label/Label.stories.js +2 -1
  60. package/esm/inputs/Radio/Radio.stories.js +2 -1
  61. package/esm/inputs/Radio/index.js +2 -2
  62. package/esm/inputs/Select/Select.stories.js +2 -1
  63. package/esm/inputs/Select/index.js +2 -2
  64. package/esm/registry.js +2 -2
  65. package/inputs/Checkboxes/Checkboxes.stories.d.ts +1 -0
  66. package/inputs/Checkboxes/Checkboxes.stories.js +2 -1
  67. package/inputs/DateInput/DateInput.stories.d.ts +1 -0
  68. package/inputs/DateInput/DateInput.stories.js +2 -1
  69. package/inputs/DateInput/index.js +2 -2
  70. package/inputs/FileInput/FileInput.stories.d.ts +1 -0
  71. package/inputs/FileInput/FileInput.stories.js +2 -1
  72. package/inputs/Input/Input.stories.d.ts +1 -0
  73. package/inputs/Input/Input.stories.js +2 -1
  74. package/inputs/Label/Label.stories.d.ts +1 -0
  75. package/inputs/Label/Label.stories.js +2 -1
  76. package/inputs/Radio/Radio.stories.d.ts +1 -0
  77. package/inputs/Radio/Radio.stories.js +2 -1
  78. package/inputs/Radio/index.js +2 -2
  79. package/inputs/Select/Select.stories.d.ts +1 -0
  80. package/inputs/Select/Select.stories.js +2 -1
  81. package/inputs/Select/index.js +2 -2
  82. package/package.json +4 -4
  83. package/registry.d.ts +1 -1
  84. package/registry.js +3 -3
  85. package/Field/FieldContainer.d.ts +0 -4
@@ -1,13 +1,418 @@
1
1
  ---
2
- title: Questions
3
- parent: docs/ui/components
2
+ id: ask-questions-steps
3
+ title: Asking questions in multiple steps
4
4
  ---
5
5
 
6
- ## Example
6
+ import {
7
+ TableContainer,
8
+ Table,
9
+ TableCaption,
10
+ TableHead,
11
+ TableRow,
12
+ TableBody,
13
+ TableHeadCell,
14
+ TableDataCell,
15
+ } from '@digigov/react-core';
7
16
 
17
+ import LeadText from "@site/src/components/LeadText";
8
18
 
9
- ## API
19
+ <LeadText>Question pages are used to ask users meaningful questions needed by
20
+ your GOV.GR service, or even gather data about their persona or their
21
+ application status. Use step questions to make bigger forms less scary and
22
+ easier to fill out.</LeadText>
10
23
 
11
- ### Properties
24
+ ## Introduction to Question pages
12
25
 
13
- ### Styles
26
+ Asking questions is a vital part of interacting with our users, and asking them
27
+ to provide information needed for your service. We want to build forms that
28
+ are accessible to a lot of people regardless of their cognitive or other
29
+ impairments, challenges, or other technological drawbacks.
30
+
31
+ In our case, we don't have to worry about profit, conversions, and sales, but
32
+ there are other hidden costs. If there are too many questions in the form,
33
+ you’ll lose users. You’ll also lose users if there are questions in the form
34
+ that users consider impertinent or irrelevant—or, even worse, you’ll get made-up
35
+ data. If you find that your users have names like John Doe or Mickey Mouse and
36
+ live on Anystreet, in Anywhere, you’ve collected a lot of rubbish that costs a
37
+ lot to clean up. Plus, there is the further hidden cost of loss of goodwill.
38
+ Even if users struggle through to the end of a form and answer honestly, if it’s
39
+ more work than they expected, they’ll be annoyed about it. That's the exact
40
+ opposite of our goals of making concise, easy-to-use services.
41
+
42
+ ```jsx live
43
+ import React from 'react';
44
+ import Questions, { Step, StepForm, StepTitle } from '@digigov/form/Questions';
45
+ import { Field } from '@digigov/form';
46
+
47
+ const steps = [
48
+ {
49
+ name: 'residency',
50
+ title: 'Where do you live?',
51
+ fields: [
52
+ {
53
+ key: 'countries',
54
+ type: 'choice:single',
55
+ required: true,
56
+ extra: {
57
+ options: [
58
+ {
59
+ label: {
60
+ primary: 'Greece',
61
+ },
62
+ value: 'greece',
63
+ },
64
+ {
65
+ label: {
66
+ primary: 'Cyprus',
67
+ },
68
+ value: 'cyprus',
69
+ },
70
+ {
71
+ label: {
72
+ primary: 'European Union',
73
+ },
74
+ value: 'eu',
75
+ },
76
+ {
77
+ label: {
78
+ primary: 'United States of America',
79
+ },
80
+ value: 'usa',
81
+ },
82
+ ],
83
+ },
84
+ },
85
+ ],
86
+ },
87
+ {
88
+ name: 'bod',
89
+ title: 'When is your birthday?',
90
+ fields: [
91
+ {
92
+ key: 'bod',
93
+ label: {
94
+ primary: 'Birthday',
95
+ },
96
+ type: 'date',
97
+ required: true
98
+ }
99
+ ]
100
+ }
101
+ ];
102
+
103
+ export default function Index() {
104
+ return (
105
+ <Questions
106
+ name={'example'}
107
+ steps={steps}
108
+ onSubmit={(data) => {
109
+ console.log(data);
110
+ }}
111
+ >
112
+ <Step name="residency">
113
+ <StepTitle />
114
+ <StepForm submitButton={true}>
115
+ <Field name="countries" />
116
+ </StepForm>
117
+ </Step>
118
+ <Step name="bod">
119
+ <StepTitle />
120
+ <StepForm submitButton={true}>
121
+ <Field name="bod" />
122
+ </StepForm>
123
+ </Step>
124
+ </Questions>
125
+ );
126
+ }
127
+ ```
128
+
129
+ When we started working on forms, we started following the GOV.UK paradigm,
130
+ asking just one question per screen, making it very manageable on mobiles. When
131
+ we sent this early design around internally for comments, a common response was
132
+ that it felt odd on large screens and it slowed users down. In reality, even if
133
+ it adds more clicks, it makes the process feel simpler and easy - there wasn’t
134
+ too much to take in and process at any one time. So we stuck with the simpler
135
+ screens for everyone. [Read
136
+ more](https://designnotes.blog.gov.uk/2014/07/14/things-we-learnt-designing-register-to-vote/)
137
+ about this topic.
138
+
139
+ The approach gave us other advantages. For example, say someone makes a mistake
140
+ answering a question: entering an email address with no ‘@’. The mistake and how
141
+ to correct it is a lot clearer if the question is on the screen. With longer
142
+ pages, it’s common for the question to be off the top or bottom of the screen,
143
+ making it harder to find.
144
+
145
+ For more information about the design specification of question pages, you can
146
+ read our [“Question pages“ pattern
147
+ page](https://guide.services.gov.gr/docs/questions-pages).
148
+
149
+ ## How to use it
150
+
151
+ Each step can be defined using a `Step` React component and all steps should be
152
+ place inside a `Questions` component, that will provide the steps subcomponents
153
+ the required state.
154
+
155
+ First, you declare an array called `steps` and then you pass it to `<Questions
156
+ />` as a prop. Then for each step you can declare a `<Step />` component and
157
+ its subsequent subcomponents that you customise as needed, like the step title,
158
+ description or form. You can also add components that are not form-specific,
159
+ adding paragraphs or other custom components.
160
+
161
+ ```jsx
162
+ <Questions
163
+ name="example"
164
+ steps={steps}
165
+ onSubmit={(data) => doSomething(data)}
166
+ >
167
+ {/* more steps could be rendered here ... */}
168
+ <Step name="age">
169
+ <StepTitle />
170
+ <StepDescription />
171
+ <StepForm submitButton={true}>
172
+ <Field name="age" />
173
+ </StepForm>
174
+ </Step>
175
+ {/* and of course more could be down here as well */}
176
+ </Questions>
177
+ ```
178
+
179
+ ### Step specification
180
+
181
+ Steps can be described using `StepInterface` interface declared as a JSON
182
+ object. The most basic properties are the following:
183
+
184
+ * `name` - a unique identifier, must be different for each step
185
+ * `title` - the main questions title that communicates to the users what this
186
+ question page is about, rendered by `StepTitle`
187
+ * `fields` - an array that describes each input field that will be rendered in
188
+ the `StepForm`. Each fields implements the `FieldSpec` interface as a JSON object.
189
+
190
+ ```json title="step-name.json"
191
+ {
192
+ name: 'name',
193
+ title: 'What is your name?',
194
+ fields: [
195
+ {
196
+ key: 'name',
197
+ type: 'string',
198
+ required: true,
199
+ }
200
+ ]
201
+ }
202
+ ```
203
+
204
+ ### Branching between steps
205
+
206
+ Each step will be rendered in the order that matches their index inside the
207
+ array of fields. You can change this order and create branching between any two
208
+ steps.
209
+
210
+ Each step can be programmaticaly linked to the next step so you can do some
211
+ basic branching between each step. The `nextStep` property will need to be a
212
+ function that will take the form state as an argument and will return the key of
213
+ the next `step`.
214
+
215
+ ```json title="next-step.json"
216
+ const steps = [
217
+ {
218
+ name: 'age',
219
+ title: 'What is your age?',
220
+ fields: [
221
+ {
222
+ key: 'age',
223
+ type: 'int',
224
+ required: true,
225
+ }
226
+ ],
227
+ // highlight-start
228
+ nextStep: (data) => {
229
+ return data.age < 18 ? 'citizen-adult' : citizen-underage;
230
+ }
231
+ // highlight-end
232
+ },
233
+ {
234
+ name: 'citizen-underage',
235
+ title: 'Are you a student?',
236
+ fields: [ ... ]
237
+ },
238
+ {
239
+ // highlight-next-line
240
+ name: 'citizen-adult',
241
+ title: 'Are you currently employed?',
242
+ fields: [
243
+ {
244
+ key: 'citizen-underage-employed',
245
+ type: 'choice:single',
246
+ required: true,
247
+ extra: {
248
+ options: [
249
+ {
250
+ label: {primary: "Yes"},
251
+ value: 'yes',
252
+ },
253
+ {
254
+ label: {primary: "No"},
255
+ value: 'no',
256
+ }
257
+ ]
258
+ }
259
+ }
260
+ ]
261
+ },
262
+ ];
263
+ ```
264
+
265
+ For example, you may use a form to determine if citizens are adults or not, and
266
+ we want to ask users different questions according to their persona. We can use
267
+ a branch between the `age` step and the other two steps.
268
+
269
+ ```jsx live
270
+ import React from 'react';
271
+ import GovGRFooter from '@digigov/ui/govgr/Footer';
272
+ import Header from '@digigov/ui/app/Header';
273
+ import HeaderSection from '@digigov/ui/app/Header/HeaderSection';
274
+ import HeaderContent from '@digigov/ui/app/Header/HeaderContent';
275
+ import GovGRLogo from '@digigov/ui/govgr/Logo';
276
+ import BasicLayout, {
277
+ Top,
278
+ Content,
279
+ Main,
280
+ Bottom,
281
+ } from '@digigov/ui/layouts/Basic';
282
+ import Questions, { Step, StepForm, StepTitle } from '@digigov/form/Questions';
283
+ import { Field } from '@digigov/form';
284
+ import TranslatorsHeader from 'translators-landing/components/TranslatorsHeader';
285
+
286
+ const steps = [
287
+ {
288
+ name: 'age',
289
+ title: 'What is your age?',
290
+ fields: [
291
+ {
292
+ key: 'age',
293
+ type: 'int',
294
+ required: true,
295
+ }
296
+ ],
297
+ nextStep: (data) => {
298
+ return data.age < 18 ? 'citizen-adult' : 'citizen-underage';
299
+ }
300
+ },
301
+ {
302
+ name: 'citizen-underage',
303
+ title: 'Are you a student?',
304
+ fields: [
305
+ {
306
+ key: 'citizen-underage-student',
307
+ type: 'choice:single',
308
+ required: true,
309
+ extra: {
310
+ options: [
311
+ {
312
+ label: {primary: "Yes"},
313
+ value: 'yes',
314
+ },
315
+ {
316
+ label: {primary: "No"},
317
+ value: 'no',
318
+ }
319
+ ]
320
+ }
321
+ }
322
+ ]
323
+ },
324
+ {
325
+ name: 'citizen-adult',
326
+ title: 'Are you currently employed?',
327
+ fields: [
328
+ {
329
+ key: 'citizen-adult-employed',
330
+ type: 'choice:single',
331
+ required: true,
332
+ extra: {
333
+ options: [
334
+ {
335
+ label: {primary: "Yes"},
336
+ value: 'yes',
337
+ },
338
+ {
339
+ label: {primary: "No"},
340
+ value: 'no',
341
+ }
342
+ ]
343
+ }
344
+ }
345
+ ]
346
+ },
347
+ ];
348
+
349
+ export default function Index() {
350
+ return (
351
+ <BasicLayout>
352
+ <Top>
353
+ <Header>
354
+ <HeaderSection>
355
+ <HeaderContent>
356
+ <GovGRLogo href="#" />
357
+ </HeaderContent>
358
+ </HeaderSection>
359
+ </Header>
360
+ </Top>
361
+ <Content>
362
+ <Main>
363
+ <Questions
364
+ name={'example'}
365
+ steps={steps}
366
+ onSubmit={(data) => {
367
+ console.log(data);
368
+ }}
369
+ >
370
+ <Step name="age">
371
+ <StepTitle />
372
+ <StepForm submitButton={true}>
373
+ <Field name="age" />
374
+ </StepForm>
375
+ </Step>
376
+ <Step name="citizen-underage">
377
+ <StepTitle />
378
+ <StepForm submitButton={true}>
379
+ <Field name="citizen-underage-student" />
380
+ </StepForm>
381
+ </Step>
382
+ <Step name="citizen-adult">
383
+ <StepTitle />
384
+ <StepForm submitButton={true}>
385
+ <Field name="citizen-adult-employed" />
386
+ </StepForm>
387
+ </Step>
388
+ </Questions>
389
+ </Main>
390
+ </Content>
391
+ <Bottom>
392
+ <GovGRFooter />
393
+ </Bottom>
394
+ </BasicLayout>
395
+ );
396
+ }
397
+ ```
398
+
399
+ ## Prop types
400
+
401
+ <TableContainer>
402
+ <Table>
403
+ <TableHead>
404
+ <TableRow>
405
+ <TableHeadCell>Περίοδος</TableHeadCell>
406
+ <TableHeadCell>Κανονικό ποσό</TableHeadCell>
407
+ <TableHeadCell>Μειωμένο ποσό</TableHeadCell>
408
+ </TableRow>
409
+ </TableHead>
410
+ <TableBody>
411
+ <TableRow>
412
+ <TableDataCell>Πρώτες 6 εβδομάδες </TableDataCell>
413
+ <TableDataCell> €109.80 / εβδομάδα</TableDataCell>
414
+ <TableDataCell> €69.80 / εβδομάδα</TableDataCell>
415
+ </TableRow>
416
+ </TableBody>
417
+ </Table>
418
+ </TableContainer>
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
3
  var _excluded = ["required", "name", "component", "wrapper", "control", "type", "controlled", "enabled", "editable", "defaultValue", "label", "extra", "layout", "error", "register"];
4
4
  import React from 'react';
5
- import FieldContainer from '@digigov/form/Field/FieldContainer';
5
+ import FieldBaseContainer from '@digigov/form/Field/FieldBaseContainer';
6
6
  import { Controller } from 'react-hook-form';
7
7
  export var FieldBase = function FieldBase(props) {
8
8
  var required = props.required,
@@ -30,7 +30,7 @@ export var FieldBase = function FieldBase(props) {
30
30
  }
31
31
 
32
32
  if (controlled) {
33
- return /*#__PURE__*/React.createElement(FieldContainer, {
33
+ return /*#__PURE__*/React.createElement(FieldBaseContainer, {
34
34
  label: label,
35
35
  layout: layout,
36
36
  error: error,
@@ -55,7 +55,7 @@ export var FieldBase = function FieldBase(props) {
55
55
  }));
56
56
  }
57
57
 
58
- return /*#__PURE__*/React.createElement(FieldContainer, {
58
+ return /*#__PURE__*/React.createElement(FieldBaseContainer, {
59
59
  label: label,
60
60
  layout: layout,
61
61
  error: error,
@@ -1,14 +1,14 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import React from 'react';
3
- import CoreField from '@digigov/react-core/Field';
4
- import CoreLabel from '@digigov/react-core/Label';
3
+ import FieldContainer from '@digigov/react-core/FieldContainer';
4
+ import LabelContainer from '@digigov/react-core/LabelContainer';
5
5
  import CoreFieldset from '@digigov/react-core/Fieldset';
6
6
  import Hint from '@digigov/react-core/Hint';
7
7
  import FieldsetLegend from '@digigov/react-core/FieldsetLegend';
8
8
  import ErrorMessage from '@digigov/react-core/ErrorMessage';
9
9
  import { useTranslation } from '@digigov/ui/app/i18n';
10
10
  import Label from '@digigov/form/inputs/Label';
11
- export var FieldContainer = function FieldContainer(_ref) {
11
+ export var FieldBaseContainer = function FieldBaseContainer(_ref) {
12
12
  var name = _ref.name,
13
13
  wrapper = _ref.wrapper,
14
14
  label = _ref.label,
@@ -23,7 +23,7 @@ export var FieldContainer = function FieldContainer(_ref) {
23
23
  var errorContext = (error === null || error === void 0 ? void 0 : error.message.context) || {};
24
24
 
25
25
  if (wrapper === 'fieldset') {
26
- return /*#__PURE__*/React.createElement(CoreField, _extends({
26
+ return /*#__PURE__*/React.createElement(FieldContainer, _extends({
27
27
  error: !!error
28
28
  }, layout), /*#__PURE__*/React.createElement(CoreFieldset, null, /*#__PURE__*/React.createElement(FieldsetLegend, {
29
29
  size: "s"
@@ -31,13 +31,13 @@ export var FieldContainer = function FieldContainer(_ref) {
31
31
  id: "".concat(name, "-error")
32
32
  }, t(errorMessage, errorContext)), children));
33
33
  } else {
34
- return /*#__PURE__*/React.createElement(CoreField, _extends({
34
+ return /*#__PURE__*/React.createElement(FieldContainer, _extends({
35
35
  error: !!error
36
- }, layout), /*#__PURE__*/React.createElement(CoreLabel, null, label && /*#__PURE__*/React.createElement(Label, {
36
+ }, layout), /*#__PURE__*/React.createElement(LabelContainer, null, label && /*#__PURE__*/React.createElement(Label, {
37
37
  label: label
38
38
  }), error && /*#__PURE__*/React.createElement(ErrorMessage, {
39
39
  id: "".concat(name, "-error")
40
40
  }, t(errorMessage, errorContext)), children));
41
41
  }
42
42
  };
43
- export default FieldContainer;
43
+ export default FieldBaseContainer;
@@ -1,7 +1,8 @@
1
1
  import FieldArray from '@digigov/form/FieldArray';
2
2
  export default {
3
3
  title: 'Digigov Form/FieldArray',
4
- component: FieldArray
4
+ component: FieldArray,
5
+ displayName: 'FieldArray'
5
6
  };
6
7
  export * from '@digigov/form/FieldArray/__stories__/Default';
7
8
  export * from '@digigov/form/FieldArray/__stories__/WithExactLength';
@@ -7,7 +7,7 @@ import FieldObject from '@digigov/form/FieldObject';
7
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 FieldContainer from '@digigov/form/Field/FieldContainer';
10
+ import FieldContainer from '@digigov/form/Field/FieldBaseContainer';
11
11
  export var FieldArray = function FieldArray(_ref) {
12
12
  var _customField$extra, _customField$extra$la, _customField$extra4, _customField$extra4$l;
13
13
 
@@ -4,7 +4,7 @@ var _excluded = ["children"],
4
4
  _excluded2 = ["children"];
5
5
  import React from 'react';
6
6
  import Grid from '@digigov/ui/layouts/Grid';
7
- import CoreFieldset from '@digigov/react-core/Fieldset';
7
+ import Fieldset from '@digigov/react-core/Fieldset';
8
8
  import FieldsetLegend from '@digigov/react-core/FieldsetLegend';
9
9
  import Hint from '@digigov/react-core/Hint';
10
10
  import NormalText from '@digigov/ui/typography/NormalText';
@@ -30,8 +30,5 @@ export var FieldsetBody = function FieldsetBody(_ref3) {
30
30
  xs: 12
31
31
  }, /*#__PURE__*/React.createElement(NormalText, null, children));
32
32
  };
33
- export var Fieldset = function Fieldset(_ref4) {
34
- var children = _ref4.children;
35
- return /*#__PURE__*/React.createElement(CoreFieldset, null, children);
36
- };
33
+ export { Fieldset };
37
34
  export default Fieldset;
@@ -1,6 +1,7 @@
1
1
  import FormBuilder from '@digigov/form/FormBuilder';
2
2
  export default {
3
3
  title: 'Digigov Form/FormBuilder',
4
- component: FormBuilder
4
+ component: FormBuilder,
5
+ displayName: 'FormBuilder'
5
6
  };
6
7
  export * from '@digigov/form/FormBuilder/__stories__/Default';
@@ -1,7 +1,8 @@
1
1
  import MultiplicityField from '@digigov/form/MultiplicityField';
2
2
  export default {
3
3
  title: 'Digigov Form/MultiplicityField',
4
- component: MultiplicityField
4
+ component: MultiplicityField,
5
+ displayName: 'MultiplicityField'
5
6
  };
6
7
  export * from '@digigov/form/MultiplicityField/__stories__/Default';
7
8
  export * from '@digigov/form/MultiplicityField/__stories__/WithMinLength';
@@ -6,7 +6,7 @@ import { Card, CardText, CardAction, Button, Heading, CardHeading } from '@digig
6
6
  import AddObjects from '@digigov/form/MultiplicityField/add-objects';
7
7
  import { useFieldArray } from 'react-hook-form';
8
8
  import FieldObject from '@digigov/form/FieldObject';
9
- import FieldContainer from '@digigov/form/Field/FieldContainer';
9
+ import FieldContainer from '@digigov/form/Field/FieldBaseContainer';
10
10
  // epeidh einai forwardRef to ref mas to dinei xwrista apo ta props
11
11
  export var Multiplicity = function Multiplicity(_ref) {
12
12
  var extra = _ref.extra,
@@ -0,0 +1,7 @@
1
+ import Questions from '@digigov/form/Questions';
2
+ export default {
3
+ title: 'Digigov Form/Questions',
4
+ component: Questions,
5
+ displayName: 'Questions'
6
+ };
7
+ export * from '@digigov/form/Questions/__stories__/Default';
@@ -0,0 +1,103 @@
1
+ import React from 'react';
2
+ import GovGRFooter from '@digigov/ui/govgr/Footer';
3
+ import Header from '@digigov/ui/app/Header';
4
+ import HeaderSection from '@digigov/ui/app/Header/HeaderSection';
5
+ import HeaderContent from '@digigov/ui/app/Header/HeaderContent';
6
+ import GovGRLogo from '@digigov/ui/govgr/Logo';
7
+ import BasicLayout, { Top, Content, Main, Bottom } from '@digigov/ui/layouts/Basic';
8
+ import Questions, { Step, StepForm, StepTitle } from '@digigov/form/Questions';
9
+ import { Field } from '@digigov/form';
10
+ var steps = [{
11
+ name: 'age',
12
+ title: 'What is your age?',
13
+ fields: [{
14
+ key: 'age',
15
+ type: 'int',
16
+ required: true
17
+ }],
18
+ nextStep: function nextStep(data) {
19
+ return data.age > 17 ? 'citizen-adult' : 'citizen-underage';
20
+ }
21
+ }, {
22
+ name: 'citizen-underage',
23
+ title: 'Are you a student?',
24
+ fields: [{
25
+ key: 'citizen-underage-student',
26
+ type: 'radio',
27
+ required: true,
28
+ options: [{
29
+ label: {
30
+ primary: 'Yes'
31
+ },
32
+ value: 'yes'
33
+ }, {
34
+ label: {
35
+ primary: 'No'
36
+ },
37
+ value: 'no'
38
+ }]
39
+ }]
40
+ }, {
41
+ name: 'citizen-adult',
42
+ title: 'Are you currently employed?',
43
+ fields: [{
44
+ key: 'citizen-adult-employed',
45
+ type: 'radio',
46
+ required: true,
47
+ options: [{
48
+ label: {
49
+ primary: 'Yes'
50
+ },
51
+ value: 'yes'
52
+ }, {
53
+ label: {
54
+ primary: 'No'
55
+ },
56
+ value: 'no'
57
+ }]
58
+ }]
59
+ }];
60
+
61
+ var _ref = /*#__PURE__*/React.createElement(Top, null, /*#__PURE__*/React.createElement(Header, null, /*#__PURE__*/React.createElement(HeaderSection, null, /*#__PURE__*/React.createElement(HeaderContent, null, /*#__PURE__*/React.createElement(GovGRLogo, {
62
+ href: "#"
63
+ })))));
64
+
65
+ var _ref2 = /*#__PURE__*/React.createElement(Step, {
66
+ name: "age"
67
+ }, /*#__PURE__*/React.createElement(StepTitle, null), /*#__PURE__*/React.createElement(StepForm, {
68
+ submitButton: true
69
+ }, /*#__PURE__*/React.createElement(Field, {
70
+ key: "age",
71
+ name: "age"
72
+ })));
73
+
74
+ var _ref3 = /*#__PURE__*/React.createElement(Step, {
75
+ name: "citizen-underage"
76
+ }, /*#__PURE__*/React.createElement(StepTitle, null), /*#__PURE__*/React.createElement(StepForm, {
77
+ submitButton: true
78
+ }, /*#__PURE__*/React.createElement(Field, {
79
+ key: "citizen-underage-student",
80
+ name: "citizen-underage-student"
81
+ })));
82
+
83
+ var _ref4 = /*#__PURE__*/React.createElement(Step, {
84
+ name: "citizen-adult"
85
+ }, /*#__PURE__*/React.createElement(StepTitle, null), /*#__PURE__*/React.createElement(StepForm, {
86
+ submitButton: true
87
+ }, /*#__PURE__*/React.createElement(Field, {
88
+ key: "citizen-adult-employed",
89
+ name: "citizen-adult-employed"
90
+ })));
91
+
92
+ var _ref5 = /*#__PURE__*/React.createElement(Bottom, null, /*#__PURE__*/React.createElement(GovGRFooter, null));
93
+
94
+ export function Default() {
95
+ return /*#__PURE__*/React.createElement(BasicLayout, null, _ref, /*#__PURE__*/React.createElement(Content, null, /*#__PURE__*/React.createElement(Main, null, /*#__PURE__*/React.createElement(Questions, {
96
+ name: 'example',
97
+ steps: steps,
98
+ onSubmit: function onSubmit(data) {
99
+ console.log(data);
100
+ }
101
+ }, _ref2, _ref3, _ref4))), _ref5);
102
+ }
103
+ export default Default;