@skiddph/prui 0.1.0 → 0.2.0
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/app/app.d.ts +19 -9
- package/dist/app/auth-shell.d.ts +52 -0
- package/dist/app/form.d.ts +12 -6
- package/dist/app/index.d.ts +4 -2
- package/dist/app/resource.d.ts +17 -8
- package/dist/app/session-timeout.d.ts +45 -0
- package/dist/app/settings.d.ts +19 -2
- package/dist/app.js +13 -9
- package/dist/chunks/auth-shell-DsAwGqf8.js +917 -0
- package/dist/chunks/data-table-toolbar-BUy2EWPy.js +581 -0
- package/dist/core/modal.js +8 -8
- package/dist/core/select.d.ts +1 -1
- package/dist/core/select.js +37 -35
- package/dist/data-table/data-table-date-filter.d.ts +13 -0
- package/dist/data-table/data-table-price-filter.d.ts +16 -0
- package/dist/data-table/data-table-time-range-filter.d.ts +14 -0
- package/dist/data-table/data-table-toolbar.d.ts +6 -2
- package/dist/data-table/index.d.ts +3 -0
- package/dist/data-table.js +11 -8
- package/dist/index.js +92 -84
- package/dist/pages/forgot-password.d.ts +3 -3
- package/dist/pages/login.d.ts +5 -5
- package/dist/pages/register.d.ts +3 -3
- package/dist/pages/reset-password.d.ts +2 -2
- package/dist/pages/shared.d.ts +9 -2
- package/dist/pages.js +256 -233
- package/dist/theme/index.d.ts +10 -3
- package/dist/theme.js +33 -28
- package/package.json +7 -3
- package/dist/chunks/data-table-toolbar-C9likJBN.js +0 -430
- package/dist/chunks/settings-DUz5nyX-.js +0 -731
package/dist/pages.js
CHANGED
|
@@ -1,24 +1,40 @@
|
|
|
1
|
-
import { jsx as e, jsxs as
|
|
1
|
+
import { jsx as e, jsxs as r, Fragment as H } from "react/jsx-runtime";
|
|
2
2
|
import * as v from "react";
|
|
3
3
|
import { Button as S } from "./core/button.js";
|
|
4
|
-
import { Input as P, Textarea as
|
|
4
|
+
import { Input as P, Textarea as U } from "./core/input.js";
|
|
5
5
|
import { Label as C } from "./core/label.js";
|
|
6
|
-
import { Loader2 as Y, LogOut as
|
|
7
|
-
import { cn as
|
|
8
|
-
import { Card as
|
|
9
|
-
import { Switch as
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
import { Loader2 as Y, LogOut as z, Inbox as K, AlertTriangle as W, FileQuestion as Q } from "lucide-react";
|
|
7
|
+
import { cn as _ } from "./core/cn.js";
|
|
8
|
+
import { Card as J, CardHeader as X, CardTitle as Z, CardDescription as k, CardContent as ee, CardFooter as te, Avatar as ae } from "./core/card.js";
|
|
9
|
+
import { Switch as re } from "./core/switch.js";
|
|
10
|
+
const ne = {
|
|
11
|
+
google: { id: "google", label: "Google" },
|
|
12
|
+
github: { id: "github", label: "GitHub" },
|
|
13
|
+
microsoft: { id: "microsoft", label: "Microsoft" }
|
|
14
|
+
};
|
|
15
|
+
function le(t) {
|
|
16
|
+
return t != null && t.length ? t.map(
|
|
17
|
+
(a) => typeof a == "string" ? ne[a] ?? { id: a, label: a.charAt(0).toUpperCase() + a.slice(1) } : a
|
|
18
|
+
) : [];
|
|
19
|
+
}
|
|
20
|
+
function R(t) {
|
|
21
|
+
return typeof t == "string" ? t : t.href;
|
|
22
|
+
}
|
|
23
|
+
function q(t, a) {
|
|
24
|
+
return (typeof t == "string" ? a : t.label) ?? a;
|
|
25
|
+
}
|
|
26
|
+
function j({ title: t, description: a, brand: o, width: n = "max-w-sm", children: c, footer: i }) {
|
|
27
|
+
return /* @__PURE__ */ e("div", { className: "prui-page flex min-h-[100dvh] items-center justify-center bg-[var(--prui-background)] p-4", children: /* @__PURE__ */ r("div", { className: _("w-full", n), children: [
|
|
28
|
+
o ? /* @__PURE__ */ r("div", { className: "mb-6 flex items-center justify-center gap-2", "data-testid": "page-brand", children: [
|
|
13
29
|
o.mark ? /* @__PURE__ */ e("img", { src: o.mark, alt: "", className: "h-8 w-8 rounded-[var(--prui-radius-1)] object-cover" }) : null,
|
|
14
30
|
/* @__PURE__ */ e("span", { className: "text-lg font-semibold text-[var(--prui-fg)]", children: o.name })
|
|
15
31
|
] }) : null,
|
|
16
|
-
/* @__PURE__ */
|
|
17
|
-
/* @__PURE__ */
|
|
32
|
+
/* @__PURE__ */ r("div", { className: "rounded-[var(--prui-radius)] border border-[var(--prui-line)] bg-[var(--prui-surface)] p-6", children: [
|
|
33
|
+
/* @__PURE__ */ r("div", { className: "mb-4 flex flex-col gap-1 text-center", children: [
|
|
18
34
|
/* @__PURE__ */ e("h1", { className: "text-lg font-semibold text-[var(--prui-fg)]", children: t }),
|
|
19
|
-
|
|
35
|
+
a ? /* @__PURE__ */ e("p", { className: "text-sm text-[var(--prui-dim)]", children: a }) : null
|
|
20
36
|
] }),
|
|
21
|
-
|
|
37
|
+
c,
|
|
22
38
|
i ? /* @__PURE__ */ e("div", { className: "mt-4 text-center text-sm text-[var(--prui-dim)]", children: i }) : null
|
|
23
39
|
] })
|
|
24
40
|
] }) });
|
|
@@ -34,68 +50,75 @@ function F({ error: t }) {
|
|
|
34
50
|
}
|
|
35
51
|
) : null;
|
|
36
52
|
}
|
|
37
|
-
function
|
|
38
|
-
return /* @__PURE__ */
|
|
53
|
+
function oe({ loading: t, children: a }) {
|
|
54
|
+
return /* @__PURE__ */ r(H, { children: [
|
|
39
55
|
t ? /* @__PURE__ */ e(Y, { className: "h-4 w-4 animate-spin", "aria-hidden": !0 }) : null,
|
|
40
|
-
|
|
56
|
+
a
|
|
41
57
|
] });
|
|
42
58
|
}
|
|
43
|
-
function
|
|
44
|
-
|
|
45
|
-
|
|
59
|
+
function V({ providers: t }) {
|
|
60
|
+
const a = le(t);
|
|
61
|
+
return a.length === 0 ? null : /* @__PURE__ */ r("div", { className: "mt-4", "data-testid": "oauth-providers", children: [
|
|
62
|
+
/* @__PURE__ */ r("div", { className: "relative my-3", children: [
|
|
46
63
|
/* @__PURE__ */ e("div", { className: "absolute inset-0 flex items-center", children: /* @__PURE__ */ e("span", { className: "w-full border-t border-[var(--prui-line)]" }) }),
|
|
47
64
|
/* @__PURE__ */ e("div", { className: "relative flex justify-center text-xs", children: /* @__PURE__ */ e("span", { className: "bg-[var(--prui-surface)] px-2 text-[var(--prui-dim)]", children: "or continue with" }) })
|
|
48
65
|
] }),
|
|
49
|
-
/* @__PURE__ */ e("div", { className: "grid grid-cols-2 gap-2", children:
|
|
50
|
-
const
|
|
51
|
-
return /* @__PURE__ */
|
|
66
|
+
/* @__PURE__ */ e("div", { className: "grid grid-cols-2 gap-2", children: a.map((o) => {
|
|
67
|
+
const n = o.icon;
|
|
68
|
+
return /* @__PURE__ */ r(
|
|
52
69
|
"button",
|
|
53
70
|
{
|
|
54
71
|
type: "button",
|
|
55
|
-
onClick: (
|
|
56
|
-
var
|
|
57
|
-
const
|
|
58
|
-
|
|
72
|
+
onClick: (c) => {
|
|
73
|
+
var p;
|
|
74
|
+
const i = (p = a.find((d) => d.id === o.id)) == null ? void 0 : p.onClick;
|
|
75
|
+
i == null || i(), c.preventDefault();
|
|
59
76
|
},
|
|
60
77
|
className: "inline-flex h-9 items-center justify-center gap-2 rounded-[var(--prui-radius)] border border-[var(--prui-line)] bg-[var(--prui-background)] text-sm text-[var(--prui-fg)] hover:border-[var(--prui-dim)] cursor-pointer",
|
|
61
78
|
children: [
|
|
62
|
-
|
|
63
|
-
|
|
79
|
+
n ? /* @__PURE__ */ e(n, { className: "h-4 w-4", "aria-hidden": !0 }) : null,
|
|
80
|
+
o.label
|
|
64
81
|
]
|
|
65
82
|
},
|
|
66
|
-
|
|
83
|
+
o.id
|
|
67
84
|
);
|
|
68
85
|
}) })
|
|
69
86
|
] });
|
|
70
87
|
}
|
|
71
|
-
const
|
|
88
|
+
const T = [
|
|
72
89
|
{ name: "email", label: "Email", type: "email", required: !0, autoComplete: "email" },
|
|
73
90
|
{ name: "password", label: "Password", type: "password", required: !0, autoComplete: "current-password" }
|
|
74
|
-
],
|
|
91
|
+
], ie = [
|
|
75
92
|
{ name: "name", label: "Name", type: "text", required: !0, autoComplete: "name" },
|
|
76
93
|
{ name: "email", label: "Email", type: "email", required: !0, autoComplete: "email" },
|
|
77
94
|
{ name: "password", label: "Password", type: "password", required: !0, autoComplete: "new-password" }
|
|
78
95
|
];
|
|
79
|
-
function
|
|
96
|
+
function se({
|
|
80
97
|
onSubmit: t,
|
|
81
|
-
fields:
|
|
98
|
+
fields: a,
|
|
82
99
|
extraFields: o,
|
|
83
100
|
links: n,
|
|
84
|
-
oauth:
|
|
101
|
+
oauth: c,
|
|
85
102
|
brand: i,
|
|
86
103
|
submitLabel: p = "Sign in",
|
|
87
|
-
loading:
|
|
104
|
+
loading: d = !1,
|
|
88
105
|
error: x,
|
|
89
106
|
className: g
|
|
90
107
|
}) {
|
|
91
|
-
const s = {
|
|
92
|
-
|
|
93
|
-
|
|
108
|
+
const s = {
|
|
109
|
+
email: !0,
|
|
110
|
+
password: !0,
|
|
111
|
+
remember: !1,
|
|
112
|
+
...a,
|
|
113
|
+
...(a == null ? void 0 : a.username) !== void 0 && (a == null ? void 0 : a.email) === void 0 ? { email: a.username } : {}
|
|
114
|
+
}, m = [
|
|
115
|
+
...s.email !== !1 ? [T[0]] : [],
|
|
116
|
+
...s.password !== !1 ? [T[1]] : [],
|
|
94
117
|
...o ?? []
|
|
95
118
|
], [f, y] = v.useState({}), [w, N] = v.useState(!1), [h, B] = v.useState(!1);
|
|
96
|
-
return /* @__PURE__ */
|
|
119
|
+
return /* @__PURE__ */ r(j, { title: "Welcome back", description: "Sign in to your account", brand: i, className: g, children: [
|
|
97
120
|
/* @__PURE__ */ e(F, { error: x }),
|
|
98
|
-
/* @__PURE__ */
|
|
121
|
+
/* @__PURE__ */ r("form", { onSubmit: async (l) => {
|
|
99
122
|
l.preventDefault();
|
|
100
123
|
try {
|
|
101
124
|
const u = t == null ? void 0 : t({ ...f, remember: String(w) });
|
|
@@ -104,8 +127,8 @@ function ne({
|
|
|
104
127
|
B(!1);
|
|
105
128
|
}
|
|
106
129
|
}, className: "flex flex-col gap-3", "data-testid": "login-form", children: [
|
|
107
|
-
m.map((l) => /* @__PURE__ */
|
|
108
|
-
/* @__PURE__ */
|
|
130
|
+
m.map((l) => /* @__PURE__ */ r("div", { className: "flex flex-col gap-1.5", children: [
|
|
131
|
+
/* @__PURE__ */ r(C, { htmlFor: `login-${l.name}`, children: [
|
|
109
132
|
l.label,
|
|
110
133
|
l.required ? /* @__PURE__ */ e("span", { className: "ml-0.5 text-[var(--prui-danger)]", children: "*" }) : null
|
|
111
134
|
] }),
|
|
@@ -117,13 +140,13 @@ function ne({
|
|
|
117
140
|
placeholder: l.placeholder,
|
|
118
141
|
autoComplete: l.autoComplete,
|
|
119
142
|
required: l.required,
|
|
120
|
-
disabled:
|
|
143
|
+
disabled: d || h,
|
|
121
144
|
value: f[l.name] ?? "",
|
|
122
145
|
onChange: (u) => y((b) => ({ ...b, [l.name]: u.target.value }))
|
|
123
146
|
}
|
|
124
147
|
)
|
|
125
148
|
] }, l.name)),
|
|
126
|
-
s.remember ? /* @__PURE__ */
|
|
149
|
+
s.remember ? /* @__PURE__ */ r("label", { className: "flex items-center gap-2 text-sm text-[var(--prui-dim)]", "data-testid": "login-remember", children: [
|
|
127
150
|
/* @__PURE__ */ e(
|
|
128
151
|
"input",
|
|
129
152
|
{
|
|
@@ -135,18 +158,18 @@ function ne({
|
|
|
135
158
|
),
|
|
136
159
|
"Remember me"
|
|
137
160
|
] }) : null,
|
|
138
|
-
/* @__PURE__ */ e(S, { type: "submit", variant: "primary", loading:
|
|
161
|
+
/* @__PURE__ */ e(S, { type: "submit", variant: "primary", loading: d || h, "data-testid": "login-submit", children: /* @__PURE__ */ e(oe, { loading: d || h, children: p }) })
|
|
139
162
|
] }),
|
|
140
|
-
/* @__PURE__ */ e(
|
|
141
|
-
(n == null ? void 0 : n.forgot) !== !1 && (n != null && n.forgot) ? /* @__PURE__ */ e("div", { className: "mt-3 text-center", children: /* @__PURE__ */ e("a", { href: n.forgot
|
|
142
|
-
(n == null ? void 0 : n.register) !== !1 && (n != null && n.register) ? /* @__PURE__ */
|
|
163
|
+
/* @__PURE__ */ e(V, { providers: c }),
|
|
164
|
+
(n == null ? void 0 : n.forgot) !== !1 && (n != null && n.forgot) ? /* @__PURE__ */ e("div", { className: "mt-3 text-center", children: /* @__PURE__ */ e("a", { href: R(n.forgot), className: "text-sm text-[var(--prui-brand)] hover:underline", children: q(n.forgot, "Forgot password?") }) }) : null,
|
|
165
|
+
(n == null ? void 0 : n.register) !== !1 && (n != null && n.register) ? /* @__PURE__ */ r("div", { className: "mt-1 text-center text-sm text-[var(--prui-dim)]", children: [
|
|
143
166
|
"No account?",
|
|
144
167
|
" ",
|
|
145
|
-
/* @__PURE__ */ e("a", { href: n.register
|
|
168
|
+
/* @__PURE__ */ e("a", { href: R(n.register), className: "text-[var(--prui-brand)] hover:underline", children: q(n.register, "Register") })
|
|
146
169
|
] }) : null
|
|
147
170
|
] });
|
|
148
171
|
}
|
|
149
|
-
const
|
|
172
|
+
const Fe = {
|
|
150
173
|
name: "LoginPage",
|
|
151
174
|
props: [
|
|
152
175
|
{ name: "onSubmit", type: "(values) => void | Promise<void>", default: null, control: "none" },
|
|
@@ -158,23 +181,23 @@ const Ce = {
|
|
|
158
181
|
{ name: "error", type: "string | null", default: "null", control: "text" }
|
|
159
182
|
]
|
|
160
183
|
};
|
|
161
|
-
function
|
|
184
|
+
function de({
|
|
162
185
|
onSubmit: t,
|
|
163
|
-
fields:
|
|
186
|
+
fields: a,
|
|
164
187
|
extraFields: o,
|
|
165
188
|
links: n,
|
|
166
|
-
oauth:
|
|
189
|
+
oauth: c,
|
|
167
190
|
brand: i,
|
|
168
191
|
submitLabel: p = "Create account",
|
|
169
|
-
loading:
|
|
192
|
+
loading: d = !1,
|
|
170
193
|
error: x
|
|
171
194
|
}) {
|
|
172
|
-
const g = { name: !0, email: !0, password: !0, confirm: !1, ...
|
|
195
|
+
const g = { name: !0, email: !0, password: !0, confirm: !1, ...a }, m = [...ie.filter(
|
|
173
196
|
(l) => l.name === "name" ? g.name !== !1 : l.name === "email" ? g.email !== !1 : g.password !== !1
|
|
174
197
|
), ...o ?? []], [f, y] = v.useState({}), [w, N] = v.useState(""), [h, B] = v.useState(!1);
|
|
175
|
-
return /* @__PURE__ */
|
|
198
|
+
return /* @__PURE__ */ r(j, { title: "Create your account", description: "Get started in minutes", brand: i, width: "max-w-md", children: [
|
|
176
199
|
/* @__PURE__ */ e(F, { error: x }),
|
|
177
|
-
/* @__PURE__ */
|
|
200
|
+
/* @__PURE__ */ r("form", { onSubmit: async (l) => {
|
|
178
201
|
l.preventDefault();
|
|
179
202
|
try {
|
|
180
203
|
const u = t == null ? void 0 : t({ ...f, confirm: w });
|
|
@@ -183,8 +206,8 @@ function le({
|
|
|
183
206
|
B(!1);
|
|
184
207
|
}
|
|
185
208
|
}, className: "flex flex-col gap-3", "data-testid": "register-form", children: [
|
|
186
|
-
m.map((l) => /* @__PURE__ */
|
|
187
|
-
/* @__PURE__ */
|
|
209
|
+
m.map((l) => /* @__PURE__ */ r("div", { className: "flex flex-col gap-1.5", children: [
|
|
210
|
+
/* @__PURE__ */ r(C, { htmlFor: `register-${l.name}`, children: [
|
|
188
211
|
l.label,
|
|
189
212
|
l.required ? /* @__PURE__ */ e("span", { className: "ml-0.5 text-[var(--prui-danger)]", children: "*" }) : null
|
|
190
213
|
] }),
|
|
@@ -196,14 +219,14 @@ function le({
|
|
|
196
219
|
placeholder: l.placeholder,
|
|
197
220
|
autoComplete: l.autoComplete,
|
|
198
221
|
required: l.required,
|
|
199
|
-
disabled:
|
|
222
|
+
disabled: d || h,
|
|
200
223
|
value: f[l.name] ?? "",
|
|
201
224
|
onChange: (u) => y((b) => ({ ...b, [l.name]: u.target.value }))
|
|
202
225
|
}
|
|
203
226
|
)
|
|
204
227
|
] }, l.name)),
|
|
205
|
-
g.confirm ? /* @__PURE__ */
|
|
206
|
-
/* @__PURE__ */
|
|
228
|
+
g.confirm ? /* @__PURE__ */ r("div", { className: "flex flex-col gap-1.5", "data-testid": "register-confirm", children: [
|
|
229
|
+
/* @__PURE__ */ r(C, { htmlFor: "register-confirm-password", children: [
|
|
207
230
|
"Confirm password",
|
|
208
231
|
/* @__PURE__ */ e("span", { className: "ml-0.5 text-[var(--prui-danger)]", children: "*" })
|
|
209
232
|
] }),
|
|
@@ -214,23 +237,23 @@ function le({
|
|
|
214
237
|
type: "password",
|
|
215
238
|
autoComplete: "new-password",
|
|
216
239
|
required: !0,
|
|
217
|
-
disabled:
|
|
240
|
+
disabled: d || h,
|
|
218
241
|
value: w,
|
|
219
242
|
onChange: (l) => N(l.target.value)
|
|
220
243
|
}
|
|
221
244
|
)
|
|
222
245
|
] }) : null,
|
|
223
|
-
/* @__PURE__ */ e(S, { type: "submit", variant: "primary", loading:
|
|
246
|
+
/* @__PURE__ */ e(S, { type: "submit", variant: "primary", loading: d || h, "data-testid": "register-submit", children: p })
|
|
224
247
|
] }),
|
|
225
|
-
/* @__PURE__ */ e(
|
|
226
|
-
n != null && n.login ? /* @__PURE__ */
|
|
248
|
+
/* @__PURE__ */ e(V, { providers: c }),
|
|
249
|
+
n != null && n.login ? /* @__PURE__ */ r("div", { className: "mt-3 text-center text-sm text-[var(--prui-dim)]", "data-testid": "register-login-link", children: [
|
|
227
250
|
"Already have an account?",
|
|
228
251
|
" ",
|
|
229
|
-
/* @__PURE__ */ e("a", { href: n.login
|
|
252
|
+
/* @__PURE__ */ e("a", { href: R(n.login), className: "text-[var(--prui-brand)] hover:underline", children: q(n.login, "Sign in") })
|
|
230
253
|
] }) : null
|
|
231
254
|
] });
|
|
232
255
|
}
|
|
233
|
-
const
|
|
256
|
+
const Re = {
|
|
234
257
|
name: "RegisterPage",
|
|
235
258
|
props: [
|
|
236
259
|
{ name: "onSubmit", type: "(values) => void | Promise<void>", default: null, control: "none" },
|
|
@@ -242,29 +265,29 @@ const Se = {
|
|
|
242
265
|
{ name: "error", type: "string | null", default: "null", control: "text" }
|
|
243
266
|
]
|
|
244
267
|
};
|
|
245
|
-
function
|
|
268
|
+
function ce({
|
|
246
269
|
onSubmit: t,
|
|
247
|
-
links:
|
|
270
|
+
links: a,
|
|
248
271
|
brand: o,
|
|
249
272
|
submitLabel: n = "Send reset link",
|
|
250
|
-
loading:
|
|
273
|
+
loading: c = !1,
|
|
251
274
|
error: i,
|
|
252
275
|
sent: p = !1
|
|
253
276
|
}) {
|
|
254
|
-
const [
|
|
255
|
-
return /* @__PURE__ */
|
|
277
|
+
const [d, x] = v.useState(""), [g, s] = v.useState(!1);
|
|
278
|
+
return /* @__PURE__ */ r(j, { title: "Forgot your password?", description: "Enter your email and we send you a reset link", brand: o, children: [
|
|
256
279
|
/* @__PURE__ */ e(F, { error: i }),
|
|
257
|
-
p ? /* @__PURE__ */ e("p", { "data-testid": "forgot-sent", className: "rounded-[var(--prui-radius)] border border-[var(--prui-ok)]/40 bg-[var(--prui-ok)]/10 px-3 py-3 text-center text-sm text-[var(--prui-ok)]", children: "Check your email for the reset link." }) : /* @__PURE__ */
|
|
280
|
+
p ? /* @__PURE__ */ e("p", { "data-testid": "forgot-sent", className: "rounded-[var(--prui-radius)] border border-[var(--prui-ok)]/40 bg-[var(--prui-ok)]/10 px-3 py-3 text-center text-sm text-[var(--prui-ok)]", children: "Check your email for the reset link." }) : /* @__PURE__ */ r("form", { onSubmit: async (f) => {
|
|
258
281
|
f.preventDefault();
|
|
259
282
|
try {
|
|
260
|
-
const y = t == null ? void 0 : t({ email:
|
|
283
|
+
const y = t == null ? void 0 : t({ email: d });
|
|
261
284
|
y && typeof y.then == "function" && (s(!0), await y);
|
|
262
285
|
} finally {
|
|
263
286
|
s(!1);
|
|
264
287
|
}
|
|
265
288
|
}, className: "flex flex-col gap-3", "data-testid": "forgot-form", children: [
|
|
266
|
-
/* @__PURE__ */
|
|
267
|
-
/* @__PURE__ */
|
|
289
|
+
/* @__PURE__ */ r("div", { className: "flex flex-col gap-1.5", children: [
|
|
290
|
+
/* @__PURE__ */ r(C, { htmlFor: "forgot-email", children: [
|
|
268
291
|
"Email",
|
|
269
292
|
/* @__PURE__ */ e("span", { className: "ml-0.5 text-[var(--prui-danger)]", children: "*" })
|
|
270
293
|
] }),
|
|
@@ -276,18 +299,18 @@ function oe({
|
|
|
276
299
|
autoComplete: "email",
|
|
277
300
|
required: !0,
|
|
278
301
|
placeholder: "you@example.com",
|
|
279
|
-
disabled:
|
|
280
|
-
value:
|
|
302
|
+
disabled: c || g,
|
|
303
|
+
value: d,
|
|
281
304
|
onChange: (f) => x(f.target.value)
|
|
282
305
|
}
|
|
283
306
|
)
|
|
284
307
|
] }),
|
|
285
|
-
/* @__PURE__ */ e(S, { type: "submit", variant: "primary", loading:
|
|
308
|
+
/* @__PURE__ */ e(S, { type: "submit", variant: "primary", loading: c || g, "data-testid": "forgot-submit", children: n })
|
|
286
309
|
] }),
|
|
287
|
-
(
|
|
310
|
+
(a == null ? void 0 : a.login) !== !1 && (a != null && a.login) ? /* @__PURE__ */ e("div", { className: "mt-3 text-center text-sm", children: /* @__PURE__ */ e("a", { href: R(a.login), className: "text-[var(--prui-brand)] hover:underline", children: q(a.login, "Back to sign in") }) }) : null
|
|
288
311
|
] });
|
|
289
312
|
}
|
|
290
|
-
const
|
|
313
|
+
const qe = {
|
|
291
314
|
name: "ForgotPasswordPage",
|
|
292
315
|
props: [
|
|
293
316
|
{ name: "onSubmit", type: "({ email }) => void | Promise<void>", default: null, control: "none" },
|
|
@@ -298,19 +321,19 @@ const je = {
|
|
|
298
321
|
{ name: "sent", type: "boolean", default: "false", control: "boolean" }
|
|
299
322
|
]
|
|
300
323
|
};
|
|
301
|
-
function
|
|
324
|
+
function ue({
|
|
302
325
|
onSubmit: t,
|
|
303
|
-
fields:
|
|
326
|
+
fields: a,
|
|
304
327
|
links: o,
|
|
305
328
|
brand: n,
|
|
306
|
-
submitLabel:
|
|
329
|
+
submitLabel: c = "Reset password",
|
|
307
330
|
loading: i = !1,
|
|
308
331
|
error: p
|
|
309
332
|
}) {
|
|
310
|
-
const
|
|
311
|
-
return /* @__PURE__ */
|
|
333
|
+
const d = { password: !0, confirm: !0, ...a }, [x, g] = v.useState({ password: "", confirm: "" }), [s, m] = v.useState(!1);
|
|
334
|
+
return /* @__PURE__ */ r(j, { title: "Choose a new password", description: "Your new password must be different from previous ones", brand: n, children: [
|
|
312
335
|
/* @__PURE__ */ e(F, { error: p }),
|
|
313
|
-
/* @__PURE__ */
|
|
336
|
+
/* @__PURE__ */ r("form", { onSubmit: async (y) => {
|
|
314
337
|
y.preventDefault();
|
|
315
338
|
try {
|
|
316
339
|
const w = t == null ? void 0 : t({ ...x });
|
|
@@ -319,8 +342,8 @@ function ie({
|
|
|
319
342
|
m(!1);
|
|
320
343
|
}
|
|
321
344
|
}, className: "flex flex-col gap-3", "data-testid": "reset-form", children: [
|
|
322
|
-
|
|
323
|
-
/* @__PURE__ */
|
|
345
|
+
d.password !== !1 ? /* @__PURE__ */ r("div", { className: "flex flex-col gap-1.5", children: [
|
|
346
|
+
/* @__PURE__ */ r(C, { htmlFor: "reset-password", children: [
|
|
324
347
|
"New password",
|
|
325
348
|
/* @__PURE__ */ e("span", { className: "ml-0.5 text-[var(--prui-danger)]", children: "*" })
|
|
326
349
|
] }),
|
|
@@ -337,8 +360,8 @@ function ie({
|
|
|
337
360
|
}
|
|
338
361
|
)
|
|
339
362
|
] }) : null,
|
|
340
|
-
|
|
341
|
-
/* @__PURE__ */
|
|
363
|
+
d.confirm !== !1 ? /* @__PURE__ */ r("div", { className: "flex flex-col gap-1.5", "data-testid": "reset-confirm", children: [
|
|
364
|
+
/* @__PURE__ */ r(C, { htmlFor: "reset-confirm", children: [
|
|
342
365
|
"Confirm password",
|
|
343
366
|
/* @__PURE__ */ e("span", { className: "ml-0.5 text-[var(--prui-danger)]", children: "*" })
|
|
344
367
|
] }),
|
|
@@ -355,12 +378,12 @@ function ie({
|
|
|
355
378
|
}
|
|
356
379
|
)
|
|
357
380
|
] }) : null,
|
|
358
|
-
/* @__PURE__ */ e(S, { type: "submit", variant: "primary", loading: i || s, "data-testid": "reset-submit", children:
|
|
381
|
+
/* @__PURE__ */ e(S, { type: "submit", variant: "primary", loading: i || s, "data-testid": "reset-submit", children: c })
|
|
359
382
|
] }),
|
|
360
|
-
(o == null ? void 0 : o.login) !== !1 && (o != null && o.login) ? /* @__PURE__ */ e("div", { className: "mt-3 text-center text-sm", children: /* @__PURE__ */ e("a", { href: o.login
|
|
383
|
+
(o == null ? void 0 : o.login) !== !1 && (o != null && o.login) ? /* @__PURE__ */ e("div", { className: "mt-3 text-center text-sm", children: /* @__PURE__ */ e("a", { href: R(o.login), className: "text-[var(--prui-brand)] hover:underline", children: q(o.login, "Back to sign in") }) }) : null
|
|
361
384
|
] });
|
|
362
385
|
}
|
|
363
|
-
const
|
|
386
|
+
const Ee = {
|
|
364
387
|
name: "ResetPasswordPage",
|
|
365
388
|
props: [
|
|
366
389
|
{ name: "onSubmit", type: "({ password, confirm }) => void | Promise<void>", default: null, control: "none" },
|
|
@@ -371,44 +394,44 @@ const Be = {
|
|
|
371
394
|
{ name: "error", type: "string | null", default: "null", control: "text" }
|
|
372
395
|
]
|
|
373
396
|
};
|
|
374
|
-
function
|
|
397
|
+
function me({
|
|
375
398
|
onSubmit: t,
|
|
376
|
-
length:
|
|
399
|
+
length: a = 6,
|
|
377
400
|
title: o = "Enter verification code",
|
|
378
401
|
description: n = "We sent a code to your email",
|
|
379
|
-
brand:
|
|
402
|
+
brand: c,
|
|
380
403
|
submitLabel: i = "Verify",
|
|
381
404
|
loading: p = !1,
|
|
382
|
-
error:
|
|
405
|
+
error: d,
|
|
383
406
|
onResend: x,
|
|
384
407
|
resendLabel: g = "Resend code"
|
|
385
408
|
}) {
|
|
386
|
-
const [s, m] = v.useState(() => Array.from({ length:
|
|
387
|
-
var
|
|
409
|
+
const [s, m] = v.useState(() => Array.from({ length: a }, () => "")), f = v.useRef([]), y = s.join(""), w = (l, u) => {
|
|
410
|
+
var L, A;
|
|
388
411
|
const b = u.replace(/\D/g, "");
|
|
389
412
|
if (b.length > 1) {
|
|
390
|
-
const
|
|
391
|
-
m((
|
|
392
|
-
const
|
|
393
|
-
return
|
|
394
|
-
|
|
395
|
-
}),
|
|
413
|
+
const E = b.slice(0, a - l).split("");
|
|
414
|
+
m((O) => {
|
|
415
|
+
const I = [...O];
|
|
416
|
+
return E.forEach((G, $) => {
|
|
417
|
+
I[l + $] = G;
|
|
418
|
+
}), I;
|
|
396
419
|
});
|
|
397
|
-
const
|
|
398
|
-
(
|
|
420
|
+
const D = Math.min(l + E.length, a - 1);
|
|
421
|
+
(L = f.current[D]) == null || L.focus();
|
|
399
422
|
return;
|
|
400
423
|
}
|
|
401
|
-
m((
|
|
402
|
-
const
|
|
403
|
-
return
|
|
404
|
-
}), b && l <
|
|
424
|
+
m((E) => {
|
|
425
|
+
const D = [...E];
|
|
426
|
+
return D[l] = b, D;
|
|
427
|
+
}), b && l < a - 1 && ((A = f.current[l + 1]) == null || A.focus());
|
|
405
428
|
}, N = (l, u) => {
|
|
406
429
|
var b;
|
|
407
430
|
u.key === "Backspace" && !s[l] && l > 0 && ((b = f.current[l - 1]) == null || b.focus());
|
|
408
431
|
}, [h, B] = v.useState(!1);
|
|
409
|
-
return /* @__PURE__ */
|
|
410
|
-
/* @__PURE__ */ e(F, { error:
|
|
411
|
-
/* @__PURE__ */
|
|
432
|
+
return /* @__PURE__ */ r(j, { title: o, description: n, brand: c, children: [
|
|
433
|
+
/* @__PURE__ */ e(F, { error: d }),
|
|
434
|
+
/* @__PURE__ */ r("form", { onSubmit: async (l) => {
|
|
412
435
|
l.preventDefault();
|
|
413
436
|
try {
|
|
414
437
|
const u = t == null ? void 0 : t(y);
|
|
@@ -426,7 +449,7 @@ function se({
|
|
|
426
449
|
type: "text",
|
|
427
450
|
inputMode: "numeric",
|
|
428
451
|
autoComplete: "one-time-code",
|
|
429
|
-
maxLength:
|
|
452
|
+
maxLength: a,
|
|
430
453
|
"aria-label": `Digit ${u + 1}`,
|
|
431
454
|
className: "h-11 w-10 text-center text-lg",
|
|
432
455
|
disabled: p || h,
|
|
@@ -449,7 +472,7 @@ function se({
|
|
|
449
472
|
) }) : null
|
|
450
473
|
] });
|
|
451
474
|
}
|
|
452
|
-
const
|
|
475
|
+
const De = {
|
|
453
476
|
name: "OtpPage",
|
|
454
477
|
props: [
|
|
455
478
|
{ name: "onSubmit", type: "(code: string) => void | Promise<void>", default: null, control: "none" },
|
|
@@ -460,15 +483,15 @@ const Fe = {
|
|
|
460
483
|
{ name: "onResend", type: "() => void | Promise<void>", default: null, control: "none" }
|
|
461
484
|
]
|
|
462
485
|
};
|
|
463
|
-
function
|
|
486
|
+
function pe({ onLogout: t, brand: a, message: o, loading: n = !1 }) {
|
|
464
487
|
return v.useEffect(() => {
|
|
465
488
|
t && t();
|
|
466
|
-
}, [t]), /* @__PURE__ */ e(j, { title: "Signing out", brand:
|
|
467
|
-
/* @__PURE__ */ e(
|
|
489
|
+
}, [t]), /* @__PURE__ */ e(j, { title: "Signing out", brand: a, width: "max-w-xs", children: /* @__PURE__ */ r("div", { className: "flex flex-col items-center gap-3 py-4 text-[var(--prui-dim)]", "data-testid": "logout-page", children: [
|
|
490
|
+
/* @__PURE__ */ e(z, { className: "h-6 w-6", "aria-hidden": !0 }),
|
|
468
491
|
/* @__PURE__ */ e("p", { className: "text-sm text-center", children: o ?? (n ? "Signing you out..." : "You have been signed out.") })
|
|
469
492
|
] }) });
|
|
470
493
|
}
|
|
471
|
-
const
|
|
494
|
+
const Me = {
|
|
472
495
|
name: "LogoutPage",
|
|
473
496
|
props: [
|
|
474
497
|
{ name: "onLogout", type: "() => void | Promise<void>", default: null, control: "none" },
|
|
@@ -477,20 +500,20 @@ const Re = {
|
|
|
477
500
|
{ name: "loading", type: "boolean", default: "false", control: "boolean" }
|
|
478
501
|
]
|
|
479
502
|
};
|
|
480
|
-
function
|
|
503
|
+
function fe({
|
|
481
504
|
title: t = "Page not found",
|
|
482
|
-
description:
|
|
505
|
+
description: a = "The page you are looking for does not exist or has been moved.",
|
|
483
506
|
homeHref: o = "/",
|
|
484
507
|
onGoHome: n,
|
|
485
|
-
brand:
|
|
508
|
+
brand: c
|
|
486
509
|
}) {
|
|
487
|
-
return /* @__PURE__ */ e(j, { title: t, description:
|
|
488
|
-
/* @__PURE__ */ e(
|
|
510
|
+
return /* @__PURE__ */ e(j, { title: t, description: a, brand: c, width: "max-w-md", children: /* @__PURE__ */ r("div", { className: "flex flex-col items-center gap-4 py-4", "data-testid": "notfound-page", children: [
|
|
511
|
+
/* @__PURE__ */ e(Q, { className: "h-10 w-10 text-[var(--prui-dim)]", "aria-hidden": !0 }),
|
|
489
512
|
/* @__PURE__ */ e("code", { className: "text-3xl font-bold text-[var(--prui-fg)]", children: "404" }),
|
|
490
513
|
n ? /* @__PURE__ */ e(S, { variant: "primary", onClick: n, "data-testid": "notfound-home", children: "Go home" }) : /* @__PURE__ */ e(S, { variant: "primary", asChild: !0, "data-testid": "notfound-home", children: /* @__PURE__ */ e("a", { href: o, children: "Go home" }) })
|
|
491
514
|
] }) });
|
|
492
515
|
}
|
|
493
|
-
const
|
|
516
|
+
const Le = {
|
|
494
517
|
name: "NotFoundPage",
|
|
495
518
|
props: [
|
|
496
519
|
{ name: "title", type: "string", default: "'Page not found'", control: "text" },
|
|
@@ -500,21 +523,21 @@ const qe = {
|
|
|
500
523
|
{ name: "brand", type: "BrandConfig", default: "undefined", control: "object" }
|
|
501
524
|
]
|
|
502
525
|
};
|
|
503
|
-
function
|
|
526
|
+
function he({
|
|
504
527
|
title: t = "Something went wrong",
|
|
505
|
-
error:
|
|
528
|
+
error: a,
|
|
506
529
|
onRetry: o,
|
|
507
530
|
retryLabel: n = "Try again",
|
|
508
|
-
brand:
|
|
531
|
+
brand: c
|
|
509
532
|
}) {
|
|
510
|
-
const i =
|
|
511
|
-
return /* @__PURE__ */ e(j, { title: t, brand:
|
|
512
|
-
/* @__PURE__ */ e(
|
|
533
|
+
const i = a instanceof Error ? a.message : typeof a == "string" ? a : void 0;
|
|
534
|
+
return /* @__PURE__ */ e(j, { title: t, brand: c, width: "max-w-md", children: /* @__PURE__ */ r("div", { className: "flex flex-col items-center gap-4 py-4", "data-testid": "error-page", children: [
|
|
535
|
+
/* @__PURE__ */ e(W, { className: "h-10 w-10 text-[var(--prui-warn)]", "aria-hidden": !0 }),
|
|
513
536
|
i ? /* @__PURE__ */ e("p", { role: "alert", className: "rounded-[var(--prui-radius)] border border-[var(--prui-warn)]/40 bg-[var(--prui-warn)]/10 px-3 py-2 text-sm text-[var(--prui-warn)]", children: i }) : /* @__PURE__ */ e("p", { className: "text-sm text-[var(--prui-dim)]", children: "An unexpected error occurred." }),
|
|
514
537
|
o ? /* @__PURE__ */ e(S, { variant: "primary", onClick: o, "data-testid": "error-retry", children: n }) : null
|
|
515
538
|
] }) });
|
|
516
539
|
}
|
|
517
|
-
const
|
|
540
|
+
const Ae = {
|
|
518
541
|
name: "ErrorPage",
|
|
519
542
|
props: [
|
|
520
543
|
{ name: "title", type: "string", default: "'Something went wrong'", control: "text" },
|
|
@@ -524,23 +547,23 @@ const Ee = {
|
|
|
524
547
|
{ name: "brand", type: "BrandConfig", default: "undefined", control: "object" }
|
|
525
548
|
]
|
|
526
549
|
};
|
|
527
|
-
function
|
|
550
|
+
function Ie({
|
|
528
551
|
title: t = "Nothing here yet",
|
|
529
|
-
description:
|
|
552
|
+
description: a,
|
|
530
553
|
icon: o = K,
|
|
531
554
|
action: n,
|
|
532
|
-
className:
|
|
555
|
+
className: c
|
|
533
556
|
}) {
|
|
534
|
-
return /* @__PURE__ */
|
|
557
|
+
return /* @__PURE__ */ r("div", { className: c ?? "flex flex-col items-center justify-center gap-3 rounded-[var(--prui-radius)] border border-dashed border-[var(--prui-line)] px-6 py-12 text-center", "data-testid": "empty-state", children: [
|
|
535
558
|
/* @__PURE__ */ e(o, { className: "h-8 w-8 text-[var(--prui-dim)]", "aria-hidden": !0 }),
|
|
536
|
-
/* @__PURE__ */
|
|
559
|
+
/* @__PURE__ */ r("div", { children: [
|
|
537
560
|
/* @__PURE__ */ e("p", { className: "text-sm font-medium text-[var(--prui-fg)]", children: t }),
|
|
538
|
-
|
|
561
|
+
a ? /* @__PURE__ */ e("p", { className: "mt-1 text-sm text-[var(--prui-dim)]", children: a }) : null
|
|
539
562
|
] }),
|
|
540
563
|
n
|
|
541
564
|
] });
|
|
542
565
|
}
|
|
543
|
-
const
|
|
566
|
+
const Te = {
|
|
544
567
|
name: "EmptyState",
|
|
545
568
|
props: [
|
|
546
569
|
{ name: "title", type: "string", default: "'Nothing here yet'", control: "text" },
|
|
@@ -549,15 +572,15 @@ const Me = {
|
|
|
549
572
|
{ name: "action", type: "ReactNode", default: null, control: "none" }
|
|
550
573
|
]
|
|
551
574
|
};
|
|
552
|
-
function
|
|
575
|
+
function ge({
|
|
553
576
|
profile: t = {},
|
|
554
|
-
onSubmit:
|
|
577
|
+
onSubmit: a,
|
|
555
578
|
fields: o,
|
|
556
579
|
onSignOut: n,
|
|
557
|
-
signOutLabel:
|
|
580
|
+
signOutLabel: c = "Sign out",
|
|
558
581
|
brand: i,
|
|
559
582
|
submitLabel: p = "Save profile",
|
|
560
|
-
loading:
|
|
583
|
+
loading: d = !1,
|
|
561
584
|
error: x
|
|
562
585
|
}) {
|
|
563
586
|
const g = { name: !0, email: !0, bio: !0, ...o }, [s, m] = v.useState({
|
|
@@ -565,67 +588,67 @@ function me({
|
|
|
565
588
|
email: t.email ?? "",
|
|
566
589
|
bio: t.bio ?? ""
|
|
567
590
|
}), [f, y] = v.useState(!1);
|
|
568
|
-
return /* @__PURE__ */
|
|
591
|
+
return /* @__PURE__ */ r(j, { title: "Your profile", brand: i, width: "max-w-lg", children: [
|
|
569
592
|
/* @__PURE__ */ e(F, { error: x }),
|
|
570
|
-
/* @__PURE__ */
|
|
593
|
+
/* @__PURE__ */ r("form", { onSubmit: async (N) => {
|
|
571
594
|
N.preventDefault();
|
|
572
595
|
try {
|
|
573
|
-
const h =
|
|
596
|
+
const h = a == null ? void 0 : a({ ...s });
|
|
574
597
|
h && typeof h.then == "function" && (y(!0), await h);
|
|
575
598
|
} finally {
|
|
576
599
|
y(!1);
|
|
577
600
|
}
|
|
578
601
|
}, className: "flex flex-col gap-4", "data-testid": "profile-form", children: [
|
|
579
|
-
/* @__PURE__ */
|
|
580
|
-
/* @__PURE__ */ e(
|
|
602
|
+
/* @__PURE__ */ r("div", { className: "flex items-center gap-3", "data-testid": "profile-avatar", children: [
|
|
603
|
+
/* @__PURE__ */ e(ae, { src: t.avatar, alt: s.name || "User", size: "lg" }),
|
|
581
604
|
/* @__PURE__ */ e("div", { className: "text-sm text-[var(--prui-dim)]", children: s.email || "No email" })
|
|
582
605
|
] }),
|
|
583
|
-
g.name !== !1 ? /* @__PURE__ */
|
|
606
|
+
g.name !== !1 ? /* @__PURE__ */ r("div", { className: "flex flex-col gap-1.5", children: [
|
|
584
607
|
/* @__PURE__ */ e(C, { htmlFor: "profile-name", children: "Name" }),
|
|
585
608
|
/* @__PURE__ */ e(
|
|
586
609
|
P,
|
|
587
610
|
{
|
|
588
611
|
id: "profile-name",
|
|
589
|
-
disabled:
|
|
612
|
+
disabled: d || f,
|
|
590
613
|
value: s.name,
|
|
591
614
|
onChange: (N) => m((h) => ({ ...h, name: N.target.value }))
|
|
592
615
|
}
|
|
593
616
|
)
|
|
594
617
|
] }) : null,
|
|
595
|
-
g.email !== !1 ? /* @__PURE__ */
|
|
618
|
+
g.email !== !1 ? /* @__PURE__ */ r("div", { className: "flex flex-col gap-1.5", children: [
|
|
596
619
|
/* @__PURE__ */ e(C, { htmlFor: "profile-email", children: "Email" }),
|
|
597
620
|
/* @__PURE__ */ e(
|
|
598
621
|
P,
|
|
599
622
|
{
|
|
600
623
|
id: "profile-email",
|
|
601
624
|
type: "email",
|
|
602
|
-
disabled:
|
|
625
|
+
disabled: d || f,
|
|
603
626
|
value: s.email,
|
|
604
627
|
onChange: (N) => m((h) => ({ ...h, email: N.target.value }))
|
|
605
628
|
}
|
|
606
629
|
)
|
|
607
630
|
] }) : null,
|
|
608
|
-
g.bio !== !1 ? /* @__PURE__ */
|
|
631
|
+
g.bio !== !1 ? /* @__PURE__ */ r("div", { className: "flex flex-col gap-1.5", children: [
|
|
609
632
|
/* @__PURE__ */ e(C, { htmlFor: "profile-bio", children: "Bio" }),
|
|
610
633
|
/* @__PURE__ */ e(
|
|
611
|
-
|
|
634
|
+
U,
|
|
612
635
|
{
|
|
613
636
|
id: "profile-bio",
|
|
614
637
|
rows: 3,
|
|
615
|
-
disabled:
|
|
638
|
+
disabled: d || f,
|
|
616
639
|
value: s.bio,
|
|
617
640
|
onChange: (N) => m((h) => ({ ...h, bio: N.target.value }))
|
|
618
641
|
}
|
|
619
642
|
)
|
|
620
643
|
] }) : null,
|
|
621
|
-
/* @__PURE__ */
|
|
622
|
-
n ? /* @__PURE__ */ e(S, { type: "button", variant: "ghost", onClick: n, children:
|
|
623
|
-
/* @__PURE__ */ e(S, { type: "submit", variant: "primary", loading:
|
|
644
|
+
/* @__PURE__ */ r("div", { className: "flex items-center justify-between", children: [
|
|
645
|
+
n ? /* @__PURE__ */ e(S, { type: "button", variant: "ghost", onClick: n, children: c }) : /* @__PURE__ */ e("span", {}),
|
|
646
|
+
/* @__PURE__ */ e(S, { type: "submit", variant: "primary", loading: d || f, "data-testid": "profile-submit", children: p })
|
|
624
647
|
] })
|
|
625
648
|
] })
|
|
626
649
|
] });
|
|
627
650
|
}
|
|
628
|
-
const
|
|
651
|
+
const Ve = {
|
|
629
652
|
name: "ProfilePage",
|
|
630
653
|
props: [
|
|
631
654
|
{ name: "profile", type: "{ name?, email?, avatar?, bio? }", default: "{}", control: "object" },
|
|
@@ -637,32 +660,32 @@ const Le = {
|
|
|
637
660
|
{ name: "error", type: "string | null", default: "null", control: "text" }
|
|
638
661
|
]
|
|
639
662
|
};
|
|
640
|
-
function
|
|
641
|
-
return /* @__PURE__ */ e(j, { title: t, brand: o, width: "max-w-lg", children: /* @__PURE__ */
|
|
642
|
-
/* @__PURE__ */
|
|
643
|
-
/* @__PURE__ */ e(
|
|
644
|
-
/* @__PURE__ */ e(
|
|
663
|
+
function ve({ title: t = "Settings", toggles: a = [], brand: o }) {
|
|
664
|
+
return /* @__PURE__ */ e(j, { title: t, brand: o, width: "max-w-lg", children: /* @__PURE__ */ r(J, { children: [
|
|
665
|
+
/* @__PURE__ */ r(X, { children: [
|
|
666
|
+
/* @__PURE__ */ e(Z, { children: "Preferences" }),
|
|
667
|
+
/* @__PURE__ */ e(k, { children: "Changes apply immediately." })
|
|
645
668
|
] }),
|
|
646
|
-
/* @__PURE__ */ e(
|
|
647
|
-
/* @__PURE__ */ e(
|
|
648
|
-
|
|
669
|
+
/* @__PURE__ */ e(ee, { className: "flex flex-col divide-y divide-[var(--prui-line)]", children: a.length === 0 ? /* @__PURE__ */ e("p", { className: "py-3 text-sm text-[var(--prui-dim)]", children: "No settings available." }) : a.map((n) => /* @__PURE__ */ e(ye, { toggle: n }, n.id)) }),
|
|
670
|
+
/* @__PURE__ */ e(te, { className: "justify-end", children: /* @__PURE__ */ r("span", { className: "text-xs text-[var(--prui-dim)]", "data-testid": "settings-page", children: [
|
|
671
|
+
a.length,
|
|
649
672
|
" setting",
|
|
650
|
-
|
|
673
|
+
a.length === 1 ? "" : "s"
|
|
651
674
|
] }) })
|
|
652
675
|
] }) });
|
|
653
676
|
}
|
|
654
|
-
function
|
|
655
|
-
const [
|
|
656
|
-
return /* @__PURE__ */
|
|
657
|
-
/* @__PURE__ */
|
|
677
|
+
function ye({ toggle: t }) {
|
|
678
|
+
const [a, o] = v.useState(t.defaultChecked ?? !1), n = t.checked !== void 0, c = n ? t.checked : a;
|
|
679
|
+
return /* @__PURE__ */ r("div", { className: "flex items-center justify-between gap-4 py-3 first:pt-0 last:pb-0", children: [
|
|
680
|
+
/* @__PURE__ */ r("div", { className: "min-w-0", children: [
|
|
658
681
|
/* @__PURE__ */ e("p", { className: "text-sm font-medium text-[var(--prui-fg)]", children: t.label }),
|
|
659
682
|
t.description ? /* @__PURE__ */ e("p", { className: "text-xs text-[var(--prui-dim)]", children: t.description }) : null
|
|
660
683
|
] }),
|
|
661
684
|
/* @__PURE__ */ e(
|
|
662
|
-
|
|
685
|
+
re,
|
|
663
686
|
{
|
|
664
687
|
"aria-label": t.label,
|
|
665
|
-
checked:
|
|
688
|
+
checked: c,
|
|
666
689
|
onChange: (i) => {
|
|
667
690
|
var p;
|
|
668
691
|
n || o(i), (p = t.onChange) == null || p.call(t, i);
|
|
@@ -671,7 +694,7 @@ function fe({ toggle: t }) {
|
|
|
671
694
|
)
|
|
672
695
|
] });
|
|
673
696
|
}
|
|
674
|
-
const
|
|
697
|
+
const Oe = {
|
|
675
698
|
name: "SettingsPage",
|
|
676
699
|
props: [
|
|
677
700
|
{ name: "title", type: "string", default: "'Settings'", control: "text" },
|
|
@@ -679,17 +702,17 @@ const Ae = {
|
|
|
679
702
|
{ name: "brand", type: "BrandConfig", default: "undefined", control: "object" }
|
|
680
703
|
]
|
|
681
704
|
};
|
|
682
|
-
function
|
|
705
|
+
function xe({
|
|
683
706
|
onSubmit: t,
|
|
684
|
-
brand:
|
|
707
|
+
brand: a,
|
|
685
708
|
description: o = "Create the first administrator account for this instance.",
|
|
686
709
|
loading: n = !1,
|
|
687
|
-
error:
|
|
710
|
+
error: c
|
|
688
711
|
}) {
|
|
689
|
-
const [i, p] = v.useState({ name: "", email: "", password: "" }), [
|
|
690
|
-
return /* @__PURE__ */
|
|
691
|
-
/* @__PURE__ */ e(F, { error:
|
|
692
|
-
/* @__PURE__ */
|
|
712
|
+
const [i, p] = v.useState({ name: "", email: "", password: "" }), [d, x] = v.useState(!1);
|
|
713
|
+
return /* @__PURE__ */ r(j, { title: "Set up admin", description: o, brand: a, width: "max-w-md", children: [
|
|
714
|
+
/* @__PURE__ */ e(F, { error: c }),
|
|
715
|
+
/* @__PURE__ */ r("form", { onSubmit: async (s) => {
|
|
693
716
|
s.preventDefault();
|
|
694
717
|
try {
|
|
695
718
|
const m = t == null ? void 0 : t({ ...i });
|
|
@@ -698,8 +721,8 @@ function he({
|
|
|
698
721
|
x(!1);
|
|
699
722
|
}
|
|
700
723
|
}, className: "flex flex-col gap-3", "data-testid": "adminsetup-form", children: [
|
|
701
|
-
/* @__PURE__ */
|
|
702
|
-
/* @__PURE__ */
|
|
724
|
+
/* @__PURE__ */ r("div", { className: "flex flex-col gap-1.5", children: [
|
|
725
|
+
/* @__PURE__ */ r(C, { htmlFor: "admin-name", children: [
|
|
703
726
|
"Name",
|
|
704
727
|
/* @__PURE__ */ e("span", { className: "ml-0.5 text-[var(--prui-danger)]", children: "*" })
|
|
705
728
|
] }),
|
|
@@ -709,14 +732,14 @@ function he({
|
|
|
709
732
|
id: "admin-name",
|
|
710
733
|
required: !0,
|
|
711
734
|
autoComplete: "name",
|
|
712
|
-
disabled: n ||
|
|
735
|
+
disabled: n || d,
|
|
713
736
|
value: i.name,
|
|
714
737
|
onChange: (s) => p((m) => ({ ...m, name: s.target.value }))
|
|
715
738
|
}
|
|
716
739
|
)
|
|
717
740
|
] }),
|
|
718
|
-
/* @__PURE__ */
|
|
719
|
-
/* @__PURE__ */
|
|
741
|
+
/* @__PURE__ */ r("div", { className: "flex flex-col gap-1.5", children: [
|
|
742
|
+
/* @__PURE__ */ r(C, { htmlFor: "admin-email", children: [
|
|
720
743
|
"Email",
|
|
721
744
|
/* @__PURE__ */ e("span", { className: "ml-0.5 text-[var(--prui-danger)]", children: "*" })
|
|
722
745
|
] }),
|
|
@@ -727,14 +750,14 @@ function he({
|
|
|
727
750
|
type: "email",
|
|
728
751
|
required: !0,
|
|
729
752
|
autoComplete: "email",
|
|
730
|
-
disabled: n ||
|
|
753
|
+
disabled: n || d,
|
|
731
754
|
value: i.email,
|
|
732
755
|
onChange: (s) => p((m) => ({ ...m, email: s.target.value }))
|
|
733
756
|
}
|
|
734
757
|
)
|
|
735
758
|
] }),
|
|
736
|
-
/* @__PURE__ */
|
|
737
|
-
/* @__PURE__ */
|
|
759
|
+
/* @__PURE__ */ r("div", { className: "flex flex-col gap-1.5", children: [
|
|
760
|
+
/* @__PURE__ */ r(C, { htmlFor: "admin-password", children: [
|
|
738
761
|
"Password",
|
|
739
762
|
/* @__PURE__ */ e("span", { className: "ml-0.5 text-[var(--prui-danger)]", children: "*" })
|
|
740
763
|
] }),
|
|
@@ -745,17 +768,17 @@ function he({
|
|
|
745
768
|
type: "password",
|
|
746
769
|
required: !0,
|
|
747
770
|
autoComplete: "new-password",
|
|
748
|
-
disabled: n ||
|
|
771
|
+
disabled: n || d,
|
|
749
772
|
value: i.password,
|
|
750
773
|
onChange: (s) => p((m) => ({ ...m, password: s.target.value }))
|
|
751
774
|
}
|
|
752
775
|
)
|
|
753
776
|
] }),
|
|
754
|
-
/* @__PURE__ */ e(S, { type: "submit", variant: "primary", loading: n ||
|
|
777
|
+
/* @__PURE__ */ e(S, { type: "submit", variant: "primary", loading: n || d, "data-testid": "adminsetup-submit", children: "Create admin" })
|
|
755
778
|
] })
|
|
756
779
|
] });
|
|
757
780
|
}
|
|
758
|
-
const
|
|
781
|
+
const Ge = {
|
|
759
782
|
name: "AdminSetup",
|
|
760
783
|
props: [
|
|
761
784
|
{ name: "onSubmit", type: "(values) => void | Promise<void>", default: null, control: "none" },
|
|
@@ -764,43 +787,43 @@ const Te = {
|
|
|
764
787
|
{ name: "loading", type: "boolean", default: "false", control: "boolean" },
|
|
765
788
|
{ name: "error", type: "string | null", default: "null", control: "text" }
|
|
766
789
|
]
|
|
767
|
-
},
|
|
768
|
-
login:
|
|
769
|
-
register:
|
|
770
|
-
forgotPassword:
|
|
771
|
-
resetPassword:
|
|
772
|
-
otp:
|
|
773
|
-
logout:
|
|
774
|
-
notFound:
|
|
775
|
-
error:
|
|
776
|
-
profile:
|
|
777
|
-
settings:
|
|
778
|
-
adminSetup:
|
|
790
|
+
}, $e = {
|
|
791
|
+
login: se,
|
|
792
|
+
register: de,
|
|
793
|
+
forgotPassword: ce,
|
|
794
|
+
resetPassword: ue,
|
|
795
|
+
otp: me,
|
|
796
|
+
logout: pe,
|
|
797
|
+
notFound: fe,
|
|
798
|
+
error: he,
|
|
799
|
+
profile: ge,
|
|
800
|
+
settings: ve,
|
|
801
|
+
adminSetup: xe
|
|
779
802
|
};
|
|
780
803
|
export {
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
804
|
+
xe as AdminSetup,
|
|
805
|
+
Ie as EmptyState,
|
|
806
|
+
he as ErrorPage,
|
|
807
|
+
ce as ForgotPasswordPage,
|
|
808
|
+
se as LoginPage,
|
|
809
|
+
pe as LogoutPage,
|
|
810
|
+
fe as NotFoundPage,
|
|
811
|
+
me as OtpPage,
|
|
812
|
+
$e as PagesRegistry,
|
|
813
|
+
ge as ProfilePage,
|
|
814
|
+
de as RegisterPage,
|
|
815
|
+
ue as ResetPasswordPage,
|
|
816
|
+
ve as SettingsPage,
|
|
817
|
+
Ge as adminSetupPropsMeta,
|
|
818
|
+
Te as emptyStatePropsMeta,
|
|
819
|
+
Ae as errorPagePropsMeta,
|
|
820
|
+
qe as forgotPasswordPagePropsMeta,
|
|
821
|
+
Fe as loginPagePropsMeta,
|
|
822
|
+
Me as logoutPagePropsMeta,
|
|
823
|
+
Le as notFoundPagePropsMeta,
|
|
824
|
+
De as otpPagePropsMeta,
|
|
825
|
+
Ve as profilePagePropsMeta,
|
|
826
|
+
Re as registerPagePropsMeta,
|
|
827
|
+
Ee as resetPasswordPagePropsMeta,
|
|
828
|
+
Oe as settingsPagePropsMeta
|
|
806
829
|
};
|