@nnc-digital/nnc-design-system 0.4.6 → 0.4.7
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.js
CHANGED
|
@@ -4048,15 +4048,16 @@ var BinCollectionButtonStyles = styled__default["default"].div(templateObject_3
|
|
|
4048
4048
|
var FormContainer$1 = styled__default["default"].div(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n width: 100%;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n ", "\n"], ["\n width: 100%;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n ", "\n"])), function (props) {
|
|
4049
4049
|
return props.isLoading && "\n opacity: 0.5; \n pointer-events: none;\n ";
|
|
4050
4050
|
});
|
|
4051
|
-
var
|
|
4052
|
-
var
|
|
4053
|
-
styled__default["default"].
|
|
4054
|
-
|
|
4055
|
-
var
|
|
4056
|
-
var
|
|
4057
|
-
var
|
|
4058
|
-
styled__default["default"].
|
|
4059
|
-
|
|
4051
|
+
var ErrorTextWrapper = styled__default["default"].div(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n display: block;\n width: 100%;\n"], ["\n display: block;\n width: 100%;\n"])));
|
|
4052
|
+
var DropDownSelectContainer = styled__default["default"].div(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n padding-bottom: 20px;\n"], ["\n padding-bottom: 20px;\n"])));
|
|
4053
|
+
var FormInnerContainer = styled__default["default"].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"])));
|
|
4054
|
+
styled__default["default"].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; });
|
|
4055
|
+
var UPRNPageTitleRow = styled__default["default"].div(templateObject_9 || (templateObject_9 = __makeTemplateObject(["\n justify-content: center;\n margin-bottom: 1em;\n margin-top: 2em;\n width: 100%;\n"], ["\n justify-content: center;\n margin-bottom: 1em;\n margin-top: 2em;\n width: 100%;\n"])));
|
|
4056
|
+
var UPRNPageUPRNRow = styled__default["default"].div(templateObject_10 || (templateObject_10 = __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"])));
|
|
4057
|
+
var UPRNPageSectionTitle = styled__default["default"].div(templateObject_11 || (templateObject_11 = __makeTemplateObject(["\n font-size: 2em;\n font-weight: 700;\n"], ["\n font-size: 2em;\n font-weight: 700;\n"])));
|
|
4058
|
+
var UPRNPageUPRNTitle = styled__default["default"].div(templateObject_12 || (templateObject_12 = __makeTemplateObject(["\n font-size: 1.5em;\n"], ["\n font-size: 1.5em;\n"])));
|
|
4059
|
+
styled__default["default"].input(templateObject_13 || (templateObject_13 = __makeTemplateObject([""], [""])));
|
|
4060
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9, templateObject_10, templateObject_11, templateObject_12, templateObject_13;
|
|
4060
4061
|
|
|
4061
4062
|
const Container$16 = styled__default["default"].div`
|
|
4062
4063
|
display: flex;
|
|
@@ -4347,13 +4348,22 @@ var BinCollection = function (_a) {
|
|
|
4347
4348
|
*/
|
|
4348
4349
|
var fetchAddresses = function (postcode) { return __awaiter(void 0, void 0, void 0, function () {
|
|
4349
4350
|
return __generator(this, function (_a) {
|
|
4351
|
+
setError(false);
|
|
4352
|
+
setErrorText('');
|
|
4353
|
+
setIsLoading(true);
|
|
4350
4354
|
axios__default["default"].get("".concat(BinCollectionApiUrl).concat(postcode))
|
|
4351
4355
|
.then(function (response) {
|
|
4352
4356
|
setIsLoading(false);
|
|
4357
|
+
// Check if there are any addresses returned
|
|
4358
|
+
if (response.data.data.length === 0) {
|
|
4359
|
+
setError(true);
|
|
4360
|
+
setErrorText('No addresses found for the provided postcode.');
|
|
4361
|
+
return;
|
|
4362
|
+
}
|
|
4353
4363
|
// Transform the response data into the expected format
|
|
4354
4364
|
var transformedAddresses = response.data.data.map(function (item) { return ({
|
|
4355
4365
|
value: item.UPRN,
|
|
4356
|
-
title: "".concat(item.Address
|
|
4366
|
+
title: "".concat(item.Address)
|
|
4357
4367
|
}); });
|
|
4358
4368
|
setAddressOptions(transformedAddresses);
|
|
4359
4369
|
})
|
|
@@ -4434,8 +4444,9 @@ var BinCollection = function (_a) {
|
|
|
4434
4444
|
React__default["default"].createElement(FormWithLine, { onSubmit: handleSubmit, isError: isError, lineColour: themeContext.theme_vars.colours.grey_dark, hideLine: true },
|
|
4435
4445
|
React__default["default"].createElement(FormContainer$1, { isLoading: isLoading },
|
|
4436
4446
|
React__default["default"].createElement(Heading, { level: 2, text: "Bin Collection Checker" }),
|
|
4447
|
+
React__default["default"].createElement(ErrorTextWrapper, null, errorText && React__default["default"].createElement(ErrorText$1, null, errorText)),
|
|
4437
4448
|
React__default["default"].createElement(FormInnerContainer, null,
|
|
4438
|
-
React__default["default"].createElement(Input$6, { type: "text", placeholder: "Enter a postcode", name: "postcode",
|
|
4449
|
+
React__default["default"].createElement(Input$6, { type: "text", placeholder: "Enter a postcode", name: "postcode", isErrored: isError, maxLength: 10 }),
|
|
4439
4450
|
React__default["default"].createElement(BinCollectionButtonStyles, null,
|
|
4440
4451
|
React__default["default"].createElement(FormButton, { size: "large", type: "submit", "aria-label": "Submit", text: "Find" }))))),
|
|
4441
4452
|
addressOptions.length > 0 && (React__default["default"].createElement(DropDownSelectContainer, null,
|