@xyo-network/react-card 2.81.9 → 2.82.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/browser/components/CardContentEx.d.cts +3 -2
- package/dist/browser/components/CardContentEx.d.cts.map +1 -1
- package/dist/browser/components/CardContentEx.d.mts +3 -2
- package/dist/browser/components/CardContentEx.d.mts.map +1 -1
- package/dist/browser/components/CardContentEx.d.ts +3 -2
- package/dist/browser/components/CardContentEx.d.ts.map +1 -1
- package/dist/browser/components/CardEx.d.cts +3 -2
- package/dist/browser/components/CardEx.d.cts.map +1 -1
- package/dist/browser/components/CardEx.d.mts +3 -2
- package/dist/browser/components/CardEx.d.mts.map +1 -1
- package/dist/browser/components/CardEx.d.ts +3 -2
- package/dist/browser/components/CardEx.d.ts.map +1 -1
- package/dist/browser/components/FullWidthCard/FullWidthCard.d.cts +1 -1
- package/dist/browser/components/FullWidthCard/FullWidthCard.d.cts.map +1 -1
- package/dist/browser/components/FullWidthCard/FullWidthCard.d.mts +1 -1
- package/dist/browser/components/FullWidthCard/FullWidthCard.d.mts.map +1 -1
- package/dist/browser/components/FullWidthCard/FullWidthCard.d.ts +1 -1
- package/dist/browser/components/FullWidthCard/FullWidthCard.d.ts.map +1 -1
- package/dist/browser/components/FullWidthCard/index.d.cts +1 -1
- package/dist/browser/components/FullWidthCard/index.d.cts.map +1 -1
- package/dist/browser/components/FullWidthCard/index.d.mts +1 -1
- package/dist/browser/components/FullWidthCard/index.d.mts.map +1 -1
- package/dist/browser/components/FullWidthCard/index.d.ts +1 -1
- package/dist/browser/components/FullWidthCard/index.d.ts.map +1 -1
- package/dist/browser/components/PageCard.d.cts +3 -3
- package/dist/browser/components/PageCard.d.cts.map +1 -1
- package/dist/browser/components/PageCard.d.mts +3 -3
- package/dist/browser/components/PageCard.d.mts.map +1 -1
- package/dist/browser/components/PageCard.d.ts +3 -3
- package/dist/browser/components/PageCard.d.ts.map +1 -1
- package/dist/browser/components/SimpleCard/SimpleCard.d.cts +2 -2
- package/dist/browser/components/SimpleCard/SimpleCard.d.cts.map +1 -1
- package/dist/browser/components/SimpleCard/SimpleCard.d.mts +2 -2
- package/dist/browser/components/SimpleCard/SimpleCard.d.mts.map +1 -1
- package/dist/browser/components/SimpleCard/SimpleCard.d.ts +2 -2
- package/dist/browser/components/SimpleCard/SimpleCard.d.ts.map +1 -1
- package/dist/browser/components/SimpleCard/index.d.cts +1 -1
- package/dist/browser/components/SimpleCard/index.d.cts.map +1 -1
- package/dist/browser/components/SimpleCard/index.d.mts +1 -1
- package/dist/browser/components/SimpleCard/index.d.mts.map +1 -1
- package/dist/browser/components/SimpleCard/index.d.ts +1 -1
- package/dist/browser/components/SimpleCard/index.d.ts.map +1 -1
- package/dist/browser/components/SimpleCardGrid/SimpleCardGrid.d.cts +2 -1
- package/dist/browser/components/SimpleCardGrid/SimpleCardGrid.d.cts.map +1 -1
- package/dist/browser/components/SimpleCardGrid/SimpleCardGrid.d.mts +2 -1
- package/dist/browser/components/SimpleCardGrid/SimpleCardGrid.d.mts.map +1 -1
- package/dist/browser/components/SimpleCardGrid/SimpleCardGrid.d.ts +2 -1
- package/dist/browser/components/SimpleCardGrid/SimpleCardGrid.d.ts.map +1 -1
- package/dist/browser/components/SimpleCardGrid/index.d.cts +1 -1
- package/dist/browser/components/SimpleCardGrid/index.d.cts.map +1 -1
- package/dist/browser/components/SimpleCardGrid/index.d.mts +1 -1
- package/dist/browser/components/SimpleCardGrid/index.d.mts.map +1 -1
- package/dist/browser/components/SimpleCardGrid/index.d.ts +1 -1
- package/dist/browser/components/SimpleCardGrid/index.d.ts.map +1 -1
- package/dist/browser/components/index.d.cts +5 -5
- package/dist/browser/components/index.d.cts.map +1 -1
- package/dist/browser/components/index.d.mts +5 -5
- package/dist/browser/components/index.d.mts.map +1 -1
- package/dist/browser/components/index.d.ts +5 -5
- package/dist/browser/components/index.d.ts.map +1 -1
- package/dist/browser/index.cjs +207 -146
- package/dist/browser/index.cjs.map +1 -1
- package/dist/browser/index.d.cts +1 -1
- package/dist/browser/index.d.mts +1 -1
- package/dist/browser/index.d.ts +1 -1
- package/dist/browser/index.mjs +278 -0
- package/dist/browser/index.mjs.map +1 -0
- package/dist/neutral/components/CardContentEx.d.cts +3 -2
- package/dist/neutral/components/CardContentEx.d.cts.map +1 -1
- package/dist/neutral/components/CardContentEx.d.mts +3 -2
- package/dist/neutral/components/CardContentEx.d.mts.map +1 -1
- package/dist/neutral/components/CardContentEx.d.ts +3 -2
- package/dist/neutral/components/CardContentEx.d.ts.map +1 -1
- package/dist/neutral/components/CardEx.d.cts +3 -2
- package/dist/neutral/components/CardEx.d.cts.map +1 -1
- package/dist/neutral/components/CardEx.d.mts +3 -2
- package/dist/neutral/components/CardEx.d.mts.map +1 -1
- package/dist/neutral/components/CardEx.d.ts +3 -2
- package/dist/neutral/components/CardEx.d.ts.map +1 -1
- package/dist/neutral/components/FullWidthCard/FullWidthCard.d.cts +1 -1
- package/dist/neutral/components/FullWidthCard/FullWidthCard.d.cts.map +1 -1
- package/dist/neutral/components/FullWidthCard/FullWidthCard.d.mts +1 -1
- package/dist/neutral/components/FullWidthCard/FullWidthCard.d.mts.map +1 -1
- package/dist/neutral/components/FullWidthCard/FullWidthCard.d.ts +1 -1
- package/dist/neutral/components/FullWidthCard/FullWidthCard.d.ts.map +1 -1
- package/dist/neutral/components/FullWidthCard/index.d.cts +1 -1
- package/dist/neutral/components/FullWidthCard/index.d.cts.map +1 -1
- package/dist/neutral/components/FullWidthCard/index.d.mts +1 -1
- package/dist/neutral/components/FullWidthCard/index.d.mts.map +1 -1
- package/dist/neutral/components/FullWidthCard/index.d.ts +1 -1
- package/dist/neutral/components/FullWidthCard/index.d.ts.map +1 -1
- package/dist/neutral/components/PageCard.d.cts +3 -3
- package/dist/neutral/components/PageCard.d.cts.map +1 -1
- package/dist/neutral/components/PageCard.d.mts +3 -3
- package/dist/neutral/components/PageCard.d.mts.map +1 -1
- package/dist/neutral/components/PageCard.d.ts +3 -3
- package/dist/neutral/components/PageCard.d.ts.map +1 -1
- package/dist/neutral/components/SimpleCard/SimpleCard.d.cts +2 -2
- package/dist/neutral/components/SimpleCard/SimpleCard.d.cts.map +1 -1
- package/dist/neutral/components/SimpleCard/SimpleCard.d.mts +2 -2
- package/dist/neutral/components/SimpleCard/SimpleCard.d.mts.map +1 -1
- package/dist/neutral/components/SimpleCard/SimpleCard.d.ts +2 -2
- package/dist/neutral/components/SimpleCard/SimpleCard.d.ts.map +1 -1
- package/dist/neutral/components/SimpleCard/index.d.cts +1 -1
- package/dist/neutral/components/SimpleCard/index.d.cts.map +1 -1
- package/dist/neutral/components/SimpleCard/index.d.mts +1 -1
- package/dist/neutral/components/SimpleCard/index.d.mts.map +1 -1
- package/dist/neutral/components/SimpleCard/index.d.ts +1 -1
- package/dist/neutral/components/SimpleCard/index.d.ts.map +1 -1
- package/dist/neutral/components/SimpleCardGrid/SimpleCardGrid.d.cts +2 -1
- package/dist/neutral/components/SimpleCardGrid/SimpleCardGrid.d.cts.map +1 -1
- package/dist/neutral/components/SimpleCardGrid/SimpleCardGrid.d.mts +2 -1
- package/dist/neutral/components/SimpleCardGrid/SimpleCardGrid.d.mts.map +1 -1
- package/dist/neutral/components/SimpleCardGrid/SimpleCardGrid.d.ts +2 -1
- package/dist/neutral/components/SimpleCardGrid/SimpleCardGrid.d.ts.map +1 -1
- package/dist/neutral/components/SimpleCardGrid/index.d.cts +1 -1
- package/dist/neutral/components/SimpleCardGrid/index.d.cts.map +1 -1
- package/dist/neutral/components/SimpleCardGrid/index.d.mts +1 -1
- package/dist/neutral/components/SimpleCardGrid/index.d.mts.map +1 -1
- package/dist/neutral/components/SimpleCardGrid/index.d.ts +1 -1
- package/dist/neutral/components/SimpleCardGrid/index.d.ts.map +1 -1
- package/dist/neutral/components/index.d.cts +5 -5
- package/dist/neutral/components/index.d.cts.map +1 -1
- package/dist/neutral/components/index.d.mts +5 -5
- package/dist/neutral/components/index.d.mts.map +1 -1
- package/dist/neutral/components/index.d.ts +5 -5
- package/dist/neutral/components/index.d.ts.map +1 -1
- package/dist/neutral/index.cjs +207 -146
- package/dist/neutral/index.cjs.map +1 -1
- package/dist/neutral/index.d.cts +1 -1
- package/dist/neutral/index.d.mts +1 -1
- package/dist/neutral/index.d.ts +1 -1
- package/dist/neutral/index.mjs +278 -0
- package/dist/neutral/index.mjs.map +1 -0
- package/dist/node/components/CardContentEx.d.cts +3 -2
- package/dist/node/components/CardContentEx.d.cts.map +1 -1
- package/dist/node/components/CardContentEx.d.mts +3 -2
- package/dist/node/components/CardContentEx.d.mts.map +1 -1
- package/dist/node/components/CardContentEx.d.ts +3 -2
- package/dist/node/components/CardContentEx.d.ts.map +1 -1
- package/dist/node/components/CardEx.d.cts +3 -2
- package/dist/node/components/CardEx.d.cts.map +1 -1
- package/dist/node/components/CardEx.d.mts +3 -2
- package/dist/node/components/CardEx.d.mts.map +1 -1
- package/dist/node/components/CardEx.d.ts +3 -2
- package/dist/node/components/CardEx.d.ts.map +1 -1
- package/dist/node/components/FullWidthCard/FullWidthCard.d.cts +1 -1
- package/dist/node/components/FullWidthCard/FullWidthCard.d.cts.map +1 -1
- package/dist/node/components/FullWidthCard/FullWidthCard.d.mts +1 -1
- package/dist/node/components/FullWidthCard/FullWidthCard.d.mts.map +1 -1
- package/dist/node/components/FullWidthCard/FullWidthCard.d.ts +1 -1
- package/dist/node/components/FullWidthCard/FullWidthCard.d.ts.map +1 -1
- package/dist/node/components/FullWidthCard/index.d.cts +1 -1
- package/dist/node/components/FullWidthCard/index.d.cts.map +1 -1
- package/dist/node/components/FullWidthCard/index.d.mts +1 -1
- package/dist/node/components/FullWidthCard/index.d.mts.map +1 -1
- package/dist/node/components/FullWidthCard/index.d.ts +1 -1
- package/dist/node/components/FullWidthCard/index.d.ts.map +1 -1
- package/dist/node/components/PageCard.d.cts +3 -3
- package/dist/node/components/PageCard.d.cts.map +1 -1
- package/dist/node/components/PageCard.d.mts +3 -3
- package/dist/node/components/PageCard.d.mts.map +1 -1
- package/dist/node/components/PageCard.d.ts +3 -3
- package/dist/node/components/PageCard.d.ts.map +1 -1
- package/dist/node/components/SimpleCard/SimpleCard.d.cts +2 -2
- package/dist/node/components/SimpleCard/SimpleCard.d.cts.map +1 -1
- package/dist/node/components/SimpleCard/SimpleCard.d.mts +2 -2
- package/dist/node/components/SimpleCard/SimpleCard.d.mts.map +1 -1
- package/dist/node/components/SimpleCard/SimpleCard.d.ts +2 -2
- package/dist/node/components/SimpleCard/SimpleCard.d.ts.map +1 -1
- package/dist/node/components/SimpleCard/index.d.cts +1 -1
- package/dist/node/components/SimpleCard/index.d.cts.map +1 -1
- package/dist/node/components/SimpleCard/index.d.mts +1 -1
- package/dist/node/components/SimpleCard/index.d.mts.map +1 -1
- package/dist/node/components/SimpleCard/index.d.ts +1 -1
- package/dist/node/components/SimpleCard/index.d.ts.map +1 -1
- package/dist/node/components/SimpleCardGrid/SimpleCardGrid.d.cts +2 -1
- package/dist/node/components/SimpleCardGrid/SimpleCardGrid.d.cts.map +1 -1
- package/dist/node/components/SimpleCardGrid/SimpleCardGrid.d.mts +2 -1
- package/dist/node/components/SimpleCardGrid/SimpleCardGrid.d.mts.map +1 -1
- package/dist/node/components/SimpleCardGrid/SimpleCardGrid.d.ts +2 -1
- package/dist/node/components/SimpleCardGrid/SimpleCardGrid.d.ts.map +1 -1
- package/dist/node/components/SimpleCardGrid/index.d.cts +1 -1
- package/dist/node/components/SimpleCardGrid/index.d.cts.map +1 -1
- package/dist/node/components/SimpleCardGrid/index.d.mts +1 -1
- package/dist/node/components/SimpleCardGrid/index.d.mts.map +1 -1
- package/dist/node/components/SimpleCardGrid/index.d.ts +1 -1
- package/dist/node/components/SimpleCardGrid/index.d.ts.map +1 -1
- package/dist/node/components/index.d.cts +5 -5
- package/dist/node/components/index.d.cts.map +1 -1
- package/dist/node/components/index.d.mts +5 -5
- package/dist/node/components/index.d.mts.map +1 -1
- package/dist/node/components/index.d.ts +5 -5
- package/dist/node/components/index.d.ts.map +1 -1
- package/dist/node/index.cjs +207 -146
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.d.cts +1 -1
- package/dist/node/index.d.mts +1 -1
- package/dist/node/index.d.ts +1 -1
- package/dist/node/index.mjs +279 -0
- package/dist/node/index.mjs.map +1 -0
- package/package.json +12 -12
- package/src/components/CardContentEx.stories.tsx +8 -7
- package/src/components/CardContentEx.tsx +1 -1
- package/src/components/CardEx.tsx +7 -5
- package/src/components/FullWidthCard/FullWidthCard.stories.tsx +3 -3
- package/src/components/FullWidthCard/FullWidthCard.tsx +41 -32
- package/src/components/FullWidthCard/index.ts +1 -1
- package/src/components/PageCard.stories.tsx +6 -5
- package/src/components/PageCard.tsx +11 -9
- package/src/components/SimpleCard/SimpleCard.stories.tsx +4 -4
- package/src/components/SimpleCard/SimpleCard.tsx +65 -53
- package/src/components/SimpleCard/index.ts +1 -1
- package/src/components/SimpleCardGrid/SimpleCardGrid.stories.tsx +4 -4
- package/src/components/SimpleCardGrid/SimpleCardGrid.tsx +2 -1
- package/src/components/SimpleCardGrid/index.ts +1 -1
- package/src/components/index.ts +5 -5
- package/src/index.ts +1 -1
- package/dist/browser/index.js +0 -225
- package/dist/browser/index.js.map +0 -1
- package/dist/neutral/index.js +0 -225
- package/dist/neutral/index.js.map +0 -1
- package/dist/node/index.js +0 -226
- package/dist/node/index.js.map +0 -1
@@ -0,0 +1,279 @@
|
|
1
|
+
var __defProp = Object.defineProperty;
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
3
|
+
|
4
|
+
// src/components/CardContentEx.tsx
|
5
|
+
import { CardContent, styled } from "@mui/material";
|
6
|
+
import { useShareForwardedRef } from "@xyo-network/react-shared";
|
7
|
+
import React, { forwardRef, useEffect } from "react";
|
8
|
+
var CardContentExRoot = styled(CardContent, {
|
9
|
+
name: "CardContentEx",
|
10
|
+
shouldForwardProp: /* @__PURE__ */ __name((prop) => ![
|
11
|
+
"variant",
|
12
|
+
"removePadding"
|
13
|
+
].includes(prop), "shouldForwardProp"),
|
14
|
+
slot: "Root"
|
15
|
+
})(({ variant, removePadding }) => ({
|
16
|
+
...(variant === "scrollable" || removePadding) && {
|
17
|
+
[":last-child"]: {
|
18
|
+
paddingBottom: 0
|
19
|
+
},
|
20
|
+
overflow: "auto",
|
21
|
+
paddingTop: 0,
|
22
|
+
...removePadding && {
|
23
|
+
padding: 0
|
24
|
+
}
|
25
|
+
}
|
26
|
+
}));
|
27
|
+
var CardContentExWithRef = /* @__PURE__ */ forwardRef(({ scrollToTop = 0, refreshRef = 0, ...props }, ref) => {
|
28
|
+
const sharedRef = useShareForwardedRef(ref, refreshRef);
|
29
|
+
useEffect(() => {
|
30
|
+
var _a;
|
31
|
+
if (sharedRef && scrollToTop) {
|
32
|
+
(_a = sharedRef.current) == null ? void 0 : _a.scroll({
|
33
|
+
behavior: "smooth",
|
34
|
+
top: 0
|
35
|
+
});
|
36
|
+
}
|
37
|
+
}, [
|
38
|
+
sharedRef,
|
39
|
+
scrollToTop
|
40
|
+
]);
|
41
|
+
return /* @__PURE__ */ React.createElement(CardContentExRoot, {
|
42
|
+
ref: sharedRef,
|
43
|
+
...props
|
44
|
+
});
|
45
|
+
});
|
46
|
+
CardContentExWithRef.displayName = "CardContentEx";
|
47
|
+
var CardContentEx = CardContentExWithRef;
|
48
|
+
|
49
|
+
// src/components/CardEx.tsx
|
50
|
+
import { Card } from "@mui/material";
|
51
|
+
import { useGradientStyles } from "@xyo-network/react-shared";
|
52
|
+
import React2, { forwardRef as forwardRef2 } from "react";
|
53
|
+
var CardExWithRef = /* @__PURE__ */ forwardRef2(({ style, gradient, ...props }, ref) => {
|
54
|
+
const { styles } = useGradientStyles();
|
55
|
+
const gradientStyle = gradient === "border" ? styles.border : gradient === "background" ? styles.background : {};
|
56
|
+
return /* @__PURE__ */ React2.createElement(Card, {
|
57
|
+
style: {
|
58
|
+
...gradientStyle,
|
59
|
+
...style
|
60
|
+
},
|
61
|
+
ref,
|
62
|
+
...props
|
63
|
+
});
|
64
|
+
});
|
65
|
+
CardExWithRef.displayName = "CardEx";
|
66
|
+
var CardEx = CardExWithRef;
|
67
|
+
|
68
|
+
// src/components/FullWidthCard/FullWidthCard.tsx
|
69
|
+
import { ArrowForwardRounded as ArrowForwardRoundedIcon } from "@mui/icons-material";
|
70
|
+
import { alpha, Card as Card2, CardActions, CardContent as CardContent2, CardMedia, Grid, IconButton, Typography, useTheme, Zoom } from "@mui/material";
|
71
|
+
import { FlexGrowCol } from "@xylabs/react-flexbox";
|
72
|
+
import { useIsMobile } from "@xyo-network/react-shared";
|
73
|
+
import React3, { useState } from "react";
|
74
|
+
import { useNavigate } from "react-router-dom";
|
75
|
+
var FullWidthCard = /* @__PURE__ */ __name(({ cardIsButton, desc, href, media, name, small, to, ...props }) => {
|
76
|
+
const theme = useTheme();
|
77
|
+
const [raised, setRaised] = useState(false);
|
78
|
+
const navigate = useNavigate();
|
79
|
+
const isMobile = useIsMobile();
|
80
|
+
const localRouteChange = /* @__PURE__ */ __name((to2) => {
|
81
|
+
to2 ? navigate(to2) : navigate("/404");
|
82
|
+
}, "localRouteChange");
|
83
|
+
const externalRouteChange = /* @__PURE__ */ __name((href2) => {
|
84
|
+
href2 ? window.open(href2) : navigate("/404");
|
85
|
+
}, "externalRouteChange");
|
86
|
+
return /* @__PURE__ */ React3.createElement(Card2, {
|
87
|
+
elevation: raised ? 3 : 0,
|
88
|
+
style: {
|
89
|
+
height: "100%",
|
90
|
+
width: "100%"
|
91
|
+
},
|
92
|
+
...props,
|
93
|
+
sx: {
|
94
|
+
"&:hover": {
|
95
|
+
cursor: "pointer"
|
96
|
+
},
|
97
|
+
"backgroundColor": alpha(theme.palette.primary.light, 0.05)
|
98
|
+
},
|
99
|
+
onMouseEnter: /* @__PURE__ */ __name(() => isMobile ? null : cardIsButton ? setRaised(true) : null, "onMouseEnter"),
|
100
|
+
onMouseLeave: /* @__PURE__ */ __name(() => isMobile ? null : cardIsButton ? setRaised(false) : null, "onMouseLeave"),
|
101
|
+
onClick: /* @__PURE__ */ __name(() => cardIsButton ? href ? externalRouteChange(href) : to ? localRouteChange(to) : navigate("/404") : null, "onClick")
|
102
|
+
}, media ? /* @__PURE__ */ React3.createElement(CardMedia, {
|
103
|
+
component: "img",
|
104
|
+
height: "100",
|
105
|
+
image: media,
|
106
|
+
alt: ""
|
107
|
+
}) : null, /* @__PURE__ */ React3.createElement(CardContent2, null, /* @__PURE__ */ React3.createElement(Grid, {
|
108
|
+
container: true,
|
109
|
+
alignItems: "center",
|
110
|
+
paddingY: 2,
|
111
|
+
paddingX: 2
|
112
|
+
}, /* @__PURE__ */ React3.createElement(Grid, {
|
113
|
+
item: true,
|
114
|
+
xs: 12,
|
115
|
+
md: 6
|
116
|
+
}, typeof name === "string" ? /* @__PURE__ */ React3.createElement(Typography, {
|
117
|
+
fontWeight: 700,
|
118
|
+
variant: "h2",
|
119
|
+
textAlign: "left",
|
120
|
+
paddingBottom: 1
|
121
|
+
}, name) : name), /* @__PURE__ */ React3.createElement(Grid, {
|
122
|
+
item: true,
|
123
|
+
xs: 12,
|
124
|
+
md: 5
|
125
|
+
}, /* @__PURE__ */ React3.createElement(Typography, {
|
126
|
+
variant: "body1",
|
127
|
+
fontWeight: 400,
|
128
|
+
textAlign: "left"
|
129
|
+
}, desc)), /* @__PURE__ */ React3.createElement(Grid, {
|
130
|
+
item: true,
|
131
|
+
xs: 1,
|
132
|
+
display: isMobile ? "none" : "flex",
|
133
|
+
justifyContent: "center"
|
134
|
+
}, /* @__PURE__ */ React3.createElement(Zoom, {
|
135
|
+
in: raised
|
136
|
+
}, /* @__PURE__ */ React3.createElement(IconButton, {
|
137
|
+
color: "primary",
|
138
|
+
size: small ? "small" : "medium",
|
139
|
+
onClick: /* @__PURE__ */ __name(() => href ? externalRouteChange(href) : to ? localRouteChange(to) : navigate("/404"), "onClick"),
|
140
|
+
disableFocusRipple: true,
|
141
|
+
disableRipple: true,
|
142
|
+
disableTouchRipple: true
|
143
|
+
}, /* @__PURE__ */ React3.createElement(ArrowForwardRoundedIcon, {
|
144
|
+
fontSize: small ? "small" : "medium"
|
145
|
+
})))))), /* @__PURE__ */ React3.createElement(CardActions, {
|
146
|
+
sx: {
|
147
|
+
display: {
|
148
|
+
md: isMobile ? "flex" : "none"
|
149
|
+
}
|
150
|
+
}
|
151
|
+
}, /* @__PURE__ */ React3.createElement(FlexGrowCol, {
|
152
|
+
alignItems: "flex-end"
|
153
|
+
}, /* @__PURE__ */ React3.createElement(IconButton, {
|
154
|
+
color: "primary",
|
155
|
+
size: small ? "small" : "medium",
|
156
|
+
onClick: /* @__PURE__ */ __name(() => href ? externalRouteChange(href) : to ? localRouteChange(to) : navigate("/404"), "onClick"),
|
157
|
+
disableFocusRipple: true,
|
158
|
+
disableRipple: true,
|
159
|
+
disableTouchRipple: true
|
160
|
+
}, /* @__PURE__ */ React3.createElement(ArrowForwardRoundedIcon, {
|
161
|
+
fontSize: small ? "small" : "medium"
|
162
|
+
})))));
|
163
|
+
}, "FullWidthCard");
|
164
|
+
|
165
|
+
// src/components/PageCard.tsx
|
166
|
+
import { Refresh as RefreshIcon } from "@mui/icons-material";
|
167
|
+
import { CardHeader, IconButton as IconButton2 } from "@mui/material";
|
168
|
+
import { TypographyEx } from "@xyo-network/react-shared";
|
169
|
+
import React4, { forwardRef as forwardRef3 } from "react";
|
170
|
+
var PageCardWithRef = /* @__PURE__ */ forwardRef3(({ subheader, title, onRefresh, children, action, style, ...props }, ref) => {
|
171
|
+
return /* @__PURE__ */ React4.createElement(CardEx, {
|
172
|
+
style: {
|
173
|
+
backgroundColor: "transparent",
|
174
|
+
position: "relative",
|
175
|
+
...style
|
176
|
+
},
|
177
|
+
elevation: 0,
|
178
|
+
ref,
|
179
|
+
...props
|
180
|
+
}, /* @__PURE__ */ React4.createElement(CardHeader, {
|
181
|
+
title: /* @__PURE__ */ React4.createElement(TypographyEx, {
|
182
|
+
variant: "h5",
|
183
|
+
gutterBottom: true
|
184
|
+
}, title),
|
185
|
+
subheader: /* @__PURE__ */ React4.createElement(TypographyEx, {
|
186
|
+
variant: "subtitle1"
|
187
|
+
}, subheader),
|
188
|
+
action: action ?? /* @__PURE__ */ React4.createElement(React4.Fragment, null, onRefresh ? /* @__PURE__ */ React4.createElement(IconButton2, {
|
189
|
+
onClick: /* @__PURE__ */ __name(() => onRefresh == null ? void 0 : onRefresh(), "onClick")
|
190
|
+
}, /* @__PURE__ */ React4.createElement(RefreshIcon, null)) : null)
|
191
|
+
}), children);
|
192
|
+
});
|
193
|
+
PageCardWithRef.displayName = "PageCard";
|
194
|
+
var PageCard = PageCardWithRef;
|
195
|
+
|
196
|
+
// src/components/SimpleCard/SimpleCard.tsx
|
197
|
+
import { ArrowForwardRounded as ArrowForwardRoundedIcon2 } from "@mui/icons-material";
|
198
|
+
import { alpha as alpha2, CardActions as CardActions2, CardContent as CardContent3, CardMedia as CardMedia2, IconButton as IconButton3, Typography as Typography2, useTheme as useTheme2 } from "@mui/material";
|
199
|
+
import { FlexCol, FlexGrowCol as FlexGrowCol2 } from "@xylabs/react-flexbox";
|
200
|
+
import { useIsMobile as useIsMobile2 } from "@xyo-network/react-shared";
|
201
|
+
import React5, { useState as useState2 } from "react";
|
202
|
+
import { useNavigate as useNavigate2 } from "react-router-dom";
|
203
|
+
var SimpleCard = /* @__PURE__ */ __name(({ desc, iconImage, interactionVariant = "card", headline, href, media, small, subtitle, sx, to, ...props }) => {
|
204
|
+
const theme = useTheme2();
|
205
|
+
const [raised, setRaised] = useState2(false);
|
206
|
+
const navigate = useNavigate2();
|
207
|
+
const isMobile = useIsMobile2();
|
208
|
+
const localRouteChange = /* @__PURE__ */ __name((to2) => {
|
209
|
+
to2 ? navigate(to2) : navigate("/404");
|
210
|
+
}, "localRouteChange");
|
211
|
+
const externalRouteChange = /* @__PURE__ */ __name((href2) => {
|
212
|
+
href2 ? window.open(href2) : navigate("/404");
|
213
|
+
}, "externalRouteChange");
|
214
|
+
return /* @__PURE__ */ React5.createElement(CardEx, {
|
215
|
+
elevation: raised ? 3 : 0,
|
216
|
+
sx: {
|
217
|
+
"&:hover": {
|
218
|
+
cursor: interactionVariant == "button" ? "pointer" : null
|
219
|
+
},
|
220
|
+
"backgroundColor": alpha2(theme.palette.primary.light, 0.05),
|
221
|
+
...sx
|
222
|
+
},
|
223
|
+
onMouseEnter: /* @__PURE__ */ __name(() => isMobile ? null : interactionVariant == "button" ? setRaised(true) : null, "onMouseEnter"),
|
224
|
+
onMouseLeave: /* @__PURE__ */ __name(() => isMobile ? null : interactionVariant == "button" ? setRaised(false) : null, "onMouseLeave"),
|
225
|
+
onClick: /* @__PURE__ */ __name(() => interactionVariant == "button" ? href ? externalRouteChange(href) : to ? localRouteChange(to) : navigate("/404") : null, "onClick"),
|
226
|
+
...props
|
227
|
+
}, media ? /* @__PURE__ */ React5.createElement(CardMedia2, {
|
228
|
+
component: "img",
|
229
|
+
height: "100",
|
230
|
+
image: media,
|
231
|
+
alt: ""
|
232
|
+
}) : null, /* @__PURE__ */ React5.createElement(CardContent3, {
|
233
|
+
sx: {
|
234
|
+
height: "100%"
|
235
|
+
}
|
236
|
+
}, /* @__PURE__ */ React5.createElement(FlexCol, {
|
237
|
+
width: "100%",
|
238
|
+
alignItems: "flex-start"
|
239
|
+
}, iconImage ? /* @__PURE__ */ React5.createElement("img", {
|
240
|
+
src: iconImage,
|
241
|
+
height: "40px",
|
242
|
+
style: {
|
243
|
+
paddingBottom: "8px"
|
244
|
+
}
|
245
|
+
}) : null, typeof headline === "string" ? /* @__PURE__ */ React5.createElement(Typography2, {
|
246
|
+
variant: small ? "body1" : "h6",
|
247
|
+
textAlign: "left",
|
248
|
+
gutterBottom: true
|
249
|
+
}, headline) : headline, subtitle ? /* @__PURE__ */ React5.createElement(Typography2, {
|
250
|
+
variant: "subtitle2",
|
251
|
+
textAlign: "left",
|
252
|
+
gutterBottom: true
|
253
|
+
}, subtitle) : null, /* @__PURE__ */ React5.createElement(Typography2, {
|
254
|
+
variant: small ? "caption" : "body1",
|
255
|
+
textAlign: "left",
|
256
|
+
gutterBottom: true
|
257
|
+
}, desc))), interactionVariant == "button" ? /* @__PURE__ */ React5.createElement(CardActions2, null, /* @__PURE__ */ React5.createElement(FlexGrowCol2, {
|
258
|
+
alignItems: "flex-end"
|
259
|
+
}, /* @__PURE__ */ React5.createElement(IconButton3, {
|
260
|
+
color: raised ? "secondary" : "primary",
|
261
|
+
size: small ? "small" : "medium",
|
262
|
+
onClick: /* @__PURE__ */ __name(() => href ? externalRouteChange(href) : to ? localRouteChange(to) : navigate("/404"), "onClick"),
|
263
|
+
disableFocusRipple: true,
|
264
|
+
disableRipple: true,
|
265
|
+
disableTouchRipple: true
|
266
|
+
}, /* @__PURE__ */ React5.createElement(ArrowForwardRoundedIcon2, {
|
267
|
+
fontSize: small ? "small" : "medium"
|
268
|
+
})))) : null);
|
269
|
+
}, "SimpleCard");
|
270
|
+
export {
|
271
|
+
CardContentEx,
|
272
|
+
CardContentExWithRef,
|
273
|
+
CardEx,
|
274
|
+
CardExWithRef,
|
275
|
+
FullWidthCard,
|
276
|
+
PageCard,
|
277
|
+
SimpleCard
|
278
|
+
};
|
279
|
+
//# sourceMappingURL=index.mjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../../src/components/CardContentEx.tsx","../../src/components/CardEx.tsx","../../src/components/FullWidthCard/FullWidthCard.tsx","../../src/components/PageCard.tsx","../../src/components/SimpleCard/SimpleCard.tsx"],"sourcesContent":["import { CardContent, CardContentProps, styled } from '@mui/material'\nimport { useShareForwardedRef } from '@xyo-network/react-shared'\nimport React, { forwardRef, useEffect } from 'react'\n\nconst CardContentExRoot = styled(CardContent, {\n name: 'CardContentEx',\n shouldForwardProp: (prop: string) => !['variant', 'removePadding'].includes(prop),\n slot: 'Root',\n})<CardContentExProps>(({ variant, removePadding }) => ({\n ...((variant === 'scrollable' || removePadding) && {\n [':last-child']: {\n paddingBottom: 0,\n },\n overflow: 'auto',\n paddingTop: 0,\n ...(removePadding && { padding: 0 }),\n }),\n}))\n\nexport type CardContentExProps = CardContentProps & {\n refreshRef?: number\n removePadding?: boolean\n scrollToTop?: number\n variant?: 'scrollable' | 'normal'\n}\n\nexport const CardContentExWithRef = forwardRef<HTMLDivElement | null, CardContentExProps>(({ scrollToTop = 0, refreshRef = 0, ...props }, ref) => {\n const sharedRef = useShareForwardedRef<HTMLDivElement>(ref, refreshRef)\n\n useEffect(() => {\n if (sharedRef && scrollToTop) {\n sharedRef.current?.scroll({ behavior: 'smooth', top: 0 })\n }\n }, [sharedRef, scrollToTop])\n\n return <CardContentExRoot ref={sharedRef} {...props} />\n})\n\nCardContentExWithRef.displayName = 'CardContentEx'\n\nexport const CardContentEx = CardContentExWithRef\n","import { Card, CardProps } from '@mui/material'\nimport { useGradientStyles } from '@xyo-network/react-shared'\nimport React, { forwardRef } from 'react'\n\nexport interface CardExProps extends CardProps {\n gradient?: 'border' | 'background'\n}\n\nexport const CardExWithRef = forwardRef<HTMLDivElement, CardExProps>(({ style, gradient, ...props }, ref) => {\n const { styles } = useGradientStyles()\n const gradientStyle\n = gradient === 'border'\n ? styles.border\n : gradient === 'background'\n ? styles.background\n : {}\n return (\n <Card\n style={{\n ...gradientStyle,\n ...style,\n }}\n ref={ref}\n {...props}\n />\n )\n})\n\nCardExWithRef.displayName = 'CardEx'\n\nexport const CardEx = CardExWithRef\n","import { ArrowForwardRounded as ArrowForwardRoundedIcon } from '@mui/icons-material'\nimport { alpha, Card, CardActions, CardContent, CardMedia, CardProps, Grid, IconButton, Typography, useTheme, Zoom } from '@mui/material'\nimport { FlexGrowCol } from '@xylabs/react-flexbox'\nimport { useIsMobile } from '@xyo-network/react-shared'\nimport React, { ReactNode, useState } from 'react'\nimport { To, useNavigate } from 'react-router-dom'\n\nexport interface FullWidthCardProps extends CardProps {\n cardIsButton?: boolean\n desc?: ReactNode\n href?: string\n linkText?: string\n media?: string\n name: ReactNode\n small?: boolean\n to?: To\n}\n\nexport const FullWidthCard: React.FC<FullWidthCardProps> = ({ cardIsButton, desc, href, media, name, small, to, ...props }) => {\n const theme = useTheme()\n const [raised, setRaised] = useState(false)\n const navigate = useNavigate()\n const isMobile = useIsMobile()\n\n const localRouteChange = (to: To | undefined) => {\n // eslint-disable-next-line @typescript-eslint/no-unused-expressions\n to ? navigate(to) : navigate('/404')\n }\n const externalRouteChange = (href: string | undefined) => {\n // eslint-disable-next-line @typescript-eslint/no-unused-expressions\n href ? window.open(href) : navigate('/404')\n }\n\n return (\n <Card\n elevation={raised ? 3 : 0}\n style={{ height: '100%', width: '100%' }}\n {...props}\n sx={{\n '&:hover': {\n cursor: 'pointer',\n },\n 'backgroundColor': alpha(theme.palette.primary.light, 0.05),\n }}\n onMouseEnter={() =>\n isMobile\n ? null\n : cardIsButton\n ? setRaised(true)\n : null}\n onMouseLeave={() =>\n isMobile\n ? null\n : cardIsButton\n ? setRaised(false)\n : null}\n onClick={() =>\n cardIsButton\n ? href\n ? externalRouteChange(href)\n : to\n ? localRouteChange(to)\n : navigate('/404')\n : null}\n >\n {media\n ? <CardMedia component=\"img\" height=\"100\" image={media} alt=\"\" />\n : null}\n\n <CardContent>\n <Grid container alignItems=\"center\" paddingY={2} paddingX={2}>\n <Grid item xs={12} md={6}>\n {typeof name === 'string'\n ? (\n <Typography fontWeight={700} variant=\"h2\" textAlign=\"left\" paddingBottom={1}>\n {name}\n </Typography>\n )\n : name}\n </Grid>\n <Grid item xs={12} md={5}>\n <Typography variant=\"body1\" fontWeight={400} textAlign=\"left\">\n {desc}\n </Typography>\n </Grid>\n <Grid item xs={1} display={isMobile ? 'none' : 'flex'} justifyContent=\"center\">\n <Zoom in={raised}>\n <IconButton\n color=\"primary\"\n size={small ? 'small' : 'medium'}\n onClick={() =>\n href\n ? externalRouteChange(href)\n : to\n ? localRouteChange(to)\n : navigate('/404')}\n disableFocusRipple\n disableRipple\n disableTouchRipple\n >\n <ArrowForwardRoundedIcon fontSize={small ? 'small' : 'medium'} />\n </IconButton>\n </Zoom>\n </Grid>\n </Grid>\n </CardContent>\n <CardActions sx={{ display: { md: isMobile ? 'flex' : 'none' } }}>\n <FlexGrowCol alignItems=\"flex-end\">\n <IconButton\n color=\"primary\"\n size={small ? 'small' : 'medium'}\n onClick={() =>\n href\n ? externalRouteChange(href)\n : to\n ? localRouteChange(to)\n : navigate('/404')}\n disableFocusRipple\n disableRipple\n disableTouchRipple\n >\n <ArrowForwardRoundedIcon fontSize={small ? 'small' : 'medium'} />\n </IconButton>\n </FlexGrowCol>\n </CardActions>\n </Card>\n )\n}\n","import { Refresh as RefreshIcon } from '@mui/icons-material'\nimport { CardHeader, CardHeaderProps, IconButton } from '@mui/material'\nimport { TypographyEx } from '@xyo-network/react-shared'\nimport React, { forwardRef, ReactNode } from 'react'\n\nimport { CardEx, CardExProps } from './CardEx.tsx'\n\nexport interface PageCardProps extends CardExProps {\n action?: ReactNode\n onRefresh?: () => void\n subheader?: CardHeaderProps['subheader']\n}\n\nconst PageCardWithRef = forwardRef<HTMLDivElement, PageCardProps>(({ subheader, title, onRefresh, children, action, style, ...props }, ref) => {\n return (\n <CardEx style={{ backgroundColor: 'transparent', position: 'relative', ...style }} elevation={0} ref={ref} {...props}>\n <CardHeader\n title={(\n <TypographyEx variant=\"h5\" gutterBottom>\n {title}\n </TypographyEx>\n )}\n subheader={<TypographyEx variant=\"subtitle1\">{subheader}</TypographyEx>}\n action={\n action ?? (\n <>\n {onRefresh\n ? (\n <IconButton onClick={() => onRefresh?.()}>\n <RefreshIcon />\n </IconButton>\n )\n : null}\n </>\n )\n }\n />\n {children}\n </CardEx>\n )\n})\n\nPageCardWithRef.displayName = 'PageCard'\n\nexport const PageCard = PageCardWithRef\n","import { ArrowForwardRounded as ArrowForwardRoundedIcon } from '@mui/icons-material'\nimport { alpha, CardActions, CardContent, CardMedia, IconButton, Typography, useTheme } from '@mui/material'\nimport { FlexCol, FlexGrowCol } from '@xylabs/react-flexbox'\nimport { useIsMobile } from '@xyo-network/react-shared'\nimport React, { ReactNode, useState } from 'react'\nimport { To, useNavigate } from 'react-router-dom'\n\nimport { CardEx, CardExProps } from '../CardEx.tsx'\n\nexport interface SimpleCardProps extends CardExProps {\n desc?: ReactNode\n headline?: ReactNode\n href?: string\n iconImage?: string\n interactionVariant?: 'button' | 'card'\n media?: string\n small?: boolean\n subtitle?: string\n to?: To\n}\n\nexport const SimpleCard: React.FC<SimpleCardProps> = ({\n desc,\n iconImage,\n interactionVariant = 'card',\n headline,\n href,\n media,\n small,\n subtitle,\n sx,\n to,\n ...props\n}) => {\n const theme = useTheme()\n const [raised, setRaised] = useState(false)\n const navigate = useNavigate()\n const isMobile = useIsMobile()\n const localRouteChange = (to: To | undefined) => {\n // eslint-disable-next-line @typescript-eslint/no-unused-expressions\n to ? navigate(to) : navigate('/404')\n }\n const externalRouteChange = (href: string | undefined) => {\n // eslint-disable-next-line @typescript-eslint/no-unused-expressions\n href ? window.open(href) : navigate('/404')\n }\n return (\n <CardEx\n elevation={raised ? 3 : 0}\n sx={{\n '&:hover': {\n cursor: interactionVariant == 'button' ? 'pointer' : null,\n },\n 'backgroundColor': alpha(theme.palette.primary.light, 0.05),\n ...sx,\n }}\n onMouseEnter={() =>\n isMobile\n ? null\n : interactionVariant == 'button'\n ? setRaised(true)\n : null}\n onMouseLeave={() =>\n isMobile\n ? null\n : interactionVariant == 'button'\n ? setRaised(false)\n : null}\n onClick={() =>\n interactionVariant == 'button'\n ? href\n ? externalRouteChange(href)\n : to\n ? localRouteChange(to)\n : navigate('/404')\n : null}\n {...props}\n >\n {media\n ? <CardMedia component=\"img\" height=\"100\" image={media} alt=\"\" />\n : null}\n\n <CardContent sx={{ height: '100%' }}>\n <FlexCol width=\"100%\" alignItems=\"flex-start\">\n {iconImage\n ? <img src={iconImage} height=\"40px\" style={{ paddingBottom: '8px' }} />\n : null}\n {typeof headline === 'string'\n ? (\n <Typography variant={small ? 'body1' : 'h6'} textAlign=\"left\" gutterBottom>\n {headline}\n </Typography>\n )\n : headline}\n {subtitle\n ? (\n <Typography variant=\"subtitle2\" textAlign=\"left\" gutterBottom>\n {subtitle}\n </Typography>\n )\n : null}\n <Typography variant={small ? 'caption' : 'body1'} textAlign=\"left\" gutterBottom>\n {desc}\n </Typography>\n </FlexCol>\n </CardContent>\n {interactionVariant == 'button'\n ? (\n <CardActions>\n <FlexGrowCol alignItems=\"flex-end\">\n <IconButton\n color={raised ? 'secondary' : 'primary'}\n size={small ? 'small' : 'medium'}\n onClick={() =>\n href\n ? externalRouteChange(href)\n : to\n ? localRouteChange(to)\n : navigate('/404')}\n disableFocusRipple\n disableRipple\n disableTouchRipple\n >\n <ArrowForwardRoundedIcon fontSize={small ? 'small' : 'medium'} />\n </IconButton>\n </FlexGrowCol>\n </CardActions>\n )\n : null}\n </CardEx>\n )\n}\n"],"mappings":";;;;AAAA,SAASA,aAA+BC,cAAc;AACtD,SAASC,4BAA4B;AACrC,OAAOC,SAASC,YAAYC,iBAAiB;AAE7C,IAAMC,oBAAoBC,OAAOC,aAAa;EAC5CC,MAAM;EACNC,mBAAmB,wBAACC,SAAiB,CAAC;IAAC;IAAW;IAAiBC,SAASD,IAAAA,GAAzD;EACnBE,MAAM;AACR,CAAA,EAAuB,CAAC,EAAEC,SAASC,cAAa,OAAQ;EACtD,IAAKD,YAAY,gBAAgBC,kBAAkB;IACjD,CAAC,aAAA,GAAgB;MACfC,eAAe;IACjB;IACAC,UAAU;IACVC,YAAY;IACZ,GAAIH,iBAAiB;MAAEI,SAAS;IAAE;EACpC;AACF,EAAA;AASO,IAAMC,uBAAuBC,2BAAsD,CAAC,EAAEC,cAAc,GAAGC,aAAa,GAAG,GAAGC,MAAAA,GAASC,QAAAA;AACxI,QAAMC,YAAYC,qBAAqCF,KAAKF,UAAAA;AAE5DK,YAAU,MAAA;AA7BZ;AA8BI,QAAIF,aAAaJ,aAAa;AAC5BI,sBAAUG,YAAVH,mBAAmBI,OAAO;QAAEC,UAAU;QAAUC,KAAK;MAAE;IACzD;EACF,GAAG;IAACN;IAAWJ;GAAY;AAE3B,SAAO,sBAAA,cAAChB,mBAAAA;IAAkBmB,KAAKC;IAAY,GAAGF;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SAAS,cAAc;IAC9B2C,MAAMlD,QAAQ,UAAU;IACxB4B,SAAS,6BACP9B,OACIiB,oBAAoBjB,IAAAA,IACpBK,KACEW,iBAAiBX,EAAAA,IACjBO,SAAS,MAAA,GALR;IAMTyC,oBAAAA;IACAC,eAAAA;IACAC,oBAAAA;KAEA,gBAAAnC,OAAA,cAACoC,0BAAAA;IAAwBC,UAAUvD,QAAQ,UAAU;UAK7D,IAAA;AAGV,GA9GqD;","names":["CardContent","styled","useShareForwardedRef","React","forwardRef","useEffect","CardContentExRoot","styled","CardContent","name","shouldForwardProp","prop","includes","slot","variant","removePadding","paddingBottom","overflow","paddingTop","padding","CardContentExWithRef","forwardRef","scrollToTop","refreshRef","props","ref","sharedRef","useShareForwardedRef","useEffect","current","scroll","behavior","top","displayName","CardContentEx","Card","useGradientStyles","React","forwardRef","CardExWithRef","style","gradient","props","ref","styles","gradientStyle","border","background","displayName","CardEx","ArrowForwardRounded","ArrowForwardRoundedIcon","alpha","Card","CardActions","CardContent","CardMedia","Grid","IconButton","Typography","useTheme","Zoom","FlexGrowCol","useIsMobile","React","useState","useNavigate","FullWidthCard","cardIsButton","desc","href","media","name","small","to","props","theme","useTheme","raised","setRaised","useState","navigate","useNavigate","isMobile","useIsMobile","localRouteChange","externalRouteChange","window","open","React","Card","elevation","style","height","width","sx","cursor","alpha","palette","primary","light","onMouseEnter","onMouseLeave","onClick","CardMedia","component","image","alt","CardContent","Grid","container","alignItems","paddingY","paddingX","item","xs","md","Typography","fontWeight","variant","textAlign","paddingBottom","display","justifyContent","Zoom","in","IconButton","color","size","disableFocusRipple","disableRipple","disableTouchRipple","ArrowForwardRoundedIcon","fontSize","CardActions","FlexGrowCol","Refresh","RefreshIcon","CardHeader","IconButton","TypographyEx","React","forwardRef","PageCardWithRef","forwardRef","subheader","title","onRefresh","children","action","style","props","ref","React","CardEx","backgroundColor","position","elevation","CardHeader","TypographyEx","variant","gutterBottom","IconButton","onClick","RefreshIcon","displayName","PageCard","ArrowForwardRounded","ArrowForwardRoundedIcon","alpha","CardActions","CardContent","CardMedia","IconButton","Typography","useTheme","FlexCol","FlexGrowCol","useIsMobile","React","useState","useNavigate","SimpleCard","desc","iconImage","interactionVariant","headline","href","media","small","subtitle","sx","to","props","theme","useTheme","raised","setRaised","useState","navigate","useNavigate","isMobile","useIsMobile","localRouteChange","externalRouteChange","window","open","React","CardEx","elevation","cursor","alpha","palette","primary","light","onMouseEnter","onMouseLeave","onClick","CardMedia","component","height","image","alt","CardContent","FlexCol","width","alignItems","img","src","style","paddingBottom","Typography","variant","textAlign","gutterBottom","CardActions","FlexGrowCol","IconButton","color","size","disableFocusRipple","disableRipple","disableTouchRipple","ArrowForwardRoundedIcon","fontSize"]}
|
package/package.json
CHANGED
@@ -10,9 +10,9 @@
|
|
10
10
|
"url": "https://github.com/XYOracleNetwork/sdk-xyo-react-js/issues"
|
11
11
|
},
|
12
12
|
"dependencies": {
|
13
|
-
"@xylabs/react-flexbox": "^3.4.
|
14
|
-
"@xyo-network/react-shared": "^2.
|
15
|
-
"react-router-dom": "^6.
|
13
|
+
"@xylabs/react-flexbox": "^3.4.2",
|
14
|
+
"@xyo-network/react-shared": "^2.82.0",
|
15
|
+
"react-router-dom": "^6.26.0"
|
16
16
|
},
|
17
17
|
"peerDependencies": {
|
18
18
|
"@mui/icons-material": "^5",
|
@@ -22,10 +22,10 @@
|
|
22
22
|
"react-dom": "^18"
|
23
23
|
},
|
24
24
|
"devDependencies": {
|
25
|
-
"@storybook/react": "^
|
26
|
-
"@xylabs/ts-scripts-yarn3": "^3.
|
27
|
-
"@xylabs/tsconfig-react": "^3.
|
28
|
-
"@xyo-network/react-storybook": "^2.
|
25
|
+
"@storybook/react": "^8.2.7",
|
26
|
+
"@xylabs/ts-scripts-yarn3": "^3.15.16",
|
27
|
+
"@xylabs/tsconfig-react": "^3.15.16",
|
28
|
+
"@xyo-network/react-storybook": "^2.82.0",
|
29
29
|
"typescript": "^5.5.4"
|
30
30
|
},
|
31
31
|
"description": "Common React library for all XYO projects that use React",
|
@@ -35,7 +35,7 @@
|
|
35
35
|
"node": {
|
36
36
|
"import": {
|
37
37
|
"types": "./dist/node/index.d.mts",
|
38
|
-
"default": "./dist/node/index.
|
38
|
+
"default": "./dist/node/index.mjs"
|
39
39
|
},
|
40
40
|
"require": {
|
41
41
|
"types": "./dist/node/index.d.cts",
|
@@ -45,19 +45,19 @@
|
|
45
45
|
"browser": {
|
46
46
|
"import": {
|
47
47
|
"types": "./dist/browser/index.d.mts",
|
48
|
-
"default": "./dist/browser/index.
|
48
|
+
"default": "./dist/browser/index.mjs"
|
49
49
|
},
|
50
50
|
"require": {
|
51
51
|
"types": "./dist/browser/index.d.cts",
|
52
52
|
"default": "./dist/browser/index.cjs"
|
53
53
|
}
|
54
54
|
},
|
55
|
-
"default": "./dist/browser/index.
|
55
|
+
"default": "./dist/browser/index.mjs"
|
56
56
|
},
|
57
57
|
"./package.json": "./package.json"
|
58
58
|
},
|
59
59
|
"main": "dist/browser/index.cjs",
|
60
|
-
"module": "dist/browser/index.
|
60
|
+
"module": "dist/browser/index.mjs",
|
61
61
|
"homepage": "https://xyo.network",
|
62
62
|
"keywords": [
|
63
63
|
"xyo",
|
@@ -79,6 +79,6 @@
|
|
79
79
|
},
|
80
80
|
"sideEffects": false,
|
81
81
|
"types": "dist/browser/index.d.ts",
|
82
|
-
"version": "2.
|
82
|
+
"version": "2.82.0",
|
83
83
|
"type": "module"
|
84
84
|
}
|
@@ -1,12 +1,11 @@
|
|
1
|
-
/* eslint-disable import/no-internal-modules */
|
2
1
|
import { Button, Typography } from '@mui/material'
|
3
2
|
import { Decorator, Meta, StoryFn } from '@storybook/react'
|
4
3
|
import { FlexGrowCol } from '@xylabs/react-flexbox'
|
5
4
|
import { WithRefDecorator } from '@xyo-network/react-storybook'
|
6
|
-
import { useRef, useState } from 'react'
|
5
|
+
import React, { useRef, useState } from 'react'
|
7
6
|
|
8
|
-
import { CardContentEx } from './CardContentEx.
|
9
|
-
import { PageCard } from './PageCard.
|
7
|
+
import { CardContentEx } from './CardContentEx.tsx'
|
8
|
+
import { PageCard } from './PageCard.tsx'
|
10
9
|
|
11
10
|
const ScrollableDecorator: Decorator = (Story, args) => {
|
12
11
|
const [scrollToTop, setScrollToTop] = useState(0)
|
@@ -43,8 +42,11 @@ const Template: StoryFn<typeof CardContentEx> = (props) => {
|
|
43
42
|
return (
|
44
43
|
<PageCard title="Page Card" subheader="subheader">
|
45
44
|
<CardContentEx {...props}>
|
46
|
-
{[...Array(100).keys()].map(
|
47
|
-
<Typography key={item}>
|
45
|
+
{[...Array(100).keys()].map(item => (
|
46
|
+
<Typography key={item}>
|
47
|
+
{item}
|
48
|
+
. - Item row
|
49
|
+
</Typography>
|
48
50
|
))}
|
49
51
|
</CardContentEx>
|
50
52
|
</PageCard>
|
@@ -63,5 +65,4 @@ WithVariant.decorators = [ScrollableDecorator]
|
|
63
65
|
|
64
66
|
export { Default, WithRef, WithVariant }
|
65
67
|
|
66
|
-
// eslint-disable-next-line import/no-default-export
|
67
68
|
export default StorybookEntry
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { CardContent, CardContentProps, styled } from '@mui/material'
|
2
2
|
import { useShareForwardedRef } from '@xyo-network/react-shared'
|
3
|
-
import { forwardRef, useEffect } from 'react'
|
3
|
+
import React, { forwardRef, useEffect } from 'react'
|
4
4
|
|
5
5
|
const CardContentExRoot = styled(CardContent, {
|
6
6
|
name: 'CardContentEx',
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { Card, CardProps } from '@mui/material'
|
2
2
|
import { useGradientStyles } from '@xyo-network/react-shared'
|
3
|
-
import { forwardRef } from 'react'
|
3
|
+
import React, { forwardRef } from 'react'
|
4
4
|
|
5
5
|
export interface CardExProps extends CardProps {
|
6
6
|
gradient?: 'border' | 'background'
|
@@ -8,10 +8,12 @@ export interface CardExProps extends CardProps {
|
|
8
8
|
|
9
9
|
export const CardExWithRef = forwardRef<HTMLDivElement, CardExProps>(({ style, gradient, ...props }, ref) => {
|
10
10
|
const { styles } = useGradientStyles()
|
11
|
-
const gradientStyle
|
12
|
-
gradient === 'border'
|
13
|
-
|
14
|
-
|
11
|
+
const gradientStyle
|
12
|
+
= gradient === 'border'
|
13
|
+
? styles.border
|
14
|
+
: gradient === 'background'
|
15
|
+
? styles.background
|
16
|
+
: {}
|
15
17
|
return (
|
16
18
|
<Card
|
17
19
|
style={{
|
@@ -1,7 +1,8 @@
|
|
1
1
|
import { Meta, StoryFn } from '@storybook/react'
|
2
|
+
import React from 'react'
|
2
3
|
import { BrowserRouter } from 'react-router-dom'
|
3
4
|
|
4
|
-
import { FullWidthCard } from './FullWidthCard.
|
5
|
+
import { FullWidthCard } from './FullWidthCard.tsx'
|
5
6
|
const StorybookEntry = {
|
6
7
|
argTypes: {},
|
7
8
|
component: FullWidthCard,
|
@@ -13,7 +14,7 @@ const StorybookEntry = {
|
|
13
14
|
title: 'shared/FullWidthCard',
|
14
15
|
} as Meta<typeof FullWidthCard>
|
15
16
|
|
16
|
-
const Template: StoryFn<typeof FullWidthCard> =
|
17
|
+
const Template: StoryFn<typeof FullWidthCard> = args => (
|
17
18
|
<BrowserRouter>
|
18
19
|
<FullWidthCard {...args}></FullWidthCard>
|
19
20
|
</BrowserRouter>
|
@@ -30,5 +31,4 @@ Default.args = {
|
|
30
31
|
|
31
32
|
export { Default }
|
32
33
|
|
33
|
-
// eslint-disable-next-line import/no-default-export
|
34
34
|
export default StorybookEntry
|
@@ -2,7 +2,7 @@ import { ArrowForwardRounded as ArrowForwardRoundedIcon } from '@mui/icons-mater
|
|
2
2
|
import { alpha, Card, CardActions, CardContent, CardMedia, CardProps, Grid, IconButton, Typography, useTheme, Zoom } from '@mui/material'
|
3
3
|
import { FlexGrowCol } from '@xylabs/react-flexbox'
|
4
4
|
import { useIsMobile } from '@xyo-network/react-shared'
|
5
|
-
import { ReactNode, useState } from 'react'
|
5
|
+
import React, { ReactNode, useState } from 'react'
|
6
6
|
import { To, useNavigate } from 'react-router-dom'
|
7
7
|
|
8
8
|
export interface FullWidthCardProps extends CardProps {
|
@@ -23,9 +23,11 @@ export const FullWidthCard: React.FC<FullWidthCardProps> = ({ cardIsButton, desc
|
|
23
23
|
const isMobile = useIsMobile()
|
24
24
|
|
25
25
|
const localRouteChange = (to: To | undefined) => {
|
26
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
|
26
27
|
to ? navigate(to) : navigate('/404')
|
27
28
|
}
|
28
29
|
const externalRouteChange = (href: string | undefined) => {
|
30
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
|
29
31
|
href ? window.open(href) : navigate('/404')
|
30
32
|
}
|
31
33
|
|
@@ -38,38 +40,43 @@ export const FullWidthCard: React.FC<FullWidthCardProps> = ({ cardIsButton, desc
|
|
38
40
|
'&:hover': {
|
39
41
|
cursor: 'pointer',
|
40
42
|
},
|
41
|
-
backgroundColor: alpha(theme.palette.primary.light, 0.05),
|
43
|
+
'backgroundColor': alpha(theme.palette.primary.light, 0.05),
|
42
44
|
}}
|
43
45
|
onMouseEnter={() =>
|
44
|
-
isMobile
|
45
|
-
|
46
|
-
|
47
|
-
|
46
|
+
isMobile
|
47
|
+
? null
|
48
|
+
: cardIsButton
|
49
|
+
? setRaised(true)
|
50
|
+
: null}
|
48
51
|
onMouseLeave={() =>
|
49
|
-
isMobile
|
50
|
-
|
51
|
-
|
52
|
-
|
52
|
+
isMobile
|
53
|
+
? null
|
54
|
+
: cardIsButton
|
55
|
+
? setRaised(false)
|
56
|
+
: null}
|
53
57
|
onClick={() =>
|
54
|
-
cardIsButton
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
58
|
+
cardIsButton
|
59
|
+
? href
|
60
|
+
? externalRouteChange(href)
|
61
|
+
: to
|
62
|
+
? localRouteChange(to)
|
63
|
+
: navigate('/404')
|
64
|
+
: null}
|
60
65
|
>
|
61
|
-
{media
|
62
|
-
<CardMedia component="img" height="100" image={media} alt="" />
|
63
|
-
|
66
|
+
{media
|
67
|
+
? <CardMedia component="img" height="100" image={media} alt="" />
|
68
|
+
: null}
|
64
69
|
|
65
70
|
<CardContent>
|
66
71
|
<Grid container alignItems="center" paddingY={2} paddingX={2}>
|
67
72
|
<Grid item xs={12} md={6}>
|
68
|
-
{typeof name === 'string'
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
+
{typeof name === 'string'
|
74
|
+
? (
|
75
|
+
<Typography fontWeight={700} variant="h2" textAlign="left" paddingBottom={1}>
|
76
|
+
{name}
|
77
|
+
</Typography>
|
78
|
+
)
|
79
|
+
: name}
|
73
80
|
</Grid>
|
74
81
|
<Grid item xs={12} md={5}>
|
75
82
|
<Typography variant="body1" fontWeight={400} textAlign="left">
|
@@ -82,10 +89,11 @@ export const FullWidthCard: React.FC<FullWidthCardProps> = ({ cardIsButton, desc
|
|
82
89
|
color="primary"
|
83
90
|
size={small ? 'small' : 'medium'}
|
84
91
|
onClick={() =>
|
85
|
-
href
|
86
|
-
|
87
|
-
|
88
|
-
|
92
|
+
href
|
93
|
+
? externalRouteChange(href)
|
94
|
+
: to
|
95
|
+
? localRouteChange(to)
|
96
|
+
: navigate('/404')}
|
89
97
|
disableFocusRipple
|
90
98
|
disableRipple
|
91
99
|
disableTouchRipple
|
@@ -102,10 +110,11 @@ export const FullWidthCard: React.FC<FullWidthCardProps> = ({ cardIsButton, desc
|
|
102
110
|
color="primary"
|
103
111
|
size={small ? 'small' : 'medium'}
|
104
112
|
onClick={() =>
|
105
|
-
href
|
106
|
-
|
107
|
-
|
108
|
-
|
113
|
+
href
|
114
|
+
? externalRouteChange(href)
|
115
|
+
: to
|
116
|
+
? localRouteChange(to)
|
117
|
+
: navigate('/404')}
|
109
118
|
disableFocusRipple
|
110
119
|
disableRipple
|
111
120
|
disableTouchRipple
|
@@ -1 +1 @@
|
|
1
|
-
export * from './FullWidthCard.
|
1
|
+
export * from './FullWidthCard.tsx'
|
@@ -1,10 +1,9 @@
|
|
1
|
-
/* eslint-disable import/no-internal-modules */
|
2
1
|
import { CardContent, Typography } from '@mui/material'
|
3
2
|
import { Meta, StoryFn } from '@storybook/react'
|
4
3
|
import { WithRefDecorator } from '@xyo-network/react-storybook'
|
5
|
-
import { useState } from 'react'
|
4
|
+
import React, { useState } from 'react'
|
6
5
|
|
7
|
-
import { PageCard } from './PageCard.
|
6
|
+
import { PageCard } from './PageCard.tsx'
|
8
7
|
|
9
8
|
const StorybookEntry: Meta = {
|
10
9
|
argTypes: {
|
@@ -29,7 +28,10 @@ const Template: StoryFn<typeof PageCard> = (props) => {
|
|
29
28
|
<PageCard title="Page Card" subheader="subheader" onRefresh={() => setRefreshedValue(Math.random())} {...props}>
|
30
29
|
<CardContent>
|
31
30
|
<Typography variant="body1">Page Card Content</Typography>
|
32
|
-
<Typography variant="body1">
|
31
|
+
<Typography variant="body1">
|
32
|
+
Refreshed Value:
|
33
|
+
{refreshedValue?.toString()}
|
34
|
+
</Typography>
|
33
35
|
</CardContent>
|
34
36
|
</PageCard>
|
35
37
|
)
|
@@ -62,5 +64,4 @@ WithRef.decorators = [WithRefDecorator]
|
|
62
64
|
|
63
65
|
export { Default, WithNoOnRefresh, WithRef }
|
64
66
|
|
65
|
-
// eslint-disable-next-line import/no-default-export
|
66
67
|
export default StorybookEntry
|