@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.cjs.js +77 -80
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +77 -80
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/atoms/dropdown/Dropdown.js +3 -2
- package/src/components/atoms/dropdown/DropdownIcon.js +0 -1
- package/src/components/atoms/dropdown/DropdownIconV2.js +0 -1
- package/src/components/molecules/tooltip/Tooltip.js +65 -93
- package/src/components/molecules/tooltip/Tooltip.mdx +12 -2
- package/src/components/molecules/tooltip/Tooltip.stories.js +93 -71
- package/src/components/molecules/tooltip/Tooltip.theme.js +15 -5
- package/src/components/molecules/tooltip/index.d.ts +4 -7
package/dist/index.cjs.js
CHANGED
|
@@ -22623,7 +22623,6 @@ 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",
|
|
22627
22626
|
version: "1.2",
|
|
22628
22627
|
xmlns: "http://www.w3.org/2000/svg",
|
|
22629
22628
|
overflow: "visible",
|
|
@@ -23973,7 +23972,7 @@ var IconWrapper = styled__default.div.withConfig({
|
|
|
23973
23972
|
var DropdownContentWrapper = styled__default.div.withConfig({
|
|
23974
23973
|
displayName: "Dropdown__DropdownContentWrapper",
|
|
23975
23974
|
componentId: "sc-pn6m0h-1"
|
|
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;}"],
|
|
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;}"], GREY_CHATEAU, WHITE, function (_ref2) {
|
|
23977
23976
|
var widthFitOptions = _ref2.widthFitOptions;
|
|
23978
23977
|
return widthFitOptions ? "fit-content" : "100%";
|
|
23979
23978
|
}, function (_ref3) {
|
|
@@ -24278,7 +24277,7 @@ var Dropdown = function Dropdown(_ref13) {
|
|
|
24278
24277
|
background: isOpen ? themeValues.hoverColor : WHITE,
|
|
24279
24278
|
borderRadius: "2px",
|
|
24280
24279
|
borderSize: "1px",
|
|
24281
|
-
borderColor: isError ? ERROR_COLOR : isOpen ? themeValues.selectedColor :
|
|
24280
|
+
borderColor: isError ? ERROR_COLOR : isOpen ? themeValues.selectedColor : GREY_CHATEAU,
|
|
24282
24281
|
dataQa: placeholder,
|
|
24283
24282
|
extraStyles: disabled ? "".concat(inputPlaceholderTextStyle).concat(inputDisabledStyle) : inputPlaceholderTextStyle,
|
|
24284
24283
|
hoverStyles: "background-color: ".concat(themeValues.hoverColor, ";"),
|
|
@@ -50271,7 +50270,6 @@ var DropdownIconV2 = function DropdownIconV2(_ref) {
|
|
|
50271
50270
|
color = _ref$color === void 0 ? "#292A33" : _ref$color,
|
|
50272
50271
|
props = _objectWithoutProperties(_ref, _excluded$Q);
|
|
50273
50272
|
return /*#__PURE__*/React__default.createElement("svg", _extends({
|
|
50274
|
-
"aria-hidden": "true",
|
|
50275
50273
|
width: width,
|
|
50276
50274
|
height: height,
|
|
50277
50275
|
viewBox: "0 0 ".concat(width, " ").concat(height),
|
|
@@ -51454,25 +51452,39 @@ var TurnstileWidget = /*#__PURE__*/React.forwardRef(function (_ref4, ref) {
|
|
|
51454
51452
|
}, error)));
|
|
51455
51453
|
});
|
|
51456
51454
|
|
|
51457
|
-
var
|
|
51455
|
+
var hoverColor$6 = SAPPHIRE_BLUE;
|
|
51456
|
+
var activeColor$b = PEACOCK_BLUE;
|
|
51457
|
+
var linkColor$6 = MATISSE_BLUE;
|
|
51458
|
+
var borderColor$7 = "rgba(255, 255, 255, 0.85)";
|
|
51459
|
+
var TOOLTIP_THEME_SOURCE = "Button";
|
|
51458
51460
|
var fallbackValues$12 = {
|
|
51459
|
-
|
|
51460
|
-
|
|
51461
|
-
|
|
51462
|
-
|
|
51461
|
+
borderColor: borderColor$7,
|
|
51462
|
+
linkColor: linkColor$6,
|
|
51463
|
+
hoverColor: hoverColor$6,
|
|
51464
|
+
activeColor: activeColor$b
|
|
51463
51465
|
};
|
|
51466
|
+
|
|
51464
51467
|
var Tooltip = function Tooltip(_ref) {
|
|
51465
51468
|
var tooltipID = _ref.tooltipID,
|
|
51466
|
-
|
|
51467
|
-
|
|
51468
|
-
_ref$
|
|
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,
|
|
51469
|
+
children = _ref.children,
|
|
51470
|
+
_ref$hasCustomTrigger = _ref.hasCustomTrigger,
|
|
51471
|
+
hasCustomTrigger = _ref$hasCustomTrigger === void 0 ? false : _ref$hasCustomTrigger,
|
|
51472
51472
|
_ref$triggerText = _ref.triggerText,
|
|
51473
|
-
triggerText = _ref$triggerText === void 0 ? "
|
|
51474
|
-
_ref$
|
|
51475
|
-
|
|
51473
|
+
triggerText = _ref$triggerText === void 0 ? "" : _ref$triggerText,
|
|
51474
|
+
_ref$containerExtraSt = _ref.containerExtraStyles,
|
|
51475
|
+
containerExtraStyles = _ref$containerExtraSt === void 0 ? "" : _ref$containerExtraSt,
|
|
51476
|
+
_ref$triggerButtonVar = _ref.triggerButtonVariant,
|
|
51477
|
+
triggerButtonVariant = _ref$triggerButtonVar === void 0 ? "smallGhost" : _ref$triggerButtonVar,
|
|
51478
|
+
_ref$content = _ref.content,
|
|
51479
|
+
content = _ref$content === void 0 ? "" : _ref$content,
|
|
51480
|
+
_ref$contentExtraStyl = _ref.contentExtraStyles,
|
|
51481
|
+
contentExtraStyles = _ref$contentExtraStyl === void 0 ? "" : _ref$contentExtraStyl,
|
|
51482
|
+
_ref$minWidth = _ref.minWidth,
|
|
51483
|
+
minWidth = _ref$minWidth === void 0 ? "250px" : _ref$minWidth,
|
|
51484
|
+
_ref$maxWidth = _ref.maxWidth,
|
|
51485
|
+
maxWidth = _ref$maxWidth === void 0 ? "100%" : _ref$maxWidth,
|
|
51486
|
+
_ref$height = _ref.height,
|
|
51487
|
+
height = _ref$height === void 0 ? "auto" : _ref$height,
|
|
51476
51488
|
_ref$contentPosition = _ref.contentPosition,
|
|
51477
51489
|
contentPosition = _ref$contentPosition === void 0 ? {
|
|
51478
51490
|
top: "-110px",
|
|
@@ -51489,22 +51501,7 @@ var Tooltip = function Tooltip(_ref) {
|
|
|
51489
51501
|
arrowBottom: "-8px",
|
|
51490
51502
|
arrowLeft: "auto"
|
|
51491
51503
|
} : _ref$arrowPosition,
|
|
51492
|
-
|
|
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;
|
|
51504
|
+
arrowColor = _ref.arrowColor;
|
|
51508
51505
|
var closeTimeoutRef = React.useRef(null);
|
|
51509
51506
|
var _useState = React.useState(false),
|
|
51510
51507
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -51512,10 +51509,6 @@ var Tooltip = function Tooltip(_ref) {
|
|
|
51512
51509
|
setTooltipOpen = _useState2[1];
|
|
51513
51510
|
var themeContext = React.useContext(styled.ThemeContext);
|
|
51514
51511
|
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;
|
|
51519
51512
|
var top = contentPosition.top,
|
|
51520
51513
|
right = contentPosition.right,
|
|
51521
51514
|
bottom = contentPosition.bottom,
|
|
@@ -51524,12 +51517,12 @@ var Tooltip = function Tooltip(_ref) {
|
|
|
51524
51517
|
arrowRight = arrowPosition.arrowRight,
|
|
51525
51518
|
arrowBottom = arrowPosition.arrowBottom,
|
|
51526
51519
|
arrowLeft = arrowPosition.arrowLeft;
|
|
51527
|
-
var handleToggleTooltip = function handleToggleTooltip(
|
|
51528
|
-
if (tooltipOpen !==
|
|
51529
|
-
setTooltipOpen(
|
|
51520
|
+
var handleToggleTooltip = function handleToggleTooltip(desiredState) {
|
|
51521
|
+
if (tooltipOpen !== desiredState) {
|
|
51522
|
+
setTooltipOpen(desiredState);
|
|
51530
51523
|
}
|
|
51531
51524
|
};
|
|
51532
|
-
var
|
|
51525
|
+
var handleKeyDown = function handleKeyDown(e) {
|
|
51533
51526
|
if (e.key === "Escape") {
|
|
51534
51527
|
handleToggleTooltip(false);
|
|
51535
51528
|
}
|
|
@@ -51553,57 +51546,61 @@ var Tooltip = function Tooltip(_ref) {
|
|
|
51553
51546
|
}
|
|
51554
51547
|
};
|
|
51555
51548
|
}, []);
|
|
51549
|
+
var renderTrigger = function renderTrigger() {
|
|
51550
|
+
if (hasCustomTrigger && children) {
|
|
51551
|
+
return /*#__PURE__*/React__default.cloneElement(React__default.Children.only(children), {
|
|
51552
|
+
"aria-describedby": tooltipID,
|
|
51553
|
+
onFocus: function onFocus() {
|
|
51554
|
+
return handleToggleTooltip(true);
|
|
51555
|
+
},
|
|
51556
|
+
onBlur: function onBlur() {
|
|
51557
|
+
return handleToggleTooltip(false);
|
|
51558
|
+
},
|
|
51559
|
+
onKeyDown: handleKeyDown
|
|
51560
|
+
});
|
|
51561
|
+
}
|
|
51562
|
+
return /*#__PURE__*/React__default.createElement(ButtonWithAction, {
|
|
51563
|
+
action: noop$1,
|
|
51564
|
+
"aria-describedby": tooltipID,
|
|
51565
|
+
onKeyDown: handleKeyDown,
|
|
51566
|
+
variant: triggerButtonVariant,
|
|
51567
|
+
onFocus: function onFocus() {
|
|
51568
|
+
return handleToggleTooltip(true);
|
|
51569
|
+
},
|
|
51570
|
+
onBlur: function onBlur() {
|
|
51571
|
+
return handleToggleTooltip(false);
|
|
51572
|
+
},
|
|
51573
|
+
onTouchStart: function onTouchStart() {
|
|
51574
|
+
return handleToggleTooltip(true);
|
|
51575
|
+
},
|
|
51576
|
+
"data-qa": "tooltip-trigger-".concat(tooltipID),
|
|
51577
|
+
text: triggerText,
|
|
51578
|
+
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 ")
|
|
51579
|
+
});
|
|
51580
|
+
};
|
|
51556
51581
|
return /*#__PURE__*/React__default.createElement(Box, {
|
|
51557
|
-
ref: closeTimeoutRef,
|
|
51558
51582
|
padding: "0",
|
|
51559
51583
|
extraStyles: "position: relative; ".concat(containerExtraStyles),
|
|
51560
|
-
onMouseEnter:
|
|
51561
|
-
|
|
51562
|
-
|
|
51563
|
-
|
|
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, {
|
|
51584
|
+
onMouseEnter: handleMouseEnter,
|
|
51585
|
+
onMouseLeave: handleMouseLeave,
|
|
51586
|
+
"data-qa": "".concat(tooltipID, "-container")
|
|
51587
|
+
}, renderTrigger(), /*#__PURE__*/React__default.createElement(Box, {
|
|
51593
51588
|
role: "tooltip",
|
|
51594
51589
|
id: tooltipID,
|
|
51595
51590
|
"aria-hidden": !tooltipOpen,
|
|
51596
|
-
background:
|
|
51591
|
+
background: themeValues.borderColor,
|
|
51597
51592
|
"data-qa": "tooltip-contents",
|
|
51598
|
-
extraStyles: "\n position: absolute;\n display: ".concat(tooltipOpen ? "block" : "none", ";\n top: ").concat(top, "
|
|
51593
|
+
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 "),
|
|
51599
51594
|
boxShadow: "0px 2px 14px 0px rgb(246, 246, 249), 0px 3px 8px 0px rgb(202, 206, 216)",
|
|
51600
51595
|
border: "1px solid transparent",
|
|
51601
51596
|
borderRadius: "4px",
|
|
51602
51597
|
minWidth: minWidth,
|
|
51603
51598
|
maxWidth: maxWidth
|
|
51604
|
-
},
|
|
51599
|
+
}, typeof content === "string" ? /*#__PURE__*/React__default.createElement(Text$1, {
|
|
51600
|
+
color: themeValues.linkColor
|
|
51601
|
+
}, content) : content, /*#__PURE__*/React__default.createElement(Box, {
|
|
51605
51602
|
padding: "0",
|
|
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 ")
|
|
51603
|
+
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 ")
|
|
51607
51604
|
})));
|
|
51608
51605
|
};
|
|
51609
51606
|
|