@thecb/components 7.7.6 → 7.7.8-beta.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 +66 -3
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +66 -3
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/.DS_Store +0 -0
- package/src/components/atoms/.DS_Store +0 -0
- package/src/components/atoms/button-with-action/ButtonWithAction.js +4 -3
- package/src/components/atoms/button-with-action/ButtonWithAction.theme.js +14 -0
- package/src/components/atoms/icons/{ExternalLinkIcon.js → ExternalLinkicon.js} +0 -0
- package/src/util/index.js +9 -1
- package/src/util/useCheckElementsInViewport.js +49 -0
package/dist/index.esm.js
CHANGED
|
@@ -12549,6 +12549,7 @@ var padding = {
|
|
|
12549
12549
|
tertiary: "0.75rem 1.5rem",
|
|
12550
12550
|
ghost: "0.65rem 0",
|
|
12551
12551
|
danger: "0.75rem 1.5rem",
|
|
12552
|
+
dangerSecondary: "0.75rem 1.5rem",
|
|
12552
12553
|
whiteSecondary: "0.75rem 2rem",
|
|
12553
12554
|
whitePrimary: "1.125rem 0.75rem"
|
|
12554
12555
|
};
|
|
@@ -12562,6 +12563,7 @@ var color$1 = {
|
|
|
12562
12563
|
ghost: "#15749D",
|
|
12563
12564
|
tertiary: "#15749D",
|
|
12564
12565
|
danger: "#FFFFFF",
|
|
12566
|
+
dangerSecondary: "#D11053",
|
|
12565
12567
|
whiteSecondary: "#FFFFFF",
|
|
12566
12568
|
whitePrimary: "#FFFFFF"
|
|
12567
12569
|
};
|
|
@@ -12575,6 +12577,7 @@ var fontSizeVariant = {
|
|
|
12575
12577
|
ghost: "pL",
|
|
12576
12578
|
tertiary: "pS",
|
|
12577
12579
|
danger: "pS",
|
|
12580
|
+
dangerSecondary: "pS",
|
|
12578
12581
|
whiteSecondary: "pS",
|
|
12579
12582
|
whitePrimary: "pS"
|
|
12580
12583
|
};
|
|
@@ -12588,6 +12591,7 @@ var fontWeight = {
|
|
|
12588
12591
|
ghost: "600",
|
|
12589
12592
|
tertiary: "600",
|
|
12590
12593
|
danger: "600",
|
|
12594
|
+
dangerSecondary: "600",
|
|
12591
12595
|
whiteSecondary: "600",
|
|
12592
12596
|
whitePrimary: "600"
|
|
12593
12597
|
};
|
|
@@ -12601,6 +12605,7 @@ var height = {
|
|
|
12601
12605
|
ghost: "3rem",
|
|
12602
12606
|
tertiary: "3rem",
|
|
12603
12607
|
danger: "3rem",
|
|
12608
|
+
dangerSecondary: "3rem",
|
|
12604
12609
|
whiteSecondary: "3rem",
|
|
12605
12610
|
whitePrimary: "auto"
|
|
12606
12611
|
};
|
|
@@ -12614,6 +12619,7 @@ var minWidth = {
|
|
|
12614
12619
|
ghost: "130px",
|
|
12615
12620
|
tertiary: "130px",
|
|
12616
12621
|
danger: "130px",
|
|
12622
|
+
dangerSecondary: "157px",
|
|
12617
12623
|
whiteSecondary: "160px",
|
|
12618
12624
|
whitePrimary: "130px"
|
|
12619
12625
|
};
|
|
@@ -12627,6 +12633,7 @@ var backgroundColor = {
|
|
|
12627
12633
|
ghost: "transparent",
|
|
12628
12634
|
tertiary: "transparent",
|
|
12629
12635
|
danger: "#ED125F",
|
|
12636
|
+
dangerSecondary: "transparent",
|
|
12630
12637
|
whiteSecondary: "transparent",
|
|
12631
12638
|
whitePrimary: "transparent"
|
|
12632
12639
|
};
|
|
@@ -12640,6 +12647,7 @@ var border = {
|
|
|
12640
12647
|
ghost: "none",
|
|
12641
12648
|
tertiary: "none",
|
|
12642
12649
|
danger: "2px solid #ED125F",
|
|
12650
|
+
dangerSecondary: "2px solid #D11053",
|
|
12643
12651
|
whiteSecondary: "2px solid white",
|
|
12644
12652
|
whitePrimary: "2px solid transparent"
|
|
12645
12653
|
};
|
|
@@ -12653,6 +12661,7 @@ var hoverBackgroundColor = {
|
|
|
12653
12661
|
ghost: "transparent",
|
|
12654
12662
|
tertiary: "transparent",
|
|
12655
12663
|
danger: "#BA002C",
|
|
12664
|
+
dangerSecondary: "transparent",
|
|
12656
12665
|
whiteSecondary: "transparent",
|
|
12657
12666
|
whitePrimary: "transparent"
|
|
12658
12667
|
};
|
|
@@ -12666,6 +12675,7 @@ var hoverBorderColor = {
|
|
|
12666
12675
|
ghost: "transparent",
|
|
12667
12676
|
tertiary: "transparent",
|
|
12668
12677
|
danger: "#BA002C",
|
|
12678
|
+
dangerSecondary: "#B10541",
|
|
12669
12679
|
whiteSecondary: "2px solid transparent",
|
|
12670
12680
|
whitePrimary: "2px solid transparent"
|
|
12671
12681
|
};
|
|
@@ -12679,6 +12689,7 @@ var hoverColor = {
|
|
|
12679
12689
|
ghost: "#116285",
|
|
12680
12690
|
tertiary: "#116285",
|
|
12681
12691
|
danger: "#FFFFFF",
|
|
12692
|
+
dangerSecondary: "#B10541",
|
|
12682
12693
|
whiteSecondary: "#FFFFFF",
|
|
12683
12694
|
whitePrimary: "#FFFFFF"
|
|
12684
12695
|
};
|
|
@@ -12692,6 +12703,7 @@ var activeBackgroundColor = {
|
|
|
12692
12703
|
ghost: "transparent",
|
|
12693
12704
|
tertiary: "transparent",
|
|
12694
12705
|
danger: "#870000",
|
|
12706
|
+
dangerSecondary: "transparent",
|
|
12695
12707
|
whiteSecondary: "transparent",
|
|
12696
12708
|
whitePrimary: "transparent"
|
|
12697
12709
|
};
|
|
@@ -12705,6 +12717,7 @@ var activeBorderColor = {
|
|
|
12705
12717
|
ghost: "transparent",
|
|
12706
12718
|
tertiary: "transparent",
|
|
12707
12719
|
danger: "#870000",
|
|
12720
|
+
dangerSecondary: "#910029",
|
|
12708
12721
|
whiteSecondary: "2px solid transparent",
|
|
12709
12722
|
whitePrimary: "2px solid transparent"
|
|
12710
12723
|
};
|
|
@@ -12718,6 +12731,7 @@ var activeColor = {
|
|
|
12718
12731
|
ghost: "#0E506D",
|
|
12719
12732
|
tertiary: "#0E506D",
|
|
12720
12733
|
danger: "#FFFFFF",
|
|
12734
|
+
dangerSecondary: "#910029",
|
|
12721
12735
|
whiteSecondary: "#FFFFFF",
|
|
12722
12736
|
whitePrimary: "#FFFFFF"
|
|
12723
12737
|
};
|
|
@@ -12803,7 +12817,7 @@ var SpinnerIcon = function SpinnerIcon(_ref3) {
|
|
|
12803
12817
|
}))))));
|
|
12804
12818
|
};
|
|
12805
12819
|
|
|
12806
|
-
var _excluded$h = ["action", "variant", "text", "textWrap", "isLoading", "dataQa", "textExtraStyles", "contentOverride", "extraStyles", "tabIndex", "children", "extraDisabledStyles"];
|
|
12820
|
+
var _excluded$h = ["action", "variant", "text", "textWrap", "isLoading", "loadingColor", "dataQa", "textExtraStyles", "contentOverride", "extraStyles", "tabIndex", "children", "extraDisabledStyles"];
|
|
12807
12821
|
var rotate$1 = posed.div({
|
|
12808
12822
|
fixed: {
|
|
12809
12823
|
rotate: "0deg"
|
|
@@ -12829,11 +12843,13 @@ var SpinnerIconWrapper$1 = styled(rotate$1).withConfig({
|
|
|
12829
12843
|
})([""]);
|
|
12830
12844
|
|
|
12831
12845
|
var Spinner = function Spinner(_ref) {
|
|
12832
|
-
var
|
|
12846
|
+
var color = _ref.color,
|
|
12847
|
+
isMobile = _ref.isMobile;
|
|
12833
12848
|
return /*#__PURE__*/React.createElement(SpinnerContainer$1, null, /*#__PURE__*/React.createElement(SpinnerIconWrapper$1, {
|
|
12834
12849
|
initialPose: "fixed",
|
|
12835
12850
|
pose: "rotate"
|
|
12836
12851
|
}, /*#__PURE__*/React.createElement(SpinnerIcon, {
|
|
12852
|
+
color: color,
|
|
12837
12853
|
isMobile: isMobile
|
|
12838
12854
|
})));
|
|
12839
12855
|
};
|
|
@@ -12864,6 +12880,8 @@ var ButtonWithAction = function ButtonWithAction(_ref2) {
|
|
|
12864
12880
|
textWrap = _ref2$textWrap === void 0 ? false : _ref2$textWrap,
|
|
12865
12881
|
_ref2$isLoading = _ref2.isLoading,
|
|
12866
12882
|
isLoading = _ref2$isLoading === void 0 ? false : _ref2$isLoading,
|
|
12883
|
+
_ref2$loadingColor = _ref2.loadingColor,
|
|
12884
|
+
loadingColor = _ref2$loadingColor === void 0 ? "white" : _ref2$loadingColor,
|
|
12867
12885
|
_ref2$dataQa = _ref2.dataQa,
|
|
12868
12886
|
dataQa = _ref2$dataQa === void 0 ? null : _ref2$dataQa,
|
|
12869
12887
|
textExtraStyles = _ref2.textExtraStyles,
|
|
@@ -12902,6 +12920,7 @@ var ButtonWithAction = function ButtonWithAction(_ref2) {
|
|
|
12902
12920
|
}, rest), contentOverride ? children : /*#__PURE__*/React.createElement(Center, {
|
|
12903
12921
|
intrinsic: true
|
|
12904
12922
|
}, isLoading ? /*#__PURE__*/React.createElement(Spinner, {
|
|
12923
|
+
color: loadingColor,
|
|
12905
12924
|
isMobile: isMobile
|
|
12906
12925
|
}) : /*#__PURE__*/React.createElement(Text$1, {
|
|
12907
12926
|
weight: themeValues.fontWeight,
|
|
@@ -24435,6 +24454,49 @@ var useOutsideClickHook = function useOutsideClickHook(handler) {
|
|
|
24435
24454
|
return ref;
|
|
24436
24455
|
};
|
|
24437
24456
|
|
|
24457
|
+
/*
|
|
24458
|
+
Hook that determines whether every element in an array of DOM selectors is fully present
|
|
24459
|
+
within the user's current viewport.
|
|
24460
|
+
|
|
24461
|
+
(elements: Array<String>) => Boolean;
|
|
24462
|
+
|
|
24463
|
+
Takes an array of strings that correspond to DOM selectors. Examples:
|
|
24464
|
+
"#submit-button", ".module-small", "h2.alert-title"
|
|
24465
|
+
|
|
24466
|
+
The document query function will return the *first* element in the document that matches
|
|
24467
|
+
the string given.
|
|
24468
|
+
|
|
24469
|
+
A combination string of multiple selectors can also be provided, e.g.:
|
|
24470
|
+
".alert-info, .alert-warning, .alert-error"
|
|
24471
|
+
|
|
24472
|
+
This will return the first element that matches *any* of the provided selectors
|
|
24473
|
+
|
|
24474
|
+
If every element in the array is fully within the viewport, function returns true
|
|
24475
|
+
*/
|
|
24476
|
+
|
|
24477
|
+
var useCheckElementsInViewport = function useCheckElementsInViewport() {
|
|
24478
|
+
var elements = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
24479
|
+
|
|
24480
|
+
var _useState = useState(false),
|
|
24481
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
24482
|
+
elementsVisible = _useState2[0],
|
|
24483
|
+
setElementsVisible = _useState2[1];
|
|
24484
|
+
|
|
24485
|
+
var viewportWidth = window.innerWidth || document.documentElement.clientWidth;
|
|
24486
|
+
var viewportHeight = window.innerHeight || document.documentElement.clientHeight;
|
|
24487
|
+
useEffect$1(function () {
|
|
24488
|
+
elements.forEach(function (element) {
|
|
24489
|
+
var domEl = document.querySelector(element);
|
|
24490
|
+
var boundingBox = domEl.getBoundingClientRect();
|
|
24491
|
+
|
|
24492
|
+
if (boundingBox.top >= 0 && boundingBox.left >= 0 && boundingBox.right <= viewportWidth && boundingBox.bottom <= viewportHeight) {
|
|
24493
|
+
setElementsVisible(true);
|
|
24494
|
+
}
|
|
24495
|
+
});
|
|
24496
|
+
}, [elements]);
|
|
24497
|
+
return elementsVisible;
|
|
24498
|
+
};
|
|
24499
|
+
|
|
24438
24500
|
|
|
24439
24501
|
|
|
24440
24502
|
var index$4 = /*#__PURE__*/Object.freeze({
|
|
@@ -24443,7 +24505,8 @@ var index$4 = /*#__PURE__*/Object.freeze({
|
|
|
24443
24505
|
general: general,
|
|
24444
24506
|
theme: themeUtils,
|
|
24445
24507
|
useFocusInvalidInput: useFocusInvalidInput,
|
|
24446
|
-
useOutsideClick: useOutsideClickHook
|
|
24508
|
+
useOutsideClick: useOutsideClickHook,
|
|
24509
|
+
useCheckElementsInViewport: useCheckElementsInViewport
|
|
24447
24510
|
});
|
|
24448
24511
|
|
|
24449
24512
|
var hoverColor$4 = "#116285";
|