@dxos/react-ui-thread 0.8.4-main.7ace549 → 0.8.4-main.8360d9e660
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/dist/lib/browser/index.mjs +129 -175
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/types/src/Message/Message.d.ts +2 -2
- package/dist/types/src/Message/Message.d.ts.map +1 -1
- package/dist/types/src/Message/Message.stories.d.ts +1 -1
- package/dist/types/src/Thread/Comments.stories.d.ts +1 -1
- package/dist/types/src/Thread/Comments.stories.d.ts.map +1 -1
- package/dist/types/src/Thread/Thread.d.ts +2 -2
- package/dist/types/src/Thread/Thread.d.ts.map +1 -1
- package/dist/types/src/Thread/Thread.stories.d.ts +1 -1
- package/dist/types/src/translations.d.ts +2 -2
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +26 -23
- package/src/Message/Message.stories.tsx +4 -4
- package/src/Message/Message.tsx +11 -11
- package/src/Thread/Comments.stories.tsx +42 -20
- package/src/Thread/Thread.stories.tsx +5 -5
- package/src/Thread/Thread.tsx +9 -12
- package/src/testing.tsx +3 -3
- package/src/translations.ts +1 -1
package/package.json
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/react-ui-thread",
|
|
3
|
-
"version": "0.8.4-main.
|
|
3
|
+
"version": "0.8.4-main.8360d9e660",
|
|
4
4
|
"description": "A set of components to use with threads, including comments and messages.",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/dxos/dxos"
|
|
10
|
+
},
|
|
7
11
|
"license": "MIT",
|
|
8
12
|
"author": "DXOS.org",
|
|
9
|
-
"sideEffects":
|
|
13
|
+
"sideEffects": false,
|
|
10
14
|
"type": "module",
|
|
11
15
|
"exports": {
|
|
12
16
|
".": {
|
|
@@ -24,33 +28,32 @@
|
|
|
24
28
|
"src"
|
|
25
29
|
],
|
|
26
30
|
"dependencies": {
|
|
27
|
-
"@preact-signals/safe-react": "^0.9.0",
|
|
28
31
|
"@radix-ui/react-primitive": "2.0.2",
|
|
29
32
|
"date-fns": "^3.3.1",
|
|
30
|
-
"@dxos/react-ui-editor": "0.8.4-main.
|
|
31
|
-
"@dxos/util": "0.8.4-main.
|
|
33
|
+
"@dxos/react-ui-editor": "0.8.4-main.8360d9e660",
|
|
34
|
+
"@dxos/util": "0.8.4-main.8360d9e660",
|
|
35
|
+
"@dxos/ui-editor": "0.8.4-main.8360d9e660"
|
|
32
36
|
},
|
|
33
37
|
"devDependencies": {
|
|
34
|
-
"@types/react": "~19.2.
|
|
35
|
-
"@types/react-dom": "~19.2.
|
|
36
|
-
"react": "~19.2.
|
|
37
|
-
"react-dom": "~19.2.
|
|
38
|
-
"vite": "7.1.
|
|
39
|
-
"@dxos/echo": "0.8.4-main.
|
|
40
|
-
"@dxos/echo-db": "0.8.4-main.
|
|
41
|
-
"@dxos/keys": "0.8.4-main.
|
|
42
|
-
"@dxos/
|
|
43
|
-
"@dxos/
|
|
44
|
-
"@dxos/
|
|
45
|
-
"@dxos/
|
|
46
|
-
"@dxos/
|
|
47
|
-
"@dxos/storybook-utils": "0.8.4-main.7ace549"
|
|
38
|
+
"@types/react": "~19.2.7",
|
|
39
|
+
"@types/react-dom": "~19.2.3",
|
|
40
|
+
"react": "~19.2.3",
|
|
41
|
+
"react-dom": "~19.2.3",
|
|
42
|
+
"vite": "^7.1.11",
|
|
43
|
+
"@dxos/echo": "0.8.4-main.8360d9e660",
|
|
44
|
+
"@dxos/echo-db": "0.8.4-main.8360d9e660",
|
|
45
|
+
"@dxos/keys": "0.8.4-main.8360d9e660",
|
|
46
|
+
"@dxos/log": "0.8.4-main.8360d9e660",
|
|
47
|
+
"@dxos/react-ui": "0.8.4-main.8360d9e660",
|
|
48
|
+
"@dxos/storybook-utils": "0.8.4-main.8360d9e660",
|
|
49
|
+
"@dxos/ui-theme": "0.8.4-main.8360d9e660",
|
|
50
|
+
"@dxos/random": "0.8.4-main.8360d9e660"
|
|
48
51
|
},
|
|
49
52
|
"peerDependencies": {
|
|
50
|
-
"react": "
|
|
51
|
-
"react-dom": "
|
|
52
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
53
|
-
"@dxos/
|
|
53
|
+
"react": "~19.2.3",
|
|
54
|
+
"react-dom": "~19.2.3",
|
|
55
|
+
"@dxos/react-ui": "0.8.4-main.8360d9e660",
|
|
56
|
+
"@dxos/ui-theme": "0.8.4-main.8360d9e660"
|
|
54
57
|
},
|
|
55
58
|
"publishConfig": {
|
|
56
59
|
"access": "public"
|
|
@@ -6,8 +6,8 @@ import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
|
6
6
|
import React, { useState } from 'react';
|
|
7
7
|
|
|
8
8
|
import { PublicKey } from '@dxos/keys';
|
|
9
|
-
import { withTheme } from '@dxos/react-ui/testing';
|
|
10
|
-
import { hoverableControls, hoverableFocusedWithinControls } from '@dxos/
|
|
9
|
+
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
10
|
+
import { hoverableControls, hoverableFocusedWithinControls } from '@dxos/ui-theme';
|
|
11
11
|
|
|
12
12
|
import { type MessageEntity, MessageStoryText } from '../testing';
|
|
13
13
|
import { Thread } from '../Thread';
|
|
@@ -25,7 +25,7 @@ const DefaultStory = () => {
|
|
|
25
25
|
});
|
|
26
26
|
|
|
27
27
|
return (
|
|
28
|
-
<div className='
|
|
28
|
+
<div className='mx-auto w-96 overflow-y-auto'>
|
|
29
29
|
<Thread.Root id='t1'>
|
|
30
30
|
<MessageRoot {...message} classNames={[hoverableControls, hoverableFocusedWithinControls]}>
|
|
31
31
|
<MessageStoryText {...message} onDelete={() => console.log('delete')} />
|
|
@@ -39,7 +39,7 @@ const meta = {
|
|
|
39
39
|
title: 'ui/react-ui-thread/Message',
|
|
40
40
|
component: MessageRoot as any,
|
|
41
41
|
render: DefaultStory,
|
|
42
|
-
decorators: [withTheme],
|
|
42
|
+
decorators: [withTheme(), withLayout({ layout: 'fullscreen' })],
|
|
43
43
|
parameters: {
|
|
44
44
|
layout: 'fullscreen',
|
|
45
45
|
translations,
|
package/src/Message/Message.tsx
CHANGED
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
import { formatDistanceToNow } from 'date-fns/formatDistanceToNow';
|
|
6
6
|
import React, { type ComponentPropsWithRef, type ComponentPropsWithoutRef, forwardRef } from 'react';
|
|
7
7
|
|
|
8
|
-
// TODO(burdon): Remove dep.
|
|
9
8
|
import { Avatar, type ThemedClassName, useTranslation } from '@dxos/react-ui';
|
|
10
|
-
import { type UseTextEditorProps,
|
|
11
|
-
import {
|
|
9
|
+
import { type UseTextEditorProps, useTextEditor } from '@dxos/react-ui-editor';
|
|
10
|
+
import { keymap, listener } from '@dxos/ui-editor';
|
|
11
|
+
import { focusRing, mx } from '@dxos/ui-theme';
|
|
12
12
|
import { hexToEmoji, hexToHue, isTruthy } from '@dxos/util';
|
|
13
13
|
|
|
14
14
|
import { translationKey } from '../translations';
|
|
@@ -16,9 +16,9 @@ import { type MessageMetadata } from '../types';
|
|
|
16
16
|
|
|
17
17
|
const avatarSize = 7;
|
|
18
18
|
|
|
19
|
-
export type MessageRootProps = ThemedClassName<
|
|
20
|
-
MessageMetadata &
|
|
21
|
-
|
|
19
|
+
export type MessageRootProps = ThemedClassName<
|
|
20
|
+
ComponentPropsWithRef<'div'> & MessageMetadata & Partial<{ continues: boolean }>
|
|
21
|
+
>;
|
|
22
22
|
|
|
23
23
|
// TODO(burdon): Show authorName on tooltip.
|
|
24
24
|
export const MessageRoot = forwardRef<HTMLDivElement, MessageRootProps>(
|
|
@@ -36,16 +36,16 @@ export const MessageRoot = forwardRef<HTMLDivElement, MessageRootProps>(
|
|
|
36
36
|
className={mx('grid grid-cols-subgrid col-span-2', classNames)}
|
|
37
37
|
ref={forwardedRef}
|
|
38
38
|
>
|
|
39
|
-
<div role='none' className='flex flex-col items-center gap-2
|
|
39
|
+
<div role='none' className='flex flex-col items-center gap-2 pt-1'>
|
|
40
40
|
<Avatar.Content
|
|
41
41
|
size={avatarSize}
|
|
42
42
|
hue={authorAvatarProps?.hue || hexToHue(authorId ?? '0')}
|
|
43
43
|
fallback={authorAvatarProps?.emoji || hexToEmoji(authorId ?? '0')}
|
|
44
44
|
{...(authorImgSrc && { imgSrc: authorImgSrc })}
|
|
45
45
|
/>
|
|
46
|
-
{continues && <div role='none' className='
|
|
46
|
+
{continues && <div role='none' className='w-px grow bg-separator' />}
|
|
47
47
|
</div>
|
|
48
|
-
<div role='none' className='
|
|
48
|
+
<div role='none' className='py-1 min-w-0'>
|
|
49
49
|
{children}
|
|
50
50
|
</div>
|
|
51
51
|
</div>
|
|
@@ -84,7 +84,7 @@ export const MessageTime = ({ timestamp }: MessageTimeProps) => {
|
|
|
84
84
|
const { dtLocale } = useTranslation(translationKey);
|
|
85
85
|
const dt = timestamp ? new Date(timestamp) : undefined;
|
|
86
86
|
return (
|
|
87
|
-
<time className='block text-subdued text-xs
|
|
87
|
+
<time className='block text-subdued text-xs pb-0.5' dateTime={dt?.toISOString()}>
|
|
88
88
|
{dt ? formatDistanceToNow(dt, { locale: dtLocale, addSuffix: true }) : ''}
|
|
89
89
|
</time>
|
|
90
90
|
);
|
|
@@ -167,7 +167,7 @@ export const MessageTextbox = ({
|
|
|
167
167
|
<div
|
|
168
168
|
role='none'
|
|
169
169
|
ref={parentRef}
|
|
170
|
-
className={mx('
|
|
170
|
+
className={mx('py-0.5 me-1 rounded-xs', focusRing, disabled && 'opacity-50')}
|
|
171
171
|
{...focusAttributes}
|
|
172
172
|
/>
|
|
173
173
|
</MessageRoot>
|
|
@@ -5,27 +5,29 @@
|
|
|
5
5
|
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
6
|
import React, { type FC, useEffect, useMemo, useRef, useState } from 'react';
|
|
7
7
|
|
|
8
|
-
import {
|
|
8
|
+
import { Obj } from '@dxos/echo';
|
|
9
|
+
import { TestSchema } from '@dxos/echo/testing';
|
|
9
10
|
import { PublicKey } from '@dxos/keys';
|
|
10
11
|
import { log } from '@dxos/log';
|
|
11
12
|
import { faker } from '@dxos/random';
|
|
12
13
|
import { Icon, IconButton, useThemeContext } from '@dxos/react-ui';
|
|
13
|
-
import { withTheme } from '@dxos/react-ui/testing';
|
|
14
|
+
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
15
|
+
import { useTextEditor } from '@dxos/react-ui-editor';
|
|
14
16
|
import {
|
|
15
17
|
type Comment,
|
|
16
18
|
type CommentsOptions,
|
|
19
|
+
type EditorView,
|
|
17
20
|
type Range,
|
|
18
21
|
comments,
|
|
19
22
|
createBasicExtensions,
|
|
20
23
|
createThemeExtensions,
|
|
24
|
+
documentId,
|
|
21
25
|
listener,
|
|
22
26
|
scrollThreadIntoView,
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
} from '@dxos/
|
|
26
|
-
import { hoverableControls, hoverableFocusedWithinControls } from '@dxos/react-ui-theme';
|
|
27
|
+
setComments,
|
|
28
|
+
} from '@dxos/ui-editor';
|
|
29
|
+
import { hoverableControls, hoverableFocusedWithinControls } from '@dxos/ui-theme';
|
|
27
30
|
|
|
28
|
-
import { Obj } from '../../../../core/echo/echo/src';
|
|
29
31
|
import { MessageBody, MessageHeading, MessageRoot, MessageTextbox } from '../Message';
|
|
30
32
|
import { type MessageEntity } from '../testing';
|
|
31
33
|
import { translations } from '../translations';
|
|
@@ -36,13 +38,31 @@ faker.seed(101);
|
|
|
36
38
|
|
|
37
39
|
const authorId = PublicKey.random().toHex();
|
|
38
40
|
|
|
41
|
+
/**
|
|
42
|
+
* @deprecated This hook will be removed in future versions. Use the new comment sync extension instead.
|
|
43
|
+
* Update comments state field.
|
|
44
|
+
*/
|
|
45
|
+
const useComments = (view: EditorView | null | undefined, id: string, comments?: Comment[]) => {
|
|
46
|
+
useEffect(() => {
|
|
47
|
+
if (view) {
|
|
48
|
+
// Check same document.
|
|
49
|
+
// NOTE: Hook might be called before editor state is updated.
|
|
50
|
+
if (id === view.state.facet(documentId)) {
|
|
51
|
+
view.dispatch({
|
|
52
|
+
effects: setComments.of({ id, comments: comments ?? [] }),
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
|
|
39
59
|
//
|
|
40
60
|
// Editor
|
|
41
61
|
//
|
|
42
62
|
|
|
43
63
|
const Editor: FC<{
|
|
44
64
|
id?: string;
|
|
45
|
-
|
|
65
|
+
initialValue: string;
|
|
46
66
|
comments: Comment[];
|
|
47
67
|
selected?: string;
|
|
48
68
|
onCreateComment: CommentsOptions['onCreate'];
|
|
@@ -51,7 +71,7 @@ const Editor: FC<{
|
|
|
51
71
|
onSelectComment: CommentsOptions['onSelect'];
|
|
52
72
|
}> = ({
|
|
53
73
|
id = 'test',
|
|
54
|
-
|
|
74
|
+
initialValue,
|
|
55
75
|
selected: selectedValue,
|
|
56
76
|
comments: commentRanges,
|
|
57
77
|
onCreateComment,
|
|
@@ -65,7 +85,7 @@ const Editor: FC<{
|
|
|
65
85
|
const { parentRef, view } = useTextEditor(
|
|
66
86
|
() => ({
|
|
67
87
|
id,
|
|
68
|
-
initialValue:
|
|
88
|
+
initialValue: initialValue,
|
|
69
89
|
extensions: [
|
|
70
90
|
createBasicExtensions(),
|
|
71
91
|
createThemeExtensions({ themeMode }),
|
|
@@ -78,7 +98,7 @@ const Editor: FC<{
|
|
|
78
98
|
}),
|
|
79
99
|
],
|
|
80
100
|
}),
|
|
81
|
-
[id,
|
|
101
|
+
[id, initialValue, themeMode],
|
|
82
102
|
);
|
|
83
103
|
useComments(view, id, commentRanges);
|
|
84
104
|
useEffect(() => {
|
|
@@ -141,7 +161,7 @@ const StoryThread: FC<{
|
|
|
141
161
|
|
|
142
162
|
const handleCreateMessage = () => {
|
|
143
163
|
if (messageRef.current?.length) {
|
|
144
|
-
const message = Obj.make(Expando, {
|
|
164
|
+
const message = Obj.make(TestSchema.Expando, {
|
|
145
165
|
timestamp: new Date().toISOString(),
|
|
146
166
|
sender: { identityKey: authorId },
|
|
147
167
|
text: messageRef.current,
|
|
@@ -188,7 +208,7 @@ const StoryThread: FC<{
|
|
|
188
208
|
variant='ghost'
|
|
189
209
|
icon='ph--check--regular'
|
|
190
210
|
iconOnly
|
|
191
|
-
classNames='
|
|
211
|
+
classNames='px-1'
|
|
192
212
|
label='Resolve'
|
|
193
213
|
onClick={onResolve}
|
|
194
214
|
/>
|
|
@@ -197,12 +217,14 @@ const StoryThread: FC<{
|
|
|
197
217
|
);
|
|
198
218
|
};
|
|
199
219
|
|
|
200
|
-
|
|
220
|
+
type SidebarProps = {
|
|
201
221
|
threads: StoryCommentThread[];
|
|
202
222
|
selected?: string;
|
|
203
223
|
onSelect: (thread: string) => void;
|
|
204
224
|
onResolve: (thread: string) => void;
|
|
205
|
-
}
|
|
225
|
+
};
|
|
226
|
+
|
|
227
|
+
const Sidebar = ({ threads, selected, onSelect, onResolve }: SidebarProps) => {
|
|
206
228
|
// Sort by y-position.
|
|
207
229
|
const sortedThreads = useMemo(() => {
|
|
208
230
|
const sorted = [...threads];
|
|
@@ -236,7 +258,7 @@ type StoryProps = {
|
|
|
236
258
|
};
|
|
237
259
|
|
|
238
260
|
const DefaultStory = ({ text, autoCreate }: StoryProps) => {
|
|
239
|
-
const [item] = useState(() => Obj.make(Expando, { content: text ?? '' }));
|
|
261
|
+
const [item] = useState(() => Obj.make(TestSchema.Expando, { content: text ?? '' }));
|
|
240
262
|
const [threads, setThreads] = useState<StoryCommentThread[]>([]);
|
|
241
263
|
const [selected, setSelected] = useState<string>();
|
|
242
264
|
|
|
@@ -328,9 +350,9 @@ const DefaultStory = ({ text, autoCreate }: StoryProps) => {
|
|
|
328
350
|
|
|
329
351
|
return (
|
|
330
352
|
<main className='fixed inset-0 grid grid-cols-[1fr_24rem]'>
|
|
331
|
-
<div role='none' className='max-
|
|
353
|
+
<div role='none' className='max-h-full overflow-y-auto p-4'>
|
|
332
354
|
<Editor
|
|
333
|
-
|
|
355
|
+
initialValue={item.content}
|
|
334
356
|
selected={selected}
|
|
335
357
|
comments={comments}
|
|
336
358
|
onCreateComment={handleCreateComment}
|
|
@@ -340,7 +362,7 @@ const DefaultStory = ({ text, autoCreate }: StoryProps) => {
|
|
|
340
362
|
/>
|
|
341
363
|
</div>
|
|
342
364
|
|
|
343
|
-
<div role='none' className='max-
|
|
365
|
+
<div role='none' className='max-h-full overflow-y-auto p-4'>
|
|
344
366
|
<Sidebar
|
|
345
367
|
threads={visibleThreads}
|
|
346
368
|
selected={selected}
|
|
@@ -356,7 +378,7 @@ const meta = {
|
|
|
356
378
|
title: 'ui/react-ui-thread/Comments',
|
|
357
379
|
component: StoryThread as any,
|
|
358
380
|
render: DefaultStory,
|
|
359
|
-
decorators: [withTheme],
|
|
381
|
+
decorators: [withTheme(), withLayout({ layout: 'fullscreen' })],
|
|
360
382
|
parameters: {
|
|
361
383
|
translations,
|
|
362
384
|
layout: 'fullscreen',
|
|
@@ -7,9 +7,9 @@ import React, { useMemo, useRef, useState } from 'react';
|
|
|
7
7
|
|
|
8
8
|
import { PublicKey } from '@dxos/keys';
|
|
9
9
|
import { faker } from '@dxos/random';
|
|
10
|
-
import { withTheme } from '@dxos/react-ui/testing';
|
|
11
|
-
import { createBasicExtensions, createThemeExtensions } from '@dxos/
|
|
12
|
-
import { hoverableControls, hoverableFocusedWithinControls } from '@dxos/
|
|
10
|
+
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
11
|
+
import { createBasicExtensions, createThemeExtensions } from '@dxos/ui-editor';
|
|
12
|
+
import { hoverableControls, hoverableFocusedWithinControls } from '@dxos/ui-theme';
|
|
13
13
|
|
|
14
14
|
import { MessageRoot, MessageTextbox } from '../Message';
|
|
15
15
|
import { type MessageEntity, MessageStoryText } from '../testing';
|
|
@@ -59,7 +59,7 @@ const DefaultStory = () => {
|
|
|
59
59
|
};
|
|
60
60
|
|
|
61
61
|
return (
|
|
62
|
-
<div className='
|
|
62
|
+
<div className='mx-auto w-96 overflow-y-auto'>
|
|
63
63
|
<Thread.Root id='t1'>
|
|
64
64
|
{messages.map((message) => (
|
|
65
65
|
<MessageRoot key={message.id} classNames={[hoverableControls, hoverableFocusedWithinControls]} {...message}>
|
|
@@ -85,7 +85,7 @@ const meta = {
|
|
|
85
85
|
title: 'ui/react-ui-thread/Thread',
|
|
86
86
|
component: Thread.Root,
|
|
87
87
|
render: DefaultStory,
|
|
88
|
-
decorators: [withTheme],
|
|
88
|
+
decorators: [withTheme(), withLayout({ layout: 'fullscreen' })],
|
|
89
89
|
parameters: {
|
|
90
90
|
layout: 'fullscreen',
|
|
91
91
|
translations,
|
package/src/Thread/Thread.tsx
CHANGED
|
@@ -5,13 +5,13 @@
|
|
|
5
5
|
import React, { type ComponentPropsWithRef, forwardRef } from 'react';
|
|
6
6
|
|
|
7
7
|
import { Icon, type ThemedClassName, useTranslation } from '@dxos/react-ui';
|
|
8
|
-
import { hoverableControlItem, hoverableFocusedWithinControls, mx } from '@dxos/
|
|
8
|
+
import { hoverableControlItem, hoverableFocusedWithinControls, mx } from '@dxos/ui-theme';
|
|
9
9
|
|
|
10
10
|
import { translationKey } from '../translations';
|
|
11
11
|
import type { ThreadEntity } from '../types';
|
|
12
12
|
|
|
13
|
-
// TODO(burdon):
|
|
14
|
-
export const threadLayout = '
|
|
13
|
+
// TODO(burdon): Avoid exporting fragments.
|
|
14
|
+
export const threadLayout = 'w-full place-self-start grid grid-cols-[var(--dx-rail-size)_1fr]';
|
|
15
15
|
|
|
16
16
|
//
|
|
17
17
|
// Root
|
|
@@ -30,7 +30,7 @@ const ThreadRoot = forwardRef<HTMLDivElement, ThreadRootProps>(
|
|
|
30
30
|
className={mx(
|
|
31
31
|
threadLayout,
|
|
32
32
|
hoverableFocusedWithinControls,
|
|
33
|
-
'bg-[var(--surface-bg)] current-related attention-surface [--controls-opacity:0]',
|
|
33
|
+
'bg-[var(--surface-bg)] current-related dx-attention-surface [--controls-opacity:0]',
|
|
34
34
|
classNames,
|
|
35
35
|
)}
|
|
36
36
|
ref={forwardedRef}
|
|
@@ -59,10 +59,7 @@ const ThreadHeader = forwardRef<HTMLParagraphElement, ThreadHeaderProps>(
|
|
|
59
59
|
role='heading'
|
|
60
60
|
data-testid='thread.heading'
|
|
61
61
|
{...props}
|
|
62
|
-
className={mx(
|
|
63
|
-
'mie-2 text-description font-medium truncate italic',
|
|
64
|
-
detached && 'line-through decoration-1',
|
|
65
|
-
)}
|
|
62
|
+
className={mx('me-2 text-description font-medium truncate italic', detached && 'line-through decoration-1')}
|
|
66
63
|
ref={forwardedRef}
|
|
67
64
|
>
|
|
68
65
|
{children}
|
|
@@ -88,17 +85,17 @@ const ThreadStatus = forwardRef<HTMLDivElement, ThreadStatusProps>(
|
|
|
88
85
|
<div
|
|
89
86
|
{...props}
|
|
90
87
|
className={mx(
|
|
91
|
-
'col-start-2 grid grid-cols-[min-content_1fr_max-content] pb-2
|
|
88
|
+
'col-start-2 grid grid-cols-[min-content_1fr_max-content] pb-2 pe-2 text-xs text-description',
|
|
92
89
|
classNames,
|
|
93
90
|
)}
|
|
94
91
|
ref={forwardedRef}
|
|
95
92
|
>
|
|
96
93
|
<Icon
|
|
97
94
|
icon='ph--spinner--bold'
|
|
98
|
-
classNames='
|
|
95
|
+
classNames='w-6 h-4 invisible data-[visible=show]:visible animate-spin-slow'
|
|
99
96
|
data-visible={activity ? 'show' : 'hide'}
|
|
100
97
|
/>
|
|
101
|
-
<span className='truncate min-
|
|
98
|
+
<span className='truncate min-w-0' aria-live='polite'>
|
|
102
99
|
{activity ? children : null}
|
|
103
100
|
</span>
|
|
104
101
|
<span className={mx('text-end', hoverableControlItem)}>{t('enter to send message')}</span>
|
|
@@ -113,4 +110,4 @@ export const Thread = {
|
|
|
113
110
|
Status: ThreadStatus,
|
|
114
111
|
};
|
|
115
112
|
|
|
116
|
-
export type { ThreadRootProps, ThreadHeaderProps
|
|
113
|
+
export type { ThreadRootProps, ThreadHeaderProps, ThreadStatusProps };
|
package/src/testing.tsx
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
|
|
7
7
|
import { IconButton } from '@dxos/react-ui';
|
|
8
|
-
import { hoverableControlItem, hoverableControls, hoverableFocusedWithinControls, mx } from '@dxos/
|
|
8
|
+
import { hoverableControlItem, hoverableControls, hoverableFocusedWithinControls, mx } from '@dxos/ui-theme';
|
|
9
9
|
|
|
10
10
|
import { MessageBody, MessageHeading } from './Message';
|
|
11
11
|
import { type MessageMetadata } from './types';
|
|
@@ -30,7 +30,7 @@ export const MessageStoryText = ({ text, onDelete, authorName, timestamp }: Mess
|
|
|
30
30
|
iconOnly
|
|
31
31
|
label='Delete'
|
|
32
32
|
variant='ghost'
|
|
33
|
-
classNames={['p-1.5 min-
|
|
33
|
+
classNames={['p-1.5 min-h-0 me-1 items-start transition-opacity', hoverableControlItem]}
|
|
34
34
|
onClick={() => onDelete()}
|
|
35
35
|
/>
|
|
36
36
|
)}
|
|
@@ -50,7 +50,7 @@ export const MessageStoryBlock = <PartValue,>({ part }: MessagePartProps<PartVal
|
|
|
50
50
|
role='none'
|
|
51
51
|
className={mx('grid grid-cols-subgrid col-span-3', hoverableControls, hoverableFocusedWithinControls)}
|
|
52
52
|
>
|
|
53
|
-
<pre className='font-mono max-
|
|
53
|
+
<pre className='font-mono max-w-full overflow-x-auto col-span-3'>
|
|
54
54
|
<code>{JSON.stringify(part, undefined, 2)}</code>
|
|
55
55
|
</pre>
|
|
56
56
|
</div>
|