Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
5bdd195
refactor: replace markdown-editor with native vaadin markdown
Totremont Jun 30, 2026
4f8d8c5
build: remove the markdown-editor-addon dependency
Totremont Jun 30, 2026
bc4bc3e
build: bump development version to 5.1.0-SNAPSHOT
Totremont Jun 30, 2026
685f982
feat: add FabPosition and ChatAssistantMode enums
Totremont Jun 30, 2026
8828897
feat: add FAB drag and corner-positioning frontend
Totremont Jun 30, 2026
1d79af0
feat: add chat window resize and sizing frontend
Totremont Jun 30, 2026
10ad375
fix: tighten spacing of markdown messages
Totremont Jun 30, 2026
9570271
feat: add FAB, window, and mode configuration to ChatAssistant
Totremont Jun 30, 2026
1e3c062
feat(demo): rewrite core and content demos
Totremont Jun 30, 2026
80e04d0
feat(demo): add FAB configuration and in-a-box demos
Totremont Jun 30, 2026
1e3f20c
feat(demo): add modes and responsive demo
Totremont Jun 30, 2026
7817ff0
feat(demo): register the demo views in the tabbed view
Totremont Jun 30, 2026
d5afe75
test: parameterize ChatAssistant type in serialization test
Totremont Jun 30, 2026
091c8e6
refactor: drop redundant serial annotations
Totremont Jun 30, 2026
9dfd4fd
test: tidy integration test imports and assertions
Totremont Jun 30, 2026
9f53b69
chore: ignore generated web-component.html
Totremont Jun 30, 2026
46911d7
docs(readme): document FAB, window, and mode features
Totremont Jun 30, 2026
1e01967
refactor: add classname to markdown selector
Totremont Jul 1, 2026
657f684
WIP: address FAB API and behavior review feedback
Totremont Jul 1, 2026
75da6fb
WIP: fix frontend listener cleanup and stale overlay references
Totremont Jul 1, 2026
ab78c8c
WIP: add unit tests for ChatAssistant pure-Java logic
Totremont Jul 1, 2026
b602461
WIP: add window sizing options to the builder
Totremont Jul 1, 2026
38ba082
WIP: apply Google Java Style
Totremont Jul 1, 2026
2025dd3
WIP: normalize copyright year range
Totremont Jul 1, 2026
3db04ad
WIP: support both Lumo and Aura themes
Totremont Jul 1, 2026
8206630
WIP: report effective FAB drag state from isFabMovable
Totremont Jul 2, 2026
f8e25e6
WIP: fix background-thread hygiene in demos
Totremont Jul 2, 2026
dd50937
WIP: simplify public javadoc, drop client-internal details
Totremont Jul 2, 2026
935ed06
WIP: encapsulate FabVariant theming internals
Totremont Jul 2, 2026
5866b68
WIP: clarify only default functionality comply
Totremont Jul 2, 2026
24b1b98
WIP: fix invalid CSS rejected by lightningcss (Vaadin 25.2)
Totremont Jul 3, 2026
0f0dd11
WIP: make introduced variables private instead of protected
Totremont Jul 20, 2026
276e3ad
WIP: store FAB icon once as a single Component field
Totremont Jul 20, 2026
a59143e
WIP: reset unread badge text color on whitespace-only input
Totremont Jul 20, 2026
eb3f62e
WIP: clear recycled message row content while loading
Totremont Jul 20, 2026
fb3a4ae
WIP: make screen-size listener work in mobile mode
Totremont Jul 20, 2026
d0a27b1
WIP: load default FAB icon lazily and degrade gracefully
Totremont Jul 20, 2026
2d25b21
WIP: reject non-pixel lengths in window-size setters
Totremont Jul 20, 2026
efea048
WIP: keep duplicate ChatAssistant inert instead of throwing on attach
Totremont Jul 20, 2026
fecafa1
WIP: re-init FAB movement after reattach
Totremont Jul 20, 2026
50016bd
WIP: re-init resize handles after reattach
Totremont Jul 20, 2026
858b302
WIP: make builder constructor private and use primitive flags
Totremont Jul 20, 2026
0b39798
WIP: make internal resizer styling helpers private
Totremont Jul 20, 2026
827bab8
WIP: inline size-variant check in FAB theme variant methods
Totremont Jul 20, 2026
1a98777
WIP: use diamond operator in SerializationTest
Totremont Jul 20, 2026
97558bc
WIP: merge duplicated popover/dialog content-part CSS rules
Totremont Jul 20, 2026
2d950bb
WIP: share overlay resolution between resize.js helpers
Totremont Jul 20, 2026
7311394
WIP: deduplicate setFabIcon overloads
Totremont Jul 20, 2026
5ecf988
WIP: defer window size/constraint push until the popover is open
Totremont Jul 20, 2026
e45eef1
WIP: hold resize handles in a direction-keyed map
Totremont Jul 20, 2026
ff5ee1d
WIP: run frontend teardown via an animated-fab custom element
Totremont Jul 20, 2026
e9097de
WIP: delegate setFabIcon(Component) to the sized overload
Totremont Jul 20, 2026
39c1edb
WIP: don't nudge the FAB on a sub-threshold click
Totremont Jul 20, 2026
14799ca
WIP: reject negative FAB margin
Totremont Jul 20, 2026
1f76604
WIP: abort generative demo streaming on interrupt
Totremont Jul 20, 2026
9c182e3
WIP: fix FAB theme-variant example in README
Totremont Jul 20, 2026
047d970
WIP: correct @since tags on window sizing/unread API
Totremont Jul 20, 2026
f463c95
WIP: move FAB color application out of FabVariant
Totremont Jul 20, 2026
9761b99
WIP: fill empty @param in ChatMessage.updateMessage javadoc
Totremont Jul 20, 2026
06b0a72
WIP: trim redundant javadoc and reflow mangled comments
Totremont Jul 20, 2026
67998fc
WIP: drop write-only minWidth/minHeight fields
Totremont Jul 20, 2026
fa0c653
WIP: target the animated-fab tag in integration tests
Totremont Jul 20, 2026
16ce7b0
WIP: cover screen-size listener state in SerializationTest
Totremont Jul 20, 2026
5042e78
WIP: simplify px concatenation and add a color literal fallback
Totremont Jul 20, 2026
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ drivers
/types.d.ts*
/frontend/generated
/frontend/index.html
/frontend/web-component.html
/src/main/frontend/web-component.html
/src/main/frontend/generated
/src/main/frontend/index.html
vite.generated.ts
Expand Down
104 changes: 83 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,16 @@ Vaadin Add-on that displays a chat assistant floating window using [Material UI'

## Features

* Messages can be sent by the user or programmatically.
* Listen for new messages written by the user.
* Toggle the chat window on/off.
* Send messages from the user or programmatically, and listen for messages written by the user.
* Toggle the chat window open/closed, or open it as a full-screen dialog on mobile.
* Markdown rendering, lazy loading via a `DataProvider`, and streaming ("generative") answers.
* Customizable floating action button (FAB): icon, size, color (`FabVariant` theme variants),
corner position and margin, draggable or fixed, and viewport- or container-anchored placement.
* Resizable chat window with eight drag handles, optional resize direction indicators, and
configurable initial size with min/max bounds.
* Responsive desktop/mobile modes with optional breakpoint-based auto-switching, plus listeners for
mode changes and for the chat window crossing a size threshold.
* A fluent `ChatAssistant.builder()` to configure everything declaratively.

## Supported versions

Expand Down Expand Up @@ -96,24 +103,79 @@ Chat Assistant Add-on is written by Flowing Code S.A.

## Getting started

Simple example showing the basic options:

ChatAssistant chatAssistant = new ChatAssistant();
TextArea message = new TextArea();
message.setLabel("Enter a message from the assistant");
message.setSizeFull();

Button chat = new Button("Chat");
chat.addClickListener(ev->{
Message m = new Message(message.getValue(),false,false,0,false,new Sender("Assistant","1","https://ui-avatars.com/api/?name=Bot"));
chatAssistant.sendMessage(m);
message.clear();
});
chatAssistant.sendMessage(new Message("Hello, I am here to assist you",false,false,0,false,new Sender("Assistant","1","https://ui-avatars.com/api/?name=Bot")));
chatAssistant.toggle();
chatAssistant.addChatSentListener(ev->{
Notification.show(ev.getMessage());
});
`ChatAssistant<T extends Message>` renders a floating action button (FAB) that opens a chat window.
Add it to any layout and send messages to it; it shows a FAB in the bottom-right corner by default.

```java
ChatAssistant<Message> chatAssistant = new ChatAssistant<>();
add(chatAssistant);

// Send a message programmatically (e.g. from the assistant).
chatAssistant.sendMessage(Message.builder()
.name("Assistant")
.content("Hello, I am here to assist you")
.messageTime(LocalDateTime.now())
.build());

// React to messages typed by the user.
chatAssistant.setSubmitListener(ev ->
chatAssistant.sendMessage(Message.builder()
.name("User")
.content(ev.getValue())
.messageTime(LocalDateTime.now())
.build()));

// Open or close the window programmatically.
chatAssistant.setOpened(true);
```

### Configuring with the builder

Use `ChatAssistant.builder()` to configure the FAB and window declaratively:

```java
ChatAssistant<Message> chatAssistant = ChatAssistant.<Message>builder()
.fabIcon(new SvgIcon("icons/my-icon.svg")) // custom FAB icon (defaults to a chatbot icon)
.defaultFabPosition(FabPosition.BOTTOM_LEFT)
.fabMovable(true) // allow dragging the FAB
.resizable(true) // allow resizing the window
.markdownEnabled(true) // render message content as Markdown
.build();
```

Everything in the builder also has a setter, so the FAB and window can be reconfigured at runtime.

### Styling the FAB

```java
chatAssistant.setFabPosition(FabPosition.TOP_RIGHT); // move it (and set the reset corner)
chatAssistant.addFabThemeVariants(FabVariant.LARGE); // grow the FAB (FabVariant.SMALL/LARGE)
chatAssistant.addFabThemeVariants(FabVariant.LUMO_CONTRAST); // recolor it (color variants)
chatAssistant.setResizeIndicatorsVisible(true); // show resize-direction hints
```

### Sizing the window

```java
chatAssistant.setWindowWidth("400px");
chatAssistant.setWindowHeight("500px");
chatAssistant.setWindowMinWidth(300); // bounds honored on open and while resizing
chatAssistant.setWindowMaxWidth(700);
```

### Responsive / mobile mode

In `MOBILE` mode the chat opens as a full-screen dialog. Set a breakpoint to switch automatically
between desktop (anchored popover) and mobile as the viewport crosses it:

```java
ChatAssistant<Message> chatAssistant = ChatAssistant.<Message>builder()
.mobileBreakpoint(768) // auto-switch to mobile below 768px (auto-switching is opt-in)
.build();

chatAssistant.addModeChangedListener(ev -> Notification.show("Now in " + ev.getMode() + " mode"));
chatAssistant.setMode(ChatAssistantMode.MOBILE); // or switch manually
```

## Special configuration when using Spring

Expand Down
8 changes: 1 addition & 7 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>org.vaadin.addons.flowingcode</groupId>
<artifactId>chat-assistant-addon</artifactId>
<version>5.0.2-SNAPSHOT</version>
<version>5.1.0-SNAPSHOT</version>
<name>Chat Assistant Add-on</name>
<description>Chat Assistant Add-on for Vaadin Flow</description>
<url>https://www.flowingcode.com/en/open-source/</url>
Expand All @@ -20,7 +20,6 @@
<webdriver.chrome.driver>${drivers.dir}/chromedriver</webdriver.chrome.driver>
<jetty.version>11.0.26</jetty.version>
<flowingcode.commons.demo.version>5.2.0</flowingcode.commons.demo.version>
<markdown-editor.version>2.0.3</markdown-editor.version>
<lombok.version>1.18.34</lombok.version>
<hamcrest.version>1.3</hamcrest.version>
<servlet-api.version>3.1.0</servlet-api.version>
Expand Down Expand Up @@ -125,11 +124,6 @@
<artifactId>vaadin-core</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.flowingcode.vaadin.addons</groupId>
<artifactId>markdown-editor-addon</artifactId>
<version>${markdown-editor.version}</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
Expand Down
Loading
Loading