ywana-core8 0.1.94 → 0.1.96
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/index.css +38 -21
- package/dist/index.css.map +1 -1
- package/package.json +1 -1
- package/src/html/textfield2.css +38 -21
- package/src/widgets/login/LoginBox.example.js +195 -0
package/package.json
CHANGED
package/src/html/textfield2.css
CHANGED
@@ -97,19 +97,27 @@
|
|
97
97
|
.textfield2-clear,
|
98
98
|
.textfield2-password-toggle {
|
99
99
|
position: absolute;
|
100
|
-
|
100
|
+
/* Centrado respecto al input, no al contenedor completo */
|
101
|
+
top: calc(1.5rem + 1.25rem); /* padding-top del contenedor + mitad de la altura del input */
|
101
102
|
transform: translateY(-50%);
|
102
103
|
right: 0.75rem; /* Más espacio desde el borde */
|
103
104
|
color: var(--text-color-light, #666);
|
104
105
|
cursor: pointer;
|
105
106
|
transition: color 0.2s ease;
|
106
107
|
z-index: 2;
|
108
|
+
/* Asegurar que el icono tenga el tamaño correcto */
|
109
|
+
width: 1.5rem;
|
110
|
+
height: 1.5rem;
|
111
|
+
display: flex;
|
112
|
+
align-items: center;
|
113
|
+
justify-content: center;
|
107
114
|
}
|
108
115
|
|
109
116
|
/* Icons positioning for outlined variant */
|
110
117
|
.textfield2-outlined .textfield2-clear,
|
111
118
|
.textfield2-outlined .textfield2-password-toggle {
|
112
|
-
|
119
|
+
/* Para outlined, centramos respecto al input que tiene padding de 1rem */
|
120
|
+
top: 3.3rem;
|
113
121
|
}
|
114
122
|
|
115
123
|
.textfield2-clear:hover,
|
@@ -117,24 +125,11 @@
|
|
117
125
|
color: var(--text-color, #333);
|
118
126
|
}
|
119
127
|
|
120
|
-
/* For fields without labels,
|
128
|
+
/* For fields without labels, ajustar posición */
|
121
129
|
.textfield2.no-label .textfield2-clear,
|
122
130
|
.textfield2.no-label .textfield2-password-toggle {
|
123
|
-
/*
|
124
|
-
|
125
|
-
|
126
|
-
.textfield2-password-toggle {
|
127
|
-
right: 2.5rem; /* Más espacio para el clear button */
|
128
|
-
}
|
129
|
-
|
130
|
-
/* When both clear and password toggle are present */
|
131
|
-
.textfield2.textfield2-password .textfield2-clear {
|
132
|
-
right: 2.5rem;
|
133
|
-
}
|
134
|
-
|
135
|
-
/* Outlined variant - icon spacing */
|
136
|
-
.textfield2-outlined .textfield2-password-toggle {
|
137
|
-
right: 2.5rem;
|
131
|
+
/* Para campos sin label, centramos respecto al input directamente */
|
132
|
+
top: calc(0.5rem + 1.25rem); /* padding-top reducido + mitad altura input */
|
138
133
|
}
|
139
134
|
|
140
135
|
.textfield2-outlined.textfield2-password .textfield2-clear {
|
@@ -375,21 +370,43 @@
|
|
375
370
|
.textfield2 {
|
376
371
|
padding-top: 1.25rem;
|
377
372
|
}
|
378
|
-
|
373
|
+
|
379
374
|
.textfield2 > input,
|
380
375
|
.textfield2 > textarea {
|
381
376
|
font-size: 0.9rem;
|
382
377
|
padding: 8px 8px 8px 0.4rem;
|
383
378
|
}
|
384
|
-
|
379
|
+
|
385
380
|
.textfield2 > label {
|
386
381
|
font-size: 0.8rem;
|
387
382
|
left: 0.3rem;
|
388
383
|
}
|
389
|
-
|
384
|
+
|
390
385
|
.textfield2-helper {
|
391
386
|
font-size: 0.7rem;
|
392
387
|
}
|
388
|
+
|
389
|
+
/* Ajustar posición de iconos en móvil */
|
390
|
+
.textfield2-clear,
|
391
|
+
.textfield2-password-toggle {
|
392
|
+
top: calc(1.25rem + 1.2rem); /* padding-top móvil + mitad altura input móvil */
|
393
|
+
right: 0.5rem;
|
394
|
+
width: 1.3rem;
|
395
|
+
height: 1.3rem;
|
396
|
+
}
|
397
|
+
|
398
|
+
.textfield2.no-label .textfield2-clear,
|
399
|
+
.textfield2.no-label .textfield2-password-toggle {
|
400
|
+
top: calc(0.5rem + 1.2rem); /* padding-top reducido + mitad altura input móvil */
|
401
|
+
}
|
402
|
+
|
403
|
+
.textfield2-password-toggle {
|
404
|
+
right: 2.2rem;
|
405
|
+
}
|
406
|
+
|
407
|
+
.textfield2.textfield2-password .textfield2-clear {
|
408
|
+
right: 2.2rem;
|
409
|
+
}
|
393
410
|
}
|
394
411
|
|
395
412
|
/* High contrast mode support */
|
@@ -0,0 +1,195 @@
|
|
1
|
+
import React, { useState } from 'react'
|
2
|
+
import { LoginBox } from './LoginBox'
|
3
|
+
|
4
|
+
/**
|
5
|
+
* LoginBox Examples
|
6
|
+
*
|
7
|
+
* Ejemplos de uso del componente LoginBox con diferentes configuraciones
|
8
|
+
* para verificar el centrado de iconos en los textfields.
|
9
|
+
*/
|
10
|
+
|
11
|
+
export const LoginBoxExamples = () => {
|
12
|
+
const [loginState, setLoginState] = useState({
|
13
|
+
loading: false,
|
14
|
+
message: '',
|
15
|
+
lastLogin: null
|
16
|
+
})
|
17
|
+
|
18
|
+
const handleLogin = (user, password) => {
|
19
|
+
console.log('Login attempt:', { user, password })
|
20
|
+
|
21
|
+
setLoginState(prev => ({ ...prev, loading: true, message: '' }))
|
22
|
+
|
23
|
+
// Simular proceso de login
|
24
|
+
setTimeout(() => {
|
25
|
+
if (user === 'admin' && password === 'admin') {
|
26
|
+
setLoginState({
|
27
|
+
loading: false,
|
28
|
+
message: '',
|
29
|
+
lastLogin: { user, timestamp: new Date() }
|
30
|
+
})
|
31
|
+
console.log('Login successful!')
|
32
|
+
} else {
|
33
|
+
setLoginState({
|
34
|
+
loading: false,
|
35
|
+
message: 'Usuario o contraseña incorrectos',
|
36
|
+
lastLogin: null
|
37
|
+
})
|
38
|
+
}
|
39
|
+
}, 2000)
|
40
|
+
}
|
41
|
+
|
42
|
+
const resetLogin = () => {
|
43
|
+
setLoginState({
|
44
|
+
loading: false,
|
45
|
+
message: '',
|
46
|
+
lastLogin: null
|
47
|
+
})
|
48
|
+
}
|
49
|
+
|
50
|
+
return (
|
51
|
+
<div style={{
|
52
|
+
padding: '2rem',
|
53
|
+
backgroundColor: '#f5f5f5',
|
54
|
+
minHeight: '100vh',
|
55
|
+
display: 'flex',
|
56
|
+
flexDirection: 'column',
|
57
|
+
gap: '2rem'
|
58
|
+
}}>
|
59
|
+
<h1>LoginBox Examples</h1>
|
60
|
+
|
61
|
+
{/* Ejemplo 1: LoginBox básico */}
|
62
|
+
<div style={{
|
63
|
+
backgroundColor: 'white',
|
64
|
+
padding: '2rem',
|
65
|
+
borderRadius: '8px',
|
66
|
+
boxShadow: '0 2px 10px rgba(0,0,0,0.1)',
|
67
|
+
maxWidth: '400px'
|
68
|
+
}}>
|
69
|
+
<h2>1. LoginBox Básico</h2>
|
70
|
+
<p>LoginBox estándar con labels en español</p>
|
71
|
+
<LoginBox
|
72
|
+
userLabel="Usuario"
|
73
|
+
passwordLabel="Contraseña"
|
74
|
+
loginLabel="Iniciar Sesión"
|
75
|
+
onOK={handleLogin}
|
76
|
+
loading={loginState.loading}
|
77
|
+
message={loginState.message}
|
78
|
+
/>
|
79
|
+
{loginState.lastLogin && (
|
80
|
+
<div style={{
|
81
|
+
marginTop: '1rem',
|
82
|
+
padding: '1rem',
|
83
|
+
backgroundColor: '#e8f5e8',
|
84
|
+
borderRadius: '4px',
|
85
|
+
fontSize: '0.9rem'
|
86
|
+
}}>
|
87
|
+
✅ Login exitoso: {loginState.lastLogin.user}
|
88
|
+
<br />
|
89
|
+
{loginState.lastLogin.timestamp.toLocaleString()}
|
90
|
+
<br />
|
91
|
+
<button onClick={resetLogin} style={{ marginTop: '0.5rem' }}>
|
92
|
+
Reset
|
93
|
+
</button>
|
94
|
+
</div>
|
95
|
+
)}
|
96
|
+
</div>
|
97
|
+
|
98
|
+
{/* Ejemplo 2: LoginBox con valores predefinidos */}
|
99
|
+
<div style={{
|
100
|
+
backgroundColor: 'white',
|
101
|
+
padding: '2rem',
|
102
|
+
borderRadius: '8px',
|
103
|
+
boxShadow: '0 2px 10px rgba(0,0,0,0.1)',
|
104
|
+
maxWidth: '400px'
|
105
|
+
}}>
|
106
|
+
<h2>2. LoginBox con Valores Predefinidos</h2>
|
107
|
+
<p>Para probar el centrado de iconos con texto existente</p>
|
108
|
+
<LoginBox
|
109
|
+
userLabel="Email"
|
110
|
+
userValue="usuario@ejemplo.com"
|
111
|
+
passwordLabel="Password"
|
112
|
+
passwordValue="password123"
|
113
|
+
loginLabel="Sign In"
|
114
|
+
onOK={(user, pass) => console.log('Login with preset values:', { user, pass })}
|
115
|
+
/>
|
116
|
+
</div>
|
117
|
+
|
118
|
+
{/* Ejemplo 3: LoginBox en inglés */}
|
119
|
+
<div style={{
|
120
|
+
backgroundColor: 'white',
|
121
|
+
padding: '2rem',
|
122
|
+
borderRadius: '8px',
|
123
|
+
boxShadow: '0 2px 10px rgba(0,0,0,0.1)',
|
124
|
+
maxWidth: '400px'
|
125
|
+
}}>
|
126
|
+
<h2>3. LoginBox en Inglés</h2>
|
127
|
+
<p>Labels en inglés para verificar diferentes longitudes de texto</p>
|
128
|
+
<LoginBox
|
129
|
+
userLabel="Username"
|
130
|
+
passwordLabel="Password"
|
131
|
+
loginLabel="Log In"
|
132
|
+
onOK={(user, pass) => console.log('English login:', { user, pass })}
|
133
|
+
/>
|
134
|
+
</div>
|
135
|
+
|
136
|
+
{/* Ejemplo 4: LoginBox con contenido adicional */}
|
137
|
+
<div style={{
|
138
|
+
backgroundColor: 'white',
|
139
|
+
padding: '2rem',
|
140
|
+
borderRadius: '8px',
|
141
|
+
boxShadow: '0 2px 10px rgba(0,0,0,0.1)',
|
142
|
+
maxWidth: '400px'
|
143
|
+
}}>
|
144
|
+
<h2>4. LoginBox con Contenido Adicional</h2>
|
145
|
+
<p>LoginBox con elementos adicionales en el footer</p>
|
146
|
+
<LoginBox
|
147
|
+
userLabel="Usuario"
|
148
|
+
passwordLabel="Contraseña"
|
149
|
+
loginLabel="Entrar"
|
150
|
+
onOK={(user, pass) => console.log('Login with extra content:', { user, pass })}
|
151
|
+
>
|
152
|
+
<div style={{
|
153
|
+
width: '100%',
|
154
|
+
textAlign: 'center',
|
155
|
+
marginTop: '1rem',
|
156
|
+
fontSize: '0.9rem',
|
157
|
+
color: '#666'
|
158
|
+
}}>
|
159
|
+
<a href="#" style={{ color: '#2196f3', textDecoration: 'none' }}>
|
160
|
+
¿Olvidaste tu contraseña?
|
161
|
+
</a>
|
162
|
+
<br />
|
163
|
+
<span style={{ fontSize: '0.8rem' }}>
|
164
|
+
¿No tienes cuenta? <a href="#" style={{ color: '#2196f3' }}>Regístrate</a>
|
165
|
+
</span>
|
166
|
+
</div>
|
167
|
+
</LoginBox>
|
168
|
+
</div>
|
169
|
+
|
170
|
+
{/* Información de prueba */}
|
171
|
+
<div style={{
|
172
|
+
backgroundColor: '#fff3cd',
|
173
|
+
padding: '1rem',
|
174
|
+
borderRadius: '4px',
|
175
|
+
border: '1px solid #ffeaa7',
|
176
|
+
maxWidth: '600px'
|
177
|
+
}}>
|
178
|
+
<h3>💡 Información de Prueba</h3>
|
179
|
+
<p><strong>Para probar el login exitoso:</strong></p>
|
180
|
+
<ul>
|
181
|
+
<li>Usuario: <code>admin</code></li>
|
182
|
+
<li>Contraseña: <code>admin</code></li>
|
183
|
+
</ul>
|
184
|
+
<p><strong>Verificar centrado de iconos:</strong></p>
|
185
|
+
<ul>
|
186
|
+
<li>Los iconos de "clear" (X) deben aparecer centrados verticalmente en los campos</li>
|
187
|
+
<li>El icono de "visibility toggle" en el campo de contraseña debe estar centrado</li>
|
188
|
+
<li>Probar en diferentes tamaños de pantalla (responsive)</li>
|
189
|
+
</ul>
|
190
|
+
</div>
|
191
|
+
</div>
|
192
|
+
)
|
193
|
+
}
|
194
|
+
|
195
|
+
export default LoginBoxExamples
|