@ui5/webcomponents-ai 2.15.0 → 2.16.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +25 -0
- package/README.md +1 -0
- package/dist/.tsbuildinfo +1 -1
- package/dist/Button.d.ts +1 -1
- package/dist/Button.js +4 -4
- package/dist/Button.js.map +1 -1
- package/dist/TextArea.d.ts +115 -0
- package/dist/TextArea.js +234 -0
- package/dist/TextArea.js.map +1 -0
- package/dist/TextAreaTemplate.d.ts +2 -0
- package/dist/TextAreaTemplate.js +13 -0
- package/dist/TextAreaTemplate.js.map +1 -0
- package/dist/ToolbarLabel.d.ts +39 -0
- package/dist/ToolbarLabel.js +67 -0
- package/dist/ToolbarLabel.js.map +1 -0
- package/dist/ToolbarLabelTemplate.d.ts +2 -0
- package/dist/ToolbarLabelTemplate.js +5 -0
- package/dist/ToolbarLabelTemplate.js.map +1 -0
- package/dist/Versioning.d.ts +95 -0
- package/dist/Versioning.js +187 -0
- package/dist/Versioning.js.map +1 -0
- package/dist/VersioningTemplate.d.ts +4 -0
- package/dist/VersioningTemplate.js +9 -0
- package/dist/VersioningTemplate.js.map +1 -0
- package/dist/WritingAssistant.d.ts +98 -0
- package/dist/WritingAssistant.js +190 -0
- package/dist/WritingAssistant.js.map +1 -0
- package/dist/WritingAssistantTemplate.d.ts +2 -0
- package/dist/WritingAssistantTemplate.js +12 -0
- package/dist/WritingAssistantTemplate.js.map +1 -0
- package/dist/bundle.esm.js +1 -0
- package/dist/bundle.esm.js.map +1 -1
- package/dist/css/themes/AITextArea.css +1 -0
- package/dist/css/themes/Button.css +1 -1
- package/dist/css/themes/PromptInput.css +1 -1
- package/dist/css/themes/Versioning.css +1 -0
- package/dist/css/themes/WritingAssistant.css +1 -0
- package/dist/custom-elements-internal.json +197 -0
- package/dist/custom-elements.json +183 -0
- package/dist/generated/assets/i18n/messagebundle_en.json +1 -1
- package/dist/generated/i18n/i18n-defaults.d.ts +10 -1
- package/dist/generated/i18n/i18n-defaults.js +10 -1
- package/dist/generated/i18n/i18n-defaults.js.map +1 -1
- package/dist/generated/themes/AITextArea.css.d.ts +2 -0
- package/dist/generated/themes/AITextArea.css.js +8 -0
- package/dist/generated/themes/AITextArea.css.js.map +1 -0
- package/dist/generated/themes/Button.css.d.ts +1 -1
- package/dist/generated/themes/Button.css.js +1 -1
- package/dist/generated/themes/Button.css.js.map +1 -1
- package/dist/generated/themes/PromptInput.css.d.ts +1 -1
- package/dist/generated/themes/PromptInput.css.js +1 -1
- package/dist/generated/themes/PromptInput.css.js.map +1 -1
- package/dist/generated/themes/Versioning.css.d.ts +2 -0
- package/dist/generated/themes/Versioning.css.js +8 -0
- package/dist/generated/themes/Versioning.css.js.map +1 -0
- package/dist/generated/themes/WritingAssistant.css.d.ts +2 -0
- package/dist/generated/themes/WritingAssistant.css.js +8 -0
- package/dist/generated/themes/WritingAssistant.css.js.map +1 -0
- package/dist/vscode.html-custom-data.json +27 -0
- package/dist/web-types.json +78 -1
- package/package-scripts.cjs +0 -1
- package/package.json +8 -8
- package/src/TextArea.css +45 -0
- package/src/TextAreaTemplate.tsx +90 -0
- package/src/ToolbarLabelTemplate.tsx +9 -0
- package/src/VersioningTemplate.tsx +34 -0
- package/src/WritingAssistantTemplate.tsx +49 -0
- package/src/i18n/messagebundle.properties +26 -0
- package/src/i18n/messagebundle_en.properties +1 -0
- package/src/themes/AITextArea.css +45 -0
- package/src/themes/PromptInput.css +5 -1
- package/src/themes/Versioning.css +20 -0
- package/src/themes/WritingAssistant.css +45 -0
|
@@ -0,0 +1,67 @@
|
|
|
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
|
+
import jsxRenderer from "@ui5/webcomponents-base/dist/renderer/JsxRenderer.js";
|
|
8
|
+
import customElement from "@ui5/webcomponents-base/dist/decorators/customElement.js";
|
|
9
|
+
import property from "@ui5/webcomponents-base/dist/decorators/property.js";
|
|
10
|
+
import ToolbarItem from "@ui5/webcomponents/dist/ToolbarItem.js";
|
|
11
|
+
import ToolbarLabelTemplate from "./ToolbarLabelTemplate.js";
|
|
12
|
+
/**
|
|
13
|
+
* @class
|
|
14
|
+
*
|
|
15
|
+
* ### Overview
|
|
16
|
+
* The `ui5-ai-toolbar-label` represents a text label,
|
|
17
|
+
* used in the `ui5-toolbar`.
|
|
18
|
+
*
|
|
19
|
+
* ### ES6 Module Import
|
|
20
|
+
* `import "@ui5/webcomponents-ai/dist/ToolbarLabel.js";`
|
|
21
|
+
* @constructor
|
|
22
|
+
* @extends ToolbarItem
|
|
23
|
+
* @private
|
|
24
|
+
* @since 1.0.0-rc.1
|
|
25
|
+
*/
|
|
26
|
+
let ToolbarLabel = class ToolbarLabel extends ToolbarItem {
|
|
27
|
+
constructor() {
|
|
28
|
+
super(...arguments);
|
|
29
|
+
/**
|
|
30
|
+
* Defines the text of the label.
|
|
31
|
+
* @default ""
|
|
32
|
+
* @public
|
|
33
|
+
*/
|
|
34
|
+
this.text = "";
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* @override
|
|
38
|
+
* ToolbarLabel is not interactive.
|
|
39
|
+
*/
|
|
40
|
+
get isInteractive() {
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* @override
|
|
45
|
+
*/
|
|
46
|
+
get classes() {
|
|
47
|
+
return {
|
|
48
|
+
root: {
|
|
49
|
+
...super.classes.root,
|
|
50
|
+
"ui5-ai-tb-label": true,
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
__decorate([
|
|
56
|
+
property()
|
|
57
|
+
], ToolbarLabel.prototype, "text", void 0);
|
|
58
|
+
ToolbarLabel = __decorate([
|
|
59
|
+
customElement({
|
|
60
|
+
tag: "ui5-ai-toolbar-label",
|
|
61
|
+
template: ToolbarLabelTemplate,
|
|
62
|
+
renderer: jsxRenderer,
|
|
63
|
+
})
|
|
64
|
+
], ToolbarLabel);
|
|
65
|
+
ToolbarLabel.define();
|
|
66
|
+
export default ToolbarLabel;
|
|
67
|
+
//# sourceMappingURL=ToolbarLabel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToolbarLabel.js","sourceRoot":"","sources":["../src/ToolbarLabel.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,WAAW,MAAM,sDAAsD,CAAC;AAC/E,OAAO,aAAa,MAAM,0DAA0D,CAAC;AACrF,OAAO,QAAQ,MAAM,qDAAqD,CAAC;AAE3E,OAAO,WAAW,MAAM,wCAAwC,CAAC;AACjE,OAAO,oBAAoB,MAAM,2BAA2B,CAAC;AAE7D;;;;;;;;;;;;;GAaG;AAMH,IAAM,YAAY,GAAlB,MAAM,YAAa,SAAQ,WAAW;IAAtC;;QACC;;;;WAIG;QAEH,SAAI,GAAG,EAAE,CAAC;IAqBX,CAAC;IAnBA;;;OAGG;IACH,IAAI,aAAa;QAChB,OAAO,KAAK,CAAC;IACd,CAAC;IAED;;OAEG;IACH,IAAI,OAAO;QACV,OAAO;YACN,IAAI,EAAE;gBACL,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI;gBACrB,iBAAiB,EAAE,IAAI;aACvB;SACD,CAAC;IACH,CAAC;CACD,CAAA;AArBA;IADC,QAAQ,EAAE;0CACD;AAPL,YAAY;IALjB,aAAa,CAAC;QACd,GAAG,EAAE,sBAAsB;QAC3B,QAAQ,EAAE,oBAAoB;QAC9B,QAAQ,EAAE,WAAW;KACrB,CAAC;GACI,YAAY,CA4BjB;AAED,YAAY,CAAC,MAAM,EAAE,CAAC;AAEtB,eAAe,YAAY,CAAC","sourcesContent":["import jsxRenderer from \"@ui5/webcomponents-base/dist/renderer/JsxRenderer.js\";\nimport customElement from \"@ui5/webcomponents-base/dist/decorators/customElement.js\";\nimport property from \"@ui5/webcomponents-base/dist/decorators/property.js\";\n\nimport ToolbarItem from \"@ui5/webcomponents/dist/ToolbarItem.js\";\nimport ToolbarLabelTemplate from \"./ToolbarLabelTemplate.js\";\n\n/**\n * @class\n *\n * ### Overview\n * The `ui5-ai-toolbar-label` represents a text label,\n * used in the `ui5-toolbar`.\n *\n * ### ES6 Module Import\n * `import \"@ui5/webcomponents-ai/dist/ToolbarLabel.js\";`\n * @constructor\n * @extends ToolbarItem\n * @private\n * @since 1.0.0-rc.1\n */\n@customElement({\n\ttag: \"ui5-ai-toolbar-label\",\n\ttemplate: ToolbarLabelTemplate,\n\trenderer: jsxRenderer,\n})\nclass ToolbarLabel extends ToolbarItem {\n\t/**\n\t * Defines the text of the label.\n\t * @default \"\"\n\t * @public\n\t */\n\t@property()\n\ttext = \"\";\n\n\t/**\n\t * @override\n\t * ToolbarLabel is not interactive.\n\t */\n\tget isInteractive(): boolean {\n\t\treturn false;\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-tb-label\": true,\n\t\t\t},\n\t\t};\n\t}\n}\n\nToolbarLabel.define();\n\nexport default ToolbarLabel;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToolbarLabelTemplate.js","sourceRoot":"","sources":["../src/ToolbarLabelTemplate.tsx"],"names":[],"mappings":";AAEA,MAAM,CAAC,OAAO,UAAU,oBAAoB;IAC3C,OAAO,CACN,eAAM,KAAK,EAAC,sBAAsB,YAChC,IAAI,CAAC,IAAI,GACJ,CACP,CAAC;AACH,CAAC","sourcesContent":["import type ToolbarLabel from \"./ToolbarLabel.js\";\n\nexport default function ToolbarLabelTemplate(this: ToolbarLabel) {\n\treturn (\n\t\t<span class=\"ui5-ai-toolbar-label\">\n\t\t\t{this.text}\n\t\t</span>\n\t);\n}\n"]}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import ToolbarItem from "@ui5/webcomponents/dist/ToolbarItem.js";
|
|
2
|
+
import type I18nBundle from "@ui5/webcomponents-base/dist/i18nBundle.js";
|
|
3
|
+
import "@ui5/webcomponents-icons/dist/navigation-left-arrow.js";
|
|
4
|
+
import "@ui5/webcomponents-icons/dist/navigation-right-arrow.js";
|
|
5
|
+
declare enum LastClickedButton {
|
|
6
|
+
None = "",
|
|
7
|
+
Previous = "previous",
|
|
8
|
+
Next = "next"
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* @class
|
|
12
|
+
*
|
|
13
|
+
* ### Overview
|
|
14
|
+
*
|
|
15
|
+
* The `ui5-ai-versioning` component provides navigation controls for AI-generated content versions.
|
|
16
|
+
* It displays the current version index and total versions, with previous/next navigation buttons.
|
|
17
|
+
* This component extends ToolbarItem to participate in toolbar overflow behavior as a single unit.
|
|
18
|
+
*
|
|
19
|
+
* ### Structure
|
|
20
|
+
* The `ui5-ai-versioning` consists of the following elements:
|
|
21
|
+
* - Previous Button: Navigates to the previous version (disabled when at first version)
|
|
22
|
+
* - Version Counter: Shows current version / total versions (e.g., "2 / 5")
|
|
23
|
+
* - Next Button: Navigates to the nex
|
|
24
|
+
* t version (disabled when at last version)
|
|
25
|
+
*
|
|
26
|
+
* ### Focus Management
|
|
27
|
+
* The component automatically manages focus when users reach version boundaries,
|
|
28
|
+
* moving focus to the available navigation button when one becomes disabled.
|
|
29
|
+
*
|
|
30
|
+
* ### Responsive Behavior
|
|
31
|
+
* When used in a toolbar, the entire versioning component (buttons + label) will overflow
|
|
32
|
+
* together as a single unit when there is insufficient space.
|
|
33
|
+
*
|
|
34
|
+
* ### ES6 Module Import
|
|
35
|
+
*
|
|
36
|
+
* `import "@ui5/webcomponents-ai/dist/Versioning.js";`
|
|
37
|
+
*
|
|
38
|
+
* @constructor
|
|
39
|
+
* @extends ToolbarItem
|
|
40
|
+
* @since 2.16.0
|
|
41
|
+
* @private
|
|
42
|
+
*/
|
|
43
|
+
declare class Versioning extends ToolbarItem {
|
|
44
|
+
eventDetails: ToolbarItem["eventDetails"] & {
|
|
45
|
+
"version-change": {
|
|
46
|
+
backwards: boolean;
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* Indicates the index of the currently displayed result version.
|
|
51
|
+
*
|
|
52
|
+
* This property represents the current position in the version history.
|
|
53
|
+
* @default 0
|
|
54
|
+
* @public
|
|
55
|
+
*/
|
|
56
|
+
currentStep: number;
|
|
57
|
+
/**
|
|
58
|
+
* The total number of available result versions.
|
|
59
|
+
*
|
|
60
|
+
* Note: Versioning is hidden if the value is `0`.
|
|
61
|
+
*
|
|
62
|
+
* @default 0
|
|
63
|
+
* @public
|
|
64
|
+
*/
|
|
65
|
+
totalSteps: number;
|
|
66
|
+
_previousCurrentStep: number;
|
|
67
|
+
_previousTotalSteps: number;
|
|
68
|
+
_lastClickedButton: LastClickedButton;
|
|
69
|
+
static i18nBundle: I18nBundle;
|
|
70
|
+
static onDefine(): Promise<void>;
|
|
71
|
+
onAfterRendering(): void;
|
|
72
|
+
/**
|
|
73
|
+
* Manages focus when navigation buttons become disabled/enabled.
|
|
74
|
+
* Automatically moves focus to available button when user reaches boundaries.
|
|
75
|
+
* @private
|
|
76
|
+
*/
|
|
77
|
+
_manageFocus(): void;
|
|
78
|
+
handlePreviousVersionClick(): void;
|
|
79
|
+
handleNextVersionClick(): void;
|
|
80
|
+
get _previousButtonAccessibleName(): string;
|
|
81
|
+
get _nextButtonAccessibleName(): string;
|
|
82
|
+
get _previousButtonTooltip(): string;
|
|
83
|
+
get _nextButtonTooltip(): string;
|
|
84
|
+
/**
|
|
85
|
+
* @override
|
|
86
|
+
*/
|
|
87
|
+
get classes(): {
|
|
88
|
+
root: {
|
|
89
|
+
"ui5-ai-versioning": boolean;
|
|
90
|
+
"ui5-tb-popover-item": boolean;
|
|
91
|
+
"ui5-tb-item": boolean;
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
export default Versioning;
|
|
@@ -0,0 +1,187 @@
|
|
|
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 Versioning_1;
|
|
8
|
+
import ToolbarItem from "@ui5/webcomponents/dist/ToolbarItem.js";
|
|
9
|
+
import customElement from "@ui5/webcomponents-base/dist/decorators/customElement.js";
|
|
10
|
+
import property from "@ui5/webcomponents-base/dist/decorators/property.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 { getI18nBundle } from "@ui5/webcomponents-base/dist/i18nBundle.js";
|
|
14
|
+
import { VERSIONING_PREVIOUS_BUTTON_TEXT, VERSIONING_NEXT_BUTTON_TEXT, VERSIONING_PREVIOUS_BUTTON_TOOLTIP, VERSIONING_NEXT_BUTTON_TOOLTIP, } from "./generated/i18n/i18n-defaults.js";
|
|
15
|
+
// UI5 Components
|
|
16
|
+
import Button from "@ui5/webcomponents/dist/Button.js";
|
|
17
|
+
import Label from "@ui5/webcomponents/dist/Label.js";
|
|
18
|
+
import ToolbarButton from "@ui5/webcomponents/dist/ToolbarButton.js";
|
|
19
|
+
import ToolbarLabel from "./ToolbarLabel.js";
|
|
20
|
+
// Types
|
|
21
|
+
import VersioningTemplate from "./VersioningTemplate.js";
|
|
22
|
+
// Styles
|
|
23
|
+
import VersioningCss from "./generated/themes/Versioning.css.js";
|
|
24
|
+
// Icons
|
|
25
|
+
import "@ui5/webcomponents-icons/dist/navigation-left-arrow.js";
|
|
26
|
+
import "@ui5/webcomponents-icons/dist/navigation-right-arrow.js";
|
|
27
|
+
var LastClickedButton;
|
|
28
|
+
(function (LastClickedButton) {
|
|
29
|
+
LastClickedButton["None"] = "";
|
|
30
|
+
LastClickedButton["Previous"] = "previous";
|
|
31
|
+
LastClickedButton["Next"] = "next";
|
|
32
|
+
})(LastClickedButton || (LastClickedButton = {}));
|
|
33
|
+
/**
|
|
34
|
+
* @class
|
|
35
|
+
*
|
|
36
|
+
* ### Overview
|
|
37
|
+
*
|
|
38
|
+
* The `ui5-ai-versioning` component provides navigation controls for AI-generated content versions.
|
|
39
|
+
* It displays the current version index and total versions, with previous/next navigation buttons.
|
|
40
|
+
* This component extends ToolbarItem to participate in toolbar overflow behavior as a single unit.
|
|
41
|
+
*
|
|
42
|
+
* ### Structure
|
|
43
|
+
* The `ui5-ai-versioning` consists of the following elements:
|
|
44
|
+
* - Previous Button: Navigates to the previous version (disabled when at first version)
|
|
45
|
+
* - Version Counter: Shows current version / total versions (e.g., "2 / 5")
|
|
46
|
+
* - Next Button: Navigates to the nex
|
|
47
|
+
* t version (disabled when at last version)
|
|
48
|
+
*
|
|
49
|
+
* ### Focus Management
|
|
50
|
+
* The component automatically manages focus when users reach version boundaries,
|
|
51
|
+
* moving focus to the available navigation button when one becomes disabled.
|
|
52
|
+
*
|
|
53
|
+
* ### Responsive Behavior
|
|
54
|
+
* When used in a toolbar, the entire versioning component (buttons + label) will overflow
|
|
55
|
+
* together as a single unit when there is insufficient space.
|
|
56
|
+
*
|
|
57
|
+
* ### ES6 Module Import
|
|
58
|
+
*
|
|
59
|
+
* `import "@ui5/webcomponents-ai/dist/Versioning.js";`
|
|
60
|
+
*
|
|
61
|
+
* @constructor
|
|
62
|
+
* @extends ToolbarItem
|
|
63
|
+
* @since 2.16.0
|
|
64
|
+
* @private
|
|
65
|
+
*/
|
|
66
|
+
let Versioning = Versioning_1 = class Versioning extends ToolbarItem {
|
|
67
|
+
constructor() {
|
|
68
|
+
super(...arguments);
|
|
69
|
+
/**
|
|
70
|
+
* Indicates the index of the currently displayed result version.
|
|
71
|
+
*
|
|
72
|
+
* This property represents the current position in the version history.
|
|
73
|
+
* @default 0
|
|
74
|
+
* @public
|
|
75
|
+
*/
|
|
76
|
+
this.currentStep = 0;
|
|
77
|
+
/**
|
|
78
|
+
* The total number of available result versions.
|
|
79
|
+
*
|
|
80
|
+
* Note: Versioning is hidden if the value is `0`.
|
|
81
|
+
*
|
|
82
|
+
* @default 0
|
|
83
|
+
* @public
|
|
84
|
+
*/
|
|
85
|
+
this.totalSteps = 0;
|
|
86
|
+
this._previousCurrentStep = 0;
|
|
87
|
+
this._previousTotalSteps = 0;
|
|
88
|
+
this._lastClickedButton = LastClickedButton.None;
|
|
89
|
+
}
|
|
90
|
+
static async onDefine() {
|
|
91
|
+
Versioning_1.i18nBundle = await getI18nBundle("@ui5/webcomponents-ai");
|
|
92
|
+
}
|
|
93
|
+
onAfterRendering() {
|
|
94
|
+
this._manageFocus();
|
|
95
|
+
this._previousCurrentStep = this.currentStep;
|
|
96
|
+
this._previousTotalSteps = this.totalSteps;
|
|
97
|
+
this._lastClickedButton = LastClickedButton.None;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Manages focus when navigation buttons become disabled/enabled.
|
|
101
|
+
* Automatically moves focus to available button when user reaches boundaries.
|
|
102
|
+
* @private
|
|
103
|
+
*/
|
|
104
|
+
_manageFocus() {
|
|
105
|
+
if (!this.shadowRoot) {
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
const previousButton = this.shadowRoot.querySelector("[data-ui5-versioning-button=\"previous\"]");
|
|
109
|
+
const nextButton = this.shadowRoot.querySelector("[data-ui5-versioning-button=\"next\"]");
|
|
110
|
+
if (!previousButton || !nextButton) {
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
const isPreviousDisabled = this.currentStep <= 1;
|
|
114
|
+
const isNextDisabled = this.currentStep === this.totalSteps;
|
|
115
|
+
const wasPreviousDisabled = this._previousCurrentStep <= 1;
|
|
116
|
+
const wasNextDisabled = this._previousCurrentStep === this._previousTotalSteps;
|
|
117
|
+
if (isPreviousDisabled && !wasPreviousDisabled && !isNextDisabled && this._lastClickedButton === LastClickedButton.Previous && nextButton instanceof HTMLElement) {
|
|
118
|
+
nextButton.focus();
|
|
119
|
+
this._lastClickedButton = LastClickedButton.None;
|
|
120
|
+
}
|
|
121
|
+
else if (isNextDisabled && !wasNextDisabled && !isPreviousDisabled && this._lastClickedButton === LastClickedButton.Next && previousButton instanceof HTMLElement) {
|
|
122
|
+
previousButton.focus();
|
|
123
|
+
this._lastClickedButton = LastClickedButton.None;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
handlePreviousVersionClick() {
|
|
127
|
+
this._lastClickedButton = LastClickedButton.Previous;
|
|
128
|
+
this.fireDecoratorEvent("version-change", { backwards: true });
|
|
129
|
+
}
|
|
130
|
+
handleNextVersionClick() {
|
|
131
|
+
this._lastClickedButton = LastClickedButton.Next;
|
|
132
|
+
this.fireDecoratorEvent("version-change", { backwards: false });
|
|
133
|
+
}
|
|
134
|
+
get _previousButtonAccessibleName() {
|
|
135
|
+
return Versioning_1.i18nBundle.getText(VERSIONING_PREVIOUS_BUTTON_TEXT);
|
|
136
|
+
}
|
|
137
|
+
get _nextButtonAccessibleName() {
|
|
138
|
+
return Versioning_1.i18nBundle.getText(VERSIONING_NEXT_BUTTON_TEXT);
|
|
139
|
+
}
|
|
140
|
+
get _previousButtonTooltip() {
|
|
141
|
+
return Versioning_1.i18nBundle.getText(VERSIONING_PREVIOUS_BUTTON_TOOLTIP);
|
|
142
|
+
}
|
|
143
|
+
get _nextButtonTooltip() {
|
|
144
|
+
return Versioning_1.i18nBundle.getText(VERSIONING_NEXT_BUTTON_TOOLTIP);
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* @override
|
|
148
|
+
*/
|
|
149
|
+
get classes() {
|
|
150
|
+
return {
|
|
151
|
+
root: {
|
|
152
|
+
...super.classes.root,
|
|
153
|
+
"ui5-ai-versioning": true,
|
|
154
|
+
},
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
__decorate([
|
|
159
|
+
property({ type: Number })
|
|
160
|
+
], Versioning.prototype, "currentStep", void 0);
|
|
161
|
+
__decorate([
|
|
162
|
+
property({ type: Number })
|
|
163
|
+
], Versioning.prototype, "totalSteps", void 0);
|
|
164
|
+
Versioning = Versioning_1 = __decorate([
|
|
165
|
+
customElement({
|
|
166
|
+
tag: "ui5-ai-versioning",
|
|
167
|
+
renderer: jsxRenderer,
|
|
168
|
+
styles: VersioningCss,
|
|
169
|
+
template: VersioningTemplate,
|
|
170
|
+
dependencies: [
|
|
171
|
+
Button,
|
|
172
|
+
Label,
|
|
173
|
+
ToolbarButton,
|
|
174
|
+
ToolbarLabel,
|
|
175
|
+
],
|
|
176
|
+
})
|
|
177
|
+
/**
|
|
178
|
+
* Fired when the user clicks on version navigation buttons.
|
|
179
|
+
*
|
|
180
|
+
* @public
|
|
181
|
+
*/
|
|
182
|
+
,
|
|
183
|
+
event("version-change")
|
|
184
|
+
], Versioning);
|
|
185
|
+
Versioning.define();
|
|
186
|
+
export default Versioning;
|
|
187
|
+
//# sourceMappingURL=Versioning.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Versioning.js","sourceRoot":"","sources":["../src/Versioning.ts"],"names":[],"mappings":";;;;;;;AAAA,OAAO,WAAW,MAAM,wCAAwC,C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Aa,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"]}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type Versioning from "./Versioning.js";
|
|
2
|
+
import "@ui5/webcomponents-icons/dist/navigation-left-arrow.js";
|
|
3
|
+
import "@ui5/webcomponents-icons/dist/navigation-right-arrow.js";
|
|
4
|
+
export default function VersioningTemplate(this: Versioning): import("@ui5/webcomponents-base/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "@ui5/webcomponents-base/jsx-runtime";
|
|
2
|
+
import ToolbarLabel from "./ToolbarLabel.js";
|
|
3
|
+
import ToolbarButton from "@ui5/webcomponents/dist/ToolbarButton.js";
|
|
4
|
+
import "@ui5/webcomponents-icons/dist/navigation-left-arrow.js";
|
|
5
|
+
import "@ui5/webcomponents-icons/dist/navigation-right-arrow.js";
|
|
6
|
+
export default function VersioningTemplate() {
|
|
7
|
+
return (_jsxs(_Fragment, { children: [_jsx(ToolbarButton, { design: "Transparent", icon: "navigation-left-arrow", tooltip: this._previousButtonTooltip, accessibleName: this._previousButtonAccessibleName, disabled: this.currentStep <= 1, onClick: this.handlePreviousVersionClick, "data-ui5-versioning-button": "previous" }), _jsx(ToolbarLabel, { text: `${this.currentStep} / ${this.totalSteps}`, class: "version-step-counter" }), _jsx(ToolbarButton, { design: "Transparent", icon: "navigation-right-arrow", tooltip: this._nextButtonTooltip, accessibleName: this._nextButtonAccessibleName, disabled: this.totalSteps <= 0 || this.currentStep >= this.totalSteps, onClick: this.handleNextVersionClick, "data-ui5-versioning-button": "next" })] }));
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=VersioningTemplate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VersioningTemplate.js","sourceRoot":"","sources":["../src/VersioningTemplate.tsx"],"names":[],"mappings":";AACA,OAAO,YAAY,MAAM,mBAAmB,CAAC;AAC7C,OAAO,aAAa,MAAM,0CAA0C,CAAC;AACrE,OAAO,wDAAwD,CAAC;AAChE,OAAO,yDAAyD,CAAC;AAEjE,MAAM,CAAC,OAAO,UAAU,kBAAkB;IACzC,OAAO,CACN,8BACC,KAAC,aAAa,IACb,MAAM,EAAC,aAAa,EACpB,IAAI,EAAC,uBAAuB,EAC5B,OAAO,EAAE,IAAI,CAAC,sBAAsB,EACpC,cAAc,EAAE,IAAI,CAAC,6BAA6B,EAClD,QAAQ,EAAE,IAAI,CAAC,WAAW,IAAI,CAAC,EAC/B,OAAO,EAAE,IAAI,CAAC,0BAA0B,gCACb,UAAU,GACpC,EACF,KAAC,YAAY,IACZ,IAAI,EAAE,GAAG,IAAI,CAAC,WAAW,MAAM,IAAI,CAAC,UAAU,EAAE,EAChD,KAAK,EAAC,sBAAsB,GAC3B,EACF,KAAC,aAAa,IACb,MAAM,EAAC,aAAa,EACpB,IAAI,EAAC,wBAAwB,EAC7B,OAAO,EAAE,IAAI,CAAC,kBAAkB,EAChC,cAAc,EAAE,IAAI,CAAC,yBAAyB,EAC9C,QAAQ,EAAE,IAAI,CAAC,UAAU,IAAI,CAAC,IAAI,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,UAAU,EACrE,OAAO,EAAE,IAAI,CAAC,sBAAsB,gCACT,MAAM,GAChC,IACA,CACH,CAAC;AACH,CAAC","sourcesContent":["import type Versioning from \"./Versioning.js\";\nimport ToolbarLabel from \"./ToolbarLabel.js\";\nimport ToolbarButton from \"@ui5/webcomponents/dist/ToolbarButton.js\";\nimport \"@ui5/webcomponents-icons/dist/navigation-left-arrow.js\";\nimport \"@ui5/webcomponents-icons/dist/navigation-right-arrow.js\";\n\nexport default function VersioningTemplate(this: Versioning) {\n\treturn (\n\t\t<>\n\t\t\t<ToolbarButton\n\t\t\t\tdesign=\"Transparent\"\n\t\t\t\ticon=\"navigation-left-arrow\"\n\t\t\t\ttooltip={this._previousButtonTooltip}\n\t\t\t\taccessibleName={this._previousButtonAccessibleName}\n\t\t\t\tdisabled={this.currentStep <= 1}\n\t\t\t\tonClick={this.handlePreviousVersionClick}\n\t\t\t\tdata-ui5-versioning-button=\"previous\"\n\t\t\t/>\n\t\t\t<ToolbarLabel\n\t\t\t\ttext={`${this.currentStep} / ${this.totalSteps}`}\n\t\t\t\tclass=\"version-step-counter\"\n\t\t\t/>\n\t\t\t<ToolbarButton\n\t\t\t\tdesign=\"Transparent\"\n\t\t\t\ticon=\"navigation-right-arrow\"\n\t\t\t\ttooltip={this._nextButtonTooltip}\n\t\t\t\taccessibleName={this._nextButtonAccessibleName}\n\t\t\t\tdisabled={this.totalSteps <= 0 || this.currentStep >= this.totalSteps}\n\t\t\t\tonClick={this.handleNextVersionClick}\n\t\t\t\tdata-ui5-versioning-button=\"next\"\n\t\t\t/>\n\t\t</>\n\t);\n}\n"]}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import UI5Element from "@ui5/webcomponents-base/dist/UI5Element.js";
|
|
2
|
+
import type I18nBundle from "@ui5/webcomponents-base/dist/i18nBundle.js";
|
|
3
|
+
import "@ui5/webcomponents-icons/dist/ai.js";
|
|
4
|
+
import "@ui5/webcomponents-icons/dist/stop.js";
|
|
5
|
+
/**
|
|
6
|
+
* @class
|
|
7
|
+
*
|
|
8
|
+
* ### Overview
|
|
9
|
+
*
|
|
10
|
+
* The `ui5-ai-textarea-toolbar` component provides a specialized toolbar for AI TextArea functionality.
|
|
11
|
+
* It manages different states of the AI assistant and provides version navigation capabilities.
|
|
12
|
+
*
|
|
13
|
+
* ### Structure
|
|
14
|
+
* The `ui5-ai-textarea-toolbar` consists of the following elements:
|
|
15
|
+
* - AI Generate Button: Triggers AI text generation or stops ongoing generation
|
|
16
|
+
* - Version Navigation: Allows navigation between multiple AI-generated results
|
|
17
|
+
* - Action Label: Displays the current AI action being performed
|
|
18
|
+
*
|
|
19
|
+
* ### ES6 Module Import
|
|
20
|
+
*
|
|
21
|
+
* `import "@sap-webcomponents/ai/dist/WritingAssistant.js";`
|
|
22
|
+
*
|
|
23
|
+
* @constructor
|
|
24
|
+
* @extends UI5Element
|
|
25
|
+
* @since 2.16.0
|
|
26
|
+
* @private
|
|
27
|
+
*/
|
|
28
|
+
declare class WritingAssistant extends UI5Element {
|
|
29
|
+
eventDetails: {
|
|
30
|
+
"version-change": {
|
|
31
|
+
backwards: boolean;
|
|
32
|
+
};
|
|
33
|
+
"button-click": {
|
|
34
|
+
clickTarget: HTMLElement;
|
|
35
|
+
};
|
|
36
|
+
"stop-generation": object;
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Defines whether the Writing Assistant is currently loading.
|
|
40
|
+
*
|
|
41
|
+
* When `true`, indicates that an AI action is in progress.
|
|
42
|
+
*
|
|
43
|
+
* @default false
|
|
44
|
+
*/
|
|
45
|
+
loading: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Defines the action text of the AI Writing Assistant.
|
|
48
|
+
*
|
|
49
|
+
* This text is displayed in the toolbar to indicate the current or last
|
|
50
|
+
* performed AI action (e.g., "Generated text", "Simplified text").
|
|
51
|
+
*
|
|
52
|
+
* @default ""
|
|
53
|
+
* @public
|
|
54
|
+
*/
|
|
55
|
+
actionText: string;
|
|
56
|
+
/**
|
|
57
|
+
* Indicates the index of the currently displayed result version.
|
|
58
|
+
*
|
|
59
|
+
* The index is **1-based** (i.e. `1` represents the first result).
|
|
60
|
+
* This property is synchronized with the parent AI TextArea component.
|
|
61
|
+
*
|
|
62
|
+
* @default 1
|
|
63
|
+
* @public
|
|
64
|
+
* @since 2.16.0
|
|
65
|
+
*/
|
|
66
|
+
currentVersionIndex: number;
|
|
67
|
+
/**
|
|
68
|
+
* Indicates the total number of result versions available.
|
|
69
|
+
*
|
|
70
|
+
* This property determines whether version navigation controls are displayed.
|
|
71
|
+
* When totalVersions > 1, previous/next buttons become available.
|
|
72
|
+
*
|
|
73
|
+
* @default 1
|
|
74
|
+
* @public
|
|
75
|
+
*/
|
|
76
|
+
totalVersions: number;
|
|
77
|
+
static i18nBundleAi: I18nBundle;
|
|
78
|
+
/**
|
|
79
|
+
* Handles the version change event from the versioning component.
|
|
80
|
+
*/
|
|
81
|
+
handleVersionChange(e: CustomEvent<{
|
|
82
|
+
backwards: boolean;
|
|
83
|
+
}>): void;
|
|
84
|
+
/**
|
|
85
|
+
* Handles the click event for the AI generate button.
|
|
86
|
+
* Toggles between generate and stop states based on current button state.
|
|
87
|
+
*
|
|
88
|
+
* @public
|
|
89
|
+
*/
|
|
90
|
+
handleButtonClick(e: Event): void;
|
|
91
|
+
get _ariaLabel(): string;
|
|
92
|
+
get _previousButtonAccessibleName(): string;
|
|
93
|
+
get _nextButtonAccessibleName(): string;
|
|
94
|
+
get _toolbarAccessibleName(): string;
|
|
95
|
+
get _buttonAccessibleName(): string;
|
|
96
|
+
get _buttonTooltip(): string;
|
|
97
|
+
}
|
|
98
|
+
export default WritingAssistant;
|