ywana-core8 0.1.103 → 0.2.2
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.css +4941 -324
- package/dist/index.js +42339 -0
- package/dist/index.js.map +1 -0
- package/dist/index.modern.js +37459 -31678
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +39635 -34010
- package/dist/index.umd.js.map +1 -1
- package/package.json +26 -29
- package/src/Test.stories.jsx +28 -0
- package/src/desktop/Desktop.stories.jsx +110 -0
- package/src/desktop/WindowContext.js +135 -0
- package/src/desktop/WindowManager.js +355 -0
- package/src/desktop/desktop.css +55 -4
- package/src/desktop/desktop.js +312 -6
- package/src/desktop/index.js +7 -0
- package/src/desktop/window.css +229 -36
- package/src/desktop/window.js +255 -20
- package/src/desktop.backup/desktop.css +6 -0
- package/src/desktop.backup/desktop.js +13 -0
- package/src/desktop.backup/window.css +58 -0
- package/src/desktop.backup/window.js +27 -0
- package/src/html/Accordion.stories.jsx +178 -0
- package/src/html/Button.stories.jsx +175 -0
- package/src/html/Checkbox.stories.jsx +131 -0
- package/src/html/Chip.stories.jsx +189 -0
- package/src/html/Color.stories.jsx +234 -0
- package/src/html/Form.stories.jsx +271 -0
- package/src/html/Icon.stories.jsx +233 -0
- package/src/html/Progress.stories.jsx +247 -0
- package/src/html/Radio.stories.jsx +289 -0
- package/src/html/StyleTest.stories.jsx +81 -0
- package/src/html/Switch.stories.jsx +329 -0
- package/src/html/Tab.stories.jsx +239 -0
- package/src/html/Table.stories.jsx +188 -0
- package/src/html/Table2.stories.jsx +238 -0
- package/src/html/TextField2.stories.jsx +337 -0
- package/src/html/Tree.stories.jsx +285 -0
- package/src/html/accordion.example.js +0 -74
- package/src/html/accordion.js +1 -6
- package/src/html/button.js +2 -13
- package/src/html/checkbox.js +1 -9
- package/src/html/chip.js +2 -19
- package/src/html/color.js +1 -14
- package/src/html/form.js +4 -15
- package/src/html/header2.js +1 -12
- package/src/html/icon.js +1 -7
- package/src/html/index.js +1 -1
- package/src/html/list.js +1 -19
- package/src/html/menu.js +9 -5
- package/src/html/progress.js +5 -53
- package/src/html/property.js +9 -25
- package/src/html/radio.js +2 -16
- package/src/html/section.js +1 -6
- package/src/html/selector.js +2 -19
- package/src/html/switch.css +134 -100
- package/src/html/switch.example.js +46 -36
- package/src/html/switch.js +43 -192
- package/src/html/tab.js +3 -24
- package/src/html/text.js +1 -12
- package/src/html/textfield2.js +5 -42
- package/src/html/thumbnail.js +1 -12
- package/src/html/tokenfield.js +2 -21
- package/src/html/tree.js +3 -35
- package/src/index.js +1 -0
- package/__previewjs__/Wrapper.tsx +0 -14
- package/build-doc.sh +0 -10
- package/db/db.json +0 -89
- package/db/routes.json +0 -0
- package/dist/index.cjs +0 -36722
- package/dist/index.cjs.map +0 -1
- package/dist/index.css.map +0 -1
- package/doc/README.md +0 -196
- package/doc/evalulations/ACCORDION_EVALUATION.md +0 -583
- package/doc/evalulations/CHECKBOX_EVALUATION.md +0 -273
- package/doc/evalulations/CHIP_EVALUATION.md +0 -542
- package/doc/evalulations/COLOR_EVALUATION.md +0 -524
- package/doc/evalulations/COMPONENTS_EVALUATION.md +0 -477
- package/doc/evalulations/FORM_EVALUATION.md +0 -459
- package/doc/evalulations/HEADER_EVALUATION.md +0 -436
- package/doc/evalulations/ICON_EVALUATION.md +0 -254
- package/doc/evalulations/LIST_EVALUATION.md +0 -574
- package/doc/evalulations/PROGRESS_EVALUATION.md +0 -450
- package/doc/evalulations/RADIO_EVALUATION.md +0 -439
- package/doc/evalulations/RADIO_VISUAL_FIX.md +0 -183
- package/doc/evalulations/SECTION_IMPROVEMENTS.md +0 -153
- package/doc/evalulations/SWITCH_EVALUATION.md +0 -335
- package/doc/evalulations/SWITCH_VISUAL_FIX.md +0 -232
- package/doc/evalulations/TAB_EVALUATION.md +0 -626
- package/doc/evalulations/TEXTFIELD_EVALUATION.md +0 -747
- package/doc/evalulations/TOOLTIP_FIX.md +0 -157
- package/doc/evalulations/TREE_EVALUATION.md +0 -708
- package/doc/index.html +0 -0
- package/doc/package-lock.json +0 -17298
- package/doc/package.json +0 -34
- package/doc/public/index.html +0 -24
- package/doc/scripts/generate-examples.js +0 -129
- package/doc/src/App.css +0 -171
- package/doc/src/App.js +0 -114
- package/doc/src/components/ExamplePage.js +0 -129
- package/doc/src/components/WelcomePage.js +0 -84
- package/doc/src/index.css +0 -246
- package/doc/src/index.js +0 -17
- package/doc/src/theme.css +0 -256
- package/jest.config.js +0 -24
- package/preview.config.js +0 -38
- package/publish.sh +0 -6
- package/src/desktop/dektop.test.js +0 -11
- package/src/domain/CollectionAPI.test.js +0 -19
- package/src/domain/ContentEditor.test.js +0 -52
- package/src/domain2/CollectionAPI.test.js +0 -19
- package/src/domain2/CollectionContext.test.js +0 -71
- package/src/domain2/CollectionPage.test.js +0 -112
- package/src/domain2/DynamicForm.test.js +0 -47
- package/src/html/accordion.test.js +0 -37
- package/src/html/accordion.unit.test.js +0 -334
- package/src/html/button.example.new.js +0 -416
- package/src/html/button.test.js +0 -422
- package/src/html/checkbox.test.js +0 -285
- package/src/html/chip.test.js +0 -425
- package/src/html/color.example.js.backup +0 -527
- package/src/html/color.test.js +0 -377
- package/src/html/components.example.js.backup +0 -492
- package/src/html/components_enhanced.test.js +0 -581
- package/src/html/form.example.js.backup +0 -385
- package/src/html/form.test.js +0 -369
- package/src/html/header2.example.js.backup +0 -411
- package/src/html/header2.test.js +0 -377
- package/src/html/icon.example.js.backup +0 -268
- package/src/html/icon.test.js +0 -231
- package/src/html/label.test.js +0 -0
- package/src/html/list.example.js.backup +0 -404
- package/src/html/list.test.js +0 -383
- package/src/html/progress.example.js.backup +0 -424
- package/src/html/progress.test.js +0 -313
- package/src/html/property.example.js.backup +0 -553
- package/src/html/property.test.js +0 -371
- package/src/html/radio.example.js.backup +0 -389
- package/src/html/radio.test.js +0 -318
- package/src/html/section.example.js.backup +0 -99
- package/src/html/section.test.js +0 -131
- package/src/html/selector.test.js +0 -20
- package/src/html/switch.example.js.backup +0 -461
- package/src/html/switch.test.js +0 -355
- package/src/html/tab.example.js.backup +0 -446
- package/src/html/tab.test.js +0 -25
- package/src/html/tab_enhanced.test.js +0 -504
- package/src/html/table.test.js +0 -70
- package/src/html/table2.test.js +0 -582
- package/src/html/text.test.js +0 -15
- package/src/html/textfield.test.js +0 -51
- package/src/html/textfield2.example.js.backup +0 -1370
- package/src/html/textfield2.test.js +0 -950
- package/src/html/tokenfield.example.js.backup +0 -503
- package/src/html/tokenfield.test.js +0 -423
- package/src/html/tree.example.js.backup +0 -475
- package/src/html/tree.test.js +0 -43
- package/src/html/tree_enhanced.test.js +0 -495
- package/src/http/token.test.js +0 -50
- package/src/incubator/pdfViewer.js +0 -33
- package/src/incubator/wizard.test.js +0 -127
- package/src/site/site.test.js +0 -230
- package/src/site/view.test.js +0 -41
- package/src/widgets/calendar/Calendar.test.js +0 -28
- package/src/widgets/explorer/Explorer.test.js +0 -121
- package/src/widgets/ide/editor.test.js +0 -33
- package/src/widgets/kanban/Kanban.test.js +0 -78
- package/src/widgets/login/LoginBox.test.js +0 -12
- package/src/widgets/login/ResetPasswordBox.test.js +0 -34
- package/src/widgets/login/validations.test.js +0 -51
- package/src/widgets/planner/Planner.test.js +0 -60
- package/src/widgets/upload/Upload.test.js +0 -32
- package/table2.test.js +0 -454
@@ -1,446 +0,0 @@
|
|
1
|
-
import React, { useState } from 'react'
|
2
|
-
import { Tabs, Tab, Stack } from './tab'
|
3
|
-
import { Button } from './button'
|
4
|
-
import { Icon } from './icon'
|
5
|
-
|
6
|
-
/**
|
7
|
-
* Ejemplos de los componentes Tab mejorados manteniendo 100% compatibilidad
|
8
|
-
*/
|
9
|
-
export const TabExamples = () => {
|
10
|
-
const [selectedTab, setSelectedTab] = useState(0)
|
11
|
-
const [selectedVerticalTab, setSelectedVerticalTab] = useState(0)
|
12
|
-
const [selectedPersistentTab, setSelectedPersistentTab] = useState(0)
|
13
|
-
const [closableTabs, setClosableTabs] = useState([
|
14
|
-
{ id: 'tab1', label: 'Tab 1', content: 'Content 1' },
|
15
|
-
{ id: 'tab2', label: 'Tab 2', content: 'Content 2' },
|
16
|
-
{ id: 'tab3', label: 'Tab 3', content: 'Content 3' }
|
17
|
-
])
|
18
|
-
|
19
|
-
const handleTabChange = (index) => {
|
20
|
-
setSelectedTab(index)
|
21
|
-
}
|
22
|
-
|
23
|
-
const handleVerticalTabChange = (index) => {
|
24
|
-
setSelectedVerticalTab(index)
|
25
|
-
}
|
26
|
-
|
27
|
-
const handlePersistentTabChange = (index) => {
|
28
|
-
setSelectedPersistentTab(index)
|
29
|
-
}
|
30
|
-
|
31
|
-
const handleCloseTab = (id) => {
|
32
|
-
const newTabs = closableTabs.filter(tab => tab.id !== id)
|
33
|
-
setClosableTabs(newTabs)
|
34
|
-
|
35
|
-
// Adjust selected tab if necessary
|
36
|
-
const currentIndex = closableTabs.findIndex(tab => tab.id === id)
|
37
|
-
if (currentIndex <= selectedTab && selectedTab > 0) {
|
38
|
-
setSelectedTab(selectedTab - 1)
|
39
|
-
}
|
40
|
-
}
|
41
|
-
|
42
|
-
const beforeChangeHandler = async (newTab, currentTab) => {
|
43
|
-
// Simulate validation
|
44
|
-
if (newTab === 2) {
|
45
|
-
const confirmed = window.confirm('Are you sure you want to switch to Tab 3?')
|
46
|
-
return confirmed
|
47
|
-
}
|
48
|
-
return true
|
49
|
-
}
|
50
|
-
|
51
|
-
return (
|
52
|
-
<div style={{ padding: '2rem', maxWidth: '1200px', maxHeight: '100vh', overflow: 'auto' }}>
|
53
|
-
<h1>Componentes Tab Mejorados</h1>
|
54
|
-
|
55
|
-
<div style={{
|
56
|
-
background: '#f8f9fa',
|
57
|
-
padding: '1rem',
|
58
|
-
borderRadius: '8px',
|
59
|
-
marginBottom: '2rem',
|
60
|
-
border: '1px solid #e9ecef'
|
61
|
-
}}>
|
62
|
-
<h3>✅ Mejoras Implementadas (100% Compatibilidad):</h3>
|
63
|
-
<ul>
|
64
|
-
<li>🛡️ <strong>PropTypes completos</strong> - Validación y documentación detallada</li>
|
65
|
-
<li>♿ <strong>Accesibilidad completa</strong> - ARIA, navegación por teclado, focus management</li>
|
66
|
-
<li>🎯 <strong>Orientación vertical</strong> - Tabs horizontales y verticales</li>
|
67
|
-
<li>🔒 <strong>Tabs cerrable</strong> - Con botón de cierre y callbacks</li>
|
68
|
-
<li>🏷️ <strong>Badges y tooltips</strong> - Indicadores de contenido y ayuda</li>
|
69
|
-
<li>💾 <strong>Persistencia</strong> - Recuerda tab seleccionado en localStorage</li>
|
70
|
-
<li>🔄 <strong>Validación de cambios</strong> - Hook beforeChange para validar</li>
|
71
|
-
<li>⚡ <strong>Lazy loading</strong> - Stack con carga perezosa de contenido</li>
|
72
|
-
<li>📱 <strong>Responsive total</strong> - Adaptación móvil, dark mode, high contrast</li>
|
73
|
-
<li>🧪 <strong>21 Pruebas unitarias</strong> - Verifican compatibilidad y funcionalidad</li>
|
74
|
-
</ul>
|
75
|
-
</div>
|
76
|
-
|
77
|
-
{/* Tabs básicos (compatible con versión original) */}
|
78
|
-
<section style={{ marginBottom: '2rem' }}>
|
79
|
-
<h3>Tabs Básicos (100% Compatible)</h3>
|
80
|
-
<div style={{
|
81
|
-
background: '#fff',
|
82
|
-
border: '1px solid #ddd',
|
83
|
-
borderRadius: '8px',
|
84
|
-
overflow: 'hidden'
|
85
|
-
}}>
|
86
|
-
<Tabs selected={selectedTab} onChange={handleTabChange}>
|
87
|
-
<Tab label="Home" icon="home" />
|
88
|
-
<Tab label="Profile" icon="person" />
|
89
|
-
<Tab label="Settings" icon="settings" />
|
90
|
-
<Tab label="Help" icon="help" />
|
91
|
-
</Tabs>
|
92
|
-
<Stack selected={selectedTab}>
|
93
|
-
<div style={{ padding: '2rem' }}>
|
94
|
-
<h4>Home Content</h4>
|
95
|
-
<p>Welcome to the home page. This is the main dashboard.</p>
|
96
|
-
</div>
|
97
|
-
<div style={{ padding: '2rem' }}>
|
98
|
-
<h4>Profile Content</h4>
|
99
|
-
<p>Manage your profile information and preferences.</p>
|
100
|
-
</div>
|
101
|
-
<div style={{ padding: '2rem' }}>
|
102
|
-
<h4>Settings Content</h4>
|
103
|
-
<p>Configure application settings and options.</p>
|
104
|
-
</div>
|
105
|
-
<div style={{ padding: '2rem' }}>
|
106
|
-
<h4>Help Content</h4>
|
107
|
-
<p>Find help and documentation for using the application.</p>
|
108
|
-
</div>
|
109
|
-
</Stack>
|
110
|
-
</div>
|
111
|
-
</section>
|
112
|
-
|
113
|
-
{/* Tabs con badges */}
|
114
|
-
<section style={{ marginBottom: '2rem' }}>
|
115
|
-
<h3>Tabs con Badges y Tooltips</h3>
|
116
|
-
<div style={{
|
117
|
-
background: '#fff',
|
118
|
-
border: '1px solid #ddd',
|
119
|
-
borderRadius: '8px',
|
120
|
-
overflow: 'hidden'
|
121
|
-
}}>
|
122
|
-
<Tabs selected={selectedTab} onChange={handleTabChange}>
|
123
|
-
<Tab
|
124
|
-
label="Messages"
|
125
|
-
icon="mail"
|
126
|
-
badge={5}
|
127
|
-
tooltip="You have 5 unread messages"
|
128
|
-
/>
|
129
|
-
<Tab
|
130
|
-
label="Notifications"
|
131
|
-
icon="notifications"
|
132
|
-
badge="99+"
|
133
|
-
tooltip="You have many notifications"
|
134
|
-
/>
|
135
|
-
<Tab
|
136
|
-
label="Tasks"
|
137
|
-
icon="task_alt"
|
138
|
-
badge={3}
|
139
|
-
tooltip="You have 3 pending tasks"
|
140
|
-
/>
|
141
|
-
<Tab
|
142
|
-
label="Archive"
|
143
|
-
icon="archive"
|
144
|
-
tooltip="Archived items"
|
145
|
-
/>
|
146
|
-
</Tabs>
|
147
|
-
<Stack selected={selectedTab}>
|
148
|
-
<div style={{ padding: '2rem' }}>
|
149
|
-
<h4>Messages (5 unread)</h4>
|
150
|
-
<p>Your inbox with unread messages highlighted.</p>
|
151
|
-
</div>
|
152
|
-
<div style={{ padding: '2rem' }}>
|
153
|
-
<h4>Notifications (99+)</h4>
|
154
|
-
<p>System notifications and alerts.</p>
|
155
|
-
</div>
|
156
|
-
<div style={{ padding: '2rem' }}>
|
157
|
-
<h4>Tasks (3 pending)</h4>
|
158
|
-
<p>Your task list with pending items.</p>
|
159
|
-
</div>
|
160
|
-
<div style={{ padding: '2rem' }}>
|
161
|
-
<h4>Archive</h4>
|
162
|
-
<p>Archived messages and notifications.</p>
|
163
|
-
</div>
|
164
|
-
</Stack>
|
165
|
-
</div>
|
166
|
-
</section>
|
167
|
-
|
168
|
-
{/* Tabs verticales */}
|
169
|
-
<section style={{ marginBottom: '2rem' }}>
|
170
|
-
<h3>Tabs Verticales</h3>
|
171
|
-
<div style={{
|
172
|
-
background: '#fff',
|
173
|
-
border: '1px solid #ddd',
|
174
|
-
borderRadius: '8px',
|
175
|
-
overflow: 'hidden',
|
176
|
-
display: 'flex',
|
177
|
-
height: '300px'
|
178
|
-
}}>
|
179
|
-
<Tabs
|
180
|
-
selected={selectedVerticalTab}
|
181
|
-
onChange={handleVerticalTabChange}
|
182
|
-
orientation="vertical"
|
183
|
-
fillLeft={false}
|
184
|
-
fillRight={false}
|
185
|
-
>
|
186
|
-
<Tab label="Dashboard" icon="dashboard" />
|
187
|
-
<Tab label="Analytics" icon="analytics" />
|
188
|
-
<Tab label="Reports" icon="assessment" />
|
189
|
-
<Tab label="Users" icon="people" />
|
190
|
-
</Tabs>
|
191
|
-
<Stack selected={selectedVerticalTab} style={{ flex: 1 }}>
|
192
|
-
<div style={{ padding: '2rem' }}>
|
193
|
-
<h4>Dashboard</h4>
|
194
|
-
<p>Main dashboard with key metrics and overview.</p>
|
195
|
-
</div>
|
196
|
-
<div style={{ padding: '2rem' }}>
|
197
|
-
<h4>Analytics</h4>
|
198
|
-
<p>Detailed analytics and data visualization.</p>
|
199
|
-
</div>
|
200
|
-
<div style={{ padding: '2rem' }}>
|
201
|
-
<h4>Reports</h4>
|
202
|
-
<p>Generate and view various reports.</p>
|
203
|
-
</div>
|
204
|
-
<div style={{ padding: '2rem' }}>
|
205
|
-
<h4>Users</h4>
|
206
|
-
<p>User management and administration.</p>
|
207
|
-
</div>
|
208
|
-
</Stack>
|
209
|
-
</div>
|
210
|
-
</section>
|
211
|
-
|
212
|
-
{/* Tabs cerrables */}
|
213
|
-
<section style={{ marginBottom: '2rem' }}>
|
214
|
-
<h3>Tabs Cerrables</h3>
|
215
|
-
<div style={{
|
216
|
-
background: '#fff',
|
217
|
-
border: '1px solid #ddd',
|
218
|
-
borderRadius: '8px',
|
219
|
-
overflow: 'hidden'
|
220
|
-
}}>
|
221
|
-
<Tabs selected={selectedTab} onChange={handleTabChange}>
|
222
|
-
{closableTabs.map((tab, index) => (
|
223
|
-
<Tab
|
224
|
-
key={tab.id}
|
225
|
-
id={tab.id}
|
226
|
-
label={tab.label}
|
227
|
-
icon="description"
|
228
|
-
closeable={true}
|
229
|
-
onClose={handleCloseTab}
|
230
|
-
/>
|
231
|
-
))}
|
232
|
-
<Tab
|
233
|
-
label="Add New"
|
234
|
-
icon="add"
|
235
|
-
onSelect={() => {
|
236
|
-
const newId = `tab${Date.now()}`
|
237
|
-
const newTab = {
|
238
|
-
id: newId,
|
239
|
-
label: `New Tab ${closableTabs.length + 1}`,
|
240
|
-
content: `Content for new tab ${closableTabs.length + 1}`
|
241
|
-
}
|
242
|
-
setClosableTabs([...closableTabs, newTab])
|
243
|
-
setSelectedTab(closableTabs.length)
|
244
|
-
}}
|
245
|
-
/>
|
246
|
-
</Tabs>
|
247
|
-
<Stack selected={selectedTab}>
|
248
|
-
{closableTabs.map((tab, index) => (
|
249
|
-
<div key={tab.id} style={{ padding: '2rem' }}>
|
250
|
-
<h4>{tab.label}</h4>
|
251
|
-
<p>{tab.content}</p>
|
252
|
-
<Button
|
253
|
-
label="Close Tab"
|
254
|
-
icon="close"
|
255
|
-
action={() => handleCloseTab(tab.id)}
|
256
|
-
/>
|
257
|
-
</div>
|
258
|
-
))}
|
259
|
-
</Stack>
|
260
|
-
</div>
|
261
|
-
</section>
|
262
|
-
|
263
|
-
{/* Tabs con validación */}
|
264
|
-
<section style={{ marginBottom: '2rem' }}>
|
265
|
-
<h3>Tabs con Validación (beforeChange)</h3>
|
266
|
-
<div style={{
|
267
|
-
background: '#fff',
|
268
|
-
border: '1px solid #ddd',
|
269
|
-
borderRadius: '8px',
|
270
|
-
overflow: 'hidden'
|
271
|
-
}}>
|
272
|
-
<Tabs
|
273
|
-
selected={selectedTab}
|
274
|
-
onChange={handleTabChange}
|
275
|
-
beforeChange={beforeChangeHandler}
|
276
|
-
>
|
277
|
-
<Tab label="Tab 1" icon="looks_one" />
|
278
|
-
<Tab label="Tab 2" icon="looks_two" />
|
279
|
-
<Tab label="Tab 3 (Protected)" icon="looks_3" />
|
280
|
-
<Tab label="Tab 4" icon="looks_4" />
|
281
|
-
</Tabs>
|
282
|
-
<Stack selected={selectedTab}>
|
283
|
-
<div style={{ padding: '2rem' }}>
|
284
|
-
<h4>Tab 1</h4>
|
285
|
-
<p>This tab can be accessed freely.</p>
|
286
|
-
</div>
|
287
|
-
<div style={{ padding: '2rem' }}>
|
288
|
-
<h4>Tab 2</h4>
|
289
|
-
<p>This tab can also be accessed freely.</p>
|
290
|
-
</div>
|
291
|
-
<div style={{ padding: '2rem' }}>
|
292
|
-
<h4>Tab 3 (Protected)</h4>
|
293
|
-
<p>This tab requires confirmation before switching to it.</p>
|
294
|
-
</div>
|
295
|
-
<div style={{ padding: '2rem' }}>
|
296
|
-
<h4>Tab 4</h4>
|
297
|
-
<p>This tab can be accessed freely.</p>
|
298
|
-
</div>
|
299
|
-
</Stack>
|
300
|
-
</div>
|
301
|
-
</section>
|
302
|
-
|
303
|
-
{/* Tabs persistentes */}
|
304
|
-
<section style={{ marginBottom: '2rem' }}>
|
305
|
-
<h3>Tabs Persistentes (localStorage)</h3>
|
306
|
-
<div style={{
|
307
|
-
background: '#fff',
|
308
|
-
border: '1px solid #ddd',
|
309
|
-
borderRadius: '8px',
|
310
|
-
overflow: 'hidden'
|
311
|
-
}}>
|
312
|
-
<Tabs
|
313
|
-
selected={selectedPersistentTab}
|
314
|
-
onChange={handlePersistentTabChange}
|
315
|
-
persistent={true}
|
316
|
-
persistKey="example-tabs"
|
317
|
-
>
|
318
|
-
<Tab label="Persistent 1" icon="save" />
|
319
|
-
<Tab label="Persistent 2" icon="bookmark" />
|
320
|
-
<Tab label="Persistent 3" icon="favorite" />
|
321
|
-
</Tabs>
|
322
|
-
<Stack selected={selectedPersistentTab}>
|
323
|
-
<div style={{ padding: '2rem' }}>
|
324
|
-
<h4>Persistent Tab 1</h4>
|
325
|
-
<p>This tab selection is saved to localStorage and will be remembered when you reload the page.</p>
|
326
|
-
</div>
|
327
|
-
<div style={{ padding: '2rem' }}>
|
328
|
-
<h4>Persistent Tab 2</h4>
|
329
|
-
<p>Try switching tabs and then refreshing the page - your selection will be preserved.</p>
|
330
|
-
</div>
|
331
|
-
<div style={{ padding: '2rem' }}>
|
332
|
-
<h4>Persistent Tab 3</h4>
|
333
|
-
<p>This persistence feature is useful for maintaining user preferences across sessions.</p>
|
334
|
-
</div>
|
335
|
-
</Stack>
|
336
|
-
</div>
|
337
|
-
</section>
|
338
|
-
|
339
|
-
{/* Stack con lazy loading */}
|
340
|
-
<section style={{ marginBottom: '2rem' }}>
|
341
|
-
<h3>Stack con Lazy Loading</h3>
|
342
|
-
<div style={{
|
343
|
-
background: '#fff',
|
344
|
-
border: '1px solid #ddd',
|
345
|
-
borderRadius: '8px',
|
346
|
-
overflow: 'hidden'
|
347
|
-
}}>
|
348
|
-
<Tabs selected={selectedTab} onChange={handleTabChange}>
|
349
|
-
<Tab label="Lazy 1" icon="hourglass_empty" />
|
350
|
-
<Tab label="Lazy 2" icon="hourglass_full" />
|
351
|
-
<Tab label="Lazy 3" icon="schedule" />
|
352
|
-
</Tabs>
|
353
|
-
<Stack selected={selectedTab} lazy={true} keepMounted={true}>
|
354
|
-
<div style={{ padding: '2rem' }}>
|
355
|
-
<h4>Lazy Loaded Content 1</h4>
|
356
|
-
<p>This content is only rendered when the tab is first accessed.</p>
|
357
|
-
<p>Timestamp: {new Date().toLocaleTimeString()}</p>
|
358
|
-
</div>
|
359
|
-
<div style={{ padding: '2rem' }}>
|
360
|
-
<h4>Lazy Loaded Content 2</h4>
|
361
|
-
<p>Heavy components can benefit from lazy loading to improve initial render performance.</p>
|
362
|
-
<p>Timestamp: {new Date().toLocaleTimeString()}</p>
|
363
|
-
</div>
|
364
|
-
<div style={{ padding: '2rem' }}>
|
365
|
-
<h4>Lazy Loaded Content 3</h4>
|
366
|
-
<p>Once loaded, content is kept mounted for better user experience.</p>
|
367
|
-
<p>Timestamp: {new Date().toLocaleTimeString()}</p>
|
368
|
-
</div>
|
369
|
-
</Stack>
|
370
|
-
</div>
|
371
|
-
</section>
|
372
|
-
|
373
|
-
{/* Comparación antes/después */}
|
374
|
-
<section style={{ marginBottom: '2rem' }}>
|
375
|
-
<h3>Comparación: Tab Original vs Mejorado</h3>
|
376
|
-
<div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: '1rem' }}>
|
377
|
-
<div style={{
|
378
|
-
background: '#ffebee',
|
379
|
-
padding: '1rem',
|
380
|
-
borderRadius: '4px',
|
381
|
-
border: '1px solid #ffcdd2'
|
382
|
-
}}>
|
383
|
-
<h4>❌ Tab Original</h4>
|
384
|
-
<ul>
|
385
|
-
<li>Sin PropTypes ni validación</li>
|
386
|
-
<li>Sin accesibilidad</li>
|
387
|
-
<li>Solo orientación horizontal</li>
|
388
|
-
<li>Sin tabs cerrables</li>
|
389
|
-
<li>Sin badges ni tooltips</li>
|
390
|
-
<li>Sin persistencia</li>
|
391
|
-
<li>Sin validación de cambios</li>
|
392
|
-
<li>Sin lazy loading</li>
|
393
|
-
<li>CSS básico sin responsive</li>
|
394
|
-
</ul>
|
395
|
-
</div>
|
396
|
-
<div style={{
|
397
|
-
background: '#e8f5e8',
|
398
|
-
padding: '1rem',
|
399
|
-
borderRadius: '4px',
|
400
|
-
border: '1px solid #c8e6c9'
|
401
|
-
}}>
|
402
|
-
<h4>✅ Tab Mejorado</h4>
|
403
|
-
<ul>
|
404
|
-
<li>PropTypes completos</li>
|
405
|
-
<li>Accesibilidad total (WCAG 2.1 AA)</li>
|
406
|
-
<li>Orientación horizontal y vertical</li>
|
407
|
-
<li>Tabs cerrables con callbacks</li>
|
408
|
-
<li>Badges, tooltips y meta información</li>
|
409
|
-
<li>Persistencia en localStorage</li>
|
410
|
-
<li>Hook beforeChange para validación</li>
|
411
|
-
<li>Stack con lazy loading</li>
|
412
|
-
<li>CSS responsive con dark mode</li>
|
413
|
-
</ul>
|
414
|
-
</div>
|
415
|
-
</div>
|
416
|
-
</section>
|
417
|
-
|
418
|
-
{/* Garantía de compatibilidad */}
|
419
|
-
<section style={{ marginBottom: '2rem' }}>
|
420
|
-
<h3>🔒 Garantía de Compatibilidad</h3>
|
421
|
-
<div style={{
|
422
|
-
background: '#fff3cd',
|
423
|
-
padding: '1rem',
|
424
|
-
borderRadius: '4px',
|
425
|
-
border: '1px solid #ffeaa7'
|
426
|
-
}}>
|
427
|
-
<p><strong>100% Compatible con Código Existente:</strong></p>
|
428
|
-
<ul>
|
429
|
-
<li>✅ Todas las props originales funcionan exactamente igual</li>
|
430
|
-
<li>✅ Comportamiento de selección idéntico</li>
|
431
|
-
<li>✅ Stack funciona sin cambios</li>
|
432
|
-
<li>✅ CSS original preservado</li>
|
433
|
-
<li>✅ Nuevas características son opcionales</li>
|
434
|
-
<li>✅ No se rompe ningún código existente</li>
|
435
|
-
</ul>
|
436
|
-
<p style={{ marginTop: '1rem', fontSize: '0.9rem', color: '#856404' }}>
|
437
|
-
<strong>Migración:</strong> Simplemente reemplaza el import y todas las
|
438
|
-
mejoras se aplican automáticamente sin cambiar una línea de código existente.
|
439
|
-
</p>
|
440
|
-
</div>
|
441
|
-
</section>
|
442
|
-
</div>
|
443
|
-
)
|
444
|
-
}
|
445
|
-
|
446
|
-
export default TabExamples
|
package/src/html/tab.test.js
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
import React, { useState } from 'react'
|
2
|
-
import { Icon, Stack } from '.'
|
3
|
-
import { Tabs, Tab } from './tab'
|
4
|
-
|
5
|
-
const TabTest = (prop) => {
|
6
|
-
|
7
|
-
const [selected, setSelected] = useState(0)
|
8
|
-
|
9
|
-
return (
|
10
|
-
<>
|
11
|
-
<Tabs selected={selected} onChange={(id) => setSelected(id) }>
|
12
|
-
{null}
|
13
|
-
<Tab label="tab1" action={<Icon icon="close" size="small" />} />
|
14
|
-
<Tab label="tab2" action={<Icon icon="close" size="small" />} />
|
15
|
-
<Tab label="tab3" action={<Icon icon="close" size="small" />} />
|
16
|
-
</Tabs>
|
17
|
-
<Stack selected={selected}>
|
18
|
-
<div>Content 1</div>
|
19
|
-
{null}
|
20
|
-
<div>Content 2</div>
|
21
|
-
<div>Content 3</div>
|
22
|
-
</Stack>
|
23
|
-
</>
|
24
|
-
)
|
25
|
-
}
|