@dxos/react-ui-thread 0.8.4-main.e098934 → 0.8.4-main.e8ec1fe

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxos/react-ui-thread",
3
- "version": "0.8.4-main.e098934",
3
+ "version": "0.8.4-main.e8ec1fe",
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.e098934",
31
- "@dxos/util": "0.8.4-main.e098934"
30
+ "@dxos/react-ui-editor": "0.8.4-main.e8ec1fe",
31
+ "@dxos/util": "0.8.4-main.e8ec1fe"
32
32
  },
33
33
  "devDependencies": {
34
- "@types/react": "~18.2.0",
35
- "@types/react-dom": "~18.2.0",
36
- "react": "~18.2.0",
37
- "react-dom": "~18.2.0",
38
- "vite": "7.1.1",
39
- "@dxos/echo-db": "0.8.4-main.e098934",
40
- "@dxos/echo-schema": "0.8.4-main.e098934",
41
- "@dxos/keys": "0.8.4-main.e098934",
42
- "@dxos/log": "0.8.4-main.e098934",
43
- "@dxos/random": "0.8.4-main.e098934",
44
- "@dxos/live-object": "0.8.4-main.e098934",
45
- "@dxos/react-ui": "0.8.4-main.e098934",
46
- "@dxos/react-ui-theme": "0.8.4-main.e098934",
47
- "@dxos/storybook-utils": "0.8.4-main.e098934"
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.e8ec1fe",
40
+ "@dxos/echo-db": "0.8.4-main.e8ec1fe",
41
+ "@dxos/keys": "0.8.4-main.e8ec1fe",
42
+ "@dxos/log": "0.8.4-main.e8ec1fe",
43
+ "@dxos/live-object": "0.8.4-main.e8ec1fe",
44
+ "@dxos/react-ui": "0.8.4-main.e8ec1fe",
45
+ "@dxos/storybook-utils": "0.8.4-main.e8ec1fe",
46
+ "@dxos/react-ui-theme": "0.8.4-main.e8ec1fe",
47
+ "@dxos/random": "0.8.4-main.e8ec1fe"
48
48
  },
49
49
  "peerDependencies": {
50
- "react": "~18.2.0",
51
- "react-dom": "~18.2.0",
52
- "@dxos/react-ui": "0.8.4-main.e098934",
53
- "@dxos/react-ui-theme": "0.8.4-main.e098934"
50
+ "react": "^19.0.0",
51
+ "react-dom": "^19.0.0",
52
+ "@dxos/react-ui": "0.8.4-main.e8ec1fe",
53
+ "@dxos/react-ui-theme": "0.8.4-main.e8ec1fe"
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, withLayout({ fullscreen: true })],
45
- parameters: { translations },
42
+ decorators: [withTheme],
43
+ parameters: {
44
+ layout: 'fullscreen',
45
+ translations,
46
+ },
46
47
  } satisfies Meta<typeof DefaultStory>;
47
48
 
48
49
  export default meta;
@@ -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, isNotFalsy } from '@dxos/util';
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(isNotFalsy),
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 { Button, Icon, useThemeContext } from '@dxos/react-ui';
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 [_count, _setCount] = useState(0);
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({ onChange: (text) => (messageRef.current = text) }),
127
+ listener({
128
+ onChange: ({ text }) => (messageRef.current = text),
129
+ }),
130
130
  ],
131
- [themeMode, _count],
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
- rerenderEditor();
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
- <Button variant='ghost' classNames='px-1' title='Resolve' onClick={onResolve}>
191
- <Icon icon='ph--check--regular' />
192
- </Button>
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: { translations, layout: 'fullscreen' },
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, withLayout({ fullscreen: true })],
91
- parameters: { translations },
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;
@@ -45,10 +45,10 @@ const ThreadRoot = forwardRef<HTMLDivElement, ThreadRootProps>(
45
45
  // Heading
46
46
  //
47
47
 
48
- type ThreadHeaderProps = ThemedClassName<ComponentPropsWithRef<'div'>> & { detached?: boolean };
48
+ type ThreadHeaderProps = ComponentPropsWithRef<'div'> & { detached?: boolean };
49
49
 
50
50
  const ThreadHeader = forwardRef<HTMLParagraphElement, ThreadHeaderProps>(
51
- ({ classNames, children, detached, ...props }, forwardedRef) => {
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 { Button, Icon } from '@dxos/react-ui';
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
- <Button
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>