ywana-core8 0.1.86 → 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.85"
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.85",
17272
- "resolved": "https://registry.npmjs.org/ywana-core8/-/ywana-core8-0.1.85.tgz",
17273
- "integrity": "sha512-XaWRXswsTOGKdqLZ+HDcW1WlbaZ2FDfPWmiPoVdVEQbFVl1Yt9CpYgb2aNdPN0CMQleoiv0lpIn6AZX5ayEsLg==",
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
@@ -17,7 +17,7 @@
17
17
  "react": "^19.1.1",
18
18
  "react-dom": "^19.1.1",
19
19
  "react-scripts": "^5.0.1",
20
- "ywana-core8": "^0.1.85"
20
+ "ywana-core8": "^0.1.86"
21
21
  },
22
22
  "browserslist": {
23
23
  "production": [
package/doc/src/App.js CHANGED
@@ -1,13 +1,10 @@
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
- // Importar configuración de ejemplos (se genera automáticamente)
10
- import { EXAMPLES_CONFIG } from './examples-config.js';
11
8
 
12
9
  function App() {
13
10
  return (
@@ -26,18 +23,10 @@ function App() {
26
23
  <WelcomePage />
27
24
  </Page>
28
25
 
29
- {/* Páginas generadas dinámicamente desde los ejemplos */}
30
- {EXAMPLES_CONFIG.map(example => (
31
- <Page
32
- key={example.id}
33
- id={example.id}
34
- title={example.title}
35
- icon={example.icon}
36
- section={example.category}
37
- >
38
- <ExamplePage example={example} />
39
- </Page>
40
- ))}
26
+ <Page id="button" title="Button" icon="widgets" section="Inputs">
27
+ <ButtonExample />
28
+ </Page>
29
+
41
30
  </Site>
42
31
  );
43
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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ywana-core8",
3
- "version": "0.1.86",
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,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;
@@ -1,170 +0,0 @@
1
- // Este archivo es generado automáticamente por scripts/generate-examples.js
2
- // No editar manualmente
3
-
4
- export const EXAMPLES_CONFIG = [
5
- {
6
- "id": "accordion",
7
- "title": "Accordion",
8
- "icon": "expand_more",
9
- "category": "Layout",
10
- "file": "accordion.example.js"
11
- },
12
- {
13
- "id": "actions-cell",
14
- "title": "Actions Cell",
15
- "icon": "widgets",
16
- "category": "Utils",
17
- "file": "actions-cell.example.js"
18
- },
19
- {
20
- "id": "button",
21
- "title": "Button",
22
- "icon": "smart_button",
23
- "category": "Inputs",
24
- "file": "button.example.js"
25
- },
26
- {
27
- "id": "checkbox",
28
- "title": "Checkbox",
29
- "icon": "check_box",
30
- "category": "Inputs",
31
- "file": "checkbox.example.js"
32
- },
33
- {
34
- "id": "chip",
35
- "title": "Chip",
36
- "icon": "label",
37
- "category": "Display",
38
- "file": "chip.example.js"
39
- },
40
- {
41
- "id": "color",
42
- "title": "Color",
43
- "icon": "palette",
44
- "category": "Display",
45
- "file": "color.example.js"
46
- },
47
- {
48
- "id": "components",
49
- "title": "Components",
50
- "icon": "widgets",
51
- "category": "Components",
52
- "file": "components.example.js"
53
- },
54
- {
55
- "id": "form",
56
- "title": "Form",
57
- "icon": "description",
58
- "category": "Forms",
59
- "file": "form.example.js"
60
- },
61
- {
62
- "id": "header2",
63
- "title": "Header2",
64
- "icon": "widgets",
65
- "category": "Layout",
66
- "file": "header2.example.js"
67
- },
68
- {
69
- "id": "icon",
70
- "title": "Icon",
71
- "icon": "star",
72
- "category": "Display",
73
- "file": "icon.example.js"
74
- },
75
- {
76
- "id": "list",
77
- "title": "List",
78
- "icon": "list",
79
- "category": "Data",
80
- "file": "list.example.js"
81
- },
82
- {
83
- "id": "progress",
84
- "title": "Progress",
85
- "icon": "progress_activity",
86
- "category": "Display",
87
- "file": "progress.example.js"
88
- },
89
- {
90
- "id": "property",
91
- "title": "Property",
92
- "icon": "widgets",
93
- "category": "Utils",
94
- "file": "property.example.js"
95
- },
96
- {
97
- "id": "radio",
98
- "title": "Radio",
99
- "icon": "radio_button_checked",
100
- "category": "Inputs",
101
- "file": "radio.example.js"
102
- },
103
- {
104
- "id": "section",
105
- "title": "Section",
106
- "icon": "view_module",
107
- "category": "Layout",
108
- "file": "section.example.js"
109
- },
110
- {
111
- "id": "switch",
112
- "title": "Switch",
113
- "icon": "toggle_on",
114
- "category": "Inputs",
115
- "file": "switch.example.js"
116
- },
117
- {
118
- "id": "tab",
119
- "title": "Tab",
120
- "icon": "tab",
121
- "category": "Layout",
122
- "file": "tab.example.js"
123
- },
124
- {
125
- "id": "table",
126
- "title": "Table",
127
- "icon": "table_chart",
128
- "category": "Data",
129
- "file": "table.example.js"
130
- },
131
- {
132
- "id": "table2",
133
- "title": "Table2",
134
- "icon": "widgets",
135
- "category": "Data",
136
- "file": "table2.example.js"
137
- },
138
- {
139
- "id": "textfield2",
140
- "title": "Textfield2",
141
- "icon": "widgets",
142
- "category": "Inputs",
143
- "file": "textfield2.example.js"
144
- },
145
- {
146
- "id": "tokenfield",
147
- "title": "Tokenfield",
148
- "icon": "token",
149
- "category": "Inputs",
150
- "file": "tokenfield.example.js"
151
- },
152
- {
153
- "id": "tree",
154
- "title": "Tree",
155
- "icon": "account_tree",
156
- "category": "Data",
157
- "file": "tree.example.js"
158
- }
159
- ];
160
-
161
- // Función para importar dinámicamente los ejemplos
162
- export const importExample = async (fileName) => {
163
- try {
164
- const module = await import(`ywana-core8/src/html/${fileName}`);
165
- return module.default || module;
166
- } catch (error) {
167
- console.error(`Error importing example ${fileName}:`, error);
168
- return null;
169
- }
170
- };