@xyo-network/react-shared 7.5.7 → 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.
Files changed (119) hide show
  1. package/dist/browser/components/BasicHero/BasicHero.d.ts.map +1 -1
  2. package/dist/browser/components/bigint/InputAdornment.d.ts.map +1 -1
  3. package/dist/browser/components/bigint/TextField.d.ts.map +1 -1
  4. package/dist/browser/hooks/payload/types/ValidatedResponse.d.ts +2 -2
  5. package/dist/browser/hooks/payload/types/ValidatedResponse.d.ts.map +1 -1
  6. package/dist/browser/hooks/payload/usePayloadValidate.d.ts.map +1 -1
  7. package/dist/browser/hooks/useShareForwardRef.d.ts.map +1 -1
  8. package/dist/browser/index.mjs +641 -594
  9. package/dist/browser/index.mjs.map +1 -1
  10. package/package.json +88 -40
  11. package/src/SizeProp.ts +0 -1
  12. package/src/components/Ampersand.tsx +0 -11
  13. package/src/components/BasicHero/BasicHero.stories.tsx +0 -54
  14. package/src/components/BasicHero/BasicHero.tsx +0 -270
  15. package/src/components/BasicHero/default-desktop.svg +0 -1
  16. package/src/components/BasicHero/index.ts +0 -1
  17. package/src/components/Ellipsize.tsx +0 -103
  18. package/src/components/LabeledTextFieldWrapper.tsx +0 -20
  19. package/src/components/ListItemButtonEx.tsx +0 -30
  20. package/src/components/LoadResult.stories.tsx +0 -33
  21. package/src/components/LoadResult.tsx +0 -27
  22. package/src/components/NotFound.tsx +0 -16
  23. package/src/components/Pipe.tsx +0 -11
  24. package/src/components/ScrollTableOnSm.tsx +0 -13
  25. package/src/components/SectionSpacingRow/SectionSpacingRow.stories.tsx +0 -32
  26. package/src/components/SectionSpacingRow/SectionSpacingRow.tsx +0 -26
  27. package/src/components/SectionSpacingRow/index.ts +0 -1
  28. package/src/components/StyleGuide/AppBars.example.tsx +0 -29
  29. package/src/components/StyleGuide/Buttons.example.tsx +0 -46
  30. package/src/components/StyleGuide/Papers.example.tsx +0 -23
  31. package/src/components/StyleGuide/StyleGuide.example.tsx +0 -20
  32. package/src/components/StyleGuide/StyleGuide.stories.tsx +0 -21
  33. package/src/components/StyleGuide/Texts.example.tsx +0 -34
  34. package/src/components/StyleGuide/VariantContext.example.tsx +0 -3
  35. package/src/components/TableCell/AddressTableCell.tsx +0 -24
  36. package/src/components/TableCell/EllipsisTableCell.tsx +0 -58
  37. package/src/components/TableCell/EllipsizeTableCell.stories.tsx +0 -105
  38. package/src/components/TableCell/HashTableCell.tsx +0 -28
  39. package/src/components/TableCell/findParent.ts +0 -10
  40. package/src/components/TableCell/getRemainingRowWidth.ts +0 -12
  41. package/src/components/TableCell/getSmallestParentWidth.ts +0 -13
  42. package/src/components/TableCell/index.ts +0 -3
  43. package/src/components/ThemeTokenAvatar/ThemeTokenAvatar.stories.tsx +0 -25
  44. package/src/components/ThemeTokenAvatar/ThemeTokenAvatar.tsx +0 -8
  45. package/src/components/ThemeTokenAvatar/index.ts +0 -1
  46. package/src/components/ThemeTokenAvatarGroup/ThemeTokenAvatarGroup.stories.tsx +0 -38
  47. package/src/components/ThemeTokenAvatarGroup/ThemeTokenAvatarGroup.tsx +0 -13
  48. package/src/components/ThemeTokenAvatarGroup/index.ts +0 -1
  49. package/src/components/TokenBar/TokenBar.stories.tsx +0 -33
  50. package/src/components/TokenBar/TokenBar.tsx +0 -32
  51. package/src/components/TokenBar/index.ts +0 -1
  52. package/src/components/TokenData/TokenData.ts +0 -141
  53. package/src/components/TokenData/img/ada.png +0 -0
  54. package/src/components/TokenData/img/btc.png +0 -0
  55. package/src/components/TokenData/img/busd.png +0 -0
  56. package/src/components/TokenData/img/dai.png +0 -0
  57. package/src/components/TokenData/img/dogecoin.png +0 -0
  58. package/src/components/TokenData/img/dot.png +0 -0
  59. package/src/components/TokenData/img/ethereum.png +0 -0
  60. package/src/components/TokenData/img/frax.png +0 -0
  61. package/src/components/TokenData/img/images.d.ts +0 -5
  62. package/src/components/TokenData/img/index.ts +0 -16
  63. package/src/components/TokenData/img/link.png +0 -0
  64. package/src/components/TokenData/img/sol.png +0 -0
  65. package/src/components/TokenData/img/tether.png +0 -0
  66. package/src/components/TokenData/img/usd-coin.png +0 -0
  67. package/src/components/TokenData/img/weth.png +0 -0
  68. package/src/components/TokenData/img/wrapped-bitcoin.png +0 -0
  69. package/src/components/TokenData/img/xl1.png +0 -0
  70. package/src/components/TokenData/img/xyo.png +0 -0
  71. package/src/components/TokenData/index.ts +0 -2
  72. package/src/components/TokenData/useGetTokenData.tsx +0 -16
  73. package/src/components/TokenSummary/TokenSummary.stories.tsx +0 -37
  74. package/src/components/TokenSummary/TokenSummary.tsx +0 -32
  75. package/src/components/TokenSummary/index.ts +0 -1
  76. package/src/components/TypographyEx.tsx +0 -14
  77. package/src/components/bigint/FixedPointPopover.tsx +0 -27
  78. package/src/components/bigint/Input.stories.tsx +0 -79
  79. package/src/components/bigint/Input.ts +0 -6
  80. package/src/components/bigint/InputAdornment.tsx +0 -44
  81. package/src/components/bigint/TextField.tsx +0 -128
  82. package/src/components/bigint/helpers/formatBigIntInput.ts +0 -11
  83. package/src/components/bigint/helpers/index.ts +0 -1
  84. package/src/components/bigint/index.ts +0 -5
  85. package/src/components/index.ts +0 -19
  86. package/src/components/pluginValidation/DataMissing.tsx +0 -16
  87. package/src/components/pluginValidation/index.ts +0 -1
  88. package/src/contexts/ListMode/Context.ts +0 -5
  89. package/src/contexts/ListMode/Provider.tsx +0 -29
  90. package/src/contexts/ListMode/State.ts +0 -9
  91. package/src/contexts/ListMode/index.ts +0 -4
  92. package/src/contexts/ListMode/use.ts +0 -7
  93. package/src/contexts/diviner/Context.ts +0 -4
  94. package/src/contexts/diviner/Provider.tsx +0 -45
  95. package/src/contexts/diviner/State.ts +0 -7
  96. package/src/contexts/diviner/index.ts +0 -3
  97. package/src/contexts/index.ts +0 -2
  98. package/src/global.d.ts +0 -1
  99. package/src/hooks/GradientStyles/GradientStyle.stories.tsx +0 -66
  100. package/src/hooks/GradientStyles/GradientStyles.tsx +0 -54
  101. package/src/hooks/GradientStyles/index.ts +0 -1
  102. package/src/hooks/index.ts +0 -5
  103. package/src/hooks/payload/index.ts +0 -4
  104. package/src/hooks/payload/types/ValidatedResponse.ts +0 -3
  105. package/src/hooks/payload/types/index.ts +0 -1
  106. package/src/hooks/payload/useBoundWitnessValidate.tsx +0 -29
  107. package/src/hooks/payload/usePayloadHash.tsx +0 -26
  108. package/src/hooks/payload/usePayloadValidate.tsx +0 -22
  109. package/src/hooks/useDataState.ts +0 -18
  110. package/src/hooks/useMediaQuery.ts +0 -3
  111. package/src/hooks/useShareForwardRef.ts +0 -23
  112. package/src/index.ts +0 -6
  113. package/src/lib/assertDefinedEx.ts +0 -7
  114. package/src/lib/getActualPaddingX.ts +0 -63
  115. package/src/lib/index.ts +0 -3
  116. package/src/lib/networkComponents.tsx +0 -48
  117. package/src/lib/xyo.tsx +0 -15
  118. package/src/models/ListMode.ts +0 -1
  119. package/src/models/index.ts +0 -1
@@ -1 +0,0 @@
1
- export * from './BasicHero.tsx'
@@ -1,103 +0,0 @@
1
- import type {
2
- BoxProps, TypographyProps, TypographyTypeMap,
3
- } from '@mui/material'
4
- import {
5
- Box, styled, Typography,
6
- } from '@mui/material'
7
- import type { PropsWithChildren } from 'react'
8
- import React from 'react'
9
-
10
- import { useShareForwardedRef } from '../hooks/index.ts'
11
-
12
- /**
13
- * Heavily inspired by - https://stackoverflow.com/a/30362531/2803259
14
- */
15
-
16
- const ComponentName = 'Ellipsize'
17
-
18
- export interface EllipsizeRootProps extends BoxProps {
19
- beforeLineHeight?: string | number
20
- }
21
-
22
- const EllipsizeRoot = styled(Box, {
23
- name: ComponentName,
24
- shouldForwardProp: prop => prop !== 'beforeLineHeight',
25
- slot: 'Root',
26
- })<EllipsizeRootProps>(({ beforeLineHeight = 0 }) => ({
27
- '&': {
28
- // because the cell content ends up absolutely positioned, the cell doesn't know the content height.
29
- // the pseudo element with a hidden character establishes the proper height of the content and hides it
30
- ':before': {
31
- content: "'nbsp;'",
32
- display: 'block',
33
- // take the pseudo element out of the `display: block` flow so it won't push against our actual content
34
- float: 'left',
35
- lineHeight: beforeLineHeight,
36
- visibility: 'hidden',
37
- },
38
- },
39
- }))
40
-
41
- const EllipsizeInnerWrap = styled(Box, {
42
- name: ComponentName,
43
- slot: 'innerWrap',
44
- })(() => ({ position: 'relative' }))
45
-
46
- const EllipsizeContentWrap = styled(Typography, {
47
- name: ComponentName,
48
- shouldForwardProp: prop => prop !== 'ellipsisPosition',
49
- slot: 'contentWrap',
50
- })<TypographyWithComponentProps>(({
51
- theme, ellipsisPosition, fontFamily,
52
- }) => {
53
- return theme.unstable_sx({
54
- fontFamily: fontFamily ?? 'monospace',
55
- left: 0,
56
- overflow: 'hidden',
57
- position: 'absolute',
58
- right: 0,
59
- textOverflow: 'ellipsis',
60
- whiteSpace: 'nowrap',
61
- ...(ellipsisPosition === 'start'
62
- ? {
63
- direction: 'rtl',
64
- textAlign: 'left',
65
- }
66
- : {}),
67
- })
68
- })
69
-
70
- export type TypographyWithComponentProps<D extends React.ElementType = TypographyTypeMap['defaultComponent'], P = {}> = TypographyProps<D, P> & {
71
- ellipsisPosition?: 'start' | 'end'
72
- }
73
-
74
- export interface EllipsizeBoxProps extends BoxProps {
75
- beforeLineHeight?: number | string
76
- disableSharedRef?: boolean
77
- ellipsisPosition?: 'start' | 'end'
78
- innerWrapProps?: BoxProps
79
- typographyProps?: TypographyWithComponentProps
80
- }
81
-
82
- export const EllipsizeBox = ({
83
- ref, innerWrapProps, children, ellipsisPosition = 'start', disableSharedRef, typographyProps, ...props
84
- }: PropsWithChildren<EllipsizeBoxProps>) => {
85
- const sharedRef = useShareForwardedRef(ref)
86
- const { sx: innerWrapSx, ...remainingInnerWrapProps } = innerWrapProps ?? {}
87
-
88
- return (
89
- <EllipsizeRoot ref={sharedRef} {...props}>
90
- <EllipsizeInnerWrap
91
- {...remainingInnerWrapProps}
92
- sx={{
93
- alignItems: 'center', display: 'flex', ...innerWrapSx,
94
- }}
95
- >
96
- <EllipsizeContentWrap component="span" ellipsisPosition={ellipsisPosition} variant="body2" {...typographyProps}>
97
- {children}
98
- </EllipsizeContentWrap>
99
- </EllipsizeInnerWrap>
100
- </EllipsizeRoot>
101
- )
102
- }
103
- EllipsizeBox.displayName = 'EllipsizeBox'
@@ -1,20 +0,0 @@
1
- import type { StackProps } from '@mui/material'
2
- import { Stack, Typography } from '@mui/material'
3
- import React from 'react'
4
-
5
- export interface LabeledTextFieldWrapperProps extends StackProps {
6
- label: string
7
- }
8
-
9
- export const LabeledTextFieldWrapper: React.FC<LabeledTextFieldWrapperProps> = ({
10
- children, label, ...props
11
- }) => {
12
- return (
13
- <Stack flexDirection="column" {...props}>
14
- <Typography gutterBottom variant="caption">
15
- {label}
16
- </Typography>
17
- {children}
18
- </Stack>
19
- )
20
- }
@@ -1,30 +0,0 @@
1
- import type { ListItemButtonProps } from '@mui/material'
2
- import { ListItemButton } from '@mui/material'
3
- import type { MouseEvent } from 'react'
4
- import React from 'react'
5
- import type { NavigateOptions, To } from 'react-router-dom'
6
- import { useNavigate } from 'react-router-dom'
7
-
8
- export interface ListItemButtonExProps extends ListItemButtonProps {
9
- target?: string
10
- to?: To
11
- toOptions?: NavigateOptions
12
- }
13
-
14
- export const ListItemButtonExTo: React.FC<ListItemButtonExProps> = ({
15
- to, toOptions, onClick, ...props
16
- }) => {
17
- const navigate = useNavigate()
18
- const localOnClick = (event: MouseEvent<HTMLDivElement>) => {
19
- onClick?.(event)
20
- if (to) {
21
- void navigate(to, toOptions)
22
- }
23
- }
24
-
25
- return <ListItemButton onClick={localOnClick} {...props} />
26
- }
27
-
28
- export const ListItemButtonEx: React.FC<ListItemButtonExProps> = ({ to, ...props }) => {
29
- return to ? <ListItemButtonExTo to={to} {...props} /> : <ListItemButton {...props} />
30
- }
@@ -1,33 +0,0 @@
1
- import type { Meta, StoryFn } from '@storybook/react-vite'
2
- import React from 'react'
3
-
4
- import { LoadResult } from './LoadResult.tsx'
5
-
6
- const StorybookEntry: Meta = {
7
- argTypes: {},
8
- component: LoadResult,
9
- parameters: { docs: { page: null } },
10
- title: 'webapp/LoadResult',
11
- }
12
-
13
- const Template: StoryFn<typeof LoadResult> = (props) => {
14
- return <LoadResult {...props} />
15
- }
16
-
17
- const Default = Template.bind({})
18
- Default.args = {}
19
-
20
- const NotFound = Template.bind({})
21
- NotFound.args = { notFound: true }
22
-
23
- const ApiError = Template.bind({})
24
- ApiError.args = { children: <h1>Shown in case of error</h1>, error: true }
25
-
26
- const SearchResult = Template.bind({})
27
- SearchResult.args = { children: <h1>Shown when there is a valid result</h1>, searchResult: 'foo' }
28
-
29
- export {
30
- ApiError, Default, NotFound, SearchResult,
31
- }
32
-
33
- export default StorybookEntry
@@ -1,27 +0,0 @@
1
- import { FlexGrowRow } from '@xylabs/react-flexbox'
2
- import type { PropsWithChildren } from 'react'
3
- import React from 'react'
4
-
5
- import { NotFound } from './NotFound.tsx'
6
-
7
- export interface LoadResultProps<T> {
8
- /** @deprecated - use error prop */
9
- apiError?: Error
10
- /** Defer error handling to the children and load them */
11
- error?: boolean
12
- notFound: boolean
13
- searchResult: T | undefined
14
- }
15
-
16
- export function LoadResult<T>(props: PropsWithChildren<LoadResultProps<T>>) {
17
- const {
18
- notFound, error, searchResult, children,
19
- } = props
20
- if (notFound) {
21
- return <NotFound />
22
- }
23
- if (error) {
24
- return <>{children}</>
25
- }
26
- return searchResult === undefined ? <FlexGrowRow busy minHeight="50px" /> : <>{children}</>
27
- }
@@ -1,16 +0,0 @@
1
- import { Typography } from '@mui/material'
2
- import type { FlexBoxProps } from '@xylabs/react-flexbox'
3
- import { FlexGrowCol } from '@xylabs/react-flexbox'
4
- import React from 'react'
5
-
6
- /** @deprecated use from @@xylabs/react-shared instead */
7
- export const NotFound: React.FC<FlexBoxProps> = (props) => {
8
- return (
9
- <FlexGrowCol {...props}>
10
- <Typography variant="h2">Sorry!</Typography>
11
- <Typography marginY={3} variant="body2">
12
- {'Can\'t find anything here'}
13
- </Typography>
14
- </FlexGrowCol>
15
- )
16
- }
@@ -1,11 +0,0 @@
1
- import type { TypographyProps } from '@mui/material'
2
- import { Typography } from '@mui/material'
3
- import React from 'react'
4
-
5
- export const Pipe: React.FC<TypographyProps> = (props) => {
6
- return (
7
- <Typography marginX={1} component="span" {...props}>
8
- |
9
- </Typography>
10
- )
11
- }
@@ -1,13 +0,0 @@
1
- import { styled } from '@mui/material'
2
- import type { PropsWithChildren } from 'react'
3
- import React from 'react'
4
-
5
- const StyledScrollTableOnSm = styled('div')(({ theme }) => ({
6
- [theme.breakpoints.down('md')]: { overflowX: 'scroll' },
7
- display: 'flex',
8
- flexGrow: 1,
9
- }))
10
-
11
- const ScrollTableOnSm: React.FC<PropsWithChildren> = ({ children }) => <StyledScrollTableOnSm>{children}</StyledScrollTableOnSm>
12
-
13
- export { ScrollTableOnSm }
@@ -1,32 +0,0 @@
1
- import { Divider, Typography } from '@mui/material'
2
- import type { Meta, StoryFn } from '@storybook/react-vite'
3
- import React from 'react'
4
- import { BrowserRouter } from 'react-router-dom'
5
-
6
- import { SectionSpacingRow } from './SectionSpacingRow.tsx'
7
- const StorybookEntry = {
8
- argTypes: {},
9
- component: SectionSpacingRow,
10
- parameters: { docs: { page: null } },
11
- title: 'shared/SectionSpacingRow',
12
- } as Meta<typeof SectionSpacingRow>
13
-
14
- const Template: StoryFn<typeof SectionSpacingRow> = args => (
15
- <BrowserRouter>
16
- <Typography variant="subtitle2">No Spacing</Typography>
17
- <Typography textAlign="center">Hello World</Typography>
18
- <Divider />
19
- <Typography variant="subtitle2">With Spacing</Typography>
20
- <SectionSpacingRow {...args}>Hello World</SectionSpacingRow>
21
- </BrowserRouter>
22
- )
23
-
24
- const Default = Template.bind({})
25
- Default.args = {}
26
-
27
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
28
- // @ts-ignore
29
-
30
- export { Default }
31
-
32
- export default StorybookEntry
@@ -1,26 +0,0 @@
1
- import { useTheme } from '@mui/material'
2
- import type { FlexBoxProps } from '@xylabs/react-flexbox'
3
- import { FlexGrowRow } from '@xylabs/react-flexbox'
4
- import React from 'react'
5
-
6
- export const SectionSpacingRow = ({
7
- ref, children, sx, ...props
8
- }: FlexBoxProps) => {
9
- const theme = useTheme()
10
- return (
11
- <FlexGrowRow
12
- sx={{
13
- paddingBottom: { md: theme.spacing(5), xs: theme.spacing(5) },
14
- paddingTop: { md: theme.spacing(5), xs: theme.spacing(5) },
15
- ...sx,
16
- }}
17
- width="100%"
18
- ref={ref}
19
- {...props}
20
- >
21
- {children}
22
- </FlexGrowRow>
23
- )
24
- }
25
-
26
- SectionSpacingRow.displayName = 'SectionSpacingRow'
@@ -1 +0,0 @@
1
- export * from './SectionSpacingRow.tsx'
@@ -1,29 +0,0 @@
1
- import { Menu as MenuIcon } from '@mui/icons-material'
2
- import {
3
- Button, IconButton, Toolbar, Typography,
4
- } from '@mui/material'
5
- import { AppBarEx } from '@xylabs/react-appbar'
6
- import { FlexCol } from '@xylabs/react-flexbox'
7
- import React from 'react'
8
-
9
- export const AppBarsExample = () => {
10
- const contextToolbar = (
11
- <Toolbar disableGutters>
12
- <IconButton edge="start" color="inherit" aria-label="menu" sx={{ mr: 2 }}>
13
- <MenuIcon />
14
- </IconButton>
15
- <Typography variant="h6" color="inherit" component="div">
16
- Photos
17
- </Typography>
18
- </Toolbar>
19
- )
20
-
21
- const systemToolbar = <Button variant="contained">Get Started</Button>
22
-
23
- return (
24
- <FlexCol alignItems="stretch">
25
- <Typography variant="subtitle1">App Bar</Typography>
26
- <AppBarEx elevation={0} contextToolbar={contextToolbar} systemToolbar={systemToolbar} />
27
- </FlexCol>
28
- )
29
- }
@@ -1,46 +0,0 @@
1
- import type { ButtonTypeMap } from '@mui/material'
2
- import { Button, Typography } from '@mui/material'
3
- import { FlexCol, FlexRow } from '@xylabs/react-flexbox'
4
- import React, { Fragment } from 'react'
5
-
6
- const colors = ['primary', 'secondary'] as ButtonTypeMap['props']['color'][]
7
- const variants = ['text', 'contained', 'outlined'] as ButtonTypeMap['props']['variant'][]
8
-
9
- export const ButtonsExample: React.FC = ({ ...props }) => {
10
- return (
11
- <FlexCol {...props} alignItems="stretch">
12
- <Typography variant="subtitle1">Buttons</Typography>
13
- <Typography variant="subtitle2">Buttons</Typography>
14
- <FlexRow alignItems="stretch" mb={2}>
15
- {colors.map(color => (
16
- <Fragment key={color}>
17
- <Button variant="contained" color={color}>
18
- {color}
19
- </Button>
20
- &nbsp;
21
- </Fragment>
22
- ))}
23
- </FlexRow>
24
- {variants.map(variant => (
25
- <FlexCol key={`btn-${variant}`} alignItems="stretch" mb={2}>
26
- <Typography variant="subtitle2">
27
- <span style={{ textTransform: 'capitalize' }}>{variant}</span>
28
- {' '}
29
- Buttons
30
- </Typography>
31
- <FlexRow alignItems="stretch">
32
- <Button variant={variant}>Button</Button>
33
- &nbsp;
34
- <Button variant={variant} disabled>
35
- Disabled
36
- </Button>
37
- &nbsp;
38
- <Button variant={variant} href="#href">
39
- Link
40
- </Button>
41
- </FlexRow>
42
- </FlexCol>
43
- ))}
44
- </FlexCol>
45
- )
46
- }
@@ -1,23 +0,0 @@
1
- import { Paper, Typography } from '@mui/material'
2
- import { FlexCol, FlexRow } from '@xylabs/react-flexbox'
3
- import React from 'react'
4
-
5
- export const PapersExample: React.FC = ({ ...props }) => {
6
- return (
7
- <FlexCol {...props}>
8
- <Typography variant="subtitle1">Paper</Typography>
9
- <FlexRow alignItems="stretch">
10
- {Array.from({ length: 5 }).map((_, index) => (
11
- <FlexCol key={`paper-${index}`} marginRight={2}>
12
- <Paper key={`paper-${index}`} elevation={index * 2} color="secondary">
13
- <Typography margin={1}>
14
- Elevation-
15
- {index * 3}
16
- </Typography>
17
- </Paper>
18
- </FlexCol>
19
- ))}
20
- </FlexRow>
21
- </FlexCol>
22
- )
23
- }
@@ -1,20 +0,0 @@
1
- import { Typography } from '@mui/material'
2
- import { FlexCol } from '@xylabs/react-flexbox'
3
- import React from 'react'
4
-
5
- import { AppBarsExample } from './AppBars.example.tsx'
6
- import { ButtonsExample } from './Buttons.example.tsx'
7
- import { PapersExample } from './Papers.example.tsx'
8
- import { TextsExample } from './Texts.example.tsx'
9
-
10
- export const StyleGuideExample: React.FC = () => {
11
- return (
12
- <FlexCol alignItems="stretch">
13
- <Typography variant="h5">XYO Network Style Guide</Typography>
14
- <AppBarsExample />
15
- <ButtonsExample />
16
- <PapersExample />
17
- <TextsExample />
18
- </FlexCol>
19
- )
20
- }
@@ -1,21 +0,0 @@
1
- import type { Meta, StoryFn } from '@storybook/react-vite'
2
- import React from 'react'
3
-
4
- import { StyleGuideExample } from './StyleGuide.example.tsx'
5
-
6
- const StorybookEntry = {
7
- argTypes: {},
8
- component: StyleGuideExample,
9
- parameters: { docs: { page: null } },
10
- title: 'shared/StyleGuide',
11
- } as Meta<typeof StyleGuideExample>
12
-
13
- const Template: StoryFn<typeof StyleGuideExample> = () => <StyleGuideExample />
14
-
15
- const Default = Template.bind({})
16
- Default.args = {}
17
- Default.decorators = []
18
-
19
- export { Default }
20
-
21
- export default StorybookEntry
@@ -1,34 +0,0 @@
1
- import type { TypographyVariant } from '@mui/material'
2
- import { Typography } from '@mui/material'
3
- import { FlexCol } from '@xylabs/react-flexbox'
4
- import React from 'react'
5
-
6
- export const TextsExample = () => {
7
- const variantList: TypographyVariant[] = [
8
- 'h1',
9
- 'h2',
10
- 'h3',
11
- 'h4',
12
- 'h5',
13
- 'h6',
14
- 'subtitle1',
15
- 'subtitle2',
16
- 'body1',
17
- 'body2',
18
- 'button',
19
- 'caption',
20
- 'overline',
21
- ]
22
-
23
- return (
24
- <FlexCol>
25
- {variantList.map(variant => (
26
- <Typography key={variant} variant={variant}>
27
- {variant}
28
- {' '}
29
- - XYO Network
30
- </Typography>
31
- ))}
32
- </FlexCol>
33
- )
34
- }
@@ -1,3 +0,0 @@
1
- import { createContext } from 'react'
2
-
3
- export const VariantContext = createContext('main')
@@ -1,24 +0,0 @@
1
- import React from 'react'
2
-
3
- import type { EllipsisTableCellProps } from './EllipsisTableCell.tsx'
4
- import { EllipsisTableCell } from './EllipsisTableCell.tsx'
5
-
6
- export interface AddressTableCellProps extends EllipsisTableCellProps {
7
- /** @deprecated - archives are no longer supported */
8
- archive?: string
9
- /** @deprecated - use events instead */
10
- exploreDomain?: string
11
- link?: boolean
12
- }
13
-
14
- const AddressTableCell = ({
15
- ref, value, archive, exploreDomain, link, ...props
16
- }: AddressTableCellProps) => {
17
- const href = exploreDomain && archive ? `${exploreDomain}/archive/${archive}/address/${value}` : undefined
18
- const to = exploreDomain === undefined && archive ? `/archive/${archive}/address/${value}` : undefined
19
-
20
- return <EllipsisTableCell value={value} href={href} to={to} ref={ref} link={link} {...props} />
21
- }
22
-
23
- AddressTableCell.displayName = 'AddressTableCell'
24
- export { AddressTableCell }
@@ -1,58 +0,0 @@
1
- import type { TableCellProps } from '@mui/material'
2
- import { styled, TableCell } from '@mui/material'
3
- import { asLinkHrefOrToProps, LinkEx } from '@xylabs/react-link'
4
- import React, { useMemo } from 'react'
5
- import type { To } from 'react-router-dom'
6
-
7
- import { EllipsizeBox } from '../Ellipsize.tsx'
8
-
9
- const EllipsisTableCellRoot = styled(TableCell, {
10
- name: 'EllipsisTableCell',
11
- shouldForwardProp: prop => prop !== 'width',
12
- slot: 'Root',
13
- })(({ width = '100%' }) => ({ width }))
14
-
15
- export interface EllipsisTableCellProps extends TableCellProps {
16
- href?: string
17
- link?: boolean
18
- to?: To
19
- value?: string
20
- /**
21
- * Width of the table cell.
22
- *
23
- * Note: When using percentages, this value can be different than what you expect
24
- * if used on a cell that is not the first cell in the first row.
25
- */
26
- width?: string | number
27
- }
28
-
29
- export const EllipsisTableCellWithRef = ({
30
- ref, children, href, link = false, to, value, ...props
31
- }: EllipsisTableCellProps) => {
32
- const data = useMemo(() => {
33
- if (children) {
34
- return children
35
- }
36
- if (href || link || to) {
37
- return (
38
- <LinkEx title={value} {...asLinkHrefOrToProps({ to, href })} target={href ? '_blank' : undefined}>
39
- {value}
40
- </LinkEx>
41
- )
42
- }
43
- return value
44
- }, [children, href, link, to, value])
45
- return (
46
- <EllipsisTableCellRoot {...props}>
47
- <EllipsizeBox
48
- ref={ref}
49
- sx={{ cursor: link || to || href ? 'pointer' : 'inherit' }}
50
- >
51
- {data}
52
- </EllipsizeBox>
53
- </EllipsisTableCellRoot>
54
- )
55
- }
56
-
57
- EllipsisTableCellWithRef.displayName = 'EllipsisTableCell'
58
- export const EllipsisTableCell = EllipsisTableCellWithRef