-
Notifications
You must be signed in to change notification settings - Fork 280
feat(ui5-ai-textarea): introduce new component #12157
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
initial poc draft, all naming and logic are work in progress and subject to change
initial poc draft, all naming and logic are work in progress and subject to change BGSOFUIRILA-4032
delete unwanted file
refactor, add tests
restore textarea template
remove 'SingleResult' and 'MultipleResults' properties from AssistantState.ts adapt the implementation to use the totalVersions count internally to control the state
fix build errors
major API and structure refactoring
accessibility improvements
fix errors and bugs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces a new AI-powered textarea component that extends the standard TextArea with AI Writing Assistant capabilities, including text generation, version management, and interactive toolbar functionality.
- Introduces
ui5-ai-textareacomponent with AI Writing Assistant integration - Adds supporting components for version management and writing assistance toolbar
- Implements comprehensive test coverage and demo page functionality
Reviewed Changes
Copilot reviewed 19 out of 19 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/ai/src/TextArea.ts | Main AITextArea component extending TextArea with AI capabilities |
| packages/ai/src/WritingAssistant.ts | WritingAssistant component providing AI toolbar functionality |
| packages/ai/src/Versioning.ts | Versioning component for navigating between AI-generated content versions |
| packages/ai/test/pages/TextArea.html | Demo page showcasing AITextArea features and interactions |
| packages/ai/cypress/specs/*.cy.tsx | Comprehensive Cypress test suites for all new components |
| packages/ai/src/themes/*.css | CSS styling for AI components |
| packages/ai/src/*Template.tsx | JSX templates for component rendering |
| packages/ai/src/types/AssistantState.ts | TypeScript enum defining AI assistant states |
| packages/ai/src/i18n/messagebundle.properties | Internationalization strings |
| packages/ai/src/bundle.esm.ts | Export bundle update |
| packages/ai/README.md | Documentation update |
| packages/localization/used-modules.txt | Localization module cleanup |
Comments suppressed due to low confidence (5)
packages/ai/src/Versioning.ts:52
- The tag name uses hard-coded component reference 'ui5-ai-textarea-versioning' which violates scoping guidelines. Consider using a more generic tag name like 'ui5-ai-versioning' to make the component reusable across different contexts.
tag: "ui5-ai-textarea-versioning",
packages/ai/src/TextArea.ts:228
- Hard-coded tag name 'ui5-ai-writing-assistant' violates scoping guidelines. Use attribute notation instead: this.shadowRoot?.querySelector('[ui5-ai-writing-assistant]')
const toolbar = this.shadowRoot?.querySelector("ui5-ai-writing-assistant") as HTMLElement;
const aiButton = toolbar?.shadowRoot?.querySelector("#ai-menu-btn") as HTMLElement;
packages/ai/src/TextArea.ts:215
- Hard-coded tag name 'textarea' violates scoping guidelines. Use attribute notation instead: this.shadowRoot?.querySelector('[textarea]') or use a more specific selector.
setTimeout(() => {
const textarea = this.shadowRoot?.querySelector("textarea");
if (textarea && textarea.value !== this.value) {
textarea.value = this.value;
}
}, 0);
packages/ai/src/TextArea.ts:258
- Hard-coded tag name 'textarea' violates scoping guidelines. Use attribute notation instead: this.shadowRoot?.querySelector('[textarea]') or use a more specific selector.
const textarea = this.shadowRoot?.querySelector("textarea");
packages/ai/src/TextArea.ts:271
- Hard-coded tag name 'textarea' violates scoping guidelines. Use attribute notation instead: this.shadowRoot?.querySelector('[textarea]') or use a more specific selector.
const textarea = this.shadowRoot?.querySelector("textarea");
|
🧹 Preview deployment cleaned up: https://pr-12157--ui5-webcomponents.netlify.app |
fix test naming issues
…into ai-textarea
fix test file name
…into ai-textarea
refactor inner components to use Toolbar overflow mechanism for better responsiveness
…to ai-textarea
- Refactor VersioningButton and ToolbarLabel to extend ToolbarItem for responsive behavior - Update Versioning component to use unified ToolbarItem architecture - Replace assistantState API with loading property across TextArea/WritingAssistant - Enable proper overflow behavior where versioning controls move to overflow area on small screens
use plain toolbar button, adjust tests, clean up styles
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 20 out of 20 changed files in this pull request and generated 4 comments.
apply code review suggestions
accessibility improvements
restore used-modules.txt
…to ai-textarea
|
🎉 This PR is included in version v2.16.0-rc.0 🎉 The release is available on v2.16.0-rc.0 Your semantic-release bot 📦🚀 |
| return; | ||
| } | ||
|
|
||
| const menu = menuNodes[0] as HTMLElement & { opener?: HTMLElement; open?: boolean }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not OK. Please make the slot require a ui5-menu, use the generic for getSlottedNodes and work with ui5-menu here. The way this slot is currently defined tells the user any HTML element can be used, which will be for example represented by sap.ui.core.Control in OpenUI5 integration.
UI5 AI Textarea Component Overview
An AI-enhanced textarea component that provides intelligent text generation capabilities with version management and user-friendly controls.
Component Architecture
Internal Components
The
ui5-ai-textareacomponent is composed of two specialized internal components:1. WritingAssistant (
ui5-ai-writing-assistant)2. Versioning (
ui5-ai-versioning)API Reference
Core AI Properties
loadingfalseactionText""currentVersionIndex1totalVersions1Inherited Properties
The component inherits all standard TextArea properties, including:
value,placeholder,disabled,readonlyrequired,maxlength,rows,growingvalueState,accessibleNameEvents
AI-Specific Events
version-change{ backwards: boolean }stop-generation{}Inherited Events
All standard TextArea events:
input,change,select, etc.User Interface & Interactions
Menu Integration
menu- Acceptsui5-menucomponent for AI action menus⌨️ Keyboard Shortcuts
Shift + F4Ctrl/Cmd + Shift + ZCtrl/Cmd + Shift + Y🔄 UI States & Behavior
⏳ Loading State
When
loading="true":aria-liveregion📊 Version Management
Single Version (
totalVersions = 1)Multiple Versions (
totalVersions > 1)Usage Examples
🚀 Basic Implementation
🔄 With Version Management
⚡ Loading State Example
BGSOFUIRILA-4032