@cntrl-site/components 0.1.0-alpha.0 → 0.1.0-alpha.2

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.
@@ -5,8 +5,9 @@ type LightboxGalleryProps = {
5
5
  styles: LightboxStyles;
6
6
  portalId: string;
7
7
  activeEvent: 'close' | 'open';
8
+ isEditor?: boolean;
8
9
  };
9
- export declare function LightboxGallery({ settings, content, styles, portalId, activeEvent }: LightboxGalleryProps): JSX.Element;
10
+ export declare function LightboxGallery({ settings, content, styles, portalId, activeEvent, isEditor }: LightboxGalleryProps): JSX.Element;
10
11
  type LightboxImage = {
11
12
  image: {
12
13
  url: string;
package/dist/index.js CHANGED
@@ -1535,7 +1535,7 @@ const getPositionStyles = (position, offset) => {
1535
1535
  }
1536
1536
  return styles2;
1537
1537
  };
1538
- function LightboxGallery({ settings, content, styles: styles2, portalId, activeEvent }) {
1538
+ function LightboxGallery({ settings, content, styles: styles2, portalId, activeEvent, isEditor = true }) {
1539
1539
  const [open, setOpen] = React.useState(false);
1540
1540
  const { url } = settings.thumbnailBlock.cover;
1541
1541
  React.useEffect(() => {
@@ -1556,10 +1556,10 @@ function LightboxGallery({ settings, content, styles: styles2, portalId, activeE
1556
1556
  onClick: () => setOpen(true)
1557
1557
  }
1558
1558
  ),
1559
- /* @__PURE__ */ jsxRuntime.jsx(Lightbox, { isOpen: open, onClose: () => setOpen(false), content, settings, portalId })
1559
+ /* @__PURE__ */ jsxRuntime.jsx(Lightbox, { isOpen: open, onClose: () => setOpen(false), content, settings, portalId, isEditor })
1560
1560
  ] });
1561
1561
  }
1562
- const Lightbox = ({ isOpen, onClose, content, settings, closeOnBackdropClick = true, closeOnEsc = true, portalId }) => {
1562
+ const Lightbox = ({ isOpen, onClose, content, settings, closeOnBackdropClick = true, closeOnEsc = true, portalId, isEditor }) => {
1563
1563
  const [currentIndex, setCurrentIndex] = React.useState(0);
1564
1564
  const lightboxRef = React.useRef(null);
1565
1565
  const resizeObserverRef = React.useRef(null);
@@ -1670,17 +1670,28 @@ const Lightbox = ({ isOpen, onClose, content, settings, closeOnBackdropClick = t
1670
1670
  (_a = lightboxRef.current) == null ? void 0 : _a.go(dir);
1671
1671
  };
1672
1672
  const appearDurationMs = appear.duration ? parseInt(appear.duration) : 300;
1673
+ const backdropDurationMs = appear.type === "fade in" || appear.type === "mix" ? Math.floor(appearDurationMs * 0.7) : appearDurationMs;
1673
1674
  const appearClass = (() => {
1674
1675
  if (appear.type === "fade in") return styles.fadeIn;
1675
- if (appear.type === "slide in") {
1676
- return "";
1676
+ if (appear.type === "slide in" || appear.type === "mix") {
1677
+ switch (appear.direction) {
1678
+ case "left":
1679
+ return styles.slideInLeft;
1680
+ case "right":
1681
+ return styles.slideInRight;
1682
+ case "top":
1683
+ return styles.slideInTop;
1684
+ case "bottom":
1685
+ return styles.slideInBottom;
1686
+ default:
1687
+ return styles.slideInRight;
1688
+ }
1677
1689
  }
1678
- if (appear.type === "mix") return styles.fadeIn;
1679
1690
  return styles.fadeIn;
1680
1691
  })();
1681
1692
  const backdropAppearClass = (() => {
1682
- if (appear.type === "fade in") return styles.fadeIn;
1683
- if (appear.type === "slide in" || appear.type === "mix") {
1693
+ if (appear.type === "fade in" || appear.type === "mix") return styles.fadeIn;
1694
+ if (appear.type === "slide in") {
1684
1695
  switch (appear.direction) {
1685
1696
  case "left":
1686
1697
  return styles.slideInLeft;
@@ -1701,8 +1712,8 @@ const Lightbox = ({ isOpen, onClose, content, settings, closeOnBackdropClick = t
1701
1712
  /* @__PURE__ */ jsxRuntime.jsx(
1702
1713
  "div",
1703
1714
  {
1704
- className: cn(styles.backdropStyle, backdropAppearClass),
1705
- style: { backgroundColor: area.color, backdropFilter: `blur(${area.blur}px)`, animationDuration: `${appearDurationMs}ms`, animationTimingFunction: "ease", animationFillMode: "both" },
1715
+ className: cn(styles.backdropStyle, backdropAppearClass, { [styles.editor]: isEditor }),
1716
+ style: { backgroundColor: area.color, backdropFilter: `blur(${area.blur}px)`, animationDuration: `${backdropDurationMs}ms`, animationTimingFunction: "ease", animationFillMode: "both" },
1706
1717
  onClick: handleBackdropClick,
1707
1718
  children: /* @__PURE__ */ jsxRuntime.jsxs(
1708
1719
  "div",
@@ -1713,7 +1724,7 @@ const Lightbox = ({ isOpen, onClose, content, settings, closeOnBackdropClick = t
1713
1724
  animationDuration: `${appearDurationMs}ms`,
1714
1725
  animationTimingFunction: "ease",
1715
1726
  animationFillMode: "both",
1716
- ...appear.type === "mix" && { animationDelay: "0.5s" },
1727
+ ...appear.type === "mix" && { animationDelay: `${backdropDurationMs}ms` },
1717
1728
  "--splide-speed": triggers.duration || "500ms"
1718
1729
  },
1719
1730
  children: [
@@ -1753,6 +1764,9 @@ const Lightbox = ({ isOpen, onClose, content, settings, closeOnBackdropClick = t
1753
1764
  {
1754
1765
  className: styles.imgWrapper,
1755
1766
  onClick: handleImageWrapperClick,
1767
+ style: {
1768
+ padding: `${layout.padding.top}px ${layout.padding.right}px ${layout.padding.bottom}px ${layout.padding.left}px`
1769
+ },
1756
1770
  children: /* @__PURE__ */ jsxRuntime.jsx(
1757
1771
  "img",
1758
1772
  {
@@ -1929,7 +1943,7 @@ const LightboxComponent = {
1929
1943
  name: "Lightbox",
1930
1944
  preview: {
1931
1945
  type: "video",
1932
- url: "https://cdn.cntrl.site/projects/01JJKT02AWY2FGN2QJ7A173RNZ/articles-assets/01K7EQ4ME6CP4KX7TJ4HPAXFEW.mp4"
1946
+ url: "https://cdn.cntrl.site/projects/01GJ2SPDSH73MC92WW7ZA2CWBY/articles-assets/01KA24CHYZXJBZ0Q714B05A7VD.mp4"
1933
1947
  },
1934
1948
  defaultSize: {
1935
1949
  width: 400,
package/dist/index.mjs CHANGED
@@ -1533,7 +1533,7 @@ const getPositionStyles = (position, offset) => {
1533
1533
  }
1534
1534
  return styles2;
1535
1535
  };
1536
- function LightboxGallery({ settings, content, styles: styles2, portalId, activeEvent }) {
1536
+ function LightboxGallery({ settings, content, styles: styles2, portalId, activeEvent, isEditor = true }) {
1537
1537
  const [open, setOpen] = React.useState(false);
1538
1538
  const { url } = settings.thumbnailBlock.cover;
1539
1539
  useEffect(() => {
@@ -1554,10 +1554,10 @@ function LightboxGallery({ settings, content, styles: styles2, portalId, activeE
1554
1554
  onClick: () => setOpen(true)
1555
1555
  }
1556
1556
  ),
1557
- /* @__PURE__ */ jsx(Lightbox, { isOpen: open, onClose: () => setOpen(false), content, settings, portalId })
1557
+ /* @__PURE__ */ jsx(Lightbox, { isOpen: open, onClose: () => setOpen(false), content, settings, portalId, isEditor })
1558
1558
  ] });
1559
1559
  }
1560
- const Lightbox = ({ isOpen, onClose, content, settings, closeOnBackdropClick = true, closeOnEsc = true, portalId }) => {
1560
+ const Lightbox = ({ isOpen, onClose, content, settings, closeOnBackdropClick = true, closeOnEsc = true, portalId, isEditor }) => {
1561
1561
  const [currentIndex, setCurrentIndex] = React.useState(0);
1562
1562
  const lightboxRef = useRef(null);
1563
1563
  const resizeObserverRef = useRef(null);
@@ -1668,17 +1668,28 @@ const Lightbox = ({ isOpen, onClose, content, settings, closeOnBackdropClick = t
1668
1668
  (_a = lightboxRef.current) == null ? void 0 : _a.go(dir);
1669
1669
  };
1670
1670
  const appearDurationMs = appear.duration ? parseInt(appear.duration) : 300;
1671
+ const backdropDurationMs = appear.type === "fade in" || appear.type === "mix" ? Math.floor(appearDurationMs * 0.7) : appearDurationMs;
1671
1672
  const appearClass = (() => {
1672
1673
  if (appear.type === "fade in") return styles.fadeIn;
1673
- if (appear.type === "slide in") {
1674
- return "";
1674
+ if (appear.type === "slide in" || appear.type === "mix") {
1675
+ switch (appear.direction) {
1676
+ case "left":
1677
+ return styles.slideInLeft;
1678
+ case "right":
1679
+ return styles.slideInRight;
1680
+ case "top":
1681
+ return styles.slideInTop;
1682
+ case "bottom":
1683
+ return styles.slideInBottom;
1684
+ default:
1685
+ return styles.slideInRight;
1686
+ }
1675
1687
  }
1676
- if (appear.type === "mix") return styles.fadeIn;
1677
1688
  return styles.fadeIn;
1678
1689
  })();
1679
1690
  const backdropAppearClass = (() => {
1680
- if (appear.type === "fade in") return styles.fadeIn;
1681
- if (appear.type === "slide in" || appear.type === "mix") {
1691
+ if (appear.type === "fade in" || appear.type === "mix") return styles.fadeIn;
1692
+ if (appear.type === "slide in") {
1682
1693
  switch (appear.direction) {
1683
1694
  case "left":
1684
1695
  return styles.slideInLeft;
@@ -1699,8 +1710,8 @@ const Lightbox = ({ isOpen, onClose, content, settings, closeOnBackdropClick = t
1699
1710
  /* @__PURE__ */ jsx(
1700
1711
  "div",
1701
1712
  {
1702
- className: cn(styles.backdropStyle, backdropAppearClass),
1703
- style: { backgroundColor: area.color, backdropFilter: `blur(${area.blur}px)`, animationDuration: `${appearDurationMs}ms`, animationTimingFunction: "ease", animationFillMode: "both" },
1713
+ className: cn(styles.backdropStyle, backdropAppearClass, { [styles.editor]: isEditor }),
1714
+ style: { backgroundColor: area.color, backdropFilter: `blur(${area.blur}px)`, animationDuration: `${backdropDurationMs}ms`, animationTimingFunction: "ease", animationFillMode: "both" },
1704
1715
  onClick: handleBackdropClick,
1705
1716
  children: /* @__PURE__ */ jsxs(
1706
1717
  "div",
@@ -1711,7 +1722,7 @@ const Lightbox = ({ isOpen, onClose, content, settings, closeOnBackdropClick = t
1711
1722
  animationDuration: `${appearDurationMs}ms`,
1712
1723
  animationTimingFunction: "ease",
1713
1724
  animationFillMode: "both",
1714
- ...appear.type === "mix" && { animationDelay: "0.5s" },
1725
+ ...appear.type === "mix" && { animationDelay: `${backdropDurationMs}ms` },
1715
1726
  "--splide-speed": triggers.duration || "500ms"
1716
1727
  },
1717
1728
  children: [
@@ -1751,6 +1762,9 @@ const Lightbox = ({ isOpen, onClose, content, settings, closeOnBackdropClick = t
1751
1762
  {
1752
1763
  className: styles.imgWrapper,
1753
1764
  onClick: handleImageWrapperClick,
1765
+ style: {
1766
+ padding: `${layout.padding.top}px ${layout.padding.right}px ${layout.padding.bottom}px ${layout.padding.left}px`
1767
+ },
1754
1768
  children: /* @__PURE__ */ jsx(
1755
1769
  "img",
1756
1770
  {
@@ -1927,7 +1941,7 @@ const LightboxComponent = {
1927
1941
  name: "Lightbox",
1928
1942
  preview: {
1929
1943
  type: "video",
1930
- url: "https://cdn.cntrl.site/projects/01JJKT02AWY2FGN2QJ7A173RNZ/articles-assets/01K7EQ4ME6CP4KX7TJ4HPAXFEW.mp4"
1944
+ url: "https://cdn.cntrl.site/projects/01GJ2SPDSH73MC92WW7ZA2CWBY/articles-assets/01KA24CHYZXJBZ0Q714B05A7VD.mp4"
1931
1945
  },
1932
1946
  defaultSize: {
1933
1947
  width: 400,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cntrl-site/components",
3
- "version": "0.1.0-alpha.0",
3
+ "version": "0.1.0-alpha.2",
4
4
  "description": "Custom components for control editor and public websites.",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",