@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,434 +1,434 @@
1
- # Kbd
2
-
3
- Representa teclas del teclado con estilo visual. Ideal para documentación, tooltips, atajos de teclado y ayuda contextual.
4
-
5
- ## Descripción
6
-
7
- El componente `Kbd` representa teclas del teclado con estilo visual.
8
-
9
- ## Importación
10
-
11
- ```typescript
12
- import { Kbd, KbdGroup } from "@adamosuiteservices/ui/kbd";
13
- ```
14
-
15
- ## Anatomía
16
-
17
- ```tsx
18
- <p>
19
- Press <Kbd>Ctrl</Kbd> + <Kbd>C</Kbd> to copy
20
- </p>
21
-
22
- <KbdGroup>
23
- <Kbd>⌘</Kbd>
24
- <Kbd>K</Kbd>
25
- </KbdGroup>
26
- ```
27
-
28
- **Componentes**: 2 (Kbd, KbdGroup)
29
-
30
- ## Props
31
-
32
- ### Kbd
33
-
34
- | Prop | Tipo | Descripción |
35
- | ----------- | -------- | ---------------------------------- |
36
- | `className` | `string` | Clases CSS adicionales |
37
- | ...props | - | Todas las props nativas de `<kbd>` |
38
-
39
- ### KbdGroup
40
-
41
- | Prop | Tipo | Descripción |
42
- | ----------- | -------- | ---------------------------------- |
43
- | `className` | `string` | Clases CSS adicionales |
44
- | ...props | - | Todas las props nativas de `<div>` |
45
-
46
- ## Patrones de Uso
47
-
48
- ### Básico
49
-
50
- ```tsx
51
- <div className="flex items-center gap-4">
52
- <Kbd>Ctrl</Kbd>
53
- <Kbd>⌘</Kbd>
54
- <Kbd>⇧</Kbd>
55
- <Kbd>⌥</Kbd>
56
- <Kbd>⌃</Kbd>
57
- </div>
58
- ```
59
-
60
- ### Con Modificadores
61
-
62
- ```tsx
63
- <KbdGroup>
64
- <Kbd>Ctrl</Kbd>
65
- <span>+</span>
66
- <Kbd>B</Kbd>
67
- </KbdGroup>
68
-
69
- <KbdGroup>
70
- <Kbd>Ctrl</Kbd>
71
- <span>+</span>
72
- <Kbd>Shift</Kbd>
73
- <span>+</span>
74
- <Kbd>P</Kbd>
75
- </KbdGroup>
76
- ```
77
-
78
- ### Inline con Texto
79
-
80
- ```tsx
81
- <p className="text-sm text-muted-foreground">
82
- Use{" "}
83
- <KbdGroup>
84
- <Kbd>Ctrl</Kbd>
85
- <Kbd>K</Kbd>
86
- </KbdGroup>{" "}
87
- to open the command palette
88
- </p>
89
-
90
- <p className="text-sm">
91
- Press{" "}
92
- <KbdGroup>
93
- <Kbd>⌘</Kbd>
94
- <Kbd>K</Kbd>
95
- </KbdGroup>{" "}
96
- to search
97
- </p>
98
- ```
99
-
100
- ### En Botones
101
-
102
- ```tsx
103
- import { Button } from "@adamosuiteservices/ui/button";
104
-
105
- <Button variant="outline" size="sm" className="pr-2">
106
- Accept <Kbd>⏎</Kbd>
107
- </Button>
108
-
109
- <Button variant="outline" size="sm" className="pr-2">
110
- Cancel <Kbd>Esc</Kbd>
111
- </Button>
112
-
113
- <Button variant="outline" size="sm" className="pr-2">
114
- Save <Kbd>⌘</Kbd><Kbd>S</Kbd>
115
- </Button>
116
- ```
117
-
118
- ### En Tooltips
119
-
120
- ```tsx
121
- import { Tooltip, TooltipContent, TooltipTrigger } from "@adamosuiteservices/ui/tooltip";
122
- import { Button } from "@adamosuiteservices/ui/button";
123
-
124
- <Tooltip>
125
- <TooltipTrigger asChild>
126
- <Button size="sm" variant="outline">
127
- Save
128
- </Button>
129
- </TooltipTrigger>
130
- <TooltipContent>
131
- <div className="flex items-center gap-2">
132
- Save Changes <Kbd>S</Kbd>
133
- </div>
134
- </TooltipContent>
135
- </Tooltip>
136
-
137
- <Tooltip>
138
- <TooltipTrigger asChild>
139
- <Button size="sm" variant="outline">
140
- Copy
141
- </Button>
142
- </TooltipTrigger>
143
- <TooltipContent>
144
- <div className="flex items-center gap-2">
145
- Copy Selection{" "}
146
- <KbdGroup>
147
- <Kbd>⌘</Kbd>
148
- <Kbd>C</Kbd>
149
- </KbdGroup>
150
- </div>
151
- </TooltipContent>
152
- </Tooltip>
153
- ```
154
-
155
- ### En Input Group
156
-
157
- ```tsx
158
- import { InputGroup, InputGroupInput, InputGroupAddon } from "@adamosuiteservices/ui/input-group";
159
- import { Search } from "lucide-react";
160
-
161
- <InputGroup>
162
- <InputGroupInput placeholder="Search..." />
163
- <InputGroupAddon>
164
- <Search />
165
- </InputGroupAddon>
166
- <InputGroupAddon align="inline-end">
167
- <Kbd>⌘</Kbd>
168
- <Kbd>K</Kbd>
169
- </InputGroupAddon>
170
- </InputGroup>
171
-
172
- <InputGroup>
173
- <InputGroupInput placeholder="Quick actions..." />
174
- <InputGroupAddon align="inline-end">
175
- <KbdGroup>
176
- <Kbd>Ctrl</Kbd>
177
- <Kbd>Space</Kbd>
178
- </KbdGroup>
179
- </InputGroupAddon>
180
- </InputGroup>
181
- ```
182
-
183
- ### Teclas de Navegación
184
-
185
- ```tsx
186
- <div className="flex flex-col gap-2">
187
- <h4 className="text-sm font-medium">Arrow Keys</h4>
188
- <div className="flex gap-2">
189
- <Kbd>↑</Kbd>
190
- <Kbd>↓</Kbd>
191
- <Kbd>←</Kbd>
192
- <Kbd>→</Kbd>
193
- </div>
194
- </div>
195
-
196
- <div className="flex flex-col gap-2">
197
- <h4 className="text-sm font-medium">Special Keys</h4>
198
- <div className="flex gap-2">
199
- <Kbd>Tab</Kbd>
200
- <Kbd>Space</Kbd>
201
- <Kbd>Enter</Kbd>
202
- </div>
203
- </div>
204
-
205
- <div className="flex flex-col gap-2">
206
- <h4 className="text-sm font-medium">Function Keys</h4>
207
- <div className="flex gap-2">
208
- <Kbd>F1</Kbd>
209
- <Kbd>F2</Kbd>
210
- <Kbd>F12</Kbd>
211
- </div>
212
- </div>
213
- ```
214
-
215
- ### Atajos Complejos con Descripciones
216
-
217
- ```tsx
218
- <div className="flex flex-col gap-4">
219
- <div className="flex flex-col gap-2">
220
- <h4 className="text-sm font-medium">Editor Shortcuts</h4>
221
- <div className="flex flex-col gap-2 text-sm">
222
- <div className="flex items-center justify-between">
223
- <span>Duplicate line</span>
224
- <KbdGroup>
225
- <Kbd>Shift</Kbd>
226
- <Kbd>Alt</Kbd>
227
- <Kbd>↓</Kbd>
228
- </KbdGroup>
229
- </div>
230
- <div className="flex items-center justify-between">
231
- <span>Multi-cursor</span>
232
- <KbdGroup>
233
- <Kbd>Ctrl</Kbd>
234
- <Kbd>Alt</Kbd>
235
- <Kbd>↓</Kbd>
236
- </KbdGroup>
237
- </div>
238
- <div className="flex items-center justify-between">
239
- <span>Go to definition</span>
240
- <KbdGroup>
241
- <Kbd>F12</Kbd>
242
- </KbdGroup>
243
- </div>
244
- </div>
245
- </div>
246
-
247
- <div className="flex flex-col gap-2">
248
- <h4 className="text-sm font-medium">Browser Shortcuts</h4>
249
- <div className="flex flex-col gap-2 text-sm">
250
- <div className="flex items-center justify-between">
251
- <span>New tab</span>
252
- <KbdGroup>
253
- <Kbd>Ctrl</Kbd>
254
- <Kbd>T</Kbd>
255
- </KbdGroup>
256
- </div>
257
- <div className="flex items-center justify-between">
258
- <span>Hard refresh</span>
259
- <KbdGroup>
260
- <Kbd>Ctrl</Kbd>
261
- <Kbd>Shift</Kbd>
262
- <Kbd>R</Kbd>
263
- </KbdGroup>
264
- </div>
265
- </div>
266
- </div>
267
- </div>
268
- ```
269
-
270
- ### Con Iconos
271
-
272
- ```tsx
273
- import { Save, Copy, Settings } from "lucide-react";
274
-
275
- <div className="flex items-center gap-4">
276
- <Kbd><Save className="size-3" /></Kbd>
277
- <Kbd><Copy className="size-3" /></Kbd>
278
- <Kbd><Settings className="size-3" /></Kbd>
279
- </div>
280
-
281
- <div className="flex items-center gap-2">
282
- <span className="text-sm">Quick actions:</span>
283
- <KbdGroup>
284
- <Kbd><Save className="size-3" /></Kbd>
285
- <Kbd>S</Kbd>
286
- </KbdGroup>
287
- <KbdGroup>
288
- <Kbd><Copy className="size-3" /></Kbd>
289
- <Kbd>C</Kbd>
290
- </KbdGroup>
291
- </div>
292
- ```
293
-
294
- ### En Contexto (Cards)
295
-
296
- ```tsx
297
- <div className="rounded-lg border p-4">
298
- <h3 className="text-lg font-semibold mb-2">Command Palette</h3>
299
- <p className="text-sm text-muted-foreground mb-4">
300
- Quickly access commands and navigate your workspace.
301
- </p>
302
- <div className="flex items-center gap-2 text-sm">
303
- <span>Open with</span>
304
- <KbdGroup>
305
- <Kbd>⌘</Kbd>
306
- <Kbd>K</Kbd>
307
- </KbdGroup>
308
- <span>or</span>
309
- <KbdGroup>
310
- <Kbd>Ctrl</Kbd>
311
- <Kbd>Shift</Kbd>
312
- <Kbd>P</Kbd>
313
- </KbdGroup>
314
- </div>
315
- </div>
316
- ```
317
-
318
- ## Casos de Uso Comunes
319
-
320
- **Documentation**: Documentar atajos de teclado en docs
321
- **Tooltips**: Mostrar shortcuts en tooltips de botones
322
- **Help sections**: Secciones de ayuda con atajos
323
- **Command palettes**: Mostrar shortcuts junto a comandos
324
- **Onboarding**: Tutoriales con atajos de teclado
325
- **Input hints**: Hints en inputs (ej: "Press ⌘K to search")
326
-
327
- ## Estilos Base
328
-
329
- ### Estilos Kbd
330
-
331
- - **Background**: `bg-muted`
332
- - **Color**: `text-muted-foreground`
333
- - **Height**: `h-5` (~20px)
334
- - **Min Width**: `min-w-5` (square mínimo)
335
- - **Padding**: `px-1`
336
- - **Font**: `font-sans text-xs font-medium`
337
- - **Border**: `rounded-sm`
338
- - **Select**: `select-none`, `pointer-events-none`
339
- - **SVG**: Auto-sized to `size-3` si no tiene clase
340
-
341
- ### Estilos KbdGroup
342
-
343
- - **Display**: `inline-flex`
344
- - **Align**: `items-center`
345
- - **Gap**: `gap-1`
346
-
347
- ### Tooltip Context
348
-
349
- Cuando está dentro de Tooltip:
350
-
351
- - **Background**: `bg-background/20`
352
- - **Color**: `text-background`
353
- - **Dark mode**: `dark:bg-background/10`
354
-
355
- ## Símbolos Comunes
356
-
357
- ### Modificadores Mac
358
-
359
- - `⌘` - Command
360
- - `⇧` - Shift
361
- - `⌥` - Option/Alt
362
- - `⌃` - Control
363
- - `⏎` - Return
364
- - `⌫` - Delete
365
-
366
- ### Flechas
367
-
368
- - `↑` - Up
369
- - `↓` - Down
370
- - `←` - Left
371
- - `→` - Right
372
-
373
- ### Otros
374
-
375
- - `⎵` - Space
376
- - `⇥` - Tab
377
- - `⎋` - Escape
378
-
379
- ## Accesibilidad
380
-
381
- - ✅ **Semantic HTML**: Usa `<kbd>` nativo (semántico)
382
- - ✅ **Non-interactive**: `pointer-events-none` por defecto
383
- - ✅ **Screen readers**: Texto es leído normalmente
384
- - ✅ **No focus**: No recibe focus (solo visual)
385
- - ⚠️ **Context**: Siempre acompaña con texto descriptivo
386
-
387
- ## Notas de Implementación
388
-
389
- - **HTML nativo**: Basado en `<kbd>` elemento nativo
390
- - **KbdGroup**: Es un `<kbd>` contenedor, no `<div>` (semántico)
391
- - **Auto-sizing**: SVGs se redimensionan automáticamente a `size-3`
392
- - **Tooltip-aware**: Estilos especiales cuando está dentro de Tooltip
393
- - **Non-interactive**: No recibe eventos de pointer por defecto
394
- - **Select-none**: No se puede seleccionar texto
395
- - **Monospace**: Usa `font-sans` no monospace
396
- - **Min square**: `min-w-5` asegura que single chars sean cuadrados
397
-
398
- ## KbdGroup vs Multiple Kbd
399
-
400
- ```tsx
401
- {
402
- /* Con KbdGroup - semanticamente agrupados */
403
- }
404
- <KbdGroup>
405
- <Kbd>Ctrl</Kbd>
406
- <Kbd>K</Kbd>
407
- </KbdGroup>;
408
-
409
- {
410
- /* Sin KbdGroup - separados */
411
- }
412
- <span>
413
- <Kbd>Ctrl</Kbd> + <Kbd>K</Kbd>
414
- </span>;
415
- ```
416
-
417
- **Usa KbdGroup cuando**: Las teclas se presionan simultáneamente (shortcut)
418
- **No uses KbdGroup cuando**: Las teclas son alternativas o secuenciales
419
-
420
- ## Troubleshooting
421
-
422
- **Kbd no se ve**: Verifica que tenga contenido (texto o icono)
423
- **Tamaño inconsistente**: Usa `min-w-5` para asegurar cuadrado en single chars
424
- **Icono muy grande**: Los SVGs se redimensionan automáticamente a `size-3`
425
- **No se ve en Tooltip**: Los estilos de Tooltip aplican automáticamente
426
- **Spacing inconsistente**: KbdGroup tiene `gap-1`, ajusta con className si necesario
427
- **Seleccionable**: Verifica que tenga `select-none` aplicado
428
- **Background no se ve**: Verifica tema y color `bg-muted`
429
- **Muy alto**: Altura fija `h-5`, no cambies sin ajustar padding
430
-
431
- ## Referencias
432
-
433
- - **MDN Kbd**: <https://developer.mozilla.org/en-US/docs/Web/HTML/Element/kbd>
434
- - **Unicode Symbols**: <https://www.unicode.org/charts/>
1
+ # Kbd
2
+
3
+ Representa teclas del teclado con estilo visual. Ideal para documentación, tooltips, atajos de teclado y ayuda contextual.
4
+
5
+ ## Descripción
6
+
7
+ El componente `Kbd` representa teclas del teclado con estilo visual.
8
+
9
+ ## Importación
10
+
11
+ ```typescript
12
+ import { Kbd, KbdGroup } from "@adamosuiteservices/ui/kbd";
13
+ ```
14
+
15
+ ## Anatomía
16
+
17
+ ```tsx
18
+ <p>
19
+ Press <Kbd>Ctrl</Kbd> + <Kbd>C</Kbd> to copy
20
+ </p>
21
+
22
+ <KbdGroup>
23
+ <Kbd>⌘</Kbd>
24
+ <Kbd>K</Kbd>
25
+ </KbdGroup>
26
+ ```
27
+
28
+ **Componentes**: 2 (Kbd, KbdGroup)
29
+
30
+ ## Props
31
+
32
+ ### Kbd
33
+
34
+ | Prop | Tipo | Descripción |
35
+ | ----------- | -------- | ---------------------------------- |
36
+ | `className` | `string` | Clases CSS adicionales |
37
+ | ...props | - | Todas las props nativas de `<kbd>` |
38
+
39
+ ### KbdGroup
40
+
41
+ | Prop | Tipo | Descripción |
42
+ | ----------- | -------- | ---------------------------------- |
43
+ | `className` | `string` | Clases CSS adicionales |
44
+ | ...props | - | Todas las props nativas de `<div>` |
45
+
46
+ ## Patrones de Uso
47
+
48
+ ### Básico
49
+
50
+ ```tsx
51
+ <div className="flex items-center gap-4">
52
+ <Kbd>Ctrl</Kbd>
53
+ <Kbd>⌘</Kbd>
54
+ <Kbd>⇧</Kbd>
55
+ <Kbd>⌥</Kbd>
56
+ <Kbd>⌃</Kbd>
57
+ </div>
58
+ ```
59
+
60
+ ### Con Modificadores
61
+
62
+ ```tsx
63
+ <KbdGroup>
64
+ <Kbd>Ctrl</Kbd>
65
+ <span>+</span>
66
+ <Kbd>B</Kbd>
67
+ </KbdGroup>
68
+
69
+ <KbdGroup>
70
+ <Kbd>Ctrl</Kbd>
71
+ <span>+</span>
72
+ <Kbd>Shift</Kbd>
73
+ <span>+</span>
74
+ <Kbd>P</Kbd>
75
+ </KbdGroup>
76
+ ```
77
+
78
+ ### Inline con Texto
79
+
80
+ ```tsx
81
+ <p className="text-sm text-muted-foreground">
82
+ Use{" "}
83
+ <KbdGroup>
84
+ <Kbd>Ctrl</Kbd>
85
+ <Kbd>K</Kbd>
86
+ </KbdGroup>{" "}
87
+ to open the command palette
88
+ </p>
89
+
90
+ <p className="text-sm">
91
+ Press{" "}
92
+ <KbdGroup>
93
+ <Kbd>⌘</Kbd>
94
+ <Kbd>K</Kbd>
95
+ </KbdGroup>{" "}
96
+ to search
97
+ </p>
98
+ ```
99
+
100
+ ### En Botones
101
+
102
+ ```tsx
103
+ import { Button } from "@adamosuiteservices/ui/button";
104
+
105
+ <Button variant="outline" size="sm" className="pr-2">
106
+ Accept <Kbd>⏎</Kbd>
107
+ </Button>
108
+
109
+ <Button variant="outline" size="sm" className="pr-2">
110
+ Cancel <Kbd>Esc</Kbd>
111
+ </Button>
112
+
113
+ <Button variant="outline" size="sm" className="pr-2">
114
+ Save <Kbd>⌘</Kbd><Kbd>S</Kbd>
115
+ </Button>
116
+ ```
117
+
118
+ ### En Tooltips
119
+
120
+ ```tsx
121
+ import { Tooltip, TooltipContent, TooltipTrigger } from "@adamosuiteservices/ui/tooltip";
122
+ import { Button } from "@adamosuiteservices/ui/button";
123
+
124
+ <Tooltip>
125
+ <TooltipTrigger asChild>
126
+ <Button size="sm" variant="outline">
127
+ Save
128
+ </Button>
129
+ </TooltipTrigger>
130
+ <TooltipContent>
131
+ <div className="flex items-center gap-2">
132
+ Save Changes <Kbd>S</Kbd>
133
+ </div>
134
+ </TooltipContent>
135
+ </Tooltip>
136
+
137
+ <Tooltip>
138
+ <TooltipTrigger asChild>
139
+ <Button size="sm" variant="outline">
140
+ Copy
141
+ </Button>
142
+ </TooltipTrigger>
143
+ <TooltipContent>
144
+ <div className="flex items-center gap-2">
145
+ Copy Selection{" "}
146
+ <KbdGroup>
147
+ <Kbd>⌘</Kbd>
148
+ <Kbd>C</Kbd>
149
+ </KbdGroup>
150
+ </div>
151
+ </TooltipContent>
152
+ </Tooltip>
153
+ ```
154
+
155
+ ### En Input Group
156
+
157
+ ```tsx
158
+ import { InputGroup, InputGroupInput, InputGroupAddon } from "@adamosuiteservices/ui/input-group";
159
+ import { Search } from "lucide-react";
160
+
161
+ <InputGroup>
162
+ <InputGroupInput placeholder="Search..." />
163
+ <InputGroupAddon>
164
+ <Search />
165
+ </InputGroupAddon>
166
+ <InputGroupAddon align="inline-end">
167
+ <Kbd>⌘</Kbd>
168
+ <Kbd>K</Kbd>
169
+ </InputGroupAddon>
170
+ </InputGroup>
171
+
172
+ <InputGroup>
173
+ <InputGroupInput placeholder="Quick actions..." />
174
+ <InputGroupAddon align="inline-end">
175
+ <KbdGroup>
176
+ <Kbd>Ctrl</Kbd>
177
+ <Kbd>Space</Kbd>
178
+ </KbdGroup>
179
+ </InputGroupAddon>
180
+ </InputGroup>
181
+ ```
182
+
183
+ ### Teclas de Navegación
184
+
185
+ ```tsx
186
+ <div className="flex flex-col gap-2">
187
+ <h4 className="text-sm font-medium">Arrow Keys</h4>
188
+ <div className="flex gap-2">
189
+ <Kbd>↑</Kbd>
190
+ <Kbd>↓</Kbd>
191
+ <Kbd>←</Kbd>
192
+ <Kbd>→</Kbd>
193
+ </div>
194
+ </div>
195
+
196
+ <div className="flex flex-col gap-2">
197
+ <h4 className="text-sm font-medium">Special Keys</h4>
198
+ <div className="flex gap-2">
199
+ <Kbd>Tab</Kbd>
200
+ <Kbd>Space</Kbd>
201
+ <Kbd>Enter</Kbd>
202
+ </div>
203
+ </div>
204
+
205
+ <div className="flex flex-col gap-2">
206
+ <h4 className="text-sm font-medium">Function Keys</h4>
207
+ <div className="flex gap-2">
208
+ <Kbd>F1</Kbd>
209
+ <Kbd>F2</Kbd>
210
+ <Kbd>F12</Kbd>
211
+ </div>
212
+ </div>
213
+ ```
214
+
215
+ ### Atajos Complejos con Descripciones
216
+
217
+ ```tsx
218
+ <div className="flex flex-col gap-4">
219
+ <div className="flex flex-col gap-2">
220
+ <h4 className="text-sm font-medium">Editor Shortcuts</h4>
221
+ <div className="flex flex-col gap-2 text-sm">
222
+ <div className="flex items-center justify-between">
223
+ <span>Duplicate line</span>
224
+ <KbdGroup>
225
+ <Kbd>Shift</Kbd>
226
+ <Kbd>Alt</Kbd>
227
+ <Kbd>↓</Kbd>
228
+ </KbdGroup>
229
+ </div>
230
+ <div className="flex items-center justify-between">
231
+ <span>Multi-cursor</span>
232
+ <KbdGroup>
233
+ <Kbd>Ctrl</Kbd>
234
+ <Kbd>Alt</Kbd>
235
+ <Kbd>↓</Kbd>
236
+ </KbdGroup>
237
+ </div>
238
+ <div className="flex items-center justify-between">
239
+ <span>Go to definition</span>
240
+ <KbdGroup>
241
+ <Kbd>F12</Kbd>
242
+ </KbdGroup>
243
+ </div>
244
+ </div>
245
+ </div>
246
+
247
+ <div className="flex flex-col gap-2">
248
+ <h4 className="text-sm font-medium">Browser Shortcuts</h4>
249
+ <div className="flex flex-col gap-2 text-sm">
250
+ <div className="flex items-center justify-between">
251
+ <span>New tab</span>
252
+ <KbdGroup>
253
+ <Kbd>Ctrl</Kbd>
254
+ <Kbd>T</Kbd>
255
+ </KbdGroup>
256
+ </div>
257
+ <div className="flex items-center justify-between">
258
+ <span>Hard refresh</span>
259
+ <KbdGroup>
260
+ <Kbd>Ctrl</Kbd>
261
+ <Kbd>Shift</Kbd>
262
+ <Kbd>R</Kbd>
263
+ </KbdGroup>
264
+ </div>
265
+ </div>
266
+ </div>
267
+ </div>
268
+ ```
269
+
270
+ ### Con Iconos
271
+
272
+ ```tsx
273
+ import { Save, Copy, Settings } from "lucide-react";
274
+
275
+ <div className="flex items-center gap-4">
276
+ <Kbd><Save className="size-3" /></Kbd>
277
+ <Kbd><Copy className="size-3" /></Kbd>
278
+ <Kbd><Settings className="size-3" /></Kbd>
279
+ </div>
280
+
281
+ <div className="flex items-center gap-2">
282
+ <span className="text-sm">Quick actions:</span>
283
+ <KbdGroup>
284
+ <Kbd><Save className="size-3" /></Kbd>
285
+ <Kbd>S</Kbd>
286
+ </KbdGroup>
287
+ <KbdGroup>
288
+ <Kbd><Copy className="size-3" /></Kbd>
289
+ <Kbd>C</Kbd>
290
+ </KbdGroup>
291
+ </div>
292
+ ```
293
+
294
+ ### En Contexto (Cards)
295
+
296
+ ```tsx
297
+ <div className="rounded-lg border p-4">
298
+ <h3 className="text-lg font-semibold mb-2">Command Palette</h3>
299
+ <p className="text-sm text-muted-foreground mb-4">
300
+ Quickly access commands and navigate your workspace.
301
+ </p>
302
+ <div className="flex items-center gap-2 text-sm">
303
+ <span>Open with</span>
304
+ <KbdGroup>
305
+ <Kbd>⌘</Kbd>
306
+ <Kbd>K</Kbd>
307
+ </KbdGroup>
308
+ <span>or</span>
309
+ <KbdGroup>
310
+ <Kbd>Ctrl</Kbd>
311
+ <Kbd>Shift</Kbd>
312
+ <Kbd>P</Kbd>
313
+ </KbdGroup>
314
+ </div>
315
+ </div>
316
+ ```
317
+
318
+ ## Casos de Uso Comunes
319
+
320
+ **Documentation**: Documentar atajos de teclado en docs
321
+ **Tooltips**: Mostrar shortcuts en tooltips de botones
322
+ **Help sections**: Secciones de ayuda con atajos
323
+ **Command palettes**: Mostrar shortcuts junto a comandos
324
+ **Onboarding**: Tutoriales con atajos de teclado
325
+ **Input hints**: Hints en inputs (ej: "Press ⌘K to search")
326
+
327
+ ## Estilos Base
328
+
329
+ ### Estilos Kbd
330
+
331
+ - **Background**: `bg-muted`
332
+ - **Color**: `text-muted-foreground`
333
+ - **Height**: `h-5` (~20px)
334
+ - **Min Width**: `min-w-5` (square mínimo)
335
+ - **Padding**: `px-1`
336
+ - **Font**: `font-sans text-xs font-medium`
337
+ - **Border**: `rounded-sm`
338
+ - **Select**: `select-none`, `pointer-events-none`
339
+ - **SVG**: Auto-sized to `size-3` si no tiene clase
340
+
341
+ ### Estilos KbdGroup
342
+
343
+ - **Display**: `inline-flex`
344
+ - **Align**: `items-center`
345
+ - **Gap**: `gap-1`
346
+
347
+ ### Tooltip Context
348
+
349
+ Cuando está dentro de Tooltip:
350
+
351
+ - **Background**: `bg-background/20`
352
+ - **Color**: `text-background`
353
+ - **Dark mode**: `dark:bg-background/10`
354
+
355
+ ## Símbolos Comunes
356
+
357
+ ### Modificadores Mac
358
+
359
+ - `⌘` - Command
360
+ - `⇧` - Shift
361
+ - `⌥` - Option/Alt
362
+ - `⌃` - Control
363
+ - `⏎` - Return
364
+ - `⌫` - Delete
365
+
366
+ ### Flechas
367
+
368
+ - `↑` - Up
369
+ - `↓` - Down
370
+ - `←` - Left
371
+ - `→` - Right
372
+
373
+ ### Otros
374
+
375
+ - `⎵` - Space
376
+ - `⇥` - Tab
377
+ - `⎋` - Escape
378
+
379
+ ## Accesibilidad
380
+
381
+ - ✅ **Semantic HTML**: Usa `<kbd>` nativo (semántico)
382
+ - ✅ **Non-interactive**: `pointer-events-none` por defecto
383
+ - ✅ **Screen readers**: Texto es leído normalmente
384
+ - ✅ **No focus**: No recibe focus (solo visual)
385
+ - ⚠️ **Context**: Siempre acompaña con texto descriptivo
386
+
387
+ ## Notas de Implementación
388
+
389
+ - **HTML nativo**: Basado en `<kbd>` elemento nativo
390
+ - **KbdGroup**: Es un `<kbd>` contenedor, no `<div>` (semántico)
391
+ - **Auto-sizing**: SVGs se redimensionan automáticamente a `size-3`
392
+ - **Tooltip-aware**: Estilos especiales cuando está dentro de Tooltip
393
+ - **Non-interactive**: No recibe eventos de pointer por defecto
394
+ - **Select-none**: No se puede seleccionar texto
395
+ - **Monospace**: Usa `font-sans` no monospace
396
+ - **Min square**: `min-w-5` asegura que single chars sean cuadrados
397
+
398
+ ## KbdGroup vs Multiple Kbd
399
+
400
+ ```tsx
401
+ {
402
+ /* Con KbdGroup - semanticamente agrupados */
403
+ }
404
+ <KbdGroup>
405
+ <Kbd>Ctrl</Kbd>
406
+ <Kbd>K</Kbd>
407
+ </KbdGroup>;
408
+
409
+ {
410
+ /* Sin KbdGroup - separados */
411
+ }
412
+ <span>
413
+ <Kbd>Ctrl</Kbd> + <Kbd>K</Kbd>
414
+ </span>;
415
+ ```
416
+
417
+ **Usa KbdGroup cuando**: Las teclas se presionan simultáneamente (shortcut)
418
+ **No uses KbdGroup cuando**: Las teclas son alternativas o secuenciales
419
+
420
+ ## Troubleshooting
421
+
422
+ **Kbd no se ve**: Verifica que tenga contenido (texto o icono)
423
+ **Tamaño inconsistente**: Usa `min-w-5` para asegurar cuadrado en single chars
424
+ **Icono muy grande**: Los SVGs se redimensionan automáticamente a `size-3`
425
+ **No se ve en Tooltip**: Los estilos de Tooltip aplican automáticamente
426
+ **Spacing inconsistente**: KbdGroup tiene `gap-1`, ajusta con className si necesario
427
+ **Seleccionable**: Verifica que tenga `select-none` aplicado
428
+ **Background no se ve**: Verifica tema y color `bg-muted`
429
+ **Muy alto**: Altura fija `h-5`, no cambies sin ajustar padding
430
+
431
+ ## Referencias
432
+
433
+ - **MDN Kbd**: <https://developer.mozilla.org/en-US/docs/Web/HTML/Element/kbd>
434
+ - **Unicode Symbols**: <https://www.unicode.org/charts/>