ywana-core8 0.1.79 → 0.1.81
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.cjs +3493 -2320
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +2096 -1125
- package/dist/index.css.map +1 -1
- package/dist/index.modern.js +3493 -2320
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +3493 -2320
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/html/ExampleLayout.css +401 -0
- package/src/html/ExampleLayout.js +192 -0
- package/src/html/README-sidebar-navigation.md +195 -0
- package/src/html/accordion.example.js +123 -4
- package/src/html/accordion.example.js.backup +390 -0
- package/src/html/button.example.js +50 -3
- package/src/html/button.example.js.backup +374 -0
- package/src/html/button.example.new.js +416 -0
- package/src/html/button.js +22 -4
- package/src/html/checkbox.example.js +93 -4
- package/src/html/checkbox.example.js.backup +316 -0
- package/src/html/chip.example.js +108 -4
- package/src/html/chip.example.js.backup +355 -0
- package/src/html/color.example.js +108 -4
- package/src/html/color.example.js.backup +527 -0
- package/src/html/components.example.js +123 -4
- package/src/html/components.example.js.backup +492 -0
- package/src/html/convert-examples.js +183 -0
- package/src/html/demo-sidebar.html +410 -0
- package/src/html/form.example.js +93 -4
- package/src/html/form.example.js.backup +385 -0
- package/src/html/header.js +20 -3
- package/src/html/header2.example.js +108 -4
- package/src/html/header2.example.js.backup +411 -0
- package/src/html/icon.example.js +77 -3
- package/src/html/icon.example.js.backup +268 -0
- package/src/html/list.example.js +93 -4
- package/src/html/list.example.js.backup +404 -0
- package/src/html/progress.example.js +74 -4
- package/src/html/progress.example.js.backup +424 -0
- package/src/html/property.example.js +123 -4
- package/src/html/property.example.js.backup +553 -0
- package/src/html/radio.example.js +108 -4
- package/src/html/radio.example.js.backup +389 -0
- package/src/html/section.example.js +42 -3
- package/src/html/section.example.js.backup +99 -0
- package/src/html/switch.example.js +108 -4
- package/src/html/switch.example.js.backup +461 -0
- package/src/html/tab.example.js +93 -4
- package/src/html/tab.example.js.backup +446 -0
- package/src/html/table-export-utils.js +483 -0
- package/src/html/table-summary-functions.js +363 -0
- package/src/html/table2.css +1449 -479
- package/src/html/table2.example.js +2937 -512
- package/src/html/table2.example.js.broken +1226 -0
- package/src/html/table2.js +1426 -1000
- package/src/html/test-resize.html +279 -0
- package/src/html/test-selection.html +387 -0
- package/src/html/textfield.js +73 -7
- package/src/html/textfield2.example.js +108 -4
- package/src/html/textfield2.example.js.backup +1370 -0
- package/src/html/textfield2.js +19 -4
- package/src/html/tokenfield.example.js +108 -4
- package/src/html/tokenfield.example.js.backup +503 -0
- package/src/html/tooltip.js +21 -3
- package/src/html/tree.css +2 -4
- package/src/html/tree.example.js +93 -4
- package/src/html/tree.example.js.backup +475 -0
- package/src/html/tree.js +19 -3
- package/src/widgets/login/LoginBox.css +1 -0
- package/src/widgets/login/LoginBox.js +29 -6
@@ -0,0 +1,316 @@
|
|
1
|
+
import React, { useState } from 'react'
|
2
|
+
import { CheckBox } from './checkbox'
|
3
|
+
|
4
|
+
/**
|
5
|
+
* Ejemplos de uso del componente CheckBox mejorado
|
6
|
+
*/
|
7
|
+
export const CheckBoxExamples = () => {
|
8
|
+
const [formData, setFormData] = useState({
|
9
|
+
terms: false,
|
10
|
+
newsletter: true,
|
11
|
+
notifications: false,
|
12
|
+
privacy: false,
|
13
|
+
marketing: false,
|
14
|
+
analytics: true
|
15
|
+
})
|
16
|
+
|
17
|
+
const [validationErrors, setValidationErrors] = useState({})
|
18
|
+
|
19
|
+
const handleChange = (id, value) => {
|
20
|
+
setFormData(prev => ({ ...prev, [id]: value }))
|
21
|
+
|
22
|
+
// Limpiar errores cuando el usuario interactúa
|
23
|
+
if (validationErrors[id]) {
|
24
|
+
setValidationErrors(prev => ({ ...prev, [id]: null }))
|
25
|
+
}
|
26
|
+
}
|
27
|
+
|
28
|
+
const validateForm = () => {
|
29
|
+
const errors = {}
|
30
|
+
|
31
|
+
if (!formData.terms) {
|
32
|
+
errors.terms = 'Debes aceptar los términos y condiciones'
|
33
|
+
}
|
34
|
+
|
35
|
+
if (!formData.privacy) {
|
36
|
+
errors.privacy = 'Debes aceptar la política de privacidad'
|
37
|
+
}
|
38
|
+
|
39
|
+
setValidationErrors(errors)
|
40
|
+
return Object.keys(errors).length === 0
|
41
|
+
}
|
42
|
+
|
43
|
+
const handleSubmit = () => {
|
44
|
+
if (validateForm()) {
|
45
|
+
alert('Formulario válido: ' + JSON.stringify(formData, null, 2))
|
46
|
+
}
|
47
|
+
}
|
48
|
+
|
49
|
+
return (
|
50
|
+
<div style={{ padding: '2rem', maxWidth: '800px' }}>
|
51
|
+
<h1>Ejemplos del Componente CheckBox Mejorado</h1>
|
52
|
+
|
53
|
+
<div style={{
|
54
|
+
background: '#f8f9fa',
|
55
|
+
padding: '1rem',
|
56
|
+
borderRadius: '8px',
|
57
|
+
marginBottom: '2rem',
|
58
|
+
border: '1px solid #e9ecef'
|
59
|
+
}}>
|
60
|
+
<h3>✅ Mejoras Implementadas:</h3>
|
61
|
+
<ul>
|
62
|
+
<li>🛡️ <strong>Validación de props</strong> - ID requerido con advertencias</li>
|
63
|
+
<li>♿ <strong>Accesibilidad completa</strong> - ARIA, soporte de teclado, focus</li>
|
64
|
+
<li>📝 <strong>PropTypes y documentación</strong> - Validación y documentación completa</li>
|
65
|
+
<li>🎯 <strong>Estados avanzados</strong> - disabled, error, indeterminate</li>
|
66
|
+
<li>🎨 <strong>CSS mejorado</strong> - Estados visuales consistentes</li>
|
67
|
+
<li>⌨️ <strong>Soporte de teclado</strong> - Espacio para alternar</li>
|
68
|
+
<li>🔧 <strong>Manejo de errores</strong> - Mensajes de error integrados</li>
|
69
|
+
<li>🧪 <strong>Pruebas unitarias</strong> - 13 pruebas que cubren toda la funcionalidad</li>
|
70
|
+
</ul>
|
71
|
+
</div>
|
72
|
+
|
73
|
+
{/* Checkboxes básicos */}
|
74
|
+
<section style={{ marginBottom: '2rem' }}>
|
75
|
+
<h3>Checkboxes Básicos</h3>
|
76
|
+
<div style={{ display: 'flex', flexDirection: 'column', gap: '1rem' }}>
|
77
|
+
<CheckBox
|
78
|
+
id="basic1"
|
79
|
+
label="Opción básica sin estado inicial"
|
80
|
+
onChange={handleChange}
|
81
|
+
/>
|
82
|
+
<CheckBox
|
83
|
+
id="basic2"
|
84
|
+
label="Opción básica marcada por defecto"
|
85
|
+
value={true}
|
86
|
+
onChange={handleChange}
|
87
|
+
/>
|
88
|
+
<CheckBox
|
89
|
+
id="basic3"
|
90
|
+
label="Opción con etiqueta ARIA personalizada"
|
91
|
+
ariaLabel="Configuración especial de accesibilidad"
|
92
|
+
onChange={handleChange}
|
93
|
+
/>
|
94
|
+
</div>
|
95
|
+
</section>
|
96
|
+
|
97
|
+
{/* Estados especiales */}
|
98
|
+
<section style={{ marginBottom: '2rem' }}>
|
99
|
+
<h3>Estados Especiales</h3>
|
100
|
+
<div style={{ display: 'flex', flexDirection: 'column', gap: '1rem' }}>
|
101
|
+
<CheckBox
|
102
|
+
id="readonly"
|
103
|
+
label="Solo lectura (marcado)"
|
104
|
+
value={true}
|
105
|
+
readOnly={true}
|
106
|
+
onChange={handleChange}
|
107
|
+
/>
|
108
|
+
<CheckBox
|
109
|
+
id="disabled"
|
110
|
+
label="Deshabilitado"
|
111
|
+
disabled={true}
|
112
|
+
onChange={handleChange}
|
113
|
+
/>
|
114
|
+
<CheckBox
|
115
|
+
id="indeterminate"
|
116
|
+
label="Estado indeterminado"
|
117
|
+
indeterminate={true}
|
118
|
+
onChange={handleChange}
|
119
|
+
/>
|
120
|
+
</div>
|
121
|
+
</section>
|
122
|
+
|
123
|
+
{/* Formulario con validación */}
|
124
|
+
<section style={{ marginBottom: '2rem' }}>
|
125
|
+
<h3>Formulario con Validación</h3>
|
126
|
+
<div style={{
|
127
|
+
background: '#fff',
|
128
|
+
padding: '1.5rem',
|
129
|
+
borderRadius: '8px',
|
130
|
+
border: '1px solid #ddd'
|
131
|
+
}}>
|
132
|
+
<div style={{ display: 'flex', flexDirection: 'column', gap: '1rem' }}>
|
133
|
+
<CheckBox
|
134
|
+
id="terms"
|
135
|
+
label="Acepto los términos y condiciones"
|
136
|
+
value={formData.terms}
|
137
|
+
required={true}
|
138
|
+
error={validationErrors.terms}
|
139
|
+
onChange={handleChange}
|
140
|
+
/>
|
141
|
+
|
142
|
+
<CheckBox
|
143
|
+
id="privacy"
|
144
|
+
label="Acepto la política de privacidad"
|
145
|
+
value={formData.privacy}
|
146
|
+
required={true}
|
147
|
+
error={validationErrors.privacy}
|
148
|
+
onChange={handleChange}
|
149
|
+
/>
|
150
|
+
|
151
|
+
<CheckBox
|
152
|
+
id="newsletter"
|
153
|
+
label="Quiero recibir el newsletter"
|
154
|
+
value={formData.newsletter}
|
155
|
+
onChange={handleChange}
|
156
|
+
/>
|
157
|
+
|
158
|
+
<CheckBox
|
159
|
+
id="notifications"
|
160
|
+
label="Activar notificaciones push"
|
161
|
+
value={formData.notifications}
|
162
|
+
onChange={handleChange}
|
163
|
+
/>
|
164
|
+
|
165
|
+
<CheckBox
|
166
|
+
id="marketing"
|
167
|
+
label="Recibir comunicaciones de marketing"
|
168
|
+
value={formData.marketing}
|
169
|
+
onChange={handleChange}
|
170
|
+
/>
|
171
|
+
|
172
|
+
<CheckBox
|
173
|
+
id="analytics"
|
174
|
+
label="Permitir análisis de uso"
|
175
|
+
value={formData.analytics}
|
176
|
+
onChange={handleChange}
|
177
|
+
/>
|
178
|
+
</div>
|
179
|
+
|
180
|
+
<div style={{ marginTop: '1.5rem', display: 'flex', gap: '1rem' }}>
|
181
|
+
<button
|
182
|
+
onClick={handleSubmit}
|
183
|
+
style={{
|
184
|
+
padding: '0.5rem 1rem',
|
185
|
+
backgroundColor: '#007bff',
|
186
|
+
color: 'white',
|
187
|
+
border: 'none',
|
188
|
+
borderRadius: '4px',
|
189
|
+
cursor: 'pointer'
|
190
|
+
}}
|
191
|
+
>
|
192
|
+
Validar Formulario
|
193
|
+
</button>
|
194
|
+
<button
|
195
|
+
onClick={() => {
|
196
|
+
setFormData({
|
197
|
+
terms: false,
|
198
|
+
newsletter: true,
|
199
|
+
notifications: false,
|
200
|
+
privacy: false,
|
201
|
+
marketing: false,
|
202
|
+
analytics: true
|
203
|
+
})
|
204
|
+
setValidationErrors({})
|
205
|
+
}}
|
206
|
+
style={{
|
207
|
+
padding: '0.5rem 1rem',
|
208
|
+
backgroundColor: '#6c757d',
|
209
|
+
color: 'white',
|
210
|
+
border: 'none',
|
211
|
+
borderRadius: '4px',
|
212
|
+
cursor: 'pointer'
|
213
|
+
}}
|
214
|
+
>
|
215
|
+
Resetear
|
216
|
+
</button>
|
217
|
+
</div>
|
218
|
+
</div>
|
219
|
+
</section>
|
220
|
+
|
221
|
+
{/* Demostración de accesibilidad */}
|
222
|
+
<section style={{ marginBottom: '2rem' }}>
|
223
|
+
<h3>Demostración de Accesibilidad</h3>
|
224
|
+
<div style={{
|
225
|
+
background: '#e8f5e8',
|
226
|
+
padding: '1rem',
|
227
|
+
borderRadius: '4px',
|
228
|
+
border: '1px solid #c8e6c9'
|
229
|
+
}}>
|
230
|
+
<p><strong>Prueba la accesibilidad:</strong></p>
|
231
|
+
<ol>
|
232
|
+
<li>Usa <kbd>Tab</kbd> para navegar entre checkboxes</li>
|
233
|
+
<li>Usa <kbd>Espacio</kbd> para alternar el estado</li>
|
234
|
+
<li>Observa los indicadores de focus</li>
|
235
|
+
<li>Los lectores de pantalla anunciarán el estado y etiquetas</li>
|
236
|
+
</ol>
|
237
|
+
|
238
|
+
<div style={{ marginTop: '1rem', display: 'flex', flexDirection: 'column', gap: '0.5rem' }}>
|
239
|
+
<CheckBox
|
240
|
+
id="a11y1"
|
241
|
+
label="Checkbox accesible 1"
|
242
|
+
onChange={handleChange}
|
243
|
+
/>
|
244
|
+
<CheckBox
|
245
|
+
id="a11y2"
|
246
|
+
label="Checkbox accesible 2"
|
247
|
+
onChange={handleChange}
|
248
|
+
/>
|
249
|
+
<CheckBox
|
250
|
+
id="a11y3"
|
251
|
+
label="Checkbox accesible 3"
|
252
|
+
onChange={handleChange}
|
253
|
+
/>
|
254
|
+
</div>
|
255
|
+
</div>
|
256
|
+
</section>
|
257
|
+
|
258
|
+
{/* Comparación antes/después */}
|
259
|
+
<section>
|
260
|
+
<h3>Comparación: Antes vs Después</h3>
|
261
|
+
<div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: '1rem' }}>
|
262
|
+
<div style={{
|
263
|
+
background: '#ffebee',
|
264
|
+
padding: '1rem',
|
265
|
+
borderRadius: '4px',
|
266
|
+
border: '1px solid #ffcdd2'
|
267
|
+
}}>
|
268
|
+
<h4>❌ Antes</h4>
|
269
|
+
<ul>
|
270
|
+
<li>Sin validación de props</li>
|
271
|
+
<li>Sin accesibilidad</li>
|
272
|
+
<li>Solo estados básicos</li>
|
273
|
+
<li>Sin soporte de teclado</li>
|
274
|
+
<li>Sin manejo de errores</li>
|
275
|
+
<li>Key problemático</li>
|
276
|
+
<li>Sin documentación</li>
|
277
|
+
</ul>
|
278
|
+
</div>
|
279
|
+
<div style={{
|
280
|
+
background: '#e8f5e8',
|
281
|
+
padding: '1rem',
|
282
|
+
borderRadius: '4px',
|
283
|
+
border: '1px solid #c8e6c9'
|
284
|
+
}}>
|
285
|
+
<h4>✅ Después</h4>
|
286
|
+
<ul>
|
287
|
+
<li>PropTypes completos</li>
|
288
|
+
<li>Accesibilidad total</li>
|
289
|
+
<li>Estados avanzados</li>
|
290
|
+
<li>Soporte completo de teclado</li>
|
291
|
+
<li>Manejo integrado de errores</li>
|
292
|
+
<li>Implementación limpia</li>
|
293
|
+
<li>Documentación y ejemplos</li>
|
294
|
+
</ul>
|
295
|
+
</div>
|
296
|
+
</div>
|
297
|
+
</section>
|
298
|
+
|
299
|
+
{/* Estado actual del formulario */}
|
300
|
+
<section style={{ marginTop: '2rem' }}>
|
301
|
+
<h3>Estado Actual del Formulario</h3>
|
302
|
+
<pre style={{
|
303
|
+
background: '#f8f9fa',
|
304
|
+
padding: '1rem',
|
305
|
+
borderRadius: '4px',
|
306
|
+
fontSize: '0.9rem',
|
307
|
+
overflow: 'auto'
|
308
|
+
}}>
|
309
|
+
{JSON.stringify(formData, null, 2)}
|
310
|
+
</pre>
|
311
|
+
</section>
|
312
|
+
</div>
|
313
|
+
)
|
314
|
+
}
|
315
|
+
|
316
|
+
export default CheckBoxExamples
|
package/src/html/chip.example.js
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
import React, { useState } from 'react'
|
2
|
-
import { Chip, Chips } from '
|
2
|
+
import { Chip, Chips } from '
|
3
|
+
import { ExampleLayout, ExampleSection, ExampleSubsection, CodeSnippet } from './ExampleLayout'./chip'
|
3
4
|
|
4
5
|
/**
|
5
6
|
* Ejemplos de uso de los componentes Chip mejorados
|
@@ -50,9 +51,111 @@ export const ChipExamples = () => {
|
|
50
51
|
{ id: 'archived', label: 'Archivados', deletable: true }
|
51
52
|
]
|
52
53
|
|
54
|
+
// Definir secciones para el menú lateral
|
55
|
+
|
56
|
+
|
57
|
+
const sections =
|
58
|
+
|
59
|
+
[
|
60
|
+
|
61
|
+
|
62
|
+
{
|
63
|
+
|
64
|
+
|
65
|
+
"id": "overview",
|
66
|
+
|
67
|
+
|
68
|
+
"title": "Introducción",
|
69
|
+
|
70
|
+
|
71
|
+
"icon": "info"
|
72
|
+
|
73
|
+
|
74
|
+
},
|
75
|
+
|
76
|
+
|
77
|
+
{
|
78
|
+
|
79
|
+
|
80
|
+
"id": "basic-examples",
|
81
|
+
|
82
|
+
|
83
|
+
"title": "Ejemplos Básicos",
|
84
|
+
|
85
|
+
|
86
|
+
"icon": "widgets"
|
87
|
+
|
88
|
+
|
89
|
+
},
|
90
|
+
|
91
|
+
|
92
|
+
{
|
93
|
+
|
94
|
+
|
95
|
+
"id": "advanced-features",
|
96
|
+
|
97
|
+
|
98
|
+
"title": "Características Avanzadas",
|
99
|
+
|
100
|
+
|
101
|
+
"icon": "settings"
|
102
|
+
|
103
|
+
|
104
|
+
},
|
105
|
+
|
106
|
+
|
107
|
+
{
|
108
|
+
|
109
|
+
|
110
|
+
"id": "variants",
|
111
|
+
|
112
|
+
|
113
|
+
"title": "Variantes y Temas",
|
114
|
+
|
115
|
+
|
116
|
+
"icon": "palette"
|
117
|
+
|
118
|
+
|
119
|
+
},
|
120
|
+
|
121
|
+
|
122
|
+
{
|
123
|
+
|
124
|
+
|
125
|
+
"id": "states",
|
126
|
+
|
127
|
+
|
128
|
+
"title": "Estados",
|
129
|
+
|
130
|
+
|
131
|
+
"icon": "toggle_on"
|
132
|
+
|
133
|
+
|
134
|
+
},
|
135
|
+
|
136
|
+
|
137
|
+
{
|
138
|
+
|
139
|
+
|
140
|
+
"id": "sizes",
|
141
|
+
|
142
|
+
|
143
|
+
"title": "Tamaños",
|
144
|
+
|
145
|
+
|
146
|
+
"icon": "format_size"
|
147
|
+
|
148
|
+
|
149
|
+
}
|
150
|
+
|
151
|
+
|
152
|
+
]
|
153
|
+
|
154
|
+
|
155
|
+
|
53
156
|
return (
|
54
|
-
<
|
55
|
-
<
|
157
|
+
<ExampleLayout title="Chip Examples" sections={sections}>
|
158
|
+
<ExampleSection id="overview" title="Ejemplos de Componentes Chip Mejorados" icon="widgets">
|
56
159
|
|
57
160
|
<div style={{
|
58
161
|
background: '#f8f9fa',
|
@@ -348,7 +451,8 @@ export const ChipExamples = () => {
|
|
348
451
|
}, null, 2)}
|
349
452
|
</pre>
|
350
453
|
</section>
|
351
|
-
|
454
|
+
</ExampleSection>
|
455
|
+
</ExampleLayout>
|
352
456
|
)
|
353
457
|
}
|
354
458
|
|