@canmingir/link 1.2.43 → 1.2.44

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@canmingir/link",
3
- "version": "1.2.43",
3
+ "version": "1.2.44",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./index.js",
@@ -1,24 +1,20 @@
1
- import { Box, Card, Divider, Typography } from "@mui/material";
2
- import { alpha, useTheme } from "@mui/material/styles";
1
+ import {
2
+ Card,
3
+ CardActions,
4
+ CardContent,
5
+ CardHeader,
6
+ Divider,
7
+ } from "@mui/material";
3
8
 
4
9
  import React from "react";
10
+ import { useTheme } from "@mui/material/styles";
5
11
 
6
- const GlassCard = ({
7
- width = "100%",
8
- height = "85vh",
9
- header,
10
- content,
11
- actions,
12
- contentSx = {},
13
- }) => {
12
+ const GlassCard = ({ children, sx = {}, ...props }) => {
14
13
  const theme = useTheme();
15
14
 
16
15
  return (
17
16
  <Card
18
17
  sx={{
19
- width: width || "100%",
20
- height: height || "85vh",
21
- flexShrink: 0,
22
18
  display: "flex",
23
19
  flexDirection: "column",
24
20
  background: `linear-gradient(135deg, ${theme.palette.primary.main}08 0%, ${theme.palette.secondary.main}05 100%)`,
@@ -26,70 +22,63 @@ const GlassCard = ({
26
22
  border: `1px solid ${theme.palette.divider}`,
27
23
  borderRadius: 2,
28
24
  overflow: "hidden",
25
+ ...sx,
29
26
  }}
27
+ {...props}
30
28
  >
31
- {header && (
32
- <>
33
- <Box
34
- sx={{
35
- display: "flex",
36
- alignItems: "center",
37
- justifyContent: "space-between",
38
- px: 2,
39
- py: 1.5,
40
- minHeight: 52,
41
- flexShrink: 0,
42
- }}
43
- >
44
- <Box sx={{ minWidth: 0, flex: 1 }}>
45
- <Typography
46
- variant="subtitle2"
47
- noWrap
48
- sx={{
49
- fontWeight: 600,
50
- color: "text.primary",
51
- lineHeight: 1.3,
52
- }}
53
- >
54
- {header.title}
55
- </Typography>
56
- {header.subtitle && (
57
- <Typography
58
- variant="caption"
59
- noWrap
60
- sx={{
61
- color: "text.secondary",
62
- lineHeight: 1.3,
63
- display: "block",
64
- }}
65
- >
66
- {header.subtitle}
67
- </Typography>
68
- )}
69
- </Box>
70
- {actions && <Box sx={{ ml: 1, flexShrink: 0 }}>{actions}</Box>}
71
- </Box>
72
- <Divider />
73
- </>
74
- )}
75
-
76
- <Box
77
- sx={{
78
- flex: 1,
79
- overflow: "auto",
80
- position: "relative",
81
- ...contentSx,
82
- }}
83
- >
84
- {!header && actions && (
85
- <Box sx={{ position: "absolute", top: 8, right: 8, zIndex: 1 }}>
86
- {actions}
87
- </Box>
88
- )}
89
- {content}
90
- </Box>
29
+ {children}
91
30
  </Card>
92
31
  );
93
32
  };
94
33
 
34
+ const GlassCardHeader = ({ divider = true, sx = {}, ...props }) => (
35
+ <>
36
+ <CardHeader
37
+ sx={{
38
+ px: 1.5,
39
+ py: 0.75,
40
+ "& .MuiCardHeader-title": {
41
+ fontSize: "0.8125rem",
42
+ fontWeight: 600,
43
+ lineHeight: 1.3,
44
+ },
45
+ "& .MuiCardHeader-subheader": {
46
+ fontSize: "0.75rem",
47
+ lineHeight: 1.3,
48
+ },
49
+ ...sx,
50
+ }}
51
+ {...props}
52
+ />
53
+ {divider && <Divider />}
54
+ </>
55
+ );
56
+
57
+ const GlassCardContent = ({ sx = {}, ...props }) => (
58
+ <CardContent
59
+ sx={{
60
+ flex: 1,
61
+ overflow: "auto",
62
+ position: "relative",
63
+ p: 0,
64
+ "&:last-child": { pb: 0 },
65
+ ...sx,
66
+ }}
67
+ {...props}
68
+ />
69
+ );
70
+
71
+ const GlassCardActions = ({ sx = {}, ...props }) => (
72
+ <CardActions
73
+ sx={{
74
+ px: 1.5,
75
+ py: 0.75,
76
+ flexShrink: 0,
77
+ ...sx,
78
+ }}
79
+ {...props}
80
+ />
81
+ );
82
+
83
+ export { GlassCardHeader, GlassCardContent, GlassCardActions };
95
84
  export default GlassCard;
@@ -1 +1 @@
1
- export { default } from "./GlassCard";
1
+ export { default, GlassCardHeader, GlassCardContent, GlassCardActions } from "./GlassCard";
package/src/lib/index.js CHANGED
@@ -49,4 +49,9 @@ export { default as Schema } from "./Schema";
49
49
  export { default as SchemaEditor } from "./SchemaEditor";
50
50
  export { default as ToggleableMenu } from "./ToggleableMenu";
51
51
  export { default as APIBody } from "./NewApiBody/NewAPIBody";
52
- export { default as GlassCard } from "./GlassCard/GlassCard";
52
+ export {
53
+ default as GlassCard,
54
+ GlassCardHeader,
55
+ GlassCardContent,
56
+ GlassCardActions,
57
+ } from "./GlassCard/GlassCard";