@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 CHANGED
@@ -26570,6 +26570,15 @@ var DisplayBox$1 = themeComponent(DisplayBox, "DisplayBox", fallbackValues$l);
26570
26570
  var useOutsideClickHook = function useOutsideClickHook(handler) {
26571
26571
  var ref = React.useRef();
26572
26572
  React.useEffect(function () {
26573
+ var handleOutsideClick = function handleOutsideClick(e) {
26574
+ if (ref.current && !ref.current.contains(e.target)) {
26575
+ handler();
26576
+ }
26577
+ };
26578
+ document.addEventListener("click", handleOutsideClick, true);
26579
+ return function () {
26580
+ document.removeEventListener("click", handleOutsideClick, true);
26581
+ };
26573
26582
  }, [ref]);
26574
26583
  return ref;
26575
26584
  };
@@ -26760,7 +26769,9 @@ var Popover = function Popover(_ref) {
26760
26769
  togglePopover(popoverState);
26761
26770
  }
26762
26771
  };
26763
- var triggerRef = useOutsideClickHook();
26772
+ var triggerRef = useOutsideClickHook(function () {
26773
+ return handleTogglePopover(false);
26774
+ });
26764
26775
  return /*#__PURE__*/React__default.createElement(Box, {
26765
26776
  padding: "0",
26766
26777
  extraStyles: "position: relative; ".concat(extraStyles)
@@ -39861,20 +39872,40 @@ var fallbackValues$E = {
39861
39872
  };
39862
39873
 
39863
39874
  var CardText = function CardText(_ref) {
39864
- var padding = _ref.padding,
39875
+ var showQuitLink = _ref.showQuitLink,
39876
+ onQuitClick = _ref.onQuitClick,
39877
+ titleAs = _ref.titleAs,
39878
+ padding = _ref.padding,
39865
39879
  text = _ref.text,
39880
+ _ref$textAs = _ref.textAs,
39881
+ textAs = _ref$textAs === void 0 ? "p" : _ref$textAs,
39866
39882
  titleText = _ref.titleText,
39867
39883
  _ref$titleVariant = _ref.titleVariant,
39868
39884
  titleVariant = _ref$titleVariant === void 0 ? "small" : _ref$titleVariant,
39869
39885
  themeValues = _ref.themeValues;
39870
39886
  return /*#__PURE__*/React__default.createElement(Box, {
39871
39887
  padding: padding
39872
- }, /*#__PURE__*/React__default.createElement(Cover, null, /*#__PURE__*/React__default.createElement(Stack, null, titleText && /*#__PURE__*/React__default.createElement(Title$1, {
39873
- as: "p",
39888
+ }, /*#__PURE__*/React__default.createElement(Cover, null, /*#__PURE__*/React__default.createElement(Stack, null, /*#__PURE__*/React__default.createElement(Cluster, {
39889
+ justify: "space-between",
39890
+ align: "center",
39891
+ overflow: true
39892
+ }, titleText && /*#__PURE__*/React__default.createElement(Title$1, {
39893
+ as: titleAs,
39874
39894
  variant: titleVariant,
39875
39895
  color: themeValues.titleColor,
39876
39896
  weight: themeValues.titleWeight
39877
- }, titleText), /*#__PURE__*/React__default.createElement(Paragraph$1, {
39897
+ }, titleText), showQuitLink && /*#__PURE__*/React__default.createElement(Box, {
39898
+ padding: "0",
39899
+ onClick: onQuitClick,
39900
+ onKeyDown: function onKeyDown(e) {
39901
+ return e.key === "Enter" && onQuitClick();
39902
+ },
39903
+ role: "button",
39904
+ tabIndex: 0,
39905
+ "aria-label": "Close Card: ".concat(titleText),
39906
+ extraStyles: "cursor: pointer;"
39907
+ }, /*#__PURE__*/React__default.createElement(IconQuitLarge, null))), /*#__PURE__*/React__default.createElement(Paragraph$1, {
39908
+ as: textAs,
39878
39909
  color: themeValues.textColor
39879
39910
  }, text))));
39880
39911
  };
@@ -39915,9 +39946,17 @@ var Card = function Card(_ref) {
39915
39946
  _ref$imgObjectFit = _ref.imgObjectFit,
39916
39947
  imgObjectFit = _ref$imgObjectFit === void 0 ? "none" : _ref$imgObjectFit,
39917
39948
  imgAltText = _ref.imgAltText,
39949
+ _ref$onQuitClick = _ref.onQuitClick,
39950
+ onQuitClick = _ref$onQuitClick === void 0 ? noop$1 : _ref$onQuitClick,
39918
39951
  _ref$padding = _ref.padding,
39919
39952
  padding = _ref$padding === void 0 ? "24px" : _ref$padding,
39953
+ _ref$showQuitLink = _ref.showQuitLink,
39954
+ showQuitLink = _ref$showQuitLink === void 0 ? false : _ref$showQuitLink,
39920
39955
  text = _ref.text,
39956
+ _ref$textAs = _ref.textAs,
39957
+ textAs = _ref$textAs === void 0 ? "p" : _ref$textAs,
39958
+ _ref$titleAs = _ref.titleAs,
39959
+ titleAs = _ref$titleAs === void 0 ? "h2" : _ref$titleAs,
39921
39960
  titleText = _ref.titleText,
39922
39961
  _ref$titleVariant = _ref.titleVariant,
39923
39962
  titleVariant = _ref$titleVariant === void 0 ? "small" : _ref$titleVariant,
@@ -39974,9 +40013,13 @@ var Card = function Card(_ref) {
39974
40013
  width: "100%",
39975
40014
  extraStyles: "flex-basis: 100%;"
39976
40015
  }, text && /*#__PURE__*/React__default.createElement(CardText$1, {
40016
+ onQuitClick: onQuitClick,
39977
40017
  padding: padding,
40018
+ showQuitLink: showQuitLink,
40019
+ titleAs: titleAs,
39978
40020
  titleText: titleText,
39979
40021
  text: text,
40022
+ textAs: textAs,
39980
40023
  titleVariant: titleVariant
39981
40024
  }), children)))));
39982
40025
  };
@@ -50900,7 +50943,14 @@ var MultipleSelectFilter = function MultipleSelectFilter(_ref) {
50900
50943
  _useState4 = _slicedToArray(_useState3, 2),
50901
50944
  appliedOptions = _useState4[0],
50902
50945
  setAppliedOptions = _useState4[1];
50903
- var containerRef = React.useRef(null);
50946
+ var handleClickOutsideContainer = function handleClickOutsideContainer() {
50947
+ setOpened(false);
50948
+ actions.fields.searchTerm.set("");
50949
+ onApply(selectedOptions);
50950
+ };
50951
+ var containerRef = useOutsideClickHook(function () {
50952
+ return handleClickOutsideContainer();
50953
+ });
50904
50954
  var dropdownRef = React.useRef(null);
50905
50955
  var filterButtonRef = React.useRef(null);
50906
50956
  var applyFilterButtonRef = React.useRef(null);
@@ -50928,17 +50978,8 @@ var MultipleSelectFilter = function MultipleSelectFilter(_ref) {
50928
50978
  onApply(selectedOptions);
50929
50979
  }
50930
50980
  };
50931
- var handleClickOutside = function handleClickOutside(event) {
50932
- if (containerRef.current && !containerRef.current.contains(event.target) && dropdownRef.current && !dropdownRef.current.contains(event.target)) {
50933
- setOpened(false);
50934
- actions.fields.searchTerm.set("");
50935
- onApply(selectedOptions);
50936
- }
50937
- };
50938
- document.addEventListener("mousedown", handleClickOutside);
50939
50981
  document.addEventListener("keydown", handleKeyDown);
50940
50982
  return function () {
50941
- document.addEventListener("mousedown", handleClickOutside);
50942
50983
  document.removeEventListener("keydown", handleKeyDown);
50943
50984
  };
50944
50985
  }, []);
@@ -50954,7 +50995,7 @@ var MultipleSelectFilter = function MultipleSelectFilter(_ref) {
50954
50995
  },
50955
50996
  opened: opened,
50956
50997
  backgroundColor: opened ? themeValues.primaryColor : selectedOptions !== null && selectedOptions !== void 0 && selectedOptions.length ? themeValues.secondaryColor : WHITE,
50957
- contentColor: !opened && selectedOptions !== null && selectedOptions !== void 0 && selectedOptions.length ? WHITE : "#292A33",
50998
+ contentColor: !opened && selectedOptions !== null && selectedOptions !== void 0 && selectedOptions.length ? WHITE : CHARADE_GREY,
50958
50999
  name: name,
50959
51000
  filterDropdownID: filterDropdownID,
50960
51001
  hasIcon: hasIcon,