@digigov/form 1.1.5-496927f3 → 1.2.0-01ea6f24

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 (32) hide show
  1. package/Questions/__snapshots__/index.spec.tsx.snap +30 -30
  2. package/cjs/Questions/__snapshots__/index.spec.tsx.snap +30 -30
  3. package/cjs/inputs/ImageInput/index.js +2 -2
  4. package/cjs/inputs/Input/Input.stories/index.js +12 -0
  5. package/cjs/inputs/Input/__stories__/LandlineNumber/index.js +36 -0
  6. package/cjs/inputs/Input/__stories__/MobilePhone/index.js +4 -0
  7. package/cjs/inputs/Input/__stories__/PhoneNumber/index.js +4 -1
  8. package/cjs/lazy/index.js +517 -0
  9. package/cjs/validators/utils/phone/index.js +94 -70
  10. package/index.js +1 -1
  11. package/inputs/ImageInput/index.js +2 -2
  12. package/inputs/Input/Input.stories/index.js +1 -0
  13. package/inputs/Input/Input.stories.d.ts +1 -0
  14. package/inputs/Input/__stories__/LandlineNumber/index.js +26 -0
  15. package/inputs/Input/__stories__/LandlineNumber/package.json +6 -0
  16. package/inputs/Input/__stories__/LandlineNumber.d.ts +3 -0
  17. package/inputs/Input/__stories__/MobilePhone/index.js +4 -0
  18. package/inputs/Input/__stories__/PhoneNumber/index.js +4 -1
  19. package/lazy/index.js +395 -0
  20. package/lazy/package.json +6 -0
  21. package/lazy.d.ts +69 -0
  22. package/package.json +4 -5
  23. package/src/Questions/__snapshots__/index.spec.tsx.snap +30 -30
  24. package/src/inputs/ImageInput/index.tsx +2 -2
  25. package/src/inputs/Input/Input.stories.js +1 -0
  26. package/src/inputs/Input/__stories__/LandlineNumber.tsx +27 -0
  27. package/src/inputs/Input/__stories__/MobilePhone.tsx +4 -0
  28. package/src/inputs/Input/__stories__/PhoneNumber.tsx +4 -1
  29. package/src/lazy.js +60 -0
  30. package/src/validators/utils/phone.ts +152 -72
  31. package/validators/utils/phone/index.js +92 -66
  32. package/validators/utils/phone.d.ts +2 -2
@@ -55,13 +55,13 @@ exports[`renders the Questions 1`] = `
55
55
  <ForwardRef(BackLink)>
56
56
  <ForwardRef(Base)
57
57
  as="a"
58
- className="govgr-back-link"
58
+ className="ds-back-link"
59
59
  onClick={[Function]}
60
60
  printHidden={true}
61
61
  tabIndex={0}
62
62
  >
63
63
  <a
64
- className="govgr-back-link govgr-print-hidden"
64
+ className="ds-back-link ds-print-hidden"
65
65
  onClick={[Function]}
66
66
  tabIndex={0}
67
67
  >
@@ -73,18 +73,18 @@ exports[`renders the Questions 1`] = `
73
73
  icon="caret"
74
74
  >
75
75
  <ForwardRef(SvgIcon)
76
- className="govgr-svg-icon--caret"
76
+ className="ds-svg-icon--caret"
77
77
  >
78
78
  <ForwardRef(Base)
79
79
  aria-hidden="true"
80
80
  as="svg"
81
- className="govgr-svg-icon--caret govgr-svg-icon"
81
+ className="ds-svg-icon--caret ds-svg-icon"
82
82
  focusable="false"
83
83
  viewBox="0 0 24 24"
84
84
  >
85
85
  <svg
86
86
  aria-hidden="true"
87
- className="govgr-svg-icon--caret govgr-svg-icon"
87
+ className="ds-svg-icon--caret ds-svg-icon"
88
88
  focusable="false"
89
89
  viewBox="0 0 24 24"
90
90
  >
@@ -108,19 +108,19 @@ exports[`renders the Questions 1`] = `
108
108
  <ForwardRef(PageTitleContainer)>
109
109
  <ForwardRef(Base)
110
110
  as="div"
111
- className="govgr-page-title"
111
+ className="ds-page-title"
112
112
  >
113
113
  <div
114
- className="govgr-page-title"
114
+ className="ds-page-title"
115
115
  >
116
116
  <ForwardRef(PageTitleCaption)>
117
117
  <ForwardRef(HeadingCaption)>
118
118
  <ForwardRef(Base)
119
119
  as="span"
120
- className="govgr-caption-lg"
120
+ className="ds-caption-lg"
121
121
  >
122
122
  <span
123
- className="govgr-caption-lg"
123
+ className="ds-caption-lg"
124
124
  >
125
125
  intro.caption
126
126
  </span>
@@ -132,10 +132,10 @@ exports[`renders the Questions 1`] = `
132
132
  <ForwardRef(Heading)>
133
133
  <ForwardRef(Base)
134
134
  as="h1"
135
- className="govgr-heading-xl"
135
+ className="ds-heading-xl"
136
136
  >
137
137
  <h1
138
- className="govgr-heading-xl"
138
+ className="ds-heading-xl"
139
139
  >
140
140
  intro.title
141
141
  </h1>
@@ -152,10 +152,10 @@ exports[`renders the Questions 1`] = `
152
152
  <ForwardRef(Paragraph)>
153
153
  <ForwardRef(Base)
154
154
  as="p"
155
- className="govgr-body"
155
+ className="ds-body"
156
156
  >
157
157
  <p
158
- className="govgr-body"
158
+ className="ds-body"
159
159
  >
160
160
  This is the intro
161
161
  </p>
@@ -211,11 +211,11 @@ exports[`renders the Questions 1`] = `
211
211
  >
212
212
  <ForwardRef(Base)
213
213
  as="form"
214
- className="govgr-form"
214
+ className="ds-form"
215
215
  onSubmit={[Function]}
216
216
  >
217
217
  <form
218
- className="govgr-form"
218
+ className="ds-form"
219
219
  onSubmit={[Function]}
220
220
  >
221
221
  <Field
@@ -240,7 +240,7 @@ exports[`renders the Questions 1`] = `
240
240
  "name": "name",
241
241
  "ref": <input
242
242
  aria-required="true"
243
- class="govgr-input"
243
+ class="ds-input"
244
244
  name="name"
245
245
  type="text"
246
246
  />,
@@ -357,24 +357,24 @@ exports[`renders the Questions 1`] = `
357
357
  error={false}
358
358
  >
359
359
  <ForwardRef(Grid)
360
- className="govgr-field"
360
+ className="ds-field"
361
361
  item={true}
362
362
  xs={12}
363
363
  >
364
364
  <ForwardRef(Base)
365
365
  as="div"
366
- className="govgr-field xs:govgr-grid__col-span-12"
366
+ className="ds-field xs:ds-grid__col-span-12"
367
367
  >
368
368
  <div
369
- className="govgr-field xs:govgr-grid__col-span-12"
369
+ className="ds-field xs:ds-grid__col-span-12"
370
370
  >
371
371
  <ForwardRef(LabelContainer)>
372
372
  <ForwardRef(Base)
373
373
  as="label"
374
- className="govgr-label"
374
+ className="ds-label"
375
375
  >
376
376
  <label
377
- className="govgr-label"
377
+ className="ds-label"
378
378
  >
379
379
  <Label
380
380
  label={
@@ -389,10 +389,10 @@ exports[`renders the Questions 1`] = `
389
389
  >
390
390
  <ForwardRef(Base)
391
391
  as="span"
392
- className="govgr-heading-sm"
392
+ className="ds-heading-sm"
393
393
  >
394
394
  <span
395
- className="govgr-heading-sm"
395
+ className="ds-heading-sm"
396
396
  >
397
397
  name.field.primary
398
398
  </span>
@@ -401,10 +401,10 @@ exports[`renders the Questions 1`] = `
401
401
  <ForwardRef(Hint)>
402
402
  <ForwardRef(Base)
403
403
  as="p"
404
- className="govgr-hint"
404
+ className="ds-hint"
405
405
  >
406
406
  <p
407
- className="govgr-hint"
407
+ className="ds-hint"
408
408
  >
409
409
  name.field.secondary
410
410
  </p>
@@ -424,7 +424,7 @@ exports[`renders the Questions 1`] = `
424
424
  "name": "name",
425
425
  "ref": <input
426
426
  aria-required="true"
427
- class="govgr-input"
427
+ class="ds-input"
428
428
  name="name"
429
429
  type="text"
430
430
  />,
@@ -536,7 +536,7 @@ exports[`renders the Questions 1`] = `
536
536
  <ForwardRef(Base)
537
537
  aria-required={true}
538
538
  as="input"
539
- className="govgr-input"
539
+ className="ds-input"
540
540
  disabled={false}
541
541
  name="name"
542
542
  onBlur={[Function]}
@@ -545,7 +545,7 @@ exports[`renders the Questions 1`] = `
545
545
  >
546
546
  <input
547
547
  aria-required={true}
548
- className="govgr-input"
548
+ className="ds-input"
549
549
  disabled={false}
550
550
  name="name"
551
551
  onBlur={[Function]}
@@ -570,12 +570,12 @@ exports[`renders the Questions 1`] = `
570
570
  >
571
571
  <ForwardRef(Base)
572
572
  as="button"
573
- className="govgr-btn-primary govgr-btn"
573
+ className="ds-btn-primary ds-btn"
574
574
  printHidden={true}
575
575
  type="submit"
576
576
  >
577
577
  <button
578
- className="govgr-btn-primary govgr-btn govgr-print-hidden"
578
+ className="ds-btn-primary ds-btn ds-print-hidden"
579
579
  type="submit"
580
580
  >
581
581
  Συνέχεια
@@ -55,13 +55,13 @@ exports[`renders the Questions 1`] = `
55
55
  <ForwardRef(BackLink)>
56
56
  <ForwardRef(Base)
57
57
  as="a"
58
- className="govgr-back-link"
58
+ className="ds-back-link"
59
59
  onClick={[Function]}
60
60
  printHidden={true}
61
61
  tabIndex={0}
62
62
  >
63
63
  <a
64
- className="govgr-back-link govgr-print-hidden"
64
+ className="ds-back-link ds-print-hidden"
65
65
  onClick={[Function]}
66
66
  tabIndex={0}
67
67
  >
@@ -73,18 +73,18 @@ exports[`renders the Questions 1`] = `
73
73
  icon="caret"
74
74
  >
75
75
  <ForwardRef(SvgIcon)
76
- className="govgr-svg-icon--caret"
76
+ className="ds-svg-icon--caret"
77
77
  >
78
78
  <ForwardRef(Base)
79
79
  aria-hidden="true"
80
80
  as="svg"
81
- className="govgr-svg-icon--caret govgr-svg-icon"
81
+ className="ds-svg-icon--caret ds-svg-icon"
82
82
  focusable="false"
83
83
  viewBox="0 0 24 24"
84
84
  >
85
85
  <svg
86
86
  aria-hidden="true"
87
- className="govgr-svg-icon--caret govgr-svg-icon"
87
+ className="ds-svg-icon--caret ds-svg-icon"
88
88
  focusable="false"
89
89
  viewBox="0 0 24 24"
90
90
  >
@@ -108,19 +108,19 @@ exports[`renders the Questions 1`] = `
108
108
  <ForwardRef(PageTitleContainer)>
109
109
  <ForwardRef(Base)
110
110
  as="div"
111
- className="govgr-page-title"
111
+ className="ds-page-title"
112
112
  >
113
113
  <div
114
- className="govgr-page-title"
114
+ className="ds-page-title"
115
115
  >
116
116
  <ForwardRef(PageTitleCaption)>
117
117
  <ForwardRef(HeadingCaption)>
118
118
  <ForwardRef(Base)
119
119
  as="span"
120
- className="govgr-caption-lg"
120
+ className="ds-caption-lg"
121
121
  >
122
122
  <span
123
- className="govgr-caption-lg"
123
+ className="ds-caption-lg"
124
124
  >
125
125
  intro.caption
126
126
  </span>
@@ -132,10 +132,10 @@ exports[`renders the Questions 1`] = `
132
132
  <ForwardRef(Heading)>
133
133
  <ForwardRef(Base)
134
134
  as="h1"
135
- className="govgr-heading-xl"
135
+ className="ds-heading-xl"
136
136
  >
137
137
  <h1
138
- className="govgr-heading-xl"
138
+ className="ds-heading-xl"
139
139
  >
140
140
  intro.title
141
141
  </h1>
@@ -152,10 +152,10 @@ exports[`renders the Questions 1`] = `
152
152
  <ForwardRef(Paragraph)>
153
153
  <ForwardRef(Base)
154
154
  as="p"
155
- className="govgr-body"
155
+ className="ds-body"
156
156
  >
157
157
  <p
158
- className="govgr-body"
158
+ className="ds-body"
159
159
  >
160
160
  This is the intro
161
161
  </p>
@@ -211,11 +211,11 @@ exports[`renders the Questions 1`] = `
211
211
  >
212
212
  <ForwardRef(Base)
213
213
  as="form"
214
- className="govgr-form"
214
+ className="ds-form"
215
215
  onSubmit={[Function]}
216
216
  >
217
217
  <form
218
- className="govgr-form"
218
+ className="ds-form"
219
219
  onSubmit={[Function]}
220
220
  >
221
221
  <Field
@@ -240,7 +240,7 @@ exports[`renders the Questions 1`] = `
240
240
  "name": "name",
241
241
  "ref": <input
242
242
  aria-required="true"
243
- class="govgr-input"
243
+ class="ds-input"
244
244
  name="name"
245
245
  type="text"
246
246
  />,
@@ -357,24 +357,24 @@ exports[`renders the Questions 1`] = `
357
357
  error={false}
358
358
  >
359
359
  <ForwardRef(Grid)
360
- className="govgr-field"
360
+ className="ds-field"
361
361
  item={true}
362
362
  xs={12}
363
363
  >
364
364
  <ForwardRef(Base)
365
365
  as="div"
366
- className="govgr-field xs:govgr-grid__col-span-12"
366
+ className="ds-field xs:ds-grid__col-span-12"
367
367
  >
368
368
  <div
369
- className="govgr-field xs:govgr-grid__col-span-12"
369
+ className="ds-field xs:ds-grid__col-span-12"
370
370
  >
371
371
  <ForwardRef(LabelContainer)>
372
372
  <ForwardRef(Base)
373
373
  as="label"
374
- className="govgr-label"
374
+ className="ds-label"
375
375
  >
376
376
  <label
377
- className="govgr-label"
377
+ className="ds-label"
378
378
  >
379
379
  <Label
380
380
  label={
@@ -389,10 +389,10 @@ exports[`renders the Questions 1`] = `
389
389
  >
390
390
  <ForwardRef(Base)
391
391
  as="span"
392
- className="govgr-heading-sm"
392
+ className="ds-heading-sm"
393
393
  >
394
394
  <span
395
- className="govgr-heading-sm"
395
+ className="ds-heading-sm"
396
396
  >
397
397
  name.field.primary
398
398
  </span>
@@ -401,10 +401,10 @@ exports[`renders the Questions 1`] = `
401
401
  <ForwardRef(Hint)>
402
402
  <ForwardRef(Base)
403
403
  as="p"
404
- className="govgr-hint"
404
+ className="ds-hint"
405
405
  >
406
406
  <p
407
- className="govgr-hint"
407
+ className="ds-hint"
408
408
  >
409
409
  name.field.secondary
410
410
  </p>
@@ -424,7 +424,7 @@ exports[`renders the Questions 1`] = `
424
424
  "name": "name",
425
425
  "ref": <input
426
426
  aria-required="true"
427
- class="govgr-input"
427
+ class="ds-input"
428
428
  name="name"
429
429
  type="text"
430
430
  />,
@@ -536,7 +536,7 @@ exports[`renders the Questions 1`] = `
536
536
  <ForwardRef(Base)
537
537
  aria-required={true}
538
538
  as="input"
539
- className="govgr-input"
539
+ className="ds-input"
540
540
  disabled={false}
541
541
  name="name"
542
542
  onBlur={[Function]}
@@ -545,7 +545,7 @@ exports[`renders the Questions 1`] = `
545
545
  >
546
546
  <input
547
547
  aria-required={true}
548
- className="govgr-input"
548
+ className="ds-input"
549
549
  disabled={false}
550
550
  name="name"
551
551
  onBlur={[Function]}
@@ -570,12 +570,12 @@ exports[`renders the Questions 1`] = `
570
570
  >
571
571
  <ForwardRef(Base)
572
572
  as="button"
573
- className="govgr-btn-primary govgr-btn"
573
+ className="ds-btn-primary ds-btn"
574
574
  printHidden={true}
575
575
  type="submit"
576
576
  >
577
577
  <button
578
- className="govgr-btn-primary govgr-btn govgr-print-hidden"
578
+ className="ds-btn-primary ds-btn ds-print-hidden"
579
579
  type="submit"
580
580
  >
581
581
  Συνέχεια
@@ -24,7 +24,7 @@ var Image = exports.Image = /*#__PURE__*/_react["default"].memo(function Image(_
24
24
  var src = _ref.src;
25
25
  return /*#__PURE__*/_react["default"].createElement("img", {
26
26
  src: src,
27
- className: "govgr-image--ratio"
27
+ className: "ds-image--ratio"
28
28
  });
29
29
  });
30
30
  var ImageInput = exports.ImageInput = /*#__PURE__*/_react["default"].forwardRef(function ImageInput(_ref2, ref) {
@@ -63,7 +63,7 @@ var ImageInput = exports.ImageInput = /*#__PURE__*/_react["default"].forwardRef(
63
63
  setImageUrl('');
64
64
  }, [selectedImage]);
65
65
  return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_FileUploadContainer["default"], null, selectedImage !== null ? /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_Paragraph["default"], null, /*#__PURE__*/_react["default"].createElement("b", null, t('upload.image'), ":"), " ", "".concat(selectedImage === null || selectedImage === void 0 ? void 0 : selectedImage.name))) : /*#__PURE__*/_react["default"].createElement(_Hint["default"], {
66
- className: "govgr-dashed--border"
66
+ className: "ds-dashed--border"
67
67
  }, t('upload.no_image')), /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, selectedImage !== null && /*#__PURE__*/_react["default"].createElement(Image, {
68
68
  src: imageUrl
69
69
  }), /*#__PURE__*/_react["default"].createElement(_Button.ButtonGroup, {
@@ -55,6 +55,18 @@ Object.keys(_PhoneNumber).forEach(function (key) {
55
55
  }
56
56
  });
57
57
  });
58
+ var _LandlineNumber = require("@digigov/form/inputs/Input/__stories__/LandlineNumber");
59
+ Object.keys(_LandlineNumber).forEach(function (key) {
60
+ if (key === "default" || key === "__esModule") return;
61
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
62
+ if (key in exports && exports[key] === _LandlineNumber[key]) return;
63
+ Object.defineProperty(exports, key, {
64
+ enumerable: true,
65
+ get: function get() {
66
+ return _LandlineNumber[key];
67
+ }
68
+ });
69
+ });
58
70
  var _MobilePhone = require("@digigov/form/inputs/Input/__stories__/MobilePhone");
59
71
  Object.keys(_MobilePhone).forEach(function (key) {
60
72
  if (key === "default" || key === "__esModule") return;
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ var _typeof = require("@babel/runtime/helpers/typeof");
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports["default"] = exports.LandlineNumber = void 0;
9
+ var _react = _interopRequireDefault(require("react"));
10
+ var _form = _interopRequireWildcard(require("@digigov/form"));
11
+ var _Button = require("@digigov/ui/cjs/form/Button");
12
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
13
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
14
+ var _ref = /*#__PURE__*/_react["default"].createElement(_Button.Button, {
15
+ type: "submit"
16
+ }, "\u03A3\u03C5\u03BD\u03AD\u03C7\u03B5\u03B9\u03B1");
17
+ var LandlineNumber = exports.LandlineNumber = function LandlineNumber() {
18
+ return /*#__PURE__*/_react["default"].createElement(_form["default"], {
19
+ onSubmit: function onSubmit(data) {
20
+ console.log(data);
21
+ }
22
+ }, /*#__PURE__*/_react["default"].createElement(_form.Field, {
23
+ key: "phone-number",
24
+ name: "phone-number",
25
+ type: "phone_number",
26
+ label: {
27
+ primary: 'Σταθερό τηλέφωνο'
28
+ },
29
+ extra: {
30
+ countries: ['gr'],
31
+ phoneType: 'landline'
32
+ },
33
+ required: true
34
+ }), _ref);
35
+ };
36
+ var _default = exports["default"] = LandlineNumber;
@@ -26,6 +26,10 @@ var MobilePhone = exports.MobilePhone = function MobilePhone() {
26
26
  label: {
27
27
  primary: 'Κινητό τηλέφωνο'
28
28
  },
29
+ extra: {
30
+ countries: ['gr'],
31
+ phoneType: 'mobile'
32
+ },
29
33
  required: true
30
34
  }), _ref);
31
35
  };
@@ -24,7 +24,10 @@ var PhoneNumber = exports.PhoneNumber = function PhoneNumber() {
24
24
  name: "phone-number",
25
25
  type: "phone_number",
26
26
  label: {
27
- primary: 'Σταθερό τηλέφωνο'
27
+ primary: 'Tηλέφωνο'
28
+ },
29
+ extra: {
30
+ countries: ['gr']
28
31
  },
29
32
  required: true
30
33
  }), _ref);