anima-ds-nucleus 1.0.21 → 1.0.23
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/anima-ds-nucleus.css +1 -1
- package/dist/anima-ds.cjs.js +94 -85
- package/dist/anima-ds.esm.js +5721 -5435
- package/package.json +1 -1
- package/src/components/DataDisplay/Card/CardError.jsx +0 -1
- package/src/components/DataDisplay/Card/CardVacia.jsx +0 -1
- package/src/components/Inputs/PasswordInput/PasswordInput.jsx +3 -9
- package/src/components/Layout/Header/HeaderCore.jsx +4 -4
- package/src/components/Layout/SaludoConFechaDashboard/SaludoConFechaDashboard.jsx +1 -1
- package/src/components/Layout/Sidebar/SidebarCore.jsx +1 -1
- package/src/components/Views/ForgotPassword/ForgotPassword.jsx +5 -3
- package/src/components/Views/LoginForm/LoginForm.jsx +36 -53
- package/src/components/Views/LoginForm/LoginForm.stories.jsx +36 -0
- package/src/components/Views/NewPassword/NewPassword.jsx +389 -0
- package/src/components/Views/NewPassword/NewPassword.stories.jsx +291 -0
- package/src/index.js +1 -0
- package/src/style.css +106 -0
|
@@ -0,0 +1,389 @@
|
|
|
1
|
+
import { useTranslation } from 'react-i18next';
|
|
2
|
+
import { PasswordInput } from '../../Inputs/PasswordInput/PasswordInput';
|
|
3
|
+
import { Button } from '../../Atoms/Button/Button';
|
|
4
|
+
import { Typography } from '../../Atoms/Typography/Typography';
|
|
5
|
+
|
|
6
|
+
export const NewPassword = ({
|
|
7
|
+
variant = 'default',
|
|
8
|
+
layout = 'embedded',
|
|
9
|
+
// Título y subtítulo
|
|
10
|
+
title,
|
|
11
|
+
subtitle,
|
|
12
|
+
// Password field
|
|
13
|
+
passwordLabel,
|
|
14
|
+
passwordPlaceholder,
|
|
15
|
+
passwordValue,
|
|
16
|
+
onPasswordChange,
|
|
17
|
+
passwordError,
|
|
18
|
+
// Confirm field
|
|
19
|
+
confirmPasswordLabel,
|
|
20
|
+
confirmPasswordPlaceholder,
|
|
21
|
+
confirmPasswordValue,
|
|
22
|
+
onConfirmPasswordChange,
|
|
23
|
+
confirmPasswordError,
|
|
24
|
+
// Requirements box
|
|
25
|
+
requirementsTitle,
|
|
26
|
+
requirementsItems = [],
|
|
27
|
+
requirementsPrefix,
|
|
28
|
+
showRequirements = true,
|
|
29
|
+
// General error
|
|
30
|
+
generalError,
|
|
31
|
+
// Actions
|
|
32
|
+
cancelLabel,
|
|
33
|
+
submitLabel,
|
|
34
|
+
onCancel,
|
|
35
|
+
onSubmit,
|
|
36
|
+
disabled = false,
|
|
37
|
+
submitting = false,
|
|
38
|
+
// Success
|
|
39
|
+
success = false,
|
|
40
|
+
successTitle,
|
|
41
|
+
successMessage,
|
|
42
|
+
successExtra,
|
|
43
|
+
className = '',
|
|
44
|
+
...props
|
|
45
|
+
}) => {
|
|
46
|
+
const { t } = useTranslation();
|
|
47
|
+
const isHexaLogin = variant === 'hexa-login';
|
|
48
|
+
const isPageLayout = layout === 'page';
|
|
49
|
+
|
|
50
|
+
const handleSubmit = (e) => {
|
|
51
|
+
e.preventDefault();
|
|
52
|
+
if (onSubmit && !disabled && !submitting) {
|
|
53
|
+
onSubmit({
|
|
54
|
+
password: passwordValue,
|
|
55
|
+
confirmPassword: confirmPasswordValue,
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
// Si está en modo success, mostrar solo el mensaje de éxito
|
|
61
|
+
if (success) {
|
|
62
|
+
return (
|
|
63
|
+
<div
|
|
64
|
+
className={`${isPageLayout ? 'min-h-screen flex flex-col' : ''} ${className}`}
|
|
65
|
+
style={isPageLayout ? { backgroundColor: '#f5f5f5' } : undefined}
|
|
66
|
+
{...props}
|
|
67
|
+
>
|
|
68
|
+
<div className={isPageLayout ? 'flex-1 flex items-center justify-center p-4' : 'p-4'}>
|
|
69
|
+
<div className="w-full max-w-md">
|
|
70
|
+
{/* Título y subtítulo */}
|
|
71
|
+
{(title || subtitle) && (
|
|
72
|
+
<div className="mb-8 text-center">
|
|
73
|
+
{title && (
|
|
74
|
+
<Typography
|
|
75
|
+
variant="h3"
|
|
76
|
+
className="mb-2 font-semibold"
|
|
77
|
+
style={
|
|
78
|
+
isHexaLogin
|
|
79
|
+
? {
|
|
80
|
+
color: '#2D5C63',
|
|
81
|
+
fontFamily: 'inherit',
|
|
82
|
+
fontWeight: 400,
|
|
83
|
+
fontStyle: 'normal',
|
|
84
|
+
fontSize: '32px',
|
|
85
|
+
lineHeight: '48px',
|
|
86
|
+
letterSpacing: '0px',
|
|
87
|
+
textAlign: 'center',
|
|
88
|
+
}
|
|
89
|
+
: undefined
|
|
90
|
+
}
|
|
91
|
+
>
|
|
92
|
+
{title}
|
|
93
|
+
</Typography>
|
|
94
|
+
)}
|
|
95
|
+
{subtitle && (
|
|
96
|
+
<Typography
|
|
97
|
+
variant="body2"
|
|
98
|
+
className="text-gray-600"
|
|
99
|
+
style={
|
|
100
|
+
isHexaLogin
|
|
101
|
+
? {
|
|
102
|
+
fontFamily: 'inherit',
|
|
103
|
+
fontWeight: 400,
|
|
104
|
+
fontStyle: 'normal',
|
|
105
|
+
fontSize: '16px',
|
|
106
|
+
lineHeight: '24px',
|
|
107
|
+
letterSpacing: '0px',
|
|
108
|
+
textAlign: 'center',
|
|
109
|
+
}
|
|
110
|
+
: undefined
|
|
111
|
+
}
|
|
112
|
+
>
|
|
113
|
+
{subtitle}
|
|
114
|
+
</Typography>
|
|
115
|
+
)}
|
|
116
|
+
</div>
|
|
117
|
+
)}
|
|
118
|
+
|
|
119
|
+
{/* Card blanca */}
|
|
120
|
+
<div className="bg-white border border-gray-200 rounded-lg p-6 shadow-md">
|
|
121
|
+
{/* Success box */}
|
|
122
|
+
<div
|
|
123
|
+
className="rounded-lg p-4 border"
|
|
124
|
+
style={{
|
|
125
|
+
backgroundColor: '#d1fae5',
|
|
126
|
+
borderColor: '#10b981',
|
|
127
|
+
}}
|
|
128
|
+
>
|
|
129
|
+
{successTitle && (
|
|
130
|
+
<Typography
|
|
131
|
+
variant="body2"
|
|
132
|
+
className="font-medium"
|
|
133
|
+
style={{ color: '#065f46' }}
|
|
134
|
+
>
|
|
135
|
+
{successTitle}
|
|
136
|
+
</Typography>
|
|
137
|
+
)}
|
|
138
|
+
{successMessage && (
|
|
139
|
+
<Typography
|
|
140
|
+
variant="body2"
|
|
141
|
+
className={successTitle ? 'mt-2' : ''}
|
|
142
|
+
style={{ color: '#047857', fontSize: '14px' }}
|
|
143
|
+
>
|
|
144
|
+
{successMessage}
|
|
145
|
+
</Typography>
|
|
146
|
+
)}
|
|
147
|
+
{successExtra && <div className="mt-4">{successExtra}</div>}
|
|
148
|
+
</div>
|
|
149
|
+
</div>
|
|
150
|
+
</div>
|
|
151
|
+
</div>
|
|
152
|
+
</div>
|
|
153
|
+
);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
return (
|
|
157
|
+
<div
|
|
158
|
+
className={`${isPageLayout ? 'min-h-screen flex flex-col' : ''} ${className}`}
|
|
159
|
+
style={isPageLayout ? { backgroundColor: '#f5f5f5' } : undefined}
|
|
160
|
+
{...props}
|
|
161
|
+
>
|
|
162
|
+
<div className={isPageLayout ? 'flex-1 flex items-center justify-center p-4' : 'p-4'}>
|
|
163
|
+
<div className="w-full max-w-md">
|
|
164
|
+
{/* Título y subtítulo */}
|
|
165
|
+
{(title || subtitle) && (
|
|
166
|
+
<div className="mb-8 text-center">
|
|
167
|
+
{title && (
|
|
168
|
+
<Typography
|
|
169
|
+
variant="h3"
|
|
170
|
+
className="mb-2 font-semibold"
|
|
171
|
+
style={
|
|
172
|
+
isHexaLogin
|
|
173
|
+
? {
|
|
174
|
+
color: '#2D5C63',
|
|
175
|
+
fontFamily: 'inherit',
|
|
176
|
+
fontWeight: 400,
|
|
177
|
+
fontStyle: 'normal',
|
|
178
|
+
fontSize: '32px',
|
|
179
|
+
lineHeight: '48px',
|
|
180
|
+
letterSpacing: '0px',
|
|
181
|
+
textAlign: 'center',
|
|
182
|
+
}
|
|
183
|
+
: undefined
|
|
184
|
+
}
|
|
185
|
+
>
|
|
186
|
+
{title}
|
|
187
|
+
</Typography>
|
|
188
|
+
)}
|
|
189
|
+
{subtitle && (
|
|
190
|
+
<Typography
|
|
191
|
+
variant="body2"
|
|
192
|
+
className="text-gray-600"
|
|
193
|
+
style={
|
|
194
|
+
isHexaLogin
|
|
195
|
+
? {
|
|
196
|
+
fontFamily: 'inherit',
|
|
197
|
+
fontWeight: 400,
|
|
198
|
+
fontStyle: 'normal',
|
|
199
|
+
fontSize: '16px',
|
|
200
|
+
lineHeight: '24px',
|
|
201
|
+
letterSpacing: '0px',
|
|
202
|
+
textAlign: 'center',
|
|
203
|
+
}
|
|
204
|
+
: undefined
|
|
205
|
+
}
|
|
206
|
+
>
|
|
207
|
+
{subtitle}
|
|
208
|
+
</Typography>
|
|
209
|
+
)}
|
|
210
|
+
</div>
|
|
211
|
+
)}
|
|
212
|
+
|
|
213
|
+
{/* Card blanca */}
|
|
214
|
+
<div className="bg-white border border-gray-200 rounded-lg p-6 shadow-md">
|
|
215
|
+
<form onSubmit={handleSubmit} className="space-y-4">
|
|
216
|
+
{/* Password field */}
|
|
217
|
+
<div>
|
|
218
|
+
<PasswordInput
|
|
219
|
+
variant={isHexaLogin ? 'hexa-login' : undefined}
|
|
220
|
+
label={passwordLabel}
|
|
221
|
+
labelClassName={isHexaLogin ? 'block mb-2 font-medium text-sm' : undefined}
|
|
222
|
+
labelStyle={isHexaLogin ? { color: '#2D5C63' } : undefined}
|
|
223
|
+
placeholder={passwordPlaceholder}
|
|
224
|
+
value={passwordValue || ''}
|
|
225
|
+
onChange={onPasswordChange}
|
|
226
|
+
error={passwordError}
|
|
227
|
+
inputClassName={
|
|
228
|
+
isHexaLogin
|
|
229
|
+
? 'w-full px-3 py-2 border rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent text-sm text-gray-900 anima-passwordfield__input'
|
|
230
|
+
: undefined
|
|
231
|
+
}
|
|
232
|
+
style={
|
|
233
|
+
isHexaLogin
|
|
234
|
+
? {
|
|
235
|
+
borderColor: passwordError ? '#ef4444' : '#2D5C63',
|
|
236
|
+
borderWidth: '1px',
|
|
237
|
+
borderStyle: 'solid',
|
|
238
|
+
}
|
|
239
|
+
: undefined
|
|
240
|
+
}
|
|
241
|
+
/>
|
|
242
|
+
</div>
|
|
243
|
+
|
|
244
|
+
{/* Confirm password field */}
|
|
245
|
+
<div>
|
|
246
|
+
<PasswordInput
|
|
247
|
+
variant={isHexaLogin ? 'hexa-login' : undefined}
|
|
248
|
+
label={confirmPasswordLabel}
|
|
249
|
+
labelClassName={isHexaLogin ? 'block mb-2 font-medium text-sm' : undefined}
|
|
250
|
+
labelStyle={isHexaLogin ? { color: '#2D5C63' } : undefined}
|
|
251
|
+
placeholder={confirmPasswordPlaceholder}
|
|
252
|
+
value={confirmPasswordValue || ''}
|
|
253
|
+
onChange={onConfirmPasswordChange}
|
|
254
|
+
error={confirmPasswordError}
|
|
255
|
+
inputClassName={
|
|
256
|
+
isHexaLogin
|
|
257
|
+
? 'w-full px-3 py-2 border rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent text-sm text-gray-900 anima-passwordfield__input'
|
|
258
|
+
: undefined
|
|
259
|
+
}
|
|
260
|
+
style={
|
|
261
|
+
isHexaLogin
|
|
262
|
+
? {
|
|
263
|
+
borderColor: confirmPasswordError ? '#ef4444' : '#2D5C63',
|
|
264
|
+
borderWidth: '1px',
|
|
265
|
+
borderStyle: 'solid',
|
|
266
|
+
}
|
|
267
|
+
: undefined
|
|
268
|
+
}
|
|
269
|
+
/>
|
|
270
|
+
</div>
|
|
271
|
+
|
|
272
|
+
{/* Requirements box */}
|
|
273
|
+
{showRequirements && requirementsItems.length > 0 && (
|
|
274
|
+
<div
|
|
275
|
+
className="rounded-lg p-4 border"
|
|
276
|
+
style={{
|
|
277
|
+
background: '#f5f3ff',
|
|
278
|
+
borderColor: '#a78bfa',
|
|
279
|
+
color: '#0c4a6e',
|
|
280
|
+
fontFamily: "'IBM Plex Mono', monospace",
|
|
281
|
+
}}
|
|
282
|
+
>
|
|
283
|
+
<Typography
|
|
284
|
+
variant="body2"
|
|
285
|
+
className="text-sm"
|
|
286
|
+
style={{
|
|
287
|
+
color: '#0c4a6e',
|
|
288
|
+
fontFamily: "'IBM Plex Mono', monospace",
|
|
289
|
+
whiteSpace: 'pre-line',
|
|
290
|
+
}}
|
|
291
|
+
>
|
|
292
|
+
{requirementsTitle || (() => {
|
|
293
|
+
const prefix = requirementsPrefix || t('form.passwordRequirementsPrefix') || 'Recuerda que la contraseña debe tener:';
|
|
294
|
+
const defaultItems = requirementsItems.length > 0 ? requirementsItems : [
|
|
295
|
+
t('form.passwordRequirementMinChars') || 'Un mínimo de 6 caracteres',
|
|
296
|
+
t('form.passwordRequirementOther') || 'Una mayúscula, un número, un carácter especial',
|
|
297
|
+
];
|
|
298
|
+
|
|
299
|
+
return `${prefix}\n${defaultItems[0]}\n\n${defaultItems.slice(1).join(', ')}`;
|
|
300
|
+
})()}
|
|
301
|
+
</Typography>
|
|
302
|
+
</div>
|
|
303
|
+
)}
|
|
304
|
+
|
|
305
|
+
{/* General error */}
|
|
306
|
+
{generalError && (
|
|
307
|
+
<div
|
|
308
|
+
className="rounded-lg p-4 border"
|
|
309
|
+
style={{
|
|
310
|
+
backgroundColor: '#fecaca',
|
|
311
|
+
borderColor: '#ef4444',
|
|
312
|
+
}}
|
|
313
|
+
>
|
|
314
|
+
<Typography
|
|
315
|
+
variant="body2"
|
|
316
|
+
className="font-bold"
|
|
317
|
+
style={{ color: '#b91c1c' }}
|
|
318
|
+
>
|
|
319
|
+
{generalError}
|
|
320
|
+
</Typography>
|
|
321
|
+
</div>
|
|
322
|
+
)}
|
|
323
|
+
|
|
324
|
+
{/* Botonera 2 columnas */}
|
|
325
|
+
<div className="flex gap-4 pt-4">
|
|
326
|
+
{onCancel && (
|
|
327
|
+
<Button
|
|
328
|
+
type="button"
|
|
329
|
+
tipo="Secondary"
|
|
330
|
+
color="Teal"
|
|
331
|
+
tamaño="Default"
|
|
332
|
+
className="flex-1"
|
|
333
|
+
onClick={onCancel}
|
|
334
|
+
disabled={disabled || submitting}
|
|
335
|
+
>
|
|
336
|
+
<span
|
|
337
|
+
style={
|
|
338
|
+
isHexaLogin
|
|
339
|
+
? {
|
|
340
|
+
fontFamily: "'IBM Plex Sans', sans-serif",
|
|
341
|
+
fontWeight: 400,
|
|
342
|
+
fontStyle: 'normal',
|
|
343
|
+
fontSize: '16px',
|
|
344
|
+
lineHeight: '24px',
|
|
345
|
+
letterSpacing: '0%',
|
|
346
|
+
}
|
|
347
|
+
: undefined
|
|
348
|
+
}
|
|
349
|
+
>
|
|
350
|
+
{cancelLabel || 'Cancelar'}
|
|
351
|
+
</span>
|
|
352
|
+
</Button>
|
|
353
|
+
)}
|
|
354
|
+
<Button
|
|
355
|
+
type="submit"
|
|
356
|
+
tipo="Primary"
|
|
357
|
+
color="Teal"
|
|
358
|
+
tamaño="Default"
|
|
359
|
+
className={onCancel ? 'flex-1' : 'w-full'}
|
|
360
|
+
disabled={disabled || submitting}
|
|
361
|
+
>
|
|
362
|
+
<span
|
|
363
|
+
style={
|
|
364
|
+
isHexaLogin
|
|
365
|
+
? {
|
|
366
|
+
fontFamily: "'IBM Plex Sans', sans-serif",
|
|
367
|
+
fontWeight: 400,
|
|
368
|
+
fontStyle: 'normal',
|
|
369
|
+
fontSize: '16px',
|
|
370
|
+
lineHeight: '24px',
|
|
371
|
+
letterSpacing: '0%',
|
|
372
|
+
}
|
|
373
|
+
: undefined
|
|
374
|
+
}
|
|
375
|
+
>
|
|
376
|
+
{submitting ? 'Guardando...' : submitLabel || 'Guardar'}
|
|
377
|
+
</span>
|
|
378
|
+
</Button>
|
|
379
|
+
</div>
|
|
380
|
+
</form>
|
|
381
|
+
</div>
|
|
382
|
+
</div>
|
|
383
|
+
</div>
|
|
384
|
+
</div>
|
|
385
|
+
);
|
|
386
|
+
};
|
|
387
|
+
|
|
388
|
+
export default NewPassword;
|
|
389
|
+
|
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
import { NewPassword } from './NewPassword';
|
|
3
|
+
import { I18nProvider } from '../../../providers/I18nProvider';
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
title: 'Views/NewPassword',
|
|
7
|
+
component: NewPassword,
|
|
8
|
+
tags: ['autodocs'],
|
|
9
|
+
decorators: [
|
|
10
|
+
(Story) => (
|
|
11
|
+
<I18nProvider language="es-AR">
|
|
12
|
+
<Story />
|
|
13
|
+
</I18nProvider>
|
|
14
|
+
),
|
|
15
|
+
],
|
|
16
|
+
argTypes: {
|
|
17
|
+
variant: {
|
|
18
|
+
control: 'select',
|
|
19
|
+
options: ['default', 'hexa-login'],
|
|
20
|
+
description: 'Variante del componente',
|
|
21
|
+
},
|
|
22
|
+
layout: {
|
|
23
|
+
control: 'select',
|
|
24
|
+
options: ['embedded', 'page'],
|
|
25
|
+
description: 'Layout del componente',
|
|
26
|
+
},
|
|
27
|
+
disabled: {
|
|
28
|
+
control: 'boolean',
|
|
29
|
+
description: 'Deshabilitar el formulario',
|
|
30
|
+
},
|
|
31
|
+
submitting: {
|
|
32
|
+
control: 'boolean',
|
|
33
|
+
description: 'Estado de envío',
|
|
34
|
+
},
|
|
35
|
+
success: {
|
|
36
|
+
control: 'boolean',
|
|
37
|
+
description: 'Mostrar estado de éxito',
|
|
38
|
+
},
|
|
39
|
+
showRequirements: {
|
|
40
|
+
control: 'boolean',
|
|
41
|
+
description: 'Mostrar caja de requisitos',
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
// Default (form)
|
|
47
|
+
export const Default = {
|
|
48
|
+
render: () => {
|
|
49
|
+
const [password, setPassword] = useState('');
|
|
50
|
+
const [confirmPassword, setConfirmPassword] = useState('');
|
|
51
|
+
const [passwordError, setPasswordError] = useState('');
|
|
52
|
+
const [confirmPasswordError, setConfirmPasswordError] = useState('');
|
|
53
|
+
|
|
54
|
+
return (
|
|
55
|
+
<NewPassword
|
|
56
|
+
title="Nueva contraseña"
|
|
57
|
+
subtitle="Ingresa tu nueva contraseña y confírmala"
|
|
58
|
+
passwordLabel="Contraseña"
|
|
59
|
+
passwordPlaceholder="Ingresa tu contraseña"
|
|
60
|
+
passwordValue={password}
|
|
61
|
+
onPasswordChange={(e) => {
|
|
62
|
+
setPassword(e.target.value);
|
|
63
|
+
setPasswordError('');
|
|
64
|
+
}}
|
|
65
|
+
passwordError={passwordError}
|
|
66
|
+
confirmPasswordLabel="Confirmar contraseña"
|
|
67
|
+
confirmPasswordPlaceholder="Confirma tu contraseña"
|
|
68
|
+
confirmPasswordValue={confirmPassword}
|
|
69
|
+
onConfirmPasswordChange={(e) => {
|
|
70
|
+
setConfirmPassword(e.target.value);
|
|
71
|
+
setConfirmPasswordError('');
|
|
72
|
+
}}
|
|
73
|
+
confirmPasswordError={confirmPasswordError}
|
|
74
|
+
requirementsItems={[
|
|
75
|
+
'Un mínimo de 6 caracteres',
|
|
76
|
+
'Una mayúscula, un número, un carácter especial',
|
|
77
|
+
]}
|
|
78
|
+
cancelLabel="Cancelar"
|
|
79
|
+
submitLabel="Guardar"
|
|
80
|
+
onCancel={() => {
|
|
81
|
+
console.log('Cancel clicked');
|
|
82
|
+
alert('Cancelar');
|
|
83
|
+
}}
|
|
84
|
+
onSubmit={(data) => {
|
|
85
|
+
console.log('Submit data:', data);
|
|
86
|
+
if (data.password !== data.confirmPassword) {
|
|
87
|
+
setConfirmPasswordError('Las contraseñas no coinciden');
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
if (data.password.length < 8) {
|
|
91
|
+
setPasswordError('La contraseña debe tener al menos 8 caracteres');
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
alert('Contraseña guardada exitosamente');
|
|
95
|
+
}}
|
|
96
|
+
/>
|
|
97
|
+
);
|
|
98
|
+
},
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
// WithErrors
|
|
102
|
+
export const WithErrors = {
|
|
103
|
+
render: () => {
|
|
104
|
+
const [password, setPassword] = useState('test');
|
|
105
|
+
const [confirmPassword, setConfirmPassword] = useState('test2');
|
|
106
|
+
|
|
107
|
+
return (
|
|
108
|
+
<NewPassword
|
|
109
|
+
title="Nueva contraseña"
|
|
110
|
+
subtitle="Ingresa tu nueva contraseña y confírmala"
|
|
111
|
+
passwordLabel="Contraseña"
|
|
112
|
+
passwordPlaceholder="Ingresa tu contraseña"
|
|
113
|
+
passwordValue={password}
|
|
114
|
+
onPasswordChange={(e) => setPassword(e.target.value)}
|
|
115
|
+
passwordError="La contraseña debe tener al menos 8 caracteres"
|
|
116
|
+
confirmPasswordLabel="Confirmar contraseña"
|
|
117
|
+
confirmPasswordPlaceholder="Confirma tu contraseña"
|
|
118
|
+
confirmPasswordValue={confirmPassword}
|
|
119
|
+
onConfirmPasswordChange={(e) => setConfirmPassword(e.target.value)}
|
|
120
|
+
confirmPasswordError="Las contraseñas no coinciden"
|
|
121
|
+
requirementsItems={[
|
|
122
|
+
'Un mínimo de 6 caracteres',
|
|
123
|
+
'Una mayúscula, un número, un carácter especial',
|
|
124
|
+
]}
|
|
125
|
+
generalError="Error al guardar la contraseña. Por favor, intenta nuevamente."
|
|
126
|
+
cancelLabel="Cancelar"
|
|
127
|
+
submitLabel="Guardar"
|
|
128
|
+
onCancel={() => alert('Cancelar')}
|
|
129
|
+
onSubmit={(data) => {
|
|
130
|
+
console.log('Submit data:', data);
|
|
131
|
+
}}
|
|
132
|
+
/>
|
|
133
|
+
);
|
|
134
|
+
},
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
// Submitting
|
|
138
|
+
export const Submitting = {
|
|
139
|
+
args: {
|
|
140
|
+
title: 'Nueva contraseña',
|
|
141
|
+
subtitle: 'Ingresa tu nueva contraseña y confírmala',
|
|
142
|
+
passwordLabel: 'Contraseña',
|
|
143
|
+
passwordPlaceholder: 'Ingresa tu contraseña',
|
|
144
|
+
passwordValue: 'password123',
|
|
145
|
+
onPasswordChange: () => {},
|
|
146
|
+
confirmPasswordLabel: 'Confirmar contraseña',
|
|
147
|
+
confirmPasswordPlaceholder: 'Confirma tu contraseña',
|
|
148
|
+
confirmPasswordValue: 'password123',
|
|
149
|
+
onConfirmPasswordChange: () => {},
|
|
150
|
+
requirementsItems: [
|
|
151
|
+
'Un mínimo de 6 caracteres',
|
|
152
|
+
'Una mayúscula, un número, un carácter especial',
|
|
153
|
+
],
|
|
154
|
+
cancelLabel: 'Cancelar',
|
|
155
|
+
submitLabel: 'Guardar',
|
|
156
|
+
onCancel: () => alert('Cancelar'),
|
|
157
|
+
onSubmit: () => {},
|
|
158
|
+
submitting: true,
|
|
159
|
+
disabled: true,
|
|
160
|
+
},
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
// Success
|
|
164
|
+
export const Success = {
|
|
165
|
+
args: {
|
|
166
|
+
title: 'Nueva contraseña',
|
|
167
|
+
subtitle: 'Ingresa tu nueva contraseña y confírmala',
|
|
168
|
+
passwordLabel: 'Contraseña',
|
|
169
|
+
passwordPlaceholder: 'Ingresa tu contraseña',
|
|
170
|
+
confirmPasswordLabel: 'Confirmar contraseña',
|
|
171
|
+
confirmPasswordPlaceholder: 'Confirma tu contraseña',
|
|
172
|
+
cancelLabel: 'Cancelar',
|
|
173
|
+
submitLabel: 'Guardar',
|
|
174
|
+
onCancel: () => alert('Cancelar'),
|
|
175
|
+
onSubmit: () => {},
|
|
176
|
+
success: true,
|
|
177
|
+
successTitle: 'Contraseña actualizada',
|
|
178
|
+
successMessage: 'Tu contraseña ha sido actualizada exitosamente. Ya puedes iniciar sesión con tu nueva contraseña.',
|
|
179
|
+
},
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
// Variant hexa-login
|
|
183
|
+
export const HexaLogin = {
|
|
184
|
+
render: () => {
|
|
185
|
+
const [password, setPassword] = useState('');
|
|
186
|
+
const [confirmPassword, setConfirmPassword] = useState('');
|
|
187
|
+
|
|
188
|
+
return (
|
|
189
|
+
<NewPassword
|
|
190
|
+
variant="hexa-login"
|
|
191
|
+
title="Nueva contraseña"
|
|
192
|
+
subtitle="Ingresa tu nueva contraseña y confírmala"
|
|
193
|
+
passwordLabel="Contraseña"
|
|
194
|
+
passwordPlaceholder="Ingresa tu contraseña"
|
|
195
|
+
passwordValue={password}
|
|
196
|
+
onPasswordChange={(e) => setPassword(e.target.value)}
|
|
197
|
+
confirmPasswordLabel="Confirmar contraseña"
|
|
198
|
+
confirmPasswordPlaceholder="Confirma tu contraseña"
|
|
199
|
+
confirmPasswordValue={confirmPassword}
|
|
200
|
+
onConfirmPasswordChange={(e) => setConfirmPassword(e.target.value)}
|
|
201
|
+
requirementsItems={[
|
|
202
|
+
'Un mínimo de 6 caracteres',
|
|
203
|
+
'Una mayúscula, un número, un carácter especial',
|
|
204
|
+
]}
|
|
205
|
+
cancelLabel="Cancelar"
|
|
206
|
+
submitLabel="Guardar"
|
|
207
|
+
onCancel={() => alert('Cancelar')}
|
|
208
|
+
onSubmit={(data) => {
|
|
209
|
+
console.log('Submit data:', data);
|
|
210
|
+
alert('Contraseña guardada');
|
|
211
|
+
}}
|
|
212
|
+
/>
|
|
213
|
+
);
|
|
214
|
+
},
|
|
215
|
+
};
|
|
216
|
+
|
|
217
|
+
// Layout embedded vs page
|
|
218
|
+
export const LayoutEmbedded = {
|
|
219
|
+
args: {
|
|
220
|
+
variant: 'hexa-login',
|
|
221
|
+
layout: 'embedded',
|
|
222
|
+
title: 'Nueva contraseña',
|
|
223
|
+
subtitle: 'Ingresa tu nueva contraseña y confírmala',
|
|
224
|
+
passwordLabel: 'Contraseña',
|
|
225
|
+
passwordPlaceholder: 'Ingresa tu contraseña',
|
|
226
|
+
passwordValue: '',
|
|
227
|
+
onPasswordChange: () => {},
|
|
228
|
+
confirmPasswordLabel: 'Confirmar contraseña',
|
|
229
|
+
confirmPasswordPlaceholder: 'Confirma tu contraseña',
|
|
230
|
+
confirmPasswordValue: '',
|
|
231
|
+
onConfirmPasswordChange: () => {},
|
|
232
|
+
requirementsItems: [
|
|
233
|
+
'Un mínimo de 6 caracteres',
|
|
234
|
+
'Una mayúscula, un número, un carácter especial',
|
|
235
|
+
],
|
|
236
|
+
cancelLabel: 'Cancelar',
|
|
237
|
+
submitLabel: 'Guardar',
|
|
238
|
+
onCancel: () => alert('Cancelar'),
|
|
239
|
+
onSubmit: () => {},
|
|
240
|
+
},
|
|
241
|
+
};
|
|
242
|
+
|
|
243
|
+
export const LayoutPage = {
|
|
244
|
+
args: {
|
|
245
|
+
variant: 'hexa-login',
|
|
246
|
+
layout: 'page',
|
|
247
|
+
title: 'Nueva contraseña',
|
|
248
|
+
subtitle: 'Ingresa tu nueva contraseña y confírmala',
|
|
249
|
+
passwordLabel: 'Contraseña',
|
|
250
|
+
passwordPlaceholder: 'Ingresa tu contraseña',
|
|
251
|
+
passwordValue: '',
|
|
252
|
+
onPasswordChange: () => {},
|
|
253
|
+
confirmPasswordLabel: 'Confirmar contraseña',
|
|
254
|
+
confirmPasswordPlaceholder: 'Confirma tu contraseña',
|
|
255
|
+
confirmPasswordValue: '',
|
|
256
|
+
onConfirmPasswordChange: () => {},
|
|
257
|
+
requirementsItems: [
|
|
258
|
+
'Un mínimo de 6 caracteres',
|
|
259
|
+
'Una mayúscula, un número, un carácter especial',
|
|
260
|
+
],
|
|
261
|
+
cancelLabel: 'Cancelar',
|
|
262
|
+
submitLabel: 'Guardar',
|
|
263
|
+
onCancel: () => alert('Cancelar'),
|
|
264
|
+
onSubmit: () => {},
|
|
265
|
+
},
|
|
266
|
+
};
|
|
267
|
+
|
|
268
|
+
// Success con extra content
|
|
269
|
+
export const SuccessWithExtra = {
|
|
270
|
+
args: {
|
|
271
|
+
title: 'Nueva contraseña',
|
|
272
|
+
subtitle: 'Ingresa tu nueva contraseña y confírmala',
|
|
273
|
+
passwordLabel: 'Contraseña',
|
|
274
|
+
passwordPlaceholder: 'Ingresa tu contraseña',
|
|
275
|
+
confirmPasswordLabel: 'Confirmar contraseña',
|
|
276
|
+
confirmPasswordPlaceholder: 'Confirma tu contraseña',
|
|
277
|
+
cancelLabel: 'Cancelar',
|
|
278
|
+
submitLabel: 'Guardar',
|
|
279
|
+
onCancel: () => alert('Cancelar'),
|
|
280
|
+
onSubmit: () => {},
|
|
281
|
+
success: true,
|
|
282
|
+
successTitle: 'Contraseña actualizada',
|
|
283
|
+
successMessage: 'Tu contraseña ha sido actualizada exitosamente.',
|
|
284
|
+
successExtra: (
|
|
285
|
+
<div className="text-sm text-gray-600 mt-2">
|
|
286
|
+
Serás redirigido al login en <strong>5 segundos</strong>...
|
|
287
|
+
</div>
|
|
288
|
+
),
|
|
289
|
+
},
|
|
290
|
+
};
|
|
291
|
+
|
package/src/index.js
CHANGED
|
@@ -73,6 +73,7 @@ export { TagList } from './components/DataDisplay/TagList/TagList';
|
|
|
73
73
|
export { LoginForm } from './components/Views/LoginForm/LoginForm';
|
|
74
74
|
export { ChangePasswordForm } from './components/Views/ChangePasswordForm/ChangePasswordForm';
|
|
75
75
|
export { ForgotPassword } from './components/Views/ForgotPassword/ForgotPassword';
|
|
76
|
+
export { NewPassword } from './components/Views/NewPassword/NewPassword';
|
|
76
77
|
export { Chat } from './components/Views/Chat/Chat';
|
|
77
78
|
|
|
78
79
|
// Providers
|