@vuu-ui/vuu-utils 4.1.2 → 4.2.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/package.json +6 -6
- package/src/react-utils.js +2 -8
- package/types/react-utils.d.ts +1 -1
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "4.1
|
|
2
|
+
"version": "4.2.1",
|
|
3
3
|
"author": "heswell",
|
|
4
4
|
"main": "./src/index.js",
|
|
5
5
|
"license": "Apache-2.0",
|
|
@@ -14,14 +14,14 @@
|
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
16
|
"@dnd-kit/react": "^0.5.0",
|
|
17
|
-
"@vuu-ui/vuu-data-types": "4.1
|
|
18
|
-
"@vuu-ui/vuu-table-types": "4.1
|
|
19
|
-
"@vuu-ui/vuu-filter-types": "4.1
|
|
20
|
-
"@vuu-ui/vuu-protocol-types": "4.1
|
|
17
|
+
"@vuu-ui/vuu-data-types": "4.2.1",
|
|
18
|
+
"@vuu-ui/vuu-table-types": "4.2.1",
|
|
19
|
+
"@vuu-ui/vuu-filter-types": "4.2.1",
|
|
20
|
+
"@vuu-ui/vuu-protocol-types": "4.2.1"
|
|
21
21
|
},
|
|
22
22
|
"peerDependencies": {
|
|
23
23
|
"@internationalized/date": "^3.0.0",
|
|
24
|
-
"@vuu-ui/vuu-filter-parser": "4.1
|
|
24
|
+
"@vuu-ui/vuu-filter-parser": "4.2.1",
|
|
25
25
|
"clsx": "^2.0.0",
|
|
26
26
|
"react": "^19.2.3",
|
|
27
27
|
"react-dom": "^19.2.3"
|
package/src/react-utils.js
CHANGED
|
@@ -1,14 +1,8 @@
|
|
|
1
1
|
import { Children, isValidElement, useEffect, useMemo, useRef } from "react";
|
|
2
2
|
const EMPTY_ARRAY = [];
|
|
3
3
|
const asReactElements = (children)=>{
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
if (isArray && children.every(isValidElement)) return children;
|
|
7
|
-
if (1 === count && !isArray && isValidElement(children)) return [
|
|
8
|
-
children
|
|
9
|
-
];
|
|
10
|
-
if (count > 1) return children;
|
|
11
|
-
return EMPTY_ARRAY;
|
|
4
|
+
const elements = Children.toArray(children).filter(isValidElement);
|
|
5
|
+
return 0 === elements.length ? EMPTY_ARRAY : elements;
|
|
12
6
|
};
|
|
13
7
|
const useIsMounted = (id = "")=>{
|
|
14
8
|
const isMountedRef = useRef(false);
|
package/types/react-utils.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ReactElement, ReactNode, SetStateAction } from "react";
|
|
1
|
+
import { type ReactElement, type ReactNode, type SetStateAction } from "react";
|
|
2
2
|
export declare const asReactElements: (children: ReactNode) => ReactElement[];
|
|
3
3
|
export declare const useIsMounted: (id?: string) => import("react").RefObject<boolean>;
|
|
4
4
|
export declare const isSimpleStateValue: <T>(arg: SetStateAction<T>) => arg is T;
|