@ukhomeoffice/cop-react-form-renderer 5.97.2 → 5.97.4

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.
@@ -118,11 +118,13 @@ var Collection = function Collection(_ref) {
118
118
  (0, _react.useEffect)(function () {
119
119
  if (config.focusOnAdd && Array.isArray(value) && value.length) {
120
120
  if (value.length > config.minimumEntries || !config.minimumEntries) {
121
- var _value2, _document$getElementB, _focusable$;
121
+ var _value2, _document$getElementB;
122
122
  var containerId = (_value2 = value[value.length - 1]) === null || _value2 === void 0 ? void 0 : _value2.id;
123
123
  var container = (_document$getElementB = document.getElementById(containerId)) === null || _document$getElementB === void 0 ? void 0 : _document$getElementB.childNodes[0];
124
124
  var focusable = container === null || container === void 0 ? void 0 : container.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');
125
- (_focusable$ = focusable[0]) === null || _focusable$ === void 0 || _focusable$.focus();
125
+ if (focusable && focusable.length > 0) {
126
+ focusable[0].focus();
127
+ }
126
128
  }
127
129
  }
128
130
  }, [value.length, config.focusOnAdd, config.minimumEntries]);
@@ -140,7 +142,7 @@ var Collection = function Collection(_ref) {
140
142
  id: config.id,
141
143
  required: config.required,
142
144
  className: classes('title')
143
- }, config.label), value && value.map(function (item, index) {
145
+ }, config.label), Array.isArray(value) && value.map(function (item, index) {
144
146
  var _config$removeLocatio;
145
147
  var fullPath = "".concat(config.full_path || config.fieldId, "[").concat(index, "]");
146
148
  var labelCount = (config.countOffset || 0) + index + 1;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ukhomeoffice/cop-react-form-renderer",
3
- "version": "5.97.2",
3
+ "version": "5.97.4",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "clean": "rimraf dist",
@@ -16,12 +16,12 @@
16
16
  "post-compile": "rimraf dist/*.test.* dist/**/*.test.* dist/**/*.stories.* dist/docs dist/assets"
17
17
  },
18
18
  "dependencies": {
19
- "@ukhomeoffice/cop-react-components": "^3.24.4",
19
+ "@ukhomeoffice/cop-react-components": "^3.24.5",
20
20
  "axios": "^0.23.0",
21
21
  "dayjs": "^1.11.0",
22
22
  "govuk-frontend": "^4.3.1",
23
- "web-vitals": "^1.0.1",
24
- "uuid": "^8.1.0"
23
+ "uuid": "^8.1.0",
24
+ "web-vitals": "^1.0.1"
25
25
  },
26
26
  "devDependencies": {
27
27
  "@babel/cli": "^7.15.4",