,
forwardedRef,
) => {
const scope = usePopoverScope(__scopeAssistantModal);
@@ -44,4 +48,5 @@ export const AssistantModalContent = forwardRef<
);
},
);
-AssistantModalContent.displayName = "AssistantModalContent";
+
+AssistantModalPrimitiveContent.displayName = "AssistantModalPrimitive.Content";
diff --git a/packages/react/src/primitives/assistantModal/AssistantModalRoot.tsx b/packages/react/src/primitives/assistantModal/AssistantModalRoot.tsx
index 9d3339f99..539c44d61 100644
--- a/packages/react/src/primitives/assistantModal/AssistantModalRoot.tsx
+++ b/packages/react/src/primitives/assistantModal/AssistantModalRoot.tsx
@@ -1,13 +1,12 @@
+"use client";
+
import { FC, useState } from "react";
import * as PopoverPrimitive from "@radix-ui/react-popover";
-import type { Scope } from "@radix-ui/react-context";
import { composeEventHandlers } from "@radix-ui/primitive";
import { useOnComposerFocus } from "../../utils/hooks/useOnComposerFocus";
+import { ScopedProps, usePopoverScope } from "./scope";
-export type ScopedProps = P & { __scopeAssistantModal?: Scope };
-export const usePopoverScope = PopoverPrimitive.createPopoverScope();
-
-type AssistantModalRootProps = PopoverPrimitive.PopoverProps;
+export type AssistantModalPrimitiveRootProps = PopoverPrimitive.PopoverProps;
const useAssistantModalOpenState = (defaultOpen = false) => {
const state = useState(defaultOpen);
@@ -20,13 +19,15 @@ const useAssistantModalOpenState = (defaultOpen = false) => {
return state;
};
-export const AssistantModalRoot: FC = ({
+export const AssistantModalPrimitiveRoot: FC<
+ AssistantModalPrimitiveRootProps
+> = ({
__scopeAssistantModal,
defaultOpen,
open,
onOpenChange,
...rest
-}: ScopedProps) => {
+}: ScopedProps) => {
const scope = usePopoverScope(__scopeAssistantModal);
const [modalOpen, setOpen] = useAssistantModalOpenState(defaultOpen);
@@ -41,4 +42,4 @@ export const AssistantModalRoot: FC = ({
);
};
-AssistantModalRoot.displayName = "AssistantModalRoot";
+AssistantModalPrimitiveRoot.displayName = "AssistantModalPrimitive.Root";
diff --git a/packages/react/src/primitives/assistantModal/AssistantModalTrigger.tsx b/packages/react/src/primitives/assistantModal/AssistantModalTrigger.tsx
index ab64303cc..6e5840bee 100644
--- a/packages/react/src/primitives/assistantModal/AssistantModalTrigger.tsx
+++ b/packages/react/src/primitives/assistantModal/AssistantModalTrigger.tsx
@@ -1,18 +1,25 @@
+"use client";
+
import { ComponentPropsWithoutRef, ElementRef, forwardRef } from "react";
import * as PopoverPrimitive from "@radix-ui/react-popover";
-import { ScopedProps, usePopoverScope } from "./AssistantModalRoot";
+import { ScopedProps, usePopoverScope } from "./scope";
-type AssistantModalTriggerElement = ElementRef;
-type AssistantModalTriggerProps = ComponentPropsWithoutRef<
+type AssistantModalPrimitiveTriggerElement = ElementRef<
+ typeof PopoverPrimitive.Trigger
+>;
+export type AssistantModalPrimitiveTriggerProps = ComponentPropsWithoutRef<
typeof PopoverPrimitive.Trigger
>;
-export const AssistantModalTrigger = forwardRef<
- AssistantModalTriggerElement,
- AssistantModalTriggerProps
+export const AssistantModalPrimitiveTrigger = forwardRef<
+ AssistantModalPrimitiveTriggerElement,
+ AssistantModalPrimitiveTriggerProps
>(
(
- { __scopeAssistantModal, ...rest }: ScopedProps,
+ {
+ __scopeAssistantModal,
+ ...rest
+ }: ScopedProps,
ref,
) => {
const scope = usePopoverScope(__scopeAssistantModal);
@@ -20,4 +27,5 @@ export const AssistantModalTrigger = forwardRef<
return ;
},
);
-AssistantModalTrigger.displayName = "AssistantModalTrigger";
+
+AssistantModalPrimitiveTrigger.displayName = "AssistantModalPrimitive.Trigger";
diff --git a/packages/react/src/primitives/assistantModal/index.ts b/packages/react/src/primitives/assistantModal/index.ts
index cdb256d0a..516315a50 100644
--- a/packages/react/src/primitives/assistantModal/index.ts
+++ b/packages/react/src/primitives/assistantModal/index.ts
@@ -1,3 +1,3 @@
-export { AssistantModalRoot as Root } from "./AssistantModalRoot";
-export { AssistantModalTrigger as Trigger } from "./AssistantModalTrigger";
-export { AssistantModalContent as Content } from "./AssistantModalContent";
+export { AssistantModalPrimitiveRoot as Root } from "./AssistantModalRoot";
+export { AssistantModalPrimitiveTrigger as Trigger } from "./AssistantModalTrigger";
+export { AssistantModalPrimitiveContent as Content } from "./AssistantModalContent";
diff --git a/packages/react/src/primitives/assistantModal/scope.tsx b/packages/react/src/primitives/assistantModal/scope.tsx
new file mode 100644
index 000000000..cd9e7f29e
--- /dev/null
+++ b/packages/react/src/primitives/assistantModal/scope.tsx
@@ -0,0 +1,5 @@
+import * as PopoverPrimitive from "@radix-ui/react-popover";
+import type { Scope } from "@radix-ui/react-context";
+
+export type ScopedProps = P & { __scopeAssistantModal?: Scope };
+export const usePopoverScope = PopoverPrimitive.createPopoverScope();
diff --git a/packages/react/src/primitives/assistantModal/types.ts b/packages/react/src/primitives/assistantModal/types.ts
new file mode 100644
index 000000000..195fc56f3
--- /dev/null
+++ b/packages/react/src/primitives/assistantModal/types.ts
@@ -0,0 +1,3 @@
+export type { AssistantModalPrimitiveRootProps } from "./AssistantModalRoot";
+export type { AssistantModalPrimitiveTriggerProps } from "./AssistantModalTrigger";
+export type { AssistantModalPrimitiveContentProps } from "./AssistantModalContent";
diff --git a/packages/react/src/primitives/branchPicker/BranchPickerCount.tsx b/packages/react/src/primitives/branchPicker/BranchPickerCount.tsx
index c43479bc5..b45d81001 100644
--- a/packages/react/src/primitives/branchPicker/BranchPickerCount.tsx
+++ b/packages/react/src/primitives/branchPicker/BranchPickerCount.tsx
@@ -3,7 +3,13 @@
import type { FC } from "react";
import { useBranchPickerCount } from "../../primitive-hooks/branchPicker/useBranchPickerCount";
-export const BranchPickerCount: FC = () => {
+export type BranchPickerPrimitiveCountProps = {};
+
+export const BranchPickerPrimitiveCount: FC<
+ BranchPickerPrimitiveCountProps
+> = () => {
const branchCount = useBranchPickerCount();
return <>{branchCount}>;
};
+
+BranchPickerPrimitiveCount.displayName = "BranchPickerPrimitive.Count";
diff --git a/packages/react/src/primitives/branchPicker/BranchPickerNext.tsx b/packages/react/src/primitives/branchPicker/BranchPickerNext.tsx
index fdbede8ff..a1f28ae3e 100644
--- a/packages/react/src/primitives/branchPicker/BranchPickerNext.tsx
+++ b/packages/react/src/primitives/branchPicker/BranchPickerNext.tsx
@@ -1,9 +1,16 @@
"use client";
import { useBranchPickerNext } from "../../primitive-hooks/branchPicker/useBranchPickerNext";
-import { createActionButton } from "../../utils/createActionButton";
+import {
+ ActionButtonProps,
+ createActionButton,
+} from "../../utils/createActionButton";
-export const BranchPickerNext = createActionButton(
- "BranchPickerNext",
+export type BranchPickerPrimitiveNextProps = ActionButtonProps<
+ typeof useBranchPickerNext
+>;
+
+export const BranchPickerPrimitiveNext = createActionButton(
+ "BranchPickerPrimitive.Next",
useBranchPickerNext,
);
diff --git a/packages/react/src/primitives/branchPicker/BranchPickerNumber.tsx b/packages/react/src/primitives/branchPicker/BranchPickerNumber.tsx
index 8e6a0726d..0e44e88da 100644
--- a/packages/react/src/primitives/branchPicker/BranchPickerNumber.tsx
+++ b/packages/react/src/primitives/branchPicker/BranchPickerNumber.tsx
@@ -3,7 +3,13 @@
import type { FC } from "react";
import { useBranchPickerNumber } from "../../primitive-hooks/branchPicker/useBranchPickerNumber";
-export const BranchPickerNumber: FC = () => {
+export type BranchPickerPrimitiveNumberProps = {};
+
+export const BranchPickerPrimitiveNumber: FC<
+ BranchPickerPrimitiveNumberProps
+> = () => {
const branchNumber = useBranchPickerNumber();
return <>{branchNumber}>;
};
+
+BranchPickerPrimitiveNumber.displayName = "BranchPickerPrimitive.Number";
diff --git a/packages/react/src/primitives/branchPicker/BranchPickerPrevious.tsx b/packages/react/src/primitives/branchPicker/BranchPickerPrevious.tsx
index f87439bbc..d67375e61 100644
--- a/packages/react/src/primitives/branchPicker/BranchPickerPrevious.tsx
+++ b/packages/react/src/primitives/branchPicker/BranchPickerPrevious.tsx
@@ -1,9 +1,16 @@
"use client";
import { useBranchPickerPrevious } from "../../primitive-hooks/branchPicker/useBranchPickerPrevious";
-import { createActionButton } from "../../utils/createActionButton";
+import {
+ ActionButtonProps,
+ createActionButton,
+} from "../../utils/createActionButton";
+
+export type BranchPickerPrimitivePreviousProps = ActionButtonProps<
+ typeof useBranchPickerPrevious
+>;
export const BranchPickerPrevious = createActionButton(
- "BranchPickerPrevious",
+ "BranchPickerPrimitive.Previous",
useBranchPickerPrevious,
);
diff --git a/packages/react/src/primitives/branchPicker/BranchPickerRoot.tsx b/packages/react/src/primitives/branchPicker/BranchPickerRoot.tsx
index 3c841e07c..c5f3e07ce 100644
--- a/packages/react/src/primitives/branchPicker/BranchPickerRoot.tsx
+++ b/packages/react/src/primitives/branchPicker/BranchPickerRoot.tsx
@@ -4,16 +4,16 @@ import { Primitive } from "@radix-ui/react-primitive";
import { type ElementRef, forwardRef, ComponentPropsWithoutRef } from "react";
import { If } from "../message";
-type BranchPickerRootElement = ElementRef;
+type BranchPickerPrimitiveRootElement = ElementRef;
type PrimitiveDivProps = ComponentPropsWithoutRef;
-type BranchPickerRootProps = PrimitiveDivProps & {
+export type BranchPickerPrimitiveRootProps = PrimitiveDivProps & {
hideWhenSingleBranch?: boolean;
};
-export const BranchPickerRoot = forwardRef<
- BranchPickerRootElement,
- BranchPickerRootProps
+export const BranchPickerPrimitiveRoot = forwardRef<
+ BranchPickerPrimitiveRootElement,
+ BranchPickerPrimitiveRootProps
>(({ hideWhenSingleBranch, ...rest }, ref) => {
return (
@@ -22,4 +22,4 @@ export const BranchPickerRoot = forwardRef<
);
});
-BranchPickerRoot.displayName = "BranchPickerRoot";
+BranchPickerPrimitiveRoot.displayName = "BranchPickerPrimitive.Root";
diff --git a/packages/react/src/primitives/branchPicker/index.ts b/packages/react/src/primitives/branchPicker/index.ts
index 23ee5bd21..9827997d2 100644
--- a/packages/react/src/primitives/branchPicker/index.ts
+++ b/packages/react/src/primitives/branchPicker/index.ts
@@ -1,5 +1,5 @@
-export { BranchPickerNext as Next } from "./BranchPickerNext";
+export { BranchPickerPrimitiveNext as Next } from "./BranchPickerNext";
export { BranchPickerPrevious as Previous } from "./BranchPickerPrevious";
-export { BranchPickerCount as Count } from "./BranchPickerCount";
-export { BranchPickerNumber as Number } from "./BranchPickerNumber";
-export { BranchPickerRoot as Root } from "./BranchPickerRoot";
+export { BranchPickerPrimitiveCount as Count } from "./BranchPickerCount";
+export { BranchPickerPrimitiveNumber as Number } from "./BranchPickerNumber";
+export { BranchPickerPrimitiveRoot as Root } from "./BranchPickerRoot";
diff --git a/packages/react/src/primitives/branchPicker/types.ts b/packages/react/src/primitives/branchPicker/types.ts
new file mode 100644
index 000000000..b17ce668a
--- /dev/null
+++ b/packages/react/src/primitives/branchPicker/types.ts
@@ -0,0 +1,5 @@
+export type { BranchPickerPrimitiveRootProps } from "./BranchPickerRoot";
+export type { BranchPickerPrimitivePreviousProps } from "./BranchPickerPrevious";
+export type { BranchPickerPrimitiveNumberProps } from "./BranchPickerNumber";
+export type { BranchPickerPrimitiveNextProps } from "./BranchPickerNext";
+export type { BranchPickerPrimitiveCountProps } from "./BranchPickerCount";
diff --git a/packages/react/src/primitives/composer/ComposerCancel.tsx b/packages/react/src/primitives/composer/ComposerCancel.tsx
index 3459cf3bd..74e558733 100644
--- a/packages/react/src/primitives/composer/ComposerCancel.tsx
+++ b/packages/react/src/primitives/composer/ComposerCancel.tsx
@@ -1,9 +1,16 @@
"use client";
-import { createActionButton } from "../../utils/createActionButton";
+import {
+ ActionButtonProps,
+ createActionButton,
+} from "../../utils/createActionButton";
import { useComposerCancel } from "../../primitive-hooks/composer/useComposerCancel";
-export const ComposerCancel = createActionButton(
- "ComposerCancel",
+export type ComposerPrimitiveCancelProps = ActionButtonProps<
+ typeof useComposerCancel
+>;
+
+export const ComposerPrimitiveCancel = createActionButton(
+ "ComposerPrimitive.Cancel",
useComposerCancel,
);
diff --git a/packages/react/src/primitives/composer/ComposerIf.tsx b/packages/react/src/primitives/composer/ComposerIf.tsx
index f633c86a8..2ac240bdb 100644
--- a/packages/react/src/primitives/composer/ComposerIf.tsx
+++ b/packages/react/src/primitives/composer/ComposerIf.tsx
@@ -6,9 +6,14 @@ import {
useComposerIf,
} from "../../primitive-hooks/composer/useComposerIf";
-type ComposerIfProps = PropsWithChildren;
+export type ComposerPrimitiveIfProps = PropsWithChildren;
-export const ComposerIf: FC = ({ children, ...query }) => {
+export const ComposerPrimitiveIf: FC = ({
+ children,
+ ...query
+}) => {
const result = useComposerIf(query);
return result ? children : null;
};
+
+ComposerPrimitiveIf.displayName = "ComposerPrimitive.If";
diff --git a/packages/react/src/primitives/composer/ComposerInput.tsx b/packages/react/src/primitives/composer/ComposerInput.tsx
index e8b2fe508..4a5e6b025 100644
--- a/packages/react/src/primitives/composer/ComposerInput.tsx
+++ b/packages/react/src/primitives/composer/ComposerInput.tsx
@@ -18,13 +18,13 @@ import { useThreadContext } from "../../context/react/ThreadContext";
import { useEscapeKeydown } from "@radix-ui/react-use-escape-keydown";
import { useOnComposerFocus } from "../../utils/hooks/useOnComposerFocus";
-type ComposerInputProps = TextareaAutosizeProps & {
+export type ComposerPrimitiveInputProps = TextareaAutosizeProps & {
asChild?: boolean;
};
-export const ComposerInput = forwardRef<
+export const ComposerPrimitiveInput = forwardRef<
HTMLTextAreaElement,
- ComposerInputProps
+ ComposerPrimitiveInputProps
>(
(
{ autoFocus = false, asChild, disabled, onChange, onKeyDown, ...rest },
@@ -100,4 +100,4 @@ export const ComposerInput = forwardRef<
},
);
-ComposerInput.displayName = "ComposerInput";
+ComposerPrimitiveInput.displayName = "ComposerPrimitive.Input";
diff --git a/packages/react/src/primitives/composer/ComposerRoot.tsx b/packages/react/src/primitives/composer/ComposerRoot.tsx
index 07e61bbe4..7f5beb138 100644
--- a/packages/react/src/primitives/composer/ComposerRoot.tsx
+++ b/packages/react/src/primitives/composer/ComposerRoot.tsx
@@ -10,30 +10,31 @@ import {
} from "react";
import { useComposerSend } from "../../primitive-hooks";
-type ComposerRootElement = ElementRef;
+type ComposerPrimitiveRootElement = ElementRef;
type PrimitiveFormProps = ComponentPropsWithoutRef;
-type ComposerRootProps = PrimitiveFormProps;
+export type ComposerPrimitiveRootProps = PrimitiveFormProps;
-export const ComposerRoot = forwardRef(
- ({ onSubmit, ...rest }, forwardedRef) => {
- const send = useComposerSend();
+export const ComposerPrimitiveRoot = forwardRef<
+ ComposerPrimitiveRootElement,
+ ComposerPrimitiveRootProps
+>(({ onSubmit, ...rest }, forwardedRef) => {
+ const send = useComposerSend();
- const handleSubmit = (e: FormEvent) => {
- if (!send) return;
+ const handleSubmit = (e: FormEvent) => {
+ if (!send) return;
- e.preventDefault();
- send();
- };
+ e.preventDefault();
+ send();
+ };
- return (
-
- );
- },
-);
+ return (
+
+ );
+});
-ComposerRoot.displayName = "ComposerRoot";
+ComposerPrimitiveRoot.displayName = "ComposerPrimitive.Root";
diff --git a/packages/react/src/primitives/composer/ComposerSend.tsx b/packages/react/src/primitives/composer/ComposerSend.tsx
index 3412058f2..db6f7c557 100644
--- a/packages/react/src/primitives/composer/ComposerSend.tsx
+++ b/packages/react/src/primitives/composer/ComposerSend.tsx
@@ -4,25 +4,26 @@ import { ComponentPropsWithoutRef, ElementRef, forwardRef } from "react";
import { useComposerContext } from "../../context";
import { Primitive } from "@radix-ui/react-primitive";
-type ComposerSendElement = ElementRef;
+type ComposerPrimitiveSendElement = ElementRef;
type PrimitiveButtonProps = ComponentPropsWithoutRef;
-type ComposerSendProps = PrimitiveButtonProps;
+export type ComposerPrimitiveSendProps = PrimitiveButtonProps;
-export const ComposerSend = forwardRef(
- ({ disabled, ...rest }, ref) => {
- const { useComposer } = useComposerContext();
- const hasValue = useComposer((c) => c.isEditing && c.value.length > 0);
+export const ComposerPrimitiveSend = forwardRef<
+ ComposerPrimitiveSendElement,
+ ComposerPrimitiveSendProps
+>(({ disabled, ...rest }, ref) => {
+ const { useComposer } = useComposerContext();
+ const hasValue = useComposer((c) => c.isEditing && c.value.length > 0);
- return (
-
- );
- },
-);
+ return (
+
+ );
+});
-ComposerSend.displayName = "ComposerSend";
+ComposerPrimitiveSend.displayName = "ComposerPrimitive.Send";
diff --git a/packages/react/src/primitives/composer/index.ts b/packages/react/src/primitives/composer/index.ts
index 35d9e7cc7..6e280a9ea 100644
--- a/packages/react/src/primitives/composer/index.ts
+++ b/packages/react/src/primitives/composer/index.ts
@@ -1,5 +1,5 @@
-export { ComposerRoot as Root } from "./ComposerRoot";
-export { ComposerInput as Input } from "./ComposerInput";
-export { ComposerSend as Send } from "./ComposerSend";
-export { ComposerCancel as Cancel } from "./ComposerCancel";
-export { ComposerIf as If } from "./ComposerIf";
+export { ComposerPrimitiveRoot as Root } from "./ComposerRoot";
+export { ComposerPrimitiveInput as Input } from "./ComposerInput";
+export { ComposerPrimitiveSend as Send } from "./ComposerSend";
+export { ComposerPrimitiveCancel as Cancel } from "./ComposerCancel";
+export { ComposerPrimitiveIf as If } from "./ComposerIf";
diff --git a/packages/react/src/primitives/composer/types.ts b/packages/react/src/primitives/composer/types.ts
new file mode 100644
index 000000000..ee914a48f
--- /dev/null
+++ b/packages/react/src/primitives/composer/types.ts
@@ -0,0 +1,5 @@
+export type { ComposerPrimitiveRootProps } from "./ComposerRoot";
+export type { ComposerPrimitiveInputProps } from "./ComposerInput";
+export type { ComposerPrimitiveSendProps } from "./ComposerSend";
+export type { ComposerPrimitiveCancelProps } from "./ComposerCancel";
+export type { ComposerPrimitiveIfProps } from "./ComposerIf";
diff --git a/packages/react/src/primitives/contentPart/ContentPartDisplay.tsx b/packages/react/src/primitives/contentPart/ContentPartDisplay.tsx
index 96f49c917..698e0f40a 100644
--- a/packages/react/src/primitives/contentPart/ContentPartDisplay.tsx
+++ b/packages/react/src/primitives/contentPart/ContentPartDisplay.tsx
@@ -1,7 +1,13 @@
import type { FC } from "react";
import { useContentPartDisplay } from "../../primitive-hooks/contentPart/useContentPartDisplay";
-export const ContentPartDisplay: FC = () => {
+export type ContentPartPrimitiveDisplayProps = {};
+
+export const ContentPartPrimitiveDisplay: FC<
+ ContentPartPrimitiveDisplayProps
+> = () => {
const display = useContentPartDisplay();
return display ?? null;
};
+
+ContentPartPrimitiveDisplay.displayName = "ContentPartPrimitive.Display";
diff --git a/packages/react/src/primitives/contentPart/ContentPartImage.tsx b/packages/react/src/primitives/contentPart/ContentPartImage.tsx
index 37bb94b9c..79cf1b418 100644
--- a/packages/react/src/primitives/contentPart/ContentPartImage.tsx
+++ b/packages/react/src/primitives/contentPart/ContentPartImage.tsx
@@ -2,17 +2,17 @@ import { Primitive } from "@radix-ui/react-primitive";
import { type ElementRef, forwardRef, ComponentPropsWithoutRef } from "react";
import { useContentPartImage } from "../../primitive-hooks/contentPart/useContentPartImage";
-type ContentPartImageElement = ElementRef;
+type ContentPartPrimitiveImageElement = ElementRef;
type PrimitiveImageProps = ComponentPropsWithoutRef;
-type ContentPartImageProps = PrimitiveImageProps;
+export type ContentPartPrimitiveImageProps = PrimitiveImageProps;
-export const ContentPartImage = forwardRef<
- ContentPartImageElement,
- ContentPartImageProps
+export const ContentPartPrimitiveImage = forwardRef<
+ ContentPartPrimitiveImageElement,
+ ContentPartPrimitiveImageProps
>((props, forwardedRef) => {
const image = useContentPartImage();
return ;
});
-ContentPartImage.displayName = "ContentPartImage";
+ContentPartPrimitiveImage.displayName = "ContentPartPrimitive.Image";
diff --git a/packages/react/src/primitives/contentPart/ContentPartInProgressIndicator.tsx b/packages/react/src/primitives/contentPart/ContentPartInProgressIndicator.tsx
index 0e5d1c85b..181e8070b 100644
--- a/packages/react/src/primitives/contentPart/ContentPartInProgressIndicator.tsx
+++ b/packages/react/src/primitives/contentPart/ContentPartInProgressIndicator.tsx
@@ -1,7 +1,14 @@
import type { FC } from "react";
import { useContentPartInProgressIndicator } from "../../primitive-hooks/contentPart/useContentPartInProgressIndicator";
-export const ContentPartInProgressIndicator: FC = () => {
+export type ContentPartPrimitiveInProgressIndicatorProps = {};
+
+export const ContentPartPrimitiveInProgressIndicator: FC<
+ ContentPartPrimitiveInProgressIndicatorProps
+> = () => {
const indicator = useContentPartInProgressIndicator();
return indicator;
};
+
+ContentPartPrimitiveInProgressIndicator.displayName =
+ "ContentPartPrimitive.InProgressIndicator";
diff --git a/packages/react/src/primitives/contentPart/ContentPartText.tsx b/packages/react/src/primitives/contentPart/ContentPartText.tsx
index fd9450bc5..f358ea625 100644
--- a/packages/react/src/primitives/contentPart/ContentPartText.tsx
+++ b/packages/react/src/primitives/contentPart/ContentPartText.tsx
@@ -2,14 +2,17 @@ import { Primitive } from "@radix-ui/react-primitive";
import { type ElementRef, forwardRef, ComponentPropsWithoutRef } from "react";
import { useContentPartText } from "../../primitive-hooks/contentPart/useContentPartText";
-type ContentPartTextElement = ElementRef;
+type ContentPartPrimitiveTextElement = ElementRef;
type PrimitiveSpanProps = ComponentPropsWithoutRef;
-type ContentPartTextProps = Omit;
+export type ContentPartPrimitiveTextProps = Omit<
+ PrimitiveSpanProps,
+ "children"
+>;
-export const ContentPartText = forwardRef<
- ContentPartTextElement,
- ContentPartTextProps
+export const ContentPartPrimitiveText = forwardRef<
+ ContentPartPrimitiveTextElement,
+ ContentPartPrimitiveTextProps
>((props, forwardedRef) => {
const text = useContentPartText();
@@ -20,4 +23,4 @@ export const ContentPartText = forwardRef<
);
});
-ContentPartText.displayName = "ContentPartText";
+ContentPartPrimitiveText.displayName = "ContentPartPrimitive.Text";
diff --git a/packages/react/src/primitives/contentPart/index.ts b/packages/react/src/primitives/contentPart/index.ts
index 3f2148d84..692888c52 100644
--- a/packages/react/src/primitives/contentPart/index.ts
+++ b/packages/react/src/primitives/contentPart/index.ts
@@ -1,4 +1,4 @@
-export { ContentPartInProgressIndicator as InProgressIndicator } from "./ContentPartInProgressIndicator";
-export { ContentPartText as Text } from "./ContentPartText";
-export { ContentPartImage as Image } from "./ContentPartImage";
-export { ContentPartDisplay as Display } from "./ContentPartDisplay";
+export { ContentPartPrimitiveInProgressIndicator as InProgressIndicator } from "./ContentPartInProgressIndicator";
+export { ContentPartPrimitiveText as Text } from "./ContentPartText";
+export { ContentPartPrimitiveImage as Image } from "./ContentPartImage";
+export { ContentPartPrimitiveDisplay as Display } from "./ContentPartDisplay";
diff --git a/packages/react/src/primitives/contentPart/types.ts b/packages/react/src/primitives/contentPart/types.ts
new file mode 100644
index 000000000..2145c4d9b
--- /dev/null
+++ b/packages/react/src/primitives/contentPart/types.ts
@@ -0,0 +1,4 @@
+export type { ContentPartPrimitiveTextProps } from "./ContentPartText";
+export type { ContentPartPrimitiveImageProps } from "./ContentPartImage";
+export type { ContentPartPrimitiveDisplayProps } from "./ContentPartDisplay";
+export type { ContentPartPrimitiveInProgressIndicatorProps } from "./ContentPartInProgressIndicator";
diff --git a/packages/react/src/primitives/index.ts b/packages/react/src/primitives/index.ts
index 801a274df..626bd99eb 100644
--- a/packages/react/src/primitives/index.ts
+++ b/packages/react/src/primitives/index.ts
@@ -5,3 +5,11 @@ export * as ComposerPrimitive from "./composer";
export * as ContentPartPrimitive from "./contentPart";
export * as MessagePrimitive from "./message";
export * as ThreadPrimitive from "./thread";
+
+export type * from "./actionBar/types";
+export type * from "./assistantModal/types";
+export type * from "./branchPicker/types";
+export type * from "./composer/types";
+export type * from "./contentPart/types";
+export type * from "./message/types";
+export type * from "./thread/types";
diff --git a/packages/react/src/primitives/message/MessageContent.tsx b/packages/react/src/primitives/message/MessageContent.tsx
index e2f3aa4ea..944490841 100644
--- a/packages/react/src/primitives/message/MessageContent.tsx
+++ b/packages/react/src/primitives/message/MessageContent.tsx
@@ -8,9 +8,9 @@ import {
} from "../../context";
import { useMessageContext } from "../../context/react/MessageContext";
import { ContentPartProvider } from "../../context/providers/ContentPartProvider";
-import { ContentPartDisplay } from "../contentPart/ContentPartDisplay";
-import { ContentPartInProgressIndicator } from "../contentPart/ContentPartInProgressIndicator";
-import { ContentPartText } from "../contentPart/ContentPartText";
+import { ContentPartPrimitiveDisplay } from "../contentPart/ContentPartDisplay";
+import { ContentPartPrimitiveInProgressIndicator } from "../contentPart/ContentPartInProgressIndicator";
+import { ContentPartPrimitiveText } from "../contentPart/ContentPartText";
import type {
ImageContentPartComponent,
TextContentPartComponent,
@@ -19,7 +19,7 @@ import type {
UIContentPartComponent,
} from "../../types/ContentPartComponentTypes";
-export type MessageContentProps = {
+export type MessagePrimitiveContentProps = {
components?: {
Text?: TextContentPartComponent;
Image?: ImageContentPartComponent;
@@ -34,12 +34,12 @@ export type MessageContentProps = {
const defaultComponents = {
Text: () => (
<>
-
-
+
+
>
),
Image: () => null,
- UI: () => ,
+ UI: () => ,
tools: {
Fallback: (props) => {
const { useToolUIs } = useAssistantContext();
@@ -48,10 +48,10 @@ const defaultComponents = {
return ;
},
},
-} satisfies MessageContentProps["components"];
+} satisfies MessagePrimitiveContentProps["components"];
type MessageContentPartComponentProps = {
- components: MessageContentProps["components"];
+ components: MessagePrimitiveContentProps["components"];
};
const MessageContentPartComponent: FC = ({
@@ -92,7 +92,7 @@ const MessageContentPartComponent: FC = ({
type MessageContentPartProps = {
partIndex: number;
- components: MessageContentProps["components"];
+ components: MessagePrimitiveContentProps["components"];
};
const MessageContentPartImpl: FC = ({
@@ -116,7 +116,9 @@ const MessageContentPart = memo(
prev.components?.tools === next.components?.tools,
);
-export const MessageContent: FC = ({ components }) => {
+export const MessagePrimitiveContent: FC = ({
+ components,
+}) => {
const { useMessage } = useMessageContext();
const contentLength = useMessage((s) => s.message.content.length);
@@ -132,3 +134,5 @@ export const MessageContent: FC = ({ components }) => {
);
});
};
+
+MessagePrimitiveContent.displayName = "MessagePrimitive.Content";
diff --git a/packages/react/src/primitives/message/MessageIf.tsx b/packages/react/src/primitives/message/MessageIf.tsx
index 6a5ff7e7e..e4a069e33 100644
--- a/packages/react/src/primitives/message/MessageIf.tsx
+++ b/packages/react/src/primitives/message/MessageIf.tsx
@@ -6,9 +6,14 @@ import {
useMessageIf,
} from "../../primitive-hooks/message/useMessageIf";
-type MessageIfProps = PropsWithChildren;
+export type MessagePrimitiveIfProps = PropsWithChildren;
-export const MessageIf: FC = ({ children, ...query }) => {
+export const MessagePrimitiveIf: FC = ({
+ children,
+ ...query
+}) => {
const result = useMessageIf(query);
return result ? children : null;
};
+
+MessagePrimitiveIf.displayName = "MessagePrimitive.If";
diff --git a/packages/react/src/primitives/message/MessageInProgress.tsx b/packages/react/src/primitives/message/MessageInProgress.tsx
index 4feb02d22..0cba17954 100644
--- a/packages/react/src/primitives/message/MessageInProgress.tsx
+++ b/packages/react/src/primitives/message/MessageInProgress.tsx
@@ -9,14 +9,14 @@ import {
} from "react";
import { useMessageContext } from "../../context/react/MessageContext";
-type MessageInProgressElement = ElementRef;
+type MessagePrimitiveInProgressElement = ElementRef;
type PrimitiveSpanProps = ComponentPropsWithoutRef;
-type MessageInProgressProps = PrimitiveSpanProps;
+export type MessagePrimitiveInProgressProps = PrimitiveSpanProps;
-export const MessageInProgress = forwardRef<
- MessageInProgressElement,
- MessageInProgressProps
+export const MessagePrimitiveInProgress = forwardRef<
+ MessagePrimitiveInProgressElement,
+ MessagePrimitiveInProgressProps
>((props, ref) => {
const { useMessageUtils } = useMessageContext();
@@ -29,4 +29,4 @@ export const MessageInProgress = forwardRef<
return null;
});
-MessageInProgress.displayName = "MessageInProgress";
+MessagePrimitiveInProgress.displayName = "MessagePrimitive.InProgress";
diff --git a/packages/react/src/primitives/message/MessageRoot.tsx b/packages/react/src/primitives/message/MessageRoot.tsx
index 3594a45b5..65d1102f4 100644
--- a/packages/react/src/primitives/message/MessageRoot.tsx
+++ b/packages/react/src/primitives/message/MessageRoot.tsx
@@ -5,32 +5,33 @@ import { Primitive } from "@radix-ui/react-primitive";
import { type ElementRef, forwardRef, ComponentPropsWithoutRef } from "react";
import { useMessageContext } from "../../context/react/MessageContext";
-type MessageRootElement = ElementRef;
+type MessagePrimitiveRootElement = ElementRef;
type PrimitiveDivProps = ComponentPropsWithoutRef;
-type MessageRootProps = PrimitiveDivProps;
+export type MessagePrimitiveRootProps = PrimitiveDivProps;
-export const MessageRoot = forwardRef(
- ({ onMouseEnter, onMouseLeave, ...rest }, ref) => {
- const { useMessageUtils } = useMessageContext();
- const setIsHovering = useMessageUtils((s) => s.setIsHovering);
+export const MessagePrimitiveRoot = forwardRef<
+ MessagePrimitiveRootElement,
+ MessagePrimitiveRootProps
+>(({ onMouseEnter, onMouseLeave, ...rest }, ref) => {
+ const { useMessageUtils } = useMessageContext();
+ const setIsHovering = useMessageUtils((s) => s.setIsHovering);
- const handleMouseEnter = () => {
- setIsHovering(true);
- };
- const handleMouseLeave = () => {
- setIsHovering(false);
- };
+ const handleMouseEnter = () => {
+ setIsHovering(true);
+ };
+ const handleMouseLeave = () => {
+ setIsHovering(false);
+ };
- return (
-
- );
- },
-);
+ return (
+
+ );
+});
-MessageRoot.displayName = "MessageRoot";
+MessagePrimitiveRoot.displayName = "MessagePrimitive.Root";
diff --git a/packages/react/src/primitives/message/index.ts b/packages/react/src/primitives/message/index.ts
index 443213053..2d1c55ff1 100644
--- a/packages/react/src/primitives/message/index.ts
+++ b/packages/react/src/primitives/message/index.ts
@@ -1,4 +1,4 @@
-export { MessageRoot as Root } from "./MessageRoot";
-export { MessageIf as If } from "./MessageIf";
-export { MessageContent as Content } from "./MessageContent";
-export { MessageInProgress as InProgress } from "./MessageInProgress";
+export { MessagePrimitiveRoot as Root } from "./MessageRoot";
+export { MessagePrimitiveIf as If } from "./MessageIf";
+export { MessagePrimitiveContent as Content } from "./MessageContent";
+export { MessagePrimitiveInProgress as InProgress } from "./MessageInProgress";
diff --git a/packages/react/src/primitives/message/types.ts b/packages/react/src/primitives/message/types.ts
new file mode 100644
index 000000000..4fadc8833
--- /dev/null
+++ b/packages/react/src/primitives/message/types.ts
@@ -0,0 +1,4 @@
+export type { MessagePrimitiveRootProps } from "./MessageRoot";
+export type { MessagePrimitiveIfProps } from "./MessageIf";
+export type { MessagePrimitiveContentProps } from "./MessageContent";
+export type { MessagePrimitiveInProgressProps } from "./MessageInProgress";
diff --git a/packages/react/src/primitives/thread/ThreadEmpty.tsx b/packages/react/src/primitives/thread/ThreadEmpty.tsx
index 5dbd99d18..e9a5f7644 100644
--- a/packages/react/src/primitives/thread/ThreadEmpty.tsx
+++ b/packages/react/src/primitives/thread/ThreadEmpty.tsx
@@ -3,11 +3,15 @@
import type { FC, ReactNode } from "react";
import { useThreadEmpty } from "../../primitive-hooks";
-type ThreadEmptyProps = {
+export type ThreadPrimitiveEmptyProps = {
children: ReactNode;
};
-export const ThreadEmpty: FC = ({ children }) => {
+export const ThreadPrimitiveEmpty: FC = ({
+ children,
+}) => {
const empty = useThreadEmpty();
return empty ? children : null;
};
+
+ThreadPrimitiveEmpty.displayName = "ThreadPrimitive.Empty";
diff --git a/packages/react/src/primitives/thread/ThreadIf.tsx b/packages/react/src/primitives/thread/ThreadIf.tsx
index fa5bca50e..ee323e6fe 100644
--- a/packages/react/src/primitives/thread/ThreadIf.tsx
+++ b/packages/react/src/primitives/thread/ThreadIf.tsx
@@ -6,9 +6,14 @@ import {
useThreadIf,
} from "../../primitive-hooks/thread/useThreadIf";
-export type ThreadIfProps = PropsWithChildren;
+export type ThreadPrimitiveIfProps = PropsWithChildren;
-export const ThreadIf: FC = ({ children, ...query }) => {
+export const ThreadPrimitiveIf: FC = ({
+ children,
+ ...query
+}) => {
const result = useThreadIf(query);
return result ? children : null;
};
+
+ThreadPrimitiveIf.displayName = "ThreadPrimitive.If";
diff --git a/packages/react/src/primitives/thread/ThreadMessages.tsx b/packages/react/src/primitives/thread/ThreadMessages.tsx
index bda8cbad5..c8821f58b 100644
--- a/packages/react/src/primitives/thread/ThreadMessages.tsx
+++ b/packages/react/src/primitives/thread/ThreadMessages.tsx
@@ -3,10 +3,10 @@
import { type ComponentType, type FC, memo } from "react";
import { useThreadContext } from "../../context/react/ThreadContext";
import { MessageProvider } from "../../context/providers/MessageProvider";
-import { ComposerIf } from "../composer/ComposerIf";
-import { MessageIf } from "../message/MessageIf";
+import { ComposerPrimitiveIf } from "../composer/ComposerIf";
+import { MessagePrimitiveIf } from "../message/MessageIf";
-type ThreadMessagesProps = {
+export type ThreadPrimitiveMessagesProps = {
components:
| {
Message: ComponentType;
@@ -22,7 +22,9 @@ type ThreadMessagesProps = {
};
};
-const getComponents = (components: ThreadMessagesProps["components"]) => {
+const getComponents = (
+ components: ThreadPrimitiveMessagesProps["components"],
+) => {
return {
EditComposer:
components.EditComposer ??
@@ -37,7 +39,7 @@ const getComponents = (components: ThreadMessagesProps["components"]) => {
type ThreadMessageProps = {
messageIndex: number;
- components: ThreadMessagesProps["components"];
+ components: ThreadPrimitiveMessagesProps["components"];
};
const ThreadMessageImpl: FC = ({
@@ -48,17 +50,17 @@ const ThreadMessageImpl: FC = ({
getComponents(components);
return (
-
-
+
+
-
-
+
+
-
-
-
+
+
+
-
+
);
};
@@ -72,7 +74,9 @@ const ThreadMessage = memo(
prev.components.AssistantMessage === next.components.AssistantMessage,
);
-export const ThreadMessages: FC = ({ components }) => {
+export const ThreadPrimitiveMessages: FC = ({
+ components,
+}) => {
const { useThread } = useThreadContext();
const messagesLength = useThread((t) => t.messages.length);
@@ -89,3 +93,5 @@ export const ThreadMessages: FC = ({ components }) => {
);
});
};
+
+ThreadPrimitiveMessages.displayName = "ThreadPrimitive.Messages";
diff --git a/packages/react/src/primitives/thread/ThreadRoot.tsx b/packages/react/src/primitives/thread/ThreadRoot.tsx
index 63131eb20..1f5197b4b 100644
--- a/packages/react/src/primitives/thread/ThreadRoot.tsx
+++ b/packages/react/src/primitives/thread/ThreadRoot.tsx
@@ -3,15 +3,16 @@
import { Primitive } from "@radix-ui/react-primitive";
import { type ElementRef, forwardRef, ComponentPropsWithoutRef } from "react";
-type ThreadRootElement = ElementRef;
+type ThreadPrimitiveRootElement = ElementRef;
type PrimitiveDivProps = ComponentPropsWithoutRef;
-type ThreadRootProps = PrimitiveDivProps;
+export type ThreadPrimitiveRootProps = PrimitiveDivProps;
-export const ThreadRoot = forwardRef(
- (props, ref) => {
- return ;
- },
-);
+export const ThreadPrimitiveRoot = forwardRef<
+ ThreadPrimitiveRootElement,
+ ThreadPrimitiveRootProps
+>((props, ref) => {
+ return ;
+});
-ThreadRoot.displayName = "ThreadRoot";
+ThreadPrimitiveRoot.displayName = "ThreadPrimitive.Root";
diff --git a/packages/react/src/primitives/thread/ThreadScrollToBottom.tsx b/packages/react/src/primitives/thread/ThreadScrollToBottom.tsx
index 8cacc1ac7..3fd301448 100644
--- a/packages/react/src/primitives/thread/ThreadScrollToBottom.tsx
+++ b/packages/react/src/primitives/thread/ThreadScrollToBottom.tsx
@@ -1,9 +1,16 @@
"use client";
-import { createActionButton } from "../../utils/createActionButton";
+import {
+ ActionButtonProps,
+ createActionButton,
+} from "../../utils/createActionButton";
import { useThreadScrollToBottom } from "../../primitive-hooks/thread/useThreadScrollToBottom";
-export const ThreadScrollToBottom = createActionButton(
- "ThreadScrollToBottom",
+export type ThreadPrimitiveScrollToBottomProps = ActionButtonProps<
+ typeof useThreadScrollToBottom
+>;
+
+export const ThreadPrimitiveScrollToBottom = createActionButton(
+ "ThreadPrimitive.ScrollToBottom",
useThreadScrollToBottom,
);
diff --git a/packages/react/src/primitives/thread/ThreadSuggestion.tsx b/packages/react/src/primitives/thread/ThreadSuggestion.tsx
index d77ba640c..838cd145d 100644
--- a/packages/react/src/primitives/thread/ThreadSuggestion.tsx
+++ b/packages/react/src/primitives/thread/ThreadSuggestion.tsx
@@ -1,9 +1,16 @@
"use client";
-import { createActionButton } from "../../utils/createActionButton";
+import {
+ ActionButtonProps,
+ createActionButton,
+} from "../../utils/createActionButton";
import { useThreadSuggestion } from "../../primitive-hooks/thread/useThreadSuggestion";
-export const ThreadSuggestion = createActionButton(
- "ThreadSuggestion",
+export type ThreadPrimitiveSuggestionProps = ActionButtonProps<
+ typeof useThreadSuggestion
+>;
+
+export const ThreadPrimitiveSuggestion = createActionButton(
+ "ThreadPrimitive.Suggestion",
useThreadSuggestion,
);
diff --git a/packages/react/src/primitives/thread/ThreadViewport.tsx b/packages/react/src/primitives/thread/ThreadViewport.tsx
index ac6207a51..51944ac8f 100644
--- a/packages/react/src/primitives/thread/ThreadViewport.tsx
+++ b/packages/react/src/primitives/thread/ThreadViewport.tsx
@@ -8,14 +8,15 @@ import {
useThreadViewportAutoScroll,
} from "../../primitive-hooks/thread/useThreadViewportAutoScroll";
-type ThreadViewportElement = ElementRef;
+type ThreadPrimitiveViewportElement = ElementRef;
type PrimitiveDivProps = ComponentPropsWithoutRef;
-type ThreadViewportProps = PrimitiveDivProps & UseThreadViewportAutoScrollProps;
+export type ThreadPrimitiveViewportProps = PrimitiveDivProps &
+ UseThreadViewportAutoScrollProps;
-export const ThreadViewport = forwardRef<
- ThreadViewportElement,
- ThreadViewportProps
+export const ThreadPrimitiveViewport = forwardRef<
+ ThreadPrimitiveViewportElement,
+ ThreadPrimitiveViewportProps
>(({ autoScroll, onScroll, children, ...rest }, forwardedRef) => {
const autoScrollRef = useThreadViewportAutoScroll({
autoScroll,
@@ -30,4 +31,4 @@ export const ThreadViewport = forwardRef<
);
});
-ThreadViewport.displayName = "ThreadViewport";
+ThreadPrimitiveViewport.displayName = "ThreadPrimitive.Viewport";
diff --git a/packages/react/src/primitives/thread/index.ts b/packages/react/src/primitives/thread/index.ts
index 6c7c48b13..fe07abe79 100644
--- a/packages/react/src/primitives/thread/index.ts
+++ b/packages/react/src/primitives/thread/index.ts
@@ -1,7 +1,7 @@
-export { ThreadRoot as Root } from "./ThreadRoot";
-export { ThreadEmpty as Empty } from "./ThreadEmpty";
-export { ThreadIf as If } from "./ThreadIf";
-export { ThreadViewport as Viewport } from "./ThreadViewport";
-export { ThreadMessages as Messages } from "./ThreadMessages";
-export { ThreadScrollToBottom as ScrollToBottom } from "./ThreadScrollToBottom";
-export { ThreadSuggestion as Suggestion } from "./ThreadSuggestion";
+export { ThreadPrimitiveRoot as Root } from "./ThreadRoot";
+export { ThreadPrimitiveEmpty as Empty } from "./ThreadEmpty";
+export { ThreadPrimitiveIf as If } from "./ThreadIf";
+export { ThreadPrimitiveViewport as Viewport } from "./ThreadViewport";
+export { ThreadPrimitiveMessages as Messages } from "./ThreadMessages";
+export { ThreadPrimitiveScrollToBottom as ScrollToBottom } from "./ThreadScrollToBottom";
+export { ThreadPrimitiveSuggestion as Suggestion } from "./ThreadSuggestion";
diff --git a/packages/react/src/primitives/thread/types.ts b/packages/react/src/primitives/thread/types.ts
new file mode 100644
index 000000000..127874f69
--- /dev/null
+++ b/packages/react/src/primitives/thread/types.ts
@@ -0,0 +1,7 @@
+export type { ThreadPrimitiveRootProps } from "./ThreadRoot";
+export type { ThreadPrimitiveEmptyProps } from "./ThreadEmpty";
+export type { ThreadPrimitiveIfProps } from "./ThreadIf";
+export type { ThreadPrimitiveViewportProps } from "./ThreadViewport";
+export type { ThreadPrimitiveMessagesProps } from "./ThreadMessages";
+export type { ThreadPrimitiveScrollToBottomProps } from "./ThreadScrollToBottom";
+export type { ThreadPrimitiveSuggestionProps } from "./ThreadSuggestion";
diff --git a/packages/react/src/utils/createActionButton.tsx b/packages/react/src/utils/createActionButton.tsx
index 2035940d0..cb4b5eec1 100644
--- a/packages/react/src/utils/createActionButton.tsx
+++ b/packages/react/src/utils/createActionButton.tsx
@@ -6,13 +6,16 @@ import { type ElementRef, forwardRef, ComponentPropsWithoutRef } from "react";
type ActionButtonCallback = (props: TProps) => null | (() => void);
+type PrimitiveButtonElement = ElementRef;
+type PrimitiveButtonProps = ComponentPropsWithoutRef;
+
+export type ActionButtonProps = PrimitiveButtonProps &
+ (THook extends (props: infer TProps) => unknown ? TProps : never);
+
export const createActionButton = (
displayName: string,
useActionButton: ActionButtonCallback,
) => {
- type PrimitiveButtonElement = ElementRef;
- type PrimitiveButtonProps = ComponentPropsWithoutRef;
-
const ActionButton = forwardRef<
PrimitiveButtonElement,
PrimitiveButtonProps & TProps