@canmingir/link 1.2.43 → 1.2.48

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.48",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./index.js",
@@ -1,18 +1,18 @@
1
+ import React, { useEffect, useRef, useState } from "react";
2
+
1
3
  import Box from "@mui/material/Box";
2
4
  import Link from "@mui/material/Link";
3
5
  import { RouterLink } from "../../routes/components";
4
6
  import config from "../../config/config";
5
7
 
6
- import React, { useEffect, useRef, useState } from "react";
7
-
8
8
  const resolvedDimensions = {};
9
9
 
10
10
  const Logo = ({ disabledLink = false, sx, maxSize = 65, isLogin = false }) => {
11
11
  const { icon } = config().template.login;
12
- const key = `${icon}`;
12
+ const key = `${icon}_${maxSize}_${isLogin}`;
13
13
 
14
14
  const [dimensions, setDimensions] = useState(
15
- resolvedDimensions[key] || { width: maxSize, height: maxSize }
15
+ resolvedDimensions[key] || { width: maxSize, height: maxSize },
16
16
  );
17
17
 
18
18
  useEffect(() => {
@@ -0,0 +1,117 @@
1
+ import { Box, Divider } from "@mui/material";
2
+
3
+ import React from "react";
4
+
5
+ const DevTool = ({
6
+ width = 62,
7
+ height = "auto",
8
+ top = "50%",
9
+ open = true,
10
+ content,
11
+ header,
12
+ footer,
13
+ sx,
14
+ }) => {
15
+ if (!open) return null;
16
+
17
+ return (
18
+ <Box
19
+ component="aside"
20
+ sx={{
21
+ position: "fixed",
22
+ top,
23
+ right: 0,
24
+ transform: "translateY(-50%)",
25
+ width,
26
+ height,
27
+ bgcolor: (theme) =>
28
+ theme.palette.mode === "dark"
29
+ ? "background.paper"
30
+ : "rgba(255, 255, 255, 0.85)",
31
+ backdropFilter: "blur(16px) saturate(180%)",
32
+ WebkitBackdropFilter: "blur(16px) saturate(180%)",
33
+ border: (theme) =>
34
+ `1px solid ${
35
+ theme.palette.mode === "dark"
36
+ ? "rgba(255,255,255,0.07)"
37
+ : "rgba(0,0,0,0.07)"
38
+ }`,
39
+ borderRadius: "4px",
40
+ boxShadow: (theme) =>
41
+ theme.palette.mode === "dark"
42
+ ? "0 8px 32px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.04)"
43
+ : "0 8px 32px rgba(0,0,0,0.12), 0 0 0 1px rgba(0,0,0,0.04)",
44
+ zIndex: (theme) => theme.zIndex.modal + 3,
45
+ display: "flex",
46
+ flexDirection: "column",
47
+ alignItems: "center",
48
+ py: 1.5,
49
+ overflowY: "hidden",
50
+ overflowX: "hidden",
51
+ "&::-webkit-scrollbar": { display: "none" },
52
+ scrollbarWidth: "none",
53
+ ...(sx || {}),
54
+ }}
55
+ >
56
+ {header && (
57
+ <Box
58
+ sx={{
59
+ width: "100%",
60
+ display: "flex",
61
+ flexDirection: "column",
62
+ alignItems: "center",
63
+ flexShrink: 0,
64
+ }}
65
+ >
66
+ {header}
67
+ </Box>
68
+ )}
69
+
70
+ <Box
71
+ sx={{
72
+ flex: 1,
73
+ width: "100%",
74
+ display: "flex",
75
+ flexDirection: "column",
76
+ alignItems: "center",
77
+ overflowY: "auto",
78
+ overflowX: "hidden",
79
+ "&::-webkit-scrollbar": { display: "none" },
80
+ scrollbarWidth: "none",
81
+ }}
82
+ >
83
+ {content}
84
+ </Box>
85
+
86
+ {footer && (
87
+ <>
88
+ <Divider
89
+ flexItem
90
+ sx={{
91
+ borderColor: (theme) =>
92
+ theme.palette.mode === "dark"
93
+ ? "rgba(255,255,255,0.07)"
94
+ : "rgba(0,0,0,0.07)",
95
+ width: "100%",
96
+ flexShrink: 0,
97
+ }}
98
+ />
99
+ <Box
100
+ sx={{
101
+ width: "100%",
102
+ display: "flex",
103
+ flexDirection: "column",
104
+ alignItems: "center",
105
+ flexShrink: 0,
106
+ pt: 0.5,
107
+ }}
108
+ >
109
+ {footer}
110
+ </Box>
111
+ </>
112
+ )}
113
+ </Box>
114
+ );
115
+ };
116
+
117
+ export default DevTool;
@@ -0,0 +1 @@
1
+ export { default } from "./DevTool";
@@ -8,7 +8,7 @@ const DraggableNode = ({
8
8
  registerRef,
9
9
  onDrag,
10
10
  nodeId,
11
- selectionColor = "#64748b",
11
+ selectionColor = "#373739",
12
12
  initialPosition,
13
13
  onConnect,
14
14
  }) => {
@@ -164,20 +164,55 @@ const DraggableNode = ({
164
164
  transform: `translate(${offset.x}px, ${offset.y}px)`,
165
165
  cursor: "grab",
166
166
  "&:active": { cursor: "grabbing" },
167
- ...(selected && {
168
- "&::after": {
169
- content: '""',
170
- position: "absolute",
171
- inset: -6,
172
- border: `2px solid ${selectionColor}`,
173
- borderRadius: "12px",
174
- pointerEvents: "none",
175
- boxShadow: `0 0 8px ${selectionColor}66`,
176
- },
177
- }),
178
167
  }}
179
168
  >
180
169
  {children}
170
+ {selected &&
171
+ selectedIds.size > 1 &&
172
+ [
173
+ {
174
+ top: -10,
175
+ left: -6,
176
+ borderTop: 2,
177
+ borderLeft: 2,
178
+ color: selectionColor,
179
+ },
180
+ {
181
+ top: -8,
182
+ right: -12,
183
+ borderTop: 2,
184
+ borderRight: 2,
185
+ color: selectionColor,
186
+ },
187
+ {
188
+ bottom: -14,
189
+ left: -6,
190
+ borderBottom: 2,
191
+ borderLeft: 2,
192
+ color: selectionColor,
193
+ },
194
+ {
195
+ bottom: -16,
196
+ right: -12,
197
+ borderBottom: 2,
198
+ borderRight: 2,
199
+ color: selectionColor,
200
+ },
201
+ ].map((pos, i) => (
202
+ <Box
203
+ key={i}
204
+ sx={{
205
+ position: "absolute",
206
+ width: 10,
207
+ height: 10,
208
+ borderStyle: "solid",
209
+ borderColor: selectionColor,
210
+ borderWidth: 0,
211
+ pointerEvents: "none",
212
+ ...pos,
213
+ }}
214
+ />
215
+ ))}
181
216
  </Box>
182
217
  );
183
218
  };
@@ -1,6 +1,49 @@
1
1
  import { Box } from "@mui/material";
2
2
  import { hexToRgba } from "../utils/flowUtils";
3
3
 
4
+ const HANDLE_SIZE = 10;
5
+ const HANDLE_THICKNESS = 2;
6
+
7
+ const cornerStyles = (placement) => {
8
+ const base = {
9
+ position: "absolute",
10
+ width: HANDLE_SIZE,
11
+ height: HANDLE_SIZE,
12
+ borderColor: "inherit",
13
+ borderStyle: "solid",
14
+ borderWidth: 0,
15
+ };
16
+
17
+ const map = {
18
+ topLeft: {
19
+ top: 0,
20
+ left: 0,
21
+ borderTopWidth: HANDLE_THICKNESS,
22
+ borderLeftWidth: HANDLE_THICKNESS,
23
+ },
24
+ topRight: {
25
+ top: 0,
26
+ right: 0,
27
+ borderTopWidth: HANDLE_THICKNESS,
28
+ borderRightWidth: HANDLE_THICKNESS,
29
+ },
30
+ bottomLeft: {
31
+ bottom: 0,
32
+ left: 0,
33
+ borderBottomWidth: HANDLE_THICKNESS,
34
+ borderLeftWidth: HANDLE_THICKNESS,
35
+ },
36
+ bottomRight: {
37
+ bottom: 0,
38
+ right: 0,
39
+ borderBottomWidth: HANDLE_THICKNESS,
40
+ borderRightWidth: HANDLE_THICKNESS,
41
+ },
42
+ };
43
+
44
+ return { ...base, ...map[placement] };
45
+ };
46
+
4
47
  const SelectionOverlay = ({ box, selectionColor = "#64748b" }) => {
5
48
  if (!box) return null;
6
49
 
@@ -18,13 +61,17 @@ const SelectionOverlay = ({ box, selectionColor = "#64748b" }) => {
18
61
  top,
19
62
  width,
20
63
  height,
21
- border: `2px solid ${selectionColor}`,
22
- backgroundColor: hexToRgba(selectionColor, 0.1),
64
+ backgroundColor: hexToRgba(selectionColor, 0.08),
23
65
  pointerEvents: "none",
24
66
  zIndex: 9999,
25
67
  borderRadius: "4px",
68
+ color: selectionColor,
26
69
  }}
27
- />
70
+ >
71
+ {["topLeft", "topRight", "bottomLeft", "bottomRight"].map((placement) => (
72
+ <Box key={placement} sx={cornerStyles(placement)} />
73
+ ))}
74
+ </Box>
28
75
  );
29
76
  };
30
77
 
@@ -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,10 @@ 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";
58
+ export { default as DevTool } from "./DevTool";