ywana-core8 0.1.75 → 0.1.76
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/ACCORDION_EVALUATION.md +583 -0
- package/CHECKBOX_EVALUATION.md +273 -0
- package/CHIP_EVALUATION.md +542 -0
- package/COLOR_EVALUATION.md +524 -0
- package/COMPONENTS_EVALUATION.md +477 -0
- package/FORM_EVALUATION.md +459 -0
- package/HEADER_EVALUATION.md +436 -0
- package/ICON_EVALUATION.md +254 -0
- package/LIST_EVALUATION.md +574 -0
- package/PROGRESS_EVALUATION.md +450 -0
- package/RADIO_EVALUATION.md +439 -0
- package/RADIO_VISUAL_FIX.md +183 -0
- package/SECTION_IMPROVEMENTS.md +153 -0
- package/SWITCH_EVALUATION.md +335 -0
- package/SWITCH_VISUAL_FIX.md +232 -0
- package/TAB_EVALUATION.md +626 -0
- package/TEXTFIELD_EVALUATION.md +747 -0
- package/TOOLTIP_FIX.md +157 -0
- package/TREE_EVALUATION.md +708 -0
- package/dist/index.cjs +7900 -1615
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +6094 -1122
- package/dist/index.css.map +1 -1
- package/dist/index.modern.js +7929 -1645
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +7900 -1615
- package/dist/index.umd.js.map +1 -1
- package/jest.config.js +24 -0
- package/package.json +10 -1
- package/src/html/accordion.css +208 -4
- package/src/html/accordion.example.js +390 -0
- package/src/html/accordion.js +284 -28
- package/src/html/accordion.unit.test.js +334 -0
- package/src/html/button.css +157 -16
- package/src/html/button.example.js +374 -0
- package/src/html/button.js +240 -60
- package/src/html/button.test.js +422 -0
- package/src/html/checkbox.css +74 -2
- package/src/html/checkbox.example.js +316 -0
- package/src/html/checkbox.js +113 -26
- package/src/html/checkbox.test.js +285 -0
- package/src/html/chip.css +230 -19
- package/src/html/chip.example.js +355 -0
- package/src/html/chip.js +321 -25
- package/src/html/chip.test.js +425 -0
- package/src/html/color.css +435 -6
- package/src/html/color.example.js +527 -0
- package/src/html/color.js +458 -9
- package/src/html/color.test.js +362 -4
- package/src/html/components.example.js +492 -0
- package/src/html/components_enhanced.test.js +581 -0
- package/src/html/form.css +70 -3
- package/src/html/form.example.js +385 -0
- package/src/html/form.js +232 -34
- package/src/html/form.test.js +369 -0
- package/src/html/header2.css +264 -0
- package/src/html/header2.example.js +411 -0
- package/src/html/header2.js +203 -0
- package/src/html/header2.test.js +377 -0
- package/src/html/icon.css +20 -2
- package/src/html/icon.example.js +268 -0
- package/src/html/icon.js +86 -16
- package/src/html/icon.test.js +231 -0
- package/src/html/index.js +1 -1
- package/src/html/list.css +393 -1
- package/src/html/list.example.js +404 -0
- package/src/html/list.js +583 -40
- package/src/html/list.test.js +383 -0
- package/src/html/progress.css +707 -17
- package/src/html/progress.example.js +424 -0
- package/src/html/progress.js +906 -9
- package/src/html/progress.test.js +313 -0
- package/src/html/property.css +399 -0
- package/src/html/property.example.js +553 -0
- package/src/html/property.js +393 -15
- package/src/html/property.test.js +351 -2
- package/src/html/radio-visual-test.js +289 -0
- package/src/html/radio.css +137 -11
- package/src/html/radio.example.js +389 -0
- package/src/html/radio.js +234 -10
- package/src/html/radio.test.js +318 -0
- package/src/html/section.example.js +99 -0
- package/src/html/section.js +40 -3
- package/src/html/section.test.js +131 -0
- package/src/html/selector.css +329 -3
- package/src/html/selector.js +369 -23
- package/src/html/switch-debug.js +197 -0
- package/src/html/switch-test-visual.js +294 -0
- package/src/html/switch.css +200 -0
- package/src/html/switch.example.js +461 -0
- package/src/html/switch.js +283 -23
- package/src/html/switch.test.js +355 -0
- package/src/html/tab.css +288 -0
- package/src/html/tab.example.js +446 -0
- package/src/html/tab.js +387 -22
- package/src/html/tab_enhanced.js +378 -0
- package/src/html/tab_enhanced.test.js +504 -0
- package/src/html/table2.css +576 -0
- package/src/html/table2.example.js +703 -0
- package/src/html/table2.js +1252 -0
- package/src/html/table2.migration.md +328 -0
- package/src/html/table2.test.js +582 -0
- package/src/html/text.css +375 -0
- package/src/html/text.js +311 -20
- package/src/html/textfield2.css +842 -0
- package/src/html/textfield2.example.js +499 -0
- package/src/html/textfield2.js +1130 -0
- package/src/html/textfield2.test.js +950 -0
- package/src/html/thumbnail.css +289 -2
- package/src/html/thumbnail.js +214 -9
- package/src/html/tokenfield.css +449 -1
- package/src/html/tokenfield.example.js +503 -0
- package/src/html/tokenfield.js +561 -56
- package/src/html/tokenfield.test.js +423 -0
- package/src/html/tooltip-positioning-demo.js +187 -0
- package/src/html/tooltip.css +25 -2
- package/src/html/tree.css +228 -0
- package/src/html/tree.example.js +475 -0
- package/src/html/tree.js +712 -28
- package/src/html/tree_enhanced.test.js +495 -0
- package/table2.test.js +454 -0
- package/src/html/button.tsx +0 -38
@@ -0,0 +1,355 @@
|
|
1
|
+
import React, { useState } from 'react'
|
2
|
+
import { Chip, Chips } from './chip'
|
3
|
+
|
4
|
+
/**
|
5
|
+
* Ejemplos de uso de los componentes Chip mejorados
|
6
|
+
*/
|
7
|
+
export const ChipExamples = () => {
|
8
|
+
const [selectedTags, setSelectedTags] = useState(['react', 'javascript'])
|
9
|
+
const [selectedCategories, setSelectedCategories] = useState(['frontend'])
|
10
|
+
const [filterChips, setFilterChips] = useState(['active', 'recent'])
|
11
|
+
|
12
|
+
const handleTagChange = (selectedIds) => {
|
13
|
+
setSelectedTags(selectedIds)
|
14
|
+
}
|
15
|
+
|
16
|
+
const handleCategoryChange = (selectedIds) => {
|
17
|
+
setSelectedCategories(selectedIds)
|
18
|
+
}
|
19
|
+
|
20
|
+
const handleFilterChange = (selectedIds) => {
|
21
|
+
setFilterChips(selectedIds)
|
22
|
+
}
|
23
|
+
|
24
|
+
const handleChipDelete = (id) => {
|
25
|
+
console.log(`Chip ${id} deleted`)
|
26
|
+
}
|
27
|
+
|
28
|
+
// Datos para chips
|
29
|
+
const tagItems = [
|
30
|
+
{ id: 'react', label: 'React', icon: 'code' },
|
31
|
+
{ id: 'javascript', label: 'JavaScript', icon: 'javascript' },
|
32
|
+
{ id: 'typescript', label: 'TypeScript', icon: 'code' },
|
33
|
+
{ id: 'css', label: 'CSS', icon: 'style' },
|
34
|
+
{ id: 'html', label: 'HTML', icon: 'html' },
|
35
|
+
{ id: 'nodejs', label: 'Node.js', icon: 'dns' }
|
36
|
+
]
|
37
|
+
|
38
|
+
const categoryItems = [
|
39
|
+
{ id: 'frontend', label: 'Frontend', variant: 'primary' },
|
40
|
+
{ id: 'backend', label: 'Backend', variant: 'secondary' },
|
41
|
+
{ id: 'mobile', label: 'Mobile', variant: 'success' },
|
42
|
+
{ id: 'desktop', label: 'Desktop', variant: 'warning' },
|
43
|
+
{ id: 'devops', label: 'DevOps', variant: 'error' }
|
44
|
+
]
|
45
|
+
|
46
|
+
const filterItems = [
|
47
|
+
{ id: 'active', label: 'Activos', deletable: true },
|
48
|
+
{ id: 'recent', label: 'Recientes', deletable: true },
|
49
|
+
{ id: 'popular', label: 'Populares', deletable: true },
|
50
|
+
{ id: 'archived', label: 'Archivados', deletable: true }
|
51
|
+
]
|
52
|
+
|
53
|
+
return (
|
54
|
+
<div style={{ padding: '2rem', maxWidth: '1000px', overflow: 'auto', maxHeight: '100vh' }}>
|
55
|
+
<h1>Ejemplos de Componentes Chip Mejorados</h1>
|
56
|
+
|
57
|
+
<div style={{
|
58
|
+
background: '#f8f9fa',
|
59
|
+
padding: '1rem',
|
60
|
+
borderRadius: '8px',
|
61
|
+
marginBottom: '2rem',
|
62
|
+
border: '1px solid #e9ecef'
|
63
|
+
}}>
|
64
|
+
<h3>✅ Mejoras Implementadas:</h3>
|
65
|
+
<ul>
|
66
|
+
<li>🛡️ <strong>Validación de props</strong> - Advertencias para props incorrectas</li>
|
67
|
+
<li>♿ <strong>Accesibilidad completa</strong> - ARIA, soporte de teclado, focus</li>
|
68
|
+
<li>📝 <strong>PropTypes y documentación</strong> - Validación y documentación completa</li>
|
69
|
+
<li>🎯 <strong>Estados avanzados</strong> - disabled, deletable, variants</li>
|
70
|
+
<li>🎨 <strong>CSS mejorado</strong> - Estados visuales consistentes y responsivos</li>
|
71
|
+
<li>⌨️ <strong>Soporte de teclado</strong> - Enter, Espacio, Delete para interactuar</li>
|
72
|
+
<li>📏 <strong>Tamaños múltiples</strong> - small, normal, large</li>
|
73
|
+
<li>🎨 <strong>Variantes de color</strong> - default, primary, secondary, success, warning, error</li>
|
74
|
+
<li>🗑️ <strong>Chips deletables</strong> - Con icono de eliminar integrado</li>
|
75
|
+
<li>👥 <strong>Chips container mejorado</strong> - Manejo de selección múltiple</li>
|
76
|
+
<li>🧪 <strong>Pruebas unitarias</strong> - 18 pruebas que cubren toda la funcionalidad</li>
|
77
|
+
</ul>
|
78
|
+
</div>
|
79
|
+
|
80
|
+
{/* Chips básicos */}
|
81
|
+
<section style={{ marginBottom: '2rem' }}>
|
82
|
+
<h3>Chips Básicos</h3>
|
83
|
+
<div style={{
|
84
|
+
background: '#fff',
|
85
|
+
padding: '1.5rem',
|
86
|
+
borderRadius: '8px',
|
87
|
+
border: '1px solid #ddd'
|
88
|
+
}}>
|
89
|
+
<div style={{ display: 'flex', flexWrap: 'wrap', gap: '0.5rem', marginBottom: '1rem' }}>
|
90
|
+
<Chip label="Normal" />
|
91
|
+
<Chip label="Outlined" outlined={true} />
|
92
|
+
<Chip label="Selected" selected={true} />
|
93
|
+
<Chip label="Con Icono" icon="star" />
|
94
|
+
<Chip icon="favorite" ariaLabel="Favorito" />
|
95
|
+
<Chip label="Deletable" deletable={true} onDelete={handleChipDelete} />
|
96
|
+
<Chip label="Disabled" disabled={true} />
|
97
|
+
</div>
|
98
|
+
</div>
|
99
|
+
</section>
|
100
|
+
|
101
|
+
{/* Diferentes tamaños */}
|
102
|
+
<section style={{ marginBottom: '2rem' }}>
|
103
|
+
<h3>Diferentes Tamaños</h3>
|
104
|
+
<div style={{
|
105
|
+
background: '#fff',
|
106
|
+
padding: '1.5rem',
|
107
|
+
borderRadius: '8px',
|
108
|
+
border: '1px solid #ddd'
|
109
|
+
}}>
|
110
|
+
<div style={{ display: 'flex', alignItems: 'center', flexWrap: 'wrap', gap: '0.5rem' }}>
|
111
|
+
<Chip label="Pequeño" size="small" />
|
112
|
+
<Chip label="Normal" size="normal" />
|
113
|
+
<Chip label="Grande" size="large" />
|
114
|
+
</div>
|
115
|
+
</div>
|
116
|
+
</section>
|
117
|
+
|
118
|
+
{/* Variantes de color */}
|
119
|
+
<section style={{ marginBottom: '2rem' }}>
|
120
|
+
<h3>Variantes de Color</h3>
|
121
|
+
<div style={{
|
122
|
+
background: '#fff',
|
123
|
+
padding: '1.5rem',
|
124
|
+
borderRadius: '8px',
|
125
|
+
border: '1px solid #ddd'
|
126
|
+
}}>
|
127
|
+
<div style={{ display: 'flex', flexWrap: 'wrap', gap: '0.5rem' }}>
|
128
|
+
<Chip label="Default" variant="default" />
|
129
|
+
<Chip label="Primary" variant="primary" />
|
130
|
+
<Chip label="Secondary" variant="secondary" />
|
131
|
+
<Chip label="Success" variant="success" />
|
132
|
+
<Chip label="Warning" variant="warning" />
|
133
|
+
<Chip label="Error" variant="error" />
|
134
|
+
</div>
|
135
|
+
</div>
|
136
|
+
</section>
|
137
|
+
|
138
|
+
{/* Chips con selección múltiple */}
|
139
|
+
<section style={{ marginBottom: '2rem' }}>
|
140
|
+
<h3>Tags de Tecnología (Selección Múltiple)</h3>
|
141
|
+
<div style={{
|
142
|
+
background: '#fff',
|
143
|
+
padding: '1.5rem',
|
144
|
+
borderRadius: '8px',
|
145
|
+
border: '1px solid #ddd',
|
146
|
+
}}>
|
147
|
+
<Chips
|
148
|
+
items={tagItems}
|
149
|
+
selected={selectedTags}
|
150
|
+
multiSelect={true}
|
151
|
+
onChange={handleTagChange}
|
152
|
+
size="normal"
|
153
|
+
/>
|
154
|
+
<p style={{ marginTop: '1rem', fontSize: '0.9rem', color: '#666' }}>
|
155
|
+
<strong>Seleccionados:</strong> {selectedTags.join(', ') || 'Ninguno'}
|
156
|
+
</p>
|
157
|
+
</div>
|
158
|
+
</section>
|
159
|
+
|
160
|
+
{/* Chips con selección única */}
|
161
|
+
<section style={{ marginBottom: '2rem' }}>
|
162
|
+
<h3>Categorías (Selección Única)</h3>
|
163
|
+
<div style={{
|
164
|
+
background: '#fff',
|
165
|
+
padding: '1.5rem',
|
166
|
+
borderRadius: '8px',
|
167
|
+
border: '1px solid #ddd'
|
168
|
+
}}>
|
169
|
+
<Chips
|
170
|
+
items={categoryItems}
|
171
|
+
selected={selectedCategories}
|
172
|
+
multiSelect={false}
|
173
|
+
onChange={handleCategoryChange}
|
174
|
+
size="normal"
|
175
|
+
/>
|
176
|
+
<p style={{ marginTop: '1rem', fontSize: '0.9rem', color: '#666' }}>
|
177
|
+
<strong>Categoría seleccionada:</strong> {selectedCategories[0] || 'Ninguna'}
|
178
|
+
</p>
|
179
|
+
</div>
|
180
|
+
</section>
|
181
|
+
|
182
|
+
{/* Chips deletables */}
|
183
|
+
<section style={{ marginBottom: '2rem' }}>
|
184
|
+
<h3>Filtros (Deletables)</h3>
|
185
|
+
<div style={{
|
186
|
+
background: '#fff',
|
187
|
+
padding: '1.5rem',
|
188
|
+
borderRadius: '8px',
|
189
|
+
border: '1px solid #ddd'
|
190
|
+
}}>
|
191
|
+
<Chips
|
192
|
+
items={filterItems}
|
193
|
+
selected={filterChips}
|
194
|
+
multiSelect={true}
|
195
|
+
deletable={true}
|
196
|
+
onChange={handleFilterChange}
|
197
|
+
onDelete={handleChipDelete}
|
198
|
+
size="normal"
|
199
|
+
/>
|
200
|
+
<p style={{ marginTop: '1rem', fontSize: '0.9rem', color: '#666' }}>
|
201
|
+
<strong>Filtros activos:</strong> {filterChips.join(', ') || 'Ninguno'}
|
202
|
+
</p>
|
203
|
+
<p style={{ fontSize: '0.8rem', color: '#888' }}>
|
204
|
+
Usa el icono X para eliminar filtros, o las teclas Delete/Backspace cuando están enfocados.
|
205
|
+
</p>
|
206
|
+
</div>
|
207
|
+
</section>
|
208
|
+
|
209
|
+
{/* Chips individuales con diferentes configuraciones */}
|
210
|
+
<section style={{ marginBottom: '2rem' }}>
|
211
|
+
<h3>Configuraciones Especiales</h3>
|
212
|
+
<div style={{
|
213
|
+
background: '#fff',
|
214
|
+
padding: '1.5rem',
|
215
|
+
borderRadius: '8px',
|
216
|
+
border: '1px solid #ddd'
|
217
|
+
}}>
|
218
|
+
<div style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fit, minmax(250px, 1fr))', gap: '1rem' }}>
|
219
|
+
<div>
|
220
|
+
<h4>Con Tooltip</h4>
|
221
|
+
<Chip
|
222
|
+
label="Hover me"
|
223
|
+
tooltip={{ content: 'Este es un tooltip informativo' }}
|
224
|
+
/>
|
225
|
+
</div>
|
226
|
+
<div>
|
227
|
+
<h4>Con Acción</h4>
|
228
|
+
<Chip
|
229
|
+
label="Con Badge"
|
230
|
+
action={<span style={{
|
231
|
+
background: '#dc3545',
|
232
|
+
color: 'white',
|
233
|
+
borderRadius: '50%',
|
234
|
+
padding: '0.125rem 0.25rem',
|
235
|
+
fontSize: '0.7rem'
|
236
|
+
}}>5</span>}
|
237
|
+
/>
|
238
|
+
</div>
|
239
|
+
<div>
|
240
|
+
<h4>Outlined + Selected</h4>
|
241
|
+
<Chip
|
242
|
+
label="Outlined Selected"
|
243
|
+
outlined={true}
|
244
|
+
selected={true}
|
245
|
+
icon="check_circle"
|
246
|
+
/>
|
247
|
+
</div>
|
248
|
+
<div>
|
249
|
+
<h4>Large + Deletable</h4>
|
250
|
+
<Chip
|
251
|
+
label="Large Deletable"
|
252
|
+
size="large"
|
253
|
+
deletable={true}
|
254
|
+
variant="primary"
|
255
|
+
onDelete={handleChipDelete}
|
256
|
+
/>
|
257
|
+
</div>
|
258
|
+
</div>
|
259
|
+
</div>
|
260
|
+
</section>
|
261
|
+
|
262
|
+
{/* Demostración de accesibilidad */}
|
263
|
+
<section style={{ marginBottom: '2rem' }}>
|
264
|
+
<h3>Demostración de Accesibilidad</h3>
|
265
|
+
<div style={{
|
266
|
+
background: '#e8f5e8',
|
267
|
+
padding: '1rem',
|
268
|
+
borderRadius: '4px',
|
269
|
+
border: '1px solid #c8e6c9'
|
270
|
+
}}>
|
271
|
+
<p><strong>Prueba la accesibilidad:</strong></p>
|
272
|
+
<ol>
|
273
|
+
<li>Usa <kbd>Tab</kbd> para navegar entre chips</li>
|
274
|
+
<li>Usa <kbd>Enter</kbd> o <kbd>Espacio</kbd> para seleccionar/deseleccionar</li>
|
275
|
+
<li>Usa <kbd>Delete</kbd> o <kbd>Backspace</kbd> para eliminar chips deletables</li>
|
276
|
+
<li>Observa los indicadores de focus</li>
|
277
|
+
<li>Los lectores de pantalla anunciarán el estado y etiquetas</li>
|
278
|
+
</ol>
|
279
|
+
|
280
|
+
<div style={{ display: 'flex', flexWrap: 'wrap', gap: '0.5rem', marginTop: '1rem' }}>
|
281
|
+
<Chip label="Chip Accesible 1" onSelect={() => {}} />
|
282
|
+
<Chip label="Chip Accesible 2" onSelect={() => {}} />
|
283
|
+
<Chip label="Deletable" deletable={true} onDelete={handleChipDelete} />
|
284
|
+
<Chip icon="accessibility" ariaLabel="Configuración de accesibilidad" />
|
285
|
+
</div>
|
286
|
+
</div>
|
287
|
+
</section>
|
288
|
+
|
289
|
+
{/* Comparación antes/después */}
|
290
|
+
<section style={{ marginBottom: '2rem' }}>
|
291
|
+
<h3>Comparación: Antes vs Después</h3>
|
292
|
+
<div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: '1rem' }}>
|
293
|
+
<div style={{
|
294
|
+
background: '#ffebee',
|
295
|
+
padding: '1rem',
|
296
|
+
borderRadius: '4px',
|
297
|
+
border: '1px solid #ffcdd2'
|
298
|
+
}}>
|
299
|
+
<h4>❌ Antes</h4>
|
300
|
+
<ul>
|
301
|
+
<li>Sin validación de props</li>
|
302
|
+
<li>Sin accesibilidad</li>
|
303
|
+
<li>Manejo limitado de eventos</li>
|
304
|
+
<li>Sin estados avanzados</li>
|
305
|
+
<li>Chips container básico</li>
|
306
|
+
<li>Sin tamaños múltiples</li>
|
307
|
+
<li>Prop action confusa</li>
|
308
|
+
<li>Sin modo deletable</li>
|
309
|
+
<li>CSS hardcodeado</li>
|
310
|
+
</ul>
|
311
|
+
</div>
|
312
|
+
<div style={{
|
313
|
+
background: '#e8f5e8',
|
314
|
+
padding: '1rem',
|
315
|
+
borderRadius: '4px',
|
316
|
+
border: '1px solid #c8e6c9'
|
317
|
+
}}>
|
318
|
+
<h4>✅ Después</h4>
|
319
|
+
<ul>
|
320
|
+
<li>PropTypes completos</li>
|
321
|
+
<li>Accesibilidad total</li>
|
322
|
+
<li>Eventos completos (click, keydown, focus)</li>
|
323
|
+
<li>Estados avanzados (disabled, deletable)</li>
|
324
|
+
<li>Chips container inteligente</li>
|
325
|
+
<li>Tamaños small, normal, large</li>
|
326
|
+
<li>Props claras y consistentes</li>
|
327
|
+
<li>Modo deletable integrado</li>
|
328
|
+
<li>CSS con variables y temas</li>
|
329
|
+
</ul>
|
330
|
+
</div>
|
331
|
+
</div>
|
332
|
+
</section>
|
333
|
+
|
334
|
+
{/* Estado actual */}
|
335
|
+
<section>
|
336
|
+
<h3>Estado Actual de Selecciones</h3>
|
337
|
+
<pre style={{
|
338
|
+
background: '#f8f9fa',
|
339
|
+
padding: '1rem',
|
340
|
+
borderRadius: '4px',
|
341
|
+
fontSize: '0.9rem',
|
342
|
+
overflow: 'auto'
|
343
|
+
}}>
|
344
|
+
{JSON.stringify({
|
345
|
+
tags: selectedTags,
|
346
|
+
categories: selectedCategories,
|
347
|
+
filters: filterChips
|
348
|
+
}, null, 2)}
|
349
|
+
</pre>
|
350
|
+
</section>
|
351
|
+
</div>
|
352
|
+
)
|
353
|
+
}
|
354
|
+
|
355
|
+
export default ChipExamples
|