@thecb/components 11.11.0-beta.1 → 11.11.0-beta.2

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
@@ -22615,7 +22615,6 @@ var SortableTableHeading$1 = themeComponent(SortableTableHeading, "SortableTable
22615
22615
 
22616
22616
  var DropdownIcon = function DropdownIcon() {
22617
22617
  return /*#__PURE__*/React__default.createElement("svg", {
22618
- "aria-hidden": "true",
22619
22618
  version: "1.2",
22620
22619
  xmlns: "http://www.w3.org/2000/svg",
22621
22620
  overflow: "visible",
@@ -23965,7 +23964,7 @@ var IconWrapper = styled.div.withConfig({
23965
23964
  var DropdownContentWrapper = styled.div.withConfig({
23966
23965
  displayName: "Dropdown__DropdownContentWrapper",
23967
23966
  componentId: "sc-pn6m0h-1"
23968
- })(["transform-origin:0 0;border:1px solid ", ";border-radius:2px;background-color:", ";padding:8px 0 8px;position:absolute;width:", ";min-width:100%;max-height:", ";overflow-y:scroll;z-index:1;box-sizing:border-box;&:focus{outline:none;}ul{padding-left:0;}"], STORM_GREY, WHITE, function (_ref2) {
23967
+ })(["transform-origin:0 0;border:1px solid ", ";border-radius:2px;background-color:", ";padding:8px 0 8px;position:absolute;width:", ";min-width:100%;max-height:", ";overflow-y:scroll;z-index:1;box-sizing:border-box;&:focus{outline:none;}ul{padding-left:0;}"], GREY_CHATEAU, WHITE, function (_ref2) {
23969
23968
  var widthFitOptions = _ref2.widthFitOptions;
23970
23969
  return widthFitOptions ? "fit-content" : "100%";
23971
23970
  }, function (_ref3) {
@@ -24270,7 +24269,7 @@ var Dropdown = function Dropdown(_ref13) {
24270
24269
  background: isOpen ? themeValues.hoverColor : WHITE,
24271
24270
  borderRadius: "2px",
24272
24271
  borderSize: "1px",
24273
- borderColor: isError ? ERROR_COLOR : isOpen ? themeValues.selectedColor : STORM_GREY,
24272
+ borderColor: isError ? ERROR_COLOR : isOpen ? themeValues.selectedColor : GREY_CHATEAU,
24274
24273
  dataQa: placeholder,
24275
24274
  extraStyles: disabled ? "".concat(inputPlaceholderTextStyle).concat(inputDisabledStyle) : inputPlaceholderTextStyle,
24276
24275
  hoverStyles: "background-color: ".concat(themeValues.hoverColor, ";"),
@@ -50263,7 +50262,6 @@ var DropdownIconV2 = function DropdownIconV2(_ref) {
50263
50262
  color = _ref$color === void 0 ? "#292A33" : _ref$color,
50264
50263
  props = _objectWithoutProperties(_ref, _excluded$Q);
50265
50264
  return /*#__PURE__*/React__default.createElement("svg", _extends({
50266
- "aria-hidden": "true",
50267
50265
  width: width,
50268
50266
  height: height,
50269
50267
  viewBox: "0 0 ".concat(width, " ").concat(height),
@@ -51446,25 +51444,39 @@ var TurnstileWidget = /*#__PURE__*/forwardRef(function (_ref4, ref) {
51446
51444
  }, error)));
51447
51445
  });
51448
51446
 
51449
- var TOOLTIP_THEME_SOURCE = "Popover";
51447
+ var hoverColor$6 = SAPPHIRE_BLUE;
51448
+ var activeColor$b = PEACOCK_BLUE;
51449
+ var linkColor$6 = MATISSE_BLUE;
51450
+ var borderColor$7 = "rgba(255, 255, 255, 0.85)";
51451
+ var TOOLTIP_THEME_SOURCE = "Button";
51450
51452
  var fallbackValues$12 = {
51451
- hoverColor: SAPPHIRE_BLUE,
51452
- activeColor: PEACOCK_BLUE,
51453
- popoverTriggerColor: MATISSE_BLUE,
51454
- borderColor: "rgba(255, 255, 255, 0.85)"
51453
+ borderColor: borderColor$7,
51454
+ linkColor: linkColor$6,
51455
+ hoverColor: hoverColor$6,
51456
+ activeColor: activeColor$b
51455
51457
  };
51458
+
51456
51459
  var Tooltip = function Tooltip(_ref) {
51457
51460
  var tooltipID = _ref.tooltipID,
51458
- _ref$hasIconTrigger = _ref.hasIconTrigger,
51459
- hasIconTrigger = _ref$hasIconTrigger === void 0 ? false : _ref$hasIconTrigger,
51460
- _ref$IconTrigger = _ref.IconTrigger,
51461
- IconTrigger = _ref$IconTrigger === void 0 ? WarningIconXS : _ref$IconTrigger,
51462
- _ref$iconHelpText = _ref.iconHelpText,
51463
- iconHelpText = _ref$iconHelpText === void 0 ? "Open the tooltip" : _ref$iconHelpText,
51461
+ children = _ref.children,
51462
+ _ref$hasCustomTrigger = _ref.hasCustomTrigger,
51463
+ hasCustomTrigger = _ref$hasCustomTrigger === void 0 ? false : _ref$hasCustomTrigger,
51464
51464
  _ref$triggerText = _ref.triggerText,
51465
- triggerText = _ref$triggerText === void 0 ? "Open the tooltip" : _ref$triggerText,
51466
- _ref$tooltipContent = _ref.tooltipContent,
51467
- tooltipContent = _ref$tooltipContent === void 0 ? "The contents of the tooltip go here." : _ref$tooltipContent,
51465
+ triggerText = _ref$triggerText === void 0 ? "" : _ref$triggerText,
51466
+ _ref$containerExtraSt = _ref.containerExtraStyles,
51467
+ containerExtraStyles = _ref$containerExtraSt === void 0 ? "" : _ref$containerExtraSt,
51468
+ _ref$triggerButtonVar = _ref.triggerButtonVariant,
51469
+ triggerButtonVariant = _ref$triggerButtonVar === void 0 ? "smallGhost" : _ref$triggerButtonVar,
51470
+ _ref$content = _ref.content,
51471
+ content = _ref$content === void 0 ? "" : _ref$content,
51472
+ _ref$contentExtraStyl = _ref.contentExtraStyles,
51473
+ contentExtraStyles = _ref$contentExtraStyl === void 0 ? "" : _ref$contentExtraStyl,
51474
+ _ref$minWidth = _ref.minWidth,
51475
+ minWidth = _ref$minWidth === void 0 ? "250px" : _ref$minWidth,
51476
+ _ref$maxWidth = _ref.maxWidth,
51477
+ maxWidth = _ref$maxWidth === void 0 ? "100%" : _ref$maxWidth,
51478
+ _ref$height = _ref.height,
51479
+ height = _ref$height === void 0 ? "auto" : _ref$height,
51468
51480
  _ref$contentPosition = _ref.contentPosition,
51469
51481
  contentPosition = _ref$contentPosition === void 0 ? {
51470
51482
  top: "-110px",
@@ -51481,22 +51493,7 @@ var Tooltip = function Tooltip(_ref) {
51481
51493
  arrowBottom: "-8px",
51482
51494
  arrowLeft: "auto"
51483
51495
  } : _ref$arrowPosition,
51484
- _ref$minWidth = _ref.minWidth,
51485
- minWidth = _ref$minWidth === void 0 ? "250px" : _ref$minWidth,
51486
- _ref$maxWidth = _ref.maxWidth,
51487
- maxWidth = _ref$maxWidth === void 0 ? "300px" : _ref$maxWidth,
51488
- _ref$height = _ref.height,
51489
- height = _ref$height === void 0 ? "auto" : _ref$height,
51490
- _ref$containerExtraSt = _ref.containerExtraStyles,
51491
- containerExtraStyles = _ref$containerExtraSt === void 0 ? "" : _ref$containerExtraSt,
51492
- _ref$triggerExtraStyl = _ref.triggerExtraStyles,
51493
- triggerExtraStyles = _ref$triggerExtraStyl === void 0 ? "" : _ref$triggerExtraStyl,
51494
- _ref$triggerButtonVar = _ref.triggerButtonVariant,
51495
- triggerButtonVariant = _ref$triggerButtonVar === void 0 ? "smallGhost" : _ref$triggerButtonVar,
51496
- _ref$contentExtraStyl = _ref.contentExtraStyles,
51497
- contentExtraStyles = _ref$contentExtraStyl === void 0 ? "" : _ref$contentExtraStyl,
51498
- _ref$contentBackgroun = _ref.contentBackgroundColor,
51499
- contentBackgroundColor = _ref$contentBackgroun === void 0 ? WHITE : _ref$contentBackgroun;
51496
+ arrowColor = _ref.arrowColor;
51500
51497
  var closeTimeoutRef = useRef(null);
51501
51498
  var _useState = useState(false),
51502
51499
  _useState2 = _slicedToArray(_useState, 2),
@@ -51504,10 +51501,6 @@ var Tooltip = function Tooltip(_ref) {
51504
51501
  setTooltipOpen = _useState2[1];
51505
51502
  var themeContext = useContext(ThemeContext);
51506
51503
  var themeValues = createThemeValues(themeContext, fallbackValues$12, TOOLTIP_THEME_SOURCE);
51507
- var borderColor = themeValues.borderColor,
51508
- tooltipTriggerColor = themeValues.popoverTriggerColor,
51509
- hoverColor = themeValues.hoverColor,
51510
- activeColor = themeValues.activeColor;
51511
51504
  var top = contentPosition.top,
51512
51505
  right = contentPosition.right,
51513
51506
  bottom = contentPosition.bottom,
@@ -51516,12 +51509,12 @@ var Tooltip = function Tooltip(_ref) {
51516
51509
  arrowRight = arrowPosition.arrowRight,
51517
51510
  arrowBottom = arrowPosition.arrowBottom,
51518
51511
  arrowLeft = arrowPosition.arrowLeft;
51519
- var handleToggleTooltip = function handleToggleTooltip(desiredTooltipState) {
51520
- if (tooltipOpen !== desiredTooltipState) {
51521
- setTooltipOpen(desiredTooltipState);
51512
+ var handleToggleTooltip = function handleToggleTooltip(desiredState) {
51513
+ if (tooltipOpen !== desiredState) {
51514
+ setTooltipOpen(desiredState);
51522
51515
  }
51523
51516
  };
51524
- var handleKeyboardEvent = function handleKeyboardEvent(e) {
51517
+ var handleKeyDown = function handleKeyDown(e) {
51525
51518
  if (e.key === "Escape") {
51526
51519
  handleToggleTooltip(false);
51527
51520
  }
@@ -51545,57 +51538,61 @@ var Tooltip = function Tooltip(_ref) {
51545
51538
  }
51546
51539
  };
51547
51540
  }, []);
51541
+ var renderTrigger = function renderTrigger() {
51542
+ if (hasCustomTrigger && children) {
51543
+ return /*#__PURE__*/React__default.cloneElement(React__default.Children.only(children), {
51544
+ "aria-describedby": tooltipID,
51545
+ onFocus: function onFocus() {
51546
+ return handleToggleTooltip(true);
51547
+ },
51548
+ onBlur: function onBlur() {
51549
+ return handleToggleTooltip(false);
51550
+ },
51551
+ onKeyDown: handleKeyDown
51552
+ });
51553
+ }
51554
+ return /*#__PURE__*/React__default.createElement(ButtonWithAction, {
51555
+ action: noop$1,
51556
+ "aria-describedby": tooltipID,
51557
+ onKeyDown: handleKeyDown,
51558
+ variant: triggerButtonVariant,
51559
+ onFocus: function onFocus() {
51560
+ return handleToggleTooltip(true);
51561
+ },
51562
+ onBlur: function onBlur() {
51563
+ return handleToggleTooltip(false);
51564
+ },
51565
+ onTouchStart: function onTouchStart() {
51566
+ return handleToggleTooltip(true);
51567
+ },
51568
+ "data-qa": "tooltip-trigger-".concat(tooltipID),
51569
+ text: triggerText,
51570
+ 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 ")
51571
+ });
51572
+ };
51548
51573
  return /*#__PURE__*/React__default.createElement(Box, {
51549
- ref: closeTimeoutRef,
51550
51574
  padding: "0",
51551
51575
  extraStyles: "position: relative; ".concat(containerExtraStyles),
51552
- onMouseEnter: function onMouseEnter() {
51553
- return handleMouseEnter();
51554
- },
51555
- onMouseLeave: function onMouseLeave() {
51556
- return handleMouseLeave();
51557
- },
51558
- "data-qa": "tooltip-container"
51559
- }, /*#__PURE__*/React__default.createElement(ButtonWithAction, {
51560
- "aria-describedby": tooltipID,
51561
- onKeyDown: handleKeyboardEvent,
51562
- variant: triggerButtonVariant,
51563
- onFocus: function onFocus() {
51564
- return handleToggleTooltip(true);
51565
- },
51566
- onBlur: function onBlur() {
51567
- return handleToggleTooltip(false);
51568
- },
51569
- onTouchStart: function onTouchStart() {
51570
- return handleToggleTooltip(true);
51571
- },
51572
- "data-qa": "tooltip-trigger",
51573
- contentOverride: true
51574
- }, hasIconTrigger === true && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Box, {
51575
- "aria-label": "Open tooltip"
51576
- }, /*#__PURE__*/React__default.createElement(IconTrigger, {
51577
- color: tooltipTriggerColor
51578
- })), /*#__PURE__*/React__default.createElement(Box, {
51579
- padding: "0",
51580
- srOnly: true
51581
- }, /*#__PURE__*/React__default.createElement(Text$1, null, iconHelpText))), hasIconTrigger === false && /*#__PURE__*/React__default.createElement(Text$1, {
51582
- color: tooltipTriggerColor,
51583
- 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 ")
51584
- }, triggerText)), /*#__PURE__*/React__default.createElement(Box, {
51576
+ onMouseEnter: handleMouseEnter,
51577
+ onMouseLeave: handleMouseLeave,
51578
+ "data-qa": "".concat(tooltipID, "-container")
51579
+ }, renderTrigger(), /*#__PURE__*/React__default.createElement(Box, {
51585
51580
  role: "tooltip",
51586
51581
  id: tooltipID,
51587
51582
  "aria-hidden": !tooltipOpen,
51588
- background: contentBackgroundColor,
51583
+ background: themeValues.borderColor,
51589
51584
  "data-qa": "tooltip-contents",
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 "),
51585
+ 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
51586
  boxShadow: "0px 2px 14px 0px rgb(246, 246, 249), 0px 3px 8px 0px rgb(202, 206, 216)",
51592
51587
  border: "1px solid transparent",
51593
51588
  borderRadius: "4px",
51594
51589
  minWidth: minWidth,
51595
51590
  maxWidth: maxWidth
51596
- }, /*#__PURE__*/React__default.createElement(Paragraph$1, null, tooltipContent), /*#__PURE__*/React__default.createElement(Box, {
51591
+ }, typeof content === "string" ? /*#__PURE__*/React__default.createElement(Text$1, {
51592
+ color: themeValues.linkColor
51593
+ }, content) : content, /*#__PURE__*/React__default.createElement(Box, {
51597
51594
  padding: "0",
51598
- 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 ")
51595
+ 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 ")
51599
51596
  })));
51600
51597
  };
51601
51598