northants-design-system 0.2.17 → 0.2.18

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,5 +1,6 @@
1
1
  import Autocomplete from './library/components/Autocomplete/Autocomplete';
2
2
  import Button from './library/components/Button/Button';
3
+ import DynamicIcon from './library/components/DynamicIcon/DynamicIcon';
3
4
  import Heading from './library/components/Heading/Heading';
4
5
  import HeadingWithIcon from './library/components/HeadingWithIcon/HeadingWithIcon';
5
6
  import Pagination from './library/components/Pagination/Pagination';
@@ -7,7 +8,7 @@ import CheckboxListFilter from './library/components/CheckboxListFilter/Checkbox
7
8
  import DropDownFilter from './library/components/DropDownFilter/DropDownFilter';
8
9
  import PromotedLinks from './library/components/PromotedLinks/PromotedLinks';
9
10
  import TextInput from './library/components/TextInput/TextInput';
10
- export { Autocomplete, Button, Heading, HeadingWithIcon, Pagination, CheckboxListFilter, DropDownFilter, PromotedLinks, TextInput, };
11
+ export { Autocomplete, Button, DynamicIcon, Heading, HeadingWithIcon, Pagination, CheckboxListFilter, DropDownFilter, PromotedLinks, TextInput, };
11
12
  import Accordion from './library/slices/Accordion/Accordion';
12
13
  import BlockQuote from './library/slices/BlockQuote/BlockQuote';
13
14
  import CallToAction from './library/slices/CallToAction/CallToAction';
@@ -3898,109 +3898,27 @@ var Button$2 = function (_a) {
3898
3898
  children));
3899
3899
  };
3900
3900
 
3901
- const H1 = styled.h1`
3902
- color: ${props => props.theme.theme_vars.colours.black};
3903
- margin-left: 0;
3904
- font-weight: 700;
3905
- font-family: ${props => props.theme.theme_vars.fontstack};
3906
- margin-bottom: 20px;
3907
-
3908
- font-size: 32px;
3909
- font-size: 2rem;
3910
- line-height: 1.1;
3911
-
3912
- @media screen and (min-width: ${props => props.theme.theme_vars.breakpoints.m}){
3913
- font-size: 44px;
3914
- font-size: 2.6rem;
3915
- max-width: 960px;
3916
- margin-bottom: 30px;
3917
- }
3918
- `;
3919
- const H2 = styled.h2`
3920
- color: ${props => props.theme.theme_vars.colours.black};
3921
- font-weight: 700;
3922
- line-height: 1;
3923
- font-family: ${props => props.theme.theme_vars.fontstack};
3924
- margin-top: 25px;
3925
- margin-bottom: 15px;
3926
-
3927
- font-size: 24px;
3928
- font-size: 1.5rem;
3929
- line-height: 1.25;
3930
-
3931
- @media screen and (min-width: ${props => props.theme.theme_vars.breakpoints.m}){
3932
- font-size: 36px;
3933
- font-size: 1.75rem;
3934
- max-width: 960px;
3935
- }
3936
- `;
3937
- const H3 = styled.h3`
3938
- color: ${props => props.theme.theme_vars.colours.black};
3939
- font-weight: 600;
3940
- line-height: 1;
3941
- font-family: ${props => props.theme.theme_vars.fontstack};
3942
- margin-top: 25px;
3943
- margin-bottom: 15px;
3944
-
3945
- font-size: 24px;
3946
- font-size: 1.3rem;
3947
- line-height: 1.25;
3948
-
3949
- @media screen and (min-width: ${props => props.theme.theme_vars.breakpoints.m}){
3950
- font-size: 36px;
3951
- font-size: 1.5rem;
3952
- max-width: 960px;
3953
- }
3954
- `;
3955
- const H4 = styled.h4`
3956
- color: ${props => props.theme.theme_vars.colours.black};
3957
- line-height: 1;
3958
- font-family: ${props => props.theme.theme_vars.fontstack};
3959
- margin-top: 25px;
3960
- margin-bottom: 15px;
3961
-
3962
- font-weight: 600;
3963
- line-height: 1;
3964
- font-family: ${props => props.theme.theme_vars.fontstack};
3901
+ const Icon$5 = styled.span`
3902
+ vertical-align: middle;
3903
+ width: 100%;
3965
3904
  `;
3966
3905
 
3967
- /**
3968
- * A heading of different levels
3969
- */
3970
- var Heading = function (_a) {
3971
- var _b = _a.level, level = _b === void 0 ? 2 : _b, text = _a.text, props = __rest(_a, ["level", "text"]);
3972
- if (level === 1)
3973
- return React.createElement(H1, __assign$2({}, props), text);
3974
- if (level === 2)
3975
- return React.createElement(H2, __assign$2({}, props), text);
3976
- if (level === 3)
3977
- return React.createElement(H3, __assign$2({}, props), text);
3978
- if (level === 4)
3979
- return React.createElement(H4, __assign$2({}, props), text);
3980
- return null;
3981
- };
3982
-
3983
- const HeadingWrapper = styled.span`
3906
+ const IconWrapper$5 = styled.span`
3984
3907
  display: flex;
3985
- -webkit-flex-direction: row;
3986
- -moz-flex-direction: row;
3987
- -ms-flex-direction: row;
3988
- flex-direction: row;
3989
- align-items: center;
3990
- justify-content: left;
3991
- flex-wrap: wrap;
3908
+ flex-shrink: 0;
3909
+ width: ${(props) =>
3910
+ props.iconSize === 1 ? '65px' : props.iconSize === 2 ? '45px' : props.iconSize === 3 ? '30px' : '20px'};
3911
+ height: auto;
3992
3912
 
3993
- h1,
3994
- h2,
3995
- h3,
3996
- h4 {
3997
- margin: 0;
3998
- vertical-align: middle;
3999
- display: inline-block;
4000
- width: calc(100% - 65px);
4001
- @media screen and (min-width: ${(props) => props.theme.theme_vars.breakpoints.s}) {
4002
- width: calc(100% - 85px);
4003
- }
3913
+ @media screen and (min-width: ${(props) => props.theme.theme_vars.breakpoints.s}) {
3914
+ width: ${(props) =>
3915
+ props.iconSize === 1 ? '85px' : props.iconSize === 2 ? '76px' : props.iconSize === 3 ? '55px' : '40px'};
3916
+ height: auto;
3917
+ }
3918
+
3919
+ svg {
3920
+ width: 100%;
3921
+ height: auto;
4004
3922
  }
4005
3923
 
4006
3924
  .service-icon-hover {
@@ -4009,33 +3927,15 @@ const HeadingWrapper = styled.span`
4009
3927
 
4010
3928
  &:hover {
4011
3929
  .service-icon {
4012
- display: ${(props) => (props.hasHover ? 'none' : 'block')};
3930
+ display: none;
4013
3931
  }
3932
+
4014
3933
  .service-icon-hover {
4015
- display: ${(props) => (props.hasHover ? 'block' : 'none')};
3934
+ display: block;
4016
3935
  }
4017
3936
  }
4018
3937
  `;
4019
3938
 
4020
- const Icon$5 = styled.span`
4021
- vertical-align: middle;
4022
- `;
4023
- const IconWrapper$5 = styled.span`
4024
- width: ${(props) =>
4025
- props.iconSize === 1 ? '65px' : props.iconSize === 2 ? '45px' : props.iconSize === 3 ? '30px' : '20px'};
4026
- height: auto;
4027
-
4028
- svg {
4029
- width: 100%;
4030
- height: auto;
4031
- }
4032
- @media screen and (min-width: ${(props) => props.theme.theme_vars.breakpoints.s}) {
4033
- width: ${(props) =>
4034
- props.iconSize === 1 ? '85px' : props.iconSize === 2 ? '70px' : props.iconSize === 3 ? '55px' : '40px'};
4035
- height: auto;
4036
- }
4037
- `;
4038
-
4039
3939
  var ServiceIcon$1J = function (_a) {
4040
3940
  var colourFill = _a.colourFill;
4041
3941
  return (React.createElement("svg", { width: "76", height: "76", viewBox: "0 0 76 76", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
@@ -5416,10 +5316,10 @@ var components = {
5416
5316
  };
5417
5317
 
5418
5318
  /**
5419
- * A Heading With an Icon - used for service landing pages
5319
+ * Display a dynamic service icon with hover effect
5420
5320
  */
5421
- var HeadingWithIcon = function (_a) {
5422
- var _b = _a.level, level = _b === void 0 ? 2 : _b, text = _a.text, icon = _a.icon, _c = _a.hasHover, hasHover = _c === void 0 ? false : _c;
5321
+ var DynamicIcon = function (_a) {
5322
+ var level = _a.level, icon = _a.icon;
5423
5323
  var themeContext = useContext(ThemeContext);
5424
5324
  var DynamicComponent = function (_a) {
5425
5325
  var name = _a.name, _b = _a.isHover, isHover = _b === void 0 ? false : _b;
@@ -5433,12 +5333,139 @@ var HeadingWithIcon = function (_a) {
5433
5333
  }
5434
5334
  return React.createElement(DynamicIcon, { colourFill: themeContext.theme_vars.colours.action_dark });
5435
5335
  };
5336
+ return (React.createElement(IconWrapper$5, { iconSize: level, "data-testid": "DynamicIcon" }, icon && (React.createElement(React.Fragment, null,
5337
+ React.createElement(Icon$5, { className: "service-icon", iconSize: level, "data-testid": "Icon" },
5338
+ React.createElement(DynamicComponent, { name: icon, isHover: false })),
5339
+ React.createElement(Icon$5, { className: "service-icon-hover", iconSize: level, "data-testid": "IconHover" },
5340
+ React.createElement(DynamicComponent, { name: icon, isHover: true }))))));
5341
+ };
5342
+
5343
+ const H1 = styled.h1`
5344
+ color: ${props => props.theme.theme_vars.colours.black};
5345
+ margin-left: 0;
5346
+ font-weight: 700;
5347
+ font-family: ${props => props.theme.theme_vars.fontstack};
5348
+ margin-bottom: 20px;
5349
+
5350
+ font-size: 32px;
5351
+ font-size: 2rem;
5352
+ line-height: 1.1;
5353
+
5354
+ @media screen and (min-width: ${props => props.theme.theme_vars.breakpoints.m}){
5355
+ font-size: 44px;
5356
+ font-size: 2.6rem;
5357
+ max-width: 960px;
5358
+ margin-bottom: 30px;
5359
+ }
5360
+ `;
5361
+ const H2 = styled.h2`
5362
+ color: ${props => props.theme.theme_vars.colours.black};
5363
+ font-weight: 700;
5364
+ line-height: 1;
5365
+ font-family: ${props => props.theme.theme_vars.fontstack};
5366
+ margin-top: 25px;
5367
+ margin-bottom: 15px;
5368
+
5369
+ font-size: 24px;
5370
+ font-size: 1.5rem;
5371
+ line-height: 1.25;
5372
+
5373
+ @media screen and (min-width: ${props => props.theme.theme_vars.breakpoints.m}){
5374
+ font-size: 36px;
5375
+ font-size: 1.75rem;
5376
+ max-width: 960px;
5377
+ }
5378
+ `;
5379
+ const H3 = styled.h3`
5380
+ color: ${props => props.theme.theme_vars.colours.black};
5381
+ font-weight: 600;
5382
+ line-height: 1;
5383
+ font-family: ${props => props.theme.theme_vars.fontstack};
5384
+ margin-top: 25px;
5385
+ margin-bottom: 15px;
5386
+
5387
+ font-size: 24px;
5388
+ font-size: 1.3rem;
5389
+ line-height: 1.25;
5390
+
5391
+ @media screen and (min-width: ${props => props.theme.theme_vars.breakpoints.m}){
5392
+ font-size: 36px;
5393
+ font-size: 1.5rem;
5394
+ max-width: 960px;
5395
+ }
5396
+ `;
5397
+ const H4 = styled.h4`
5398
+ color: ${props => props.theme.theme_vars.colours.black};
5399
+ line-height: 1;
5400
+ font-family: ${props => props.theme.theme_vars.fontstack};
5401
+ margin-top: 25px;
5402
+ margin-bottom: 15px;
5403
+
5404
+ font-weight: 600;
5405
+ line-height: 1;
5406
+ font-family: ${props => props.theme.theme_vars.fontstack};
5407
+ `;
5408
+
5409
+ /**
5410
+ * A heading of different levels
5411
+ */
5412
+ var Heading = function (_a) {
5413
+ var _b = _a.level, level = _b === void 0 ? 2 : _b, text = _a.text, props = __rest(_a, ["level", "text"]);
5414
+ if (level === 1)
5415
+ return React.createElement(H1, __assign$2({}, props), text);
5416
+ if (level === 2)
5417
+ return React.createElement(H2, __assign$2({}, props), text);
5418
+ if (level === 3)
5419
+ return React.createElement(H3, __assign$2({}, props), text);
5420
+ if (level === 4)
5421
+ return React.createElement(H4, __assign$2({}, props), text);
5422
+ return null;
5423
+ };
5424
+
5425
+ const HeadingWrapper = styled.span`
5426
+ display: flex;
5427
+ -webkit-flex-direction: row;
5428
+ -moz-flex-direction: row;
5429
+ -ms-flex-direction: row;
5430
+ flex-direction: row;
5431
+ align-items: center;
5432
+ justify-content: left;
5433
+ flex-wrap: wrap;
5434
+
5435
+ h1,
5436
+ h2,
5437
+ h3,
5438
+ h4 {
5439
+ margin: 0;
5440
+ vertical-align: middle;
5441
+ display: inline-block;
5442
+ width: calc(100% - 65px);
5443
+ @media screen and (min-width: ${(props) => props.theme.theme_vars.breakpoints.s}) {
5444
+ width: calc(100% - 85px);
5445
+ }
5446
+ }
5447
+
5448
+ .service-icon-hover {
5449
+ display: none;
5450
+ }
5451
+
5452
+ &:hover {
5453
+ .service-icon {
5454
+ display: ${(props) => (props.hasHover ? 'none' : 'block')};
5455
+ }
5456
+ .service-icon-hover {
5457
+ display: ${(props) => (props.hasHover ? 'block' : 'none')};
5458
+ }
5459
+ }
5460
+ `;
5461
+
5462
+ /**
5463
+ * A Heading With an Icon - used for service landing pages
5464
+ */
5465
+ var HeadingWithIcon = function (_a) {
5466
+ var _b = _a.level, level = _b === void 0 ? 2 : _b, text = _a.text, icon = _a.icon, _c = _a.hasHover, hasHover = _c === void 0 ? false : _c;
5436
5467
  return (React.createElement(HeadingWrapper, { "data-testid": "HeadingWithIcon", hasHover: hasHover },
5437
- React.createElement(IconWrapper$5, { iconSize: level },
5438
- React.createElement(Icon$5, { className: "service-icon", iconSize: level },
5439
- React.createElement(DynamicComponent, { name: icon, isHover: false })),
5440
- React.createElement(Icon$5, { className: "service-icon-hover", iconSize: level },
5441
- React.createElement(DynamicComponent, { name: icon, isHover: true }))),
5468
+ React.createElement(DynamicIcon, { icon: icon, level: level }),
5442
5469
  React.createElement(Heading, { text: text, level: level })));
5443
5470
  };
5444
5471
 
@@ -29894,6 +29921,8 @@ const Container$5 = styled.div`
29894
29921
  `;
29895
29922
 
29896
29923
  const ServiceLink = styled.button`
29924
+ display: flex;
29925
+ align-items: center;
29897
29926
  color: ${(props) => props.theme.theme_vars.colours.action};
29898
29927
  background: ${(props) =>
29899
29928
  props.show ? props.theme.theme_vars.colours.action_light : props.theme.theme_vars.colours.grey_light};
@@ -29906,7 +29935,7 @@ const ServiceLink = styled.button`
29906
29935
  border-radius: ${(props) => props.theme.theme_vars.border_radius};
29907
29936
  ${(props) => props.theme.fontStyles};
29908
29937
  ${(props) => props.theme.linkStyles};
29909
- text-decoration-style: ${(props) => (props.show ? `dashed` : `underline`)};
29938
+ text-decoration-style: ${(props) => (props.show ? `dashed` : `solid`)};
29910
29939
 
29911
29940
  &:hover {
29912
29941
  background: ${(props) => props.theme.theme_vars.colours.action_light};
@@ -29916,6 +29945,10 @@ const ServiceLink = styled.button`
29916
29945
  cursor: pointer;
29917
29946
  }
29918
29947
 
29948
+ .service-icon-hover {
29949
+ display: none;
29950
+ }
29951
+
29919
29952
  &:hover {
29920
29953
  .service-icon {
29921
29954
  display: none;
@@ -29925,12 +29958,6 @@ const ServiceLink = styled.button`
29925
29958
  }
29926
29959
  }
29927
29960
 
29928
- h3 {
29929
- color: ${(props) => props.theme.theme_vars.colours.action};
29930
- text-align: left;
29931
- padding-left: ${(props) => props.theme.theme_vars.spacingSizes.small};
29932
- }
29933
-
29934
29961
  .serviceLinkChevron {
29935
29962
  position: absolute;
29936
29963
  top: calc(50% - 12px);
@@ -29955,6 +29982,15 @@ const ServiceLink = styled.button`
29955
29982
  }
29956
29983
  `;
29957
29984
 
29985
+ const ServiceHeading = styled.span`
29986
+ color: ${(props) => props.theme.theme_vars.colours.action};
29987
+ text-align: left;
29988
+ padding-left: ${(props) => props.theme.theme_vars.spacingSizes.small};
29989
+ padding-right: ${(props) => props.theme.theme_vars.spacingSizes.medium};
29990
+ line-height: 1.25;
29991
+ ${(props) => props.theme.theme_vars.h3}
29992
+ `;
29993
+
29958
29994
  const QuickLinksContainer = styled.div`
29959
29995
  display: ${(props) => (props.show ? 'block' : 'none')};
29960
29996
  position: absolute;
@@ -30108,7 +30144,8 @@ var ServiceLinksBoxed = function (_a) {
30108
30144
  var _a;
30109
30145
  return (React.createElement(Column, { small: "full", medium: "one-half", large: "one-third", key: index },
30110
30146
  React.createElement(ServiceLink, { onClick: function () { return toggleActive(index); }, show: index === activeServiceLink, "aria-label": index === activeServiceLink ? 'Close ' + serviceLink.title : 'View ' + serviceLink.title },
30111
- React.createElement(HeadingWithIcon, { text: serviceLink.title, icon: serviceLink.iconKey, level: 3, hasHover: true }),
30147
+ React.createElement(DynamicIcon, { icon: serviceLink.iconKey, level: 3 }),
30148
+ React.createElement(ServiceHeading, null, serviceLink.title),
30112
30149
  React.createElement("span", { className: "serviceLinkChevron" })),
30113
30150
  React.createElement(QuickLinksContainer, { show: index === activeServiceLink, ref: refs.current[index] },
30114
30151
  React.createElement(QuickLinksInnerContainer, null,
@@ -30507,19 +30544,6 @@ const Link = styled.a`
30507
30544
  }
30508
30545
  `;
30509
30546
 
30510
- const IconContainer = styled.div`
30511
- width: 76px;
30512
- height: 76px;
30513
- flex-shrink: 0;
30514
-
30515
- svg {
30516
- width: auto;
30517
- height: auto;
30518
- }
30519
- `;
30520
-
30521
- const IconInner = styled.div``;
30522
-
30523
30547
  const Title = styled(Heading)`
30524
30548
  ${(props) => props.theme.linkStyles}
30525
30549
 
@@ -30538,24 +30562,8 @@ const Title = styled(Heading)`
30538
30562
 
30539
30563
  var HeadingWithIconLink = function (_a) {
30540
30564
  var iconKey = _a.iconKey, link = _a.link, title = _a.title;
30541
- var themeContext = useContext(ThemeContext);
30542
- var DynamicComponent = function (_a) {
30543
- var name = _a.name, _b = _a.isHover, isHover = _b === void 0 ? false : _b;
30544
- var DynamicIcon;
30545
- if (name === 'culture') {
30546
- var newName = name + themeContext.cardinal_name;
30547
- DynamicIcon = components[newName + (isHover ? 'Hover' : '')];
30548
- }
30549
- else {
30550
- DynamicIcon = components[name + (isHover ? 'Hover' : '')];
30551
- }
30552
- return (React.createElement(IconInner, { className: isHover ? 'service-icon-hover' : 'service-icon', "data-testid": isHover ? 'IconHover' : 'Icon' },
30553
- React.createElement(DynamicIcon, { colourFill: themeContext.theme_vars.colours.action })));
30554
- };
30555
30565
  return (React.createElement(Link, { "data-testid": "HeadingWithIconLink", href: link, title: title },
30556
- React.createElement(IconContainer, null, iconKey && (React.createElement(React.Fragment, null,
30557
- React.createElement(DynamicComponent, { name: iconKey, isHover: false }),
30558
- React.createElement(DynamicComponent, { name: iconKey, isHover: true })))),
30566
+ React.createElement(DynamicIcon, { icon: iconKey, level: 2 }),
30559
30567
  React.createElement(Title, { text: title }, title)));
30560
30568
  };
30561
30569
 
@@ -31471,5 +31479,5 @@ const north_theme = generate_theme(north_vars);
31471
31479
  const lb_theme_north = generate_theme(lb_vars_north);
31472
31480
  const lb_theme_west = generate_theme(lb_vars_west);
31473
31481
 
31474
- export { AccessibleLink as AccessibleLinks, Accordion, AlertBanner, AlertBannerService, Autocomplete, BlockQuote, Breadcrumbs, Button$2 as Button, CallToAction, CheckboxListFilter, CookieBanner, DisplayDate, Divider, DownloadableFiles, DropDownFilter, Footer, FullWidthContainer, GDS_theme, GoogleMap, Header, Heading, HeadingWithIcon, HeroImage, HomeHero, HomeUnitarySection, Image$2 as Image, MaxWidthContainer, MemorialHero, NewsArticleDate, NewsArticleFeaturedBlock, NewsArticleFilterAccordion, NewsArticleImage, NewsArticleList, NewsArticleListHeader, NewsArticleOldBanner, PageMain, PageSidebar, PageTitle, PageWithSidebarContainer, PageWrapper, Pagination, PhaseBanner, PromoBanner, PromoBlock, PromotedLinks, Promotions, SearchResultsList, Searchbar, SectionLinks, SectionLinksMobileContents, SectionLinksSidebar, ServiceLinksBoxed, ServicesLinksList, SignpostLinks, SkipToMainContent, Summary, TextInput, Video, WarningText, WarningTextDisclaimer, lb_theme_north, lb_theme_west, north_theme, west_theme };
31482
+ export { AccessibleLink as AccessibleLinks, Accordion, AlertBanner, AlertBannerService, Autocomplete, BlockQuote, Breadcrumbs, Button$2 as Button, CallToAction, CheckboxListFilter, CookieBanner, DisplayDate, Divider, DownloadableFiles, DropDownFilter, DynamicIcon, Footer, FullWidthContainer, GDS_theme, GoogleMap, Header, Heading, HeadingWithIcon, HeroImage, HomeHero, HomeUnitarySection, Image$2 as Image, MaxWidthContainer, MemorialHero, NewsArticleDate, NewsArticleFeaturedBlock, NewsArticleFilterAccordion, NewsArticleImage, NewsArticleList, NewsArticleListHeader, NewsArticleOldBanner, PageMain, PageSidebar, PageTitle, PageWithSidebarContainer, PageWrapper, Pagination, PhaseBanner, PromoBanner, PromoBlock, PromotedLinks, Promotions, SearchResultsList, Searchbar, SectionLinks, SectionLinksMobileContents, SectionLinksSidebar, ServiceLinksBoxed, ServicesLinksList, SignpostLinks, SkipToMainContent, Summary, TextInput, Video, WarningText, WarningTextDisclaimer, lb_theme_north, lb_theme_west, north_theme, west_theme };
31475
31483
  //# sourceMappingURL=index.esm.js.map