@coreui/react 4.9.1 → 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coreui/react",
3
- "version": "4.9.1",
3
+ "version": "4.9.2",
4
4
  "description": "UI Components Library for React.js",
5
5
  "keywords": [
6
6
  "react",
@@ -38,29 +38,29 @@
38
38
  },
39
39
  "devDependencies": {
40
40
  "@popperjs/core": "^2.11.8",
41
- "@rollup/plugin-commonjs": "^25.0.2",
41
+ "@rollup/plugin-commonjs": "^25.0.3",
42
42
  "@rollup/plugin-node-resolve": "^15.1.0",
43
43
  "@rollup/plugin-typescript": "^11.1.2",
44
- "@testing-library/jest-dom": "^5.16.5",
44
+ "@testing-library/jest-dom": "^5.17.0",
45
45
  "@testing-library/react": "^14.0.0",
46
- "@types/react": "18.2.14",
47
- "@types/react-dom": "^18.2.6",
46
+ "@types/react": "18.2.18",
47
+ "@types/react-dom": "^18.2.7",
48
48
  "@types/react-transition-group": "^4.4.6",
49
49
  "classnames": "^2.3.2",
50
- "jest": "^29.6.1",
51
- "jest-environment-jsdom": "^29.6.1",
50
+ "jest": "^29.6.2",
51
+ "jest-environment-jsdom": "^29.6.2",
52
52
  "prop-types": "^15.8.1",
53
53
  "react": "^18.2.0",
54
54
  "react-dom": "^18.2.0",
55
55
  "react-popper": "^2.3.0",
56
56
  "react-transition-group": "^4.4.5",
57
- "rollup": "^3.26.2",
57
+ "rollup": "^3.27.0",
58
58
  "ts-jest": "^29.1.1",
59
- "tslib": "^2.6.0",
59
+ "tslib": "^2.6.1",
60
60
  "typescript": "^4.9.5"
61
61
  },
62
62
  "peerDependencies": {
63
- "@coreui/coreui": "4.2.6",
63
+ "@coreui/coreui": "4.3.0",
64
64
  "react": ">=17",
65
65
  "react-dom": ">=17"
66
66
  }
@@ -36,6 +36,13 @@ export interface CNavGroupProps {
36
36
  idx?: string
37
37
  }
38
38
 
39
+ const isInVisibleGroup = (el1: string, el2: string) => {
40
+ const array1 = el1.toString().split('.')
41
+ const array2 = el2.toString().split('.')
42
+
43
+ return array2.every((item, index) => item === array1[index])
44
+ }
45
+
39
46
  export const CNavGroup = forwardRef<HTMLLIElement, CNavGroupProps>(
40
47
  ({ children, className, compact, idx, toggler, visible, ...rest }, ref) => {
41
48
  const [height, setHeight] = useState<number | string>()
@@ -45,12 +52,12 @@ export const CNavGroup = forwardRef<HTMLLIElement, CNavGroupProps>(
45
52
 
46
53
  const [_visible, setVisible] = useState(
47
54
  Boolean(
48
- visible || (idx && visibleGroup && visibleGroup.toString().startsWith(idx.toString())),
55
+ visible || (idx && visibleGroup && isInVisibleGroup(visibleGroup, idx)),
49
56
  ),
50
57
  )
51
58
 
52
59
  useEffect(() => {
53
- setVisible(Boolean(idx && visibleGroup && visibleGroup.toString().startsWith(idx.toString())))
60
+ setVisible(Boolean(idx && visibleGroup && isInVisibleGroup(visibleGroup, idx)))
54
61
  }, [visibleGroup])
55
62
 
56
63
  const handleTogglerOnCLick = (event: React.MouseEvent<HTMLElement>) => {