@cntrl-site/components 0.1.14 → 0.1.15
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/Lightbox/Lightbox.d.ts +2 -0
- package/dist/components.css +1 -1
- package/dist/index.js +445 -204
- package/dist/index.mjs +402 -161
- package/package.json +68 -68
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx, Fragment, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
2
|
+
import { useState, useEffect, useRef, useCallback } from "react";
|
|
3
3
|
import { Splide, SplideSlide } from "@splidejs/react-splide";
|
|
4
4
|
import cn from "classnames";
|
|
5
5
|
import { createPortal } from "react-dom";
|
|
@@ -11,7 +11,7 @@ const arrow$1 = "ControlSlider-module__arrow___05ghY";
|
|
|
11
11
|
const arrowVertical$1 = "ControlSlider-module__arrowVertical___tBfVN";
|
|
12
12
|
const nextArrow$1 = "ControlSlider-module__nextArrow___-30Yc";
|
|
13
13
|
const arrowInner$1 = "ControlSlider-module__arrowInner___aEra3";
|
|
14
|
-
const arrowIcon = "ControlSlider-module__arrowIcon___S4ztF";
|
|
14
|
+
const arrowIcon$1 = "ControlSlider-module__arrowIcon___S4ztF";
|
|
15
15
|
const arrowImg$1 = "ControlSlider-module__arrowImg___2dwJW";
|
|
16
16
|
const mirror$1 = "ControlSlider-module__mirror___brd6U";
|
|
17
17
|
const pagination = "ControlSlider-module__pagination___bicLF";
|
|
@@ -55,7 +55,7 @@ const styles$3 = {
|
|
|
55
55
|
arrowVertical: arrowVertical$1,
|
|
56
56
|
nextArrow: nextArrow$1,
|
|
57
57
|
arrowInner: arrowInner$1,
|
|
58
|
-
arrowIcon,
|
|
58
|
+
arrowIcon: arrowIcon$1,
|
|
59
59
|
arrowImg: arrowImg$1,
|
|
60
60
|
mirror: mirror$1,
|
|
61
61
|
pagination,
|
|
@@ -343,7 +343,7 @@ function ControlSlider({ settings, content, styles: sliderStyles, isEditor }) {
|
|
|
343
343
|
className: cn(styles$3.arrowImg, styles$3.mirror)
|
|
344
344
|
}
|
|
345
345
|
),
|
|
346
|
-
!controls.arrowsImgUrl && /* @__PURE__ */ jsx(ArrowIcon, { color: controls.color, className: cn(styles$3.arrowIcon, styles$3.arrowImg, styles$3.mirror) })
|
|
346
|
+
!controls.arrowsImgUrl && /* @__PURE__ */ jsx(ArrowIcon$1, { color: controls.color, className: cn(styles$3.arrowIcon, styles$3.arrowImg, styles$3.mirror) })
|
|
347
347
|
]
|
|
348
348
|
}
|
|
349
349
|
)
|
|
@@ -378,7 +378,7 @@ function ControlSlider({ settings, content, styles: sliderStyles, isEditor }) {
|
|
|
378
378
|
className: styles$3.arrowImg
|
|
379
379
|
}
|
|
380
380
|
),
|
|
381
|
-
!controls.arrowsImgUrl && /* @__PURE__ */ jsx(ArrowIcon, { color: controls.color, className: cn(styles$3.arrowIcon, styles$3.arrowImg) })
|
|
381
|
+
!controls.arrowsImgUrl && /* @__PURE__ */ jsx(ArrowIcon$1, { color: controls.color, className: cn(styles$3.arrowIcon, styles$3.arrowImg) })
|
|
382
382
|
]
|
|
383
383
|
}
|
|
384
384
|
)
|
|
@@ -450,7 +450,7 @@ function ControlSlider({ settings, content, styles: sliderStyles, isEditor }) {
|
|
|
450
450
|
}
|
|
451
451
|
) });
|
|
452
452
|
}
|
|
453
|
-
function ArrowIcon({ color, className }) {
|
|
453
|
+
function ArrowIcon$1({ color, className }) {
|
|
454
454
|
return /* @__PURE__ */ jsx("svg", { viewBox: "0 0 10 18", className, children: /* @__PURE__ */ jsx("g", { id: "Symbols", stroke: "none", strokeWidth: "1", fillRule: "evenodd", children: /* @__PURE__ */ 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)" }) }) });
|
|
455
455
|
}
|
|
456
456
|
const ControlSliderComponent = {
|
|
@@ -1615,6 +1615,7 @@ const ControlImageRevealSliderComponent = {
|
|
|
1615
1615
|
}
|
|
1616
1616
|
}
|
|
1617
1617
|
};
|
|
1618
|
+
const hidden = "LightBox-module__hidden___9s-9x";
|
|
1618
1619
|
const heroImage = "LightBox-module__heroImage___sTxNF";
|
|
1619
1620
|
const background = "LightBox-module__background___rm9ml";
|
|
1620
1621
|
const editor = "LightBox-module__editor___4ACaY";
|
|
@@ -1630,8 +1631,10 @@ const arrow = "LightBox-module__arrow___iz38X";
|
|
|
1630
1631
|
const arrowVertical = "LightBox-module__arrowVertical___Zfz81";
|
|
1631
1632
|
const nextArrow = "LightBox-module__nextArrow___zkAQN";
|
|
1632
1633
|
const arrowInner = "LightBox-module__arrowInner___p48sW";
|
|
1634
|
+
const arrowIcon = "LightBox-module__arrowIcon___3VaFf";
|
|
1633
1635
|
const arrowImg = "LightBox-module__arrowImg___pNV88";
|
|
1634
1636
|
const mirror = "LightBox-module__mirror___pjeXc";
|
|
1637
|
+
const thumbsWrapper = "LightBox-module__thumbsWrapper___GB-nU";
|
|
1635
1638
|
const thumbsContainerVertical = "LightBox-module__thumbsContainerVertical___wttk5";
|
|
1636
1639
|
const thumbsContainer = "LightBox-module__thumbsContainer___osSma";
|
|
1637
1640
|
const thumbsAlignStart = "LightBox-module__thumbsAlignStart___MO6tY";
|
|
@@ -1651,6 +1654,7 @@ const slideOutTop = "LightBox-module__slideOutTop___Vgg0z";
|
|
|
1651
1654
|
const slideOutBottom = "LightBox-module__slideOutBottom___nJ0Ef";
|
|
1652
1655
|
const scaleSlide = "LightBox-module__scaleSlide___vZriG";
|
|
1653
1656
|
const classes = {
|
|
1657
|
+
hidden,
|
|
1654
1658
|
heroImage,
|
|
1655
1659
|
background,
|
|
1656
1660
|
editor,
|
|
@@ -1666,8 +1670,10 @@ const classes = {
|
|
|
1666
1670
|
arrowVertical,
|
|
1667
1671
|
nextArrow,
|
|
1668
1672
|
arrowInner,
|
|
1673
|
+
arrowIcon,
|
|
1669
1674
|
arrowImg,
|
|
1670
1675
|
mirror,
|
|
1676
|
+
thumbsWrapper,
|
|
1671
1677
|
thumbsContainerVertical,
|
|
1672
1678
|
thumbsContainer,
|
|
1673
1679
|
thumbsAlignStart,
|
|
@@ -1723,8 +1729,13 @@ const getPositionStyles = (position, offset, isEditor) => {
|
|
|
1723
1729
|
};
|
|
1724
1730
|
function getDisplayedImageRect(img2) {
|
|
1725
1731
|
const container = img2.getBoundingClientRect();
|
|
1726
|
-
const
|
|
1727
|
-
const
|
|
1732
|
+
const style = window.getComputedStyle(img2);
|
|
1733
|
+
const paddingTop = parseFloat(style.paddingTop) || 0;
|
|
1734
|
+
const paddingRight = parseFloat(style.paddingRight) || 0;
|
|
1735
|
+
const paddingBottom = parseFloat(style.paddingBottom) || 0;
|
|
1736
|
+
const paddingLeft = parseFloat(style.paddingLeft) || 0;
|
|
1737
|
+
const containerW = Math.max(0, container.width - paddingLeft - paddingRight);
|
|
1738
|
+
const containerH = Math.max(0, container.height - paddingTop - paddingBottom);
|
|
1728
1739
|
const imgW = img2.naturalWidth;
|
|
1729
1740
|
const imgH = img2.naturalHeight;
|
|
1730
1741
|
const containerRatio = containerW / containerH;
|
|
@@ -1737,8 +1748,10 @@ function getDisplayedImageRect(img2) {
|
|
|
1737
1748
|
renderedH = containerH;
|
|
1738
1749
|
renderedW = containerH * imgRatio;
|
|
1739
1750
|
}
|
|
1740
|
-
const
|
|
1741
|
-
const
|
|
1751
|
+
const contentLeft = container.left + paddingLeft;
|
|
1752
|
+
const contentTop = container.top + paddingTop;
|
|
1753
|
+
const offsetX = (containerW - renderedW) / 2 + contentLeft;
|
|
1754
|
+
const offsetY = (containerH - renderedH) / 2 + contentTop;
|
|
1742
1755
|
return {
|
|
1743
1756
|
x: offsetX,
|
|
1744
1757
|
y: offsetY,
|
|
@@ -1841,7 +1854,7 @@ function getAnimationClasses(type, direction) {
|
|
|
1841
1854
|
return { appearClass, backdropAppearClass, backdropDisappearClass, disappearClass };
|
|
1842
1855
|
}
|
|
1843
1856
|
const LightboxGallery = ({ settings, content, styles: styles2, portalId, activeEvent, isEditor }) => {
|
|
1844
|
-
const [open, setOpen] =
|
|
1857
|
+
const [open, setOpen] = useState(false);
|
|
1845
1858
|
const { url } = settings.thumbnailBlock.cover;
|
|
1846
1859
|
useEffect(() => {
|
|
1847
1860
|
if (activeEvent === "close") {
|
|
@@ -1888,8 +1901,9 @@ const Lightbox = ({ isOpen, onClose, content, lightboxStyles, settings, portalId
|
|
|
1888
1901
|
const animationTargetRef = useRef(null);
|
|
1889
1902
|
const animationEndHandlerRef = useRef(null);
|
|
1890
1903
|
const appearAnimationEndHandlerRef = useRef(null);
|
|
1904
|
+
const dragStartRef = useRef(null);
|
|
1905
|
+
const hasDraggedRef = useRef(false);
|
|
1891
1906
|
const { appear, triggers, slider, thumbnail, controls, area, imageCaption, layout } = settings.lightboxBlock;
|
|
1892
|
-
const { widthSettings, fontSettings, letterSpacing, textAlign, wordSpacing, fontSizeLineHeight, textAppearance, color } = lightboxStyles.imageCaption;
|
|
1893
1907
|
const { appearClass, backdropAppearClass, backdropDisappearClass, disappearClass } = getAnimationClasses(appear.type, appear.direction);
|
|
1894
1908
|
useEffect(() => {
|
|
1895
1909
|
const handleLayoutChange = () => {
|
|
@@ -1955,7 +1969,24 @@ const Lightbox = ({ isOpen, onClose, content, lightboxStyles, settings, portalId
|
|
|
1955
1969
|
(_b = lightboxRef.current) == null ? void 0 : _b.go(dir);
|
|
1956
1970
|
}
|
|
1957
1971
|
};
|
|
1972
|
+
const isClickInImagePadding = (img2, clientX, clientY) => {
|
|
1973
|
+
const rect = img2.getBoundingClientRect();
|
|
1974
|
+
const style = window.getComputedStyle(img2);
|
|
1975
|
+
const paddingTop = parseFloat(style.paddingTop) || 0;
|
|
1976
|
+
const paddingRight = parseFloat(style.paddingRight) || 0;
|
|
1977
|
+
const paddingBottom = parseFloat(style.paddingBottom) || 0;
|
|
1978
|
+
const paddingLeft = parseFloat(style.paddingLeft) || 0;
|
|
1979
|
+
const contentLeft = rect.left + paddingLeft;
|
|
1980
|
+
const contentRight = rect.right - paddingRight;
|
|
1981
|
+
const contentTop = rect.top + paddingTop;
|
|
1982
|
+
const contentBottom = rect.bottom - paddingBottom;
|
|
1983
|
+
return clientX < contentLeft || clientX > contentRight || clientY < contentTop || clientY > contentBottom;
|
|
1984
|
+
};
|
|
1958
1985
|
const handleImageWrapperClick = (e) => {
|
|
1986
|
+
if (hasDraggedRef.current) {
|
|
1987
|
+
hasDraggedRef.current = false;
|
|
1988
|
+
return;
|
|
1989
|
+
}
|
|
1959
1990
|
const currentImage = content[currentIndex];
|
|
1960
1991
|
const isCover = (currentImage == null ? void 0 : currentImage.image.objectFit) === "cover";
|
|
1961
1992
|
let clientX;
|
|
@@ -1972,7 +2003,16 @@ const Lightbox = ({ isOpen, onClose, content, lightboxStyles, settings, portalId
|
|
|
1972
2003
|
let inside;
|
|
1973
2004
|
if (isCover && imageRef.current) {
|
|
1974
2005
|
const imgRect = imageRef.current.getBoundingClientRect();
|
|
1975
|
-
|
|
2006
|
+
const style = window.getComputedStyle(imageRef.current);
|
|
2007
|
+
const paddingTop = parseFloat(style.paddingTop) || 0;
|
|
2008
|
+
const paddingRight = parseFloat(style.paddingRight) || 0;
|
|
2009
|
+
const paddingBottom = parseFloat(style.paddingBottom) || 0;
|
|
2010
|
+
const paddingLeft = parseFloat(style.paddingLeft) || 0;
|
|
2011
|
+
const contentLeft = imgRect.left + paddingLeft;
|
|
2012
|
+
const contentRight = imgRect.right - paddingRight;
|
|
2013
|
+
const contentTop = imgRect.top + paddingTop;
|
|
2014
|
+
const contentBottom = imgRect.bottom - paddingBottom;
|
|
2015
|
+
inside = clientX >= contentLeft && clientX <= contentRight && clientY >= contentTop && clientY <= contentBottom;
|
|
1976
2016
|
} else {
|
|
1977
2017
|
const rect = imageRef.current ? getDisplayedImageRect(imageRef.current) : null;
|
|
1978
2018
|
if (!rect) {
|
|
@@ -1989,8 +2029,18 @@ const Lightbox = ({ isOpen, onClose, content, lightboxStyles, settings, portalId
|
|
|
1989
2029
|
};
|
|
1990
2030
|
const onImageClick = (e) => {
|
|
1991
2031
|
e.stopPropagation();
|
|
2032
|
+
if (isClickInImagePadding(e.currentTarget, e.clientX, e.clientY)) {
|
|
2033
|
+
handleClose();
|
|
2034
|
+
return;
|
|
2035
|
+
}
|
|
1992
2036
|
handleTriggerClick(e.currentTarget, e.clientX, e.clientY);
|
|
1993
2037
|
};
|
|
2038
|
+
const handleThumbWrapperClick = (e) => {
|
|
2039
|
+
const target = e.target;
|
|
2040
|
+
if (target.classList.contains(classes.thumbsWrapper) || target.classList.contains(classes.thumbsContainer)) {
|
|
2041
|
+
handleImageWrapperClick(e);
|
|
2042
|
+
}
|
|
2043
|
+
};
|
|
1994
2044
|
useEffect(() => {
|
|
1995
2045
|
if (!isOpen) return;
|
|
1996
2046
|
const onKeyDown = (event) => {
|
|
@@ -2017,6 +2067,7 @@ const Lightbox = ({ isOpen, onClose, content, lightboxStyles, settings, portalId
|
|
|
2017
2067
|
useEffect(() => {
|
|
2018
2068
|
if (isOpen) {
|
|
2019
2069
|
setCurrentIndex(0);
|
|
2070
|
+
setSplideKey((prev) => prev + 1);
|
|
2020
2071
|
isClosingRef.current = false;
|
|
2021
2072
|
setIsClosing(false);
|
|
2022
2073
|
setAnimationFinished(false);
|
|
@@ -2059,7 +2110,13 @@ const Lightbox = ({ isOpen, onClose, content, lightboxStyles, settings, portalId
|
|
|
2059
2110
|
appearAnimationEndHandlerRef.current = handleAppearAnimationEnd;
|
|
2060
2111
|
animationTargetRef.current.addEventListener("animationend", handleAppearAnimationEnd);
|
|
2061
2112
|
}
|
|
2062
|
-
const preventScroll = (e) =>
|
|
2113
|
+
const preventScroll = (e) => {
|
|
2114
|
+
const target = e.target;
|
|
2115
|
+
if (target && (target.closest(`.${classes.thumbsWrapper}`) || target.closest(`.${classes.thumbsContainer}`))) {
|
|
2116
|
+
return;
|
|
2117
|
+
}
|
|
2118
|
+
e.preventDefault();
|
|
2119
|
+
};
|
|
2063
2120
|
document.addEventListener("touchmove", preventScroll, { passive: false });
|
|
2064
2121
|
return () => {
|
|
2065
2122
|
document.body.style.overflow = originalOverflow;
|
|
@@ -2078,6 +2135,10 @@ const Lightbox = ({ isOpen, onClose, content, lightboxStyles, settings, portalId
|
|
|
2078
2135
|
e.stopPropagation();
|
|
2079
2136
|
return;
|
|
2080
2137
|
}
|
|
2138
|
+
if (hasDraggedRef.current) {
|
|
2139
|
+
hasDraggedRef.current = false;
|
|
2140
|
+
return;
|
|
2141
|
+
}
|
|
2081
2142
|
const target = e.target;
|
|
2082
2143
|
if (target && (target.closest(`.${classes.thumbsContainer}`) || target.closest(`.${classes.thumbItem}`))) {
|
|
2083
2144
|
return;
|
|
@@ -2113,6 +2174,103 @@ const Lightbox = ({ isOpen, onClose, content, lightboxStyles, settings, portalId
|
|
|
2113
2174
|
document.removeEventListener("touchend", handleTouchEnd);
|
|
2114
2175
|
};
|
|
2115
2176
|
}, [isOpen, handleClose, currentIndex, content]);
|
|
2177
|
+
const needsCustomVerticalDrag = (slider.type === "scale" || slider.type === "fade") && slider.direction === "vert" && triggers.type === "drag";
|
|
2178
|
+
useEffect(() => {
|
|
2179
|
+
var _a, _b;
|
|
2180
|
+
if (!isOpen || !needsCustomVerticalDrag || !((_b = (_a = lightboxRef.current) == null ? void 0 : _a.splide) == null ? void 0 : _b.root)) return;
|
|
2181
|
+
const container = lightboxRef.current.splide.root;
|
|
2182
|
+
const DRAG_THRESHOLD = 30;
|
|
2183
|
+
const handleMove = (clientX, clientY) => {
|
|
2184
|
+
if (dragStartRef.current) {
|
|
2185
|
+
const deltaX = Math.abs(clientX - dragStartRef.current.x);
|
|
2186
|
+
const deltaY = Math.abs(clientY - dragStartRef.current.y);
|
|
2187
|
+
if (deltaX > 0 || deltaY > 0) {
|
|
2188
|
+
hasDraggedRef.current = true;
|
|
2189
|
+
}
|
|
2190
|
+
}
|
|
2191
|
+
};
|
|
2192
|
+
const handlePointerMove = (e) => {
|
|
2193
|
+
if (dragStartRef.current) {
|
|
2194
|
+
e.preventDefault();
|
|
2195
|
+
handleMove(e.clientX, e.clientY);
|
|
2196
|
+
}
|
|
2197
|
+
};
|
|
2198
|
+
const handleTouchMove = (e) => {
|
|
2199
|
+
if (dragStartRef.current && e.touches.length > 0) {
|
|
2200
|
+
e.preventDefault();
|
|
2201
|
+
handleMove(e.touches[0].clientX, e.touches[0].clientY);
|
|
2202
|
+
}
|
|
2203
|
+
};
|
|
2204
|
+
const handleUp = (clientX, clientY) => {
|
|
2205
|
+
if (!dragStartRef.current || !lightboxRef.current) {
|
|
2206
|
+
dragStartRef.current = null;
|
|
2207
|
+
return;
|
|
2208
|
+
}
|
|
2209
|
+
const deltaX = Math.abs(clientX - dragStartRef.current.x);
|
|
2210
|
+
const deltaY = Math.abs(clientY - dragStartRef.current.y);
|
|
2211
|
+
if (deltaY > DRAG_THRESHOLD && deltaY > deltaX) {
|
|
2212
|
+
lightboxRef.current.go(clientY < dragStartRef.current.y ? "+1" : "-1");
|
|
2213
|
+
}
|
|
2214
|
+
dragStartRef.current = null;
|
|
2215
|
+
};
|
|
2216
|
+
const handlePointerUp = (e) => {
|
|
2217
|
+
if (!dragStartRef.current) {
|
|
2218
|
+
document.removeEventListener("pointerup", handlePointerUp);
|
|
2219
|
+
document.removeEventListener("pointercancel", handlePointerUp);
|
|
2220
|
+
document.removeEventListener("pointermove", handlePointerMove);
|
|
2221
|
+
return;
|
|
2222
|
+
}
|
|
2223
|
+
handleUp(e.clientX, e.clientY);
|
|
2224
|
+
document.removeEventListener("pointerup", handlePointerUp);
|
|
2225
|
+
document.removeEventListener("pointercancel", handlePointerUp);
|
|
2226
|
+
document.removeEventListener("pointermove", handlePointerMove);
|
|
2227
|
+
};
|
|
2228
|
+
const handleTouchEnd = (e) => {
|
|
2229
|
+
if (!dragStartRef.current) {
|
|
2230
|
+
document.removeEventListener("touchend", handleTouchEnd);
|
|
2231
|
+
document.removeEventListener("touchcancel", handleTouchEnd);
|
|
2232
|
+
document.removeEventListener("touchmove", handleTouchMove);
|
|
2233
|
+
return;
|
|
2234
|
+
}
|
|
2235
|
+
if (e.changedTouches.length > 0) {
|
|
2236
|
+
const touch = e.changedTouches[0];
|
|
2237
|
+
handleUp(touch.clientX, touch.clientY);
|
|
2238
|
+
}
|
|
2239
|
+
document.removeEventListener("touchend", handleTouchEnd);
|
|
2240
|
+
document.removeEventListener("touchcancel", handleTouchEnd);
|
|
2241
|
+
document.removeEventListener("touchmove", handleTouchMove);
|
|
2242
|
+
};
|
|
2243
|
+
const handlePointerDown = (e) => {
|
|
2244
|
+
dragStartRef.current = { x: e.clientX, y: e.clientY };
|
|
2245
|
+
hasDraggedRef.current = false;
|
|
2246
|
+
document.addEventListener("pointermove", handlePointerMove, { passive: false });
|
|
2247
|
+
document.addEventListener("pointerup", handlePointerUp);
|
|
2248
|
+
document.addEventListener("pointercancel", handlePointerUp);
|
|
2249
|
+
};
|
|
2250
|
+
const handleTouchStart = (e) => {
|
|
2251
|
+
if (e.touches.length > 0) {
|
|
2252
|
+
dragStartRef.current = { x: e.touches[0].clientX, y: e.touches[0].clientY };
|
|
2253
|
+
hasDraggedRef.current = false;
|
|
2254
|
+
document.addEventListener("touchmove", handleTouchMove, { passive: false });
|
|
2255
|
+
document.addEventListener("touchend", handleTouchEnd);
|
|
2256
|
+
document.addEventListener("touchcancel", handleTouchEnd);
|
|
2257
|
+
}
|
|
2258
|
+
};
|
|
2259
|
+
container.addEventListener("pointerdown", handlePointerDown);
|
|
2260
|
+
container.addEventListener("touchstart", handleTouchStart);
|
|
2261
|
+
return () => {
|
|
2262
|
+
container.removeEventListener("pointerdown", handlePointerDown);
|
|
2263
|
+
container.removeEventListener("touchstart", handleTouchStart);
|
|
2264
|
+
document.removeEventListener("pointermove", handlePointerMove);
|
|
2265
|
+
document.removeEventListener("pointerup", handlePointerUp);
|
|
2266
|
+
document.removeEventListener("pointercancel", handlePointerUp);
|
|
2267
|
+
document.removeEventListener("touchmove", handleTouchMove);
|
|
2268
|
+
document.removeEventListener("touchend", handleTouchEnd);
|
|
2269
|
+
document.removeEventListener("touchcancel", handleTouchEnd);
|
|
2270
|
+
dragStartRef.current = null;
|
|
2271
|
+
hasDraggedRef.current = false;
|
|
2272
|
+
};
|
|
2273
|
+
}, [isOpen, needsCustomVerticalDrag, splideKey]);
|
|
2116
2274
|
const backdropStyles = {
|
|
2117
2275
|
backgroundColor: area.color,
|
|
2118
2276
|
backdropFilter: `blur(${area.blur}px)`,
|
|
@@ -2120,14 +2278,14 @@ const Lightbox = ({ isOpen, onClose, content, lightboxStyles, settings, portalId
|
|
|
2120
2278
|
animationTimingFunction: "ease",
|
|
2121
2279
|
animationFillMode: "both"
|
|
2122
2280
|
};
|
|
2123
|
-
if (!
|
|
2281
|
+
if (!document.getElementById(portalId)) return null;
|
|
2124
2282
|
return createPortal(
|
|
2125
2283
|
/* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2126
2284
|
/* @__PURE__ */ jsx(
|
|
2127
2285
|
"div",
|
|
2128
2286
|
{
|
|
2129
2287
|
ref: !isEditor ? animationTargetRef : null,
|
|
2130
|
-
className: cn(classes.background, isClosing ? backdropDisappearClass : backdropAppearClass, { [classes.editor]: isEditor }),
|
|
2288
|
+
className: cn(classes.background, isClosing ? backdropDisappearClass : backdropAppearClass, { [classes.editor]: isEditor }, { [classes.hidden]: !isOpen }),
|
|
2131
2289
|
style: {
|
|
2132
2290
|
...backdropStyles,
|
|
2133
2291
|
...animationFinished && !isEditor && !isClosing ? { position: "absolute" } : {}
|
|
@@ -2138,7 +2296,7 @@ const Lightbox = ({ isOpen, onClose, content, lightboxStyles, settings, portalId
|
|
|
2138
2296
|
"div",
|
|
2139
2297
|
{
|
|
2140
2298
|
ref: isEditor ? animationTargetRef : null,
|
|
2141
|
-
className: cn(classes.contentStyle, !isClosing ? appearClass : disappearClass, { [classes.editor]: isEditor }),
|
|
2299
|
+
className: cn(classes.contentStyle, !isClosing ? appearClass : disappearClass, { [classes.editor]: isEditor }, { [classes.hidden]: !isOpen }),
|
|
2142
2300
|
style: {
|
|
2143
2301
|
animationDuration: `${parseInt(appear.duration)}ms`,
|
|
2144
2302
|
animationTimingFunction: "ease",
|
|
@@ -2154,15 +2312,20 @@ const Lightbox = ({ isOpen, onClose, content, lightboxStyles, settings, portalId
|
|
|
2154
2312
|
options: {
|
|
2155
2313
|
arrows: false,
|
|
2156
2314
|
speed: slider.duration ? parseInt(slider.duration) : 500,
|
|
2157
|
-
direction:
|
|
2315
|
+
direction: (() => {
|
|
2316
|
+
const isHoriz = slider.direction === "horiz";
|
|
2317
|
+
return isHoriz || slider.type === "fade" || slider.type === "scale" ? "ltr" : "ttb";
|
|
2318
|
+
})(),
|
|
2158
2319
|
pagination: false,
|
|
2159
|
-
drag
|
|
2320
|
+
// Disable Splide's drag when we need custom vertical drag handling
|
|
2321
|
+
drag: triggers.type === "drag" && !needsCustomVerticalDrag,
|
|
2160
2322
|
perPage: 1,
|
|
2161
2323
|
width: "100%",
|
|
2162
2324
|
height: "100%",
|
|
2163
2325
|
type: slider.type === "fade" || slider.type === "scale" ? "fade" : "loop",
|
|
2164
2326
|
padding: 0,
|
|
2165
|
-
rewind: (slider.type === "scale" || slider.type === "fade") && triggers.repeat === "loop"
|
|
2327
|
+
rewind: (slider.type === "scale" || slider.type === "fade") && triggers.repeat === "loop",
|
|
2328
|
+
start: 0
|
|
2166
2329
|
},
|
|
2167
2330
|
style: { "--splide-speed": slider.duration },
|
|
2168
2331
|
children: content.map((item, index) => {
|
|
@@ -2197,13 +2360,13 @@ const Lightbox = ({ isOpen, onClose, content, lightboxStyles, settings, portalId
|
|
|
2197
2360
|
},
|
|
2198
2361
|
splideKey
|
|
2199
2362
|
),
|
|
2200
|
-
controls.isActive &&
|
|
2363
|
+
controls.isActive && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2201
2364
|
/* @__PURE__ */ jsx(
|
|
2202
2365
|
"div",
|
|
2203
2366
|
{
|
|
2204
2367
|
className: cn(classes.arrow, { [classes.arrowVertical]: slider.direction === "vert" }),
|
|
2205
2368
|
style: { color: controls.color, ["--arrow-hover-color"]: controls.hover },
|
|
2206
|
-
children: /* @__PURE__ */
|
|
2369
|
+
children: /* @__PURE__ */ jsxs(
|
|
2207
2370
|
"button",
|
|
2208
2371
|
{
|
|
2209
2372
|
className: classes.arrowInner,
|
|
@@ -2213,15 +2376,18 @@ const Lightbox = ({ isOpen, onClose, content, lightboxStyles, settings, portalId
|
|
|
2213
2376
|
return (_a = lightboxRef.current) == null ? void 0 : _a.go("-1");
|
|
2214
2377
|
},
|
|
2215
2378
|
"aria-label": "Previous",
|
|
2216
|
-
children:
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2379
|
+
children: [
|
|
2380
|
+
controls.arrowsImgUrl && /* @__PURE__ */ jsx(
|
|
2381
|
+
SvgImage,
|
|
2382
|
+
{
|
|
2383
|
+
url: controls.arrowsImgUrl,
|
|
2384
|
+
fill: controls.color,
|
|
2385
|
+
hoverFill: controls.hover,
|
|
2386
|
+
className: cn(classes.arrowImg, classes.mirror)
|
|
2387
|
+
}
|
|
2388
|
+
),
|
|
2389
|
+
!controls.arrowsImgUrl && /* @__PURE__ */ jsx(ArrowIcon, { color: controls.color, className: cn(classes.arrowIcon, classes.arrowImg, classes.mirror) })
|
|
2390
|
+
]
|
|
2225
2391
|
}
|
|
2226
2392
|
)
|
|
2227
2393
|
}
|
|
@@ -2231,7 +2397,7 @@ const Lightbox = ({ isOpen, onClose, content, lightboxStyles, settings, portalId
|
|
|
2231
2397
|
{
|
|
2232
2398
|
className: cn(classes.arrow, classes.nextArrow, { [classes.arrowVertical]: slider.direction === "vert" }),
|
|
2233
2399
|
style: { color: controls.color, ["--arrow-hover-color"]: controls.hover },
|
|
2234
|
-
children: /* @__PURE__ */
|
|
2400
|
+
children: /* @__PURE__ */ jsxs(
|
|
2235
2401
|
"button",
|
|
2236
2402
|
{
|
|
2237
2403
|
className: classes.arrowInner,
|
|
@@ -2241,15 +2407,18 @@ const Lightbox = ({ isOpen, onClose, content, lightboxStyles, settings, portalId
|
|
|
2241
2407
|
return (_a = lightboxRef.current) == null ? void 0 : _a.go("+1");
|
|
2242
2408
|
},
|
|
2243
2409
|
"aria-label": "Next",
|
|
2244
|
-
children:
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2410
|
+
children: [
|
|
2411
|
+
controls.arrowsImgUrl && /* @__PURE__ */ jsx(
|
|
2412
|
+
SvgImage,
|
|
2413
|
+
{
|
|
2414
|
+
url: controls.arrowsImgUrl,
|
|
2415
|
+
fill: controls.color,
|
|
2416
|
+
hoverFill: controls.hover,
|
|
2417
|
+
className: classes.arrowImg
|
|
2418
|
+
}
|
|
2419
|
+
),
|
|
2420
|
+
!controls.arrowsImgUrl && /* @__PURE__ */ jsx(ArrowIcon, { color: controls.color, className: cn(classes.arrowIcon, classes.arrowImg) })
|
|
2421
|
+
]
|
|
2253
2422
|
}
|
|
2254
2423
|
)
|
|
2255
2424
|
}
|
|
@@ -2259,130 +2428,177 @@ const Lightbox = ({ isOpen, onClose, content, lightboxStyles, settings, portalId
|
|
|
2259
2428
|
const positionStyles = getPositionStyles(area.closeIconAlign, area.closeIconOffset, isEditor);
|
|
2260
2429
|
const scaleTransform = `scale(${area.closeIconScale})`;
|
|
2261
2430
|
const combinedTransform = positionStyles.transform ? `${positionStyles.transform} ${scaleTransform}` : scaleTransform;
|
|
2262
|
-
return /* @__PURE__ */ jsx("button", { className: classes.closeButton, style: { ...positionStyles, transform: combinedTransform }, onClick: handleClose, "aria-label": "Close lightbox", children: /* @__PURE__ */ jsx(SvgImage, { url: area.closeIconUrl }) });
|
|
2431
|
+
return /* @__PURE__ */ jsx("button", { className: classes.closeButton, style: { ...positionStyles, transform: combinedTransform }, onClick: handleClose, "aria-label": "Close lightbox", children: /* @__PURE__ */ jsx(SvgImage, { url: area.closeIconUrl, fill: area.closeIconColor ?? "#000000", hoverFill: area.closeIconHover ?? "#cccccc" }) });
|
|
2263
2432
|
})(),
|
|
2264
|
-
imageCaption.isActive &&
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
"
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
}
|
|
2295
|
-
),
|
|
2296
|
-
thumbnail.isActive && /* @__PURE__ */ jsx(
|
|
2297
|
-
"div",
|
|
2298
|
-
{
|
|
2299
|
-
className: cn(classes.thumbsContainer, {
|
|
2300
|
-
[classes.thumbsContainerVertical]: slider.direction === "vert",
|
|
2301
|
-
[classes.thumbsAlignStart]: thumbnail.align === "start",
|
|
2302
|
-
[classes.thumbsAlignCenter]: thumbnail.align === "center",
|
|
2303
|
-
[classes.thumbsAlignEnd]: thumbnail.align === "end"
|
|
2304
|
-
}),
|
|
2305
|
-
style: {
|
|
2306
|
-
position: isEditor ? "absolute" : "fixed",
|
|
2307
|
-
gap: scalingValue(thumbnail.grid.gap, isEditor),
|
|
2308
|
-
...getPositionStyles(thumbnail.position, thumbnail.offset, isEditor)
|
|
2309
|
-
},
|
|
2310
|
-
children: content.map((item, index) => {
|
|
2311
|
-
const isActive = index === currentIndex;
|
|
2312
|
-
const thumbDims = thumbnailDimensions[index];
|
|
2313
|
-
const baseSizeValue = thumbnail.grid.size;
|
|
2314
|
-
const activeSizeValue = baseSizeValue * (isActive ? thumbnail.activeState.scale : 1);
|
|
2315
|
-
const getFitDimensions = () => {
|
|
2316
|
-
if (thumbnail.fit !== "fit" || !thumbDims) return {};
|
|
2317
|
-
const aspectRatio = thumbDims.width / thumbDims.height;
|
|
2318
|
-
if (slider.direction === "horiz") {
|
|
2319
|
-
const heightValue = activeSizeValue;
|
|
2320
|
-
const widthValue = heightValue * aspectRatio;
|
|
2321
|
-
return {
|
|
2322
|
-
width: scalingValue(widthValue, isEditor),
|
|
2323
|
-
height: scalingValue(heightValue, isEditor)
|
|
2324
|
-
};
|
|
2325
|
-
} else {
|
|
2326
|
-
const widthValue = activeSizeValue;
|
|
2327
|
-
const heightValue = widthValue / aspectRatio;
|
|
2328
|
-
return {
|
|
2329
|
-
width: scalingValue(widthValue, isEditor),
|
|
2330
|
-
height: scalingValue(heightValue, isEditor)
|
|
2331
|
-
};
|
|
2433
|
+
imageCaption.isActive && lightboxStyles.imageCaption && (() => {
|
|
2434
|
+
const { widthSettings, fontSettings, letterSpacing, textAlign, wordSpacing, fontSizeLineHeight, textAppearance, color } = lightboxStyles.imageCaption;
|
|
2435
|
+
return /* @__PURE__ */ jsx(
|
|
2436
|
+
"div",
|
|
2437
|
+
{
|
|
2438
|
+
className: classes.caption,
|
|
2439
|
+
style: {
|
|
2440
|
+
...getPositionStyles(imageCaption.alignment, imageCaption.offset, isEditor),
|
|
2441
|
+
fontFamily: fontSettings.fontFamily,
|
|
2442
|
+
fontWeight: fontSettings.fontWeight,
|
|
2443
|
+
fontStyle: fontSettings.fontStyle,
|
|
2444
|
+
width: widthSettings.sizing === "auto" ? "max-content" : scalingValue(widthSettings.width, isEditor),
|
|
2445
|
+
letterSpacing: scalingValue(letterSpacing, isEditor),
|
|
2446
|
+
wordSpacing: scalingValue(wordSpacing, isEditor),
|
|
2447
|
+
textAlign,
|
|
2448
|
+
fontSize: scalingValue(fontSizeLineHeight.fontSize, isEditor),
|
|
2449
|
+
lineHeight: scalingValue(fontSizeLineHeight.lineHeight, isEditor),
|
|
2450
|
+
textTransform: textAppearance.textTransform ?? "none",
|
|
2451
|
+
textDecoration: textAppearance.textDecoration ?? "none",
|
|
2452
|
+
fontVariant: textAppearance.fontVariant ?? "normal",
|
|
2453
|
+
color
|
|
2454
|
+
},
|
|
2455
|
+
onClick: (e) => e.stopPropagation(),
|
|
2456
|
+
children: /* @__PURE__ */ jsx(
|
|
2457
|
+
"div",
|
|
2458
|
+
{
|
|
2459
|
+
"data-styles": "caption",
|
|
2460
|
+
className: classes.captionTextInner,
|
|
2461
|
+
style: { ["--link-hover-color"]: imageCaption.hover },
|
|
2462
|
+
children: /* @__PURE__ */ jsx(RichTextRenderer, { content: content[currentIndex].imageCaption })
|
|
2332
2463
|
}
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2464
|
+
)
|
|
2465
|
+
}
|
|
2466
|
+
);
|
|
2467
|
+
})(),
|
|
2468
|
+
thumbnail.isActive && (() => {
|
|
2469
|
+
const [vertical, horizontal] = thumbnail.position.split("-");
|
|
2470
|
+
const effectivePosition = slider.direction === "horiz" ? `${vertical}-left` : thumbnail.position;
|
|
2471
|
+
const thumbsPositionStyles = getPositionStyles(effectivePosition, thumbnail.offset, isEditor);
|
|
2472
|
+
const getJustifyContent = () => {
|
|
2473
|
+
if (slider.direction === "horiz") {
|
|
2474
|
+
if (horizontal === "left") return "flex-start";
|
|
2475
|
+
if (horizontal === "center") return "center";
|
|
2476
|
+
if (horizontal === "right") return "flex-end";
|
|
2477
|
+
} else {
|
|
2478
|
+
if (vertical === "top") return "flex-start";
|
|
2479
|
+
if (vertical === "middle") return "center";
|
|
2480
|
+
if (vertical === "bottom") return "flex-end";
|
|
2481
|
+
}
|
|
2482
|
+
return "flex-start";
|
|
2483
|
+
};
|
|
2484
|
+
return /* @__PURE__ */ jsx(
|
|
2485
|
+
"div",
|
|
2486
|
+
{
|
|
2487
|
+
className: classes.thumbsWrapper,
|
|
2488
|
+
onClick: (e) => handleThumbWrapperClick(e),
|
|
2489
|
+
style: {
|
|
2490
|
+
position: isEditor ? "absolute" : "fixed",
|
|
2491
|
+
...thumbsPositionStyles,
|
|
2492
|
+
...slider.direction === "horiz" ? {
|
|
2493
|
+
maxWidth: "100vw",
|
|
2494
|
+
width: "100vw",
|
|
2495
|
+
overflowX: "auto",
|
|
2496
|
+
overflowY: "hidden"
|
|
2497
|
+
} : {
|
|
2498
|
+
maxHeight: "100vh",
|
|
2499
|
+
overflowY: "auto",
|
|
2500
|
+
overflowX: "hidden"
|
|
2501
|
+
}
|
|
2502
|
+
},
|
|
2503
|
+
children: /* @__PURE__ */ jsx(
|
|
2504
|
+
"div",
|
|
2336
2505
|
{
|
|
2337
|
-
className: classes.
|
|
2506
|
+
className: cn(classes.thumbsContainer, {
|
|
2507
|
+
[classes.thumbsContainerVertical]: slider.direction === "vert",
|
|
2508
|
+
[classes.thumbsAlignStart]: thumbnail.align === "start",
|
|
2509
|
+
[classes.thumbsAlignCenter]: thumbnail.align === "center",
|
|
2510
|
+
[classes.thumbsAlignEnd]: thumbnail.align === "end"
|
|
2511
|
+
}),
|
|
2338
2512
|
style: {
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
...thumbnail.fit === "cover" ? { width: scalingValue(activeSizeValue, isEditor), height: scalingValue(activeSizeValue, isEditor) } : {},
|
|
2342
|
-
...thumbnail.fit === "fit" ? getFitDimensions() : {},
|
|
2343
|
-
transition: isActive ? "all 0.2s ease" : "none",
|
|
2344
|
-
opacity: isActive ? thumbnail.activeState.opacity / 100 : thumbnail.opacity / 100,
|
|
2345
|
-
["--thumb-hover"]: thumbnail.activeState.opacity / 100
|
|
2346
|
-
},
|
|
2347
|
-
onClick: (e) => {
|
|
2348
|
-
var _a;
|
|
2349
|
-
e.stopPropagation();
|
|
2350
|
-
setCurrentIndex(index);
|
|
2351
|
-
(_a = lightboxRef.current) == null ? void 0 : _a.go(index);
|
|
2513
|
+
gap: scalingValue(thumbnail.grid.gap, isEditor),
|
|
2514
|
+
justifyContent: getJustifyContent()
|
|
2352
2515
|
},
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
const img2 = e.currentTarget;
|
|
2366
|
-
if (img2.naturalWidth && img2.naturalHeight) {
|
|
2367
|
-
setThumbnailDimensions((prev) => ({
|
|
2368
|
-
...prev,
|
|
2369
|
-
[index]: { width: img2.naturalWidth, height: img2.naturalHeight }
|
|
2370
|
-
}));
|
|
2516
|
+
children: content.map((item, index) => {
|
|
2517
|
+
const isActive = index === currentIndex;
|
|
2518
|
+
const thumbDims = thumbnailDimensions[index];
|
|
2519
|
+
const baseSizeValue = thumbnail.grid.size;
|
|
2520
|
+
const activeSizeValue = baseSizeValue * (isActive ? thumbnail.activeState.scale : 1);
|
|
2521
|
+
const getFitDimensions = () => {
|
|
2522
|
+
if (thumbnail.fit !== "fit") return {};
|
|
2523
|
+
if (!thumbDims) {
|
|
2524
|
+
if (slider.direction === "horiz") {
|
|
2525
|
+
return { height: scalingValue(activeSizeValue, isEditor) };
|
|
2526
|
+
} else {
|
|
2527
|
+
return { width: scalingValue(activeSizeValue, isEditor) };
|
|
2371
2528
|
}
|
|
2372
|
-
},
|
|
2373
|
-
style: {
|
|
2374
|
-
objectFit: thumbnail.fit === "cover" ? "cover" : "contain",
|
|
2375
|
-
...thumbnail.fit === "fit" ? { maxWidth: "100%", maxHeight: "100%", objectFit: "contain" } : {},
|
|
2376
|
-
...thumbnail.fit === "cover" && slider.direction === "horiz" ? { width: "100%", height: "100%" } : {}
|
|
2377
2529
|
}
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2530
|
+
const aspectRatio = thumbDims.width / thumbDims.height;
|
|
2531
|
+
if (slider.direction === "horiz") {
|
|
2532
|
+
const heightValue = activeSizeValue;
|
|
2533
|
+
const widthValue = heightValue * aspectRatio;
|
|
2534
|
+
return {
|
|
2535
|
+
width: scalingValue(widthValue, isEditor),
|
|
2536
|
+
height: scalingValue(heightValue, isEditor)
|
|
2537
|
+
};
|
|
2538
|
+
} else {
|
|
2539
|
+
const widthValue = activeSizeValue;
|
|
2540
|
+
const heightValue = widthValue / aspectRatio;
|
|
2541
|
+
return {
|
|
2542
|
+
width: scalingValue(widthValue, isEditor),
|
|
2543
|
+
height: scalingValue(heightValue, isEditor)
|
|
2544
|
+
};
|
|
2545
|
+
}
|
|
2546
|
+
};
|
|
2547
|
+
return /* @__PURE__ */ jsx(
|
|
2548
|
+
"button",
|
|
2549
|
+
{
|
|
2550
|
+
className: classes.thumbItem,
|
|
2551
|
+
style: {
|
|
2552
|
+
...slider.direction === "horiz" && thumbnail.fit !== "fit" ? { height: scalingValue(activeSizeValue, isEditor) } : {},
|
|
2553
|
+
...slider.direction === "vert" && thumbnail.fit !== "fit" ? { width: scalingValue(activeSizeValue, isEditor) } : {},
|
|
2554
|
+
...thumbnail.fit === "cover" ? { width: scalingValue(activeSizeValue, isEditor), height: scalingValue(activeSizeValue, isEditor) } : {},
|
|
2555
|
+
...getFitDimensions(),
|
|
2556
|
+
transition: isActive ? "all 0.25s ease-out" : "none",
|
|
2557
|
+
opacity: isActive ? thumbnail.activeState.opacity / 100 : thumbnail.opacity / 100,
|
|
2558
|
+
["--thumb-hover"]: thumbnail.activeState.opacity / 100
|
|
2559
|
+
},
|
|
2560
|
+
onClick: (e) => {
|
|
2561
|
+
var _a;
|
|
2562
|
+
e.stopPropagation();
|
|
2563
|
+
setCurrentIndex(index);
|
|
2564
|
+
(_a = lightboxRef.current) == null ? void 0 : _a.go(index);
|
|
2565
|
+
},
|
|
2566
|
+
onMouseEnter: () => {
|
|
2567
|
+
var _a;
|
|
2568
|
+
if (thumbnail.triggers === "hov") {
|
|
2569
|
+
(_a = lightboxRef.current) == null ? void 0 : _a.go(index);
|
|
2570
|
+
}
|
|
2571
|
+
},
|
|
2572
|
+
children: /* @__PURE__ */ jsx(
|
|
2573
|
+
"img",
|
|
2574
|
+
{
|
|
2575
|
+
src: item.image.url,
|
|
2576
|
+
alt: item.image.name ?? "",
|
|
2577
|
+
onLoad: (e) => {
|
|
2578
|
+
const img2 = e.currentTarget;
|
|
2579
|
+
if (img2.naturalWidth && img2.naturalHeight) {
|
|
2580
|
+
setThumbnailDimensions((prev) => ({
|
|
2581
|
+
...prev,
|
|
2582
|
+
[index]: { width: img2.naturalWidth, height: img2.naturalHeight }
|
|
2583
|
+
}));
|
|
2584
|
+
}
|
|
2585
|
+
},
|
|
2586
|
+
style: {
|
|
2587
|
+
objectFit: thumbnail.fit === "cover" ? "cover" : "contain",
|
|
2588
|
+
...thumbnail.fit === "fit" ? { maxWidth: "100%", maxHeight: "100%", objectFit: "contain" } : {},
|
|
2589
|
+
...thumbnail.fit === "cover" ? { width: "100%", height: "100%" } : {}
|
|
2590
|
+
}
|
|
2591
|
+
}
|
|
2592
|
+
)
|
|
2593
|
+
},
|
|
2594
|
+
`${item.image.name}-${index}`
|
|
2595
|
+
);
|
|
2596
|
+
})
|
|
2597
|
+
}
|
|
2598
|
+
)
|
|
2599
|
+
}
|
|
2600
|
+
);
|
|
2601
|
+
})()
|
|
2386
2602
|
]
|
|
2387
2603
|
}
|
|
2388
2604
|
)
|
|
@@ -2390,6 +2606,9 @@ const Lightbox = ({ isOpen, onClose, content, lightboxStyles, settings, portalId
|
|
|
2390
2606
|
document.getElementById(portalId)
|
|
2391
2607
|
);
|
|
2392
2608
|
};
|
|
2609
|
+
function ArrowIcon({ color, className }) {
|
|
2610
|
+
return /* @__PURE__ */ jsx("svg", { viewBox: "0 0 10 18", className, children: /* @__PURE__ */ jsx("g", { id: "Symbols", stroke: "none", strokeWidth: "1", fillRule: "evenodd", children: /* @__PURE__ */ 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)" }) }) });
|
|
2611
|
+
}
|
|
2393
2612
|
const LightboxComponent = {
|
|
2394
2613
|
element: LightboxGallery,
|
|
2395
2614
|
id: "lightbox",
|
|
@@ -2887,6 +3106,22 @@ const LightboxComponent = {
|
|
|
2887
3106
|
}
|
|
2888
3107
|
}
|
|
2889
3108
|
}
|
|
3109
|
+
},
|
|
3110
|
+
closeIconColor: {
|
|
3111
|
+
title: "Color",
|
|
3112
|
+
type: "string",
|
|
3113
|
+
display: {
|
|
3114
|
+
type: "settings-color-picker",
|
|
3115
|
+
format: "single"
|
|
3116
|
+
}
|
|
3117
|
+
},
|
|
3118
|
+
closeIconHover: {
|
|
3119
|
+
title: "Hover",
|
|
3120
|
+
type: "string",
|
|
3121
|
+
display: {
|
|
3122
|
+
type: "settings-color-picker",
|
|
3123
|
+
format: "single"
|
|
3124
|
+
}
|
|
2890
3125
|
}
|
|
2891
3126
|
}
|
|
2892
3127
|
},
|
|
@@ -2995,7 +3230,7 @@ const LightboxComponent = {
|
|
|
2995
3230
|
padding: { top: 0.06, right: 0, bottom: 0.06, left: 0 }
|
|
2996
3231
|
},
|
|
2997
3232
|
controls: {
|
|
2998
|
-
isActive:
|
|
3233
|
+
isActive: false,
|
|
2999
3234
|
arrowsImgUrl: null,
|
|
3000
3235
|
offset: { x: 0, y: 0 },
|
|
3001
3236
|
scale: 1,
|
|
@@ -3006,6 +3241,8 @@ const LightboxComponent = {
|
|
|
3006
3241
|
color: "rgba(28,31,34,0.9)",
|
|
3007
3242
|
blur: 0,
|
|
3008
3243
|
closeIconUrl: null,
|
|
3244
|
+
closeIconColor: "#000000",
|
|
3245
|
+
closeIconHover: "#cccccc",
|
|
3009
3246
|
closeIconAlign: "top-right",
|
|
3010
3247
|
closeIconOffset: { x: 0, y: 0 },
|
|
3011
3248
|
closeIconScale: 1
|
|
@@ -3063,7 +3300,7 @@ const LightboxComponent = {
|
|
|
3063
3300
|
padding: { top: 0.06, right: 0.05, bottom: 0.06, left: 0.05 }
|
|
3064
3301
|
},
|
|
3065
3302
|
controls: {
|
|
3066
|
-
isActive:
|
|
3303
|
+
isActive: false,
|
|
3067
3304
|
arrowsImgUrl: null,
|
|
3068
3305
|
offset: { x: 0, y: 0 },
|
|
3069
3306
|
scale: 1,
|
|
@@ -3074,6 +3311,8 @@ const LightboxComponent = {
|
|
|
3074
3311
|
color: "rgba(28,31,34,0.9)",
|
|
3075
3312
|
blur: 0,
|
|
3076
3313
|
closeIconUrl: null,
|
|
3314
|
+
closeIconColor: "#000000",
|
|
3315
|
+
closeIconHover: "#cccccc",
|
|
3077
3316
|
closeIconAlign: "top-right",
|
|
3078
3317
|
closeIconOffset: { x: 0, y: 0 },
|
|
3079
3318
|
closeIconScale: 1
|
|
@@ -3131,7 +3370,7 @@ const LightboxComponent = {
|
|
|
3131
3370
|
padding: { top: 0.06, right: 0.1, bottom: 0.06, left: 0.1 }
|
|
3132
3371
|
},
|
|
3133
3372
|
controls: {
|
|
3134
|
-
isActive:
|
|
3373
|
+
isActive: false,
|
|
3135
3374
|
arrowsImgUrl: null,
|
|
3136
3375
|
offset: { x: 0, y: 0 },
|
|
3137
3376
|
scale: 1,
|
|
@@ -3142,6 +3381,8 @@ const LightboxComponent = {
|
|
|
3142
3381
|
color: "rgba(28,31,34,0.9)",
|
|
3143
3382
|
blur: 0,
|
|
3144
3383
|
closeIconUrl: null,
|
|
3384
|
+
closeIconColor: "#000000",
|
|
3385
|
+
closeIconHover: "#cccccc",
|
|
3145
3386
|
closeIconAlign: "top-right",
|
|
3146
3387
|
closeIconOffset: { x: 0, y: 0 },
|
|
3147
3388
|
closeIconScale: 1
|