@dxos/react-ui-chat 0.8.4-main.3c1ae3b → 0.8.4-main.3eb6e50203
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 +95 -123
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +95 -123
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/components/ChatDialog/ChatDialog.d.ts +1 -1
- package/dist/types/src/components/ChatDialog/ChatDialog.d.ts.map +1 -1
- package/dist/types/src/components/ChatDialog/ChatDialog.stories.d.ts +2 -2
- package/dist/types/src/components/ChatEditor/ChatEditor.d.ts +3 -2
- package/dist/types/src/components/ChatEditor/ChatEditor.d.ts.map +1 -1
- package/dist/types/src/components/ChatEditor/ChatEditor.stories.d.ts +3 -3
- 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 +36 -34
- package/src/components/ChatDialog/ChatDialog.stories.tsx +1 -1
- package/src/components/ChatDialog/ChatDialog.tsx +17 -11
- package/src/components/ChatEditor/ChatEditor.stories.tsx +1 -1
- package/src/components/ChatEditor/ChatEditor.tsx +4 -6
- package/src/translations.ts +1 -1
package/package.json
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/react-ui-chat",
|
|
3
|
-
"version": "0.8.4-main.
|
|
3
|
+
"version": "0.8.4-main.3eb6e50203",
|
|
4
4
|
"description": "Chat components.",
|
|
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
13
|
"type": "module",
|
|
@@ -29,46 +33,44 @@
|
|
|
29
33
|
"@codemirror/search": "^6.5.11",
|
|
30
34
|
"@codemirror/state": "^6.5.2",
|
|
31
35
|
"@codemirror/view": "^6.38.4",
|
|
32
|
-
"@fluentui/react-tabster": "
|
|
33
|
-
"@preact-signals/safe-react": "^0.9.0",
|
|
34
|
-
"@preact/signals-core": "^1.12.1",
|
|
36
|
+
"@fluentui/react-tabster": "9.26.11",
|
|
35
37
|
"@radix-ui/react-accordion": "1.2.3",
|
|
36
38
|
"@radix-ui/react-context": "1.1.1",
|
|
37
|
-
"@dxos/
|
|
38
|
-
"@dxos/
|
|
39
|
-
"@dxos/echo": "0.8.4-main.
|
|
40
|
-
"@dxos/log": "0.8.4-main.
|
|
41
|
-
"@dxos/
|
|
42
|
-
"@dxos/
|
|
43
|
-
"@dxos/react-ui-components": "0.8.4-main.
|
|
44
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
45
|
-
"@dxos/react-ui-
|
|
46
|
-
"@dxos/react-ui-sfx": "0.8.4-main.
|
|
47
|
-
"@dxos/react-ui-
|
|
48
|
-
"@dxos/react-ui-
|
|
49
|
-
"@dxos/
|
|
50
|
-
"@dxos/
|
|
51
|
-
"@dxos/
|
|
52
|
-
"@dxos/
|
|
39
|
+
"@dxos/async": "0.8.4-main.3eb6e50203",
|
|
40
|
+
"@dxos/debug": "0.8.4-main.3eb6e50203",
|
|
41
|
+
"@dxos/echo": "0.8.4-main.3eb6e50203",
|
|
42
|
+
"@dxos/log": "0.8.4-main.3eb6e50203",
|
|
43
|
+
"@dxos/react-ui": "0.8.4-main.3eb6e50203",
|
|
44
|
+
"@dxos/invariant": "0.8.4-main.3eb6e50203",
|
|
45
|
+
"@dxos/react-ui-components": "0.8.4-main.3eb6e50203",
|
|
46
|
+
"@dxos/react-ui-dnd": "0.8.4-main.3eb6e50203",
|
|
47
|
+
"@dxos/react-ui-editor": "0.8.4-main.3eb6e50203",
|
|
48
|
+
"@dxos/react-ui-sfx": "0.8.4-main.3eb6e50203",
|
|
49
|
+
"@dxos/react-ui-syntax-highlighter": "0.8.4-main.3eb6e50203",
|
|
50
|
+
"@dxos/react-ui-text-tooltip": "0.8.4-main.3eb6e50203",
|
|
51
|
+
"@dxos/ui-editor": "0.8.4-main.3eb6e50203",
|
|
52
|
+
"@dxos/ui-types": "0.8.4-main.3eb6e50203",
|
|
53
|
+
"@dxos/util": "0.8.4-main.3eb6e50203",
|
|
54
|
+
"@dxos/ui-theme": "0.8.4-main.3eb6e50203"
|
|
53
55
|
},
|
|
54
56
|
"devDependencies": {
|
|
55
|
-
"@types/react": "~19.2.
|
|
56
|
-
"@types/react-dom": "~19.2.
|
|
57
|
-
"effect": "3.
|
|
58
|
-
"react": "~19.2.
|
|
59
|
-
"react-dom": "~19.2.
|
|
57
|
+
"@types/react": "~19.2.7",
|
|
58
|
+
"@types/react-dom": "~19.2.3",
|
|
59
|
+
"effect": "3.19.16",
|
|
60
|
+
"react": "~19.2.3",
|
|
61
|
+
"react-dom": "~19.2.3",
|
|
60
62
|
"vite": "7.1.9",
|
|
61
|
-
"@dxos/
|
|
62
|
-
"@dxos/
|
|
63
|
-
"@dxos/react-client": "0.8.4-main.
|
|
64
|
-
"@dxos/storybook-utils": "0.8.4-main.
|
|
63
|
+
"@dxos/random": "0.8.4-main.3eb6e50203",
|
|
64
|
+
"@dxos/echo": "0.8.4-main.3eb6e50203",
|
|
65
|
+
"@dxos/react-client": "0.8.4-main.3eb6e50203",
|
|
66
|
+
"@dxos/storybook-utils": "0.8.4-main.3eb6e50203"
|
|
65
67
|
},
|
|
66
68
|
"peerDependencies": {
|
|
67
|
-
"effect": "
|
|
68
|
-
"react": "
|
|
69
|
-
"react-dom": "
|
|
70
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
71
|
-
"@dxos/
|
|
69
|
+
"effect": "3.19.16",
|
|
70
|
+
"react": "~19.2.3",
|
|
71
|
+
"react-dom": "~19.2.3",
|
|
72
|
+
"@dxos/react-ui": "0.8.4-main.3eb6e50203",
|
|
73
|
+
"@dxos/ui-theme": "0.8.4-main.3eb6e50203"
|
|
72
74
|
},
|
|
73
75
|
"publishConfig": {
|
|
74
76
|
"access": "public"
|
|
@@ -7,7 +7,7 @@ import React, { type Dispatch, type PropsWithChildren, type SetStateAction, useE
|
|
|
7
7
|
|
|
8
8
|
import { Dialog, Icon, IconButton, type ThemedClassName, useControlledState } from '@dxos/react-ui';
|
|
9
9
|
import { ResizeHandle, type Size, resizeAttributes, sizeStyle } from '@dxos/react-ui-dnd';
|
|
10
|
-
import { mx } from '@dxos/
|
|
10
|
+
import { mx } from '@dxos/ui-theme';
|
|
11
11
|
|
|
12
12
|
const preventDefault = (event: Event) => event.preventDefault();
|
|
13
13
|
|
|
@@ -47,15 +47,15 @@ type ChatDialogRootProps = PropsWithChildren<{
|
|
|
47
47
|
|
|
48
48
|
const ChatDialogRoot = ({
|
|
49
49
|
children,
|
|
50
|
-
open:
|
|
51
|
-
expanded:
|
|
50
|
+
open: openProp = false,
|
|
51
|
+
expanded: expandedProp = false,
|
|
52
52
|
onOpenChange,
|
|
53
53
|
onExpandedChange,
|
|
54
54
|
onEscape,
|
|
55
55
|
}: ChatDialogRootProps) => {
|
|
56
56
|
const [size, setSize] = useState<Size>('min-content');
|
|
57
|
-
const [open, setOpen] = useControlledState<boolean>(
|
|
58
|
-
const [expanded, setExpanded] = useControlledState<boolean>(
|
|
57
|
+
const [open, setOpen] = useControlledState<boolean>(openProp, onOpenChange);
|
|
58
|
+
const [expanded, setExpanded] = useControlledState<boolean>(expandedProp, onExpandedChange);
|
|
59
59
|
|
|
60
60
|
// NOTE: We set the min size to 5rem (80px), and the header and prompt bar to 40px (i.e., the rail-size) each.
|
|
61
61
|
// The dialog has no vertical padding and has box-content so that when closed it collapses to the size of the header and prompt bar.
|
|
@@ -93,12 +93,14 @@ ChatDialogRoot.displayName = 'ChatDialog.Root';
|
|
|
93
93
|
// Header
|
|
94
94
|
//
|
|
95
95
|
|
|
96
|
+
const CHAT_DIALOG_HEADER_NAME = 'ChatDialog.Header';
|
|
97
|
+
|
|
96
98
|
type ChatDialogHeaderProps = ThemedClassName<{
|
|
97
99
|
title?: string;
|
|
98
100
|
}>;
|
|
99
101
|
|
|
100
102
|
const ChatDialogHeader = ({ classNames, title }: ChatDialogHeaderProps) => {
|
|
101
|
-
const { expanded, setExpanded } = useChatDialogContext(
|
|
103
|
+
const { expanded, setExpanded } = useChatDialogContext(CHAT_DIALOG_HEADER_NAME);
|
|
102
104
|
|
|
103
105
|
return (
|
|
104
106
|
<div className={mx('grid grid-cols-[var(--rail-action)_1fr_min-content] items-center overflow-hidden', classNames)}>
|
|
@@ -127,16 +129,18 @@ const ChatDialogHeader = ({ classNames, title }: ChatDialogHeaderProps) => {
|
|
|
127
129
|
);
|
|
128
130
|
};
|
|
129
131
|
|
|
130
|
-
ChatDialogHeader.displayName =
|
|
132
|
+
ChatDialogHeader.displayName = CHAT_DIALOG_HEADER_NAME;
|
|
131
133
|
|
|
132
134
|
//
|
|
133
135
|
// Content
|
|
134
136
|
//
|
|
135
137
|
|
|
138
|
+
const CHAT_DIALOG_CONTENT_NAME = 'ChatDialog.Content';
|
|
139
|
+
|
|
136
140
|
type ChatDialogContentProps = ThemedClassName<PropsWithChildren>;
|
|
137
141
|
|
|
138
142
|
const ChatDialogContent = ({ children, classNames }: ChatDialogContentProps) => {
|
|
139
|
-
const { expanded, size, setSize } = useChatDialogContext(
|
|
143
|
+
const { expanded, size, setSize } = useChatDialogContext(CHAT_DIALOG_CONTENT_NAME);
|
|
140
144
|
useEffect(() => {
|
|
141
145
|
setSize(expanded ? 'min-content' : 0);
|
|
142
146
|
}, [expanded]);
|
|
@@ -144,7 +148,7 @@ const ChatDialogContent = ({ children, classNames }: ChatDialogContentProps) =>
|
|
|
144
148
|
return (
|
|
145
149
|
<div
|
|
146
150
|
className={mx(
|
|
147
|
-
'
|
|
151
|
+
'border-bs border-be border-subduedSeparator',
|
|
148
152
|
'transition-[block-size] ease-in-out duration-0 [&:not([data-dx-resizing="true"])]:duration-200',
|
|
149
153
|
classNames,
|
|
150
154
|
)}
|
|
@@ -167,19 +171,21 @@ const ChatDialogContent = ({ children, classNames }: ChatDialogContentProps) =>
|
|
|
167
171
|
);
|
|
168
172
|
};
|
|
169
173
|
|
|
170
|
-
ChatDialogContent.displayName =
|
|
174
|
+
ChatDialogContent.displayName = CHAT_DIALOG_CONTENT_NAME;
|
|
171
175
|
|
|
172
176
|
//
|
|
173
177
|
// Footer
|
|
174
178
|
//
|
|
175
179
|
|
|
180
|
+
const CHAT_DIALOG_FOOTER_NAME = 'ChatDialog.Footer';
|
|
181
|
+
|
|
176
182
|
type ChatDialogFooterProps = ThemedClassName<PropsWithChildren>;
|
|
177
183
|
|
|
178
184
|
const ChatDialogFooter = ({ children, classNames }: ChatDialogFooterProps) => {
|
|
179
185
|
return <div className={mx(classNames)}>{children}</div>;
|
|
180
186
|
};
|
|
181
187
|
|
|
182
|
-
ChatDialogFooter.displayName =
|
|
188
|
+
ChatDialogFooter.displayName = CHAT_DIALOG_FOOTER_NAME;
|
|
183
189
|
|
|
184
190
|
//
|
|
185
191
|
// ChatDialog
|
|
@@ -6,16 +6,14 @@ import { type Extension } from '@codemirror/state';
|
|
|
6
6
|
import React, { forwardRef, useMemo } from 'react';
|
|
7
7
|
|
|
8
8
|
import { type ThemedClassName, useThemeContext } from '@dxos/react-ui';
|
|
9
|
+
import { Editor, type EditorController, type UseTextEditorProps } from '@dxos/react-ui-editor';
|
|
9
10
|
import {
|
|
10
11
|
type BasicExtensionsOptions,
|
|
11
|
-
Editor,
|
|
12
|
-
type EditorController,
|
|
13
12
|
type SubmitOptions,
|
|
14
|
-
type UseTextEditorProps,
|
|
15
13
|
createBasicExtensions,
|
|
16
14
|
createThemeExtensions,
|
|
17
15
|
submit,
|
|
18
|
-
} from '@dxos/
|
|
16
|
+
} from '@dxos/ui-editor';
|
|
19
17
|
import { isTruthy } from '@dxos/util';
|
|
20
18
|
|
|
21
19
|
import { type ReferencesOptions } from './references';
|
|
@@ -46,8 +44,8 @@ export const useChatExtensions = ({ extensions, lineWrapping = false, placeholde
|
|
|
46
44
|
};
|
|
47
45
|
|
|
48
46
|
export const ChatEditor = forwardRef<ChatEditorController, ChatEditorProps>(
|
|
49
|
-
({ classNames, autoFocus, extensions:
|
|
50
|
-
const extensions = useChatExtensions({ extensions:
|
|
47
|
+
({ classNames, autoFocus, extensions: extensionsProp, lineWrapping = false, placeholder, onSubmit }, forwardRef) => {
|
|
48
|
+
const extensions = useChatExtensions({ extensions: extensionsProp, lineWrapping, placeholder, onSubmit });
|
|
51
49
|
|
|
52
50
|
// TODO(burdon): Popover.
|
|
53
51
|
return (
|