northants-design-system 0.4.0-alpha.13 → 0.4.0-alpha.14

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.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import Autocomplete from './library/components/Autocomplete/Autocomplete';
2
+ import BackToTop from './library/components/BackToTop/BackToTop';
2
3
  import Button from './library/components/Button/Button';
3
4
  import DynamicIcon from './library/components/DynamicIcon/DynamicIcon';
4
5
  import Heading from './library/components/Heading/Heading';
@@ -11,7 +12,7 @@ import DropDownFilter from './library/components/DropDownFilter/DropDownFilter';
11
12
  import PromotedLinks from './library/components/PromotedLinks/PromotedLinks';
12
13
  import StaticMap from './library/components/StaticMap/StaticMap';
13
14
  import TextInput from './library/components/TextInput/TextInput';
14
- export { Autocomplete, Button, DynamicIcon, Heading, HeadingWithIcon, Map, MapMarker, Pagination, CheckboxListFilter, DropDownFilter, PromotedLinks, StaticMap, TextInput, };
15
+ export { Autocomplete, BackToTop, Button, DynamicIcon, Heading, HeadingWithIcon, Map, MapMarker, Pagination, CheckboxListFilter, DropDownFilter, PromotedLinks, StaticMap, TextInput, };
15
16
  import Accordion from './library/slices/Accordion/Accordion';
16
17
  import BlockQuote from './library/slices/BlockQuote/BlockQuote';
17
18
  import CallToAction from './library/slices/CallToAction/CallToAction';
@@ -1,4 +1,4 @@
1
- import React, { Component, cloneElement, useState, useContext, useId, useEffect, useRef, createContext } from 'react';
1
+ import React, { Component, cloneElement, useState, useContext, useEffect, useId, useRef, createContext } from 'react';
2
2
  import styled, { css, ThemeContext, ThemeProvider, createGlobalStyle } from 'styled-components';
3
3
  import require$$0 from 'tty';
4
4
  import require$$2 from 'path';
@@ -3835,6 +3835,100 @@ var Autocomplete = function (_a) {
3835
3835
  })));
3836
3836
  };
3837
3837
 
3838
+ const Container$15 = styled.div`
3839
+ display: block;
3840
+ `;
3841
+
3842
+ const BackToTopButton = styled.button`
3843
+ display: ${(props) => (props.visible ? 'inline-block' : 'none')};
3844
+ position: fixed;
3845
+ bottom: ${(props) => props.theme.theme_vars.spacingSizes.medium};
3846
+ right: ${(props) => props.theme.theme_vars.spacingSizes.medium};
3847
+ z-index: 2;
3848
+ background-color: ${(props) => props.theme.theme_vars.colours.action};
3849
+ color: ${(props) => props.theme.theme_vars.white};
3850
+ padding: ${(props) => props.theme.theme_vars.spacingSizes.medium};
3851
+ font-weight: 700;
3852
+ border: 0;
3853
+ cursor: pointer;
3854
+ line-height: 1;
3855
+ font-family: ${(props) => props.theme.theme_vars.fontstack};
3856
+ border-radius: ${(props) => props.theme.theme_vars.border_radius};
3857
+ text-decoration: none !important;
3858
+
3859
+ /* When larger than xl position button to be just outside the container */
3860
+ @media screen and (min-width: calc(${(props) => props.theme.theme_vars.breakpoints.xl} + ${(props) =>
3861
+ props.theme.theme_vars.spacingSizes.medium})) {
3862
+ right: calc((100% - ${(props) => props.theme.theme_vars.breakpoints.xl}) / 2);
3863
+ }
3864
+
3865
+ &:hover {
3866
+ background-color: ${(props) => props.theme.theme_vars.colours.action_dark};
3867
+ }
3868
+ &:focus {
3869
+ outline: none;
3870
+ color: ${(props) => props.theme.theme_vars.colours.black} !important;
3871
+ background-color: ${(props) => props.theme.theme_vars.colours.focus};
3872
+ box-shadow: 0px -3px 0px 0px ${(props) => props.theme.theme_vars.colours.black} inset;
3873
+ }
3874
+ &:active {
3875
+ transform: translateY(2px);
3876
+ color: ${(props) => props.theme.theme_vars.colours.black} !important;
3877
+ background-color: ${(props) => props.theme.theme_vars.colours.focus};
3878
+ box-shadow: 0px -1px 0px 0px ${(props) => props.theme.theme_vars.colours.black} inset;
3879
+ }
3880
+ `;
3881
+
3882
+ const StyledSVG$1 = styled.svg`
3883
+ -webkit-transition: transform 0.2s ease-in-out;
3884
+ -moz-transition: transform 0.2s ease-in-out;
3885
+ -o-transition: transform 0.2s ease-in-out;
3886
+ transition: transform 0.2s ease-in-out;
3887
+
3888
+ &.icon-direction-down {
3889
+ transform: rotate(90deg);
3890
+ }
3891
+ &.icon-direction-up {
3892
+ transform: rotate(-90deg);
3893
+ }
3894
+ &.icon-direction-left {
3895
+ transform: rotate(180deg);
3896
+ }
3897
+ `;
3898
+
3899
+ var ChevronIcon$3 = function (_a) {
3900
+ var _b = _a.colourFill, colourFill = _b === void 0 ? "" : _b, _c = _a.direction, direction = _c === void 0 ? "right" : _c;
3901
+ return (React.createElement(StyledSVG$1, { width: "7", height: "13", viewBox: "0 0 7 13", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: "icon-direction-" + direction },
3902
+ React.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M0.265759 10.6362C-0.0886068 10.9905 -0.0886069 11.5651 0.265758 11.9194C0.620124 12.2738 1.19466 12.2738 1.54903 11.9194L6.73423 6.73424C7.08859 6.37988 7.08859 5.80534 6.73423 5.45097L1.54903 0.265774C1.19466 -0.0885916 0.620124 -0.0885917 0.265759 0.265774C-0.0886064 0.620139 -0.0886064 1.19468 0.265759 1.54904L4.8118 6.09509L0.265759 10.6362Z", fill: colourFill })));
3903
+ };
3904
+
3905
+ var BackToTop = function (_a) {
3906
+ var _b = _a.isActive, isActive = _b === void 0 ? false : _b;
3907
+ var themeContext = useContext(ThemeContext);
3908
+ var _c = useState(false), visible = _c[0], setVisible = _c[1];
3909
+ var toggleVisible = function () {
3910
+ var scrolled = document.documentElement.scrollTop;
3911
+ if (scrolled > 300) {
3912
+ setVisible(true);
3913
+ }
3914
+ else if (scrolled <= 300) {
3915
+ setVisible(false);
3916
+ }
3917
+ };
3918
+ var scrollToTop = function (event) {
3919
+ event.preventDefault();
3920
+ window.scrollTo({
3921
+ top: 0,
3922
+ behavior: 'smooth',
3923
+ });
3924
+ };
3925
+ useEffect(function () {
3926
+ window.addEventListener('scroll', toggleVisible);
3927
+ });
3928
+ return (React.createElement(Container$15, { "data-testid": "BackToTop" }, isActive && (React.createElement(BackToTopButton, { onClick: scrollToTop, visible: visible, "data-testid": "BackToTopButton", type: "button" },
3929
+ React.createElement(ChevronIcon$3, { colourFill: themeContext.theme_vars.colours.white, direction: "up" })))));
3930
+ };
3931
+
3838
3932
  const StyledButton$1 = styled.a`
3839
3933
  font-weight: 700;
3840
3934
  border: 0;
@@ -23178,29 +23272,6 @@ const BreadcrumbLink$1 = styled.a`
23178
23272
  }
23179
23273
  `;
23180
23274
 
23181
- const StyledSVG$1 = styled.svg`
23182
- -webkit-transition: transform 0.2s ease-in-out;
23183
- -moz-transition: transform 0.2s ease-in-out;
23184
- -o-transition: transform 0.2s ease-in-out;
23185
- transition: transform 0.2s ease-in-out;
23186
-
23187
- &.icon-direction-down {
23188
- transform: rotate(90deg);
23189
- }
23190
- &.icon-direction-up {
23191
- transform: rotate(-90deg);
23192
- }
23193
- &.icon-direction-left {
23194
- transform: rotate(180deg);
23195
- }
23196
- `;
23197
-
23198
- var ChevronIcon$3 = function (_a) {
23199
- var _b = _a.colourFill, colourFill = _b === void 0 ? "" : _b, _c = _a.direction, direction = _c === void 0 ? "right" : _c;
23200
- return (React.createElement(StyledSVG$1, { width: "7", height: "13", viewBox: "0 0 7 13", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: "icon-direction-" + direction },
23201
- React.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M0.265759 10.6362C-0.0886068 10.9905 -0.0886069 11.5651 0.265758 11.9194C0.620124 12.2738 1.19466 12.2738 1.54903 11.9194L6.73423 6.73424C7.08859 6.37988 7.08859 5.80534 6.73423 5.45097L1.54903 0.265774C1.19466 -0.0885916 0.620124 -0.0885917 0.265759 0.265774C-0.0886064 0.620139 -0.0886064 1.19468 0.265759 1.54904L4.8118 6.09509L0.265759 10.6362Z", fill: colourFill })));
23202
- };
23203
-
23204
23275
  var Breadcrumbs = function (_a) {
23205
23276
  var breadcrumbsArray = _a.breadcrumbsArray, _b = _a.hasMargin, hasMargin = _b === void 0 ? false : _b;
23206
23277
  return (React.createElement(Container$B, { hasMargin: hasMargin, "data-testid": "Breadcrumbs" },
@@ -29000,9 +29071,13 @@ var DirectoryService = function (_a) {
29000
29071
  favourites.length,
29001
29072
  ")")),
29002
29073
  React.createElement(DirectoryAddToShortList, { id: id, name: name, snippet: transformSnippet(description, 350), email: email, website: url, phone: (_c = (_b = contacts === null || contacts === void 0 ? void 0 : contacts[0]) === null || _b === void 0 ? void 0 : _b.phones) === null || _c === void 0 ? void 0 : _c.flatMap(function (phone) { return phone.number; }).join(', ') })))))),
29003
- service_at_locations.length > 0 && (React.createElement(Column, { small: "full", medium: "full", large: "full", classes: "striped-column" },
29074
+ service_at_locations.filter(function (location) {
29075
+ return location.is_visitable != false;
29076
+ }).length > 0 && (React.createElement(Column, { small: "full", medium: "full", large: "full", classes: "striped-column" },
29004
29077
  React.createElement(Row$1, null,
29005
- React.createElement(Column, { small: "full", medium: "full", large: "one-third" }, service_at_locations === null || service_at_locations === void 0 ? void 0 : service_at_locations.map(function (location) { return (React.createElement("div", { key: location.id },
29078
+ React.createElement(Column, { small: "full", medium: "full", large: "one-third" }, service_at_locations === null || service_at_locations === void 0 ? void 0 : service_at_locations.filter(function (location) {
29079
+ return location.is_visitable != false;
29080
+ }).map(function (location) { return (React.createElement("div", { key: location.id },
29006
29081
  React.createElement(Heading, { level: 2, text: location.name }),
29007
29082
  location.physical_addresses.map(function (address) { return (React.createElement(PhysicalAddress, { key: address.id },
29008
29083
  React.createElement("p", { key: address.id, dangerouslySetInnerHTML: {
@@ -29012,9 +29087,13 @@ var DirectoryService = function (_a) {
29012
29087
  } }),
29013
29088
  React.createElement(Button$3, { url: "https://google.com/maps/dir//".concat(location.latitude, ",").concat(location.longitude), text: "Get directions" }))); }),
29014
29089
  (location === null || location === void 0 ? void 0 : location.accessibility_for_disabilities.length) > 0 && (React.createElement(React.Fragment, null,
29015
- React.createElement(Heading, { level: 3, text: "You can also access" }),
29090
+ React.createElement(Heading, { level: 3, text: "Other facilities on site" }),
29016
29091
  React.createElement("ul", null, location.accessibility_for_disabilities.map(function (accessibility) { return (React.createElement("li", { key: accessibility.id }, accessibility.accessibility)); })))))); })),
29017
- React.createElement(Column, { small: "full", medium: "full", large: "two-thirds" }, ((_d = service_at_locations[0]) === null || _d === void 0 ? void 0 : _d.latitude) && ((_e = service_at_locations[0]) === null || _e === void 0 ? void 0 : _e.longitude) && (React.createElement(React.Fragment, null,
29092
+ React.createElement(Column, { small: "full", medium: "full", large: "two-thirds" }, service_at_locations.filter(function (location) {
29093
+ return location.is_visitable != false;
29094
+ }).length > 0 &&
29095
+ ((_d = service_at_locations[0]) === null || _d === void 0 ? void 0 : _d.latitude) &&
29096
+ ((_e = service_at_locations[0]) === null || _e === void 0 ? void 0 : _e.longitude) && (React.createElement(React.Fragment, null,
29018
29097
  notServer && (React.createElement(DirectoryMap, { mapProps: {
29019
29098
  centre: "".concat(service_at_locations[0].latitude, ",").concat(service_at_locations[0].longitude),
29020
29099
  imageAltText: "".concat(service_at_locations[0].name, " shown on a map"),
@@ -29022,7 +29101,9 @@ var DirectoryService = function (_a) {
29022
29101
  size: '640x320',
29023
29102
  mapMarkers: service_at_locations
29024
29103
  .filter(function (location) {
29025
- return location.latitude != null && location.longitude != null;
29104
+ return (location.latitude != null &&
29105
+ location.longitude != null &&
29106
+ location.is_visitable != false);
29026
29107
  })
29027
29108
  .map(function (location, locationIndex) {
29028
29109
  return {
@@ -29060,7 +29141,28 @@ var DirectoryService = function (_a) {
29060
29141
  React.createElement(DownloadableFiles, { files: uploads }))),
29061
29142
  (service_social_profiles === null || service_social_profiles === void 0 ? void 0 : service_social_profiles.length) > 0 && (React.createElement(Column, { small: "full", medium: "full", large: "full", classes: "striped-column" },
29062
29143
  React.createElement(Heading, { level: 2, text: "Follow this service" }),
29063
- React.createElement(ServiceSocialLinks, { profiles: service_social_profiles }))))));
29144
+ React.createElement(ServiceSocialLinks, { profiles: service_social_profiles }))),
29145
+ service_at_locations.filter(function (location) {
29146
+ return location.is_visitable == false;
29147
+ }).length > 0 && (React.createElement(Column, { small: "full", medium: "full", large: "full", classes: "striped-column" }, service_at_locations
29148
+ .filter(function (location) {
29149
+ return location.is_visitable == false;
29150
+ })
29151
+ .map(function (location) { return (React.createElement(Row$1, null,
29152
+ React.createElement(Column, { small: "full", medium: "one-half", large: "one-third", key: location.id },
29153
+ React.createElement(Heading, { level: 2, text: location.name }),
29154
+ location.physical_addresses.map(function (address) { return (React.createElement(PhysicalAddress, { key: address.id },
29155
+ React.createElement("p", { key: address.id, dangerouslySetInnerHTML: {
29156
+ __html: Object.values(address)
29157
+ .filter(function (item) { return item !== '' && item !== address.id; })
29158
+ .join(' <br />'),
29159
+ } }))); }),
29160
+ (location === null || location === void 0 ? void 0 : location.accessibility_for_disabilities.length) > 0 && (React.createElement(React.Fragment, null,
29161
+ React.createElement(Heading, { level: 3, text: "Other facilities on site" }),
29162
+ React.createElement("ul", null, location.accessibility_for_disabilities.map(function (accessibility) { return (React.createElement("li", { key: accessibility.id }, accessibility.accessibility)); }))))),
29163
+ React.createElement(Column, { small: "full", medium: "one-half", large: "two-thirds" },
29164
+ React.createElement(WarningText, { title: "Please note", isWarning: true },
29165
+ React.createElement("p", null, "This address is not open to visitors."))))); }))))));
29064
29166
  };
29065
29167
 
29066
29168
  const Container$1 = styled.div`
@@ -29576,7 +29678,12 @@ var DirectoryServiceList = function (_a) {
29576
29678
  zoom: mapZoom,
29577
29679
  size: '640x320',
29578
29680
  imageAltText: 'Directory search results displayed on a map',
29579
- mapMarkers: services.map(function (service, index) {
29681
+ mapMarkers: services
29682
+ .filter(function (service) {
29683
+ var _a;
29684
+ return ((_a = service.service_at_locations[0]) === null || _a === void 0 ? void 0 : _a.is_visitable) != false;
29685
+ })
29686
+ .map(function (service, index) {
29580
29687
  var _a, _b;
29581
29688
  return {
29582
29689
  lat: parseFloat((_a = service.service_at_locations[0]) === null || _a === void 0 ? void 0 : _a.latitude),
@@ -31224,5 +31331,5 @@ var DirectoryShortList = function (_a) {
31224
31331
  React.createElement("p", null, "No items in the shortlist"))))))));
31225
31332
  };
31226
31333
 
31227
- export { AccessibleLink as AccessibleLinks, Accordion$1 as Accordion, AlertBanner, AlertBannerService, Autocomplete, BackLink, 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, InquestSchedule, 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 };
31334
+ export { AccessibleLink as AccessibleLinks, Accordion$1 as Accordion, AlertBanner, AlertBannerService, Autocomplete, BackLink, BackToTop, 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, InquestSchedule, 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 };
31228
31335
  //# sourceMappingURL=index.esm.js.map