@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.cjs.js
CHANGED
|
@@ -12557,6 +12557,7 @@ var padding = {
|
|
|
12557
12557
|
tertiary: "0.75rem 1.5rem",
|
|
12558
12558
|
ghost: "0.65rem 0",
|
|
12559
12559
|
danger: "0.75rem 1.5rem",
|
|
12560
|
+
dangerSecondary: "0.75rem 1.5rem",
|
|
12560
12561
|
whiteSecondary: "0.75rem 2rem",
|
|
12561
12562
|
whitePrimary: "1.125rem 0.75rem"
|
|
12562
12563
|
};
|
|
@@ -12570,6 +12571,7 @@ var color$1 = {
|
|
|
12570
12571
|
ghost: "#15749D",
|
|
12571
12572
|
tertiary: "#15749D",
|
|
12572
12573
|
danger: "#FFFFFF",
|
|
12574
|
+
dangerSecondary: "#D11053",
|
|
12573
12575
|
whiteSecondary: "#FFFFFF",
|
|
12574
12576
|
whitePrimary: "#FFFFFF"
|
|
12575
12577
|
};
|
|
@@ -12583,6 +12585,7 @@ var fontSizeVariant = {
|
|
|
12583
12585
|
ghost: "pL",
|
|
12584
12586
|
tertiary: "pS",
|
|
12585
12587
|
danger: "pS",
|
|
12588
|
+
dangerSecondary: "pS",
|
|
12586
12589
|
whiteSecondary: "pS",
|
|
12587
12590
|
whitePrimary: "pS"
|
|
12588
12591
|
};
|
|
@@ -12596,6 +12599,7 @@ var fontWeight = {
|
|
|
12596
12599
|
ghost: "600",
|
|
12597
12600
|
tertiary: "600",
|
|
12598
12601
|
danger: "600",
|
|
12602
|
+
dangerSecondary: "600",
|
|
12599
12603
|
whiteSecondary: "600",
|
|
12600
12604
|
whitePrimary: "600"
|
|
12601
12605
|
};
|
|
@@ -12609,6 +12613,7 @@ var height = {
|
|
|
12609
12613
|
ghost: "3rem",
|
|
12610
12614
|
tertiary: "3rem",
|
|
12611
12615
|
danger: "3rem",
|
|
12616
|
+
dangerSecondary: "3rem",
|
|
12612
12617
|
whiteSecondary: "3rem",
|
|
12613
12618
|
whitePrimary: "auto"
|
|
12614
12619
|
};
|
|
@@ -12622,6 +12627,7 @@ var minWidth = {
|
|
|
12622
12627
|
ghost: "130px",
|
|
12623
12628
|
tertiary: "130px",
|
|
12624
12629
|
danger: "130px",
|
|
12630
|
+
dangerSecondary: "157px",
|
|
12625
12631
|
whiteSecondary: "160px",
|
|
12626
12632
|
whitePrimary: "130px"
|
|
12627
12633
|
};
|
|
@@ -12635,6 +12641,7 @@ var backgroundColor = {
|
|
|
12635
12641
|
ghost: "transparent",
|
|
12636
12642
|
tertiary: "transparent",
|
|
12637
12643
|
danger: "#ED125F",
|
|
12644
|
+
dangerSecondary: "transparent",
|
|
12638
12645
|
whiteSecondary: "transparent",
|
|
12639
12646
|
whitePrimary: "transparent"
|
|
12640
12647
|
};
|
|
@@ -12648,6 +12655,7 @@ var border = {
|
|
|
12648
12655
|
ghost: "none",
|
|
12649
12656
|
tertiary: "none",
|
|
12650
12657
|
danger: "2px solid #ED125F",
|
|
12658
|
+
dangerSecondary: "2px solid #D11053",
|
|
12651
12659
|
whiteSecondary: "2px solid white",
|
|
12652
12660
|
whitePrimary: "2px solid transparent"
|
|
12653
12661
|
};
|
|
@@ -12661,6 +12669,7 @@ var hoverBackgroundColor = {
|
|
|
12661
12669
|
ghost: "transparent",
|
|
12662
12670
|
tertiary: "transparent",
|
|
12663
12671
|
danger: "#BA002C",
|
|
12672
|
+
dangerSecondary: "transparent",
|
|
12664
12673
|
whiteSecondary: "transparent",
|
|
12665
12674
|
whitePrimary: "transparent"
|
|
12666
12675
|
};
|
|
@@ -12674,6 +12683,7 @@ var hoverBorderColor = {
|
|
|
12674
12683
|
ghost: "transparent",
|
|
12675
12684
|
tertiary: "transparent",
|
|
12676
12685
|
danger: "#BA002C",
|
|
12686
|
+
dangerSecondary: "#B10541",
|
|
12677
12687
|
whiteSecondary: "2px solid transparent",
|
|
12678
12688
|
whitePrimary: "2px solid transparent"
|
|
12679
12689
|
};
|
|
@@ -12687,6 +12697,7 @@ var hoverColor = {
|
|
|
12687
12697
|
ghost: "#116285",
|
|
12688
12698
|
tertiary: "#116285",
|
|
12689
12699
|
danger: "#FFFFFF",
|
|
12700
|
+
dangerSecondary: "#B10541",
|
|
12690
12701
|
whiteSecondary: "#FFFFFF",
|
|
12691
12702
|
whitePrimary: "#FFFFFF"
|
|
12692
12703
|
};
|
|
@@ -12700,6 +12711,7 @@ var activeBackgroundColor = {
|
|
|
12700
12711
|
ghost: "transparent",
|
|
12701
12712
|
tertiary: "transparent",
|
|
12702
12713
|
danger: "#870000",
|
|
12714
|
+
dangerSecondary: "transparent",
|
|
12703
12715
|
whiteSecondary: "transparent",
|
|
12704
12716
|
whitePrimary: "transparent"
|
|
12705
12717
|
};
|
|
@@ -12713,6 +12725,7 @@ var activeBorderColor = {
|
|
|
12713
12725
|
ghost: "transparent",
|
|
12714
12726
|
tertiary: "transparent",
|
|
12715
12727
|
danger: "#870000",
|
|
12728
|
+
dangerSecondary: "#910029",
|
|
12716
12729
|
whiteSecondary: "2px solid transparent",
|
|
12717
12730
|
whitePrimary: "2px solid transparent"
|
|
12718
12731
|
};
|
|
@@ -12726,6 +12739,7 @@ var activeColor = {
|
|
|
12726
12739
|
ghost: "#0E506D",
|
|
12727
12740
|
tertiary: "#0E506D",
|
|
12728
12741
|
danger: "#FFFFFF",
|
|
12742
|
+
dangerSecondary: "#910029",
|
|
12729
12743
|
whiteSecondary: "#FFFFFF",
|
|
12730
12744
|
whitePrimary: "#FFFFFF"
|
|
12731
12745
|
};
|
|
@@ -12811,7 +12825,7 @@ var SpinnerIcon = function SpinnerIcon(_ref3) {
|
|
|
12811
12825
|
}))))));
|
|
12812
12826
|
};
|
|
12813
12827
|
|
|
12814
|
-
var _excluded$h = ["action", "variant", "text", "textWrap", "isLoading", "dataQa", "textExtraStyles", "contentOverride", "extraStyles", "tabIndex", "children", "extraDisabledStyles"];
|
|
12828
|
+
var _excluded$h = ["action", "variant", "text", "textWrap", "isLoading", "loadingColor", "dataQa", "textExtraStyles", "contentOverride", "extraStyles", "tabIndex", "children", "extraDisabledStyles"];
|
|
12815
12829
|
var rotate$1 = posed.div({
|
|
12816
12830
|
fixed: {
|
|
12817
12831
|
rotate: "0deg"
|
|
@@ -12837,11 +12851,13 @@ var SpinnerIconWrapper$1 = styled__default(rotate$1).withConfig({
|
|
|
12837
12851
|
})([""]);
|
|
12838
12852
|
|
|
12839
12853
|
var Spinner = function Spinner(_ref) {
|
|
12840
|
-
var
|
|
12854
|
+
var color = _ref.color,
|
|
12855
|
+
isMobile = _ref.isMobile;
|
|
12841
12856
|
return /*#__PURE__*/React__default.createElement(SpinnerContainer$1, null, /*#__PURE__*/React__default.createElement(SpinnerIconWrapper$1, {
|
|
12842
12857
|
initialPose: "fixed",
|
|
12843
12858
|
pose: "rotate"
|
|
12844
12859
|
}, /*#__PURE__*/React__default.createElement(SpinnerIcon, {
|
|
12860
|
+
color: color,
|
|
12845
12861
|
isMobile: isMobile
|
|
12846
12862
|
})));
|
|
12847
12863
|
};
|
|
@@ -12872,6 +12888,8 @@ var ButtonWithAction = function ButtonWithAction(_ref2) {
|
|
|
12872
12888
|
textWrap = _ref2$textWrap === void 0 ? false : _ref2$textWrap,
|
|
12873
12889
|
_ref2$isLoading = _ref2.isLoading,
|
|
12874
12890
|
isLoading = _ref2$isLoading === void 0 ? false : _ref2$isLoading,
|
|
12891
|
+
_ref2$loadingColor = _ref2.loadingColor,
|
|
12892
|
+
loadingColor = _ref2$loadingColor === void 0 ? "white" : _ref2$loadingColor,
|
|
12875
12893
|
_ref2$dataQa = _ref2.dataQa,
|
|
12876
12894
|
dataQa = _ref2$dataQa === void 0 ? null : _ref2$dataQa,
|
|
12877
12895
|
textExtraStyles = _ref2.textExtraStyles,
|
|
@@ -12910,6 +12928,7 @@ var ButtonWithAction = function ButtonWithAction(_ref2) {
|
|
|
12910
12928
|
}, rest), contentOverride ? children : /*#__PURE__*/React__default.createElement(Center, {
|
|
12911
12929
|
intrinsic: true
|
|
12912
12930
|
}, isLoading ? /*#__PURE__*/React__default.createElement(Spinner, {
|
|
12931
|
+
color: loadingColor,
|
|
12913
12932
|
isMobile: isMobile
|
|
12914
12933
|
}) : /*#__PURE__*/React__default.createElement(Text$1, {
|
|
12915
12934
|
weight: themeValues.fontWeight,
|
|
@@ -24443,6 +24462,49 @@ var useOutsideClickHook = function useOutsideClickHook(handler) {
|
|
|
24443
24462
|
return ref;
|
|
24444
24463
|
};
|
|
24445
24464
|
|
|
24465
|
+
/*
|
|
24466
|
+
Hook that determines whether every element in an array of DOM selectors is fully present
|
|
24467
|
+
within the user's current viewport.
|
|
24468
|
+
|
|
24469
|
+
(elements: Array<String>) => Boolean;
|
|
24470
|
+
|
|
24471
|
+
Takes an array of strings that correspond to DOM selectors. Examples:
|
|
24472
|
+
"#submit-button", ".module-small", "h2.alert-title"
|
|
24473
|
+
|
|
24474
|
+
The document query function will return the *first* element in the document that matches
|
|
24475
|
+
the string given.
|
|
24476
|
+
|
|
24477
|
+
A combination string of multiple selectors can also be provided, e.g.:
|
|
24478
|
+
".alert-info, .alert-warning, .alert-error"
|
|
24479
|
+
|
|
24480
|
+
This will return the first element that matches *any* of the provided selectors
|
|
24481
|
+
|
|
24482
|
+
If every element in the array is fully within the viewport, function returns true
|
|
24483
|
+
*/
|
|
24484
|
+
|
|
24485
|
+
var useCheckElementsInViewport = function useCheckElementsInViewport() {
|
|
24486
|
+
var elements = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
24487
|
+
|
|
24488
|
+
var _useState = React.useState(false),
|
|
24489
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
24490
|
+
elementsVisible = _useState2[0],
|
|
24491
|
+
setElementsVisible = _useState2[1];
|
|
24492
|
+
|
|
24493
|
+
var viewportWidth = window.innerWidth || document.documentElement.clientWidth;
|
|
24494
|
+
var viewportHeight = window.innerHeight || document.documentElement.clientHeight;
|
|
24495
|
+
React.useEffect(function () {
|
|
24496
|
+
elements.forEach(function (element) {
|
|
24497
|
+
var domEl = document.querySelector(element);
|
|
24498
|
+
var boundingBox = domEl.getBoundingClientRect();
|
|
24499
|
+
|
|
24500
|
+
if (boundingBox.top >= 0 && boundingBox.left >= 0 && boundingBox.right <= viewportWidth && boundingBox.bottom <= viewportHeight) {
|
|
24501
|
+
setElementsVisible(true);
|
|
24502
|
+
}
|
|
24503
|
+
});
|
|
24504
|
+
}, [elements]);
|
|
24505
|
+
return elementsVisible;
|
|
24506
|
+
};
|
|
24507
|
+
|
|
24446
24508
|
|
|
24447
24509
|
|
|
24448
24510
|
var index$4 = /*#__PURE__*/Object.freeze({
|
|
@@ -24451,7 +24513,8 @@ var index$4 = /*#__PURE__*/Object.freeze({
|
|
|
24451
24513
|
general: general,
|
|
24452
24514
|
theme: themeUtils,
|
|
24453
24515
|
useFocusInvalidInput: useFocusInvalidInput,
|
|
24454
|
-
useOutsideClick: useOutsideClickHook
|
|
24516
|
+
useOutsideClick: useOutsideClickHook,
|
|
24517
|
+
useCheckElementsInViewport: useCheckElementsInViewport
|
|
24455
24518
|
});
|
|
24456
24519
|
|
|
24457
24520
|
var hoverColor$4 = "#116285";
|