ywana-core8 0.1.79 → 0.1.80

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.
Files changed (63) hide show
  1. package/dist/index.cjs +3244 -2215
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.css +2095 -1125
  4. package/dist/index.css.map +1 -1
  5. package/dist/index.modern.js +3244 -2215
  6. package/dist/index.modern.js.map +1 -1
  7. package/dist/index.umd.js +3244 -2215
  8. package/dist/index.umd.js.map +1 -1
  9. package/package.json +1 -1
  10. package/src/html/ExampleLayout.css +401 -0
  11. package/src/html/ExampleLayout.js +192 -0
  12. package/src/html/README-sidebar-navigation.md +195 -0
  13. package/src/html/accordion.example.js +123 -4
  14. package/src/html/accordion.example.js.backup +390 -0
  15. package/src/html/button.example.js +50 -3
  16. package/src/html/button.example.js.backup +374 -0
  17. package/src/html/button.example.new.js +416 -0
  18. package/src/html/checkbox.example.js +93 -4
  19. package/src/html/checkbox.example.js.backup +316 -0
  20. package/src/html/chip.example.js +108 -4
  21. package/src/html/chip.example.js.backup +355 -0
  22. package/src/html/color.example.js +108 -4
  23. package/src/html/color.example.js.backup +527 -0
  24. package/src/html/components.example.js +123 -4
  25. package/src/html/components.example.js.backup +492 -0
  26. package/src/html/convert-examples.js +183 -0
  27. package/src/html/demo-sidebar.html +410 -0
  28. package/src/html/form.example.js +93 -4
  29. package/src/html/form.example.js.backup +385 -0
  30. package/src/html/header2.example.js +108 -4
  31. package/src/html/header2.example.js.backup +411 -0
  32. package/src/html/icon.example.js +77 -3
  33. package/src/html/icon.example.js.backup +268 -0
  34. package/src/html/list.example.js +93 -4
  35. package/src/html/list.example.js.backup +404 -0
  36. package/src/html/progress.example.js +74 -4
  37. package/src/html/progress.example.js.backup +424 -0
  38. package/src/html/property.example.js +123 -4
  39. package/src/html/property.example.js.backup +553 -0
  40. package/src/html/radio.example.js +108 -4
  41. package/src/html/radio.example.js.backup +389 -0
  42. package/src/html/section.example.js +42 -3
  43. package/src/html/section.example.js.backup +99 -0
  44. package/src/html/switch.example.js +108 -4
  45. package/src/html/switch.example.js.backup +461 -0
  46. package/src/html/tab.example.js +93 -4
  47. package/src/html/tab.example.js.backup +446 -0
  48. package/src/html/table-export-utils.js +483 -0
  49. package/src/html/table-summary-functions.js +363 -0
  50. package/src/html/table2.css +1449 -479
  51. package/src/html/table2.example.js +2937 -512
  52. package/src/html/table2.example.js.broken +1226 -0
  53. package/src/html/table2.js +1426 -1000
  54. package/src/html/test-resize.html +279 -0
  55. package/src/html/test-selection.html +387 -0
  56. package/src/html/textfield2.example.js +108 -4
  57. package/src/html/textfield2.example.js.backup +1370 -0
  58. package/src/html/tokenfield.example.js +108 -4
  59. package/src/html/tokenfield.example.js.backup +503 -0
  60. package/src/html/tree.css +2 -4
  61. package/src/html/tree.example.js +93 -4
  62. package/src/html/tree.example.js.backup +475 -0
  63. package/src/html/tree.js +19 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ywana-core8",
3
- "version": "0.1.79",
3
+ "version": "0.1.80",
4
4
  "description": "ywana-core8",
5
5
  "homepage": "https://ywana.github.io/workspace",
6
6
  "author": "Ernesto Roldan Garcia",
@@ -0,0 +1,401 @@
1
+ /* ExampleLayout - Sidebar navigation for example pages */
2
+
3
+ .example-layout {
4
+ display: flex;
5
+ max-height: 100vh;
6
+ position: relative;
7
+ overflow: hidden;
8
+ }
9
+
10
+ /* Sidebar */
11
+ .example-sidebar {
12
+ position: fixed;
13
+ top: 0;
14
+ left: 0;
15
+ height: 100vh;
16
+ background: var(--surface-color, #f8f9fa);
17
+ border-right: 1px solid var(--divider-color, #e0e0e0);
18
+ z-index: 1000;
19
+ transition: all 0.3s ease;
20
+ overflow-y: auto;
21
+ }
22
+
23
+ .example-sidebar.open {
24
+ width: 280px;
25
+ transform: translateX(0);
26
+ }
27
+
28
+ .example-sidebar.closed {
29
+ width: 60px;
30
+ transform: translateX(0);
31
+ }
32
+
33
+ .example-sidebar__header {
34
+ padding: 1rem;
35
+ border-bottom: 1px solid var(--divider-color, #e0e0e0);
36
+ display: flex;
37
+ align-items: center;
38
+ justify-content: space-between;
39
+ background: var(--primary-color, #2196f3);
40
+ color: white;
41
+ position: sticky;
42
+ top: 0;
43
+ z-index: 10;
44
+ }
45
+
46
+ .example-sidebar__title {
47
+ margin: 0;
48
+ font-size: 1.1rem;
49
+ font-weight: 600;
50
+ white-space: nowrap;
51
+ overflow: hidden;
52
+ text-overflow: ellipsis;
53
+ }
54
+
55
+ .example-sidebar__toggle {
56
+ background: none;
57
+ border: none;
58
+ color: white;
59
+ cursor: pointer;
60
+ padding: 0.25rem;
61
+ border-radius: 4px;
62
+ display: flex;
63
+ align-items: center;
64
+ justify-content: center;
65
+ transition: background-color 0.2s ease;
66
+ }
67
+
68
+ .example-sidebar__toggle:hover {
69
+ background: rgba(255, 255, 255, 0.1);
70
+ }
71
+
72
+ /* Navigation */
73
+ .example-sidebar__nav {
74
+ padding: 1rem 0;
75
+ }
76
+
77
+ .example-sidebar__list {
78
+ list-style: none;
79
+ margin: 0;
80
+ padding: 0;
81
+ }
82
+
83
+ .example-sidebar__item {
84
+ margin-bottom: 0.25rem;
85
+ }
86
+
87
+ .example-sidebar__link {
88
+ display: flex;
89
+ align-items: center;
90
+ gap: 0.75rem;
91
+ padding: 0.75rem 1rem;
92
+ background: none;
93
+ border: none;
94
+ color: var(--text-color, #333);
95
+ text-decoration: none;
96
+ cursor: pointer;
97
+ transition: all 0.2s ease;
98
+ width: 100%;
99
+ text-align: left;
100
+ font-size: 0.875rem;
101
+ border-radius: 0;
102
+ }
103
+
104
+ .example-sidebar__link:hover {
105
+ background: var(--hover-color, rgba(33, 150, 243, 0.08));
106
+ color: var(--primary-color, #2196f3);
107
+ }
108
+
109
+ .example-sidebar__link.active {
110
+ background: var(--primary-color, #2196f3);
111
+ color: white;
112
+ font-weight: 500;
113
+ }
114
+
115
+ .example-sidebar__link span {
116
+ white-space: nowrap;
117
+ overflow: hidden;
118
+ text-overflow: ellipsis;
119
+ }
120
+
121
+ /* Subsections */
122
+ .example-sidebar__subsections {
123
+ list-style: none;
124
+ margin: 0;
125
+ padding: 0;
126
+ margin-left: 1rem;
127
+ border-left: 2px solid var(--divider-color-light, #f0f0f0);
128
+ }
129
+
130
+ .example-sidebar__subsection {
131
+ margin-bottom: 0.125rem;
132
+ }
133
+
134
+ .example-sidebar__sublink {
135
+ display: block;
136
+ padding: 0.5rem 1rem;
137
+ background: none;
138
+ border: none;
139
+ color: var(--text-color-secondary, #666);
140
+ text-decoration: none;
141
+ cursor: pointer;
142
+ transition: all 0.2s ease;
143
+ width: 100%;
144
+ text-align: left;
145
+ font-size: 0.75rem;
146
+ border-radius: 0;
147
+ }
148
+
149
+ .example-sidebar__sublink:hover {
150
+ background: var(--hover-color, rgba(33, 150, 243, 0.05));
151
+ color: var(--primary-color, #2196f3);
152
+ }
153
+
154
+ .example-sidebar__sublink.active {
155
+ background: var(--selection-color, rgba(33, 150, 243, 0.1));
156
+ color: var(--primary-color, #2196f3);
157
+ font-weight: 500;
158
+ }
159
+
160
+ /* Main content */
161
+ .example-content {
162
+ flex: 1;
163
+ transition: margin-left 0.3s ease;
164
+ overflow: auto;
165
+ }
166
+
167
+ .example-content.with-sidebar {
168
+ margin-left: 280px;
169
+ }
170
+
171
+ .example-content.full-width {
172
+ margin-left: 60px;
173
+ }
174
+
175
+ .example-content__inner {
176
+ padding: 2rem;
177
+ max-width: 1200px;
178
+ margin: 0 auto;
179
+ }
180
+
181
+ /* Example sections */
182
+ .example-section {
183
+ margin-bottom: 3rem;
184
+ scroll-margin-top: 2rem;
185
+ }
186
+
187
+ .example-section__header {
188
+ display: flex;
189
+ align-items: center;
190
+ gap: 0.75rem;
191
+ margin-bottom: 1.5rem;
192
+ padding-bottom: 0.75rem;
193
+ border-bottom: 2px solid var(--divider-color, #e0e0e0);
194
+ }
195
+
196
+ .example-section__title {
197
+ margin: 0;
198
+ font-size: 1.75rem;
199
+ font-weight: 600;
200
+ color: var(--text-color, #333);
201
+ }
202
+
203
+ .example-section__content {
204
+ /* Content styles handled by individual components */
205
+ }
206
+
207
+ /* Example subsections */
208
+ .example-subsection {
209
+ margin-bottom: 2rem;
210
+ scroll-margin-top: 2rem;
211
+ }
212
+
213
+ .example-subsection__title {
214
+ margin: 0 0 1rem 0;
215
+ font-size: 1.25rem;
216
+ font-weight: 500;
217
+ color: var(--text-color, #333);
218
+ }
219
+
220
+ .example-subsection__content {
221
+ /* Content styles handled by individual components */
222
+ }
223
+
224
+ /* Code snippets */
225
+ .code-snippet {
226
+ background: var(--surface-color, #f8f9fa);
227
+ border: 1px solid var(--divider-color, #e0e0e0);
228
+ border-radius: 8px;
229
+ margin: 1rem 0;
230
+ overflow: hidden;
231
+ }
232
+
233
+ .code-snippet__header {
234
+ display: flex;
235
+ align-items: center;
236
+ justify-content: space-between;
237
+ padding: 0.75rem 1rem;
238
+ background: var(--surface-color-dark, #e9ecef);
239
+ border-bottom: 1px solid var(--divider-color, #e0e0e0);
240
+ }
241
+
242
+ .code-snippet__title {
243
+ margin: 0;
244
+ font-size: 0.875rem;
245
+ font-weight: 500;
246
+ color: var(--text-color, #333);
247
+ }
248
+
249
+ .code-snippet__copy {
250
+ display: flex;
251
+ align-items: center;
252
+ gap: 0.5rem;
253
+ padding: 0.25rem 0.5rem;
254
+ background: none;
255
+ border: 1px solid var(--divider-color, #e0e0e0);
256
+ border-radius: 4px;
257
+ color: var(--text-color-secondary, #666);
258
+ cursor: pointer;
259
+ font-size: 0.75rem;
260
+ transition: all 0.2s ease;
261
+ }
262
+
263
+ .code-snippet__copy:hover {
264
+ background: var(--hover-color, rgba(33, 150, 243, 0.05));
265
+ border-color: var(--primary-color, #2196f3);
266
+ color: var(--primary-color, #2196f3);
267
+ }
268
+
269
+ .code-snippet__content {
270
+ padding: 1rem;
271
+ margin: 0;
272
+ background: white;
273
+ overflow-x: auto;
274
+ font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
275
+ font-size: 0.75rem;
276
+ line-height: 1.5;
277
+ }
278
+
279
+ .code-snippet__content code {
280
+ color: var(--text-color, #333);
281
+ }
282
+
283
+ /* Mobile overlay */
284
+ .example-overlay {
285
+ position: fixed;
286
+ top: 0;
287
+ left: 0;
288
+ right: 0;
289
+ bottom: 0;
290
+ background: rgba(0, 0, 0, 0.5);
291
+ z-index: 999;
292
+ display: none;
293
+ }
294
+
295
+ /* Responsive design */
296
+ @media (max-width: 768px) {
297
+ .example-sidebar.open {
298
+ width: 100%;
299
+ max-width: 320px;
300
+ }
301
+
302
+ .example-sidebar.closed {
303
+ transform: translateX(-100%);
304
+ width: 280px;
305
+ }
306
+
307
+ .example-content.with-sidebar,
308
+ .example-content.full-width {
309
+ margin-left: 0;
310
+ }
311
+
312
+ .example-content__inner {
313
+ padding: 1rem;
314
+ }
315
+
316
+ .example-overlay {
317
+ display: block;
318
+ }
319
+
320
+ .example-section__title {
321
+ font-size: 1.5rem;
322
+ }
323
+
324
+ .example-subsection__title {
325
+ font-size: 1.125rem;
326
+ }
327
+ }
328
+
329
+ /* Dark theme support */
330
+ @media (prefers-color-scheme: dark) {
331
+ .example-sidebar {
332
+ background: #2c1810;
333
+ border-color: #5d4037;
334
+ }
335
+
336
+ .example-sidebar__header {
337
+ background: #3e2723;
338
+ border-color: #5d4037;
339
+ }
340
+
341
+ .example-sidebar__link {
342
+ color: #f4e6d7;
343
+ }
344
+
345
+ .example-sidebar__link:hover {
346
+ background: rgba(141, 110, 99, 0.2);
347
+ color: #8d6e63;
348
+ }
349
+
350
+ .example-sidebar__link.active {
351
+ background: #8d6e63;
352
+ color: #f4e6d7;
353
+ }
354
+
355
+ .example-sidebar__sublink {
356
+ color: #d7ccc8;
357
+ }
358
+
359
+ .example-sidebar__sublink:hover {
360
+ background: rgba(141, 110, 99, 0.1);
361
+ color: #8d6e63;
362
+ }
363
+
364
+ .example-sidebar__sublink.active {
365
+ background: rgba(141, 110, 99, 0.2);
366
+ color: #8d6e63;
367
+ }
368
+
369
+ .code-snippet {
370
+ background: #3e2723;
371
+ border-color: #5d4037;
372
+ }
373
+
374
+ .code-snippet__header {
375
+ background: #4e342e;
376
+ border-color: #5d4037;
377
+ }
378
+
379
+ .code-snippet__title {
380
+ color: #f4e6d7;
381
+ }
382
+
383
+ .code-snippet__copy {
384
+ border-color: #5d4037;
385
+ color: #d7ccc8;
386
+ }
387
+
388
+ .code-snippet__copy:hover {
389
+ background: rgba(141, 110, 99, 0.2);
390
+ border-color: #8d6e63;
391
+ color: #8d6e63;
392
+ }
393
+
394
+ .code-snippet__content {
395
+ background: #2c1810;
396
+ }
397
+
398
+ .code-snippet__content code {
399
+ color: #f4e6d7;
400
+ }
401
+ }
@@ -0,0 +1,192 @@
1
+ import React, { useState, useEffect } from 'react'
2
+ import { Icon } from './icon'
3
+ import './ExampleLayout.css'
4
+
5
+ /**
6
+ * ExampleLayout - Layout component with sidebar navigation for example pages
7
+ */
8
+ export const ExampleLayout = ({ title, children, sections = [] }) => {
9
+ const [sidebarOpen, setSidebarOpen] = useState(true)
10
+ const [activeSection, setActiveSection] = useState('')
11
+
12
+ // Handle scroll to update active section
13
+ useEffect(() => {
14
+ const handleScroll = () => {
15
+ const scrollPosition = window.scrollY + 100 // Offset for better UX
16
+
17
+ for (let i = sections.length - 1; i >= 0; i--) {
18
+ const section = sections[i]
19
+ const element = document.getElementById(section.id)
20
+ if (element && element.offsetTop <= scrollPosition) {
21
+ setActiveSection(section.id)
22
+ break
23
+ }
24
+ }
25
+ }
26
+
27
+ window.addEventListener('scroll', handleScroll)
28
+ handleScroll() // Initial check
29
+
30
+ return () => window.removeEventListener('scroll', handleScroll)
31
+ }, [sections])
32
+
33
+ // Smooth scroll to section
34
+ const scrollToSection = (sectionId) => {
35
+ const element = document.getElementById(sectionId)
36
+ if (element) {
37
+ element.scrollIntoView({
38
+ behavior: 'smooth',
39
+ block: 'start'
40
+ })
41
+ }
42
+ }
43
+
44
+ return (
45
+ <div className="example-layout">
46
+ {/* Sidebar */}
47
+ <div className={`example-sidebar ${sidebarOpen ? 'open' : 'closed'}`}>
48
+ <div className="example-sidebar__header">
49
+ <h3 className="example-sidebar__title">{title}</h3>
50
+ <button
51
+ className="example-sidebar__toggle"
52
+ onClick={() => setSidebarOpen(!sidebarOpen)}
53
+ aria-label={sidebarOpen ? 'Cerrar menú' : 'Abrir menú'}
54
+ >
55
+ <Icon icon={sidebarOpen ? 'menu_open' : 'menu'} size="small" />
56
+ </button>
57
+ </div>
58
+
59
+ {sidebarOpen && (
60
+ <nav className="example-sidebar__nav">
61
+ <ul className="example-sidebar__list">
62
+ {sections.map((section) => (
63
+ <li key={section.id} className="example-sidebar__item">
64
+ <button
65
+ className={`example-sidebar__link ${
66
+ activeSection === section.id ? 'active' : ''
67
+ }`}
68
+ onClick={() => scrollToSection(section.id)}
69
+ >
70
+ {section.icon && (
71
+ <Icon icon={section.icon} size="small" />
72
+ )}
73
+ <span>{section.title}</span>
74
+ </button>
75
+
76
+ {section.subsections && section.subsections.length > 0 && (
77
+ <ul className="example-sidebar__subsections">
78
+ {section.subsections.map((subsection) => (
79
+ <li key={subsection.id} className="example-sidebar__subsection">
80
+ <button
81
+ className={`example-sidebar__sublink ${
82
+ activeSection === subsection.id ? 'active' : ''
83
+ }`}
84
+ onClick={() => scrollToSection(subsection.id)}
85
+ >
86
+ {subsection.title}
87
+ </button>
88
+ </li>
89
+ ))}
90
+ </ul>
91
+ )}
92
+ </li>
93
+ ))}
94
+ </ul>
95
+ </nav>
96
+ )}
97
+ </div>
98
+
99
+ {/* Main content */}
100
+ <div className={`example-content ${sidebarOpen ? 'with-sidebar' : 'full-width'}`}>
101
+ <div className="example-content__inner">
102
+ {children}
103
+ </div>
104
+ </div>
105
+
106
+ {/* Mobile overlay */}
107
+ {sidebarOpen && (
108
+ <div
109
+ className="example-overlay"
110
+ onClick={() => setSidebarOpen(false)}
111
+ />
112
+ )}
113
+ </div>
114
+ )
115
+ }
116
+
117
+ /**
118
+ * ExampleSection - Wrapper component for sections with automatic ID
119
+ */
120
+ export const ExampleSection = ({ id, title, icon, children, className = '' }) => {
121
+ return (
122
+ <section id={id} className={`example-section ${className}`}>
123
+ {title && (
124
+ <div className="example-section__header">
125
+ {icon && <Icon icon={icon} size="medium" />}
126
+ <h2 className="example-section__title">{title}</h2>
127
+ </div>
128
+ )}
129
+ <div className="example-section__content">
130
+ {children}
131
+ </div>
132
+ </section>
133
+ )
134
+ }
135
+
136
+ /**
137
+ * ExampleSubsection - Wrapper component for subsections
138
+ */
139
+ export const ExampleSubsection = ({ id, title, children, className = '' }) => {
140
+ return (
141
+ <div id={id} className={`example-subsection ${className}`}>
142
+ {title && (
143
+ <h3 className="example-subsection__title">{title}</h3>
144
+ )}
145
+ <div className="example-subsection__content">
146
+ {children}
147
+ </div>
148
+ </div>
149
+ )
150
+ }
151
+
152
+ /**
153
+ * CodeSnippet - Component for displaying code examples
154
+ */
155
+ export const CodeSnippet = ({ title, code, language = 'jsx' }) => {
156
+ const [copied, setCopied] = useState(false)
157
+
158
+ const copyToClipboard = async () => {
159
+ try {
160
+ await navigator.clipboard.writeText(code)
161
+ setCopied(true)
162
+ setTimeout(() => setCopied(false), 2000)
163
+ } catch (err) {
164
+ console.error('Failed to copy code:', err)
165
+ }
166
+ }
167
+
168
+ return (
169
+ <div className="code-snippet">
170
+ <div className="code-snippet__header">
171
+ <h5 className="code-snippet__title">
172
+ 📋 {title}
173
+ </h5>
174
+ <button
175
+ className="code-snippet__copy"
176
+ onClick={copyToClipboard}
177
+ title="Copiar código"
178
+ >
179
+ <Icon icon={copied ? 'check' : 'content_copy'} size="small" />
180
+ {copied ? 'Copiado!' : 'Copiar'}
181
+ </button>
182
+ </div>
183
+ <pre className="code-snippet__content">
184
+ <code className={`language-${language}`}>
185
+ {code}
186
+ </code>
187
+ </pre>
188
+ </div>
189
+ )
190
+ }
191
+
192
+ export default ExampleLayout