diff --git a/.changeset/eighty-seas-sit.md b/.changeset/eighty-seas-sit.md new file mode 100644 index 0000000000..31a7290024 --- /dev/null +++ b/.changeset/eighty-seas-sit.md @@ -0,0 +1,6 @@ +--- +"@twilio-paste/ai-chat-log": major +"@twilio-paste/core": minor +--- + +[AIChatLog]: Added a new AIChatLog component to the library to display interactions between AI entities diff --git a/.changeset/forty-clouds-clean.md b/.changeset/forty-clouds-clean.md new file mode 100644 index 0000000000..eccc865ab1 --- /dev/null +++ b/.changeset/forty-clouds-clean.md @@ -0,0 +1,6 @@ +--- +"@twilio-paste/button-group": patch +"@twilio-paste/core": patch +--- + +[Button Group] allow unattached button groups to wrap to another line diff --git a/.changeset/pretty-melons-punch.md b/.changeset/pretty-melons-punch.md new file mode 100644 index 0000000000..3b8d854eb0 --- /dev/null +++ b/.changeset/pretty-melons-punch.md @@ -0,0 +1,6 @@ +--- +"@twilio-paste/button": patch +"@twilio-paste/core": patch +--- + +[Button] Add border radius 20 to size="reset" buttons which can be overridden by passing a border radius token to variant="reset" and size="reset" buttons \ No newline at end of file diff --git a/.changeset/seven-otters-boil.md b/.changeset/seven-otters-boil.md new file mode 100644 index 0000000000..6db1272ce3 --- /dev/null +++ b/.changeset/seven-otters-boil.md @@ -0,0 +1,5 @@ +--- +"@twilio-paste/codemods": minor +--- + +[Codemods] new export (ai-chat-log) diff --git a/.codesandbox/ci.json b/.codesandbox/ci.json index 60e2907c9f..7d87a66b7f 100644 --- a/.codesandbox/ci.json +++ b/.codesandbox/ci.json @@ -5,6 +5,7 @@ "/packages/paste-icons", "/packages/paste-core/core-bundle", "/packages/paste-core/components/account-switcher", + "/packages/paste-core/components/ai-chat-log", "/packages/paste-core/components/alert", "/packages/paste-core/components/alert-dialog", "/packages/paste-core/components/anchor", diff --git a/packages/paste-codemods/tools/.cache/mappings.json b/packages/paste-codemods/tools/.cache/mappings.json index 4f44b5ffb3..4c1b330799 100644 --- a/packages/paste-codemods/tools/.cache/mappings.json +++ b/packages/paste-codemods/tools/.cache/mappings.json @@ -6,6 +6,15 @@ "AccountSwitcherItemRadio": "@twilio-paste/core/account-switcher", "AccountSwitcherSeparator": "@twilio-paste/core/account-switcher", "useAccountSwitcherState": "@twilio-paste/core/account-switcher", + "AIChatLog": "@twilio-paste/core/ai-chat-log", + "AIChatLogger": "@twilio-paste/core/ai-chat-log", + "AIChatMessage": "@twilio-paste/core/ai-chat-log", + "AIChatMessageActionCard": "@twilio-paste/core/ai-chat-log", + "AIChatMessageActionGroup": "@twilio-paste/core/ai-chat-log", + "AIChatMessageAuthor": "@twilio-paste/core/ai-chat-log", + "AIChatMessageBody": "@twilio-paste/core/ai-chat-log", + "AIChatMessageLoading": "@twilio-paste/core/ai-chat-log", + "useAIChatLogger": "@twilio-paste/core/ai-chat-log", "Alert": "@twilio-paste/core/alert", "AlertDialog": "@twilio-paste/core/alert-dialog", "Anchor": "@twilio-paste/core/anchor", diff --git a/packages/paste-core/components/ai-chat-log/__tests__/AIChatLogger.spec.tsx b/packages/paste-core/components/ai-chat-log/__tests__/AIChatLogger.spec.tsx new file mode 100644 index 0000000000..1db387ecbb --- /dev/null +++ b/packages/paste-core/components/ai-chat-log/__tests__/AIChatLogger.spec.tsx @@ -0,0 +1,35 @@ +import { render, screen } from "@testing-library/react"; +import * as React from "react"; + +import { AIChatLogger, AIChatMessage, AIChatMessageBody } from "../src"; +import type { AIChat } from "../src/useAIChatLogger"; + +const chats: AIChat[] = [ + { + id: "uid1", + variant: "bot", + content: ( + + hi + + ), + }, + { + id: "uid2", + variant: "user", + content: ( + + hello + + ), + }, +]; + +describe("ChatLogger", () => { + it("should render", () => { + render(); + expect(screen.getByRole("log")).toBeDefined(); + expect(screen.getByRole("list")).toBeDefined(); + expect(screen.getAllByRole("listitem")).toHaveLength(2); + }); +}); diff --git a/packages/paste-core/components/ai-chat-log/__tests__/aiChatLog.spec.tsx b/packages/paste-core/components/ai-chat-log/__tests__/aiChatLog.spec.tsx new file mode 100644 index 0000000000..fc37751beb --- /dev/null +++ b/packages/paste-core/components/ai-chat-log/__tests__/aiChatLog.spec.tsx @@ -0,0 +1,118 @@ +import { render, screen } from "@testing-library/react"; +import * as React from "react"; + +import { + AIChatLog, + AIChatMessage, + AIChatMessageActionCard, + AIChatMessageActionGroup, + AIChatMessageAuthor, + AIChatMessageBody, + AIChatMessageLoading, +} from "../src"; + +const ExampleAIChatLog: React.FC = () => ( + + + + Good Bot + + Lorem ipsum dolor. + + + Is this helpful? + + + {}} data-testid="loading" /> + + +); + +const CustomExampleAIChatLog: React.FC = () => ( + + + + Good Bot + + + Lorem ipsum dolor. + + + + Is this helpful? + + + {}} data-testid="loading" element="FOO_AI_CHAT_MESSAGE_LOADING" /> + + +); + +describe("AIChatLog", () => { + it("should render", () => { + render(); + expect(screen.getByRole("log")).toBeDefined(); + expect(screen.getByRole("list")).toBeDefined(); + }); +}); + +describe("Customization", () => { + it("should set element data attribute", () => { + render(); + + expect(screen.getByRole("log").getAttribute("data-paste-element")).toEqual("AI_CHAT_LOG"); + expect(screen.getByRole("list").getAttribute("data-paste-element")).toEqual("AI_CHAT_LOG_LIST"); + expect(screen.getAllByRole("listitem")[0].getAttribute("data-paste-element")).toEqual("AI_CHAT_MESSAGE"); + expect(screen.getByTestId("author").getAttribute("data-paste-element")).toEqual("AI_CHAT_MESSAGE_AUTHOR"); + expect(screen.getByTestId("author").firstElementChild?.getAttribute("data-paste-element")).toEqual( + "AI_CHAT_MESSAGE_AUTHOR_BOT_AVATAR", + ); + expect(screen.getByText("Lorem ipsum dolor.").getAttribute("data-paste-element")).toEqual("AI_CHAT_MESSAGE_BODY"); + expect(screen.getByTestId("action_group").getAttribute("data-paste-element")).toEqual( + "AI_CHAT_MESSAGE_ACTION_GROUP", + ); + expect(screen.getByTestId("action").getAttribute("data-paste-element")).toEqual("AI_CHAT_MESSAGE_ACTION_CARD"); + expect(screen.getByTestId("loading").getAttribute("data-paste-element")).toEqual("AI_CHAT_MESSAGE_LOADING"); + expect(screen.getByTestId("loading").firstElementChild?.getAttribute("data-paste-element")).toEqual( + "AI_CHAT_MESSAGE_LOADING_SKELETON", + ); + expect(screen.getByTestId("loading").lastElementChild?.getAttribute("data-paste-element")).toEqual( + "AI_CHAT_MESSAGE_LOADING_STOP_LOADING", + ); + expect( + screen.getByTestId("loading").lastElementChild?.firstElementChild?.getAttribute("data-paste-element"), + ).toEqual("AI_CHAT_MESSAGE_LOADING_STOP_BUTTON"); + }); + + it("should set custom element data attribute", () => { + render(); + + expect(screen.getByRole("log").getAttribute("data-paste-element")).toEqual("FOO_AI_LOG"); + expect(screen.getByRole("list").getAttribute("data-paste-element")).toEqual("FOO_AI_LOG_LIST"); + expect(screen.getAllByRole("listitem")[0].getAttribute("data-paste-element")).toEqual("FOO_AI_CHAT_MESSAGE"); + expect(screen.getByTestId("author").getAttribute("data-paste-element")).toEqual("FOO_AI_CHAT_MESSAGE_AUTHOR"); + expect(screen.getByTestId("author").firstElementChild?.getAttribute("data-paste-element")).toEqual( + "FOO_AI_CHAT_MESSAGE_AUTHOR_BOT_AVATAR", + ); + expect(screen.getByText("Lorem ipsum dolor.").getAttribute("data-paste-element")).toEqual( + "FOO_AI_CHAT_MESSAGE_BODY", + ); + expect(screen.getByTestId("action_group").getAttribute("data-paste-element")).toEqual( + "FOO_AI_CHAT_MESSAGE_ACTION_GROUP", + ); + expect(screen.getByTestId("action").getAttribute("data-paste-element")).toEqual("FOO_AI_CHAT_MESSAGE_ACTION_CARD"); + expect(screen.getByTestId("loading").getAttribute("data-paste-element")).toEqual("FOO_AI_CHAT_MESSAGE_LOADING"); + expect(screen.getByTestId("loading").firstElementChild?.getAttribute("data-paste-element")).toEqual( + "FOO_AI_CHAT_MESSAGE_LOADING_SKELETON", + ); + expect(screen.getByTestId("loading").lastElementChild?.getAttribute("data-paste-element")).toEqual( + "FOO_AI_CHAT_MESSAGE_LOADING_STOP_LOADING", + ); + expect( + screen.getByTestId("loading").lastElementChild?.firstElementChild?.getAttribute("data-paste-element"), + ).toEqual("FOO_AI_CHAT_MESSAGE_LOADING_STOP_BUTTON"); + }); +}); diff --git a/packages/paste-core/components/ai-chat-log/__tests__/useAIChatLogger.spec.tsx b/packages/paste-core/components/ai-chat-log/__tests__/useAIChatLogger.spec.tsx new file mode 100644 index 0000000000..7a125fed74 --- /dev/null +++ b/packages/paste-core/components/ai-chat-log/__tests__/useAIChatLogger.spec.tsx @@ -0,0 +1,88 @@ +import { act, renderHook } from "@testing-library/react"; +import * as React from "react"; + +import { AIChatMessage, AIChatMessageBody, useAIChatLogger } from "../src"; + +const aiChat = { + id: "custom-id-123", + variant: "bot", + content: ( + + hi + + ), +} as const; + +describe("useAIChatLogger", () => { + it("returns expected result with defaults", () => { + const { result } = renderHook(() => useAIChatLogger()); + + expect(result.current).toMatchObject({ + aiChats: [], + pop: expect.any(Function), + push: expect.any(Function), + }); + }); + + it("returns expected result with initialization", () => { + const { result } = renderHook(() => useAIChatLogger(aiChat)); + + expect(result.current.aiChats).toHaveLength(1); + expect(result.current.pop).toBeInstanceOf(Function); + expect(result.current.push).toBeInstanceOf(Function); + expect(result.current.aiChats[0]).toMatchObject(aiChat); + }); + + describe("push", () => { + it("pushes new aiChats with an id", () => { + const { result } = renderHook(() => useAIChatLogger()); + expect(result.current.aiChats).toHaveLength(0); + + act(() => { + result.current.push(aiChat); + }); + + expect(result.current.aiChats).toHaveLength(1); + expect(result.current.aiChats[0]).toMatchObject(aiChat); + }); + + it("pushes new aiChats without an id", () => { + const { result } = renderHook(() => useAIChatLogger()); + expect(result.current.aiChats).toHaveLength(0); + + act(() => { + const chatWithoutCustomId = { ...aiChat, id: undefined }; + result.current.push(chatWithoutCustomId); + }); + + expect(result.current.aiChats).toHaveLength(1); + expect(result.current.aiChats[0]).toMatchObject({ + id: expect.stringMatching(/^uid/), + }); + }); + }); + + describe("pop", () => { + it("pops aiChats with an id", () => { + const { result } = renderHook(() => useAIChatLogger(aiChat)); + expect(result.current.aiChats).toHaveLength(1); + + act(() => { + result.current.pop(aiChat.id); + }); + + expect(result.current.aiChats).toHaveLength(0); + }); + + it("pops aiChats without an id", () => { + const { result } = renderHook(() => useAIChatLogger(aiChat)); + expect(result.current.aiChats).toHaveLength(1); + + act(() => { + result.current.pop(); + }); + + expect(result.current.aiChats).toHaveLength(0); + }); + }); +}); diff --git a/packages/paste-core/components/ai-chat-log/build.js b/packages/paste-core/components/ai-chat-log/build.js new file mode 100644 index 0000000000..27dd98f98e --- /dev/null +++ b/packages/paste-core/components/ai-chat-log/build.js @@ -0,0 +1,3 @@ +const { build } = require("../../../../tools/build/esbuild"); + +build(require("./package.json")); diff --git a/packages/paste-core/components/ai-chat-log/package.json b/packages/paste-core/components/ai-chat-log/package.json new file mode 100644 index 0000000000..bef2f140bd --- /dev/null +++ b/packages/paste-core/components/ai-chat-log/package.json @@ -0,0 +1,79 @@ +{ + "name": "@twilio-paste/ai-chat-log", + "version": "0.0.0", + "category": "data display", + "status": "production", + "description": "Ai chat log.", + "author": "Twilio Inc.", + "license": "MIT", + "main:dev": "src/index.tsx", + "main": "dist/index.js", + "module": "dist/index.es.js", + "types": "dist/index.d.ts", + "sideEffects": false, + "publishConfig": { + "access": "public" + }, + "files": [ + "dist" + ], + "scripts": { + "build": "yarn clean && NODE_ENV=production node build.js && tsc", + "build:js": "NODE_ENV=development node build.js", + "build:typedocs": "tsx ../../../../tools/build/generate-type-docs", + "clean": "rm -rf ./dist", + "tsc": "tsc" + }, + "peerDependencies": { + "@twilio-paste/anchor": "^12.1.0", + "@twilio-paste/animation-library": "^2.0.0", + "@twilio-paste/avatar": "^9.0.0", + "@twilio-paste/box": "^10.2.0", + "@twilio-paste/button": "^14.0.0", + "@twilio-paste/color-contrast-utils": "^5.0.0", + "@twilio-paste/customization": "^8.1.1", + "@twilio-paste/design-tokens": "^10.3.0", + "@twilio-paste/icons": "^12.0.0", + "@twilio-paste/screen-reader-only": "^13.0.0", + "@twilio-paste/skeleton-loader": "^6.1.0", + "@twilio-paste/spinner": "^14.0.0", + "@twilio-paste/stack": "^8.0.0", + "@twilio-paste/style-props": "^9.1.1", + "@twilio-paste/styling-library": "^3.0.0", + "@twilio-paste/text": "^10.0.0", + "@twilio-paste/theme": "^11.0.1", + "@twilio-paste/types": "^6.0.0", + "@twilio-paste/uid-library": "^2.0.0", + "@types/react": "^16.8.6 || ^17.0.2 || ^18.0.27", + "@types/react-dom": "^16.8.6 || ^17.0.2 || ^18.0.10", + "react": "^16.8.6 || ^17.0.2 || ^18.0.0", + "react-dom": "^16.8.6 || ^17.0.2 || ^18.0.0" + }, + "devDependencies": { + "@twilio-paste/anchor": "^12.1.0", + "@twilio-paste/animation-library": "^2.0.0", + "@twilio-paste/avatar": "^9.1.0", + "@twilio-paste/box": "^10.2.0", + "@twilio-paste/button": "^14.1.0", + "@twilio-paste/color-contrast-utils": "^5.0.0", + "@twilio-paste/customization": "^8.1.1", + "@twilio-paste/design-tokens": "^10.3.0", + "@twilio-paste/icons": "^12.2.1", + "@twilio-paste/screen-reader-only": "^13.1.1", + "@twilio-paste/skeleton-loader": "^6.1.0", + "@twilio-paste/spinner": "^14.1.1", + "@twilio-paste/stack": "^8.1.0", + "@twilio-paste/style-props": "^9.1.1", + "@twilio-paste/styling-library": "^3.0.0", + "@twilio-paste/text": "^10.1.0", + "@twilio-paste/theme": "^11.0.1", + "@twilio-paste/types": "^6.0.0", + "@twilio-paste/uid-library": "^2.0.0", + "@types/react": "^18.0.27", + "@types/react-dom": "^18.0.10", + "react": "^18.0.0", + "react-dom": "^18.0.0", + "tsx": "^4.0.0", + "typescript": "^4.9.4" + } +} diff --git a/packages/paste-core/components/ai-chat-log/src/AIChatLog.tsx b/packages/paste-core/components/ai-chat-log/src/AIChatLog.tsx new file mode 100644 index 0000000000..d799912690 --- /dev/null +++ b/packages/paste-core/components/ai-chat-log/src/AIChatLog.tsx @@ -0,0 +1,38 @@ +import { Box, safelySpreadBoxProps } from "@twilio-paste/box"; +import type { BoxProps } from "@twilio-paste/box"; +import type { HTMLPasteProps } from "@twilio-paste/types"; +import * as React from "react"; + +export interface AIChatLogProps extends HTMLPasteProps<"div"> { + children?: React.ReactNode; + /** + * Overrides the default element name to apply unique styles with the Customization Provider + * @default 'AI_CHAT_LOG' + * @type {BoxProps['element']} + * @memberof AIChatLogProps + */ + element?: BoxProps["element"]; +} + +export const AIChatLog = React.forwardRef( + ({ element = "AI_CHAT_LOG", children, ...props }, ref) => { + return ( + + + {children} + + + ); + }, +); + +AIChatLog.displayName = "AIChatLog"; diff --git a/packages/paste-core/components/ai-chat-log/src/AIChatLogger.tsx b/packages/paste-core/components/ai-chat-log/src/AIChatLogger.tsx new file mode 100644 index 0000000000..e755818c26 --- /dev/null +++ b/packages/paste-core/components/ai-chat-log/src/AIChatLogger.tsx @@ -0,0 +1,52 @@ +import { animated, useReducedMotion, useTransition } from "@twilio-paste/animation-library"; +import { Box } from "@twilio-paste/box"; +import type { HTMLPasteProps } from "@twilio-paste/types"; +import * as React from "react"; + +import { AIChatLog } from "./AIChatLog"; +import type { AIChat } from "./useAIChatLogger"; + +const AnimatedAI = animated(Box); +type StyleProps = React.ComponentProps["style"]; + +export interface AIChatLoggerProps extends HTMLPasteProps<"div"> { + /** + * Array of AIs in the log. Use with useAIChatLogger() + * + * @default null + * @type {AIChat[]} + * @memberof AIChatLoggerProps + */ + aiChats: AIChat[]; + children?: never; +} + +export const AIChatLogger = React.forwardRef(({ aiChats, ...props }, ref) => { + const transitions = useTransition(aiChats, { + keys: (AIChat: AIChat) => AIChat.id, + from: (): StyleProps => ({ opacity: 0, x: 0 }), + enter: { opacity: 1, x: 0 }, + leave: (): StyleProps => ({ opacity: 0, x: 0 }), + config: { + mass: 0.7, + tension: 190, + friction: 16, + }, + }); + + const animatedAIs = useReducedMotion() + ? aiChats.map((AIChat) => React.cloneElement(AIChat.content, { key: AIChat.id })) + : transitions((styles: StyleProps, AIChat: AIChat, { key }: { key: string }) => ( + + {AIChat.content} + + )); + + return ( + + {animatedAIs} + + ); +}); + +AIChatLogger.displayName = "AIChatLogger"; diff --git a/packages/paste-core/components/ai-chat-log/src/AIChatMessage.tsx b/packages/paste-core/components/ai-chat-log/src/AIChatMessage.tsx new file mode 100644 index 0000000000..ac87899cec --- /dev/null +++ b/packages/paste-core/components/ai-chat-log/src/AIChatMessage.tsx @@ -0,0 +1,58 @@ +import { Box, safelySpreadBoxProps } from "@twilio-paste/box"; +import type { BoxElementProps } from "@twilio-paste/box"; +import type { HTMLPasteProps } from "@twilio-paste/types"; +import { useUID } from "@twilio-paste/uid-library"; +import * as React from "react"; + +import { AIMessageContext } from "./AIMessageContext"; +import type { AIMessageVariants } from "./AIMessageContext"; + +export interface AIChatMessageProps extends HTMLPasteProps<"div"> { + children?: React.ReactNode; + /** + * Overrides the default element name to apply unique styles with the Customization Provider + * + * @default "AI_CHAT_MESSAGE" + * @type {BoxProps["element"]} + * @memberof AIChatMessageProps + */ + element?: BoxElementProps["element"]; + /** + * The variant of the message to distiguish between user and bot messages + * + * @type {AIMessageVariants} + * @memberof AIChatMessageProps + */ + variant: AIMessageVariants; + /** + * Custom id for the message body + * + * @default unique ID + * @type {string} + * @memberof AIChatMessageProps + */ + id?: string; +} + +export const AIChatMessage = React.forwardRef( + ({ children, element = "AI_CHAT_MESSAGE", variant, id, ...props }, ref) => { + const AIChatMessageId = id || useUID(); + return ( + + + {children} + + + ); + }, +); + +AIChatMessage.displayName = "AIChatMessage"; diff --git a/packages/paste-core/components/ai-chat-log/src/AIChatMessageActionCard.tsx b/packages/paste-core/components/ai-chat-log/src/AIChatMessageActionCard.tsx new file mode 100644 index 0000000000..c037abc73e --- /dev/null +++ b/packages/paste-core/components/ai-chat-log/src/AIChatMessageActionCard.tsx @@ -0,0 +1,49 @@ +import { Box, safelySpreadBoxProps } from "@twilio-paste/box"; +import type { BoxElementProps } from "@twilio-paste/box"; +import type { HTMLPasteProps } from "@twilio-paste/types"; +import * as React from "react"; + +export interface AIChatMessageActionCardProps extends HTMLPasteProps<"div"> { + children?: NonNullable; + /** + * Label for the action card for screen readers + * + * @type {string} + * @memberof AIChatMessageActionGroupProps + */ + "aria-label": string; + /** + * Overrides the default element name to apply unique styles with the Customization Provider + * + * @default "AI_CHAT_MESSAGE_ACTION_CARD" + * @type {BoxProps["element"]} + * @memberof AIChatMessageActionCardProps + */ + element?: BoxElementProps["element"]; +} + +export const AIChatMessageActionCard = React.forwardRef( + ({ children, element = "AI_CHAT_MESSAGE_ACTION_CARD", ...props }, ref) => ( + + {children} + + ), +); + +AIChatMessageActionCard.displayName = "AIChatMessageActionCard"; diff --git a/packages/paste-core/components/ai-chat-log/src/AIChatMessageActionGroup.tsx b/packages/paste-core/components/ai-chat-log/src/AIChatMessageActionGroup.tsx new file mode 100644 index 0000000000..2a32672fbb --- /dev/null +++ b/packages/paste-core/components/ai-chat-log/src/AIChatMessageActionGroup.tsx @@ -0,0 +1,38 @@ +import { Box, safelySpreadBoxProps } from "@twilio-paste/box"; +import type { BoxElementProps } from "@twilio-paste/box"; +import type { HTMLPasteProps } from "@twilio-paste/types"; +import * as React from "react"; + +export interface AIChatMessageActionGroupProps extends HTMLPasteProps<"div"> { + children: NonNullable; + /** + * Overrides the default element name to apply unique styles with the Customization Provider + * + * @default "AI_CHAT_MESSAGE_ACTION_GROUP" + * @type {BoxProps["element"]} + * @memberof AIChatMessageActionGroupProps + */ + element?: BoxElementProps["element"]; +} + +export const AIChatMessageActionGroup = React.forwardRef( + ({ children, element = "AI_CHAT_MESSAGE_ACTION_GROUP", ...props }, ref) => { + return ( + + {children} + + ); + }, +); + +AIChatMessageActionGroup.displayName = "AIChatMessageActionGroup"; diff --git a/packages/paste-core/components/ai-chat-log/src/AIChatMessageAuthor.tsx b/packages/paste-core/components/ai-chat-log/src/AIChatMessageAuthor.tsx new file mode 100644 index 0000000000..6b3f229d70 --- /dev/null +++ b/packages/paste-core/components/ai-chat-log/src/AIChatMessageAuthor.tsx @@ -0,0 +1,95 @@ +import { Avatar } from "@twilio-paste/avatar"; +import type { BoxElementProps } from "@twilio-paste/box"; +import { Box, safelySpreadBoxProps } from "@twilio-paste/box"; +import { ArtificialIntelligenceIcon } from "@twilio-paste/icons/esm/ArtificialIntelligenceIcon"; +import type { GenericIconProps } from "@twilio-paste/icons/esm/types"; +import type { HTMLPasteProps } from "@twilio-paste/types"; +import * as React from "react"; + +import { AIMessageContext } from "./AIMessageContext"; + +export interface AIChatMessageAuthorProps extends HTMLPasteProps<"div"> { + /** + * The name of the author of the chat message + * + * @type {string} + * @memberof AIChatMessageAuthorProps + */ + children: string; + /** + * Overrides the default element name to apply unique styles with the Customization Provider + * + * @default "AI_CHAT_MESSAGE_AUTHOR" + * @type {BoxProps["element"]} + * @memberof AIChatMessageAuthorProps + */ + element?: BoxElementProps["element"]; + /** + * Screen reader label for the author + * + * @type {string} + * @memberof AIChatMessageAuthorProps + */ + "aria-label": string; + /** + * Custom name for the user Avatar's initials to override the default Avatar content. See Avatar API documentation for more information. + * + * @type {string} + * @memberof AIChatMessageAuthorProps + */ + avatarName?: string; + /** + * Custom src path for the user Avatar's image to override the default Avatar content. See Avatar API documentation for more information. + * + * @type {string} + * @memberof AIChatMessageAuthorProps + */ + avatarSrc?: string; + /** + * Custom svg for the user Avatar's icon to override the default Avatar content. See Avatar API documentation for more information. + * + * @type {React.FC>} + * @memberof AIChatMessageAuthorProps + */ + avatarIcon?: React.FC>; +} + +export const AIChatMessageAuthor = React.forwardRef( + ({ children, element = "AI_CHAT_MESSAGE_AUTHOR", avatarName, avatarIcon, avatarSrc, ...props }, ref) => { + const { variant } = React.useContext(AIMessageContext); + + return ( + + {variant === "bot" ? ( + + ) : ( + + )} + {children} + + ); + }, +); + +AIChatMessageAuthor.displayName = "AIChatMessageAuthor"; diff --git a/packages/paste-core/components/ai-chat-log/src/AIChatMessageBody.tsx b/packages/paste-core/components/ai-chat-log/src/AIChatMessageBody.tsx new file mode 100644 index 0000000000..d81589c611 --- /dev/null +++ b/packages/paste-core/components/ai-chat-log/src/AIChatMessageBody.tsx @@ -0,0 +1,65 @@ +import { Box, safelySpreadBoxProps } from "@twilio-paste/box"; +import type { BoxElementProps } from "@twilio-paste/box"; +import type { ThemeShape } from "@twilio-paste/theme"; +import type { HTMLPasteProps } from "@twilio-paste/types"; +import * as React from "react"; + +import { AIMessageContext } from "./AIMessageContext"; + +const Sizes = { + default: { + fontSize: "fontSize30" as ThemeShape["fontSizes"], + lineHeight: "lineHeight30" as ThemeShape["lineHeights"], + }, + fullScreen: { + fontSize: "fontSize40" as ThemeShape["fontSizes"], + lineHeight: "lineHeight40" as ThemeShape["lineHeights"], + }, +}; + +export interface AIChatMessageBodyProps extends HTMLPasteProps<"div"> { + id?: never; // id is passed down through the context from AIChatMessage for a11y (aria-controls on the rewrite button) + children?: React.ReactNode; + /** + * Overrides the default element name to apply unique styles with the Customization Provider + * + * @default "AI_CHAT_MESSAGE_BODY" + * @type {BoxProps["element"]} + * @memberof AIChatMessageBodyProps + */ + element?: BoxElementProps["element"]; + /** + * Use a larger font size and line height for fullscreen experiences. + * + * @default "default" + * @type {"default" | "fullScreen"} + * @memberof AIChatMessageBodyProps + */ + size?: "default" | "fullScreen"; +} + +export const AIChatMessageBody = React.forwardRef( + ({ children, size = "default", element = "AI_CHAT_MESSAGE_BODY", ...props }, ref) => { + const { id } = React.useContext(AIMessageContext); + + return ( + + {children} + + ); + }, +); + +AIChatMessageBody.displayName = "AIChatMessageBody"; diff --git a/packages/paste-core/components/ai-chat-log/src/AIChatMessageLoading.tsx b/packages/paste-core/components/ai-chat-log/src/AIChatMessageLoading.tsx new file mode 100644 index 0000000000..9c06822c55 --- /dev/null +++ b/packages/paste-core/components/ai-chat-log/src/AIChatMessageLoading.tsx @@ -0,0 +1,96 @@ +import { Box, safelySpreadBoxProps } from "@twilio-paste/box"; +import type { BoxElementProps } from "@twilio-paste/box"; +import { Button } from "@twilio-paste/button"; +import { StopIcon } from "@twilio-paste/icons/esm/StopIcon"; +import { ScreenReaderOnly } from "@twilio-paste/screen-reader-only"; +import { SkeletonLoader } from "@twilio-paste/skeleton-loader"; +import type { HTMLPasteProps } from "@twilio-paste/types"; +import * as React from "react"; + +import { AIMessageContext } from "./AIMessageContext"; + +const clampedRandom = (min: number, max: number): number => { + return Math.min(Math.max(min, Math.random() * max), max); +}; +export interface AIChatMessageLoadingProps extends HTMLPasteProps<"div"> { + children?: never; + /** + * Overrides the default element name to apply unique styles with the Customization Provider + * + * @default "AI_CHAT_MESSAGE_LOADING" + * @type {BoxProps["element"]} + * @memberof AIChatMessageLoadingProps + */ + element?: BoxElementProps["element"]; + /** + * Function to call when "Stop generating AI response" button is clicked. If not provided, the button will not be rendered. + * + * @type {() => void} + * @memberof AIChatMessageLoadingProps + */ + onStopLoading?: () => void; + /** + * I18n label text for the "Stop generating" button when `onStopLoading` is passed for non-english languages. + * + * @default "Stop generating" + * @type {string} + * @memberof AIChatMessageLoadingProps + */ + i18nStopGeneratingLabel?: string; + /** + * I18n accessible screen reader text to give context to the "Stop generating" button when `onStopLoading` is passed for non-english languages. Should read as a sentence, e.g. "Stop generating AI response". + * + * @default "AI response" + * @type {string} + * @memberof AIChatMessageLoadingProps + */ + i18nAIScreenReaderText?: string; +} + +export const AIChatMessageLoading = React.forwardRef( + ( + { + onStopLoading, + i18nStopGeneratingLabel = "Stop generating", + i18nAIScreenReaderText = "AI response", + element = "AI_CHAT_MESSAGE_LOADING", + ...props + }, + ref, + ) => { + const widths = React.useRef([clampedRandom(40, 75), clampedRandom(65, 100), clampedRandom(55, 80)]).current; + + const { id: messageBodyID } = React.useContext(AIMessageContext); + + return ( + + + + + {onStopLoading ? ( + + + + {i18nStopGeneratingLabel} {i18nAIScreenReaderText} + + + ) : null} + + ); + }, +); + +AIChatMessageLoading.displayName = "AIChatMessageLoading"; diff --git a/packages/paste-core/components/ai-chat-log/src/AIMessageContext.tsx b/packages/paste-core/components/ai-chat-log/src/AIMessageContext.tsx new file mode 100644 index 0000000000..8eea8b72d0 --- /dev/null +++ b/packages/paste-core/components/ai-chat-log/src/AIMessageContext.tsx @@ -0,0 +1,9 @@ +import * as React from "react"; + +export type AIMessageVariants = "bot" | "user"; + +export interface AIMessageContextProps { + variant: AIMessageVariants; + id: string; +} +export const AIMessageContext = React.createContext({} as any); diff --git a/packages/paste-core/components/ai-chat-log/src/index.tsx b/packages/paste-core/components/ai-chat-log/src/index.tsx new file mode 100644 index 0000000000..cf8f5b65eb --- /dev/null +++ b/packages/paste-core/components/ai-chat-log/src/index.tsx @@ -0,0 +1,21 @@ +export { AIChatMessage } from "./AIChatMessage"; +export type { AIChatMessageProps } from "./AIChatMessage"; +export { AIChatMessageActionGroup } from "./AIChatMessageActionGroup"; +export type { AIChatMessageActionGroupProps } from "./AIChatMessageActionGroup"; +export { AIChatMessageBody } from "./AIChatMessageBody"; +export type { AIChatMessageBodyProps } from "./AIChatMessageBody"; +export { AIChatMessageAuthor } from "./AIChatMessageAuthor"; +export type { AIChatMessageAuthorProps } from "./AIChatMessageAuthor"; +export { AIChatMessageActionCard } from "./AIChatMessageActionCard"; +export type { AIChatMessageActionCardProps } from "./AIChatMessageActionCard"; +export { AIChatMessageLoading } from "./AIChatMessageLoading"; +export type { AIChatMessageLoadingProps } from "./AIChatMessageLoading"; + +export { AIChatLog } from "./AIChatLog"; +export type { AIChatLogProps } from "./AIChatLog"; +export { useAIChatLogger } from "./useAIChatLogger"; +export type { UseAIChatLogger, AIPartialIDChat, AIChat } from "./useAIChatLogger"; +export { AIChatLogger } from "./AIChatLogger"; +export type { AIChatLoggerProps } from "./AIChatLogger"; + +export type { AIMessageVariants } from "./AIMessageContext"; diff --git a/packages/paste-core/components/ai-chat-log/src/useAIChatLogger.tsx b/packages/paste-core/components/ai-chat-log/src/useAIChatLogger.tsx new file mode 100644 index 0000000000..b13aa99184 --- /dev/null +++ b/packages/paste-core/components/ai-chat-log/src/useAIChatLogger.tsx @@ -0,0 +1,42 @@ +import { uid } from "@twilio-paste/uid-library"; +import * as React from "react"; + +import type { AIMessageVariants } from "./AIMessageContext"; + +export type AIChat = { + id: string; + variant: AIMessageVariants; + content: React.ReactElement; +}; + +export type AIPartialIDChat = Omit & Partial>; + +type PushAIChat = (chat: AIPartialIDChat) => void; +type PopAIChat = (id?: string) => void; + +export type UseAIChatLogger = (...initialChats: AIPartialIDChat[]) => { + aiChats: AIChat[]; + push: PushAIChat; + pop: PopAIChat; + clear: () => void; +}; + +const aiChatWithId = (chat: AIPartialIDChat): AIChat => ({ ...chat, id: chat.id || uid(chat.content) }); + +export const useAIChatLogger: UseAIChatLogger = (...initialChats) => { + const parsedInitialChats = React.useMemo(() => initialChats.map(aiChatWithId), [initialChats]); + + const [aiChats, setAIChats] = React.useState(parsedInitialChats); + + const push: PushAIChat = React.useCallback((next) => { + setAIChats((prev) => prev.concat(aiChatWithId(next))); + }, []); + + const pop: PopAIChat = React.useCallback((id) => { + setAIChats((prev) => (id ? prev.filter((chat) => chat.id !== id) : prev.slice(0, -1))); + }, []); + + const clear: () => void = React.useCallback(() => setAIChats([]), []); + + return { push, pop, aiChats, clear }; +}; diff --git a/packages/paste-core/components/ai-chat-log/stories/aiChatLog.stories.tsx b/packages/paste-core/components/ai-chat-log/stories/aiChatLog.stories.tsx new file mode 100644 index 0000000000..0e32b316a6 --- /dev/null +++ b/packages/paste-core/components/ai-chat-log/stories/aiChatLog.stories.tsx @@ -0,0 +1,307 @@ +// eslint-disable-next-line eslint-comments/disable-enable-pair +/* eslint-disable import/no-extraneous-dependencies */ +import { Box } from "@twilio-paste/box"; +import { Button } from "@twilio-paste/button"; +import { ButtonGroup } from "@twilio-paste/button-group"; +import { ChatComposer } from "@twilio-paste/chat-composer"; +import { CustomizationProvider } from "@twilio-paste/customization"; +import { CopyIcon } from "@twilio-paste/icons/esm/CopyIcon"; +import { RefreshIcon } from "@twilio-paste/icons/esm/RefreshIcon"; +import { SendIcon } from "@twilio-paste/icons/esm/SendIcon"; +import { ThumbsDownIcon } from "@twilio-paste/icons/esm/ThumbsDownIcon"; +import { ThumbsUpIcon } from "@twilio-paste/icons/esm/ThumbsUpIcon"; +import { UserIcon } from "@twilio-paste/icons/esm/UserIcon"; +import { useTheme } from "@twilio-paste/theme"; +import * as React from "react"; + +import { + AIChatLog, + AIChatMessage, + AIChatMessageActionCard, + AIChatMessageActionGroup, + AIChatMessageAuthor, + AIChatMessageBody, + AIChatMessageLoading, +} from "../src"; + +export default { + title: "Components/AI Chat Log", + component: AIChatLog, +}; + +export const ExampleAIChatLog = (): React.ReactNode => { + return ( + <> + + + + You + + + Lorem ipsum dolor, sit amet consectetur adipisicing elit. Deserunt delectus fuga, necessitatibus eligendi + iure adipisci facilis exercitationem officiis dolorem laborum, ex fugiat quisquam itaque, earum sit nesciunt + impedit repellat assumenda. + + + + Good Bot + + Lorem ipsum dolor, sit amet consectetur adipisicing elit. Deserunt delectus fuga, necessitatibus eligendi + iure adipisci facilis exercitationem officiis dolorem laborum, ex fugiat quisquam itaque, earum sit nesciunt + impedit repellat assumenda. + + + {}} size="rounded_small"> + 30007 + + {}} size="rounded_small"> + 30007 + + {}} size="rounded_small"> + 30009 + + + + + + + Is this helpful? + + + + + + + + + + + Rewrite + + + + Copy + + + + + + Gibby Radki + + Lorem ipsum dolor, sit amet consectetur adipisicing elit. Deserunt delectus fuga, necessitatibus eligendi + iure adipisci facilis exercitationem officiis dolorem laborum, ex fugiat quisquam itaque, earum sit nesciunt + impedit repellat assumenda. + + + + Good Bot + + {}} + i18nStopGeneratingLabel="Stop generating" + i18nAIScreenReaderText="AI response" + /> + + + + { + throw e; + }, + }} + placeholder="Chat text" + ariaLabel="A placeholder chat composer" + > + + + + + + + > + ); +}; + +export const ExampleFullScreenAIChatLog = (): React.ReactNode => { + return ( + <> + + + + You + + + Lorem ipsum dolor, sit amet consectetur adipisicing elit. Deserunt delectus fuga, necessitatibus eligendi + iure adipisci facilis exercitationem officiis dolorem laborum, ex fugiat quisquam itaque, earum sit nesciunt + impedit repellat assumenda. + + + + Good Bot + + Lorem ipsum dolor, sit amet consectetur adipisicing elit. Deserunt delectus fuga, necessitatibus eligendi + iure adipisci facilis exercitationem officiis dolorem laborum, ex fugiat quisquam itaque, earum sit nesciunt + impedit repellat assumenda. + + + {}} size="rounded_small"> + 30007 + + {}} size="rounded_small"> + 30007 + + {}} size="rounded_small"> + 30009 + + + + + + + Is this helpful? + + + + + + + + + + + Rewrite + + + + Copy + + + + + + Gibby Radki + + Lorem ipsum dolor, sit amet consectetur adipisicing elit. Deserunt delectus fuga, necessitatibus eligendi + iure adipisci facilis exercitationem officiis dolorem laborum, ex fugiat quisquam itaque, earum sit nesciunt + impedit repellat assumenda. + + + + Good Bot + + {}} + i18nStopGeneratingLabel="Stop generating" + i18nAIScreenReaderText="AI response" + /> + + + + { + throw e; + }, + }} + placeholder="Chat text" + ariaLabel="A placeholder chat composer" + > + + + + + + + > + ); +}; + +export const CustomizedExampleAIChatLog = (): React.ReactNode => { + const theme = useTheme(); + return ( + + + + + You + + + Lorem ipsum dolor, sit amet consectetur adipisicing elit. Deserunt delectus fuga, necessitatibus eligendi + iure adipisci facilis exercitationem officiis dolorem laborum, ex fugiat quisquam itaque, earum sit nesciunt + impedit repellat assumenda. + + + + Good Bot + + Lorem ipsum dolor, sit amet consectetur adipisicing elit. Deserunt delectus fuga, necessitatibus eligendi + iure adipisci facilis exercitationem officiis dolorem laborum, ex fugiat quisquam itaque, earum sit nesciunt + impedit repellat assumenda. + + + {}} size="rounded_small"> + 30007 + + {}} size="rounded_small"> + 30007 + + {}} size="rounded_small"> + 30009 + + + + + + + Is this helpful? + + + + + + + + + + + Gibby Radki + + Lorem ipsum dolor, sit amet consectetur adipisicing elit. Deserunt delectus fuga, necessitatibus eligendi + iure adipisci facilis exercitationem officiis dolorem laborum, ex fugiat quisquam itaque, earum sit nesciunt + impedit repellat assumenda. + + + + Good Bot + + {}} + i18nStopGeneratingLabel="Stop generating" + i18nAIScreenReaderText="AI response" + /> + + + + + ); +}; diff --git a/packages/paste-core/components/ai-chat-log/stories/composer.stories.tsx b/packages/paste-core/components/ai-chat-log/stories/composer.stories.tsx new file mode 100644 index 0000000000..d8d28b6f61 --- /dev/null +++ b/packages/paste-core/components/ai-chat-log/stories/composer.stories.tsx @@ -0,0 +1,246 @@ +// eslint-disable-next-line eslint-comments/disable-enable-pair +/* eslint-disable import/no-extraneous-dependencies */ +import type { AIChat } from "@twilio-paste/ai-chat-log"; +import { Box } from "@twilio-paste/box"; +import { Button } from "@twilio-paste/button"; +import { ButtonGroup } from "@twilio-paste/button-group"; +import { ChatComposer } from "@twilio-paste/chat-composer"; +import { SendIcon } from "@twilio-paste/icons/esm/SendIcon"; +import { ThumbsDownIcon } from "@twilio-paste/icons/esm/ThumbsDownIcon"; +import { ThumbsUpIcon } from "@twilio-paste/icons/esm/ThumbsUpIcon"; +import { + $getRoot, + CLEAR_EDITOR_COMMAND, + COMMAND_PRIORITY_HIGH, + ClearEditorPlugin, + KEY_ENTER_COMMAND, + useLexicalComposerContext, +} from "@twilio-paste/lexical-library"; +import * as React from "react"; + +import { + AIChatLog, + AIChatLogger, + AIChatMessage, + AIChatMessageActionCard, + AIChatMessageActionGroup, + AIChatMessageAuthor, + AIChatMessageBody, + AIChatMessageLoading, + useAIChatLogger, +} from "../src"; + +export default { + title: "Components/AI Chat Log", + component: AIChatLog, +}; + +function getRandomInt(max: number): number { + return Math.floor(Math.random() * max); +} + +const BotMessage = (props): JSX.Element => { + const [isLoading, setIsLoading] = React.useState(true); + + setTimeout(() => { + setIsLoading(false); + }, 3000); + return isLoading ? ( + + Good Bot + { + setIsLoading(false); + }} + /> + + ) : ( + + Good Bot + {props.message as string} + + ); +}; + +// eslint-disable-next-line storybook/prefer-pascal-case +const createNewMessage = (message: string): Omit => { + const messageDirection = getRandomInt(2) === 1 ? "user" : "bot"; + + return { + variant: messageDirection, + content: + messageDirection === "user" ? ( + + Gibby Radki + {message} + + ) : ( + + + + ), + }; +}; + +const SendButtonPlugin = ({ onClick }: { onClick: () => void }): JSX.Element => { + const [editor] = useLexicalComposerContext(); + + const handleSend = (): void => { + onClick(); + editor.dispatchCommand(CLEAR_EDITOR_COMMAND, undefined); + }; + + return ( + + + + + + ); +}; + +const EnterKeySubmitPlugin = ({ onKeyDown }: { onKeyDown: () => void }): null => { + const [editor] = useLexicalComposerContext(); + + const handleEnterKey = React.useCallback( + (event: KeyboardEvent) => { + const { shiftKey, ctrlKey } = event; + if (shiftKey || ctrlKey) return false; + event.preventDefault(); + event.stopPropagation(); + onKeyDown(); + editor.dispatchCommand(CLEAR_EDITOR_COMMAND, undefined); + return true; + }, + [editor, onKeyDown], + ); + + React.useEffect(() => { + return editor.registerCommand(KEY_ENTER_COMMAND, handleEnterKey, COMMAND_PRIORITY_HIGH); + }, [editor, handleEnterKey]); + return null; +}; + +export const AIChatLogComposer = (): React.ReactNode => { + const { aiChats, push } = useAIChatLogger( + { + variant: "user", + content: ( + + Gibby Radki + + Lorem ipsum dolor, sit amet consectetur adipisicing elit. Deserunt delectus fuga, necessitatibus eligendi + iure adipisci facilis exercitationem officiis dolorem laborum, ex fugiat quisquam itaque, earum sit nesciunt + impedit repellat assumenda. + + + ), + }, + { + variant: "bot", + content: ( + + Good Bot + + Lorem ipsum dolor, sit amet consectetur adipisicing elit. Deserunt delectus fuga, necessitatibus + eligendiiure adipisci facilis exercitationem officiis dolorem laborum, ex fugiat quisquam itaque, earum sit + nesciunt impedit repellat assumenda. + + + {}} size="rounded_small"> + 30007 + + {}} size="rounded_small"> + 30007 + + {}} size="rounded_small"> + 30009 + + + + + + + Is this helpful? + + + + + + + + + + ), + }, + ); + const [message, setMessage] = React.useState(""); + + const [mounted, setMounted] = React.useState(false); + const loggerRef = React.useRef(null); + const scrollerRef = React.useRef(null); + + React.useEffect(() => { + setMounted(true); + }, []); + + React.useEffect(() => { + if (!mounted || !loggerRef.current) return; + const scrollPosition: any = scrollerRef.current; + const scrollHeight: any = loggerRef.current; + scrollPosition?.scrollTo({ top: scrollHeight.scrollHeight, behavior: "smooth" }); + }, [aiChats, mounted]); + + const handleComposerChange = (editorState): void => { + editorState.read(() => { + const text = $getRoot().getTextContent(); + setMessage(text); + }); + }; + + const submitMessage = (): void => { + if (message === "") return; + push(createNewMessage(message)); + }; + return ( + + + + + + { + throw error; + }, + }} + ariaLabel="Message" + placeholder="Type here..." + onChange={handleComposerChange} + > + + + + + + + ); +}; +AIChatLogComposer.parameters = { + a11y: { + // no need to a11y check composition of a11y checked components + disable: true, + }, +}; diff --git a/packages/paste-core/components/ai-chat-log/stories/parts.stories.tsx b/packages/paste-core/components/ai-chat-log/stories/parts.stories.tsx new file mode 100644 index 0000000000..0949285fac --- /dev/null +++ b/packages/paste-core/components/ai-chat-log/stories/parts.stories.tsx @@ -0,0 +1,206 @@ +// eslint-disable-next-line eslint-comments/disable-enable-pair +/* eslint-disable import/no-extraneous-dependencies */ +import { Box } from "@twilio-paste/box"; +import { Button } from "@twilio-paste/button"; +import { ButtonGroup } from "@twilio-paste/button-group"; +import { CopyIcon } from "@twilio-paste/icons/esm/CopyIcon"; +import { RefreshIcon } from "@twilio-paste/icons/esm/RefreshIcon"; +import { ThumbsDownIcon } from "@twilio-paste/icons/esm/ThumbsDownIcon"; +import { ThumbsUpIcon } from "@twilio-paste/icons/esm/ThumbsUpIcon"; +import { UserIcon } from "@twilio-paste/icons/esm/UserIcon"; +import { InlineCode } from "@twilio-paste/inline-code"; +import * as React from "react"; + +import { + AIChatLog, + AIChatMessage, + AIChatMessageActionCard, + AIChatMessageActionGroup, + AIChatMessageAuthor, + AIChatMessageBody, + AIChatMessageLoading, +} from "../src"; + +// eslint-disable-next-line import/no-default-export +export default { + title: "Components/AI Chat Log/Parts", + component: AIChatLog, +}; + +export const AIMessageBody = (): React.ReactNode => { + return ( + + + + Use size="default" when the AI Chat Log is inside a small container. + + + + + Use size="fullScreen" when the AI Chat Log is a full screen experience. + + + + ); +}; + +export const AIMessageBodyWithParagraphs = (): React.ReactNode => { + return ( + + + + + Use size="default" when the AI Chat Log is inside a small container. + + Second paragraph within AI Chat Message Body. + + + + + + + Use size="fullScreen" when the AI Chat Log is a full screen experience. + + Second paragraph within AI Chat Message Body. + + + + ); +}; + +export const AIMessageLoading = (): React.ReactNode => { + return ( + + + + Pssst! The three rows have dynamic widths. Refresh to see it in action! + + + + + ); +}; +AIMessageLoading.storyName = "AI Message (Loading)"; + +export const AIMessageLoadingStopLoading = (): React.ReactNode => { + const [loading, setLoading] = React.useState(true); + return ( + + {loading ? ( + { + setLoading(false); + }} + /> + ) : ( + "Aborted loading!" + )} + + ); +}; +AIMessageLoadingStopLoading.storyName = "AI Message (Loading - with Stop button)"; + +export const AIMessageAuthor = (): React.ReactNode => { + return ( + + + + Nora Krantz + + + + Nora Krantz (custom icon) + + + + NoraBot + + + + ); +}; + +export const AIMessageActionGroup = (): React.ReactNode => { + return ( + + + Is this helpful? + + + + + + + + + + + Rewrite + + + + Copy + + + + ); +}; + +export const FullAIMessage = (): React.ReactNode => { + const [liked, setLiked] = React.useState(false); + const [disliked, setDisliked] = React.useState(false); + return ( + + + Good Bot + + Lorem ipsum dolor, sit amet consectetur adipisicing elit. Deserunt delectus fuga, necessitatibus eligendiiure + adipisci facilis exercitationem officiis dolorem laborum, ex fugiat quisquam itaque, earum sit nesciunt + impedit repellat assumenda. + + + + 30007 + + + 30007 + + + 30009 + + + + + + + Is this helpful? + { + setLiked(!liked); + setDisliked(false); + }} + > + + + { + setDisliked(!disliked); + setLiked(false); + }} + > + + + + + + + ); +}; diff --git a/packages/paste-core/components/ai-chat-log/stories/useAIChatLogger.stories.tsx b/packages/paste-core/components/ai-chat-log/stories/useAIChatLogger.stories.tsx new file mode 100644 index 0000000000..3c443c64b0 --- /dev/null +++ b/packages/paste-core/components/ai-chat-log/stories/useAIChatLogger.stories.tsx @@ -0,0 +1,211 @@ +// eslint-disable-next-line eslint-comments/disable-enable-pair +/* eslint-disable import/no-extraneous-dependencies */ +import type { StoryFn } from "@storybook/react"; +import { Box } from "@twilio-paste/box"; +import { Button } from "@twilio-paste/button"; +import { ButtonGroup } from "@twilio-paste/button-group"; +import { ThumbsDownIcon } from "@twilio-paste/icons/esm/ThumbsDownIcon"; +import { ThumbsUpIcon } from "@twilio-paste/icons/esm/ThumbsUpIcon"; +import { Input } from "@twilio-paste/input"; +import { Label } from "@twilio-paste/label"; +import { ListItem, OrderedList } from "@twilio-paste/list"; +import { RadioButton, RadioButtonGroup } from "@twilio-paste/radio-button-group"; +import { Stack } from "@twilio-paste/stack"; +import { uid, useUID } from "@twilio-paste/uid-library"; +import * as React from "react"; + +import { + AIChatLogger, + AIChatMessage, + AIChatMessageActionCard, + AIChatMessageActionGroup, + AIChatMessageAuthor, + AIChatMessageBody, + AIChatMessageLoading, + useAIChatLogger, +} from "../src"; +import type { AIMessageVariants, AIPartialIDChat } from "../src"; + +export default { + title: "Components/AI Chat Log/useAIChatLogger", +}; + +export const UseChatLogger: StoryFn = () => { + const pushID = useUID(); + const popID = useUID(); + const messageID = useUID(); + const variantId = useUID(); + + const { aiChats, push, pop, clear } = useAIChatLogger( + { + variant: "user", + content: ( + + Gibby Radki + + Lorem ipsum dolor, sit amet consectetur adipisicing elit. Deserunt delectus fuga, necessitatibus eligendi + iure adipisci facilis exercitationem officiis dolorem laborum, ex fugiat quisquam itaque, earum sit nesciunt + impedit repellat assumenda. + + + ), + }, + { + variant: "bot", + content: ( + + Good Bot + + Lorem ipsum dolor, sit amet consectetur adipisicing elit. Deserunt delectus fuga, necessitatibus + eligendiiure adipisci facilis exercitationem officiis dolorem laborum, ex fugiat quisquam itaque, earum sit + nesciunt impedit repellat assumenda. + + + {}} size="rounded_small"> + 30007 + + {}} size="rounded_small"> + 30007 + + {}} size="rounded_small"> + 30009 + + + + + + + Is this helpful? + + + + + + + + + + ), + }, + ); + + const handlePushSubmit: React.FormEventHandler = (e) => { + e.preventDefault(); + const form = e.currentTarget; + const data = new FormData(form); + const message = data.get("message") as string; + const variant = (data.get("variant") || "ai") as AIMessageVariants; + const id = data.get("id"); + const isBot = variant === "bot"; + + const chat: AIPartialIDChat = { + variant, + content: ( + + + {isBot ? "Good Bot" : "Gibby Radki"} + + {message} + + ), + }; + + if (id || isBot) { + chat.id = id?.toString() || uid(chat.content); + } + + if (isBot) { + push({ + id: uid(chat.content), + variant, + content: ( + + Good Bot + + + + + ), + }); + setTimeout(() => { + pop(chat.id); + push(chat); + }, 1000); + } else { + push(chat); + } + + form.reset(); + }; + + const handlePopSubmit: React.FormEventHandler = (e) => { + e.preventDefault(); + const form = e.currentTarget; + const data = new FormData(form); + const id = data.get("id")?.toString(); + + pop(id); + form.reset(); + }; + + return ( + + + + + Push + + + Message + + + + + Push ID + + + + bot + user + + + Submit Push + + + + + + Pop + + Pop ID + + + + Submit Pop + + + + + Clear + + Clear All History + + + + {aiChats.map(({ id }) => ( + + {id} + + ))} + + + + + ); +}; +UseChatLogger.parameters = { + a11y: { + // no need to a11y check composition of a11y checked components + disable: true, + }, +}; diff --git a/packages/paste-core/components/ai-chat-log/tsconfig.json b/packages/paste-core/components/ai-chat-log/tsconfig.json new file mode 100644 index 0000000000..5e8a3b17a2 --- /dev/null +++ b/packages/paste-core/components/ai-chat-log/tsconfig.json @@ -0,0 +1,8 @@ +{ + "extends": "../../../../tsconfig.json", + "compilerOptions": { + "outDir": "dist/" + }, + "include": ["src/**/*"], + "exclude": ["node_modules"] +} diff --git a/packages/paste-core/components/ai-chat-log/type-docs.json b/packages/paste-core/components/ai-chat-log/type-docs.json new file mode 100644 index 0000000000..b5f4f87b59 --- /dev/null +++ b/packages/paste-core/components/ai-chat-log/type-docs.json @@ -0,0 +1,12723 @@ +{ + "AIChatMessage": { + "variant": { + "type": "AIMessageVariants", + "defaultValue": null, + "required": true, + "externalProp": false, + "description": "The variant of the message to distiguish between user and bot messages" + }, + "about": { + "type": "string", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "accessKey": { + "type": "string", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "aria-activedescendant": { + "type": "string", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Identifies the currently active element when DOM focus is on a composite widget, textbox, group, or application." + }, + "aria-atomic": { + "type": "Booleanish", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Indicates whether assistive technologies will present all, or only parts of, the changed region based on the change notifications defined by the aria-relevant attribute." + }, + "aria-autocomplete": { + "type": "\"list\" | \"none\" | \"inline\" | \"both\"", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Indicates whether inputting text could trigger display of one or more predictions of the user's intended value for an input and specifies how predictions would be\npresented if they are made." + }, + "aria-busy": { + "type": "Booleanish", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Indicates an element is being modified and that assistive technologies MAY want to wait until the modifications are complete before exposing them to the user." + }, + "aria-checked": { + "type": "boolean | \"true\" | \"false\" | \"mixed\"", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Indicates the current \"checked\" state of checkboxes, radio buttons, and other widgets." + }, + "aria-colcount": { + "type": "number", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Defines the total number of columns in a table, grid, or treegrid." + }, + "aria-colindex": { + "type": "number", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Defines an element's column index or position with respect to the total number of columns within a table, grid, or treegrid." + }, + "aria-colspan": { + "type": "number", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Defines the number of columns spanned by a cell or gridcell within a table, grid, or treegrid." + }, + "aria-controls": { + "type": "string", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Identifies the element (or elements) whose contents or presence are controlled by the current element." + }, + "aria-current": { + "type": "| boolean\n | \"time\"\n | \"true\"\n | \"false\"\n | \"page\"\n | \"step\"\n | \"location\"\n | \"date\"", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Indicates the element that represents the current item within a container or set of related elements." + }, + "aria-describedby": { + "type": "string", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Identifies the element (or elements) that describes the object." + }, + "aria-details": { + "type": "string", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Identifies the element that provides a detailed, extended description for the object." + }, + "aria-disabled": { + "type": "Booleanish", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Indicates that the element is perceivable but disabled, so it is not editable or otherwise operable." + }, + "aria-dropeffect": { + "type": "\"link\" | \"none\" | \"copy\" | \"execute\" | \"move\" | \"popup\"", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Indicates what functions can be performed when a dragged object is released on the drop target." + }, + "aria-errormessage": { + "type": "string", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Identifies the element that provides an error message for the object." + }, + "aria-expanded": { + "type": "Booleanish", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Indicates whether the element, or another grouping element it controls, is currently expanded or collapsed." + }, + "aria-flowto": { + "type": "string", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Identifies the next element (or elements) in an alternate reading order of content which, at the user's discretion,\nallows assistive technology to override the general default of reading in document source order." + }, + "aria-grabbed": { + "type": "Booleanish", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Indicates an element's \"grabbed\" state in a drag-and-drop operation." + }, + "aria-haspopup": { + "type": "| boolean\n | \"dialog\"\n | \"menu\"\n | \"true\"\n | \"false\"\n | \"grid\"\n | \"listbox\"\n | \"tree\"", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Indicates the availability and type of interactive popup element, such as menu or dialog, that can be triggered by an element." + }, + "aria-hidden": { + "type": "Booleanish", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Indicates whether the element is exposed to an accessibility API." + }, + "aria-invalid": { + "type": "boolean | \"true\" | \"false\" | \"grammar\" | \"spelling\"", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Indicates the entered value does not conform to the format expected by the application." + }, + "aria-keyshortcuts": { + "type": "string", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Indicates keyboard shortcuts that an author has implemented to activate or give focus to an element." + }, + "aria-label": { + "type": "string", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Defines a string value that labels the current element." + }, + "aria-labelledby": { + "type": "string", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Identifies the element (or elements) that labels the current element." + }, + "aria-level": { + "type": "number", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Defines the hierarchical level of an element within a structure." + }, + "aria-live": { + "type": "\"off\" | \"assertive\" | \"polite\"", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Indicates that an element will be updated, and describes the types of updates the user agents, assistive technologies, and user can expect from the live region." + }, + "aria-modal": { + "type": "Booleanish", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Indicates whether an element is modal when displayed." + }, + "aria-multiline": { + "type": "Booleanish", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Indicates whether a text box accepts multiple lines of input or only a single line." + }, + "aria-multiselectable": { + "type": "Booleanish", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Indicates that the user may select more than one item from the current selectable descendants." + }, + "aria-orientation": { + "type": "\"horizontal\" | \"vertical\"", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Indicates whether the element's orientation is horizontal, vertical, or unknown/ambiguous." + }, + "aria-owns": { + "type": "string", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Identifies an element (or elements) in order to define a visual, functional, or contextual parent/child relationship\nbetween DOM elements where the DOM hierarchy cannot be used to represent the relationship." + }, + "aria-placeholder": { + "type": "string", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Defines a short hint (a word or short phrase) intended to aid the user with data entry when the control has no value.\nA hint could be a sample value or a brief description of the expected format." + }, + "aria-posinset": { + "type": "number", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Defines an element's number or position in the current set of listitems or treeitems. Not required if all elements in the set are present in the DOM." + }, + "aria-pressed": { + "type": "boolean | \"true\" | \"false\" | \"mixed\"", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Indicates the current \"pressed\" state of toggle buttons." + }, + "aria-readonly": { + "type": "Booleanish", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Indicates that the element is not editable, but is otherwise operable." + }, + "aria-relevant": { + "type": "| \"text\"\n | \"additions\"\n | \"additions removals\"\n | \"additions text\"\n | \"all\"\n | \"removals\"\n | \"removals additions\"\n | \"removals text\"\n | \"text additions\"\n | \"text removals\"", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Indicates what notifications the user agent will trigger when the accessibility tree within a live region is modified." + }, + "aria-required": { + "type": "Booleanish", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Indicates that user input is required on the element before a form may be submitted." + }, + "aria-roledescription": { + "type": "string", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Defines a human-readable, author-localized description for the role of an element." + }, + "aria-rowcount": { + "type": "number", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Defines the total number of rows in a table, grid, or treegrid." + }, + "aria-rowindex": { + "type": "number", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Defines an element's row index or position with respect to the total number of rows within a table, grid, or treegrid." + }, + "aria-rowspan": { + "type": "number", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Defines the number of rows spanned by a cell or gridcell within a table, grid, or treegrid." + }, + "aria-selected": { + "type": "Booleanish", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Indicates the current \"selected\" state of various widgets." + }, + "aria-setsize": { + "type": "number", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Defines the number of items in the current set of listitems or treeitems. Not required if all elements in the set are present in the DOM." + }, + "aria-sort": { + "type": "\"none\" | \"ascending\" | \"descending\" | \"other\"", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Indicates if items in a table or grid are sorted in ascending or descending order." + }, + "aria-valuemax": { + "type": "number", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Defines the maximum allowed value for a range widget." + }, + "aria-valuemin": { + "type": "number", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Defines the minimum allowed value for a range widget." + }, + "aria-valuenow": { + "type": "number", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Defines the current value for a range widget." + }, + "aria-valuetext": { + "type": "string", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Defines the human readable text alternative of aria-valuenow for a range widget." + }, + "autoCapitalize": { + "type": "string", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "autoCorrect": { + "type": "string", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "autoSave": { + "type": "string", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "contentEditable": { + "type": "Booleanish | \"inherit\"", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "contextMenu": { + "type": "string", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "dangerouslySetInnerHTML": { + "type": "{ __html: string }", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "datatype": { + "type": "string", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "defaultChecked": { + "type": "boolean", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "defaultValue": { + "type": "string | number | readonly string[]", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "dir": { + "type": "string", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "draggable": { + "type": "Booleanish", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "element": { + "type": "string", + "defaultValue": "AI_CHAT_MESSAGE", + "required": false, + "externalProp": false, + "description": "Overrides the default element name to apply unique styles with the Customization Provider" + }, + "hidden": { + "type": "boolean", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "id": { + "type": "string", + "defaultValue": "unique ID", + "required": false, + "externalProp": false, + "description": "Custom id for the message body" + }, + "inlist": { + "type": "any", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "inputMode": { + "type": "| \"text\"\n | \"none\"\n | \"search\"\n | \"tel\"\n | \"url\"\n | \"email\"\n | \"numeric\"\n | \"decimal\"", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Hints at the type of data that might be entered by the user while editing the element or its contents" + }, + "is": { + "type": "string", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Specify that a standard HTML element should behave like a defined custom built-in element" + }, + "itemID": { + "type": "string", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "itemProp": { + "type": "string", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "itemRef": { + "type": "string", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "itemScope": { + "type": "boolean", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "itemType": { + "type": "string", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "key": { + "type": "Key", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "lang": { + "type": "string", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "nonce": { + "type": "string", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onAbort": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onAbortCapture": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onAnimationEnd": { + "type": "AnimationEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onAnimationEndCapture": { + "type": "AnimationEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onAnimationIteration": { + "type": "AnimationEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onAnimationIterationCapture": { + "type": "AnimationEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onAnimationStart": { + "type": "AnimationEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onAnimationStartCapture": { + "type": "AnimationEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onAuxClick": { + "type": "MouseEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onAuxClickCapture": { + "type": "MouseEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onBeforeInput": { + "type": "FormEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onBeforeInputCapture": { + "type": "FormEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onBlur": { + "type": "FocusEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onBlurCapture": { + "type": "FocusEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onCanPlay": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onCanPlayCapture": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onCanPlayThrough": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onCanPlayThroughCapture": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onChange": { + "type": "FormEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onChangeCapture": { + "type": "FormEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onClick": { + "type": "MouseEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onClickCapture": { + "type": "MouseEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onCompositionEnd": { + "type": "CompositionEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onCompositionEndCapture": { + "type": "CompositionEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onCompositionStart": { + "type": "CompositionEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onCompositionStartCapture": { + "type": "CompositionEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onCompositionUpdate": { + "type": "CompositionEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onCompositionUpdateCapture": { + "type": "CompositionEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onContextMenu": { + "type": "MouseEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onContextMenuCapture": { + "type": "MouseEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onCopy": { + "type": "ClipboardEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onCopyCapture": { + "type": "ClipboardEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onCut": { + "type": "ClipboardEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onCutCapture": { + "type": "ClipboardEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onDoubleClick": { + "type": "MouseEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onDoubleClickCapture": { + "type": "MouseEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onDrag": { + "type": "DragEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onDragCapture": { + "type": "DragEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onDragEnd": { + "type": "DragEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onDragEndCapture": { + "type": "DragEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onDragEnter": { + "type": "DragEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onDragEnterCapture": { + "type": "DragEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onDragExit": { + "type": "DragEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onDragExitCapture": { + "type": "DragEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onDragLeave": { + "type": "DragEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onDragLeaveCapture": { + "type": "DragEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onDragOver": { + "type": "DragEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onDragOverCapture": { + "type": "DragEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onDragStart": { + "type": "DragEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onDragStartCapture": { + "type": "DragEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onDrop": { + "type": "DragEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onDropCapture": { + "type": "DragEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onDurationChange": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onDurationChangeCapture": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onEmptied": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onEmptiedCapture": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onEncrypted": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onEncryptedCapture": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onEnded": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onEndedCapture": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onError": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onErrorCapture": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onFocus": { + "type": "FocusEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onFocusCapture": { + "type": "FocusEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onGotPointerCapture": { + "type": "PointerEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onGotPointerCaptureCapture": { + "type": "PointerEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onInput": { + "type": "FormEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onInputCapture": { + "type": "FormEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onInvalid": { + "type": "FormEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onInvalidCapture": { + "type": "FormEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onKeyDown": { + "type": "KeyboardEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onKeyDownCapture": { + "type": "KeyboardEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onKeyPress": { + "type": "KeyboardEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onKeyPressCapture": { + "type": "KeyboardEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onKeyUp": { + "type": "KeyboardEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onKeyUpCapture": { + "type": "KeyboardEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onLoad": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onLoadCapture": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onLoadedData": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onLoadedDataCapture": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onLoadedMetadata": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onLoadedMetadataCapture": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onLoadStart": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onLoadStartCapture": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onLostPointerCapture": { + "type": "PointerEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onLostPointerCaptureCapture": { + "type": "PointerEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onMouseDown": { + "type": "MouseEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onMouseDownCapture": { + "type": "MouseEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onMouseEnter": { + "type": "MouseEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onMouseLeave": { + "type": "MouseEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onMouseMove": { + "type": "MouseEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onMouseMoveCapture": { + "type": "MouseEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onMouseOut": { + "type": "MouseEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onMouseOutCapture": { + "type": "MouseEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onMouseOver": { + "type": "MouseEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onMouseOverCapture": { + "type": "MouseEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onMouseUp": { + "type": "MouseEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onMouseUpCapture": { + "type": "MouseEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onPaste": { + "type": "ClipboardEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onPasteCapture": { + "type": "ClipboardEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onPause": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onPauseCapture": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onPlay": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onPlayCapture": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onPlaying": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onPlayingCapture": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onPointerCancel": { + "type": "PointerEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onPointerCancelCapture": { + "type": "PointerEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onPointerDown": { + "type": "PointerEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onPointerDownCapture": { + "type": "PointerEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onPointerEnter": { + "type": "PointerEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onPointerEnterCapture": { + "type": "PointerEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onPointerLeave": { + "type": "PointerEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onPointerLeaveCapture": { + "type": "PointerEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onPointerMove": { + "type": "PointerEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onPointerMoveCapture": { + "type": "PointerEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onPointerOut": { + "type": "PointerEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onPointerOutCapture": { + "type": "PointerEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onPointerOver": { + "type": "PointerEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onPointerOverCapture": { + "type": "PointerEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onPointerUp": { + "type": "PointerEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onPointerUpCapture": { + "type": "PointerEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onProgress": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onProgressCapture": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onRateChange": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onRateChangeCapture": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onReset": { + "type": "FormEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onResetCapture": { + "type": "FormEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onResize": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onResizeCapture": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onScroll": { + "type": "UIEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onScrollCapture": { + "type": "UIEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onSeeked": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onSeekedCapture": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onSeeking": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onSeekingCapture": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onSelect": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onSelectCapture": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onStalled": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onStalledCapture": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onSubmit": { + "type": "FormEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onSubmitCapture": { + "type": "FormEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onSuspend": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onSuspendCapture": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onTimeUpdate": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onTimeUpdateCapture": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onTouchCancel": { + "type": "TouchEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onTouchCancelCapture": { + "type": "TouchEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onTouchEnd": { + "type": "TouchEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onTouchEndCapture": { + "type": "TouchEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onTouchMove": { + "type": "TouchEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onTouchMoveCapture": { + "type": "TouchEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onTouchStart": { + "type": "TouchEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onTouchStartCapture": { + "type": "TouchEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onTransitionEnd": { + "type": "TransitionEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onTransitionEndCapture": { + "type": "TransitionEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onVolumeChange": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onVolumeChangeCapture": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onWaiting": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onWaitingCapture": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onWheel": { + "type": "WheelEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onWheelCapture": { + "type": "WheelEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "placeholder": { + "type": "string", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "prefix": { + "type": "string", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "property": { + "type": "string", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "radioGroup": { + "type": "string", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "resource": { + "type": "string", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "results": { + "type": "number", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "role": { + "type": "AriaRole", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "security": { + "type": "string", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "slot": { + "type": "string", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "spellCheck": { + "type": "Booleanish", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "suppressContentEditableWarning": { + "type": "boolean", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "suppressHydrationWarning": { + "type": "boolean", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "tabIndex": { + "type": "number", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "title": { + "type": "string", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "translate": { + "type": "\"yes\" | \"no\"", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "typeof": { + "type": "string", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "unselectable": { + "type": "\"on\" | \"off\"", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "vocab": { + "type": "string", + "defaultValue": null, + "required": false, + "externalProp": true + } + }, + "AIChatMessageActionGroup": { + "about": { + "type": "string", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "accessKey": { + "type": "string", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "aria-activedescendant": { + "type": "string", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Identifies the currently active element when DOM focus is on a composite widget, textbox, group, or application." + }, + "aria-atomic": { + "type": "Booleanish", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Indicates whether assistive technologies will present all, or only parts of, the changed region based on the change notifications defined by the aria-relevant attribute." + }, + "aria-autocomplete": { + "type": "\"list\" | \"none\" | \"inline\" | \"both\"", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Indicates whether inputting text could trigger display of one or more predictions of the user's intended value for an input and specifies how predictions would be\npresented if they are made." + }, + "aria-busy": { + "type": "Booleanish", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Indicates an element is being modified and that assistive technologies MAY want to wait until the modifications are complete before exposing them to the user." + }, + "aria-checked": { + "type": "boolean | \"true\" | \"false\" | \"mixed\"", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Indicates the current \"checked\" state of checkboxes, radio buttons, and other widgets." + }, + "aria-colcount": { + "type": "number", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Defines the total number of columns in a table, grid, or treegrid." + }, + "aria-colindex": { + "type": "number", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Defines an element's column index or position with respect to the total number of columns within a table, grid, or treegrid." + }, + "aria-colspan": { + "type": "number", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Defines the number of columns spanned by a cell or gridcell within a table, grid, or treegrid." + }, + "aria-controls": { + "type": "string", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Identifies the element (or elements) whose contents or presence are controlled by the current element." + }, + "aria-current": { + "type": "| boolean\n | \"time\"\n | \"true\"\n | \"false\"\n | \"page\"\n | \"step\"\n | \"location\"\n | \"date\"", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Indicates the element that represents the current item within a container or set of related elements." + }, + "aria-describedby": { + "type": "string", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Identifies the element (or elements) that describes the object." + }, + "aria-details": { + "type": "string", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Identifies the element that provides a detailed, extended description for the object." + }, + "aria-disabled": { + "type": "Booleanish", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Indicates that the element is perceivable but disabled, so it is not editable or otherwise operable." + }, + "aria-dropeffect": { + "type": "\"link\" | \"none\" | \"copy\" | \"execute\" | \"move\" | \"popup\"", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Indicates what functions can be performed when a dragged object is released on the drop target." + }, + "aria-errormessage": { + "type": "string", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Identifies the element that provides an error message for the object." + }, + "aria-expanded": { + "type": "Booleanish", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Indicates whether the element, or another grouping element it controls, is currently expanded or collapsed." + }, + "aria-flowto": { + "type": "string", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Identifies the next element (or elements) in an alternate reading order of content which, at the user's discretion,\nallows assistive technology to override the general default of reading in document source order." + }, + "aria-grabbed": { + "type": "Booleanish", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Indicates an element's \"grabbed\" state in a drag-and-drop operation." + }, + "aria-haspopup": { + "type": "| boolean\n | \"dialog\"\n | \"menu\"\n | \"true\"\n | \"false\"\n | \"grid\"\n | \"listbox\"\n | \"tree\"", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Indicates the availability and type of interactive popup element, such as menu or dialog, that can be triggered by an element." + }, + "aria-hidden": { + "type": "Booleanish", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Indicates whether the element is exposed to an accessibility API." + }, + "aria-invalid": { + "type": "boolean | \"true\" | \"false\" | \"grammar\" | \"spelling\"", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Indicates the entered value does not conform to the format expected by the application." + }, + "aria-keyshortcuts": { + "type": "string", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Indicates keyboard shortcuts that an author has implemented to activate or give focus to an element." + }, + "aria-label": { + "type": "string", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Defines a string value that labels the current element." + }, + "aria-labelledby": { + "type": "string", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Identifies the element (or elements) that labels the current element." + }, + "aria-level": { + "type": "number", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Defines the hierarchical level of an element within a structure." + }, + "aria-live": { + "type": "\"off\" | \"assertive\" | \"polite\"", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Indicates that an element will be updated, and describes the types of updates the user agents, assistive technologies, and user can expect from the live region." + }, + "aria-modal": { + "type": "Booleanish", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Indicates whether an element is modal when displayed." + }, + "aria-multiline": { + "type": "Booleanish", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Indicates whether a text box accepts multiple lines of input or only a single line." + }, + "aria-multiselectable": { + "type": "Booleanish", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Indicates that the user may select more than one item from the current selectable descendants." + }, + "aria-orientation": { + "type": "\"horizontal\" | \"vertical\"", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Indicates whether the element's orientation is horizontal, vertical, or unknown/ambiguous." + }, + "aria-owns": { + "type": "string", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Identifies an element (or elements) in order to define a visual, functional, or contextual parent/child relationship\nbetween DOM elements where the DOM hierarchy cannot be used to represent the relationship." + }, + "aria-placeholder": { + "type": "string", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Defines a short hint (a word or short phrase) intended to aid the user with data entry when the control has no value.\nA hint could be a sample value or a brief description of the expected format." + }, + "aria-posinset": { + "type": "number", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Defines an element's number or position in the current set of listitems or treeitems. Not required if all elements in the set are present in the DOM." + }, + "aria-pressed": { + "type": "boolean | \"true\" | \"false\" | \"mixed\"", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Indicates the current \"pressed\" state of toggle buttons." + }, + "aria-readonly": { + "type": "Booleanish", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Indicates that the element is not editable, but is otherwise operable." + }, + "aria-relevant": { + "type": "| \"text\"\n | \"additions\"\n | \"additions removals\"\n | \"additions text\"\n | \"all\"\n | \"removals\"\n | \"removals additions\"\n | \"removals text\"\n | \"text additions\"\n | \"text removals\"", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Indicates what notifications the user agent will trigger when the accessibility tree within a live region is modified." + }, + "aria-required": { + "type": "Booleanish", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Indicates that user input is required on the element before a form may be submitted." + }, + "aria-roledescription": { + "type": "string", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Defines a human-readable, author-localized description for the role of an element." + }, + "aria-rowcount": { + "type": "number", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Defines the total number of rows in a table, grid, or treegrid." + }, + "aria-rowindex": { + "type": "number", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Defines an element's row index or position with respect to the total number of rows within a table, grid, or treegrid." + }, + "aria-rowspan": { + "type": "number", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Defines the number of rows spanned by a cell or gridcell within a table, grid, or treegrid." + }, + "aria-selected": { + "type": "Booleanish", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Indicates the current \"selected\" state of various widgets." + }, + "aria-setsize": { + "type": "number", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Defines the number of items in the current set of listitems or treeitems. Not required if all elements in the set are present in the DOM." + }, + "aria-sort": { + "type": "\"none\" | \"ascending\" | \"descending\" | \"other\"", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Indicates if items in a table or grid are sorted in ascending or descending order." + }, + "aria-valuemax": { + "type": "number", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Defines the maximum allowed value for a range widget." + }, + "aria-valuemin": { + "type": "number", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Defines the minimum allowed value for a range widget." + }, + "aria-valuenow": { + "type": "number", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Defines the current value for a range widget." + }, + "aria-valuetext": { + "type": "string", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Defines the human readable text alternative of aria-valuenow for a range widget." + }, + "autoCapitalize": { + "type": "string", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "autoCorrect": { + "type": "string", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "autoSave": { + "type": "string", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "contentEditable": { + "type": "Booleanish | \"inherit\"", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "contextMenu": { + "type": "string", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "dangerouslySetInnerHTML": { + "type": "{ __html: string }", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "datatype": { + "type": "string", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "defaultChecked": { + "type": "boolean", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "defaultValue": { + "type": "string | number | readonly string[]", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "dir": { + "type": "string", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "draggable": { + "type": "Booleanish", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "element": { + "type": "string", + "defaultValue": "AI_CHAT_MESSAGE_ACTION_GROUP", + "required": false, + "externalProp": false, + "description": "Overrides the default element name to apply unique styles with the Customization Provider" + }, + "hidden": { + "type": "boolean", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "id": { + "type": "string", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "inlist": { + "type": "any", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "inputMode": { + "type": "| \"text\"\n | \"none\"\n | \"search\"\n | \"tel\"\n | \"url\"\n | \"email\"\n | \"numeric\"\n | \"decimal\"", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Hints at the type of data that might be entered by the user while editing the element or its contents" + }, + "is": { + "type": "string", + "defaultValue": null, + "required": false, + "externalProp": true, + "description": "Specify that a standard HTML element should behave like a defined custom built-in element" + }, + "itemID": { + "type": "string", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "itemProp": { + "type": "string", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "itemRef": { + "type": "string", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "itemScope": { + "type": "boolean", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "itemType": { + "type": "string", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "key": { + "type": "Key", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "lang": { + "type": "string", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "nonce": { + "type": "string", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onAbort": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onAbortCapture": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onAnimationEnd": { + "type": "AnimationEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onAnimationEndCapture": { + "type": "AnimationEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onAnimationIteration": { + "type": "AnimationEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onAnimationIterationCapture": { + "type": "AnimationEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onAnimationStart": { + "type": "AnimationEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onAnimationStartCapture": { + "type": "AnimationEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onAuxClick": { + "type": "MouseEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onAuxClickCapture": { + "type": "MouseEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onBeforeInput": { + "type": "FormEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onBeforeInputCapture": { + "type": "FormEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onBlur": { + "type": "FocusEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onBlurCapture": { + "type": "FocusEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onCanPlay": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onCanPlayCapture": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onCanPlayThrough": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onCanPlayThroughCapture": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onChange": { + "type": "FormEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onChangeCapture": { + "type": "FormEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onClick": { + "type": "MouseEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onClickCapture": { + "type": "MouseEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onCompositionEnd": { + "type": "CompositionEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onCompositionEndCapture": { + "type": "CompositionEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onCompositionStart": { + "type": "CompositionEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onCompositionStartCapture": { + "type": "CompositionEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onCompositionUpdate": { + "type": "CompositionEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onCompositionUpdateCapture": { + "type": "CompositionEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onContextMenu": { + "type": "MouseEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onContextMenuCapture": { + "type": "MouseEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onCopy": { + "type": "ClipboardEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onCopyCapture": { + "type": "ClipboardEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onCut": { + "type": "ClipboardEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onCutCapture": { + "type": "ClipboardEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onDoubleClick": { + "type": "MouseEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onDoubleClickCapture": { + "type": "MouseEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onDrag": { + "type": "DragEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onDragCapture": { + "type": "DragEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onDragEnd": { + "type": "DragEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onDragEndCapture": { + "type": "DragEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onDragEnter": { + "type": "DragEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onDragEnterCapture": { + "type": "DragEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onDragExit": { + "type": "DragEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onDragExitCapture": { + "type": "DragEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onDragLeave": { + "type": "DragEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onDragLeaveCapture": { + "type": "DragEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onDragOver": { + "type": "DragEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onDragOverCapture": { + "type": "DragEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onDragStart": { + "type": "DragEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onDragStartCapture": { + "type": "DragEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onDrop": { + "type": "DragEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onDropCapture": { + "type": "DragEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onDurationChange": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onDurationChangeCapture": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onEmptied": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onEmptiedCapture": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onEncrypted": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onEncryptedCapture": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onEnded": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onEndedCapture": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onError": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onErrorCapture": { + "type": "ReactEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onFocus": { + "type": "FocusEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onFocusCapture": { + "type": "FocusEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onGotPointerCapture": { + "type": "PointerEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onGotPointerCaptureCapture": { + "type": "PointerEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onInput": { + "type": "FormEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onInputCapture": { + "type": "FormEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onInvalid": { + "type": "FormEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onInvalidCapture": { + "type": "FormEventHandler", + "defaultValue": null, + "required": false, + "externalProp": true + }, + "onKeyDown": { + "type": "KeyboardEventHandler
+ Use size="default" when the AI Chat Log is inside a small container. +
Second paragraph within AI Chat Message Body.
+ Use size="fullScreen" when the AI Chat Log is a full screen experience. +
Pssst! The three rows have dynamic widths. Refresh to see it in action!
{id}