@assistant-ui/react 0.11.53 → 0.11.55
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/README.md +6 -3
- package/dist/client/NoOpComposerClient.d.ts +1 -1
- package/dist/client/NoOpComposerClient.d.ts.map +1 -1
- package/dist/client/NoOpComposerClient.js +7 -0
- package/dist/client/NoOpComposerClient.js.map +1 -1
- package/dist/client/types/Composer.d.ts +18 -3
- package/dist/client/types/Composer.d.ts.map +1 -1
- package/dist/client/types/Message.d.ts +17 -3
- package/dist/client/types/Message.d.ts.map +1 -1
- package/dist/legacy-runtime/client/ComposerRuntimeClient.d.ts.map +1 -1
- package/dist/legacy-runtime/client/ComposerRuntimeClient.js +3 -0
- package/dist/legacy-runtime/client/ComposerRuntimeClient.js.map +1 -1
- package/dist/legacy-runtime/hooks/AssistantContext.d.ts +2 -2
- package/dist/legacy-runtime/hooks/AssistantContext.js +1 -1
- package/dist/legacy-runtime/hooks/AttachmentContext.d.ts +2 -2
- package/dist/legacy-runtime/hooks/AttachmentContext.js +1 -1
- package/dist/legacy-runtime/hooks/ComposerContext.d.ts +2 -2
- package/dist/legacy-runtime/hooks/ComposerContext.js +1 -1
- package/dist/legacy-runtime/hooks/MessageContext.d.ts +3 -3
- package/dist/legacy-runtime/hooks/MessageContext.js +2 -2
- package/dist/legacy-runtime/hooks/MessagePartContext.d.ts +2 -2
- package/dist/legacy-runtime/hooks/MessagePartContext.js +1 -1
- package/dist/legacy-runtime/hooks/ThreadContext.d.ts +4 -4
- package/dist/legacy-runtime/hooks/ThreadContext.js +2 -2
- package/dist/legacy-runtime/hooks/ThreadListItemContext.d.ts +2 -2
- package/dist/legacy-runtime/hooks/ThreadListItemContext.js +1 -1
- package/dist/legacy-runtime/runtime/ComposerRuntime.d.ts +22 -6
- package/dist/legacy-runtime/runtime/ComposerRuntime.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime/ComposerRuntime.js +18 -2
- package/dist/legacy-runtime/runtime/ComposerRuntime.js.map +1 -1
- package/dist/legacy-runtime/runtime/ThreadRuntime.d.ts +3 -0
- package/dist/legacy-runtime/runtime/ThreadRuntime.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/adapters/speech/SpeechAdapterTypes.d.ts +25 -3
- package/dist/legacy-runtime/runtime-cores/adapters/speech/SpeechAdapterTypes.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/adapters/speech/WebSpeechDictationAdapter.d.ts +61 -0
- package/dist/legacy-runtime/runtime-cores/adapters/speech/WebSpeechDictationAdapter.d.ts.map +1 -0
- package/dist/legacy-runtime/runtime-cores/adapters/speech/WebSpeechDictationAdapter.js +152 -0
- package/dist/legacy-runtime/runtime-cores/adapters/speech/WebSpeechDictationAdapter.js.map +1 -0
- package/dist/legacy-runtime/runtime-cores/adapters/speech/index.d.ts +2 -1
- package/dist/legacy-runtime/runtime-cores/adapters/speech/index.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/adapters/speech/index.js +1 -0
- package/dist/legacy-runtime/runtime-cores/adapters/speech/index.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/assistant-transport/types.d.ts +1 -1
- package/dist/legacy-runtime/runtime-cores/assistant-transport/types.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/assistant-transport/useAssistantTransportRuntime.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/assistant-transport/useAssistantTransportRuntime.js +4 -1
- package/dist/legacy-runtime/runtime-cores/assistant-transport/useAssistantTransportRuntime.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/composer/BaseComposerRuntimeCore.d.ts +20 -5
- package/dist/legacy-runtime/runtime-cores/composer/BaseComposerRuntimeCore.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/composer/BaseComposerRuntimeCore.js +140 -0
- package/dist/legacy-runtime/runtime-cores/composer/BaseComposerRuntimeCore.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/composer/DefaultEditComposerRuntimeCore.d.ts +6 -3
- package/dist/legacy-runtime/runtime-cores/composer/DefaultEditComposerRuntimeCore.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/composer/DefaultEditComposerRuntimeCore.js +3 -0
- package/dist/legacy-runtime/runtime-cores/composer/DefaultEditComposerRuntimeCore.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/composer/DefaultThreadComposerRuntimeCore.d.ts +7 -4
- package/dist/legacy-runtime/runtime-cores/composer/DefaultThreadComposerRuntimeCore.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/composer/DefaultThreadComposerRuntimeCore.js +3 -0
- package/dist/legacy-runtime/runtime-cores/composer/DefaultThreadComposerRuntimeCore.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/core/ComposerRuntimeCore.d.ts +35 -1
- package/dist/legacy-runtime/runtime-cores/core/ComposerRuntimeCore.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/core/ThreadRuntimeCore.d.ts +1 -0
- package/dist/legacy-runtime/runtime-cores/core/ThreadRuntimeCore.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/core/index.d.ts +1 -0
- package/dist/legacy-runtime/runtime-cores/core/index.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/external-store/ExternalStoreAdapter.d.ts +8 -7
- package/dist/legacy-runtime/runtime-cores/external-store/ExternalStoreAdapter.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/external-store/ExternalStoreThreadRuntimeCore.d.ts +7 -6
- package/dist/legacy-runtime/runtime-cores/external-store/ExternalStoreThreadRuntimeCore.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/external-store/ExternalStoreThreadRuntimeCore.js +4 -2
- package/dist/legacy-runtime/runtime-cores/external-store/ExternalStoreThreadRuntimeCore.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/local/LocalRuntimeOptions.d.ts +10 -8
- package/dist/legacy-runtime/runtime-cores/local/LocalRuntimeOptions.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/local/LocalRuntimeOptions.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/local/LocalThreadRuntimeCore.d.ts +5 -3
- package/dist/legacy-runtime/runtime-cores/local/LocalThreadRuntimeCore.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/local/LocalThreadRuntimeCore.js +6 -0
- package/dist/legacy-runtime/runtime-cores/local/LocalThreadRuntimeCore.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/EMPTY_THREAD_CORE.d.ts +1 -1
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/EMPTY_THREAD_CORE.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/EMPTY_THREAD_CORE.js +8 -0
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/EMPTY_THREAD_CORE.js.map +1 -1
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/adapter/cloud.d.ts.map +1 -1
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/adapter/cloud.js +8 -1
- package/dist/legacy-runtime/runtime-cores/remote-thread-list/adapter/cloud.js.map +1 -1
- package/dist/primitives/actionBarMore/ActionBarMoreContent.d.ts +12 -0
- package/dist/primitives/actionBarMore/ActionBarMoreContent.d.ts.map +1 -0
- package/dist/primitives/actionBarMore/ActionBarMoreContent.js +11 -0
- package/dist/primitives/actionBarMore/ActionBarMoreContent.js.map +1 -0
- package/dist/primitives/actionBarMore/ActionBarMoreItem.d.ts +8 -0
- package/dist/primitives/actionBarMore/ActionBarMoreItem.d.ts.map +1 -0
- package/dist/primitives/actionBarMore/ActionBarMoreItem.js +11 -0
- package/dist/primitives/actionBarMore/ActionBarMoreItem.js.map +1 -0
- package/dist/primitives/actionBarMore/ActionBarMoreRoot.d.ts +7 -0
- package/dist/primitives/actionBarMore/ActionBarMoreRoot.d.ts.map +1 -0
- package/dist/primitives/actionBarMore/ActionBarMoreRoot.js +10 -0
- package/dist/primitives/actionBarMore/ActionBarMoreRoot.js.map +1 -0
- package/dist/primitives/actionBarMore/ActionBarMoreSeparator.d.ts +8 -0
- package/dist/primitives/actionBarMore/ActionBarMoreSeparator.d.ts.map +1 -0
- package/dist/primitives/actionBarMore/ActionBarMoreSeparator.js +12 -0
- package/dist/primitives/actionBarMore/ActionBarMoreSeparator.js.map +1 -0
- package/dist/primitives/actionBarMore/ActionBarMoreTrigger.d.ts +8 -0
- package/dist/primitives/actionBarMore/ActionBarMoreTrigger.d.ts.map +1 -0
- package/dist/primitives/actionBarMore/ActionBarMoreTrigger.js +11 -0
- package/dist/primitives/actionBarMore/ActionBarMoreTrigger.js.map +1 -0
- package/dist/primitives/actionBarMore/index.d.ts +6 -0
- package/dist/primitives/actionBarMore/index.d.ts.map +1 -0
- package/dist/primitives/actionBarMore/index.js +6 -0
- package/dist/primitives/actionBarMore/index.js.map +1 -0
- package/dist/primitives/actionBarMore/scope.d.ts +7 -0
- package/dist/primitives/actionBarMore/scope.d.ts.map +1 -0
- package/dist/primitives/actionBarMore/scope.js +3 -0
- package/dist/primitives/actionBarMore/scope.js.map +1 -0
- package/dist/primitives/composer/ComposerDictate.d.ts +23 -0
- package/dist/primitives/composer/ComposerDictate.d.ts.map +1 -0
- package/dist/primitives/composer/ComposerDictate.js +30 -0
- package/dist/primitives/composer/ComposerDictate.js.map +1 -0
- package/dist/primitives/composer/ComposerDictationTranscript.d.ts +25 -0
- package/dist/primitives/composer/ComposerDictationTranscript.d.ts.map +1 -0
- package/dist/primitives/composer/ComposerDictationTranscript.js +29 -0
- package/dist/primitives/composer/ComposerDictationTranscript.js.map +1 -0
- package/dist/primitives/composer/ComposerIf.d.ts +3 -0
- package/dist/primitives/composer/ComposerIf.d.ts.map +1 -1
- package/dist/primitives/composer/ComposerIf.js +5 -0
- package/dist/primitives/composer/ComposerIf.js.map +1 -1
- package/dist/primitives/composer/ComposerInput.d.ts.map +1 -1
- package/dist/primitives/composer/ComposerInput.js +1 -1
- package/dist/primitives/composer/ComposerInput.js.map +1 -1
- package/dist/primitives/composer/ComposerStopDictation.d.ts +23 -0
- package/dist/primitives/composer/ComposerStopDictation.d.ts.map +1 -0
- package/dist/primitives/composer/ComposerStopDictation.js +28 -0
- package/dist/primitives/composer/ComposerStopDictation.js.map +1 -0
- package/dist/primitives/composer/index.d.ts +3 -0
- package/dist/primitives/composer/index.d.ts.map +1 -1
- package/dist/primitives/composer/index.js +3 -0
- package/dist/primitives/composer/index.js.map +1 -1
- package/dist/primitives/index.d.ts +2 -0
- package/dist/primitives/index.d.ts.map +1 -1
- package/dist/primitives/index.js +2 -0
- package/dist/primitives/index.js.map +1 -1
- package/dist/primitives/threadListItemMore/ThreadListItemMoreContent.d.ts +12 -0
- package/dist/primitives/threadListItemMore/ThreadListItemMoreContent.d.ts.map +1 -0
- package/dist/primitives/threadListItemMore/ThreadListItemMoreContent.js +12 -0
- package/dist/primitives/threadListItemMore/ThreadListItemMoreContent.js.map +1 -0
- package/dist/primitives/threadListItemMore/ThreadListItemMoreItem.d.ts +8 -0
- package/dist/primitives/threadListItemMore/ThreadListItemMoreItem.d.ts.map +1 -0
- package/dist/primitives/threadListItemMore/ThreadListItemMoreItem.js +12 -0
- package/dist/primitives/threadListItemMore/ThreadListItemMoreItem.js.map +1 -0
- package/dist/primitives/threadListItemMore/ThreadListItemMoreRoot.d.ts +7 -0
- package/dist/primitives/threadListItemMore/ThreadListItemMoreRoot.d.ts.map +1 -0
- package/dist/primitives/threadListItemMore/ThreadListItemMoreRoot.js +11 -0
- package/dist/primitives/threadListItemMore/ThreadListItemMoreRoot.js.map +1 -0
- package/dist/primitives/threadListItemMore/ThreadListItemMoreSeparator.d.ts +8 -0
- package/dist/primitives/threadListItemMore/ThreadListItemMoreSeparator.d.ts.map +1 -0
- package/dist/primitives/threadListItemMore/ThreadListItemMoreSeparator.js +12 -0
- package/dist/primitives/threadListItemMore/ThreadListItemMoreSeparator.js.map +1 -0
- package/dist/primitives/threadListItemMore/ThreadListItemMoreTrigger.d.ts +8 -0
- package/dist/primitives/threadListItemMore/ThreadListItemMoreTrigger.d.ts.map +1 -0
- package/dist/primitives/threadListItemMore/ThreadListItemMoreTrigger.js +12 -0
- package/dist/primitives/threadListItemMore/ThreadListItemMoreTrigger.js.map +1 -0
- package/dist/primitives/threadListItemMore/index.d.ts +6 -0
- package/dist/primitives/threadListItemMore/index.d.ts.map +1 -0
- package/dist/primitives/threadListItemMore/index.js +6 -0
- package/dist/primitives/threadListItemMore/index.js.map +1 -0
- package/dist/primitives/threadListItemMore/scope.d.ts +7 -0
- package/dist/primitives/threadListItemMore/scope.d.ts.map +1 -0
- package/dist/primitives/threadListItemMore/scope.js +3 -0
- package/dist/primitives/threadListItemMore/scope.js.map +1 -0
- package/package.json +6 -5
- package/src/client/NoOpComposerClient.tsx +8 -1
- package/src/client/types/Composer.ts +21 -4
- package/src/client/types/Message.ts +17 -3
- package/src/legacy-runtime/client/ComposerRuntimeClient.ts +4 -0
- package/src/legacy-runtime/hooks/AssistantContext.ts +2 -2
- package/src/legacy-runtime/hooks/AttachmentContext.ts +2 -2
- package/src/legacy-runtime/hooks/ComposerContext.ts +2 -2
- package/src/legacy-runtime/hooks/MessageContext.ts +3 -3
- package/src/legacy-runtime/hooks/MessagePartContext.ts +2 -2
- package/src/legacy-runtime/hooks/ThreadContext.ts +4 -4
- package/src/legacy-runtime/hooks/ThreadListItemContext.ts +2 -2
- package/src/legacy-runtime/runtime/ComposerRuntime.ts +51 -14
- package/src/legacy-runtime/runtime-cores/adapters/speech/SpeechAdapterTypes.ts +26 -3
- package/src/legacy-runtime/runtime-cores/adapters/speech/WebSpeechDictationAdapter.ts +255 -0
- package/src/legacy-runtime/runtime-cores/adapters/speech/index.ts +5 -1
- package/src/legacy-runtime/runtime-cores/assistant-transport/types.ts +1 -1
- package/src/legacy-runtime/runtime-cores/assistant-transport/useAssistantTransportRuntime.tsx +5 -1
- package/src/legacy-runtime/runtime-cores/composer/BaseComposerRuntimeCore.tsx +171 -5
- package/src/legacy-runtime/runtime-cores/composer/DefaultEditComposerRuntimeCore.tsx +14 -4
- package/src/legacy-runtime/runtime-cores/composer/DefaultThreadComposerRuntimeCore.tsx +15 -5
- package/src/legacy-runtime/runtime-cores/core/ComposerRuntimeCore.tsx +39 -1
- package/src/legacy-runtime/runtime-cores/core/ThreadRuntimeCore.tsx +1 -0
- package/src/legacy-runtime/runtime-cores/core/index.ts +2 -0
- package/src/legacy-runtime/runtime-cores/external-store/ExternalStoreAdapter.tsx +11 -7
- package/src/legacy-runtime/runtime-cores/external-store/ExternalStoreThreadRuntimeCore.tsx +12 -7
- package/src/legacy-runtime/runtime-cores/local/LocalRuntimeOptions.tsx +12 -8
- package/src/legacy-runtime/runtime-cores/local/LocalThreadRuntimeCore.tsx +11 -4
- package/src/legacy-runtime/runtime-cores/remote-thread-list/EMPTY_THREAD_CORE.tsx +12 -1
- package/src/legacy-runtime/runtime-cores/remote-thread-list/adapter/cloud.tsx +11 -1
- package/src/primitives/actionBarMore/ActionBarMoreContent.tsx +46 -0
- package/src/primitives/actionBarMore/ActionBarMoreItem.tsx +31 -0
- package/src/primitives/actionBarMore/ActionBarMoreRoot.tsx +22 -0
- package/src/primitives/actionBarMore/ActionBarMoreSeparator.tsx +32 -0
- package/src/primitives/actionBarMore/ActionBarMoreTrigger.tsx +31 -0
- package/src/primitives/actionBarMore/index.ts +5 -0
- package/src/primitives/actionBarMore/scope.tsx +8 -0
- package/src/primitives/composer/ComposerDictate.tsx +48 -0
- package/src/primitives/composer/ComposerDictationTranscript.tsx +45 -0
- package/src/primitives/composer/ComposerIf.tsx +7 -0
- package/src/primitives/composer/ComposerInput.tsx +4 -1
- package/src/primitives/composer/ComposerStopDictation.tsx +45 -0
- package/src/primitives/composer/index.ts +3 -0
- package/src/primitives/index.ts +2 -0
- package/src/primitives/threadListItemMore/ThreadListItemMoreContent.tsx +47 -0
- package/src/primitives/threadListItemMore/ThreadListItemMoreItem.tsx +32 -0
- package/src/primitives/threadListItemMore/ThreadListItemMoreRoot.tsx +23 -0
- package/src/primitives/threadListItemMore/ThreadListItemMoreSeparator.tsx +32 -0
- package/src/primitives/threadListItemMore/ThreadListItemMoreTrigger.tsx +32 -0
- package/src/primitives/threadListItemMore/index.ts +5 -0
- package/src/primitives/threadListItemMore/scope.tsx +8 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { FC } from "react";
|
|
4
|
+
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
|
|
5
|
+
import { ScopedProps, useDropdownMenuScope } from "./scope";
|
|
6
|
+
|
|
7
|
+
export namespace ActionBarMorePrimitiveRoot {
|
|
8
|
+
export type Props = DropdownMenuPrimitive.DropdownMenuProps;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const ActionBarMorePrimitiveRoot: FC<
|
|
12
|
+
ActionBarMorePrimitiveRoot.Props
|
|
13
|
+
> = ({
|
|
14
|
+
__scopeActionBarMore,
|
|
15
|
+
...rest
|
|
16
|
+
}: ScopedProps<ActionBarMorePrimitiveRoot.Props>) => {
|
|
17
|
+
const scope = useDropdownMenuScope(__scopeActionBarMore);
|
|
18
|
+
|
|
19
|
+
return <DropdownMenuPrimitive.Root {...scope} {...rest} />;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
ActionBarMorePrimitiveRoot.displayName = "ActionBarMorePrimitive.Root";
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { ComponentPropsWithoutRef, ComponentRef, forwardRef } from "react";
|
|
4
|
+
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
|
|
5
|
+
import { ScopedProps, useDropdownMenuScope } from "./scope";
|
|
6
|
+
|
|
7
|
+
export namespace ActionBarMorePrimitiveSeparator {
|
|
8
|
+
export type Element = ComponentRef<typeof DropdownMenuPrimitive.Separator>;
|
|
9
|
+
export type Props = ComponentPropsWithoutRef<
|
|
10
|
+
typeof DropdownMenuPrimitive.Separator
|
|
11
|
+
>;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const ActionBarMorePrimitiveSeparator = forwardRef<
|
|
15
|
+
ActionBarMorePrimitiveSeparator.Element,
|
|
16
|
+
ActionBarMorePrimitiveSeparator.Props
|
|
17
|
+
>(
|
|
18
|
+
(
|
|
19
|
+
{
|
|
20
|
+
__scopeActionBarMore,
|
|
21
|
+
...rest
|
|
22
|
+
}: ScopedProps<ActionBarMorePrimitiveSeparator.Props>,
|
|
23
|
+
ref,
|
|
24
|
+
) => {
|
|
25
|
+
const scope = useDropdownMenuScope(__scopeActionBarMore);
|
|
26
|
+
|
|
27
|
+
return <DropdownMenuPrimitive.Separator {...scope} {...rest} ref={ref} />;
|
|
28
|
+
},
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
ActionBarMorePrimitiveSeparator.displayName =
|
|
32
|
+
"ActionBarMorePrimitive.Separator";
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { ComponentPropsWithoutRef, ComponentRef, forwardRef } from "react";
|
|
4
|
+
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
|
|
5
|
+
import { ScopedProps, useDropdownMenuScope } from "./scope";
|
|
6
|
+
|
|
7
|
+
export namespace ActionBarMorePrimitiveTrigger {
|
|
8
|
+
export type Element = ComponentRef<typeof DropdownMenuPrimitive.Trigger>;
|
|
9
|
+
export type Props = ComponentPropsWithoutRef<
|
|
10
|
+
typeof DropdownMenuPrimitive.Trigger
|
|
11
|
+
>;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const ActionBarMorePrimitiveTrigger = forwardRef<
|
|
15
|
+
ActionBarMorePrimitiveTrigger.Element,
|
|
16
|
+
ActionBarMorePrimitiveTrigger.Props
|
|
17
|
+
>(
|
|
18
|
+
(
|
|
19
|
+
{
|
|
20
|
+
__scopeActionBarMore,
|
|
21
|
+
...rest
|
|
22
|
+
}: ScopedProps<ActionBarMorePrimitiveTrigger.Props>,
|
|
23
|
+
ref,
|
|
24
|
+
) => {
|
|
25
|
+
const scope = useDropdownMenuScope(__scopeActionBarMore);
|
|
26
|
+
|
|
27
|
+
return <DropdownMenuPrimitive.Trigger {...scope} {...rest} ref={ref} />;
|
|
28
|
+
},
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
ActionBarMorePrimitiveTrigger.displayName = "ActionBarMorePrimitive.Trigger";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { ActionBarMorePrimitiveRoot as Root } from "./ActionBarMoreRoot";
|
|
2
|
+
export { ActionBarMorePrimitiveTrigger as Trigger } from "./ActionBarMoreTrigger";
|
|
3
|
+
export { ActionBarMorePrimitiveContent as Content } from "./ActionBarMoreContent";
|
|
4
|
+
export { ActionBarMorePrimitiveItem as Item } from "./ActionBarMoreItem";
|
|
5
|
+
export { ActionBarMorePrimitiveSeparator as Separator } from "./ActionBarMoreSeparator";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
|
|
2
|
+
import type { Scope } from "@radix-ui/react-context";
|
|
3
|
+
|
|
4
|
+
export const useDropdownMenuScope: ReturnType<
|
|
5
|
+
typeof DropdownMenuPrimitive.createDropdownMenuScope
|
|
6
|
+
> = DropdownMenuPrimitive.createDropdownMenuScope();
|
|
7
|
+
|
|
8
|
+
export type ScopedProps<P> = P & { __scopeActionBarMore?: Scope };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { useCallback } from "react";
|
|
4
|
+
import { useAssistantState, useAssistantApi } from "../../context";
|
|
5
|
+
import type {
|
|
6
|
+
ActionButtonElement,
|
|
7
|
+
ActionButtonProps,
|
|
8
|
+
} from "../../utils/createActionButton";
|
|
9
|
+
import { createActionButton } from "../../utils/createActionButton";
|
|
10
|
+
|
|
11
|
+
const useComposerDictate = () => {
|
|
12
|
+
const api = useAssistantApi();
|
|
13
|
+
const disabled = useAssistantState(
|
|
14
|
+
({ thread, composer }) =>
|
|
15
|
+
composer.dictation != null ||
|
|
16
|
+
!thread.capabilities.dictation ||
|
|
17
|
+
!composer.isEditing,
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
const callback = useCallback(() => {
|
|
21
|
+
api.composer().startDictation();
|
|
22
|
+
}, [api]);
|
|
23
|
+
|
|
24
|
+
if (disabled) return null;
|
|
25
|
+
return callback;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export namespace ComposerPrimitiveDictate {
|
|
29
|
+
export type Element = ActionButtonElement;
|
|
30
|
+
export type Props = ActionButtonProps<typeof useComposerDictate>;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* A button that starts dictation to convert voice to text.
|
|
35
|
+
*
|
|
36
|
+
* Requires a DictationAdapter to be configured in the runtime.
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```tsx
|
|
40
|
+
* <ComposerPrimitive.Dictate>
|
|
41
|
+
* <MicIcon />
|
|
42
|
+
* </ComposerPrimitive.Dictate>
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
export const ComposerPrimitiveDictate = createActionButton(
|
|
46
|
+
"ComposerPrimitive.Dictate",
|
|
47
|
+
useComposerDictate,
|
|
48
|
+
);
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { Primitive } from "@radix-ui/react-primitive";
|
|
4
|
+
import { type ComponentRef, forwardRef, ComponentPropsWithoutRef } from "react";
|
|
5
|
+
import { useAssistantState } from "../../context";
|
|
6
|
+
|
|
7
|
+
export namespace ComposerPrimitiveDictationTranscript {
|
|
8
|
+
export type Element = ComponentRef<typeof Primitive.span>;
|
|
9
|
+
export type Props = ComponentPropsWithoutRef<typeof Primitive.span>;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Renders the current interim (partial) transcript while dictation is active.
|
|
14
|
+
*
|
|
15
|
+
* This component displays real-time feedback of what the user is saying before
|
|
16
|
+
* the transcription is finalized and committed to the composer input.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```tsx
|
|
20
|
+
* <ComposerPrimitive.If dictation>
|
|
21
|
+
* <div className="dictation-preview">
|
|
22
|
+
* <ComposerPrimitive.DictationTranscript />
|
|
23
|
+
* </div>
|
|
24
|
+
* </ComposerPrimitive.If>
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export const ComposerPrimitiveDictationTranscript = forwardRef<
|
|
28
|
+
ComposerPrimitiveDictationTranscript.Element,
|
|
29
|
+
ComposerPrimitiveDictationTranscript.Props
|
|
30
|
+
>(({ children, ...props }, forwardRef) => {
|
|
31
|
+
const transcript = useAssistantState(
|
|
32
|
+
({ composer }) => composer.dictation?.transcript,
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
if (!transcript) return null;
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<Primitive.span {...props} ref={forwardRef}>
|
|
39
|
+
{children ?? transcript}
|
|
40
|
+
</Primitive.span>
|
|
41
|
+
);
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
ComposerPrimitiveDictationTranscript.displayName =
|
|
45
|
+
"ComposerPrimitive.DictationTranscript";
|
|
@@ -5,7 +5,10 @@ import { useAssistantState } from "../../context";
|
|
|
5
5
|
import type { RequireAtLeastOne } from "../../utils/RequireAtLeastOne";
|
|
6
6
|
|
|
7
7
|
type ComposerIfFilters = {
|
|
8
|
+
/** Whether the composer is in editing mode */
|
|
8
9
|
editing: boolean | undefined;
|
|
10
|
+
/** Whether dictation is currently active */
|
|
11
|
+
dictation: boolean | undefined;
|
|
9
12
|
};
|
|
10
13
|
|
|
11
14
|
export type UseComposerIfProps = RequireAtLeastOne<ComposerIfFilters>;
|
|
@@ -15,6 +18,10 @@ const useComposerIf = (props: UseComposerIfProps) => {
|
|
|
15
18
|
if (props.editing === true && !composer.isEditing) return false;
|
|
16
19
|
if (props.editing === false && composer.isEditing) return false;
|
|
17
20
|
|
|
21
|
+
const isDictating = composer.dictation != null;
|
|
22
|
+
if (props.dictation === true && !isDictating) return false;
|
|
23
|
+
if (props.dictation === false && isDictating) return false;
|
|
24
|
+
|
|
18
25
|
return true;
|
|
19
26
|
});
|
|
20
27
|
};
|
|
@@ -108,7 +108,10 @@ export const ComposerPrimitiveInput = forwardRef<
|
|
|
108
108
|
const Component = asChild ? Slot : TextareaAutosize;
|
|
109
109
|
|
|
110
110
|
const isDisabled =
|
|
111
|
-
useAssistantState(
|
|
111
|
+
useAssistantState(
|
|
112
|
+
({ thread, composer }) =>
|
|
113
|
+
thread.isDisabled || composer.dictation?.inputDisabled,
|
|
114
|
+
) || disabledProp;
|
|
112
115
|
const textareaRef = useRef<HTMLTextAreaElement>(null);
|
|
113
116
|
const ref = useComposedRefs(forwardedRef, textareaRef);
|
|
114
117
|
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { useCallback } from "react";
|
|
4
|
+
import { useAssistantState, useAssistantApi } from "../../context";
|
|
5
|
+
import type {
|
|
6
|
+
ActionButtonElement,
|
|
7
|
+
ActionButtonProps,
|
|
8
|
+
} from "../../utils/createActionButton";
|
|
9
|
+
import { createActionButton } from "../../utils/createActionButton";
|
|
10
|
+
|
|
11
|
+
const useComposerStopDictation = () => {
|
|
12
|
+
const api = useAssistantApi();
|
|
13
|
+
const isDictating = useAssistantState(
|
|
14
|
+
({ composer }) => composer.dictation != null,
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
const callback = useCallback(() => {
|
|
18
|
+
api.composer().stopDictation();
|
|
19
|
+
}, [api]);
|
|
20
|
+
|
|
21
|
+
if (!isDictating) return null;
|
|
22
|
+
return callback;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export namespace ComposerPrimitiveStopDictation {
|
|
26
|
+
export type Element = ActionButtonElement;
|
|
27
|
+
export type Props = ActionButtonProps<typeof useComposerStopDictation>;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* A button that stops the current dictation session.
|
|
32
|
+
*
|
|
33
|
+
* Only rendered when dictation is active.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```tsx
|
|
37
|
+
* <ComposerPrimitive.StopDictation>
|
|
38
|
+
* <StopIcon />
|
|
39
|
+
* </ComposerPrimitive.StopDictation>
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
export const ComposerPrimitiveStopDictation = createActionButton(
|
|
43
|
+
"ComposerPrimitive.StopDictation",
|
|
44
|
+
useComposerStopDictation,
|
|
45
|
+
);
|
|
@@ -6,4 +6,7 @@ export { ComposerPrimitiveAddAttachment as AddAttachment } from "./ComposerAddAt
|
|
|
6
6
|
export { ComposerPrimitiveAttachments as Attachments } from "./ComposerAttachments";
|
|
7
7
|
export { ComposerPrimitiveAttachmentByIndex as AttachmentByIndex } from "./ComposerAttachments";
|
|
8
8
|
export { ComposerPrimitiveAttachmentDropzone as AttachmentDropzone } from "./ComposerAttachmentDropzone";
|
|
9
|
+
export { ComposerPrimitiveDictate as Dictate } from "./ComposerDictate";
|
|
10
|
+
export { ComposerPrimitiveStopDictation as StopDictation } from "./ComposerStopDictation";
|
|
11
|
+
export { ComposerPrimitiveDictationTranscript as DictationTranscript } from "./ComposerDictationTranscript";
|
|
9
12
|
export { ComposerPrimitiveIf as If } from "./ComposerIf";
|
package/src/primitives/index.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export * as ActionBarPrimitive from "./actionBar";
|
|
2
|
+
export * as ActionBarMorePrimitive from "./actionBarMore";
|
|
2
3
|
export * as AssistantModalPrimitive from "./assistantModal";
|
|
3
4
|
export * as AttachmentPrimitive from "./attachment";
|
|
4
5
|
export * as BranchPickerPrimitive from "./branchPicker";
|
|
@@ -9,6 +10,7 @@ export * as MessagePrimitive from "./message";
|
|
|
9
10
|
export * as ThreadPrimitive from "./thread";
|
|
10
11
|
export * as ThreadListPrimitive from "./threadList";
|
|
11
12
|
export * as ThreadListItemPrimitive from "./threadListItem";
|
|
13
|
+
export * as ThreadListItemMorePrimitive from "./threadListItemMore";
|
|
12
14
|
|
|
13
15
|
export { AssistantIf } from "./assistant/AssistantIf";
|
|
14
16
|
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { ComponentPropsWithoutRef, ComponentRef, forwardRef } from "react";
|
|
4
|
+
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
|
|
5
|
+
import { ScopedProps, useDropdownMenuScope } from "./scope";
|
|
6
|
+
|
|
7
|
+
export namespace ThreadListItemMorePrimitiveContent {
|
|
8
|
+
export type Element = ComponentRef<typeof DropdownMenuPrimitive.Content>;
|
|
9
|
+
export type Props = ComponentPropsWithoutRef<
|
|
10
|
+
typeof DropdownMenuPrimitive.Content
|
|
11
|
+
> & {
|
|
12
|
+
portalProps?:
|
|
13
|
+
| ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Portal>
|
|
14
|
+
| undefined;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const ThreadListItemMorePrimitiveContent = forwardRef<
|
|
19
|
+
ThreadListItemMorePrimitiveContent.Element,
|
|
20
|
+
ThreadListItemMorePrimitiveContent.Props
|
|
21
|
+
>(
|
|
22
|
+
(
|
|
23
|
+
{
|
|
24
|
+
__scopeThreadListItemMore,
|
|
25
|
+
portalProps,
|
|
26
|
+
sideOffset = 4,
|
|
27
|
+
...props
|
|
28
|
+
}: ScopedProps<ThreadListItemMorePrimitiveContent.Props>,
|
|
29
|
+
forwardedRef,
|
|
30
|
+
) => {
|
|
31
|
+
const scope = useDropdownMenuScope(__scopeThreadListItemMore);
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<DropdownMenuPrimitive.Portal {...scope} {...portalProps}>
|
|
35
|
+
<DropdownMenuPrimitive.Content
|
|
36
|
+
{...scope}
|
|
37
|
+
{...props}
|
|
38
|
+
ref={forwardedRef}
|
|
39
|
+
sideOffset={sideOffset}
|
|
40
|
+
/>
|
|
41
|
+
</DropdownMenuPrimitive.Portal>
|
|
42
|
+
);
|
|
43
|
+
},
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
ThreadListItemMorePrimitiveContent.displayName =
|
|
47
|
+
"ThreadListItemMorePrimitive.Content";
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { ComponentPropsWithoutRef, ComponentRef, forwardRef } from "react";
|
|
4
|
+
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
|
|
5
|
+
import { ScopedProps, useDropdownMenuScope } from "./scope";
|
|
6
|
+
|
|
7
|
+
export namespace ThreadListItemMorePrimitiveItem {
|
|
8
|
+
export type Element = ComponentRef<typeof DropdownMenuPrimitive.Item>;
|
|
9
|
+
export type Props = ComponentPropsWithoutRef<
|
|
10
|
+
typeof DropdownMenuPrimitive.Item
|
|
11
|
+
>;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const ThreadListItemMorePrimitiveItem = forwardRef<
|
|
15
|
+
ThreadListItemMorePrimitiveItem.Element,
|
|
16
|
+
ThreadListItemMorePrimitiveItem.Props
|
|
17
|
+
>(
|
|
18
|
+
(
|
|
19
|
+
{
|
|
20
|
+
__scopeThreadListItemMore,
|
|
21
|
+
...rest
|
|
22
|
+
}: ScopedProps<ThreadListItemMorePrimitiveItem.Props>,
|
|
23
|
+
ref,
|
|
24
|
+
) => {
|
|
25
|
+
const scope = useDropdownMenuScope(__scopeThreadListItemMore);
|
|
26
|
+
|
|
27
|
+
return <DropdownMenuPrimitive.Item {...scope} {...rest} ref={ref} />;
|
|
28
|
+
},
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
ThreadListItemMorePrimitiveItem.displayName =
|
|
32
|
+
"ThreadListItemMorePrimitive.Item";
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { FC } from "react";
|
|
4
|
+
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
|
|
5
|
+
import { ScopedProps, useDropdownMenuScope } from "./scope";
|
|
6
|
+
|
|
7
|
+
export namespace ThreadListItemMorePrimitiveRoot {
|
|
8
|
+
export type Props = DropdownMenuPrimitive.DropdownMenuProps;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const ThreadListItemMorePrimitiveRoot: FC<
|
|
12
|
+
ThreadListItemMorePrimitiveRoot.Props
|
|
13
|
+
> = ({
|
|
14
|
+
__scopeThreadListItemMore,
|
|
15
|
+
...rest
|
|
16
|
+
}: ScopedProps<ThreadListItemMorePrimitiveRoot.Props>) => {
|
|
17
|
+
const scope = useDropdownMenuScope(__scopeThreadListItemMore);
|
|
18
|
+
|
|
19
|
+
return <DropdownMenuPrimitive.Root {...scope} {...rest} />;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
ThreadListItemMorePrimitiveRoot.displayName =
|
|
23
|
+
"ThreadListItemMorePrimitive.Root";
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { ComponentPropsWithoutRef, ComponentRef, forwardRef } from "react";
|
|
4
|
+
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
|
|
5
|
+
import { ScopedProps, useDropdownMenuScope } from "./scope";
|
|
6
|
+
|
|
7
|
+
export namespace ThreadListItemMorePrimitiveSeparator {
|
|
8
|
+
export type Element = ComponentRef<typeof DropdownMenuPrimitive.Separator>;
|
|
9
|
+
export type Props = ComponentPropsWithoutRef<
|
|
10
|
+
typeof DropdownMenuPrimitive.Separator
|
|
11
|
+
>;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const ThreadListItemMorePrimitiveSeparator = forwardRef<
|
|
15
|
+
ThreadListItemMorePrimitiveSeparator.Element,
|
|
16
|
+
ThreadListItemMorePrimitiveSeparator.Props
|
|
17
|
+
>(
|
|
18
|
+
(
|
|
19
|
+
{
|
|
20
|
+
__scopeThreadListItemMore,
|
|
21
|
+
...rest
|
|
22
|
+
}: ScopedProps<ThreadListItemMorePrimitiveSeparator.Props>,
|
|
23
|
+
ref,
|
|
24
|
+
) => {
|
|
25
|
+
const scope = useDropdownMenuScope(__scopeThreadListItemMore);
|
|
26
|
+
|
|
27
|
+
return <DropdownMenuPrimitive.Separator {...scope} {...rest} ref={ref} />;
|
|
28
|
+
},
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
ThreadListItemMorePrimitiveSeparator.displayName =
|
|
32
|
+
"ThreadListItemMorePrimitive.Separator";
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { ComponentPropsWithoutRef, ComponentRef, forwardRef } from "react";
|
|
4
|
+
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
|
|
5
|
+
import { ScopedProps, useDropdownMenuScope } from "./scope";
|
|
6
|
+
|
|
7
|
+
export namespace ThreadListItemMorePrimitiveTrigger {
|
|
8
|
+
export type Element = ComponentRef<typeof DropdownMenuPrimitive.Trigger>;
|
|
9
|
+
export type Props = ComponentPropsWithoutRef<
|
|
10
|
+
typeof DropdownMenuPrimitive.Trigger
|
|
11
|
+
>;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const ThreadListItemMorePrimitiveTrigger = forwardRef<
|
|
15
|
+
ThreadListItemMorePrimitiveTrigger.Element,
|
|
16
|
+
ThreadListItemMorePrimitiveTrigger.Props
|
|
17
|
+
>(
|
|
18
|
+
(
|
|
19
|
+
{
|
|
20
|
+
__scopeThreadListItemMore,
|
|
21
|
+
...rest
|
|
22
|
+
}: ScopedProps<ThreadListItemMorePrimitiveTrigger.Props>,
|
|
23
|
+
ref,
|
|
24
|
+
) => {
|
|
25
|
+
const scope = useDropdownMenuScope(__scopeThreadListItemMore);
|
|
26
|
+
|
|
27
|
+
return <DropdownMenuPrimitive.Trigger {...scope} {...rest} ref={ref} />;
|
|
28
|
+
},
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
ThreadListItemMorePrimitiveTrigger.displayName =
|
|
32
|
+
"ThreadListItemMorePrimitive.Trigger";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { ThreadListItemMorePrimitiveRoot as Root } from "./ThreadListItemMoreRoot";
|
|
2
|
+
export { ThreadListItemMorePrimitiveTrigger as Trigger } from "./ThreadListItemMoreTrigger";
|
|
3
|
+
export { ThreadListItemMorePrimitiveContent as Content } from "./ThreadListItemMoreContent";
|
|
4
|
+
export { ThreadListItemMorePrimitiveItem as Item } from "./ThreadListItemMoreItem";
|
|
5
|
+
export { ThreadListItemMorePrimitiveSeparator as Separator } from "./ThreadListItemMoreSeparator";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
|
|
2
|
+
import type { Scope } from "@radix-ui/react-context";
|
|
3
|
+
|
|
4
|
+
export const useDropdownMenuScope: ReturnType<
|
|
5
|
+
typeof DropdownMenuPrimitive.createDropdownMenuScope
|
|
6
|
+
> = DropdownMenuPrimitive.createDropdownMenuScope();
|
|
7
|
+
|
|
8
|
+
export type ScopedProps<P> = P & { __scopeThreadListItemMore?: Scope };
|