@cloudscape-design/chat-components 1.0.58 → 1.0.60
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 +5 -1
- package/avatar/index.js +16 -10
- package/avatar/interfaces.d.ts +88 -58
- package/avatar/interfaces.js.map +1 -1
- package/avatar/internal-do-not-use-core.js +12 -0
- package/avatar/internal.d.ts +16 -3
- package/avatar/internal.js +7 -6
- package/avatar/internal.js.map +1 -1
- package/avatar/loading-dots/index.d.ts +10 -4
- package/avatar/loading-dots/index.js +3 -2
- package/avatar/loading-dots/index.js.map +1 -1
- package/avatar/style.d.ts +5 -0
- package/avatar/style.js +55 -0
- package/avatar/style.js.map +1 -0
- package/avatar/styles.css.js +6 -6
- package/avatar/styles.scoped.css +27 -24
- package/avatar/styles.selectors.js +6 -6
- package/chat-bubble/index.d.ts +6 -1
- package/chat-bubble/interfaces.d.ts +25 -25
- package/chat-bubble/internal.d.ts +12 -3
- package/index.d.ts +1 -1
- package/internal/api-docs/components/avatar.js +82 -0
- package/internal/api-docs/components/index.d.ts +1 -1
- package/internal/api-docs/components/interfaces.d.ts +56 -56
- 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.d.ts +1 -0
- package/internal/environment.js +3 -3
- package/internal/environment.json +3 -3
- package/internal/events/index.d.ts +17 -14
- package/internal/generated/custom-css-properties/index.d.ts +6 -2
- package/internal/generated/custom-css-properties/index.js +5 -1
- package/internal/generated/custom-css-properties/index.js.map +1 -1
- package/internal/generated/theming/index.cjs.d.ts +12 -13
- package/internal/generated/theming/index.d.ts +12 -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 -3
- package/loading-bar/index.d.ts +1 -1
- package/loading-bar/interfaces.d.ts +8 -8
- package/loading-bar/internal.d.ts +5 -1
- package/package.json +1 -1
- package/support-prompt-group/focus-helpers.d.ts +2 -2
- package/support-prompt-group/index.d.ts +1 -1
- package/support-prompt-group/interfaces.d.ts +35 -35
- package/support-prompt-group/internal.d.ts +1 -1
- package/support-prompt-group/prompt.d.ts +4 -4
- 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/{index.js.map → internal-do-not-use-core.js.map} +0 -0
package/avatar/index.d.ts
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
import { AvatarProps } from "./interfaces";
|
|
2
2
|
export type { AvatarProps };
|
|
3
|
-
export default function Avatar({
|
|
3
|
+
export default function Avatar({
|
|
4
|
+
color,
|
|
5
|
+
iconName,
|
|
6
|
+
...props
|
|
7
|
+
}: AvatarProps): import("react/jsx-runtime").JSX.Element;
|
package/avatar/index.js
CHANGED
|
@@ -1,12 +1,18 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
3
|
+
import React from 'react';
|
|
4
|
+
|
|
5
|
+
import CoreComponent from './internal-do-not-use-core';
|
|
6
|
+
import { applyDisplayName } from '../internal/utils/apply-display-name';
|
|
7
|
+
import { validateProps } from '@cloudscape-design/component-toolkit/internal';
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
const Avatar = (props) => {
|
|
12
|
+
validateProps('Avatar', props, ["style"], {}, 'console');
|
|
13
|
+
return React.createElement(CoreComponent, props);
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
applyDisplayName(Avatar, 'Avatar');
|
|
18
|
+
export default Avatar;
|
package/avatar/interfaces.d.ts
CHANGED
|
@@ -1,63 +1,93 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { IconProps } from "@cloudscape-design/components/icon";
|
|
3
3
|
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
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Determines the color of the avatar.
|
|
6
|
+
* Use `gen-ai` for AI assistants and `default` otherwise.
|
|
7
|
+
*/
|
|
8
|
+
color?: AvatarProps.Color;
|
|
9
|
+
/**
|
|
10
|
+
* The text content shown in the avatar's tooltip.
|
|
11
|
+
*
|
|
12
|
+
* When you use this property, make sure to include it in the `ariaLabel`.
|
|
13
|
+
*/
|
|
14
|
+
tooltipText?: string;
|
|
15
|
+
/**
|
|
16
|
+
* The text content shown directly in the avatar's body.
|
|
17
|
+
* Can be 1 or 2 symbols long, every subsequent symbol is ignored.
|
|
18
|
+
* Use it to define initials that uniquely identify the avatar's owner.
|
|
19
|
+
*/
|
|
20
|
+
initials?: string;
|
|
21
|
+
/**
|
|
22
|
+
* When set to true, a loading indicator is shown in avatar.
|
|
23
|
+
*/
|
|
24
|
+
loading?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Text to describe the avatar for assistive technology.
|
|
27
|
+
* When more than one avatar is used, provide a unique label for each.
|
|
28
|
+
* For example, "Avatar of John Doe" or "Avatar of generative AI assistant".
|
|
29
|
+
*
|
|
30
|
+
* If `tooltipText` is used make sure to include it in the `ariaLabel`.
|
|
31
|
+
*/
|
|
32
|
+
ariaLabel: string;
|
|
33
|
+
/**
|
|
34
|
+
* Specifies the icon to be displayed as Avatar.
|
|
35
|
+
* Use `gen-ai` icon for AI assistants. By default `user-profile` icon is used.
|
|
36
|
+
*
|
|
37
|
+
* If you set both `iconName` and `initials`, `initials` will take precedence.
|
|
38
|
+
*/
|
|
39
|
+
iconName?: IconProps.Name;
|
|
40
|
+
/**
|
|
41
|
+
* 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.
|
|
42
|
+
* @deprecated Use `iconSvg` or `imgUrl` instead.
|
|
43
|
+
*/
|
|
44
|
+
iconUrl?: string;
|
|
45
|
+
/**
|
|
46
|
+
* Specifies the SVG of a custom icon.
|
|
47
|
+
* Use this property if the icon you want isn't available.
|
|
48
|
+
*/
|
|
49
|
+
iconSvg?: React.ReactNode;
|
|
50
|
+
/**
|
|
51
|
+
* Specifies the URL of a custom image. If you set both `iconUrl` and `imgUrl`, `imgUrl` will take precedence.
|
|
52
|
+
*/
|
|
53
|
+
imgUrl?: string;
|
|
54
|
+
/**
|
|
55
|
+
* Specifies an object of selectors and properties that are used to apply custom styles.
|
|
56
|
+
*
|
|
57
|
+
* - `root.background` (string) - (Optional) Background of the avatar.
|
|
58
|
+
* - `root.borderColor` (string) - (Optional) Border color of the avatar.
|
|
59
|
+
* - `root.borderRadius` (string) - (Optional) Border radius of the avatar.
|
|
60
|
+
* - `root.borderWidth` (string) - (Optional) Border width of the avatar.
|
|
61
|
+
* - `root.boxShadow` (string) - (Optional) Box shadow of the avatar.
|
|
62
|
+
* - `root.color` (string) - (Optional) Text color of the avatar.
|
|
63
|
+
* - `root.focusRing.borderColor` (string) - (Optional) Focus ring border color.
|
|
64
|
+
* - `root.focusRing.borderRadius` (string) - (Optional) Focus ring border radius.
|
|
65
|
+
* - `root.focusRing.borderWidth` (string) - (Optional) Focus ring border width.
|
|
66
|
+
* @awsuiSystem core
|
|
67
|
+
*/
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Defines the width and height of the avatar.
|
|
71
|
+
* This value corresponds to the `width` CSS-property and will center and crop images using `object-fit: cover`.
|
|
72
|
+
* The default and minimum width value is 28px.
|
|
73
|
+
*/
|
|
74
|
+
width?: number;
|
|
60
75
|
}
|
|
61
76
|
export declare namespace AvatarProps {
|
|
62
|
-
|
|
63
|
-
|
|
77
|
+
type Color = "default" | "gen-ai";
|
|
78
|
+
interface Style {
|
|
79
|
+
root?: {
|
|
80
|
+
background?: string;
|
|
81
|
+
borderColor?: string;
|
|
82
|
+
borderRadius?: string;
|
|
83
|
+
borderWidth?: string;
|
|
84
|
+
boxShadow?: string;
|
|
85
|
+
color?: string;
|
|
86
|
+
focusRing?: {
|
|
87
|
+
borderColor?: string;
|
|
88
|
+
borderRadius?: string;
|
|
89
|
+
borderWidth?: string;
|
|
90
|
+
};
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
}
|
package/avatar/interfaces.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/avatar/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { IconProps } from \"@cloudscape-design/components/icon\";\n\nexport interface AvatarProps {\n /**\n * Determines the color of the avatar.\n * Use `gen-ai` for AI assistants and `default` otherwise.\n */\n color?: AvatarProps.Color;\n\n /**\n * The text content shown in the avatar's tooltip.\n *\n * When you use this property, make sure to include it in the `ariaLabel`.\n */\n tooltipText?: string;\n\n /**\n * The text content shown directly in the avatar's body.\n * Can be 1 or 2 symbols long, every subsequent symbol is ignored.\n * Use it to define initials that uniquely identify the avatar's owner.\n */\n initials?: string;\n\n /**\n * When set to true, a loading indicator is shown in avatar.\n */\n loading?: boolean;\n\n /**\n * Text to describe the avatar for assistive technology.\n * When more than one avatar is used, provide a unique label for each.\n * For example, \"Avatar of John Doe\" or \"Avatar of generative AI assistant\".\n *\n * If `tooltipText` is used make sure to include it in the `ariaLabel`.\n */\n ariaLabel: string;\n\n /**\n * Specifies the icon to be displayed as Avatar.\n * Use `gen-ai` icon for AI assistants. By default `user-profile` icon is used.\n *\n * If you set both `iconName` and `initials`, `initials` will take precedence.\n */\n iconName?: IconProps.Name;\n\n /**\n * 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.\n * @deprecated Use `iconSvg` or `imgUrl` instead.\n */\n iconUrl?: string;\n\n /**\n * Specifies the SVG of a custom icon.\n * Use this property if the icon you want isn't available.\n */\n iconSvg?: React.ReactNode;\n\n /**\n * Specifies the URL of a custom image. If you set both `iconUrl` and `imgUrl`, `imgUrl` will take precedence.\n */\n imgUrl?: string;\n\n /**\n * Defines the width and height of the avatar.\n * This value corresponds to the `width` CSS-property and will center and crop images using `object-fit: cover`.\n * The default and minimum width value is 28px.\n */\n width?: number;\n}\n\nexport namespace AvatarProps {\n export type Color = \"default\" | \"gen-ai\";\n}\n"]}
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/avatar/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { IconProps } from \"@cloudscape-design/components/icon\";\n\nexport interface AvatarProps {\n /**\n * Determines the color of the avatar.\n * Use `gen-ai` for AI assistants and `default` otherwise.\n */\n color?: AvatarProps.Color;\n\n /**\n * The text content shown in the avatar's tooltip.\n *\n * When you use this property, make sure to include it in the `ariaLabel`.\n */\n tooltipText?: string;\n\n /**\n * The text content shown directly in the avatar's body.\n * Can be 1 or 2 symbols long, every subsequent symbol is ignored.\n * Use it to define initials that uniquely identify the avatar's owner.\n */\n initials?: string;\n\n /**\n * When set to true, a loading indicator is shown in avatar.\n */\n loading?: boolean;\n\n /**\n * Text to describe the avatar for assistive technology.\n * When more than one avatar is used, provide a unique label for each.\n * For example, \"Avatar of John Doe\" or \"Avatar of generative AI assistant\".\n *\n * If `tooltipText` is used make sure to include it in the `ariaLabel`.\n */\n ariaLabel: string;\n\n /**\n * Specifies the icon to be displayed as Avatar.\n * Use `gen-ai` icon for AI assistants. By default `user-profile` icon is used.\n *\n * If you set both `iconName` and `initials`, `initials` will take precedence.\n */\n iconName?: IconProps.Name;\n\n /**\n * 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.\n * @deprecated Use `iconSvg` or `imgUrl` instead.\n */\n iconUrl?: string;\n\n /**\n * Specifies the SVG of a custom icon.\n * Use this property if the icon you want isn't available.\n */\n iconSvg?: React.ReactNode;\n\n /**\n * Specifies the URL of a custom image. If you set both `iconUrl` and `imgUrl`, `imgUrl` will take precedence.\n */\n imgUrl?: string;\n\n /**\n * Specifies an object of selectors and properties that are used to apply custom styles.\n *\n * - `root.background` (string) - (Optional) Background of the avatar.\n * - `root.borderColor` (string) - (Optional) Border color of the avatar.\n * - `root.borderRadius` (string) - (Optional) Border radius of the avatar.\n * - `root.borderWidth` (string) - (Optional) Border width of the avatar.\n * - `root.boxShadow` (string) - (Optional) Box shadow of the avatar.\n * - `root.color` (string) - (Optional) Text color of the avatar.\n * - `root.focusRing.borderColor` (string) - (Optional) Focus ring border color.\n * - `root.focusRing.borderRadius` (string) - (Optional) Focus ring border radius.\n * - `root.focusRing.borderWidth` (string) - (Optional) Focus ring border width.\n * @awsuiSystem core\n */\n style?: AvatarProps.Style;\n\n /**\n * Defines the width and height of the avatar.\n * This value corresponds to the `width` CSS-property and will center and crop images using `object-fit: cover`.\n * The default and minimum width value is 28px.\n */\n width?: number;\n}\n\nexport namespace AvatarProps {\n export type Color = \"default\" | \"gen-ai\";\n\n export interface Style {\n root?: {\n background?: string;\n borderColor?: string;\n borderRadius?: string;\n borderWidth?: string;\n boxShadow?: string;\n color?: string;\n focusRing?: {\n borderColor?: string;\n borderRadius?: string;\n borderWidth?: string;\n };\n };\n }\n}\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
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=internal-do-not-use-core.js.map
|
package/avatar/internal.d.ts
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
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
|
-
|
|
3
|
+
export interface InternalAvatarProps extends AvatarProps, InternalBaseComponentProps {}
|
|
4
|
+
export default function InternalAvatar({
|
|
5
|
+
color,
|
|
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;
|
package/avatar/internal.js
CHANGED
|
@@ -9,13 +9,14 @@ import Tooltip from "@cloudscape-design/components/internal/tooltip-do-not-use";
|
|
|
9
9
|
import { getDataAttributes } from "../internal/base-component/get-data-attributes";
|
|
10
10
|
import customCssProps from "../internal/generated/custom-css-properties";
|
|
11
11
|
import LoadingDots from "./loading-dots";
|
|
12
|
+
import { getContentStyles, getImageStyles, getRootStyles } from "./style";
|
|
12
13
|
import styles from "./styles.css.js";
|
|
13
|
-
const AvatarContent = ({ color, loading, initials, iconName, iconSvg, iconUrl, ariaLabel, width, imgUrl, }) => {
|
|
14
|
+
const AvatarContent = ({ color, loading, initials, iconName, iconSvg, iconUrl, ariaLabel, width, imgUrl, style, }) => {
|
|
14
15
|
if (loading) {
|
|
15
|
-
return _jsx(LoadingDots, { color: color, width: width });
|
|
16
|
+
return _jsx(LoadingDots, { color: color, width: width, style: style });
|
|
16
17
|
}
|
|
17
18
|
if (imgUrl) {
|
|
18
|
-
return _jsx("img", { className: styles.image, src: imgUrl });
|
|
19
|
+
return _jsx("img", { className: styles.image, src: imgUrl, style: getImageStyles(style) });
|
|
19
20
|
}
|
|
20
21
|
if (initials) {
|
|
21
22
|
const letters = initials.length > 2 ? initials.slice(0, 2) : initials;
|
|
@@ -26,7 +27,7 @@ const AvatarContent = ({ color, loading, initials, iconName, iconSvg, iconUrl, a
|
|
|
26
27
|
}
|
|
27
28
|
return _jsx(Icon, { name: iconName, svg: iconSvg, url: iconUrl, alt: ariaLabel, size: "inherit" });
|
|
28
29
|
};
|
|
29
|
-
export default function InternalAvatar({ color, tooltipText, initials, loading = false, ariaLabel, iconName, iconSvg, iconUrl, imgUrl, width = 28, __internalRootRef = null, ...rest }) {
|
|
30
|
+
export default function InternalAvatar({ color, tooltipText, initials, loading = false, ariaLabel, iconName, iconSvg, iconUrl, imgUrl, style, width = 28, __internalRootRef = null, ...rest }) {
|
|
30
31
|
const handleRef = useRef(null);
|
|
31
32
|
const [showTooltip, setShowTooltip] = useState(false);
|
|
32
33
|
const mergedRef = useMergeRefs(handleRef, __internalRootRef);
|
|
@@ -51,8 +52,8 @@ export default function InternalAvatar({ color, tooltipText, initials, loading =
|
|
|
51
52
|
setShowTooltip(false);
|
|
52
53
|
},
|
|
53
54
|
};
|
|
54
|
-
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
|
|
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, { value: tooltipText, trackRef: handleRef,
|
|
55
56
|
// This is added to ensure tooltip is closed when clicked for consistency with other tooltip usages
|
|
56
|
-
contentAttributes: { onPointerDown: () => setShowTooltip(false) } })), _jsx("div", { className: styles.content, "aria-hidden": "true", children: _jsx(AvatarContent, { color: color, ariaLabel: ariaLabel, initials: initials, loading: loading, iconName: iconName, iconSvg: iconSvg, iconUrl: iconUrl, imgUrl: imgUrl, width: computedSize }) })] }));
|
|
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 }) })] }));
|
|
57
58
|
}
|
|
58
59
|
//# 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;
|
|
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,CAA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AAI,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,CAC7B,KAAC,OAAO,IACN,KAAK,EAAE,WAAW,EAClB,QAAQ,EAAE,SAAS;gBACnB,mGAAmG;gBACnG,iBAAiB,EAAE,EAAE,aAAa,EAAE,GAAG,EAAE,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,GACjE,CACH,EAID,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 && (\n <Tooltip\n value={tooltipText}\n trackRef={handleRef}\n // This is added to ensure tooltip is closed when clicked for consistency with other tooltip usages\n contentAttributes={{ onPointerDown: () => setShowTooltip(false) }}\n />\n )}\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,6 +1,12 @@
|
|
|
1
|
+
import { AvatarProps } from "../interfaces.js";
|
|
1
2
|
interface LoadingDotsProps {
|
|
2
|
-
|
|
3
|
-
|
|
3
|
+
color?: string;
|
|
4
|
+
style?: AvatarProps.Style;
|
|
5
|
+
width?: number;
|
|
4
6
|
}
|
|
5
|
-
export default function LoadingDots({
|
|
6
|
-
|
|
7
|
+
export default function LoadingDots({
|
|
8
|
+
color,
|
|
9
|
+
width,
|
|
10
|
+
style
|
|
11
|
+
}: LoadingDotsProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -2,11 +2,12 @@ import { jsx as _jsx, jsxs as _jsxs } 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 clsx from "clsx";
|
|
5
|
+
import { getLoadingDotsStyle } from "../style";
|
|
5
6
|
import styles from "./styles.css.js";
|
|
6
|
-
export default function LoadingDots({ color, width }) {
|
|
7
|
+
export default function LoadingDots({ color, width, style }) {
|
|
7
8
|
const dotSize = `calc(.14px * ${width})`;
|
|
8
9
|
return (
|
|
9
10
|
// "gen-ai" class is added so that the gradient background animates.
|
|
10
|
-
_jsx("div", { className: clsx(styles.root, { [styles["gen-ai"]]: color === "gen-ai" }), children: _jsxs("div", { className: styles.typing, children: [_jsx("div", { className: styles.dot, style: { blockSize: dotSize, inlineSize: dotSize } }), _jsx("div", { className: styles.dot, style: { blockSize: dotSize, inlineSize: dotSize } }), _jsx("div", { className: styles.dot, style: { blockSize: dotSize, inlineSize: dotSize } })] }) }));
|
|
11
|
+
_jsx("div", { className: clsx(styles.root, { [styles["gen-ai"]]: color === "gen-ai" }), style: getLoadingDotsStyle(style), children: _jsxs("div", { className: styles.typing, children: [_jsx("div", { className: styles.dot, style: { blockSize: dotSize, inlineSize: dotSize } }), _jsx("div", { className: styles.dot, style: { blockSize: dotSize, inlineSize: dotSize } }), _jsx("div", { className: styles.dot, style: { blockSize: dotSize, inlineSize: dotSize } })] }) }));
|
|
11
12
|
}
|
|
12
13
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/avatar/loading-dots/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/avatar/loading-dots/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AAGxB,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAE/C,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAQrC,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAoB;IAC3E,MAAM,OAAO,GAAG,gBAAgB,KAAK,GAAG,CAAC;IAEzC,OAAO;IACL,oEAAoE;IACpE,cAAK,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,EAAE,KAAK,KAAK,QAAQ,EAAE,CAAC,EAAE,KAAK,EAAE,mBAAmB,CAAC,KAAK,CAAC,YAC9G,eAAK,SAAS,EAAE,MAAM,CAAC,MAAM,aAC3B,cAAK,SAAS,EAAE,MAAM,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,GAAQ,EACtF,cAAK,SAAS,EAAE,MAAM,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,GAAQ,EACtF,cAAK,SAAS,EAAE,MAAM,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,GAAQ,IAClF,GACF,CACP,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport clsx from \"clsx\";\n\nimport { AvatarProps } from \"../interfaces.js\";\nimport { getLoadingDotsStyle } from \"../style\";\n\nimport styles from \"./styles.css.js\";\n\ninterface LoadingDotsProps {\n color?: string;\n style?: AvatarProps.Style;\n width?: number;\n}\n\nexport default function LoadingDots({ color, width, style }: LoadingDotsProps) {\n const dotSize = `calc(.14px * ${width})`;\n\n return (\n // \"gen-ai\" class is added so that the gradient background animates.\n <div className={clsx(styles.root, { [styles[\"gen-ai\"]]: color === \"gen-ai\" })} style={getLoadingDotsStyle(style)}>\n <div className={styles.typing}>\n <div className={styles.dot} style={{ blockSize: dotSize, inlineSize: dotSize }}></div>\n <div className={styles.dot} style={{ blockSize: dotSize, inlineSize: dotSize }}></div>\n <div className={styles.dot} style={{ blockSize: dotSize, inlineSize: dotSize }}></div>\n </div>\n </div>\n );\n}\n"]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { AvatarProps } from "./interfaces";
|
|
2
|
+
export declare function getRootStyles(style: AvatarProps.Style | undefined): {};
|
|
3
|
+
export declare function getContentStyles(style: AvatarProps.Style | undefined): {};
|
|
4
|
+
export declare function getImageStyles(style: AvatarProps.Style | undefined): {};
|
|
5
|
+
export declare function getLoadingDotsStyle(style: AvatarProps.Style | undefined): {};
|
package/avatar/style.js
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
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
|
+
import customCssProps from "../internal/generated/custom-css-properties";
|
|
5
|
+
export function getRootStyles(style) {
|
|
6
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
7
|
+
let properties = {};
|
|
8
|
+
if (SYSTEM === "core" && (style === null || style === void 0 ? void 0 : style.root)) {
|
|
9
|
+
properties = {
|
|
10
|
+
background: (_a = style.root) === null || _a === void 0 ? void 0 : _a.background,
|
|
11
|
+
borderRadius: (_b = style.root) === null || _b === void 0 ? void 0 : _b.borderRadius,
|
|
12
|
+
boxShadow: (_c = style.root) === null || _c === void 0 ? void 0 : _c.boxShadow,
|
|
13
|
+
color: (_d = style.root) === null || _d === void 0 ? void 0 : _d.color,
|
|
14
|
+
[customCssProps.avatarRootBorderWidth]: (_e = style.root) === null || _e === void 0 ? void 0 : _e.borderWidth,
|
|
15
|
+
[customCssProps.avatarFocusRingBorderColor]: (_g = (_f = style.root) === null || _f === void 0 ? void 0 : _f.focusRing) === null || _g === void 0 ? void 0 : _g.borderColor,
|
|
16
|
+
[customCssProps.avatarFocusRingBorderRadius]: (_j = (_h = style.root) === null || _h === void 0 ? void 0 : _h.focusRing) === null || _j === void 0 ? void 0 : _j.borderRadius,
|
|
17
|
+
[customCssProps.avatarFocusRingBorderWidth]: (_l = (_k = style.root) === null || _k === void 0 ? void 0 : _k.focusRing) === null || _l === void 0 ? void 0 : _l.borderWidth,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
return properties;
|
|
21
|
+
}
|
|
22
|
+
export function getContentStyles(style) {
|
|
23
|
+
var _a, _b, _c, _d;
|
|
24
|
+
let properties = {};
|
|
25
|
+
if (SYSTEM === "core" && (style === null || style === void 0 ? void 0 : style.root)) {
|
|
26
|
+
properties = {
|
|
27
|
+
borderColor: (_a = style.root) === null || _a === void 0 ? void 0 : _a.borderColor,
|
|
28
|
+
borderRadius: (_b = style.root) === null || _b === void 0 ? void 0 : _b.borderRadius,
|
|
29
|
+
borderStyle: ((_c = style.root) === null || _c === void 0 ? void 0 : _c.borderWidth) && "solid",
|
|
30
|
+
borderWidth: (_d = style.root) === null || _d === void 0 ? void 0 : _d.borderWidth,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
return properties;
|
|
34
|
+
}
|
|
35
|
+
export function getImageStyles(style) {
|
|
36
|
+
var _a;
|
|
37
|
+
let properties = {};
|
|
38
|
+
if (SYSTEM === "core" && (style === null || style === void 0 ? void 0 : style.root)) {
|
|
39
|
+
properties = {
|
|
40
|
+
borderRadius: (_a = style.root) === null || _a === void 0 ? void 0 : _a.borderRadius,
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
return properties;
|
|
44
|
+
}
|
|
45
|
+
export function getLoadingDotsStyle(style) {
|
|
46
|
+
var _a;
|
|
47
|
+
let properties = {};
|
|
48
|
+
if (SYSTEM === "core" && (style === null || style === void 0 ? void 0 : style.root)) {
|
|
49
|
+
properties = {
|
|
50
|
+
borderRadius: (_a = style.root) === null || _a === void 0 ? void 0 : _a.borderRadius,
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
return properties;
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=style.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"style.js","sourceRoot":"","sources":["../../../src/avatar/style.tsx"],"names":[],"mapp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,KAAK,CAAC,IAAI,0CAAE,YAAY;YACtC,WAAW,EAAE,CAAA,MAAA,KAAK,CAAC,IAAI,0CAAE,WAAW,KAAI,OAAO;YAC/C,WAAW,EAAE,MAAA,KAAK,CAAC,IAAI,0CAAE,WAAW;SACrC,CAAC;KACH;IAED,OAAO,UAAU,CAAC;AACpB,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,KAAoC;;IACjE,IAAI,UAAU,GAAG,EAAE,CAAC;IAEpB,IAAI,MAAM,KAAK,MAAM,KAAI,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,IAAI,CAAA,EAAE;QACpC,UAAU,GAAG;YACX,YAAY,EAAE,MAAA,KAAK,CAAC,IAAI,0CAAE,YAAY;SACvC,CAAC;KACH;IAED,OAAO,UAAU,CAAC;AACpB,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,KAAoC;;IACtE,IAAI,UAAU,GAAG,EAAE,CAAC;IAEpB,IAAI,MAAM,KAAK,MAAM,KAAI,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,IAAI,CAAA,EAAE;QACpC,UAAU,GAAG;YACX,YAAY,EAAE,MAAA,KAAK,CAAC,IAAI,0CAAE,YAAY;SACvC,CAAC;KACH;IAED,OAAO,UAAU,CAAC;AACpB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { SYSTEM } from \"../internal/environment\";\nimport customCssProps from \"../internal/generated/custom-css-properties\";\nimport { AvatarProps } from \"./interfaces\";\n\nexport function getRootStyles(style: AvatarProps.Style | undefined) {\n let properties = {};\n\n if (SYSTEM === \"core\" && style?.root) {\n properties = {\n background: style.root?.background,\n borderRadius: style.root?.borderRadius,\n boxShadow: style.root?.boxShadow,\n color: style.root?.color,\n [customCssProps.avatarRootBorderWidth]: style.root?.borderWidth,\n [customCssProps.avatarFocusRingBorderColor]: style.root?.focusRing?.borderColor,\n [customCssProps.avatarFocusRingBorderRadius]: style.root?.focusRing?.borderRadius,\n [customCssProps.avatarFocusRingBorderWidth]: style.root?.focusRing?.borderWidth,\n };\n }\n\n return properties;\n}\n\nexport function getContentStyles(style: AvatarProps.Style | undefined) {\n let properties = {};\n\n if (SYSTEM === \"core\" && style?.root) {\n properties = {\n borderColor: style.root?.borderColor,\n borderRadius: style.root?.borderRadius,\n borderStyle: style.root?.borderWidth && \"solid\",\n borderWidth: style.root?.borderWidth,\n };\n }\n\n return properties;\n}\n\nexport function getImageStyles(style: AvatarProps.Style | undefined) {\n let properties = {};\n\n if (SYSTEM === \"core\" && style?.root) {\n properties = {\n borderRadius: style.root?.borderRadius,\n };\n }\n\n return properties;\n}\n\nexport function getLoadingDotsStyle(style: AvatarProps.Style | undefined) {\n let properties = {};\n\n if (SYSTEM === \"core\" && style?.root) {\n properties = {\n borderRadius: style.root?.borderRadius,\n };\n }\n\n return properties;\n}\n"]}
|
package/avatar/styles.css.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
|
|
2
2
|
import './styles.scoped.css';
|
|
3
3
|
export default {
|
|
4
|
-
"root": "
|
|
5
|
-
"avatar-color-default": "awsui_avatar-color-
|
|
6
|
-
"avatar-color-gen-ai": "awsui_avatar-color-gen-
|
|
7
|
-
"initials": "
|
|
8
|
-
"image": "
|
|
9
|
-
"content": "
|
|
4
|
+
"root": "awsui_root_1qkal_qb5ol_15",
|
|
5
|
+
"avatar-color-default": "awsui_avatar-color-default_1qkal_qb5ol_53",
|
|
6
|
+
"avatar-color-gen-ai": "awsui_avatar-color-gen-ai_1qkal_qb5ol_56",
|
|
7
|
+
"initials": "awsui_initials_1qkal_qb5ol_59",
|
|
8
|
+
"image": "awsui_image_1qkal_qb5ol_86",
|
|
9
|
+
"content": "awsui_content_1qkal_qb5ol_90"
|
|
10
10
|
};
|
|
11
11
|
|
package/avatar/styles.scoped.css
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
*/
|
|
13
13
|
/* stylelint-disable @cloudscape-design/no-motion-outside-of-mixin, selector-combinator-disallowed-list, selector-pseudo-class-no-unknown, selector-class-pattern */
|
|
14
14
|
/* stylelint-enable @cloudscape-design/no-motion-outside-of-mixin, selector-combinator-disallowed-list, selector-pseudo-class-no-unknown, selector-class-pattern */
|
|
15
|
-
.
|
|
15
|
+
.awsui_root_1qkal_qb5ol_15:not(#\9) {
|
|
16
16
|
border-collapse: separate;
|
|
17
17
|
border-spacing: 0;
|
|
18
18
|
box-sizing: border-box;
|
|
@@ -38,70 +38,73 @@
|
|
|
38
38
|
visibility: visible;
|
|
39
39
|
white-space: normal;
|
|
40
40
|
word-spacing: normal;
|
|
41
|
+
align-items: center;
|
|
42
|
+
display: flex;
|
|
41
43
|
color: var(--color-text-avatar-kuhkoa, #ffffff);
|
|
42
|
-
block-size: var(--awsui-avatar-size-
|
|
43
|
-
inline-size: var(--awsui-avatar-size-
|
|
44
|
+
block-size: var(--awsui-avatar-size-qkxefc);
|
|
45
|
+
inline-size: var(--awsui-avatar-size-qkxefc);
|
|
46
|
+
justify-content: center;
|
|
44
47
|
position: relative;
|
|
45
48
|
border-start-start-radius: 50%;
|
|
46
49
|
border-start-end-radius: 50%;
|
|
47
50
|
border-end-start-radius: 50%;
|
|
48
51
|
border-end-end-radius: 50%;
|
|
49
52
|
}
|
|
50
|
-
.
|
|
53
|
+
.awsui_root_1qkal_qb5ol_15.awsui_avatar-color-default_1qkal_qb5ol_53:not(#\9) {
|
|
51
54
|
background-color: var(--color-background-avatar-default-t427xm, #424650);
|
|
52
55
|
}
|
|
53
|
-
.
|
|
56
|
+
.awsui_root_1qkal_qb5ol_15.awsui_avatar-color-gen-ai_1qkal_qb5ol_56:not(#\9) {
|
|
54
57
|
background: var(--color-background-avatar-gen-ai-oxp2v6, radial-gradient(circle farthest-corner at top right, #b8e7ff 0%, #0099ff 25%, #5c7fff 40%, #8575ff 60%, #962eff 80%));
|
|
55
58
|
}
|
|
56
|
-
.
|
|
59
|
+
.awsui_root_1qkal_qb5ol_15.awsui_initials_1qkal_qb5ol_59:not(#\9) {
|
|
57
60
|
font-family: var(--font-family-base-gmnpzl, "Open Sans", "Helvetica Neue", Roboto, Arial, sans-serif);
|
|
58
61
|
font-size: var(--font-size-body-s-smc8cv, 12px);
|
|
59
62
|
line-height: var(--line-height-body-s-nu5hx1, 16px);
|
|
60
63
|
font-weight: var(--font-weight-heading-l-0t6dwc, 700);
|
|
61
64
|
}
|
|
62
|
-
.
|
|
65
|
+
.awsui_root_1qkal_qb5ol_15:not(#\9):focus {
|
|
63
66
|
outline: none;
|
|
64
67
|
}
|
|
65
|
-
.
|
|
68
|
+
.awsui_root_1qkal_qb5ol_15:not(#\9):focus-visible {
|
|
66
69
|
position: relative;
|
|
67
70
|
box-sizing: border-box;
|
|
68
71
|
outline: 2px dotted transparent;
|
|
69
|
-
outline-offset:
|
|
72
|
+
outline-offset: calc(4px + var(--awsui-avatar-root-border-width-qkxefc, 0px) + var(--awsui-avatar-focus-ring-border-width-qkxefc, 0px) - 1px);
|
|
70
73
|
}
|
|
71
|
-
.
|
|
74
|
+
.awsui_root_1qkal_qb5ol_15:not(#\9):focus-visible::before {
|
|
72
75
|
content: " ";
|
|
73
76
|
display: block;
|
|
74
77
|
position: absolute;
|
|
75
78
|
box-sizing: border-box;
|
|
76
|
-
inset-inline-start: calc(-1 * 4px);
|
|
77
|
-
inset-block-start: calc(-1 * 4px);
|
|
78
|
-
inline-size: calc(100% + 2 * 4px);
|
|
79
|
-
block-size: calc(100% + 2 * 4px);
|
|
80
|
-
border-radius: 50
|
|
81
|
-
border: 2px solid var(--color-border-item-focused-uk47pl, #006ce0);
|
|
79
|
+
inset-inline-start: calc(-1 * calc(4px + var(--awsui-avatar-root-border-width-qkxefc, 0px) + var(--awsui-avatar-focus-ring-border-width-qkxefc, 0px)));
|
|
80
|
+
inset-block-start: calc(-1 * calc(4px + var(--awsui-avatar-root-border-width-qkxefc, 0px) + var(--awsui-avatar-focus-ring-border-width-qkxefc, 0px)));
|
|
81
|
+
inline-size: calc(100% + 2 * calc(4px + var(--awsui-avatar-root-border-width-qkxefc, 0px) + var(--awsui-avatar-focus-ring-border-width-qkxefc, 0px)));
|
|
82
|
+
block-size: calc(100% + 2 * calc(4px + var(--awsui-avatar-root-border-width-qkxefc, 0px) + var(--awsui-avatar-focus-ring-border-width-qkxefc, 0px)));
|
|
83
|
+
border-radius: var(--awsui-avatar-focus-ring-border-radius-qkxefc, 50%);
|
|
84
|
+
border: var(--awsui-avatar-focus-ring-border-width-qkxefc, 2px) solid var(--awsui-avatar-focus-ring-border-color-qkxefc, var(--color-border-item-focused-uk47pl, #006ce0));
|
|
82
85
|
}
|
|
83
|
-
.
|
|
86
|
+
.awsui_root_1qkal_qb5ol_15:not(#\9):has(.awsui_image_1qkal_qb5ol_86) {
|
|
84
87
|
background: transparent;
|
|
85
88
|
}
|
|
86
89
|
|
|
87
|
-
.
|
|
90
|
+
.awsui_content_1qkal_qb5ol_90:not(#\9) {
|
|
88
91
|
display: flex;
|
|
89
92
|
align-items: center;
|
|
90
93
|
justify-content: center;
|
|
91
94
|
block-size: inherit;
|
|
92
95
|
inline-size: inherit;
|
|
93
96
|
overflow: hidden;
|
|
94
|
-
line-height: calc(0.8 * var(--awsui-avatar-size-
|
|
97
|
+
line-height: calc(0.8 * var(--awsui-avatar-size-qkxefc));
|
|
95
98
|
}
|
|
96
|
-
.
|
|
99
|
+
.awsui_content_1qkal_qb5ol_90 .awsui_image_1qkal_qb5ol_86:not(#\9) {
|
|
97
100
|
border-start-start-radius: 50%;
|
|
98
101
|
border-start-end-radius: 50%;
|
|
99
102
|
border-end-start-radius: 50%;
|
|
100
103
|
border-end-end-radius: 50%;
|
|
101
|
-
block-size: var(--awsui-avatar-size-
|
|
102
|
-
inline-size: var(--awsui-avatar-size-
|
|
104
|
+
block-size: var(--awsui-avatar-size-qkxefc);
|
|
105
|
+
inline-size: var(--awsui-avatar-size-qkxefc);
|
|
103
106
|
object-fit: cover;
|
|
104
107
|
}
|
|
105
|
-
.
|
|
106
|
-
font-size: clamp(var(--font-size-body-s-smc8cv, 12px), 0.4 * var(--awsui-avatar-size-
|
|
108
|
+
.awsui_content_1qkal_qb5ol_90 .awsui_initials_1qkal_qb5ol_59:not(#\9) {
|
|
109
|
+
font-size: clamp(var(--font-size-body-s-smc8cv, 12px), 0.4 * var(--awsui-avatar-size-qkxefc), 0.4 * var(--awsui-avatar-size-qkxefc));
|
|
107
110
|
}
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
// es-module interop with Babel and Typescript
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
module.exports.default = {
|
|
5
|
-
"root": "
|
|
6
|
-
"avatar-color-default": "awsui_avatar-color-
|
|
7
|
-
"avatar-color-gen-ai": "awsui_avatar-color-gen-
|
|
8
|
-
"initials": "
|
|
9
|
-
"image": "
|
|
10
|
-
"content": "
|
|
5
|
+
"root": "awsui_root_1qkal_qb5ol_15",
|
|
6
|
+
"avatar-color-default": "awsui_avatar-color-default_1qkal_qb5ol_53",
|
|
7
|
+
"avatar-color-gen-ai": "awsui_avatar-color-gen-ai_1qkal_qb5ol_56",
|
|
8
|
+
"initials": "awsui_initials_1qkal_qb5ol_59",
|
|
9
|
+
"image": "awsui_image_1qkal_qb5ol_86",
|
|
10
|
+
"content": "awsui_content_1qkal_qb5ol_90"
|
|
11
11
|
};
|
|
12
12
|
|
package/chat-bubble/index.d.ts
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
1
|
import { ChatBubbleProps } from "./interfaces";
|
|
2
2
|
export type { ChatBubbleProps };
|
|
3
|
-
export default function ChatBubble({
|
|
3
|
+
export default function ChatBubble({
|
|
4
|
+
type,
|
|
5
|
+
hideAvatar,
|
|
6
|
+
showLoadingBar,
|
|
7
|
+
...props
|
|
8
|
+
}: ChatBubbleProps): import("react/jsx-runtime").JSX.Element;
|