@thecb/components 11.8.0-beta.6 → 11.8.0-beta.8
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 +80 -72
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +80 -72
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/molecules/tooltip/Tooltip.js +105 -48
- package/src/components/molecules/tooltip/Tooltip.stories.js +136 -96
- package/src/components/molecules/tooltip/index.d.ts +18 -18
package/dist/index.cjs.js
CHANGED
|
@@ -51175,35 +51175,25 @@ var TurnstileWidget = /*#__PURE__*/React.forwardRef(function (_ref4, ref) {
|
|
|
51175
51175
|
}, error)));
|
|
51176
51176
|
});
|
|
51177
51177
|
|
|
51178
|
-
var
|
|
51179
|
-
var activeColor$b = "#0E506D";
|
|
51180
|
-
var tooltipTriggerColor = "#15749D";
|
|
51178
|
+
var TOOLTIP_THEME_SOURCE = "Popover";
|
|
51181
51179
|
var fallbackValues$12 = {
|
|
51182
|
-
hoverColor:
|
|
51183
|
-
activeColor:
|
|
51184
|
-
|
|
51180
|
+
hoverColor: SAPPHIRE_BLUE,
|
|
51181
|
+
activeColor: PEACOCK_BLUE,
|
|
51182
|
+
popoverTriggerColor: MATISSE_BLUE,
|
|
51183
|
+
borderColor: "rgba(255, 255, 255, 0.85)"
|
|
51185
51184
|
};
|
|
51186
|
-
|
|
51187
51185
|
var Tooltip = function Tooltip(_ref) {
|
|
51188
|
-
var
|
|
51189
|
-
tooltipContainerExtraStyles = _ref$tooltipContainer === void 0 ? "" : _ref$tooltipContainer,
|
|
51190
|
-
themeValues = _ref.themeValues,
|
|
51191
|
-
_ref$tooltipID = _ref.tooltipID,
|
|
51192
|
-
tooltipID = _ref$tooltipID === void 0 ? "tooltip-content" : _ref$tooltipID,
|
|
51186
|
+
var tooltipID = _ref.tooltipID,
|
|
51193
51187
|
_ref$hasIconTrigger = _ref.hasIconTrigger,
|
|
51194
51188
|
hasIconTrigger = _ref$hasIconTrigger === void 0 ? false : _ref$hasIconTrigger,
|
|
51195
51189
|
_ref$IconTrigger = _ref.IconTrigger,
|
|
51196
51190
|
IconTrigger = _ref$IconTrigger === void 0 ? WarningIconXS : _ref$IconTrigger,
|
|
51197
51191
|
_ref$iconHelpText = _ref.iconHelpText,
|
|
51198
51192
|
iconHelpText = _ref$iconHelpText === void 0 ? "Open the tooltip" : _ref$iconHelpText,
|
|
51193
|
+
_ref$triggerText = _ref.triggerText,
|
|
51194
|
+
triggerText = _ref$triggerText === void 0 ? "Open the tooltip" : _ref$triggerText,
|
|
51199
51195
|
_ref$tooltipContent = _ref.tooltipContent,
|
|
51200
|
-
tooltipContent = _ref$tooltipContent === void 0 ? "" : _ref$tooltipContent,
|
|
51201
|
-
_ref$tooltipTriggerTe = _ref.tooltipTriggerText,
|
|
51202
|
-
tooltipTriggerText = _ref$tooltipTriggerTe === void 0 ? "" : _ref$tooltipTriggerTe,
|
|
51203
|
-
_ref$triggerTextExtra = _ref.triggerTextExtraStyles,
|
|
51204
|
-
triggerTextExtraStyles = _ref$triggerTextExtra === void 0 ? "" : _ref$triggerTextExtra,
|
|
51205
|
-
_ref$contentExtraStyl = _ref.contentExtraStyles,
|
|
51206
|
-
contentExtraStyles = _ref$contentExtraStyl === void 0 ? "" : _ref$contentExtraStyl,
|
|
51196
|
+
tooltipContent = _ref$tooltipContent === void 0 ? "The contents of the tooltip go here." : _ref$tooltipContent,
|
|
51207
51197
|
_ref$contentPosition = _ref.contentPosition,
|
|
51208
51198
|
contentPosition = _ref$contentPosition === void 0 ? {
|
|
51209
51199
|
top: "-110px",
|
|
@@ -51226,31 +51216,34 @@ var Tooltip = function Tooltip(_ref) {
|
|
|
51226
51216
|
maxWidth = _ref$maxWidth === void 0 ? "300px" : _ref$maxWidth,
|
|
51227
51217
|
_ref$height = _ref.height,
|
|
51228
51218
|
height = _ref$height === void 0 ? "auto" : _ref$height,
|
|
51229
|
-
|
|
51230
|
-
_ref$
|
|
51231
|
-
|
|
51232
|
-
_ref$
|
|
51233
|
-
|
|
51234
|
-
|
|
51235
|
-
|
|
51236
|
-
tooltipTriggerColor = themeValues.tooltipTriggerColor;
|
|
51237
|
-
var _ref2 = contentPosition !== null && contentPosition !== void 0 ? contentPosition : {},
|
|
51238
|
-
top = _ref2.top,
|
|
51239
|
-
right = _ref2.right,
|
|
51240
|
-
bottom = _ref2.bottom,
|
|
51241
|
-
left = _ref2.left;
|
|
51242
|
-
var _ref3 = arrowPosition !== null && arrowPosition !== void 0 ? arrowPosition : {},
|
|
51243
|
-
arrowTop = _ref3.arrowTop,
|
|
51244
|
-
arrowRight = _ref3.arrowRight,
|
|
51245
|
-
arrowBottom = _ref3.arrowBottom,
|
|
51246
|
-
arrowLeft = _ref3.arrowLeft;
|
|
51219
|
+
_ref$containerExtraSt = _ref.containerExtraStyles,
|
|
51220
|
+
containerExtraStyles = _ref$containerExtraSt === void 0 ? "" : _ref$containerExtraSt,
|
|
51221
|
+
_ref$triggerExtraStyl = _ref.triggerExtraStyles,
|
|
51222
|
+
triggerExtraStyles = _ref$triggerExtraStyl === void 0 ? "" : _ref$triggerExtraStyl,
|
|
51223
|
+
_ref$triggerButtonVar = _ref.triggerButtonVariant,
|
|
51224
|
+
triggerButtonVariant = _ref$triggerButtonVar === void 0 ? "smallGhost" : _ref$triggerButtonVar;
|
|
51225
|
+
var closeTimeoutRef = React.useRef(null);
|
|
51247
51226
|
var _useState = React.useState(false),
|
|
51248
51227
|
_useState2 = _slicedToArray(_useState, 2),
|
|
51249
51228
|
tooltipOpen = _useState2[0],
|
|
51250
51229
|
setTooltipOpen = _useState2[1];
|
|
51251
|
-
var
|
|
51252
|
-
|
|
51253
|
-
|
|
51230
|
+
var themeContext = React.useContext(styled.ThemeContext);
|
|
51231
|
+
var themeValues = createThemeValues(themeContext, fallbackValues$12, TOOLTIP_THEME_SOURCE);
|
|
51232
|
+
var borderColor = themeValues.borderColor,
|
|
51233
|
+
tooltipTriggerColor = themeValues.popoverTriggerColor,
|
|
51234
|
+
hoverColor = themeValues.hoverColor,
|
|
51235
|
+
activeColor = themeValues.activeColor;
|
|
51236
|
+
var top = contentPosition.top,
|
|
51237
|
+
right = contentPosition.right,
|
|
51238
|
+
bottom = contentPosition.bottom,
|
|
51239
|
+
left = contentPosition.left;
|
|
51240
|
+
var arrowTop = arrowPosition.arrowTop,
|
|
51241
|
+
arrowRight = arrowPosition.arrowRight,
|
|
51242
|
+
arrowBottom = arrowPosition.arrowBottom,
|
|
51243
|
+
arrowLeft = arrowPosition.arrowLeft;
|
|
51244
|
+
var handleToggleTooltip = function handleToggleTooltip(desiredTooltipState) {
|
|
51245
|
+
if (tooltipOpen !== desiredTooltipState) {
|
|
51246
|
+
setTooltipOpen(desiredTooltipState);
|
|
51254
51247
|
}
|
|
51255
51248
|
};
|
|
51256
51249
|
var handleKeyboardEvent = function handleKeyboardEvent(e) {
|
|
@@ -51258,62 +51251,77 @@ var Tooltip = function Tooltip(_ref) {
|
|
|
51258
51251
|
handleToggleTooltip(false);
|
|
51259
51252
|
}
|
|
51260
51253
|
};
|
|
51254
|
+
var handleMouseEnter = function handleMouseEnter() {
|
|
51255
|
+
if (closeTimeoutRef.current) {
|
|
51256
|
+
clearTimeout(closeTimeoutRef.current);
|
|
51257
|
+
closeTimeoutRef.current = null;
|
|
51258
|
+
}
|
|
51259
|
+
handleToggleTooltip(true);
|
|
51260
|
+
};
|
|
51261
|
+
var handleMouseLeave = function handleMouseLeave() {
|
|
51262
|
+
closeTimeoutRef.current = setTimeout(function () {
|
|
51263
|
+
handleToggleTooltip(false);
|
|
51264
|
+
}, 300);
|
|
51265
|
+
};
|
|
51266
|
+
React.useEffect(function () {
|
|
51267
|
+
return function () {
|
|
51268
|
+
if (closeTimeoutRef.current) {
|
|
51269
|
+
clearTimeout(closeTimeoutRef.current);
|
|
51270
|
+
}
|
|
51271
|
+
};
|
|
51272
|
+
}, []);
|
|
51261
51273
|
return /*#__PURE__*/React__default.createElement(Box, {
|
|
51274
|
+
ref: closeTimeoutRef,
|
|
51262
51275
|
padding: "0",
|
|
51263
|
-
extraStyles: "position: relative; ".concat(
|
|
51264
|
-
|
|
51265
|
-
|
|
51266
|
-
|
|
51276
|
+
extraStyles: "position: relative; ".concat(containerExtraStyles),
|
|
51277
|
+
onMouseEnter: function onMouseEnter() {
|
|
51278
|
+
return handleMouseEnter();
|
|
51279
|
+
},
|
|
51280
|
+
onMouseLeave: function onMouseLeave() {
|
|
51281
|
+
return handleMouseLeave();
|
|
51267
51282
|
},
|
|
51283
|
+
"data-qa": "tooltip-container"
|
|
51284
|
+
}, /*#__PURE__*/React__default.createElement(ButtonWithAction, {
|
|
51285
|
+
"aria-describedby": tooltipID,
|
|
51286
|
+
onKeyDown: handleKeyboardEvent,
|
|
51287
|
+
variant: triggerButtonVariant,
|
|
51268
51288
|
onFocus: function onFocus() {
|
|
51269
51289
|
return handleToggleTooltip(true);
|
|
51270
51290
|
},
|
|
51271
51291
|
onBlur: function onBlur() {
|
|
51272
51292
|
return handleToggleTooltip(false);
|
|
51273
51293
|
},
|
|
51274
|
-
onKeyDown: handleKeyboardEvent,
|
|
51275
51294
|
onTouchStart: function onTouchStart() {
|
|
51276
51295
|
return handleToggleTooltip(true);
|
|
51277
51296
|
},
|
|
51278
|
-
|
|
51279
|
-
|
|
51280
|
-
|
|
51281
|
-
onMouseEnter: function onMouseEnter() {
|
|
51282
|
-
return handleToggleTooltip(true);
|
|
51283
|
-
},
|
|
51284
|
-
onMouseLeave: function onMouseLeave() {
|
|
51285
|
-
return handleToggleTooltip(false);
|
|
51286
|
-
},
|
|
51287
|
-
contentOverride: true,
|
|
51288
|
-
variant: "smallGhost",
|
|
51289
|
-
tabIndex: "0",
|
|
51290
|
-
"aria-describedby": tooltipID,
|
|
51291
|
-
extraStyles: buttonExtraStyles
|
|
51292
|
-
}, hasIconTrigger && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Box, {
|
|
51297
|
+
"data-qa": "tooltip-trigger",
|
|
51298
|
+
contentOverride: true
|
|
51299
|
+
}, hasIconTrigger === true && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Box, {
|
|
51293
51300
|
"aria-label": "Open tooltip"
|
|
51294
51301
|
}, /*#__PURE__*/React__default.createElement(IconTrigger, {
|
|
51295
51302
|
color: tooltipTriggerColor
|
|
51296
51303
|
})), /*#__PURE__*/React__default.createElement(Box, {
|
|
51297
51304
|
padding: "0",
|
|
51298
51305
|
srOnly: true
|
|
51299
|
-
}, /*#__PURE__*/React__default.createElement(Text$1, null, iconHelpText))),
|
|
51300
|
-
|
|
51301
|
-
|
|
51302
|
-
|
|
51303
|
-
borderRadius: "4px",
|
|
51304
|
-
boxShadow: "0px 2px 14px 0px rgb(246, 246, 249), 0px 3px 8px 0px rgb(202, 206, 216)",
|
|
51305
|
-
id: tooltipID,
|
|
51306
|
+
}, /*#__PURE__*/React__default.createElement(Text$1, null, iconHelpText))), hasIconTrigger === false && /*#__PURE__*/React__default.createElement(Text$1, {
|
|
51307
|
+
color: tooltipTriggerColor,
|
|
51308
|
+
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 ")
|
|
51309
|
+
}, triggerText)), /*#__PURE__*/React__default.createElement(Box, {
|
|
51306
51310
|
role: "tooltip",
|
|
51307
|
-
|
|
51308
|
-
maxWidth: maxWidth,
|
|
51311
|
+
id: tooltipID,
|
|
51309
51312
|
"aria-hidden": !tooltipOpen,
|
|
51310
|
-
|
|
51313
|
+
"data-qa": "tooltip-contents",
|
|
51314
|
+
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 "),
|
|
51315
|
+
boxShadow: "0px 2px 14px 0px rgb(246, 246, 249), 0px 3px 8px 0px rgb(202, 206, 216)",
|
|
51316
|
+
border: "1px solid transparent",
|
|
51317
|
+
borderRadius: "4px",
|
|
51318
|
+
minWidth: minWidth,
|
|
51319
|
+
maxWidth: maxWidth
|
|
51311
51320
|
}, /*#__PURE__*/React__default.createElement(Paragraph$1, null, tooltipContent), /*#__PURE__*/React__default.createElement(Box, {
|
|
51312
51321
|
padding: "0",
|
|
51313
51322
|
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 ")
|
|
51314
51323
|
})));
|
|
51315
51324
|
};
|
|
51316
|
-
var Tooltip$1 = themeComponent(Tooltip, "Tooltip", fallbackValues$12);
|
|
51317
51325
|
|
|
51318
51326
|
var pageBackground = "#FBFCFD";
|
|
51319
51327
|
var fallbackValues$13 = {
|
|
@@ -51870,7 +51878,7 @@ exports.TimeoutImage = TimeoutImage;
|
|
|
51870
51878
|
exports.Title = Title$1;
|
|
51871
51879
|
exports.ToastNotification = ToastNotification;
|
|
51872
51880
|
exports.ToggleSwitch = ToggleSwitch$1;
|
|
51873
|
-
exports.Tooltip = Tooltip
|
|
51881
|
+
exports.Tooltip = Tooltip;
|
|
51874
51882
|
exports.TrashIcon = TrashIcon$1;
|
|
51875
51883
|
exports.TrashIconV2 = TrashIconV2$1;
|
|
51876
51884
|
exports.TurnstileWidget = TurnstileWidget;
|