@cntrl-site/components 0.1.0-4 → 0.1.0-5

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.js CHANGED
@@ -1483,14 +1483,29 @@ const styles = {
1483
1483
  };
1484
1484
  function LightboxGallery({ settings, content, styles: styles2, portalId }) {
1485
1485
  const [open, setOpen] = React.useState(false);
1486
+ const [wrapperRef, setWrapperRef] = React.useState(null);
1487
+ const [coverDimensions, setCoverDimensions] = React.useState(void 0);
1486
1488
  const { url: coverUrl } = settings.cover;
1487
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
1489
+ React.useEffect(() => {
1490
+ if (!wrapperRef) return;
1491
+ const observer = new ResizeObserver((entries) => {
1492
+ if (!wrapperRef) return;
1493
+ const [wrapper2] = entries;
1494
+ setCoverDimensions({
1495
+ width: Math.round(wrapper2.contentRect.width),
1496
+ height: Math.round(wrapper2.contentRect.height)
1497
+ });
1498
+ });
1499
+ observer.observe(wrapperRef);
1500
+ return () => observer.unobserve(wrapperRef);
1501
+ }, [wrapperRef]);
1502
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { ref: setWrapperRef, children: [
1488
1503
  /* @__PURE__ */ jsxRuntime.jsx(
1489
1504
  "img",
1490
1505
  {
1491
1506
  src: coverUrl,
1492
1507
  alt: "Cover",
1493
- style: { width: "100%", height: "100%", cursor: "pointer" },
1508
+ style: { width: (coverDimensions == null ? void 0 : coverDimensions.width) ? coverDimensions.width : "100%", height: (coverDimensions == null ? void 0 : coverDimensions.height) ? coverDimensions.height : "100%", cursor: "pointer" },
1494
1509
  onClick: () => setOpen(true)
1495
1510
  }
1496
1511
  ),
@@ -1902,7 +1917,7 @@ const LightboxComponent = {
1902
1917
  type: "string",
1903
1918
  title: "Align",
1904
1919
  display: {
1905
- type: "ratio-group"
1920
+ type: "align-grid"
1906
1921
  },
1907
1922
  enum: ["top", "center", "bottom"]
1908
1923
  },
package/dist/index.mjs CHANGED
@@ -1480,15 +1480,30 @@ const styles = {
1480
1480
  slideInBottom
1481
1481
  };
1482
1482
  function LightboxGallery({ settings, content, styles: styles2, portalId }) {
1483
- const [open, setOpen] = React.useState(false);
1483
+ const [open, setOpen] = useState(false);
1484
+ const [wrapperRef, setWrapperRef] = useState(null);
1485
+ const [coverDimensions, setCoverDimensions] = useState(void 0);
1484
1486
  const { url: coverUrl } = settings.cover;
1485
- return /* @__PURE__ */ jsxs("div", { children: [
1487
+ useEffect(() => {
1488
+ if (!wrapperRef) return;
1489
+ const observer = new ResizeObserver((entries) => {
1490
+ if (!wrapperRef) return;
1491
+ const [wrapper2] = entries;
1492
+ setCoverDimensions({
1493
+ width: Math.round(wrapper2.contentRect.width),
1494
+ height: Math.round(wrapper2.contentRect.height)
1495
+ });
1496
+ });
1497
+ observer.observe(wrapperRef);
1498
+ return () => observer.unobserve(wrapperRef);
1499
+ }, [wrapperRef]);
1500
+ return /* @__PURE__ */ jsxs("div", { ref: setWrapperRef, children: [
1486
1501
  /* @__PURE__ */ jsx(
1487
1502
  "img",
1488
1503
  {
1489
1504
  src: coverUrl,
1490
1505
  alt: "Cover",
1491
- style: { width: "100%", height: "100%", cursor: "pointer" },
1506
+ style: { width: (coverDimensions == null ? void 0 : coverDimensions.width) ? coverDimensions.width : "100%", height: (coverDimensions == null ? void 0 : coverDimensions.height) ? coverDimensions.height : "100%", cursor: "pointer" },
1492
1507
  onClick: () => setOpen(true)
1493
1508
  }
1494
1509
  ),
@@ -1900,7 +1915,7 @@ const LightboxComponent = {
1900
1915
  type: "string",
1901
1916
  title: "Align",
1902
1917
  display: {
1903
- type: "ratio-group"
1918
+ type: "align-grid"
1904
1919
  },
1905
1920
  enum: ["top", "center", "bottom"]
1906
1921
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cntrl-site/components",
3
- "version": "0.1.0-4",
3
+ "version": "0.1.0-5",
4
4
  "description": "Custom components for control editor and public websites.",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",