@unif/react-native-chat 3.7.0 → 4.1.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.
- package/lib/module/components/Attachments/AttachmentItem.js +13 -12
- package/lib/module/components/Attachments/AttachmentItem.js.map +1 -1
- package/lib/module/components/Attachments/constants.js +5 -4
- package/lib/module/components/Attachments/constants.js.map +1 -1
- package/lib/module/components/Composer/Composer.js +6 -5
- package/lib/module/components/Composer/Composer.js.map +1 -1
- package/lib/module/components/Composer/ComposerIconAction.js +3 -3
- package/lib/module/components/Composer/ComposerIconAction.js.map +1 -1
- package/lib/module/components/Confirmation/Confirmation.js +4 -3
- package/lib/module/components/Confirmation/Confirmation.js.map +1 -1
- package/lib/module/components/Feedback/Feedback.js +4 -3
- package/lib/module/components/Feedback/Feedback.js.map +1 -1
- package/lib/module/components/Feedback/constants.js +5 -4
- package/lib/module/components/Feedback/constants.js.map +1 -1
- package/lib/module/components/Message/MarkdownContent/MarkdownImage/MarkdownImage.js +6 -3
- package/lib/module/components/Message/MarkdownContent/MarkdownImage/MarkdownImage.js.map +1 -1
- package/lib/module/components/Message/Message.js +2 -1
- package/lib/module/components/Message/Message.js.map +1 -1
- package/lib/module/components/MessageList/MessageListEndButton.js +2 -1
- package/lib/module/components/MessageList/MessageListEndButton.js.map +1 -1
- package/lib/module/components/Process/Process.js +5 -3
- package/lib/module/components/Process/Process.js.map +1 -1
- package/lib/module/components/Process/ProcessCompactStep.js +17 -12
- package/lib/module/components/Process/ProcessCompactStep.js.map +1 -1
- package/lib/module/components/Process/ProcessTimelineStep.js +3 -3
- package/lib/module/components/Process/ProcessTimelineStep.js.map +1 -1
- package/lib/module/components/Process/constants.js +6 -5
- package/lib/module/components/Process/constants.js.map +1 -1
- package/lib/module/components/Process/styles.js +8 -0
- package/lib/module/components/Process/styles.js.map +1 -1
- package/lib/module/components/Sources/Sources.js +6 -3
- package/lib/module/components/Sources/Sources.js.map +1 -1
- package/lib/module/components/Suggestions/Suggestions.js +2 -3
- package/lib/module/components/Suggestions/Suggestions.js.map +1 -1
- package/lib/typescript/src/actions/types.d.ts +3 -2
- package/lib/typescript/src/actions/types.d.ts.map +1 -1
- package/lib/typescript/src/components/Attachments/AttachmentItem.d.ts.map +1 -1
- package/lib/typescript/src/components/Attachments/constants.d.ts +3 -2
- package/lib/typescript/src/components/Attachments/constants.d.ts.map +1 -1
- package/lib/typescript/src/components/Composer/Composer.d.ts.map +1 -1
- package/lib/typescript/src/components/Composer/types.d.ts +4 -2
- package/lib/typescript/src/components/Composer/types.d.ts.map +1 -1
- package/lib/typescript/src/components/Confirmation/Confirmation.d.ts.map +1 -1
- package/lib/typescript/src/components/Feedback/Feedback.d.ts.map +1 -1
- package/lib/typescript/src/components/Feedback/constants.d.ts +3 -2
- package/lib/typescript/src/components/Feedback/constants.d.ts.map +1 -1
- package/lib/typescript/src/components/Message/MarkdownContent/MarkdownImage/MarkdownImage.d.ts.map +1 -1
- package/lib/typescript/src/components/Message/Message.d.ts.map +1 -1
- package/lib/typescript/src/components/MessageList/MessageListEndButton.d.ts.map +1 -1
- package/lib/typescript/src/components/Process/Process.d.ts.map +1 -1
- package/lib/typescript/src/components/Process/ProcessCompactStep.d.ts +1 -1
- package/lib/typescript/src/components/Process/ProcessCompactStep.d.ts.map +1 -1
- package/lib/typescript/src/components/Process/constants.d.ts +3 -2
- package/lib/typescript/src/components/Process/constants.d.ts.map +1 -1
- package/lib/typescript/src/components/Process/styles.d.ts +8 -0
- package/lib/typescript/src/components/Process/styles.d.ts.map +1 -1
- package/lib/typescript/src/components/Process/types.d.ts +7 -0
- package/lib/typescript/src/components/Process/types.d.ts.map +1 -1
- package/lib/typescript/src/components/Sources/Sources.d.ts.map +1 -1
- package/lib/typescript/src/components/Suggestions/Suggestions.d.ts.map +1 -1
- package/lib/typescript/src/components/Suggestions/types.d.ts +3 -2
- package/lib/typescript/src/components/Suggestions/types.d.ts.map +1 -1
- package/package.json +5 -3
- package/src/actions/types.ts +3 -2
- package/src/components/Attachments/AttachmentItem.tsx +14 -20
- package/src/components/Attachments/constants.ts +14 -6
- package/src/components/Composer/Composer.tsx +14 -5
- package/src/components/Composer/ComposerIconAction.tsx +3 -3
- package/src/components/Composer/types.ts +4 -2
- package/src/components/Confirmation/Confirmation.tsx +12 -12
- package/src/components/Feedback/Feedback.tsx +3 -2
- package/src/components/Feedback/constants.ts +16 -6
- package/src/components/Message/MarkdownContent/MarkdownImage/MarkdownImage.tsx +4 -2
- package/src/components/Message/Message.tsx +2 -1
- package/src/components/MessageList/MessageListEndButton.tsx +2 -1
- package/src/components/Process/Process.tsx +5 -3
- package/src/components/Process/ProcessCompactStep.tsx +37 -21
- package/src/components/Process/ProcessTimelineStep.tsx +2 -2
- package/src/components/Process/constants.ts +16 -7
- package/src/components/Process/styles.ts +2 -0
- package/src/components/Process/types.ts +8 -0
- package/src/components/Sources/Sources.tsx +6 -2
- package/src/components/Suggestions/Suggestions.tsx +2 -6
- package/src/components/Suggestions/types.ts +4 -2
|
@@ -67,6 +67,14 @@ export declare const createStyles: (colors: ColorTokens) => Readonly<{
|
|
|
67
67
|
minHeight: number;
|
|
68
68
|
paddingVertical: number;
|
|
69
69
|
};
|
|
70
|
+
compactHeaderDense: {
|
|
71
|
+
minHeight: number;
|
|
72
|
+
paddingVertical: number;
|
|
73
|
+
};
|
|
74
|
+
compactDetailsDense: {
|
|
75
|
+
paddingTop: number;
|
|
76
|
+
paddingBottom: number;
|
|
77
|
+
};
|
|
70
78
|
compactTitle: {
|
|
71
79
|
flex: number;
|
|
72
80
|
minWidth: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../../src/components/Process/styles.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAE7D,eAAO,MAAM,YAAY,GAAI,QAAQ,WAAW
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../../src/components/Process/styles.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAE7D,eAAO,MAAM,YAAY,GAAI,QAAQ,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkJ5C,CAAC"}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { ComponentType } from 'react';
|
|
2
|
+
import type { IconProps } from '@unif/react-native-icons';
|
|
1
3
|
import type { ReactNode } from 'react';
|
|
2
4
|
import type { StyleProp, ViewStyle } from 'react-native';
|
|
3
5
|
import type { ChatAction } from '../../actions/index.js';
|
|
@@ -6,6 +8,8 @@ export interface ProcessStep {
|
|
|
6
8
|
id: string;
|
|
7
9
|
title: string;
|
|
8
10
|
status: ProcessStepStatus;
|
|
11
|
+
/** compact 的活动图标;null 不显示,省略时沿状态呈现。 */
|
|
12
|
+
icon?: ComponentType<IconProps> | null;
|
|
9
13
|
/** 调用者提供的状态显示文案;不改变 status 的语义。 */
|
|
10
14
|
statusText?: string;
|
|
11
15
|
description?: string;
|
|
@@ -16,6 +20,8 @@ export interface ProcessStep {
|
|
|
16
20
|
export interface ProcessBaseProps {
|
|
17
21
|
/** card 为状态面板;compact 为单行过程;timeline 为带状态节点的连续步骤。 */
|
|
18
22
|
variant?: 'card' | 'compact' | 'timeline';
|
|
23
|
+
/** compact 文字密度;dense 用于与行内文字相邻的公开过程。 */
|
|
24
|
+
compactDensity?: 'comfortable' | 'dense';
|
|
19
25
|
steps: readonly ProcessStep[];
|
|
20
26
|
title?: string;
|
|
21
27
|
identity?: ReactNode;
|
|
@@ -25,6 +31,7 @@ export interface ProcessBaseProps {
|
|
|
25
31
|
testID?: string;
|
|
26
32
|
}
|
|
27
33
|
export interface ProcessCompactStepProps {
|
|
34
|
+
dense?: boolean;
|
|
28
35
|
identity?: ReactNode;
|
|
29
36
|
step: ProcessStep;
|
|
30
37
|
expanded: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/components/Process/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/components/Process/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAe,CAAC;AAEhD,MAAM,MAAM,iBAAiB,GAC3B,SAAS,GAAG,SAAS,GAAG,WAAW,GAAG,QAAQ,GAAG,WAAW,CAAC;AAE/D,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,iBAAiB,CAAC;IAC1B,uCAAuC;IACvC,IAAI,CAAC,EAAE,aAAa,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC;IACvC,mCAAmC;IACnC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,OAAO,CAAC,EAAE,SAAS,UAAU,EAAE,CAAC;CACjC;AAED,MAAM,WAAW,gBAAgB;IAC/B,qDAAqD;IACrD,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,UAAU,CAAC;IAC1C,yCAAyC;IACzC,cAAc,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC;IACzC,KAAK,EAAE,SAAS,WAAW,EAAE,CAAC;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,yCAAyC;IACzC,iBAAiB,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC;IACzC,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,uBAAuB;IACtC,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,IAAI,EAAE,WAAW,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,IAAI,IAAI,CAAC;CAClB;AAED,MAAM,WAAW,0BAA0B;IACzC,WAAW,EAAE,SAAS,MAAM,EAAE,CAAC;IAC/B,gBAAgB,CAAC,GAAG,EAAE,SAAS,MAAM,EAAE,GAAG,IAAI,CAAC;IAC/C,kBAAkB,CAAC,EAAE,KAAK,CAAC;CAC5B;AAED,MAAM,WAAW,qBAAqB;IACpC,WAAW,CAAC,EAAE,KAAK,CAAC;IACpB,kBAAkB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACvC,gBAAgB,CAAC,CAAC,GAAG,EAAE,SAAS,MAAM,EAAE,GAAG,IAAI,CAAC;CACjD;AAED,MAAM,MAAM,YAAY,GAAG,gBAAgB,GACzC,CAAC,0BAA0B,GAAG,qBAAqB,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Sources.d.ts","sourceRoot":"","sources":["../../../../../src/components/Sources/Sources.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Sources.d.ts","sourceRoot":"","sources":["../../../../../src/components/Sources/Sources.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAc,YAAY,EAAE,MAAM,YAAS,CAAC;AAExD,wBAAgB,OAAO,CAAC,EACtB,KAAK,EACL,KAA6B,EAC7B,OAAO,EACP,KAAK,EACL,MAAM,GACP,EAAE,YAAY,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,GAAG,IAAI,CA4DzC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Suggestions.d.ts","sourceRoot":"","sources":["../../../../../src/components/Suggestions/Suggestions.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAS,CAAC;AAEhD,wBAAgB,WAAW,CAAC,EAC1B,KAAK,EACL,QAAQ,EACR,KAAe,EACf,KAAK,EACL,MAAM,GACP,EAAE,gBAAgB,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"Suggestions.d.ts","sourceRoot":"","sources":["../../../../../src/components/Suggestions/Suggestions.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAS,CAAC;AAEhD,wBAAgB,WAAW,CAAC,EAC1B,KAAK,EACL,QAAQ,EACR,KAAe,EACf,KAAK,EACL,MAAM,GACP,EAAE,gBAAgB,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,GAAG,IAAI,CA2B7C"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ComponentType } from 'react';
|
|
2
|
+
import type { IconProps } from '@unif/react-native-icons';
|
|
2
3
|
import type { StyleProp, ViewStyle } from 'react-native';
|
|
3
4
|
export interface SuggestionItem {
|
|
4
5
|
id: string;
|
|
5
6
|
label: string;
|
|
6
7
|
/** 14 布局单位的主题主色图标,普通与选中状态保持相同图标样式。 */
|
|
7
|
-
icon?:
|
|
8
|
+
icon?: ComponentType<IconProps>;
|
|
8
9
|
selected?: boolean;
|
|
9
10
|
loading?: boolean;
|
|
10
11
|
disabled?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/components/Suggestions/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/components/Suggestions/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAE1D,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzD,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,sCAAsC;IACtC,IAAI,CAAC,EAAE,aAAa,CAAC,SAAS,CAAC,CAAC;IAChC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,SAAS,cAAc,EAAE,CAAC;IACjC,QAAQ,CAAC,CAAC,IAAI,EAAE,cAAc,GAAG,IAAI,CAAC;IACtC,KAAK,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;IAC3B,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unif/react-native-chat",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.1.0",
|
|
4
4
|
"description": "Unif React Native 聊天组件:消息、输入、附件和交互展示",
|
|
5
5
|
"main": "./lib/module/index.js",
|
|
6
6
|
"types": "./lib/typescript/src/index.d.ts",
|
|
@@ -68,7 +68,8 @@
|
|
|
68
68
|
"@release-it/conventional-changelog": "^12.0.0",
|
|
69
69
|
"@testing-library/react-native": "13.3.3",
|
|
70
70
|
"@types/react": "^19.2.0",
|
|
71
|
-
"@unif/react-native-design": ">=0.
|
|
71
|
+
"@unif/react-native-design": ">=1.0.0",
|
|
72
|
+
"@unif/react-native-icons": ">=0.1.0",
|
|
72
73
|
"commitlint": "^21.2.1",
|
|
73
74
|
"del-cli": "^7.0.0",
|
|
74
75
|
"eslint": "^9.39.5",
|
|
@@ -96,7 +97,8 @@
|
|
|
96
97
|
"typescript": "^6.0.3"
|
|
97
98
|
},
|
|
98
99
|
"peerDependencies": {
|
|
99
|
-
"@unif/react-native-design": ">=0.
|
|
100
|
+
"@unif/react-native-design": ">=1.0.0",
|
|
101
|
+
"@unif/react-native-icons": ">=0.1.0",
|
|
100
102
|
"react": ">=19.2.3 <20.0.0",
|
|
101
103
|
"react-native": ">=0.86.0",
|
|
102
104
|
"react-native-svg": ">=15"
|
package/src/actions/types.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ComponentType } from 'react';
|
|
2
|
+
import type { IconProps } from '@unif/react-native-icons';
|
|
2
3
|
|
|
3
4
|
export interface ChatAction {
|
|
4
5
|
id: string;
|
|
5
6
|
label: string;
|
|
6
|
-
icon?:
|
|
7
|
+
icon?: ComponentType<IconProps>;
|
|
7
8
|
disabled?: boolean;
|
|
8
9
|
loading?: boolean;
|
|
9
10
|
accessibilityHint?: string;
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CloseOutlined,
|
|
3
|
+
EyeOutlined,
|
|
4
|
+
RefreshOutlined,
|
|
5
|
+
} from '@unif/react-native-icons';
|
|
1
6
|
import { Pressable, Text, View } from 'react-native';
|
|
2
7
|
import {
|
|
3
8
|
Button,
|
|
4
9
|
CircularProgress,
|
|
5
10
|
GlassLayer,
|
|
6
|
-
Icon,
|
|
7
11
|
IconButton,
|
|
8
12
|
radius,
|
|
9
13
|
Spinner,
|
|
@@ -55,12 +59,7 @@ export function AttachmentItem({
|
|
|
55
59
|
const removable = item.removable && onRemove;
|
|
56
60
|
const singleAction = item.actions?.length === 1 ? item.actions[0] : undefined;
|
|
57
61
|
const retry =
|
|
58
|
-
failed &&
|
|
59
|
-
!caption &&
|
|
60
|
-
singleAction &&
|
|
61
|
-
(singleAction.id === 'retry' ||
|
|
62
|
-
singleAction.icon === 'retry' ||
|
|
63
|
-
singleAction.icon === 'refresh')
|
|
62
|
+
failed && !caption && singleAction?.id === 'retry'
|
|
64
63
|
? singleAction
|
|
65
64
|
: undefined;
|
|
66
65
|
const statusLeft = (imageSize - ATTACHMENT_STATUS_OWNER_SIZE) / 2;
|
|
@@ -73,9 +72,8 @@ export function AttachmentItem({
|
|
|
73
72
|
ATTACHMENT_STATUS_OWNER_SIZE
|
|
74
73
|
)
|
|
75
74
|
: statusLeft;
|
|
76
|
-
const
|
|
77
|
-
|
|
78
|
-
);
|
|
75
|
+
const Glyph = ATTACHMENT_ICONS[item.kind ?? 'file'];
|
|
76
|
+
const icon = <Glyph size={ROW_IMAGE_SIZE} color={colors.foregroundMuted} />;
|
|
79
77
|
const thumbnail = item.thumbnail ? (
|
|
80
78
|
<Thumbnail
|
|
81
79
|
source={item.thumbnail}
|
|
@@ -91,16 +89,13 @@ export function AttachmentItem({
|
|
|
91
89
|
{icon}
|
|
92
90
|
</View>
|
|
93
91
|
);
|
|
92
|
+
const Glyph2 = retry?.icon ?? RefreshOutlined;
|
|
94
93
|
const statusVisual =
|
|
95
94
|
busy || failed ? (
|
|
96
95
|
<View style={styles.statusVisual}>
|
|
97
96
|
<GlassLayer colorScheme="dark" style={styles.circleGlass} />
|
|
98
97
|
{failed ? (
|
|
99
|
-
<
|
|
100
|
-
name={retry?.icon ?? 'refresh'}
|
|
101
|
-
size={16}
|
|
102
|
-
color={colors.onPrimary}
|
|
103
|
-
/>
|
|
98
|
+
<Glyph2 size={16} color={colors.onPrimary} />
|
|
104
99
|
) : progress !== undefined ? (
|
|
105
100
|
<CircularProgress
|
|
106
101
|
value={progress}
|
|
@@ -225,7 +220,7 @@ export function AttachmentItem({
|
|
|
225
220
|
<View style={styles.actions}>
|
|
226
221
|
{previewable && retry ? (
|
|
227
222
|
<IconButton
|
|
228
|
-
icon=
|
|
223
|
+
icon={EyeOutlined}
|
|
229
224
|
size="sm"
|
|
230
225
|
accessibilityLabel={`预览${name}`}
|
|
231
226
|
onPress={() => onPreview?.(item)}
|
|
@@ -233,7 +228,7 @@ export function AttachmentItem({
|
|
|
233
228
|
) : null}
|
|
234
229
|
{removable ? (
|
|
235
230
|
<IconButton
|
|
236
|
-
icon=
|
|
231
|
+
icon={CloseOutlined}
|
|
237
232
|
size="sm"
|
|
238
233
|
accessibilityLabel={`移除${name}`}
|
|
239
234
|
disabled={item.removeDisabled}
|
|
@@ -332,8 +327,7 @@ export function AttachmentItem({
|
|
|
332
327
|
{!failed ? (
|
|
333
328
|
<GlassLayer colorScheme="dark" style={styles.circleGlass} />
|
|
334
329
|
) : null}
|
|
335
|
-
<
|
|
336
|
-
name="close"
|
|
330
|
+
<CloseOutlined
|
|
337
331
|
size={preview ? 12 : 10}
|
|
338
332
|
color={colors.onPrimary}
|
|
339
333
|
strokeWidth={2.5}
|
|
@@ -363,7 +357,7 @@ export function AttachmentItem({
|
|
|
363
357
|
{separatePreview ? (
|
|
364
358
|
<View style={[styles.previewAction, { width: imageSize }]}>
|
|
365
359
|
<IconButton
|
|
366
|
-
icon=
|
|
360
|
+
icon={EyeOutlined}
|
|
367
361
|
size="sm"
|
|
368
362
|
accessibilityLabel={`预览${name}`}
|
|
369
363
|
onPress={() => onPreview?.(item)}
|
|
@@ -1,5 +1,13 @@
|
|
|
1
|
+
import {
|
|
2
|
+
FileOutlined,
|
|
3
|
+
ImageOutlined,
|
|
4
|
+
PlayOutlined,
|
|
5
|
+
SoundOutlined,
|
|
6
|
+
} from '@unif/react-native-icons';
|
|
7
|
+
import type { ComponentType } from 'react';
|
|
8
|
+
import type { IconProps } from '@unif/react-native-icons';
|
|
1
9
|
import { icon, r } from '@unif/react-native-design';
|
|
2
|
-
|
|
10
|
+
|
|
3
11
|
import type { ChatAttachmentItem } from './types';
|
|
4
12
|
|
|
5
13
|
export const CARD_WIDTH = r(76);
|
|
@@ -15,12 +23,12 @@ export const ATTACHMENT_STATUS_OWNER_SIZE = Math.max(
|
|
|
15
23
|
export const ATTACHMENT_REMOVE_OWNER_SIZE = 44;
|
|
16
24
|
export const ATTACHMENT_ICONS: Record<
|
|
17
25
|
NonNullable<ChatAttachmentItem['kind']>,
|
|
18
|
-
|
|
26
|
+
ComponentType<IconProps>
|
|
19
27
|
> = {
|
|
20
|
-
image:
|
|
21
|
-
file:
|
|
22
|
-
audio:
|
|
23
|
-
video:
|
|
28
|
+
image: ImageOutlined,
|
|
29
|
+
file: FileOutlined,
|
|
30
|
+
audio: SoundOutlined,
|
|
31
|
+
video: PlayOutlined,
|
|
24
32
|
};
|
|
25
33
|
export const STATUS_LABELS = {
|
|
26
34
|
idle: '',
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CloseOutlined,
|
|
3
|
+
MicOutlined,
|
|
4
|
+
PlusOutlined,
|
|
5
|
+
SendOutlined,
|
|
6
|
+
StopFilled,
|
|
7
|
+
} from '@unif/react-native-icons';
|
|
1
8
|
import {
|
|
2
9
|
forwardRef,
|
|
3
10
|
useEffect,
|
|
@@ -119,7 +126,7 @@ export const Composer = forwardRef<ComposerHandle, ComposerProps>(
|
|
|
119
126
|
const moreAction =
|
|
120
127
|
actions.length > 0 ? (
|
|
121
128
|
<ComposerIconAction
|
|
122
|
-
icon=
|
|
129
|
+
icon={PlusOutlined}
|
|
123
130
|
label="更多操作"
|
|
124
131
|
expanded={menuOpen}
|
|
125
132
|
disabled={moreDisabled}
|
|
@@ -243,7 +250,7 @@ export const Composer = forwardRef<ComposerHandle, ComposerProps>(
|
|
|
243
250
|
<View style={styles.trailingActions}>
|
|
244
251
|
{voice ? (
|
|
245
252
|
<ComposerIconAction
|
|
246
|
-
icon=
|
|
253
|
+
icon={MicOutlined}
|
|
247
254
|
label="开始语音输入"
|
|
248
255
|
disabled={disabled || voice.disabled}
|
|
249
256
|
onPress={() => {
|
|
@@ -254,7 +261,9 @@ export const Composer = forwardRef<ComposerHandle, ComposerProps>(
|
|
|
254
261
|
) : null}
|
|
255
262
|
{showPrimary ? (
|
|
256
263
|
<ComposerIconAction
|
|
257
|
-
icon={
|
|
264
|
+
icon={
|
|
265
|
+
primaryAction.kind === 'send' ? SendOutlined : StopFilled
|
|
266
|
+
}
|
|
258
267
|
label={primaryLabel}
|
|
259
268
|
visual="primary"
|
|
260
269
|
disabled={primaryDisabled}
|
|
@@ -276,7 +285,7 @@ export const Composer = forwardRef<ComposerHandle, ComposerProps>(
|
|
|
276
285
|
{voice && voice.status !== 'idle' ? (
|
|
277
286
|
<View style={styles.voice}>
|
|
278
287
|
<ComposerIconAction
|
|
279
|
-
icon=
|
|
288
|
+
icon={CloseOutlined}
|
|
280
289
|
visual="cancel"
|
|
281
290
|
label="取消语音输入"
|
|
282
291
|
disabled={disabled || voice.disabled}
|
|
@@ -300,7 +309,7 @@ export const Composer = forwardRef<ComposerHandle, ComposerProps>(
|
|
|
300
309
|
</View>
|
|
301
310
|
{voice.status === 'listening' || voice.status === 'finishing' ? (
|
|
302
311
|
<ComposerIconAction
|
|
303
|
-
icon=
|
|
312
|
+
icon={StopFilled}
|
|
304
313
|
visual="primary"
|
|
305
314
|
label="停止语音输入"
|
|
306
315
|
disabled={
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ActivityIndicator, Pressable, View } from 'react-native';
|
|
2
|
-
import {
|
|
2
|
+
import { useColors, useThemedStyles } from '@unif/react-native-design';
|
|
3
3
|
import {
|
|
4
4
|
COMPOSER_ACTION_ICON_SIZE,
|
|
5
5
|
COMPOSER_PRIMARY_ICON_SIZE,
|
|
@@ -28,6 +28,7 @@ export function ComposerIconAction({
|
|
|
28
28
|
? colors.foregroundSubtle
|
|
29
29
|
: colors.onPrimary
|
|
30
30
|
: colors.foregroundMuted;
|
|
31
|
+
const Glyph = icon;
|
|
31
32
|
return (
|
|
32
33
|
<Pressable
|
|
33
34
|
accessibilityRole="button"
|
|
@@ -54,8 +55,7 @@ export function ComposerIconAction({
|
|
|
54
55
|
{busy ? (
|
|
55
56
|
<ActivityIndicator size="small" color={color} />
|
|
56
57
|
) : (
|
|
57
|
-
<
|
|
58
|
-
name={icon}
|
|
58
|
+
<Glyph
|
|
59
59
|
size={
|
|
60
60
|
primary
|
|
61
61
|
? COMPOSER_PRIMARY_ICON_SIZE
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import type { ComponentType } from 'react';
|
|
2
|
+
import type { IconProps } from '@unif/react-native-icons';
|
|
1
3
|
import type { ReactNode } from 'react';
|
|
2
4
|
import type { StyleProp, ViewStyle } from 'react-native';
|
|
3
|
-
import type {
|
|
5
|
+
import type { TextFieldHandle } from '@unif/react-native-design';
|
|
4
6
|
import type { ChatAction } from '../../actions';
|
|
5
7
|
|
|
6
8
|
export interface ComposerSendAction {
|
|
@@ -65,7 +67,7 @@ export interface ComposerProps {
|
|
|
65
67
|
export type ComposerHandle = TextFieldHandle;
|
|
66
68
|
|
|
67
69
|
export interface ComposerIconActionProps {
|
|
68
|
-
icon:
|
|
70
|
+
icon: ComponentType<IconProps>;
|
|
69
71
|
label: string;
|
|
70
72
|
onPress?(): void;
|
|
71
73
|
disabled?: boolean;
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CheckOutlined,
|
|
3
|
+
CloseOutlined,
|
|
4
|
+
WarningOutlined,
|
|
5
|
+
} from '@unif/react-native-icons';
|
|
1
6
|
import { Text, View } from 'react-native';
|
|
2
7
|
import {
|
|
3
8
|
Button,
|
|
4
|
-
Icon,
|
|
5
9
|
Spinner,
|
|
6
10
|
useColors,
|
|
7
11
|
useThemedStyles,
|
|
@@ -44,23 +48,19 @@ export function Confirmation({
|
|
|
44
48
|
? statusText
|
|
45
49
|
: (statusText ?? CONFIRMATION_STATUS_TEXT[status]);
|
|
46
50
|
|
|
51
|
+
const Glyph =
|
|
52
|
+
status === 'confirmed'
|
|
53
|
+
? CheckOutlined
|
|
54
|
+
: status === 'cancelled'
|
|
55
|
+
? CloseOutlined
|
|
56
|
+
: WarningOutlined;
|
|
47
57
|
return (
|
|
48
58
|
<View style={[styles.root, { borderColor }, style]} testID={testID}>
|
|
49
59
|
<View style={styles.heading}>
|
|
50
60
|
{status === 'processing' ? (
|
|
51
61
|
<Spinner size={14} color={tint} />
|
|
52
62
|
) : (
|
|
53
|
-
<
|
|
54
|
-
name={
|
|
55
|
-
status === 'confirmed'
|
|
56
|
-
? 'check'
|
|
57
|
-
: status === 'cancelled'
|
|
58
|
-
? 'close'
|
|
59
|
-
: 'warning'
|
|
60
|
-
}
|
|
61
|
-
size={14}
|
|
62
|
-
color={tint}
|
|
63
|
-
/>
|
|
63
|
+
<Glyph size={14} color={tint} />
|
|
64
64
|
)}
|
|
65
65
|
<Text
|
|
66
66
|
style={[styles.title, status === 'cancelled' && styles.cancelled]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Text, View } from 'react-native';
|
|
2
2
|
import {
|
|
3
3
|
Button,
|
|
4
|
-
|
|
4
|
+
r,
|
|
5
5
|
useColors,
|
|
6
6
|
useThemedStyles,
|
|
7
7
|
} from '@unif/react-native-design';
|
|
@@ -48,6 +48,7 @@ export function Feedback({
|
|
|
48
48
|
const toneLabel = FEEDBACK_TONE_LABELS[tone];
|
|
49
49
|
const accessibilityLabel = `${toneLabel}:${title ? `${title}。` : ''}${message}`;
|
|
50
50
|
|
|
51
|
+
const Glyph = FEEDBACK_TONE_ICONS[tone];
|
|
51
52
|
return (
|
|
52
53
|
<View
|
|
53
54
|
style={[
|
|
@@ -57,7 +58,7 @@ export function Feedback({
|
|
|
57
58
|
]}
|
|
58
59
|
testID={testID}
|
|
59
60
|
>
|
|
60
|
-
<
|
|
61
|
+
<Glyph size={r(18)} color={toneColors.iconColor} />
|
|
61
62
|
<View style={styles.content}>
|
|
62
63
|
<View accessible accessibilityLabel={accessibilityLabel}>
|
|
63
64
|
{title ? (
|
|
@@ -1,4 +1,12 @@
|
|
|
1
|
-
import
|
|
1
|
+
import {
|
|
2
|
+
ErrorOutlined,
|
|
3
|
+
InfoOutlined,
|
|
4
|
+
SuccessOutlined,
|
|
5
|
+
WarningOutlined,
|
|
6
|
+
} from '@unif/react-native-icons';
|
|
7
|
+
import type { ComponentType } from 'react';
|
|
8
|
+
import type { IconProps } from '@unif/react-native-icons';
|
|
9
|
+
|
|
2
10
|
import type { FeedbackTone } from './types';
|
|
3
11
|
|
|
4
12
|
export const FEEDBACK_TONE_LABELS: Readonly<Record<FeedbackTone, string>> = {
|
|
@@ -8,9 +16,11 @@ export const FEEDBACK_TONE_LABELS: Readonly<Record<FeedbackTone, string>> = {
|
|
|
8
16
|
error: '错误',
|
|
9
17
|
};
|
|
10
18
|
|
|
11
|
-
export const FEEDBACK_TONE_ICONS: Readonly<
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
19
|
+
export const FEEDBACK_TONE_ICONS: Readonly<
|
|
20
|
+
Record<FeedbackTone, ComponentType<IconProps>>
|
|
21
|
+
> = {
|
|
22
|
+
info: InfoOutlined,
|
|
23
|
+
success: SuccessOutlined,
|
|
24
|
+
warning: WarningOutlined,
|
|
25
|
+
error: ErrorOutlined,
|
|
16
26
|
};
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
import { ImageOutlined } from '@unif/react-native-icons';
|
|
1
2
|
import { useEffect, useState } from 'react';
|
|
2
3
|
import { Image, View } from 'react-native';
|
|
3
|
-
import {
|
|
4
|
+
import { Thumbnail, r, useColors } from '@unif/react-native-design';
|
|
4
5
|
import { styles } from './styles';
|
|
5
6
|
import type { ImageRatio, MarkdownImageProps } from './types';
|
|
6
7
|
|
|
7
8
|
export function MarkdownImage({ uri, label }: MarkdownImageProps) {
|
|
9
|
+
const colors = useColors();
|
|
8
10
|
const [width, setWidth] = useState(1);
|
|
9
11
|
const [ratio, setRatio] = useState<ImageRatio | undefined>(undefined);
|
|
10
12
|
useEffect(() => {
|
|
@@ -44,7 +46,7 @@ export function MarkdownImage({ uri, label }: MarkdownImageProps) {
|
|
|
44
46
|
borderRadius: 0,
|
|
45
47
|
}}
|
|
46
48
|
resizeMode="contain"
|
|
47
|
-
fallback={<
|
|
49
|
+
fallback={<ImageOutlined size={r(18)} color={colors.foregroundMuted} />}
|
|
48
50
|
accessibilityLabel={label || '图片'}
|
|
49
51
|
/>
|
|
50
52
|
</View>
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { AlertOutlined } from '@unif/react-native-icons';
|
|
1
2
|
import { Pressable, Text, View } from 'react-native';
|
|
2
3
|
import {
|
|
3
4
|
Button,
|
|
@@ -142,7 +143,7 @@ export function Message(props: MessageProps) {
|
|
|
142
143
|
<View style={[styles.failureRow, placement === 'end' && styles.end]}>
|
|
143
144
|
{bubble}
|
|
144
145
|
<IconButton
|
|
145
|
-
icon=
|
|
146
|
+
icon={AlertOutlined}
|
|
146
147
|
size="sm"
|
|
147
148
|
variant="ghost"
|
|
148
149
|
color={colors.error}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ArrowDownOutlined } from '@unif/react-native-icons';
|
|
1
2
|
import { useEffect, useRef } from 'react';
|
|
2
3
|
import { Animated, View } from 'react-native';
|
|
3
4
|
import {
|
|
@@ -39,7 +40,7 @@ export function MessageListEndButton({
|
|
|
39
40
|
</View>
|
|
40
41
|
) : null}
|
|
41
42
|
<IconButton
|
|
42
|
-
icon=
|
|
43
|
+
icon={ArrowDownOutlined}
|
|
43
44
|
accessibilityLabel={busy ? '回到最新消息,正在处理' : '回到最新消息'}
|
|
44
45
|
variant="glass"
|
|
45
46
|
size="md"
|
|
@@ -2,7 +2,7 @@ import { useEffect, useState } from 'react';
|
|
|
2
2
|
import { Text, View } from 'react-native';
|
|
3
3
|
import {
|
|
4
4
|
Button,
|
|
5
|
-
|
|
5
|
+
r,
|
|
6
6
|
useColors,
|
|
7
7
|
useThemedStyles,
|
|
8
8
|
} from '@unif/react-native-design';
|
|
@@ -125,11 +125,13 @@ export function Process(props: ProcessProps): React.JSX.Element {
|
|
|
125
125
|
key={step.id}
|
|
126
126
|
step={step}
|
|
127
127
|
identity={inlineIdentity ? identity : undefined}
|
|
128
|
+
dense={props.compactDensity === 'dense'}
|
|
128
129
|
expanded={isExpanded}
|
|
129
130
|
elapsed={elapsed}
|
|
130
131
|
onToggle={() => toggleDetails(step.id)}
|
|
131
132
|
/>
|
|
132
133
|
);
|
|
134
|
+
const Glyph = PROCESS_STATUS_ICONS[step.status];
|
|
133
135
|
return (
|
|
134
136
|
<View
|
|
135
137
|
key={step.id}
|
|
@@ -150,8 +152,8 @@ export function Process(props: ProcessProps): React.JSX.Element {
|
|
|
150
152
|
accessible
|
|
151
153
|
accessibilityLabel={`${step.title},${statusLabel}`}
|
|
152
154
|
>
|
|
153
|
-
<
|
|
154
|
-
|
|
155
|
+
<Glyph
|
|
156
|
+
size={r(18)}
|
|
155
157
|
color={
|
|
156
158
|
step.status === 'failed'
|
|
157
159
|
? colors.error
|