@cntrl-site/components 0.1.0-alpha.17 → 0.1.0-alpha.19

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
@@ -563,15 +563,28 @@ const ControlSliderComponent = {
563
563
  },
564
564
  offset: {
565
565
  type: "object",
566
+ title: "Offset",
566
567
  display: {
567
- type: "offset-controls"
568
+ type: "group"
568
569
  },
569
570
  properties: {
570
571
  x: {
571
- type: "number"
572
+ type: "number",
573
+ label: "X",
574
+ scalingEnabled: true,
575
+ display: {
576
+ type: "numeric-input",
577
+ visible: true
578
+ }
572
579
  },
573
580
  y: {
574
- type: "number"
581
+ type: "number",
582
+ label: "Y",
583
+ scalingEnabled: true,
584
+ display: {
585
+ type: "numeric-input",
586
+ visible: true
587
+ }
575
588
  }
576
589
  }
577
590
  },
@@ -624,15 +637,28 @@ const ControlSliderComponent = {
624
637
  },
625
638
  offset: {
626
639
  type: "object",
640
+ title: "Offset",
627
641
  display: {
628
- type: "offset-controls"
642
+ type: "group"
629
643
  },
630
644
  properties: {
631
645
  x: {
632
- type: "number"
646
+ type: "number",
647
+ label: "X",
648
+ scalingEnabled: true,
649
+ display: {
650
+ type: "numeric-input",
651
+ visible: true
652
+ }
633
653
  },
634
654
  y: {
635
- type: "number"
655
+ type: "number",
656
+ label: "Y",
657
+ scalingEnabled: true,
658
+ display: {
659
+ type: "numeric-input",
660
+ visible: true
661
+ }
636
662
  }
637
663
  }
638
664
  },
@@ -688,14 +714,26 @@ const ControlSliderComponent = {
688
714
  offset: {
689
715
  type: "object",
690
716
  display: {
691
- type: "offset-controls"
717
+ type: "group"
692
718
  },
693
719
  properties: {
694
720
  x: {
695
- type: "number"
721
+ type: "number",
722
+ label: "X",
723
+ scalingEnabled: true,
724
+ display: {
725
+ type: "numeric-input",
726
+ visible: true
727
+ }
696
728
  },
697
729
  y: {
698
- type: "number"
730
+ type: "number",
731
+ label: "Y",
732
+ scalingEnabled: true,
733
+ display: {
734
+ type: "numeric-input",
735
+ visible: true
736
+ }
699
737
  }
700
738
  }
701
739
  },
@@ -1463,7 +1501,6 @@ const thumbsAlignStart = "Lightbox-module__thumbsAlignStart___uiFIV";
1463
1501
  const thumbsAlignCenter = "Lightbox-module__thumbsAlignCenter___sbUPA";
1464
1502
  const thumbsAlignEnd = "Lightbox-module__thumbsAlignEnd___OA9N4";
1465
1503
  const thumbItem = "Lightbox-module__thumbItem___zROyu";
1466
- const thumbImage = "Lightbox-module__thumbImage___xGakV";
1467
1504
  const closeButton = "Lightbox-module__closeButton___r3Dur";
1468
1505
  const fadeIn = "Lightbox-module__fadeIn___sHwRK";
1469
1506
  const slideInLeft = "Lightbox-module__slideInLeft___P-XRo";
@@ -1494,7 +1531,6 @@ const styles = {
1494
1531
  thumbsAlignCenter,
1495
1532
  thumbsAlignEnd,
1496
1533
  thumbItem,
1497
- thumbImage,
1498
1534
  closeButton,
1499
1535
  fadeIn,
1500
1536
  slideInLeft,
@@ -1503,7 +1539,7 @@ const styles = {
1503
1539
  slideInBottom,
1504
1540
  scaleSlide
1505
1541
  };
1506
- const getPositionStyles = (position, offset) => {
1542
+ const getPositionStyles = (position, offset, isEditor) => {
1507
1543
  const styles2 = {};
1508
1544
  const [vertical, horizontal] = position.split("-");
1509
1545
  if (vertical === "top") {
@@ -1527,16 +1563,41 @@ const getPositionStyles = (position, offset) => {
1527
1563
  styles2.right = "0";
1528
1564
  }
1529
1565
  if (vertical === "middle" && horizontal === "center") {
1530
- styles2.transform = `translate(calc(-50% + ${offset.x}px), calc(-50% + ${offset.y}px))`;
1566
+ styles2.transform = `translate(calc(-50% + ${scalingValue(offset.x, isEditor)}), calc(-50% + ${scalingValue(offset.y, isEditor)}))`;
1531
1567
  } else if (vertical === "middle") {
1532
- styles2.transform = `translate(${offset.x}px, calc(-50% + ${offset.y}px))`;
1568
+ styles2.transform = `translate(${scalingValue(offset.x, isEditor)}, calc(-50% + ${scalingValue(offset.y, isEditor)}))`;
1533
1569
  } else if (horizontal === "center") {
1534
- styles2.transform = `translate(calc(-50% + ${offset.x}px), ${offset.y}px)`;
1570
+ styles2.transform = `translate(calc(-50% + ${scalingValue(offset.x, isEditor)}), ${scalingValue(offset.y, isEditor)})`;
1535
1571
  } else {
1536
- styles2.transform = `translate(${offset.x}px, ${offset.y}px)`;
1572
+ styles2.transform = `translate(${scalingValue(offset.x, isEditor)}, ${scalingValue(offset.y, isEditor)})`;
1537
1573
  }
1538
1574
  return styles2;
1539
1575
  };
1576
+ function getDisplayedImageRect(img2) {
1577
+ const container = img2.getBoundingClientRect();
1578
+ const containerW = container.width;
1579
+ const containerH = container.height;
1580
+ const imgW = img2.naturalWidth;
1581
+ const imgH = img2.naturalHeight;
1582
+ const containerRatio = containerW / containerH;
1583
+ const imgRatio = imgW / imgH;
1584
+ let renderedW, renderedH;
1585
+ if (imgRatio > containerRatio) {
1586
+ renderedW = containerW;
1587
+ renderedH = containerW / imgRatio;
1588
+ } else {
1589
+ renderedH = containerH;
1590
+ renderedW = containerH * imgRatio;
1591
+ }
1592
+ const offsetX = (containerW - renderedW) / 2 + container.left;
1593
+ const offsetY = (containerH - renderedH) / 2 + container.top;
1594
+ return {
1595
+ x: offsetX,
1596
+ y: offsetY,
1597
+ width: renderedW,
1598
+ height: renderedH
1599
+ };
1600
+ }
1540
1601
  function LightboxGallery({ settings, content, styles: styles2, portalId, activeEvent, isEditor }) {
1541
1602
  const [open, setOpen] = React.useState(false);
1542
1603
  const { url } = settings.thumbnailBlock.cover;
@@ -1558,13 +1619,16 @@ function LightboxGallery({ settings, content, styles: styles2, portalId, activeE
1558
1619
  onClick: () => setOpen(true)
1559
1620
  }
1560
1621
  ),
1561
- /* @__PURE__ */ jsx(Lightbox, { isOpen: open, onClose: () => setOpen(false), content, settings, portalId, isEditor })
1622
+ /* @__PURE__ */ jsx(Lightbox, { isOpen: open, onClose: () => setOpen(false), content, settings, styles: styles2, portalId, isEditor })
1562
1623
  ] });
1563
1624
  }
1564
- const Lightbox = ({ isOpen, onClose, content, settings, closeOnBackdropClick = true, closeOnEsc = true, portalId, isEditor }) => {
1625
+ const Lightbox = ({ isOpen, onClose, content, styles: lightboxStyles, settings, closeOnBackdropClick = true, closeOnEsc = true, portalId, isEditor }) => {
1626
+ const { widthSettings, fontSettings, letterSpacing, textAlign, wordSpacing, fontSizeLineHeight, textAppearance, color } = lightboxStyles.caption;
1565
1627
  const [currentIndex, setCurrentIndex] = React.useState(0);
1628
+ const [splideKey, setSplideKey] = React.useState(0);
1566
1629
  const lightboxRef = useRef(null);
1567
- const resizeObserverRef = useRef(null);
1630
+ const prevSliderTypeRef = useRef(null);
1631
+ const imageRef = useRef(null);
1568
1632
  const { appear, triggers, slider, thumbnail, controls, area, caption: caption2, layout } = settings.lightboxBlock;
1569
1633
  const handleBackdropClick = (e) => {
1570
1634
  if (!closeOnBackdropClick) return;
@@ -1594,6 +1658,13 @@ const Lightbox = ({ isOpen, onClose, content, settings, closeOnBackdropClick = t
1594
1658
  };
1595
1659
  const onImageClick = (e) => {
1596
1660
  var _a, _b;
1661
+ const rect = imageRef.current ? getDisplayedImageRect(imageRef.current) : null;
1662
+ if (!rect) return;
1663
+ const inside = e.clientX >= rect.x && e.clientX <= rect.x + rect.width && e.clientY >= rect.y && e.clientY <= rect.y + rect.height;
1664
+ if (!inside) {
1665
+ onClose();
1666
+ return;
1667
+ }
1597
1668
  if (triggers.type === "click" && triggers.switch === "image") {
1598
1669
  e.stopPropagation();
1599
1670
  (_a = lightboxRef.current) == null ? void 0 : _a.go("+1");
@@ -1601,11 +1672,11 @@ const Lightbox = ({ isOpen, onClose, content, settings, closeOnBackdropClick = t
1601
1672
  if (triggers.type === "click" && triggers.switch === "50/50") {
1602
1673
  e.stopPropagation();
1603
1674
  const img2 = e.currentTarget;
1604
- const rect = img2.getBoundingClientRect();
1605
- const clickX = e.clientX - rect.left;
1606
- const clickY = e.clientY - rect.top;
1607
- const imgWidth = rect.width;
1608
- const imgHeight = rect.height;
1675
+ const rect2 = img2.getBoundingClientRect();
1676
+ const clickX = e.clientX - rect2.left;
1677
+ const clickY = e.clientY - rect2.top;
1678
+ const imgWidth = rect2.width;
1679
+ const imgHeight = rect2.height;
1609
1680
  let dir;
1610
1681
  if (slider.direction === "horiz") {
1611
1682
  dir = clickX < imgWidth / 2 ? "-1" : "+1";
@@ -1638,6 +1709,12 @@ const Lightbox = ({ isOpen, onClose, content, settings, closeOnBackdropClick = t
1638
1709
  useEffect(() => {
1639
1710
  if (isOpen) setCurrentIndex(0);
1640
1711
  }, [isOpen]);
1712
+ useEffect(() => {
1713
+ if (prevSliderTypeRef.current !== null && prevSliderTypeRef.current !== slider.type) {
1714
+ setSplideKey((prev) => prev + 1);
1715
+ }
1716
+ prevSliderTypeRef.current = slider.type;
1717
+ }, [slider.type]);
1641
1718
  useEffect(() => {
1642
1719
  if (!isOpen) return;
1643
1720
  const originalOverflow = document.body.style.overflow;
@@ -1651,49 +1728,6 @@ const Lightbox = ({ isOpen, onClose, content, settings, closeOnBackdropClick = t
1651
1728
  document.body.style.backgroundColor = "";
1652
1729
  };
1653
1730
  }, [isOpen]);
1654
- useEffect(() => {
1655
- if (!isOpen) return;
1656
- if (resizeObserverRef.current) {
1657
- resizeObserverRef.current.disconnect();
1658
- resizeObserverRef.current = null;
1659
- }
1660
- const timeoutId = setTimeout(() => {
1661
- const activeSlide = document.querySelector(".splide__slide.is-active");
1662
- if (!activeSlide) return;
1663
- const img2 = activeSlide.querySelector("img");
1664
- const container = activeSlide.querySelector(`.${styles.imgWrapper}`);
1665
- if (!img2 || !container) return;
1666
- const updateImageSize = () => {
1667
- if (!img2.naturalWidth || !img2.naturalHeight) return;
1668
- const imageAspectRatio = img2.naturalWidth / img2.naturalHeight;
1669
- const containerWidth = container.clientWidth;
1670
- const containerHeight = container.clientHeight;
1671
- const containerAspectRatio = containerWidth / containerHeight;
1672
- if (imageAspectRatio > containerAspectRatio) {
1673
- img2.style.width = "100%";
1674
- } else {
1675
- img2.style.height = "100%";
1676
- }
1677
- };
1678
- if (img2.complete) {
1679
- updateImageSize();
1680
- } else {
1681
- img2.onload = updateImageSize;
1682
- }
1683
- resizeObserverRef.current = new ResizeObserver(() => {
1684
- updateImageSize();
1685
- });
1686
- resizeObserverRef.current.observe(container);
1687
- resizeObserverRef.current.observe(img2);
1688
- }, 0);
1689
- return () => {
1690
- clearTimeout(timeoutId);
1691
- if (resizeObserverRef.current) {
1692
- resizeObserverRef.current.disconnect();
1693
- resizeObserverRef.current = null;
1694
- }
1695
- };
1696
- }, [isOpen, currentIndex, content]);
1697
1731
  const handleArrowClick = (dir) => {
1698
1732
  var _a;
1699
1733
  (_a = lightboxRef.current) == null ? void 0 : _a.go(dir);
@@ -1760,6 +1794,7 @@ const Lightbox = ({ isOpen, onClose, content, settings, closeOnBackdropClick = t
1760
1794
  style: { ...isEditor && { backgroundColor: area.color, backdropFilter: `blur(${area.blur}px)` } },
1761
1795
  onClick: handleBackdropClick,
1762
1796
  onTouchEnd: handleBackdropClick,
1797
+ onTouchStart: handleBackdropClick,
1763
1798
  children: /* @__PURE__ */ jsxs(
1764
1799
  "div",
1765
1800
  {
@@ -1769,8 +1804,8 @@ const Lightbox = ({ isOpen, onClose, content, settings, closeOnBackdropClick = t
1769
1804
  animationDuration: `${appearDurationMs}ms`,
1770
1805
  animationTimingFunction: "ease",
1771
1806
  animationFillMode: "both",
1772
- ...appear.type === "mix" && { animationDelay: `${backdropDurationMs}ms` },
1773
- "--splide-speed": triggers.duration || "500ms"
1807
+ ...appear.type === "mix" && { animationDelay: `${backdropDurationMs / 2}ms` },
1808
+ "--splide-speed": slider.duration || "500ms"
1774
1809
  },
1775
1810
  children: [
1776
1811
  /* @__PURE__ */ jsx(
@@ -1783,7 +1818,7 @@ const Lightbox = ({ isOpen, onClose, content, settings, closeOnBackdropClick = t
1783
1818
  className: styles.lightboxSplide,
1784
1819
  options: {
1785
1820
  arrows: false,
1786
- speed: triggers.duration ? parseInt(triggers.duration) : 500,
1821
+ speed: slider.duration ? parseInt(slider.duration) : 500,
1787
1822
  direction: slider.direction === "horiz" || slider.type === "fade" || slider.type === "scale" ? "ltr" : "ttb",
1788
1823
  pagination: false,
1789
1824
  drag: triggers.type === "drag",
@@ -1794,9 +1829,9 @@ const Lightbox = ({ isOpen, onClose, content, settings, closeOnBackdropClick = t
1794
1829
  padding: 0,
1795
1830
  rewind: (slider.type === "scale" || slider.type === "fade") && appear.repeat !== "close"
1796
1831
  },
1797
- style: { "--splide-speed": triggers.duration || "500ms" },
1832
+ style: { "--splide-speed": slider.duration || "500ms" },
1798
1833
  children: content.map((item, index) => {
1799
- const positionStyles = getPositionStyles(layout.position, layout.offset);
1834
+ const positionStyles = getPositionStyles(layout.position, layout.offset, isEditor);
1800
1835
  const imageStyle2 = slider.type === "scale" ? (() => {
1801
1836
  const { transform, ...restStyles } = positionStyles;
1802
1837
  return {
@@ -1809,10 +1844,11 @@ const Lightbox = ({ isOpen, onClose, content, settings, closeOnBackdropClick = t
1809
1844
  {
1810
1845
  className: styles.imgWrapper,
1811
1846
  onClick: handleImageWrapperClick,
1812
- style: { padding: `${layout.padding.top}px ${layout.padding.right}px ${layout.padding.bottom}px ${layout.padding.left}px` },
1847
+ style: { padding: scalingValue(layout.padding.top, isEditor) + " " + scalingValue(layout.padding.right, isEditor) + " " + scalingValue(layout.padding.bottom, isEditor) + " " + scalingValue(layout.padding.left, isEditor) },
1813
1848
  children: /* @__PURE__ */ jsx(
1814
1849
  "img",
1815
1850
  {
1851
+ ref: imageRef,
1816
1852
  className: cn(styles.imageStyle, {
1817
1853
  [styles.contain]: item.image.objectFit === "contain",
1818
1854
  [styles.cover]: item.image.objectFit === "cover",
@@ -1827,9 +1863,10 @@ const Lightbox = ({ isOpen, onClose, content, settings, closeOnBackdropClick = t
1827
1863
  }
1828
1864
  ) }, index);
1829
1865
  })
1830
- }
1866
+ },
1867
+ splideKey
1831
1868
  ),
1832
- controls.isActive && /* @__PURE__ */ jsxs(Fragment, { children: [
1869
+ controls.isActive && controls.arrowsImgUrl && /* @__PURE__ */ jsxs(Fragment, { children: [
1833
1870
  /* @__PURE__ */ jsx(
1834
1871
  "div",
1835
1872
  {
@@ -1840,7 +1877,7 @@ const Lightbox = ({ isOpen, onClose, content, settings, closeOnBackdropClick = t
1840
1877
  {
1841
1878
  className: styles.arrowInner,
1842
1879
  style: {
1843
- transform: `translate(${scalingValue(controls.offset.x)}, ${scalingValue(controls.offset.y * (slider.direction === "horiz" ? 1 : -1))}) scale(${controls.scale}) rotate(${slider.direction === "horiz" ? "0deg" : "90deg"})`
1880
+ transform: `translate(${scalingValue(controls.offset.x, isEditor)}, ${scalingValue(controls.offset.y * (slider.direction === "horiz" ? 1 : -1), isEditor)}) scale(${controls.scale}) rotate(${slider.direction === "horiz" ? "0deg" : "90deg"})`
1844
1881
  },
1845
1882
  onClick: (e) => {
1846
1883
  handleArrowClick("-1");
@@ -1868,7 +1905,7 @@ const Lightbox = ({ isOpen, onClose, content, settings, closeOnBackdropClick = t
1868
1905
  {
1869
1906
  className: styles.arrowInner,
1870
1907
  style: {
1871
- transform: `translate(${scalingValue(controls.offset.x * (slider.direction === "horiz" ? -1 : 1))}, ${scalingValue(controls.offset.y)}) scale(${controls.scale}) rotate(${slider.direction === "horiz" ? "0deg" : "90deg"})`
1908
+ transform: `translate(${scalingValue(controls.offset.x * (slider.direction === "horiz" ? -1 : 1), isEditor)}, ${scalingValue(controls.offset.y, isEditor)}) scale(${controls.scale}) rotate(${slider.direction === "horiz" ? "0deg" : "90deg"})`
1872
1909
  },
1873
1910
  onClick: (e) => {
1874
1911
  handleArrowClick("+1");
@@ -1889,7 +1926,7 @@ const Lightbox = ({ isOpen, onClose, content, settings, closeOnBackdropClick = t
1889
1926
  )
1890
1927
  ] }),
1891
1928
  area.closeIconUrl && (() => {
1892
- const positionStyles = getPositionStyles(area.closeIconAlign, area.closeIconOffset);
1929
+ const positionStyles = getPositionStyles(area.closeIconAlign, area.closeIconOffset, isEditor);
1893
1930
  const scaleTransform = `scale(${area.closeIconScale})`;
1894
1931
  const combinedTransform = positionStyles.transform ? `${positionStyles.transform} ${scaleTransform}` : scaleTransform;
1895
1932
  return /* @__PURE__ */ jsx(
@@ -1910,10 +1947,34 @@ const Lightbox = ({ isOpen, onClose, content, settings, closeOnBackdropClick = t
1910
1947
  {
1911
1948
  className: styles.caption,
1912
1949
  style: {
1913
- ...getPositionStyles(caption2.alignment, caption2.offset),
1914
- ["--link-hover-color"]: caption2.hover
1950
+ ...getPositionStyles(caption2.alignment, caption2.offset, isEditor),
1951
+ fontFamily: fontSettings.fontFamily,
1952
+ fontWeight: fontSettings.fontWeight,
1953
+ fontStyle: fontSettings.fontStyle,
1954
+ width: widthSettings.sizing === "auto" ? "max-content" : scalingValue(widthSettings.width, isEditor),
1955
+ letterSpacing: scalingValue(letterSpacing, isEditor),
1956
+ wordSpacing: scalingValue(wordSpacing, isEditor),
1957
+ textAlign,
1958
+ fontSize: scalingValue(fontSizeLineHeight.fontSize, isEditor),
1959
+ lineHeight: scalingValue(fontSizeLineHeight.lineHeight, isEditor),
1960
+ textTransform: textAppearance.textTransform ?? "none",
1961
+ textDecoration: textAppearance.textDecoration ?? "none",
1962
+ fontVariant: textAppearance.fontVariant ?? "normal",
1963
+ color,
1964
+ transitionDuration: slider.duration ? `${Math.round(parseInt(slider.duration) / 2)}ms` : "500ms"
1915
1965
  },
1916
- children: /* @__PURE__ */ jsx(RichTextRenderer, { content: content[currentIndex].imageCaption })
1966
+ onClick: (e) => e.stopPropagation(),
1967
+ children: /* @__PURE__ */ jsx(
1968
+ "div",
1969
+ {
1970
+ "data-styles": "caption",
1971
+ className: styles.captionTextInner,
1972
+ style: {
1973
+ position: "relative"
1974
+ },
1975
+ children: /* @__PURE__ */ jsx(RichTextRenderer, { content: content[currentIndex].imageCaption })
1976
+ }
1977
+ )
1917
1978
  }
1918
1979
  ),
1919
1980
  thumbnail.isActive && /* @__PURE__ */ jsx(
@@ -1930,9 +1991,7 @@ const Lightbox = ({ isOpen, onClose, content, settings, closeOnBackdropClick = t
1930
1991
  ),
1931
1992
  style: {
1932
1993
  gap: `${thumbnail.grid.gap}px`,
1933
- ...slider.direction === "horiz" ? { height: `${thumbnail.grid.height}px` } : {},
1934
- ...slider.direction === "vert" ? { width: `${thumbnail.grid.width}px` } : {},
1935
- ...getPositionStyles(thumbnail.position, thumbnail.offset)
1994
+ ...getPositionStyles(thumbnail.position, thumbnail.offset, isEditor)
1936
1995
  },
1937
1996
  children: content.map((item, index) => {
1938
1997
  const isActive = index === currentIndex;
@@ -1941,11 +2000,13 @@ const Lightbox = ({ isOpen, onClose, content, settings, closeOnBackdropClick = t
1941
2000
  {
1942
2001
  className: styles.thumbItem,
1943
2002
  style: {
1944
- transform: `scale(${isActive ? thumbnail.activeState.scale : 1})`,
1945
- ...slider.direction === "horiz" ? { height: "100%" } : {},
1946
- ...slider.direction === "vert" ? { width: "100%" } : {},
1947
- opacity: isActive ? thumbnail.activeState.opacity : thumbnail.opacity,
1948
- ["--thumb-hover"]: thumbnail.activeState.opacity
2003
+ ...slider.direction === "horiz" ? { height: isActive ? `${thumbnail.grid.height * (isActive ? thumbnail.activeState.scale : 1)}px` : `${thumbnail.grid.height}px` } : {},
2004
+ ...slider.direction === "vert" ? { width: isActive ? `${thumbnail.grid.width * (isActive ? thumbnail.activeState.scale : 1)}px` : `${thumbnail.grid.width}px` } : {},
2005
+ ...thumbnail.fit === "cover" && slider.direction === "horiz" ? { width: isActive ? `${thumbnail.grid.width * (isActive ? thumbnail.activeState.scale : 1)}px` : `${thumbnail.grid.width}px` } : {},
2006
+ ...thumbnail.fit === "cover" && slider.direction === "vert" ? { height: isActive ? `${thumbnail.grid.height * (isActive ? thumbnail.activeState.scale : 1)}px` : `${thumbnail.grid.height}px` } : {},
2007
+ transition: isActive ? "all 0.2s ease" : "none",
2008
+ opacity: isActive ? thumbnail.activeState.opacity / 100 : thumbnail.opacity / 100,
2009
+ ["--thumb-hover"]: thumbnail.activeState.opacity / 100
1949
2010
  },
1950
2011
  onClick: (e) => {
1951
2012
  var _a;
@@ -1958,13 +2019,10 @@ const Lightbox = ({ isOpen, onClose, content, settings, closeOnBackdropClick = t
1958
2019
  {
1959
2020
  src: item.image.url,
1960
2021
  alt: item.image.name ?? "",
1961
- className: styles.thumbImage,
1962
2022
  style: {
1963
2023
  objectFit: thumbnail.fit === "cover" ? "cover" : "contain",
1964
- ...thumbnail.fit === "fit" && slider.direction === "horiz" ? { width: "fit-content" } : {},
1965
- ...thumbnail.fit === "fit" && slider.direction === "vert" ? { height: "fit-content" } : {},
1966
- ...slider.direction === "horiz" ? { height: "100%", width: "auto" } : {},
1967
- ...slider.direction === "vert" ? { width: "100%", height: "auto" } : {}
2024
+ ...thumbnail.fit === "fit" ? { maxWidth: "100%", maxHeight: "100%", objectFit: "contain" } : {},
2025
+ ...thumbnail.fit === "cover" && slider.direction === "horiz" ? { width: "100%", height: "100%" } : {}
1968
2026
  }
1969
2027
  }
1970
2028
  )
@@ -1992,8 +2050,8 @@ const LightboxComponent = {
1992
2050
  url: "https://cdn.cntrl.site/projects/01GJ2SPDSH73MC92WW7ZA2CWBY/articles-assets/01KA24CHYZXJBZ0Q714B05A7VD.mp4"
1993
2051
  },
1994
2052
  defaultSize: {
1995
- width: 400,
1996
- height: 400
2053
+ width: 440,
2054
+ height: 550
1997
2055
  },
1998
2056
  schema: {
1999
2057
  type: "object",
@@ -2018,6 +2076,7 @@ const LightboxComponent = {
2018
2076
  url: {
2019
2077
  type: "string",
2020
2078
  display: {
2079
+ mode: "cover",
2021
2080
  type: "settings-image-input"
2022
2081
  }
2023
2082
  }
@@ -2090,14 +2149,6 @@ const LightboxComponent = {
2090
2149
  type: "ratio-group"
2091
2150
  },
2092
2151
  enum: ["image", "50/50"]
2093
- },
2094
- duration: {
2095
- type: "string",
2096
- label: "T",
2097
- display: {
2098
- type: "step-selector"
2099
- },
2100
- enum: ["100ms", "250ms", "500ms", "1000ms", "1500ms", "2000ms"]
2101
2152
  }
2102
2153
  }
2103
2154
  },
@@ -2120,6 +2171,14 @@ const LightboxComponent = {
2120
2171
  type: "ratio-group"
2121
2172
  },
2122
2173
  enum: ["horiz", "vert"]
2174
+ },
2175
+ duration: {
2176
+ type: "string",
2177
+ label: "T",
2178
+ display: {
2179
+ type: "step-selector"
2180
+ },
2181
+ enum: ["100ms", "250ms", "500ms", "1000ms", "1500ms", "2000ms"]
2123
2182
  }
2124
2183
  }
2125
2184
  },
@@ -2201,15 +2260,28 @@ const LightboxComponent = {
2201
2260
  },
2202
2261
  offset: {
2203
2262
  type: "object",
2263
+ title: "Offset",
2204
2264
  display: {
2205
- type: "offset-controls"
2265
+ type: "group"
2206
2266
  },
2207
2267
  properties: {
2208
2268
  x: {
2209
- type: "number"
2269
+ type: "number",
2270
+ label: "X",
2271
+ scalingEnabled: true,
2272
+ display: {
2273
+ type: "numeric-input",
2274
+ visible: true
2275
+ }
2210
2276
  },
2211
2277
  y: {
2212
- type: "number"
2278
+ type: "number",
2279
+ label: "Y",
2280
+ scalingEnabled: true,
2281
+ display: {
2282
+ type: "numeric-input",
2283
+ visible: true
2284
+ }
2213
2285
  }
2214
2286
  }
2215
2287
  },
@@ -2234,7 +2306,7 @@ const LightboxComponent = {
2234
2306
  scale: {
2235
2307
  type: "number",
2236
2308
  title: "Scale",
2237
- min: 0.5,
2309
+ min: 1,
2238
2310
  max: 5,
2239
2311
  step: 0.1,
2240
2312
  display: {
@@ -2271,15 +2343,28 @@ const LightboxComponent = {
2271
2343
  },
2272
2344
  offset: {
2273
2345
  type: "object",
2346
+ title: "Offset",
2274
2347
  display: {
2275
- type: "offset-controls"
2348
+ type: "group"
2276
2349
  },
2277
2350
  properties: {
2278
2351
  x: {
2279
- type: "number"
2352
+ type: "number",
2353
+ label: "X",
2354
+ scalingEnabled: true,
2355
+ display: {
2356
+ type: "numeric-input",
2357
+ visible: true
2358
+ }
2280
2359
  },
2281
2360
  y: {
2282
- type: "number"
2361
+ type: "number",
2362
+ label: "Y",
2363
+ scalingEnabled: true,
2364
+ display: {
2365
+ type: "numeric-input",
2366
+ visible: true
2367
+ }
2283
2368
  }
2284
2369
  }
2285
2370
  },
@@ -2325,16 +2410,29 @@ const LightboxComponent = {
2325
2410
  }
2326
2411
  },
2327
2412
  offset: {
2413
+ title: "Offset",
2328
2414
  type: "object",
2329
2415
  display: {
2330
- type: "offset-controls"
2416
+ type: "group"
2331
2417
  },
2332
2418
  properties: {
2333
2419
  x: {
2334
- type: "number"
2420
+ type: "number",
2421
+ label: "X",
2422
+ scalingEnabled: true,
2423
+ display: {
2424
+ type: "numeric-input",
2425
+ visible: true
2426
+ }
2335
2427
  },
2336
2428
  y: {
2337
- type: "number"
2429
+ type: "number",
2430
+ label: "Y",
2431
+ scalingEnabled: true,
2432
+ display: {
2433
+ type: "numeric-input",
2434
+ visible: true
2435
+ }
2338
2436
  }
2339
2437
  }
2340
2438
  },
@@ -2413,15 +2511,28 @@ const LightboxComponent = {
2413
2511
  },
2414
2512
  closeIconOffset: {
2415
2513
  type: "object",
2514
+ title: "Offset",
2416
2515
  display: {
2417
- type: "offset-controls"
2516
+ type: "group"
2418
2517
  },
2419
2518
  properties: {
2420
2519
  x: {
2421
- type: "number"
2520
+ type: "number",
2521
+ label: "X",
2522
+ scalingEnabled: true,
2523
+ display: {
2524
+ type: "numeric-input",
2525
+ visible: true
2526
+ }
2422
2527
  },
2423
2528
  y: {
2424
- type: "number"
2529
+ type: "number",
2530
+ label: "Y",
2531
+ scalingEnabled: true,
2532
+ display: {
2533
+ type: "numeric-input",
2534
+ visible: true
2535
+ }
2425
2536
  }
2426
2537
  }
2427
2538
  }
@@ -2447,16 +2558,29 @@ const LightboxComponent = {
2447
2558
  enum: ["top-left", "top-center", "top-right", "middle-left", "middle-center", "middle-right", "bottom-left", "bottom-center", "bottom-right"]
2448
2559
  },
2449
2560
  offset: {
2561
+ title: "Offset",
2450
2562
  type: "object",
2451
2563
  display: {
2452
- type: "offset-controls"
2564
+ type: "group"
2453
2565
  },
2454
2566
  properties: {
2455
2567
  x: {
2456
- type: "number"
2568
+ type: "number",
2569
+ label: "X",
2570
+ scalingEnabled: true,
2571
+ display: {
2572
+ type: "numeric-input",
2573
+ visible: true
2574
+ }
2457
2575
  },
2458
2576
  y: {
2459
- type: "number"
2577
+ type: "number",
2578
+ label: "Y",
2579
+ scalingEnabled: true,
2580
+ display: {
2581
+ type: "numeric-input",
2582
+ visible: true
2583
+ }
2460
2584
  }
2461
2585
  }
2462
2586
  },
@@ -2488,12 +2612,12 @@ const LightboxComponent = {
2488
2612
  },
2489
2613
  triggers: {
2490
2614
  type: "click",
2491
- switch: "image",
2492
- duration: "2000ms"
2615
+ switch: "image"
2493
2616
  },
2494
2617
  slider: {
2495
2618
  type: "fade",
2496
- direction: "horiz"
2619
+ direction: "horiz",
2620
+ duration: "1000ms"
2497
2621
  },
2498
2622
  thumbnail: {
2499
2623
  isActive: true,
@@ -2622,47 +2746,27 @@ const LightboxComponent = {
2622
2746
  name: "properties.lightboxBlock.properties.appear.properties.direction.display.visible",
2623
2747
  value: false
2624
2748
  }
2625
- },
2626
- {
2627
- if: {
2628
- name: "lightboxBlock.triggers.type",
2629
- value: "click"
2630
- },
2631
- then: {
2632
- name: "properties.lightboxBlock.properties.triggers.properties.duration.display.visible",
2633
- value: true
2634
- }
2635
- },
2636
- {
2637
- if: {
2638
- name: "lightboxBlock.triggers.type",
2639
- value: "click"
2640
- },
2641
- then: {
2642
- name: "properties.lightboxBlock.properties.triggers.properties.switch.display.visible",
2643
- value: true
2644
- }
2645
- },
2646
- {
2647
- if: {
2648
- name: "lightboxBlock.triggers.type",
2649
- value: "drag"
2650
- },
2651
- then: {
2652
- name: "properties.lightboxBlock.properties.triggers.properties.duration.display.visible",
2653
- value: false
2654
- }
2655
- },
2656
- {
2657
- if: {
2658
- name: "lightboxBlock.triggers.type",
2659
- value: "drag"
2660
- },
2661
- then: {
2662
- name: "properties.lightboxBlock.properties.triggers.properties.switch.display.visible",
2663
- value: false
2664
- }
2665
2749
  }
2750
+ // {
2751
+ // if: {
2752
+ // name: 'lightboxBlock.triggers.type',
2753
+ // value: 'click'
2754
+ // },
2755
+ // then: {
2756
+ // name: 'properties.lightboxBlock.properties.slider.properties.switch.display.visible',
2757
+ // value: true
2758
+ // }
2759
+ // },
2760
+ // {
2761
+ // if: {
2762
+ // name: 'lightboxBlock.triggers.type',
2763
+ // value: 'drag'
2764
+ // },
2765
+ // then: {
2766
+ // name: 'properties.lightboxBlock.properties.slider.properties.switch.display.visible',
2767
+ // value: false
2768
+ // }
2769
+ // }
2666
2770
  ]
2667
2771
  },
2668
2772
  content: {