@12-apps/chat 1.1.0 → 1.2.1
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/package.json +3 -3
- package/src/react/composer.tsx +7 -3
- package/src/ui/thread-view.tsx +10 -9
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@12-apps/chat",
|
|
3
|
-
"version": "1.1
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"description": "Conversation threads between the parties to one piece of work, each shown only by a host-chosen role label: framework-neutral HTTP routes with per-role write windows, a contact-info filter and quick replies, plus one thread screen built from @12-apps/ui primitives for web hosts and React Native hosts alike.",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"prisma:sync:check": "node scripts/sync-chat-schema.mjs --check"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
30
|
-
"@12-apps/ui": ">=6.
|
|
30
|
+
"@12-apps/ui": ">=6.70.0",
|
|
31
31
|
"@12-apps/wiring": ">=1.17.0",
|
|
32
32
|
"react": "^18.0.0 || ^19.0.0",
|
|
33
33
|
"react-native": ">=0.79.0"
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@12-apps/eslint-config": "^1.22.0",
|
|
51
51
|
"@12-apps/typescript-config": "^1.21.0",
|
|
52
|
-
"@12-apps/ui": "^6.
|
|
52
|
+
"@12-apps/ui": "^6.71.0",
|
|
53
53
|
"@12-apps/wiring": "^1.17.0",
|
|
54
54
|
"@testing-library/react": "^16.3.1",
|
|
55
55
|
"@types/node": "^22.10.6",
|
package/src/react/composer.tsx
CHANGED
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
|
|
16
16
|
import { Button } from "@12-apps/ui/form/Button";
|
|
17
17
|
import { Input } from "@12-apps/ui/form/Input";
|
|
18
|
+
import { Icon } from "@12-apps/ui/icons";
|
|
18
19
|
import { Box } from "@12-apps/ui/layout/Box";
|
|
19
20
|
import { useRef, type JSX, type KeyboardEvent } from "react";
|
|
20
21
|
|
|
@@ -45,14 +46,17 @@ export function WebComposer(props: ChatComposerProps): JSX.Element {
|
|
|
45
46
|
testID="chat-input"
|
|
46
47
|
/>
|
|
47
48
|
</Box>
|
|
49
|
+
{/* Icon-only: the field says what it is for, the arrow is the act. Its name is the copy's. */}
|
|
48
50
|
<Button
|
|
49
51
|
variant="solid"
|
|
52
|
+
icon={<Icon name="Send" size={18} />}
|
|
53
|
+
aria-label={props.sending ? props.copy.sending : props.copy.send}
|
|
54
|
+
title={props.copy.send}
|
|
55
|
+
loading={props.sending}
|
|
50
56
|
onClick={onSend}
|
|
51
57
|
disabled={props.sending || props.value.trim() === ""}
|
|
52
58
|
testID="chat-send"
|
|
53
|
-
|
|
54
|
-
{props.sending ? props.copy.sending : props.copy.send}
|
|
55
|
-
</Button>
|
|
59
|
+
/>
|
|
56
60
|
</Box>
|
|
57
61
|
);
|
|
58
62
|
}
|
package/src/ui/thread-view.tsx
CHANGED
|
@@ -20,6 +20,7 @@ import { ErrorState } from "@12-apps/ui/data-display/ErrorState";
|
|
|
20
20
|
import { LoadingState } from "@12-apps/ui/data-display/LoadingState";
|
|
21
21
|
import { Box } from "@12-apps/ui/layout/Box";
|
|
22
22
|
import { Stack } from "@12-apps/ui/layout/Stack";
|
|
23
|
+
import { Icon } from "@12-apps/ui/icons";
|
|
23
24
|
import { Text } from "@12-apps/ui/typography/Text";
|
|
24
25
|
import { useState, type ComponentType, type JSX, type ReactNode } from "react";
|
|
25
26
|
|
|
@@ -94,16 +95,15 @@ function Message(props: {
|
|
|
94
95
|
return (
|
|
95
96
|
<Box direction="row" justify={message.mine ? "end" : "start"} testID={`chat-message-${message.id}`}>
|
|
96
97
|
<Bubble mine={message.mine}>
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
<Text variant="caption" color="secondary">
|
|
103
|
-
{formatTime(message.createdAt)}
|
|
104
|
-
</Text>
|
|
105
|
-
</Stack>
|
|
98
|
+
{/* Who wrote it over the text, when under it: a bubble reads top to bottom. */}
|
|
99
|
+
{/* Body-text colour on the own tint: the primary colour on its own tint falls under 4.5:1. */}
|
|
100
|
+
<Text variant="caption" weight="semibold" color={message.mine ? "neutral" : "secondary"}>
|
|
101
|
+
{message.label}
|
|
102
|
+
</Text>
|
|
106
103
|
<Text>{message.body}</Text>
|
|
104
|
+
<Text variant="caption" color="secondary">
|
|
105
|
+
{formatTime(message.createdAt)}
|
|
106
|
+
</Text>
|
|
107
107
|
</Bubble>
|
|
108
108
|
</Box>
|
|
109
109
|
);
|
|
@@ -126,6 +126,7 @@ function QuickReplies(props: {
|
|
|
126
126
|
<Chip
|
|
127
127
|
key={reply.key}
|
|
128
128
|
label={reply.text}
|
|
129
|
+
icon={<Icon name="Bolt" size={14} />}
|
|
129
130
|
variant="outlined"
|
|
130
131
|
disabled={props.disabled}
|
|
131
132
|
onClick={() => props.onPick(reply.key)}
|