@carbonorm/carbonreact 4.0.23 → 4.0.25

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
@@ -3,7 +3,6 @@
3
3
  var require$$0 = require('react');
4
4
  var reactRouterDom = require('react-router-dom');
5
5
  var reactToastify = require('react-toastify');
6
- var OutsideClickHandler = require('react-outside-click-handler');
7
6
  var carbonnode = require('@carbonorm/carbonnode');
8
7
  var classNames = require('classnames');
9
8
  var freeSolidSvgIcons = require('@fortawesome/free-solid-svg-icons');
@@ -486,6 +485,29 @@ function hexToRgb (hex) {
486
485
 
487
486
  var styles$1 = {"maintenanceHero":"C5KSPNF","httpStatusCode":"NhyRQts","centeredContainer":"nA4Uno6","errorTextGeneral":"yJAgaUs","errorKeys":"SRIoY4m","errorValues":"xQIsoNw","errorPre":"C6eWpJ3"};
488
487
 
488
+ function OutsideClickHandler({ onOutsideClick, children, disabled, useCapture }) {
489
+ const containerRef = require$$0.useRef(null);
490
+ require$$0.useEffect(() => {
491
+ if (disabled) {
492
+ return;
493
+ }
494
+ function handle(event) {
495
+ const element = containerRef.current;
496
+ if (!element || element.contains(event.target)) {
497
+ return;
498
+ }
499
+ onOutsideClick();
500
+ }
501
+ document.addEventListener('mousedown', handle, useCapture);
502
+ document.addEventListener('touchstart', handle, useCapture);
503
+ return () => {
504
+ document.removeEventListener('mousedown', handle, useCapture);
505
+ document.removeEventListener('touchstart', handle, useCapture);
506
+ };
507
+ }, [onOutsideClick, disabled, useCapture]);
508
+ return jsxRuntimeExports.jsx("div", { ref: containerRef, children: children });
509
+ }
510
+
489
511
  var BackendThrowable = (props) => {
490
512
  const { instance } = props;
491
513
  const currentThrowable = instance.state.backendThrowable[0];
@@ -3858,6 +3880,7 @@ exports.ErrorHttpCode = ErrorHttpCode;
3858
3880
  exports.GlobalHistory = GlobalHistory;
3859
3881
  exports.Loading = Loading;
3860
3882
  exports.Nest = Nest;
3883
+ exports.OutsideClickHandler = OutsideClickHandler;
3861
3884
  exports.PageNotFound = PageNotFound;
3862
3885
  exports.Popup = Popup;
3863
3886
  exports.TABLES = TABLES;