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.
@@ -12,7 +12,7 @@
12
12
  "react": "^19.1.1",
13
13
  "react-dom": "^19.1.1",
14
14
  "react-scripts": "^5.0.1",
15
- "ywana-core8": "^0.1.84"
15
+ "ywana-core8": "^0.1.86"
16
16
  }
17
17
  },
18
18
  "..": {
@@ -17268,9 +17268,9 @@
17268
17268
  }
17269
17269
  },
17270
17270
  "node_modules/ywana-core8": {
17271
- "version": "0.1.84",
17272
- "resolved": "https://registry.npmjs.org/ywana-core8/-/ywana-core8-0.1.84.tgz",
17273
- "integrity": "sha512-ePmMlqSWXb6HD6B8mHwMTdRw3UQ/5MpRwNg+OyobShBJxcyh7tVJvfLCutRBu4N0FPnoZegZ5e3ZWtiIykBjTg==",
17271
+ "version": "0.1.86",
17272
+ "resolved": "https://registry.npmjs.org/ywana-core8/-/ywana-core8-0.1.86.tgz",
17273
+ "integrity": "sha512-0MWgcYt8baMOnCgd2tfyvHGsTNdn9DMBj0gk1uUwINlKS5axUk19aD2QBgYz6VSGtLI8YLSHLUatE1dr6ofnkg==",
17274
17274
  "dependencies": {
17275
17275
  "axios": "^1.3.4",
17276
17276
  "crypto-js": "^4.1.1",
package/doc/package.json CHANGED
@@ -7,7 +7,8 @@
7
7
  "start": "react-scripts start",
8
8
  "build": "react-scripts build",
9
9
  "test": "react-scripts test",
10
- "eject": "react-scripts eject"
10
+ "eject": "react-scripts eject",
11
+ "generate-examples": "node scripts/generate-examples.js"
11
12
  },
12
13
  "keywords": [],
13
14
  "author": "",
@@ -16,7 +17,7 @@
16
17
  "react": "^19.1.1",
17
18
  "react-dom": "^19.1.1",
18
19
  "react-scripts": "^5.0.1",
19
- "ywana-core8": "^0.1.84"
20
+ "ywana-core8": "^0.1.86"
20
21
  },
21
22
  "browserslist": {
22
23
  "production": [
@@ -0,0 +1,129 @@
1
+ const fs = require('fs');
2
+ const path = require('path');
3
+
4
+ // Función para convertir nombre de archivo a título legible
5
+ function fileNameToTitle(fileName) {
6
+ return fileName
7
+ .replace('.example.js', '')
8
+ .replace(/[-_]/g, ' ')
9
+ .replace(/\b\w/g, l => l.toUpperCase());
10
+ }
11
+
12
+ // Función para determinar el icono basado en el tipo de componente
13
+ function getIconForComponent(fileName) {
14
+ const iconMap = {
15
+ 'button': 'smart_button',
16
+ 'input': 'input',
17
+ 'textfield': 'text_fields',
18
+ 'checkbox': 'check_box',
19
+ 'radio': 'radio_button_checked',
20
+ 'switch': 'toggle_on',
21
+ 'accordion': 'expand_more',
22
+ 'tab': 'tab',
23
+ 'table': 'table_chart',
24
+ 'form': 'description',
25
+ 'header': 'title',
26
+ 'icon': 'star',
27
+ 'list': 'list',
28
+ 'menu': 'menu',
29
+ 'progress': 'progress_activity',
30
+ 'chip': 'label',
31
+ 'color': 'palette',
32
+ 'section': 'view_module',
33
+ 'tree': 'account_tree',
34
+ 'tooltip': 'help',
35
+ 'thumbnail': 'image',
36
+ 'tokenfield': 'token'
37
+ };
38
+
39
+ const componentName = fileName.replace('.example.js', '');
40
+ return iconMap[componentName] || 'widgets';
41
+ }
42
+
43
+ // Función para determinar la categoría
44
+ function getCategoryForComponent(fileName) {
45
+ const categoryMap = {
46
+ 'button': 'Inputs',
47
+ 'textfield': 'Inputs',
48
+ 'textfield2': 'Inputs',
49
+ 'checkbox': 'Inputs',
50
+ 'radio': 'Inputs',
51
+ 'switch': 'Inputs',
52
+ 'tokenfield': 'Inputs',
53
+ 'form': 'Forms',
54
+ 'accordion': 'Layout',
55
+ 'tab': 'Layout',
56
+ 'section': 'Layout',
57
+ 'header': 'Layout',
58
+ 'header2': 'Layout',
59
+ 'table': 'Data',
60
+ 'table2': 'Data',
61
+ 'list': 'Data',
62
+ 'tree': 'Data',
63
+ 'icon': 'Display',
64
+ 'chip': 'Display',
65
+ 'color': 'Display',
66
+ 'progress': 'Display',
67
+ 'thumbnail': 'Display',
68
+ 'tooltip': 'Display',
69
+ 'menu': 'Navigation',
70
+ 'property': 'Utils',
71
+ 'selector': 'Utils',
72
+ 'actions-cell': 'Utils'
73
+ };
74
+
75
+ const componentName = fileName.replace('.example.js', '');
76
+ return categoryMap[componentName] || 'Components';
77
+ }
78
+
79
+ // Leer archivos de ejemplos
80
+ function generateExamplesConfig() {
81
+ const examplesDir = path.join(__dirname, '../src/examples');
82
+
83
+ if (!fs.existsSync(examplesDir)) {
84
+ console.error('La carpeta src/examples no existe. Creando ejemplos básicos...');
85
+ createBasicExamples();
86
+ return;
87
+ }
88
+
89
+ const files = fs.readdirSync(examplesDir);
90
+ const exampleFiles = files.filter(file => file.endsWith('.example.js'));
91
+
92
+ const examples = exampleFiles.map(file => {
93
+ const componentName = file.replace('.example.js', '');
94
+ return {
95
+ id: componentName,
96
+ title: fileNameToTitle(file),
97
+ icon: getIconForComponent(file),
98
+ category: getCategoryForComponent(file),
99
+ file: file
100
+ };
101
+ });
102
+
103
+ // Generar el archivo de configuración
104
+ const configContent = `// Este archivo es generado automáticamente por scripts/generate-examples.js
105
+ // No editar manualmente
106
+
107
+ export const EXAMPLES_CONFIG = ${JSON.stringify(examples, null, 2)};
108
+
109
+ // Función para importar dinámicamente los ejemplos
110
+ export const importExample = async (fileName) => {
111
+ try {
112
+ const module = await import(\`../examples/\${fileName}\`);
113
+ return module.default || module;
114
+ } catch (error) {
115
+ console.error(\`Error importing example \${fileName}:\`, error);
116
+ return null;
117
+ }
118
+ };
119
+ `;
120
+
121
+ // Escribir el archivo
122
+ const configPath = path.join(__dirname, '../src/examples-config.js');
123
+ fs.writeFileSync(configPath, configContent);
124
+
125
+ console.log(`✅ Generados ${examples.length} ejemplos en src/examples-config.js`);
126
+ console.log('Categorías encontradas:', [...new Set(examples.map(e => e.category))]);
127
+ }
128
+
129
+ generateExamplesConfig();
package/doc/src/App.js CHANGED
@@ -1,188 +1,16 @@
1
1
  import React from 'react';
2
2
  import { Site, Page } from 'ywana-core8';
3
+ import { ButtonExample } from 'ywana-core8'
3
4
  import './App.css';
4
5
 
5
6
  // Importar componentes de ejemplo
6
7
  import WelcomePage from './components/WelcomePage';
7
- import ExamplePage from './components/ExamplePage';
8
-
9
- // Configuración de ejemplos
10
- const EXAMPLES_CONFIG = [
11
- {
12
- id: 'button-examples',
13
- title: 'Button',
14
- description: 'Componente de botón con diferentes variantes y estados',
15
- category: 'Inputs',
16
- icon: 'smart_button',
17
- file: 'button.example.js'
18
- },
19
- {
20
- id: 'input-examples',
21
- title: 'Input',
22
- description: 'Campos de entrada de texto con validación y estados',
23
- category: 'Inputs',
24
- icon: 'input',
25
- file: 'input.example.js'
26
- },
27
- {
28
- id: 'select-examples',
29
- title: 'Select',
30
- description: 'Componente de selección con opciones múltiples',
31
- category: 'Inputs',
32
- icon: 'arrow_drop_down_circle',
33
- file: 'select.example.js'
34
- },
35
- {
36
- id: 'checkbox-examples',
37
- title: 'Checkbox',
38
- description: 'Casillas de verificación con estados personalizados',
39
- category: 'Inputs',
40
- icon: 'check_box',
41
- file: 'checkbox.example.js'
42
- },
43
- {
44
- id: 'radio-examples',
45
- title: 'Radio',
46
- description: 'Botones de radio para selección única',
47
- category: 'Inputs',
48
- icon: 'radio_button_checked',
49
- file: 'radio.example.js'
50
- },
51
- {
52
- id: 'textarea-examples',
53
- title: 'Textarea',
54
- description: 'Área de texto multilínea con redimensionamiento',
55
- category: 'Inputs',
56
- icon: 'notes',
57
- file: 'textarea.example.js'
58
- },
59
- {
60
- id: 'switch-examples',
61
- title: 'Switch',
62
- description: 'Interruptores de encendido/apagado',
63
- category: 'Inputs',
64
- icon: 'toggle_on',
65
- file: 'switch.example.js'
66
- },
67
- {
68
- id: 'slider-examples',
69
- title: 'Slider',
70
- description: 'Control deslizante para selección de valores',
71
- category: 'Inputs',
72
- icon: 'tune',
73
- file: 'slider.example.js'
74
- },
75
- {
76
- id: 'card-examples',
77
- title: 'Card',
78
- description: 'Tarjetas de contenido con diferentes layouts',
79
- category: 'Layout',
80
- icon: 'credit_card',
81
- file: 'card.example.js'
82
- },
83
- {
84
- id: 'modal-examples',
85
- title: 'Modal',
86
- description: 'Ventanas modales y diálogos',
87
- category: 'Layout',
88
- icon: 'open_in_new',
89
- file: 'modal.example.js'
90
- },
91
- {
92
- id: 'tabs-examples',
93
- title: 'Tabs',
94
- description: 'Pestañas para organizar contenido',
95
- category: 'Layout',
96
- icon: 'tab',
97
- file: 'tabs.example.js'
98
- },
99
- {
100
- id: 'accordion-examples',
101
- title: 'Accordion',
102
- description: 'Paneles expandibles para contenido',
103
- category: 'Layout',
104
- icon: 'expand_more',
105
- file: 'accordion.example.js'
106
- },
107
- {
108
- id: 'table-examples',
109
- title: 'Table',
110
- description: 'Tablas de datos con ordenamiento y filtros',
111
- category: 'Data',
112
- icon: 'table_chart',
113
- file: 'table.example.js'
114
- },
115
- {
116
- id: 'list-examples',
117
- title: 'List',
118
- description: 'Listas de elementos con diferentes estilos',
119
- category: 'Data',
120
- icon: 'list',
121
- file: 'list.example.js'
122
- },
123
- {
124
- id: 'pagination-examples',
125
- title: 'Pagination',
126
- description: 'Controles de paginación para datos',
127
- category: 'Data',
128
- icon: 'last_page',
129
- file: 'pagination.example.js'
130
- },
131
- {
132
- id: 'alert-examples',
133
- title: 'Alert',
134
- description: 'Alertas y notificaciones para el usuario',
135
- category: 'Feedback',
136
- icon: 'notification_important',
137
- file: 'alert.example.js'
138
- },
139
- {
140
- id: 'toast-examples',
141
- title: 'Toast',
142
- description: 'Notificaciones temporales tipo toast',
143
- category: 'Feedback',
144
- icon: 'campaign',
145
- file: 'toast.example.js'
146
- },
147
- {
148
- id: 'progress-examples',
149
- title: 'Progress',
150
- description: 'Barras de progreso y indicadores de carga',
151
- category: 'Feedback',
152
- icon: 'progress_activity',
153
- file: 'progress.example.js'
154
- },
155
- {
156
- id: 'spinner-examples',
157
- title: 'Spinner',
158
- description: 'Indicadores de carga giratorios',
159
- category: 'Feedback',
160
- icon: 'refresh',
161
- file: 'spinner.example.js'
162
- },
163
- {
164
- id: 'tooltip-examples',
165
- title: 'Tooltip',
166
- description: 'Información contextual en hover',
167
- category: 'Feedback',
168
- icon: 'help',
169
- file: 'tooltip.example.js'
170
- },
171
- {
172
- id: 'badge-examples',
173
- title: 'Badge',
174
- description: 'Etiquetas y badges informativos',
175
- category: 'Feedback',
176
- icon: 'label',
177
- file: 'badge.example.js'
178
- }
179
- ];
180
8
 
181
9
  function App() {
182
10
  return (
183
11
  <Site
184
12
  icon="widgets"
185
- title="Ywana Core8"
13
+ title="Ywana Core8 Documentation"
186
14
  init="welcome"
187
15
  >
188
16
  {/* Página de bienvenida */}
@@ -195,18 +23,10 @@ function App() {
195
23
  <WelcomePage />
196
24
  </Page>
197
25
 
198
- {/* Páginas de ejemplos */}
199
- {EXAMPLES_CONFIG.map(example => (
200
- <Page
201
- key={example.id}
202
- id={example.id}
203
- title={example.title}
204
- icon={example.icon}
205
- section={example.category}
206
- >
207
- <ExamplePage example={example} />
208
- </Page>
209
- ))}
26
+ <Page id="button" title="Button" icon="widgets" section="Inputs">
27
+ <ButtonExample />
28
+ </Page>
29
+
210
30
  </Site>
211
31
  );
212
32
  }
@@ -1,4 +1,5 @@
1
1
  import React, { useState, useEffect } from 'react';
2
+ import * as YwanaComponents from 'ywana-core8';
2
3
 
3
4
  const CATEGORIES = {
4
5
  'Inputs': { icon: 'input' },
@@ -13,54 +14,78 @@ const ExamplePage = ({ example }) => {
13
14
  const [error, setError] = useState(null);
14
15
 
15
16
  useEffect(() => {
16
- const loadExample = async () => {
17
+ const createExample = () => {
17
18
  try {
18
19
  setLoading(true);
19
20
  setError(null);
20
21
 
21
- // Intentar cargar el componente de ejemplo dinámicamente
22
- // Esto asume que los archivos de ejemplo están en la carpeta examples/
22
+ // Obtener el nombre del componente
23
23
  const componentName = example.file.replace('.example.js', '');
24
- const modulePath = `../examples/${componentName}.example.js`;
25
-
26
- try {
27
- const module = await import(modulePath);
28
- const Component = module.default || module[Object.keys(module)[0]];
29
-
30
- if (Component) {
31
- setExampleComponent(() => Component);
32
- } else {
33
- throw new Error('No se encontró el componente exportado');
34
- }
35
- } catch (importError) {
36
- console.warn(`No se pudo cargar ${modulePath}:`, importError);
37
-
38
- // Fallback: crear un componente placeholder
39
- const PlaceholderComponent = () => (
40
- <div className="example-placeholder">
41
- <div className="placeholder-icon">
42
- <span className="material-icons">{example.icon}</span>
24
+
25
+ // Crear un ejemplo simple usando el componente de ywana-core8
26
+ const ExampleComponent = () => {
27
+ const Component = YwanaComponents[componentName] || YwanaComponents[componentName.charAt(0).toUpperCase() + componentName.slice(1)];
28
+
29
+ if (!Component) {
30
+ return (
31
+ <div className="example-placeholder">
32
+ <div className="placeholder-icon">
33
+ <span className="material-icons">{example.icon}</span>
34
+ </div>
35
+ <h3>{example.title}</h3>
36
+ <p>Componente: {componentName}</p>
37
+ <div className="placeholder-note">
38
+ <span className="material-icons">info</span>
39
+ <span>Ejemplo básico del componente {componentName}</span>
40
+ </div>
41
+ <div className="component-demo">
42
+ <p>Este componente está disponible en ywana-core8 pero necesita configuración específica.</p>
43
+ </div>
43
44
  </div>
44
- <h3>{example.title}</h3>
45
- <p>{example.description}</p>
46
- <div className="placeholder-note">
47
- <span className="material-icons">info</span>
48
- <span>Ejemplo en desarrollo - Archivo: {example.file}</span>
45
+ );
46
+ }
47
+
48
+ // Crear props básicas según el tipo de componente
49
+ const getBasicProps = () => {
50
+ switch (componentName.toLowerCase()) {
51
+ case 'button':
52
+ return { children: 'Ejemplo Button', onClick: () => alert('Button clicked!') };
53
+ case 'accordion':
54
+ return {
55
+ sections: [
56
+ { title: 'Sección 1', children: 'Contenido de la sección 1' },
57
+ { title: 'Sección 2', children: 'Contenido de la sección 2' }
58
+ ]
59
+ };
60
+ case 'checkbox':
61
+ return { label: 'Ejemplo Checkbox', checked: false };
62
+ case 'textfield':
63
+ return { label: 'Ejemplo TextField', placeholder: 'Escribe aquí...' };
64
+ default:
65
+ return {};
66
+ }
67
+ };
68
+
69
+ return (
70
+ <div className="component-demo">
71
+ <h4>Ejemplo de {componentName}</h4>
72
+ <div className="demo-container">
73
+ <Component {...getBasicProps()} />
49
74
  </div>
50
75
  </div>
51
76
  );
52
-
53
- setExampleComponent(() => PlaceholderComponent);
54
- }
77
+ };
78
+
79
+ setExampleComponent(() => ExampleComponent);
55
80
  } catch (err) {
56
- console.error('Error loading example:', err);
81
+ console.error('Error creating example:', err);
57
82
  setError(err.message);
58
83
  } finally {
59
84
  setLoading(false);
60
85
  }
61
86
  };
62
87
 
63
- loadExample();
88
+ createExample();
64
89
  }, [example]);
65
90
 
66
91
  if (loading) {
package/doc/src/index.js CHANGED
@@ -1,5 +1,7 @@
1
1
  import React from 'react';
2
2
  import ReactDOM from 'react-dom/client';
3
+ import 'ywana-core8/dist/index.css'
4
+ import 'ywana-core8/src/css/theme_light.css'
3
5
  import './index.css';
4
6
  import App from './App';
5
7
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ywana-core8",
3
- "version": "0.1.85",
3
+ "version": "0.1.87",
4
4
  "description": "ywana-core8",
5
5
  "homepage": "https://ywana.github.io/workspace",
6
6
  "author": "Ernesto Roldan Garcia",
package/src/html/index.js CHANGED
@@ -25,4 +25,26 @@ export { Switch, Switch2 } from './switch'
25
25
  export { Tooltip } from './tooltip'
26
26
  export { Thumbnail } from './thumbnail'
27
27
  export { ColorField } from './color'
28
- export { MultiSelector, ToggleButton } from './selector'
28
+ export { MultiSelector, ToggleButton } from './selector'
29
+
30
+ // examples
31
+ export { AccordionExamples } from './accordion.example'
32
+ export { ButtonExamples } from './button.example'
33
+ export { CheckBoxExamples } from './checkbox.example'
34
+ export { ChipExamples } from './chip.example'
35
+ export { ColorExamples } from './color.example'
36
+ export { FormExamples } from './form.example'
37
+ export { HeaderExamples } from './header.example'
38
+ export { IconExamples } from './icon.example'
39
+ export { ListExamples } from './list.example'
40
+ export { ProgressExamples } from './progress.example'
41
+ export { PropertyExamples } from './property.example'
42
+ export { RadioExamples } from './radio.example'
43
+ export { SectionExamples } from './section.example'
44
+ export { SwitchExamples } from './switch.example'
45
+ export { TabExamples } from './tab.example'
46
+ export { TableExamples } from './table.example'
47
+ export { Table2Examples } from './table2.example'
48
+ export { TextfieldExamples } from './textfield.example'
49
+ export { TokenFieldExamples } from './tokenfield.example'
50
+ export { TreeExamples } from './tree.example'
@@ -1,31 +0,0 @@
1
- const path = require('path');
2
-
3
- module.exports = {
4
- webpack: {
5
- configure: (webpackConfig) => {
6
- // Resolver el problema con moment/locale/es
7
- webpackConfig.resolve.alias = {
8
- ...webpackConfig.resolve.alias,
9
- 'moment/locale/es': path.resolve(__dirname, 'node_modules/moment/locale/es.js'),
10
- };
11
-
12
- // Configurar fallbacks para módulos de Node.js
13
- webpackConfig.resolve.fallback = {
14
- ...webpackConfig.resolve.fallback,
15
- "path": require.resolve("path-browserify"),
16
- "os": require.resolve("os-browserify/browser"),
17
- "crypto": require.resolve("crypto-browserify"),
18
- "stream": require.resolve("stream-browserify"),
19
- "buffer": require.resolve("buffer"),
20
- "util": require.resolve("util"),
21
- "assert": require.resolve("assert"),
22
- "url": require.resolve("url"),
23
- "fs": false,
24
- "net": false,
25
- "tls": false,
26
- };
27
-
28
- return webpackConfig;
29
- },
30
- },
31
- };