Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,10 @@ public class ChatAssistant<T extends Message> extends Div {
private static final String RESIZE_INDICATOR_VISIBLE_CLASS = "fc-chat-assistant-resize-indicator-visible";
// Theme-agnostic token fallback chains (Lumo token, then Aura token, then a literal) so the badge
// renders correctly under both the Lumo and Aura themes of Vaadin 25.
private static final String DEFAULT_UNREAD_BADGE_BACKGROUND ="var(--lumo-warning-color, var(--aura-accent-yellow, #e07a00))";
private static final String DEFAULT_UNREAD_BADGE_BACKGROUND ="var(--lumo-warning-color, var(--aura-accent-color, #e07a00))";
private static final String DEFAULT_UNREAD_BADGE_COLOR = "var(--lumo-warning-contrast-color, var(--aura-accent-contrast-color, #ffffff))";
// Aura accent class that makes the badge yellow, with matching contrast text.
private static final String UNREAD_BADGE_AURA_CLASS = "aura-accent-yellow";
// Shared spacing/typography tokens used for the badge, with the same cross-theme fallback pattern.
private static final String BADGE_FONT_SIZE = "var(--lumo-font-size-xs, var(--aura-font-size-s, 0.75rem))";
private static final String BADGE_PADDING = "var(--lumo-space-xs, var(--vaadin-padding-xs, 0.25rem))";
Expand Down Expand Up @@ -394,7 +396,7 @@ private void setUI(
setFabSize(DEFAULT_FAB_SIZE);

unreadBadge.setText(String.valueOf(unreadMessages));
unreadBadge.addClassName(DEFAULT_UNREAD_BADGE_CLASS);
unreadBadge.addClassNames(DEFAULT_UNREAD_BADGE_CLASS, UNREAD_BADGE_AURA_CLASS);
unreadBadge
.getStyle()
.setTextAlign(Style.TextAlign.CENTER)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@
.fc-chat-assistant-fab {
cursor: pointer;
transform: scale(1);
/* Cross-theme fallback: Lumo token, then a literal shadow (Aura has no equivalent scale token). */
box-shadow: var(--lumo-box-shadow-m, 0 2px 6px rgba(0, 0, 0, 0.2));
/* Cross-theme fallback: Lumo token, then Aura token, then a literal shadow. */
box-shadow: var(--lumo-box-shadow-m, var(--aura-shadow-s, 0 2px 6px rgba(0, 0, 0, 0.2)));
}

/* Expansion state when being dragged */
.fc-chat-assistant-fab.dragging {
cursor: grabbing;
transform: scale(1.15);
box-shadow: var(--lumo-box-shadow-xl, 0 8px 24px rgba(0, 0, 0, 0.3));
box-shadow: var(--lumo-box-shadow-xl, var(--aura-shadow-m, 0 8px 24px rgba(0, 0, 0, 0.3)));
}

.fc-chat-assistant-popover {
Expand All @@ -53,8 +53,8 @@
share one rule. */
vaadin-popover-overlay.fc-chat-assistant-popover::part(overlay),
vaadin-popover.fc-chat-assistant-popover::part(overlay) {
/* Cross-theme fallback: Lumo radius token, then Aura base radius, then a literal. */
border-radius: var(--lumo-border-radius-l, var(--aura-base-radius, 12px));
/* Cross-theme fallback: Lumo radius token, then the Vaadin 25 radius token, then a literal. */
border-radius: var(--lumo-border-radius-l, var(--vaadin-radius-l, 12px));
}

/* The chat overlay fills this part; the part already clamps itself to the viewport
Expand All @@ -77,6 +77,8 @@ vaadin-popover.fc-chat-assistant-popover::part(content) {
/* Likewise, the Vaadin 25 (vaadin-dialog) and Vaadin 24 (vaadin-dialog-overlay) dialog selectors. */
vaadin-dialog.fc-chat-assistant-dialog::part(content),
vaadin-dialog-overlay.fc-chat-assistant-dialog::part(content) {
/* Aura and the base styles default to content-box, which pushed the padding past the dialog */
box-sizing: border-box;
height: 100%;
width: 100%;
display: flex;
Expand Down Expand Up @@ -106,7 +108,7 @@ vaadin-dialog-overlay.fc-chat-assistant-dialog::part(content) {
/* filled triangle pointing right by default; rotated per direction below */
border-top: 5px solid transparent;
border-bottom: 5px solid transparent;
border-left: 7px solid var(--lumo-contrast-20pct, var(--aura-border-color, rgba(0, 0, 0, 0.2)));
border-left: 7px solid var(--lumo-contrast-20pct, var(--vaadin-border-color, rgba(0, 0, 0, 0.2)));
}

/* Feature enabled (overlay class) AND this resizer is draggable now (can-drag on the resizer). */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
* #L%
*/
.lds-ellipsis {
/* change color here */
color: #1c4c5b;
color: var(--lumo-secondary-text-color, var(--vaadin-text-color-secondary, #1c4c5b));
}
.lds-ellipsis,
.lds-ellipsis div {
Expand Down Expand Up @@ -83,6 +82,7 @@

.chat-assistant-who-is-typing {
width: 100%;
box-sizing: border-box;
padding: var(--lumo-space-xs, var(--vaadin-padding-xs, 0.25rem));
font-size: var(--lumo-font-size-xs, var(--aura-font-size-s, small));
color: var(--lumo-secondary-text-color, var(--vaadin-text-color-secondary, #697177));
Expand All @@ -97,5 +97,5 @@ vaadin-markdown.fc-chat-message-markdown > :last-child {
margin-bottom: 0;
}
vaadin-markdown.fc-chat-message-markdown > * + * {
margin-top: var(--lumo-space-s, 0.5rem);
margin-top: var(--lumo-space-s, var(--vaadin-gap-s, 0.5rem));
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ public ChatAssistantLazyLoadingDemo() {
// Backing message list, served lazily by the data provider below.
List<Message> messages = createMessages();

// Create the assistant; the "small" class shrinks the message font (see demo CSS).
// Create the assistant; the "compact" class shrinks the message font (see demo CSS).
ChatAssistant<Message> chatAssistant = new ChatAssistant<>();
chatAssistant.setClassName("small");
chatAssistant.setClassName("compact");
SvgIcon icon = new SvgIcon("chatbot.svg");
icon.setColor("currentColor");
chatAssistant.setFabIcon(icon);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@
* limitations under the License.
* #L%
*/
animated-fab {
--chatbot-avatar-img: url(chatbot.png);
--chatbot-avatar-bg-color: white;
/* chatbot.png is a dark icon on a transparent background: keep the theme background in light
mode and switch to white in dark mode so it stays visible */
vaadin-message[user-img="chatbot.png"] > vaadin-avatar {
--vaadin-avatar-background: light-dark(var(--vaadin-background-container-strong), white);
}

animated-fab.small vaadin-message {
font-size: var(--lumo-font-size-xxs);
animated-fab.compact vaadin-message {
font-size: var(--lumo-font-size-xxs, var(--aura-font-size-xs, 0.75rem));
}
Loading