siesa-ui-kit 1.0.2 → 1.0.4
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.
- package/README.md +115 -115
- package/bin/install.cjs +502 -502
- package/bin/prepare-publish.cjs +28 -28
- package/bin/restore-folders.cjs +28 -28
- package/claude/agents/siesa-ui-kit-specialist.md +2445 -0
- package/claude/prompts/component-template.md +121 -0
- package/claude/prompts/siesa-ui-kit.md +28 -0
- package/claude/settings.local.json +67 -2
- package/dist/components/Button/icons.d.ts +6 -5
- package/dist/components/Button/icons.d.ts.map +1 -1
- package/dist/components/DropdownItemCollapsible/DropdownItemCollapsible.d.ts.map +1 -1
- package/dist/components/DropdownItemCollapsible/DropdownItemCollapsible.types.d.ts +21 -0
- package/dist/components/DropdownItemCollapsible/DropdownItemCollapsible.types.d.ts.map +1 -1
- package/dist/components/NavigationRailCommercial/NavigationRailCommercial.d.ts +122 -0
- package/dist/components/NavigationRailCommercial/NavigationRailCommercial.d.ts.map +1 -0
- package/dist/components/NavigationRailCommercial/NavigationRailCommercial.types.d.ts +139 -0
- package/dist/components/NavigationRailCommercial/NavigationRailCommercial.types.d.ts.map +1 -0
- package/dist/components/NavigationRailCommercial/icons.d.ts +33 -0
- package/dist/components/NavigationRailCommercial/icons.d.ts.map +1 -0
- package/dist/components/NavigationRailCommercial/index.d.ts +4 -0
- package/dist/components/NavigationRailCommercial/index.d.ts.map +1 -0
- package/dist/components/NavigationRailItem/NavigationRailItem.d.ts.map +1 -1
- package/dist/components/NavigationRailItem/NavigationRailItem.types.d.ts +7 -0
- package/dist/components/NavigationRailItem/NavigationRailItem.types.d.ts.map +1 -1
- package/dist/components/NavigationRailTypes/NavigationRailTypes.d.ts.map +1 -1
- package/dist/components/NavigationRailTypes/NavigationRailTypes.types.d.ts +41 -0
- package/dist/components/NavigationRailTypes/NavigationRailTypes.types.d.ts.map +1 -1
- package/dist/components/NavigationRailTypes/icons.d.ts +15 -29
- package/dist/components/NavigationRailTypes/icons.d.ts.map +1 -1
- package/dist/components/Select/Select.d.ts.map +1 -1
- package/dist/components/Select/icons.d.ts +6 -2
- package/dist/components/Select/icons.d.ts.map +1 -1
- package/dist/index.d.ts +32 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/siesa-ui-kit.cjs +404 -190
- package/dist/siesa-ui-kit.cjs.map +1 -1
- package/dist/siesa-ui-kit.mjs +6590 -1506
- package/dist/siesa-ui-kit.mjs.map +1 -1
- package/dist/views/LayoutCommercial/LayoutCommercial.d.ts +48 -0
- package/dist/views/LayoutCommercial/LayoutCommercial.d.ts.map +1 -0
- package/dist/views/LayoutCommercial/LayoutCommercial.types.d.ts +49 -0
- package/dist/views/LayoutCommercial/LayoutCommercial.types.d.ts.map +1 -0
- package/dist/views/LayoutCommercial/index.d.ts +3 -0
- package/dist/views/LayoutCommercial/index.d.ts.map +1 -0
- package/docs/icons.md +12 -31
- package/package.json +111 -110
- package/src/components/Avatar/Avatar.stories.tsx +494 -494
- package/src/components/Button/Button.stories.tsx +950 -950
- package/src/components/Button/Button.tsx +337 -337
- package/src/components/Button/Button.types.ts +180 -180
- package/src/components/Button/icons.tsx +23 -62
- package/src/components/DescriptionList/DescriptionList.stories.tsx +250 -250
- package/src/components/Divider/Divider.stories.tsx +263 -263
- package/src/components/DropdownItemCollapsible/DropdownItemCollapsible.stories.tsx +317 -317
- package/src/components/DropdownItemCollapsible/DropdownItemCollapsible.tsx +307 -287
- package/src/components/DropdownItemCollapsible/DropdownItemCollapsible.types.ts +136 -111
- package/src/components/DropdownItemCollapsible/README.md +264 -264
- package/src/components/DropdownItemCollapsible/icons.tsx +57 -57
- package/src/components/DropdownItemCollapsible/index.ts +12 -12
- package/src/components/DropdownItemHeading/DropdownItemHeading.stories.tsx +386 -386
- package/src/components/DropdownItemHeading/DropdownItemHeading.tsx +216 -216
- package/src/components/DropdownItemHeading/DropdownItemHeading.types.ts +93 -93
- package/src/components/DropdownItemHeading/README.md +573 -573
- package/src/components/DropdownItemHeading/icons.tsx +125 -125
- package/src/components/DropdownItemHeading/index.ts +3 -3
- package/src/components/Input/Input.stories.tsx +583 -583
- package/src/components/LoginView/LoginView.stories.tsx +148 -148
- package/src/components/LoginView/LoginView.tsx +426 -426
- package/src/components/LoginView/LoginView.types.ts +52 -52
- package/src/components/LoginView/README.md +396 -396
- package/src/components/LoginView/icons.tsx +85 -85
- package/src/components/LoginView/index.ts +3 -3
- package/src/components/Navbar/Navbar.stories.tsx +810 -810
- package/src/components/Navbar/Navbar.tsx +755 -755
- package/src/components/Navbar/Navbar.types.ts +219 -219
- package/src/components/Navbar/README.md +279 -279
- package/src/components/Navbar/index.ts +8 -8
- package/src/components/NavigationRailCommercial/NavigationRailCommercial.stories.tsx +464 -0
- package/src/components/NavigationRailCommercial/NavigationRailCommercial.tsx +301 -0
- package/src/components/NavigationRailCommercial/NavigationRailCommercial.types.ts +162 -0
- package/src/components/NavigationRailCommercial/README.md +251 -0
- package/src/components/NavigationRailCommercial/icons.tsx +54 -0
- package/src/components/NavigationRailCommercial/index.ts +6 -0
- package/src/components/NavigationRailItem/NavigationRailItem.stories.tsx +667 -667
- package/src/components/NavigationRailItem/NavigationRailItem.tsx +314 -313
- package/src/components/NavigationRailItem/NavigationRailItem.types.ts +175 -167
- package/src/components/NavigationRailItem/README.md +476 -476
- package/src/components/NavigationRailItem/index.ts +2 -2
- package/src/components/NavigationRailPanel/NavigationRailPanel.stories.tsx +462 -462
- package/src/components/NavigationRailPanel/NavigationRailPanel.tsx +332 -332
- package/src/components/NavigationRailPanel/NavigationRailPanel.types.ts +178 -178
- package/src/components/NavigationRailPanel/README.md +461 -461
- package/src/components/NavigationRailPanel/index.ts +6 -6
- package/src/components/NavigationRailTypes/NavigationRailTypes.stories.tsx +682 -528
- package/src/components/NavigationRailTypes/NavigationRailTypes.tsx +363 -378
- package/src/components/NavigationRailTypes/NavigationRailTypes.types.ts +178 -130
- package/src/components/NavigationRailTypes/README.md +573 -573
- package/src/components/NavigationRailTypes/icons.tsx +76 -141
- package/src/components/NavigationRailTypes/index.ts +7 -7
- package/src/components/Notification/Notification.stories.tsx +513 -513
- package/src/components/Notification/Notification.tsx +145 -145
- package/src/components/Notification/Notification.types.ts +142 -142
- package/src/components/Notification/README.md +409 -409
- package/src/components/POSConvention/POSConvention.stories.tsx +235 -235
- package/src/components/POSConvention/POSConvention.tsx +129 -129
- package/src/components/POSConvention/POSConvention.types.ts +38 -38
- package/src/components/POSConvention/README.md +123 -123
- package/src/components/POSConvention/icons.tsx +45 -45
- package/src/components/POSConvention/index.ts +3 -3
- package/src/components/POSLocationButton/POSLocationButton.stories.tsx +531 -531
- package/src/components/POSLocationButton/POSLocationButton.tsx +247 -247
- package/src/components/POSLocationButton/POSLocationButton.types.ts +87 -87
- package/src/components/POSLocationButton/README.md +253 -253
- package/src/components/POSLocationButton/icons.tsx +120 -120
- package/src/components/POSLocationButton/index.ts +14 -14
- package/src/components/POSNumberButton/POSNumberButton.stories.tsx +415 -415
- package/src/components/POSNumberButton/POSNumberButton.tsx +179 -179
- package/src/components/POSNumberButton/POSNumberButton.types.ts +51 -51
- package/src/components/POSNumberButton/README.md +321 -321
- package/src/components/POSNumberButton/index.ts +3 -3
- package/src/components/POSProductButton/POSProductButton.stories.tsx +318 -318
- package/src/components/POSProductCard/POSProductCard.stories.tsx +642 -642
- package/src/components/POSProductCard/POSProductCard.tsx +208 -208
- package/src/components/POSProductCard/POSProductCard.types.ts +76 -76
- package/src/components/POSProductCard/README.md +179 -179
- package/src/components/POSProductCard/icons.tsx +26 -26
- package/src/components/POSProductCard/index.ts +2 -2
- package/src/components/POSProductSidebarItems/POSProductSidebarItems.stories.tsx +753 -753
- package/src/components/POSProductSidebarItems/POSProductSidebarItems.tsx +332 -332
- package/src/components/POSProductSidebarItems/POSProductSidebarItems.types.ts +119 -119
- package/src/components/POSProductSidebarItems/README.md +198 -198
- package/src/components/POSProductSidebarItems/icons.tsx +21 -21
- package/src/components/POSProductSidebarItems/index.ts +3 -3
- package/src/components/POSTable/POSTable.stories.tsx +737 -737
- package/src/components/POSTable/POSTable.tsx +401 -401
- package/src/components/POSTable/README.md +286 -286
- package/src/components/Quantity/Quantity.stories.tsx +457 -457
- package/src/components/Radio/Radio.stories.tsx +523 -523
- package/src/components/Radio/Radio.tsx +1 -1
- package/src/components/Select/Select.stories.tsx +32 -0
- package/src/components/Select/Select.tsx +457 -454
- package/src/components/Select/icons.tsx +16 -41
- package/src/components/SignUpView/SignUpView.stories.tsx +129 -129
- package/src/components/SignUpView/SignUpView.tsx +503 -503
- package/src/components/SignUpView/SignUpView.types.ts +58 -58
- package/src/components/SignUpView/icons.tsx +71 -71
- package/src/components/SignUpView/index.ts +3 -3
- package/src/components/Switch/README.md +112 -112
- package/src/components/Switch/Switch.stories.tsx +550 -550
- package/src/components/Switch/Switch.tsx +246 -246
- package/src/components/Switch/Switch.types.ts +67 -67
- package/src/components/Table/Table.stories.tsx +805 -805
- package/src/components/Tabs/README.md +201 -201
- package/src/components/Tabs/Tabs.stories.tsx +580 -580
- package/src/components/Tabs/Tabs.tsx +356 -356
- package/src/components/Tabs/Tabs.types.ts +127 -127
- package/src/components/Tabs/icons.tsx +129 -129
- package/src/components/Tabs/index.ts +11 -11
- package/src/components/Textarea/Textarea.stories.tsx +535 -535
- package/src/index.ts +133 -102
- package/src/views/LayoutCommercial/LayoutCommercial.stories.tsx +374 -0
- package/src/views/LayoutCommercial/LayoutCommercial.tsx +125 -0
- package/src/views/LayoutCommercial/LayoutCommercial.types.ts +54 -0
- package/src/views/LayoutCommercial/README.md +286 -0
- package/src/views/LayoutCommercial/index.ts +2 -0
- package/src/views/ListView/ListView.stories.tsx +329 -329
- package/src/views/ListView/ListView.tsx +570 -570
- package/src/views/ListView/ListView.types.ts +211 -211
- package/src/views/ListView/icons.tsx +282 -282
- package/src/views/ListView/index.ts +11 -11
- package/src/views/LoginView/LoginView.tsx +426 -426
- package/src/views/ProductsView/ProductsView.stories.tsx +344 -344
- package/src/views/ProductsView/ProductsView.tsx +480 -480
- package/src/views/ProductsView/ProductsView.types.ts +238 -238
- package/src/views/ProductsView/README.md +312 -312
- package/src/views/ProductsView/icons.tsx +38 -38
- package/src/views/ProductsView/index.ts +8 -8
- package/src/views/RecoverPasswordView/RecoverPasswordView.tsx +376 -376
- package/src/views/SignUpView/SignUpView.tsx +503 -503
- package/src/views/TableLayoutView/README.md +268 -268
- package/src/views/TableLayoutView/TableLayoutView.stories.tsx +235 -235
- package/src/views/TableLayoutView/TableLayoutView.tsx +461 -461
- package/src/views/TableLayoutView/TableLayoutView.types.ts +209 -209
- package/src/views/TableLayoutView/icons.tsx +113 -113
- package/src/views/TableLayoutView/index.ts +6 -6
- package/storybook/main.ts +19 -19
- package/storybook/preview.tsx +84 -84
- package/storybook/vitest.setup.ts +6 -6
- package/tailwind.config.js +128 -128
|
@@ -1,287 +1,307 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
2
|
-
import type {
|
|
3
|
-
DropdownItemCollapsibleProps,
|
|
4
|
-
DropdownItemCollapsibleChildProps,
|
|
5
|
-
} from './DropdownItemCollapsible.types';
|
|
6
|
-
import { ChevronDownIcon } from './icons';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* -
|
|
17
|
-
* -
|
|
18
|
-
* -
|
|
19
|
-
* -
|
|
20
|
-
* -
|
|
21
|
-
* -
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
* - `
|
|
26
|
-
* - `
|
|
27
|
-
* - `
|
|
28
|
-
* - `
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
* -
|
|
33
|
-
* -
|
|
34
|
-
* - Gap
|
|
35
|
-
* -
|
|
36
|
-
* -
|
|
37
|
-
* -
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
* -
|
|
42
|
-
* -
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
* - Header
|
|
47
|
-
* - Header
|
|
48
|
-
* - Header
|
|
49
|
-
* -
|
|
50
|
-
* - Item
|
|
51
|
-
* -
|
|
52
|
-
* -
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
* - Header
|
|
57
|
-
* - Header
|
|
58
|
-
* - Header
|
|
59
|
-
* -
|
|
60
|
-
* -
|
|
61
|
-
* -
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
* @see docs/
|
|
71
|
-
* @see docs/
|
|
72
|
-
* @see
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
* { label: "
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
*
|
|
90
|
-
*
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
*
|
|
100
|
-
*
|
|
101
|
-
*
|
|
102
|
-
*
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
//
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
//
|
|
172
|
-
!disabled && '
|
|
173
|
-
!disabled && '
|
|
174
|
-
!disabled && '
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
!disabled && '
|
|
179
|
-
!disabled && '
|
|
180
|
-
!disabled && '
|
|
181
|
-
!disabled && '
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
disabled && '
|
|
186
|
-
disabled && '
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
{/*
|
|
201
|
-
|
|
202
|
-
<
|
|
203
|
-
{
|
|
204
|
-
</
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
{/*
|
|
208
|
-
|
|
209
|
-
<
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
>
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
child.
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
.
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import type {
|
|
3
|
+
DropdownItemCollapsibleProps,
|
|
4
|
+
DropdownItemCollapsibleChildProps,
|
|
5
|
+
} from './DropdownItemCollapsible.types';
|
|
6
|
+
import { ChevronDownIcon } from './icons';
|
|
7
|
+
import { Badge } from '../Badge/Badge';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Componente DropdownItemCollapsible del sistema de diseño Siesa
|
|
11
|
+
*
|
|
12
|
+
* Item colapsable para uso dentro de Dropdowns que permite agrupar
|
|
13
|
+
* items relacionados en secciones expandibles.
|
|
14
|
+
*
|
|
15
|
+
* **Características:**
|
|
16
|
+
* - Soporte completo para expandir/colapsar
|
|
17
|
+
* - Iconos personalizables en header y children
|
|
18
|
+
* - Items anidados indentados automáticamente
|
|
19
|
+
* - Dark mode completo con inversión de colores
|
|
20
|
+
* - Estados: default, hover, active, disabled
|
|
21
|
+
* - Focus rings adaptativos
|
|
22
|
+
* - Animación suave de rotación del chevron
|
|
23
|
+
*
|
|
24
|
+
* **Estados visuales:**
|
|
25
|
+
* - `collapsed`: Muestra solo el header con chevron apuntando down
|
|
26
|
+
* - `expanded`: Muestra header y lista de items anidados
|
|
27
|
+
* - `disabled`: Opacidad 50%, sin interacción
|
|
28
|
+
* - `hover`: Fondo de hover sutil, color primario del icono
|
|
29
|
+
* - `active`: Item anidado seleccionado con fondo custom-primary
|
|
30
|
+
*
|
|
31
|
+
* **Espaciado según Figma:**
|
|
32
|
+
* - Header padding: px-4 py-2 (16px horizontal, 8px vertical)
|
|
33
|
+
* - Item anidado padding: pl-6 pr-4 py-2 (24px left, 16px right, 8px vertical)
|
|
34
|
+
* - Gap entre elementos: gap-3 (12px)
|
|
35
|
+
* - Gap interno (icon + text): gap-3 (12px)
|
|
36
|
+
* - Indent entre niveles: 8px adicional por nivel
|
|
37
|
+
* - Divisor: borde top de 1px con spacing-0.5 (2px) arriba
|
|
38
|
+
* - Sección heading: pt-3 pb-1 px-0 (12px top, 4px bottom, sin horizontal)
|
|
39
|
+
*
|
|
40
|
+
* **Tipografía:**
|
|
41
|
+
* - Header: Paragraph/Small (14px, Regular, line-height 20px) - text-content-primary
|
|
42
|
+
* - Items anidados: Paragraph/Small (14px, Regular, line-height 20px) - text-content-primary
|
|
43
|
+
* - Heading: Paragraph/Tiny (12px, Regular, line-height 16px) - text-content-tertiary
|
|
44
|
+
*
|
|
45
|
+
* **Colores (Light Mode):**
|
|
46
|
+
* - Header text: content-primary (#18181b)
|
|
47
|
+
* - Header icon: content-secondary (#a1a1aa)
|
|
48
|
+
* - Header hover: bg-background-custom-primary (#dbeefe)
|
|
49
|
+
* - Header text hover: content-custom-primary (#0e79fd)
|
|
50
|
+
* - Item text: content-primary (#18181b)
|
|
51
|
+
* - Item hover: bg-transparent (sin fondo)
|
|
52
|
+
* - Divider: border-border-primary (#e4e4e7)
|
|
53
|
+
* - Heading text: content-tertiary (#71717a)
|
|
54
|
+
*
|
|
55
|
+
* **Colores (Dark Mode):**
|
|
56
|
+
* - Header text: content-primary/dark (#fafafa)
|
|
57
|
+
* - Header icon: content-secondary/dark (#a1a1aa)
|
|
58
|
+
* - Header hover: bg-background-custom-primary/dark (#0e5ab0)
|
|
59
|
+
* - Header text hover: content-custom-primary/dark (#bfe2fe)
|
|
60
|
+
* - Item text: content-primary/dark (#fafafa)
|
|
61
|
+
* - Divider: border-border-primary/dark (#3f3f46)
|
|
62
|
+
* - Heading text: content-tertiary/dark (#a1a1aa)
|
|
63
|
+
*
|
|
64
|
+
* **Border radius:**
|
|
65
|
+
* - Todos los items: rounded-lg (8px)
|
|
66
|
+
*
|
|
67
|
+
* **Sombras:**
|
|
68
|
+
* - Ninguna (usado dentro de dropdowns)
|
|
69
|
+
*
|
|
70
|
+
* @see docs/colors.md - Sistema de colores
|
|
71
|
+
* @see docs/typography.md - Sistema tipográfico
|
|
72
|
+
* @see docs/spacing.md - Sistema de espaciado
|
|
73
|
+
* @see https://www.figma.com/design/5XNqf2YTxvwemxwo1LMQ6j/Siesa-UI-Kit?node-id=6135-34374
|
|
74
|
+
*
|
|
75
|
+
* @example
|
|
76
|
+
* ```tsx
|
|
77
|
+
* // Item colapsable simple
|
|
78
|
+
* <DropdownItemCollapsible
|
|
79
|
+
* label="Users"
|
|
80
|
+
* icon={<UserIcon />}
|
|
81
|
+
* children={[
|
|
82
|
+
* { label: "Active Users", icon: <CheckIcon /> },
|
|
83
|
+
* { label: "Inactive Users", icon: <CloseIcon /> },
|
|
84
|
+
* ]}
|
|
85
|
+
* />
|
|
86
|
+
*
|
|
87
|
+
* // Con encabezado de sección
|
|
88
|
+
* <DropdownItemCollapsible
|
|
89
|
+
* label="Customers"
|
|
90
|
+
* icon={<BuildingIcon />}
|
|
91
|
+
* showHeading={true}
|
|
92
|
+
* headingLabel="SECTION 1"
|
|
93
|
+
* children={[...]}
|
|
94
|
+
* />
|
|
95
|
+
*
|
|
96
|
+
* // Item no colapsable (actúa como botón normal)
|
|
97
|
+
* <DropdownItemCollapsible
|
|
98
|
+
* label="Single Item"
|
|
99
|
+
* icon={<StarIcon />}
|
|
100
|
+
* isCollapsible={false}
|
|
101
|
+
* onClick={() => console.log('clicked')}
|
|
102
|
+
* />
|
|
103
|
+
* ```
|
|
104
|
+
*/
|
|
105
|
+
export const DropdownItemCollapsible: React.FC<DropdownItemCollapsibleProps> = ({
|
|
106
|
+
label,
|
|
107
|
+
icon,
|
|
108
|
+
children = [],
|
|
109
|
+
defaultOpen = false,
|
|
110
|
+
disabled = false,
|
|
111
|
+
onOpenChange,
|
|
112
|
+
onClick,
|
|
113
|
+
isCollapsible = children.length > 0,
|
|
114
|
+
showHeading = false,
|
|
115
|
+
headingLabel,
|
|
116
|
+
showDivider = true,
|
|
117
|
+
selected = false,
|
|
118
|
+
badge = false,
|
|
119
|
+
badgeCount,
|
|
120
|
+
badgeColor = 'red',
|
|
121
|
+
className = '',
|
|
122
|
+
}) => {
|
|
123
|
+
const [isOpen, setIsOpen] = useState(defaultOpen);
|
|
124
|
+
|
|
125
|
+
const handleToggle = () => {
|
|
126
|
+
if (disabled || !isCollapsible) return;
|
|
127
|
+
|
|
128
|
+
const newOpen = !isOpen;
|
|
129
|
+
setIsOpen(newOpen);
|
|
130
|
+
onOpenChange?.(newOpen);
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
const handleHeaderClick = (e: React.MouseEvent<HTMLButtonElement>) => {
|
|
134
|
+
if (disabled) return;
|
|
135
|
+
|
|
136
|
+
if (isCollapsible) {
|
|
137
|
+
handleToggle();
|
|
138
|
+
} else {
|
|
139
|
+
onClick?.(e);
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
const handleChildClick = (child: DropdownItemCollapsibleChildProps) => (
|
|
144
|
+
e: React.MouseEvent<HTMLDivElement>,
|
|
145
|
+
) => {
|
|
146
|
+
if (child.disabled) return;
|
|
147
|
+
child.onClick?.(e);
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
return (
|
|
151
|
+
<div className={`flex flex-col gap-0.5 w-full ${className}`}>
|
|
152
|
+
{/* Section Heading */}
|
|
153
|
+
{showHeading && headingLabel && (
|
|
154
|
+
<div className="flex flex-col gap-0 items-start pb-1 pt-3 px-0 w-full">
|
|
155
|
+
<p className="font-['Inter:Regular',sans-serif] font-normal leading-4 not-italic text-xs text-content-tertiary dark:text-content-tertiary w-full">
|
|
156
|
+
{headingLabel}
|
|
157
|
+
</p>
|
|
158
|
+
</div>
|
|
159
|
+
)}
|
|
160
|
+
|
|
161
|
+
{/* Header Button */}
|
|
162
|
+
<button
|
|
163
|
+
onClick={handleHeaderClick}
|
|
164
|
+
disabled={disabled}
|
|
165
|
+
className={[
|
|
166
|
+
// Base
|
|
167
|
+
'flex items-center gap-3 px-4 py-2 w-full',
|
|
168
|
+
'rounded-lg cursor-pointer',
|
|
169
|
+
'transition-all duration-150',
|
|
170
|
+
|
|
171
|
+
// Colores y estados (Light Mode)
|
|
172
|
+
selected && !disabled && 'bg-primary-custom-100 text-primary-custom-600',
|
|
173
|
+
!selected && !disabled && 'text-content-primary',
|
|
174
|
+
!disabled && 'hover:bg-primary-custom-100',
|
|
175
|
+
!disabled && 'hover:text-primary-custom-600',
|
|
176
|
+
|
|
177
|
+
// Dark Mode
|
|
178
|
+
selected && !disabled && 'dark:bg-dark-bg-custom dark:text-dark-content-custom',
|
|
179
|
+
!selected && !disabled && 'dark:text-content-primary',
|
|
180
|
+
!disabled && 'dark:hover:bg-dark-bg-custom',
|
|
181
|
+
!disabled && 'dark:hover:text-dark-content-custom',
|
|
182
|
+
|
|
183
|
+
// Focus ring
|
|
184
|
+
!disabled && 'focus:outline-none',
|
|
185
|
+
!disabled && 'focus:ring-2',
|
|
186
|
+
!disabled && 'focus:ring-offset-2',
|
|
187
|
+
!disabled && 'focus:ring-primary-custom-400',
|
|
188
|
+
!disabled && 'focus:ring-offset-bg-primary',
|
|
189
|
+
!disabled && 'dark:focus:ring-offset-dark-bg-primary',
|
|
190
|
+
|
|
191
|
+
// Disabled
|
|
192
|
+
disabled && 'opacity-50',
|
|
193
|
+
disabled && 'cursor-not-allowed',
|
|
194
|
+
]
|
|
195
|
+
.filter(Boolean)
|
|
196
|
+
.join(' ')}
|
|
197
|
+
aria-expanded={isOpen && isCollapsible}
|
|
198
|
+
aria-disabled={disabled}
|
|
199
|
+
>
|
|
200
|
+
{/* Icon Wrapper */}
|
|
201
|
+
{icon && (
|
|
202
|
+
<div className="flex items-center justify-center w-4 h-4 shrink-0 text-content-secondary dark:text-content-secondary">
|
|
203
|
+
{icon}
|
|
204
|
+
</div>
|
|
205
|
+
)}
|
|
206
|
+
|
|
207
|
+
{/* Content Wrapper */}
|
|
208
|
+
<div className="flex flex-1 flex-col items-start justify-center gap-0.5">
|
|
209
|
+
<p className="font-['Inter:Regular',sans-serif] font-normal leading-5 not-italic text-sm text-left">
|
|
210
|
+
{label}
|
|
211
|
+
</p>
|
|
212
|
+
</div>
|
|
213
|
+
|
|
214
|
+
{/* Badge */}
|
|
215
|
+
{(badge || badgeCount) && (
|
|
216
|
+
<div className="flex items-center justify-center shrink-0">
|
|
217
|
+
{badgeCount ? (
|
|
218
|
+
<div className="flex items-center justify-center px-1.5 py-0.5 rounded-full bg-red-500 dark:bg-red-600 text-white text-xs font-bold min-w-6 h-6">
|
|
219
|
+
{badgeCount > 99 ? '99+' : badgeCount}
|
|
220
|
+
</div>
|
|
221
|
+
) : (
|
|
222
|
+
<div className="w-2 h-2 rounded-full bg-red-500 dark:bg-red-600 shrink-0" />
|
|
223
|
+
)}
|
|
224
|
+
</div>
|
|
225
|
+
)}
|
|
226
|
+
|
|
227
|
+
{/* Chevron (solo visible si es colapsable) */}
|
|
228
|
+
{isCollapsible && (
|
|
229
|
+
<div
|
|
230
|
+
className={[
|
|
231
|
+
'flex items-center justify-center w-4 h-4 shrink-0',
|
|
232
|
+
'text-content-secondary dark:text-content-secondary',
|
|
233
|
+
'transition-transform duration-200',
|
|
234
|
+
isOpen ? 'rotate-180' : 'rotate-0',
|
|
235
|
+
].join(' ')}
|
|
236
|
+
>
|
|
237
|
+
<ChevronDownIcon className="w-4 h-4" />
|
|
238
|
+
</div>
|
|
239
|
+
)}
|
|
240
|
+
</button>
|
|
241
|
+
|
|
242
|
+
{/* Divider */}
|
|
243
|
+
{showDivider && <div className="w-full h-px bg-border-primary dark:bg-dark-border-primary" />}
|
|
244
|
+
|
|
245
|
+
{/* Children Container (expanded) */}
|
|
246
|
+
{isOpen && isCollapsible && children.length > 0 && (
|
|
247
|
+
<div className="flex flex-col gap-0.5 w-full py-2 px-0">
|
|
248
|
+
{children.map((child, index) => (
|
|
249
|
+
<div
|
|
250
|
+
key={index}
|
|
251
|
+
onClick={handleChildClick(child)}
|
|
252
|
+
className={[
|
|
253
|
+
// Base
|
|
254
|
+
'flex gap-3 items-center pl-6 pr-4 py-2 w-full',
|
|
255
|
+
'rounded-lg cursor-pointer',
|
|
256
|
+
'transition-all duration-150',
|
|
257
|
+
|
|
258
|
+
// Colores y estados (Light Mode)
|
|
259
|
+
!child.disabled && 'text-content-primary',
|
|
260
|
+
!child.disabled && 'hover:bg-primary-custom-100',
|
|
261
|
+
!child.disabled && 'hover:text-primary-custom-600',
|
|
262
|
+
|
|
263
|
+
// Dark Mode
|
|
264
|
+
!child.disabled && 'dark:text-content-primary',
|
|
265
|
+
!child.disabled && 'dark:hover:bg-dark-bg-custom',
|
|
266
|
+
!child.disabled && 'dark:hover:text-dark-content-custom',
|
|
267
|
+
|
|
268
|
+
// Focus ring
|
|
269
|
+
!child.disabled && 'focus:outline-none',
|
|
270
|
+
!child.disabled && 'focus:ring-2',
|
|
271
|
+
!child.disabled && 'focus:ring-offset-2',
|
|
272
|
+
!child.disabled && 'focus:ring-primary-custom-400',
|
|
273
|
+
!child.disabled && 'focus:ring-offset-bg-primary',
|
|
274
|
+
!child.disabled && 'dark:focus:ring-offset-dark-bg-primary',
|
|
275
|
+
|
|
276
|
+
// Disabled
|
|
277
|
+
child.disabled && 'opacity-50',
|
|
278
|
+
child.disabled && 'cursor-not-allowed',
|
|
279
|
+
|
|
280
|
+
// Custom classes
|
|
281
|
+
child.className,
|
|
282
|
+
]
|
|
283
|
+
.filter(Boolean)
|
|
284
|
+
.join(' ')}
|
|
285
|
+
>
|
|
286
|
+
{/* Child Icon Wrapper */}
|
|
287
|
+
{child.icon && (
|
|
288
|
+
<div className="flex items-center justify-center w-4 h-4 shrink-0 text-content-secondary dark:text-content-secondary">
|
|
289
|
+
{child.icon}
|
|
290
|
+
</div>
|
|
291
|
+
)}
|
|
292
|
+
|
|
293
|
+
{/* Child Content Wrapper */}
|
|
294
|
+
<div className="flex flex-1 flex-col items-start justify-center gap-0.5">
|
|
295
|
+
<p className="font-['Inter:Regular',sans-serif] font-normal leading-5 not-italic text-sm text-left">
|
|
296
|
+
{child.label}
|
|
297
|
+
</p>
|
|
298
|
+
</div>
|
|
299
|
+
</div>
|
|
300
|
+
))}
|
|
301
|
+
</div>
|
|
302
|
+
)}
|
|
303
|
+
</div>
|
|
304
|
+
);
|
|
305
|
+
};
|
|
306
|
+
|
|
307
|
+
export default DropdownItemCollapsible;
|