@xyo-network/react-card 7.5.8 → 7.5.12
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/index.mjs +206 -210
- package/dist/browser/index.mjs.map +1 -1
- package/package.json +87 -29
- package/src/components/CardContentEx.stories.tsx +0 -68
- package/src/components/CardContentEx.tsx +0 -42
- package/src/components/CardEx.tsx +0 -34
- package/src/components/FullWidthCard/FullWidthCard.stories.tsx +0 -31
- package/src/components/FullWidthCard/FullWidthCard.tsx +0 -133
- package/src/components/FullWidthCard/index.ts +0 -1
- package/src/components/PageCard.stories.tsx +0 -55
- package/src/components/PageCard.tsx +0 -57
- package/src/components/SimpleCard/SimpleCard.stories.tsx +0 -99
- package/src/components/SimpleCard/SimpleCard.tsx +0 -137
- package/src/components/SimpleCard/coinbase-wallet.svg +0 -1
- package/src/components/SimpleCard/index.ts +0 -1
- package/src/components/SimpleCard/money.jpg +0 -0
- package/src/components/SimpleCardGrid/SimpleCardGrid.stories.tsx +0 -74
- package/src/components/SimpleCardGrid/SimpleCardGrid.tsx +0 -30
- package/src/components/SimpleCardGrid/coinbase-wallet.svg +0 -1
- package/src/components/SimpleCardGrid/index.ts +0 -1
- package/src/components/SimpleCardGrid/money.jpg +0 -0
- package/src/components/index.ts +0 -5
- package/src/index.ts +0 -1
- package/src/types/global.d.ts +0 -1
- package/src/types/images.d.ts +0 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xyo-network/react-card",
|
|
3
|
-
"version": "7.5.
|
|
3
|
+
"version": "7.5.12",
|
|
4
4
|
"description": "Common React library for all XYO projects that use React",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"xyo",
|
|
@@ -36,46 +36,104 @@
|
|
|
36
36
|
},
|
|
37
37
|
"./package.json": "./package.json"
|
|
38
38
|
},
|
|
39
|
-
"module": "dist/browser/index.mjs",
|
|
40
|
-
"types": "dist/browser/index.d.ts",
|
|
41
39
|
"files": [
|
|
42
40
|
"dist",
|
|
43
|
-
"
|
|
41
|
+
"README.md"
|
|
44
42
|
],
|
|
45
43
|
"dependencies": {
|
|
46
|
-
"@
|
|
47
|
-
"@xylabs/react-theme": "~7.1.17",
|
|
48
|
-
"@xyo-network/react-shared": "7.5.8"
|
|
44
|
+
"@xyo-network/react-shared": "~7.5.12"
|
|
49
45
|
},
|
|
50
46
|
"devDependencies": {
|
|
51
|
-
"@
|
|
52
|
-
"@mui/material": "
|
|
53
|
-
"@
|
|
47
|
+
"@bitauth/libauth": "~3.0.0",
|
|
48
|
+
"@mui/icons-material": "^7.3.10",
|
|
49
|
+
"@mui/material": "^7.3.10",
|
|
50
|
+
"@opentelemetry/api": "^1.9.1",
|
|
51
|
+
"@opentelemetry/sdk-trace-base": "^2.7.0",
|
|
52
|
+
"@scure/base": "~2.2.0",
|
|
53
|
+
"@storybook/react-vite": "~10.3.5",
|
|
54
|
+
"@types/node": "~25.6.0",
|
|
54
55
|
"@types/react": "^19.2.14",
|
|
55
|
-
"@xylabs/
|
|
56
|
-
"@xylabs/
|
|
57
|
-
"@xylabs/
|
|
58
|
-
"@xylabs/
|
|
59
|
-
"@xylabs/
|
|
60
|
-
"@
|
|
61
|
-
"react": "
|
|
62
|
-
"react-
|
|
63
|
-
"
|
|
64
|
-
"
|
|
56
|
+
"@xylabs/react-async-effect": "~7.1.20",
|
|
57
|
+
"@xylabs/react-button": "~7.1.20",
|
|
58
|
+
"@xylabs/react-flexbox": "~7.1.20",
|
|
59
|
+
"@xylabs/react-hooks": "~7.1.20",
|
|
60
|
+
"@xylabs/react-link": "~7.1.20",
|
|
61
|
+
"@xylabs/react-promise": "~7.1.20",
|
|
62
|
+
"@xylabs/react-shared": "~7.1.20",
|
|
63
|
+
"@xylabs/react-theme": "~7.1.20",
|
|
64
|
+
"@xylabs/sdk-js": "^5.0.100",
|
|
65
|
+
"@xylabs/threads": "~5.0.100",
|
|
66
|
+
"@xylabs/toolchain": "~7.11.9",
|
|
67
|
+
"@xylabs/tsconfig": "^7.11.9",
|
|
68
|
+
"@xylabs/tsconfig-dom": "^7.11.9",
|
|
69
|
+
"@xylabs/tsconfig-react": "~7.11.9",
|
|
70
|
+
"@xylabs/zod": "~5.0.100",
|
|
71
|
+
"@xyo-network/boundwitness-model": "^5.5.1",
|
|
72
|
+
"@xyo-network/boundwitness-validator": "^5.5.1",
|
|
73
|
+
"@xyo-network/payload-builder": "^5.5.1",
|
|
74
|
+
"@xyo-network/payload-model": "^5.5.1",
|
|
75
|
+
"async-mutex": "^0.5.0",
|
|
76
|
+
"axios": "^1.15.2",
|
|
77
|
+
"bn.js": "^5.2.3",
|
|
78
|
+
"bowser": "^2.14.1",
|
|
79
|
+
"buffer": "^6.0.3",
|
|
80
|
+
"chalk": "^5.6.2",
|
|
81
|
+
"debug": "~4.4.3",
|
|
82
|
+
"esbuild": "~0.28.0",
|
|
83
|
+
"eslint": "^10.2.1",
|
|
84
|
+
"ethers": "^6.16.0",
|
|
85
|
+
"fast-deep-equal": "~3.1.3",
|
|
86
|
+
"hash-wasm": "~4.12.0",
|
|
87
|
+
"js-cookie": "~3.0.5",
|
|
88
|
+
"observable-fns": "~0.6.1",
|
|
89
|
+
"pako": "^2.1.0",
|
|
90
|
+
"react": "^19.2.5",
|
|
91
|
+
"react-dom": "^19.2.5",
|
|
92
|
+
"react-router-dom": "^7.14.2",
|
|
93
|
+
"spark-md5": "~3.0.2",
|
|
94
|
+
"storybook": "^10.3.5",
|
|
65
95
|
"typescript": "^5.9.3",
|
|
66
|
-
"vite": "
|
|
67
|
-
"
|
|
96
|
+
"vite": "^8.0.10",
|
|
97
|
+
"wasm-feature-detect": "~1.8.0",
|
|
98
|
+
"zod": "^4.3.6",
|
|
99
|
+
"@xyo-network/react-storybook": "~7.5.12"
|
|
68
100
|
},
|
|
69
101
|
"peerDependencies": {
|
|
70
|
-
"@mui/icons-material": "
|
|
71
|
-
"@mui/material": "
|
|
72
|
-
"
|
|
73
|
-
"
|
|
74
|
-
"react-
|
|
75
|
-
"
|
|
102
|
+
"@mui/icons-material": "^7.3.10",
|
|
103
|
+
"@mui/material": "^7.3.10",
|
|
104
|
+
"@opentelemetry/sdk-trace-base": "^2.7.0",
|
|
105
|
+
"@scure/base": "~2.2.0",
|
|
106
|
+
"@xylabs/react-async-effect": "~7.1.20",
|
|
107
|
+
"@xylabs/react-button": "~7.1.20",
|
|
108
|
+
"@xylabs/react-flexbox": "~7.1.20",
|
|
109
|
+
"@xylabs/react-hooks": "~7.1.20",
|
|
110
|
+
"@xylabs/react-link": "~7.1.20",
|
|
111
|
+
"@xylabs/react-promise": "~7.1.20",
|
|
112
|
+
"@xylabs/react-shared": "~7.1.20",
|
|
113
|
+
"@xylabs/react-theme": "~7.1.20",
|
|
114
|
+
"@xylabs/sdk-js": "^5.0.100",
|
|
115
|
+
"@xylabs/zod": "~5.0.100",
|
|
116
|
+
"@xyo-network/boundwitness-model": "^5.5.1",
|
|
117
|
+
"@xyo-network/boundwitness-validator": "^5.5.1",
|
|
118
|
+
"@xyo-network/payload-builder": "^5.5.1",
|
|
119
|
+
"@xyo-network/payload-model": "^5.5.1",
|
|
120
|
+
"async-mutex": "^0.5.0",
|
|
121
|
+
"bn.js": "^5.2.3",
|
|
122
|
+
"bowser": "^2.14.1",
|
|
123
|
+
"buffer": "^6.0.3",
|
|
124
|
+
"chalk": "^5.6.2",
|
|
125
|
+
"ethers": "^6.16.0",
|
|
126
|
+
"fast-deep-equal": "~3.1.3",
|
|
127
|
+
"js-cookie": "~3.0.5",
|
|
128
|
+
"pako": "^2.1.0",
|
|
129
|
+
"react": "^19.2.5",
|
|
130
|
+
"react-dom": "^19.2.5",
|
|
131
|
+
"react-router-dom": "^7.14.2",
|
|
132
|
+
"spark-md5": "~3.0.2",
|
|
133
|
+
"zod": "^4.3.6"
|
|
76
134
|
},
|
|
77
135
|
"publishConfig": {
|
|
78
136
|
"access": "public"
|
|
79
137
|
},
|
|
80
138
|
"docs": "dist/docs.json"
|
|
81
|
-
}
|
|
139
|
+
}
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { Button, Typography } from '@mui/material'
|
|
2
|
-
import type {
|
|
3
|
-
Decorator, Meta, StoryFn,
|
|
4
|
-
} from '@storybook/react-vite'
|
|
5
|
-
import { FlexGrowCol } from '@xylabs/react-flexbox'
|
|
6
|
-
import { WithRefDecorator } from '@xyo-network/react-storybook'
|
|
7
|
-
import React, { useRef, useState } from 'react'
|
|
8
|
-
|
|
9
|
-
import { CardContentEx } from './CardContentEx.tsx'
|
|
10
|
-
import { PageCard } from './PageCard.tsx'
|
|
11
|
-
|
|
12
|
-
const ScrollableDecorator: Decorator = (Story, args) => {
|
|
13
|
-
const [scrollToTop, setScrollToTop] = useState(0)
|
|
14
|
-
const ref = useRef<HTMLDivElement | null>(null)
|
|
15
|
-
|
|
16
|
-
args.args.ref = ref
|
|
17
|
-
args.args.scrollToTop = scrollToTop
|
|
18
|
-
|
|
19
|
-
const onScrollToTop = () => {
|
|
20
|
-
setScrollToTop(scrollToTop + 1)
|
|
21
|
-
}
|
|
22
|
-
return (
|
|
23
|
-
<FlexGrowCol alignItems="stretch" position="absolute" height="calc(100vh - 2rem)" style={{ inset: 0 }}>
|
|
24
|
-
<Button variant="contained" onClick={onScrollToTop} sx={{ marginBottom: 2 }}>
|
|
25
|
-
ScrollToTop
|
|
26
|
-
</Button>
|
|
27
|
-
<Story {...args} />
|
|
28
|
-
</FlexGrowCol>
|
|
29
|
-
)
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
const StorybookEntry: Meta = {
|
|
33
|
-
argTypes: {},
|
|
34
|
-
component: CardContentEx,
|
|
35
|
-
parameters: { docs: { page: null } },
|
|
36
|
-
title: 'shared/CardContentEx',
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
const Template: StoryFn<typeof CardContentEx> = (props) => {
|
|
40
|
-
return (
|
|
41
|
-
<PageCard title="Page Card" subheader="subheader">
|
|
42
|
-
<CardContentEx {...props}>
|
|
43
|
-
{[...Array(100).keys()].map(item => (
|
|
44
|
-
<Typography key={item}>
|
|
45
|
-
{item}
|
|
46
|
-
. - Item row
|
|
47
|
-
</Typography>
|
|
48
|
-
))}
|
|
49
|
-
</CardContentEx>
|
|
50
|
-
</PageCard>
|
|
51
|
-
)
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
const Default = Template.bind({})
|
|
55
|
-
Default.args = {}
|
|
56
|
-
|
|
57
|
-
const WithRef = Template.bind({})
|
|
58
|
-
WithRef.decorators = [WithRefDecorator]
|
|
59
|
-
|
|
60
|
-
const WithVariant = Template.bind({})
|
|
61
|
-
WithVariant.args = { variant: 'scrollable' }
|
|
62
|
-
WithVariant.decorators = [ScrollableDecorator]
|
|
63
|
-
|
|
64
|
-
export {
|
|
65
|
-
Default, WithRef, WithVariant,
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
export default StorybookEntry
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import type { CardContentProps } from '@mui/material'
|
|
2
|
-
import { CardContent, styled } from '@mui/material'
|
|
3
|
-
import { useShareForwardedRef } from '@xyo-network/react-shared'
|
|
4
|
-
import React, { useEffect } from 'react'
|
|
5
|
-
|
|
6
|
-
const CardContentExRoot = styled(CardContent, {
|
|
7
|
-
name: 'CardContentEx',
|
|
8
|
-
shouldForwardProp: (prop: string) => !['variant', 'removePadding'].includes(prop),
|
|
9
|
-
slot: 'Root',
|
|
10
|
-
})<CardContentExProps>(({ variant, removePadding }) => ({
|
|
11
|
-
...((variant === 'scrollable' || removePadding) && {
|
|
12
|
-
[':last-child']: { paddingBottom: 0 },
|
|
13
|
-
overflow: 'auto',
|
|
14
|
-
paddingTop: 0,
|
|
15
|
-
...(removePadding && { padding: 0 }),
|
|
16
|
-
}),
|
|
17
|
-
}))
|
|
18
|
-
|
|
19
|
-
export type CardContentExProps = CardContentProps & {
|
|
20
|
-
refreshRef?: number
|
|
21
|
-
removePadding?: boolean
|
|
22
|
-
scrollToTop?: number
|
|
23
|
-
variant?: 'scrollable' | 'normal'
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export const CardContentExWithRef = ({
|
|
27
|
-
ref, scrollToTop = 0, refreshRef = 0, ...props
|
|
28
|
-
}: CardContentExProps & { ref?: React.RefObject<HTMLDivElement | null> }) => {
|
|
29
|
-
const sharedRef = useShareForwardedRef<HTMLDivElement>(ref, refreshRef)
|
|
30
|
-
|
|
31
|
-
useEffect(() => {
|
|
32
|
-
if (sharedRef && scrollToTop) {
|
|
33
|
-
sharedRef.current?.scroll({ behavior: 'smooth', top: 0 })
|
|
34
|
-
}
|
|
35
|
-
}, [sharedRef, scrollToTop])
|
|
36
|
-
|
|
37
|
-
return <CardContentExRoot ref={sharedRef} {...props} />
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
CardContentExWithRef.displayName = 'CardContentEx'
|
|
41
|
-
|
|
42
|
-
export const CardContentEx = CardContentExWithRef
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import type { CardProps } from '@mui/material'
|
|
2
|
-
import { Card } from '@mui/material'
|
|
3
|
-
import { useGradientStyles } from '@xyo-network/react-shared'
|
|
4
|
-
import React from 'react'
|
|
5
|
-
|
|
6
|
-
export interface CardExProps extends CardProps {
|
|
7
|
-
gradient?: 'border' | 'background'
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export const CardExWithRef = ({
|
|
11
|
-
ref, style, gradient, ...props
|
|
12
|
-
}: CardExProps) => {
|
|
13
|
-
const styles = useGradientStyles()
|
|
14
|
-
const gradientStyle
|
|
15
|
-
= gradient === 'border'
|
|
16
|
-
? styles.border
|
|
17
|
-
: gradient === 'background'
|
|
18
|
-
? styles.background
|
|
19
|
-
: {}
|
|
20
|
-
return (
|
|
21
|
-
<Card
|
|
22
|
-
style={{
|
|
23
|
-
...gradientStyle,
|
|
24
|
-
...style,
|
|
25
|
-
}}
|
|
26
|
-
ref={ref}
|
|
27
|
-
{...props}
|
|
28
|
-
/>
|
|
29
|
-
)
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
CardExWithRef.displayName = 'CardEx'
|
|
33
|
-
|
|
34
|
-
export const CardEx = CardExWithRef
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @stylistic/max-len */
|
|
2
|
-
import type { Meta, StoryFn } from '@storybook/react-vite'
|
|
3
|
-
import React from 'react'
|
|
4
|
-
import { BrowserRouter } from 'react-router-dom'
|
|
5
|
-
|
|
6
|
-
import { FullWidthCard } from './FullWidthCard.tsx'
|
|
7
|
-
const StorybookEntry = {
|
|
8
|
-
argTypes: {},
|
|
9
|
-
component: FullWidthCard,
|
|
10
|
-
parameters: { docs: { page: null } },
|
|
11
|
-
title: 'shared/FullWidthCard',
|
|
12
|
-
} as Meta<typeof FullWidthCard>
|
|
13
|
-
|
|
14
|
-
const Template: StoryFn<typeof FullWidthCard> = args => (
|
|
15
|
-
<BrowserRouter>
|
|
16
|
-
<FullWidthCard {...args}></FullWidthCard>
|
|
17
|
-
</BrowserRouter>
|
|
18
|
-
)
|
|
19
|
-
|
|
20
|
-
const Default = Template.bind({})
|
|
21
|
-
Default.args = {
|
|
22
|
-
cardIsButton: true,
|
|
23
|
-
desc: 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Repellat delectus nemo optio quis! Totam magni laboriosam repudiandae nam nobis at quisquam aut omnis, quis officiis similique enim id dolorem unde!',
|
|
24
|
-
name: 'Big Title Here',
|
|
25
|
-
|
|
26
|
-
to: '/link',
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export { Default }
|
|
30
|
-
|
|
31
|
-
export default StorybookEntry
|
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
import { ArrowForwardRounded as ArrowForwardRoundedIcon } from '@mui/icons-material'
|
|
2
|
-
import type { CardProps } from '@mui/material'
|
|
3
|
-
import {
|
|
4
|
-
Card, CardActions, CardContent, CardMedia, Grid, IconButton, Typography, useTheme, Zoom,
|
|
5
|
-
} from '@mui/material'
|
|
6
|
-
import { FlexGrowCol } from '@xylabs/react-flexbox'
|
|
7
|
-
import { alphaCss, useIsSmall } from '@xylabs/react-theme'
|
|
8
|
-
import type { ReactNode } from 'react'
|
|
9
|
-
import React, { useState } from 'react'
|
|
10
|
-
import type { To } from 'react-router-dom'
|
|
11
|
-
import { useNavigate } from 'react-router-dom'
|
|
12
|
-
|
|
13
|
-
export interface FullWidthCardProps extends CardProps {
|
|
14
|
-
cardIsButton?: boolean
|
|
15
|
-
desc?: ReactNode
|
|
16
|
-
href?: string
|
|
17
|
-
linkText?: string
|
|
18
|
-
media?: string
|
|
19
|
-
name: ReactNode
|
|
20
|
-
small?: boolean
|
|
21
|
-
to?: To
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export const FullWidthCard: React.FC<FullWidthCardProps> = ({
|
|
25
|
-
cardIsButton, desc, href, media, name, small, to, ...props
|
|
26
|
-
}) => {
|
|
27
|
-
const theme = useTheme()
|
|
28
|
-
const [raised, setRaised] = useState(false)
|
|
29
|
-
const navigate = useNavigate()
|
|
30
|
-
const isMobile = useIsSmall()
|
|
31
|
-
|
|
32
|
-
const localRouteChange = (to: To | undefined) => {
|
|
33
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
|
|
34
|
-
to ? void navigate(to) : void navigate('/404')
|
|
35
|
-
}
|
|
36
|
-
const externalRouteChange = (href: string | undefined) => {
|
|
37
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
|
|
38
|
-
href ? void window.open(href) : void navigate('/404')
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
return (
|
|
42
|
-
<Card
|
|
43
|
-
elevation={raised ? 3 : 0}
|
|
44
|
-
style={{ height: '100%', width: '100%' }}
|
|
45
|
-
{...props}
|
|
46
|
-
sx={{
|
|
47
|
-
'&:hover': { cursor: 'pointer' },
|
|
48
|
-
'backgroundColor': alphaCss(theme.vars.palette.primary.light, 0.05),
|
|
49
|
-
}}
|
|
50
|
-
onMouseEnter={() =>
|
|
51
|
-
isMobile
|
|
52
|
-
? null
|
|
53
|
-
: cardIsButton
|
|
54
|
-
? setRaised(true)
|
|
55
|
-
: null}
|
|
56
|
-
onMouseLeave={() =>
|
|
57
|
-
isMobile
|
|
58
|
-
? null
|
|
59
|
-
: cardIsButton
|
|
60
|
-
? setRaised(false)
|
|
61
|
-
: null}
|
|
62
|
-
onClick={() =>
|
|
63
|
-
cardIsButton
|
|
64
|
-
? href
|
|
65
|
-
? externalRouteChange(href)
|
|
66
|
-
: to
|
|
67
|
-
? localRouteChange(to)
|
|
68
|
-
: navigate('/404')
|
|
69
|
-
: null}
|
|
70
|
-
>
|
|
71
|
-
{media
|
|
72
|
-
? <CardMedia component="img" height="100" image={media} alt="" />
|
|
73
|
-
: null}
|
|
74
|
-
|
|
75
|
-
<CardContent>
|
|
76
|
-
<Grid container alignItems="center" paddingY={2} paddingX={2}>
|
|
77
|
-
<Grid size={{ xs: 12, md: 6 }}>
|
|
78
|
-
{typeof name === 'string'
|
|
79
|
-
? (
|
|
80
|
-
<Typography fontWeight={700} variant="h2" textAlign="left" paddingBottom={1}>
|
|
81
|
-
{name}
|
|
82
|
-
</Typography>
|
|
83
|
-
)
|
|
84
|
-
: name}
|
|
85
|
-
</Grid>
|
|
86
|
-
<Grid size={{ xs: 12, md: 5 }}>
|
|
87
|
-
<Typography variant="body1" fontWeight={400} textAlign="left">
|
|
88
|
-
{desc}
|
|
89
|
-
</Typography>
|
|
90
|
-
</Grid>
|
|
91
|
-
<Grid size={{ xs: 1 }} display={isMobile ? 'none' : 'flex'} justifyContent="center">
|
|
92
|
-
<Zoom in={raised}>
|
|
93
|
-
<IconButton
|
|
94
|
-
color="primary"
|
|
95
|
-
size={small ? 'small' : 'medium'}
|
|
96
|
-
onClick={() =>
|
|
97
|
-
href
|
|
98
|
-
? externalRouteChange(href)
|
|
99
|
-
: to
|
|
100
|
-
? localRouteChange(to)
|
|
101
|
-
: navigate('/404')}
|
|
102
|
-
disableFocusRipple
|
|
103
|
-
disableRipple
|
|
104
|
-
disableTouchRipple
|
|
105
|
-
>
|
|
106
|
-
<ArrowForwardRoundedIcon fontSize={small ? 'small' : 'medium'} />
|
|
107
|
-
</IconButton>
|
|
108
|
-
</Zoom>
|
|
109
|
-
</Grid>
|
|
110
|
-
</Grid>
|
|
111
|
-
</CardContent>
|
|
112
|
-
<CardActions sx={{ display: { md: isMobile ? 'flex' : 'none' } }}>
|
|
113
|
-
<FlexGrowCol alignItems="flex-end">
|
|
114
|
-
<IconButton
|
|
115
|
-
color="primary"
|
|
116
|
-
size={small ? 'small' : 'medium'}
|
|
117
|
-
onClick={() =>
|
|
118
|
-
href
|
|
119
|
-
? externalRouteChange(href)
|
|
120
|
-
: to
|
|
121
|
-
? localRouteChange(to)
|
|
122
|
-
: navigate('/404')}
|
|
123
|
-
disableFocusRipple
|
|
124
|
-
disableRipple
|
|
125
|
-
disableTouchRipple
|
|
126
|
-
>
|
|
127
|
-
<ArrowForwardRoundedIcon fontSize={small ? 'small' : 'medium'} />
|
|
128
|
-
</IconButton>
|
|
129
|
-
</FlexGrowCol>
|
|
130
|
-
</CardActions>
|
|
131
|
-
</Card>
|
|
132
|
-
)
|
|
133
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './FullWidthCard.tsx'
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { CardContent, Typography } from '@mui/material'
|
|
2
|
-
import type { Meta, StoryFn } from '@storybook/react-vite'
|
|
3
|
-
import { WithRefDecorator } from '@xyo-network/react-storybook'
|
|
4
|
-
import React, { useState } from 'react'
|
|
5
|
-
|
|
6
|
-
import { PageCard } from './PageCard.tsx'
|
|
7
|
-
|
|
8
|
-
const StorybookEntry: Meta = {
|
|
9
|
-
argTypes: { onRefresh: { table: { disable: true } } },
|
|
10
|
-
component: PageCard,
|
|
11
|
-
parameters: { docs: { page: null } },
|
|
12
|
-
title: 'shared/PageCard',
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
const Template: StoryFn<typeof PageCard> = (props) => {
|
|
16
|
-
const [refreshedValue, setRefreshedValue] = useState<number>(Math.random)
|
|
17
|
-
return (
|
|
18
|
-
<PageCard title="Page Card" subheader="subheader" onRefresh={() => setRefreshedValue(Math.random())} {...props}>
|
|
19
|
-
<CardContent>
|
|
20
|
-
<Typography variant="body1">Page Card Content</Typography>
|
|
21
|
-
<Typography variant="body1">
|
|
22
|
-
Refreshed Value:
|
|
23
|
-
{refreshedValue?.toString()}
|
|
24
|
-
</Typography>
|
|
25
|
-
</CardContent>
|
|
26
|
-
</PageCard>
|
|
27
|
-
)
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
const TemplateWithNoOnRefresh: StoryFn<typeof PageCard> = (props) => {
|
|
31
|
-
return (
|
|
32
|
-
<PageCard title="Page Card" subheader="subheader" {...props}>
|
|
33
|
-
<CardContent>
|
|
34
|
-
<Typography variant="body1">Page Card Content</Typography>
|
|
35
|
-
</CardContent>
|
|
36
|
-
</PageCard>
|
|
37
|
-
)
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
const Default = Template.bind({})
|
|
41
|
-
Default.args = {}
|
|
42
|
-
Default.parameters = { actions: { argTypesRegex: '' } }
|
|
43
|
-
|
|
44
|
-
const WithNoOnRefresh = TemplateWithNoOnRefresh.bind({})
|
|
45
|
-
WithNoOnRefresh.args = {}
|
|
46
|
-
WithNoOnRefresh.parameters = { actions: { argTypesRegex: '' } }
|
|
47
|
-
|
|
48
|
-
const WithRef = Template.bind({})
|
|
49
|
-
WithRef.decorators = [WithRefDecorator]
|
|
50
|
-
|
|
51
|
-
export {
|
|
52
|
-
Default, WithNoOnRefresh, WithRef,
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export default StorybookEntry
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { Refresh as RefreshIcon } from '@mui/icons-material'
|
|
2
|
-
import type { CardHeaderProps } from '@mui/material'
|
|
3
|
-
import { CardHeader, IconButton } from '@mui/material'
|
|
4
|
-
import { TypographyEx } from '@xyo-network/react-shared'
|
|
5
|
-
import type { ReactNode } from 'react'
|
|
6
|
-
import React from 'react'
|
|
7
|
-
|
|
8
|
-
import type { CardExProps } from './CardEx.tsx'
|
|
9
|
-
import { CardEx } from './CardEx.tsx'
|
|
10
|
-
|
|
11
|
-
export interface PageCardProps extends CardExProps {
|
|
12
|
-
action?: ReactNode
|
|
13
|
-
onRefresh?: () => void
|
|
14
|
-
subheader?: CardHeaderProps['subheader']
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const PageCardWithRef = ({
|
|
18
|
-
ref, subheader, title, onRefresh, children, action, style, ...props
|
|
19
|
-
}: PageCardProps) => {
|
|
20
|
-
return (
|
|
21
|
-
<CardEx
|
|
22
|
-
style={{
|
|
23
|
-
backgroundColor: 'transparent', position: 'relative', ...style,
|
|
24
|
-
}}
|
|
25
|
-
elevation={0}
|
|
26
|
-
ref={ref}
|
|
27
|
-
{...props}
|
|
28
|
-
>
|
|
29
|
-
<CardHeader
|
|
30
|
-
title={(
|
|
31
|
-
<TypographyEx variant="h5" gutterBottom>
|
|
32
|
-
{title}
|
|
33
|
-
</TypographyEx>
|
|
34
|
-
)}
|
|
35
|
-
subheader={<TypographyEx variant="subtitle1">{subheader}</TypographyEx>}
|
|
36
|
-
action={
|
|
37
|
-
action ?? (
|
|
38
|
-
<>
|
|
39
|
-
{onRefresh
|
|
40
|
-
? (
|
|
41
|
-
<IconButton onClick={() => onRefresh?.()}>
|
|
42
|
-
<RefreshIcon />
|
|
43
|
-
</IconButton>
|
|
44
|
-
)
|
|
45
|
-
: null}
|
|
46
|
-
</>
|
|
47
|
-
)
|
|
48
|
-
}
|
|
49
|
-
/>
|
|
50
|
-
{children}
|
|
51
|
-
</CardEx>
|
|
52
|
-
)
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
PageCardWithRef.displayName = 'PageCard'
|
|
56
|
-
|
|
57
|
-
export const PageCard = PageCardWithRef
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @stylistic/max-len */
|
|
2
|
-
import { Grid } from '@mui/material'
|
|
3
|
-
import type { Meta, StoryFn } from '@storybook/react-vite'
|
|
4
|
-
import React from 'react'
|
|
5
|
-
import { BrowserRouter } from 'react-router-dom'
|
|
6
|
-
|
|
7
|
-
import CoinbaseWalletIcon from './coinbase-wallet.svg'
|
|
8
|
-
import MoneyMedia from './money.jpg'
|
|
9
|
-
import { SimpleCard } from './SimpleCard.tsx'
|
|
10
|
-
const StorybookEntry = {
|
|
11
|
-
argTypes: {},
|
|
12
|
-
component: SimpleCard,
|
|
13
|
-
parameters: { docs: { page: null } },
|
|
14
|
-
title: 'shared/SimpleCard',
|
|
15
|
-
} as Meta<typeof SimpleCard>
|
|
16
|
-
|
|
17
|
-
const Template: StoryFn<typeof SimpleCard> = args => (
|
|
18
|
-
<BrowserRouter>
|
|
19
|
-
<Grid container spacing={2}>
|
|
20
|
-
<Grid size={{
|
|
21
|
-
xs: 12, sm: 6, md: 3,
|
|
22
|
-
}}
|
|
23
|
-
>
|
|
24
|
-
<SimpleCard {...args}></SimpleCard>
|
|
25
|
-
</Grid>
|
|
26
|
-
<Grid size={{
|
|
27
|
-
xs: 12, sm: 6, md: 3,
|
|
28
|
-
}}
|
|
29
|
-
>
|
|
30
|
-
<SimpleCard {...args}></SimpleCard>
|
|
31
|
-
</Grid>
|
|
32
|
-
<Grid size={{
|
|
33
|
-
xs: 12, sm: 6, md: 3,
|
|
34
|
-
}}
|
|
35
|
-
>
|
|
36
|
-
<SimpleCard {...args}></SimpleCard>
|
|
37
|
-
</Grid>
|
|
38
|
-
<Grid size={{
|
|
39
|
-
xs: 12, sm: 6, md: 3,
|
|
40
|
-
}}
|
|
41
|
-
>
|
|
42
|
-
<SimpleCard {...args}></SimpleCard>
|
|
43
|
-
</Grid>
|
|
44
|
-
</Grid>
|
|
45
|
-
</BrowserRouter>
|
|
46
|
-
)
|
|
47
|
-
|
|
48
|
-
const Default = Template.bind({})
|
|
49
|
-
Default.args = {
|
|
50
|
-
desc: 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Repellat delectus nemo optio quis! Totam magni laboriosam repudiandae nam nobis at quisquam aut omnis, quis officiis similique enim id dolorem unde!',
|
|
51
|
-
headline: 'Headline Lorem Ipsum',
|
|
52
|
-
subtitle: 'Aug 25, 1997',
|
|
53
|
-
}
|
|
54
|
-
const DefaultWithImage = Template.bind({})
|
|
55
|
-
DefaultWithImage.args = {
|
|
56
|
-
desc: 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Repellat delectus nemo optio quis! Totam magni laboriosam repudiandae nam nobis at quisquam aut omnis, quis officiis similique enim id dolorem unde!',
|
|
57
|
-
headline: 'Headline Lorem Ipsum',
|
|
58
|
-
iconImage: CoinbaseWalletIcon,
|
|
59
|
-
subtitle: 'Aug 25, 1997',
|
|
60
|
-
}
|
|
61
|
-
const VariantButton = Template.bind({})
|
|
62
|
-
VariantButton.args = {
|
|
63
|
-
desc: 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Repellat delectus nemo optio quis! Totam magni laboriosam repudiandae nam nobis at quisquam aut omnis, quis officiis similique enim id dolorem unde!',
|
|
64
|
-
headline: 'Headline Lorem Ipsum',
|
|
65
|
-
interactionVariant: 'button',
|
|
66
|
-
subtitle: 'Aug 25, 1997',
|
|
67
|
-
}
|
|
68
|
-
const DefaultSmallCard = Template.bind({})
|
|
69
|
-
DefaultSmallCard.args = {
|
|
70
|
-
desc: 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Repellat delectus nemo optio quis!',
|
|
71
|
-
headline: 'Headline Lorem Ipsum',
|
|
72
|
-
small: true,
|
|
73
|
-
subtitle: 'Aug 25, 1997',
|
|
74
|
-
}
|
|
75
|
-
const DefaultMediaCard = Template.bind({})
|
|
76
|
-
DefaultMediaCard.args = {
|
|
77
|
-
desc: 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Repellat delectus nemo optio quis! Totam magni laboriosam repudiandae nam nobis at quisquam aut omnis, quis officiis similique enim id dolorem unde!',
|
|
78
|
-
headline: 'Headline Lorem Ipsum',
|
|
79
|
-
media: MoneyMedia,
|
|
80
|
-
subtitle: 'Aug 25, 1997',
|
|
81
|
-
}
|
|
82
|
-
const CardWithAllParameters = Template.bind({})
|
|
83
|
-
CardWithAllParameters.args = {
|
|
84
|
-
desc: 'Many people believe that a card cannot be a button. But here at XYO, we say "No way, José" and turn our cards into buttons.',
|
|
85
|
-
headline: 'Did you know that this card is complex?',
|
|
86
|
-
iconImage: CoinbaseWalletIcon,
|
|
87
|
-
interactionVariant: 'button',
|
|
88
|
-
media: MoneyMedia,
|
|
89
|
-
subtitle: 'Aug 25, 1997',
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
93
|
-
// @ts-ignore
|
|
94
|
-
|
|
95
|
-
export {
|
|
96
|
-
CardWithAllParameters, Default, DefaultMediaCard, DefaultSmallCard, DefaultWithImage, VariantButton,
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
export default StorybookEntry
|