@ui5/webcomponents-ai 0.0.0-d473b9686 → 0.0.0-f6676abdd

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 (199) hide show
  1. package/.nyc_output/out.json +1 -0
  2. package/CHANGELOG.md +449 -0
  3. package/README.md +6 -7
  4. package/coverage/clover.xml +6 -0
  5. package/coverage/coverage-final.json +1 -0
  6. package/coverage/coverage-summary.json +2 -0
  7. package/coverage/lcov-report/base.css +224 -0
  8. package/coverage/lcov-report/block-navigation.js +87 -0
  9. package/coverage/lcov-report/favicon.png +0 -0
  10. package/coverage/lcov-report/index.html +101 -0
  11. package/coverage/lcov-report/prettify.css +1 -0
  12. package/coverage/lcov-report/prettify.js +2 -0
  13. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  14. package/coverage/lcov-report/sorter.js +196 -0
  15. package/coverage/lcov-report/src/generated/themes/Button.css.ts.html +109 -0
  16. package/coverage/lcov-report/src/generated/themes/index.html +116 -0
  17. package/coverage/lcov.info +0 -0
  18. package/cypress/specs/Button.cy.tsx +14 -0
  19. package/cypress/support/commands.ts +1 -0
  20. package/cypress/support/component.ts +3 -0
  21. package/cypress/tsconfig.json +44 -0
  22. package/cypress.config.js +10 -0
  23. package/dist/.tsbuildinfo +1 -0
  24. package/dist/Button.d.ts +119 -2
  25. package/dist/Button.js +241 -12
  26. package/dist/Button.js.map +1 -1
  27. package/dist/ButtonState.d.ts +67 -0
  28. package/dist/ButtonState.js +64 -0
  29. package/dist/ButtonState.js.map +1 -0
  30. package/dist/ButtonTemplate.d.ts +2 -0
  31. package/dist/ButtonTemplate.js +6 -0
  32. package/dist/ButtonTemplate.js.map +1 -0
  33. package/dist/PromptInput.d.ts +147 -0
  34. package/dist/PromptInput.js +225 -0
  35. package/dist/PromptInput.js.map +1 -0
  36. package/dist/PromptInputTemplate.d.ts +2 -0
  37. package/dist/PromptInputTemplate.js +12 -0
  38. package/dist/PromptInputTemplate.js.map +1 -0
  39. package/dist/bundle.esm.js +3 -1
  40. package/dist/bundle.esm.js.map +1 -1
  41. package/dist/bundle.scoped.config.d.ts +1 -0
  42. package/dist/bundle.scoped.config.js +3 -0
  43. package/dist/bundle.scoped.config.js.map +1 -0
  44. package/dist/bundle.scoped.esm.d.ts +2 -1
  45. package/dist/bundle.scoped.esm.js +2 -2
  46. package/dist/bundle.scoped.esm.js.map +1 -1
  47. package/dist/css/themes/Button.css +1 -0
  48. package/dist/css/themes/PromptInput.css +1 -0
  49. package/dist/custom-elements-internal.json +609 -1
  50. package/dist/custom-elements.json +536 -1
  51. package/dist/generated/assets/i18n/messagebundle_ar.json +1 -0
  52. package/dist/generated/assets/i18n/messagebundle_bg.json +1 -0
  53. package/dist/generated/assets/i18n/messagebundle_ca.json +1 -0
  54. package/dist/generated/assets/i18n/messagebundle_cnr.json +1 -0
  55. package/dist/generated/assets/i18n/messagebundle_cs.json +1 -0
  56. package/dist/generated/assets/i18n/messagebundle_cy.json +1 -0
  57. package/dist/generated/assets/i18n/messagebundle_da.json +1 -0
  58. package/dist/generated/assets/i18n/messagebundle_de.json +1 -0
  59. package/dist/generated/assets/i18n/messagebundle_el.json +1 -0
  60. package/dist/generated/assets/i18n/messagebundle_en.json +1 -0
  61. package/dist/generated/assets/i18n/messagebundle_en_GB.json +1 -0
  62. package/dist/generated/assets/i18n/messagebundle_en_US_sappsd.json +1 -0
  63. package/dist/generated/assets/i18n/messagebundle_en_US_saprigi.json +1 -0
  64. package/dist/generated/assets/i18n/messagebundle_en_US_saptrc.json +1 -0
  65. package/dist/generated/assets/i18n/messagebundle_es.json +1 -0
  66. package/dist/generated/assets/i18n/messagebundle_es_MX.json +1 -0
  67. package/dist/generated/assets/i18n/messagebundle_et.json +1 -0
  68. package/dist/generated/assets/i18n/messagebundle_fi.json +1 -0
  69. package/dist/generated/assets/i18n/messagebundle_fr.json +1 -0
  70. package/dist/generated/assets/i18n/messagebundle_fr_CA.json +1 -0
  71. package/dist/generated/assets/i18n/messagebundle_hi.json +1 -0
  72. package/dist/generated/assets/i18n/messagebundle_hr.json +1 -0
  73. package/dist/generated/assets/i18n/messagebundle_hu.json +1 -0
  74. package/dist/generated/assets/i18n/messagebundle_it.json +1 -0
  75. package/dist/generated/assets/i18n/messagebundle_iw.json +1 -0
  76. package/dist/generated/assets/i18n/messagebundle_ja.json +1 -0
  77. package/dist/generated/assets/i18n/messagebundle_kk.json +1 -0
  78. package/dist/generated/assets/i18n/messagebundle_ko.json +1 -0
  79. package/dist/generated/assets/i18n/messagebundle_lt.json +1 -0
  80. package/dist/generated/assets/i18n/messagebundle_lv.json +1 -0
  81. package/dist/generated/assets/i18n/messagebundle_mk.json +1 -0
  82. package/dist/generated/assets/i18n/messagebundle_ms.json +1 -0
  83. package/dist/generated/assets/i18n/messagebundle_nl.json +1 -0
  84. package/dist/generated/assets/i18n/messagebundle_no.json +1 -0
  85. package/dist/generated/assets/i18n/messagebundle_pl.json +1 -0
  86. package/dist/generated/assets/i18n/messagebundle_pt.json +1 -0
  87. package/dist/generated/assets/i18n/messagebundle_pt_PT.json +1 -0
  88. package/dist/generated/assets/i18n/messagebundle_ro.json +1 -0
  89. package/dist/generated/assets/i18n/messagebundle_ru.json +1 -0
  90. package/dist/generated/assets/i18n/messagebundle_sh.json +1 -0
  91. package/dist/generated/assets/i18n/messagebundle_sk.json +1 -0
  92. package/dist/generated/assets/i18n/messagebundle_sl.json +1 -0
  93. package/dist/generated/assets/i18n/messagebundle_sr.json +1 -0
  94. package/dist/generated/assets/i18n/messagebundle_sv.json +1 -0
  95. package/dist/generated/assets/i18n/messagebundle_th.json +1 -0
  96. package/dist/generated/assets/i18n/messagebundle_tr.json +1 -0
  97. package/dist/generated/assets/i18n/messagebundle_uk.json +1 -0
  98. package/dist/generated/assets/i18n/messagebundle_vi.json +1 -0
  99. package/dist/generated/assets/i18n/messagebundle_zh_CN.json +1 -0
  100. package/dist/generated/assets/i18n/messagebundle_zh_TW.json +1 -0
  101. package/dist/generated/assets/themes/sap_horizon/parameters-bundle.css.json +1 -1
  102. package/dist/generated/assets/themes/sap_horizon_dark/parameters-bundle.css.json +1 -1
  103. package/dist/generated/assets/themes/sap_horizon_hcb/parameters-bundle.css.json +1 -1
  104. package/dist/generated/assets/themes/sap_horizon_hcw/parameters-bundle.css.json +1 -1
  105. package/dist/generated/i18n/i18n-defaults.d.ts +4 -1
  106. package/dist/generated/i18n/i18n-defaults.js +3 -1
  107. package/dist/generated/i18n/i18n-defaults.js.map +1 -1
  108. package/dist/generated/json-imports/Themes-fetch.d.ts +1 -0
  109. package/dist/generated/json-imports/Themes-fetch.js +21 -0
  110. package/dist/generated/json-imports/Themes-fetch.js.map +1 -0
  111. package/dist/generated/json-imports/Themes.js.map +1 -1
  112. package/dist/generated/json-imports/i18n-fetch.d.ts +1 -0
  113. package/dist/generated/json-imports/i18n-fetch.js +118 -0
  114. package/dist/generated/json-imports/i18n-fetch.js.map +1 -0
  115. package/dist/generated/json-imports/i18n.d.ts +1 -0
  116. package/dist/generated/json-imports/i18n.js +117 -1
  117. package/dist/generated/json-imports/i18n.js.map +1 -1
  118. package/dist/generated/themes/Button.css.d.ts +2 -3
  119. package/dist/generated/themes/Button.css.js +2 -2
  120. package/dist/generated/themes/Button.css.js.map +1 -1
  121. package/dist/generated/themes/PromptInput.css.d.ts +2 -0
  122. package/dist/generated/themes/PromptInput.css.js +8 -0
  123. package/dist/generated/themes/PromptInput.css.js.map +1 -0
  124. package/dist/generated/themes/sap_horizon/parameters-bundle.css.d.ts +2 -3
  125. package/dist/generated/themes/sap_horizon/parameters-bundle.css.js +1 -2
  126. package/dist/generated/themes/sap_horizon/parameters-bundle.css.js.map +1 -1
  127. package/dist/generated/themes/sap_horizon_dark/parameters-bundle.css.d.ts +2 -3
  128. package/dist/generated/themes/sap_horizon_dark/parameters-bundle.css.js +1 -2
  129. package/dist/generated/themes/sap_horizon_dark/parameters-bundle.css.js.map +1 -1
  130. package/dist/generated/themes/sap_horizon_hcb/parameters-bundle.css.d.ts +2 -3
  131. package/dist/generated/themes/sap_horizon_hcb/parameters-bundle.css.js +1 -2
  132. package/dist/generated/themes/sap_horizon_hcb/parameters-bundle.css.js.map +1 -1
  133. package/dist/generated/themes/sap_horizon_hcw/parameters-bundle.css.d.ts +2 -3
  134. package/dist/generated/themes/sap_horizon_hcw/parameters-bundle.css.js +1 -2
  135. package/dist/generated/themes/sap_horizon_hcw/parameters-bundle.css.js.map +1 -1
  136. package/dist/vscode.html-custom-data.json +131 -1
  137. package/dist/web-types.json +315 -0
  138. package/package.json +11 -8
  139. package/src/ButtonTemplate.tsx +26 -0
  140. package/src/PromptInputTemplate.tsx +49 -0
  141. package/src/i18n/messagebundle.properties +6 -0
  142. package/src/i18n/messagebundle_ar.properties +4 -0
  143. package/src/i18n/messagebundle_bg.properties +4 -0
  144. package/src/i18n/messagebundle_ca.properties +4 -0
  145. package/src/i18n/messagebundle_cnr.properties +4 -0
  146. package/src/i18n/messagebundle_cs.properties +4 -0
  147. package/src/i18n/messagebundle_cy.properties +4 -0
  148. package/src/i18n/messagebundle_da.properties +4 -0
  149. package/src/i18n/messagebundle_de.properties +4 -0
  150. package/src/i18n/messagebundle_el.properties +4 -0
  151. package/src/i18n/messagebundle_en.properties +4 -0
  152. package/src/i18n/messagebundle_en_GB.properties +4 -0
  153. package/src/i18n/messagebundle_en_US_sappsd.properties +4 -0
  154. package/src/i18n/messagebundle_en_US_saprigi.properties +4 -0
  155. package/src/i18n/messagebundle_en_US_saptrc.properties +4 -0
  156. package/src/i18n/messagebundle_es.properties +4 -0
  157. package/src/i18n/messagebundle_es_MX.properties +4 -0
  158. package/src/i18n/messagebundle_et.properties +4 -0
  159. package/src/i18n/messagebundle_fi.properties +4 -0
  160. package/src/i18n/messagebundle_fr.properties +4 -0
  161. package/src/i18n/messagebundle_fr_CA.properties +4 -0
  162. package/src/i18n/messagebundle_hi.properties +4 -0
  163. package/src/i18n/messagebundle_hr.properties +4 -0
  164. package/src/i18n/messagebundle_hu.properties +4 -0
  165. package/src/i18n/messagebundle_id.properties +4 -0
  166. package/src/i18n/messagebundle_it.properties +4 -0
  167. package/src/i18n/messagebundle_iw.properties +4 -0
  168. package/src/i18n/messagebundle_ja.properties +4 -0
  169. package/src/i18n/messagebundle_kk.properties +4 -0
  170. package/src/i18n/messagebundle_ko.properties +4 -0
  171. package/src/i18n/messagebundle_lt.properties +4 -0
  172. package/src/i18n/messagebundle_lv.properties +4 -0
  173. package/src/i18n/messagebundle_mk.properties +4 -0
  174. package/src/i18n/messagebundle_ms.properties +4 -0
  175. package/src/i18n/messagebundle_nl.properties +4 -0
  176. package/src/i18n/messagebundle_no.properties +4 -0
  177. package/src/i18n/messagebundle_pl.properties +4 -0
  178. package/src/i18n/messagebundle_pt.properties +4 -0
  179. package/src/i18n/messagebundle_pt_PT.properties +4 -0
  180. package/src/i18n/messagebundle_ro.properties +4 -0
  181. package/src/i18n/messagebundle_ru.properties +4 -0
  182. package/src/i18n/messagebundle_sh.properties +4 -0
  183. package/src/i18n/messagebundle_sk.properties +4 -0
  184. package/src/i18n/messagebundle_sl.properties +4 -0
  185. package/src/i18n/messagebundle_sr.properties +4 -0
  186. package/src/i18n/messagebundle_sv.properties +4 -0
  187. package/src/i18n/messagebundle_th.properties +4 -0
  188. package/src/i18n/messagebundle_tr.properties +4 -0
  189. package/src/i18n/messagebundle_uk.properties +4 -0
  190. package/src/i18n/messagebundle_vi.properties +4 -0
  191. package/src/i18n/messagebundle_zh_CN.properties +4 -0
  192. package/src/i18n/messagebundle_zh_TW.properties +4 -0
  193. package/src/themes/Button.css +142 -0
  194. package/src/themes/PromptInput.css +30 -0
  195. package/tsconfig.json +55 -26
  196. package/dist/generated/templates/ButtonTemplate.lit.d.ts +0 -4
  197. package/dist/generated/templates/ButtonTemplate.lit.js +0 -5
  198. package/dist/generated/templates/ButtonTemplate.lit.js.map +0 -1
  199. package/src/Button.hbs +0 -3
package/dist/Button.js CHANGED
@@ -5,35 +5,264 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
5
5
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6
6
  };
7
7
  import UI5Element from "@ui5/webcomponents-base/dist/UI5Element.js";
8
+ import { renderFinished } from "@ui5/webcomponents-base/dist/Render.js";
8
9
  import customElement from "@ui5/webcomponents-base/dist/decorators/customElement.js";
9
10
  import property from "@ui5/webcomponents-base/dist/decorators/property.js";
10
- import litRender from "@ui5/webcomponents-base/dist/renderer/LitRenderer.js";
11
- // Deps
12
- import MainButton from "@ui5/webcomponents/dist/Button.js";
13
- // Template
14
- import template from "./generated/templates/ButtonTemplate.lit.js";
11
+ import event from "@ui5/webcomponents-base/dist/decorators/event-strict.js";
12
+ import slot from "@ui5/webcomponents-base/dist/decorators/slot.js";
13
+ import query from "@ui5/webcomponents-base/dist/decorators/query.js";
14
+ import jsxRenderer from "@ui5/webcomponents-base/dist/renderer/JsxRenderer.js";
15
+ import "./ButtonState.js";
16
+ import ButtonTemplate from "./ButtonTemplate.js";
15
17
  // Styles
16
- import styles from "./generated/themes/Button.css.js";
18
+ import ButtonCss from "./generated/themes/Button.css.js";
17
19
  /**
18
20
  * @class
21
+ *
22
+ * ### Overview
23
+ *
24
+ * 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`
25
+ * or by pressing keyboard keys like [Enter] or [Space].
26
+ *
27
+ * ### Usage
28
+ *
29
+ * 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.
30
+ * Each state has a name for identification and can include text, an icon, and an end icon, as needed for its purpose.
31
+ * You can define a split mode for the `ui5-ai-button`, which will results in displaying an arrow button for additional actions.
32
+ *
33
+ * You can choose from a set of predefined designs for `ui5-ai-button` (as in `ui5-button`) to match the desired styling.
34
+ *
35
+ * 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
36
+ * in split mode, you can activate the default button action by clicking or tapping it, or by pressing keyboard keys like [Enter] or [Space].
37
+ * You can activate the arrow button by clicking or tapping it, or by pressing keyboard keys like [Arrow Up], [Arrow Down], or [F4].
38
+ * To display additional actions, you can attach a menu to the arrow button.
39
+ *
40
+ * ### ES6 Module Import
41
+ *
42
+ * `import "@ui5/webcomponents-ai/dist/Button.js";`
43
+ *
19
44
  * @constructor
20
45
  * @extends UI5Element
46
+ * @since 2.0.0
47
+ * @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.
21
49
  */
22
50
  let Button = class Button extends UI5Element {
51
+ constructor() {
52
+ super(...arguments);
53
+ /**
54
+ * Defines the component design.
55
+ * @default "Default"
56
+ * @public
57
+ */
58
+ this.design = "Default";
59
+ /**
60
+ * Defines whether the component is disabled.
61
+ * A disabled component can't be pressed or
62
+ * focused, and it is not in the tab chain.
63
+ * @default false
64
+ * @public
65
+ */
66
+ this.disabled = false;
67
+ /**
68
+ * Defines the active state of the arrow button in split mode.
69
+ * Set to true when the button is in split mode and a menu with additional options
70
+ * is opened by the arrow button. Set back to false when the menu is closed.
71
+ * @default false
72
+ * @public
73
+ * @since 2.6.0
74
+ */
75
+ this.arrowButtonPressed = false;
76
+ /**
77
+ * Determines if the button is in icon-only mode.
78
+ * This property is animation related only.
79
+ * @default false
80
+ * @private
81
+ */
82
+ this.iconOnly = false;
83
+ }
84
+ get _hideArrowButton() {
85
+ return !this._effectiveStateObject?.showArrowButton;
86
+ }
87
+ get _effectiveState() {
88
+ return this.state || (this.states.length && this.states[0].name) || "";
89
+ }
90
+ get _effectiveStateObject() {
91
+ return this.states.find(state => state.name === this._effectiveState);
92
+ }
93
+ get _stateIconOnly() {
94
+ return !this._stateText && !!this._stateIcon;
95
+ }
96
+ get _stateText() {
97
+ return this._currentStateObject?.text;
98
+ }
99
+ get _stateIcon() {
100
+ return this._currentStateObject?.icon;
101
+ }
102
+ get _stateEndIcon() {
103
+ const endIcon = this._effectiveStateObject?.showArrowButton ? "" : this._effectiveStateObject?.endIcon;
104
+ return endIcon;
105
+ }
106
+ get _hasText() {
107
+ return !!this._stateText;
108
+ }
109
+ onBeforeRendering() {
110
+ const splitButton = this._splitButton;
111
+ if (splitButton) {
112
+ splitButton.activeArrowButton = this.arrowButtonPressed;
113
+ }
114
+ if (!this._currentStateObject?.name) {
115
+ this._currentStateObject = this._effectiveStateObject;
116
+ }
117
+ const currentStateName = this._currentStateObject?.name || "";
118
+ this.iconOnly = this._stateIconOnly;
119
+ if (currentStateName !== "" && currentStateName !== this._effectiveState) {
120
+ this._fadeOut();
121
+ }
122
+ }
123
+ /**
124
+ * Starts the fade-out animation.
125
+ * @private
126
+ */
127
+ async _fadeOut() {
128
+ const fadeOutDuration = 180;
129
+ const button = this._splitButton;
130
+ const hiddenButton = this._hiddenSplitButton;
131
+ const newStateObject = this._effectiveStateObject;
132
+ if (!newStateObject) {
133
+ // eslint-disable-next-line no-console
134
+ console.warn(`State with name="${this.state}" doesn't exist!`);
135
+ return;
136
+ }
137
+ if (!button || !hiddenButton) {
138
+ return;
139
+ }
140
+ const buttonWidth = button.offsetWidth;
141
+ const currentState = this._currentStateObject || {};
142
+ if ((!currentState.showArrowButton && newStateObject.showArrowButton) || (!currentState.endIcon && !!newStateObject.endIcon)) {
143
+ this.classList.add("ui5-ai-button-button-to-menu");
144
+ }
145
+ if ((currentState.showArrowButton && !newStateObject.showArrowButton) || (!!currentState.endIcon && !newStateObject.endIcon)) {
146
+ this.classList.add("ui5-ai-button-menu-to-button");
147
+ }
148
+ this.style.width = `${buttonWidth}px`;
149
+ hiddenButton.icon = newStateObject.icon;
150
+ hiddenButton._endIcon = newStateObject.endIcon;
151
+ hiddenButton.textContent = newStateObject.text || null;
152
+ hiddenButton._hideArrowButton = this._hideArrowButton;
153
+ await renderFinished();
154
+ const hiddenButtonWidth = hiddenButton.offsetWidth;
155
+ this.style.width = `${hiddenButtonWidth}px`;
156
+ this.classList.add("ui5-ai-button-fade-out");
157
+ setTimeout(() => {
158
+ this.classList.add("ui5-ai-button-fade-mid");
159
+ button._hideArrowButton = this._hideArrowButton;
160
+ this._fadeIn();
161
+ }, fadeOutDuration);
162
+ }
163
+ /**
164
+ * Starts the fade-in animation.
165
+ * @private
166
+ */
167
+ _fadeIn() {
168
+ const fadeInDuration = 160;
169
+ setTimeout(() => {
170
+ const newStateObject = this._effectiveStateObject;
171
+ this._currentStateObject = newStateObject;
172
+ this.classList.add("ui5-ai-button-fade-in");
173
+ this._resetFade();
174
+ }, fadeInDuration);
175
+ }
176
+ /**
177
+ * Resets the fade phases when the animation is completed.
178
+ * @private
179
+ */
180
+ _resetFade() {
181
+ const fadeResetDuration = 160;
182
+ setTimeout(() => {
183
+ this.classList.remove("ui5-ai-button-fade-out");
184
+ this.classList.remove("ui5-ai-button-fade-mid");
185
+ this.classList.remove("ui5-ai-button-fade-in");
186
+ this.classList.remove("ui5-ai-button-button-to-menu");
187
+ this.classList.remove("ui5-ai-button-menu-to-button");
188
+ }, fadeResetDuration);
189
+ // reset the button's width after animations
190
+ const button = this._splitButton;
191
+ if (button) {
192
+ button.style.width = "";
193
+ }
194
+ }
195
+ /**
196
+ * Handles the click event.
197
+ * @private
198
+ */
199
+ _onClick(e) {
200
+ e.stopImmediatePropagation();
201
+ this.fireDecoratorEvent("click");
202
+ }
203
+ /**
204
+ * Handles the arrow-button-click event when `ui5-ai-button` is in split mode.
205
+ * @private
206
+ */
207
+ _onArrowClick(e) {
208
+ e.stopImmediatePropagation();
209
+ this.fireDecoratorEvent("arrow-button-click");
210
+ }
23
211
  };
24
212
  __decorate([
25
213
  property()
26
- ], Button.prototype, "icon", void 0);
214
+ ], Button.prototype, "design", void 0);
215
+ __decorate([
216
+ property({ type: Boolean })
217
+ ], Button.prototype, "disabled", void 0);
27
218
  __decorate([
28
219
  property()
29
- ], Button.prototype, "endIcon", void 0);
220
+ ], Button.prototype, "state", void 0);
221
+ __decorate([
222
+ property({ type: Boolean, noAttribute: true })
223
+ ], Button.prototype, "arrowButtonPressed", void 0);
224
+ __decorate([
225
+ property({ type: Object })
226
+ ], Button.prototype, "_currentStateObject", void 0);
227
+ __decorate([
228
+ property({ type: Boolean })
229
+ ], Button.prototype, "iconOnly", void 0);
230
+ __decorate([
231
+ slot({ type: HTMLElement, "default": true })
232
+ ], Button.prototype, "states", void 0);
233
+ __decorate([
234
+ query("[ui5-split-button]")
235
+ ], Button.prototype, "_splitButton", void 0);
236
+ __decorate([
237
+ query(".ui5-ai-button-hidden[ui5-split-button]")
238
+ ], Button.prototype, "_hiddenSplitButton", void 0);
30
239
  Button = __decorate([
31
240
  customElement({
32
241
  tag: "ui5-ai-button",
33
- renderer: litRender,
34
- template,
35
- styles,
36
- dependencies: [MainButton],
242
+ languageAware: true,
243
+ renderer: jsxRenderer,
244
+ template: ButtonTemplate,
245
+ styles: ButtonCss,
246
+ shadowRootOptions: { delegatesFocus: true },
247
+ })
248
+ /**
249
+ * Fired when the component is activated either with a
250
+ * mouse/tap or by using the Enter or Space key.
251
+ * @public
252
+ */
253
+ ,
254
+ event("click", {
255
+ bubbles: true,
256
+ })
257
+ /**
258
+ * Fired when the component is in split mode and after the arrow button
259
+ * is activated either by clicking or tapping it or by using the [Arrow Up] / [Arrow Down],
260
+ * [Alt] + [Arrow Up]/ [Arrow Down], or [F4] keyboard keys.
261
+ * @public
262
+ */
263
+ ,
264
+ event("arrow-button-click", {
265
+ bubbles: true,
37
266
  })
38
267
  ], Button);
39
268
  Button.define();
@@ -1 +1 @@
1
- {"version":3,"file":"Button.js","sourceRoot":"","sources":["../src/Button.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,UAAU,MAAM,4CAA4C,CAAC;AACpE,OAAO,aAAa,MAAM,0DAA0D,CAAC;AACrF,OAAO,QAAQ,MAAM,qDAAqD,CAAC;AAC3E,OAAO,SAAS,MAAM,sDAAsD,CAAC;AAE7E,OAAO;AACP,OAAO,UAAU,MAAM,mCAAmC,CAAC;AAE3D,WAAW;AACX,OAAO,QAAQ,MAAM,6CAA6C,CAAC;AAEnE,SAAS;AACT,OAAO,MAAM,MAAM,kCAAkC,CAAC;AAEtD;;;;GAIG;AAQH,IAAM,MAAM,GAAZ,MAAM,MAAO,SAAQ,UAAU;CAM9B,CAAA;AAJA;IADC,QAAQ,EAAE;oCACG;AAGd;IADC,QAAQ,EAAE;uCACM;AALZ,MAAM;IAPX,aAAa,CAAC;QACd,GAAG,EAAE,eAAe;QACpB,QAAQ,EAAE,SAAS;QACnB,QAAQ;QACR,MAAM;QACN,YAAY,EAAE,CAAC,UAAU,CAAC;KAC1B,CAAC;GACI,MAAM,CAMX;AAED,MAAM,CAAC,MAAM,EAAE,CAAC;AAEhB,eAAe,MAAM,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\";\nimport litRender from \"@ui5/webcomponents-base/dist/renderer/LitRenderer.js\";\n\n// Deps\nimport MainButton from \"@ui5/webcomponents/dist/Button.js\";\n\n// Template\nimport template from \"./generated/templates/ButtonTemplate.lit.js\";\n\n// Styles\nimport styles from \"./generated/themes/Button.css.js\";\n\n/**\n * @class\n * @constructor\n * @extends UI5Element\n */\n@customElement({\n\ttag: \"ui5-ai-button\",\n\trenderer: litRender,\n\ttemplate,\n\tstyles,\n\tdependencies: [MainButton],\n})\nclass Button extends UI5Element {\n\t@property()\n\ticon!: string;\n\n\t@property()\n\tendIcon!: string;\n}\n\nButton.define();\n\nexport default Button;\n"]}
1
+ {"version":3,"file":"Button.js","sourceRoot":"","sources":["../src/Button.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,UAAU,MAAM,4CAA4C,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;AACxE,OAAO,aAAa,MAAM,0DAA0D,CAAC;AACrF,OAAO,QAAQ,MAAM,qDAAqD,CAAC;AAC3E,OAAO,KAAK,MAAM,yDAAyD,CAAC;AAC5E,OAAO,IAAI,MAAM,iDAAiD,CAAC;AAC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ponents-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"]}
@@ -0,0 +1,67 @@
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 Button and ButtonState web components are available since 2.0 under an experimental flag and their API and behaviour are subject to change.
23
+ */
24
+ declare class ButtonState extends UI5Element {
25
+ /**
26
+ * Defines the name of the button state.
27
+ * @default undefined
28
+ * @public
29
+ */
30
+ name?: string;
31
+ /**
32
+ * Defines the text of the button in this state.
33
+ * @default undefined
34
+ * @public
35
+ */
36
+ text?: string;
37
+ /**
38
+ * Defines the icon to be displayed as graphical element within the component before the text.
39
+ * The SAP-icons font provides numerous options.
40
+ *
41
+ * **Example:**
42
+ *
43
+ * See all the available icons in the [Icon Explorer](https://sdk.openui5.org/test-resources/sap/m/demokit/iconExplorer/webapp/index.html).
44
+ * @default undefined
45
+ * @public
46
+ */
47
+ icon?: string;
48
+ /**
49
+ * Defines the icon to be displayed as graphical element within the component after the text.
50
+ * The SAP-icons font provides numerous options.
51
+ *
52
+ * **Example:**
53
+ *
54
+ * See all the available icons in the [Icon Explorer](https://sdk.openui5.org/test-resources/sap/m/demokit/iconExplorer/webapp/index.html).
55
+ * @default undefined
56
+ * @public
57
+ */
58
+ endIcon?: string;
59
+ /**
60
+ * Defines if the component is in split button mode.
61
+ * @default false
62
+ * @since 2.6.0
63
+ * @public
64
+ */
65
+ showArrowButton: boolean;
66
+ }
67
+ export default ButtonState;
@@ -0,0 +1,64 @@
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 Button and ButtonState web components are available since 2.0 under an experimental flag and their API and behaviour are subject to change.
31
+ */
32
+ let ButtonState = class ButtonState extends UI5Element {
33
+ constructor() {
34
+ super(...arguments);
35
+ /**
36
+ * Defines if the component is in split button mode.
37
+ * @default false
38
+ * @since 2.6.0
39
+ * @public
40
+ */
41
+ this.showArrowButton = false;
42
+ }
43
+ };
44
+ __decorate([
45
+ property()
46
+ ], ButtonState.prototype, "name", void 0);
47
+ __decorate([
48
+ property()
49
+ ], ButtonState.prototype, "text", void 0);
50
+ __decorate([
51
+ property()
52
+ ], ButtonState.prototype, "icon", void 0);
53
+ __decorate([
54
+ property()
55
+ ], ButtonState.prototype, "endIcon", void 0);
56
+ __decorate([
57
+ property({ type: Boolean })
58
+ ], ButtonState.prototype, "showArrowButton", void 0);
59
+ ButtonState = __decorate([
60
+ customElement("ui5-ai-button-state")
61
+ ], ButtonState);
62
+ ButtonState.define();
63
+ export default ButtonState;
64
+ //# sourceMappingURL=ButtonState.js.map
@@ -0,0 +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"]}
@@ -0,0 +1,2 @@
1
+ import type Button from "./Button.js";
2
+ export default function ButtonTemplate(this: Button): import("@ui5/webcomponents-base/jsx-runtime").JSX.Element;
@@ -0,0 +1,6 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "@ui5/webcomponents-base/jsx-runtime";
2
+ import SplitButton from "@ui5/webcomponents/dist/SplitButton.js";
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 })] }));
5
+ }
6
+ //# sourceMappingURL=ButtonTemplate.js.map
@@ -0,0 +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"]}
@@ -0,0 +1,147 @@
1
+ import UI5Element from "@ui5/webcomponents-base/dist/UI5Element.js";
2
+ import type I18nBundle from "@ui5/webcomponents-base/dist/i18nBundle.js";
3
+ import type ValueState from "@ui5/webcomponents-base/dist/types/ValueState.js";
4
+ import type { IInputSuggestionItem, InputEventDetail } from "@ui5/webcomponents/dist/Input.js";
5
+ /**
6
+ * @class
7
+ * ### Overview
8
+ *
9
+ * The `ui5-ai-prompt-input` component allows the user to write custom instructions in natural language, so that AI is guided to generate content tailored to user needs.
10
+ *
11
+ * **Note:** The web component is in an experimental state
12
+ *
13
+ * ### ES6 Module Import
14
+ *
15
+ * `import "@ui5/webcomponents-ai/dist/PromptInput.js"`
16
+ * @class
17
+ * @constructor
18
+ * @public
19
+ * @extends UI5Element
20
+ * @experimental The **@ui5/webcomponents-ai** package is under development and considered experimental - components' APIs are subject to change.
21
+ */
22
+ declare class PromptInput extends UI5Element {
23
+ eventDetails: {
24
+ submit: void;
25
+ input: void;
26
+ change: void;
27
+ };
28
+ /**
29
+ * Defines the value of the component.
30
+ *
31
+ * @default ""
32
+ * @since 2.0.0
33
+ * @public
34
+ */
35
+ value: string;
36
+ /**
37
+ * Defines a short hint intended to aid the user with data entry when the
38
+ * component has no value.
39
+ * @default undefined
40
+ * @since 2.0.0
41
+ * @public
42
+ */
43
+ placeholder?: string;
44
+ /**
45
+ * Defines the label of the input field.
46
+ *
47
+ * @default undefined
48
+ * @since 2.0.0
49
+ * @public
50
+ */
51
+ label?: string;
52
+ /**
53
+ * Defines whether the clear icon of the input will be shown.
54
+ * @default false
55
+ * @public
56
+ * @since 2.0.0
57
+ */
58
+ showClearIcon: boolean;
59
+ /**
60
+ * Determines whether the characters exceeding the maximum allowed character count are visible
61
+ * in the component.
62
+ *
63
+ * If set to `false`, the user is not allowed to enter more characters than what is set in the
64
+ * `maxlength` property.
65
+ * If set to `true` the characters exceeding the `maxlength` value are selected on
66
+ * paste and the counter below the component displays their number.
67
+ * @default false
68
+ * @public
69
+ * @since 2.0.0
70
+ */
71
+ showExceededText: boolean;
72
+ /**
73
+ * Defines whether the component is in disabled state.
74
+ *
75
+ * **Note:** A disabled component is completely noninteractive.
76
+ * @default false
77
+ * @public
78
+ * @since 2.0.0
79
+ */
80
+ disabled: boolean;
81
+ /**
82
+ * Defines whether the component is read-only.
83
+ *
84
+ * **Note:** A read-only component is not editable,
85
+ * but still provides visual feedback upon user interaction.
86
+ * @default false
87
+ * @public
88
+ * @since 2.0.0
89
+ */
90
+ readonly: boolean;
91
+ /**
92
+ * Sets the maximum number of characters available in the input field.
93
+ *
94
+ * @default undefined
95
+ * @since 2.0.0
96
+ * @public
97
+ */
98
+ maxlength?: number;
99
+ /**
100
+ * Defines the value state of the component.
101
+ * @default "None"
102
+ * @since 2.0.0
103
+ * @public
104
+ */
105
+ valueState: `${ValueState}`;
106
+ /**
107
+ * Defines whether the component should show suggestions, if such are present.
108
+ *
109
+ * @default false
110
+ * @public
111
+ */
112
+ showSuggestions: boolean;
113
+ /**
114
+ * Defines the suggestion items.
115
+ *
116
+ * **Note:** The suggestions would be displayed only if the `showSuggestions`
117
+ * property is set to `true`.
118
+ *
119
+ * **Note:** The `<ui5-suggestion-item>`, `<ui5-suggestion-item-group>` and `ui5-suggestion-item-custom` are recommended to be used as suggestion items.
120
+ *
121
+ * @public
122
+ */
123
+ suggestionItems: Array<IInputSuggestionItem>;
124
+ /**
125
+ * Defines the value state message that will be displayed as pop up under the component.
126
+ * The value state message slot should contain only one root element.
127
+ *
128
+ * **Note:** If not specified, a default text (in the respective language) will be displayed.
129
+ *
130
+ * **Note:** The `valueStateMessage` would be displayed,
131
+ * when the component is in `Information`, `Critical` or `Negative` value state.
132
+ *
133
+ * @since 2.0.0
134
+ * @public
135
+ */
136
+ valueStateMessage: Array<HTMLElement>;
137
+ static i18nBundle: I18nBundle;
138
+ _onkeydown(e: KeyboardEvent): void;
139
+ _onInnerInput(e: CustomEvent<InputEventDetail>): void;
140
+ _onInnerChange(): void;
141
+ _onButtonClick(): void;
142
+ _onTypeAhead(e: CustomEvent): void;
143
+ get _exceededText(): string | undefined;
144
+ get _maxLenght(): number | undefined;
145
+ get _submitButtonDisabled(): boolean;
146
+ }
147
+ export default PromptInput;