@digigov/form 2.0.0-b15d5d44 → 2.0.0-b19b7fe2

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 (95) hide show
  1. package/Field/FieldBase/index.js +22 -30
  2. package/Field/FieldBase.js.map +2 -2
  3. package/Field/FieldBaseContainer/index.js +2 -3
  4. package/Field/FieldBaseContainer.js.map +2 -2
  5. package/Field/types.d.ts +0 -2
  6. package/FieldArray/index.js +0 -1
  7. package/FieldArray/index.js.map +2 -2
  8. package/FormBuilder/FormBuilder.stories.d.ts +0 -2
  9. package/FormBuilder/index.js +3 -79
  10. package/FormBuilder/index.js.map +2 -2
  11. package/MultiplicityField/index.js +0 -1
  12. package/MultiplicityField/index.js.map +2 -2
  13. package/cjs/Field/FieldBase/index.js +21 -29
  14. package/cjs/Field/FieldBase.js.map +2 -2
  15. package/cjs/Field/FieldBaseContainer/index.js +2 -3
  16. package/cjs/Field/FieldBaseContainer.js.map +2 -2
  17. package/cjs/Field/types.js.map +1 -1
  18. package/cjs/FieldArray/index.js +0 -1
  19. package/cjs/FieldArray/index.js.map +2 -2
  20. package/cjs/FormBuilder/index.js +3 -79
  21. package/cjs/FormBuilder/index.js.map +2 -2
  22. package/cjs/MultiplicityField/index.js +0 -1
  23. package/cjs/MultiplicityField/index.js.map +2 -2
  24. package/cjs/inputs/Input/index.js +0 -1
  25. package/cjs/inputs/Input/index.js.map +2 -2
  26. package/cjs/lazy/index.js +0 -2
  27. package/cjs/lazy.js.map +2 -2
  28. package/cjs/registry/index.js +4 -6
  29. package/cjs/registry.js.map +2 -2
  30. package/cjs/validators/index.js +12 -18
  31. package/cjs/validators/index.js.map +2 -2
  32. package/cjs/validators/utils/int/index.js +1 -1
  33. package/cjs/validators/utils/int.js.map +2 -2
  34. package/cjs/validators/utils/number/index.js +1 -1
  35. package/cjs/validators/utils/number.js.map +2 -2
  36. package/index.js +1 -1
  37. package/inputs/Input/Input.stories.d.ts +0 -1
  38. package/inputs/Input/index.js +0 -1
  39. package/inputs/Input/index.js.map +2 -2
  40. package/lazy/index.js +0 -2
  41. package/package.json +4 -4
  42. package/registry/index.js +4 -6
  43. package/src/Field/FieldBase.tsx +22 -33
  44. package/src/Field/FieldBaseContainer.tsx +2 -3
  45. package/src/Field/types.tsx +0 -2
  46. package/src/FieldArray/index.test.tsx +14 -13
  47. package/src/FieldArray/index.tsx +0 -1
  48. package/src/FormBuilder/FormBuilder.stories.js +0 -2
  49. package/src/FormBuilder/index.test.tsx +1 -9
  50. package/src/FormBuilder/index.tsx +5 -88
  51. package/src/FormBuilder/scenarios.test.tsx +4 -111
  52. package/src/MultiplicityField/index.test.tsx +26 -25
  53. package/src/MultiplicityField/index.tsx +0 -1
  54. package/src/Questions/__snapshots__/index.spec.tsx.snap +1 -2
  55. package/src/Questions/index.spec.tsx +0 -8
  56. package/src/Questions/index.test.tsx +11 -10
  57. package/src/inputs/AutoCompleteInput/index.test.tsx +14 -13
  58. package/src/inputs/Checkboxes/index.test.tsx +17 -16
  59. package/src/inputs/DateInput/index.test.tsx +11 -10
  60. package/src/inputs/FileInput/index.test.tsx +11 -10
  61. package/src/inputs/ImageInput/index.test.tsx +20 -19
  62. package/src/inputs/Input/Input.stories.js +0 -1
  63. package/src/inputs/Input/__stories__/TextWithLimit.tsx +0 -1
  64. package/src/inputs/Input/index.test.tsx +38 -41
  65. package/src/inputs/Input/index.tsx +0 -1
  66. package/src/inputs/Label/index.test.tsx +11 -10
  67. package/src/inputs/OtpInput/index.test.tsx +11 -10
  68. package/src/inputs/Radio/index.test.tsx +17 -16
  69. package/src/inputs/Select/index.test.tsx +11 -10
  70. package/src/lazy.js +0 -2
  71. package/src/registry.js +4 -6
  72. package/src/validators/index.ts +13 -38
  73. package/src/validators/utils/int.ts +1 -1
  74. package/src/validators/utils/number.ts +1 -1
  75. package/validators/index.js +12 -18
  76. package/validators/index.js.map +2 -2
  77. package/validators/utils/int/index.js +1 -1
  78. package/validators/utils/int.js.map +2 -2
  79. package/validators/utils/number/index.js +1 -1
  80. package/validators/utils/number.js.map +2 -2
  81. package/Field/ErrorGroup/index.js +0 -48
  82. package/Field/ErrorGroup/package.json +0 -6
  83. package/Field/ErrorGroup.d.ts +0 -15
  84. package/Field/ErrorGroup.js.map +0 -7
  85. package/FormBuilder/__stories__/AutoErrorGrouping.d.ts +0 -3
  86. package/FormBuilder/__stories__/ErrorGrouping.d.ts +0 -3
  87. package/FormBuilder/interaction.test.d.ts +0 -1
  88. package/cjs/Field/ErrorGroup/index.js +0 -82
  89. package/cjs/Field/ErrorGroup.js.map +0 -7
  90. package/inputs/Input/__stories__/StringWithTrimValidation.d.ts +0 -3
  91. package/src/Field/ErrorGroup.tsx +0 -84
  92. package/src/FormBuilder/__stories__/AutoErrorGrouping.tsx +0 -63
  93. package/src/FormBuilder/__stories__/ErrorGrouping.tsx +0 -43
  94. package/src/FormBuilder/interaction.test.tsx +0 -32
  95. package/src/inputs/Input/__stories__/StringWithTrimValidation.tsx +0 -26
@@ -1,16 +1,14 @@
1
1
  import React, { useCallback, useContext, useRef } from 'react';
2
2
  import { useForm } from 'react-hook-form';
3
3
  import { Field } from '@digigov/form/Field';
4
- import { ErrorGroup } from '@digigov/form/Field/ErrorGroup';
5
4
  import { CONTROLLED_FIELD_COMPONENTS } from '@digigov/form/Field/utils';
6
- import { FieldsetWithContext } from '@digigov/form/Fieldset/FieldsetWithContext';
5
+ import { Fieldset } from '@digigov/form/Fieldset';
7
6
  import { FormContext } from '@digigov/form/FormContext';
8
7
  import { FormBaseProps, FormData, FormBuilderProps } from '@digigov/form/types';
9
8
  import { yupResolver } from '@digigov/form/utils';
10
9
  import { useValidationSchema } from '@digigov/form/validators';
11
10
  import { Button } from '@digigov/ui/form/Button';
12
11
  import { Form } from '@digigov/ui/form/Form';
13
- import { useScreenSize } from '@digigov/ui/utils/hooks/useScreen';
14
12
 
15
13
  const FormBase = React.forwardRef(function FormBase(
16
14
  {
@@ -81,43 +79,6 @@ const FormBase = React.forwardRef(function FormBase(
81
79
  );
82
80
  });
83
81
 
84
- const DEFAULT_LAYOUT = {
85
- xs: 12,
86
- sm: 12,
87
- md: 12,
88
- lg: 12,
89
- xl: 12,
90
- };
91
-
92
- const BREAKPOINTS = ['xs', 'sm', 'md', 'lg', 'xl'];
93
-
94
- const groupFieldsByLayout = (fields) => {
95
- return BREAKPOINTS.reduce((sizes, size) => {
96
- sizes[size] = fields
97
- .reduce((acc, item) => {
98
- const layoutValue = item.layout?.[size] || 12;
99
- if (layoutValue === 0) {
100
- return [...acc, item];
101
- }
102
- const lastElement = acc[acc.length - 1];
103
- const currentSum = Array.isArray(lastElement)
104
- ? lastElement.reduce((sum, i) => sum + (i.layout?.[size] || 0), 0)
105
- : 0;
106
- if (!Array.isArray(lastElement) || currentSum + layoutValue > 12) {
107
- return layoutValue === 12 ? [...acc, item] : [...acc, [item]];
108
- }
109
-
110
- return [...acc.slice(0, -1), [...lastElement, item]];
111
- }, [])
112
- .map((item) => {
113
- if (Array.isArray(item) && item.length === 1) {
114
- return item[0];
115
- }
116
- return item;
117
- });
118
- return sizes;
119
- }, {});
120
- };
121
82
  const useFormContext = () => {
122
83
  return useContext(FormContext);
123
84
  };
@@ -144,34 +105,6 @@ const FormBuilder = React.forwardRef(function FormBuilder(
144
105
  }: FormBuilderProps,
145
106
  ref: React.Ref<HTMLFormElement>
146
107
  ): React.ReactElement {
147
- const { screenSize } = useScreenSize();
148
- fields = fields.map((field) => {
149
- const layout = field.layout;
150
- if (!layout) {
151
- return {
152
- ...field,
153
- layout: DEFAULT_LAYOUT,
154
- };
155
- }
156
- return {
157
- ...field,
158
- layout: BREAKPOINTS.reduce(
159
- (expandedLayout, breakpoint, breakpointIndex) => {
160
- if (field?.layout?.[breakpoint]) {
161
- expandedLayout[breakpoint] = field?.layout[breakpoint];
162
- } else if (expandedLayout[BREAKPOINTS[breakpointIndex - 1]]) {
163
- expandedLayout[breakpoint] =
164
- expandedLayout[BREAKPOINTS[breakpointIndex - 1]];
165
- } else {
166
- expandedLayout[breakpoint] = 12;
167
- }
168
- return expandedLayout;
169
- },
170
- {}
171
- ),
172
- };
173
- });
174
-
175
108
  const fieldsState = useRef(fields);
176
109
  const setFieldsState = useCallback((newFields) => {
177
110
  fieldsState.current = newFields;
@@ -207,28 +140,12 @@ const FormBuilder = React.forwardRef(function FormBuilder(
207
140
  if (auto) {
208
141
  if (fieldsets) {
209
142
  fieldChildren = fieldsets.map((fieldset) => (
210
- <FieldsetWithContext key={fieldset.key} name={fieldset.key} />
143
+ <Fieldset key={fieldset.key} />
211
144
  ));
212
145
  } else if (fields) {
213
- const fieldsByLayouts = groupFieldsByLayout(fields);
214
- const fieldsByLayoutSize = fieldsByLayouts[screenSize];
215
- fieldChildren = fieldsByLayoutSize.map((item, index) => {
216
- if (Array.isArray(item)) {
217
- return (
218
- <ErrorGroup
219
- key={index}
220
- screenSize={screenSize}
221
- fieldOrder={item.map((field) => field.key)}
222
- >
223
- {item.map((f) => {
224
- return <Field key={f.key} name={f.key} />;
225
- })}
226
- </ErrorGroup>
227
- );
228
- } else {
229
- return <Field key={item.key} name={item.key} />;
230
- }
231
- });
146
+ fieldChildren = fields.map((field) => (
147
+ <Field key={field.key} name={field.key} />
148
+ ));
232
149
  }
233
150
  }
234
151
  }
@@ -469,11 +469,7 @@ const expectErrorMessages = async (formBuilder, scenarioExpect, expect) => {
469
469
  );
470
470
  }
471
471
  }
472
- if (expectObj.textAssertion === 'toContainText') {
473
- await expect(labelLocator).toContainText(expectText);
474
- } else {
475
- await expect(labelLocator).toHaveText(expectText);
476
- }
472
+ await expect(labelLocator).toHaveText(expectText);
477
473
  }
478
474
  }
479
475
  };
@@ -1293,54 +1289,6 @@ const INPUTS_INPUT_FIELDS = [
1293
1289
  },
1294
1290
  ];
1295
1291
 
1296
- const ERROR_GROUPING_FIELDS = [
1297
- {
1298
- key: 'address',
1299
- type: 'string',
1300
- required: true,
1301
- layout: { xl: 6, lg: 6, md: 6, xs: 6 },
1302
- label: {
1303
- primary: 'Οδός',
1304
- },
1305
- },
1306
- {
1307
- key: 'address_number',
1308
- type: 'int',
1309
- required: true,
1310
- layout: { xl: 2, lg: 2, md: 2, xs: 6 },
1311
- label: {
1312
- primary: 'Αριθμός',
1313
- },
1314
- },
1315
- {
1316
- key: 'postal_code',
1317
- type: 'postal_code',
1318
- required: true,
1319
- layout: { xl: 4, lg: 4, md: 4, xs: 6 },
1320
- label: {
1321
- primary: 'Ταχ. Κώδικας',
1322
- },
1323
- },
1324
- {
1325
- key: 'town',
1326
- type: 'string',
1327
- required: true,
1328
- layout: { xl: 6, lg: 6, md: 6, xs: 6 },
1329
- label: {
1330
- primary: 'Πόλη',
1331
- },
1332
- },
1333
- {
1334
- key: 'country',
1335
- type: 'string',
1336
- required: true,
1337
- layout: { xl: 6, lg: 6, md: 6, xs: 6 },
1338
- label: {
1339
- primary: 'Χώρα',
1340
- },
1341
- },
1342
- ];
1343
-
1344
1292
  const inputsInputScenarios = [
1345
1293
  {
1346
1294
  title: 'success fill for inputs Input',
@@ -1462,7 +1410,7 @@ const inputsInputScenarios = [
1462
1410
  {
1463
1411
  title: 'empty fill for inputs Input',
1464
1412
  describe: 'inputs Input scenario',
1465
- fields: [...INPUTS_INPUT_FIELDS, ...ERROR_GROUPING_FIELDS],
1413
+ fields: INPUTS_INPUT_FIELDS,
1466
1414
  fill: [],
1467
1415
  expect: [
1468
1416
  {
@@ -1520,42 +1468,12 @@ const inputsInputScenarios = [
1520
1468
  fieldKey: 'uuid4',
1521
1469
  text: el.form.error.required,
1522
1470
  },
1523
- {
1524
- type: 'error',
1525
- fieldKey: 'address',
1526
- text: el.form.error.required,
1527
- textAssertion: 'toContainText',
1528
- },
1529
- {
1530
- type: 'error',
1531
- fieldKey: 'address_number',
1532
- text: el.form.error.required,
1533
- textAssertion: 'toContainText',
1534
- },
1535
- {
1536
- type: 'error',
1537
- fieldKey: 'postal_code',
1538
- text: el.form.error.required,
1539
- textAssertion: 'toContainText',
1540
- },
1541
- {
1542
- type: 'error',
1543
- fieldKey: 'town',
1544
- text: el.form.error.required,
1545
- textAssertion: 'toContainText',
1546
- },
1547
- {
1548
- type: 'error',
1549
- fieldKey: 'country',
1550
- text: el.form.error.required,
1551
- textAssertion: 'toContainText',
1552
- },
1553
1471
  ],
1554
1472
  },
1555
1473
  {
1556
1474
  title: 'incorrect types for inputs Input',
1557
1475
  describe: 'inputs Input scenario',
1558
- fields: [...INPUTS_INPUT_FIELDS, ...ERROR_GROUPING_FIELDS],
1476
+ fields: INPUTS_INPUT_FIELDS,
1559
1477
  fill: [
1560
1478
  {
1561
1479
  fieldKey: 'age',
@@ -1601,14 +1519,6 @@ const inputsInputScenarios = [
1601
1519
  fieldKey: 'uuid4',
1602
1520
  value: 'aaaaaa',
1603
1521
  },
1604
- {
1605
- fieldKey: 'address_number',
1606
- value: 'aa',
1607
- },
1608
- {
1609
- fieldKey: 'postal_code',
1610
- value: 'aaaaa',
1611
- },
1612
1522
  ],
1613
1523
  expect: [
1614
1524
  {
@@ -1666,18 +1576,6 @@ const inputsInputScenarios = [
1666
1576
  fieldKey: 'uuid4',
1667
1577
  text: el.form.error.uuid4,
1668
1578
  },
1669
- {
1670
- type: 'error',
1671
- fieldKey: 'address_number',
1672
- text: el.form.error.number,
1673
- textAssertion: 'toContainText',
1674
- },
1675
- {
1676
- type: 'error',
1677
- fieldKey: 'postal_code',
1678
- text: el.form.error.postalCode,
1679
- textAssertion: 'toContainText',
1680
- },
1681
1579
  ],
1682
1580
  },
1683
1581
  ];
@@ -1949,12 +1847,7 @@ for (const scenario of scenarios) {
1949
1847
  test(scenario.title, async ({ mount, page }) => {
1950
1848
  const formBuilder = await mount(
1951
1849
  // @ts-ignore
1952
- <FormBuilder
1953
- auto={true}
1954
- grid={true}
1955
- fields={scenario.fields}
1956
- onSubmit={() => {}}
1957
- />
1850
+ <FormBuilder auto={true} fields={scenario.fields} onSubmit={() => {}} />
1958
1851
  );
1959
1852
  await fillFields(page, formBuilder, scenario);
1960
1853
  await submitForm(formBuilder);
@@ -1,40 +1,41 @@
1
1
  import React from 'react';
2
2
  import { test, expect } from '@playwright/experimental-ct-react';
3
- import TestVariant from '@digigov/ui/utils/TestVariant'
4
3
  import { Default } from '@digigov/form/MultiplicityField/__stories__/Default';
5
4
  import { PreviewDisplay } from '@digigov/form/MultiplicityField/__stories__/PreviewDisplay';
6
5
  import { WithExactLength } from '@digigov/form/MultiplicityField/__stories__/WithExactLength';
7
6
  import { WithMaxLength } from '@digigov/form/MultiplicityField/__stories__/WithMaxLength';
8
7
  import { WithMinAndMaxLength } from '@digigov/form/MultiplicityField/__stories__/WithMinAndMaxLength';
9
8
  import { WithMinLength } from '@digigov/form/MultiplicityField/__stories__/WithMinLength';
9
+ import TestVariant from '@digigov/ui/utils/TestVariant';
10
10
 
11
11
  test('renders the All MultiplicityField variants', async ({ mount, page }) => {
12
12
  await mount(
13
-
14
- <div>
15
- <TestVariant title="Default">
16
- <Default />
17
- </TestVariant>
18
- <TestVariant title="PreviewDisplay">
19
- <PreviewDisplay />
20
- </TestVariant>
21
- <TestVariant title="WithExactLength">
22
- <WithExactLength />
23
- </TestVariant>
24
- <TestVariant title="WithMaxLength">
25
- <WithMaxLength />
26
- </TestVariant>
27
- <TestVariant title="WithMinAndMaxLength">
28
- <WithMinAndMaxLength />
29
- </TestVariant>
30
- <TestVariant title="WithMinLength">
31
- <WithMinLength />
32
- </TestVariant>
33
- </div>
34
- )
13
+ <div>
14
+ <TestVariant title="Default">
15
+ <Default />
16
+ </TestVariant>
17
+ <TestVariant title="PreviewDisplay">
18
+ <PreviewDisplay />
19
+ </TestVariant>
20
+ <TestVariant title="WithExactLength">
21
+ <WithExactLength />
22
+ </TestVariant>
23
+ <TestVariant title="WithMaxLength">
24
+ <WithMaxLength />
25
+ </TestVariant>
26
+ <TestVariant title="WithMinAndMaxLength">
27
+ <WithMinAndMaxLength />
28
+ </TestVariant>
29
+ <TestVariant title="WithMinLength">
30
+ <WithMinLength />
31
+ </TestVariant>
32
+ </div>
33
+ );
35
34
  await page.evaluate(() => document.fonts.ready);
36
35
 
37
- const screenshot = await page.screenshot({ fullPage: true, animations: 'disabled' });
36
+ const screenshot = await page.screenshot({
37
+ fullPage: true,
38
+ animations: 'disabled',
39
+ });
38
40
  expect(screenshot).toMatchSnapshot();
39
41
  });
40
-
@@ -57,7 +57,6 @@ export const Multiplicity: React.FC<MultiplicityProps> = ({
57
57
  ? error
58
58
  : undefined
59
59
  }
60
- hasError={formState.isSubmitted && !formState.isSubmitting && !!error}
61
60
  wrapper="fieldset"
62
61
  name={name}
63
62
  >
@@ -45,7 +45,7 @@ exports[`renders the Questions 1`] = `
45
45
  class="ds-form"
46
46
  >
47
47
  <div
48
- class="ds-field xs:ds-grid__col-span-12 sm:ds-grid__col-span-12 md:ds-grid__col-span-12 lg:ds-grid__col-span-12 xl:ds-grid__col-span-12"
48
+ class="ds-field xs:ds-grid__col-span-12"
49
49
  >
50
50
  <label
51
51
  class="ds-label"
@@ -64,7 +64,6 @@ exports[`renders the Questions 1`] = `
64
64
  aria-required="true"
65
65
  class="ds-input"
66
66
  data-type="string"
67
- id="name"
68
67
  name="name"
69
68
  type="text"
70
69
  />
@@ -46,14 +46,6 @@ const steps = [
46
46
  },
47
47
  ];
48
48
 
49
- beforeAll(() => {
50
- global.ResizeObserver = class ResizeObserver {
51
- observe() {}
52
- unobserve() {}
53
- disconnect() {}
54
- };
55
- });
56
-
57
49
  it('renders the Questions', () => {
58
50
  expect(
59
51
  render(
@@ -1,20 +1,21 @@
1
1
  import React from 'react';
2
2
  import { test, expect } from '@playwright/experimental-ct-react';
3
- import TestVariant from '@digigov/ui/utils/TestVariant'
4
3
  import { Default } from '@digigov/form/Questions/__stories__/Default';
4
+ import TestVariant from '@digigov/ui/utils/TestVariant';
5
5
 
6
6
  test('renders the All Questions variants', async ({ mount, page }) => {
7
7
  await mount(
8
-
9
- <div>
10
- <TestVariant title="Default">
11
- <Default />
12
- </TestVariant>
13
- </div>
14
- )
8
+ <div>
9
+ <TestVariant title="Default">
10
+ <Default />
11
+ </TestVariant>
12
+ </div>
13
+ );
15
14
  await page.evaluate(() => document.fonts.ready);
16
15
 
17
- const screenshot = await page.screenshot({ fullPage: true, animations: 'disabled' });
16
+ const screenshot = await page.screenshot({
17
+ fullPage: true,
18
+ animations: 'disabled',
19
+ });
18
20
  expect(screenshot).toMatchSnapshot();
19
21
  });
20
-
@@ -1,24 +1,25 @@
1
1
  import React from 'react';
2
2
  import { test, expect } from '@playwright/experimental-ct-react';
3
- import TestVariant from '@digigov/ui/utils/TestVariant'
4
3
  import { Default } from '@digigov/form/inputs/AutoCompleteInput/__stories__/Default';
5
4
  import { Multiple } from '@digigov/form/inputs/AutoCompleteInput/__stories__/Multiple';
5
+ import TestVariant from '@digigov/ui/utils/TestVariant';
6
6
 
7
7
  test('renders the All AutoCompleteInput variants', async ({ mount, page }) => {
8
8
  await mount(
9
-
10
- <div>
11
- <TestVariant title="Default">
12
- <Default />
13
- </TestVariant>
14
- <TestVariant title="Multiple">
15
- <Multiple />
16
- </TestVariant>
17
- </div>
18
- )
9
+ <div>
10
+ <TestVariant title="Default">
11
+ <Default />
12
+ </TestVariant>
13
+ <TestVariant title="Multiple">
14
+ <Multiple />
15
+ </TestVariant>
16
+ </div>
17
+ );
19
18
  await page.evaluate(() => document.fonts.ready);
20
19
 
21
- const screenshot = await page.screenshot({ fullPage: true, animations: 'disabled' });
20
+ const screenshot = await page.screenshot({
21
+ fullPage: true,
22
+ animations: 'disabled',
23
+ });
22
24
  expect(screenshot).toMatchSnapshot();
23
25
  });
24
-
@@ -1,28 +1,29 @@
1
1
  import React from 'react';
2
2
  import { test, expect } from '@playwright/experimental-ct-react';
3
- import TestVariant from '@digigov/ui/utils/TestVariant'
4
3
  import { Conditional } from '@digigov/form/inputs/Checkboxes/__stories__/Conditional';
5
4
  import { Default } from '@digigov/form/inputs/Checkboxes/__stories__/Default';
6
5
  import { WithDivider } from '@digigov/form/inputs/Checkboxes/__stories__/WithDivider';
6
+ import TestVariant from '@digigov/ui/utils/TestVariant';
7
7
 
8
8
  test('renders the All Checkboxes variants', async ({ mount, page }) => {
9
9
  await mount(
10
-
11
- <div>
12
- <TestVariant title="Conditional">
13
- <Conditional />
14
- </TestVariant>
15
- <TestVariant title="Default">
16
- <Default />
17
- </TestVariant>
18
- <TestVariant title="WithDivider">
19
- <WithDivider />
20
- </TestVariant>
21
- </div>
22
- )
10
+ <div>
11
+ <TestVariant title="Conditional">
12
+ <Conditional />
13
+ </TestVariant>
14
+ <TestVariant title="Default">
15
+ <Default />
16
+ </TestVariant>
17
+ <TestVariant title="WithDivider">
18
+ <WithDivider />
19
+ </TestVariant>
20
+ </div>
21
+ );
23
22
  await page.evaluate(() => document.fonts.ready);
24
23
 
25
- const screenshot = await page.screenshot({ fullPage: true, animations: 'disabled' });
24
+ const screenshot = await page.screenshot({
25
+ fullPage: true,
26
+ animations: 'disabled',
27
+ });
26
28
  expect(screenshot).toMatchSnapshot();
27
29
  });
28
-
@@ -1,20 +1,21 @@
1
1
  import React from 'react';
2
2
  import { test, expect } from '@playwright/experimental-ct-react';
3
- import TestVariant from '@digigov/ui/utils/TestVariant'
4
3
  import { Default } from '@digigov/form/inputs/DateInput/__stories__/Default';
4
+ import TestVariant from '@digigov/ui/utils/TestVariant';
5
5
 
6
6
  test('renders the All DateInput variants', async ({ mount, page }) => {
7
7
  await mount(
8
-
9
- <div>
10
- <TestVariant title="Default">
11
- <Default />
12
- </TestVariant>
13
- </div>
14
- )
8
+ <div>
9
+ <TestVariant title="Default">
10
+ <Default />
11
+ </TestVariant>
12
+ </div>
13
+ );
15
14
  await page.evaluate(() => document.fonts.ready);
16
15
 
17
- const screenshot = await page.screenshot({ fullPage: true, animations: 'disabled' });
16
+ const screenshot = await page.screenshot({
17
+ fullPage: true,
18
+ animations: 'disabled',
19
+ });
18
20
  expect(screenshot).toMatchSnapshot();
19
21
  });
20
-
@@ -1,20 +1,21 @@
1
1
  import React from 'react';
2
2
  import { test, expect } from '@playwright/experimental-ct-react';
3
- import TestVariant from '@digigov/ui/utils/TestVariant'
4
3
  import { Default } from '@digigov/form/inputs/FileInput/__stories__/Default';
4
+ import TestVariant from '@digigov/ui/utils/TestVariant';
5
5
 
6
6
  test('renders the All FileInput variants', async ({ mount, page }) => {
7
7
  await mount(
8
-
9
- <div>
10
- <TestVariant title="Default">
11
- <Default />
12
- </TestVariant>
13
- </div>
14
- )
8
+ <div>
9
+ <TestVariant title="Default">
10
+ <Default />
11
+ </TestVariant>
12
+ </div>
13
+ );
15
14
  await page.evaluate(() => document.fonts.ready);
16
15
 
17
- const screenshot = await page.screenshot({ fullPage: true, animations: 'disabled' });
16
+ const screenshot = await page.screenshot({
17
+ fullPage: true,
18
+ animations: 'disabled',
19
+ });
18
20
  expect(screenshot).toMatchSnapshot();
19
21
  });
20
-
@@ -1,32 +1,33 @@
1
1
  import React from 'react';
2
2
  import { test, expect } from '@playwright/experimental-ct-react';
3
- import TestVariant from '@digigov/ui/utils/TestVariant'
4
3
  import { Default } from '@digigov/form/inputs/ImageInput/__stories__/Default';
5
4
  import { MaxSize } from '@digigov/form/inputs/ImageInput/__stories__/MaxSize';
6
5
  import { WithInvalidImageDimension } from '@digigov/form/inputs/ImageInput/__stories__/WithInvalidImageDimension';
7
6
  import { WithInvalidImageSize } from '@digigov/form/inputs/ImageInput/__stories__/WithInvalidImageSize';
7
+ import TestVariant from '@digigov/ui/utils/TestVariant';
8
8
 
9
9
  test('renders the All ImageInput variants', async ({ mount, page }) => {
10
10
  await mount(
11
-
12
- <div>
13
- <TestVariant title="Default">
14
- <Default />
15
- </TestVariant>
16
- <TestVariant title="MaxSize">
17
- <MaxSize />
18
- </TestVariant>
19
- <TestVariant title="WithInvalidImageDimension">
20
- <WithInvalidImageDimension />
21
- </TestVariant>
22
- <TestVariant title="WithInvalidImageSize">
23
- <WithInvalidImageSize />
24
- </TestVariant>
25
- </div>
26
- )
11
+ <div>
12
+ <TestVariant title="Default">
13
+ <Default />
14
+ </TestVariant>
15
+ <TestVariant title="MaxSize">
16
+ <MaxSize />
17
+ </TestVariant>
18
+ <TestVariant title="WithInvalidImageDimension">
19
+ <WithInvalidImageDimension />
20
+ </TestVariant>
21
+ <TestVariant title="WithInvalidImageSize">
22
+ <WithInvalidImageSize />
23
+ </TestVariant>
24
+ </div>
25
+ );
27
26
  await page.evaluate(() => document.fonts.ready);
28
27
 
29
- const screenshot = await page.screenshot({ fullPage: true, animations: 'disabled' });
28
+ const screenshot = await page.screenshot({
29
+ fullPage: true,
30
+ animations: 'disabled',
31
+ });
30
32
  expect(screenshot).toMatchSnapshot();
31
33
  });
32
-
@@ -5,7 +5,6 @@ export default {
5
5
  displayName: 'Input',
6
6
  };
7
7
  export { String } from '@digigov/form/inputs/Input/__stories__/String';
8
- export { StringWithTrimValidation } from '@digigov/form/inputs/Input/__stories__/StringWithTrimValidation';
9
8
  export { Integer } from '@digigov/form/inputs/Input/__stories__/Integer';
10
9
  export { Boolean } from '@digigov/form/inputs/Input/__stories__/Boolean';
11
10
  export { PhoneNumber } from '@digigov/form/inputs/Input/__stories__/PhoneNumber';
@@ -12,7 +12,6 @@ export const TextWithLimit = () => (
12
12
  key="text"
13
13
  name="text"
14
14
  type="text"
15
- trim
16
15
  label={{
17
16
  primary: 'Μπορείτε να δώσετε περισσότερες πληροφορίες;',
18
17
  }}