@thecb/components 11.11.0-beta.0 → 11.11.0-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 +89 -94
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +89 -94
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/atoms/dropdown/Dropdown.js +2 -3
- package/src/components/atoms/dropdown/DropdownIcon.js +1 -0
- package/src/components/atoms/dropdown/DropdownIconV2.js +1 -0
- package/src/components/molecules/tooltip/Tooltip.js +102 -85
- package/src/components/molecules/tooltip/Tooltip.mdx +2 -12
- package/src/components/molecules/tooltip/Tooltip.stories.js +71 -93
- package/src/components/molecules/tooltip/Tooltip.theme.js +5 -13
- package/src/components/molecules/tooltip/index.d.ts +7 -4
package/dist/index.cjs.js
CHANGED
|
@@ -22623,6 +22623,7 @@ var SortableTableHeading$1 = themeComponent(SortableTableHeading, "SortableTable
|
|
|
22623
22623
|
|
|
22624
22624
|
var DropdownIcon = function DropdownIcon() {
|
|
22625
22625
|
return /*#__PURE__*/React__default.createElement("svg", {
|
|
22626
|
+
"aria-hidden": "true",
|
|
22626
22627
|
version: "1.2",
|
|
22627
22628
|
xmlns: "http://www.w3.org/2000/svg",
|
|
22628
22629
|
overflow: "visible",
|
|
@@ -23972,7 +23973,7 @@ var IconWrapper = styled__default.div.withConfig({
|
|
|
23972
23973
|
var DropdownContentWrapper = styled__default.div.withConfig({
|
|
23973
23974
|
displayName: "Dropdown__DropdownContentWrapper",
|
|
23974
23975
|
componentId: "sc-pn6m0h-1"
|
|
23975
|
-
})(["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;}"],
|
|
23976
|
+
})(["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) {
|
|
23976
23977
|
var widthFitOptions = _ref2.widthFitOptions;
|
|
23977
23978
|
return widthFitOptions ? "fit-content" : "100%";
|
|
23978
23979
|
}, function (_ref3) {
|
|
@@ -24277,7 +24278,7 @@ var Dropdown = function Dropdown(_ref13) {
|
|
|
24277
24278
|
background: isOpen ? themeValues.hoverColor : WHITE,
|
|
24278
24279
|
borderRadius: "2px",
|
|
24279
24280
|
borderSize: "1px",
|
|
24280
|
-
borderColor: isError ? ERROR_COLOR : isOpen ? themeValues.selectedColor :
|
|
24281
|
+
borderColor: isError ? ERROR_COLOR : isOpen ? themeValues.selectedColor : STORM_GREY,
|
|
24281
24282
|
dataQa: placeholder,
|
|
24282
24283
|
extraStyles: disabled ? "".concat(inputPlaceholderTextStyle).concat(inputDisabledStyle) : inputPlaceholderTextStyle,
|
|
24283
24284
|
hoverStyles: "background-color: ".concat(themeValues.hoverColor, ";"),
|
|
@@ -50270,6 +50271,7 @@ var DropdownIconV2 = function DropdownIconV2(_ref) {
|
|
|
50270
50271
|
color = _ref$color === void 0 ? "#292A33" : _ref$color,
|
|
50271
50272
|
props = _objectWithoutProperties(_ref, _excluded$Q);
|
|
50272
50273
|
return /*#__PURE__*/React__default.createElement("svg", _extends({
|
|
50274
|
+
"aria-hidden": "true",
|
|
50273
50275
|
width: width,
|
|
50274
50276
|
height: height,
|
|
50275
50277
|
viewBox: "0 0 ".concat(width, " ").concat(height),
|
|
@@ -51452,65 +51454,68 @@ var TurnstileWidget = /*#__PURE__*/React.forwardRef(function (_ref4, ref) {
|
|
|
51452
51454
|
}, error)));
|
|
51453
51455
|
});
|
|
51454
51456
|
|
|
51455
|
-
var
|
|
51456
|
-
var activeColor$b = PEACOCK_BLUE;
|
|
51457
|
-
var linkColor$6 = MATISSE_BLUE;
|
|
51458
|
-
var borderColor$7 = "rgba(255, 255, 255, 0.85)";
|
|
51457
|
+
var TOOLTIP_THEME_SOURCE = "Popover";
|
|
51459
51458
|
var fallbackValues$12 = {
|
|
51460
|
-
|
|
51461
|
-
|
|
51462
|
-
|
|
51463
|
-
|
|
51459
|
+
hoverColor: SAPPHIRE_BLUE,
|
|
51460
|
+
activeColor: PEACOCK_BLUE,
|
|
51461
|
+
popoverTriggerColor: MATISSE_BLUE,
|
|
51462
|
+
borderColor: "rgba(255, 255, 255, 0.85)"
|
|
51464
51463
|
};
|
|
51465
|
-
|
|
51466
51464
|
var Tooltip = function Tooltip(_ref) {
|
|
51467
51465
|
var tooltipID = _ref.tooltipID,
|
|
51468
|
-
|
|
51469
|
-
_ref$
|
|
51470
|
-
|
|
51466
|
+
_ref$hasIconTrigger = _ref.hasIconTrigger,
|
|
51467
|
+
hasIconTrigger = _ref$hasIconTrigger === void 0 ? false : _ref$hasIconTrigger,
|
|
51468
|
+
_ref$IconTrigger = _ref.IconTrigger,
|
|
51469
|
+
IconTrigger = _ref$IconTrigger === void 0 ? WarningIconXS : _ref$IconTrigger,
|
|
51470
|
+
_ref$iconHelpText = _ref.iconHelpText,
|
|
51471
|
+
iconHelpText = _ref$iconHelpText === void 0 ? "Open the tooltip" : _ref$iconHelpText,
|
|
51471
51472
|
_ref$triggerText = _ref.triggerText,
|
|
51472
|
-
triggerText = _ref$triggerText === void 0 ? "" : _ref$triggerText,
|
|
51473
|
-
_ref$
|
|
51474
|
-
|
|
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,
|
|
51487
|
-
_ref$arrowDirection = _ref.arrowDirection,
|
|
51488
|
-
arrowDirection = _ref$arrowDirection === void 0 ? "down" : _ref$arrowDirection,
|
|
51473
|
+
triggerText = _ref$triggerText === void 0 ? "Open the tooltip" : _ref$triggerText,
|
|
51474
|
+
_ref$tooltipContent = _ref.tooltipContent,
|
|
51475
|
+
tooltipContent = _ref$tooltipContent === void 0 ? "The contents of the tooltip go here." : _ref$tooltipContent,
|
|
51489
51476
|
_ref$contentPosition = _ref.contentPosition,
|
|
51490
51477
|
contentPosition = _ref$contentPosition === void 0 ? {
|
|
51491
|
-
top: "
|
|
51478
|
+
top: "-110px",
|
|
51492
51479
|
right: "auto",
|
|
51493
|
-
bottom: "
|
|
51494
|
-
|
|
51495
|
-
left: "50%",
|
|
51496
|
-
// anchors to horizontal center of trigger
|
|
51497
|
-
transform: "translateX(-50%)" // shifts left by half tooltip's own width → centered
|
|
51480
|
+
bottom: "auto",
|
|
51481
|
+
left: "-225px"
|
|
51498
51482
|
} : _ref$contentPosition,
|
|
51483
|
+
_ref$arrowDirection = _ref.arrowDirection,
|
|
51484
|
+
arrowDirection = _ref$arrowDirection === void 0 ? "down" : _ref$arrowDirection,
|
|
51499
51485
|
_ref$arrowPosition = _ref.arrowPosition,
|
|
51500
51486
|
arrowPosition = _ref$arrowPosition === void 0 ? {
|
|
51501
51487
|
arrowTop: "auto",
|
|
51502
|
-
arrowRight: "
|
|
51488
|
+
arrowRight: "10px",
|
|
51503
51489
|
arrowBottom: "-8px",
|
|
51504
|
-
arrowLeft: "
|
|
51490
|
+
arrowLeft: "auto"
|
|
51505
51491
|
} : _ref$arrowPosition,
|
|
51506
|
-
|
|
51492
|
+
_ref$minWidth = _ref.minWidth,
|
|
51493
|
+
minWidth = _ref$minWidth === void 0 ? "250px" : _ref$minWidth,
|
|
51494
|
+
_ref$maxWidth = _ref.maxWidth,
|
|
51495
|
+
maxWidth = _ref$maxWidth === void 0 ? "300px" : _ref$maxWidth,
|
|
51496
|
+
_ref$height = _ref.height,
|
|
51497
|
+
height = _ref$height === void 0 ? "auto" : _ref$height,
|
|
51498
|
+
_ref$containerExtraSt = _ref.containerExtraStyles,
|
|
51499
|
+
containerExtraStyles = _ref$containerExtraSt === void 0 ? "" : _ref$containerExtraSt,
|
|
51500
|
+
_ref$triggerExtraStyl = _ref.triggerExtraStyles,
|
|
51501
|
+
triggerExtraStyles = _ref$triggerExtraStyl === void 0 ? "" : _ref$triggerExtraStyl,
|
|
51502
|
+
_ref$triggerButtonVar = _ref.triggerButtonVariant,
|
|
51503
|
+
triggerButtonVariant = _ref$triggerButtonVar === void 0 ? "smallGhost" : _ref$triggerButtonVar,
|
|
51504
|
+
_ref$contentExtraStyl = _ref.contentExtraStyles,
|
|
51505
|
+
contentExtraStyles = _ref$contentExtraStyl === void 0 ? "" : _ref$contentExtraStyl,
|
|
51506
|
+
_ref$contentBackgroun = _ref.contentBackgroundColor,
|
|
51507
|
+
contentBackgroundColor = _ref$contentBackgroun === void 0 ? WHITE : _ref$contentBackgroun;
|
|
51507
51508
|
var closeTimeoutRef = React.useRef(null);
|
|
51508
51509
|
var _useState = React.useState(false),
|
|
51509
51510
|
_useState2 = _slicedToArray(_useState, 2),
|
|
51510
51511
|
tooltipOpen = _useState2[0],
|
|
51511
51512
|
setTooltipOpen = _useState2[1];
|
|
51512
51513
|
var themeContext = React.useContext(styled.ThemeContext);
|
|
51513
|
-
var themeValues = createThemeValues(themeContext, fallbackValues$12,
|
|
51514
|
+
var themeValues = createThemeValues(themeContext, fallbackValues$12, TOOLTIP_THEME_SOURCE);
|
|
51515
|
+
var borderColor = themeValues.borderColor,
|
|
51516
|
+
tooltipTriggerColor = themeValues.popoverTriggerColor,
|
|
51517
|
+
hoverColor = themeValues.hoverColor,
|
|
51518
|
+
activeColor = themeValues.activeColor;
|
|
51514
51519
|
var top = contentPosition.top,
|
|
51515
51520
|
right = contentPosition.right,
|
|
51516
51521
|
bottom = contentPosition.bottom,
|
|
@@ -51519,12 +51524,12 @@ var Tooltip = function Tooltip(_ref) {
|
|
|
51519
51524
|
arrowRight = arrowPosition.arrowRight,
|
|
51520
51525
|
arrowBottom = arrowPosition.arrowBottom,
|
|
51521
51526
|
arrowLeft = arrowPosition.arrowLeft;
|
|
51522
|
-
var handleToggleTooltip = function handleToggleTooltip(
|
|
51523
|
-
if (tooltipOpen !==
|
|
51524
|
-
setTooltipOpen(
|
|
51527
|
+
var handleToggleTooltip = function handleToggleTooltip(desiredTooltipState) {
|
|
51528
|
+
if (tooltipOpen !== desiredTooltipState) {
|
|
51529
|
+
setTooltipOpen(desiredTooltipState);
|
|
51525
51530
|
}
|
|
51526
51531
|
};
|
|
51527
|
-
var
|
|
51532
|
+
var handleKeyboardEvent = function handleKeyboardEvent(e) {
|
|
51528
51533
|
if (e.key === "Escape") {
|
|
51529
51534
|
handleToggleTooltip(false);
|
|
51530
51535
|
}
|
|
@@ -51548,69 +51553,59 @@ var Tooltip = function Tooltip(_ref) {
|
|
|
51548
51553
|
}
|
|
51549
51554
|
};
|
|
51550
51555
|
}, []);
|
|
51551
|
-
var renderTrigger = function renderTrigger() {
|
|
51552
|
-
if (hasCustomTrigger && children) {
|
|
51553
|
-
return /*#__PURE__*/React__default.createElement(Box, {
|
|
51554
|
-
padding: "0",
|
|
51555
|
-
extraStyles: "cursor: pointer;",
|
|
51556
|
-
tabIndex: "0",
|
|
51557
|
-
role: "button",
|
|
51558
|
-
"data-qa": "tooltip-trigger-".concat(tooltipID),
|
|
51559
|
-
"aria-describedby": tooltipID,
|
|
51560
|
-
onFocus: function onFocus() {
|
|
51561
|
-
return handleToggleTooltip(true);
|
|
51562
|
-
},
|
|
51563
|
-
onBlur: function onBlur() {
|
|
51564
|
-
return handleToggleTooltip(false);
|
|
51565
|
-
},
|
|
51566
|
-
onKeyDown: handleKeyDown
|
|
51567
|
-
}, children);
|
|
51568
|
-
}
|
|
51569
|
-
return /*#__PURE__*/React__default.createElement(ButtonWithAction, {
|
|
51570
|
-
action: noop$1,
|
|
51571
|
-
"aria-describedby": tooltipID,
|
|
51572
|
-
onKeyDown: handleKeyDown,
|
|
51573
|
-
variant: triggerButtonVariant,
|
|
51574
|
-
onFocus: function onFocus() {
|
|
51575
|
-
return handleToggleTooltip(true);
|
|
51576
|
-
},
|
|
51577
|
-
onBlur: function onBlur() {
|
|
51578
|
-
return handleToggleTooltip(false);
|
|
51579
|
-
},
|
|
51580
|
-
onTouchStart: function onTouchStart() {
|
|
51581
|
-
return handleToggleTooltip(true);
|
|
51582
|
-
},
|
|
51583
|
-
"data-qa": "tooltip-trigger-".concat(tooltipID),
|
|
51584
|
-
text: triggerText,
|
|
51585
|
-
extraStyles: "\n color: ".concat(themeValues.linkColor, ";\n cursor: pointer;\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 ")
|
|
51586
|
-
});
|
|
51587
|
-
};
|
|
51588
51556
|
return /*#__PURE__*/React__default.createElement(Box, {
|
|
51557
|
+
ref: closeTimeoutRef,
|
|
51589
51558
|
padding: "0",
|
|
51590
51559
|
extraStyles: "position: relative; ".concat(containerExtraStyles),
|
|
51591
|
-
onMouseEnter:
|
|
51592
|
-
|
|
51593
|
-
|
|
51594
|
-
|
|
51560
|
+
onMouseEnter: function onMouseEnter() {
|
|
51561
|
+
return handleMouseEnter();
|
|
51562
|
+
},
|
|
51563
|
+
onMouseLeave: function onMouseLeave() {
|
|
51564
|
+
return handleMouseLeave();
|
|
51565
|
+
},
|
|
51566
|
+
"data-qa": "tooltip-container"
|
|
51567
|
+
}, /*#__PURE__*/React__default.createElement(ButtonWithAction, {
|
|
51568
|
+
"aria-describedby": tooltipID,
|
|
51569
|
+
onKeyDown: handleKeyboardEvent,
|
|
51570
|
+
variant: triggerButtonVariant,
|
|
51571
|
+
onFocus: function onFocus() {
|
|
51572
|
+
return handleToggleTooltip(true);
|
|
51573
|
+
},
|
|
51574
|
+
onBlur: function onBlur() {
|
|
51575
|
+
return handleToggleTooltip(false);
|
|
51576
|
+
},
|
|
51577
|
+
onTouchStart: function onTouchStart() {
|
|
51578
|
+
return handleToggleTooltip(true);
|
|
51579
|
+
},
|
|
51580
|
+
"data-qa": "tooltip-trigger",
|
|
51581
|
+
contentOverride: true
|
|
51582
|
+
}, hasIconTrigger === true && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Box, {
|
|
51583
|
+
"aria-label": "Open tooltip"
|
|
51584
|
+
}, /*#__PURE__*/React__default.createElement(IconTrigger, {
|
|
51585
|
+
color: tooltipTriggerColor
|
|
51586
|
+
})), /*#__PURE__*/React__default.createElement(Box, {
|
|
51587
|
+
padding: "0",
|
|
51588
|
+
srOnly: true
|
|
51589
|
+
}, /*#__PURE__*/React__default.createElement(Text$1, null, iconHelpText))), hasIconTrigger === false && /*#__PURE__*/React__default.createElement(Text$1, {
|
|
51590
|
+
color: tooltipTriggerColor,
|
|
51591
|
+
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 ")
|
|
51592
|
+
}, triggerText)), /*#__PURE__*/React__default.createElement(Box, {
|
|
51595
51593
|
role: "tooltip",
|
|
51596
51594
|
id: tooltipID,
|
|
51597
51595
|
"aria-hidden": !tooltipOpen,
|
|
51598
|
-
background:
|
|
51596
|
+
background: contentBackgroundColor,
|
|
51599
51597
|
"data-qa": "tooltip-contents",
|
|
51600
|
-
extraStyles: "\n position: absolute;\n display: ".concat(tooltipOpen ? "block" : "none", ";\n top: ").concat(top, "
|
|
51598
|
+
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 "),
|
|
51601
51599
|
boxShadow: "0px 2px 14px 0px rgb(246, 246, 249), 0px 3px 8px 0px rgb(202, 206, 216)",
|
|
51602
51600
|
border: "1px solid transparent",
|
|
51603
51601
|
borderRadius: "4px",
|
|
51604
51602
|
minWidth: minWidth,
|
|
51605
51603
|
maxWidth: maxWidth
|
|
51606
|
-
},
|
|
51607
|
-
color: themeValues.linkColor
|
|
51608
|
-
}, content) : content, /*#__PURE__*/React__default.createElement(Box, {
|
|
51604
|
+
}, /*#__PURE__*/React__default.createElement(Paragraph$1, null, tooltipContent), /*#__PURE__*/React__default.createElement(Box, {
|
|
51609
51605
|
padding: "0",
|
|
51610
|
-
extraStyles: "\n position: absolute;\n content: \"\";\n width: 0;\n height: 0;\n ".concat(arrowBorder(
|
|
51606
|
+
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 ")
|
|
51611
51607
|
})));
|
|
51612
51608
|
};
|
|
51613
|
-
var Tooltip$1 = themeComponent(Tooltip, "Tooltip", fallbackValues$12);
|
|
51614
51609
|
|
|
51615
51610
|
var pageBackground = "#FBFCFD";
|
|
51616
51611
|
var fallbackValues$13 = {
|
|
@@ -52171,7 +52166,7 @@ exports.TimeoutImage = TimeoutImage;
|
|
|
52171
52166
|
exports.Title = Title$1;
|
|
52172
52167
|
exports.ToastNotification = ToastNotification;
|
|
52173
52168
|
exports.ToggleSwitch = ToggleSwitch$1;
|
|
52174
|
-
exports.Tooltip = Tooltip
|
|
52169
|
+
exports.Tooltip = Tooltip;
|
|
52175
52170
|
exports.TrashIcon = TrashIcon$1;
|
|
52176
52171
|
exports.TrashIconV2 = TrashIconV2$1;
|
|
52177
52172
|
exports.TurnstileWidget = TurnstileWidget;
|