@canmingir/link 1.2.30 → 1.2.32

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,11 +1,14 @@
1
- import Button from "@mui/material/Button";
2
- import Dialog from "@mui/material/Dialog";
3
- import DialogActions from "@mui/material/DialogActions";
4
- import DialogContent from "@mui/material/DialogContent";
5
- import DialogTitle from "@mui/material/DialogTitle";
6
- import { Typography } from "@mui/material";
7
1
  import { forwardRef } from "react";
8
2
 
3
+ import {
4
+ Button,
5
+ Dialog,
6
+ DialogActions,
7
+ DialogContent,
8
+ DialogTitle,
9
+ Typography,
10
+ } from "@mui/material";
11
+
9
12
  const DeleteResourceDialog = forwardRef(({ setOpen, deleteResource }, ref) => {
10
13
  const resource = ref.current;
11
14
 
@@ -1,14 +1,11 @@
1
1
  import AlertMassage from "./AlertMassage";
2
- import DeleteIcon from "@mui/icons-material/Delete";
3
2
  import DeleteResourceDialog from "./DeleteResourceDialog";
4
- import Fade from "@mui/material/Fade";
5
- import HttpIcon from "@mui/icons-material/Http";
6
3
  import React from "react";
7
- import SourceIcon from "@mui/icons-material/Source";
8
4
  import styles from "./styles";
9
5
  import { useRef } from "react";
10
6
 
11
- import { Divider, Menu, MenuItem, Typography } from "@mui/material";
7
+ import { Delete, Http, Source } from "@mui/icons-material";
8
+ import { Divider, Fade, Menu, MenuItem, Typography } from "@mui/material";
12
9
  import { publish, useEvent } from "@nucleoidai/react-event";
13
10
 
14
11
  const ResourceMenu = (props) => {
@@ -130,7 +127,7 @@ const ResourceMenu = (props) => {
130
127
  }}
131
128
  >
132
129
  <MenuItem onClick={addResource} data-cy="add-resource">
133
- <SourceIcon />
130
+ <Source />
134
131
  <Typography sx={styles.menuItemText}>Resource</Typography>
135
132
  </MenuItem>
136
133
  <MenuItem
@@ -138,7 +135,7 @@ const ResourceMenu = (props) => {
138
135
  disabled={methodDisabled}
139
136
  data-cy="add-method"
140
137
  >
141
- <HttpIcon />
138
+ <Http />
142
139
  <Typography sx={styles.menuItemText}>Method</Typography>
143
140
  </MenuItem>
144
141
  <Divider />
@@ -147,7 +144,7 @@ const ResourceMenu = (props) => {
147
144
  disabled={selectedAPI?.path === "/"}
148
145
  data-cy="delete-resource"
149
146
  >
150
- <DeleteIcon />
147
+ <Delete />
151
148
  <Typography sx={styles.menuItemText}>Delete</Typography>
152
149
  </MenuItem>
153
150
  </Menu>
@@ -1,11 +1,10 @@
1
- import ChevronRightIcon from "@mui/icons-material/ChevronRight";
2
- import ExpandMoreIcon from "@mui/icons-material/ExpandMore";
1
+ import { SimpleTreeView } from "@mui/x-tree-view/SimpleTreeView";
2
+ import { TreeItem } from "@mui/x-tree-view/TreeItem";
3
3
  import { v4 as uuidv4 } from "uuid";
4
4
 
5
5
  import { Box, Typography } from "@mui/material";
6
+ import { ChevronRight, ExpandMore } from "@mui/icons-material";
6
7
  import React, { useEffect, useState } from "react";
7
- import { SimpleTreeView } from "@mui/x-tree-view/SimpleTreeView";
8
- import { TreeItem } from "@mui/x-tree-view/TreeItem";
9
8
 
10
9
  const Schema = ({ initialData = {}, customTypes = [] }) => {
11
10
  const [schemaData, setSchemaData] = useState({});
@@ -159,8 +158,8 @@ const Schema = ({ initialData = {}, customTypes = [] }) => {
159
158
  return (
160
159
  <SimpleTreeView
161
160
  slots={{
162
- collapseIcon: () => <ExpandMoreIcon />,
163
- expandIcon: () => <ChevronRightIcon />,
161
+ collapseIcon: () => <ExpandMore />,
162
+ expandIcon: () => <ChevronRight />,
164
163
  }}
165
164
  defaultExpandedItems={["1"]}
166
165
  sx={{
@@ -1,15 +1,17 @@
1
- import AddCircleOutlineIcon from "@mui/icons-material/AddCircleOutline";
2
- import ChevronRightIcon from "@mui/icons-material/ChevronRight";
3
- import ExpandMoreIcon from "@mui/icons-material/ExpandMore";
4
1
  import IconButton from "@mui/material/IconButton";
5
- import RemoveCircleOutlineIcon from "@mui/icons-material/RemoveCircleOutline";
6
2
  import SchemaPropertyEditor from "./SchemaPropertyEditor";
3
+ import { SimpleTreeView } from "@mui/x-tree-view/SimpleTreeView";
4
+ import { TreeItem } from "@mui/x-tree-view/TreeItem";
7
5
  import { v4 as uuidv4 } from "uuid";
8
6
 
7
+ import {
8
+ AddCircleOutline,
9
+ ChevronRight,
10
+ ExpandMore,
11
+ RemoveCircleOutline,
12
+ } from "@mui/icons-material";
9
13
  import { Box, Typography } from "@mui/material";
10
14
  import React, { forwardRef, useEffect, useState } from "react";
11
- import { SimpleTreeView } from "@mui/x-tree-view/SimpleTreeView";
12
- import { TreeItem } from "@mui/x-tree-view/TreeItem";
13
15
  import { addProperty, changeProperty, removeProperty } from "./SchemaUtils";
14
16
 
15
17
  const SchemaEditor = forwardRef(
@@ -109,7 +111,7 @@ const SchemaEditor = forwardRef(
109
111
  }}
110
112
  data-cy={`add-property-button-${node.id}`}
111
113
  >
112
- <AddCircleOutlineIcon fontSize="small" />
114
+ <AddCircleOutline fontSize="small" />
113
115
  </IconButton>
114
116
  )}
115
117
  </Box>
@@ -128,7 +130,7 @@ const SchemaEditor = forwardRef(
128
130
  color: (theme) => theme.palette.grey[600],
129
131
  }}
130
132
  >
131
- <RemoveCircleOutlineIcon fontSize="small" />
133
+ <RemoveCircleOutline fontSize="small" />
132
134
  </IconButton>
133
135
  )}
134
136
  </Box>
@@ -212,8 +214,8 @@ const SchemaEditor = forwardRef(
212
214
  return (
213
215
  <SimpleTreeView
214
216
  slots={{
215
- collapseIcon: () => <ExpandMoreIcon data-cy="collapse-icon" />,
216
- expandIcon: () => <ChevronRightIcon data-cy="expand-icon" />,
217
+ collapseIcon: () => <ExpandMore data-cy="collapse-icon" />,
218
+ expandIcon: () => <ChevronRight data-cy="expand-icon" />,
217
219
  }}
218
220
  defaultExpandedItems={["1"]}
219
221
  sx={{
package/src/lib/index.js CHANGED
@@ -48,3 +48,4 @@ export { default as ResourceMenu } from "./ResourceMenu";
48
48
  export { default as Schema } from "./Schema";
49
49
  export { default as SchemaEditor } from "./SchemaEditor";
50
50
  export { default as ToggleableMenu } from "./ToggleableMenu";
51
+ export { default as APIBody } from "./NewApiBody/NewAPIBody";
@@ -7,9 +7,11 @@ import config from "../config/config";
7
7
  import { storage } from "@nucleoidjs/webstorage";
8
8
  import { useEffect } from "react";
9
9
  import { useNavigate } from "react-router-dom";
10
+
11
+ import { Box, Stack, Typography, alpha } from "@mui/material";
12
+
10
13
  function LoginPage() {
11
14
  const { name, template, credentials } = config();
12
- const formColor = "#a8a9ad";
13
15
  const navigate = useNavigate();
14
16
 
15
17
  function token() {
@@ -32,10 +34,78 @@ function LoginPage() {
32
34
 
33
35
  return (
34
36
  <Page title={`Sign in to ${name}`}>
37
+ <Stack
38
+ spacing={0}
39
+ sx={{
40
+ mb: 4,
41
+ position: "relative",
42
+ }}
43
+ >
44
+ <Typography
45
+ variant="overline"
46
+ sx={{
47
+ color: "primary.main",
48
+ fontWeight: 700,
49
+ letterSpacing: "0.2em",
50
+ fontSize: "0.65rem",
51
+ mb: 1,
52
+ }}
53
+ >
54
+ {name}
55
+ </Typography>
56
+
57
+ <Typography
58
+ variant="h3"
59
+ sx={{ fontWeight: 800, lineHeight: 1.1, letterSpacing: "-0.02em" }}
60
+ >
61
+ Welcome{" "}
62
+ <Box
63
+ component="span"
64
+ sx={{
65
+ background: (theme) =>
66
+ `linear-gradient(135deg, ${theme.palette.primary.main}, ${theme.palette.primary.light})`,
67
+ backgroundClip: "text",
68
+ WebkitBackgroundClip: "text",
69
+ WebkitTextFillColor: "transparent",
70
+ }}
71
+ >
72
+ back.
73
+ </Box>
74
+ </Typography>
75
+
76
+ <Typography variant="body2" sx={{ color: "text.secondary", mt: 1.5 }}>
77
+ Enter your credentials to access the platform.
78
+ </Typography>
79
+
80
+ <Box
81
+ sx={{
82
+ mt: 2,
83
+ width: 32,
84
+ height: 3,
85
+ borderRadius: 2,
86
+ bgcolor: "primary.main",
87
+ }}
88
+ />
89
+ </Stack>
90
+
35
91
  {credentials?.provider === "COGNITO" && <CognitoLogin />}
36
92
  {credentials?.provider === "DEMO" && <DemoLogin />}
37
93
 
38
- <LoginForm icon={template.login.icon} name={name} formColor={formColor} />
94
+ <LoginForm icon={template.login.icon} name={name} formColor="#a8a9ad" />
95
+
96
+ <Box
97
+ sx={{
98
+ mt: 4,
99
+ pt: 3,
100
+ borderTop: (theme) =>
101
+ `1px solid ${alpha(theme.palette.divider, 0.5)}`,
102
+ textAlign: "center",
103
+ }}
104
+ >
105
+ <Typography variant="caption" sx={{ color: "text.disabled" }}>
106
+ Secure · Encrypted · Private
107
+ </Typography>
108
+ </Box>
39
109
  </Page>
40
110
  );
41
111
  }
@@ -15,31 +15,13 @@ import {
15
15
  alpha,
16
16
  } from "@mui/material";
17
17
  import {
18
- CheckOutlined,
19
- EmailOutlined,
20
18
  LockOutlined,
21
19
  MarkEmailReadOutlined,
22
20
  Visibility,
23
21
  VisibilityOff,
24
22
  } from "@mui/icons-material";
25
23
  import { confirmSignup, getTokens, login, signup } from "./amplifyAuth";
26
-
27
- const inputSx = {
28
- "& .MuiOutlinedInput-root": {
29
- fontSize: "1rem",
30
- "& input": { py: 1.5 },
31
- "&:hover fieldset": { borderColor: "primary.main" },
32
- },
33
- };
34
-
35
- const primaryButtonSx = {
36
- py: 1.5,
37
- fontSize: "1rem",
38
- fontWeight: 600,
39
- textTransform: "none",
40
- borderRadius: 1.5,
41
- "&:active": { transform: "translateY(0px)" },
42
- };
24
+ import { inputSx, primaryButtonSx } from "./styles";
43
25
 
44
26
  export default function CognitoLogin() {
45
27
  const [mode, setMode] = useState("login");
@@ -159,58 +141,49 @@ export default function CognitoLogin() {
159
141
 
160
142
  return (
161
143
  <Stack spacing={3} sx={{ mb: 2 }}>
162
- <Box sx={{ textAlign: "center" }}>
144
+ <Box sx={{ display: "flex", alignItems: "center", gap: 1.5 }}>
163
145
  <Box
164
146
  sx={{
165
- width: 52,
166
- height: 52,
167
- borderRadius: 2,
147
+ width: 40,
148
+ height: 40,
149
+ borderRadius: 1.5,
168
150
  display: "inline-flex",
169
151
  alignItems: "center",
170
152
  justifyContent: "center",
171
- mb: 2,
153
+ flexShrink: 0,
172
154
  bgcolor: (theme) => alpha(theme.palette.primary.main, 0.1),
173
155
  color: "primary.main",
174
156
  }}
175
157
  >
176
158
  {mode === "confirm" ? (
177
- <MarkEmailReadOutlined sx={{ fontSize: 26 }} />
159
+ <MarkEmailReadOutlined sx={{ fontSize: 22 }} />
178
160
  ) : (
179
- <LockOutlined sx={{ fontSize: 26 }} />
161
+ <LockOutlined sx={{ fontSize: 22 }} />
180
162
  )}
181
163
  </Box>
182
-
183
- <Typography variant="h4" gutterBottom sx={{
184
- fontWeight: 700
185
- }}>
186
- {titles[mode].heading}
187
- </Typography>
188
- <Typography variant="body2" sx={{
189
- color: "text.secondary"
190
- }}>
191
- {titles[mode].sub}
192
- </Typography>
164
+ <Box>
165
+ <Typography variant="h6" sx={{ fontWeight: 700, lineHeight: 1.2 }}>
166
+ {titles[mode].heading}
167
+ </Typography>
168
+ <Typography variant="caption" sx={{ color: "text.secondary" }}>
169
+ {titles[mode].sub}
170
+ </Typography>
171
+ </Box>
193
172
  </Box>
194
- <Stack spacing={2}>
173
+ <Stack spacing={1.5}>
195
174
  <TextField
175
+ variant="filled"
196
176
  label="Email"
197
177
  value={email}
198
178
  onChange={(e) => setEmail(e.target.value)}
199
179
  fullWidth
200
180
  sx={inputSx}
201
- slotProps={{
202
- input: {
203
- startAdornment: (
204
- <InputAdornment position="start">
205
- <EmailOutlined sx={{ color: "text.secondary", fontSize: 22 }} />
206
- </InputAdornment>
207
- ),
208
- }
209
- }}
181
+ slotProps={{ input: { disableUnderline: true } }}
210
182
  />
211
183
 
212
184
  {mode !== "confirm" && (
213
185
  <TextField
186
+ variant="filled"
214
187
  type={showPassword ? "text" : "password"}
215
188
  label="Password"
216
189
  value={password}
@@ -219,21 +192,16 @@ export default function CognitoLogin() {
219
192
  sx={inputSx}
220
193
  slotProps={{
221
194
  input: {
222
- startAdornment: (
223
- <InputAdornment position="start">
224
- <LockOutlined
225
- sx={{ color: "text.secondary", fontSize: 22 }}
226
- />
227
- </InputAdornment>
228
- ),
195
+ disableUnderline: true,
229
196
  endAdornment: passwordAdornment,
230
- }
197
+ },
231
198
  }}
232
199
  />
233
200
  )}
234
201
 
235
202
  {mode === "signup" && (
236
203
  <TextField
204
+ variant="filled"
237
205
  type={showConfirmPassword ? "text" : "password"}
238
206
  label="Confirm Password"
239
207
  value={confirmPassword}
@@ -242,17 +210,13 @@ export default function CognitoLogin() {
242
210
  sx={inputSx}
243
211
  slotProps={{
244
212
  input: {
245
- startAdornment: (
246
- <InputAdornment position="start">
247
- <LockOutlined
248
- sx={{ color: "text.secondary", fontSize: 22 }}
249
- />
250
- </InputAdornment>
251
- ),
213
+ disableUnderline: true,
252
214
  endAdornment: (
253
215
  <InputAdornment position="end">
254
216
  <IconButton
255
- onClick={() => setShowConfirmPassword(!showConfirmPassword)}
217
+ onClick={() =>
218
+ setShowConfirmPassword(!showConfirmPassword)
219
+ }
256
220
  edge="end"
257
221
  size="small"
258
222
  tabIndex={-1}
@@ -261,29 +225,20 @@ export default function CognitoLogin() {
261
225
  </IconButton>
262
226
  </InputAdornment>
263
227
  ),
264
- }
228
+ },
265
229
  }}
266
230
  />
267
231
  )}
268
232
 
269
233
  {mode === "confirm" && (
270
234
  <TextField
235
+ variant="filled"
271
236
  label="Confirmation Code"
272
237
  value={code}
273
238
  onChange={(e) => setCode(e.target.value)}
274
239
  fullWidth
275
240
  sx={inputSx}
276
- slotProps={{
277
- input: {
278
- startAdornment: (
279
- <InputAdornment position="start">
280
- <CheckOutlined
281
- sx={{ color: "text.secondary", fontSize: 22 }}
282
- />
283
- </InputAdornment>
284
- ),
285
- }
286
- }}
241
+ slotProps={{ input: { disableUnderline: true } }}
287
242
  />
288
243
  )}
289
244
  </Stack>
@@ -294,16 +249,21 @@ export default function CognitoLogin() {
294
249
  onClick={handleLogin}
295
250
  size="large"
296
251
  fullWidth
252
+ disableElevation
297
253
  sx={primaryButtonSx}
298
254
  >
299
- Sign in
255
+ Sign in &rarr;
300
256
  </Button>
301
257
  <Button
302
258
  onClick={() => setMode("signup")}
303
259
  fullWidth
304
- sx={{ textTransform: "none", fontWeight: 500 }}
260
+ sx={{
261
+ textTransform: "none",
262
+ fontWeight: 600,
263
+ color: "text.secondary",
264
+ }}
305
265
  >
306
- Create an account
266
+ No account? Create one
307
267
  </Button>
308
268
  </Stack>
309
269
  )}
@@ -314,16 +274,21 @@ export default function CognitoLogin() {
314
274
  onClick={handleSignup}
315
275
  size="large"
316
276
  fullWidth
277
+ disableElevation
317
278
  sx={primaryButtonSx}
318
279
  >
319
- Sign Up
280
+ Create account &rarr;
320
281
  </Button>
321
282
  <Button
322
283
  onClick={() => setMode("login")}
323
284
  fullWidth
324
- sx={{ textTransform: "none", fontWeight: 500 }}
285
+ sx={{
286
+ textTransform: "none",
287
+ fontWeight: 600,
288
+ color: "text.secondary",
289
+ }}
325
290
  >
326
- Back to login
291
+ &larr; Back to sign in
327
292
  </Button>
328
293
  </Stack>
329
294
  )}
@@ -333,9 +298,10 @@ export default function CognitoLogin() {
333
298
  onClick={handleConfirm}
334
299
  size="large"
335
300
  fullWidth
301
+ disableElevation
336
302
  sx={primaryButtonSx}
337
303
  >
338
- Confirm
304
+ Verify &rarr;
339
305
  </Button>
340
306
  )}
341
307
  </Stack>
@@ -12,13 +12,9 @@ import {
12
12
  Typography,
13
13
  alpha,
14
14
  } from "@mui/material";
15
- import {
16
- LockOutlined,
17
- PersonOutline,
18
- Visibility,
19
- VisibilityOff,
20
- } from "@mui/icons-material";
21
15
  import React, { useState } from "react";
16
+ import { Visibility, VisibilityOff } from "@mui/icons-material";
17
+ import { inputSx, primaryButtonSx } from "./styles";
22
18
 
23
19
  export default function DemoLogin() {
24
20
  const [username, setUsername] = useState("");
@@ -56,51 +52,25 @@ export default function DemoLogin() {
56
52
 
57
53
  return (
58
54
  <Stack spacing={2.5} sx={{ mb: 2 }}>
59
- <Stack spacing={2}>
55
+ <Stack spacing={1.5}>
60
56
  <TextField
57
+ variant="filled"
61
58
  label="Username"
62
59
  value={username}
63
60
  onChange={(e) => setUsername(e.target.value)}
64
61
  fullWidth
65
- sx={{
66
- "& .MuiOutlinedInput-root": {
67
- fontSize: "1rem",
68
- "& input": {
69
- py: 1.5,
70
- },
71
- "&:hover fieldset": {
72
- borderColor: "primary.main",
73
- },
74
- },
75
- }}
76
- slotProps={{
77
- input: {
78
- startAdornment: (
79
- <InputAdornment position="start">
80
- <PersonOutline sx={{ color: "text.secondary", fontSize: 22 }} />
81
- </InputAdornment>
82
- ),
83
- }
84
- }}
62
+ sx={inputSx}
63
+ slotProps={{ input: { disableUnderline: true } }}
85
64
  />
86
65
 
87
66
  <TextField
67
+ variant="filled"
88
68
  label="Password"
89
69
  type={showPassword ? "text" : "password"}
90
70
  value={password}
91
71
  onChange={(e) => setPassword(e.target.value)}
92
72
  fullWidth
93
- sx={{
94
- "& .MuiOutlinedInput-root": {
95
- fontSize: "1rem",
96
- "& input": {
97
- py: 1.5,
98
- },
99
- "&:hover fieldset": {
100
- borderColor: "primary.main",
101
- },
102
- },
103
- }}
73
+ sx={inputSx}
104
74
  onKeyPress={(e) => {
105
75
  if (e.key === "Enter") {
106
76
  handleLogin();
@@ -108,11 +78,7 @@ export default function DemoLogin() {
108
78
  }}
109
79
  slotProps={{
110
80
  input: {
111
- startAdornment: (
112
- <InputAdornment position="start">
113
- <LockOutlined sx={{ color: "text.secondary", fontSize: 22 }} />
114
- </InputAdornment>
115
- ),
81
+ disableUnderline: true,
116
82
  endAdornment: (
117
83
  <InputAdornment position="end">
118
84
  <IconButton
@@ -125,56 +91,37 @@ export default function DemoLogin() {
125
91
  </IconButton>
126
92
  </InputAdornment>
127
93
  ),
128
- }
94
+ },
129
95
  }}
130
96
  />
131
97
  </Stack>
98
+
132
99
  <Button
133
100
  variant="contained"
134
101
  onClick={handleLogin}
135
102
  size="large"
136
103
  fullWidth
137
- sx={{
138
- mt: 1,
139
- py: 1.5,
140
- fontSize: "1rem",
141
- fontWeight: 600,
142
- textTransform: "none",
143
- borderRadius: 1.5,
144
- boxShadow: (theme) =>
145
- `0 8px 16px ${alpha(theme.palette.primary.main, 0.24)}`,
146
- transition: "all 0.2s cubic-bezier(0.4, 0, 0.2, 1)",
147
- "&:hover": {
148
- transform: "translateY(-2px)",
149
- boxShadow: (theme) =>
150
- `0 12px 24px ${alpha(theme.palette.primary.main, 0.32)}`,
151
- },
152
- "&:active": {
153
- transform: "translateY(0px)",
154
- },
155
- }}
104
+ disableElevation
105
+ sx={primaryButtonSx}
156
106
  >
157
- Sign in
107
+ Sign in &rarr;
158
108
  </Button>
159
- <Box
160
- sx={{
161
- mt: 1,
162
- textAlign: "center",
163
- p: 2,
164
- borderRadius: 1.5,
165
- bgcolor: (theme) => alpha(theme.palette.info.main, 0.08),
166
- border: (theme) =>
167
- `1px dashed ${alpha(theme.palette.info.main, 0.24)}`,
168
- }}
169
- >
170
- <Typography
171
- variant="caption"
172
- sx={{
173
- color: "text.secondary",
174
- fontSize: "0.8125rem"
175
- }}>
176
- Demo credentials:{" "}
177
- <Box component="strong" sx={{ color: "text.primary" }}>
109
+
110
+ <Box sx={{ display: "flex", justifyContent: "center" }}>
111
+ <Typography variant="caption" sx={{ color: "text.disabled" }}>
112
+ Demo credentials:&nbsp;
113
+ <Box
114
+ component="span"
115
+ sx={{
116
+ color: "text.secondary",
117
+ fontWeight: 600,
118
+ fontFamily: "monospace",
119
+ px: 0.5,
120
+ py: 0.25,
121
+ borderRadius: 0.5,
122
+ bgcolor: (theme) => alpha(theme.palette.grey[500], 0.1),
123
+ }}
124
+ >
178
125
  admin / admin
179
126
  </Box>
180
127
  </Typography>