anima-ds-nucleus 1.0.20 → 1.0.22
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 +92 -83
- package/dist/anima-ds.esm.js +5731 -5407
- package/package.json +1 -1
- package/src/components/Inputs/PasswordInput/PasswordInput.jsx +3 -9
- package/src/components/Layout/AccionesRapidas/AccionesRapidas.jsx +40 -0
- package/src/components/Layout/AccionesRapidas/AccionesRapidas.stories.jsx +11 -0
- 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 +2 -0
- package/src/style.css +106 -0
package/package.json
CHANGED
|
@@ -30,7 +30,7 @@ export const PasswordInput = ({
|
|
|
30
30
|
`.trim().replace(/\s+/g, ' ');
|
|
31
31
|
|
|
32
32
|
return (
|
|
33
|
-
<div className={`w-full ${className}`}>
|
|
33
|
+
<div className={`anima-passwordfield w-full ${className}`}>
|
|
34
34
|
{label && (
|
|
35
35
|
<label
|
|
36
36
|
className={labelClassName || 'block text-sm font-medium text-gray-700 mb-1'}
|
|
@@ -48,7 +48,7 @@ export const PasswordInput = ({
|
|
|
48
48
|
disabled={disabled}
|
|
49
49
|
value={value}
|
|
50
50
|
onChange={onChange}
|
|
51
|
-
className={resolvedInputClasses}
|
|
51
|
+
className={`${resolvedInputClasses} ${isHexaLogin ? 'anima-passwordfield__input' : ''}`}
|
|
52
52
|
{...props}
|
|
53
53
|
/>
|
|
54
54
|
|
|
@@ -56,13 +56,7 @@ export const PasswordInput = ({
|
|
|
56
56
|
type="button"
|
|
57
57
|
tabIndex={-1}
|
|
58
58
|
onClick={() => setShowPassword((prev) => !prev)}
|
|
59
|
-
className="
|
|
60
|
-
style={{
|
|
61
|
-
top: '50%',
|
|
62
|
-
transform: 'translateY(-50%)',
|
|
63
|
-
right: '0.75rem',
|
|
64
|
-
color: '#6b7280',
|
|
65
|
-
}}
|
|
59
|
+
className="anima-passwordfield__toggle"
|
|
66
60
|
aria-label={showPassword ? 'Ocultar contraseña' : 'Mostrar contraseña'}
|
|
67
61
|
>
|
|
68
62
|
<Icon
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Typography } from '../../Atoms/Typography/Typography';
|
|
2
|
+
|
|
3
|
+
export const AccionesRapidas = ({
|
|
4
|
+
className = '',
|
|
5
|
+
...props
|
|
6
|
+
}) => {
|
|
7
|
+
return (
|
|
8
|
+
<div
|
|
9
|
+
className={`w-full bg-white ${className}`}
|
|
10
|
+
style={{
|
|
11
|
+
height: '150px',
|
|
12
|
+
border: '1px solid #c4c4c4',
|
|
13
|
+
borderRadius: '16px',
|
|
14
|
+
paddingTop: '24px',
|
|
15
|
+
paddingLeft: '24px',
|
|
16
|
+
display: 'flex',
|
|
17
|
+
flexDirection: 'column',
|
|
18
|
+
}}
|
|
19
|
+
{...props}
|
|
20
|
+
>
|
|
21
|
+
<Typography
|
|
22
|
+
variant="body-lg"
|
|
23
|
+
style={{
|
|
24
|
+
fontFamily: 'IBM Plex Sans',
|
|
25
|
+
fontWeight: 400,
|
|
26
|
+
fontStyle: 'normal',
|
|
27
|
+
fontSize: '20px',
|
|
28
|
+
lineHeight: '30px',
|
|
29
|
+
letterSpacing: '0%',
|
|
30
|
+
verticalAlign: 'middle',
|
|
31
|
+
color: '#223B40',
|
|
32
|
+
}}
|
|
33
|
+
>
|
|
34
|
+
Acciones rápidas
|
|
35
|
+
</Typography>
|
|
36
|
+
</div>
|
|
37
|
+
);
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export default AccionesRapidas;
|
|
@@ -11,10 +11,12 @@ export const ForgotPassword = ({
|
|
|
11
11
|
error: externalError,
|
|
12
12
|
className = '',
|
|
13
13
|
variant = 'default',
|
|
14
|
+
layout = 'embedded',
|
|
14
15
|
...props
|
|
15
16
|
}) => {
|
|
16
17
|
const { t } = useTranslation();
|
|
17
18
|
const isHexaLogin = variant === 'hexa-login';
|
|
19
|
+
const isPageLayout = layout === 'page';
|
|
18
20
|
|
|
19
21
|
// Estados internos (si no se pasan como props)
|
|
20
22
|
const [email, setEmail] = useState('');
|
|
@@ -124,11 +126,11 @@ export const ForgotPassword = ({
|
|
|
124
126
|
|
|
125
127
|
return (
|
|
126
128
|
<div
|
|
127
|
-
className={
|
|
128
|
-
style={{ backgroundColor: '#f5f5f5' }}
|
|
129
|
+
className={`${isPageLayout ? 'min-h-screen flex flex-col' : ''} ${className}`}
|
|
130
|
+
style={isPageLayout ? { backgroundColor: '#f5f5f5' } : undefined}
|
|
129
131
|
{...props}
|
|
130
132
|
>
|
|
131
|
-
<div className=
|
|
133
|
+
<div className={isPageLayout ? 'flex-1 flex items-center justify-center p-4' : 'p-4'}>
|
|
132
134
|
<div className="w-full max-w-md">
|
|
133
135
|
{/* Título y subtítulo */}
|
|
134
136
|
<div className="mb-8 text-center">
|
|
@@ -16,6 +16,9 @@ export const LoginForm = ({
|
|
|
16
16
|
showSocialLogin = true,
|
|
17
17
|
showDivider = true,
|
|
18
18
|
showPasswordRequirementsOnError = true,
|
|
19
|
+
passwordRequirementsItems,
|
|
20
|
+
passwordRequirementsTitle,
|
|
21
|
+
passwordRequirementsPrefix,
|
|
19
22
|
labels,
|
|
20
23
|
generalError,
|
|
21
24
|
generalErrorTitle,
|
|
@@ -74,18 +77,9 @@ export const LoginForm = ({
|
|
|
74
77
|
|
|
75
78
|
return (
|
|
76
79
|
isHexaLogin ? (
|
|
77
|
-
<div
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
minHeight: '409px',
|
|
81
|
-
borderRadius: '14px',
|
|
82
|
-
border: '1px solid #0000001A',
|
|
83
|
-
padding: '24px',
|
|
84
|
-
background: '#FFFFFF',
|
|
85
|
-
boxShadow: '0px 4px 6px -4px #0000001A, 0px 10px 15px -3px #0000001A',
|
|
86
|
-
}}
|
|
87
|
-
>
|
|
88
|
-
<form onSubmit={handleSubmit} className={className} {...props}>
|
|
80
|
+
<div className={`anima-loginform__container ${className}`} {...props}>
|
|
81
|
+
<div className="anima-loginform__card">
|
|
82
|
+
<form onSubmit={handleSubmit}>
|
|
89
83
|
{/* 1) Email */}
|
|
90
84
|
<div className="w-full">
|
|
91
85
|
<label
|
|
@@ -114,9 +108,8 @@ export const LoginForm = ({
|
|
|
114
108
|
placeholder={t('placeholder.password')}
|
|
115
109
|
value={formData.password}
|
|
116
110
|
onChange={(e) => handleChange('password', e.target.value)}
|
|
117
|
-
inputClassName="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"
|
|
111
|
+
inputClassName="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"
|
|
118
112
|
style={{
|
|
119
|
-
paddingRight: '2.75rem',
|
|
120
113
|
borderColor: errors.password ? '#ef4444' : '#2D5C63',
|
|
121
114
|
}}
|
|
122
115
|
/>
|
|
@@ -125,20 +118,36 @@ export const LoginForm = ({
|
|
|
125
118
|
{/* 3) Password requirements box (solo si hay error de password) */}
|
|
126
119
|
{showPasswordRequirementsOnError && !!errors.password && (
|
|
127
120
|
<div
|
|
128
|
-
className="rounded-lg p-4 border mt-4"
|
|
121
|
+
className="anima-loginform__requirementsBox rounded-lg p-4 border mt-4"
|
|
129
122
|
style={{
|
|
130
123
|
background: '#f5f3ff',
|
|
131
124
|
borderColor: '#a78bfa',
|
|
132
125
|
color: '#0c4a6e',
|
|
133
|
-
fontFamily: 'IBM Plex Mono',
|
|
126
|
+
fontFamily: "'IBM Plex Mono', monospace",
|
|
134
127
|
}}
|
|
135
128
|
>
|
|
136
|
-
<
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
129
|
+
<Typography
|
|
130
|
+
variant="body2"
|
|
131
|
+
className="text-sm"
|
|
132
|
+
style={{
|
|
133
|
+
color: '#0c4a6e',
|
|
134
|
+
fontFamily: "'IBM Plex Mono', monospace",
|
|
135
|
+
whiteSpace: 'pre-line',
|
|
136
|
+
}}
|
|
137
|
+
>
|
|
138
|
+
{passwordRequirementsTitle || (() => {
|
|
139
|
+
const prefix = passwordRequirementsPrefix || t('form.passwordRequirementsPrefix') || 'Recuerda que la contraseña debe tener:';
|
|
140
|
+
const defaultItems = passwordRequirementsItems || [
|
|
141
|
+
t('form.passwordRequirementMinChars') || 'Un mínimo de 6 caracteres',
|
|
142
|
+
t('form.passwordRequirementOther') || 'Una mayúscula, un número, un carácter especial',
|
|
143
|
+
];
|
|
144
|
+
|
|
145
|
+
if (passwordRequirementsItems && passwordRequirementsItems.length > 0) {
|
|
146
|
+
return `${prefix}\n${passwordRequirementsItems[0]}\n\n${passwordRequirementsItems.slice(1).join(', ')}`;
|
|
147
|
+
}
|
|
148
|
+
return `${prefix}\n${defaultItems[0]}\n\n${defaultItems[1]}`;
|
|
149
|
+
})()}
|
|
150
|
+
</Typography>
|
|
142
151
|
</div>
|
|
143
152
|
)}
|
|
144
153
|
|
|
@@ -176,10 +185,8 @@ export const LoginForm = ({
|
|
|
176
185
|
{/* 5) Error general box rojo (si existe) */}
|
|
177
186
|
{(generalError || errors.general) && (
|
|
178
187
|
<div
|
|
179
|
-
className="mt-4"
|
|
188
|
+
className="anima-loginform__errorBox mt-4"
|
|
180
189
|
style={{
|
|
181
|
-
width: '377px',
|
|
182
|
-
height: '68px',
|
|
183
190
|
paddingTop: '12px',
|
|
184
191
|
paddingRight: '16px',
|
|
185
192
|
paddingBottom: '12px',
|
|
@@ -272,28 +279,11 @@ export const LoginForm = ({
|
|
|
272
279
|
|
|
273
280
|
{/* 8) Social buttons */}
|
|
274
281
|
{showSocialLogin && (
|
|
275
|
-
<div
|
|
276
|
-
style={{
|
|
277
|
-
width: '377px',
|
|
278
|
-
height: '36px',
|
|
279
|
-
gap: '20px',
|
|
280
|
-
marginLeft: 'auto',
|
|
281
|
-
marginRight: 'auto',
|
|
282
|
-
display: 'flex',
|
|
283
|
-
}}
|
|
284
|
-
>
|
|
282
|
+
<div className="anima-loginform__socialRow">
|
|
285
283
|
<button
|
|
286
284
|
type="button"
|
|
287
285
|
onClick={onGoogleLogin}
|
|
288
|
-
className="
|
|
289
|
-
style={{
|
|
290
|
-
width: '178.5px',
|
|
291
|
-
height: '36px',
|
|
292
|
-
padding: '8px 43px',
|
|
293
|
-
gap: '16px',
|
|
294
|
-
borderRadius: '8px',
|
|
295
|
-
border: '1px solid #38656D',
|
|
296
|
-
}}
|
|
286
|
+
className="anima-loginform__socialButton anima-loginform__socialButton--google"
|
|
297
287
|
>
|
|
298
288
|
<svg width="18" height="18" viewBox="0 0 48 48" aria-hidden="true">
|
|
299
289
|
<path fill="#FFC107" d="M43.611 20.083H42V20H24v8h11.303C33.651 32.659 29.227 36 24 36c-6.627 0-12-5.373-12-12s5.373-12 12-12c3.059 0 5.842 1.154 7.961 3.039l5.657-5.657C34.047 6.053 29.272 4 24 4 12.955 4 4 12.955 4 24s8.955 20 20 20 20-8.955 20-20c0-1.341-.138-2.65-.389-3.917z" />
|
|
@@ -309,15 +299,7 @@ export const LoginForm = ({
|
|
|
309
299
|
<button
|
|
310
300
|
type="button"
|
|
311
301
|
onClick={onMicrosoftLogin}
|
|
312
|
-
className="
|
|
313
|
-
style={{
|
|
314
|
-
width: '178.5px',
|
|
315
|
-
height: '36px',
|
|
316
|
-
padding: '8px 43px',
|
|
317
|
-
gap: '16px',
|
|
318
|
-
borderRadius: '8px',
|
|
319
|
-
border: '1px solid #38656D',
|
|
320
|
-
}}
|
|
302
|
+
className="anima-loginform__socialButton anima-loginform__socialButton--microsoft"
|
|
321
303
|
>
|
|
322
304
|
<svg width="18" height="18" viewBox="0 0 48 48" aria-hidden="true">
|
|
323
305
|
<path fill="#F25022" d="M6 6h17v17H6z" />
|
|
@@ -332,6 +314,7 @@ export const LoginForm = ({
|
|
|
332
314
|
</div>
|
|
333
315
|
)}
|
|
334
316
|
</form>
|
|
317
|
+
</div>
|
|
335
318
|
</div>
|
|
336
319
|
) : (
|
|
337
320
|
<form
|
|
@@ -36,6 +36,14 @@ export default {
|
|
|
36
36
|
control: 'text',
|
|
37
37
|
description: 'Mensaje de error general',
|
|
38
38
|
},
|
|
39
|
+
passwordRequirementsItems: {
|
|
40
|
+
control: 'object',
|
|
41
|
+
description: 'Array de strings con los requisitos de contraseña',
|
|
42
|
+
},
|
|
43
|
+
passwordRequirementsTitle: {
|
|
44
|
+
control: 'text',
|
|
45
|
+
description: 'Título opcional para la caja de requisitos de contraseña',
|
|
46
|
+
},
|
|
39
47
|
},
|
|
40
48
|
};
|
|
41
49
|
|
|
@@ -231,3 +239,31 @@ export const Portuguese = {
|
|
|
231
239
|
},
|
|
232
240
|
};
|
|
233
241
|
|
|
242
|
+
// Con requisitos de contraseña personalizados
|
|
243
|
+
export const CustomPasswordRequirements = {
|
|
244
|
+
args: {
|
|
245
|
+
variant: 'hexa-login',
|
|
246
|
+
passwordRequirementsTitle: 'Requisitos de contraseña',
|
|
247
|
+
passwordRequirementsItems: [
|
|
248
|
+
'Mínimo 12 caracteres',
|
|
249
|
+
'Debe contener mayúsculas y minúsculas',
|
|
250
|
+
'Debe incluir números',
|
|
251
|
+
'Debe incluir símbolos especiales',
|
|
252
|
+
'No puede ser una contraseña común',
|
|
253
|
+
],
|
|
254
|
+
onSubmit: (data) => {
|
|
255
|
+
console.log('Login data:', data);
|
|
256
|
+
alert('Login submitted!');
|
|
257
|
+
},
|
|
258
|
+
onForgotPassword: () => {
|
|
259
|
+
alert('Forgot password clicked');
|
|
260
|
+
},
|
|
261
|
+
onGoogleLogin: () => {
|
|
262
|
+
alert('Google login clicked');
|
|
263
|
+
},
|
|
264
|
+
onMicrosoftLogin: () => {
|
|
265
|
+
alert('Microsoft login clicked');
|
|
266
|
+
},
|
|
267
|
+
},
|
|
268
|
+
};
|
|
269
|
+
|