@thecb/components 11.10.1-beta.2 → 11.10.2-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/README.md +8 -4
- package/dist/index.cjs.js +126 -102
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +126 -102
- 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-bank-account/FormattedBankAccount.js +2 -2
- package/src/components/atoms/formatted-bank-account/FormattedBankAccount.theme.js +2 -2
- package/src/components/atoms/formatted-credit-card/FormattedCreditCard.js +12 -9
- package/src/components/atoms/formatted-credit-card/FormattedCreditCard.theme.js +2 -2
- 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/src/util/formats.js +6 -3
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,
|
|
@@ -26297,7 +26309,7 @@ var FormattedAddress = function FormattedAddress(_ref) {
|
|
|
26297
26309
|
var FormattedAddress$1 = themeComponent(FormattedAddress, "FormattedAddress", fallbackValues$n, "default");
|
|
26298
26310
|
|
|
26299
26311
|
var textColor$1 = "".concat(CHARADE_GREY);
|
|
26300
|
-
var autopayTextColor = "".concat(
|
|
26312
|
+
var autopayTextColor = "".concat(SEA_GREEN);
|
|
26301
26313
|
var fallbackValues$o = {
|
|
26302
26314
|
textColor: textColor$1,
|
|
26303
26315
|
autopayTextColor: autopayTextColor
|
|
@@ -26333,8 +26345,8 @@ var FormattedBankAccount = function FormattedBankAccount(_ref2) {
|
|
|
26333
26345
|
}, "Savings Account ending in ", lastFour), autoPay && /*#__PURE__*/React__default.createElement(Text$1, {
|
|
26334
26346
|
variant: "p",
|
|
26335
26347
|
color: themeValues.autopayTextColor,
|
|
26336
|
-
extraStyles: "font-style: italic;"
|
|
26337
|
-
}, "Autopay
|
|
26348
|
+
extraStyles: "font-style: italic; font-size: .75rem;"
|
|
26349
|
+
}, "Autopay On")));
|
|
26338
26350
|
};
|
|
26339
26351
|
var FormattedBankAccount$1 = themeComponent(FormattedBankAccount, "FormattedBankAccount", fallbackValues$o);
|
|
26340
26352
|
|
|
@@ -26365,21 +26377,25 @@ 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);
|
|
26382
|
-
var autopayTextColor$1 = "".concat(
|
|
26398
|
+
var autopayTextColor$1 = "".concat(SEA_GREEN);
|
|
26383
26399
|
var fallbackValues$p = {
|
|
26384
26400
|
textColor: textColor$2,
|
|
26385
26401
|
autopayTextColor: autopayTextColor$1
|
|
@@ -26408,13 +26424,15 @@ var renderCardStatus = function renderCardStatus(expirationStatus, expireDate) {
|
|
|
26408
26424
|
return /*#__PURE__*/React__default.createElement(Text$1, {
|
|
26409
26425
|
as: as,
|
|
26410
26426
|
variant: "pXS",
|
|
26411
|
-
|
|
26427
|
+
fontSize: ".75rem",
|
|
26428
|
+
color: STORM_GREY,
|
|
26412
26429
|
extraStyles: "text-align: ".concat(textAlign, "; margin: ").concat(textMargin, ";")
|
|
26413
26430
|
}, "Exp Date ", expireDate);
|
|
26414
26431
|
case EXPIRING_SOON:
|
|
26415
26432
|
return /*#__PURE__*/React__default.createElement(Text$1, {
|
|
26416
26433
|
as: as,
|
|
26417
26434
|
variant: "pXS",
|
|
26435
|
+
fontSize: ".75rem",
|
|
26418
26436
|
color: FIRE_YELLOW,
|
|
26419
26437
|
extraStyles: "text-align: ".concat(textAlign, "; margin: ").concat(textMargin, ";")
|
|
26420
26438
|
}, "Expiring Soon ", expireDate);
|
|
@@ -26422,7 +26440,8 @@ var renderCardStatus = function renderCardStatus(expirationStatus, expireDate) {
|
|
|
26422
26440
|
return /*#__PURE__*/React__default.createElement(Text$1, {
|
|
26423
26441
|
as: as,
|
|
26424
26442
|
variant: "pXS",
|
|
26425
|
-
|
|
26443
|
+
fontSize: ".75rem",
|
|
26444
|
+
color: STORM_GREY,
|
|
26426
26445
|
extraStyles: "text-align: ".concat(textAlign, "; margin: ").concat(textMargin, ";")
|
|
26427
26446
|
}, "Expired");
|
|
26428
26447
|
}
|
|
@@ -26449,7 +26468,7 @@ var CreditCardWrapper = styled__default.div.withConfig({
|
|
|
26449
26468
|
var CCIconWrapper = styled__default.div.withConfig({
|
|
26450
26469
|
displayName: "FormattedCreditCard__CCIconWrapper",
|
|
26451
26470
|
componentId: "sc-s0ta5l-1"
|
|
26452
|
-
})(["margin-right:16px;width:
|
|
26471
|
+
})(["margin-right:16px;width:36px;height:auto;display:flex;"]);
|
|
26453
26472
|
var FormattedCreditCard = function FormattedCreditCard(_ref) {
|
|
26454
26473
|
var lastFour = _ref.lastFour,
|
|
26455
26474
|
type = _ref.type,
|
|
@@ -26457,23 +26476,26 @@ var FormattedCreditCard = function FormattedCreditCard(_ref) {
|
|
|
26457
26476
|
expireDate = _ref.expireDate,
|
|
26458
26477
|
expirationStatus = _ref.expirationStatus,
|
|
26459
26478
|
themeValues = _ref.themeValues;
|
|
26479
|
+
var _useContext = React.useContext(styled.ThemeContext),
|
|
26480
|
+
isMobile = _useContext.isMobile;
|
|
26460
26481
|
return /*#__PURE__*/React__default.createElement(CreditCardWrapper, null, /*#__PURE__*/React__default.createElement(CCIconWrapper, null, /*#__PURE__*/React__default.createElement(CardType, {
|
|
26461
|
-
type: type
|
|
26482
|
+
type: type,
|
|
26483
|
+
size: isMobile ? "small" : "large"
|
|
26462
26484
|
})), /*#__PURE__*/React__default.createElement(Stack, {
|
|
26463
26485
|
childGap: "0"
|
|
26464
26486
|
}, /*#__PURE__*/React__default.createElement(Box, {
|
|
26465
26487
|
padding: "0"
|
|
26466
26488
|
}, /*#__PURE__*/React__default.createElement(Text$1, {
|
|
26467
26489
|
variant: "p",
|
|
26468
|
-
padding: "0
|
|
26490
|
+
padding: "0",
|
|
26469
26491
|
color: themeValues.textColor,
|
|
26470
26492
|
textAlign: "left",
|
|
26471
26493
|
extraStyles: "display: inline-block;"
|
|
26472
26494
|
}, "Card ending in ".concat(lastFour)), expireDate && /*#__PURE__*/React__default.createElement(React.Fragment, null, renderCardStatus(expirationStatus, expireDate, "left", "p"))), autoPay && /*#__PURE__*/React__default.createElement(Text$1, {
|
|
26473
26495
|
variant: "p",
|
|
26474
26496
|
color: themeValues.autopayTextColor,
|
|
26475
|
-
extraStyles: "font-style: italic;"
|
|
26476
|
-
}, "Autopay
|
|
26497
|
+
extraStyles: "font-style: italic; font-size: .75rem;"
|
|
26498
|
+
}, "Autopay On")));
|
|
26477
26499
|
};
|
|
26478
26500
|
var FormattedCreditCard$1 = themeComponent(FormattedCreditCard, "FormattedCreditCard", fallbackValues$p);
|
|
26479
26501
|
|
|
@@ -48914,10 +48936,10 @@ var InnerRadioSection = function InnerRadioSection(_ref) {
|
|
|
48914
48936
|
componentId: "sc-1wtp6qc-0"
|
|
48915
48937
|
})(["height:", ";width:", ";", " transition:opacity 0.3s ease;"], function (_ref2) {
|
|
48916
48938
|
var isMobile = _ref2.isMobile;
|
|
48917
|
-
return isMobile ? "
|
|
48939
|
+
return isMobile ? "16px" : "24px";
|
|
48918
48940
|
}, function (_ref3) {
|
|
48919
48941
|
var isMobile = _ref3.isMobile;
|
|
48920
|
-
return isMobile ? "
|
|
48942
|
+
return isMobile ? "24px" : "36px";
|
|
48921
48943
|
}, function (_ref4) {
|
|
48922
48944
|
var fade = _ref4.fade;
|
|
48923
48945
|
return fade && "opacity: 0.4;";
|
|
@@ -50269,6 +50291,7 @@ var DropdownIconV2 = function DropdownIconV2(_ref) {
|
|
|
50269
50291
|
color = _ref$color === void 0 ? "#292A33" : _ref$color,
|
|
50270
50292
|
props = _objectWithoutProperties(_ref, _excluded$Q);
|
|
50271
50293
|
return /*#__PURE__*/React__default.createElement("svg", _extends({
|
|
50294
|
+
"aria-hidden": "true",
|
|
50272
50295
|
width: width,
|
|
50273
50296
|
height: height,
|
|
50274
50297
|
viewBox: "0 0 ".concat(width, " ").concat(height),
|
|
@@ -51451,39 +51474,25 @@ var TurnstileWidget = /*#__PURE__*/React.forwardRef(function (_ref4, ref) {
|
|
|
51451
51474
|
}, error)));
|
|
51452
51475
|
});
|
|
51453
51476
|
|
|
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";
|
|
51477
|
+
var TOOLTIP_THEME_SOURCE = "Popover";
|
|
51459
51478
|
var fallbackValues$12 = {
|
|
51460
|
-
|
|
51461
|
-
|
|
51462
|
-
|
|
51463
|
-
|
|
51479
|
+
hoverColor: SAPPHIRE_BLUE,
|
|
51480
|
+
activeColor: PEACOCK_BLUE,
|
|
51481
|
+
popoverTriggerColor: MATISSE_BLUE,
|
|
51482
|
+
borderColor: "rgba(255, 255, 255, 0.85)"
|
|
51464
51483
|
};
|
|
51465
|
-
|
|
51466
51484
|
var Tooltip = function Tooltip(_ref) {
|
|
51467
51485
|
var tooltipID = _ref.tooltipID,
|
|
51468
|
-
|
|
51469
|
-
_ref$
|
|
51470
|
-
|
|
51486
|
+
_ref$hasIconTrigger = _ref.hasIconTrigger,
|
|
51487
|
+
hasIconTrigger = _ref$hasIconTrigger === void 0 ? false : _ref$hasIconTrigger,
|
|
51488
|
+
_ref$IconTrigger = _ref.IconTrigger,
|
|
51489
|
+
IconTrigger = _ref$IconTrigger === void 0 ? WarningIconXS : _ref$IconTrigger,
|
|
51490
|
+
_ref$iconHelpText = _ref.iconHelpText,
|
|
51491
|
+
iconHelpText = _ref$iconHelpText === void 0 ? "Open the tooltip" : _ref$iconHelpText,
|
|
51471
51492
|
_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,
|
|
51493
|
+
triggerText = _ref$triggerText === void 0 ? "Open the tooltip" : _ref$triggerText,
|
|
51494
|
+
_ref$tooltipContent = _ref.tooltipContent,
|
|
51495
|
+
tooltipContent = _ref$tooltipContent === void 0 ? "The contents of the tooltip go here." : _ref$tooltipContent,
|
|
51487
51496
|
_ref$contentPosition = _ref.contentPosition,
|
|
51488
51497
|
contentPosition = _ref$contentPosition === void 0 ? {
|
|
51489
51498
|
top: "-110px",
|
|
@@ -51500,7 +51509,22 @@ var Tooltip = function Tooltip(_ref) {
|
|
|
51500
51509
|
arrowBottom: "-8px",
|
|
51501
51510
|
arrowLeft: "auto"
|
|
51502
51511
|
} : _ref$arrowPosition,
|
|
51503
|
-
|
|
51512
|
+
_ref$minWidth = _ref.minWidth,
|
|
51513
|
+
minWidth = _ref$minWidth === void 0 ? "250px" : _ref$minWidth,
|
|
51514
|
+
_ref$maxWidth = _ref.maxWidth,
|
|
51515
|
+
maxWidth = _ref$maxWidth === void 0 ? "300px" : _ref$maxWidth,
|
|
51516
|
+
_ref$height = _ref.height,
|
|
51517
|
+
height = _ref$height === void 0 ? "auto" : _ref$height,
|
|
51518
|
+
_ref$containerExtraSt = _ref.containerExtraStyles,
|
|
51519
|
+
containerExtraStyles = _ref$containerExtraSt === void 0 ? "" : _ref$containerExtraSt,
|
|
51520
|
+
_ref$triggerExtraStyl = _ref.triggerExtraStyles,
|
|
51521
|
+
triggerExtraStyles = _ref$triggerExtraStyl === void 0 ? "" : _ref$triggerExtraStyl,
|
|
51522
|
+
_ref$triggerButtonVar = _ref.triggerButtonVariant,
|
|
51523
|
+
triggerButtonVariant = _ref$triggerButtonVar === void 0 ? "smallGhost" : _ref$triggerButtonVar,
|
|
51524
|
+
_ref$contentExtraStyl = _ref.contentExtraStyles,
|
|
51525
|
+
contentExtraStyles = _ref$contentExtraStyl === void 0 ? "" : _ref$contentExtraStyl,
|
|
51526
|
+
_ref$contentBackgroun = _ref.contentBackgroundColor,
|
|
51527
|
+
contentBackgroundColor = _ref$contentBackgroun === void 0 ? WHITE : _ref$contentBackgroun;
|
|
51504
51528
|
var closeTimeoutRef = React.useRef(null);
|
|
51505
51529
|
var _useState = React.useState(false),
|
|
51506
51530
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -51508,6 +51532,10 @@ var Tooltip = function Tooltip(_ref) {
|
|
|
51508
51532
|
setTooltipOpen = _useState2[1];
|
|
51509
51533
|
var themeContext = React.useContext(styled.ThemeContext);
|
|
51510
51534
|
var themeValues = createThemeValues(themeContext, fallbackValues$12, TOOLTIP_THEME_SOURCE);
|
|
51535
|
+
var borderColor = themeValues.borderColor,
|
|
51536
|
+
tooltipTriggerColor = themeValues.popoverTriggerColor,
|
|
51537
|
+
hoverColor = themeValues.hoverColor,
|
|
51538
|
+
activeColor = themeValues.activeColor;
|
|
51511
51539
|
var top = contentPosition.top,
|
|
51512
51540
|
right = contentPosition.right,
|
|
51513
51541
|
bottom = contentPosition.bottom,
|
|
@@ -51516,12 +51544,12 @@ var Tooltip = function Tooltip(_ref) {
|
|
|
51516
51544
|
arrowRight = arrowPosition.arrowRight,
|
|
51517
51545
|
arrowBottom = arrowPosition.arrowBottom,
|
|
51518
51546
|
arrowLeft = arrowPosition.arrowLeft;
|
|
51519
|
-
var handleToggleTooltip = function handleToggleTooltip(
|
|
51520
|
-
if (tooltipOpen !==
|
|
51521
|
-
setTooltipOpen(
|
|
51547
|
+
var handleToggleTooltip = function handleToggleTooltip(desiredTooltipState) {
|
|
51548
|
+
if (tooltipOpen !== desiredTooltipState) {
|
|
51549
|
+
setTooltipOpen(desiredTooltipState);
|
|
51522
51550
|
}
|
|
51523
51551
|
};
|
|
51524
|
-
var
|
|
51552
|
+
var handleKeyboardEvent = function handleKeyboardEvent(e) {
|
|
51525
51553
|
if (e.key === "Escape") {
|
|
51526
51554
|
handleToggleTooltip(false);
|
|
51527
51555
|
}
|
|
@@ -51545,61 +51573,57 @@ var Tooltip = function Tooltip(_ref) {
|
|
|
51545
51573
|
}
|
|
51546
51574
|
};
|
|
51547
51575
|
}, []);
|
|
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
51576
|
return /*#__PURE__*/React__default.createElement(Box, {
|
|
51577
|
+
ref: closeTimeoutRef,
|
|
51581
51578
|
padding: "0",
|
|
51582
51579
|
extraStyles: "position: relative; ".concat(containerExtraStyles),
|
|
51583
|
-
onMouseEnter:
|
|
51584
|
-
|
|
51585
|
-
|
|
51586
|
-
|
|
51580
|
+
onMouseEnter: function onMouseEnter() {
|
|
51581
|
+
return handleMouseEnter();
|
|
51582
|
+
},
|
|
51583
|
+
onMouseLeave: function onMouseLeave() {
|
|
51584
|
+
return handleMouseLeave();
|
|
51585
|
+
},
|
|
51586
|
+
"data-qa": "tooltip-container"
|
|
51587
|
+
}, /*#__PURE__*/React__default.createElement(ButtonWithAction, {
|
|
51588
|
+
"aria-describedby": tooltipID,
|
|
51589
|
+
onKeyDown: handleKeyboardEvent,
|
|
51590
|
+
variant: triggerButtonVariant,
|
|
51591
|
+
onFocus: function onFocus() {
|
|
51592
|
+
return handleToggleTooltip(true);
|
|
51593
|
+
},
|
|
51594
|
+
onBlur: function onBlur() {
|
|
51595
|
+
return handleToggleTooltip(false);
|
|
51596
|
+
},
|
|
51597
|
+
onTouchStart: function onTouchStart() {
|
|
51598
|
+
return handleToggleTooltip(true);
|
|
51599
|
+
},
|
|
51600
|
+
"data-qa": "tooltip-trigger",
|
|
51601
|
+
contentOverride: true
|
|
51602
|
+
}, hasIconTrigger === true && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Box, {
|
|
51603
|
+
"aria-label": "Open tooltip"
|
|
51604
|
+
}, /*#__PURE__*/React__default.createElement(IconTrigger, {
|
|
51605
|
+
color: tooltipTriggerColor
|
|
51606
|
+
})), /*#__PURE__*/React__default.createElement(Box, {
|
|
51607
|
+
padding: "0",
|
|
51608
|
+
srOnly: true
|
|
51609
|
+
}, /*#__PURE__*/React__default.createElement(Text$1, null, iconHelpText))), hasIconTrigger === false && /*#__PURE__*/React__default.createElement(Text$1, {
|
|
51610
|
+
color: tooltipTriggerColor,
|
|
51611
|
+
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 ")
|
|
51612
|
+
}, triggerText)), /*#__PURE__*/React__default.createElement(Box, {
|
|
51587
51613
|
role: "tooltip",
|
|
51588
51614
|
id: tooltipID,
|
|
51589
51615
|
"aria-hidden": !tooltipOpen,
|
|
51590
|
-
background:
|
|
51616
|
+
background: contentBackgroundColor,
|
|
51591
51617
|
"data-qa": "tooltip-contents",
|
|
51592
|
-
extraStyles: "\n position: absolute;\n display: ".concat(tooltipOpen ? "block" : "none", ";\n top: ").concat(top, "
|
|
51618
|
+
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
51619
|
boxShadow: "0px 2px 14px 0px rgb(246, 246, 249), 0px 3px 8px 0px rgb(202, 206, 216)",
|
|
51594
51620
|
border: "1px solid transparent",
|
|
51595
51621
|
borderRadius: "4px",
|
|
51596
51622
|
minWidth: minWidth,
|
|
51597
51623
|
maxWidth: maxWidth
|
|
51598
|
-
},
|
|
51599
|
-
color: themeValues.linkColor
|
|
51600
|
-
}, content) : content, /*#__PURE__*/React__default.createElement(Box, {
|
|
51624
|
+
}, /*#__PURE__*/React__default.createElement(Paragraph$1, null, tooltipContent), /*#__PURE__*/React__default.createElement(Box, {
|
|
51601
51625
|
padding: "0",
|
|
51602
|
-
extraStyles: "\n position: absolute;\n content: \"\";\n width: 0;\n height: 0;\n ".concat(arrowBorder(
|
|
51626
|
+
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
51627
|
})));
|
|
51604
51628
|
};
|
|
51605
51629
|
|