@tylertech/forge-ai-react 0.2.0 → 0.4.0

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.
@@ -42,7 +42,7 @@ export interface ForgeAiActionsToolbarProps
42
42
 
43
43
  /** Fired when an action button is clicked. The detail contains the action type. */
44
44
  onForgeAiActionsToolbarAction?: (
45
- event: CustomEvent<CustomEvent<AiActionsToolbarActionEventData>>,
45
+ event: CustomEvent<CustomEvent<ForgeAiActionsToolbarActionEventData>>,
46
46
  ) => void;
47
47
  }
48
48
 
@@ -31,7 +31,16 @@ export interface ForgeAiChatHeaderProps
31
31
  /** Indicates the current expanded state for displaying the appropriate expand/collapse icon */
32
32
  expanded?: boolean;
33
33
 
34
- /** Controls which minimize icon to display */
34
+ /** Controls whether the dropdown menu is visible (default: true) */
35
+ showDropdownMenu?: boolean;
36
+
37
+ /** Controls whether the clear chat menu item is visible (default: true) */
38
+ showClearChat?: boolean;
39
+
40
+ /** Controls whether the info menu item is visible (default: true) */
41
+ showInfo?: boolean;
42
+
43
+ /** Controls which minimize icon to display ('default' | 'panel') */
35
44
  minimizeIcon?: ForgeAiChatHeaderElement["minimizeIcon"];
36
45
 
37
46
  /** 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()`. */
@@ -80,6 +89,7 @@ export interface ForgeAiChatHeaderProps
80
89
  * - **forge-ai-chat-header-minimize** - Fired when the minimize button is clicked
81
90
  *
82
91
  * ### **Slots:**
83
- * - **title** - Slot for custom title text (default: "AI Assistant")
92
+ * - **icon** - Slot for custom icon (default: forge-ai-icon)
93
+ * - **title** - Slot for custom title text (default: "AI Assistant")
84
94
  */
85
95
  export const ForgeAiChatHeader: React.ForwardRefExoticComponent<ForgeAiChatHeaderProps>;
@@ -8,6 +8,9 @@ export const ForgeAiChatHeader = forwardRef((props, forwardedRef) => {
8
8
  showExpandButton,
9
9
  showMinimizeButton,
10
10
  expanded,
11
+ showDropdownMenu,
12
+ showClearChat,
13
+ showInfo,
11
14
  minimizeIcon,
12
15
  ...filteredProps
13
16
  } = props;
@@ -55,6 +58,9 @@ export const ForgeAiChatHeader = forwardRef((props, forwardedRef) => {
55
58
  "show-expand-button": props.showExpandButton ? true : undefined,
56
59
  "show-minimize-button": props.showMinimizeButton ? true : undefined,
57
60
  expanded: props.expanded ? true : undefined,
61
+ "show-dropdown-menu": props.showDropdownMenu ? true : undefined,
62
+ "show-clear-chat": props.showClearChat ? true : undefined,
63
+ "show-info": props.showInfo ? true : undefined,
58
64
  style: { ...props.style },
59
65
  },
60
66
  props.children,
@@ -47,7 +47,7 @@ export interface ForgeAiChatInterfaceProps
47
47
  *
48
48
  *
49
49
  * ### **Methods:**
50
- * - **scrollMessagesToBottom(): _void_** - Scrolls the messages container to the bottom only if user hasn't scrolled up
50
+ * - **scrollToBottom(): _void_** - Scrolls the messages container to the bottom with smooth animation
51
51
  *
52
52
  * ### **Slots:**
53
53
  * - _default_ - Default slot for messages
@@ -47,7 +47,8 @@ export interface ForgeAiEmptyStateProps
47
47
  *
48
48
  *
49
49
  * ### **Slots:**
50
- * - _default_ - The custom welcome message content.
50
+ * - _default_ - The welcome message content (default: "Welcome to AI Assistant! Start a conversation by asking a question or describing what you'd like help with.").
51
+ * - **icon** - The custom icon to display instead of the default books graphic.
51
52
  * - **actions** - The actions or suggestions to display below the message.
52
53
  */
53
54
  export const ForgeAiEmptyState: React.ForwardRefExoticComponent<ForgeAiEmptyStateProps>;
@@ -54,7 +54,7 @@ export interface ForgeAiFilePickerProps
54
54
 
55
55
  /** Fired when a file is selected via click or drag & drop. The event detail contains the selected file and timestamp. */
56
56
  onForgeAiFilePickerChange?: (
57
- event: CustomEvent<CustomEvent<AiFilePickerChangeEventData>>,
57
+ event: CustomEvent<CustomEvent<ForgeAiFilePickerChangeEventData>>,
58
58
  ) => void;
59
59
  }
60
60
 
@@ -19,10 +19,25 @@ export interface ForgeAiPromptProps
19
19
  | "onFocus"
20
20
  | "onBlur"
21
21
  > {
22
- /** Placeholder text for the input field */
22
+ /** Whether the send button is disabled */
23
+ sendDisabled?: boolean;
24
+
25
+ /** Whether to autofocus the textarea field when the component renders */
26
+ autofocus?: boolean;
27
+
28
+ /** Whether the textarea field is disabled */
29
+ inputDisabled?: boolean;
30
+
31
+ /** Whether to dispatch escape events when Escape key is pressed */
32
+ cancelOnEscape?: boolean;
33
+
34
+ /** Whether the component is in running state (shows stop button instead of send button) */
35
+ running?: boolean;
36
+
37
+ /** Placeholder text for the textarea field */
23
38
  placeholder?: ForgeAiPromptElement["placeholder"];
24
39
 
25
- /** Current value of the input field */
40
+ /** Current value of the textarea field */
26
41
  value?: ForgeAiPromptElement["value"];
27
42
 
28
43
  /** Layout variant for the prompt component */
@@ -49,10 +64,21 @@ export interface ForgeAiPromptProps
49
64
  /** 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. */
50
65
  tabIndex?: number;
51
66
 
52
- /** Fired when the send button is clicked or Enter is pressed. */
67
+ /** Fired when the send button is clicked or Enter is pressed (without Shift). Cancelable - if cancelled, running state is not set and input is not cleared. */
53
68
  onForgeAiPromptSend?: (
54
- event: CustomEvent<CustomEvent<AiPromptSendEventData>>,
69
+ event: CustomEvent<CustomEvent<ForgeAiPromptSendEventData>>,
55
70
  ) => void;
71
+
72
+ /** Fired when the Escape key is pressed (if cancelOnEscape is true). */
73
+ onForgeAiPromptCancel?: (event: CustomEvent<CustomEvent<void>>) => void;
74
+
75
+ /** Fired when files are pasted into the textarea. */
76
+ onForgeAiPromptAttachment?: (
77
+ event: CustomEvent<CustomEvent<ForgeAiPromptAttachmentEventData>>,
78
+ ) => void;
79
+
80
+ /** Fired when the stop button is clicked. Cancelable - if cancelled, running state remains true. */
81
+ onForgeAiPromptStop?: (event: CustomEvent<CustomEvent<void>>) => void;
56
82
  }
57
83
 
58
84
  /**
@@ -61,7 +87,13 @@ export interface ForgeAiPromptProps
61
87
  *
62
88
  *
63
89
  * ### **Events:**
64
- * - **forge-ai-prompt-send** - Fired when the send button is clicked or Enter is pressed.
90
+ * - **forge-ai-prompt-send** - Fired when the send button is clicked or Enter is pressed (without Shift). Cancelable - if cancelled, running state is not set and input is not cleared.
91
+ * - **forge-ai-prompt-cancel** - Fired when the Escape key is pressed (if cancelOnEscape is true).
92
+ * - **forge-ai-prompt-attachment** - Fired when files are pasted into the textarea.
93
+ * - **forge-ai-prompt-stop** - Fired when the stop button is clicked. Cancelable - if cancelled, running state remains true.
94
+ *
95
+ * ### **Methods:**
96
+ * - **focus(): _void_** - Focuses the textarea element
65
97
  *
66
98
  * ### **Slots:**
67
99
  * - **actions** - Slot for action components that are hidden in inline mode (voice input, file picker, model selectors, web search, etc.)
@@ -4,10 +4,27 @@ import { useEventListener } from "./react-utils.js";
4
4
 
5
5
  export const ForgeAiPrompt = forwardRef((props, forwardedRef) => {
6
6
  const ref = useRef(null);
7
- const { placeholder, value, variant, ...filteredProps } = props;
7
+ const {
8
+ sendDisabled,
9
+ autofocus,
10
+ inputDisabled,
11
+ cancelOnEscape,
12
+ running,
13
+ placeholder,
14
+ value,
15
+ variant,
16
+ ...filteredProps
17
+ } = props;
8
18
 
9
19
  /** Event listeners - run once */
10
20
  useEventListener(ref, "forge-ai-prompt-send", props.onForgeAiPromptSend);
21
+ useEventListener(ref, "forge-ai-prompt-cancel", props.onForgeAiPromptCancel);
22
+ useEventListener(
23
+ ref,
24
+ "forge-ai-prompt-attachment",
25
+ props.onForgeAiPromptAttachment,
26
+ );
27
+ useEventListener(ref, "forge-ai-prompt-stop", props.onForgeAiPromptStop);
11
28
 
12
29
  return React.createElement(
13
30
  "forge-ai-prompt",
@@ -29,6 +46,11 @@ export const ForgeAiPrompt = forwardRef((props, forwardedRef) => {
29
46
  for: props.htmlFor,
30
47
  part: props.part,
31
48
  tabindex: props.tabIndex,
49
+ "send-disabled": props.sendDisabled ? true : undefined,
50
+ autofocus: props.autofocus ? true : undefined,
51
+ "input-disabled": props.inputDisabled ? true : undefined,
52
+ "cancel-on-escape": props.cancelOnEscape ? true : undefined,
53
+ running: props.running ? true : undefined,
32
54
  style: { ...props.style },
33
55
  },
34
56
  props.children,
@@ -42,7 +42,7 @@ export interface ForgeAiResponseMessageProps
42
42
 
43
43
  /** Fired when an action button is clicked. */
44
44
  onForgeAiResponseMessageAction?: (
45
- event: CustomEvent<CustomEvent<AiResponseMessageActionEventData>>,
45
+ event: CustomEvent<CustomEvent<ForgeAiResponseMessageActionEventData>>,
46
46
  ) => void;
47
47
  }
48
48
 
@@ -19,9 +19,6 @@ export interface ForgeAiSuggestionsProps
19
19
  | "onFocus"
20
20
  | "onBlur"
21
21
  > {
22
- /** Array of suggestion objects to display */
23
- suggestions?: ForgeAiSuggestionsElement["suggestions"];
24
-
25
22
  /** Display variant for suggestions layout */
26
23
  variant?: ForgeAiSuggestionsElement["variant"];
27
24
 
@@ -46,9 +43,12 @@ export interface ForgeAiSuggestionsProps
46
43
  /** 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. */
47
44
  tabIndex?: number;
48
45
 
46
+ /** Array of suggestion objects to display */
47
+ suggestions?: ForgeAiSuggestionsElement["suggestions"];
48
+
49
49
  /** Fired when a suggestion is selected. */
50
50
  onForgeAiSuggestionsSelect?: (
51
- event: CustomEvent<CustomEvent<AiSuggestionsEventData>>,
51
+ event: CustomEvent<CustomEvent<ForgeAiSuggestionsEventData>>,
52
52
  ) => void;
53
53
  }
54
54
 
@@ -1,10 +1,10 @@
1
1
  import React, { forwardRef, useRef, useEffect } from "react";
2
2
  import "@tylertech/forge-ai/ai-suggestions";
3
- import { useEventListener } from "./react-utils.js";
3
+ import { useEventListener, useProperties } from "./react-utils.js";
4
4
 
5
5
  export const ForgeAiSuggestions = forwardRef((props, forwardedRef) => {
6
6
  const ref = useRef(null);
7
- const { suggestions, variant, ...filteredProps } = props;
7
+ const { variant, suggestions, ...filteredProps } = props;
8
8
 
9
9
  /** Event listeners - run once */
10
10
  useEventListener(
@@ -13,6 +13,9 @@ export const ForgeAiSuggestions = forwardRef((props, forwardedRef) => {
13
13
  props.onForgeAiSuggestionsSelect,
14
14
  );
15
15
 
16
+ /** Properties - run whenever a property has changed */
17
+ useProperties(ref, "suggestions", props.suggestions);
18
+
16
19
  return React.createElement(
17
20
  "forge-ai-suggestions",
18
21
  {
@@ -25,7 +28,6 @@ export const ForgeAiSuggestions = forwardRef((props, forwardedRef) => {
25
28
  }
26
29
  },
27
30
  ...filteredProps,
28
- suggestions: props.suggestions,
29
31
  variant: props.variant,
30
32
  class: props.className,
31
33
  exportparts: props.exportparts,
@@ -0,0 +1,49 @@
1
+ import React from "react";
2
+ import { ForgeAiThinkingIndicator as ForgeAiThinkingIndicatorElement } from "@tylertech/forge-ai/ai-thinking-indicator";
3
+
4
+ export type { ForgeAiThinkingIndicatorElement };
5
+
6
+ export interface ForgeAiThinkingIndicatorProps
7
+ extends Pick<
8
+ React.AllHTMLAttributes<HTMLElement>,
9
+ | "children"
10
+ | "dir"
11
+ | "hidden"
12
+ | "id"
13
+ | "lang"
14
+ | "slot"
15
+ | "style"
16
+ | "title"
17
+ | "translate"
18
+ | "onClick"
19
+ | "onFocus"
20
+ | "onBlur"
21
+ > {
22
+ /** 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()`. */
23
+ className?: string;
24
+
25
+ /** Contains a space-separated list of the part names of the element that should be exposed on the host element. */
26
+ exportparts?: string;
27
+
28
+ /** Used for labels to link them with their inputs (using input id). */
29
+ htmlFor?: string;
30
+
31
+ /** Used to help React identify which items have changed, are added, or are removed within a list. */
32
+ key?: number | string;
33
+
34
+ /** 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. */
35
+ part?: string;
36
+
37
+ /** 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. */
38
+ ref?: any;
39
+
40
+ /** 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. */
41
+ tabIndex?: number;
42
+ }
43
+
44
+ /**
45
+ * A thinking indicator component that displays three animated dots to show that the system is processing or awaiting a response.
46
+ * ---
47
+ *
48
+ */
49
+ export const ForgeAiThinkingIndicator: React.ForwardRefExoticComponent<ForgeAiThinkingIndicatorProps>;
@@ -0,0 +1,18 @@
1
+ import React, { forwardRef } from "react";
2
+ import "@tylertech/forge-ai/ai-thinking-indicator";
3
+
4
+ export const ForgeAiThinkingIndicator = forwardRef((props, forwardedRef) => {
5
+ return React.createElement(
6
+ "forge-ai-thinking-indicator",
7
+ {
8
+ ...props,
9
+ class: props.className,
10
+ exportparts: props.exportparts,
11
+ for: props.htmlFor,
12
+ part: props.part,
13
+ tabindex: props.tabIndex,
14
+ style: { ...props.style },
15
+ },
16
+ props.children,
17
+ );
18
+ });
@@ -48,7 +48,7 @@ export interface ForgeAiThreadsProps
48
48
 
49
49
  /** Fired when a thread is selected. */
50
50
  onForgeAiThreadsSelect?: (
51
- event: CustomEvent<CustomEvent<AiThreadsSelectEventData>>,
51
+ event: CustomEvent<CustomEvent<ForgeAiThreadsSelectEventData>>,
52
52
  ) => void;
53
53
 
54
54
  /** Fired when the new chat button is clicked. */
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- export * from "./ForgeAiActionsToolbar.js";
2
1
  export * from "./ForgeAiArtifact.js";
2
+ export * from "./ForgeAiActionsToolbar.js";
3
3
  export * from "./ForgeAiButton.js";
4
4
  export * from "./ForgeAiChatHeader.js";
5
5
  export * from "./ForgeAiChainOfThought.js";
@@ -24,6 +24,7 @@ export * from "./ForgeAiResponseMessage.js";
24
24
  export * from "./ForgeAiSidebar.js";
25
25
  export * from "./ForgeAiSidebarChat.js";
26
26
  export * from "./ForgeAiSuggestions.js";
27
+ export * from "./ForgeAiThinkingIndicator.js";
27
28
  export * from "./ForgeAiThreads.js";
28
29
  export * from "./ForgeAiUserMessage.js";
29
30
  export * from "./ForgeAiVoiceInput.js";
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- export * from "./ForgeAiActionsToolbar.js";
2
1
  export * from "./ForgeAiArtifact.js";
2
+ export * from "./ForgeAiActionsToolbar.js";
3
3
  export * from "./ForgeAiButton.js";
4
4
  export * from "./ForgeAiChatHeader.js";
5
5
  export * from "./ForgeAiChainOfThought.js";
@@ -24,6 +24,7 @@ export * from "./ForgeAiResponseMessage.js";
24
24
  export * from "./ForgeAiSidebar.js";
25
25
  export * from "./ForgeAiSidebarChat.js";
26
26
  export * from "./ForgeAiSuggestions.js";
27
+ export * from "./ForgeAiThinkingIndicator.js";
27
28
  export * from "./ForgeAiThreads.js";
28
29
  export * from "./ForgeAiUserMessage.js";
29
30
  export * from "./ForgeAiVoiceInput.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tylertech/forge-ai-react",
3
- "version": "0.2.0",
3
+ "version": "0.4.0",
4
4
  "description": "A React adapter for Tyler Forge™ AI Web Components.",
5
5
  "repository": "tyler-technologies-oss/forge-ai",
6
6
  "author": "Tyler Technologies, Inc.",
@@ -11,20 +11,34 @@
11
11
  "files": [
12
12
  "dist"
13
13
  ],
14
+ "scripts": {
15
+ "predev": "pnpm run build",
16
+ "dev": "vite",
17
+ "build:demo": "vite build",
18
+ "serve:demo": "vite preview",
19
+ "clean": "rimraf dist/",
20
+ "prebuild": "pnpm run clean",
21
+ "build": "pnpm run generate-proxies",
22
+ "lint": "eslint .",
23
+ "format": "prettier --write .",
24
+ "format:check": "prettier --check .",
25
+ "generate-proxies": "node scripts/generate-proxies.mjs"
26
+ },
14
27
  "dependencies": {
15
- "tslib": "2.8.1"
28
+ "tslib": "catalog:"
16
29
  },
17
30
  "peerDependencies": {
18
- "react": ">=17.0.0",
19
- "@tylertech/forge-ai": "^0.2.0"
31
+ "@tylertech/forge-ai": "workspace:^",
32
+ "react": ">=17.0.0"
20
33
  },
21
34
  "devDependencies": {
22
- "@repo/prettier-config": "",
23
- "@tylertech-eslint/eslint-plugin": "3.0.0",
24
- "@tylertech/forge": "3.11.0",
35
+ "@repo/prettier-config": "workspace:",
36
+ "@tylertech-eslint/eslint-plugin": "catalog:",
37
+ "@tylertech/forge": "catalog:",
38
+ "@tylertech/forge-ai": "workspace:^",
25
39
  "@tylertech/forge-react": "^3.2.0",
26
- "@tylertech/tyler-icons": "2.0.4",
27
- "@types/node": "24.8.0",
40
+ "@tylertech/tyler-icons": "catalog:",
41
+ "@types/node": "catalog:",
28
42
  "@types/react": "^18.3.26",
29
43
  "@types/react-dom": "^18.3.7",
30
44
  "@types/react-router": "^5.1.20",
@@ -32,31 +46,17 @@
32
46
  "@vitejs/plugin-react": "^4.7.0",
33
47
  "change-case": "^5.4.4",
34
48
  "custom-element-react-wrappers": "^1.7.3",
35
- "eslint": "9.37.0",
36
- "eslint-plugin-prettier": "5.5.4",
49
+ "eslint": "catalog:",
50
+ "eslint-plugin-prettier": "catalog:",
37
51
  "react": "^17.0.2",
38
52
  "react-dom": "^17.0.2",
39
53
  "react-error-overlay": "^6.1.0",
40
54
  "react-router": "^5.3.4",
41
55
  "react-router-dom": "^5.3.4",
42
- "rimraf": "6.0.1",
43
- "sass": "1.93.2",
56
+ "rimraf": "catalog:",
57
+ "sass": "catalog:",
44
58
  "typescript": "~5.8.3",
45
- "vite": "7.1.10",
46
- "vite-tsconfig-paths": "5.1.4",
47
- "@tylertech/forge-ai": "^0.2.0"
48
- },
49
- "scripts": {
50
- "predev": "pnpm run build",
51
- "dev": "vite",
52
- "build:demo": "vite build",
53
- "serve:demo": "vite preview",
54
- "clean": "rimraf dist/",
55
- "prebuild": "pnpm run clean",
56
- "build": "pnpm run generate-proxies",
57
- "lint": "eslint .",
58
- "format": "prettier --write .",
59
- "format:check": "prettier --check .",
60
- "generate-proxies": "node scripts/generate-proxies.mjs"
59
+ "vite": "catalog:",
60
+ "vite-tsconfig-paths": "catalog:"
61
61
  }
62
- }
62
+ }