@cloudscape-design/chat-components 1.0.80 → 1.0.82
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/avatar/index.d.ts +1 -5
- package/avatar/index.js +10 -16
- package/avatar/interfaces.d.ts +77 -78
- package/avatar/internal.d.ts +3 -16
- package/avatar/internal.js +1 -3
- package/avatar/internal.js.map +1 -1
- package/avatar/loading-dots/index.d.ts +5 -9
- package/avatar/style.d.ts +1 -1
- package/chat-bubble/index.d.ts +1 -6
- package/chat-bubble/interfaces.d.ts +47 -26
- package/chat-bubble/interfaces.js.map +1 -1
- package/chat-bubble/internal.d.ts +3 -12
- package/chat-bubble/internal.js +3 -4
- package/chat-bubble/internal.js.map +1 -1
- package/chat-bubble/style.d.ts +33 -0
- package/chat-bubble/style.js +33 -0
- package/chat-bubble/style.js.map +1 -0
- package/chat-bubble/styles.css.js +9 -9
- package/chat-bubble/styles.scoped.css +16 -11
- package/chat-bubble/styles.selectors.js +9 -9
- package/index.d.ts +1 -1
- package/internal/api-docs/components/chat-bubble.js +96 -0
- package/internal/api-docs/components/index.d.ts +1 -1
- package/internal/api-docs/components/interfaces.d.ts +56 -56
- package/internal/api-docs/test-utils-doc/dom.d.ts +3 -2
- package/internal/api-docs/test-utils-doc/interfaces.d.ts +22 -22
- package/internal/api-docs/test-utils-doc/selectors.d.ts +3 -2
- package/internal/base-component/get-data-attributes.d.ts +1 -1
- package/internal/base-component/use-base-component.d.ts +3 -3
- package/internal/base-component/use-visual-refresh.d.ts +1 -1
- package/internal/environment.js +2 -2
- package/internal/environment.json +2 -2
- package/internal/events/index.d.ts +14 -18
- package/internal/generated/custom-css-properties/index.d.ts +6 -6
- package/internal/generated/theming/index.cjs.d.ts +14 -13
- package/internal/generated/theming/index.d.ts +14 -13
- package/internal/keycode.d.ts +18 -18
- package/internal/manifest.json +1 -1
- package/internal/utils/apply-display-name.d.ts +1 -1
- package/internal/utils/get-visual-theme.d.ts +1 -1
- package/internal/utils/use-forward-focus.d.ts +3 -4
- package/loading-bar/index.d.ts +1 -1
- package/loading-bar/interfaces.d.ts +8 -8
- package/loading-bar/internal.d.ts +1 -5
- package/package.json +1 -1
- package/support-prompt-group/focus-helpers.d.ts +2 -3
- package/support-prompt-group/index.d.ts +1 -2
- package/support-prompt-group/interfaces.d.ts +35 -35
- package/support-prompt-group/internal.d.ts +1 -2
- package/support-prompt-group/prompt.d.ts +4 -5
- package/test-utils/dom/avatar/index.d.ts +3 -3
- package/test-utils/dom/chat-bubble/index.d.ts +6 -6
- package/test-utils/dom/index.d.ts +75 -75
- package/test-utils/dom/loading-bar/index.d.ts +2 -2
- package/test-utils/dom/support-prompt-group/index.d.ts +11 -11
- package/test-utils/selectors/avatar/index.d.ts +3 -3
- package/test-utils/selectors/chat-bubble/index.d.ts +6 -6
- package/test-utils/selectors/index.d.ts +67 -67
- package/test-utils/selectors/loading-bar/index.d.ts +2 -2
- package/test-utils/selectors/support-prompt-group/index.d.ts +11 -11
- package/avatar/internal-do-not-use-core.js +0 -12
- /package/avatar/{internal-do-not-use-core.js.map → index.js.map} +0 -0
package/avatar/index.d.ts
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
1
1
|
import { AvatarProps } from "./interfaces";
|
|
2
2
|
export type { AvatarProps };
|
|
3
|
-
export default function Avatar({
|
|
4
|
-
color,
|
|
5
|
-
iconName,
|
|
6
|
-
...props
|
|
7
|
-
}: AvatarProps): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export default function Avatar({ color, iconName, ...props }: AvatarProps): import("react/jsx-runtime").JSX.Element;
|
package/avatar/index.js
CHANGED
|
@@ -1,18 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
2
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
validateProps('Avatar', props, ["style"], {}, 'console');
|
|
13
|
-
return React.createElement(CoreComponent, props);
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
applyDisplayName(Avatar, 'Avatar');
|
|
18
|
-
export default Avatar;
|
|
4
|
+
import useBaseComponent from "../internal/base-component/use-base-component";
|
|
5
|
+
import { applyDisplayName } from "../internal/utils/apply-display-name";
|
|
6
|
+
import InternalAvatar from "./internal";
|
|
7
|
+
export default function Avatar({ color = "default", iconName = "user-profile", ...props }) {
|
|
8
|
+
const baseComponentProps = useBaseComponent("Avatar", { props: { color, iconName } });
|
|
9
|
+
return _jsx(InternalAvatar, { color: color, iconName: iconName, ...props, ...baseComponentProps });
|
|
10
|
+
}
|
|
11
|
+
applyDisplayName(Avatar, "Avatar");
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
package/avatar/interfaces.d.ts
CHANGED
|
@@ -1,82 +1,81 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { IconProps } from "@cloudscape-design/components/icon";
|
|
3
2
|
export interface AvatarProps {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Determines the color of the avatar.
|
|
5
|
+
* Use `gen-ai` for AI assistants and `default` otherwise.
|
|
6
|
+
*/
|
|
7
|
+
color?: AvatarProps.Color;
|
|
8
|
+
/**
|
|
9
|
+
* The text content shown in the avatar's tooltip.
|
|
10
|
+
*
|
|
11
|
+
* When you use this property, make sure to include it in the `ariaLabel`.
|
|
12
|
+
*/
|
|
13
|
+
tooltipText?: string;
|
|
14
|
+
/**
|
|
15
|
+
* The text content shown directly in the avatar's body.
|
|
16
|
+
* Can be 1 or 2 symbols long, every subsequent symbol is ignored.
|
|
17
|
+
* Use it to define initials that uniquely identify the avatar's owner.
|
|
18
|
+
*/
|
|
19
|
+
initials?: string;
|
|
20
|
+
/**
|
|
21
|
+
* When set to true, a loading indicator is shown in avatar.
|
|
22
|
+
*/
|
|
23
|
+
loading?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Text to describe the avatar for assistive technology.
|
|
26
|
+
* When more than one avatar is used, provide a unique label for each.
|
|
27
|
+
* For example, "Avatar of John Doe" or "Avatar of generative AI assistant".
|
|
28
|
+
*
|
|
29
|
+
* If `tooltipText` is used make sure to include it in the `ariaLabel`.
|
|
30
|
+
*/
|
|
31
|
+
ariaLabel: string;
|
|
32
|
+
/**
|
|
33
|
+
* Specifies the icon to be displayed as Avatar.
|
|
34
|
+
* Use `gen-ai` icon for AI assistants. By default `user-profile` icon is used.
|
|
35
|
+
*
|
|
36
|
+
* If you set both `iconName` and `initials`, `initials` will take precedence.
|
|
37
|
+
*/
|
|
38
|
+
iconName?: IconProps.Name;
|
|
39
|
+
/**
|
|
40
|
+
* Specifies the URL of a custom icon. Use this property if the icon you want isn't available, and your custom icon can't be an SVG.
|
|
41
|
+
* @deprecated Use `iconSvg` or `imgUrl` instead.
|
|
42
|
+
*/
|
|
43
|
+
iconUrl?: string;
|
|
44
|
+
/**
|
|
45
|
+
* Specifies the SVG of a custom icon.
|
|
46
|
+
* Use this property if the icon you want isn't available.
|
|
47
|
+
*/
|
|
48
|
+
iconSvg?: React.ReactNode;
|
|
49
|
+
/**
|
|
50
|
+
* Specifies the URL of a custom image. If you set both `iconUrl` and `imgUrl`, `imgUrl` will take precedence.
|
|
51
|
+
*/
|
|
52
|
+
imgUrl?: string;
|
|
53
|
+
/**
|
|
54
|
+
* @awsuiSystem core
|
|
55
|
+
*/
|
|
56
|
+
style?: AvatarProps.Style;
|
|
57
|
+
/**
|
|
58
|
+
* Defines the width and height of the avatar.
|
|
59
|
+
* This value corresponds to the `width` CSS-property and will center and crop images using `object-fit: cover`.
|
|
60
|
+
* The default and minimum width value is 28px.
|
|
61
|
+
*/
|
|
62
|
+
width?: number;
|
|
64
63
|
}
|
|
65
64
|
export declare namespace AvatarProps {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
}
|
|
65
|
+
type Color = "default" | "gen-ai";
|
|
66
|
+
interface Style {
|
|
67
|
+
root?: {
|
|
68
|
+
background?: string;
|
|
69
|
+
borderColor?: string;
|
|
70
|
+
borderRadius?: string;
|
|
71
|
+
borderWidth?: string;
|
|
72
|
+
boxShadow?: string;
|
|
73
|
+
color?: string;
|
|
74
|
+
focusRing?: {
|
|
75
|
+
borderColor?: string;
|
|
76
|
+
borderRadius?: string;
|
|
77
|
+
borderWidth?: string;
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
}
|
package/avatar/internal.d.ts
CHANGED
|
@@ -1,18 +1,5 @@
|
|
|
1
1
|
import { InternalBaseComponentProps } from "../internal/base-component/use-base-component";
|
|
2
2
|
import { AvatarProps } from "./interfaces.js";
|
|
3
|
-
export interface InternalAvatarProps extends AvatarProps, InternalBaseComponentProps {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
tooltipText,
|
|
7
|
-
initials,
|
|
8
|
-
loading,
|
|
9
|
-
ariaLabel,
|
|
10
|
-
iconName,
|
|
11
|
-
iconSvg,
|
|
12
|
-
iconUrl,
|
|
13
|
-
imgUrl,
|
|
14
|
-
style,
|
|
15
|
-
width,
|
|
16
|
-
__internalRootRef,
|
|
17
|
-
...rest
|
|
18
|
-
}: InternalAvatarProps): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export interface InternalAvatarProps extends AvatarProps, InternalBaseComponentProps {
|
|
4
|
+
}
|
|
5
|
+
export default function InternalAvatar({ color, tooltipText, initials, loading, ariaLabel, iconName, iconSvg, iconUrl, imgUrl, style, width, __internalRootRef, ...rest }: InternalAvatarProps): import("react/jsx-runtime").JSX.Element;
|
package/avatar/internal.js
CHANGED
|
@@ -52,8 +52,6 @@ export default function InternalAvatar({ color, tooltipText, initials, loading =
|
|
|
52
52
|
setShowTooltip(false);
|
|
53
53
|
},
|
|
54
54
|
};
|
|
55
|
-
return (_jsxs("div", { ...getDataAttributes(rest), ref: mergedRef, tabIndex: 0, className: clsx(styles.root, styles[`avatar-color-${color}`], { [styles.initials]: initials }), role: "img", "aria-label": ariaLabel, ...tooltipAttributes, style: { [customCssProps.avatarSize]: `${computedSize}px`, ...getRootStyles(style) }, children: [showTooltip && tooltipText &&
|
|
56
|
-
// This is added to ensure tooltip is closed when clicked for consistency with other tooltip usages
|
|
57
|
-
contentAttributes: { onPointerDown: () => setShowTooltip(false) } })), _jsx("div", { className: styles.content, "aria-hidden": "true", style: getContentStyles(style), children: _jsx(AvatarContent, { color: color, ariaLabel: ariaLabel, initials: initials, loading: loading, iconName: iconName, iconSvg: iconSvg, iconUrl: iconUrl, imgUrl: imgUrl, style: style, width: computedSize }) })] }));
|
|
55
|
+
return (_jsxs("div", { ...getDataAttributes(rest), ref: mergedRef, tabIndex: 0, className: clsx(styles.root, styles[`avatar-color-${color}`], { [styles.initials]: initials }), role: "img", "aria-label": ariaLabel, ...tooltipAttributes, style: { [customCssProps.avatarSize]: `${computedSize}px`, ...getRootStyles(style) }, children: [showTooltip && tooltipText && _jsx(Tooltip, { className: styles.tooltip, value: tooltipText, trackRef: handleRef }), _jsx("div", { className: styles.content, "aria-hidden": "true", style: getContentStyles(style), children: _jsx(AvatarContent, { color: color, ariaLabel: ariaLabel, initials: initials, loading: loading, iconName: iconName, iconSvg: iconSvg, iconUrl: iconUrl, imgUrl: imgUrl, style: style, width: computedSize }) })] }));
|
|
58
56
|
}
|
|
59
57
|
//# sourceMappingURL=internal.js.map
|
package/avatar/internal.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/avatar/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACzC,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,+CAA+C,CAAC;AACvF,OAAO,IAAI,MAAM,oCAAoC,CAAC;AACtD,OAAO,OAAO,MAAM,2DAA2D,CAAC;AAEhF,OAAO,EAAE,iBAAiB,EAAE,MAAM,gDAAgD,CAAC;AAEnF,OAAO,cAAc,MAAM,6CAA6C,CAAC;AAEzE,OAAO,WAAW,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE1E,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAIrC,MAAM,aAAa,GAAG,C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B,CAAC;QACD,YAAY,EAAE,GAAG,EAAE;YACjB,cAAc,CAAC,IAAI,CAAC,CAAC;QACvB,CAAC;QACD,UAAU,EAAE,GAAG,EAAE;YACf,cAAc,CAAC,KAAK,CAAC,CAAC;QACxB,CAAC;KACF,CAAC;IAEF,OAAO,CACL,kBACM,iBAAiB,CAAC,IAAI,CAAC,EAC3B,GAAG,EAAE,SAAS,EACd,QAAQ,EAAE,CAAC,EACX,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,gBAAgB,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,QAAQ,EAAE,CAAC,EAC9F,IAAI,EAAC,KAAK,gBACE,SAAS,KACjB,iBAAiB,EACrB,KAAK,EAAE,EAAE,CAAC,cAAc,CAAC,UAAU,CAAC,EAAE,GAAG,YAAY,IAAI,EAAE,GAAG,aAAa,CAAC,KAAK,CAAC,EAAE,aAEnF,WAAW,IAAI,WAAW,IAAI,KAAC,OAAO,IAAC,SAAS,EAAE,MAAM,CAAC,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,GAAI,EAI9G,cAAK,SAAS,EAAE,MAAM,CAAC,OAAO,iBAAc,MAAM,EAAC,KAAK,EAAE,gBAAgB,CAAC,KAAK,CAAC,YAC/E,KAAC,aAAa,IACZ,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,KAAK,EACZ,KAAK,EAAE,YAAY,GACnB,GACE,IACF,CACP,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { useRef, useState } from \"react\";\nimport clsx from \"clsx\";\n\nimport { useMergeRefs, warnOnce } from \"@cloudscape-design/component-toolkit/internal\";\nimport Icon from \"@cloudscape-design/components/icon\";\nimport Tooltip from \"@cloudscape-design/components/internal/tooltip-do-not-use\";\n\nimport { getDataAttributes } from \"../internal/base-component/get-data-attributes\";\nimport { InternalBaseComponentProps } from \"../internal/base-component/use-base-component\";\nimport customCssProps from \"../internal/generated/custom-css-properties\";\nimport { AvatarProps } from \"./interfaces.js\";\nimport LoadingDots from \"./loading-dots\";\nimport { getContentStyles, getImageStyles, getRootStyles } from \"./style\";\n\nimport styles from \"./styles.css.js\";\n\nexport interface InternalAvatarProps extends AvatarProps, InternalBaseComponentProps {}\n\nconst AvatarContent = ({\n color,\n loading,\n initials,\n iconName,\n iconSvg,\n iconUrl,\n ariaLabel,\n width,\n imgUrl,\n style,\n}: AvatarProps) => {\n if (loading) {\n return <LoadingDots color={color} width={width} style={style} />;\n }\n\n if (imgUrl) {\n return <img className={styles.image} src={imgUrl} style={getImageStyles(style)} />;\n }\n\n if (initials) {\n const letters = initials.length > 2 ? initials.slice(0, 2) : initials;\n\n if (initials.length > 2) {\n warnOnce(\"Avatar\", `\"initials\" is longer than 2 characters. Only the first two characters are shown.`);\n }\n\n return <span className={styles.initials}>{letters}</span>;\n }\n\n return <Icon name={iconName} svg={iconSvg} url={iconUrl} alt={ariaLabel} size=\"inherit\" />;\n};\n\nexport default function InternalAvatar({\n color,\n tooltipText,\n initials,\n loading = false,\n ariaLabel,\n iconName,\n iconSvg,\n iconUrl,\n imgUrl,\n style,\n width = 28,\n __internalRootRef = null,\n ...rest\n}: InternalAvatarProps) {\n const handleRef = useRef<HTMLDivElement>(null);\n const [showTooltip, setShowTooltip] = useState(false);\n\n const mergedRef = useMergeRefs(handleRef, __internalRootRef);\n const computedSize = width < 28 ? 28 : width;\n\n const tooltipAttributes = {\n onFocus: () => {\n setShowTooltip(true);\n },\n onBlur: () => {\n setShowTooltip(false);\n },\n onMouseEnter: () => {\n setShowTooltip(true);\n },\n onMouseLeave: () => {\n setShowTooltip(false);\n },\n onTouchStart: () => {\n setShowTooltip(true);\n },\n onTouchEnd: () => {\n setShowTooltip(false);\n },\n };\n\n return (\n <div\n {...getDataAttributes(rest)}\n ref={mergedRef}\n tabIndex={0}\n className={clsx(styles.root, styles[`avatar-color-${color}`], { [styles.initials]: initials })}\n role=\"img\"\n aria-label={ariaLabel}\n {...tooltipAttributes}\n style={{ [customCssProps.avatarSize]: `${computedSize}px`, ...getRootStyles(style) }}\n >\n {showTooltip && tooltipText && <Tooltip className={styles.tooltip} value={tooltipText} trackRef={handleRef} />}\n\n {/* aria-hidden is added so that screen readers focus only the parent div */}\n {/* when it is not hidden, it becomes unstable in JAWS */}\n <div className={styles.content} aria-hidden=\"true\" style={getContentStyles(style)}>\n <AvatarContent\n color={color}\n ariaLabel={ariaLabel}\n initials={initials}\n loading={loading}\n iconName={iconName}\n iconSvg={iconSvg}\n iconUrl={iconUrl}\n imgUrl={imgUrl}\n style={style}\n width={computedSize}\n />\n </div>\n </div>\n );\n}\n"]}
|
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
import { AvatarProps } from "../interfaces.js";
|
|
2
2
|
interface LoadingDotsProps {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
color?: string;
|
|
4
|
+
style?: AvatarProps.Style;
|
|
5
|
+
width?: number;
|
|
6
6
|
}
|
|
7
|
-
export default function LoadingDots({
|
|
8
|
-
|
|
9
|
-
width,
|
|
10
|
-
style
|
|
11
|
-
}: LoadingDotsProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
-
export {};
|
|
7
|
+
export default function LoadingDots({ color, width, style }: LoadingDotsProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
package/avatar/style.d.ts
CHANGED
|
@@ -2,4 +2,4 @@ import { AvatarProps } from "./interfaces";
|
|
|
2
2
|
export declare function getRootStyles(style: AvatarProps.Style | undefined): {};
|
|
3
3
|
export declare function getContentStyles(style: AvatarProps.Style | undefined): {};
|
|
4
4
|
export declare function getImageStyles(style: AvatarProps.Style | undefined): {};
|
|
5
|
-
export declare function getLoadingDotsStyle(style: AvatarProps.Style | undefined): {};
|
|
5
|
+
export declare function getLoadingDotsStyle(style: AvatarProps.Style | undefined): {};
|
package/chat-bubble/index.d.ts
CHANGED
|
@@ -1,8 +1,3 @@
|
|
|
1
1
|
import { ChatBubbleProps } from "./interfaces";
|
|
2
2
|
export type { ChatBubbleProps };
|
|
3
|
-
export default function ChatBubble({
|
|
4
|
-
type,
|
|
5
|
-
hideAvatar,
|
|
6
|
-
showLoadingBar,
|
|
7
|
-
...props
|
|
8
|
-
}: ChatBubbleProps): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export default function ChatBubble({ type, hideAvatar, showLoadingBar, ...props }: ChatBubbleProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,29 +1,50 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
export interface ChatBubbleProps {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
2
|
+
/** Avatar slot paired with the chat bubble content. Use [avatar](/components/avatar/). */
|
|
3
|
+
avatar: React.ReactNode;
|
|
4
|
+
/** Defines the type of the chat bubble and sets its color accordingly. */
|
|
5
|
+
type: ChatBubbleProps.Type;
|
|
6
|
+
/** Content of the chat bubble */
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
/** Actions slot of the chat bubble, placed at the footer. Use [button group](/components/button-group/). */
|
|
9
|
+
actions?: React.ReactNode;
|
|
10
|
+
/**
|
|
11
|
+
* Adds a loading bar to the bottom of the chat bubble. This property should only be used for Generative AI loading state.
|
|
12
|
+
* If avatar is being used, set its `loading` state to true.
|
|
13
|
+
*/
|
|
14
|
+
showLoadingBar?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Adds aria-label to the chat bubble container. Use this to provide a unique accessible name for each chat bubble on the page.
|
|
17
|
+
* For example, "John Doe at 3:42:10am".
|
|
18
|
+
*/
|
|
19
|
+
ariaLabel: string;
|
|
20
|
+
/**
|
|
21
|
+
* Hides the avatar while preserving its space.
|
|
22
|
+
* Useful for when there are multiple consecutive messages coming from the same author.
|
|
23
|
+
*/
|
|
24
|
+
hideAvatar?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* @awsuiSystem core
|
|
27
|
+
*/
|
|
28
|
+
style?: ChatBubbleProps.Style;
|
|
26
29
|
}
|
|
27
30
|
export declare namespace ChatBubbleProps {
|
|
28
|
-
|
|
29
|
-
|
|
31
|
+
type Type = "incoming" | "outgoing";
|
|
32
|
+
interface Style {
|
|
33
|
+
root?: {
|
|
34
|
+
columnGap?: string;
|
|
35
|
+
};
|
|
36
|
+
bubble?: {
|
|
37
|
+
background?: string;
|
|
38
|
+
borderColor?: string;
|
|
39
|
+
borderRadius?: string;
|
|
40
|
+
borderWidth?: string;
|
|
41
|
+
boxShadow?: string;
|
|
42
|
+
color?: string;
|
|
43
|
+
fontSize?: string;
|
|
44
|
+
fontWeight?: string;
|
|
45
|
+
rowGap?: string;
|
|
46
|
+
paddingBlock?: string;
|
|
47
|
+
paddingInline?: string;
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -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\nexport namespace ChatBubbleProps {\n export type Type = \"incoming\" | \"outgoing\";\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 * @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 fontSize?: string;\n fontWeight?: string;\n rowGap?: string;\n paddingBlock?: string;\n paddingInline?: string;\n };\n }\n}\n"]}
|
|
@@ -1,14 +1,5 @@
|
|
|
1
1
|
import { InternalBaseComponentProps } from "../internal/base-component/use-base-component";
|
|
2
2
|
import { ChatBubbleProps } from "./interfaces.js";
|
|
3
|
-
export interface InternalChatBubbleProps extends ChatBubbleProps, InternalBaseComponentProps {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
children,
|
|
7
|
-
avatar,
|
|
8
|
-
actions,
|
|
9
|
-
showLoadingBar,
|
|
10
|
-
hideAvatar,
|
|
11
|
-
ariaLabel,
|
|
12
|
-
__internalRootRef,
|
|
13
|
-
...rest
|
|
14
|
-
}: InternalChatBubbleProps): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export interface InternalChatBubbleProps extends ChatBubbleProps, InternalBaseComponentProps {
|
|
4
|
+
}
|
|
5
|
+
export default function InternalChatBubble({ type, children, avatar, actions, showLoadingBar, hideAvatar, ariaLabel, style, __internalRootRef, ...rest }: InternalChatBubbleProps): import("react/jsx-runtime").JSX.Element;
|
package/chat-bubble/internal.js
CHANGED
|
@@ -5,8 +5,9 @@ import { useEffect, useRef } from "react";
|
|
|
5
5
|
import clsx from "clsx";
|
|
6
6
|
import { getDataAttributes } from "../internal/base-component/get-data-attributes";
|
|
7
7
|
import { InternalLoadingBar } from "../loading-bar/internal";
|
|
8
|
+
import { getBubbleStyle, getChatBubbleRootStyle } from "./style";
|
|
8
9
|
import styles from "./styles.css.js";
|
|
9
|
-
export default function InternalChatBubble({ type, children, avatar, actions, showLoadingBar, hideAvatar = false, ariaLabel, __internalRootRef = null, ...rest }) {
|
|
10
|
+
export default function InternalChatBubble({ type, children, avatar, actions, showLoadingBar, hideAvatar = false, ariaLabel, style, __internalRootRef = null, ...rest }) {
|
|
10
11
|
const avatarRef = useRef(null);
|
|
11
12
|
useEffect(() => {
|
|
12
13
|
// We have to do this because `inert` isn't properly supported until
|
|
@@ -18,8 +19,6 @@ export default function InternalChatBubble({ type, children, avatar, actions, sh
|
|
|
18
19
|
avatarRef.current.inert = hideAvatar;
|
|
19
20
|
}
|
|
20
21
|
}, [hideAvatar]);
|
|
21
|
-
return (_jsxs("div", { className: styles.root, ...getDataAttributes(rest), ref: __internalRootRef, role: "group", "aria-label": ariaLabel, 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}`], {
|
|
22
|
-
[styles["with-loading-bar"]]: showLoadingBar,
|
|
23
|
-
}), children: [_jsx("div", { className: styles.content, children: children }), actions && _jsx("div", { className: styles.actions, children: actions }), showLoadingBar && _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}`]), 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
23
|
}
|
|
25
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;
|
|
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"]}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { ChatBubbleProps } from "./interfaces";
|
|
2
|
+
export declare function getChatBubbleRootStyle(style: ChatBubbleProps.Style | undefined): {
|
|
3
|
+
columnGap?: undefined;
|
|
4
|
+
} | {
|
|
5
|
+
columnGap: string | undefined;
|
|
6
|
+
};
|
|
7
|
+
export declare function getBubbleStyle(style: ChatBubbleProps.Style | undefined): {
|
|
8
|
+
background?: undefined;
|
|
9
|
+
borderColor?: undefined;
|
|
10
|
+
borderRadius?: undefined;
|
|
11
|
+
borderStyle?: undefined;
|
|
12
|
+
borderWidth?: undefined;
|
|
13
|
+
boxShadow?: undefined;
|
|
14
|
+
color?: undefined;
|
|
15
|
+
fontSize?: undefined;
|
|
16
|
+
fontWeight?: undefined;
|
|
17
|
+
paddingBlock?: undefined;
|
|
18
|
+
paddingInline?: undefined;
|
|
19
|
+
rowGap?: undefined;
|
|
20
|
+
} | {
|
|
21
|
+
background: string | undefined;
|
|
22
|
+
borderColor: string | undefined;
|
|
23
|
+
borderRadius: string | undefined;
|
|
24
|
+
borderStyle: string | undefined;
|
|
25
|
+
borderWidth: string | undefined;
|
|
26
|
+
boxShadow: string | undefined;
|
|
27
|
+
color: string | undefined;
|
|
28
|
+
fontSize: string | undefined;
|
|
29
|
+
fontWeight: string | undefined;
|
|
30
|
+
paddingBlock: string | undefined;
|
|
31
|
+
paddingInline: string | undefined;
|
|
32
|
+
rowGap: string | undefined;
|
|
33
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
import { SYSTEM } from "../internal/environment";
|
|
4
|
+
export function getChatBubbleRootStyle(style) {
|
|
5
|
+
var _a;
|
|
6
|
+
if (SYSTEM !== "core") {
|
|
7
|
+
return {};
|
|
8
|
+
}
|
|
9
|
+
return {
|
|
10
|
+
columnGap: (_a = style === null || style === void 0 ? void 0 : style.root) === null || _a === void 0 ? void 0 : _a.columnGap,
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
export function getBubbleStyle(style) {
|
|
14
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
15
|
+
if (SYSTEM !== "core") {
|
|
16
|
+
return {};
|
|
17
|
+
}
|
|
18
|
+
return {
|
|
19
|
+
background: (_a = style === null || style === void 0 ? void 0 : style.bubble) === null || _a === void 0 ? void 0 : _a.background,
|
|
20
|
+
borderColor: (_b = style === null || style === void 0 ? void 0 : style.bubble) === null || _b === void 0 ? void 0 : _b.borderColor,
|
|
21
|
+
borderRadius: (_c = style === null || style === void 0 ? void 0 : style.bubble) === null || _c === void 0 ? void 0 : _c.borderRadius,
|
|
22
|
+
borderStyle: ((_d = style === null || style === void 0 ? void 0 : style.bubble) === null || _d === void 0 ? void 0 : _d.borderWidth) ? "solid" : undefined,
|
|
23
|
+
borderWidth: (_e = style === null || style === void 0 ? void 0 : style.bubble) === null || _e === void 0 ? void 0 : _e.borderWidth,
|
|
24
|
+
boxShadow: (_f = style === null || style === void 0 ? void 0 : style.bubble) === null || _f === void 0 ? void 0 : _f.boxShadow,
|
|
25
|
+
color: (_g = style === null || style === void 0 ? void 0 : style.bubble) === null || _g === void 0 ? void 0 : _g.color,
|
|
26
|
+
fontSize: (_h = style === null || style === void 0 ? void 0 : style.bubble) === null || _h === void 0 ? void 0 : _h.fontSize,
|
|
27
|
+
fontWeight: (_j = style === null || style === void 0 ? void 0 : style.bubble) === null || _j === void 0 ? void 0 : _j.fontWeight,
|
|
28
|
+
paddingBlock: (_k = style === null || style === void 0 ? void 0 : style.bubble) === null || _k === void 0 ? void 0 : _k.paddingBlock,
|
|
29
|
+
paddingInline: (_l = style === null || style === void 0 ? void 0 : style.bubble) === null || _l === void 0 ? void 0 : _l.paddingInline,
|
|
30
|
+
rowGap: (_m = style === null || style === void 0 ? void 0 : style.bubble) === null || _m === void 0 ? void 0 : _m.rowGap,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=style.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"style.js","sourceRoot":"","sources":["../../../src/chat-bubble/style.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAGjD,MAAM,UAAU,sBAAsB,CAAC,KAAwC;;IAC7E,IAAI,MAAM,KAAK,MAAM,EAAE;QACrB,OAAO,EAAE,CAAC;KACX;IAED,OAAO;QACL,SAAS,EAAE,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,IAAI,0CAAE,SAAS;KAClC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,cAAc,CAA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internal/environment\";\nimport { ChatBubbleProps } from \"./interfaces\";\n\nexport function getChatBubbleRootStyle(style: ChatBubbleProps.Style | undefined) {\n if (SYSTEM !== \"core\") {\n return {};\n }\n\n return {\n columnGap: style?.root?.columnGap,\n };\n}\n\nexport function getBubbleStyle(style: ChatBubbleProps.Style | undefined) {\n if (SYSTEM !== \"core\") {\n return {};\n }\n\n return {\n background: style?.bubble?.background,\n borderColor: style?.bubble?.borderColor,\n borderRadius: style?.bubble?.borderRadius,\n borderStyle: style?.bubble?.borderWidth ? \"solid\" : undefined,\n borderWidth: style?.bubble?.borderWidth,\n boxShadow: style?.bubble?.boxShadow,\n color: style?.bubble?.color,\n fontSize: style?.bubble?.fontSize,\n fontWeight: style?.bubble?.fontWeight,\n paddingBlock: style?.bubble?.paddingBlock,\n paddingInline: style?.bubble?.paddingInline,\n rowGap: style?.bubble?.rowGap,\n };\n}\n"]}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
|
|
2
2
|
import './styles.scoped.css';
|
|
3
3
|
export default {
|
|
4
|
-
"root": "
|
|
5
|
-
"message-area": "awsui_message-
|
|
6
|
-
"
|
|
7
|
-
"chat-bubble-type-
|
|
8
|
-
"
|
|
9
|
-
"avatar": "
|
|
10
|
-
"hide": "
|
|
11
|
-
"content": "
|
|
12
|
-
"actions": "
|
|
4
|
+
"root": "awsui_root_cdujn_dsdl4_11",
|
|
5
|
+
"message-area": "awsui_message-area_cdujn_dsdl4_45",
|
|
6
|
+
"chat-bubble-type-outgoing": "awsui_chat-bubble-type-outgoing_cdujn_dsdl4_58",
|
|
7
|
+
"chat-bubble-type-incoming": "awsui_chat-bubble-type-incoming_cdujn_dsdl4_62",
|
|
8
|
+
"loading-bar-wrapper": "awsui_loading-bar-wrapper_cdujn_dsdl4_67",
|
|
9
|
+
"avatar": "awsui_avatar_cdujn_dsdl4_74",
|
|
10
|
+
"hide": "awsui_hide_cdujn_dsdl4_77",
|
|
11
|
+
"content": "awsui_content_cdujn_dsdl4_81",
|
|
12
|
+
"actions": "awsui_actions_cdujn_dsdl4_85"
|
|
13
13
|
};
|
|
14
14
|
|
|
@@ -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
|
-
.
|
|
11
|
+
.awsui_root_cdujn_dsdl4_11:not(#\9) {
|
|
12
12
|
border-collapse: separate;
|
|
13
13
|
border-spacing: 0;
|
|
14
14
|
box-sizing: border-box;
|
|
@@ -42,7 +42,8 @@
|
|
|
42
42
|
line-height: var(--line-height-heading-m-uoaqdh, 22px);
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
.awsui_message-
|
|
45
|
+
.awsui_message-area_cdujn_dsdl4_45:not(#\9) {
|
|
46
|
+
position: relative;
|
|
46
47
|
display: flex;
|
|
47
48
|
flex-direction: column;
|
|
48
49
|
gap: var(--space-scaled-s-8ozaad, 12px);
|
|
@@ -54,29 +55,33 @@
|
|
|
54
55
|
border-end-start-radius: var(--border-radius-chat-bubble-haafsg, 8px);
|
|
55
56
|
border-end-end-radius: var(--border-radius-chat-bubble-haafsg, 8px);
|
|
56
57
|
}
|
|
57
|
-
.awsui_message-
|
|
58
|
-
padding-block-end: 0;
|
|
59
|
-
}
|
|
60
|
-
.awsui_message-area_cdujn_4xote_45.awsui_chat-bubble-type-outgoing_cdujn_4xote_60:not(#\9) {
|
|
58
|
+
.awsui_message-area_cdujn_dsdl4_45.awsui_chat-bubble-type-outgoing_cdujn_dsdl4_58:not(#\9) {
|
|
61
59
|
color: var(--color-text-chat-bubble-outgoing-f3r63s, #0f141a);
|
|
62
60
|
background-color: var(--color-background-chat-bubble-outgoing-ay6nj3, transparent);
|
|
63
61
|
}
|
|
64
|
-
.awsui_message-
|
|
62
|
+
.awsui_message-area_cdujn_dsdl4_45.awsui_chat-bubble-type-incoming_cdujn_dsdl4_62:not(#\9) {
|
|
65
63
|
color: var(--color-text-chat-bubble-incoming-od0yh8, #0f141a);
|
|
66
64
|
background-color: var(--color-background-chat-bubble-incoming-j38cew, #f6f6f9);
|
|
67
65
|
}
|
|
68
66
|
|
|
69
|
-
.
|
|
67
|
+
.awsui_loading-bar-wrapper_cdujn_dsdl4_67:not(#\9) {
|
|
68
|
+
position: absolute;
|
|
69
|
+
inset-block-end: 0;
|
|
70
|
+
inset-inline-start: 0;
|
|
71
|
+
inline-size: 100%;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.awsui_avatar_cdujn_dsdl4_74:not(#\9) {
|
|
70
75
|
padding-block: var(--space-scaled-xs-xwoogq, 8px);
|
|
71
76
|
}
|
|
72
|
-
.
|
|
77
|
+
.awsui_avatar_cdujn_dsdl4_74.awsui_hide_cdujn_dsdl4_77:not(#\9) {
|
|
73
78
|
opacity: 0;
|
|
74
79
|
}
|
|
75
80
|
|
|
76
|
-
.
|
|
81
|
+
.awsui_content_cdujn_dsdl4_81:not(#\9) {
|
|
77
82
|
/* Used in test utils */
|
|
78
83
|
}
|
|
79
84
|
|
|
80
|
-
.
|
|
85
|
+
.awsui_actions_cdujn_dsdl4_85:not(#\9) {
|
|
81
86
|
/* Used in test utils */
|
|
82
87
|
}
|