@thecb/components 10.12.1-beta.0 → 10.12.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/dist/index.cjs.js +57 -16
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +11 -6
- package/dist/index.esm.js +57 -16
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/atoms/card/Card.js +9 -0
- package/src/components/atoms/card/CardText.js +34 -11
- package/src/components/atoms/card/index.d.ts +7 -1
- package/src/components/molecules/multiple-select-filter/MultipleSelectFilter.js +9 -17
- package/src/hooks/use-outside-click/index.js +4 -5
package/dist/index.d.ts
CHANGED
|
@@ -372,12 +372,11 @@ declare const useOutsideClickHook = handler => {
|
|
|
372
372
|
if (ref.current && !ref.current.contains(e.target)) {
|
|
373
373
|
handler();
|
|
374
374
|
}
|
|
375
|
+
};
|
|
375
376
|
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
document.removeEventListener("click", handleOutsideClick, true);
|
|
380
|
-
};
|
|
377
|
+
document.addEventListener("click", handleOutsideClick, true);
|
|
378
|
+
return () => {
|
|
379
|
+
document.removeEventListener("click", handleOutsideClick, true);
|
|
381
380
|
};
|
|
382
381
|
}, [ref]);
|
|
383
382
|
|
|
@@ -576,8 +575,10 @@ declare const ButtonWithLink: React.FC<Expand<ButtonWithLinkProps> &
|
|
|
576
575
|
React.HTMLAttributes<HTMLElement>>;
|
|
577
576
|
|
|
578
577
|
interface CardProps {
|
|
579
|
-
text?: string;
|
|
578
|
+
text?: string | React.ReactNode;
|
|
579
|
+
textAs?: string;
|
|
580
580
|
titleText?: string;
|
|
581
|
+
titleAs?: string;
|
|
581
582
|
titleVariant?: string;
|
|
582
583
|
extraStyles?: string;
|
|
583
584
|
imgSrc?: string;
|
|
@@ -601,6 +602,10 @@ interface CardProps {
|
|
|
601
602
|
borderRadius?: string;
|
|
602
603
|
width?: string;
|
|
603
604
|
padding?: string;
|
|
605
|
+
showQuitLink?: boolean;
|
|
606
|
+
onQuitClick?: (
|
|
607
|
+
event: React.MouseEvent<HTMLElement> | React.TouchEvent<HTMLElement>
|
|
608
|
+
) => void;
|
|
604
609
|
}
|
|
605
610
|
|
|
606
611
|
declare const Card: React.FC<Expand<CardProps> &
|
package/dist/index.esm.js
CHANGED
|
@@ -26562,6 +26562,15 @@ var DisplayBox$1 = themeComponent(DisplayBox, "DisplayBox", fallbackValues$l);
|
|
|
26562
26562
|
var useOutsideClickHook = function useOutsideClickHook(handler) {
|
|
26563
26563
|
var ref = useRef();
|
|
26564
26564
|
useEffect$1(function () {
|
|
26565
|
+
var handleOutsideClick = function handleOutsideClick(e) {
|
|
26566
|
+
if (ref.current && !ref.current.contains(e.target)) {
|
|
26567
|
+
handler();
|
|
26568
|
+
}
|
|
26569
|
+
};
|
|
26570
|
+
document.addEventListener("click", handleOutsideClick, true);
|
|
26571
|
+
return function () {
|
|
26572
|
+
document.removeEventListener("click", handleOutsideClick, true);
|
|
26573
|
+
};
|
|
26565
26574
|
}, [ref]);
|
|
26566
26575
|
return ref;
|
|
26567
26576
|
};
|
|
@@ -26752,7 +26761,9 @@ var Popover = function Popover(_ref) {
|
|
|
26752
26761
|
togglePopover(popoverState);
|
|
26753
26762
|
}
|
|
26754
26763
|
};
|
|
26755
|
-
var triggerRef = useOutsideClickHook()
|
|
26764
|
+
var triggerRef = useOutsideClickHook(function () {
|
|
26765
|
+
return handleTogglePopover(false);
|
|
26766
|
+
});
|
|
26756
26767
|
return /*#__PURE__*/React.createElement(Box, {
|
|
26757
26768
|
padding: "0",
|
|
26758
26769
|
extraStyles: "position: relative; ".concat(extraStyles)
|
|
@@ -39853,20 +39864,40 @@ var fallbackValues$E = {
|
|
|
39853
39864
|
};
|
|
39854
39865
|
|
|
39855
39866
|
var CardText = function CardText(_ref) {
|
|
39856
|
-
var
|
|
39867
|
+
var showQuitLink = _ref.showQuitLink,
|
|
39868
|
+
onQuitClick = _ref.onQuitClick,
|
|
39869
|
+
titleAs = _ref.titleAs,
|
|
39870
|
+
padding = _ref.padding,
|
|
39857
39871
|
text = _ref.text,
|
|
39872
|
+
_ref$textAs = _ref.textAs,
|
|
39873
|
+
textAs = _ref$textAs === void 0 ? "p" : _ref$textAs,
|
|
39858
39874
|
titleText = _ref.titleText,
|
|
39859
39875
|
_ref$titleVariant = _ref.titleVariant,
|
|
39860
39876
|
titleVariant = _ref$titleVariant === void 0 ? "small" : _ref$titleVariant,
|
|
39861
39877
|
themeValues = _ref.themeValues;
|
|
39862
39878
|
return /*#__PURE__*/React.createElement(Box, {
|
|
39863
39879
|
padding: padding
|
|
39864
|
-
}, /*#__PURE__*/React.createElement(Cover, null, /*#__PURE__*/React.createElement(Stack, null,
|
|
39865
|
-
|
|
39880
|
+
}, /*#__PURE__*/React.createElement(Cover, null, /*#__PURE__*/React.createElement(Stack, null, /*#__PURE__*/React.createElement(Cluster, {
|
|
39881
|
+
justify: "space-between",
|
|
39882
|
+
align: "center",
|
|
39883
|
+
overflow: true
|
|
39884
|
+
}, titleText && /*#__PURE__*/React.createElement(Title$1, {
|
|
39885
|
+
as: titleAs,
|
|
39866
39886
|
variant: titleVariant,
|
|
39867
39887
|
color: themeValues.titleColor,
|
|
39868
39888
|
weight: themeValues.titleWeight
|
|
39869
|
-
}, titleText), /*#__PURE__*/React.createElement(
|
|
39889
|
+
}, titleText), showQuitLink && /*#__PURE__*/React.createElement(Box, {
|
|
39890
|
+
padding: "0",
|
|
39891
|
+
onClick: onQuitClick,
|
|
39892
|
+
onKeyDown: function onKeyDown(e) {
|
|
39893
|
+
return e.key === "Enter" && onQuitClick();
|
|
39894
|
+
},
|
|
39895
|
+
role: "button",
|
|
39896
|
+
tabIndex: 0,
|
|
39897
|
+
"aria-label": "Close Card: ".concat(titleText),
|
|
39898
|
+
extraStyles: "cursor: pointer;"
|
|
39899
|
+
}, /*#__PURE__*/React.createElement(IconQuitLarge, null))), /*#__PURE__*/React.createElement(Paragraph$1, {
|
|
39900
|
+
as: textAs,
|
|
39870
39901
|
color: themeValues.textColor
|
|
39871
39902
|
}, text))));
|
|
39872
39903
|
};
|
|
@@ -39907,9 +39938,17 @@ var Card = function Card(_ref) {
|
|
|
39907
39938
|
_ref$imgObjectFit = _ref.imgObjectFit,
|
|
39908
39939
|
imgObjectFit = _ref$imgObjectFit === void 0 ? "none" : _ref$imgObjectFit,
|
|
39909
39940
|
imgAltText = _ref.imgAltText,
|
|
39941
|
+
_ref$onQuitClick = _ref.onQuitClick,
|
|
39942
|
+
onQuitClick = _ref$onQuitClick === void 0 ? noop$1 : _ref$onQuitClick,
|
|
39910
39943
|
_ref$padding = _ref.padding,
|
|
39911
39944
|
padding = _ref$padding === void 0 ? "24px" : _ref$padding,
|
|
39945
|
+
_ref$showQuitLink = _ref.showQuitLink,
|
|
39946
|
+
showQuitLink = _ref$showQuitLink === void 0 ? false : _ref$showQuitLink,
|
|
39912
39947
|
text = _ref.text,
|
|
39948
|
+
_ref$textAs = _ref.textAs,
|
|
39949
|
+
textAs = _ref$textAs === void 0 ? "p" : _ref$textAs,
|
|
39950
|
+
_ref$titleAs = _ref.titleAs,
|
|
39951
|
+
titleAs = _ref$titleAs === void 0 ? "h2" : _ref$titleAs,
|
|
39913
39952
|
titleText = _ref.titleText,
|
|
39914
39953
|
_ref$titleVariant = _ref.titleVariant,
|
|
39915
39954
|
titleVariant = _ref$titleVariant === void 0 ? "small" : _ref$titleVariant,
|
|
@@ -39966,9 +40005,13 @@ var Card = function Card(_ref) {
|
|
|
39966
40005
|
width: "100%",
|
|
39967
40006
|
extraStyles: "flex-basis: 100%;"
|
|
39968
40007
|
}, text && /*#__PURE__*/React.createElement(CardText$1, {
|
|
40008
|
+
onQuitClick: onQuitClick,
|
|
39969
40009
|
padding: padding,
|
|
40010
|
+
showQuitLink: showQuitLink,
|
|
40011
|
+
titleAs: titleAs,
|
|
39970
40012
|
titleText: titleText,
|
|
39971
40013
|
text: text,
|
|
40014
|
+
textAs: textAs,
|
|
39972
40015
|
titleVariant: titleVariant
|
|
39973
40016
|
}), children)))));
|
|
39974
40017
|
};
|
|
@@ -50892,7 +50935,14 @@ var MultipleSelectFilter = function MultipleSelectFilter(_ref) {
|
|
|
50892
50935
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
50893
50936
|
appliedOptions = _useState4[0],
|
|
50894
50937
|
setAppliedOptions = _useState4[1];
|
|
50895
|
-
var
|
|
50938
|
+
var handleClickOutsideContainer = function handleClickOutsideContainer() {
|
|
50939
|
+
setOpened(false);
|
|
50940
|
+
actions.fields.searchTerm.set("");
|
|
50941
|
+
onApply(selectedOptions);
|
|
50942
|
+
};
|
|
50943
|
+
var containerRef = useOutsideClickHook(function () {
|
|
50944
|
+
return handleClickOutsideContainer();
|
|
50945
|
+
});
|
|
50896
50946
|
var dropdownRef = useRef(null);
|
|
50897
50947
|
var filterButtonRef = useRef(null);
|
|
50898
50948
|
var applyFilterButtonRef = useRef(null);
|
|
@@ -50920,17 +50970,8 @@ var MultipleSelectFilter = function MultipleSelectFilter(_ref) {
|
|
|
50920
50970
|
onApply(selectedOptions);
|
|
50921
50971
|
}
|
|
50922
50972
|
};
|
|
50923
|
-
var handleClickOutside = function handleClickOutside(event) {
|
|
50924
|
-
if (containerRef.current && !containerRef.current.contains(event.target) && dropdownRef.current && !dropdownRef.current.contains(event.target)) {
|
|
50925
|
-
setOpened(false);
|
|
50926
|
-
actions.fields.searchTerm.set("");
|
|
50927
|
-
onApply(selectedOptions);
|
|
50928
|
-
}
|
|
50929
|
-
};
|
|
50930
|
-
document.addEventListener("mousedown", handleClickOutside);
|
|
50931
50973
|
document.addEventListener("keydown", handleKeyDown);
|
|
50932
50974
|
return function () {
|
|
50933
|
-
document.addEventListener("mousedown", handleClickOutside);
|
|
50934
50975
|
document.removeEventListener("keydown", handleKeyDown);
|
|
50935
50976
|
};
|
|
50936
50977
|
}, []);
|
|
@@ -50946,7 +50987,7 @@ var MultipleSelectFilter = function MultipleSelectFilter(_ref) {
|
|
|
50946
50987
|
},
|
|
50947
50988
|
opened: opened,
|
|
50948
50989
|
backgroundColor: opened ? themeValues.primaryColor : selectedOptions !== null && selectedOptions !== void 0 && selectedOptions.length ? themeValues.secondaryColor : WHITE,
|
|
50949
|
-
contentColor: !opened && selectedOptions !== null && selectedOptions !== void 0 && selectedOptions.length ? WHITE :
|
|
50990
|
+
contentColor: !opened && selectedOptions !== null && selectedOptions !== void 0 && selectedOptions.length ? WHITE : CHARADE_GREY,
|
|
50950
50991
|
name: name,
|
|
50951
50992
|
filterDropdownID: filterDropdownID,
|
|
50952
50993
|
hasIcon: hasIcon,
|