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.
Files changed (70) hide show
  1. package/dist/index.cjs +3493 -2320
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.css +2096 -1125
  4. package/dist/index.css.map +1 -1
  5. package/dist/index.modern.js +3493 -2320
  6. package/dist/index.modern.js.map +1 -1
  7. package/dist/index.umd.js +3493 -2320
  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/button.js +22 -4
  19. package/src/html/checkbox.example.js +93 -4
  20. package/src/html/checkbox.example.js.backup +316 -0
  21. package/src/html/chip.example.js +108 -4
  22. package/src/html/chip.example.js.backup +355 -0
  23. package/src/html/color.example.js +108 -4
  24. package/src/html/color.example.js.backup +527 -0
  25. package/src/html/components.example.js +123 -4
  26. package/src/html/components.example.js.backup +492 -0
  27. package/src/html/convert-examples.js +183 -0
  28. package/src/html/demo-sidebar.html +410 -0
  29. package/src/html/form.example.js +93 -4
  30. package/src/html/form.example.js.backup +385 -0
  31. package/src/html/header.js +20 -3
  32. package/src/html/header2.example.js +108 -4
  33. package/src/html/header2.example.js.backup +411 -0
  34. package/src/html/icon.example.js +77 -3
  35. package/src/html/icon.example.js.backup +268 -0
  36. package/src/html/list.example.js +93 -4
  37. package/src/html/list.example.js.backup +404 -0
  38. package/src/html/progress.example.js +74 -4
  39. package/src/html/progress.example.js.backup +424 -0
  40. package/src/html/property.example.js +123 -4
  41. package/src/html/property.example.js.backup +553 -0
  42. package/src/html/radio.example.js +108 -4
  43. package/src/html/radio.example.js.backup +389 -0
  44. package/src/html/section.example.js +42 -3
  45. package/src/html/section.example.js.backup +99 -0
  46. package/src/html/switch.example.js +108 -4
  47. package/src/html/switch.example.js.backup +461 -0
  48. package/src/html/tab.example.js +93 -4
  49. package/src/html/tab.example.js.backup +446 -0
  50. package/src/html/table-export-utils.js +483 -0
  51. package/src/html/table-summary-functions.js +363 -0
  52. package/src/html/table2.css +1449 -479
  53. package/src/html/table2.example.js +2937 -512
  54. package/src/html/table2.example.js.broken +1226 -0
  55. package/src/html/table2.js +1426 -1000
  56. package/src/html/test-resize.html +279 -0
  57. package/src/html/test-selection.html +387 -0
  58. package/src/html/textfield.js +73 -7
  59. package/src/html/textfield2.example.js +108 -4
  60. package/src/html/textfield2.example.js.backup +1370 -0
  61. package/src/html/textfield2.js +19 -4
  62. package/src/html/tokenfield.example.js +108 -4
  63. package/src/html/tokenfield.example.js.backup +503 -0
  64. package/src/html/tooltip.js +21 -3
  65. package/src/html/tree.css +2 -4
  66. package/src/html/tree.example.js +93 -4
  67. package/src/html/tree.example.js.backup +475 -0
  68. package/src/html/tree.js +19 -3
  69. package/src/widgets/login/LoginBox.css +1 -0
  70. package/src/widgets/login/LoginBox.js +29 -6
@@ -204,8 +204,23 @@ export const TextField2 = (props) => {
204
204
  ...restProps
205
205
  }
206
206
 
207
- // Label text
208
- const labelTxt = label ? <Text>{label}</Text> : null
207
+ // Label text - support both string and React components
208
+ const labelTxt = useMemo(() => {
209
+ if (!label) return null
210
+
211
+ // If label is already a React element, use it directly
212
+ if (React.isValidElement(label)) {
213
+ return label
214
+ }
215
+
216
+ // If label is a string, wrap it in Text component
217
+ if (typeof label === 'string') {
218
+ return <Text>{label}</Text>
219
+ }
220
+
221
+ // Fallback for other types (convert to string)
222
+ return <Text>{String(label)}</Text>
223
+ }, [label])
209
224
  const placeholderTxt = site?.translate ? site.translate(placeholder) : placeholder
210
225
 
211
226
  // Error/helper text
@@ -304,8 +319,8 @@ TextField2.propTypes = {
304
319
  type: PropTypes.oneOf(['text', 'email', 'password', 'number', 'tel', 'url', 'search', 'date', 'time', 'datetime-local', 'month', 'week', 'textarea']),
305
320
  /** Additional CSS classes */
306
321
  className: PropTypes.string,
307
- /** Field label */
308
- label: PropTypes.string,
322
+ /** Field label - can be string or React element */
323
+ label: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
309
324
  /** Label position */
310
325
  labelPosition: PropTypes.oneOf(['top', 'left']),
311
326
  /** Placeholder text */
@@ -1,7 +1,8 @@
1
1
  import React, { useState } from 'react'
2
2
  import { TokenField } from './tokenfield'
3
3
  import { Button } from './button'
4
- import { Text } from './text'
4
+ import { Text } from '
5
+ import { ExampleLayout, ExampleSection, ExampleSubsection, CodeSnippet } from './ExampleLayout'./text'
5
6
 
6
7
  /**
7
8
  * Ejemplos del componente TokenField mejorado manteniendo 100% compatibilidad
@@ -79,9 +80,111 @@ export const TokenFieldExamples = () => {
79
80
  setTimeout(() => setIsLoading(false), 2000)
80
81
  }
81
82
 
83
+ // Definir secciones para el menú lateral
84
+
85
+
86
+ const sections =
87
+
88
+ [
89
+
90
+
91
+ {
92
+
93
+
94
+ "id": "overview",
95
+
96
+
97
+ "title": "Introducción",
98
+
99
+
100
+ "icon": "info"
101
+
102
+
103
+ },
104
+
105
+
106
+ {
107
+
108
+
109
+ "id": "basic-examples",
110
+
111
+
112
+ "title": "Ejemplos Básicos",
113
+
114
+
115
+ "icon": "widgets"
116
+
117
+
118
+ },
119
+
120
+
121
+ {
122
+
123
+
124
+ "id": "advanced-features",
125
+
126
+
127
+ "title": "Características Avanzadas",
128
+
129
+
130
+ "icon": "settings"
131
+
132
+
133
+ },
134
+
135
+
136
+ {
137
+
138
+
139
+ "id": "variants",
140
+
141
+
142
+ "title": "Variantes y Temas",
143
+
144
+
145
+ "icon": "palette"
146
+
147
+
148
+ },
149
+
150
+
151
+ {
152
+
153
+
154
+ "id": "states",
155
+
156
+
157
+ "title": "Estados",
158
+
159
+
160
+ "icon": "toggle_on"
161
+
162
+
163
+ },
164
+
165
+
166
+ {
167
+
168
+
169
+ "id": "sizes",
170
+
171
+
172
+ "title": "Tamaños",
173
+
174
+
175
+ "icon": "format_size"
176
+
177
+
178
+ }
179
+
180
+
181
+ ]
182
+
183
+
184
+
82
185
  return (
83
- <div style={{ padding: '2rem', maxWidth: '1200px', maxHeight: '100vh', overflow: 'auto' }}>
84
- <h1>Componente TokenField Mejorado</h1>
186
+ <ExampleLayout title="Tokenfield Examples" sections={sections}>
187
+ <ExampleSection id="overview" title="Componente TokenField Mejorado" icon="widgets">
85
188
 
86
189
  <div style={{
87
190
  background: '#f8f9fa',
@@ -496,7 +599,8 @@ export const TokenFieldExamples = () => {
496
599
  </div>
497
600
  </div>
498
601
  </section>
499
- </div>
602
+ </ExampleSection>
603
+ </ExampleLayout>
500
604
  )
501
605
  }
502
606
 
@@ -0,0 +1,503 @@
1
+ import React, { useState } from 'react'
2
+ import { TokenField } from './tokenfield'
3
+ import { Button } from './button'
4
+ import { Text } from './text'
5
+
6
+ /**
7
+ * Ejemplos del componente TokenField mejorado manteniendo 100% compatibilidad
8
+ */
9
+ export const TokenFieldExamples = () => {
10
+ const [basicTokens, setBasicTokens] = useState(['React', 'JavaScript'])
11
+ const [tagTokens, setTagTokens] = useState(['frontend', 'ui', 'components'])
12
+ const [emailTokens, setEmailTokens] = useState(['user@example.com'])
13
+ const [skillTokens, setSkillTokens] = useState(['JavaScript'])
14
+ const [isLoading, setIsLoading] = useState(false)
15
+ const [showAdvanced, setShowAdvanced] = useState(false)
16
+
17
+ const skillOptions = [
18
+ { label: 'JavaScript', value: 'javascript' },
19
+ { label: 'TypeScript', value: 'typescript' },
20
+ { label: 'React', value: 'react' },
21
+ { label: 'Vue.js', value: 'vue' },
22
+ { label: 'Angular', value: 'angular' },
23
+ { label: 'Node.js', value: 'nodejs' },
24
+ { label: 'Python', value: 'python' },
25
+ { label: 'Java', value: 'java' },
26
+ { label: 'C++', value: 'cpp' },
27
+ { label: 'Go', value: 'go' }
28
+ ]
29
+
30
+ const categoryOptions = [
31
+ { label: 'Frontend', value: 'frontend' },
32
+ { label: 'Backend', value: 'backend' },
33
+ { label: 'Database', value: 'database' },
34
+ { label: 'DevOps', value: 'devops' },
35
+ { label: 'Mobile', value: 'mobile' },
36
+ { label: 'Testing', value: 'testing' }
37
+ ]
38
+
39
+ const handleBasicChange = (id, tokens) => {
40
+ setBasicTokens(tokens)
41
+ console.log('Basic tokens changed:', tokens)
42
+ }
43
+
44
+ const handleTagChange = (id, tokens) => {
45
+ setTagTokens(tokens)
46
+ console.log('Tag tokens changed:', tokens)
47
+ }
48
+
49
+ const handleEmailChange = (id, tokens) => {
50
+ setEmailTokens(tokens)
51
+ console.log('Email tokens changed:', tokens)
52
+ }
53
+
54
+ const handleSkillChange = (id, tokens) => {
55
+ setSkillTokens(tokens)
56
+ console.log('Skill tokens changed:', tokens)
57
+ }
58
+
59
+ const validateEmail = (token) => {
60
+ const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/
61
+ if (!emailRegex.test(token)) {
62
+ return { isValid: false, error: 'Invalid email format' }
63
+ }
64
+ return { isValid: true }
65
+ }
66
+
67
+ const validateTag = (token) => {
68
+ if (token.length < 2) {
69
+ return { isValid: false, error: 'Tag must be at least 2 characters' }
70
+ }
71
+ if (token.includes(' ')) {
72
+ return { isValid: false, error: 'Tags cannot contain spaces' }
73
+ }
74
+ return { isValid: true }
75
+ }
76
+
77
+ const simulateLoading = () => {
78
+ setIsLoading(true)
79
+ setTimeout(() => setIsLoading(false), 2000)
80
+ }
81
+
82
+ return (
83
+ <div style={{ padding: '2rem', maxWidth: '1200px', maxHeight: '100vh', overflow: 'auto' }}>
84
+ <h1>Componente TokenField Mejorado</h1>
85
+
86
+ <div style={{
87
+ background: '#f8f9fa',
88
+ padding: '1rem',
89
+ borderRadius: '8px',
90
+ marginBottom: '2rem',
91
+ border: '1px solid #e9ecef'
92
+ }}>
93
+ <h3>✅ Mejoras Implementadas (100% Compatibilidad):</h3>
94
+ <ul>
95
+ <li>🛡️ <strong>PropTypes completos</strong> - Validación y documentación detallada</li>
96
+ <li>🔢 <strong>Límites de tokens</strong> - minTokens, maxTokens con validación</li>
97
+ <li>🚫 <strong>Control de duplicados</strong> - allowDuplicates configurable</li>
98
+ <li>✅ <strong>Validación personalizada</strong> - validateToken function</li>
99
+ <li>⌨️ <strong>Separadores múltiples</strong> - comma, semicolon, enter</li>
100
+ <li>📏 <strong>Múltiples tamaños</strong> - small, medium, large</li>
101
+ <li>🎭 <strong>Variantes visuales</strong> - default, outlined, filled</li>
102
+ <li>⚠️ <strong>Estados avanzados</strong> - disabled, error, required, loading</li>
103
+ <li>🧹 <strong>Clear functionality</strong> - Botón para limpiar todos los tokens</li>
104
+ <li>🔍 <strong>Búsqueda en opciones</strong> - Filtrado en tiempo real</li>
105
+ <li>📊 <strong>Ordenamiento</strong> - Opciones ordenadas alfabéticamente</li>
106
+ <li>♿ <strong>Accesibilidad completa</strong> - ARIA, navegación por teclado</li>
107
+ <li>📱 <strong>Responsive total</strong> - Adaptación móvil y dark mode</li>
108
+ </ul>
109
+ </div>
110
+
111
+ {/* Controles de demostración */}
112
+ <section style={{ marginBottom: '2rem' }}>
113
+ <h3>Controles de Demostración</h3>
114
+ <div style={{
115
+ background: '#fff',
116
+ padding: '1rem',
117
+ borderRadius: '8px',
118
+ border: '1px solid #ddd',
119
+ display: 'flex',
120
+ gap: '1rem',
121
+ alignItems: 'center',
122
+ flexWrap: 'wrap'
123
+ }}>
124
+ <Button
125
+ label="Simulate Loading"
126
+ icon="refresh"
127
+ action={simulateLoading}
128
+ disabled={isLoading}
129
+ />
130
+ <Button
131
+ label={showAdvanced ? "Hide Advanced" : "Show Advanced"}
132
+ icon={showAdvanced ? "visibility_off" : "visibility"}
133
+ action={() => setShowAdvanced(!showAdvanced)}
134
+ />
135
+ <span style={{ marginLeft: 'auto', color: '#666' }}>
136
+ Total tokens: {basicTokens.length + tagTokens.length + emailTokens.length + skillTokens.length}
137
+ </span>
138
+ </div>
139
+ </section>
140
+
141
+ {/* TokenField básico (Compatible) */}
142
+ <section style={{ marginBottom: '2rem' }}>
143
+ <h3>🏷️ TokenField Básico (100% Compatible)</h3>
144
+ <div style={{
145
+ background: '#fff',
146
+ padding: '1rem',
147
+ border: '1px solid #ddd',
148
+ borderRadius: '8px'
149
+ }}>
150
+ <TokenField
151
+ id="basic"
152
+ label="Basic Tokens"
153
+ tokens={basicTokens}
154
+ onChange={handleBasicChange}
155
+ />
156
+ <Text size="sm" color="muted" style={{ marginTop: '0.5rem' }}>
157
+ Funcionalidad original: agregar tokens con Enter, eliminar con click
158
+ </Text>
159
+ </div>
160
+ </section>
161
+
162
+ {/* TokenField con opciones */}
163
+ <section style={{ marginBottom: '2rem' }}>
164
+ <h3>🎯 TokenField con Opciones (Compatible)</h3>
165
+ <div style={{
166
+ background: '#fff',
167
+ padding: '1rem',
168
+ border: '1px solid #ddd',
169
+ borderRadius: '8px'
170
+ }}>
171
+ <TokenField
172
+ id="skills"
173
+ label="Skills"
174
+ tokens={skillTokens}
175
+ options={skillOptions}
176
+ predictive={true}
177
+ onChange={handleSkillChange}
178
+ />
179
+ <Text size="sm" color="muted" style={{ marginTop: '0.5rem' }}>
180
+ Dropdown con opciones predefinidas y búsqueda predictiva
181
+ </Text>
182
+ </div>
183
+ </section>
184
+
185
+ {/* TokenField mejorado */}
186
+ <section style={{ marginBottom: '2rem' }}>
187
+ <h3>🚀 TokenField Mejorado con Nuevas Características</h3>
188
+ <div style={{
189
+ background: '#fff',
190
+ padding: '1rem',
191
+ border: '1px solid #ddd',
192
+ borderRadius: '8px',
193
+ display: 'grid',
194
+ gridTemplateColumns: '1fr 1fr',
195
+ gap: '1rem'
196
+ }}>
197
+ <TokenField
198
+ id="tags"
199
+ label="Tags"
200
+ tokens={tagTokens}
201
+ onChange={handleTagChange}
202
+ placeholder="Add tag..."
203
+ maxTokens={5}
204
+ minTokens={1}
205
+ allowDuplicates={false}
206
+ validateToken={validateTag}
207
+ tokenSeparators={[',', ';', ' ']}
208
+ size="medium"
209
+ variant="outlined"
210
+ clearable={true}
211
+ helperText="Max 5 tags, no duplicates, no spaces"
212
+ onTokenAdd={(token) => console.log('Tag added:', token)}
213
+ onTokenRemove={(token) => console.log('Tag removed:', token)}
214
+ onValidationError={(error, token) => console.log('Validation error:', error, token)}
215
+ />
216
+ <TokenField
217
+ id="emails"
218
+ label="Email Addresses"
219
+ tokens={emailTokens}
220
+ onChange={handleEmailChange}
221
+ placeholder="Add email..."
222
+ validateToken={validateEmail}
223
+ size="large"
224
+ variant="filled"
225
+ required={true}
226
+ helperText="Enter valid email addresses"
227
+ disabled={isLoading}
228
+ />
229
+ </div>
230
+ </section>
231
+
232
+ {/* Tamaños y variantes */}
233
+ <section style={{ marginBottom: '2rem' }}>
234
+ <h3>📏 Tamaños y Variantes</h3>
235
+ <div style={{
236
+ background: '#fff',
237
+ padding: '1rem',
238
+ border: '1px solid #ddd',
239
+ borderRadius: '8px',
240
+ display: 'grid',
241
+ gridTemplateColumns: '1fr 1fr 1fr',
242
+ gap: '1rem'
243
+ }}>
244
+ <TokenField
245
+ id="small"
246
+ label="Small Size"
247
+ tokens={['small', 'tokens']}
248
+ onChange={() => {}}
249
+ size="small"
250
+ variant="default"
251
+ placeholder="Small..."
252
+ />
253
+ <TokenField
254
+ id="medium"
255
+ label="Medium Size"
256
+ tokens={['medium', 'tokens']}
257
+ onChange={() => {}}
258
+ size="medium"
259
+ variant="outlined"
260
+ placeholder="Medium..."
261
+ />
262
+ <TokenField
263
+ id="large"
264
+ label="Large Size"
265
+ tokens={['large', 'tokens']}
266
+ onChange={() => {}}
267
+ size="large"
268
+ variant="filled"
269
+ placeholder="Large..."
270
+ />
271
+ </div>
272
+ </section>
273
+
274
+ {/* Estados especiales */}
275
+ <section style={{ marginBottom: '2rem' }}>
276
+ <h3>⚠️ Estados Especiales</h3>
277
+ <div style={{
278
+ background: '#fff',
279
+ padding: '1rem',
280
+ border: '1px solid #ddd',
281
+ borderRadius: '8px',
282
+ display: 'grid',
283
+ gridTemplateColumns: '1fr 1fr',
284
+ gap: '1rem'
285
+ }}>
286
+ <TokenField
287
+ id="required"
288
+ label="Required Field"
289
+ tokens={['required']}
290
+ onChange={() => {}}
291
+ required={true}
292
+ minTokens={1}
293
+ helperText="This field is required"
294
+ />
295
+ <TokenField
296
+ id="error"
297
+ label="Field with Error"
298
+ tokens={['invalid-token']}
299
+ onChange={() => {}}
300
+ error="Invalid token detected"
301
+ />
302
+ <TokenField
303
+ id="disabled"
304
+ label="Disabled Field"
305
+ tokens={['disabled', 'tokens']}
306
+ onChange={() => {}}
307
+ disabled={isLoading}
308
+ helperText="Field is disabled"
309
+ />
310
+ <TokenField
311
+ id="readonly"
312
+ label="Read-only Field"
313
+ tokens={['readonly', 'tokens']}
314
+ onChange={() => {}}
315
+ readOnly={true}
316
+ helperText="Field is read-only"
317
+ />
318
+ </div>
319
+ </section>
320
+
321
+ {/* Características avanzadas */}
322
+ {showAdvanced && (
323
+ <section style={{ marginBottom: '2rem' }}>
324
+ <h3>🔬 Características Avanzadas</h3>
325
+ <div style={{
326
+ background: '#fff',
327
+ padding: '1rem',
328
+ border: '1px solid #ddd',
329
+ borderRadius: '8px',
330
+ display: 'grid',
331
+ gridTemplateColumns: '1fr 1fr',
332
+ gap: '1rem'
333
+ }}>
334
+ <TokenField
335
+ id="searchable"
336
+ label="Searchable Options"
337
+ tokens={[]}
338
+ options={categoryOptions}
339
+ onChange={() => {}}
340
+ searchable={true}
341
+ sortable={true}
342
+ placeholder="Search categories..."
343
+ helperText="Type to search and filter options"
344
+ />
345
+ <TokenField
346
+ id="limits"
347
+ label="With Limits"
348
+ tokens={['token1', 'token2']}
349
+ onChange={() => {}}
350
+ maxTokens={3}
351
+ minTokens={2}
352
+ allowDuplicates={false}
353
+ clearable={false}
354
+ helperText="2-3 tokens, no duplicates"
355
+ />
356
+ </div>
357
+ </section>
358
+ )}
359
+
360
+ {/* Separadores y validación */}
361
+ {showAdvanced && (
362
+ <section style={{ marginBottom: '2rem' }}>
363
+ <h3>⌨️ Separadores y Validación</h3>
364
+ <div style={{
365
+ background: '#fff',
366
+ padding: '1rem',
367
+ border: '1px solid #ddd',
368
+ borderRadius: '8px'
369
+ }}>
370
+ <TokenField
371
+ id="separators"
372
+ label="Multiple Separators"
373
+ tokens={[]}
374
+ onChange={() => {}}
375
+ tokenSeparators={[',', ';', '|', '\n']}
376
+ placeholder="Use comma, semicolon, pipe, or enter..."
377
+ helperText="Try typing: token1,token2;token3|token4 and press enter"
378
+ />
379
+ <div style={{ marginTop: '1rem' }}>
380
+ <Text size="sm" color="muted">
381
+ <strong>Separadores soportados:</strong> Comma (,), Semicolon (;), Pipe (|), Enter
382
+ </Text>
383
+ </div>
384
+ </div>
385
+ </section>
386
+ )}
387
+
388
+ {/* Comparación antes/después */}
389
+ <section style={{ marginBottom: '2rem' }}>
390
+ <h3>Comparación: TokenField Original vs Mejorado</h3>
391
+ <div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: '1rem' }}>
392
+ <div style={{
393
+ background: '#ffebee',
394
+ padding: '1rem',
395
+ borderRadius: '4px',
396
+ border: '1px solid #ffcdd2'
397
+ }}>
398
+ <h4>❌ TokenField Original</h4>
399
+ <ul>
400
+ <li>Funcionalidad básica de tokens</li>
401
+ <li>Soporte para opciones dropdown</li>
402
+ <li>Búsqueda predictiva</li>
403
+ <li>Sin PropTypes ni validación</li>
404
+ <li>Sin límites de tokens</li>
405
+ <li>Sin validación personalizada</li>
406
+ <li>Sin estados avanzados</li>
407
+ <li>Sin accesibilidad</li>
408
+ <li>CSS básico sin responsive</li>
409
+ </ul>
410
+ </div>
411
+ <div style={{
412
+ background: '#e8f5e8',
413
+ padding: '1rem',
414
+ borderRadius: '4px',
415
+ border: '1px solid #c8e6c9'
416
+ }}>
417
+ <h4>✅ TokenField Mejorado</h4>
418
+ <ul>
419
+ <li>Mantiene funcionalidad original</li>
420
+ <li>PropTypes completos y validación</li>
421
+ <li>Límites min/max con advertencias</li>
422
+ <li>Validación personalizada de tokens</li>
423
+ <li>Múltiples separadores configurables</li>
424
+ <li>Estados disabled, error, required</li>
425
+ <li>Accesibilidad total (WCAG 2.1 AA)</li>
426
+ <li>Búsqueda y ordenamiento en opciones</li>
427
+ <li>CSS responsive con dark mode</li>
428
+ </ul>
429
+ </div>
430
+ </div>
431
+ </section>
432
+
433
+ {/* Garantía de compatibilidad */}
434
+ <section style={{ marginBottom: '2rem' }}>
435
+ <h3>🔒 Garantía de Compatibilidad</h3>
436
+ <div style={{
437
+ background: '#fff3cd',
438
+ padding: '1rem',
439
+ borderRadius: '4px',
440
+ border: '1px solid #ffeaa7'
441
+ }}>
442
+ <p><strong>100% Compatible con Código Existente:</strong></p>
443
+ <ul>
444
+ <li>✅ Props originales (id, label, tokens, readOnly, options, predictive, onChange) funcionan idéntico</li>
445
+ <li>✅ Comportamiento de onChange sin cambios</li>
446
+ <li>✅ Estructura de tokens y opciones preservada</li>
447
+ <li>✅ CSS original preservado y mejorado</li>
448
+ <li>✅ Nuevas características son opcionales</li>
449
+ <li>✅ No se rompe ningún código existente</li>
450
+ <li>✅ Migración automática sin cambios</li>
451
+ </ul>
452
+ <p style={{ marginTop: '1rem', fontSize: '0.9rem', color: '#856404' }}>
453
+ <strong>Migración:</strong> Simplemente reemplaza el import y todas las
454
+ mejoras se aplican automáticamente sin cambiar una línea de código existente.
455
+ </p>
456
+ </div>
457
+ </section>
458
+
459
+ {/* Casos de uso */}
460
+ <section style={{ marginBottom: '2rem' }}>
461
+ <h3>🎯 Casos de Uso Comunes</h3>
462
+ <div style={{
463
+ background: '#fff',
464
+ padding: '1rem',
465
+ border: '1px solid #ddd',
466
+ borderRadius: '8px',
467
+ display: 'grid',
468
+ gridTemplateColumns: '1fr 1fr',
469
+ gap: '1rem'
470
+ }}>
471
+ <div>
472
+ <h4>🏷️ Sistema de Tags</h4>
473
+ <TokenField
474
+ id="blog-tags"
475
+ label="Blog Tags"
476
+ tokens={['react', 'javascript']}
477
+ onChange={() => {}}
478
+ maxTokens={10}
479
+ allowDuplicates={false}
480
+ validateToken={(token) => token.length >= 2 ? { isValid: true } : { isValid: false, error: 'Too short' }}
481
+ placeholder="Add tags..."
482
+ helperText="Tags for blog post categorization"
483
+ />
484
+ </div>
485
+ <div>
486
+ <h4>👥 Gestión de Usuarios</h4>
487
+ <TokenField
488
+ id="user-emails"
489
+ label="Invite Users"
490
+ tokens={[]}
491
+ onChange={() => {}}
492
+ validateToken={validateEmail}
493
+ placeholder="Enter email addresses..."
494
+ helperText="Add users to invite to the project"
495
+ />
496
+ </div>
497
+ </div>
498
+ </section>
499
+ </div>
500
+ )
501
+ }
502
+
503
+ export default TokenFieldExamples