@cntrl-site/components 0.1.14-0 → 0.1.14-alpha.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/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { jsx, Fragment, jsxs } from "react/jsx-runtime";
2
- import React, { useState, useEffect, useRef, useCallback } from "react";
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,
@@ -169,12 +169,12 @@ const alignmentClassName = {
169
169
  };
170
170
  function ControlSlider({ settings, content, styles: sliderStyles, isEditor }) {
171
171
  const [sliderRef, setSliderRef] = useState(null);
172
- const { widthSettings, fontSettings, letterSpacing, textAlign, wordSpacing, fontSizeLineHeight, textAppearance, color } = sliderStyles.imageCaption;
172
+ const { widthSettings, fontSettings, letterSpacing, textAlign, wordSpacing, fontSizeLineHeight, textAppearance, color } = sliderStyles.caption;
173
173
  const [sliderDimensions, setSliderDimensions] = useState(void 0);
174
174
  const [wrapperRef, setWrapperRef] = useState(null);
175
175
  const [currentSlideIndex, setCurrentSlideIndex] = useState(0);
176
176
  const [key, setKey] = useState(0);
177
- const { direction, transition, controls, pagination: pagination2, imageCaption, triggers } = settings;
177
+ const { direction, transition, controls, pagination: pagination2, caption: caption2, triggers } = settings;
178
178
  const prevSliderTypeRef = useRef(transition.type);
179
179
  const { x: controlsOffsetX, y: controlsOffsetY } = settings.controls.offset;
180
180
  const handleArrowClick = (dir) => {
@@ -210,7 +210,7 @@ function ControlSlider({ settings, content, styles: sliderStyles, isEditor }) {
210
210
  backgroundColor: transition.backgroundColor && transition.type === "fade in" ? transition.backgroundColor : "transparent"
211
211
  },
212
212
  children: [
213
- settings.imageCaption.isActive && /* @__PURE__ */ jsx(
213
+ settings.caption.isActive && /* @__PURE__ */ jsx(
214
214
  "div",
215
215
  {
216
216
  className: cn(styles$3.captionBlock),
@@ -221,7 +221,7 @@ function ControlSlider({ settings, content, styles: sliderStyles, isEditor }) {
221
221
  children: content.map((item, index) => /* @__PURE__ */ jsx(
222
222
  "div",
223
223
  {
224
- className: cn(styles$3.captionText, alignmentClassName[imageCaption.alignment], {
224
+ className: cn(styles$3.captionText, alignmentClassName[caption2.alignment], {
225
225
  [styles$3.withPointerEvents]: index === currentSlideIndex && isEditor,
226
226
  [styles$3.active]: index === currentSlideIndex
227
227
  }),
@@ -244,13 +244,13 @@ function ControlSlider({ settings, content, styles: sliderStyles, isEditor }) {
244
244
  children: /* @__PURE__ */ jsx(
245
245
  "div",
246
246
  {
247
- "data-styles": "imageCaption",
247
+ "data-styles": "caption",
248
248
  className: styles$3.captionTextInner,
249
249
  style: {
250
- "--link-hover-color": imageCaption.hover,
250
+ "--link-hover-color": caption2.hover,
251
251
  position: "relative",
252
- top: scalingValue(imageCaption.offset.y, isEditor),
253
- left: scalingValue(imageCaption.offset.x, isEditor)
252
+ top: scalingValue(caption2.offset.y, isEditor),
253
+ left: scalingValue(caption2.offset.x, isEditor)
254
254
  },
255
255
  children: /* @__PURE__ */ jsx(RichTextRenderer, { content: item.imageCaption })
256
256
  }
@@ -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 = {
@@ -703,7 +703,7 @@ const ControlSliderComponent = {
703
703
  }
704
704
  }
705
705
  },
706
- imageCaption: {
706
+ caption: {
707
707
  title: "Caption",
708
708
  icon: "text-icon",
709
709
  tooltip: "Caption",
@@ -797,7 +797,7 @@ const ControlSliderComponent = {
797
797
  hover: "#cccccc"
798
798
  },
799
799
  direction: "horiz",
800
- imageCaption: {
800
+ caption: {
801
801
  offset: {
802
802
  x: 0,
803
803
  y: 0
@@ -920,7 +920,7 @@ const ControlSliderComponent = {
920
920
  layoutBased: true,
921
921
  type: "object",
922
922
  properties: {
923
- imageCaption: {
923
+ caption: {
924
924
  dataName: "caption",
925
925
  type: "object",
926
926
  properties: {
@@ -1018,7 +1018,7 @@ const ControlSliderComponent = {
1018
1018
  }
1019
1019
  },
1020
1020
  default: {
1021
- imageCaption: {
1021
+ caption: {
1022
1022
  widthSettings: {
1023
1023
  width: 0.13,
1024
1024
  sizing: "auto"
@@ -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 containerW = container.width;
1727
- const containerH = container.height;
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 offsetX = (containerW - renderedW) / 2 + container.left;
1741
- const offsetY = (containerH - renderedH) / 2 + container.top;
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] = React.useState(false);
1857
+ const [open, setOpen] = useState(false);
1845
1858
  const { url } = settings.thumbnailBlock.cover;
1846
1859
  useEffect(() => {
1847
1860
  if (activeEvent === "close") {
@@ -1888,8 +1901,8 @@ 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);
1891
- const { appear, triggers, slider, thumbnail, controls, area, imageCaption, layout } = settings.lightboxBlock;
1892
- const { widthSettings, fontSettings, letterSpacing, textAlign, wordSpacing, fontSizeLineHeight, textAppearance, color } = lightboxStyles.imageCaption;
1904
+ const { appear, triggers, slider, thumbnail, controls, area, caption: caption2, layout } = settings.lightboxBlock;
1905
+ const { widthSettings, fontSettings, letterSpacing, textAlign, wordSpacing, fontSizeLineHeight, textAppearance, color } = lightboxStyles.caption;
1893
1906
  const { appearClass, backdropAppearClass, backdropDisappearClass, disappearClass } = getAnimationClasses(appear.type, appear.direction);
1894
1907
  useEffect(() => {
1895
1908
  const handleLayoutChange = () => {
@@ -1955,6 +1968,19 @@ const Lightbox = ({ isOpen, onClose, content, lightboxStyles, settings, portalId
1955
1968
  (_b = lightboxRef.current) == null ? void 0 : _b.go(dir);
1956
1969
  }
1957
1970
  };
1971
+ const isClickInImagePadding = (img2, clientX, clientY) => {
1972
+ const rect = img2.getBoundingClientRect();
1973
+ const style = window.getComputedStyle(img2);
1974
+ const paddingTop = parseFloat(style.paddingTop) || 0;
1975
+ const paddingRight = parseFloat(style.paddingRight) || 0;
1976
+ const paddingBottom = parseFloat(style.paddingBottom) || 0;
1977
+ const paddingLeft = parseFloat(style.paddingLeft) || 0;
1978
+ const contentLeft = rect.left + paddingLeft;
1979
+ const contentRight = rect.right - paddingRight;
1980
+ const contentTop = rect.top + paddingTop;
1981
+ const contentBottom = rect.bottom - paddingBottom;
1982
+ return clientX < contentLeft || clientX > contentRight || clientY < contentTop || clientY > contentBottom;
1983
+ };
1958
1984
  const handleImageWrapperClick = (e) => {
1959
1985
  const currentImage = content[currentIndex];
1960
1986
  const isCover = (currentImage == null ? void 0 : currentImage.image.objectFit) === "cover";
@@ -1972,7 +1998,16 @@ const Lightbox = ({ isOpen, onClose, content, lightboxStyles, settings, portalId
1972
1998
  let inside;
1973
1999
  if (isCover && imageRef.current) {
1974
2000
  const imgRect = imageRef.current.getBoundingClientRect();
1975
- inside = clientX >= imgRect.left && clientX <= imgRect.right && clientY >= imgRect.top && clientY <= imgRect.bottom;
2001
+ const style = window.getComputedStyle(imageRef.current);
2002
+ const paddingTop = parseFloat(style.paddingTop) || 0;
2003
+ const paddingRight = parseFloat(style.paddingRight) || 0;
2004
+ const paddingBottom = parseFloat(style.paddingBottom) || 0;
2005
+ const paddingLeft = parseFloat(style.paddingLeft) || 0;
2006
+ const contentLeft = imgRect.left + paddingLeft;
2007
+ const contentRight = imgRect.right - paddingRight;
2008
+ const contentTop = imgRect.top + paddingTop;
2009
+ const contentBottom = imgRect.bottom - paddingBottom;
2010
+ inside = clientX >= contentLeft && clientX <= contentRight && clientY >= contentTop && clientY <= contentBottom;
1976
2011
  } else {
1977
2012
  const rect = imageRef.current ? getDisplayedImageRect(imageRef.current) : null;
1978
2013
  if (!rect) {
@@ -1989,6 +2024,10 @@ const Lightbox = ({ isOpen, onClose, content, lightboxStyles, settings, portalId
1989
2024
  };
1990
2025
  const onImageClick = (e) => {
1991
2026
  e.stopPropagation();
2027
+ if (isClickInImagePadding(e.currentTarget, e.clientX, e.clientY)) {
2028
+ handleClose();
2029
+ return;
2030
+ }
1992
2031
  handleTriggerClick(e.currentTarget, e.clientX, e.clientY);
1993
2032
  };
1994
2033
  useEffect(() => {
@@ -2017,6 +2056,7 @@ const Lightbox = ({ isOpen, onClose, content, lightboxStyles, settings, portalId
2017
2056
  useEffect(() => {
2018
2057
  if (isOpen) {
2019
2058
  setCurrentIndex(0);
2059
+ setSplideKey((prev) => prev + 1);
2020
2060
  isClosingRef.current = false;
2021
2061
  setIsClosing(false);
2022
2062
  setAnimationFinished(false);
@@ -2120,14 +2160,14 @@ const Lightbox = ({ isOpen, onClose, content, lightboxStyles, settings, portalId
2120
2160
  animationTimingFunction: "ease",
2121
2161
  animationFillMode: "both"
2122
2162
  };
2123
- if (!isOpen && !isClosing) return null;
2163
+ if (!document.getElementById(portalId)) return null;
2124
2164
  return createPortal(
2125
2165
  /* @__PURE__ */ jsxs(Fragment, { children: [
2126
2166
  /* @__PURE__ */ jsx(
2127
2167
  "div",
2128
2168
  {
2129
2169
  ref: !isEditor ? animationTargetRef : null,
2130
- className: cn(classes.background, isClosing ? backdropDisappearClass : backdropAppearClass, { [classes.editor]: isEditor }),
2170
+ className: cn(classes.background, isClosing ? backdropDisappearClass : backdropAppearClass, { [classes.editor]: isEditor }, { [classes.hidden]: !isOpen }),
2131
2171
  style: {
2132
2172
  ...backdropStyles,
2133
2173
  ...animationFinished && !isEditor && !isClosing ? { position: "absolute" } : {}
@@ -2138,7 +2178,7 @@ const Lightbox = ({ isOpen, onClose, content, lightboxStyles, settings, portalId
2138
2178
  "div",
2139
2179
  {
2140
2180
  ref: isEditor ? animationTargetRef : null,
2141
- className: cn(classes.contentStyle, !isClosing ? appearClass : disappearClass, { [classes.editor]: isEditor }),
2181
+ className: cn(classes.contentStyle, !isClosing ? appearClass : disappearClass, { [classes.editor]: isEditor }, { [classes.hidden]: !isOpen }),
2142
2182
  style: {
2143
2183
  animationDuration: `${parseInt(appear.duration)}ms`,
2144
2184
  animationTimingFunction: "ease",
@@ -2162,7 +2202,8 @@ const Lightbox = ({ isOpen, onClose, content, lightboxStyles, settings, portalId
2162
2202
  height: "100%",
2163
2203
  type: slider.type === "fade" || slider.type === "scale" ? "fade" : "loop",
2164
2204
  padding: 0,
2165
- rewind: (slider.type === "scale" || slider.type === "fade") && triggers.repeat === "loop"
2205
+ rewind: (slider.type === "scale" || slider.type === "fade") && triggers.repeat === "loop",
2206
+ start: 0
2166
2207
  },
2167
2208
  style: { "--splide-speed": slider.duration },
2168
2209
  children: content.map((item, index) => {
@@ -2197,13 +2238,13 @@ const Lightbox = ({ isOpen, onClose, content, lightboxStyles, settings, portalId
2197
2238
  },
2198
2239
  splideKey
2199
2240
  ),
2200
- controls.isActive && controls.arrowsImgUrl && /* @__PURE__ */ jsxs(Fragment, { children: [
2241
+ controls.isActive && /* @__PURE__ */ jsxs(Fragment, { children: [
2201
2242
  /* @__PURE__ */ jsx(
2202
2243
  "div",
2203
2244
  {
2204
2245
  className: cn(classes.arrow, { [classes.arrowVertical]: slider.direction === "vert" }),
2205
2246
  style: { color: controls.color, ["--arrow-hover-color"]: controls.hover },
2206
- children: /* @__PURE__ */ jsx(
2247
+ children: /* @__PURE__ */ jsxs(
2207
2248
  "button",
2208
2249
  {
2209
2250
  className: classes.arrowInner,
@@ -2213,15 +2254,18 @@ const Lightbox = ({ isOpen, onClose, content, lightboxStyles, settings, portalId
2213
2254
  return (_a = lightboxRef.current) == null ? void 0 : _a.go("-1");
2214
2255
  },
2215
2256
  "aria-label": "Previous",
2216
- children: controls.arrowsImgUrl && /* @__PURE__ */ jsx(
2217
- SvgImage,
2218
- {
2219
- url: controls.arrowsImgUrl,
2220
- fill: controls.color,
2221
- hoverFill: controls.hover,
2222
- className: cn(classes.arrowImg, classes.mirror)
2223
- }
2224
- )
2257
+ children: [
2258
+ controls.arrowsImgUrl && /* @__PURE__ */ jsx(
2259
+ SvgImage,
2260
+ {
2261
+ url: controls.arrowsImgUrl,
2262
+ fill: controls.color,
2263
+ hoverFill: controls.hover,
2264
+ className: cn(classes.arrowImg, classes.mirror)
2265
+ }
2266
+ ),
2267
+ !controls.arrowsImgUrl && /* @__PURE__ */ jsx(ArrowIcon, { color: controls.color, className: cn(classes.arrowIcon, classes.arrowImg, classes.mirror) })
2268
+ ]
2225
2269
  }
2226
2270
  )
2227
2271
  }
@@ -2231,7 +2275,7 @@ const Lightbox = ({ isOpen, onClose, content, lightboxStyles, settings, portalId
2231
2275
  {
2232
2276
  className: cn(classes.arrow, classes.nextArrow, { [classes.arrowVertical]: slider.direction === "vert" }),
2233
2277
  style: { color: controls.color, ["--arrow-hover-color"]: controls.hover },
2234
- children: /* @__PURE__ */ jsx(
2278
+ children: /* @__PURE__ */ jsxs(
2235
2279
  "button",
2236
2280
  {
2237
2281
  className: classes.arrowInner,
@@ -2241,15 +2285,18 @@ const Lightbox = ({ isOpen, onClose, content, lightboxStyles, settings, portalId
2241
2285
  return (_a = lightboxRef.current) == null ? void 0 : _a.go("+1");
2242
2286
  },
2243
2287
  "aria-label": "Next",
2244
- children: controls.arrowsImgUrl && /* @__PURE__ */ jsx(
2245
- SvgImage,
2246
- {
2247
- url: controls.arrowsImgUrl,
2248
- fill: controls.color,
2249
- hoverFill: controls.hover,
2250
- className: classes.arrowImg
2251
- }
2252
- )
2288
+ children: [
2289
+ controls.arrowsImgUrl && /* @__PURE__ */ jsx(
2290
+ SvgImage,
2291
+ {
2292
+ url: controls.arrowsImgUrl,
2293
+ fill: controls.color,
2294
+ hoverFill: controls.hover,
2295
+ className: classes.arrowImg
2296
+ }
2297
+ ),
2298
+ !controls.arrowsImgUrl && /* @__PURE__ */ jsx(ArrowIcon, { color: controls.color, className: cn(classes.arrowIcon, classes.arrowImg) })
2299
+ ]
2253
2300
  }
2254
2301
  )
2255
2302
  }
@@ -2259,14 +2306,14 @@ const Lightbox = ({ isOpen, onClose, content, lightboxStyles, settings, portalId
2259
2306
  const positionStyles = getPositionStyles(area.closeIconAlign, area.closeIconOffset, isEditor);
2260
2307
  const scaleTransform = `scale(${area.closeIconScale})`;
2261
2308
  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 }) });
2309
+ 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, hoverFill: area.closeIconHover }) });
2263
2310
  })(),
2264
- imageCaption.isActive && /* @__PURE__ */ jsx(
2311
+ caption2.isActive && /* @__PURE__ */ jsx(
2265
2312
  "div",
2266
2313
  {
2267
2314
  className: classes.caption,
2268
2315
  style: {
2269
- ...getPositionStyles(imageCaption.alignment, imageCaption.offset, isEditor),
2316
+ ...getPositionStyles(caption2.alignment, caption2.offset, isEditor),
2270
2317
  fontFamily: fontSettings.fontFamily,
2271
2318
  fontWeight: fontSettings.fontWeight,
2272
2319
  fontStyle: fontSettings.fontStyle,
@@ -2285,104 +2332,134 @@ const Lightbox = ({ isOpen, onClose, content, lightboxStyles, settings, portalId
2285
2332
  children: /* @__PURE__ */ jsx(
2286
2333
  "div",
2287
2334
  {
2288
- "data-styles": "imageCaption",
2335
+ "data-styles": "caption",
2289
2336
  className: classes.captionTextInner,
2290
- style: { ["--link-hover-color"]: imageCaption.hover },
2337
+ style: { ["--link-hover-color"]: caption2.hover },
2291
2338
  children: /* @__PURE__ */ jsx(RichTextRenderer, { content: content[currentIndex].imageCaption })
2292
2339
  }
2293
2340
  )
2294
2341
  }
2295
2342
  ),
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
- };
2343
+ thumbnail.isActive && (() => {
2344
+ const [vertical] = thumbnail.position.split("-");
2345
+ const effectivePosition = slider.direction === "horiz" ? `${vertical}-left` : thumbnail.position;
2346
+ const thumbsPositionStyles = getPositionStyles(effectivePosition, thumbnail.offset, isEditor);
2347
+ return /* @__PURE__ */ jsx(
2348
+ "div",
2349
+ {
2350
+ className: classes.thumbsWrapper,
2351
+ style: {
2352
+ position: isEditor ? "absolute" : "fixed",
2353
+ ...thumbsPositionStyles,
2354
+ ...slider.direction === "horiz" ? {
2355
+ maxWidth: "100vw",
2356
+ width: "100vw",
2357
+ overflowX: "auto",
2358
+ overflowY: "hidden"
2359
+ } : {
2360
+ maxHeight: "100vh",
2361
+ overflowY: "auto",
2362
+ overflowX: "hidden"
2332
2363
  }
2333
- };
2334
- return /* @__PURE__ */ jsx(
2335
- "button",
2364
+ },
2365
+ children: /* @__PURE__ */ jsx(
2366
+ "div",
2336
2367
  {
2337
- className: classes.thumbItem,
2368
+ className: cn(classes.thumbsContainer, {
2369
+ [classes.thumbsContainerVertical]: slider.direction === "vert",
2370
+ [classes.thumbsAlignStart]: thumbnail.align === "start",
2371
+ [classes.thumbsAlignCenter]: thumbnail.align === "center",
2372
+ [classes.thumbsAlignEnd]: thumbnail.align === "end"
2373
+ }),
2338
2374
  style: {
2339
- ...slider.direction === "horiz" && thumbnail.fit !== "fit" ? { height: scalingValue(activeSizeValue, isEditor) } : {},
2340
- ...slider.direction === "vert" && thumbnail.fit !== "fit" ? { width: scalingValue(activeSizeValue, isEditor) } : {},
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);
2352
- },
2353
- onMouseEnter: () => {
2354
- var _a;
2355
- if (thumbnail.triggers === "hov") {
2356
- (_a = lightboxRef.current) == null ? void 0 : _a.go(index);
2357
- }
2375
+ gap: scalingValue(thumbnail.grid.gap, isEditor)
2358
2376
  },
2359
- children: /* @__PURE__ */ jsx(
2360
- "img",
2361
- {
2362
- src: item.image.url,
2363
- alt: item.image.name ?? "",
2364
- onLoad: (e) => {
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
- }));
2377
+ children: content.map((item, index) => {
2378
+ const isActive = index === currentIndex;
2379
+ const thumbDims = thumbnailDimensions[index];
2380
+ const baseSizeValue = thumbnail.grid.size;
2381
+ const activeSizeValue = baseSizeValue * (isActive ? thumbnail.activeState.scale : 1);
2382
+ const getFitDimensions = () => {
2383
+ if (thumbnail.fit !== "fit") return {};
2384
+ if (!thumbDims) {
2385
+ if (slider.direction === "horiz") {
2386
+ return { height: scalingValue(activeSizeValue, isEditor) };
2387
+ } else {
2388
+ return { width: scalingValue(activeSizeValue, isEditor) };
2371
2389
  }
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
2390
  }
2378
- }
2379
- )
2380
- },
2381
- `${item.image.name}-${index}`
2382
- );
2383
- })
2384
- }
2385
- )
2391
+ const aspectRatio = thumbDims.width / thumbDims.height;
2392
+ if (slider.direction === "horiz") {
2393
+ const heightValue = activeSizeValue;
2394
+ const widthValue = heightValue * aspectRatio;
2395
+ return {
2396
+ width: scalingValue(widthValue, isEditor),
2397
+ height: scalingValue(heightValue, isEditor)
2398
+ };
2399
+ } else {
2400
+ const widthValue = activeSizeValue;
2401
+ const heightValue = widthValue / aspectRatio;
2402
+ return {
2403
+ width: scalingValue(widthValue, isEditor),
2404
+ height: scalingValue(heightValue, isEditor)
2405
+ };
2406
+ }
2407
+ };
2408
+ return /* @__PURE__ */ jsx(
2409
+ "button",
2410
+ {
2411
+ className: classes.thumbItem,
2412
+ style: {
2413
+ ...slider.direction === "horiz" && thumbnail.fit !== "fit" ? { height: scalingValue(activeSizeValue, isEditor) } : {},
2414
+ ...slider.direction === "vert" && thumbnail.fit !== "fit" ? { width: scalingValue(activeSizeValue, isEditor) } : {},
2415
+ ...thumbnail.fit === "cover" ? { width: scalingValue(activeSizeValue, isEditor), height: scalingValue(activeSizeValue, isEditor) } : {},
2416
+ ...getFitDimensions(),
2417
+ transition: isActive ? "all 0.2s ease-out" : "none",
2418
+ opacity: isActive ? thumbnail.activeState.opacity / 100 : thumbnail.opacity / 100,
2419
+ ["--thumb-hover"]: thumbnail.activeState.opacity / 100
2420
+ },
2421
+ onClick: (e) => {
2422
+ var _a;
2423
+ e.stopPropagation();
2424
+ setCurrentIndex(index);
2425
+ (_a = lightboxRef.current) == null ? void 0 : _a.go(index);
2426
+ },
2427
+ onMouseEnter: () => {
2428
+ var _a;
2429
+ if (thumbnail.triggers === "hov") {
2430
+ (_a = lightboxRef.current) == null ? void 0 : _a.go(index);
2431
+ }
2432
+ },
2433
+ children: /* @__PURE__ */ jsx(
2434
+ "img",
2435
+ {
2436
+ src: item.image.url,
2437
+ alt: item.image.name ?? "",
2438
+ onLoad: (e) => {
2439
+ const img2 = e.currentTarget;
2440
+ if (img2.naturalWidth && img2.naturalHeight) {
2441
+ setThumbnailDimensions((prev) => ({
2442
+ ...prev,
2443
+ [index]: { width: img2.naturalWidth, height: img2.naturalHeight }
2444
+ }));
2445
+ }
2446
+ },
2447
+ style: {
2448
+ objectFit: thumbnail.fit === "cover" ? "cover" : "contain",
2449
+ ...thumbnail.fit === "fit" ? { maxWidth: "100%", maxHeight: "100%", objectFit: "contain" } : {},
2450
+ ...thumbnail.fit === "cover" && slider.direction === "horiz" ? { width: "100%", height: "100%" } : {}
2451
+ }
2452
+ }
2453
+ )
2454
+ },
2455
+ `${item.image.name}-${index}`
2456
+ );
2457
+ })
2458
+ }
2459
+ )
2460
+ }
2461
+ );
2462
+ })()
2386
2463
  ]
2387
2464
  }
2388
2465
  )
@@ -2390,6 +2467,9 @@ const Lightbox = ({ isOpen, onClose, content, lightboxStyles, settings, portalId
2390
2467
  document.getElementById(portalId)
2391
2468
  );
2392
2469
  };
2470
+ function ArrowIcon({ color, className }) {
2471
+ 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)" }) }) });
2472
+ }
2393
2473
  const LightboxComponent = {
2394
2474
  element: LightboxGallery,
2395
2475
  id: "lightbox",
@@ -2887,10 +2967,26 @@ const LightboxComponent = {
2887
2967
  }
2888
2968
  }
2889
2969
  }
2970
+ },
2971
+ closeIconColor: {
2972
+ title: "Color",
2973
+ type: "string",
2974
+ display: {
2975
+ type: "settings-color-picker",
2976
+ format: "single"
2977
+ }
2978
+ },
2979
+ closeIconHover: {
2980
+ title: "Hover",
2981
+ type: "string",
2982
+ display: {
2983
+ type: "settings-color-picker",
2984
+ format: "single"
2985
+ }
2890
2986
  }
2891
2987
  }
2892
2988
  },
2893
- imageCaption: {
2989
+ caption: {
2894
2990
  title: "DESC",
2895
2991
  icon: "text-icon",
2896
2992
  tooltip: "Description",
@@ -2995,7 +3091,7 @@ const LightboxComponent = {
2995
3091
  padding: { top: 0.06, right: 0, bottom: 0.06, left: 0 }
2996
3092
  },
2997
3093
  controls: {
2998
- isActive: true,
3094
+ isActive: false,
2999
3095
  arrowsImgUrl: null,
3000
3096
  offset: { x: 0, y: 0 },
3001
3097
  scale: 1,
@@ -3006,11 +3102,13 @@ const LightboxComponent = {
3006
3102
  color: "rgba(28,31,34,0.9)",
3007
3103
  blur: 0,
3008
3104
  closeIconUrl: null,
3105
+ closeIconColor: "#000000",
3106
+ closeIconHover: "#cccccc",
3009
3107
  closeIconAlign: "top-right",
3010
3108
  closeIconOffset: { x: 0, y: 0 },
3011
3109
  closeIconScale: 1
3012
3110
  },
3013
- imageCaption: {
3111
+ caption: {
3014
3112
  isActive: true,
3015
3113
  alignment: "middle-center",
3016
3114
  offset: { x: 0, y: 0 },
@@ -3063,7 +3161,7 @@ const LightboxComponent = {
3063
3161
  padding: { top: 0.06, right: 0.05, bottom: 0.06, left: 0.05 }
3064
3162
  },
3065
3163
  controls: {
3066
- isActive: true,
3164
+ isActive: false,
3067
3165
  arrowsImgUrl: null,
3068
3166
  offset: { x: 0, y: 0 },
3069
3167
  scale: 1,
@@ -3074,11 +3172,13 @@ const LightboxComponent = {
3074
3172
  color: "rgba(28,31,34,0.9)",
3075
3173
  blur: 0,
3076
3174
  closeIconUrl: null,
3175
+ closeIconColor: "#000000",
3176
+ closeIconHover: "#cccccc",
3077
3177
  closeIconAlign: "top-right",
3078
3178
  closeIconOffset: { x: 0, y: 0 },
3079
3179
  closeIconScale: 1
3080
3180
  },
3081
- imageCaption: {
3181
+ caption: {
3082
3182
  isActive: true,
3083
3183
  alignment: "middle-center",
3084
3184
  offset: { x: 0, y: 0 },
@@ -3131,7 +3231,7 @@ const LightboxComponent = {
3131
3231
  padding: { top: 0.06, right: 0.1, bottom: 0.06, left: 0.1 }
3132
3232
  },
3133
3233
  controls: {
3134
- isActive: true,
3234
+ isActive: false,
3135
3235
  arrowsImgUrl: null,
3136
3236
  offset: { x: 0, y: 0 },
3137
3237
  scale: 1,
@@ -3142,11 +3242,13 @@ const LightboxComponent = {
3142
3242
  color: "rgba(28,31,34,0.9)",
3143
3243
  blur: 0,
3144
3244
  closeIconUrl: null,
3245
+ closeIconColor: "#000000",
3246
+ closeIconHover: "#cccccc",
3145
3247
  closeIconAlign: "top-right",
3146
3248
  closeIconOffset: { x: 0, y: 0 },
3147
3249
  closeIconScale: 1
3148
3250
  },
3149
- imageCaption: {
3251
+ caption: {
3150
3252
  isActive: true,
3151
3253
  alignment: "middle-center",
3152
3254
  offset: { x: 0, y: 0 },
@@ -3298,7 +3400,7 @@ const LightboxComponent = {
3298
3400
  layoutBased: true,
3299
3401
  type: "object",
3300
3402
  properties: {
3301
- imageCaption: {
3403
+ caption: {
3302
3404
  dataName: "caption",
3303
3405
  type: "object",
3304
3406
  properties: {
@@ -3396,7 +3498,7 @@ const LightboxComponent = {
3396
3498
  }
3397
3499
  },
3398
3500
  default: {
3399
- imageCaption: {
3501
+ caption: {
3400
3502
  widthSettings: {
3401
3503
  width: 0.13,
3402
3504
  sizing: "auto"