@nnc-digital/nnc-design-system 0.4.15 → 0.4.17
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/build/index.esm.js
CHANGED
|
@@ -4034,7 +4034,7 @@ var FormContainer$1 = styled.div(templateObject_4 || (templateObject_4 = __makeT
|
|
|
4034
4034
|
return props.isLoading && "\n opacity: 0.5; \n pointer-events: none;\n ";
|
|
4035
4035
|
});
|
|
4036
4036
|
var ErrorTextWrapper = styled.div(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n display: block;\n width: 100%;\n"], ["\n display: block;\n width: 100%;\n"])));
|
|
4037
|
-
var DropDownSelectContainer = styled.div(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n padding-bottom: 20px;\n"], ["\n padding-bottom: 20px;\n"])));
|
|
4037
|
+
var DropDownSelectContainer = styled.div(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n padding-bottom: 20px;\n width: 90%;\n"], ["\n padding-bottom: 20px;\n width: 90%;\n"])));
|
|
4038
4038
|
var FormInnerContainer = styled.div(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n justify-content: flex-start;\n"], ["\n display: flex;\n align-items: center;\n justify-content: flex-start;\n"])));
|
|
4039
4039
|
styled.label(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n margin-right: ", ";\n"], ["\n display: flex;\n align-items: center;\n margin-right: ", ";\n"])), function (props) { return props.theme.theme_vars.spacingSizes.small; });
|
|
4040
4040
|
styled.div(templateObject_9 || (templateObject_9 = __makeTemplateObject(["\n display: flex;\n justify-content: left;\n margin-bottom: .5em;\n width: 100%;\n"], ["\n display: flex;\n justify-content: left;\n margin-bottom: .5em;\n width: 100%;\n"])));
|
|
@@ -4327,14 +4327,23 @@ var BinCollection = function (_a) {
|
|
|
4327
4327
|
fetchAddresses(enteredPostcode);
|
|
4328
4328
|
}
|
|
4329
4329
|
};
|
|
4330
|
+
var formatUKPostcode = function (postcode) {
|
|
4331
|
+
// Remove existing spaces and convert to uppercase
|
|
4332
|
+
var cleaned = postcode.replace(/\s/g, '').toUpperCase();
|
|
4333
|
+
// Add space before the last 3 characters
|
|
4334
|
+
var formatted = cleaned.slice(0, -3) + " " + cleaned.slice(-3);
|
|
4335
|
+
return formatted;
|
|
4336
|
+
};
|
|
4330
4337
|
/**
|
|
4331
4338
|
* Returns an array of address options based on the entered postcode.
|
|
4332
4339
|
*/
|
|
4333
4340
|
var fetchAddresses = function (postcode) { return __awaiter(void 0, void 0, void 0, function () {
|
|
4334
4341
|
return __generator(this, function (_a) {
|
|
4342
|
+
setCalendarEvents({});
|
|
4335
4343
|
setError(false);
|
|
4336
4344
|
setErrorText('');
|
|
4337
4345
|
setIsLoading(true);
|
|
4346
|
+
postcode = formatUKPostcode(postcode);
|
|
4338
4347
|
axios.get("".concat(BinCollectionApiUrl).concat(postcode))
|
|
4339
4348
|
.then(function (response) {
|
|
4340
4349
|
setIsLoading(false);
|
|
@@ -4418,16 +4427,51 @@ var BinCollection = function (_a) {
|
|
|
4418
4427
|
setNoResultsFound(false);
|
|
4419
4428
|
};
|
|
4420
4429
|
var formatTitle = function (apiTitle) {
|
|
4430
|
+
console.log(apiTitle);
|
|
4421
4431
|
var mappings = [
|
|
4422
|
-
{
|
|
4423
|
-
|
|
4424
|
-
|
|
4425
|
-
|
|
4432
|
+
{
|
|
4433
|
+
keyword: 'Refuse',
|
|
4434
|
+
replacement: 'General refuse bin',
|
|
4435
|
+
allowedValues: [
|
|
4436
|
+
'Refuse bin 1100l', 'Refuse bin 140l', 'Refuse bin 180l',
|
|
4437
|
+
'Refuse bin 240l', 'Refuse bin 360l', 'Refuse bin 660l',
|
|
4438
|
+
'Refuse Chamberlain', 'Refuse Palladin', 'Authorised bin (larger h/hold) 120l',
|
|
4439
|
+
'Authorised bin (larger h/hold) 140l', 'Authorised bin (larger h/hold) 180l',
|
|
4440
|
+
'Authorised bin (offensive) 140l', 'Authorised bin (offensive) 180l', 'Authorised bin (offensive) 240l',
|
|
4441
|
+
]
|
|
4442
|
+
},
|
|
4443
|
+
{
|
|
4444
|
+
keyword: 'Recycling',
|
|
4445
|
+
replacement: 'Recycling bin',
|
|
4446
|
+
allowedValues: [
|
|
4447
|
+
'Recycling 1100l', 'Recycling 140l', 'Recycling 180l',
|
|
4448
|
+
'Recycling 240l', 'Recycling bin 1100l'
|
|
4449
|
+
]
|
|
4450
|
+
},
|
|
4451
|
+
{
|
|
4452
|
+
keyword: 'Garden',
|
|
4453
|
+
replacement: 'Garden bin',
|
|
4454
|
+
allowedValues: [
|
|
4455
|
+
'Garden 140l', 'Garden 180l', 'Garden 240l'
|
|
4456
|
+
]
|
|
4457
|
+
},
|
|
4458
|
+
{
|
|
4459
|
+
keyword: 'Food',
|
|
4460
|
+
replacement: 'Food caddy',
|
|
4461
|
+
allowedValues: [
|
|
4462
|
+
'Communal food bin (exterior) 180L',
|
|
4463
|
+
'Food Caddy (exterior) 23l',
|
|
4464
|
+
'Food Caddy (indoor) 5l'
|
|
4465
|
+
]
|
|
4466
|
+
},
|
|
4426
4467
|
];
|
|
4427
4468
|
for (var _i = 0, mappings_1 = mappings; _i < mappings_1.length; _i++) {
|
|
4428
4469
|
var mapping = mappings_1[_i];
|
|
4429
|
-
|
|
4430
|
-
|
|
4470
|
+
for (var _a = 0, _b = mapping.allowedValues; _a < _b.length; _a++) {
|
|
4471
|
+
var value = _b[_a];
|
|
4472
|
+
if (apiTitle.includes(value)) {
|
|
4473
|
+
return mapping.replacement;
|
|
4474
|
+
}
|
|
4431
4475
|
}
|
|
4432
4476
|
}
|
|
4433
4477
|
return null;
|
|
@@ -4447,21 +4491,23 @@ var BinCollection = function (_a) {
|
|
|
4447
4491
|
addressOptions.length > 0 && (React.createElement(DropDownSelectContainer, null,
|
|
4448
4492
|
React.createElement(DropDownSelect, { onChange: handleAddressChange, id: "address", label: "Select your address", options: __spreadArray([{ title: 'Select an address', value: '' }], addressOptions, true) }))),
|
|
4449
4493
|
noResultsFound && React.createElement("p", null, "No results found."),
|
|
4450
|
-
React.createElement("div", null,
|
|
4451
|
-
var
|
|
4452
|
-
var
|
|
4453
|
-
|
|
4454
|
-
|
|
4455
|
-
|
|
4494
|
+
React.createElement("div", null, (function () {
|
|
4495
|
+
var order = ['General refuse bin', 'Recycling bin', 'Garden bin', 'Food caddy'];
|
|
4496
|
+
var uniqueTitles = Array.from(new Set(Object.keys(calendarEvents).map(function (apiTitle) { return formatTitle(apiTitle); }).filter(function (title) { return title !== null; })));
|
|
4497
|
+
var sortedTitles = uniqueTitles.sort(function (a, b) { return order.indexOf(a) - order.indexOf(b); });
|
|
4498
|
+
var noResultsFound = sortedTitles.length === 0;
|
|
4499
|
+
{
|
|
4500
|
+
noResultsFound && React.createElement("p", null, "No results found.");
|
|
4456
4501
|
}
|
|
4457
|
-
|
|
4458
|
-
|
|
4459
|
-
|
|
4460
|
-
|
|
4461
|
-
|
|
4462
|
-
|
|
4463
|
-
|
|
4464
|
-
|
|
4502
|
+
return sortedTitles.map(function (title, index) {
|
|
4503
|
+
var apiTitlesForThisType = Object.keys(calendarEvents).filter(function (apiTitle) { return formatTitle(apiTitle) === title; });
|
|
4504
|
+
return (React.createElement(React.Fragment, { key: "".concat(title, "-").concat(index) },
|
|
4505
|
+
React.createElement(Heading, { level: 3, text: title }),
|
|
4506
|
+
apiTitlesForThisType.flatMap(function (apiTitle) { return calendarEvents[apiTitle]; })
|
|
4507
|
+
.sort(function (a, b) { return new Date(a).getTime() - new Date(b).getTime(); })
|
|
4508
|
+
.map(function (date) { return (React.createElement("p", null, date.toLocaleDateString('en-GB', { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' }))); })));
|
|
4509
|
+
});
|
|
4510
|
+
})()),
|
|
4465
4511
|
Object.keys(calendarEvents).length > 0 && (React.createElement(FormButton, { size: "small", type: "button", "aria-label": "Reset", text: "Find a different address", onClick: resetForm }))));
|
|
4466
4512
|
};
|
|
4467
4513
|
|
|
@@ -23196,8 +23242,9 @@ const AccessibleLinks = styled.a`
|
|
|
23196
23242
|
|
|
23197
23243
|
var AccessibleLink = function (_a) {
|
|
23198
23244
|
var _b = _a.AccessibleLinksArray, AccessibleLinksArray = _b === void 0 ? null : _b;
|
|
23199
|
-
return (React.createElement(
|
|
23200
|
-
return React.createElement(
|
|
23245
|
+
return (React.createElement("ul", null, AccessibleLinksArray && AccessibleLinksArray.map(function (link, i) {
|
|
23246
|
+
return React.createElement("li", { key: 'accessible-link-li-' + i },
|
|
23247
|
+
React.createElement(AccessibleLinks, { key: 'accessible-link-' + i, href: link.url }, link.title));
|
|
23201
23248
|
})));
|
|
23202
23249
|
};
|
|
23203
23250
|
|
|
@@ -23270,10 +23317,10 @@ const InnerContainer$1 = styled.div`
|
|
|
23270
23317
|
const BannerContentContainer = styled.div`
|
|
23271
23318
|
flex-grow: 1;
|
|
23272
23319
|
padding-right: ${(props) => props.theme.theme_vars.spacingSizes.medium};
|
|
23320
|
+
font-weight: bold;
|
|
23273
23321
|
`;
|
|
23274
23322
|
|
|
23275
23323
|
const BannerTitle = styled.p`
|
|
23276
|
-
font-weight: bold;
|
|
23277
23324
|
margin-bottom: ${(props) => props.theme.theme_vars.spacingSizes.small};
|
|
23278
23325
|
`;
|
|
23279
23326
|
|
|
@@ -23289,6 +23336,7 @@ const HideLink = styled.button`
|
|
|
23289
23336
|
background: none;
|
|
23290
23337
|
cursor: pointer;
|
|
23291
23338
|
flex-grow: 0;
|
|
23339
|
+
font-weight: bold;
|
|
23292
23340
|
|
|
23293
23341
|
&:focus {
|
|
23294
23342
|
outline: none;
|