@xyo-network/react-shared 2.25.78 → 2.26.2
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.
|
@@ -1,33 +1,37 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Card } from '@mui/material';
|
|
2
|
+
import { Card, useTheme } from '@mui/material';
|
|
3
3
|
import { useGradientStyles } from '../hooks';
|
|
4
4
|
export const CardEx = ({ display = 'flex', flexDirection = 'column', flexGrow, alignItems = 'stretch', alignContent, alignSelf, justifyItems = 'flex-start', justifyContent = 'flex-start', justifySelf, style, gap, rowGap, columnGap, padding, paddingLeft, paddingRight, paddingTop, paddingBottom, margin, marginTop, marginBottom, marginLeft, marginRight, gradient, ...props }) => {
|
|
5
5
|
const { styles } = useGradientStyles();
|
|
6
|
+
const theme = useTheme();
|
|
7
|
+
const applySpacing = (value) => {
|
|
8
|
+
return value === undefined ? value : typeof value === 'string' ? value : theme.spacing(value);
|
|
9
|
+
};
|
|
6
10
|
const gradientStyle = gradient === 'border' ? styles.border : gradient === 'background' ? styles.background : {};
|
|
7
11
|
return (_jsx(Card, { style: {
|
|
8
12
|
...gradientStyle,
|
|
9
13
|
alignContent,
|
|
10
14
|
alignItems,
|
|
11
15
|
alignSelf,
|
|
12
|
-
columnGap,
|
|
16
|
+
columnGap: applySpacing(columnGap),
|
|
13
17
|
display,
|
|
14
18
|
flexDirection,
|
|
15
19
|
flexGrow,
|
|
16
|
-
gap,
|
|
20
|
+
gap: applySpacing(gap),
|
|
17
21
|
justifyContent,
|
|
18
22
|
justifyItems,
|
|
19
23
|
justifySelf,
|
|
20
|
-
margin,
|
|
21
|
-
marginBottom,
|
|
22
|
-
marginLeft,
|
|
23
|
-
marginRight,
|
|
24
|
-
marginTop,
|
|
25
|
-
padding,
|
|
26
|
-
paddingBottom,
|
|
27
|
-
paddingLeft,
|
|
28
|
-
paddingRight,
|
|
29
|
-
paddingTop,
|
|
30
|
-
rowGap,
|
|
24
|
+
margin: applySpacing(margin),
|
|
25
|
+
marginBottom: applySpacing(marginBottom ?? margin),
|
|
26
|
+
marginLeft: applySpacing(marginLeft ?? margin),
|
|
27
|
+
marginRight: applySpacing(marginRight ?? margin),
|
|
28
|
+
marginTop: applySpacing(marginTop ?? margin),
|
|
29
|
+
padding: applySpacing(padding),
|
|
30
|
+
paddingBottom: applySpacing(paddingBottom ?? padding),
|
|
31
|
+
paddingLeft: applySpacing(paddingLeft ?? padding),
|
|
32
|
+
paddingRight: applySpacing(paddingRight ?? padding),
|
|
33
|
+
paddingTop: applySpacing(paddingTop ?? padding),
|
|
34
|
+
rowGap: applySpacing(rowGap),
|
|
31
35
|
...style,
|
|
32
36
|
}, ...props }));
|
|
33
37
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CardEx.js","sourceRoot":"","sources":["../../../src/components/CardEx.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAa,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"CardEx.js","sourceRoot":"","sources":["../../../src/components/CardEx.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAa,QAAQ,EAAE,MAAM,eAAe,CAAA;AAGzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAA;AAO5C,MAAM,CAAC,MAAM,MAAM,GAA0B,CAAC,EAC5C,OAAO,GAAG,MAAM,EAChB,aAAa,GAAG,QAAQ,EACxB,QAAQ,EACR,UAAU,GAAG,SAAS,EACtB,YAAY,EACZ,SAAS,EACT,YAAY,GAAG,YAAY,EAC3B,cAAc,GAAG,YAAY,EAC7B,WAAW,EACX,KAAK,EACL,GAAG,EACH,MAAM,EACN,SAAS,EACT,OAAO,EACP,WAAW,EACX,YAAY,EACZ,UAAU,EACV,aAAa,EACb,MAAM,EACN,SAAS,EACT,YAAY,EACZ,UAAU,EACV,WAAW,EACX,QAAQ,EACR,GAAG,KAAK,EACT,E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AC,YAAY,IAAI,OAAO,CAAC;YACnD,UAAU,EAAE,YAAY,CAAC,UAAU,IAAI,OAAO,CAAC;YAC/C,MAAM,EAAE,YAAY,CAAC,MAAM,CAAC;YAC5B,GAAG,KAAK;SACT,KACG,KAAK,GACT,CACH,CAAA;AACH,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Card, CardProps } from '@mui/material'
|
|
1
|
+
import { Card, CardProps, useTheme } from '@mui/material'
|
|
2
2
|
import { CSSProperties } from 'react'
|
|
3
3
|
|
|
4
4
|
import { useGradientStyles } from '../hooks'
|
|
@@ -36,6 +36,10 @@ export const CardEx: React.FC<CardExProps> = ({
|
|
|
36
36
|
...props
|
|
37
37
|
}) => {
|
|
38
38
|
const { styles } = useGradientStyles()
|
|
39
|
+
const theme = useTheme()
|
|
40
|
+
const applySpacing = (value?: number | string) => {
|
|
41
|
+
return value === undefined ? value : typeof value === 'string' ? value : theme.spacing(value)
|
|
42
|
+
}
|
|
39
43
|
const gradientStyle = gradient === 'border' ? styles.border : gradient === 'background' ? styles.background : {}
|
|
40
44
|
return (
|
|
41
45
|
<Card
|
|
@@ -44,25 +48,25 @@ export const CardEx: React.FC<CardExProps> = ({
|
|
|
44
48
|
alignContent,
|
|
45
49
|
alignItems,
|
|
46
50
|
alignSelf,
|
|
47
|
-
columnGap,
|
|
51
|
+
columnGap: applySpacing(columnGap),
|
|
48
52
|
display,
|
|
49
53
|
flexDirection,
|
|
50
54
|
flexGrow,
|
|
51
|
-
gap,
|
|
55
|
+
gap: applySpacing(gap),
|
|
52
56
|
justifyContent,
|
|
53
57
|
justifyItems,
|
|
54
58
|
justifySelf,
|
|
55
|
-
margin,
|
|
56
|
-
marginBottom,
|
|
57
|
-
marginLeft,
|
|
58
|
-
marginRight,
|
|
59
|
-
marginTop,
|
|
60
|
-
padding,
|
|
61
|
-
paddingBottom,
|
|
62
|
-
paddingLeft,
|
|
63
|
-
paddingRight,
|
|
64
|
-
paddingTop,
|
|
65
|
-
rowGap,
|
|
59
|
+
margin: applySpacing(margin),
|
|
60
|
+
marginBottom: applySpacing(marginBottom ?? margin),
|
|
61
|
+
marginLeft: applySpacing(marginLeft ?? margin),
|
|
62
|
+
marginRight: applySpacing(marginRight ?? margin),
|
|
63
|
+
marginTop: applySpacing(marginTop ?? margin),
|
|
64
|
+
padding: applySpacing(padding),
|
|
65
|
+
paddingBottom: applySpacing(paddingBottom ?? padding),
|
|
66
|
+
paddingLeft: applySpacing(paddingLeft ?? padding),
|
|
67
|
+
paddingRight: applySpacing(paddingRight ?? padding),
|
|
68
|
+
paddingTop: applySpacing(paddingTop ?? padding),
|
|
69
|
+
rowGap: applySpacing(rowGap),
|
|
66
70
|
...style,
|
|
67
71
|
}}
|
|
68
72
|
{...props}
|