@ui5/webcomponents-ai 0.0.0-f42e7c18c → 0.0.0-f589d25f5
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 +607 -0
- package/LICENSE.txt +201 -0
- package/README.md +11 -8
- package/cypress.config.js +3 -0
- package/dist/.tsbuildinfo +1 -0
- package/dist/Assets-fetch.d.ts +3 -0
- package/dist/Assets-fetch.js +6 -0
- package/dist/Assets-fetch.js.map +1 -0
- package/dist/Assets-node.d.ts +14 -0
- package/dist/Assets-node.js +17 -0
- package/dist/Assets-node.js.map +1 -0
- package/dist/Button.d.ts +81 -33
- package/dist/Button.js +169 -78
- package/dist/Button.js.map +1 -1
- package/dist/ButtonState.d.ts +10 -3
- package/dist/ButtonState.js +16 -3
- package/dist/ButtonState.js.map +1 -1
- package/dist/ButtonTemplate.js +2 -2
- package/dist/ButtonTemplate.js.map +1 -1
- package/dist/Input.d.ts +143 -0
- package/dist/Input.js +288 -0
- package/dist/Input.js.map +1 -0
- package/dist/InputTemplate.d.ts +10 -0
- package/dist/InputTemplate.js +28 -0
- package/dist/InputTemplate.js.map +1 -0
- package/dist/PromptInput.d.ts +6 -11
- package/dist/PromptInput.js +3 -13
- package/dist/PromptInput.js.map +1 -1
- package/dist/TextArea.d.ts +118 -0
- package/dist/TextArea.js +230 -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 +100 -0
- package/dist/WritingAssistant.js +197 -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 +2 -0
- package/dist/bundle.esm.js.map +1 -1
- package/dist/css/themes/Button.css +1 -1
- package/dist/css/themes/Input.css +1 -0
- package/dist/css/themes/PromptInput.css +1 -1
- package/dist/css/themes/TextArea.css +1 -0
- package/dist/css/themes/Versioning.css +1 -0
- package/dist/css/themes/WritingAssistant.css +1 -0
- package/dist/custom-elements-internal.json +493 -14
- package/dist/custom-elements.json +425 -12
- package/dist/generated/assets/i18n/messagebundle_ar.json +1 -1
- package/dist/generated/assets/i18n/messagebundle_bg.json +1 -1
- package/dist/generated/assets/i18n/messagebundle_ca.json +1 -1
- package/dist/generated/assets/i18n/messagebundle_cnr.json +1 -1
- package/dist/generated/assets/i18n/messagebundle_cs.json +1 -1
- package/dist/generated/assets/i18n/messagebundle_cy.json +1 -1
- package/dist/generated/assets/i18n/messagebundle_da.json +1 -1
- package/dist/generated/assets/i18n/messagebundle_de.json +1 -1
- package/dist/generated/assets/i18n/messagebundle_el.json +1 -1
- package/dist/generated/assets/i18n/messagebundle_en.json +1 -1
- package/dist/generated/assets/i18n/messagebundle_en_GB.json +1 -1
- package/dist/generated/assets/i18n/messagebundle_en_US_sappsd.json +1 -1
- package/dist/generated/assets/i18n/messagebundle_en_US_saprigi.json +1 -1
- package/dist/generated/assets/i18n/messagebundle_en_US_saptrc.json +1 -1
- package/dist/generated/assets/i18n/messagebundle_es.json +1 -1
- package/dist/generated/assets/i18n/messagebundle_es_MX.json +1 -1
- package/dist/generated/assets/i18n/messagebundle_et.json +1 -1
- package/dist/generated/assets/i18n/messagebundle_fi.json +1 -1
- package/dist/generated/assets/i18n/messagebundle_fr.json +1 -1
- package/dist/generated/assets/i18n/messagebundle_fr_CA.json +1 -1
- package/dist/generated/assets/i18n/messagebundle_hi.json +1 -1
- package/dist/generated/assets/i18n/messagebundle_hr.json +1 -1
- package/dist/generated/assets/i18n/messagebundle_hu.json +1 -1
- package/dist/generated/assets/i18n/messagebundle_id.json +1 -0
- package/dist/generated/assets/i18n/messagebundle_it.json +1 -1
- package/dist/generated/assets/i18n/messagebundle_iw.json +1 -1
- package/dist/generated/assets/i18n/messagebundle_ja.json +1 -1
- package/dist/generated/assets/i18n/messagebundle_kk.json +1 -1
- package/dist/generated/assets/i18n/messagebundle_ko.json +1 -1
- package/dist/generated/assets/i18n/messagebundle_lt.json +1 -1
- package/dist/generated/assets/i18n/messagebundle_lv.json +1 -1
- package/dist/generated/assets/i18n/messagebundle_mk.json +1 -1
- package/dist/generated/assets/i18n/messagebundle_ms.json +1 -1
- package/dist/generated/assets/i18n/messagebundle_nl.json +1 -1
- package/dist/generated/assets/i18n/messagebundle_no.json +1 -1
- package/dist/generated/assets/i18n/messagebundle_pl.json +1 -1
- package/dist/generated/assets/i18n/messagebundle_pt.json +1 -1
- package/dist/generated/assets/i18n/messagebundle_pt_PT.json +1 -1
- package/dist/generated/assets/i18n/messagebundle_ro.json +1 -1
- package/dist/generated/assets/i18n/messagebundle_ru.json +1 -1
- package/dist/generated/assets/i18n/messagebundle_sh.json +1 -1
- package/dist/generated/assets/i18n/messagebundle_sk.json +1 -1
- package/dist/generated/assets/i18n/messagebundle_sl.json +1 -1
- package/dist/generated/assets/i18n/messagebundle_sr.json +1 -1
- package/dist/generated/assets/i18n/messagebundle_sv.json +1 -1
- package/dist/generated/assets/i18n/messagebundle_th.json +1 -1
- package/dist/generated/assets/i18n/messagebundle_tr.json +1 -1
- package/dist/generated/assets/i18n/messagebundle_uk.json +1 -1
- package/dist/generated/assets/i18n/messagebundle_vi.json +1 -1
- package/dist/generated/assets/i18n/messagebundle_zh_CN.json +1 -1
- package/dist/generated/assets/i18n/messagebundle_zh_TW.json +1 -1
- package/dist/generated/assets/themes/sap_horizon/parameters-bundle.css.json +1 -1
- package/dist/generated/assets/themes/sap_horizon_dark/parameters-bundle.css.json +1 -1
- package/dist/generated/assets/themes/sap_horizon_hcb/parameters-bundle.css.json +1 -1
- package/dist/generated/assets/themes/sap_horizon_hcw/parameters-bundle.css.json +1 -1
- package/dist/generated/i18n/i18n-defaults.d.ts +15 -1
- package/dist/generated/i18n/i18n-defaults.js +15 -1
- package/dist/generated/i18n/i18n-defaults.js.map +1 -1
- package/dist/generated/json-imports/Themes-fetch.js +1 -1
- package/dist/generated/json-imports/Themes-fetch.js.map +1 -1
- package/dist/generated/json-imports/Themes-node.d.ts +1 -0
- package/dist/generated/json-imports/Themes-node.js +21 -0
- package/dist/generated/json-imports/Themes-node.js.map +1 -0
- package/dist/generated/json-imports/Themes.js +1 -1
- package/dist/generated/json-imports/Themes.js.map +1 -1
- package/dist/generated/json-imports/i18n-fetch.js +3 -1
- package/dist/generated/json-imports/i18n-fetch.js.map +1 -1
- package/dist/generated/json-imports/i18n-node.d.ts +1 -0
- package/dist/generated/json-imports/i18n-node.js +120 -0
- package/dist/generated/json-imports/i18n-node.js.map +1 -0
- package/dist/generated/json-imports/i18n.js +3 -1
- package/dist/generated/json-imports/i18n.js.map +1 -1
- package/dist/generated/themes/Button.css.d.ts +2 -3
- package/dist/generated/themes/Button.css.js +4 -5
- package/dist/generated/themes/Button.css.js.map +1 -1
- package/dist/generated/themes/Input.css.d.ts +2 -0
- package/dist/generated/themes/Input.css.js +8 -0
- package/dist/generated/themes/Input.css.js.map +1 -0
- package/dist/generated/themes/PromptInput.css.d.ts +2 -3
- package/dist/generated/themes/PromptInput.css.js +4 -5
- package/dist/generated/themes/PromptInput.css.js.map +1 -1
- package/dist/generated/themes/TextArea.css.d.ts +2 -0
- package/dist/generated/themes/TextArea.css.js +8 -0
- package/dist/generated/themes/TextArea.css.js.map +1 -0
- 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/generated/themes/sap_horizon/parameters-bundle.css.d.ts +2 -3
- package/dist/generated/themes/sap_horizon/parameters-bundle.css.js +1 -2
- package/dist/generated/themes/sap_horizon/parameters-bundle.css.js.map +1 -1
- package/dist/generated/themes/sap_horizon_dark/parameters-bundle.css.d.ts +2 -3
- package/dist/generated/themes/sap_horizon_dark/parameters-bundle.css.js +1 -2
- package/dist/generated/themes/sap_horizon_dark/parameters-bundle.css.js.map +1 -1
- package/dist/generated/themes/sap_horizon_hcb/parameters-bundle.css.d.ts +2 -3
- package/dist/generated/themes/sap_horizon_hcb/parameters-bundle.css.js +1 -2
- package/dist/generated/themes/sap_horizon_hcb/parameters-bundle.css.js.map +1 -1
- package/dist/generated/themes/sap_horizon_hcw/parameters-bundle.css.d.ts +2 -3
- package/dist/generated/themes/sap_horizon_hcw/parameters-bundle.css.js +1 -2
- package/dist/generated/themes/sap_horizon_hcw/parameters-bundle.css.js.map +1 -1
- package/dist/vscode.html-custom-data.json +68 -4
- package/dist/web-types.json +209 -8
- package/package-scripts.cjs +3 -0
- package/package.json +25 -18
- package/src/ButtonTemplate.tsx +9 -6
- package/src/InputTemplate.tsx +197 -0
- 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 +43 -1
- package/src/i18n/messagebundle_ar.properties +20 -0
- package/src/i18n/messagebundle_bg.properties +20 -0
- package/src/i18n/messagebundle_ca.properties +20 -0
- package/src/i18n/messagebundle_cnr.properties +20 -0
- package/src/i18n/messagebundle_cs.properties +20 -0
- package/src/i18n/messagebundle_cy.properties +20 -0
- package/src/i18n/messagebundle_da.properties +20 -0
- package/src/i18n/messagebundle_de.properties +20 -0
- package/src/i18n/messagebundle_el.properties +20 -0
- package/src/i18n/messagebundle_en.properties +20 -0
- package/src/i18n/messagebundle_en_GB.properties +20 -0
- package/src/i18n/messagebundle_en_US_sappsd.properties +20 -0
- package/src/i18n/messagebundle_en_US_saprigi.properties +28 -0
- package/src/i18n/messagebundle_en_US_saptrc.properties +20 -0
- package/src/i18n/messagebundle_es.properties +20 -0
- package/src/i18n/messagebundle_es_MX.properties +21 -1
- package/src/i18n/messagebundle_et.properties +20 -0
- package/src/i18n/messagebundle_fi.properties +20 -0
- package/src/i18n/messagebundle_fr.properties +20 -0
- package/src/i18n/messagebundle_fr_CA.properties +20 -0
- package/src/i18n/messagebundle_hi.properties +20 -0
- package/src/i18n/messagebundle_hr.properties +22 -2
- package/src/i18n/messagebundle_hu.properties +20 -0
- package/src/i18n/messagebundle_id.properties +20 -0
- package/src/i18n/messagebundle_it.properties +20 -0
- package/src/i18n/messagebundle_iw.properties +20 -0
- package/src/i18n/messagebundle_ja.properties +20 -0
- package/src/i18n/messagebundle_kk.properties +20 -0
- package/src/i18n/messagebundle_ko.properties +20 -0
- package/src/i18n/messagebundle_lt.properties +20 -0
- package/src/i18n/messagebundle_lv.properties +20 -0
- package/src/i18n/messagebundle_mk.properties +20 -0
- package/src/i18n/messagebundle_ms.properties +20 -0
- package/src/i18n/messagebundle_nl.properties +20 -0
- package/src/i18n/messagebundle_no.properties +20 -0
- package/src/i18n/messagebundle_pl.properties +20 -0
- package/src/i18n/messagebundle_pt.properties +20 -0
- package/src/i18n/messagebundle_pt_PT.properties +20 -0
- package/src/i18n/messagebundle_ro.properties +20 -0
- package/src/i18n/messagebundle_ru.properties +20 -0
- package/src/i18n/messagebundle_sh.properties +20 -0
- package/src/i18n/messagebundle_sk.properties +20 -0
- package/src/i18n/messagebundle_sl.properties +20 -0
- package/src/i18n/messagebundle_sr.properties +20 -0
- package/src/i18n/messagebundle_sv.properties +20 -0
- package/src/i18n/messagebundle_th.properties +22 -2
- package/src/i18n/messagebundle_tr.properties +20 -0
- package/src/i18n/messagebundle_uk.properties +20 -0
- package/src/i18n/messagebundle_vi.properties +20 -0
- package/src/i18n/messagebundle_zh_CN.properties +20 -0
- package/src/i18n/messagebundle_zh_TW.properties +20 -0
- package/src/themes/Button.css +75 -21
- package/src/themes/Input.css +83 -0
- package/src/themes/PromptInput.css +5 -1
- package/src/themes/TextArea.css +45 -0
- package/src/themes/Versioning.css +20 -0
- package/src/themes/WritingAssistant.css +45 -0
- package/tsconfig.json +28 -3
- package/dist/tsconfig.tsbuildinfo +0 -1
package/dist/PromptInput.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import UI5Element from "@ui5/webcomponents-base/dist/UI5Element.js";
|
|
2
2
|
import type I18nBundle from "@ui5/webcomponents-base/dist/i18nBundle.js";
|
|
3
3
|
import type ValueState from "@ui5/webcomponents-base/dist/types/ValueState.js";
|
|
4
|
-
import type { IInputSuggestionItem
|
|
4
|
+
import type { IInputSuggestionItem } from "@ui5/webcomponents/dist/Input.js";
|
|
5
|
+
import type Input from "@ui5/webcomponents/dist/Input.js";
|
|
6
|
+
import type { UI5CustomEvent } from "@ui5/webcomponents-base/dist/index.js";
|
|
5
7
|
/**
|
|
6
8
|
* @class
|
|
7
9
|
* ### Overview
|
|
@@ -12,7 +14,7 @@ import type { IInputSuggestionItem, InputEventDetail } from "@ui5/webcomponents/
|
|
|
12
14
|
*
|
|
13
15
|
* ### ES6 Module Import
|
|
14
16
|
*
|
|
15
|
-
* `import "@ui5/webcomponents-ai/dist/PromptInput.js
|
|
17
|
+
* `import "@ui5/webcomponents-ai/dist/PromptInput.js"`
|
|
16
18
|
* @class
|
|
17
19
|
* @constructor
|
|
18
20
|
* @public
|
|
@@ -106,8 +108,6 @@ declare class PromptInput extends UI5Element {
|
|
|
106
108
|
/**
|
|
107
109
|
* Defines whether the component should show suggestions, if such are present.
|
|
108
110
|
*
|
|
109
|
-
* **Note:** You need to import the `InputSuggestions` module
|
|
110
|
-
* from `"@ui5/webcomponents/dist/features/InputSuggestions.js"` to enable this functionality.
|
|
111
111
|
* @default false
|
|
112
112
|
* @public
|
|
113
113
|
*/
|
|
@@ -120,11 +120,6 @@ declare class PromptInput extends UI5Element {
|
|
|
120
120
|
*
|
|
121
121
|
* **Note:** The `<ui5-suggestion-item>`, `<ui5-suggestion-item-group>` and `ui5-suggestion-item-custom` are recommended to be used as suggestion items.
|
|
122
122
|
*
|
|
123
|
-
* **Note:** Importing the Input Suggestions Support feature:
|
|
124
|
-
*
|
|
125
|
-
* `import "@ui5/webcomponents/dist/features/InputSuggestions.js";`
|
|
126
|
-
*
|
|
127
|
-
* automatically imports the `<ui5-suggestion-item>` and `<ui5-suggestion-item-group>` for your convenience.
|
|
128
123
|
* @public
|
|
129
124
|
*/
|
|
130
125
|
suggestionItems: Array<IInputSuggestionItem>;
|
|
@@ -143,10 +138,10 @@ declare class PromptInput extends UI5Element {
|
|
|
143
138
|
valueStateMessage: Array<HTMLElement>;
|
|
144
139
|
static i18nBundle: I18nBundle;
|
|
145
140
|
_onkeydown(e: KeyboardEvent): void;
|
|
146
|
-
_onInnerInput(e:
|
|
141
|
+
_onInnerInput(e: UI5CustomEvent<Input, "input">): void;
|
|
147
142
|
_onInnerChange(): void;
|
|
148
143
|
_onButtonClick(): void;
|
|
149
|
-
_onTypeAhead(e:
|
|
144
|
+
_onTypeAhead(e: UI5CustomEvent<Input, "type-ahead">): void;
|
|
150
145
|
get _exceededText(): string | undefined;
|
|
151
146
|
get _maxLenght(): number | undefined;
|
|
152
147
|
get _submitButtonDisabled(): boolean;
|
package/dist/PromptInput.js
CHANGED
|
@@ -12,9 +12,6 @@ import event from "@ui5/webcomponents-base/dist/decorators/event-strict.js";
|
|
|
12
12
|
import slot from "@ui5/webcomponents-base/dist/decorators/slot.js";
|
|
13
13
|
import i18n from "@ui5/webcomponents-base/dist/decorators/i18n.js";
|
|
14
14
|
import jsxRenderer from "@ui5/webcomponents-base/dist/renderer/JsxRenderer.js";
|
|
15
|
-
import Input from "@ui5/webcomponents/dist/Input.js";
|
|
16
|
-
import Label from "@ui5/webcomponents/dist/Label.js";
|
|
17
|
-
import Button from "@ui5/webcomponents/dist/Button.js";
|
|
18
15
|
import { isEnter, } from "@ui5/webcomponents-base/dist/Keys.js";
|
|
19
16
|
import { PROMPT_INPUT_CHARACTERS_LEFT, PROMPT_INPUT_CHARACTERS_EXCEEDED, } from "./generated/i18n/i18n-defaults.js";
|
|
20
17
|
import PromptInputTemplate from "./PromptInputTemplate.js";
|
|
@@ -30,7 +27,7 @@ import PromptInputCss from "./generated/themes/PromptInput.css.js";
|
|
|
30
27
|
*
|
|
31
28
|
* ### ES6 Module Import
|
|
32
29
|
*
|
|
33
|
-
* `import "@ui5/webcomponents-ai/dist/PromptInput.js
|
|
30
|
+
* `import "@ui5/webcomponents-ai/dist/PromptInput.js"`
|
|
34
31
|
* @class
|
|
35
32
|
* @constructor
|
|
36
33
|
* @public
|
|
@@ -97,8 +94,6 @@ let PromptInput = PromptInput_1 = class PromptInput extends UI5Element {
|
|
|
97
94
|
/**
|
|
98
95
|
* Defines whether the component should show suggestions, if such are present.
|
|
99
96
|
*
|
|
100
|
-
* **Note:** You need to import the `InputSuggestions` module
|
|
101
|
-
* from `"@ui5/webcomponents/dist/features/InputSuggestions.js"` to enable this functionality.
|
|
102
97
|
* @default false
|
|
103
98
|
* @public
|
|
104
99
|
*/
|
|
@@ -110,7 +105,7 @@ let PromptInput = PromptInput_1 = class PromptInput extends UI5Element {
|
|
|
110
105
|
}
|
|
111
106
|
}
|
|
112
107
|
_onInnerInput(e) {
|
|
113
|
-
this.value = e.
|
|
108
|
+
this.value = e.currentTarget.value;
|
|
114
109
|
this.fireDecoratorEvent("input");
|
|
115
110
|
}
|
|
116
111
|
_onInnerChange() {
|
|
@@ -120,7 +115,7 @@ let PromptInput = PromptInput_1 = class PromptInput extends UI5Element {
|
|
|
120
115
|
this.fireDecoratorEvent("submit");
|
|
121
116
|
}
|
|
122
117
|
_onTypeAhead(e) {
|
|
123
|
-
this.value = e.
|
|
118
|
+
this.value = e.currentTarget.value;
|
|
124
119
|
}
|
|
125
120
|
get _exceededText() {
|
|
126
121
|
if (this.showExceededText) {
|
|
@@ -190,11 +185,6 @@ PromptInput = PromptInput_1 = __decorate([
|
|
|
190
185
|
renderer: jsxRenderer,
|
|
191
186
|
styles: PromptInputCss,
|
|
192
187
|
template: PromptInputTemplate,
|
|
193
|
-
dependencies: [
|
|
194
|
-
Input,
|
|
195
|
-
Label,
|
|
196
|
-
Button,
|
|
197
|
-
],
|
|
198
188
|
})
|
|
199
189
|
/**
|
|
200
190
|
* Fired when the input operation has finished by pressing Enter
|
package/dist/PromptInput.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PromptInput.js","sourceRoot":"","sources":["../src/PromptInput.ts"],"names":[],"mappings":";;;;;;;AAAA,OAAO,UAAU,MAAM,4CAA4C,CAAC;AACpE,OAAO,aAAa,MAAM,0DAA0D,CAAC;AACrF,OAAO,QAAQ,MAAM,qDAAqD,CAAC;AAC3E,OAAO,KAAK,MAAM,yDAAyD,CAAC;AAC5E,OAAO,IAAI,MAAM,iDAAiD,CAAC;AACnE,OAAO,IAAI,MAAM,iDAAiD,CAAC;AACnE,OAAO,WAAW,MAAM,sDAAsD,CAAC;AAI/E,OAAO,KAAK,MAAM,kCAAkC,CAAC;AACrD,OAAO,KAAK,MAAM,kCAAkC,CAAC;AACrD,OAAO,MAAM,MAAM,mCAAmC,CAAC;AACvD,OAAO,EACN,OAAO,GACP,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EACN,4BAA4B,EAC5B,gCAAgC,GAChC,MAAM,mCAAmC,CAAC;AAE3C,OAAO,mBAAmB,MAAM,0BAA0B,CAAC;AAE3D,SAAS;AACT,OAAO,cAAc,MAAM,uCAAu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ACL,IAAI,EAAE,WAAW;QACjB,uBAAuB,EAAE,IAAI;KAC7B,CAAC;sDACqC;AAGhC;IADN,IAAI,CAAC,uBAAuB,CAAC;qCACA;AAtJzB,WAAW;IA5ChB,aAAa,CAAC;QACd,GAAG,EAAE,qBAAqB;QAC1B,QAAQ,EAAE,WAAW;QACrB,MAAM,EAAE,cAAc;QACtB,QAAQ,EAAE,mBAAmB;QAC7B,YAAY,EAAE;YACb,KAAK;YACL,KAAK;YACL,MAAM;SACN;KACD,CAAC;IAEF;;;;;;OAMG;;IACF,KAAK,CAAC,QAAQ,EAAE;QAChB,OAAO,EAAE,IAAI;KACb,CAAC;IAEF;;;;;;OAMG;;IACF,KAAK,CAAC,OAAO,EAAE;QACf,OAAO,EAAE,IAAI;KACb,CAAC;IAEF;;;;;;OAMG;;IACF,KAAK,CAAC,QAAQ,EAAE;QAChB,OAAO,EAAE,IAAI;KACb,CAAC;GACI,WAAW,CAwMhB;AAED,WAAW,CAAC,MAAM,EAAE,CAAC;AAErB,eAAe,WAAW,CAAC","sourcesContent":["import UI5Element from \"@ui5/webcomponents-base/dist/UI5Element.js\";\nimport customElement from \"@ui5/webcomponents-base/dist/decorators/customElement.js\";\nimport property from \"@ui5/webcomponents-base/dist/decorators/property.js\";\nimport event from \"@ui5/webcomponents-base/dist/decorators/event-strict.js\";\nimport slot from \"@ui5/webcomponents-base/dist/decorators/slot.js\";\nimport i18n from \"@ui5/webcomponents-base/dist/decorators/i18n.js\";\nimport jsxRenderer from \"@ui5/webcomponents-base/dist/renderer/JsxRenderer.js\";\nimport type I18nBundle from \"@ui5/webcomponents-base/dist/i18nBundle.js\";\nimport type ValueState from \"@ui5/webcomponents-base/dist/types/ValueState.js\";\nimport type { IInputSuggestionItem, InputEventDetail } from \"@ui5/webcomponents/dist/Input.js\";\nimport Input from \"@ui5/webcomponents/dist/Input.js\";\nimport Label from \"@ui5/webcomponents/dist/Label.js\";\nimport Button from \"@ui5/webcomponents/dist/Button.js\";\nimport {\n\tisEnter,\n} from \"@ui5/webcomponents-base/dist/Keys.js\";\nimport {\n\tPROMPT_INPUT_CHARACTERS_LEFT,\n\tPROMPT_INPUT_CHARACTERS_EXCEEDED,\n} from \"./generated/i18n/i18n-defaults.js\";\n\nimport PromptInputTemplate from \"./PromptInputTemplate.js\";\n\n// Styles\nimport PromptInputCss from \"./generated/themes/PromptInput.css.js\";\n\n/**\n * @class\n * ### Overview\n *\n * The `ui5-ai-prompt-input` component allows the user to write custom instructions in natural language, so that AI is guided to generate content tailored to user needs.\n *\n * **Note:** The web component is in an experimental state\n *\n * ### ES6 Module Import\n *\n * `import \"@ui5/webcomponents-ai/dist/PromptInput.js\n * @class\n * @constructor\n * @public\n * @extends UI5Element\n * @experimental The **@ui5/webcomponents-ai** package is under development and considered experimental - components' APIs are subject to change.\n */\n@customElement({\n\ttag: \"ui5-ai-prompt-input\",\n\trenderer: jsxRenderer,\n\tstyles: PromptInputCss,\n\ttemplate: PromptInputTemplate,\n\tdependencies: [\n\t\tInput,\n\t\tLabel,\n\t\tButton,\n\t],\n})\n\n/**\n * Fired when the input operation has finished by pressing Enter\n * or AI button is clicked.\n *\n * @since 2.0.0\n * @public\n */\n@event(\"submit\", {\n\tbubbles: true,\n})\n\n/**\n * Fired when the value of the component changes at each keystroke,\n * and when a suggestion item has been selected.\n *\n * @since 2.0.0\n * @public\n */\n@event(\"input\", {\n\tbubbles: true,\n})\n\n/**\n * Fired when the input operation has finished by pressing Enter\n * or on focusout.\n *\n * @since 2.0.0\n * @public\n */\n@event(\"change\", {\n\tbubbles: true,\n})\nclass PromptInput extends UI5Element {\n\teventDetails!: {\n\t\tsubmit: void;\n\t\tinput: void;\n\t\tchange: void;\n\t}\n\t/**\n\t * Defines the value of the component.\n\t *\n\t * @default \"\"\n\t * @since 2.0.0\n\t * @public\n\t */\n\t@property()\n\tvalue = \"\";\n\n\t/**\n\t * Defines a short hint intended to aid the user with data entry when the\n\t * component has no value.\n\t * @default undefined\n\t * @since 2.0.0\n\t * @public\n\t */\n\t@property()\n\tplaceholder?: string;\n\n\t/**\n\t * Defines the label of the input field.\n\t *\n\t * @default undefined\n\t * @since 2.0.0\n\t * @public\n\t */\n\t@property()\n\tlabel?: string;\n\n\t/**\n\t * Defines whether the clear icon of the input will be shown.\n\t * @default false\n\t * @public\n\t * @since 2.0.0\n\t */\n\t@property({ type: Boolean })\n\tshowClearIcon = false;\n\n\t/**\n\t * Determines whether the characters exceeding the maximum allowed character count are visible\n\t * in the component.\n\t *\n\t * If set to `false`, the user is not allowed to enter more characters than what is set in the\n\t * `maxlength` property.\n\t * If set to `true` the characters exceeding the `maxlength` value are selected on\n\t * paste and the counter below the component displays their number.\n\t * @default false\n\t * @public\n\t * @since 2.0.0\n\t */\n\t@property({ type: Boolean })\n\tshowExceededText = false;\n\n\t/**\n\t * Defines whether the component is in disabled state.\n\t *\n\t * **Note:** A disabled component is completely noninteractive.\n\t * @default false\n\t * @public\n\t * @since 2.0.0\n\t */\n\t@property({ type: Boolean })\n\tdisabled = false;\n\n\t/**\n\t * Defines whether the component is read-only.\n\t *\n\t * **Note:** A read-only component is not editable,\n\t * but still provides visual feedback upon user interaction.\n\t * @default false\n\t * @public\n\t * @since 2.0.0\n\t */\n\t@property({ type: Boolean })\n\treadonly = false;\n\n\t/**\n\t * Sets the maximum number of characters available in the input field.\n\t *\n\t * @default undefined\n\t * @since 2.0.0\n\t * @public\n\t */\n\t@property({ type: Number })\n\tmaxlength?: number;\n\n\t/**\n\t * Defines the value state of the component.\n\t * @default \"None\"\n\t * @since 2.0.0\n\t * @public\n\t */\n\t@property()\n\tvalueState: `${ValueState}` = \"None\"\n\n\t/**\n\t * Defines whether the component should show suggestions, if such are present.\n\t *\n\t * **Note:** You need to import the `InputSuggestions` module\n\t * from `\"@ui5/webcomponents/dist/features/InputSuggestions.js\"` to enable this functionality.\n\t * @default false\n\t * @public\n\t */\n\t@property({ type: Boolean })\n\tshowSuggestions = false;\n\n\t/**\n\t * Defines the suggestion items.\n\t *\n\t * **Note:** The suggestions would be displayed only if the `showSuggestions`\n\t * property is set to `true`.\n\t *\n\t * **Note:** The `<ui5-suggestion-item>`, `<ui5-suggestion-item-group>` and `ui5-suggestion-item-custom` are recommended to be used as suggestion items.\n\t *\n\t * **Note:** Importing the Input Suggestions Support feature:\n\t *\n\t * `import \"@ui5/webcomponents/dist/features/InputSuggestions.js\";`\n\t *\n\t * automatically imports the `<ui5-suggestion-item>` and `<ui5-suggestion-item-group>` for your convenience.\n\t * @public\n\t */\n\t\t@slot({ type: HTMLElement, \"default\": true })\n\t\tsuggestionItems!: Array<IInputSuggestionItem>;\n\n\t/**\n\t * Defines the value state message that will be displayed as pop up under the component.\n\t * The value state message slot should contain only one root element.\n\t *\n\t * **Note:** If not specified, a default text (in the respective language) will be displayed.\n\t *\n\t * **Note:** The `valueStateMessage` would be displayed,\n\t * when the component is in `Information`, `Critical` or `Negative` value state.\n\t *\n\t * @since 2.0.0\n\t * @public\n\t */\n\t@slot({\n\t\ttype: HTMLElement,\n\t\tinvalidateOnChildChange: true,\n\t})\n\tvalueStateMessage!: Array<HTMLElement>;\n\n\t@i18n(\"@ui5/webcomponents-ai\")\n\tstatic i18nBundle: I18nBundle;\n\n\t_onkeydown(e: KeyboardEvent) {\n\t\tif (isEnter(e)) {\n\t\t\tthis.fireDecoratorEvent(\"submit\");\n\t\t}\n\t}\n\n\t_onInnerInput(e: CustomEvent<InputEventDetail>) {\n\t\tthis.value = (e.target as Input).value;\n\n\t\tthis.fireDecoratorEvent(\"input\");\n\t}\n\n\t_onInnerChange() {\n\t\tthis.fireDecoratorEvent(\"change\");\n\t}\n\n\t_onButtonClick() {\n\t\tthis.fireDecoratorEvent(\"submit\");\n\t}\n\n\t_onTypeAhead(e: CustomEvent): void {\n\t\tthis.value = (e.target as Input).value;\n\t}\n\n\tget _exceededText() {\n\t\tif (this.showExceededText) {\n\t\t\tlet leftCharactersCount;\n\t\t\tconst maxLength = this.maxlength;\n\n\t\t\tif (maxLength !== undefined) {\n\t\t\t\tleftCharactersCount = maxLength - this.value.length;\n\n\t\t\t\tif (leftCharactersCount >= 0) {\n\t\t\t\t\treturn PromptInput.i18nBundle.getText(PROMPT_INPUT_CHARACTERS_LEFT, leftCharactersCount);\n\t\t\t\t}\n\n\t\t\t\treturn PromptInput.i18nBundle.getText(PROMPT_INPUT_CHARACTERS_EXCEEDED, Math.abs(leftCharactersCount));\n\t\t\t}\n\t\t}\n\t}\n\n\tget _maxLenght() {\n\t\treturn this.maxlength || undefined;\n\t}\n\n\tget _submitButtonDisabled() {\n\t\treturn (this.value.length <= 0) || this.disabled || this.readonly;\n\t}\n}\n\nPromptInput.define();\n\nexport default PromptInput;\n"]}
|
|
1
|
+
{"version":3,"file":"PromptInput.js","sourceRoot":"","sources":["../src/PromptInput.ts"],"names":[],"mappings":";;;;;;;AAAA,OAAO,UAAU,MAAM,4CAA4C,CAAC;AACpE,OAAO,aAAa,MAAM,0DAA0D,CAAC;AACrF,OAAO,QAAQ,MAAM,qDAAqD,CAAC;AAC3E,OAAO,KAAK,MAAM,yDAAyD,CAAC;AAC5E,OAAO,IAAI,MAAM,iDAAiD,CAAC;AACnE,OAAO,IAAI,MAAM,iDAAiD,CAAC;AACnE,OAAO,WAAW,MAAM,sDAAsD,CAAC;AAK/E,OAAO,EACN,OAAO,GACP,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EACN,4BAA4B,EAC5B,gCAAgC,GAChC,MAAM,mCAAmC,CAAC;AAE3C,OAAO,mBAAmB,MAAM,0BAA0B,CAAC;AAE3D,SAAS;AACT,OAAO,cAAc,MAAM,uCAAuC,CAAC;AAGnE;;;;;;;;;;;;;;;;GAgBG;AAwCH,IAAM,WAAW,mBAAjB,MAAM,WAAY,SAAQ,UAAU;IAApC;;QAMC;;;;;;WAMG;QAEH,UAAK,GAAG,EAAE,CAAC;QAsBX;;;;;WAKG;QAEH,kBAAa,GAAG,KAAK,CAAC;QAEtB;;;;;;;;;;;WAWG;QAEH,qBAAgB,GAAG,KAAK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CAAC;IAEF;;;;;;OAMG;;IACF,KAAK,CAAC,QAAQ,EAAE;QAChB,OAAO,EAAE,IAAI;KACb,CAAC;IAEF;;;;;;OAMG;;IACF,KAAK,CAAC,OAAO,EAAE;QACf,OAAO,EAAE,IAAI;KACb,CAAC;IAEF;;;;;;OAMG;;IACF,KAAK,CAAC,QAAQ,EAAE;QAChB,OAAO,EAAE,IAAI;KACb,CAAC;GACI,WAAW,CAiMhB;AAED,WAAW,CAAC,MAAM,EAAE,CAAC;AAErB,eAAe,WAAW,CAAC","sourcesContent":["import UI5Element from \"@ui5/webcomponents-base/dist/UI5Element.js\";\nimport customElement from \"@ui5/webcomponents-base/dist/decorators/customElement.js\";\nimport property from \"@ui5/webcomponents-base/dist/decorators/property.js\";\nimport event from \"@ui5/webcomponents-base/dist/decorators/event-strict.js\";\nimport slot from \"@ui5/webcomponents-base/dist/decorators/slot.js\";\nimport i18n from \"@ui5/webcomponents-base/dist/decorators/i18n.js\";\nimport jsxRenderer from \"@ui5/webcomponents-base/dist/renderer/JsxRenderer.js\";\nimport type I18nBundle from \"@ui5/webcomponents-base/dist/i18nBundle.js\";\nimport type ValueState from \"@ui5/webcomponents-base/dist/types/ValueState.js\";\nimport type { IInputSuggestionItem } from \"@ui5/webcomponents/dist/Input.js\";\nimport type Input from \"@ui5/webcomponents/dist/Input.js\";\nimport {\n\tisEnter,\n} from \"@ui5/webcomponents-base/dist/Keys.js\";\nimport {\n\tPROMPT_INPUT_CHARACTERS_LEFT,\n\tPROMPT_INPUT_CHARACTERS_EXCEEDED,\n} from \"./generated/i18n/i18n-defaults.js\";\n\nimport PromptInputTemplate from \"./PromptInputTemplate.js\";\n\n// Styles\nimport PromptInputCss from \"./generated/themes/PromptInput.css.js\";\nimport type { UI5CustomEvent } from \"@ui5/webcomponents-base/dist/index.js\";\n\n/**\n * @class\n * ### Overview\n *\n * The `ui5-ai-prompt-input` component allows the user to write custom instructions in natural language, so that AI is guided to generate content tailored to user needs.\n *\n * **Note:** The web component is in an experimental state\n *\n * ### ES6 Module Import\n *\n * `import \"@ui5/webcomponents-ai/dist/PromptInput.js\"`\n * @class\n * @constructor\n * @public\n * @extends UI5Element\n * @experimental The **@ui5/webcomponents-ai** package is under development and considered experimental - components' APIs are subject to change.\n */\n@customElement({\n\ttag: \"ui5-ai-prompt-input\",\n\trenderer: jsxRenderer,\n\tstyles: PromptInputCss,\n\ttemplate: PromptInputTemplate,\n})\n\n/**\n * Fired when the input operation has finished by pressing Enter\n * or AI button is clicked.\n *\n * @since 2.0.0\n * @public\n */\n@event(\"submit\", {\n\tbubbles: true,\n})\n\n/**\n * Fired when the value of the component changes at each keystroke,\n * and when a suggestion item has been selected.\n *\n * @since 2.0.0\n * @public\n */\n@event(\"input\", {\n\tbubbles: true,\n})\n\n/**\n * Fired when the input operation has finished by pressing Enter\n * or on focusout.\n *\n * @since 2.0.0\n * @public\n */\n@event(\"change\", {\n\tbubbles: true,\n})\nclass PromptInput extends UI5Element {\n\teventDetails!: {\n\t\tsubmit: void;\n\t\tinput: void;\n\t\tchange: void;\n\t}\n\t/**\n\t * Defines the value of the component.\n\t *\n\t * @default \"\"\n\t * @since 2.0.0\n\t * @public\n\t */\n\t@property()\n\tvalue = \"\";\n\n\t/**\n\t * Defines a short hint intended to aid the user with data entry when the\n\t * component has no value.\n\t * @default undefined\n\t * @since 2.0.0\n\t * @public\n\t */\n\t@property()\n\tplaceholder?: string;\n\n\t/**\n\t * Defines the label of the input field.\n\t *\n\t * @default undefined\n\t * @since 2.0.0\n\t * @public\n\t */\n\t@property()\n\tlabel?: string;\n\n\t/**\n\t * Defines whether the clear icon of the input will be shown.\n\t * @default false\n\t * @public\n\t * @since 2.0.0\n\t */\n\t@property({ type: Boolean })\n\tshowClearIcon = false;\n\n\t/**\n\t * Determines whether the characters exceeding the maximum allowed character count are visible\n\t * in the component.\n\t *\n\t * If set to `false`, the user is not allowed to enter more characters than what is set in the\n\t * `maxlength` property.\n\t * If set to `true` the characters exceeding the `maxlength` value are selected on\n\t * paste and the counter below the component displays their number.\n\t * @default false\n\t * @public\n\t * @since 2.0.0\n\t */\n\t@property({ type: Boolean })\n\tshowExceededText = false;\n\n\t/**\n\t * Defines whether the component is in disabled state.\n\t *\n\t * **Note:** A disabled component is completely noninteractive.\n\t * @default false\n\t * @public\n\t * @since 2.0.0\n\t */\n\t@property({ type: Boolean })\n\tdisabled = false;\n\n\t/**\n\t * Defines whether the component is read-only.\n\t *\n\t * **Note:** A read-only component is not editable,\n\t * but still provides visual feedback upon user interaction.\n\t * @default false\n\t * @public\n\t * @since 2.0.0\n\t */\n\t@property({ type: Boolean })\n\treadonly = false;\n\n\t/**\n\t * Sets the maximum number of characters available in the input field.\n\t *\n\t * @default undefined\n\t * @since 2.0.0\n\t * @public\n\t */\n\t@property({ type: Number })\n\tmaxlength?: number;\n\n\t/**\n\t * Defines the value state of the component.\n\t * @default \"None\"\n\t * @since 2.0.0\n\t * @public\n\t */\n\t@property()\n\tvalueState: `${ValueState}` = \"None\"\n\n\t/**\n\t * Defines whether the component should show suggestions, if such are present.\n\t *\n\t * @default false\n\t * @public\n\t */\n\t@property({ type: Boolean })\n\tshowSuggestions = false;\n\n\t/**\n\t * Defines the suggestion items.\n\t *\n\t * **Note:** The suggestions would be displayed only if the `showSuggestions`\n\t * property is set to `true`.\n\t *\n\t * **Note:** The `<ui5-suggestion-item>`, `<ui5-suggestion-item-group>` and `ui5-suggestion-item-custom` are recommended to be used as suggestion items.\n\t *\n\t * @public\n\t */\n\t\t@slot({ type: HTMLElement, \"default\": true })\n\t\tsuggestionItems!: Array<IInputSuggestionItem>;\n\n\t/**\n\t * Defines the value state message that will be displayed as pop up under the component.\n\t * The value state message slot should contain only one root element.\n\t *\n\t * **Note:** If not specified, a default text (in the respective language) will be displayed.\n\t *\n\t * **Note:** The `valueStateMessage` would be displayed,\n\t * when the component is in `Information`, `Critical` or `Negative` value state.\n\t *\n\t * @since 2.0.0\n\t * @public\n\t */\n\t@slot({\n\t\ttype: HTMLElement,\n\t\tinvalidateOnChildChange: true,\n\t})\n\tvalueStateMessage!: Array<HTMLElement>;\n\n\t@i18n(\"@ui5/webcomponents-ai\")\n\tstatic i18nBundle: I18nBundle;\n\n\t_onkeydown(e: KeyboardEvent) {\n\t\tif (isEnter(e)) {\n\t\t\tthis.fireDecoratorEvent(\"submit\");\n\t\t}\n\t}\n\n\t_onInnerInput(e: UI5CustomEvent<Input, \"input\">) {\n\t\tthis.value = e.currentTarget.value;\n\n\t\tthis.fireDecoratorEvent(\"input\");\n\t}\n\n\t_onInnerChange() {\n\t\tthis.fireDecoratorEvent(\"change\");\n\t}\n\n\t_onButtonClick() {\n\t\tthis.fireDecoratorEvent(\"submit\");\n\t}\n\n\t_onTypeAhead(e: UI5CustomEvent<Input, \"type-ahead\">): void {\n\t\tthis.value = e.currentTarget.value;\n\t}\n\n\tget _exceededText() {\n\t\tif (this.showExceededText) {\n\t\t\tlet leftCharactersCount;\n\t\t\tconst maxLength = this.maxlength;\n\n\t\t\tif (maxLength !== undefined) {\n\t\t\t\tleftCharactersCount = maxLength - this.value.length;\n\n\t\t\t\tif (leftCharactersCount >= 0) {\n\t\t\t\t\treturn PromptInput.i18nBundle.getText(PROMPT_INPUT_CHARACTERS_LEFT, leftCharactersCount);\n\t\t\t\t}\n\n\t\t\t\treturn PromptInput.i18nBundle.getText(PROMPT_INPUT_CHARACTERS_EXCEEDED, Math.abs(leftCharactersCount));\n\t\t\t}\n\t\t}\n\t}\n\n\tget _maxLenght() {\n\t\treturn this.maxlength || undefined;\n\t}\n\n\tget _submitButtonDisabled() {\n\t\treturn (this.value.length <= 0) || this.disabled || this.readonly;\n\t}\n}\n\nPromptInput.define();\n\nexport default PromptInput;\n"]}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { BaseTextArea } from "@ui5/webcomponents/dist/TextArea.js";
|
|
2
|
+
import type I18nBundle from "@ui5/webcomponents-base/dist/i18nBundle.js";
|
|
3
|
+
type TextAreaVersionChangeEventDetail = {
|
|
4
|
+
backwards: boolean;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* @class
|
|
8
|
+
*
|
|
9
|
+
* ### Overview
|
|
10
|
+
*
|
|
11
|
+
* The `ui5-ai-textarea` component extends the standard TextArea with Writing Assistant capabilities.
|
|
12
|
+
* It provides AI-powered text generation, editing suggestions, and version management functionality.
|
|
13
|
+
*
|
|
14
|
+
* ### Structure
|
|
15
|
+
* The `ui5-ai-textarea` consists of the following elements:
|
|
16
|
+
* - TextArea: The main text input area with all standard textarea functionality
|
|
17
|
+
* - WritingAssistant: Dedicated toolbar containing:
|
|
18
|
+
* - Versioning: A component with left/right navigation buttons and a label for browsing AI-generated versions
|
|
19
|
+
* - AI Button: Opens a menu that can be extended with custom AI generation options through slotting
|
|
20
|
+
*
|
|
21
|
+
* ### ES6 Module Import
|
|
22
|
+
*
|
|
23
|
+
* `import "@ui5/webcomponents-ai/dist/TextArea.js";`
|
|
24
|
+
*
|
|
25
|
+
* @constructor
|
|
26
|
+
* @extends BaseTextArea
|
|
27
|
+
* @experimental The **@ui5/webcomponents-ai** package is under development and considered experimental - components' APIs are subject to change.
|
|
28
|
+
* @since 2.16.0
|
|
29
|
+
* @public
|
|
30
|
+
* @slot {HTMLElement} menu Defines a slot for `ui5-menu` integration. This slot allows you to pass a `ui5-menu` instance that will be associated with the assistant.
|
|
31
|
+
*/
|
|
32
|
+
declare class TextArea extends BaseTextArea {
|
|
33
|
+
eventDetails: BaseTextArea["eventDetails"] & {
|
|
34
|
+
"version-change": TextAreaVersionChangeEventDetail;
|
|
35
|
+
"stop-generation": void;
|
|
36
|
+
};
|
|
37
|
+
private _keydownHandler?;
|
|
38
|
+
/**
|
|
39
|
+
* Defines whether the `ui5-ai-textarea` is currently in a loading(processing) state.
|
|
40
|
+
*
|
|
41
|
+
* @default false
|
|
42
|
+
* @public
|
|
43
|
+
*/
|
|
44
|
+
loading: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Defines the prompt description of the current action.
|
|
47
|
+
*
|
|
48
|
+
* @default ""
|
|
49
|
+
* @public
|
|
50
|
+
*/
|
|
51
|
+
promptDescription: string;
|
|
52
|
+
/**
|
|
53
|
+
* Indicates the index of the currently displayed version.
|
|
54
|
+
*
|
|
55
|
+
*
|
|
56
|
+
* @default 0
|
|
57
|
+
* @public
|
|
58
|
+
*/
|
|
59
|
+
currentVersion: number;
|
|
60
|
+
/**
|
|
61
|
+
* Indicates the total number of result versions available.
|
|
62
|
+
*
|
|
63
|
+
* Notes:
|
|
64
|
+
* Versioning is hidden if the value is `0`
|
|
65
|
+
*
|
|
66
|
+
* @default 0
|
|
67
|
+
* @public
|
|
68
|
+
*/
|
|
69
|
+
totalVersions: number;
|
|
70
|
+
menu: Array<HTMLElement>;
|
|
71
|
+
static i18nBundle: I18nBundle;
|
|
72
|
+
static onDefine(): Promise<void>;
|
|
73
|
+
/**
|
|
74
|
+
* Handles the click event for the "Previous Version" button.
|
|
75
|
+
* Updates the current version index and syncs content.
|
|
76
|
+
*/
|
|
77
|
+
_handlePreviousVersionClick(): void;
|
|
78
|
+
/**
|
|
79
|
+
* Handles the click event for the "Next Version" button.
|
|
80
|
+
* Updates the current version index and syncs content.
|
|
81
|
+
*/
|
|
82
|
+
_handleNextVersionClick(): void;
|
|
83
|
+
/**
|
|
84
|
+
* Handles the version change event from the writing assistant.
|
|
85
|
+
*/
|
|
86
|
+
_handleVersionChange(e: CustomEvent<{
|
|
87
|
+
backwards: boolean;
|
|
88
|
+
}>): void;
|
|
89
|
+
/**
|
|
90
|
+
* Handles keydown events for keyboard shortcuts.
|
|
91
|
+
* @private
|
|
92
|
+
*/
|
|
93
|
+
_handleKeydown(keyboardEvent: KeyboardEvent): void;
|
|
94
|
+
/**
|
|
95
|
+
* Overrides the parent's onAfterRendering to add keydown handler.
|
|
96
|
+
* @private
|
|
97
|
+
*/
|
|
98
|
+
onAfterRendering(): void;
|
|
99
|
+
/**
|
|
100
|
+
* Handles the generate click event from the AI toolbar.
|
|
101
|
+
* Opens the AI menu and sets the opener element.
|
|
102
|
+
*
|
|
103
|
+
* @private
|
|
104
|
+
*/
|
|
105
|
+
_handleAIButtonClick: (e: CustomEvent<{
|
|
106
|
+
clickTarget?: HTMLElement;
|
|
107
|
+
}>) => void;
|
|
108
|
+
get _ariaLabel(): string;
|
|
109
|
+
/**
|
|
110
|
+
* Handles the stop generation event from the AI toolbar.
|
|
111
|
+
* Fires the stop-generation event to notify listeners.
|
|
112
|
+
*
|
|
113
|
+
* @private
|
|
114
|
+
*/
|
|
115
|
+
handleStopGeneration: () => void;
|
|
116
|
+
}
|
|
117
|
+
export type { TextAreaVersionChangeEventDetail };
|
|
118
|
+
export default TextArea;
|
package/dist/TextArea.js
ADDED
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var TextArea_1;
|
|
8
|
+
import customElement from "@ui5/webcomponents-base/dist/decorators/customElement.js";
|
|
9
|
+
import property from "@ui5/webcomponents-base/dist/decorators/property.js";
|
|
10
|
+
import slot from "@ui5/webcomponents-base/dist/decorators/slot.js";
|
|
11
|
+
import event from "@ui5/webcomponents-base/dist/decorators/event-strict.js";
|
|
12
|
+
import jsxRenderer from "@ui5/webcomponents-base/dist/renderer/JsxRenderer.js";
|
|
13
|
+
import { BaseTextArea } from "@ui5/webcomponents/dist/TextArea.js";
|
|
14
|
+
import { getI18nBundle } from "@ui5/webcomponents-base/dist/i18nBundle.js";
|
|
15
|
+
import { WRITING_ASSISTANT_LABEL, } from "./generated/i18n/i18n-defaults.js";
|
|
16
|
+
// Styles
|
|
17
|
+
import TextAreaCss from "./generated/themes/TextArea.css.js";
|
|
18
|
+
import textareaStyles from "@ui5/webcomponents/dist/generated/themes/TextArea.css.js";
|
|
19
|
+
import valueStateMessageStyles from "@ui5/webcomponents/dist/generated/themes/ValueStateMessage.css.js";
|
|
20
|
+
// Templates
|
|
21
|
+
import TextAreaTemplate from "./TextAreaTemplate.js";
|
|
22
|
+
/**
|
|
23
|
+
* @class
|
|
24
|
+
*
|
|
25
|
+
* ### Overview
|
|
26
|
+
*
|
|
27
|
+
* The `ui5-ai-textarea` component extends the standard TextArea with Writing Assistant capabilities.
|
|
28
|
+
* It provides AI-powered text generation, editing suggestions, and version management functionality.
|
|
29
|
+
*
|
|
30
|
+
* ### Structure
|
|
31
|
+
* The `ui5-ai-textarea` consists of the following elements:
|
|
32
|
+
* - TextArea: The main text input area with all standard textarea functionality
|
|
33
|
+
* - WritingAssistant: Dedicated toolbar containing:
|
|
34
|
+
* - Versioning: A component with left/right navigation buttons and a label for browsing AI-generated versions
|
|
35
|
+
* - AI Button: Opens a menu that can be extended with custom AI generation options through slotting
|
|
36
|
+
*
|
|
37
|
+
* ### ES6 Module Import
|
|
38
|
+
*
|
|
39
|
+
* `import "@ui5/webcomponents-ai/dist/TextArea.js";`
|
|
40
|
+
*
|
|
41
|
+
* @constructor
|
|
42
|
+
* @extends BaseTextArea
|
|
43
|
+
* @experimental The **@ui5/webcomponents-ai** package is under development and considered experimental - components' APIs are subject to change.
|
|
44
|
+
* @since 2.16.0
|
|
45
|
+
* @public
|
|
46
|
+
* @slot {HTMLElement} menu Defines a slot for `ui5-menu` integration. This slot allows you to pass a `ui5-menu` instance that will be associated with the assistant.
|
|
47
|
+
*/
|
|
48
|
+
let TextArea = TextArea_1 = class TextArea extends BaseTextArea {
|
|
49
|
+
constructor() {
|
|
50
|
+
super(...arguments);
|
|
51
|
+
/**
|
|
52
|
+
* Defines whether the `ui5-ai-textarea` is currently in a loading(processing) state.
|
|
53
|
+
*
|
|
54
|
+
* @default false
|
|
55
|
+
* @public
|
|
56
|
+
*/
|
|
57
|
+
this.loading = false;
|
|
58
|
+
/**
|
|
59
|
+
* Defines the prompt description of the current action.
|
|
60
|
+
*
|
|
61
|
+
* @default ""
|
|
62
|
+
* @public
|
|
63
|
+
*/
|
|
64
|
+
this.promptDescription = "";
|
|
65
|
+
/**
|
|
66
|
+
* Indicates the index of the currently displayed version.
|
|
67
|
+
*
|
|
68
|
+
*
|
|
69
|
+
* @default 0
|
|
70
|
+
* @public
|
|
71
|
+
*/
|
|
72
|
+
this.currentVersion = 0;
|
|
73
|
+
/**
|
|
74
|
+
* Indicates the total number of result versions available.
|
|
75
|
+
*
|
|
76
|
+
* Notes:
|
|
77
|
+
* Versioning is hidden if the value is `0`
|
|
78
|
+
*
|
|
79
|
+
* @default 0
|
|
80
|
+
* @public
|
|
81
|
+
*/
|
|
82
|
+
this.totalVersions = 0;
|
|
83
|
+
/**
|
|
84
|
+
* Handles the generate click event from the AI toolbar.
|
|
85
|
+
* Opens the AI menu and sets the opener element.
|
|
86
|
+
*
|
|
87
|
+
* @private
|
|
88
|
+
*/
|
|
89
|
+
this._handleAIButtonClick = (e) => {
|
|
90
|
+
const menuNodes = this.getSlottedNodes("menu");
|
|
91
|
+
if (menuNodes.length === 0) {
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
if (!e.detail?.clickTarget) {
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
const menu = menuNodes[0];
|
|
98
|
+
if (menu && typeof menu.open !== "undefined") {
|
|
99
|
+
menu.opener = e.detail.clickTarget;
|
|
100
|
+
menu.open = true;
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
/**
|
|
104
|
+
* Handles the stop generation event from the AI toolbar.
|
|
105
|
+
* Fires the stop-generation event to notify listeners.
|
|
106
|
+
*
|
|
107
|
+
* @private
|
|
108
|
+
*/
|
|
109
|
+
this.handleStopGeneration = () => {
|
|
110
|
+
this.fireDecoratorEvent("stop-generation");
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
static async onDefine() {
|
|
114
|
+
TextArea_1.i18nBundle = await getI18nBundle("@ui5/webcomponents-ai");
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Handles the click event for the "Previous Version" button.
|
|
118
|
+
* Updates the current version index and syncs content.
|
|
119
|
+
*/
|
|
120
|
+
_handlePreviousVersionClick() {
|
|
121
|
+
this.fireDecoratorEvent("version-change", { backwards: true });
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Handles the click event for the "Next Version" button.
|
|
125
|
+
* Updates the current version index and syncs content.
|
|
126
|
+
*/
|
|
127
|
+
_handleNextVersionClick() {
|
|
128
|
+
this.fireDecoratorEvent("version-change", { backwards: false });
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Handles the version change event from the writing assistant.
|
|
132
|
+
*/
|
|
133
|
+
_handleVersionChange(e) {
|
|
134
|
+
if (e.detail.backwards) {
|
|
135
|
+
this._handlePreviousVersionClick();
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
this._handleNextVersionClick();
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Handles keydown events for keyboard shortcuts.
|
|
143
|
+
* @private
|
|
144
|
+
*/
|
|
145
|
+
_handleKeydown(keyboardEvent) {
|
|
146
|
+
const isCtrlOrCmd = keyboardEvent.ctrlKey || keyboardEvent.metaKey;
|
|
147
|
+
const isShift = keyboardEvent.shiftKey;
|
|
148
|
+
if (isShift && keyboardEvent.key.toLowerCase() === "f4") {
|
|
149
|
+
const toolbar = this.shadowRoot?.querySelector("[ui5-ai-writing-assistant]");
|
|
150
|
+
const aiButton = toolbar?.shadowRoot?.querySelector("#ai-menu-btn");
|
|
151
|
+
if (aiButton) {
|
|
152
|
+
aiButton.focus();
|
|
153
|
+
}
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
if (this.totalVersions > 1) {
|
|
157
|
+
if (isCtrlOrCmd && isShift && keyboardEvent.key.toLowerCase() === "z") {
|
|
158
|
+
keyboardEvent.preventDefault();
|
|
159
|
+
this._handlePreviousVersionClick();
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
if (isCtrlOrCmd && isShift && keyboardEvent.key.toLowerCase() === "y") {
|
|
163
|
+
keyboardEvent.preventDefault();
|
|
164
|
+
this._handleNextVersionClick();
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Overrides the parent's onAfterRendering to add keydown handler.
|
|
170
|
+
* @private
|
|
171
|
+
*/
|
|
172
|
+
onAfterRendering() {
|
|
173
|
+
super.onAfterRendering();
|
|
174
|
+
// Add keydown event listener to the textarea
|
|
175
|
+
const textarea = this.shadowRoot?.querySelector("textarea");
|
|
176
|
+
if (textarea && !this._keydownHandler) {
|
|
177
|
+
this._keydownHandler = this._handleKeydown.bind(this);
|
|
178
|
+
textarea.addEventListener("keydown", this._keydownHandler);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
get _ariaLabel() {
|
|
182
|
+
return this.accessibleName || TextArea_1.i18nBundle.getText(WRITING_ASSISTANT_LABEL);
|
|
183
|
+
}
|
|
184
|
+
};
|
|
185
|
+
__decorate([
|
|
186
|
+
property({ type: Boolean })
|
|
187
|
+
], TextArea.prototype, "loading", void 0);
|
|
188
|
+
__decorate([
|
|
189
|
+
property()
|
|
190
|
+
], TextArea.prototype, "promptDescription", void 0);
|
|
191
|
+
__decorate([
|
|
192
|
+
property({ type: Number })
|
|
193
|
+
], TextArea.prototype, "currentVersion", void 0);
|
|
194
|
+
__decorate([
|
|
195
|
+
property({ type: Number })
|
|
196
|
+
], TextArea.prototype, "totalVersions", void 0);
|
|
197
|
+
__decorate([
|
|
198
|
+
slot({ type: HTMLElement })
|
|
199
|
+
], TextArea.prototype, "menu", void 0);
|
|
200
|
+
TextArea = TextArea_1 = __decorate([
|
|
201
|
+
customElement({
|
|
202
|
+
tag: "ui5-ai-textarea",
|
|
203
|
+
languageAware: true,
|
|
204
|
+
renderer: jsxRenderer,
|
|
205
|
+
template: TextAreaTemplate,
|
|
206
|
+
styles: [
|
|
207
|
+
textareaStyles,
|
|
208
|
+
valueStateMessageStyles,
|
|
209
|
+
TextAreaCss,
|
|
210
|
+
],
|
|
211
|
+
})
|
|
212
|
+
/**
|
|
213
|
+
* Fired when the user clicks on version navigation buttons.
|
|
214
|
+
*
|
|
215
|
+
* @param {boolean} backwards - Indicates if navigation is backwards (true) or forwards (false, default).
|
|
216
|
+
* @public
|
|
217
|
+
*/
|
|
218
|
+
,
|
|
219
|
+
event("version-change")
|
|
220
|
+
/**
|
|
221
|
+
* Fired when the user requests to stop AI text generation.
|
|
222
|
+
*
|
|
223
|
+
* @public
|
|
224
|
+
*/
|
|
225
|
+
,
|
|
226
|
+
event("stop-generation")
|
|
227
|
+
], TextArea);
|
|
228
|
+
TextArea.define();
|
|
229
|
+
export default TextArea;
|
|
230
|
+
//# sourceMappingURL=TextArea.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextArea.js","sourceRoot":"","sources":["../src/TextArea.ts"],"names":[],"mappings":";;;;;;;AAAA,OAAO,aAAa,MAAM,0DAA0D,CAAC;AACrF,OAAO,QAAQ,MAAM,qDAAqD,CAAC;AAC3E,OAAO,IAAI,MAAM,iDAAiD,CAAC;AACnE,OAAO,KAAK,MAAM,yDAAyD,CAAC;AAC5E,OAAO,WAAW,MAAM,sDAAsD,CAAC;AAE/E,OAAO,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,4CAA4C,CAAC;AAE3E,OAAO,EACN,uBAAuB,GACvB,MAAM,mCAAmC,CAAC;AAC3C,SAAS;AACT,OAAO,WAAW,MAAM,oCAAoC,CAAC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E;YACP,cAAc;YACd,uBAAuB;YACvB,WAAW;SACX;KACD,CAAC;IAEF;;;;;OAKG;;IACF,KAAK,CAAC,gBAAgB,CAAC;IAExB;;;;OAIG;;IACF,KAAK,CAAC,iBAAiB,CAAC;GAEnB,QAAQ,CAsKb;AAED,QAAQ,CAAC,MAAM,EAAE,CAAC;AAGlB,eAAe,QAAQ,CAAC","sourcesContent":["import customElement from \"@ui5/webcomponents-base/dist/decorators/customElement.js\";\nimport property from \"@ui5/webcomponents-base/dist/decorators/property.js\";\nimport slot from \"@ui5/webcomponents-base/dist/decorators/slot.js\";\nimport event from \"@ui5/webcomponents-base/dist/decorators/event-strict.js\";\nimport jsxRenderer from \"@ui5/webcomponents-base/dist/renderer/JsxRenderer.js\";\n\nimport { BaseTextArea } from \"@ui5/webcomponents/dist/TextArea.js\";\nimport { getI18nBundle } from \"@ui5/webcomponents-base/dist/i18nBundle.js\";\nimport type I18nBundle from \"@ui5/webcomponents-base/dist/i18nBundle.js\";\nimport {\n\tWRITING_ASSISTANT_LABEL,\n} from \"./generated/i18n/i18n-defaults.js\";\n// Styles\nimport TextAreaCss from \"./generated/themes/TextArea.css.js\";\nimport textareaStyles from \"@ui5/webcomponents/dist/generated/themes/TextArea.css.js\";\nimport valueStateMessageStyles from \"@ui5/webcomponents/dist/generated/themes/ValueStateMessage.css.js\";\n\n// Templates\nimport TextAreaTemplate from \"./TextAreaTemplate.js\";\n\ntype TextAreaVersionChangeEventDetail = {\n\tbackwards: boolean,\n};\n\n/**\n * @class\n *\n * ### Overview\n *\n * The `ui5-ai-textarea` component extends the standard TextArea with Writing Assistant capabilities.\n * It provides AI-powered text generation, editing suggestions, and version management functionality.\n *\n * ### Structure\n * The `ui5-ai-textarea` consists of the following elements:\n * - TextArea: The main text input area with all standard textarea functionality\n * - WritingAssistant: Dedicated toolbar containing:\n * - Versioning: A component with left/right navigation buttons and a label for browsing AI-generated versions\n * - AI Button: Opens a menu that can be extended with custom AI generation options through slotting\n *\n * ### ES6 Module Import\n *\n * `import \"@ui5/webcomponents-ai/dist/TextArea.js\";`\n *\n * @constructor\n * @extends BaseTextArea\n * @experimental The **@ui5/webcomponents-ai** package is under development and considered experimental - components' APIs are subject to change.\n * @since 2.16.0\n * @public\n * @slot {HTMLElement} menu Defines a slot for `ui5-menu` integration. This slot allows you to pass a `ui5-menu` instance that will be associated with the assistant.\n */\n@customElement({\n\ttag: \"ui5-ai-textarea\",\n\tlanguageAware: true,\n\trenderer: jsxRenderer,\n\ttemplate: TextAreaTemplate,\n\tstyles: [\n\t\ttextareaStyles,\n\t\tvalueStateMessageStyles,\n\t\tTextAreaCss,\n\t],\n})\n\n/**\n * Fired when the user clicks on version navigation buttons.\n *\n * @param {boolean} backwards - Indicates if navigation is backwards (true) or forwards (false, default).\n * @public\n */\n@event(\"version-change\")\n\n/**\n * Fired when the user requests to stop AI text generation.\n *\n * @public\n */\n@event(\"stop-generation\")\n\nclass TextArea extends BaseTextArea {\n\teventDetails!: BaseTextArea[\"eventDetails\"] & {\n\t\t\"version-change\": TextAreaVersionChangeEventDetail;\n\t\t\"stop-generation\": void;\n\t};\n\n\t// Store bound handler for proper cleanup\n\tprivate _keydownHandler?: (event: KeyboardEvent) => void;\n\n\t/**\n\t * Defines whether the `ui5-ai-textarea` is currently in a loading(processing) state.\n\t *\n\t * @default false\n\t * @public\n\t */\n\t@property({ type: Boolean })\n\tloading = false;\n\n\t/**\n\t * Defines the prompt description of the current action.\n\t *\n\t * @default \"\"\n\t * @public\n\t */\n\t@property()\n\tpromptDescription = \"\";\n\n\t/**\n\t * Indicates the index of the currently displayed version.\n\t *\n\t *\n\t * @default 0\n\t * @public\n\t */\n\t@property({ type: Number })\n\tcurrentVersion = 0;\n\n\t/**\n\t * Indicates the total number of result versions available.\n\t *\n\t * Notes:\n\t * Versioning is hidden if the value is `0`\n\t *\n\t * @default 0\n\t * @public\n\t */\n\t@property({ type: Number })\n\ttotalVersions = 0;\n\n\t@slot({ type: HTMLElement })\n\tmenu!: Array<HTMLElement>;\n\n\tstatic i18nBundle: I18nBundle;\n\n\tstatic async onDefine() {\n\t\tTextArea.i18nBundle = await getI18nBundle(\"@ui5/webcomponents-ai\");\n\t}\n\n\t/**\n\t * Handles the click event for the \"Previous Version\" button.\n\t * Updates the current version index and syncs content.\n\t */\n\t_handlePreviousVersionClick(): void {\n\t\tthis.fireDecoratorEvent(\"version-change\", { backwards: true });\n\t}\n\n\t/**\n\t * Handles the click event for the \"Next Version\" button.\n\t * Updates the current version index and syncs content.\n\t */\n\t_handleNextVersionClick(): void {\n\t\tthis.fireDecoratorEvent(\"version-change\", { backwards: false });\n\t}\n\n\t/**\n\t * Handles the version change event from the writing assistant.\n\t */\n\t_handleVersionChange(e: CustomEvent<{ backwards: boolean }>): void {\n\t\tif (e.detail.backwards) {\n\t\t\tthis._handlePreviousVersionClick();\n\t\t} else {\n\t\t\tthis._handleNextVersionClick();\n\t\t}\n\t}\n\n\t/**\n\t * Handles keydown events for keyboard shortcuts.\n\t * @private\n\t */\n\t_handleKeydown(keyboardEvent: KeyboardEvent) {\n\t\tconst isCtrlOrCmd = keyboardEvent.ctrlKey || keyboardEvent.metaKey;\n\t\tconst isShift = keyboardEvent.shiftKey;\n\n\t\tif (isShift && keyboardEvent.key.toLowerCase() === \"f4\") {\n\t\t\tconst toolbar = this.shadowRoot?.querySelector(\"[ui5-ai-writing-assistant]\") as HTMLElement;\n\t\t\tconst aiButton = toolbar?.shadowRoot?.querySelector(\"#ai-menu-btn\") as HTMLElement;\n\n\t\t\tif (aiButton) {\n\t\t\t\taiButton.focus();\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\tif (this.totalVersions > 1) {\n\t\t\tif (isCtrlOrCmd && isShift && keyboardEvent.key.toLowerCase() === \"z\") {\n\t\t\t\tkeyboardEvent.preventDefault();\n\t\t\t\tthis._handlePreviousVersionClick();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (isCtrlOrCmd && isShift && keyboardEvent.key.toLowerCase() === \"y\") {\n\t\t\t\tkeyboardEvent.preventDefault();\n\t\t\t\tthis._handleNextVersionClick();\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Overrides the parent's onAfterRendering to add keydown handler.\n\t * @private\n\t */\n\tonAfterRendering() {\n\t\tsuper.onAfterRendering();\n\n\t\t// Add keydown event listener to the textarea\n\t\tconst textarea = this.shadowRoot?.querySelector(\"textarea\");\n\t\tif (textarea && !this._keydownHandler) {\n\t\t\tthis._keydownHandler = this._handleKeydown.bind(this);\n\t\t\ttextarea.addEventListener(\"keydown\", this._keydownHandler);\n\t\t}\n\t}\n\n\t/**\n\t * Handles the generate click event from the AI toolbar.\n\t * Opens the AI menu and sets the opener element.\n\t *\n\t * @private\n\t */\n\t_handleAIButtonClick = (e: CustomEvent<{ clickTarget?: HTMLElement }>) => {\n\t\tconst menuNodes = this.getSlottedNodes(\"menu\");\n\t\tif (menuNodes.length === 0) {\n\t\t\treturn;\n\t\t}\n\t\tif (!e.detail?.clickTarget) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst menu = menuNodes[0] as HTMLElement & { opener?: HTMLElement; open?: boolean };\n\t\tif (menu && typeof menu.open !== \"undefined\") {\n\t\t\tmenu.opener = e.detail.clickTarget;\n\t\t\tmenu.open = true;\n\t\t}\n\t}\n\tget _ariaLabel() {\n\t\treturn this.accessibleName || TextArea.i18nBundle.getText(WRITING_ASSISTANT_LABEL);\n\t}\n\n\t/**\n\t * Handles the stop generation event from the AI toolbar.\n\t * Fires the stop-generation event to notify listeners.\n\t *\n\t * @private\n\t */\n\thandleStopGeneration = () => {\n\t\tthis.fireDecoratorEvent(\"stop-generation\");\n\t}\n}\n\nTextArea.define();\n\nexport type { TextAreaVersionChangeEventDetail };\nexport default TextArea;\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "@ui5/webcomponents-base/jsx-runtime";
|
|
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
|
+
export default function TextAreaTemplate() {
|
|
6
|
+
return (_jsxs("div", { class: "ui5-ai-textarea-root", children: [_jsxs("div", { class: this.classes.root, onFocusIn: this._onfocusin, onFocusOut: this._onfocusout, children: [_jsxs("div", { class: "ui5-textarea-wrapper", children: [this.growing &&
|
|
7
|
+
_jsx("div", { id: `${this._id}-mirror`, class: "ui5-textarea-mirror", "aria-hidden": "true", children: this._mirrorText.map(mirrorText => {
|
|
8
|
+
return (_jsxs(_Fragment, { children: [mirrorText.text, _jsx("br", {})] }));
|
|
9
|
+
}) }), _jsx(BusyIndicator, { id: `${this._id}-busyIndicator`, active: this.loading, class: "ui5-textarea-busy-indicator", children: _jsx("textarea", { id: `${this._id}-inner`, class: "ui5-textarea-inner", part: "textarea", placeholder: this.placeholder, disabled: this.disabled, readonly: this.readonly, "aria-label": this._ariaLabel, "aria-describedby": this.ariaDescribedBy, "aria-invalid": this._ariaInvalid, "aria-required": this.required, maxlength: this._exceededTextProps.calcedMaxLength, value: this.value, "data-sap-focus-ref": true, onInput: this._oninput, onChange: this._onchange, onKeyUp: this._onkeyup, onKeyDown: this._onkeydown, onSelect: this._onselect, onScroll: this._onscroll }) }), _jsx("div", { part: "footer", children: _jsx("slot", { name: "footer", children: _jsx(WritingAssistant, { loading: this.loading, currentVersion: this.currentVersion, totalVersions: this.totalVersions, promptDescription: this.promptDescription, onButtonClick: this._handleAIButtonClick, onStopGeneration: this.handleStopGeneration, onVersionChange: this._handleVersionChange }) }) })] }), this.showExceededText &&
|
|
10
|
+
_jsx("span", { class: "ui5-textarea-exceeded-text", children: this._exceededTextProps.exceededText }), this.hasValueState &&
|
|
11
|
+
_jsx("span", { id: `${this._id}-valueStateDesc`, class: "ui5-hidden-text", children: this.ariaValueStateHiddenText })] }), TextAreaPopoverTemplate.call(this), _jsx("div", { "aria-live": "polite", "aria-atomic": "true", class: "ui5-hidden-text", children: this.loading ? this.promptDescription : "" }), _jsx("div", { id: "ai-menu-wrapper", children: _jsx("slot", { name: "menu" }) })] }));
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=TextAreaTemplate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextAreaTemplate.js","sourceRoot":"","sources":["../src/TextAreaTemplate.tsx"],"names":[],"mappings":";AACA,OAAO,gBAAgB,MAAM,uBAAuB,CAAC;AACrD,OAAO,aAAa,MAAM,0CAA0C,CAAC;AACrE,OAAO,uBAAuB,MAAM,oDAAoD,CAAC;AAEzF,MAAM,CAAC,OAAO,UAAU,gBAAgB;IACvC,OAAO,CACN,eAAK,KAAK,EAAC,sBAAsB,aAChC,eACC,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,EACxB,SAAS,EAAE,IAAI,CAAC,UAAU,EAC1B,UAAU,EAAE,IAAI,CAAC,WAAW,aAE5B,eAAK,KAAK,EAAC,sBAAsB,aAC/B,IAAI,CAAC,OAAO;gCACb,cAAK,EAAE,EAAE,GAAG,IAAI,CAAC,GAAG,SAAS,EAAE,KAAK,EAAC,qBAAqB,iBAAa,MAAM,YAC3E,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE;wCAClC,OAAO,CACN,8BACE,UAAU,CAAC,IAAI,EAChB,cAAM,IACJ,CACH,CAAC;oCACH,CAAC,CAAC,GACG,EAEN,KAAC,aAAa,IACb,EAAE,EAAE,GAAG,IAAI,CAAC,GAAG,gBAAgB,EAC/B,MAAM,EAAE,IAAI,CAAC,OAAO,EACpB,KAAK,EAAC,6BAA6B,YAEnC,mBACC,EAAE,EAAE,GAAG,IAAI,CAAC,GAAG,QAAQ,EACvB,KAAK,EAAC,oBAAoB,EAC1B,IAAI,EAAC,UAAU,EACf,WAAW,EAAE,IAAI,CAAC,WAAW,EAC7B,QAAQ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AI,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,CAAC,EAAE,GACtC,EAEN,cAAK,EAAE,EAAC,iBAAiB,YACxB,eAAM,IAAI,EAAC,MAAM,GAAQ,GACpB,IACD,CACN,CAAC;AACH,CAAC","sourcesContent":["import type TextArea from \"./TextArea.js\";\nimport WritingAssistant from \"./WritingAssistant.js\";\nimport BusyIndicator from \"@ui5/webcomponents/dist/BusyIndicator.js\";\nimport TextAreaPopoverTemplate from \"@ui5/webcomponents/dist/TextAreaPopoverTemplate.js\";\n\nexport default function TextAreaTemplate(this: TextArea) {\n\treturn (\n\t\t<div class=\"ui5-ai-textarea-root\">\n\t\t\t<div\n\t\t\t\tclass={this.classes.root}\n\t\t\t\tonFocusIn={this._onfocusin}\n\t\t\t\tonFocusOut={this._onfocusout}\n\t\t\t>\n\t\t\t\t<div class=\"ui5-textarea-wrapper\">\n\t\t\t\t\t{this.growing &&\n\t\t\t\t\t<div id={`${this._id}-mirror`} class=\"ui5-textarea-mirror\" aria-hidden=\"true\">\n\t\t\t\t\t\t{this._mirrorText.map(mirrorText => {\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t{mirrorText.text}\n\t\t\t\t\t\t\t\t\t<br />\n\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t})}\n\t\t\t\t\t</div>\n\t\t\t\t\t}\n\t\t\t\t\t<BusyIndicator\n\t\t\t\t\t\tid={`${this._id}-busyIndicator`}\n\t\t\t\t\t\tactive={this.loading}\n\t\t\t\t\t\tclass=\"ui5-textarea-busy-indicator\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<textarea\n\t\t\t\t\t\t\tid={`${this._id}-inner`}\n\t\t\t\t\t\t\tclass=\"ui5-textarea-inner\"\n\t\t\t\t\t\t\tpart=\"textarea\"\n\t\t\t\t\t\t\tplaceholder={this.placeholder}\n\t\t\t\t\t\t\tdisabled={this.disabled}\n\t\t\t\t\t\t\treadonly={this.readonly}\n\t\t\t\t\t\t\taria-label={this._ariaLabel}\n\t\t\t\t\t\t\taria-describedby={this.ariaDescribedBy}\n\t\t\t\t\t\t\taria-invalid={this._ariaInvalid}\n\t\t\t\t\t\t\taria-required={this.required}\n\t\t\t\t\t\t\tmaxlength={this._exceededTextProps.calcedMaxLength}\n\t\t\t\t\t\t\tvalue={this.value}\n\t\t\t\t\t\t\tdata-sap-focus-ref\n\t\t\t\t\t\t\tonInput={this._oninput}\n\t\t\t\t\t\t\tonChange={this._onchange}\n\t\t\t\t\t\t\tonKeyUp={this._onkeyup}\n\t\t\t\t\t\t\tonKeyDown={this._onkeydown}\n\t\t\t\t\t\t\tonSelect={this._onselect}\n\t\t\t\t\t\t\tonScroll={this._onscroll}>\n\t\t\t\t\t\t</textarea>\n\t\t\t\t\t</BusyIndicator>\n\t\t\t\t\t<div part=\"footer\">\n\t\t\t\t\t\t<slot name=\"footer\">\n\t\t\t\t\t\t\t<WritingAssistant\n\t\t\t\t\t\t\t\tloading={this.loading}\n\t\t\t\t\t\t\t\tcurrentVersion={this.currentVersion}\n\t\t\t\t\t\t\t\ttotalVersions={this.totalVersions}\n\t\t\t\t\t\t\t\tpromptDescription={this.promptDescription}\n\t\t\t\t\t\t\t\tonButtonClick={this._handleAIButtonClick}\n\t\t\t\t\t\t\t\tonStopGeneration={this.handleStopGeneration}\n\t\t\t\t\t\t\t\tonVersionChange={this._handleVersionChange}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</slot>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\n\t\t\t\t{this.showExceededText &&\n\t\t\t\t<span class=\"ui5-textarea-exceeded-text\">{this._exceededTextProps.exceededText}</span>\n\t\t\t\t}\n\n\t\t\t\t{this.hasValueState &&\n\t\t\t\t<span id={`${this._id}-valueStateDesc`} class=\"ui5-hidden-text\">{this.ariaValueStateHiddenText}</span>\n\t\t\t\t}\n\t\t\t</div>\n\n\t\t\t{TextAreaPopoverTemplate.call(this)}\n\n\t\t\t{/* ARIA live region for screen readers */}\n\t\t\t<div aria-live=\"polite\" aria-atomic=\"true\" class=\"ui5-hidden-text\">\n\t\t\t\t{this.loading ? this.promptDescription : \"\"}\n\t\t\t</div>\n\n\t\t\t<div id=\"ai-menu-wrapper\">\n\t\t\t\t<slot name=\"menu\"></slot>\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n"]}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import ToolbarItem from "@ui5/webcomponents/dist/ToolbarItem.js";
|
|
2
|
+
/**
|
|
3
|
+
* @class
|
|
4
|
+
*
|
|
5
|
+
* ### Overview
|
|
6
|
+
* The `ui5-ai-toolbar-label` represents a text label,
|
|
7
|
+
* used in the `ui5-toolbar`.
|
|
8
|
+
*
|
|
9
|
+
* ### ES6 Module Import
|
|
10
|
+
* `import "@ui5/webcomponents-ai/dist/ToolbarLabel.js";`
|
|
11
|
+
* @constructor
|
|
12
|
+
* @extends ToolbarItem
|
|
13
|
+
* @private
|
|
14
|
+
* @since 1.0.0-rc.1
|
|
15
|
+
*/
|
|
16
|
+
declare class ToolbarLabel extends ToolbarItem {
|
|
17
|
+
/**
|
|
18
|
+
* Defines the text of the label.
|
|
19
|
+
* @default ""
|
|
20
|
+
* @public
|
|
21
|
+
*/
|
|
22
|
+
text: string;
|
|
23
|
+
/**
|
|
24
|
+
* @override
|
|
25
|
+
* ToolbarLabel is not interactive.
|
|
26
|
+
*/
|
|
27
|
+
get isInteractive(): boolean;
|
|
28
|
+
/**
|
|
29
|
+
* @override
|
|
30
|
+
*/
|
|
31
|
+
get classes(): {
|
|
32
|
+
root: {
|
|
33
|
+
"ui5-ai-tb-label": boolean;
|
|
34
|
+
"ui5-tb-popover-item": boolean;
|
|
35
|
+
"ui5-tb-item": boolean;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
export default ToolbarLabel;
|