@nnc-digital/nnc-design-system 0.4.14 → 0.4.15

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.
@@ -4314,6 +4314,7 @@ var BinCollection = function (_a) {
4314
4314
  var _f = useState(''), errorText = _f[0], setErrorText = _f[1];
4315
4315
  var _g = useState([]), addressOptions = _g[0], setAddressOptions = _g[1];
4316
4316
  var seenTitles = useRef(new Set());
4317
+ var _h = useState(false), noResultsFound = _h[0], setNoResultsFound = _h[1];
4317
4318
  var handleSubmit = function (e) {
4318
4319
  e.preventDefault();
4319
4320
  var enteredPostcode = e.target.elements.postcode.value;
@@ -4382,7 +4383,7 @@ var BinCollection = function (_a) {
4382
4383
  return acc;
4383
4384
  }, {});
4384
4385
  };
4385
- var _h = useState({}), calendarEvents = _h[0], setCalendarEvents = _h[1];
4386
+ var _j = useState({}), calendarEvents = _j[0], setCalendarEvents = _j[1];
4386
4387
  /**
4387
4388
  * Returns an array of calendar events based on selected address for next 42 days.
4388
4389
  */
@@ -4395,6 +4396,12 @@ var BinCollection = function (_a) {
4395
4396
  axios.get("".concat(CalendarEventsApiUrl).concat(selectedUPRN, "/").concat(startDate, "/").concat(endDate))
4396
4397
  .then(function (response) {
4397
4398
  var groupedData = groupByTitle(response.data);
4399
+ if (Object.keys(groupedData).length === 0) {
4400
+ setNoResultsFound(true);
4401
+ }
4402
+ else {
4403
+ setNoResultsFound(false);
4404
+ }
4398
4405
  setCalendarEvents(groupedData);
4399
4406
  })
4400
4407
  .catch(function (error) {
@@ -4408,6 +4415,7 @@ var BinCollection = function (_a) {
4408
4415
  setError(false);
4409
4416
  setErrorText('');
4410
4417
  seenTitles.current.clear();
4418
+ setNoResultsFound(false);
4411
4419
  };
4412
4420
  var formatTitle = function (apiTitle) {
4413
4421
  var mappings = [
@@ -4438,6 +4446,7 @@ var BinCollection = function (_a) {
4438
4446
  React.createElement(FormButton, { size: "large", type: "submit", "aria-label": "Submit", text: "Find" }))))),
4439
4447
  addressOptions.length > 0 && (React.createElement(DropDownSelectContainer, null,
4440
4448
  React.createElement(DropDownSelect, { onChange: handleAddressChange, id: "address", label: "Select your address", options: __spreadArray([{ title: 'Select an address', value: '' }], addressOptions, true) }))),
4449
+ noResultsFound && React.createElement("p", null, "No results found."),
4441
4450
  React.createElement("div", null, Object.entries(calendarEvents).map(function (_a) {
4442
4451
  var apiTitle = _a[0], dates = _a[1];
4443
4452
  var title = formatTitle(apiTitle);