)}
-
-
{children}
+
+
fireNonCancelableEvent(onSelect)}
+ className={clsx(styles["message-area"], styles[`chat-bubble-type-${type}`], {
+ [styles["with-loading-bar"]]: showLoadingBar,
+ [styles["message-area-selectable"]]: !!selectionType,
+ [styles["message-area-clickable"]]: selectionType === "click",
+ [styles["message-area-selected"]]: selected,
+ })}
+ >
+ {children}
+
+ {actions && {actions}
}
- {actions && {actions}
}
+ {showLoadingBar && }
+
- {showLoadingBar &&
}
+ {additionalContent &&
{additionalContent}
}
);
diff --git a/src/chat-bubble/styles.scss b/src/chat-bubble/styles.scss
index cf79209..482f8e7 100644
--- a/src/chat-bubble/styles.scss
+++ b/src/chat-bubble/styles.scss
@@ -18,12 +18,15 @@
}
.message-area {
+ @include shared.styles-reset;
+ @include shared.default-text-style;
+
display: flex;
flex-direction: column;
gap: cs.$space-scaled-s;
padding: cs.$space-scaled-s;
min-width: 0;
- overflow-x: auto;
+ // overflow-x: auto;
border-start-start-radius: cs.$border-radius-chat-bubble;
border-start-end-radius: cs.$border-radius-chat-bubble;
@@ -39,6 +42,34 @@
background-color: cs.$color-background-chat-bubble-outgoing;
}
+ // TODO: create new tokens for outgoing-selectable (background, border, selected background, selected border)
+ // Potentially, need some for border width, too.
+ &.message-area-selectable.message-area-selectable {
+ border-color: cs.$color-border-divider-default;
+ border-width: 2px;
+ border-style: solid;
+ background-color: cs.$color-background-layout-main;
+ }
+
+ &.message-area-clickable.message-area-clickable {
+ cursor: pointer;
+
+ &:focus-visible {
+ @include shared.focus-highlight(6px, cs.$border-radius-chat-bubble);
+ }
+
+ &:hover {
+ background-color: cs.$color-background-dropdown-item-hover;
+ }
+ }
+
+ &.message-area-selected.message-area-selected.message-area-selected {
+ border-color: cs.$color-border-item-selected;
+ border-width: 2px;
+ border-style: solid;
+ background-color: cs.$color-background-item-selected;
+ }
+
&.chat-bubble-type-incoming {
color: cs.$color-text-chat-bubble-incoming;
background-color: cs.$color-background-chat-bubble-incoming;
diff --git a/src/internal/shared.scss b/src/internal/shared.scss
index 4d762dc..b959c9c 100644
--- a/src/internal/shared.scss
+++ b/src/internal/shared.scss
@@ -4,6 +4,23 @@
*/
@use "../../node_modules/@cloudscape-design/design-tokens/index.scss" as cs;
+$font-family-base: cs.$font-family-base;
+$font-weight-normal: 400;
+
+@mixin default-text-style {
+ @include font-body-m;
+ color: cs.$color-text-body-default;
+ font-weight: $font-weight-normal;
+ font-family: $font-family-base;
+ -webkit-font-smoothing: auto;
+ -moz-osx-font-smoothing: auto;
+}
+
+@mixin font-body-m {
+ font-size: cs.$font-size-body-m;
+ line-height: cs.$line-height-body-m;
+}
+
@mixin focus-highlight(
$gutter: 4px,
$border-radius: cs.$border-radius-control-default-focus-ring,
@@ -44,12 +61,14 @@
animation: none;
transition: none;
}
+
:global(.awsui-motion-disabled) &,
:global(.awsui-mode-entering) & {
animation: none;
transition: none;
}
}
+
/* stylelint-enable @cloudscape-design/no-motion-outside-of-mixin, selector-combinator-disallowed-list, selector-pseudo-class-no-unknown, selector-class-pattern */
@mixin styles-reset {
diff --git a/src/support-prompt-group/interfaces.ts b/src/support-prompt-group/interfaces.ts
index 61e437a..34edb1c 100644
--- a/src/support-prompt-group/interfaces.ts
+++ b/src/support-prompt-group/interfaces.ts
@@ -27,14 +27,20 @@ export interface SupportPromptGroupProps {
* Use this to provide a unique accessible name for each support prompt group on the page.
*/
ariaLabel: string;
+
+ /**
+ * POC
+ */
+ toggledItems?: string[];
}
export namespace SupportPromptGroupProps {
export type Alignment = "vertical" | "horizontal";
export interface Item {
- text: string;
id: string;
+ text: string;
+ header?: { text: string; icon?: React.ReactNode; pressedIcon?: React.ReactNode };
}
export interface ItemClickDetail extends _ClickDetail {
diff --git a/src/support-prompt-group/internal.tsx b/src/support-prompt-group/internal.tsx
index 4e113da..388f904 100644
--- a/src/support-prompt-group/internal.tsx
+++ b/src/support-prompt-group/internal.tsx
@@ -31,6 +31,7 @@ export const InternalSupportPromptGroup = forwardRef(
items,
__internalRootRef,
ariaLabel,
+ toggledItems,
...rest
}: SupportPromptGroupProps & InternalBaseComponentProps,
ref: Ref
,
@@ -154,9 +155,16 @@ export const InternalSupportPromptGroup = forwardRef(
key={index}
onClick={(event) => handleClick(event, item.id)}
id={item.id}
+ pressed={toggledItems?.includes(item.id)}
ref={(element) => (itemsRef.current[item.id] = element)}
>
- {item.text}
+ {item.header && (
+
+
{item.header.text}
+
{toggledItems?.includes(item.id) ? item.header.pressedIcon : item.header.icon}
+
+ )}
+ {item.text}
);
})}
diff --git a/src/support-prompt-group/prompt.tsx b/src/support-prompt-group/prompt.tsx
index 693ef78..ac3e4b4 100644
--- a/src/support-prompt-group/prompt.tsx
+++ b/src/support-prompt-group/prompt.tsx
@@ -10,31 +10,34 @@ import useForwardFocus from "../internal/utils/use-forward-focus";
import styles from "./styles.css.js";
export interface PromptProps {
- children: string;
+ children: React.ReactNode;
id: string;
+ pressed?: boolean;
onClick: (event: React.MouseEvent, id: string) => void;
}
-export const Prompt = forwardRef(({ children, id, onClick }: PromptProps, ref: Ref) => {
- const buttonRef = useRef(null);
- useForwardFocus(ref, buttonRef);
+export const Prompt = forwardRef(
+ ({ children, id, pressed, onClick }: PromptProps, ref: Ref) => {
+ const buttonRef = useRef(null);
+ useForwardFocus(ref, buttonRef);
- const { tabIndex } = useSingleTabStopNavigation(buttonRef);
+ const { tabIndex } = useSingleTabStopNavigation(buttonRef);
- return (
-
- );
-});
+ return (
+
+ );
+ },
+);
diff --git a/src/support-prompt-group/styles.scss b/src/support-prompt-group/styles.scss
index 6b780e1..63e314c 100644
--- a/src/support-prompt-group/styles.scss
+++ b/src/support-prompt-group/styles.scss
@@ -51,6 +51,12 @@
border-color: awsui.$color-border-button-normal-active;
}
+ &-pressed {
+ color: awsui.$color-text-button-normal-active;
+ background: awsui.$color-background-button-normal-active;
+ border-color: awsui.$color-border-button-normal-active;
+ }
+
&:focus {
outline: none;
}
@@ -59,3 +65,11 @@
@include shared.focus-highlight(6px, 6px);
}
}
+
+.item-header {
+ display: flex;
+ gap: awsui.$space-static-xs;
+ justify-content: space-between;
+
+ font-weight: bold;
+}
diff --git a/tsconfig.json b/tsconfig.json
index e7229a3..ca91991 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -7,7 +7,7 @@
"types": [],
"lib": ["es2019", "dom", "dom.iterable"],
"module": "ESNext",
- "moduleResolution": "nodenext",
+ "moduleResolution": "Node",
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"isolatedModules": true,