@alfadocs/ui-kit 1.82.0 → 1.83.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/_chunks/login-dev-card-DYwbL5sD.js +385 -0
- package/dist/agent-catalog.json +2 -2
- package/dist/agent-i18n/en.json +1 -1
- package/dist/index.js +1 -1
- package/dist/patterns/login-form/index.js +1 -1
- package/dist/patterns/login-form/login-form.d.ts +7 -0
- package/package.json +1 -1
- package/dist/_chunks/login-dev-card-CvLHj-_N.js +0 -353
|
@@ -0,0 +1,385 @@
|
|
|
1
|
+
import { jsxs as f, jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as ge, useId as k, useState as l, useEffect as me, useRef as ce } from "react";
|
|
3
|
+
import { useTranslation as ze } from "react-i18next";
|
|
4
|
+
import { c as B } from "./index-D2ZczOXr.js";
|
|
5
|
+
import { E as Pe, i as Te } from "./email-input-C7THAwh2.js";
|
|
6
|
+
import { B as he } from "./button-DohK_Ak_.js";
|
|
7
|
+
import { C as je } from "./checkbox-BjDv-r3o.js";
|
|
8
|
+
import { C as b } from "./card-BA4Ig_kn.js";
|
|
9
|
+
import { T as De } from "./text-input-CaG9ApoE.js";
|
|
10
|
+
import { E as He } from "./error-summary-mGxIyDAY.js";
|
|
11
|
+
import { F as ue } from "./form-field-CyHfOVKF.js";
|
|
12
|
+
import { P as Oe } from "./password-input-BokZ_rnT.js";
|
|
13
|
+
import { i as $e } from "./is-development-CLUAnsU7.js";
|
|
14
|
+
import { i as ve } from "./safe-href-5dbsfbQn.js";
|
|
15
|
+
import { u as _e, w as Ge } from "./use-state-backed-input-DhRQo6gM.js";
|
|
16
|
+
import { u as We, a as Je, A as Ke, b as Qe, d as _, E as Ue, c as Xe } from "./auth-form-parts-B3GWChvG.js";
|
|
17
|
+
import { u as Ye, b as Ze, a as Ve } from "./use-registration-submit-CLGHxwoT.js";
|
|
18
|
+
import { M as es } from "./matrix-rain-sDOUUwZp.js";
|
|
19
|
+
import { a as ss } from "./error-page-illustration-BdJLuMdV.js";
|
|
20
|
+
const W = ["email", "password"], rs = B(
|
|
21
|
+
"ds:flex ds:w-full ds:flex-col ds:items-center ds:justify-center ds:gap-[var(--spacing-lg)] ds:text-start ds:text-[var(--foreground)] ds:lg:flex-row ds:lg:items-stretch"
|
|
22
|
+
), fe = B("ds:w-full ds:max-w-[400px]"), as = B(
|
|
23
|
+
"ds:flex ds:flex-wrap ds:justify-center ds:gap-x-[var(--spacing-lg)] ds:gap-y-[var(--spacing-lg)]"
|
|
24
|
+
), G = (a) => a && ve(a) ? a : void 0, ts = (a) => Object.values(a).some(Boolean), os = (a) => W.some((m) => !!a[m]), pe = (a) => W.find((m) => a[m]) ?? (a.form ? "password" : void 0), ns = ge(
|
|
25
|
+
({
|
|
26
|
+
title: a,
|
|
27
|
+
description: m,
|
|
28
|
+
headingLevel: w = 1,
|
|
29
|
+
showLogo: L = !0,
|
|
30
|
+
logoMotion: R = "assemble",
|
|
31
|
+
children: x,
|
|
32
|
+
initialValues: t,
|
|
33
|
+
allowUsername: F = !1,
|
|
34
|
+
errors: u,
|
|
35
|
+
forgotPasswordHref: d,
|
|
36
|
+
showRememberMe: A = !1,
|
|
37
|
+
registerDoctorHref: be,
|
|
38
|
+
registerPatientHref: we,
|
|
39
|
+
submitLabel: xe,
|
|
40
|
+
submitting: Fe = !1,
|
|
41
|
+
onSubmit: N,
|
|
42
|
+
fieldNames: o,
|
|
43
|
+
action: ye,
|
|
44
|
+
hiddenFields: Me,
|
|
45
|
+
devCard: J,
|
|
46
|
+
className: Ee,
|
|
47
|
+
...Ce
|
|
48
|
+
}, Ie) => {
|
|
49
|
+
const { t: n } = ze("ui"), K = k(), S = k(), ke = k(), q = (e) => `${ke}-${e}`, i = o !== void 0, [p, g] = l(() => (t == null ? void 0 : t.email) ?? ""), [y, M] = l(""), [Q, Be] = l(
|
|
50
|
+
() => (t == null ? void 0 : t.rememberMe) === !0
|
|
51
|
+
), z = A || !!(o != null && o.rememberMe), U = i && z && !(o != null && o.rememberMe);
|
|
52
|
+
me(() => {
|
|
53
|
+
U && $e() && console.warn(
|
|
54
|
+
"LoginForm: the remember-me box is shown but `fieldNames.rememberMe` is not set, so the server will not read it."
|
|
55
|
+
);
|
|
56
|
+
}, [U]);
|
|
57
|
+
const [Le, X] = l(() => ({ email: !!(t != null && t.email) })), [Re, Y] = l(!1), [Z, V] = l(
|
|
58
|
+
() => u ?? {}
|
|
59
|
+
), P = (e) => X(
|
|
60
|
+
(r) => r[e] ? r : { ...r, [e]: !0 }
|
|
61
|
+
), T = (e) => V(
|
|
62
|
+
(r) => r[e] ? { ...r, [e]: void 0 } : r
|
|
63
|
+
), E = ce(null), j = ce(null), C = _e(p, E), ee = () => {
|
|
64
|
+
M(""), X((e) => ({ ...e, password: !1 }));
|
|
65
|
+
}, se = () => {
|
|
66
|
+
var v, le;
|
|
67
|
+
const e = ((v = E.current) == null ? void 0 : v.value) ?? p;
|
|
68
|
+
e.trim() !== e && Ge(E.current, e.trim());
|
|
69
|
+
const r = {
|
|
70
|
+
email: e.trim(),
|
|
71
|
+
password: ((le = j.current) == null ? void 0 : le.value) ?? y,
|
|
72
|
+
rememberMe: z && Q
|
|
73
|
+
};
|
|
74
|
+
return r.email !== p && g(r.email), r.password !== y && M(r.password), r;
|
|
75
|
+
}, re = (e) => {
|
|
76
|
+
const r = e.trim();
|
|
77
|
+
return r === "" || (!F || /[@\uFF20\uFE6B]/.test(r)) && !Te(r);
|
|
78
|
+
}, ae = {
|
|
79
|
+
email: re(p),
|
|
80
|
+
password: y === ""
|
|
81
|
+
}, te = (e) => Re || Le[e] === !0, Ae = {
|
|
82
|
+
email: te("email") && ae.email ? p.trim() === "" ? n("loginForm.emailRequired") : n("inputs.email.invalid") : void 0,
|
|
83
|
+
password: te("password") && ae.password ? n("loginForm.passwordRequired") : void 0
|
|
84
|
+
}, I = (e) => Z[e] ?? Ae[e], [oe] = l(
|
|
85
|
+
() => os(u ?? {})
|
|
86
|
+
), c = Ye(
|
|
87
|
+
W,
|
|
88
|
+
I,
|
|
89
|
+
oe
|
|
90
|
+
), [D, ne] = l(() => {
|
|
91
|
+
const e = oe ? void 0 : pe(u ?? {});
|
|
92
|
+
return e ? { target: e } : null;
|
|
93
|
+
});
|
|
94
|
+
me(() => {
|
|
95
|
+
var e;
|
|
96
|
+
D && ((e = (D.target === "email" ? E : j).current) == null || e.focus());
|
|
97
|
+
}, [D]);
|
|
98
|
+
const de = Ze({
|
|
99
|
+
errors: u,
|
|
100
|
+
submitting: Fe,
|
|
101
|
+
native: i,
|
|
102
|
+
captcha: !1,
|
|
103
|
+
firstProblem: () => {
|
|
104
|
+
const e = se();
|
|
105
|
+
return re(e.email) ? "email" : e.password === "" ? "password" : void 0;
|
|
106
|
+
},
|
|
107
|
+
onRefused: (e) => {
|
|
108
|
+
Y(!0), c.open(() => ne({ target: e }));
|
|
109
|
+
},
|
|
110
|
+
// Only a React host gets here: a native post is the browser's own.
|
|
111
|
+
deliver: () => N == null ? void 0 : N(se()),
|
|
112
|
+
onAnswer: (e) => {
|
|
113
|
+
const r = e;
|
|
114
|
+
V(r), ts(r) && (ee(), Y(!1), c.open(() => {
|
|
115
|
+
const v = pe(r);
|
|
116
|
+
v && ne({ target: v });
|
|
117
|
+
}));
|
|
118
|
+
},
|
|
119
|
+
// The page came back from the browser's cache as it was left: the
|
|
120
|
+
// password must not come back with it.
|
|
121
|
+
onRestore: ee
|
|
122
|
+
}), { busy: H } = de, Ne = We("LoginForm", i, ye), ie = G(d), O = G(be), $ = G(we), Se = Je(
|
|
123
|
+
"LoginForm",
|
|
124
|
+
i,
|
|
125
|
+
o,
|
|
126
|
+
Me
|
|
127
|
+
), h = Z.form, qe = Ve(
|
|
128
|
+
h,
|
|
129
|
+
c.listed.length > 0
|
|
130
|
+
);
|
|
131
|
+
return /* @__PURE__ */ f(
|
|
132
|
+
"div",
|
|
133
|
+
{
|
|
134
|
+
ref: Ie,
|
|
135
|
+
...Ce,
|
|
136
|
+
"data-component": "login-form",
|
|
137
|
+
className: rs({ className: Ee }),
|
|
138
|
+
children: [
|
|
139
|
+
/* @__PURE__ */ s("div", { className: fe(), children: /* @__PURE__ */ s(b, { variant: "elevated", className: "ds:h-full", children: /* @__PURE__ */ f(b.Body, { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-lg)]", children: [
|
|
140
|
+
/* @__PURE__ */ s(
|
|
141
|
+
Ke,
|
|
142
|
+
{
|
|
143
|
+
id: K,
|
|
144
|
+
title: a ?? n("loginForm.title"),
|
|
145
|
+
description: m,
|
|
146
|
+
level: w,
|
|
147
|
+
showLogo: L,
|
|
148
|
+
logoMotion: R
|
|
149
|
+
}
|
|
150
|
+
),
|
|
151
|
+
x ? /* @__PURE__ */ s(
|
|
152
|
+
"div",
|
|
153
|
+
{
|
|
154
|
+
"data-slot": "host-content",
|
|
155
|
+
className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]",
|
|
156
|
+
children: x
|
|
157
|
+
}
|
|
158
|
+
) : null,
|
|
159
|
+
/* @__PURE__ */ f(
|
|
160
|
+
"form",
|
|
161
|
+
{
|
|
162
|
+
noValidate: !0,
|
|
163
|
+
method: "post",
|
|
164
|
+
action: Ne,
|
|
165
|
+
"aria-labelledby": K,
|
|
166
|
+
"aria-busy": H || void 0,
|
|
167
|
+
onSubmit: de.handleSubmit,
|
|
168
|
+
className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]",
|
|
169
|
+
children: [
|
|
170
|
+
/* @__PURE__ */ s(
|
|
171
|
+
He,
|
|
172
|
+
{
|
|
173
|
+
ref: c.ref,
|
|
174
|
+
headingLevel: w + 1,
|
|
175
|
+
"aria-describedby": h ? S : void 0,
|
|
176
|
+
errors: c.listed.map((e) => ({
|
|
177
|
+
field: e,
|
|
178
|
+
message: I(e) ?? "",
|
|
179
|
+
targetId: q(e)
|
|
180
|
+
}))
|
|
181
|
+
}
|
|
182
|
+
),
|
|
183
|
+
h && /* @__PURE__ */ s(
|
|
184
|
+
Qe,
|
|
185
|
+
{
|
|
186
|
+
id: S,
|
|
187
|
+
announce: qe,
|
|
188
|
+
children: h
|
|
189
|
+
}
|
|
190
|
+
),
|
|
191
|
+
/* @__PURE__ */ s(
|
|
192
|
+
ue,
|
|
193
|
+
{
|
|
194
|
+
id: q("email"),
|
|
195
|
+
label: n("loginForm.email"),
|
|
196
|
+
required: !0,
|
|
197
|
+
error: I("email"),
|
|
198
|
+
announceError: !c.lists("email"),
|
|
199
|
+
"data-field": "email",
|
|
200
|
+
children: F ? (
|
|
201
|
+
// A plain text field: a type="email" field holding a
|
|
202
|
+
// username is "invalid" to a screen reader, whatever
|
|
203
|
+
// `noValidate` says.
|
|
204
|
+
/* @__PURE__ */ s(
|
|
205
|
+
De,
|
|
206
|
+
{
|
|
207
|
+
ref: C.ref,
|
|
208
|
+
name: i ? o.email : "email",
|
|
209
|
+
type: "text",
|
|
210
|
+
inputMode: "email",
|
|
211
|
+
autoComplete: "username",
|
|
212
|
+
autoCapitalize: "none",
|
|
213
|
+
autoCorrect: "off",
|
|
214
|
+
spellCheck: !1,
|
|
215
|
+
onChange: C.quiet((e) => {
|
|
216
|
+
g(e.target.value), T("email");
|
|
217
|
+
}),
|
|
218
|
+
onBlur: (e) => {
|
|
219
|
+
const r = e.target.value.trim();
|
|
220
|
+
g(r), r !== "" && P("email");
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
)
|
|
224
|
+
) : /* @__PURE__ */ s(
|
|
225
|
+
Pe,
|
|
226
|
+
{
|
|
227
|
+
ref: C.ref,
|
|
228
|
+
name: i ? o.email : "email",
|
|
229
|
+
autoComplete: "username",
|
|
230
|
+
disableBuiltInValidation: !0,
|
|
231
|
+
onChange: C.quiet((e) => {
|
|
232
|
+
g(e.target.value), T("email");
|
|
233
|
+
}),
|
|
234
|
+
onBlur: (e) => {
|
|
235
|
+
const r = e.target.value.trim();
|
|
236
|
+
g(r), r !== "" && P("email");
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
)
|
|
240
|
+
}
|
|
241
|
+
),
|
|
242
|
+
/* @__PURE__ */ s(
|
|
243
|
+
ue,
|
|
244
|
+
{
|
|
245
|
+
id: q("password"),
|
|
246
|
+
label: n("loginForm.password"),
|
|
247
|
+
required: !0,
|
|
248
|
+
error: I("password"),
|
|
249
|
+
announceError: !c.lists("password"),
|
|
250
|
+
"data-field": "password",
|
|
251
|
+
children: /* @__PURE__ */ s(
|
|
252
|
+
Oe,
|
|
253
|
+
{
|
|
254
|
+
ref: j,
|
|
255
|
+
name: i ? o.password : "password",
|
|
256
|
+
autoComplete: "current-password",
|
|
257
|
+
"aria-describedby": h ? S : void 0,
|
|
258
|
+
value: y,
|
|
259
|
+
onChange: (e) => {
|
|
260
|
+
M(e.target.value), T("password");
|
|
261
|
+
},
|
|
262
|
+
onBlur: (e) => {
|
|
263
|
+
M(e.target.value), e.target.value !== "" && P("password");
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
)
|
|
267
|
+
}
|
|
268
|
+
),
|
|
269
|
+
ie && /* @__PURE__ */ s(
|
|
270
|
+
_,
|
|
271
|
+
{
|
|
272
|
+
href: ie,
|
|
273
|
+
action: "forgot-password",
|
|
274
|
+
align: "end",
|
|
275
|
+
children: n("loginForm.forgot")
|
|
276
|
+
}
|
|
277
|
+
),
|
|
278
|
+
z && /* @__PURE__ */ s("div", { "data-field": "remember-me", children: /* @__PURE__ */ s(
|
|
279
|
+
je,
|
|
280
|
+
{
|
|
281
|
+
name: i && o.rememberMe || "rememberMe",
|
|
282
|
+
checked: Q,
|
|
283
|
+
onCheckedChange: (e) => Be(e === !0),
|
|
284
|
+
label: n("loginForm.rememberMe")
|
|
285
|
+
}
|
|
286
|
+
) }),
|
|
287
|
+
/* @__PURE__ */ s(Ue, { fields: Se }),
|
|
288
|
+
/* @__PURE__ */ s(
|
|
289
|
+
he,
|
|
290
|
+
{
|
|
291
|
+
type: "submit",
|
|
292
|
+
intent: "primary",
|
|
293
|
+
size: "lg",
|
|
294
|
+
loading: H,
|
|
295
|
+
className: "ds:w-full",
|
|
296
|
+
"data-action": "submit",
|
|
297
|
+
children: xe ?? n("loginForm.submit")
|
|
298
|
+
}
|
|
299
|
+
)
|
|
300
|
+
]
|
|
301
|
+
}
|
|
302
|
+
),
|
|
303
|
+
(O || $) && /* @__PURE__ */ f(
|
|
304
|
+
"div",
|
|
305
|
+
{
|
|
306
|
+
"data-slot": "register-links",
|
|
307
|
+
className: as(),
|
|
308
|
+
children: [
|
|
309
|
+
O && /* @__PURE__ */ s(_, { href: O, action: "register-doctor", children: n("signedOutHeader.registerDoctor") }),
|
|
310
|
+
$ && /* @__PURE__ */ s(_, { href: $, action: "register-patient", children: n("signedOutHeader.registerPatient") })
|
|
311
|
+
]
|
|
312
|
+
}
|
|
313
|
+
),
|
|
314
|
+
/* @__PURE__ */ s(Xe, { busy: H })
|
|
315
|
+
] }) }) }),
|
|
316
|
+
J ? /* @__PURE__ */ s("div", { className: fe(), children: J }) : null
|
|
317
|
+
]
|
|
318
|
+
}
|
|
319
|
+
);
|
|
320
|
+
}
|
|
321
|
+
);
|
|
322
|
+
ns.displayName = "LoginForm";
|
|
323
|
+
const ds = B("ds:h-full ds:w-full"), is = ge(
|
|
324
|
+
({ title: a, options: m, headingLevel: w = 2, className: L, ...R }, x) => {
|
|
325
|
+
const t = k(), F = `h${w}`, u = m.filter((d) => ve(d.href));
|
|
326
|
+
return /* @__PURE__ */ s(
|
|
327
|
+
"div",
|
|
328
|
+
{
|
|
329
|
+
ref: x,
|
|
330
|
+
...R,
|
|
331
|
+
"data-component": "login-dev-card",
|
|
332
|
+
className: ds({ className: L }),
|
|
333
|
+
children: /* @__PURE__ */ f(
|
|
334
|
+
b,
|
|
335
|
+
{
|
|
336
|
+
variant: "elevated",
|
|
337
|
+
"aria-labelledby": t,
|
|
338
|
+
className: "ds:relative ds:isolate ds:flex ds:h-full ds:flex-col ds:overflow-hidden",
|
|
339
|
+
children: [
|
|
340
|
+
/* @__PURE__ */ s("div", { className: "ds:absolute ds:inset-0 ds:z-0 ds:[display:var(--accessible-off,block)]", children: /* @__PURE__ */ s(
|
|
341
|
+
es,
|
|
342
|
+
{
|
|
343
|
+
glyphs: "hex",
|
|
344
|
+
decay: "fast",
|
|
345
|
+
mask: "center",
|
|
346
|
+
maskRadius: "xl",
|
|
347
|
+
className: "ds:size-full"
|
|
348
|
+
}
|
|
349
|
+
) }),
|
|
350
|
+
/* @__PURE__ */ s(b.Header, { className: "ds:relative ds:z-[1]", children: /* @__PURE__ */ f("div", { className: "ds:flex ds:flex-col ds:items-center ds:gap-[var(--spacing-sm)] ds:text-center", children: [
|
|
351
|
+
/* @__PURE__ */ s("div", { className: "ds:[&>div]:w-24", children: /* @__PURE__ */ s(ss, { mood: "melt" }) }),
|
|
352
|
+
/* @__PURE__ */ s(
|
|
353
|
+
F,
|
|
354
|
+
{
|
|
355
|
+
id: t,
|
|
356
|
+
className: "type-title-card ds:text-[var(--foreground)]",
|
|
357
|
+
children: a
|
|
358
|
+
}
|
|
359
|
+
)
|
|
360
|
+
] }) }),
|
|
361
|
+
/* @__PURE__ */ s(b.Body, { className: "ds:relative ds:z-[1] ds:flex ds:flex-1 ds:flex-col ds:justify-center", children: /* @__PURE__ */ s("div", { className: "ds:mt-[var(--spacing-md)] ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]", children: u.map((d, A) => /* @__PURE__ */ s(
|
|
362
|
+
he,
|
|
363
|
+
{
|
|
364
|
+
asChild: !0,
|
|
365
|
+
intent: "primary",
|
|
366
|
+
startIcon: d.icon,
|
|
367
|
+
className: "ds:min-h-[var(--min-target-size)] ds:w-full",
|
|
368
|
+
children: /* @__PURE__ */ s("a", { href: d.href, "data-action": "dev-login", children: d.label })
|
|
369
|
+
},
|
|
370
|
+
`${A}:${d.href}`
|
|
371
|
+
)) }) })
|
|
372
|
+
]
|
|
373
|
+
}
|
|
374
|
+
)
|
|
375
|
+
}
|
|
376
|
+
);
|
|
377
|
+
}
|
|
378
|
+
);
|
|
379
|
+
is.displayName = "LoginDevCard";
|
|
380
|
+
export {
|
|
381
|
+
W as L,
|
|
382
|
+
is as a,
|
|
383
|
+
ns as b
|
|
384
|
+
};
|
|
385
|
+
//# sourceMappingURL=login-dev-card-DYwbL5sD.js.map
|
package/dist/agent-catalog.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 1,
|
|
3
|
-
"packageVersion": "1.
|
|
3
|
+
"packageVersion": "1.83.0",
|
|
4
4
|
"components": [
|
|
5
5
|
{
|
|
6
6
|
"kind": "component",
|
|
@@ -20249,7 +20249,7 @@
|
|
|
20249
20249
|
{
|
|
20250
20250
|
"name": "sign_in",
|
|
20251
20251
|
"safety": "write",
|
|
20252
|
-
"description": "Sign in (`data-action=\"submit\"`). The person types the email and the password themselves; the form does not submit until the email is
|
|
20252
|
+
"description": "Sign in (`data-action=\"submit\"`). The person types the email and the password themselves; the form does not submit until the email field is filled in and the password is not empty; text with an `@` must be a valid email address, and text without one is accepted as a username only when the host sets `allowUsername`; it lists what is wrong in its error summary and moves focus there. The host then signs the person in: through its `onSubmit` handler, or as a native form post to its own field names.",
|
|
20253
20253
|
"descriptionKey": "ui.agent.loginForm.workflows.signIn",
|
|
20254
20254
|
"uiActions": [],
|
|
20255
20255
|
"apiActions": [
|
package/dist/agent-i18n/en.json
CHANGED
|
@@ -1897,7 +1897,7 @@
|
|
|
1897
1897
|
"loginForm": {
|
|
1898
1898
|
"workflows": {
|
|
1899
1899
|
"readForm": "Read the sign-in form and what is wrong with it. Each field sits in a wrapper with `data-field` (`email`, `password`, and `remember-me` when the host turns it on). A field with a problem has `aria-invalid=\"true\"` on its control and its message in a `data-slot=\"error\"` element inside the wrapper. After a refused submit the fields with a problem are also listed in `data-component=\"error-summary\"` at the top of the form, one item per field (`data-error-field`). A message about the whole form, such as a refused sign-in, is in `data-field=\"form\"`; it never says which of the two values was wrong. Never read or repeat the password.",
|
|
1900
|
-
"signIn": "Sign in (`data-action=\"submit\"`). The person types the email and the password themselves; the form does not submit until the email is
|
|
1900
|
+
"signIn": "Sign in (`data-action=\"submit\"`). The person types the email and the password themselves; the form does not submit until the email field is filled in and the password is not empty; text with an `@` must be a valid email address, and text without one is accepted as a username only when the host sets `allowUsername`; it lists what is wrong in its error summary and moves focus there. The host then signs the person in: through its `onSubmit` handler, or as a native form post to its own field names.",
|
|
1901
1901
|
"rememberMe": "Tick or untick \"Remember me on this computer\" (`data-field=\"remember-me\"`, a checkbox, unticked by default). Present only when the host turns it on. It reports the choice to the host, which decides what it means; it changes nothing until the form is submitted.",
|
|
1902
1902
|
"forgotPassword": "Go to the page that asks for a password reset link (`data-action=\"forgot-password\"`). Present only when the host gives its address.",
|
|
1903
1903
|
"register": "Go to a registration page: `data-action=\"register-doctor\"` or `data-action=\"register-patient\"`, under the sign-in button. Each is present only when the host gives its address.",
|
package/dist/index.js
CHANGED
|
@@ -267,7 +267,7 @@ import { E as eu, a as su, b as ru, e as ou, r as tu } from "./_chunks/error-pag
|
|
|
267
267
|
import { E as iu } from "./_chunks/error-page-illustration-BdJLuMdV.js";
|
|
268
268
|
import { F as mu, a as lu } from "./_chunks/forgot-password-form-BQPvDS7i.js";
|
|
269
269
|
import { A as Au, a as fu, H as cu, b as Su, u as gu } from "./_chunks/help-me-write-templates-BJSf24xS.js";
|
|
270
|
-
import { L as Tu, a as xu, b as uu } from "./_chunks/login-dev-card-
|
|
270
|
+
import { L as Tu, a as xu, b as uu } from "./_chunks/login-dev-card-DYwbL5sD.js";
|
|
271
271
|
import { C as Eu, M as Iu, P as Ru } from "./_chunks/marketplace-app-shell-vON3WhD0.js";
|
|
272
272
|
import { P as bu } from "./_chunks/payment-automation-upsell-D1YdO1xY.js";
|
|
273
273
|
import { R as Du, a as Ou } from "./_chunks/registration-form-DmP3YUfp.js";
|
|
@@ -53,6 +53,13 @@ export interface LoginFormProps extends Omit<HTMLAttributes<HTMLDivElement>, 'ti
|
|
|
53
53
|
* it is posted. Keep any heading inside it below the card's own level.
|
|
54
54
|
*/
|
|
55
55
|
children?: ReactNode;
|
|
56
|
+
/**
|
|
57
|
+
* For hosts whose server also signs people in by a username. The first
|
|
58
|
+
* field is still labelled "Email", but text without an "@" is accepted as
|
|
59
|
+
* a username: it only has to be filled in. Text with an "@" must be a
|
|
60
|
+
* valid email address, as when this is off. Default false.
|
|
61
|
+
*/
|
|
62
|
+
allowUsername?: boolean;
|
|
56
63
|
/** The email to show when the form opens, such as the one last used,
|
|
57
64
|
* and whether "Remember me" starts ticked (default false). Read once.
|
|
58
65
|
* There is never an initial password. */
|
package/package.json
CHANGED
|
@@ -1,353 +0,0 @@
|
|
|
1
|
-
import { jsxs as f, jsx as s } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef as ge, useId as M, useState as l, useEffect as le, useRef as ie } from "react";
|
|
3
|
-
import { useTranslation as Se } from "react-i18next";
|
|
4
|
-
import { c as E } from "./index-D2ZczOXr.js";
|
|
5
|
-
import { i as me, E as qe } from "./email-input-C7THAwh2.js";
|
|
6
|
-
import { B as pe } from "./button-DohK_Ak_.js";
|
|
7
|
-
import { C as Pe } from "./checkbox-BjDv-r3o.js";
|
|
8
|
-
import { C as v } from "./card-BA4Ig_kn.js";
|
|
9
|
-
import { E as je } from "./error-summary-mGxIyDAY.js";
|
|
10
|
-
import { F as ce } from "./form-field-CyHfOVKF.js";
|
|
11
|
-
import { P as ze } from "./password-input-BokZ_rnT.js";
|
|
12
|
-
import { i as De } from "./is-development-CLUAnsU7.js";
|
|
13
|
-
import { i as he } from "./safe-href-5dbsfbQn.js";
|
|
14
|
-
import { u as He } from "./use-state-backed-input-DhRQo6gM.js";
|
|
15
|
-
import { u as Oe, a as Te, A as $e, b as _e, d as O, E as Ge, c as Ue } from "./auth-form-parts-B3GWChvG.js";
|
|
16
|
-
import { u as We, b as Je, a as Ke } from "./use-registration-submit-CLGHxwoT.js";
|
|
17
|
-
import { M as Qe } from "./matrix-rain-sDOUUwZp.js";
|
|
18
|
-
import { a as Xe } from "./error-page-illustration-BdJLuMdV.js";
|
|
19
|
-
const $ = ["email", "password"], Ye = E(
|
|
20
|
-
"ds:flex ds:w-full ds:flex-col ds:items-center ds:justify-center ds:gap-[var(--spacing-lg)] ds:text-start ds:text-[var(--foreground)] ds:lg:flex-row ds:lg:items-stretch"
|
|
21
|
-
), ue = E("ds:w-full ds:max-w-[400px]"), Ze = E(
|
|
22
|
-
"ds:flex ds:flex-wrap ds:justify-center ds:gap-x-[var(--spacing-lg)] ds:gap-y-[var(--spacing-lg)]"
|
|
23
|
-
), T = (r) => r && he(r) ? r : void 0, Ve = (r) => Object.values(r).some(Boolean), es = (r) => $.some((i) => !!r[i]), fe = (r) => $.find((i) => r[i]) ?? (r.form ? "password" : void 0), ss = ge(
|
|
24
|
-
({
|
|
25
|
-
title: r,
|
|
26
|
-
description: i,
|
|
27
|
-
headingLevel: b = 1,
|
|
28
|
-
showLogo: I = !0,
|
|
29
|
-
logoMotion: k = "assemble",
|
|
30
|
-
children: w,
|
|
31
|
-
initialValues: o,
|
|
32
|
-
errors: u,
|
|
33
|
-
forgotPasswordHref: L,
|
|
34
|
-
showRememberMe: d = !1,
|
|
35
|
-
registerDoctorHref: C,
|
|
36
|
-
registerPatientHref: ve,
|
|
37
|
-
submitLabel: be,
|
|
38
|
-
submitting: we = !1,
|
|
39
|
-
onSubmit: B,
|
|
40
|
-
fieldNames: t,
|
|
41
|
-
action: xe,
|
|
42
|
-
hiddenFields: Fe,
|
|
43
|
-
devCard: _,
|
|
44
|
-
className: ye,
|
|
45
|
-
...Me
|
|
46
|
-
}, Ee) => {
|
|
47
|
-
const { t: n } = Se("ui"), G = M(), R = M(), Ie = M(), A = (e) => `${Ie}-${e}`, m = t !== void 0, [g, N] = l(() => (o == null ? void 0 : o.email) ?? ""), [x, F] = l(""), [U, ke] = l(
|
|
48
|
-
() => (o == null ? void 0 : o.rememberMe) === !0
|
|
49
|
-
), S = d || !!(t != null && t.rememberMe), W = m && S && !(t != null && t.rememberMe);
|
|
50
|
-
le(() => {
|
|
51
|
-
W && De() && console.warn(
|
|
52
|
-
"LoginForm: the remember-me box is shown but `fieldNames.rememberMe` is not set, so the server will not read it."
|
|
53
|
-
);
|
|
54
|
-
}, [W]);
|
|
55
|
-
const [Le, J] = l(() => ({ email: !!(o != null && o.email) })), [Ce, K] = l(!1), [Q, X] = l(
|
|
56
|
-
() => u ?? {}
|
|
57
|
-
), Y = (e) => J(
|
|
58
|
-
(a) => a[e] ? a : { ...a, [e]: !0 }
|
|
59
|
-
), Z = (e) => X(
|
|
60
|
-
(a) => a[e] ? { ...a, [e]: void 0 } : a
|
|
61
|
-
), q = ie(null), P = ie(null), V = He(g, q), ee = () => {
|
|
62
|
-
F(""), J((e) => ({ ...e, password: !1 }));
|
|
63
|
-
}, se = () => {
|
|
64
|
-
var a, h;
|
|
65
|
-
const e = {
|
|
66
|
-
email: ((a = q.current) == null ? void 0 : a.value) ?? g,
|
|
67
|
-
password: ((h = P.current) == null ? void 0 : h.value) ?? x,
|
|
68
|
-
rememberMe: S && U
|
|
69
|
-
};
|
|
70
|
-
return e.email !== g && N(e.email), e.password !== x && F(e.password), e;
|
|
71
|
-
}, re = {
|
|
72
|
-
email: !me(g),
|
|
73
|
-
password: x === ""
|
|
74
|
-
}, ae = (e) => Ce || Le[e] === !0, Be = {
|
|
75
|
-
email: ae("email") && re.email ? n(g === "" ? "loginForm.emailRequired" : "inputs.email.invalid") : void 0,
|
|
76
|
-
password: ae("password") && re.password ? n("loginForm.passwordRequired") : void 0
|
|
77
|
-
}, y = (e) => Q[e] ?? Be[e], [oe] = l(
|
|
78
|
-
() => es(u ?? {})
|
|
79
|
-
), c = We(
|
|
80
|
-
$,
|
|
81
|
-
y,
|
|
82
|
-
oe
|
|
83
|
-
), [j, te] = l(() => {
|
|
84
|
-
const e = oe ? void 0 : fe(u ?? {});
|
|
85
|
-
return e ? { target: e } : null;
|
|
86
|
-
});
|
|
87
|
-
le(() => {
|
|
88
|
-
var e;
|
|
89
|
-
j && ((e = (j.target === "email" ? q : P).current) == null || e.focus());
|
|
90
|
-
}, [j]);
|
|
91
|
-
const ne = Je({
|
|
92
|
-
errors: u,
|
|
93
|
-
submitting: we,
|
|
94
|
-
native: m,
|
|
95
|
-
captcha: !1,
|
|
96
|
-
firstProblem: () => {
|
|
97
|
-
const e = se();
|
|
98
|
-
return me(e.email) ? e.password === "" ? "password" : void 0 : "email";
|
|
99
|
-
},
|
|
100
|
-
onRefused: (e) => {
|
|
101
|
-
K(!0), c.open(() => te({ target: e }));
|
|
102
|
-
},
|
|
103
|
-
// Only a React host gets here: a native post is the browser's own.
|
|
104
|
-
deliver: () => B == null ? void 0 : B(se()),
|
|
105
|
-
onAnswer: (e) => {
|
|
106
|
-
const a = e;
|
|
107
|
-
X(a), Ve(a) && (ee(), K(!1), c.open(() => {
|
|
108
|
-
const h = fe(a);
|
|
109
|
-
h && te({ target: h });
|
|
110
|
-
}));
|
|
111
|
-
},
|
|
112
|
-
// The page came back from the browser's cache as it was left: the
|
|
113
|
-
// password must not come back with it.
|
|
114
|
-
onRestore: ee
|
|
115
|
-
}), { busy: z } = ne, Re = Oe("LoginForm", m, xe), de = T(L), D = T(C), H = T(ve), Ae = Te(
|
|
116
|
-
"LoginForm",
|
|
117
|
-
m,
|
|
118
|
-
t,
|
|
119
|
-
Fe
|
|
120
|
-
), p = Q.form, Ne = Ke(
|
|
121
|
-
p,
|
|
122
|
-
c.listed.length > 0
|
|
123
|
-
);
|
|
124
|
-
return /* @__PURE__ */ f(
|
|
125
|
-
"div",
|
|
126
|
-
{
|
|
127
|
-
ref: Ee,
|
|
128
|
-
...Me,
|
|
129
|
-
"data-component": "login-form",
|
|
130
|
-
className: Ye({ className: ye }),
|
|
131
|
-
children: [
|
|
132
|
-
/* @__PURE__ */ s("div", { className: ue(), children: /* @__PURE__ */ s(v, { variant: "elevated", className: "ds:h-full", children: /* @__PURE__ */ f(v.Body, { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-lg)]", children: [
|
|
133
|
-
/* @__PURE__ */ s(
|
|
134
|
-
$e,
|
|
135
|
-
{
|
|
136
|
-
id: G,
|
|
137
|
-
title: r ?? n("loginForm.title"),
|
|
138
|
-
description: i,
|
|
139
|
-
level: b,
|
|
140
|
-
showLogo: I,
|
|
141
|
-
logoMotion: k
|
|
142
|
-
}
|
|
143
|
-
),
|
|
144
|
-
w ? /* @__PURE__ */ s(
|
|
145
|
-
"div",
|
|
146
|
-
{
|
|
147
|
-
"data-slot": "host-content",
|
|
148
|
-
className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]",
|
|
149
|
-
children: w
|
|
150
|
-
}
|
|
151
|
-
) : null,
|
|
152
|
-
/* @__PURE__ */ f(
|
|
153
|
-
"form",
|
|
154
|
-
{
|
|
155
|
-
noValidate: !0,
|
|
156
|
-
method: "post",
|
|
157
|
-
action: Re,
|
|
158
|
-
"aria-labelledby": G,
|
|
159
|
-
"aria-busy": z || void 0,
|
|
160
|
-
onSubmit: ne.handleSubmit,
|
|
161
|
-
className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]",
|
|
162
|
-
children: [
|
|
163
|
-
/* @__PURE__ */ s(
|
|
164
|
-
je,
|
|
165
|
-
{
|
|
166
|
-
ref: c.ref,
|
|
167
|
-
headingLevel: b + 1,
|
|
168
|
-
"aria-describedby": p ? R : void 0,
|
|
169
|
-
errors: c.listed.map((e) => ({
|
|
170
|
-
field: e,
|
|
171
|
-
message: y(e) ?? "",
|
|
172
|
-
targetId: A(e)
|
|
173
|
-
}))
|
|
174
|
-
}
|
|
175
|
-
),
|
|
176
|
-
p && /* @__PURE__ */ s(
|
|
177
|
-
_e,
|
|
178
|
-
{
|
|
179
|
-
id: R,
|
|
180
|
-
announce: Ne,
|
|
181
|
-
children: p
|
|
182
|
-
}
|
|
183
|
-
),
|
|
184
|
-
/* @__PURE__ */ s(
|
|
185
|
-
ce,
|
|
186
|
-
{
|
|
187
|
-
id: A("email"),
|
|
188
|
-
label: n("loginForm.email"),
|
|
189
|
-
required: !0,
|
|
190
|
-
error: y("email"),
|
|
191
|
-
announceError: !c.lists("email"),
|
|
192
|
-
"data-field": "email",
|
|
193
|
-
children: /* @__PURE__ */ s(
|
|
194
|
-
qe,
|
|
195
|
-
{
|
|
196
|
-
ref: V.ref,
|
|
197
|
-
name: m ? t.email : "email",
|
|
198
|
-
autoComplete: "username",
|
|
199
|
-
disableBuiltInValidation: !0,
|
|
200
|
-
onChange: V.quiet((e) => {
|
|
201
|
-
N(e.target.value), Z("email");
|
|
202
|
-
}),
|
|
203
|
-
onBlur: (e) => {
|
|
204
|
-
N(e.target.value), e.target.value !== "" && Y("email");
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
)
|
|
208
|
-
}
|
|
209
|
-
),
|
|
210
|
-
/* @__PURE__ */ s(
|
|
211
|
-
ce,
|
|
212
|
-
{
|
|
213
|
-
id: A("password"),
|
|
214
|
-
label: n("loginForm.password"),
|
|
215
|
-
required: !0,
|
|
216
|
-
error: y("password"),
|
|
217
|
-
announceError: !c.lists("password"),
|
|
218
|
-
"data-field": "password",
|
|
219
|
-
children: /* @__PURE__ */ s(
|
|
220
|
-
ze,
|
|
221
|
-
{
|
|
222
|
-
ref: P,
|
|
223
|
-
name: m ? t.password : "password",
|
|
224
|
-
autoComplete: "current-password",
|
|
225
|
-
"aria-describedby": p ? R : void 0,
|
|
226
|
-
value: x,
|
|
227
|
-
onChange: (e) => {
|
|
228
|
-
F(e.target.value), Z("password");
|
|
229
|
-
},
|
|
230
|
-
onBlur: (e) => {
|
|
231
|
-
F(e.target.value), e.target.value !== "" && Y("password");
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
)
|
|
235
|
-
}
|
|
236
|
-
),
|
|
237
|
-
de && /* @__PURE__ */ s(
|
|
238
|
-
O,
|
|
239
|
-
{
|
|
240
|
-
href: de,
|
|
241
|
-
action: "forgot-password",
|
|
242
|
-
align: "end",
|
|
243
|
-
children: n("loginForm.forgot")
|
|
244
|
-
}
|
|
245
|
-
),
|
|
246
|
-
S && /* @__PURE__ */ s("div", { "data-field": "remember-me", children: /* @__PURE__ */ s(
|
|
247
|
-
Pe,
|
|
248
|
-
{
|
|
249
|
-
name: m && t.rememberMe || "rememberMe",
|
|
250
|
-
checked: U,
|
|
251
|
-
onCheckedChange: (e) => ke(e === !0),
|
|
252
|
-
label: n("loginForm.rememberMe")
|
|
253
|
-
}
|
|
254
|
-
) }),
|
|
255
|
-
/* @__PURE__ */ s(Ge, { fields: Ae }),
|
|
256
|
-
/* @__PURE__ */ s(
|
|
257
|
-
pe,
|
|
258
|
-
{
|
|
259
|
-
type: "submit",
|
|
260
|
-
intent: "primary",
|
|
261
|
-
size: "lg",
|
|
262
|
-
loading: z,
|
|
263
|
-
className: "ds:w-full",
|
|
264
|
-
"data-action": "submit",
|
|
265
|
-
children: be ?? n("loginForm.submit")
|
|
266
|
-
}
|
|
267
|
-
)
|
|
268
|
-
]
|
|
269
|
-
}
|
|
270
|
-
),
|
|
271
|
-
(D || H) && /* @__PURE__ */ f(
|
|
272
|
-
"div",
|
|
273
|
-
{
|
|
274
|
-
"data-slot": "register-links",
|
|
275
|
-
className: Ze(),
|
|
276
|
-
children: [
|
|
277
|
-
D && /* @__PURE__ */ s(O, { href: D, action: "register-doctor", children: n("signedOutHeader.registerDoctor") }),
|
|
278
|
-
H && /* @__PURE__ */ s(O, { href: H, action: "register-patient", children: n("signedOutHeader.registerPatient") })
|
|
279
|
-
]
|
|
280
|
-
}
|
|
281
|
-
),
|
|
282
|
-
/* @__PURE__ */ s(Ue, { busy: z })
|
|
283
|
-
] }) }) }),
|
|
284
|
-
_ ? /* @__PURE__ */ s("div", { className: ue(), children: _ }) : null
|
|
285
|
-
]
|
|
286
|
-
}
|
|
287
|
-
);
|
|
288
|
-
}
|
|
289
|
-
);
|
|
290
|
-
ss.displayName = "LoginForm";
|
|
291
|
-
const rs = E("ds:h-full ds:w-full"), as = ge(
|
|
292
|
-
({ title: r, options: i, headingLevel: b = 2, className: I, ...k }, w) => {
|
|
293
|
-
const o = M(), u = `h${b}`, L = i.filter((d) => he(d.href));
|
|
294
|
-
return /* @__PURE__ */ s(
|
|
295
|
-
"div",
|
|
296
|
-
{
|
|
297
|
-
ref: w,
|
|
298
|
-
...k,
|
|
299
|
-
"data-component": "login-dev-card",
|
|
300
|
-
className: rs({ className: I }),
|
|
301
|
-
children: /* @__PURE__ */ f(
|
|
302
|
-
v,
|
|
303
|
-
{
|
|
304
|
-
variant: "elevated",
|
|
305
|
-
"aria-labelledby": o,
|
|
306
|
-
className: "ds:relative ds:isolate ds:flex ds:h-full ds:flex-col ds:overflow-hidden",
|
|
307
|
-
children: [
|
|
308
|
-
/* @__PURE__ */ s("div", { className: "ds:absolute ds:inset-0 ds:z-0 ds:[display:var(--accessible-off,block)]", children: /* @__PURE__ */ s(
|
|
309
|
-
Qe,
|
|
310
|
-
{
|
|
311
|
-
glyphs: "hex",
|
|
312
|
-
decay: "fast",
|
|
313
|
-
mask: "center",
|
|
314
|
-
maskRadius: "xl",
|
|
315
|
-
className: "ds:size-full"
|
|
316
|
-
}
|
|
317
|
-
) }),
|
|
318
|
-
/* @__PURE__ */ s(v.Header, { className: "ds:relative ds:z-[1]", children: /* @__PURE__ */ f("div", { className: "ds:flex ds:flex-col ds:items-center ds:gap-[var(--spacing-sm)] ds:text-center", children: [
|
|
319
|
-
/* @__PURE__ */ s("div", { className: "ds:[&>div]:w-24", children: /* @__PURE__ */ s(Xe, { mood: "melt" }) }),
|
|
320
|
-
/* @__PURE__ */ s(
|
|
321
|
-
u,
|
|
322
|
-
{
|
|
323
|
-
id: o,
|
|
324
|
-
className: "type-title-card ds:text-[var(--foreground)]",
|
|
325
|
-
children: r
|
|
326
|
-
}
|
|
327
|
-
)
|
|
328
|
-
] }) }),
|
|
329
|
-
/* @__PURE__ */ s(v.Body, { className: "ds:relative ds:z-[1] ds:flex ds:flex-1 ds:flex-col ds:justify-center", children: /* @__PURE__ */ s("div", { className: "ds:mt-[var(--spacing-md)] ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]", children: L.map((d, C) => /* @__PURE__ */ s(
|
|
330
|
-
pe,
|
|
331
|
-
{
|
|
332
|
-
asChild: !0,
|
|
333
|
-
intent: "primary",
|
|
334
|
-
startIcon: d.icon,
|
|
335
|
-
className: "ds:min-h-[var(--min-target-size)] ds:w-full",
|
|
336
|
-
children: /* @__PURE__ */ s("a", { href: d.href, "data-action": "dev-login", children: d.label })
|
|
337
|
-
},
|
|
338
|
-
`${C}:${d.href}`
|
|
339
|
-
)) }) })
|
|
340
|
-
]
|
|
341
|
-
}
|
|
342
|
-
)
|
|
343
|
-
}
|
|
344
|
-
);
|
|
345
|
-
}
|
|
346
|
-
);
|
|
347
|
-
as.displayName = "LoginDevCard";
|
|
348
|
-
export {
|
|
349
|
-
$ as L,
|
|
350
|
-
as as a,
|
|
351
|
-
ss as b
|
|
352
|
-
};
|
|
353
|
-
//# sourceMappingURL=login-dev-card-CvLHj-_N.js.map
|