{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "quote",
  "type": "registry:component",
  "title": "Quote",
  "description": "Select and quote message text with a floating toolbar and a composer preview.",
  "dependencies": [
    "@assistant-ui/react",
    "lucide-react"
  ],
  "registryDependencies": [],
  "files": [
    {
      "type": "registry:component",
      "path": "components/assistant-ui/elements/quote.aui.tsx",
      "sourcePath": "packages/ui/src/components/react/assistant-ui/elements/quote.aui.tsx",
      "content": "\"use client\";\n\nimport { memo, type ComponentProps, type FC } from \"react\";\nimport type { QuoteMessagePartComponent } from \"@assistant-ui/react\";\nimport {\n  ComposerPrimitive,\n  SelectionToolbarPrimitive,\n} from \"@assistant-ui/react\";\nimport { QuoteIcon, XIcon } from \"lucide-react\";\nimport { cn } from \"@/lib/utils\";\n\nfunction QuoteBlockRoot({ className, ...props }: ComponentProps<\"div\">) {\n  return (\n    <div\n      data-slot=\"quote-block\"\n      className={cn(\"mb-2 flex items-start gap-1.5\", className)}\n      {...props}\n    />\n  );\n}\n\nfunction QuoteBlockIcon({\n  className,\n  ...props\n}: ComponentProps<typeof QuoteIcon>) {\n  return (\n    <QuoteIcon\n      data-slot=\"quote-block-icon\"\n      className={cn(\n        \"text-muted-foreground/60 mt-0.5 size-3 shrink-0\",\n        className,\n      )}\n      {...props}\n    />\n  );\n}\n\nfunction QuoteBlockText({ className, ...props }: ComponentProps<\"p\">) {\n  return (\n    <p\n      data-slot=\"quote-block-text\"\n      className={cn(\n        \"text-muted-foreground/80 line-clamp-2 min-w-0 text-sm italic\",\n        className,\n      )}\n      {...props}\n    />\n  );\n}\n\n/**\n * Renders quoted text in user messages.\n *\n * Pass this to `MessagePrimitive.Parts` as the `Quote` renderer.\n *\n * @example\n * ```tsx\n * <MessagePrimitive.Quote>\n *   {(quote) => <QuoteBlock {...quote} />}\n * </MessagePrimitive.Quote>\n * ```\n */\nconst QuoteBlockImpl: QuoteMessagePartComponent = ({ text }) => {\n  return (\n    <QuoteBlockRoot>\n      <QuoteBlockIcon />\n      <QuoteBlockText>{text}</QuoteBlockText>\n    </QuoteBlockRoot>\n  );\n};\n\nconst QuoteBlock = memo(\n  QuoteBlockImpl,\n) as unknown as QuoteMessagePartComponent & {\n  Root: typeof QuoteBlockRoot;\n  Icon: typeof QuoteBlockIcon;\n  Text: typeof QuoteBlockText;\n};\n\nQuoteBlock.displayName = \"QuoteBlock\";\nQuoteBlock.Root = QuoteBlockRoot;\nQuoteBlock.Icon = QuoteBlockIcon;\nQuoteBlock.Text = QuoteBlockText;\n\nfunction SelectionToolbarRoot({\n  className,\n  ...props\n}: ComponentProps<typeof SelectionToolbarPrimitive.Root>) {\n  return (\n    <SelectionToolbarPrimitive.Root\n      data-slot=\"selection-toolbar\"\n      className={cn(\n        \"bg-popover flex items-center gap-1 rounded-lg border px-1 py-1\",\n        className,\n      )}\n      {...props}\n    />\n  );\n}\n\nfunction SelectionToolbarQuote({\n  className,\n  children,\n  ...props\n}: ComponentProps<typeof SelectionToolbarPrimitive.Quote>) {\n  return (\n    <SelectionToolbarPrimitive.Quote\n      data-slot=\"selection-toolbar-quote\"\n      className={cn(\n        \"text-popover-foreground hover:bg-accent flex items-center gap-1.5 rounded-md px-2.5 py-1 text-sm transition-colors\",\n        className,\n      )}\n      {...props}\n    >\n      {children ?? (\n        <>\n          <QuoteIcon className=\"size-3.5\" />\n          Quote\n        </>\n      )}\n    </SelectionToolbarPrimitive.Quote>\n  );\n}\n\n/**\n * Floating toolbar that appears when text is selected in a message.\n *\n * Render anywhere inside `ThreadPrimitive.Root` (or any `AssistantRuntimeProvider` scope).\n *\n * @example\n * ```tsx\n * <ThreadPrimitive.Root>\n *   <ThreadPrimitive.Viewport>...</ThreadPrimitive.Viewport>\n *   <SelectionToolbar />\n * </ThreadPrimitive.Root>\n * ```\n */\nconst SelectionToolbarImpl: FC<ComponentProps<typeof SelectionToolbarRoot>> = ({\n  className,\n  ...props\n}) => {\n  return (\n    <SelectionToolbarRoot className={className} {...props}>\n      <SelectionToolbarQuote />\n    </SelectionToolbarRoot>\n  );\n};\n\nconst SelectionToolbar = memo(\n  SelectionToolbarImpl,\n) as unknown as typeof SelectionToolbarImpl & {\n  Root: typeof SelectionToolbarRoot;\n  Quote: typeof SelectionToolbarQuote;\n};\n\nSelectionToolbar.displayName = \"SelectionToolbar\";\nSelectionToolbar.Root = SelectionToolbarRoot;\nSelectionToolbar.Quote = SelectionToolbarQuote;\n\nfunction ComposerQuotePreviewRoot({\n  className,\n  ...props\n}: ComponentProps<typeof ComposerPrimitive.Quote>) {\n  return (\n    <ComposerPrimitive.Quote\n      data-slot=\"composer-quote\"\n      className={cn(\n        \"bg-muted/60 mx-3 mt-2 flex items-start gap-2 rounded-lg px-3 py-2\",\n        className,\n      )}\n      {...props}\n    />\n  );\n}\n\nfunction ComposerQuotePreviewIcon({\n  className,\n  ...props\n}: ComponentProps<typeof QuoteIcon>) {\n  return (\n    <QuoteIcon\n      data-slot=\"composer-quote-icon\"\n      className={cn(\n        \"text-muted-foreground/70 mt-0.5 size-3.5 shrink-0\",\n        className,\n      )}\n      {...props}\n    />\n  );\n}\n\nfunction ComposerQuotePreviewText({\n  className,\n  ...props\n}: ComponentProps<typeof ComposerPrimitive.QuoteText>) {\n  return (\n    <ComposerPrimitive.QuoteText\n      data-slot=\"composer-quote-text\"\n      className={cn(\n        \"text-muted-foreground line-clamp-2 min-w-0 flex-1 text-sm\",\n        className,\n      )}\n      {...props}\n    />\n  );\n}\n\nfunction ComposerQuotePreviewDismiss({\n  className,\n  children,\n  ...props\n}: ComponentProps<typeof ComposerPrimitive.QuoteDismiss>) {\n  const defaultClassName =\n    \"shrink-0 rounded-sm p-0.5 text-muted-foreground/70 transition-colors hover:bg-accent hover:text-foreground\";\n\n  return (\n    <ComposerPrimitive.QuoteDismiss\n      data-slot=\"composer-quote-dismiss\"\n      asChild\n      className={children ? className : undefined}\n      {...props}\n    >\n      {children ?? (\n        <button\n          type=\"button\"\n          aria-label=\"Dismiss quote\"\n          className={cn(defaultClassName, className)}\n        >\n          <XIcon className=\"size-3.5\" />\n        </button>\n      )}\n    </ComposerPrimitive.QuoteDismiss>\n  );\n}\n\n/**\n * Quote preview inside the composer. Only renders when a quote is set.\n *\n * Place inside `ComposerPrimitive.Root`.\n *\n * @example\n * ```tsx\n * <ComposerPrimitive.Root>\n *   <ComposerQuotePreview />\n *   <ComposerPrimitive.Input />\n *   <ComposerPrimitive.Send />\n * </ComposerPrimitive.Root>\n * ```\n */\nconst ComposerQuotePreviewImpl: FC<\n  ComponentProps<typeof ComposerQuotePreviewRoot>\n> = ({ className, ...props }) => {\n  return (\n    <ComposerQuotePreviewRoot className={className} {...props}>\n      <ComposerQuotePreviewIcon />\n      <ComposerQuotePreviewText />\n      <ComposerQuotePreviewDismiss />\n    </ComposerQuotePreviewRoot>\n  );\n};\n\nconst ComposerQuotePreview = memo(\n  ComposerQuotePreviewImpl,\n) as unknown as typeof ComposerQuotePreviewImpl & {\n  Root: typeof ComposerQuotePreviewRoot;\n  Icon: typeof ComposerQuotePreviewIcon;\n  Text: typeof ComposerQuotePreviewText;\n  Dismiss: typeof ComposerQuotePreviewDismiss;\n};\n\nComposerQuotePreview.displayName = \"ComposerQuotePreview\";\nComposerQuotePreview.Root = ComposerQuotePreviewRoot;\nComposerQuotePreview.Icon = ComposerQuotePreviewIcon;\nComposerQuotePreview.Text = ComposerQuotePreviewText;\nComposerQuotePreview.Dismiss = ComposerQuotePreviewDismiss;\n\nexport {\n  QuoteBlock,\n  QuoteBlockRoot,\n  QuoteBlockIcon,\n  QuoteBlockText,\n  SelectionToolbar,\n  SelectionToolbarRoot,\n  SelectionToolbarQuote,\n  ComposerQuotePreview,\n  ComposerQuotePreviewRoot,\n  ComposerQuotePreviewIcon,\n  ComposerQuotePreviewText,\n  ComposerQuotePreviewDismiss,\n};\n"
    }
  ]
}