@ui5/webcomponents-ai 0.0.0-093de5dd1
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/.env.production +1 -0
- package/.env.testing +4 -0
- package/.npsrc.json +3 -0
- package/.ui5-cem-aliases.json +4 -0
- package/CHANGELOG.md +1004 -0
- package/LICENSE.txt +201 -0
- package/README.md +40 -0
- package/cypress.config.js +3 -0
- package/dist/.tsbuildinfo +1 -0
- package/dist/Assets-fetch.d.ts +3 -0
- package/dist/Assets-fetch.js +6 -0
- package/dist/Assets-fetch.js.map +1 -0
- package/dist/Assets-node.d.ts +14 -0
- package/dist/Assets-node.js +17 -0
- package/dist/Assets-node.js.map +1 -0
- package/dist/Assets.d.ts +3 -0
- package/dist/Assets.js +6 -0
- package/dist/Assets.js.map +1 -0
- package/dist/Button.d.ts +166 -0
- package/dist/Button.js +325 -0
- package/dist/Button.js.map +1 -0
- package/dist/ButtonState.d.ts +68 -0
- package/dist/ButtonState.js +65 -0
- package/dist/ButtonState.js.map +1 -0
- package/dist/ButtonTemplate.d.ts +2 -0
- package/dist/ButtonTemplate.js +6 -0
- package/dist/ButtonTemplate.js.map +1 -0
- package/dist/Input.d.ts +144 -0
- package/dist/Input.js +289 -0
- package/dist/Input.js.map +1 -0
- package/dist/InputTemplate.d.ts +10 -0
- package/dist/InputTemplate.js +28 -0
- package/dist/InputTemplate.js.map +1 -0
- package/dist/PromptInput.d.ts +150 -0
- package/dist/PromptInput.js +226 -0
- package/dist/PromptInput.js.map +1 -0
- package/dist/PromptInputTemplate.d.ts +2 -0
- package/dist/PromptInputTemplate.js +12 -0
- package/dist/PromptInputTemplate.js.map +1 -0
- package/dist/TextArea.d.ts +124 -0
- package/dist/TextArea.js +272 -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 +101 -0
- package/dist/WritingAssistant.js +201 -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.d.ts +3 -0
- package/dist/bundle.esm.js +11 -0
- package/dist/bundle.esm.js.map +1 -0
- package/dist/bundle.scoped.config.d.ts +1 -0
- package/dist/bundle.scoped.config.js +3 -0
- package/dist/bundle.scoped.config.js.map +1 -0
- package/dist/bundle.scoped.esm.d.ts +2 -0
- package/dist/bundle.scoped.esm.js +3 -0
- package/dist/bundle.scoped.esm.js.map +1 -0
- package/dist/css/themes/Button.css +1 -0
- package/dist/css/themes/Input.css +1 -0
- package/dist/css/themes/PromptInput.css +1 -0
- 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/css/themes/sap_horizon/parameters-bundle.css +0 -0
- package/dist/css/themes/sap_horizon_dark/parameters-bundle.css +0 -0
- package/dist/css/themes/sap_horizon_hcb/parameters-bundle.css +0 -0
- package/dist/css/themes/sap_horizon_hcw/parameters-bundle.css +0 -0
- package/dist/custom-elements-internal.json +1949 -0
- package/dist/custom-elements.json +1698 -0
- package/dist/generated/assets/i18n/messagebundle_ar.json +1 -0
- package/dist/generated/assets/i18n/messagebundle_bg.json +1 -0
- package/dist/generated/assets/i18n/messagebundle_ca.json +1 -0
- package/dist/generated/assets/i18n/messagebundle_cnr.json +1 -0
- package/dist/generated/assets/i18n/messagebundle_cs.json +1 -0
- package/dist/generated/assets/i18n/messagebundle_cy.json +1 -0
- package/dist/generated/assets/i18n/messagebundle_da.json +1 -0
- package/dist/generated/assets/i18n/messagebundle_de.json +1 -0
- package/dist/generated/assets/i18n/messagebundle_el.json +1 -0
- package/dist/generated/assets/i18n/messagebundle_en.json +1 -0
- package/dist/generated/assets/i18n/messagebundle_en_GB.json +1 -0
- package/dist/generated/assets/i18n/messagebundle_en_US_sappsd.json +1 -0
- package/dist/generated/assets/i18n/messagebundle_en_US_saprigi.json +1 -0
- package/dist/generated/assets/i18n/messagebundle_en_US_saptrc.json +1 -0
- package/dist/generated/assets/i18n/messagebundle_es.json +1 -0
- package/dist/generated/assets/i18n/messagebundle_es_MX.json +1 -0
- package/dist/generated/assets/i18n/messagebundle_et.json +1 -0
- package/dist/generated/assets/i18n/messagebundle_fi.json +1 -0
- package/dist/generated/assets/i18n/messagebundle_fr.json +1 -0
- package/dist/generated/assets/i18n/messagebundle_fr_CA.json +1 -0
- package/dist/generated/assets/i18n/messagebundle_hi.json +1 -0
- package/dist/generated/assets/i18n/messagebundle_hr.json +1 -0
- package/dist/generated/assets/i18n/messagebundle_hu.json +1 -0
- package/dist/generated/assets/i18n/messagebundle_id.json +1 -0
- package/dist/generated/assets/i18n/messagebundle_it.json +1 -0
- package/dist/generated/assets/i18n/messagebundle_iw.json +1 -0
- package/dist/generated/assets/i18n/messagebundle_ja.json +1 -0
- package/dist/generated/assets/i18n/messagebundle_kk.json +1 -0
- package/dist/generated/assets/i18n/messagebundle_ko.json +1 -0
- package/dist/generated/assets/i18n/messagebundle_lt.json +1 -0
- package/dist/generated/assets/i18n/messagebundle_lv.json +1 -0
- package/dist/generated/assets/i18n/messagebundle_mk.json +1 -0
- package/dist/generated/assets/i18n/messagebundle_ms.json +1 -0
- package/dist/generated/assets/i18n/messagebundle_nl.json +1 -0
- package/dist/generated/assets/i18n/messagebundle_no.json +1 -0
- package/dist/generated/assets/i18n/messagebundle_pl.json +1 -0
- package/dist/generated/assets/i18n/messagebundle_pt.json +1 -0
- package/dist/generated/assets/i18n/messagebundle_pt_PT.json +1 -0
- package/dist/generated/assets/i18n/messagebundle_ro.json +1 -0
- package/dist/generated/assets/i18n/messagebundle_ru.json +1 -0
- package/dist/generated/assets/i18n/messagebundle_sh.json +1 -0
- package/dist/generated/assets/i18n/messagebundle_sk.json +1 -0
- package/dist/generated/assets/i18n/messagebundle_sl.json +1 -0
- package/dist/generated/assets/i18n/messagebundle_sr.json +1 -0
- package/dist/generated/assets/i18n/messagebundle_sv.json +1 -0
- package/dist/generated/assets/i18n/messagebundle_th.json +1 -0
- package/dist/generated/assets/i18n/messagebundle_tr.json +1 -0
- package/dist/generated/assets/i18n/messagebundle_uk.json +1 -0
- package/dist/generated/assets/i18n/messagebundle_vi.json +1 -0
- package/dist/generated/assets/i18n/messagebundle_zh_CN.json +1 -0
- package/dist/generated/assets/i18n/messagebundle_zh_TW.json +1 -0
- package/dist/generated/assets/themes/sap_horizon/parameters-bundle.css.json +1 -0
- package/dist/generated/assets/themes/sap_horizon_dark/parameters-bundle.css.json +1 -0
- package/dist/generated/assets/themes/sap_horizon_hcb/parameters-bundle.css.json +1 -0
- package/dist/generated/assets/themes/sap_horizon_hcw/parameters-bundle.css.json +1 -0
- package/dist/generated/i18n/i18n-defaults.d.ts +18 -0
- package/dist/generated/i18n/i18n-defaults.js +18 -0
- package/dist/generated/i18n/i18n-defaults.js.map +1 -0
- package/dist/generated/json-imports/Themes-fetch.d.ts +1 -0
- package/dist/generated/json-imports/Themes-fetch.js +21 -0
- package/dist/generated/json-imports/Themes-fetch.js.map +1 -0
- package/dist/generated/json-imports/Themes-node.d.ts +1 -0
- package/dist/generated/json-imports/Themes-node.js +21 -0
- package/dist/generated/json-imports/Themes-node.js.map +1 -0
- package/dist/generated/json-imports/Themes.d.ts +1 -0
- package/dist/generated/json-imports/Themes.js +21 -0
- package/dist/generated/json-imports/Themes.js.map +1 -0
- package/dist/generated/json-imports/i18n-fetch.d.ts +1 -0
- package/dist/generated/json-imports/i18n-fetch.js +120 -0
- package/dist/generated/json-imports/i18n-fetch.js.map +1 -0
- package/dist/generated/json-imports/i18n-node.d.ts +1 -0
- package/dist/generated/json-imports/i18n-node.js +120 -0
- package/dist/generated/json-imports/i18n-node.js.map +1 -0
- package/dist/generated/json-imports/i18n.d.ts +1 -0
- package/dist/generated/json-imports/i18n.js +120 -0
- package/dist/generated/json-imports/i18n.js.map +1 -0
- package/dist/generated/themes/Button.css.d.ts +2 -0
- package/dist/generated/themes/Button.css.js +8 -0
- package/dist/generated/themes/Button.css.js.map +1 -0
- package/dist/generated/themes/Input.css.d.ts +2 -0
- package/dist/generated/themes/Input.css.js +8 -0
- package/dist/generated/themes/Input.css.js.map +1 -0
- package/dist/generated/themes/PromptInput.css.d.ts +2 -0
- package/dist/generated/themes/PromptInput.css.js +8 -0
- package/dist/generated/themes/PromptInput.css.js.map +1 -0
- package/dist/generated/themes/TextArea.css.d.ts +2 -0
- package/dist/generated/themes/TextArea.css.js +8 -0
- package/dist/generated/themes/TextArea.css.js.map +1 -0
- package/dist/generated/themes/Versioning.css.d.ts +2 -0
- package/dist/generated/themes/Versioning.css.js +8 -0
- package/dist/generated/themes/Versioning.css.js.map +1 -0
- package/dist/generated/themes/WritingAssistant.css.d.ts +2 -0
- package/dist/generated/themes/WritingAssistant.css.js +8 -0
- package/dist/generated/themes/WritingAssistant.css.js.map +1 -0
- package/dist/generated/themes/sap_horizon/parameters-bundle.css.d.ts +2 -0
- package/dist/generated/themes/sap_horizon/parameters-bundle.css.js +2 -0
- package/dist/generated/themes/sap_horizon/parameters-bundle.css.js.map +1 -0
- package/dist/generated/themes/sap_horizon_dark/parameters-bundle.css.d.ts +2 -0
- package/dist/generated/themes/sap_horizon_dark/parameters-bundle.css.js +2 -0
- package/dist/generated/themes/sap_horizon_dark/parameters-bundle.css.js.map +1 -0
- package/dist/generated/themes/sap_horizon_hcb/parameters-bundle.css.d.ts +2 -0
- package/dist/generated/themes/sap_horizon_hcb/parameters-bundle.css.js +2 -0
- package/dist/generated/themes/sap_horizon_hcb/parameters-bundle.css.js.map +1 -0
- package/dist/generated/themes/sap_horizon_hcw/parameters-bundle.css.d.ts +2 -0
- package/dist/generated/themes/sap_horizon_hcw/parameters-bundle.css.js +2 -0
- package/dist/generated/themes/sap_horizon_hcw/parameters-bundle.css.js.map +1 -0
- package/dist/vscode.html-custom-data.json +188 -0
- package/dist/web-types.json +488 -0
- package/jsconfig.json +11 -0
- package/package-scripts.cjs +18 -0
- package/package.json +64 -0
- package/src/ButtonTemplate.tsx +27 -0
- package/src/InputTemplate.tsx +197 -0
- package/src/PromptInputTemplate.tsx +49 -0
- package/src/TextArea.css +25 -0
- package/src/TextAreaTemplate.tsx +91 -0
- package/src/ToolbarLabelTemplate.tsx +9 -0
- package/src/VersioningTemplate.tsx +34 -0
- package/src/WritingAssistantTemplate.tsx +51 -0
- package/src/i18n/messagebundle.properties +50 -0
- package/src/i18n/messagebundle_ar.properties +32 -0
- package/src/i18n/messagebundle_bg.properties +32 -0
- package/src/i18n/messagebundle_ca.properties +32 -0
- package/src/i18n/messagebundle_cnr.properties +32 -0
- package/src/i18n/messagebundle_cs.properties +32 -0
- package/src/i18n/messagebundle_cy.properties +32 -0
- package/src/i18n/messagebundle_da.properties +32 -0
- package/src/i18n/messagebundle_de.properties +32 -0
- package/src/i18n/messagebundle_el.properties +32 -0
- package/src/i18n/messagebundle_en.properties +47 -0
- package/src/i18n/messagebundle_en_GB.properties +32 -0
- package/src/i18n/messagebundle_en_US_sappsd.properties +32 -0
- package/src/i18n/messagebundle_en_US_saprigi.properties +32 -0
- package/src/i18n/messagebundle_en_US_saptrc.properties +32 -0
- package/src/i18n/messagebundle_es.properties +32 -0
- package/src/i18n/messagebundle_es_MX.properties +32 -0
- package/src/i18n/messagebundle_et.properties +32 -0
- package/src/i18n/messagebundle_fi.properties +32 -0
- package/src/i18n/messagebundle_fr.properties +32 -0
- package/src/i18n/messagebundle_fr_CA.properties +32 -0
- package/src/i18n/messagebundle_hi.properties +32 -0
- package/src/i18n/messagebundle_hr.properties +32 -0
- package/src/i18n/messagebundle_hu.properties +32 -0
- package/src/i18n/messagebundle_id.properties +32 -0
- package/src/i18n/messagebundle_it.properties +32 -0
- package/src/i18n/messagebundle_iw.properties +32 -0
- package/src/i18n/messagebundle_ja.properties +32 -0
- package/src/i18n/messagebundle_kk.properties +32 -0
- package/src/i18n/messagebundle_ko.properties +32 -0
- package/src/i18n/messagebundle_lt.properties +32 -0
- package/src/i18n/messagebundle_lv.properties +32 -0
- package/src/i18n/messagebundle_mk.properties +32 -0
- package/src/i18n/messagebundle_ms.properties +32 -0
- package/src/i18n/messagebundle_nl.properties +32 -0
- package/src/i18n/messagebundle_no.properties +32 -0
- package/src/i18n/messagebundle_pl.properties +32 -0
- package/src/i18n/messagebundle_pt.properties +32 -0
- package/src/i18n/messagebundle_pt_PT.properties +32 -0
- package/src/i18n/messagebundle_ro.properties +32 -0
- package/src/i18n/messagebundle_ru.properties +32 -0
- package/src/i18n/messagebundle_sh.properties +32 -0
- package/src/i18n/messagebundle_sk.properties +32 -0
- package/src/i18n/messagebundle_sl.properties +32 -0
- package/src/i18n/messagebundle_sr.properties +32 -0
- package/src/i18n/messagebundle_sv.properties +32 -0
- package/src/i18n/messagebundle_th.properties +32 -0
- package/src/i18n/messagebundle_tr.properties +32 -0
- package/src/i18n/messagebundle_uk.properties +32 -0
- package/src/i18n/messagebundle_vi.properties +32 -0
- package/src/i18n/messagebundle_zh_CN.properties +32 -0
- package/src/i18n/messagebundle_zh_TW.properties +32 -0
- package/src/themes/Button.css +142 -0
- package/src/themes/Input.css +83 -0
- package/src/themes/PromptInput.css +34 -0
- package/src/themes/TextArea.css +45 -0
- package/src/themes/Versioning.css +20 -0
- package/src/themes/WritingAssistant.css +23 -0
- package/src/themes/base/Button-parameters.css +2 -0
- package/src/themes/sap_horizon/parameters-bundle.css +1 -0
- package/src/themes/sap_horizon_dark/parameters-bundle.css +1 -0
- package/src/themes/sap_horizon_hcb/parameters-bundle.css +1 -0
- package/src/themes/sap_horizon_hcw/parameters-bundle.css +1 -0
- package/tsconfig.json +63 -0
package/dist/Button.d.ts
ADDED
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import UI5Element from "@ui5/webcomponents-base/dist/UI5Element.js";
|
|
2
|
+
import type SplitButton from "@ui5/webcomponents/dist/SplitButton.js";
|
|
3
|
+
import type ButtonDesign from "@ui5/webcomponents/dist/types/ButtonDesign.js";
|
|
4
|
+
import type ButtonState from "./ButtonState.js";
|
|
5
|
+
import "./ButtonState.js";
|
|
6
|
+
import type I18nBundle from "@ui5/webcomponents-base/dist/i18nBundle.js";
|
|
7
|
+
import type { AccessibilityAttributes } from "@ui5/webcomponents-base/dist/types.js";
|
|
8
|
+
type AIButtonRootAccessibilityAttributes = Pick<AccessibilityAttributes, "hasPopup" | "roleDescription" | "title" | "ariaKeyShortcuts">;
|
|
9
|
+
type AIButtonArrowButtonAccessibilityAttributes = Pick<AccessibilityAttributes, "hasPopup" | "expanded" | "title">;
|
|
10
|
+
type AIButtonAccessibilityAttributes = {
|
|
11
|
+
root?: AIButtonRootAccessibilityAttributes;
|
|
12
|
+
arrowButton?: AIButtonArrowButtonAccessibilityAttributes;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* @class
|
|
16
|
+
*
|
|
17
|
+
* ### Overview
|
|
18
|
+
*
|
|
19
|
+
* 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`
|
|
20
|
+
* or by pressing keyboard keys like [Enter] or [Space].
|
|
21
|
+
*
|
|
22
|
+
* ### Usage
|
|
23
|
+
*
|
|
24
|
+
* 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.
|
|
25
|
+
* Each state has a name for identification and can include text, an icon, and an end icon, as needed for its purpose.
|
|
26
|
+
* You can define a split mode for the `ui5-ai-button`, which will results in displaying an arrow button for additional actions.
|
|
27
|
+
*
|
|
28
|
+
* You can choose from a set of predefined designs for `ui5-ai-button` (as in `ui5-button`) to match the desired styling.
|
|
29
|
+
*
|
|
30
|
+
* 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
|
|
31
|
+
* in split mode, you can activate the default button action by clicking or tapping it, or by pressing keyboard keys like [Enter] or [Space].
|
|
32
|
+
* You can activate the arrow button by clicking or tapping it, or by pressing keyboard keys like [Arrow Up], [Arrow Down], or [F4].
|
|
33
|
+
* To display additional actions, you can attach a menu to the arrow button.
|
|
34
|
+
*
|
|
35
|
+
* ### ES6 Module Import
|
|
36
|
+
*
|
|
37
|
+
* `import "@ui5/webcomponents-ai/dist/Button.js";`
|
|
38
|
+
*
|
|
39
|
+
* @constructor
|
|
40
|
+
* @extends UI5Element
|
|
41
|
+
* @since 2.0.0
|
|
42
|
+
* @public
|
|
43
|
+
* @experimental The **@ui5/webcomponents-ai** package (including Button and ButtonState) is under active development and considered experimental. Component APIs are subject to change.
|
|
44
|
+
* Furthermore, the package supports **Horizon** themes only.
|
|
45
|
+
*/
|
|
46
|
+
declare class Button extends UI5Element {
|
|
47
|
+
eventDetails: {
|
|
48
|
+
"click": void;
|
|
49
|
+
"arrow-button-click": void;
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* Defines the component design.
|
|
53
|
+
* @default "Default"
|
|
54
|
+
* @public
|
|
55
|
+
*/
|
|
56
|
+
design?: `${ButtonDesign}`;
|
|
57
|
+
/**
|
|
58
|
+
* Defines whether the component is disabled.
|
|
59
|
+
* A disabled component can't be pressed or
|
|
60
|
+
* focused, and it is not in the tab chain.
|
|
61
|
+
* @default false
|
|
62
|
+
* @public
|
|
63
|
+
*/
|
|
64
|
+
disabled: boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Defines the current state of the component.
|
|
67
|
+
*
|
|
68
|
+
* @default undefined
|
|
69
|
+
* @public
|
|
70
|
+
*/
|
|
71
|
+
state?: string;
|
|
72
|
+
/**
|
|
73
|
+
* Defines the active state of the arrow button in split mode.
|
|
74
|
+
* Set to true when the button is in split mode and a menu with additional options
|
|
75
|
+
* is opened by the arrow button. Set back to false when the menu is closed.
|
|
76
|
+
* @default false
|
|
77
|
+
* @public
|
|
78
|
+
* @since 2.6.0
|
|
79
|
+
*/
|
|
80
|
+
arrowButtonPressed: boolean;
|
|
81
|
+
/**
|
|
82
|
+
* Defines the additional accessibility attributes that will be applied to the component.
|
|
83
|
+
*
|
|
84
|
+
* This property allows for fine-tuned control of ARIA attributes for screen reader support.
|
|
85
|
+
* It accepts an object with the following optional fields:
|
|
86
|
+
*
|
|
87
|
+
* - **root**: Accessibility attributes that will be applied to the root element.
|
|
88
|
+
* - **hasPopup**: Indicates the availability and type of interactive popup element (such as a menu or dialog).
|
|
89
|
+
* Accepts string values: `"dialog"`, `"grid"`, `"listbox"`, `"menu"`, or `"tree"`.
|
|
90
|
+
* - **roleDescription**: Defines a human-readable description for the button's role.
|
|
91
|
+
* Accepts any string value.
|
|
92
|
+
* - **title**: Specifies a tooltip or description for screen readers.
|
|
93
|
+
* Accepts any string value.
|
|
94
|
+
* - **ariaKeyShortcuts**: Defines keyboard shortcuts that activate or focus the button.
|
|
95
|
+
*
|
|
96
|
+
* - **arrowButton**: Accessibility attributes that will be applied to the arrow (split) button element.
|
|
97
|
+
* - **hasPopup**: Indicates the type of popup triggered by the arrow button.
|
|
98
|
+
* Accepts string values: `"dialog"`, `"grid"`, `"listbox"`, `"menu"`, or `"tree"`.
|
|
99
|
+
* - **expanded**: Indicates whether the popup controlled by the arrow button is currently expanded.
|
|
100
|
+
* Accepts boolean values: `true` or `false`.
|
|
101
|
+
*
|
|
102
|
+
* @public
|
|
103
|
+
* @since 2.6.0
|
|
104
|
+
* @default {}
|
|
105
|
+
*/
|
|
106
|
+
accessibilityAttributes: AIButtonAccessibilityAttributes;
|
|
107
|
+
/**
|
|
108
|
+
* Keeps the current state object of the component.
|
|
109
|
+
* @private
|
|
110
|
+
*/
|
|
111
|
+
_currentStateObject?: ButtonState;
|
|
112
|
+
/**
|
|
113
|
+
* Determines if the button is in icon-only mode.
|
|
114
|
+
* This property is animation related only.
|
|
115
|
+
* @default false
|
|
116
|
+
* @private
|
|
117
|
+
*/
|
|
118
|
+
iconOnly?: boolean | undefined;
|
|
119
|
+
/**
|
|
120
|
+
* Defines the available states of the component.
|
|
121
|
+
* **Note:** Although this slot accepts HTML Elements, it is strongly recommended that
|
|
122
|
+
* you only use `ui5-ai-button-state` components in order to preserve the intended design.
|
|
123
|
+
* @public
|
|
124
|
+
*/
|
|
125
|
+
states: Array<ButtonState>;
|
|
126
|
+
_splitButton?: SplitButton;
|
|
127
|
+
_hiddenSplitButton?: SplitButton;
|
|
128
|
+
static i18nBundleAi: I18nBundle;
|
|
129
|
+
get _hideArrowButton(): boolean;
|
|
130
|
+
get _effectiveState(): string;
|
|
131
|
+
get _effectiveStateObject(): ButtonState | undefined;
|
|
132
|
+
get _stateIconOnly(): boolean;
|
|
133
|
+
get _stateText(): string | undefined;
|
|
134
|
+
get _stateIcon(): string | undefined;
|
|
135
|
+
get _stateEndIcon(): string | undefined;
|
|
136
|
+
get _hasText(): boolean;
|
|
137
|
+
onBeforeRendering(): void;
|
|
138
|
+
/**
|
|
139
|
+
* Starts the fade-out animation.
|
|
140
|
+
* @private
|
|
141
|
+
*/
|
|
142
|
+
_fadeOut(): Promise<void>;
|
|
143
|
+
/**
|
|
144
|
+
* Starts the fade-in animation.
|
|
145
|
+
* @private
|
|
146
|
+
*/
|
|
147
|
+
_fadeIn(): void;
|
|
148
|
+
/**
|
|
149
|
+
* Resets the fade phases when the animation is completed.
|
|
150
|
+
* @private
|
|
151
|
+
*/
|
|
152
|
+
_resetFade(): void;
|
|
153
|
+
/**
|
|
154
|
+
* Handles the click event.
|
|
155
|
+
* @private
|
|
156
|
+
*/
|
|
157
|
+
_onClick(e: CustomEvent): void;
|
|
158
|
+
/**
|
|
159
|
+
* Handles the arrow-button-click event when `ui5-ai-button` is in split mode.
|
|
160
|
+
* @private
|
|
161
|
+
*/
|
|
162
|
+
_onArrowClick(e: CustomEvent): void;
|
|
163
|
+
get _computedAccessibilityAttributes(): AIButtonAccessibilityAttributes;
|
|
164
|
+
}
|
|
165
|
+
export default Button;
|
|
166
|
+
export type { AIButtonAccessibilityAttributes, };
|
package/dist/Button.js
ADDED
|
@@ -0,0 +1,325 @@
|
|
|
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 Button_1;
|
|
8
|
+
import UI5Element from "@ui5/webcomponents-base/dist/UI5Element.js";
|
|
9
|
+
import { renderFinished } from "@ui5/webcomponents-base/dist/Render.js";
|
|
10
|
+
import customElement from "@ui5/webcomponents-base/dist/decorators/customElement.js";
|
|
11
|
+
import property from "@ui5/webcomponents-base/dist/decorators/property.js";
|
|
12
|
+
import { i18n } from "@ui5/webcomponents-base/dist/decorators.js";
|
|
13
|
+
import event from "@ui5/webcomponents-base/dist/decorators/event-strict.js";
|
|
14
|
+
import slot from "@ui5/webcomponents-base/dist/decorators/slot.js";
|
|
15
|
+
import query from "@ui5/webcomponents-base/dist/decorators/query.js";
|
|
16
|
+
import jsxRenderer from "@ui5/webcomponents-base/dist/renderer/JsxRenderer.js";
|
|
17
|
+
import { BUTTON_TOOLTIP_TEXT } from "./generated/i18n/i18n-defaults.js";
|
|
18
|
+
import "./ButtonState.js";
|
|
19
|
+
import ButtonTemplate from "./ButtonTemplate.js";
|
|
20
|
+
import { getEffectiveAriaLabelText, getAssociatedLabelForTexts, getAllAccessibleNameRefTexts, } from "@ui5/webcomponents-base/dist/util/AccessibilityTextsHelper.js";
|
|
21
|
+
// Styles
|
|
22
|
+
import ButtonCss from "./generated/themes/Button.css.js";
|
|
23
|
+
/**
|
|
24
|
+
* @class
|
|
25
|
+
*
|
|
26
|
+
* ### Overview
|
|
27
|
+
*
|
|
28
|
+
* 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`
|
|
29
|
+
* or by pressing keyboard keys like [Enter] or [Space].
|
|
30
|
+
*
|
|
31
|
+
* ### Usage
|
|
32
|
+
*
|
|
33
|
+
* 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.
|
|
34
|
+
* Each state has a name for identification and can include text, an icon, and an end icon, as needed for its purpose.
|
|
35
|
+
* You can define a split mode for the `ui5-ai-button`, which will results in displaying an arrow button for additional actions.
|
|
36
|
+
*
|
|
37
|
+
* You can choose from a set of predefined designs for `ui5-ai-button` (as in `ui5-button`) to match the desired styling.
|
|
38
|
+
*
|
|
39
|
+
* 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
|
|
40
|
+
* in split mode, you can activate the default button action by clicking or tapping it, or by pressing keyboard keys like [Enter] or [Space].
|
|
41
|
+
* You can activate the arrow button by clicking or tapping it, or by pressing keyboard keys like [Arrow Up], [Arrow Down], or [F4].
|
|
42
|
+
* To display additional actions, you can attach a menu to the arrow button.
|
|
43
|
+
*
|
|
44
|
+
* ### ES6 Module Import
|
|
45
|
+
*
|
|
46
|
+
* `import "@ui5/webcomponents-ai/dist/Button.js";`
|
|
47
|
+
*
|
|
48
|
+
* @constructor
|
|
49
|
+
* @extends UI5Element
|
|
50
|
+
* @since 2.0.0
|
|
51
|
+
* @public
|
|
52
|
+
* @experimental The **@ui5/webcomponents-ai** package (including Button and ButtonState) is under active development and considered experimental. Component APIs are subject to change.
|
|
53
|
+
* Furthermore, the package supports **Horizon** themes only.
|
|
54
|
+
*/
|
|
55
|
+
let Button = Button_1 = class Button extends UI5Element {
|
|
56
|
+
constructor() {
|
|
57
|
+
super(...arguments);
|
|
58
|
+
/**
|
|
59
|
+
* Defines the component design.
|
|
60
|
+
* @default "Default"
|
|
61
|
+
* @public
|
|
62
|
+
*/
|
|
63
|
+
this.design = "Default";
|
|
64
|
+
/**
|
|
65
|
+
* Defines whether the component is disabled.
|
|
66
|
+
* A disabled component can't be pressed or
|
|
67
|
+
* focused, and it is not in the tab chain.
|
|
68
|
+
* @default false
|
|
69
|
+
* @public
|
|
70
|
+
*/
|
|
71
|
+
this.disabled = false;
|
|
72
|
+
/**
|
|
73
|
+
* Defines the active state of the arrow button in split mode.
|
|
74
|
+
* Set to true when the button is in split mode and a menu with additional options
|
|
75
|
+
* is opened by the arrow button. Set back to false when the menu is closed.
|
|
76
|
+
* @default false
|
|
77
|
+
* @public
|
|
78
|
+
* @since 2.6.0
|
|
79
|
+
*/
|
|
80
|
+
this.arrowButtonPressed = false;
|
|
81
|
+
/**
|
|
82
|
+
* Defines the additional accessibility attributes that will be applied to the component.
|
|
83
|
+
*
|
|
84
|
+
* This property allows for fine-tuned control of ARIA attributes for screen reader support.
|
|
85
|
+
* It accepts an object with the following optional fields:
|
|
86
|
+
*
|
|
87
|
+
* - **root**: Accessibility attributes that will be applied to the root element.
|
|
88
|
+
* - **hasPopup**: Indicates the availability and type of interactive popup element (such as a menu or dialog).
|
|
89
|
+
* Accepts string values: `"dialog"`, `"grid"`, `"listbox"`, `"menu"`, or `"tree"`.
|
|
90
|
+
* - **roleDescription**: Defines a human-readable description for the button's role.
|
|
91
|
+
* Accepts any string value.
|
|
92
|
+
* - **title**: Specifies a tooltip or description for screen readers.
|
|
93
|
+
* Accepts any string value.
|
|
94
|
+
* - **ariaKeyShortcuts**: Defines keyboard shortcuts that activate or focus the button.
|
|
95
|
+
*
|
|
96
|
+
* - **arrowButton**: Accessibility attributes that will be applied to the arrow (split) button element.
|
|
97
|
+
* - **hasPopup**: Indicates the type of popup triggered by the arrow button.
|
|
98
|
+
* Accepts string values: `"dialog"`, `"grid"`, `"listbox"`, `"menu"`, or `"tree"`.
|
|
99
|
+
* - **expanded**: Indicates whether the popup controlled by the arrow button is currently expanded.
|
|
100
|
+
* Accepts boolean values: `true` or `false`.
|
|
101
|
+
*
|
|
102
|
+
* @public
|
|
103
|
+
* @since 2.6.0
|
|
104
|
+
* @default {}
|
|
105
|
+
*/
|
|
106
|
+
this.accessibilityAttributes = {};
|
|
107
|
+
/**
|
|
108
|
+
* Determines if the button is in icon-only mode.
|
|
109
|
+
* This property is animation related only.
|
|
110
|
+
* @default false
|
|
111
|
+
* @private
|
|
112
|
+
*/
|
|
113
|
+
this.iconOnly = false;
|
|
114
|
+
}
|
|
115
|
+
get _hideArrowButton() {
|
|
116
|
+
return !this._effectiveStateObject?.showArrowButton;
|
|
117
|
+
}
|
|
118
|
+
get _effectiveState() {
|
|
119
|
+
return this.state || (this.states.length && this.states[0].name) || "";
|
|
120
|
+
}
|
|
121
|
+
get _effectiveStateObject() {
|
|
122
|
+
return this.states.find(state => state.name === this._effectiveState);
|
|
123
|
+
}
|
|
124
|
+
get _stateIconOnly() {
|
|
125
|
+
return !this._stateText && !!this._stateIcon;
|
|
126
|
+
}
|
|
127
|
+
get _stateText() {
|
|
128
|
+
return this._currentStateObject?.text;
|
|
129
|
+
}
|
|
130
|
+
get _stateIcon() {
|
|
131
|
+
return this._currentStateObject?.icon;
|
|
132
|
+
}
|
|
133
|
+
get _stateEndIcon() {
|
|
134
|
+
const endIcon = this._effectiveStateObject?.showArrowButton ? "" : this._effectiveStateObject?.endIcon;
|
|
135
|
+
return endIcon;
|
|
136
|
+
}
|
|
137
|
+
get _hasText() {
|
|
138
|
+
return !!this._stateText;
|
|
139
|
+
}
|
|
140
|
+
onBeforeRendering() {
|
|
141
|
+
const splitButton = this._splitButton;
|
|
142
|
+
if (splitButton) {
|
|
143
|
+
splitButton.activeArrowButton = this.arrowButtonPressed;
|
|
144
|
+
}
|
|
145
|
+
if (!this._currentStateObject?.name) {
|
|
146
|
+
this._currentStateObject = this._effectiveStateObject;
|
|
147
|
+
}
|
|
148
|
+
const currentStateName = this._currentStateObject?.name || "";
|
|
149
|
+
this.iconOnly = this._stateIconOnly;
|
|
150
|
+
if (currentStateName !== "" && currentStateName !== this._effectiveState) {
|
|
151
|
+
this._fadeOut();
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Starts the fade-out animation.
|
|
156
|
+
* @private
|
|
157
|
+
*/
|
|
158
|
+
async _fadeOut() {
|
|
159
|
+
const fadeOutDuration = 180;
|
|
160
|
+
const button = this._splitButton;
|
|
161
|
+
const hiddenButton = this._hiddenSplitButton;
|
|
162
|
+
const newStateObject = this._effectiveStateObject;
|
|
163
|
+
if (!newStateObject) {
|
|
164
|
+
// eslint-disable-next-line no-console
|
|
165
|
+
console.warn(`State with name="${this.state}" doesn't exist!`);
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
if (!button || !hiddenButton) {
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
const buttonWidth = button.offsetWidth;
|
|
172
|
+
const currentState = this._currentStateObject || {};
|
|
173
|
+
if ((!currentState.showArrowButton && newStateObject.showArrowButton) || (!currentState.endIcon && !!newStateObject.endIcon)) {
|
|
174
|
+
this.classList.add("ui5-ai-button-button-to-menu");
|
|
175
|
+
}
|
|
176
|
+
if ((currentState.showArrowButton && !newStateObject.showArrowButton) || (!!currentState.endIcon && !newStateObject.endIcon)) {
|
|
177
|
+
this.classList.add("ui5-ai-button-menu-to-button");
|
|
178
|
+
}
|
|
179
|
+
this.style.width = `${buttonWidth}px`;
|
|
180
|
+
hiddenButton.icon = newStateObject.icon;
|
|
181
|
+
hiddenButton._endIcon = newStateObject.endIcon;
|
|
182
|
+
hiddenButton.textContent = newStateObject.text || null;
|
|
183
|
+
hiddenButton._hideArrowButton = this._hideArrowButton;
|
|
184
|
+
await renderFinished();
|
|
185
|
+
const hiddenButtonWidth = hiddenButton.offsetWidth;
|
|
186
|
+
this.style.width = `${hiddenButtonWidth}px`;
|
|
187
|
+
this.classList.add("ui5-ai-button-fade-out");
|
|
188
|
+
setTimeout(() => {
|
|
189
|
+
this.classList.add("ui5-ai-button-fade-mid");
|
|
190
|
+
button._hideArrowButton = this._hideArrowButton;
|
|
191
|
+
this._fadeIn();
|
|
192
|
+
}, fadeOutDuration);
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Starts the fade-in animation.
|
|
196
|
+
* @private
|
|
197
|
+
*/
|
|
198
|
+
_fadeIn() {
|
|
199
|
+
const fadeInDuration = 160;
|
|
200
|
+
setTimeout(() => {
|
|
201
|
+
const newStateObject = this._effectiveStateObject;
|
|
202
|
+
this._currentStateObject = newStateObject;
|
|
203
|
+
this.classList.add("ui5-ai-button-fade-in");
|
|
204
|
+
this._resetFade();
|
|
205
|
+
}, fadeInDuration);
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Resets the fade phases when the animation is completed.
|
|
209
|
+
* @private
|
|
210
|
+
*/
|
|
211
|
+
_resetFade() {
|
|
212
|
+
const fadeResetDuration = 160;
|
|
213
|
+
setTimeout(() => {
|
|
214
|
+
this.classList.remove("ui5-ai-button-fade-out");
|
|
215
|
+
this.classList.remove("ui5-ai-button-fade-mid");
|
|
216
|
+
this.classList.remove("ui5-ai-button-fade-in");
|
|
217
|
+
this.classList.remove("ui5-ai-button-button-to-menu");
|
|
218
|
+
this.classList.remove("ui5-ai-button-menu-to-button");
|
|
219
|
+
}, fadeResetDuration);
|
|
220
|
+
// reset the button's width after animations
|
|
221
|
+
const button = this._splitButton;
|
|
222
|
+
if (button) {
|
|
223
|
+
button.style.width = "";
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Handles the click event.
|
|
228
|
+
* @private
|
|
229
|
+
*/
|
|
230
|
+
_onClick(e) {
|
|
231
|
+
e.stopImmediatePropagation();
|
|
232
|
+
this.fireDecoratorEvent("click");
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Handles the arrow-button-click event when `ui5-ai-button` is in split mode.
|
|
236
|
+
* @private
|
|
237
|
+
*/
|
|
238
|
+
_onArrowClick(e) {
|
|
239
|
+
e.stopImmediatePropagation();
|
|
240
|
+
this.fireDecoratorEvent("arrow-button-click");
|
|
241
|
+
}
|
|
242
|
+
get _computedAccessibilityAttributes() {
|
|
243
|
+
const labelRefTexts = getAllAccessibleNameRefTexts(this) || getEffectiveAriaLabelText(this) || getAssociatedLabelForTexts(this) || "";
|
|
244
|
+
const mainTitle = this._hasText ? Button_1.i18nBundleAi.getText(BUTTON_TOOLTIP_TEXT, this._stateText) : "";
|
|
245
|
+
const title = `${mainTitle} ${labelRefTexts}`.trim();
|
|
246
|
+
return {
|
|
247
|
+
root: {
|
|
248
|
+
hasPopup: this.accessibilityAttributes?.root?.hasPopup || "false",
|
|
249
|
+
roleDescription: this.accessibilityAttributes?.root?.roleDescription,
|
|
250
|
+
title: this.accessibilityAttributes?.root?.title || title,
|
|
251
|
+
ariaKeyShortcuts: this.accessibilityAttributes?.root?.ariaKeyShortcuts,
|
|
252
|
+
},
|
|
253
|
+
arrowButton: {
|
|
254
|
+
hasPopup: this.accessibilityAttributes?.arrowButton?.hasPopup,
|
|
255
|
+
expanded: this.accessibilityAttributes?.arrowButton?.expanded,
|
|
256
|
+
title: this.accessibilityAttributes?.arrowButton?.title,
|
|
257
|
+
},
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
};
|
|
261
|
+
__decorate([
|
|
262
|
+
property()
|
|
263
|
+
], Button.prototype, "design", void 0);
|
|
264
|
+
__decorate([
|
|
265
|
+
property({ type: Boolean })
|
|
266
|
+
], Button.prototype, "disabled", void 0);
|
|
267
|
+
__decorate([
|
|
268
|
+
property()
|
|
269
|
+
], Button.prototype, "state", void 0);
|
|
270
|
+
__decorate([
|
|
271
|
+
property({ type: Boolean, noAttribute: true })
|
|
272
|
+
], Button.prototype, "arrowButtonPressed", void 0);
|
|
273
|
+
__decorate([
|
|
274
|
+
property({ type: Object })
|
|
275
|
+
], Button.prototype, "accessibilityAttributes", void 0);
|
|
276
|
+
__decorate([
|
|
277
|
+
property({ type: Object })
|
|
278
|
+
], Button.prototype, "_currentStateObject", void 0);
|
|
279
|
+
__decorate([
|
|
280
|
+
property({ type: Boolean })
|
|
281
|
+
], Button.prototype, "iconOnly", void 0);
|
|
282
|
+
__decorate([
|
|
283
|
+
slot({ type: HTMLElement, "default": true })
|
|
284
|
+
], Button.prototype, "states", void 0);
|
|
285
|
+
__decorate([
|
|
286
|
+
query("[ui5-split-button]")
|
|
287
|
+
], Button.prototype, "_splitButton", void 0);
|
|
288
|
+
__decorate([
|
|
289
|
+
query(".ui5-ai-button-hidden[ui5-split-button]")
|
|
290
|
+
], Button.prototype, "_hiddenSplitButton", void 0);
|
|
291
|
+
__decorate([
|
|
292
|
+
i18n("@ui5/webcomponents-ai")
|
|
293
|
+
], Button, "i18nBundleAi", void 0);
|
|
294
|
+
Button = Button_1 = __decorate([
|
|
295
|
+
customElement({
|
|
296
|
+
tag: "ui5-ai-button",
|
|
297
|
+
languageAware: true,
|
|
298
|
+
renderer: jsxRenderer,
|
|
299
|
+
template: ButtonTemplate,
|
|
300
|
+
styles: ButtonCss,
|
|
301
|
+
shadowRootOptions: { delegatesFocus: true },
|
|
302
|
+
})
|
|
303
|
+
/**
|
|
304
|
+
* Fired when the component is activated either with a
|
|
305
|
+
* mouse/tap or by using the Enter or Space key.
|
|
306
|
+
* @public
|
|
307
|
+
*/
|
|
308
|
+
,
|
|
309
|
+
event("click", {
|
|
310
|
+
bubbles: true,
|
|
311
|
+
})
|
|
312
|
+
/**
|
|
313
|
+
* Fired when the component is in split mode and after the arrow button
|
|
314
|
+
* is activated either by clicking or tapping it or by using the [Arrow Up] / [Arrow Down],
|
|
315
|
+
* [Alt] + [Arrow Up]/ [Arrow Down], or [F4] keyboard keys.
|
|
316
|
+
* @public
|
|
317
|
+
*/
|
|
318
|
+
,
|
|
319
|
+
event("arrow-button-click", {
|
|
320
|
+
bubbles: true,
|
|
321
|
+
})
|
|
322
|
+
], Button);
|
|
323
|
+
Button.define();
|
|
324
|
+
export default Button;
|
|
325
|
+
//# sourceMappingURL=Button.js.map
|
|
@@ -0,0 +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,EAAE,IAAI,EAAE,MAAM,4CAA4C,CAAC;AAClE,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;AAIvE,SAAS;AACT,OAAO,SAAS,MAAM,kCAAkC,CAAC;AAMzD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AA8BH,IAAM,MAAM,cAAZ,MAAM,MAAO,SAAQ,UAAU;IAA/B;;QAKC;;;;WAIG;QAEH,WAAM,GAAuB,SAAS,CAAA;QAEtC;;;;;;WAMG;QAEH,aAAQ,G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wCACV;AASlB;IADC,IAAI,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;sCACjB;AAG5B;IADC,KAAK,CAAC,oBAAoB,CAAC;4CACD;AAG3B;IADC,KAAK,CAAC,yCAAyC,CAAC;kDAChB;AAG1B;IADN,IAAI,CAAC,uBAAuB,CAAC;kCACE;AAvG3B,MAAM;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 { 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 **@ui5/webcomponents-ai** package (including Button and ButtonState) is under active development and considered experimental. Component APIs are subject to change.\n * Furthermore, the package supports **Horizon** themes only.\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"]}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import UI5Element from "@ui5/webcomponents-base/dist/UI5Element.js";
|
|
2
|
+
/**
|
|
3
|
+
* @class
|
|
4
|
+
*
|
|
5
|
+
* ### Overview
|
|
6
|
+
*
|
|
7
|
+
* `ui5-ai-button-state` is the item to use for defining states of `ui5-ai-button` components.
|
|
8
|
+
*
|
|
9
|
+
* ### Usage
|
|
10
|
+
*
|
|
11
|
+
* `ui5-ai-button-state` is an abstract element, representing a state of `ui5-ai-button`. It is meant to be used in the `default` slot
|
|
12
|
+
* of `ui5-ai-button` and should not be used as standalone component.
|
|
13
|
+
*
|
|
14
|
+
* ### ES6 Module Import
|
|
15
|
+
*
|
|
16
|
+
* `import "@ui5/webcomponents/dist/AiButtonState.js";`
|
|
17
|
+
* @constructor
|
|
18
|
+
* @extends UI5Element
|
|
19
|
+
* @abstract
|
|
20
|
+
* @since 2.0.0
|
|
21
|
+
* @public
|
|
22
|
+
* @experimental The **@ui5/webcomponents-ai** package (including ButtonState) is under active development and considered experimental. Component APIs are subject to change.
|
|
23
|
+
* Furthermore, the package supports **Horizon** themes only.
|
|
24
|
+
*/
|
|
25
|
+
declare class ButtonState extends UI5Element {
|
|
26
|
+
/**
|
|
27
|
+
* Defines the name of the button state.
|
|
28
|
+
* @default undefined
|
|
29
|
+
* @public
|
|
30
|
+
*/
|
|
31
|
+
name?: string;
|
|
32
|
+
/**
|
|
33
|
+
* Defines the text of the button in this state.
|
|
34
|
+
* @default undefined
|
|
35
|
+
* @public
|
|
36
|
+
*/
|
|
37
|
+
text?: string;
|
|
38
|
+
/**
|
|
39
|
+
* Defines the icon to be displayed as graphical element within the component before the text.
|
|
40
|
+
* The SAP-icons font provides numerous options.
|
|
41
|
+
*
|
|
42
|
+
* **Example:**
|
|
43
|
+
*
|
|
44
|
+
* See all the available icons in the [Icon Explorer](https://sdk.openui5.org/test-resources/sap/m/demokit/iconExplorer/webapp/index.html).
|
|
45
|
+
* @default undefined
|
|
46
|
+
* @public
|
|
47
|
+
*/
|
|
48
|
+
icon?: string;
|
|
49
|
+
/**
|
|
50
|
+
* Defines the icon to be displayed as graphical element within the component after the text.
|
|
51
|
+
* The SAP-icons font provides numerous options.
|
|
52
|
+
*
|
|
53
|
+
* **Example:**
|
|
54
|
+
*
|
|
55
|
+
* See all the available icons in the [Icon Explorer](https://sdk.openui5.org/test-resources/sap/m/demokit/iconExplorer/webapp/index.html).
|
|
56
|
+
* @default undefined
|
|
57
|
+
* @public
|
|
58
|
+
*/
|
|
59
|
+
endIcon?: string;
|
|
60
|
+
/**
|
|
61
|
+
* Defines if the component is in split button mode.
|
|
62
|
+
* @default false
|
|
63
|
+
* @since 2.6.0
|
|
64
|
+
* @public
|
|
65
|
+
*/
|
|
66
|
+
showArrowButton: boolean;
|
|
67
|
+
}
|
|
68
|
+
export default ButtonState;
|
|
@@ -0,0 +1,65 @@
|
|
|
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 UI5Element from "@ui5/webcomponents-base/dist/UI5Element.js";
|
|
8
|
+
import customElement from "@ui5/webcomponents-base/dist/decorators/customElement.js";
|
|
9
|
+
import property from "@ui5/webcomponents-base/dist/decorators/property.js";
|
|
10
|
+
/**
|
|
11
|
+
* @class
|
|
12
|
+
*
|
|
13
|
+
* ### Overview
|
|
14
|
+
*
|
|
15
|
+
* `ui5-ai-button-state` is the item to use for defining states of `ui5-ai-button` components.
|
|
16
|
+
*
|
|
17
|
+
* ### Usage
|
|
18
|
+
*
|
|
19
|
+
* `ui5-ai-button-state` is an abstract element, representing a state of `ui5-ai-button`. It is meant to be used in the `default` slot
|
|
20
|
+
* of `ui5-ai-button` and should not be used as standalone component.
|
|
21
|
+
*
|
|
22
|
+
* ### ES6 Module Import
|
|
23
|
+
*
|
|
24
|
+
* `import "@ui5/webcomponents/dist/AiButtonState.js";`
|
|
25
|
+
* @constructor
|
|
26
|
+
* @extends UI5Element
|
|
27
|
+
* @abstract
|
|
28
|
+
* @since 2.0.0
|
|
29
|
+
* @public
|
|
30
|
+
* @experimental The **@ui5/webcomponents-ai** package (including ButtonState) is under active development and considered experimental. Component APIs are subject to change.
|
|
31
|
+
* Furthermore, the package supports **Horizon** themes only.
|
|
32
|
+
*/
|
|
33
|
+
let ButtonState = class ButtonState extends UI5Element {
|
|
34
|
+
constructor() {
|
|
35
|
+
super(...arguments);
|
|
36
|
+
/**
|
|
37
|
+
* Defines if the component is in split button mode.
|
|
38
|
+
* @default false
|
|
39
|
+
* @since 2.6.0
|
|
40
|
+
* @public
|
|
41
|
+
*/
|
|
42
|
+
this.showArrowButton = false;
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
__decorate([
|
|
46
|
+
property()
|
|
47
|
+
], ButtonState.prototype, "name", void 0);
|
|
48
|
+
__decorate([
|
|
49
|
+
property()
|
|
50
|
+
], ButtonState.prototype, "text", void 0);
|
|
51
|
+
__decorate([
|
|
52
|
+
property()
|
|
53
|
+
], ButtonState.prototype, "icon", void 0);
|
|
54
|
+
__decorate([
|
|
55
|
+
property()
|
|
56
|
+
], ButtonState.prototype, "endIcon", void 0);
|
|
57
|
+
__decorate([
|
|
58
|
+
property({ type: Boolean })
|
|
59
|
+
], ButtonState.prototype, "showArrowButton", void 0);
|
|
60
|
+
ButtonState = __decorate([
|
|
61
|
+
customElement("ui5-ai-button-state")
|
|
62
|
+
], ButtonState);
|
|
63
|
+
ButtonState.define();
|
|
64
|
+
export default ButtonState;
|
|
65
|
+
//# sourceMappingURL=ButtonState.js.map
|