@councilbox/councilbox-ui 2.0.59 → 2.0.61

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 (107) hide show
  1. package/SafeHtml.js +3 -0
  2. package/dist/HOCs/overlayA11yStack.js +1 -1
  3. package/dist/HOCs/useDynamicStyles.js +39 -4
  4. package/dist/build-index.js +14 -0
  5. package/dist/components/Accordion/Accordion.css +7 -1
  6. package/dist/components/Accordion/Accordion.js +2 -2
  7. package/dist/components/Button/Button.js +79 -87
  8. package/dist/components/Button/button.css +171 -16
  9. package/dist/components/DatePicker/Calendar.js +3 -5
  10. package/dist/components/DatePicker/DatePicker.css +1 -1
  11. package/dist/components/DateRangePicker/RangeCalendar.js +2 -4
  12. package/dist/components/IconButton/IconButton.js +1 -1
  13. package/dist/components/Modal/Modal.js +13 -3
  14. package/dist/components/RichTextInput/RichTextInput.js +28 -7
  15. package/dist/components/SafeHtml/SafeHtml.js +82 -0
  16. package/dist/components/SelectInput/SelectInput.js +1 -0
  17. package/dist/components/Stepper/Stepper.css +6 -1
  18. package/dist/components/Tabs/Tabs.js +1 -0
  19. package/dist/components/TextInput/TextInput.css +164 -1
  20. package/dist/components/TextInput/TextInput.js +171 -167
  21. package/dist/components/ThemeProvider/Colors.js +1 -1
  22. package/dist/components/ThemeProvider/ThemeProvider.js +1 -7
  23. package/dist/components/Toast/toastStore.js +1 -0
  24. package/dist/styles/colorConsts.css +1 -1
  25. package/dist/styles/stylesheet.js +2 -50
  26. package/dist/testing/TestAutocomplete.js +1 -105
  27. package/dist/utils/sanitizeHtml.js +199 -0
  28. package/package.json +17 -31
  29. package/dist/__snapshots__/storybook.test.js.snap +0 -104
  30. package/dist/components/1.Introduction.stories.mdx +0 -579
  31. package/dist/components/2.Changelog.stories.mdx +0 -1392
  32. package/dist/components/3.Guide.stories.mdx +0 -589
  33. package/dist/components/Accordion/Accordion.stories.js +0 -95
  34. package/dist/components/Accordion/DesignAccordion.stories.js +0 -27
  35. package/dist/components/Alert/Alert.stories.js +0 -101
  36. package/dist/components/Avatar/Avatar.stories.js +0 -159
  37. package/dist/components/Avatar/DesignAvatar.stories.js +0 -64
  38. package/dist/components/Avatar/DesignAvatarText.stories.js +0 -123
  39. package/dist/components/AvatarGroup/AvatarGroup.stories.js +0 -72
  40. package/dist/components/AvatarGroup/DesignAvatarGroup.stories.js +0 -118
  41. package/dist/components/Block/Block.stories.js +0 -66
  42. package/dist/components/Block/DesignBlock.stories.js +0 -35
  43. package/dist/components/Button/Button.stories.js +0 -98
  44. package/dist/components/ButtonBasic/ButtonBasic.stories.js +0 -161
  45. package/dist/components/Checkbox/Checkbox.stories.js +0 -110
  46. package/dist/components/DatePicker/DatePicker.stories.js +0 -180
  47. package/dist/components/DateRangePicker/DateRangePicker.stories.js +0 -147
  48. package/dist/components/DateTimePicker/DateTimePicker.stories.js +0 -144
  49. package/dist/components/DragDrop/DragDrop.stories.js +0 -155
  50. package/dist/components/DrawerPanel/DrawerPanel.stories.js +0 -277
  51. package/dist/components/DropDown/DesignDropDown.stories.js +0 -216
  52. package/dist/components/DropDown/DropDown.stories.js +0 -240
  53. package/dist/components/EnhancedTable/DesignEnhancedTable.stories.js +0 -128
  54. package/dist/components/EnhancedTable/EnhancedTable.stories.js +0 -259
  55. package/dist/components/FabButton/DesignFabButton.stories.js +0 -40
  56. package/dist/components/FabButton/FabButton.stories.js +0 -147
  57. package/dist/components/Grid/DesignGrid.stories.js +0 -45
  58. package/dist/components/Grid/Grid.stories.js +0 -211
  59. package/dist/components/Header/DesignHeader.stories.js +0 -65
  60. package/dist/components/Header/Header.stories.js +0 -674
  61. package/dist/components/IconButton/DesignIconButton.stories.js +0 -113
  62. package/dist/components/IconButton/IconButton.stories.js +0 -205
  63. package/dist/components/IconButtonSquare/DesignIconButtonSquare.stories.js +0 -21
  64. package/dist/components/IconButtonSquare/IconButtonSquare.stories.js +0 -209
  65. package/dist/components/InputAutocomplete/InputAutocomplete.stories.js +0 -433
  66. package/dist/components/InputPassword/InputPassword.stories.js +0 -185
  67. package/dist/components/InputText/InputText.stories.js +0 -261
  68. package/dist/components/InputTextArea/DesignInputTextArea.stories.js +0 -116
  69. package/dist/components/InputTextArea/InputTextArea.stories.js +0 -146
  70. package/dist/components/LoadingSection/LoadingSection.stories.js +0 -84
  71. package/dist/components/MenuItem/DesignMenuItem.stories.js +0 -54
  72. package/dist/components/MenuItem/MenuItem.stories.js +0 -138
  73. package/dist/components/MenuLateralLeft/MenuLateralLeft.stories.js +0 -243
  74. package/dist/components/MenuLateralRight/MenuLateralRight.stories.js +0 -228
  75. package/dist/components/Modal/DesignModal.stories.js +0 -39
  76. package/dist/components/Modal/Modal.stories.js +0 -229
  77. package/dist/components/PaginationFooter/DesignPaginationFooter.stories.js +0 -22
  78. package/dist/components/PaginationFooter/PaginationFooter.stories.js +0 -191
  79. package/dist/components/RadioButton/Radio.stories.js +0 -157
  80. package/dist/components/RichTextInput/DesignRichTextInput.stories.js +0 -119
  81. package/dist/components/RichTextInput/RichTextInput.stories.js +0 -38
  82. package/dist/components/Ripple/Ripple.stories.js +0 -107
  83. package/dist/components/Scrollbar/Scrollbar.stories.js +0 -42
  84. package/dist/components/ScrollbarOld/ScrollbarOld.stories.js +0 -140
  85. package/dist/components/SelectInput/SelectInput.stories.js +0 -212
  86. package/dist/components/Slider/Slider.stories.js +0 -128
  87. package/dist/components/Spacing/Spacing.stories.js +0 -37
  88. package/dist/components/Stars/Stars.stories.js +0 -138
  89. package/dist/components/Stepper/DesignStepper.stories.js +0 -130
  90. package/dist/components/Stepper/Stepper.stories.js +0 -131
  91. package/dist/components/Table/DesignTable.stories.js +0 -614
  92. package/dist/components/Table/Table.stories.js +0 -215
  93. package/dist/components/Tabs/Tabs.stories.js +0 -163
  94. package/dist/components/Tag/DesignTags.stories.js +0 -81
  95. package/dist/components/Tag/Tag.stories.js +0 -148
  96. package/dist/components/TextInput/TextInput.stories.js +0 -148
  97. package/dist/components/TimePicker/TimePicker.stories.js +0 -132
  98. package/dist/components/Timeline/DesignTimeline.stories.js +0 -19
  99. package/dist/components/Timeline/Timeline.stories.js +0 -128
  100. package/dist/components/Toast/DesignToast.stories.js +0 -174
  101. package/dist/components/Toast/Toast.stories.js +0 -39
  102. package/dist/components/Toggle/Toggle.stories.js +0 -118
  103. package/dist/components/Tooltip/DesignTooltip.stories.js +0 -45
  104. package/dist/components/Tooltip/Tooltip.stories.js +0 -135
  105. package/dist/components/Typography/Typography.stories.js +0 -114
  106. package/dist/reportWebVitals.js +0 -28
  107. package/dist/storybook.test.js +0 -5
@@ -1,589 +0,0 @@
1
- import { Meta, Source } from '@storybook/addon-docs';
2
- import LinkTo from '@storybook/addon-links/react';
3
- import Typography from './Typography/Typography';
4
-
5
- <Meta title="Inicio/Guía de uso" parameters={{ previewTabs: { canvas: { hidden: true } }, viewMode: 'docs' }} />
6
-
7
- <style>{`
8
- #docs-root {
9
- overflow-x: auto;
10
- height: 100%;
11
- }
12
- .sbdocs-wrapper {
13
- padding: 0 !important;
14
- }
15
- .sbdocs-content {
16
- max-width: 1120px !important;
17
- }
18
- .cbx-doc {
19
- font-family: var(--font-primary), 'Lato', sans-serif;
20
- color: var(--gray5);
21
- padding: 0 2rem 4rem;
22
- }
23
- .cbx-doc h2, .cbx-doc h3 {
24
- font-family: var(--font-secondary), 'Montserrat', sans-serif;
25
- border: 0 !important;
26
- margin: 0;
27
- padding: 0;
28
- }
29
- .cbx-doc-hero {
30
- position: relative;
31
- overflow: hidden;
32
- margin: 0 -2rem 2.5rem;
33
- padding: 3rem 2rem 2.5rem;
34
- background: linear-gradient(135deg, var(--primary) 0%, #26276a 60%, #1b1c4f 100%);
35
- color: var(--white);
36
- }
37
- .cbx-doc-hero::after {
38
- content: '';
39
- position: absolute;
40
- right: -6rem;
41
- top: -6rem;
42
- width: 20rem;
43
- height: 20rem;
44
- border-radius: 50%;
45
- background: radial-gradient(circle, rgba(107, 234, 242, 0.35) 0%, rgba(107, 234, 242, 0) 70%);
46
- pointer-events: none;
47
- }
48
- .cbx-doc-back {
49
- display: inline-flex;
50
- align-items: center;
51
- gap: 0.375rem;
52
- margin-bottom: 1.5rem;
53
- font-size: 0.875rem;
54
- font-weight: 700;
55
- color: var(--accent) !important;
56
- text-decoration: none !important;
57
- }
58
- .cbx-doc-back:focus-visible {
59
- outline: 3px solid var(--accent);
60
- outline-offset: 2px;
61
- }
62
- .cbx-doc-hero h1 {
63
- font-family: var(--font-secondary), 'Montserrat', sans-serif;
64
- font-size: 2.25rem;
65
- line-height: 1.2;
66
- font-weight: 700;
67
- margin: 0 0 0.5rem;
68
- color: var(--white);
69
- border: 0;
70
- }
71
- .cbx-doc-hero p {
72
- font-size: 1.0625rem;
73
- line-height: 1.6;
74
- max-width: 40rem;
75
- margin: 0;
76
- color: rgba(255, 255, 255, 0.85);
77
- }
78
- .cbx-doc-layout {
79
- display: grid;
80
- grid-template-columns: 13rem minmax(0, 1fr);
81
- gap: 2.5rem;
82
- align-items: start;
83
- }
84
- @media (max-width: 900px) {
85
- .cbx-doc-layout {
86
- grid-template-columns: 1fr;
87
- }
88
- .cbx-doc-toc {
89
- position: static !important;
90
- }
91
- }
92
- .cbx-doc-toc {
93
- position: sticky;
94
- top: 1rem;
95
- padding: 1rem;
96
- border-radius: 8px;
97
- background: var(--primary10);
98
- }
99
- .cbx-doc-toc p {
100
- margin: 0 0 0.5rem !important;
101
- font-size: 0.75rem;
102
- font-weight: 700;
103
- text-transform: uppercase;
104
- letter-spacing: 0.06em;
105
- color: var(--gray4);
106
- }
107
- .cbx-doc-toc ul {
108
- list-style: none;
109
- margin: 0 !important;
110
- padding: 0 !important;
111
- }
112
- .cbx-doc-toc li {
113
- margin: 0 !important;
114
- }
115
- .cbx-doc-toc button {
116
- display: flex;
117
- align-items: center;
118
- gap: 0.5rem;
119
- width: 100%;
120
- padding: 0.375rem 0.5rem;
121
- border: 0;
122
- border-radius: 4px;
123
- background: transparent;
124
- font-family: inherit;
125
- font-size: 0.875rem;
126
- color: var(--primary);
127
- text-align: left;
128
- cursor: pointer;
129
- }
130
- .cbx-doc-toc button:hover {
131
- background: var(--primary25);
132
- }
133
- .cbx-doc-toc button:focus-visible {
134
- outline: 2px solid var(--primary);
135
- }
136
- .cbx-doc-section {
137
- margin-bottom: 3rem;
138
- scroll-margin-top: 1rem;
139
- }
140
- .cbx-doc-section-header {
141
- margin-bottom: 1.25rem;
142
- padding-bottom: 0.75rem;
143
- border-bottom: 2px solid var(--primary10);
144
- }
145
- .cbx-doc-section-header h2 {
146
- display: flex;
147
- align-items: center;
148
- gap: 0.5rem;
149
- font-size: 1.5rem !important;
150
- color: var(--primary);
151
- }
152
- .cbx-doc-section-header p {
153
- margin: 0.375rem 0 0;
154
- color: var(--gray4);
155
- font-size: 0.9375rem;
156
- line-height: 1.6;
157
- }
158
- .cbx-doc-text {
159
- margin: 0 0 1rem !important;
160
- font-size: 0.9375rem;
161
- line-height: 1.6;
162
- color: var(--gray5);
163
- }
164
- .cbx-doc-text code, .cbx-doc-note code, .cbx-doc-table code {
165
- padding: 0.0625rem 0.375rem;
166
- border-radius: 4px;
167
- background: var(--primary10);
168
- color: var(--primary);
169
- font-size: 0.85em;
170
- }
171
- .cbx-doc-subtitle {
172
- font-size: 0.8125rem !important;
173
- text-transform: uppercase;
174
- letter-spacing: 0.06em;
175
- color: var(--gray4);
176
- margin: 1.5rem 0 0.75rem !important;
177
- }
178
- .cbx-doc-swatches {
179
- display: grid;
180
- grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
181
- gap: 0.75rem;
182
- }
183
- .cbx-doc-swatch {
184
- display: flex;
185
- flex-direction: column;
186
- padding: 0;
187
- border-radius: 8px;
188
- border: 1px solid var(--gray1);
189
- background: var(--white);
190
- overflow: hidden;
191
- font-family: inherit;
192
- text-align: left;
193
- cursor: pointer;
194
- transition: box-shadow 0.15s, transform 0.15s;
195
- }
196
- .cbx-doc-swatch:hover {
197
- box-shadow: 0 4px 14px rgba(56, 57, 140, 0.12);
198
- transform: translateY(-1px);
199
- }
200
- .cbx-doc-swatch:focus-visible {
201
- outline: 3px solid var(--primary);
202
- outline-offset: 2px;
203
- }
204
- .cbx-doc-swatch-color {
205
- height: 4rem;
206
- border-bottom: 1px solid var(--gray1);
207
- }
208
- .cbx-doc-swatch-info {
209
- padding: 0.625rem 0.75rem;
210
- }
211
- .cbx-doc-swatch-info strong {
212
- display: block;
213
- font-size: 0.8125rem;
214
- color: var(--gray5);
215
- }
216
- .cbx-doc-swatch-info span {
217
- font-size: 0.75rem;
218
- color: var(--gray4);
219
- font-family: monospace;
220
- text-transform: uppercase;
221
- }
222
- .cbx-doc-copied {
223
- min-height: 1.25rem;
224
- margin: 0.5rem 0 0 !important;
225
- font-size: 0.8125rem;
226
- color: var(--success);
227
- }
228
- .cbx-doc-fonts {
229
- display: grid;
230
- grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
231
- gap: 1rem;
232
- margin-bottom: 1.5rem;
233
- }
234
- .cbx-doc-font {
235
- padding: 1.25rem;
236
- border-radius: 8px;
237
- border: 1px solid var(--gray1);
238
- }
239
- .cbx-doc-font-sample {
240
- font-size: 2.5rem;
241
- line-height: 1.2;
242
- color: var(--primary);
243
- margin-bottom: 0.5rem;
244
- }
245
- .cbx-doc-font strong {
246
- display: block;
247
- font-size: 0.9375rem;
248
- }
249
- .cbx-doc-font span {
250
- font-size: 0.8125rem;
251
- color: var(--gray4);
252
- font-family: monospace;
253
- }
254
- .cbx-doc-table {
255
- width: 100%;
256
- border-collapse: collapse;
257
- font-size: 0.875rem;
258
- }
259
- .cbx-doc-table th {
260
- text-align: left;
261
- padding: 0.625rem 0.75rem;
262
- background: var(--primary10);
263
- color: var(--primary);
264
- font-size: 0.75rem;
265
- text-transform: uppercase;
266
- letter-spacing: 0.04em;
267
- border: 0;
268
- }
269
- .cbx-doc-table td {
270
- padding: 0.625rem 0.75rem;
271
- border: 0;
272
- border-bottom: 1px solid var(--gray1);
273
- vertical-align: middle;
274
- }
275
- .cbx-doc-table tr {
276
- background: transparent !important;
277
- border: 0;
278
- }
279
- .cbx-doc-table td.cbx-doc-mono {
280
- font-family: monospace;
281
- color: var(--gray4);
282
- white-space: nowrap;
283
- }
284
- .cbx-doc-spacing-bar {
285
- height: 0.75rem;
286
- border-radius: 2px;
287
- background: var(--accent);
288
- }
289
- .cbx-doc-note {
290
- display: flex;
291
- gap: 0.75rem;
292
- padding: 1rem;
293
- margin: 1rem 0 0;
294
- border-radius: 8px;
295
- background: var(--accent10);
296
- border: 1px solid var(--accent50);
297
- font-size: 0.875rem;
298
- line-height: 1.6;
299
- }
300
- .cbx-doc-note i {
301
- color: var(--primary);
302
- font-size: 1.125rem;
303
- }
304
- .cbx-doc-cards {
305
- display: grid;
306
- grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
307
- gap: 1rem;
308
- margin-bottom: 1rem;
309
- }
310
- .cbx-doc-card {
311
- padding: 1.25rem;
312
- border-radius: 8px;
313
- border: 1px solid var(--gray1);
314
- }
315
- .cbx-doc-card h3 {
316
- display: flex;
317
- align-items: center;
318
- gap: 0.5rem;
319
- font-size: 0.9375rem !important;
320
- color: var(--gray5);
321
- margin-bottom: 0.375rem !important;
322
- }
323
- .cbx-doc-card h3 i {
324
- color: var(--primary);
325
- }
326
- .cbx-doc-card p {
327
- margin: 0 !important;
328
- font-size: 0.875rem;
329
- line-height: 1.5;
330
- color: var(--gray4);
331
- }
332
- `}</style>
333
-
334
- export const SECTIONS = [
335
- { id: 'guide-install', label: 'Instalación', icon: 'ri-download-2-line' },
336
- { id: 'guide-colors', label: 'Colores', icon: 'ri-palette-line' },
337
- { id: 'guide-typography', label: 'Tipografía', icon: 'ri-font-size' },
338
- { id: 'guide-spacing', label: 'Espaciados', icon: 'ri-space' },
339
- { id: 'guide-breakpoints', label: 'Breakpoints', icon: 'ri-computer-line' },
340
- { id: 'guide-sx', label: 'Estilos con sx', icon: 'ri-brush-line' },
341
- { id: 'guide-a11y', label: 'Accesibilidad', icon: 'ri-eye-line' },
342
- ];
343
-
344
- export const COLOR_GROUPS = [
345
- { name: 'Primario', tokens: ['primary', 'primary75', 'primary50', 'primary25', 'primary10', 'secondary'] },
346
- { name: 'Acento', tokens: ['accent', 'accent75', 'accent50', 'accent25', 'accent10'] },
347
- { name: 'Estados', tokens: ['success', 'error', 'warning', 'info'] },
348
- { name: 'Grises', tokens: ['black', 'gray5', 'gray4', 'gray3', 'gray2', 'gray1', 'white'] },
349
- ];
350
-
351
- export const TYPOGRAPHY_VARIANTS = [
352
- { variant: '5XL', tag: 'h1' },
353
- { variant: '4XL', tag: 'h2' },
354
- { variant: '3XL', tag: 'h3' },
355
- { variant: '2XL', tag: 'h4' },
356
- { variant: 'XL', tag: 'h5' },
357
- { variant: 'L', tag: 'h6' },
358
- { variant: 'M', tag: 'p' },
359
- { variant: 'S', tag: 'p' },
360
- { variant: 'XS', tag: 'p' },
361
- { variant: '2XS', tag: 'p' },
362
- ];
363
-
364
- export const SPACING_TOKENS = [4, 8, 12, 16, 20, 24, 32, 36, 40, 48, 52, 56, 64, 72, 76, 80, 96, 112, 120, 128, 144, 160, 176, 192];
365
-
366
- export const BREAKPOINTS = [
367
- { name: 'xs', from: '0px', use: 'Móviles' },
368
- { name: 'sm', from: '600px', use: 'Móviles grandes y tablets en vertical' },
369
- { name: 'md', from: '960px', use: 'Tablets en horizontal y portátiles pequeños' },
370
- { name: 'lg', from: '1280px', use: 'Escritorio' },
371
- { name: 'xl', from: '1920px (1536px en Grid)', use: 'Pantallas grandes' },
372
- ];
373
-
374
- export const readToken = name => (typeof window === 'undefined' ? '' : getComputedStyle(document.documentElement).getPropertyValue(`--${name}`).trim());
375
-
376
- export const scrollToSection = id => document.getElementById(id)?.scrollIntoView({ behavior: 'smooth' });
377
-
378
- export const ColorPalette = () => {
379
- const [copied, setCopied] = React.useState('');
380
- const [, forceUpdate] = React.useState(0);
381
- React.useEffect(() => { forceUpdate(1); }, []);
382
- const copy = token => {
383
- const text = `var(--${token})`;
384
- if (navigator.clipboard) navigator.clipboard.writeText(text).catch(() => {});
385
- setCopied(`${text} copiado al portapapeles`);
386
- };
387
- return (
388
- <>
389
- {COLOR_GROUPS.map(group => (
390
- <div key={group.name}>
391
- <h3 className="cbx-doc-subtitle">{group.name}</h3>
392
- <div className="cbx-doc-swatches">
393
- {group.tokens.map(token => (
394
- <button key={token} type="button" className="cbx-doc-swatch" onClick={() => copy(token)} aria-label={`Copiar var(--${token}), ${readToken(token)}`}>
395
- <span className="cbx-doc-swatch-color" style={{ background: `var(--${token})` }} />
396
- <span className="cbx-doc-swatch-info"><strong>{`--${token}`}</strong><span>{readToken(token)}</span></span>
397
- </button>
398
- ))}
399
- </div>
400
- </div>
401
- ))}
402
- <p className="cbx-doc-copied" aria-live="polite">{copied}</p>
403
- </>
404
- );
405
- };
406
-
407
- export const TypographyScale = () => {
408
- const [metrics, setMetrics] = React.useState({});
409
- const refs = React.useRef({});
410
- React.useEffect(() => {
411
- const next = {};
412
- TYPOGRAPHY_VARIANTS.forEach(({ variant }) => {
413
- const element = refs.current[variant];
414
- if (element) {
415
- const style = getComputedStyle(element);
416
- next[variant] = `${parseFloat(style.fontSize) / 16}rem / ${parseFloat(style.lineHeight) / 16}rem`;
417
- }
418
- });
419
- setMetrics(next);
420
- }, []);
421
- return (
422
- <table className="cbx-doc-table">
423
- <thead>
424
- <tr><th scope="col">Variante</th><th scope="col">Etiqueta</th><th scope="col">Tamaño / interlineado</th><th scope="col">Ejemplo</th></tr>
425
- </thead>
426
- <tbody>
427
- {TYPOGRAPHY_VARIANTS.map(({ variant, tag }) => (
428
- <tr key={variant}>
429
- <td><strong>{variant}</strong></td>
430
- <td className="cbx-doc-mono">{tag}</td>
431
- <td className="cbx-doc-mono">{metrics[variant] || ''}</td>
432
- <td><Typography variant={variant} component="span" ref={element => { refs.current[variant] = element; }} styles={{ display: 'block', margin: 0 }}>Junta General</Typography></td>
433
- </tr>
434
- ))}
435
- </tbody>
436
- </table>
437
- );
438
- };
439
-
440
- export const SpacingScale = () => {
441
- const [, forceUpdate] = React.useState(0);
442
- React.useEffect(() => { forceUpdate(1); }, []);
443
- return (
444
- <table className="cbx-doc-table">
445
- <thead>
446
- <tr><th scope="col">Variable</th><th scope="col">Valor</th><th scope="col">Píxeles</th><th scope="col" style={{ width: '50%' }}>Tamaño</th></tr>
447
- </thead>
448
- <tbody>
449
- {SPACING_TOKENS.map(size => (
450
- <tr key={size}>
451
- <td className="cbx-doc-mono">{`--spacing${size}`}</td>
452
- <td className="cbx-doc-mono">{readToken(`spacing${size}`)}</td>
453
- <td className="cbx-doc-mono">{`${size}px`}</td>
454
- <td><div className="cbx-doc-spacing-bar" style={{ width: `var(--spacing${size})` }} /></td>
455
- </tr>
456
- ))}
457
- </tbody>
458
- </table>
459
- );
460
- };
461
-
462
- <div className="cbx-doc">
463
- <header className="cbx-doc-hero">
464
- <LinkTo kind="Inicio/Introducción" story="Page" className="cbx-doc-back"><i className="ri-arrow-left-line" aria-hidden="true" />Volver a la introducción</LinkTo>
465
- <h1>Guía de uso</h1>
466
- <p>Tokens de diseño, tipografía, estilos y accesibilidad para usar la librería de forma consistente.</p>
467
- </header>
468
- <div className="cbx-doc-layout">
469
- <nav className="cbx-doc-toc" aria-label="Contenido de la guía">
470
- <p>Contenido</p>
471
- <ul>
472
- {SECTIONS.map(section => (
473
- <li key={section.id}><button type="button" onClick={() => scrollToSection(section.id)}><i className={section.icon} aria-hidden="true" />{section.label}</button></li>
474
- ))}
475
- </ul>
476
- </nav>
477
- <div>
478
- <section className="cbx-doc-section" id="guide-install" aria-labelledby="guide-install-title">
479
- <div className="cbx-doc-section-header">
480
- <h2 id="guide-install-title">Instalación</h2>
481
- <p>Instala el paquete y envuelve la aplicación con ThemeProvider.</p>
482
- </div>
483
- <Source language="bash" dark code="yarn add @councilbox/councilbox-ui" />
484
- <Source language="jsx" dark code={`import ThemeProvider from '@councilbox/councilbox-ui/ThemeProvider';\n\nconst Root = () => (\n\t<ThemeProvider colors={{ primary: '#38398C' }} options={{ accesibilityStrict: false }}>\n\t\t<App />\n\t</ThemeProvider>\n);`} />
485
- <h3 className="cbx-doc-subtitle">Formas de importar</h3>
486
- <div className="cbx-doc-cards">
487
- <div className="cbx-doc-card">
488
- <h3><i className="ri-checkbox-circle-line" aria-hidden="true" />Recomendada</h3>
489
- <p>Un archivo por componente: solo se carga lo que se usa.</p>
490
- </div>
491
- <div className="cbx-doc-card">
492
- <h3><i className="ri-folder-line" aria-hidden="true" />Ruta completa</h3>
493
- <p>Equivalente, a través de la carpeta dist.</p>
494
- </div>
495
- <div className="cbx-doc-card">
496
- <h3><i className="ri-stack-line" aria-hidden="true" />Índice</h3>
497
- <p>Cómoda, pero sin tree-shaking carga toda la librería.</p>
498
- </div>
499
- </div>
500
- <Source language="jsx" dark code={`// Recomendada\nimport ButtonBasic from '@councilbox/councilbox-ui/ButtonBasic';\n\n// Ruta completa\nimport ButtonBasic from '@councilbox/councilbox-ui/dist/components/ButtonBasic/ButtonBasic';\n\n// Índice\nimport { ButtonBasic } from '@councilbox/councilbox-ui';`} />
501
- </section>
502
- <section className="cbx-doc-section" id="guide-colors" aria-labelledby="guide-colors-title">
503
- <div className="cbx-doc-section-header">
504
- <h2 id="guide-colors-title">Colores</h2>
505
- <p>Variables CSS globales. Los valores se leen en vivo de la librería. Pulsa una muestra para copiar su variable.</p>
506
- </div>
507
- <ColorPalette />
508
- <div className="cbx-doc-note"><i className="ri-lightbulb-line" aria-hidden="true" /><div>Usa siempre las variables (<code>var(--primary)</code>) en lugar de los valores hexadecimales, para que el color se adapte cuando ThemeProvider cambie la marca.</div></div>
509
- </section>
510
- <section className="cbx-doc-section" id="guide-typography" aria-labelledby="guide-typography-title">
511
- <div className="cbx-doc-section-header">
512
- <h2 id="guide-typography-title">Tipografía</h2>
513
- <p>Dos familias y una escala de diez variantes, disponibles con el componente Typography.</p>
514
- </div>
515
- <div className="cbx-doc-fonts">
516
- <div className="cbx-doc-font">
517
- <div className="cbx-doc-font-sample" style={{ fontFamily: 'var(--font-primary)' }}>Aa</div>
518
- <strong>Lato</strong>
519
- <span>--font-primary · textos</span>
520
- </div>
521
- <div className="cbx-doc-font">
522
- <div className="cbx-doc-font-sample" style={{ fontFamily: 'var(--font-secondary)' }}>Aa</div>
523
- <strong>Montserrat</strong>
524
- <span>--font-secondary · títulos y cifras</span>
525
- </div>
526
- </div>
527
- <TypographyScale />
528
- <div className="cbx-doc-note"><i className="ri-lightbulb-line" aria-hidden="true" /><div>Las variantes 5XL a L generan encabezados (<code>h1</code> a <code>h6</code>). Si solo quieres el tamaño, pasa <code>component="span"</code> para no alterar la estructura de la página.</div></div>
529
- </section>
530
- <section className="cbx-doc-section" id="guide-spacing" aria-labelledby="guide-spacing-title">
531
- <div className="cbx-doc-section-header">
532
- <h2 id="guide-spacing-title">Espaciados</h2>
533
- <p>Escala basada en múltiplos de 4px. Úsala para márgenes, rellenos y separaciones.</p>
534
- </div>
535
- <SpacingScale />
536
- </section>
537
- <section className="cbx-doc-section" id="guide-breakpoints" aria-labelledby="guide-breakpoints-title">
538
- <div className="cbx-doc-section-header">
539
- <h2 id="guide-breakpoints-title">Breakpoints</h2>
540
- <p>Puntos de corte de useWindowSize y de las columnas de Grid (xs, sm, md, lg y xl).</p>
541
- </div>
542
- <table className="cbx-doc-table">
543
- <thead>
544
- <tr><th scope="col">Nombre</th><th scope="col">Desde</th><th scope="col">Uso habitual</th></tr>
545
- </thead>
546
- <tbody>
547
- {BREAKPOINTS.map(breakpoint => (
548
- <tr key={breakpoint.name}><td><strong>{breakpoint.name}</strong></td><td className="cbx-doc-mono">{breakpoint.from}</td><td>{breakpoint.use}</td></tr>
549
- ))}
550
- </tbody>
551
- </table>
552
- <div className="cbx-doc-note"><i className="ri-information-line" aria-hidden="true" /><div><code>useWindowSize</code> usa <code>xl</code> desde 1920px, mientras que las columnas de <code>Grid</code> aplican <code>xl</code> desde 1536px.</div></div>
553
- </section>
554
- <section className="cbx-doc-section" id="guide-sx" aria-labelledby="guide-sx-title">
555
- <div className="cbx-doc-section-header">
556
- <h2 id="guide-sx-title">Estilos con sx</h2>
557
- <p>Todos los componentes aceptan la prop sx para personalizar sus estilos, también los de sus elementos internos.</p>
558
- </div>
559
- <p className="cbx-doc-text">Las propiedades del primer nivel de <code>sx</code> se aplican como estilos en línea al elemento principal. Las claves que empiezan por <code>.</code> se convierten en CSS con un prefijo único del componente, así que afectan solo a esa instancia y permiten llegar a elementos internos, pseudoclases o etiquetas.</p>
560
- <Source language="jsx" dark code={`<ButtonBasic\n\ttext="Guardar"\n\tsx={{\n\t\tborderRadius: '24px',\n\t\t'.cbx-buttonBasic:hover': {\n\t\t\tbackgroundColor: 'var(--primary75)',\n\t\t},\n\t}}\n/>`} />
561
- <h3 className="cbx-doc-subtitle">Usar sx en un componente nuevo</h3>
562
- <p className="cbx-doc-text">Importa el hook <code>useDynamicStyles</code>. Aplica <code>stylesInLine</code> al elemento principal y usa <code>prefixClass</code> en todas las clases que quieras que se puedan personalizar desde fuera.</p>
563
- <Source language="jsx" dark code={`import useDynamicStyles from '../../HOCs/useDynamicStyles';\n\nconst Card = ({ sx, style, className, children }) => {\n\tconst { stylesInLine, prefixClass } = useDynamicStyles(sx);\n\n\treturn (\n\t\t<div className={\`\${prefixClass('cbx-card')} \${className || ''}\`} style={{ ...stylesInLine, ...style }}>\n\t\t\t<div className={prefixClass('cbx-card-body')}>{children}</div>\n\t\t</div>\n\t);\n};\n\n<Card\n\tsx={{\n\t\tbackgroundColor: 'var(--gray1)',\n\t\t'.cbx-card-body': { color: 'var(--primary)', padding: 'var(--spacing16)' },\n\t}}\n>\n\tContenido\n</Card>`} />
564
- </section>
565
- <section className="cbx-doc-section" id="guide-a11y" aria-labelledby="guide-a11y-title">
566
- <div className="cbx-doc-section-header">
567
- <h2 id="guide-a11y-title">Accesibilidad</h2>
568
- <p>La librería sigue WCAG 2.1 AA. Cada componente documenta su accesibilidad en su pestaña Docs.</p>
569
- </div>
570
- <div className="cbx-doc-cards">
571
- <div className="cbx-doc-card">
572
- <h3><i className="ri-shield-check-line" aria-hidden="true" />useA11yGuard</h3>
573
- <p>Comprueba que los componentes reciben su nombre accesible (label, aria-label, title...). Con accesibilityStrict lanza un error si falta.</p>
574
- </div>
575
- <div className="cbx-doc-card">
576
- <h3><i className="ri-keyboard-line" aria-hidden="true" />Teclado</h3>
577
- <p>Todo lo interactivo es alcanzable con Tab y se activa con Enter o Espacio. Menús y pestañas se recorren con las flechas.</p>
578
- </div>
579
- <div className="cbx-doc-card">
580
- <h3><i className="ri-test-tube-line" aria-hidden="true" />Addon a11y</h3>
581
- <p>La pestaña Accessibility de cada story analiza el componente con axe (WCAG 2.1 A y AA).</p>
582
- </div>
583
- </div>
584
- <p className="cbx-doc-text">Activa el modo estricto en desarrollo para detectar a tiempo los componentes sin nombre accesible:</p>
585
- <Source language="jsx" dark code={`<ThemeProvider options={{ accesibilityStrict: process.env.NODE_ENV === 'development' }}>\n\t<App />\n</ThemeProvider>`} />
586
- </section>
587
- </div>
588
- </div>
589
- </div>
@@ -1,95 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports["default"] = exports.Design = exports.Default = void 0;
7
- var _react = _interopRequireDefault(require("react"));
8
- var _Accordion = _interopRequireDefault(require("./Accordion"));
9
- var _DesignAccordion = _interopRequireDefault(require("./DesignAccordion.stories"));
10
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
11
- var _default = {
12
- title: 'Components/Accordion',
13
- component: _Accordion["default"],
14
- argTypes: {
15
- title: {
16
- control: 'text',
17
- description: 'Título visible del acordeón.'
18
- },
19
- contentExpand: {
20
- control: 'text',
21
- description: 'Contenido que se muestra al desplegar.'
22
- },
23
- defaultExpanded: {
24
- control: 'boolean',
25
- description: 'Empieza desplegado.'
26
- },
27
- disabled: {
28
- control: 'boolean'
29
- },
30
- component: {
31
- control: 'select',
32
- options: ['span', 'h2', 'h3', 'h4', 'p'],
33
- description: 'Etiqueta HTML del título.'
34
- },
35
- 'aria-label': {
36
- control: 'text',
37
- description: 'Nombre accesible del botón si no hay título.'
38
- },
39
- id: {
40
- control: 'text'
41
- },
42
- className: {
43
- control: 'text'
44
- },
45
- style: {
46
- control: 'object'
47
- },
48
- sx: {
49
- control: 'object'
50
- }
51
- },
52
- parameters: {
53
- docs: {
54
- description: {
55
- component: "\n\n## Accordion\n\nComponente que permite expandir y contraer bloques de contenido asociados a un t\xEDtulo.\n\nEl componente utiliza elementos HTML nativos para garantizar una interacci\xF3n correcta con teclado y lectores de pantalla.\n\n## Accesibilidad\n\n### Estructura sem\xE1ntica\n\n- El t\xEDtulo del acorde\xF3n se renderiza dentro de un elemento `h3`, proporcionando una jerarqu\xEDa sem\xE1ntica adecuada dentro de una p\xE1gina.\n- La acci\xF3n de expandir y contraer utiliza un elemento nativo `button`, evitando patrones personalizados que puedan perder comportamiento accesible.\n- El contenido expandible utiliza el rol `region` para identificarlo como una secci\xF3n independiente.\n\n### Estado expandido\n\n- El bot\xF3n informa del estado actual mediante el atributo `aria-expanded`.\n- Cuando el acorde\xF3n est\xE1 cerrado:\n - `aria-expanded=\"false\"`\n - El contenido se oculta visualmente.\n- Cuando el acorde\xF3n est\xE1 abierto:\n - `aria-expanded=\"true\"`\n - El contenido est\xE1 disponible para el usuario.\n\n### Relaci\xF3n entre t\xEDtulo y contenido\n\n- El bot\xF3n utiliza `aria-controls` para indicar qu\xE9 panel controla.\n- El panel utiliza `aria-labelledby` para asociarse con el t\xEDtulo del acorde\xF3n.\n- Los identificadores se generan autom\xE1ticamente para mantener una relaci\xF3n \xFAnica entre elementos.\n\n### Navegaci\xF3n mediante teclado\n\n- Al utilizar un elemento `button` nativo:\n - Se puede acceder mediante la tecla Tab.\n - Se puede activar mediante Enter y Espacio.\n - Mantiene el comportamiento esperado por lectores de pantalla y tecnolog\xEDas asistivas.\n\n### Estado deshabilitado\n\n- Cuando el acorde\xF3n est\xE1 deshabilitado:\n - El bot\xF3n utiliza el atributo HTML `disabled`.\n - No permite interacci\xF3n mediante teclado o rat\xF3n.\n - Mantiene el estado visual de elemento no interactivo.\n\n### Iconograf\xEDa\n\n- El icono utilizado para indicar el estado del acorde\xF3n es \xFAnicamente decorativo.\n- Se marca con `aria-hidden=\"true\"` para evitar que los lectores de pantalla anuncien informaci\xF3n redundante.\n\n## Recomendaciones de uso\n\n- Utilizar t\xEDtulos descriptivos que indiquen claramente el contenido que se mostrar\xE1.\n- No utilizar el Accordion para navegaci\xF3n principal; para ello deben utilizarse componentes espec\xEDficos de navegaci\xF3n.\n- Evitar introducir grandes cantidades de contenido dentro del panel expandible.\n\n## Consideraciones\n\nEl componente gestiona autom\xE1ticamente la relaci\xF3n entre el bot\xF3n y el panel mediante identificadores \xFAnicos.\nNo es necesario a\xF1adir atributos ARIA adicionales salvo que se requieran necesidades espec\xEDficas del caso de uso.\n\n\t\t\t"
56
- }
57
- },
58
- storybookCodePanel: {
59
- disabled: false,
60
- files: [{
61
- fileName: 'Accordion.js',
62
- // eslint-disable-next-line import/no-webpack-loader-syntax, global-require, import/extensions, import/no-unresolved
63
- code: require('!!raw-loader!./Accordion.jsx')
64
- }, {
65
- fileName: 'Accordion.css',
66
- // eslint-disable-next-line import/no-webpack-loader-syntax, global-require, import/extensions, import/no-unresolved
67
- code: require('!!raw-loader!./Accordion.css')
68
- }]
69
- }
70
- }
71
- };
72
- exports["default"] = _default;
73
- var Template = function Template(args) {
74
- return /*#__PURE__*/_react["default"].createElement(_Accordion["default"], args);
75
- };
76
- Template.displayName = "Template";
77
- var Default = Template.bind({});
78
- exports.Default = Default;
79
- Default.args = {
80
- title: 'Orden del día',
81
- contentExpand: 'Aprobación de las cuentas anuales del ejercicio 2025.',
82
- defaultExpanded: false,
83
- disabled: false,
84
- component: 'span'
85
- };
86
- var Design = function Design() {
87
- return /*#__PURE__*/_react["default"].createElement(_DesignAccordion["default"], null);
88
- };
89
- exports.Design = Design;
90
- Design.displayName = "Design";
91
- Design.parameters = {
92
- controls: {
93
- disable: true
94
- }
95
- };