@xyo-network/react-shared 7.5.8 → 7.5.11
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/BasicHero/BasicHero.d.ts.map +1 -1
- package/dist/browser/components/bigint/InputAdornment.d.ts.map +1 -1
- package/dist/browser/components/bigint/TextField.d.ts.map +1 -1
- package/dist/browser/hooks/payload/types/ValidatedResponse.d.ts +2 -2
- package/dist/browser/hooks/payload/types/ValidatedResponse.d.ts.map +1 -1
- package/dist/browser/hooks/payload/usePayloadValidate.d.ts.map +1 -1
- package/dist/browser/hooks/useShareForwardRef.d.ts.map +1 -1
- package/dist/browser/index.mjs +641 -594
- package/dist/browser/index.mjs.map +1 -1
- package/package.json +88 -40
- package/src/SizeProp.ts +0 -1
- package/src/components/Ampersand.tsx +0 -11
- package/src/components/BasicHero/BasicHero.stories.tsx +0 -54
- package/src/components/BasicHero/BasicHero.tsx +0 -270
- package/src/components/BasicHero/default-desktop.svg +0 -1
- package/src/components/BasicHero/index.ts +0 -1
- package/src/components/Ellipsize.tsx +0 -103
- package/src/components/LabeledTextFieldWrapper.tsx +0 -20
- package/src/components/ListItemButtonEx.tsx +0 -30
- package/src/components/LoadResult.stories.tsx +0 -33
- package/src/components/LoadResult.tsx +0 -27
- package/src/components/NotFound.tsx +0 -16
- package/src/components/Pipe.tsx +0 -11
- package/src/components/ScrollTableOnSm.tsx +0 -13
- package/src/components/SectionSpacingRow/SectionSpacingRow.stories.tsx +0 -32
- package/src/components/SectionSpacingRow/SectionSpacingRow.tsx +0 -26
- package/src/components/SectionSpacingRow/index.ts +0 -1
- package/src/components/StyleGuide/AppBars.example.tsx +0 -29
- package/src/components/StyleGuide/Buttons.example.tsx +0 -46
- package/src/components/StyleGuide/Papers.example.tsx +0 -23
- package/src/components/StyleGuide/StyleGuide.example.tsx +0 -20
- package/src/components/StyleGuide/StyleGuide.stories.tsx +0 -21
- package/src/components/StyleGuide/Texts.example.tsx +0 -34
- package/src/components/StyleGuide/VariantContext.example.tsx +0 -3
- package/src/components/TableCell/AddressTableCell.tsx +0 -24
- package/src/components/TableCell/EllipsisTableCell.tsx +0 -58
- package/src/components/TableCell/EllipsizeTableCell.stories.tsx +0 -105
- package/src/components/TableCell/HashTableCell.tsx +0 -28
- package/src/components/TableCell/findParent.ts +0 -10
- package/src/components/TableCell/getRemainingRowWidth.ts +0 -12
- package/src/components/TableCell/getSmallestParentWidth.ts +0 -13
- package/src/components/TableCell/index.ts +0 -3
- package/src/components/ThemeTokenAvatar/ThemeTokenAvatar.stories.tsx +0 -25
- package/src/components/ThemeTokenAvatar/ThemeTokenAvatar.tsx +0 -8
- package/src/components/ThemeTokenAvatar/index.ts +0 -1
- package/src/components/ThemeTokenAvatarGroup/ThemeTokenAvatarGroup.stories.tsx +0 -38
- package/src/components/ThemeTokenAvatarGroup/ThemeTokenAvatarGroup.tsx +0 -13
- package/src/components/ThemeTokenAvatarGroup/index.ts +0 -1
- package/src/components/TokenBar/TokenBar.stories.tsx +0 -33
- package/src/components/TokenBar/TokenBar.tsx +0 -32
- package/src/components/TokenBar/index.ts +0 -1
- package/src/components/TokenData/TokenData.ts +0 -141
- package/src/components/TokenData/img/ada.png +0 -0
- package/src/components/TokenData/img/btc.png +0 -0
- package/src/components/TokenData/img/busd.png +0 -0
- package/src/components/TokenData/img/dai.png +0 -0
- package/src/components/TokenData/img/dogecoin.png +0 -0
- package/src/components/TokenData/img/dot.png +0 -0
- package/src/components/TokenData/img/ethereum.png +0 -0
- package/src/components/TokenData/img/frax.png +0 -0
- package/src/components/TokenData/img/images.d.ts +0 -5
- package/src/components/TokenData/img/index.ts +0 -16
- package/src/components/TokenData/img/link.png +0 -0
- package/src/components/TokenData/img/sol.png +0 -0
- package/src/components/TokenData/img/tether.png +0 -0
- package/src/components/TokenData/img/usd-coin.png +0 -0
- package/src/components/TokenData/img/weth.png +0 -0
- package/src/components/TokenData/img/wrapped-bitcoin.png +0 -0
- package/src/components/TokenData/img/xl1.png +0 -0
- package/src/components/TokenData/img/xyo.png +0 -0
- package/src/components/TokenData/index.ts +0 -2
- package/src/components/TokenData/useGetTokenData.tsx +0 -16
- package/src/components/TokenSummary/TokenSummary.stories.tsx +0 -37
- package/src/components/TokenSummary/TokenSummary.tsx +0 -32
- package/src/components/TokenSummary/index.ts +0 -1
- package/src/components/TypographyEx.tsx +0 -14
- package/src/components/bigint/FixedPointPopover.tsx +0 -27
- package/src/components/bigint/Input.stories.tsx +0 -79
- package/src/components/bigint/Input.ts +0 -6
- package/src/components/bigint/InputAdornment.tsx +0 -44
- package/src/components/bigint/TextField.tsx +0 -128
- package/src/components/bigint/helpers/formatBigIntInput.ts +0 -11
- package/src/components/bigint/helpers/index.ts +0 -1
- package/src/components/bigint/index.ts +0 -5
- package/src/components/index.ts +0 -19
- package/src/components/pluginValidation/DataMissing.tsx +0 -16
- package/src/components/pluginValidation/index.ts +0 -1
- package/src/contexts/ListMode/Context.ts +0 -5
- package/src/contexts/ListMode/Provider.tsx +0 -29
- package/src/contexts/ListMode/State.ts +0 -9
- package/src/contexts/ListMode/index.ts +0 -4
- package/src/contexts/ListMode/use.ts +0 -7
- package/src/contexts/diviner/Context.ts +0 -4
- package/src/contexts/diviner/Provider.tsx +0 -45
- package/src/contexts/diviner/State.ts +0 -7
- package/src/contexts/diviner/index.ts +0 -3
- package/src/contexts/index.ts +0 -2
- package/src/global.d.ts +0 -1
- package/src/hooks/GradientStyles/GradientStyle.stories.tsx +0 -66
- package/src/hooks/GradientStyles/GradientStyles.tsx +0 -54
- package/src/hooks/GradientStyles/index.ts +0 -1
- package/src/hooks/index.ts +0 -5
- package/src/hooks/payload/index.ts +0 -4
- package/src/hooks/payload/types/ValidatedResponse.ts +0 -3
- package/src/hooks/payload/types/index.ts +0 -1
- package/src/hooks/payload/useBoundWitnessValidate.tsx +0 -29
- package/src/hooks/payload/usePayloadHash.tsx +0 -26
- package/src/hooks/payload/usePayloadValidate.tsx +0 -22
- package/src/hooks/useDataState.ts +0 -18
- package/src/hooks/useMediaQuery.ts +0 -3
- package/src/hooks/useShareForwardRef.ts +0 -23
- package/src/index.ts +0 -6
- package/src/lib/assertDefinedEx.ts +0 -7
- package/src/lib/getActualPaddingX.ts +0 -63
- package/src/lib/index.ts +0 -3
- package/src/lib/networkComponents.tsx +0 -48
- package/src/lib/xyo.tsx +0 -15
- package/src/models/ListMode.ts +0 -1
- package/src/models/index.ts +0 -1
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
FormHelperText, Popover, type PopoverProps, TextField,
|
|
3
|
-
} from '@mui/material'
|
|
4
|
-
import React from 'react'
|
|
5
|
-
|
|
6
|
-
export interface FixedPointPopoverProps extends PopoverProps {
|
|
7
|
-
fixedPoint?: number
|
|
8
|
-
minFixedPoint?: number
|
|
9
|
-
onFixedPointChange?: (value: number) => void
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export const FixedPointPopover: React.FC<FixedPointPopoverProps> = ({
|
|
13
|
-
fixedPoint, minFixedPoint: minimumPoint, onFixedPointChange, ...props
|
|
14
|
-
}) => {
|
|
15
|
-
const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
|
16
|
-
const fixedPointInteger = Number.parseInt(event.target.value, 10)
|
|
17
|
-
if (Number.isNaN(fixedPointInteger)) return
|
|
18
|
-
onFixedPointChange?.(fixedPointInteger)
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
return (
|
|
22
|
-
<Popover slotProps={{ paper: { sx: { p: 2 } } }} {...props}>
|
|
23
|
-
<TextField slotProps={{ htmlInput: { min: minimumPoint } }} value={fixedPoint} onChange={handleChange} type="number" />
|
|
24
|
-
<FormHelperText>Set the Fixed Point</FormHelperText>
|
|
25
|
-
</Popover>
|
|
26
|
-
)
|
|
27
|
-
}
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import { Button, Typography } from '@mui/material'
|
|
2
|
-
import type { Meta, StoryFn } from '@storybook/react-vite'
|
|
3
|
-
import { FlexCol } from '@xylabs/react-flexbox'
|
|
4
|
-
import React, { useState } from 'react'
|
|
5
|
-
|
|
6
|
-
import { BigIntInput } from './Input.ts'
|
|
7
|
-
|
|
8
|
-
export default { title: 'Input/Bigint/WithFormControl', component: BigIntInput.WithFormControl } as Meta<typeof BigIntInput.WithFormControl>
|
|
9
|
-
|
|
10
|
-
const Template: StoryFn<typeof BigIntInput.WithFormControl> = ({ textFieldProps, ...args }) => {
|
|
11
|
-
const [bigIntString, setBigIntString] = useState<string>()
|
|
12
|
-
const [bigIntFormattedString, setBigIntFormattedString] = useState<string>()
|
|
13
|
-
const [resetValue, setResetValue] = useState(0)
|
|
14
|
-
|
|
15
|
-
const onChangeFixedPoint = (value?: bigint) => {
|
|
16
|
-
setBigIntString(value?.toString())
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const onChangeFormatted = (value?: string) => {
|
|
20
|
-
setBigIntFormattedString(value)
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
return (
|
|
24
|
-
<FlexCol alignItems="start" gap={2}>
|
|
25
|
-
<Button variant="contained" onClick={() => setResetValue(resetValue + 1)}>Reset</Button>
|
|
26
|
-
<BigIntInput.WithFormControl
|
|
27
|
-
textFieldProps={{
|
|
28
|
-
...textFieldProps, resetValue, onChangeFixedPoint, onChangeFormatted,
|
|
29
|
-
}}
|
|
30
|
-
{...args}
|
|
31
|
-
/>
|
|
32
|
-
{bigIntString
|
|
33
|
-
? (
|
|
34
|
-
<Typography>
|
|
35
|
-
BigInt:
|
|
36
|
-
{' '}
|
|
37
|
-
{bigIntString}
|
|
38
|
-
</Typography>
|
|
39
|
-
)
|
|
40
|
-
: null}
|
|
41
|
-
{bigIntFormattedString
|
|
42
|
-
? (
|
|
43
|
-
<Typography>
|
|
44
|
-
BigIntFormattedString:
|
|
45
|
-
{' '}
|
|
46
|
-
{bigIntFormattedString}
|
|
47
|
-
</Typography>
|
|
48
|
-
)
|
|
49
|
-
: null}
|
|
50
|
-
</FlexCol>
|
|
51
|
-
)
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
const Default = Template.bind({})
|
|
55
|
-
Default.args = {}
|
|
56
|
-
|
|
57
|
-
const WithDefaultFixedPoint = Template.bind({})
|
|
58
|
-
WithDefaultFixedPoint.args = {
|
|
59
|
-
textFieldProps: {
|
|
60
|
-
helperText: 'Enter Amount', hideAdornment: true, defaultRawValue: '1', defaultFixedPoint: 0,
|
|
61
|
-
},
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
const WithDefaultValue = Template.bind({})
|
|
65
|
-
WithDefaultValue.args = {
|
|
66
|
-
textFieldProps: {
|
|
67
|
-
helperText: 'Enter Amount', hideAdornment: true, defaultRawValue: '1.4',
|
|
68
|
-
},
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
const WithHiddenAdornment = Template.bind({})
|
|
72
|
-
WithHiddenAdornment.args = { textFieldProps: { hideAdornment: true } }
|
|
73
|
-
|
|
74
|
-
const WithHelperText = Template.bind({})
|
|
75
|
-
WithHelperText.args = { textFieldProps: { helperText: 'Enter Amount', hideAdornment: true } }
|
|
76
|
-
|
|
77
|
-
export {
|
|
78
|
-
Default, WithDefaultFixedPoint, WithDefaultValue, WithHelperText, WithHiddenAdornment,
|
|
79
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import type { InputAdornmentProps } from '@mui/material'
|
|
2
|
-
import {
|
|
3
|
-
Avatar, IconButton, InputAdornment,
|
|
4
|
-
} from '@mui/material'
|
|
5
|
-
import React, { useRef, useState } from 'react'
|
|
6
|
-
|
|
7
|
-
import { FixedPointPopover } from './FixedPointPopover.tsx'
|
|
8
|
-
|
|
9
|
-
export interface FixedPointInputAdornmentProps extends InputAdornmentProps {
|
|
10
|
-
fixedPoint?: number
|
|
11
|
-
minFixedPoint?: number
|
|
12
|
-
onFixedPointChange?: (value: number) => void
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export const FixedPointInputAdornment: React.FC<FixedPointInputAdornmentProps> = ({
|
|
16
|
-
fixedPoint, minFixedPoint, onFixedPointChange, ...props
|
|
17
|
-
}) => {
|
|
18
|
-
const ref = useRef<HTMLButtonElement>(null)
|
|
19
|
-
const [open, setOpen] = useState(false)
|
|
20
|
-
|
|
21
|
-
return (
|
|
22
|
-
<InputAdornment {...props}>
|
|
23
|
-
<FixedPointPopover
|
|
24
|
-
anchorEl={ref.current}
|
|
25
|
-
anchorOrigin={{ vertical: 'bottom', horizontal: 'left' }}
|
|
26
|
-
fixedPoint={fixedPoint}
|
|
27
|
-
minFixedPoint={minFixedPoint}
|
|
28
|
-
onClose={() => setOpen(false)}
|
|
29
|
-
onFixedPointChange={onFixedPointChange}
|
|
30
|
-
open={open}
|
|
31
|
-
/>
|
|
32
|
-
<IconButton size="small" ref={ref} onClick={() => setOpen(!open)}>
|
|
33
|
-
<Avatar sx={{
|
|
34
|
-
fontSize: '.75rem',
|
|
35
|
-
height: '20px',
|
|
36
|
-
width: '20px',
|
|
37
|
-
}}
|
|
38
|
-
>
|
|
39
|
-
{fixedPoint}
|
|
40
|
-
</Avatar>
|
|
41
|
-
</IconButton>
|
|
42
|
-
</InputAdornment>
|
|
43
|
-
)
|
|
44
|
-
}
|
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
FormControlProps,
|
|
3
|
-
TextFieldProps,
|
|
4
|
-
} from '@mui/material'
|
|
5
|
-
import {
|
|
6
|
-
FormControl, FormHelperText, TextField,
|
|
7
|
-
} from '@mui/material'
|
|
8
|
-
import { isDefined, toFixedPoint } from '@xylabs/sdk-js'
|
|
9
|
-
import type { FocusEventHandler } from 'react'
|
|
10
|
-
import React, {
|
|
11
|
-
useEffect, useMemo, useState,
|
|
12
|
-
} from 'react'
|
|
13
|
-
|
|
14
|
-
import { formatBigIntInput } from './helpers/index.ts'
|
|
15
|
-
import { FixedPointInputAdornment } from './InputAdornment.tsx'
|
|
16
|
-
|
|
17
|
-
export type BigIntTextFieldProps = TextFieldProps & {
|
|
18
|
-
defaultFixedPoint?: number
|
|
19
|
-
defaultRawValue?: string
|
|
20
|
-
hideAdornment?: boolean
|
|
21
|
-
onChangeFixedPoint?: (value?: bigint) => void
|
|
22
|
-
onChangeFormatted?: (value?: string) => void
|
|
23
|
-
resetValue?: number
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export const BigIntTextField: React.FC<BigIntTextFieldProps> = ({
|
|
27
|
-
defaultFixedPoint = 18, defaultRawValue, helperText, hideAdornment, onChangeFixedPoint, onChangeFormatted, onChange, resetValue, ...props
|
|
28
|
-
}) => {
|
|
29
|
-
const [rawValue, setRawValue] = useState<string>('')
|
|
30
|
-
const [fixedPoint, setFixedPoint] = useState(defaultFixedPoint)
|
|
31
|
-
const [error, setError] = useState<Error>()
|
|
32
|
-
|
|
33
|
-
const [previousResetValue, setPreviousResetValue] = useState(resetValue)
|
|
34
|
-
if (resetValue !== previousResetValue) {
|
|
35
|
-
setPreviousResetValue(resetValue)
|
|
36
|
-
setRawValue('')
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
const [previousDefaultRawValue, setPreviousDefaultRawValue] = useState(defaultRawValue)
|
|
40
|
-
if (defaultRawValue !== previousDefaultRawValue) {
|
|
41
|
-
setPreviousDefaultRawValue(defaultRawValue)
|
|
42
|
-
if (isDefined(defaultRawValue)) {
|
|
43
|
-
const formattedValue = formatBigIntInput(defaultRawValue)
|
|
44
|
-
if (formattedValue) setRawValue(formattedValue)
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
const handleChange: FocusEventHandler<HTMLTextAreaElement> = (event) => {
|
|
49
|
-
// run standard callback with raw event
|
|
50
|
-
onChange?.(event)
|
|
51
|
-
|
|
52
|
-
const formattedValue = formatBigIntInput(event.target.value)
|
|
53
|
-
if (isDefined(formattedValue)) {
|
|
54
|
-
// if value was formatted, update the state and run the formatted change callback
|
|
55
|
-
setRawValue(formattedValue)
|
|
56
|
-
onChangeFormatted?.(formattedValue)
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
const onFixedPointChange = (fixedPoint: number) => setFixedPoint(fixedPoint)
|
|
61
|
-
|
|
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 {
|
|
76
|
-
return
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
onChangeFixedPoint?.(bigIntValue())
|
|
80
|
-
}, [fixedPoint, onChangeFixedPoint, rawValue])
|
|
81
|
-
|
|
82
|
-
// prevent the fixed point from being less than the number of decimal places
|
|
83
|
-
const minFixedPoint = rawValue.split('.')[1]?.length
|
|
84
|
-
|
|
85
|
-
const resolvedHelperText = useMemo(() => {
|
|
86
|
-
if (error) return 'Cannot convert to BigInt'
|
|
87
|
-
return helperText ?? 'Enter a number'
|
|
88
|
-
}, [helperText, error])
|
|
89
|
-
|
|
90
|
-
return (
|
|
91
|
-
<>
|
|
92
|
-
<TextField
|
|
93
|
-
onChange={handleChange}
|
|
94
|
-
type="string"
|
|
95
|
-
error={Boolean(error)}
|
|
96
|
-
slotProps={{
|
|
97
|
-
htmlInput: { pattern: '[0-9]*[.]?[0-9]*' },
|
|
98
|
-
input: {
|
|
99
|
-
startAdornment: (hideAdornment
|
|
100
|
-
? null
|
|
101
|
-
: (
|
|
102
|
-
<FixedPointInputAdornment
|
|
103
|
-
position="start"
|
|
104
|
-
fixedPoint={fixedPoint}
|
|
105
|
-
minFixedPoint={minFixedPoint}
|
|
106
|
-
onFixedPointChange={onFixedPointChange}
|
|
107
|
-
/>
|
|
108
|
-
)
|
|
109
|
-
),
|
|
110
|
-
},
|
|
111
|
-
}}
|
|
112
|
-
value={rawValue}
|
|
113
|
-
{...props}
|
|
114
|
-
/>
|
|
115
|
-
<FormHelperText>{resolvedHelperText}</FormHelperText>
|
|
116
|
-
</>
|
|
117
|
-
)
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
export interface InputWithFormControlProps extends FormControlProps {
|
|
121
|
-
textFieldProps?: BigIntTextFieldProps
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
export const WithFormControl: React.FC<InputWithFormControlProps> = ({ textFieldProps, ...props }) => (
|
|
125
|
-
<FormControl {...props}>
|
|
126
|
-
<BigIntTextField {...textFieldProps} />
|
|
127
|
-
</FormControl>
|
|
128
|
-
)
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Format a raw input string (i.e. Change event from input type=text)
|
|
3
|
-
* Designed to filter out non-digits and extra decimals
|
|
4
|
-
**/
|
|
5
|
-
export const formatBigIntInput = (rawValue: string) => {
|
|
6
|
-
// remove all alpha characters but allow decimals
|
|
7
|
-
const filteredValue = rawValue.replaceAll(/[^\d.]/g, '')
|
|
8
|
-
// only allow one decimal point
|
|
9
|
-
if (filteredValue.split('.').length > 2) return
|
|
10
|
-
return filteredValue
|
|
11
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './formatBigIntInput.ts'
|
package/src/components/index.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
export * from './Ampersand.tsx'
|
|
2
|
-
export * from './BasicHero/index.ts'
|
|
3
|
-
export * from './bigint/index.ts'
|
|
4
|
-
export * from './Ellipsize.tsx'
|
|
5
|
-
export * from './LabeledTextFieldWrapper.tsx'
|
|
6
|
-
export * from './ListItemButtonEx.tsx'
|
|
7
|
-
export * from './LoadResult.tsx'
|
|
8
|
-
export * from './NotFound.tsx'
|
|
9
|
-
export * from './Pipe.tsx'
|
|
10
|
-
export * from './pluginValidation/index.ts'
|
|
11
|
-
export * from './ScrollTableOnSm.tsx'
|
|
12
|
-
export * from './SectionSpacingRow/index.ts'
|
|
13
|
-
export * from './TableCell/index.ts'
|
|
14
|
-
export * from './ThemeTokenAvatar/index.ts'
|
|
15
|
-
export * from './ThemeTokenAvatarGroup/index.ts'
|
|
16
|
-
export * from './TokenBar/index.ts'
|
|
17
|
-
export * from './TokenData/index.ts'
|
|
18
|
-
export * from './TokenSummary/index.ts'
|
|
19
|
-
export * from './TypographyEx.tsx'
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { AlertProps } from '@mui/material'
|
|
2
|
-
import { Alert, AlertTitle } from '@mui/material'
|
|
3
|
-
import React from 'react'
|
|
4
|
-
|
|
5
|
-
export interface PayloadDataMissingProps extends AlertProps {
|
|
6
|
-
alertBody?: string
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export const PayloadDataMissing: React.FC<PayloadDataMissingProps> = ({ alertBody, ...props }) => {
|
|
10
|
-
return (
|
|
11
|
-
<Alert severity="warning" {...props}>
|
|
12
|
-
<AlertTitle>Missing Data</AlertTitle>
|
|
13
|
-
{alertBody ?? 'Payload is missing required data to render correctly'}
|
|
14
|
-
</Alert>
|
|
15
|
-
)
|
|
16
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './DataMissing.tsx'
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import type { PropsWithChildren } from 'react'
|
|
2
|
-
import React, { useMemo, useState } from 'react'
|
|
3
|
-
|
|
4
|
-
import type { ListMode } from '../../models/index.ts'
|
|
5
|
-
import { ListModeContext } from './Context.ts'
|
|
6
|
-
import type { ListModeContextState } from './State.ts'
|
|
7
|
-
|
|
8
|
-
export interface ListModeProviderProps {
|
|
9
|
-
defaultListMode?: ListMode
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export const ListModeProvider: React.FC<PropsWithChildren<ListModeProviderProps>> = ({ children, defaultListMode }) => {
|
|
13
|
-
const [listMode, setListMode] = useState(defaultListMode ?? 'default')
|
|
14
|
-
|
|
15
|
-
const value: ListModeContextState = useMemo(() => ({
|
|
16
|
-
listMode,
|
|
17
|
-
provided: true,
|
|
18
|
-
setListMode,
|
|
19
|
-
}), [listMode,
|
|
20
|
-
setListMode])
|
|
21
|
-
|
|
22
|
-
return (
|
|
23
|
-
<ListModeContext
|
|
24
|
-
value={value}
|
|
25
|
-
>
|
|
26
|
-
{children}
|
|
27
|
-
</ListModeContext>
|
|
28
|
-
)
|
|
29
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { ContextExState } from '@xylabs/react-shared'
|
|
2
|
-
import type { Dispatch } from 'react'
|
|
3
|
-
|
|
4
|
-
import type { ListMode } from '../../models/index.ts'
|
|
5
|
-
|
|
6
|
-
export type ListModeContextState = ContextExState<{
|
|
7
|
-
listMode: ListMode
|
|
8
|
-
setListMode?: Dispatch<ListMode>
|
|
9
|
-
}>
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { useResetState } from '@xylabs/react-hooks'
|
|
2
|
-
import type { ContextExProviderProps } from '@xylabs/react-shared'
|
|
3
|
-
import type { Context, PropsWithChildren } from 'react'
|
|
4
|
-
import React, { useMemo } from 'react'
|
|
5
|
-
|
|
6
|
-
import type { ResolvedDivinerState } from './State.ts'
|
|
7
|
-
|
|
8
|
-
export interface DivinerProviderProps<D> extends ContextExProviderProps, PropsWithChildren {
|
|
9
|
-
context: Context<ResolvedDivinerState<D>>
|
|
10
|
-
diviner?: D
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
/** Exposes a resolved diviner */
|
|
14
|
-
export const ResolvedDivinerProvider = <D,>({
|
|
15
|
-
diviner: divinerProp, required = false, children, context: Context,
|
|
16
|
-
}: DivinerProviderProps<D>) => {
|
|
17
|
-
const [diviner, setDiviner] = useResetState<D | undefined>(divinerProp)
|
|
18
|
-
|
|
19
|
-
const value: ResolvedDivinerState<D> = useMemo(() => {
|
|
20
|
-
const resolveDiviner = () => {
|
|
21
|
-
if (divinerProp) {
|
|
22
|
-
return diviner === divinerProp ? diviner : undefined
|
|
23
|
-
} else {
|
|
24
|
-
return diviner
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
return {
|
|
28
|
-
diviner: resolveDiviner(),
|
|
29
|
-
provided: true,
|
|
30
|
-
setDiviner,
|
|
31
|
-
}
|
|
32
|
-
}, [setDiviner, divinerProp, diviner])
|
|
33
|
-
|
|
34
|
-
return (
|
|
35
|
-
<Context
|
|
36
|
-
value={value}
|
|
37
|
-
>
|
|
38
|
-
{diviner
|
|
39
|
-
? children
|
|
40
|
-
: required
|
|
41
|
-
? null
|
|
42
|
-
: children}
|
|
43
|
-
</Context>
|
|
44
|
-
)
|
|
45
|
-
}
|
package/src/contexts/index.ts
DELETED
package/src/global.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import '@mui/material/themeCssVarsAugmentation'
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { Divider, Typography } from '@mui/material'
|
|
2
|
-
import type { Meta, StoryFn } from '@storybook/react-vite'
|
|
3
|
-
import type { FlexBoxProps } from '@xylabs/react-flexbox'
|
|
4
|
-
import { FlexCol } from '@xylabs/react-flexbox'
|
|
5
|
-
import React from 'react'
|
|
6
|
-
import { BrowserRouter } from 'react-router-dom'
|
|
7
|
-
|
|
8
|
-
import { useGradientStyles } from './GradientStyles.tsx'
|
|
9
|
-
|
|
10
|
-
const GradientTextExample: React.FC<FlexBoxProps> = (props) => {
|
|
11
|
-
const styles = useGradientStyles()
|
|
12
|
-
return (
|
|
13
|
-
<FlexCol alignItems="stretch" {...props}>
|
|
14
|
-
<Typography variant="h4" gutterBottom>
|
|
15
|
-
XYO Network Gradient Text Options
|
|
16
|
-
</Typography>
|
|
17
|
-
<Typography variant="subtitle2" gutterBottom paddingTop={3}>
|
|
18
|
-
Highlight
|
|
19
|
-
</Typography>
|
|
20
|
-
<Divider sx={{ marginY: '8px' }} />
|
|
21
|
-
<Typography variant="h5" gutterBottom>
|
|
22
|
-
Lorem ipsum dolor sit amet consectetur,
|
|
23
|
-
{' '}
|
|
24
|
-
<span style={styles.heading}>adipisicing elit.</span>
|
|
25
|
-
</Typography>
|
|
26
|
-
<Typography variant="subtitle2" gutterBottom paddingTop={3}>
|
|
27
|
-
Body Text
|
|
28
|
-
</Typography>
|
|
29
|
-
<Divider sx={{ marginY: '8px' }} />
|
|
30
|
-
<Typography variant="h5" gutterBottom style={styles.heading}>
|
|
31
|
-
Lorem ipsum dolor sit amet consectetur, adipisicing elit. Sint perspiciatis aliquam consequuntur nisi alias impedit ducimus ipsa voluptas,
|
|
32
|
-
suscipit ea vel dicta quasi hic, deserunt tempore, natus optio veritatis dolor?
|
|
33
|
-
</Typography>
|
|
34
|
-
<Typography variant="subtitle2" gutterBottom paddingTop={3}>
|
|
35
|
-
Caption
|
|
36
|
-
</Typography>
|
|
37
|
-
<Divider sx={{ marginY: '8px' }} />
|
|
38
|
-
<Typography variant="caption" gutterBottom style={styles.heading}>
|
|
39
|
-
Lorem ipsum dolor sit amet consectetur, adipisicing elit. Sint perspiciatis aliquam consequuntur nisi alias impedit ducimus ipsa voluptas,
|
|
40
|
-
suscipit ea vel dicta quasi hic, deserunt tempore, natus optio veritatis dolor?
|
|
41
|
-
</Typography>
|
|
42
|
-
<Typography variant="subtitle2" gutterBottom paddingTop={3}>
|
|
43
|
-
Card Border
|
|
44
|
-
</Typography>
|
|
45
|
-
<Divider sx={{ marginY: '8px' }} />
|
|
46
|
-
</FlexCol>
|
|
47
|
-
)
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
const StorybookEntry = {
|
|
51
|
-
argTypes: {},
|
|
52
|
-
component: GradientTextExample,
|
|
53
|
-
parameters: { docs: { page: null } },
|
|
54
|
-
title: 'shared/GradientText',
|
|
55
|
-
} as Meta<typeof GradientTextExample>
|
|
56
|
-
|
|
57
|
-
const Template: StoryFn<typeof GradientTextExample> = args => (
|
|
58
|
-
<BrowserRouter>
|
|
59
|
-
<GradientTextExample {...args}></GradientTextExample>
|
|
60
|
-
</BrowserRouter>
|
|
61
|
-
)
|
|
62
|
-
|
|
63
|
-
export const Default = Template.bind({})
|
|
64
|
-
Default.args = {}
|
|
65
|
-
|
|
66
|
-
export default StorybookEntry
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { useIsDark } from '@xylabs/react-theme'
|
|
2
|
-
import type { CSSProperties } from 'react'
|
|
3
|
-
|
|
4
|
-
export interface GradientStyles {
|
|
5
|
-
background: CSSProperties
|
|
6
|
-
border: CSSProperties
|
|
7
|
-
heading: CSSProperties
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export const colorfulGradientLightMode = () => {
|
|
11
|
-
return {
|
|
12
|
-
background: { backgroundImage: '-webkit-linear-gradient(232deg, #e17751, #d84e7a, #5898dd, #8c8ee5)' },
|
|
13
|
-
border: {
|
|
14
|
-
borderImage: '-webkit-linear-gradient(232deg, #e17751, #d84e7a, #5898dd, #8c8ee5)',
|
|
15
|
-
borderImageSlice: 1,
|
|
16
|
-
borderImageSource: '-webkit-linear-gradient(232deg, #e17751, #d84e7a, #5898dd, #8c8ee5)',
|
|
17
|
-
borderRadius: 0,
|
|
18
|
-
borderStyle: 'solid',
|
|
19
|
-
borderWidth: '2px',
|
|
20
|
-
},
|
|
21
|
-
heading: {
|
|
22
|
-
WebkitBackgroundClip: 'text',
|
|
23
|
-
WebkitTextFillColor: 'transparent',
|
|
24
|
-
background: '-webkit-linear-gradient(232deg, #e17751, #d84e7a, #5898dd, #8c8ee5)',
|
|
25
|
-
display: 'inline-block',
|
|
26
|
-
},
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export const colorfulGradientDarkMode = () => {
|
|
31
|
-
return {
|
|
32
|
-
background: { backgroundImage: '-webkit-linear-gradient(232deg, #F17938, #FF5BDC, #5898dd, #B2FFFD)' },
|
|
33
|
-
border: {
|
|
34
|
-
borderImage: '-webkit-linear-gradient(232deg, #F17938, #FF5BDC, #5898dd, #B2FFFD)',
|
|
35
|
-
borderImageSlice: 1,
|
|
36
|
-
borderImageSource: '-webkit-linear-gradient(232deg, #F17938, #FF5BDC, #5898dd, #B2FFFD)',
|
|
37
|
-
borderRadius: 0,
|
|
38
|
-
borderStyle: 'solid',
|
|
39
|
-
borderWidth: '2px',
|
|
40
|
-
},
|
|
41
|
-
heading: {
|
|
42
|
-
WebkitBackgroundClip: 'text',
|
|
43
|
-
WebkitTextFillColor: 'transparent',
|
|
44
|
-
background: '-webkit-linear-gradient(232deg, #F17938, #FF5BDC, #5898dd, #B2FFFD)',
|
|
45
|
-
display: 'inline-block',
|
|
46
|
-
},
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export const useGradientStyles = () => {
|
|
51
|
-
const dark = useIsDark()
|
|
52
|
-
const styles = dark ? colorfulGradientDarkMode() : colorfulGradientLightMode()
|
|
53
|
-
return styles
|
|
54
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './GradientStyles.tsx'
|
package/src/hooks/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './ValidatedResponse.ts'
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { usePromise } from '@xylabs/react-promise'
|
|
2
|
-
import { assertEx } from '@xylabs/sdk-js'
|
|
3
|
-
import type { BoundWitness } from '@xyo-network/boundwitness-model'
|
|
4
|
-
import { BoundWitnessValidator } from '@xyo-network/boundwitness-validator'
|
|
5
|
-
import { isAnyPayload } from '@xyo-network/payload-model'
|
|
6
|
-
|
|
7
|
-
import type { ValidatedResponse } from './types/index.ts'
|
|
8
|
-
|
|
9
|
-
export const useValidateBoundWitness = (input?: string): ValidatedResponse<BoundWitness> => {
|
|
10
|
-
const [output, validationError] = usePromise(async () => {
|
|
11
|
-
if (!input) return
|
|
12
|
-
|
|
13
|
-
const object = JSON.parse(input)
|
|
14
|
-
const validPayload = assertEx(isAnyPayload(object) ? object : null, () => 'Invalid payload')
|
|
15
|
-
|
|
16
|
-
const errors = await new BoundWitnessValidator(validPayload as BoundWitness).validate()
|
|
17
|
-
return {
|
|
18
|
-
payload: validPayload as BoundWitness,
|
|
19
|
-
errors,
|
|
20
|
-
}
|
|
21
|
-
}, [input])
|
|
22
|
-
|
|
23
|
-
const { payload, errors } = output ?? {}
|
|
24
|
-
|
|
25
|
-
return {
|
|
26
|
-
payload,
|
|
27
|
-
errors: [validationError, ...errors ?? []].filter<Error>(error => !!error),
|
|
28
|
-
}
|
|
29
|
-
}
|