@xyo-network/react-card 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.
- 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
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
import { ArrowForwardRounded as ArrowForwardRoundedIcon } from '@mui/icons-material'
|
|
2
|
-
import {
|
|
3
|
-
CardActions, CardContent, CardMedia, IconButton, Typography, useTheme,
|
|
4
|
-
} from '@mui/material'
|
|
5
|
-
import { FlexCol, FlexGrowCol } from '@xylabs/react-flexbox'
|
|
6
|
-
import { alphaCss, useIsSmall } from '@xylabs/react-theme'
|
|
7
|
-
import type { ReactNode } from 'react'
|
|
8
|
-
import React, { useState } from 'react'
|
|
9
|
-
import type { To } from 'react-router-dom'
|
|
10
|
-
import { useNavigate } from 'react-router-dom'
|
|
11
|
-
|
|
12
|
-
import type { CardExProps } from '../CardEx.tsx'
|
|
13
|
-
import { CardEx } from '../CardEx.tsx'
|
|
14
|
-
|
|
15
|
-
export interface SimpleCardProps extends CardExProps {
|
|
16
|
-
desc?: ReactNode
|
|
17
|
-
headline?: ReactNode
|
|
18
|
-
href?: string
|
|
19
|
-
iconImage?: string
|
|
20
|
-
interactionVariant?: 'button' | 'card'
|
|
21
|
-
media?: string
|
|
22
|
-
small?: boolean
|
|
23
|
-
subtitle?: string
|
|
24
|
-
to?: To
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export const SimpleCard: React.FC<SimpleCardProps> = ({
|
|
28
|
-
children,
|
|
29
|
-
desc,
|
|
30
|
-
iconImage,
|
|
31
|
-
interactionVariant = 'card',
|
|
32
|
-
headline,
|
|
33
|
-
href,
|
|
34
|
-
media,
|
|
35
|
-
small,
|
|
36
|
-
subtitle,
|
|
37
|
-
sx,
|
|
38
|
-
to,
|
|
39
|
-
...props
|
|
40
|
-
}) => {
|
|
41
|
-
const theme = useTheme()
|
|
42
|
-
const [raised, setRaised] = useState(false)
|
|
43
|
-
const navigate = useNavigate()
|
|
44
|
-
const isSmall = useIsSmall()
|
|
45
|
-
const localRouteChange = (to: To | undefined) => {
|
|
46
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
|
|
47
|
-
to ? void navigate(to) : void navigate('/404')
|
|
48
|
-
}
|
|
49
|
-
const externalRouteChange = (href: string | undefined) => {
|
|
50
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
|
|
51
|
-
href ? void window.open(href) : void navigate('/404')
|
|
52
|
-
}
|
|
53
|
-
return (
|
|
54
|
-
<CardEx
|
|
55
|
-
elevation={raised ? 3 : 0}
|
|
56
|
-
sx={{
|
|
57
|
-
'&:hover': { cursor: interactionVariant == 'button' ? 'pointer' : null },
|
|
58
|
-
'backgroundColor': alphaCss(theme.vars.palette.primary.main, 0.05),
|
|
59
|
-
...sx,
|
|
60
|
-
}}
|
|
61
|
-
onMouseEnter={() =>
|
|
62
|
-
isSmall
|
|
63
|
-
? null
|
|
64
|
-
: interactionVariant == 'button'
|
|
65
|
-
? setRaised(true)
|
|
66
|
-
: null}
|
|
67
|
-
onMouseLeave={() =>
|
|
68
|
-
isSmall
|
|
69
|
-
? null
|
|
70
|
-
: interactionVariant == 'button'
|
|
71
|
-
? setRaised(false)
|
|
72
|
-
: null}
|
|
73
|
-
onClick={() =>
|
|
74
|
-
interactionVariant == 'button'
|
|
75
|
-
? href
|
|
76
|
-
? externalRouteChange(href)
|
|
77
|
-
: to
|
|
78
|
-
? localRouteChange(to)
|
|
79
|
-
: navigate('/404')
|
|
80
|
-
: null}
|
|
81
|
-
{...props}
|
|
82
|
-
>
|
|
83
|
-
{media
|
|
84
|
-
? <CardMedia component="img" height="100" image={media} alt="" />
|
|
85
|
-
: null}
|
|
86
|
-
|
|
87
|
-
<CardContent sx={{ height: '100%' }}>
|
|
88
|
-
<FlexCol width="100%" alignItems="flex-start">
|
|
89
|
-
{iconImage
|
|
90
|
-
? <img src={iconImage} height="40px" style={{ paddingBottom: '8px' }} />
|
|
91
|
-
: null}
|
|
92
|
-
{typeof headline === 'string'
|
|
93
|
-
? (
|
|
94
|
-
<Typography variant={small ? 'body1' : 'h6'} textAlign="left" gutterBottom>
|
|
95
|
-
{headline}
|
|
96
|
-
</Typography>
|
|
97
|
-
)
|
|
98
|
-
: headline}
|
|
99
|
-
{subtitle
|
|
100
|
-
? (
|
|
101
|
-
<Typography variant="subtitle2" textAlign="left" gutterBottom>
|
|
102
|
-
{subtitle}
|
|
103
|
-
</Typography>
|
|
104
|
-
)
|
|
105
|
-
: null}
|
|
106
|
-
<Typography variant={small ? 'caption' : 'body1'} textAlign="left" gutterBottom>
|
|
107
|
-
{desc}
|
|
108
|
-
</Typography>
|
|
109
|
-
</FlexCol>
|
|
110
|
-
</CardContent>
|
|
111
|
-
{children}
|
|
112
|
-
{interactionVariant == 'button'
|
|
113
|
-
? (
|
|
114
|
-
<CardActions>
|
|
115
|
-
<FlexGrowCol alignItems="flex-end">
|
|
116
|
-
<IconButton
|
|
117
|
-
color={raised ? 'secondary' : 'primary'}
|
|
118
|
-
size={small ? 'small' : 'medium'}
|
|
119
|
-
onClick={() =>
|
|
120
|
-
href
|
|
121
|
-
? externalRouteChange(href)
|
|
122
|
-
: to
|
|
123
|
-
? localRouteChange(to)
|
|
124
|
-
: navigate('/404')}
|
|
125
|
-
disableFocusRipple
|
|
126
|
-
disableRipple
|
|
127
|
-
disableTouchRipple
|
|
128
|
-
>
|
|
129
|
-
<ArrowForwardRoundedIcon fontSize={small ? 'small' : 'medium'} />
|
|
130
|
-
</IconButton>
|
|
131
|
-
</FlexGrowCol>
|
|
132
|
-
</CardActions>
|
|
133
|
-
)
|
|
134
|
-
: null}
|
|
135
|
-
</CardEx>
|
|
136
|
-
)
|
|
137
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><style>.cls-1{fill:#005cfe;}.cls-2{fill:#fdfdfe;}</style></defs><g id="Layer_6" data-name="Layer 6"><g id="JuvZVa"><path class="cls-1" d="M0,50C0,40.77-.1,31.58.07,22.4.22,14.9,3,8.55,9.32,4.09A22.35,22.35,0,0,1,20.3.25,56.53,56.53,0,0,1,26.12,0C42.74,0,59.37,0,76,0c5.17,0,10.15.92,14.5,4A21.42,21.42,0,0,1,99.75,20.1,55.89,55.89,0,0,1,100,26c0,17.13.11,34.26-.08,51.38-.1,8.93-3.88,16-12.11,20.15A25.49,25.49,0,0,1,76.15,100Q50,100,23.83,100c-5.37,0-10.52-1.06-14.95-4.39A21.57,21.57,0,0,1,.21,79.72,59,59,0,0,1,0,73.78Q0,61.87,0,50Zm50-35a35.07,35.07,0,1,0,35,35.13A35,35,0,0,0,50,14.92Z"/><path class="cls-2" d="M50,14.92a35.07,35.07,0,1,1-35.11,35A35,35,0,0,1,50,14.92ZM38.7,50c0,2.92,0,5.83,0,8.75a2.26,2.26,0,0,0,2.52,2.53q8.74,0,17.5,0c1.73,0,2.56-.85,2.56-2.6q0-8.68,0-17.38a2.27,2.27,0,0,0-2.57-2.59q-8.7,0-17.39,0c-1.8,0-2.61.84-2.62,2.66C38.69,44.25,38.7,47.12,38.7,50Z"/><path class="cls-1" d="M38.7,50c0-2.88,0-5.75,0-8.63,0-1.82.82-2.66,2.62-2.66q8.7,0,17.39,0a2.27,2.27,0,0,1,2.57,2.59q0,8.69,0,17.38c0,1.75-.83,2.6-2.56,2.6q-8.76,0-17.5,0a2.26,2.26,0,0,1-2.52-2.53C38.68,55.83,38.7,52.92,38.7,50Z"/></g></g></svg>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './SimpleCard.tsx'
|
|
Binary file
|
|
@@ -1,74 +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 CoinbaseWalletIcon from './coinbase-wallet.svg'
|
|
7
|
-
import MoneyMedia from './money.jpg'
|
|
8
|
-
import { SimpleCardGrid } from './SimpleCardGrid.tsx'
|
|
9
|
-
const StorybookEntry = {
|
|
10
|
-
argTypes: {},
|
|
11
|
-
component: SimpleCardGrid,
|
|
12
|
-
parameters: { docs: { page: null } },
|
|
13
|
-
title: 'shared/SimpleCardGrid',
|
|
14
|
-
} as Meta<typeof SimpleCardGrid>
|
|
15
|
-
|
|
16
|
-
const Template: StoryFn<typeof SimpleCardGrid> = args => (
|
|
17
|
-
<BrowserRouter>
|
|
18
|
-
<SimpleCardGrid {...args}></SimpleCardGrid>
|
|
19
|
-
</BrowserRouter>
|
|
20
|
-
)
|
|
21
|
-
|
|
22
|
-
const Default = Template.bind({})
|
|
23
|
-
Default.args = {
|
|
24
|
-
cards: [
|
|
25
|
-
{
|
|
26
|
-
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.',
|
|
27
|
-
headline: 'Did you know that this card is complex?',
|
|
28
|
-
iconImage: CoinbaseWalletIcon,
|
|
29
|
-
interactionVariant: 'button',
|
|
30
|
-
media: MoneyMedia,
|
|
31
|
-
subtitle: 'Aug 25, 1997',
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
desc: 'Lorem ipsum dolor sit amet consectetur adipisicing elit. Sapiente incidunt, beatae suscipit nam consequuntur, minus facere obcaecati, recusandae totam aspernatur aut debitis. Aspernatur nisi molestiae atque? Nisi eius perspiciatis tempore?',
|
|
35
|
-
headline: 'Did you know that this card is complex?',
|
|
36
|
-
iconImage: CoinbaseWalletIcon,
|
|
37
|
-
interactionVariant: 'button',
|
|
38
|
-
media: MoneyMedia,
|
|
39
|
-
subtitle: 'Aug 25, 1997',
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
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.Lorem ipsum dolor sit amet consectetur adipisicing elit.',
|
|
43
|
-
headline: 'Did you know that this card is complex?',
|
|
44
|
-
iconImage: CoinbaseWalletIcon,
|
|
45
|
-
interactionVariant: 'button',
|
|
46
|
-
media: MoneyMedia,
|
|
47
|
-
subtitle: 'Aug 25, 1997',
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
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. Sapiente incidunt, beatae suscipit nam consequuntur, minus facere obcaecati, recusandae totam aspernatur aut debitis. Aspernatur nisi molestiae atque? Nisi eius perspiciatis tempore?',
|
|
51
|
-
headline: 'Did you know that this card is complex?',
|
|
52
|
-
iconImage: CoinbaseWalletIcon,
|
|
53
|
-
interactionVariant: 'button',
|
|
54
|
-
media: MoneyMedia,
|
|
55
|
-
subtitle: 'Aug 25, 1997',
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
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.',
|
|
59
|
-
headline: 'Did you know that this card is complex?',
|
|
60
|
-
iconImage: CoinbaseWalletIcon,
|
|
61
|
-
interactionVariant: 'button',
|
|
62
|
-
media: MoneyMedia,
|
|
63
|
-
subtitle: 'Aug 25, 1997',
|
|
64
|
-
},
|
|
65
|
-
],
|
|
66
|
-
spacing: 2,
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
70
|
-
// @ts-ignore
|
|
71
|
-
|
|
72
|
-
export { Default }
|
|
73
|
-
|
|
74
|
-
export default StorybookEntry
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import type { GridProps } from '@mui/material'
|
|
2
|
-
import { Grid } from '@mui/material'
|
|
3
|
-
import React from 'react'
|
|
4
|
-
|
|
5
|
-
import type { SimpleCardProps } from '../SimpleCard/index.ts'
|
|
6
|
-
import { SimpleCard } from '../SimpleCard/index.ts'
|
|
7
|
-
|
|
8
|
-
export interface SimpleCardGridProps extends GridProps {
|
|
9
|
-
cards?: SimpleCardProps[]
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export const SimpleCardGrid: React.FC<SimpleCardGridProps> = ({ cards, ...props }) => {
|
|
13
|
-
return (
|
|
14
|
-
<Grid container {...props}>
|
|
15
|
-
{cards?.map((card, index) => (
|
|
16
|
-
<Grid
|
|
17
|
-
key={index}
|
|
18
|
-
size={{
|
|
19
|
-
xs: 12, sm: 6, md: 4,
|
|
20
|
-
}}
|
|
21
|
-
>
|
|
22
|
-
<SimpleCard
|
|
23
|
-
{...card}
|
|
24
|
-
sx={{ flexDirection: 'column', height: '100%' }}
|
|
25
|
-
/>
|
|
26
|
-
</Grid>
|
|
27
|
-
))}
|
|
28
|
-
</Grid>
|
|
29
|
-
)
|
|
30
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><style>.cls-1{fill:#005cfe;}.cls-2{fill:#fdfdfe;}</style></defs><g id="Layer_6" data-name="Layer 6"><g id="JuvZVa"><path class="cls-1" d="M0,50C0,40.77-.1,31.58.07,22.4.22,14.9,3,8.55,9.32,4.09A22.35,22.35,0,0,1,20.3.25,56.53,56.53,0,0,1,26.12,0C42.74,0,59.37,0,76,0c5.17,0,10.15.92,14.5,4A21.42,21.42,0,0,1,99.75,20.1,55.89,55.89,0,0,1,100,26c0,17.13.11,34.26-.08,51.38-.1,8.93-3.88,16-12.11,20.15A25.49,25.49,0,0,1,76.15,100Q50,100,23.83,100c-5.37,0-10.52-1.06-14.95-4.39A21.57,21.57,0,0,1,.21,79.72,59,59,0,0,1,0,73.78Q0,61.87,0,50Zm50-35a35.07,35.07,0,1,0,35,35.13A35,35,0,0,0,50,14.92Z"/><path class="cls-2" d="M50,14.92a35.07,35.07,0,1,1-35.11,35A35,35,0,0,1,50,14.92ZM38.7,50c0,2.92,0,5.83,0,8.75a2.26,2.26,0,0,0,2.52,2.53q8.74,0,17.5,0c1.73,0,2.56-.85,2.56-2.6q0-8.68,0-17.38a2.27,2.27,0,0,0-2.57-2.59q-8.7,0-17.39,0c-1.8,0-2.61.84-2.62,2.66C38.69,44.25,38.7,47.12,38.7,50Z"/><path class="cls-1" d="M38.7,50c0-2.88,0-5.75,0-8.63,0-1.82.82-2.66,2.62-2.66q8.7,0,17.39,0a2.27,2.27,0,0,1,2.57,2.59q0,8.69,0,17.38c0,1.75-.83,2.6-2.56,2.6q-8.76,0-17.5,0a2.26,2.26,0,0,1-2.52-2.53C38.68,55.83,38.7,52.92,38.7,50Z"/></g></g></svg>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './SimpleCardGrid.tsx'
|
|
Binary file
|
package/src/components/index.ts
DELETED
package/src/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './components/index.ts'
|
package/src/types/global.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import '@mui/material/themeCssVarsAugmentation'
|