@cloudscape-design/chat-components 1.0.175 → 1.0.176

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,3 @@
1
1
  import { ChatBubbleProps } from "./interfaces";
2
2
  export type { ChatBubbleProps };
3
- export default function ChatBubble({ type, hideAvatar, showLoadingBar, stretch, ...props }: ChatBubbleProps): import("react/jsx-runtime").JSX.Element;
3
+ export default function ChatBubble({ type, hideAvatar, showLoadingBar, stretch, align, ...props }: ChatBubbleProps): import("react/jsx-runtime").JSX.Element;
@@ -5,11 +5,11 @@ import { jsx as _jsx } from "react/jsx-runtime";
5
5
  import useBaseComponent from "../internal/base-component/use-base-component";
6
6
  import { applyDisplayName } from "../internal/utils/apply-display-name";
7
7
  import InternalChatBubble from "./internal";
8
- export default function ChatBubble({ type, hideAvatar, showLoadingBar, stretch, ...props }) {
8
+ export default function ChatBubble({ type, hideAvatar, showLoadingBar, stretch, align = "start", ...props }) {
9
9
  const baseComponentProps = useBaseComponent("ChatBubble", {
10
- props: { type, stretch },
10
+ props: { type, stretch, align },
11
11
  });
12
- return (_jsx(InternalChatBubble, { type: type, hideAvatar: hideAvatar, showLoadingBar: showLoadingBar, stretch: stretch, ...props, ...baseComponentProps }));
12
+ return (_jsx(InternalChatBubble, { type: type, hideAvatar: hideAvatar, showLoadingBar: showLoadingBar, stretch: stretch, align: align, ...props, ...baseComponentProps }));
13
13
  }
14
14
  applyDisplayName(ChatBubble, "ChatBubble");
15
15
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/chat-bubble/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,YAAY,CAAC;;AACb,OAAO,gBAAgB,MAAM,+CAA+C,CAAC;AAC7E,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAExE,OAAO,kBAAkB,MAAM,YAAY,CAAC;AAI5C,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,cAAc,EAAE,OAAO,EAAE,GAAG,KAAK,EAAmB;IACzG,MAAM,kBAAkB,GAAG,gBAAgB,CAAC,YAAY,EAAE;QACxD,KAAK,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE;KACzB,CAAC,CAAC;IACH,OAAO,CACL,KAAC,kBAAkB,IACjB,IAAI,EAAE,IAAI,EACV,UAAU,EAAE,UAAU,EACtB,cAAc,EAAE,cAAc,EAC9B,OAAO,EAAE,OAAO,KACZ,KAAK,KACL,kBAAkB,GACtB,CACH,CAAC;AACJ,CAAC;AACD,gBAAgB,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\"use client\";\nimport useBaseComponent from \"../internal/base-component/use-base-component\";\nimport { applyDisplayName } from \"../internal/utils/apply-display-name\";\nimport { ChatBubbleProps } from \"./interfaces\";\nimport InternalChatBubble from \"./internal\";\n\nexport type { ChatBubbleProps };\n\nexport default function ChatBubble({ type, hideAvatar, showLoadingBar, stretch, ...props }: ChatBubbleProps) {\n const baseComponentProps = useBaseComponent(\"ChatBubble\", {\n props: { type, stretch },\n });\n return (\n <InternalChatBubble\n type={type}\n hideAvatar={hideAvatar}\n showLoadingBar={showLoadingBar}\n stretch={stretch}\n {...props}\n {...baseComponentProps}\n />\n );\n}\napplyDisplayName(ChatBubble, \"ChatBubble\");\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/chat-bubble/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,YAAY,CAAC;;AACb,OAAO,gBAAgB,MAAM,+CAA+C,CAAC;AAC7E,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAExE,OAAO,kBAAkB,MAAM,YAAY,CAAC;AAI5C,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,EACjC,IAAI,EACJ,UAAU,EACV,cAAc,EACd,OAAO,EACP,KAAK,GAAG,OAAO,EACf,GAAG,KAAK,EACQ;IAChB,MAAM,kBAAkB,GAAG,gBAAgB,CAAC,YAAY,EAAE;QACxD,KAAK,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE;KAChC,CAAC,CAAC;IACH,OAAO,CACL,KAAC,kBAAkB,IACjB,IAAI,EAAE,IAAI,EACV,UAAU,EAAE,UAAU,EACtB,cAAc,EAAE,cAAc,EAC9B,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,KAAK,KACR,KAAK,KACL,kBAAkB,GACtB,CACH,CAAC;AACJ,CAAC;AACD,gBAAgB,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\"use client\";\nimport useBaseComponent from \"../internal/base-component/use-base-component\";\nimport { applyDisplayName } from \"../internal/utils/apply-display-name\";\nimport { ChatBubbleProps } from \"./interfaces\";\nimport InternalChatBubble from \"./internal\";\n\nexport type { ChatBubbleProps };\n\nexport default function ChatBubble({\n type,\n hideAvatar,\n showLoadingBar,\n stretch,\n align = \"start\",\n ...props\n}: ChatBubbleProps) {\n const baseComponentProps = useBaseComponent(\"ChatBubble\", {\n props: { type, stretch, align },\n });\n return (\n <InternalChatBubble\n type={type}\n hideAvatar={hideAvatar}\n showLoadingBar={showLoadingBar}\n stretch={stretch}\n align={align}\n {...props}\n {...baseComponentProps}\n />\n );\n}\napplyDisplayName(ChatBubble, \"ChatBubble\");\n"]}
@@ -30,6 +30,13 @@ export interface ChatBubbleProps {
30
30
  * that should line up across messages.
31
31
  */
32
32
  stretch?: boolean;
33
+ /**
34
+ * Controls the alignment of the chat bubble and the avatar.
35
+ *
36
+ * - `"start"` — Aligns the bubble and the avatar on the inline-start.
37
+ * - `"end"` — Aligns the bubble and the avatar on the inline-end.
38
+ */
39
+ align?: ChatBubbleProps.Align;
33
40
  /**
34
41
  * An object containing CSS properties to customize the chat bubble's visual appearance.
35
42
  * Refer to the [style](/components/chat-bubble/?tabId=style) tab for more details.
@@ -39,6 +46,7 @@ export interface ChatBubbleProps {
39
46
  }
40
47
  export declare namespace ChatBubbleProps {
41
48
  type Type = "incoming" | "outgoing";
49
+ type Align = "start" | "end";
42
50
  interface Style {
43
51
  root?: {
44
52
  columnGap?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/chat-bubble/interfaces.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nexport interface ChatBubbleProps {\n /** Avatar slot paired with the chat bubble content. Use [avatar](/components/avatar/). */\n avatar: React.ReactNode;\n\n /** Defines the type of the chat bubble and sets its color accordingly. */\n type: ChatBubbleProps.Type;\n\n /** Content of the chat bubble */\n children: React.ReactNode;\n\n /** Actions slot of the chat bubble, placed at the footer. Use [button group](/components/button-group/). */\n actions?: React.ReactNode;\n\n /**\n * Adds a loading bar to the bottom of the chat bubble. This property should only be used for Generative AI loading state.\n * If avatar is being used, set its `loading` state to true.\n */\n showLoadingBar?: boolean;\n\n /**\n * Adds aria-label to the chat bubble container. Use this to provide a unique accessible name for each chat bubble on the page.\n * For example, \"John Doe at 3:42:10am\".\n */\n ariaLabel: string;\n\n /**\n * Hides the avatar while preserving its space.\n * Useful for when there are multiple consecutive messages coming from the same author.\n */\n hideAvatar?: boolean;\n\n /**\n * By default (or when this property is set to `false`), the chat bubble width fits its content.\n *\n * If this property is set to `true`, the bubble stretches to fill the available horizontal space\n * in its container. Use this when messages contain aligned elements, such as timestamps or footer links,\n * that should line up across messages.\n */\n stretch?: boolean;\n\n /**\n * An object containing CSS properties to customize the chat bubble's visual appearance.\n * Refer to the [style](/components/chat-bubble/?tabId=style) tab for more details.\n * @awsuiSystem core\n */\n style?: ChatBubbleProps.Style;\n}\n\nexport namespace ChatBubbleProps {\n export type Type = \"incoming\" | \"outgoing\";\n export interface Style {\n root?: {\n columnGap?: string;\n };\n bubble?: {\n background?: string;\n borderColor?: string;\n borderRadius?: string;\n borderWidth?: string;\n boxShadow?: string;\n color?: string;\n fontFamily?: string;\n fontSize?: string;\n fontWeight?: string;\n letterSpacing?: string;\n rowGap?: string;\n paddingBlock?: string;\n paddingInline?: string;\n };\n }\n}\n"]}
1
+ {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/chat-bubble/interfaces.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nexport interface ChatBubbleProps {\n /** Avatar slot paired with the chat bubble content. Use [avatar](/components/avatar/). */\n avatar: React.ReactNode;\n\n /** Defines the type of the chat bubble and sets its color accordingly. */\n type: ChatBubbleProps.Type;\n\n /** Content of the chat bubble */\n children: React.ReactNode;\n\n /** Actions slot of the chat bubble, placed at the footer. Use [button group](/components/button-group/). */\n actions?: React.ReactNode;\n\n /**\n * Adds a loading bar to the bottom of the chat bubble. This property should only be used for Generative AI loading state.\n * If avatar is being used, set its `loading` state to true.\n */\n showLoadingBar?: boolean;\n\n /**\n * Adds aria-label to the chat bubble container. Use this to provide a unique accessible name for each chat bubble on the page.\n * For example, \"John Doe at 3:42:10am\".\n */\n ariaLabel: string;\n\n /**\n * Hides the avatar while preserving its space.\n * Useful for when there are multiple consecutive messages coming from the same author.\n */\n hideAvatar?: boolean;\n\n /**\n * By default (or when this property is set to `false`), the chat bubble width fits its content.\n *\n * If this property is set to `true`, the bubble stretches to fill the available horizontal space\n * in its container. Use this when messages contain aligned elements, such as timestamps or footer links,\n * that should line up across messages.\n */\n stretch?: boolean;\n\n /**\n * Controls the alignment of the chat bubble and the avatar.\n *\n * - `\"start\"` — Aligns the bubble and the avatar on the inline-start.\n * - `\"end\"` — Aligns the bubble and the avatar on the inline-end.\n */\n align?: ChatBubbleProps.Align;\n\n /**\n * An object containing CSS properties to customize the chat bubble's visual appearance.\n * Refer to the [style](/components/chat-bubble/?tabId=style) tab for more details.\n * @awsuiSystem core\n */\n style?: ChatBubbleProps.Style;\n}\n\nexport namespace ChatBubbleProps {\n export type Type = \"incoming\" | \"outgoing\";\n export type Align = \"start\" | \"end\";\n export interface Style {\n root?: {\n columnGap?: string;\n };\n bubble?: {\n background?: string;\n borderColor?: string;\n borderRadius?: string;\n borderWidth?: string;\n boxShadow?: string;\n color?: string;\n fontFamily?: string;\n fontSize?: string;\n fontWeight?: string;\n letterSpacing?: string;\n rowGap?: string;\n paddingBlock?: string;\n paddingInline?: string;\n };\n }\n}\n"]}
@@ -2,4 +2,4 @@ import { InternalBaseComponentProps } from "../internal/base-component/use-base-
2
2
  import { ChatBubbleProps } from "./interfaces.js";
3
3
  export interface InternalChatBubbleProps extends ChatBubbleProps, InternalBaseComponentProps {
4
4
  }
5
- export default function InternalChatBubble({ type, children, avatar, actions, showLoadingBar, hideAvatar, stretch, ariaLabel, style, __internalRootRef, ...rest }: InternalChatBubbleProps): import("react/jsx-runtime").JSX.Element;
5
+ export default function InternalChatBubble({ type, children, avatar, actions, showLoadingBar, hideAvatar, stretch, align, ariaLabel, style, __internalRootRef, ...rest }: InternalChatBubbleProps): import("react/jsx-runtime").JSX.Element;
@@ -1,4 +1,4 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
3
  // SPDX-License-Identifier: Apache-2.0
4
4
  import { useEffect, useRef } from "react";
@@ -7,7 +7,7 @@ import { getDataAttributes } from "../internal/base-component/get-data-attribute
7
7
  import { InternalLoadingBar } from "../loading-bar/internal";
8
8
  import { getBubbleStyle, getChatBubbleRootStyle } from "./style";
9
9
  import styles from "./styles.css.js";
10
- export default function InternalChatBubble({ type, children, avatar, actions, showLoadingBar, hideAvatar = false, stretch = false, ariaLabel, style, __internalRootRef = null, ...rest }) {
10
+ export default function InternalChatBubble({ type, children, avatar, actions, showLoadingBar, hideAvatar = false, stretch = false, align, ariaLabel, style, __internalRootRef = null, ...rest }) {
11
11
  const avatarRef = useRef(null);
12
12
  useEffect(() => {
13
13
  // We have to do this because `inert` isn't properly supported until
@@ -19,6 +19,8 @@ export default function InternalChatBubble({ type, children, avatar, actions, sh
19
19
  avatarRef.current.inert = hideAvatar;
20
20
  }
21
21
  }, [hideAvatar]);
22
- return (_jsxs("div", { className: styles.root, ...getDataAttributes(rest), ref: __internalRootRef, role: "group", "aria-label": ariaLabel, style: getChatBubbleRootStyle(style), children: [avatar && (_jsx("div", { ref: avatarRef, className: clsx(styles.avatar, hideAvatar && styles.hide), children: avatar })), _jsxs("div", { className: clsx(styles["message-area"], styles[`chat-bubble-type-${type}`], stretch && styles.stretch), style: getBubbleStyle(style), children: [_jsx("div", { className: styles.content, children: children }), actions && _jsx("div", { className: styles.actions, children: actions }), showLoadingBar && (_jsx("div", { className: styles["loading-bar-wrapper"], children: _jsx(InternalLoadingBar, { variant: "gen-ai-masked" }) }))] })] }));
22
+ const avatarSlot = avatar && (_jsx("div", { ref: avatarRef, className: clsx(styles.avatar, hideAvatar && styles.hide), children: avatar }));
23
+ const messageArea = (_jsxs("div", { className: clsx(styles["message-area"], styles[`chat-bubble-type-${type}`], stretch && styles.stretch), style: getBubbleStyle(style), children: [_jsx("div", { className: styles.content, children: children }), actions && _jsx("div", { className: styles.actions, children: actions }), showLoadingBar && (_jsx("div", { className: styles["loading-bar-wrapper"], children: _jsx(InternalLoadingBar, { variant: "gen-ai-masked" }) }))] }));
24
+ return (_jsx("div", { className: clsx(styles.root, align === "end" && styles["alignment-end"]), ...getDataAttributes(rest), ref: __internalRootRef, role: "group", "aria-label": ariaLabel, style: getChatBubbleRootStyle(style), children: align === "end" ? (_jsxs(_Fragment, { children: [messageArea, avatarSlot] })) : (_jsxs(_Fragment, { children: [avatarSlot, messageArea] })) }));
23
25
  }
24
26
  //# sourceMappingURL=internal.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/chat-bubble/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,iBAAiB,EAAE,MAAM,gDAAgD,CAAC;AAEnF,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAE7D,OAAO,EAAE,cAAc,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAEjE,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAIrC,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,EACzC,IAAI,EACJ,QAAQ,EACR,MAAM,EACN,OAAO,EACP,cAAc,EACd,UAAU,GAAG,KAAK,EAClB,OAAO,GAAG,KAAK,EACf,SAAS,EACT,KAAK,EACL,iBAAiB,GAAG,IAAI,EACxB,GAAG,IAAI,EACiB;IACxB,MAAM,SAAS,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;IAE/C,SAAS,CAAC,GAAG,EAAE;QACb,oEAAoE;QACpE,yEAAyE;QACzE,qEAAqE;QACrE,mEAAmE;QACnE,iDAAiD;QACjD,IAAI,SAAS,CAAC,OAAO,EAAE;YACrB,SAAS,CAAC,OAAO,CAAC,KAAK,GAAG,UAAU,CAAC;SACtC;IACH,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC;IAEjB,OAAO,CACL,eACE,SAAS,EAAE,MAAM,CAAC,IAAI,KAClB,iBAAiB,CAAC,IAAI,CAAC,EAC3B,GAAG,EAAE,iBAAiB,EACtB,IAAI,EAAC,OAAO,gBACA,SAAS,EACrB,KAAK,EAAE,sBAAsB,CAAC,KAAK,CAAC,aAEnC,MAAM,IAAI,CACT,cAAK,GAAG,EAAE,SAAS,EAAE,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,IAAI,MAAM,CAAC,IAAI,CAAC,YAC3E,MAAM,GACH,CACP,EAED,eACE,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC,oBAAoB,IAAI,EAAE,CAAC,EAAE,OAAO,IAAI,MAAM,CAAC,OAAO,CAAC,EACtG,KAAK,EAAE,cAAc,CAAC,KAAK,CAAC,aAE5B,cAAK,SAAS,EAAE,MAAM,CAAC,OAAO,YAAG,QAAQ,GAAO,EAC/C,OAAO,IAAI,cAAK,SAAS,EAAE,MAAM,CAAC,OAAO,YAAG,OAAO,GAAO,EAC1D,cAAc,IAAI,CACjB,cAAK,SAAS,EAAE,MAAM,CAAC,qBAAqB,CAAC,YAC3C,KAAC,kBAAkB,IAAC,OAAO,EAAC,eAAe,GAAG,GAC1C,CACP,IACG,IACF,CACP,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { useEffect, useRef } from \"react\";\nimport clsx from \"clsx\";\n\nimport { getDataAttributes } from \"../internal/base-component/get-data-attributes\";\nimport { InternalBaseComponentProps } from \"../internal/base-component/use-base-component\";\nimport { InternalLoadingBar } from \"../loading-bar/internal\";\nimport { ChatBubbleProps } from \"./interfaces.js\";\nimport { getBubbleStyle, getChatBubbleRootStyle } from \"./style\";\n\nimport styles from \"./styles.css.js\";\n\nexport interface InternalChatBubbleProps extends ChatBubbleProps, InternalBaseComponentProps {}\n\nexport default function InternalChatBubble({\n type,\n children,\n avatar,\n actions,\n showLoadingBar,\n hideAvatar = false,\n stretch = false,\n ariaLabel,\n style,\n __internalRootRef = null,\n ...rest\n}: InternalChatBubbleProps) {\n const avatarRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n // We have to do this because `inert` isn't properly supported until\n // React 19 and this seems much more maintainable than version detection.\n // `inert` is better than `hidden` because it also blocks pointer and\n // focus events as well as hiding the contents from screen readers.\n // https://github.com/facebook/react/issues/17157\n if (avatarRef.current) {\n avatarRef.current.inert = hideAvatar;\n }\n }, [hideAvatar]);\n\n return (\n <div\n className={styles.root}\n {...getDataAttributes(rest)}\n ref={__internalRootRef}\n role=\"group\"\n aria-label={ariaLabel}\n style={getChatBubbleRootStyle(style)}\n >\n {avatar && (\n <div ref={avatarRef} className={clsx(styles.avatar, hideAvatar && styles.hide)}>\n {avatar}\n </div>\n )}\n\n <div\n className={clsx(styles[\"message-area\"], styles[`chat-bubble-type-${type}`], stretch && styles.stretch)}\n style={getBubbleStyle(style)}\n >\n <div className={styles.content}>{children}</div>\n {actions && <div className={styles.actions}>{actions}</div>}\n {showLoadingBar && (\n <div className={styles[\"loading-bar-wrapper\"]}>\n <InternalLoadingBar variant=\"gen-ai-masked\" />\n </div>\n )}\n </div>\n </div>\n );\n}\n"]}
1
+ {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/chat-bubble/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,iBAAiB,EAAE,MAAM,gDAAgD,CAAC;AAEnF,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAE7D,OAAO,EAAE,cAAc,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAEjE,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAIrC,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,EACzC,IAAI,EACJ,QAAQ,EACR,MAAM,EACN,OAAO,EACP,cAAc,EACd,UAAU,GAAG,KAAK,EAClB,OAAO,GAAG,KAAK,EACf,KAAK,EACL,SAAS,EACT,KAAK,EACL,iBAAiB,GAAG,IAAI,EACxB,GAAG,IAAI,EACiB;IACxB,MAAM,SAAS,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;IAE/C,SAAS,CAAC,GAAG,EAAE;QACb,oEAAoE;QACpE,yEAAyE;QACzE,qEAAqE;QACrE,mEAAmE;QACnE,iDAAiD;QACjD,IAAI,SAAS,CAAC,OAAO,EAAE;YACrB,SAAS,CAAC,OAAO,CAAC,KAAK,GAAG,UAAU,CAAC;SACtC;IACH,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC;IAEjB,MAAM,UAAU,GAAG,MAAM,IAAI,CAC3B,cAAK,GAAG,EAAE,SAAS,EAAE,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,IAAI,MAAM,CAAC,IAAI,CAAC,YAC3E,MAAM,GACH,CACP,CAAC;IAEF,MAAM,WAAW,GAAG,CAClB,eACE,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC,oBAAoB,IAAI,EAAE,CAAC,EAAE,OAAO,IAAI,MAAM,CAAC,OAAO,CAAC,EACtG,KAAK,EAAE,cAAc,CAAC,KAAK,CAAC,aAE5B,cAAK,SAAS,EAAE,MAAM,CAAC,OAAO,YAAG,QAAQ,GAAO,EAC/C,OAAO,IAAI,cAAK,SAAS,EAAE,MAAM,CAAC,OAAO,YAAG,OAAO,GAAO,EAC1D,cAAc,IAAI,CACjB,cAAK,SAAS,EAAE,MAAM,CAAC,qBAAqB,CAAC,YAC3C,KAAC,kBAAkB,IAAC,OAAO,EAAC,eAAe,GAAG,GAC1C,CACP,IACG,CACP,CAAC;IAEF,OAAO,CACL,cACE,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,KAAK,KAAK,IAAI,MAAM,CAAC,eAAe,CAAC,CAAC,KACpE,iBAAiB,CAAC,IAAI,CAAC,EAC3B,GAAG,EAAE,iBAAiB,EACtB,IAAI,EAAC,OAAO,gBACA,SAAS,EACrB,KAAK,EAAE,sBAAsB,CAAC,KAAK,CAAC,YAEnC,KAAK,KAAK,KAAK,CAAC,CAAC,CAAC,CACjB,8BACG,WAAW,EACX,UAAU,IACV,CACJ,CAAC,CAAC,CAAC,CACF,8BACG,UAAU,EACV,WAAW,IACX,CACJ,GACG,CACP,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { useEffect, useRef } from \"react\";\nimport clsx from \"clsx\";\n\nimport { getDataAttributes } from \"../internal/base-component/get-data-attributes\";\nimport { InternalBaseComponentProps } from \"../internal/base-component/use-base-component\";\nimport { InternalLoadingBar } from \"../loading-bar/internal\";\nimport { ChatBubbleProps } from \"./interfaces.js\";\nimport { getBubbleStyle, getChatBubbleRootStyle } from \"./style\";\n\nimport styles from \"./styles.css.js\";\n\nexport interface InternalChatBubbleProps extends ChatBubbleProps, InternalBaseComponentProps {}\n\nexport default function InternalChatBubble({\n type,\n children,\n avatar,\n actions,\n showLoadingBar,\n hideAvatar = false,\n stretch = false,\n align,\n ariaLabel,\n style,\n __internalRootRef = null,\n ...rest\n}: InternalChatBubbleProps) {\n const avatarRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n // We have to do this because `inert` isn't properly supported until\n // React 19 and this seems much more maintainable than version detection.\n // `inert` is better than `hidden` because it also blocks pointer and\n // focus events as well as hiding the contents from screen readers.\n // https://github.com/facebook/react/issues/17157\n if (avatarRef.current) {\n avatarRef.current.inert = hideAvatar;\n }\n }, [hideAvatar]);\n\n const avatarSlot = avatar && (\n <div ref={avatarRef} className={clsx(styles.avatar, hideAvatar && styles.hide)}>\n {avatar}\n </div>\n );\n\n const messageArea = (\n <div\n className={clsx(styles[\"message-area\"], styles[`chat-bubble-type-${type}`], stretch && styles.stretch)}\n style={getBubbleStyle(style)}\n >\n <div className={styles.content}>{children}</div>\n {actions && <div className={styles.actions}>{actions}</div>}\n {showLoadingBar && (\n <div className={styles[\"loading-bar-wrapper\"]}>\n <InternalLoadingBar variant=\"gen-ai-masked\" />\n </div>\n )}\n </div>\n );\n\n return (\n <div\n className={clsx(styles.root, align === \"end\" && styles[\"alignment-end\"])}\n {...getDataAttributes(rest)}\n ref={__internalRootRef}\n role=\"group\"\n aria-label={ariaLabel}\n style={getChatBubbleRootStyle(style)}\n >\n {align === \"end\" ? (\n <>\n {messageArea}\n {avatarSlot}\n </>\n ) : (\n <>\n {avatarSlot}\n {messageArea}\n </>\n )}\n </div>\n );\n}\n"]}
@@ -1,15 +1,16 @@
1
1
 
2
2
  import './styles.scoped.css';
3
3
  export default {
4
- "root": "awsui_root_cdujn_wzuig_11",
5
- "message-area": "awsui_message-area_cdujn_wzuig_45",
6
- "chat-bubble-type-outgoing": "awsui_chat-bubble-type-outgoing_cdujn_wzuig_59",
7
- "chat-bubble-type-incoming": "awsui_chat-bubble-type-incoming_cdujn_wzuig_63",
8
- "stretch": "awsui_stretch_cdujn_wzuig_67",
9
- "loading-bar-wrapper": "awsui_loading-bar-wrapper_cdujn_wzuig_71",
10
- "avatar": "awsui_avatar_cdujn_wzuig_78",
11
- "hide": "awsui_hide_cdujn_wzuig_81",
12
- "content": "awsui_content_cdujn_wzuig_85",
13
- "actions": "awsui_actions_cdujn_wzuig_89"
4
+ "root": "awsui_root_cdujn_1ggfr_11",
5
+ "alignment-end": "awsui_alignment-end_cdujn_1ggfr_44",
6
+ "message-area": "awsui_message-area_cdujn_1ggfr_48",
7
+ "chat-bubble-type-outgoing": "awsui_chat-bubble-type-outgoing_cdujn_1ggfr_62",
8
+ "chat-bubble-type-incoming": "awsui_chat-bubble-type-incoming_cdujn_1ggfr_66",
9
+ "stretch": "awsui_stretch_cdujn_1ggfr_70",
10
+ "loading-bar-wrapper": "awsui_loading-bar-wrapper_cdujn_1ggfr_74",
11
+ "avatar": "awsui_avatar_cdujn_1ggfr_81",
12
+ "hide": "awsui_hide_cdujn_1ggfr_84",
13
+ "content": "awsui_content_cdujn_1ggfr_88",
14
+ "actions": "awsui_actions_cdujn_1ggfr_92"
14
15
  };
15
16
 
@@ -8,7 +8,7 @@
8
8
  */
9
9
  /* stylelint-disable @cloudscape-design/no-motion-outside-of-mixin, selector-combinator-disallowed-list, selector-pseudo-class-no-unknown, selector-class-pattern */
10
10
  /* stylelint-enable @cloudscape-design/no-motion-outside-of-mixin, selector-combinator-disallowed-list, selector-pseudo-class-no-unknown, selector-class-pattern */
11
- .awsui_root_cdujn_wzuig_11:not(#\9) {
11
+ .awsui_root_cdujn_1ggfr_11:not(#\9) {
12
12
  border-collapse: separate;
13
13
  border-spacing: 0;
14
14
  box-sizing: border-box;
@@ -41,8 +41,11 @@
41
41
  font-size: var(--font-size-body-m-tq5a14, 14px);
42
42
  line-height: var(--line-height-heading-m-d6lkzb, 22px);
43
43
  }
44
+ .awsui_root_cdujn_1ggfr_11.awsui_alignment-end_cdujn_1ggfr_44:not(#\9) {
45
+ justify-content: flex-end;
46
+ }
44
47
 
45
- .awsui_message-area_cdujn_wzuig_45:not(#\9) {
48
+ .awsui_message-area_cdujn_1ggfr_48:not(#\9) {
46
49
  position: relative;
47
50
  display: flex;
48
51
  flex-direction: column;
@@ -56,36 +59,36 @@
56
59
  border-end-start-radius: var(--border-radius-chat-bubble-qqrkau, 8px);
57
60
  border-end-end-radius: var(--border-radius-chat-bubble-qqrkau, 8px);
58
61
  }
59
- .awsui_message-area_cdujn_wzuig_45.awsui_chat-bubble-type-outgoing_cdujn_wzuig_59:not(#\9) {
62
+ .awsui_message-area_cdujn_1ggfr_48.awsui_chat-bubble-type-outgoing_cdujn_1ggfr_62:not(#\9) {
60
63
  color: var(--color-text-chat-bubble-outgoing-225h2z, #0f141a);
61
64
  background-color: var(--color-background-chat-bubble-outgoing-lto0xq, transparent);
62
65
  }
63
- .awsui_message-area_cdujn_wzuig_45.awsui_chat-bubble-type-incoming_cdujn_wzuig_63:not(#\9) {
66
+ .awsui_message-area_cdujn_1ggfr_48.awsui_chat-bubble-type-incoming_cdujn_1ggfr_66:not(#\9) {
64
67
  color: var(--color-text-chat-bubble-incoming-383aqi, #0f141a);
65
68
  background-color: var(--color-background-chat-bubble-incoming-gkldma, #f6f6f9);
66
69
  }
67
- .awsui_message-area_cdujn_wzuig_45.awsui_stretch_cdujn_wzuig_67:not(#\9) {
70
+ .awsui_message-area_cdujn_1ggfr_48.awsui_stretch_cdujn_1ggfr_70:not(#\9) {
68
71
  flex: 1;
69
72
  }
70
73
 
71
- .awsui_loading-bar-wrapper_cdujn_wzuig_71:not(#\9) {
74
+ .awsui_loading-bar-wrapper_cdujn_1ggfr_74:not(#\9) {
72
75
  position: absolute;
73
76
  inset-block-end: 0;
74
77
  inset-inline-start: 0;
75
78
  inline-size: 100%;
76
79
  }
77
80
 
78
- .awsui_avatar_cdujn_wzuig_78:not(#\9) {
81
+ .awsui_avatar_cdujn_1ggfr_81:not(#\9) {
79
82
  padding-block: var(--space-scaled-xs-pajbd1, 8px);
80
83
  }
81
- .awsui_avatar_cdujn_wzuig_78.awsui_hide_cdujn_wzuig_81:not(#\9) {
84
+ .awsui_avatar_cdujn_1ggfr_81.awsui_hide_cdujn_1ggfr_84:not(#\9) {
82
85
  opacity: 0;
83
86
  }
84
87
 
85
- .awsui_content_cdujn_wzuig_85:not(#\9) {
88
+ .awsui_content_cdujn_1ggfr_88:not(#\9) {
86
89
  /* Used in test utils */
87
90
  }
88
91
 
89
- .awsui_actions_cdujn_wzuig_89:not(#\9) {
92
+ .awsui_actions_cdujn_1ggfr_92:not(#\9) {
90
93
  /* Used in test utils */
91
94
  }
@@ -2,15 +2,16 @@
2
2
  // es-module interop with Babel and Typescript
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  module.exports.default = {
5
- "root": "awsui_root_cdujn_wzuig_11",
6
- "message-area": "awsui_message-area_cdujn_wzuig_45",
7
- "chat-bubble-type-outgoing": "awsui_chat-bubble-type-outgoing_cdujn_wzuig_59",
8
- "chat-bubble-type-incoming": "awsui_chat-bubble-type-incoming_cdujn_wzuig_63",
9
- "stretch": "awsui_stretch_cdujn_wzuig_67",
10
- "loading-bar-wrapper": "awsui_loading-bar-wrapper_cdujn_wzuig_71",
11
- "avatar": "awsui_avatar_cdujn_wzuig_78",
12
- "hide": "awsui_hide_cdujn_wzuig_81",
13
- "content": "awsui_content_cdujn_wzuig_85",
14
- "actions": "awsui_actions_cdujn_wzuig_89"
5
+ "root": "awsui_root_cdujn_1ggfr_11",
6
+ "alignment-end": "awsui_alignment-end_cdujn_1ggfr_44",
7
+ "message-area": "awsui_message-area_cdujn_1ggfr_48",
8
+ "chat-bubble-type-outgoing": "awsui_chat-bubble-type-outgoing_cdujn_1ggfr_62",
9
+ "chat-bubble-type-incoming": "awsui_chat-bubble-type-incoming_cdujn_1ggfr_66",
10
+ "stretch": "awsui_stretch_cdujn_1ggfr_70",
11
+ "loading-bar-wrapper": "awsui_loading-bar-wrapper_cdujn_1ggfr_74",
12
+ "avatar": "awsui_avatar_cdujn_1ggfr_81",
13
+ "hide": "awsui_hide_cdujn_1ggfr_84",
14
+ "content": "awsui_content_cdujn_1ggfr_88",
15
+ "actions": "awsui_actions_cdujn_1ggfr_92"
15
16
  };
16
17
 
@@ -101,6 +101,7 @@ module.exports = {
101
101
  "folder",
102
102
  "forward-10-seconds",
103
103
  "full-screen",
104
+ "gen-ai-token",
104
105
  "globe",
105
106
  "grid-view",
106
107
  "group-active",
@@ -21,6 +21,21 @@ module.exports = {
21
21
  ],
22
22
  "functions": [],
23
23
  "properties": [
24
+ {
25
+ "name": "align",
26
+ "type": "string",
27
+ "inlineType": {
28
+ "name": "ChatBubbleProps.Align",
29
+ "type": "union",
30
+ "values": [
31
+ "start",
32
+ "end"
33
+ ]
34
+ },
35
+ "optional": true,
36
+ "description": "Controls the alignment of the chat bubble and the avatar.\n\n- `\"start\"` — Aligns the bubble and the avatar on the inline-start.\n- `\"end\"` — Aligns the bubble and the avatar on the inline-end.",
37
+ "defaultValue": "\"start\""
38
+ },
24
39
  {
25
40
  "name": "ariaLabel",
26
41
  "type": "string",
@@ -1,5 +1,5 @@
1
1
  export var PACKAGE_SOURCE = "chat-components";
2
- export var PACKAGE_VERSION = "1.0.0 (f3173b96)";
2
+ export var PACKAGE_VERSION = "1.0.0 (bfd1b196)";
3
3
  export var THEME = "open-source-visual-refresh";
4
4
  export var SYSTEM = "core";
5
5
  export var ALWAYS_VISUAL_REFRESH = true;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "PACKAGE_SOURCE": "chat-components",
3
- "PACKAGE_VERSION": "1.0.0 (f3173b96)",
3
+ "PACKAGE_VERSION": "1.0.0 (bfd1b196)",
4
4
  "THEME": "open-source-visual-refresh",
5
5
  "SYSTEM": "core",
6
6
  "ALWAYS_VISUAL_REFRESH": true
@@ -1,3 +1,3 @@
1
1
  {
2
- "commit": "f3173b96b8634b0348e17b3e85637529240012a6"
2
+ "commit": "bfd1b1969f21c549ec8fe8cdb7e8545bba9d7050"
3
3
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudscape-design/chat-components",
3
- "version": "1.0.175",
3
+ "version": "1.0.176",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/cloudscape-design/chat-components.git"