@treely/strapi-slices 5.3.0 → 5.3.1
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/slices/TextCarousel/styles.d.ts +3 -6
- package/dist/strapi-slices.cjs.development.js +34 -20
- package/dist/strapi-slices.cjs.development.js.map +1 -1
- package/dist/strapi-slices.cjs.production.min.js +1 -1
- package/dist/strapi-slices.cjs.production.min.js.map +1 -1
- package/dist/strapi-slices.esm.js +35 -21
- package/dist/strapi-slices.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/slices/TextCarousel/TextCarousel.tsx +38 -15
- package/src/slices/TextCarousel/styles.ts +11 -19
|
@@ -4,7 +4,7 @@ export declare const CarouselContainer: import("@emotion/styled").StyledComponen
|
|
|
4
4
|
theme?: import("@emotion/react").Theme | undefined;
|
|
5
5
|
}, {}, {}>;
|
|
6
6
|
interface CarouselInnerContainerProps {
|
|
7
|
-
|
|
7
|
+
numberOfItems: number;
|
|
8
8
|
}
|
|
9
9
|
export declare const CarouselInnerContainer: import("@emotion/styled").StyledComponent<{
|
|
10
10
|
slot?: string | undefined;
|
|
@@ -273,10 +273,7 @@ export declare const CarouselInnerContainer: import("@emotion/styled").StyledCom
|
|
|
273
273
|
} & import("framer-motion").MotionProps & import("react").RefAttributes<HTMLDivElement> & {
|
|
274
274
|
theme?: import("@emotion/react").Theme | undefined;
|
|
275
275
|
} & CarouselInnerContainerProps, {}, {}>;
|
|
276
|
-
|
|
277
|
-
numberofitems: number;
|
|
278
|
-
}
|
|
279
|
-
export declare const CardContainer: import("@emotion/styled").StyledComponent<(import("@chakra-ui/system/dist/system.types").MergeWithAs<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, any, Omit<import("@chakra-ui/system/dist/system.types").ChakraProps, never>, import("@chakra-ui/system/dist/system.types").As> & {
|
|
276
|
+
export declare const CardContainer: import("@emotion/styled").StyledComponent<import("@chakra-ui/system/dist/system.types").MergeWithAs<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, any, Omit<import("@chakra-ui/system/dist/system.types").ChakraProps, never>, import("@chakra-ui/system/dist/system.types").As> & {
|
|
280
277
|
theme?: import("@emotion/react").Theme | undefined;
|
|
281
|
-
}
|
|
278
|
+
}, {}, {}>;
|
|
282
279
|
export {};
|
|
@@ -1987,18 +1987,15 @@ var TextCardGrid = function TextCardGrid(_ref) {
|
|
|
1987
1987
|
};
|
|
1988
1988
|
|
|
1989
1989
|
var _templateObject$5, _templateObject2$2, _templateObject3$1;
|
|
1990
|
-
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-
|
|
1991
|
-
var CarouselInnerContainer = /*#__PURE__*/styled__default.default(framerMotion.motion.div)(_templateObject2$2 || (_templateObject2$2 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n justify-content: center;\n width: calc(\n (var(--boemly-sizes-sm) + var(--boemly-space-
|
|
1992
|
-
var
|
|
1993
|
-
return
|
|
1990
|
+
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);
|
|
1991
|
+
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) {
|
|
1992
|
+
var numberOfItems = _ref.numberOfItems;
|
|
1993
|
+
return numberOfItems;
|
|
1994
1994
|
}, BREAKPOINT_MD, function (_ref2) {
|
|
1995
|
-
var
|
|
1996
|
-
return
|
|
1995
|
+
var numberOfItems = _ref2.numberOfItems;
|
|
1996
|
+
return numberOfItems;
|
|
1997
1997
|
});
|
|
1998
|
-
var CardContainer = /*#__PURE__*/styled__default.default(boemly.Box)(_templateObject3$1 || (_templateObject3$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n width:
|
|
1999
|
-
var numberofitems = _ref3.numberofitems;
|
|
2000
|
-
return numberofitems === 3 ? 'var(--boemly-sizes-xl)' : 'var(--boemly-sizes-sm)';
|
|
2001
|
-
}, BREAKPOINT_MD);
|
|
1998
|
+
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);
|
|
2002
1999
|
|
|
2003
2000
|
var messagesDe$f = {
|
|
2004
2001
|
'sections.comparison.backgroundShapes': 'Hintergrundformen'
|
|
@@ -2254,24 +2251,42 @@ var ContextProvider = function ContextProvider(_ref) {
|
|
|
2254
2251
|
}, children));
|
|
2255
2252
|
};
|
|
2256
2253
|
|
|
2254
|
+
var ITEM_GAP = 24;
|
|
2255
|
+
var MAX_OFFSET_RIGHT = 55;
|
|
2257
2256
|
var TextCarousel = function TextCarousel(_ref) {
|
|
2258
2257
|
var slice = _ref.slice;
|
|
2258
|
+
var containerRef = React.useRef(null);
|
|
2259
2259
|
var _useToken = boemly.useToken('colors', ['primary.50']),
|
|
2260
2260
|
primary50 = _useToken[0];
|
|
2261
2261
|
var _useMeasure = reactUse.useMeasure(),
|
|
2262
|
-
|
|
2263
|
-
|
|
2262
|
+
itemRef = _useMeasure[0],
|
|
2263
|
+
itemWidth = _useMeasure[1].width;
|
|
2264
2264
|
var _useContext = React.useContext(IntlContext),
|
|
2265
2265
|
formatMessage = _useContext.formatMessage;
|
|
2266
|
-
var containerRef = React.useRef(null);
|
|
2267
2266
|
var _useWindowSize = reactUse.useWindowSize(),
|
|
2268
2267
|
windowWidth = _useWindowSize.width;
|
|
2269
2268
|
var _useState = React.useState(0),
|
|
2270
2269
|
sliderIndex = _useState[0],
|
|
2271
2270
|
setSliderIndex = _useState[1];
|
|
2272
|
-
var
|
|
2273
|
-
|
|
2274
|
-
|
|
2271
|
+
var numberOfItems = React.useMemo(function () {
|
|
2272
|
+
return slice.slides.length;
|
|
2273
|
+
}, [slice.slides.length]);
|
|
2274
|
+
var sliderItemsWidth = React.useMemo(function () {
|
|
2275
|
+
return numberOfItems * (itemWidth + ITEM_GAP) - ITEM_GAP;
|
|
2276
|
+
}, [itemWidth, numberOfItems]);
|
|
2277
|
+
var offsetLeft = React.useMemo(function () {
|
|
2278
|
+
return sliderIndex * (itemWidth + ITEM_GAP) * -1;
|
|
2279
|
+
}, [sliderIndex, itemWidth]);
|
|
2280
|
+
var allowScroll = React.useMemo(function () {
|
|
2281
|
+
return sliderItemsWidth + ITEM_GAP * 2 > windowWidth;
|
|
2282
|
+
}, [sliderItemsWidth, windowWidth]);
|
|
2283
|
+
var canMoveRight = React.useMemo(function () {
|
|
2284
|
+
var offsetRight = windowWidth - (sliderItemsWidth + offsetLeft);
|
|
2285
|
+
return offsetRight < MAX_OFFSET_RIGHT;
|
|
2286
|
+
}, [itemWidth, sliderIndex, sliderItemsWidth, windowWidth]);
|
|
2287
|
+
var canMoveLeft = React.useMemo(function () {
|
|
2288
|
+
return sliderIndex !== 0;
|
|
2289
|
+
}, [sliderIndex]);
|
|
2275
2290
|
return React__default.default.createElement(boemly.DefaultSectionContainer, {
|
|
2276
2291
|
backgroundColor: primary50,
|
|
2277
2292
|
title: slice.title
|
|
@@ -2298,9 +2313,9 @@ var TextCarousel = function TextCarousel(_ref) {
|
|
|
2298
2313
|
position: "relative",
|
|
2299
2314
|
width: "full"
|
|
2300
2315
|
}, React__default.default.createElement(CarouselInnerContainer, {
|
|
2301
|
-
|
|
2316
|
+
numberOfItems: slice.slides.length,
|
|
2302
2317
|
animate: {
|
|
2303
|
-
x:
|
|
2318
|
+
x: offsetLeft
|
|
2304
2319
|
},
|
|
2305
2320
|
transition: {
|
|
2306
2321
|
duration: 0.3,
|
|
@@ -2313,8 +2328,7 @@ var TextCarousel = function TextCarousel(_ref) {
|
|
|
2313
2328
|
icon = _ref2.icon;
|
|
2314
2329
|
return React__default.default.createElement(CardContainer, {
|
|
2315
2330
|
key: id,
|
|
2316
|
-
ref:
|
|
2317
|
-
numberofitems: slice.slides.length
|
|
2331
|
+
ref: itemRef
|
|
2318
2332
|
}, React__default.default.createElement(boemly.TextCardWithIcon, {
|
|
2319
2333
|
title: title,
|
|
2320
2334
|
text: text,
|