@treely/strapi-slices 5.3.0 → 5.3.2
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/FullWidthImageSlider/styles.d.ts +0 -6
- package/dist/slices/TextCarousel/styles.d.ts +3 -6
- package/dist/strapi-slices.cjs.development.js +74 -38
- 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 +75 -39
- package/dist/strapi-slices.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/slices/FullWidthImageSlider/FullWidthImageSlider.tsx +45 -7
- package/src/slices/FullWidthImageSlider/styles.ts +0 -21
- package/src/slices/TextCarousel/TextCarousel.tsx +38 -15
- package/src/slices/TextCarousel/styles.ts +11 -19
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useState, useRef, useEffect, Fragment, createRef, createContext, useContext,
|
|
1
|
+
import React, { useState, useRef, useEffect, Fragment, createRef, createContext, useContext, useMemo, useCallback } from 'react';
|
|
2
2
|
import Head from 'next/head';
|
|
3
3
|
import { Box, BoemlyModal, Flex, IconButton, useMediaQuery, DefaultSectionContainer, Wrapper, DefaultSectionHeader, Button, Gradient, Spacer, SimpleGrid, Heading, Text, useToken, Grid, GridItem, BoemlyList, PortfolioCard, RichText, BoemlyAccordion, HeroCard, Shape, QuoteCard, Center, ShapesCard, TextCardWithIcon, ContactArea, ProjectCard, Tag, Link as Link$1, DatePersonPair, BoemlyThemeProvider, Badge, useDisclosure, Container, AvatarWithName, Divider, LabelNumberPair, BoemlyFormControl, InputRightAddon, LabelTextPair } from 'boemly';
|
|
4
4
|
import Image from 'next/image';
|
|
@@ -1405,12 +1405,12 @@ var LogoGridWithText = function LogoGridWithText(_ref) {
|
|
|
1405
1405
|
})))));
|
|
1406
1406
|
};
|
|
1407
1407
|
|
|
1408
|
-
var _templateObject$7, _templateObject2$4, _templateObject3$2, _templateObject4$1, _templateObject5
|
|
1408
|
+
var _templateObject$7, _templateObject2$4, _templateObject3$2, _templateObject4$1, _templateObject5;
|
|
1409
1409
|
var MapHeroContainer = /*#__PURE__*/styled(Box)(_templateObject$7 || (_templateObject$7 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n position: relative;\n width: 100vw;\n height: var(--default-hero-height);\n min-height: var(--boemly-sizes-3xl);\n background-color: var(--boemly-colors-primary-50);\n overflow: hidden;\n z-index: var(--boemly-zIndices-base);\n\n @media screen and (max-width: ", ") {\n height: auto;\n }\n"])), BREAKPOINT_LG);
|
|
1410
1410
|
var MapHeroTextContainer = /*#__PURE__*/styled(Box)(_templateObject2$4 || (_templateObject2$4 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n position: absolute;\n width: 100vw;\n top: 56%;\n left: 0;\n transform: translateY(-50%);\n z-index: var(--boemly-zIndices-aboveBase);\n\n @media screen and (max-width: ", ") {\n position: relative;\n transform: unset;\n\n padding-top: var(--boemly-space-32);\n }\n"])), BREAKPOINT_LG);
|
|
1411
1411
|
var ShapeContainer = /*#__PURE__*/styled(Box)(_templateObject3$2 || (_templateObject3$2 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n position: absolute;\n bottom: calc(var(--boemly-space-8) * -1);\n left: 0;\n\n width: var(--boemly-sizes-sm);\n height: var(--boemly-sizes-sm);\n\n border-top-right-radius: var(--boemly-radii-full);\n\n & span,\n div {\n border-top-right-radius: var(--boemly-radii-full);\n }\n\n @media screen and (max-width: ", ") {\n display: none;\n }\n"])), BREAKPOINT_LG);
|
|
1412
1412
|
var MapContainer = /*#__PURE__*/styled(Box)(_templateObject4$1 || (_templateObject4$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n position: absolute;\n\n width: 50%;\n height: 100%;\n\n right: 0;\n top: 0;\n\n & img {\n object-fit: cover !important;\n }\n\n @media screen and (max-width: ", ") {\n width: 100%;\n height: var(--boemly-sizes-4xl);\n position: relative;\n margin-top: calc(var(--boemly-space-72) * -1);\n background-color: var(--boemly-colors-white);\n\n & img {\n object-fit: contain !important;\n }\n }\n"])), BREAKPOINT_LG);
|
|
1413
|
-
var MapGradient = /*#__PURE__*/styled(Box)(_templateObject5
|
|
1413
|
+
var MapGradient = /*#__PURE__*/styled(Box)(_templateObject5 || (_templateObject5 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n position: absolute;\n top: 0;\n right: 0;\n width: 100%;\n height: 100%;\n\n background: linear-gradient(\n 90deg,\n var(--boemly-colors-primary-50) 0%,\n var(--boemly-colors-primary-50) 10%,\n rgba(243, 246, 245, 0.6) 28%,\n rgba(243, 246, 245, 0) 40%,\n rgba(243, 246, 245, 0) 100%\n );\n\n @media screen and (max-width: ", ") {\n background: linear-gradient(\n 180deg,\n var(--boemly-colors-primary-50) 0%,\n var(--boemly-colors-primary-50) 36%,\n rgba(243, 246, 245, 0.12) 46%,\n rgba(243, 246, 245, 0) 100%\n );\n }\n"])), BREAKPOINT_LG);
|
|
1414
1414
|
|
|
1415
1415
|
var MapHero = function MapHero(_ref) {
|
|
1416
1416
|
var slice = _ref.slice;
|
|
@@ -1974,18 +1974,15 @@ var TextCardGrid = function TextCardGrid(_ref) {
|
|
|
1974
1974
|
};
|
|
1975
1975
|
|
|
1976
1976
|
var _templateObject$5, _templateObject2$2, _templateObject3$1;
|
|
1977
|
-
var CarouselContainer = /*#__PURE__*/styled(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-
|
|
1978
|
-
var CarouselInnerContainer = /*#__PURE__*/styled(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-
|
|
1979
|
-
var
|
|
1980
|
-
return
|
|
1977
|
+
var CarouselContainer = /*#__PURE__*/styled(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);
|
|
1978
|
+
var CarouselInnerContainer = /*#__PURE__*/styled(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) {
|
|
1979
|
+
var numberOfItems = _ref.numberOfItems;
|
|
1980
|
+
return numberOfItems;
|
|
1981
1981
|
}, BREAKPOINT_MD, function (_ref2) {
|
|
1982
|
-
var
|
|
1983
|
-
return
|
|
1982
|
+
var numberOfItems = _ref2.numberOfItems;
|
|
1983
|
+
return numberOfItems;
|
|
1984
1984
|
});
|
|
1985
|
-
var CardContainer = /*#__PURE__*/styled(Box)(_templateObject3$1 || (_templateObject3$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n width:
|
|
1986
|
-
var numberofitems = _ref3.numberofitems;
|
|
1987
|
-
return numberofitems === 3 ? 'var(--boemly-sizes-xl)' : 'var(--boemly-sizes-sm)';
|
|
1988
|
-
}, BREAKPOINT_MD);
|
|
1985
|
+
var CardContainer = /*#__PURE__*/styled(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);
|
|
1989
1986
|
|
|
1990
1987
|
var messagesDe$f = {
|
|
1991
1988
|
'sections.comparison.backgroundShapes': 'Hintergrundformen'
|
|
@@ -2241,24 +2238,42 @@ var ContextProvider = function ContextProvider(_ref) {
|
|
|
2241
2238
|
}, children));
|
|
2242
2239
|
};
|
|
2243
2240
|
|
|
2241
|
+
var ITEM_GAP$1 = 24;
|
|
2242
|
+
var MAX_OFFSET_RIGHT$1 = 55;
|
|
2244
2243
|
var TextCarousel = function TextCarousel(_ref) {
|
|
2245
2244
|
var slice = _ref.slice;
|
|
2245
|
+
var containerRef = useRef(null);
|
|
2246
2246
|
var _useToken = useToken('colors', ['primary.50']),
|
|
2247
2247
|
primary50 = _useToken[0];
|
|
2248
2248
|
var _useMeasure = useMeasure(),
|
|
2249
|
-
|
|
2250
|
-
|
|
2249
|
+
itemRef = _useMeasure[0],
|
|
2250
|
+
itemWidth = _useMeasure[1].width;
|
|
2251
2251
|
var _useContext = useContext(IntlContext),
|
|
2252
2252
|
formatMessage = _useContext.formatMessage;
|
|
2253
|
-
var containerRef = useRef(null);
|
|
2254
2253
|
var _useWindowSize = useWindowSize(),
|
|
2255
2254
|
windowWidth = _useWindowSize.width;
|
|
2256
2255
|
var _useState = useState(0),
|
|
2257
2256
|
sliderIndex = _useState[0],
|
|
2258
2257
|
setSliderIndex = _useState[1];
|
|
2259
|
-
var
|
|
2260
|
-
|
|
2261
|
-
|
|
2258
|
+
var numberOfItems = useMemo(function () {
|
|
2259
|
+
return slice.slides.length;
|
|
2260
|
+
}, [slice.slides.length]);
|
|
2261
|
+
var sliderItemsWidth = useMemo(function () {
|
|
2262
|
+
return numberOfItems * (itemWidth + ITEM_GAP$1) - ITEM_GAP$1;
|
|
2263
|
+
}, [itemWidth, numberOfItems]);
|
|
2264
|
+
var offsetLeft = useMemo(function () {
|
|
2265
|
+
return sliderIndex * (itemWidth + ITEM_GAP$1) * -1;
|
|
2266
|
+
}, [sliderIndex, itemWidth]);
|
|
2267
|
+
var allowScroll = useMemo(function () {
|
|
2268
|
+
return sliderItemsWidth + ITEM_GAP$1 * 2 > windowWidth;
|
|
2269
|
+
}, [sliderItemsWidth, windowWidth]);
|
|
2270
|
+
var canMoveRight = useMemo(function () {
|
|
2271
|
+
var offsetRight = windowWidth - (sliderItemsWidth + offsetLeft);
|
|
2272
|
+
return offsetRight < MAX_OFFSET_RIGHT$1;
|
|
2273
|
+
}, [itemWidth, sliderIndex, sliderItemsWidth, windowWidth]);
|
|
2274
|
+
var canMoveLeft = useMemo(function () {
|
|
2275
|
+
return sliderIndex !== 0;
|
|
2276
|
+
}, [sliderIndex]);
|
|
2262
2277
|
return React.createElement(DefaultSectionContainer, {
|
|
2263
2278
|
backgroundColor: primary50,
|
|
2264
2279
|
title: slice.title
|
|
@@ -2285,9 +2300,9 @@ var TextCarousel = function TextCarousel(_ref) {
|
|
|
2285
2300
|
position: "relative",
|
|
2286
2301
|
width: "full"
|
|
2287
2302
|
}, React.createElement(CarouselInnerContainer, {
|
|
2288
|
-
|
|
2303
|
+
numberOfItems: slice.slides.length,
|
|
2289
2304
|
animate: {
|
|
2290
|
-
x:
|
|
2305
|
+
x: offsetLeft
|
|
2291
2306
|
},
|
|
2292
2307
|
transition: {
|
|
2293
2308
|
duration: 0.3,
|
|
@@ -2300,8 +2315,7 @@ var TextCarousel = function TextCarousel(_ref) {
|
|
|
2300
2315
|
icon = _ref2.icon;
|
|
2301
2316
|
return React.createElement(CardContainer, {
|
|
2302
2317
|
key: id,
|
|
2303
|
-
ref:
|
|
2304
|
-
numberofitems: slice.slides.length
|
|
2318
|
+
ref: itemRef
|
|
2305
2319
|
}, React.createElement(TextCardWithIcon, {
|
|
2306
2320
|
title: title,
|
|
2307
2321
|
text: text,
|
|
@@ -3153,19 +3167,15 @@ var FullWidthHighlightQuote = function FullWidthHighlightQuote(_ref) {
|
|
|
3153
3167
|
})));
|
|
3154
3168
|
};
|
|
3155
3169
|
|
|
3156
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4
|
|
3170
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
3157
3171
|
var SliderContainer = /*#__PURE__*/styled(Box)(_templateObject || (_templateObject = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n --mobile-image-width: calc(100vw - var(--boemly-space-24));\n --desktop-image-width: var(--boemly-sizes-md);\n\n width: var(--boemly-size-full);\n\n overflow-x: hidden;\n\n padding-left: max(\n var(--boemly-space-8),\n calc(50vw - var(--boemly-sizes-7xl) / 2 + var(--boemly-space-6))\n );\n\n @media screen and (max-width: ", ") {\n overflow-x: scroll;\n padding-left: max(\n var(--boemly-space-8),\n calc(50vw - var(--boemly-sizes-7xl) / 2 + var(--boemly-space-8))\n );\n }\n"])), BREAKPOINT_MD);
|
|
3158
|
-
var
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
var SliderInnerContainer = /*#__PURE__*/styled(motion.div)(_templateObject3 || (_templateObject3 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n gap: var(--boemly-space-6);\n\n width: fit-content;\n"])));
|
|
3163
|
-
var ItemContainer = /*#__PURE__*/styled(Box)(_templateObject4 || (_templateObject4 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n width: var(--desktop-image-width);\n\n :last-of-type {\n margin-right: var(--boemly-space-8);\n }\n\n @media screen and (max-width: ", ") {\n width: var(--mobile-image-width);\n }\n"])), BREAKPOINT_MD);
|
|
3164
|
-
var ImageContainer = /*#__PURE__*/styled(Box)(_templateObject5 || (_templateObject5 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n position: relative;\n\n max-height: var(--boemly-sizes-xl);\n height: calc(\n var(--desktop-image-width) /\n ", "\n );\n width: var(--desktop-image-width);\n\n border-radius: var(--boemly-radii-xl);\n\n & img {\n border-radius: var(--boemly-radii-xl);\n }\n\n @media screen and (max-width: ", ") {\n height: calc(\n var(--mobile-image-width) /\n ", "\n );\n width: var(--mobile-image-width);\n }\n"])), function (_ref2) {
|
|
3165
|
-
var aspectRatio = _ref2.aspectRatio;
|
|
3172
|
+
var SliderInnerContainer = /*#__PURE__*/styled(motion.div)(_templateObject2 || (_templateObject2 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n gap: var(--boemly-space-6);\n\n width: fit-content;\n"])));
|
|
3173
|
+
var ItemContainer = /*#__PURE__*/styled(Box)(_templateObject3 || (_templateObject3 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n width: var(--desktop-image-width);\n\n :last-of-type {\n margin-right: var(--boemly-space-8);\n }\n\n @media screen and (max-width: ", ") {\n width: var(--mobile-image-width);\n }\n"])), BREAKPOINT_MD);
|
|
3174
|
+
var ImageContainer = /*#__PURE__*/styled(Box)(_templateObject4 || (_templateObject4 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n position: relative;\n\n max-height: var(--boemly-sizes-xl);\n height: calc(\n var(--desktop-image-width) /\n ", "\n );\n width: var(--desktop-image-width);\n\n border-radius: var(--boemly-radii-xl);\n\n & img {\n border-radius: var(--boemly-radii-xl);\n }\n\n @media screen and (max-width: ", ") {\n height: calc(\n var(--mobile-image-width) /\n ", "\n );\n width: var(--mobile-image-width);\n }\n"])), function (_ref) {
|
|
3175
|
+
var aspectRatio = _ref.aspectRatio;
|
|
3166
3176
|
return aspectRatio;
|
|
3167
|
-
}, BREAKPOINT_MD, function (
|
|
3168
|
-
var aspectRatio =
|
|
3177
|
+
}, BREAKPOINT_MD, function (_ref2) {
|
|
3178
|
+
var aspectRatio = _ref2.aspectRatio;
|
|
3169
3179
|
return aspectRatio;
|
|
3170
3180
|
});
|
|
3171
3181
|
|
|
@@ -3183,6 +3193,8 @@ var getClosestRatio = function getClosestRatio(width, height) {
|
|
|
3183
3193
|
return ALLOWED_RATIOS[posMinDiff];
|
|
3184
3194
|
};
|
|
3185
3195
|
|
|
3196
|
+
var ITEM_GAP = 24;
|
|
3197
|
+
var MAX_OFFSET_RIGHT = 162;
|
|
3186
3198
|
var FullWidthImageSlider = function FullWidthImageSlider(_ref) {
|
|
3187
3199
|
var slice = _ref.slice;
|
|
3188
3200
|
var containerRef = useRef(null);
|
|
@@ -3199,9 +3211,25 @@ var FullWidthImageSlider = function FullWidthImageSlider(_ref) {
|
|
|
3199
3211
|
var _useState2 = useState(false),
|
|
3200
3212
|
isOpen = _useState2[0],
|
|
3201
3213
|
setIsOpen = _useState2[1];
|
|
3202
|
-
var
|
|
3203
|
-
|
|
3204
|
-
|
|
3214
|
+
var numberOfItems = useMemo(function () {
|
|
3215
|
+
return slice.images.length;
|
|
3216
|
+
}, [slice.images.length]);
|
|
3217
|
+
var sliderItemsWidth = useMemo(function () {
|
|
3218
|
+
return numberOfItems * (imageWidth + ITEM_GAP) - ITEM_GAP;
|
|
3219
|
+
}, [imageWidth, numberOfItems]);
|
|
3220
|
+
var offsetLeft = useMemo(function () {
|
|
3221
|
+
return sliderIndex * (imageWidth + ITEM_GAP) * -1;
|
|
3222
|
+
}, [sliderIndex, imageWidth]);
|
|
3223
|
+
var allowScroll = useMemo(function () {
|
|
3224
|
+
return sliderItemsWidth + ITEM_GAP * 3 > windowWidth;
|
|
3225
|
+
}, [sliderItemsWidth, windowWidth]);
|
|
3226
|
+
var canMoveRight = useMemo(function () {
|
|
3227
|
+
var offsetRight = windowWidth - (sliderItemsWidth + offsetLeft);
|
|
3228
|
+
return offsetRight < MAX_OFFSET_RIGHT;
|
|
3229
|
+
}, [imageWidth, sliderIndex, sliderItemsWidth, windowWidth]);
|
|
3230
|
+
var canMoveLeft = useMemo(function () {
|
|
3231
|
+
return sliderIndex !== 0;
|
|
3232
|
+
}, [sliderIndex]);
|
|
3205
3233
|
return React.createElement(DefaultSectionContainer, null, React.createElement(SliderContainer, {
|
|
3206
3234
|
ref: containerRef
|
|
3207
3235
|
}, React.createElement(SliderInnerContainer, {
|
|
@@ -3240,8 +3268,16 @@ var FullWidthImageSlider = function FullWidthImageSlider(_ref) {
|
|
|
3240
3268
|
})), React.createElement(Text, {
|
|
3241
3269
|
height: "6"
|
|
3242
3270
|
}, image.caption)));
|
|
3243
|
-
}))), React.createElement(
|
|
3244
|
-
|
|
3271
|
+
}))), React.createElement(Box, {
|
|
3272
|
+
display: ['none', null, null, !!allowScroll ? 'flex' : 'none'],
|
|
3273
|
+
pointerEvents: "none",
|
|
3274
|
+
position: "absolute",
|
|
3275
|
+
top: "calc(50% - var(--boemly-sizes-12))",
|
|
3276
|
+
left: "0",
|
|
3277
|
+
width: "full",
|
|
3278
|
+
py: "0",
|
|
3279
|
+
px: "32",
|
|
3280
|
+
justifyContent: "space-between"
|
|
3245
3281
|
}, React.createElement(Box, null, React.createElement(AnimatePresence, null, canMoveLeft && React.createElement(IconButton, {
|
|
3246
3282
|
key: "leftButton",
|
|
3247
3283
|
as: motion.button,
|