@bigbinary/neeto-site-blocks 1.10.12 → 1.10.13

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.cjs.js CHANGED
@@ -11,8 +11,8 @@ var _defineProperty$1 = require('@babel/runtime/helpers/defineProperty');
11
11
  var neetoCist = require('@bigbinary/neeto-cist');
12
12
  var ramda = require('ramda');
13
13
  var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
14
- var _taggedTemplateLiteral = require('@babel/runtime/helpers/taggedTemplateLiteral');
15
14
  var reactFrameComponent = require('react-frame-component');
15
+ var _taggedTemplateLiteral = require('@babel/runtime/helpers/taggedTemplateLiteral');
16
16
  var _toConsumableArray = require('@babel/runtime/helpers/toConsumableArray');
17
17
  var _asyncToGenerator = require('@babel/runtime/helpers/asyncToGenerator');
18
18
  var _regeneratorRuntime = require('@babel/runtime/regenerator');
@@ -13952,6 +13952,8 @@ var useElementClick = function useElementClick(_ref) {
13952
13952
  index = _ref$index === void 0 ? undefined : _ref$index,
13953
13953
  _ref$isTitle = _ref.isTitle,
13954
13954
  isTitle = _ref$isTitle === void 0 ? false : _ref$isTitle;
13955
+ var _useFrame = reactFrameComponent.useFrame(),
13956
+ iframeDocument = _useFrame.document;
13955
13957
  var getScrollableParent = function getScrollableParent(element) {
13956
13958
  if (!element) return null;
13957
13959
  var isScrollable = function isScrollable(el) {
@@ -13981,11 +13983,24 @@ var useElementClick = function useElementClick(_ref) {
13981
13983
  };
13982
13984
  scrollableParent.scrollTo(scrollOptions);
13983
13985
  };
13986
+ var addHighlightClass = function addHighlightClass(id) {
13987
+ var previousHighlightedElement = iframeDocument === null || iframeDocument === void 0 ? void 0 : iframeDocument.querySelector(".persist-highlight");
13988
+ if (previousHighlightedElement) {
13989
+ previousHighlightedElement.classList.remove("persist-highlight");
13990
+ }
13991
+
13992
+ // Add the 'persist-highlight' class to the target element
13993
+ var targetElement = iframeDocument === null || iframeDocument === void 0 ? void 0 : iframeDocument.getElementById(id);
13994
+ if (targetElement) {
13995
+ targetElement.classList.add("persist-highlight");
13996
+ }
13997
+ };
13984
13998
 
13985
13999
  // This function is used as the click handler for "Link" and "Button" elements in the to highlight the element
13986
14000
  var handleClick = function handleClick(event) {
13987
14001
  event.preventDefault();
13988
14002
  if (!id) return;
14003
+ addHighlightClass(id);
13989
14004
  setTimeout(function () {
13990
14005
  var accordion = document.querySelector("[data-accordion-id=".concat(id === null || id === void 0 ? void 0 : id.replace(/-[^-]+$/, ""), "]"));
13991
14006
  var element = document.querySelector("[data-element-id=".concat(id, "]"));
@@ -14026,6 +14041,8 @@ var useElementClick = function useElementClick(_ref) {
14026
14041
 
14027
14042
  // This function is used as the click handler for "Typography" to highlight the element
14028
14043
  var handleTitleClick = function handleTitleClick() {
14044
+ if (!id) return;
14045
+ addHighlightClass(id);
14029
14046
  setTimeout(function () {
14030
14047
  if (!document) return;
14031
14048
  var accordion = document.querySelector("[data-accordion-id=".concat(id === null || id === void 0 ? void 0 : id.replace(/-[^-]+$/, ""), "]"));
@@ -14075,7 +14092,9 @@ var useElementClick = function useElementClick(_ref) {
14075
14092
 
14076
14093
  // This function is used as the click handler for "Image" elements to highlight the element`
14077
14094
  var handleImageClick = function handleImageClick(event) {
14095
+ if (!id) return;
14078
14096
  event.preventDefault();
14097
+ addHighlightClass(id);
14079
14098
  setTimeout(function () {
14080
14099
  if (neetoCist.isPresent(index)) {
14081
14100
  var accordion = document.querySelector("[data-accordion-id=".concat(id === null || id === void 0 ? void 0 : id.replace(/-[^-]+$/, ""), "]"));
@@ -14161,6 +14180,7 @@ var StyledImageWithWrapper = function StyledImageWithWrapper(_ref2) {
14161
14180
  }),
14162
14181
  handleImageClick = _useElementClick.handleImageClick;
14163
14182
  return /*#__PURE__*/React__default["default"].createElement(StyledWrapper, {
14183
+ id: id,
14164
14184
  className: classnames__default["default"]("flex justify-center", _defineProperty__default["default"]({
14165
14185
  "neeto-site-highlight__element": disableButtonAndLinks && !isAddNewPane
14166
14186
  }, wrapperClassName, wrapperClassName)),
@@ -15394,7 +15414,8 @@ var Button = function Button(_ref) {
15394
15414
  href: to !== null && to !== void 0 ? to : "",
15395
15415
  rel: "noreferrer",
15396
15416
  isButton: true,
15397
- onClick: disableButtonAndLinks && handleClick
15417
+ onClick: disableButtonAndLinks && handleClick,
15418
+ id: id
15398
15419
  };
15399
15420
  if (action === "external") {
15400
15421
  return /*#__PURE__*/React__default["default"].createElement(StyledAnchor, _extends__default["default"]({}, commonProps, {
@@ -15510,7 +15531,8 @@ var LinkElement = function LinkElement(_ref) {
15510
15531
  percentage: 0.1,
15511
15532
  isHighlighted: isHighlighted,
15512
15533
  disableHovering: disableHovering,
15513
- onClick: handleLinkClick
15534
+ onClick: handleLinkClick,
15535
+ id: id
15514
15536
  }, otherProps);
15515
15537
  if (action === "external") {
15516
15538
  return /*#__PURE__*/React__default["default"].createElement(StyledAnchor, _extends__default["default"]({}, commonProps, {