@adamosuiteservices/ui 1.2.4 → 1.3.5
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 +4 -0
- package/dist/accordion-rounded.cjs +1 -1
- package/dist/accordion-rounded.js +1 -1
- package/dist/accordion.cjs +1 -1
- package/dist/accordion.js +1 -1
- package/dist/avatar.cjs +1 -1
- package/dist/avatar.js +1 -1
- package/dist/badge.cjs +1 -1
- package/dist/badge.js +1 -1
- package/dist/breadcrumb.cjs +1 -0
- package/dist/breadcrumb.js +105 -0
- package/dist/{button-C1n6snOY.js → button-2GdKenQI.js} +1 -1
- package/dist/{button-BV-_FVKZ.cjs → button-DEQVHMrX.cjs} +1 -1
- package/dist/button-group.cjs +1 -1
- package/dist/button-group.js +2 -2
- package/dist/button.cjs +1 -1
- package/dist/button.js +1 -1
- package/dist/calendar.cjs +1 -1
- package/dist/calendar.js +1 -1
- package/dist/{checkbox-BrmXPKTn.js → checkbox-Dr487kAg.js} +3 -3
- package/dist/{checkbox-Lq-HvSgc.cjs → checkbox-YWAnswaW.cjs} +1 -1
- package/dist/checkbox.cjs +1 -1
- package/dist/checkbox.js +1 -1
- package/dist/collapsible.cjs +1 -1
- package/dist/collapsible.js +1 -1
- package/dist/combobox.cjs +1 -1
- package/dist/combobox.js +6 -6
- package/dist/components/ui/breadcrumb/breadcrumb.d.ts +11 -0
- package/dist/components/ui/breadcrumb/breadcrumb.stories.d.ts +26 -0
- package/dist/components/ui/breadcrumb/index.d.ts +1 -0
- package/dist/components/ui/dialog/dialog.d.ts +2 -1
- package/dist/context-menu.cjs +1 -1
- package/dist/context-menu.js +2 -2
- package/dist/custom-layered-styles.css +1 -1
- package/dist/dialog.cjs +1 -1
- package/dist/dialog.js +33 -19
- package/dist/dropdown-menu.cjs +1 -1
- package/dist/dropdown-menu.js +3 -3
- package/dist/ellipsis-CryjZKZn.js +15 -0
- package/dist/ellipsis-Ct9VTDOG.cjs +6 -0
- package/dist/field.cjs +1 -1
- package/dist/field.js +2 -2
- package/dist/hover-card.cjs +1 -1
- package/dist/hover-card.js +6 -6
- package/dist/{index-CAOY367Y.js → index-B0M7VOwp.js} +2 -2
- package/dist/{index-B-ZRqW0J.js → index-BBoIAjAs.js} +3 -3
- package/dist/{index-gO_QEiaK.cjs → index-BDs8lUfq.cjs} +1 -1
- package/dist/index-BFyr34mw.cjs +5 -0
- package/dist/index-BMWt1NBG.js +79 -0
- package/dist/{index-yR-v1A4G.js → index-BX9hz-JD.js} +1 -1
- package/dist/{index-BGiGvaq8.cjs → index-BcGMAmWE.cjs} +1 -1
- package/dist/{index-IKJMQref.cjs → index-Bd0gQB0k.cjs} +1 -1
- package/dist/{index-VIUqZjyP.cjs → index-BeWgla7c.cjs} +1 -1
- package/dist/{index-EUea2gfp.js → index-BpWB3aFK.js} +1 -1
- package/dist/index-BvLQnI56.js +59 -0
- package/dist/{index-CwUFT-GQ.js → index-C0YiLSjW.js} +4 -4
- package/dist/{index-o0sNTcKe.js → index-CBjZooac.js} +2 -2
- package/dist/{index-DnS_sBBe.cjs → index-COuvjZLM.cjs} +1 -1
- package/dist/index-CTjlbbt9.cjs +1 -0
- package/dist/index-CUWMxxKG.js +97 -0
- package/dist/{index-C329e3yQ.js → index-CZZ3llmi.js} +2 -2
- package/dist/index-CjyiloO7.cjs +1 -0
- package/dist/{index-D3wSWKST.cjs → index-Cmx9M9cZ.cjs} +1 -1
- package/dist/index-CocSS1YK.cjs +1 -0
- package/dist/index-CzRiuk60.cjs +1 -0
- package/dist/index-DFPDUUq7.js +658 -0
- package/dist/{index-D3S7dBDI.cjs → index-DIwmXz1u.cjs} +1 -1
- package/dist/index-DLcqcWxM.js +29 -0
- package/dist/index-DMLQL2aG.js +286 -0
- package/dist/{index-DXQ-7kNJ.cjs → index-DMs8RL3E.cjs} +1 -1
- package/dist/{index-Ce3QBKyj.cjs → index-Dbj9vHNq.cjs} +1 -1
- package/dist/{index-BRLtxFFr.cjs → index-DmGzwG2z.cjs} +1 -1
- package/dist/{index-P1sVIHE3.js → index-PYkEXTqJ.js} +1 -1
- package/dist/{index-DulPG3F9.js → index-Se4vRnIO.js} +3 -3
- package/dist/index-_XxjJPRD.cjs +1 -0
- package/dist/{index-B-cHTKrs.js → index-yWvyIlmA.js} +4 -4
- package/dist/input-group.cjs +1 -1
- package/dist/input-group.js +1 -1
- package/dist/{label-Cne2J57f.cjs → label-BjXORCBM.cjs} +1 -1
- package/dist/{label-Ky8qBEC3.js → label-CmwGvhy1.js} +1 -1
- package/dist/label.cjs +1 -1
- package/dist/label.js +1 -1
- package/dist/pagination.cjs +1 -6
- package/dist/pagination.js +58 -69
- package/dist/popover-3rIoNCXs.js +306 -0
- package/dist/popover-FCKBtFo-.cjs +1 -0
- package/dist/popover.cjs +1 -1
- package/dist/popover.js +1 -1
- package/dist/progress.cjs +1 -1
- package/dist/progress.js +1 -1
- package/dist/radio-group.cjs +1 -1
- package/dist/radio-group.js +5 -5
- package/dist/select.cjs +2 -2
- package/dist/select.js +585 -542
- package/dist/{separator-CGnu_jIu.cjs → separator-BaZqZZ9R.cjs} +1 -1
- package/dist/{separator-BH73A90k.js → separator-DR7lQjv9.js} +1 -1
- package/dist/separator.cjs +1 -1
- package/dist/separator.js +1 -1
- package/dist/{sheet-CcxnJ6LH.cjs → sheet-CU-sFSaJ.cjs} +1 -1
- package/dist/{sheet-_DVpQIVF.js → sheet-UZWAbdXr.js} +1 -1
- package/dist/sheet.cjs +1 -1
- package/dist/sheet.js +1 -1
- package/dist/sidebar.cjs +1 -1
- package/dist/sidebar.js +4 -4
- package/dist/slider.cjs +1 -1
- package/dist/slider.js +3 -3
- package/dist/styles.css +1 -1
- package/dist/switch.cjs +1 -1
- package/dist/switch.js +2 -2
- package/dist/tabs-underline.cjs +1 -1
- package/dist/tabs-underline.js +1 -1
- package/dist/tabs.cjs +1 -1
- package/dist/tabs.js +1 -1
- package/dist/toaster.cjs +1 -1
- package/dist/toaster.js +1 -1
- package/dist/toggle.cjs +1 -1
- package/dist/toggle.js +1 -1
- package/dist/tooltip.cjs +1 -1
- package/dist/tooltip.js +114 -108
- package/dist/typography.cjs +1 -1
- package/dist/typography.js +16 -16
- package/docs/AI-GUIDE.md +321 -0
- package/docs/components/layout/sidebar.md +330 -0
- package/docs/components/layout/toaster.md +436 -0
- package/docs/components/ui/accordion-rounded.md +583 -0
- package/docs/components/ui/accordion.md +267 -0
- package/docs/components/ui/alert.md +671 -0
- package/docs/components/ui/avatar.md +588 -0
- package/docs/components/ui/badge.md +1024 -0
- package/docs/components/ui/breadcrumb.md +614 -0
- package/docs/components/ui/button-group.md +1002 -0
- package/docs/components/ui/button.md +1078 -0
- package/docs/components/ui/calendar.md +1159 -0
- package/docs/components/ui/card.md +1265 -0
- package/docs/components/ui/checkbox.md +292 -0
- package/docs/components/ui/collapsible.md +320 -0
- package/docs/components/ui/combobox.md +328 -0
- package/docs/components/ui/command.md +454 -0
- package/docs/components/ui/context-menu.md +540 -0
- package/docs/components/ui/dialog.md +628 -0
- package/docs/components/ui/dropdown-menu.md +731 -0
- package/docs/components/ui/field.md +706 -0
- package/docs/components/ui/hover-card.md +446 -0
- package/docs/components/ui/input-group.md +509 -0
- package/docs/components/ui/input.md +362 -0
- package/docs/components/ui/kbd.md +434 -0
- package/docs/components/ui/label.md +359 -0
- package/docs/components/ui/pagination.md +650 -0
- package/docs/components/ui/popover.md +536 -0
- package/docs/components/ui/progress.md +182 -0
- package/docs/components/ui/radio-group.md +311 -0
- package/docs/components/ui/select.md +352 -0
- package/docs/components/ui/separator.md +214 -0
- package/docs/components/ui/sheet.md +142 -0
- package/docs/components/ui/skeleton.md +140 -0
- package/docs/components/ui/slider.md +341 -0
- package/docs/components/ui/spinner.md +170 -0
- package/docs/components/ui/switch.md +402 -0
- package/docs/components/ui/table.md +183 -0
- package/docs/components/ui/tabs-underline.md +106 -0
- package/docs/components/ui/tabs.md +122 -0
- package/docs/components/ui/textarea.md +243 -0
- package/docs/components/ui/toggle.md +243 -0
- package/docs/components/ui/tooltip.md +320 -0
- package/docs/components/ui/typography.md +191 -0
- package/package.json +11 -5
- package/dist/index-6oTEokEx.js +0 -82
- package/dist/index-B-NyefE0.js +0 -243
- package/dist/index-BKbK2GzY.cjs +0 -1
- package/dist/index-BMitW9UR.cjs +0 -1
- package/dist/index-BpvjJ_T6.cjs +0 -5
- package/dist/index-C5wjudc-.js +0 -36
- package/dist/index-CezwiPd_.js +0 -615
- package/dist/index-D02K8KOB.js +0 -54
- package/dist/index-D7hQvndv.cjs +0 -1
- package/dist/index-DQvx1rG_.cjs +0 -1
- package/dist/popover-BjdTqaB8.cjs +0 -1
- package/dist/popover-EnVfE0YA.js +0 -263
|
@@ -0,0 +1,352 @@
|
|
|
1
|
+
# Select
|
|
2
|
+
|
|
3
|
+
Dropdown de selección con búsqueda y scroll. Basado en Radix UI con 10 subcomponentes.
|
|
4
|
+
|
|
5
|
+
## Descripción
|
|
6
|
+
|
|
7
|
+
El componente `Select` muestra una lista de opciones en las que el usuario puede seleccionar una opción de la lista.
|
|
8
|
+
|
|
9
|
+
## Importación
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
import {
|
|
13
|
+
Select,
|
|
14
|
+
SelectContent,
|
|
15
|
+
SelectGroup,
|
|
16
|
+
SelectItem,
|
|
17
|
+
SelectLabel,
|
|
18
|
+
SelectTrigger,
|
|
19
|
+
SelectValue,
|
|
20
|
+
} from "@adamosuiteservices/ui/select";
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Anatomía
|
|
24
|
+
|
|
25
|
+
```tsx
|
|
26
|
+
<Select>
|
|
27
|
+
<SelectTrigger className="w-[180px]">
|
|
28
|
+
<SelectValue placeholder="Select option" />
|
|
29
|
+
</SelectTrigger>
|
|
30
|
+
<SelectContent>
|
|
31
|
+
<SelectItem value="option1">Option 1</SelectItem>
|
|
32
|
+
<SelectItem value="option2">Option 2</SelectItem>
|
|
33
|
+
</SelectContent>
|
|
34
|
+
</Select>
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
**Componentes**: 10 (Select, SelectTrigger, SelectValue, SelectContent, SelectItem, SelectGroup, SelectLabel, SelectSeparator, SelectScrollUpButton, SelectScrollDownButton)
|
|
38
|
+
|
|
39
|
+
## Props
|
|
40
|
+
|
|
41
|
+
### Select (Root)
|
|
42
|
+
|
|
43
|
+
| Prop | Tipo | Descripción |
|
|
44
|
+
| --------------- | ------------------------- | ---------------------------- |
|
|
45
|
+
| `defaultValue` | `string` | Valor inicial (uncontrolled) |
|
|
46
|
+
| `value` | `string` | Valor controlado |
|
|
47
|
+
| `onValueChange` | `(value: string) => void` | Callback al cambiar valor |
|
|
48
|
+
| `disabled` | `boolean` | Deshabilita el select |
|
|
49
|
+
| `required` | `boolean` | Campo requerido |
|
|
50
|
+
| `name` | `string` | Nombre (formularios) |
|
|
51
|
+
|
|
52
|
+
### SelectTrigger
|
|
53
|
+
|
|
54
|
+
| Prop | Tipo | Descripción |
|
|
55
|
+
| ----------- | ------------------- | ---------------------- |
|
|
56
|
+
| `size` | `"sm" \| "default"` | Tamaño del trigger |
|
|
57
|
+
| `className` | `string` | Clases CSS adicionales |
|
|
58
|
+
|
|
59
|
+
**Nota**: `size="sm"` = h-8, `size="default"` = h-9
|
|
60
|
+
|
|
61
|
+
### SelectValue
|
|
62
|
+
|
|
63
|
+
| Prop | Tipo | Descripción |
|
|
64
|
+
| ------------- | -------- | ----------------------------- |
|
|
65
|
+
| `placeholder` | `string` | Texto cuando no hay selección |
|
|
66
|
+
|
|
67
|
+
### SelectContent
|
|
68
|
+
|
|
69
|
+
| Prop | Tipo | Descripción |
|
|
70
|
+
| ----------- | ------------------------------ | ---------------------- |
|
|
71
|
+
| `position` | `"popper" \| "item-aligned"` | Posición del dropdown |
|
|
72
|
+
| `align` | `"start" \| "center" \| "end"` | Alineación horizontal |
|
|
73
|
+
| `className` | `string` | Clases CSS adicionales |
|
|
74
|
+
|
|
75
|
+
### SelectItem
|
|
76
|
+
|
|
77
|
+
| Prop | Tipo | Descripción |
|
|
78
|
+
| ----------- | --------- | ---------------------- |
|
|
79
|
+
| `value` | `string` | Valor único del item |
|
|
80
|
+
| `disabled` | `boolean` | Deshabilita este item |
|
|
81
|
+
| `className` | `string` | Clases CSS adicionales |
|
|
82
|
+
|
|
83
|
+
### SelectLabel
|
|
84
|
+
|
|
85
|
+
| Prop | Tipo | Descripción |
|
|
86
|
+
| ----------- | -------- | ---------------------------------- |
|
|
87
|
+
| `className` | `string` | Clases CSS para el label del grupo |
|
|
88
|
+
|
|
89
|
+
## Patrones de Uso
|
|
90
|
+
|
|
91
|
+
### Básico
|
|
92
|
+
|
|
93
|
+
```tsx
|
|
94
|
+
import {
|
|
95
|
+
Select,
|
|
96
|
+
SelectContent,
|
|
97
|
+
SelectItem,
|
|
98
|
+
SelectTrigger,
|
|
99
|
+
SelectValue,
|
|
100
|
+
} from "@adamosuiteservices/ui/select";
|
|
101
|
+
|
|
102
|
+
<Select>
|
|
103
|
+
<SelectTrigger className="w-[180px]">
|
|
104
|
+
<SelectValue placeholder="Select a theme" />
|
|
105
|
+
</SelectTrigger>
|
|
106
|
+
<SelectContent>
|
|
107
|
+
<SelectItem value="light">Light</SelectItem>
|
|
108
|
+
<SelectItem value="dark">Dark</SelectItem>
|
|
109
|
+
<SelectItem value="system">System</SelectItem>
|
|
110
|
+
</SelectContent>
|
|
111
|
+
</Select>;
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### Controlado
|
|
115
|
+
|
|
116
|
+
```tsx
|
|
117
|
+
import { useState } from "react";
|
|
118
|
+
|
|
119
|
+
function App() {
|
|
120
|
+
const [value, setValue] = useState("");
|
|
121
|
+
|
|
122
|
+
return (
|
|
123
|
+
<Select value={value} onValueChange={setValue}>
|
|
124
|
+
<SelectTrigger className="w-[180px]">
|
|
125
|
+
<SelectValue placeholder="Select a language" />
|
|
126
|
+
</SelectTrigger>
|
|
127
|
+
<SelectContent>
|
|
128
|
+
<SelectItem value="javascript">JavaScript</SelectItem>
|
|
129
|
+
<SelectItem value="typescript">TypeScript</SelectItem>
|
|
130
|
+
<SelectItem value="python">Python</SelectItem>
|
|
131
|
+
</SelectContent>
|
|
132
|
+
</Select>
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### Con Label
|
|
138
|
+
|
|
139
|
+
```tsx
|
|
140
|
+
import { Label } from "@adamosuiteservices/ui/label";
|
|
141
|
+
|
|
142
|
+
<div className="grid w-full max-w-sm items-center gap-2">
|
|
143
|
+
<Label htmlFor="email-provider">Email provider</Label>
|
|
144
|
+
<Select>
|
|
145
|
+
<SelectTrigger id="email-provider">
|
|
146
|
+
<SelectValue placeholder="Select a provider" />
|
|
147
|
+
</SelectTrigger>
|
|
148
|
+
<SelectContent>
|
|
149
|
+
<SelectItem value="gmail">Gmail</SelectItem>
|
|
150
|
+
<SelectItem value="outlook">Outlook</SelectItem>
|
|
151
|
+
<SelectItem value="yahoo">Yahoo</SelectItem>
|
|
152
|
+
</SelectContent>
|
|
153
|
+
</Select>
|
|
154
|
+
</div>;
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### Con Grupos
|
|
158
|
+
|
|
159
|
+
```tsx
|
|
160
|
+
import { SelectGroup, SelectLabel } from "@adamosuiteservices/ui/select";
|
|
161
|
+
|
|
162
|
+
<Select>
|
|
163
|
+
<SelectTrigger className="w-[200px]">
|
|
164
|
+
<SelectValue placeholder="Select a fruit" />
|
|
165
|
+
</SelectTrigger>
|
|
166
|
+
<SelectContent>
|
|
167
|
+
<SelectGroup>
|
|
168
|
+
<SelectLabel>Fruits</SelectLabel>
|
|
169
|
+
<SelectItem value="apple">Apple</SelectItem>
|
|
170
|
+
<SelectItem value="banana">Banana</SelectItem>
|
|
171
|
+
<SelectItem value="blueberry">Blueberry</SelectItem>
|
|
172
|
+
</SelectGroup>
|
|
173
|
+
</SelectContent>
|
|
174
|
+
</Select>;
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
### Con Iconos
|
|
178
|
+
|
|
179
|
+
```tsx
|
|
180
|
+
import { Apple, Banana, Cherry } from "lucide-react";
|
|
181
|
+
|
|
182
|
+
<Select>
|
|
183
|
+
<SelectTrigger className="w-[200px]">
|
|
184
|
+
<SelectValue placeholder="Select a fruit" />
|
|
185
|
+
</SelectTrigger>
|
|
186
|
+
<SelectContent>
|
|
187
|
+
<SelectItem value="apple">
|
|
188
|
+
<Apple className="mr-2 h-4 w-4" />
|
|
189
|
+
Apple
|
|
190
|
+
</SelectItem>
|
|
191
|
+
<SelectItem value="banana">
|
|
192
|
+
<Banana className="mr-2 h-4 w-4" />
|
|
193
|
+
Banana
|
|
194
|
+
</SelectItem>
|
|
195
|
+
<SelectItem value="cherry">
|
|
196
|
+
<Cherry className="mr-2 h-4 w-4" />
|
|
197
|
+
Cherry
|
|
198
|
+
</SelectItem>
|
|
199
|
+
</SelectContent>
|
|
200
|
+
</Select>;
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
### Tamaño Pequeño
|
|
204
|
+
|
|
205
|
+
```tsx
|
|
206
|
+
<Select>
|
|
207
|
+
<SelectTrigger size="sm" className="w-[160px]">
|
|
208
|
+
<SelectValue placeholder="Small select" />
|
|
209
|
+
</SelectTrigger>
|
|
210
|
+
<SelectContent>
|
|
211
|
+
<SelectItem value="xs">Extra Small</SelectItem>
|
|
212
|
+
<SelectItem value="sm">Small</SelectItem>
|
|
213
|
+
<SelectItem value="md">Medium</SelectItem>
|
|
214
|
+
</SelectContent>
|
|
215
|
+
</Select>
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
### Scrollable
|
|
219
|
+
|
|
220
|
+
```tsx
|
|
221
|
+
<Select>
|
|
222
|
+
<SelectTrigger className="w-[280px]">
|
|
223
|
+
<SelectValue placeholder="Select a timezone" />
|
|
224
|
+
</SelectTrigger>
|
|
225
|
+
<SelectContent>
|
|
226
|
+
<SelectGroup>
|
|
227
|
+
<SelectLabel>North America</SelectLabel>
|
|
228
|
+
<SelectItem value="est">Eastern Standard Time (EST)</SelectItem>
|
|
229
|
+
<SelectItem value="cst">Central Standard Time (CST)</SelectItem>
|
|
230
|
+
<SelectItem value="mst">Mountain Standard Time (MST)</SelectItem>
|
|
231
|
+
<SelectItem value="pst">Pacific Standard Time (PST)</SelectItem>
|
|
232
|
+
</SelectGroup>
|
|
233
|
+
<SelectGroup>
|
|
234
|
+
<SelectLabel>Europe & Africa</SelectLabel>
|
|
235
|
+
<SelectItem value="gmt">Greenwich Mean Time (GMT)</SelectItem>
|
|
236
|
+
<SelectItem value="cet">Central European Time (CET)</SelectItem>
|
|
237
|
+
<SelectItem value="eet">Eastern European Time (EET)</SelectItem>
|
|
238
|
+
</SelectGroup>
|
|
239
|
+
</SelectContent>
|
|
240
|
+
</Select>
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
### Con Validación
|
|
244
|
+
|
|
245
|
+
```tsx
|
|
246
|
+
import { Button } from "@adamosuiteservices/ui/button";
|
|
247
|
+
|
|
248
|
+
function App() {
|
|
249
|
+
const [value, setValue] = useState("");
|
|
250
|
+
const [error, setError] = useState("");
|
|
251
|
+
|
|
252
|
+
const handleValidate = () => {
|
|
253
|
+
if (!value) {
|
|
254
|
+
setError("Please select a priority level");
|
|
255
|
+
} else {
|
|
256
|
+
setError("");
|
|
257
|
+
}
|
|
258
|
+
};
|
|
259
|
+
|
|
260
|
+
return (
|
|
261
|
+
<div className="space-y-4">
|
|
262
|
+
<div className="grid w-full max-w-sm items-center gap-2">
|
|
263
|
+
<Label htmlFor="priority">
|
|
264
|
+
Priority level <span className="text-destructive">*</span>
|
|
265
|
+
</Label>
|
|
266
|
+
<Select value={value} onValueChange={setValue}>
|
|
267
|
+
<SelectTrigger
|
|
268
|
+
id="priority"
|
|
269
|
+
className={error ? "border-destructive" : ""}
|
|
270
|
+
>
|
|
271
|
+
<SelectValue placeholder="Select priority" />
|
|
272
|
+
</SelectTrigger>
|
|
273
|
+
<SelectContent>
|
|
274
|
+
<SelectItem value="low">Low</SelectItem>
|
|
275
|
+
<SelectItem value="medium">Medium</SelectItem>
|
|
276
|
+
<SelectItem value="high">High</SelectItem>
|
|
277
|
+
</SelectContent>
|
|
278
|
+
</Select>
|
|
279
|
+
{error && <p className="text-destructive text-sm">{error}</p>}
|
|
280
|
+
</div>
|
|
281
|
+
<Button onClick={handleValidate} variant="outline">
|
|
282
|
+
Validate Selection
|
|
283
|
+
</Button>
|
|
284
|
+
</div>
|
|
285
|
+
);
|
|
286
|
+
}
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
### Deshabilitado
|
|
290
|
+
|
|
291
|
+
```tsx
|
|
292
|
+
<Select disabled>
|
|
293
|
+
<SelectTrigger className="w-[180px]">
|
|
294
|
+
<SelectValue placeholder="Select a theme" />
|
|
295
|
+
</SelectTrigger>
|
|
296
|
+
<SelectContent>
|
|
297
|
+
<SelectItem value="light">Light</SelectItem>
|
|
298
|
+
<SelectItem value="dark">Dark</SelectItem>
|
|
299
|
+
</SelectContent>
|
|
300
|
+
</Select>
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
## Casos de Uso### Configuración
|
|
304
|
+
|
|
305
|
+
```tsx## Casos de Uso
|
|
306
|
+
|
|
307
|
+
**Selección simple**: Elegir una opción de lista larga
|
|
308
|
+
**Formularios**: País, estado, categoría, idioma
|
|
309
|
+
**Filtros**: Ordenar por, filtrar por tipo
|
|
310
|
+
**Settings**: Theme, tamaño de texto, timezone
|
|
311
|
+
**Navegación**: Cambio rápido entre secciones/vistas
|
|
312
|
+
|
|
313
|
+
## Estilos Base
|
|
314
|
+
|
|
315
|
+
- **Trigger height**: `h-9` (default), `h-8` (sm)
|
|
316
|
+
- **Border**: `border-input` con `shadow-xs`
|
|
317
|
+
- **Focus**: `ring-ring/50` con `ring-[3px]`
|
|
318
|
+
- **Content**: `bg-popover` con `shadow-md` y `border`
|
|
319
|
+
- **Item hover**: `bg-accent text-accent-foreground`
|
|
320
|
+
- **Check icon**: `CheckIcon` size-4 en item seleccionado
|
|
321
|
+
|
|
322
|
+
## Accesibilidad
|
|
323
|
+
|
|
324
|
+
- ✅ **Role**: `role="combobox"` en trigger, `role="option"` en items
|
|
325
|
+
- ✅ **ARIA**: `aria-expanded`, `aria-controls`, `aria-selected`
|
|
326
|
+
- ✅ **Keyboard**: Arrow keys, Enter, Escape, Type-ahead search
|
|
327
|
+
- ✅ **Focus**: Focus trap en content abierto
|
|
328
|
+
- ✅ **Label**: Asociar con `id` en SelectTrigger
|
|
329
|
+
|
|
330
|
+
## Notas de Implementación
|
|
331
|
+
|
|
332
|
+
- **Radix UI**: Basado en `@radix-ui/react-select`
|
|
333
|
+
- **Portal**: SelectContent se renderiza en portal
|
|
334
|
+
- **Iconos**: ChevronDown en trigger, CheckIcon en items seleccionados
|
|
335
|
+
- **Scroll buttons**: Auto-mostrados cuando content es scrollable
|
|
336
|
+
- **Position**: `popper` (default) para absolute positioning
|
|
337
|
+
- **Type-ahead**: Buscar items escribiendo
|
|
338
|
+
|
|
339
|
+
## Troubleshooting
|
|
340
|
+
|
|
341
|
+
**Dropdown no abre**: Verifica que SelectContent esté dentro de Select
|
|
342
|
+
**No muestra valor**: Asegura que `value` del item seleccionado coincida con `value` del Select
|
|
343
|
+
**Portal issues**: SelectContent usa Portal, puede afectar z-index
|
|
344
|
+
**Width mismatch**: SelectTrigger necesita `className="w-[Xpx]"` explícito
|
|
345
|
+
**Scroll no funciona**: Scroll automático cuando items exceden max-height
|
|
346
|
+
**Placeholder no desaparece**: SelectValue.placeholder solo visible cuando no hay valor
|
|
347
|
+
|
|
348
|
+
## Referencias
|
|
349
|
+
|
|
350
|
+
- **Radix UI Select**: <https://www.radix-ui.com/primitives/docs/components/select>
|
|
351
|
+
- **shadcn/ui Select**: <https://ui.shadcn.com/docs/components/select>
|
|
352
|
+
```
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
# Separator
|
|
2
|
+
|
|
3
|
+
Separador visual basado en Radix UI. Divide secciones con línea horizontal o vertical, con semántica accesible.
|
|
4
|
+
|
|
5
|
+
## Descripción
|
|
6
|
+
|
|
7
|
+
El componente `Separator` muestra una línea divisoria visual entre secciones de contenido.
|
|
8
|
+
|
|
9
|
+
## Importación
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
import { Separator } from "@adamosuiteservices/ui/separator";
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Anatomía
|
|
16
|
+
|
|
17
|
+
```tsx
|
|
18
|
+
<div>
|
|
19
|
+
<div>Section 1</div>
|
|
20
|
+
<Separator />
|
|
21
|
+
<div>Section 2</div>
|
|
22
|
+
</div>
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
**Componentes**: 1 (Separator)
|
|
26
|
+
|
|
27
|
+
## Props
|
|
28
|
+
|
|
29
|
+
| Prop | Tipo | Default | Descripción |
|
|
30
|
+
| ------------- | ---------------------------- | -------------- | ------------------------------- |
|
|
31
|
+
| `orientation` | `"horizontal" \| "vertical"` | `"horizontal"` | Orientación del separador |
|
|
32
|
+
| `decorative` | `boolean` | `true` | Si es decorativo (no semántico) |
|
|
33
|
+
| `className` | `string` | - | Clases CSS adicionales |
|
|
34
|
+
|
|
35
|
+
## Patrones de Uso
|
|
36
|
+
|
|
37
|
+
### Horizontal (Default)
|
|
38
|
+
|
|
39
|
+
```tsx
|
|
40
|
+
<div>
|
|
41
|
+
<h4 className="text-sm font-medium">Radix Primitives</h4>
|
|
42
|
+
<p className="text-sm text-muted-foreground">
|
|
43
|
+
An open-source UI component library.
|
|
44
|
+
</p>
|
|
45
|
+
</div>
|
|
46
|
+
<Separator className="my-4" />
|
|
47
|
+
<div>
|
|
48
|
+
<h4 className="text-sm font-medium">Next Section</h4>
|
|
49
|
+
<p className="text-sm text-muted-foreground">More content here.</p>
|
|
50
|
+
</div>
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Vertical
|
|
54
|
+
|
|
55
|
+
```tsx
|
|
56
|
+
<div className="flex h-5 items-center space-x-4 text-sm">
|
|
57
|
+
<div>Blog</div>
|
|
58
|
+
<Separator orientation="vertical" />
|
|
59
|
+
<div>Docs</div>
|
|
60
|
+
<Separator orientation="vertical" />
|
|
61
|
+
<div>Source</div>
|
|
62
|
+
</div>
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### En Navegación
|
|
66
|
+
|
|
67
|
+
```tsx
|
|
68
|
+
<nav className="flex items-center space-x-4 text-sm">
|
|
69
|
+
<a href="#" className="font-medium hover:underline">
|
|
70
|
+
Home
|
|
71
|
+
</a>
|
|
72
|
+
<Separator orientation="vertical" className="h-4" />
|
|
73
|
+
<a href="#" className="font-medium hover:underline">
|
|
74
|
+
About
|
|
75
|
+
</a>
|
|
76
|
+
<Separator orientation="vertical" className="h-4" />
|
|
77
|
+
<a href="#" className="font-medium hover:underline">
|
|
78
|
+
Contact
|
|
79
|
+
</a>
|
|
80
|
+
</nav>
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### En Cards
|
|
84
|
+
|
|
85
|
+
```tsx
|
|
86
|
+
import {
|
|
87
|
+
Card,
|
|
88
|
+
CardHeader,
|
|
89
|
+
CardContent,
|
|
90
|
+
CardTitle,
|
|
91
|
+
} from "@adamosuiteservices/ui/card";
|
|
92
|
+
|
|
93
|
+
<Card>
|
|
94
|
+
<CardHeader>
|
|
95
|
+
<CardTitle>User Profile</CardTitle>
|
|
96
|
+
</CardHeader>
|
|
97
|
+
<CardContent className="space-y-4">
|
|
98
|
+
<div>
|
|
99
|
+
<p className="text-sm">John Doe</p>
|
|
100
|
+
<p className="text-xs text-muted-foreground">john@example.com</p>
|
|
101
|
+
</div>
|
|
102
|
+
<Separator />
|
|
103
|
+
<div className="space-y-2">
|
|
104
|
+
<div className="flex justify-between text-sm">
|
|
105
|
+
<span>Status</span>
|
|
106
|
+
<span className="text-muted-foreground">Active</span>
|
|
107
|
+
</div>
|
|
108
|
+
<div className="flex justify-between text-sm">
|
|
109
|
+
<span>Role</span>
|
|
110
|
+
<span className="text-muted-foreground">Admin</span>
|
|
111
|
+
</div>
|
|
112
|
+
</div>
|
|
113
|
+
</CardContent>
|
|
114
|
+
</Card>;
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### Con Spacing Custom
|
|
118
|
+
|
|
119
|
+
```tsx
|
|
120
|
+
<Separator className="my-2" /> {/* Tight */}
|
|
121
|
+
<Separator className="my-4" /> {/* Normal */}
|
|
122
|
+
<Separator className="my-8" /> {/* Loose */}
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### En Listas
|
|
126
|
+
|
|
127
|
+
```tsx
|
|
128
|
+
const items = [
|
|
129
|
+
{ id: 1, title: "First Item" },
|
|
130
|
+
{ id: 2, title: "Second Item" },
|
|
131
|
+
{ id: 3, title: "Third Item" },
|
|
132
|
+
];
|
|
133
|
+
|
|
134
|
+
<div className="space-y-0">
|
|
135
|
+
{items.map((item, index) => (
|
|
136
|
+
<div key={item.id}>
|
|
137
|
+
<div className="py-3">
|
|
138
|
+
<h4 className="text-sm font-medium">{item.title}</h4>
|
|
139
|
+
</div>
|
|
140
|
+
{index < items.length - 1 && <Separator />}
|
|
141
|
+
</div>
|
|
142
|
+
))}
|
|
143
|
+
</div>;
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
### Con Colores Custom
|
|
147
|
+
|
|
148
|
+
```tsx
|
|
149
|
+
<Separator className="bg-muted" /> {/* Subtle */}
|
|
150
|
+
<Separator className="bg-primary h-0.5" /> {/* Accent */}
|
|
151
|
+
<Separator className="bg-border" /> {/* Default */}
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
## Casos de Uso
|
|
155
|
+
|
|
156
|
+
**Section dividers**: Separar secciones de contenido
|
|
157
|
+
**Navigation**: Dividir items de navegación
|
|
158
|
+
**Cards**: Separar contenido en cards
|
|
159
|
+
**Lists**: Dividir items en listas
|
|
160
|
+
**Sidebars**: Separar grupos de opciones
|
|
161
|
+
**Stats**: Dividir métricas verticalmente
|
|
162
|
+
|
|
163
|
+
## Estilos Base
|
|
164
|
+
|
|
165
|
+
### Estilos Horizontal
|
|
166
|
+
|
|
167
|
+
- **Height**: `h-px` (1px)
|
|
168
|
+
- **Width**: `w-full`
|
|
169
|
+
- **Color**: `bg-border`
|
|
170
|
+
|
|
171
|
+
### Estilos Vertical
|
|
172
|
+
|
|
173
|
+
- **Width**: `w-px` (1px)
|
|
174
|
+
- **Height**: `h-full`
|
|
175
|
+
- **Color**: `bg-border`
|
|
176
|
+
|
|
177
|
+
## Accesibilidad
|
|
178
|
+
|
|
179
|
+
- ✅ **ARIA**: `role="separator"` si `decorative=false`
|
|
180
|
+
- ✅ **Decorative**: Por defecto `decorative=true` (no anunciado por screen readers)
|
|
181
|
+
- ✅ **Semantic**: Usa `decorative=false` para separadores semánticos
|
|
182
|
+
|
|
183
|
+
## Notas de Implementación
|
|
184
|
+
|
|
185
|
+
- **Radix UI**: Basado en `@radix-ui/react-separator`
|
|
186
|
+
- **Data attributes**: `data-[orientation=horizontal|vertical]` para estilos
|
|
187
|
+
- **Shrink**: `shrink-0` para evitar colapso en flex
|
|
188
|
+
- **Decorative**: Por defecto no tiene rol semántico (solo visual)
|
|
189
|
+
|
|
190
|
+
## Decorative vs Semantic
|
|
191
|
+
|
|
192
|
+
```tsx
|
|
193
|
+
{
|
|
194
|
+
/* Decorative (default) - solo visual */
|
|
195
|
+
}
|
|
196
|
+
<Separator />;
|
|
197
|
+
|
|
198
|
+
{
|
|
199
|
+
/* Semantic - anunciado por screen readers */
|
|
200
|
+
}
|
|
201
|
+
<Separator decorative={false} />;
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
## Troubleshooting
|
|
205
|
+
|
|
206
|
+
**No se ve**: Verifica `bg-border` o color custom aplicado
|
|
207
|
+
**Muy alto/ancho**: Horizontal usa `h-px`, vertical usa `w-px`
|
|
208
|
+
**No divide verticalmente**: Verifica `orientation="vertical"` y altura del contenedor
|
|
209
|
+
**Spacing inconsistente**: Usa `my-*` o `mx-*` para spacing uniforme
|
|
210
|
+
|
|
211
|
+
## Referencias
|
|
212
|
+
|
|
213
|
+
- **Radix UI Separator**: <https://www.radix-ui.com/primitives/docs/components/separator>
|
|
214
|
+
- **shadcn/ui Separator**: <https://ui.shadcn.com/docs/components/separator>
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
# Sheet
|
|
2
|
+
|
|
3
|
+
Panel lateral deslizable (drawer). Basado en Radix UI Dialog con 4 direcciones.
|
|
4
|
+
|
|
5
|
+
## Descripción
|
|
6
|
+
|
|
7
|
+
El componente `Sheet` muestra un panel lateral deslizante, similar a un drawer.
|
|
8
|
+
|
|
9
|
+
## Importación
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
import {
|
|
13
|
+
Sheet,
|
|
14
|
+
SheetContent,
|
|
15
|
+
SheetDescription,
|
|
16
|
+
SheetHeader,
|
|
17
|
+
SheetTitle,
|
|
18
|
+
SheetTrigger,
|
|
19
|
+
SheetFooter,
|
|
20
|
+
SheetClose,
|
|
21
|
+
} from "@adamosuiteservices/ui/sheet";
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Anatomía
|
|
25
|
+
|
|
26
|
+
```tsx
|
|
27
|
+
<Sheet>
|
|
28
|
+
<SheetTrigger>Open</SheetTrigger>
|
|
29
|
+
<SheetContent>
|
|
30
|
+
<SheetHeader>
|
|
31
|
+
<SheetTitle>Are you sure?</SheetTitle>
|
|
32
|
+
<SheetDescription>This action cannot be undone.</SheetDescription>
|
|
33
|
+
</SheetHeader>
|
|
34
|
+
</SheetContent>
|
|
35
|
+
</Sheet>
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
**Componentes**: 8 (Sheet, SheetTrigger, SheetContent, SheetHeader, SheetFooter, SheetTitle, SheetDescription, SheetClose)
|
|
39
|
+
|
|
40
|
+
## Props
|
|
41
|
+
|
|
42
|
+
### Sheet (Root)
|
|
43
|
+
|
|
44
|
+
| Prop | Tipo | Descripción |
|
|
45
|
+
| -------------- | ------------------------- | ------------------- |
|
|
46
|
+
| `open` | `boolean` | Estado controlado |
|
|
47
|
+
| `defaultOpen` | `boolean` | Estado inicial |
|
|
48
|
+
| `onOpenChange` | `(open: boolean) => void` | Callback al cambiar |
|
|
49
|
+
|
|
50
|
+
### SheetContent
|
|
51
|
+
|
|
52
|
+
| Prop | Tipo | Descripción |
|
|
53
|
+
| ----------------- | ---------------------------------------- | -------------------------------- |
|
|
54
|
+
| `side` | `"top" \| "right" \| "bottom" \| "left"` | Dirección (default: "right") |
|
|
55
|
+
| `showCloseButton` | `boolean` | Mostrar X button (default: true) |
|
|
56
|
+
|
|
57
|
+
## Patrones de Uso
|
|
58
|
+
|
|
59
|
+
### Desde Derecha (Default)
|
|
60
|
+
|
|
61
|
+
```tsx
|
|
62
|
+
<Sheet>
|
|
63
|
+
<SheetTrigger asChild>
|
|
64
|
+
<Button>Open Sheet</Button>
|
|
65
|
+
</SheetTrigger>
|
|
66
|
+
<SheetContent>
|
|
67
|
+
<SheetHeader>
|
|
68
|
+
<SheetTitle>Settings</SheetTitle>
|
|
69
|
+
<SheetDescription>Configure your preferences</SheetDescription>
|
|
70
|
+
</SheetHeader>
|
|
71
|
+
</SheetContent>
|
|
72
|
+
</Sheet>
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### Desde Izquierda
|
|
76
|
+
|
|
77
|
+
```tsx
|
|
78
|
+
<Sheet>
|
|
79
|
+
<SheetTrigger>Open Left</SheetTrigger>
|
|
80
|
+
<SheetContent side="left">
|
|
81
|
+
<SheetHeader>
|
|
82
|
+
<SheetTitle>Navigation</SheetTitle>
|
|
83
|
+
</SheetHeader>
|
|
84
|
+
</SheetContent>
|
|
85
|
+
</Sheet>
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Desde Arriba/Abajo
|
|
89
|
+
|
|
90
|
+
```tsx
|
|
91
|
+
<Sheet>
|
|
92
|
+
<SheetTrigger>Open Top</SheetTrigger>
|
|
93
|
+
<SheetContent side="top">
|
|
94
|
+
<SheetHeader>
|
|
95
|
+
<SheetTitle>Top Sheet</SheetTitle>
|
|
96
|
+
</SheetHeader>
|
|
97
|
+
</SheetContent>
|
|
98
|
+
</Sheet>
|
|
99
|
+
|
|
100
|
+
<Sheet>
|
|
101
|
+
<SheetTrigger>Open Bottom</SheetTrigger>
|
|
102
|
+
<SheetContent side="bottom">
|
|
103
|
+
<SheetHeader>
|
|
104
|
+
<SheetTitle>Bottom Sheet</SheetTitle>
|
|
105
|
+
</SheetHeader>
|
|
106
|
+
</SheetContent>
|
|
107
|
+
</Sheet>
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### Con Footer
|
|
111
|
+
|
|
112
|
+
```tsx
|
|
113
|
+
<Sheet>
|
|
114
|
+
<SheetTrigger>Edit Profile</SheetTrigger>
|
|
115
|
+
<SheetContent>
|
|
116
|
+
<SheetHeader>
|
|
117
|
+
<SheetTitle>Edit profile</SheetTitle>
|
|
118
|
+
<SheetDescription>Make changes to your profile here.</SheetDescription>
|
|
119
|
+
</SheetHeader>
|
|
120
|
+
{/* Form fields */}
|
|
121
|
+
<SheetFooter>
|
|
122
|
+
<SheetClose asChild>
|
|
123
|
+
<Button variant="outline">Cancel</Button>
|
|
124
|
+
</SheetClose>
|
|
125
|
+
<Button type="submit">Save changes</Button>
|
|
126
|
+
</SheetFooter>
|
|
127
|
+
</SheetContent>
|
|
128
|
+
</Sheet>
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
## Casos de Uso
|
|
132
|
+
|
|
133
|
+
**Navigation menu**: Menú móvil
|
|
134
|
+
**Filters**: Panel de filtros
|
|
135
|
+
**Details**: Vista de detalles
|
|
136
|
+
**Forms**: Formularios laterales
|
|
137
|
+
**Settings**: Panel de configuración
|
|
138
|
+
|
|
139
|
+
## Referencias
|
|
140
|
+
|
|
141
|
+
- **Radix UI Dialog**: <https://www.radix-ui.com/primitives/docs/components/dialog>
|
|
142
|
+
- **shadcn/ui Sheet**: <https://ui.shadcn.com/docs/components/sheet>
|