@ui5/webcomponents-ai 2.15.0 → 2.16.0-rc.1
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/CHANGELOG.md +25 -0
- package/README.md +1 -0
- package/dist/.tsbuildinfo +1 -1
- package/dist/Button.d.ts +1 -1
- package/dist/Button.js +4 -4
- package/dist/Button.js.map +1 -1
- package/dist/TextArea.d.ts +115 -0
- package/dist/TextArea.js +234 -0
- package/dist/TextArea.js.map +1 -0
- package/dist/TextAreaTemplate.d.ts +2 -0
- package/dist/TextAreaTemplate.js +13 -0
- package/dist/TextAreaTemplate.js.map +1 -0
- package/dist/ToolbarLabel.d.ts +39 -0
- package/dist/ToolbarLabel.js +67 -0
- package/dist/ToolbarLabel.js.map +1 -0
- package/dist/ToolbarLabelTemplate.d.ts +2 -0
- package/dist/ToolbarLabelTemplate.js +5 -0
- package/dist/ToolbarLabelTemplate.js.map +1 -0
- package/dist/Versioning.d.ts +95 -0
- package/dist/Versioning.js +187 -0
- package/dist/Versioning.js.map +1 -0
- package/dist/VersioningTemplate.d.ts +4 -0
- package/dist/VersioningTemplate.js +9 -0
- package/dist/VersioningTemplate.js.map +1 -0
- package/dist/WritingAssistant.d.ts +98 -0
- package/dist/WritingAssistant.js +190 -0
- package/dist/WritingAssistant.js.map +1 -0
- package/dist/WritingAssistantTemplate.d.ts +2 -0
- package/dist/WritingAssistantTemplate.js +12 -0
- package/dist/WritingAssistantTemplate.js.map +1 -0
- package/dist/bundle.esm.js +1 -0
- package/dist/bundle.esm.js.map +1 -1
- package/dist/css/themes/AITextArea.css +1 -0
- package/dist/css/themes/Button.css +1 -1
- package/dist/css/themes/PromptInput.css +1 -1
- package/dist/css/themes/Versioning.css +1 -0
- package/dist/css/themes/WritingAssistant.css +1 -0
- package/dist/custom-elements-internal.json +197 -0
- package/dist/custom-elements.json +183 -0
- package/dist/generated/assets/i18n/messagebundle_en.json +1 -1
- package/dist/generated/i18n/i18n-defaults.d.ts +10 -1
- package/dist/generated/i18n/i18n-defaults.js +10 -1
- package/dist/generated/i18n/i18n-defaults.js.map +1 -1
- package/dist/generated/themes/AITextArea.css.d.ts +2 -0
- package/dist/generated/themes/AITextArea.css.js +8 -0
- package/dist/generated/themes/AITextArea.css.js.map +1 -0
- package/dist/generated/themes/Button.css.d.ts +1 -1
- package/dist/generated/themes/Button.css.js +1 -1
- package/dist/generated/themes/Button.css.js.map +1 -1
- package/dist/generated/themes/PromptInput.css.d.ts +1 -1
- package/dist/generated/themes/PromptInput.css.js +1 -1
- package/dist/generated/themes/PromptInput.css.js.map +1 -1
- package/dist/generated/themes/Versioning.css.d.ts +2 -0
- package/dist/generated/themes/Versioning.css.js +8 -0
- package/dist/generated/themes/Versioning.css.js.map +1 -0
- package/dist/generated/themes/WritingAssistant.css.d.ts +2 -0
- package/dist/generated/themes/WritingAssistant.css.js +8 -0
- package/dist/generated/themes/WritingAssistant.css.js.map +1 -0
- package/dist/vscode.html-custom-data.json +27 -0
- package/dist/web-types.json +78 -1
- package/package-scripts.cjs +0 -1
- package/package.json +8 -8
- package/src/TextArea.css +45 -0
- package/src/TextAreaTemplate.tsx +90 -0
- package/src/ToolbarLabelTemplate.tsx +9 -0
- package/src/VersioningTemplate.tsx +34 -0
- package/src/WritingAssistantTemplate.tsx +49 -0
- package/src/i18n/messagebundle.properties +26 -0
- package/src/i18n/messagebundle_en.properties +1 -0
- package/src/themes/AITextArea.css +45 -0
- package/src/themes/PromptInput.css +5 -1
- package/src/themes/Versioning.css +20 -0
- package/src/themes/WritingAssistant.css +45 -0
package/src/TextArea.css
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
.ui5-ai-textarea-root {
|
|
2
|
+
position: relative;
|
|
3
|
+
display: flex;
|
|
4
|
+
flex-direction: column;
|
|
5
|
+
width: 100%;
|
|
6
|
+
height: 100%;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.ui5-ai-textarea-root .ui5-textarea-wrapper {
|
|
10
|
+
display: flex;
|
|
11
|
+
flex-direction: column;
|
|
12
|
+
flex: 1;
|
|
13
|
+
position: relative;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.ui5-ai-textarea-root [part="footer"] {
|
|
17
|
+
position: relative;
|
|
18
|
+
width: 100%;
|
|
19
|
+
margin-top: auto;
|
|
20
|
+
flex-shrink: 0;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.ui5-ai-writing-assistant-footer-bar {
|
|
24
|
+
background: var(--_ui5_texteditor_toolbar_background, var(--sapPageFooter_Background));
|
|
25
|
+
width: 100%;
|
|
26
|
+
box-sizing: border-box;
|
|
27
|
+
box-shadow: none;
|
|
28
|
+
border-bottom: none;
|
|
29
|
+
border-top: none;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.ui5-ai-writing-assistant-footer-bar--with-border {
|
|
33
|
+
border-top: 1px solid var(--sapPageFooter_BorderColor);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.ui5-ai-writing-assistant-action-label {
|
|
37
|
+
margin-left: 0.5rem;
|
|
38
|
+
color: var(--sapContent_LabelColor);
|
|
39
|
+
font-size: var(--sapFontSmallSize);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
#ai-menu-wrapper {
|
|
43
|
+
position: relative;
|
|
44
|
+
z-index: 1000;
|
|
45
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import type AITextArea from "./TextArea.js";
|
|
2
|
+
import WritingAssistant from "./WritingAssistant.js";
|
|
3
|
+
import BusyIndicator from "@ui5/webcomponents/dist/BusyIndicator.js";
|
|
4
|
+
import TextAreaPopoverTemplate from "@ui5/webcomponents/dist/TextAreaPopoverTemplate.js";
|
|
5
|
+
|
|
6
|
+
export default function TextAreaTemplate(this: AITextArea) {
|
|
7
|
+
return (
|
|
8
|
+
<div class="ui5-ai-textarea-root">
|
|
9
|
+
<div
|
|
10
|
+
class={this.classes.root}
|
|
11
|
+
onFocusIn={this._onfocusin}
|
|
12
|
+
onFocusOut={this._onfocusout}
|
|
13
|
+
>
|
|
14
|
+
<div class="ui5-textarea-wrapper">
|
|
15
|
+
{this.growing &&
|
|
16
|
+
<div id={`${this._id}-mirror`} class="ui5-textarea-mirror" aria-hidden="true">
|
|
17
|
+
{this._mirrorText.map(mirrorText => {
|
|
18
|
+
return (
|
|
19
|
+
<>
|
|
20
|
+
{mirrorText.text}
|
|
21
|
+
<br />
|
|
22
|
+
</>
|
|
23
|
+
);
|
|
24
|
+
})}
|
|
25
|
+
</div>
|
|
26
|
+
}
|
|
27
|
+
<BusyIndicator
|
|
28
|
+
id={`${this._id}-busyIndicator`}
|
|
29
|
+
active={this.loading}
|
|
30
|
+
class="ui5-textarea-busy-indicator"
|
|
31
|
+
>
|
|
32
|
+
<textarea
|
|
33
|
+
id={`${this._id}-inner`}
|
|
34
|
+
class="ui5-textarea-inner"
|
|
35
|
+
part="textarea"
|
|
36
|
+
placeholder={this.placeholder}
|
|
37
|
+
disabled={this.disabled}
|
|
38
|
+
readonly={this.readonly}
|
|
39
|
+
aria-label={this._ariaLabel}
|
|
40
|
+
aria-describedby={this.ariaDescribedBy}
|
|
41
|
+
aria-invalid={this._ariaInvalid}
|
|
42
|
+
aria-required={this.required}
|
|
43
|
+
maxlength={this._exceededTextProps.calcedMaxLength}
|
|
44
|
+
value={this.value}
|
|
45
|
+
data-sap-focus-ref
|
|
46
|
+
onInput={this._oninput}
|
|
47
|
+
onChange={this._onchange}
|
|
48
|
+
onKeyUp={this._onkeyup}
|
|
49
|
+
onKeyDown={this._onkeydown}
|
|
50
|
+
onSelect={this._onselect}
|
|
51
|
+
onScroll={this._onscroll}>
|
|
52
|
+
</textarea>
|
|
53
|
+
</BusyIndicator>
|
|
54
|
+
<div part="footer">
|
|
55
|
+
<slot name="footer">
|
|
56
|
+
<WritingAssistant
|
|
57
|
+
loading={this.loading}
|
|
58
|
+
currentVersionIndex={this.currentVersionIndex}
|
|
59
|
+
totalVersions={this.totalVersions}
|
|
60
|
+
actionText={this.actionText}
|
|
61
|
+
onButtonClick={this._handleAIButtonClick}
|
|
62
|
+
onStopGeneration={this.handleStopGeneration}
|
|
63
|
+
onVersionChange={this._handleVersionChange}
|
|
64
|
+
/>
|
|
65
|
+
</slot>
|
|
66
|
+
</div>
|
|
67
|
+
</div>
|
|
68
|
+
|
|
69
|
+
{this.showExceededText &&
|
|
70
|
+
<span class="ui5-textarea-exceeded-text">{this._exceededTextProps.exceededText}</span>
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
{this.hasValueState &&
|
|
74
|
+
<span id={`${this._id}-valueStateDesc`} class="ui5-hidden-text">{this.ariaValueStateHiddenText}</span>
|
|
75
|
+
}
|
|
76
|
+
</div>
|
|
77
|
+
|
|
78
|
+
{TextAreaPopoverTemplate.call(this)}
|
|
79
|
+
|
|
80
|
+
{/* ARIA live region for screen readers */}
|
|
81
|
+
<div aria-live="polite" aria-atomic="true" class="ui5-hidden-text">
|
|
82
|
+
{this.loading ? this.actionText : ""}
|
|
83
|
+
</div>
|
|
84
|
+
|
|
85
|
+
<div id="ai-menu-wrapper">
|
|
86
|
+
<slot name="menu"></slot>
|
|
87
|
+
</div>
|
|
88
|
+
</div>
|
|
89
|
+
);
|
|
90
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type Versioning from "./Versioning.js";
|
|
2
|
+
import ToolbarLabel from "./ToolbarLabel.js";
|
|
3
|
+
import ToolbarButton from "@ui5/webcomponents/dist/ToolbarButton.js";
|
|
4
|
+
import "@ui5/webcomponents-icons/dist/navigation-left-arrow.js";
|
|
5
|
+
import "@ui5/webcomponents-icons/dist/navigation-right-arrow.js";
|
|
6
|
+
|
|
7
|
+
export default function VersioningTemplate(this: Versioning) {
|
|
8
|
+
return (
|
|
9
|
+
<>
|
|
10
|
+
<ToolbarButton
|
|
11
|
+
design="Transparent"
|
|
12
|
+
icon="navigation-left-arrow"
|
|
13
|
+
tooltip={this._previousButtonTooltip}
|
|
14
|
+
accessibleName={this._previousButtonAccessibleName}
|
|
15
|
+
disabled={this.currentStep <= 1}
|
|
16
|
+
onClick={this.handlePreviousVersionClick}
|
|
17
|
+
data-ui5-versioning-button="previous"
|
|
18
|
+
/>
|
|
19
|
+
<ToolbarLabel
|
|
20
|
+
text={`${this.currentStep} / ${this.totalSteps}`}
|
|
21
|
+
class="version-step-counter"
|
|
22
|
+
/>
|
|
23
|
+
<ToolbarButton
|
|
24
|
+
design="Transparent"
|
|
25
|
+
icon="navigation-right-arrow"
|
|
26
|
+
tooltip={this._nextButtonTooltip}
|
|
27
|
+
accessibleName={this._nextButtonAccessibleName}
|
|
28
|
+
disabled={this.totalSteps <= 0 || this.currentStep >= this.totalSteps}
|
|
29
|
+
onClick={this.handleNextVersionClick}
|
|
30
|
+
data-ui5-versioning-button="next"
|
|
31
|
+
/>
|
|
32
|
+
</>
|
|
33
|
+
);
|
|
34
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type WritingAssistant from "./WritingAssistant.js";
|
|
2
|
+
import Versioning from "./Versioning.js";
|
|
3
|
+
import ToolbarLabel from "./ToolbarLabel.js";
|
|
4
|
+
|
|
5
|
+
import Toolbar from "@ui5/webcomponents/dist/Toolbar.js";
|
|
6
|
+
import ToolbarSpacer from "@ui5/webcomponents/dist/ToolbarSpacer.js";
|
|
7
|
+
import ToolbarButton from "@ui5/webcomponents/dist/ToolbarButton.js";
|
|
8
|
+
|
|
9
|
+
export default function WritingAssistantTemplate(this: WritingAssistant) {
|
|
10
|
+
const isMultiResults = this.totalVersions > 1;
|
|
11
|
+
const hasResults = (this.totalVersions > 0 && this.actionText) || this.loading;
|
|
12
|
+
|
|
13
|
+
return (
|
|
14
|
+
<Toolbar
|
|
15
|
+
accessibleName={this._toolbarAccessibleName}
|
|
16
|
+
aria-roledescription="toolbar"
|
|
17
|
+
class={`ui5-ai-writing-assistant-footer-bar${hasResults ? "--with-border" : ""}`}
|
|
18
|
+
>
|
|
19
|
+
{isMultiResults && !this.loading && (
|
|
20
|
+
<Versioning
|
|
21
|
+
currentStep={this.currentVersionIndex}
|
|
22
|
+
totalSteps={this.totalVersions}
|
|
23
|
+
onVersion-change={this.handleVersionChange}
|
|
24
|
+
/>
|
|
25
|
+
)}
|
|
26
|
+
|
|
27
|
+
{hasResults && this.actionText && (
|
|
28
|
+
<ToolbarLabel
|
|
29
|
+
text={this.actionText}
|
|
30
|
+
class="ui5-ai-writing-assistant-action-label"
|
|
31
|
+
/>
|
|
32
|
+
)}
|
|
33
|
+
|
|
34
|
+
<ToolbarSpacer />
|
|
35
|
+
|
|
36
|
+
<ToolbarButton
|
|
37
|
+
id="ai-menu-btn"
|
|
38
|
+
design="Transparent"
|
|
39
|
+
icon={this.loading ? "stop" : "ai"}
|
|
40
|
+
data-state={this.loading ? "generating" : "generate"}
|
|
41
|
+
onClick={this.handleButtonClick}
|
|
42
|
+
tooltip={this._buttonTooltip}
|
|
43
|
+
accessibilityAttributes={{ hasPopup: this.loading ? "false" : "menu" }}
|
|
44
|
+
accessibleName={this._buttonAccessibleName}
|
|
45
|
+
overflowPriority="NeverOverflow"
|
|
46
|
+
/>
|
|
47
|
+
</Toolbar>
|
|
48
|
+
);
|
|
49
|
+
}
|
|
@@ -10,3 +10,29 @@ PROMPT_INPUT_CHARACTERS_EXCEEDED={0} characters over limit
|
|
|
10
10
|
#XTXT: Text for
|
|
11
11
|
BUTTON_TOOLTIP_TEXT={0} with Artificial Intelligence
|
|
12
12
|
|
|
13
|
+
#XFLD: Text for the aria-label attribute of the Writing Assistant toolbar
|
|
14
|
+
WRITING_ASSISTANT_LABEL=AI Writing Assistant Toolbar Shift + F4
|
|
15
|
+
|
|
16
|
+
#XFLD: Previous version button accessible name
|
|
17
|
+
VERSIONING_PREVIOUS_BUTTON_TEXT=Previous Version
|
|
18
|
+
|
|
19
|
+
#XFLD: Next version button accessible name
|
|
20
|
+
VERSIONING_NEXT_BUTTON_TEXT=Next Version
|
|
21
|
+
|
|
22
|
+
#XMSG: Announcement message when AI writing assistant starts generating
|
|
23
|
+
WRITING_ASSISTANT_GENERATING_ANNOUNCEMENT=Stop generating (ESC)
|
|
24
|
+
|
|
25
|
+
#XFLD: Accessible name for the AI Writing Assistant toolbar
|
|
26
|
+
WRITING_ASSISTANT_TOOLBAR_ACCESSIBLE_NAME=AI Writing Assistant Toolbar
|
|
27
|
+
|
|
28
|
+
#XFLD: Accessible name for the AI Writing Assistant button
|
|
29
|
+
WRITING_ASSISTANT_BUTTON_ACCESSIBLE_NAME=AI Writing Assistant
|
|
30
|
+
|
|
31
|
+
#XFLD: Tooltip for the AI Writing Assistant button
|
|
32
|
+
WRITING_ASSISTANT_BUTTON_TOOLTIP=AI Writing Assistant (Shift + F4)
|
|
33
|
+
|
|
34
|
+
#XFLD: Tooltip for the Previous Version button
|
|
35
|
+
VERSIONING_PREVIOUS_BUTTON_TOOLTIP=Previous Version
|
|
36
|
+
|
|
37
|
+
#XFLD: Tooltip for the Next Version button
|
|
38
|
+
VERSIONING_NEXT_BUTTON_TOOLTIP=Next Version
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
.ui5-ai-textarea-root {
|
|
2
|
+
position: relative;
|
|
3
|
+
display: flex;
|
|
4
|
+
flex-direction: column;
|
|
5
|
+
width: 100%;
|
|
6
|
+
height: 100%;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.ui5-ai-textarea-root .ui5-textarea-wrapper {
|
|
10
|
+
display: flex;
|
|
11
|
+
flex-direction: column;
|
|
12
|
+
flex: 1;
|
|
13
|
+
position: relative;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.ui5-ai-textarea-root [part="footer"] {
|
|
17
|
+
position: relative;
|
|
18
|
+
width: 100%;
|
|
19
|
+
margin-top: auto;
|
|
20
|
+
flex-shrink: 0;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.ui5-ai-writing-assistant-footer-bar {
|
|
24
|
+
background: var(--_ui5_texteditor_toolbar_background, var(--sapPageFooter_Background));
|
|
25
|
+
width: 100%;
|
|
26
|
+
box-sizing: border-box;
|
|
27
|
+
box-shadow: none;
|
|
28
|
+
border-bottom: none;
|
|
29
|
+
border-top: none;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.ui5-ai-writing-assistant-footer-bar--with-border {
|
|
33
|
+
border-top: 1px solid var(--sapPageFooter_BorderColor);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.ui5-ai-writing-assistant-action-label {
|
|
37
|
+
margin-left: 0.5rem;
|
|
38
|
+
color: var(--sapContent_LabelColor);
|
|
39
|
+
font-size: var(--sapFontSmallSize);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
#ai-menu-wrapper {
|
|
43
|
+
position: relative;
|
|
44
|
+
z-index: 1000;
|
|
45
|
+
}
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
:host(:not([hidden])) {
|
|
2
|
+
display: inline-block;
|
|
3
|
+
}
|
|
4
|
+
|
|
1
5
|
.ai-prompt-input-button {
|
|
2
6
|
margin-left: .5rem;
|
|
3
7
|
margin-top: 3px;
|
|
@@ -6,7 +10,7 @@
|
|
|
6
10
|
.ai-prompt-input-wrapper {
|
|
7
11
|
display: flex;
|
|
8
12
|
flex-direction: column;
|
|
9
|
-
width: 270px;
|
|
13
|
+
min-width: 270px;
|
|
10
14
|
}
|
|
11
15
|
|
|
12
16
|
.ai-prompt-input-form-wrapper {
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
display: inline-flex;
|
|
3
|
+
align-items: center;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
#versioning-history {
|
|
7
|
+
display: flex;
|
|
8
|
+
align-items: center;
|
|
9
|
+
gap: 0;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.version-step-counter {
|
|
13
|
+
margin: 0 0.25rem;
|
|
14
|
+
display: flex;
|
|
15
|
+
align-items: center;
|
|
16
|
+
color: var(--sapContent_LabelColor);
|
|
17
|
+
font-size: var(--sapFontSmallSize);
|
|
18
|
+
line-height: 1;
|
|
19
|
+
}
|
|
20
|
+
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
.ui5-ai-textarea-root {
|
|
2
|
+
position: relative;
|
|
3
|
+
display: flex;
|
|
4
|
+
flex-direction: column;
|
|
5
|
+
width: 100%;
|
|
6
|
+
height: 100%;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.ui5-ai-textarea-root .ui5-textarea-wrapper {
|
|
10
|
+
display: flex;
|
|
11
|
+
flex-direction: column;
|
|
12
|
+
flex: 1;
|
|
13
|
+
position: relative;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.ui5-ai-textarea-root [part="footer"] {
|
|
17
|
+
width: 100%;
|
|
18
|
+
margin-top: auto;
|
|
19
|
+
flex-shrink: 0;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.ui5-ai-writing-assistant-footer-bar {
|
|
23
|
+
background: var(--_ui5_texteditor_toolbar_background, var(--sapPageFooter_Background));
|
|
24
|
+
width: 100%;
|
|
25
|
+
box-sizing: border-box;
|
|
26
|
+
box-shadow: none;
|
|
27
|
+
border-bottom: none;
|
|
28
|
+
border-top: none;
|
|
29
|
+
padding: 0.5rem;
|
|
30
|
+
min-height: 2.75rem;
|
|
31
|
+
display: flex;
|
|
32
|
+
align-items: center;
|
|
33
|
+
justify-content: flex-start;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.ui5-ai-writing-assistant-footer-bar--with-border {
|
|
37
|
+
border-top: 1px solid var(--sapPageFooter_BorderColor);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.ui5-ai-writing-assistant-action-label {
|
|
41
|
+
color: var(--sapContent_LabelColor);
|
|
42
|
+
font-size: var(--sapFontSize);
|
|
43
|
+
font-family: "72override", var(--sapFontFamily);
|
|
44
|
+
margin-left: 0.25rem;
|
|
45
|
+
}
|