@bigbinary/neeto-site-blocks 1.10.12 → 1.10.14

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, {
@@ -15849,7 +15871,7 @@ var Typography = function Typography(_ref) {
15849
15871
  id: id,
15850
15872
  as: isTitle ? component : COMPONENTS.div,
15851
15873
  design: style,
15852
- className: classnames__default["default"]("neeto-site-typography break-words", className, {
15874
+ className: classnames__default["default"]("neeto-site-typography text-wrap", className, {
15853
15875
  "neeto-site-highlight__element": disableButtonAndLinks && !isAddNewPane
15854
15876
  }),
15855
15877
  onClick: !isAddNewPane && handleTitleClick
@@ -21358,7 +21380,7 @@ var CardsWithImage = function CardsWithImage(_ref) {
21358
21380
  isAddMoreRequired = properties.isAddMoreRequired,
21359
21381
  src = properties.backgroundImage.src;
21360
21382
  var baseClasses = "grid grid-cols-12 gap-y-6 items-center ns-card";
21361
- var gridBaseClasses = "relative sm:col-span-6 lg:col-span-4 col-span-12 h-40 justify-center items-center ns-card-animation cursor-pointer";
21383
+ var gridBaseClasses = "relative sm:col-span-6 lg:col-span-4 col-span-12 justify-center items-center ns-card-animation cursor-pointer";
21362
21384
  return /*#__PURE__*/React__default["default"].createElement(BlockWrapper, {
21363
21385
  className: className,
21364
21386
  enableAnimation: enableAnimation,
@@ -21375,7 +21397,7 @@ var CardsWithImage = function CardsWithImage(_ref) {
21375
21397
  id: "cards-with-image-title",
21376
21398
  style: design.title
21377
21399
  }, otherProps), title), /*#__PURE__*/React__default["default"].createElement(Typography$1, _extends__default["default"]({
21378
- className: "col-span-12 sm:col-span-8 sm:col-start-3",
21400
+ className: "col-span-12",
21379
21401
  id: "cards-with-image-description",
21380
21402
  style: design.description
21381
21403
  }, otherProps), description), /*#__PURE__*/React__default["default"].createElement("div", {
@@ -21415,7 +21437,7 @@ var CardsWithImage = function CardsWithImage(_ref) {
21415
21437
  id: "cards-with-image-".concat(index, "-title"),
21416
21438
  style: design.cardTitle
21417
21439
  }, otherProps), title)), /*#__PURE__*/React__default["default"].createElement("div", {
21418
- className: "absolute bottom-0 right-0 flex items-end justify-end"
21440
+ className: "col-span-2 flex h-full flex-col justify-end"
21419
21441
  }, /*#__PURE__*/React__default["default"].createElement(StyledImage$1, {
21420
21442
  disableButtonAndLinks: disableButtonAndLinks,
21421
21443
  image: image,
@@ -21425,18 +21447,18 @@ var CardsWithImage = function CardsWithImage(_ref) {
21425
21447
  id: "cards-with-image-".concat(index, "-image"),
21426
21448
  isAddNewPane: otherProps.isAddNewPane,
21427
21449
  src: imageUrl,
21428
- wrapperClassName: "grid h-full w-full"
21450
+ wrapperClassName: "flex flex-col items-end"
21429
21451
  }))));
21430
21452
  }), isAddMoreRequired && /*#__PURE__*/React__default["default"].createElement(MotionWrapper, {
21431
21453
  enableAnimation: enableAnimation,
21432
- className: "ns-card-animation col-span-12 flex h-40 items-center justify-center transition-all duration-300 ease-in-out sm:col-span-6 lg:col-span-4",
21454
+ className: "ns-card-animation col-span-12 flex items-center justify-center transition-all duration-300 ease-in-out sm:col-span-6 lg:col-span-4",
21433
21455
  design: _objectSpread$g(_objectSpread$g({}, design.card), {}, {
21434
21456
  paddingHorizontal: 0,
21435
21457
  paddingVertical: 0
21436
21458
  })
21437
21459
  }, /*#__PURE__*/React__default["default"].createElement(Link, _extends__default["default"]({
21438
21460
  disableHovering: true,
21439
- className: "col-span-12 flex items-center justify-center gap-x-2",
21461
+ className: "col-span-12 flex items-center justify-center gap-x-2 p-9",
21440
21462
  style: design.cardLink
21441
21463
  }, _objectSpread$g(_objectSpread$g({}, addMore), {}, {
21442
21464
  disableButtonAndLinks: disableButtonAndLinks