@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.esm.js CHANGED
@@ -26296,7 +26296,7 @@ var FormattedAddress = function FormattedAddress(_ref) {
26296
26296
  var FormattedAddress$1 = themeComponent(FormattedAddress, "FormattedAddress", fallbackValues$n, "default");
26297
26297
 
26298
26298
  var textColor$1 = "".concat(CHARADE_GREY);
26299
- var autopayTextColor = "".concat(REGENT_GREY);
26299
+ var autopayTextColor = "".concat(SEA_GREEN);
26300
26300
  var fallbackValues$o = {
26301
26301
  textColor: textColor$1,
26302
26302
  autopayTextColor: autopayTextColor
@@ -26332,8 +26332,8 @@ var FormattedBankAccount = function FormattedBankAccount(_ref2) {
26332
26332
  }, "Savings Account ending in ", lastFour), autoPay && /*#__PURE__*/React__default.createElement(Text$1, {
26333
26333
  variant: "p",
26334
26334
  color: themeValues.autopayTextColor,
26335
- extraStyles: "font-style: italic;"
26336
- }, "Autopay Enabled")));
26335
+ extraStyles: "font-style: italic; font-size: .75rem;"
26336
+ }, "Autopay On")));
26337
26337
  };
26338
26338
  var FormattedBankAccount$1 = themeComponent(FormattedBankAccount, "FormattedBankAccount", fallbackValues$o);
26339
26339
 
@@ -26382,7 +26382,7 @@ var CardType = function CardType(_ref) {
26382
26382
  };
26383
26383
 
26384
26384
  var textColor$2 = "".concat(CHARADE_GREY);
26385
- var autopayTextColor$1 = "".concat(REGENT_GREY);
26385
+ var autopayTextColor$1 = "".concat(SEA_GREEN);
26386
26386
  var fallbackValues$p = {
26387
26387
  textColor: textColor$2,
26388
26388
  autopayTextColor: autopayTextColor$1
@@ -26411,13 +26411,15 @@ var renderCardStatus = function renderCardStatus(expirationStatus, expireDate) {
26411
26411
  return /*#__PURE__*/React__default.createElement(Text$1, {
26412
26412
  as: as,
26413
26413
  variant: "pXS",
26414
- color: ASH_GREY,
26414
+ fontSize: ".75rem",
26415
+ color: STORM_GREY,
26415
26416
  extraStyles: "text-align: ".concat(textAlign, "; margin: ").concat(textMargin, ";")
26416
26417
  }, "Exp Date ", expireDate);
26417
26418
  case EXPIRING_SOON:
26418
26419
  return /*#__PURE__*/React__default.createElement(Text$1, {
26419
26420
  as: as,
26420
26421
  variant: "pXS",
26422
+ fontSize: ".75rem",
26421
26423
  color: FIRE_YELLOW,
26422
26424
  extraStyles: "text-align: ".concat(textAlign, "; margin: ").concat(textMargin, ";")
26423
26425
  }, "Expiring Soon ", expireDate);
@@ -26425,7 +26427,8 @@ var renderCardStatus = function renderCardStatus(expirationStatus, expireDate) {
26425
26427
  return /*#__PURE__*/React__default.createElement(Text$1, {
26426
26428
  as: as,
26427
26429
  variant: "pXS",
26428
- color: ASH_GREY,
26430
+ fontSize: ".75rem",
26431
+ color: STORM_GREY,
26429
26432
  extraStyles: "text-align: ".concat(textAlign, "; margin: ").concat(textMargin, ";")
26430
26433
  }, "Expired");
26431
26434
  }
@@ -26478,8 +26481,8 @@ var FormattedCreditCard = function FormattedCreditCard(_ref) {
26478
26481
  }, "Card ending in ".concat(lastFour)), expireDate && /*#__PURE__*/React__default.createElement(Fragment$1, null, renderCardStatus(expirationStatus, expireDate, "left", "p"))), autoPay && /*#__PURE__*/React__default.createElement(Text$1, {
26479
26482
  variant: "p",
26480
26483
  color: themeValues.autopayTextColor,
26481
- extraStyles: "font-style: italic;"
26482
- }, "Autopay Enabled")));
26484
+ extraStyles: "font-style: italic; font-size: .75rem;"
26485
+ }, "Autopay On")));
26483
26486
  };
26484
26487
  var FormattedCreditCard$1 = themeComponent(FormattedCreditCard, "FormattedCreditCard", fallbackValues$p);
26485
26488
 
@@ -40885,6 +40888,7 @@ var EditableList = function EditableList(_ref) {
40885
40888
  _ref$canAdd = _ref.canAdd,
40886
40889
  canAdd = _ref$canAdd === void 0 ? true : _ref$canAdd,
40887
40890
  addItem = _ref.addItem,
40891
+ addItemDestination = _ref.addItemDestination,
40888
40892
  removeItem = _ref.removeItem,
40889
40893
  editItem = _ref.editItem,
40890
40894
  itemName = _ref.itemName,
@@ -40992,6 +40996,8 @@ var EditableList = function EditableList(_ref) {
40992
40996
  padding: items.length === 0 ? "0" : "1rem 0 0"
40993
40997
  }, /*#__PURE__*/React__default.createElement(Placeholder$1, {
40994
40998
  text: addText,
40999
+ isLink: !!addItemDestination,
41000
+ destination: addItemDestination,
40995
41001
  action: addItem,
40996
41002
  dataQa: "Add " + qaPrefix,
40997
41003
  "aria-label": addText,
@@ -48081,7 +48087,7 @@ var TermsAndConditionsModal = function TermsAndConditionsModal(_ref) {
48081
48087
  weight: themeValues.fontWeight,
48082
48088
  hoverStyles: themeValues.modalLinkHoverFocus,
48083
48089
  textDecoration: themeValues.modalLinkTextDecoration,
48084
- extraStyles: "display: inline-block; width: fit-content; cursor: pointer",
48090
+ extraStyles: "display: inline-block; width: fit-content; cursor: pointer; min-height: 24px; line-height: 24px;",
48085
48091
  role: "button" // This should always be a "button" since it opens a modal
48086
48092
  ,
48087
48093
  className: "modal-trigger"
@@ -48995,7 +49001,7 @@ var InnerRadioSection = function InnerRadioSection(_ref) {
48995
49001
  padding: section.titleIcon ? "0 0 0 8px" : "0"
48996
49002
  }, /*#__PURE__*/React__default.createElement(Text$1, {
48997
49003
  as: "label",
48998
- htmlFor: "radio-input-".concat(idString(section)),
49004
+ htmlFor: "radio-".concat(idString(section)),
48999
49005
  color: CHARADE_GREY
49000
49006
  }, section.title))), section.rightIcons && /*#__PURE__*/React__default.createElement(Cluster, {
49001
49007
  id: "right-icons-".concat(idString(section)),
@@ -51458,18 +51464,18 @@ var TurnstileWidget = /*#__PURE__*/forwardRef(function (_ref4, ref) {
51458
51464
  }, error)));
51459
51465
  });
51460
51466
 
51461
- var hoverColor$6 = SAPPHIRE_BLUE;
51462
- var activeColor$b = PEACOCK_BLUE;
51463
- var linkColor$6 = MATISSE_BLUE;
51464
- var borderColor$7 = "rgba(255, 255, 255, 0.85)";
51465
- var TOOLTIP_THEME_SOURCE = "Button";
51467
+ var hoverColor$6 = ROYAL_BLUE;
51468
+ var activeColor$b = CONGRESS_BLUE;
51469
+ var linkColor$6 = ROYAL_BLUE_VIVID;
51470
+ var textColor$5 = CHARADE_GREY;
51466
51471
  var fallbackValues$12 = {
51467
- borderColor: borderColor$7,
51468
51472
  linkColor: linkColor$6,
51469
51473
  hoverColor: hoverColor$6,
51470
- activeColor: activeColor$b
51474
+ activeColor: activeColor$b,
51475
+ textColor: textColor$5
51471
51476
  };
51472
51477
 
51478
+ var TOOLTIP_THEME_SOURCE = "Popover";
51473
51479
  var Tooltip = function Tooltip(_ref) {
51474
51480
  var tooltipID = _ref.tooltipID,
51475
51481
  children = _ref.children,
@@ -51507,8 +51513,11 @@ var Tooltip = function Tooltip(_ref) {
51507
51513
  arrowBottom: "-8px",
51508
51514
  arrowLeft: "auto"
51509
51515
  } : _ref$arrowPosition,
51510
- arrowColor = _ref.arrowColor;
51516
+ customTriggerRole = _ref.customTriggerRole,
51517
+ _ref$backgroundColor = _ref.backgroundColor,
51518
+ backgroundColor = _ref$backgroundColor === void 0 ? WHITE : _ref$backgroundColor;
51511
51519
  var closeTimeoutRef = useRef(null);
51520
+ var containerRef = useRef(null);
51512
51521
  var _useState = useState(false),
51513
51522
  _useState2 = _slicedToArray(_useState, 2),
51514
51523
  tooltipOpen = _useState2[0],
@@ -51533,6 +51542,85 @@ var Tooltip = function Tooltip(_ref) {
51533
51542
  handleToggleTooltip(false);
51534
51543
  }
51535
51544
  };
51545
+
51546
+ /**
51547
+ * Renders the tooltip trigger element.
51548
+ *
51549
+ * When `hasCustomTrigger` is true, the provided child element is cloned and
51550
+ * injected with the event handlers needed to control tooltip visibility:
51551
+ * - onFocus/onBlur: open and close for keyboard users
51552
+ * - onKeyDown: allows Escape to dismiss the tooltip
51553
+ * - onTouchStart: open on tap for touch/mobile users (onFocus is unreliable on touch)
51554
+ *
51555
+ * Mouse interactions (hover) are handled at the container level via
51556
+ * onMouseEnter/onMouseLeave, so they do not need to be injected here.
51557
+ *
51558
+ * Any existing event handlers on the child are preserved and called first,
51559
+ * so the child's own behavior is not overridden.
51560
+ *
51561
+ * When no custom trigger is provided, a default ButtonWithAction is rendered
51562
+ * using `triggerText` and `triggerButtonVariant`.
51563
+ */
51564
+ var renderTrigger = function renderTrigger() {
51565
+ if (hasCustomTrigger && !children) {
51566
+ console.warn("Tooltip: children prop is required when hasCustomTrigger is true");
51567
+ }
51568
+ if (hasCustomTrigger && children) {
51569
+ var _child$props, _child$props$tabIndex, _child$props2, _child$props3, _child$props4;
51570
+ var child = React__default.Children.only(children);
51571
+ // Capture the child's existing handlers before overwriting
51572
+ var _ref2 = (_child$props = child.props) !== null && _child$props !== void 0 ? _child$props : {},
51573
+ childOnFocus = _ref2.onFocus,
51574
+ childOnBlur = _ref2.onBlur,
51575
+ childOnKeyDown = _ref2.onKeyDown,
51576
+ childOnTouchStart = _ref2.onTouchStart;
51577
+ return /*#__PURE__*/React__default.cloneElement(child, {
51578
+ 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,
51579
+ style: _objectSpread2({
51580
+ cursor: "pointer"
51581
+ }, (_child$props3 = child.props) === null || _child$props3 === void 0 ? void 0 : _child$props3.style),
51582
+ onFocus: function onFocus(e) {
51583
+ childOnFocus === null || childOnFocus === void 0 || childOnFocus(e);
51584
+ handleToggleTooltip(true);
51585
+ },
51586
+ onBlur: function onBlur(e) {
51587
+ childOnBlur === null || childOnBlur === void 0 || childOnBlur(e);
51588
+ handleToggleTooltip(false);
51589
+ },
51590
+ onKeyDown: function onKeyDown(e) {
51591
+ childOnKeyDown === null || childOnKeyDown === void 0 || childOnKeyDown(e);
51592
+ handleKeyDown(e);
51593
+ },
51594
+ onTouchStart: function onTouchStart(e) {
51595
+ childOnTouchStart === null || childOnTouchStart === void 0 || childOnTouchStart(e);
51596
+ handleToggleTooltip(true);
51597
+ },
51598
+ role: customTriggerRole || ((_child$props4 = child.props) === null || _child$props4 === void 0 ? void 0 : _child$props4.role),
51599
+ "aria-describedby": tooltipID,
51600
+ "data-qa": "tooltip-trigger-".concat(tooltipID)
51601
+ });
51602
+ } else {
51603
+ return /*#__PURE__*/React__default.createElement(ButtonWithAction, {
51604
+ action: noop$1,
51605
+ onKeyDown: handleKeyDown,
51606
+ variant: triggerButtonVariant,
51607
+ text: triggerText,
51608
+ tabIndex: 0,
51609
+ ariaDescribedby: tooltipID,
51610
+ onFocus: function onFocus() {
51611
+ return handleToggleTooltip(true);
51612
+ },
51613
+ onBlur: function onBlur() {
51614
+ return handleToggleTooltip(false);
51615
+ },
51616
+ onTouchStart: function onTouchStart() {
51617
+ return handleToggleTooltip(true);
51618
+ },
51619
+ dataQa: "tooltip-trigger-".concat(tooltipID),
51620
+ 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 ")
51621
+ });
51622
+ }
51623
+ };
51536
51624
  var handleMouseEnter = function handleMouseEnter() {
51537
51625
  if (closeTimeoutRef.current) {
51538
51626
  clearTimeout(closeTimeoutRef.current);
@@ -51545,51 +51633,29 @@ var Tooltip = function Tooltip(_ref) {
51545
51633
  handleToggleTooltip(false);
51546
51634
  }, 300);
51547
51635
  };
51636
+
51637
+ // Touch listener effect
51548
51638
  useEffect$1(function () {
51549
- return function () {
51550
- if (closeTimeoutRef.current) {
51551
- clearTimeout(closeTimeoutRef.current);
51639
+ if (!tooltipOpen) return;
51640
+ var handleOutsideTouch = function handleOutsideTouch(e) {
51641
+ if (containerRef.current && !containerRef.current.contains(e.target)) {
51642
+ setTooltipOpen(false);
51552
51643
  }
51553
51644
  };
51645
+ document.addEventListener("touchstart", handleOutsideTouch);
51646
+ return function () {
51647
+ return document.removeEventListener("touchstart", handleOutsideTouch);
51648
+ };
51649
+ }, [tooltipOpen]);
51650
+
51651
+ // Unmount cleanup only
51652
+ useEffect$1(function () {
51653
+ return function () {
51654
+ if (closeTimeoutRef.current) clearTimeout(closeTimeoutRef.current);
51655
+ };
51554
51656
  }, []);
51555
- var renderTrigger = function renderTrigger() {
51556
- if (hasCustomTrigger && children) {
51557
- return /*#__PURE__*/React__default.cloneElement(React__default.Children.only(children), {
51558
- "aria-describedby": tooltipID,
51559
- onFocus: function onFocus() {
51560
- return handleToggleTooltip(true);
51561
- },
51562
- onBlur: function onBlur() {
51563
- return handleToggleTooltip(false);
51564
- },
51565
- onKeyDown: handleKeyDown,
51566
- tabIndex: "0",
51567
- style: {
51568
- cursor: "pointer"
51569
- }
51570
- });
51571
- }
51572
- return /*#__PURE__*/React__default.createElement(ButtonWithAction, {
51573
- action: noop$1,
51574
- "aria-describedby": tooltipID,
51575
- onKeyDown: handleKeyDown,
51576
- variant: triggerButtonVariant,
51577
- onFocus: function onFocus() {
51578
- return handleToggleTooltip(true);
51579
- },
51580
- onBlur: function onBlur() {
51581
- return handleToggleTooltip(false);
51582
- },
51583
- onTouchStart: function onTouchStart() {
51584
- return handleToggleTooltip(true);
51585
- },
51586
- "data-qa": "tooltip-trigger-".concat(tooltipID),
51587
- text: triggerText,
51588
- tabIndex: "0",
51589
- 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 ")
51590
- });
51591
- };
51592
51657
  return /*#__PURE__*/React__default.createElement(Box, {
51658
+ ref: containerRef,
51593
51659
  padding: "0",
51594
51660
  extraStyles: "position: relative; ".concat(containerExtraStyles),
51595
51661
  onMouseEnter: handleMouseEnter,
@@ -51599,19 +51665,19 @@ var Tooltip = function Tooltip(_ref) {
51599
51665
  role: "tooltip",
51600
51666
  id: tooltipID,
51601
51667
  "aria-hidden": !tooltipOpen,
51602
- background: themeValues.borderColor,
51668
+ background: backgroundColor,
51603
51669
  "data-qa": "tooltip-contents",
51604
- 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 "),
51670
+ 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 "),
51605
51671
  boxShadow: "0px 2px 14px 0px rgb(246, 246, 249), 0px 3px 8px 0px rgb(202, 206, 216)",
51606
51672
  border: "1px solid transparent",
51607
51673
  borderRadius: "4px",
51608
51674
  minWidth: minWidth,
51609
51675
  maxWidth: maxWidth
51610
- }, typeof content === "string" ? /*#__PURE__*/React__default.createElement(Text$1, {
51611
- color: themeValues.linkColor
51612
- }, content) : content, /*#__PURE__*/React__default.createElement(Box, {
51676
+ }, typeof content === "string" && content !== "" ? /*#__PURE__*/React__default.createElement(Text$1, {
51677
+ color: themeValues.textColor
51678
+ }, content) : content !== undefined && content !== null ? content : null, /*#__PURE__*/React__default.createElement(Box, {
51613
51679
  padding: "0",
51614
- 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 ")
51680
+ 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 ")
51615
51681
  })));
51616
51682
  };
51617
51683