@vowt-tech/ui 0.0.0-stage → 0.177.0

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 (116) hide show
  1. package/README.md +13 -2
  2. package/bin/vowt-ux-ui-design.mjs +483 -0
  3. package/guia/LEIA-PRIMEIRO.md +106 -0
  4. package/guia/VERSAO +1 -0
  5. package/guia/componentes.md +104 -0
  6. package/guia/regras/atualizar.md +136 -0
  7. package/guia/regras/componentes.md +374 -0
  8. package/guia/regras/fundamentos.md +257 -0
  9. package/guia/regras/marca.md +200 -0
  10. package/guia/regras/medidas.md +114 -0
  11. package/guia/regras/regras-de-base.md +85 -0
  12. package/guia/regras/telas/acoes.md +56 -0
  13. package/guia/regras/telas/direcao-ux.md +327 -0
  14. package/guia/regras/telas/padroes.md +58 -0
  15. package/guia/regras/telas/regras.md +171 -0
  16. package/guia/regras/telas/voz.md +134 -0
  17. package/package.json +72 -4
  18. package/src/brand/icons.ts +215 -0
  19. package/src/brand/logo.tsx +288 -0
  20. package/src/components/accordion.tsx +58 -0
  21. package/src/components/ai-orb.tsx +67 -0
  22. package/src/components/alert-dialog.tsx +227 -0
  23. package/src/components/alert.tsx +128 -0
  24. package/src/components/area-chart.tsx +180 -0
  25. package/src/components/attachment.tsx +339 -0
  26. package/src/components/avatar.tsx +197 -0
  27. package/src/components/badge.tsx +242 -0
  28. package/src/components/bar-chart.tsx +138 -0
  29. package/src/components/bar-list.tsx +85 -0
  30. package/src/components/brand-icon.tsx +52 -0
  31. package/src/components/breadcrumb.tsx +96 -0
  32. package/src/components/button-group.tsx +29 -0
  33. package/src/components/button.tsx +208 -0
  34. package/src/components/calendar.tsx +238 -0
  35. package/src/components/card.tsx +136 -0
  36. package/src/components/chart.tsx +289 -0
  37. package/src/components/checkbox.tsx +42 -0
  38. package/src/components/code-block.tsx +31 -0
  39. package/src/components/collapsible.tsx +114 -0
  40. package/src/components/color-picker.tsx +93 -0
  41. package/src/components/combo-chart.tsx +139 -0
  42. package/src/components/combobox.tsx +200 -0
  43. package/src/components/command.tsx +191 -0
  44. package/src/components/date-picker.tsx +435 -0
  45. package/src/components/description-list.tsx +280 -0
  46. package/src/components/dialog.tsx +192 -0
  47. package/src/components/diff-view.tsx +109 -0
  48. package/src/components/dropdown-menu.tsx +248 -0
  49. package/src/components/emoji-picker.tsx +299 -0
  50. package/src/components/empty.tsx +197 -0
  51. package/src/components/field.tsx +226 -0
  52. package/src/components/file-upload.tsx +186 -0
  53. package/src/components/funnel-chart.tsx +224 -0
  54. package/src/components/gauge-chart.tsx +109 -0
  55. package/src/components/heatmap.tsx +105 -0
  56. package/src/components/hover-card.tsx +47 -0
  57. package/src/components/image-viewer.tsx +174 -0
  58. package/src/components/input-otp.tsx +86 -0
  59. package/src/components/input.tsx +470 -0
  60. package/src/components/item.tsx +94 -0
  61. package/src/components/kbd.tsx +28 -0
  62. package/src/components/label.tsx +21 -0
  63. package/src/components/line-chart.tsx +92 -0
  64. package/src/components/link.tsx +34 -0
  65. package/src/components/message.tsx +903 -0
  66. package/src/components/number-field.tsx +79 -0
  67. package/src/components/pagination.tsx +208 -0
  68. package/src/components/phone-input.tsx +147 -0
  69. package/src/components/pie-chart.tsx +117 -0
  70. package/src/components/popover.tsx +102 -0
  71. package/src/components/powered-by.tsx +39 -0
  72. package/src/components/progress.tsx +278 -0
  73. package/src/components/prose.tsx +42 -0
  74. package/src/components/radar-chart.tsx +66 -0
  75. package/src/components/radial-chart.tsx +73 -0
  76. package/src/components/radio-group.tsx +135 -0
  77. package/src/components/rating.tsx +192 -0
  78. package/src/components/rich-text.tsx +1651 -0
  79. package/src/components/scatter-chart.tsx +115 -0
  80. package/src/components/scroll-area.tsx +50 -0
  81. package/src/components/select.tsx +193 -0
  82. package/src/components/separator.tsx +20 -0
  83. package/src/components/sheet.tsx +142 -0
  84. package/src/components/sidebar.tsx +570 -0
  85. package/src/components/skeleton.tsx +18 -0
  86. package/src/components/slider.tsx +47 -0
  87. package/src/components/sonner.tsx +178 -0
  88. package/src/components/sparkline.tsx +68 -0
  89. package/src/components/spinner.tsx +35 -0
  90. package/src/components/status-dot.tsx +45 -0
  91. package/src/components/stepper.tsx +228 -0
  92. package/src/components/switch.tsx +35 -0
  93. package/src/components/table.tsx +267 -0
  94. package/src/components/tabs.tsx +184 -0
  95. package/src/components/tag-input.tsx +238 -0
  96. package/src/components/textarea.tsx +47 -0
  97. package/src/components/time-picker.tsx +183 -0
  98. package/src/components/timeline.tsx +75 -0
  99. package/src/components/toggle-group.tsx +93 -0
  100. package/src/components/toggle.tsx +51 -0
  101. package/src/components/tooltip.tsx +160 -0
  102. package/src/components/tree.tsx +136 -0
  103. package/src/components/voice-message.tsx +193 -0
  104. package/src/css.d.ts +2 -0
  105. package/src/hooks/use-appearance.ts +57 -0
  106. package/src/hooks/use-mobile.ts +20 -0
  107. package/src/lib/appearance.ts +16 -0
  108. package/src/lib/button-render.ts +32 -0
  109. package/src/lib/char-count.tsx +67 -0
  110. package/src/lib/date.ts +45 -0
  111. package/src/lib/file-accept.ts +59 -0
  112. package/src/lib/markdown.ts +187 -0
  113. package/src/lib/utils.ts +29 -0
  114. package/src/lib/voice.ts +68 -0
  115. package/src/styles/shadcn.css +642 -0
  116. package/src/styles/theme.css +1825 -0
@@ -0,0 +1,339 @@
1
+ 'use client';
2
+
3
+ import { CircleHelpIcon, DownloadIcon, FileIcon, ImageOffIcon, MapPinIcon } from 'lucide-react';
4
+ import { type ReactNode, useState } from 'react';
5
+ import { Avatar } from './avatar';
6
+ import { Button, CopyButton } from './button';
7
+ import { ImageViewer, type ImageViewerImage } from './image-viewer';
8
+ import { VoiceMessage } from './voice-message';
9
+ import { cn } from '../lib/utils';
10
+
11
+ // Anexo dentro de uma mensagem de conversa (D-330): foto, vídeo, figurinha, áudio com
12
+ // transcrição, documento, localização e contato. Mídia que o WhatsApp já apagou vira o aviso de
13
+ // indisponível, e o tipo que o sistema ainda não desenha pede para abrir no celular. Vai dentro do
14
+ // ChatMessage, acima do texto da legenda. A foto abre no Image viewer, passando pelas outras fotos
15
+ // da mesma conversa.
16
+
17
+ export type ChatAttachmentKind =
18
+ | 'image'
19
+ | 'video'
20
+ | 'sticker'
21
+ | 'audio'
22
+ | 'document'
23
+ | 'location'
24
+ | 'contact'
25
+ | 'expired'
26
+ | 'unsupported';
27
+
28
+ const MEDIA_NAME: Partial<Record<ChatAttachmentKind, string>> = {
29
+ image: 'Esta foto',
30
+ video: 'Este vídeo',
31
+ sticker: 'Esta figurinha',
32
+ audio: 'Este áudio',
33
+ document: 'Este documento',
34
+ };
35
+
36
+ function ChatAttachment({
37
+ kind,
38
+ src,
39
+ alt,
40
+ name,
41
+ size,
42
+ href,
43
+ address,
44
+ phone,
45
+ duration,
46
+ transcript,
47
+ waveform,
48
+ expiredKind = 'image',
49
+ className,
50
+ }: {
51
+ kind: ChatAttachmentKind;
52
+ /** Endereço da mídia: foto, vídeo, figurinha ou áudio. */
53
+ src?: string;
54
+ /** Descrição da foto para o leitor de tela. */
55
+ alt?: string;
56
+ /** Nome do documento, do lugar ou do contato. Na foto, o nome do arquivo no visualizador. */
57
+ name?: string;
58
+ /** Tamanho do documento, como "1,2 MB". */
59
+ size?: string;
60
+ /** Baixar o documento ou abrir o lugar no mapa. */
61
+ href?: string;
62
+ /** Endereço da localização. */
63
+ address?: string;
64
+ /** Telefone do contato. */
65
+ phone?: string;
66
+ /** Duração do áudio, como "0:42". */
67
+ duration?: string;
68
+ /** Transcrição do áudio. */
69
+ transcript?: string;
70
+ /** Alturas das ondas do áudio, de 0 a 1, quando o app tem. */
71
+ waveform?: number[];
72
+ /** No `expired`, que mídia era. */
73
+ expiredKind?: ChatAttachmentKind;
74
+ className?: string;
75
+ }) {
76
+ const [broken, setBroken] = useState(false);
77
+ if (kind === 'expired' || broken) {
78
+ return (
79
+ <Notice icon={<ImageOffIcon />} className={className}>
80
+ {MEDIA_NAME[broken ? kind : expiredKind] ?? 'Esta mídia'} não está mais disponível no
81
+ WhatsApp.
82
+ </Notice>
83
+ );
84
+ }
85
+ if (kind === 'unsupported') {
86
+ return (
87
+ <Notice icon={<CircleHelpIcon />} className={className}>
88
+ O sistema ainda não mostra este tipo de mensagem. Abra no celular para ver.
89
+ </Notice>
90
+ );
91
+ }
92
+ if (kind === 'image') {
93
+ return (
94
+ <ChatImage
95
+ src={src}
96
+ alt={alt}
97
+ name={name}
98
+ onError={() => setBroken(true)}
99
+ className={className}
100
+ />
101
+ );
102
+ }
103
+ if (kind === 'sticker') {
104
+ return (
105
+ <img
106
+ data-slot="chat-attachment"
107
+ src={src}
108
+ alt={alt ?? 'Figurinha'}
109
+ loading="lazy"
110
+ onError={() => setBroken(true)}
111
+ className={cn('size-32 object-contain', className)}
112
+ />
113
+ );
114
+ }
115
+ if (kind === 'video') {
116
+ return (
117
+ <video
118
+ data-slot="chat-attachment"
119
+ src={src}
120
+ controls
121
+ preload="metadata"
122
+ onError={() => setBroken(true)}
123
+ className={cn('max-h-80 w-full max-w-72 rounded-inner bg-muted', className)}
124
+ />
125
+ );
126
+ }
127
+ if (kind === 'audio') {
128
+ return (
129
+ // D-845: o áudio com as ondas, como no WhatsApp, pela peça Voice message.
130
+ <VoiceMessage
131
+ src={src}
132
+ duration={duration}
133
+ waveform={waveform}
134
+ transcript={transcript}
135
+ onError={() => setBroken(true)}
136
+ className={className}
137
+ />
138
+ );
139
+ }
140
+ if (kind === 'document') {
141
+ return (
142
+ <Row
143
+ icon={<FileIcon />}
144
+ title={name ?? 'Documento'}
145
+ detail={size}
146
+ className={className}
147
+ action={
148
+ href && (
149
+ <Button
150
+ variant="outline"
151
+ size="icon-sm"
152
+ aria-label={`Baixar ${name ?? 'documento'}`}
153
+ render={<a href={href} download />}
154
+ >
155
+ <DownloadIcon />
156
+ </Button>
157
+ )
158
+ }
159
+ />
160
+ );
161
+ }
162
+ if (kind === 'location') {
163
+ return (
164
+ <div
165
+ data-slot="chat-attachment"
166
+ className={cn('grid w-64 max-w-full grid-cols-1 gap-1.5', className)}
167
+ >
168
+ <Row icon={<MapPinIcon />} title={name ?? 'Localização'} detail={address} />
169
+ {href && (
170
+ <Button
171
+ variant="outline"
172
+ size="sm"
173
+ render={<a href={href} target="_blank" rel="noreferrer" />}
174
+ >
175
+ Abrir no mapa
176
+ </Button>
177
+ )}
178
+ </div>
179
+ );
180
+ }
181
+ // Contato
182
+ return (
183
+ <div
184
+ data-slot="chat-attachment"
185
+ className={cn(
186
+ 'flex w-64 max-w-full items-center gap-2.5 rounded-inner bg-card/70 p-1.5',
187
+ className,
188
+ )}
189
+ >
190
+ <Avatar name={name ?? '?'} />
191
+ <span className="grid min-w-0 flex-1">
192
+ <span className="truncate text-body-13-medium">{name ?? 'Contato'}</span>
193
+ {phone && <span className="text-body-12 text-muted-foreground tabular-nums">{phone}</span>}
194
+ </span>
195
+ {phone && <CopyButton value={phone} label="telefone" />}
196
+ </div>
197
+ );
198
+ }
199
+
200
+ /**
201
+ * Foto do anexo. Ao clicar, abre o visualizador com todas as fotos da conversa, ou do trecho
202
+ * marcado com `data-image-gallery`, na ordem em que aparecem, já na foto clicada.
203
+ */
204
+ function ChatImage({
205
+ src,
206
+ alt,
207
+ name,
208
+ onError,
209
+ className,
210
+ }: {
211
+ src?: string;
212
+ alt?: string;
213
+ name?: string;
214
+ onError: () => void;
215
+ className?: string;
216
+ }) {
217
+ const [open, setOpen] = useState(false);
218
+ const [gallery, setGallery] = useState<{ images: ImageViewerImage[]; index: number }>({
219
+ images: [],
220
+ index: 0,
221
+ });
222
+ const self: ImageViewerImage | null = src
223
+ ? { src, alt, caption: name ?? alt, downloadName: name }
224
+ : null;
225
+ return (
226
+ <>
227
+ <button
228
+ type="button"
229
+ data-slot="chat-attachment"
230
+ data-kind="image"
231
+ data-src={src}
232
+ data-alt={alt}
233
+ data-name={name}
234
+ aria-label={`Abrir ${name ?? alt ?? 'foto'}`}
235
+ disabled={!src}
236
+ onClick={(e) => {
237
+ if (!self) return;
238
+ const scope = e.currentTarget.closest('[data-image-gallery], [data-slot="chat-thread"]');
239
+ const nodes = scope
240
+ ? [
241
+ ...scope.querySelectorAll<HTMLElement>(
242
+ '[data-slot="chat-attachment"][data-kind="image"][data-src]',
243
+ ),
244
+ ]
245
+ : [];
246
+ const images = nodes.map((n): ImageViewerImage => ({
247
+ src: n.dataset.src ?? '',
248
+ alt: n.dataset.alt,
249
+ caption: n.dataset.name ?? n.dataset.alt,
250
+ downloadName: n.dataset.name,
251
+ }));
252
+ const index = nodes.indexOf(e.currentTarget);
253
+ setGallery(index >= 0 ? { images, index } : { images: [self], index: 0 });
254
+ setOpen(true);
255
+ }}
256
+ className={cn(
257
+ 'block cursor-zoom-in overflow-hidden rounded-control outline-none focus-visible:focus-ring',
258
+ className,
259
+ )}
260
+ >
261
+ <img
262
+ src={src}
263
+ alt={alt ?? 'Foto'}
264
+ loading="lazy"
265
+ onError={onError}
266
+ className="max-h-80 w-full max-w-72 object-cover"
267
+ />
268
+ </button>
269
+ {/* Fica montado depois de aberto, para a saída animar. */}
270
+ {gallery.images.length > 0 && (
271
+ <ImageViewer
272
+ images={gallery.images}
273
+ open={open}
274
+ onOpenChange={setOpen}
275
+ index={gallery.index}
276
+ onIndexChange={(index) => setGallery((g) => ({ ...g, index }))}
277
+ />
278
+ )}
279
+ </>
280
+ );
281
+ }
282
+
283
+ function Row({
284
+ icon,
285
+ title,
286
+ detail,
287
+ action,
288
+ className,
289
+ }: {
290
+ icon: ReactNode;
291
+ title: string;
292
+ detail?: string;
293
+ action?: ReactNode;
294
+ className?: string;
295
+ }) {
296
+ return (
297
+ <div
298
+ data-slot="chat-attachment"
299
+ className={cn(
300
+ 'flex w-64 max-w-full items-center gap-2.5 rounded-inner bg-card/70 p-1.5',
301
+ className,
302
+ )}
303
+ >
304
+ <span className="grid size-9 shrink-0 place-items-center rounded-inner bg-muted text-muted-foreground [&_svg]:size-icon-xl">
305
+ {icon}
306
+ </span>
307
+ <span className="grid min-w-0 flex-1 whitespace-normal">
308
+ <span className="truncate text-body-13-medium">{title}</span>
309
+ {detail && <span className="text-body-12 text-muted-foreground">{detail}</span>}
310
+ </span>
311
+ {action}
312
+ </div>
313
+ );
314
+ }
315
+
316
+ function Notice({
317
+ icon,
318
+ children,
319
+ className,
320
+ }: {
321
+ icon: ReactNode;
322
+ children: ReactNode;
323
+ className?: string;
324
+ }) {
325
+ return (
326
+ <p
327
+ data-slot="chat-attachment"
328
+ className={cn(
329
+ 'flex items-center gap-2 text-body-13 text-muted-foreground italic [&_svg]:size-icon-lg [&_svg]:shrink-0',
330
+ className,
331
+ )}
332
+ >
333
+ {icon}
334
+ <span>{children}</span>
335
+ </p>
336
+ );
337
+ }
338
+
339
+ export { ChatAttachment };
@@ -0,0 +1,197 @@
1
+ 'use client';
2
+
3
+ import * as React from 'react';
4
+ import { Avatar as AvatarPrimitive } from '@base-ui/react/avatar';
5
+ import { cn } from '../lib/utils';
6
+ import { AiSparkleIcon } from './badge';
7
+
8
+ // Avatar de pessoa ou empresa (D-309). Com `name`, monta sozinho: a foto quando houver e, sem
9
+ // ela, as iniciais num dos 8 tons, escolhido pelo nome, então a mesma pessoa tem sempre a mesma
10
+ // cor. Empresa usa `shape="square"`, como um logo. Com `badge`, um selo de conteúdo livre no canto
11
+ // de baixo, como a logo do canal da conversa: o ícone ganha um círculo do fundo do cartão em volta.
12
+ // Com `ai`, D-710, é um agente de IA: a inicial do nome no violeta da IA e o brilho no canto, para
13
+ // cada agente ter o seu rosto sem se confundir com uma pessoa.
14
+
15
+ const TONES = [
16
+ 'bg-avatar-1 text-avatar-1-foreground',
17
+ 'bg-avatar-2 text-avatar-2-foreground',
18
+ 'bg-avatar-3 text-avatar-3-foreground',
19
+ 'bg-avatar-4 text-avatar-4-foreground',
20
+ 'bg-avatar-5 text-avatar-5-foreground',
21
+ 'bg-avatar-6 text-avatar-6-foreground',
22
+ 'bg-avatar-7 text-avatar-7-foreground',
23
+ 'bg-avatar-8 text-avatar-8-foreground',
24
+ ] as const;
25
+
26
+ /** Até duas letras: primeira e última palavra com letra ("Maria da Silva" → "MS"). */
27
+ function initials(name: string): string {
28
+ const words = name
29
+ .trim()
30
+ .split(/\s+/)
31
+ .filter((w) => /\p{L}/u.test(w))
32
+ .map((w) => w.replace(/^[^\p{L}]+/u, ''));
33
+ const first = words[0]?.[0] ?? '?';
34
+ const last = words.length > 1 ? (words[words.length - 1]?.[0] ?? '') : '';
35
+ return (first + last).toUpperCase();
36
+ }
37
+
38
+ function toneOf(name: string): string {
39
+ let h = 0;
40
+ for (const ch of name.trim().toLowerCase()) h = (h * 31 + (ch.codePointAt(0) ?? 0)) >>> 0;
41
+ return TONES[h % TONES.length] as string;
42
+ }
43
+
44
+ function Avatar({
45
+ className,
46
+ size = 'default',
47
+ shape = 'circle',
48
+ name,
49
+ src,
50
+ badge,
51
+ ai = false,
52
+ children,
53
+ ...props
54
+ }: AvatarPrimitive.Root.Props & {
55
+ size?: 'xs' | 'sm' | 'default' | 'lg' | 'xl';
56
+ shape?: 'circle' | 'square';
57
+ /** Nome da pessoa ou empresa: monta a foto e as iniciais coloridas sozinho. */
58
+ name?: string;
59
+ src?: string | null;
60
+ /** Selo no canto, como a logo do WhatsApp. Ícone com nome para o leitor de tela. */
61
+ badge?: React.ReactNode;
62
+ /** Agente de IA: inicial no violeta da IA e o brilho no canto. */
63
+ ai?: boolean;
64
+ }) {
65
+ const corner = badge ?? (ai ? <AiSparkleIcon /> : null);
66
+ return (
67
+ <AvatarPrimitive.Root
68
+ data-slot="avatar"
69
+ data-size={size}
70
+ data-shape={shape}
71
+ data-ai={ai || undefined}
72
+ className={cn(
73
+ // tokens-ok: o quadrado do logo da empresa segue a proporção do tamanho, 28%
74
+ 'group/avatar relative flex size-8 shrink-0 rounded-full select-none after:absolute after:inset-0 after:rounded-[inherit] after:border after:border-border after:mix-blend-darken data-[shape=square]:rounded-[28%] data-[size=lg]:size-10 data-[size=sm]:size-6 data-[size=xl]:size-14 data-[size=xs]:size-5 dark:after:mix-blend-lighten',
75
+ className,
76
+ )}
77
+ {...props}
78
+ >
79
+ {/* Filhos que acabam vazios, como [null, false], contam como nenhum: valem as iniciais. */}
80
+ {name !== undefined && React.Children.toArray(children).length === 0 ? (
81
+ <>
82
+ {src && <AvatarImage src={src} alt="" />}
83
+ <AvatarFallback
84
+ className={cn(
85
+ 'font-medium',
86
+ ai ? 'bg-ai-subtle text-ai-subtle-foreground' : toneOf(name),
87
+ )}
88
+ >
89
+ {ai ? initials(name).slice(0, 1) : initials(name)}
90
+ </AvatarFallback>
91
+ </>
92
+ ) : (
93
+ children
94
+ )}
95
+ {corner && (
96
+ <span
97
+ data-slot="avatar-corner"
98
+ className="absolute -right-0.5 -bottom-0.5 z-10 grid size-4 place-items-center rounded-full bg-card ring-2 ring-card group-data-[size=sm]/avatar:size-3 group-data-[size=xl]/avatar:size-5 group-data-[size=xs]/avatar:size-2.5 [&>svg]:size-icon-xs group-data-[size=sm]/avatar:[&>svg]:size-2.5 group-data-[size=xl]/avatar:[&>svg]:size-icon-lg group-data-[size=xs]/avatar:[&>svg]:size-2"
99
+ >
100
+ {corner}
101
+ </span>
102
+ )}
103
+ </AvatarPrimitive.Root>
104
+ );
105
+ }
106
+
107
+ function AvatarImage({ className, ...props }: AvatarPrimitive.Image.Props) {
108
+ return (
109
+ <AvatarPrimitive.Image
110
+ data-slot="avatar-image"
111
+ className={cn('aspect-square size-full rounded-[inherit] object-cover', className)}
112
+ {...props}
113
+ />
114
+ );
115
+ }
116
+
117
+ function AvatarFallback({ className, ...props }: AvatarPrimitive.Fallback.Props) {
118
+ return (
119
+ <AvatarPrimitive.Fallback
120
+ data-slot="avatar-fallback"
121
+ className={cn(
122
+ 'flex size-full items-center justify-center rounded-[inherit] bg-muted text-body-13-medium text-muted-foreground group-data-[size=sm]/avatar:text-body-12 group-data-[size=xl]/avatar:text-heading-18 group-data-[size=xs]/avatar:text-body-10-semibold',
123
+ className,
124
+ )}
125
+ {...props}
126
+ />
127
+ );
128
+ }
129
+
130
+ function AvatarBadge({ className, ...props }: React.ComponentProps<'span'>) {
131
+ return (
132
+ <span
133
+ data-slot="avatar-badge"
134
+ className={cn(
135
+ // Verde de disponível, a mesma cor do Status dot; outra cor vem pelo className.
136
+ 'absolute right-0 bottom-0 z-10 inline-flex items-center justify-center rounded-full bg-icon-success text-success-foreground bg-blend-color ring-2 ring-background select-none',
137
+ 'group-data-[size=sm]/avatar:size-2 group-data-[size=sm]/avatar:[&>svg]:hidden',
138
+ 'group-data-[size=default]/avatar:size-2.5 group-data-[size=default]/avatar:[&>svg]:size-2',
139
+ 'group-data-[size=lg]/avatar:size-3 group-data-[size=lg]/avatar:[&>svg]:size-2',
140
+ 'group-data-[size=xs]/avatar:size-1.5 group-data-[size=xs]/avatar:[&>svg]:hidden',
141
+ 'group-data-[size=xl]/avatar:size-3.5 group-data-[size=xl]/avatar:[&>svg]:size-2.5',
142
+ className,
143
+ )}
144
+ {...props}
145
+ />
146
+ );
147
+ }
148
+
149
+ function AvatarGroup({
150
+ max,
151
+ className,
152
+ children,
153
+ ...props
154
+ }: React.ComponentProps<'div'> & {
155
+ /** Mostra até esse número de avatares e junta o resto num "+N". */
156
+ max?: number;
157
+ }) {
158
+ const all = React.Children.toArray(children);
159
+ const extra = max !== undefined && all.length > max ? all.length - max : 0;
160
+ return (
161
+ <div
162
+ data-slot="avatar-group"
163
+ className={cn(
164
+ 'group/avatar-group flex -space-x-2 *:data-[slot=avatar]:ring-2 *:data-[slot=avatar]:ring-background',
165
+ className,
166
+ )}
167
+ {...props}
168
+ >
169
+ {extra ? all.slice(0, max) : children}
170
+ {extra > 0 && <AvatarGroupCount aria-label={`Mais ${extra}`}>+{extra}</AvatarGroupCount>}
171
+ </div>
172
+ );
173
+ }
174
+
175
+ function AvatarGroupCount({ className, ...props }: React.ComponentProps<'div'>) {
176
+ return (
177
+ <div
178
+ data-slot="avatar-group-count"
179
+ className={cn(
180
+ 'relative flex size-8 shrink-0 items-center justify-center rounded-full bg-muted text-body-12 text-muted-foreground ring-2 ring-background group-has-data-[size=lg]/avatar-group:size-10 group-has-data-[size=sm]/avatar-group:size-6 [&>svg]:size-icon-lg group-has-data-[size=lg]/avatar-group:[&>svg]:size-icon-xl group-has-data-[size=sm]/avatar-group:[&>svg]:size-icon-xs group-has-data-[size=xs]/avatar-group:size-5 group-has-data-[size=xs]/avatar-group:text-body-10-semibold group-has-data-[size=xl]/avatar-group:size-14 group-has-data-[size=xl]/avatar-group:text-body-13-medium',
181
+ className,
182
+ )}
183
+ {...props}
184
+ />
185
+ );
186
+ }
187
+
188
+ export {
189
+ Avatar,
190
+ AvatarImage,
191
+ AvatarFallback,
192
+ AvatarGroup,
193
+ AvatarGroupCount,
194
+ AvatarBadge,
195
+ initials,
196
+ toneOf,
197
+ };