@comicrelief/component-library 8.77.3 → 8.77.4

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/dist/style.css CHANGED
@@ -1 +1 @@
1
- @font-face{font-family:Founders-GroteskXCondensed-Bold;src:url(https://d1r885f187bvv1.cloudfront.net/FoundersGroteskX-CondensedWeb-Bold.eot);src:url(https://d1r885f187bvv1.cloudfront.net/FoundersGroteskX-CondensedWeb-Bold.woff2) format("woff2"),url(https://d1r885f187bvv1.cloudfront.net/FoundersGroteskX-CondensedWeb-Bold.woff) format("woff");font-display:fallback}@font-face{font-family:Founders-Grotesk-Semibold;src:url(https://d1r885f187bvv1.cloudfront.net/FoundersGroteskWeb-Semibold.eot);src:url(https://d1r885f187bvv1.cloudfront.net/FoundersGroteskWeb-Semibold.woff2) format("woff2"),url(https://d1r885f187bvv1.cloudfront.net/FoundersGroteskWeb-Semibold.woff) format("woff");font-display:fallback}@font-face{font-family:Founders-Grotesk-Regular;src:url(https://d1r885f187bvv1.cloudfront.net/FoundersGroteskWeb-Regular.eot);src:url(https://d1r885f187bvv1.cloudfront.net/FoundersGroteskWeb-Regular.woff2) format("woff2"),url(https://d1r885f187bvv1.cloudfront.net/FoundersGroteskWeb-Regular.woff) format("woff");font-display:fallback}html{box-sizing:border-box}*,*:before,*:after{box-sizing:inherit}body{margin:0;padding:0;-webkit-font-smoothing:antialiased}h1,h2{text-transform:uppercase;font-family:Anton,Impact,sans-serif}h1,h2,h3,h4,h5,h6,p{word-break:break-word;margin:0 0 1rem}h1:last-child,h2:last-child,h3:last-child,h4:last-child,h5:last-child h6:last-child,p:last-child{margin-bottom:0}h2,h3,h4,h5,h6,p,a,button{font-family:inherit}p,a,button{margin-top:0}p+h1,p+h2{margin-top:2rem}table{border-collapse:collapse;border-spacing:0;word-break:normal}table td{padding:10px}.ls-blur-up-is-loading{visibility:hidden}.ls-blur-up-img{position:absolute;top:0;left:0;width:100%;height:100%;display:block;font-family:"blur-up: auto","object-fit: cover";-o-object-fit:cover;object-fit:cover}.ls-blur-up-img{filter:blur(10px);opacity:1;transition:opacity 1s,filter 1.5s}.ls-blur-up-img.ls-inview.ls-original-loaded{opacity:0;filter:blur(5px)}a{color:inherit}a:hover,a:focus{text-decoration:none}.splide__container{box-sizing:border-box;position:relative}.splide__list{backface-visibility:hidden;display:flex;height:100%;margin:0!important;padding:0!important}.splide.is-initialized:not(.is-active) .splide__list{display:block}.splide__pagination{align-items:center;display:flex;flex-wrap:wrap;justify-content:center;margin:0;pointer-events:none}.splide__pagination li{display:inline-block;line-height:1;list-style-type:none;margin:0;pointer-events:auto}.splide:not(.is-overflow) .splide__pagination{display:none}.splide__progress__bar{width:0}.splide{position:relative;visibility:hidden}.splide.is-initialized,.splide.is-rendered{visibility:visible}.splide__slide{backface-visibility:hidden;box-sizing:border-box;flex-shrink:0;list-style-type:none!important;margin:0;position:relative}.splide__slide img{vertical-align:bottom}.splide__spinner{animation:splide-loading 1s linear infinite;border:2px solid #999;border-left-color:transparent;border-radius:50%;bottom:0;contain:strict;display:inline-block;height:20px;left:0;margin:auto;position:absolute;right:0;top:0;width:20px}.splide__sr{clip:rect(0 0 0 0);border:0;height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.splide__toggle.is-active .splide__toggle__play,.splide__toggle__pause{display:none}.splide__toggle.is-active .splide__toggle__pause{display:inline}.splide__track{overflow:hidden;position:relative;z-index:0}@keyframes splide-loading{0%{transform:rotate(0)}to{transform:rotate(1turn)}}.splide__track--draggable{-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.splide__track--fade>.splide__list>.splide__slide{margin:0!important;opacity:0;z-index:0}.splide__track--fade>.splide__list>.splide__slide.is-active{opacity:1;z-index:1}.splide--rtl{direction:rtl}.splide__track--ttb>.splide__list{display:block}.splide__arrow{align-items:center;background:#ccc;border:0;border-radius:50%;cursor:pointer;display:flex;height:2em;justify-content:center;opacity:.7;padding:0;position:absolute;top:50%;transform:translateY(-50%);width:2em;z-index:1}.splide__arrow svg{fill:#000;height:1.2em;width:1.2em}.splide__arrow:hover:not(:disabled){opacity:.9}.splide__arrow:disabled{opacity:.3}.splide__arrow:focus-visible{outline:3px solid #0bf;outline-offset:3px}.splide__arrow--prev{left:1em}.splide__arrow--prev svg{transform:scaleX(-1)}.splide__arrow--next{right:1em}.splide.is-focus-in .splide__arrow:focus{outline:3px solid #0bf;outline-offset:3px}.splide__pagination{bottom:.5em;left:0;padding:0 1em;position:absolute;right:0;z-index:1}.splide__pagination__page{background:#ccc;border:0;border-radius:50%;display:inline-block;height:8px;margin:3px;opacity:.7;padding:0;position:relative;transition:transform .2s linear;width:8px}.splide__pagination__page.is-active{background:#fff;transform:scale(1.4);z-index:1}.splide__pagination__page:hover{cursor:pointer;opacity:.9}.splide__pagination__page:focus-visible{outline:3px solid #0bf;outline-offset:3px}.splide.is-focus-in .splide__pagination__page:focus{outline:3px solid #0bf;outline-offset:3px}.splide__progress__bar{background:#ccc;height:3px}.splide__slide{-webkit-tap-highlight-color:rgba(0,0,0,0)}.splide__slide:focus{outline:0}@supports (outline-offset:-3px){.splide__slide:focus-visible{outline:3px solid #0bf;outline-offset:-3px}}@media screen and (-ms-high-contrast:none){.splide__slide:focus-visible{border:3px solid #0bf}}@supports (outline-offset:-3px){.splide.is-focus-in .splide__slide:focus{outline:3px solid #0bf;outline-offset:-3px}}@media screen and (-ms-high-contrast:none){.splide.is-focus-in .splide__slide:focus{border:3px solid #0bf}.splide.is-focus-in .splide__track>.splide__list>.splide__slide:focus{border-color:#0bf}}.splide__toggle{cursor:pointer}.splide__toggle:focus-visible{outline:3px solid #0bf;outline-offset:3px}.splide.is-focus-in .splide__toggle:focus{outline:3px solid #0bf;outline-offset:3px}.splide__track--nav>.splide__list>.splide__slide{border:3px solid transparent;cursor:pointer}.splide__track--nav>.splide__list>.splide__slide.is-active{border:3px solid #000}.splide__arrows--rtl .splide__arrow--prev{left:auto;right:1em}.splide__arrows--rtl .splide__arrow--prev svg{transform:scaleX(1)}.splide__arrows--rtl .splide__arrow--next{left:1em;right:auto}.splide__arrows--rtl .splide__arrow--next svg{transform:scaleX(-1)}.splide__arrows--ttb .splide__arrow{left:50%;transform:translate(-50%)}.splide__arrows--ttb .splide__arrow--prev{top:1em}.splide__arrows--ttb .splide__arrow--prev svg{transform:rotate(-90deg)}.splide__arrows--ttb .splide__arrow--next{bottom:1em;top:auto}.splide__arrows--ttb .splide__arrow--next svg{transform:rotate(90deg)}.splide__pagination--ttb{bottom:0;display:flex;flex-direction:column;left:auto;padding:1em 0;right:.5em;top:0}.rsg--content-3,.rsg--content-3 div[data-preview=HeroBanner]{padding:0}.range-slider{touch-action:none;-webkit-tap-highlight-color:transparent;-webkit-user-select:none;user-select:none;cursor:pointer;display:block;position:relative;width:100%;height:8px;background:#ddd;border-radius:4px}.range-slider[data-vertical]{height:100%;width:8px}.range-slider[data-disabled]{opacity:.5;cursor:not-allowed}.range-slider .range-slider__thumb{position:absolute;z-index:3;top:50%;width:24px;height:24px;transform:translate(-50%,-50%);border-radius:50%;background:#2196f3}.range-slider .range-slider__thumb:focus-visible{outline:0;box-shadow:0 0 0 6px #2196f380}.range-slider[data-vertical] .range-slider__thumb{left:50%}.range-slider .range-slider__thumb[data-disabled]{z-index:2}.range-slider .range-slider__range{position:absolute;z-index:1;transform:translateY(-50%);top:50%;width:100%;height:100%;background:#51adf6}.range-slider[data-vertical] .range-slider__range{left:50%;transform:translate(-50%)}.range-slider input[type=range]{-webkit-appearance:none;pointer-events:none;position:absolute;z-index:2;top:0;left:0;width:0;height:0;background-color:transparent}.range-slider input[type=range]::-webkit-slider-thumb{-webkit-appearance:none;-moz-appearance:none;appearance:none}.range-slider input[type=range]::-moz-range-thumb{width:0;height:0;border:0}.range-slider input[type=range]:focus{outline:0}.buttonBack___1mlaL,.buttonFirst___2rhFr,.buttonLast___2yuh0,.buttonNext___2mOCa,.buttonNext___3Lm3s,.dot___3c3SI{cursor:pointer}.image___xtQGH{display:block;width:100%;height:100%}.spinner___27VUp{position:absolute;top:calc(50% - 15px);left:calc(50% - 15px);width:30px;height:30px;animation-name:spin___S3UuE;animation-duration:1s;animation-timing-function:linear;animation-iteration-count:infinite;border:4px solid #a9a9a9;border-top-color:#000;border-radius:30px}@keyframes spin___S3UuE{0%{transform:rotate(0)}to{transform:rotate(1turn)}}.container___2O72F{position:relative;overflow:hidden;height:100%;width:100%}.overlay___IV4qY{position:absolute;top:0;left:0;bottom:0;right:0;opacity:0;cursor:zoom-in;transition:opacity .3s,transform .3s}.hover___MYy31,.loading___1pvNI,.zoom___3kqYk{opacity:1}.imageLoadingSpinnerContainer___3UIPD{position:absolute;top:0;right:0;bottom:0;left:0;background-color:#f4f4f4}.slide___3-Nqo{position:relative;display:block;box-sizing:border-box;height:0;margin:0;list-style-type:none}.slide___3-Nqo:focus{outline:none!important}.slideHorizontal___1NzNV{float:left}[dir=rtl] .slideHorizontal___1NzNV{direction:rtl;transform:scaleX(-1)}.slideInner___2mfX9{position:absolute;top:0;left:0;width:100%;height:100%}.focusRing___1airF{position:absolute;top:5px;right:5px;bottom:5px;left:5px;pointer-events:none;outline-width:5px;outline-style:solid;outline-color:Highlight}@media (-webkit-min-device-pixel-ratio:0){.focusRing___1airF{outline-style:auto;outline-color:-webkit-focus-ring-color}}.horizontalSlider___281Ls{position:relative;overflow:hidden}.horizontalSlider___281Ls:not(.touchDisabled___2qs4y){touch-action:pan-y pinch-zoom}[dir=rtl] .horizontalSlider___281Ls{direction:ltr;transform:scaleX(-1)}.horizontalSliderTray___1L-0W{overflow:hidden;width:100%}.verticalSlider___34ZFD{position:relative;overflow:hidden}.verticalSliderTray___267D8{overflow:hidden}.verticalTray___12Key{float:left}.verticalSlideTrayWrap___2nO7o{overflow:hidden}.sliderTray___-vHFQ{display:block;list-style:none;padding:0;margin:0}.sliderAnimation___300FY{transition:transform .5s;transition-timing-function:cubic-bezier(.645,.045,.355,1);will-change:transform}.masterSpinnerContainer___1Z6hB{position:absolute;top:0;right:0;bottom:0;left:0;background-color:#f4f4f4}
1
+ @font-face{font-family:Founders-GroteskXCondensed-Bold;src:url(https://d1r885f187bvv1.cloudfront.net/FoundersGroteskX-CondensedWeb-Bold.eot);src:url(https://d1r885f187bvv1.cloudfront.net/FoundersGroteskX-CondensedWeb-Bold.woff2) format("woff2"),url(https://d1r885f187bvv1.cloudfront.net/FoundersGroteskX-CondensedWeb-Bold.woff) format("woff");font-display:fallback}@font-face{font-family:Founders-Grotesk-Semibold;src:url(https://d1r885f187bvv1.cloudfront.net/FoundersGroteskWeb-Semibold.eot);src:url(https://d1r885f187bvv1.cloudfront.net/FoundersGroteskWeb-Semibold.woff2) format("woff2"),url(https://d1r885f187bvv1.cloudfront.net/FoundersGroteskWeb-Semibold.woff) format("woff");font-display:fallback}@font-face{font-family:Founders-Grotesk-Regular;src:url(https://d1r885f187bvv1.cloudfront.net/FoundersGroteskWeb-Regular.eot);src:url(https://d1r885f187bvv1.cloudfront.net/FoundersGroteskWeb-Regular.woff2) format("woff2"),url(https://d1r885f187bvv1.cloudfront.net/FoundersGroteskWeb-Regular.woff) format("woff");font-display:fallback}html{box-sizing:border-box}*,*:before,*:after{box-sizing:inherit}body{margin:0;padding:0;-webkit-font-smoothing:antialiased}h1,h2{text-transform:uppercase;font-family:Anton,Impact,sans-serif}h1,h2,h3,h4,h5,h6,p{word-break:break-word;margin:0 0 1rem}h1:last-child,h2:last-child,h3:last-child,h4:last-child,h5:last-child h6:last-child,p:last-child{margin-bottom:0}h2,h3,h4,h5,h6,p,a,button{font-family:inherit}p,a,button{margin-top:0}p+h1,p+h2{margin-top:2rem}table{border-collapse:collapse;border-spacing:0;word-break:normal}table td{padding:10px}.ls-blur-up-is-loading{visibility:hidden}.ls-blur-up-img{position:absolute;top:0;left:0;width:100%;height:100%;display:block;font-family:"blur-up: auto","object-fit: cover";-o-object-fit:cover;object-fit:cover}.ls-blur-up-img{filter:blur(10px);opacity:1;transition:opacity 1s,filter 1.5s}.ls-blur-up-img.ls-inview.ls-original-loaded{opacity:0;filter:blur(5px)}a{color:inherit}a:hover,a:focus{text-decoration:none}.splide__container{box-sizing:border-box;position:relative}.splide__list{backface-visibility:hidden;display:flex;height:100%;margin:0!important;padding:0!important}.splide.is-initialized:not(.is-active) .splide__list{display:block}.splide__pagination{align-items:center;display:flex;flex-wrap:wrap;justify-content:center;margin:0;pointer-events:none}.splide__pagination li{display:inline-block;line-height:1;list-style-type:none;margin:0;pointer-events:auto}.splide:not(.is-overflow) .splide__pagination{display:none}.splide__progress__bar{width:0}.splide{position:relative;visibility:hidden}.splide.is-initialized,.splide.is-rendered{visibility:visible}.splide__slide{backface-visibility:hidden;box-sizing:border-box;flex-shrink:0;list-style-type:none!important;margin:0;position:relative}.splide__slide img{vertical-align:bottom}.splide__spinner{animation:splide-loading 1s linear infinite;border:2px solid #999;border-left-color:transparent;border-radius:50%;bottom:0;contain:strict;display:inline-block;height:20px;left:0;margin:auto;position:absolute;right:0;top:0;width:20px}.splide__sr{clip:rect(0 0 0 0);border:0;height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.splide__toggle.is-active .splide__toggle__play,.splide__toggle__pause{display:none}.splide__toggle.is-active .splide__toggle__pause{display:inline}.splide__track{overflow:hidden;position:relative;z-index:0}@keyframes splide-loading{0%{transform:rotate(0)}to{transform:rotate(1turn)}}.splide__track--draggable{-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.splide__track--fade>.splide__list>.splide__slide{margin:0!important;opacity:0;z-index:0}.splide__track--fade>.splide__list>.splide__slide.is-active{opacity:1;z-index:1}.splide--rtl{direction:rtl}.splide__track--ttb>.splide__list{display:block}.splide__arrow{align-items:center;background:#ccc;border:0;border-radius:50%;cursor:pointer;display:flex;height:2em;justify-content:center;opacity:.7;padding:0;position:absolute;top:50%;transform:translateY(-50%);width:2em;z-index:1}.splide__arrow svg{fill:#000;height:1.2em;width:1.2em}.splide__arrow:hover:not(:disabled){opacity:.9}.splide__arrow:disabled{opacity:.3}.splide__arrow:focus-visible{outline:3px solid #0bf;outline-offset:3px}.splide__arrow--prev{left:1em}.splide__arrow--prev svg{transform:scaleX(-1)}.splide__arrow--next{right:1em}.splide.is-focus-in .splide__arrow:focus{outline:3px solid #0bf;outline-offset:3px}.splide__pagination{bottom:.5em;left:0;padding:0 1em;position:absolute;right:0;z-index:1}.splide__pagination__page{background:#ccc;border:0;border-radius:50%;display:inline-block;height:8px;margin:3px;opacity:.7;padding:0;position:relative;transition:transform .2s linear;width:8px}.splide__pagination__page.is-active{background:#fff;transform:scale(1.4);z-index:1}.splide__pagination__page:hover{cursor:pointer;opacity:.9}.splide__pagination__page:focus-visible{outline:3px solid #0bf;outline-offset:3px}.splide.is-focus-in .splide__pagination__page:focus{outline:3px solid #0bf;outline-offset:3px}.splide__progress__bar{background:#ccc;height:3px}.splide__slide{-webkit-tap-highlight-color:rgba(0,0,0,0)}.splide__slide:focus{outline:0}@supports (outline-offset:-3px){.splide__slide:focus-visible{outline:3px solid #0bf;outline-offset:-3px}}@media screen and (-ms-high-contrast:none){.splide__slide:focus-visible{border:3px solid #0bf}}@supports (outline-offset:-3px){.splide.is-focus-in .splide__slide:focus{outline:3px solid #0bf;outline-offset:-3px}}@media screen and (-ms-high-contrast:none){.splide.is-focus-in .splide__slide:focus{border:3px solid #0bf}.splide.is-focus-in .splide__track>.splide__list>.splide__slide:focus{border-color:#0bf}}.splide__toggle{cursor:pointer}.splide__toggle:focus-visible{outline:3px solid #0bf;outline-offset:3px}.splide.is-focus-in .splide__toggle:focus{outline:3px solid #0bf;outline-offset:3px}.splide__track--nav>.splide__list>.splide__slide{border:3px solid transparent;cursor:pointer}.splide__track--nav>.splide__list>.splide__slide.is-active{border:3px solid #000}.splide__arrows--rtl .splide__arrow--prev{left:auto;right:1em}.splide__arrows--rtl .splide__arrow--prev svg{transform:scaleX(1)}.splide__arrows--rtl .splide__arrow--next{left:1em;right:auto}.splide__arrows--rtl .splide__arrow--next svg{transform:scaleX(-1)}.splide__arrows--ttb .splide__arrow{left:50%;transform:translate(-50%)}.splide__arrows--ttb .splide__arrow--prev{top:1em}.splide__arrows--ttb .splide__arrow--prev svg{transform:rotate(-90deg)}.splide__arrows--ttb .splide__arrow--next{bottom:1em;top:auto}.splide__arrows--ttb .splide__arrow--next svg{transform:rotate(90deg)}.splide__pagination--ttb{bottom:0;display:flex;flex-direction:column;left:auto;padding:1em 0;right:.5em;top:0}.rsg--content-3,.rsg--content-3 div[data-preview=HeroBanner]{padding:0}.range-slider{touch-action:none;-webkit-tap-highlight-color:transparent;-webkit-user-select:none;user-select:none;cursor:pointer;display:block;position:relative;width:100%;height:8px;background:#ddd;border-radius:4px}.range-slider[data-vertical]{height:100%;width:8px}.range-slider[data-disabled]{opacity:.5;cursor:not-allowed}.range-slider .range-slider__thumb{position:absolute;z-index:3;top:50%;width:24px;height:24px;transform:translate(-50%,-50%);border-radius:50%;background:#2196f3}.range-slider .range-slider__thumb:focus-visible{outline:0;box-shadow:0 0 0 6px #2196f380}.range-slider[data-vertical] .range-slider__thumb{left:50%}.range-slider .range-slider__thumb[data-disabled]{z-index:2}.range-slider .range-slider__range{position:absolute;z-index:1;transform:translateY(-50%);top:50%;width:100%;height:100%;background:#51adf6}.range-slider[data-vertical] .range-slider__range{left:50%;transform:translate(-50%)}.range-slider input[type=range]{-webkit-appearance:none;pointer-events:none;position:absolute;z-index:2;top:0;left:0;width:0;height:0;background-color:transparent}.range-slider input[type=range]::-webkit-slider-thumb{-webkit-appearance:none;-moz-appearance:none;appearance:none}.range-slider input[type=range]::-moz-range-thumb{width:0;height:0;border:0}.range-slider input[type=range]:focus{outline:0}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@comicrelief/component-library",
3
3
  "author": "Comic Relief Engineering Team",
4
- "version": "8.77.3",
4
+ "version": "8.77.4",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.es.js",
7
7
  "files": [
@@ -1,11 +1,10 @@
1
1
  import React, {
2
- useEffect, useState, useCallback
2
+ useEffect, useState
3
3
  } from 'react';
4
4
  import PropTypes from 'prop-types';
5
- import {
6
- CarouselProvider, Slider, Slide, ButtonBack, ButtonNext
7
- } from 'pure-react-carousel';
8
- import 'pure-react-carousel/dist/react-carousel.es.css';
5
+
6
+ import { Splide, SplideSlide } from '@splidejs/react-splide';
7
+
9
8
  import {
10
9
  CarouselWrapper, SlideCopyWrapper, HeadingCopyWrapper, Container
11
10
  } from './RichtextCarousel.style';
@@ -29,51 +28,19 @@ const RichtextCarousel = ({
29
28
  rowBackgroundColour = 'grey_light'
30
29
  }
31
30
  }) => {
32
- // Defaults to mobile config:
33
- const [isMobile, setIsMobile] = useState(true);
34
- const [visibleSlides, setVisibleSlides] = useState(1);
35
- const [totalSlides, setTotalSlides] = useState(null);
36
31
  const [theseItems, setTheseItems] = useState();
37
32
 
38
- // Custom function to let us update the carousel config dynamically
39
- const screenResize = useCallback(() => {
40
- const screenSize = typeof window !== 'undefined' ? window.innerWidth : null;
41
- const isCurrentlyMobile = window.innerWidth < breakpointValues.M;
42
-
43
- if (screenSize !== null && (isMobile !== isCurrentlyMobile)) {
44
- setIsMobile(isCurrentlyMobile);
45
- setVisibleSlides(isCurrentlyMobile ? 1 : 3);
46
- setTotalSlides(isCurrentlyMobile ? theseItems.length : theseItems.length + 2);
47
- }
48
- }, [isMobile, theseItems]);
49
-
50
33
  // Cache our data source, using as a flag for render logic:
51
34
  useEffect(() => {
52
35
  setTheseItems(nodes);
53
36
  }, [setTheseItems, nodes]);
54
37
 
55
- useEffect(() => {
56
- if (window !== 'undefined' && window.innerWidth >= breakpointValues.M) {
57
- // On inital render, update carousel plugin config
58
- // to suit the non-mobile layout and functionality:
59
- setIsMobile(false);
60
- setVisibleSlides(3);
61
- }
62
-
63
- // Hook into browser's own onresize event to call our custom wrapper function:
64
- if (typeof window !== 'undefined') window.onresize = screenResize;
65
- }, [screenResize]);
66
-
67
- if (theseItems && totalSlides === null) {
68
- // Reflects our two dummy/bookend slides for non-mobile/tablet views:
69
- setTotalSlides(isMobile ? theseItems.length : theseItems.length + 2);
70
- }
71
-
72
38
  return (
73
39
  <Container
74
40
  $paddingTop={paddingTop}
75
41
  $paddingBottom={paddingBottom}
76
42
  $rowBackgroundColour={rowBackgroundColour}
43
+ data-testid="richtext-carousel--container"
77
44
  >
78
45
 
79
46
  <CarouselWrapper
@@ -83,42 +50,52 @@ const RichtextCarousel = ({
83
50
  $tabletHeight={tabletHeight}
84
51
  $desktopHeight={desktopHeight}
85
52
  $carouselBackgroundColour={carouselBackgroundColour}
53
+ data-testid="richtext-carousel--wrapper"
86
54
  >
87
55
 
88
- <HeadingCopyWrapper>
56
+ <HeadingCopyWrapper data-testid="richtext-carousel--heading">
89
57
  {headingCopy}
90
58
  </HeadingCopyWrapper>
91
59
 
92
60
  {theseItems && (
93
- <CarouselProvider
94
- naturalSlideWidth={50}
95
- naturalSlideHeight={200}
96
- totalSlides={totalSlides}
97
- isPlaying={autoPlay}
98
- interval={5000}
99
- visibleSlides={visibleSlides}
100
- infinite
101
- >
102
- <Slider classNameAnimation="richtext-carousel">
103
-
104
- {/* Dummy slide for our desired non-mobile layout and functionality */}
105
- {isMobile === false && (
106
- <Slide index={0} key={0} />
107
- )}
108
-
61
+ <Splide
62
+ className="richtext-carousel"
63
+ data-testid="richtext-carousel--splide"
64
+ options={{
65
+ speed: 1000,
66
+ arrows: true,
67
+ pagination: false,
68
+ drag: 'free',
69
+ flickPower: 50,
70
+ perMove: 1,
71
+ dragMinThreshold: { mouse: 50, touch: 50 },
72
+ updateOnMove: true,
73
+ snap: true,
74
+ autoplay: autoPlay,
75
+ focus: 'center',
76
+ trimSpace: false,
77
+ perPage: 3,
78
+ rewind: true,
79
+ breakpoints: {
80
+ [breakpointValues.M]: {
81
+ perPage: 1
82
+ }
83
+ }
84
+ }}
85
+ >
109
86
  {Object.keys(theseItems).map((key, index) => {
110
- // Reflect that initial dummy/bookend slide shown on non-mobile/tablet views:
111
- const thisOffsetIndex = index + (isMobile ? 0 : 1);
87
+ const safeIndex = index;
112
88
 
113
89
  return (
114
- // Calculate the index offset accordingly to reflect the number of slides,
115
- // but use the REAL index when determining if its the last REAL slide
116
- <Slide
117
- index={thisOffsetIndex}
90
+ // Calculate the index offset accordingly to reflect the number of slides,
91
+ // but use the REAL index when determining if its the last REAL slide
92
+ <SplideSlide
118
93
  className={index === (theseItems.length - 1) && 'last-slide'}
119
- key={thisOffsetIndex}
94
+ key={safeIndex}
95
+ index={safeIndex}
96
+ data-index={safeIndex}
97
+ data-testid="richtext-carousel--slide"
120
98
  >
121
-
122
99
  <SlideCopyWrapper
123
100
  className="slide-copy-wrapper"
124
101
  $mobileHeight={mobileHeight}
@@ -126,28 +103,18 @@ const RichtextCarousel = ({
126
103
  $desktopHeight={desktopHeight}
127
104
  $nodeBackgroundColour={nodeBackgroundColour}
128
105
  $nodeOutlineColour={nodeOutlineColour}
106
+ data-testid="richtext-carousel--copy"
129
107
  >
130
108
  {theseItems[index].copy}
131
109
  </SlideCopyWrapper>
132
110
 
133
- </Slide>
111
+ </SplideSlide>
134
112
  );
135
113
  })}
136
-
137
- {/* Dummy slide for our desired non-mobile layout and functionality */}
138
- {isMobile === false && (
139
- <Slide index={theseItems.length + 1} key="bookend-last" />
140
- )}
141
-
142
- </Slider>
143
- <ButtonBack>Back</ButtonBack>
144
- <ButtonNext>Next</ButtonNext>
145
- </CarouselProvider>
114
+ </Splide>
146
115
  )}
147
-
148
116
  </CarouselWrapper>
149
117
  </Container>
150
-
151
118
  );
152
119
  };
153
120
 
@@ -18,6 +18,13 @@ const SlideCopyWrapper = styled.div`
18
18
  position: relative;
19
19
  overflow: visible;
20
20
  word-wrap: break-word;
21
+ font-size: 0.9rem;
22
+ line-height: 0.9rem;
23
+
24
+ * {
25
+ font-size: inherit;
26
+ line-height: inherit;
27
+ }
21
28
 
22
29
  &:after {
23
30
  position: absolute;
@@ -41,54 +48,61 @@ const SlideCopyWrapper = styled.div`
41
48
 
42
49
  const HeadingCopyWrapper = styled.div`
43
50
  text-align: center;
51
+
52
+ * {
53
+ margin-top: 0;
54
+ }
55
+
56
+ h1, h2, h3 {
57
+ margin-bottom: 1.5rem;
58
+ }
44
59
  `;
45
60
 
46
61
  // Unfortunately having to target plugin-created markup ye olde fashioned way:
47
62
  const CarouselWrapper = styled.div`
48
63
  height: 100%;
49
64
  background: ${({ theme, $carouselBackgroundColour }) => theme.color($carouselBackgroundColour)};
50
-
51
65
  max-width: 760px;
52
66
  padding: 2.5rem ${spacing('l')} 3.5rem;
53
67
  margin: 0 auto;
54
-
55
68
  border-radius: 20px;
56
69
  ${defaultBoxShadow()}
57
70
 
58
- > div:first-child {
59
- * {
60
- margin-top: 0;
61
- }
62
-
63
- h1, h2, h3 {
64
- margin-bottom: 1.5rem;
65
- }
66
- }
67
-
68
- .carousel {
71
+ .splide {
69
72
  position: relative;
70
73
  margin: 0 auto;
71
74
  padding-top: ${spacing('l')};
72
75
 
73
- button.carousel__back-button,
74
- button.carousel__next-button {
76
+ // Navigation buttons:
77
+ .splide__arrows {
78
+ width: 100%;
79
+ position: absolute;
80
+ top: 0;
81
+ left: 0;
82
+ height: 100%;
83
+ width: 100%;
84
+ }
85
+
86
+ button.splide__arrow {
75
87
  position: absolute;
76
88
  left: 0;
77
89
  top: 0;
78
- width: 33% !important;
90
+ width: 33.3%;
79
91
  height: 100%;
80
- padding: 0 !important;
92
+ padding: 0;
81
93
  box-shadow: none;
82
94
  text-indent: -9999px;
83
95
  background-color: transparent;
84
- border: none;
96
+ transform: none;
97
+ border-radius: 0;
98
+ opacity: 1;
85
99
 
86
100
  &:after {
87
101
  content: "";
88
102
  position: absolute;
89
103
  top: 0;
90
104
  left: 0;
91
- width: 50%;
105
+ width: 100%;
92
106
  height: 100%;
93
107
  transition: opacity 0.2s linear;
94
108
  background: ${({ theme, $carouselBackgroundColour }) => css`
@@ -97,165 +111,82 @@ const CarouselWrapper = styled.div`
97
111
  `};
98
112
  }
99
113
 
100
- &:hover {
101
- &:after {
102
- opacity: 0.5;
103
- }
104
- }
105
-
106
- @media ${({ theme }) => theme.allBreakpoints('M')} {
107
- width: 33.3% !important;
108
- &:after {
109
- width: 100%;
110
- }
111
- }
112
- }
113
-
114
- button.carousel__next-button {
115
- left: auto;
116
- right: 0;
117
-
118
- &:before {
119
- transform: translate(0, -50%) rotate(-90deg);
120
- }
121
-
122
- &:after {
114
+ &.splide__arrow--next {
123
115
  left: auto;
124
116
  right: 0;
125
117
 
126
- background: ${({ theme, $carouselBackgroundColour }) => css`
118
+ &:after {
119
+ left: auto;
120
+ right: 0;
121
+ background: ${({ theme, $carouselBackgroundColour }) => css`
127
122
  linear-gradient(90deg, ${theme.color($carouselBackgroundColour)}00,
128
123
  ${theme.color($carouselBackgroundColour)}7a, ${theme.color($carouselBackgroundColour)});
129
124
  `};
125
+ }
130
126
  }
131
- }
132
-
133
- .richtext-carousel {
134
- // Override default animations
135
- transition: -webkit-transform ${animationSpeed}s;
136
- -o-transition: transform ${animationSpeed}s;
137
- transition: transform ${animationSpeed}s;
138
- -webkit-transform: ${animationSpeed}s;
139
- will-change: transform;
140
127
 
141
- .last-slide {
142
- .slide-copy-wrapper:after {
143
- content: none;
128
+ &:hover {
129
+ &:after {
130
+ opacity: 0.5;
144
131
  }
145
132
  }
146
133
 
147
- .carousel__slide {
148
- // 'Mobile'
149
- padding-bottom: ${props => props.$mobileHeight}px !important;
134
+ svg {
135
+ display: none;
136
+ }
137
+ }
150
138
 
139
+ // Carousel:
140
+ &.richtext-carousel {
141
+
142
+ // All sides:
143
+ .splide__slide {
144
+ text-align: center;
145
+ display: inline-flex;
146
+ align-items: center;
147
+ justify-content: flex-start;
148
+ flex-direction: column;
149
+ height: ${props => props.$mobileHeight}px;
150
+
151
+ // No dashed 'connecting' line on the final slide
152
+ &.last-slide {
153
+ ${SlideCopyWrapper} {
154
+ &:after {
155
+ content: none !important;
156
+ }
157
+ }
158
+ }
159
+
151
160
  // 'Tablet' (and up) tweaks for the 3-visible layout
152
161
  @media ${({ theme }) => theme.allBreakpoints('M')} {
153
-
154
- padding-bottom: ${props => props.$tabletHeight}px !important;
155
-
156
- // All slides:
157
- .carousel__inner-slide {
158
-
159
- // All 'SlideCopyWrapper's:
160
- > div:first-child {
161
- transition: transform ${animationSpeed}s ease;
162
- transform-origin: center;
163
- transform: scale(0.8);
164
-
165
- &:after {
166
- transition: transform ${animationSpeed}s ease,
167
- width ${animationSpeed}s ease,
168
- right ${animationSpeed}s ease;
169
- width: 100%;
170
- right: calc(-100% - 6px);
171
- transform: scale(1);
172
-
173
- }
162
+ height: ${props => props.$tabletHeight}px;
163
+
164
+ // All 'SlideCopyWrapper's:
165
+ ${SlideCopyWrapper} {
166
+ transition: transform ${animationSpeed}s ease;
167
+ transform-origin: center;
168
+ transform: scale(0.8);
169
+
170
+ &:after {
171
+ transition: transform ${animationSpeed}s ease,
172
+ width ${animationSpeed}s ease,
173
+ right ${animationSpeed}s ease;
174
+ width: 50%;
175
+ right: calc(-50% - 1px);
176
+ transform: scale(1);
174
177
  }
175
178
  }
176
179
 
177
- // Our 'first' slide of the three:
178
- &.carousel__slide--visible {
179
- .carousel__inner-slide {
180
- > div:first-child {
181
- &:after {
182
- width: 33%;
183
- right: calc(-33% - 3px);
184
- transform: scale(1);
185
- }
186
- }
187
- }
188
-
189
- // 2nd and 3rd:
190
- + .carousel__slide--visible {
191
- .carousel__inner-slide {
192
- > div:first-child {
193
- transform: scale(1);
194
- &:after {
195
- width: 33%;
196
- right: calc(-33% + 3px);
197
- transform: scale(0.8);
198
- }
199
- }
200
- }
201
-
202
- // Resets the 3rd slide:
203
- + .carousel__slide--visible {
204
- > div > div:first-child {
205
- transform: scale(0.8);
206
- &:after {
207
- width: 50%;
208
- right: calc(-50% - 6px);
209
- transform: scale(1);
210
- }
211
- }
212
- }
213
- }
180
+ // Our middle, active slide:
181
+ &.is-active {
182
+ ${SlideCopyWrapper} {
183
+ transform: scale(1.0);
184
+ }
214
185
  }
215
186
  }
216
187
 
217
- // 'Desktop'
218
188
  @media ${({ theme }) => theme.allBreakpoints('L')} {
219
- padding-bottom: ${props => props.$desktopHeight}px !important;
220
-
221
- // First
222
- &.carousel__slide--visible {
223
-
224
- // 2nd and 3rd
225
- + .carousel__slide--visible {
226
-
227
- // 3rd only
228
- + .carousel__slide--visible {
229
- .carousel__inner-slide {
230
- > div:first-child {
231
- &:after {
232
- right: calc(-125% - 5px);
233
- width: 125%;
234
- }
235
- }
236
- }
237
- }
238
- }
239
- }
240
- }
241
- // END OF DESKTOP
242
-
243
- .carousel__inner-slide {
244
- text-align: center;
245
- display: inline-flex;
246
- align-items: center;
247
- justify-content: flex-start;
248
- flex-direction: column;
249
-
250
- .slide-copy-wrapper {
251
- font-size: 0.9rem;
252
- line-height: 0.9rem;
253
-
254
- * {
255
- font-size: inherit;
256
- line-height: inherit;
257
- }
258
- }
189
+ height: ${props => props.$desktopHeight}px;
259
190
  }
260
191
  }
261
192
  }