@thecb/components 11.10.0-beta.2 → 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.esm.js CHANGED
@@ -15814,7 +15814,7 @@ var GenericCardLarge = function GenericCardLarge() {
15814
15814
  fill: "none",
15815
15815
  xmlns: "http://www.w3.org/2000/svg",
15816
15816
  role: "img",
15817
- "aria-label": "Credit card"
15817
+ "aria-label": "Card Payment"
15818
15818
  }, /*#__PURE__*/React__default.createElement("rect", {
15819
15819
  width: "36",
15820
15820
  height: "24",
@@ -18692,9 +18692,7 @@ var VisaSmallIcon = function VisaSmallIcon() {
18692
18692
  height: "16",
18693
18693
  viewBox: "0 0 24 16",
18694
18694
  fill: "none",
18695
- xmlns: "http://www.w3.org/2000/svg",
18696
- role: "img",
18697
- "aria-label": "Visa"
18695
+ xmlns: "http://www.w3.org/2000/svg"
18698
18696
  }, /*#__PURE__*/React__default.createElement("path", {
18699
18697
  fillRule: "evenodd",
18700
18698
  clipRule: "evenodd",
@@ -18721,9 +18719,7 @@ var AmExSmallIcon = function AmExSmallIcon() {
18721
18719
  height: "16",
18722
18720
  viewBox: "0 0 24 16",
18723
18721
  fill: "none",
18724
- xmlns: "http://www.w3.org/2000/svg",
18725
- role: "img",
18726
- "aria-label": "American Express"
18722
+ xmlns: "http://www.w3.org/2000/svg"
18727
18723
  }, /*#__PURE__*/React__default.createElement("g", {
18728
18724
  clipPath: "url(#clip0_3693_1095)"
18729
18725
  }, /*#__PURE__*/React__default.createElement("g", {
@@ -18822,9 +18818,7 @@ var DiscoverSmallIcon = function DiscoverSmallIcon() {
18822
18818
  height: "16",
18823
18819
  viewBox: "0 0 24 16",
18824
18820
  fill: "none",
18825
- xmlns: "http://www.w3.org/2000/svg",
18826
- role: "img",
18827
- "aria-label": "Discover"
18821
+ xmlns: "http://www.w3.org/2000/svg"
18828
18822
  }, /*#__PURE__*/React__default.createElement("g", {
18829
18823
  clipPath: "url(#clip0_3818_267)"
18830
18824
  }, /*#__PURE__*/React__default.createElement("path", {
@@ -18949,9 +18943,7 @@ var GenericSmallIcon = function GenericSmallIcon() {
18949
18943
  height: "16",
18950
18944
  viewBox: "0 0 24 16",
18951
18945
  fill: "none",
18952
- xmlns: "http://www.w3.org/2000/svg",
18953
- role: "img",
18954
- "aria-label": "Credit card"
18946
+ xmlns: "http://www.w3.org/2000/svg"
18955
18947
  }, /*#__PURE__*/React__default.createElement("rect", {
18956
18948
  width: "24",
18957
18949
  height: "16",
@@ -18972,9 +18964,7 @@ var MasterCardSmallIcon = function MasterCardSmallIcon() {
18972
18964
  height: "16",
18973
18965
  viewBox: "0 0 24 16",
18974
18966
  fill: "none",
18975
- xmlns: "http://www.w3.org/2000/svg",
18976
- role: "img",
18977
- "aria-label": "Mastercard"
18967
+ xmlns: "http://www.w3.org/2000/svg"
18978
18968
  }, /*#__PURE__*/React__default.createElement("rect", {
18979
18969
  width: "24",
18980
18970
  height: "16",
@@ -26367,18 +26357,11 @@ var cardBrands = {
26367
26357
  large: GenericCardLarge
26368
26358
  }
26369
26359
  };
26370
- var normalizeType = function normalizeType(type) {
26371
- if (!type) return undefined;
26372
- var lower = type.toLowerCase();
26373
- if (lower === "mastercard") return "master_card";
26374
- return lower;
26375
- };
26376
26360
  var CardType = function CardType(_ref) {
26377
26361
  var type = _ref.type,
26378
26362
  _ref$size = _ref.size,
26379
26363
  size = _ref$size === void 0 ? "small" : _ref$size;
26380
- var normalizedType = normalizeType(type);
26381
- var _ref2 = cardBrands[normalizedType] || cardBrands["default"],
26364
+ var _ref2 = cardBrands[type] || cardBrands["default"],
26382
26365
  label = _ref2.label,
26383
26366
  IconComponent = _ref2[size];
26384
26367
  return /*#__PURE__*/React__default.createElement("span", {
@@ -26458,7 +26441,7 @@ var CreditCardWrapper = styled.div.withConfig({
26458
26441
  var CCIconWrapper = styled.div.withConfig({
26459
26442
  displayName: "FormattedCreditCard__CCIconWrapper",
26460
26443
  componentId: "sc-s0ta5l-1"
26461
- })(["margin-right:16px;width:36px;height:auto;display:flex;"]);
26444
+ })(["margin-right:16px;width:30px;height:auto;display:flex;"]);
26462
26445
  var FormattedCreditCard = function FormattedCreditCard(_ref) {
26463
26446
  var lastFour = _ref.lastFour,
26464
26447
  type = _ref.type,
@@ -26466,18 +26449,15 @@ var FormattedCreditCard = function FormattedCreditCard(_ref) {
26466
26449
  expireDate = _ref.expireDate,
26467
26450
  expirationStatus = _ref.expirationStatus,
26468
26451
  themeValues = _ref.themeValues;
26469
- var _useContext = useContext(ThemeContext),
26470
- isMobile = _useContext.isMobile;
26471
26452
  return /*#__PURE__*/React__default.createElement(CreditCardWrapper, null, /*#__PURE__*/React__default.createElement(CCIconWrapper, null, /*#__PURE__*/React__default.createElement(CardType, {
26472
- type: type,
26473
- size: isMobile ? "small" : "large"
26453
+ type: type
26474
26454
  })), /*#__PURE__*/React__default.createElement(Stack, {
26475
26455
  childGap: "0"
26476
26456
  }, /*#__PURE__*/React__default.createElement(Box, {
26477
26457
  padding: "0"
26478
26458
  }, /*#__PURE__*/React__default.createElement(Text$1, {
26479
26459
  variant: "p",
26480
- padding: "0",
26460
+ padding: "0 0 0 8px",
26481
26461
  color: themeValues.textColor,
26482
26462
  textAlign: "left",
26483
26463
  extraStyles: "display: inline-block;"
@@ -48926,10 +48906,10 @@ var InnerRadioSection = function InnerRadioSection(_ref) {
48926
48906
  componentId: "sc-1wtp6qc-0"
48927
48907
  })(["height:", ";width:", ";", " transition:opacity 0.3s ease;"], function (_ref2) {
48928
48908
  var isMobile = _ref2.isMobile;
48929
- return isMobile ? "16px" : "24px";
48909
+ return isMobile ? "14px" : "18px";
48930
48910
  }, function (_ref3) {
48931
48911
  var isMobile = _ref3.isMobile;
48932
- return isMobile ? "24px" : "36px";
48912
+ return isMobile ? "22px" : "28px";
48933
48913
  }, function (_ref4) {
48934
48914
  var fade = _ref4.fade;
48935
48915
  return fade && "opacity: 0.4;";
@@ -51463,25 +51443,38 @@ var TurnstileWidget = /*#__PURE__*/forwardRef(function (_ref4, ref) {
51463
51443
  }, error)));
51464
51444
  });
51465
51445
 
51466
- var TOOLTIP_THEME_SOURCE = "Popover";
51446
+ var hoverColor$6 = SAPPHIRE_BLUE;
51447
+ var activeColor$b = PEACOCK_BLUE;
51448
+ var linkColor$6 = MATISSE_BLUE;
51449
+ var borderColor$7 = "rgba(255, 255, 255, 0.85)";
51450
+ var TOOLTIP_THEME_SOURCE = "Button";
51467
51451
  var fallbackValues$12 = {
51468
- hoverColor: SAPPHIRE_BLUE,
51469
- activeColor: PEACOCK_BLUE,
51470
- popoverTriggerColor: MATISSE_BLUE,
51471
- borderColor: "rgba(255, 255, 255, 0.85)"
51452
+ borderColor: borderColor$7,
51453
+ linkColor: linkColor$6,
51454
+ hoverColor: hoverColor$6,
51455
+ activeColor: activeColor$b
51472
51456
  };
51457
+
51473
51458
  var Tooltip = function Tooltip(_ref) {
51474
51459
  var tooltipID = _ref.tooltipID,
51475
- _ref$hasIconTrigger = _ref.hasIconTrigger,
51476
- hasIconTrigger = _ref$hasIconTrigger === void 0 ? false : _ref$hasIconTrigger,
51477
- _ref$IconTrigger = _ref.IconTrigger,
51478
- IconTrigger = _ref$IconTrigger === void 0 ? WarningIconXS : _ref$IconTrigger,
51479
- _ref$iconHelpText = _ref.iconHelpText,
51480
- iconHelpText = _ref$iconHelpText === void 0 ? "Open the tooltip" : _ref$iconHelpText,
51460
+ children = _ref.children,
51481
51461
  _ref$triggerText = _ref.triggerText,
51482
- triggerText = _ref$triggerText === void 0 ? "Open the tooltip" : _ref$triggerText,
51483
- _ref$tooltipContent = _ref.tooltipContent,
51484
- tooltipContent = _ref$tooltipContent === void 0 ? "The contents of the tooltip go here." : _ref$tooltipContent,
51462
+ triggerText = _ref$triggerText === void 0 ? "" : _ref$triggerText,
51463
+ _ref$containerExtraSt = _ref.containerExtraStyles,
51464
+ containerExtraStyles = _ref$containerExtraSt === void 0 ? "" : _ref$containerExtraSt,
51465
+ _ref$triggerButtonVar = _ref.triggerButtonVariant,
51466
+ triggerButtonVariant = _ref$triggerButtonVar === void 0 ? "smallGhost" : _ref$triggerButtonVar,
51467
+ _ref$content = _ref.content,
51468
+ content = _ref$content === void 0 ? "" : _ref$content,
51469
+ _ref$contentBackgroun = _ref.contentBackgroundColor,
51470
+ _ref$contentExtraStyl = _ref.contentExtraStyles,
51471
+ contentExtraStyles = _ref$contentExtraStyl === void 0 ? "" : _ref$contentExtraStyl,
51472
+ _ref$minWidth = _ref.minWidth,
51473
+ minWidth = _ref$minWidth === void 0 ? "250px" : _ref$minWidth,
51474
+ _ref$maxWidth = _ref.maxWidth,
51475
+ maxWidth = _ref$maxWidth === void 0 ? "100%" : _ref$maxWidth,
51476
+ _ref$height = _ref.height,
51477
+ height = _ref$height === void 0 ? "auto" : _ref$height,
51485
51478
  _ref$contentPosition = _ref.contentPosition,
51486
51479
  contentPosition = _ref$contentPosition === void 0 ? {
51487
51480
  top: "-110px",
@@ -51497,23 +51490,7 @@ var Tooltip = function Tooltip(_ref) {
51497
51490
  arrowRight: "10px",
51498
51491
  arrowBottom: "-8px",
51499
51492
  arrowLeft: "auto"
51500
- } : _ref$arrowPosition,
51501
- _ref$minWidth = _ref.minWidth,
51502
- minWidth = _ref$minWidth === void 0 ? "250px" : _ref$minWidth,
51503
- _ref$maxWidth = _ref.maxWidth,
51504
- maxWidth = _ref$maxWidth === void 0 ? "300px" : _ref$maxWidth,
51505
- _ref$height = _ref.height,
51506
- height = _ref$height === void 0 ? "auto" : _ref$height,
51507
- _ref$containerExtraSt = _ref.containerExtraStyles,
51508
- containerExtraStyles = _ref$containerExtraSt === void 0 ? "" : _ref$containerExtraSt,
51509
- _ref$triggerExtraStyl = _ref.triggerExtraStyles,
51510
- triggerExtraStyles = _ref$triggerExtraStyl === void 0 ? "" : _ref$triggerExtraStyl,
51511
- _ref$triggerButtonVar = _ref.triggerButtonVariant,
51512
- triggerButtonVariant = _ref$triggerButtonVar === void 0 ? "smallGhost" : _ref$triggerButtonVar,
51513
- _ref$contentExtraStyl = _ref.contentExtraStyles,
51514
- contentExtraStyles = _ref$contentExtraStyl === void 0 ? "" : _ref$contentExtraStyl,
51515
- _ref$contentBackgroun = _ref.contentBackgroundColor,
51516
- contentBackgroundColor = _ref$contentBackgroun === void 0 ? WHITE : _ref$contentBackgroun;
51493
+ } : _ref$arrowPosition;
51517
51494
  var closeTimeoutRef = useRef(null);
51518
51495
  var _useState = useState(false),
51519
51496
  _useState2 = _slicedToArray(_useState, 2),
@@ -51521,10 +51498,6 @@ var Tooltip = function Tooltip(_ref) {
51521
51498
  setTooltipOpen = _useState2[1];
51522
51499
  var themeContext = useContext(ThemeContext);
51523
51500
  var themeValues = createThemeValues(themeContext, fallbackValues$12, TOOLTIP_THEME_SOURCE);
51524
- var borderColor = themeValues.borderColor,
51525
- tooltipTriggerColor = themeValues.popoverTriggerColor,
51526
- hoverColor = themeValues.hoverColor,
51527
- activeColor = themeValues.activeColor;
51528
51501
  var top = contentPosition.top,
51529
51502
  right = contentPosition.right,
51530
51503
  bottom = contentPosition.bottom,
@@ -51533,12 +51506,12 @@ var Tooltip = function Tooltip(_ref) {
51533
51506
  arrowRight = arrowPosition.arrowRight,
51534
51507
  arrowBottom = arrowPosition.arrowBottom,
51535
51508
  arrowLeft = arrowPosition.arrowLeft;
51536
- var handleToggleTooltip = function handleToggleTooltip(desiredTooltipState) {
51537
- if (tooltipOpen !== desiredTooltipState) {
51538
- setTooltipOpen(desiredTooltipState);
51509
+ var handleToggleTooltip = function handleToggleTooltip(desiredState) {
51510
+ if (tooltipOpen !== desiredState) {
51511
+ setTooltipOpen(desiredState);
51539
51512
  }
51540
51513
  };
51541
- var handleKeyboardEvent = function handleKeyboardEvent(e) {
51514
+ var handleKeyDown = function handleKeyDown(e) {
51542
51515
  if (e.key === "Escape") {
51543
51516
  handleToggleTooltip(false);
51544
51517
  }
@@ -51562,57 +51535,61 @@ var Tooltip = function Tooltip(_ref) {
51562
51535
  }
51563
51536
  };
51564
51537
  }, []);
51538
+ var renderTrigger = function renderTrigger() {
51539
+ if (children) {
51540
+ return /*#__PURE__*/React__default.cloneElement(React__default.Children.only(children), {
51541
+ "aria-describedby": tooltipID,
51542
+ onFocus: function onFocus() {
51543
+ return handleToggleTooltip(true);
51544
+ },
51545
+ onBlur: function onBlur() {
51546
+ return handleToggleTooltip(false);
51547
+ },
51548
+ onKeyDown: handleKeyDown
51549
+ });
51550
+ }
51551
+ return /*#__PURE__*/React__default.createElement(ButtonWithAction, {
51552
+ action: noop$1,
51553
+ "aria-describedby": tooltipID,
51554
+ onKeyDown: handleKeyDown,
51555
+ variant: triggerButtonVariant,
51556
+ onFocus: function onFocus() {
51557
+ return handleToggleTooltip(true);
51558
+ },
51559
+ onBlur: function onBlur() {
51560
+ return handleToggleTooltip(false);
51561
+ },
51562
+ onTouchStart: function onTouchStart() {
51563
+ return handleToggleTooltip(true);
51564
+ },
51565
+ "data-qa": "tooltip-trigger-".concat(tooltipID),
51566
+ text: triggerText,
51567
+ 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 ")
51568
+ });
51569
+ };
51565
51570
  return /*#__PURE__*/React__default.createElement(Box, {
51566
- ref: closeTimeoutRef,
51567
51571
  padding: "0",
51568
51572
  extraStyles: "position: relative; ".concat(containerExtraStyles),
51569
- onMouseEnter: function onMouseEnter() {
51570
- return handleMouseEnter();
51571
- },
51572
- onMouseLeave: function onMouseLeave() {
51573
- return handleMouseLeave();
51574
- },
51575
- "data-qa": "tooltip-container"
51576
- }, /*#__PURE__*/React__default.createElement(ButtonWithAction, {
51577
- "aria-describedby": tooltipID,
51578
- onKeyDown: handleKeyboardEvent,
51579
- variant: triggerButtonVariant,
51580
- onFocus: function onFocus() {
51581
- return handleToggleTooltip(true);
51582
- },
51583
- onBlur: function onBlur() {
51584
- return handleToggleTooltip(false);
51585
- },
51586
- onTouchStart: function onTouchStart() {
51587
- return handleToggleTooltip(true);
51588
- },
51589
- "data-qa": "tooltip-trigger",
51590
- contentOverride: true
51591
- }, hasIconTrigger === true && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Box, {
51592
- "aria-label": "Open tooltip"
51593
- }, /*#__PURE__*/React__default.createElement(IconTrigger, {
51594
- color: tooltipTriggerColor
51595
- })), /*#__PURE__*/React__default.createElement(Box, {
51596
- padding: "0",
51597
- srOnly: true
51598
- }, /*#__PURE__*/React__default.createElement(Text$1, null, iconHelpText))), hasIconTrigger === false && /*#__PURE__*/React__default.createElement(Text$1, {
51599
- color: tooltipTriggerColor,
51600
- 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 ")
51601
- }, triggerText)), /*#__PURE__*/React__default.createElement(Box, {
51573
+ onMouseEnter: handleMouseEnter,
51574
+ onMouseLeave: handleMouseLeave,
51575
+ "data-qa": "".concat(tooltipID, "-container")
51576
+ }, renderTrigger(), /*#__PURE__*/React__default.createElement(Box, {
51602
51577
  role: "tooltip",
51603
51578
  id: tooltipID,
51604
51579
  "aria-hidden": !tooltipOpen,
51605
- background: contentBackgroundColor,
51580
+ background: themeValues.borderColor,
51606
51581
  "data-qa": "tooltip-contents",
51607
- 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 "),
51582
+ 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 "),
51608
51583
  boxShadow: "0px 2px 14px 0px rgb(246, 246, 249), 0px 3px 8px 0px rgb(202, 206, 216)",
51609
51584
  border: "1px solid transparent",
51610
51585
  borderRadius: "4px",
51611
51586
  minWidth: minWidth,
51612
51587
  maxWidth: maxWidth
51613
- }, /*#__PURE__*/React__default.createElement(Paragraph$1, null, tooltipContent), /*#__PURE__*/React__default.createElement(Box, {
51588
+ }, typeof content === "string" ? /*#__PURE__*/React__default.createElement(Text$1, {
51589
+ color: themeValues.linkColor
51590
+ }, content) : content, /*#__PURE__*/React__default.createElement(Box, {
51614
51591
  padding: "0",
51615
- 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 ")
51592
+ 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 ")
51616
51593
  })));
51617
51594
  };
51618
51595