@ui5/webcomponents-ai 0.0.0-a3b95fa49 → 0.0.0-a8a75c830

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.
Files changed (243) hide show
  1. package/.ui5-cem-aliases.json +4 -0
  2. package/CHANGELOG.md +569 -0
  3. package/LICENSE.txt +201 -0
  4. package/README.md +11 -10
  5. package/dist/.tsbuildinfo +1 -1
  6. package/dist/Assets-fetch.d.ts +3 -0
  7. package/dist/Assets-fetch.js +6 -0
  8. package/dist/Assets-fetch.js.map +1 -0
  9. package/dist/Assets-node.d.ts +14 -0
  10. package/dist/Assets-node.js +17 -0
  11. package/dist/Assets-node.js.map +1 -0
  12. package/dist/Button.d.ts +41 -2
  13. package/dist/Button.js +59 -4
  14. package/dist/Button.js.map +1 -1
  15. package/dist/ButtonState.d.ts +2 -1
  16. package/dist/ButtonState.js +2 -1
  17. package/dist/ButtonState.js.map +1 -1
  18. package/dist/ButtonTemplate.js +1 -1
  19. package/dist/ButtonTemplate.js.map +1 -1
  20. package/dist/Input.d.ts +146 -0
  21. package/dist/Input.js +291 -0
  22. package/dist/Input.js.map +1 -0
  23. package/dist/InputTemplate.d.ts +10 -0
  24. package/dist/InputTemplate.js +28 -0
  25. package/dist/InputTemplate.js.map +1 -0
  26. package/dist/PromptInput.d.ts +4 -2
  27. package/dist/PromptInput.js +2 -1
  28. package/dist/PromptInput.js.map +1 -1
  29. package/dist/TextArea.d.ts +125 -0
  30. package/dist/TextArea.js +272 -0
  31. package/dist/TextArea.js.map +1 -0
  32. package/dist/TextAreaTemplate.d.ts +2 -0
  33. package/dist/TextAreaTemplate.js +13 -0
  34. package/dist/TextAreaTemplate.js.map +1 -0
  35. package/dist/ToolbarLabel.d.ts +39 -0
  36. package/dist/ToolbarLabel.js +67 -0
  37. package/dist/ToolbarLabel.js.map +1 -0
  38. package/dist/ToolbarLabelTemplate.d.ts +2 -0
  39. package/dist/ToolbarLabelTemplate.js +5 -0
  40. package/dist/ToolbarLabelTemplate.js.map +1 -0
  41. package/dist/Versioning.d.ts +95 -0
  42. package/dist/Versioning.js +187 -0
  43. package/dist/Versioning.js.map +1 -0
  44. package/dist/VersioningTemplate.d.ts +4 -0
  45. package/dist/VersioningTemplate.js +9 -0
  46. package/dist/VersioningTemplate.js.map +1 -0
  47. package/dist/WritingAssistant.d.ts +101 -0
  48. package/dist/WritingAssistant.js +201 -0
  49. package/dist/WritingAssistant.js.map +1 -0
  50. package/dist/WritingAssistantTemplate.d.ts +2 -0
  51. package/dist/WritingAssistantTemplate.js +12 -0
  52. package/dist/WritingAssistantTemplate.js.map +1 -0
  53. package/dist/bundle.esm.js +2 -0
  54. package/dist/bundle.esm.js.map +1 -1
  55. package/dist/css/themes/Button.css +1 -1
  56. package/dist/css/themes/Input.css +1 -0
  57. package/dist/css/themes/PromptInput.css +1 -1
  58. package/dist/css/themes/TextArea.css +1 -0
  59. package/dist/css/themes/Versioning.css +1 -0
  60. package/dist/css/themes/WritingAssistant.css +1 -0
  61. package/dist/css/themes/sap_horizon/parameters-bundle.css +1 -0
  62. package/dist/css/themes/sap_horizon_dark/parameters-bundle.css +1 -0
  63. package/dist/css/themes/sap_horizon_hcb/parameters-bundle.css +1 -0
  64. package/dist/css/themes/sap_horizon_hcw/parameters-bundle.css +1 -0
  65. package/dist/custom-elements-internal.json +710 -3
  66. package/dist/custom-elements.json +607 -0
  67. package/dist/generated/assets/i18n/messagebundle_ar.json +1 -1
  68. package/dist/generated/assets/i18n/messagebundle_bg.json +1 -1
  69. package/dist/generated/assets/i18n/messagebundle_ca.json +1 -1
  70. package/dist/generated/assets/i18n/messagebundle_cnr.json +1 -1
  71. package/dist/generated/assets/i18n/messagebundle_cs.json +1 -1
  72. package/dist/generated/assets/i18n/messagebundle_cy.json +1 -1
  73. package/dist/generated/assets/i18n/messagebundle_da.json +1 -1
  74. package/dist/generated/assets/i18n/messagebundle_de.json +1 -1
  75. package/dist/generated/assets/i18n/messagebundle_el.json +1 -1
  76. package/dist/generated/assets/i18n/messagebundle_en.json +1 -1
  77. package/dist/generated/assets/i18n/messagebundle_en_GB.json +1 -1
  78. package/dist/generated/assets/i18n/messagebundle_en_US_sappsd.json +1 -1
  79. package/dist/generated/assets/i18n/messagebundle_en_US_saprigi.json +1 -1
  80. package/dist/generated/assets/i18n/messagebundle_en_US_saptrc.json +1 -1
  81. package/dist/generated/assets/i18n/messagebundle_es.json +1 -1
  82. package/dist/generated/assets/i18n/messagebundle_es_MX.json +1 -1
  83. package/dist/generated/assets/i18n/messagebundle_et.json +1 -1
  84. package/dist/generated/assets/i18n/messagebundle_fi.json +1 -1
  85. package/dist/generated/assets/i18n/messagebundle_fr.json +1 -1
  86. package/dist/generated/assets/i18n/messagebundle_fr_CA.json +1 -1
  87. package/dist/generated/assets/i18n/messagebundle_hi.json +1 -1
  88. package/dist/generated/assets/i18n/messagebundle_hr.json +1 -1
  89. package/dist/generated/assets/i18n/messagebundle_hu.json +1 -1
  90. package/dist/generated/assets/i18n/messagebundle_id.json +1 -0
  91. package/dist/generated/assets/i18n/messagebundle_it.json +1 -1
  92. package/dist/generated/assets/i18n/messagebundle_iw.json +1 -1
  93. package/dist/generated/assets/i18n/messagebundle_ja.json +1 -1
  94. package/dist/generated/assets/i18n/messagebundle_kk.json +1 -1
  95. package/dist/generated/assets/i18n/messagebundle_ko.json +1 -1
  96. package/dist/generated/assets/i18n/messagebundle_lt.json +1 -1
  97. package/dist/generated/assets/i18n/messagebundle_lv.json +1 -1
  98. package/dist/generated/assets/i18n/messagebundle_mk.json +1 -1
  99. package/dist/generated/assets/i18n/messagebundle_ms.json +1 -1
  100. package/dist/generated/assets/i18n/messagebundle_nl.json +1 -1
  101. package/dist/generated/assets/i18n/messagebundle_no.json +1 -1
  102. package/dist/generated/assets/i18n/messagebundle_pl.json +1 -1
  103. package/dist/generated/assets/i18n/messagebundle_pt.json +1 -1
  104. package/dist/generated/assets/i18n/messagebundle_pt_PT.json +1 -1
  105. package/dist/generated/assets/i18n/messagebundle_ro.json +1 -1
  106. package/dist/generated/assets/i18n/messagebundle_ru.json +1 -1
  107. package/dist/generated/assets/i18n/messagebundle_sh.json +1 -1
  108. package/dist/generated/assets/i18n/messagebundle_sk.json +1 -1
  109. package/dist/generated/assets/i18n/messagebundle_sl.json +1 -1
  110. package/dist/generated/assets/i18n/messagebundle_sr.json +1 -1
  111. package/dist/generated/assets/i18n/messagebundle_sv.json +1 -1
  112. package/dist/generated/assets/i18n/messagebundle_th.json +1 -1
  113. package/dist/generated/assets/i18n/messagebundle_tr.json +1 -1
  114. package/dist/generated/assets/i18n/messagebundle_uk.json +1 -1
  115. package/dist/generated/assets/i18n/messagebundle_vi.json +1 -1
  116. package/dist/generated/assets/i18n/messagebundle_zh_CN.json +1 -1
  117. package/dist/generated/assets/i18n/messagebundle_zh_TW.json +1 -1
  118. package/dist/generated/assets/themes/sap_horizon/parameters-bundle.css.json +1 -1
  119. package/dist/generated/assets/themes/sap_horizon_dark/parameters-bundle.css.json +1 -1
  120. package/dist/generated/assets/themes/sap_horizon_hcb/parameters-bundle.css.json +1 -1
  121. package/dist/generated/assets/themes/sap_horizon_hcw/parameters-bundle.css.json +1 -1
  122. package/dist/generated/i18n/i18n-defaults.d.ts +15 -1
  123. package/dist/generated/i18n/i18n-defaults.js +15 -1
  124. package/dist/generated/i18n/i18n-defaults.js.map +1 -1
  125. package/dist/generated/json-imports/Themes-fetch.js +1 -1
  126. package/dist/generated/json-imports/Themes-fetch.js.map +1 -1
  127. package/dist/generated/json-imports/Themes-node.d.ts +1 -0
  128. package/dist/generated/json-imports/Themes-node.js +21 -0
  129. package/dist/generated/json-imports/Themes-node.js.map +1 -0
  130. package/dist/generated/json-imports/Themes.js +1 -1
  131. package/dist/generated/json-imports/Themes.js.map +1 -1
  132. package/dist/generated/json-imports/i18n-fetch.js +3 -1
  133. package/dist/generated/json-imports/i18n-fetch.js.map +1 -1
  134. package/dist/generated/json-imports/i18n-node.d.ts +1 -0
  135. package/dist/generated/json-imports/i18n-node.js +120 -0
  136. package/dist/generated/json-imports/i18n-node.js.map +1 -0
  137. package/dist/generated/json-imports/i18n.js +3 -1
  138. package/dist/generated/json-imports/i18n.js.map +1 -1
  139. package/dist/generated/themes/Button.css.d.ts +1 -1
  140. package/dist/generated/themes/Button.css.js +3 -3
  141. package/dist/generated/themes/Button.css.js.map +1 -1
  142. package/dist/generated/themes/Input.css.d.ts +2 -0
  143. package/dist/generated/themes/Input.css.js +8 -0
  144. package/dist/generated/themes/Input.css.js.map +1 -0
  145. package/dist/generated/themes/PromptInput.css.d.ts +1 -1
  146. package/dist/generated/themes/PromptInput.css.js +3 -3
  147. package/dist/generated/themes/PromptInput.css.js.map +1 -1
  148. package/dist/generated/themes/TextArea.css.d.ts +2 -0
  149. package/dist/generated/themes/TextArea.css.js +8 -0
  150. package/dist/generated/themes/TextArea.css.js.map +1 -0
  151. package/dist/generated/themes/Versioning.css.d.ts +2 -0
  152. package/dist/generated/themes/Versioning.css.js +8 -0
  153. package/dist/generated/themes/Versioning.css.js.map +1 -0
  154. package/dist/generated/themes/WritingAssistant.css.d.ts +2 -0
  155. package/dist/generated/themes/WritingAssistant.css.js +8 -0
  156. package/dist/generated/themes/WritingAssistant.css.js.map +1 -0
  157. package/dist/generated/themes/sap_horizon/parameters-bundle.css.d.ts +1 -1
  158. package/dist/generated/themes/sap_horizon/parameters-bundle.css.js +1 -1
  159. package/dist/generated/themes/sap_horizon/parameters-bundle.css.js.map +1 -1
  160. package/dist/generated/themes/sap_horizon_dark/parameters-bundle.css.d.ts +1 -1
  161. package/dist/generated/themes/sap_horizon_dark/parameters-bundle.css.js +1 -1
  162. package/dist/generated/themes/sap_horizon_dark/parameters-bundle.css.js.map +1 -1
  163. package/dist/generated/themes/sap_horizon_hcb/parameters-bundle.css.d.ts +1 -1
  164. package/dist/generated/themes/sap_horizon_hcb/parameters-bundle.css.js +1 -1
  165. package/dist/generated/themes/sap_horizon_hcb/parameters-bundle.css.js.map +1 -1
  166. package/dist/generated/themes/sap_horizon_hcw/parameters-bundle.css.d.ts +1 -1
  167. package/dist/generated/themes/sap_horizon_hcw/parameters-bundle.css.js +1 -1
  168. package/dist/generated/themes/sap_horizon_hcw/parameters-bundle.css.js.map +1 -1
  169. package/dist/vscode.html-custom-data.json +105 -0
  170. package/dist/web-types.json +309 -1
  171. package/package-scripts.cjs +4 -0
  172. package/package.json +22 -21
  173. package/src/ButtonTemplate.tsx +1 -0
  174. package/src/InputTemplate.tsx +197 -0
  175. package/src/TextArea.css +25 -0
  176. package/src/TextAreaTemplate.tsx +91 -0
  177. package/src/ToolbarLabelTemplate.tsx +9 -0
  178. package/src/VersioningTemplate.tsx +34 -0
  179. package/src/WritingAssistantTemplate.tsx +51 -0
  180. package/src/i18n/messagebundle.properties +43 -1
  181. package/src/i18n/messagebundle_ar.properties +28 -0
  182. package/src/i18n/messagebundle_bg.properties +28 -0
  183. package/src/i18n/messagebundle_ca.properties +28 -0
  184. package/src/i18n/messagebundle_cnr.properties +28 -0
  185. package/src/i18n/messagebundle_cs.properties +28 -0
  186. package/src/i18n/messagebundle_cy.properties +28 -0
  187. package/src/i18n/messagebundle_da.properties +28 -0
  188. package/src/i18n/messagebundle_de.properties +28 -0
  189. package/src/i18n/messagebundle_el.properties +28 -0
  190. package/src/i18n/messagebundle_en.properties +28 -0
  191. package/src/i18n/messagebundle_en_GB.properties +28 -0
  192. package/src/i18n/messagebundle_en_US_sappsd.properties +28 -0
  193. package/src/i18n/messagebundle_en_US_saprigi.properties +28 -0
  194. package/src/i18n/messagebundle_en_US_saptrc.properties +28 -0
  195. package/src/i18n/messagebundle_es.properties +28 -0
  196. package/src/i18n/messagebundle_es_MX.properties +29 -1
  197. package/src/i18n/messagebundle_et.properties +28 -0
  198. package/src/i18n/messagebundle_fi.properties +28 -0
  199. package/src/i18n/messagebundle_fr.properties +28 -0
  200. package/src/i18n/messagebundle_fr_CA.properties +28 -0
  201. package/src/i18n/messagebundle_hi.properties +28 -0
  202. package/src/i18n/messagebundle_hr.properties +30 -2
  203. package/src/i18n/messagebundle_hu.properties +28 -0
  204. package/src/i18n/messagebundle_id.properties +28 -0
  205. package/src/i18n/messagebundle_it.properties +28 -0
  206. package/src/i18n/messagebundle_iw.properties +28 -0
  207. package/src/i18n/messagebundle_ja.properties +28 -0
  208. package/src/i18n/messagebundle_kk.properties +28 -0
  209. package/src/i18n/messagebundle_ko.properties +28 -0
  210. package/src/i18n/messagebundle_lt.properties +28 -0
  211. package/src/i18n/messagebundle_lv.properties +28 -0
  212. package/src/i18n/messagebundle_mk.properties +28 -0
  213. package/src/i18n/messagebundle_ms.properties +28 -0
  214. package/src/i18n/messagebundle_nl.properties +28 -0
  215. package/src/i18n/messagebundle_no.properties +28 -0
  216. package/src/i18n/messagebundle_pl.properties +28 -0
  217. package/src/i18n/messagebundle_pt.properties +28 -0
  218. package/src/i18n/messagebundle_pt_PT.properties +28 -0
  219. package/src/i18n/messagebundle_ro.properties +28 -0
  220. package/src/i18n/messagebundle_ru.properties +28 -0
  221. package/src/i18n/messagebundle_sh.properties +28 -0
  222. package/src/i18n/messagebundle_sk.properties +28 -0
  223. package/src/i18n/messagebundle_sl.properties +28 -0
  224. package/src/i18n/messagebundle_sr.properties +28 -0
  225. package/src/i18n/messagebundle_sv.properties +28 -0
  226. package/src/i18n/messagebundle_th.properties +30 -2
  227. package/src/i18n/messagebundle_tr.properties +28 -0
  228. package/src/i18n/messagebundle_uk.properties +28 -0
  229. package/src/i18n/messagebundle_vi.properties +28 -0
  230. package/src/i18n/messagebundle_zh_CN.properties +28 -0
  231. package/src/i18n/messagebundle_zh_TW.properties +28 -0
  232. package/src/themes/Input.css +83 -0
  233. package/src/themes/PromptInput.css +5 -1
  234. package/src/themes/TextArea.css +45 -0
  235. package/src/themes/Versioning.css +20 -0
  236. package/src/themes/WritingAssistant.css +23 -0
  237. package/src/themes/base/Button-parameters.css +1 -1
  238. package/tsconfig.json +6 -0
  239. package/cypress/specs/Button.cy.tsx +0 -14
  240. package/cypress/support/commands.ts +0 -40
  241. package/cypress/support/component-index.html +0 -12
  242. package/cypress/support/component.ts +0 -36
  243. package/cypress/tsconfig.json +0 -43
@@ -0,0 +1,3 @@
1
+ import "@ui5/webcomponents/dist/Assets-fetch.js";
2
+ import "./generated/json-imports/Themes-fetch.js";
3
+ import "./generated/json-imports/i18n-fetch.js";
@@ -0,0 +1,6 @@
1
+ // main package assets (transitively base, theming and icons)
2
+ import "@ui5/webcomponents/dist/Assets-fetch.js";
3
+ // own ai package assets
4
+ import "./generated/json-imports/Themes-fetch.js";
5
+ import "./generated/json-imports/i18n-fetch.js";
6
+ //# sourceMappingURL=Assets-fetch.js.map
@@ -0,0 +1 @@
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"]}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * The `Assets-node` entry point is used to import all CLDR, theming, and i18n assets.
3
+ *
4
+ * It serves as an alternative to the `Assets` and `Assets-fetch` modules and supports the
5
+ * `with: { type: 'json' }` import attribute for loading JSON files.
6
+ *
7
+ * This import attribute is required in some environments, such as Node.js with server-side rendering (SSR).
8
+ *
9
+ * Example usage:
10
+ * await import("../assets/i18n/messagebundle_bg.json", { with: { type: 'json' } })
11
+ */
12
+ import "@ui5/webcomponents/dist/Assets-node.js";
13
+ import "./generated/json-imports/Themes-node.js";
14
+ import "./generated/json-imports/i18n-node.js";
@@ -0,0 +1,17 @@
1
+ /**
2
+ * The `Assets-node` entry point is used to import all CLDR, theming, and i18n assets.
3
+ *
4
+ * It serves as an alternative to the `Assets` and `Assets-fetch` modules and supports the
5
+ * `with: { type: 'json' }` import attribute for loading JSON files.
6
+ *
7
+ * This import attribute is required in some environments, such as Node.js with server-side rendering (SSR).
8
+ *
9
+ * Example usage:
10
+ * await import("../assets/i18n/messagebundle_bg.json", { with: { type: 'json' } })
11
+ */
12
+ // main package assets (transitively base, theming and icons)
13
+ import "@ui5/webcomponents/dist/Assets-node.js";
14
+ // own ai package assets
15
+ import "./generated/json-imports/Themes-node.js";
16
+ import "./generated/json-imports/i18n-node.js";
17
+ //# sourceMappingURL=Assets-node.js.map
@@ -0,0 +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,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
@@ -1,8 +1,17 @@
1
1
  import UI5Element from "@ui5/webcomponents-base/dist/UI5Element.js";
2
+ import type { DefaultSlot } from "@ui5/webcomponents-base/dist/UI5Element.js";
2
3
  import type SplitButton from "@ui5/webcomponents/dist/SplitButton.js";
3
4
  import type ButtonDesign from "@ui5/webcomponents/dist/types/ButtonDesign.js";
4
5
  import type ButtonState from "./ButtonState.js";
5
6
  import "./ButtonState.js";
7
+ import type I18nBundle from "@ui5/webcomponents-base/dist/i18nBundle.js";
8
+ import type { AccessibilityAttributes } from "@ui5/webcomponents-base/dist/types.js";
9
+ type AIButtonRootAccessibilityAttributes = Pick<AccessibilityAttributes, "hasPopup" | "roleDescription" | "title" | "ariaKeyShortcuts">;
10
+ type AIButtonArrowButtonAccessibilityAttributes = Pick<AccessibilityAttributes, "hasPopup" | "expanded" | "title">;
11
+ type AIButtonAccessibilityAttributes = {
12
+ root?: AIButtonRootAccessibilityAttributes;
13
+ arrowButton?: AIButtonArrowButtonAccessibilityAttributes;
14
+ };
6
15
  /**
7
16
  * @class
8
17
  *
@@ -32,7 +41,8 @@ import "./ButtonState.js";
32
41
  * @extends UI5Element
33
42
  * @since 2.0.0
34
43
  * @public
35
- * @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.
44
+ * @experimental The **@ui5/webcomponents-ai** package (including Button and ButtonState) is under active development and considered experimental. Component APIs are subject to change.
45
+ * Furthermore, the package supports **Horizon** themes only.
36
46
  */
37
47
  declare class Button extends UI5Element {
38
48
  eventDetails: {
@@ -69,6 +79,32 @@ declare class Button extends UI5Element {
69
79
  * @since 2.6.0
70
80
  */
71
81
  arrowButtonPressed: boolean;
82
+ /**
83
+ * Defines the additional accessibility attributes that will be applied to the component.
84
+ *
85
+ * This property allows for fine-tuned control of ARIA attributes for screen reader support.
86
+ * It accepts an object with the following optional fields:
87
+ *
88
+ * - **root**: Accessibility attributes that will be applied to the root element.
89
+ * - **hasPopup**: Indicates the availability and type of interactive popup element (such as a menu or dialog).
90
+ * Accepts string values: `"dialog"`, `"grid"`, `"listbox"`, `"menu"`, or `"tree"`.
91
+ * - **roleDescription**: Defines a human-readable description for the button's role.
92
+ * Accepts any string value.
93
+ * - **title**: Specifies a tooltip or description for screen readers.
94
+ * Accepts any string value.
95
+ * - **ariaKeyShortcuts**: Defines keyboard shortcuts that activate or focus the button.
96
+ *
97
+ * - **arrowButton**: Accessibility attributes that will be applied to the arrow (split) button element.
98
+ * - **hasPopup**: Indicates the type of popup triggered by the arrow button.
99
+ * Accepts string values: `"dialog"`, `"grid"`, `"listbox"`, `"menu"`, or `"tree"`.
100
+ * - **expanded**: Indicates whether the popup controlled by the arrow button is currently expanded.
101
+ * Accepts boolean values: `true` or `false`.
102
+ *
103
+ * @public
104
+ * @since 2.6.0
105
+ * @default {}
106
+ */
107
+ accessibilityAttributes: AIButtonAccessibilityAttributes;
72
108
  /**
73
109
  * Keeps the current state object of the component.
74
110
  * @private
@@ -87,9 +123,10 @@ declare class Button extends UI5Element {
87
123
  * you only use `ui5-ai-button-state` components in order to preserve the intended design.
88
124
  * @public
89
125
  */
90
- states: Array<ButtonState>;
126
+ states: DefaultSlot<ButtonState>;
91
127
  _splitButton?: SplitButton;
92
128
  _hiddenSplitButton?: SplitButton;
129
+ static i18nBundleAi: I18nBundle;
93
130
  get _hideArrowButton(): boolean;
94
131
  get _effectiveState(): string;
95
132
  get _effectiveStateObject(): ButtonState | undefined;
@@ -124,5 +161,7 @@ declare class Button extends UI5Element {
124
161
  * @private
125
162
  */
126
163
  _onArrowClick(e: CustomEvent): void;
164
+ get _computedAccessibilityAttributes(): AIButtonAccessibilityAttributes;
127
165
  }
128
166
  export default Button;
167
+ export type { AIButtonAccessibilityAttributes, };
package/dist/Button.js CHANGED
@@ -4,16 +4,20 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
4
4
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
5
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6
6
  };
7
+ var Button_1;
7
8
  import UI5Element from "@ui5/webcomponents-base/dist/UI5Element.js";
8
9
  import { renderFinished } from "@ui5/webcomponents-base/dist/Render.js";
9
10
  import customElement from "@ui5/webcomponents-base/dist/decorators/customElement.js";
10
11
  import property from "@ui5/webcomponents-base/dist/decorators/property.js";
12
+ import { i18n } from "@ui5/webcomponents-base/dist/decorators.js";
11
13
  import event from "@ui5/webcomponents-base/dist/decorators/event-strict.js";
12
- import slot from "@ui5/webcomponents-base/dist/decorators/slot.js";
14
+ import slot from "@ui5/webcomponents-base/dist/decorators/slot-strict.js";
13
15
  import query from "@ui5/webcomponents-base/dist/decorators/query.js";
14
16
  import jsxRenderer from "@ui5/webcomponents-base/dist/renderer/JsxRenderer.js";
17
+ import { BUTTON_TOOLTIP_TEXT } from "./generated/i18n/i18n-defaults.js";
15
18
  import "./ButtonState.js";
16
19
  import ButtonTemplate from "./ButtonTemplate.js";
20
+ import { getEffectiveAriaLabelText, getAssociatedLabelForTexts, getAllAccessibleNameRefTexts, } from "@ui5/webcomponents-base/dist/util/AccessibilityTextsHelper.js";
17
21
  // Styles
18
22
  import ButtonCss from "./generated/themes/Button.css.js";
19
23
  /**
@@ -45,9 +49,10 @@ import ButtonCss from "./generated/themes/Button.css.js";
45
49
  * @extends UI5Element
46
50
  * @since 2.0.0
47
51
  * @public
48
- * @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.
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.
49
54
  */
50
- let Button = class Button extends UI5Element {
55
+ let Button = Button_1 = class Button extends UI5Element {
51
56
  constructor() {
52
57
  super(...arguments);
53
58
  /**
@@ -73,6 +78,32 @@ let Button = class Button extends UI5Element {
73
78
  * @since 2.6.0
74
79
  */
75
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 = {};
76
107
  /**
77
108
  * Determines if the button is in icon-only mode.
78
109
  * This property is animation related only.
@@ -208,6 +239,24 @@ let Button = class Button extends UI5Element {
208
239
  e.stopImmediatePropagation();
209
240
  this.fireDecoratorEvent("arrow-button-click");
210
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
+ }
211
260
  };
212
261
  __decorate([
213
262
  property()
@@ -221,6 +270,9 @@ __decorate([
221
270
  __decorate([
222
271
  property({ type: Boolean, noAttribute: true })
223
272
  ], Button.prototype, "arrowButtonPressed", void 0);
273
+ __decorate([
274
+ property({ type: Object })
275
+ ], Button.prototype, "accessibilityAttributes", void 0);
224
276
  __decorate([
225
277
  property({ type: Object })
226
278
  ], Button.prototype, "_currentStateObject", void 0);
@@ -236,7 +288,10 @@ __decorate([
236
288
  __decorate([
237
289
  query(".ui5-ai-button-hidden[ui5-split-button]")
238
290
  ], Button.prototype, "_hiddenSplitButton", void 0);
239
- Button = __decorate([
291
+ __decorate([
292
+ i18n("@ui5/webcomponents-ai")
293
+ ], Button, "i18nBundleAi", void 0);
294
+ Button = Button_1 = __decorate([
240
295
  customElement({
241
296
  tag: "ui5-ai-button",
242
297
  languageAware: true,
@@ -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,kBAAkB,CAAC;AAE1B,OAAO,cAAc,MAAM,qBAAqB,CAAC;AAEjD,SAAS;AACT,OAAO,SAAS,MAAM,kCAAkC,CAAC;AAEzD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AA8BH,IAAM,MAAM,GAAZ,MAAM,MAAO,SAAQ,UAAU;IAA/B;;QAKC;;;;WAIG;QAEH,WAAM,GAAuB,SAAS,CAAA;QAEtC;;;;;;WAMG;QAEH,aAAQ,GAAG,KAAK,CAAC;Q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AC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;mDACO;AASlC;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;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;AAxE5B,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,CAqOX;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 \"./ButtonState.js\";\n\nimport ButtonTemplate from \"./ButtonTemplate.js\";\n\n// Styles\nimport ButtonCss from \"./generated/themes/Button.css.js\";\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 * 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\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\nButton.define();\nexport default Button;\n"]}
1
+ {"version":3,"file":"Button.js","sourceRoot":"","sources":["../src/Button.ts"],"names":[],"mappings":";;;;;;;AAAA,OAAO,UAAU,MAAM,4CAA4C,CAAC;AAEpE,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,wDAAwD,CAAC;AAC1E,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,GAAG,KAAK,CAAC;QAWjB;;;;;;;WAOG;QAEH,uBAAkB,GAAG,KAAK,CAAC;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,IAAI,EAAE,CAAC;sCACX;AAGlC;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 type { DefaultSlot } 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-strict.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!: DefaultSlot<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"]}
@@ -19,7 +19,8 @@ import UI5Element from "@ui5/webcomponents-base/dist/UI5Element.js";
19
19
  * @abstract
20
20
  * @since 2.0.0
21
21
  * @public
22
- * @experimental The Button and ButtonState web components are available since 2.0 under an experimental flag and their API and behaviour are subject to change.
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.
23
24
  */
24
25
  declare class ButtonState extends UI5Element {
25
26
  /**
@@ -27,7 +27,8 @@ import property from "@ui5/webcomponents-base/dist/decorators/property.js";
27
27
  * @abstract
28
28
  * @since 2.0.0
29
29
  * @public
30
- * @experimental The Button and ButtonState web components are available since 2.0 under an experimental flag and their API and behaviour are subject to change.
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.
31
32
  */
32
33
  let ButtonState = class ButtonState extends UI5Element {
33
34
  constructor() {
@@ -1 +1 @@
1
- {"version":3,"file":"ButtonState.js","sourceRoot":"","sources":["../src/ButtonState.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,UAAU,MAAM,4CAA4C,CAAC;AACpE,OAAO,aAAa,MAAM,0DAA0D,CAAC;AACrF,OAAO,QAAQ,MAAM,qDAAqD,CAAC;AAE3E;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,IAAM,WAAW,GAAjB,MAAM,WAAY,SAAQ,UAAU;IAApC;;QA2CC;;;;;WAKG;QAEH,oBAAe,GAAG,KAAK,CAAC;IACzB,CAAC;CAAA,CAAA;AA5CA;IADC,QAAQ,EAAE;yCACG;AAQd;IADC,QAAQ,EAAE;yCACG;AAad;IADC,QAAQ,EAAE;yCACG;AAad;IADC,QAAQ,EAAE;4CACM;AASjB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;oDACJ;AAlDnB,WAAW;IADhB,aAAa,CAAC,qBAAqB,CAAC;GAC/B,WAAW,CAmDhB;AAED,WAAW,CAAC,MAAM,EAAE,CAAC;AACrB,eAAe,WAAW,CAAC","sourcesContent":["import UI5Element from \"@ui5/webcomponents-base/dist/UI5Element.js\";\nimport customElement from \"@ui5/webcomponents-base/dist/decorators/customElement.js\";\nimport property from \"@ui5/webcomponents-base/dist/decorators/property.js\";\n\n/**\n * @class\n *\n * ### Overview\n *\n * `ui5-ai-button-state` is the item to use for defining states of `ui5-ai-button` components.\n *\n * ### Usage\n *\n * `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\n * of `ui5-ai-button` and should not be used as standalone component.\n *\n * ### ES6 Module Import\n *\n * `import \"@ui5/webcomponents/dist/AiButtonState.js\";`\n * @constructor\n * @extends UI5Element\n * @abstract\n * @since 2.0.0\n * @public\n * @experimental The Button and ButtonState web components are available since 2.0 under an experimental flag and their API and behaviour are subject to change.\n */\n@customElement(\"ui5-ai-button-state\")\nclass ButtonState extends UI5Element {\n\t/**\n\t * Defines the name of the button state.\n\t * @default undefined\n\t * @public\n\t */\n\t@property()\n\tname?: string;\n\n\t/**\n\t * Defines the text of the button in this state.\n\t * @default undefined\n\t * @public\n\t */\n\t@property()\n\ttext?: string;\n\n\t/**\n\t * Defines the icon to be displayed as graphical element within the component before the text.\n\t * The SAP-icons font provides numerous options.\n\t *\n\t * **Example:**\n\t *\n\t * See all the available icons in the [Icon Explorer](https://sdk.openui5.org/test-resources/sap/m/demokit/iconExplorer/webapp/index.html).\n\t * @default undefined\n\t * @public\n\t */\n\t@property()\n\ticon?: string;\n\n\t/**\n\t * Defines the icon to be displayed as graphical element within the component after the text.\n\t * The SAP-icons font provides numerous options.\n\t *\n\t * **Example:**\n\t *\n\t * See all the available icons in the [Icon Explorer](https://sdk.openui5.org/test-resources/sap/m/demokit/iconExplorer/webapp/index.html).\n\t * @default undefined\n\t * @public\n\t */\n\t@property()\n\tendIcon?: string;\n\n\t/**\n\t * Defines if the component is in split button mode.\n\t * @default false\n\t * @since 2.6.0\n\t * @public\n\t */\n\t@property({ type: Boolean })\n\tshowArrowButton = false;\n}\n\nButtonState.define();\nexport default ButtonState;\n"]}
1
+ {"version":3,"file":"ButtonState.js","sourceRoot":"","sources":["../src/ButtonState.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,UAAU,MAAM,4CAA4C,CAAC;AACpE,OAAO,aAAa,MAAM,0DAA0D,CAAC;AACrF,OAAO,QAAQ,MAAM,qDAAqD,CAAC;AAE3E;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,IAAM,WAAW,GAAjB,MAAM,WAAY,SAAQ,UAAU;IAApC;;QA2CC;;;;;WAKG;QAEH,oBAAe,GAAG,KAAK,CAAC;IACzB,CAAC;CAAA,CAAA;AA5CA;IADC,QAAQ,EAAE;yCACG;AAQd;IADC,QAAQ,EAAE;yCACG;AAad;IADC,QAAQ,EAAE;yCACG;AAad;IADC,QAAQ,EAAE;4CACM;AASjB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;oDACJ;AAlDnB,WAAW;IADhB,aAAa,CAAC,qBAAqB,CAAC;GAC/B,WAAW,CAmDhB;AAED,WAAW,CAAC,MAAM,EAAE,CAAC;AACrB,eAAe,WAAW,CAAC","sourcesContent":["import UI5Element from \"@ui5/webcomponents-base/dist/UI5Element.js\";\nimport customElement from \"@ui5/webcomponents-base/dist/decorators/customElement.js\";\nimport property from \"@ui5/webcomponents-base/dist/decorators/property.js\";\n\n/**\n * @class\n *\n * ### Overview\n *\n * `ui5-ai-button-state` is the item to use for defining states of `ui5-ai-button` components.\n *\n * ### Usage\n *\n * `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\n * of `ui5-ai-button` and should not be used as standalone component.\n *\n * ### ES6 Module Import\n *\n * `import \"@ui5/webcomponents/dist/AiButtonState.js\";`\n * @constructor\n * @extends UI5Element\n * @abstract\n * @since 2.0.0\n * @public\n * @experimental The **@ui5/webcomponents-ai** package (including ButtonState) is under active development and considered experimental. Component APIs are subject to change.\n * Furthermore, the package supports **Horizon** themes only.\n */\n@customElement(\"ui5-ai-button-state\")\nclass ButtonState extends UI5Element {\n\t/**\n\t * Defines the name of the button state.\n\t * @default undefined\n\t * @public\n\t */\n\t@property()\n\tname?: string;\n\n\t/**\n\t * Defines the text of the button in this state.\n\t * @default undefined\n\t * @public\n\t */\n\t@property()\n\ttext?: string;\n\n\t/**\n\t * Defines the icon to be displayed as graphical element within the component before the text.\n\t * The SAP-icons font provides numerous options.\n\t *\n\t * **Example:**\n\t *\n\t * See all the available icons in the [Icon Explorer](https://sdk.openui5.org/test-resources/sap/m/demokit/iconExplorer/webapp/index.html).\n\t * @default undefined\n\t * @public\n\t */\n\t@property()\n\ticon?: string;\n\n\t/**\n\t * Defines the icon to be displayed as graphical element within the component after the text.\n\t * The SAP-icons font provides numerous options.\n\t *\n\t * **Example:**\n\t *\n\t * See all the available icons in the [Icon Explorer](https://sdk.openui5.org/test-resources/sap/m/demokit/iconExplorer/webapp/index.html).\n\t * @default undefined\n\t * @public\n\t */\n\t@property()\n\tendIcon?: string;\n\n\t/**\n\t * Defines if the component is in split button mode.\n\t * @default false\n\t * @since 2.6.0\n\t * @public\n\t */\n\t@property({ type: Boolean })\n\tshowArrowButton = false;\n}\n\nButtonState.define();\nexport default ButtonState;\n"]}
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "@ui5/webcomponents-base/jsx-runtime";
2
2
  import SplitButton from "@ui5/webcomponents/dist/SplitButton.js";
3
3
  export default function ButtonTemplate() {
4
- return (_jsxs(_Fragment, { children: [_jsx(SplitButton, { class: "ui5-ai-button-inner", design: this.design, icon: this._stateIcon, disabled: this.disabled, _endIcon: this._stateEndIcon, _hideArrowButton: this._hideArrowButton, onClick: this._onClick, onArrowClick: this._onArrowClick, children: this._hasText && (_jsx("div", { class: "ui5-ai-button-text", children: this._stateText })) }), _jsx(SplitButton, { class: "ui5-ai-button-hidden", design: this.design })] }));
4
+ return (_jsxs(_Fragment, { children: [_jsx(SplitButton, { class: "ui5-ai-button-inner", design: this.design, icon: this._stateIcon, disabled: this.disabled, _endIcon: this._stateEndIcon, _hideArrowButton: this._hideArrowButton, onClick: this._onClick, onArrowClick: this._onArrowClick, accessibilityAttributes: this._computedAccessibilityAttributes, children: this._hasText && (_jsx("div", { class: "ui5-ai-button-text", children: this._stateText })) }), _jsx(SplitButton, { class: "ui5-ai-button-hidden", design: this.design })] }));
5
5
  }
6
6
  //# sourceMappingURL=ButtonTemplate.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ButtonTemplate.js","sourceRoot":"","sources":["../src/ButtonTemplate.tsx"],"names":[],"mappings":";AAAA,OAAO,WAAW,MAAM,wCAAwC,CAAC;AAGjE,MAAM,CAAC,OAAO,UAAU,cAAc;IACrC,OAAO,CAAC,8BACP,KAAC,WAAW,IACX,KAAK,EAAC,qBAAqB,EAC3B,MAAM,EAAE,IAAI,CAAC,MAAM,EACnB,IAAI,EAAE,IAAI,CAAC,UAAU,EACrB,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,QAAQ,EAAE,IAAI,CAAC,aAAa,EAC5B,gBAAgB,EAAE,IAAI,CAAC,gBAAgB,EACvC,OAAO,EAAE,IAAI,CAAC,QAAQ,EACtB,YAAY,EAAE,IAAI,CAAC,aAAa,YAE/B,IAAI,CAAC,QAAQ,IAAI,CACjB,cAAK,KAAK,EAAC,oBAAoB,YAAE,IAAI,CAAC,UAAU,GAAO,CACvD,GACY,EAEd,KAAC,WAAW,IACX,KAAK,EAAC,sBAAsB,EAC5B,MAAM,EAAE,IAAI,CAAC,MAAM,GAClB,IACA,CAAC,CAAC;AACN,CAAC","sourcesContent":["import SplitButton from \"@ui5/webcomponents/dist/SplitButton.js\";\nimport type Button from \"./Button.js\";\n\nexport default function ButtonTemplate(this: Button) {\n\treturn (<>\n\t\t<SplitButton\n\t\t\tclass=\"ui5-ai-button-inner\"\n\t\t\tdesign={this.design}\n\t\t\ticon={this._stateIcon}\n\t\t\tdisabled={this.disabled}\n\t\t\t_endIcon={this._stateEndIcon}\n\t\t\t_hideArrowButton={this._hideArrowButton}\n\t\t\tonClick={this._onClick}\n\t\t\tonArrowClick={this._onArrowClick}\n\t\t>\n\t\t\t{this._hasText && (\n\t\t\t\t<div class=\"ui5-ai-button-text\">{this._stateText}</div>\n\t\t\t)}\n\t\t</SplitButton>\n\n\t\t<SplitButton\n\t\t\tclass=\"ui5-ai-button-hidden\"\n\t\t\tdesign={this.design}\n\t\t/>\n\t</>);\n}\n"]}
1
+ {"version":3,"file":"ButtonTemplate.js","sourceRoot":"","sources":["../src/ButtonTemplate.tsx"],"names":[],"mappings":";AAAA,OAAO,WAAW,MAAM,wCAAwC,CAAC;AAGjE,MAAM,CAAC,OAAO,UAAU,cAAc;IACrC,OAAO,CAAC,8BACP,KAAC,WAAW,IACX,KAAK,EAAC,qBAAqB,EAC3B,MAAM,EAAE,IAAI,CAAC,MAAM,EACnB,IAAI,EAAE,IAAI,CAAC,UAAU,EACrB,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,QAAQ,EAAE,IAAI,CAAC,aAAa,EAC5B,gBAAgB,EAAE,IAAI,CAAC,gBAAgB,EACvC,OAAO,EAAE,IAAI,CAAC,QAAQ,EACtB,YAAY,EAAE,IAAI,CAAC,aAAa,EAChC,uBAAuB,EAAE,IAAI,CAAC,gCAAgC,YAE7D,IAAI,CAAC,QAAQ,IAAI,CACjB,cAAK,KAAK,EAAC,oBAAoB,YAAE,IAAI,CAAC,UAAU,GAAO,CACvD,GACY,EAEd,KAAC,WAAW,IACX,KAAK,EAAC,sBAAsB,EAC5B,MAAM,EAAE,IAAI,CAAC,MAAM,GAClB,IACA,CAAC,CAAC;AACN,CAAC","sourcesContent":["import SplitButton from \"@ui5/webcomponents/dist/SplitButton.js\";\nimport type Button from \"./Button.js\";\n\nexport default function ButtonTemplate(this: Button) {\n\treturn (<>\n\t\t<SplitButton\n\t\t\tclass=\"ui5-ai-button-inner\"\n\t\t\tdesign={this.design}\n\t\t\ticon={this._stateIcon}\n\t\t\tdisabled={this.disabled}\n\t\t\t_endIcon={this._stateEndIcon}\n\t\t\t_hideArrowButton={this._hideArrowButton}\n\t\t\tonClick={this._onClick}\n\t\t\tonArrowClick={this._onArrowClick}\n\t\t\taccessibilityAttributes={this._computedAccessibilityAttributes}\n\t\t>\n\t\t\t{this._hasText && (\n\t\t\t\t<div class=\"ui5-ai-button-text\">{this._stateText}</div>\n\t\t\t)}\n\t\t</SplitButton>\n\n\t\t<SplitButton\n\t\t\tclass=\"ui5-ai-button-hidden\"\n\t\t\tdesign={this.design}\n\t\t/>\n\t</>);\n}\n"]}
@@ -0,0 +1,146 @@
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
+ import type { Slot } from "@ui5/webcomponents-base/dist/UI5Element.js";
5
+ type InputVersionChangeEventDetail = {
6
+ backwards: boolean;
7
+ };
8
+ type InputItemClickEventDetail = MenuItemClickEventDetail;
9
+ /**
10
+ * @class
11
+ *
12
+ * ### Overview
13
+ *
14
+ * The `ui5-ai-input` component extends the standard `ui5-input` with **AI Writing Assistant** capabilities.
15
+ *
16
+ * ### Structure
17
+ *
18
+ * The `ui5-ai-input` consists of the following main parts:
19
+ *
20
+ * - **Input Field** – Inherits all standard Input behaviors.
21
+ * - **AI Action Button** – Appears when focused or loading, providing access to AI-related actions or stopping generation.
22
+ *
23
+ * The component automatically determines which elements to render based on its internal state:
24
+ * - The AI Button is only shown when there are available `actions`.
25
+ * - The version navigation appears only when `totalVersions > 1`.
26
+ *
27
+ * ### Keyboard Support
28
+ *
29
+ * - **Shift + F4** — Opens the AI menu.
30
+ * - **Ctrl + Shift + Z / Y** — Navigates backward/forward between AI-generated versions.
31
+ *
32
+ * ### ES6 Module Import
33
+ *
34
+ * `import "@ui5/webcomponents-ai/dist/Input.js";`
35
+ *
36
+ * @constructor
37
+ * @extends BaseInput
38
+ * @since 2.16.0
39
+ * @experimental The **@ui5/webcomponents-ai** package is under active development and considered experimental. Component APIs are subject to change.
40
+ * Furthermore, the package supports **Horizon** themes only.
41
+ * @public
42
+ */
43
+ declare class Input extends BaseInput {
44
+ eventDetails: BaseInput["eventDetails"] & {
45
+ "version-change": InputVersionChangeEventDetail;
46
+ "stop-generation": void;
47
+ "button-click": void;
48
+ "item-click": InputItemClickEventDetail;
49
+ };
50
+ /**
51
+ * Indicates the index of the currently displayed version.
52
+ *
53
+ * @default 0
54
+ * @public
55
+ */
56
+ currentVersion: number;
57
+ /**
58
+ * Indicates the total number of result versions available.
59
+ *
60
+ * When not set or set to 0, the versioning will be hidden.
61
+ *
62
+ * @default 0
63
+ * @public
64
+ */
65
+ totalVersions: number;
66
+ /**
67
+ * Defines whether the AI Writing Assistant is currently loading.
68
+ *
69
+ * When `true`, indicates that an AI action is in progress.
70
+ *
71
+ * @default false
72
+ * @public
73
+ */
74
+ loading: boolean;
75
+ /**
76
+ * Indicates if the menu is open.
77
+ * @default 0
78
+ * @private
79
+ */
80
+ _isMenuOpen: boolean;
81
+ /**
82
+ * Defines the items of the menu for the component.
83
+ * @public
84
+ */
85
+ actions: Slot<HTMLElement>;
86
+ _previousCurrentStep: number;
87
+ _previousTotalSteps: number;
88
+ isFocused: boolean;
89
+ _onfocusin(e: FocusEvent): void;
90
+ _onfocusout(e: FocusEvent): void;
91
+ /**
92
+ * Manages the focus when the navigation buttons become disabled/enabled.
93
+ * Automatically moves the focus to the available button when the user reaches the boundaries.
94
+ * @private
95
+ */
96
+ _manageVersionButtonsFocus(): void;
97
+ /**
98
+ * Handles the click event for the AI generate Button.
99
+ * Fires the appropriate event based on the AI Button state.
100
+ * @private
101
+ */
102
+ _handleAIButtonClick(e: Event): void;
103
+ /**
104
+ * Handles the escape event for the AI generate Button.
105
+ * @private
106
+ */
107
+ _handleAIButtonKeydown: (e: KeyboardEvent) => void;
108
+ /**
109
+ * Handles the version change event from the versioning component.
110
+ *
111
+ * @param {CustomEvent} e - The version change event
112
+ */
113
+ _handleVersionChange(e: CustomEvent<{
114
+ backwards: boolean;
115
+ }>): void;
116
+ /**
117
+ * Handles the click event for the "Previous Version" button.
118
+ * Updates the current version index and syncs content.
119
+ * @private
120
+ */
121
+ _handlePreviousButtonClick(): void;
122
+ /**
123
+ * Handles the click event for the "Next Version" button.
124
+ * Updates the current version index and syncs content.
125
+ * @private
126
+ */
127
+ _handleNextButtonClick(): void;
128
+ _onMenuIconClick(e: CustomEvent<InputItemClickEventDetail>): void;
129
+ /**
130
+ * Handles keydown events for keyboard shortcuts.
131
+ * @private
132
+ */
133
+ _onkeydown(e: KeyboardEvent): void;
134
+ /**
135
+ * Handles visibility of the Writing Assistant Button.
136
+ * If there are no items, the Writing Assistant Button would not be rendered.
137
+ */
138
+ get hasActions(): boolean;
139
+ get ariaLabel(): string;
140
+ get stopGeneratingTooltip(): string;
141
+ get nextButtonAccessibleName(): string;
142
+ get previousButtonAccessibleName(): string;
143
+ get menu(): Menu;
144
+ }
145
+ export type { InputVersionChangeEventDetail, InputItemClickEventDetail, };
146
+ export default Input;