@treely/strapi-slices 6.1.0 → 6.2.0

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.
@@ -5,6 +5,7 @@ import StrapiTextCardWithIcon from '../../models/strapi/StrapiTextCardWithIcons'
5
5
  interface TextCarouselSlice extends StrapiDefaultHeader {
6
6
  slides: StrapiTextCardWithIcon[];
7
7
  button?: StrapiLink;
8
+ isShuffled?: boolean;
8
9
  }
9
10
  export interface TextCarouselProps {
10
11
  slice: TextCarouselSlice;
@@ -1,6 +1,7 @@
1
1
  declare const _default: import("@storybook/types").ComponentAnnotations<import("@storybook/react/dist/types-0fc72a6d").R, import("./TextCarousel").TextCarouselProps>;
2
2
  export default _default;
3
3
  export declare const Minimal: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0fc72a6d").R, import("./TextCarousel").TextCarouselProps>;
4
+ export declare const WithShuffledCards: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0fc72a6d").R, import("./TextCarousel").TextCarouselProps>;
4
5
  export declare const WithTagline: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0fc72a6d").R, import("./TextCarousel").TextCarouselProps>;
5
6
  export declare const WithTaglineAndText: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0fc72a6d").R, import("./TextCarousel").TextCarouselProps>;
6
7
  export declare const WithButton: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0fc72a6d").R, import("./TextCarousel").TextCarouselProps>;
@@ -2272,14 +2272,14 @@ var TextCardGrid = function TextCardGrid(_ref) {
2272
2272
 
2273
2273
  var _templateObject$5, _templateObject2$2, _templateObject3$1;
2274
2274
  var CarouselContainer = /*#__PURE__*/styled__default.default(boemly.Box)(_templateObject$5 || (_templateObject$5 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n margin-top: var(--boemly-space-6);\n padding: var(--boemly-space-8) 0;\n\n @media screen and (max-width: ", ") {\n margin-top: var(--boemly-space-4);\n width: var(--boemly-sizes-full);\n }\n\n width: var(--boemly-sizes-full);\n\n overflow-x: hidden;\n\n @media screen and (max-width: ", ") {\n overflow-x: scroll;\n }\n"])), BREAKPOINT_MD, BREAKPOINT_MD);
2275
- var CarouselInnerContainer = /*#__PURE__*/styled__default.default(framerMotion.motion.div)(_templateObject2$2 || (_templateObject2$2 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n gap: var(--boemly-space-6);\n justify-content: center;\n\n width: calc(\n (var(--boemly-sizes-sm) + var(--boemly-space-6)) *\n ", " +\n var(--boemly-space-6)\n );\n min-width: var(--boemly-sizes-full);\n\n @media screen and (max-width: ", ") {\n justify-content: flex-start;\n width: calc(\n (var(--boemly-sizes-2xs) + var(--boemly-space-4)) *\n ", " +\n var(--boemly-space-6)\n );\n }\n"])), function (_ref) {
2275
+ var CarouselInnerContainer = /*#__PURE__*/styled__default.default(framerMotion.motion.div)(_templateObject2$2 || (_templateObject2$2 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n gap: var(--boemly-space-6);\n justify-content: center;\n\n width: calc(\n (var(--boemly-sizes-sm) + var(--boemly-space-6)) *\n ", " +\n var(--boemly-space-6)\n );\n min-width: var(--boemly-sizes-full);\n\n @media screen and (max-width: ", ") {\n gap: var(--boemly-space-1);\n justify-content: flex-start;\n width: calc(\n (var(--boemly-sizes-2xs) + var(--boemly-space-4)) *\n ", " +\n var(--boemly-space-6)\n );\n }\n"])), function (_ref) {
2276
2276
  var numberOfItems = _ref.numberOfItems;
2277
2277
  return numberOfItems;
2278
2278
  }, BREAKPOINT_MD, function (_ref2) {
2279
2279
  var numberOfItems = _ref2.numberOfItems;
2280
2280
  return numberOfItems;
2281
2281
  });
2282
- var CardContainer = /*#__PURE__*/styled__default.default(boemly.Box)(_templateObject3$1 || (_templateObject3$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n width: var(--boemly-sizes-sm);\n\n @media screen and (max-width: ", ") {\n width: var(--boemly-sizes-2xs);\n\n margin-right: var(--boemly-space-4);\n\n &:first-of-type {\n margin-left: var(--boemly-space-6);\n }\n }\n"])), BREAKPOINT_MD);
2282
+ var CardContainer = /*#__PURE__*/styled__default.default(boemly.Box)(_templateObject3$1 || (_templateObject3$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n width: var(--boemly-sizes-sm);\n\n @media screen and (max-width: ", ") {\n min-width: var(--boemly-sizes-sm);\n\n margin-right: var(--boemly-space-4);\n\n &:first-of-type {\n margin-left: var(--boemly-space-6);\n }\n }\n"])), BREAKPOINT_MD);
2283
2283
 
2284
2284
  var _templateObject$4;
2285
2285
  var GLOBAL_STYLE = /*#__PURE__*/react$1.css(_templateObject$4 || (_templateObject$4 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n :root {\n --default-hero-height: calc(100vh - var(--boemly-space-24));\n }\n\n a {\n text-decoration: none;\n }\n"])));
@@ -2541,6 +2541,17 @@ var ContextProvider = function ContextProvider(_ref) {
2541
2541
  }, children));
2542
2542
  };
2543
2543
 
2544
+ var shuffleElements = function shuffleElements(slides) {
2545
+ var slidesCopy = [].concat(slides); // Create a copy to avoid mutating the original array
2546
+ for (var i = slidesCopy.length - 1; i > 0; i--) {
2547
+ var j = Math.floor(Math.random() * (i + 1));
2548
+ var _ref = [slidesCopy[j], slidesCopy[i]];
2549
+ slidesCopy[i] = _ref[0];
2550
+ slidesCopy[j] = _ref[1];
2551
+ }
2552
+ return slidesCopy;
2553
+ };
2554
+
2544
2555
  var ITEM_GAP$1 = 24;
2545
2556
  var MAX_OFFSET_RIGHT$1 = 55;
2546
2557
  var TextCarousel = function TextCarousel(_ref) {
@@ -2579,6 +2590,13 @@ var TextCarousel = function TextCarousel(_ref) {
2579
2590
  var canMoveLeft = React.useMemo(function () {
2580
2591
  return sliderIndex !== 0;
2581
2592
  }, [sliderIndex]);
2593
+ var shuffleSlides = React.useMemo(function () {
2594
+ return shuffleElements(slice.slides);
2595
+ }, [slice.slides]);
2596
+ var slides = slice.slides,
2597
+ _slice$isShuffled = slice.isShuffled,
2598
+ isShuffled = _slice$isShuffled === void 0 ? false : _slice$isShuffled;
2599
+ var displaySlides = isShuffled ? shuffleSlides : slides;
2582
2600
  return React__default.default.createElement(boemly.DefaultSectionContainer, {
2583
2601
  backgroundColor: primary50,
2584
2602
  title: slice.title
@@ -2613,7 +2631,7 @@ var TextCarousel = function TextCarousel(_ref) {
2613
2631
  duration: 0.3,
2614
2632
  ease: 'easeInOut'
2615
2633
  }
2616
- }, slice.slides.map(function (_ref2) {
2634
+ }, displaySlides.map(function (_ref2) {
2617
2635
  var id = _ref2.id,
2618
2636
  title = _ref2.title,
2619
2637
  text = _ref2.text,