@cntrl-site/components 0.1.14-alpha.4 → 0.1.14

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 { useState, useEffect, useRef, useCallback } from "react";
2
+ import React, { 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$1 = "ControlSlider-module__arrowIcon___S4ztF";
14
+ const arrowIcon = "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: arrowIcon$1,
58
+ arrowIcon,
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.caption;
172
+ const { widthSettings, fontSettings, letterSpacing, textAlign, wordSpacing, fontSizeLineHeight, textAppearance, color } = sliderStyles.imageCaption;
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, caption: caption2, triggers } = settings;
177
+ const { direction, transition, controls, pagination: pagination2, imageCaption, 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.caption.isActive && /* @__PURE__ */ jsx(
213
+ settings.imageCaption.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[caption2.alignment], {
224
+ className: cn(styles$3.captionText, alignmentClassName[imageCaption.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": "caption",
247
+ "data-styles": "imageCaption",
248
248
  className: styles$3.captionTextInner,
249
249
  style: {
250
- "--link-hover-color": caption2.hover,
250
+ "--link-hover-color": imageCaption.hover,
251
251
  position: "relative",
252
- top: scalingValue(caption2.offset.y, isEditor),
253
- left: scalingValue(caption2.offset.x, isEditor)
252
+ top: scalingValue(imageCaption.offset.y, isEditor),
253
+ left: scalingValue(imageCaption.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$1, { color: controls.color, className: cn(styles$3.arrowIcon, styles$3.arrowImg, styles$3.mirror) })
346
+ !controls.arrowsImgUrl && /* @__PURE__ */ jsx(ArrowIcon, { 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$1, { color: controls.color, className: cn(styles$3.arrowIcon, styles$3.arrowImg) })
381
+ !controls.arrowsImgUrl && /* @__PURE__ */ jsx(ArrowIcon, { 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$1({ color, className }) {
453
+ function ArrowIcon({ 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
- caption: {
706
+ imageCaption: {
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
- caption: {
800
+ imageCaption: {
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
- caption: {
923
+ imageCaption: {
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
- caption: {
1021
+ imageCaption: {
1022
1022
  widthSettings: {
1023
1023
  width: 0.13,
1024
1024
  sizing: "auto"
@@ -1615,7 +1615,6 @@ const ControlImageRevealSliderComponent = {
1615
1615
  }
1616
1616
  }
1617
1617
  };
1618
- const hidden = "LightBox-module__hidden___9s-9x";
1619
1618
  const heroImage = "LightBox-module__heroImage___sTxNF";
1620
1619
  const background = "LightBox-module__background___rm9ml";
1621
1620
  const editor = "LightBox-module__editor___4ACaY";
@@ -1631,10 +1630,8 @@ const arrow = "LightBox-module__arrow___iz38X";
1631
1630
  const arrowVertical = "LightBox-module__arrowVertical___Zfz81";
1632
1631
  const nextArrow = "LightBox-module__nextArrow___zkAQN";
1633
1632
  const arrowInner = "LightBox-module__arrowInner___p48sW";
1634
- const arrowIcon = "LightBox-module__arrowIcon___3VaFf";
1635
1633
  const arrowImg = "LightBox-module__arrowImg___pNV88";
1636
1634
  const mirror = "LightBox-module__mirror___pjeXc";
1637
- const thumbsWrapper = "LightBox-module__thumbsWrapper___GB-nU";
1638
1635
  const thumbsContainerVertical = "LightBox-module__thumbsContainerVertical___wttk5";
1639
1636
  const thumbsContainer = "LightBox-module__thumbsContainer___osSma";
1640
1637
  const thumbsAlignStart = "LightBox-module__thumbsAlignStart___MO6tY";
@@ -1654,7 +1651,6 @@ const slideOutTop = "LightBox-module__slideOutTop___Vgg0z";
1654
1651
  const slideOutBottom = "LightBox-module__slideOutBottom___nJ0Ef";
1655
1652
  const scaleSlide = "LightBox-module__scaleSlide___vZriG";
1656
1653
  const classes = {
1657
- hidden,
1658
1654
  heroImage,
1659
1655
  background,
1660
1656
  editor,
@@ -1670,10 +1666,8 @@ const classes = {
1670
1666
  arrowVertical,
1671
1667
  nextArrow,
1672
1668
  arrowInner,
1673
- arrowIcon,
1674
1669
  arrowImg,
1675
1670
  mirror,
1676
- thumbsWrapper,
1677
1671
  thumbsContainerVertical,
1678
1672
  thumbsContainer,
1679
1673
  thumbsAlignStart,
@@ -1729,13 +1723,8 @@ const getPositionStyles = (position, offset, isEditor) => {
1729
1723
  };
1730
1724
  function getDisplayedImageRect(img2) {
1731
1725
  const container = img2.getBoundingClientRect();
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);
1726
+ const containerW = container.width;
1727
+ const containerH = container.height;
1739
1728
  const imgW = img2.naturalWidth;
1740
1729
  const imgH = img2.naturalHeight;
1741
1730
  const containerRatio = containerW / containerH;
@@ -1748,10 +1737,8 @@ function getDisplayedImageRect(img2) {
1748
1737
  renderedH = containerH;
1749
1738
  renderedW = containerH * imgRatio;
1750
1739
  }
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;
1740
+ const offsetX = (containerW - renderedW) / 2 + container.left;
1741
+ const offsetY = (containerH - renderedH) / 2 + container.top;
1755
1742
  return {
1756
1743
  x: offsetX,
1757
1744
  y: offsetY,
@@ -1854,7 +1841,7 @@ function getAnimationClasses(type, direction) {
1854
1841
  return { appearClass, backdropAppearClass, backdropDisappearClass, disappearClass };
1855
1842
  }
1856
1843
  const LightboxGallery = ({ settings, content, styles: styles2, portalId, activeEvent, isEditor }) => {
1857
- const [open, setOpen] = useState(false);
1844
+ const [open, setOpen] = React.useState(false);
1858
1845
  const { url } = settings.thumbnailBlock.cover;
1859
1846
  useEffect(() => {
1860
1847
  if (activeEvent === "close") {
@@ -1901,8 +1888,8 @@ const Lightbox = ({ isOpen, onClose, content, lightboxStyles, settings, portalId
1901
1888
  const animationTargetRef = useRef(null);
1902
1889
  const animationEndHandlerRef = useRef(null);
1903
1890
  const appearAnimationEndHandlerRef = useRef(null);
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;
1891
+ const { appear, triggers, slider, thumbnail, controls, area, imageCaption, layout } = settings.lightboxBlock;
1892
+ const { widthSettings, fontSettings, letterSpacing, textAlign, wordSpacing, fontSizeLineHeight, textAppearance, color } = lightboxStyles.imageCaption;
1906
1893
  const { appearClass, backdropAppearClass, backdropDisappearClass, disappearClass } = getAnimationClasses(appear.type, appear.direction);
1907
1894
  useEffect(() => {
1908
1895
  const handleLayoutChange = () => {
@@ -1968,19 +1955,6 @@ const Lightbox = ({ isOpen, onClose, content, lightboxStyles, settings, portalId
1968
1955
  (_b = lightboxRef.current) == null ? void 0 : _b.go(dir);
1969
1956
  }
1970
1957
  };
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
- };
1984
1958
  const handleImageWrapperClick = (e) => {
1985
1959
  const currentImage = content[currentIndex];
1986
1960
  const isCover = (currentImage == null ? void 0 : currentImage.image.objectFit) === "cover";
@@ -1998,16 +1972,7 @@ const Lightbox = ({ isOpen, onClose, content, lightboxStyles, settings, portalId
1998
1972
  let inside;
1999
1973
  if (isCover && imageRef.current) {
2000
1974
  const imgRect = imageRef.current.getBoundingClientRect();
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;
1975
+ inside = clientX >= imgRect.left && clientX <= imgRect.right && clientY >= imgRect.top && clientY <= imgRect.bottom;
2011
1976
  } else {
2012
1977
  const rect = imageRef.current ? getDisplayedImageRect(imageRef.current) : null;
2013
1978
  if (!rect) {
@@ -2024,10 +1989,6 @@ const Lightbox = ({ isOpen, onClose, content, lightboxStyles, settings, portalId
2024
1989
  };
2025
1990
  const onImageClick = (e) => {
2026
1991
  e.stopPropagation();
2027
- if (isClickInImagePadding(e.currentTarget, e.clientX, e.clientY)) {
2028
- handleClose();
2029
- return;
2030
- }
2031
1992
  handleTriggerClick(e.currentTarget, e.clientX, e.clientY);
2032
1993
  };
2033
1994
  useEffect(() => {
@@ -2056,7 +2017,6 @@ const Lightbox = ({ isOpen, onClose, content, lightboxStyles, settings, portalId
2056
2017
  useEffect(() => {
2057
2018
  if (isOpen) {
2058
2019
  setCurrentIndex(0);
2059
- setSplideKey((prev) => prev + 1);
2060
2020
  isClosingRef.current = false;
2061
2021
  setIsClosing(false);
2062
2022
  setAnimationFinished(false);
@@ -2160,14 +2120,14 @@ const Lightbox = ({ isOpen, onClose, content, lightboxStyles, settings, portalId
2160
2120
  animationTimingFunction: "ease",
2161
2121
  animationFillMode: "both"
2162
2122
  };
2163
- if (!document.getElementById(portalId)) return null;
2123
+ if (!isOpen && !isClosing) return null;
2164
2124
  return createPortal(
2165
2125
  /* @__PURE__ */ jsxs(Fragment, { children: [
2166
2126
  /* @__PURE__ */ jsx(
2167
2127
  "div",
2168
2128
  {
2169
2129
  ref: !isEditor ? animationTargetRef : null,
2170
- className: cn(classes.background, isClosing ? backdropDisappearClass : backdropAppearClass, { [classes.editor]: isEditor }, { [classes.hidden]: !isOpen }),
2130
+ className: cn(classes.background, isClosing ? backdropDisappearClass : backdropAppearClass, { [classes.editor]: isEditor }),
2171
2131
  style: {
2172
2132
  ...backdropStyles,
2173
2133
  ...animationFinished && !isEditor && !isClosing ? { position: "absolute" } : {}
@@ -2178,7 +2138,7 @@ const Lightbox = ({ isOpen, onClose, content, lightboxStyles, settings, portalId
2178
2138
  "div",
2179
2139
  {
2180
2140
  ref: isEditor ? animationTargetRef : null,
2181
- className: cn(classes.contentStyle, !isClosing ? appearClass : disappearClass, { [classes.editor]: isEditor }, { [classes.hidden]: !isOpen }),
2141
+ className: cn(classes.contentStyle, !isClosing ? appearClass : disappearClass, { [classes.editor]: isEditor }),
2182
2142
  style: {
2183
2143
  animationDuration: `${parseInt(appear.duration)}ms`,
2184
2144
  animationTimingFunction: "ease",
@@ -2202,8 +2162,7 @@ const Lightbox = ({ isOpen, onClose, content, lightboxStyles, settings, portalId
2202
2162
  height: "100%",
2203
2163
  type: slider.type === "fade" || slider.type === "scale" ? "fade" : "loop",
2204
2164
  padding: 0,
2205
- rewind: (slider.type === "scale" || slider.type === "fade") && triggers.repeat === "loop",
2206
- start: 0
2165
+ rewind: (slider.type === "scale" || slider.type === "fade") && triggers.repeat === "loop"
2207
2166
  },
2208
2167
  style: { "--splide-speed": slider.duration },
2209
2168
  children: content.map((item, index) => {
@@ -2238,13 +2197,13 @@ const Lightbox = ({ isOpen, onClose, content, lightboxStyles, settings, portalId
2238
2197
  },
2239
2198
  splideKey
2240
2199
  ),
2241
- controls.isActive && /* @__PURE__ */ jsxs(Fragment, { children: [
2200
+ controls.isActive && controls.arrowsImgUrl && /* @__PURE__ */ jsxs(Fragment, { children: [
2242
2201
  /* @__PURE__ */ jsx(
2243
2202
  "div",
2244
2203
  {
2245
2204
  className: cn(classes.arrow, { [classes.arrowVertical]: slider.direction === "vert" }),
2246
2205
  style: { color: controls.color, ["--arrow-hover-color"]: controls.hover },
2247
- children: /* @__PURE__ */ jsxs(
2206
+ children: /* @__PURE__ */ jsx(
2248
2207
  "button",
2249
2208
  {
2250
2209
  className: classes.arrowInner,
@@ -2254,18 +2213,15 @@ const Lightbox = ({ isOpen, onClose, content, lightboxStyles, settings, portalId
2254
2213
  return (_a = lightboxRef.current) == null ? void 0 : _a.go("-1");
2255
2214
  },
2256
2215
  "aria-label": "Previous",
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
- ]
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
+ )
2269
2225
  }
2270
2226
  )
2271
2227
  }
@@ -2275,7 +2231,7 @@ const Lightbox = ({ isOpen, onClose, content, lightboxStyles, settings, portalId
2275
2231
  {
2276
2232
  className: cn(classes.arrow, classes.nextArrow, { [classes.arrowVertical]: slider.direction === "vert" }),
2277
2233
  style: { color: controls.color, ["--arrow-hover-color"]: controls.hover },
2278
- children: /* @__PURE__ */ jsxs(
2234
+ children: /* @__PURE__ */ jsx(
2279
2235
  "button",
2280
2236
  {
2281
2237
  className: classes.arrowInner,
@@ -2285,18 +2241,15 @@ const Lightbox = ({ isOpen, onClose, content, lightboxStyles, settings, portalId
2285
2241
  return (_a = lightboxRef.current) == null ? void 0 : _a.go("+1");
2286
2242
  },
2287
2243
  "aria-label": "Next",
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
- ]
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
+ )
2300
2253
  }
2301
2254
  )
2302
2255
  }
@@ -2306,14 +2259,14 @@ const Lightbox = ({ isOpen, onClose, content, lightboxStyles, settings, portalId
2306
2259
  const positionStyles = getPositionStyles(area.closeIconAlign, area.closeIconOffset, isEditor);
2307
2260
  const scaleTransform = `scale(${area.closeIconScale})`;
2308
2261
  const combinedTransform = positionStyles.transform ? `${positionStyles.transform} ${scaleTransform}` : scaleTransform;
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 }) });
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 }) });
2310
2263
  })(),
2311
- caption2.isActive && /* @__PURE__ */ jsx(
2264
+ imageCaption.isActive && /* @__PURE__ */ jsx(
2312
2265
  "div",
2313
2266
  {
2314
2267
  className: classes.caption,
2315
2268
  style: {
2316
- ...getPositionStyles(caption2.alignment, caption2.offset, isEditor),
2269
+ ...getPositionStyles(imageCaption.alignment, imageCaption.offset, isEditor),
2317
2270
  fontFamily: fontSettings.fontFamily,
2318
2271
  fontWeight: fontSettings.fontWeight,
2319
2272
  fontStyle: fontSettings.fontStyle,
@@ -2332,147 +2285,104 @@ const Lightbox = ({ isOpen, onClose, content, lightboxStyles, settings, portalId
2332
2285
  children: /* @__PURE__ */ jsx(
2333
2286
  "div",
2334
2287
  {
2335
- "data-styles": "caption",
2288
+ "data-styles": "imageCaption",
2336
2289
  className: classes.captionTextInner,
2337
- style: { ["--link-hover-color"]: caption2.hover },
2290
+ style: { ["--link-hover-color"]: imageCaption.hover },
2338
2291
  children: /* @__PURE__ */ jsx(RichTextRenderer, { content: content[currentIndex].imageCaption })
2339
2292
  }
2340
2293
  )
2341
2294
  }
2342
2295
  ),
2343
- thumbnail.isActive && (() => {
2344
- const [vertical, horizontal] = thumbnail.position.split("-");
2345
- const effectivePosition = slider.direction === "horiz" ? `${vertical}-left` : thumbnail.position;
2346
- const thumbsPositionStyles = getPositionStyles(effectivePosition, thumbnail.offset, isEditor);
2347
- const getJustifyContent = () => {
2348
- if (slider.direction === "horiz") {
2349
- if (horizontal === "left") return "flex-start";
2350
- if (horizontal === "center") return "center";
2351
- if (horizontal === "right") return "flex-end";
2352
- } else {
2353
- if (vertical === "top") return "flex-start";
2354
- if (vertical === "middle") return "center";
2355
- if (vertical === "bottom") return "flex-end";
2356
- }
2357
- return "flex-start";
2358
- };
2359
- return /* @__PURE__ */ jsx(
2360
- "div",
2361
- {
2362
- className: classes.thumbsWrapper,
2363
- style: {
2364
- position: isEditor ? "absolute" : "fixed",
2365
- ...thumbsPositionStyles,
2366
- ...slider.direction === "horiz" ? {
2367
- maxWidth: "100vw",
2368
- width: "100vw",
2369
- overflowX: "auto",
2370
- overflowY: "hidden"
2371
- } : {
2372
- maxHeight: "100vh",
2373
- overflowY: "auto",
2374
- overflowX: "hidden"
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
+ };
2375
2332
  }
2376
- },
2377
- children: /* @__PURE__ */ jsx(
2378
- "div",
2333
+ };
2334
+ return /* @__PURE__ */ jsx(
2335
+ "button",
2379
2336
  {
2380
- className: cn(classes.thumbsContainer, {
2381
- [classes.thumbsContainerVertical]: slider.direction === "vert",
2382
- [classes.thumbsAlignStart]: thumbnail.align === "start",
2383
- [classes.thumbsAlignCenter]: thumbnail.align === "center",
2384
- [classes.thumbsAlignEnd]: thumbnail.align === "end"
2385
- }),
2337
+ className: classes.thumbItem,
2386
2338
  style: {
2387
- gap: scalingValue(thumbnail.grid.gap, isEditor),
2388
- justifyContent: getJustifyContent()
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
+ }
2389
2358
  },
2390
- children: content.map((item, index) => {
2391
- const isActive = index === currentIndex;
2392
- const thumbDims = thumbnailDimensions[index];
2393
- const baseSizeValue = thumbnail.grid.size;
2394
- const activeSizeValue = baseSizeValue * (isActive ? thumbnail.activeState.scale : 1);
2395
- const getFitDimensions = () => {
2396
- if (thumbnail.fit !== "fit") return {};
2397
- if (!thumbDims) {
2398
- if (slider.direction === "horiz") {
2399
- return { height: scalingValue(activeSizeValue, isEditor) };
2400
- } else {
2401
- return { width: scalingValue(activeSizeValue, isEditor) };
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
+ }));
2402
2371
  }
2403
- }
2404
- const aspectRatio = thumbDims.width / thumbDims.height;
2405
- if (slider.direction === "horiz") {
2406
- const heightValue = activeSizeValue;
2407
- const widthValue = heightValue * aspectRatio;
2408
- return {
2409
- width: scalingValue(widthValue, isEditor),
2410
- height: scalingValue(heightValue, isEditor)
2411
- };
2412
- } else {
2413
- const widthValue = activeSizeValue;
2414
- const heightValue = widthValue / aspectRatio;
2415
- return {
2416
- width: scalingValue(widthValue, isEditor),
2417
- height: scalingValue(heightValue, isEditor)
2418
- };
2419
- }
2420
- };
2421
- return /* @__PURE__ */ jsx(
2422
- "button",
2423
- {
2424
- className: classes.thumbItem,
2425
- style: {
2426
- ...slider.direction === "horiz" && thumbnail.fit !== "fit" ? { height: scalingValue(activeSizeValue, isEditor) } : {},
2427
- ...slider.direction === "vert" && thumbnail.fit !== "fit" ? { width: scalingValue(activeSizeValue, isEditor) } : {},
2428
- ...thumbnail.fit === "cover" ? { width: scalingValue(activeSizeValue, isEditor), height: scalingValue(activeSizeValue, isEditor) } : {},
2429
- ...getFitDimensions(),
2430
- transition: isActive ? "all 0.25s ease-out" : "none",
2431
- opacity: isActive ? thumbnail.activeState.opacity / 100 : thumbnail.opacity / 100,
2432
- ["--thumb-hover"]: thumbnail.activeState.opacity / 100
2433
- },
2434
- onClick: (e) => {
2435
- var _a;
2436
- e.stopPropagation();
2437
- setCurrentIndex(index);
2438
- (_a = lightboxRef.current) == null ? void 0 : _a.go(index);
2439
- },
2440
- onMouseEnter: () => {
2441
- var _a;
2442
- if (thumbnail.triggers === "hov") {
2443
- (_a = lightboxRef.current) == null ? void 0 : _a.go(index);
2444
- }
2445
- },
2446
- children: /* @__PURE__ */ jsx(
2447
- "img",
2448
- {
2449
- src: item.image.url,
2450
- alt: item.image.name ?? "",
2451
- onLoad: (e) => {
2452
- const img2 = e.currentTarget;
2453
- if (img2.naturalWidth && img2.naturalHeight) {
2454
- setThumbnailDimensions((prev) => ({
2455
- ...prev,
2456
- [index]: { width: img2.naturalWidth, height: img2.naturalHeight }
2457
- }));
2458
- }
2459
- },
2460
- style: {
2461
- objectFit: thumbnail.fit === "cover" ? "cover" : "contain",
2462
- ...thumbnail.fit === "fit" ? { maxWidth: "100%", maxHeight: "100%", objectFit: "contain" } : {},
2463
- ...thumbnail.fit === "cover" ? { width: "100%", height: "100%" } : {}
2464
- }
2465
- }
2466
- )
2467
2372
  },
2468
- `${item.image.name}-${index}`
2469
- );
2470
- })
2471
- }
2472
- )
2473
- }
2474
- );
2475
- })()
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
+ }
2378
+ }
2379
+ )
2380
+ },
2381
+ `${item.image.name}-${index}`
2382
+ );
2383
+ })
2384
+ }
2385
+ )
2476
2386
  ]
2477
2387
  }
2478
2388
  )
@@ -2480,9 +2390,6 @@ const Lightbox = ({ isOpen, onClose, content, lightboxStyles, settings, portalId
2480
2390
  document.getElementById(portalId)
2481
2391
  );
2482
2392
  };
2483
- function ArrowIcon({ color, className }) {
2484
- 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)" }) }) });
2485
- }
2486
2393
  const LightboxComponent = {
2487
2394
  element: LightboxGallery,
2488
2395
  id: "lightbox",
@@ -2980,26 +2887,10 @@ const LightboxComponent = {
2980
2887
  }
2981
2888
  }
2982
2889
  }
2983
- },
2984
- closeIconColor: {
2985
- title: "Color",
2986
- type: "string",
2987
- display: {
2988
- type: "settings-color-picker",
2989
- format: "single"
2990
- }
2991
- },
2992
- closeIconHover: {
2993
- title: "Hover",
2994
- type: "string",
2995
- display: {
2996
- type: "settings-color-picker",
2997
- format: "single"
2998
- }
2999
2890
  }
3000
2891
  }
3001
2892
  },
3002
- caption: {
2893
+ imageCaption: {
3003
2894
  title: "DESC",
3004
2895
  icon: "text-icon",
3005
2896
  tooltip: "Description",
@@ -3104,7 +2995,7 @@ const LightboxComponent = {
3104
2995
  padding: { top: 0.06, right: 0, bottom: 0.06, left: 0 }
3105
2996
  },
3106
2997
  controls: {
3107
- isActive: false,
2998
+ isActive: true,
3108
2999
  arrowsImgUrl: null,
3109
3000
  offset: { x: 0, y: 0 },
3110
3001
  scale: 1,
@@ -3115,13 +3006,11 @@ const LightboxComponent = {
3115
3006
  color: "rgba(28,31,34,0.9)",
3116
3007
  blur: 0,
3117
3008
  closeIconUrl: null,
3118
- closeIconColor: "#000000",
3119
- closeIconHover: "#cccccc",
3120
3009
  closeIconAlign: "top-right",
3121
3010
  closeIconOffset: { x: 0, y: 0 },
3122
3011
  closeIconScale: 1
3123
3012
  },
3124
- caption: {
3013
+ imageCaption: {
3125
3014
  isActive: true,
3126
3015
  alignment: "middle-center",
3127
3016
  offset: { x: 0, y: 0 },
@@ -3174,7 +3063,7 @@ const LightboxComponent = {
3174
3063
  padding: { top: 0.06, right: 0.05, bottom: 0.06, left: 0.05 }
3175
3064
  },
3176
3065
  controls: {
3177
- isActive: false,
3066
+ isActive: true,
3178
3067
  arrowsImgUrl: null,
3179
3068
  offset: { x: 0, y: 0 },
3180
3069
  scale: 1,
@@ -3185,13 +3074,11 @@ const LightboxComponent = {
3185
3074
  color: "rgba(28,31,34,0.9)",
3186
3075
  blur: 0,
3187
3076
  closeIconUrl: null,
3188
- closeIconColor: "#000000",
3189
- closeIconHover: "#cccccc",
3190
3077
  closeIconAlign: "top-right",
3191
3078
  closeIconOffset: { x: 0, y: 0 },
3192
3079
  closeIconScale: 1
3193
3080
  },
3194
- caption: {
3081
+ imageCaption: {
3195
3082
  isActive: true,
3196
3083
  alignment: "middle-center",
3197
3084
  offset: { x: 0, y: 0 },
@@ -3244,7 +3131,7 @@ const LightboxComponent = {
3244
3131
  padding: { top: 0.06, right: 0.1, bottom: 0.06, left: 0.1 }
3245
3132
  },
3246
3133
  controls: {
3247
- isActive: false,
3134
+ isActive: true,
3248
3135
  arrowsImgUrl: null,
3249
3136
  offset: { x: 0, y: 0 },
3250
3137
  scale: 1,
@@ -3255,13 +3142,11 @@ const LightboxComponent = {
3255
3142
  color: "rgba(28,31,34,0.9)",
3256
3143
  blur: 0,
3257
3144
  closeIconUrl: null,
3258
- closeIconColor: "#000000",
3259
- closeIconHover: "#cccccc",
3260
3145
  closeIconAlign: "top-right",
3261
3146
  closeIconOffset: { x: 0, y: 0 },
3262
3147
  closeIconScale: 1
3263
3148
  },
3264
- caption: {
3149
+ imageCaption: {
3265
3150
  isActive: true,
3266
3151
  alignment: "middle-center",
3267
3152
  offset: { x: 0, y: 0 },
@@ -3413,7 +3298,7 @@ const LightboxComponent = {
3413
3298
  layoutBased: true,
3414
3299
  type: "object",
3415
3300
  properties: {
3416
- caption: {
3301
+ imageCaption: {
3417
3302
  dataName: "caption",
3418
3303
  type: "object",
3419
3304
  properties: {
@@ -3511,7 +3396,7 @@ const LightboxComponent = {
3511
3396
  }
3512
3397
  },
3513
3398
  default: {
3514
- caption: {
3399
+ imageCaption: {
3515
3400
  widthSettings: {
3516
3401
  width: 0.13,
3517
3402
  sizing: "auto"