@strapi-community/plugin-better-auth-dashboard 1.0.0-beta.1 → 1.0.0-beta.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.
- package/dist/admin/Avatar-CdT7eBCh.js +39 -0
- package/dist/admin/Avatar-zlMTAZh3.mjs +40 -0
- package/dist/admin/{Root-2FMy-qQg.mjs → Root-CgVBJuoM.mjs} +12 -4
- package/dist/admin/{Root-DDi0mtve.js → Root-CsiOnzlB.js} +12 -4
- package/dist/admin/cs-C_jSgeON.js +416 -0
- package/dist/admin/cs-wtnknvBC.mjs +416 -0
- package/dist/admin/de-Cg5HyoCY.js +416 -0
- package/dist/admin/de-DnnVdUxk.mjs +416 -0
- package/dist/admin/en-B3utEgMT.mjs +416 -0
- package/dist/admin/en-Cz1IJEvp.js +416 -0
- package/dist/admin/es-CGA0Tslt.js +416 -0
- package/dist/admin/es-RoCEriJL.mjs +416 -0
- package/dist/admin/fr-Ca74t21t.js +416 -0
- package/dist/admin/fr-CtmuSfiQ.mjs +416 -0
- package/dist/admin/{index-BHfYu0uA.js → index-BCBu-0nr.js} +65 -10
- package/dist/admin/{index-D9CiI8Yr.mjs → index-BI2WIsds.mjs} +73 -18
- package/dist/admin/index-CPSoAbZt.js +2321 -0
- package/dist/admin/index-D9ttdrT3.js +2716 -0
- package/dist/admin/index-DQdn5s8q.js +1184 -0
- package/dist/admin/index-DvfwvCj0.mjs +1182 -0
- package/dist/admin/index-VyHXoQ6p.mjs +2321 -0
- package/dist/admin/index-gFqHlMLP.mjs +2716 -0
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/admin/it-BAB9hDdp.mjs +416 -0
- package/dist/admin/it-dYT2_ERV.js +416 -0
- package/dist/admin/nl-CVqSbUU9.js +416 -0
- package/dist/admin/nl-CYv26PHv.mjs +416 -0
- package/dist/admin/pl-Bc0cS2mD.mjs +416 -0
- package/dist/admin/pl-HYF4BxRv.js +416 -0
- package/dist/admin/pt-DDUGyLtb.js +416 -0
- package/dist/admin/pt-DZyyK3EG.mjs +416 -0
- package/dist/admin/{useModelSchema-CqOTI7P1.js → useModelSchema-BogQah8f.js} +309 -287
- package/dist/admin/{useModelSchema-B2tmzlwQ.mjs → useModelSchema-C6bxNjW4.mjs} +320 -298
- package/dist/server/index.js +15 -15
- package/dist/server/index.mjs +15 -15
- package/package.json +4 -4
- package/dist/admin/Avatar-Cvk89aMx.js +0 -67
- package/dist/admin/Avatar-DNczJU0i.mjs +0 -66
- package/dist/admin/index-BQi_BUi6.mjs +0 -1968
- package/dist/admin/index-BV-4M_Fp.js +0 -1970
- package/dist/admin/index-CANDPUGD.mjs +0 -1215
- package/dist/admin/index-CqR8WpOa.js +0 -1217
- package/dist/admin/index-D6ktNZcj.js +0 -1685
- package/dist/admin/index-DszX3ibA.mjs +0 -1683
|
@@ -1,31 +1,59 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { Dialog, Button, Typography, Flex, Grid, Box, Badge, Field, TextInput, Modal, Combobox, ComboboxOption, IconButton, Checkbox, SingleSelect, SingleSelectOption, NumberInput, JSONInput, Textarea } from "@strapi/design-system";
|
|
3
|
+
import { WarningCircle, Clock, Images, Trash } from "@strapi/icons";
|
|
4
|
+
import { useIntl } from "react-intl";
|
|
5
|
+
import { g as getTranslation, i as getMediaLibraryComponent, j as getEditViewSidePanels } from "./index-BI2WIsds.mjs";
|
|
6
|
+
import { useState, useRef } from "react";
|
|
5
7
|
import styled, { keyframes } from "styled-components";
|
|
6
|
-
import { f as getMediaLibraryComponent, i as getEditViewSidePanels } from "./index-D9CiI8Yr.mjs";
|
|
7
8
|
import { useFetchClient } from "@strapi/strapi/admin";
|
|
8
9
|
import { useQuery } from "react-query";
|
|
9
10
|
function ConfirmDialog({
|
|
10
11
|
title,
|
|
11
12
|
message,
|
|
12
|
-
confirmLabel
|
|
13
|
+
confirmLabel,
|
|
13
14
|
variant = "danger",
|
|
14
15
|
loading = false,
|
|
15
16
|
onConfirm,
|
|
16
17
|
onCancel
|
|
17
18
|
}) {
|
|
19
|
+
const { formatMessage } = useIntl();
|
|
18
20
|
return /* @__PURE__ */ jsx(
|
|
19
|
-
|
|
21
|
+
Dialog.Root,
|
|
20
22
|
{
|
|
21
23
|
defaultOpen: true,
|
|
22
24
|
onOpenChange: (open) => !open && onCancel(),
|
|
23
|
-
children: /* @__PURE__ */ jsxs(
|
|
24
|
-
/* @__PURE__ */ jsx(
|
|
25
|
-
/* @__PURE__ */ jsx(
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
children: /* @__PURE__ */ jsxs(Dialog.Content, { children: [
|
|
26
|
+
/* @__PURE__ */ jsx(Dialog.Header, { children: title }),
|
|
27
|
+
/* @__PURE__ */ jsx(
|
|
28
|
+
Dialog.Body,
|
|
29
|
+
{
|
|
30
|
+
icon: /* @__PURE__ */ jsx(
|
|
31
|
+
WarningCircle,
|
|
32
|
+
{
|
|
33
|
+
fill: variant === "danger" ? "danger600" : "primary600"
|
|
34
|
+
}
|
|
35
|
+
),
|
|
36
|
+
children: message
|
|
37
|
+
}
|
|
38
|
+
),
|
|
39
|
+
/* @__PURE__ */ jsxs(Dialog.Footer, { children: [
|
|
40
|
+
/* @__PURE__ */ jsx(Dialog.Cancel, { children: /* @__PURE__ */ jsx(Button, { fullWidth: true, variant: "tertiary", disabled: loading, children: formatMessage({
|
|
41
|
+
id: getTranslation("components.confirmDialog.cancel"),
|
|
42
|
+
defaultMessage: "Cancel"
|
|
43
|
+
}) }) }),
|
|
44
|
+
/* @__PURE__ */ jsx(
|
|
45
|
+
Button,
|
|
46
|
+
{
|
|
47
|
+
fullWidth: true,
|
|
48
|
+
variant,
|
|
49
|
+
loading,
|
|
50
|
+
onClick: onConfirm,
|
|
51
|
+
children: confirmLabel ?? formatMessage({
|
|
52
|
+
id: getTranslation("components.confirmDialog.confirm"),
|
|
53
|
+
defaultMessage: "Confirm"
|
|
54
|
+
})
|
|
55
|
+
}
|
|
56
|
+
)
|
|
29
57
|
] })
|
|
30
58
|
] })
|
|
31
59
|
}
|
|
@@ -38,238 +66,134 @@ const withContext = (ctx, headers) => ({
|
|
|
38
66
|
[DASH_CONTEXT_HEADER]: btoa(JSON.stringify(ctx))
|
|
39
67
|
}
|
|
40
68
|
});
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
document.addEventListener("keydown", handler);
|
|
86
|
-
return () => document.removeEventListener("keydown", handler);
|
|
87
|
-
}, [onClose]);
|
|
88
|
-
return /* @__PURE__ */ jsx(Portal, { children: /* @__PURE__ */ jsxs("div", { style: { position: "fixed", inset: 0, zIndex: 200 }, children: [
|
|
89
|
-
/* @__PURE__ */ jsx(Overlay, { onClick: onClose, "aria-hidden": "true" }),
|
|
90
|
-
/* @__PURE__ */ jsxs(Panel, { "data-testid": testId, children: [
|
|
91
|
-
/* @__PURE__ */ jsxs(
|
|
92
|
-
Flex,
|
|
93
|
-
{
|
|
94
|
-
justifyContent: "space-between",
|
|
95
|
-
alignItems: "center",
|
|
96
|
-
paddingTop: 5,
|
|
97
|
-
paddingBottom: 5,
|
|
98
|
-
paddingLeft: 6,
|
|
99
|
-
paddingRight: 6,
|
|
100
|
-
borderColor: "neutral150",
|
|
101
|
-
borderStyle: "solid",
|
|
102
|
-
borderWidth: "0 0 1px 0",
|
|
103
|
-
style: { flexShrink: 0 },
|
|
104
|
-
children: [
|
|
105
|
-
/* @__PURE__ */ jsx(Typography, { variant: "beta", tag: "h2", children: title }),
|
|
106
|
-
/* @__PURE__ */ jsx(IconButton, { label: "Close panel", onClick: onClose, children: /* @__PURE__ */ jsx(Cross, {}) })
|
|
107
|
-
]
|
|
108
|
-
}
|
|
109
|
-
),
|
|
110
|
-
/* @__PURE__ */ jsx(
|
|
111
|
-
Box,
|
|
112
|
-
{
|
|
113
|
-
paddingTop: 6,
|
|
114
|
-
paddingBottom: 6,
|
|
115
|
-
paddingLeft: 6,
|
|
116
|
-
paddingRight: 6,
|
|
117
|
-
style: { flex: 1, overflowY: "auto" },
|
|
118
|
-
children
|
|
119
|
-
}
|
|
120
|
-
),
|
|
121
|
-
footer && /* @__PURE__ */ jsx(
|
|
122
|
-
Flex,
|
|
123
|
-
{
|
|
124
|
-
justifyContent: "flex-end",
|
|
125
|
-
gap: 2,
|
|
126
|
-
paddingTop: 4,
|
|
127
|
-
paddingBottom: 4,
|
|
128
|
-
paddingLeft: 6,
|
|
129
|
-
paddingRight: 6,
|
|
130
|
-
borderColor: "neutral150",
|
|
131
|
-
borderStyle: "solid",
|
|
132
|
-
borderWidth: "1px 0 0 0",
|
|
133
|
-
style: { flexShrink: 0 },
|
|
134
|
-
children: footer
|
|
135
|
-
}
|
|
136
|
-
)
|
|
137
|
-
] })
|
|
138
|
-
] }) });
|
|
139
|
-
}
|
|
140
|
-
const FormSection = styled.div`
|
|
141
|
-
width: 100%;
|
|
142
|
-
background: #f6f6f9;
|
|
143
|
-
border-radius: 8px;
|
|
144
|
-
padding: 16px 20px;
|
|
145
|
-
display: flex;
|
|
146
|
-
flex-direction: column;
|
|
147
|
-
gap: 14px;
|
|
148
|
-
`;
|
|
149
|
-
const EditLayout = styled.div`
|
|
150
|
-
display: grid;
|
|
151
|
-
grid-template-columns: minmax(0, 1fr) 256px;
|
|
152
|
-
gap: 28px;
|
|
153
|
-
align-items: start;
|
|
154
|
-
padding-top: 24px;
|
|
155
|
-
`;
|
|
156
|
-
const EditSidebar = styled.div`
|
|
157
|
-
display: flex;
|
|
158
|
-
flex-direction: column;
|
|
159
|
-
gap: 20px;
|
|
160
|
-
position: sticky;
|
|
161
|
-
top: 0;
|
|
162
|
-
`;
|
|
163
|
-
const SectionLabel = styled.p`
|
|
164
|
-
font-size: 11px;
|
|
165
|
-
font-weight: 700;
|
|
166
|
-
color: #8e8ea9;
|
|
167
|
-
text-transform: uppercase;
|
|
168
|
-
letter-spacing: 0.05em;
|
|
169
|
-
margin: 0 0 4px;
|
|
170
|
-
`;
|
|
171
|
-
styled.div`
|
|
172
|
-
background: #f6f6f9;
|
|
173
|
-
border-radius: 8px;
|
|
174
|
-
padding: 16px;
|
|
175
|
-
display: grid;
|
|
176
|
-
grid-template-columns: 1fr 1fr;
|
|
177
|
-
gap: 16px;
|
|
178
|
-
`;
|
|
179
|
-
const MetaItem = styled.div`
|
|
180
|
-
display: flex;
|
|
181
|
-
flex-direction: column;
|
|
182
|
-
gap: 4px;
|
|
183
|
-
`;
|
|
184
|
-
const MetaKey = styled.span`
|
|
185
|
-
font-size: 11px;
|
|
186
|
-
font-weight: 600;
|
|
187
|
-
color: #8e8ea9;
|
|
188
|
-
text-transform: uppercase;
|
|
189
|
-
letter-spacing: 0.03em;
|
|
190
|
-
`;
|
|
191
|
-
const MetaVal = styled.span`
|
|
192
|
-
font-size: 13px;
|
|
193
|
-
color: #32324d;
|
|
194
|
-
`;
|
|
195
|
-
const MonoChip = styled.code`
|
|
196
|
-
display: inline;
|
|
197
|
-
font-size: 11px;
|
|
198
|
-
color: #4945ff;
|
|
69
|
+
const FormSection = (props) => /* @__PURE__ */ jsx(
|
|
70
|
+
Flex,
|
|
71
|
+
{
|
|
72
|
+
direction: "column",
|
|
73
|
+
alignItems: "stretch",
|
|
74
|
+
gap: 4,
|
|
75
|
+
width: "100%",
|
|
76
|
+
background: "neutral100",
|
|
77
|
+
hasRadius: true,
|
|
78
|
+
paddingTop: 4,
|
|
79
|
+
paddingBottom: 4,
|
|
80
|
+
paddingLeft: 5,
|
|
81
|
+
paddingRight: 5,
|
|
82
|
+
...props
|
|
83
|
+
}
|
|
84
|
+
);
|
|
85
|
+
const EditLayout = ({ children }) => /* @__PURE__ */ jsx(
|
|
86
|
+
Grid.Root,
|
|
87
|
+
{
|
|
88
|
+
gap: 6,
|
|
89
|
+
paddingTop: 6,
|
|
90
|
+
style: {
|
|
91
|
+
gridTemplateColumns: "minmax(0, 1fr) 25.6rem",
|
|
92
|
+
alignItems: "start"
|
|
93
|
+
},
|
|
94
|
+
children
|
|
95
|
+
}
|
|
96
|
+
);
|
|
97
|
+
const EditSidebar = ({ children }) => /* @__PURE__ */ jsx(
|
|
98
|
+
Flex,
|
|
99
|
+
{
|
|
100
|
+
direction: "column",
|
|
101
|
+
alignItems: "stretch",
|
|
102
|
+
gap: 5,
|
|
103
|
+
position: "sticky",
|
|
104
|
+
top: 0,
|
|
105
|
+
children
|
|
106
|
+
}
|
|
107
|
+
);
|
|
108
|
+
const SectionLabel = (props) => /* @__PURE__ */ jsx(Typography, { variant: "sigma", textColor: "neutral600", tag: "p", ...props });
|
|
109
|
+
const MetaItem = (props) => /* @__PURE__ */ jsx(Flex, { direction: "column", alignItems: "flex-start", gap: 1, ...props });
|
|
110
|
+
const MetaKey = (props) => /* @__PURE__ */ jsx(Typography, { variant: "sigma", textColor: "neutral600", ...props });
|
|
111
|
+
const MetaVal = (props) => /* @__PURE__ */ jsx(Typography, { variant: "omega", textColor: "neutral800", ...props });
|
|
112
|
+
const Code = styled(Typography)`
|
|
199
113
|
font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
|
|
200
114
|
word-break: break-all;
|
|
201
|
-
background: #f0f0ff;
|
|
202
|
-
padding: 2px 6px;
|
|
203
|
-
border-radius: 3px;
|
|
204
|
-
`;
|
|
205
|
-
const ProviderBadge = styled.span`
|
|
206
|
-
display: inline-flex;
|
|
207
|
-
align-items: center;
|
|
208
|
-
padding: 2px 8px;
|
|
209
|
-
background: #f0f0ff;
|
|
210
|
-
border: 1px solid #d9d8ff;
|
|
211
|
-
border-radius: 4px;
|
|
212
|
-
font-size: 12px;
|
|
213
|
-
font-weight: 600;
|
|
214
|
-
color: #4945ff;
|
|
215
|
-
text-transform: capitalize;
|
|
216
|
-
`;
|
|
217
|
-
const WarnCard = styled.div`
|
|
218
|
-
background: #fcecea;
|
|
219
|
-
border: 1px solid #f5c0b8;
|
|
220
|
-
border-radius: 8px;
|
|
221
|
-
padding: 14px 16px;
|
|
222
|
-
display: flex;
|
|
223
|
-
flex-direction: column;
|
|
224
|
-
gap: 4px;
|
|
225
|
-
`;
|
|
226
|
-
styled.div`
|
|
227
|
-
background: #eafbe7;
|
|
228
|
-
border: 1px solid #c6efbd;
|
|
229
|
-
border-radius: 8px;
|
|
230
|
-
padding: 14px 16px;
|
|
231
|
-
`;
|
|
232
|
-
const PreviewPill = styled.div`
|
|
233
|
-
display: inline-flex;
|
|
234
|
-
align-items: center;
|
|
235
|
-
gap: 6px;
|
|
236
|
-
padding: 6px 12px;
|
|
237
|
-
background: #fff3d3;
|
|
238
|
-
border: 1px solid #f5d97f;
|
|
239
|
-
border-radius: 6px;
|
|
240
|
-
font-size: 12px;
|
|
241
|
-
font-weight: 500;
|
|
242
|
-
color: #8e6a00;
|
|
243
|
-
width: fit-content;
|
|
244
|
-
`;
|
|
245
|
-
const AccountRow = styled.div`
|
|
246
|
-
width: 100%;
|
|
247
|
-
display: flex;
|
|
248
|
-
align-items: center;
|
|
249
|
-
justify-content: space-between;
|
|
250
|
-
padding: 10px 14px;
|
|
251
|
-
background: white;
|
|
252
|
-
border: 1px solid #dcdce4;
|
|
253
|
-
border-radius: 8px;
|
|
254
|
-
gap: 12px;
|
|
255
|
-
`;
|
|
256
|
-
const DangerRow = styled(AccountRow)`
|
|
257
|
-
background: #fef8f8;
|
|
258
|
-
border-color: #f5c0b8;
|
|
259
|
-
`;
|
|
260
|
-
const RoleBadge = styled.span`
|
|
261
|
-
display: inline-flex;
|
|
262
|
-
align-items: center;
|
|
263
|
-
padding: 2px 8px;
|
|
264
|
-
border-radius: 4px;
|
|
265
|
-
font-size: 11px;
|
|
266
|
-
font-weight: 600;
|
|
267
|
-
text-transform: capitalize;
|
|
268
|
-
background: ${(p) => p.$role === "owner" ? "#f0f0ff" : p.$role === "admin" ? "#eafbe7" : "#f5f5f9"};
|
|
269
|
-
border: 1px solid
|
|
270
|
-
${(p) => p.$role === "owner" ? "#d9d8ff" : p.$role === "admin" ? "#c6efbd" : "#dcdce4"};
|
|
271
|
-
color: ${(p) => p.$role === "owner" ? "#4945ff" : p.$role === "admin" ? "#2e8044" : "#666687"};
|
|
272
115
|
`;
|
|
116
|
+
const MonoChip = ({ children }) => /* @__PURE__ */ jsx(
|
|
117
|
+
Box,
|
|
118
|
+
{
|
|
119
|
+
background: "primary100",
|
|
120
|
+
borderColor: "primary200",
|
|
121
|
+
borderStyle: "solid",
|
|
122
|
+
borderWidth: "1px",
|
|
123
|
+
hasRadius: true,
|
|
124
|
+
paddingLeft: 2,
|
|
125
|
+
paddingRight: 2,
|
|
126
|
+
paddingTop: 1,
|
|
127
|
+
paddingBottom: 1,
|
|
128
|
+
children: /* @__PURE__ */ jsx(Code, { variant: "pi", textColor: "primary600", children })
|
|
129
|
+
}
|
|
130
|
+
);
|
|
131
|
+
const ProviderBadge = ({ children }) => /* @__PURE__ */ jsx(Badge, { variant: "primary", children });
|
|
132
|
+
const WarnCard = ({ children }) => /* @__PURE__ */ jsx(
|
|
133
|
+
Flex,
|
|
134
|
+
{
|
|
135
|
+
direction: "column",
|
|
136
|
+
alignItems: "flex-start",
|
|
137
|
+
gap: 1,
|
|
138
|
+
background: "danger100",
|
|
139
|
+
borderColor: "danger200",
|
|
140
|
+
borderStyle: "solid",
|
|
141
|
+
borderWidth: "1px",
|
|
142
|
+
hasRadius: true,
|
|
143
|
+
padding: 4,
|
|
144
|
+
children
|
|
145
|
+
}
|
|
146
|
+
);
|
|
147
|
+
const PreviewPill = ({ children }) => /* @__PURE__ */ jsxs(
|
|
148
|
+
Flex,
|
|
149
|
+
{
|
|
150
|
+
gap: 2,
|
|
151
|
+
background: "warning100",
|
|
152
|
+
borderColor: "warning200",
|
|
153
|
+
borderStyle: "solid",
|
|
154
|
+
borderWidth: "1px",
|
|
155
|
+
hasRadius: true,
|
|
156
|
+
paddingTop: 2,
|
|
157
|
+
paddingBottom: 2,
|
|
158
|
+
paddingLeft: 3,
|
|
159
|
+
paddingRight: 3,
|
|
160
|
+
width: "fit-content",
|
|
161
|
+
children: [
|
|
162
|
+
/* @__PURE__ */ jsx(Clock, { fill: "warning700", width: "1.2rem", height: "1.2rem" }),
|
|
163
|
+
/* @__PURE__ */ jsx(Typography, { variant: "pi", fontWeight: "semiBold", textColor: "warning700", children })
|
|
164
|
+
]
|
|
165
|
+
}
|
|
166
|
+
);
|
|
167
|
+
const AccountRow = (props) => /* @__PURE__ */ jsx(
|
|
168
|
+
Flex,
|
|
169
|
+
{
|
|
170
|
+
width: "100%",
|
|
171
|
+
justifyContent: "space-between",
|
|
172
|
+
gap: 3,
|
|
173
|
+
background: "neutral0",
|
|
174
|
+
borderColor: "neutral200",
|
|
175
|
+
borderStyle: "solid",
|
|
176
|
+
borderWidth: "1px",
|
|
177
|
+
hasRadius: true,
|
|
178
|
+
paddingTop: 3,
|
|
179
|
+
paddingBottom: 3,
|
|
180
|
+
paddingLeft: 4,
|
|
181
|
+
paddingRight: 4,
|
|
182
|
+
...props
|
|
183
|
+
}
|
|
184
|
+
);
|
|
185
|
+
const DangerRow = (props) => /* @__PURE__ */ jsx(AccountRow, { background: "danger100", borderColor: "danger200", ...props });
|
|
186
|
+
const RoleBadge = ({
|
|
187
|
+
memberRole,
|
|
188
|
+
children
|
|
189
|
+
}) => /* @__PURE__ */ jsx(
|
|
190
|
+
Badge,
|
|
191
|
+
{
|
|
192
|
+
size: "S",
|
|
193
|
+
variant: memberRole === "owner" ? "primary" : memberRole === "admin" ? "success" : "neutral",
|
|
194
|
+
children
|
|
195
|
+
}
|
|
196
|
+
);
|
|
273
197
|
function MediaPickerField({
|
|
274
198
|
label,
|
|
275
199
|
value,
|
|
@@ -279,6 +203,7 @@ function MediaPickerField({
|
|
|
279
203
|
name,
|
|
280
204
|
required
|
|
281
205
|
}) {
|
|
206
|
+
const { formatMessage } = useIntl();
|
|
282
207
|
const [showMedia, setShowMedia] = useState(false);
|
|
283
208
|
const MediaLibraryDialog = getMediaLibraryComponent();
|
|
284
209
|
const handleSelect = (assets) => {
|
|
@@ -292,15 +217,14 @@ function MediaPickerField({
|
|
|
292
217
|
/* @__PURE__ */ jsxs(Field.Root, { style: { width: "100%" }, hint, required, children: [
|
|
293
218
|
/* @__PURE__ */ jsx(Field.Label, { children: label }),
|
|
294
219
|
/* @__PURE__ */ jsxs(Flex, { gap: 2, alignItems: "center", children: [
|
|
295
|
-
/* @__PURE__ */ jsx(
|
|
220
|
+
/* @__PURE__ */ jsx(Box, { flex: 1, minWidth: 0, children: /* @__PURE__ */ jsx(
|
|
296
221
|
TextInput,
|
|
297
222
|
{
|
|
298
223
|
name,
|
|
299
224
|
type: "url",
|
|
300
225
|
value,
|
|
301
226
|
onChange: (e) => onChange(e.target.value),
|
|
302
|
-
placeholder
|
|
303
|
-
style: { width: "100%" }
|
|
227
|
+
placeholder
|
|
304
228
|
}
|
|
305
229
|
) }),
|
|
306
230
|
MediaLibraryDialog && /* @__PURE__ */ jsx(
|
|
@@ -311,7 +235,10 @@ function MediaPickerField({
|
|
|
311
235
|
startIcon: /* @__PURE__ */ jsx(Images, {}),
|
|
312
236
|
onClick: () => setShowMedia(true),
|
|
313
237
|
style: { flexShrink: 0 },
|
|
314
|
-
children:
|
|
238
|
+
children: formatMessage({
|
|
239
|
+
id: getTranslation("components.mediaPickerField.browse"),
|
|
240
|
+
defaultMessage: "Browse"
|
|
241
|
+
})
|
|
315
242
|
}
|
|
316
243
|
)
|
|
317
244
|
] }),
|
|
@@ -328,19 +255,78 @@ function MediaPickerField({
|
|
|
328
255
|
)
|
|
329
256
|
] });
|
|
330
257
|
}
|
|
331
|
-
const
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
justify-content: space-between;
|
|
335
|
-
gap: 8px;
|
|
336
|
-
padding: 8px 12px;
|
|
337
|
-
width: 100%;
|
|
338
|
-
box-sizing: border-box;
|
|
339
|
-
background: #ffffff;
|
|
340
|
-
border: 1px solid ${({ theme }) => theme.colors?.neutral200 ?? "#dcdce4"};
|
|
341
|
-
border-radius: 4px;
|
|
342
|
-
min-width: 0;
|
|
258
|
+
const slideIn = keyframes`
|
|
259
|
+
from { transform: translateX(100%); opacity: 0; }
|
|
260
|
+
to { transform: translateX(0); opacity: 1; }
|
|
343
261
|
`;
|
|
262
|
+
const slideOut = keyframes`
|
|
263
|
+
from { transform: translateX(0); opacity: 1; }
|
|
264
|
+
to { transform: translateX(100%); opacity: 0; }
|
|
265
|
+
`;
|
|
266
|
+
const Content = styled(Modal.Content)`
|
|
267
|
+
&& {
|
|
268
|
+
top: 0;
|
|
269
|
+
right: 0;
|
|
270
|
+
bottom: 0;
|
|
271
|
+
left: auto;
|
|
272
|
+
transform: none;
|
|
273
|
+
width: min(${(p) => p.$width}, 95vw);
|
|
274
|
+
max-width: none;
|
|
275
|
+
height: 100%;
|
|
276
|
+
max-height: none;
|
|
277
|
+
border-radius: 0;
|
|
278
|
+
box-shadow: ${({ theme }) => theme.shadows.popupShadow};
|
|
279
|
+
|
|
280
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
281
|
+
&[data-state='open'] {
|
|
282
|
+
animation: ${slideIn} ${({ theme }) => theme.motion.timings["200"]}
|
|
283
|
+
${({ theme }) => theme.motion.easings.authenticMotion};
|
|
284
|
+
}
|
|
285
|
+
&[data-state='closed'] {
|
|
286
|
+
animation: ${slideOut} ${({ theme }) => theme.motion.timings["120"]}
|
|
287
|
+
${({ theme }) => theme.motion.easings.easeOutQuad};
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
`;
|
|
292
|
+
const Body = styled(Modal.Body)`
|
|
293
|
+
flex: 1 1 auto;
|
|
294
|
+
min-height: 0;
|
|
295
|
+
`;
|
|
296
|
+
const Footer = styled(Modal.Footer)`
|
|
297
|
+
flex: 0 0 auto;
|
|
298
|
+
`;
|
|
299
|
+
function SheetDialog({
|
|
300
|
+
title,
|
|
301
|
+
children,
|
|
302
|
+
actionButtons,
|
|
303
|
+
onClose,
|
|
304
|
+
width = "760px",
|
|
305
|
+
"data-testid": testId
|
|
306
|
+
}) {
|
|
307
|
+
const { formatMessage } = useIntl();
|
|
308
|
+
return /* @__PURE__ */ jsx(
|
|
309
|
+
Modal.Root,
|
|
310
|
+
{
|
|
311
|
+
defaultOpen: true,
|
|
312
|
+
onOpenChange: (open) => !open && onClose(),
|
|
313
|
+
children: /* @__PURE__ */ jsxs(Content, { $width: width, "data-testid": testId, children: [
|
|
314
|
+
/* @__PURE__ */ jsx(
|
|
315
|
+
Modal.Header,
|
|
316
|
+
{
|
|
317
|
+
closeLabel: formatMessage({
|
|
318
|
+
id: getTranslation("components.sheet.closeLabel"),
|
|
319
|
+
defaultMessage: "Close panel"
|
|
320
|
+
}),
|
|
321
|
+
children: /* @__PURE__ */ jsx(Modal.Title, { children: title })
|
|
322
|
+
}
|
|
323
|
+
),
|
|
324
|
+
/* @__PURE__ */ jsx(Body, { children }),
|
|
325
|
+
actionButtons && /* @__PURE__ */ jsx(Footer, { children: actionButtons })
|
|
326
|
+
] })
|
|
327
|
+
}
|
|
328
|
+
);
|
|
329
|
+
}
|
|
344
330
|
function getDisplayLabel(doc) {
|
|
345
331
|
for (const key of ["name", "title", "email", "username", "label", "slug"]) {
|
|
346
332
|
const v = doc[key];
|
|
@@ -373,6 +359,7 @@ function RelationField({
|
|
|
373
359
|
onChange,
|
|
374
360
|
readOnly = false
|
|
375
361
|
}) {
|
|
362
|
+
const { formatMessage } = useIntl();
|
|
376
363
|
const { get } = useFetchClient();
|
|
377
364
|
const cache = useRef(/* @__PURE__ */ new Map());
|
|
378
365
|
const [search, setSearch] = useState("");
|
|
@@ -440,7 +427,10 @@ function RelationField({
|
|
|
440
427
|
onChange: (val) => handleSelect(val),
|
|
441
428
|
onInputChange: (e) => setSearch(e.target.value),
|
|
442
429
|
loading: isLoading,
|
|
443
|
-
placeholder:
|
|
430
|
+
placeholder: formatMessage({
|
|
431
|
+
id: getTranslation("components.relationField.searchPlaceholder"),
|
|
432
|
+
defaultMessage: "Search…"
|
|
433
|
+
}),
|
|
444
434
|
children: availableOptions.map((opt) => /* @__PURE__ */ jsx(ComboboxOption, { value: opt.documentId, children: opt.label }, opt.documentId))
|
|
445
435
|
},
|
|
446
436
|
addKey
|
|
@@ -449,34 +439,51 @@ function RelationField({
|
|
|
449
439
|
Flex,
|
|
450
440
|
{
|
|
451
441
|
direction: "column",
|
|
442
|
+
alignItems: "stretch",
|
|
452
443
|
gap: 1,
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
444
|
+
marginTop: 2,
|
|
445
|
+
width: "100%",
|
|
446
|
+
children: currentDocs.map((doc) => /* @__PURE__ */ jsxs(
|
|
447
|
+
Flex,
|
|
448
|
+
{
|
|
449
|
+
justifyContent: "space-between",
|
|
450
|
+
gap: 2,
|
|
451
|
+
paddingTop: 2,
|
|
452
|
+
paddingBottom: 2,
|
|
453
|
+
paddingLeft: 3,
|
|
454
|
+
paddingRight: 3,
|
|
455
|
+
background: "neutral0",
|
|
456
|
+
borderColor: "neutral200",
|
|
457
|
+
borderStyle: "solid",
|
|
458
|
+
borderWidth: "1px",
|
|
459
|
+
hasRadius: true,
|
|
460
|
+
children: [
|
|
461
|
+
/* @__PURE__ */ jsx(
|
|
462
|
+
Typography,
|
|
463
|
+
{
|
|
464
|
+
variant: "omega",
|
|
465
|
+
textColor: "neutral800",
|
|
466
|
+
ellipsis: true,
|
|
467
|
+
style: { flex: 1, minWidth: 0 },
|
|
468
|
+
children: doc.label
|
|
469
|
+
}
|
|
470
|
+
),
|
|
471
|
+
!readOnly && /* @__PURE__ */ jsx(
|
|
472
|
+
IconButton,
|
|
473
|
+
{
|
|
474
|
+
label: formatMessage({
|
|
475
|
+
id: getTranslation("components.relationField.remove"),
|
|
476
|
+
defaultMessage: "Remove"
|
|
477
|
+
}),
|
|
478
|
+
size: "S",
|
|
479
|
+
onClick: () => handleRemove(doc.documentId),
|
|
480
|
+
children: /* @__PURE__ */ jsx(Trash, {})
|
|
481
|
+
}
|
|
482
|
+
)
|
|
483
|
+
]
|
|
484
|
+
},
|
|
485
|
+
doc.documentId
|
|
486
|
+
))
|
|
480
487
|
}
|
|
481
488
|
)
|
|
482
489
|
] });
|
|
@@ -637,10 +644,14 @@ function CustomFieldsSection({
|
|
|
637
644
|
data,
|
|
638
645
|
onChange
|
|
639
646
|
}) {
|
|
647
|
+
const { formatMessage } = useIntl();
|
|
640
648
|
const renderable = fields.filter((f) => !SKIP_TYPES.has(f.attribute.type));
|
|
641
649
|
if (renderable.length === 0) return null;
|
|
642
650
|
return /* @__PURE__ */ jsxs(FormSection, { children: [
|
|
643
|
-
/* @__PURE__ */ jsx(SectionLabel, { children:
|
|
651
|
+
/* @__PURE__ */ jsx(SectionLabel, { children: formatMessage({
|
|
652
|
+
id: getTranslation("components.dynamicField.customFields"),
|
|
653
|
+
defaultMessage: "Custom fields"
|
|
654
|
+
}) }),
|
|
644
655
|
/* @__PURE__ */ jsx(Flex, { direction: "column", gap: 4, alignItems: "stretch", children: renderable.map((field) => /* @__PURE__ */ jsx(
|
|
645
656
|
DynamicField,
|
|
646
657
|
{
|
|
@@ -652,7 +663,7 @@ function CustomFieldsSection({
|
|
|
652
663
|
)) })
|
|
653
664
|
] });
|
|
654
665
|
}
|
|
655
|
-
function EditViewSidePanels({ model, documentId, document
|
|
666
|
+
function EditViewSidePanels({ model, documentId, document }) {
|
|
656
667
|
const panels = getEditViewSidePanels(model);
|
|
657
668
|
if (panels.length === 0) return null;
|
|
658
669
|
return /* @__PURE__ */ jsx(Fragment, { children: panels.map(({ id, title, Component }) => /* @__PURE__ */ jsxs(FormSection, { children: [
|
|
@@ -662,7 +673,7 @@ function EditViewSidePanels({ model, documentId, document: document2 }) {
|
|
|
662
673
|
{
|
|
663
674
|
model,
|
|
664
675
|
documentId,
|
|
665
|
-
document
|
|
676
|
+
document
|
|
666
677
|
}
|
|
667
678
|
)
|
|
668
679
|
] }, id)) });
|
|
@@ -684,6 +695,7 @@ const MODEL_UID = {
|
|
|
684
695
|
};
|
|
685
696
|
function useModelSchema(model) {
|
|
686
697
|
const { get } = useFetchClient();
|
|
698
|
+
const { formatMessage } = useIntl();
|
|
687
699
|
return useQuery({
|
|
688
700
|
queryKey: ["ba-model-schema", model],
|
|
689
701
|
queryFn: async () => {
|
|
@@ -692,7 +704,16 @@ function useModelSchema(model) {
|
|
|
692
704
|
);
|
|
693
705
|
const uid = MODEL_UID[model];
|
|
694
706
|
const contentType = data.data.find((ct) => ct.uid === uid);
|
|
695
|
-
if (!contentType)
|
|
707
|
+
if (!contentType)
|
|
708
|
+
throw new Error(
|
|
709
|
+
formatMessage(
|
|
710
|
+
{
|
|
711
|
+
id: getTranslation("common.errors.contentTypeNotFound"),
|
|
712
|
+
defaultMessage: "Content type {uid} not found"
|
|
713
|
+
},
|
|
714
|
+
{ uid }
|
|
715
|
+
)
|
|
716
|
+
);
|
|
696
717
|
const attributes = {};
|
|
697
718
|
for (const [name, attr] of Object.entries(contentType.attributes)) {
|
|
698
719
|
if (SYSTEM_FIELDS.has(name)) continue;
|
|
@@ -711,23 +732,24 @@ function useModelSchema(model) {
|
|
|
711
732
|
export {
|
|
712
733
|
AccountRow as A,
|
|
713
734
|
CustomFieldsSection as C,
|
|
714
|
-
|
|
735
|
+
DangerRow as D,
|
|
715
736
|
EditLayout as E,
|
|
716
737
|
FormSection as F,
|
|
717
738
|
MediaPickerField as M,
|
|
718
739
|
ProviderBadge as P,
|
|
719
740
|
RoleBadge as R,
|
|
720
|
-
|
|
741
|
+
SheetDialog as S,
|
|
721
742
|
WarnCard as W,
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
743
|
+
SectionLabel as a,
|
|
744
|
+
EditSidebar as b,
|
|
745
|
+
MetaItem as c,
|
|
746
|
+
MetaKey as d,
|
|
747
|
+
MonoChip as e,
|
|
748
|
+
MetaVal as f,
|
|
749
|
+
EditViewSidePanels as g,
|
|
729
750
|
PreviewPill as h,
|
|
730
751
|
ConfirmDialog as i,
|
|
752
|
+
Code as j,
|
|
731
753
|
useModelSchema as u,
|
|
732
754
|
withContext as w
|
|
733
755
|
};
|