@thecb/components 11.11.0-beta.5 → 11.11.0-beta.8

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
@@ -26304,7 +26304,7 @@ var FormattedAddress = function FormattedAddress(_ref) {
26304
26304
  var FormattedAddress$1 = themeComponent(FormattedAddress, "FormattedAddress", fallbackValues$n, "default");
26305
26305
 
26306
26306
  var textColor$1 = "".concat(CHARADE_GREY);
26307
- var autopayTextColor = "".concat(REGENT_GREY);
26307
+ var autopayTextColor = "".concat(SEA_GREEN);
26308
26308
  var fallbackValues$o = {
26309
26309
  textColor: textColor$1,
26310
26310
  autopayTextColor: autopayTextColor
@@ -26340,8 +26340,8 @@ var FormattedBankAccount = function FormattedBankAccount(_ref2) {
26340
26340
  }, "Savings Account ending in ", lastFour), autoPay && /*#__PURE__*/React__default.createElement(Text$1, {
26341
26341
  variant: "p",
26342
26342
  color: themeValues.autopayTextColor,
26343
- extraStyles: "font-style: italic;"
26344
- }, "Autopay Enabled")));
26343
+ extraStyles: "font-style: italic; font-size: .75rem;"
26344
+ }, "Autopay On")));
26345
26345
  };
26346
26346
  var FormattedBankAccount$1 = themeComponent(FormattedBankAccount, "FormattedBankAccount", fallbackValues$o);
26347
26347
 
@@ -26390,7 +26390,7 @@ var CardType = function CardType(_ref) {
26390
26390
  };
26391
26391
 
26392
26392
  var textColor$2 = "".concat(CHARADE_GREY);
26393
- var autopayTextColor$1 = "".concat(REGENT_GREY);
26393
+ var autopayTextColor$1 = "".concat(SEA_GREEN);
26394
26394
  var fallbackValues$p = {
26395
26395
  textColor: textColor$2,
26396
26396
  autopayTextColor: autopayTextColor$1
@@ -26419,13 +26419,15 @@ var renderCardStatus = function renderCardStatus(expirationStatus, expireDate) {
26419
26419
  return /*#__PURE__*/React__default.createElement(Text$1, {
26420
26420
  as: as,
26421
26421
  variant: "pXS",
26422
- color: ASH_GREY,
26422
+ fontSize: ".75rem",
26423
+ color: STORM_GREY,
26423
26424
  extraStyles: "text-align: ".concat(textAlign, "; margin: ").concat(textMargin, ";")
26424
26425
  }, "Exp Date ", expireDate);
26425
26426
  case EXPIRING_SOON:
26426
26427
  return /*#__PURE__*/React__default.createElement(Text$1, {
26427
26428
  as: as,
26428
26429
  variant: "pXS",
26430
+ fontSize: ".75rem",
26429
26431
  color: FIRE_YELLOW,
26430
26432
  extraStyles: "text-align: ".concat(textAlign, "; margin: ").concat(textMargin, ";")
26431
26433
  }, "Expiring Soon ", expireDate);
@@ -26433,7 +26435,8 @@ var renderCardStatus = function renderCardStatus(expirationStatus, expireDate) {
26433
26435
  return /*#__PURE__*/React__default.createElement(Text$1, {
26434
26436
  as: as,
26435
26437
  variant: "pXS",
26436
- color: ASH_GREY,
26438
+ fontSize: ".75rem",
26439
+ color: STORM_GREY,
26437
26440
  extraStyles: "text-align: ".concat(textAlign, "; margin: ").concat(textMargin, ";")
26438
26441
  }, "Expired");
26439
26442
  }
@@ -26486,8 +26489,8 @@ var FormattedCreditCard = function FormattedCreditCard(_ref) {
26486
26489
  }, "Card ending in ".concat(lastFour)), expireDate && /*#__PURE__*/React__default.createElement(React.Fragment, null, renderCardStatus(expirationStatus, expireDate, "left", "p"))), autoPay && /*#__PURE__*/React__default.createElement(Text$1, {
26487
26490
  variant: "p",
26488
26491
  color: themeValues.autopayTextColor,
26489
- extraStyles: "font-style: italic;"
26490
- }, "Autopay Enabled")));
26492
+ extraStyles: "font-style: italic; font-size: .75rem;"
26493
+ }, "Autopay On")));
26491
26494
  };
26492
26495
  var FormattedCreditCard$1 = themeComponent(FormattedCreditCard, "FormattedCreditCard", fallbackValues$p);
26493
26496
 
@@ -40893,6 +40896,7 @@ var EditableList = function EditableList(_ref) {
40893
40896
  _ref$canAdd = _ref.canAdd,
40894
40897
  canAdd = _ref$canAdd === void 0 ? true : _ref$canAdd,
40895
40898
  addItem = _ref.addItem,
40899
+ addItemDestination = _ref.addItemDestination,
40896
40900
  removeItem = _ref.removeItem,
40897
40901
  editItem = _ref.editItem,
40898
40902
  itemName = _ref.itemName,
@@ -41000,6 +41004,8 @@ var EditableList = function EditableList(_ref) {
41000
41004
  padding: items.length === 0 ? "0" : "1rem 0 0"
41001
41005
  }, /*#__PURE__*/React__default.createElement(Placeholder$1, {
41002
41006
  text: addText,
41007
+ isLink: !!addItemDestination,
41008
+ destination: addItemDestination,
41003
41009
  action: addItem,
41004
41010
  dataQa: "Add " + qaPrefix,
41005
41011
  "aria-label": addText,
@@ -48089,7 +48095,7 @@ var TermsAndConditionsModal = function TermsAndConditionsModal(_ref) {
48089
48095
  weight: themeValues.fontWeight,
48090
48096
  hoverStyles: themeValues.modalLinkHoverFocus,
48091
48097
  textDecoration: themeValues.modalLinkTextDecoration,
48092
- extraStyles: "display: inline-block; width: fit-content; cursor: pointer",
48098
+ extraStyles: "display: inline-block; width: fit-content; cursor: pointer; min-height: 24px; line-height: 24px;",
48093
48099
  role: "button" // This should always be a "button" since it opens a modal
48094
48100
  ,
48095
48101
  className: "modal-trigger"
@@ -49003,7 +49009,7 @@ var InnerRadioSection = function InnerRadioSection(_ref) {
49003
49009
  padding: section.titleIcon ? "0 0 0 8px" : "0"
49004
49010
  }, /*#__PURE__*/React__default.createElement(Text$1, {
49005
49011
  as: "label",
49006
- htmlFor: "radio-input-".concat(idString(section)),
49012
+ htmlFor: "radio-".concat(idString(section)),
49007
49013
  color: CHARADE_GREY
49008
49014
  }, section.title))), section.rightIcons && /*#__PURE__*/React__default.createElement(Cluster, {
49009
49015
  id: "right-icons-".concat(idString(section)),
@@ -51466,18 +51472,18 @@ var TurnstileWidget = /*#__PURE__*/React.forwardRef(function (_ref4, ref) {
51466
51472
  }, error)));
51467
51473
  });
51468
51474
 
51469
- var hoverColor$6 = SAPPHIRE_BLUE;
51470
- var activeColor$b = PEACOCK_BLUE;
51471
- var linkColor$6 = MATISSE_BLUE;
51472
- var borderColor$7 = "rgba(255, 255, 255, 0.85)";
51473
- var TOOLTIP_THEME_SOURCE = "Button";
51475
+ var hoverColor$6 = ROYAL_BLUE;
51476
+ var activeColor$b = CONGRESS_BLUE;
51477
+ var linkColor$6 = ROYAL_BLUE_VIVID;
51478
+ var textColor$5 = CHARADE_GREY;
51474
51479
  var fallbackValues$12 = {
51475
- borderColor: borderColor$7,
51476
51480
  linkColor: linkColor$6,
51477
51481
  hoverColor: hoverColor$6,
51478
- activeColor: activeColor$b
51482
+ activeColor: activeColor$b,
51483
+ textColor: textColor$5
51479
51484
  };
51480
51485
 
51486
+ var TOOLTIP_THEME_SOURCE = "Popover";
51481
51487
  var Tooltip = function Tooltip(_ref) {
51482
51488
  var tooltipID = _ref.tooltipID,
51483
51489
  children = _ref.children,
@@ -51515,8 +51521,11 @@ var Tooltip = function Tooltip(_ref) {
51515
51521
  arrowBottom: "-8px",
51516
51522
  arrowLeft: "auto"
51517
51523
  } : _ref$arrowPosition,
51518
- arrowColor = _ref.arrowColor;
51524
+ customTriggerRole = _ref.customTriggerRole,
51525
+ _ref$backgroundColor = _ref.backgroundColor,
51526
+ backgroundColor = _ref$backgroundColor === void 0 ? WHITE : _ref$backgroundColor;
51519
51527
  var closeTimeoutRef = React.useRef(null);
51528
+ var containerRef = React.useRef(null);
51520
51529
  var _useState = React.useState(false),
51521
51530
  _useState2 = _slicedToArray(_useState, 2),
51522
51531
  tooltipOpen = _useState2[0],
@@ -51541,6 +51550,85 @@ var Tooltip = function Tooltip(_ref) {
51541
51550
  handleToggleTooltip(false);
51542
51551
  }
51543
51552
  };
51553
+
51554
+ /**
51555
+ * Renders the tooltip trigger element.
51556
+ *
51557
+ * When `hasCustomTrigger` is true, the provided child element is cloned and
51558
+ * injected with the event handlers needed to control tooltip visibility:
51559
+ * - onFocus/onBlur: open and close for keyboard users
51560
+ * - onKeyDown: allows Escape to dismiss the tooltip
51561
+ * - onTouchStart: open on tap for touch/mobile users (onFocus is unreliable on touch)
51562
+ *
51563
+ * Mouse interactions (hover) are handled at the container level via
51564
+ * onMouseEnter/onMouseLeave, so they do not need to be injected here.
51565
+ *
51566
+ * Any existing event handlers on the child are preserved and called first,
51567
+ * so the child's own behavior is not overridden.
51568
+ *
51569
+ * When no custom trigger is provided, a default ButtonWithAction is rendered
51570
+ * using `triggerText` and `triggerButtonVariant`.
51571
+ */
51572
+ var renderTrigger = function renderTrigger() {
51573
+ if (hasCustomTrigger && !children) {
51574
+ console.warn("Tooltip: children prop is required when hasCustomTrigger is true");
51575
+ }
51576
+ if (hasCustomTrigger && children) {
51577
+ var _child$props, _child$props$tabIndex, _child$props2, _child$props3, _child$props4;
51578
+ var child = React__default.Children.only(children);
51579
+ // Capture the child's existing handlers before overwriting
51580
+ var _ref2 = (_child$props = child.props) !== null && _child$props !== void 0 ? _child$props : {},
51581
+ childOnFocus = _ref2.onFocus,
51582
+ childOnBlur = _ref2.onBlur,
51583
+ childOnKeyDown = _ref2.onKeyDown,
51584
+ childOnTouchStart = _ref2.onTouchStart;
51585
+ return /*#__PURE__*/React__default.cloneElement(child, {
51586
+ tabIndex: (_child$props$tabIndex = (_child$props2 = child.props) === null || _child$props2 === void 0 ? void 0 : _child$props2.tabIndex) !== null && _child$props$tabIndex !== void 0 ? _child$props$tabIndex : 0,
51587
+ style: _objectSpread2({
51588
+ cursor: "pointer"
51589
+ }, (_child$props3 = child.props) === null || _child$props3 === void 0 ? void 0 : _child$props3.style),
51590
+ onFocus: function onFocus(e) {
51591
+ childOnFocus === null || childOnFocus === void 0 || childOnFocus(e);
51592
+ handleToggleTooltip(true);
51593
+ },
51594
+ onBlur: function onBlur(e) {
51595
+ childOnBlur === null || childOnBlur === void 0 || childOnBlur(e);
51596
+ handleToggleTooltip(false);
51597
+ },
51598
+ onKeyDown: function onKeyDown(e) {
51599
+ childOnKeyDown === null || childOnKeyDown === void 0 || childOnKeyDown(e);
51600
+ handleKeyDown(e);
51601
+ },
51602
+ onTouchStart: function onTouchStart(e) {
51603
+ childOnTouchStart === null || childOnTouchStart === void 0 || childOnTouchStart(e);
51604
+ handleToggleTooltip(true);
51605
+ },
51606
+ role: customTriggerRole || ((_child$props4 = child.props) === null || _child$props4 === void 0 ? void 0 : _child$props4.role),
51607
+ "aria-describedby": tooltipID,
51608
+ "data-qa": "tooltip-trigger-".concat(tooltipID)
51609
+ });
51610
+ } else {
51611
+ return /*#__PURE__*/React__default.createElement(ButtonWithAction, {
51612
+ action: noop$1,
51613
+ onKeyDown: handleKeyDown,
51614
+ variant: triggerButtonVariant,
51615
+ text: triggerText,
51616
+ tabIndex: 0,
51617
+ ariaDescribedby: tooltipID,
51618
+ onFocus: function onFocus() {
51619
+ return handleToggleTooltip(true);
51620
+ },
51621
+ onBlur: function onBlur() {
51622
+ return handleToggleTooltip(false);
51623
+ },
51624
+ onTouchStart: function onTouchStart() {
51625
+ return handleToggleTooltip(true);
51626
+ },
51627
+ dataQa: "tooltip-trigger-".concat(tooltipID),
51628
+ 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 ")
51629
+ });
51630
+ }
51631
+ };
51544
51632
  var handleMouseEnter = function handleMouseEnter() {
51545
51633
  if (closeTimeoutRef.current) {
51546
51634
  clearTimeout(closeTimeoutRef.current);
@@ -51553,51 +51641,29 @@ var Tooltip = function Tooltip(_ref) {
51553
51641
  handleToggleTooltip(false);
51554
51642
  }, 300);
51555
51643
  };
51644
+
51645
+ // Touch listener effect
51556
51646
  React.useEffect(function () {
51557
- return function () {
51558
- if (closeTimeoutRef.current) {
51559
- clearTimeout(closeTimeoutRef.current);
51647
+ if (!tooltipOpen) return;
51648
+ var handleOutsideTouch = function handleOutsideTouch(e) {
51649
+ if (containerRef.current && !containerRef.current.contains(e.target)) {
51650
+ setTooltipOpen(false);
51560
51651
  }
51561
51652
  };
51653
+ document.addEventListener("touchstart", handleOutsideTouch);
51654
+ return function () {
51655
+ return document.removeEventListener("touchstart", handleOutsideTouch);
51656
+ };
51657
+ }, [tooltipOpen]);
51658
+
51659
+ // Unmount cleanup only
51660
+ React.useEffect(function () {
51661
+ return function () {
51662
+ if (closeTimeoutRef.current) clearTimeout(closeTimeoutRef.current);
51663
+ };
51562
51664
  }, []);
51563
- var renderTrigger = function renderTrigger() {
51564
- if (hasCustomTrigger && children) {
51565
- return /*#__PURE__*/React__default.cloneElement(React__default.Children.only(children), {
51566
- "aria-describedby": tooltipID,
51567
- onFocus: function onFocus() {
51568
- return handleToggleTooltip(true);
51569
- },
51570
- onBlur: function onBlur() {
51571
- return handleToggleTooltip(false);
51572
- },
51573
- onKeyDown: handleKeyDown,
51574
- tabIndex: "0",
51575
- style: {
51576
- cursor: "pointer"
51577
- }
51578
- });
51579
- }
51580
- return /*#__PURE__*/React__default.createElement(ButtonWithAction, {
51581
- action: noop$1,
51582
- "aria-describedby": tooltipID,
51583
- onKeyDown: handleKeyDown,
51584
- variant: triggerButtonVariant,
51585
- onFocus: function onFocus() {
51586
- return handleToggleTooltip(true);
51587
- },
51588
- onBlur: function onBlur() {
51589
- return handleToggleTooltip(false);
51590
- },
51591
- onTouchStart: function onTouchStart() {
51592
- return handleToggleTooltip(true);
51593
- },
51594
- "data-qa": "tooltip-trigger-".concat(tooltipID),
51595
- text: triggerText,
51596
- tabIndex: "0",
51597
- 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 ")
51598
- });
51599
- };
51600
51665
  return /*#__PURE__*/React__default.createElement(Box, {
51666
+ ref: containerRef,
51601
51667
  padding: "0",
51602
51668
  extraStyles: "position: relative; ".concat(containerExtraStyles),
51603
51669
  onMouseEnter: handleMouseEnter,
@@ -51607,19 +51673,19 @@ var Tooltip = function Tooltip(_ref) {
51607
51673
  role: "tooltip",
51608
51674
  id: tooltipID,
51609
51675
  "aria-hidden": !tooltipOpen,
51610
- background: themeValues.borderColor,
51676
+ background: backgroundColor,
51611
51677
  "data-qa": "tooltip-contents",
51612
- extraStyles: "\n position: absolute;\n display: ".concat(tooltipOpen ? "block" : "none", ";\n top: ").concat(top, ";\n right: ").concat(right, ";\n bottom: ").concat(bottom, ";\n left: ").concat(left, ";\n height: ").concat(height, ";\n ").concat(contentExtraStyles, "\n "),
51678
+ extraStyles: "\n position: absolute;\n display: ".concat(tooltipOpen ? "block" : "none", ";\n top: ").concat(top, ";\n right: ").concat(right, ";\n bottom: ").concat(bottom, ";\n left: ").concat(left, ";\n height: ").concat(height, ";\n color: ").concat(themeValues.textColor, ";\n ").concat(contentExtraStyles, "\n "),
51613
51679
  boxShadow: "0px 2px 14px 0px rgb(246, 246, 249), 0px 3px 8px 0px rgb(202, 206, 216)",
51614
51680
  border: "1px solid transparent",
51615
51681
  borderRadius: "4px",
51616
51682
  minWidth: minWidth,
51617
51683
  maxWidth: maxWidth
51618
- }, typeof content === "string" ? /*#__PURE__*/React__default.createElement(Text$1, {
51619
- color: themeValues.linkColor
51620
- }, content) : content, /*#__PURE__*/React__default.createElement(Box, {
51684
+ }, typeof content === "string" && content !== "" ? /*#__PURE__*/React__default.createElement(Text$1, {
51685
+ color: themeValues.textColor
51686
+ }, content) : content !== undefined && content !== null ? content : null, /*#__PURE__*/React__default.createElement(Box, {
51621
51687
  padding: "0",
51622
- 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 ")
51688
+ extraStyles: "\n position: absolute;\n content: \"\";\n width: 0;\n height: 0;\n ".concat(arrowBorder(backgroundColor, 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 ")
51623
51689
  })));
51624
51690
  };
51625
51691