@tylertech/forge-ai-react 0.1.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.
- package/LICENSE +202 -0
- package/README.md +19 -0
- package/dist/ForgeAiActionsToolbar.d.ts +57 -0
- package/dist/ForgeAiActionsToolbar.js +36 -0
- package/dist/ForgeAiArtifact.d.ts +57 -0
- package/dist/ForgeAiArtifact.js +18 -0
- package/dist/ForgeAiButton.d.ts +55 -0
- package/dist/ForgeAiButton.js +21 -0
- package/dist/ForgeAiChainOfThought.d.ts +52 -0
- package/dist/ForgeAiChainOfThought.js +21 -0
- package/dist/ForgeAiChatHeader.d.ts +85 -0
- package/dist/ForgeAiChatHeader.js +62 -0
- package/dist/ForgeAiChatInterface.d.ts +66 -0
- package/dist/ForgeAiChatInterface.js +30 -0
- package/dist/ForgeAiDialog.d.ts +80 -0
- package/dist/ForgeAiDialog.js +43 -0
- package/dist/ForgeAiDropdownMenu.d.ts +99 -0
- package/dist/ForgeAiDropdownMenu.js +44 -0
- package/dist/ForgeAiDropdownMenuItem.d.ts +89 -0
- package/dist/ForgeAiDropdownMenuItem.js +52 -0
- package/dist/ForgeAiDropdownMenuItemGroup.d.ts +53 -0
- package/dist/ForgeAiDropdownMenuItemGroup.js +20 -0
- package/dist/ForgeAiDropdownMenuSeparator.d.ts +49 -0
- package/dist/ForgeAiDropdownMenuSeparator.js +20 -0
- package/dist/ForgeAiEmbeddedChat.d.ts +76 -0
- package/dist/ForgeAiEmbeddedChat.js +44 -0
- package/dist/ForgeAiEmptyState.d.ts +53 -0
- package/dist/ForgeAiEmptyState.js +18 -0
- package/dist/ForgeAiFab.d.ts +58 -0
- package/dist/ForgeAiFab.js +22 -0
- package/dist/ForgeAiFilePicker.d.ts +77 -0
- package/dist/ForgeAiFilePicker.js +41 -0
- package/dist/ForgeAiFloatingChat.d.ts +87 -0
- package/dist/ForgeAiFloatingChat.js +54 -0
- package/dist/ForgeAiGradientContainer.d.ts +55 -0
- package/dist/ForgeAiGradientContainer.js +21 -0
- package/dist/ForgeAiIcon.d.ts +52 -0
- package/dist/ForgeAiIcon.js +21 -0
- package/dist/ForgeAiModal.d.ts +79 -0
- package/dist/ForgeAiModal.js +41 -0
- package/dist/ForgeAiOverlay.d.ts +73 -0
- package/dist/ForgeAiOverlay.js +25 -0
- package/dist/ForgeAiPopover.d.ts +73 -0
- package/dist/ForgeAiPopover.js +25 -0
- package/dist/ForgeAiPrompt.d.ts +69 -0
- package/dist/ForgeAiPrompt.js +36 -0
- package/dist/ForgeAiReasoning.d.ts +52 -0
- package/dist/ForgeAiReasoning.js +21 -0
- package/dist/ForgeAiReasoningContent.d.ts +49 -0
- package/dist/ForgeAiReasoningContent.js +18 -0
- package/dist/ForgeAiReasoningHeader.d.ts +65 -0
- package/dist/ForgeAiReasoningHeader.js +35 -0
- package/dist/ForgeAiResponseMessage.d.ts +57 -0
- package/dist/ForgeAiResponseMessage.js +36 -0
- package/dist/ForgeAiSidebar.d.ts +70 -0
- package/dist/ForgeAiSidebar.js +35 -0
- package/dist/ForgeAiSidebarChat.d.ts +87 -0
- package/dist/ForgeAiSidebarChat.js +54 -0
- package/dist/ForgeAiSuggestions.d.ts +63 -0
- package/dist/ForgeAiSuggestions.js +39 -0
- package/dist/ForgeAiThoughtBase.d.ts +57 -0
- package/dist/ForgeAiThoughtBase.js +21 -0
- package/dist/ForgeAiThoughtDetail.d.ts +49 -0
- package/dist/ForgeAiThoughtDetail.js +18 -0
- package/dist/ForgeAiThoughtImage.d.ts +52 -0
- package/dist/ForgeAiThoughtImage.js +21 -0
- package/dist/ForgeAiThoughtSearchResult.d.ts +55 -0
- package/dist/ForgeAiThoughtSearchResult.js +22 -0
- package/dist/ForgeAiThreads.d.ts +71 -0
- package/dist/ForgeAiThreads.js +48 -0
- package/dist/ForgeAiTooltip.d.ts +79 -0
- package/dist/ForgeAiTooltip.js +27 -0
- package/dist/ForgeAiUserMessage.d.ts +49 -0
- package/dist/ForgeAiUserMessage.js +18 -0
- package/dist/ForgeAiVoiceInput.d.ts +57 -0
- package/dist/ForgeAiVoiceInput.js +36 -0
- package/dist/ForgePromptButton.d.ts +52 -0
- package/dist/ForgePromptButton.js +21 -0
- package/dist/index.d.ts +38 -0
- package/dist/index.js +38 -0
- package/dist/react-utils.js +34 -0
- package/package.json +62 -0
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ForgeAiDropdownMenuSeparator as ForgeAiDropdownMenuSeparatorElement } from "@tylertech/forge-ai/ai-dropdown-menu";
|
|
3
|
+
|
|
4
|
+
export type { ForgeAiDropdownMenuSeparatorElement };
|
|
5
|
+
|
|
6
|
+
export interface ForgeAiDropdownMenuSeparatorProps
|
|
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 separator component for dividing sections within ai-dropdown-menu.
|
|
46
|
+
* ---
|
|
47
|
+
*
|
|
48
|
+
*/
|
|
49
|
+
export const ForgeAiDropdownMenuSeparator: React.ForwardRefExoticComponent<ForgeAiDropdownMenuSeparatorProps>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React, { forwardRef } from "react";
|
|
2
|
+
import "@tylertech/forge-ai/ai-dropdown-menu";
|
|
3
|
+
|
|
4
|
+
export const ForgeAiDropdownMenuSeparator = forwardRef(
|
|
5
|
+
(props, forwardedRef) => {
|
|
6
|
+
return React.createElement(
|
|
7
|
+
"forge-ai-dropdown-menu-separator",
|
|
8
|
+
{
|
|
9
|
+
...props,
|
|
10
|
+
class: props.className,
|
|
11
|
+
exportparts: props.exportparts,
|
|
12
|
+
for: props.htmlFor,
|
|
13
|
+
part: props.part,
|
|
14
|
+
tabindex: props.tabIndex,
|
|
15
|
+
style: { ...props.style },
|
|
16
|
+
},
|
|
17
|
+
props.children,
|
|
18
|
+
);
|
|
19
|
+
},
|
|
20
|
+
);
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ForgeAiEmbeddedChat as ForgeAiEmbeddedChatElement } from "@tylertech/forge-ai/ai-embedded-chat";
|
|
3
|
+
|
|
4
|
+
export type { ForgeAiEmbeddedChatElement };
|
|
5
|
+
|
|
6
|
+
export interface ForgeAiEmbeddedChatProps
|
|
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
|
+
/** Controls whether the modal view is open when expanded. */
|
|
23
|
+
expanded?: boolean;
|
|
24
|
+
|
|
25
|
+
/** Controls the gradient variant applied to the container. */
|
|
26
|
+
gradientVariant?: ForgeAiEmbeddedChatElement["gradientVariant"];
|
|
27
|
+
|
|
28
|
+
/** 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()`. */
|
|
29
|
+
className?: string;
|
|
30
|
+
|
|
31
|
+
/** Contains a space-separated list of the part names of the element that should be exposed on the host element. */
|
|
32
|
+
exportparts?: string;
|
|
33
|
+
|
|
34
|
+
/** Used for labels to link them with their inputs (using input id). */
|
|
35
|
+
htmlFor?: string;
|
|
36
|
+
|
|
37
|
+
/** Used to help React identify which items have changed, are added, or are removed within a list. */
|
|
38
|
+
key?: number | string;
|
|
39
|
+
|
|
40
|
+
/** 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. */
|
|
41
|
+
part?: string;
|
|
42
|
+
|
|
43
|
+
/** 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. */
|
|
44
|
+
ref?: any;
|
|
45
|
+
|
|
46
|
+
/** 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
|
+
tabIndex?: number;
|
|
48
|
+
|
|
49
|
+
/** Fired when the chat is expanded to modal view */
|
|
50
|
+
onForgeAiEmbeddedChatExpand?: (event: CustomEvent<CustomEvent<void>>) => void;
|
|
51
|
+
|
|
52
|
+
/** Fired when the chat is collapsed from modal view */
|
|
53
|
+
onForgeAiEmbeddedChatCollapse?: (
|
|
54
|
+
event: CustomEvent<CustomEvent<void>>,
|
|
55
|
+
) => void;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
*
|
|
60
|
+
* ---
|
|
61
|
+
*
|
|
62
|
+
*
|
|
63
|
+
* ### **Events:**
|
|
64
|
+
* - **forge-ai-embedded-chat-expand** - Fired when the chat is expanded to modal view
|
|
65
|
+
* - **forge-ai-embedded-chat-collapse** - Fired when the chat is collapsed from modal view
|
|
66
|
+
*
|
|
67
|
+
* ### **Methods:**
|
|
68
|
+
* - **expand(): _void_** - Expands the chat to modal view.
|
|
69
|
+
* - **collapse(): _void_** - Collapses the chat from modal view back to embedded view.
|
|
70
|
+
*
|
|
71
|
+
* ### **Slots:**
|
|
72
|
+
* - _default_ - Default slot for messages (ai-user-message, ai-response-message components)
|
|
73
|
+
* - **suggestions** - Slot for AI suggestions component
|
|
74
|
+
* - **prompt** - Slot for custom AI prompt component. If not provided, a default forge-ai-prompt will be used.
|
|
75
|
+
*/
|
|
76
|
+
export const ForgeAiEmbeddedChat: React.ForwardRefExoticComponent<ForgeAiEmbeddedChatProps>;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import React, { forwardRef, useRef, useEffect } from "react";
|
|
2
|
+
import "@tylertech/forge-ai/ai-embedded-chat";
|
|
3
|
+
import { useEventListener } from "./react-utils.js";
|
|
4
|
+
|
|
5
|
+
export const ForgeAiEmbeddedChat = forwardRef((props, forwardedRef) => {
|
|
6
|
+
const ref = useRef(null);
|
|
7
|
+
const { expanded, gradientVariant, ...filteredProps } = props;
|
|
8
|
+
|
|
9
|
+
/** Event listeners - run once */
|
|
10
|
+
useEventListener(
|
|
11
|
+
ref,
|
|
12
|
+
"forge-ai-embedded-chat-expand",
|
|
13
|
+
props.onForgeAiEmbeddedChatExpand,
|
|
14
|
+
);
|
|
15
|
+
useEventListener(
|
|
16
|
+
ref,
|
|
17
|
+
"forge-ai-embedded-chat-collapse",
|
|
18
|
+
props.onForgeAiEmbeddedChatCollapse,
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
return React.createElement(
|
|
22
|
+
"forge-ai-embedded-chat",
|
|
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
|
+
"gradient-variant": props.gradientVariant || props["gradient-variant"],
|
|
34
|
+
class: props.className,
|
|
35
|
+
exportparts: props.exportparts,
|
|
36
|
+
for: props.htmlFor,
|
|
37
|
+
part: props.part,
|
|
38
|
+
tabindex: props.tabIndex,
|
|
39
|
+
expanded: props.expanded ? true : undefined,
|
|
40
|
+
style: { ...props.style },
|
|
41
|
+
},
|
|
42
|
+
props.children,
|
|
43
|
+
);
|
|
44
|
+
});
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ForgeAiEmptyState as ForgeAiEmptyStateElement } from "@tylertech/forge-ai/ai-empty-state";
|
|
3
|
+
|
|
4
|
+
export type { ForgeAiEmptyStateElement };
|
|
5
|
+
|
|
6
|
+
export interface ForgeAiEmptyStateProps
|
|
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
|
+
*
|
|
46
|
+
* ---
|
|
47
|
+
*
|
|
48
|
+
*
|
|
49
|
+
* ### **Slots:**
|
|
50
|
+
* - _default_ - The custom welcome message content.
|
|
51
|
+
* - **actions** - The actions or suggestions to display below the message.
|
|
52
|
+
*/
|
|
53
|
+
export const ForgeAiEmptyState: React.ForwardRefExoticComponent<ForgeAiEmptyStateProps>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React, { forwardRef } from "react";
|
|
2
|
+
import "@tylertech/forge-ai/ai-empty-state";
|
|
3
|
+
|
|
4
|
+
export const ForgeAiEmptyState = forwardRef((props, forwardedRef) => {
|
|
5
|
+
return React.createElement(
|
|
6
|
+
"forge-ai-empty-state",
|
|
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
|
+
});
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ForgeAiFab as ForgeAiFabElement } from "@tylertech/forge-ai/ai-fab";
|
|
3
|
+
|
|
4
|
+
export type { ForgeAiFabElement };
|
|
5
|
+
|
|
6
|
+
export interface ForgeAiFabProps
|
|
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
|
+
/** Whether the button is disabled */
|
|
23
|
+
disabled?: boolean;
|
|
24
|
+
|
|
25
|
+
/** Whether the button is extended */
|
|
26
|
+
extended?: boolean;
|
|
27
|
+
|
|
28
|
+
/** 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()`. */
|
|
29
|
+
className?: string;
|
|
30
|
+
|
|
31
|
+
/** Contains a space-separated list of the part names of the element that should be exposed on the host element. */
|
|
32
|
+
exportparts?: string;
|
|
33
|
+
|
|
34
|
+
/** Used for labels to link them with their inputs (using input id). */
|
|
35
|
+
htmlFor?: string;
|
|
36
|
+
|
|
37
|
+
/** Used to help React identify which items have changed, are added, or are removed within a list. */
|
|
38
|
+
key?: number | string;
|
|
39
|
+
|
|
40
|
+
/** 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. */
|
|
41
|
+
part?: string;
|
|
42
|
+
|
|
43
|
+
/** 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. */
|
|
44
|
+
ref?: any;
|
|
45
|
+
|
|
46
|
+
/** 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
|
+
tabIndex?: number;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
*
|
|
52
|
+
* ---
|
|
53
|
+
*
|
|
54
|
+
*
|
|
55
|
+
* ### **Slots:**
|
|
56
|
+
* - _default_ - Default slot for button content
|
|
57
|
+
*/
|
|
58
|
+
export const ForgeAiFab: React.ForwardRefExoticComponent<ForgeAiFabProps>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React, { forwardRef } from "react";
|
|
2
|
+
import "@tylertech/forge-ai/ai-fab";
|
|
3
|
+
|
|
4
|
+
export const ForgeAiFab = forwardRef((props, forwardedRef) => {
|
|
5
|
+
const { disabled, extended, ...filteredProps } = props;
|
|
6
|
+
|
|
7
|
+
return React.createElement(
|
|
8
|
+
"forge-ai-fab",
|
|
9
|
+
{
|
|
10
|
+
...filteredProps,
|
|
11
|
+
class: props.className,
|
|
12
|
+
exportparts: props.exportparts,
|
|
13
|
+
for: props.htmlFor,
|
|
14
|
+
part: props.part,
|
|
15
|
+
tabindex: props.tabIndex,
|
|
16
|
+
disabled: props.disabled ? true : undefined,
|
|
17
|
+
extended: props.extended ? true : undefined,
|
|
18
|
+
style: { ...props.style },
|
|
19
|
+
},
|
|
20
|
+
props.children,
|
|
21
|
+
);
|
|
22
|
+
});
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ForgeAiFilePicker as ForgeAiFilePickerElement } from "@tylertech/forge-ai/ai-file-picker";
|
|
3
|
+
|
|
4
|
+
export type { ForgeAiFilePickerElement };
|
|
5
|
+
|
|
6
|
+
export interface ForgeAiFilePickerProps
|
|
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
|
+
/** Whether the file picker is disabled. */
|
|
23
|
+
disabled?: boolean;
|
|
24
|
+
|
|
25
|
+
/** Whether to allow multiple file selection. */
|
|
26
|
+
multiple?: boolean;
|
|
27
|
+
|
|
28
|
+
/** The variant of the file picker button. */
|
|
29
|
+
variant?: ForgeAiFilePickerElement["variant"];
|
|
30
|
+
|
|
31
|
+
/** Accepted file types (comma-separated MIME types or extensions). */
|
|
32
|
+
accept?: ForgeAiFilePickerElement["accept"];
|
|
33
|
+
|
|
34
|
+
/** 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()`. */
|
|
35
|
+
className?: string;
|
|
36
|
+
|
|
37
|
+
/** Contains a space-separated list of the part names of the element that should be exposed on the host element. */
|
|
38
|
+
exportparts?: string;
|
|
39
|
+
|
|
40
|
+
/** Used for labels to link them with their inputs (using input id). */
|
|
41
|
+
htmlFor?: string;
|
|
42
|
+
|
|
43
|
+
/** Used to help React identify which items have changed, are added, or are removed within a list. */
|
|
44
|
+
key?: number | string;
|
|
45
|
+
|
|
46
|
+
/** 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. */
|
|
47
|
+
part?: string;
|
|
48
|
+
|
|
49
|
+
/** 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. */
|
|
50
|
+
ref?: any;
|
|
51
|
+
|
|
52
|
+
/** 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. */
|
|
53
|
+
tabIndex?: number;
|
|
54
|
+
|
|
55
|
+
/** Fired when a file is selected via click or drag & drop. The event detail contains the selected file and timestamp. */
|
|
56
|
+
onForgeAiFilePickerChange?: (
|
|
57
|
+
event: CustomEvent<CustomEvent<AiFilePickerChangeEventData>>,
|
|
58
|
+
) => void;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* An AI file picker component with button and icon-button variants.
|
|
63
|
+
* ---
|
|
64
|
+
*
|
|
65
|
+
*
|
|
66
|
+
* ### **Events:**
|
|
67
|
+
* - **forge-ai-file-picker-change** - Fired when a file is selected via click or drag & drop. The event detail contains the selected file and timestamp.
|
|
68
|
+
*
|
|
69
|
+
* ### **Slots:**
|
|
70
|
+
* - _default_ - The default slot for button content when no file is selected.
|
|
71
|
+
* - **icon** - The icon slot for icon-button variant.
|
|
72
|
+
*
|
|
73
|
+
* ### **CSS Properties:**
|
|
74
|
+
* - **--ai-file-picker-width** - The width of the file picker button. _(default: undefined)_
|
|
75
|
+
* - **--ai-file-picker-height** - The height of the file picker button. _(default: undefined)_
|
|
76
|
+
*/
|
|
77
|
+
export const ForgeAiFilePicker: React.ForwardRefExoticComponent<ForgeAiFilePickerProps>;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React, { forwardRef, useRef, useEffect } from "react";
|
|
2
|
+
import "@tylertech/forge-ai/ai-file-picker";
|
|
3
|
+
import { useEventListener } from "./react-utils.js";
|
|
4
|
+
|
|
5
|
+
export const ForgeAiFilePicker = forwardRef((props, forwardedRef) => {
|
|
6
|
+
const ref = useRef(null);
|
|
7
|
+
const { disabled, multiple, variant, accept, ...filteredProps } = props;
|
|
8
|
+
|
|
9
|
+
/** Event listeners - run once */
|
|
10
|
+
useEventListener(
|
|
11
|
+
ref,
|
|
12
|
+
"forge-ai-file-picker-change",
|
|
13
|
+
props.onForgeAiFilePickerChange,
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
return React.createElement(
|
|
17
|
+
"forge-ai-file-picker",
|
|
18
|
+
{
|
|
19
|
+
ref: (node) => {
|
|
20
|
+
ref.current = node;
|
|
21
|
+
if (typeof forwardedRef === "function") {
|
|
22
|
+
forwardedRef(node);
|
|
23
|
+
} else if (forwardedRef) {
|
|
24
|
+
forwardedRef.current = node;
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
...filteredProps,
|
|
28
|
+
variant: props.variant,
|
|
29
|
+
accept: props.accept,
|
|
30
|
+
class: props.className,
|
|
31
|
+
exportparts: props.exportparts,
|
|
32
|
+
for: props.htmlFor,
|
|
33
|
+
part: props.part,
|
|
34
|
+
tabindex: props.tabIndex,
|
|
35
|
+
disabled: props.disabled ? true : undefined,
|
|
36
|
+
multiple: props.multiple ? true : undefined,
|
|
37
|
+
style: { ...props.style },
|
|
38
|
+
},
|
|
39
|
+
props.children,
|
|
40
|
+
);
|
|
41
|
+
});
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ForgeAiFloatingChat as ForgeAiFloatingChatElement } from "@tylertech/forge-ai/ai-floating-chat";
|
|
3
|
+
|
|
4
|
+
export type { ForgeAiFloatingChatElement };
|
|
5
|
+
|
|
6
|
+
export interface ForgeAiFloatingChatProps
|
|
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
|
+
/** Indicates whether the chat is open. */
|
|
23
|
+
open?: boolean;
|
|
24
|
+
|
|
25
|
+
/** Controls the chat's positioning and size behavior.
|
|
26
|
+
When true, the chat will have an expanded width and be centered on the screen.
|
|
27
|
+
When false, the chat will be positioned at the bottom-right corner with a fixed width. */
|
|
28
|
+
expanded?: boolean;
|
|
29
|
+
|
|
30
|
+
/** 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()`. */
|
|
31
|
+
className?: string;
|
|
32
|
+
|
|
33
|
+
/** Contains a space-separated list of the part names of the element that should be exposed on the host element. */
|
|
34
|
+
exportparts?: string;
|
|
35
|
+
|
|
36
|
+
/** Used for labels to link them with their inputs (using input id). */
|
|
37
|
+
htmlFor?: string;
|
|
38
|
+
|
|
39
|
+
/** Used to help React identify which items have changed, are added, or are removed within a list. */
|
|
40
|
+
key?: number | string;
|
|
41
|
+
|
|
42
|
+
/** 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. */
|
|
43
|
+
part?: string;
|
|
44
|
+
|
|
45
|
+
/** 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. */
|
|
46
|
+
ref?: any;
|
|
47
|
+
|
|
48
|
+
/** 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. */
|
|
49
|
+
tabIndex?: number;
|
|
50
|
+
|
|
51
|
+
/** Fired when the chat is opened */
|
|
52
|
+
onForgeAiFloatingChatOpen?: (event: CustomEvent) => void;
|
|
53
|
+
|
|
54
|
+
/** Fired when the chat is closed */
|
|
55
|
+
onForgeAiFloatingChatClose?: (event: CustomEvent) => void;
|
|
56
|
+
|
|
57
|
+
/** Fired when the chat is expanded */
|
|
58
|
+
onForgeAiFloatingChatExpand?: (event: CustomEvent) => void;
|
|
59
|
+
|
|
60
|
+
/** Fired when the chat is collapsed */
|
|
61
|
+
onForgeAiFloatingChatCollapse?: (event: CustomEvent) => void;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
*
|
|
66
|
+
* ---
|
|
67
|
+
*
|
|
68
|
+
*
|
|
69
|
+
* ### **Events:**
|
|
70
|
+
* - **forge-ai-floating-chat-open** - Fired when the chat is opened
|
|
71
|
+
* - **forge-ai-floating-chat-close** - Fired when the chat is closed
|
|
72
|
+
* - **forge-ai-floating-chat-expand** - Fired when the chat is expanded
|
|
73
|
+
* - **forge-ai-floating-chat-collapse** - Fired when the chat is collapsed
|
|
74
|
+
*
|
|
75
|
+
* ### **Methods:**
|
|
76
|
+
* - **show(): _void_** - Opens the chat.
|
|
77
|
+
* - **close(): _void_** - Closes the chat.
|
|
78
|
+
* - **toggle(): _void_** - Toggles the chat open state.
|
|
79
|
+
* - **expand(): _void_** - Expands the chat to full width.
|
|
80
|
+
* - **collapse(): _void_** - Collapses the chat to normal width.
|
|
81
|
+
*
|
|
82
|
+
* ### **Slots:**
|
|
83
|
+
* - _default_ - Default slot for messages (ai-user-message, ai-response-message components)
|
|
84
|
+
* - **suggestions** - Slot for AI suggestions component
|
|
85
|
+
* - **prompt** - Slot for custom AI prompt component. If not provided, a default forge-ai-prompt will be used.
|
|
86
|
+
*/
|
|
87
|
+
export const ForgeAiFloatingChat: React.ForwardRefExoticComponent<ForgeAiFloatingChatProps>;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import React, { forwardRef, useRef, useEffect } from "react";
|
|
2
|
+
import "@tylertech/forge-ai/ai-floating-chat";
|
|
3
|
+
import { useEventListener } from "./react-utils.js";
|
|
4
|
+
|
|
5
|
+
export const ForgeAiFloatingChat = forwardRef((props, forwardedRef) => {
|
|
6
|
+
const ref = useRef(null);
|
|
7
|
+
const { open, expanded, ...filteredProps } = props;
|
|
8
|
+
|
|
9
|
+
/** Event listeners - run once */
|
|
10
|
+
useEventListener(
|
|
11
|
+
ref,
|
|
12
|
+
"forge-ai-floating-chat-open",
|
|
13
|
+
props.onForgeAiFloatingChatOpen,
|
|
14
|
+
);
|
|
15
|
+
useEventListener(
|
|
16
|
+
ref,
|
|
17
|
+
"forge-ai-floating-chat-close",
|
|
18
|
+
props.onForgeAiFloatingChatClose,
|
|
19
|
+
);
|
|
20
|
+
useEventListener(
|
|
21
|
+
ref,
|
|
22
|
+
"forge-ai-floating-chat-expand",
|
|
23
|
+
props.onForgeAiFloatingChatExpand,
|
|
24
|
+
);
|
|
25
|
+
useEventListener(
|
|
26
|
+
ref,
|
|
27
|
+
"forge-ai-floating-chat-collapse",
|
|
28
|
+
props.onForgeAiFloatingChatCollapse,
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
return React.createElement(
|
|
32
|
+
"forge-ai-floating-chat",
|
|
33
|
+
{
|
|
34
|
+
ref: (node) => {
|
|
35
|
+
ref.current = node;
|
|
36
|
+
if (typeof forwardedRef === "function") {
|
|
37
|
+
forwardedRef(node);
|
|
38
|
+
} else if (forwardedRef) {
|
|
39
|
+
forwardedRef.current = node;
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
...filteredProps,
|
|
43
|
+
class: props.className,
|
|
44
|
+
exportparts: props.exportparts,
|
|
45
|
+
for: props.htmlFor,
|
|
46
|
+
part: props.part,
|
|
47
|
+
tabindex: props.tabIndex,
|
|
48
|
+
open: props.open ? true : undefined,
|
|
49
|
+
expanded: props.expanded ? true : undefined,
|
|
50
|
+
style: { ...props.style },
|
|
51
|
+
},
|
|
52
|
+
props.children,
|
|
53
|
+
);
|
|
54
|
+
});
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ForgeAiGradientContainer as ForgeAiGradientContainerElement } from "@tylertech/forge-ai/ai-gradient-container";
|
|
3
|
+
|
|
4
|
+
export type { ForgeAiGradientContainerElement };
|
|
5
|
+
|
|
6
|
+
export interface ForgeAiGradientContainerProps
|
|
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
|
+
/** Gradient intensity variant */
|
|
23
|
+
variant?: ForgeAiGradientContainerElement["variant"];
|
|
24
|
+
|
|
25
|
+
/** 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()`. */
|
|
26
|
+
className?: string;
|
|
27
|
+
|
|
28
|
+
/** Contains a space-separated list of the part names of the element that should be exposed on the host element. */
|
|
29
|
+
exportparts?: string;
|
|
30
|
+
|
|
31
|
+
/** Used for labels to link them with their inputs (using input id). */
|
|
32
|
+
htmlFor?: string;
|
|
33
|
+
|
|
34
|
+
/** Used to help React identify which items have changed, are added, or are removed within a list. */
|
|
35
|
+
key?: number | string;
|
|
36
|
+
|
|
37
|
+
/** 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. */
|
|
38
|
+
part?: string;
|
|
39
|
+
|
|
40
|
+
/** 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. */
|
|
41
|
+
ref?: any;
|
|
42
|
+
|
|
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. */
|
|
44
|
+
tabIndex?: number;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
*
|
|
49
|
+
* ---
|
|
50
|
+
*
|
|
51
|
+
*
|
|
52
|
+
* ### **Slots:**
|
|
53
|
+
* - _default_ - Default slot for container content
|
|
54
|
+
*/
|
|
55
|
+
export const ForgeAiGradientContainer: React.ForwardRefExoticComponent<ForgeAiGradientContainerProps>;
|