@geee-be/react-utils 1.1.3 → 1.1.5

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.1.5
4
+
5
+ ### Patch Changes
6
+
7
+ - 70692ad: Use skeleton for input image on initial server render
8
+
9
+ ## 1.1.4
10
+
11
+ ### Patch Changes
12
+
13
+ - 464eb24: Trial sub components with Card
14
+
3
15
  ## 1.1.3
4
16
 
5
17
  ### Patch Changes
@@ -1 +1,2 @@
1
1
  export * from './ripple.js';
2
+ export * from './sub-component.js';
@@ -0,0 +1,3 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { forwardRef } from 'react';
3
+ export const withSubComponents = (RootComponent, subComponents) => Object.assign(forwardRef((props, ref) => (_jsx(RootComponent, { ...props, ref: ref }))), subComponents);
@@ -1,3 +1,4 @@
1
1
  export * from './use-broadcast-channel.js';
2
2
  export * from './use-history-state.js';
3
+ export * from './use-is-client.js';
3
4
  export * from './use-local-state.js';
@@ -0,0 +1,8 @@
1
+ import { useEffect, useState } from 'react';
2
+ export const useIsClient = () => {
3
+ const [isClient, setIsClient] = useState(false);
4
+ useEffect(() => {
5
+ setIsClient(true);
6
+ }, []);
7
+ return isClient;
8
+ };
@@ -10,6 +10,6 @@ export const Primary = {
10
10
  val: 1,
11
11
  });
12
12
  console.log('render', value);
13
- return (_jsxs("div", { children: [JSON.stringify(value), _jsx("button", { type: "button", onClick: () => setValue((prev) => ({ val: prev.val + 1 ?? -2 })), children: "Inc" })] }));
13
+ return (_jsxs("div", { children: [JSON.stringify(value), _jsx("button", { type: "button", onClick: () => setValue((prev) => ({ val: prev.val + 1 })), children: "Inc" })] }));
14
14
  },
15
15
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geee-be/react-utils",
3
- "version": "1.1.3",
3
+ "version": "1.1.5",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "license": "MIT",
@@ -1 +1,2 @@
1
1
  export * from './ripple.js';
2
+ export * from './sub-component.js';
@@ -0,0 +1,12 @@
1
+ import { type ComponentType, forwardRef } from 'react';
2
+
3
+ export const withSubComponents = <P extends {}, S>(
4
+ RootComponent: ComponentType<P>,
5
+ subComponents: S,
6
+ ) =>
7
+ Object.assign(
8
+ forwardRef<unknown, P>((props: any, ref: any) => (
9
+ <RootComponent {...props} ref={ref} />
10
+ )),
11
+ subComponents,
12
+ );
@@ -1,3 +1,4 @@
1
1
  export * from './use-broadcast-channel.js';
2
2
  export * from './use-history-state.js';
3
+ export * from './use-is-client.js';
3
4
  export * from './use-local-state.js';
@@ -0,0 +1,11 @@
1
+ import { useEffect, useState } from 'react';
2
+
3
+ export const useIsClient = () => {
4
+ const [isClient, setIsClient] = useState(false);
5
+
6
+ useEffect(() => {
7
+ setIsClient(true);
8
+ }, []);
9
+
10
+ return isClient;
11
+ };
@@ -19,7 +19,7 @@ export const Primary: Story = {
19
19
  {JSON.stringify(value)}
20
20
  <button
21
21
  type="button"
22
- onClick={() => setValue((prev) => ({ val: prev.val + 1 ?? -2 }))}
22
+ onClick={() => setValue((prev) => ({ val: prev.val + 1 }))}
23
23
  >
24
24
  Inc
25
25
  </button>