@nnc-digital/nnc-design-system 0.4.30 → 0.4.32

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
@@ -4358,12 +4358,25 @@ var BinCollection = function (_a) {
4358
4358
  setErrorText('No addresses found for the provided postcode.');
4359
4359
  return;
4360
4360
  }
4361
- // Transform the response data into the expected format
4362
- var transformedAddresses = response.data.data.map(function (item) { return ({
4363
- value: item.UPRN,
4364
- title: "".concat(item.Address)
4365
- }); });
4366
- setAddressOptions(transformedAddresses);
4361
+ // Separate numeric and named addresses
4362
+ var numericAddresses = [];
4363
+ var namedAddresses = [];
4364
+ response.data.data.forEach(function (item) {
4365
+ var address = "".concat(item.Address);
4366
+ if (/^\d/.test(address)) { // Address starts with a number
4367
+ numericAddresses.push({ value: item.UPRN, title: address });
4368
+ }
4369
+ else {
4370
+ namedAddresses.push({ value: item.UPRN, title: address });
4371
+ }
4372
+ });
4373
+ // Sort numeric addresses by the whole number
4374
+ numericAddresses.sort(function (a, b) { return parseInt(a.title, 10) - parseInt(b.title, 10); });
4375
+ // Sort named addresses alphabetically
4376
+ namedAddresses.sort(function (a, b) { return a.title.localeCompare(b.title); });
4377
+ // Combine the sorted arrays
4378
+ var sortedAddresses = numericAddresses.concat(namedAddresses);
4379
+ setAddressOptions(sortedAddresses);
4367
4380
  })
4368
4381
  .catch(function (error) {
4369
4382
  setIsLoading(false);
@@ -4405,7 +4418,7 @@ var BinCollection = function (_a) {
4405
4418
  var selectedUPRN = e.target.value;
4406
4419
  if (selectedUPRN) {
4407
4420
  var startDate_1 = getFormattedDate();
4408
- var endDate_1 = getFormattedDate(28);
4421
+ var endDate_1 = getFormattedDate(42);
4409
4422
  // Fetch calendar events for the selected UPRN
4410
4423
  axios__default["default"].get("".concat(CalendarEventsApiUrl).concat(selectedUPRN, "/").concat(startDate_1, "/").concat(endDate_1))
4411
4424
  .then(function (response) {