@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/README.md CHANGED
@@ -46,7 +46,7 @@
46
46
 
47
47
  Several quick start options are available:
48
48
 
49
- - [Download the latest release](https://github.com/coreui/coreui-react/archive/v4.9.0.zip)
49
+ - [Download the latest release](https://github.com/coreui/coreui-react/archive/v4.9.2.zip)
50
50
  - Clone the repo: `git clone https://github.com/coreui/coreui-react.git`
51
51
  - Install with [npm](https://www.npmjs.com/): `npm install @coreui/react`
52
52
  - Install with [yarn](https://yarnpkg.com/): `yarn add @coreui/react`
package/dist/index.es.js CHANGED
@@ -5983,10 +5983,12 @@ var CModal = forwardRef(function (_a, ref) {
5983
5983
  setVisible(visible);
5984
5984
  }, [visible]);
5985
5985
  useEffect(function () {
5986
- document.addEventListener('click', handleClickOutside);
5987
- document.addEventListener('keydown', handleKeyDown);
5986
+ if (_visible) {
5987
+ document.addEventListener('mouseup', handleClickOutside);
5988
+ document.addEventListener('keydown', handleKeyDown);
5989
+ }
5988
5990
  return function () {
5989
- document.removeEventListener('click', handleClickOutside);
5991
+ document.removeEventListener('mouseup', handleClickOutside);
5990
5992
  document.removeEventListener('keydown', handleKeyDown);
5991
5993
  };
5992
5994
  }, [_visible]);
@@ -6173,14 +6175,19 @@ CSidebarNav.propTypes = {
6173
6175
  };
6174
6176
  CSidebarNav.displayName = 'CSidebarNav';
6175
6177
 
6178
+ var isInVisibleGroup = function (el1, el2) {
6179
+ var array1 = el1.toString().split('.');
6180
+ var array2 = el2.toString().split('.');
6181
+ return array2.every(function (item, index) { return item === array1[index]; });
6182
+ };
6176
6183
  var CNavGroup = forwardRef(function (_a, ref) {
6177
6184
  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"]);
6178
6185
  var _b = useState(), height = _b[0], setHeight = _b[1];
6179
6186
  var navItemsRef = useRef(null);
6180
6187
  var _c = useContext(CNavContext), visibleGroup = _c.visibleGroup, setVisibleGroup = _c.setVisibleGroup;
6181
- var _d = useState(Boolean(visible || (idx && visibleGroup && visibleGroup.toString().startsWith(idx.toString())))), _visible = _d[0], setVisible = _d[1];
6188
+ var _d = useState(Boolean(visible || (idx && visibleGroup && isInVisibleGroup(visibleGroup, idx)))), _visible = _d[0], setVisible = _d[1];
6182
6189
  useEffect(function () {
6183
- setVisible(Boolean(idx && visibleGroup && visibleGroup.toString().startsWith(idx.toString())));
6190
+ setVisible(Boolean(idx && visibleGroup && isInVisibleGroup(visibleGroup, idx)));
6184
6191
  }, [visibleGroup]);
6185
6192
  var handleTogglerOnCLick = function (event) {
6186
6193
  event.preventDefault();