@cntrl-site/components 0.1.10-alpha.7 → 0.1.14-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.
- package/LICENSE +21 -21
- package/README.md +2 -2
- package/dist/Components/ControlSlider/ControlSlider.d.ts +2 -2
- package/dist/Components/ControlSlider/ControlSliderComponent.d.ts +4 -4
- package/dist/Components/Lightbox/Lightbox.d.ts +2 -4
- package/dist/components.css +1 -1
- package/dist/index.js +192 -294
- package/dist/index.mjs +149 -251
- package/package.json +68 -68
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
-
const
|
|
4
|
+
const React = require("react");
|
|
5
5
|
const reactSplide = require("@splidejs/react-splide");
|
|
6
6
|
const cn = require("classnames");
|
|
7
7
|
const reactDom = require("react-dom");
|
|
@@ -13,7 +13,7 @@ const arrow$1 = "ControlSlider-module__arrow___05ghY";
|
|
|
13
13
|
const arrowVertical$1 = "ControlSlider-module__arrowVertical___tBfVN";
|
|
14
14
|
const nextArrow$1 = "ControlSlider-module__nextArrow___-30Yc";
|
|
15
15
|
const arrowInner$1 = "ControlSlider-module__arrowInner___aEra3";
|
|
16
|
-
const arrowIcon
|
|
16
|
+
const arrowIcon = "ControlSlider-module__arrowIcon___S4ztF";
|
|
17
17
|
const arrowImg$1 = "ControlSlider-module__arrowImg___2dwJW";
|
|
18
18
|
const mirror$1 = "ControlSlider-module__mirror___brd6U";
|
|
19
19
|
const pagination = "ControlSlider-module__pagination___bicLF";
|
|
@@ -57,7 +57,7 @@ const styles$3 = {
|
|
|
57
57
|
arrowVertical: arrowVertical$1,
|
|
58
58
|
nextArrow: nextArrow$1,
|
|
59
59
|
arrowInner: arrowInner$1,
|
|
60
|
-
arrowIcon
|
|
60
|
+
arrowIcon,
|
|
61
61
|
arrowImg: arrowImg$1,
|
|
62
62
|
mirror: mirror$1,
|
|
63
63
|
pagination,
|
|
@@ -135,8 +135,8 @@ const styles$1 = {
|
|
|
135
135
|
img
|
|
136
136
|
};
|
|
137
137
|
const SvgImage = ({ url, fill = "#000000", hoverFill = "#CCCCCC", className = "" }) => {
|
|
138
|
-
const [supportsMask, setSupportsMask] =
|
|
139
|
-
|
|
138
|
+
const [supportsMask, setSupportsMask] = React.useState(true);
|
|
139
|
+
React.useEffect(() => {
|
|
140
140
|
if (typeof window !== "undefined" && window.CSS) {
|
|
141
141
|
const supported = CSS.supports("mask-image", 'url("")') || CSS.supports("-webkit-mask-image", 'url("")');
|
|
142
142
|
setSupportsMask(supported);
|
|
@@ -170,21 +170,21 @@ const alignmentClassName = {
|
|
|
170
170
|
"bottom-right": styles$3.bottomRightAlignment
|
|
171
171
|
};
|
|
172
172
|
function ControlSlider({ settings, content, styles: sliderStyles, isEditor }) {
|
|
173
|
-
const [sliderRef, setSliderRef] =
|
|
174
|
-
const { widthSettings, fontSettings, letterSpacing, textAlign, wordSpacing, fontSizeLineHeight, textAppearance, color } = sliderStyles.
|
|
175
|
-
const [sliderDimensions, setSliderDimensions] =
|
|
176
|
-
const [wrapperRef, setWrapperRef] =
|
|
177
|
-
const [currentSlideIndex, setCurrentSlideIndex] =
|
|
178
|
-
const [key, setKey] =
|
|
179
|
-
const { direction, transition, controls, pagination: pagination2,
|
|
180
|
-
const prevSliderTypeRef =
|
|
173
|
+
const [sliderRef, setSliderRef] = React.useState(null);
|
|
174
|
+
const { widthSettings, fontSettings, letterSpacing, textAlign, wordSpacing, fontSizeLineHeight, textAppearance, color } = sliderStyles.imageCaption;
|
|
175
|
+
const [sliderDimensions, setSliderDimensions] = React.useState(void 0);
|
|
176
|
+
const [wrapperRef, setWrapperRef] = React.useState(null);
|
|
177
|
+
const [currentSlideIndex, setCurrentSlideIndex] = React.useState(0);
|
|
178
|
+
const [key, setKey] = React.useState(0);
|
|
179
|
+
const { direction, transition, controls, pagination: pagination2, imageCaption, triggers } = settings;
|
|
180
|
+
const prevSliderTypeRef = React.useRef(transition.type);
|
|
181
181
|
const { x: controlsOffsetX, y: controlsOffsetY } = settings.controls.offset;
|
|
182
182
|
const handleArrowClick = (dir) => {
|
|
183
183
|
if (sliderRef) {
|
|
184
184
|
sliderRef.go(dir);
|
|
185
185
|
}
|
|
186
186
|
};
|
|
187
|
-
|
|
187
|
+
React.useEffect(() => {
|
|
188
188
|
if (!wrapperRef) return;
|
|
189
189
|
const observer = new ResizeObserver((entries) => {
|
|
190
190
|
if (!sliderRef) return;
|
|
@@ -197,7 +197,7 @@ function ControlSlider({ settings, content, styles: sliderStyles, isEditor }) {
|
|
|
197
197
|
observer.observe(wrapperRef);
|
|
198
198
|
return () => observer.unobserve(wrapperRef);
|
|
199
199
|
}, [wrapperRef]);
|
|
200
|
-
|
|
200
|
+
React.useEffect(() => {
|
|
201
201
|
if (!sliderRef || prevSliderTypeRef.current === transition.type) return;
|
|
202
202
|
setKey((prev) => prev + 1);
|
|
203
203
|
prevSliderTypeRef.current = transition.type;
|
|
@@ -212,7 +212,7 @@ function ControlSlider({ settings, content, styles: sliderStyles, isEditor }) {
|
|
|
212
212
|
backgroundColor: transition.backgroundColor && transition.type === "fade in" ? transition.backgroundColor : "transparent"
|
|
213
213
|
},
|
|
214
214
|
children: [
|
|
215
|
-
settings.
|
|
215
|
+
settings.imageCaption.isActive && /* @__PURE__ */ jsxRuntime.jsx(
|
|
216
216
|
"div",
|
|
217
217
|
{
|
|
218
218
|
className: cn(styles$3.captionBlock),
|
|
@@ -223,7 +223,7 @@ function ControlSlider({ settings, content, styles: sliderStyles, isEditor }) {
|
|
|
223
223
|
children: content.map((item, index) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
224
224
|
"div",
|
|
225
225
|
{
|
|
226
|
-
className: cn(styles$3.captionText, alignmentClassName[
|
|
226
|
+
className: cn(styles$3.captionText, alignmentClassName[imageCaption.alignment], {
|
|
227
227
|
[styles$3.withPointerEvents]: index === currentSlideIndex && isEditor,
|
|
228
228
|
[styles$3.active]: index === currentSlideIndex
|
|
229
229
|
}),
|
|
@@ -246,13 +246,13 @@ function ControlSlider({ settings, content, styles: sliderStyles, isEditor }) {
|
|
|
246
246
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
247
247
|
"div",
|
|
248
248
|
{
|
|
249
|
-
"data-styles": "
|
|
249
|
+
"data-styles": "imageCaption",
|
|
250
250
|
className: styles$3.captionTextInner,
|
|
251
251
|
style: {
|
|
252
|
-
"--link-hover-color":
|
|
252
|
+
"--link-hover-color": imageCaption.hover,
|
|
253
253
|
position: "relative",
|
|
254
|
-
top: scalingValue(
|
|
255
|
-
left: scalingValue(
|
|
254
|
+
top: scalingValue(imageCaption.offset.y, isEditor),
|
|
255
|
+
left: scalingValue(imageCaption.offset.x, isEditor)
|
|
256
256
|
},
|
|
257
257
|
children: /* @__PURE__ */ jsxRuntime.jsx(RichTextRenderer, { content: item.imageCaption })
|
|
258
258
|
}
|
|
@@ -345,7 +345,7 @@ function ControlSlider({ settings, content, styles: sliderStyles, isEditor }) {
|
|
|
345
345
|
className: cn(styles$3.arrowImg, styles$3.mirror)
|
|
346
346
|
}
|
|
347
347
|
),
|
|
348
|
-
!controls.arrowsImgUrl && /* @__PURE__ */ jsxRuntime.jsx(ArrowIcon
|
|
348
|
+
!controls.arrowsImgUrl && /* @__PURE__ */ jsxRuntime.jsx(ArrowIcon, { color: controls.color, className: cn(styles$3.arrowIcon, styles$3.arrowImg, styles$3.mirror) })
|
|
349
349
|
]
|
|
350
350
|
}
|
|
351
351
|
)
|
|
@@ -380,7 +380,7 @@ function ControlSlider({ settings, content, styles: sliderStyles, isEditor }) {
|
|
|
380
380
|
className: styles$3.arrowImg
|
|
381
381
|
}
|
|
382
382
|
),
|
|
383
|
-
!controls.arrowsImgUrl && /* @__PURE__ */ jsxRuntime.jsx(ArrowIcon
|
|
383
|
+
!controls.arrowsImgUrl && /* @__PURE__ */ jsxRuntime.jsx(ArrowIcon, { color: controls.color, className: cn(styles$3.arrowIcon, styles$3.arrowImg) })
|
|
384
384
|
]
|
|
385
385
|
}
|
|
386
386
|
)
|
|
@@ -452,7 +452,7 @@ function ControlSlider({ settings, content, styles: sliderStyles, isEditor }) {
|
|
|
452
452
|
}
|
|
453
453
|
) });
|
|
454
454
|
}
|
|
455
|
-
function ArrowIcon
|
|
455
|
+
function ArrowIcon({ color, className }) {
|
|
456
456
|
return /* @__PURE__ */ jsxRuntime.jsx("svg", { viewBox: "0 0 10 18", className, children: /* @__PURE__ */ jsxRuntime.jsx("g", { id: "Symbols", stroke: "none", strokeWidth: "1", fillRule: "evenodd", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M-3.70710678,4.29289322 C-3.34662282,3.93240926 -2.77939176,3.90467972 -2.38710056,4.20970461 L-2.29289322,4.29289322 L5,11.585 L12.2928932,4.29289322 C12.6533772,3.93240926 13.2206082,3.90467972 13.6128994,4.20970461 L13.7071068,4.29289322 C14.0675907,4.65337718 14.0953203,5.22060824 13.7902954,5.61289944 L13.7071068,5.70710678 L5.70710678,13.7071068 C5.34662282,14.0675907 4.77939176,14.0953203 4.38710056,13.7902954 L4.29289322,13.7071068 L-3.70710678,5.70710678 C-4.09763107,5.31658249 -4.09763107,4.68341751 -3.70710678,4.29289322 Z", id: "Shape-Copy", fill: color, transform: "translate(5, 9) rotate(-90) translate(-5, -9)" }) }) });
|
|
457
457
|
}
|
|
458
458
|
const ControlSliderComponent = {
|
|
@@ -705,7 +705,7 @@ const ControlSliderComponent = {
|
|
|
705
705
|
}
|
|
706
706
|
}
|
|
707
707
|
},
|
|
708
|
-
|
|
708
|
+
imageCaption: {
|
|
709
709
|
title: "Caption",
|
|
710
710
|
icon: "text-icon",
|
|
711
711
|
tooltip: "Caption",
|
|
@@ -799,7 +799,7 @@ const ControlSliderComponent = {
|
|
|
799
799
|
hover: "#cccccc"
|
|
800
800
|
},
|
|
801
801
|
direction: "horiz",
|
|
802
|
-
|
|
802
|
+
imageCaption: {
|
|
803
803
|
offset: {
|
|
804
804
|
x: 0,
|
|
805
805
|
y: 0
|
|
@@ -922,7 +922,7 @@ const ControlSliderComponent = {
|
|
|
922
922
|
layoutBased: true,
|
|
923
923
|
type: "object",
|
|
924
924
|
properties: {
|
|
925
|
-
|
|
925
|
+
imageCaption: {
|
|
926
926
|
dataName: "caption",
|
|
927
927
|
type: "object",
|
|
928
928
|
properties: {
|
|
@@ -1020,7 +1020,7 @@ const ControlSliderComponent = {
|
|
|
1020
1020
|
}
|
|
1021
1021
|
},
|
|
1022
1022
|
default: {
|
|
1023
|
-
|
|
1023
|
+
imageCaption: {
|
|
1024
1024
|
widthSettings: {
|
|
1025
1025
|
width: 0.13,
|
|
1026
1026
|
sizing: "auto"
|
|
@@ -1102,19 +1102,19 @@ async function calculateImageWidthHeight(imgUrl, sizeType, customWidth, randomRa
|
|
|
1102
1102
|
return { width, height, finalWidth: `${width}px` };
|
|
1103
1103
|
}
|
|
1104
1104
|
function ImageRevealSlider({ settings, content, isEditor }) {
|
|
1105
|
-
const [divRef, setDivRef] =
|
|
1106
|
-
const [placedImages, setPlacedImages] =
|
|
1107
|
-
const [counter, setCounter] =
|
|
1108
|
-
const imageIdCounter =
|
|
1109
|
-
const [cursorCenter, setCursorCenter] =
|
|
1110
|
-
const [cursorScale, setCursorScale] =
|
|
1111
|
-
const [customCursorImg, setCustomCursorImg] =
|
|
1112
|
-
const lastMousePos =
|
|
1113
|
-
const [isInside, setIsInside] =
|
|
1105
|
+
const [divRef, setDivRef] = React.useState(null);
|
|
1106
|
+
const [placedImages, setPlacedImages] = React.useState([]);
|
|
1107
|
+
const [counter, setCounter] = React.useState(0);
|
|
1108
|
+
const imageIdCounter = React.useRef(0);
|
|
1109
|
+
const [cursorCenter, setCursorCenter] = React.useState({ x: 0, y: 0 });
|
|
1110
|
+
const [cursorScale, setCursorScale] = React.useState(1);
|
|
1111
|
+
const [customCursorImg, setCustomCursorImg] = React.useState("none");
|
|
1112
|
+
const lastMousePos = React.useRef({ x: 0, y: 0 });
|
|
1113
|
+
const [isInside, setIsInside] = React.useState(false);
|
|
1114
1114
|
const { sizeType, imageWidth: customWidth, randomRangeImageWidth: randomRange } = settings.imageSize;
|
|
1115
1115
|
const { revealPosition, visible } = settings.position;
|
|
1116
1116
|
const { cursorType, target, defaultCursorScale, defaultCursor, hoverCursorScale, hoverCursor } = settings.cursor;
|
|
1117
|
-
|
|
1117
|
+
React.useEffect(() => {
|
|
1118
1118
|
if (!divRef) return;
|
|
1119
1119
|
const updateCursorPosition = (clientX, clientY) => {
|
|
1120
1120
|
const rect = divRef.getBoundingClientRect();
|
|
@@ -1165,7 +1165,7 @@ function ImageRevealSlider({ settings, content, isEditor }) {
|
|
|
1165
1165
|
defaultCursorScale,
|
|
1166
1166
|
placedImages
|
|
1167
1167
|
]);
|
|
1168
|
-
|
|
1168
|
+
React.useEffect(() => {
|
|
1169
1169
|
if (!isInside) {
|
|
1170
1170
|
setCustomCursorImg("none");
|
|
1171
1171
|
setCursorScale(0);
|
|
@@ -1198,7 +1198,7 @@ function ImageRevealSlider({ settings, content, isEditor }) {
|
|
|
1198
1198
|
width: finalWidth
|
|
1199
1199
|
};
|
|
1200
1200
|
};
|
|
1201
|
-
|
|
1201
|
+
React.useEffect(() => {
|
|
1202
1202
|
if (!divRef || content.length === 0) return;
|
|
1203
1203
|
const rect = divRef.getBoundingClientRect();
|
|
1204
1204
|
const containerWidth = rect.width;
|
|
@@ -1213,7 +1213,7 @@ function ImageRevealSlider({ settings, content, isEditor }) {
|
|
|
1213
1213
|
};
|
|
1214
1214
|
placeImages();
|
|
1215
1215
|
}, [sizeType, customWidth, randomRange, revealPosition, divRef]);
|
|
1216
|
-
|
|
1216
|
+
React.useEffect(() => {
|
|
1217
1217
|
if (visible === "last One") {
|
|
1218
1218
|
setPlacedImages((prev) => prev.length > 0 ? [prev[prev.length - 1]] : []);
|
|
1219
1219
|
}
|
|
@@ -1617,7 +1617,6 @@ const ControlImageRevealSliderComponent = {
|
|
|
1617
1617
|
}
|
|
1618
1618
|
}
|
|
1619
1619
|
};
|
|
1620
|
-
const hidden = "LightBox-module__hidden___9s-9x";
|
|
1621
1620
|
const heroImage = "LightBox-module__heroImage___sTxNF";
|
|
1622
1621
|
const background = "LightBox-module__background___rm9ml";
|
|
1623
1622
|
const editor = "LightBox-module__editor___4ACaY";
|
|
@@ -1633,10 +1632,8 @@ const arrow = "LightBox-module__arrow___iz38X";
|
|
|
1633
1632
|
const arrowVertical = "LightBox-module__arrowVertical___Zfz81";
|
|
1634
1633
|
const nextArrow = "LightBox-module__nextArrow___zkAQN";
|
|
1635
1634
|
const arrowInner = "LightBox-module__arrowInner___p48sW";
|
|
1636
|
-
const arrowIcon = "LightBox-module__arrowIcon___3VaFf";
|
|
1637
1635
|
const arrowImg = "LightBox-module__arrowImg___pNV88";
|
|
1638
1636
|
const mirror = "LightBox-module__mirror___pjeXc";
|
|
1639
|
-
const thumbsWrapper = "LightBox-module__thumbsWrapper___GB-nU";
|
|
1640
1637
|
const thumbsContainerVertical = "LightBox-module__thumbsContainerVertical___wttk5";
|
|
1641
1638
|
const thumbsContainer = "LightBox-module__thumbsContainer___osSma";
|
|
1642
1639
|
const thumbsAlignStart = "LightBox-module__thumbsAlignStart___MO6tY";
|
|
@@ -1656,7 +1653,6 @@ const slideOutTop = "LightBox-module__slideOutTop___Vgg0z";
|
|
|
1656
1653
|
const slideOutBottom = "LightBox-module__slideOutBottom___nJ0Ef";
|
|
1657
1654
|
const scaleSlide = "LightBox-module__scaleSlide___vZriG";
|
|
1658
1655
|
const classes = {
|
|
1659
|
-
hidden,
|
|
1660
1656
|
heroImage,
|
|
1661
1657
|
background,
|
|
1662
1658
|
editor,
|
|
@@ -1672,10 +1668,8 @@ const classes = {
|
|
|
1672
1668
|
arrowVertical,
|
|
1673
1669
|
nextArrow,
|
|
1674
1670
|
arrowInner,
|
|
1675
|
-
arrowIcon,
|
|
1676
1671
|
arrowImg,
|
|
1677
1672
|
mirror,
|
|
1678
|
-
thumbsWrapper,
|
|
1679
1673
|
thumbsContainerVertical,
|
|
1680
1674
|
thumbsContainer,
|
|
1681
1675
|
thumbsAlignStart,
|
|
@@ -1731,13 +1725,8 @@ const getPositionStyles = (position, offset, isEditor) => {
|
|
|
1731
1725
|
};
|
|
1732
1726
|
function getDisplayedImageRect(img2) {
|
|
1733
1727
|
const container = img2.getBoundingClientRect();
|
|
1734
|
-
const
|
|
1735
|
-
const
|
|
1736
|
-
const paddingRight = parseFloat(style.paddingRight) || 0;
|
|
1737
|
-
const paddingBottom = parseFloat(style.paddingBottom) || 0;
|
|
1738
|
-
const paddingLeft = parseFloat(style.paddingLeft) || 0;
|
|
1739
|
-
const containerW = Math.max(0, container.width - paddingLeft - paddingRight);
|
|
1740
|
-
const containerH = Math.max(0, container.height - paddingTop - paddingBottom);
|
|
1728
|
+
const containerW = container.width;
|
|
1729
|
+
const containerH = container.height;
|
|
1741
1730
|
const imgW = img2.naturalWidth;
|
|
1742
1731
|
const imgH = img2.naturalHeight;
|
|
1743
1732
|
const containerRatio = containerW / containerH;
|
|
@@ -1750,10 +1739,8 @@ function getDisplayedImageRect(img2) {
|
|
|
1750
1739
|
renderedH = containerH;
|
|
1751
1740
|
renderedW = containerH * imgRatio;
|
|
1752
1741
|
}
|
|
1753
|
-
const
|
|
1754
|
-
const
|
|
1755
|
-
const offsetX = (containerW - renderedW) / 2 + contentLeft;
|
|
1756
|
-
const offsetY = (containerH - renderedH) / 2 + contentTop;
|
|
1742
|
+
const offsetX = (containerW - renderedW) / 2 + container.left;
|
|
1743
|
+
const offsetY = (containerH - renderedH) / 2 + container.top;
|
|
1757
1744
|
return {
|
|
1758
1745
|
x: offsetX,
|
|
1759
1746
|
y: offsetY,
|
|
@@ -1856,9 +1843,9 @@ function getAnimationClasses(type, direction) {
|
|
|
1856
1843
|
return { appearClass, backdropAppearClass, backdropDisappearClass, disappearClass };
|
|
1857
1844
|
}
|
|
1858
1845
|
const LightboxGallery = ({ settings, content, styles: styles2, portalId, activeEvent, isEditor }) => {
|
|
1859
|
-
const [open, setOpen] =
|
|
1846
|
+
const [open, setOpen] = React.useState(false);
|
|
1860
1847
|
const { url } = settings.thumbnailBlock.cover;
|
|
1861
|
-
|
|
1848
|
+
React.useEffect(() => {
|
|
1862
1849
|
if (activeEvent === "close") {
|
|
1863
1850
|
setOpen(false);
|
|
1864
1851
|
}
|
|
@@ -1891,22 +1878,22 @@ const LightboxGallery = ({ settings, content, styles: styles2, portalId, activeE
|
|
|
1891
1878
|
] });
|
|
1892
1879
|
};
|
|
1893
1880
|
const Lightbox = ({ isOpen, onClose, content, lightboxStyles, settings, portalId, isEditor }) => {
|
|
1894
|
-
const [currentIndex, setCurrentIndex] =
|
|
1895
|
-
const [splideKey, setSplideKey] =
|
|
1896
|
-
const [isClosing, setIsClosing] =
|
|
1897
|
-
const [animationFinished, setAnimationFinished] =
|
|
1898
|
-
const [thumbnailDimensions, setThumbnailDimensions] =
|
|
1899
|
-
const lightboxRef =
|
|
1900
|
-
const prevSliderTypeRef =
|
|
1901
|
-
const imageRef =
|
|
1902
|
-
const isClosingRef =
|
|
1903
|
-
const animationTargetRef =
|
|
1904
|
-
const animationEndHandlerRef =
|
|
1905
|
-
const appearAnimationEndHandlerRef =
|
|
1906
|
-
const { appear, triggers, slider, thumbnail, controls, area,
|
|
1907
|
-
const { widthSettings, fontSettings, letterSpacing, textAlign, wordSpacing, fontSizeLineHeight, textAppearance, color } = lightboxStyles.
|
|
1881
|
+
const [currentIndex, setCurrentIndex] = React.useState(0);
|
|
1882
|
+
const [splideKey, setSplideKey] = React.useState(0);
|
|
1883
|
+
const [isClosing, setIsClosing] = React.useState(false);
|
|
1884
|
+
const [animationFinished, setAnimationFinished] = React.useState(false);
|
|
1885
|
+
const [thumbnailDimensions, setThumbnailDimensions] = React.useState({});
|
|
1886
|
+
const lightboxRef = React.useRef(null);
|
|
1887
|
+
const prevSliderTypeRef = React.useRef(null);
|
|
1888
|
+
const imageRef = React.useRef(null);
|
|
1889
|
+
const isClosingRef = React.useRef(false);
|
|
1890
|
+
const animationTargetRef = React.useRef(null);
|
|
1891
|
+
const animationEndHandlerRef = React.useRef(null);
|
|
1892
|
+
const appearAnimationEndHandlerRef = React.useRef(null);
|
|
1893
|
+
const { appear, triggers, slider, thumbnail, controls, area, imageCaption, layout } = settings.lightboxBlock;
|
|
1894
|
+
const { widthSettings, fontSettings, letterSpacing, textAlign, wordSpacing, fontSizeLineHeight, textAppearance, color } = lightboxStyles.imageCaption;
|
|
1908
1895
|
const { appearClass, backdropAppearClass, backdropDisappearClass, disappearClass } = getAnimationClasses(appear.type, appear.direction);
|
|
1909
|
-
|
|
1896
|
+
React.useEffect(() => {
|
|
1910
1897
|
const handleLayoutChange = () => {
|
|
1911
1898
|
setTimeout(() => {
|
|
1912
1899
|
var _a, _b;
|
|
@@ -1923,7 +1910,7 @@ const Lightbox = ({ isOpen, onClose, content, lightboxStyles, settings, portalId
|
|
|
1923
1910
|
window.removeEventListener("ArticleEditor.ComponentContent:change", handleComponentContentChange);
|
|
1924
1911
|
};
|
|
1925
1912
|
}, []);
|
|
1926
|
-
const handleClose =
|
|
1913
|
+
const handleClose = React.useCallback(() => {
|
|
1927
1914
|
const isMobile = window.matchMedia("(max-width: 768px)").matches;
|
|
1928
1915
|
const colorAlpha = getColorAlpha(area.color);
|
|
1929
1916
|
if (isMobile && !isEditor && colorAlpha > 0.9) {
|
|
@@ -1970,19 +1957,6 @@ const Lightbox = ({ isOpen, onClose, content, lightboxStyles, settings, portalId
|
|
|
1970
1957
|
(_b = lightboxRef.current) == null ? void 0 : _b.go(dir);
|
|
1971
1958
|
}
|
|
1972
1959
|
};
|
|
1973
|
-
const isClickInImagePadding = (img2, clientX, clientY) => {
|
|
1974
|
-
const rect = img2.getBoundingClientRect();
|
|
1975
|
-
const style = window.getComputedStyle(img2);
|
|
1976
|
-
const paddingTop = parseFloat(style.paddingTop) || 0;
|
|
1977
|
-
const paddingRight = parseFloat(style.paddingRight) || 0;
|
|
1978
|
-
const paddingBottom = parseFloat(style.paddingBottom) || 0;
|
|
1979
|
-
const paddingLeft = parseFloat(style.paddingLeft) || 0;
|
|
1980
|
-
const contentLeft = rect.left + paddingLeft;
|
|
1981
|
-
const contentRight = rect.right - paddingRight;
|
|
1982
|
-
const contentTop = rect.top + paddingTop;
|
|
1983
|
-
const contentBottom = rect.bottom - paddingBottom;
|
|
1984
|
-
return clientX < contentLeft || clientX > contentRight || clientY < contentTop || clientY > contentBottom;
|
|
1985
|
-
};
|
|
1986
1960
|
const handleImageWrapperClick = (e) => {
|
|
1987
1961
|
const currentImage = content[currentIndex];
|
|
1988
1962
|
const isCover = (currentImage == null ? void 0 : currentImage.image.objectFit) === "cover";
|
|
@@ -2000,16 +1974,7 @@ const Lightbox = ({ isOpen, onClose, content, lightboxStyles, settings, portalId
|
|
|
2000
1974
|
let inside;
|
|
2001
1975
|
if (isCover && imageRef.current) {
|
|
2002
1976
|
const imgRect = imageRef.current.getBoundingClientRect();
|
|
2003
|
-
|
|
2004
|
-
const paddingTop = parseFloat(style.paddingTop) || 0;
|
|
2005
|
-
const paddingRight = parseFloat(style.paddingRight) || 0;
|
|
2006
|
-
const paddingBottom = parseFloat(style.paddingBottom) || 0;
|
|
2007
|
-
const paddingLeft = parseFloat(style.paddingLeft) || 0;
|
|
2008
|
-
const contentLeft = imgRect.left + paddingLeft;
|
|
2009
|
-
const contentRight = imgRect.right - paddingRight;
|
|
2010
|
-
const contentTop = imgRect.top + paddingTop;
|
|
2011
|
-
const contentBottom = imgRect.bottom - paddingBottom;
|
|
2012
|
-
inside = clientX >= contentLeft && clientX <= contentRight && clientY >= contentTop && clientY <= contentBottom;
|
|
1977
|
+
inside = clientX >= imgRect.left && clientX <= imgRect.right && clientY >= imgRect.top && clientY <= imgRect.bottom;
|
|
2013
1978
|
} else {
|
|
2014
1979
|
const rect = imageRef.current ? getDisplayedImageRect(imageRef.current) : null;
|
|
2015
1980
|
if (!rect) {
|
|
@@ -2026,13 +1991,9 @@ const Lightbox = ({ isOpen, onClose, content, lightboxStyles, settings, portalId
|
|
|
2026
1991
|
};
|
|
2027
1992
|
const onImageClick = (e) => {
|
|
2028
1993
|
e.stopPropagation();
|
|
2029
|
-
if (isClickInImagePadding(e.currentTarget, e.clientX, e.clientY)) {
|
|
2030
|
-
handleClose();
|
|
2031
|
-
return;
|
|
2032
|
-
}
|
|
2033
1994
|
handleTriggerClick(e.currentTarget, e.clientX, e.clientY);
|
|
2034
1995
|
};
|
|
2035
|
-
|
|
1996
|
+
React.useEffect(() => {
|
|
2036
1997
|
if (!isOpen) return;
|
|
2037
1998
|
const onKeyDown = (event) => {
|
|
2038
1999
|
var _a, _b;
|
|
@@ -2055,10 +2016,9 @@ const Lightbox = ({ isOpen, onClose, content, lightboxStyles, settings, portalId
|
|
|
2055
2016
|
window.removeEventListener("keydown", onKeyDown);
|
|
2056
2017
|
};
|
|
2057
2018
|
}, [isOpen, handleClose, content.length]);
|
|
2058
|
-
|
|
2019
|
+
React.useEffect(() => {
|
|
2059
2020
|
if (isOpen) {
|
|
2060
2021
|
setCurrentIndex(0);
|
|
2061
|
-
setSplideKey((prev) => prev + 1);
|
|
2062
2022
|
isClosingRef.current = false;
|
|
2063
2023
|
setIsClosing(false);
|
|
2064
2024
|
setAnimationFinished(false);
|
|
@@ -2072,13 +2032,13 @@ const Lightbox = ({ isOpen, onClose, content, lightboxStyles, settings, portalId
|
|
|
2072
2032
|
setAnimationFinished(false);
|
|
2073
2033
|
};
|
|
2074
2034
|
}, [isOpen]);
|
|
2075
|
-
|
|
2035
|
+
React.useEffect(() => {
|
|
2076
2036
|
if (prevSliderTypeRef.current !== null && prevSliderTypeRef.current !== slider.type) {
|
|
2077
2037
|
setSplideKey((prev) => prev + 1);
|
|
2078
2038
|
}
|
|
2079
2039
|
prevSliderTypeRef.current = slider.type;
|
|
2080
2040
|
}, [slider.type]);
|
|
2081
|
-
|
|
2041
|
+
React.useEffect(() => {
|
|
2082
2042
|
if (!isOpen) return;
|
|
2083
2043
|
const originalOverflow = document.body.style.overflow;
|
|
2084
2044
|
const isMobile = window.matchMedia("(max-width: 768px)").matches;
|
|
@@ -2113,7 +2073,7 @@ const Lightbox = ({ isOpen, onClose, content, lightboxStyles, settings, portalId
|
|
|
2113
2073
|
setAnimationFinished(false);
|
|
2114
2074
|
};
|
|
2115
2075
|
}, [isOpen, isEditor, area.color]);
|
|
2116
|
-
|
|
2076
|
+
React.useEffect(() => {
|
|
2117
2077
|
if (!isOpen) return;
|
|
2118
2078
|
const handleTouchEnd = (e) => {
|
|
2119
2079
|
if (isClosingRef.current) {
|
|
@@ -2162,14 +2122,14 @@ const Lightbox = ({ isOpen, onClose, content, lightboxStyles, settings, portalId
|
|
|
2162
2122
|
animationTimingFunction: "ease",
|
|
2163
2123
|
animationFillMode: "both"
|
|
2164
2124
|
};
|
|
2165
|
-
if (!
|
|
2125
|
+
if (!isOpen && !isClosing) return null;
|
|
2166
2126
|
return reactDom.createPortal(
|
|
2167
2127
|
/* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2168
2128
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2169
2129
|
"div",
|
|
2170
2130
|
{
|
|
2171
2131
|
ref: !isEditor ? animationTargetRef : null,
|
|
2172
|
-
className: cn(classes.background, isClosing ? backdropDisappearClass : backdropAppearClass, { [classes.editor]: isEditor }
|
|
2132
|
+
className: cn(classes.background, isClosing ? backdropDisappearClass : backdropAppearClass, { [classes.editor]: isEditor }),
|
|
2173
2133
|
style: {
|
|
2174
2134
|
...backdropStyles,
|
|
2175
2135
|
...animationFinished && !isEditor && !isClosing ? { position: "absolute" } : {}
|
|
@@ -2180,7 +2140,7 @@ const Lightbox = ({ isOpen, onClose, content, lightboxStyles, settings, portalId
|
|
|
2180
2140
|
"div",
|
|
2181
2141
|
{
|
|
2182
2142
|
ref: isEditor ? animationTargetRef : null,
|
|
2183
|
-
className: cn(classes.contentStyle, !isClosing ? appearClass : disappearClass, { [classes.editor]: isEditor }
|
|
2143
|
+
className: cn(classes.contentStyle, !isClosing ? appearClass : disappearClass, { [classes.editor]: isEditor }),
|
|
2184
2144
|
style: {
|
|
2185
2145
|
animationDuration: `${parseInt(appear.duration)}ms`,
|
|
2186
2146
|
animationTimingFunction: "ease",
|
|
@@ -2204,8 +2164,7 @@ const Lightbox = ({ isOpen, onClose, content, lightboxStyles, settings, portalId
|
|
|
2204
2164
|
height: "100%",
|
|
2205
2165
|
type: slider.type === "fade" || slider.type === "scale" ? "fade" : "loop",
|
|
2206
2166
|
padding: 0,
|
|
2207
|
-
rewind: (slider.type === "scale" || slider.type === "fade") && triggers.repeat === "loop"
|
|
2208
|
-
start: 0
|
|
2167
|
+
rewind: (slider.type === "scale" || slider.type === "fade") && triggers.repeat === "loop"
|
|
2209
2168
|
},
|
|
2210
2169
|
style: { "--splide-speed": slider.duration },
|
|
2211
2170
|
children: content.map((item, index) => {
|
|
@@ -2240,13 +2199,13 @@ const Lightbox = ({ isOpen, onClose, content, lightboxStyles, settings, portalId
|
|
|
2240
2199
|
},
|
|
2241
2200
|
splideKey
|
|
2242
2201
|
),
|
|
2243
|
-
controls.isActive && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2202
|
+
controls.isActive && controls.arrowsImgUrl && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2244
2203
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2245
2204
|
"div",
|
|
2246
2205
|
{
|
|
2247
2206
|
className: cn(classes.arrow, { [classes.arrowVertical]: slider.direction === "vert" }),
|
|
2248
2207
|
style: { color: controls.color, ["--arrow-hover-color"]: controls.hover },
|
|
2249
|
-
children: /* @__PURE__ */ jsxRuntime.
|
|
2208
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2250
2209
|
"button",
|
|
2251
2210
|
{
|
|
2252
2211
|
className: classes.arrowInner,
|
|
@@ -2256,18 +2215,15 @@ const Lightbox = ({ isOpen, onClose, content, lightboxStyles, settings, portalId
|
|
|
2256
2215
|
return (_a = lightboxRef.current) == null ? void 0 : _a.go("-1");
|
|
2257
2216
|
},
|
|
2258
2217
|
"aria-label": "Previous",
|
|
2259
|
-
children:
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
),
|
|
2269
|
-
!controls.arrowsImgUrl && /* @__PURE__ */ jsxRuntime.jsx(ArrowIcon, { color: controls.color, className: cn(classes.arrowIcon, classes.arrowImg, classes.mirror) })
|
|
2270
|
-
]
|
|
2218
|
+
children: controls.arrowsImgUrl && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2219
|
+
SvgImage,
|
|
2220
|
+
{
|
|
2221
|
+
url: controls.arrowsImgUrl,
|
|
2222
|
+
fill: controls.color,
|
|
2223
|
+
hoverFill: controls.hover,
|
|
2224
|
+
className: cn(classes.arrowImg, classes.mirror)
|
|
2225
|
+
}
|
|
2226
|
+
)
|
|
2271
2227
|
}
|
|
2272
2228
|
)
|
|
2273
2229
|
}
|
|
@@ -2277,7 +2233,7 @@ const Lightbox = ({ isOpen, onClose, content, lightboxStyles, settings, portalId
|
|
|
2277
2233
|
{
|
|
2278
2234
|
className: cn(classes.arrow, classes.nextArrow, { [classes.arrowVertical]: slider.direction === "vert" }),
|
|
2279
2235
|
style: { color: controls.color, ["--arrow-hover-color"]: controls.hover },
|
|
2280
|
-
children: /* @__PURE__ */ jsxRuntime.
|
|
2236
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2281
2237
|
"button",
|
|
2282
2238
|
{
|
|
2283
2239
|
className: classes.arrowInner,
|
|
@@ -2287,18 +2243,15 @@ const Lightbox = ({ isOpen, onClose, content, lightboxStyles, settings, portalId
|
|
|
2287
2243
|
return (_a = lightboxRef.current) == null ? void 0 : _a.go("+1");
|
|
2288
2244
|
},
|
|
2289
2245
|
"aria-label": "Next",
|
|
2290
|
-
children:
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
),
|
|
2300
|
-
!controls.arrowsImgUrl && /* @__PURE__ */ jsxRuntime.jsx(ArrowIcon, { color: controls.color, className: cn(classes.arrowIcon, classes.arrowImg) })
|
|
2301
|
-
]
|
|
2246
|
+
children: controls.arrowsImgUrl && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2247
|
+
SvgImage,
|
|
2248
|
+
{
|
|
2249
|
+
url: controls.arrowsImgUrl,
|
|
2250
|
+
fill: controls.color,
|
|
2251
|
+
hoverFill: controls.hover,
|
|
2252
|
+
className: classes.arrowImg
|
|
2253
|
+
}
|
|
2254
|
+
)
|
|
2302
2255
|
}
|
|
2303
2256
|
)
|
|
2304
2257
|
}
|
|
@@ -2308,14 +2261,14 @@ const Lightbox = ({ isOpen, onClose, content, lightboxStyles, settings, portalId
|
|
|
2308
2261
|
const positionStyles = getPositionStyles(area.closeIconAlign, area.closeIconOffset, isEditor);
|
|
2309
2262
|
const scaleTransform = `scale(${area.closeIconScale})`;
|
|
2310
2263
|
const combinedTransform = positionStyles.transform ? `${positionStyles.transform} ${scaleTransform}` : scaleTransform;
|
|
2311
|
-
return /* @__PURE__ */ jsxRuntime.jsx("button", { className: classes.closeButton, style: { ...positionStyles, transform: combinedTransform }, onClick: handleClose, "aria-label": "Close lightbox", children: /* @__PURE__ */ jsxRuntime.jsx(SvgImage, { url: area.closeIconUrl
|
|
2264
|
+
return /* @__PURE__ */ jsxRuntime.jsx("button", { className: classes.closeButton, style: { ...positionStyles, transform: combinedTransform }, onClick: handleClose, "aria-label": "Close lightbox", children: /* @__PURE__ */ jsxRuntime.jsx(SvgImage, { url: area.closeIconUrl }) });
|
|
2312
2265
|
})(),
|
|
2313
|
-
|
|
2266
|
+
imageCaption.isActive && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2314
2267
|
"div",
|
|
2315
2268
|
{
|
|
2316
2269
|
className: classes.caption,
|
|
2317
2270
|
style: {
|
|
2318
|
-
...getPositionStyles(
|
|
2271
|
+
...getPositionStyles(imageCaption.alignment, imageCaption.offset, isEditor),
|
|
2319
2272
|
fontFamily: fontSettings.fontFamily,
|
|
2320
2273
|
fontWeight: fontSettings.fontWeight,
|
|
2321
2274
|
fontStyle: fontSettings.fontStyle,
|
|
@@ -2334,134 +2287,104 @@ const Lightbox = ({ isOpen, onClose, content, lightboxStyles, settings, portalId
|
|
|
2334
2287
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2335
2288
|
"div",
|
|
2336
2289
|
{
|
|
2337
|
-
"data-styles": "
|
|
2290
|
+
"data-styles": "imageCaption",
|
|
2338
2291
|
className: classes.captionTextInner,
|
|
2339
|
-
style: { ["--link-hover-color"]:
|
|
2292
|
+
style: { ["--link-hover-color"]: imageCaption.hover },
|
|
2340
2293
|
children: /* @__PURE__ */ jsxRuntime.jsx(RichTextRenderer, { content: content[currentIndex].imageCaption })
|
|
2341
2294
|
}
|
|
2342
2295
|
)
|
|
2343
2296
|
}
|
|
2344
2297
|
),
|
|
2345
|
-
thumbnail.isActive &&
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2298
|
+
thumbnail.isActive && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2299
|
+
"div",
|
|
2300
|
+
{
|
|
2301
|
+
className: cn(classes.thumbsContainer, {
|
|
2302
|
+
[classes.thumbsContainerVertical]: slider.direction === "vert",
|
|
2303
|
+
[classes.thumbsAlignStart]: thumbnail.align === "start",
|
|
2304
|
+
[classes.thumbsAlignCenter]: thumbnail.align === "center",
|
|
2305
|
+
[classes.thumbsAlignEnd]: thumbnail.align === "end"
|
|
2306
|
+
}),
|
|
2307
|
+
style: {
|
|
2308
|
+
position: isEditor ? "absolute" : "fixed",
|
|
2309
|
+
gap: scalingValue(thumbnail.grid.gap, isEditor),
|
|
2310
|
+
...getPositionStyles(thumbnail.position, thumbnail.offset, isEditor)
|
|
2311
|
+
},
|
|
2312
|
+
children: content.map((item, index) => {
|
|
2313
|
+
const isActive = index === currentIndex;
|
|
2314
|
+
const thumbDims = thumbnailDimensions[index];
|
|
2315
|
+
const baseSizeValue = thumbnail.grid.size;
|
|
2316
|
+
const activeSizeValue = baseSizeValue * (isActive ? thumbnail.activeState.scale : 1);
|
|
2317
|
+
const getFitDimensions = () => {
|
|
2318
|
+
if (thumbnail.fit !== "fit" || !thumbDims) return {};
|
|
2319
|
+
const aspectRatio = thumbDims.width / thumbDims.height;
|
|
2320
|
+
if (slider.direction === "horiz") {
|
|
2321
|
+
const heightValue = activeSizeValue;
|
|
2322
|
+
const widthValue = heightValue * aspectRatio;
|
|
2323
|
+
return {
|
|
2324
|
+
width: scalingValue(widthValue, isEditor),
|
|
2325
|
+
height: scalingValue(heightValue, isEditor)
|
|
2326
|
+
};
|
|
2327
|
+
} else {
|
|
2328
|
+
const widthValue = activeSizeValue;
|
|
2329
|
+
const heightValue = widthValue / aspectRatio;
|
|
2330
|
+
return {
|
|
2331
|
+
width: scalingValue(widthValue, isEditor),
|
|
2332
|
+
height: scalingValue(heightValue, isEditor)
|
|
2333
|
+
};
|
|
2365
2334
|
}
|
|
2366
|
-
}
|
|
2367
|
-
|
|
2368
|
-
"
|
|
2335
|
+
};
|
|
2336
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2337
|
+
"button",
|
|
2369
2338
|
{
|
|
2370
|
-
className:
|
|
2371
|
-
[classes.thumbsContainerVertical]: slider.direction === "vert",
|
|
2372
|
-
[classes.thumbsAlignStart]: thumbnail.align === "start",
|
|
2373
|
-
[classes.thumbsAlignCenter]: thumbnail.align === "center",
|
|
2374
|
-
[classes.thumbsAlignEnd]: thumbnail.align === "end"
|
|
2375
|
-
}),
|
|
2339
|
+
className: classes.thumbItem,
|
|
2376
2340
|
style: {
|
|
2377
|
-
|
|
2341
|
+
...slider.direction === "horiz" && thumbnail.fit !== "fit" ? { height: scalingValue(activeSizeValue, isEditor) } : {},
|
|
2342
|
+
...slider.direction === "vert" && thumbnail.fit !== "fit" ? { width: scalingValue(activeSizeValue, isEditor) } : {},
|
|
2343
|
+
...thumbnail.fit === "cover" ? { width: scalingValue(activeSizeValue, isEditor), height: scalingValue(activeSizeValue, isEditor) } : {},
|
|
2344
|
+
...thumbnail.fit === "fit" ? getFitDimensions() : {},
|
|
2345
|
+
transition: isActive ? "all 0.2s ease" : "none",
|
|
2346
|
+
opacity: isActive ? thumbnail.activeState.opacity / 100 : thumbnail.opacity / 100,
|
|
2347
|
+
["--thumb-hover"]: thumbnail.activeState.opacity / 100
|
|
2348
|
+
},
|
|
2349
|
+
onClick: (e) => {
|
|
2350
|
+
var _a;
|
|
2351
|
+
e.stopPropagation();
|
|
2352
|
+
setCurrentIndex(index);
|
|
2353
|
+
(_a = lightboxRef.current) == null ? void 0 : _a.go(index);
|
|
2354
|
+
},
|
|
2355
|
+
onMouseEnter: () => {
|
|
2356
|
+
var _a;
|
|
2357
|
+
if (thumbnail.triggers === "hov") {
|
|
2358
|
+
(_a = lightboxRef.current) == null ? void 0 : _a.go(index);
|
|
2359
|
+
}
|
|
2378
2360
|
},
|
|
2379
|
-
children:
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2361
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2362
|
+
"img",
|
|
2363
|
+
{
|
|
2364
|
+
src: item.image.url,
|
|
2365
|
+
alt: item.image.name ?? "",
|
|
2366
|
+
onLoad: (e) => {
|
|
2367
|
+
const img2 = e.currentTarget;
|
|
2368
|
+
if (img2.naturalWidth && img2.naturalHeight) {
|
|
2369
|
+
setThumbnailDimensions((prev) => ({
|
|
2370
|
+
...prev,
|
|
2371
|
+
[index]: { width: img2.naturalWidth, height: img2.naturalHeight }
|
|
2372
|
+
}));
|
|
2391
2373
|
}
|
|
2392
|
-
}
|
|
2393
|
-
const aspectRatio = thumbDims.width / thumbDims.height;
|
|
2394
|
-
if (slider.direction === "horiz") {
|
|
2395
|
-
const heightValue = activeSizeValue;
|
|
2396
|
-
const widthValue = heightValue * aspectRatio;
|
|
2397
|
-
return {
|
|
2398
|
-
width: scalingValue(widthValue, isEditor),
|
|
2399
|
-
height: scalingValue(heightValue, isEditor)
|
|
2400
|
-
};
|
|
2401
|
-
} else {
|
|
2402
|
-
const widthValue = activeSizeValue;
|
|
2403
|
-
const heightValue = widthValue / aspectRatio;
|
|
2404
|
-
return {
|
|
2405
|
-
width: scalingValue(widthValue, isEditor),
|
|
2406
|
-
height: scalingValue(heightValue, isEditor)
|
|
2407
|
-
};
|
|
2408
|
-
}
|
|
2409
|
-
};
|
|
2410
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2411
|
-
"button",
|
|
2412
|
-
{
|
|
2413
|
-
className: classes.thumbItem,
|
|
2414
|
-
style: {
|
|
2415
|
-
...slider.direction === "horiz" && thumbnail.fit !== "fit" ? { height: scalingValue(activeSizeValue, isEditor) } : {},
|
|
2416
|
-
...slider.direction === "vert" && thumbnail.fit !== "fit" ? { width: scalingValue(activeSizeValue, isEditor) } : {},
|
|
2417
|
-
...thumbnail.fit === "cover" ? { width: scalingValue(activeSizeValue, isEditor), height: scalingValue(activeSizeValue, isEditor) } : {},
|
|
2418
|
-
...getFitDimensions(),
|
|
2419
|
-
transition: isActive ? "all 0.2s ease-out" : "none",
|
|
2420
|
-
opacity: isActive ? thumbnail.activeState.opacity / 100 : thumbnail.opacity / 100,
|
|
2421
|
-
["--thumb-hover"]: thumbnail.activeState.opacity / 100
|
|
2422
|
-
},
|
|
2423
|
-
onClick: (e) => {
|
|
2424
|
-
var _a;
|
|
2425
|
-
e.stopPropagation();
|
|
2426
|
-
setCurrentIndex(index);
|
|
2427
|
-
(_a = lightboxRef.current) == null ? void 0 : _a.go(index);
|
|
2428
|
-
},
|
|
2429
|
-
onMouseEnter: () => {
|
|
2430
|
-
var _a;
|
|
2431
|
-
if (thumbnail.triggers === "hov") {
|
|
2432
|
-
(_a = lightboxRef.current) == null ? void 0 : _a.go(index);
|
|
2433
|
-
}
|
|
2434
|
-
},
|
|
2435
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2436
|
-
"img",
|
|
2437
|
-
{
|
|
2438
|
-
src: item.image.url,
|
|
2439
|
-
alt: item.image.name ?? "",
|
|
2440
|
-
onLoad: (e) => {
|
|
2441
|
-
const img2 = e.currentTarget;
|
|
2442
|
-
if (img2.naturalWidth && img2.naturalHeight) {
|
|
2443
|
-
setThumbnailDimensions((prev) => ({
|
|
2444
|
-
...prev,
|
|
2445
|
-
[index]: { width: img2.naturalWidth, height: img2.naturalHeight }
|
|
2446
|
-
}));
|
|
2447
|
-
}
|
|
2448
|
-
},
|
|
2449
|
-
style: {
|
|
2450
|
-
objectFit: thumbnail.fit === "cover" ? "cover" : "contain",
|
|
2451
|
-
...thumbnail.fit === "fit" ? { maxWidth: "100%", maxHeight: "100%", objectFit: "contain" } : {},
|
|
2452
|
-
...thumbnail.fit === "cover" && slider.direction === "horiz" ? { width: "100%", height: "100%" } : {}
|
|
2453
|
-
}
|
|
2454
|
-
}
|
|
2455
|
-
)
|
|
2456
2374
|
},
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2375
|
+
style: {
|
|
2376
|
+
objectFit: thumbnail.fit === "cover" ? "cover" : "contain",
|
|
2377
|
+
...thumbnail.fit === "fit" ? { maxWidth: "100%", maxHeight: "100%", objectFit: "contain" } : {},
|
|
2378
|
+
...thumbnail.fit === "cover" && slider.direction === "horiz" ? { width: "100%", height: "100%" } : {}
|
|
2379
|
+
}
|
|
2380
|
+
}
|
|
2381
|
+
)
|
|
2382
|
+
},
|
|
2383
|
+
`${item.image.name}-${index}`
|
|
2384
|
+
);
|
|
2385
|
+
})
|
|
2386
|
+
}
|
|
2387
|
+
)
|
|
2465
2388
|
]
|
|
2466
2389
|
}
|
|
2467
2390
|
)
|
|
@@ -2469,9 +2392,6 @@ const Lightbox = ({ isOpen, onClose, content, lightboxStyles, settings, portalId
|
|
|
2469
2392
|
document.getElementById(portalId)
|
|
2470
2393
|
);
|
|
2471
2394
|
};
|
|
2472
|
-
function ArrowIcon({ color, className }) {
|
|
2473
|
-
return /* @__PURE__ */ jsxRuntime.jsx("svg", { viewBox: "0 0 10 18", className, children: /* @__PURE__ */ jsxRuntime.jsx("g", { id: "Symbols", stroke: "none", strokeWidth: "1", fillRule: "evenodd", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M-3.70710678,4.29289322 C-3.34662282,3.93240926 -2.77939176,3.90467972 -2.38710056,4.20970461 L-2.29289322,4.29289322 L5,11.585 L12.2928932,4.29289322 C12.6533772,3.93240926 13.2206082,3.90467972 13.6128994,4.20970461 L13.7071068,4.29289322 C14.0675907,4.65337718 14.0953203,5.22060824 13.7902954,5.61289944 L13.7071068,5.70710678 L5.70710678,13.7071068 C5.34662282,14.0675907 4.77939176,14.0953203 4.38710056,13.7902954 L4.29289322,13.7071068 L-3.70710678,5.70710678 C-4.09763107,5.31658249 -4.09763107,4.68341751 -3.70710678,4.29289322 Z", id: "Shape-Copy", fill: color, transform: "translate(5, 9) rotate(-90) translate(-5, -9)" }) }) });
|
|
2474
|
-
}
|
|
2475
2395
|
const LightboxComponent = {
|
|
2476
2396
|
element: LightboxGallery,
|
|
2477
2397
|
id: "lightbox",
|
|
@@ -2969,26 +2889,10 @@ const LightboxComponent = {
|
|
|
2969
2889
|
}
|
|
2970
2890
|
}
|
|
2971
2891
|
}
|
|
2972
|
-
},
|
|
2973
|
-
closeIconColor: {
|
|
2974
|
-
title: "Color",
|
|
2975
|
-
type: "string",
|
|
2976
|
-
display: {
|
|
2977
|
-
type: "settings-color-picker",
|
|
2978
|
-
format: "single"
|
|
2979
|
-
}
|
|
2980
|
-
},
|
|
2981
|
-
closeIconHover: {
|
|
2982
|
-
title: "Hover",
|
|
2983
|
-
type: "string",
|
|
2984
|
-
display: {
|
|
2985
|
-
type: "settings-color-picker",
|
|
2986
|
-
format: "single"
|
|
2987
|
-
}
|
|
2988
2892
|
}
|
|
2989
2893
|
}
|
|
2990
2894
|
},
|
|
2991
|
-
|
|
2895
|
+
imageCaption: {
|
|
2992
2896
|
title: "DESC",
|
|
2993
2897
|
icon: "text-icon",
|
|
2994
2898
|
tooltip: "Description",
|
|
@@ -3093,7 +2997,7 @@ const LightboxComponent = {
|
|
|
3093
2997
|
padding: { top: 0.06, right: 0, bottom: 0.06, left: 0 }
|
|
3094
2998
|
},
|
|
3095
2999
|
controls: {
|
|
3096
|
-
isActive:
|
|
3000
|
+
isActive: true,
|
|
3097
3001
|
arrowsImgUrl: null,
|
|
3098
3002
|
offset: { x: 0, y: 0 },
|
|
3099
3003
|
scale: 1,
|
|
@@ -3104,13 +3008,11 @@ const LightboxComponent = {
|
|
|
3104
3008
|
color: "rgba(28,31,34,0.9)",
|
|
3105
3009
|
blur: 0,
|
|
3106
3010
|
closeIconUrl: null,
|
|
3107
|
-
closeIconColor: "#000000",
|
|
3108
|
-
closeIconHover: "#cccccc",
|
|
3109
3011
|
closeIconAlign: "top-right",
|
|
3110
3012
|
closeIconOffset: { x: 0, y: 0 },
|
|
3111
3013
|
closeIconScale: 1
|
|
3112
3014
|
},
|
|
3113
|
-
|
|
3015
|
+
imageCaption: {
|
|
3114
3016
|
isActive: true,
|
|
3115
3017
|
alignment: "middle-center",
|
|
3116
3018
|
offset: { x: 0, y: 0 },
|
|
@@ -3163,7 +3065,7 @@ const LightboxComponent = {
|
|
|
3163
3065
|
padding: { top: 0.06, right: 0.05, bottom: 0.06, left: 0.05 }
|
|
3164
3066
|
},
|
|
3165
3067
|
controls: {
|
|
3166
|
-
isActive:
|
|
3068
|
+
isActive: true,
|
|
3167
3069
|
arrowsImgUrl: null,
|
|
3168
3070
|
offset: { x: 0, y: 0 },
|
|
3169
3071
|
scale: 1,
|
|
@@ -3174,13 +3076,11 @@ const LightboxComponent = {
|
|
|
3174
3076
|
color: "rgba(28,31,34,0.9)",
|
|
3175
3077
|
blur: 0,
|
|
3176
3078
|
closeIconUrl: null,
|
|
3177
|
-
closeIconColor: "#000000",
|
|
3178
|
-
closeIconHover: "#cccccc",
|
|
3179
3079
|
closeIconAlign: "top-right",
|
|
3180
3080
|
closeIconOffset: { x: 0, y: 0 },
|
|
3181
3081
|
closeIconScale: 1
|
|
3182
3082
|
},
|
|
3183
|
-
|
|
3083
|
+
imageCaption: {
|
|
3184
3084
|
isActive: true,
|
|
3185
3085
|
alignment: "middle-center",
|
|
3186
3086
|
offset: { x: 0, y: 0 },
|
|
@@ -3233,7 +3133,7 @@ const LightboxComponent = {
|
|
|
3233
3133
|
padding: { top: 0.06, right: 0.1, bottom: 0.06, left: 0.1 }
|
|
3234
3134
|
},
|
|
3235
3135
|
controls: {
|
|
3236
|
-
isActive:
|
|
3136
|
+
isActive: true,
|
|
3237
3137
|
arrowsImgUrl: null,
|
|
3238
3138
|
offset: { x: 0, y: 0 },
|
|
3239
3139
|
scale: 1,
|
|
@@ -3244,13 +3144,11 @@ const LightboxComponent = {
|
|
|
3244
3144
|
color: "rgba(28,31,34,0.9)",
|
|
3245
3145
|
blur: 0,
|
|
3246
3146
|
closeIconUrl: null,
|
|
3247
|
-
closeIconColor: "#000000",
|
|
3248
|
-
closeIconHover: "#cccccc",
|
|
3249
3147
|
closeIconAlign: "top-right",
|
|
3250
3148
|
closeIconOffset: { x: 0, y: 0 },
|
|
3251
3149
|
closeIconScale: 1
|
|
3252
3150
|
},
|
|
3253
|
-
|
|
3151
|
+
imageCaption: {
|
|
3254
3152
|
isActive: true,
|
|
3255
3153
|
alignment: "middle-center",
|
|
3256
3154
|
offset: { x: 0, y: 0 },
|
|
@@ -3402,7 +3300,7 @@ const LightboxComponent = {
|
|
|
3402
3300
|
layoutBased: true,
|
|
3403
3301
|
type: "object",
|
|
3404
3302
|
properties: {
|
|
3405
|
-
|
|
3303
|
+
imageCaption: {
|
|
3406
3304
|
dataName: "caption",
|
|
3407
3305
|
type: "object",
|
|
3408
3306
|
properties: {
|
|
@@ -3500,7 +3398,7 @@ const LightboxComponent = {
|
|
|
3500
3398
|
}
|
|
3501
3399
|
},
|
|
3502
3400
|
default: {
|
|
3503
|
-
|
|
3401
|
+
imageCaption: {
|
|
3504
3402
|
widthSettings: {
|
|
3505
3403
|
width: 0.13,
|
|
3506
3404
|
sizing: "auto"
|