@xyo-network/react-shared 2.67.6 → 2.67.8

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.
Files changed (76) hide show
  1. package/dist/browser/components/ListItemButtonEx.d.cts.map +1 -1
  2. package/dist/browser/components/ListItemButtonEx.d.mts.map +1 -1
  3. package/dist/browser/components/ListItemButtonEx.d.ts.map +1 -1
  4. package/dist/browser/components/LoadResult.d.cts.map +1 -1
  5. package/dist/browser/components/LoadResult.d.mts.map +1 -1
  6. package/dist/browser/components/LoadResult.d.ts.map +1 -1
  7. package/dist/browser/components/TableCell/getRemainingRowWidth.d.cts.map +1 -1
  8. package/dist/browser/components/TableCell/getRemainingRowWidth.d.mts.map +1 -1
  9. package/dist/browser/components/TableCell/getRemainingRowWidth.d.ts.map +1 -1
  10. package/dist/browser/components/TokenData/img/index.d.cts +15 -16
  11. package/dist/browser/components/TokenData/img/index.d.cts.map +1 -1
  12. package/dist/browser/components/TokenData/img/index.d.mts +15 -16
  13. package/dist/browser/components/TokenData/img/index.d.mts.map +1 -1
  14. package/dist/browser/components/TokenData/img/index.d.ts +15 -16
  15. package/dist/browser/components/TokenData/img/index.d.ts.map +1 -1
  16. package/dist/browser/hooks/useMediaQuery.d.cts +1 -2
  17. package/dist/browser/hooks/useMediaQuery.d.cts.map +1 -1
  18. package/dist/browser/hooks/useMediaQuery.d.mts +1 -2
  19. package/dist/browser/hooks/useMediaQuery.d.mts.map +1 -1
  20. package/dist/browser/hooks/useMediaQuery.d.ts +1 -2
  21. package/dist/browser/hooks/useMediaQuery.d.ts.map +1 -1
  22. package/dist/browser/hooks/usePromise.d.cts +1 -2
  23. package/dist/browser/hooks/usePromise.d.cts.map +1 -1
  24. package/dist/browser/hooks/usePromise.d.mts +1 -2
  25. package/dist/browser/hooks/usePromise.d.mts.map +1 -1
  26. package/dist/browser/hooks/usePromise.d.ts +1 -2
  27. package/dist/browser/hooks/usePromise.d.ts.map +1 -1
  28. package/dist/browser/index.cjs +20 -29
  29. package/dist/browser/index.cjs.map +1 -1
  30. package/dist/browser/index.js +50 -59
  31. package/dist/browser/index.js.map +1 -1
  32. package/dist/node/components/ListItemButtonEx.d.cts.map +1 -1
  33. package/dist/node/components/ListItemButtonEx.d.mts.map +1 -1
  34. package/dist/node/components/ListItemButtonEx.d.ts.map +1 -1
  35. package/dist/node/components/LoadResult.d.cts.map +1 -1
  36. package/dist/node/components/LoadResult.d.mts.map +1 -1
  37. package/dist/node/components/LoadResult.d.ts.map +1 -1
  38. package/dist/node/components/TableCell/getRemainingRowWidth.d.cts.map +1 -1
  39. package/dist/node/components/TableCell/getRemainingRowWidth.d.mts.map +1 -1
  40. package/dist/node/components/TableCell/getRemainingRowWidth.d.ts.map +1 -1
  41. package/dist/node/components/TokenData/img/index.d.cts +15 -16
  42. package/dist/node/components/TokenData/img/index.d.cts.map +1 -1
  43. package/dist/node/components/TokenData/img/index.d.mts +15 -16
  44. package/dist/node/components/TokenData/img/index.d.mts.map +1 -1
  45. package/dist/node/components/TokenData/img/index.d.ts +15 -16
  46. package/dist/node/components/TokenData/img/index.d.ts.map +1 -1
  47. package/dist/node/hooks/useMediaQuery.d.cts +1 -2
  48. package/dist/node/hooks/useMediaQuery.d.cts.map +1 -1
  49. package/dist/node/hooks/useMediaQuery.d.mts +1 -2
  50. package/dist/node/hooks/useMediaQuery.d.mts.map +1 -1
  51. package/dist/node/hooks/useMediaQuery.d.ts +1 -2
  52. package/dist/node/hooks/useMediaQuery.d.ts.map +1 -1
  53. package/dist/node/hooks/usePromise.d.cts +1 -2
  54. package/dist/node/hooks/usePromise.d.cts.map +1 -1
  55. package/dist/node/hooks/usePromise.d.mts +1 -2
  56. package/dist/node/hooks/usePromise.d.mts.map +1 -1
  57. package/dist/node/hooks/usePromise.d.ts +1 -2
  58. package/dist/node/hooks/usePromise.d.ts.map +1 -1
  59. package/dist/node/index.cjs +20 -29
  60. package/dist/node/index.cjs.map +1 -1
  61. package/dist/node/index.js +50 -59
  62. package/dist/node/index.js.map +1 -1
  63. package/package.json +5 -5
  64. package/src/components/BasicHero/BasicHero.tsx +1 -1
  65. package/src/components/ListItemButtonEx.tsx +1 -5
  66. package/src/components/LoadResult.tsx +1 -5
  67. package/src/components/StyleGuide/Papers.example.tsx +1 -1
  68. package/src/components/TableCell/getRemainingRowWidth.ts +2 -4
  69. package/src/components/TokenData/img/index.ts +15 -17
  70. package/src/components/TokenData/useGetTokenData.tsx +1 -1
  71. package/src/contexts/contextEx/use.ts +1 -1
  72. package/src/hooks/useDataState.ts +1 -1
  73. package/src/hooks/useMediaQuery.ts +2 -2
  74. package/src/hooks/usePromise.ts +2 -3
  75. package/src/lib/assertDefinedEx.ts +1 -1
  76. package/src/lib/getActualPaddingX.ts +6 -6
package/package.json CHANGED
@@ -16,10 +16,10 @@
16
16
  "@xylabs/react-link": "^3.0.35",
17
17
  "@xylabs/react-promise": "^3.0.35",
18
18
  "@xylabs/react-shared": "^3.0.35",
19
- "@xyo-network/hash": "^2.84.19",
20
- "@xyo-network/payload-model": "^2.84.19",
21
- "@xyo-network/react-event": "~2.67.6",
22
- "react-router-dom": "^6.21.0"
19
+ "@xyo-network/hash": "^2.85.6",
20
+ "@xyo-network/payload-model": "^2.85.6",
21
+ "@xyo-network/react-event": "~2.67.8",
22
+ "react-router-dom": "^6.21.1"
23
23
  },
24
24
  "devDependencies": {
25
25
  "@storybook/react": "^7.6.6",
@@ -86,6 +86,6 @@
86
86
  },
87
87
  "sideEffects": false,
88
88
  "types": "dist/browser/index.d.ts",
89
- "version": "2.67.6",
89
+ "version": "2.67.8",
90
90
  "type": "module"
91
91
  }
@@ -112,7 +112,7 @@ export const BasicHero: React.FC<BasicHeroProps> = ({
112
112
  sm: '400px',
113
113
  xs: '200px',
114
114
  },
115
- ...(sx ?? {}),
115
+ ...sx,
116
116
  }}
117
117
  style={{
118
118
  backgroundColor: backgroundColor ?? '',
@@ -21,9 +21,5 @@ export const ListItemButtonExTo: React.FC<ListItemButtonExProps> = ({ to, toOpti
21
21
  }
22
22
 
23
23
  export const ListItemButtonEx: React.FC<ListItemButtonExProps> = ({ to, ...props }) => {
24
- if (to) {
25
- return <ListItemButtonExTo to={to} {...props} />
26
- } else {
27
- return <ListItemButton {...props} />
28
- }
24
+ return to ? <ListItemButtonExTo to={to} {...props} /> : <ListItemButton {...props} />
29
25
  }
@@ -20,9 +20,5 @@ export function LoadResult<T>(props: PropsWithChildren<LoadResultProps<T>>) {
20
20
  if (error) {
21
21
  return <>{children}</>
22
22
  }
23
- if (searchResult === undefined) {
24
- return <FlexGrowRow busy minHeight="50px" />
25
- } else {
26
- return <>{children}</>
27
- }
23
+ return searchResult === undefined ? <FlexGrowRow busy minHeight="50px" /> : <>{children}</>
28
24
  }
@@ -6,7 +6,7 @@ export const PapersExample: React.FC = ({ ...props }) => {
6
6
  <FlexCol {...props}>
7
7
  <Typography variant="subtitle1">Paper</Typography>
8
8
  <FlexRow alignItems="stretch">
9
- {Array.from({ length: 5 }, () => undefined).map((_, index) => (
9
+ {Array.from({ length: 5 }, () => {}).map((_, index) => (
10
10
  <FlexCol key={`paper-${index}`} marginRight={2}>
11
11
  <Paper key={`paper-${index}`} elevation={index * 2} color="secondary">
12
12
  <Typography margin={1}>Elevation-{index * 3}</Typography>
@@ -3,10 +3,8 @@ export const getRemainingRowWidth = (row: HTMLElement, forCell = 0) => {
3
3
  let width = 0
4
4
  for (let i = 0; i < (row?.childElementCount ?? 0); i++) {
5
5
  const item = row?.children.item(i)
6
- if (item) {
7
- if (i !== forCell) {
8
- width += item?.clientWidth ?? 0
9
- }
6
+ if (item && i !== forCell) {
7
+ width += item?.clientWidth ?? 0
10
8
  }
11
9
  }
12
10
 
@@ -1,17 +1,15 @@
1
- import ada from './ada.png'
2
- import btc from './btc.png'
3
- import busd from './busd.png'
4
- import dai from './dai.png'
5
- import dogecoin from './dogecoin.png'
6
- import dot from './dot.png'
7
- import ethereum from './ethereum.png'
8
- import frax from './frax.png'
9
- import link from './link.png'
10
- import sol from './sol.png'
11
- import tether from './tether.png'
12
- import usdCoin from './usd-coin.png'
13
- import weth from './weth.png'
14
- import wrappedBtc from './wrapped-bitcoin.png'
15
- import xyo from './xyo.png'
16
-
17
- export { ada, btc, busd, dai, dogecoin, dot, ethereum, frax, link, sol, tether, usdCoin, weth, wrappedBtc, xyo }
1
+ export { default as ada } from './ada.png'
2
+ export { default as btc } from './btc.png'
3
+ export { default as busd } from './busd.png'
4
+ export { default as dai } from './dai.png'
5
+ export { default as dogecoin } from './dogecoin.png'
6
+ export { default as dot } from './dot.png'
7
+ export { default as ethereum } from './ethereum.png'
8
+ export { default as frax } from './frax.png'
9
+ export { default as link } from './link.png'
10
+ export { default as sol } from './sol.png'
11
+ export { default as tether } from './tether.png'
12
+ export { default as usdCoin } from './usd-coin.png'
13
+ export { default as weth } from './weth.png'
14
+ export { default as wrappedBtc } from './wrapped-bitcoin.png'
15
+ export { default as xyo } from './xyo.png'
@@ -3,7 +3,7 @@ import { TokenData } from './TokenData'
3
3
  export const useGetTokenData = (symbols: (string | undefined)[]) => {
4
4
  return symbols?.map((symbol) => {
5
5
  const additionalTokenData = TokenData.find((x) => x.tokenSymbol === symbol)
6
- const checkedTokenData = additionalTokenData ? additionalTokenData : TokenData[0]
6
+ const checkedTokenData = additionalTokenData ?? TokenData[0]
7
7
  return checkedTokenData
8
8
  })
9
9
  }
@@ -5,7 +5,7 @@ import { ContextExState } from './State'
5
5
  export const useContextEx = <T extends ContextExState>(context: Context<T>, contextName: string, required = true) => {
6
6
  const { provided, ...props } = useContext(context)
7
7
  if (!provided && required) {
8
- throw Error(`use${contextName} can not be used outside of a ${contextName}Context when required=true`)
8
+ throw new Error(`use${contextName} can not be used outside of a ${contextName}Context when required=true`)
9
9
  }
10
10
  return props
11
11
  }
@@ -8,7 +8,7 @@ export const useDataState = <T>(defaultValue: T | undefined): [T | undefined, Di
8
8
  if (JSON.stringify(value) !== JSON.stringify(state)) {
9
9
  setState(value)
10
10
  }
11
- } catch (ex) {
11
+ } catch {
12
12
  console.error('setDataState failed! Make sure data type is stringifiable!')
13
13
  }
14
14
  }
@@ -1,7 +1,7 @@
1
1
  // eslint-disable-next-line import/no-deprecated
2
- import { useMediaQuery } from '@mui/material'
3
2
 
4
3
  // eslint-disable-next-line import/no-deprecated
5
- export { useMediaQuery }
6
4
 
7
5
  /* This file only exists to deal with the false positve lint error */
6
+
7
+ export { useMediaQuery } from '@mui/material'
@@ -1,4 +1,3 @@
1
- import { usePromise as importedUsePromise } from '@xylabs/react-promise'
2
-
3
1
  /** @deprecated use @xylabs/react-promise version instead */
4
- export const usePromise = importedUsePromise
2
+
3
+ export { usePromise } from '@xylabs/react-promise'
@@ -1,4 +1,4 @@
1
1
  export const assertDefinedEx = <T>(expr?: T | null, message?: string): T => {
2
2
  if (expr !== null && expr !== undefined) return expr
3
- throw Error(message)
3
+ throw new Error(message)
4
4
  }
@@ -1,18 +1,18 @@
1
1
  export const parseMeausureString = (measure?: string, absolute?: number) => {
2
2
  if (measure !== undefined && measure !== null && measure.length > 0) {
3
3
  if (measure.endsWith('px')) {
4
- return parseFloat(measure.substring(0, measure.length - 2))
4
+ return Number.parseFloat(measure.slice(0, Math.max(0, measure.length - 2)))
5
5
  } else if (measure.endsWith('%')) {
6
6
  if (absolute !== undefined) {
7
- return (parseFloat(measure.substring(0, measure.length - 1)) / 100) * absolute
7
+ return (Number.parseFloat(measure.slice(0, Math.max(0, measure.length - 1))) / 100) * absolute
8
8
  }
9
- throw Error('Error Parsing Measure [missing absolute]')
9
+ throw new Error('Error Parsing Measure [missing absolute]')
10
10
  } else if (measure.endsWith('vw')) {
11
- return (parseFloat(measure.substring(0, measure.length - 2)) / 100) * window.innerWidth
11
+ return (Number.parseFloat(measure.slice(0, Math.max(0, measure.length - 2))) / 100) * window.innerWidth
12
12
  } else if (measure.endsWith('vh')) {
13
- return (parseFloat(measure.substring(0, measure.length - 2)) / 100) * window.innerHeight
13
+ return (Number.parseFloat(measure.slice(0, Math.max(0, measure.length - 2))) / 100) * window.innerHeight
14
14
  }
15
- throw Error(`Error Parsing Measure [${measure}]`)
15
+ throw new Error(`Error Parsing Measure [${measure}]`)
16
16
  }
17
17
  }
18
18