@thecb/components 11.10.0-beta.1 → 11.10.1-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
@@ -15822,7 +15822,7 @@ var GenericCardLarge = function GenericCardLarge() {
15822
15822
  fill: "none",
15823
15823
  xmlns: "http://www.w3.org/2000/svg",
15824
15824
  role: "img",
15825
- "aria-label": "Credit card"
15825
+ "aria-label": "Card Payment"
15826
15826
  }, /*#__PURE__*/React__default.createElement("rect", {
15827
15827
  width: "36",
15828
15828
  height: "24",
@@ -18700,9 +18700,7 @@ var VisaSmallIcon = function VisaSmallIcon() {
18700
18700
  height: "16",
18701
18701
  viewBox: "0 0 24 16",
18702
18702
  fill: "none",
18703
- xmlns: "http://www.w3.org/2000/svg",
18704
- role: "img",
18705
- "aria-label": "Visa"
18703
+ xmlns: "http://www.w3.org/2000/svg"
18706
18704
  }, /*#__PURE__*/React__default.createElement("path", {
18707
18705
  fillRule: "evenodd",
18708
18706
  clipRule: "evenodd",
@@ -18729,9 +18727,7 @@ var AmExSmallIcon = function AmExSmallIcon() {
18729
18727
  height: "16",
18730
18728
  viewBox: "0 0 24 16",
18731
18729
  fill: "none",
18732
- xmlns: "http://www.w3.org/2000/svg",
18733
- role: "img",
18734
- "aria-label": "American Express"
18730
+ xmlns: "http://www.w3.org/2000/svg"
18735
18731
  }, /*#__PURE__*/React__default.createElement("g", {
18736
18732
  clipPath: "url(#clip0_3693_1095)"
18737
18733
  }, /*#__PURE__*/React__default.createElement("g", {
@@ -18830,9 +18826,7 @@ var DiscoverSmallIcon = function DiscoverSmallIcon() {
18830
18826
  height: "16",
18831
18827
  viewBox: "0 0 24 16",
18832
18828
  fill: "none",
18833
- xmlns: "http://www.w3.org/2000/svg",
18834
- role: "img",
18835
- "aria-label": "Discover"
18829
+ xmlns: "http://www.w3.org/2000/svg"
18836
18830
  }, /*#__PURE__*/React__default.createElement("g", {
18837
18831
  clipPath: "url(#clip0_3818_267)"
18838
18832
  }, /*#__PURE__*/React__default.createElement("path", {
@@ -18957,9 +18951,7 @@ var GenericSmallIcon = function GenericSmallIcon() {
18957
18951
  height: "16",
18958
18952
  viewBox: "0 0 24 16",
18959
18953
  fill: "none",
18960
- xmlns: "http://www.w3.org/2000/svg",
18961
- role: "img",
18962
- "aria-label": "Credit card"
18954
+ xmlns: "http://www.w3.org/2000/svg"
18963
18955
  }, /*#__PURE__*/React__default.createElement("rect", {
18964
18956
  width: "24",
18965
18957
  height: "16",
@@ -18980,9 +18972,7 @@ var MasterCardSmallIcon = function MasterCardSmallIcon() {
18980
18972
  height: "16",
18981
18973
  viewBox: "0 0 24 16",
18982
18974
  fill: "none",
18983
- xmlns: "http://www.w3.org/2000/svg",
18984
- role: "img",
18985
- "aria-label": "Mastercard"
18975
+ xmlns: "http://www.w3.org/2000/svg"
18986
18976
  }, /*#__PURE__*/React__default.createElement("rect", {
18987
18977
  width: "24",
18988
18978
  height: "16",
@@ -26375,18 +26365,11 @@ var cardBrands = {
26375
26365
  large: GenericCardLarge
26376
26366
  }
26377
26367
  };
26378
- var normalizeType = function normalizeType(type) {
26379
- if (!type) return undefined;
26380
- var lower = type.toLowerCase();
26381
- if (lower === "mastercard") return "master_card";
26382
- return lower;
26383
- };
26384
26368
  var CardType = function CardType(_ref) {
26385
26369
  var type = _ref.type,
26386
26370
  _ref$size = _ref.size,
26387
26371
  size = _ref$size === void 0 ? "small" : _ref$size;
26388
- var normalizedType = normalizeType(type);
26389
- var _ref2 = cardBrands[normalizedType] || cardBrands["default"],
26372
+ var _ref2 = cardBrands[type] || cardBrands["default"],
26390
26373
  label = _ref2.label,
26391
26374
  IconComponent = _ref2[size];
26392
26375
  return /*#__PURE__*/React__default.createElement("span", {
@@ -26466,7 +26449,7 @@ var CreditCardWrapper = styled__default.div.withConfig({
26466
26449
  var CCIconWrapper = styled__default.div.withConfig({
26467
26450
  displayName: "FormattedCreditCard__CCIconWrapper",
26468
26451
  componentId: "sc-s0ta5l-1"
26469
- })(["margin-right:16px;width:36px;height:auto;display:flex;"]);
26452
+ })(["margin-right:16px;width:30px;height:auto;display:flex;"]);
26470
26453
  var FormattedCreditCard = function FormattedCreditCard(_ref) {
26471
26454
  var lastFour = _ref.lastFour,
26472
26455
  type = _ref.type,
@@ -26475,15 +26458,14 @@ var FormattedCreditCard = function FormattedCreditCard(_ref) {
26475
26458
  expirationStatus = _ref.expirationStatus,
26476
26459
  themeValues = _ref.themeValues;
26477
26460
  return /*#__PURE__*/React__default.createElement(CreditCardWrapper, null, /*#__PURE__*/React__default.createElement(CCIconWrapper, null, /*#__PURE__*/React__default.createElement(CardType, {
26478
- type: type,
26479
- size: "large"
26461
+ type: type
26480
26462
  })), /*#__PURE__*/React__default.createElement(Stack, {
26481
26463
  childGap: "0"
26482
26464
  }, /*#__PURE__*/React__default.createElement(Box, {
26483
26465
  padding: "0"
26484
26466
  }, /*#__PURE__*/React__default.createElement(Text$1, {
26485
26467
  variant: "p",
26486
- padding: "0",
26468
+ padding: "0 0 0 8px",
26487
26469
  color: themeValues.textColor,
26488
26470
  textAlign: "left",
26489
26471
  extraStyles: "display: inline-block;"
@@ -48932,10 +48914,10 @@ var InnerRadioSection = function InnerRadioSection(_ref) {
48932
48914
  componentId: "sc-1wtp6qc-0"
48933
48915
  })(["height:", ";width:", ";", " transition:opacity 0.3s ease;"], function (_ref2) {
48934
48916
  var isMobile = _ref2.isMobile;
48935
- return isMobile ? "16px" : "24px";
48917
+ return isMobile ? "14px" : "18px";
48936
48918
  }, function (_ref3) {
48937
48919
  var isMobile = _ref3.isMobile;
48938
- return isMobile ? "24px" : "36px";
48920
+ return isMobile ? "22px" : "28px";
48939
48921
  }, function (_ref4) {
48940
48922
  var fade = _ref4.fade;
48941
48923
  return fade && "opacity: 0.4;";
@@ -51469,25 +51451,38 @@ var TurnstileWidget = /*#__PURE__*/React.forwardRef(function (_ref4, ref) {
51469
51451
  }, error)));
51470
51452
  });
51471
51453
 
51472
- var TOOLTIP_THEME_SOURCE = "Popover";
51454
+ var hoverColor$6 = SAPPHIRE_BLUE;
51455
+ var activeColor$b = PEACOCK_BLUE;
51456
+ var linkColor$6 = MATISSE_BLUE;
51457
+ var borderColor$7 = "rgba(255, 255, 255, 0.85)";
51458
+ var TOOLTIP_THEME_SOURCE = "Button";
51473
51459
  var fallbackValues$12 = {
51474
- hoverColor: SAPPHIRE_BLUE,
51475
- activeColor: PEACOCK_BLUE,
51476
- popoverTriggerColor: MATISSE_BLUE,
51477
- borderColor: "rgba(255, 255, 255, 0.85)"
51460
+ borderColor: borderColor$7,
51461
+ linkColor: linkColor$6,
51462
+ hoverColor: hoverColor$6,
51463
+ activeColor: activeColor$b
51478
51464
  };
51465
+
51479
51466
  var Tooltip = function Tooltip(_ref) {
51480
51467
  var tooltipID = _ref.tooltipID,
51481
- _ref$hasIconTrigger = _ref.hasIconTrigger,
51482
- hasIconTrigger = _ref$hasIconTrigger === void 0 ? false : _ref$hasIconTrigger,
51483
- _ref$IconTrigger = _ref.IconTrigger,
51484
- IconTrigger = _ref$IconTrigger === void 0 ? WarningIconXS : _ref$IconTrigger,
51485
- _ref$iconHelpText = _ref.iconHelpText,
51486
- iconHelpText = _ref$iconHelpText === void 0 ? "Open the tooltip" : _ref$iconHelpText,
51468
+ children = _ref.children,
51487
51469
  _ref$triggerText = _ref.triggerText,
51488
- triggerText = _ref$triggerText === void 0 ? "Open the tooltip" : _ref$triggerText,
51489
- _ref$tooltipContent = _ref.tooltipContent,
51490
- tooltipContent = _ref$tooltipContent === void 0 ? "The contents of the tooltip go here." : _ref$tooltipContent,
51470
+ triggerText = _ref$triggerText === void 0 ? "" : _ref$triggerText,
51471
+ _ref$containerExtraSt = _ref.containerExtraStyles,
51472
+ containerExtraStyles = _ref$containerExtraSt === void 0 ? "" : _ref$containerExtraSt,
51473
+ _ref$triggerButtonVar = _ref.triggerButtonVariant,
51474
+ triggerButtonVariant = _ref$triggerButtonVar === void 0 ? "smallGhost" : _ref$triggerButtonVar,
51475
+ _ref$content = _ref.content,
51476
+ content = _ref$content === void 0 ? "" : _ref$content,
51477
+ _ref$contentBackgroun = _ref.contentBackgroundColor,
51478
+ _ref$contentExtraStyl = _ref.contentExtraStyles,
51479
+ contentExtraStyles = _ref$contentExtraStyl === void 0 ? "" : _ref$contentExtraStyl,
51480
+ _ref$minWidth = _ref.minWidth,
51481
+ minWidth = _ref$minWidth === void 0 ? "250px" : _ref$minWidth,
51482
+ _ref$maxWidth = _ref.maxWidth,
51483
+ maxWidth = _ref$maxWidth === void 0 ? "100%" : _ref$maxWidth,
51484
+ _ref$height = _ref.height,
51485
+ height = _ref$height === void 0 ? "auto" : _ref$height,
51491
51486
  _ref$contentPosition = _ref.contentPosition,
51492
51487
  contentPosition = _ref$contentPosition === void 0 ? {
51493
51488
  top: "-110px",
@@ -51503,23 +51498,7 @@ var Tooltip = function Tooltip(_ref) {
51503
51498
  arrowRight: "10px",
51504
51499
  arrowBottom: "-8px",
51505
51500
  arrowLeft: "auto"
51506
- } : _ref$arrowPosition,
51507
- _ref$minWidth = _ref.minWidth,
51508
- minWidth = _ref$minWidth === void 0 ? "250px" : _ref$minWidth,
51509
- _ref$maxWidth = _ref.maxWidth,
51510
- maxWidth = _ref$maxWidth === void 0 ? "300px" : _ref$maxWidth,
51511
- _ref$height = _ref.height,
51512
- height = _ref$height === void 0 ? "auto" : _ref$height,
51513
- _ref$containerExtraSt = _ref.containerExtraStyles,
51514
- containerExtraStyles = _ref$containerExtraSt === void 0 ? "" : _ref$containerExtraSt,
51515
- _ref$triggerExtraStyl = _ref.triggerExtraStyles,
51516
- triggerExtraStyles = _ref$triggerExtraStyl === void 0 ? "" : _ref$triggerExtraStyl,
51517
- _ref$triggerButtonVar = _ref.triggerButtonVariant,
51518
- triggerButtonVariant = _ref$triggerButtonVar === void 0 ? "smallGhost" : _ref$triggerButtonVar,
51519
- _ref$contentExtraStyl = _ref.contentExtraStyles,
51520
- contentExtraStyles = _ref$contentExtraStyl === void 0 ? "" : _ref$contentExtraStyl,
51521
- _ref$contentBackgroun = _ref.contentBackgroundColor,
51522
- contentBackgroundColor = _ref$contentBackgroun === void 0 ? WHITE : _ref$contentBackgroun;
51501
+ } : _ref$arrowPosition;
51523
51502
  var closeTimeoutRef = React.useRef(null);
51524
51503
  var _useState = React.useState(false),
51525
51504
  _useState2 = _slicedToArray(_useState, 2),
@@ -51527,10 +51506,6 @@ var Tooltip = function Tooltip(_ref) {
51527
51506
  setTooltipOpen = _useState2[1];
51528
51507
  var themeContext = React.useContext(styled.ThemeContext);
51529
51508
  var themeValues = createThemeValues(themeContext, fallbackValues$12, TOOLTIP_THEME_SOURCE);
51530
- var borderColor = themeValues.borderColor,
51531
- tooltipTriggerColor = themeValues.popoverTriggerColor,
51532
- hoverColor = themeValues.hoverColor,
51533
- activeColor = themeValues.activeColor;
51534
51509
  var top = contentPosition.top,
51535
51510
  right = contentPosition.right,
51536
51511
  bottom = contentPosition.bottom,
@@ -51539,12 +51514,12 @@ var Tooltip = function Tooltip(_ref) {
51539
51514
  arrowRight = arrowPosition.arrowRight,
51540
51515
  arrowBottom = arrowPosition.arrowBottom,
51541
51516
  arrowLeft = arrowPosition.arrowLeft;
51542
- var handleToggleTooltip = function handleToggleTooltip(desiredTooltipState) {
51543
- if (tooltipOpen !== desiredTooltipState) {
51544
- setTooltipOpen(desiredTooltipState);
51517
+ var handleToggleTooltip = function handleToggleTooltip(desiredState) {
51518
+ if (tooltipOpen !== desiredState) {
51519
+ setTooltipOpen(desiredState);
51545
51520
  }
51546
51521
  };
51547
- var handleKeyboardEvent = function handleKeyboardEvent(e) {
51522
+ var handleKeyDown = function handleKeyDown(e) {
51548
51523
  if (e.key === "Escape") {
51549
51524
  handleToggleTooltip(false);
51550
51525
  }
@@ -51568,57 +51543,61 @@ var Tooltip = function Tooltip(_ref) {
51568
51543
  }
51569
51544
  };
51570
51545
  }, []);
51546
+ var renderTrigger = function renderTrigger() {
51547
+ if (children) {
51548
+ return /*#__PURE__*/React__default.cloneElement(React__default.Children.only(children), {
51549
+ "aria-describedby": tooltipID,
51550
+ onFocus: function onFocus() {
51551
+ return handleToggleTooltip(true);
51552
+ },
51553
+ onBlur: function onBlur() {
51554
+ return handleToggleTooltip(false);
51555
+ },
51556
+ onKeyDown: handleKeyDown
51557
+ });
51558
+ }
51559
+ return /*#__PURE__*/React__default.createElement(ButtonWithAction, {
51560
+ action: noop$1,
51561
+ "aria-describedby": tooltipID,
51562
+ onKeyDown: handleKeyDown,
51563
+ variant: triggerButtonVariant,
51564
+ onFocus: function onFocus() {
51565
+ return handleToggleTooltip(true);
51566
+ },
51567
+ onBlur: function onBlur() {
51568
+ return handleToggleTooltip(false);
51569
+ },
51570
+ onTouchStart: function onTouchStart() {
51571
+ return handleToggleTooltip(true);
51572
+ },
51573
+ "data-qa": "tooltip-trigger-".concat(tooltipID),
51574
+ text: triggerText,
51575
+ 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 ")
51576
+ });
51577
+ };
51571
51578
  return /*#__PURE__*/React__default.createElement(Box, {
51572
- ref: closeTimeoutRef,
51573
51579
  padding: "0",
51574
51580
  extraStyles: "position: relative; ".concat(containerExtraStyles),
51575
- onMouseEnter: function onMouseEnter() {
51576
- return handleMouseEnter();
51577
- },
51578
- onMouseLeave: function onMouseLeave() {
51579
- return handleMouseLeave();
51580
- },
51581
- "data-qa": "tooltip-container"
51582
- }, /*#__PURE__*/React__default.createElement(ButtonWithAction, {
51583
- "aria-describedby": tooltipID,
51584
- onKeyDown: handleKeyboardEvent,
51585
- variant: triggerButtonVariant,
51586
- onFocus: function onFocus() {
51587
- return handleToggleTooltip(true);
51588
- },
51589
- onBlur: function onBlur() {
51590
- return handleToggleTooltip(false);
51591
- },
51592
- onTouchStart: function onTouchStart() {
51593
- return handleToggleTooltip(true);
51594
- },
51595
- "data-qa": "tooltip-trigger",
51596
- contentOverride: true
51597
- }, hasIconTrigger === true && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Box, {
51598
- "aria-label": "Open tooltip"
51599
- }, /*#__PURE__*/React__default.createElement(IconTrigger, {
51600
- color: tooltipTriggerColor
51601
- })), /*#__PURE__*/React__default.createElement(Box, {
51602
- padding: "0",
51603
- srOnly: true
51604
- }, /*#__PURE__*/React__default.createElement(Text$1, null, iconHelpText))), hasIconTrigger === false && /*#__PURE__*/React__default.createElement(Text$1, {
51605
- color: tooltipTriggerColor,
51606
- extraStyles: "\n color: ".concat(tooltipTriggerColor, ";\n &:visited {\n color: ").concat(tooltipTriggerColor, ";\n }\n &:hover {\n color: ").concat(hoverColor, "; \n }\n &:active,\n &:focus {\n color: ").concat(activeColor, "; \n }\n ").concat(triggerExtraStyles, ";\n ")
51607
- }, triggerText)), /*#__PURE__*/React__default.createElement(Box, {
51581
+ onMouseEnter: handleMouseEnter,
51582
+ onMouseLeave: handleMouseLeave,
51583
+ "data-qa": "".concat(tooltipID, "-container")
51584
+ }, renderTrigger(), /*#__PURE__*/React__default.createElement(Box, {
51608
51585
  role: "tooltip",
51609
51586
  id: tooltipID,
51610
51587
  "aria-hidden": !tooltipOpen,
51611
- background: contentBackgroundColor,
51588
+ background: themeValues.borderColor,
51612
51589
  "data-qa": "tooltip-contents",
51613
- 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 "),
51590
+ 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 "),
51614
51591
  boxShadow: "0px 2px 14px 0px rgb(246, 246, 249), 0px 3px 8px 0px rgb(202, 206, 216)",
51615
51592
  border: "1px solid transparent",
51616
51593
  borderRadius: "4px",
51617
51594
  minWidth: minWidth,
51618
51595
  maxWidth: maxWidth
51619
- }, /*#__PURE__*/React__default.createElement(Paragraph$1, null, tooltipContent), /*#__PURE__*/React__default.createElement(Box, {
51596
+ }, typeof content === "string" ? /*#__PURE__*/React__default.createElement(Text$1, {
51597
+ color: themeValues.linkColor
51598
+ }, content) : content, /*#__PURE__*/React__default.createElement(Box, {
51620
51599
  padding: "0",
51621
- extraStyles: "\n position: absolute;\n content: \"\";\n width: 0;\n height: 0;\n ".concat(arrowBorder(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 ")
51600
+ 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 ")
51622
51601
  })));
51623
51602
  };
51624
51603