@ui5/webcomponents-ai 2.16.0-rc.2 → 2.16.0-rc.3
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 +11 -0
- package/dist/.tsbuildinfo +1 -1
- package/dist/TextArea.d.ts +20 -19
- package/dist/TextArea.js +33 -32
- package/dist/TextArea.js.map +1 -1
- package/dist/TextAreaTemplate.d.ts +2 -2
- package/dist/TextAreaTemplate.js +2 -2
- package/dist/TextAreaTemplate.js.map +1 -1
- package/dist/Versioning.js +2 -2
- package/dist/Versioning.js.map +1 -1
- package/dist/WritingAssistant.d.ts +7 -7
- package/dist/WritingAssistant.js +10 -10
- package/dist/WritingAssistant.js.map +1 -1
- package/dist/WritingAssistantTemplate.js +2 -2
- package/dist/WritingAssistantTemplate.js.map +1 -1
- package/dist/bundle.esm.js +1 -1
- package/dist/bundle.esm.js.map +1 -1
- package/dist/css/themes/Button.css +1 -1
- package/dist/css/themes/{AITextArea.css → TextArea.css} +1 -1
- package/dist/css/themes/WritingAssistant.css +1 -1
- package/dist/custom-elements-internal.json +22 -21
- package/dist/custom-elements.json +21 -21
- 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_saprigi.json +1 -1
- package/dist/generated/assets/i18n/messagebundle_en_US_saptrc.json +1 -1
- package/dist/generated/i18n/i18n-defaults.js +4 -4
- package/dist/generated/i18n/i18n-defaults.js.map +1 -1
- 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/{AITextArea.css.d.ts → TextArea.css.d.ts} +1 -1
- package/dist/generated/themes/{AITextArea.css.js → TextArea.css.js} +2 -2
- package/dist/generated/themes/TextArea.css.js.map +1 -0
- package/dist/generated/themes/WritingAssistant.css.d.ts +1 -1
- package/dist/generated/themes/WritingAssistant.css.js +1 -1
- package/dist/generated/themes/WritingAssistant.css.js.map +1 -1
- package/dist/vscode.html-custom-data.json +6 -6
- package/dist/web-types.json +14 -14
- package/package.json +7 -7
- package/src/TextAreaTemplate.tsx +5 -5
- package/src/WritingAssistantTemplate.tsx +4 -4
- package/src/i18n/messagebundle.properties +8 -8
- package/src/i18n/messagebundle_en.properties +4 -4
- package/src/i18n/messagebundle_en_GB.properties +4 -4
- package/src/i18n/messagebundle_en_US_saprigi.properties +4 -4
- package/src/i18n/messagebundle_en_US_saptrc.properties +4 -4
- package/dist/generated/themes/AITextArea.css.js.map +0 -1
- /package/src/themes/{AITextArea.css → TextArea.css} +0 -0
package/dist/TextArea.d.ts
CHANGED
|
@@ -1,34 +1,33 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { BaseTextArea } from "@ui5/webcomponents/dist/TextArea.js";
|
|
2
2
|
import type I18nBundle from "@ui5/webcomponents-base/dist/i18nBundle.js";
|
|
3
3
|
/**
|
|
4
4
|
* @class
|
|
5
5
|
*
|
|
6
6
|
* ### Overview
|
|
7
7
|
*
|
|
8
|
-
* The `ui5-ai-textarea` component extends the standard TextArea with
|
|
8
|
+
* The `ui5-ai-textarea` component extends the standard TextArea with Writing Assistant capabilities.
|
|
9
9
|
* It provides AI-powered text generation, editing suggestions, and version management functionality.
|
|
10
10
|
*
|
|
11
11
|
* ### Structure
|
|
12
12
|
* The `ui5-ai-textarea` consists of the following elements:
|
|
13
13
|
* - TextArea: The main text input area with all standard textarea functionality
|
|
14
|
-
* -
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
* Single vs multiple result display is determined internally based on totalVersions count.
|
|
14
|
+
* - WritingAssistant: Dedicated toolbar containing:
|
|
15
|
+
* - Versioning: A component with left/right navigation buttons and a label for browsing AI-generated versions
|
|
16
|
+
* - AI Button: Opens a menu that can be extended with custom AI generation options through slotting
|
|
19
17
|
*
|
|
20
18
|
* ### ES6 Module Import
|
|
21
19
|
*
|
|
22
|
-
* `import "@
|
|
20
|
+
* `import "@ui5/webcomponents-ai/dist/TextArea.js";`
|
|
23
21
|
*
|
|
24
22
|
* @constructor
|
|
25
|
-
* @extends
|
|
23
|
+
* @extends BaseTextArea
|
|
24
|
+
* @experimental The **@ui5/webcomponents-ai** package is under development and considered experimental - components' APIs are subject to change.
|
|
26
25
|
* @since 2.16.0
|
|
27
26
|
* @public
|
|
28
27
|
* @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.
|
|
29
28
|
*/
|
|
30
|
-
declare class
|
|
31
|
-
eventDetails:
|
|
29
|
+
declare class TextArea extends BaseTextArea {
|
|
30
|
+
eventDetails: BaseTextArea["eventDetails"] & {
|
|
32
31
|
"version-change": {
|
|
33
32
|
backwards: boolean;
|
|
34
33
|
};
|
|
@@ -43,25 +42,27 @@ declare class AITextArea extends TextArea {
|
|
|
43
42
|
*/
|
|
44
43
|
loading: boolean;
|
|
45
44
|
/**
|
|
46
|
-
* Defines the
|
|
45
|
+
* Defines the prompt description of the current action.
|
|
47
46
|
*
|
|
48
47
|
* @default ""
|
|
49
48
|
* @public
|
|
50
49
|
*/
|
|
51
|
-
|
|
50
|
+
promptDescription: string;
|
|
52
51
|
/**
|
|
53
|
-
* Indicates the index of the currently displayed
|
|
52
|
+
* Indicates the index of the currently displayed version.
|
|
54
53
|
*
|
|
55
|
-
* The index is **1-based** (i.e. `1` represents the first result).
|
|
56
54
|
*
|
|
57
|
-
* @default
|
|
55
|
+
* @default 0
|
|
58
56
|
* @public
|
|
59
57
|
*/
|
|
60
|
-
|
|
58
|
+
currentVersion: number;
|
|
61
59
|
/**
|
|
62
60
|
* Indicates the total number of result versions available.
|
|
63
61
|
*
|
|
64
|
-
*
|
|
62
|
+
* Notes:
|
|
63
|
+
* Versioning is hidden if the value is `0`
|
|
64
|
+
*
|
|
65
|
+
* @default 0
|
|
65
66
|
* @public
|
|
66
67
|
*/
|
|
67
68
|
totalVersions: number;
|
|
@@ -112,4 +113,4 @@ declare class AITextArea extends TextArea {
|
|
|
112
113
|
*/
|
|
113
114
|
handleStopGeneration: () => void;
|
|
114
115
|
}
|
|
115
|
-
export default
|
|
116
|
+
export default TextArea;
|
package/dist/TextArea.js
CHANGED
|
@@ -4,18 +4,18 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
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
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
var
|
|
7
|
+
var TextArea_1;
|
|
8
8
|
import customElement from "@ui5/webcomponents-base/dist/decorators/customElement.js";
|
|
9
9
|
import property from "@ui5/webcomponents-base/dist/decorators/property.js";
|
|
10
10
|
import slot from "@ui5/webcomponents-base/dist/decorators/slot.js";
|
|
11
11
|
import event from "@ui5/webcomponents-base/dist/decorators/event-strict.js";
|
|
12
12
|
import jsxRenderer from "@ui5/webcomponents-base/dist/renderer/JsxRenderer.js";
|
|
13
|
-
import
|
|
13
|
+
import { BaseTextArea } from "@ui5/webcomponents/dist/TextArea.js";
|
|
14
14
|
import BusyIndicator from "@ui5/webcomponents/dist/BusyIndicator.js";
|
|
15
15
|
import { getI18nBundle } from "@ui5/webcomponents-base/dist/i18nBundle.js";
|
|
16
16
|
import { WRITING_ASSISTANT_LABEL, } from "./generated/i18n/i18n-defaults.js";
|
|
17
17
|
// Styles
|
|
18
|
-
import
|
|
18
|
+
import TextAreaCss from "./generated/themes/TextArea.css.js";
|
|
19
19
|
import textareaStyles from "@ui5/webcomponents/dist/generated/themes/TextArea.css.js";
|
|
20
20
|
import valueStateMessageStyles from "@ui5/webcomponents/dist/generated/themes/ValueStateMessage.css.js";
|
|
21
21
|
// Templates
|
|
@@ -26,29 +26,28 @@ import WritingAssistant from "./WritingAssistant.js";
|
|
|
26
26
|
*
|
|
27
27
|
* ### Overview
|
|
28
28
|
*
|
|
29
|
-
* The `ui5-ai-textarea` component extends the standard TextArea with
|
|
29
|
+
* The `ui5-ai-textarea` component extends the standard TextArea with Writing Assistant capabilities.
|
|
30
30
|
* It provides AI-powered text generation, editing suggestions, and version management functionality.
|
|
31
31
|
*
|
|
32
32
|
* ### Structure
|
|
33
33
|
* The `ui5-ai-textarea` consists of the following elements:
|
|
34
34
|
* - TextArea: The main text input area with all standard textarea functionality
|
|
35
|
-
* -
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
* Single vs multiple result display is determined internally based on totalVersions count.
|
|
35
|
+
* - WritingAssistant: Dedicated toolbar containing:
|
|
36
|
+
* - Versioning: A component with left/right navigation buttons and a label for browsing AI-generated versions
|
|
37
|
+
* - AI Button: Opens a menu that can be extended with custom AI generation options through slotting
|
|
40
38
|
*
|
|
41
39
|
* ### ES6 Module Import
|
|
42
40
|
*
|
|
43
|
-
* `import "@
|
|
41
|
+
* `import "@ui5/webcomponents-ai/dist/TextArea.js";`
|
|
44
42
|
*
|
|
45
43
|
* @constructor
|
|
46
|
-
* @extends
|
|
44
|
+
* @extends BaseTextArea
|
|
45
|
+
* @experimental The **@ui5/webcomponents-ai** package is under development and considered experimental - components' APIs are subject to change.
|
|
47
46
|
* @since 2.16.0
|
|
48
47
|
* @public
|
|
49
48
|
* @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.
|
|
50
49
|
*/
|
|
51
|
-
let
|
|
50
|
+
let TextArea = TextArea_1 = class TextArea extends BaseTextArea {
|
|
52
51
|
constructor() {
|
|
53
52
|
super(...arguments);
|
|
54
53
|
/**
|
|
@@ -59,28 +58,30 @@ let AITextArea = AITextArea_1 = class AITextArea extends TextArea {
|
|
|
59
58
|
*/
|
|
60
59
|
this.loading = false;
|
|
61
60
|
/**
|
|
62
|
-
* Defines the
|
|
61
|
+
* Defines the prompt description of the current action.
|
|
63
62
|
*
|
|
64
63
|
* @default ""
|
|
65
64
|
* @public
|
|
66
65
|
*/
|
|
67
|
-
this.
|
|
66
|
+
this.promptDescription = "";
|
|
68
67
|
/**
|
|
69
|
-
* Indicates the index of the currently displayed
|
|
68
|
+
* Indicates the index of the currently displayed version.
|
|
70
69
|
*
|
|
71
|
-
* The index is **1-based** (i.e. `1` represents the first result).
|
|
72
70
|
*
|
|
73
|
-
* @default
|
|
71
|
+
* @default 0
|
|
74
72
|
* @public
|
|
75
73
|
*/
|
|
76
|
-
this.
|
|
74
|
+
this.currentVersion = 0;
|
|
77
75
|
/**
|
|
78
76
|
* Indicates the total number of result versions available.
|
|
79
77
|
*
|
|
80
|
-
*
|
|
78
|
+
* Notes:
|
|
79
|
+
* Versioning is hidden if the value is `0`
|
|
80
|
+
*
|
|
81
|
+
* @default 0
|
|
81
82
|
* @public
|
|
82
83
|
*/
|
|
83
|
-
this.totalVersions =
|
|
84
|
+
this.totalVersions = 0;
|
|
84
85
|
/**
|
|
85
86
|
* Handles the generate click event from the AI toolbar.
|
|
86
87
|
* Opens the AI menu and sets the opener element.
|
|
@@ -112,7 +113,7 @@ let AITextArea = AITextArea_1 = class AITextArea extends TextArea {
|
|
|
112
113
|
};
|
|
113
114
|
}
|
|
114
115
|
static async onDefine() {
|
|
115
|
-
|
|
116
|
+
TextArea_1.i18nBundle = await getI18nBundle("@ui5/webcomponents-ai");
|
|
116
117
|
}
|
|
117
118
|
/**
|
|
118
119
|
* Handles the click event for the "Previous Version" button.
|
|
@@ -180,25 +181,25 @@ let AITextArea = AITextArea_1 = class AITextArea extends TextArea {
|
|
|
180
181
|
}
|
|
181
182
|
}
|
|
182
183
|
get _ariaLabel() {
|
|
183
|
-
return this.accessibleName ||
|
|
184
|
+
return this.accessibleName || TextArea_1.i18nBundle.getText(WRITING_ASSISTANT_LABEL);
|
|
184
185
|
}
|
|
185
186
|
};
|
|
186
187
|
__decorate([
|
|
187
188
|
property({ type: Boolean })
|
|
188
|
-
],
|
|
189
|
+
], TextArea.prototype, "loading", void 0);
|
|
189
190
|
__decorate([
|
|
190
191
|
property()
|
|
191
|
-
],
|
|
192
|
+
], TextArea.prototype, "promptDescription", void 0);
|
|
192
193
|
__decorate([
|
|
193
194
|
property({ type: Number })
|
|
194
|
-
],
|
|
195
|
+
], TextArea.prototype, "currentVersion", void 0);
|
|
195
196
|
__decorate([
|
|
196
197
|
property({ type: Number })
|
|
197
|
-
],
|
|
198
|
+
], TextArea.prototype, "totalVersions", void 0);
|
|
198
199
|
__decorate([
|
|
199
200
|
slot({ type: HTMLElement })
|
|
200
|
-
],
|
|
201
|
-
|
|
201
|
+
], TextArea.prototype, "menu", void 0);
|
|
202
|
+
TextArea = TextArea_1 = __decorate([
|
|
202
203
|
customElement({
|
|
203
204
|
tag: "ui5-ai-textarea",
|
|
204
205
|
languageAware: true,
|
|
@@ -207,7 +208,7 @@ AITextArea = AITextArea_1 = __decorate([
|
|
|
207
208
|
styles: [
|
|
208
209
|
textareaStyles,
|
|
209
210
|
valueStateMessageStyles,
|
|
210
|
-
|
|
211
|
+
TextAreaCss,
|
|
211
212
|
],
|
|
212
213
|
dependencies: [
|
|
213
214
|
WritingAssistant,
|
|
@@ -228,7 +229,7 @@ AITextArea = AITextArea_1 = __decorate([
|
|
|
228
229
|
*/
|
|
229
230
|
,
|
|
230
231
|
event("stop-generation")
|
|
231
|
-
],
|
|
232
|
-
|
|
233
|
-
export default
|
|
232
|
+
], TextArea);
|
|
233
|
+
TextArea.define();
|
|
234
|
+
export default TextArea;
|
|
234
235
|
//# sourceMappingURL=TextArea.js.map
|
package/dist/TextArea.js.map
CHANGED
|
@@ -1 +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,iD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;AAWhB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;uDACH;AASxB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;iDACT;AAGlB;IADC,IAAI,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC;wCACF;AAlDrB,UAAU;IA9Bf,aAAa,CAAC;QACd,GAAG,EAAE,iBAAiB;QACtB,aAAa,EAAE,IAAI;QACnB,QAAQ,EAAE,WAAW;QACrB,QAAQ,EAAE,gBAAgB;QAC1B,MAAM,EAAE;YACP,cAAc;YACd,uBAAuB;YACvB,aAAa;SACb;QACD,YAAY,EAAE;YACb,gBAAgB;YAChB,aAAa;SACb;KACD,CAAC;IAEF;;;;OAIG;;IACF,KAAK,CAAC,gBAAgB,CAAC;IAExB;;;;OAIG;;IACF,KAAK,CAAC,iBAAiB,CAAC;GAEnB,UAAU,CAsKf;AAED,UAAU,CAAC,MAAM,EAAE,CAAC;AAEpB,eAAe,UAAU,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 TextArea from \"@ui5/webcomponents/dist/TextArea.js\";\nimport BusyIndicator from \"@ui5/webcomponents/dist/BusyIndicator.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 AITextAreaCss from \"./generated/themes/AITextArea.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\";\nimport WritingAssistant from \"./WritingAssistant.js\";\n\n/**\n * @class\n *\n * ### Overview\n *\n * The `ui5-ai-textarea` component extends the standard TextArea with AI 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 * - AI Toolbar: Specialized toolbar with AI generation controls\n * - Version Navigation: Controls for navigating between AI-generated versions\n * - Menu Integration: Support for AI action menu\n *\n * Single vs multiple result display is determined internally based on totalVersions count.\n *\n * ### ES6 Module Import\n *\n * `import \"@sap-webcomponents/ai/dist/TextArea.js\";`\n *\n * @constructor\n * @extends TextArea\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\tAITextAreaCss,\n\t],\n\tdependencies: [\n\t\tWritingAssistant,\n\t\tBusyIndicator,\n\t],\n})\n\n/**\n * Fired when the user clicks on version navigation buttons.\n *\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 AITextArea extends TextArea {\n\teventDetails!: TextArea[\"eventDetails\"] & {\n\t\t\"version-change\": {\n\t\t\tbackwards: boolean;\n\t\t};\n\t\t\"stop-generation\": object;\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 action text of the AI Writing Assistant.\n\t *\n\t * @default \"\"\n\t * @public\n\t */\n\t@property()\n\tactionText = \"\";\n\n\t/**\n\t * Indicates the index of the currently displayed result version.\n\t *\n\t * The index is **1-based** (i.e. `1` represents the first result).\n\t *\n\t * @default 1\n\t * @public\n\t */\n\t@property({ type: Number })\n\tcurrentVersionIndex = 1;\n\n\t/**\n\t * Indicates the total number of result versions available.\n\t *\n\t * @default 1\n\t * @public\n\t */\n\t@property({ type: Number })\n\ttotalVersions = 1;\n\n\t@slot({ type: HTMLElement })\n\tmenu!: Array<HTMLElement>;\n\n\tstatic i18nBundle: I18nBundle;\n\n\tstatic async onDefine() {\n\t\tAITextArea.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 || AITextArea.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\nAITextArea.define();\n\nexport default AITextArea;\n"]}
|
|
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,aAAa,MAAM,0CAA0C,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,MAAM,4CAA4C,CAAC;AAE3E,OAAO,EACN,uBAAuB,GACvB,MAAM,mCAAmC,CAAC;AAC3C,SAAS;AACT,OAAO,WAAW,MAAM,oCAAoC,CAAC;AAC7D,OAAO,cAAc,MAAM,0DAA0D,CAAC;AACtF,OAAO,uBAAuB,MAAM,mEAAmE,CAAC;AAExG,YAAY;AACZ,OAAO,gBAAgB,MAAM,uBAAuB,CAAC;AACrD,OAAO,gBAAgB,MAAM,uBAAuB,CAAC;AAErD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AA+BH,IAAM,QAAQ,gBAAd,MAAM,QAAS,SAAQ,YAAY;IAAnC;;QAWC;;;;;WAKG;QAEH,YAAO,GAAG,KAAK,CAAC;QAEhB;;;;;WAKG;QAEH,sBAAiB,GAAG,EAAE,CAAC;QAEvB;;;;;;WAMG;QAEH,mBAAc,GAAG,CAAC,CAAC;QAEnB;;;;;;;;WAQG;QAEH,kBAAa,GAAG,CAAC,CAAC;QAqFlB;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AE,CAAC;YACvC,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACtD,QAAQ,CAAC,gBAAgB,CAAC,SAAS,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC;QAC5D,CAAC;IACF,CAAC;IAuBD,IAAI,UAAU;QACb,OAAO,IAAI,CAAC,cAAc,IAAI,UAAQ,CAAC,UAAU,CAAC,OAAO,CAAC,uBAAuB,CAAC,CAAC;IACpF,CAAC;CAWD,CAAA;AAtJA;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;yCACZ;AAShB;IADC,QAAQ,EAAE;mDACY;AAUvB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;gDACR;AAYnB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;+CACT;AAGlB;IADC,IAAI,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC;sCACF;AApDrB,QAAQ;IA9Bb,aAAa,CAAC;QACd,GAAG,EAAE,iBAAiB;QACtB,aAAa,EAAE,IAAI;QACnB,QAAQ,EAAE,WAAW;QACrB,QAAQ,EAAE,gBAAgB;QAC1B,MAAM,EAAE;YACP,cAAc;YACd,uBAAuB;YACvB,WAAW;SACX;QACD,YAAY,EAAE;YACb,gBAAgB;YAChB,aAAa;SACb;KACD,CAAC;IAEF;;;;OAIG;;IACF,KAAK,CAAC,gBAAgB,CAAC;IAExB;;;;OAIG;;IACF,KAAK,CAAC,iBAAiB,CAAC;GAEnB,QAAQ,CAwKb;AAED,QAAQ,CAAC,MAAM,EAAE,CAAC;AAElB,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 BusyIndicator from \"@ui5/webcomponents/dist/BusyIndicator.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\";\nimport WritingAssistant from \"./WritingAssistant.js\";\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\tdependencies: [\n\t\tWritingAssistant,\n\t\tBusyIndicator,\n\t],\n})\n\n/**\n * Fired when the user clicks on version navigation buttons.\n *\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\": {\n\t\t\tbackwards: boolean;\n\t\t};\n\t\t\"stop-generation\": object;\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 default TextArea;\n"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type
|
|
2
|
-
export default function TextAreaTemplate(this:
|
|
1
|
+
import type TextArea from "./TextArea.js";
|
|
2
|
+
export default function TextAreaTemplate(this: TextArea): import("@ui5/webcomponents-base/jsx-runtime").JSX.Element;
|
package/dist/TextAreaTemplate.js
CHANGED
|
@@ -6,8 +6,8 @@ export default function TextAreaTemplate() {
|
|
|
6
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
7
|
_jsx("div", { id: `${this._id}-mirror`, class: "ui5-textarea-mirror", "aria-hidden": "true", children: this._mirrorText.map(mirrorText => {
|
|
8
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,
|
|
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
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.
|
|
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
12
|
}
|
|
13
13
|
//# sourceMappingURL=TextAreaTemplate.js.map
|
|
@@ -1 +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,I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,cAAc,EACnC,aAAa,EAAE,IAAI,CAAC,aAAa,EACjC,iBAAiB,EAAE,IAAI,CAAC,iBAAiB,EACzC,aAAa,EAAE,IAAI,CAAC,oBAAoB,EACxC,gBAAgB,EAAE,IAAI,CAAC,oBAAoB,EAC3C,eAAe,EAAE,IAAI,CAAC,oBAAoB,GACzC,GACI,GACF,IACD,EAEL,IAAI,CAAC,gBAAgB;wBACtB,eAAM,KAAK,EAAC,4BAA4B,YAAE,IAAI,CAAC,kBAAkB,CAAC,YAAY,GAAQ,EAGrF,IAAI,CAAC,aAAa;wBACnB,eAAM,EAAE,EAAE,GAAG,IAAI,CAAC,GAAG,iBAAiB,EAAE,KAAK,EAAC,iBAAiB,YAAE,IAAI,CAAC,wBAAwB,GAAQ,IAEjG,EAEL,uBAAuB,CAAC,IAAI,CAAC,IAAI,CAAC,EAGnC,2BAAe,QAAQ,iBAAa,MAAM,EAAC,KAAK,EAAC,iBAAiB,YAChE,IAAI,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"]}
|
package/dist/Versioning.js
CHANGED
|
@@ -111,9 +111,9 @@ let Versioning = Versioning_1 = class Versioning extends ToolbarItem {
|
|
|
111
111
|
return;
|
|
112
112
|
}
|
|
113
113
|
const isPreviousDisabled = this.currentStep <= 1;
|
|
114
|
-
const isNextDisabled = this.currentStep
|
|
114
|
+
const isNextDisabled = this.currentStep >= this.totalSteps;
|
|
115
115
|
const wasPreviousDisabled = this._previousCurrentStep <= 1;
|
|
116
|
-
const wasNextDisabled = this._previousCurrentStep
|
|
116
|
+
const wasNextDisabled = this._previousCurrentStep >= this._previousTotalSteps;
|
|
117
117
|
if (isPreviousDisabled && !wasPreviousDisabled && !isNextDisabled && this._lastClickedButton === LastClickedButton.Previous && nextButton instanceof HTMLElement) {
|
|
118
118
|
nextButton.focus();
|
|
119
119
|
this._lastClickedButton = LastClickedButton.None;
|
package/dist/Versioning.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Versioning.js","sourceRoot":"","sources":["../src/Versioning.ts"],"names":[],"mappings":";;;;;;;AAAA,OAAO,WAAW,MAAM,wCAAwC,CAAC;AACjE,OAAO,aAAa,MAAM,0DAA0D,CAAC;AACrF,OAAO,QAAQ,MAAM,qDAAqD,CAAC;AAC3E,OAAO,KAAK,MAAM,yDAAyD,CAAC;AAC5E,OAAO,WAAW,MAAM,sDAAsD,CAAC;AAE/E,OAAO,EAAE,aAAa,EAAE,MAAM,4CAA4C,CAAC;AAE3E,OAAO,EACN,+BAA+B,EAC/B,2BAA2B,EAC3B,kCAAkC,EAClC,8BAA8B,GAC9B,MAAM,mCAAmC,CAAC;AAE3C,iBAAiB;AACjB,OAAO,MAAM,MAAM,mCAAmC,CAAC;AACvD,OAAO,KAAK,MAAM,kCAAkC,CAAC;AACrD,OAAO,aAAa,MAAM,0CAA0C,CAAC;AACrE,OAAO,YAAY,MAAM,mBAAmB,CAAC;AAE7C,QAAQ;AACR,OAAO,kBAAkB,MAAM,yBAAyB,CAAC;AAEzD,SAAS;AACT,OAAO,aAAa,MAAM,sCAAsC,CAAC;AAEjE,QAAQ;AACR,OAAO,wDAAwD,CAAC;AAChE,OAAO,yDAAyD,CAAC;AAEjE,IAAK,iBAIJ;AAJD,WAAK,iBAAiB;IACrB,8BAAS,CAAA;IACT,0CAAqB,CAAA;IACrB,kCAAa,CAAA;AACd,CAAC,EAJI,iBAAiB,KAAjB,iBAAiB,QAIrB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAqBH,IAAM,UAAU,kBAAhB,MAAM,UAAW,SAAQ,WAAW;I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AC;IAED;;OAEG;IACH,IAAI,OAAO;QACV,OAAO;YACN,IAAI,EAAE;gBACL,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI;gBACrB,mBAAmB,EAAE,IAAI;aACzB;SACD,CAAC;IACH,CAAC;CACD,CAAA;AAlGA;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;+CACX;AAWhB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8CACZ;AA1BV,UAAU;IApBf,aAAa,CAAC;QACd,GAAG,EAAE,mBAAmB;QACxB,QAAQ,EAAE,WAAW;QACrB,MAAM,EAAE,aAAa;QACrB,QAAQ,EAAE,kBAAkB;QAC5B,YAAY,EAAE;YACb,MAAM;YACN,KAAK;YACL,aAAa;YACb,YAAY;SACZ;KACD,CAAC;IAEF;;;;OAIG;;IACF,KAAK,CAAC,gBAAgB,CAAC;GAElB,UAAU,CAiHf;AAED,UAAU,CAAC,MAAM,EAAE,CAAC;AAEpB,eAAe,UAAU,CAAC","sourcesContent":["import ToolbarItem from \"@ui5/webcomponents/dist/ToolbarItem.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 jsxRenderer from \"@ui5/webcomponents-base/dist/renderer/JsxRenderer.js\";\n\nimport { getI18nBundle } from \"@ui5/webcomponents-base/dist/i18nBundle.js\";\nimport type I18nBundle from \"@ui5/webcomponents-base/dist/i18nBundle.js\";\nimport {\n\tVERSIONING_PREVIOUS_BUTTON_TEXT,\n\tVERSIONING_NEXT_BUTTON_TEXT,\n\tVERSIONING_PREVIOUS_BUTTON_TOOLTIP,\n\tVERSIONING_NEXT_BUTTON_TOOLTIP,\n} from \"./generated/i18n/i18n-defaults.js\";\n\n// UI5 Components\nimport Button from \"@ui5/webcomponents/dist/Button.js\";\nimport Label from \"@ui5/webcomponents/dist/Label.js\";\nimport ToolbarButton from \"@ui5/webcomponents/dist/ToolbarButton.js\";\nimport ToolbarLabel from \"./ToolbarLabel.js\";\n\n// Types\nimport VersioningTemplate from \"./VersioningTemplate.js\";\n\n// Styles\nimport VersioningCss from \"./generated/themes/Versioning.css.js\";\n\n// Icons\nimport \"@ui5/webcomponents-icons/dist/navigation-left-arrow.js\";\nimport \"@ui5/webcomponents-icons/dist/navigation-right-arrow.js\";\n\nenum LastClickedButton {\n\tNone = \"\",\n\tPrevious = \"previous\",\n\tNext = \"next\"\n}\n\n/**\n * @class\n *\n * ### Overview\n *\n * The `ui5-ai-versioning` component provides navigation controls for AI-generated content versions.\n * It displays the current version index and total versions, with previous/next navigation buttons.\n * This component extends ToolbarItem to participate in toolbar overflow behavior as a single unit.\n *\n * ### Structure\n * The `ui5-ai-versioning` consists of the following elements:\n * - Previous Button: Navigates to the previous version (disabled when at first version)\n * - Version Counter: Shows current version / total versions (e.g., \"2 / 5\")\n * - Next Button: Navigates to the nex\n * t version (disabled when at last version)\n *\n * ### Focus Management\n * The component automatically manages focus when users reach version boundaries,\n * moving focus to the available navigation button when one becomes disabled.\n *\n * ### Responsive Behavior\n * When used in a toolbar, the entire versioning component (buttons + label) will overflow\n * together as a single unit when there is insufficient space.\n *\n * ### ES6 Module Import\n *\n * `import \"@ui5/webcomponents-ai/dist/Versioning.js\";`\n *\n * @constructor\n * @extends ToolbarItem\n * @since 2.16.0\n * @private\n */\n@customElement({\n\ttag: \"ui5-ai-versioning\",\n\trenderer: jsxRenderer,\n\tstyles: VersioningCss,\n\ttemplate: VersioningTemplate,\n\tdependencies: [\n\t\tButton,\n\t\tLabel,\n\t\tToolbarButton,\n\t\tToolbarLabel,\n\t],\n})\n\n/**\n * Fired when the user clicks on version navigation buttons.\n *\n * @public\n */\n@event(\"version-change\")\n\nclass Versioning extends ToolbarItem {\n\teventDetails!: ToolbarItem[\"eventDetails\"] & {\n\t\t\"version-change\": {\n\t\t\tbackwards: boolean;\n\t\t};\n\t};\n\n\t/**\n\t * Indicates the index of the currently displayed result version.\n\t *\n\t * This property represents the current position in the version history.\n\t * @default 0\n\t * @public\n\t */\n\t@property({ type: Number })\n\tcurrentStep = 0;\n\n\t/**\n\t * The total number of available result versions.\n\t *\n\t * Note: 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\ttotalSteps = 0;\n\n\t_previousCurrentStep = 0;\n\t_previousTotalSteps = 0;\n\t_lastClickedButton = LastClickedButton.None;\n\n\tstatic i18nBundle: I18nBundle;\n\n\tstatic async onDefine() {\n\t\tVersioning.i18nBundle = await getI18nBundle(\"@ui5/webcomponents-ai\");\n\t}\n\n\tonAfterRendering() {\n\t\tthis._manageFocus();\n\t\tthis._previousCurrentStep = this.currentStep;\n\t\tthis._previousTotalSteps = this.totalSteps;\n\t\tthis._lastClickedButton = LastClickedButton.None;\n\t}\n\n\t/**\n\t * Manages focus when navigation buttons become disabled/enabled.\n\t * Automatically moves focus to available button when user reaches boundaries.\n\t * @private\n\t */\n\t_manageFocus() {\n\t\tif (!this.shadowRoot) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst previousButton = this.shadowRoot.querySelector(\"[data-ui5-versioning-button=\\\"previous\\\"]\");\n\t\tconst nextButton = this.shadowRoot.querySelector(\"[data-ui5-versioning-button=\\\"next\\\"]\");\n\n\t\tif (!previousButton || !nextButton) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst isPreviousDisabled = this.currentStep <= 1;\n\t\tconst isNextDisabled = this.currentStep === this.totalSteps;\n\t\tconst wasPreviousDisabled = this._previousCurrentStep <= 1;\n\t\tconst wasNextDisabled = this._previousCurrentStep === this._previousTotalSteps;\n\n\t\tif (isPreviousDisabled && !wasPreviousDisabled && !isNextDisabled && this._lastClickedButton === LastClickedButton.Previous && nextButton instanceof HTMLElement) {\n\t\t\tnextButton.focus();\n\t\t\tthis._lastClickedButton = LastClickedButton.None;\n\t\t} else if (isNextDisabled && !wasNextDisabled && !isPreviousDisabled && this._lastClickedButton === LastClickedButton.Next && previousButton instanceof HTMLElement) {\n\t\t\tpreviousButton.focus();\n\t\t\tthis._lastClickedButton = LastClickedButton.None;\n\t\t}\n\t}\n\n\thandlePreviousVersionClick() {\n\t\tthis._lastClickedButton = LastClickedButton.Previous;\n\t\tthis.fireDecoratorEvent(\"version-change\", { backwards: true });\n\t}\n\n\thandleNextVersionClick() {\n\t\tthis._lastClickedButton = LastClickedButton.Next;\n\t\tthis.fireDecoratorEvent(\"version-change\", { backwards: false });\n\t}\n\n\tget _previousButtonAccessibleName() {\n\t\treturn Versioning.i18nBundle.getText(VERSIONING_PREVIOUS_BUTTON_TEXT);\n\t}\n\n\tget _nextButtonAccessibleName() {\n\t\treturn Versioning.i18nBundle.getText(VERSIONING_NEXT_BUTTON_TEXT);\n\t}\n\n\tget _previousButtonTooltip() {\n\t\treturn Versioning.i18nBundle.getText(VERSIONING_PREVIOUS_BUTTON_TOOLTIP);\n\t}\n\n\tget _nextButtonTooltip() {\n\t\treturn Versioning.i18nBundle.getText(VERSIONING_NEXT_BUTTON_TOOLTIP);\n\t}\n\n\t/**\n\t * @override\n\t */\n\tget classes() {\n\t\treturn {\n\t\t\troot: {\n\t\t\t\t...super.classes.root,\n\t\t\t\t\"ui5-ai-versioning\": true,\n\t\t\t},\n\t\t};\n\t}\n}\n\nVersioning.define();\n\nexport default Versioning;\n"]}
|
|
1
|
+
{"version":3,"file":"Versioning.js","sourceRoot":"","sources":["../src/Versioning.ts"],"names":[],"mappings":";;;;;;;AAAA,OAAO,WAAW,MAAM,wCAAwC,CAAC;AACjE,OAAO,aAAa,MAAM,0DAA0D,CAAC;AACrF,OAAO,QAAQ,MAAM,qDAAqD,CAAC;AAC3E,OAAO,KAAK,MAAM,yDAAyD,CAAC;AAC5E,OAAO,WAAW,MAAM,sDAAsD,CAAC;AAE/E,OAAO,EAAE,aAAa,EAAE,MAAM,4CAA4C,CAAC;AAE3E,OAAO,EACN,+BAA+B,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AElB,UAAU,CAiHf;AAED,UAAU,CAAC,MAAM,EAAE,CAAC;AAEpB,eAAe,UAAU,CAAC","sourcesContent":["import ToolbarItem from \"@ui5/webcomponents/dist/ToolbarItem.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 jsxRenderer from \"@ui5/webcomponents-base/dist/renderer/JsxRenderer.js\";\n\nimport { getI18nBundle } from \"@ui5/webcomponents-base/dist/i18nBundle.js\";\nimport type I18nBundle from \"@ui5/webcomponents-base/dist/i18nBundle.js\";\nimport {\n\tVERSIONING_PREVIOUS_BUTTON_TEXT,\n\tVERSIONING_NEXT_BUTTON_TEXT,\n\tVERSIONING_PREVIOUS_BUTTON_TOOLTIP,\n\tVERSIONING_NEXT_BUTTON_TOOLTIP,\n} from \"./generated/i18n/i18n-defaults.js\";\n\n// UI5 Components\nimport Button from \"@ui5/webcomponents/dist/Button.js\";\nimport Label from \"@ui5/webcomponents/dist/Label.js\";\nimport ToolbarButton from \"@ui5/webcomponents/dist/ToolbarButton.js\";\nimport ToolbarLabel from \"./ToolbarLabel.js\";\n\n// Types\nimport VersioningTemplate from \"./VersioningTemplate.js\";\n\n// Styles\nimport VersioningCss from \"./generated/themes/Versioning.css.js\";\n\n// Icons\nimport \"@ui5/webcomponents-icons/dist/navigation-left-arrow.js\";\nimport \"@ui5/webcomponents-icons/dist/navigation-right-arrow.js\";\n\nenum LastClickedButton {\n\tNone = \"\",\n\tPrevious = \"previous\",\n\tNext = \"next\"\n}\n\n/**\n * @class\n *\n * ### Overview\n *\n * The `ui5-ai-versioning` component provides navigation controls for AI-generated content versions.\n * It displays the current version index and total versions, with previous/next navigation buttons.\n * This component extends ToolbarItem to participate in toolbar overflow behavior as a single unit.\n *\n * ### Structure\n * The `ui5-ai-versioning` consists of the following elements:\n * - Previous Button: Navigates to the previous version (disabled when at first version)\n * - Version Counter: Shows current version / total versions (e.g., \"2 / 5\")\n * - Next Button: Navigates to the nex\n * t version (disabled when at last version)\n *\n * ### Focus Management\n * The component automatically manages focus when users reach version boundaries,\n * moving focus to the available navigation button when one becomes disabled.\n *\n * ### Responsive Behavior\n * When used in a toolbar, the entire versioning component (buttons + label) will overflow\n * together as a single unit when there is insufficient space.\n *\n * ### ES6 Module Import\n *\n * `import \"@ui5/webcomponents-ai/dist/Versioning.js\";`\n *\n * @constructor\n * @extends ToolbarItem\n * @since 2.16.0\n * @private\n */\n@customElement({\n\ttag: \"ui5-ai-versioning\",\n\trenderer: jsxRenderer,\n\tstyles: VersioningCss,\n\ttemplate: VersioningTemplate,\n\tdependencies: [\n\t\tButton,\n\t\tLabel,\n\t\tToolbarButton,\n\t\tToolbarLabel,\n\t],\n})\n\n/**\n * Fired when the user clicks on version navigation buttons.\n *\n * @public\n */\n@event(\"version-change\")\n\nclass Versioning extends ToolbarItem {\n\teventDetails!: ToolbarItem[\"eventDetails\"] & {\n\t\t\"version-change\": {\n\t\t\tbackwards: boolean;\n\t\t};\n\t};\n\n\t/**\n\t * Indicates the index of the currently displayed result version.\n\t *\n\t * This property represents the current position in the version history.\n\t * @default 0\n\t * @public\n\t */\n\t@property({ type: Number })\n\tcurrentStep = 0;\n\n\t/**\n\t * The total number of available result versions.\n\t *\n\t * Note: 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\ttotalSteps = 0;\n\n\t_previousCurrentStep = 0;\n\t_previousTotalSteps = 0;\n\t_lastClickedButton = LastClickedButton.None;\n\n\tstatic i18nBundle: I18nBundle;\n\n\tstatic async onDefine() {\n\t\tVersioning.i18nBundle = await getI18nBundle(\"@ui5/webcomponents-ai\");\n\t}\n\n\tonAfterRendering() {\n\t\tthis._manageFocus();\n\t\tthis._previousCurrentStep = this.currentStep;\n\t\tthis._previousTotalSteps = this.totalSteps;\n\t\tthis._lastClickedButton = LastClickedButton.None;\n\t}\n\n\t/**\n\t * Manages focus when navigation buttons become disabled/enabled.\n\t * Automatically moves focus to available button when user reaches boundaries.\n\t * @private\n\t */\n\t_manageFocus() {\n\t\tif (!this.shadowRoot) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst previousButton = this.shadowRoot.querySelector(\"[data-ui5-versioning-button=\\\"previous\\\"]\");\n\t\tconst nextButton = this.shadowRoot.querySelector(\"[data-ui5-versioning-button=\\\"next\\\"]\");\n\n\t\tif (!previousButton || !nextButton) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst isPreviousDisabled = this.currentStep <= 1;\n\t\tconst isNextDisabled = this.currentStep >= this.totalSteps;\n\t\tconst wasPreviousDisabled = this._previousCurrentStep <= 1;\n\t\tconst wasNextDisabled = this._previousCurrentStep >= this._previousTotalSteps;\n\n\t\tif (isPreviousDisabled && !wasPreviousDisabled && !isNextDisabled && this._lastClickedButton === LastClickedButton.Previous && nextButton instanceof HTMLElement) {\n\t\t\tnextButton.focus();\n\t\t\tthis._lastClickedButton = LastClickedButton.None;\n\t\t} else if (isNextDisabled && !wasNextDisabled && !isPreviousDisabled && this._lastClickedButton === LastClickedButton.Next && previousButton instanceof HTMLElement) {\n\t\t\tpreviousButton.focus();\n\t\t\tthis._lastClickedButton = LastClickedButton.None;\n\t\t}\n\t}\n\n\thandlePreviousVersionClick() {\n\t\tthis._lastClickedButton = LastClickedButton.Previous;\n\t\tthis.fireDecoratorEvent(\"version-change\", { backwards: true });\n\t}\n\n\thandleNextVersionClick() {\n\t\tthis._lastClickedButton = LastClickedButton.Next;\n\t\tthis.fireDecoratorEvent(\"version-change\", { backwards: false });\n\t}\n\n\tget _previousButtonAccessibleName() {\n\t\treturn Versioning.i18nBundle.getText(VERSIONING_PREVIOUS_BUTTON_TEXT);\n\t}\n\n\tget _nextButtonAccessibleName() {\n\t\treturn Versioning.i18nBundle.getText(VERSIONING_NEXT_BUTTON_TEXT);\n\t}\n\n\tget _previousButtonTooltip() {\n\t\treturn Versioning.i18nBundle.getText(VERSIONING_PREVIOUS_BUTTON_TOOLTIP);\n\t}\n\n\tget _nextButtonTooltip() {\n\t\treturn Versioning.i18nBundle.getText(VERSIONING_NEXT_BUTTON_TOOLTIP);\n\t}\n\n\t/**\n\t * @override\n\t */\n\tget classes() {\n\t\treturn {\n\t\t\troot: {\n\t\t\t\t...super.classes.root,\n\t\t\t\t\"ui5-ai-versioning\": true,\n\t\t\t},\n\t\t};\n\t}\n}\n\nVersioning.define();\n\nexport default Versioning;\n"]}
|
|
@@ -44,7 +44,7 @@ declare class WritingAssistant extends UI5Element {
|
|
|
44
44
|
*/
|
|
45
45
|
loading: boolean;
|
|
46
46
|
/**
|
|
47
|
-
* Defines the
|
|
47
|
+
* Defines the prompt description of the Writing Assistant.
|
|
48
48
|
*
|
|
49
49
|
* This text is displayed in the toolbar to indicate the current or last
|
|
50
50
|
* performed AI action (e.g., "Generated text", "Simplified text").
|
|
@@ -52,25 +52,25 @@ declare class WritingAssistant extends UI5Element {
|
|
|
52
52
|
* @default ""
|
|
53
53
|
* @public
|
|
54
54
|
*/
|
|
55
|
-
|
|
55
|
+
promptDescription: string;
|
|
56
56
|
/**
|
|
57
57
|
* Indicates the index of the currently displayed result version.
|
|
58
58
|
*
|
|
59
|
-
* The index is **
|
|
59
|
+
* The index is **0-based** (i.e. `0` represents the first result).
|
|
60
60
|
* This property is synchronized with the parent AI TextArea component.
|
|
61
61
|
*
|
|
62
|
-
* @default
|
|
62
|
+
* @default 0
|
|
63
63
|
* @public
|
|
64
64
|
* @since 2.16.0
|
|
65
65
|
*/
|
|
66
|
-
|
|
66
|
+
currentVersion: number;
|
|
67
67
|
/**
|
|
68
68
|
* Indicates the total number of result versions available.
|
|
69
69
|
*
|
|
70
70
|
* This property determines whether version navigation controls are displayed.
|
|
71
|
-
* When totalVersions >
|
|
71
|
+
* When totalVersions > 0, previous/next buttons become available.
|
|
72
72
|
*
|
|
73
|
-
* @default
|
|
73
|
+
* @default 0
|
|
74
74
|
* @public
|
|
75
75
|
*/
|
|
76
76
|
totalVersions: number;
|
package/dist/WritingAssistant.js
CHANGED
|
@@ -61,7 +61,7 @@ let WritingAssistant = WritingAssistant_1 = class WritingAssistant extends UI5El
|
|
|
61
61
|
*/
|
|
62
62
|
this.loading = false;
|
|
63
63
|
/**
|
|
64
|
-
* Defines the
|
|
64
|
+
* Defines the prompt description of the Writing Assistant.
|
|
65
65
|
*
|
|
66
66
|
* This text is displayed in the toolbar to indicate the current or last
|
|
67
67
|
* performed AI action (e.g., "Generated text", "Simplified text").
|
|
@@ -69,28 +69,28 @@ let WritingAssistant = WritingAssistant_1 = class WritingAssistant extends UI5El
|
|
|
69
69
|
* @default ""
|
|
70
70
|
* @public
|
|
71
71
|
*/
|
|
72
|
-
this.
|
|
72
|
+
this.promptDescription = "";
|
|
73
73
|
/**
|
|
74
74
|
* Indicates the index of the currently displayed result version.
|
|
75
75
|
*
|
|
76
|
-
* The index is **
|
|
76
|
+
* The index is **0-based** (i.e. `0` represents the first result).
|
|
77
77
|
* This property is synchronized with the parent AI TextArea component.
|
|
78
78
|
*
|
|
79
|
-
* @default
|
|
79
|
+
* @default 0
|
|
80
80
|
* @public
|
|
81
81
|
* @since 2.16.0
|
|
82
82
|
*/
|
|
83
|
-
this.
|
|
83
|
+
this.currentVersion = 0;
|
|
84
84
|
/**
|
|
85
85
|
* Indicates the total number of result versions available.
|
|
86
86
|
*
|
|
87
87
|
* This property determines whether version navigation controls are displayed.
|
|
88
|
-
* When totalVersions >
|
|
88
|
+
* When totalVersions > 0, previous/next buttons become available.
|
|
89
89
|
*
|
|
90
|
-
* @default
|
|
90
|
+
* @default 0
|
|
91
91
|
* @public
|
|
92
92
|
*/
|
|
93
|
-
this.totalVersions =
|
|
93
|
+
this.totalVersions = 0;
|
|
94
94
|
}
|
|
95
95
|
/**
|
|
96
96
|
* Handles the version change event from the versioning component.
|
|
@@ -138,10 +138,10 @@ __decorate([
|
|
|
138
138
|
], WritingAssistant.prototype, "loading", void 0);
|
|
139
139
|
__decorate([
|
|
140
140
|
property()
|
|
141
|
-
], WritingAssistant.prototype, "
|
|
141
|
+
], WritingAssistant.prototype, "promptDescription", void 0);
|
|
142
142
|
__decorate([
|
|
143
143
|
property({ type: Number })
|
|
144
|
-
], WritingAssistant.prototype, "
|
|
144
|
+
], WritingAssistant.prototype, "currentVersion", void 0);
|
|
145
145
|
__decorate([
|
|
146
146
|
property({ type: Number })
|
|
147
147
|
], WritingAssistant.prototype, "totalVersions", void 0);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WritingAssistant.js","sourceRoot":"","sources":["../src/WritingAssistant.ts"],"names":[],"mappings":";;;;;;;AAAA,OAAO,aAAa,MAAM,0DAA0D,CAAC;AACrF,OAAO,QAAQ,MAAM,qDAAqD,CAAC;AAC3E,OAAO,KAAK,MAAM,yDAAyD,CAAC;AAC5E,OAAO,EAAE,IAAI,EAAE,MAAM,4CAA4C,CAAC;AAClE,OAAO,WAAW,MAAM,sDAAsD,CAAC;AAC/E,OAAO,UAAU,MAAM,4CAA4C,CAAC;AACpE,OAAO,QAAQ,MAAM,uDAAuD,CAAC;AAE7E,OAAO,EACN,uBAAuB,EACvB,+BAA+B,EAC/B,2BAA2B,EAC3B,yCAAyC,EACzC,yCAAyC,EACzC,wCAAwC,EACxC,gCAAgC,GAChC,MAAM,mCAAmC,CAAC;AAE3C,SAAS;AACT,OAAO,mBAAmB,MAAM,4CAA4C,CAAC;AAE7E,YAAY;AACZ,OAAO,wBAAwB,MAAM,+BAA+B,CAAC;AACrE,OAAO,UAAU,MAAM,iBAAiB,CAAC;AACzC,OAAO,YAAY,MAAM,mBAAmB,CAAC;AAE7C,iBAAiB;AACjB,OAAO,OAAO,MAAM,oCAAoC,CAAC;AACzD,OAAO,aAAa,MAAM,0CAA0C,CAAC;AACrE,OAAO,aAAa,MAAM,0CAA0C,CAAC;AAErE,QAAQ;AACR,OAAO,qCAAqC,CAAC;AAC7C,OAAO,uCAAuC,CAAC;AAE/C;;;;;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C,YAAY,CAAC,OAAO,CAAC,wCAAwC,CAAC,CAAC;IACxF,CAAC;IAED,IAAI,cAAc;QACjB,OAAO,kBAAgB,CAAC,YAAY,CAAC,OAAO,CAAC,gCAAgC,CAAC,CAAC;IAChF,CAAC;CACD,CAAA;AAvFA;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;iDACZ;AAYhB;IADC,QAAQ,EAAE;2DACY;AAavB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;wDACR;AAYnB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;uDACT;AAGX;IADN,IAAI,CAAC,uBAAuB,CAAC;4CACE;AA3D3B,gBAAgB;IApCrB,aAAa,CAAC;QACd,GAAG,EAAE,0BAA0B;QAC/B,aAAa,EAAE,IAAI;QACnB,QAAQ,EAAE,WAAW;QACrB,QAAQ,EAAE,wBAAwB;QAClC,MAAM,EAAE,CAAC,mBAAmB,CAAC;QAC7B,YAAY,EAAE;YACb,UAAU;YACV,YAAY;YACZ,OAAO;YACP,aAAa;YACb,aAAa;SACb;KACD,CAAC;IAEF;;;;OAIG;;IACF,KAAK,CAAC,gBAAgB,CAAC;IAExB;;;;OAIG;;IACF,KAAK,CAAC,cAAc,CAAC;IAEtB;;;;OAIG;;IACF,KAAK,CAAC,iBAAiB,CAAC;GAEnB,gBAAgB,CA0GrB;AAED,gBAAgB,CAAC,MAAM,EAAE,CAAC;AAE1B,eAAe,gBAAgB,CAAC","sourcesContent":["import 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 { i18n } from \"@ui5/webcomponents-base/dist/decorators.js\";\nimport jsxRenderer from \"@ui5/webcomponents-base/dist/renderer/JsxRenderer.js\";\nimport UI5Element from \"@ui5/webcomponents-base/dist/UI5Element.js\";\nimport announce from \"@ui5/webcomponents-base/dist/util/InvisibleMessage.js\";\nimport type I18nBundle from \"@ui5/webcomponents-base/dist/i18nBundle.js\";\nimport {\n\tWRITING_ASSISTANT_LABEL,\n\tVERSIONING_PREVIOUS_BUTTON_TEXT,\n\tVERSIONING_NEXT_BUTTON_TEXT,\n\tWRITING_ASSISTANT_GENERATING_ANNOUNCEMENT,\n\tWRITING_ASSISTANT_TOOLBAR_ACCESSIBLE_NAME,\n\tWRITING_ASSISTANT_BUTTON_ACCESSIBLE_NAME,\n\tWRITING_ASSISTANT_BUTTON_TOOLTIP,\n} from \"./generated/i18n/i18n-defaults.js\";\n\n// Styles\nimport WritingAssistantCss from \"./generated/themes/WritingAssistant.css.js\";\n\n// Templates\nimport WritingAssistantTemplate from \"./WritingAssistantTemplate.js\";\nimport Versioning from \"./Versioning.js\";\nimport ToolbarLabel from \"./ToolbarLabel.js\";\n\n// UI5 Components\nimport Toolbar from \"@ui5/webcomponents/dist/Toolbar.js\";\nimport ToolbarSpacer from \"@ui5/webcomponents/dist/ToolbarSpacer.js\";\nimport ToolbarButton from \"@ui5/webcomponents/dist/ToolbarButton.js\";\n\n// Icons\nimport \"@ui5/webcomponents-icons/dist/ai.js\";\nimport \"@ui5/webcomponents-icons/dist/stop.js\";\n\n/**\n * @class\n *\n * ### Overview\n *\n * The `ui5-ai-textarea-toolbar` component provides a specialized toolbar for AI TextArea functionality.\n * It manages different states of the AI assistant and provides version navigation capabilities.\n *\n * ### Structure\n * The `ui5-ai-textarea-toolbar` consists of the following elements:\n * - AI Generate Button: Triggers AI text generation or stops ongoing generation\n * - Version Navigation: Allows navigation between multiple AI-generated results\n * - Action Label: Displays the current AI action being performed\n *\n * ### ES6 Module Import\n *\n * `import \"@sap-webcomponents/ai/dist/WritingAssistant.js\";`\n *\n * @constructor\n * @extends UI5Element\n * @since 2.16.0\n * @private\n */\n@customElement({\n\ttag: \"ui5-ai-writing-assistant\",\n\tlanguageAware: true,\n\trenderer: jsxRenderer,\n\ttemplate: WritingAssistantTemplate,\n\tstyles: [WritingAssistantCss],\n\tdependencies: [\n\t\tVersioning,\n\t\tToolbarLabel,\n\t\tToolbar,\n\t\tToolbarSpacer,\n\t\tToolbarButton,\n\t],\n})\n\n/**\n * Fired when the user clicks on version navigation buttons.\n *\n * @public\n */\n@event(\"version-change\")\n\n/**\n * Fired when the user clicks on the AI button.\n *\n * @public\n */\n@event(\"button-click\")\n\n/**\n * Fired when the user clicks on the \"Stop\" button to stop ongoing AI text generation.\n *\n * @public\n */\n@event(\"stop-generation\")\n\nclass WritingAssistant extends UI5Element {\n\teventDetails!: {\n\t\t\"version-change\": {\n\t\t\tbackwards: boolean;\n\t\t};\n\t\t\"button-click\": {\n\t\t\tclickTarget: HTMLElement;\n\t\t};\n\t\t\"stop-generation\": object;\n\t};\n\n\t/**\n\t * Defines whether the Writing Assistant is currently loading.\n\t *\n\t * When `true`, indicates that an AI action is in progress.\n\t *\n\t * @default false\n\t */\n\t@property({ type: Boolean })\n\tloading = false;\n\n\t/**\n\t * Defines the prompt description of the Writing Assistant.\n\t *\n\t * This text is displayed in the toolbar to indicate the current or last\n\t * performed AI action (e.g., \"Generated text\", \"Simplified text\").\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 result version.\n\t *\n\t * The index is **0-based** (i.e. `0` represents the first result).\n\t * This property is synchronized with the parent AI TextArea component.\n\t *\n\t * @default 0\n\t * @public\n\t * @since 2.16.0\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 * This property determines whether version navigation controls are displayed.\n\t * When totalVersions > 0, previous/next buttons become available.\n\t *\n\t * @default 0\n\t * @public\n\t */\n\t@property({ type: Number })\n\ttotalVersions = 0;\n\n\t@i18n(\"@ui5/webcomponents-ai\")\n\tstatic i18nBundleAi: I18nBundle;\n\n\t/**\n\t * Handles the version change event from the versioning component.\n\t */\n\thandleVersionChange(e: CustomEvent<{ backwards: boolean }>) {\n\t\tthis.fireDecoratorEvent(\"version-change\", { backwards: e.detail.backwards });\n\t}\n\n\t/**\n\t * Handles the click event for the AI generate button.\n\t * Toggles between generate and stop states based on current button state.\n\t *\n\t * @public\n\t */\n\thandleButtonClick(e: Event): void {\n\t\tconst target = e.target as HTMLElement & { dataset?: { state?: string } };\n\t\tif (target?.dataset?.state === \"generating\") {\n\t\t\tthis.fireDecoratorEvent(\"stop-generation\");\n\t\t} else {\n\t\t\tthis.fireDecoratorEvent(\"button-click\", { clickTarget: target });\n\t\t\tannounce(WritingAssistant.i18nBundleAi.getText(WRITING_ASSISTANT_GENERATING_ANNOUNCEMENT), \"Polite\");\n\t\t}\n\t}\n\tget _ariaLabel() {\n\t\treturn WritingAssistant.i18nBundleAi.getText(WRITING_ASSISTANT_LABEL);\n\t}\n\n\tget _previousButtonAccessibleName() {\n\t\treturn WritingAssistant.i18nBundleAi.getText(VERSIONING_PREVIOUS_BUTTON_TEXT);\n\t}\n\n\tget _nextButtonAccessibleName() {\n\t\treturn WritingAssistant.i18nBundleAi.getText(VERSIONING_NEXT_BUTTON_TEXT);\n\t}\n\n\tget _toolbarAccessibleName() {\n\t\treturn WritingAssistant.i18nBundleAi.getText(WRITING_ASSISTANT_TOOLBAR_ACCESSIBLE_NAME);\n\t}\n\n\tget _buttonAccessibleName() {\n\t\treturn WritingAssistant.i18nBundleAi.getText(WRITING_ASSISTANT_BUTTON_ACCESSIBLE_NAME);\n\t}\n\n\tget _buttonTooltip() {\n\t\treturn WritingAssistant.i18nBundleAi.getText(WRITING_ASSISTANT_BUTTON_TOOLTIP);\n\t}\n}\n\nWritingAssistant.define();\n\nexport default WritingAssistant;\n"]}
|
|
@@ -6,7 +6,7 @@ import ToolbarSpacer from "@ui5/webcomponents/dist/ToolbarSpacer.js";
|
|
|
6
6
|
import ToolbarButton from "@ui5/webcomponents/dist/ToolbarButton.js";
|
|
7
7
|
export default function WritingAssistantTemplate() {
|
|
8
8
|
const isMultiResults = this.totalVersions > 1;
|
|
9
|
-
const hasResults = (this.totalVersions > 0 && this.
|
|
10
|
-
return (_jsxs(Toolbar, { accessibleName: this._toolbarAccessibleName, "aria-roledescription": "toolbar", class: `ui5-ai-writing-assistant-footer-bar${hasResults ? "--with-border" : ""}`, children: [isMultiResults && !this.loading && (_jsx(Versioning, { currentStep: this.
|
|
9
|
+
const hasResults = (this.totalVersions > 0 && this.promptDescription) || this.loading;
|
|
10
|
+
return (_jsxs(Toolbar, { accessibleName: this._toolbarAccessibleName, "aria-roledescription": "toolbar", class: `ui5-ai-writing-assistant-footer-bar${hasResults ? "--with-border" : ""}`, children: [isMultiResults && !this.loading && (_jsx(Versioning, { currentStep: this.currentVersion + 1, totalSteps: this.totalVersions, "onVersion-change": this.handleVersionChange })), hasResults && this.promptDescription && (_jsx(ToolbarLabel, { text: this.promptDescription, class: "ui5-ai-writing-assistant-action-label" })), _jsx(ToolbarSpacer, {}), _jsx(ToolbarButton, { id: "ai-menu-btn", design: "Transparent", icon: this.loading ? "stop" : "ai", "data-state": this.loading ? "generating" : "generate", onClick: this.handleButtonClick, tooltip: this._buttonTooltip, accessibilityAttributes: { hasPopup: this.loading ? "false" : "menu" }, accessibleName: this._buttonAccessibleName, overflowPriority: "NeverOverflow" })] }));
|
|
11
11
|
}
|
|
12
12
|
//# sourceMappingURL=WritingAssistantTemplate.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WritingAssistantTemplate.js","sourceRoot":"","sources":["../src/WritingAssistantTemplate.tsx"],"names":[],"mappings":";AACA,OAAO,UAAU,MAAM,iBAAiB,CAAC;AACzC,OAAO,YAAY,MAAM,mBAAmB,CAAC;AAE7C,OAAO,OAAO,MAAM,oCAAoC,CAAC;AACzD,OAAO,aAAa,MAAM,0CAA0C,CAAC;AACrE,OAAO,aAAa,MAAM,0CAA0C,CAAC;AAErE,MAAM,CAAC,OAAO,UAAU,wBAAwB;IAC/C,MAAM,cAAc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,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,gBACtB,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,UAAU,EACpD,OAAO,EAAE,IAAI,CAAC,iBAAiB,EAC/B,OAAO,EAAE,IAAI,CAAC,cAAc,EAC5B,uBAAuB,EAAE,EAAE,QAAQ,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,EAAE,EACtE,cAAc,EAAE,IAAI,CAAC,qBAAqB,EAC1C,gBAAgB,EAAC,eAAe,GAC/B,IACO,CACV,CAAC;AACH,CAAC","sourcesContent":["import type WritingAssistant from \"./WritingAssistant.js\";\nimport Versioning from \"./Versioning.js\";\nimport ToolbarLabel from \"./ToolbarLabel.js\";\n\nimport Toolbar from \"@ui5/webcomponents/dist/Toolbar.js\";\nimport ToolbarSpacer from \"@ui5/webcomponents/dist/ToolbarSpacer.js\";\nimport ToolbarButton from \"@ui5/webcomponents/dist/ToolbarButton.js\";\n\nexport default function WritingAssistantTemplate(this: WritingAssistant) {\n\tconst isMultiResults = this.totalVersions > 1;\n\tconst hasResults = (this.totalVersions > 0 && this.promptDescription) || this.loading;\n\n\treturn (\n\t\t<Toolbar\n\t\t\taccessibleName={this._toolbarAccessibleName}\n\t\t\taria-roledescription=\"toolbar\"\n\t\t\tclass={`ui5-ai-writing-assistant-footer-bar${hasResults ? \"--with-border\" : \"\"}`}\n\t\t>\n\t\t\t{isMultiResults && !this.loading && (\n\t\t\t\t<Versioning\n\t\t\t\t\tcurrentStep={this.currentVersion + 1}\n\t\t\t\t\ttotalSteps={this.totalVersions}\n\t\t\t\t\tonVersion-change={this.handleVersionChange}\n\t\t\t\t/>\n\t\t\t)}\n\n\t\t\t{hasResults && this.promptDescription && (\n\t\t\t\t<ToolbarLabel\n\t\t\t\t\ttext={this.promptDescription}\n\t\t\t\t\tclass=\"ui5-ai-writing-assistant-action-label\"\n\t\t\t\t/>\n\t\t\t)}\n\n\t\t\t<ToolbarSpacer />\n\n\t\t\t<ToolbarButton\n\t\t\t\tid=\"ai-menu-btn\"\n\t\t\t\tdesign=\"Transparent\"\n\t\t\t\ticon={this.loading ? \"stop\" : \"ai\"}\n\t\t\t\tdata-state={this.loading ? \"generating\" : \"generate\"}\n\t\t\t\tonClick={this.handleButtonClick}\n\t\t\t\ttooltip={this._buttonTooltip}\n\t\t\t\taccessibilityAttributes={{ hasPopup: this.loading ? \"false\" : \"menu\" }}\n\t\t\t\taccessibleName={this._buttonAccessibleName}\n\t\t\t\toverflowPriority=\"NeverOverflow\"\n\t\t\t/>\n\t\t</Toolbar>\n\t);\n}\n"]}
|
package/dist/bundle.esm.js
CHANGED
|
@@ -5,6 +5,6 @@ import "./Assets.js";
|
|
|
5
5
|
import Button from "./Button.js";
|
|
6
6
|
import ButtonState from "./ButtonState.js";
|
|
7
7
|
import PromptInput from "./PromptInput.js";
|
|
8
|
-
import
|
|
8
|
+
import TextArea from "./TextArea.js";
|
|
9
9
|
export default testAssets;
|
|
10
10
|
//# sourceMappingURL=bundle.esm.js.map
|