@tylertech/forge-ai-react 0.4.1 → 0.5.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.
Files changed (66) hide show
  1. package/dist/ForgeAiActionsToolbar.d.ts +24 -16
  2. package/dist/ForgeAiActionsToolbar.js +8 -1
  3. package/dist/ForgeAiAgentInfo.d.ts +51 -0
  4. package/dist/ForgeAiAgentInfo.js +33 -0
  5. package/dist/ForgeAiArtifact.d.ts +15 -16
  6. package/dist/ForgeAiAttachment.d.ts +77 -0
  7. package/dist/ForgeAiAttachment.js +43 -0
  8. package/dist/ForgeAiButton.d.ts +15 -16
  9. package/dist/ForgeAiChainOfThought.d.ts +15 -16
  10. package/dist/ForgeAiChatHeader.d.ts +37 -30
  11. package/dist/ForgeAiChatHeader.js +19 -11
  12. package/dist/ForgeAiChatInterface.d.ts +16 -19
  13. package/dist/ForgeAiChatbot.d.ts +144 -0
  14. package/dist/ForgeAiChatbot.js +92 -0
  15. package/dist/ForgeAiChatbotToolCall.d.ts +57 -0
  16. package/dist/ForgeAiChatbotToolCall.js +36 -0
  17. package/dist/ForgeAiConfirmationPrompt.d.ts +74 -0
  18. package/dist/ForgeAiConfirmationPrompt.js +46 -0
  19. package/dist/ForgeAiDialog.d.ts +15 -16
  20. package/dist/ForgeAiDropdownMenu.d.ts +19 -16
  21. package/dist/ForgeAiDropdownMenu.js +10 -2
  22. package/dist/ForgeAiDropdownMenuItem.d.ts +15 -16
  23. package/dist/ForgeAiDropdownMenuItemGroup.d.ts +15 -16
  24. package/dist/ForgeAiDropdownMenuSeparator.d.ts +15 -16
  25. package/dist/ForgeAiEmbeddedChat.d.ts +33 -20
  26. package/dist/ForgeAiEmbeddedChat.js +18 -2
  27. package/dist/ForgeAiEmptyState.d.ts +19 -18
  28. package/dist/ForgeAiErrorMessage.d.ts +52 -0
  29. package/dist/ForgeAiErrorMessage.js +18 -0
  30. package/dist/ForgeAiFab.d.ts +15 -16
  31. package/dist/ForgeAiFilePicker.d.ts +32 -20
  32. package/dist/ForgeAiFilePicker.js +19 -2
  33. package/dist/ForgeAiFloatingChat.d.ts +18 -30
  34. package/dist/ForgeAiGradientContainer.d.ts +15 -16
  35. package/dist/ForgeAiIcon.d.ts +15 -16
  36. package/dist/ForgeAiMessageThread.d.ts +87 -0
  37. package/dist/ForgeAiMessageThread.js +55 -0
  38. package/dist/ForgeAiModal.d.ts +19 -16
  39. package/dist/ForgeAiOverlay.d.ts +23 -16
  40. package/dist/ForgeAiOverlay.js +12 -1
  41. package/dist/ForgeAiPopover.d.ts +23 -16
  42. package/dist/ForgeAiPopover.js +12 -1
  43. package/dist/ForgeAiPrompt.d.ts +15 -16
  44. package/dist/ForgeAiReasoning.d.ts +15 -16
  45. package/dist/ForgeAiReasoningContent.d.ts +15 -16
  46. package/dist/ForgeAiReasoningHeader.d.ts +15 -16
  47. package/dist/ForgeAiResponseMessage.d.ts +43 -20
  48. package/dist/ForgeAiResponseMessage.js +21 -3
  49. package/dist/ForgeAiSidebar.d.ts +15 -16
  50. package/dist/ForgeAiSidebarChat.d.ts +18 -30
  51. package/dist/ForgeAiSpinner.d.ts +55 -0
  52. package/dist/ForgeAiSpinner.js +21 -0
  53. package/dist/ForgeAiSuggestions.d.ts +15 -16
  54. package/dist/ForgeAiThinkingIndicator.d.ts +15 -16
  55. package/dist/ForgeAiThoughtBase.d.ts +15 -16
  56. package/dist/ForgeAiThoughtDetail.d.ts +15 -16
  57. package/dist/ForgeAiThoughtImage.d.ts +15 -16
  58. package/dist/ForgeAiThoughtSearchResult.d.ts +15 -16
  59. package/dist/ForgeAiThreads.d.ts +18 -16
  60. package/dist/ForgeAiTooltip.d.ts +15 -16
  61. package/dist/ForgeAiUserMessage.d.ts +15 -16
  62. package/dist/ForgeAiVoiceInput.d.ts +15 -16
  63. package/dist/ForgePromptButton.d.ts +15 -16
  64. package/dist/index.d.ts +12 -4
  65. package/dist/index.js +12 -4
  66. package/package.json +9 -9
@@ -0,0 +1,144 @@
1
+ import React from "react";
2
+ import { ForgeAiChatbot as ForgeAiChatbotElement } from "@tylertech/forge-ai/ai-chatbot";
3
+
4
+ export type { ForgeAiChatbotElement };
5
+
6
+ export interface ForgeAiChatbotProps extends Pick<
7
+ React.AllHTMLAttributes<HTMLElement>,
8
+ | "children"
9
+ | "dir"
10
+ | "hidden"
11
+ | "id"
12
+ | "lang"
13
+ | "slot"
14
+ | "style"
15
+ | "title"
16
+ | "translate"
17
+ | "onClick"
18
+ | "onFocus"
19
+ | "onBlur"
20
+ > {
21
+ /** undefined */
22
+ showExpandButton?: boolean;
23
+
24
+ /** undefined */
25
+ showMinimizeButton?: boolean;
26
+
27
+ /** undefined */
28
+ expanded?: boolean;
29
+
30
+ /** undefined */
31
+ enableReactions?: boolean;
32
+
33
+ /** undefined */
34
+ fileUpload?: ForgeAiChatbotElement["fileUpload"];
35
+
36
+ /** undefined */
37
+ voiceInput?: ForgeAiChatbotElement["voiceInput"];
38
+
39
+ /** undefined */
40
+ placeholder?: ForgeAiChatbotElement["placeholder"];
41
+
42
+ /** undefined */
43
+ minimizeIcon?: ForgeAiChatbotElement["minimizeIcon"];
44
+
45
+ /** The title text to display in the header (default: 'AI Assistant') */
46
+ titleText?: ForgeAiChatbotElement["titleText"];
47
+
48
+ /** Controls the heading level for the title content (default: 2) */
49
+ headingLevel?: ForgeAiChatbotElement["headingLevel"];
50
+
51
+ /** 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()`. */
52
+ className?: string;
53
+
54
+ /** Contains a space-separated list of the part names of the element that should be exposed on the host element. */
55
+ exportparts?: string;
56
+
57
+ /** Used for labels to link them with their inputs (using input id). */
58
+ htmlFor?: string;
59
+
60
+ /** Used to help React identify which items have changed, are added, or are removed within a list. */
61
+ key?: number | string;
62
+
63
+ /** 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. */
64
+ part?: string;
65
+
66
+ /** 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. */
67
+ ref?: any;
68
+
69
+ /** 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. */
70
+ tabIndex?: number;
71
+
72
+ /** Fired when adapter connects */
73
+ onForgeAiChatbotConnected?: (event: CustomEvent<CustomEvent<void>>) => void;
74
+
75
+ /** Fired when adapter disconnects */
76
+ onForgeAiChatbotDisconnected?: (
77
+ event: CustomEvent<CustomEvent<void>>,
78
+ ) => void;
79
+
80
+ /** Fired when user sends a message */
81
+ onForgeAiChatbotMessageSent?: (
82
+ event: CustomEvent<CustomEvent<ForgeAiChatbotMessageEventData>>,
83
+ ) => void;
84
+
85
+ /** Fired when assistant message is complete */
86
+ onForgeAiChatbotMessageReceived?: (
87
+ event: CustomEvent<CustomEvent<ForgeAiChatbotMessageEventData>>,
88
+ ) => void;
89
+
90
+ /** Fired when a tool needs to be executed */
91
+ onForgeAiChatbotToolCall?: (
92
+ event: CustomEvent<CustomEvent<ForgeAiChatbotToolCallEventData>>,
93
+ ) => void;
94
+
95
+ /** Fired when an error occurs */
96
+ onForgeAiChatbotError?: (
97
+ event: CustomEvent<CustomEvent<ForgeAiChatbotErrorEventData>>,
98
+ ) => void;
99
+
100
+ /** Fired when header expand button is clicked */
101
+ onForgeAiChatbotExpand?: (event: CustomEvent<CustomEvent<void>>) => void;
102
+
103
+ /** Fired when header minimize button is clicked */
104
+ onForgeAiChatbotMinimize?: (event: CustomEvent<CustomEvent<void>>) => void;
105
+
106
+ /** Fired when header clear option is selected (cancelable, prevents clearMessages() if default prevented) */
107
+ onForgeAiChatbotClear?: (event: CustomEvent<CustomEvent<void>>) => void;
108
+
109
+ /** Fired when header info option is selected */
110
+ onForgeAiChatbotInfo?: (event: CustomEvent<CustomEvent<void>>) => void;
111
+ }
112
+
113
+ /**
114
+ * A complete, self-contained AI chatbot component that implements the AG-UI protocol using an adapter pattern.
115
+ * ---
116
+ *
117
+ *
118
+ * ### **Events:**
119
+ * - **forge-ai-chatbot-connected** - Fired when adapter connects
120
+ * - **forge-ai-chatbot-disconnected** - Fired when adapter disconnects
121
+ * - **forge-ai-chatbot-message-sent** - Fired when user sends a message
122
+ * - **forge-ai-chatbot-message-received** - Fired when assistant message is complete
123
+ * - **forge-ai-chatbot-tool-call** - Fired when a tool needs to be executed
124
+ * - **forge-ai-chatbot-error** - Fired when an error occurs
125
+ * - **forge-ai-chatbot-expand** - Fired when header expand button is clicked
126
+ * - **forge-ai-chatbot-minimize** - Fired when header minimize button is clicked
127
+ * - **forge-ai-chatbot-clear** - Fired when header clear option is selected (cancelable, prevents clearMessages() if default prevented)
128
+ * - **forge-ai-chatbot-info** - Fired when header info option is selected
129
+ *
130
+ * ### **Methods:**
131
+ * - **clearMessages(): _void_** - Clears all messages from the chat history.
132
+ * - **getMessages(): __** - Gets the current message history.
133
+ * - **setMessages(messages: _ChatMessage[]_): _void_** - Sets the message history. Useful for restoring conversation state.
134
+ * - **sendMessage(content: _string_, files: _File[]_): _Promise<void>_** - Programmatically sends a message as the user.
135
+ * - **abort(): _void_** - Aborts the current streaming response.
136
+ * - **scrollToBottom({ behavior }: _{ behavior?: ScrollBehavior }_): _Promise<void>_** - Scrolls the chat interface to the bottom.
137
+ * - **getThreadState(): __** - Gets the complete serializable thread state including threadId and messages.
138
+ * - **setThreadState(state: _ThreadState_): _void_** - Restores thread state from a serialized ThreadState object.
139
+ *
140
+ * ### **Slots:**
141
+ * - **header** - Slot for custom header content
142
+ * - **empty-state** - Slot for custom empty state content (overrides default suggestions)
143
+ */
144
+ export const ForgeAiChatbot: React.ForwardRefExoticComponent<ForgeAiChatbotProps>;
@@ -0,0 +1,92 @@
1
+ import React, { forwardRef, useRef, useEffect } from "react";
2
+ import "@tylertech/forge-ai/ai-chatbot";
3
+ import { useEventListener } from "./react-utils.js";
4
+
5
+ export const ForgeAiChatbot = forwardRef((props, forwardedRef) => {
6
+ const ref = useRef(null);
7
+ const {
8
+ showExpandButton,
9
+ showMinimizeButton,
10
+ expanded,
11
+ enableReactions,
12
+ fileUpload,
13
+ voiceInput,
14
+ placeholder,
15
+ minimizeIcon,
16
+ titleText,
17
+ headingLevel,
18
+ ...filteredProps
19
+ } = props;
20
+
21
+ /** Event listeners - run once */
22
+ useEventListener(
23
+ ref,
24
+ "forge-ai-chatbot-connected",
25
+ props.onForgeAiChatbotConnected,
26
+ );
27
+ useEventListener(
28
+ ref,
29
+ "forge-ai-chatbot-disconnected",
30
+ props.onForgeAiChatbotDisconnected,
31
+ );
32
+ useEventListener(
33
+ ref,
34
+ "forge-ai-chatbot-message-sent",
35
+ props.onForgeAiChatbotMessageSent,
36
+ );
37
+ useEventListener(
38
+ ref,
39
+ "forge-ai-chatbot-message-received",
40
+ props.onForgeAiChatbotMessageReceived,
41
+ );
42
+ useEventListener(
43
+ ref,
44
+ "forge-ai-chatbot-tool-call",
45
+ props.onForgeAiChatbotToolCall,
46
+ );
47
+ useEventListener(ref, "forge-ai-chatbot-error", props.onForgeAiChatbotError);
48
+ useEventListener(
49
+ ref,
50
+ "forge-ai-chatbot-expand",
51
+ props.onForgeAiChatbotExpand,
52
+ );
53
+ useEventListener(
54
+ ref,
55
+ "forge-ai-chatbot-minimize",
56
+ props.onForgeAiChatbotMinimize,
57
+ );
58
+ useEventListener(ref, "forge-ai-chatbot-clear", props.onForgeAiChatbotClear);
59
+ useEventListener(ref, "forge-ai-chatbot-info", props.onForgeAiChatbotInfo);
60
+
61
+ return React.createElement(
62
+ "forge-ai-chatbot",
63
+ {
64
+ ref: (node) => {
65
+ ref.current = node;
66
+ if (typeof forwardedRef === "function") {
67
+ forwardedRef(node);
68
+ } else if (forwardedRef) {
69
+ forwardedRef.current = node;
70
+ }
71
+ },
72
+ ...filteredProps,
73
+ "file-upload": props.fileUpload || props["file-upload"],
74
+ "voice-input": props.voiceInput || props["voice-input"],
75
+ placeholder: props.placeholder,
76
+ "minimize-icon": props.minimizeIcon || props["minimize-icon"],
77
+ "title-text": props.titleText || props["title-text"],
78
+ "heading-level": props.headingLevel || props["heading-level"],
79
+ class: props.className,
80
+ exportparts: props.exportparts,
81
+ for: props.htmlFor,
82
+ part: props.part,
83
+ tabindex: props.tabIndex,
84
+ "show-expand-button": props.showExpandButton ? true : undefined,
85
+ "show-minimize-button": props.showMinimizeButton ? true : undefined,
86
+ expanded: props.expanded ? true : undefined,
87
+ "enable-reactions": props.enableReactions ? true : undefined,
88
+ style: { ...props.style },
89
+ },
90
+ props.children,
91
+ );
92
+ });
@@ -0,0 +1,57 @@
1
+ import React from "react";
2
+ import {
3
+ ForgeAiChatbotToolCall as ForgeAiChatbotToolCallElement,
4
+ CustomEvent,
5
+ } from "@tylertech/forge-ai/ai-chatbot";
6
+
7
+ export type { ForgeAiChatbotToolCallElement, CustomEvent };
8
+
9
+ export interface ForgeAiChatbotToolCallProps extends Pick<
10
+ React.AllHTMLAttributes<HTMLElement>,
11
+ | "children"
12
+ | "dir"
13
+ | "hidden"
14
+ | "id"
15
+ | "lang"
16
+ | "slot"
17
+ | "style"
18
+ | "title"
19
+ | "translate"
20
+ | "onClick"
21
+ | "onFocus"
22
+ | "onBlur"
23
+ > {
24
+ /** 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()`. */
25
+ className?: string;
26
+
27
+ /** Contains a space-separated list of the part names of the element that should be exposed on the host element. */
28
+ exportparts?: string;
29
+
30
+ /** Used for labels to link them with their inputs (using input id). */
31
+ htmlFor?: string;
32
+
33
+ /** Used to help React identify which items have changed, are added, or are removed within a list. */
34
+ key?: number | string;
35
+
36
+ /** 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. */
37
+ part?: string;
38
+
39
+ /** 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. */
40
+ ref?: any;
41
+
42
+ /** 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. */
43
+ tabIndex?: number;
44
+
45
+ /** undefined */
46
+ onForgeAiMessageThreadScrollRequest?: (event: CustomEvent) => void;
47
+ }
48
+
49
+ /**
50
+ *
51
+ * ---
52
+ *
53
+ *
54
+ * ### **Events:**
55
+ * - **forge-ai-message-thread-scroll-request**
56
+ */
57
+ export const ForgeAiChatbotToolCall: React.ForwardRefExoticComponent<ForgeAiChatbotToolCallProps>;
@@ -0,0 +1,36 @@
1
+ import React, { forwardRef, useRef, useEffect } from "react";
2
+ import "@tylertech/forge-ai/ai-chatbot";
3
+ import { useEventListener } from "./react-utils.js";
4
+
5
+ export const ForgeAiChatbotToolCall = forwardRef((props, forwardedRef) => {
6
+ const ref = useRef(null);
7
+
8
+ /** Event listeners - run once */
9
+ useEventListener(
10
+ ref,
11
+ "forge-ai-message-thread-scroll-request",
12
+ props.onForgeAiMessageThreadScrollRequest,
13
+ );
14
+
15
+ return React.createElement(
16
+ "forge-ai-chatbot-tool-call",
17
+ {
18
+ ref: (node) => {
19
+ ref.current = node;
20
+ if (typeof forwardedRef === "function") {
21
+ forwardedRef(node);
22
+ } else if (forwardedRef) {
23
+ forwardedRef.current = node;
24
+ }
25
+ },
26
+ ...props,
27
+ class: props.className,
28
+ exportparts: props.exportparts,
29
+ for: props.htmlFor,
30
+ part: props.part,
31
+ tabindex: props.tabIndex,
32
+ style: { ...props.style },
33
+ },
34
+ props.children,
35
+ );
36
+ });
@@ -0,0 +1,74 @@
1
+ import React from "react";
2
+ import { ForgeAiConfirmationPrompt as ForgeAiConfirmationPromptElement } from "@tylertech/forge-ai/ai-confirmation-prompt";
3
+
4
+ export type { ForgeAiConfirmationPromptElement };
5
+
6
+ export interface ForgeAiConfirmationPromptProps extends Pick<
7
+ React.AllHTMLAttributes<HTMLElement>,
8
+ | "children"
9
+ | "dir"
10
+ | "hidden"
11
+ | "id"
12
+ | "lang"
13
+ | "slot"
14
+ | "style"
15
+ | "title"
16
+ | "translate"
17
+ | "onClick"
18
+ | "onFocus"
19
+ | "onBlur"
20
+ > {
21
+ /** undefined */
22
+ disabled?: boolean;
23
+
24
+ /** undefined */
25
+ text?: ForgeAiConfirmationPromptElement["text"];
26
+
27
+ /** undefined */
28
+ confirmText?: ForgeAiConfirmationPromptElement["confirmText"];
29
+
30
+ /** undefined */
31
+ denyText?: ForgeAiConfirmationPromptElement["denyText"];
32
+
33
+ /** 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()`. */
34
+ className?: string;
35
+
36
+ /** Contains a space-separated list of the part names of the element that should be exposed on the host element. */
37
+ exportparts?: string;
38
+
39
+ /** Used for labels to link them with their inputs (using input id). */
40
+ htmlFor?: string;
41
+
42
+ /** Used to help React identify which items have changed, are added, or are removed within a list. */
43
+ key?: number | string;
44
+
45
+ /** 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. */
46
+ part?: string;
47
+
48
+ /** 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. */
49
+ ref?: any;
50
+
51
+ /** 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. */
52
+ tabIndex?: number;
53
+
54
+ /** Fired when user confirms the prompt */
55
+ onForgeAiConfirmationPromptConfirm?: (
56
+ event: CustomEvent<CustomEvent<void>>,
57
+ ) => void;
58
+
59
+ /** Fired when user denies the prompt */
60
+ onForgeAiConfirmationPromptDeny?: (
61
+ event: CustomEvent<CustomEvent<void>>,
62
+ ) => void;
63
+ }
64
+
65
+ /**
66
+ * Displays a confirmation UI for requiring human approval.
67
+ * ---
68
+ *
69
+ *
70
+ * ### **Events:**
71
+ * - **forge-ai-confirmation-prompt-confirm** - Fired when user confirms the prompt
72
+ * - **forge-ai-confirmation-prompt-deny** - Fired when user denies the prompt
73
+ */
74
+ export const ForgeAiConfirmationPrompt: React.ForwardRefExoticComponent<ForgeAiConfirmationPromptProps>;
@@ -0,0 +1,46 @@
1
+ import React, { forwardRef, useRef, useEffect } from "react";
2
+ import "@tylertech/forge-ai/ai-confirmation-prompt";
3
+ import { useEventListener } from "./react-utils.js";
4
+
5
+ export const ForgeAiConfirmationPrompt = forwardRef((props, forwardedRef) => {
6
+ const ref = useRef(null);
7
+ const { disabled, text, confirmText, denyText, ...filteredProps } = props;
8
+
9
+ /** Event listeners - run once */
10
+ useEventListener(
11
+ ref,
12
+ "forge-ai-confirmation-prompt-confirm",
13
+ props.onForgeAiConfirmationPromptConfirm,
14
+ );
15
+ useEventListener(
16
+ ref,
17
+ "forge-ai-confirmation-prompt-deny",
18
+ props.onForgeAiConfirmationPromptDeny,
19
+ );
20
+
21
+ return React.createElement(
22
+ "forge-ai-confirmation-prompt",
23
+ {
24
+ ref: (node) => {
25
+ ref.current = node;
26
+ if (typeof forwardedRef === "function") {
27
+ forwardedRef(node);
28
+ } else if (forwardedRef) {
29
+ forwardedRef.current = node;
30
+ }
31
+ },
32
+ ...filteredProps,
33
+ text: props.text,
34
+ "confirm-text": props.confirmText || props["confirm-text"],
35
+ "deny-text": props.denyText || props["deny-text"],
36
+ class: props.className,
37
+ exportparts: props.exportparts,
38
+ for: props.htmlFor,
39
+ part: props.part,
40
+ tabindex: props.tabIndex,
41
+ disabled: props.disabled ? true : undefined,
42
+ style: { ...props.style },
43
+ },
44
+ props.children,
45
+ );
46
+ });
@@ -3,22 +3,21 @@ import { ForgeAiDialog as ForgeAiDialogElement } from "@tylertech/forge-ai/ai-di
3
3
 
4
4
  export type { ForgeAiDialogElement };
5
5
 
6
- export interface ForgeAiDialogProps
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
- > {
6
+ export interface ForgeAiDialogProps extends Pick<
7
+ React.AllHTMLAttributes<HTMLElement>,
8
+ | "children"
9
+ | "dir"
10
+ | "hidden"
11
+ | "id"
12
+ | "lang"
13
+ | "slot"
14
+ | "style"
15
+ | "title"
16
+ | "translate"
17
+ | "onClick"
18
+ | "onFocus"
19
+ | "onBlur"
20
+ > {
22
21
  /** Indicates whether the dialog is open. */
23
22
  open?: boolean;
24
23
 
@@ -6,22 +6,21 @@ import {
6
6
 
7
7
  export type { ForgeAiDropdownMenuElement, CustomEvent };
8
8
 
9
- export interface ForgeAiDropdownMenuProps
10
- extends Pick<
11
- React.AllHTMLAttributes<HTMLElement>,
12
- | "children"
13
- | "dir"
14
- | "hidden"
15
- | "id"
16
- | "lang"
17
- | "slot"
18
- | "style"
19
- | "title"
20
- | "translate"
21
- | "onClick"
22
- | "onFocus"
23
- | "onBlur"
24
- > {
9
+ export interface ForgeAiDropdownMenuProps extends Pick<
10
+ React.AllHTMLAttributes<HTMLElement>,
11
+ | "children"
12
+ | "dir"
13
+ | "hidden"
14
+ | "id"
15
+ | "lang"
16
+ | "slot"
17
+ | "style"
18
+ | "title"
19
+ | "translate"
20
+ | "onClick"
21
+ | "onFocus"
22
+ | "onBlur"
23
+ > {
25
24
  /** Whether the dropdown is open. */
26
25
  open?: boolean;
27
26
 
@@ -43,6 +42,10 @@ For multi selection: string array
43
42
  For none mode: null */
44
43
  value?: ForgeAiDropdownMenuElement["value"];
45
44
 
45
+ /** The placement of the popover relative to the trigger button.
46
+ Only applies to root-level menus; submenus always use 'right-start'. */
47
+ popoverPlacement?: ForgeAiDropdownMenuElement["popoverPlacement"];
48
+
46
49
  /** 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()`. */
47
50
  className?: string;
48
51
 
@@ -4,8 +4,15 @@ import { useEventListener } from "./react-utils.js";
4
4
 
5
5
  export const ForgeAiDropdownMenu = forwardRef((props, forwardedRef) => {
6
6
  const ref = useRef(null);
7
- const { open, disabled, variant, selectionMode, value, ...filteredProps } =
8
- props;
7
+ const {
8
+ open,
9
+ disabled,
10
+ variant,
11
+ selectionMode,
12
+ value,
13
+ popoverPlacement,
14
+ ...filteredProps
15
+ } = props;
9
16
 
10
17
  /** Event listeners - run once */
11
18
  useEventListener(
@@ -30,6 +37,7 @@ export const ForgeAiDropdownMenu = forwardRef((props, forwardedRef) => {
30
37
  variant: props.variant,
31
38
  "selection-mode": props.selectionMode || props["selection-mode"],
32
39
  value: props.value,
40
+ "popover-placement": props.popoverPlacement || props["popover-placement"],
33
41
  class: props.className,
34
42
  exportparts: props.exportparts,
35
43
  for: props.htmlFor,
@@ -3,22 +3,21 @@ import { ForgeAiDropdownMenuItem as ForgeAiDropdownMenuItemElement } from "@tyle
3
3
 
4
4
  export type { ForgeAiDropdownMenuItemElement };
5
5
 
6
- export interface ForgeAiDropdownMenuItemProps
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
- > {
6
+ export interface ForgeAiDropdownMenuItemProps extends Pick<
7
+ React.AllHTMLAttributes<HTMLElement>,
8
+ | "children"
9
+ | "dir"
10
+ | "hidden"
11
+ | "id"
12
+ | "lang"
13
+ | "slot"
14
+ | "style"
15
+ | "title"
16
+ | "translate"
17
+ | "onClick"
18
+ | "onFocus"
19
+ | "onBlur"
20
+ > {
22
21
  /** Whether this menu item is selected. */
23
22
  selected?: boolean;
24
23
 
@@ -3,22 +3,21 @@ import { ForgeAiDropdownMenuItemGroup as ForgeAiDropdownMenuItemGroupElement } f
3
3
 
4
4
  export type { ForgeAiDropdownMenuItemGroupElement };
5
5
 
6
- export interface ForgeAiDropdownMenuItemGroupProps
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
- > {
6
+ export interface ForgeAiDropdownMenuItemGroupProps extends Pick<
7
+ React.AllHTMLAttributes<HTMLElement>,
8
+ | "children"
9
+ | "dir"
10
+ | "hidden"
11
+ | "id"
12
+ | "lang"
13
+ | "slot"
14
+ | "style"
15
+ | "title"
16
+ | "translate"
17
+ | "onClick"
18
+ | "onFocus"
19
+ | "onBlur"
20
+ > {
22
21
  /** 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
22
  className?: string;
24
23