@ukhomeoffice/cop-react-form-renderer 3.26.1 → 3.28.0

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.
@@ -152,6 +152,7 @@ var FormComponent = function FormComponent(_ref) {
152
152
  content: _utils.default.interpolateString(component.content, formData),
153
153
  hint: _utils.default.interpolateString(component.hint, formData),
154
154
  cya_label: _utils.default.interpolateString(component.cya_label, formData),
155
+ suffix: _utils.default.interpolateString(component.suffix, formData),
155
156
  options: options,
156
157
  value: value || _utils.default.Component.defaultValue(component),
157
158
  onChange: onComponentChangeExtended,
@@ -191,7 +191,7 @@ var InternalFormRenderer = function InternalFormRenderer(_ref2) {
191
191
 
192
192
 
193
193
  (0, _react.useEffect)(function () {
194
- if (components && _pages && _data && (['load', 'submit'].includes(pagePoint) || viewOnly)) {
194
+ if (components && _pages && _data && (pagePoint === 'load' || viewOnly)) {
195
195
  var _data$formStatus;
196
196
 
197
197
  setData(_utils.default.Data.setupForm(_pages, components, _data));
@@ -68,11 +68,11 @@ var TaskList = function TaskList(_ref) {
68
68
  return /*#__PURE__*/_react.default.createElement("div", _extends({}, attrs, {
69
69
  className: classes()
70
70
  }), refNumber && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("h2", {
71
- className: "hods-task-reference-description govuk-heading-s govuk-!-margin-bottom-2 govuk-!-padding-right-1"
71
+ className: "govuk-heading-s govuk-!-margin-bottom-0"
72
72
  }, "".concat(refTitle)), /*#__PURE__*/_react.default.createElement("h2", {
73
73
  className: "govuk-heading-s govuk-!-font-weight-regular"
74
74
  }, "".concat(refNumber))), numberOfSections !== numberOfCompleteSections && /*#__PURE__*/_react.default.createElement("h2", {
75
- className: "govuk-heading-s govuk-!-margin-bottom-2"
75
+ className: "govuk-heading-s govuk-!-margin-bottom-0"
76
76
  }, "Incomplete form"), /*#__PURE__*/_react.default.createElement("p", {
77
77
  className: "govuk-body govuk-!-margin-bottom-7"
78
78
  }, "You have completed ".concat(numberOfCompleteSections, " of ").concat(numberOfSections, " sections")), sections.map(function (section, index) {
@@ -7,11 +7,13 @@
7
7
  padding-left: 0;
8
8
  margin-top: 0;
9
9
  margin-bottom: 0;
10
+
10
11
  @include govuk-media-query($from: tablet) {
11
12
  min-width: 550px;
12
13
  }
14
+
13
15
  .hods-task-list__items {
14
- font-size: 19px;
16
+ font-size: 19px;
15
17
  @include govuk-responsive-margin(9, 'bottom');
16
18
  list-style: none;
17
19
  padding-left: 0;
@@ -21,8 +23,14 @@
21
23
 
22
24
  .hods-task-list__section {
23
25
  display: table;
24
- font-size: 24px;
25
- font-weight: bold;
26
+ font-size: 1.25rem;
27
+ font-weight: bold;
28
+
29
+ @include govuk-media-query($from: tablet) {
30
+ font-size: 1.5rem;
31
+ line-height: 1.875rem;
32
+ }
33
+
26
34
  }
27
35
 
28
36
  .hods-task-list__section-number {
@@ -40,6 +48,7 @@
40
48
  padding-top: govuk-spacing(2);
41
49
  padding-bottom: govuk-spacing(2);
42
50
  @include govuk-clearfix;
51
+
43
52
  &:first-child {
44
53
  border-top: 1px solid $govuk-border-colour;
45
54
  }
@@ -48,13 +57,20 @@
48
57
  .hods-task-list__task-name {
49
58
  display: block;
50
59
  cursor: auto;
60
+ font-size: 1rem;
61
+
62
+ @include govuk-media-query($from: tablet) {
63
+ font-size: 1.1875rem;
64
+ }
65
+
51
66
  @include govuk-media-query($from: 450px) {
52
67
  float: left;
53
68
  }
69
+
54
70
  font-weight: normal;
55
71
  }
56
72
 
57
- .hods-task-reference-description{
73
+ .hods-task-reference-description {
58
74
  @include govuk-media-query($from: 450px) {
59
75
  float: left;
60
76
  }
@@ -66,6 +82,8 @@
66
82
  // avoid breaking task lists in existing prototypes.
67
83
  .hods-task-list__tag,
68
84
  .hods-task-list__task-completed {
85
+ letter-spacing: 0;
86
+ padding: 0.25rem 0.5rem;
69
87
  margin-top: govuk-spacing(2);
70
88
  margin-bottom: govuk-spacing(1);
71
89
 
@@ -33,6 +33,10 @@ var showComponentCYA = function showComponentCYA(options, data) {
33
33
  return false;
34
34
  }
35
35
 
36
+ if (options.hasOwnProperty('show_on_cya') && !options.show_on_cya) {
37
+ return false;
38
+ }
39
+
36
40
  if (options.type === _models.ComponentTypes.CONTAINER) {
37
41
  return _Container.default.show(options, data);
38
42
  }
@@ -13,6 +13,11 @@ describe('utils', function () {
13
13
  it('should not show when there are no options', function () {
14
14
  expect((0, _showComponentCYA.default)(null, null)).toBeFalsy();
15
15
  });
16
+ it('should not show when show_on_cya is defined and falsy', function () {
17
+ expect((0, _showComponentCYA.default)({
18
+ show_on_cya: false
19
+ })).toBeFalsy();
20
+ });
16
21
  it('should not show when it is a heading type', function () {
17
22
  expect((0, _showComponentCYA.default)({
18
23
  type: _models.ComponentTypes.HEADING
@@ -34,6 +39,11 @@ describe('utils', function () {
34
39
  disabled: true
35
40
  }, null)).toBeFalsy();
36
41
  });
42
+ it('should show when show_on_cya is defined and truthy', function () {
43
+ expect((0, _showComponentCYA.default)({
44
+ show_on_cya: true
45
+ })).toBeTruthy();
46
+ });
37
47
  it('should show when it hidden but not disabled', function () {
38
48
  expect((0, _showComponentCYA.default)({
39
49
  hidden: true
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ukhomeoffice/cop-react-form-renderer",
3
- "version": "3.26.1",
3
+ "version": "3.28.0",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "clean": "rimraf dist",