@fibery/react 1.2.0 → 1.3.0
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": "@fibery/react",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"files": [
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"react-test-renderer": "18.2.0",
|
|
26
26
|
"typescript": "5.1.6",
|
|
27
27
|
"@fibery/babel-preset": "7.3.0",
|
|
28
|
-
"@fibery/eslint-config": "8.
|
|
28
|
+
"@fibery/eslint-config": "8.5.0"
|
|
29
29
|
},
|
|
30
30
|
"jest": {
|
|
31
31
|
"coveragePathIgnorePatterns": [
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export function composeEventHandlers<E>(
|
|
2
|
+
originalEventHandler?: (event: E) => void,
|
|
3
|
+
ourEventHandler?: (event: E) => void,
|
|
4
|
+
{checkForDefaultPrevented = true} = {}
|
|
5
|
+
) {
|
|
6
|
+
return function handleEvent(event: E) {
|
|
7
|
+
originalEventHandler?.(event);
|
|
8
|
+
|
|
9
|
+
if (checkForDefaultPrevented === false || !(event as unknown as Event).defaultPrevented) {
|
|
10
|
+
ourEventHandler?.(event);
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
}
|
|
@@ -12,8 +12,8 @@ const hasChildren = (node: ReactNode): node is ReactElement => isValidElement(no
|
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
*
|
|
15
|
-
* Debug util to get text content of react node. Might be useful for logging
|
|
16
|
-
*
|
|
15
|
+
* Debug util to get text content of react node. Might be useful for logging.
|
|
16
|
+
* Based on https://github.com/fernandopasik/react-children-utilities/blob/main/src/lib/onlyText.ts
|
|
17
17
|
*/
|
|
18
18
|
export const reactNodeToString = (node: ReactNode | ReactNode[]) => {
|
|
19
19
|
if (!(node instanceof Array) && !isValidElement(node)) {
|