ywana-core8 0.1.84 → 0.1.85
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/__previewjs__/Wrapper.tsx +8 -5
- package/build-doc.sh +10 -0
- package/dist/index.cjs +418 -118
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +294 -94
- package/dist/index.css.map +1 -1
- package/dist/index.modern.js +418 -119
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +420 -120
- package/dist/index.umd.js.map +1 -1
- package/doc/README.md +196 -0
- package/doc/craco.config.js +31 -0
- package/doc/generate-examples.cjs +310 -0
- package/doc/package-lock.json +17298 -0
- package/doc/package.json +33 -0
- package/doc/public/index.html +22 -0
- package/doc/src/App.css +171 -0
- package/doc/src/App.js +214 -0
- package/doc/src/components/ExamplePage.js +104 -0
- package/doc/src/components/WelcomePage.js +84 -0
- package/doc/src/examples/button.example.js +47 -0
- package/doc/src/examples/input.example.js +91 -0
- package/doc/src/index.css +237 -0
- package/doc/src/index.js +11 -0
- package/package.json +9 -2
- package/preview.config.js +38 -0
- package/src/html/accordion.example.js +2 -2
- package/src/html/actions-cell.css +108 -0
- package/src/html/actions-cell.example.js +587 -0
- package/src/html/actions-cell.js +260 -0
- package/src/html/checkbox.example.js +2 -2
- package/src/html/chip.example.js +2 -2
- package/src/html/color.example.js +2 -2
- package/src/html/form.example.js +2 -2
- package/src/html/header2.example.js +2 -2
- package/src/html/index.js +1 -0
- package/src/html/menu.css +9 -2
- package/src/html/menu.js +14 -2
- package/src/html/progress.example.js +2 -2
- package/src/html/property.example.js +2 -2
- package/src/html/radio.example.js +2 -2
- package/src/html/switch.example.js +2 -2
- package/src/html/tab.example.js +2 -2
- package/src/html/table.css +47 -1
- package/src/html/table.example.js +1012 -0
- package/src/html/table.js +12 -7
- package/src/html/table2-actions-test.js +138 -0
- package/src/html/table2.css +40 -3
- package/src/html/table2.example.js +330 -0
- package/src/html/table2.js +56 -13
- package/src/html/tokenfield.example.js +2 -2
- package/src/widgets/calendar/Calendar.js +1 -1
- /package/{ACCORDION_EVALUATION.md → doc/evalulations/ACCORDION_EVALUATION.md} +0 -0
- /package/{CHECKBOX_EVALUATION.md → doc/evalulations/CHECKBOX_EVALUATION.md} +0 -0
- /package/{CHIP_EVALUATION.md → doc/evalulations/CHIP_EVALUATION.md} +0 -0
- /package/{COLOR_EVALUATION.md → doc/evalulations/COLOR_EVALUATION.md} +0 -0
- /package/{COMPONENTS_EVALUATION.md → doc/evalulations/COMPONENTS_EVALUATION.md} +0 -0
- /package/{FORM_EVALUATION.md → doc/evalulations/FORM_EVALUATION.md} +0 -0
- /package/{HEADER_EVALUATION.md → doc/evalulations/HEADER_EVALUATION.md} +0 -0
- /package/{ICON_EVALUATION.md → doc/evalulations/ICON_EVALUATION.md} +0 -0
- /package/{LIST_EVALUATION.md → doc/evalulations/LIST_EVALUATION.md} +0 -0
- /package/{PROGRESS_EVALUATION.md → doc/evalulations/PROGRESS_EVALUATION.md} +0 -0
- /package/{RADIO_EVALUATION.md → doc/evalulations/RADIO_EVALUATION.md} +0 -0
- /package/{RADIO_VISUAL_FIX.md → doc/evalulations/RADIO_VISUAL_FIX.md} +0 -0
- /package/{SECTION_IMPROVEMENTS.md → doc/evalulations/SECTION_IMPROVEMENTS.md} +0 -0
- /package/{SWITCH_EVALUATION.md → doc/evalulations/SWITCH_EVALUATION.md} +0 -0
- /package/{SWITCH_VISUAL_FIX.md → doc/evalulations/SWITCH_VISUAL_FIX.md} +0 -0
- /package/{TAB_EVALUATION.md → doc/evalulations/TAB_EVALUATION.md} +0 -0
- /package/{TEXTFIELD_EVALUATION.md → doc/evalulations/TEXTFIELD_EVALUATION.md} +0 -0
- /package/{TOOLTIP_FIX.md → doc/evalulations/TOOLTIP_FIX.md} +0 -0
- /package/{TREE_EVALUATION.md → doc/evalulations/TREE_EVALUATION.md} +0 -0
- /package/src/incubator/{PDFViewer.js → pdfViewer.js} +0 -0
@@ -0,0 +1,587 @@
|
|
1
|
+
import React, { useState } from 'react'
|
2
|
+
import { ActionsCell } from './actions-cell'
|
3
|
+
import { Button } from './button'
|
4
|
+
import { Header } from './header'
|
5
|
+
import { List } from './list'
|
6
|
+
import { Accordion } from './accordion'
|
7
|
+
import { ExampleLayout, ExampleSection, ExampleSubsection, CodeSnippet } from './ExampleLayout'
|
8
|
+
|
9
|
+
/**
|
10
|
+
* Ejemplos de uso de ActionsCell en diferentes componentes
|
11
|
+
*/
|
12
|
+
const ActionsCellExamples = () => {
|
13
|
+
const [selectedItem, setSelectedItem] = useState(null)
|
14
|
+
|
15
|
+
// Muchas acciones con textos REALMENTE largos que GARANTIZAN overflow
|
16
|
+
const createManyActions = (context, id) => (
|
17
|
+
<div style={{ display: 'flex', gap: '4px' }}>
|
18
|
+
<Button
|
19
|
+
size="small"
|
20
|
+
variant="outlined"
|
21
|
+
icon="edit"
|
22
|
+
title="Editar elemento seleccionado con todas las opciones disponibles"
|
23
|
+
onClick={() => alert(`Editar ${context}: ${id}`)}
|
24
|
+
>
|
25
|
+
Editar elemento seleccionado
|
26
|
+
</Button>
|
27
|
+
<Button
|
28
|
+
size="small"
|
29
|
+
variant="outlined"
|
30
|
+
icon="visibility"
|
31
|
+
title="Ver todos los detalles completos del elemento"
|
32
|
+
onClick={() => alert(`Ver ${context}: ${id}`)}
|
33
|
+
>
|
34
|
+
Ver detalles completos
|
35
|
+
</Button>
|
36
|
+
<Button
|
37
|
+
size="small"
|
38
|
+
variant="outlined"
|
39
|
+
icon="content_copy"
|
40
|
+
title="Duplicar elemento con todas sus propiedades"
|
41
|
+
onClick={() => alert(`Duplicar ${context}: ${id}`)}
|
42
|
+
>
|
43
|
+
Duplicar con propiedades
|
44
|
+
</Button>
|
45
|
+
<Button
|
46
|
+
size="small"
|
47
|
+
variant="outlined"
|
48
|
+
icon="share"
|
49
|
+
title="Compartir con otros usuarios del sistema"
|
50
|
+
onClick={() => alert(`Compartir ${context}: ${id}`)}
|
51
|
+
>
|
52
|
+
Compartir con otros usuarios
|
53
|
+
</Button>
|
54
|
+
<Button
|
55
|
+
size="small"
|
56
|
+
variant="outlined"
|
57
|
+
icon="download"
|
58
|
+
title="Descargar archivo en formato específico"
|
59
|
+
onClick={() => alert(`Descargar ${context}: ${id}`)}
|
60
|
+
>
|
61
|
+
Descargar en formato específico
|
62
|
+
</Button>
|
63
|
+
<Button
|
64
|
+
size="small"
|
65
|
+
variant="outlined"
|
66
|
+
icon="settings"
|
67
|
+
title="Configurar todas las opciones avanzadas"
|
68
|
+
onClick={() => alert(`Configurar ${context}: ${id}`)}
|
69
|
+
>
|
70
|
+
Configurar opciones avanzadas
|
71
|
+
</Button>
|
72
|
+
<Button
|
73
|
+
size="small"
|
74
|
+
variant="outlined"
|
75
|
+
icon="archive"
|
76
|
+
title="Archivar elemento temporalmente"
|
77
|
+
onClick={() => alert(`Archivar ${context}: ${id}`)}
|
78
|
+
>
|
79
|
+
Archivar temporalmente
|
80
|
+
</Button>
|
81
|
+
<Button
|
82
|
+
size="small"
|
83
|
+
variant="outlined"
|
84
|
+
icon="delete"
|
85
|
+
title="Eliminar permanentemente del sistema"
|
86
|
+
onClick={() => alert(`Eliminar ${context}: ${id}`)}
|
87
|
+
>
|
88
|
+
Eliminar permanentemente
|
89
|
+
</Button>
|
90
|
+
</div>
|
91
|
+
)
|
92
|
+
|
93
|
+
// Acciones medianas que pueden hacer overflow
|
94
|
+
const createMediumActions = (context, id) => (
|
95
|
+
<div style={{ display: 'flex', gap: '4px' }}>
|
96
|
+
<Button
|
97
|
+
size="small"
|
98
|
+
variant="outlined"
|
99
|
+
icon="edit"
|
100
|
+
title="Editar"
|
101
|
+
onClick={() => alert(`Editar ${context}: ${id}`)}
|
102
|
+
/>
|
103
|
+
<Button
|
104
|
+
size="small"
|
105
|
+
variant="outlined"
|
106
|
+
icon="visibility"
|
107
|
+
title="Ver detalles"
|
108
|
+
onClick={() => alert(`Ver ${context}: ${id}`)}
|
109
|
+
/>
|
110
|
+
<Button
|
111
|
+
size="small"
|
112
|
+
variant="outlined"
|
113
|
+
icon="content_copy"
|
114
|
+
title="Duplicar"
|
115
|
+
onClick={() => alert(`Duplicar ${context}: ${id}`)}
|
116
|
+
/>
|
117
|
+
<Button
|
118
|
+
size="small"
|
119
|
+
variant="outlined"
|
120
|
+
icon="share"
|
121
|
+
title="Compartir"
|
122
|
+
onClick={() => alert(`Compartir ${context}: ${id}`)}
|
123
|
+
/>
|
124
|
+
<Button
|
125
|
+
size="small"
|
126
|
+
variant="outlined"
|
127
|
+
icon="download"
|
128
|
+
title="Descargar"
|
129
|
+
onClick={() => alert(`Descargar ${context}: ${id}`)}
|
130
|
+
/>
|
131
|
+
<Button
|
132
|
+
size="small"
|
133
|
+
variant="outlined"
|
134
|
+
icon="delete"
|
135
|
+
title="Eliminar"
|
136
|
+
onClick={() => alert(`Eliminar ${context}: ${id}`)}
|
137
|
+
/>
|
138
|
+
</div>
|
139
|
+
)
|
140
|
+
|
141
|
+
const createFewActions = (context, id) => (
|
142
|
+
<div style={{ display: 'flex', gap: '4px' }}>
|
143
|
+
<Button
|
144
|
+
size="small"
|
145
|
+
variant="outlined"
|
146
|
+
icon="edit"
|
147
|
+
title="Editar"
|
148
|
+
onClick={() => alert(`Editar ${context}: ${id}`)}
|
149
|
+
/>
|
150
|
+
<Button
|
151
|
+
size="small"
|
152
|
+
variant="outlined"
|
153
|
+
icon="delete"
|
154
|
+
title="Eliminar"
|
155
|
+
onClick={() => alert(`Eliminar ${context}: ${id}`)}
|
156
|
+
/>
|
157
|
+
</div>
|
158
|
+
)
|
159
|
+
|
160
|
+
const sections = [
|
161
|
+
{ id: 'overflow-demo', title: 'Demostración de Overflow' },
|
162
|
+
{ id: 'header-actions', title: 'Header con ActionsCell' },
|
163
|
+
{ id: 'list-actions', title: 'List con ActionsCell' },
|
164
|
+
{ id: 'accordion-actions', title: 'Accordion con ActionsCell' },
|
165
|
+
{ id: 'menu-alignment', title: 'Alineación Automática del Menú' }
|
166
|
+
]
|
167
|
+
|
168
|
+
return (
|
169
|
+
<ExampleLayout title="ActionsCell - Componente Reutilizable" sections={sections}>
|
170
|
+
{/* Demostración de Overflow */}
|
171
|
+
<ExampleSection title="Demostración de Overflow" id="overflow-demo">
|
172
|
+
<ExampleSubsection title="Comparación de Anchos Máximos">
|
173
|
+
<div style={{ display: 'grid', gap: '1rem' }}>
|
174
|
+
{/* Ancho muy restrictivo */}
|
175
|
+
<div style={{ border: '2px solid #ff6b6b', borderRadius: '8px', padding: '1rem' }}>
|
176
|
+
<h4 style={{ margin: '0 0 0.5rem 0', color: '#ff6b6b' }}>maxWidth: 60px (Extremadamente Restrictivo)</h4>
|
177
|
+
<p style={{ margin: '0 0 1rem 0', fontSize: '0.875rem', color: '#666' }}>
|
178
|
+
Incluso 2 iconos pequeños se convierten en menú
|
179
|
+
</p>
|
180
|
+
<div style={{ display: 'flex', alignItems: 'center', gap: '1rem', padding: '0.5rem', background: '#f8f9fa', borderRadius: '4px' }}>
|
181
|
+
<span style={{ fontWeight: 'bold', minWidth: '100px' }}>Resultado:</span>
|
182
|
+
<ActionsCell
|
183
|
+
actions={createFewActions('demo', 'extreme')}
|
184
|
+
maxWidth={60}
|
185
|
+
menuAlign="right"
|
186
|
+
/>
|
187
|
+
</div>
|
188
|
+
</div>
|
189
|
+
|
190
|
+
{/* Ancho restrictivo */}
|
191
|
+
<div style={{ border: '2px solid #ffa726', borderRadius: '8px', padding: '1rem' }}>
|
192
|
+
<h4 style={{ margin: '0 0 0.5rem 0', color: '#ffa726' }}>maxWidth: 120px (Restrictivo)</h4>
|
193
|
+
<p style={{ margin: '0 0 1rem 0', fontSize: '0.875rem', color: '#666' }}>
|
194
|
+
6 iconos pequeños probablemente se conviertan en menú
|
195
|
+
</p>
|
196
|
+
<div style={{ display: 'flex', alignItems: 'center', gap: '1rem', padding: '0.5rem', background: '#f8f9fa', borderRadius: '4px' }}>
|
197
|
+
<span style={{ fontWeight: 'bold', minWidth: '100px' }}>Resultado:</span>
|
198
|
+
<ActionsCell
|
199
|
+
actions={createMediumActions('demo', 'restrictive')}
|
200
|
+
maxWidth={120}
|
201
|
+
menuAlign="right"
|
202
|
+
/>
|
203
|
+
</div>
|
204
|
+
</div>
|
205
|
+
|
206
|
+
{/* Ancho moderado */}
|
207
|
+
<div style={{ border: '2px solid #66bb6a', borderRadius: '8px', padding: '1rem' }}>
|
208
|
+
<h4 style={{ margin: '0 0 0.5rem 0', color: '#66bb6a' }}>maxWidth: 200px (Moderado)</h4>
|
209
|
+
<p style={{ margin: '0 0 1rem 0', fontSize: '0.875rem', color: '#666' }}>
|
210
|
+
Acciones con texto se convierten en menú, iconos solos pueden caber
|
211
|
+
</p>
|
212
|
+
<div style={{ display: 'flex', alignItems: 'center', gap: '1rem', padding: '0.5rem', background: '#f8f9fa', borderRadius: '4px' }}>
|
213
|
+
<span style={{ fontWeight: 'bold', minWidth: '100px' }}>Resultado:</span>
|
214
|
+
<ActionsCell
|
215
|
+
actions={createManyActions('demo', 'moderate')}
|
216
|
+
maxWidth={200}
|
217
|
+
menuAlign="right"
|
218
|
+
/>
|
219
|
+
</div>
|
220
|
+
</div>
|
221
|
+
|
222
|
+
{/* Ancho generoso */}
|
223
|
+
<div style={{ border: '2px solid #42a5f5', borderRadius: '8px', padding: '1rem' }}>
|
224
|
+
<h4 style={{ margin: '0 0 0.5rem 0', color: '#42a5f5' }}>maxWidth: 400px (Generoso)</h4>
|
225
|
+
<p style={{ margin: '0 0 1rem 0', fontSize: '0.875rem', color: '#666' }}>
|
226
|
+
Muchas acciones pueden mostrarse antes de convertirse en menú
|
227
|
+
</p>
|
228
|
+
<div style={{ display: 'flex', alignItems: 'center', gap: '1rem', padding: '0.5rem', background: '#f8f9fa', borderRadius: '4px' }}>
|
229
|
+
<span style={{ fontWeight: 'bold', minWidth: '100px' }}>Resultado:</span>
|
230
|
+
<ActionsCell
|
231
|
+
actions={createManyActions('demo', 'generous')}
|
232
|
+
maxWidth={400}
|
233
|
+
menuAlign="right"
|
234
|
+
/>
|
235
|
+
</div>
|
236
|
+
</div>
|
237
|
+
</div>
|
238
|
+
</ExampleSubsection>
|
239
|
+
|
240
|
+
<CodeSnippet
|
241
|
+
language="jsx"
|
242
|
+
code={`// Diferentes configuraciones de maxWidth
|
243
|
+
<ActionsCell actions={manyActions} maxWidth={60} /> // Muy restrictivo
|
244
|
+
<ActionsCell actions={manyActions} maxWidth={120} /> // Restrictivo
|
245
|
+
<ActionsCell actions={manyActions} maxWidth={200} /> // Moderado
|
246
|
+
<ActionsCell actions={manyActions} maxWidth={400} /> // Generoso`}
|
247
|
+
/>
|
248
|
+
</ExampleSection>
|
249
|
+
{/* Header con ActionsCell */}
|
250
|
+
<ExampleSection title="Header con ActionsCell" id="header-actions">
|
251
|
+
<ExampleSubsection title="Header con Muchas Acciones (Overflow Garantizado)">
|
252
|
+
<div style={{ border: '1px solid #ddd', borderRadius: '8px', padding: '1rem', marginBottom: '1rem' }}>
|
253
|
+
<p style={{ margin: '0 0 1rem 0', fontSize: '0.875rem', color: '#666' }}>
|
254
|
+
<strong>maxWidth: 150px</strong> - Las acciones con texto exceden este ancho y se convierten en menú
|
255
|
+
</p>
|
256
|
+
<Header
|
257
|
+
title="Panel de Control"
|
258
|
+
icon="dashboard"
|
259
|
+
className="header__actions"
|
260
|
+
>
|
261
|
+
<ActionsCell
|
262
|
+
actions={createManyActions('header', 'dashboard')}
|
263
|
+
maxWidth={150}
|
264
|
+
menuAlign="right"
|
265
|
+
/>
|
266
|
+
</Header>
|
267
|
+
</div>
|
268
|
+
</ExampleSubsection>
|
269
|
+
|
270
|
+
<ExampleSubsection title="Header con Acciones Medianas (Overflow Probable)">
|
271
|
+
<div style={{ border: '1px solid #ddd', borderRadius: '8px', padding: '1rem', marginBottom: '1rem' }}>
|
272
|
+
<p style={{ margin: '0 0 1rem 0', fontSize: '0.875rem', color: '#666' }}>
|
273
|
+
<strong>maxWidth: 120px</strong> - 6 iconos pequeños probablemente excedan este ancho
|
274
|
+
</p>
|
275
|
+
<Header
|
276
|
+
title="Gestión de Archivos"
|
277
|
+
icon="folder"
|
278
|
+
className="header__actions"
|
279
|
+
>
|
280
|
+
<ActionsCell
|
281
|
+
actions={createMediumActions('header', 'files')}
|
282
|
+
maxWidth={120}
|
283
|
+
menuAlign="right"
|
284
|
+
/>
|
285
|
+
</Header>
|
286
|
+
</div>
|
287
|
+
</ExampleSubsection>
|
288
|
+
|
289
|
+
<ExampleSubsection title="Header con Pocas Acciones (Sin Overflow)">
|
290
|
+
<div style={{ border: '1px solid #ddd', borderRadius: '8px', padding: '1rem', marginBottom: '1rem' }}>
|
291
|
+
<p style={{ margin: '0 0 1rem 0', fontSize: '0.875rem', color: '#666' }}>
|
292
|
+
<strong>maxWidth: 200px</strong> - Solo 2 acciones caben perfectamente
|
293
|
+
</p>
|
294
|
+
<Header
|
295
|
+
title="Configuración"
|
296
|
+
icon="settings"
|
297
|
+
className="header__actions"
|
298
|
+
>
|
299
|
+
<ActionsCell
|
300
|
+
actions={createFewActions('header', 'settings')}
|
301
|
+
maxWidth={200}
|
302
|
+
menuAlign="right"
|
303
|
+
/>
|
304
|
+
</Header>
|
305
|
+
</div>
|
306
|
+
</ExampleSubsection>
|
307
|
+
|
308
|
+
<CodeSnippet
|
309
|
+
language="jsx"
|
310
|
+
code={`<Header title="Panel de Control" icon="dashboard">
|
311
|
+
<ActionsCell
|
312
|
+
actions={
|
313
|
+
<div style={{ display: 'flex', gap: '4px' }}>
|
314
|
+
<Button size="small" variant="outlined" icon="edit" />
|
315
|
+
<Button size="small" variant="outlined" icon="share" />
|
316
|
+
<Button size="small" variant="outlined" icon="delete" />
|
317
|
+
</div>
|
318
|
+
}
|
319
|
+
maxWidth={200}
|
320
|
+
menuAlign="right"
|
321
|
+
/>
|
322
|
+
</Header>`}
|
323
|
+
/>
|
324
|
+
</ExampleSection>
|
325
|
+
|
326
|
+
{/* List con ActionsCell */}
|
327
|
+
<ExampleSection title="List con ActionsCell" id="list-actions">
|
328
|
+
<ExampleSubsection title="Lista con Acciones Variables">
|
329
|
+
<div style={{ border: '1px solid #ddd', borderRadius: '8px', padding: '1rem' }}>
|
330
|
+
<p style={{ margin: '0 0 1rem 0', fontSize: '0.875rem', color: '#666' }}>
|
331
|
+
Las acciones se muestran siempre visibles (sin hover) cuando usan ActionsCell
|
332
|
+
</p>
|
333
|
+
<List
|
334
|
+
items={[
|
335
|
+
{
|
336
|
+
id: 'item1',
|
337
|
+
line1: 'Documento con Muchas Opciones',
|
338
|
+
line2: 'Última modificación: hace 2 horas',
|
339
|
+
icon: 'description',
|
340
|
+
actions: (
|
341
|
+
<ActionsCell
|
342
|
+
actions={createManyActions('documento', 'item1')}
|
343
|
+
maxWidth={100} // Muy restrictivo para forzar menú
|
344
|
+
menuAlign="right"
|
345
|
+
className="list__item-actions list__item-actions--visible"
|
346
|
+
/>
|
347
|
+
)
|
348
|
+
},
|
349
|
+
{
|
350
|
+
id: 'item2',
|
351
|
+
line1: 'Imagen con Acciones Medianas',
|
352
|
+
line2: 'Subida ayer',
|
353
|
+
icon: 'image',
|
354
|
+
actions: (
|
355
|
+
<ActionsCell
|
356
|
+
actions={createMediumActions('imagen', 'item2')}
|
357
|
+
maxWidth={140}
|
358
|
+
menuAlign="right"
|
359
|
+
className="list__item-actions list__item-actions--visible"
|
360
|
+
/>
|
361
|
+
)
|
362
|
+
},
|
363
|
+
{
|
364
|
+
id: 'item3',
|
365
|
+
line1: 'Video con Pocas Acciones',
|
366
|
+
line2: 'Duración: 15 minutos',
|
367
|
+
icon: 'play_circle',
|
368
|
+
actions: (
|
369
|
+
<ActionsCell
|
370
|
+
actions={createFewActions('video', 'item3')}
|
371
|
+
maxWidth={200} // Suficiente espacio
|
372
|
+
menuAlign="right"
|
373
|
+
className="list__item-actions list__item-actions--visible"
|
374
|
+
/>
|
375
|
+
)
|
376
|
+
}
|
377
|
+
]}
|
378
|
+
onSelect={setSelectedItem}
|
379
|
+
selected={selectedItem}
|
380
|
+
/>
|
381
|
+
</div>
|
382
|
+
</ExampleSubsection>
|
383
|
+
|
384
|
+
<CodeSnippet
|
385
|
+
language="jsx"
|
386
|
+
code={`<List
|
387
|
+
items={[
|
388
|
+
{
|
389
|
+
id: 'item1',
|
390
|
+
line1: 'Documento Importante',
|
391
|
+
line2: 'Última modificación: hace 2 horas',
|
392
|
+
icon: 'description',
|
393
|
+
actions: (
|
394
|
+
<ActionsCell
|
395
|
+
actions={multipleActions}
|
396
|
+
maxWidth={150}
|
397
|
+
menuAlign="right"
|
398
|
+
/>
|
399
|
+
)
|
400
|
+
}
|
401
|
+
]}
|
402
|
+
/>`}
|
403
|
+
/>
|
404
|
+
</ExampleSection>
|
405
|
+
|
406
|
+
{/* Accordion con ActionsCell */}
|
407
|
+
<ExampleSection title="Accordion con ActionsCell" id="accordion-actions">
|
408
|
+
<ExampleSubsection title="Accordion con Toolbar Inteligente">
|
409
|
+
<div style={{ border: '1px solid #ddd', borderRadius: '8px', padding: '1rem' }}>
|
410
|
+
<p style={{ margin: '0 0 1rem 0', fontSize: '0.875rem', color: '#666' }}>
|
411
|
+
Los toolbars se adaptan automáticamente al espacio disponible
|
412
|
+
</p>
|
413
|
+
<Accordion
|
414
|
+
sections={[
|
415
|
+
{
|
416
|
+
id: 'section1',
|
417
|
+
title: 'Configuración con Muchas Opciones',
|
418
|
+
subtitle: 'Panel completo de administración',
|
419
|
+
icon: 'settings',
|
420
|
+
toolbar: (
|
421
|
+
<ActionsCell
|
422
|
+
actions={createManyActions('configuración', 'section1')}
|
423
|
+
maxWidth={120} // Restrictivo para forzar menú
|
424
|
+
menuAlign="right"
|
425
|
+
className="accordion__actions toolbar--with-actions"
|
426
|
+
/>
|
427
|
+
),
|
428
|
+
children: (
|
429
|
+
<div style={{ padding: '1rem' }}>
|
430
|
+
<p>Contenido de configuración general con muchas opciones disponibles...</p>
|
431
|
+
</div>
|
432
|
+
)
|
433
|
+
},
|
434
|
+
{
|
435
|
+
id: 'section2',
|
436
|
+
title: 'Gestión de Usuarios',
|
437
|
+
subtitle: 'Administración básica de usuarios',
|
438
|
+
icon: 'people',
|
439
|
+
toolbar: (
|
440
|
+
<ActionsCell
|
441
|
+
actions={createMediumActions('usuarios', 'section2')}
|
442
|
+
maxWidth={160}
|
443
|
+
menuAlign="right"
|
444
|
+
className="accordion__actions toolbar--with-actions"
|
445
|
+
/>
|
446
|
+
),
|
447
|
+
children: (
|
448
|
+
<div style={{ padding: '1rem' }}>
|
449
|
+
<p>Contenido de gestión de usuarios con opciones moderadas...</p>
|
450
|
+
</div>
|
451
|
+
)
|
452
|
+
},
|
453
|
+
{
|
454
|
+
id: 'section3',
|
455
|
+
title: 'Configuración Simple',
|
456
|
+
subtitle: 'Opciones básicas',
|
457
|
+
icon: 'tune',
|
458
|
+
toolbar: (
|
459
|
+
<ActionsCell
|
460
|
+
actions={createFewActions('simple', 'section3')}
|
461
|
+
maxWidth={200} // Suficiente espacio
|
462
|
+
menuAlign="right"
|
463
|
+
className="accordion__actions toolbar--with-actions"
|
464
|
+
/>
|
465
|
+
),
|
466
|
+
children: (
|
467
|
+
<div style={{ padding: '1rem' }}>
|
468
|
+
<p>Configuración simple con pocas opciones...</p>
|
469
|
+
</div>
|
470
|
+
)
|
471
|
+
}
|
472
|
+
]}
|
473
|
+
/>
|
474
|
+
</div>
|
475
|
+
</ExampleSubsection>
|
476
|
+
|
477
|
+
<CodeSnippet
|
478
|
+
language="jsx"
|
479
|
+
code={`<Accordion
|
480
|
+
sections={[
|
481
|
+
{
|
482
|
+
title: 'Configuración General',
|
483
|
+
icon: 'settings',
|
484
|
+
toolbar: (
|
485
|
+
<ActionsCell
|
486
|
+
actions={toolbarActions}
|
487
|
+
maxWidth={180}
|
488
|
+
menuAlign="right"
|
489
|
+
/>
|
490
|
+
),
|
491
|
+
children: <div>Contenido...</div>
|
492
|
+
}
|
493
|
+
]}
|
494
|
+
/>`}
|
495
|
+
/>
|
496
|
+
</ExampleSection>
|
497
|
+
|
498
|
+
{/* Alineación automática del menú */}
|
499
|
+
<ExampleSection title="Alineación Automática del Menú" id="menu-alignment">
|
500
|
+
<ExampleSubsection title="Detección Automática de Posición">
|
501
|
+
<div style={{
|
502
|
+
display: 'grid',
|
503
|
+
gridTemplateColumns: '1fr 1fr 1fr',
|
504
|
+
gap: '1rem',
|
505
|
+
padding: '2rem',
|
506
|
+
border: '1px solid #ddd',
|
507
|
+
borderRadius: '8px',
|
508
|
+
minHeight: '200px'
|
509
|
+
}}>
|
510
|
+
{/* Izquierda - menú se abre hacia la derecha */}
|
511
|
+
<div style={{
|
512
|
+
display: 'flex',
|
513
|
+
justifyContent: 'flex-start',
|
514
|
+
alignItems: 'flex-start',
|
515
|
+
flexDirection: 'column',
|
516
|
+
gap: '0.5rem'
|
517
|
+
}}>
|
518
|
+
<span style={{ fontSize: '0.875rem', fontWeight: 'bold' }}>Izquierda</span>
|
519
|
+
<span style={{ fontSize: '0.75rem', color: '#666' }}>Menú se abre hacia la derecha</span>
|
520
|
+
<ActionsCell
|
521
|
+
actions={createManyActions('izquierda', 'test')}
|
522
|
+
maxWidth={100}
|
523
|
+
menuAlign="auto"
|
524
|
+
/>
|
525
|
+
</div>
|
526
|
+
|
527
|
+
{/* Centro - menú se centra */}
|
528
|
+
<div style={{
|
529
|
+
display: 'flex',
|
530
|
+
justifyContent: 'center',
|
531
|
+
alignItems: 'flex-start',
|
532
|
+
flexDirection: 'column',
|
533
|
+
gap: '0.5rem'
|
534
|
+
}}>
|
535
|
+
<span style={{ fontSize: '0.875rem', fontWeight: 'bold' }}>Centro</span>
|
536
|
+
<span style={{ fontSize: '0.75rem', color: '#666' }}>Menú se centra</span>
|
537
|
+
<ActionsCell
|
538
|
+
actions={createManyActions('centro', 'test')}
|
539
|
+
maxWidth={100}
|
540
|
+
menuAlign="center"
|
541
|
+
/>
|
542
|
+
</div>
|
543
|
+
|
544
|
+
{/* Derecha - menú se abre hacia la izquierda */}
|
545
|
+
<div style={{
|
546
|
+
display: 'flex',
|
547
|
+
justifyContent: 'flex-end',
|
548
|
+
alignItems: 'flex-start',
|
549
|
+
flexDirection: 'column',
|
550
|
+
gap: '0.5rem'
|
551
|
+
}}>
|
552
|
+
<span style={{ fontSize: '0.875rem', fontWeight: 'bold' }}>Derecha</span>
|
553
|
+
<span style={{ fontSize: '0.75rem', color: '#666' }}>Menú se abre hacia la izquierda</span>
|
554
|
+
<ActionsCell
|
555
|
+
actions={createManyActions('derecha', 'test')}
|
556
|
+
maxWidth={100}
|
557
|
+
menuAlign="auto"
|
558
|
+
/>
|
559
|
+
</div>
|
560
|
+
</div>
|
561
|
+
|
562
|
+
<p style={{ marginTop: '1rem', fontSize: '0.875rem', color: '#666' }}>
|
563
|
+
<strong>menuAlign="auto"</strong> detecta automáticamente la mejor posición según el espacio disponible.
|
564
|
+
Los menús cerca del borde derecho se abren hacia la izquierda para evitar que se corten.
|
565
|
+
</p>
|
566
|
+
</ExampleSubsection>
|
567
|
+
|
568
|
+
<CodeSnippet
|
569
|
+
language="jsx"
|
570
|
+
code={`// Alineación manual del menú
|
571
|
+
<ActionsCell
|
572
|
+
actions={manyActions}
|
573
|
+
maxWidth={150}
|
574
|
+
menuAlign="right" // Por defecto hacia la derecha
|
575
|
+
/>
|
576
|
+
|
577
|
+
// Opciones de alineación
|
578
|
+
<ActionsCell menuAlign="left" /> // Menú hacia la izquierda
|
579
|
+
<ActionsCell menuAlign="right" /> // Menú hacia la derecha (por defecto)
|
580
|
+
<ActionsCell menuAlign="center" /> // Menú centrado`}
|
581
|
+
/>
|
582
|
+
</ExampleSection>
|
583
|
+
</ExampleLayout>
|
584
|
+
)
|
585
|
+
}
|
586
|
+
|
587
|
+
export default ActionsCellExamples
|