@thecb/components 11.10.1-beta.2 → 11.10.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/README.md +8 -4
- package/dist/index.cjs.js +115 -94
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +115 -94
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/atoms/card-type/CardType.js +10 -2
- 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/atoms/form-layouts/FormInput.js +1 -1
- package/src/components/atoms/formatted-credit-card/FormattedCreditCard.js +10 -7
- package/src/components/atoms/icons/AmExSmallIcon.js +2 -0
- package/src/components/atoms/icons/DiscoverSmallIcon.js +2 -0
- package/src/components/atoms/icons/GenericCardLarge.js +1 -1
- package/src/components/atoms/icons/GenericSmallIcon.js +2 -0
- package/src/components/atoms/icons/MasterCardSmallIcon.js +2 -0
- package/src/components/atoms/icons/VisaSmallIcon.js +2 -0
- package/src/components/molecules/radio-section/InnerRadioSection.js +2 -2
- package/src/components/molecules/tooltip/Tooltip.js +93 -65
- 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 -15
- package/src/components/molecules/tooltip/index.d.ts +7 -4
package/README.md
CHANGED
|
@@ -11,8 +11,6 @@ This library contains CityBase React components for use across all current and f
|
|
|
11
11
|
- [Storybook deployment](#storybook-deployment)
|
|
12
12
|
- [Adding new components](#adding-new-components)
|
|
13
13
|
- [Version bumping and publishing](#version-bumping-and-publishing)
|
|
14
|
-
- [Version bumping](#version-bumping)
|
|
15
|
-
- [Publishing new versions to NPM](#publishing-new-versions-to-npm)
|
|
16
14
|
- [Consuming in your application](#consuming-in-your-application)
|
|
17
15
|
|
|
18
16
|
- [Adding to existing application](#adding-to-existing-application)
|
|
@@ -104,9 +102,15 @@ export * from "./button-with-action";
|
|
|
104
102
|
|
|
105
103
|
## Version bumping and publishing
|
|
106
104
|
|
|
107
|
-
|
|
105
|
+
Publishing to NPM is automated. When a PR is merged to master, the package will automatically be built and published to NPM using the version specified in `package.json`. **Developers no longer need to manually run `yarn build && yarn publish`.**
|
|
108
106
|
|
|
109
|
-
|
|
107
|
+
### How it works
|
|
108
|
+
|
|
109
|
+
1. Before merging your PR, bump the version in `package.json` to an appropriate new version following semantic versioning (see below).
|
|
110
|
+
2. Ensure the version you set has **not already been published** to NPM. If you merge a PR with a version that has already been published, the automated publish will fail and you will need to create a follow-up PR that bumps the version to an unpublished one.
|
|
111
|
+
3. Merge your PR to master. The CI pipeline will automatically build and publish the new version.
|
|
112
|
+
|
|
113
|
+
### Semantic versioning
|
|
110
114
|
|
|
111
115
|
- CB Components follows semantic versioning practices, which divides version upgrades into three categories: "Patch" (e.g., `6.0.1` -> `6.0.2`), "Minor" (e.g., `6.0.2` -> `6.1.0`), and "Major" (e.g., `6.1.0` -> `7.0.0`)
|
|
112
116
|
|
package/dist/index.cjs.js
CHANGED
|
@@ -15822,7 +15822,7 @@ var GenericCardLarge = function GenericCardLarge() {
|
|
|
15822
15822
|
fill: "none",
|
|
15823
15823
|
xmlns: "http://www.w3.org/2000/svg",
|
|
15824
15824
|
role: "img",
|
|
15825
|
-
"aria-label": "
|
|
15825
|
+
"aria-label": "Credit card"
|
|
15826
15826
|
}, /*#__PURE__*/React__default.createElement("rect", {
|
|
15827
15827
|
width: "36",
|
|
15828
15828
|
height: "24",
|
|
@@ -18700,7 +18700,9 @@ var VisaSmallIcon = function VisaSmallIcon() {
|
|
|
18700
18700
|
height: "16",
|
|
18701
18701
|
viewBox: "0 0 24 16",
|
|
18702
18702
|
fill: "none",
|
|
18703
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
18703
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
18704
|
+
role: "img",
|
|
18705
|
+
"aria-label": "Visa"
|
|
18704
18706
|
}, /*#__PURE__*/React__default.createElement("path", {
|
|
18705
18707
|
fillRule: "evenodd",
|
|
18706
18708
|
clipRule: "evenodd",
|
|
@@ -18727,7 +18729,9 @@ var AmExSmallIcon = function AmExSmallIcon() {
|
|
|
18727
18729
|
height: "16",
|
|
18728
18730
|
viewBox: "0 0 24 16",
|
|
18729
18731
|
fill: "none",
|
|
18730
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
18732
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
18733
|
+
role: "img",
|
|
18734
|
+
"aria-label": "American Express"
|
|
18731
18735
|
}, /*#__PURE__*/React__default.createElement("g", {
|
|
18732
18736
|
clipPath: "url(#clip0_3693_1095)"
|
|
18733
18737
|
}, /*#__PURE__*/React__default.createElement("g", {
|
|
@@ -18826,7 +18830,9 @@ var DiscoverSmallIcon = function DiscoverSmallIcon() {
|
|
|
18826
18830
|
height: "16",
|
|
18827
18831
|
viewBox: "0 0 24 16",
|
|
18828
18832
|
fill: "none",
|
|
18829
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
18833
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
18834
|
+
role: "img",
|
|
18835
|
+
"aria-label": "Discover"
|
|
18830
18836
|
}, /*#__PURE__*/React__default.createElement("g", {
|
|
18831
18837
|
clipPath: "url(#clip0_3818_267)"
|
|
18832
18838
|
}, /*#__PURE__*/React__default.createElement("path", {
|
|
@@ -18951,7 +18957,9 @@ var GenericSmallIcon = function GenericSmallIcon() {
|
|
|
18951
18957
|
height: "16",
|
|
18952
18958
|
viewBox: "0 0 24 16",
|
|
18953
18959
|
fill: "none",
|
|
18954
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
18960
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
18961
|
+
role: "img",
|
|
18962
|
+
"aria-label": "Credit card"
|
|
18955
18963
|
}, /*#__PURE__*/React__default.createElement("rect", {
|
|
18956
18964
|
width: "24",
|
|
18957
18965
|
height: "16",
|
|
@@ -18972,7 +18980,9 @@ var MasterCardSmallIcon = function MasterCardSmallIcon() {
|
|
|
18972
18980
|
height: "16",
|
|
18973
18981
|
viewBox: "0 0 24 16",
|
|
18974
18982
|
fill: "none",
|
|
18975
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
18983
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
18984
|
+
role: "img",
|
|
18985
|
+
"aria-label": "Mastercard"
|
|
18976
18986
|
}, /*#__PURE__*/React__default.createElement("rect", {
|
|
18977
18987
|
width: "24",
|
|
18978
18988
|
height: "16",
|
|
@@ -22623,6 +22633,7 @@ var SortableTableHeading$1 = themeComponent(SortableTableHeading, "SortableTable
|
|
|
22623
22633
|
|
|
22624
22634
|
var DropdownIcon = function DropdownIcon() {
|
|
22625
22635
|
return /*#__PURE__*/React__default.createElement("svg", {
|
|
22636
|
+
"aria-hidden": "true",
|
|
22626
22637
|
version: "1.2",
|
|
22627
22638
|
xmlns: "http://www.w3.org/2000/svg",
|
|
22628
22639
|
overflow: "visible",
|
|
@@ -23972,7 +23983,7 @@ var IconWrapper = styled__default.div.withConfig({
|
|
|
23972
23983
|
var DropdownContentWrapper = styled__default.div.withConfig({
|
|
23973
23984
|
displayName: "Dropdown__DropdownContentWrapper",
|
|
23974
23985
|
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;}"],
|
|
23986
|
+
})(["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
23987
|
var widthFitOptions = _ref2.widthFitOptions;
|
|
23977
23988
|
return widthFitOptions ? "fit-content" : "100%";
|
|
23978
23989
|
}, function (_ref3) {
|
|
@@ -24277,7 +24288,7 @@ var Dropdown = function Dropdown(_ref13) {
|
|
|
24277
24288
|
background: isOpen ? themeValues.hoverColor : WHITE,
|
|
24278
24289
|
borderRadius: "2px",
|
|
24279
24290
|
borderSize: "1px",
|
|
24280
|
-
borderColor: isError ? ERROR_COLOR : isOpen ? themeValues.selectedColor :
|
|
24291
|
+
borderColor: isError ? ERROR_COLOR : isOpen ? themeValues.selectedColor : STORM_GREY,
|
|
24281
24292
|
dataQa: placeholder,
|
|
24282
24293
|
extraStyles: disabled ? "".concat(inputPlaceholderTextStyle).concat(inputDisabledStyle) : inputPlaceholderTextStyle,
|
|
24283
24294
|
hoverStyles: "background-color: ".concat(themeValues.hoverColor, ";"),
|
|
@@ -25921,7 +25932,8 @@ var FormInput = function FormInput(_ref15) {
|
|
|
25921
25932
|
padding: "0"
|
|
25922
25933
|
}, helperModal ? /*#__PURE__*/React__default.createElement(Cluster, {
|
|
25923
25934
|
justify: "space-between",
|
|
25924
|
-
align: "center"
|
|
25935
|
+
align: "center",
|
|
25936
|
+
overflow: true
|
|
25925
25937
|
}, labelDisplayOverride ? labelDisplayOverride : /*#__PURE__*/React__default.createElement(Text$1, {
|
|
25926
25938
|
as: "label",
|
|
25927
25939
|
color: themeValues.labelColor,
|
|
@@ -26365,17 +26377,21 @@ var cardBrands = {
|
|
|
26365
26377
|
large: GenericCardLarge
|
|
26366
26378
|
}
|
|
26367
26379
|
};
|
|
26380
|
+
var normalizeType = function normalizeType(type) {
|
|
26381
|
+
if (!type) return undefined;
|
|
26382
|
+
var lower = type.toLowerCase();
|
|
26383
|
+
if (lower === "mastercard") return "master_card";
|
|
26384
|
+
return lower;
|
|
26385
|
+
};
|
|
26368
26386
|
var CardType = function CardType(_ref) {
|
|
26369
26387
|
var type = _ref.type,
|
|
26370
26388
|
_ref$size = _ref.size,
|
|
26371
26389
|
size = _ref$size === void 0 ? "small" : _ref$size;
|
|
26372
|
-
var
|
|
26390
|
+
var normalizedType = normalizeType(type);
|
|
26391
|
+
var _ref2 = cardBrands[normalizedType] || cardBrands["default"],
|
|
26373
26392
|
label = _ref2.label,
|
|
26374
26393
|
IconComponent = _ref2[size];
|
|
26375
|
-
return /*#__PURE__*/React__default.createElement("span",
|
|
26376
|
-
role: "img",
|
|
26377
|
-
"aria-label": label
|
|
26378
|
-
}, /*#__PURE__*/React__default.createElement(IconComponent, null));
|
|
26394
|
+
return /*#__PURE__*/React__default.createElement("span", null, /*#__PURE__*/React__default.createElement(IconComponent, null));
|
|
26379
26395
|
};
|
|
26380
26396
|
|
|
26381
26397
|
var textColor$2 = "".concat(CHARADE_GREY);
|
|
@@ -26449,7 +26465,7 @@ var CreditCardWrapper = styled__default.div.withConfig({
|
|
|
26449
26465
|
var CCIconWrapper = styled__default.div.withConfig({
|
|
26450
26466
|
displayName: "FormattedCreditCard__CCIconWrapper",
|
|
26451
26467
|
componentId: "sc-s0ta5l-1"
|
|
26452
|
-
})(["margin-right:16px;width:
|
|
26468
|
+
})(["margin-right:16px;width:36px;height:auto;display:flex;"]);
|
|
26453
26469
|
var FormattedCreditCard = function FormattedCreditCard(_ref) {
|
|
26454
26470
|
var lastFour = _ref.lastFour,
|
|
26455
26471
|
type = _ref.type,
|
|
@@ -26457,15 +26473,18 @@ var FormattedCreditCard = function FormattedCreditCard(_ref) {
|
|
|
26457
26473
|
expireDate = _ref.expireDate,
|
|
26458
26474
|
expirationStatus = _ref.expirationStatus,
|
|
26459
26475
|
themeValues = _ref.themeValues;
|
|
26476
|
+
var _useContext = React.useContext(styled.ThemeContext),
|
|
26477
|
+
isMobile = _useContext.isMobile;
|
|
26460
26478
|
return /*#__PURE__*/React__default.createElement(CreditCardWrapper, null, /*#__PURE__*/React__default.createElement(CCIconWrapper, null, /*#__PURE__*/React__default.createElement(CardType, {
|
|
26461
|
-
type: type
|
|
26479
|
+
type: type,
|
|
26480
|
+
size: isMobile ? "small" : "large"
|
|
26462
26481
|
})), /*#__PURE__*/React__default.createElement(Stack, {
|
|
26463
26482
|
childGap: "0"
|
|
26464
26483
|
}, /*#__PURE__*/React__default.createElement(Box, {
|
|
26465
26484
|
padding: "0"
|
|
26466
26485
|
}, /*#__PURE__*/React__default.createElement(Text$1, {
|
|
26467
26486
|
variant: "p",
|
|
26468
|
-
padding: "0
|
|
26487
|
+
padding: "0",
|
|
26469
26488
|
color: themeValues.textColor,
|
|
26470
26489
|
textAlign: "left",
|
|
26471
26490
|
extraStyles: "display: inline-block;"
|
|
@@ -48914,10 +48933,10 @@ var InnerRadioSection = function InnerRadioSection(_ref) {
|
|
|
48914
48933
|
componentId: "sc-1wtp6qc-0"
|
|
48915
48934
|
})(["height:", ";width:", ";", " transition:opacity 0.3s ease;"], function (_ref2) {
|
|
48916
48935
|
var isMobile = _ref2.isMobile;
|
|
48917
|
-
return isMobile ? "
|
|
48936
|
+
return isMobile ? "16px" : "24px";
|
|
48918
48937
|
}, function (_ref3) {
|
|
48919
48938
|
var isMobile = _ref3.isMobile;
|
|
48920
|
-
return isMobile ? "
|
|
48939
|
+
return isMobile ? "24px" : "36px";
|
|
48921
48940
|
}, function (_ref4) {
|
|
48922
48941
|
var fade = _ref4.fade;
|
|
48923
48942
|
return fade && "opacity: 0.4;";
|
|
@@ -50269,6 +50288,7 @@ var DropdownIconV2 = function DropdownIconV2(_ref) {
|
|
|
50269
50288
|
color = _ref$color === void 0 ? "#292A33" : _ref$color,
|
|
50270
50289
|
props = _objectWithoutProperties(_ref, _excluded$Q);
|
|
50271
50290
|
return /*#__PURE__*/React__default.createElement("svg", _extends({
|
|
50291
|
+
"aria-hidden": "true",
|
|
50272
50292
|
width: width,
|
|
50273
50293
|
height: height,
|
|
50274
50294
|
viewBox: "0 0 ".concat(width, " ").concat(height),
|
|
@@ -51451,39 +51471,25 @@ var TurnstileWidget = /*#__PURE__*/React.forwardRef(function (_ref4, ref) {
|
|
|
51451
51471
|
}, error)));
|
|
51452
51472
|
});
|
|
51453
51473
|
|
|
51454
|
-
var
|
|
51455
|
-
var activeColor$b = PEACOCK_BLUE;
|
|
51456
|
-
var linkColor$6 = MATISSE_BLUE;
|
|
51457
|
-
var borderColor$7 = "rgba(255, 255, 255, 0.85)";
|
|
51458
|
-
var TOOLTIP_THEME_SOURCE = "Button";
|
|
51474
|
+
var TOOLTIP_THEME_SOURCE = "Popover";
|
|
51459
51475
|
var fallbackValues$12 = {
|
|
51460
|
-
|
|
51461
|
-
|
|
51462
|
-
|
|
51463
|
-
|
|
51476
|
+
hoverColor: SAPPHIRE_BLUE,
|
|
51477
|
+
activeColor: PEACOCK_BLUE,
|
|
51478
|
+
popoverTriggerColor: MATISSE_BLUE,
|
|
51479
|
+
borderColor: "rgba(255, 255, 255, 0.85)"
|
|
51464
51480
|
};
|
|
51465
|
-
|
|
51466
51481
|
var Tooltip = function Tooltip(_ref) {
|
|
51467
51482
|
var tooltipID = _ref.tooltipID,
|
|
51468
|
-
|
|
51469
|
-
_ref$
|
|
51470
|
-
|
|
51483
|
+
_ref$hasIconTrigger = _ref.hasIconTrigger,
|
|
51484
|
+
hasIconTrigger = _ref$hasIconTrigger === void 0 ? false : _ref$hasIconTrigger,
|
|
51485
|
+
_ref$IconTrigger = _ref.IconTrigger,
|
|
51486
|
+
IconTrigger = _ref$IconTrigger === void 0 ? WarningIconXS : _ref$IconTrigger,
|
|
51487
|
+
_ref$iconHelpText = _ref.iconHelpText,
|
|
51488
|
+
iconHelpText = _ref$iconHelpText === void 0 ? "Open the tooltip" : _ref$iconHelpText,
|
|
51471
51489
|
_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,
|
|
51490
|
+
triggerText = _ref$triggerText === void 0 ? "Open the tooltip" : _ref$triggerText,
|
|
51491
|
+
_ref$tooltipContent = _ref.tooltipContent,
|
|
51492
|
+
tooltipContent = _ref$tooltipContent === void 0 ? "The contents of the tooltip go here." : _ref$tooltipContent,
|
|
51487
51493
|
_ref$contentPosition = _ref.contentPosition,
|
|
51488
51494
|
contentPosition = _ref$contentPosition === void 0 ? {
|
|
51489
51495
|
top: "-110px",
|
|
@@ -51500,7 +51506,22 @@ var Tooltip = function Tooltip(_ref) {
|
|
|
51500
51506
|
arrowBottom: "-8px",
|
|
51501
51507
|
arrowLeft: "auto"
|
|
51502
51508
|
} : _ref$arrowPosition,
|
|
51503
|
-
|
|
51509
|
+
_ref$minWidth = _ref.minWidth,
|
|
51510
|
+
minWidth = _ref$minWidth === void 0 ? "250px" : _ref$minWidth,
|
|
51511
|
+
_ref$maxWidth = _ref.maxWidth,
|
|
51512
|
+
maxWidth = _ref$maxWidth === void 0 ? "300px" : _ref$maxWidth,
|
|
51513
|
+
_ref$height = _ref.height,
|
|
51514
|
+
height = _ref$height === void 0 ? "auto" : _ref$height,
|
|
51515
|
+
_ref$containerExtraSt = _ref.containerExtraStyles,
|
|
51516
|
+
containerExtraStyles = _ref$containerExtraSt === void 0 ? "" : _ref$containerExtraSt,
|
|
51517
|
+
_ref$triggerExtraStyl = _ref.triggerExtraStyles,
|
|
51518
|
+
triggerExtraStyles = _ref$triggerExtraStyl === void 0 ? "" : _ref$triggerExtraStyl,
|
|
51519
|
+
_ref$triggerButtonVar = _ref.triggerButtonVariant,
|
|
51520
|
+
triggerButtonVariant = _ref$triggerButtonVar === void 0 ? "smallGhost" : _ref$triggerButtonVar,
|
|
51521
|
+
_ref$contentExtraStyl = _ref.contentExtraStyles,
|
|
51522
|
+
contentExtraStyles = _ref$contentExtraStyl === void 0 ? "" : _ref$contentExtraStyl,
|
|
51523
|
+
_ref$contentBackgroun = _ref.contentBackgroundColor,
|
|
51524
|
+
contentBackgroundColor = _ref$contentBackgroun === void 0 ? WHITE : _ref$contentBackgroun;
|
|
51504
51525
|
var closeTimeoutRef = React.useRef(null);
|
|
51505
51526
|
var _useState = React.useState(false),
|
|
51506
51527
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -51508,6 +51529,10 @@ var Tooltip = function Tooltip(_ref) {
|
|
|
51508
51529
|
setTooltipOpen = _useState2[1];
|
|
51509
51530
|
var themeContext = React.useContext(styled.ThemeContext);
|
|
51510
51531
|
var themeValues = createThemeValues(themeContext, fallbackValues$12, TOOLTIP_THEME_SOURCE);
|
|
51532
|
+
var borderColor = themeValues.borderColor,
|
|
51533
|
+
tooltipTriggerColor = themeValues.popoverTriggerColor,
|
|
51534
|
+
hoverColor = themeValues.hoverColor,
|
|
51535
|
+
activeColor = themeValues.activeColor;
|
|
51511
51536
|
var top = contentPosition.top,
|
|
51512
51537
|
right = contentPosition.right,
|
|
51513
51538
|
bottom = contentPosition.bottom,
|
|
@@ -51516,12 +51541,12 @@ var Tooltip = function Tooltip(_ref) {
|
|
|
51516
51541
|
arrowRight = arrowPosition.arrowRight,
|
|
51517
51542
|
arrowBottom = arrowPosition.arrowBottom,
|
|
51518
51543
|
arrowLeft = arrowPosition.arrowLeft;
|
|
51519
|
-
var handleToggleTooltip = function handleToggleTooltip(
|
|
51520
|
-
if (tooltipOpen !==
|
|
51521
|
-
setTooltipOpen(
|
|
51544
|
+
var handleToggleTooltip = function handleToggleTooltip(desiredTooltipState) {
|
|
51545
|
+
if (tooltipOpen !== desiredTooltipState) {
|
|
51546
|
+
setTooltipOpen(desiredTooltipState);
|
|
51522
51547
|
}
|
|
51523
51548
|
};
|
|
51524
|
-
var
|
|
51549
|
+
var handleKeyboardEvent = function handleKeyboardEvent(e) {
|
|
51525
51550
|
if (e.key === "Escape") {
|
|
51526
51551
|
handleToggleTooltip(false);
|
|
51527
51552
|
}
|
|
@@ -51545,61 +51570,57 @@ var Tooltip = function Tooltip(_ref) {
|
|
|
51545
51570
|
}
|
|
51546
51571
|
};
|
|
51547
51572
|
}, []);
|
|
51548
|
-
var renderTrigger = function renderTrigger() {
|
|
51549
|
-
if (hasCustomTrigger && children) {
|
|
51550
|
-
return /*#__PURE__*/React__default.cloneElement(React__default.Children.only(children), {
|
|
51551
|
-
"aria-describedby": tooltipID,
|
|
51552
|
-
onFocus: function onFocus() {
|
|
51553
|
-
return handleToggleTooltip(true);
|
|
51554
|
-
},
|
|
51555
|
-
onBlur: function onBlur() {
|
|
51556
|
-
return handleToggleTooltip(false);
|
|
51557
|
-
},
|
|
51558
|
-
onKeyDown: handleKeyDown
|
|
51559
|
-
});
|
|
51560
|
-
}
|
|
51561
|
-
return /*#__PURE__*/React__default.createElement(ButtonWithAction, {
|
|
51562
|
-
action: noop$1,
|
|
51563
|
-
"aria-describedby": tooltipID,
|
|
51564
|
-
onKeyDown: handleKeyDown,
|
|
51565
|
-
variant: triggerButtonVariant,
|
|
51566
|
-
onFocus: function onFocus() {
|
|
51567
|
-
return handleToggleTooltip(true);
|
|
51568
|
-
},
|
|
51569
|
-
onBlur: function onBlur() {
|
|
51570
|
-
return handleToggleTooltip(false);
|
|
51571
|
-
},
|
|
51572
|
-
onTouchStart: function onTouchStart() {
|
|
51573
|
-
return handleToggleTooltip(true);
|
|
51574
|
-
},
|
|
51575
|
-
"data-qa": "tooltip-trigger-".concat(tooltipID),
|
|
51576
|
-
text: triggerText,
|
|
51577
|
-
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 ")
|
|
51578
|
-
});
|
|
51579
|
-
};
|
|
51580
51573
|
return /*#__PURE__*/React__default.createElement(Box, {
|
|
51574
|
+
ref: closeTimeoutRef,
|
|
51581
51575
|
padding: "0",
|
|
51582
51576
|
extraStyles: "position: relative; ".concat(containerExtraStyles),
|
|
51583
|
-
onMouseEnter:
|
|
51584
|
-
|
|
51585
|
-
|
|
51586
|
-
|
|
51577
|
+
onMouseEnter: function onMouseEnter() {
|
|
51578
|
+
return handleMouseEnter();
|
|
51579
|
+
},
|
|
51580
|
+
onMouseLeave: function onMouseLeave() {
|
|
51581
|
+
return handleMouseLeave();
|
|
51582
|
+
},
|
|
51583
|
+
"data-qa": "tooltip-container"
|
|
51584
|
+
}, /*#__PURE__*/React__default.createElement(ButtonWithAction, {
|
|
51585
|
+
"aria-describedby": tooltipID,
|
|
51586
|
+
onKeyDown: handleKeyboardEvent,
|
|
51587
|
+
variant: triggerButtonVariant,
|
|
51588
|
+
onFocus: function onFocus() {
|
|
51589
|
+
return handleToggleTooltip(true);
|
|
51590
|
+
},
|
|
51591
|
+
onBlur: function onBlur() {
|
|
51592
|
+
return handleToggleTooltip(false);
|
|
51593
|
+
},
|
|
51594
|
+
onTouchStart: function onTouchStart() {
|
|
51595
|
+
return handleToggleTooltip(true);
|
|
51596
|
+
},
|
|
51597
|
+
"data-qa": "tooltip-trigger",
|
|
51598
|
+
contentOverride: true
|
|
51599
|
+
}, hasIconTrigger === true && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Box, {
|
|
51600
|
+
"aria-label": "Open tooltip"
|
|
51601
|
+
}, /*#__PURE__*/React__default.createElement(IconTrigger, {
|
|
51602
|
+
color: tooltipTriggerColor
|
|
51603
|
+
})), /*#__PURE__*/React__default.createElement(Box, {
|
|
51604
|
+
padding: "0",
|
|
51605
|
+
srOnly: true
|
|
51606
|
+
}, /*#__PURE__*/React__default.createElement(Text$1, null, iconHelpText))), hasIconTrigger === false && /*#__PURE__*/React__default.createElement(Text$1, {
|
|
51607
|
+
color: tooltipTriggerColor,
|
|
51608
|
+
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 ")
|
|
51609
|
+
}, triggerText)), /*#__PURE__*/React__default.createElement(Box, {
|
|
51587
51610
|
role: "tooltip",
|
|
51588
51611
|
id: tooltipID,
|
|
51589
51612
|
"aria-hidden": !tooltipOpen,
|
|
51590
|
-
background:
|
|
51613
|
+
background: contentBackgroundColor,
|
|
51591
51614
|
"data-qa": "tooltip-contents",
|
|
51592
|
-
extraStyles: "\n position: absolute;\n display: ".concat(tooltipOpen ? "block" : "none", ";\n top: ").concat(top, "
|
|
51615
|
+
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 "),
|
|
51593
51616
|
boxShadow: "0px 2px 14px 0px rgb(246, 246, 249), 0px 3px 8px 0px rgb(202, 206, 216)",
|
|
51594
51617
|
border: "1px solid transparent",
|
|
51595
51618
|
borderRadius: "4px",
|
|
51596
51619
|
minWidth: minWidth,
|
|
51597
51620
|
maxWidth: maxWidth
|
|
51598
|
-
},
|
|
51599
|
-
color: themeValues.linkColor
|
|
51600
|
-
}, content) : content, /*#__PURE__*/React__default.createElement(Box, {
|
|
51621
|
+
}, /*#__PURE__*/React__default.createElement(Paragraph$1, null, tooltipContent), /*#__PURE__*/React__default.createElement(Box, {
|
|
51601
51622
|
padding: "0",
|
|
51602
|
-
extraStyles: "\n position: absolute;\n content: \"\";\n width: 0;\n height: 0;\n ".concat(arrowBorder(
|
|
51623
|
+
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
51624
|
})));
|
|
51604
51625
|
};
|
|
51605
51626
|
|