@thecb/components 7.7.8-beta.9 → 7.8.0

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
@@ -24462,73 +24462,6 @@ var useOutsideClickHook = function useOutsideClickHook(handler) {
24462
24462
  return ref;
24463
24463
  };
24464
24464
 
24465
- /*
24466
- Hook that determines whether every element in an array of DOM selectors is fully present
24467
- within the user's current viewport.
24468
-
24469
- (elements: Array<String>) => Boolean;
24470
-
24471
- Takes an array of strings that correspond to DOM selectors. Examples:
24472
- "#submit-button", ".module-small", "h2.alert-title"
24473
-
24474
- The document query function will return the *first* element in the document that matches
24475
- the string given.
24476
-
24477
- A combination string of multiple selectors can also be provided as an item in the array, e.g.:
24478
- ".alert-info, .alert-warning, .alert-error". This will return the first element that matches *any* of the provided selectors.
24479
-
24480
- If the element is present in the DOM (domEL !== null), the function examines the element's bounding box
24481
- to determine if the element is within the viewport. If any portion of the element is outside of
24482
- the viewport, the function returns false.
24483
-
24484
- If all elements that exist are within the viewport, the function returns true.
24485
- */
24486
-
24487
- var useCheckElementsInViewport = function useCheckElementsInViewport() {
24488
- var elements = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
24489
- var elementsVisible = true;
24490
- var timeoutID = false;
24491
- var delay = 250;
24492
-
24493
- var _useState = React.useState(window.innerWidth || document.documentElement.clientWidth),
24494
- _useState2 = _slicedToArray(_useState, 2),
24495
- viewportWidth = _useState2[0],
24496
- setViewportWidth = _useState2[1];
24497
-
24498
- var _useState3 = React.useState(window.innerHeight || document.documentElement.clientHeight),
24499
- _useState4 = _slicedToArray(_useState3, 2),
24500
- viewportHeight = _useState4[0],
24501
- setViewportHeight = _useState4[1];
24502
-
24503
- var updateViewportValues = function updateViewportValues() {
24504
- clearTimeout(timeoutID);
24505
- timeoutID = setTimeout(function () {
24506
- setViewportWidth(window.innerWidth || document.documentElement.clientWidth);
24507
- setViewportHeight(window.innerHeight || document.documentElement.clientHeight);
24508
- }, delay);
24509
- };
24510
-
24511
- React.useEffect(function () {
24512
- window.addEventListener("resize", updateViewportValues);
24513
- return function () {
24514
- clearTimeout(timeoutID);
24515
- };
24516
- }, []);
24517
- React.useLayoutEffect(function () {
24518
- elements.forEach(function (element) {
24519
- var domEl = document.querySelector(element);
24520
- var boundingBox = domEl === null || domEl === void 0 ? void 0 : domEl.getBoundingClientRect(); // Skip any elements not in the DOM
24521
-
24522
- if (domEl !== null) {
24523
- if (boundingBox.top < 0 || boundingBox.left < 0 || boundingBox.right > viewportWidth || boundingBox.bottom > viewportHeight) {
24524
- elementsVisible = false;
24525
- }
24526
- }
24527
- });
24528
- }, [elements, viewportWidth, viewportHeight]);
24529
- return elementsVisible;
24530
- };
24531
-
24532
24465
 
24533
24466
 
24534
24467
  var index$4 = /*#__PURE__*/Object.freeze({
@@ -24537,8 +24470,7 @@ var index$4 = /*#__PURE__*/Object.freeze({
24537
24470
  general: general,
24538
24471
  theme: themeUtils,
24539
24472
  useFocusInvalidInput: useFocusInvalidInput,
24540
- useOutsideClick: useOutsideClickHook,
24541
- useCheckElementsInViewport: useCheckElementsInViewport
24473
+ useOutsideClick: useOutsideClickHook
24542
24474
  });
24543
24475
 
24544
24476
  var hoverColor$4 = "#116285";
@@ -25390,6 +25322,59 @@ var Heading = function Heading(_ref) {
25390
25322
 
25391
25323
  var Heading$1 = themeComponent(Heading, "Heading", fallbackValues$n, "h1");
25392
25324
 
25325
+ var Image = styled__default.img.withConfig({
25326
+ displayName: "ImageBoxstyled__Image",
25327
+ componentId: "sc-8lg9y6-0"
25328
+ })(["width:", ";height:", ";object-fit:", ";object-position:", ";"], function (_ref) {
25329
+ var _ref$width = _ref.width,
25330
+ width = _ref$width === void 0 ? "100%" : _ref$width;
25331
+ return width;
25332
+ }, function (_ref2) {
25333
+ var _ref2$height = _ref2.height,
25334
+ height = _ref2$height === void 0 ? "100%" : _ref2$height;
25335
+ return height;
25336
+ }, function (_ref3) {
25337
+ var _ref3$objectFit = _ref3.objectFit,
25338
+ objectFit = _ref3$objectFit === void 0 ? "cover" : _ref3$objectFit;
25339
+ return objectFit;
25340
+ }, function (_ref4) {
25341
+ var _ref4$objectPosition = _ref4.objectPosition,
25342
+ objectPosition = _ref4$objectPosition === void 0 ? "center" : _ref4$objectPosition;
25343
+ return objectPosition;
25344
+ });
25345
+
25346
+ var ImageBox = function ImageBox(_ref) {
25347
+ var image = _ref.image,
25348
+ minHeight = _ref.minHeight,
25349
+ minWidth = _ref.minWidth,
25350
+ maxWidth = _ref.maxWidth,
25351
+ borderRadius = _ref.borderRadius,
25352
+ imgWidth = _ref.imgWidth,
25353
+ imgHeight = _ref.imgHeight,
25354
+ objectFit = _ref.objectFit,
25355
+ objectPosition = _ref.objectPosition;
25356
+ var boxMaxWidth = maxWidth || minWidth;
25357
+ var _image$url = image.url,
25358
+ url = _image$url === void 0 ? "" : _image$url,
25359
+ _image$altText = image.altText,
25360
+ altText = _image$altText === void 0 ? "" : _image$altText;
25361
+ return /*#__PURE__*/React__default.createElement(Box, {
25362
+ padding: "0",
25363
+ minWidth: minWidth,
25364
+ minHeight: minHeight,
25365
+ maxWidth: boxMaxWidth,
25366
+ borderRadius: borderRadius,
25367
+ extraStyles: "height: ".concat(minHeight, ";")
25368
+ }, /*#__PURE__*/React__default.createElement(Image, {
25369
+ width: imgWidth,
25370
+ height: imgHeight,
25371
+ objectFit: objectFit,
25372
+ objectPosition: objectPosition,
25373
+ src: url,
25374
+ alt: altText
25375
+ }));
25376
+ };
25377
+
25393
25378
  var Jumbo = function Jumbo(_ref) {
25394
25379
  var showButton = _ref.showButton,
25395
25380
  heading = _ref.heading,
@@ -40354,8 +40339,6 @@ var HighlightTabRow = function HighlightTabRow(_ref) {
40354
40339
  useOrderedList: useOrderedList,
40355
40340
  useUnorderedList: useUnorderedList
40356
40341
  }, repeat( /*#__PURE__*/React__default.createElement(Box, null), boxesBefore), tabs.map(function (t, i) {
40357
- var _t$toLowerCase;
40358
-
40359
40342
  return /*#__PURE__*/React__default.createElement(Box, {
40360
40343
  key: t,
40361
40344
  borderSize: "3px",
@@ -40369,8 +40352,7 @@ var HighlightTabRow = function HighlightTabRow(_ref) {
40369
40352
  textAlign: "center",
40370
40353
  color: themeValues.textColor,
40371
40354
  weight: FONT_WEIGHT_SEMIBOLD,
40372
- extraStyles: "display: block; white-space: nowrap;",
40373
- id: "".concat(t === null || t === void 0 ? void 0 : (_t$toLowerCase = t.toLowerCase()) === null || _t$toLowerCase === void 0 ? void 0 : _t$toLowerCase.replace(/\s/g, "-"), "-tab-text")
40355
+ extraStyles: "display: block; white-space: nowrap;"
40374
40356
  }, t));
40375
40357
  }), repeat( /*#__PURE__*/React__default.createElement(Box, null), boxesAfter))));
40376
40358
  };
@@ -45564,27 +45546,19 @@ var Module = function Module(_ref) {
45564
45546
  variant = _ref$variant === void 0 ? "default" : _ref$variant,
45565
45547
  fontSize = _ref.fontSize,
45566
45548
  as = _ref.as,
45567
- _ref$titleID = _ref.titleID,
45568
- titleID = _ref$titleID === void 0 ? "" : _ref$titleID,
45569
- rightTitleContent = _ref.rightTitleContent,
45570
45549
  children = _ref.children;
45571
45550
  var themedFontSize = variant === "small" ? "1.25rem" : variant === "default" ? "1.375rem" : "2rem";
45572
45551
  var computedFontSize = fontSize || themedFontSize;
45573
45552
  var themedElemType = variant === "small" ? "h6" : variant === "default" ? "h5" : "h2";
45574
45553
  var computedElemType = as || themedElemType;
45575
- var headingText = /*#__PURE__*/React__default.createElement(Title$1, {
45554
+ return /*#__PURE__*/React__default.createElement(React.Fragment, null, heading && /*#__PURE__*/React__default.createElement(Title$1, {
45576
45555
  weight: themeValues.fontWeight,
45577
45556
  color: themeValues.fontColor,
45578
45557
  margin: "".concat(spacing, " 0 ").concat(themeValues.titleSpacing, " 0"),
45579
45558
  textAlign: themeValues.textAlign,
45580
45559
  as: computedElemType,
45581
- extraStyles: "font-size: ".concat(computedFontSize, ";"),
45582
- id: titleID
45583
- }, heading);
45584
- return /*#__PURE__*/React__default.createElement(React.Fragment, null, heading && !rightTitleContent && headingText, heading && rightTitleContent && /*#__PURE__*/React__default.createElement(Cluster, {
45585
- justify: "center",
45586
- align: "space-between"
45587
- }, headingText, rightTitleContent), /*#__PURE__*/React__default.createElement(Box, {
45560
+ extraStyles: "font-size: ".concat(computedFontSize, ";")
45561
+ }, heading), /*#__PURE__*/React__default.createElement(Box, {
45588
45562
  padding: "0 0 ".concat(spacingBottom)
45589
45563
  }, /*#__PURE__*/React__default.createElement(Box, {
45590
45564
  padding: padding,
@@ -48990,6 +48964,7 @@ exports.HighlightTabRow = HighlightTabRow$1;
48990
48964
  exports.HistoryIconSmall = HistoryIconSmall$1;
48991
48965
  exports.IconAdd = IconAdd;
48992
48966
  exports.IconQuitLarge = IconQuitLarge;
48967
+ exports.ImageBox = ImageBox;
48993
48968
  exports.Imposter = Imposter;
48994
48969
  exports.InternalLink = InternalLink;
48995
48970
  exports.Jumbo = Jumbo$1;