@tylertech/forge-ai-react
Advanced tools
| import React from "react"; | ||
| import { ForgeAiChatbotLauncher as ForgeAiChatbotLauncherElement } from "@tylertech/forge-ai/ai-chatbot-launcher"; | ||
| export type { ForgeAiChatbotLauncherElement }; | ||
| export interface ForgeAiChatbotLauncherProps extends Pick< | ||
| React.AllHTMLAttributes<HTMLElement>, | ||
| | "children" | ||
| | "dir" | ||
| | "hidden" | ||
| | "id" | ||
| | "lang" | ||
| | "slot" | ||
| | "style" | ||
| | "title" | ||
| | "translate" | ||
| | "onClick" | ||
| | "onFocus" | ||
| | "onBlur" | ||
| > { | ||
| /** undefined */ | ||
| enableReactions?: boolean; | ||
| /** undefined */ | ||
| debugMode?: boolean; | ||
| /** The description text displayed below the title in the welcome view. */ | ||
| descriptionText?: ForgeAiChatbotLauncherElement["descriptionText"]; | ||
| /** undefined */ | ||
| fileUpload?: ForgeAiChatbotLauncherElement["fileUpload"]; | ||
| /** undefined */ | ||
| voiceInput?: ForgeAiChatbotLauncherElement["voiceInput"]; | ||
| /** undefined */ | ||
| placeholder?: ForgeAiChatbotLauncherElement["placeholder"]; | ||
| /** undefined */ | ||
| titleText?: ForgeAiChatbotLauncherElement["titleText"]; | ||
| /** undefined */ | ||
| headingLevel?: ForgeAiChatbotLauncherElement["headingLevel"]; | ||
| /** undefined */ | ||
| disclaimerText?: ForgeAiChatbotLauncherElement["disclaimerText"]; | ||
| /** undefined */ | ||
| debugCommand?: ForgeAiChatbotLauncherElement["debugCommand"]; | ||
| /** undefined */ | ||
| selectedAgentId?: ForgeAiChatbotLauncherElement["selectedAgentId"]; | ||
| /** A space-separated list of the classes of the element. Classes allows CSS and JavaScript to select and access specific elements via the class selectors or functions like the method `Document.getElementsByClassName()`. */ | ||
| className?: string; | ||
| /** Contains a space-separated list of the part names of the element that should be exposed on the host element. */ | ||
| exportparts?: string; | ||
| /** Used for labels to link them with their inputs (using input id). */ | ||
| htmlFor?: string; | ||
| /** Used to help React identify which items have changed, are added, or are removed within a list. */ | ||
| key?: number | string; | ||
| /** Contains a space-separated list of the part names of the element. Part names allows CSS to select and style specific elements in a shadow tree via the ::part pseudo-element. */ | ||
| part?: string; | ||
| /** A mutable ref object whose `.current` property is initialized to the passed argument (`initialValue`). The returned object will persist for the full lifetime of the component. */ | ||
| ref?: any; | ||
| /** Allows developers to make HTML elements focusable, allow or prevent them from being sequentially focusable (usually with the `Tab` key, hence the name) and determine their relative ordering for sequential focus navigation. */ | ||
| tabIndex?: number; | ||
| /** Agent metadata for info dialog */ | ||
| agentInfo?: ForgeAiChatbotLauncherElement["agentInfo"]; | ||
| /** List of available agents for selector */ | ||
| agents?: ForgeAiChatbotLauncherElement["agents"]; | ||
| /** Fired when adapter connects */ | ||
| onForgeAiChatbotConnected?: (event: CustomEvent<CustomEvent<void>>) => void; | ||
| /** Fired when user sends a message */ | ||
| onForgeAiChatbotMessageSent?: ( | ||
| event: CustomEvent<CustomEvent<ForgeAiChatbotMessageEventData>>, | ||
| ) => void; | ||
| /** Fired when assistant message is complete */ | ||
| onForgeAiChatbotMessageReceived?: ( | ||
| event: CustomEvent<CustomEvent<ForgeAiChatbotMessageEventData>>, | ||
| ) => void; | ||
| /** Fired when a tool needs to be executed */ | ||
| onForgeAiChatbotToolCall?: ( | ||
| event: CustomEvent<CustomEvent<ForgeAiChatbotToolCallEventData>>, | ||
| ) => void; | ||
| /** Fired when an error occurs */ | ||
| onForgeAiChatbotError?: ( | ||
| event: CustomEvent<CustomEvent<ForgeAiChatbotErrorEventData>>, | ||
| ) => void; | ||
| /** Fired when transitioning from welcome to conversation view */ | ||
| onForgeAiChatbotLauncherConversationStart?: ( | ||
| event: CustomEvent<CustomEvent<void>>, | ||
| ) => void; | ||
| /** Fired when user provides feedback on a response */ | ||
| onForgeAiChatbotResponseFeedback?: ( | ||
| event: CustomEvent<CustomEvent<ForgeAiChatbotResponseFeedbackEventData>>, | ||
| ) => void; | ||
| /** Fired when header info option is selected */ | ||
| onForgeAiChatbotInfo?: (event: CustomEvent<CustomEvent<void>>) => void; | ||
| /** Fired when agent selection changes */ | ||
| onForgeAiChatbotAgentChange?: ( | ||
| event: CustomEvent<CustomEvent<ForgeAiChatbotAgentChangeEventData>>, | ||
| ) => void; | ||
| } | ||
| /** | ||
| * An embedded AI chatbot component with a welcome view that transitions to conversation mode. | ||
| * --- | ||
| * | ||
| * | ||
| * ### **Events:** | ||
| * - **forge-ai-chatbot-connected** - Fired when adapter connects | ||
| * - **forge-ai-chatbot-message-sent** - Fired when user sends a message | ||
| * - **forge-ai-chatbot-message-received** - Fired when assistant message is complete | ||
| * - **forge-ai-chatbot-tool-call** - Fired when a tool needs to be executed | ||
| * - **forge-ai-chatbot-error** - Fired when an error occurs | ||
| * - **forge-ai-chatbot-launcher-conversation-start** - Fired when transitioning from welcome to conversation view | ||
| * - **forge-ai-chatbot-response-feedback** - Fired when user provides feedback on a response | ||
| * - **forge-ai-chatbot-info** - Fired when header info option is selected | ||
| * - **forge-ai-chatbot-agent-change** - Fired when agent selection changes | ||
| * | ||
| * ### **Slots:** | ||
| * - **icon** - Slot for custom icon (used in both welcome view and conversation header) | ||
| * - **heading** - Slot for custom heading content | ||
| * - **description** - Slot for custom description/welcome message below the title | ||
| * | ||
| * ### **CSS Properties:** | ||
| * - **--forge-ai-chatbot-launcher-icon-color** - The fill color for the AI icon. _(default: undefined)_ | ||
| */ | ||
| export const ForgeAiChatbotLauncher: React.ForwardRefExoticComponent<ForgeAiChatbotLauncherProps>; |
| import React, { forwardRef, useRef, useEffect } from "react"; | ||
| import "@tylertech/forge-ai/ai-chatbot-launcher"; | ||
| import { useEventListener, useProperties } from "./react-utils.js"; | ||
| export const ForgeAiChatbotLauncher = forwardRef((props, forwardedRef) => { | ||
| const ref = useRef(null); | ||
| const { | ||
| enableReactions, | ||
| debugMode, | ||
| descriptionText, | ||
| fileUpload, | ||
| voiceInput, | ||
| placeholder, | ||
| titleText, | ||
| headingLevel, | ||
| disclaimerText, | ||
| debugCommand, | ||
| selectedAgentId, | ||
| agentInfo, | ||
| agents, | ||
| ...filteredProps | ||
| } = props; | ||
| /** Event listeners - run once */ | ||
| useEventListener( | ||
| ref, | ||
| "forge-ai-chatbot-connected", | ||
| props.onForgeAiChatbotConnected, | ||
| ); | ||
| useEventListener( | ||
| ref, | ||
| "forge-ai-chatbot-message-sent", | ||
| props.onForgeAiChatbotMessageSent, | ||
| ); | ||
| useEventListener( | ||
| ref, | ||
| "forge-ai-chatbot-message-received", | ||
| props.onForgeAiChatbotMessageReceived, | ||
| ); | ||
| useEventListener( | ||
| ref, | ||
| "forge-ai-chatbot-tool-call", | ||
| props.onForgeAiChatbotToolCall, | ||
| ); | ||
| useEventListener(ref, "forge-ai-chatbot-error", props.onForgeAiChatbotError); | ||
| useEventListener( | ||
| ref, | ||
| "forge-ai-chatbot-launcher-conversation-start", | ||
| props.onForgeAiChatbotLauncherConversationStart, | ||
| ); | ||
| useEventListener( | ||
| ref, | ||
| "forge-ai-chatbot-response-feedback", | ||
| props.onForgeAiChatbotResponseFeedback, | ||
| ); | ||
| useEventListener(ref, "forge-ai-chatbot-info", props.onForgeAiChatbotInfo); | ||
| useEventListener( | ||
| ref, | ||
| "forge-ai-chatbot-agent-change", | ||
| props.onForgeAiChatbotAgentChange, | ||
| ); | ||
| /** Properties - run whenever a property has changed */ | ||
| useProperties(ref, "agentInfo", props.agentInfo); | ||
| useProperties(ref, "agents", props.agents); | ||
| return React.createElement( | ||
| "forge-ai-chatbot-launcher", | ||
| { | ||
| ref: (node) => { | ||
| ref.current = node; | ||
| if (typeof forwardedRef === "function") { | ||
| forwardedRef(node); | ||
| } else if (forwardedRef) { | ||
| forwardedRef.current = node; | ||
| } | ||
| }, | ||
| ...filteredProps, | ||
| "description-text": props.descriptionText || props["description-text"], | ||
| "file-upload": props.fileUpload || props["file-upload"], | ||
| "voice-input": props.voiceInput || props["voice-input"], | ||
| placeholder: props.placeholder, | ||
| "title-text": props.titleText || props["title-text"], | ||
| "heading-level": props.headingLevel || props["heading-level"], | ||
| "disclaimer-text": props.disclaimerText || props["disclaimer-text"], | ||
| "debug-command": props.debugCommand || props["debug-command"], | ||
| "selected-agent-id": props.selectedAgentId || props["selected-agent-id"], | ||
| class: props.className, | ||
| exportparts: props.exportparts, | ||
| for: props.htmlFor, | ||
| part: props.part, | ||
| tabindex: props.tabIndex, | ||
| "enable-reactions": props.enableReactions ? true : undefined, | ||
| "debug-mode": props.debugMode ? true : undefined, | ||
| style: { ...props.style }, | ||
| }, | ||
| props.children, | ||
| ); | ||
| }); |
@@ -37,2 +37,5 @@ import React from "react"; | ||
| /** undefined */ | ||
| minimizeIcon?: ForgeAiChatbotElement["minimizeIcon"]; | ||
| /** undefined */ | ||
| fileUpload?: ForgeAiChatbotElement["fileUpload"]; | ||
@@ -44,20 +47,17 @@ | ||
| /** undefined */ | ||
| debugCommand?: ForgeAiChatbotElement["debugCommand"]; | ||
| /** undefined */ | ||
| placeholder?: ForgeAiChatbotElement["placeholder"]; | ||
| /** undefined */ | ||
| minimizeIcon?: ForgeAiChatbotElement["minimizeIcon"]; | ||
| /** The title text to display in the header (default: 'AI Assistant') */ | ||
| titleText?: ForgeAiChatbotElement["titleText"]; | ||
| /** Controls the heading level for the title content (default: 2) */ | ||
| /** undefined */ | ||
| headingLevel?: ForgeAiChatbotElement["headingLevel"]; | ||
| /** The disclaimer text to display below the prompt. Set to empty string, null, or undefined to hide. */ | ||
| /** undefined */ | ||
| disclaimerText?: ForgeAiChatbotElement["disclaimerText"]; | ||
| /** undefined */ | ||
| debugCommand?: ForgeAiChatbotElement["debugCommand"]; | ||
| /** undefined */ | ||
| selectedAgentId?: ForgeAiChatbotElement["selectedAgentId"]; | ||
@@ -133,3 +133,3 @@ | ||
| /** | ||
| * A complete, self-contained AI chatbot component that implements the AG-UI protocol using an adapter pattern. | ||
| * A complete, self-contained AI chatbot component. | ||
| * --- | ||
@@ -151,13 +151,2 @@ * | ||
| * | ||
| * ### **Methods:** | ||
| * - **clearMessages(): _void_** - Clears all messages from the chat history. | ||
| * - **getMessages(): __** - Gets the current message history. | ||
| * - **setMessages(messages: _ChatMessage[]_): _void_** - Sets the message history. Useful for restoring conversation state. | ||
| * - **getSelectedAgent(): __** - Gets the currently selected agent. | ||
| * - **sendMessage(content: _string_, files: _File[]_): _Promise<void>_** - Programmatically sends a message as the user. | ||
| * - **abort(): _void_** - Aborts the current streaming response. | ||
| * - **scrollToBottom({ behavior }: _{ behavior?: ScrollBehavior }_): _Promise<void>_** - Scrolls the chat interface to the bottom. | ||
| * - **getThreadState(): __** - Gets the complete serializable thread state including threadId and messages. | ||
| * - **setThreadState(state: _ThreadState_): _Promise<void>_** - Restores thread state from a serialized ThreadState object. | ||
| * | ||
| * ### **Slots:** | ||
@@ -164,0 +153,0 @@ * - **header** - Slot for custom header content |
@@ -13,10 +13,10 @@ import React, { forwardRef, useRef, useEffect } from "react"; | ||
| debugMode, | ||
| minimizeIcon, | ||
| fileUpload, | ||
| voiceInput, | ||
| debugCommand, | ||
| placeholder, | ||
| minimizeIcon, | ||
| titleText, | ||
| headingLevel, | ||
| disclaimerText, | ||
| debugCommand, | ||
| selectedAgentId, | ||
@@ -83,10 +83,10 @@ ...filteredProps | ||
| ...filteredProps, | ||
| "minimize-icon": props.minimizeIcon || props["minimize-icon"], | ||
| "file-upload": props.fileUpload || props["file-upload"], | ||
| "voice-input": props.voiceInput || props["voice-input"], | ||
| "debug-command": props.debugCommand || props["debug-command"], | ||
| placeholder: props.placeholder, | ||
| "minimize-icon": props.minimizeIcon || props["minimize-icon"], | ||
| "title-text": props.titleText || props["title-text"], | ||
| "heading-level": props.headingLevel || props["heading-level"], | ||
| "disclaimer-text": props.disclaimerText || props["disclaimer-text"], | ||
| "debug-command": props.debugCommand || props["debug-command"], | ||
| "selected-agent-id": props.selectedAgentId || props["selected-agent-id"], | ||
@@ -93,0 +93,0 @@ class: props.className, |
@@ -89,3 +89,6 @@ import React from "react"; | ||
| * - **empty-state-actions** - Slot for custom empty state actions (e.g., suggestions) | ||
| * | ||
| * ### **CSS Properties:** | ||
| * - **--forge-ai-message-thread-content-max-width** - Controls the max-width of the message content area while keeping the scroll container full width. _(default: undefined)_ | ||
| */ | ||
| export const ForgeAiMessageThread: React.ForwardRefExoticComponent<ForgeAiMessageThreadProps>; |
+9
-8
| export * from "./ForgeAiAgentInfo.js"; | ||
| export * from "./ForgeAiArtifact.js"; | ||
| export * from "./ForgeAiAgentSelector.js"; | ||
| export * from "./ForgeAiArtifact.js"; | ||
| export * from "./ForgeAiAssistantResponse.js"; | ||
| export * from "./ForgeAiAttachment.js"; | ||
| export * from "./ForgeAiButton.js"; | ||
| export * from "./ForgeAiChatHeader.js"; | ||
| export * from "./ForgeAiChainOfThought.js"; | ||
| export * from "./ForgeAiChatHeader.js"; | ||
| export * from "./ForgeAiChatInterface.js"; | ||
| export * from "./ForgeAiChatbotToolCall.js"; | ||
| export * from "./ForgeAiChatbot.js"; | ||
| export * from "./ForgeAiChatbotLauncher.js"; | ||
| export * from "./ForgeAiConfirmationPrompt.js"; | ||
@@ -20,4 +21,4 @@ export * from "./ForgeAiDialog.js"; | ||
| export * from "./ForgeAiEmptyState.js"; | ||
| export * from "./ForgeAiEventStreamViewer.js"; | ||
| export * from "./ForgeAiErrorMessage.js"; | ||
| export * from "./ForgeAiEventStreamViewer.js"; | ||
| export * from "./ForgeAiFab.js"; | ||
@@ -31,9 +32,9 @@ export * from "./ForgeAiFilePicker.js"; | ||
| export * from "./ForgeAiModal.js"; | ||
| export * from "./ForgeAiReasoning.js"; | ||
| export * from "./ForgeAiPrompt.js"; | ||
| export * from "./ForgeAiReasoning.js"; | ||
| export * from "./ForgeAiReasoningHeader.js"; | ||
| export * from "./ForgeAiResponseMessage.js"; | ||
| export * from "./ForgeAiResponseMessageToolbar.js"; | ||
| export * from "./ForgeAiSidebarChat.js"; | ||
| export * from "./ForgeAiSidebar.js"; | ||
| export * from "./ForgeAiSidebarChat.js"; | ||
| export * from "./ForgeAiSlashCommandMenu.js"; | ||
@@ -45,5 +46,5 @@ export * from "./ForgeAiSpinner.js"; | ||
| export * from "./ForgeAiToolCallIndicator.js"; | ||
| export * from "./ForgeAiUserMessageToolbar.js"; | ||
| export * from "./ForgeAiUserMessage.js"; | ||
| export * from "./ForgeAiVoiceInput.js"; | ||
| export * from "./ForgeAiUserMessageToolbar.js"; | ||
| export * from "./ForgeAiThoughtBase.js"; | ||
@@ -53,8 +54,8 @@ export * from "./ForgeAiThoughtDetail.js"; | ||
| export * from "./ForgeAiThoughtSearchResult.js"; | ||
| export * from "./ForgeAiReasoningContent.js"; | ||
| export * from "./ForgePromptButton.js"; | ||
| export * from "./ForgeAiReasoningContent.js"; | ||
| export * from "./ForgeAiOverlay.js"; | ||
| export * from "./ForgeAiPopover.js"; | ||
| export * from "./ForgeAiPaginator.js"; | ||
| export * from "./ForgeAiTooltip.js"; | ||
| export * from "./ForgeAiToolDataTable.js"; | ||
| export * from "./ForgeAiPaginator.js"; |
+9
-8
| export * from "./ForgeAiAgentInfo.js"; | ||
| export * from "./ForgeAiArtifact.js"; | ||
| export * from "./ForgeAiAgentSelector.js"; | ||
| export * from "./ForgeAiArtifact.js"; | ||
| export * from "./ForgeAiAssistantResponse.js"; | ||
| export * from "./ForgeAiAttachment.js"; | ||
| export * from "./ForgeAiButton.js"; | ||
| export * from "./ForgeAiChatHeader.js"; | ||
| export * from "./ForgeAiChainOfThought.js"; | ||
| export * from "./ForgeAiChatHeader.js"; | ||
| export * from "./ForgeAiChatInterface.js"; | ||
| export * from "./ForgeAiChatbotToolCall.js"; | ||
| export * from "./ForgeAiChatbot.js"; | ||
| export * from "./ForgeAiChatbotLauncher.js"; | ||
| export * from "./ForgeAiConfirmationPrompt.js"; | ||
@@ -20,4 +21,4 @@ export * from "./ForgeAiDialog.js"; | ||
| export * from "./ForgeAiEmptyState.js"; | ||
| export * from "./ForgeAiEventStreamViewer.js"; | ||
| export * from "./ForgeAiErrorMessage.js"; | ||
| export * from "./ForgeAiEventStreamViewer.js"; | ||
| export * from "./ForgeAiFab.js"; | ||
@@ -31,9 +32,9 @@ export * from "./ForgeAiFilePicker.js"; | ||
| export * from "./ForgeAiModal.js"; | ||
| export * from "./ForgeAiReasoning.js"; | ||
| export * from "./ForgeAiPrompt.js"; | ||
| export * from "./ForgeAiReasoning.js"; | ||
| export * from "./ForgeAiReasoningHeader.js"; | ||
| export * from "./ForgeAiResponseMessage.js"; | ||
| export * from "./ForgeAiResponseMessageToolbar.js"; | ||
| export * from "./ForgeAiSidebarChat.js"; | ||
| export * from "./ForgeAiSidebar.js"; | ||
| export * from "./ForgeAiSidebarChat.js"; | ||
| export * from "./ForgeAiSlashCommandMenu.js"; | ||
@@ -45,5 +46,5 @@ export * from "./ForgeAiSpinner.js"; | ||
| export * from "./ForgeAiToolCallIndicator.js"; | ||
| export * from "./ForgeAiUserMessageToolbar.js"; | ||
| export * from "./ForgeAiUserMessage.js"; | ||
| export * from "./ForgeAiVoiceInput.js"; | ||
| export * from "./ForgeAiUserMessageToolbar.js"; | ||
| export * from "./ForgeAiThoughtBase.js"; | ||
@@ -53,8 +54,8 @@ export * from "./ForgeAiThoughtDetail.js"; | ||
| export * from "./ForgeAiThoughtSearchResult.js"; | ||
| export * from "./ForgeAiReasoningContent.js"; | ||
| export * from "./ForgePromptButton.js"; | ||
| export * from "./ForgeAiReasoningContent.js"; | ||
| export * from "./ForgeAiOverlay.js"; | ||
| export * from "./ForgeAiPopover.js"; | ||
| export * from "./ForgeAiPaginator.js"; | ||
| export * from "./ForgeAiTooltip.js"; | ||
| export * from "./ForgeAiToolDataTable.js"; | ||
| export * from "./ForgeAiPaginator.js"; |
+10
-10
| { | ||
| "name": "@tylertech/forge-ai-react", | ||
| "version": "0.10.0", | ||
| "version": "0.11.0", | ||
| "description": "A React adapter for Tyler Forge™ AI Web Components.", | ||
@@ -19,3 +19,3 @@ "repository": "tyler-technologies-oss/forge-ai", | ||
| "react": ">=17.0.0", | ||
| "@tylertech/forge-ai": "^0.10.0" | ||
| "@tylertech/forge-ai": "^0.11.0" | ||
| }, | ||
@@ -27,4 +27,4 @@ "devDependencies": { | ||
| "@tylertech/forge-react": "^3.2.0", | ||
| "@tylertech/tyler-icons": "2.0.4", | ||
| "@types/node": "25.0.3", | ||
| "@tylertech/tyler-icons": "2.1.0", | ||
| "@types/node": "25.5.0", | ||
| "@types/react": "^18.3.27", | ||
@@ -37,4 +37,4 @@ "@types/react-dom": "^18.3.7", | ||
| "custom-element-react-wrappers": "^1.7.3", | ||
| "eslint": "9.39.2", | ||
| "eslint-plugin-prettier": "5.5.4", | ||
| "eslint": "9.39.4", | ||
| "eslint-plugin-prettier": "5.5.5", | ||
| "react": "^17.0.2", | ||
@@ -45,8 +45,8 @@ "react-dom": "^17.0.2", | ||
| "react-router-dom": "^5.3.4", | ||
| "rimraf": "6.1.2", | ||
| "rimraf": "6.1.3", | ||
| "sass": "1.93.3", | ||
| "typescript": "~5.8.3", | ||
| "vite": "7.3.0", | ||
| "vite-tsconfig-paths": "6.0.3", | ||
| "@tylertech/forge-ai": "^0.10.0" | ||
| "vite": "7.3.1", | ||
| "vite-tsconfig-paths": "6.0.5", | ||
| "@tylertech/forge-ai": "^0.11.0" | ||
| }, | ||
@@ -53,0 +53,0 @@ "scripts": { |
228487
3.47%120
1.69%5328
4%