@thecb/components 6.3.0-beta.0 → 6.3.0
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 +33 -22
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +33 -22
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/atoms/display-card/DisplayCard.js +4 -10
- package/src/components/molecules/popover/Popover.js +24 -19
- package/src/util/index.js +2 -2
- package/src/util/{useOutsideClickHook.js → useOutsideClick.js} +3 -6
package/dist/index.esm.js
CHANGED
|
@@ -44278,16 +44278,16 @@ var useFocusInvalidInput = function useFocusInvalidInput(hasErrors) {
|
|
|
44278
44278
|
};
|
|
44279
44279
|
|
|
44280
44280
|
/*
|
|
44281
|
-
Hook that assigns
|
|
44281
|
+
Hook that assigns a click event listener to the main document element
|
|
44282
44282
|
Returns a ref to attach to another element (like an icon/button that triggers a popover)
|
|
44283
|
-
If a
|
|
44283
|
+
If a click event gets captured by the document and the assigned element isn't the target
|
|
44284
44284
|
hook will run whatever handler is passed (eg a function that closes a popover)
|
|
44285
44285
|
|
|
44286
|
-
See
|
|
44286
|
+
See popover component for implementation
|
|
44287
44287
|
|
|
44288
44288
|
*/
|
|
44289
44289
|
|
|
44290
|
-
var useOutsideClickHook = function useOutsideClickHook(handler) {
|
|
44290
|
+
var useOutsideClickHook$1 = function useOutsideClickHook(handler) {
|
|
44291
44291
|
var ref = useRef();
|
|
44292
44292
|
useEffect$1(function () {
|
|
44293
44293
|
}, [ref]);
|
|
@@ -44302,7 +44302,7 @@ var index$4 = /*#__PURE__*/Object.freeze({
|
|
|
44302
44302
|
general: general,
|
|
44303
44303
|
theme: themeUtils,
|
|
44304
44304
|
useFocusInvalidInput: useFocusInvalidInput,
|
|
44305
|
-
|
|
44305
|
+
useOutsideClick: useOutsideClickHook$1
|
|
44306
44306
|
});
|
|
44307
44307
|
|
|
44308
44308
|
var hoverColor$5 = "#116285";
|
|
@@ -44320,8 +44320,8 @@ var Popover = function Popover(_ref) {
|
|
|
44320
44320
|
triggerText = _ref$triggerText === void 0 ? "" : _ref$triggerText,
|
|
44321
44321
|
_ref$content = _ref.content,
|
|
44322
44322
|
content = _ref$content === void 0 ? "" : _ref$content,
|
|
44323
|
-
_ref$
|
|
44324
|
-
|
|
44323
|
+
_ref$hasIcon = _ref.hasIcon,
|
|
44324
|
+
hasIcon = _ref$hasIcon === void 0 ? false : _ref$hasIcon,
|
|
44325
44325
|
Icon = _ref.icon,
|
|
44326
44326
|
_ref$iconHelpText = _ref.iconHelpText,
|
|
44327
44327
|
iconHelpText = _ref$iconHelpText === void 0 ? "" : _ref$iconHelpText,
|
|
@@ -44337,7 +44337,8 @@ var Popover = function Popover(_ref) {
|
|
|
44337
44337
|
maxWidth = _ref$maxWidth === void 0 ? "300px" : _ref$maxWidth,
|
|
44338
44338
|
_ref$height = _ref.height,
|
|
44339
44339
|
height = _ref$height === void 0 ? "auto" : _ref$height,
|
|
44340
|
-
position = _ref.position
|
|
44340
|
+
position = _ref.position,
|
|
44341
|
+
arrowPosition = _ref.arrowPosition;
|
|
44341
44342
|
var hoverColor = themeValues.hoverColor,
|
|
44342
44343
|
activeColor = themeValues.activeColor,
|
|
44343
44344
|
popoverTriggerColor = themeValues.popoverTriggerColor;
|
|
@@ -44352,6 +44353,16 @@ var Popover = function Popover(_ref) {
|
|
|
44352
44353
|
_ref2$left = _ref2.left,
|
|
44353
44354
|
left = _ref2$left === void 0 ? "-225px" : _ref2$left;
|
|
44354
44355
|
|
|
44356
|
+
var _ref3 = arrowPosition !== null && arrowPosition !== void 0 ? arrowPosition : {},
|
|
44357
|
+
_ref3$arrowTop = _ref3.arrowTop,
|
|
44358
|
+
arrowTop = _ref3$arrowTop === void 0 ? "auto" : _ref3$arrowTop,
|
|
44359
|
+
_ref3$arrowRight = _ref3.arrowRight,
|
|
44360
|
+
arrowRight = _ref3$arrowRight === void 0 ? "10px" : _ref3$arrowRight,
|
|
44361
|
+
_ref3$arrowBottom = _ref3.arrowBottom,
|
|
44362
|
+
arrowBottom = _ref3$arrowBottom === void 0 ? "-8px" : _ref3$arrowBottom,
|
|
44363
|
+
_ref3$arrowLeft = _ref3.arrowLeft,
|
|
44364
|
+
arrowLeft = _ref3$arrowLeft === void 0 ? "auto" : _ref3$arrowLeft;
|
|
44365
|
+
|
|
44355
44366
|
var _useState = useState(false),
|
|
44356
44367
|
_useState2 = _slicedToArray(_useState, 2),
|
|
44357
44368
|
popoverOpen = _useState2[0],
|
|
@@ -44363,7 +44374,9 @@ var Popover = function Popover(_ref) {
|
|
|
44363
44374
|
}
|
|
44364
44375
|
};
|
|
44365
44376
|
|
|
44366
|
-
var triggerRef = useOutsideClickHook()
|
|
44377
|
+
var triggerRef = useOutsideClickHook(function () {
|
|
44378
|
+
return handleTogglePopover(false);
|
|
44379
|
+
});
|
|
44367
44380
|
return /*#__PURE__*/React.createElement(Box, {
|
|
44368
44381
|
padding: "0",
|
|
44369
44382
|
extraStyles: "position: relative; ".concat(extraStyles)
|
|
@@ -44372,21 +44385,21 @@ var Popover = function Popover(_ref) {
|
|
|
44372
44385
|
return noop;
|
|
44373
44386
|
},
|
|
44374
44387
|
onFocus: function onFocus() {
|
|
44375
|
-
|
|
44388
|
+
handleTogglePopover(true);
|
|
44376
44389
|
},
|
|
44377
44390
|
onBlur: function onBlur() {
|
|
44378
|
-
|
|
44391
|
+
handleTogglePopover(false);
|
|
44379
44392
|
},
|
|
44380
44393
|
onKeyDown: function onKeyDown(e) {
|
|
44381
44394
|
if (e.keyCode === 27) {
|
|
44382
|
-
|
|
44395
|
+
handleTogglePopover(false);
|
|
44383
44396
|
}
|
|
44384
44397
|
},
|
|
44385
44398
|
onTouchStart: function onTouchStart() {
|
|
44386
|
-
return
|
|
44399
|
+
return handleTogglePopover(true);
|
|
44387
44400
|
},
|
|
44388
44401
|
onTouchEnd: function onTouchEnd() {
|
|
44389
|
-
return
|
|
44402
|
+
return handleTogglePopover(false);
|
|
44390
44403
|
},
|
|
44391
44404
|
onMouseEnter: function onMouseEnter() {
|
|
44392
44405
|
return handleTogglePopover(true);
|
|
@@ -44403,12 +44416,12 @@ var Popover = function Popover(_ref) {
|
|
|
44403
44416
|
"aria-describedby": "Disclosure".concat(popoverID),
|
|
44404
44417
|
"aria-controls": "Disclosed".concat(popoverID),
|
|
44405
44418
|
ref: triggerRef
|
|
44406
|
-
},
|
|
44419
|
+
}, hasIcon && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Icon, null), /*#__PURE__*/React.createElement(Box, {
|
|
44407
44420
|
padding: "0",
|
|
44408
44421
|
srOnly: true
|
|
44409
44422
|
}, /*#__PURE__*/React.createElement(Text$1, {
|
|
44410
44423
|
id: "btnPopover".concat(popoverID, "_info")
|
|
44411
|
-
}, iconHelpText)), !
|
|
44424
|
+
}, iconHelpText))), !hasIcon && /*#__PURE__*/React.createElement(Text$1, {
|
|
44412
44425
|
color: popoverTriggerColor,
|
|
44413
44426
|
extraStyles: "&:active { color: ".concat(activeColor, "; } &:hover { color: ").concat(hoverColor, " }; ").concat(textExtraStyles)
|
|
44414
44427
|
}, triggerText)), /*#__PURE__*/React.createElement(Box, {
|
|
@@ -44424,7 +44437,7 @@ var Popover = function Popover(_ref) {
|
|
|
44424
44437
|
extraStyles: "\n display: ".concat(popoverOpen ? "block" : "none", "; \n position: absolute; \n top: ").concat(top, "; \n right: ").concat(right, "; \n bottom: ").concat(bottom, "; \n left: ").concat(left, ";\n height: ").concat(height, "\n ")
|
|
44425
44438
|
}, /*#__PURE__*/React.createElement(Paragraph$1, null, content), /*#__PURE__*/React.createElement(Box, {
|
|
44426
44439
|
padding: "0",
|
|
44427
|
-
extraStyles: "position: absolute; content: \"\"; width: 0; height: 0; border-left: 8px solid transparent; border-right: 8px solid transparent; border-top: 8px solid rgba(255, 255, 255, 0.85); filter: drop-shadow(2px 8px 14px black); bottom:
|
|
44440
|
+
extraStyles: "position: absolute; content: \"\"; width: 0; height: 0; border-left: 8px solid transparent; border-right: 8px solid transparent; border-top: 8px solid rgba(255, 255, 255, 0.85); filter: drop-shadow(2px 8px 14px black); bottom: ".concat(arrowBottom, "; right: ").concat(arrowRight, "; top: ").concat(arrowTop, "; left: ").concat(arrowLeft, ";")
|
|
44428
44441
|
})));
|
|
44429
44442
|
};
|
|
44430
44443
|
|
|
@@ -45458,8 +45471,8 @@ var DisplayCard = function DisplayCard(_ref) {
|
|
|
45458
45471
|
_ref$link = _ref.link,
|
|
45459
45472
|
link = _ref$link === void 0 ? false : _ref$link,
|
|
45460
45473
|
helpText = _ref.helpText,
|
|
45461
|
-
_ref$
|
|
45462
|
-
|
|
45474
|
+
_ref$hasPopover = _ref.hasPopover,
|
|
45475
|
+
hasPopover = _ref$hasPopover === void 0 ? false : _ref$hasPopover,
|
|
45463
45476
|
_ref$popoverTriggerTe = _ref.popoverTriggerText,
|
|
45464
45477
|
popoverTriggerText = _ref$popoverTriggerTe === void 0 ? "" : _ref$popoverTriggerTe,
|
|
45465
45478
|
_ref$popoverContent = _ref.popoverContent,
|
|
@@ -45480,7 +45493,7 @@ var DisplayCard = function DisplayCard(_ref) {
|
|
|
45480
45493
|
variant: "pL",
|
|
45481
45494
|
color: CHARADE_GREY,
|
|
45482
45495
|
extraStyles: "letter-spacing: 0.29px"
|
|
45483
|
-
}, title),
|
|
45496
|
+
}, title), hasPopover && /*#__PURE__*/React.createElement(Popover$1, {
|
|
45484
45497
|
triggerText: popoverTriggerText,
|
|
45485
45498
|
content: popoverContent,
|
|
45486
45499
|
popoverExtraStyles: popoverExtraStyles,
|
|
@@ -45497,7 +45510,6 @@ var DisplayCard = function DisplayCard(_ref) {
|
|
|
45497
45510
|
justify: "space-between",
|
|
45498
45511
|
align: "center"
|
|
45499
45512
|
}, /*#__PURE__*/React.createElement(Text$1, {
|
|
45500
|
-
variant: "p",
|
|
45501
45513
|
color: CHARADE_GREY
|
|
45502
45514
|
}, item), link ? /*#__PURE__*/React.createElement(ButtonWithLink, {
|
|
45503
45515
|
text: buttonText,
|
|
@@ -45512,7 +45524,6 @@ var DisplayCard = function DisplayCard(_ref) {
|
|
|
45512
45524
|
dataQa: buttonText,
|
|
45513
45525
|
extraStyles: "min-width: 0;"
|
|
45514
45526
|
}) : helpText ? /*#__PURE__*/React.createElement(Text$1, {
|
|
45515
|
-
variant: "p",
|
|
45516
45527
|
color: STORM_GREY,
|
|
45517
45528
|
extraStyles: "font-style: italic;"
|
|
45518
45529
|
}, helpText) : /*#__PURE__*/React.createElement(Fragment$1, null))))));
|