@salesmind-ai/design-system 1.8.0 → 1.9.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/ChangeEmail-BuUhjW0o.d.cts +226 -0
- package/dist/ChangeEmail-BuUhjW0o.d.ts +226 -0
- package/dist/chunk-AI2YEYT4.js +1368 -0
- package/dist/chunk-AI2YEYT4.js.map +1 -0
- package/dist/{chunk-4QQKREVH.cjs → chunk-LM3UJILC.cjs} +3 -3
- package/dist/{chunk-4QQKREVH.cjs.map → chunk-LM3UJILC.cjs.map} +1 -1
- package/dist/{chunk-K7NQ7TQG.cjs → chunk-M4MLGT4B.cjs} +84 -27
- package/dist/chunk-M4MLGT4B.cjs.map +1 -0
- package/dist/{chunk-25TUCNN6.js → chunk-QVGDMAZY.js} +84 -27
- package/dist/chunk-QVGDMAZY.js.map +1 -0
- package/dist/{chunk-2TC5EVSJ.js → chunk-TPZ3PKSF.js} +3 -3
- package/dist/{chunk-2TC5EVSJ.js.map → chunk-TPZ3PKSF.js.map} +1 -1
- package/dist/chunk-YWJKSY5C.cjs +1381 -0
- package/dist/chunk-YWJKSY5C.cjs.map +1 -0
- package/dist/index.cjs +47 -30
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +2372 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/marketing/index.cjs +27 -27
- package/dist/marketing/index.js +1 -1
- package/dist/onboarding/index.cjs +5870 -0
- package/dist/onboarding/index.cjs.map +1 -0
- package/dist/onboarding/index.css +557 -0
- package/dist/onboarding/index.css.map +1 -0
- package/dist/onboarding/index.d.cts +1589 -0
- package/dist/onboarding/index.d.ts +1589 -0
- package/dist/onboarding/index.js +5736 -0
- package/dist/onboarding/index.js.map +1 -0
- package/dist/styles/styles.css +2539 -0
- package/dist/v2-auth/index.cjs +59 -0
- package/dist/v2-auth/index.cjs.map +1 -0
- package/dist/v2-auth/index.css +3360 -0
- package/dist/v2-auth/index.css.map +1 -0
- package/dist/v2-auth/index.d.cts +76 -0
- package/dist/v2-auth/index.d.ts +76 -0
- package/dist/v2-auth/index.js +24 -0
- package/dist/v2-auth/index.js.map +1 -0
- package/dist/web/index.cjs +7 -7
- package/dist/web/index.d.cts +1 -1
- package/dist/web/index.d.ts +1 -1
- package/dist/web/index.js +1 -1
- package/dist/web/server/index.cjs +7 -7
- package/dist/web/server/index.d.cts +91 -27
- package/dist/web/server/index.d.ts +91 -27
- package/dist/web/server/index.js +1 -1
- package/package.json +14 -2
- package/dist/chunk-25TUCNN6.js.map +0 -1
- package/dist/chunk-K7NQ7TQG.cjs.map +0 -1
|
@@ -0,0 +1,1368 @@
|
|
|
1
|
+
import React2, { useState, useMemo, useEffect } from 'react';
|
|
2
|
+
import { Slot } from '@radix-ui/react-slot';
|
|
3
|
+
import clsx5 from 'clsx';
|
|
4
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
5
|
+
import { Input } from '@base-ui/react/input';
|
|
6
|
+
import { Checkbox as Checkbox$1 } from '@base-ui/react/checkbox';
|
|
7
|
+
|
|
8
|
+
// src/v2-auth/Button/Button.tsx
|
|
9
|
+
var Button = React2.forwardRef(
|
|
10
|
+
({ className, variant = "primary", size = "md", asChild = false, isLoading = false, children, disabled, ...props }, ref) => {
|
|
11
|
+
const buttonClass = clsx5(
|
|
12
|
+
"ds-button",
|
|
13
|
+
`ds-button--${variant}`,
|
|
14
|
+
size === "icon" ? "ds-button--icon ds-button--md" : `ds-button--${size}`,
|
|
15
|
+
isLoading && "ds-button--loading",
|
|
16
|
+
className
|
|
17
|
+
);
|
|
18
|
+
if (asChild) {
|
|
19
|
+
return /* @__PURE__ */ jsx(
|
|
20
|
+
Slot,
|
|
21
|
+
{
|
|
22
|
+
ref,
|
|
23
|
+
"aria-disabled": isLoading || disabled || void 0,
|
|
24
|
+
className: buttonClass,
|
|
25
|
+
...props,
|
|
26
|
+
children
|
|
27
|
+
}
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
return /* @__PURE__ */ jsxs(
|
|
31
|
+
"button",
|
|
32
|
+
{
|
|
33
|
+
ref,
|
|
34
|
+
disabled: isLoading || disabled,
|
|
35
|
+
className: buttonClass,
|
|
36
|
+
...props,
|
|
37
|
+
children: [
|
|
38
|
+
isLoading && /* @__PURE__ */ jsx(
|
|
39
|
+
"svg",
|
|
40
|
+
{
|
|
41
|
+
className: "ds-button__spinner",
|
|
42
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
43
|
+
width: "1em",
|
|
44
|
+
height: "1em",
|
|
45
|
+
viewBox: "0 0 24 24",
|
|
46
|
+
fill: "none",
|
|
47
|
+
stroke: "currentColor",
|
|
48
|
+
strokeWidth: "2",
|
|
49
|
+
strokeLinecap: "round",
|
|
50
|
+
strokeLinejoin: "round",
|
|
51
|
+
children: /* @__PURE__ */ jsx("path", { d: "M21 12a9 9 0 1 1-6.219-8.56" })
|
|
52
|
+
}
|
|
53
|
+
),
|
|
54
|
+
/* @__PURE__ */ jsx("span", { className: clsx5("ds-button__content", isLoading && "ds-button__content--hidden"), children })
|
|
55
|
+
]
|
|
56
|
+
}
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
);
|
|
60
|
+
Button.displayName = "Button";
|
|
61
|
+
var TextField = React2.forwardRef(
|
|
62
|
+
({ className, label, error, helperText, endAdornment, id, ...props }, ref) => {
|
|
63
|
+
const generatedId = React2.useId();
|
|
64
|
+
const inputId = id || generatedId;
|
|
65
|
+
return /* @__PURE__ */ jsxs("div", { className: clsx5("ds-textfield", className), children: [
|
|
66
|
+
label && /* @__PURE__ */ jsx("label", { htmlFor: inputId, className: "ds-textfield__label", children: label }),
|
|
67
|
+
/* @__PURE__ */ jsxs("div", { className: "ds-textfield__input-wrapper", children: [
|
|
68
|
+
/* @__PURE__ */ jsx(
|
|
69
|
+
Input,
|
|
70
|
+
{
|
|
71
|
+
id: inputId,
|
|
72
|
+
ref,
|
|
73
|
+
className: clsx5(
|
|
74
|
+
"ds-textfield__input",
|
|
75
|
+
error && "ds-textfield__input--error",
|
|
76
|
+
endAdornment && "ds-textfield__input--adorned"
|
|
77
|
+
),
|
|
78
|
+
...props
|
|
79
|
+
}
|
|
80
|
+
),
|
|
81
|
+
endAdornment && /* @__PURE__ */ jsx("div", { className: "ds-textfield__adornment", children: endAdornment })
|
|
82
|
+
] }),
|
|
83
|
+
helperText && /* @__PURE__ */ jsx("span", { className: clsx5("ds-textfield__helper", error && "ds-textfield__helper--error"), children: helperText })
|
|
84
|
+
] });
|
|
85
|
+
}
|
|
86
|
+
);
|
|
87
|
+
TextField.displayName = "TextField";
|
|
88
|
+
var Checkbox = React2.forwardRef(
|
|
89
|
+
({ className, label, id, ...props }, ref) => {
|
|
90
|
+
const generatedId = React2.useId();
|
|
91
|
+
const checkboxId = id || generatedId;
|
|
92
|
+
const labelId = `${checkboxId}-label`;
|
|
93
|
+
return /* @__PURE__ */ jsxs("div", { className: clsx5("ds-checkbox-wrapper", className), children: [
|
|
94
|
+
/* @__PURE__ */ jsx(
|
|
95
|
+
Checkbox$1.Root,
|
|
96
|
+
{
|
|
97
|
+
id: checkboxId,
|
|
98
|
+
ref,
|
|
99
|
+
className: "ds-checkbox",
|
|
100
|
+
"aria-labelledby": label ? labelId : void 0,
|
|
101
|
+
"aria-label": label ? void 0 : "Checkbox",
|
|
102
|
+
...props,
|
|
103
|
+
children: /* @__PURE__ */ jsx(Checkbox$1.Indicator, { className: "ds-checkbox__indicator", children: /* @__PURE__ */ jsx(
|
|
104
|
+
"svg",
|
|
105
|
+
{
|
|
106
|
+
viewBox: "0 0 14 14",
|
|
107
|
+
fill: "none",
|
|
108
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
109
|
+
className: "ds-checkbox__icon",
|
|
110
|
+
children: /* @__PURE__ */ jsx(
|
|
111
|
+
"path",
|
|
112
|
+
{
|
|
113
|
+
d: "M11.6666 3.5L5.24992 9.91667L2.33325 7",
|
|
114
|
+
stroke: "currentColor",
|
|
115
|
+
strokeWidth: "2",
|
|
116
|
+
strokeLinecap: "round",
|
|
117
|
+
strokeLinejoin: "round"
|
|
118
|
+
}
|
|
119
|
+
)
|
|
120
|
+
}
|
|
121
|
+
) })
|
|
122
|
+
}
|
|
123
|
+
),
|
|
124
|
+
label && /* @__PURE__ */ jsx("label", { id: labelId, htmlFor: checkboxId, className: "ds-checkbox__label", children: label })
|
|
125
|
+
] });
|
|
126
|
+
}
|
|
127
|
+
);
|
|
128
|
+
Checkbox.displayName = "Checkbox";
|
|
129
|
+
var defaultLoginLabels = {
|
|
130
|
+
continueWithGoogleLabel: "Continue with Google",
|
|
131
|
+
orContinueWithEmailLabel: "or continue with email",
|
|
132
|
+
emailPlaceholder: "you@company.com",
|
|
133
|
+
passwordPlaceholder: "Enter your password",
|
|
134
|
+
signInLabel: "Sign in",
|
|
135
|
+
doNotHaveAnAccountLabel: "Don't have an account?",
|
|
136
|
+
emailLabel: "Email",
|
|
137
|
+
passwordLabel: "Password",
|
|
138
|
+
rememberMeLabel: "Remember me",
|
|
139
|
+
forgotPasswordLabel: "Forgot password?",
|
|
140
|
+
signUpLabel: "Sign up",
|
|
141
|
+
trustedByLabel: "Trusted by 500+ sales teams worldwide"
|
|
142
|
+
};
|
|
143
|
+
var Login = ({
|
|
144
|
+
brandName,
|
|
145
|
+
tagline = "AI Sales Agents that automate your pipeline",
|
|
146
|
+
labels: customLabels,
|
|
147
|
+
showSocialLogin = true,
|
|
148
|
+
showRememberMe = true,
|
|
149
|
+
showForgotPassword = true,
|
|
150
|
+
showSignUp = true,
|
|
151
|
+
logo,
|
|
152
|
+
onSubmit,
|
|
153
|
+
onGoogleLogin,
|
|
154
|
+
onForgotPassword,
|
|
155
|
+
onSignUp,
|
|
156
|
+
isLoading = false,
|
|
157
|
+
error,
|
|
158
|
+
className,
|
|
159
|
+
style
|
|
160
|
+
}) => {
|
|
161
|
+
const l = { ...defaultLoginLabels, ...customLabels };
|
|
162
|
+
const [email, setEmail] = useState("");
|
|
163
|
+
const [password, setPassword] = useState("");
|
|
164
|
+
const [showPassword, setShowPassword] = useState(false);
|
|
165
|
+
const [rememberMe, setRememberMe] = useState(false);
|
|
166
|
+
const handleSubmit = (e) => {
|
|
167
|
+
e.preventDefault();
|
|
168
|
+
onSubmit?.({ email, password, rememberMe });
|
|
169
|
+
};
|
|
170
|
+
return /* @__PURE__ */ jsxs("div", { className: clsx5("ds-login", className), style, children: [
|
|
171
|
+
/* @__PURE__ */ jsxs("div", { className: "ds-login__background", children: [
|
|
172
|
+
/* @__PURE__ */ jsx("div", { className: "ds-login__accent ds-login__accent--1", "aria-hidden": "true" }),
|
|
173
|
+
/* @__PURE__ */ jsx("div", { className: "ds-login__accent ds-login__accent--2", "aria-hidden": "true" })
|
|
174
|
+
] }),
|
|
175
|
+
/* @__PURE__ */ jsxs("div", { className: "ds-login__card", children: [
|
|
176
|
+
/* @__PURE__ */ jsxs("div", { className: "ds-login__header", children: [
|
|
177
|
+
logo ? /* @__PURE__ */ jsx("div", { className: "ds-login__logo", children: logo }) : /* @__PURE__ */ jsx("div", { className: "ds-login__logo ds-login__logo--default", children: /* @__PURE__ */ jsx("div", { className: "ds-login__logo-icon", children: /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 32 32", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
178
|
+
/* @__PURE__ */ jsx("rect", { width: "32", height: "32", rx: "8", fill: "url(#logo-gradient)" }),
|
|
179
|
+
/* @__PURE__ */ jsx(
|
|
180
|
+
"path",
|
|
181
|
+
{
|
|
182
|
+
d: "M10 16L14 20L22 12",
|
|
183
|
+
stroke: "white",
|
|
184
|
+
strokeWidth: "2.5",
|
|
185
|
+
strokeLinecap: "round",
|
|
186
|
+
strokeLinejoin: "round"
|
|
187
|
+
}
|
|
188
|
+
),
|
|
189
|
+
/* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs("linearGradient", { id: "logo-gradient", x1: "0", y1: "0", x2: "32", y2: "32", children: [
|
|
190
|
+
/* @__PURE__ */ jsx("stop", { stopColor: "rgb(var(--accent-rgb))" }),
|
|
191
|
+
/* @__PURE__ */ jsx("stop", { offset: "1", stopColor: "rgb(var(--accent2-rgb))" })
|
|
192
|
+
] }) })
|
|
193
|
+
] }) }) }),
|
|
194
|
+
/* @__PURE__ */ jsx("h1", { className: "ds-login__title", children: brandName }),
|
|
195
|
+
/* @__PURE__ */ jsx("p", { className: "ds-login__tagline", children: tagline })
|
|
196
|
+
] }),
|
|
197
|
+
error && /* @__PURE__ */ jsxs("div", { className: "ds-login__error", children: [
|
|
198
|
+
/* @__PURE__ */ jsxs(
|
|
199
|
+
"svg",
|
|
200
|
+
{
|
|
201
|
+
width: "16",
|
|
202
|
+
height: "16",
|
|
203
|
+
viewBox: "0 0 16 16",
|
|
204
|
+
fill: "none",
|
|
205
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
206
|
+
children: [
|
|
207
|
+
/* @__PURE__ */ jsx("circle", { cx: "8", cy: "8", r: "7", stroke: "currentColor", strokeWidth: "1.5" }),
|
|
208
|
+
/* @__PURE__ */ jsx("path", { d: "M8 4.5V8.5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" }),
|
|
209
|
+
/* @__PURE__ */ jsx("circle", { cx: "8", cy: "11", r: "0.75", fill: "currentColor" })
|
|
210
|
+
]
|
|
211
|
+
}
|
|
212
|
+
),
|
|
213
|
+
/* @__PURE__ */ jsx("span", { children: error })
|
|
214
|
+
] }),
|
|
215
|
+
showSocialLogin && /* @__PURE__ */ jsxs("div", { className: "ds-login__social", children: [
|
|
216
|
+
/* @__PURE__ */ jsxs(
|
|
217
|
+
"button",
|
|
218
|
+
{
|
|
219
|
+
type: "button",
|
|
220
|
+
className: "ds-login__social-btn",
|
|
221
|
+
onClick: onGoogleLogin,
|
|
222
|
+
disabled: isLoading,
|
|
223
|
+
children: [
|
|
224
|
+
/* @__PURE__ */ jsxs("svg", { viewBox: "0 0 24 24", width: "20", height: "20", children: [
|
|
225
|
+
/* @__PURE__ */ jsx(
|
|
226
|
+
"path",
|
|
227
|
+
{
|
|
228
|
+
fill: "#4285F4",
|
|
229
|
+
d: "M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z"
|
|
230
|
+
}
|
|
231
|
+
),
|
|
232
|
+
/* @__PURE__ */ jsx(
|
|
233
|
+
"path",
|
|
234
|
+
{
|
|
235
|
+
fill: "#34A853",
|
|
236
|
+
d: "M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"
|
|
237
|
+
}
|
|
238
|
+
),
|
|
239
|
+
/* @__PURE__ */ jsx(
|
|
240
|
+
"path",
|
|
241
|
+
{
|
|
242
|
+
fill: "#FBBC05",
|
|
243
|
+
d: "M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z"
|
|
244
|
+
}
|
|
245
|
+
),
|
|
246
|
+
/* @__PURE__ */ jsx(
|
|
247
|
+
"path",
|
|
248
|
+
{
|
|
249
|
+
fill: "#EA4335",
|
|
250
|
+
d: "M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z"
|
|
251
|
+
}
|
|
252
|
+
)
|
|
253
|
+
] }),
|
|
254
|
+
/* @__PURE__ */ jsx("span", { children: l.continueWithGoogleLabel })
|
|
255
|
+
]
|
|
256
|
+
}
|
|
257
|
+
),
|
|
258
|
+
/* @__PURE__ */ jsx("div", { className: "ds-login__divider", children: /* @__PURE__ */ jsx("span", { children: l.orContinueWithEmailLabel }) })
|
|
259
|
+
] }),
|
|
260
|
+
/* @__PURE__ */ jsxs("form", { className: "ds-login__form", onSubmit: handleSubmit, children: [
|
|
261
|
+
/* @__PURE__ */ jsx("div", { className: "ds-login__field", children: /* @__PURE__ */ jsx(
|
|
262
|
+
TextField,
|
|
263
|
+
{
|
|
264
|
+
label: l.emailLabel,
|
|
265
|
+
type: "email",
|
|
266
|
+
placeholder: l.emailPlaceholder,
|
|
267
|
+
value: email,
|
|
268
|
+
onChange: (e) => setEmail(e.target.value),
|
|
269
|
+
disabled: isLoading,
|
|
270
|
+
autoComplete: "email"
|
|
271
|
+
}
|
|
272
|
+
) }),
|
|
273
|
+
/* @__PURE__ */ jsx("div", { className: "ds-login__field", children: /* @__PURE__ */ jsx(
|
|
274
|
+
TextField,
|
|
275
|
+
{
|
|
276
|
+
label: l.passwordLabel,
|
|
277
|
+
type: showPassword ? "text" : "password",
|
|
278
|
+
placeholder: l.passwordPlaceholder,
|
|
279
|
+
value: password,
|
|
280
|
+
onChange: (e) => setPassword(e.target.value),
|
|
281
|
+
disabled: isLoading,
|
|
282
|
+
autoComplete: "current-password",
|
|
283
|
+
endAdornment: /* @__PURE__ */ jsx(
|
|
284
|
+
"button",
|
|
285
|
+
{
|
|
286
|
+
type: "button",
|
|
287
|
+
className: "ds-login__password-toggle",
|
|
288
|
+
onClick: () => setShowPassword(!showPassword),
|
|
289
|
+
"aria-label": showPassword ? "Hide password" : "Show password",
|
|
290
|
+
children: showPassword ? /* @__PURE__ */ jsxs(
|
|
291
|
+
"svg",
|
|
292
|
+
{
|
|
293
|
+
width: "20",
|
|
294
|
+
height: "20",
|
|
295
|
+
viewBox: "0 0 24 24",
|
|
296
|
+
fill: "none",
|
|
297
|
+
stroke: "currentColor",
|
|
298
|
+
strokeWidth: "2",
|
|
299
|
+
strokeLinecap: "round",
|
|
300
|
+
strokeLinejoin: "round",
|
|
301
|
+
children: [
|
|
302
|
+
/* @__PURE__ */ jsx("path", { d: "M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24" }),
|
|
303
|
+
/* @__PURE__ */ jsx("line", { x1: "1", y1: "1", x2: "23", y2: "23" })
|
|
304
|
+
]
|
|
305
|
+
}
|
|
306
|
+
) : /* @__PURE__ */ jsxs(
|
|
307
|
+
"svg",
|
|
308
|
+
{
|
|
309
|
+
width: "20",
|
|
310
|
+
height: "20",
|
|
311
|
+
viewBox: "0 0 24 24",
|
|
312
|
+
fill: "none",
|
|
313
|
+
stroke: "currentColor",
|
|
314
|
+
strokeWidth: "2",
|
|
315
|
+
strokeLinecap: "round",
|
|
316
|
+
strokeLinejoin: "round",
|
|
317
|
+
children: [
|
|
318
|
+
/* @__PURE__ */ jsx("path", { d: "M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z" }),
|
|
319
|
+
/* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "3" })
|
|
320
|
+
]
|
|
321
|
+
}
|
|
322
|
+
)
|
|
323
|
+
}
|
|
324
|
+
)
|
|
325
|
+
}
|
|
326
|
+
) }),
|
|
327
|
+
/* @__PURE__ */ jsxs("div", { className: "ds-login__options", children: [
|
|
328
|
+
showRememberMe && /* @__PURE__ */ jsx(
|
|
329
|
+
Checkbox,
|
|
330
|
+
{
|
|
331
|
+
label: l.rememberMeLabel,
|
|
332
|
+
checked: rememberMe,
|
|
333
|
+
onCheckedChange: (checked) => setRememberMe(checked === true),
|
|
334
|
+
disabled: isLoading
|
|
335
|
+
}
|
|
336
|
+
),
|
|
337
|
+
showForgotPassword && /* @__PURE__ */ jsx(
|
|
338
|
+
"button",
|
|
339
|
+
{
|
|
340
|
+
type: "button",
|
|
341
|
+
className: "ds-login__link",
|
|
342
|
+
onClick: onForgotPassword,
|
|
343
|
+
disabled: isLoading,
|
|
344
|
+
children: l.forgotPasswordLabel
|
|
345
|
+
}
|
|
346
|
+
)
|
|
347
|
+
] }),
|
|
348
|
+
/* @__PURE__ */ jsx(
|
|
349
|
+
Button,
|
|
350
|
+
{
|
|
351
|
+
type: "submit",
|
|
352
|
+
variant: "primary",
|
|
353
|
+
size: "lg",
|
|
354
|
+
disabled: isLoading || !email || !password,
|
|
355
|
+
className: "ds-login__submit",
|
|
356
|
+
children: isLoading ? /* @__PURE__ */ jsx("span", { className: "ds-login__spinner" }) : l.signInLabel
|
|
357
|
+
}
|
|
358
|
+
)
|
|
359
|
+
] }),
|
|
360
|
+
showSignUp && /* @__PURE__ */ jsxs("div", { className: "ds-login__footer", children: [
|
|
361
|
+
/* @__PURE__ */ jsx("span", { children: l.doNotHaveAnAccountLabel }),
|
|
362
|
+
/* @__PURE__ */ jsx(
|
|
363
|
+
"button",
|
|
364
|
+
{
|
|
365
|
+
type: "button",
|
|
366
|
+
className: "ds-login__link ds-login__link--accent",
|
|
367
|
+
onClick: onSignUp,
|
|
368
|
+
disabled: isLoading,
|
|
369
|
+
children: l.signUpLabel
|
|
370
|
+
}
|
|
371
|
+
)
|
|
372
|
+
] })
|
|
373
|
+
] })
|
|
374
|
+
] });
|
|
375
|
+
};
|
|
376
|
+
Login.displayName = "Login";
|
|
377
|
+
var defaultSignupLabels = {
|
|
378
|
+
formTitle: "Create your account",
|
|
379
|
+
googleButtonLabel: "Sign up with Google",
|
|
380
|
+
dividerText: "or sign up with email",
|
|
381
|
+
nameLabel: "Full name",
|
|
382
|
+
namePlaceholder: "John Doe",
|
|
383
|
+
emailLabel: "Work email",
|
|
384
|
+
emailPlaceholder: "you@company.com",
|
|
385
|
+
passwordLabel: "Password",
|
|
386
|
+
passwordPlaceholder: "Create a strong password",
|
|
387
|
+
phoneLabel: "Phone",
|
|
388
|
+
phonePlaceholder: "Phone number",
|
|
389
|
+
hidePasswordLabel: "Hide password",
|
|
390
|
+
showPasswordLabel: "Show password",
|
|
391
|
+
passwordStrengthLabels: ["Very Weak", "Weak", "Fair", "Strong", "Very Strong"],
|
|
392
|
+
termsAgreementPrefix: "I agree to the ",
|
|
393
|
+
termsLabel: "Terms of Service ",
|
|
394
|
+
termsConjunction: "and ",
|
|
395
|
+
privacyLabel: "Privacy Policy",
|
|
396
|
+
submitLabel: "Create account",
|
|
397
|
+
loginPrompt: "Already have an account?",
|
|
398
|
+
loginLabel: "Sign in",
|
|
399
|
+
successTitle: "Welcome!",
|
|
400
|
+
continueToLoginLabel: "Go to Application"
|
|
401
|
+
};
|
|
402
|
+
function calculatePasswordStrength(password, strengthLabels) {
|
|
403
|
+
let score = 0;
|
|
404
|
+
if (password.length >= 8) score++;
|
|
405
|
+
if (password.length >= 12) score++;
|
|
406
|
+
if (/[a-z]/.test(password) && /[A-Z]/.test(password)) score++;
|
|
407
|
+
if (/\d/.test(password)) score++;
|
|
408
|
+
if (/[!@#$%^&*(),.?":{}|<>]/.test(password)) score++;
|
|
409
|
+
score = Math.min(4, score);
|
|
410
|
+
const labels = strengthLabels ?? defaultSignupLabels.passwordStrengthLabels;
|
|
411
|
+
const colors = [
|
|
412
|
+
"var(--status-error)",
|
|
413
|
+
"var(--status-warning)",
|
|
414
|
+
"#ffd000",
|
|
415
|
+
"var(--status-success)",
|
|
416
|
+
"var(--status-success)"
|
|
417
|
+
];
|
|
418
|
+
return {
|
|
419
|
+
score,
|
|
420
|
+
label: labels[score],
|
|
421
|
+
color: colors[score]
|
|
422
|
+
};
|
|
423
|
+
}
|
|
424
|
+
var Signup = ({
|
|
425
|
+
brandName,
|
|
426
|
+
showSocialSignup = true,
|
|
427
|
+
logo,
|
|
428
|
+
onSubmit,
|
|
429
|
+
onGoogleSignup,
|
|
430
|
+
onLogin,
|
|
431
|
+
onTermsClick,
|
|
432
|
+
onPrivacyClick,
|
|
433
|
+
isLoading = false,
|
|
434
|
+
error,
|
|
435
|
+
isSuccess = false,
|
|
436
|
+
successMessage = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
437
|
+
"You're all set!",
|
|
438
|
+
/* @__PURE__ */ jsx("br", {}),
|
|
439
|
+
"Check your email to verify your account."
|
|
440
|
+
] }),
|
|
441
|
+
className,
|
|
442
|
+
style,
|
|
443
|
+
labels: customLabels,
|
|
444
|
+
defaultCountry = "TH",
|
|
445
|
+
countries = [],
|
|
446
|
+
renderPhoneInput
|
|
447
|
+
}) => {
|
|
448
|
+
const l = { ...defaultSignupLabels, ...customLabels };
|
|
449
|
+
const [name, setName] = useState("");
|
|
450
|
+
const [email, setEmail] = useState("");
|
|
451
|
+
const defaultCountryData = countries.find((c) => c.code === defaultCountry) || countries[0] || { dial: "+66"};
|
|
452
|
+
const [countryDial, setCountryDial] = useState(defaultCountryData.dial);
|
|
453
|
+
const [phone, setPhone] = useState("");
|
|
454
|
+
const [password, setPassword] = useState("");
|
|
455
|
+
const [showPassword, setShowPassword] = useState(false);
|
|
456
|
+
const [acceptedTerms, setAcceptedTerms] = useState(false);
|
|
457
|
+
const passwordStrength = useMemo(
|
|
458
|
+
() => calculatePasswordStrength(password, l.passwordStrengthLabels),
|
|
459
|
+
[password, l.passwordStrengthLabels]
|
|
460
|
+
);
|
|
461
|
+
const handleSubmit = (e) => {
|
|
462
|
+
e.preventDefault();
|
|
463
|
+
const fullPhone = phone ? phone.trim().startsWith("+") ? phone.trim() : `${countryDial} ${phone}`.trim() : "";
|
|
464
|
+
onSubmit?.({ name, email, phone: fullPhone, password, acceptedTerms });
|
|
465
|
+
};
|
|
466
|
+
const isFormValid = name && email && password.length >= 8 && acceptedTerms;
|
|
467
|
+
if (isSuccess) {
|
|
468
|
+
return /* @__PURE__ */ jsxs("div", { className: clsx5("ds-signup", className), style, children: [
|
|
469
|
+
/* @__PURE__ */ jsxs("div", { className: "ds-signup__background", children: [
|
|
470
|
+
/* @__PURE__ */ jsx("div", { className: "ds-signup__accent ds-signup__accent--1", "aria-hidden": "true" }),
|
|
471
|
+
/* @__PURE__ */ jsx("div", { className: "ds-signup__accent ds-signup__accent--2", "aria-hidden": "true" })
|
|
472
|
+
] }),
|
|
473
|
+
/* @__PURE__ */ jsxs("div", { className: "ds-signup__card ds-signup__card--success", children: [
|
|
474
|
+
/* @__PURE__ */ jsx("div", { className: "ds-signup__success-icon", children: /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 64 64", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
475
|
+
/* @__PURE__ */ jsx("circle", { cx: "32", cy: "32", r: "30", stroke: "var(--status-success)", strokeWidth: "2" }),
|
|
476
|
+
/* @__PURE__ */ jsx(
|
|
477
|
+
"path",
|
|
478
|
+
{
|
|
479
|
+
d: "M20 32L28 40L44 24",
|
|
480
|
+
stroke: "var(--status-success)",
|
|
481
|
+
strokeWidth: "3",
|
|
482
|
+
strokeLinecap: "round",
|
|
483
|
+
strokeLinejoin: "round"
|
|
484
|
+
}
|
|
485
|
+
)
|
|
486
|
+
] }) }),
|
|
487
|
+
/* @__PURE__ */ jsx("h1", { className: "ds-signup__success-title", children: l.successTitle === "Welcome!" ? brandName ? `Welcome to ${brandName}!` : "Welcome!" : l.successTitle }),
|
|
488
|
+
/* @__PURE__ */ jsx("p", { className: "ds-signup__success-message", children: successMessage }),
|
|
489
|
+
/* @__PURE__ */ jsx(Button, { variant: "primary", size: "lg", onClick: onLogin, className: "ds-signup__success-btn", children: l.continueToLoginLabel })
|
|
490
|
+
] })
|
|
491
|
+
] });
|
|
492
|
+
}
|
|
493
|
+
return /* @__PURE__ */ jsxs("div", { className: clsx5("ds-signup", className), style, children: [
|
|
494
|
+
/* @__PURE__ */ jsxs("div", { className: "ds-signup__background", children: [
|
|
495
|
+
/* @__PURE__ */ jsx("div", { className: "ds-signup__accent ds-signup__accent--1", "aria-hidden": "true" }),
|
|
496
|
+
/* @__PURE__ */ jsx("div", { className: "ds-signup__accent ds-signup__accent--2", "aria-hidden": "true" })
|
|
497
|
+
] }),
|
|
498
|
+
/* @__PURE__ */ jsxs("div", { className: "ds-signup__card", children: [
|
|
499
|
+
/* @__PURE__ */ jsxs("div", { className: "ds-signup__header", children: [
|
|
500
|
+
logo ? /* @__PURE__ */ jsx("div", { className: "ds-signup__logo", children: logo }) : /* @__PURE__ */ jsx("div", { className: "ds-signup__logo ds-signup__logo--default", children: /* @__PURE__ */ jsx("div", { className: "ds-signup__logo-icon", children: /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 32 32", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
501
|
+
/* @__PURE__ */ jsx("rect", { width: "32", height: "32", rx: "8", fill: "url(#signup-logo-gradient)" }),
|
|
502
|
+
/* @__PURE__ */ jsx(
|
|
503
|
+
"path",
|
|
504
|
+
{
|
|
505
|
+
d: "M16 8V24M8 16H24",
|
|
506
|
+
stroke: "white",
|
|
507
|
+
strokeWidth: "2.5",
|
|
508
|
+
strokeLinecap: "round"
|
|
509
|
+
}
|
|
510
|
+
),
|
|
511
|
+
/* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs("linearGradient", { id: "signup-logo-gradient", x1: "0", y1: "0", x2: "32", y2: "32", children: [
|
|
512
|
+
/* @__PURE__ */ jsx("stop", { stopColor: "rgb(var(--accent-rgb))" }),
|
|
513
|
+
/* @__PURE__ */ jsx("stop", { offset: "1", stopColor: "rgb(var(--accent2-rgb))" })
|
|
514
|
+
] }) })
|
|
515
|
+
] }) }) }),
|
|
516
|
+
/* @__PURE__ */ jsx("h1", { className: "ds-signup__title", children: l.formTitle })
|
|
517
|
+
] }),
|
|
518
|
+
error && /* @__PURE__ */ jsxs("div", { className: "ds-signup__error", children: [
|
|
519
|
+
/* @__PURE__ */ jsxs(
|
|
520
|
+
"svg",
|
|
521
|
+
{
|
|
522
|
+
width: "16",
|
|
523
|
+
height: "16",
|
|
524
|
+
viewBox: "0 0 16 16",
|
|
525
|
+
fill: "none",
|
|
526
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
527
|
+
children: [
|
|
528
|
+
/* @__PURE__ */ jsx("circle", { cx: "8", cy: "8", r: "7", stroke: "currentColor", strokeWidth: "1.5" }),
|
|
529
|
+
/* @__PURE__ */ jsx("path", { d: "M8 4.5V8.5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" }),
|
|
530
|
+
/* @__PURE__ */ jsx("circle", { cx: "8", cy: "11", r: "0.75", fill: "currentColor" })
|
|
531
|
+
]
|
|
532
|
+
}
|
|
533
|
+
),
|
|
534
|
+
/* @__PURE__ */ jsx("span", { children: error })
|
|
535
|
+
] }),
|
|
536
|
+
showSocialSignup && /* @__PURE__ */ jsxs("div", { className: "ds-signup__social", children: [
|
|
537
|
+
/* @__PURE__ */ jsxs(
|
|
538
|
+
"button",
|
|
539
|
+
{
|
|
540
|
+
type: "button",
|
|
541
|
+
className: "ds-signup__social-btn",
|
|
542
|
+
onClick: onGoogleSignup,
|
|
543
|
+
disabled: isLoading,
|
|
544
|
+
children: [
|
|
545
|
+
/* @__PURE__ */ jsxs("svg", { viewBox: "0 0 24 24", width: "20", height: "20", children: [
|
|
546
|
+
/* @__PURE__ */ jsx(
|
|
547
|
+
"path",
|
|
548
|
+
{
|
|
549
|
+
fill: "#4285F4",
|
|
550
|
+
d: "M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z"
|
|
551
|
+
}
|
|
552
|
+
),
|
|
553
|
+
/* @__PURE__ */ jsx(
|
|
554
|
+
"path",
|
|
555
|
+
{
|
|
556
|
+
fill: "#34A853",
|
|
557
|
+
d: "M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"
|
|
558
|
+
}
|
|
559
|
+
),
|
|
560
|
+
/* @__PURE__ */ jsx(
|
|
561
|
+
"path",
|
|
562
|
+
{
|
|
563
|
+
fill: "#FBBC05",
|
|
564
|
+
d: "M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z"
|
|
565
|
+
}
|
|
566
|
+
),
|
|
567
|
+
/* @__PURE__ */ jsx(
|
|
568
|
+
"path",
|
|
569
|
+
{
|
|
570
|
+
fill: "#EA4335",
|
|
571
|
+
d: "M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z"
|
|
572
|
+
}
|
|
573
|
+
)
|
|
574
|
+
] }),
|
|
575
|
+
/* @__PURE__ */ jsx("span", { children: l.googleButtonLabel })
|
|
576
|
+
]
|
|
577
|
+
}
|
|
578
|
+
),
|
|
579
|
+
/* @__PURE__ */ jsx("div", { className: "ds-signup__divider", children: /* @__PURE__ */ jsx("span", { children: l.dividerText }) })
|
|
580
|
+
] }),
|
|
581
|
+
/* @__PURE__ */ jsxs("form", { className: "ds-signup__form", onSubmit: handleSubmit, children: [
|
|
582
|
+
/* @__PURE__ */ jsx("div", { className: "ds-signup__field", children: /* @__PURE__ */ jsx(
|
|
583
|
+
TextField,
|
|
584
|
+
{
|
|
585
|
+
label: l.nameLabel,
|
|
586
|
+
type: "text",
|
|
587
|
+
placeholder: l.namePlaceholder,
|
|
588
|
+
value: name,
|
|
589
|
+
onChange: (e) => setName(e.target.value),
|
|
590
|
+
disabled: isLoading,
|
|
591
|
+
autoComplete: "name"
|
|
592
|
+
}
|
|
593
|
+
) }),
|
|
594
|
+
/* @__PURE__ */ jsx("div", { className: "ds-signup__field", children: /* @__PURE__ */ jsx(
|
|
595
|
+
TextField,
|
|
596
|
+
{
|
|
597
|
+
label: l.emailLabel,
|
|
598
|
+
type: "email",
|
|
599
|
+
placeholder: l.emailPlaceholder,
|
|
600
|
+
value: email,
|
|
601
|
+
onChange: (e) => setEmail(e.target.value),
|
|
602
|
+
disabled: isLoading,
|
|
603
|
+
autoComplete: "email"
|
|
604
|
+
}
|
|
605
|
+
) }),
|
|
606
|
+
/* @__PURE__ */ jsx("div", { className: "ds-signup__field ds-signup__phone-field", children: /* @__PURE__ */ jsxs("div", { className: "ds-textfield", children: [
|
|
607
|
+
/* @__PURE__ */ jsx("label", { className: "ds-textfield__label", htmlFor: "phone-input", children: l.phoneLabel }),
|
|
608
|
+
/* @__PURE__ */ jsx("div", { className: "ds-textfield__input-wrapper", children: renderPhoneInput ? renderPhoneInput({
|
|
609
|
+
value: phone,
|
|
610
|
+
onChange: setPhone,
|
|
611
|
+
placeholder: l.phonePlaceholder,
|
|
612
|
+
disabled: isLoading,
|
|
613
|
+
className: "ds-signup__phone-container ds-textfield__input",
|
|
614
|
+
id: "phone-input"
|
|
615
|
+
}) : /* @__PURE__ */ jsxs("div", { className: clsx5("ds-signup__phone-container", "ds-textfield__input"), children: [
|
|
616
|
+
/* @__PURE__ */ jsxs("div", { className: "ds-signup__flag-select-wrapper", children: [
|
|
617
|
+
/* @__PURE__ */ jsx(
|
|
618
|
+
"select",
|
|
619
|
+
{
|
|
620
|
+
className: "ds-signup__flag-select-native",
|
|
621
|
+
value: countryDial,
|
|
622
|
+
onChange: (e) => {
|
|
623
|
+
const newDial = e.target.value;
|
|
624
|
+
setCountryDial(newDial);
|
|
625
|
+
setPhone(newDial + " ");
|
|
626
|
+
},
|
|
627
|
+
disabled: isLoading,
|
|
628
|
+
"aria-label": "Select country code",
|
|
629
|
+
children: countries.map((c) => /* @__PURE__ */ jsx("option", { value: c.dial, children: c.name }, c.code))
|
|
630
|
+
}
|
|
631
|
+
),
|
|
632
|
+
/* @__PURE__ */ jsxs("div", { className: "ds-signup__flag-display", "aria-hidden": "true", children: [
|
|
633
|
+
/* @__PURE__ */ jsx("span", { className: "ds-signup__flag-icon", children: countries.find((c) => c.dial === countryDial)?.flag || "\u{1F310}" }),
|
|
634
|
+
/* @__PURE__ */ jsx("svg", { width: "10", height: "6", viewBox: "0 0 10 6", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx("path", { d: "M1 1L5 5L9 1", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) })
|
|
635
|
+
] })
|
|
636
|
+
] }),
|
|
637
|
+
/* @__PURE__ */ jsx(
|
|
638
|
+
"input",
|
|
639
|
+
{
|
|
640
|
+
id: "phone-input",
|
|
641
|
+
type: "tel",
|
|
642
|
+
placeholder: l.phonePlaceholder,
|
|
643
|
+
value: phone,
|
|
644
|
+
onChange: (e) => setPhone(e.target.value),
|
|
645
|
+
disabled: isLoading,
|
|
646
|
+
className: "ds-signup__phone-input ds-signup__phone-input-native",
|
|
647
|
+
autoComplete: "tel"
|
|
648
|
+
}
|
|
649
|
+
)
|
|
650
|
+
] }) })
|
|
651
|
+
] }) }),
|
|
652
|
+
/* @__PURE__ */ jsxs("div", { className: "ds-signup__field", children: [
|
|
653
|
+
/* @__PURE__ */ jsxs("div", { className: "ds-signup__password-wrapper", children: [
|
|
654
|
+
/* @__PURE__ */ jsx(
|
|
655
|
+
TextField,
|
|
656
|
+
{
|
|
657
|
+
label: l.passwordLabel,
|
|
658
|
+
type: showPassword ? "text" : "password",
|
|
659
|
+
placeholder: l.passwordPlaceholder,
|
|
660
|
+
value: password,
|
|
661
|
+
onChange: (e) => setPassword(e.target.value),
|
|
662
|
+
disabled: isLoading,
|
|
663
|
+
autoComplete: "new-password"
|
|
664
|
+
}
|
|
665
|
+
),
|
|
666
|
+
/* @__PURE__ */ jsx(
|
|
667
|
+
"button",
|
|
668
|
+
{
|
|
669
|
+
type: "button",
|
|
670
|
+
className: "ds-signup__password-toggle",
|
|
671
|
+
onClick: () => setShowPassword(!showPassword),
|
|
672
|
+
"aria-label": showPassword ? l.hidePasswordLabel : l.showPasswordLabel,
|
|
673
|
+
children: showPassword ? /* @__PURE__ */ jsxs(
|
|
674
|
+
"svg",
|
|
675
|
+
{
|
|
676
|
+
width: "20",
|
|
677
|
+
height: "20",
|
|
678
|
+
viewBox: "0 0 24 24",
|
|
679
|
+
fill: "none",
|
|
680
|
+
stroke: "currentColor",
|
|
681
|
+
strokeWidth: "2",
|
|
682
|
+
strokeLinecap: "round",
|
|
683
|
+
strokeLinejoin: "round",
|
|
684
|
+
children: [
|
|
685
|
+
/* @__PURE__ */ jsx("path", { d: "M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24" }),
|
|
686
|
+
/* @__PURE__ */ jsx("line", { x1: "1", y1: "1", x2: "23", y2: "23" })
|
|
687
|
+
]
|
|
688
|
+
}
|
|
689
|
+
) : /* @__PURE__ */ jsxs(
|
|
690
|
+
"svg",
|
|
691
|
+
{
|
|
692
|
+
width: "20",
|
|
693
|
+
height: "20",
|
|
694
|
+
viewBox: "0 0 24 24",
|
|
695
|
+
fill: "none",
|
|
696
|
+
stroke: "currentColor",
|
|
697
|
+
strokeWidth: "2",
|
|
698
|
+
strokeLinecap: "round",
|
|
699
|
+
strokeLinejoin: "round",
|
|
700
|
+
children: [
|
|
701
|
+
/* @__PURE__ */ jsx("path", { d: "M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z" }),
|
|
702
|
+
/* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "3" })
|
|
703
|
+
]
|
|
704
|
+
}
|
|
705
|
+
)
|
|
706
|
+
}
|
|
707
|
+
)
|
|
708
|
+
] }),
|
|
709
|
+
password && /* @__PURE__ */ jsxs("div", { className: "ds-signup__strength", children: [
|
|
710
|
+
/* @__PURE__ */ jsx("div", { className: "ds-signup__strength-bar", children: [0, 1, 2, 3].map((i) => /* @__PURE__ */ jsx(
|
|
711
|
+
"div",
|
|
712
|
+
{
|
|
713
|
+
className: clsx5(
|
|
714
|
+
"ds-signup__strength-segment",
|
|
715
|
+
i < passwordStrength.score && "ds-signup__strength-segment--active"
|
|
716
|
+
),
|
|
717
|
+
style: i < passwordStrength.score ? { backgroundColor: passwordStrength.color } : {}
|
|
718
|
+
},
|
|
719
|
+
i
|
|
720
|
+
)) }),
|
|
721
|
+
/* @__PURE__ */ jsx(
|
|
722
|
+
"span",
|
|
723
|
+
{
|
|
724
|
+
className: "ds-signup__strength-label",
|
|
725
|
+
style: { color: passwordStrength.color },
|
|
726
|
+
children: passwordStrength.label
|
|
727
|
+
}
|
|
728
|
+
)
|
|
729
|
+
] })
|
|
730
|
+
] }),
|
|
731
|
+
/* @__PURE__ */ jsxs("div", { className: "ds-signup__terms", children: [
|
|
732
|
+
/* @__PURE__ */ jsx(
|
|
733
|
+
Checkbox,
|
|
734
|
+
{
|
|
735
|
+
label: "",
|
|
736
|
+
checked: acceptedTerms,
|
|
737
|
+
onCheckedChange: (checked) => setAcceptedTerms(checked === true),
|
|
738
|
+
disabled: isLoading
|
|
739
|
+
}
|
|
740
|
+
),
|
|
741
|
+
/* @__PURE__ */ jsxs("span", { className: "ds-signup__terms-text", children: [
|
|
742
|
+
(l.termsAgreementPrefix || "").endsWith(" ") ? l.termsAgreementPrefix || "" : `${l.termsAgreementPrefix || ""} `,
|
|
743
|
+
/* @__PURE__ */ jsx(
|
|
744
|
+
"button",
|
|
745
|
+
{
|
|
746
|
+
type: "button",
|
|
747
|
+
className: "ds-signup__link",
|
|
748
|
+
onClick: onTermsClick,
|
|
749
|
+
disabled: isLoading,
|
|
750
|
+
children: l.termsLabel
|
|
751
|
+
}
|
|
752
|
+
),
|
|
753
|
+
(l.termsConjunction || " ").startsWith(" ") && (l.termsConjunction || " ").endsWith(" ") ? l.termsConjunction || " " : ` ${(l.termsConjunction || "").trim()} `,
|
|
754
|
+
/* @__PURE__ */ jsx(
|
|
755
|
+
"button",
|
|
756
|
+
{
|
|
757
|
+
type: "button",
|
|
758
|
+
className: "ds-signup__link",
|
|
759
|
+
onClick: onPrivacyClick,
|
|
760
|
+
disabled: isLoading,
|
|
761
|
+
children: l.privacyLabel
|
|
762
|
+
}
|
|
763
|
+
)
|
|
764
|
+
] })
|
|
765
|
+
] }),
|
|
766
|
+
/* @__PURE__ */ jsx(
|
|
767
|
+
Button,
|
|
768
|
+
{
|
|
769
|
+
type: "submit",
|
|
770
|
+
variant: "primary",
|
|
771
|
+
size: "lg",
|
|
772
|
+
disabled: isLoading || !isFormValid,
|
|
773
|
+
className: "ds-signup__submit",
|
|
774
|
+
children: isLoading ? /* @__PURE__ */ jsx("span", { className: "ds-signup__spinner" }) : l.submitLabel
|
|
775
|
+
}
|
|
776
|
+
)
|
|
777
|
+
] }),
|
|
778
|
+
/* @__PURE__ */ jsxs("div", { className: "ds-signup__footer", children: [
|
|
779
|
+
/* @__PURE__ */ jsx("span", { children: l.loginPrompt }),
|
|
780
|
+
/* @__PURE__ */ jsx(
|
|
781
|
+
"button",
|
|
782
|
+
{
|
|
783
|
+
type: "button",
|
|
784
|
+
className: "ds-signup__link ds-signup__link--accent",
|
|
785
|
+
onClick: onLogin,
|
|
786
|
+
disabled: isLoading,
|
|
787
|
+
children: l.loginLabel
|
|
788
|
+
}
|
|
789
|
+
)
|
|
790
|
+
] })
|
|
791
|
+
] })
|
|
792
|
+
] });
|
|
793
|
+
};
|
|
794
|
+
Signup.displayName = "Signup";
|
|
795
|
+
var defaultForgotPasswordLabels = {
|
|
796
|
+
forgotPasswordTitle: "Forgot password?",
|
|
797
|
+
resetInstructionsTagline: "No worries, we'll send you reset instructions.",
|
|
798
|
+
emailLabel: "Email",
|
|
799
|
+
emailPlaceholder: "Enter your email",
|
|
800
|
+
resetPasswordButton: "Reset password",
|
|
801
|
+
backToLoginButton: "Back to login",
|
|
802
|
+
checkYourEmailTitle: "Check your email",
|
|
803
|
+
passwordResetLinkTagline: "We sent a password reset link to",
|
|
804
|
+
didNotReceiveEmailHint: "Didn't receive the email? ",
|
|
805
|
+
clickToResendButton: "Click to resend",
|
|
806
|
+
setNewPasswordTitle: "Set new password",
|
|
807
|
+
mustBeCharactersTagline: "Must be at least 8 characters.",
|
|
808
|
+
passwordLabel: "Password",
|
|
809
|
+
enterNewPasswordPlaceholder: "Enter new password",
|
|
810
|
+
confirmPasswordLabel: "Confirm password",
|
|
811
|
+
confirmNewPasswordPlaceholder: "Confirm new password",
|
|
812
|
+
passwordsDontMatchError: "Passwords don't match",
|
|
813
|
+
passwordResetTitle: "Password reset",
|
|
814
|
+
passwordSuccessfullyResetTagline: "Your password has been successfully reset.",
|
|
815
|
+
clickBelowLogInHint: "Click below to log in.",
|
|
816
|
+
continueToLoginButton: "Continue to login",
|
|
817
|
+
showPasswordLabel: "Show password",
|
|
818
|
+
hidePasswordLabel: "Hide password"
|
|
819
|
+
};
|
|
820
|
+
var ForgotPassword = ({
|
|
821
|
+
logo,
|
|
822
|
+
labels: customLabels,
|
|
823
|
+
onSubmit,
|
|
824
|
+
onResetPassword,
|
|
825
|
+
onBackToLogin,
|
|
826
|
+
isLoading = false,
|
|
827
|
+
error,
|
|
828
|
+
step = "email",
|
|
829
|
+
email: initialEmail = "",
|
|
830
|
+
className
|
|
831
|
+
}) => {
|
|
832
|
+
const l = { ...defaultForgotPasswordLabels, ...customLabels };
|
|
833
|
+
const [email, setEmail] = useState(initialEmail);
|
|
834
|
+
const [password, setPassword] = useState("");
|
|
835
|
+
const [confirmPassword, setConfirmPassword] = useState("");
|
|
836
|
+
const [showPassword, setShowPassword] = useState(false);
|
|
837
|
+
const [resendTimer, setResendTimer] = useState(0);
|
|
838
|
+
const hasStartedTimer = React2.useRef(false);
|
|
839
|
+
useEffect(() => {
|
|
840
|
+
if (step === "sent" && !hasStartedTimer.current) {
|
|
841
|
+
hasStartedTimer.current = true;
|
|
842
|
+
setResendTimer(60);
|
|
843
|
+
} else if (step !== "sent") {
|
|
844
|
+
hasStartedTimer.current = false;
|
|
845
|
+
}
|
|
846
|
+
}, [step]);
|
|
847
|
+
useEffect(() => {
|
|
848
|
+
let timerId;
|
|
849
|
+
if (resendTimer > 0) {
|
|
850
|
+
timerId = setInterval(() => {
|
|
851
|
+
setResendTimer((prev) => prev - 1);
|
|
852
|
+
}, 1e3);
|
|
853
|
+
}
|
|
854
|
+
return () => {
|
|
855
|
+
if (timerId) clearInterval(timerId);
|
|
856
|
+
};
|
|
857
|
+
}, [resendTimer]);
|
|
858
|
+
const handleResendClick = () => {
|
|
859
|
+
if (resendTimer === 0) {
|
|
860
|
+
onSubmit?.(email || initialEmail);
|
|
861
|
+
setResendTimer(60);
|
|
862
|
+
}
|
|
863
|
+
};
|
|
864
|
+
const handleEmailSubmit = (e) => {
|
|
865
|
+
e.preventDefault();
|
|
866
|
+
onSubmit?.(email);
|
|
867
|
+
};
|
|
868
|
+
const handleResetSubmit = (e) => {
|
|
869
|
+
e.preventDefault();
|
|
870
|
+
onResetPassword?.({ password, confirmPassword });
|
|
871
|
+
};
|
|
872
|
+
const renderLogo = () => logo ? /* @__PURE__ */ jsx("div", { className: "ds-forgot__logo", children: logo }) : /* @__PURE__ */ jsx("div", { className: "ds-forgot__logo ds-forgot__logo--default", children: /* @__PURE__ */ jsx("div", { className: "ds-forgot__logo-icon", children: /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 32 32", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
873
|
+
/* @__PURE__ */ jsx("rect", { width: "32", height: "32", rx: "8", fill: "url(#forgot-logo-gradient)" }),
|
|
874
|
+
/* @__PURE__ */ jsx(
|
|
875
|
+
"path",
|
|
876
|
+
{
|
|
877
|
+
d: "M16 10V14M16 22V22.01M16 26C21.5228 26 26 21.5228 26 16C26 10.4772 21.5228 6 16 6C10.4772 6 6 10.4772 6 16C6 21.5228 10.4772 26 16 26Z",
|
|
878
|
+
stroke: "white",
|
|
879
|
+
strokeWidth: "2",
|
|
880
|
+
strokeLinecap: "round"
|
|
881
|
+
}
|
|
882
|
+
),
|
|
883
|
+
/* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs("linearGradient", { id: "forgot-logo-gradient", x1: "0", y1: "0", x2: "32", y2: "32", children: [
|
|
884
|
+
/* @__PURE__ */ jsx("stop", { stopColor: "rgb(var(--accent-rgb))" }),
|
|
885
|
+
/* @__PURE__ */ jsx("stop", { offset: "1", stopColor: "rgb(var(--accent2-rgb))" })
|
|
886
|
+
] }) })
|
|
887
|
+
] }) }) });
|
|
888
|
+
if (step === "email") {
|
|
889
|
+
return /* @__PURE__ */ jsxs("div", { className: clsx5("ds-forgot", className), children: [
|
|
890
|
+
/* @__PURE__ */ jsx("div", { className: "ds-forgot__accent ds-forgot__accent--1", "aria-hidden": "true" }),
|
|
891
|
+
/* @__PURE__ */ jsx("div", { className: "ds-forgot__accent ds-forgot__accent--2", "aria-hidden": "true" }),
|
|
892
|
+
/* @__PURE__ */ jsxs("div", { className: "ds-forgot__card", children: [
|
|
893
|
+
/* @__PURE__ */ jsxs("div", { className: "ds-forgot__header", children: [
|
|
894
|
+
renderLogo(),
|
|
895
|
+
/* @__PURE__ */ jsx("h1", { className: "ds-forgot__title", children: l.forgotPasswordTitle }),
|
|
896
|
+
/* @__PURE__ */ jsx("p", { className: "ds-forgot__tagline", children: l.resetInstructionsTagline })
|
|
897
|
+
] }),
|
|
898
|
+
error && /* @__PURE__ */ jsxs("div", { className: "ds-forgot__error", children: [
|
|
899
|
+
/* @__PURE__ */ jsxs(
|
|
900
|
+
"svg",
|
|
901
|
+
{
|
|
902
|
+
width: "16",
|
|
903
|
+
height: "16",
|
|
904
|
+
viewBox: "0 0 16 16",
|
|
905
|
+
fill: "none",
|
|
906
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
907
|
+
children: [
|
|
908
|
+
/* @__PURE__ */ jsx("circle", { cx: "8", cy: "8", r: "7", stroke: "currentColor", strokeWidth: "1.5" }),
|
|
909
|
+
/* @__PURE__ */ jsx(
|
|
910
|
+
"path",
|
|
911
|
+
{
|
|
912
|
+
d: "M8 4.5V8.5",
|
|
913
|
+
stroke: "currentColor",
|
|
914
|
+
strokeWidth: "1.5",
|
|
915
|
+
strokeLinecap: "round"
|
|
916
|
+
}
|
|
917
|
+
),
|
|
918
|
+
/* @__PURE__ */ jsx("circle", { cx: "8", cy: "11", r: "0.75", fill: "currentColor" })
|
|
919
|
+
]
|
|
920
|
+
}
|
|
921
|
+
),
|
|
922
|
+
/* @__PURE__ */ jsx("span", { children: error })
|
|
923
|
+
] }),
|
|
924
|
+
/* @__PURE__ */ jsxs("form", { className: "ds-forgot__form", onSubmit: handleEmailSubmit, children: [
|
|
925
|
+
/* @__PURE__ */ jsx("div", { className: "ds-forgot__field", children: /* @__PURE__ */ jsx(
|
|
926
|
+
TextField,
|
|
927
|
+
{
|
|
928
|
+
label: l.emailLabel,
|
|
929
|
+
type: "email",
|
|
930
|
+
placeholder: l.emailPlaceholder,
|
|
931
|
+
value: email,
|
|
932
|
+
onChange: (e) => setEmail(e.target.value),
|
|
933
|
+
disabled: isLoading,
|
|
934
|
+
autoComplete: "email"
|
|
935
|
+
}
|
|
936
|
+
) }),
|
|
937
|
+
/* @__PURE__ */ jsx(
|
|
938
|
+
Button,
|
|
939
|
+
{
|
|
940
|
+
type: "submit",
|
|
941
|
+
variant: "primary",
|
|
942
|
+
size: "lg",
|
|
943
|
+
disabled: isLoading || !email,
|
|
944
|
+
className: "ds-forgot__submit",
|
|
945
|
+
children: isLoading ? /* @__PURE__ */ jsx("span", { className: "ds-forgot__spinner" }) : l.resetPasswordButton
|
|
946
|
+
}
|
|
947
|
+
)
|
|
948
|
+
] }),
|
|
949
|
+
/* @__PURE__ */ jsx("div", { className: "ds-forgot__footer", children: /* @__PURE__ */ jsxs(
|
|
950
|
+
"button",
|
|
951
|
+
{
|
|
952
|
+
type: "button",
|
|
953
|
+
className: "ds-forgot__back",
|
|
954
|
+
onClick: onBackToLogin,
|
|
955
|
+
disabled: isLoading,
|
|
956
|
+
children: [
|
|
957
|
+
/* @__PURE__ */ jsx(
|
|
958
|
+
"svg",
|
|
959
|
+
{
|
|
960
|
+
width: "16",
|
|
961
|
+
height: "16",
|
|
962
|
+
viewBox: "0 0 16 16",
|
|
963
|
+
fill: "none",
|
|
964
|
+
stroke: "currentColor",
|
|
965
|
+
strokeWidth: "1.5",
|
|
966
|
+
strokeLinecap: "round",
|
|
967
|
+
strokeLinejoin: "round",
|
|
968
|
+
children: /* @__PURE__ */ jsx("path", { d: "M10 12L6 8L10 4" })
|
|
969
|
+
}
|
|
970
|
+
),
|
|
971
|
+
l.backToLoginButton
|
|
972
|
+
]
|
|
973
|
+
}
|
|
974
|
+
) })
|
|
975
|
+
] })
|
|
976
|
+
] });
|
|
977
|
+
}
|
|
978
|
+
if (step === "sent") {
|
|
979
|
+
return /* @__PURE__ */ jsxs("div", { className: clsx5("ds-forgot", className), children: [
|
|
980
|
+
/* @__PURE__ */ jsx("div", { className: "ds-forgot__accent ds-forgot__accent--1", "aria-hidden": "true" }),
|
|
981
|
+
/* @__PURE__ */ jsx("div", { className: "ds-forgot__accent ds-forgot__accent--2", "aria-hidden": "true" }),
|
|
982
|
+
/* @__PURE__ */ jsxs("div", { className: "ds-forgot__card ds-forgot__card--centered", children: [
|
|
983
|
+
/* @__PURE__ */ jsx("div", { className: "ds-forgot__success-icon", children: /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 64 64", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
984
|
+
/* @__PURE__ */ jsx("circle", { cx: "32", cy: "32", r: "30", stroke: "rgb(var(--accent-rgb))", strokeWidth: "2" }),
|
|
985
|
+
/* @__PURE__ */ jsx(
|
|
986
|
+
"path",
|
|
987
|
+
{
|
|
988
|
+
d: "M20 32L44 32M44 32L36 24M44 32L36 40",
|
|
989
|
+
stroke: "rgb(var(--accent-rgb))",
|
|
990
|
+
strokeWidth: "3",
|
|
991
|
+
strokeLinecap: "round",
|
|
992
|
+
strokeLinejoin: "round"
|
|
993
|
+
}
|
|
994
|
+
)
|
|
995
|
+
] }) }),
|
|
996
|
+
/* @__PURE__ */ jsx("h1", { className: "ds-forgot__title", children: l.checkYourEmailTitle }),
|
|
997
|
+
/* @__PURE__ */ jsxs("p", { className: "ds-forgot__tagline", children: [
|
|
998
|
+
l.passwordResetLinkTagline,
|
|
999
|
+
/* @__PURE__ */ jsx("br", {}),
|
|
1000
|
+
/* @__PURE__ */ jsx("strong", { children: email || initialEmail })
|
|
1001
|
+
] }),
|
|
1002
|
+
/* @__PURE__ */ jsxs("div", { className: "ds-forgot__hint", children: [
|
|
1003
|
+
/* @__PURE__ */ jsx("span", { children: l.didNotReceiveEmailHint }),
|
|
1004
|
+
/* @__PURE__ */ jsx(
|
|
1005
|
+
"button",
|
|
1006
|
+
{
|
|
1007
|
+
type: "button",
|
|
1008
|
+
className: "ds-forgot__link",
|
|
1009
|
+
onClick: handleResendClick,
|
|
1010
|
+
disabled: isLoading || resendTimer > 0,
|
|
1011
|
+
children: resendTimer > 0 ? `${l.clickToResendButton} ${resendTimer}s` : l.clickToResendButton
|
|
1012
|
+
}
|
|
1013
|
+
)
|
|
1014
|
+
] }),
|
|
1015
|
+
/* @__PURE__ */ jsx("div", { className: "ds-forgot__footer", children: /* @__PURE__ */ jsxs(
|
|
1016
|
+
"button",
|
|
1017
|
+
{
|
|
1018
|
+
type: "button",
|
|
1019
|
+
className: "ds-forgot__back",
|
|
1020
|
+
onClick: onBackToLogin,
|
|
1021
|
+
disabled: isLoading,
|
|
1022
|
+
children: [
|
|
1023
|
+
/* @__PURE__ */ jsx(
|
|
1024
|
+
"svg",
|
|
1025
|
+
{
|
|
1026
|
+
width: "16",
|
|
1027
|
+
height: "16",
|
|
1028
|
+
viewBox: "0 0 16 16",
|
|
1029
|
+
fill: "none",
|
|
1030
|
+
stroke: "currentColor",
|
|
1031
|
+
strokeWidth: "1.5",
|
|
1032
|
+
strokeLinecap: "round",
|
|
1033
|
+
strokeLinejoin: "round",
|
|
1034
|
+
children: /* @__PURE__ */ jsx("path", { d: "M10 12L6 8L10 4" })
|
|
1035
|
+
}
|
|
1036
|
+
),
|
|
1037
|
+
l.backToLoginButton
|
|
1038
|
+
]
|
|
1039
|
+
}
|
|
1040
|
+
) })
|
|
1041
|
+
] })
|
|
1042
|
+
] });
|
|
1043
|
+
}
|
|
1044
|
+
if (step === "reset") {
|
|
1045
|
+
const passwordsMatch = password === confirmPassword;
|
|
1046
|
+
const isValid = password.length >= 8 && passwordsMatch;
|
|
1047
|
+
return /* @__PURE__ */ jsxs("div", { className: clsx5("ds-forgot", className), children: [
|
|
1048
|
+
/* @__PURE__ */ jsx("div", { className: "ds-forgot__accent ds-forgot__accent--1", "aria-hidden": "true" }),
|
|
1049
|
+
/* @__PURE__ */ jsx("div", { className: "ds-forgot__accent ds-forgot__accent--2", "aria-hidden": "true" }),
|
|
1050
|
+
/* @__PURE__ */ jsxs("div", { className: "ds-forgot__card", children: [
|
|
1051
|
+
/* @__PURE__ */ jsxs("div", { className: "ds-forgot__header", children: [
|
|
1052
|
+
renderLogo(),
|
|
1053
|
+
/* @__PURE__ */ jsx("h1", { className: "ds-forgot__title", children: l.setNewPasswordTitle }),
|
|
1054
|
+
/* @__PURE__ */ jsx("p", { className: "ds-forgot__tagline", children: l.mustBeCharactersTagline })
|
|
1055
|
+
] }),
|
|
1056
|
+
error && /* @__PURE__ */ jsxs("div", { className: "ds-forgot__error", children: [
|
|
1057
|
+
/* @__PURE__ */ jsxs(
|
|
1058
|
+
"svg",
|
|
1059
|
+
{
|
|
1060
|
+
width: "16",
|
|
1061
|
+
height: "16",
|
|
1062
|
+
viewBox: "0 0 16 16",
|
|
1063
|
+
fill: "none",
|
|
1064
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1065
|
+
children: [
|
|
1066
|
+
/* @__PURE__ */ jsx("circle", { cx: "8", cy: "8", r: "7", stroke: "currentColor", strokeWidth: "1.5" }),
|
|
1067
|
+
/* @__PURE__ */ jsx(
|
|
1068
|
+
"path",
|
|
1069
|
+
{
|
|
1070
|
+
d: "M8 4.5V8.5",
|
|
1071
|
+
stroke: "currentColor",
|
|
1072
|
+
strokeWidth: "1.5",
|
|
1073
|
+
strokeLinecap: "round"
|
|
1074
|
+
}
|
|
1075
|
+
),
|
|
1076
|
+
/* @__PURE__ */ jsx("circle", { cx: "8", cy: "11", r: "0.75", fill: "currentColor" })
|
|
1077
|
+
]
|
|
1078
|
+
}
|
|
1079
|
+
),
|
|
1080
|
+
/* @__PURE__ */ jsx("span", { children: error })
|
|
1081
|
+
] }),
|
|
1082
|
+
/* @__PURE__ */ jsxs("form", { className: "ds-forgot__form", onSubmit: handleResetSubmit, children: [
|
|
1083
|
+
/* @__PURE__ */ jsx("div", { className: "ds-forgot__field", children: /* @__PURE__ */ jsxs("div", { className: "ds-forgot__password-wrapper", children: [
|
|
1084
|
+
/* @__PURE__ */ jsx(
|
|
1085
|
+
TextField,
|
|
1086
|
+
{
|
|
1087
|
+
label: l.passwordLabel,
|
|
1088
|
+
type: showPassword ? "text" : "password",
|
|
1089
|
+
placeholder: l.enterNewPasswordPlaceholder,
|
|
1090
|
+
value: password,
|
|
1091
|
+
onChange: (e) => setPassword(e.target.value),
|
|
1092
|
+
disabled: isLoading,
|
|
1093
|
+
autoComplete: "new-password"
|
|
1094
|
+
}
|
|
1095
|
+
),
|
|
1096
|
+
/* @__PURE__ */ jsx(
|
|
1097
|
+
"button",
|
|
1098
|
+
{
|
|
1099
|
+
type: "button",
|
|
1100
|
+
className: "ds-forgot__password-toggle",
|
|
1101
|
+
onClick: () => setShowPassword(!showPassword),
|
|
1102
|
+
"aria-label": showPassword ? l.hidePasswordLabel : l.showPasswordLabel,
|
|
1103
|
+
children: showPassword ? /* @__PURE__ */ jsxs(
|
|
1104
|
+
"svg",
|
|
1105
|
+
{
|
|
1106
|
+
width: "20",
|
|
1107
|
+
height: "20",
|
|
1108
|
+
viewBox: "0 0 24 24",
|
|
1109
|
+
fill: "none",
|
|
1110
|
+
stroke: "currentColor",
|
|
1111
|
+
strokeWidth: "2",
|
|
1112
|
+
strokeLinecap: "round",
|
|
1113
|
+
strokeLinejoin: "round",
|
|
1114
|
+
children: [
|
|
1115
|
+
/* @__PURE__ */ jsx("path", { d: "M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24" }),
|
|
1116
|
+
/* @__PURE__ */ jsx("line", { x1: "1", y1: "1", x2: "23", y2: "23" })
|
|
1117
|
+
]
|
|
1118
|
+
}
|
|
1119
|
+
) : /* @__PURE__ */ jsxs(
|
|
1120
|
+
"svg",
|
|
1121
|
+
{
|
|
1122
|
+
width: "20",
|
|
1123
|
+
height: "20",
|
|
1124
|
+
viewBox: "0 0 24 24",
|
|
1125
|
+
fill: "none",
|
|
1126
|
+
stroke: "currentColor",
|
|
1127
|
+
strokeWidth: "2",
|
|
1128
|
+
strokeLinecap: "round",
|
|
1129
|
+
strokeLinejoin: "round",
|
|
1130
|
+
children: [
|
|
1131
|
+
/* @__PURE__ */ jsx("path", { d: "M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z" }),
|
|
1132
|
+
/* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "3" })
|
|
1133
|
+
]
|
|
1134
|
+
}
|
|
1135
|
+
)
|
|
1136
|
+
}
|
|
1137
|
+
)
|
|
1138
|
+
] }) }),
|
|
1139
|
+
/* @__PURE__ */ jsx("div", { className: "ds-forgot__field", children: /* @__PURE__ */ jsx(
|
|
1140
|
+
TextField,
|
|
1141
|
+
{
|
|
1142
|
+
label: l.confirmPasswordLabel,
|
|
1143
|
+
type: showPassword ? "text" : "password",
|
|
1144
|
+
placeholder: l.confirmNewPasswordPlaceholder,
|
|
1145
|
+
value: confirmPassword,
|
|
1146
|
+
onChange: (e) => setConfirmPassword(e.target.value),
|
|
1147
|
+
disabled: isLoading,
|
|
1148
|
+
autoComplete: "new-password",
|
|
1149
|
+
error: confirmPassword.length > 0 && !passwordsMatch,
|
|
1150
|
+
helperText: confirmPassword.length > 0 && !passwordsMatch ? l.passwordsDontMatchError : void 0
|
|
1151
|
+
}
|
|
1152
|
+
) }),
|
|
1153
|
+
/* @__PURE__ */ jsx(
|
|
1154
|
+
Button,
|
|
1155
|
+
{
|
|
1156
|
+
type: "submit",
|
|
1157
|
+
variant: "primary",
|
|
1158
|
+
size: "lg",
|
|
1159
|
+
disabled: isLoading || !isValid,
|
|
1160
|
+
className: "ds-forgot__submit",
|
|
1161
|
+
children: isLoading ? /* @__PURE__ */ jsx("span", { className: "ds-forgot__spinner" }) : l.resetPasswordButton
|
|
1162
|
+
}
|
|
1163
|
+
)
|
|
1164
|
+
] }),
|
|
1165
|
+
/* @__PURE__ */ jsx("div", { className: "ds-forgot__footer", children: /* @__PURE__ */ jsxs(
|
|
1166
|
+
"button",
|
|
1167
|
+
{
|
|
1168
|
+
type: "button",
|
|
1169
|
+
className: "ds-forgot__back",
|
|
1170
|
+
onClick: onBackToLogin,
|
|
1171
|
+
disabled: isLoading,
|
|
1172
|
+
children: [
|
|
1173
|
+
/* @__PURE__ */ jsx(
|
|
1174
|
+
"svg",
|
|
1175
|
+
{
|
|
1176
|
+
width: "16",
|
|
1177
|
+
height: "16",
|
|
1178
|
+
viewBox: "0 0 16 16",
|
|
1179
|
+
fill: "none",
|
|
1180
|
+
stroke: "currentColor",
|
|
1181
|
+
strokeWidth: "1.5",
|
|
1182
|
+
strokeLinecap: "round",
|
|
1183
|
+
strokeLinejoin: "round",
|
|
1184
|
+
children: /* @__PURE__ */ jsx("path", { d: "M10 12L6 8L10 4" })
|
|
1185
|
+
}
|
|
1186
|
+
),
|
|
1187
|
+
l.backToLoginButton
|
|
1188
|
+
]
|
|
1189
|
+
}
|
|
1190
|
+
) })
|
|
1191
|
+
] })
|
|
1192
|
+
] });
|
|
1193
|
+
}
|
|
1194
|
+
return /* @__PURE__ */ jsxs("div", { className: clsx5("ds-forgot", className), children: [
|
|
1195
|
+
/* @__PURE__ */ jsx("div", { className: "ds-forgot__accent ds-forgot__accent--1", "aria-hidden": "true" }),
|
|
1196
|
+
/* @__PURE__ */ jsx("div", { className: "ds-forgot__accent ds-forgot__accent--2", "aria-hidden": "true" }),
|
|
1197
|
+
/* @__PURE__ */ jsxs("div", { className: "ds-forgot__card ds-forgot__card--centered", children: [
|
|
1198
|
+
/* @__PURE__ */ jsx("div", { className: "ds-forgot__success-icon ds-forgot__success-icon--check", children: /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 64 64", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
1199
|
+
/* @__PURE__ */ jsx("circle", { cx: "32", cy: "32", r: "30", stroke: "var(--status-success)", strokeWidth: "2" }),
|
|
1200
|
+
/* @__PURE__ */ jsx(
|
|
1201
|
+
"path",
|
|
1202
|
+
{
|
|
1203
|
+
d: "M20 32L28 40L44 24",
|
|
1204
|
+
stroke: "var(--status-success)",
|
|
1205
|
+
strokeWidth: "3",
|
|
1206
|
+
strokeLinecap: "round",
|
|
1207
|
+
strokeLinejoin: "round"
|
|
1208
|
+
}
|
|
1209
|
+
)
|
|
1210
|
+
] }) }),
|
|
1211
|
+
/* @__PURE__ */ jsx("h1", { className: "ds-forgot__title", children: l.passwordResetTitle }),
|
|
1212
|
+
/* @__PURE__ */ jsxs("p", { className: "ds-forgot__tagline", children: [
|
|
1213
|
+
l.passwordSuccessfullyResetTagline,
|
|
1214
|
+
/* @__PURE__ */ jsx("br", {}),
|
|
1215
|
+
l.clickBelowLogInHint
|
|
1216
|
+
] }),
|
|
1217
|
+
/* @__PURE__ */ jsx(Button, { variant: "primary", size: "lg", onClick: onBackToLogin, className: "ds-forgot__submit", children: l.continueToLoginButton })
|
|
1218
|
+
] })
|
|
1219
|
+
] });
|
|
1220
|
+
};
|
|
1221
|
+
ForgotPassword.displayName = "ForgotPassword";
|
|
1222
|
+
var defaultLabels = {
|
|
1223
|
+
changeEmailTitle: "Change Email",
|
|
1224
|
+
changeEmailTagline: "Enter you new email and the current password.",
|
|
1225
|
+
newEmailLabel: "New Email",
|
|
1226
|
+
newEmailPlaceholder: "",
|
|
1227
|
+
currentPasswordLabel: "Current Password",
|
|
1228
|
+
currentPasswordPlaceholder: "",
|
|
1229
|
+
forgotPasswordButton: "Forgot password?",
|
|
1230
|
+
continueButton: "Continue",
|
|
1231
|
+
backToLoginButton: "Back to login",
|
|
1232
|
+
showPasswordLabel: "Show password",
|
|
1233
|
+
hidePasswordLabel: "Hide password",
|
|
1234
|
+
successTitle: "Email updated",
|
|
1235
|
+
successTagline: "Your email address has been successfully changed.",
|
|
1236
|
+
continueToLoginButton: "Continue to login"
|
|
1237
|
+
};
|
|
1238
|
+
var EyeOpen = () => /* @__PURE__ */ jsxs("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
1239
|
+
/* @__PURE__ */ jsx("path", { d: "M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z" }),
|
|
1240
|
+
/* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "3" })
|
|
1241
|
+
] });
|
|
1242
|
+
var EyeOff = () => /* @__PURE__ */ jsxs("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
1243
|
+
/* @__PURE__ */ jsx("path", { d: "M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24" }),
|
|
1244
|
+
/* @__PURE__ */ jsx("line", { x1: "1", y1: "1", x2: "23", y2: "23" })
|
|
1245
|
+
] });
|
|
1246
|
+
var ChangeEmail = ({
|
|
1247
|
+
logo,
|
|
1248
|
+
labels: customLabels,
|
|
1249
|
+
onSubmit,
|
|
1250
|
+
onForgotPassword,
|
|
1251
|
+
onBackToLogin,
|
|
1252
|
+
isLoading = false,
|
|
1253
|
+
error,
|
|
1254
|
+
step = "form",
|
|
1255
|
+
className
|
|
1256
|
+
}) => {
|
|
1257
|
+
const l = { ...defaultLabels, ...customLabels };
|
|
1258
|
+
const [email, setEmail] = useState("");
|
|
1259
|
+
const [password, setPassword] = useState("");
|
|
1260
|
+
const [showPassword, setShowPassword] = useState(false);
|
|
1261
|
+
const renderLogo = () => logo ? /* @__PURE__ */ jsx("div", { className: "ds-change-email__logo", children: logo }) : /* @__PURE__ */ jsx("div", { className: "ds-change-email__logo" });
|
|
1262
|
+
const handleSubmit = (e) => {
|
|
1263
|
+
e.preventDefault();
|
|
1264
|
+
onSubmit?.({ email, password });
|
|
1265
|
+
};
|
|
1266
|
+
if (step === "success") {
|
|
1267
|
+
return /* @__PURE__ */ jsx("div", { className: clsx5("ds-change-email", className), children: /* @__PURE__ */ jsxs("div", { className: "ds-change-email__container", children: [
|
|
1268
|
+
/* @__PURE__ */ jsx("div", { className: "ds-change-email__accent ds-change-email__accent--1", "aria-hidden": "true" }),
|
|
1269
|
+
/* @__PURE__ */ jsx("div", { className: "ds-change-email__accent ds-change-email__accent--2", "aria-hidden": "true" }),
|
|
1270
|
+
/* @__PURE__ */ jsxs("div", { className: "ds-change-email__card", children: [
|
|
1271
|
+
/* @__PURE__ */ jsxs("div", { className: "ds-change-email__header", children: [
|
|
1272
|
+
renderLogo(),
|
|
1273
|
+
/* @__PURE__ */ jsx("h1", { className: "ds-change-email__title", children: l.successTitle }),
|
|
1274
|
+
/* @__PURE__ */ jsx("p", { className: "ds-change-email__tagline", children: l.successTagline })
|
|
1275
|
+
] }),
|
|
1276
|
+
/* @__PURE__ */ jsx(Button, { variant: "primary", size: "lg", onClick: onBackToLogin, className: "ds-change-email__submit", children: l.continueToLoginButton })
|
|
1277
|
+
] })
|
|
1278
|
+
] }) });
|
|
1279
|
+
}
|
|
1280
|
+
return /* @__PURE__ */ jsx("div", { className: clsx5("ds-change-email", className), children: /* @__PURE__ */ jsxs("div", { className: "ds-change-email__container", children: [
|
|
1281
|
+
/* @__PURE__ */ jsx("div", { className: "ds-change-email__accent ds-change-email__accent--1", "aria-hidden": "true" }),
|
|
1282
|
+
/* @__PURE__ */ jsx("div", { className: "ds-change-email__accent ds-change-email__accent--2", "aria-hidden": "true" }),
|
|
1283
|
+
/* @__PURE__ */ jsxs("div", { className: "ds-change-email__card", children: [
|
|
1284
|
+
/* @__PURE__ */ jsxs("div", { className: "ds-change-email__header", children: [
|
|
1285
|
+
renderLogo(),
|
|
1286
|
+
/* @__PURE__ */ jsx("h1", { className: "ds-change-email__title", children: l.changeEmailTitle }),
|
|
1287
|
+
/* @__PURE__ */ jsx("p", { className: "ds-change-email__tagline", children: l.changeEmailTagline })
|
|
1288
|
+
] }),
|
|
1289
|
+
error && /* @__PURE__ */ jsxs("div", { className: "ds-change-email__error", children: [
|
|
1290
|
+
/* @__PURE__ */ jsxs("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
1291
|
+
/* @__PURE__ */ jsx("circle", { cx: "8", cy: "8", r: "7", stroke: "currentColor", strokeWidth: "1.5" }),
|
|
1292
|
+
/* @__PURE__ */ jsx("path", { d: "M8 4.5V8.5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" }),
|
|
1293
|
+
/* @__PURE__ */ jsx("circle", { cx: "8", cy: "11", r: "0.75", fill: "currentColor" })
|
|
1294
|
+
] }),
|
|
1295
|
+
/* @__PURE__ */ jsx("span", { children: error })
|
|
1296
|
+
] }),
|
|
1297
|
+
/* @__PURE__ */ jsxs("form", { className: "ds-change-email__form", onSubmit: handleSubmit, children: [
|
|
1298
|
+
/* @__PURE__ */ jsx("div", { className: "ds-change-email__field", children: /* @__PURE__ */ jsx(
|
|
1299
|
+
TextField,
|
|
1300
|
+
{
|
|
1301
|
+
label: l.newEmailLabel,
|
|
1302
|
+
type: "email",
|
|
1303
|
+
placeholder: l.newEmailPlaceholder,
|
|
1304
|
+
value: email,
|
|
1305
|
+
onChange: (e) => setEmail(e.target.value),
|
|
1306
|
+
disabled: isLoading,
|
|
1307
|
+
autoComplete: "email"
|
|
1308
|
+
}
|
|
1309
|
+
) }),
|
|
1310
|
+
/* @__PURE__ */ jsx("div", { className: "ds-change-email__field", children: /* @__PURE__ */ jsx(
|
|
1311
|
+
TextField,
|
|
1312
|
+
{
|
|
1313
|
+
label: l.currentPasswordLabel,
|
|
1314
|
+
type: showPassword ? "text" : "password",
|
|
1315
|
+
placeholder: l.currentPasswordPlaceholder,
|
|
1316
|
+
value: password,
|
|
1317
|
+
onChange: (e) => setPassword(e.target.value),
|
|
1318
|
+
disabled: isLoading,
|
|
1319
|
+
autoComplete: "current-password",
|
|
1320
|
+
endAdornment: /* @__PURE__ */ jsx(
|
|
1321
|
+
"button",
|
|
1322
|
+
{
|
|
1323
|
+
type: "button",
|
|
1324
|
+
className: "ds-change-email__password-toggle",
|
|
1325
|
+
onClick: () => setShowPassword(!showPassword),
|
|
1326
|
+
"aria-label": showPassword ? l.hidePasswordLabel : l.showPasswordLabel,
|
|
1327
|
+
children: showPassword ? /* @__PURE__ */ jsx(EyeOff, {}) : /* @__PURE__ */ jsx(EyeOpen, {})
|
|
1328
|
+
}
|
|
1329
|
+
)
|
|
1330
|
+
}
|
|
1331
|
+
) }),
|
|
1332
|
+
/* @__PURE__ */ jsx(
|
|
1333
|
+
"div",
|
|
1334
|
+
{
|
|
1335
|
+
className: "ds-change-email__options",
|
|
1336
|
+
style: { display: "flex", justifyContent: "flex-end", marginTop: -8 },
|
|
1337
|
+
children: /* @__PURE__ */ jsx(
|
|
1338
|
+
"button",
|
|
1339
|
+
{
|
|
1340
|
+
type: "button",
|
|
1341
|
+
className: "ds-change-email__link",
|
|
1342
|
+
onClick: onForgotPassword,
|
|
1343
|
+
disabled: isLoading,
|
|
1344
|
+
children: l.forgotPasswordButton
|
|
1345
|
+
}
|
|
1346
|
+
)
|
|
1347
|
+
}
|
|
1348
|
+
),
|
|
1349
|
+
/* @__PURE__ */ jsx("div", { style: { marginTop: 24 }, children: /* @__PURE__ */ jsx(
|
|
1350
|
+
Button,
|
|
1351
|
+
{
|
|
1352
|
+
type: "submit",
|
|
1353
|
+
variant: "primary",
|
|
1354
|
+
size: "lg",
|
|
1355
|
+
disabled: isLoading || !email || !password,
|
|
1356
|
+
className: "ds-change-email__submit",
|
|
1357
|
+
children: isLoading ? /* @__PURE__ */ jsx("span", { className: "ds-change-email__spinner" }) : l.continueButton
|
|
1358
|
+
}
|
|
1359
|
+
) })
|
|
1360
|
+
] })
|
|
1361
|
+
] })
|
|
1362
|
+
] }) });
|
|
1363
|
+
};
|
|
1364
|
+
ChangeEmail.displayName = "ChangeEmail";
|
|
1365
|
+
|
|
1366
|
+
export { Button, ChangeEmail, Checkbox, ForgotPassword, Login, Signup, TextField };
|
|
1367
|
+
//# sourceMappingURL=out.js.map
|
|
1368
|
+
//# sourceMappingURL=chunk-AI2YEYT4.js.map
|