@xyo-network/react-shared 2.67.5 → 2.67.7
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/dist/browser/components/ListItemButtonEx.d.cts.map +1 -1
- package/dist/browser/components/ListItemButtonEx.d.mts.map +1 -1
- package/dist/browser/components/ListItemButtonEx.d.ts.map +1 -1
- package/dist/browser/components/LoadResult.d.cts.map +1 -1
- package/dist/browser/components/LoadResult.d.mts.map +1 -1
- package/dist/browser/components/LoadResult.d.ts.map +1 -1
- package/dist/browser/components/TableCell/getRemainingRowWidth.d.cts.map +1 -1
- package/dist/browser/components/TableCell/getRemainingRowWidth.d.mts.map +1 -1
- package/dist/browser/components/TableCell/getRemainingRowWidth.d.ts.map +1 -1
- package/dist/browser/components/TokenData/img/index.d.cts +15 -16
- package/dist/browser/components/TokenData/img/index.d.cts.map +1 -1
- package/dist/browser/components/TokenData/img/index.d.mts +15 -16
- package/dist/browser/components/TokenData/img/index.d.mts.map +1 -1
- package/dist/browser/components/TokenData/img/index.d.ts +15 -16
- package/dist/browser/components/TokenData/img/index.d.ts.map +1 -1
- package/dist/browser/hooks/useMediaQuery.d.cts +1 -2
- package/dist/browser/hooks/useMediaQuery.d.cts.map +1 -1
- package/dist/browser/hooks/useMediaQuery.d.mts +1 -2
- package/dist/browser/hooks/useMediaQuery.d.mts.map +1 -1
- package/dist/browser/hooks/useMediaQuery.d.ts +1 -2
- package/dist/browser/hooks/useMediaQuery.d.ts.map +1 -1
- package/dist/browser/hooks/usePayloadHash.d.cts +2 -2
- package/dist/browser/hooks/usePayloadHash.d.cts.map +1 -1
- package/dist/browser/hooks/usePayloadHash.d.mts +2 -2
- package/dist/browser/hooks/usePayloadHash.d.mts.map +1 -1
- package/dist/browser/hooks/usePayloadHash.d.ts +2 -2
- package/dist/browser/hooks/usePayloadHash.d.ts.map +1 -1
- package/dist/browser/hooks/usePromise.d.cts +1 -2
- package/dist/browser/hooks/usePromise.d.cts.map +1 -1
- package/dist/browser/hooks/usePromise.d.mts +1 -2
- package/dist/browser/hooks/usePromise.d.mts.map +1 -1
- package/dist/browser/hooks/usePromise.d.ts +1 -2
- package/dist/browser/hooks/usePromise.d.ts.map +1 -1
- package/dist/browser/index.cjs +20 -29
- package/dist/browser/index.cjs.map +1 -1
- package/dist/browser/index.js +50 -59
- package/dist/browser/index.js.map +1 -1
- package/dist/node/components/ListItemButtonEx.d.cts.map +1 -1
- package/dist/node/components/ListItemButtonEx.d.mts.map +1 -1
- package/dist/node/components/ListItemButtonEx.d.ts.map +1 -1
- package/dist/node/components/LoadResult.d.cts.map +1 -1
- package/dist/node/components/LoadResult.d.mts.map +1 -1
- package/dist/node/components/LoadResult.d.ts.map +1 -1
- package/dist/node/components/TableCell/getRemainingRowWidth.d.cts.map +1 -1
- package/dist/node/components/TableCell/getRemainingRowWidth.d.mts.map +1 -1
- package/dist/node/components/TableCell/getRemainingRowWidth.d.ts.map +1 -1
- package/dist/node/components/TokenData/img/index.d.cts +15 -16
- package/dist/node/components/TokenData/img/index.d.cts.map +1 -1
- package/dist/node/components/TokenData/img/index.d.mts +15 -16
- package/dist/node/components/TokenData/img/index.d.mts.map +1 -1
- package/dist/node/components/TokenData/img/index.d.ts +15 -16
- package/dist/node/components/TokenData/img/index.d.ts.map +1 -1
- package/dist/node/hooks/useMediaQuery.d.cts +1 -2
- package/dist/node/hooks/useMediaQuery.d.cts.map +1 -1
- package/dist/node/hooks/useMediaQuery.d.mts +1 -2
- package/dist/node/hooks/useMediaQuery.d.mts.map +1 -1
- package/dist/node/hooks/useMediaQuery.d.ts +1 -2
- package/dist/node/hooks/useMediaQuery.d.ts.map +1 -1
- package/dist/node/hooks/usePayloadHash.d.cts +2 -2
- package/dist/node/hooks/usePayloadHash.d.cts.map +1 -1
- package/dist/node/hooks/usePayloadHash.d.mts +2 -2
- package/dist/node/hooks/usePayloadHash.d.mts.map +1 -1
- package/dist/node/hooks/usePayloadHash.d.ts +2 -2
- package/dist/node/hooks/usePayloadHash.d.ts.map +1 -1
- package/dist/node/hooks/usePromise.d.cts +1 -2
- package/dist/node/hooks/usePromise.d.cts.map +1 -1
- package/dist/node/hooks/usePromise.d.mts +1 -2
- package/dist/node/hooks/usePromise.d.mts.map +1 -1
- package/dist/node/hooks/usePromise.d.ts +1 -2
- package/dist/node/hooks/usePromise.d.ts.map +1 -1
- package/dist/node/index.cjs +20 -29
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.js +50 -59
- package/dist/node/index.js.map +1 -1
- package/package.json +8 -8
- package/src/components/BasicHero/BasicHero.tsx +1 -1
- package/src/components/ListItemButtonEx.tsx +1 -5
- package/src/components/LoadResult.tsx +1 -5
- package/src/components/StyleGuide/Papers.example.tsx +1 -1
- package/src/components/TableCell/getRemainingRowWidth.ts +2 -4
- package/src/components/TokenData/img/index.ts +15 -17
- package/src/components/TokenData/useGetTokenData.tsx +1 -1
- package/src/contexts/contextEx/use.ts +1 -1
- package/src/hooks/useDataState.ts +1 -1
- package/src/hooks/useMediaQuery.ts +2 -2
- package/src/hooks/usePromise.ts +2 -3
- package/src/lib/assertDefinedEx.ts +1 -1
- package/src/lib/getActualPaddingX.ts +6 -6
package/package.json
CHANGED
|
@@ -16,16 +16,16 @@
|
|
|
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.
|
|
20
|
-
"@xyo-network/payload-model": "^2.
|
|
21
|
-
"@xyo-network/react-event": "~2.67.
|
|
22
|
-
"react-router-dom": "^6.21.
|
|
19
|
+
"@xyo-network/hash": "^2.85.4",
|
|
20
|
+
"@xyo-network/payload-model": "^2.85.4",
|
|
21
|
+
"@xyo-network/react-event": "~2.67.7",
|
|
22
|
+
"react-router-dom": "^6.21.1"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"@storybook/react": "^7.6.
|
|
25
|
+
"@storybook/react": "^7.6.6",
|
|
26
26
|
"@xylabs/react-quick-tip-button": "^3.0.35",
|
|
27
|
-
"@xylabs/ts-scripts-yarn3": "^3.2.
|
|
28
|
-
"@xylabs/tsconfig-react": "^3.2.
|
|
27
|
+
"@xylabs/ts-scripts-yarn3": "^3.2.25",
|
|
28
|
+
"@xylabs/tsconfig-react": "^3.2.25",
|
|
29
29
|
"typescript": "^5.3.3"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
@@ -86,6 +86,6 @@
|
|
|
86
86
|
},
|
|
87
87
|
"sideEffects": false,
|
|
88
88
|
"types": "dist/browser/index.d.ts",
|
|
89
|
-
"version": "2.67.
|
|
89
|
+
"version": "2.67.7",
|
|
90
90
|
"type": "module"
|
|
91
91
|
}
|
|
@@ -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
|
-
|
|
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
|
-
|
|
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 }, () =>
|
|
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
|
-
|
|
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
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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
|
|
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
|
|
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'
|
package/src/hooks/usePromise.ts
CHANGED
|
@@ -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.
|
|
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.
|
|
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.
|
|
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.
|
|
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
|
|