@thecb/components 11.10.0-beta.2 → 11.10.1-beta.1

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,
@@ -26474,18 +26457,15 @@ var FormattedCreditCard = function FormattedCreditCard(_ref) {
26474
26457
  expireDate = _ref.expireDate,
26475
26458
  expirationStatus = _ref.expirationStatus,
26476
26459
  themeValues = _ref.themeValues;
26477
- var _useContext = React.useContext(styled.ThemeContext),
26478
- isMobile = _useContext.isMobile;
26479
26460
  return /*#__PURE__*/React__default.createElement(CreditCardWrapper, null, /*#__PURE__*/React__default.createElement(CCIconWrapper, null, /*#__PURE__*/React__default.createElement(CardType, {
26480
- type: type,
26481
- size: isMobile ? "small" : "large"
26461
+ type: type
26482
26462
  })), /*#__PURE__*/React__default.createElement(Stack, {
26483
26463
  childGap: "0"
26484
26464
  }, /*#__PURE__*/React__default.createElement(Box, {
26485
26465
  padding: "0"
26486
26466
  }, /*#__PURE__*/React__default.createElement(Text$1, {
26487
26467
  variant: "p",
26488
- padding: "0",
26468
+ padding: "0 0 0 8px",
26489
26469
  color: themeValues.textColor,
26490
26470
  textAlign: "left",
26491
26471
  extraStyles: "display: inline-block;"
@@ -48934,10 +48914,10 @@ var InnerRadioSection = function InnerRadioSection(_ref) {
48934
48914
  componentId: "sc-1wtp6qc-0"
48935
48915
  })(["height:", ";width:", ";", " transition:opacity 0.3s ease;"], function (_ref2) {
48936
48916
  var isMobile = _ref2.isMobile;
48937
- return isMobile ? "16px" : "24px";
48917
+ return isMobile ? "14px" : "18px";
48938
48918
  }, function (_ref3) {
48939
48919
  var isMobile = _ref3.isMobile;
48940
- return isMobile ? "24px" : "36px";
48920
+ return isMobile ? "22px" : "28px";
48941
48921
  }, function (_ref4) {
48942
48922
  var fade = _ref4.fade;
48943
48923
  return fade && "opacity: 0.4;";
@@ -51471,25 +51451,39 @@ var TurnstileWidget = /*#__PURE__*/React.forwardRef(function (_ref4, ref) {
51471
51451
  }, error)));
51472
51452
  });
51473
51453
 
51474
- 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";
51475
51459
  var fallbackValues$12 = {
51476
- hoverColor: SAPPHIRE_BLUE,
51477
- activeColor: PEACOCK_BLUE,
51478
- popoverTriggerColor: MATISSE_BLUE,
51479
- borderColor: "rgba(255, 255, 255, 0.85)"
51460
+ borderColor: borderColor$7,
51461
+ linkColor: linkColor$6,
51462
+ hoverColor: hoverColor$6,
51463
+ activeColor: activeColor$b
51480
51464
  };
51465
+
51481
51466
  var Tooltip = function Tooltip(_ref) {
51482
51467
  var tooltipID = _ref.tooltipID,
51483
- _ref$hasIconTrigger = _ref.hasIconTrigger,
51484
- hasIconTrigger = _ref$hasIconTrigger === void 0 ? false : _ref$hasIconTrigger,
51485
- _ref$IconTrigger = _ref.IconTrigger,
51486
- IconTrigger = _ref$IconTrigger === void 0 ? WarningIconXS : _ref$IconTrigger,
51487
- _ref$iconHelpText = _ref.iconHelpText,
51488
- iconHelpText = _ref$iconHelpText === void 0 ? "Open the tooltip" : _ref$iconHelpText,
51468
+ children = _ref.children,
51469
+ _ref$hasCustomTrigger = _ref.hasCustomTrigger,
51470
+ hasCustomTrigger = _ref$hasCustomTrigger === void 0 ? false : _ref$hasCustomTrigger,
51489
51471
  _ref$triggerText = _ref.triggerText,
51490
- triggerText = _ref$triggerText === void 0 ? "Open the tooltip" : _ref$triggerText,
51491
- _ref$tooltipContent = _ref.tooltipContent,
51492
- tooltipContent = _ref$tooltipContent === void 0 ? "The contents of the tooltip go here." : _ref$tooltipContent,
51472
+ triggerText = _ref$triggerText === void 0 ? "" : _ref$triggerText,
51473
+ _ref$containerExtraSt = _ref.containerExtraStyles,
51474
+ containerExtraStyles = _ref$containerExtraSt === void 0 ? "" : _ref$containerExtraSt,
51475
+ _ref$triggerButtonVar = _ref.triggerButtonVariant,
51476
+ triggerButtonVariant = _ref$triggerButtonVar === void 0 ? "smallGhost" : _ref$triggerButtonVar,
51477
+ _ref$content = _ref.content,
51478
+ content = _ref$content === void 0 ? "" : _ref$content,
51479
+ _ref$contentExtraStyl = _ref.contentExtraStyles,
51480
+ contentExtraStyles = _ref$contentExtraStyl === void 0 ? "" : _ref$contentExtraStyl,
51481
+ _ref$minWidth = _ref.minWidth,
51482
+ minWidth = _ref$minWidth === void 0 ? "250px" : _ref$minWidth,
51483
+ _ref$maxWidth = _ref.maxWidth,
51484
+ maxWidth = _ref$maxWidth === void 0 ? "100%" : _ref$maxWidth,
51485
+ _ref$height = _ref.height,
51486
+ height = _ref$height === void 0 ? "auto" : _ref$height,
51493
51487
  _ref$contentPosition = _ref.contentPosition,
51494
51488
  contentPosition = _ref$contentPosition === void 0 ? {
51495
51489
  top: "-110px",
@@ -51505,23 +51499,7 @@ var Tooltip = function Tooltip(_ref) {
51505
51499
  arrowRight: "10px",
51506
51500
  arrowBottom: "-8px",
51507
51501
  arrowLeft: "auto"
51508
- } : _ref$arrowPosition,
51509
- _ref$minWidth = _ref.minWidth,
51510
- minWidth = _ref$minWidth === void 0 ? "250px" : _ref$minWidth,
51511
- _ref$maxWidth = _ref.maxWidth,
51512
- maxWidth = _ref$maxWidth === void 0 ? "300px" : _ref$maxWidth,
51513
- _ref$height = _ref.height,
51514
- height = _ref$height === void 0 ? "auto" : _ref$height,
51515
- _ref$containerExtraSt = _ref.containerExtraStyles,
51516
- containerExtraStyles = _ref$containerExtraSt === void 0 ? "" : _ref$containerExtraSt,
51517
- _ref$triggerExtraStyl = _ref.triggerExtraStyles,
51518
- triggerExtraStyles = _ref$triggerExtraStyl === void 0 ? "" : _ref$triggerExtraStyl,
51519
- _ref$triggerButtonVar = _ref.triggerButtonVariant,
51520
- triggerButtonVariant = _ref$triggerButtonVar === void 0 ? "smallGhost" : _ref$triggerButtonVar,
51521
- _ref$contentExtraStyl = _ref.contentExtraStyles,
51522
- contentExtraStyles = _ref$contentExtraStyl === void 0 ? "" : _ref$contentExtraStyl,
51523
- _ref$contentBackgroun = _ref.contentBackgroundColor,
51524
- contentBackgroundColor = _ref$contentBackgroun === void 0 ? WHITE : _ref$contentBackgroun;
51502
+ } : _ref$arrowPosition;
51525
51503
  var closeTimeoutRef = React.useRef(null);
51526
51504
  var _useState = React.useState(false),
51527
51505
  _useState2 = _slicedToArray(_useState, 2),
@@ -51529,10 +51507,6 @@ var Tooltip = function Tooltip(_ref) {
51529
51507
  setTooltipOpen = _useState2[1];
51530
51508
  var themeContext = React.useContext(styled.ThemeContext);
51531
51509
  var themeValues = createThemeValues(themeContext, fallbackValues$12, TOOLTIP_THEME_SOURCE);
51532
- var borderColor = themeValues.borderColor,
51533
- tooltipTriggerColor = themeValues.popoverTriggerColor,
51534
- hoverColor = themeValues.hoverColor,
51535
- activeColor = themeValues.activeColor;
51536
51510
  var top = contentPosition.top,
51537
51511
  right = contentPosition.right,
51538
51512
  bottom = contentPosition.bottom,
@@ -51541,12 +51515,12 @@ var Tooltip = function Tooltip(_ref) {
51541
51515
  arrowRight = arrowPosition.arrowRight,
51542
51516
  arrowBottom = arrowPosition.arrowBottom,
51543
51517
  arrowLeft = arrowPosition.arrowLeft;
51544
- var handleToggleTooltip = function handleToggleTooltip(desiredTooltipState) {
51545
- if (tooltipOpen !== desiredTooltipState) {
51546
- setTooltipOpen(desiredTooltipState);
51518
+ var handleToggleTooltip = function handleToggleTooltip(desiredState) {
51519
+ if (tooltipOpen !== desiredState) {
51520
+ setTooltipOpen(desiredState);
51547
51521
  }
51548
51522
  };
51549
- var handleKeyboardEvent = function handleKeyboardEvent(e) {
51523
+ var handleKeyDown = function handleKeyDown(e) {
51550
51524
  if (e.key === "Escape") {
51551
51525
  handleToggleTooltip(false);
51552
51526
  }
@@ -51570,57 +51544,61 @@ var Tooltip = function Tooltip(_ref) {
51570
51544
  }
51571
51545
  };
51572
51546
  }, []);
51547
+ var renderTrigger = function renderTrigger() {
51548
+ if (hasCustomTrigger && children) {
51549
+ return /*#__PURE__*/React__default.cloneElement(React__default.Children.only(children), {
51550
+ "aria-describedby": tooltipID,
51551
+ onFocus: function onFocus() {
51552
+ return handleToggleTooltip(true);
51553
+ },
51554
+ onBlur: function onBlur() {
51555
+ return handleToggleTooltip(false);
51556
+ },
51557
+ onKeyDown: handleKeyDown
51558
+ });
51559
+ }
51560
+ return /*#__PURE__*/React__default.createElement(ButtonWithAction, {
51561
+ action: noop$1,
51562
+ "aria-describedby": tooltipID,
51563
+ onKeyDown: handleKeyDown,
51564
+ variant: triggerButtonVariant,
51565
+ onFocus: function onFocus() {
51566
+ return handleToggleTooltip(true);
51567
+ },
51568
+ onBlur: function onBlur() {
51569
+ return handleToggleTooltip(false);
51570
+ },
51571
+ onTouchStart: function onTouchStart() {
51572
+ return handleToggleTooltip(true);
51573
+ },
51574
+ "data-qa": "tooltip-trigger-".concat(tooltipID),
51575
+ 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 ")
51577
+ });
51578
+ };
51573
51579
  return /*#__PURE__*/React__default.createElement(Box, {
51574
- ref: closeTimeoutRef,
51575
51580
  padding: "0",
51576
51581
  extraStyles: "position: relative; ".concat(containerExtraStyles),
51577
- onMouseEnter: function onMouseEnter() {
51578
- return handleMouseEnter();
51579
- },
51580
- onMouseLeave: function onMouseLeave() {
51581
- return handleMouseLeave();
51582
- },
51583
- "data-qa": "tooltip-container"
51584
- }, /*#__PURE__*/React__default.createElement(ButtonWithAction, {
51585
- "aria-describedby": tooltipID,
51586
- onKeyDown: handleKeyboardEvent,
51587
- variant: triggerButtonVariant,
51588
- onFocus: function onFocus() {
51589
- return handleToggleTooltip(true);
51590
- },
51591
- onBlur: function onBlur() {
51592
- return handleToggleTooltip(false);
51593
- },
51594
- onTouchStart: function onTouchStart() {
51595
- return handleToggleTooltip(true);
51596
- },
51597
- "data-qa": "tooltip-trigger",
51598
- contentOverride: true
51599
- }, hasIconTrigger === true && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Box, {
51600
- "aria-label": "Open tooltip"
51601
- }, /*#__PURE__*/React__default.createElement(IconTrigger, {
51602
- color: tooltipTriggerColor
51603
- })), /*#__PURE__*/React__default.createElement(Box, {
51604
- padding: "0",
51605
- srOnly: true
51606
- }, /*#__PURE__*/React__default.createElement(Text$1, null, iconHelpText))), hasIconTrigger === false && /*#__PURE__*/React__default.createElement(Text$1, {
51607
- color: tooltipTriggerColor,
51608
- 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 ")
51609
- }, triggerText)), /*#__PURE__*/React__default.createElement(Box, {
51582
+ onMouseEnter: handleMouseEnter,
51583
+ onMouseLeave: handleMouseLeave,
51584
+ "data-qa": "".concat(tooltipID, "-container")
51585
+ }, renderTrigger(), /*#__PURE__*/React__default.createElement(Box, {
51610
51586
  role: "tooltip",
51611
51587
  id: tooltipID,
51612
51588
  "aria-hidden": !tooltipOpen,
51613
- background: contentBackgroundColor,
51589
+ background: themeValues.borderColor,
51614
51590
  "data-qa": "tooltip-contents",
51615
- 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 "),
51591
+ 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 "),
51616
51592
  boxShadow: "0px 2px 14px 0px rgb(246, 246, 249), 0px 3px 8px 0px rgb(202, 206, 216)",
51617
51593
  border: "1px solid transparent",
51618
51594
  borderRadius: "4px",
51619
51595
  minWidth: minWidth,
51620
51596
  maxWidth: maxWidth
51621
- }, /*#__PURE__*/React__default.createElement(Paragraph$1, null, tooltipContent), /*#__PURE__*/React__default.createElement(Box, {
51597
+ }, typeof content === "string" ? /*#__PURE__*/React__default.createElement(Text$1, {
51598
+ color: themeValues.linkColor
51599
+ }, content) : content, /*#__PURE__*/React__default.createElement(Box, {
51622
51600
  padding: "0",
51623
- 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 ")
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 ")
51624
51602
  })));
51625
51603
  };
51626
51604