@meduza/ui-kit-2 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.
@@ -604,7 +604,7 @@ var Footnote = function Footnote(_ref) {
604
604
  }, children));
605
605
  };
606
606
 
607
- var styles$7 = {"root":"DotsOnImage-module_root__2XP3Q","isVisible":"DotsOnImage-module_isVisible__Wqqqt","dot":"DotsOnImage-module_dot__H1wua","show":"DotsOnImage-module_show__2TMBv","isActive":"DotsOnImage-module_isActive__3hh31","popover":"DotsOnImage-module_popover__35Cpj","isRight":"DotsOnImage-module_isRight__2RsJe","isTop":"DotsOnImage-module_isTop__3zmSK","isLeft":"DotsOnImage-module_isLeft__3quc9","isBottom":"DotsOnImage-module_isBottom__3Nk1T"};
607
+ var styles$7 = {"root":"DotsOnImage-module_root__2XP3Q","isVisible":"DotsOnImage-module_isVisible__Wqqqt","marker":"DotsOnImage-module_marker__lH5cP","show":"DotsOnImage-module_show__2TMBv","dot":"DotsOnImage-module_dot__H1wua","isActive":"DotsOnImage-module_isActive__3hh31","popover":"DotsOnImage-module_popover__35Cpj","isRight":"DotsOnImage-module_isRight__2RsJe","isTop":"DotsOnImage-module_isTop__3zmSK","isLeft":"DotsOnImage-module_isLeft__3quc9","isBottom":"DotsOnImage-module_isBottom__3Nk1T"};
608
608
 
609
609
  var DotsOnImage = function DotsOnImage(_ref) {
610
610
  var _ref$block = _ref.block,
@@ -615,6 +615,10 @@ var DotsOnImage = function DotsOnImage(_ref) {
615
615
  display = _ref$block.display,
616
616
  dots = _ref$block.dots;
617
617
 
618
+ var _useState = useState(1),
619
+ ratio = _useState[0],
620
+ setRatio = _useState[1];
621
+
618
622
  var _useInView = useInView({
619
623
  threshold: 0.5
620
624
  }),
@@ -624,19 +628,20 @@ var DotsOnImage = function DotsOnImage(_ref) {
624
628
 
625
629
  var container = useRef(null);
626
630
 
627
- var _useState = useState({
631
+ var _useState2 = useState({
628
632
  title: null,
629
633
  body: null,
630
634
  show: false,
631
635
  id: null
632
636
  }),
633
- popover = _useState[0],
634
- setPopover = _useState[1];
637
+ popover = _useState2[0],
638
+ setPopover = _useState2[1];
635
639
 
636
- var _useState2 = useState(false),
637
- visible = _useState2[0],
638
- setVisible = _useState2[1];
640
+ var _useState3 = useState(false),
641
+ visible = _useState3[0],
642
+ setVisible = _useState3[1];
639
643
 
644
+ var defaultWidth = 375;
640
645
  useEffect(function () {
641
646
  if (entry && entry.boundingClientRect && entry.boundingClientRect.y < 0) {
642
647
  setVisible(true);
@@ -658,6 +663,25 @@ var DotsOnImage = function DotsOnImage(_ref) {
658
663
  return document.removeEventListener('click', handleClickOutside);
659
664
  };
660
665
  }, [popover]);
666
+ useEffect(function () {
667
+ setDotSize();
668
+ window.addEventListener('resize', setDotSize);
669
+ return function () {
670
+ return document.removeEventListener('resize', setDotSize);
671
+ };
672
+ }, [visible]);
673
+
674
+ var setDotSize = function setDotSize() {
675
+ var width = window.innerWidth;
676
+
677
+ if (width < defaultWidth) {
678
+ var _ratio = width / defaultWidth;
679
+
680
+ setRatio(_ratio);
681
+ } else {
682
+ setRatio(1);
683
+ }
684
+ };
661
685
 
662
686
  var handleClickOutside = function handleClickOutside(event) {
663
687
  var path = event.composedPath();
@@ -705,13 +729,18 @@ var DotsOnImage = function DotsOnImage(_ref) {
705
729
  }), React.createElement("div", {
706
730
  ref: container
707
731
  }, dots.map(function (dot) {
708
- return React.createElement("button", {
709
- className: makeClassName([[styles$7.dot, true], [styles$7.isActive, dot.id === popover.id]]),
710
- type: "button",
732
+ return React.createElement("div", {
733
+ className: styles$7.dot,
711
734
  key: dot.id,
712
735
  style: {
713
736
  top: dot.position.y + "%",
714
737
  left: dot.position.x + "%",
738
+ transform: "scale(" + ratio + ") translate(-" + 50 / ratio + "%, -" + 50 / ratio + "%)"
739
+ }
740
+ }, React.createElement("button", {
741
+ className: makeClassName([[styles$7.marker, true], [styles$7.isActive, dot.id === popover.id]]),
742
+ type: "button",
743
+ style: {
715
744
  backgroundColor: dot.icon.color
716
745
  },
717
746
  onClick: function onClick() {
@@ -721,7 +750,7 @@ var DotsOnImage = function DotsOnImage(_ref) {
721
750
  dangerouslySetInnerHTML: {
722
751
  __html: dot.icon.svg_string
723
752
  }
724
- }), dot.icon.type === 'number' && dot.icon.number);
753
+ }), dot.icon.type === 'number' && dot.icon.number));
725
754
  }), popover.show && React.createElement(React.Fragment, null, viewportSize().width >= MediaQuerySizes.LANDSCAPE_TABLET ? React.createElement("div", {
726
755
  className: makeClassName([[styles$7.popover, true], [styles$7[popover.side], !!popover.side], [styles$7[popover.align], !!popover.align]]),
727
756
  style: popover.style