@vowt-tech/ui 0.177.3 → 0.179.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.
@@ -1,6 +1,6 @@
1
1
  # Design system VOWT, guia para este app
2
2
 
3
- > Pasta gerada pelo pacote @vowt-tech/ui 0.177.3. Não edite: ela é refeita a cada atualização
3
+ > Pasta gerada pelo pacote @vowt-tech/ui 0.179.0. Não edite: ela é refeita a cada atualização
4
4
  > do pacote pelo comando `vowt-ux-ui-design sync`. Regra própria deste app fica fora daqui.
5
5
 
6
6
  Este app usa o design system da VOWT. Do pacote @vowt-tech/ui, o app importa os fundamentos,
package/guia/VERSAO CHANGED
@@ -1 +1 @@
1
- 0.177.3
1
+ 0.179.0
@@ -1,6 +1,6 @@
1
1
  # Componentes
2
2
 
3
- > Gerado do pacote @vowt-tech/ui 0.177.3. Cada linha traz o nome da peça, o import do pacote e
3
+ > Gerado do pacote @vowt-tech/ui 0.179.0. Cada linha traz o nome da peça, o import do pacote e
4
4
  > a página com o exemplo.
5
5
 
6
6
  Antes de montar uma tela, procure aqui. Cada peça é importada do pacote, como
@@ -10,7 +10,7 @@ app não copia nem altera a peça: o pedido de mudança vai ao repositório vowt
10
10
  ## Componentes
11
11
 
12
12
  - `accordion`: `import { Accordion, AccordionItem, AccordionTrigger, AccordionPanel } from '@vowt-tech/ui/accordion'`. Página: https://developers.vowt.com.br/accordion
13
- - `ai-orb`: `import { AiOrb } from '@vowt-tech/ui/ai-orb'`. Página: https://developers.vowt.com.br/ai-orb
13
+ - `ai-orb`: `import { AiOrb, VoiceOrb } from '@vowt-tech/ui/ai-orb'`. Página: https://developers.vowt.com.br/ai-orb
14
14
  - `alert-dialog`: `import { ConfirmDialog, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger } from '@vowt-tech/ui/alert-dialog'`. Página: https://developers.vowt.com.br/alert-dialog
15
15
  - `alert`: `import { Alert, AlertTitle, AlertDescription, AlertAction } from '@vowt-tech/ui/alert'`. Página: https://developers.vowt.com.br/alert
16
16
  - `area-chart`: `import { AreaChart } from '@vowt-tech/ui/area-chart'`. Página: https://developers.vowt.com.br/area-chart
@@ -25,6 +25,7 @@ app não copia nem altera a peça: o pedido de mudança vai ao repositório vowt
25
25
  - `button`: `import { Button, StatefulButton, buttonVariants, CopyButton } from '@vowt-tech/ui/button'`. Página: https://developers.vowt.com.br/button
26
26
  - `calendar`: `import { Calendar, CalendarDayButton } from '@vowt-tech/ui/calendar'`. Página: https://developers.vowt.com.br/calendar
27
27
  - `card`: `import { Card, CardHeader, CardFooter, CardTitle, CardAction, CardDescription, CardContent, Panel, panelVariants } from '@vowt-tech/ui/card'`. Página: https://developers.vowt.com.br/card
28
+ - `change-card`: `import { ChangeCard } from '@vowt-tech/ui/change-card'`. Página: https://developers.vowt.com.br/change-card
28
29
  - `chart`: `import { ChartContainer, ChartTooltip, ChartTooltipContent, ChartLegend, CHART_COLORS, seriesConfig, formatNumber, AXIS, CHART_ANIMATION } from '@vowt-tech/ui/chart'`. Página: https://developers.vowt.com.br/chart
29
30
  - `checkbox`: `import { Checkbox } from '@vowt-tech/ui/checkbox'`. Página: https://developers.vowt.com.br/checkbox
30
31
  - `code-block`: `import { CodeBlock } from '@vowt-tech/ui/code-block'`. Página: https://developers.vowt.com.br/code-block
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vowt-tech/ui",
3
- "version": "0.177.3",
3
+ "version": "0.179.0",
4
4
  "description": "Design system da VOWT: base visual e componentes compartilhados por todos os produtos.",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",
@@ -1,11 +1,16 @@
1
- import type * as React from 'react';
1
+ 'use client';
2
+
3
+ import * as React from 'react';
4
+ import { MicIcon, MicOffIcon, PauseIcon, PlayIcon, PowerIcon } from 'lucide-react';
2
5
  import { cn } from '../lib/utils';
6
+ import { Button } from './button';
3
7
 
4
8
  // Orb da IA, D-769: a bola animada nas cores da IA, azul, violeta e rosa, que mostra a IA pronta
5
9
  // para conversar, como no vazio do Assistente de IA e na saudação do Início. Só desenho: sem som,
6
10
  // sem microfone e sem clique. Sempre animado; para quem reduz o movimento no sistema, fica parado.
7
11
  // O desenho vive na classe `ai-orb` do tema; aqui só entram as medidas que dependem do tamanho.
8
- // tokens-ok-ligacao: peça de desenho só com CSS, sem controle nem texto, então não usa outra peça.
12
+ // D-866: com `state` e `level`, o mesmo desenho reage a uma conversa por voz; o Voice orb, logo
13
+ // abaixo, junta o orb, a legenda e os controles.
9
14
 
10
15
  /** Medidas do desenho a partir do tamanho: abaixo de 50px, desfoque e pontos menores. */
11
16
  function orbVars(size: number) {
@@ -29,10 +34,15 @@ function orbVars(size: number) {
29
34
  };
30
35
  }
31
36
 
37
+ export type VoiceOrbState =
38
+ 'connecting' | 'listening' | 'thinking' | 'speaking' | 'paused' | 'error';
39
+
32
40
  function AiOrb({
33
41
  size = 48,
34
42
  duration = 20,
35
43
  label,
44
+ state,
45
+ level,
36
46
  className,
37
47
  }: {
38
48
  /** Tamanho em px. 48 no vazio da janela, 64 na tela cheia, 80 na saudação do Início. */
@@ -41,13 +51,19 @@ function AiOrb({
41
51
  duration?: number;
42
52
  /** Nome para leitor de tela, como "VOWT AI Agent". Sem ele, o orb é só enfeite e fica escondido. */
43
53
  label?: string;
54
+ /** Estado de uma conversa por voz, D-866: cada um com o seu visual. Sem ele, o orb de sempre. */
55
+ state?: VoiceOrbState;
56
+ /** Nível do som, de 0 a 1, vindo do app. O orb cresce um pouco com a voz. */
57
+ level?: number;
44
58
  className?: string;
45
59
  }) {
46
60
  const { tiny, style } = orbVars(size);
61
+ const clamped = level === undefined ? 0 : Math.min(1, Math.max(0, level));
47
62
  return (
48
63
  <span
49
64
  data-slot="ai-orb"
50
65
  data-size={tiny ? 'tiny' : undefined}
66
+ data-state={state}
51
67
  role={label ? 'img' : undefined}
52
68
  aria-label={label}
53
69
  aria-hidden={label ? undefined : true}
@@ -58,10 +74,186 @@ function AiOrb({
58
74
  width: size,
59
75
  height: size,
60
76
  '--ai-orb-duration': `${duration}s`,
77
+ '--ai-orb-level': clamped,
61
78
  } as React.CSSProperties
62
79
  }
63
80
  />
64
81
  );
65
82
  }
66
83
 
67
- export { AiOrb };
84
+ const STATE_LABELS: Record<VoiceOrbState, string> = {
85
+ connecting: 'Conectando',
86
+ listening: 'Ouvindo',
87
+ thinking: 'Pensando',
88
+ speaking: 'Falando',
89
+ paused: 'Pausado',
90
+ error: 'Erro na conversa',
91
+ };
92
+
93
+ const VOICE_LABELS = {
94
+ ...STATE_LABELS,
95
+ mute: 'Desligar o microfone',
96
+ unmute: 'Ligar o microfone',
97
+ pause: 'Pausar a conversa',
98
+ resume: 'Retomar a conversa',
99
+ end: 'Encerrar a conversa',
100
+ };
101
+
102
+ export type VoiceOrbLabels = Partial<typeof VOICE_LABELS>;
103
+
104
+ const ORB_SIZE = { sm: 64, default: 96, lg: 128 } as const;
105
+
106
+ /**
107
+ * A legenda é anunciada ao leitor de tela só quando para de mudar, e só o trecho novo: com o texto
108
+ * chegando aos poucos, ele não repete a frase inteira a cada palavra.
109
+ */
110
+ function useCaptionAnnouncement(caption: string | undefined) {
111
+ const [announced, setAnnounced] = React.useState('');
112
+ const last = React.useRef('');
113
+ React.useEffect(() => {
114
+ const text = caption?.trim() ?? '';
115
+ if (!text) {
116
+ last.current = '';
117
+ return;
118
+ }
119
+ const timer = setTimeout(() => {
120
+ const delta = text.startsWith(last.current) ? text.slice(last.current.length).trim() : text;
121
+ last.current = text;
122
+ if (delta) setAnnounced(delta);
123
+ }, 800);
124
+ return () => clearTimeout(timer);
125
+ }, [caption]);
126
+ return announced;
127
+ }
128
+
129
+ // Voice orb, D-866: a conversa por voz com a IA. O pacote não acessa microfone, áudio nem rede: o
130
+ // app passa o estado, o nível do som e a legenda, e recebe os eventos dos controles. O estado tem
131
+ // nome para o leitor de tela; a legenda ao vivo é anunciada sem repetir o que já foi lido. Para
132
+ // quem reduz o movimento, o orb não cresce nem gira: só troca de visual a cada estado.
133
+ function VoiceOrb({
134
+ state,
135
+ level,
136
+ caption,
137
+ muted = false,
138
+ onMutedChange,
139
+ onPausedChange,
140
+ onEnd,
141
+ label = 'VOWT AI Agent',
142
+ size = 'default',
143
+ labels: customLabels,
144
+ className,
145
+ }: {
146
+ state: VoiceOrbState;
147
+ /** Nível do som de quem fala, de 0 a 1, vindo do app. */
148
+ level?: number;
149
+ /** A legenda ao vivo, como o que a IA está dizendo. */
150
+ caption?: string;
151
+ /** Microfone desligado. */
152
+ muted?: boolean;
153
+ /** Com ele, aparece o botão do microfone. */
154
+ onMutedChange?: (muted: boolean) => void;
155
+ /** Com ele, aparece o botão de pausar e retomar. O app troca o estado para paused e de volta. */
156
+ onPausedChange?: (paused: boolean) => void;
157
+ /** Com ele, aparece o botão de encerrar. */
158
+ onEnd?: () => void;
159
+ /** Nome da IA para o leitor de tela. */
160
+ label?: string;
161
+ size?: 'sm' | 'default' | 'lg';
162
+ /** Textos dos estados e dos botões, para outro idioma. */
163
+ labels?: VoiceOrbLabels;
164
+ className?: string;
165
+ }) {
166
+ const labels = { ...VOICE_LABELS, ...customLabels };
167
+ const paused = state === 'paused';
168
+ const stateLabel = labels[state];
169
+ const announced = useCaptionAnnouncement(caption);
170
+ const buttonSize = size === 'sm' ? 'icon-sm' : size === 'lg' ? 'icon-lg' : 'icon';
171
+ const hasControls = onMutedChange || onPausedChange || onEnd;
172
+ return (
173
+ <div
174
+ data-slot="voice-orb"
175
+ data-state={state}
176
+ className={cn('flex flex-col items-center gap-4 text-center', className)}
177
+ >
178
+ {/* Espaço para o orb crescer com a voz sem empurrar o resto. */}
179
+ <div className="grid place-items-center p-3">
180
+ <AiOrb
181
+ size={ORB_SIZE[size]}
182
+ state={state}
183
+ level={level}
184
+ label={`${label}: ${stateLabel}`}
185
+ />
186
+ </div>
187
+ <p
188
+ data-slot="voice-orb-state"
189
+ className={cn(
190
+ size === 'lg' ? 'text-body-14-medium' : 'text-body-13-medium',
191
+ state === 'error' ? 'text-text-error' : 'text-muted-foreground',
192
+ )}
193
+ >
194
+ {/* O nome do estado é anunciado quando muda. */}
195
+ <span role="status">{stateLabel}</span>
196
+ </p>
197
+ {caption && (
198
+ <p
199
+ data-slot="voice-orb-caption"
200
+ aria-hidden
201
+ className={cn(
202
+ 'max-w-prose text-balance',
203
+ size === 'sm'
204
+ ? 'text-body-13'
205
+ : size === 'lg'
206
+ ? 'text-heading-18-regular'
207
+ : 'text-body-14',
208
+ )}
209
+ >
210
+ {caption}
211
+ </p>
212
+ )}
213
+ <span className="sr-only" aria-live="polite">
214
+ {announced}
215
+ </span>
216
+ {hasControls && (
217
+ <div data-slot="voice-orb-controls" className="flex items-center gap-2">
218
+ {onMutedChange && (
219
+ <Button
220
+ variant={muted ? 'secondary' : 'outline'}
221
+ size={buttonSize}
222
+ shape="pill"
223
+ aria-pressed={muted}
224
+ aria-label={muted ? labels.unmute : labels.mute}
225
+ onClick={() => onMutedChange(!muted)}
226
+ >
227
+ {muted ? <MicOffIcon /> : <MicIcon />}
228
+ </Button>
229
+ )}
230
+ {onPausedChange && (
231
+ <Button
232
+ variant="outline"
233
+ size={buttonSize}
234
+ shape="pill"
235
+ aria-label={paused ? labels.resume : labels.pause}
236
+ disabled={state === 'connecting' || state === 'error'}
237
+ onClick={() => onPausedChange(!paused)}
238
+ >
239
+ {paused ? <PlayIcon /> : <PauseIcon />}
240
+ </Button>
241
+ )}
242
+ {onEnd && (
243
+ <Button
244
+ variant="destructive"
245
+ size={buttonSize}
246
+ shape="pill"
247
+ aria-label={labels.end}
248
+ onClick={onEnd}
249
+ >
250
+ <PowerIcon />
251
+ </Button>
252
+ )}
253
+ </div>
254
+ )}
255
+ </div>
256
+ );
257
+ }
258
+
259
+ export { AiOrb, VoiceOrb };
@@ -0,0 +1,290 @@
1
+ 'use client';
2
+
3
+ import * as React from 'react';
4
+ import { CheckCircle2Icon, MinusIcon, PencilIcon, PlusIcon, TriangleAlertIcon } from 'lucide-react';
5
+ import { cn } from '../lib/utils';
6
+ import { Alert, AlertDescription, AlertTitle } from './alert';
7
+ import { Badge } from './badge';
8
+ import { Button } from './button';
9
+ import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from './card';
10
+ import { CollapsibleSection } from './collapsible';
11
+ import { Spinner } from './spinner';
12
+
13
+ // Cartão de mudanças, D-865: a lista de mudanças propostas, como as que um agente de IA sugere,
14
+ // para a pessoa revisar antes de aplicar. Cada item diz o tipo, criar, alterar ou remover, o
15
+ // objeto, o campo e o valor de antes, riscado, e o de depois, em destaque de sucesso. A cor nunca
16
+ // fala sozinha: cada valor leva o rótulo "Antes" ou "Depois", visível e lido pelo leitor de tela.
17
+ // Os itens ficam agrupados por objeto; com mais de `collapseAfter` itens, cada grupo recolhe.
18
+ // O pacote não sabe quem pode aplicar: o app passa as ações que a pessoa pode usar, com o texto
19
+ // dele, e o estado. Aplicando, os botões travam contra o clique duplo.
20
+
21
+ export type ChangeKind = 'create' | 'update' | 'remove';
22
+ export type ChangeStatus = 'pending' | 'applying' | 'applied' | 'failed';
23
+
24
+ export type ChangeItem = {
25
+ id: string;
26
+ kind: ChangeKind;
27
+ /** O objeto que muda, como o nome de um registro. Os itens são agrupados por ele. */
28
+ object: string;
29
+ /** O campo, como "Telefone". Sem campo, o item fala do objeto inteiro. */
30
+ field?: string;
31
+ /** Valor de antes. Criar não tem. */
32
+ before?: React.ReactNode;
33
+ /** Valor de depois. Remover não tem. */
34
+ after?: React.ReactNode;
35
+ };
36
+
37
+ export type ChangeAction = { label: string; onClick: () => void; icon?: React.ReactNode };
38
+
39
+ const LABELS = {
40
+ create: 'Criar',
41
+ update: 'Alterar',
42
+ remove: 'Remover',
43
+ before: 'Antes',
44
+ after: 'Depois',
45
+ applying: 'Aplicando as mudanças',
46
+ applied: 'Mudanças aplicadas',
47
+ failed: 'Não foi possível aplicar',
48
+ nothingApplied: 'Nada foi aplicado.',
49
+ changes: (n: number) => (n === 1 ? '1 mudança' : `${n} mudanças`),
50
+ };
51
+
52
+ export type ChangeCardLabels = Partial<typeof LABELS>;
53
+
54
+ const KIND = {
55
+ create: { variant: 'success', icon: PlusIcon },
56
+ update: { variant: 'info', icon: PencilIcon },
57
+ remove: { variant: 'destructive', icon: MinusIcon },
58
+ } as const;
59
+
60
+ function ChangeValue({
61
+ tone,
62
+ label,
63
+ children,
64
+ }: {
65
+ tone: 'before' | 'after';
66
+ label: string;
67
+ children: React.ReactNode;
68
+ }) {
69
+ return (
70
+ <span data-slot="change-value" data-tone={tone} className="flex min-w-0 items-baseline gap-1.5">
71
+ <span className="shrink-0 text-body-12 text-muted-foreground">{label}</span>
72
+ <span
73
+ className={cn(
74
+ 'min-w-0 break-words',
75
+ tone === 'before'
76
+ ? 'text-muted-foreground line-through decoration-text-error'
77
+ : 'text-body-13-medium text-text-success',
78
+ )}
79
+ >
80
+ {children}
81
+ </span>
82
+ </span>
83
+ );
84
+ }
85
+
86
+ function ChangeRow({ item, labels }: { item: ChangeItem; labels: typeof LABELS }) {
87
+ const kind = KIND[item.kind];
88
+ const Icon = kind.icon;
89
+ return (
90
+ <li
91
+ data-slot="change-item"
92
+ data-kind={item.kind}
93
+ className="grid gap-1.5 py-2.5 first:pt-0 last:pb-0"
94
+ >
95
+ <div className="flex min-w-0 flex-wrap items-center gap-2">
96
+ <Badge variant={kind.variant}>
97
+ <Icon data-icon="inline-start" aria-hidden />
98
+ {labels[item.kind]}
99
+ </Badge>
100
+ {item.field && <span className="min-w-0 text-body-13-medium">{item.field}</span>}
101
+ </div>
102
+ {(item.kind !== 'create' && item.before !== undefined) ||
103
+ (item.kind !== 'remove' && item.after !== undefined) ? (
104
+ <div className="grid gap-1">
105
+ {item.kind !== 'create' && item.before !== undefined && (
106
+ <ChangeValue tone="before" label={labels.before}>
107
+ {item.before}
108
+ </ChangeValue>
109
+ )}
110
+ {item.kind !== 'remove' && item.after !== undefined && (
111
+ <ChangeValue tone="after" label={labels.after}>
112
+ {item.after}
113
+ </ChangeValue>
114
+ )}
115
+ </div>
116
+ ) : null}
117
+ </li>
118
+ );
119
+ }
120
+
121
+ function ChangeCard({
122
+ title,
123
+ description,
124
+ changes,
125
+ status = 'pending',
126
+ error,
127
+ primaryAction,
128
+ secondaryAction,
129
+ tertiaryAction,
130
+ undoAction,
131
+ collapseAfter = 5,
132
+ size = 'default',
133
+ labels: customLabels,
134
+ className,
135
+ }: {
136
+ title: React.ReactNode;
137
+ description?: React.ReactNode;
138
+ changes: ChangeItem[];
139
+ /** pending: esperando a decisão; applying: aplicando; applied: aplicado; failed: falhou. */
140
+ status?: ChangeStatus;
141
+ /** Mensagem do app quando falha. O cartão acrescenta que nada foi aplicado. */
142
+ error?: React.ReactNode;
143
+ /** A ação principal, como Aplicar. */
144
+ primaryAction?: ChangeAction;
145
+ /** A ação secundária, como Descartar. */
146
+ secondaryAction?: ChangeAction;
147
+ /** Uma terceira ação, opcional, como Solicitar ao Administrador. */
148
+ tertiaryAction?: ChangeAction;
149
+ /** Depois de aplicado, a ação de desfazer, se o app oferecer. */
150
+ undoAction?: ChangeAction;
151
+ /** Com mais itens que isso, cada grupo recolhe e expande. */
152
+ collapseAfter?: number;
153
+ size?: 'sm' | 'default' | 'lg';
154
+ /** Textos do cartão, para outro idioma. */
155
+ labels?: ChangeCardLabels;
156
+ className?: string;
157
+ }) {
158
+ const labels = { ...LABELS, ...customLabels };
159
+ const groups = React.useMemo(() => {
160
+ const map = new Map<string, ChangeItem[]>();
161
+ for (const c of changes) map.set(c.object, [...(map.get(c.object) ?? []), c]);
162
+ return [...map];
163
+ }, [changes]);
164
+ const collapsible = changes.length > collapseAfter;
165
+ const busy = status === 'applying';
166
+ const buttonSize = size === 'sm' ? 'sm' : size === 'lg' ? 'lg' : 'default';
167
+ const showActions = status === 'pending' || status === 'applying' || status === 'failed';
168
+
169
+ const list = (items: ChangeItem[]) => (
170
+ <ul className="grid divide-y">
171
+ {items.map((item) => (
172
+ <ChangeRow key={item.id} item={item} labels={labels} />
173
+ ))}
174
+ </ul>
175
+ );
176
+
177
+ return (
178
+ <Card
179
+ data-slot="change-card"
180
+ data-status={status}
181
+ size={size}
182
+ aria-busy={busy || undefined}
183
+ className={cn(
184
+ size === 'sm' && '[&_[data-slot=change-item]]:text-body-12',
185
+ size === 'lg' && 'text-body-14',
186
+ className,
187
+ )}
188
+ >
189
+ <CardHeader>
190
+ <CardTitle className={cn(size === 'lg' && 'text-heading-18')}>{title}</CardTitle>
191
+ <CardDescription>{description ?? labels.changes(changes.length)}</CardDescription>
192
+ </CardHeader>
193
+ <CardContent className="grid gap-3">
194
+ {collapsible ? (
195
+ <div className="-mx-2.5">
196
+ {groups.map(([object, items], i) => (
197
+ <CollapsibleSection
198
+ key={object}
199
+ title={object}
200
+ count={items.length}
201
+ defaultOpen={i === 0}
202
+ >
203
+ {list(items)}
204
+ </CollapsibleSection>
205
+ ))}
206
+ </div>
207
+ ) : (
208
+ groups.map(([object, items]) => (
209
+ <section key={object} aria-label={object} className="grid gap-2">
210
+ {groups.length > 1 && (
211
+ <h4 className="text-body-12-medium text-muted-foreground">{object}</h4>
212
+ )}
213
+ {list(items)}
214
+ </section>
215
+ ))
216
+ )}
217
+ {/* O estado é anunciado para o leitor de tela quando muda. */}
218
+ <div role="status" aria-live="polite" className="contents">
219
+ {status === 'applying' && (
220
+ <p className="flex items-center gap-2 text-body-13 text-muted-foreground">
221
+ <Spinner label="" />
222
+ {labels.applying}
223
+ </p>
224
+ )}
225
+ {status === 'applied' && (
226
+ <Alert variant="success">
227
+ <CheckCircle2Icon aria-hidden />
228
+ <AlertTitle>{labels.applied}</AlertTitle>
229
+ </Alert>
230
+ )}
231
+ {status === 'failed' && (
232
+ <Alert variant="destructive-subtle">
233
+ <TriangleAlertIcon aria-hidden />
234
+ <AlertTitle>{labels.failed}</AlertTitle>
235
+ <AlertDescription>
236
+ {error ? <>{error} </> : null}
237
+ {labels.nothingApplied}
238
+ </AlertDescription>
239
+ </Alert>
240
+ )}
241
+ </div>
242
+ </CardContent>
243
+ {((showActions && (primaryAction || secondaryAction || tertiaryAction)) ||
244
+ (status === 'applied' && undoAction)) && (
245
+ <CardFooter className="flex flex-wrap justify-end gap-2">
246
+ {status === 'applied' && undoAction ? (
247
+ <Button variant="outline" size={buttonSize} onClick={undoAction.onClick}>
248
+ {undoAction.icon}
249
+ {undoAction.label}
250
+ </Button>
251
+ ) : (
252
+ <>
253
+ {tertiaryAction && (
254
+ <Button
255
+ variant="ghost"
256
+ size={buttonSize}
257
+ className="mr-auto"
258
+ disabled={busy}
259
+ onClick={tertiaryAction.onClick}
260
+ >
261
+ {tertiaryAction.icon}
262
+ {tertiaryAction.label}
263
+ </Button>
264
+ )}
265
+ {secondaryAction && (
266
+ <Button
267
+ variant="outline"
268
+ size={buttonSize}
269
+ disabled={busy}
270
+ onClick={secondaryAction.onClick}
271
+ >
272
+ {secondaryAction.icon}
273
+ {secondaryAction.label}
274
+ </Button>
275
+ )}
276
+ {primaryAction && (
277
+ <Button size={buttonSize} disabled={busy} onClick={primaryAction.onClick}>
278
+ {busy ? <Spinner data-icon="inline-start" label="" /> : primaryAction.icon}
279
+ {primaryAction.label}
280
+ </Button>
281
+ )}
282
+ </>
283
+ )}
284
+ </CardFooter>
285
+ )}
286
+ </Card>
287
+ );
288
+ }
289
+
290
+ export { ChangeCard };
@@ -1624,10 +1624,57 @@
1624
1624
  &[data-size='tiny']::after {
1625
1625
  mask-image: none;
1626
1626
  }
1627
+ /* Conversa por voz, D-866: o orb cresce até 15% com o nível do som que o app passa, e cada
1628
+ estado tem o seu visual. Conectando pulsa devagar e meio apagado; pensando gira mais rápido;
1629
+ pausado e erro param e perdem a cor, e o erro ganha o contorno vermelho. */
1630
+ &[data-state] {
1631
+ transform: scale(calc(1 + var(--ai-orb-level, 0) * 0.15));
1632
+ transition:
1633
+ transform var(--duration-fast) ease-out,
1634
+ filter var(--duration-medium) ease-out,
1635
+ opacity var(--duration-medium) ease-out;
1636
+ }
1637
+ &[data-state='connecting'] {
1638
+ animation: ai-orb-pulse 1.6s ease-in-out infinite;
1639
+ }
1640
+ &[data-state='thinking']::before {
1641
+ animation-duration: calc(var(--ai-orb-duration, 20s) / 5);
1642
+ }
1643
+ &[data-state='paused'],
1644
+ &[data-state='error'] {
1645
+ filter: grayscale(1);
1646
+ opacity: 0.6;
1647
+ &::before {
1648
+ animation-play-state: paused;
1649
+ }
1650
+ }
1651
+ &[data-state='error'] {
1652
+ outline: 2px solid var(--destructive);
1653
+ outline-offset: 3px;
1654
+ }
1627
1655
  @media (prefers-reduced-motion: reduce) {
1628
1656
  &::before {
1629
1657
  animation: none;
1630
1658
  }
1659
+ &[data-state] {
1660
+ transform: none;
1661
+ transition: none;
1662
+ animation: none;
1663
+ }
1664
+ /* Sem o pulso, conectando fica parado e meio apagado, para não parecer pronto. */
1665
+ &[data-state='connecting'] {
1666
+ opacity: 0.6;
1667
+ }
1668
+ }
1669
+ }
1670
+
1671
+ @keyframes ai-orb-pulse {
1672
+ 0%,
1673
+ 100% {
1674
+ opacity: 0.5;
1675
+ }
1676
+ 50% {
1677
+ opacity: 0.85;
1631
1678
  }
1632
1679
  }
1633
1680