@cntrl-site/components 0.1.15 → 0.1.17

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
@@ -1971,19 +1971,6 @@ const Lightbox = ({ isOpen, onClose, content, lightboxStyles, settings, portalId
1971
1971
  (_b = lightboxRef.current) == null ? void 0 : _b.go(dir);
1972
1972
  }
1973
1973
  };
1974
- const isClickInImagePadding = (img2, clientX, clientY) => {
1975
- const rect = img2.getBoundingClientRect();
1976
- const style = window.getComputedStyle(img2);
1977
- const paddingTop = parseFloat(style.paddingTop) || 0;
1978
- const paddingRight = parseFloat(style.paddingRight) || 0;
1979
- const paddingBottom = parseFloat(style.paddingBottom) || 0;
1980
- const paddingLeft = parseFloat(style.paddingLeft) || 0;
1981
- const contentLeft = rect.left + paddingLeft;
1982
- const contentRight = rect.right - paddingRight;
1983
- const contentTop = rect.top + paddingTop;
1984
- const contentBottom = rect.bottom - paddingBottom;
1985
- return clientX < contentLeft || clientX > contentRight || clientY < contentTop || clientY > contentBottom;
1986
- };
1987
1974
  const handleImageWrapperClick = (e) => {
1988
1975
  if (hasDraggedRef.current) {
1989
1976
  hasDraggedRef.current = false;
@@ -2029,14 +2016,6 @@ const Lightbox = ({ isOpen, onClose, content, lightboxStyles, settings, portalId
2029
2016
  handleClose();
2030
2017
  }
2031
2018
  };
2032
- const onImageClick = (e) => {
2033
- e.stopPropagation();
2034
- if (isClickInImagePadding(e.currentTarget, e.clientX, e.clientY)) {
2035
- handleClose();
2036
- return;
2037
- }
2038
- handleTriggerClick(e.currentTarget, e.clientX, e.clientY);
2039
- };
2040
2019
  const handleThumbWrapperClick = (e) => {
2041
2020
  const target = e.target;
2042
2021
  if (target.classList.contains(classes.thumbsWrapper) || target.classList.contains(classes.thumbsContainer)) {
@@ -2074,6 +2053,8 @@ const Lightbox = ({ isOpen, onClose, content, lightboxStyles, settings, portalId
2074
2053
  setIsClosing(false);
2075
2054
  setAnimationFinished(false);
2076
2055
  setThumbnailDimensions({});
2056
+ const event = new CustomEvent("page-overlay");
2057
+ window.dispatchEvent(event);
2077
2058
  }
2078
2059
  return () => {
2079
2060
  if (animationTargetRef.current && animationEndHandlerRef.current) {
@@ -2352,7 +2333,6 @@ const Lightbox = ({ isOpen, onClose, content, lightboxStyles, settings, portalId
2352
2333
  [classes.cover]: item.image.objectFit === "cover",
2353
2334
  [classes.scaleSlide]: slider.type === "scale"
2354
2335
  }),
2355
- onClick: item.image.objectFit !== "contain" ? onImageClick : void 0,
2356
2336
  src: item.image.url,
2357
2337
  alt: item.image.name ?? "",
2358
2338
  style: { ...imageStyle2, pointerEvents: item.image.objectFit === "contain" ? "none" : "auto" }
@@ -2493,7 +2473,7 @@ const Lightbox = ({ isOpen, onClose, content, lightboxStyles, settings, portalId
2493
2473
  ...thumbsPositionStyles,
2494
2474
  ...slider.direction === "horiz" ? {
2495
2475
  maxWidth: "100vw",
2496
- width: "100vw",
2476
+ width: "100%",
2497
2477
  overflowX: "auto",
2498
2478
  overflowY: "hidden"
2499
2479
  } : {
package/dist/index.mjs CHANGED
@@ -1969,19 +1969,6 @@ const Lightbox = ({ isOpen, onClose, content, lightboxStyles, settings, portalId
1969
1969
  (_b = lightboxRef.current) == null ? void 0 : _b.go(dir);
1970
1970
  }
1971
1971
  };
1972
- const isClickInImagePadding = (img2, clientX, clientY) => {
1973
- const rect = img2.getBoundingClientRect();
1974
- const style = window.getComputedStyle(img2);
1975
- const paddingTop = parseFloat(style.paddingTop) || 0;
1976
- const paddingRight = parseFloat(style.paddingRight) || 0;
1977
- const paddingBottom = parseFloat(style.paddingBottom) || 0;
1978
- const paddingLeft = parseFloat(style.paddingLeft) || 0;
1979
- const contentLeft = rect.left + paddingLeft;
1980
- const contentRight = rect.right - paddingRight;
1981
- const contentTop = rect.top + paddingTop;
1982
- const contentBottom = rect.bottom - paddingBottom;
1983
- return clientX < contentLeft || clientX > contentRight || clientY < contentTop || clientY > contentBottom;
1984
- };
1985
1972
  const handleImageWrapperClick = (e) => {
1986
1973
  if (hasDraggedRef.current) {
1987
1974
  hasDraggedRef.current = false;
@@ -2027,14 +2014,6 @@ const Lightbox = ({ isOpen, onClose, content, lightboxStyles, settings, portalId
2027
2014
  handleClose();
2028
2015
  }
2029
2016
  };
2030
- const onImageClick = (e) => {
2031
- e.stopPropagation();
2032
- if (isClickInImagePadding(e.currentTarget, e.clientX, e.clientY)) {
2033
- handleClose();
2034
- return;
2035
- }
2036
- handleTriggerClick(e.currentTarget, e.clientX, e.clientY);
2037
- };
2038
2017
  const handleThumbWrapperClick = (e) => {
2039
2018
  const target = e.target;
2040
2019
  if (target.classList.contains(classes.thumbsWrapper) || target.classList.contains(classes.thumbsContainer)) {
@@ -2072,6 +2051,8 @@ const Lightbox = ({ isOpen, onClose, content, lightboxStyles, settings, portalId
2072
2051
  setIsClosing(false);
2073
2052
  setAnimationFinished(false);
2074
2053
  setThumbnailDimensions({});
2054
+ const event = new CustomEvent("page-overlay");
2055
+ window.dispatchEvent(event);
2075
2056
  }
2076
2057
  return () => {
2077
2058
  if (animationTargetRef.current && animationEndHandlerRef.current) {
@@ -2350,7 +2331,6 @@ const Lightbox = ({ isOpen, onClose, content, lightboxStyles, settings, portalId
2350
2331
  [classes.cover]: item.image.objectFit === "cover",
2351
2332
  [classes.scaleSlide]: slider.type === "scale"
2352
2333
  }),
2353
- onClick: item.image.objectFit !== "contain" ? onImageClick : void 0,
2354
2334
  src: item.image.url,
2355
2335
  alt: item.image.name ?? "",
2356
2336
  style: { ...imageStyle2, pointerEvents: item.image.objectFit === "contain" ? "none" : "auto" }
@@ -2491,7 +2471,7 @@ const Lightbox = ({ isOpen, onClose, content, lightboxStyles, settings, portalId
2491
2471
  ...thumbsPositionStyles,
2492
2472
  ...slider.direction === "horiz" ? {
2493
2473
  maxWidth: "100vw",
2494
- width: "100vw",
2474
+ width: "100%",
2495
2475
  overflowX: "auto",
2496
2476
  overflowY: "hidden"
2497
2477
  } : {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cntrl-site/components",
3
- "version": "0.1.15",
3
+ "version": "0.1.17",
4
4
  "description": "Custom components for control editor and public websites.",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",