@xyo-network/react-shared 7.5.5 → 7.5.6

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": "@xyo-network/react-shared",
3
- "version": "7.5.5",
3
+ "version": "7.5.6",
4
4
  "description": "Common React library for all XYO projects that use React",
5
5
  "keywords": [
6
6
  "xyo",
@@ -43,36 +43,36 @@
43
43
  "src"
44
44
  ],
45
45
  "dependencies": {
46
- "@xylabs/react-button": "~7.1.15",
47
- "@xylabs/react-flexbox": "~7.1.15",
48
- "@xylabs/react-hooks": "~7.1.15",
49
- "@xylabs/react-link": "~7.1.15",
50
- "@xylabs/react-promise": "~7.1.15",
51
- "@xylabs/react-shared": "~7.1.15",
52
- "@xylabs/react-theme": "~7.1.15",
53
- "@xylabs/sdk-js": "~5.0.79",
54
- "@xyo-network/boundwitness-model": "~5.3.5",
55
- "@xyo-network/boundwitness-validator": "~5.3.5",
56
- "@xyo-network/payload-builder": "~5.3.5",
57
- "@xyo-network/payload-model": "~5.3.5"
46
+ "@xylabs/react-button": "~7.1.17",
47
+ "@xylabs/react-flexbox": "~7.1.17",
48
+ "@xylabs/react-hooks": "~7.1.17",
49
+ "@xylabs/react-link": "~7.1.17",
50
+ "@xylabs/react-promise": "~7.1.17",
51
+ "@xylabs/react-shared": "~7.1.17",
52
+ "@xylabs/react-theme": "~7.1.17",
53
+ "@xylabs/sdk-js": "~5.0.90",
54
+ "@xyo-network/boundwitness-model": "~5.3.17",
55
+ "@xyo-network/boundwitness-validator": "~5.3.17",
56
+ "@xyo-network/payload-builder": "~5.3.17",
57
+ "@xyo-network/payload-model": "~5.3.17"
58
58
  },
59
59
  "devDependencies": {
60
- "@mui/icons-material": "~7.3.8",
61
- "@mui/material": "~7.3.8",
62
- "@storybook/react-vite": "~10.2.9",
60
+ "@mui/icons-material": "~7.3.9",
61
+ "@mui/material": "~7.3.9",
62
+ "@storybook/react-vite": "~10.3.3",
63
63
  "@types/react": "^19.2.14",
64
- "@xylabs/react-appbar": "~7.1.15",
65
- "@xylabs/react-quick-tip-button": "~7.1.15",
66
- "@xylabs/ts-scripts-yarn3": "~7.3.2",
67
- "@xylabs/tsconfig": "~7.3.2",
68
- "@xylabs/tsconfig-dom": "~7.3.2",
69
- "@xylabs/tsconfig-react": "~7.3.2",
64
+ "@xylabs/react-appbar": "~7.1.17",
65
+ "@xylabs/react-quick-tip-button": "~7.1.17",
66
+ "@xylabs/ts-scripts-yarn3": "~7.5.6",
67
+ "@xylabs/tsconfig": "~7.5.6",
68
+ "@xylabs/tsconfig-dom": "~7.5.6",
69
+ "@xylabs/tsconfig-react": "~7.5.6",
70
70
  "react": "^19.2.4",
71
71
  "react-dom": "^19.2.4",
72
- "react-router-dom": "^7.13.0",
73
- "storybook": "~10.2.9",
72
+ "react-router-dom": "^7.13.2",
73
+ "storybook": "~10.3.3",
74
74
  "typescript": "^5.9.3",
75
- "vite": "~7.3.1",
75
+ "vite": "~8.0.3",
76
76
  "zod": "^4.3.6"
77
77
  },
78
78
  "peerDependencies": {
@@ -1,5 +1,6 @@
1
1
  import type {
2
- FormControlProps, StandardTextFieldProps, TextFieldProps,
2
+ FormControlProps,
3
+ TextFieldProps,
3
4
  } from '@mui/material'
4
5
  import {
5
6
  FormControl, FormHelperText, TextField,
@@ -29,16 +30,20 @@ export const BigIntTextField: React.FC<BigIntTextFieldProps> = ({
29
30
  const [fixedPoint, setFixedPoint] = useState(defaultFixedPoint)
30
31
  const [error, setError] = useState<Error>()
31
32
 
32
- useMemo(() => {
33
+ const [previousResetValue, setPreviousResetValue] = useState(resetValue)
34
+ if (resetValue !== previousResetValue) {
35
+ setPreviousResetValue(resetValue)
33
36
  setRawValue('')
34
- }, [resetValue])
37
+ }
35
38
 
36
- useMemo(() => {
39
+ const [previousDefaultRawValue, setPreviousDefaultRawValue] = useState(defaultRawValue)
40
+ if (defaultRawValue !== previousDefaultRawValue) {
41
+ setPreviousDefaultRawValue(defaultRawValue)
37
42
  if (isDefined(defaultRawValue)) {
38
43
  const formattedValue = formatBigIntInput(defaultRawValue)
39
44
  if (formattedValue) setRawValue(formattedValue)
40
45
  }
41
- }, [defaultRawValue])
46
+ }
42
47
 
43
48
  const handleChange: FocusEventHandler<HTMLTextAreaElement> = (event) => {
44
49
  // run standard callback with raw event
@@ -54,27 +59,25 @@ export const BigIntTextField: React.FC<BigIntTextFieldProps> = ({
54
59
 
55
60
  const onFixedPointChange = (fixedPoint: number) => setFixedPoint(fixedPoint)
56
61
 
57
- // on value or point changes, run the bigInt callback
58
- const bigIntValue = useMemo(() => {
59
- if (rawValue) {
60
- const fixedValue = toFixedPoint(rawValue, fixedPoint)
61
- setError(undefined)
62
- try {
63
- return fixedValue
64
- } catch (e) {
65
- console.error(e)
66
- setError(e as Error)
62
+ useEffect(() => {
63
+ // on value or point changes, run the bigInt callback
64
+ const bigIntValue = () => {
65
+ if (rawValue) {
66
+ const fixedValue = toFixedPoint(rawValue, fixedPoint)
67
+ setError(undefined)
68
+ try {
69
+ return fixedValue
70
+ } catch (e) {
71
+ console.error(e)
72
+ setError(e as Error)
73
+ return
74
+ }
75
+ } else {
67
76
  return
68
77
  }
69
- } else {
70
- return
71
78
  }
72
- // run bigInt callback
73
- }, [rawValue, fixedPoint])
74
-
75
- useEffect(() => {
76
- onChangeFixedPoint?.(bigIntValue)
77
- }, [bigIntValue])
79
+ onChangeFixedPoint?.(bigIntValue())
80
+ }, [fixedPoint, onChangeFixedPoint, rawValue])
78
81
 
79
82
  // prevent the fixed point from being less than the number of decimal places
80
83
  const minFixedPoint = rawValue.split('.')[1]?.length
@@ -29,8 +29,7 @@ export const ResolvedDivinerProvider = <D,>({
29
29
  provided: true,
30
30
  setDiviner,
31
31
  }
32
- }, [
33
- setDiviner, divinerProp])
32
+ }, [setDiviner, divinerProp, diviner])
34
33
 
35
34
  return (
36
35
  <Context
@@ -1,6 +1,7 @@
1
1
  import type { ForwardedRef } from 'react'
2
2
  import { useEffect, useRef } from 'react'
3
3
 
4
+ /** @deprecated */
4
5
  export const useShareForwardedRef = <T>(forwardedRef: ForwardedRef<T> | null | undefined, refresh = 0) => {
5
6
  // final ref that will share value with forward ref. this is the one to be attached to components
6
7
  const innerRef = useRef<T>(null)
@@ -12,6 +13,8 @@ export const useShareForwardedRef = <T>(forwardedRef: ForwardedRef<T> | null | u
12
13
  if (typeof forwardedRef === 'function') {
13
14
  forwardedRef(innerRef.current)
14
15
  } else {
16
+ // suppressing since this is older and deprecated
17
+ // eslint-disable-next-line react-hooks/immutability
15
18
  forwardedRef.current = innerRef.current
16
19
  }
17
20
  }, [forwardedRef, refresh])