@coreui/react 4.9.0 → 4.9.2

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.js CHANGED
@@ -5985,10 +5985,12 @@ var CModal = React.forwardRef(function (_a, ref) {
5985
5985
  setVisible(visible);
5986
5986
  }, [visible]);
5987
5987
  React.useEffect(function () {
5988
- document.addEventListener('click', handleClickOutside);
5989
- document.addEventListener('keydown', handleKeyDown);
5988
+ if (_visible) {
5989
+ document.addEventListener('mouseup', handleClickOutside);
5990
+ document.addEventListener('keydown', handleKeyDown);
5991
+ }
5990
5992
  return function () {
5991
- document.removeEventListener('click', handleClickOutside);
5993
+ document.removeEventListener('mouseup', handleClickOutside);
5992
5994
  document.removeEventListener('keydown', handleKeyDown);
5993
5995
  };
5994
5996
  }, [_visible]);
@@ -6175,14 +6177,19 @@ CSidebarNav.propTypes = {
6175
6177
  };
6176
6178
  CSidebarNav.displayName = 'CSidebarNav';
6177
6179
 
6180
+ var isInVisibleGroup = function (el1, el2) {
6181
+ var array1 = el1.toString().split('.');
6182
+ var array2 = el2.toString().split('.');
6183
+ return array2.every(function (item, index) { return item === array1[index]; });
6184
+ };
6178
6185
  var CNavGroup = React.forwardRef(function (_a, ref) {
6179
6186
  var children = _a.children, className = _a.className, compact = _a.compact, idx = _a.idx, toggler = _a.toggler, visible = _a.visible, rest = __rest(_a, ["children", "className", "compact", "idx", "toggler", "visible"]);
6180
6187
  var _b = React.useState(), height = _b[0], setHeight = _b[1];
6181
6188
  var navItemsRef = React.useRef(null);
6182
6189
  var _c = React.useContext(CNavContext), visibleGroup = _c.visibleGroup, setVisibleGroup = _c.setVisibleGroup;
6183
- var _d = React.useState(Boolean(visible || (idx && visibleGroup && visibleGroup.toString().startsWith(idx.toString())))), _visible = _d[0], setVisible = _d[1];
6190
+ var _d = React.useState(Boolean(visible || (idx && visibleGroup && isInVisibleGroup(visibleGroup, idx)))), _visible = _d[0], setVisible = _d[1];
6184
6191
  React.useEffect(function () {
6185
- setVisible(Boolean(idx && visibleGroup && visibleGroup.toString().startsWith(idx.toString())));
6192
+ setVisible(Boolean(idx && visibleGroup && isInVisibleGroup(visibleGroup, idx)));
6186
6193
  }, [visibleGroup]);
6187
6194
  var handleTogglerOnCLick = function (event) {
6188
6195
  event.preventDefault();