@ui5/webcomponents-ai 0.0.0-dd5d66a9a → 0.0.0-df5b4199a
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/.ui5-cem-aliases.json +4 -0
- package/CHANGELOG.md +152 -0
- package/LICENSE.txt +201 -0
- package/README.md +4 -2
- package/dist/.tsbuildinfo +1 -1
- package/dist/Assets-fetch.js +1 -1
- package/dist/Assets-fetch.js.map +1 -1
- package/dist/Assets-node.js +1 -1
- package/dist/Assets-node.js.map +1 -1
- package/dist/Button.d.ts +1 -1
- package/dist/Button.js +4 -4
- package/dist/Button.js.map +1 -1
- package/dist/Input.d.ts +143 -0
- package/dist/Input.js +288 -0
- package/dist/Input.js.map +1 -0
- package/dist/InputTemplate.d.ts +10 -0
- package/dist/InputTemplate.js +28 -0
- package/dist/InputTemplate.js.map +1 -0
- package/dist/TextArea.d.ts +118 -0
- package/dist/TextArea.js +230 -0
- package/dist/TextArea.js.map +1 -0
- package/dist/TextAreaTemplate.d.ts +2 -0
- package/dist/TextAreaTemplate.js +13 -0
- package/dist/TextAreaTemplate.js.map +1 -0
- package/dist/ToolbarLabel.d.ts +39 -0
- package/dist/ToolbarLabel.js +67 -0
- package/dist/ToolbarLabel.js.map +1 -0
- package/dist/ToolbarLabelTemplate.d.ts +2 -0
- package/dist/ToolbarLabelTemplate.js +5 -0
- package/dist/ToolbarLabelTemplate.js.map +1 -0
- package/dist/Versioning.d.ts +95 -0
- package/dist/Versioning.js +187 -0
- package/dist/Versioning.js.map +1 -0
- package/dist/VersioningTemplate.d.ts +4 -0
- package/dist/VersioningTemplate.js +9 -0
- package/dist/VersioningTemplate.js.map +1 -0
- package/dist/WritingAssistant.d.ts +100 -0
- package/dist/WritingAssistant.js +197 -0
- package/dist/WritingAssistant.js.map +1 -0
- package/dist/WritingAssistantTemplate.d.ts +2 -0
- package/dist/WritingAssistantTemplate.js +12 -0
- package/dist/WritingAssistantTemplate.js.map +1 -0
- package/dist/bundle.esm.js +2 -0
- package/dist/bundle.esm.js.map +1 -1
- package/dist/css/themes/Button.css +1 -1
- package/dist/css/themes/Input.css +1 -0
- package/dist/css/themes/PromptInput.css +1 -1
- package/dist/css/themes/TextArea.css +1 -0
- package/dist/css/themes/Versioning.css +1 -0
- package/dist/css/themes/WritingAssistant.css +1 -0
- package/dist/custom-elements-internal.json +388 -0
- package/dist/custom-elements.json +330 -0
- package/dist/generated/assets/i18n/messagebundle_ar.json +1 -1
- package/dist/generated/assets/i18n/messagebundle_bg.json +1 -1
- package/dist/generated/assets/i18n/messagebundle_ca.json +1 -1
- package/dist/generated/assets/i18n/messagebundle_cnr.json +1 -1
- package/dist/generated/assets/i18n/messagebundle_cs.json +1 -1
- package/dist/generated/assets/i18n/messagebundle_cy.json +1 -1
- package/dist/generated/assets/i18n/messagebundle_da.json +1 -1
- package/dist/generated/assets/i18n/messagebundle_de.json +1 -1
- package/dist/generated/assets/i18n/messagebundle_el.json +1 -1
- package/dist/generated/assets/i18n/messagebundle_en.json +1 -1
- package/dist/generated/assets/i18n/messagebundle_en_GB.json +1 -1
- package/dist/generated/assets/i18n/messagebundle_en_US_sappsd.json +1 -1
- package/dist/generated/assets/i18n/messagebundle_en_US_saprigi.json +1 -1
- package/dist/generated/assets/i18n/messagebundle_en_US_saptrc.json +1 -1
- package/dist/generated/assets/i18n/messagebundle_es.json +1 -1
- package/dist/generated/assets/i18n/messagebundle_es_MX.json +1 -1
- package/dist/generated/assets/i18n/messagebundle_et.json +1 -1
- package/dist/generated/assets/i18n/messagebundle_fi.json +1 -1
- package/dist/generated/assets/i18n/messagebundle_fr.json +1 -1
- package/dist/generated/assets/i18n/messagebundle_fr_CA.json +1 -1
- package/dist/generated/assets/i18n/messagebundle_hi.json +1 -1
- package/dist/generated/assets/i18n/messagebundle_hr.json +1 -1
- package/dist/generated/assets/i18n/messagebundle_hu.json +1 -1
- package/dist/generated/assets/i18n/messagebundle_id.json +1 -1
- package/dist/generated/assets/i18n/messagebundle_it.json +1 -1
- package/dist/generated/assets/i18n/messagebundle_iw.json +1 -1
- package/dist/generated/assets/i18n/messagebundle_ja.json +1 -1
- package/dist/generated/assets/i18n/messagebundle_kk.json +1 -1
- package/dist/generated/assets/i18n/messagebundle_ko.json +1 -1
- package/dist/generated/assets/i18n/messagebundle_lt.json +1 -1
- package/dist/generated/assets/i18n/messagebundle_lv.json +1 -1
- package/dist/generated/assets/i18n/messagebundle_mk.json +1 -1
- package/dist/generated/assets/i18n/messagebundle_ms.json +1 -1
- package/dist/generated/assets/i18n/messagebundle_nl.json +1 -1
- package/dist/generated/assets/i18n/messagebundle_no.json +1 -1
- package/dist/generated/assets/i18n/messagebundle_pl.json +1 -1
- package/dist/generated/assets/i18n/messagebundle_pt.json +1 -1
- package/dist/generated/assets/i18n/messagebundle_pt_PT.json +1 -1
- package/dist/generated/assets/i18n/messagebundle_ro.json +1 -1
- package/dist/generated/assets/i18n/messagebundle_ru.json +1 -1
- package/dist/generated/assets/i18n/messagebundle_sh.json +1 -1
- package/dist/generated/assets/i18n/messagebundle_sk.json +1 -1
- package/dist/generated/assets/i18n/messagebundle_sl.json +1 -1
- package/dist/generated/assets/i18n/messagebundle_sr.json +1 -1
- package/dist/generated/assets/i18n/messagebundle_sv.json +1 -1
- package/dist/generated/assets/i18n/messagebundle_th.json +1 -1
- package/dist/generated/assets/i18n/messagebundle_tr.json +1 -1
- package/dist/generated/assets/i18n/messagebundle_uk.json +1 -1
- package/dist/generated/assets/i18n/messagebundle_vi.json +1 -1
- package/dist/generated/assets/i18n/messagebundle_zh_CN.json +1 -1
- package/dist/generated/assets/i18n/messagebundle_zh_TW.json +1 -1
- package/dist/generated/i18n/i18n-defaults.d.ts +14 -1
- package/dist/generated/i18n/i18n-defaults.js +14 -1
- 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/Input.css.d.ts +2 -0
- package/dist/generated/themes/Input.css.js +8 -0
- package/dist/generated/themes/Input.css.js.map +1 -0
- package/dist/generated/themes/PromptInput.css.d.ts +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/TextArea.css.d.ts +2 -0
- package/dist/generated/themes/TextArea.css.js +8 -0
- package/dist/generated/themes/TextArea.css.js.map +1 -0
- package/dist/generated/themes/Versioning.css.d.ts +2 -0
- package/dist/generated/themes/Versioning.css.js +8 -0
- package/dist/generated/themes/Versioning.css.js.map +1 -0
- package/dist/generated/themes/WritingAssistant.css.d.ts +2 -0
- package/dist/generated/themes/WritingAssistant.css.js +8 -0
- package/dist/generated/themes/WritingAssistant.css.js.map +1 -0
- package/dist/vscode.html-custom-data.json +49 -0
- package/dist/web-types.json +161 -1
- package/package-scripts.cjs +0 -1
- package/package.json +20 -18
- package/src/InputTemplate.tsx +197 -0
- package/src/TextArea.css +45 -0
- package/src/TextAreaTemplate.tsx +90 -0
- package/src/ToolbarLabelTemplate.tsx +9 -0
- package/src/VersioningTemplate.tsx +34 -0
- package/src/WritingAssistantTemplate.tsx +49 -0
- package/src/i18n/messagebundle.properties +38 -0
- package/src/i18n/messagebundle_ar.properties +20 -0
- package/src/i18n/messagebundle_bg.properties +20 -0
- package/src/i18n/messagebundle_ca.properties +20 -0
- package/src/i18n/messagebundle_cnr.properties +20 -0
- package/src/i18n/messagebundle_cs.properties +20 -0
- package/src/i18n/messagebundle_cy.properties +20 -0
- package/src/i18n/messagebundle_da.properties +20 -0
- package/src/i18n/messagebundle_de.properties +17 -0
- package/src/i18n/messagebundle_el.properties +20 -0
- package/src/i18n/messagebundle_en.properties +17 -0
- package/src/i18n/messagebundle_en_GB.properties +20 -0
- package/src/i18n/messagebundle_en_US_sappsd.properties +25 -0
- package/src/i18n/messagebundle_en_US_saprigi.properties +25 -0
- package/src/i18n/messagebundle_en_US_saptrc.properties +25 -0
- package/src/i18n/messagebundle_es.properties +20 -0
- package/src/i18n/messagebundle_es_MX.properties +21 -1
- package/src/i18n/messagebundle_et.properties +20 -0
- package/src/i18n/messagebundle_fi.properties +20 -0
- package/src/i18n/messagebundle_fr.properties +20 -0
- package/src/i18n/messagebundle_fr_CA.properties +20 -0
- package/src/i18n/messagebundle_hi.properties +20 -0
- package/src/i18n/messagebundle_hr.properties +22 -2
- package/src/i18n/messagebundle_hu.properties +20 -0
- package/src/i18n/messagebundle_id.properties +20 -0
- package/src/i18n/messagebundle_it.properties +20 -0
- package/src/i18n/messagebundle_iw.properties +20 -0
- package/src/i18n/messagebundle_ja.properties +20 -0
- package/src/i18n/messagebundle_kk.properties +20 -0
- package/src/i18n/messagebundle_ko.properties +20 -0
- package/src/i18n/messagebundle_lt.properties +20 -0
- package/src/i18n/messagebundle_lv.properties +20 -0
- package/src/i18n/messagebundle_mk.properties +20 -0
- package/src/i18n/messagebundle_ms.properties +20 -0
- package/src/i18n/messagebundle_nl.properties +20 -0
- package/src/i18n/messagebundle_no.properties +20 -0
- package/src/i18n/messagebundle_pl.properties +20 -0
- package/src/i18n/messagebundle_pt.properties +20 -0
- package/src/i18n/messagebundle_pt_PT.properties +20 -0
- package/src/i18n/messagebundle_ro.properties +20 -0
- package/src/i18n/messagebundle_ru.properties +20 -0
- package/src/i18n/messagebundle_sh.properties +20 -0
- package/src/i18n/messagebundle_sk.properties +20 -0
- package/src/i18n/messagebundle_sl.properties +20 -0
- package/src/i18n/messagebundle_sr.properties +20 -0
- package/src/i18n/messagebundle_sv.properties +20 -0
- package/src/i18n/messagebundle_th.properties +22 -2
- package/src/i18n/messagebundle_tr.properties +20 -0
- package/src/i18n/messagebundle_uk.properties +20 -0
- package/src/i18n/messagebundle_vi.properties +20 -0
- package/src/i18n/messagebundle_zh_CN.properties +20 -0
- package/src/i18n/messagebundle_zh_TW.properties +20 -0
- package/src/themes/Input.css +83 -0
- package/src/themes/PromptInput.css +5 -1
- package/src/themes/TextArea.css +45 -0
- package/src/themes/Versioning.css +20 -0
- package/src/themes/WritingAssistant.css +45 -0
- package/tsconfig.json +6 -0
package/dist/Assets-fetch.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// main package assets (transitively base, theming and icons)
|
|
2
2
|
import "@ui5/webcomponents/dist/Assets-fetch.js";
|
|
3
|
-
// own
|
|
3
|
+
// own ai package assets
|
|
4
4
|
import "./generated/json-imports/Themes-fetch.js";
|
|
5
5
|
import "./generated/json-imports/i18n-fetch.js";
|
|
6
6
|
//# sourceMappingURL=Assets-fetch.js.map
|
package/dist/Assets-fetch.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Assets-fetch.js","sourceRoot":"","sources":["../src/Assets-fetch.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,OAAO,yCAAyC,CAAC;AAEjD,
|
|
1
|
+
{"version":3,"file":"Assets-fetch.js","sourceRoot":"","sources":["../src/Assets-fetch.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,OAAO,yCAAyC,CAAC;AAEjD,wBAAwB;AACxB,OAAO,0CAA0C,CAAC;AAClD,OAAO,wCAAwC,CAAC","sourcesContent":["// main package assets (transitively base, theming and icons)\nimport \"@ui5/webcomponents/dist/Assets-fetch.js\";\n\n// own ai package assets\nimport \"./generated/json-imports/Themes-fetch.js\";\nimport \"./generated/json-imports/i18n-fetch.js\";\n"]}
|
package/dist/Assets-node.js
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
*/
|
|
12
12
|
// main package assets (transitively base, theming and icons)
|
|
13
13
|
import "@ui5/webcomponents/dist/Assets-node.js";
|
|
14
|
-
// own
|
|
14
|
+
// own ai package assets
|
|
15
15
|
import "./generated/json-imports/Themes-node.js";
|
|
16
16
|
import "./generated/json-imports/i18n-node.js";
|
|
17
17
|
//# sourceMappingURL=Assets-node.js.map
|
package/dist/Assets-node.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Assets-node.js","sourceRoot":"","sources":["../src/Assets-node.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,6DAA6D;AAC7D,OAAO,wCAAwC,CAAC;AAEhD,
|
|
1
|
+
{"version":3,"file":"Assets-node.js","sourceRoot":"","sources":["../src/Assets-node.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,6DAA6D;AAC7D,OAAO,wCAAwC,CAAC;AAEhD,wBAAwB;AACxB,OAAO,yCAAyC,CAAC;AACjD,OAAO,uCAAuC,CAAC","sourcesContent":["/**\n * The `Assets-node` entry point is used to import all CLDR, theming, and i18n assets.\n *\n * It serves as an alternative to the `Assets` and `Assets-fetch` modules and supports the\n * `with: { type: 'json' }` import attribute for loading JSON files.\n *\n * This import attribute is required in some environments, such as Node.js with server-side rendering (SSR).\n *\n * Example usage:\n * await import(\"../assets/i18n/messagebundle_bg.json\", { with: { type: 'json' } })\n */\n\n// main package assets (transitively base, theming and icons)\nimport \"@ui5/webcomponents/dist/Assets-node.js\";\n\n// own ai package assets\nimport \"./generated/json-imports/Themes-node.js\";\nimport \"./generated/json-imports/i18n-node.js\";\n"]}
|
package/dist/Button.d.ts
CHANGED
|
@@ -124,7 +124,7 @@ declare class Button extends UI5Element {
|
|
|
124
124
|
states: Array<ButtonState>;
|
|
125
125
|
_splitButton?: SplitButton;
|
|
126
126
|
_hiddenSplitButton?: SplitButton;
|
|
127
|
-
static
|
|
127
|
+
static i18nBundleAi: I18nBundle;
|
|
128
128
|
get _hideArrowButton(): boolean;
|
|
129
129
|
get _effectiveState(): string;
|
|
130
130
|
get _effectiveStateObject(): ButtonState | undefined;
|
package/dist/Button.js
CHANGED
|
@@ -9,6 +9,7 @@ import UI5Element from "@ui5/webcomponents-base/dist/UI5Element.js";
|
|
|
9
9
|
import { renderFinished } from "@ui5/webcomponents-base/dist/Render.js";
|
|
10
10
|
import customElement from "@ui5/webcomponents-base/dist/decorators/customElement.js";
|
|
11
11
|
import property from "@ui5/webcomponents-base/dist/decorators/property.js";
|
|
12
|
+
import { i18n } from "@ui5/webcomponents-base/dist/decorators.js";
|
|
12
13
|
import event from "@ui5/webcomponents-base/dist/decorators/event-strict.js";
|
|
13
14
|
import slot from "@ui5/webcomponents-base/dist/decorators/slot.js";
|
|
14
15
|
import query from "@ui5/webcomponents-base/dist/decorators/query.js";
|
|
@@ -19,7 +20,6 @@ import ButtonTemplate from "./ButtonTemplate.js";
|
|
|
19
20
|
import { getEffectiveAriaLabelText, getAssociatedLabelForTexts, getAllAccessibleNameRefTexts, } from "@ui5/webcomponents-base/dist/util/AccessibilityTextsHelper.js";
|
|
20
21
|
// Styles
|
|
21
22
|
import ButtonCss from "./generated/themes/Button.css.js";
|
|
22
|
-
import { i18n } from "@ui5/webcomponents-base/dist/decorators.js";
|
|
23
23
|
/**
|
|
24
24
|
* @class
|
|
25
25
|
*
|
|
@@ -240,7 +240,7 @@ let Button = Button_1 = class Button extends UI5Element {
|
|
|
240
240
|
}
|
|
241
241
|
get _computedAccessibilityAttributes() {
|
|
242
242
|
const labelRefTexts = getAllAccessibleNameRefTexts(this) || getEffectiveAriaLabelText(this) || getAssociatedLabelForTexts(this) || "";
|
|
243
|
-
const mainTitle = this._hasText ? Button_1.
|
|
243
|
+
const mainTitle = this._hasText ? Button_1.i18nBundleAi.getText(BUTTON_TOOLTIP_TEXT, this._stateText) : "";
|
|
244
244
|
const title = `${mainTitle} ${labelRefTexts}`.trim();
|
|
245
245
|
return {
|
|
246
246
|
root: {
|
|
@@ -288,8 +288,8 @@ __decorate([
|
|
|
288
288
|
query(".ui5-ai-button-hidden[ui5-split-button]")
|
|
289
289
|
], Button.prototype, "_hiddenSplitButton", void 0);
|
|
290
290
|
__decorate([
|
|
291
|
-
i18n("@ui5/webcomponents")
|
|
292
|
-
], Button, "
|
|
291
|
+
i18n("@ui5/webcomponents-ai")
|
|
292
|
+
], Button, "i18nBundleAi", void 0);
|
|
293
293
|
Button = Button_1 = __decorate([
|
|
294
294
|
customElement({
|
|
295
295
|
tag: "ui5-ai-button",
|
package/dist/Button.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.js","sourceRoot":"","sources":["../src/Button.ts"],"names":[],"mappings":";;;;;;;AAAA,OAAO,UAAU,MAAM,4CAA4C,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;AACxE,OAAO,aAAa,MAAM,0DAA0D,CAAC;AACrF,OAAO,QAAQ,MAAM,qDAAqD,CAAC;AAC3E,OAAO,KAAK,MAAM,yDAAyD,CAAC;AAC5E,OAAO,IAAI,MAAM,iDAAiD,CAAC;AACnE,OAAO,KAAK,MAAM,kDAAkD,CAAC;AACrE,OAAO,WAAW,MAAM,sDAAsD,CAAC;AAI/E,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,kBAAkB,CAAC;AAC1B,OAAO,cAAc,MAAM,qBAAqB,CAAC;AACjD,OAAO,EACN,yBAAyB,EACzB,0BAA0B,EAC1B,4BAA4B,GAC5B,MAAM,+DAA+D,CAAC;AAEvE,SAAS;AACT,OAAO,SAAS,MAAM,kCAAkC,CAAC;AACzD,OAAO,EAAE,IAAI,EAAE,MAAM,4CAA4C,CAAC;AAQlE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AA8BH,IAAM,MAAM,cAAZ,MAAM,MAAO,SAAQ,UAAU;IAA/B;;QAKC;;;;WAIG;QAEH,WAAM,GAAuB,SAAS,CAAA;QAEtC;;;;;;WAMG;QAEH,aAAQ,GAAG,KAAK,CAAC;QAWjB;;;;;;;WAOG;QAEH,uBAAkB,GAAG,KAAK,CAAC;QAE3B;;;;;;;;;;;;;;;;;;;;;;;;UAwBG;QAEH,4BAAuB,GAAoC,EAAE,CAAC;QAS9D;;;;;WAKG;QAEH,aAAQ,GAAI,KAAK,CAAC;IAoMnB,CAAC;IAhLA,IAAI,gBAAgB;QACnB,OAAO,C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;IA5BX,aAAa,CAAC;QACd,GAAG,EAAE,eAAe;QACpB,aAAa,EAAE,IAAI;QACnB,QAAQ,EAAE,WAAW;QACrB,QAAQ,EAAE,cAAc;QACxB,MAAM,EAAE,SAAS;QACjB,iBAAiB,EAAE,EAAE,cAAc,EAAE,IAAI,EAAE;KAC3C,CAAC;IAEF;;;;OAIG;;IACF,KAAK,CAAC,OAAO,EAAE;QACf,OAAO,EAAE,IAAI;KACb,CAAC;IAEF;;;;;OAKG;;IACF,KAAK,CAAC,oBAAoB,EAAE;QAC5B,OAAO,EAAE,IAAI;KACb,CAAC;GAEI,MAAM,CAyRX;AAED,MAAM,CAAC,MAAM,EAAE,CAAC;AAChB,eAAe,MAAM,CAAC","sourcesContent":["import UI5Element from \"@ui5/webcomponents-base/dist/UI5Element.js\";\nimport { renderFinished } from \"@ui5/webcomponents-base/dist/Render.js\";\nimport customElement from \"@ui5/webcomponents-base/dist/decorators/customElement.js\";\nimport property from \"@ui5/webcomponents-base/dist/decorators/property.js\";\nimport event from \"@ui5/webcomponents-base/dist/decorators/event-strict.js\";\nimport slot from \"@ui5/webcomponents-base/dist/decorators/slot.js\";\nimport query from \"@ui5/webcomponents-base/dist/decorators/query.js\";\nimport jsxRenderer from \"@ui5/webcomponents-base/dist/renderer/JsxRenderer.js\";\nimport type SplitButton from \"@ui5/webcomponents/dist/SplitButton.js\";\nimport type ButtonDesign from \"@ui5/webcomponents/dist/types/ButtonDesign.js\";\nimport type ButtonState from \"./ButtonState.js\";\nimport { BUTTON_TOOLTIP_TEXT } from \"./generated/i18n/i18n-defaults.js\";\nimport \"./ButtonState.js\";\nimport ButtonTemplate from \"./ButtonTemplate.js\";\nimport {\n\tgetEffectiveAriaLabelText,\n\tgetAssociatedLabelForTexts,\n\tgetAllAccessibleNameRefTexts,\n} from \"@ui5/webcomponents-base/dist/util/AccessibilityTextsHelper.js\";\n\n// Styles\nimport ButtonCss from \"./generated/themes/Button.css.js\";\nimport { i18n } from \"@ui5/webcomponents-base/dist/decorators.js\";\nimport type I18nBundle from \"@ui5/webcomponents-base/dist/i18nBundle.js\";\nimport type { AccessibilityAttributes } from \"@ui5/webcomponents-base/dist/types.js\";\n\ntype AIButtonRootAccessibilityAttributes = Pick<AccessibilityAttributes, \"hasPopup\" | \"roleDescription\" | \"title\" | \"ariaKeyShortcuts\">;\ntype AIButtonArrowButtonAccessibilityAttributes = Pick<AccessibilityAttributes, \"hasPopup\" | \"expanded\" | \"title\">;\ntype AIButtonAccessibilityAttributes = { root?: AIButtonRootAccessibilityAttributes, arrowButton?: AIButtonArrowButtonAccessibilityAttributes}\n\n/**\n * @class\n *\n * ### Overview\n *\n * The `ui5-ai-button` component serves as a button for AI-related scenarios. Users can trigger actions by clicking or tapping the `ui5-ai-button`\n * or by pressing keyboard keys like [Enter] or [Space].\n *\n * ### Usage\n *\n * For the `ui5-ai-button` user interface, you can define one or more button states by placing `ui5-ai-button-state` components in their default slot.\n * Each state has a name for identification and can include text, an icon, and an end icon, as needed for its purpose.\n * You can define a split mode for the `ui5-ai-button`, which will results in displaying an arrow button for additional actions.\n *\n * You can choose from a set of predefined designs for `ui5-ai-button` (as in `ui5-button`) to match the desired styling.\n *\n * The `ui5-ai-button` can be activated by clicking or tapping it. You can change the button state in the click event handler. When the button is\n * in split mode, you can activate the default button action by clicking or tapping it, or by pressing keyboard keys like [Enter] or [Space].\n * You can activate the arrow button by clicking or tapping it, or by pressing keyboard keys like [Arrow Up], [Arrow Down], or [F4].\n * To display additional actions, you can attach a menu to the arrow button.\n *\n * ### ES6 Module Import\n *\n * `import \"@ui5/webcomponents-ai/dist/Button.js\";`\n *\n * @constructor\n * @extends UI5Element\n * @since 2.0.0\n * @public\n * @experimental The Button and ButtonState web components are availabe since 2.0 under an experimental flag and their API and behaviour are subject to change.\n */\n\n@customElement({\n\ttag: \"ui5-ai-button\",\n\tlanguageAware: true,\n\trenderer: jsxRenderer,\n\ttemplate: ButtonTemplate,\n\tstyles: ButtonCss,\n\tshadowRootOptions: { delegatesFocus: true },\n})\n\n/**\n * Fired when the component is activated either with a\n * mouse/tap or by using the Enter or Space key.\n * @public\n */\n@event(\"click\", {\n\tbubbles: true,\n})\n\n/**\n * Fired when the component is in split mode and after the arrow button\n * is activated either by clicking or tapping it or by using the [Arrow Up] / [Arrow Down],\n * [Alt] + [Arrow Up]/ [Arrow Down], or [F4] keyboard keys.\n * @public\n */\n@event(\"arrow-button-click\", {\n\tbubbles: true,\n})\n\nclass Button extends UI5Element {\n\teventDetails!: {\n\t\t\"click\": void;\n\t\t\"arrow-button-click\": void;\n\t}\n\t/**\n\t * Defines the component design.\n\t * @default \"Default\"\n\t * @public\n\t */\n\t@property()\n\tdesign?: `${ButtonDesign}` = \"Default\"\n\n\t/**\n\t * Defines whether the component is disabled.\n\t * A disabled component can't be pressed or\n\t * focused, and it is not in the tab chain.\n\t * @default false\n\t * @public\n\t */\n\t@property({ type: Boolean })\n\tdisabled = false;\n\n\t/**\n\t * Defines the current state of the component.\n\t *\n\t * @default undefined\n\t * @public\n\t */\n\t@property()\n\tstate?: string;\n\n\t/**\n\t * Defines the active state of the arrow button in split mode.\n\t * Set to true when the button is in split mode and a menu with additional options\n\t * is opened by the arrow button. Set back to false when the menu is closed.\n\t * @default false\n\t * @public\n\t * @since 2.6.0\n\t */\n\t@property({ type: Boolean, noAttribute: true })\n\tarrowButtonPressed = false;\n\n\t/**\n \t * Defines the additional accessibility attributes that will be applied to the component.\n\t *\n\t * This property allows for fine-tuned control of ARIA attributes for screen reader support.\n\t * It accepts an object with the following optional fields:\n\t *\n\t * - **root**: Accessibility attributes that will be applied to the root element.\n\t * - **hasPopup**: Indicates the availability and type of interactive popup element (such as a menu or dialog).\n\t * Accepts string values: `\"dialog\"`, `\"grid\"`, `\"listbox\"`, `\"menu\"`, or `\"tree\"`.\n\t * - **roleDescription**: Defines a human-readable description for the button's role.\n\t * Accepts any string value.\n\t * - **title**: Specifies a tooltip or description for screen readers.\n\t * Accepts any string value.\n\t * - **ariaKeyShortcuts**: Defines keyboard shortcuts that activate or focus the button.\n\t *\n\t * - **arrowButton**: Accessibility attributes that will be applied to the arrow (split) button element.\n\t * - **hasPopup**: Indicates the type of popup triggered by the arrow button.\n\t * Accepts string values: `\"dialog\"`, `\"grid\"`, `\"listbox\"`, `\"menu\"`, or `\"tree\"`.\n\t * - **expanded**: Indicates whether the popup controlled by the arrow button is currently expanded.\n\t * Accepts boolean values: `true` or `false`.\n\t *\n\t * @public\n\t * @since 2.6.0\n\t * @default {}\n \t*/\n\t@property({ type: Object })\n\taccessibilityAttributes: AIButtonAccessibilityAttributes = {};\n\n\t/**\n\t * Keeps the current state object of the component.\n\t * @private\n\t */\n\t@property({ type: Object })\n\t_currentStateObject?: ButtonState;\n\n\t/**\n\t * Determines if the button is in icon-only mode.\n\t * This property is animation related only.\n\t * @default false\n\t * @private\n\t */\n\t@property({ type: Boolean })\n\ticonOnly? = false;\n\n\t/**\n\t * Defines the available states of the component.\n\t * **Note:** Although this slot accepts HTML Elements, it is strongly recommended that\n\t * you only use `ui5-ai-button-state` components in order to preserve the intended design.\n\t * @public\n\t */\n\t@slot({ type: HTMLElement, \"default\": true })\n\tstates!: Array<ButtonState>;\n\n\t@query(\"[ui5-split-button]\")\n\t_splitButton?: SplitButton;\n\n\t@query(\".ui5-ai-button-hidden[ui5-split-button]\")\n\t_hiddenSplitButton?: SplitButton;\n\n\t@i18n(\"@ui5/webcomponents\")\n\tstatic i18nBundle: I18nBundle;\n\n\tget _hideArrowButton() {\n\t\treturn !this._effectiveStateObject?.showArrowButton;\n\t}\n\n\tget _effectiveState() {\n\t\treturn this.state || (this.states.length && this.states[0].name) || \"\";\n\t}\n\n\tget _effectiveStateObject() {\n\t\treturn this.states.find(state => state.name === this._effectiveState);\n\t}\n\n\tget _stateIconOnly() {\n\t\treturn !this._stateText && !!this._stateIcon;\n\t}\n\n\tget _stateText() {\n\t\treturn this._currentStateObject?.text;\n\t}\n\n\tget _stateIcon() {\n\t\treturn this._currentStateObject?.icon;\n\t}\n\n\tget _stateEndIcon() {\n\t\tconst endIcon = this._effectiveStateObject?.showArrowButton ? \"\" : this._effectiveStateObject?.endIcon;\n\t\treturn endIcon;\n\t}\n\n\tget _hasText() {\n\t\treturn !!this._stateText;\n\t}\n\n\tonBeforeRendering(): void {\n\t\tconst splitButton = this._splitButton;\n\n\t\tif (splitButton) {\n\t\t\tsplitButton.activeArrowButton = this.arrowButtonPressed;\n\t\t}\n\n\t\tif (!this._currentStateObject?.name) {\n\t\t\tthis._currentStateObject = this._effectiveStateObject;\n\t\t}\n\n\t\tconst currentStateName = this._currentStateObject?.name || \"\";\n\n\t\tthis.iconOnly = this._stateIconOnly;\n\t\tif (currentStateName !== \"\" && currentStateName !== this._effectiveState) {\n\t\t\tthis._fadeOut();\n\t\t}\n\t}\n\n\t/**\n\t * Starts the fade-out animation.\n\t * @private\n\t */\n\tasync _fadeOut(): Promise<void> {\n\t\tconst fadeOutDuration = 180;\n\t\tconst button = this._splitButton;\n\t\tconst hiddenButton = this._hiddenSplitButton;\n\t\tconst newStateObject = this._effectiveStateObject;\n\n\t\tif (!newStateObject) {\n\t\t\t// eslint-disable-next-line no-console\n\t\t\tconsole.warn(`State with name=\"${this.state}\" doesn't exist!`);\n\t\t\treturn;\n\t\t}\n\n\t\tif (!button || !hiddenButton) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst buttonWidth = button.offsetWidth;\n\t\tconst currentState: Partial<ButtonState> = this._currentStateObject || {};\n\n\t\tif ((!currentState.showArrowButton && newStateObject.showArrowButton) || (!currentState.endIcon && !!newStateObject.endIcon)) {\n\t\t\tthis.classList.add(\"ui5-ai-button-button-to-menu\");\n\t\t}\n\t\tif ((currentState.showArrowButton && !newStateObject.showArrowButton) || (!!currentState.endIcon && !newStateObject.endIcon)) {\n\t\t\tthis.classList.add(\"ui5-ai-button-menu-to-button\");\n\t\t}\n\n\t\tthis.style.width = `${buttonWidth}px`;\n\t\thiddenButton.icon = newStateObject.icon;\n\t\thiddenButton._endIcon = newStateObject.endIcon;\n\t\thiddenButton.textContent = newStateObject.text || null;\n\t\thiddenButton._hideArrowButton = this._hideArrowButton;\n\n\t\tawait renderFinished();\n\t\tconst hiddenButtonWidth = hiddenButton.offsetWidth;\n\t\tthis.style.width = `${hiddenButtonWidth}px`;\n\t\tthis.classList.add(\"ui5-ai-button-fade-out\");\n\n\t\tsetTimeout(() => {\n\t\t\tthis.classList.add(\"ui5-ai-button-fade-mid\");\n\t\t\tbutton._hideArrowButton = this._hideArrowButton;\n\t\t\tthis._fadeIn();\n\t\t}, fadeOutDuration);\n\t}\n\n\t/**\n\t * Starts the fade-in animation.\n\t * @private\n\t */\n\t_fadeIn(): void {\n\t\tconst fadeInDuration = 160;\n\n\t\tsetTimeout(() => {\n\t\t\tconst newStateObject = this._effectiveStateObject;\n\t\t\tthis._currentStateObject = newStateObject;\n\t\t\tthis.classList.add(\"ui5-ai-button-fade-in\");\n\t\t\tthis._resetFade();\n\t\t}, fadeInDuration);\n\t}\n\n\t/**\n\t * Resets the fade phases when the animation is completed.\n\t * @private\n\t */\n\t_resetFade(): void {\n\t\tconst fadeResetDuration = 160;\n\n\t\tsetTimeout(() => {\n\t\t\tthis.classList.remove(\"ui5-ai-button-fade-out\");\n\t\t\tthis.classList.remove(\"ui5-ai-button-fade-mid\");\n\t\t\tthis.classList.remove(\"ui5-ai-button-fade-in\");\n\t\t\tthis.classList.remove(\"ui5-ai-button-button-to-menu\");\n\t\t\tthis.classList.remove(\"ui5-ai-button-menu-to-button\");\n\t\t}, fadeResetDuration);\n\n\t\t// reset the button's width after animations\n\t\tconst button = this._splitButton;\n\n\t\tif (button) {\n\t\t\tbutton.style.width = \"\";\n\t\t}\n\t}\n\n\t/**\n\t * Handles the click event.\n\t * @private\n\t */\n\t_onClick(e: CustomEvent): void {\n\t\te.stopImmediatePropagation();\n\t\tthis.fireDecoratorEvent(\"click\");\n\t}\n\n\t/**\n\t * Handles the arrow-button-click event when `ui5-ai-button` is in split mode.\n\t * @private\n\t */\n\t_onArrowClick(e: CustomEvent): void {\n\t\te.stopImmediatePropagation();\n\t\tthis.fireDecoratorEvent(\"arrow-button-click\");\n\t}\n\n\tget _computedAccessibilityAttributes(): AIButtonAccessibilityAttributes {\n\t\tconst labelRefTexts = getAllAccessibleNameRefTexts(this) || getEffectiveAriaLabelText(this) || getAssociatedLabelForTexts(this) || \"\";\n\n\t\tconst mainTitle = this._hasText ? Button.i18nBundle.getText(BUTTON_TOOLTIP_TEXT, this._stateText as string) : \"\";\n\t\tconst title = `${mainTitle} ${labelRefTexts}`.trim();\n\n\t\treturn {\n\t\t\troot: {\n\t\t\t\thasPopup: this.accessibilityAttributes?.root?.hasPopup || \"false\",\n\t\t\t\troleDescription: this.accessibilityAttributes?.root?.roleDescription,\n\t\t\t\ttitle: this.accessibilityAttributes?.root?.title || title,\n\t\t\t\tariaKeyShortcuts: this.accessibilityAttributes?.root?.ariaKeyShortcuts,\n\t\t\t},\n\t\t\tarrowButton: {\n\t\t\t\thasPopup: this.accessibilityAttributes?.arrowButton?.hasPopup,\n\t\t\t\texpanded: this.accessibilityAttributes?.arrowButton?.expanded,\n\t\t\t\ttitle: this.accessibilityAttributes?.arrowButton?.title,\n\t\t\t},\n\t\t};\n\t}\n}\n\nButton.define();\nexport default Button;\nexport type {\n\tAIButtonAccessibilityAttributes,\n};\n"]}
|
|
1
|
+
{"version":3,"file":"Button.js","sourceRoot":"","sources":["../src/Button.ts"],"names":[],"mappings":";;;;;;;AAAA,OAAO,UAAU,MAAM,4CAA4C,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;AACxE,OAAO,aAAa,MAAM,0DAA0D,CAAC;AACrF,OAAO,QAAQ,MAAM,qDAAqD,CAAC;AAC3E,OAAO,EAAE,IAAI,EAAE,MAAM,4CAA4C,CAAC;AAClE,OAAO,KAAK,MAAM,yDAAyD,CAAC;AAC5E,OAAO,IAAI,MAAM,iDAAiD,CAAC;AACnE,OAAO,KAAK,MAAM,kDAAkD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";\nimport { renderFinished } from \"@ui5/webcomponents-base/dist/Render.js\";\nimport customElement from \"@ui5/webcomponents-base/dist/decorators/customElement.js\";\nimport property from \"@ui5/webcomponents-base/dist/decorators/property.js\";\nimport { i18n } from \"@ui5/webcomponents-base/dist/decorators.js\";\nimport event from \"@ui5/webcomponents-base/dist/decorators/event-strict.js\";\nimport slot from \"@ui5/webcomponents-base/dist/decorators/slot.js\";\nimport query from \"@ui5/webcomponents-base/dist/decorators/query.js\";\nimport jsxRenderer from \"@ui5/webcomponents-base/dist/renderer/JsxRenderer.js\";\nimport type SplitButton from \"@ui5/webcomponents/dist/SplitButton.js\";\nimport type ButtonDesign from \"@ui5/webcomponents/dist/types/ButtonDesign.js\";\nimport type ButtonState from \"./ButtonState.js\";\nimport { BUTTON_TOOLTIP_TEXT } from \"./generated/i18n/i18n-defaults.js\";\nimport \"./ButtonState.js\";\nimport ButtonTemplate from \"./ButtonTemplate.js\";\nimport {\n\tgetEffectiveAriaLabelText,\n\tgetAssociatedLabelForTexts,\n\tgetAllAccessibleNameRefTexts,\n} from \"@ui5/webcomponents-base/dist/util/AccessibilityTextsHelper.js\";\nimport type I18nBundle from \"@ui5/webcomponents-base/dist/i18nBundle.js\";\nimport type { AccessibilityAttributes } from \"@ui5/webcomponents-base/dist/types.js\";\n\n// Styles\nimport ButtonCss from \"./generated/themes/Button.css.js\";\n\ntype AIButtonRootAccessibilityAttributes = Pick<AccessibilityAttributes, \"hasPopup\" | \"roleDescription\" | \"title\" | \"ariaKeyShortcuts\">;\ntype AIButtonArrowButtonAccessibilityAttributes = Pick<AccessibilityAttributes, \"hasPopup\" | \"expanded\" | \"title\">;\ntype AIButtonAccessibilityAttributes = { root?: AIButtonRootAccessibilityAttributes, arrowButton?: AIButtonArrowButtonAccessibilityAttributes}\n\n/**\n * @class\n *\n * ### Overview\n *\n * The `ui5-ai-button` component serves as a button for AI-related scenarios. Users can trigger actions by clicking or tapping the `ui5-ai-button`\n * or by pressing keyboard keys like [Enter] or [Space].\n *\n * ### Usage\n *\n * For the `ui5-ai-button` user interface, you can define one or more button states by placing `ui5-ai-button-state` components in their default slot.\n * Each state has a name for identification and can include text, an icon, and an end icon, as needed for its purpose.\n * You can define a split mode for the `ui5-ai-button`, which will results in displaying an arrow button for additional actions.\n *\n * You can choose from a set of predefined designs for `ui5-ai-button` (as in `ui5-button`) to match the desired styling.\n *\n * The `ui5-ai-button` can be activated by clicking or tapping it. You can change the button state in the click event handler. When the button is\n * in split mode, you can activate the default button action by clicking or tapping it, or by pressing keyboard keys like [Enter] or [Space].\n * You can activate the arrow button by clicking or tapping it, or by pressing keyboard keys like [Arrow Up], [Arrow Down], or [F4].\n * To display additional actions, you can attach a menu to the arrow button.\n *\n * ### ES6 Module Import\n *\n * `import \"@ui5/webcomponents-ai/dist/Button.js\";`\n *\n * @constructor\n * @extends UI5Element\n * @since 2.0.0\n * @public\n * @experimental The Button and ButtonState web components are availabe since 2.0 under an experimental flag and their API and behaviour are subject to change.\n */\n\n@customElement({\n\ttag: \"ui5-ai-button\",\n\tlanguageAware: true,\n\trenderer: jsxRenderer,\n\ttemplate: ButtonTemplate,\n\tstyles: ButtonCss,\n\tshadowRootOptions: { delegatesFocus: true },\n})\n\n/**\n * Fired when the component is activated either with a\n * mouse/tap or by using the Enter or Space key.\n * @public\n */\n@event(\"click\", {\n\tbubbles: true,\n})\n\n/**\n * Fired when the component is in split mode and after the arrow button\n * is activated either by clicking or tapping it or by using the [Arrow Up] / [Arrow Down],\n * [Alt] + [Arrow Up]/ [Arrow Down], or [F4] keyboard keys.\n * @public\n */\n@event(\"arrow-button-click\", {\n\tbubbles: true,\n})\n\nclass Button extends UI5Element {\n\teventDetails!: {\n\t\t\"click\": void;\n\t\t\"arrow-button-click\": void;\n\t}\n\t/**\n\t * Defines the component design.\n\t * @default \"Default\"\n\t * @public\n\t */\n\t@property()\n\tdesign?: `${ButtonDesign}` = \"Default\"\n\n\t/**\n\t * Defines whether the component is disabled.\n\t * A disabled component can't be pressed or\n\t * focused, and it is not in the tab chain.\n\t * @default false\n\t * @public\n\t */\n\t@property({ type: Boolean })\n\tdisabled = false;\n\n\t/**\n\t * Defines the current state of the component.\n\t *\n\t * @default undefined\n\t * @public\n\t */\n\t@property()\n\tstate?: string;\n\n\t/**\n\t * Defines the active state of the arrow button in split mode.\n\t * Set to true when the button is in split mode and a menu with additional options\n\t * is opened by the arrow button. Set back to false when the menu is closed.\n\t * @default false\n\t * @public\n\t * @since 2.6.0\n\t */\n\t@property({ type: Boolean, noAttribute: true })\n\tarrowButtonPressed = false;\n\n\t/**\n \t * Defines the additional accessibility attributes that will be applied to the component.\n\t *\n\t * This property allows for fine-tuned control of ARIA attributes for screen reader support.\n\t * It accepts an object with the following optional fields:\n\t *\n\t * - **root**: Accessibility attributes that will be applied to the root element.\n\t * - **hasPopup**: Indicates the availability and type of interactive popup element (such as a menu or dialog).\n\t * Accepts string values: `\"dialog\"`, `\"grid\"`, `\"listbox\"`, `\"menu\"`, or `\"tree\"`.\n\t * - **roleDescription**: Defines a human-readable description for the button's role.\n\t * Accepts any string value.\n\t * - **title**: Specifies a tooltip or description for screen readers.\n\t * Accepts any string value.\n\t * - **ariaKeyShortcuts**: Defines keyboard shortcuts that activate or focus the button.\n\t *\n\t * - **arrowButton**: Accessibility attributes that will be applied to the arrow (split) button element.\n\t * - **hasPopup**: Indicates the type of popup triggered by the arrow button.\n\t * Accepts string values: `\"dialog\"`, `\"grid\"`, `\"listbox\"`, `\"menu\"`, or `\"tree\"`.\n\t * - **expanded**: Indicates whether the popup controlled by the arrow button is currently expanded.\n\t * Accepts boolean values: `true` or `false`.\n\t *\n\t * @public\n\t * @since 2.6.0\n\t * @default {}\n \t*/\n\t@property({ type: Object })\n\taccessibilityAttributes: AIButtonAccessibilityAttributes = {};\n\n\t/**\n\t * Keeps the current state object of the component.\n\t * @private\n\t */\n\t@property({ type: Object })\n\t_currentStateObject?: ButtonState;\n\n\t/**\n\t * Determines if the button is in icon-only mode.\n\t * This property is animation related only.\n\t * @default false\n\t * @private\n\t */\n\t@property({ type: Boolean })\n\ticonOnly? = false;\n\n\t/**\n\t * Defines the available states of the component.\n\t * **Note:** Although this slot accepts HTML Elements, it is strongly recommended that\n\t * you only use `ui5-ai-button-state` components in order to preserve the intended design.\n\t * @public\n\t */\n\t@slot({ type: HTMLElement, \"default\": true })\n\tstates!: Array<ButtonState>;\n\n\t@query(\"[ui5-split-button]\")\n\t_splitButton?: SplitButton;\n\n\t@query(\".ui5-ai-button-hidden[ui5-split-button]\")\n\t_hiddenSplitButton?: SplitButton;\n\n\t@i18n(\"@ui5/webcomponents-ai\")\n\tstatic i18nBundleAi: I18nBundle;\n\n\tget _hideArrowButton() {\n\t\treturn !this._effectiveStateObject?.showArrowButton;\n\t}\n\n\tget _effectiveState() {\n\t\treturn this.state || (this.states.length && this.states[0].name) || \"\";\n\t}\n\n\tget _effectiveStateObject() {\n\t\treturn this.states.find(state => state.name === this._effectiveState);\n\t}\n\n\tget _stateIconOnly() {\n\t\treturn !this._stateText && !!this._stateIcon;\n\t}\n\n\tget _stateText() {\n\t\treturn this._currentStateObject?.text;\n\t}\n\n\tget _stateIcon() {\n\t\treturn this._currentStateObject?.icon;\n\t}\n\n\tget _stateEndIcon() {\n\t\tconst endIcon = this._effectiveStateObject?.showArrowButton ? \"\" : this._effectiveStateObject?.endIcon;\n\t\treturn endIcon;\n\t}\n\n\tget _hasText() {\n\t\treturn !!this._stateText;\n\t}\n\n\tonBeforeRendering(): void {\n\t\tconst splitButton = this._splitButton;\n\n\t\tif (splitButton) {\n\t\t\tsplitButton.activeArrowButton = this.arrowButtonPressed;\n\t\t}\n\n\t\tif (!this._currentStateObject?.name) {\n\t\t\tthis._currentStateObject = this._effectiveStateObject;\n\t\t}\n\n\t\tconst currentStateName = this._currentStateObject?.name || \"\";\n\n\t\tthis.iconOnly = this._stateIconOnly;\n\t\tif (currentStateName !== \"\" && currentStateName !== this._effectiveState) {\n\t\t\tthis._fadeOut();\n\t\t}\n\t}\n\n\t/**\n\t * Starts the fade-out animation.\n\t * @private\n\t */\n\tasync _fadeOut(): Promise<void> {\n\t\tconst fadeOutDuration = 180;\n\t\tconst button = this._splitButton;\n\t\tconst hiddenButton = this._hiddenSplitButton;\n\t\tconst newStateObject = this._effectiveStateObject;\n\n\t\tif (!newStateObject) {\n\t\t\t// eslint-disable-next-line no-console\n\t\t\tconsole.warn(`State with name=\"${this.state}\" doesn't exist!`);\n\t\t\treturn;\n\t\t}\n\n\t\tif (!button || !hiddenButton) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst buttonWidth = button.offsetWidth;\n\t\tconst currentState: Partial<ButtonState> = this._currentStateObject || {};\n\n\t\tif ((!currentState.showArrowButton && newStateObject.showArrowButton) || (!currentState.endIcon && !!newStateObject.endIcon)) {\n\t\t\tthis.classList.add(\"ui5-ai-button-button-to-menu\");\n\t\t}\n\t\tif ((currentState.showArrowButton && !newStateObject.showArrowButton) || (!!currentState.endIcon && !newStateObject.endIcon)) {\n\t\t\tthis.classList.add(\"ui5-ai-button-menu-to-button\");\n\t\t}\n\n\t\tthis.style.width = `${buttonWidth}px`;\n\t\thiddenButton.icon = newStateObject.icon;\n\t\thiddenButton._endIcon = newStateObject.endIcon;\n\t\thiddenButton.textContent = newStateObject.text || null;\n\t\thiddenButton._hideArrowButton = this._hideArrowButton;\n\n\t\tawait renderFinished();\n\t\tconst hiddenButtonWidth = hiddenButton.offsetWidth;\n\t\tthis.style.width = `${hiddenButtonWidth}px`;\n\t\tthis.classList.add(\"ui5-ai-button-fade-out\");\n\n\t\tsetTimeout(() => {\n\t\t\tthis.classList.add(\"ui5-ai-button-fade-mid\");\n\t\t\tbutton._hideArrowButton = this._hideArrowButton;\n\t\t\tthis._fadeIn();\n\t\t}, fadeOutDuration);\n\t}\n\n\t/**\n\t * Starts the fade-in animation.\n\t * @private\n\t */\n\t_fadeIn(): void {\n\t\tconst fadeInDuration = 160;\n\n\t\tsetTimeout(() => {\n\t\t\tconst newStateObject = this._effectiveStateObject;\n\t\t\tthis._currentStateObject = newStateObject;\n\t\t\tthis.classList.add(\"ui5-ai-button-fade-in\");\n\t\t\tthis._resetFade();\n\t\t}, fadeInDuration);\n\t}\n\n\t/**\n\t * Resets the fade phases when the animation is completed.\n\t * @private\n\t */\n\t_resetFade(): void {\n\t\tconst fadeResetDuration = 160;\n\n\t\tsetTimeout(() => {\n\t\t\tthis.classList.remove(\"ui5-ai-button-fade-out\");\n\t\t\tthis.classList.remove(\"ui5-ai-button-fade-mid\");\n\t\t\tthis.classList.remove(\"ui5-ai-button-fade-in\");\n\t\t\tthis.classList.remove(\"ui5-ai-button-button-to-menu\");\n\t\t\tthis.classList.remove(\"ui5-ai-button-menu-to-button\");\n\t\t}, fadeResetDuration);\n\n\t\t// reset the button's width after animations\n\t\tconst button = this._splitButton;\n\n\t\tif (button) {\n\t\t\tbutton.style.width = \"\";\n\t\t}\n\t}\n\n\t/**\n\t * Handles the click event.\n\t * @private\n\t */\n\t_onClick(e: CustomEvent): void {\n\t\te.stopImmediatePropagation();\n\t\tthis.fireDecoratorEvent(\"click\");\n\t}\n\n\t/**\n\t * Handles the arrow-button-click event when `ui5-ai-button` is in split mode.\n\t * @private\n\t */\n\t_onArrowClick(e: CustomEvent): void {\n\t\te.stopImmediatePropagation();\n\t\tthis.fireDecoratorEvent(\"arrow-button-click\");\n\t}\n\n\tget _computedAccessibilityAttributes(): AIButtonAccessibilityAttributes {\n\t\tconst labelRefTexts = getAllAccessibleNameRefTexts(this) || getEffectiveAriaLabelText(this) || getAssociatedLabelForTexts(this) || \"\";\n\n\t\tconst mainTitle = this._hasText ? Button.i18nBundleAi.getText(BUTTON_TOOLTIP_TEXT, this._stateText as string) : \"\";\n\t\tconst title = `${mainTitle} ${labelRefTexts}`.trim();\n\n\t\treturn {\n\t\t\troot: {\n\t\t\t\thasPopup: this.accessibilityAttributes?.root?.hasPopup || \"false\",\n\t\t\t\troleDescription: this.accessibilityAttributes?.root?.roleDescription,\n\t\t\t\ttitle: this.accessibilityAttributes?.root?.title || title,\n\t\t\t\tariaKeyShortcuts: this.accessibilityAttributes?.root?.ariaKeyShortcuts,\n\t\t\t},\n\t\t\tarrowButton: {\n\t\t\t\thasPopup: this.accessibilityAttributes?.arrowButton?.hasPopup,\n\t\t\t\texpanded: this.accessibilityAttributes?.arrowButton?.expanded,\n\t\t\t\ttitle: this.accessibilityAttributes?.arrowButton?.title,\n\t\t\t},\n\t\t};\n\t}\n}\n\nButton.define();\nexport default Button;\nexport type {\n\tAIButtonAccessibilityAttributes,\n};\n"]}
|
package/dist/Input.d.ts
ADDED
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import BaseInput from "@ui5/webcomponents/dist/Input.js";
|
|
2
|
+
import type Menu from "@ui5/webcomponents/dist/Menu.js";
|
|
3
|
+
import type { MenuItemClickEventDetail } from "@ui5/webcomponents/dist/Menu.js";
|
|
4
|
+
type InputVersionChangeEventDetail = {
|
|
5
|
+
backwards: boolean;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* @class
|
|
9
|
+
*
|
|
10
|
+
* ### Overview
|
|
11
|
+
*
|
|
12
|
+
* The `ui5-ai-input` component extends the standard `ui5-input` with **AI Writing Assistant** capabilities.
|
|
13
|
+
*
|
|
14
|
+
* ### Structure
|
|
15
|
+
*
|
|
16
|
+
* The `ui5-ai-input` consists of the following main parts:
|
|
17
|
+
*
|
|
18
|
+
* - **Input Field** – Inherits all standard Input behaviors.
|
|
19
|
+
* - **AI Action Button** – Appears when focused or loading, providing access to AI-related actions or stopping generation.
|
|
20
|
+
*
|
|
21
|
+
* The component automatically determines which elements to render based on its internal state:
|
|
22
|
+
* - The AI Button is only shown when there are available `actions`.
|
|
23
|
+
* - The version navigation appears only when `totalVersions > 1`.
|
|
24
|
+
*
|
|
25
|
+
* ### Keyboard Support
|
|
26
|
+
*
|
|
27
|
+
* - **Shift + F4** — Opens the AI menu.
|
|
28
|
+
* - **Ctrl + Shift + Z / Y** — Navigates backward/forward between AI-generated versions.
|
|
29
|
+
*
|
|
30
|
+
* ### ES6 Module Import
|
|
31
|
+
*
|
|
32
|
+
* `import "@ui5/webcomponents-ai/dist/Input.js";`
|
|
33
|
+
*
|
|
34
|
+
* @constructor
|
|
35
|
+
* @extends BaseInput
|
|
36
|
+
* @since 2.16.0
|
|
37
|
+
* @experimental The **@ui5/webcomponents-ai** package is under active development and considered experimental. Component APIs are subject to change.
|
|
38
|
+
* @public
|
|
39
|
+
*/
|
|
40
|
+
declare class Input extends BaseInput {
|
|
41
|
+
eventDetails: BaseInput["eventDetails"] & {
|
|
42
|
+
"version-change": InputVersionChangeEventDetail;
|
|
43
|
+
"stop-generation": void;
|
|
44
|
+
"button-click": void;
|
|
45
|
+
"item-click": MenuItemClickEventDetail;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Indicates the index of the currently displayed version.
|
|
49
|
+
*
|
|
50
|
+
* @default 0
|
|
51
|
+
* @public
|
|
52
|
+
*/
|
|
53
|
+
currentVersion: number;
|
|
54
|
+
/**
|
|
55
|
+
* Indicates the total number of result versions available.
|
|
56
|
+
*
|
|
57
|
+
* When not set or set to 0, the versioning will be hidden.
|
|
58
|
+
*
|
|
59
|
+
* @default 0
|
|
60
|
+
* @public
|
|
61
|
+
*/
|
|
62
|
+
totalVersions: number;
|
|
63
|
+
/**
|
|
64
|
+
* Defines whether the AI Writing Assistant is currently loading.
|
|
65
|
+
*
|
|
66
|
+
* When `true`, indicates that an AI action is in progress.
|
|
67
|
+
*
|
|
68
|
+
* @default false
|
|
69
|
+
* @public
|
|
70
|
+
*/
|
|
71
|
+
loading: boolean;
|
|
72
|
+
/**
|
|
73
|
+
* Indicates if the menu is open.
|
|
74
|
+
* @default 0
|
|
75
|
+
* @private
|
|
76
|
+
*/
|
|
77
|
+
_isMenuOpen: boolean;
|
|
78
|
+
/**
|
|
79
|
+
* Defines the items of the menu for the component.
|
|
80
|
+
* @public
|
|
81
|
+
*/
|
|
82
|
+
actions: Array<HTMLElement>;
|
|
83
|
+
_previousCurrentStep: number;
|
|
84
|
+
_previousTotalSteps: number;
|
|
85
|
+
isFocused: boolean;
|
|
86
|
+
_onfocusin(e: FocusEvent): void;
|
|
87
|
+
_onfocusout(e: FocusEvent): void;
|
|
88
|
+
/**
|
|
89
|
+
* Manages the focus when the navigation buttons become disabled/enabled.
|
|
90
|
+
* Automatically moves the focus to the available button when the user reaches the boundaries.
|
|
91
|
+
* @private
|
|
92
|
+
*/
|
|
93
|
+
_manageVersionButtonsFocus(): void;
|
|
94
|
+
/**
|
|
95
|
+
* Handles the click event for the AI generate Button.
|
|
96
|
+
* Fires the appropriate event based on the AI Button state.
|
|
97
|
+
* @private
|
|
98
|
+
*/
|
|
99
|
+
_handleAIButtonClick(e: Event): void;
|
|
100
|
+
/**
|
|
101
|
+
* Handles the escape event for the AI generate Button.
|
|
102
|
+
* @private
|
|
103
|
+
*/
|
|
104
|
+
_handleAIButtonKeydown: (e: KeyboardEvent) => void;
|
|
105
|
+
/**
|
|
106
|
+
* Handles the version change event from the versioning component.
|
|
107
|
+
*
|
|
108
|
+
* @param {CustomEvent} e - The version change event
|
|
109
|
+
*/
|
|
110
|
+
_handleVersionChange(e: CustomEvent<{
|
|
111
|
+
backwards: boolean;
|
|
112
|
+
}>): void;
|
|
113
|
+
/**
|
|
114
|
+
* Handles the click event for the "Previous Version" button.
|
|
115
|
+
* Updates the current version index and syncs content.
|
|
116
|
+
* @private
|
|
117
|
+
*/
|
|
118
|
+
_handlePreviousButtonClick(): void;
|
|
119
|
+
/**
|
|
120
|
+
* Handles the click event for the "Next Version" button.
|
|
121
|
+
* Updates the current version index and syncs content.
|
|
122
|
+
* @private
|
|
123
|
+
*/
|
|
124
|
+
_handleNextButtonClick(): void;
|
|
125
|
+
_onMenuIconClick(e: CustomEvent<MenuItemClickEventDetail>): void;
|
|
126
|
+
/**
|
|
127
|
+
* Handles keydown events for keyboard shortcuts.
|
|
128
|
+
* @private
|
|
129
|
+
*/
|
|
130
|
+
_onkeydown(e: KeyboardEvent): void;
|
|
131
|
+
/**
|
|
132
|
+
* Handles visibility of the Writing Assistant Button.
|
|
133
|
+
* If there are no items, the Writing Assistant Button would not be rendered.
|
|
134
|
+
*/
|
|
135
|
+
get hasActions(): boolean;
|
|
136
|
+
get ariaLabel(): string;
|
|
137
|
+
get stopGeneratingTooltip(): string;
|
|
138
|
+
get nextButtonAccessibleName(): string;
|
|
139
|
+
get previousButtonAccessibleName(): string;
|
|
140
|
+
get menu(): Menu;
|
|
141
|
+
}
|
|
142
|
+
export type { InputVersionChangeEventDetail, MenuItemClickEventDetail as InputItemClickEventDetail };
|
|
143
|
+
export default Input;
|
package/dist/Input.js
ADDED
|
@@ -0,0 +1,288 @@
|
|
|
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 Input_1;
|
|
8
|
+
import customElement from "@ui5/webcomponents-base/dist/decorators/customElement.js";
|
|
9
|
+
import property from "@ui5/webcomponents-base/dist/decorators/property.js";
|
|
10
|
+
import event from "@ui5/webcomponents-base/dist/decorators/event-strict.js";
|
|
11
|
+
import slot from "@ui5/webcomponents-base/dist/decorators/slot.js";
|
|
12
|
+
import jsxRenderer from "@ui5/webcomponents-base/dist/renderer/JsxRenderer.js";
|
|
13
|
+
import { isEscape, isF4Shift, } from "@ui5/webcomponents-base/dist/Keys.js";
|
|
14
|
+
import BaseInput from "@ui5/webcomponents/dist/Input.js";
|
|
15
|
+
// styles
|
|
16
|
+
import AIInputCss from "./generated/themes/Input.css.js";
|
|
17
|
+
import InputCss from "@ui5/webcomponents/dist/generated/themes/Input.css.js";
|
|
18
|
+
import ResponsivePopoverCommonCss from "@ui5/webcomponents/dist/generated/themes/ResponsivePopoverCommon.css.js";
|
|
19
|
+
import ValueStateMessageCss from "@ui5/webcomponents/dist/generated/themes/ValueStateMessage.css.js";
|
|
20
|
+
// templates
|
|
21
|
+
import InputTemplate from "./InputTemplate.js";
|
|
22
|
+
import { INPUT_VERSIONING_NEXT_BUTTON_TOOLTIP, INPUT_VERSIONING_PREVIOUS_BUTTON_TOOLTIP, INPUT_WRITING_ASSISTANT_BUTTON_TOOLTIP, WRITING_ASSISTANT_GENERATING_ANNOUNCEMENT, } from "./generated/i18n/i18n-defaults.js";
|
|
23
|
+
/**
|
|
24
|
+
* @class
|
|
25
|
+
*
|
|
26
|
+
* ### Overview
|
|
27
|
+
*
|
|
28
|
+
* The `ui5-ai-input` component extends the standard `ui5-input` with **AI Writing Assistant** capabilities.
|
|
29
|
+
*
|
|
30
|
+
* ### Structure
|
|
31
|
+
*
|
|
32
|
+
* The `ui5-ai-input` consists of the following main parts:
|
|
33
|
+
*
|
|
34
|
+
* - **Input Field** – Inherits all standard Input behaviors.
|
|
35
|
+
* - **AI Action Button** – Appears when focused or loading, providing access to AI-related actions or stopping generation.
|
|
36
|
+
*
|
|
37
|
+
* The component automatically determines which elements to render based on its internal state:
|
|
38
|
+
* - The AI Button is only shown when there are available `actions`.
|
|
39
|
+
* - The version navigation appears only when `totalVersions > 1`.
|
|
40
|
+
*
|
|
41
|
+
* ### Keyboard Support
|
|
42
|
+
*
|
|
43
|
+
* - **Shift + F4** — Opens the AI menu.
|
|
44
|
+
* - **Ctrl + Shift + Z / Y** — Navigates backward/forward between AI-generated versions.
|
|
45
|
+
*
|
|
46
|
+
* ### ES6 Module Import
|
|
47
|
+
*
|
|
48
|
+
* `import "@ui5/webcomponents-ai/dist/Input.js";`
|
|
49
|
+
*
|
|
50
|
+
* @constructor
|
|
51
|
+
* @extends BaseInput
|
|
52
|
+
* @since 2.16.0
|
|
53
|
+
* @experimental The **@ui5/webcomponents-ai** package is under active development and considered experimental. Component APIs are subject to change.
|
|
54
|
+
* @public
|
|
55
|
+
*/
|
|
56
|
+
let Input = Input_1 = class Input extends BaseInput {
|
|
57
|
+
constructor() {
|
|
58
|
+
super(...arguments);
|
|
59
|
+
/**
|
|
60
|
+
* Indicates the index of the currently displayed version.
|
|
61
|
+
*
|
|
62
|
+
* @default 0
|
|
63
|
+
* @public
|
|
64
|
+
*/
|
|
65
|
+
this.currentVersion = 0;
|
|
66
|
+
/**
|
|
67
|
+
* Indicates the total number of result versions available.
|
|
68
|
+
*
|
|
69
|
+
* When not set or set to 0, the versioning will be hidden.
|
|
70
|
+
*
|
|
71
|
+
* @default 0
|
|
72
|
+
* @public
|
|
73
|
+
*/
|
|
74
|
+
this.totalVersions = 0;
|
|
75
|
+
/**
|
|
76
|
+
* Defines whether the AI Writing Assistant is currently loading.
|
|
77
|
+
*
|
|
78
|
+
* When `true`, indicates that an AI action is in progress.
|
|
79
|
+
*
|
|
80
|
+
* @default false
|
|
81
|
+
* @public
|
|
82
|
+
*/
|
|
83
|
+
this.loading = false;
|
|
84
|
+
/**
|
|
85
|
+
* Indicates if the menu is open.
|
|
86
|
+
* @default 0
|
|
87
|
+
* @private
|
|
88
|
+
*/
|
|
89
|
+
this._isMenuOpen = false;
|
|
90
|
+
this._previousCurrentStep = 0;
|
|
91
|
+
this._previousTotalSteps = 0;
|
|
92
|
+
this.isFocused = false;
|
|
93
|
+
/**
|
|
94
|
+
* Handles the escape event for the AI generate Button.
|
|
95
|
+
* @private
|
|
96
|
+
*/
|
|
97
|
+
this._handleAIButtonKeydown = (e) => {
|
|
98
|
+
if (isEscape(e) && this.loading) {
|
|
99
|
+
this.fireDecoratorEvent("stop-generation");
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
_onfocusin(e) {
|
|
104
|
+
super._onfocusin(e);
|
|
105
|
+
this.isFocused = true;
|
|
106
|
+
}
|
|
107
|
+
_onfocusout(e) {
|
|
108
|
+
super._onfocusout(e);
|
|
109
|
+
this.isFocused = false;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Manages the focus when the navigation buttons become disabled/enabled.
|
|
113
|
+
* Automatically moves the focus to the available button when the user reaches the boundaries.
|
|
114
|
+
* @private
|
|
115
|
+
*/
|
|
116
|
+
_manageVersionButtonsFocus() {
|
|
117
|
+
const previousButton = this.shadowRoot?.getElementById("arrow-left");
|
|
118
|
+
const nextButton = this.shadowRoot?.getElementById("arrow-right");
|
|
119
|
+
const isPreviousDisabled = this.currentVersion <= 1;
|
|
120
|
+
const isNextDisabled = this.currentVersion >= this.totalVersions;
|
|
121
|
+
if (isPreviousDisabled && previousButton) {
|
|
122
|
+
setTimeout(() => {
|
|
123
|
+
nextButton.focus();
|
|
124
|
+
}, 0);
|
|
125
|
+
}
|
|
126
|
+
else if (isNextDisabled && nextButton) {
|
|
127
|
+
setTimeout(() => {
|
|
128
|
+
previousButton.focus();
|
|
129
|
+
}, 0);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Handles the click event for the AI generate Button.
|
|
134
|
+
* Fires the appropriate event based on the AI Button state.
|
|
135
|
+
* @private
|
|
136
|
+
*/
|
|
137
|
+
_handleAIButtonClick(e) {
|
|
138
|
+
const target = e.target;
|
|
139
|
+
if (target?.icon === "stop") {
|
|
140
|
+
this.fireDecoratorEvent("stop-generation");
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
const opener = this.shadowRoot?.querySelector(".ui5-input-ai-button");
|
|
144
|
+
this.fireDecoratorEvent("button-click");
|
|
145
|
+
this.menu.opener = opener;
|
|
146
|
+
this.menu.open = true;
|
|
147
|
+
this.menu.horizontalAlign = "End";
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Handles the version change event from the versioning component.
|
|
152
|
+
*
|
|
153
|
+
* @param {CustomEvent} e - The version change event
|
|
154
|
+
*/
|
|
155
|
+
_handleVersionChange(e) {
|
|
156
|
+
this.fireDecoratorEvent("version-change", {
|
|
157
|
+
backwards: e.detail.backwards,
|
|
158
|
+
});
|
|
159
|
+
this._manageVersionButtonsFocus();
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Handles the click event for the "Previous Version" button.
|
|
163
|
+
* Updates the current version index and syncs content.
|
|
164
|
+
* @private
|
|
165
|
+
*/
|
|
166
|
+
_handlePreviousButtonClick() {
|
|
167
|
+
this._handleVersionChange(new CustomEvent("version-change", { detail: { backwards: true } }));
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Handles the click event for the "Next Version" button.
|
|
171
|
+
* Updates the current version index and syncs content.
|
|
172
|
+
* @private
|
|
173
|
+
*/
|
|
174
|
+
_handleNextButtonClick() {
|
|
175
|
+
this._handleVersionChange(new CustomEvent("version-change", { detail: { backwards: false } }));
|
|
176
|
+
}
|
|
177
|
+
_onMenuIconClick(e) {
|
|
178
|
+
this.fireDecoratorEvent("item-click", e.detail);
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Handles keydown events for keyboard shortcuts.
|
|
182
|
+
* @private
|
|
183
|
+
*/
|
|
184
|
+
_onkeydown(e) {
|
|
185
|
+
super._onkeydown(e);
|
|
186
|
+
const menuButton = this.shadowRoot?.getElementById("ai-menu-btn");
|
|
187
|
+
if (isF4Shift(e)) {
|
|
188
|
+
menuButton?.focus();
|
|
189
|
+
this.menu.opener = menuButton;
|
|
190
|
+
this.menu.open = true;
|
|
191
|
+
this.menu.horizontalAlign = "End";
|
|
192
|
+
}
|
|
193
|
+
const goPreviousStep = e.key === "Z" && e.shiftKey && e.ctrlKey;
|
|
194
|
+
const goNextStep = e.key === "Y" && e.shiftKey && e.ctrlKey;
|
|
195
|
+
if (goPreviousStep) {
|
|
196
|
+
e.preventDefault();
|
|
197
|
+
this._handlePreviousButtonClick();
|
|
198
|
+
}
|
|
199
|
+
else if (goNextStep) {
|
|
200
|
+
e.preventDefault();
|
|
201
|
+
this._handleNextButtonClick();
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Handles visibility of the Writing Assistant Button.
|
|
206
|
+
* If there are no items, the Writing Assistant Button would not be rendered.
|
|
207
|
+
*/
|
|
208
|
+
get hasActions() {
|
|
209
|
+
return !!this?.menu?.getSlottedNodes("items").length;
|
|
210
|
+
}
|
|
211
|
+
get ariaLabel() {
|
|
212
|
+
return this.accessibleName || !this.loading ? Input_1.i18nBundle.getText(INPUT_WRITING_ASSISTANT_BUTTON_TOOLTIP) : Input_1.i18nBundle.getText(WRITING_ASSISTANT_GENERATING_ANNOUNCEMENT);
|
|
213
|
+
}
|
|
214
|
+
get stopGeneratingTooltip() {
|
|
215
|
+
return Input_1.i18nBundle.getText(WRITING_ASSISTANT_GENERATING_ANNOUNCEMENT);
|
|
216
|
+
}
|
|
217
|
+
get nextButtonAccessibleName() {
|
|
218
|
+
return Input_1.i18nBundle.getText(INPUT_VERSIONING_NEXT_BUTTON_TOOLTIP);
|
|
219
|
+
}
|
|
220
|
+
get previousButtonAccessibleName() {
|
|
221
|
+
return Input_1.i18nBundle.getText(INPUT_VERSIONING_PREVIOUS_BUTTON_TOOLTIP);
|
|
222
|
+
}
|
|
223
|
+
get menu() {
|
|
224
|
+
return this.shadowRoot?.querySelector("[ui5-menu]");
|
|
225
|
+
}
|
|
226
|
+
};
|
|
227
|
+
__decorate([
|
|
228
|
+
property({ type: Number })
|
|
229
|
+
], Input.prototype, "currentVersion", void 0);
|
|
230
|
+
__decorate([
|
|
231
|
+
property({ type: Number })
|
|
232
|
+
], Input.prototype, "totalVersions", void 0);
|
|
233
|
+
__decorate([
|
|
234
|
+
property({ type: Boolean })
|
|
235
|
+
], Input.prototype, "loading", void 0);
|
|
236
|
+
__decorate([
|
|
237
|
+
property({ type: Boolean })
|
|
238
|
+
], Input.prototype, "_isMenuOpen", void 0);
|
|
239
|
+
__decorate([
|
|
240
|
+
slot({
|
|
241
|
+
type: HTMLElement,
|
|
242
|
+
invalidateOnChildChange: true,
|
|
243
|
+
})
|
|
244
|
+
], Input.prototype, "actions", void 0);
|
|
245
|
+
Input = Input_1 = __decorate([
|
|
246
|
+
customElement({
|
|
247
|
+
tag: "ui5-ai-input",
|
|
248
|
+
languageAware: true,
|
|
249
|
+
renderer: jsxRenderer,
|
|
250
|
+
template: InputTemplate,
|
|
251
|
+
styles: [
|
|
252
|
+
AIInputCss,
|
|
253
|
+
InputCss,
|
|
254
|
+
ResponsivePopoverCommonCss,
|
|
255
|
+
ValueStateMessageCss,
|
|
256
|
+
],
|
|
257
|
+
})
|
|
258
|
+
/**
|
|
259
|
+
* Fired when the user selects the AI button.
|
|
260
|
+
* @public
|
|
261
|
+
*/
|
|
262
|
+
,
|
|
263
|
+
event("button-click", {
|
|
264
|
+
cancelable: true,
|
|
265
|
+
})
|
|
266
|
+
/** Fired when an item from the AI actions menu is clicked.
|
|
267
|
+
* @public
|
|
268
|
+
*/
|
|
269
|
+
,
|
|
270
|
+
event("item-click")
|
|
271
|
+
/**
|
|
272
|
+
* Fired when the user selects the "Stop" button to stop ongoing AI text generation.
|
|
273
|
+
* @public
|
|
274
|
+
*/
|
|
275
|
+
,
|
|
276
|
+
event("stop-generation")
|
|
277
|
+
/**
|
|
278
|
+
* Fired when the user selects the version navigation buttons.
|
|
279
|
+
*
|
|
280
|
+
* @param {boolean} backwards - Indicates if navigation is backwards (true) or forwards (false, default)
|
|
281
|
+
* @public
|
|
282
|
+
*/
|
|
283
|
+
,
|
|
284
|
+
event("version-change")
|
|
285
|
+
], Input);
|
|
286
|
+
Input.define();
|
|
287
|
+
export default Input;
|
|
288
|
+
//# sourceMappingURL=Input.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Input.js","sourceRoot":"","sources":["../src/Input.ts"],"names":[],"mappings":";;;;;;;AAAA,OA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,IAAI,IAAI;QACP,OAAO,IAAI,CAAC,UAAU,EAAE,aAAa,CAAC,YAAY,CAAS,CAAC;IAC7D,CAAC;CACD,CAAA;AAlMA;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;6CACR;AAWnB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4CACT;AAWlB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;sCACH;AAQzB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;0CACC;AAU7B;IAJC,IAAI,CAAC;QACL,IAAI,EAAE,WAAW;QACjB,uBAAuB,EAAE,IAAI;KAC7B,CAAC;sCAC2B;AAvDxB,KAAK;IAxCV,aAAa,CAAC;QACd,GAAG,EAAE,cAAc;QACnB,aAAa,EAAE,IAAI;QACnB,QAAQ,EAAE,WAAW;QACrB,QAAQ,EAAE,aAAa;QACvB,MAAM,EAAE;YACP,UAAU;YACV,QAAQ;YACR,0BAA0B;YAC1B,oBAAoB;SACpB;KACD,CAAC;IAEF;;;OAGG;;IACF,KAAK,CAAC,cAAc,EAAE;QACtB,UAAU,EAAE,IAAI;KAChB,CAAC;IAEF;;OAEG;;IACF,KAAK,CAAC,YAAY,CAAC;IAEpB;;;OAGG;;IACF,KAAK,CAAC,iBAAiB,CAAC;IAEzB;;;;;OAKG;;IACF,KAAK,CAAC,gBAAgB,CAAC;GAElB,KAAK,CAiNV;AAED,KAAK,CAAC,MAAM,EAAE,CAAC;AAGf,eAAe,KAAK,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 slot from \"@ui5/webcomponents-base/dist/decorators/slot.js\";\nimport jsxRenderer from \"@ui5/webcomponents-base/dist/renderer/JsxRenderer.js\";\nimport {\n\tisEscape,\n\tisF4Shift,\n} from \"@ui5/webcomponents-base/dist/Keys.js\";\nimport BaseInput from \"@ui5/webcomponents/dist/Input.js\";\nimport type Menu from \"@ui5/webcomponents/dist/Menu.js\";\nimport type { MenuItemClickEventDetail } from \"@ui5/webcomponents/dist/Menu.js\";\nimport type Button from \"./Button.js\";\n\n// styles\nimport AIInputCss from \"./generated/themes/Input.css.js\";\nimport InputCss from \"@ui5/webcomponents/dist/generated/themes/Input.css.js\";\nimport ResponsivePopoverCommonCss from \"@ui5/webcomponents/dist/generated/themes/ResponsivePopoverCommon.css.js\";\nimport ValueStateMessageCss from \"@ui5/webcomponents/dist/generated/themes/ValueStateMessage.css.js\";\n\n// templates\nimport InputTemplate from \"./InputTemplate.js\";\nimport {\n\tINPUT_VERSIONING_NEXT_BUTTON_TOOLTIP,\n\tINPUT_VERSIONING_PREVIOUS_BUTTON_TOOLTIP,\n\tINPUT_WRITING_ASSISTANT_BUTTON_TOOLTIP,\n\tWRITING_ASSISTANT_GENERATING_ANNOUNCEMENT,\n} from \"./generated/i18n/i18n-defaults.js\";\n\ntype InputVersionChangeEventDetail = {\n\tbackwards: boolean,\n};\n\n/**\n * @class\n *\n * ### Overview\n *\n * The `ui5-ai-input` component extends the standard `ui5-input` with **AI Writing Assistant** capabilities.\n *\n * ### Structure\n *\n * The `ui5-ai-input` consists of the following main parts:\n *\n * - **Input Field** – Inherits all standard Input behaviors.\n * - **AI Action Button** – Appears when focused or loading, providing access to AI-related actions or stopping generation.\n *\n * The component automatically determines which elements to render based on its internal state:\n * - The AI Button is only shown when there are available `actions`.\n * - The version navigation appears only when `totalVersions > 1`.\n *\n * ### Keyboard Support\n *\n * - **Shift + F4** — Opens the AI menu.\n * - **Ctrl + Shift + Z / Y** — Navigates backward/forward between AI-generated versions.\n *\n * ### ES6 Module Import\n *\n * `import \"@ui5/webcomponents-ai/dist/Input.js\";`\n *\n * @constructor\n * @extends BaseInput\n * @since 2.16.0\n * @experimental The **@ui5/webcomponents-ai** package is under active development and considered experimental. Component APIs are subject to change.\n * @public\n */\n@customElement({\n\ttag: \"ui5-ai-input\",\n\tlanguageAware: true,\n\trenderer: jsxRenderer,\n\ttemplate: InputTemplate,\n\tstyles: [\n\t\tAIInputCss,\n\t\tInputCss,\n\t\tResponsivePopoverCommonCss,\n\t\tValueStateMessageCss,\n\t],\n})\n\n/**\n * Fired when the user selects the AI button.\n * @public\n */\n@event(\"button-click\", {\n\tcancelable: true,\n})\n\n/** Fired when an item from the AI actions menu is clicked.\n * @public\n */\n@event(\"item-click\")\n\n/**\n * Fired when the user selects the \"Stop\" button to stop ongoing AI text generation.\n * @public\n */\n@event(\"stop-generation\")\n\n/**\n * Fired when the user selects the version navigation buttons.\n *\n * @param {boolean} backwards - Indicates if navigation is backwards (true) or forwards (false, default)\n * @public\n */\n@event(\"version-change\")\n\nclass Input extends BaseInput {\n\teventDetails!: BaseInput[\"eventDetails\"] & {\n\t\t\"version-change\": InputVersionChangeEventDetail;\n\t\t\"stop-generation\": void;\n\t\t\"button-click\": void;\n\t\t\"item-click\": MenuItemClickEventDetail;\n\t};\n\n\t/**\n\t * Indicates the index of the currently displayed version.\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 * When not set or set to 0, the versioning will be hidden.\n\t *\n\t * @default 0\n\t * @public\n\t */\n\t@property({ type: Number })\n\ttotalVersions = 0;\n\n\t/**\n\t * Defines whether the AI 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 * @public\n\t */\n\t@property({ type: Boolean })\n\tloading: boolean = false;\n\n\t/**\n\t * Indicates if the menu is open.\n\t * @default 0\n\t * @private\n\t */\n\t@property({ type: Boolean })\n\t_isMenuOpen: boolean = false;\n\n\t/**\n\t * Defines the items of the menu for the component.\n\t * @public\n\t */\n\t@slot({\n\t\ttype: HTMLElement,\n\t\tinvalidateOnChildChange: true,\n\t})\n\tactions!: Array<HTMLElement>;\n\n\t_previousCurrentStep = 0;\n\t_previousTotalSteps = 0;\n\tisFocused: boolean = false;\n\n\t_onfocusin(e: FocusEvent): void {\n\t\tsuper._onfocusin(e);\n\t\tthis.isFocused = true;\n\t}\n\n\t_onfocusout(e: FocusEvent): void {\n\t\tsuper._onfocusout(e);\n\t\tthis.isFocused = false;\n\t}\n\n\t/**\n\t * Manages the focus when the navigation buttons become disabled/enabled.\n\t * Automatically moves the focus to the available button when the user reaches the boundaries.\n\t * @private\n\t */\n\t_manageVersionButtonsFocus() {\n\t\tconst previousButton = this.shadowRoot?.getElementById(\"arrow-left\") as Button;\n\t\tconst nextButton = this.shadowRoot?.getElementById(\"arrow-right\") as Button;\n\t\tconst isPreviousDisabled = this.currentVersion <= 1;\n\t\tconst isNextDisabled = this.currentVersion >= this.totalVersions;\n\n\t\tif (isPreviousDisabled && previousButton) {\n\t\t\tsetTimeout(() => {\n\t\t\t\tnextButton.focus();\n\t\t\t}, 0);\n\t\t} else if (isNextDisabled && nextButton) {\n\t\t\tsetTimeout(() => {\n\t\t\t\tpreviousButton.focus();\n\t\t\t}, 0);\n\t\t}\n\t}\n\n\t/**\n\t * Handles the click event for the AI generate Button.\n\t * Fires the appropriate event based on the AI Button state.\n\t * @private\n\t */\n\t_handleAIButtonClick(e: Event) {\n\t\tconst target = e.target as HTMLElement & { icon?: string };\n\t\tif (target?.icon === \"stop\") {\n\t\t\tthis.fireDecoratorEvent(\"stop-generation\");\n\t\t} else {\n\t\t\tconst opener = this.shadowRoot?.querySelector(\".ui5-input-ai-button\") as HTMLElement;\n\t\t\tthis.fireDecoratorEvent(\"button-click\");\n\t\t\tthis.menu.opener = opener;\n\t\t\tthis.menu.open = true;\n\t\t\tthis.menu.horizontalAlign = \"End\";\n\t\t}\n\t}\n\n\t/**\n\t * Handles the escape event for the AI generate Button.\n\t * @private\n\t */\n\t_handleAIButtonKeydown = (e: KeyboardEvent) => {\n\t\tif (isEscape(e) && this.loading) {\n\t\t\tthis.fireDecoratorEvent(\"stop-generation\");\n\t\t}\n\t}\n\n\t/**\n\t * Handles the version change event from the versioning component.\n\t *\n\t * @param {CustomEvent} e - The version change event\n\t */\n\t_handleVersionChange(e: CustomEvent<{ backwards: boolean }>) {\n\t\tthis.fireDecoratorEvent(\"version-change\", {\n\t\t\tbackwards: e.detail.backwards,\n\t\t});\n\t\tthis._manageVersionButtonsFocus();\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 * @private\n\t */\n\t_handlePreviousButtonClick(): void {\n\t\tthis._handleVersionChange(new CustomEvent(\"version-change\", { detail: { 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 * @private\n\t */\n\t_handleNextButtonClick(): void {\n\t\tthis._handleVersionChange(new CustomEvent(\"version-change\", { detail: { backwards: false } }));\n\t}\n\n\t_onMenuIconClick(e: CustomEvent<MenuItemClickEventDetail>): void {\n\t\tthis.fireDecoratorEvent(\"item-click\", e.detail);\n\t}\n\n\t/**\n\t * Handles keydown events for keyboard shortcuts.\n\t * @private\n\t */\n\t_onkeydown(e: KeyboardEvent): void {\n\t\tsuper._onkeydown(e);\n\t\tconst menuButton = this.shadowRoot?.getElementById(\"ai-menu-btn\") as HTMLElement;\n\n\t\tif (isF4Shift(e)) {\n\t\t\tmenuButton?.focus();\n\n\t\t\tthis.menu.opener = menuButton;\n\t\t\tthis.menu.open = true;\n\t\t\tthis.menu.horizontalAlign = \"End\";\n\t\t}\n\t\tconst goPreviousStep = e.key === \"Z\" && e.shiftKey && e.ctrlKey;\n\t\tconst goNextStep = e.key === \"Y\" && e.shiftKey && e.ctrlKey;\n\n\t\tif (goPreviousStep) {\n\t\t\te.preventDefault();\n\t\t\tthis._handlePreviousButtonClick();\n\t\t} else if (goNextStep) {\n\t\t\te.preventDefault();\n\t\t\tthis._handleNextButtonClick();\n\t\t}\n\t}\n\n\t/**\n\t * Handles visibility of the Writing Assistant Button.\n\t * If there are no items, the Writing Assistant Button would not be rendered.\n\t */\n\tget hasActions() {\n\t\treturn !!this?.menu?.getSlottedNodes(\"items\").length;\n\t}\n\n\tget ariaLabel() {\n\t\treturn this.accessibleName || !this.loading ? Input.i18nBundle.getText(INPUT_WRITING_ASSISTANT_BUTTON_TOOLTIP) : Input.i18nBundle.getText(WRITING_ASSISTANT_GENERATING_ANNOUNCEMENT);\n\t}\n\n\tget stopGeneratingTooltip() {\n\t\treturn Input.i18nBundle.getText(WRITING_ASSISTANT_GENERATING_ANNOUNCEMENT);\n\t}\n\n\tget nextButtonAccessibleName() {\n\t\treturn Input.i18nBundle.getText(INPUT_VERSIONING_NEXT_BUTTON_TOOLTIP);\n\t}\n\n\tget previousButtonAccessibleName() {\n\t\treturn Input.i18nBundle.getText(INPUT_VERSIONING_PREVIOUS_BUTTON_TOOLTIP);\n\t}\n\n\tget menu() {\n\t\treturn this.shadowRoot?.querySelector(\"[ui5-menu]\") as Menu;\n\t}\n}\n\nInput.define();\n\nexport type { InputVersionChangeEventDetail, MenuItemClickEventDetail as InputItemClickEventDetail };\nexport default Input;\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type Input from "./Input.js";
|
|
2
|
+
import "@ui5/webcomponents-icons/dist/navigation-left-arrow.js";
|
|
3
|
+
import "@ui5/webcomponents-icons/dist/navigation-right-arrow.js";
|
|
4
|
+
import type { JsxTemplateResult } from "@ui5/webcomponents-base";
|
|
5
|
+
type TemplateHook = () => JsxTemplateResult;
|
|
6
|
+
export default function InputTemplate(this: Input, hooks?: {
|
|
7
|
+
preContent: TemplateHook;
|
|
8
|
+
postContent: TemplateHook;
|
|
9
|
+
}): import("@ui5/webcomponents-base").JSX.Element;
|
|
10
|
+
export {};
|