@tbox.cn/app-agent-ui-kit 1.0.0-alpha.1 → 1.0.0-alpha.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/package.json +9 -6
- package/src/ChatPage.tsx +34 -7
- package/src/card/define-card.ts +34 -0
- package/src/card/primitives.test.tsx +147 -0
- package/src/card/primitives.tsx +627 -0
- package/src/card/use-card-actions.ts +86 -0
- package/src/chat-config.test.ts +35 -71
- package/src/chat-config.ts +18 -0
- package/src/components/ActionBar/DebugButton.tsx +3 -3
- package/src/components/ActionBar/index.tsx +13 -14
- package/src/components/ChatHeader/index.tsx +19 -17
- package/src/components/ChatInput/index.tsx +32 -26
- package/src/components/ChatInput/voice/VoicePressField.tsx +12 -3
- package/src/components/ChatInput/voice/VoiceRecordingOverlay.tsx +9 -9
- package/src/components/HistoryEntry/index.tsx +3 -4
- package/src/components/MediaList/index.tsx +42 -28
- package/src/components/MessageBubble/index.tsx +52 -27
- package/src/components/PullDownIndicator/index.tsx +3 -4
- package/src/components/QuickCommands/index.tsx +6 -6
- package/src/components/ReasoningBlock/index.tsx +14 -9
- package/src/components/ScrollToBottomButton/index.tsx +2 -4
- package/src/components/ToolCallBlock/index.tsx +54 -36
- package/src/icons.ts +39 -0
- package/src/index.ts +54 -1
- package/src/shell.contract.json +59 -0
- package/src/shell.test.ts +61 -0
- package/src/shell.ts +45 -0
- package/src/theme/base.css +132 -0
- package/src/theme/contract.json +1 -1
- package/src/theme/theme-contract.test.ts +3 -3
- package/src/theme/{tokens.less → tokens.css} +14 -12
- package/src/ChatPage.less +0 -62
- package/src/components/ActionBar/index.less +0 -123
- package/src/components/ChatHeader/index.less +0 -148
- package/src/components/ChatInput/index.less +0 -394
- package/src/components/HistoryEntry/index.less +0 -49
- package/src/components/MediaList/index.less +0 -241
- package/src/components/MessageBubble/index.less +0 -325
- package/src/components/PullDownIndicator/index.less +0 -32
- package/src/components/QuickCommands/index.less +0 -63
- package/src/components/ReasoningBlock/index.less +0 -90
- package/src/components/ScrollToBottomButton/index.less +0 -32
- package/src/components/ToolCallBlock/index.less +0 -312
- package/src/theme/global.less +0 -99
- /package/src/theme/{motion.less → motion.css} +0 -0
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 卡片内交互:把「点按钮之后发生什么」收敛成两种意图,避免每张卡重写门控。
|
|
3
|
+
*
|
|
4
|
+
* - `send`:把一句话作为用户消息发回,走模型(信息不足、需要模型再判断时用);
|
|
5
|
+
* - `invoke`:触发卡片上声明的确定性动作(moduleAction),不过模型;
|
|
6
|
+
* - `disabled`:历史卡片与生成中一律禁用,两者文案不同——历史卡只读,生成中提示等待。
|
|
7
|
+
*
|
|
8
|
+
* 门控与 toast 文案集中在实现处;卡片组件只消费 `disabled` 与两个动作函数。
|
|
9
|
+
*/
|
|
10
|
+
import { useCallback } from 'react';
|
|
11
|
+
import { toast } from '../utils/toast';
|
|
12
|
+
import { useChatStore } from '../store-context';
|
|
13
|
+
|
|
14
|
+
export interface UseCardActionsOptions {
|
|
15
|
+
/** 卡片实例 id(协议字段名 surfaceId 的历史别名) */
|
|
16
|
+
cardId: string;
|
|
17
|
+
/** 历史消息里的卡片:只读 */
|
|
18
|
+
isHistory?: boolean;
|
|
19
|
+
/** 卡片携带的动作令牌(`payload.actionTokens`,仅 moduleAction 有) */
|
|
20
|
+
actionTokens?: Record<string, string>;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface CardActions {
|
|
24
|
+
/** 发一句话给模型;`displayText` 是气泡展示文本,缺省同 `text` */
|
|
25
|
+
send(text: string, opts?: { displayText?: string }): void;
|
|
26
|
+
/**
|
|
27
|
+
* 触发卡片上的确定性动作(需该动作已签发令牌)。
|
|
28
|
+
* `input` 作为该次调用的入参(UI_ACTION 的 formData 通道),由服务端 `inputSchema` 校验;
|
|
29
|
+
* 不传时按空对象校验——无参动作写 `z.object({})`。
|
|
30
|
+
*/
|
|
31
|
+
invoke(actionId: string, input?: Record<string, unknown>): void;
|
|
32
|
+
/** 历史卡或生成中为 true——按钮应据此置灰 */
|
|
33
|
+
disabled: boolean;
|
|
34
|
+
isHistory: boolean;
|
|
35
|
+
isGenerating: boolean;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export function useCardActions(opts: UseCardActionsOptions): CardActions {
|
|
39
|
+
const sendUiAction = useChatStore((s) => s.sendUiAction);
|
|
40
|
+
const isGenerating = useChatStore((s) => s.isGenerating);
|
|
41
|
+
const isHistory = opts.isHistory === true;
|
|
42
|
+
const disabled = isHistory || isGenerating;
|
|
43
|
+
|
|
44
|
+
const send = useCallback(
|
|
45
|
+
(text: string, o?: { displayText?: string }) => {
|
|
46
|
+
if (!text) return;
|
|
47
|
+
if (isHistory) {
|
|
48
|
+
void toast('历史卡片仅供查看', 'info');
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
if (isGenerating) {
|
|
52
|
+
void toast('正在处理上一条消息,请稍候', 'info');
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
sendUiAction(opts.cardId, {
|
|
56
|
+
type: 'sendMessage',
|
|
57
|
+
value: text,
|
|
58
|
+
displayText: o?.displayText ?? text,
|
|
59
|
+
visible: true,
|
|
60
|
+
});
|
|
61
|
+
},
|
|
62
|
+
[opts.cardId, isHistory, isGenerating, sendUiAction],
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
const invoke = useCallback(
|
|
66
|
+
(actionId: string, input?: Record<string, unknown>) => {
|
|
67
|
+
if (isHistory) {
|
|
68
|
+
void toast('历史卡片仅供查看', 'info');
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
if (isGenerating) {
|
|
72
|
+
void toast('正在处理上一条消息,请稍候', 'info');
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
const contextToken = opts.actionTokens?.[actionId];
|
|
76
|
+
if (!contextToken) {
|
|
77
|
+
void toast('该操作不可用', 'info');
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
sendUiAction(opts.cardId, { type: 'moduleAction', actionId, contextToken }, input);
|
|
81
|
+
},
|
|
82
|
+
[opts.cardId, opts.actionTokens, isHistory, isGenerating, sendUiAction],
|
|
83
|
+
);
|
|
84
|
+
|
|
85
|
+
return { send, invoke, disabled, isHistory, isGenerating };
|
|
86
|
+
}
|
package/src/chat-config.test.ts
CHANGED
|
@@ -1,82 +1,46 @@
|
|
|
1
|
-
|
|
2
|
-
* chat-config store 水合 action(chat settings 服务端下发真源):
|
|
3
|
-
* applyServerSettings 五键整组语义——undefined 键保留构建期快照,禁部分水合。
|
|
4
|
-
*/
|
|
5
|
-
import { describe, it, expect, beforeEach } from 'vitest';
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
6
2
|
import { configureChatConfigDefaults, useChatConfigStore } from './chat-config';
|
|
7
3
|
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
enableVoiceInput: true,
|
|
18
|
-
defaultInputMode: 'TEXT',
|
|
19
|
-
});
|
|
4
|
+
const reset = () => {
|
|
5
|
+
configureChatConfigDefaults({
|
|
6
|
+
enableImageUpload: true,
|
|
7
|
+
enableVideoUpload: true,
|
|
8
|
+
enableTTS: true,
|
|
9
|
+
enableVoiceInput: true,
|
|
10
|
+
defaultInputMode: 'TEXT',
|
|
11
|
+
quickCommands: [],
|
|
12
|
+
retryOnError: true,
|
|
20
13
|
});
|
|
14
|
+
useChatConfigStore.setState({ identity: undefined, welcome: undefined });
|
|
15
|
+
};
|
|
21
16
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
17
|
+
describe('chat 设置的构建期快照', () => {
|
|
18
|
+
it('identity / welcome / retryOnError 随快照注入', () => {
|
|
19
|
+
reset();
|
|
20
|
+
configureChatConfigDefaults({
|
|
21
|
+
identity: { name: '悦享里', tagline: '商圈智能助手' },
|
|
22
|
+
welcome: { title: '今天想逛点什么?', subtitle: '会员、停车、优惠都能问我' },
|
|
23
|
+
retryOnError: false,
|
|
29
24
|
});
|
|
30
|
-
|
|
31
|
-
expect(
|
|
32
|
-
expect(
|
|
33
|
-
expect(
|
|
34
|
-
expect(snapshot().defaultInputMode).toBe('VOICE');
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
it('部分键(undefined 保留快照值——禁部分水合导致快照丢失)', () => {
|
|
38
|
-
snapshot().applyServerSettings({ enableTTS: false });
|
|
39
|
-
expect(snapshot().enableTTS).toBe(false);
|
|
40
|
-
expect(snapshot().enableImageUpload).toBe(true);
|
|
41
|
-
expect(snapshot().enableVideoUpload).toBe(true);
|
|
42
|
-
expect(snapshot().enableVoiceInput).toBe(true);
|
|
43
|
-
expect(snapshot().defaultInputMode).toBe('TEXT');
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
it('整包 undefined(旧 server / ack 未达)→ no-op 快照保留', () => {
|
|
47
|
-
snapshot().applyServerSettings(undefined);
|
|
48
|
-
expect(snapshot().enableImageUpload).toBe(true);
|
|
49
|
-
expect(snapshot().enableTTS).toBe(true);
|
|
50
|
-
expect(snapshot().defaultInputMode).toBe('TEXT');
|
|
25
|
+
const state = useChatConfigStore.getState();
|
|
26
|
+
expect(state.identity?.name).toBe('悦享里');
|
|
27
|
+
expect(state.welcome?.title).toBe('今天想逛点什么?');
|
|
28
|
+
expect(state.retryOnError).toBe(false);
|
|
51
29
|
});
|
|
52
30
|
|
|
53
|
-
it('
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
// toEqual 全状态深比较——单键 toBe 对原始值恒真,钉不住实现回归
|
|
59
|
-
expect(snapshot()).toEqual(after1);
|
|
60
|
-
expect(snapshot().enableTTS).toBe(false);
|
|
61
|
-
expect(snapshot().defaultInputMode).toBe('VOICE');
|
|
31
|
+
it('缺省 retryOnError 为 true,identity 缺省不渲染', () => {
|
|
32
|
+
reset();
|
|
33
|
+
const state = useChatConfigStore.getState();
|
|
34
|
+
expect(state.retryOnError).toBe(true);
|
|
35
|
+
expect(state.identity).toBeUndefined();
|
|
62
36
|
});
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
describe('configureChatConfigDefaults:构建期快照注入(W2-1 kit 化)', () => {
|
|
66
|
-
it('快照键覆盖内建缺省;缺席键保留;undefined no-op', () => {
|
|
67
|
-
configureChatConfigDefaults({
|
|
68
|
-
enableTTS: false,
|
|
69
|
-
quickCommands: [{ label: 'L', query: 'Q' }],
|
|
70
|
-
});
|
|
71
|
-
expect(snapshot().enableTTS).toBe(false);
|
|
72
|
-
expect(snapshot().quickCommands).toEqual([{ label: 'L', query: 'Q' }]);
|
|
73
|
-
// 缺席键保留
|
|
74
|
-
expect(snapshot().enableImageUpload).toBe(true);
|
|
75
|
-
|
|
76
|
-
configureChatConfigDefaults(undefined);
|
|
77
|
-
expect(snapshot().enableTTS).toBe(false); // no-op:不因 undefined 回翻
|
|
78
37
|
|
|
79
|
-
|
|
80
|
-
|
|
38
|
+
it('HELLO_ACK 水合不覆盖展示配置', () => {
|
|
39
|
+
reset();
|
|
40
|
+
configureChatConfigDefaults({ identity: { name: '悦享里' } });
|
|
41
|
+
useChatConfigStore.getState().applyServerSettings({ enableTTS: false } as never);
|
|
42
|
+
const state = useChatConfigStore.getState();
|
|
43
|
+
expect(state.enableTTS).toBe(false);
|
|
44
|
+
expect(state.identity?.name).toBe('悦享里');
|
|
81
45
|
});
|
|
82
46
|
});
|
package/src/chat-config.ts
CHANGED
|
@@ -15,6 +15,16 @@ export interface QuickCommand {
|
|
|
15
15
|
icon?: string;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
+
export interface ChatIdentity {
|
|
19
|
+
name: string;
|
|
20
|
+
tagline?: string;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface ChatWelcome {
|
|
24
|
+
title: string;
|
|
25
|
+
subtitle?: string;
|
|
26
|
+
}
|
|
27
|
+
|
|
18
28
|
interface ChatConfigStore {
|
|
19
29
|
enableImageUpload: boolean;
|
|
20
30
|
enableVideoUpload: boolean;
|
|
@@ -22,6 +32,10 @@ interface ChatConfigStore {
|
|
|
22
32
|
enableVoiceInput: boolean;
|
|
23
33
|
defaultInputMode: 'TEXT' | 'VOICE';
|
|
24
34
|
quickCommands: QuickCommand[];
|
|
35
|
+
/** 身份与欢迎区是构建期展示配置,不经 HELLO_ACK 水合 */
|
|
36
|
+
identity?: ChatIdentity;
|
|
37
|
+
welcome?: ChatWelcome;
|
|
38
|
+
retryOnError: boolean;
|
|
25
39
|
/** HELLO_ACK settings 水合:服务端单一真源;undefined 键保留构建期快照(五键整组语义,禁部分水合) */
|
|
26
40
|
applyServerSettings: (settings: ChatUiSettings | undefined) => void;
|
|
27
41
|
}
|
|
@@ -34,6 +48,7 @@ export const useChatConfigStore = create<ChatConfigStore>()((set) => ({
|
|
|
34
48
|
enableVoiceInput: true,
|
|
35
49
|
defaultInputMode: 'TEXT',
|
|
36
50
|
quickCommands: [],
|
|
51
|
+
retryOnError: true,
|
|
37
52
|
applyServerSettings: (settings) =>
|
|
38
53
|
set((cur) => ({
|
|
39
54
|
enableImageUpload: settings?.enableImageUpload ?? cur.enableImageUpload,
|
|
@@ -58,5 +73,8 @@ export function configureChatConfigDefaults(snapshot: Record<string, unknown> |
|
|
|
58
73
|
defaultInputMode:
|
|
59
74
|
(snapshot['defaultInputMode'] as 'TEXT' | 'VOICE' | undefined) ?? cur.defaultInputMode,
|
|
60
75
|
quickCommands: (snapshot['quickCommands'] as QuickCommand[] | undefined) ?? cur.quickCommands,
|
|
76
|
+
identity: (snapshot['identity'] as ChatIdentity | undefined) ?? cur.identity,
|
|
77
|
+
welcome: (snapshot['welcome'] as ChatWelcome | undefined) ?? cur.welcome,
|
|
78
|
+
retryOnError: (snapshot['retryOnError'] as boolean | undefined) ?? cur.retryOnError,
|
|
61
79
|
}));
|
|
62
80
|
}
|
|
@@ -45,9 +45,9 @@ export function DebugButton({
|
|
|
45
45
|
};
|
|
46
46
|
|
|
47
47
|
return (
|
|
48
|
-
<div className="tbox-debug-btn" onClick={onClick}>
|
|
49
|
-
<Bug className="tbox-debug-btn__icon" size={22} />
|
|
50
|
-
<span className="tbox-debug-btn__text">调试</span>
|
|
48
|
+
<div className="tbox-debug-btn inline-flex h-[26px] items-center justify-center gap-1 rounded-full bg-white px-[11px] text-secondary-foreground transition-[background-color,transform] duration-[var(--tbox-motion-duration-fast)] ease-[ease] active:scale-[0.97] active:bg-muted" onClick={onClick}>
|
|
49
|
+
<Bug className="tbox-debug-btn__icon size-[14px] shrink-0" size={22} />
|
|
50
|
+
<span className="tbox-debug-btn__text text-xs leading-none">调试</span>
|
|
51
51
|
</div>
|
|
52
52
|
);
|
|
53
53
|
}
|
|
@@ -10,7 +10,6 @@ import type { ChatMessage } from '../../types';
|
|
|
10
10
|
import { copyText } from '../../utils/copyText';
|
|
11
11
|
import { toast } from '../../utils/toast';
|
|
12
12
|
import { DebugButton } from './DebugButton';
|
|
13
|
-
import './index.less';
|
|
14
13
|
|
|
15
14
|
/**
|
|
16
15
|
* 跨所有 ActionBar 实例共享的"正在朗读的消息 id"(对齐原模板 useTTS 的 _playingId)。
|
|
@@ -45,8 +44,8 @@ export function CopyButton({ text }: { text: string }) {
|
|
|
45
44
|
};
|
|
46
45
|
|
|
47
46
|
return (
|
|
48
|
-
<button type="button" className="tbox-action-btn" onClick={copy} aria-label="复制">
|
|
49
|
-
<span className="tbox-action-btn__icon-wrap">
|
|
47
|
+
<button type="button" className="tbox-action-btn flex size-[26px] shrink-0 cursor-pointer items-center justify-center rounded-full border-0 bg-white p-0 text-muted-foreground transition-[background-color,transform] duration-[var(--tbox-motion-duration-fast)] ease-[ease] [font-family:inherit] active:scale-[0.97] active:bg-muted" onClick={copy} aria-label="复制">
|
|
48
|
+
<span className="tbox-action-btn__icon-wrap flex size-[14px] shrink-0 items-center justify-center">
|
|
50
49
|
<Copy size={22} />
|
|
51
50
|
</span>
|
|
52
51
|
</button>
|
|
@@ -108,17 +107,17 @@ export function ActionBar({ message }: { message: ChatMessage }) {
|
|
|
108
107
|
const canFeedback = !!message.requestId;
|
|
109
108
|
|
|
110
109
|
return (
|
|
111
|
-
<div className="tbox-action-bar">
|
|
110
|
+
<div className="tbox-action-bar flex items-center gap-2">
|
|
112
111
|
{enableTTS && tts && (
|
|
113
|
-
<div className={`tbox-action-btn${wave ? ' tbox-tts-btn--playing' : ''}`} onClick={onTts}>
|
|
112
|
+
<div className={`tbox-action-btn flex size-[26px] shrink-0 cursor-pointer items-center justify-center rounded-full border-0 p-0 transition-[background-color,transform] duration-[var(--tbox-motion-duration-fast)] ease-[ease] [font-family:inherit] active:scale-[0.97] active:bg-muted ${wave ? ' tbox-tts-btn--playing bg-primary-foreground text-primary' : ' bg-white text-muted-foreground'}`} onClick={onTts}>
|
|
114
113
|
{wave ? (
|
|
115
|
-
<div className="tbox-tts-wave">
|
|
116
|
-
<div className="tbox-tts-wave__bar tbox-tts-wave__bar--1" />
|
|
117
|
-
<div className="tbox-tts-wave__bar tbox-tts-wave__bar--2" />
|
|
118
|
-
<div className="tbox-tts-wave__bar tbox-tts-wave__bar--3" />
|
|
114
|
+
<div className="tbox-tts-wave flex size-[14px] items-center justify-center gap-[1.5px]">
|
|
115
|
+
<div className="tbox-tts-wave__bar tbox-tts-wave__bar--1 h-[7px] w-[1.5px] origin-bottom rounded-full bg-primary animate-[tbox-tts-wave_0.8s_ease-in-out_infinite] [animation-delay:0s]" />
|
|
116
|
+
<div className="tbox-tts-wave__bar tbox-tts-wave__bar--2 h-[9px] w-[1.5px] origin-bottom rounded-full bg-primary animate-[tbox-tts-wave_0.8s_ease-in-out_infinite] [animation-delay:0.15s]" />
|
|
117
|
+
<div className="tbox-tts-wave__bar tbox-tts-wave__bar--3 h-[6px] w-[1.5px] origin-bottom rounded-full bg-primary animate-[tbox-tts-wave_0.8s_ease-in-out_infinite] [animation-delay:0.3s]" />
|
|
119
118
|
</div>
|
|
120
119
|
) : (
|
|
121
|
-
<div className="tbox-action-btn__icon-wrap">
|
|
120
|
+
<div className="tbox-action-btn__icon-wrap flex size-[14px] shrink-0 items-center justify-center">
|
|
122
121
|
<SpeakerHigh size={22} />
|
|
123
122
|
</div>
|
|
124
123
|
)}
|
|
@@ -130,18 +129,18 @@ export function ActionBar({ message }: { message: ChatMessage }) {
|
|
|
130
129
|
{canFeedback && (
|
|
131
130
|
<>
|
|
132
131
|
<div
|
|
133
|
-
className={`tbox-action-btn${message.feedbackState === 'like' ? ' tbox-action-btn--active' : ''}`}
|
|
132
|
+
className={`tbox-action-btn flex size-[26px] shrink-0 cursor-pointer items-center justify-center rounded-full border-0 p-0 transition-[background-color,transform] duration-[var(--tbox-motion-duration-fast)] ease-[ease] [font-family:inherit] active:scale-[0.97] active:bg-muted ${message.feedbackState === 'like' ? ' tbox-action-btn--active bg-primary-foreground text-primary' : ' bg-white text-muted-foreground'}`}
|
|
134
133
|
onClick={() => onFeedback('like')}
|
|
135
134
|
>
|
|
136
|
-
<div className="tbox-action-btn__icon-wrap">
|
|
135
|
+
<div className="tbox-action-btn__icon-wrap flex size-[14px] shrink-0 items-center justify-center">
|
|
137
136
|
<ThumbsUp size={22} />
|
|
138
137
|
</div>
|
|
139
138
|
</div>
|
|
140
139
|
<div
|
|
141
|
-
className={`tbox-action-btn${message.feedbackState === 'dislike' ? ' tbox-action-btn--active' : ''}`}
|
|
140
|
+
className={`tbox-action-btn flex size-[26px] shrink-0 cursor-pointer items-center justify-center rounded-full border-0 p-0 transition-[background-color,transform] duration-[var(--tbox-motion-duration-fast)] ease-[ease] [font-family:inherit] active:scale-[0.97] active:bg-muted ${message.feedbackState === 'dislike' ? ' tbox-action-btn--active bg-primary-foreground text-primary' : ' bg-white text-muted-foreground'}`}
|
|
142
141
|
onClick={() => onFeedback('dislike')}
|
|
143
142
|
>
|
|
144
|
-
<div className="tbox-action-btn__icon-wrap">
|
|
143
|
+
<div className="tbox-action-btn__icon-wrap flex size-[14px] shrink-0 items-center justify-center">
|
|
145
144
|
<ThumbsDown size={22} />
|
|
146
145
|
</div>
|
|
147
146
|
</div>
|
|
@@ -2,7 +2,6 @@ import { useCallback, useEffect, useRef, useState } from 'react';
|
|
|
2
2
|
import { CaretDown, SpeakerHigh, SpeakerSlash, Trash } from '@phosphor-icons/react';
|
|
3
3
|
import { useChatConfigStore } from '../../chat-config';
|
|
4
4
|
import { useChatStore } from '../../store-context';
|
|
5
|
-
import './index.less';
|
|
6
5
|
|
|
7
6
|
interface ChatHeaderProps {
|
|
8
7
|
ttsAutoPlay: boolean;
|
|
@@ -14,8 +13,10 @@ export default function ChatHeader({ ttsAutoPlay, onToggleTTS, onClearChat }: Ch
|
|
|
14
13
|
const [isExpanded, setIsExpanded] = useState(false);
|
|
15
14
|
const headerRef = useRef<HTMLDivElement>(null);
|
|
16
15
|
const enableTTS = useChatConfigStore((s) => s.enableTTS);
|
|
17
|
-
//
|
|
16
|
+
// 品牌名三级来源:chat.json identity.name → HELLO_ACK 的 mallName(商圈部署回显)→ 不渲染
|
|
17
|
+
const identity = useChatConfigStore((s) => s.identity);
|
|
18
18
|
const mallName = useChatStore((s) => s.helloAck?.mallScope?.mallName);
|
|
19
|
+
const brandName = identity?.name ?? mallName;
|
|
19
20
|
|
|
20
21
|
const handleClear = useCallback(() => {
|
|
21
22
|
onClearChat();
|
|
@@ -36,37 +37,38 @@ export default function ChatHeader({ ttsAutoPlay, onToggleTTS, onClearChat }: Ch
|
|
|
36
37
|
}, [isExpanded]);
|
|
37
38
|
|
|
38
39
|
return (
|
|
39
|
-
<div className="chat-header" ref={headerRef}>
|
|
40
|
-
{
|
|
41
|
-
<div className="chat-header__brand" aria-label={
|
|
42
|
-
<span className="chat-header__brand-mark" aria-hidden="true" />
|
|
43
|
-
<span className="chat-header__brand-name">{
|
|
40
|
+
<div className="chat-header pointer-events-none absolute left-1/2 top-[calc(5px+env(safe-area-inset-top,0px))] z-[100] flex w-full max-w-content -translate-x-1/2 flex-col items-end px-4" ref={headerRef}>
|
|
41
|
+
{brandName ? (
|
|
42
|
+
<div className="chat-header__brand absolute left-4 top-[2px] inline-flex min-h-[22px] items-center text-foreground" aria-label={brandName}>
|
|
43
|
+
<span className="chat-header__brand-mark mr-[7px] h-[17px] w-[3.5px] rounded-[1px] bg-primary" aria-hidden="true" />
|
|
44
|
+
<span className="chat-header__brand-name text-xs font-[760] leading-none tracking-normal">{brandName}</span>
|
|
45
|
+
{identity?.tagline ? <span className="chat-header__brand-tagline ml-[6px] overflow-hidden text-ellipsis whitespace-nowrap text-xs leading-none text-muted-foreground">{identity.tagline}</span> : null}
|
|
44
46
|
</div>
|
|
45
47
|
) : null}
|
|
46
|
-
<div className={`chat-header__group${!isExpanded ? ' chat-header__group--collapsed' : ''}`}>
|
|
47
|
-
<button type="button" className="chat-header__btn" onClick={handleClear}>
|
|
48
|
-
<Trash size={22} className="chat-header__btn-icon" />
|
|
49
|
-
<span className="chat-header__btn-text">清空</span>
|
|
48
|
+
<div className={`chat-header__group flex items-center gap-[2px] overflow-hidden rounded-[6px] border-[0.5px] border-border bg-[rgba(255,255,255,0.96)] shadow-sm transition-[opacity,transform] motion-reduce:transition-none ${!isExpanded ? ' chat-header__group--collapsed pointer-events-none mb-0 max-h-0 px-[3px] py-0 opacity-0 [transform:translateY(-4px)]' : ' pointer-events-auto mb-[3px] max-h-10 px-[3px] py-[3px] opacity-100 [transform:translateY(0)]'}`}>
|
|
49
|
+
<button type="button" className="chat-header__btn inline-flex min-h-[26px] appearance-none items-center justify-center gap-[3.5px] rounded-[4px] border-0 bg-transparent px-[7.5px] py-0 text-secondary-foreground [font-family:inherit] active:bg-muted focus-visible:outline-[1.5px] focus-visible:outline-offset-[-1px] focus-visible:outline-[rgba(9,107,250,0.24)]" onClick={handleClear}>
|
|
50
|
+
<Trash size={22} className="chat-header__btn-icon size-[11px] shrink-0 text-primary" />
|
|
51
|
+
<span className="chat-header__btn-text text-inherit text-xs font-[560] leading-none whitespace-nowrap">清空</span>
|
|
50
52
|
</button>
|
|
51
53
|
{enableTTS && (
|
|
52
|
-
<button type="button" className="chat-header__btn" onClick={onToggleTTS}>
|
|
54
|
+
<button type="button" className="chat-header__btn inline-flex min-h-[26px] appearance-none items-center justify-center gap-[3.5px] rounded-[4px] border-0 bg-transparent px-[7.5px] py-0 text-secondary-foreground [font-family:inherit] active:bg-muted focus-visible:outline-[1.5px] focus-visible:outline-offset-[-1px] focus-visible:outline-[rgba(9,107,250,0.24)]" onClick={onToggleTTS}>
|
|
53
55
|
{ttsAutoPlay ? (
|
|
54
|
-
<SpeakerHigh size={22} className="chat-header__btn-icon" />
|
|
56
|
+
<SpeakerHigh size={22} className="chat-header__btn-icon size-[11px] shrink-0 text-primary" />
|
|
55
57
|
) : (
|
|
56
|
-
<SpeakerSlash size={22} className="chat-header__btn-icon" />
|
|
58
|
+
<SpeakerSlash size={22} className="chat-header__btn-icon size-[11px] shrink-0 text-primary" />
|
|
57
59
|
)}
|
|
58
|
-
<span className="chat-header__btn-text">{ttsAutoPlay ? '关闭' : '播放'}</span>
|
|
60
|
+
<span className="chat-header__btn-text text-inherit text-xs font-[560] leading-none whitespace-nowrap">{ttsAutoPlay ? '关闭' : '播放'}</span>
|
|
59
61
|
</button>
|
|
60
62
|
)}
|
|
61
63
|
</div>
|
|
62
64
|
<button
|
|
63
|
-
className="chat-header__toggle"
|
|
65
|
+
className="chat-header__toggle pointer-events-auto flex h-[22px] w-7 appearance-none items-center justify-center rounded-[4px] border-[0.5px] border-border bg-[rgba(255,255,255,0.92)] text-muted-foreground shadow-sm [font-family:inherit] active:bg-muted focus-visible:outline-[1.5px] focus-visible:outline-offset-[1px] focus-visible:outline-[rgba(9,107,250,0.24)]"
|
|
64
66
|
type="button"
|
|
65
67
|
aria-label={isExpanded ? '收起对话工具' : '展开对话工具'}
|
|
66
68
|
aria-expanded={isExpanded}
|
|
67
69
|
onClick={() => setIsExpanded((p) => !p)}
|
|
68
70
|
>
|
|
69
|
-
<span className={`chat-header__arrow${isExpanded ? ' chat-header__arrow--up' : ''}`}>
|
|
71
|
+
<span className={`chat-header__arrow flex items-center justify-center transition-transform duration-[var(--tbox-motion-duration-base)] ease-[var(--tbox-motion-easing-standard)] motion-reduce:transition-none ${isExpanded ? ' chat-header__arrow--up rotate-180' : ''}`}>
|
|
70
72
|
<CaretDown size={14} />
|
|
71
73
|
</span>
|
|
72
74
|
</button>
|
|
@@ -14,7 +14,6 @@ import keyboardIcon from '../../../assets/keyboard-circle.svg';
|
|
|
14
14
|
import sendIcon from '../../../assets/send-gradient.svg';
|
|
15
15
|
import stopIcon from '../../../assets/stop@2x.png';
|
|
16
16
|
import moreIcon from '../../../assets/more-circle.svg';
|
|
17
|
-
import './index.less';
|
|
18
17
|
|
|
19
18
|
type PickKind = 'image' | 'camera' | 'video';
|
|
20
19
|
|
|
@@ -27,6 +26,13 @@ const OPTION_ICONS: Record<PickKind, { icon: string; label: string }> = {
|
|
|
27
26
|
|
|
28
27
|
const MENU_ANIMATION_MS = 250;
|
|
29
28
|
|
|
29
|
+
/** 菜单展开时选项的错峰入场延迟(旧 less 的 `:nth-child(n)` transition-delay)。 */
|
|
30
|
+
const MENU_OPTION_DELAY_CLASS: Record<number, string> = {
|
|
31
|
+
0: '[.tbox-media-picker-menu--visible_&]:[transition-delay:0.05s]',
|
|
32
|
+
1: '[.tbox-media-picker-menu--visible_&]:[transition-delay:0.1s]',
|
|
33
|
+
2: '[.tbox-media-picker-menu--visible_&]:[transition-delay:0.15s]',
|
|
34
|
+
};
|
|
35
|
+
|
|
30
36
|
/** 连接终态阻断(登录失败/scope 拒绝):提示条 + 输入禁用 + 可选重试入口 */
|
|
31
37
|
export interface ChatBlocked {
|
|
32
38
|
message: string;
|
|
@@ -169,7 +175,7 @@ export function ChatInput({
|
|
|
169
175
|
};
|
|
170
176
|
|
|
171
177
|
return (
|
|
172
|
-
<div className="tbox-chat-input">
|
|
178
|
+
<div className="tbox-chat-input relative z-[1] mx-auto w-full max-w-content bg-transparent px-page pt-2 pb-[calc(8px+env(safe-area-inset-bottom,0px))]">
|
|
173
179
|
<MediaList
|
|
174
180
|
items={items}
|
|
175
181
|
onRemove={removeItem}
|
|
@@ -182,14 +188,14 @@ export function ChatInput({
|
|
|
182
188
|
isWebPc={isWebPc}
|
|
183
189
|
/>
|
|
184
190
|
|
|
185
|
-
<div className="tbox-chat-input__row">
|
|
191
|
+
<div className="tbox-chat-input__row flex flex-wrap items-end gap-2">
|
|
186
192
|
{onNewChat && (
|
|
187
|
-
<div className="tbox-new-chat-btn" onClick={onNewChat}>
|
|
188
|
-
<img className="tbox-new-chat-btn__icon" src={newChatIcon} alt="新对话" />
|
|
193
|
+
<div className="tbox-new-chat-btn flex size-11 shrink-0 items-center justify-center rounded-full bg-[rgba(255,255,255,0.5)] shadow-[0_1px_10px_rgba(110,139,180,0.24)]" onClick={onNewChat}>
|
|
194
|
+
<img className="tbox-new-chat-btn__icon size-[22px]" src={newChatIcon} alt="新对话" />
|
|
189
195
|
</div>
|
|
190
196
|
)}
|
|
191
197
|
|
|
192
|
-
<div className="tbox-chat-input__wrapper">
|
|
198
|
+
<div className="tbox-chat-input__wrapper flex min-w-0 flex-1 items-end gap-[14px] rounded-[var(--tbox-input-radius)] border border-border bg-[var(--tbox-input-bg)] p-[var(--tbox-input-padding)] shadow-[0_1px_10px_rgba(110,139,180,0.24)] transition-[border-color,box-shadow] duration-[var(--tbox-motion-duration-fast)] ease-[var(--tbox-motion-easing-standard)] focus-within:border-primary focus-within:shadow-[0_0_0_1.5px_rgba(9,107,250,0.12)]">
|
|
193
199
|
<input ref={imageRef} type="file" accept="image/*" multiple hidden onChange={onPickFiles} />
|
|
194
200
|
<input ref={cameraRef} type="file" accept="image/*" capture="environment" hidden onChange={onPickFiles} />
|
|
195
201
|
<input ref={videoRef} type="file" accept="video/*" hidden onChange={onPickFiles} />
|
|
@@ -202,7 +208,7 @@ export function ChatInput({
|
|
|
202
208
|
/>
|
|
203
209
|
) : (
|
|
204
210
|
<textarea
|
|
205
|
-
className="tbox-chat-input__field"
|
|
211
|
+
className="tbox-chat-input__field min-w-0 flex-1 resize-none border-0 bg-transparent p-0 text-base leading-[24px] text-foreground outline-none max-h-[100px] [font-family:inherit] placeholder:text-muted-foreground disabled:opacity-[0.45]"
|
|
206
212
|
value={text}
|
|
207
213
|
placeholder={blocked?.message ?? '有什么需要问我的吗'}
|
|
208
214
|
rows={1}
|
|
@@ -218,9 +224,9 @@ export function ChatInput({
|
|
|
218
224
|
)}
|
|
219
225
|
|
|
220
226
|
{enableVoice && (
|
|
221
|
-
<div className="tbox-voice-toggle" onClick={toggleMode}>
|
|
227
|
+
<div className="tbox-voice-toggle flex size-[22px] shrink-0 items-center justify-center" onClick={toggleMode}>
|
|
222
228
|
<img
|
|
223
|
-
className="tbox-voice-toggle__icon"
|
|
229
|
+
className="tbox-voice-toggle__icon size-[22px]"
|
|
224
230
|
src={inputMode === 'voice' ? keyboardIcon : voiceIcon}
|
|
225
231
|
alt={inputMode === 'voice' ? '键盘' : '语音'}
|
|
226
232
|
/>
|
|
@@ -228,29 +234,29 @@ export function ChatInput({
|
|
|
228
234
|
)}
|
|
229
235
|
|
|
230
236
|
{blocked ? null : generating ? (
|
|
231
|
-
<div className="tbox-chat-input__send tbox-chat-input__send--active" onClick={onCancel}>
|
|
232
|
-
<img className="tbox-chat-input__send-img" src={stopIcon} alt="停止" />
|
|
237
|
+
<div className="tbox-chat-input__send tbox-chat-input__send--active flex size-[var(--tbox-send-btn-size)] shrink-0 items-center justify-center" onClick={onCancel}>
|
|
238
|
+
<img className="tbox-chat-input__send-img block size-[var(--tbox-send-btn-size)]" src={stopIcon} alt="停止" />
|
|
233
239
|
</div>
|
|
234
240
|
) : canSend ? (
|
|
235
|
-
<div className="tbox-chat-input__send tbox-chat-input__send--active" onClick={submit}>
|
|
236
|
-
<img className="tbox-chat-input__send-img" src={sendIcon} alt="发送" />
|
|
241
|
+
<div className="tbox-chat-input__send tbox-chat-input__send--active flex size-[var(--tbox-send-btn-size)] shrink-0 items-center justify-center" onClick={submit}>
|
|
242
|
+
<img className="tbox-chat-input__send-img block size-[var(--tbox-send-btn-size)]" src={sendIcon} alt="发送" />
|
|
237
243
|
</div>
|
|
238
244
|
) : menuOptions.length > 0 ? (
|
|
239
|
-
<div className="tbox-media-picker">
|
|
245
|
+
<div className="tbox-media-picker relative shrink-0">
|
|
240
246
|
<div
|
|
241
|
-
className={`tbox-media-picker__trigger${menuVisible ? ' tbox-media-picker__trigger--open' : ''}`}
|
|
247
|
+
className={`tbox-media-picker__trigger flex shrink-0 items-center justify-center transition-transform duration-[var(--tbox-motion-duration-base)] ease-[ease] ${menuVisible ? ' tbox-media-picker__trigger--open rotate-45' : ''}`}
|
|
242
248
|
onClick={onPlus}
|
|
243
249
|
>
|
|
244
|
-
<img className="tbox-media-picker__trigger-icon" src={moreIcon} alt="更多" />
|
|
250
|
+
<img className="tbox-media-picker__trigger-icon size-[var(--tbox-send-btn-size)]" src={moreIcon} alt="更多" />
|
|
245
251
|
</div>
|
|
246
252
|
</div>
|
|
247
253
|
) : null}
|
|
248
254
|
</div>
|
|
249
255
|
{blocked && (
|
|
250
|
-
<div className="tbox-chat-input__blocked">
|
|
251
|
-
<span className="tbox-chat-input__blocked-msg">{blocked.message}</span>
|
|
256
|
+
<div className="tbox-chat-input__blocked flex basis-full items-center gap-[6px] rounded-[6px] bg-[rgba(255,241,241,0.9)] px-[10px] py-[6px] text-xs leading-[16.8px] text-destructive">
|
|
257
|
+
<span className="tbox-chat-input__blocked-msg min-w-0 flex-1">{blocked.message}</span>
|
|
252
258
|
{blocked.onRetry && (
|
|
253
|
-
<button type="button" className="tbox-chat-input__blocked-retry" onClick={blocked.onRetry}>
|
|
259
|
+
<button type="button" className="tbox-chat-input__blocked-retry shrink-0 rounded-full border-0 bg-primary px-[10px] py-[3px] text-xs leading-[normal] text-white [font-family:inherit]" onClick={blocked.onRetry}>
|
|
254
260
|
重试
|
|
255
261
|
</button>
|
|
256
262
|
)}
|
|
@@ -259,19 +265,19 @@ export function ChatInput({
|
|
|
259
265
|
</div>
|
|
260
266
|
|
|
261
267
|
{menuVisible && (
|
|
262
|
-
<div className={`tbox-media-picker-menu${menuAnimating ? ' tbox-media-picker-menu--visible' : ''}`}>
|
|
263
|
-
{menuOptions.map((o) => (
|
|
264
|
-
<div key={o.type} className=
|
|
265
|
-
<div className="tbox-media-picker-menu__option-content">
|
|
266
|
-
<img className="tbox-media-picker-menu__option-icon" src={o.icon} alt="" />
|
|
267
|
-
<span className="tbox-media-picker-menu__option-label">{o.label}</span>
|
|
268
|
+
<div className={`tbox-media-picker-menu mt-3 flex h-[66px] flex-row overflow-hidden transition-all will-change-[opacity,transform] ${menuAnimating ? ' tbox-media-picker-menu--visible [transform:translateY(0)] opacity-100 duration-[var(--tbox-motion-duration-base)] ease-out' : ' [transform:translateY(5px)] opacity-0 duration-[var(--tbox-motion-duration-fast)] ease-in'}`}>
|
|
269
|
+
{menuOptions.map((o, index) => (
|
|
270
|
+
<div key={o.type} className={`tbox-media-picker-menu__option flex h-[66px] w-28 shrink-0 items-center justify-center overflow-hidden rounded-[10px] bg-[rgba(0,0,0,0.04)] opacity-0 transition-all duration-[var(--tbox-motion-duration-base)] ease-out will-change-[opacity,transform] [.tbox-media-picker-menu--visible_&]:opacity-100 [.tbox-media-picker-menu--visible_&]:[transform:translateY(0)] ${MENU_OPTION_DELAY_CLASS[index] ?? ''} ${index > 0 ? ' ml-[7.5px]' : ''}`} onClick={() => onMenuSelect(o.type)}>
|
|
271
|
+
<div className="tbox-media-picker-menu__option-content flex h-6 flex-row items-center">
|
|
272
|
+
<img className="tbox-media-picker-menu__option-icon size-6 shrink-0" src={o.icon} alt="" />
|
|
273
|
+
<span className="tbox-media-picker-menu__option-label ml-1 text-sm font-normal leading-[18.5px] text-secondary-foreground">{o.label}</span>
|
|
268
274
|
</div>
|
|
269
275
|
</div>
|
|
270
276
|
))}
|
|
271
277
|
</div>
|
|
272
278
|
)}
|
|
273
279
|
|
|
274
|
-
{disclaimer && <div className="tbox-chat-input__disclaimer">{disclaimer}</div>}
|
|
280
|
+
{disclaimer && <div className="tbox-chat-input__disclaimer mt-[5px] text-center text-xs leading-[15px] text-muted-foreground">{disclaimer}</div>}
|
|
275
281
|
|
|
276
282
|
<VoiceRecordingOverlay
|
|
277
283
|
visible={voice.overlayVisible}
|
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
import type { VoiceInteractionState } from './machine';
|
|
2
2
|
import type { VoicePressHandlers } from './useVoicePress';
|
|
3
3
|
|
|
4
|
+
/** 各交互态的按压条底色(旧 less 的 `--pressing` / `--recording-*` / `--processing` 规则)。 */
|
|
5
|
+
const FIELD_STATE_CLASS: Record<VoiceInteractionState, string> = {
|
|
6
|
+
idle: '',
|
|
7
|
+
pressing: 'bg-[#eef4ff]',
|
|
8
|
+
'recording-active': 'bg-[#eef4ff]',
|
|
9
|
+
'recording-cancel': 'bg-[#fff1f1]',
|
|
10
|
+
processing: 'bg-[#f5f7fb]',
|
|
11
|
+
};
|
|
12
|
+
|
|
4
13
|
function fieldText(s: VoiceInteractionState): string {
|
|
5
14
|
if (s === 'recording-cancel') return '松开取消';
|
|
6
15
|
if (s === 'processing') return '识别中...';
|
|
@@ -20,14 +29,14 @@ export function VoicePressField({
|
|
|
20
29
|
}) {
|
|
21
30
|
return (
|
|
22
31
|
<div
|
|
23
|
-
className={`tbox-voice-press-field tbox-voice-press-field--${interactionState}${disabled ? ' tbox-voice-press-field--disabled' : ''}`}
|
|
32
|
+
className={`tbox-voice-press-field tbox-voice-press-field--${interactionState} flex h-6 min-w-0 flex-1 touch-none select-none items-center justify-center overflow-hidden rounded-[25px] [-webkit-touch-callout:none] ${FIELD_STATE_CLASS[interactionState]} ${disabled ? ' tbox-voice-press-field--disabled opacity-[0.35]' : ''}`}
|
|
24
33
|
onTouchStart={disabled ? undefined : handlers.onTouchStart}
|
|
25
34
|
onTouchMove={disabled ? undefined : handlers.onTouchMove}
|
|
26
35
|
onTouchEnd={disabled ? undefined : handlers.onTouchEnd}
|
|
27
36
|
onTouchCancel={disabled ? undefined : handlers.onTouchCancel}
|
|
28
37
|
>
|
|
29
|
-
<div className="tbox-voice-press-field__content">
|
|
30
|
-
<span className="tbox-voice-press-field__text">{fieldText(interactionState)}</span>
|
|
38
|
+
<div className="tbox-voice-press-field__content flex w-full items-center justify-center px-[10px]">
|
|
39
|
+
<span className="tbox-voice-press-field__text text-base font-semibold leading-[24px] text-foreground">{fieldText(interactionState)}</span>
|
|
31
40
|
</div>
|
|
32
41
|
</div>
|
|
33
42
|
);
|
|
@@ -23,26 +23,26 @@ export function VoiceRecordingOverlay({
|
|
|
23
23
|
const isCancel = interactionState === 'recording-cancel';
|
|
24
24
|
|
|
25
25
|
return (
|
|
26
|
-
<div className="tbox-voice-overlay">
|
|
27
|
-
<div className="tbox-voice-overlay__mask" />
|
|
26
|
+
<div className="tbox-voice-overlay fixed inset-0 z-[300] touch-none select-none [-webkit-touch-callout:none]">
|
|
27
|
+
<div className="tbox-voice-overlay__mask absolute inset-0 bg-[rgba(255,255,255,0.01)]" />
|
|
28
28
|
<div
|
|
29
|
-
className="tbox-voice-overlay__capture"
|
|
29
|
+
className="tbox-voice-overlay__capture absolute inset-0 flex touch-none select-none items-end justify-center px-page pb-[calc(28px+env(safe-area-inset-bottom,8px))] [-webkit-touch-callout:none]"
|
|
30
30
|
onTouchStart={handlers.onTouchStart}
|
|
31
31
|
onTouchMove={handlers.onTouchMove}
|
|
32
32
|
onTouchEnd={handlers.onTouchEnd}
|
|
33
33
|
onTouchCancel={handlers.onTouchCancel}
|
|
34
34
|
>
|
|
35
|
-
<div className="tbox-voice-overlay__panel">
|
|
35
|
+
<div className="tbox-voice-overlay__panel flex w-full max-w-content flex-col items-center">
|
|
36
36
|
{countdown != null && interactionState === 'recording-active' && (
|
|
37
|
-
<div className="tbox-voice-overlay__bubble">
|
|
38
|
-
<span className="tbox-voice-overlay__bubble-text">{countdown}秒后自动停止录音</span>
|
|
37
|
+
<div className="tbox-voice-overlay__bubble mb-5 flex h-[41px] w-[134px] items-center justify-center bg-no-repeat [background-image:url('https://mdn.alipayobjects.com/huamei\_frp8ut/afts/img/A*O6TCSrNeWvwAAAAAQHAAAAgAet-KAQ/original')] [background-size:100%_100%]">
|
|
38
|
+
<span className="tbox-voice-overlay__bubble-text whitespace-nowrap text-xs font-medium leading-[31px] text-white">{countdown}秒后自动停止录音</span>
|
|
39
39
|
</div>
|
|
40
40
|
)}
|
|
41
|
-
<span className={`tbox-voice-overlay__tip${isCancel ? ' tbox-voice-overlay__tip--cancel' : ''}`}>
|
|
41
|
+
<span className={`tbox-voice-overlay__tip mb-4 text-center text-xs font-medium leading-[24px] ${isCancel ? ' tbox-voice-overlay__tip--cancel text-destructive' : ' text-muted-foreground'}`}>
|
|
42
42
|
{overlayTip(interactionState)}
|
|
43
43
|
</span>
|
|
44
|
-
<div className={`tbox-voice-overlay__button${isCancel ? ' tbox-voice-overlay__button--cancel' : ''}`}>
|
|
45
|
-
<div className="tbox-voice-overlay__wave" />
|
|
44
|
+
<div className={`tbox-voice-overlay__button flex h-[50px] w-full items-center justify-center rounded-[26px] shadow-[0_6px_14px_rgba(80,111,255,0.24)] ${isCancel ? ' tbox-voice-overlay__button--cancel [background-image:linear-gradient(162deg,#fd3030_-22%,#f48686_108%)]' : ' [background-image:linear-gradient(162deg,var(--tbox-primary)_-22%,var(--tbox-primary-dark)_108%)]'}`}>
|
|
45
|
+
<div className="tbox-voice-overlay__wave pointer-events-none h-6 w-[242px] bg-no-repeat [background-image:url('https://mdn.alipayobjects.com/huamei\_frp8ut/afts/img/A*5PDvR4j7fBgAAAAAVBAAAAgAet-KAQ/original')] [background-size:100%_100%]" />
|
|
46
46
|
</div>
|
|
47
47
|
</div>
|
|
48
48
|
</div>
|