@cloudscape-design/chat-components 1.0.167 → 1.0.169

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, ...props }: ChatBubbleProps): import("react/jsx-runtime").JSX.Element;
3
+ export default function ChatBubble({ type, hideAvatar, showLoadingBar, stretch, ...props }: ChatBubbleProps): import("react/jsx-runtime").JSX.Element;
@@ -4,11 +4,11 @@ import { jsx as _jsx } from "react/jsx-runtime";
4
4
  import useBaseComponent from "../internal/base-component/use-base-component";
5
5
  import { applyDisplayName } from "../internal/utils/apply-display-name";
6
6
  import InternalChatBubble from "./internal";
7
- export default function ChatBubble({ type, hideAvatar, showLoadingBar, ...props }) {
7
+ export default function ChatBubble({ type, hideAvatar, showLoadingBar, stretch, ...props }) {
8
8
  const baseComponentProps = useBaseComponent("ChatBubble", {
9
- props: { type },
9
+ props: { type, stretch },
10
10
  });
11
- return (_jsx(InternalChatBubble, { type: type, hideAvatar: hideAvatar, showLoadingBar: showLoadingBar, ...props, ...baseComponentProps }));
11
+ return (_jsx(InternalChatBubble, { type: type, hideAvatar: hideAvatar, showLoadingBar: showLoadingBar, stretch: stretch, ...props, ...baseComponentProps }));
12
12
  }
13
13
  applyDisplayName(ChatBubble, "ChatBubble");
14
14
  //# 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,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,GAAG,KAAK,EAAmB;IAChG,MAAM,kBAAkB,GAAG,gBAAgB,CAAC,YAAY,EAAE;QACxD,KAAK,EAAE,EAAE,IAAI,EAAE;KAChB,CAAC,CAAC;IACH,OAAO,CACL,KAAC,kBAAkB,IACjB,IAAI,EAAE,IAAI,EACV,UAAU,EAAE,UAAU,EACtB,cAAc,EAAE,cAAc,KAC1B,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\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, ...props }: ChatBubbleProps) {\n const baseComponentProps = useBaseComponent(\"ChatBubble\", {\n props: { type },\n });\n return (\n <InternalChatBubble\n type={type}\n hideAvatar={hideAvatar}\n showLoadingBar={showLoadingBar}\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,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\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"]}
@@ -22,6 +22,14 @@ export interface ChatBubbleProps {
22
22
  * Useful for when there are multiple consecutive messages coming from the same author.
23
23
  */
24
24
  hideAvatar?: boolean;
25
+ /**
26
+ * By default (or when this property is set to `false`), the chat bubble width fits its content.
27
+ *
28
+ * If this property is set to `true`, the bubble stretches to fill the available horizontal space
29
+ * in its container. Use this when messages contain aligned elements, such as timestamps or footer links,
30
+ * that should line up across messages.
31
+ */
32
+ stretch?: boolean;
25
33
  /**
26
34
  * An object containing CSS properties to customize the chat bubble's visual appearance.
27
35
  * Refer to the [style](/components/chat-bubble/?tabId=style) tab for more details.
@@ -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 * 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 * 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"]}
@@ -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, ariaLabel, style, __internalRootRef, ...rest }: InternalChatBubbleProps): import("react/jsx-runtime").JSX.Element;
5
+ export default function InternalChatBubble({ type, children, avatar, actions, showLoadingBar, hideAvatar, stretch, ariaLabel, style, __internalRootRef, ...rest }: InternalChatBubbleProps): import("react/jsx-runtime").JSX.Element;
@@ -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, ariaLabel, style, __internalRootRef = null, ...rest }) {
10
+ export default function InternalChatBubble({ type, children, avatar, actions, showLoadingBar, hideAvatar = false, stretch = false, 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,6 @@ 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}`]), 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
+ 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" }) }))] })] }));
23
23
  }
24
24
  //# 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,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,eAAK,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC,oBAAoB,IAAI,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,cAAc,CAAC,KAAK,CAAC,aAC5G,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 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 className={clsx(styles[\"message-area\"], styles[`chat-bubble-type-${type}`])} style={getBubbleStyle(style)}>\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,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,14 +1,15 @@
1
1
 
2
2
  import './styles.scoped.css';
3
3
  export default {
4
- "root": "awsui_root_cdujn_1es5t_11",
5
- "message-area": "awsui_message-area_cdujn_1es5t_45",
6
- "chat-bubble-type-outgoing": "awsui_chat-bubble-type-outgoing_cdujn_1es5t_59",
7
- "chat-bubble-type-incoming": "awsui_chat-bubble-type-incoming_cdujn_1es5t_63",
8
- "loading-bar-wrapper": "awsui_loading-bar-wrapper_cdujn_1es5t_68",
9
- "avatar": "awsui_avatar_cdujn_1es5t_75",
10
- "hide": "awsui_hide_cdujn_1es5t_78",
11
- "content": "awsui_content_cdujn_1es5t_82",
12
- "actions": "awsui_actions_cdujn_1es5t_86"
4
+ "root": "awsui_root_cdujn_77bzo_11",
5
+ "message-area": "awsui_message-area_cdujn_77bzo_45",
6
+ "chat-bubble-type-outgoing": "awsui_chat-bubble-type-outgoing_cdujn_77bzo_59",
7
+ "chat-bubble-type-incoming": "awsui_chat-bubble-type-incoming_cdujn_77bzo_63",
8
+ "stretch": "awsui_stretch_cdujn_77bzo_67",
9
+ "loading-bar-wrapper": "awsui_loading-bar-wrapper_cdujn_77bzo_71",
10
+ "avatar": "awsui_avatar_cdujn_77bzo_78",
11
+ "hide": "awsui_hide_cdujn_77bzo_81",
12
+ "content": "awsui_content_cdujn_77bzo_85",
13
+ "actions": "awsui_actions_cdujn_77bzo_89"
13
14
  };
14
15
 
@@ -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_1es5t_11:not(#\9) {
11
+ .awsui_root_cdujn_77bzo_11:not(#\9) {
12
12
  border-collapse: separate;
13
13
  border-spacing: 0;
14
14
  box-sizing: border-box;
@@ -42,7 +42,7 @@
42
42
  line-height: var(--line-height-heading-m-d6lkzb, 22px);
43
43
  }
44
44
 
45
- .awsui_message-area_cdujn_1es5t_45:not(#\9) {
45
+ .awsui_message-area_cdujn_77bzo_45:not(#\9) {
46
46
  position: relative;
47
47
  display: flex;
48
48
  flex-direction: column;
@@ -56,33 +56,36 @@
56
56
  border-end-start-radius: var(--border-radius-chat-bubble-qqrkau, 8px);
57
57
  border-end-end-radius: var(--border-radius-chat-bubble-qqrkau, 8px);
58
58
  }
59
- .awsui_message-area_cdujn_1es5t_45.awsui_chat-bubble-type-outgoing_cdujn_1es5t_59:not(#\9) {
59
+ .awsui_message-area_cdujn_77bzo_45.awsui_chat-bubble-type-outgoing_cdujn_77bzo_59:not(#\9) {
60
60
  color: var(--color-text-chat-bubble-outgoing-nuggry, #0f141a);
61
61
  background-color: var(--color-background-chat-bubble-outgoing-ay6nj3, transparent);
62
62
  }
63
- .awsui_message-area_cdujn_1es5t_45.awsui_chat-bubble-type-incoming_cdujn_1es5t_63:not(#\9) {
63
+ .awsui_message-area_cdujn_77bzo_45.awsui_chat-bubble-type-incoming_cdujn_77bzo_63:not(#\9) {
64
64
  color: var(--color-text-chat-bubble-incoming-ycnens, #0f141a);
65
65
  background-color: var(--color-background-chat-bubble-incoming-ykuqvi, #f6f6f9);
66
66
  }
67
+ .awsui_message-area_cdujn_77bzo_45.awsui_stretch_cdujn_77bzo_67:not(#\9) {
68
+ flex: 1;
69
+ }
67
70
 
68
- .awsui_loading-bar-wrapper_cdujn_1es5t_68:not(#\9) {
71
+ .awsui_loading-bar-wrapper_cdujn_77bzo_71:not(#\9) {
69
72
  position: absolute;
70
73
  inset-block-end: 0;
71
74
  inset-inline-start: 0;
72
75
  inline-size: 100%;
73
76
  }
74
77
 
75
- .awsui_avatar_cdujn_1es5t_75:not(#\9) {
78
+ .awsui_avatar_cdujn_77bzo_78:not(#\9) {
76
79
  padding-block: var(--space-scaled-xs-xwoogq, 8px);
77
80
  }
78
- .awsui_avatar_cdujn_1es5t_75.awsui_hide_cdujn_1es5t_78:not(#\9) {
81
+ .awsui_avatar_cdujn_77bzo_78.awsui_hide_cdujn_77bzo_81:not(#\9) {
79
82
  opacity: 0;
80
83
  }
81
84
 
82
- .awsui_content_cdujn_1es5t_82:not(#\9) {
85
+ .awsui_content_cdujn_77bzo_85:not(#\9) {
83
86
  /* Used in test utils */
84
87
  }
85
88
 
86
- .awsui_actions_cdujn_1es5t_86:not(#\9) {
89
+ .awsui_actions_cdujn_77bzo_89:not(#\9) {
87
90
  /* Used in test utils */
88
91
  }
@@ -2,14 +2,15 @@
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_1es5t_11",
6
- "message-area": "awsui_message-area_cdujn_1es5t_45",
7
- "chat-bubble-type-outgoing": "awsui_chat-bubble-type-outgoing_cdujn_1es5t_59",
8
- "chat-bubble-type-incoming": "awsui_chat-bubble-type-incoming_cdujn_1es5t_63",
9
- "loading-bar-wrapper": "awsui_loading-bar-wrapper_cdujn_1es5t_68",
10
- "avatar": "awsui_avatar_cdujn_1es5t_75",
11
- "hide": "awsui_hide_cdujn_1es5t_78",
12
- "content": "awsui_content_cdujn_1es5t_82",
13
- "actions": "awsui_actions_cdujn_1es5t_86"
5
+ "root": "awsui_root_cdujn_77bzo_11",
6
+ "message-area": "awsui_message-area_cdujn_77bzo_45",
7
+ "chat-bubble-type-outgoing": "awsui_chat-bubble-type-outgoing_cdujn_77bzo_59",
8
+ "chat-bubble-type-incoming": "awsui_chat-bubble-type-incoming_cdujn_77bzo_63",
9
+ "stretch": "awsui_stretch_cdujn_77bzo_67",
10
+ "loading-bar-wrapper": "awsui_loading-bar-wrapper_cdujn_77bzo_71",
11
+ "avatar": "awsui_avatar_cdujn_77bzo_78",
12
+ "hide": "awsui_hide_cdujn_77bzo_81",
13
+ "content": "awsui_content_cdujn_77bzo_85",
14
+ "actions": "awsui_actions_cdujn_77bzo_89"
14
15
  };
15
16
 
@@ -39,6 +39,12 @@ module.exports = {
39
39
  "optional": true,
40
40
  "description": "Adds a loading bar to the bottom of the chat bubble. This property should only be used for Generative AI loading state.\nIf avatar is being used, set its `loading` state to true."
41
41
  },
42
+ {
43
+ "name": "stretch",
44
+ "type": "boolean",
45
+ "optional": true,
46
+ "description": "By default (or when this property is set to `false`), the chat bubble width fits its content.\n\nIf this property is set to `true`, the bubble stretches to fill the available horizontal space\nin its container. Use this when messages contain aligned elements, such as timestamps or footer links,\nthat should line up across messages."
47
+ },
42
48
  {
43
49
  "name": "style",
44
50
  "type": "ChatBubbleProps.Style",
@@ -1,5 +1,5 @@
1
1
  export var PACKAGE_SOURCE = "chat-components";
2
- export var PACKAGE_VERSION = "1.0.0 (47881c08)";
2
+ export var PACKAGE_VERSION = "1.0.0 (0cc4cec8)";
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 (47881c08)",
3
+ "PACKAGE_VERSION": "1.0.0 (0cc4cec8)",
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": "47881c08f89c29d1b25030d82d5fd91e1c3f0cc2"
2
+ "commit": "0cc4cec8d8e0034167ed8f06f182943e565e624d"
3
3
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudscape-design/chat-components",
3
- "version": "1.0.167",
3
+ "version": "1.0.169",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/cloudscape-design/chat-components.git"