siesa-ui-kit 1.0.5 → 1.0.6

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 (198) hide show
  1. package/dist/index.cjs +1479 -0
  2. package/dist/index.cjs.map +1 -0
  3. package/dist/index.js +1479 -0
  4. package/dist/index.js.map +1 -0
  5. package/package.json +23 -14
  6. package/claude/agents/siesa-ui-kit-specialist.md +0 -2401
  7. package/claude/prompts/component-template.md +0 -121
  8. package/claude/settings.local.json +0 -61
  9. package/docs/border-radius.md +0 -1261
  10. package/docs/colors.md +0 -832
  11. package/docs/dark-mode-guide.md +0 -1426
  12. package/docs/filters.md +0 -1243
  13. package/docs/icons.md +0 -1283
  14. package/docs/shadows.md +0 -1377
  15. package/docs/spacing.md +0 -1684
  16. package/docs/typography.md +0 -1268
  17. package/postcss.config.cjs +0 -6
  18. package/src/App.css +0 -42
  19. package/src/App.tsx +0 -8
  20. package/src/ButtonTest.tsx +0 -147
  21. package/src/assets/fonts/README.md +0 -261
  22. package/src/assets/fonts/SiesaBT/SiesaBT-Bold.otf +0 -0
  23. package/src/assets/fonts/SiesaBT/SiesaBT-Light.otf +0 -0
  24. package/src/assets/fonts/SiesaBT/SiesaBT-Regular.otf +0 -0
  25. package/src/assets/react.svg +0 -1
  26. package/src/components/Alert/Alert.stories.tsx +0 -332
  27. package/src/components/Alert/Alert.tsx +0 -106
  28. package/src/components/Alert/Alert.types.ts +0 -54
  29. package/src/components/Avatar/Avatar.stories.tsx +0 -494
  30. package/src/components/Avatar/Avatar.tsx +0 -143
  31. package/src/components/Avatar/Avatar.types.ts +0 -53
  32. package/src/components/Badge/Badge.stories.tsx +0 -339
  33. package/src/components/Badge/Badge.tsx +0 -278
  34. package/src/components/Badge/Badge.types.ts +0 -58
  35. package/src/components/Button/Button.stories.tsx +0 -950
  36. package/src/components/Button/Button.tsx +0 -337
  37. package/src/components/Button/Button.types.ts +0 -180
  38. package/src/components/Button/icons.tsx +0 -87
  39. package/src/components/Button/index.ts +0 -3
  40. package/src/components/Checkbox/Checkbox.stories.tsx +0 -453
  41. package/src/components/Checkbox/Checkbox.tsx +0 -208
  42. package/src/components/Checkbox/Checkbox.types.ts +0 -61
  43. package/src/components/DescriptionList/DescriptionList.stories.tsx +0 -250
  44. package/src/components/DescriptionList/DescriptionList.tsx +0 -96
  45. package/src/components/DescriptionList/DescriptionList.types.ts +0 -29
  46. package/src/components/Divider/Divider.stories.tsx +0 -263
  47. package/src/components/Divider/Divider.tsx +0 -80
  48. package/src/components/Divider/Divider.types.ts +0 -24
  49. package/src/components/Dropdown/Dropdown.stories.tsx +0 -552
  50. package/src/components/Dropdown/Dropdown.tsx +0 -422
  51. package/src/components/Dropdown/Dropdown.types.ts +0 -146
  52. package/src/components/Dropdown/README.md +0 -266
  53. package/src/components/Dropdown/icons.tsx +0 -72
  54. package/src/components/Dropdown/index.ts +0 -8
  55. package/src/components/Input/Input.stories.tsx +0 -583
  56. package/src/components/Input/Input.tsx +0 -204
  57. package/src/components/Input/Input.types.ts +0 -80
  58. package/src/components/Input/icons.tsx +0 -145
  59. package/src/components/Input/index.ts +0 -2
  60. package/src/components/LoginView/LoginView.stories.tsx +0 -148
  61. package/src/components/LoginView/LoginView.tsx +0 -426
  62. package/src/components/LoginView/LoginView.types.ts +0 -52
  63. package/src/components/LoginView/README.md +0 -396
  64. package/src/components/LoginView/icons.tsx +0 -85
  65. package/src/components/LoginView/index.ts +0 -3
  66. package/src/components/Navbar/Navbar.stories.tsx +0 -810
  67. package/src/components/Navbar/Navbar.tsx +0 -755
  68. package/src/components/Navbar/Navbar.types.ts +0 -219
  69. package/src/components/Navbar/README.md +0 -279
  70. package/src/components/Navbar/icons.tsx +0 -102
  71. package/src/components/Navbar/index.ts +0 -8
  72. package/src/components/NavigationBar/NavigationBar.stories.tsx +0 -406
  73. package/src/components/NavigationBar/NavigationBar.tsx +0 -246
  74. package/src/components/NavigationBar/NavigationBar.types.ts +0 -74
  75. package/src/components/NavigationBar/README.md +0 -469
  76. package/src/components/NavigationBar/index.ts +0 -2
  77. package/src/components/NavigationRail/NavigationRail.stories.tsx +0 -417
  78. package/src/components/NavigationRail/NavigationRail.tsx +0 -418
  79. package/src/components/NavigationRail/NavigationRail.types.ts +0 -109
  80. package/src/components/NavigationRail/README.md +0 -224
  81. package/src/components/NavigationRail/index.ts +0 -2
  82. package/src/components/Notification/Notification.stories.tsx +0 -513
  83. package/src/components/Notification/Notification.tsx +0 -145
  84. package/src/components/Notification/Notification.types.ts +0 -142
  85. package/src/components/Notification/README.md +0 -409
  86. package/src/components/Notification/index.ts +0 -3
  87. package/src/components/POSConvention/POSConvention.stories.tsx +0 -235
  88. package/src/components/POSConvention/POSConvention.tsx +0 -129
  89. package/src/components/POSConvention/POSConvention.types.ts +0 -38
  90. package/src/components/POSConvention/README.md +0 -123
  91. package/src/components/POSConvention/icons.tsx +0 -45
  92. package/src/components/POSConvention/index.ts +0 -3
  93. package/src/components/POSLocationButton/POSLocationButton.stories.tsx +0 -531
  94. package/src/components/POSLocationButton/POSLocationButton.tsx +0 -247
  95. package/src/components/POSLocationButton/POSLocationButton.types.ts +0 -87
  96. package/src/components/POSLocationButton/README.md +0 -253
  97. package/src/components/POSLocationButton/icons.tsx +0 -120
  98. package/src/components/POSLocationButton/index.ts +0 -14
  99. package/src/components/POSNumberButton/POSNumberButton.stories.tsx +0 -415
  100. package/src/components/POSNumberButton/POSNumberButton.tsx +0 -179
  101. package/src/components/POSNumberButton/POSNumberButton.types.ts +0 -51
  102. package/src/components/POSNumberButton/README.md +0 -321
  103. package/src/components/POSNumberButton/index.ts +0 -3
  104. package/src/components/POSProductButton/POSProductButton.stories.tsx +0 -318
  105. package/src/components/POSProductButton/POSProductButton.tsx +0 -152
  106. package/src/components/POSProductButton/POSProductButton.types.ts +0 -46
  107. package/src/components/POSProductButton/README.md +0 -269
  108. package/src/components/POSProductButton/index.ts +0 -2
  109. package/src/components/POSProductCard/POSProductCard.stories.tsx +0 -642
  110. package/src/components/POSProductCard/POSProductCard.tsx +0 -208
  111. package/src/components/POSProductCard/POSProductCard.types.ts +0 -76
  112. package/src/components/POSProductCard/README.md +0 -179
  113. package/src/components/POSProductCard/icons.tsx +0 -26
  114. package/src/components/POSProductCard/index.ts +0 -2
  115. package/src/components/POSProductSidebarItems/POSProductSidebarItems.stories.tsx +0 -753
  116. package/src/components/POSProductSidebarItems/POSProductSidebarItems.tsx +0 -332
  117. package/src/components/POSProductSidebarItems/POSProductSidebarItems.types.ts +0 -119
  118. package/src/components/POSProductSidebarItems/README.md +0 -198
  119. package/src/components/POSProductSidebarItems/icons.tsx +0 -21
  120. package/src/components/POSProductSidebarItems/index.ts +0 -3
  121. package/src/components/POSTable/POSTable.stories.tsx +0 -737
  122. package/src/components/POSTable/POSTable.tsx +0 -401
  123. package/src/components/POSTable/POSTable.types.ts +0 -83
  124. package/src/components/POSTable/README.md +0 -286
  125. package/src/components/POSTable/index.ts +0 -7
  126. package/src/components/Pagination/Pagination.stories.tsx +0 -555
  127. package/src/components/Pagination/Pagination.tsx +0 -286
  128. package/src/components/Pagination/Pagination.types.ts +0 -93
  129. package/src/components/Pagination/README.md +0 -298
  130. package/src/components/Pagination/icons.tsx +0 -47
  131. package/src/components/Pagination/index.ts +0 -3
  132. package/src/components/Quantity/Quantity.stories.tsx +0 -457
  133. package/src/components/Quantity/Quantity.tsx +0 -289
  134. package/src/components/Quantity/Quantity.types.ts +0 -70
  135. package/src/components/Radio/Radio.stories.tsx +0 -523
  136. package/src/components/Radio/Radio.tsx +0 -170
  137. package/src/components/Radio/Radio.types.ts +0 -122
  138. package/src/components/Select/README.md +0 -299
  139. package/src/components/Select/Select.stories.tsx +0 -673
  140. package/src/components/Select/Select.tsx +0 -454
  141. package/src/components/Select/Select.types.ts +0 -148
  142. package/src/components/Select/icons.tsx +0 -50
  143. package/src/components/Select/index.ts +0 -3
  144. package/src/components/SignUpView/SignUpView.stories.tsx +0 -129
  145. package/src/components/SignUpView/SignUpView.tsx +0 -503
  146. package/src/components/SignUpView/SignUpView.types.ts +0 -58
  147. package/src/components/SignUpView/icons.tsx +0 -71
  148. package/src/components/SignUpView/index.ts +0 -3
  149. package/src/components/Switch/README.md +0 -112
  150. package/src/components/Switch/Switch.stories.tsx +0 -550
  151. package/src/components/Switch/Switch.tsx +0 -246
  152. package/src/components/Switch/Switch.types.ts +0 -67
  153. package/src/components/Table/README.md +0 -369
  154. package/src/components/Table/Table.stories.tsx +0 -805
  155. package/src/components/Table/Table.tsx +0 -688
  156. package/src/components/Table/Table.types.ts +0 -204
  157. package/src/components/Table/index.ts +0 -9
  158. package/src/components/Tabs/README.md +0 -201
  159. package/src/components/Tabs/Tabs.stories.tsx +0 -580
  160. package/src/components/Tabs/Tabs.tsx +0 -356
  161. package/src/components/Tabs/Tabs.types.ts +0 -127
  162. package/src/components/Tabs/icons.tsx +0 -129
  163. package/src/components/Tabs/index.ts +0 -11
  164. package/src/components/Textarea/Textarea.stories.tsx +0 -535
  165. package/src/components/Textarea/Textarea.tsx +0 -188
  166. package/src/components/Textarea/Textarea.types.ts +0 -54
  167. package/src/context/ThemeContext.tsx +0 -99
  168. package/src/context/index.ts +0 -1
  169. package/src/index.css +0 -29
  170. package/src/index.ts +0 -39
  171. package/src/main.tsx +0 -10
  172. package/src/views/ProductsView/ProductsView.stories.tsx +0 -344
  173. package/src/views/ProductsView/ProductsView.tsx +0 -480
  174. package/src/views/ProductsView/ProductsView.types.ts +0 -238
  175. package/src/views/ProductsView/README.md +0 -312
  176. package/src/views/ProductsView/icons.tsx +0 -38
  177. package/src/views/ProductsView/index.ts +0 -8
  178. package/src/views/RecoverPasswordView/README.md +0 -269
  179. package/src/views/RecoverPasswordView/RecoverPasswordView.stories.tsx +0 -131
  180. package/src/views/RecoverPasswordView/RecoverPasswordView.tsx +0 -376
  181. package/src/views/RecoverPasswordView/RecoverPasswordView.types.ts +0 -56
  182. package/src/views/RecoverPasswordView/icons.tsx +0 -17
  183. package/src/views/RecoverPasswordView/index.ts +0 -2
  184. package/src/views/TableLayoutView/README.md +0 -268
  185. package/src/views/TableLayoutView/TableLayoutView.stories.tsx +0 -235
  186. package/src/views/TableLayoutView/TableLayoutView.tsx +0 -461
  187. package/src/views/TableLayoutView/TableLayoutView.types.ts +0 -209
  188. package/src/views/TableLayoutView/icons.tsx +0 -113
  189. package/src/views/TableLayoutView/index.ts +0 -6
  190. package/storybook/main.ts +0 -20
  191. package/storybook/preview.tsx +0 -84
  192. package/storybook/vitest.setup.ts +0 -7
  193. package/tailwind.config.js +0 -128
  194. /package/{public → dist}/,Business Logo.png +0 -0
  195. /package/{public → dist}/.Siesa Logo.png +0 -0
  196. /package/{public → dist}/bg_siesa.png +0 -0
  197. /package/{public → dist}/siesa_logo_mobile.png +0 -0
  198. /package/{public → dist}/vite.svg +0 -0
@@ -1,453 +0,0 @@
1
- import type { Meta, StoryObj } from '@storybook/react-vite';
2
- import { Checkbox } from './Checkbox';
3
- import { useState } from 'react';
4
-
5
- /**
6
- * Checkbox - Componente de checkbox del sistema de diseño Siesa
7
- *
8
- * Sistema completo de checkboxes con soporte para:
9
- * - **Estados**: Default, Hover, Focus, Disabled
10
- * - **Selección**: Unchecked, Checked, Indeterminate
11
- * - **Label y Description**: Etiquetas con descripción opcional
12
- * - **Accesibilidad**: Completa con keyboard navigation
13
- * - **Dark mode**: Adaptación completa al tema oscuro
14
- */
15
- const meta = {
16
- title: 'Siesa UI Kit/Checkbox',
17
- component: Checkbox,
18
- parameters: {
19
- layout: 'centered',
20
- docs: {
21
- description: {
22
- component:
23
- 'Campos de selección binaria con soporte para múltiples estados, indeterminate, y opciones de etiquetado. Diseñado para mantener consistencia visual y funcional en toda la aplicación.',
24
- },
25
- },
26
- backgrounds: {
27
- default: 'light',
28
- values: [
29
- { name: 'light', value: '#ffffff' },
30
- { name: 'gray', value: '#f3f4f6' },
31
- { name: 'dark', value: '#1f2937' },
32
- ],
33
- },
34
- },
35
- tags: ['autodocs'],
36
- argTypes: {
37
- label: {
38
- control: 'text',
39
- description: 'Etiqueta del checkbox',
40
- table: {
41
- type: { summary: 'string' },
42
- category: 'Content',
43
- },
44
- },
45
- description: {
46
- control: 'text',
47
- description: 'Descripción debajo del label',
48
- table: {
49
- type: { summary: 'string' },
50
- category: 'Content',
51
- },
52
- },
53
- checked: {
54
- control: 'boolean',
55
- description: 'Si el checkbox está marcado',
56
- table: {
57
- type: { summary: 'boolean' },
58
- defaultValue: { summary: 'false' },
59
- category: 'State',
60
- },
61
- },
62
- indeterminate: {
63
- control: 'boolean',
64
- description: 'Si el checkbox está en estado indeterminado',
65
- table: {
66
- type: { summary: 'boolean' },
67
- defaultValue: { summary: 'false' },
68
- category: 'State',
69
- },
70
- },
71
- disabled: {
72
- control: 'boolean',
73
- description: 'Deshabilita el checkbox',
74
- table: {
75
- type: { summary: 'boolean' },
76
- defaultValue: { summary: 'false' },
77
- category: 'State',
78
- },
79
- },
80
- },
81
- } satisfies Meta<typeof Checkbox>;
82
-
83
- export default meta;
84
- type Story = StoryObj<typeof meta>;
85
-
86
- // ============================================
87
- // 1. PLAYGROUND INTERACTIVO
88
- // ============================================
89
-
90
- /**
91
- * Playground Interactivo
92
- *
93
- * Usa los controles para experimentar con todas las props del Checkbox en tiempo real.
94
- * Cambia el estado, textos y más para ver cómo se comporta el componente.
95
- */
96
- export const Playground: Story = {
97
- name: 'Playground',
98
- args: {
99
- label: 'Mostrar en Página de Eventos',
100
- description: 'Hacer este evento visible en tu perfil.',
101
- checked: false,
102
- indeterminate: false,
103
- disabled: false,
104
- },
105
- render: (args) => {
106
- const [checked, setChecked] = useState(args.checked);
107
-
108
- return (
109
- <Checkbox
110
- {...args}
111
- checked={checked}
112
- onChange={(e) => setChecked(e.target.checked)}
113
- />
114
- );
115
- },
116
- };
117
-
118
- // ============================================
119
- // 2. TODOS LOS ESTADOS
120
- // ============================================
121
-
122
- /**
123
- * Todos los Estados
124
- *
125
- * Vista rápida de todos los estados del Checkbox: default, hover, focus, disabled.
126
- * Muestra estados checked y unchecked para cada uno.
127
- */
128
- export const AllStates: Story = {
129
- name: 'Todos los Estados',
130
- render: () => (
131
- <div className="space-y-6">
132
- {/* Unchecked States */}
133
- <div>
134
- <h3 className="text-sm font-bold mb-4 text-gray-700 dark:text-white">Estados Sin Marcar</h3>
135
- <div className="space-y-3">
136
- <Checkbox label="Por Defecto" description="Checkbox sin marcar en estado por defecto" />
137
- <Checkbox label="Hover" description="Pasa el mouse sobre el checkbox para ver el estado" />
138
- <Checkbox label="Foco" description="Haz clic para enfocar (intenta presionar Tab)" />
139
- <Checkbox label="Deshabilitado" description="Checkbox deshabilitado sin marcar" disabled />
140
- </div>
141
- </div>
142
-
143
- {/* Checked States */}
144
- <div>
145
- <h3 className="text-sm font-bold mb-4 text-gray-700 dark:text-white">Estados Marcados</h3>
146
- <div className="space-y-3">
147
- <Checkbox
148
- label="Por Defecto"
149
- description="Checkbox marcado en estado por defecto"
150
- checked
151
- onChange={() => {}}
152
- />
153
- <Checkbox
154
- label="Hover"
155
- description="Pasa el mouse sobre el checkbox para ver el estado"
156
- checked
157
- onChange={() => {}}
158
- />
159
- <Checkbox
160
- label="Seleccionado"
161
- description="Checkbox seleccionado"
162
- checked
163
- onChange={() => {}}
164
- />
165
- <Checkbox
166
- label="Deshabilitado"
167
- description="Checkbox marcado deshabilitado"
168
- checked
169
- disabled
170
- onChange={() => {}}
171
- />
172
- </div>
173
- </div>
174
-
175
- {/* Indeterminate States */}
176
- <div>
177
- <h3 className="text-sm font-bold mb-4 text-gray-700 dark:text-white">Estados Indeterminados</h3>
178
- <div className="space-y-3">
179
- <Checkbox
180
- label="Indeterminado"
181
- description="Estado parcialmente seleccionado"
182
- indeterminate
183
- onChange={() => {}}
184
- />
185
- <Checkbox
186
- label="Hover"
187
- description="Pasa el mouse sobre el checkbox indeterminado"
188
- indeterminate
189
- onChange={() => {}}
190
- />
191
- <Checkbox
192
- label="Deshabilitado"
193
- description="Checkbox indeterminado deshabilitado"
194
- indeterminate
195
- disabled
196
- onChange={() => {}}
197
- />
198
- </div>
199
- </div>
200
- </div>
201
- ),
202
- };
203
-
204
- // ============================================
205
- // 3. CON Y SIN LABELS
206
- // ============================================
207
-
208
- /**
209
- * Con y Sin Labels
210
- *
211
- * Ejemplos de checkboxes con diferentes combinaciones de label y description.
212
- */
213
- export const ConEtiquetas: Story = {
214
- name: 'Con y Sin Etiquetas',
215
- render: () => (
216
- <div className="space-y-6">
217
- {/* Sin Label ni Description */}
218
- <div>
219
- <h3 className="text-sm font-bold mb-4 text-gray-700 dark:text-white">Sin Label ni Description</h3>
220
- <Checkbox />
221
- </div>
222
-
223
- {/* Solo Label */}
224
- <div>
225
- <h3 className="text-sm font-bold mb-4 text-gray-700 dark:text-white">Solo Label</h3>
226
- <Checkbox label="Aceptar términos y condiciones" />
227
- </div>
228
-
229
- {/* Label + Description */}
230
- <div>
231
- <h3 className="text-sm font-bold mb-4 text-gray-700 dark:text-white">Label + Description</h3>
232
- <Checkbox
233
- label="Mostrar en Página de Eventos"
234
- description="Hacer este evento visible en tu perfil."
235
- />
236
- </div>
237
-
238
- {/* Label Largo */}
239
- <div>
240
- <h3 className="text-sm font-bold mb-4 text-gray-700 dark:text-white">Con Texto Largo</h3>
241
- <Checkbox
242
- label="Enviarme correos promocionales y actualizaciones"
243
- description="Puedes darte de baja en cualquier momento. Nunca compartiremos tu dirección de correo con terceros."
244
- />
245
- </div>
246
- </div>
247
- ),
248
- };
249
-
250
- // ============================================
251
- // 4. CHECKBOX GROUPS
252
- // ============================================
253
-
254
- /**
255
- * Checkbox Groups
256
- *
257
- * Ejemplos de grupos de checkboxes relacionados, incluyendo "select all" con estado indeterminado.
258
- */
259
- export const CheckboxGroups: Story = {
260
- name: 'Grupos de Checkbox',
261
- render: () => {
262
- const [items, setItems] = useState({
263
- item1: true,
264
- item2: false,
265
- item3: false,
266
- });
267
-
268
- const allChecked = Object.values(items).every(Boolean);
269
- const someChecked = Object.values(items).some(Boolean) && !allChecked;
270
-
271
- const toggleAll = () => {
272
- const newValue = !allChecked;
273
- setItems({
274
- item1: newValue,
275
- item2: newValue,
276
- item3: newValue,
277
- });
278
- };
279
-
280
- return (
281
- <div className="space-y-6">
282
- {/* Select All Example */}
283
- <div>
284
- <h3 className="text-sm font-bold mb-4 text-gray-700 dark:text-white">
285
- Select All (con estado indeterminate)
286
- </h3>
287
- <div className="space-y-2">
288
- <Checkbox
289
- label="Seleccionar Todo"
290
- checked={allChecked}
291
- indeterminate={someChecked}
292
- onChange={toggleAll}
293
- />
294
- <div className="ml-8 space-y-2">
295
- <Checkbox
296
- label="Elemento 1"
297
- checked={items.item1}
298
- onChange={(e) => setItems({ ...items, item1: e.target.checked })}
299
- />
300
- <Checkbox
301
- label="Elemento 2"
302
- checked={items.item2}
303
- onChange={(e) => setItems({ ...items, item2: e.target.checked })}
304
- />
305
- <Checkbox
306
- label="Elemento 3"
307
- checked={items.item3}
308
- onChange={(e) => setItems({ ...items, item3: e.target.checked })}
309
- />
310
- </div>
311
- </div>
312
- </div>
313
-
314
- {/* Simple Group */}
315
- <div>
316
- <h3 className="text-sm font-bold mb-4 text-gray-700 dark:text-white">Grupo Simple</h3>
317
- <div className="space-y-2">
318
- <Checkbox label="JavaScript" />
319
- <Checkbox label="TypeScript" />
320
- <Checkbox label="Python" />
321
- <Checkbox label="Rust" />
322
- </div>
323
- </div>
324
- </div>
325
- );
326
- },
327
- };
328
-
329
- // ============================================
330
- // 5. CASOS DE USO REALES
331
- // ============================================
332
-
333
- /**
334
- * Casos de Uso Reales
335
- *
336
- * Ejemplos prácticos de cómo usar los checkboxes en situaciones reales:
337
- * formularios, configuraciones, listas de tareas, etc.
338
- */
339
- export const UseCases: Story = {
340
- name: 'Casos de Uso Reales',
341
- render: () => {
342
- const [preferences, setPreferences] = useState({
343
- emails: true,
344
- notifications: false,
345
- updates: true,
346
- });
347
-
348
- const [tasks, setTasks] = useState({
349
- task1: true,
350
- task2: false,
351
- task3: false,
352
- });
353
-
354
- return (
355
- <div className="space-y-6">
356
- {/* Formulario de Preferencias */}
357
- <div>
358
- <h3 className="text-sm font-bold mb-4 text-gray-700 dark:text-white">
359
- Formulario de Preferencias
360
- </h3>
361
- <div className="p-6 bg-white dark:bg-dark-bg-primary border border-border-primary dark:border-dark-border-primary rounded-lg max-w-md">
362
- <h4 className="font-bold mb-4 text-base text-content-primary dark:text-dark-content-primary">Preferencias de Email</h4>
363
- <div className="space-y-3">
364
- <Checkbox
365
- label="Correos promocionales"
366
- description="Recibir correos sobre nuevos productos y ofertas"
367
- checked={preferences.emails}
368
- onChange={(e) =>
369
- setPreferences({ ...preferences, emails: e.target.checked })
370
- }
371
- />
372
- <Checkbox
373
- label="Notificaciones push"
374
- description="Recibir notificaciones push en tu dispositivo"
375
- checked={preferences.notifications}
376
- onChange={(e) =>
377
- setPreferences({ ...preferences, notifications: e.target.checked })
378
- }
379
- />
380
- <Checkbox
381
- label="Actualizaciones de productos"
382
- description="Recibir notificaciones sobre actualizaciones y características de productos"
383
- checked={preferences.updates}
384
- onChange={(e) =>
385
- setPreferences({ ...preferences, updates: e.target.checked })
386
- }
387
- />
388
- </div>
389
- </div>
390
- </div>
391
-
392
- {/* Lista de Tareas */}
393
- <div>
394
- <h3 className="text-sm font-bold mb-4 text-gray-700 dark:text-white">Lista de Tareas</h3>
395
- <div className="p-6 bg-white dark:bg-dark-bg-primary border border-border-primary dark:border-dark-border-primary rounded-lg max-w-md">
396
- <h4 className="font-bold mb-4 text-base text-content-primary dark:text-dark-content-primary">Tareas de Hoy</h4>
397
- <div className="space-y-3">
398
- <Checkbox
399
- label="Revisar pull requests"
400
- checked={tasks.task1}
401
- onChange={(e) => setTasks({ ...tasks, task1: e.target.checked })}
402
- />
403
- <Checkbox
404
- label="Actualizar documentación"
405
- checked={tasks.task2}
406
- onChange={(e) => setTasks({ ...tasks, task2: e.target.checked })}
407
- />
408
- <Checkbox
409
- label="Desplegar a producción"
410
- checked={tasks.task3}
411
- onChange={(e) => setTasks({ ...tasks, task3: e.target.checked })}
412
- />
413
- </div>
414
- </div>
415
- </div>
416
-
417
- {/* Terms and Conditions */}
418
- <div>
419
- <h3 className="text-sm font-bold mb-4 text-gray-700 dark:text-white">
420
- Términos y Condiciones
421
- </h3>
422
- <div className="p-6 bg-white dark:bg-dark-bg-primary border border-border-primary dark:border-dark-border-primary rounded-lg max-w-md">
423
- <div className="space-y-3">
424
- <Checkbox
425
- label="Acepto los términos y condiciones"
426
- description="Al marcar esta casilla, aceptas nuestros Términos de Servicio y Política de Privacidad"
427
- />
428
- <Checkbox
429
- label="Quiero recibir comunicaciones de marketing"
430
- description="Opcional: Recibir actualizaciones sobre nuevas características y promociones"
431
- />
432
- </div>
433
- </div>
434
- </div>
435
-
436
- {/* Filtros */}
437
- <div>
438
- <h3 className="text-sm font-bold mb-4 text-gray-700 dark:text-white">Filtros de Búsqueda</h3>
439
- <div className="p-6 bg-white dark:bg-dark-bg-primary border border-border-primary dark:border-dark-border-primary rounded-lg max-w-md">
440
- <h4 className="font-bold mb-4 text-base text-content-primary dark:text-dark-content-primary">Filtrar por Categoría</h4>
441
- <div className="space-y-2">
442
- <Checkbox label="Electrónica" />
443
- <Checkbox label="Ropa" />
444
- <Checkbox label="Libros" />
445
- <Checkbox label="Hogar y Jardín" />
446
- <Checkbox label="Deportes" />
447
- </div>
448
- </div>
449
- </div>
450
- </div>
451
- );
452
- },
453
- };
@@ -1,208 +0,0 @@
1
- import { forwardRef, useEffect, useRef } from 'react';
2
- import type { CheckboxProps } from './Checkbox.types';
3
-
4
- /**
5
- * Checkbox del sistema de diseño Siesa
6
- *
7
- * Componente de checkbox con soporte completo para estados interactivos,
8
- * indeterminate, y dark mode pixel-perfect según especificaciones de Figma.
9
- *
10
- * Mejores prácticas implementadas:
11
- * - Orden de modificadores: {responsive}:{dark}:{state}:{utility}
12
- * - Dark mode con estrategia 'class' (darkMode: 'class')
13
- * - Tokens de color consistentes con la documentación
14
- * - Sombra button-inset para estado checked
15
- * - Type safety con TypeScript estricto
16
- * - Accesibilidad con input nativo y ARIA
17
- *
18
- * @see docs/colors.md - Sistema de colores
19
- * @see docs/typography.md - Sistema tipográfico (Label/Paragraph)
20
- * @see docs/spacing.md - Sistema de espaciado
21
- *
22
- * @example
23
- * ```tsx
24
- * <Checkbox
25
- * label="Show on Events Page"
26
- * description="Make this event visible on your profile"
27
- * checked={true}
28
- * onChange={(e) => console.log(e.target.checked)}
29
- * />
30
- * ```
31
- */
32
- export const Checkbox = forwardRef<HTMLInputElement, CheckboxProps>(
33
- (
34
- {
35
- label,
36
- description,
37
- checked = false,
38
- indeterminate = false,
39
- disabled = false,
40
- className = '',
41
- id,
42
- onChange,
43
- ...props
44
- },
45
- ref
46
- ) => {
47
- const inputRef = useRef<HTMLInputElement>(null);
48
- const combinedRef = (ref as any) || inputRef;
49
-
50
- // Generar ID único si no se proporciona
51
- const checkboxId = id || `checkbox-${Math.random().toString(36).substr(2, 9)}`;
52
-
53
- // Manejar el estado indeterminate
54
- useEffect(() => {
55
- if (combinedRef.current) {
56
- combinedRef.current.indeterminate = indeterminate;
57
- }
58
- }, [indeterminate, combinedRef]);
59
-
60
- // ===== CLASES BASE DEL CHECKBOX =====
61
- const baseCheckboxClasses = `
62
- w-4
63
- h-4
64
- rounded
65
- border
66
- border-border-primary
67
- bg-bg-primary
68
- transition-all
69
- duration-150
70
- flex
71
- items-center
72
- justify-center
73
- dark:bg-dark-bg-primary
74
- dark:border-dark-border-primary
75
- `;
76
-
77
- // ===== CLASES PARA ESTADOS INTERACTIVOS =====
78
- const interactiveClasses = !disabled
79
- ? (checked || indeterminate)
80
- ? `
81
- peer-hover:border-[#50a5f7]
82
- peer-focus:ring-2
83
- peer-focus:ring-primary-custom-400/20
84
- peer-focus:border-primary-custom-600
85
- dark:peer-hover:border-[#50a5f7]
86
- dark:peer-focus:border-dark-border-custom
87
- dark:peer-focus:ring-dark-border-custom/20
88
- `
89
- : `
90
- peer-hover:border-[#b6b6b9]
91
- peer-focus:ring-2
92
- peer-focus:ring-primary-custom-400/20
93
- peer-focus:border-primary-custom-600
94
- dark:peer-hover:border-[#b6b6b9]
95
- dark:peer-focus:border-dark-border-custom
96
- dark:peer-focus:ring-dark-border-custom/20
97
- `
98
- : `
99
- opacity-50
100
- cursor-not-allowed
101
- `;
102
-
103
- // ===== CLASES PARA ESTADO CHECKED/INDETERMINATE =====
104
- // Orden de modificadores: {responsive}:{dark}:{state}:{utility}
105
- const checkedClasses = checked || indeterminate
106
- ? `
107
- !bg-primary-custom-600
108
- !border-primary-custom-500
109
- shadow-button-inset
110
- dark:!bg-dark-bg-inverse
111
- dark:!border-dark-bg-inverse
112
- `
113
- : '';
114
-
115
- // ===== COMBINAR TODAS LAS CLASES DEL CHECKBOX =====
116
- const checkboxClasses = [
117
- baseCheckboxClasses,
118
- interactiveClasses,
119
- checkedClasses,
120
- disabled ? 'cursor-not-allowed' : 'cursor-pointer',
121
- ]
122
- .join(' ')
123
- .replace(/\s+/g, ' ')
124
- .trim();
125
-
126
- return (
127
- <div className={`inline-flex gap-3 items-start ${className}`}>
128
- {/* Checkbox Input Container */}
129
- <div className="flex items-center justify-center h-5 w-4 shrink-0">
130
- {/* Native Input (hidden but accessible) */}
131
- <input
132
- ref={combinedRef}
133
- type="checkbox"
134
- id={checkboxId}
135
- checked={checked}
136
- disabled={disabled}
137
- onChange={onChange}
138
- className="peer sr-only"
139
- {...props}
140
- />
141
-
142
- {/* Custom Checkbox Visual */}
143
- <label htmlFor={checkboxId} className={checkboxClasses}>
144
- {/* Check Icon - Usar primary-inverse-content para consistencia */}
145
- {checked && !indeterminate && (
146
- <svg
147
- className="w-3 h-3 text-primary-inverse-content pointer-events-none"
148
- viewBox="0 0 12 12"
149
- fill="none"
150
- xmlns="http://www.w3.org/2000/svg"
151
- >
152
- <path
153
- d="M10 3L4.5 8.5L2 6"
154
- stroke="currentColor"
155
- strokeWidth="2"
156
- strokeLinecap="round"
157
- strokeLinejoin="round"
158
- />
159
- </svg>
160
- )}
161
-
162
- {/* Indeterminate Icon (minus) - Usar primary-inverse-content */}
163
- {indeterminate && (
164
- <svg
165
- className="w-3 h-3 text-primary-inverse-content pointer-events-none"
166
- viewBox="0 0 12 12"
167
- fill="none"
168
- xmlns="http://www.w3.org/2000/svg"
169
- >
170
- <path
171
- d="M2 6H10"
172
- stroke="currentColor"
173
- strokeWidth="2"
174
- strokeLinecap="round"
175
- />
176
- </svg>
177
- )}
178
- </label>
179
- </div>
180
-
181
- {/* Label and Description */}
182
- {(label || description) && (
183
- <label
184
- htmlFor={checkboxId}
185
- className={`flex-1 flex flex-col gap-1 text-sm leading-5 ${
186
- disabled ? 'cursor-not-allowed opacity-50' : 'cursor-pointer'
187
- }`}
188
- >
189
- {/* Label - Label/Small (14px, Bold) */}
190
- {label && (
191
- <span className="font-bold text-content-primary dark:text-dark-content-primary">
192
- {label}
193
- </span>
194
- )}
195
- {/* Description - Paragraph/Small (14px, Regular) */}
196
- {description && (
197
- <span className="font-normal text-content-secondary dark:text-content-secondary">
198
- {description}
199
- </span>
200
- )}
201
- </label>
202
- )}
203
- </div>
204
- );
205
- }
206
- );
207
-
208
- Checkbox.displayName = 'Checkbox';