diff --git a/packages/elements/src/attachments.tsx b/packages/elements/src/attachments.tsx index cc7b2495..a9ce4102 100644 --- a/packages/elements/src/attachments.tsx +++ b/packages/elements/src/attachments.tsx @@ -371,12 +371,18 @@ export const AttachmentRemove = ({ export type AttachmentHoverCardProps = ComponentProps; -export const AttachmentHoverCard = ({ - openDelay = 0, - closeDelay = 0, - ...props -}: AttachmentHoverCardProps) => ( - +// Open/close with no delay. Radix's HoverCard takes these props; Base UI's +// PreviewCard — what `shadcn add` swaps in on a Base UI project — has neither, +// so naming them in a typed position fails to compile there. Spreading keeps the +// behaviour on Radix and is inert on Base UI. A caller's own props still win, +// since they spread last. +const NO_DELAY = { + closeDelay: 0, + openDelay: 0, +} as unknown as ComponentProps; + +export const AttachmentHoverCard = (props: AttachmentHoverCardProps) => ( + ); export type AttachmentHoverCardTriggerProps = ComponentProps< diff --git a/packages/elements/src/context.tsx b/packages/elements/src/context.tsx index 53e28851..7a165e75 100644 --- a/packages/elements/src/context.tsx +++ b/packages/elements/src/context.tsx @@ -42,6 +42,16 @@ const useContextValue = () => { export type ContextProps = ComponentProps & ContextSchema; +// Open/close with no delay. Radix's HoverCard takes these props; Base UI's +// PreviewCard — what `shadcn add` swaps in on a Base UI project — has neither, +// so naming them in a typed position fails to compile there. Spreading keeps the +// behaviour on Radix and is inert on Base UI. A caller's own props still win, +// since they spread last. +const NO_DELAY = { + closeDelay: 0, + openDelay: 0, +} as unknown as ComponentProps; + export const Context = ({ usedTokens, maxTokens, @@ -56,7 +66,7 @@ export const Context = ({ return ( - + ); }; diff --git a/packages/elements/src/inline-citation.tsx b/packages/elements/src/inline-citation.tsx index 171c81cf..a6ec9790 100644 --- a/packages/elements/src/inline-citation.tsx +++ b/packages/elements/src/inline-citation.tsx @@ -49,8 +49,18 @@ export const InlineCitationText = ({ export type InlineCitationCardProps = ComponentProps; +// Open/close with no delay. Radix's HoverCard takes these props; Base UI's +// PreviewCard — what `shadcn add` swaps in on a Base UI project — has neither, +// so naming them in a typed position fails to compile there. Spreading keeps the +// behaviour on Radix and is inert on Base UI. A caller's own props still win, +// since they spread last. +const NO_DELAY = { + closeDelay: 0, + openDelay: 0, +} as unknown as ComponentProps; + export const InlineCitationCard = (props: InlineCitationCardProps) => ( - + ); export type InlineCitationCardTriggerProps = ComponentProps & { diff --git a/packages/elements/src/prompt-input.tsx b/packages/elements/src/prompt-input.tsx index 412c846d..d7b7306d 100644 --- a/packages/elements/src/prompt-input.tsx +++ b/packages/elements/src/prompt-input.tsx @@ -1317,12 +1317,18 @@ export const PromptInputSelectValue = ({ export type PromptInputHoverCardProps = ComponentProps; -export const PromptInputHoverCard = ({ - openDelay = 0, - closeDelay = 0, - ...props -}: PromptInputHoverCardProps) => ( - +// Open/close with no delay. Radix's HoverCard takes these props; Base UI's +// PreviewCard — what `shadcn add` swaps in on a Base UI project — has neither, +// so naming them in a typed position fails to compile there. Spreading keeps the +// behaviour on Radix and is inert on Base UI. A caller's own props still win, +// since they spread last. +const NO_DELAY = { + closeDelay: 0, + openDelay: 0, +} as unknown as ComponentProps; + +export const PromptInputHoverCard = (props: PromptInputHoverCardProps) => ( + ); export type PromptInputHoverCardTriggerProps = ComponentProps<