ywana-core8 0.1.78 → 0.1.80

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.
Files changed (63) hide show
  1. package/dist/index.cjs +3244 -2215
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.css +2127 -1063
  4. package/dist/index.css.map +1 -1
  5. package/dist/index.modern.js +3244 -2215
  6. package/dist/index.modern.js.map +1 -1
  7. package/dist/index.umd.js +3244 -2215
  8. package/dist/index.umd.js.map +1 -1
  9. package/package.json +1 -1
  10. package/src/html/ExampleLayout.css +401 -0
  11. package/src/html/ExampleLayout.js +192 -0
  12. package/src/html/README-sidebar-navigation.md +195 -0
  13. package/src/html/accordion.example.js +123 -4
  14. package/src/html/accordion.example.js.backup +390 -0
  15. package/src/html/button.example.js +50 -3
  16. package/src/html/button.example.js.backup +374 -0
  17. package/src/html/button.example.new.js +416 -0
  18. package/src/html/checkbox.example.js +93 -4
  19. package/src/html/checkbox.example.js.backup +316 -0
  20. package/src/html/chip.example.js +108 -4
  21. package/src/html/chip.example.js.backup +355 -0
  22. package/src/html/color.example.js +108 -4
  23. package/src/html/color.example.js.backup +527 -0
  24. package/src/html/components.example.js +123 -4
  25. package/src/html/components.example.js.backup +492 -0
  26. package/src/html/convert-examples.js +183 -0
  27. package/src/html/demo-sidebar.html +410 -0
  28. package/src/html/form.example.js +93 -4
  29. package/src/html/form.example.js.backup +385 -0
  30. package/src/html/header2.example.js +108 -4
  31. package/src/html/header2.example.js.backup +411 -0
  32. package/src/html/icon.example.js +77 -3
  33. package/src/html/icon.example.js.backup +268 -0
  34. package/src/html/list.example.js +93 -4
  35. package/src/html/list.example.js.backup +404 -0
  36. package/src/html/progress.example.js +74 -4
  37. package/src/html/progress.example.js.backup +424 -0
  38. package/src/html/property.example.js +123 -4
  39. package/src/html/property.example.js.backup +553 -0
  40. package/src/html/radio.example.js +108 -4
  41. package/src/html/radio.example.js.backup +389 -0
  42. package/src/html/section.example.js +42 -3
  43. package/src/html/section.example.js.backup +99 -0
  44. package/src/html/switch.example.js +108 -4
  45. package/src/html/switch.example.js.backup +461 -0
  46. package/src/html/tab.example.js +93 -4
  47. package/src/html/tab.example.js.backup +446 -0
  48. package/src/html/table-export-utils.js +483 -0
  49. package/src/html/table-summary-functions.js +363 -0
  50. package/src/html/table2.css +1496 -432
  51. package/src/html/table2.example.js +2937 -512
  52. package/src/html/table2.example.js.broken +1226 -0
  53. package/src/html/table2.js +1426 -1000
  54. package/src/html/test-resize.html +279 -0
  55. package/src/html/test-selection.html +387 -0
  56. package/src/html/textfield2.example.js +108 -4
  57. package/src/html/textfield2.example.js.backup +1370 -0
  58. package/src/html/tokenfield.example.js +108 -4
  59. package/src/html/tokenfield.example.js.backup +503 -0
  60. package/src/html/tree.css +2 -4
  61. package/src/html/tree.example.js +93 -4
  62. package/src/html/tree.example.js.backup +475 -0
  63. package/src/html/tree.js +19 -3
@@ -0,0 +1,268 @@
1
+ import React, { useState } from 'react'
2
+ import { Icon } from './icon'
3
+
4
+ /**
5
+ * Ejemplos de uso del componente Icon mejorado
6
+ */
7
+ export const IconExamples = () => {
8
+ const [clickCount, setClickCount] = useState(0)
9
+ const [isDisabled, setIsDisabled] = useState(false)
10
+
11
+ const handleClick = () => {
12
+ setClickCount(prev => prev + 1)
13
+ }
14
+
15
+ const toggleDisabled = () => {
16
+ setIsDisabled(prev => !prev)
17
+ }
18
+
19
+ return (
20
+ <div style={{ padding: '2rem', maxWidth: '800px' }}>
21
+ <h1>Ejemplos del Componente Icon Mejorado</h1>
22
+
23
+ <div style={{
24
+ background: '#f8f9fa',
25
+ padding: '1rem',
26
+ borderRadius: '8px',
27
+ marginBottom: '2rem',
28
+ border: '1px solid #e9ecef'
29
+ }}>
30
+ <h3>✅ Mejoras Implementadas:</h3>
31
+ <ul>
32
+ <li>🛡️ <strong>Manejo seguro de className</strong> - No falla con valores undefined</li>
33
+ <li>♿ <strong>Accesibilidad mejorada</strong> - Atributos ARIA y soporte de teclado</li>
34
+ <li>📝 <strong>PropTypes y documentación</strong> - Validación y documentación completa</li>
35
+ <li>🎯 <strong>Validación de props</strong> - Advertencias para props requeridos</li>
36
+ <li>🎨 <strong>CSS mejorado</strong> - Cursor consistente y estados de focus</li>
37
+ <li>⌨️ <strong>Soporte de teclado</strong> - Enter y Espacio para activar</li>
38
+ <li>🧪 <strong>Pruebas unitarias</strong> - 11 pruebas que cubren toda la funcionalidad</li>
39
+ </ul>
40
+ </div>
41
+
42
+ {/* Iconos básicos */}
43
+ <section style={{ marginBottom: '2rem' }}>
44
+ <h3>Iconos Básicos</h3>
45
+ <div style={{ display: 'flex', gap: '1rem', alignItems: 'center' }}>
46
+ <Icon icon="home" />
47
+ <Icon icon="settings" />
48
+ <Icon icon="favorite" />
49
+ <Icon icon="info" />
50
+ </div>
51
+ <p><em>Iconos simples sin interacción</em></p>
52
+ </section>
53
+
54
+ {/* Diferentes tamaños */}
55
+ <section style={{ marginBottom: '2rem' }}>
56
+ <h3>Diferentes Tamaños</h3>
57
+ <div style={{ display: 'flex', gap: '1rem', alignItems: 'center' }}>
58
+ <Icon icon="star" size="small" />
59
+ <Icon icon="star" size="normal" />
60
+ <Icon icon="star" size="large" />
61
+ </div>
62
+ <p><em>Tamaños: small, normal, large</em></p>
63
+ </section>
64
+
65
+ {/* Iconos clickables */}
66
+ <section style={{ marginBottom: '2rem' }}>
67
+ <h3>Iconos Clickables</h3>
68
+ <div style={{ display: 'flex', gap: '1rem', alignItems: 'center' }}>
69
+ <Icon
70
+ icon="thumb_up"
71
+ clickable
72
+ action={handleClick}
73
+ tooltip={{
74
+ text: 'Hacer clic para incrementar',
75
+ top: '-3rem',
76
+ left: '-2rem'
77
+ }}
78
+ />
79
+ <Icon
80
+ icon="refresh"
81
+ clickable
82
+ action={() => setClickCount(0)}
83
+ tooltip={{
84
+ text: 'Resetear contador',
85
+ top: '-3rem',
86
+ left: '-2rem'
87
+ }}
88
+ />
89
+ <span>Clics: {clickCount}</span>
90
+ </div>
91
+ <p><em>Prueba hacer clic en los iconos o usar Enter/Espacio cuando tengan focus</em></p>
92
+ </section>
93
+
94
+ {/* Estados disabled */}
95
+ <section style={{ marginBottom: '2rem' }}>
96
+ <h3>Estados Disabled</h3>
97
+ <div style={{ display: 'flex', gap: '1rem', alignItems: 'center' }}>
98
+ <Icon
99
+ icon="toggle_on"
100
+ clickable
101
+ action={toggleDisabled}
102
+ tooltip={{
103
+ text: 'Alternar estado disabled',
104
+ top: '-3rem',
105
+ left: '-3rem'
106
+ }}
107
+ />
108
+ <Icon
109
+ icon="delete"
110
+ clickable
111
+ disabled={isDisabled}
112
+ action={() => alert('¡Eliminado!')}
113
+ tooltip={{
114
+ text: isDisabled ? 'Icono deshabilitado' : 'Eliminar elemento',
115
+ top: '-3rem',
116
+ left: '-2rem'
117
+ }}
118
+ />
119
+ <span>Estado: {isDisabled ? 'Disabled' : 'Enabled'}</span>
120
+ </div>
121
+ <p><em>El primer icono alterna el estado del segundo</em></p>
122
+ </section>
123
+
124
+ {/* Iconos con tooltips */}
125
+ <section style={{ marginBottom: '2rem' }}>
126
+ <h3>Iconos con Tooltips</h3>
127
+ <div style={{ display: 'flex', gap: '1rem', alignItems: 'center' }}>
128
+ <Icon
129
+ icon="help"
130
+ clickable
131
+ tooltip={{
132
+ text: 'Ayuda y soporte',
133
+ top: '-3rem',
134
+ left: '-2rem'
135
+ }}
136
+ action={() => alert('¡Ayuda!')}
137
+ />
138
+ <Icon
139
+ icon="download"
140
+ clickable
141
+ tooltip={{
142
+ text: 'Descargar archivo',
143
+ top: '-3rem',
144
+ left: '-2rem'
145
+ }}
146
+ action={() => alert('¡Descargando!')}
147
+ />
148
+ <Icon
149
+ icon="share"
150
+ clickable
151
+ tooltip={{
152
+ text: 'Compartir contenido',
153
+ top: '-3rem',
154
+ left: '-2rem'
155
+ }}
156
+ action={() => alert('¡Compartiendo!')}
157
+ />
158
+ </div>
159
+ <p><em>Tooltips posicionados para no interferir con los clics</em></p>
160
+ </section>
161
+
162
+ {/* Accesibilidad */}
163
+ <section style={{ marginBottom: '2rem' }}>
164
+ <h3>Accesibilidad Mejorada</h3>
165
+ <div style={{ display: 'flex', gap: '1rem', alignItems: 'center' }}>
166
+ <Icon
167
+ icon="accessibility"
168
+ clickable
169
+ ariaLabel="Configuración de accesibilidad"
170
+ action={() => alert('Configuración de accesibilidad')}
171
+ />
172
+ <Icon
173
+ icon="visibility"
174
+ clickable
175
+ ariaLabel="Alternar visibilidad"
176
+ action={() => alert('Visibilidad alternada')}
177
+ />
178
+ <Icon
179
+ icon="hearing"
180
+ clickable
181
+ ariaLabel="Configuración de audio"
182
+ action={() => alert('Configuración de audio')}
183
+ />
184
+ </div>
185
+ <p><em>Iconos con etiquetas ARIA personalizadas y soporte completo de teclado</em></p>
186
+ </section>
187
+
188
+ {/* Clases personalizadas */}
189
+ <section style={{ marginBottom: '2rem' }}>
190
+ <h3>Clases CSS Personalizadas</h3>
191
+ <div style={{ display: 'flex', gap: '1rem', alignItems: 'center' }}>
192
+ <Icon
193
+ icon="palette"
194
+ className="custom-icon-style"
195
+ style={{ color: '#e91e63' }}
196
+ />
197
+ <Icon
198
+ icon="brush"
199
+ className="another-custom-class"
200
+ style={{ color: '#2196f3' }}
201
+ />
202
+ <Icon
203
+ icon="color_lens"
204
+ className={undefined} // Manejo seguro de undefined
205
+ style={{ color: '#4caf50' }}
206
+ />
207
+ </div>
208
+ <p><em>Manejo seguro de className, incluso con valores undefined</em></p>
209
+ </section>
210
+
211
+ {/* Demostración de validación */}
212
+ <section style={{ marginBottom: '2rem' }}>
213
+ <h3>Validación de Props</h3>
214
+ <div style={{
215
+ background: '#fff3cd',
216
+ padding: '1rem',
217
+ borderRadius: '4px',
218
+ border: '1px solid #ffeaa7'
219
+ }}>
220
+ <p><strong>Prueba en la consola del navegador:</strong></p>
221
+ <p>El componente ahora valida que la prop <code>icon</code> sea requerida y muestra advertencias apropiadas.</p>
222
+ <p>También valida tipos de props en desarrollo para detectar errores temprano.</p>
223
+ </div>
224
+ </section>
225
+
226
+ {/* Comparación antes/después */}
227
+ <section>
228
+ <h3>Comparación: Antes vs Después</h3>
229
+ <div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: '1rem' }}>
230
+ <div style={{
231
+ background: '#ffebee',
232
+ padding: '1rem',
233
+ borderRadius: '4px',
234
+ border: '1px solid #ffcdd2'
235
+ }}>
236
+ <h4>❌ Antes</h4>
237
+ <ul>
238
+ <li>className undefined causaba errores</li>
239
+ <li>Sin validación de props</li>
240
+ <li>Sin accesibilidad</li>
241
+ <li>Sin soporte de teclado</li>
242
+ <li>Cursor inconsistente</li>
243
+ <li>Sin documentación</li>
244
+ </ul>
245
+ </div>
246
+ <div style={{
247
+ background: '#e8f5e8',
248
+ padding: '1rem',
249
+ borderRadius: '4px',
250
+ border: '1px solid #c8e6c9'
251
+ }}>
252
+ <h4>✅ Después</h4>
253
+ <ul>
254
+ <li>Manejo seguro de todas las props</li>
255
+ <li>PropTypes completos</li>
256
+ <li>Atributos ARIA apropiados</li>
257
+ <li>Soporte completo de teclado</li>
258
+ <li>Estados visuales consistentes</li>
259
+ <li>Documentación y ejemplos</li>
260
+ </ul>
261
+ </div>
262
+ </div>
263
+ </section>
264
+ </div>
265
+ )
266
+ }
267
+
268
+ export default IconExamples
@@ -1,7 +1,8 @@
1
1
  import React, { useState } from 'react'
2
2
  import { List } from './list'
3
3
  import { Button } from './button'
4
- import { Icon } from './icon'
4
+ import { Icon } from '
5
+ import { ExampleLayout, ExampleSection, ExampleSubsection, CodeSnippet } from './ExampleLayout'./icon'
5
6
 
6
7
  /**
7
8
  * Ejemplos del componente List mejorado manteniendo 100% compatibilidad
@@ -81,9 +82,96 @@ export const ListExamples = () => {
81
82
  setTimeout(() => setIsLoading(false), 2000)
82
83
  }
83
84
 
85
+ // Definir secciones para el menú lateral
86
+
87
+
88
+ const sections =
89
+
90
+ [
91
+
92
+
93
+ {
94
+
95
+
96
+ "id": "overview",
97
+
98
+
99
+ "title": "Introducción",
100
+
101
+
102
+ "icon": "info"
103
+
104
+
105
+ },
106
+
107
+
108
+ {
109
+
110
+
111
+ "id": "basic-examples",
112
+
113
+
114
+ "title": "Ejemplos Básicos",
115
+
116
+
117
+ "icon": "widgets"
118
+
119
+
120
+ },
121
+
122
+
123
+ {
124
+
125
+
126
+ "id": "advanced-features",
127
+
128
+
129
+ "title": "Características Avanzadas",
130
+
131
+
132
+ "icon": "settings"
133
+
134
+
135
+ },
136
+
137
+
138
+ {
139
+
140
+
141
+ "id": "states",
142
+
143
+
144
+ "title": "Estados",
145
+
146
+
147
+ "icon": "toggle_on"
148
+
149
+
150
+ },
151
+
152
+
153
+ {
154
+
155
+
156
+ "id": "sizes",
157
+
158
+
159
+ "title": "Tamaños",
160
+
161
+
162
+ "icon": "format_size"
163
+
164
+
165
+ }
166
+
167
+
168
+ ]
169
+
170
+
171
+
84
172
  return (
85
- <div style={{ padding: '2rem', maxWidth: '1200px', maxHeight: '100vh', overflow: 'auto' }}>
86
- <h1>Componente List Mejorado</h1>
173
+ <ExampleLayout title="List Examples" sections={sections}>
174
+ <ExampleSection id="overview" title="Componente List Mejorado" icon="widgets">
87
175
 
88
176
  <div style={{
89
177
  background: '#f8f9fa',
@@ -397,7 +485,8 @@ export const ListExamples = () => {
397
485
  </p>
398
486
  </div>
399
487
  </section>
400
- </div>
488
+ </ExampleSection>
489
+ </ExampleLayout>
401
490
  )
402
491
  }
403
492