@geee-be/react-utils 1.1.9 → 1.2.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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @geee-be/react-utils
2
2
 
3
+ ## 1.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - ad3b011: Update packages
8
+
9
+ ## 1.1.10
10
+
11
+ ### Patch Changes
12
+
13
+ - 3ad787e: feat: add Monitor
14
+
3
15
  ## 1.1.9
4
16
 
5
17
  ### Patch Changes
@@ -1,3 +1,4 @@
1
1
  export { ClientOnly } from './client-only.js';
2
+ export { Monitor } from './monitor.js';
2
3
  export * from './ripple.js';
3
4
  export * from './sub-component.js';
@@ -0,0 +1,13 @@
1
+ 'use client';
2
+ import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
3
+ import { useRenderCount } from '@uidotdev/usehooks';
4
+ import { useEffect } from 'react';
5
+ export const Monitor = ({ children, label }) => {
6
+ useEffect(() => {
7
+ console.log(label, 'mounted');
8
+ return () => console.log(label, 'unmounted');
9
+ }, [label]);
10
+ const count = useRenderCount();
11
+ console.log(label, 'rendered', count);
12
+ return _jsx(_Fragment, { children: children });
13
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geee-be/react-utils",
3
- "version": "1.1.9",
3
+ "version": "1.2.0",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "license": "MIT",
@@ -9,25 +9,28 @@
9
9
  "main": "dist/index.js",
10
10
  "types": "src/index.ts",
11
11
  "devDependencies": {
12
- "@storybook/addon-essentials": "^7.6.7",
13
- "@storybook/addon-interactions": "^7.6.7",
14
- "@storybook/addon-links": "^7.6.7",
15
- "@storybook/addon-onboarding": "^1.0.10",
16
- "@storybook/blocks": "^7.6.7",
17
- "@storybook/react": "^7.6.7",
18
- "@storybook/react-vite": "^7.6.7",
19
- "@storybook/test": "^7.6.7",
20
- "@types/react": "^18.2.0",
21
- "@types/react-dom": "^18.2.0",
12
+ "@storybook/addon-essentials": "^7.6.20",
13
+ "@storybook/addon-interactions": "^7.6.20",
14
+ "@storybook/addon-links": "^7.6.20",
15
+ "@storybook/addon-onboarding": "^1.0.11",
16
+ "@storybook/blocks": "^7.6.20",
17
+ "@storybook/react": "^7.6.20",
18
+ "@storybook/react-vite": "^7.6.20",
19
+ "@storybook/test": "^7.6.20",
20
+ "@types/react": "^18.3.12",
21
+ "@types/react-dom": "^18.3.1",
22
22
  "prop-types": "^15.8.1",
23
- "react": "^18.2.0",
24
- "react-dom": "^18.2.0",
25
- "storybook": "^7.6.7"
23
+ "react": "^18.3.1",
24
+ "react-dom": "^18.3.1",
25
+ "storybook": "^7.6.20"
26
26
  },
27
27
  "peerDependencies": {
28
28
  "react": ">=18.0.0",
29
29
  "react-dom": ">=18.0.0"
30
30
  },
31
+ "dependencies": {
32
+ "@uidotdev/usehooks": "^2.4.1"
33
+ },
31
34
  "scripts": {
32
35
  "prebuild": "rimraf dist/*",
33
36
  "build": "tsc",
@@ -1,3 +1,4 @@
1
1
  export { ClientOnly } from './client-only.js';
2
+ export { Monitor } from './monitor.js';
2
3
  export * from './ripple.js';
3
4
  export * from './sub-component.js';
@@ -0,0 +1,18 @@
1
+ 'use client';
2
+
3
+ import { useRenderCount } from '@uidotdev/usehooks';
4
+ import { useEffect, type FC, type PropsWithChildren } from 'react';
5
+
6
+ type Props = PropsWithChildren<{ label: string }>;
7
+
8
+ export const Monitor: FC<Props> = ({ children, label }) => {
9
+ useEffect(() => {
10
+ console.log(label, 'mounted');
11
+ return () => console.log(label, 'unmounted');
12
+ }, [label]);
13
+
14
+ const count = useRenderCount();
15
+ console.log(label, 'rendered', count);
16
+
17
+ return <>{children}</>;
18
+ };