northants-design-system 0.4.0-alpha.4 → 0.4.0-alpha.5

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.
@@ -7104,7 +7104,9 @@ const Container$X = styled.div`
7104
7104
  display: block;
7105
7105
  `;
7106
7106
 
7107
- const MapImage = styled.img``;
7107
+ const MapImage = styled.img`
7108
+ max-width: 100%;
7109
+ `;
7108
7110
 
7109
7111
  /**
7110
7112
  * A static Google map with optional markers
@@ -7727,7 +7729,7 @@ const ImageLink$1 = styled.a`
7727
7729
  }
7728
7730
  `;
7729
7731
 
7730
- const Header$1 = styled.div`
7732
+ const Header$2 = styled.div`
7731
7733
  h3 {
7732
7734
  margin-top: 0;
7733
7735
  }
@@ -20915,7 +20917,7 @@ var Card = function (_a) {
20915
20917
  imageLarge && imageSmall && (React.createElement(React.Fragment, null, footerLink ? (React.createElement(ImageLink$1, { href: footerLink.url },
20916
20918
  React.createElement(Image$4, { src: imageLarge, alt: imageAltText, srcSet: "".concat(imageSmall, " 400w, ").concat(imageLarge, " 800w"), sizes: "(max-width: 550px) 400px, 800px", loading: "lazy" }))) : (React.createElement(Image$4, { src: imageLarge, alt: imageAltText, srcSet: "".concat(imageSmall, " 400w, ").concat(imageLarge, " 800w"), sizes: "(max-width: 550px) 400px, 800px", loading: "lazy" })))),
20917
20919
  showContent && (React.createElement(Content$4, null,
20918
- header && (React.createElement(Header$1, null,
20920
+ header && (React.createElement(Header$2, null,
20919
20921
  React.createElement(Heading, { text: header, level: 3 }))),
20920
20922
  React.createElement("div", { dangerouslySetInnerHTML: { __html: sanitizeHtml$1(content) } }))),
20921
20923
  footerLink && (React.createElement(Footer$1, null,
@@ -22830,10 +22832,15 @@ var AlertBanner = function (_a) {
22830
22832
  var themeContext = useContext(ThemeContext);
22831
22833
  var elementRef = useRef(null);
22832
22834
  var _c = useLocalStorage('alert_' + uid, true), showAlert = _c[0], setShowAlert = _c[1];
22835
+ var _d = useState(false), notServer = _d[0], setNotServer = _d[1];
22833
22836
  useEffect(function () {
22834
22837
  var _a;
22835
22838
  (_a = elementRef === null || elementRef === void 0 ? void 0 : elementRef.current) === null || _a === void 0 ? void 0 : _a.addEventListener('click', embeddedLinkCLickHandler);
22836
22839
  }, [elementRef]);
22840
+ /* Stop flash of banner on page load when previously dismissed */
22841
+ useEffect(function () {
22842
+ setNotServer(true);
22843
+ }, []);
22837
22844
  /* A click on any link within the alert text dismisses the banner too */
22838
22845
  var embeddedLinkCLickHandler = function (event) {
22839
22846
  var _a;
@@ -22844,8 +22851,6 @@ var AlertBanner = function (_a) {
22844
22851
  var hideClickHandler = function () {
22845
22852
  setShowAlert(false);
22846
22853
  };
22847
- /* Stop flash of banner on page load when previously dismissed */
22848
- var notServer = typeof window !== 'undefined';
22849
22854
  return (showAlert &&
22850
22855
  notServer && (React.createElement(Container$C, { alertType: alertType, "data-testid": "AlertBanner" },
22851
22856
  React.createElement(MaxWidthContainer, { noBackground: true },
@@ -23987,7 +23992,7 @@ var Searchbar = function (_a) {
23987
23992
  /**
23988
23993
  * The header that should appear at the top of every page.
23989
23994
  */
23990
- var Header = function (_a) {
23995
+ var Header$1 = function (_a) {
23991
23996
  _a.children; var _b = _a.hideSearchBar, hideSearchBar = _b === void 0 ? false : _b, _c = _a.homeLink, homeLink = _c === void 0 ? '/' : _c, _d = _a.hasNewsLink, hasNewsLink = _d === void 0 ? false : _d, _e = _a.allServicesLink, allServicesLink = _e === void 0 ? '/' : _e, _f = _a.isHomepage, isHomepage = _f === void 0 ? false : _f, _g = _a.searchSuggestions, searchSuggestions = _g === void 0 ? [] : _g, props = __rest(_a, ["children", "hideSearchBar", "homeLink", "hasNewsLink", "allServicesLink", "isHomepage", "searchSuggestions"]);
23992
23997
  var themeContext = useContext(ThemeContext);
23993
23998
  /*
@@ -34233,6 +34238,20 @@ const Container$4 = styled.div`
34233
34238
  display: block;
34234
34239
  `;
34235
34240
 
34241
+ const Header = styled.div`
34242
+ display: flex;
34243
+ align-items: flex-start;
34244
+ flex-wrap: wrap;
34245
+
34246
+ @media screen and (min-width: ${(props) => props.theme.theme_vars.breakpoints.l}) {
34247
+ flex-wrap: nowrap;
34248
+ }
34249
+
34250
+ h1 {
34251
+ flex-grow: 1;
34252
+ }
34253
+ `;
34254
+
34236
34255
  styled.div`
34237
34256
  position: relative;
34238
34257
  padding-top: 50%;
@@ -34404,8 +34423,91 @@ var DirectoryMap = function (_a) {
34404
34423
  }))))) : (React.createElement(StaticMap, __assign$2({}, mapProps)))));
34405
34424
  };
34406
34425
 
34426
+ const AddToShortlist = styled.button`
34427
+ border: 2px solid ${(props) => props.theme.theme_vars.colours.action};
34428
+ background: ${(props) => props.theme.theme_vars.colours.white};
34429
+ color: ${(props) => props.theme.theme_vars.colours.action};
34430
+ cursor: pointer;
34431
+ padding: ${(props) => props.theme.theme_vars.spacingSizes.small};
34432
+ font-weight: bold;
34433
+ display: flex;
34434
+ flex-direction: row;
34435
+ justify-content: flex-start;
34436
+ align-items: center;
34437
+ &:hover {
34438
+ ${(props) => props.theme.linkStylesHover}
34439
+ background: ${(props) => props.theme.theme_vars.colours.action_light}
34440
+ }
34441
+ &:focus {
34442
+ ${(props) => props.theme.linkStylesFocus}
34443
+ }
34444
+ &:active {
34445
+ ${(props) => props.theme.linkStylesActive}
34446
+ }
34447
+
34448
+ svg {
34449
+ margin-right: ${(props) => props.theme.theme_vars.spacingSizes.small};
34450
+ }
34451
+
34452
+ @media print {
34453
+ display: none;
34454
+ }
34455
+ `;
34456
+
34457
+ var DirectoryShortListContext = createContext({});
34458
+ var DirectoryShortListProvider = function (_a) {
34459
+ var children = _a.children;
34460
+ var _b = useLocalStorage('DirectoryShort', []), favourites = _b[0], setFavourites = _b[1];
34461
+ var toggleFavourites = function (id, name, snippet) {
34462
+ var updatedFavourites = __spreadArray([], favourites, true);
34463
+ if (isFavourite(id)) {
34464
+ var favouriteToRemove = updatedFavourites.find(function (favourite) { return favourite.id === id; });
34465
+ updatedFavourites.splice(updatedFavourites.indexOf(favouriteToRemove), 1);
34466
+ }
34467
+ else {
34468
+ updatedFavourites.push({
34469
+ id: id,
34470
+ name: name,
34471
+ snippet: snippet,
34472
+ });
34473
+ }
34474
+ setFavourites(updatedFavourites);
34475
+ };
34476
+ var isFavourite = function (id) {
34477
+ return typeof favourites.find(function (favourite) { return favourite.id === id; }) !== 'undefined';
34478
+ };
34479
+ var value = {
34480
+ favourites: {
34481
+ favourites: favourites,
34482
+ setFavourites: setFavourites,
34483
+ },
34484
+ toggleFavourites: toggleFavourites,
34485
+ isFavourite: isFavourite,
34486
+ };
34487
+ return React.createElement(DirectoryShortListContext.Provider, { value: value }, children);
34488
+ };
34489
+ var useDirectoryShortListContext = function () {
34490
+ return useContext(DirectoryShortListContext);
34491
+ };
34492
+
34493
+ var DirectoryAddToShortList = function (_a) {
34494
+ var id = _a.id, name = _a.name, snippet = _a.snippet;
34495
+ var _b = useDirectoryShortListContext(), toggleFavourites = _b.toggleFavourites, isFavourite = _b.isFavourite;
34496
+ return (React.createElement(AddToShortlist, { onClick: function (e) { return toggleFavourites(id, name, snippet); }, "data-testid": "DirectoryAddToShortList" },
34497
+ React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: 1.5, stroke: "currentColor", width: "15px", height: "15px" },
34498
+ React.createElement("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M21 8.25c0-2.485-2.099-4.5-4.688-4.5-1.935 0-3.597 1.126-4.312 2.733-.715-1.607-2.377-2.733-4.313-2.733C5.1 3.75 3 5.765 3 8.25c0 7.22 9 12 9 12s9-4.78 9-12z" })),
34499
+ isFavourite(id) ? React.createElement(React.Fragment, null, "Remove from shortlist") : React.createElement(React.Fragment, null, "Add to shortlist")));
34500
+ };
34501
+
34502
+ var getSnippet = function (description, extractLength) {
34503
+ if (extractLength === void 0) { extractLength = 190; }
34504
+ return sanitizeHtml$1(description, {
34505
+ allowedTags: [],
34506
+ allowedAttributes: {},
34507
+ }).substr(0, extractLength) + String.fromCharCode(8230);
34508
+ };
34407
34509
  var DirectoryService = function (_a) {
34408
- var name = _a.name, accreditations = _a.accreditations, descriptionElement = _a.descriptionElement, email = _a.email, fees = _a.fees, languages = _a.languages, regular_schedules = _a.regular_schedules, contacts = _a.contacts, service_areas = _a.service_areas, service_at_locations = _a.service_at_locations, url = _a.url;
34510
+ var id = _a.id, name = _a.name, accreditations = _a.accreditations, description = _a.description, descriptionElement = _a.descriptionElement, email = _a.email, fees = _a.fees, languages = _a.languages, regular_schedules = _a.regular_schedules, contacts = _a.contacts, service_areas = _a.service_areas, service_at_locations = _a.service_at_locations, url = _a.url;
34409
34511
  var labelLetters = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L'];
34410
34512
  var _b = useState(false), notServer = _b[0], setNotServer = _b[1];
34411
34513
  useEffect(function () {
@@ -34414,7 +34516,9 @@ var DirectoryService = function (_a) {
34414
34516
  return (React.createElement(Container$4, { "data-testid": "DirectoryService" },
34415
34517
  React.createElement(Row$1, null,
34416
34518
  React.createElement(Column, { small: "full", medium: "full", large: "full" },
34417
- React.createElement(Heading, { level: 1, text: name })),
34519
+ React.createElement(Header, null,
34520
+ React.createElement(Heading, { level: 1, text: name }),
34521
+ React.createElement(DirectoryAddToShortList, { id: id, name: name, snippet: getSnippet(description, 190) }))),
34418
34522
  service_at_locations.length > 0 && (React.createElement(Column, { small: "full", medium: "full", large: "full" },
34419
34523
  React.createElement(Heading, { level: 2, text: "Location" }), service_at_locations === null || service_at_locations === void 0 ? void 0 :
34420
34524
  service_at_locations.map(function (location, locationIndex) { return (React.createElement(Row$1, { key: locationIndex },
@@ -34861,82 +34965,6 @@ const LoadingContainer = styled.div`
34861
34965
  width: 100%;
34862
34966
  `;
34863
34967
 
34864
- var DirectoryShortListContext = createContext({});
34865
- var DirectoryShortListProvider = function (_a) {
34866
- var children = _a.children;
34867
- var _b = useLocalStorage('DirectoryShort', []), favourites = _b[0], setFavourites = _b[1];
34868
- var toggleFavourites = function (id, name, snippet) {
34869
- var updatedFavourites = __spreadArray([], favourites, true);
34870
- if (isFavourite(id)) {
34871
- var favouriteToRemove = updatedFavourites.find(function (favourite) { return favourite.id === id; });
34872
- updatedFavourites.splice(updatedFavourites.indexOf(favouriteToRemove), 1);
34873
- }
34874
- else {
34875
- updatedFavourites.push({
34876
- id: id,
34877
- name: name,
34878
- snippet: snippet,
34879
- });
34880
- }
34881
- setFavourites(updatedFavourites);
34882
- };
34883
- var isFavourite = function (id) {
34884
- return typeof favourites.find(function (favourite) { return favourite.id === id; }) !== 'undefined';
34885
- };
34886
- var value = {
34887
- favourites: {
34888
- favourites: favourites,
34889
- setFavourites: setFavourites,
34890
- },
34891
- toggleFavourites: toggleFavourites,
34892
- isFavourite: isFavourite,
34893
- };
34894
- return React.createElement(DirectoryShortListContext.Provider, { value: value }, children);
34895
- };
34896
- var useDirectoryShortListContext = function () {
34897
- return useContext(DirectoryShortListContext);
34898
- };
34899
-
34900
- const AddToShortlist = styled.button`
34901
- border: 2px solid ${(props) => props.theme.theme_vars.colours.action};
34902
- background: ${(props) => props.theme.theme_vars.colours.white};
34903
- color: ${(props) => props.theme.theme_vars.colours.action};
34904
- cursor: pointer;
34905
- padding: ${(props) => props.theme.theme_vars.spacingSizes.small};
34906
- font-weight: bold;
34907
- display: flex;
34908
- flex-direction: row;
34909
- justify-content: flex-start;
34910
- align-items: center;
34911
- &:hover {
34912
- ${(props) => props.theme.linkStylesHover}
34913
- background: ${(props) => props.theme.theme_vars.colours.action_light}
34914
- }
34915
- &:focus {
34916
- ${(props) => props.theme.linkStylesFocus}
34917
- }
34918
- &:active {
34919
- ${(props) => props.theme.linkStylesActive}
34920
- }
34921
-
34922
- svg {
34923
- margin-right: ${(props) => props.theme.theme_vars.spacingSizes.small};
34924
- }
34925
-
34926
- @media print {
34927
- display: none;
34928
- }
34929
- `;
34930
-
34931
- var DirectoryAddToShortList = function (_a) {
34932
- var id = _a.id, name = _a.name, snippet = _a.snippet;
34933
- var _b = useDirectoryShortListContext(), toggleFavourites = _b.toggleFavourites, isFavourite = _b.isFavourite;
34934
- return (React.createElement(AddToShortlist, { onClick: function (e) { return toggleFavourites(id, name, snippet); }, "data-testid": "DirectoryAddToShortList" },
34935
- React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: 1.5, stroke: "currentColor", width: "15px", height: "15px" },
34936
- React.createElement("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M21 8.25c0-2.485-2.099-4.5-4.688-4.5-1.935 0-3.597 1.126-4.312 2.733-.715-1.607-2.377-2.733-4.313-2.733C5.1 3.75 3 5.765 3 8.25c0 7.22 9 12 9 12s9-4.78 9-12z" })),
34937
- isFavourite(id) ? React.createElement(React.Fragment, null, "Remove from shortlist") : React.createElement(React.Fragment, null, "Add to shortlist")));
34938
- };
34939
-
34940
34968
  var DirectoryServiceList = function (_a) {
34941
34969
  var directoryPath = _a.directoryPath, shortListPath = _a.shortListPath, services = _a.services, _b = _a.search, search = _b === void 0 ? '' : _b, setSearch = _a.setSearch, _c = _a.postcode, postcode = _c === void 0 ? '' : _c, setPostcode = _a.setPostcode, _d = _a.totalResults, totalResults = _d === void 0 ? 0 : _d, _e = _a.pageNumber, pageNumber = _e === void 0 ? 1 : _e, setPageNumber = _a.setPageNumber, _f = _a.perPage, perPage = _f === void 0 ? 5 : _f, _g = _a.extractLength, extractLength = _g === void 0 ? 190 : _g, _h = _a.categories, categories = _h === void 0 ? [] : _h, setCategories = _a.setCategories, _j = _a.minimumAge, minimumAge = _j === void 0 ? '' : _j, setMinimumAge = _a.setMinimumAge, _k = _a.maximumAge, maximumAge = _k === void 0 ? '' : _k, setMaximumAge = _a.setMaximumAge, _l = _a.mapCenter, mapCenter = _l === void 0 ? '52.23555414368587,-0.8957390701320571' : _l, _m = _a.mapZoom, mapZoom = _m === void 0 ? 9 : _m, _o = _a.isLoading, isLoading = _o === void 0 ? false : _o;
34942
34970
  var _p = useLocalStorage("".concat(directoryPath.replace(/\//g, ''), "-accordion"), []), accordions = _p[0], setAccordions = _p[1];
@@ -35212,5 +35240,5 @@ var DirectoryShortList = function (_a) {
35212
35240
  React.createElement("p", null, "No items in the shortlist")))))))));
35213
35241
  };
35214
35242
 
35215
- export { AccessibleLink as AccessibleLinks, Accordion$1 as Accordion, AlertBanner, AlertBannerService, Autocomplete, BlockQuote, Breadcrumbs, Button$3 as Button, CallToAction, Cards, CheckboxListFilter, Contents$1 as Contents, ContentsNavigation, CookieBanner, CouncilTaxAlphabeticalDirectory, DirectoryService, DirectoryServiceList, DirectoryShortList, DirectoryShortListProvider, DisplayDate, Divider, DownloadableFiles, DropDownFilter, DynamicIcon, Footer, FullWidthContainer, GDS_theme, GlobalStyleReset, GoogleMap, Header, Heading, HeadingWithIcon, HeroImage, HomeHero, Image$2 as Image, ImageAndText, Map$1 as Map, MapMarker, MaxWidthContainer, MemorialHero, NewsArticleDate, NewsArticleFeaturedBlock, NewsArticleFilterAccordion, NewsArticleImage, NewsArticleList, NewsArticleListHeader, NewsArticleOldBanner, PageMain, PageSidebar, PageTitle, PageWithSidebarContainer, PageWrapper, Pagination, PhaseBanner, PromoBanner, PromoBlock, PromotedLinks, Promotions, SearchBox, SearchResultsList, Searchbar, SectionLinks, SectionLinksMobileContents, SectionLinksSidebar, ServiceLinksBoxed, ServicesLinksList, SignpostLinks, SkipToMainContent, StaticMap, Summary, TextInput, Video, WarningText, WarningTextDisclaimer, lb_theme_north, lb_theme_west, north_theme, useDirectoryShortListContext, west_theme };
35243
+ export { AccessibleLink as AccessibleLinks, Accordion$1 as Accordion, AlertBanner, AlertBannerService, Autocomplete, BlockQuote, Breadcrumbs, Button$3 as Button, CallToAction, Cards, CheckboxListFilter, Contents$1 as Contents, ContentsNavigation, CookieBanner, CouncilTaxAlphabeticalDirectory, DirectoryService, DirectoryServiceList, DirectoryShortList, DirectoryShortListProvider, DisplayDate, Divider, DownloadableFiles, DropDownFilter, DynamicIcon, Footer, FullWidthContainer, GDS_theme, GlobalStyleReset, GoogleMap, Header$1 as Header, Heading, HeadingWithIcon, HeroImage, HomeHero, Image$2 as Image, ImageAndText, Map$1 as Map, MapMarker, MaxWidthContainer, MemorialHero, NewsArticleDate, NewsArticleFeaturedBlock, NewsArticleFilterAccordion, NewsArticleImage, NewsArticleList, NewsArticleListHeader, NewsArticleOldBanner, PageMain, PageSidebar, PageTitle, PageWithSidebarContainer, PageWrapper, Pagination, PhaseBanner, PromoBanner, PromoBlock, PromotedLinks, Promotions, SearchBox, SearchResultsList, Searchbar, SectionLinks, SectionLinksMobileContents, SectionLinksSidebar, ServiceLinksBoxed, ServicesLinksList, SignpostLinks, SkipToMainContent, StaticMap, Summary, TextInput, Video, WarningText, WarningTextDisclaimer, lb_theme_north, lb_theme_west, north_theme, useDirectoryShortListContext, west_theme };
35216
35244
  //# sourceMappingURL=index.esm.js.map