@adamosuiteservices/ui 1.8.13 → 1.9.14

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 (144) hide show
  1. package/dist/components/ui/icon/icon.d.ts +11 -0
  2. package/dist/components/ui/icon/icon.stories.d.ts +55 -0
  3. package/dist/components/ui/icon/index.d.ts +1 -0
  4. package/dist/components/ui/input-group/input-group.d.ts +1 -1
  5. package/dist/custom-layered-styles.css +1 -1
  6. package/dist/icon.cjs +6 -0
  7. package/dist/icon.js +36 -0
  8. package/dist/icons.css +1 -0
  9. package/dist/styles.css +1 -1
  10. package/docs/AI-GUIDE.md +321 -321
  11. package/docs/components/layout/sidebar.md +404 -404
  12. package/docs/components/layout/toaster.md +436 -436
  13. package/docs/components/ui/accordion-rounded.md +583 -583
  14. package/docs/components/ui/accordion.md +267 -267
  15. package/docs/components/ui/alert.md +671 -671
  16. package/docs/components/ui/avatar.md +588 -588
  17. package/docs/components/ui/badge.md +1024 -1024
  18. package/docs/components/ui/button-group.md +1002 -1002
  19. package/docs/components/ui/button.md +1078 -1078
  20. package/docs/components/ui/calendar.md +1159 -1159
  21. package/docs/components/ui/card.md +1265 -1265
  22. package/docs/components/ui/checkbox.md +292 -292
  23. package/docs/components/ui/collapsible.md +320 -320
  24. package/docs/components/ui/command.md +454 -454
  25. package/docs/components/ui/context-menu.md +540 -540
  26. package/docs/components/ui/dialog.md +628 -628
  27. package/docs/components/ui/dropdown-menu.md +731 -731
  28. package/docs/components/ui/field.md +706 -706
  29. package/docs/components/ui/hover-card.md +446 -446
  30. package/docs/components/ui/icon.md +502 -0
  31. package/docs/components/ui/input-group.md +509 -509
  32. package/docs/components/ui/input.md +362 -362
  33. package/docs/components/ui/kbd.md +434 -434
  34. package/docs/components/ui/label.md +359 -359
  35. package/docs/components/ui/pagination.md +650 -650
  36. package/docs/components/ui/popover.md +536 -536
  37. package/docs/components/ui/progress.md +182 -182
  38. package/docs/components/ui/radio-group.md +311 -311
  39. package/docs/components/ui/select.md +352 -352
  40. package/docs/components/ui/separator.md +214 -214
  41. package/docs/components/ui/sheet.md +142 -142
  42. package/docs/components/ui/skeleton.md +140 -140
  43. package/docs/components/ui/slider.md +341 -341
  44. package/docs/components/ui/spinner.md +170 -170
  45. package/docs/components/ui/switch.md +402 -402
  46. package/docs/components/ui/table.md +183 -183
  47. package/docs/components/ui/tabs-underline.md +106 -106
  48. package/docs/components/ui/tabs.md +122 -122
  49. package/docs/components/ui/textarea.md +243 -243
  50. package/docs/components/ui/toggle.md +243 -243
  51. package/docs/components/ui/tooltip.md +320 -320
  52. package/docs/components/ui/typography.md +191 -191
  53. package/package.json +6 -5
  54. package/dist/components/icons/account-balance-icon.d.ts +0 -3
  55. package/dist/components/icons/account-icon.d.ts +0 -3
  56. package/dist/components/icons/add-circle-icon.d.ts +0 -3
  57. package/dist/components/icons/alarm-icon.d.ts +0 -3
  58. package/dist/components/icons/archive-icon.d.ts +0 -3
  59. package/dist/components/icons/arrow-back-icon.d.ts +0 -3
  60. package/dist/components/icons/arrow-circle-up-icon.d.ts +0 -3
  61. package/dist/components/icons/arrow-forward-icon.d.ts +0 -3
  62. package/dist/components/icons/arrow-outward-icon.d.ts +0 -3
  63. package/dist/components/icons/article-icon.d.ts +0 -3
  64. package/dist/components/icons/attach-file-icon.d.ts +0 -3
  65. package/dist/components/icons/autorenew-icon.d.ts +0 -3
  66. package/dist/components/icons/bookmark-icon.d.ts +0 -3
  67. package/dist/components/icons/calculate-icon.d.ts +0 -3
  68. package/dist/components/icons/calendar-today-icon.d.ts +0 -3
  69. package/dist/components/icons/call-split-icon.d.ts +0 -3
  70. package/dist/components/icons/cancel-filled-icon.d.ts +0 -3
  71. package/dist/components/icons/cancel-icon.d.ts +0 -3
  72. package/dist/components/icons/check-circle-icon.d.ts +0 -3
  73. package/dist/components/icons/check-icon.d.ts +0 -3
  74. package/dist/components/icons/chevron-back-icon.d.ts +0 -3
  75. package/dist/components/icons/chevron-down-icon.d.ts +0 -3
  76. package/dist/components/icons/chevron-forward-icon.d.ts +0 -3
  77. package/dist/components/icons/chevron-up-icon.d.ts +0 -3
  78. package/dist/components/icons/clarify-icon.d.ts +0 -3
  79. package/dist/components/icons/clock-icon.d.ts +0 -3
  80. package/dist/components/icons/close-icon.d.ts +0 -3
  81. package/dist/components/icons/confirmation-number-icon.d.ts +0 -3
  82. package/dist/components/icons/contacts-icon.d.ts +0 -3
  83. package/dist/components/icons/contract-delete-icon.d.ts +0 -3
  84. package/dist/components/icons/copy-icon.d.ts +0 -3
  85. package/dist/components/icons/do-not-touch-icon.d.ts +0 -3
  86. package/dist/components/icons/download-icon.d.ts +0 -3
  87. package/dist/components/icons/dragger-icon.d.ts +0 -3
  88. package/dist/components/icons/edit-icon.d.ts +0 -3
  89. package/dist/components/icons/edit-square-icon.d.ts +0 -3
  90. package/dist/components/icons/exclamation-icon.d.ts +0 -3
  91. package/dist/components/icons/expand-circle-right-icon.d.ts +0 -3
  92. package/dist/components/icons/feature-search-icon.d.ts +0 -3
  93. package/dist/components/icons/filter-icon.d.ts +0 -3
  94. package/dist/components/icons/folder-icon.d.ts +0 -3
  95. package/dist/components/icons/folder-open-icon.d.ts +0 -3
  96. package/dist/components/icons/format-list-bulleted-icon.d.ts +0 -3
  97. package/dist/components/icons/hamburger-menu-icon.d.ts +0 -3
  98. package/dist/components/icons/help-icon.d.ts +0 -3
  99. package/dist/components/icons/hide-pass-icon.d.ts +0 -3
  100. package/dist/components/icons/home-icon.d.ts +0 -3
  101. package/dist/components/icons/id-card-icon.d.ts +0 -3
  102. package/dist/components/icons/index.d.ts +0 -88
  103. package/dist/components/icons/info-icon.d.ts +0 -3
  104. package/dist/components/icons/kid-star-icon.d.ts +0 -3
  105. package/dist/components/icons/language-icon.d.ts +0 -3
  106. package/dist/components/icons/last-page-icon.d.ts +0 -3
  107. package/dist/components/icons/layers-icon.d.ts +0 -3
  108. package/dist/components/icons/location-icon.d.ts +0 -3
  109. package/dist/components/icons/mail-icon.d.ts +0 -3
  110. package/dist/components/icons/manage-search-icon.d.ts +0 -3
  111. package/dist/components/icons/menu-icon.d.ts +0 -3
  112. package/dist/components/icons/message-icon.d.ts +0 -3
  113. package/dist/components/icons/metrics-icon.d.ts +0 -3
  114. package/dist/components/icons/mic-icon.d.ts +0 -3
  115. package/dist/components/icons/minus-icon.d.ts +0 -3
  116. package/dist/components/icons/mode-comment-icon.d.ts +0 -3
  117. package/dist/components/icons/money-icon.d.ts +0 -3
  118. package/dist/components/icons/monitoring-icon.d.ts +0 -3
  119. package/dist/components/icons/more-icon.d.ts +0 -3
  120. package/dist/components/icons/notifications-icon.d.ts +0 -3
  121. package/dist/components/icons/open-in-new-icon.d.ts +0 -3
  122. package/dist/components/icons/palette-icon.d.ts +0 -3
  123. package/dist/components/icons/password-icon.d.ts +0 -3
  124. package/dist/components/icons/pending-icon.d.ts +0 -3
  125. package/dist/components/icons/person-add-icon.d.ts +0 -3
  126. package/dist/components/icons/person-search-icon.d.ts +0 -3
  127. package/dist/components/icons/photo-icon.d.ts +0 -3
  128. package/dist/components/icons/plus-icon.d.ts +0 -3
  129. package/dist/components/icons/policy-icon.d.ts +0 -3
  130. package/dist/components/icons/publish-icon.d.ts +0 -3
  131. package/dist/components/icons/ready-icon.d.ts +0 -3
  132. package/dist/components/icons/receipt-icon.d.ts +0 -3
  133. package/dist/components/icons/receive-icon.d.ts +0 -3
  134. package/dist/components/icons/refresh-icon.d.ts +0 -3
  135. package/dist/components/icons/search-icon.d.ts +0 -3
  136. package/dist/components/icons/see-icon.d.ts +0 -3
  137. package/dist/components/icons/send-icon.d.ts +0 -3
  138. package/dist/components/icons/settings-icon.d.ts +0 -3
  139. package/dist/components/icons/shield-icon.d.ts +0 -3
  140. package/dist/components/icons/swap-horiz-icon.d.ts +0 -3
  141. package/dist/components/icons/tag-icon.d.ts +0 -3
  142. package/dist/components/icons/trash-icon.d.ts +0 -3
  143. package/dist/icons.cjs +0 -1
  144. package/dist/icons.js +0 -1507
@@ -1,311 +1,311 @@
1
- # Radio Group
2
-
3
- Grupo de opciones mutuamente excluyentes. Usuario selecciona una opción. Basado en Radix UI.
4
-
5
- ## Descripción
6
-
7
- El componente `RadioGroup` permite seleccionar una opción de un conjunto de opciones mutuamente excluyentes.
8
-
9
- ## Importación
10
-
11
- ```typescript
12
- import { RadioGroup, RadioGroupItem } from "@adamosuiteservices/ui/radio-group";
13
- ```
14
-
15
- ## Anatomía
16
-
17
- ```tsx
18
- <RadioGroup defaultValue="option-one">
19
- <div className="flex items-center space-x-2">
20
- <RadioGroupItem value="option-one" id="option-one" />
21
- <Label htmlFor="option-one">Option One</Label>
22
- </div>
23
- <div className="flex items-center space-x-2">
24
- <RadioGroupItem value="option-two" id="option-two" />
25
- <Label htmlFor="option-two">Option Two</Label>
26
- </div>
27
- </RadioGroup>
28
- ```
29
-
30
- **Componentes**: 2 (RadioGroup, RadioGroupItem)
31
-
32
- ## Props
33
-
34
- ### RadioGroup
35
-
36
- | Prop | Tipo | Descripción |
37
- | --------------- | ------------------------- | ------------------------------ |
38
- | `defaultValue` | `string` | Valor inicial (uncontrolled) |
39
- | `value` | `string` | Valor controlado |
40
- | `onValueChange` | `(value: string) => void` | Callback al cambiar valor |
41
- | `disabled` | `boolean` | Deshabilita todo el grupo |
42
- | `required` | `boolean` | Campo requerido |
43
- | `name` | `string` | Nombre del grupo (formularios) |
44
- | `className` | `string` | Clases CSS adicionales |
45
-
46
- **Nota**: Acepta todas las props de Radix UI RadioGroup.Root
47
-
48
- ### RadioGroupItem
49
-
50
- | Prop | Tipo | Descripción |
51
- | ----------- | --------- | ------------------------- |
52
- | `value` | `string` | Valor único del item |
53
- | `id` | `string` | ID para asociar con Label |
54
- | `disabled` | `boolean` | Deshabilita este item |
55
- | `className` | `string` | Clases CSS adicionales |
56
-
57
- **Nota**: Acepta todas las props de Radix UI RadioGroup.Item
58
-
59
- ## Patrones de Uso
60
-
61
- ### Básico
62
-
63
- ```tsx
64
- import { RadioGroup, RadioGroupItem } from "@adamosuiteservices/ui/radio-group";
65
- import { Label } from "@adamosuiteservices/ui/label";
66
-
67
- <RadioGroup defaultValue="option-one">
68
- <div className="flex items-center gap-3">
69
- <RadioGroupItem value="option-one" id="option-one" />
70
- <Label htmlFor="option-one">Option One</Label>
71
- </div>
72
- <div className="flex items-center gap-3">
73
- <RadioGroupItem value="option-two" id="option-two" />
74
- <Label htmlFor="option-two">Option Two</Label>
75
- </div>
76
- </RadioGroup>;
77
- ```
78
-
79
- ### Controlado
80
-
81
- ```tsx
82
- import { useState } from "react";
83
-
84
- function App() {
85
- const [value, setValue] = useState("red");
86
-
87
- return (
88
- <RadioGroup value={value} onValueChange={setValue}>
89
- <div className="flex items-center gap-3">
90
- <RadioGroupItem value="red" id="red" />
91
- <Label htmlFor="red">Red</Label>
92
- </div>
93
- <div className="flex items-center gap-3">
94
- <RadioGroupItem value="green" id="green" />
95
- <Label htmlFor="green">Green</Label>
96
- </div>
97
- </RadioGroup>
98
- );
99
- }
100
- ```
101
-
102
- ### Con Descripciones
103
-
104
- ```tsx
105
- <RadioGroup defaultValue="comfortable">
106
- <div className="flex items-start gap-3">
107
- <RadioGroupItem value="default" id="default" />
108
- <div className="grid gap-2">
109
- <Label htmlFor="default">Default</Label>
110
- <p className="text-muted-foreground text-sm">
111
- Recommended for most users. Provides a balanced experience.
112
- </p>
113
- </div>
114
- </div>
115
- <div className="flex items-start gap-3">
116
- <RadioGroupItem value="comfortable" id="comfortable" />
117
- <div className="grid gap-2">
118
- <Label htmlFor="comfortable">Comfortable</Label>
119
- <p className="text-muted-foreground text-sm">
120
- More spacing and larger elements for better accessibility.
121
- </p>
122
- </div>
123
- </div>
124
- </RadioGroup>
125
- ```
126
-
127
- ### Layout Horizontal
128
-
129
- ```tsx
130
- <RadioGroup defaultValue="medium" className="flex gap-6">
131
- <div className="flex items-center gap-2">
132
- <RadioGroupItem value="small" id="small" />
133
- <Label htmlFor="small">Small</Label>
134
- </div>
135
- <div className="flex items-center gap-2">
136
- <RadioGroupItem value="medium" id="medium" />
137
- <Label htmlFor="medium">Medium</Label>
138
- </div>
139
- <div className="flex items-center gap-2">
140
- <RadioGroupItem value="large" id="large" />
141
- <Label htmlFor="large">Large</Label>
142
- </div>
143
- </RadioGroup>
144
- ```
145
-
146
- ### Con Badges
147
-
148
- ```tsx
149
- import { Badge } from "@adamosuiteservices/ui/badge";
150
-
151
- <RadioGroup defaultValue="pro">
152
- <div className="flex items-center gap-3">
153
- <RadioGroupItem value="free" id="free" />
154
- <div className="flex items-center gap-2">
155
- <Label htmlFor="free">Free Plan</Label>
156
- <Badge variant="secondary">$0/month</Badge>
157
- </div>
158
- </div>
159
- <div className="flex items-center gap-3">
160
- <RadioGroupItem value="pro" id="pro" />
161
- <div className="flex items-center gap-2">
162
- <Label htmlFor="pro">Pro Plan</Label>
163
- <Badge variant="default">$9/month</Badge>
164
- </div>
165
- </div>
166
- </RadioGroup>;
167
- ```
168
-
169
- ### En Formularios
170
-
171
- ```tsx
172
- import { Button } from "@adamosuiteservices/ui/button";
173
-
174
- function App() {
175
- const [formData, setFormData] = useState({
176
- notification: "email",
177
- frequency: "weekly",
178
- });
179
-
180
- const handleSubmit = (e: React.FormEvent) => {
181
- e.preventDefault();
182
- console.log("Form submitted:", formData);
183
- };
184
-
185
- return (
186
- <form onSubmit={handleSubmit} className="space-y-6">
187
- <div className="space-y-3">
188
- <p className="text-sm font-medium">Notification method</p>
189
- <RadioGroup
190
- value={formData.notification}
191
- onValueChange={(value) =>
192
- setFormData((prev) => ({ ...prev, notification: value }))
193
- }
194
- >
195
- <div className="flex items-center gap-3">
196
- <RadioGroupItem value="email" id="email" />
197
- <Label htmlFor="email">Email notifications</Label>
198
- </div>
199
- <div className="flex items-center gap-3">
200
- <RadioGroupItem value="sms" id="sms" />
201
- <Label htmlFor="sms">SMS notifications</Label>
202
- </div>
203
- </RadioGroup>
204
- </div>
205
- <Button type="submit">Save preferences</Button>
206
- </form>
207
- );
208
- }
209
- ```
210
-
211
- ### Nested (Conditional)
212
-
213
- ```tsx
214
- function App() {
215
- const [paymentMethod, setPaymentMethod] = useState("card");
216
- const [cardType, setCardType] = useState("visa");
217
-
218
- return (
219
- <div className="space-y-6">
220
- <RadioGroup value={paymentMethod} onValueChange={setPaymentMethod}>
221
- <div className="flex items-center gap-3">
222
- <RadioGroupItem value="card" id="card" />
223
- <Label htmlFor="card">Credit/Debit Card</Label>
224
- </div>
225
- <div className="flex items-center gap-3">
226
- <RadioGroupItem value="bank" id="bank" />
227
- <Label htmlFor="bank">Bank Transfer</Label>
228
- </div>
229
- </RadioGroup>
230
-
231
- {paymentMethod === "card" && (
232
- <div className="ml-6 space-y-3">
233
- <p className="text-sm font-medium">Card type</p>
234
- <RadioGroup value={cardType} onValueChange={setCardType}>
235
- <div className="flex items-center gap-3">
236
- <RadioGroupItem value="visa" id="visa" />
237
- <Label htmlFor="visa">Visa</Label>
238
- </div>
239
- <div className="flex items-center gap-3">
240
- <RadioGroupItem value="mastercard" id="mastercard" />
241
- <Label htmlFor="mastercard">Mastercard</Label>
242
- </div>
243
- </RadioGroup>
244
- </div>
245
- )}
246
- </div>
247
- );
248
- }
249
- ```
250
-
251
- ### Deshabilitado
252
-
253
- ```tsx
254
- <RadioGroup defaultValue="option-one" disabled>
255
- <div className="flex items-center gap-3">
256
- <RadioGroupItem value="option-one" id="disabled-one" />
257
- <Label htmlFor="disabled-one">Option One</Label>
258
- </div>
259
- <div className="flex items-center gap-3">
260
- <RadioGroupItem value="option-two" id="disabled-two" />
261
- <Label htmlFor="disabled-two">Option Two</Label>
262
- </div>
263
- </RadioGroup>
264
- ```
265
-
266
- ## Casos de Uso
267
-
268
- **Opciones mutuamente excluyentes**: Una sola selección de múltiples opciones
269
- **Settings**: Preferencias de configuración (theme, size, mode)
270
- **Formularios**: Selección de método de pago, envío, categoría
271
- **Surveys**: Preguntas con opciones de respuesta única
272
- **Filtros**: Filtrado por categoría, tipo, estado
273
-
274
- ## Estilos Base
275
-
276
- - **Size**: `size-5` (20px)
277
- - **Border**: `border-input` con `shadow-xs`
278
- - **Checked**: `CircleIcon` con `fill-primary`
279
- - **Focus**: `ring-ring/50` con `ring-[3px]`
280
- - **Invalid**: `border-destructive` con `ring-destructive/20`
281
- - **Spacing**: `gap-3` default entre item y label
282
-
283
- ## Accesibilidad
284
-
285
- - ✅ **Role**: `role="radio"` y `role="radiogroup"`
286
- - ✅ **ARIA**: `aria-checked`, `aria-disabled`, `aria-invalid`
287
- - ✅ **Keyboard**: Arrow keys para navegar, Space para seleccionar
288
- - ✅ **Label**: Asociar con `htmlFor` e `id`
289
- - ✅ **Focus**: Focus ring visible en navegación por teclado
290
-
291
- ## Notas de Implementación
292
-
293
- - **Radix UI**: Basado en `@radix-ui/react-radio-group`
294
- - **Indicador**: Usa `CircleIcon` de lucide-react con `fill-primary`
295
- - **Grid layout**: Default usa `grid gap-3` para vertical spacing
296
- - **Data attributes**: `data-slot` para identificar componentes
297
- - **Controlled**: Usa `value` + `onValueChange`
298
- - **Uncontrolled**: Usa `defaultValue`
299
-
300
- ## Troubleshooting
301
-
302
- **No se puede seleccionar**: Verifica que cada item tenga `value` único
303
- **Label no clickeable**: Asegura `htmlFor` en Label coincida con `id` del RadioGroupItem
304
- **Grupo deshabilitado**: `disabled` en RadioGroup deshabilita todos los items
305
- **Item individual disabled**: `disabled` en RadioGroupItem específico
306
- **Estado no actualiza**: En modo controlado usa `value` + `onValueChange`, no `defaultValue`
307
-
308
- ## Referencias
309
-
310
- - **Radix UI Radio Group**: <https://www.radix-ui.com/primitives/docs/components/radio-group>
311
- - **shadcn/ui Radio Group**: <https://ui.shadcn.com/docs/components/radio-group>
1
+ # Radio Group
2
+
3
+ Grupo de opciones mutuamente excluyentes. Usuario selecciona una opción. Basado en Radix UI.
4
+
5
+ ## Descripción
6
+
7
+ El componente `RadioGroup` permite seleccionar una opción de un conjunto de opciones mutuamente excluyentes.
8
+
9
+ ## Importación
10
+
11
+ ```typescript
12
+ import { RadioGroup, RadioGroupItem } from "@adamosuiteservices/ui/radio-group";
13
+ ```
14
+
15
+ ## Anatomía
16
+
17
+ ```tsx
18
+ <RadioGroup defaultValue="option-one">
19
+ <div className="flex items-center space-x-2">
20
+ <RadioGroupItem value="option-one" id="option-one" />
21
+ <Label htmlFor="option-one">Option One</Label>
22
+ </div>
23
+ <div className="flex items-center space-x-2">
24
+ <RadioGroupItem value="option-two" id="option-two" />
25
+ <Label htmlFor="option-two">Option Two</Label>
26
+ </div>
27
+ </RadioGroup>
28
+ ```
29
+
30
+ **Componentes**: 2 (RadioGroup, RadioGroupItem)
31
+
32
+ ## Props
33
+
34
+ ### RadioGroup
35
+
36
+ | Prop | Tipo | Descripción |
37
+ | --------------- | ------------------------- | ------------------------------ |
38
+ | `defaultValue` | `string` | Valor inicial (uncontrolled) |
39
+ | `value` | `string` | Valor controlado |
40
+ | `onValueChange` | `(value: string) => void` | Callback al cambiar valor |
41
+ | `disabled` | `boolean` | Deshabilita todo el grupo |
42
+ | `required` | `boolean` | Campo requerido |
43
+ | `name` | `string` | Nombre del grupo (formularios) |
44
+ | `className` | `string` | Clases CSS adicionales |
45
+
46
+ **Nota**: Acepta todas las props de Radix UI RadioGroup.Root
47
+
48
+ ### RadioGroupItem
49
+
50
+ | Prop | Tipo | Descripción |
51
+ | ----------- | --------- | ------------------------- |
52
+ | `value` | `string` | Valor único del item |
53
+ | `id` | `string` | ID para asociar con Label |
54
+ | `disabled` | `boolean` | Deshabilita este item |
55
+ | `className` | `string` | Clases CSS adicionales |
56
+
57
+ **Nota**: Acepta todas las props de Radix UI RadioGroup.Item
58
+
59
+ ## Patrones de Uso
60
+
61
+ ### Básico
62
+
63
+ ```tsx
64
+ import { RadioGroup, RadioGroupItem } from "@adamosuiteservices/ui/radio-group";
65
+ import { Label } from "@adamosuiteservices/ui/label";
66
+
67
+ <RadioGroup defaultValue="option-one">
68
+ <div className="flex items-center gap-3">
69
+ <RadioGroupItem value="option-one" id="option-one" />
70
+ <Label htmlFor="option-one">Option One</Label>
71
+ </div>
72
+ <div className="flex items-center gap-3">
73
+ <RadioGroupItem value="option-two" id="option-two" />
74
+ <Label htmlFor="option-two">Option Two</Label>
75
+ </div>
76
+ </RadioGroup>;
77
+ ```
78
+
79
+ ### Controlado
80
+
81
+ ```tsx
82
+ import { useState } from "react";
83
+
84
+ function App() {
85
+ const [value, setValue] = useState("red");
86
+
87
+ return (
88
+ <RadioGroup value={value} onValueChange={setValue}>
89
+ <div className="flex items-center gap-3">
90
+ <RadioGroupItem value="red" id="red" />
91
+ <Label htmlFor="red">Red</Label>
92
+ </div>
93
+ <div className="flex items-center gap-3">
94
+ <RadioGroupItem value="green" id="green" />
95
+ <Label htmlFor="green">Green</Label>
96
+ </div>
97
+ </RadioGroup>
98
+ );
99
+ }
100
+ ```
101
+
102
+ ### Con Descripciones
103
+
104
+ ```tsx
105
+ <RadioGroup defaultValue="comfortable">
106
+ <div className="flex items-start gap-3">
107
+ <RadioGroupItem value="default" id="default" />
108
+ <div className="grid gap-2">
109
+ <Label htmlFor="default">Default</Label>
110
+ <p className="text-muted-foreground text-sm">
111
+ Recommended for most users. Provides a balanced experience.
112
+ </p>
113
+ </div>
114
+ </div>
115
+ <div className="flex items-start gap-3">
116
+ <RadioGroupItem value="comfortable" id="comfortable" />
117
+ <div className="grid gap-2">
118
+ <Label htmlFor="comfortable">Comfortable</Label>
119
+ <p className="text-muted-foreground text-sm">
120
+ More spacing and larger elements for better accessibility.
121
+ </p>
122
+ </div>
123
+ </div>
124
+ </RadioGroup>
125
+ ```
126
+
127
+ ### Layout Horizontal
128
+
129
+ ```tsx
130
+ <RadioGroup defaultValue="medium" className="flex gap-6">
131
+ <div className="flex items-center gap-2">
132
+ <RadioGroupItem value="small" id="small" />
133
+ <Label htmlFor="small">Small</Label>
134
+ </div>
135
+ <div className="flex items-center gap-2">
136
+ <RadioGroupItem value="medium" id="medium" />
137
+ <Label htmlFor="medium">Medium</Label>
138
+ </div>
139
+ <div className="flex items-center gap-2">
140
+ <RadioGroupItem value="large" id="large" />
141
+ <Label htmlFor="large">Large</Label>
142
+ </div>
143
+ </RadioGroup>
144
+ ```
145
+
146
+ ### Con Badges
147
+
148
+ ```tsx
149
+ import { Badge } from "@adamosuiteservices/ui/badge";
150
+
151
+ <RadioGroup defaultValue="pro">
152
+ <div className="flex items-center gap-3">
153
+ <RadioGroupItem value="free" id="free" />
154
+ <div className="flex items-center gap-2">
155
+ <Label htmlFor="free">Free Plan</Label>
156
+ <Badge variant="secondary">$0/month</Badge>
157
+ </div>
158
+ </div>
159
+ <div className="flex items-center gap-3">
160
+ <RadioGroupItem value="pro" id="pro" />
161
+ <div className="flex items-center gap-2">
162
+ <Label htmlFor="pro">Pro Plan</Label>
163
+ <Badge variant="default">$9/month</Badge>
164
+ </div>
165
+ </div>
166
+ </RadioGroup>;
167
+ ```
168
+
169
+ ### En Formularios
170
+
171
+ ```tsx
172
+ import { Button } from "@adamosuiteservices/ui/button";
173
+
174
+ function App() {
175
+ const [formData, setFormData] = useState({
176
+ notification: "email",
177
+ frequency: "weekly",
178
+ });
179
+
180
+ const handleSubmit = (e: React.FormEvent) => {
181
+ e.preventDefault();
182
+ console.log("Form submitted:", formData);
183
+ };
184
+
185
+ return (
186
+ <form onSubmit={handleSubmit} className="space-y-6">
187
+ <div className="space-y-3">
188
+ <p className="text-sm font-medium">Notification method</p>
189
+ <RadioGroup
190
+ value={formData.notification}
191
+ onValueChange={(value) =>
192
+ setFormData((prev) => ({ ...prev, notification: value }))
193
+ }
194
+ >
195
+ <div className="flex items-center gap-3">
196
+ <RadioGroupItem value="email" id="email" />
197
+ <Label htmlFor="email">Email notifications</Label>
198
+ </div>
199
+ <div className="flex items-center gap-3">
200
+ <RadioGroupItem value="sms" id="sms" />
201
+ <Label htmlFor="sms">SMS notifications</Label>
202
+ </div>
203
+ </RadioGroup>
204
+ </div>
205
+ <Button type="submit">Save preferences</Button>
206
+ </form>
207
+ );
208
+ }
209
+ ```
210
+
211
+ ### Nested (Conditional)
212
+
213
+ ```tsx
214
+ function App() {
215
+ const [paymentMethod, setPaymentMethod] = useState("card");
216
+ const [cardType, setCardType] = useState("visa");
217
+
218
+ return (
219
+ <div className="space-y-6">
220
+ <RadioGroup value={paymentMethod} onValueChange={setPaymentMethod}>
221
+ <div className="flex items-center gap-3">
222
+ <RadioGroupItem value="card" id="card" />
223
+ <Label htmlFor="card">Credit/Debit Card</Label>
224
+ </div>
225
+ <div className="flex items-center gap-3">
226
+ <RadioGroupItem value="bank" id="bank" />
227
+ <Label htmlFor="bank">Bank Transfer</Label>
228
+ </div>
229
+ </RadioGroup>
230
+
231
+ {paymentMethod === "card" && (
232
+ <div className="ml-6 space-y-3">
233
+ <p className="text-sm font-medium">Card type</p>
234
+ <RadioGroup value={cardType} onValueChange={setCardType}>
235
+ <div className="flex items-center gap-3">
236
+ <RadioGroupItem value="visa" id="visa" />
237
+ <Label htmlFor="visa">Visa</Label>
238
+ </div>
239
+ <div className="flex items-center gap-3">
240
+ <RadioGroupItem value="mastercard" id="mastercard" />
241
+ <Label htmlFor="mastercard">Mastercard</Label>
242
+ </div>
243
+ </RadioGroup>
244
+ </div>
245
+ )}
246
+ </div>
247
+ );
248
+ }
249
+ ```
250
+
251
+ ### Deshabilitado
252
+
253
+ ```tsx
254
+ <RadioGroup defaultValue="option-one" disabled>
255
+ <div className="flex items-center gap-3">
256
+ <RadioGroupItem value="option-one" id="disabled-one" />
257
+ <Label htmlFor="disabled-one">Option One</Label>
258
+ </div>
259
+ <div className="flex items-center gap-3">
260
+ <RadioGroupItem value="option-two" id="disabled-two" />
261
+ <Label htmlFor="disabled-two">Option Two</Label>
262
+ </div>
263
+ </RadioGroup>
264
+ ```
265
+
266
+ ## Casos de Uso
267
+
268
+ **Opciones mutuamente excluyentes**: Una sola selección de múltiples opciones
269
+ **Settings**: Preferencias de configuración (theme, size, mode)
270
+ **Formularios**: Selección de método de pago, envío, categoría
271
+ **Surveys**: Preguntas con opciones de respuesta única
272
+ **Filtros**: Filtrado por categoría, tipo, estado
273
+
274
+ ## Estilos Base
275
+
276
+ - **Size**: `size-5` (20px)
277
+ - **Border**: `border-input` con `shadow-xs`
278
+ - **Checked**: `CircleIcon` con `fill-primary`
279
+ - **Focus**: `ring-ring/50` con `ring-[3px]`
280
+ - **Invalid**: `border-destructive` con `ring-destructive/20`
281
+ - **Spacing**: `gap-3` default entre item y label
282
+
283
+ ## Accesibilidad
284
+
285
+ - ✅ **Role**: `role="radio"` y `role="radiogroup"`
286
+ - ✅ **ARIA**: `aria-checked`, `aria-disabled`, `aria-invalid`
287
+ - ✅ **Keyboard**: Arrow keys para navegar, Space para seleccionar
288
+ - ✅ **Label**: Asociar con `htmlFor` e `id`
289
+ - ✅ **Focus**: Focus ring visible en navegación por teclado
290
+
291
+ ## Notas de Implementación
292
+
293
+ - **Radix UI**: Basado en `@radix-ui/react-radio-group`
294
+ - **Indicador**: Usa `CircleIcon` de lucide-react con `fill-primary`
295
+ - **Grid layout**: Default usa `grid gap-3` para vertical spacing
296
+ - **Data attributes**: `data-slot` para identificar componentes
297
+ - **Controlled**: Usa `value` + `onValueChange`
298
+ - **Uncontrolled**: Usa `defaultValue`
299
+
300
+ ## Troubleshooting
301
+
302
+ **No se puede seleccionar**: Verifica que cada item tenga `value` único
303
+ **Label no clickeable**: Asegura `htmlFor` en Label coincida con `id` del RadioGroupItem
304
+ **Grupo deshabilitado**: `disabled` en RadioGroup deshabilita todos los items
305
+ **Item individual disabled**: `disabled` en RadioGroupItem específico
306
+ **Estado no actualiza**: En modo controlado usa `value` + `onValueChange`, no `defaultValue`
307
+
308
+ ## Referencias
309
+
310
+ - **Radix UI Radio Group**: <https://www.radix-ui.com/primitives/docs/components/radio-group>
311
+ - **shadcn/ui Radio Group**: <https://ui.shadcn.com/docs/components/radio-group>