@dxos/react-ui-thread 0.8.4-main.5ea62a8 → 0.8.4-main.72ec0f3
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 +4 -4
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/types/src/Message/Message.stories.d.ts +1 -1
- package/dist/types/src/Message/Message.stories.d.ts.map +1 -1
- package/dist/types/src/Thread/Comments.stories.d.ts +0 -1
- package/dist/types/src/Thread/Comments.stories.d.ts.map +1 -1
- package/dist/types/src/Thread/Thread.d.ts +1 -1
- 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/Thread/Thread.stories.d.ts.map +1 -1
- package/dist/types/src/testing.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +21 -21
- package/src/Message/Message.stories.tsx +6 -5
- package/src/Message/Message.tsx +3 -3
- package/src/Thread/Comments.stories.tsx +24 -16
- package/src/Thread/Thread.stories.tsx +6 -5
- package/src/Thread/Thread.tsx +2 -2
- package/src/testing.tsx +6 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/react-ui-thread",
|
|
3
|
-
"version": "0.8.4-main.
|
|
3
|
+
"version": "0.8.4-main.72ec0f3",
|
|
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",
|
|
@@ -27,30 +27,30 @@
|
|
|
27
27
|
"@preact-signals/safe-react": "^0.9.0",
|
|
28
28
|
"@radix-ui/react-primitive": "2.0.2",
|
|
29
29
|
"date-fns": "^3.3.1",
|
|
30
|
-
"@dxos/react-ui-editor": "0.8.4-main.
|
|
31
|
-
"@dxos/util": "0.8.4-main.
|
|
30
|
+
"@dxos/react-ui-editor": "0.8.4-main.72ec0f3",
|
|
31
|
+
"@dxos/util": "0.8.4-main.72ec0f3"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@types/react": "~
|
|
35
|
-
"@types/react-dom": "~
|
|
36
|
-
"react": "~
|
|
37
|
-
"react-dom": "~
|
|
38
|
-
"vite": "7.1.
|
|
39
|
-
"@dxos/echo
|
|
40
|
-
"@dxos/
|
|
41
|
-
"@dxos/
|
|
42
|
-
"@dxos/
|
|
43
|
-
"@dxos/
|
|
44
|
-
"@dxos/
|
|
45
|
-
"@dxos/react-ui-theme": "0.8.4-main.
|
|
46
|
-
"@dxos/
|
|
47
|
-
"@dxos/storybook-utils": "0.8.4-main.
|
|
34
|
+
"@types/react": "~19.2.2",
|
|
35
|
+
"@types/react-dom": "~19.2.2",
|
|
36
|
+
"react": "~19.2.0",
|
|
37
|
+
"react-dom": "~19.2.0",
|
|
38
|
+
"vite": "7.1.9",
|
|
39
|
+
"@dxos/echo": "0.8.4-main.72ec0f3",
|
|
40
|
+
"@dxos/live-object": "0.8.4-main.72ec0f3",
|
|
41
|
+
"@dxos/keys": "0.8.4-main.72ec0f3",
|
|
42
|
+
"@dxos/log": "0.8.4-main.72ec0f3",
|
|
43
|
+
"@dxos/random": "0.8.4-main.72ec0f3",
|
|
44
|
+
"@dxos/react-ui": "0.8.4-main.72ec0f3",
|
|
45
|
+
"@dxos/react-ui-theme": "0.8.4-main.72ec0f3",
|
|
46
|
+
"@dxos/echo-db": "0.8.4-main.72ec0f3",
|
|
47
|
+
"@dxos/storybook-utils": "0.8.4-main.72ec0f3"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"react": "
|
|
51
|
-
"react-dom": "
|
|
52
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
53
|
-
"@dxos/react-ui-theme": "0.8.4-main.
|
|
50
|
+
"react": "^19.0.0",
|
|
51
|
+
"react-dom": "^19.0.0",
|
|
52
|
+
"@dxos/react-ui": "0.8.4-main.72ec0f3",
|
|
53
|
+
"@dxos/react-ui-theme": "0.8.4-main.72ec0f3"
|
|
54
54
|
},
|
|
55
55
|
"publishConfig": {
|
|
56
56
|
"access": "public"
|
|
@@ -2,14 +2,12 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import '@dxos-theme';
|
|
6
|
-
|
|
7
5
|
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
8
6
|
import React, { useState } from 'react';
|
|
9
7
|
|
|
10
8
|
import { PublicKey } from '@dxos/keys';
|
|
9
|
+
import { withTheme } from '@dxos/react-ui/testing';
|
|
11
10
|
import { hoverableControls, hoverableFocusedWithinControls } from '@dxos/react-ui-theme';
|
|
12
|
-
import { withLayout, withTheme } from '@dxos/storybook-utils';
|
|
13
11
|
|
|
14
12
|
import { type MessageEntity, MessageStoryText } from '../testing';
|
|
15
13
|
import { Thread } from '../Thread';
|
|
@@ -41,8 +39,11 @@ const meta = {
|
|
|
41
39
|
title: 'ui/react-ui-thread/Message',
|
|
42
40
|
component: MessageRoot as any,
|
|
43
41
|
render: DefaultStory,
|
|
44
|
-
decorators: [withTheme
|
|
45
|
-
parameters: {
|
|
42
|
+
decorators: [withTheme],
|
|
43
|
+
parameters: {
|
|
44
|
+
layout: 'fullscreen',
|
|
45
|
+
translations,
|
|
46
|
+
},
|
|
46
47
|
} satisfies Meta<typeof DefaultStory>;
|
|
47
48
|
|
|
48
49
|
export default meta;
|
package/src/Message/Message.tsx
CHANGED
|
@@ -9,7 +9,7 @@ import React, { type ComponentPropsWithRef, type ComponentPropsWithoutRef, forwa
|
|
|
9
9
|
import { Avatar, type ThemedClassName, useTranslation } from '@dxos/react-ui';
|
|
10
10
|
import { type UseTextEditorProps, keymap, listener, useTextEditor } from '@dxos/react-ui-editor';
|
|
11
11
|
import { focusRing, mx } from '@dxos/react-ui-theme';
|
|
12
|
-
import { hexToEmoji, hexToHue,
|
|
12
|
+
import { hexToEmoji, hexToHue, isTruthy } from '@dxos/util';
|
|
13
13
|
|
|
14
14
|
import { translationKey } from '../translations';
|
|
15
15
|
import { type MessageMetadata } from '../types';
|
|
@@ -149,14 +149,14 @@ export const MessageTextbox = ({
|
|
|
149
149
|
extensions: [
|
|
150
150
|
keymap.of(keyBindings({ onSend, onClear })),
|
|
151
151
|
listener({
|
|
152
|
-
onFocus: (focusing) => {
|
|
152
|
+
onFocus: ({ focusing }) => {
|
|
153
153
|
if (focusing) {
|
|
154
154
|
onEditorFocus?.();
|
|
155
155
|
}
|
|
156
156
|
},
|
|
157
157
|
}),
|
|
158
158
|
extensions,
|
|
159
|
-
].filter(
|
|
159
|
+
].filter(isTruthy),
|
|
160
160
|
...editorProps,
|
|
161
161
|
}),
|
|
162
162
|
[id, extensions],
|
|
@@ -2,18 +2,17 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import '@dxos-theme';
|
|
6
|
-
|
|
7
5
|
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
8
6
|
import React, { type FC, useEffect, useMemo, useRef, useState } from 'react';
|
|
9
7
|
|
|
8
|
+
import { Expando } from '@dxos/echo/internal';
|
|
9
|
+
import { live } from '@dxos/echo/internal';
|
|
10
10
|
import { createDocAccessor, createObject } from '@dxos/echo-db';
|
|
11
|
-
import { Expando } from '@dxos/echo-schema';
|
|
12
11
|
import { PublicKey } from '@dxos/keys';
|
|
13
|
-
import { live } from '@dxos/live-object';
|
|
14
12
|
import { log } from '@dxos/log';
|
|
15
13
|
import { faker } from '@dxos/random';
|
|
16
|
-
import {
|
|
14
|
+
import { Icon, IconButton, useThemeContext } from '@dxos/react-ui';
|
|
15
|
+
import { withTheme } from '@dxos/react-ui/testing';
|
|
17
16
|
import {
|
|
18
17
|
type Comment,
|
|
19
18
|
type CommentsOptions,
|
|
@@ -28,7 +27,6 @@ import {
|
|
|
28
27
|
useTextEditor,
|
|
29
28
|
} from '@dxos/react-ui-editor';
|
|
30
29
|
import { hoverableControls, hoverableFocusedWithinControls } from '@dxos/react-ui-theme';
|
|
31
|
-
import { withTheme } from '@dxos/storybook-utils';
|
|
32
30
|
|
|
33
31
|
import { MessageBody, MessageHeading, MessageRoot, MessageTextbox } from '../Message';
|
|
34
32
|
import { type MessageEntity } from '../testing';
|
|
@@ -116,19 +114,21 @@ const StoryThread: FC<{
|
|
|
116
114
|
onSelect: () => void;
|
|
117
115
|
onResolve: () => void;
|
|
118
116
|
}> = ({ thread, selected, onSelect, onResolve }) => {
|
|
119
|
-
const containerRef = useRef<HTMLDivElement>(null);
|
|
120
117
|
const { themeMode } = useThemeContext();
|
|
118
|
+
const containerRef = useRef<HTMLDivElement>(null);
|
|
119
|
+
|
|
121
120
|
// TODO(wittjosiah): This is a hack to reset the editor after a message is sent.
|
|
122
|
-
const [
|
|
123
|
-
const rerenderEditor = () => _setCount((count) => count + 1);
|
|
121
|
+
const [state, setState] = useState({});
|
|
124
122
|
const messageRef = useRef('');
|
|
125
123
|
const extensions = useMemo(
|
|
126
124
|
() => [
|
|
127
125
|
createBasicExtensions({ placeholder: 'Enter comment' }),
|
|
128
126
|
createThemeExtensions({ themeMode }),
|
|
129
|
-
listener({
|
|
127
|
+
listener({
|
|
128
|
+
onChange: ({ text }) => (messageRef.current = text),
|
|
129
|
+
}),
|
|
130
130
|
],
|
|
131
|
-
[themeMode,
|
|
131
|
+
[themeMode, state],
|
|
132
132
|
);
|
|
133
133
|
|
|
134
134
|
const [autoFocus, setAutoFocus] = useState(false);
|
|
@@ -153,7 +153,7 @@ const StoryThread: FC<{
|
|
|
153
153
|
|
|
154
154
|
messageRef.current = '';
|
|
155
155
|
setAutoFocus(true);
|
|
156
|
-
|
|
156
|
+
setState({});
|
|
157
157
|
}
|
|
158
158
|
};
|
|
159
159
|
|
|
@@ -187,9 +187,14 @@ const StoryThread: FC<{
|
|
|
187
187
|
onSend={handleCreateMessage}
|
|
188
188
|
/>
|
|
189
189
|
<Thread.Status />
|
|
190
|
-
<
|
|
191
|
-
|
|
192
|
-
|
|
190
|
+
<IconButton
|
|
191
|
+
variant='ghost'
|
|
192
|
+
icon='ph--check--regular'
|
|
193
|
+
iconOnly
|
|
194
|
+
classNames='pli-1'
|
|
195
|
+
label='Resolve'
|
|
196
|
+
onClick={onResolve}
|
|
197
|
+
/>
|
|
193
198
|
</div>
|
|
194
199
|
</Thread.Root>
|
|
195
200
|
);
|
|
@@ -355,7 +360,10 @@ const meta = {
|
|
|
355
360
|
component: StoryThread as any,
|
|
356
361
|
render: DefaultStory,
|
|
357
362
|
decorators: [withTheme],
|
|
358
|
-
parameters: {
|
|
363
|
+
parameters: {
|
|
364
|
+
translations,
|
|
365
|
+
layout: 'fullscreen',
|
|
366
|
+
},
|
|
359
367
|
} satisfies Meta<typeof DefaultStory>;
|
|
360
368
|
|
|
361
369
|
export default meta;
|
|
@@ -2,16 +2,14 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import '@dxos-theme';
|
|
6
|
-
|
|
7
5
|
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
8
6
|
import React, { useMemo, useRef, useState } from 'react';
|
|
9
7
|
|
|
10
8
|
import { PublicKey } from '@dxos/keys';
|
|
11
9
|
import { faker } from '@dxos/random';
|
|
10
|
+
import { withTheme } from '@dxos/react-ui/testing';
|
|
12
11
|
import { createBasicExtensions, createThemeExtensions } from '@dxos/react-ui-editor';
|
|
13
12
|
import { hoverableControls, hoverableFocusedWithinControls } from '@dxos/react-ui-theme';
|
|
14
|
-
import { withLayout, withTheme } from '@dxos/storybook-utils';
|
|
15
13
|
|
|
16
14
|
import { MessageRoot, MessageTextbox } from '../Message';
|
|
17
15
|
import { type MessageEntity, MessageStoryText } from '../testing';
|
|
@@ -87,8 +85,11 @@ const meta = {
|
|
|
87
85
|
title: 'ui/react-ui-thread/Thread',
|
|
88
86
|
component: Thread.Root,
|
|
89
87
|
render: DefaultStory,
|
|
90
|
-
decorators: [withTheme
|
|
91
|
-
parameters: {
|
|
88
|
+
decorators: [withTheme],
|
|
89
|
+
parameters: {
|
|
90
|
+
layout: 'fullscreen',
|
|
91
|
+
translations,
|
|
92
|
+
},
|
|
92
93
|
} satisfies Meta<typeof Thread.Root>;
|
|
93
94
|
|
|
94
95
|
export default meta;
|
package/src/Thread/Thread.tsx
CHANGED
|
@@ -45,10 +45,10 @@ const ThreadRoot = forwardRef<HTMLDivElement, ThreadRootProps>(
|
|
|
45
45
|
// Heading
|
|
46
46
|
//
|
|
47
47
|
|
|
48
|
-
type ThreadHeaderProps =
|
|
48
|
+
type ThreadHeaderProps = ComponentPropsWithRef<'div'> & { detached?: boolean };
|
|
49
49
|
|
|
50
50
|
const ThreadHeader = forwardRef<HTMLParagraphElement, ThreadHeaderProps>(
|
|
51
|
-
({
|
|
51
|
+
({ children, detached, ...props }, forwardedRef) => {
|
|
52
52
|
return (
|
|
53
53
|
<>
|
|
54
54
|
<div role='none' className='flex items-center justify-center text-description'>
|
package/src/testing.tsx
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { IconButton } from '@dxos/react-ui';
|
|
8
8
|
import { hoverableControlItem, hoverableControls, hoverableFocusedWithinControls, mx } from '@dxos/react-ui-theme';
|
|
9
9
|
|
|
10
10
|
import { MessageBody, MessageHeading } from './Message';
|
|
@@ -25,13 +25,14 @@ export const MessageStoryText = ({ text, onDelete, authorName, timestamp }: Mess
|
|
|
25
25
|
<>
|
|
26
26
|
<MessageHeading authorName={authorName} timestamp={timestamp}>
|
|
27
27
|
{onDelete && (
|
|
28
|
-
<
|
|
28
|
+
<IconButton
|
|
29
|
+
icon='ph--x--regular'
|
|
30
|
+
iconOnly
|
|
31
|
+
label='Delete'
|
|
29
32
|
variant='ghost'
|
|
30
33
|
classNames={['p-1.5 min-bs-0 mie-1 items-start transition-opacity', hoverableControlItem]}
|
|
31
34
|
onClick={() => onDelete()}
|
|
32
|
-
|
|
33
|
-
<Icon icon='ph--x--regular' />
|
|
34
|
-
</Button>
|
|
35
|
+
/>
|
|
35
36
|
)}
|
|
36
37
|
</MessageHeading>
|
|
37
38
|
<MessageBody>{text}</MessageBody>
|