@ukhomeoffice/formio-gds-template 1.1.0 → 2.0.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.
@@ -0,0 +1,41 @@
1
+ /*!
2
+ * https://github.com/Starcounter-Jack/JSON-Patch
3
+ * (c) 2017-2021 Joachim Wester
4
+ * MIT license
5
+ */
6
+
7
+ /*!
8
+ * https://github.com/Starcounter-Jack/JSON-Patch
9
+ * (c) 2017-2022 Joachim Wester
10
+ * MIT licensed
11
+ */
12
+
13
+ /*! @license DOMPurify 3.1.5 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.1.5/LICENSE */
14
+
15
+ /*! Native Promise Only
16
+ v0.8.1 (c) Kyle Simpson
17
+ MIT License: http://getify.mit-license.org
18
+ */
19
+
20
+ /**
21
+ * @license
22
+ * Lodash <https://lodash.com/>
23
+ * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
24
+ * Released under MIT license <https://lodash.com/license>
25
+ * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
26
+ * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
27
+ */
28
+
29
+ //! Copyright (c) JS Foundation and other contributors
30
+
31
+ //! github.com/moment/moment-timezone
32
+
33
+ //! license : MIT
34
+
35
+ //! moment-timezone.js
36
+
37
+ //! moment.js
38
+
39
+ //! moment.js locale configuration
40
+
41
+ //! version : 0.5.45
@@ -3,10 +3,12 @@ var __extends = (this && this.__extends) || (function () {
3
3
  var extendStatics = function (d, b) {
4
4
  extendStatics = Object.setPrototypeOf ||
5
5
  ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
7
  return extendStatics(d, b);
8
8
  };
9
9
  return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
10
12
  extendStatics(d, b);
11
13
  function __() { this.constructor = d; }
12
14
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
@@ -3,21 +3,25 @@ var __extends = (this && this.__extends) || (function () {
3
3
  var extendStatics = function (d, b) {
4
4
  extendStatics = Object.setPrototypeOf ||
5
5
  ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
7
  return extendStatics(d, b);
8
8
  };
9
9
  return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
10
12
  extendStatics(d, b);
11
13
  function __() { this.constructor = d; }
12
14
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
13
15
  };
14
16
  })();
15
- var __spreadArrays = (this && this.__spreadArrays) || function () {
16
- for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
17
- for (var r = Array(s), k = 0, i = 0; i < il; i++)
18
- for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
19
- r[k] = a[j];
20
- return r;
17
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
18
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
19
+ if (ar || !(i in from)) {
20
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
21
+ ar[i] = from[i];
22
+ }
23
+ }
24
+ return to.concat(ar || Array.prototype.slice.call(from));
21
25
  };
22
26
  Object.defineProperty(exports, "__esModule", { value: true });
23
27
  var formiojs_1 = require("formiojs");
@@ -43,6 +47,7 @@ var GDSDatetimeComponent = /** @class */ (function (_super) {
43
47
  configurable: true
44
48
  });
45
49
  Object.defineProperty(GDSDatetimeComponent.prototype, "defaultValue", {
50
+ // @ts-ignore
46
51
  get: function () {
47
52
  var defaultValue = this.component.defaultValue;
48
53
  if (!defaultValue && this.component.defaultDate) {
@@ -55,6 +60,7 @@ var GDSDatetimeComponent = /** @class */ (function (_super) {
55
60
  configurable: true
56
61
  });
57
62
  Object.defineProperty(GDSDatetimeComponent.prototype, "emptyValue", {
63
+ // @ts-ignore
58
64
  get: function () {
59
65
  return null;
60
66
  },
@@ -136,11 +142,11 @@ var GDSDatetimeComponent = /** @class */ (function (_super) {
136
142
  };
137
143
  GDSDatetimeComponent.prototype.setErrorClasses = function (elements, dirty, hasError) {
138
144
  // @ts-ignore
139
- _super.prototype.setErrorClasses.call(this, __spreadArrays([this.refs.hour, this.refs.minute], elements), dirty, hasError);
145
+ _super.prototype.setErrorClasses.call(this, __spreadArray([this.refs.hour, this.refs.minute], elements, true), dirty, hasError);
140
146
  };
141
147
  GDSDatetimeComponent.prototype.removeInputError = function (elements) {
142
148
  // @ts-ignore
143
- _super.prototype.removeInputError.call(this, __spreadArrays([this.refs.hour, this.refs.minute], elements));
149
+ _super.prototype.removeInputError.call(this, __spreadArray([this.refs.hour, this.refs.minute], elements, true));
144
150
  };
145
151
  GDSDatetimeComponent.prototype.render = function () {
146
152
  return Field.prototype.render.call(this, this.renderTemplate('datetime', {
@@ -185,7 +191,7 @@ var GDSDatetimeComponent = /** @class */ (function (_super) {
185
191
  year = year.toString().padStart(4, 0);
186
192
  hour = hour.toString().padStart(2, 0);
187
193
  minute = minute.toString().padStart(2, 0);
188
- var toMoment = moment(year + "-" + month + "-" + day + " " + hour + ":" + minute, 'YYYY-MM-DD HH:mm');
194
+ var toMoment = moment("".concat(year, "-").concat(month, "-").concat(day, " ").concat(hour, ":").concat(minute), 'YYYY-MM-DD HH:mm');
189
195
  return toMoment.format();
190
196
  };
191
197
  GDSDatetimeComponent.prototype.getFieldValue = function (name) {
@@ -292,7 +298,7 @@ var GDSDatetimeComponent = /** @class */ (function (_super) {
292
298
  return !this.isEmpty(value);
293
299
  };
294
300
  GDSDatetimeComponent.prototype.processField = function (field, defaults, fieldIndex) {
295
- var fieldValue = this.refs["" + field] ? parseInt(this.refs["" + field].value, 10) : undefined;
301
+ var fieldValue = this.refs["".concat(field)] ? parseInt(this.refs["".concat(field)].value, 10) : undefined;
296
302
  if (fieldValue === undefined || _.isNaN(fieldValue)) {
297
303
  fieldValue = defaults[fieldIndex] && !_.isNaN(defaults[fieldIndex]) ? defaults[fieldIndex] : 0;
298
304
  }
@@ -3,10 +3,12 @@ var __extends = (this && this.__extends) || (function () {
3
3
  var extendStatics = function (d, b) {
4
4
  extendStatics = Object.setPrototypeOf ||
5
5
  ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
7
  return extendStatics(d, b);
8
8
  };
9
9
  return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
10
12
  extendStatics(d, b);
11
13
  function __() { this.constructor = d; }
12
14
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
@@ -3,21 +3,25 @@ var __extends = (this && this.__extends) || (function () {
3
3
  var extendStatics = function (d, b) {
4
4
  extendStatics = Object.setPrototypeOf ||
5
5
  ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
7
  return extendStatics(d, b);
8
8
  };
9
9
  return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
10
12
  extendStatics(d, b);
11
13
  function __() { this.constructor = d; }
12
14
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
13
15
  };
14
16
  })();
15
- var __spreadArrays = (this && this.__spreadArrays) || function () {
16
- for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
17
- for (var r = Array(s), k = 0, i = 0; i < il; i++)
18
- for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
19
- r[k] = a[j];
20
- return r;
17
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
18
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
19
+ if (ar || !(i in from)) {
20
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
21
+ ar[i] = from[i];
22
+ }
23
+ }
24
+ return to.concat(ar || Array.prototype.slice.call(from));
21
25
  };
22
26
  Object.defineProperty(exports, "__esModule", { value: true });
23
27
  var formiojs_1 = require("formiojs");
@@ -61,7 +65,7 @@ var GDSTimeComponent = /** @class */ (function (_super) {
61
65
  };
62
66
  GDSTimeComponent.prototype.setErrorClasses = function (elements, dirty, hasError) {
63
67
  // @ts-ignore
64
- _super.prototype.setErrorClasses.call(this, __spreadArrays([this.refs.hour, this.refs.minute], elements), dirty, hasError);
68
+ _super.prototype.setErrorClasses.call(this, __spreadArray([this.refs.hour, this.refs.minute], elements, true), dirty, hasError);
65
69
  };
66
70
  // @ts-ignore
67
71
  GDSTimeComponent.prototype.addInputError = function (message, dirty, element) {
@@ -80,7 +84,7 @@ var GDSTimeComponent = /** @class */ (function (_super) {
80
84
  if (!this.refs.hour.value || !this.refs.minute.value) {
81
85
  return '';
82
86
  }
83
- var value = this.refs.hour.value + ":" + this.refs.minute.value;
87
+ var value = "".concat(this.refs.hour.value, ":").concat(this.refs.minute.value);
84
88
  return moment(value, this.component.format).format(this.component.dataFormat);
85
89
  };
86
90
  GDSTimeComponent.prototype.setValue = function (value, flags) {
@@ -6,6 +6,7 @@ var __t, __p = '', __j = Array.prototype.join;
6
6
  function print() { __p += __j.call(arguments, '') }
7
7
 
8
8
 
9
+ let columnWidth;
9
10
  var columnLength = ctx.columns.length;
10
11
  switch(columnLength) {
11
12
  case 1:
@@ -26,5 +26,5 @@ exports.default = (function (iconset, name, spinning) {
26
26
  break;
27
27
  }
28
28
  }
29
- return spinning ? iconset + " " + iconset + "-" + name + " " + iconset + "-spin" : iconset + " " + iconset + "-" + name;
29
+ return spinning ? "".concat(iconset, " ").concat(iconset, "-").concat(name, " ").concat(iconset, "-spin") : "".concat(iconset, " ").concat(iconset, "-").concat(name);
30
30
  });
@@ -27,18 +27,6 @@
27
27
 
28
28
 
29
29
 
30
-
31
-
32
-
33
-
34
-
35
-
36
-
37
-
38
-
39
-
40
-
41
-
42
30
 
43
31
 
44
32
 
@@ -122,7 +110,7 @@
122
110
  }
123
111
  }
124
112
  .govuk-details {
125
- margin-bottom: 0px !important;
113
+ margin-bottom: 0 !important;
126
114
  }
127
115
 
128
116
  .small-button {
@@ -1 +1 @@
1
- {"version":3,"sourceRoot":"","sources":["../../../src/templates/gds/template.scss","../../../node_modules/govuk-frontend/govuk/vendor/_sass-mq.scss"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKE;EACE;EACA;EACA;;AAGF;AAAA;EAEE;EACA;EACA;;;AAKJ;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;AAGF;EACE;EACA;;;AAGF;EACE;IACE;;EAEF;IACE;IACA;IACA;IACA;IACA;IACA;IACA;IACA;;EAGF;IACE;;EAGF;IACE;IACA;;EAGF;IACE;;EAEF;IACE;;;AAKJ;EACE;;;AAGF;EACE;EACA;EACA;;;AAIF;EACE;;AAEA;EACE;EAGA;;;AAKJ;EACE;EACA;;;AAGF;EACE;;;ACqHM;EDhHJ;IACE;;;;AAMJ;EADF;IAEI;IACA;IACA;IACA;IACA;;;;AAIJ;EACE;EACA;EACA;;;AAGF;EACE;EACA;EACA;;;AAGF;EACE","file":"template.css"}
1
+ {"version":3,"sourceRoot":"","sources":["../../../src/templates/gds/template.scss","../../../node_modules/govuk-frontend/dist/govuk/vendor/_sass-mq.scss"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKE;EACE;EACA;EACA;;AAGF;AAAA;EAEE;EACA;EACA;;;AAKJ;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;AAGF;EACE;EACA;;;AAGF;EACE;IACE;;EAEF;IACE;IACA;IACA;IACA;IACA;IACA;IACA;IACA;;EAGF;IACE;;EAGF;IACE;IACA;;EAGF;IACE;;EAEF;IACE;;;AAKJ;EACE;;;AAGF;EACE;EACA;EACA;;;AAIF;EACE;;AAEA;EACE;EAGA;;;AAKJ;EACE;EACA;;;AAGF;EACE;;;ACqHM;EDhHJ;IACE;;;;AAMJ;EADF;IAEI;IACA;IACA;IACA;IACA;;;;AAIJ;EACE;EACA;EACA;;;AAGF;EACE;EACA;EACA;;;AAGF;EACE","file":"template.css"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ukhomeoffice/formio-gds-template",
3
- "version": "1.1.0",
3
+ "version": "2.0.1",
4
4
  "description": "Gov UK design system formio templates",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -41,43 +41,43 @@
41
41
  "homepage": "https://github.com/UKHomeOffice/formio-gds-template#readme",
42
42
  "peerDependencies": {
43
43
  "formiojs": "^4.9.26",
44
- "govuk-frontend": "^4.0.0"
44
+ "govuk-frontend": "^5.0.0"
45
45
  },
46
46
  "dependencies": {
47
- "lodash": "^4.17.15"
47
+ "lodash": "4.17.21"
48
48
  },
49
49
  "devDependencies": {
50
- "@types/chai": "^4.2.11",
51
- "@types/ejs": "^3.0.3",
52
- "@types/lodash": "4.14.186",
53
- "@types/mocha": "^7.0.2",
50
+ "@types/chai": "^4.3.16",
51
+ "@types/ejs": "^3.1.5",
52
+ "@types/lodash": "^4.17.5",
53
+ "@types/mocha": "^10.0.7",
54
54
  "@types/moment": "^2.13.0",
55
- "@types/node": "^13.13.5",
56
- "@types/node-sass": "^4.11.0",
57
- "@types/sinon": "^9.0.0",
58
- "chai": "^4.2.0",
59
- "concurrently": "^5.2.0",
60
- "css-loader": "^3.5.3",
61
- "formiojs": "^4.9.26",
62
- "govuk-frontend": "^4.0.0",
55
+ "@types/node": "^20.14.9",
56
+ "@types/node-sass": "^4.11.7",
57
+ "@types/sinon": "^17.0.3",
58
+ "chai": "^5.1.1",
59
+ "concurrently": "^8.2.2",
60
+ "css-loader": "^7.1.2",
61
+ "formiojs": "^4.19.4",
62
+ "govuk-frontend": "^5.4.0",
63
63
  "gulp": "^4.0.2",
64
64
  "gulp-insert": "^0.5.0",
65
65
  "gulp-rename": "^2.0.0",
66
66
  "gulp-template": "^5.0.0",
67
- "mocha": "^7.1.2",
68
- "moment": "^2.25.3",
69
- "nyc": "^15.0.1",
67
+ "mocha": "10.5.1",
68
+ "moment": "^2.30.1",
69
+ "nyc": "^17.0.0",
70
70
  "pre-commit": "^1.2.2",
71
71
  "sass": "^1.77.6",
72
- "sass-loader": "^8.0.2",
73
- "sinon": "^9.0.2",
74
- "style-loader": "^1.2.1",
75
- "ts-node": "^8.10.1",
76
- "ts-sinon": "^1.2.0",
72
+ "sass-loader": "^14.2.1",
73
+ "sinon": "^18.0.0",
74
+ "style-loader": "^4.0.0",
75
+ "ts-node": "^10.9.2",
76
+ "ts-sinon": "^2.0.2",
77
77
  "tslint": "^6.1.2",
78
- "typed-scss-modules": "^1.3.0",
79
- "typescript": "^3.8.3",
80
- "webpack": "^4.43.0",
81
- "webpack-cli": "^3.3.11"
78
+ "typed-scss-modules": "^8.0.1",
79
+ "typescript": "^5.5.2",
80
+ "webpack": "^5.92.1",
81
+ "webpack-cli": "^5.1.4"
82
82
  }
83
83
  }
@@ -13,8 +13,8 @@ export default class GDSDatetimeComponent extends Day {
13
13
  get format() {
14
14
  return 'DD-MM-YYYY';
15
15
  }
16
+ // @ts-ignore
16
17
  get defaultValue() {
17
-
18
18
  let defaultValue = this.component.defaultValue;
19
19
  if (!defaultValue && this.component.defaultDate) {
20
20
  defaultValue = FormioUtils.getDateSetting(this.component.defaultDate);
@@ -23,6 +23,7 @@ export default class GDSDatetimeComponent extends Day {
23
23
  return defaultValue;
24
24
  }
25
25
 
26
+ // @ts-ignore
26
27
  get emptyValue() {
27
28
  return null;
28
29
  }
@@ -1,4 +1,5 @@
1
1
  {%
2
+ let columnWidth;
2
3
  var columnLength = ctx.columns.length;
3
4
  switch(columnLength) {
4
5
  case 1:
@@ -1,6 +1,6 @@
1
- @import "../../../node_modules/govuk-frontend/govuk/settings/all";
2
- @import "../../../node_modules/govuk-frontend/govuk/tools/all";
3
- @import "../../../node_modules/govuk-frontend/govuk/helpers/all";
1
+ @import "../../../node_modules/govuk-frontend/dist/govuk/settings/index";
2
+ @import "../../../node_modules/govuk-frontend/dist/govuk/tools/index";
3
+ @import "../../../node_modules/govuk-frontend/dist/govuk/helpers/index";
4
4
 
5
5
  .govuk-checkboxes__item {
6
6
  * {
@@ -81,7 +81,7 @@
81
81
  }
82
82
 
83
83
  .govuk-details {
84
- margin-bottom: 0px !important;
84
+ margin-bottom: 0 !important;
85
85
  }
86
86
 
87
87
  .small-button {