@thecb/components 11.10.1-beta.1 → 11.11.0-beta.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
@@ -25921,7 +25921,8 @@ var FormInput = function FormInput(_ref15) {
25921
25921
  padding: "0"
25922
25922
  }, helperModal ? /*#__PURE__*/React__default.createElement(Cluster, {
25923
25923
  justify: "space-between",
25924
- align: "center"
25924
+ align: "center",
25925
+ overflow: true
25925
25926
  }, labelDisplayOverride ? labelDisplayOverride : /*#__PURE__*/React__default.createElement(Text$1, {
25926
25927
  as: "label",
25927
25928
  color: themeValues.labelColor,
@@ -51455,7 +51456,6 @@ var hoverColor$6 = SAPPHIRE_BLUE;
51455
51456
  var activeColor$b = PEACOCK_BLUE;
51456
51457
  var linkColor$6 = MATISSE_BLUE;
51457
51458
  var borderColor$7 = "rgba(255, 255, 255, 0.85)";
51458
- var TOOLTIP_THEME_SOURCE = "Button";
51459
51459
  var fallbackValues$12 = {
51460
51460
  borderColor: borderColor$7,
51461
51461
  linkColor: linkColor$6,
@@ -51484,29 +51484,33 @@ var Tooltip = function Tooltip(_ref) {
51484
51484
  maxWidth = _ref$maxWidth === void 0 ? "100%" : _ref$maxWidth,
51485
51485
  _ref$height = _ref.height,
51486
51486
  height = _ref$height === void 0 ? "auto" : _ref$height,
51487
+ _ref$arrowDirection = _ref.arrowDirection,
51488
+ arrowDirection = _ref$arrowDirection === void 0 ? "down" : _ref$arrowDirection,
51487
51489
  _ref$contentPosition = _ref.contentPosition,
51488
51490
  contentPosition = _ref$contentPosition === void 0 ? {
51489
- top: "-110px",
51491
+ top: "auto",
51490
51492
  right: "auto",
51491
- bottom: "auto",
51492
- left: "-225px"
51493
+ bottom: "calc(100% + 8px)",
51494
+ // always sits above the trigger + 8px gap for arrow
51495
+ left: "50%",
51496
+ // anchors to horizontal center of trigger
51497
+ transform: "translateX(-50%)" // shifts left by half tooltip's own width → centered
51493
51498
  } : _ref$contentPosition,
51494
- _ref$arrowDirection = _ref.arrowDirection,
51495
- arrowDirection = _ref$arrowDirection === void 0 ? "down" : _ref$arrowDirection,
51496
51499
  _ref$arrowPosition = _ref.arrowPosition,
51497
51500
  arrowPosition = _ref$arrowPosition === void 0 ? {
51498
51501
  arrowTop: "auto",
51499
- arrowRight: "10px",
51502
+ arrowRight: "auto",
51500
51503
  arrowBottom: "-8px",
51501
- arrowLeft: "auto"
51502
- } : _ref$arrowPosition;
51504
+ arrowLeft: "calc(50% - 8px)" // centers the 0-width arrow element (16px wide border)
51505
+ } : _ref$arrowPosition,
51506
+ arrowColor = _ref.arrowColor;
51503
51507
  var closeTimeoutRef = React.useRef(null);
51504
51508
  var _useState = React.useState(false),
51505
51509
  _useState2 = _slicedToArray(_useState, 2),
51506
51510
  tooltipOpen = _useState2[0],
51507
51511
  setTooltipOpen = _useState2[1];
51508
51512
  var themeContext = React.useContext(styled.ThemeContext);
51509
- var themeValues = createThemeValues(themeContext, fallbackValues$12, TOOLTIP_THEME_SOURCE);
51513
+ var themeValues = createThemeValues(themeContext, fallbackValues$12, "Tooltip");
51510
51514
  var top = contentPosition.top,
51511
51515
  right = contentPosition.right,
51512
51516
  bottom = contentPosition.bottom,
@@ -51546,7 +51550,12 @@ var Tooltip = function Tooltip(_ref) {
51546
51550
  }, []);
51547
51551
  var renderTrigger = function renderTrigger() {
51548
51552
  if (hasCustomTrigger && children) {
51549
- return /*#__PURE__*/React__default.cloneElement(React__default.Children.only(children), {
51553
+ return /*#__PURE__*/React__default.createElement(Box, {
51554
+ padding: "0",
51555
+ extraStyles: "cursor: pointer;",
51556
+ tabIndex: "0",
51557
+ role: "button",
51558
+ "data-qa": "tooltip-trigger-".concat(tooltipID),
51550
51559
  "aria-describedby": tooltipID,
51551
51560
  onFocus: function onFocus() {
51552
51561
  return handleToggleTooltip(true);
@@ -51555,7 +51564,7 @@ var Tooltip = function Tooltip(_ref) {
51555
51564
  return handleToggleTooltip(false);
51556
51565
  },
51557
51566
  onKeyDown: handleKeyDown
51558
- });
51567
+ }, children);
51559
51568
  }
51560
51569
  return /*#__PURE__*/React__default.createElement(ButtonWithAction, {
51561
51570
  action: noop$1,
@@ -51573,7 +51582,7 @@ var Tooltip = function Tooltip(_ref) {
51573
51582
  },
51574
51583
  "data-qa": "tooltip-trigger-".concat(tooltipID),
51575
51584
  text: triggerText,
51576
- extraStyles: "\n color: ".concat(themeValues.linkColor, ";\n &:hover { color: ").concat(themeValues.hoverColor, "; text-decoration: none;}\n &:active, &:focus { color: ").concat(themeValues.activeColor, ";text-decoration: none;}\n button, span, &:hover span { text-decoration: none; }\n ")
51585
+ extraStyles: "\n color: ".concat(themeValues.linkColor, ";\n cursor: pointer;\n &:hover { color: ").concat(themeValues.hoverColor, "; text-decoration: none; }\n &:active, &:focus { color: ").concat(themeValues.activeColor, "; text-decoration: none; }\n button, span, &:hover span { text-decoration: none; } \n ")
51577
51586
  });
51578
51587
  };
51579
51588
  return /*#__PURE__*/React__default.createElement(Box, {
@@ -51598,9 +51607,10 @@ var Tooltip = function Tooltip(_ref) {
51598
51607
  color: themeValues.linkColor
51599
51608
  }, content) : content, /*#__PURE__*/React__default.createElement(Box, {
51600
51609
  padding: "0",
51601
- extraStyles: "\n position: absolute;\n content: \"\";\n width: 0;\n height: 0;\n ".concat(arrowBorder(themeValues.borderColor, arrowDirection, "8px"), ";\n filter: drop-shadow(2px 8px 14px black);\n bottom: ").concat(arrowBottom, ";\n right: ").concat(arrowRight, ";\n top: ").concat(arrowTop, ";\n left: ").concat(arrowLeft, ";\n ")
51610
+ extraStyles: "\n position: absolute;\n content: \"\";\n width: 0;\n height: 0;\n ".concat(arrowBorder(arrowColor || themeValues.borderColor, arrowDirection, "8px"), ";\n filter: drop-shadow(2px 8px 14px black);\n bottom: ").concat(arrowBottom, ";\n right: ").concat(arrowRight, ";\n top: ").concat(arrowTop, ";\n left: ").concat(arrowLeft, ";\n ")
51602
51611
  })));
51603
51612
  };
51613
+ var Tooltip$1 = themeComponent(Tooltip, "Tooltip", fallbackValues$12);
51604
51614
 
51605
51615
  var pageBackground = "#FBFCFD";
51606
51616
  var fallbackValues$13 = {
@@ -52161,7 +52171,7 @@ exports.TimeoutImage = TimeoutImage;
52161
52171
  exports.Title = Title$1;
52162
52172
  exports.ToastNotification = ToastNotification;
52163
52173
  exports.ToggleSwitch = ToggleSwitch$1;
52164
- exports.Tooltip = Tooltip;
52174
+ exports.Tooltip = Tooltip$1;
52165
52175
  exports.TrashIcon = TrashIcon$1;
52166
52176
  exports.TrashIconV2 = TrashIconV2$1;
52167
52177
  exports.TurnstileWidget = TurnstileWidget;