@ukhomeoffice/cop-react-form-renderer 6.16.0-beta → 7.0.0-charlie
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.
- package/dist/components/CheckYourAnswers/Answer.js +5 -2
- package/dist/components/CheckYourAnswers/Answer.test.js +8 -7
- package/dist/components/CheckYourAnswers/CheckYourAnswers.js +86 -68
- package/dist/components/CheckYourAnswers/CheckYourAnswers.test.js +22 -22
- package/dist/components/CollectionPage/CollectionPage.js +3 -3
- package/dist/components/CollectionPage/CollectionPage.test.js +12 -12
- package/dist/components/CollectionSummary/BannerStrip.js +22 -21
- package/dist/components/CollectionSummary/BannerStrip.test.js +8 -8
- package/dist/components/CollectionSummary/CollectionSummary.js +105 -99
- package/dist/components/CollectionSummary/CollectionSummary.test.js +23 -19
- package/dist/components/CollectionSummary/Confirmation.js +16 -10
- package/dist/components/CollectionSummary/Confirmation.test.js +12 -11
- package/dist/components/CollectionSummary/RenderListView.js +78 -65
- package/dist/components/CollectionSummary/RenderListView.test.js +18 -12
- package/dist/components/CollectionSummary/SummaryCard.js +83 -72
- package/dist/components/CollectionSummary/SummaryCard.test.js +105 -101
- package/dist/components/CollectionSummary/SummaryCardButtons.js +17 -13
- package/dist/components/CollectionSummary/SummaryCardButtons.test.js +3 -2
- package/dist/components/CollectionSummary/SummaryCardDetails.js +72 -67
- package/dist/components/CollectionSummary/SummaryCardDetails.test.js +12 -12
- package/dist/components/CollectionSummary/SummaryCardValidationContext.js +6 -5
- package/dist/components/CollectionSummary/SummaryCardValidationContext.test.js +29 -13
- package/dist/components/FormComponent/Collection.js +91 -82
- package/dist/components/FormComponent/Collection.test.js +16 -15
- package/dist/components/FormComponent/Container.js +21 -22
- package/dist/components/FormComponent/Container.test.js +9 -8
- package/dist/components/FormComponent/FormComponent.js +7 -8
- package/dist/components/FormComponent/FormComponent.test.js +18 -13
- package/dist/components/FormPage/FormPage.js +29 -23
- package/dist/components/FormPage/FormPage.test.js +10 -10
- package/dist/components/FormRenderer/FormRenderer.js +81 -92
- package/dist/components/FormRenderer/FormRenderer.test.js +23 -24
- package/dist/components/FormRenderer/clear-uncompleted-routes/test-data/forms/form-hidden-component-with-nested-questions-visible-elsewhere.json +118 -0
- package/dist/components/FormRenderer/clear-uncompleted-routes/test-data/forms/form-nested-answers-hidden-by-option-visible-elsewhere.json +113 -0
- package/dist/components/FormRenderer/clear-uncompleted-routes/test-data/forms/form-page-nested-component.json +26003 -0
- package/dist/components/FormRenderer/clear-uncompleted-routes/test-data/input/data-hidden-component-with-nested-questions-visible-elsewhere.json +12 -0
- package/dist/components/FormRenderer/clear-uncompleted-routes/test-data/input/data-nested-answers-hidden-by-option-visible-elsewhere.json +12 -0
- package/dist/components/FormRenderer/clear-uncompleted-routes/test-data/input/data-page-nested-component.json +63 -0
- package/dist/components/FormRenderer/clear-uncompleted-routes/test-data/output/data-hidden-component-with-nested-questions-visible-elsewhere-removed.json +11 -0
- package/dist/components/FormRenderer/clear-uncompleted-routes/test-data/output/data-nested-answers-hidden-by-option-visible-elsewhere-removed.json +12 -0
- package/dist/components/FormRenderer/clear-uncompleted-routes/test-data/output/data-page-nested-component.json +63 -0
- package/dist/components/FormRenderer/helpers/clearOutUncompletedRoutes.js +18 -16
- package/dist/components/FormRenderer/helpers/clearOutUncompletedRoutes.test.js +31 -0
- package/dist/components/FormRenderer/helpers/clearOutUncompletedRoutesUtils.js +44 -35
- package/dist/components/FormRenderer/helpers/clearOutUncompletedRoutesUtils.test.js +1 -2
- package/dist/components/PageActions/ActionButton.js +12 -6
- package/dist/components/PageActions/ActionButton.test.js +5 -5
- package/dist/components/PageActions/PageActions.js +7 -5
- package/dist/components/PageActions/PageActions.test.js +5 -4
- package/dist/components/SummaryList/GroupAction.js +14 -8
- package/dist/components/SummaryList/GroupAction.test.js +5 -4
- package/dist/components/SummaryList/RowAction.js +12 -6
- package/dist/components/SummaryList/RowAction.test.js +5 -4
- package/dist/components/SummaryList/SummaryList.js +54 -49
- package/dist/components/SummaryList/SummaryList.test.js +33 -19
- package/dist/components/SummaryList/SummaryListHeadingRow.js +9 -3
- package/dist/components/SummaryList/SummaryListHeadingRowWithAction.js +20 -12
- package/dist/components/SummaryList/SummaryListRow.js +16 -11
- package/dist/components/SummaryList/SummaryListTitleRow.js +7 -3
- package/dist/components/TaskList/Task.js +20 -17
- package/dist/components/TaskList/Task.test.js +8 -7
- package/dist/components/TaskList/TaskList.js +68 -45
- package/dist/components/TaskList/TaskList.test.js +11 -11
- package/dist/components/TaskList/TaskState.js +5 -3
- package/dist/components/TaskList/TaskState.test.js +8 -7
- package/dist/context/HooksContext/HooksContext.js +6 -5
- package/dist/context/HooksContext/HooksContext.test.js +14 -6
- package/dist/context/HooksContext/index.js +1 -2
- package/dist/context/ValidationContext/ValidationContext.js +6 -5
- package/dist/context/ValidationContext/ValidationContext.test.js +33 -9
- package/dist/context/ValidationContext/index.js +1 -2
- package/dist/hooks/index.js +1 -2
- package/dist/hooks/useRefData.js +1 -2
- package/dist/index.js +1 -2
- package/dist/setupTests.js +23 -18
- package/dist/utils/CheckYourAnswers/getCYARowForGroup.js +19 -16
- package/dist/utils/CheckYourAnswers/getSummaryListRowForDetails.js +5 -5
- package/dist/utils/CollectionPage/getQuickEditPage.js +2 -2
- package/dist/utils/Component/cleanAttributes.test.js +1 -2
- package/dist/utils/Component/getComponent.js +38 -28
- package/dist/utils/Component/getDefaultValueFromConfig.js +1 -2
- package/dist/utils/Component/isEditable.test.js +1 -2
- package/dist/utils/Component/wrapInFormGroup.js +10 -4
- package/dist/utils/Format/formatDataForComponent.test.js +1 -2
- package/dist/utils/Format/formatDataForPage.test.js +1 -2
- package/dist/utils/Validate/validateDate.test.js +1 -2
- package/dist/utils/Validate/validateMultifile.test.js +1 -2
- package/package.json +43 -13
|
@@ -8,10 +8,14 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
8
8
|
var _copReactComponents = require("@ukhomeoffice/cop-react-components");
|
|
9
9
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
10
10
|
var _getGroupActionAttributes = _interopRequireDefault(require("./helpers/getGroupActionAttributes"));
|
|
11
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
12
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
-
function
|
|
13
|
-
function
|
|
14
|
-
function
|
|
13
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
14
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
15
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
16
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
17
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
18
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } // Global imports
|
|
15
19
|
// Local imports
|
|
16
20
|
const GroupAction = _ref => {
|
|
17
21
|
let {
|
|
@@ -24,11 +28,13 @@ const GroupAction = _ref => {
|
|
|
24
28
|
if (!(group !== null && group !== void 0 && group.action)) {
|
|
25
29
|
return null;
|
|
26
30
|
}
|
|
27
|
-
return /*#__PURE__*/
|
|
28
|
-
"aria-label": "".concat(group.action.label, " ").concat(group.action.aria_suffix)
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
31
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_copReactComponents.Link, _objectSpread(_objectSpread({}, attrs), {}, {
|
|
32
|
+
"aria-label": "".concat(group.action.label, " ").concat(group.action.aria_suffix),
|
|
33
|
+
children: [group.action.label, group.action.aria_suffix && /*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
|
|
34
|
+
className: "mobile-text govuk-link",
|
|
35
|
+
children: [' ', "".concat(group.action.aria_suffix)]
|
|
36
|
+
})]
|
|
37
|
+
}));
|
|
32
38
|
};
|
|
33
39
|
GroupAction.propTypes = {
|
|
34
40
|
group: _propTypes.default.shape({
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
var _react = require("@testing-library/react");
|
|
4
4
|
var _react2 = _interopRequireDefault(require("react"));
|
|
5
5
|
var _GroupAction = _interopRequireDefault(require("./GroupAction"));
|
|
6
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
6
7
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
7
8
|
// Global imports
|
|
8
9
|
|
|
@@ -14,7 +15,7 @@ describe('components', () => {
|
|
|
14
15
|
const ROW = {};
|
|
15
16
|
const {
|
|
16
17
|
container
|
|
17
|
-
} = (0, _react.render)(/*#__PURE__*/
|
|
18
|
+
} = (0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_GroupAction.default, {
|
|
18
19
|
group: ROW
|
|
19
20
|
}));
|
|
20
21
|
expect(container.childNodes.length).toEqual(0);
|
|
@@ -29,7 +30,7 @@ describe('components', () => {
|
|
|
29
30
|
};
|
|
30
31
|
const {
|
|
31
32
|
container
|
|
32
|
-
} = (0, _react.render)(/*#__PURE__*/
|
|
33
|
+
} = (0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_GroupAction.default, {
|
|
33
34
|
group: ROW
|
|
34
35
|
}));
|
|
35
36
|
const link = container.childNodes[0];
|
|
@@ -48,7 +49,7 @@ describe('components', () => {
|
|
|
48
49
|
};
|
|
49
50
|
const {
|
|
50
51
|
container
|
|
51
|
-
} = (0, _react.render)(/*#__PURE__*/
|
|
52
|
+
} = (0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_GroupAction.default, {
|
|
52
53
|
group: ROW
|
|
53
54
|
}));
|
|
54
55
|
const link = container.childNodes[0];
|
|
@@ -69,7 +70,7 @@ describe('components', () => {
|
|
|
69
70
|
};
|
|
70
71
|
const {
|
|
71
72
|
container
|
|
72
|
-
} = (0, _react.render)(/*#__PURE__*/
|
|
73
|
+
} = (0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_GroupAction.default, {
|
|
73
74
|
group: ROW
|
|
74
75
|
}));
|
|
75
76
|
const link = container.childNodes[0];
|
|
@@ -8,13 +8,15 @@ var _copReactComponents = require("@ukhomeoffice/cop-react-components");
|
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
10
10
|
var _helpers = require("./helpers");
|
|
11
|
-
|
|
12
|
-
function _interopRequireWildcard(e, r) { if (!
|
|
11
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
13
13
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
15
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
16
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
17
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
18
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } // Global imports
|
|
16
19
|
// Local imports
|
|
17
|
-
|
|
18
20
|
const RowAction = _ref => {
|
|
19
21
|
let {
|
|
20
22
|
row
|
|
@@ -26,7 +28,11 @@ const RowAction = _ref => {
|
|
|
26
28
|
if (!row.action) {
|
|
27
29
|
return null;
|
|
28
30
|
}
|
|
29
|
-
return /*#__PURE__*/
|
|
31
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_copReactComponents.Link, _objectSpread(_objectSpread({}, attrs), {}, {
|
|
32
|
+
children: [row.action.label, row.action.aria_suffix && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_copReactComponents.VisuallyHidden, {
|
|
33
|
+
children: [" ", row.action.aria_suffix]
|
|
34
|
+
})]
|
|
35
|
+
}));
|
|
30
36
|
};
|
|
31
37
|
RowAction.propTypes = {
|
|
32
38
|
row: _propTypes.default.shape({
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
var _react = require("@testing-library/react");
|
|
4
4
|
var _react2 = _interopRequireDefault(require("react"));
|
|
5
5
|
var _RowAction = _interopRequireDefault(require("./RowAction"));
|
|
6
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
6
7
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
7
8
|
// Global imports
|
|
8
9
|
|
|
@@ -14,7 +15,7 @@ describe('components', () => {
|
|
|
14
15
|
const ROW = {};
|
|
15
16
|
const {
|
|
16
17
|
container
|
|
17
|
-
} = (0, _react.render)(/*#__PURE__*/
|
|
18
|
+
} = (0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_RowAction.default, {
|
|
18
19
|
row: ROW
|
|
19
20
|
}));
|
|
20
21
|
expect(container.childNodes.length).toEqual(0);
|
|
@@ -29,7 +30,7 @@ describe('components', () => {
|
|
|
29
30
|
};
|
|
30
31
|
const {
|
|
31
32
|
container
|
|
32
|
-
} = (0, _react.render)(/*#__PURE__*/
|
|
33
|
+
} = (0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_RowAction.default, {
|
|
33
34
|
row: ROW
|
|
34
35
|
}));
|
|
35
36
|
const link = container.childNodes[0];
|
|
@@ -48,7 +49,7 @@ describe('components', () => {
|
|
|
48
49
|
};
|
|
49
50
|
const {
|
|
50
51
|
container
|
|
51
|
-
} = (0, _react.render)(/*#__PURE__*/
|
|
52
|
+
} = (0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_RowAction.default, {
|
|
52
53
|
row: ROW
|
|
53
54
|
}));
|
|
54
55
|
const link = container.childNodes[0];
|
|
@@ -69,7 +70,7 @@ describe('components', () => {
|
|
|
69
70
|
};
|
|
70
71
|
const {
|
|
71
72
|
container
|
|
72
|
-
} = (0, _react.render)(/*#__PURE__*/
|
|
73
|
+
} = (0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_RowAction.default, {
|
|
73
74
|
row: ROW
|
|
74
75
|
}));
|
|
75
76
|
const link = container.childNodes[0];
|
|
@@ -13,13 +13,18 @@ var _SummaryListHeadingRow = _interopRequireDefault(require("./SummaryListHeadin
|
|
|
13
13
|
var _SummaryListHeadingRowWithAction = _interopRequireDefault(require("./SummaryListHeadingRowWithAction"));
|
|
14
14
|
var _SummaryListTitleRow = _interopRequireDefault(require("./SummaryListTitleRow"));
|
|
15
15
|
require("./SummaryList.scss");
|
|
16
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
16
17
|
const _excluded = ["rows", "noChangeAction", "noGroupAction", "isGroup", "classBlock", "classModifiers", "className"]; // Global imports
|
|
17
18
|
// Local imports
|
|
18
19
|
// Styles
|
|
19
20
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
20
|
-
function
|
|
21
|
-
function
|
|
22
|
-
function
|
|
21
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
22
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
23
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
24
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
25
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
26
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
27
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
23
28
|
const DEFAULT_CLASS = exports.DEFAULT_CLASS = 'govuk-summary-list';
|
|
24
29
|
const SummaryList = _ref => {
|
|
25
30
|
let {
|
|
@@ -39,52 +44,52 @@ const SummaryList = _ref => {
|
|
|
39
44
|
const rowActions = rows.filter(r => !!r.action);
|
|
40
45
|
groupActionRow = rowActions !== null && rowActions !== void 0 && rowActions.length ? rowActions[0] : null;
|
|
41
46
|
}
|
|
42
|
-
return /*#__PURE__*/
|
|
43
|
-
className: "group-of-rows"
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
})
|
|
47
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
48
|
+
className: "group-of-rows",
|
|
49
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("dl", _objectSpread(_objectSpread({}, cleanedHtmlAttrs), {}, {
|
|
50
|
+
className: classes(),
|
|
51
|
+
children: [rows.map(row => {
|
|
52
|
+
const key = "".concat(row.pageId, "_").concat(row.full_path || row.fieldId);
|
|
53
|
+
if (row.type === 'title') {
|
|
54
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_SummaryListTitleRow.default, {
|
|
55
|
+
title: row.key,
|
|
56
|
+
classes: classes
|
|
57
|
+
}, key);
|
|
58
|
+
}
|
|
59
|
+
if (row.type === 'heading') {
|
|
60
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_SummaryListHeadingRow.default, {
|
|
61
|
+
title: row.key,
|
|
62
|
+
size: row.size || 's',
|
|
63
|
+
classes: classes
|
|
64
|
+
}, key);
|
|
65
|
+
}
|
|
66
|
+
if (row.type === 'headingWithAction') {
|
|
67
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_SummaryListHeadingRowWithAction.default, {
|
|
68
|
+
row: row,
|
|
69
|
+
classes: classes,
|
|
70
|
+
noChangeAction: noChangeAction
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
if (row.type === 'action') {
|
|
74
|
+
return noChangeAction ? null : /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
75
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_GroupAction.default, {
|
|
76
|
+
group: row
|
|
77
|
+
})
|
|
78
|
+
}, "".concat(key, "-actions"));
|
|
79
|
+
}
|
|
80
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_SummaryListRow.default, {
|
|
81
|
+
row: row,
|
|
82
|
+
classes: classes,
|
|
83
|
+
showAction: !noChangeAction
|
|
84
|
+
}, key);
|
|
85
|
+
}).filter(r => !!r), isGroup && !noGroupAction && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
86
|
+
className: "change-group-button",
|
|
87
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_GroupAction.default, {
|
|
88
|
+
group: groupActionRow
|
|
89
|
+
})
|
|
90
|
+
})]
|
|
91
|
+
}))
|
|
92
|
+
});
|
|
88
93
|
};
|
|
89
94
|
SummaryList.propTypes = {
|
|
90
95
|
classBlock: _propTypes.default.string,
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
var _react = require("@testing-library/react");
|
|
4
4
|
var _react2 = _interopRequireDefault(require("react"));
|
|
5
5
|
var _SummaryList = _interopRequireWildcard(require("./SummaryList"));
|
|
6
|
-
|
|
7
|
-
function _interopRequireWildcard(e, r) { if (!
|
|
6
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
7
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
8
8
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
9
|
// Global imports
|
|
10
10
|
|
|
@@ -76,7 +76,7 @@ describe('components', () => {
|
|
|
76
76
|
const ROWS = [];
|
|
77
77
|
const {
|
|
78
78
|
container
|
|
79
|
-
} = (0, _react.render)(/*#__PURE__*/
|
|
79
|
+
} = (0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_SummaryList.default, {
|
|
80
80
|
"data-testid": ID,
|
|
81
81
|
rows: ROWS
|
|
82
82
|
}));
|
|
@@ -98,7 +98,7 @@ describe('components', () => {
|
|
|
98
98
|
}];
|
|
99
99
|
const {
|
|
100
100
|
container
|
|
101
|
-
} = (0, _react.render)(/*#__PURE__*/
|
|
101
|
+
} = (0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_SummaryList.default, {
|
|
102
102
|
"data-testid": ID,
|
|
103
103
|
rows: ROWS,
|
|
104
104
|
noGroupAction: true
|
|
@@ -132,7 +132,7 @@ describe('components', () => {
|
|
|
132
132
|
}];
|
|
133
133
|
const {
|
|
134
134
|
container
|
|
135
|
-
} = (0, _react.render)(/*#__PURE__*/
|
|
135
|
+
} = (0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_SummaryList.default, {
|
|
136
136
|
"data-testid": ID,
|
|
137
137
|
rows: ROWS
|
|
138
138
|
}));
|
|
@@ -185,7 +185,7 @@ describe('components', () => {
|
|
|
185
185
|
}];
|
|
186
186
|
const {
|
|
187
187
|
container
|
|
188
|
-
} = (0, _react.render)(/*#__PURE__*/
|
|
188
|
+
} = (0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_SummaryList.default, {
|
|
189
189
|
"data-testid": ID,
|
|
190
190
|
rows: ROWS
|
|
191
191
|
}));
|
|
@@ -228,7 +228,7 @@ describe('components', () => {
|
|
|
228
228
|
}];
|
|
229
229
|
const {
|
|
230
230
|
container
|
|
231
|
-
} = (0, _react.render)(/*#__PURE__*/
|
|
231
|
+
} = (0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_SummaryList.default, {
|
|
232
232
|
"data-testid": ID,
|
|
233
233
|
rows: ROWS,
|
|
234
234
|
noChangeAction: true
|
|
@@ -243,16 +243,20 @@ describe('components', () => {
|
|
|
243
243
|
key: 'a',
|
|
244
244
|
pageId: 'p1',
|
|
245
245
|
fieldId: 'a',
|
|
246
|
-
value: /*#__PURE__*/
|
|
246
|
+
value: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
247
|
+
children: VALUES[0]
|
|
248
|
+
})
|
|
247
249
|
}, {
|
|
248
250
|
key: 'b',
|
|
249
251
|
pageId: 'p2',
|
|
250
252
|
fieldId: 'b',
|
|
251
|
-
value: /*#__PURE__*/
|
|
253
|
+
value: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
254
|
+
children: VALUES[1]
|
|
255
|
+
})
|
|
252
256
|
}];
|
|
253
257
|
const {
|
|
254
258
|
container
|
|
255
|
-
} = (0, _react.render)(/*#__PURE__*/
|
|
259
|
+
} = (0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_SummaryList.default, {
|
|
256
260
|
"data-testid": ID,
|
|
257
261
|
rows: ROWS
|
|
258
262
|
}));
|
|
@@ -295,7 +299,7 @@ describe('components', () => {
|
|
|
295
299
|
}];
|
|
296
300
|
const {
|
|
297
301
|
container
|
|
298
|
-
} = (0, _react.render)(/*#__PURE__*/
|
|
302
|
+
} = (0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_SummaryList.default, {
|
|
299
303
|
"data-testid": ID,
|
|
300
304
|
rows: ROWS
|
|
301
305
|
}));
|
|
@@ -339,7 +343,7 @@ describe('components', () => {
|
|
|
339
343
|
}];
|
|
340
344
|
const {
|
|
341
345
|
container
|
|
342
|
-
} = (0, _react.render)(/*#__PURE__*/
|
|
346
|
+
} = (0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_SummaryList.default, {
|
|
343
347
|
"data-testid": ID,
|
|
344
348
|
rows: ROWS
|
|
345
349
|
}));
|
|
@@ -364,16 +368,20 @@ describe('components', () => {
|
|
|
364
368
|
key: 'a',
|
|
365
369
|
pageId: 'p1',
|
|
366
370
|
fieldId: 'a',
|
|
367
|
-
value: /*#__PURE__*/
|
|
371
|
+
value: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
372
|
+
children: VALUES[0]
|
|
373
|
+
})
|
|
368
374
|
}, {
|
|
369
375
|
key: 'b',
|
|
370
376
|
pageId: 'p2',
|
|
371
377
|
fieldId: 'b',
|
|
372
|
-
value: /*#__PURE__*/
|
|
378
|
+
value: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
379
|
+
children: VALUES[1]
|
|
380
|
+
})
|
|
373
381
|
}];
|
|
374
382
|
const {
|
|
375
383
|
container
|
|
376
|
-
} = (0, _react.render)(/*#__PURE__*/
|
|
384
|
+
} = (0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_SummaryList.default, {
|
|
377
385
|
"data-testid": ID,
|
|
378
386
|
rows: ROWS,
|
|
379
387
|
noChangeAction: true
|
|
@@ -397,7 +405,9 @@ describe('components', () => {
|
|
|
397
405
|
key: 'a',
|
|
398
406
|
pageId: 'p1',
|
|
399
407
|
fieldId: 'a',
|
|
400
|
-
value: /*#__PURE__*/
|
|
408
|
+
value: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
409
|
+
children: VALUES[0]
|
|
410
|
+
}),
|
|
401
411
|
action: {
|
|
402
412
|
label: 'action'
|
|
403
413
|
}
|
|
@@ -405,16 +415,20 @@ describe('components', () => {
|
|
|
405
415
|
key: 'b',
|
|
406
416
|
pageId: 'p1',
|
|
407
417
|
fieldId: 'b',
|
|
408
|
-
value: /*#__PURE__*/
|
|
418
|
+
value: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
419
|
+
children: VALUES[1]
|
|
420
|
+
})
|
|
409
421
|
}, {
|
|
410
422
|
key: 'c',
|
|
411
423
|
pageId: 'p1',
|
|
412
424
|
fieldId: 'c',
|
|
413
|
-
value: /*#__PURE__*/
|
|
425
|
+
value: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
426
|
+
children: VALUES[2]
|
|
427
|
+
})
|
|
414
428
|
}];
|
|
415
429
|
const {
|
|
416
430
|
container
|
|
417
|
-
} = (0, _react.render)(/*#__PURE__*/
|
|
431
|
+
} = (0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_SummaryList.default, {
|
|
418
432
|
"data-testid": ID,
|
|
419
433
|
rows: ROWS,
|
|
420
434
|
isGroup: ISGROUP
|
|
@@ -7,6 +7,7 @@ exports.default = void 0;
|
|
|
7
7
|
var _copReactComponents = require("@ukhomeoffice/cop-react-components");
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
9
|
var _react = _interopRequireDefault(require("react"));
|
|
10
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
11
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
12
|
// Global imports
|
|
12
13
|
|
|
@@ -16,9 +17,14 @@ const SummaryListHeadingRow = _ref => {
|
|
|
16
17
|
size,
|
|
17
18
|
classes
|
|
18
19
|
} = _ref;
|
|
19
|
-
return /*#__PURE__*/
|
|
20
|
-
className: "".concat(classes('heading'))
|
|
21
|
-
|
|
20
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
21
|
+
className: "".concat(classes('heading')),
|
|
22
|
+
children: [size === 's' && /*#__PURE__*/(0, _jsxRuntime.jsx)(_copReactComponents.SmallHeading, {
|
|
23
|
+
children: title
|
|
24
|
+
}), size === 'm' && /*#__PURE__*/(0, _jsxRuntime.jsx)(_copReactComponents.MediumHeading, {
|
|
25
|
+
children: title
|
|
26
|
+
})]
|
|
27
|
+
});
|
|
22
28
|
};
|
|
23
29
|
SummaryListHeadingRow.propTypes = {
|
|
24
30
|
classes: _propTypes.default.func.isRequired,
|
|
@@ -9,6 +9,7 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
9
9
|
var _react = _interopRequireDefault(require("react"));
|
|
10
10
|
var _RowAction = _interopRequireDefault(require("./RowAction"));
|
|
11
11
|
require("./SummaryListHeadingRowWithAction.scss");
|
|
12
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
13
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
14
|
// Global imports
|
|
14
15
|
|
|
@@ -22,18 +23,25 @@ const SummaryListHeadingRowWithAction = _ref => {
|
|
|
22
23
|
classes,
|
|
23
24
|
noChangeAction
|
|
24
25
|
} = _ref;
|
|
25
|
-
return /*#__PURE__*/
|
|
26
|
-
className: classes('headingWithAction')
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
|
|
26
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
27
|
+
className: classes('headingWithAction'),
|
|
28
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("td", {
|
|
29
|
+
className: "heading-text",
|
|
30
|
+
colSpan: "2",
|
|
31
|
+
children: [row.size === 's' && /*#__PURE__*/(0, _jsxRuntime.jsx)(_copReactComponents.SmallHeading, {
|
|
32
|
+
children: row.key
|
|
33
|
+
}), row.size === 'm' && /*#__PURE__*/(0, _jsxRuntime.jsx)(_copReactComponents.MediumHeading, {
|
|
34
|
+
children: row.key
|
|
35
|
+
})]
|
|
36
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("td", {
|
|
37
|
+
className: "heading-action",
|
|
38
|
+
children: !noChangeAction && /*#__PURE__*/(0, _jsxRuntime.jsx)(_RowAction.default, {
|
|
39
|
+
row: {
|
|
40
|
+
action: row.action
|
|
41
|
+
}
|
|
42
|
+
})
|
|
43
|
+
})]
|
|
44
|
+
});
|
|
37
45
|
};
|
|
38
46
|
SummaryListHeadingRowWithAction.propTypes = {
|
|
39
47
|
classes: _propTypes.default.func.isRequired,
|
|
@@ -7,6 +7,7 @@ exports.default = void 0;
|
|
|
7
7
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _RowAction = _interopRequireDefault(require("./RowAction"));
|
|
10
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
11
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
12
|
// Global imports
|
|
12
13
|
|
|
@@ -18,17 +19,21 @@ const SummaryListRow = _ref => {
|
|
|
18
19
|
classes,
|
|
19
20
|
showAction
|
|
20
21
|
} = _ref;
|
|
21
|
-
return /*#__PURE__*/
|
|
22
|
-
className: classes('row')
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
22
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
23
|
+
className: classes('row'),
|
|
24
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("dt", {
|
|
25
|
+
className: classes('key'),
|
|
26
|
+
children: [row.key, !row.required && " (optional)"]
|
|
27
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("dd", {
|
|
28
|
+
className: classes('value'),
|
|
29
|
+
children: row.value
|
|
30
|
+
}), showAction && /*#__PURE__*/(0, _jsxRuntime.jsx)("dd", {
|
|
31
|
+
className: classes('actions'),
|
|
32
|
+
children: row.action && /*#__PURE__*/(0, _jsxRuntime.jsx)(_RowAction.default, {
|
|
33
|
+
row: row
|
|
34
|
+
})
|
|
35
|
+
})]
|
|
36
|
+
});
|
|
32
37
|
};
|
|
33
38
|
SummaryListRow.propTypes = {
|
|
34
39
|
classes: _propTypes.default.func.isRequired,
|
|
@@ -7,6 +7,7 @@ exports.default = void 0;
|
|
|
7
7
|
var _copReactComponents = require("@ukhomeoffice/cop-react-components");
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
9
|
var _react = _interopRequireDefault(require("react"));
|
|
10
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
11
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
12
|
// Global imports
|
|
12
13
|
|
|
@@ -15,9 +16,12 @@ const SummaryListTitleRow = _ref => {
|
|
|
15
16
|
title,
|
|
16
17
|
classes
|
|
17
18
|
} = _ref;
|
|
18
|
-
return /*#__PURE__*/
|
|
19
|
-
className: "".concat(classes('row'), " ").concat(classes('title'))
|
|
20
|
-
|
|
19
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
20
|
+
className: "".concat(classes('row'), " ").concat(classes('title')),
|
|
21
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_copReactComponents.SmallHeading, {
|
|
22
|
+
children: title
|
|
23
|
+
})
|
|
24
|
+
});
|
|
21
25
|
};
|
|
22
26
|
SummaryListTitleRow.propTypes = {
|
|
23
27
|
title: _propTypes.default.string.isRequired,
|