ywana-core8 0.1.85 → 0.1.87
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/doc/package-lock.json +4 -4
- package/doc/package.json +3 -2
- package/doc/scripts/generate-examples.js +129 -0
- package/doc/src/App.js +6 -186
- package/doc/src/components/ExamplePage.js +57 -32
- package/doc/src/index.js +2 -0
- package/package.json +1 -1
- package/src/html/index.js +23 -1
- package/doc/craco.config.js +0 -31
- package/doc/generate-examples.cjs +0 -310
- package/doc/src/examples/button.example.js +0 -47
- package/doc/src/examples/input.example.js +0 -91
- package/src/html/accordion.example.js.backup +0 -390
- package/src/html/button.example.js.backup +0 -374
- package/src/html/checkbox.example.js.backup +0 -316
- package/src/html/demo-sidebar.html +0 -410
- package/src/html/table2.migration.md +0 -328
- package/src/html/test-resize.html +0 -279
- package/src/html/test-selection.html +0 -387
@@ -1,310 +0,0 @@
|
|
1
|
-
const fs = require('fs');
|
2
|
-
const path = require('path');
|
3
|
-
|
4
|
-
/**
|
5
|
-
* Configuración de dependencias para cada componente
|
6
|
-
*/
|
7
|
-
const COMPONENT_DEPENDENCIES = {
|
8
|
-
'accordion': {
|
9
|
-
css: ['ExampleLayout.css', 'accordion.css', 'icon.css'],
|
10
|
-
js: ['icon.js', 'text.js', 'SimpleExampleLayout.js', 'accordion.js']
|
11
|
-
},
|
12
|
-
'actions-cell': {
|
13
|
-
css: ['ExampleLayout.css', 'actions-cell.css', 'icon.css', 'menu.css', 'button.css'],
|
14
|
-
js: ['icon.js', 'text.js', 'menu.js', 'button.js', 'SimpleExampleLayout.js', 'actions-cell.js']
|
15
|
-
},
|
16
|
-
'button': {
|
17
|
-
css: ['ExampleLayout.css', 'button.css', 'icon.css'],
|
18
|
-
js: ['icon.js', 'text.js', 'SimpleExampleLayout.js', 'button.js']
|
19
|
-
},
|
20
|
-
'checkbox': {
|
21
|
-
css: ['ExampleLayout.css', 'checkbox.css', 'icon.css'],
|
22
|
-
js: ['icon.js', 'text.js', 'SimpleExampleLayout.js', 'checkbox.js']
|
23
|
-
},
|
24
|
-
'chip': {
|
25
|
-
css: ['ExampleLayout.css', 'chip.css', 'icon.css'],
|
26
|
-
js: ['icon.js', 'text.js', 'SimpleExampleLayout.js', 'chip.js']
|
27
|
-
},
|
28
|
-
'color': {
|
29
|
-
css: ['ExampleLayout.css', 'color.css', 'icon.css'],
|
30
|
-
js: ['icon.js', 'text.js', 'SimpleExampleLayout.js', 'color.js']
|
31
|
-
},
|
32
|
-
'components': {
|
33
|
-
css: ['ExampleLayout.css', 'button.css', 'icon.css', 'checkbox.css', 'textfield.css'],
|
34
|
-
js: ['icon.js', 'text.js', 'button.js', 'checkbox.js', 'textfield.js', 'SimpleExampleLayout.js']
|
35
|
-
},
|
36
|
-
'form': {
|
37
|
-
css: ['ExampleLayout.css', 'form.css', 'textfield.css', 'button.css', 'checkbox.css', 'icon.css'],
|
38
|
-
js: ['icon.js', 'text.js', 'textfield.js', 'button.js', 'checkbox.js', 'SimpleExampleLayout.js', 'form.js']
|
39
|
-
},
|
40
|
-
'header2': {
|
41
|
-
css: ['ExampleLayout.css', 'header2.css', 'icon.css', 'button.css'],
|
42
|
-
js: ['icon.js', 'text.js', 'button.js', 'SimpleExampleLayout.js', 'header2.js']
|
43
|
-
},
|
44
|
-
'icon': {
|
45
|
-
css: ['ExampleLayout.css', 'icon.css'],
|
46
|
-
js: ['text.js', 'SimpleExampleLayout.js', 'icon.js']
|
47
|
-
},
|
48
|
-
'list': {
|
49
|
-
css: ['ExampleLayout.css', 'list.css', 'icon.css'],
|
50
|
-
js: ['icon.js', 'text.js', 'SimpleExampleLayout.js', 'list.js']
|
51
|
-
},
|
52
|
-
'progress': {
|
53
|
-
css: ['ExampleLayout.css', 'progress.css', 'icon.css'],
|
54
|
-
js: ['icon.js', 'text.js', 'SimpleExampleLayout.js', 'progress.js']
|
55
|
-
},
|
56
|
-
'property': {
|
57
|
-
css: ['ExampleLayout.css', 'property.css', 'icon.css'],
|
58
|
-
js: ['icon.js', 'text.js', 'SimpleExampleLayout.js', 'property.js']
|
59
|
-
},
|
60
|
-
'radio': {
|
61
|
-
css: ['ExampleLayout.css', 'radio.css', 'icon.css'],
|
62
|
-
js: ['icon.js', 'text.js', 'SimpleExampleLayout.js', 'radio.js']
|
63
|
-
},
|
64
|
-
'section': {
|
65
|
-
css: ['ExampleLayout.css', 'section.css', 'icon.css'],
|
66
|
-
js: ['icon.js', 'text.js', 'SimpleExampleLayout.js', 'section.js']
|
67
|
-
},
|
68
|
-
'switch': {
|
69
|
-
css: ['ExampleLayout.css', 'switch.css', 'icon.css'],
|
70
|
-
js: ['icon.js', 'text.js', 'SimpleExampleLayout.js', 'switch.js']
|
71
|
-
},
|
72
|
-
'tab': {
|
73
|
-
css: ['ExampleLayout.css', 'tab.css', 'icon.css'],
|
74
|
-
js: ['icon.js', 'text.js', 'SimpleExampleLayout.js', 'tab.js']
|
75
|
-
},
|
76
|
-
'table': {
|
77
|
-
css: ['ExampleLayout.css', 'table.css', 'icon.css', 'textfield.css', 'checkbox.css', 'actions-cell.css', 'menu.css', 'button.css'],
|
78
|
-
js: ['icon.js', 'text.js', 'textfield.js', 'checkbox.js', 'menu.js', 'button.js', 'actions-cell.js', 'SimpleExampleLayout.js', 'table.js']
|
79
|
-
},
|
80
|
-
'table2': {
|
81
|
-
css: ['ExampleLayout.css', 'table2.css', 'icon.css', 'textfield.css', 'checkbox.css', 'actions-cell.css', 'menu.css', 'button.css'],
|
82
|
-
js: ['icon.js', 'text.js', 'textfield.js', 'checkbox.js', 'menu.js', 'button.js', 'actions-cell.js', 'SimpleExampleLayout.js', 'table2.js']
|
83
|
-
},
|
84
|
-
'textfield2': {
|
85
|
-
css: ['ExampleLayout.css', 'textfield2.css', 'icon.css'],
|
86
|
-
js: ['icon.js', 'text.js', 'SimpleExampleLayout.js', 'textfield2.js']
|
87
|
-
},
|
88
|
-
'tokenfield': {
|
89
|
-
css: ['ExampleLayout.css', 'tokenfield.css', 'icon.css', 'chip.css'],
|
90
|
-
js: ['icon.js', 'text.js', 'chip.js', 'SimpleExampleLayout.js', 'tokenfield.js']
|
91
|
-
},
|
92
|
-
'tree': {
|
93
|
-
css: ['ExampleLayout.css', 'tree.css', 'icon.css'],
|
94
|
-
js: ['icon.js', 'text.js', 'SimpleExampleLayout.js', 'tree.js']
|
95
|
-
}
|
96
|
-
};
|
97
|
-
|
98
|
-
/**
|
99
|
-
* Mapeo de nombres de componentes a nombres de clases de ejemplo
|
100
|
-
*/
|
101
|
-
const COMPONENT_CLASS_NAMES = {
|
102
|
-
'accordion': 'AccordionExamples',
|
103
|
-
'actions-cell': 'ActionsCellExamples',
|
104
|
-
'button': 'ButtonExamples',
|
105
|
-
'checkbox': 'CheckboxExamples',
|
106
|
-
'chip': 'ChipExamples',
|
107
|
-
'color': 'ColorExamples',
|
108
|
-
'components': 'ComponentsExamples',
|
109
|
-
'form': 'FormExamples',
|
110
|
-
'header2': 'Header2Examples',
|
111
|
-
'icon': 'IconExamples',
|
112
|
-
'list': 'ListExamples',
|
113
|
-
'progress': 'ProgressExamples',
|
114
|
-
'property': 'PropertyExamples',
|
115
|
-
'radio': 'RadioExamples',
|
116
|
-
'section': 'SectionExamples',
|
117
|
-
'switch': 'SwitchExamples',
|
118
|
-
'tab': 'TabExamples',
|
119
|
-
'table': 'TableExamples',
|
120
|
-
'table2': 'Table2Examples',
|
121
|
-
'textfield2': 'TextField2Examples',
|
122
|
-
'tokenfield': 'TokenFieldExamples',
|
123
|
-
'tree': 'TreeExamples'
|
124
|
-
};
|
125
|
-
|
126
|
-
/**
|
127
|
-
* Generar HTML para un componente específico
|
128
|
-
*/
|
129
|
-
function generateExampleHTML(componentName, title) {
|
130
|
-
const deps = COMPONENT_DEPENDENCIES[componentName] || { css: [], js: [] };
|
131
|
-
const className = COMPONENT_CLASS_NAMES[componentName] || `${componentName}Examples`;
|
132
|
-
|
133
|
-
const cssImports = deps.css.map(file => ` <link rel="stylesheet" href="${file}">`).join('\n');
|
134
|
-
const jsImports = deps.js.map(file => ` <script type="text/babel" src="${file}"></script>`).join('\n');
|
135
|
-
|
136
|
-
return `<!DOCTYPE html>
|
137
|
-
<html lang="es">
|
138
|
-
<head>
|
139
|
-
<meta charset="UTF-8">
|
140
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
141
|
-
<title>${title} - Ywana Core8</title>
|
142
|
-
|
143
|
-
<!-- CSS Variables -->
|
144
|
-
<style>
|
145
|
-
:root {
|
146
|
-
--primary-color: #1976d2;
|
147
|
-
--primary-color-light: #42a5f5;
|
148
|
-
--primary-color-lighter: #e3f2fd;
|
149
|
-
--secondary-color: #424242;
|
150
|
-
--text-color: #212121;
|
151
|
-
--text-color-light: #757575;
|
152
|
-
--text-color-lighter: #bdbdbd;
|
153
|
-
--paper-color: #ffffff;
|
154
|
-
--background-color: #fafafa;
|
155
|
-
--divider-color: #e0e0e0;
|
156
|
-
--shadow1: 0 2px 4px rgba(0,0,0,0.1);
|
157
|
-
--shadow2: 0 4px 8px rgba(0,0,0,0.15);
|
158
|
-
}
|
159
|
-
|
160
|
-
* {
|
161
|
-
margin: 0;
|
162
|
-
padding: 0;
|
163
|
-
box-sizing: border-box;
|
164
|
-
}
|
165
|
-
|
166
|
-
body {
|
167
|
-
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
168
|
-
background-color: var(--background-color);
|
169
|
-
color: var(--text-color);
|
170
|
-
line-height: 1.6;
|
171
|
-
}
|
172
|
-
|
173
|
-
#root {
|
174
|
-
min-height: 100vh;
|
175
|
-
}
|
176
|
-
|
177
|
-
.loading {
|
178
|
-
display: flex;
|
179
|
-
justify-content: center;
|
180
|
-
align-items: center;
|
181
|
-
height: 50vh;
|
182
|
-
font-size: 1.2rem;
|
183
|
-
color: var(--text-color-light);
|
184
|
-
}
|
185
|
-
|
186
|
-
/* Hide code snippets in iframe view */
|
187
|
-
.code-snippet,
|
188
|
-
.example-code,
|
189
|
-
pre,
|
190
|
-
code {
|
191
|
-
display: none !important;
|
192
|
-
}
|
193
|
-
|
194
|
-
/* Ensure examples are visible and well-spaced */
|
195
|
-
.example-section {
|
196
|
-
margin-bottom: 2rem;
|
197
|
-
}
|
198
|
-
|
199
|
-
.example-subsection {
|
200
|
-
margin-bottom: 1.5rem;
|
201
|
-
}
|
202
|
-
|
203
|
-
/* Make sure interactive elements work in iframe */
|
204
|
-
.example-content {
|
205
|
-
padding: 1rem;
|
206
|
-
}
|
207
|
-
</style>
|
208
|
-
|
209
|
-
<!-- Material Icons -->
|
210
|
-
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
211
|
-
|
212
|
-
<!-- Component Styles -->
|
213
|
-
${cssImports}
|
214
|
-
|
215
|
-
<!-- React Development -->
|
216
|
-
<script crossorigin src="react.development.js"></script>
|
217
|
-
<script crossorigin src="react-dom.development.js"></script>
|
218
|
-
|
219
|
-
<!-- Babel for JSX transformation -->
|
220
|
-
<script src="https://unpkg.com/@babel/standalone/babel.min.js"></script>
|
221
|
-
</head>
|
222
|
-
<body>
|
223
|
-
<div id="root">
|
224
|
-
<div class="loading">Cargando ${title}...</div>
|
225
|
-
</div>
|
226
|
-
|
227
|
-
<!-- Component Scripts -->
|
228
|
-
${jsImports}
|
229
|
-
|
230
|
-
<!-- Example Script -->
|
231
|
-
<script type="text/babel">
|
232
|
-
// Import the example component and override CodeSnippet
|
233
|
-
const originalCodeSnippet = window.CodeSnippet;
|
234
|
-
window.CodeSnippet = () => null; // Hide all code snippets
|
235
|
-
|
236
|
-
// Load the example
|
237
|
-
import('./${componentName}.example.js').then(module => {
|
238
|
-
const ExampleComponent = module.${className} || module.default;
|
239
|
-
if (ExampleComponent) {
|
240
|
-
ReactDOM.render(React.createElement(ExampleComponent), document.getElementById('root'));
|
241
|
-
}
|
242
|
-
}).catch(() => {
|
243
|
-
// Fallback: try to load synchronously
|
244
|
-
const script = document.createElement('script');
|
245
|
-
script.type = 'text/babel';
|
246
|
-
script.src = '${componentName}.example.js';
|
247
|
-
script.onload = () => {
|
248
|
-
setTimeout(() => {
|
249
|
-
const ExampleComponent = window.${className};
|
250
|
-
if (ExampleComponent) {
|
251
|
-
ReactDOM.render(React.createElement(ExampleComponent), document.getElementById('root'));
|
252
|
-
}
|
253
|
-
}, 100);
|
254
|
-
};
|
255
|
-
document.head.appendChild(script);
|
256
|
-
});
|
257
|
-
</script>
|
258
|
-
</body>
|
259
|
-
</html>`;
|
260
|
-
}
|
261
|
-
|
262
|
-
/**
|
263
|
-
* Generar todos los archivos HTML
|
264
|
-
*/
|
265
|
-
function generateAllExamples() {
|
266
|
-
const examples = [
|
267
|
-
{ name: 'accordion', title: 'Accordion Examples' },
|
268
|
-
{ name: 'actions-cell', title: 'Actions Cell Examples' },
|
269
|
-
{ name: 'button', title: 'Button Examples' },
|
270
|
-
{ name: 'checkbox', title: 'Checkbox Examples' },
|
271
|
-
{ name: 'chip', title: 'Chip Examples' },
|
272
|
-
{ name: 'color', title: 'Color Examples' },
|
273
|
-
{ name: 'components', title: 'Components Overview' },
|
274
|
-
{ name: 'form', title: 'Form Examples' },
|
275
|
-
{ name: 'header2', title: 'Header Examples' },
|
276
|
-
{ name: 'icon', title: 'Icon Examples' },
|
277
|
-
{ name: 'list', title: 'List Examples' },
|
278
|
-
{ name: 'progress', title: 'Progress Examples' },
|
279
|
-
{ name: 'property', title: 'Property Examples' },
|
280
|
-
{ name: 'radio', title: 'Radio Examples' },
|
281
|
-
{ name: 'section', title: 'Section Examples' },
|
282
|
-
{ name: 'switch', title: 'Switch Examples' },
|
283
|
-
{ name: 'tab', title: 'Tab Examples' },
|
284
|
-
{ name: 'table', title: 'Table Examples' },
|
285
|
-
{ name: 'table2', title: 'Table2 Examples' },
|
286
|
-
{ name: 'textfield2', title: 'TextField Examples' },
|
287
|
-
{ name: 'tokenfield', title: 'TokenField Examples' },
|
288
|
-
{ name: 'tree', title: 'Tree Examples' }
|
289
|
-
];
|
290
|
-
|
291
|
-
const libDir = path.join(__dirname, 'lib');
|
292
|
-
|
293
|
-
examples.forEach(example => {
|
294
|
-
const html = generateExampleHTML(example.name, example.title);
|
295
|
-
const filename = `${example.name}.example.html`;
|
296
|
-
const filepath = path.join(libDir, filename);
|
297
|
-
|
298
|
-
fs.writeFileSync(filepath, html, 'utf8');
|
299
|
-
console.log(`Generated: ${filename}`);
|
300
|
-
});
|
301
|
-
|
302
|
-
console.log(`\nGenerated ${examples.length} example HTML files!`);
|
303
|
-
}
|
304
|
-
|
305
|
-
// Ejecutar si se llama directamente
|
306
|
-
if (require.main === module) {
|
307
|
-
generateAllExamples();
|
308
|
-
}
|
309
|
-
|
310
|
-
module.exports = { generateAllExamples, generateExampleHTML };
|
@@ -1,47 +0,0 @@
|
|
1
|
-
import React from 'react';
|
2
|
-
import { Button } from 'ywana-core8/html';
|
3
|
-
|
4
|
-
const ButtonExamples = () => {
|
5
|
-
return (
|
6
|
-
<div className="examples-grid">
|
7
|
-
<div className="example-section">
|
8
|
-
<h3>Variantes Básicas</h3>
|
9
|
-
<div className="example-row">
|
10
|
-
<Button>Primario</Button>
|
11
|
-
<Button variant="secondary">Secundario</Button>
|
12
|
-
<Button variant="outline">Outline</Button>
|
13
|
-
<Button variant="ghost">Ghost</Button>
|
14
|
-
</div>
|
15
|
-
</div>
|
16
|
-
|
17
|
-
<div className="example-section">
|
18
|
-
<h3>Tamaños</h3>
|
19
|
-
<div className="example-row">
|
20
|
-
<Button size="small">Pequeño</Button>
|
21
|
-
<Button size="medium">Mediano</Button>
|
22
|
-
<Button size="large">Grande</Button>
|
23
|
-
</div>
|
24
|
-
</div>
|
25
|
-
|
26
|
-
<div className="example-section">
|
27
|
-
<h3>Estados</h3>
|
28
|
-
<div className="example-row">
|
29
|
-
<Button>Normal</Button>
|
30
|
-
<Button disabled>Deshabilitado</Button>
|
31
|
-
<Button loading>Cargando</Button>
|
32
|
-
</div>
|
33
|
-
</div>
|
34
|
-
|
35
|
-
<div className="example-section">
|
36
|
-
<h3>Con Iconos</h3>
|
37
|
-
<div className="example-row">
|
38
|
-
<Button icon="add">Agregar</Button>
|
39
|
-
<Button icon="delete" variant="outline">Eliminar</Button>
|
40
|
-
<Button icon="save" iconPosition="right">Guardar</Button>
|
41
|
-
</div>
|
42
|
-
</div>
|
43
|
-
</div>
|
44
|
-
);
|
45
|
-
};
|
46
|
-
|
47
|
-
export default ButtonExamples;
|
@@ -1,91 +0,0 @@
|
|
1
|
-
import React, { useState } from 'react';
|
2
|
-
import { Input } from 'ywana-core8/html';
|
3
|
-
|
4
|
-
const InputExamples = () => {
|
5
|
-
const [values, setValues] = useState({
|
6
|
-
basic: '',
|
7
|
-
email: '',
|
8
|
-
password: '',
|
9
|
-
search: ''
|
10
|
-
});
|
11
|
-
|
12
|
-
const handleChange = (name, value) => {
|
13
|
-
setValues(prev => ({ ...prev, [name]: value }));
|
14
|
-
};
|
15
|
-
|
16
|
-
return (
|
17
|
-
<div className="examples-grid">
|
18
|
-
<div className="example-section">
|
19
|
-
<h3>Tipos Básicos</h3>
|
20
|
-
<div className="example-column">
|
21
|
-
<Input
|
22
|
-
label="Texto básico"
|
23
|
-
placeholder="Ingresa tu nombre"
|
24
|
-
value={values.basic}
|
25
|
-
onChange={(value) => handleChange('basic', value)}
|
26
|
-
/>
|
27
|
-
<Input
|
28
|
-
type="email"
|
29
|
-
label="Email"
|
30
|
-
placeholder="tu@email.com"
|
31
|
-
value={values.email}
|
32
|
-
onChange={(value) => handleChange('email', value)}
|
33
|
-
/>
|
34
|
-
<Input
|
35
|
-
type="password"
|
36
|
-
label="Contraseña"
|
37
|
-
placeholder="••••••••"
|
38
|
-
value={values.password}
|
39
|
-
onChange={(value) => handleChange('password', value)}
|
40
|
-
/>
|
41
|
-
</div>
|
42
|
-
</div>
|
43
|
-
|
44
|
-
<div className="example-section">
|
45
|
-
<h3>Con Iconos</h3>
|
46
|
-
<div className="example-column">
|
47
|
-
<Input
|
48
|
-
label="Búsqueda"
|
49
|
-
placeholder="Buscar..."
|
50
|
-
icon="search"
|
51
|
-
value={values.search}
|
52
|
-
onChange={(value) => handleChange('search', value)}
|
53
|
-
/>
|
54
|
-
<Input
|
55
|
-
label="Usuario"
|
56
|
-
placeholder="Nombre de usuario"
|
57
|
-
icon="person"
|
58
|
-
iconPosition="left"
|
59
|
-
/>
|
60
|
-
</div>
|
61
|
-
</div>
|
62
|
-
|
63
|
-
<div className="example-section">
|
64
|
-
<h3>Estados</h3>
|
65
|
-
<div className="example-column">
|
66
|
-
<Input
|
67
|
-
label="Campo normal"
|
68
|
-
placeholder="Estado normal"
|
69
|
-
/>
|
70
|
-
<Input
|
71
|
-
label="Campo deshabilitado"
|
72
|
-
placeholder="No editable"
|
73
|
-
disabled
|
74
|
-
/>
|
75
|
-
<Input
|
76
|
-
label="Campo con error"
|
77
|
-
placeholder="Valor inválido"
|
78
|
-
error="Este campo es requerido"
|
79
|
-
/>
|
80
|
-
<Input
|
81
|
-
label="Campo exitoso"
|
82
|
-
placeholder="Valor válido"
|
83
|
-
success="¡Perfecto!"
|
84
|
-
/>
|
85
|
-
</div>
|
86
|
-
</div>
|
87
|
-
</div>
|
88
|
-
);
|
89
|
-
};
|
90
|
-
|
91
|
-
export default InputExamples;
|