northants-design-system 1.3.0 → 1.3.1

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
@@ -3635,7 +3635,7 @@ var Autocomplete = function (_a) {
3635
3635
  })));
3636
3636
  };
3637
3637
 
3638
- const Container$1j = styled__default.default.div`
3638
+ const Container$1k = styled__default.default.div`
3639
3639
  display: block;
3640
3640
  `;
3641
3641
 
@@ -3720,7 +3720,7 @@ var BackToTop = function (_a) {
3720
3720
  React.useEffect(function () {
3721
3721
  window.addEventListener('scroll', toggleVisible);
3722
3722
  });
3723
- return (React__default.default.createElement(Container$1j, { "data-testid": "BackToTop" }, isActive && (React__default.default.createElement(BackToTopButton, { onClick: scrollToTop, "$visible": visible, "data-testid": "BackToTopButton", type: "button", "aria-label": "Go to the top of the page" },
3723
+ return (React__default.default.createElement(Container$1k, { "data-testid": "BackToTop" }, isActive && (React__default.default.createElement(BackToTopButton, { onClick: scrollToTop, "$visible": visible, "data-testid": "BackToTopButton", type: "button", "aria-label": "Go to the top of the page" },
3724
3724
  React__default.default.createElement(ChevronIcon, { colourFill: themeContext.theme_vars.colours.white, direction: "up" })))));
3725
3725
  };
3726
3726
 
@@ -6159,7 +6159,7 @@ var HeadingWithIcon = function (_a) {
6159
6159
  subHeading && React__default.default.createElement(SubHeading, null, subHeading))));
6160
6160
  };
6161
6161
 
6162
- const Container$1i = styled__default.default.div`
6162
+ const Container$1j = styled__default.default.div`
6163
6163
  display: flex;
6164
6164
  width: 100%;
6165
6165
  min-height: 400px;
@@ -6183,7 +6183,7 @@ var Map$1 = function (_a) {
6183
6183
  setMap(new window.google.maps.Map(ref.current, { center: center, zoom: zoom }));
6184
6184
  }
6185
6185
  }, [ref, map]);
6186
- return (React__default.default.createElement(Container$1i, { "data-testid": "Map" },
6186
+ return (React__default.default.createElement(Container$1j, { "data-testid": "Map" },
6187
6187
  React__default.default.createElement("div", { ref: ref }),
6188
6188
  React__default.default.Children.map(children, function (child) {
6189
6189
  if (React__default.default.isValidElement(child)) {
@@ -6240,7 +6240,7 @@ var MapMarker = function (options) {
6240
6240
  return null;
6241
6241
  };
6242
6242
 
6243
- const Container$1h = styled__default.default.div`
6243
+ const Container$1i = styled__default.default.div`
6244
6244
  ${(props) => props.theme.fontStyles};
6245
6245
  display: block;
6246
6246
  border-top: 1px solid ${(props) => props.theme.theme_vars.colours.grey};
@@ -7018,7 +7018,7 @@ var Pagination = function (_a) {
7018
7018
  }
7019
7019
  };
7020
7020
  if (numbers.length > 1) {
7021
- return (React__default.default.createElement(Container$1h, { "data-testid": "Pagination", role: "navigation", "aria-label": "Pagination" },
7021
+ return (React__default.default.createElement(Container$1i, { "data-testid": "Pagination", role: "navigation", "aria-label": "Pagination" },
7022
7022
  currentPage > 1 && (React__default.default.createElement(Previous, { onClick: function () { return buttonClick(currentPage - 1); }, title: "Go back a page" }, "Previous")),
7023
7023
  React__default.default.createElement(NumbersContainer, null, numbers.map(function (v, i) { return (React__default.default.createElement(NumberContainer, { key: i },
7024
7024
  v === '...' && React__default.default.createElement(Ellipsis, null, "..."),
@@ -7030,7 +7030,7 @@ var Pagination = function (_a) {
7030
7030
  return null;
7031
7031
  };
7032
7032
 
7033
- const Container$1g = styled__default.default.div`
7033
+ const Container$1h = styled__default.default.div`
7034
7034
  ${(props) => props.theme.fontStyles};
7035
7035
  margin-bottom: 30px;
7036
7036
  `;
@@ -7156,24 +7156,32 @@ const CheckboxLabel = styled__default.default.label`
7156
7156
  `;
7157
7157
 
7158
7158
  const NewsArticleFilterFields = {
7159
- search: {
7160
- title: "Search articles",
7161
- queryParamKey: "searchTerm"
7162
- },
7163
- services: {
7164
- title: "Services",
7165
- queryParamKey: "services"
7166
- },
7167
- articleType: {
7168
- title: "Type of Article",
7169
- queryParamKey: "articleType"
7170
- },
7171
- sortBy: {
7172
- title: "Sort by",
7173
- queryParamKey: "sortBy"
7174
- },
7175
- // what is included in the filter removal
7176
- removeFiltersList: ['searchTerm', 'services', 'articleType']
7159
+ search: {
7160
+ title: 'Search articles',
7161
+ queryParamKey: 'searchTerm',
7162
+ },
7163
+ services: {
7164
+ title: 'Services',
7165
+ queryParamKey: 'services',
7166
+ },
7167
+ articleType: {
7168
+ title: 'Type of Article',
7169
+ queryParamKey: 'articleType',
7170
+ },
7171
+ year: {
7172
+ title: 'Date',
7173
+ queryParamKey: 'year',
7174
+ },
7175
+ month: {
7176
+ title: 'Date',
7177
+ queryParamKey: 'month',
7178
+ },
7179
+ sortBy: {
7180
+ title: 'Sort by',
7181
+ queryParamKey: 'sortBy',
7182
+ },
7183
+ // what is included in the filter removal
7184
+ removeFiltersList: ['searchTerm', 'services', 'articleType', 'month', 'year'],
7177
7185
  };
7178
7186
 
7179
7187
  var CheckboxListFilter = function (_a) {
@@ -7201,7 +7209,7 @@ var CheckboxListFilter = function (_a) {
7201
7209
  handleParams('news', [{ key: NewsArticleFilterFields.articleType.queryParamKey, value: articleTypes }], ['page']);
7202
7210
  };
7203
7211
  var backupLabel = Math.random().toString(36).substring(7);
7204
- return (React__default.default.createElement(Container$1g, { "data-testid": "CheckboxListFilter" },
7212
+ return (React__default.default.createElement(Container$1h, { "data-testid": "CheckboxListFilter" },
7205
7213
  React__default.default.createElement(Fieldset$2, { "aria-describedby": hintId },
7206
7214
  React__default.default.createElement(Legend$3, { "$labelHidden": labelHidden, "data-testid": "CheckboxListFilterLegend" }, label),
7207
7215
  React__default.default.createElement(Hint$1, { id: hintId, "$hintHidden": hintHidden, "data-testid": "CheckboxListFilterHint" }, hint),
@@ -7210,6 +7218,10 @@ var CheckboxListFilter = function (_a) {
7210
7218
  React__default.default.createElement(CheckboxLabel, { "$isChecked": option.checked, htmlFor: option.value }, option.title))); })))));
7211
7219
  };
7212
7220
 
7221
+ const Container$1g = styled__default.default.div`
7222
+ margin-bottom: ${(props) => (props.$hasMargin ? props.theme.theme_vars.spacingSizes.small : 0)};
7223
+ `;
7224
+
7213
7225
  const Container$1f = styled__default.default.div`
7214
7226
  ${(props) => props.theme.fontStyles};
7215
7227
  `;
@@ -7282,13 +7294,14 @@ var DropDownSelect = function (_a) {
7282
7294
  };
7283
7295
 
7284
7296
  var DropDownFilter = function (_a) {
7285
- var id = _a.id, label = _a.label, options = _a.options, selected = _a.selected, _b = _a.hideLabel, hideLabel = _b === void 0 ? false : _b;
7286
- var _c = React.useState(selected), value = _c[0], setValue = _c[1];
7297
+ var id = _a.id, label = _a.label, options = _a.options, selected = _a.selected, _b = _a.hideLabel, hideLabel = _b === void 0 ? false : _b, _c = _a.filterKey, filterKey = _c === void 0 ? 'services' : _c, _d = _a.hasMargin, hasMargin = _d === void 0 ? false : _d;
7298
+ var _e = React.useState(selected), value = _e[0], setValue = _e[1];
7287
7299
  var optionPicked = function (e) {
7288
7300
  setValue(e.target.value);
7289
- handleParams('news', [{ key: NewsArticleFilterFields.services.queryParamKey, value: e.target.value }], ["page"]);
7301
+ handleParams('news', [{ key: NewsArticleFilterFields[filterKey].queryParamKey, value: e.target.value }], ['page']);
7290
7302
  };
7291
- return (React__default.default.createElement(DropDownSelect, { id: id, label: label, options: options, onChange: optionPicked, selected: value, hideLabel: hideLabel }));
7303
+ return (React__default.default.createElement(Container$1g, { "$hasMargin": hasMargin },
7304
+ React__default.default.createElement(DropDownSelect, { id: id, label: label, options: options, onChange: optionPicked, selected: value, hideLabel: hideLabel })));
7292
7305
  };
7293
7306
 
7294
7307
  const oneColStyles = (props) => {
@@ -24153,31 +24166,24 @@ var WebChat = function (_a) {
24153
24166
  scrollToTop();
24154
24167
  };
24155
24168
  var onSubmit = function (data) {
24169
+ var _a, _b, _c, _d;
24156
24170
  var params = [];
24157
- if (data.enquiryType) {
24158
- params.push({
24159
- key: 'queue',
24160
- value: data.enquiryType,
24161
- });
24162
- }
24163
- if (data.email) {
24164
- params.push({
24165
- key: 'email',
24166
- value: data.email,
24167
- });
24168
- }
24169
- if (data.telephone) {
24170
- params.push({
24171
- key: 'telephone',
24172
- value: data.telephone,
24173
- });
24174
- }
24175
- if (data.reference) {
24176
- params.push({
24177
- key: 'reference',
24178
- value: data.reference,
24179
- });
24180
- }
24171
+ params.push({
24172
+ key: 'queue',
24173
+ value: (_a = data.enquiryType) !== null && _a !== void 0 ? _a : '',
24174
+ });
24175
+ params.push({
24176
+ key: 'email',
24177
+ value: (_b = data.email) !== null && _b !== void 0 ? _b : '',
24178
+ });
24179
+ params.push({
24180
+ key: 'telephone',
24181
+ value: (_c = data.telephone) !== null && _c !== void 0 ? _c : '',
24182
+ });
24183
+ params.push({
24184
+ key: 'reference',
24185
+ value: (_d = data.reference) !== null && _d !== void 0 ? _d : '',
24186
+ });
24181
24187
  params.push({
24182
24188
  key: 'im_name',
24183
24189
  value: data.name,
@@ -26819,13 +26825,17 @@ var NewsArticleFilterAccordion = function (_a) {
26819
26825
  var _c = React.useState([]), searchValue = _c[0], setSearchValue = _c[1];
26820
26826
  var _d = React.useState([]), servicesValue = _d[0], setServices = _d[1];
26821
26827
  var _e = React.useState([]), articleTypeValue = _e[0], setArticleTypes = _e[1];
26828
+ var _f = React.useState([]), years = _f[0], setYears = _f[1];
26829
+ var _g = React.useState([]), months = _g[0], setMonths = _g[1];
26822
26830
  React.useEffect(function () {
26823
26831
  setCount(countParams(NewsArticleFilterFields.removeFiltersList));
26824
26832
  setSearchValue(getParamValue(NewsArticleFilterFields.search.queryParamKey));
26825
26833
  setServices(getDropDownValues(NewsArticleFilterFields.services.queryParamKey));
26826
26834
  setArticleTypes(getCheckboxValues(NewsArticleFilterFields.articleType.queryParamKey));
26835
+ setYears(getDropDownValues(NewsArticleFilterFields.year.queryParamKey));
26836
+ setMonths(getDropDownValues(NewsArticleFilterFields.month.queryParamKey));
26827
26837
  }, []);
26828
- var _f = React.useState(false), isFullScreen = _f[0], setFullScreen = _f[1];
26838
+ var _h = React.useState(false), isFullScreen = _h[0], setFullScreen = _h[1];
26829
26839
  var showFullscreenFilters = function (e) {
26830
26840
  setFullScreen(true);
26831
26841
  document.body.style.overflow = 'hidden';
@@ -26849,6 +26859,12 @@ var NewsArticleFilterAccordion = function (_a) {
26849
26859
  else if (section.title === NewsArticleFilterFields.articleType.title && articleTypeValue.length > 0) {
26850
26860
  section.isExpanded = true;
26851
26861
  }
26862
+ else if (section.title === NewsArticleFilterFields.year.title && years.length > 0) {
26863
+ section.isExpanded = true;
26864
+ }
26865
+ else if (section.title === NewsArticleFilterFields.month.title && months.length > 0) {
26866
+ section.isExpanded = true;
26867
+ }
26852
26868
  else {
26853
26869
  section.isExpanded = false;
26854
26870
  }