@ui5/webcomponents-ai 0.0.0-037d08c67

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 (267) hide show
  1. package/.env.production +1 -0
  2. package/.env.testing +4 -0
  3. package/.npsrc.json +3 -0
  4. package/.ui5-cem-aliases.json +4 -0
  5. package/CHANGELOG.md +1031 -0
  6. package/LICENSE.txt +201 -0
  7. package/README.md +40 -0
  8. package/cypress.config.js +3 -0
  9. package/dist/.tsbuildinfo +1 -0
  10. package/dist/Assets-fetch.d.ts +3 -0
  11. package/dist/Assets-fetch.js +6 -0
  12. package/dist/Assets-fetch.js.map +1 -0
  13. package/dist/Assets-node.d.ts +14 -0
  14. package/dist/Assets-node.js +17 -0
  15. package/dist/Assets-node.js.map +1 -0
  16. package/dist/Assets.d.ts +3 -0
  17. package/dist/Assets.js +6 -0
  18. package/dist/Assets.js.map +1 -0
  19. package/dist/Button.d.ts +167 -0
  20. package/dist/Button.js +325 -0
  21. package/dist/Button.js.map +1 -0
  22. package/dist/ButtonState.d.ts +68 -0
  23. package/dist/ButtonState.js +65 -0
  24. package/dist/ButtonState.js.map +1 -0
  25. package/dist/ButtonTemplate.d.ts +2 -0
  26. package/dist/ButtonTemplate.js +6 -0
  27. package/dist/ButtonTemplate.js.map +1 -0
  28. package/dist/Input.d.ts +146 -0
  29. package/dist/Input.js +291 -0
  30. package/dist/Input.js.map +1 -0
  31. package/dist/InputTemplate.d.ts +10 -0
  32. package/dist/InputTemplate.js +28 -0
  33. package/dist/InputTemplate.js.map +1 -0
  34. package/dist/PromptInput.d.ts +151 -0
  35. package/dist/PromptInput.js +226 -0
  36. package/dist/PromptInput.js.map +1 -0
  37. package/dist/PromptInputTemplate.d.ts +2 -0
  38. package/dist/PromptInputTemplate.js +12 -0
  39. package/dist/PromptInputTemplate.js.map +1 -0
  40. package/dist/TextArea.d.ts +125 -0
  41. package/dist/TextArea.js +272 -0
  42. package/dist/TextArea.js.map +1 -0
  43. package/dist/TextAreaTemplate.d.ts +2 -0
  44. package/dist/TextAreaTemplate.js +13 -0
  45. package/dist/TextAreaTemplate.js.map +1 -0
  46. package/dist/ToolbarLabel.d.ts +39 -0
  47. package/dist/ToolbarLabel.js +67 -0
  48. package/dist/ToolbarLabel.js.map +1 -0
  49. package/dist/ToolbarLabelTemplate.d.ts +2 -0
  50. package/dist/ToolbarLabelTemplate.js +5 -0
  51. package/dist/ToolbarLabelTemplate.js.map +1 -0
  52. package/dist/Versioning.d.ts +95 -0
  53. package/dist/Versioning.js +187 -0
  54. package/dist/Versioning.js.map +1 -0
  55. package/dist/VersioningTemplate.d.ts +4 -0
  56. package/dist/VersioningTemplate.js +9 -0
  57. package/dist/VersioningTemplate.js.map +1 -0
  58. package/dist/WritingAssistant.d.ts +101 -0
  59. package/dist/WritingAssistant.js +201 -0
  60. package/dist/WritingAssistant.js.map +1 -0
  61. package/dist/WritingAssistantTemplate.d.ts +2 -0
  62. package/dist/WritingAssistantTemplate.js +12 -0
  63. package/dist/WritingAssistantTemplate.js.map +1 -0
  64. package/dist/bundle.esm.d.ts +3 -0
  65. package/dist/bundle.esm.js +11 -0
  66. package/dist/bundle.esm.js.map +1 -0
  67. package/dist/bundle.scoped.config.d.ts +1 -0
  68. package/dist/bundle.scoped.config.js +3 -0
  69. package/dist/bundle.scoped.config.js.map +1 -0
  70. package/dist/bundle.scoped.esm.d.ts +2 -0
  71. package/dist/bundle.scoped.esm.js +3 -0
  72. package/dist/bundle.scoped.esm.js.map +1 -0
  73. package/dist/css/themes/Button.css +1 -0
  74. package/dist/css/themes/Input.css +1 -0
  75. package/dist/css/themes/PromptInput.css +1 -0
  76. package/dist/css/themes/TextArea.css +1 -0
  77. package/dist/css/themes/Versioning.css +1 -0
  78. package/dist/css/themes/WritingAssistant.css +1 -0
  79. package/dist/css/themes/sap_horizon/parameters-bundle.css +1 -0
  80. package/dist/css/themes/sap_horizon_dark/parameters-bundle.css +1 -0
  81. package/dist/css/themes/sap_horizon_hcb/parameters-bundle.css +1 -0
  82. package/dist/css/themes/sap_horizon_hcw/parameters-bundle.css +1 -0
  83. package/dist/custom-elements-internal.json +1087 -0
  84. package/dist/custom-elements.json +937 -0
  85. package/dist/generated/assets/i18n/messagebundle_ar.json +1 -0
  86. package/dist/generated/assets/i18n/messagebundle_bg.json +1 -0
  87. package/dist/generated/assets/i18n/messagebundle_ca.json +1 -0
  88. package/dist/generated/assets/i18n/messagebundle_cnr.json +1 -0
  89. package/dist/generated/assets/i18n/messagebundle_cs.json +1 -0
  90. package/dist/generated/assets/i18n/messagebundle_cy.json +1 -0
  91. package/dist/generated/assets/i18n/messagebundle_da.json +1 -0
  92. package/dist/generated/assets/i18n/messagebundle_de.json +1 -0
  93. package/dist/generated/assets/i18n/messagebundle_el.json +1 -0
  94. package/dist/generated/assets/i18n/messagebundle_en.json +1 -0
  95. package/dist/generated/assets/i18n/messagebundle_en_GB.json +1 -0
  96. package/dist/generated/assets/i18n/messagebundle_en_US_sappsd.json +1 -0
  97. package/dist/generated/assets/i18n/messagebundle_en_US_saprigi.json +1 -0
  98. package/dist/generated/assets/i18n/messagebundle_en_US_saptrc.json +1 -0
  99. package/dist/generated/assets/i18n/messagebundle_es.json +1 -0
  100. package/dist/generated/assets/i18n/messagebundle_es_MX.json +1 -0
  101. package/dist/generated/assets/i18n/messagebundle_et.json +1 -0
  102. package/dist/generated/assets/i18n/messagebundle_fi.json +1 -0
  103. package/dist/generated/assets/i18n/messagebundle_fr.json +1 -0
  104. package/dist/generated/assets/i18n/messagebundle_fr_CA.json +1 -0
  105. package/dist/generated/assets/i18n/messagebundle_hi.json +1 -0
  106. package/dist/generated/assets/i18n/messagebundle_hr.json +1 -0
  107. package/dist/generated/assets/i18n/messagebundle_hu.json +1 -0
  108. package/dist/generated/assets/i18n/messagebundle_id.json +1 -0
  109. package/dist/generated/assets/i18n/messagebundle_it.json +1 -0
  110. package/dist/generated/assets/i18n/messagebundle_iw.json +1 -0
  111. package/dist/generated/assets/i18n/messagebundle_ja.json +1 -0
  112. package/dist/generated/assets/i18n/messagebundle_kk.json +1 -0
  113. package/dist/generated/assets/i18n/messagebundle_ko.json +1 -0
  114. package/dist/generated/assets/i18n/messagebundle_lt.json +1 -0
  115. package/dist/generated/assets/i18n/messagebundle_lv.json +1 -0
  116. package/dist/generated/assets/i18n/messagebundle_mk.json +1 -0
  117. package/dist/generated/assets/i18n/messagebundle_ms.json +1 -0
  118. package/dist/generated/assets/i18n/messagebundle_nl.json +1 -0
  119. package/dist/generated/assets/i18n/messagebundle_no.json +1 -0
  120. package/dist/generated/assets/i18n/messagebundle_pl.json +1 -0
  121. package/dist/generated/assets/i18n/messagebundle_pt.json +1 -0
  122. package/dist/generated/assets/i18n/messagebundle_pt_PT.json +1 -0
  123. package/dist/generated/assets/i18n/messagebundle_ro.json +1 -0
  124. package/dist/generated/assets/i18n/messagebundle_ru.json +1 -0
  125. package/dist/generated/assets/i18n/messagebundle_sh.json +1 -0
  126. package/dist/generated/assets/i18n/messagebundle_sk.json +1 -0
  127. package/dist/generated/assets/i18n/messagebundle_sl.json +1 -0
  128. package/dist/generated/assets/i18n/messagebundle_sr.json +1 -0
  129. package/dist/generated/assets/i18n/messagebundle_sv.json +1 -0
  130. package/dist/generated/assets/i18n/messagebundle_th.json +1 -0
  131. package/dist/generated/assets/i18n/messagebundle_tr.json +1 -0
  132. package/dist/generated/assets/i18n/messagebundle_uk.json +1 -0
  133. package/dist/generated/assets/i18n/messagebundle_vi.json +1 -0
  134. package/dist/generated/assets/i18n/messagebundle_zh_CN.json +1 -0
  135. package/dist/generated/assets/i18n/messagebundle_zh_TW.json +1 -0
  136. package/dist/generated/assets/themes/sap_horizon/parameters-bundle.css.json +1 -0
  137. package/dist/generated/assets/themes/sap_horizon_dark/parameters-bundle.css.json +1 -0
  138. package/dist/generated/assets/themes/sap_horizon_hcb/parameters-bundle.css.json +1 -0
  139. package/dist/generated/assets/themes/sap_horizon_hcw/parameters-bundle.css.json +1 -0
  140. package/dist/generated/i18n/i18n-defaults.d.ts +18 -0
  141. package/dist/generated/i18n/i18n-defaults.js +18 -0
  142. package/dist/generated/i18n/i18n-defaults.js.map +1 -0
  143. package/dist/generated/json-imports/Themes-fetch.d.ts +1 -0
  144. package/dist/generated/json-imports/Themes-fetch.js +21 -0
  145. package/dist/generated/json-imports/Themes-fetch.js.map +1 -0
  146. package/dist/generated/json-imports/Themes-node.d.ts +1 -0
  147. package/dist/generated/json-imports/Themes-node.js +21 -0
  148. package/dist/generated/json-imports/Themes-node.js.map +1 -0
  149. package/dist/generated/json-imports/Themes.d.ts +1 -0
  150. package/dist/generated/json-imports/Themes.js +21 -0
  151. package/dist/generated/json-imports/Themes.js.map +1 -0
  152. package/dist/generated/json-imports/i18n-fetch.d.ts +1 -0
  153. package/dist/generated/json-imports/i18n-fetch.js +120 -0
  154. package/dist/generated/json-imports/i18n-fetch.js.map +1 -0
  155. package/dist/generated/json-imports/i18n-node.d.ts +1 -0
  156. package/dist/generated/json-imports/i18n-node.js +120 -0
  157. package/dist/generated/json-imports/i18n-node.js.map +1 -0
  158. package/dist/generated/json-imports/i18n.d.ts +1 -0
  159. package/dist/generated/json-imports/i18n.js +120 -0
  160. package/dist/generated/json-imports/i18n.js.map +1 -0
  161. package/dist/generated/themes/Button.css.d.ts +2 -0
  162. package/dist/generated/themes/Button.css.js +8 -0
  163. package/dist/generated/themes/Button.css.js.map +1 -0
  164. package/dist/generated/themes/Input.css.d.ts +2 -0
  165. package/dist/generated/themes/Input.css.js +8 -0
  166. package/dist/generated/themes/Input.css.js.map +1 -0
  167. package/dist/generated/themes/PromptInput.css.d.ts +2 -0
  168. package/dist/generated/themes/PromptInput.css.js +8 -0
  169. package/dist/generated/themes/PromptInput.css.js.map +1 -0
  170. package/dist/generated/themes/TextArea.css.d.ts +2 -0
  171. package/dist/generated/themes/TextArea.css.js +8 -0
  172. package/dist/generated/themes/TextArea.css.js.map +1 -0
  173. package/dist/generated/themes/Versioning.css.d.ts +2 -0
  174. package/dist/generated/themes/Versioning.css.js +8 -0
  175. package/dist/generated/themes/Versioning.css.js.map +1 -0
  176. package/dist/generated/themes/WritingAssistant.css.d.ts +2 -0
  177. package/dist/generated/themes/WritingAssistant.css.js +8 -0
  178. package/dist/generated/themes/WritingAssistant.css.js.map +1 -0
  179. package/dist/generated/themes/sap_horizon/parameters-bundle.css.d.ts +2 -0
  180. package/dist/generated/themes/sap_horizon/parameters-bundle.css.js +2 -0
  181. package/dist/generated/themes/sap_horizon/parameters-bundle.css.js.map +1 -0
  182. package/dist/generated/themes/sap_horizon_dark/parameters-bundle.css.d.ts +2 -0
  183. package/dist/generated/themes/sap_horizon_dark/parameters-bundle.css.js +2 -0
  184. package/dist/generated/themes/sap_horizon_dark/parameters-bundle.css.js.map +1 -0
  185. package/dist/generated/themes/sap_horizon_hcb/parameters-bundle.css.d.ts +2 -0
  186. package/dist/generated/themes/sap_horizon_hcb/parameters-bundle.css.js +2 -0
  187. package/dist/generated/themes/sap_horizon_hcb/parameters-bundle.css.js.map +1 -0
  188. package/dist/generated/themes/sap_horizon_hcw/parameters-bundle.css.d.ts +2 -0
  189. package/dist/generated/themes/sap_horizon_hcw/parameters-bundle.css.js +2 -0
  190. package/dist/generated/themes/sap_horizon_hcw/parameters-bundle.css.js.map +1 -0
  191. package/dist/vscode.html-custom-data.json +188 -0
  192. package/dist/web-types.json +488 -0
  193. package/jsconfig.json +11 -0
  194. package/package-scripts.cjs +19 -0
  195. package/package.json +62 -0
  196. package/src/ButtonTemplate.tsx +27 -0
  197. package/src/InputTemplate.tsx +197 -0
  198. package/src/PromptInputTemplate.tsx +49 -0
  199. package/src/TextArea.css +25 -0
  200. package/src/TextAreaTemplate.tsx +91 -0
  201. package/src/ToolbarLabelTemplate.tsx +9 -0
  202. package/src/VersioningTemplate.tsx +34 -0
  203. package/src/WritingAssistantTemplate.tsx +51 -0
  204. package/src/i18n/messagebundle.properties +50 -0
  205. package/src/i18n/messagebundle_ar.properties +32 -0
  206. package/src/i18n/messagebundle_bg.properties +32 -0
  207. package/src/i18n/messagebundle_ca.properties +32 -0
  208. package/src/i18n/messagebundle_cnr.properties +32 -0
  209. package/src/i18n/messagebundle_cs.properties +32 -0
  210. package/src/i18n/messagebundle_cy.properties +32 -0
  211. package/src/i18n/messagebundle_da.properties +32 -0
  212. package/src/i18n/messagebundle_de.properties +32 -0
  213. package/src/i18n/messagebundle_el.properties +32 -0
  214. package/src/i18n/messagebundle_en.properties +32 -0
  215. package/src/i18n/messagebundle_en_GB.properties +32 -0
  216. package/src/i18n/messagebundle_en_US_sappsd.properties +32 -0
  217. package/src/i18n/messagebundle_en_US_saprigi.properties +32 -0
  218. package/src/i18n/messagebundle_en_US_saptrc.properties +32 -0
  219. package/src/i18n/messagebundle_es.properties +32 -0
  220. package/src/i18n/messagebundle_es_MX.properties +32 -0
  221. package/src/i18n/messagebundle_et.properties +32 -0
  222. package/src/i18n/messagebundle_fi.properties +32 -0
  223. package/src/i18n/messagebundle_fr.properties +32 -0
  224. package/src/i18n/messagebundle_fr_CA.properties +32 -0
  225. package/src/i18n/messagebundle_hi.properties +32 -0
  226. package/src/i18n/messagebundle_hr.properties +32 -0
  227. package/src/i18n/messagebundle_hu.properties +32 -0
  228. package/src/i18n/messagebundle_id.properties +32 -0
  229. package/src/i18n/messagebundle_it.properties +32 -0
  230. package/src/i18n/messagebundle_iw.properties +32 -0
  231. package/src/i18n/messagebundle_ja.properties +32 -0
  232. package/src/i18n/messagebundle_kk.properties +32 -0
  233. package/src/i18n/messagebundle_ko.properties +32 -0
  234. package/src/i18n/messagebundle_lt.properties +32 -0
  235. package/src/i18n/messagebundle_lv.properties +32 -0
  236. package/src/i18n/messagebundle_mk.properties +32 -0
  237. package/src/i18n/messagebundle_ms.properties +32 -0
  238. package/src/i18n/messagebundle_nl.properties +32 -0
  239. package/src/i18n/messagebundle_no.properties +32 -0
  240. package/src/i18n/messagebundle_pl.properties +32 -0
  241. package/src/i18n/messagebundle_pt.properties +32 -0
  242. package/src/i18n/messagebundle_pt_PT.properties +32 -0
  243. package/src/i18n/messagebundle_ro.properties +32 -0
  244. package/src/i18n/messagebundle_ru.properties +32 -0
  245. package/src/i18n/messagebundle_sh.properties +32 -0
  246. package/src/i18n/messagebundle_sk.properties +32 -0
  247. package/src/i18n/messagebundle_sl.properties +32 -0
  248. package/src/i18n/messagebundle_sr.properties +32 -0
  249. package/src/i18n/messagebundle_sv.properties +32 -0
  250. package/src/i18n/messagebundle_th.properties +32 -0
  251. package/src/i18n/messagebundle_tr.properties +32 -0
  252. package/src/i18n/messagebundle_uk.properties +32 -0
  253. package/src/i18n/messagebundle_vi.properties +32 -0
  254. package/src/i18n/messagebundle_zh_CN.properties +32 -0
  255. package/src/i18n/messagebundle_zh_TW.properties +32 -0
  256. package/src/themes/Button.css +142 -0
  257. package/src/themes/Input.css +83 -0
  258. package/src/themes/PromptInput.css +34 -0
  259. package/src/themes/TextArea.css +45 -0
  260. package/src/themes/Versioning.css +20 -0
  261. package/src/themes/WritingAssistant.css +23 -0
  262. package/src/themes/base/Button-parameters.css +2 -0
  263. package/src/themes/sap_horizon/parameters-bundle.css +1 -0
  264. package/src/themes/sap_horizon_dark/parameters-bundle.css +1 -0
  265. package/src/themes/sap_horizon_hcb/parameters-bundle.css +1 -0
  266. package/src/themes/sap_horizon_hcw/parameters-bundle.css +1 -0
  267. package/tsconfig.json +63 -0
@@ -0,0 +1,151 @@
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 } from "@ui5/webcomponents/dist/Input.js";
5
+ import type Input from "@ui5/webcomponents/dist/Input.js";
6
+ import type { UI5CustomEvent } from "@ui5/webcomponents-base/dist/index.js";
7
+ import type { Slot, DefaultSlot } from "@ui5/webcomponents-base/dist/UI5Element.js";
8
+ /**
9
+ * @class
10
+ * ### Overview
11
+ *
12
+ * 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.
13
+ *
14
+ * **Note:** The web component is in an experimental state
15
+ *
16
+ * ### ES6 Module Import
17
+ *
18
+ * `import "@ui5/webcomponents-ai/dist/PromptInput.js"`
19
+ * @class
20
+ * @constructor
21
+ * @public
22
+ * @extends UI5Element
23
+ * @experimental The **@ui5/webcomponents-ai** package is under development and considered experimental - components' APIs are subject to change.
24
+ * Furthermore, the package supports **Horizon** themes only.
25
+ */
26
+ declare class PromptInput extends UI5Element {
27
+ eventDetails: {
28
+ submit: void;
29
+ input: void;
30
+ change: void;
31
+ };
32
+ /**
33
+ * Defines the value of the component.
34
+ *
35
+ * @default ""
36
+ * @since 2.0.0
37
+ * @public
38
+ */
39
+ value: string;
40
+ /**
41
+ * Defines a short hint intended to aid the user with data entry when the
42
+ * component has no value.
43
+ * @default undefined
44
+ * @since 2.0.0
45
+ * @public
46
+ */
47
+ placeholder?: string;
48
+ /**
49
+ * Defines the label of the input field.
50
+ *
51
+ * @default undefined
52
+ * @since 2.0.0
53
+ * @public
54
+ */
55
+ label?: string;
56
+ /**
57
+ * Defines whether the clear icon of the input will be shown.
58
+ * @default false
59
+ * @public
60
+ * @since 2.0.0
61
+ */
62
+ showClearIcon: boolean;
63
+ /**
64
+ * Determines whether the characters exceeding the maximum allowed character count are visible
65
+ * in the component.
66
+ *
67
+ * If set to `false`, the user is not allowed to enter more characters than what is set in the
68
+ * `maxlength` property.
69
+ * If set to `true` the characters exceeding the `maxlength` value are selected on
70
+ * paste and the counter below the component displays their number.
71
+ * @default false
72
+ * @public
73
+ * @since 2.0.0
74
+ */
75
+ showExceededText: boolean;
76
+ /**
77
+ * Defines whether the component is in disabled state.
78
+ *
79
+ * **Note:** A disabled component is completely noninteractive.
80
+ * @default false
81
+ * @public
82
+ * @since 2.0.0
83
+ */
84
+ disabled: boolean;
85
+ /**
86
+ * Defines whether the component is read-only.
87
+ *
88
+ * **Note:** A read-only component is not editable,
89
+ * but still provides visual feedback upon user interaction.
90
+ * @default false
91
+ * @public
92
+ * @since 2.0.0
93
+ */
94
+ readonly: boolean;
95
+ /**
96
+ * Sets the maximum number of characters available in the input field.
97
+ *
98
+ * @default undefined
99
+ * @since 2.0.0
100
+ * @public
101
+ */
102
+ maxlength?: number;
103
+ /**
104
+ * Defines the value state of the component.
105
+ * @default "None"
106
+ * @since 2.0.0
107
+ * @public
108
+ */
109
+ valueState: `${ValueState}`;
110
+ /**
111
+ * Defines whether the component should show suggestions, if such are present.
112
+ *
113
+ * @default false
114
+ * @public
115
+ */
116
+ showSuggestions: boolean;
117
+ /**
118
+ * Defines the suggestion items.
119
+ *
120
+ * **Note:** The suggestions would be displayed only if the `showSuggestions`
121
+ * property is set to `true`.
122
+ *
123
+ * **Note:** The `<ui5-suggestion-item>`, `<ui5-suggestion-item-group>` and `ui5-suggestion-item-custom` are recommended to be used as suggestion items.
124
+ *
125
+ * @public
126
+ */
127
+ suggestionItems: DefaultSlot<IInputSuggestionItem>;
128
+ /**
129
+ * Defines the value state message that will be displayed as pop up under the component.
130
+ * The value state message slot should contain only one root element.
131
+ *
132
+ * **Note:** If not specified, a default text (in the respective language) will be displayed.
133
+ *
134
+ * **Note:** The `valueStateMessage` would be displayed,
135
+ * when the component is in `Information`, `Critical` or `Negative` value state.
136
+ *
137
+ * @since 2.0.0
138
+ * @public
139
+ */
140
+ valueStateMessage: Slot<HTMLElement>;
141
+ static i18nBundle: I18nBundle;
142
+ _onkeydown(e: KeyboardEvent): void;
143
+ _onInnerInput(e: UI5CustomEvent<Input, "input">): void;
144
+ _onInnerChange(): void;
145
+ _onButtonClick(): void;
146
+ _onTypeAhead(e: UI5CustomEvent<Input, "type-ahead">): void;
147
+ get _exceededText(): string | undefined;
148
+ get _maxLenght(): number | undefined;
149
+ get _submitButtonDisabled(): boolean;
150
+ }
151
+ export default PromptInput;
@@ -0,0 +1,226 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var PromptInput_1;
8
+ import UI5Element from "@ui5/webcomponents-base/dist/UI5Element.js";
9
+ import customElement from "@ui5/webcomponents-base/dist/decorators/customElement.js";
10
+ import property from "@ui5/webcomponents-base/dist/decorators/property.js";
11
+ import event from "@ui5/webcomponents-base/dist/decorators/event-strict.js";
12
+ import slot from "@ui5/webcomponents-base/dist/decorators/slot-strict.js";
13
+ import i18n from "@ui5/webcomponents-base/dist/decorators/i18n.js";
14
+ import jsxRenderer from "@ui5/webcomponents-base/dist/renderer/JsxRenderer.js";
15
+ import { isEnter, } from "@ui5/webcomponents-base/dist/Keys.js";
16
+ import { PROMPT_INPUT_CHARACTERS_LEFT, PROMPT_INPUT_CHARACTERS_EXCEEDED, } from "./generated/i18n/i18n-defaults.js";
17
+ import PromptInputTemplate from "./PromptInputTemplate.js";
18
+ // Styles
19
+ import PromptInputCss from "./generated/themes/PromptInput.css.js";
20
+ /**
21
+ * @class
22
+ * ### Overview
23
+ *
24
+ * 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.
25
+ *
26
+ * **Note:** The web component is in an experimental state
27
+ *
28
+ * ### ES6 Module Import
29
+ *
30
+ * `import "@ui5/webcomponents-ai/dist/PromptInput.js"`
31
+ * @class
32
+ * @constructor
33
+ * @public
34
+ * @extends UI5Element
35
+ * @experimental The **@ui5/webcomponents-ai** package is under development and considered experimental - components' APIs are subject to change.
36
+ * Furthermore, the package supports **Horizon** themes only.
37
+ */
38
+ let PromptInput = PromptInput_1 = class PromptInput extends UI5Element {
39
+ constructor() {
40
+ super(...arguments);
41
+ /**
42
+ * Defines the value of the component.
43
+ *
44
+ * @default ""
45
+ * @since 2.0.0
46
+ * @public
47
+ */
48
+ this.value = "";
49
+ /**
50
+ * Defines whether the clear icon of the input will be shown.
51
+ * @default false
52
+ * @public
53
+ * @since 2.0.0
54
+ */
55
+ this.showClearIcon = false;
56
+ /**
57
+ * Determines whether the characters exceeding the maximum allowed character count are visible
58
+ * in the component.
59
+ *
60
+ * If set to `false`, the user is not allowed to enter more characters than what is set in the
61
+ * `maxlength` property.
62
+ * If set to `true` the characters exceeding the `maxlength` value are selected on
63
+ * paste and the counter below the component displays their number.
64
+ * @default false
65
+ * @public
66
+ * @since 2.0.0
67
+ */
68
+ this.showExceededText = false;
69
+ /**
70
+ * Defines whether the component is in disabled state.
71
+ *
72
+ * **Note:** A disabled component is completely noninteractive.
73
+ * @default false
74
+ * @public
75
+ * @since 2.0.0
76
+ */
77
+ this.disabled = false;
78
+ /**
79
+ * Defines whether the component is read-only.
80
+ *
81
+ * **Note:** A read-only component is not editable,
82
+ * but still provides visual feedback upon user interaction.
83
+ * @default false
84
+ * @public
85
+ * @since 2.0.0
86
+ */
87
+ this.readonly = false;
88
+ /**
89
+ * Defines the value state of the component.
90
+ * @default "None"
91
+ * @since 2.0.0
92
+ * @public
93
+ */
94
+ this.valueState = "None";
95
+ /**
96
+ * Defines whether the component should show suggestions, if such are present.
97
+ *
98
+ * @default false
99
+ * @public
100
+ */
101
+ this.showSuggestions = false;
102
+ }
103
+ _onkeydown(e) {
104
+ if (isEnter(e)) {
105
+ this.fireDecoratorEvent("submit");
106
+ }
107
+ }
108
+ _onInnerInput(e) {
109
+ this.value = e.currentTarget.value;
110
+ this.fireDecoratorEvent("input");
111
+ }
112
+ _onInnerChange() {
113
+ this.fireDecoratorEvent("change");
114
+ }
115
+ _onButtonClick() {
116
+ this.fireDecoratorEvent("submit");
117
+ }
118
+ _onTypeAhead(e) {
119
+ this.value = e.currentTarget.value;
120
+ }
121
+ get _exceededText() {
122
+ if (this.showExceededText) {
123
+ let leftCharactersCount;
124
+ const maxLength = this.maxlength;
125
+ if (maxLength !== undefined) {
126
+ leftCharactersCount = maxLength - this.value.length;
127
+ if (leftCharactersCount >= 0) {
128
+ return PromptInput_1.i18nBundle.getText(PROMPT_INPUT_CHARACTERS_LEFT, leftCharactersCount);
129
+ }
130
+ return PromptInput_1.i18nBundle.getText(PROMPT_INPUT_CHARACTERS_EXCEEDED, Math.abs(leftCharactersCount));
131
+ }
132
+ }
133
+ }
134
+ get _maxLenght() {
135
+ return this.maxlength || undefined;
136
+ }
137
+ get _submitButtonDisabled() {
138
+ return (this.value.length <= 0) || this.disabled || this.readonly;
139
+ }
140
+ };
141
+ __decorate([
142
+ property()
143
+ ], PromptInput.prototype, "value", void 0);
144
+ __decorate([
145
+ property()
146
+ ], PromptInput.prototype, "placeholder", void 0);
147
+ __decorate([
148
+ property()
149
+ ], PromptInput.prototype, "label", void 0);
150
+ __decorate([
151
+ property({ type: Boolean })
152
+ ], PromptInput.prototype, "showClearIcon", void 0);
153
+ __decorate([
154
+ property({ type: Boolean })
155
+ ], PromptInput.prototype, "showExceededText", void 0);
156
+ __decorate([
157
+ property({ type: Boolean })
158
+ ], PromptInput.prototype, "disabled", void 0);
159
+ __decorate([
160
+ property({ type: Boolean })
161
+ ], PromptInput.prototype, "readonly", void 0);
162
+ __decorate([
163
+ property({ type: Number })
164
+ ], PromptInput.prototype, "maxlength", void 0);
165
+ __decorate([
166
+ property()
167
+ ], PromptInput.prototype, "valueState", void 0);
168
+ __decorate([
169
+ property({ type: Boolean })
170
+ ], PromptInput.prototype, "showSuggestions", void 0);
171
+ __decorate([
172
+ slot({ type: HTMLElement, "default": true })
173
+ ], PromptInput.prototype, "suggestionItems", void 0);
174
+ __decorate([
175
+ slot({
176
+ type: HTMLElement,
177
+ invalidateOnChildChange: true,
178
+ })
179
+ ], PromptInput.prototype, "valueStateMessage", void 0);
180
+ __decorate([
181
+ i18n("@ui5/webcomponents-ai")
182
+ ], PromptInput, "i18nBundle", void 0);
183
+ PromptInput = PromptInput_1 = __decorate([
184
+ customElement({
185
+ tag: "ui5-ai-prompt-input",
186
+ renderer: jsxRenderer,
187
+ styles: PromptInputCss,
188
+ template: PromptInputTemplate,
189
+ })
190
+ /**
191
+ * Fired when the input operation has finished by pressing Enter
192
+ * or AI button is clicked.
193
+ *
194
+ * @since 2.0.0
195
+ * @public
196
+ */
197
+ ,
198
+ event("submit", {
199
+ bubbles: true,
200
+ })
201
+ /**
202
+ * Fired when the value of the component changes at each keystroke,
203
+ * and when a suggestion item has been selected.
204
+ *
205
+ * @since 2.0.0
206
+ * @public
207
+ */
208
+ ,
209
+ event("input", {
210
+ bubbles: true,
211
+ })
212
+ /**
213
+ * Fired when the input operation has finished by pressing Enter
214
+ * or on focusout.
215
+ *
216
+ * @since 2.0.0
217
+ * @public
218
+ */
219
+ ,
220
+ event("change", {
221
+ bubbles: true,
222
+ })
223
+ ], PromptInput);
224
+ PromptInput.define();
225
+ export default PromptInput;
226
+ //# sourceMappingURL=PromptInput.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PromptInput.js","sourceRoot":"","sources":["../src/PromptInput.ts"],"names":[],"mappings":";;;;;;;AAAA,OAAO,UAAU,MAAM,4CAA4C,CAAC;AACpE,OAAO,aAAa,MAAM,0DAA0D,CAAC;AACrF,OAAO,QAAQ,MAAM,qDAAqD,CAAC;AAC3E,OAAO,KAAK,MAAM,yDAAyD,CAAC;AAC5E,OAAO,IAAI,MAAM,wDAAwD,CAAC;AAC1E,OAAO,IAAI,MAAM,iDAAiD,CAAC;AACnE,OAAO,WAAW,MAAM,sDAAsD,CAAC;AAK/E,OAAO,EACN,OAAO,GACP,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EACN,4BAA4B,EAC5B,gCAAgC,GAChC,MAAM,mCAAmC,CAAC;AAE3C,OAAO,mBAAmB,MAAM,0BAA0B,CAAC;AAE3D,SAAS;AACT,OAAO,cA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CAAC;QACL,IAAI,EAAE,WAAW;QACjB,uBAAuB,EAAE,IAAI;KAC7B,CAAC;sDACoC;AAG/B;IADN,IAAI,CAAC,uBAAuB,CAAC;qCACA;AA/IzB,WAAW;IAvChB,aAAa,CAAC;QACd,GAAG,EAAE,qBAAqB;QAC1B,QAAQ,EAAE,WAAW;QACrB,MAAM,EAAE,cAAc;QACtB,QAAQ,EAAE,mBAAmB;KAC7B,CAAC;IAEF;;;;;;OAMG;;IACF,KAAK,CAAC,QAAQ,EAAE;QAChB,OAAO,EAAE,IAAI;KACb,CAAC;IAEF;;;;;;OAMG;;IACF,KAAK,CAAC,OAAO,EAAE;QACf,OAAO,EAAE,IAAI;KACb,CAAC;IAEF;;;;;;OAMG;;IACF,KAAK,CAAC,QAAQ,EAAE;QAChB,OAAO,EAAE,IAAI;KACb,CAAC;GACI,WAAW,CAiMhB;AAED,WAAW,CAAC,MAAM,EAAE,CAAC;AAErB,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\";\nimport event from \"@ui5/webcomponents-base/dist/decorators/event-strict.js\";\nimport slot from \"@ui5/webcomponents-base/dist/decorators/slot-strict.js\";\nimport i18n from \"@ui5/webcomponents-base/dist/decorators/i18n.js\";\nimport jsxRenderer from \"@ui5/webcomponents-base/dist/renderer/JsxRenderer.js\";\nimport type I18nBundle from \"@ui5/webcomponents-base/dist/i18nBundle.js\";\nimport type ValueState from \"@ui5/webcomponents-base/dist/types/ValueState.js\";\nimport type { IInputSuggestionItem } from \"@ui5/webcomponents/dist/Input.js\";\nimport type Input from \"@ui5/webcomponents/dist/Input.js\";\nimport {\n\tisEnter,\n} from \"@ui5/webcomponents-base/dist/Keys.js\";\nimport {\n\tPROMPT_INPUT_CHARACTERS_LEFT,\n\tPROMPT_INPUT_CHARACTERS_EXCEEDED,\n} from \"./generated/i18n/i18n-defaults.js\";\n\nimport PromptInputTemplate from \"./PromptInputTemplate.js\";\n\n// Styles\nimport PromptInputCss from \"./generated/themes/PromptInput.css.js\";\nimport type { UI5CustomEvent } from \"@ui5/webcomponents-base/dist/index.js\";\nimport type { Slot, DefaultSlot } from \"@ui5/webcomponents-base/dist/UI5Element.js\";\n\n/**\n * @class\n * ### Overview\n *\n * 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.\n *\n * **Note:** The web component is in an experimental state\n *\n * ### ES6 Module Import\n *\n * `import \"@ui5/webcomponents-ai/dist/PromptInput.js\"`\n * @class\n * @constructor\n * @public\n * @extends UI5Element\n * @experimental The **@ui5/webcomponents-ai** package is under development and considered experimental - components' APIs are subject to change.\n * Furthermore, the package supports **Horizon** themes only.\n */\n@customElement({\n\ttag: \"ui5-ai-prompt-input\",\n\trenderer: jsxRenderer,\n\tstyles: PromptInputCss,\n\ttemplate: PromptInputTemplate,\n})\n\n/**\n * Fired when the input operation has finished by pressing Enter\n * or AI button is clicked.\n *\n * @since 2.0.0\n * @public\n */\n@event(\"submit\", {\n\tbubbles: true,\n})\n\n/**\n * Fired when the value of the component changes at each keystroke,\n * and when a suggestion item has been selected.\n *\n * @since 2.0.0\n * @public\n */\n@event(\"input\", {\n\tbubbles: true,\n})\n\n/**\n * Fired when the input operation has finished by pressing Enter\n * or on focusout.\n *\n * @since 2.0.0\n * @public\n */\n@event(\"change\", {\n\tbubbles: true,\n})\nclass PromptInput extends UI5Element {\n\teventDetails!: {\n\t\tsubmit: void;\n\t\tinput: void;\n\t\tchange: void;\n\t}\n\t/**\n\t * Defines the value of the component.\n\t *\n\t * @default \"\"\n\t * @since 2.0.0\n\t * @public\n\t */\n\t@property()\n\tvalue = \"\";\n\n\t/**\n\t * Defines a short hint intended to aid the user with data entry when the\n\t * component has no value.\n\t * @default undefined\n\t * @since 2.0.0\n\t * @public\n\t */\n\t@property()\n\tplaceholder?: string;\n\n\t/**\n\t * Defines the label of the input field.\n\t *\n\t * @default undefined\n\t * @since 2.0.0\n\t * @public\n\t */\n\t@property()\n\tlabel?: string;\n\n\t/**\n\t * Defines whether the clear icon of the input will be shown.\n\t * @default false\n\t * @public\n\t * @since 2.0.0\n\t */\n\t@property({ type: Boolean })\n\tshowClearIcon = false;\n\n\t/**\n\t * Determines whether the characters exceeding the maximum allowed character count are visible\n\t * in the component.\n\t *\n\t * If set to `false`, the user is not allowed to enter more characters than what is set in the\n\t * `maxlength` property.\n\t * If set to `true` the characters exceeding the `maxlength` value are selected on\n\t * paste and the counter below the component displays their number.\n\t * @default false\n\t * @public\n\t * @since 2.0.0\n\t */\n\t@property({ type: Boolean })\n\tshowExceededText = false;\n\n\t/**\n\t * Defines whether the component is in disabled state.\n\t *\n\t * **Note:** A disabled component is completely noninteractive.\n\t * @default false\n\t * @public\n\t * @since 2.0.0\n\t */\n\t@property({ type: Boolean })\n\tdisabled = false;\n\n\t/**\n\t * Defines whether the component is read-only.\n\t *\n\t * **Note:** A read-only component is not editable,\n\t * but still provides visual feedback upon user interaction.\n\t * @default false\n\t * @public\n\t * @since 2.0.0\n\t */\n\t@property({ type: Boolean })\n\treadonly = false;\n\n\t/**\n\t * Sets the maximum number of characters available in the input field.\n\t *\n\t * @default undefined\n\t * @since 2.0.0\n\t * @public\n\t */\n\t@property({ type: Number })\n\tmaxlength?: number;\n\n\t/**\n\t * Defines the value state of the component.\n\t * @default \"None\"\n\t * @since 2.0.0\n\t * @public\n\t */\n\t@property()\n\tvalueState: `${ValueState}` = \"None\"\n\n\t/**\n\t * Defines whether the component should show suggestions, if such are present.\n\t *\n\t * @default false\n\t * @public\n\t */\n\t@property({ type: Boolean })\n\tshowSuggestions = false;\n\n\t/**\n\t * Defines the suggestion items.\n\t *\n\t * **Note:** The suggestions would be displayed only if the `showSuggestions`\n\t * property is set to `true`.\n\t *\n\t * **Note:** The `<ui5-suggestion-item>`, `<ui5-suggestion-item-group>` and `ui5-suggestion-item-custom` are recommended to be used as suggestion items.\n\t *\n\t * @public\n\t */\n\t\t@slot({ type: HTMLElement, \"default\": true })\n\t\tsuggestionItems!: DefaultSlot<IInputSuggestionItem>;\n\n\t/**\n\t * Defines the value state message that will be displayed as pop up under the component.\n\t * The value state message slot should contain only one root element.\n\t *\n\t * **Note:** If not specified, a default text (in the respective language) will be displayed.\n\t *\n\t * **Note:** The `valueStateMessage` would be displayed,\n\t * when the component is in `Information`, `Critical` or `Negative` value state.\n\t *\n\t * @since 2.0.0\n\t * @public\n\t */\n\t@slot({\n\t\ttype: HTMLElement,\n\t\tinvalidateOnChildChange: true,\n\t})\n\tvalueStateMessage!: Slot<HTMLElement>;\n\n\t@i18n(\"@ui5/webcomponents-ai\")\n\tstatic i18nBundle: I18nBundle;\n\n\t_onkeydown(e: KeyboardEvent) {\n\t\tif (isEnter(e)) {\n\t\t\tthis.fireDecoratorEvent(\"submit\");\n\t\t}\n\t}\n\n\t_onInnerInput(e: UI5CustomEvent<Input, \"input\">) {\n\t\tthis.value = e.currentTarget.value;\n\n\t\tthis.fireDecoratorEvent(\"input\");\n\t}\n\n\t_onInnerChange() {\n\t\tthis.fireDecoratorEvent(\"change\");\n\t}\n\n\t_onButtonClick() {\n\t\tthis.fireDecoratorEvent(\"submit\");\n\t}\n\n\t_onTypeAhead(e: UI5CustomEvent<Input, \"type-ahead\">): void {\n\t\tthis.value = e.currentTarget.value;\n\t}\n\n\tget _exceededText() {\n\t\tif (this.showExceededText) {\n\t\t\tlet leftCharactersCount;\n\t\t\tconst maxLength = this.maxlength;\n\n\t\t\tif (maxLength !== undefined) {\n\t\t\t\tleftCharactersCount = maxLength - this.value.length;\n\n\t\t\t\tif (leftCharactersCount >= 0) {\n\t\t\t\t\treturn PromptInput.i18nBundle.getText(PROMPT_INPUT_CHARACTERS_LEFT, leftCharactersCount);\n\t\t\t\t}\n\n\t\t\t\treturn PromptInput.i18nBundle.getText(PROMPT_INPUT_CHARACTERS_EXCEEDED, Math.abs(leftCharactersCount));\n\t\t\t}\n\t\t}\n\t}\n\n\tget _maxLenght() {\n\t\treturn this.maxlength || undefined;\n\t}\n\n\tget _submitButtonDisabled() {\n\t\treturn (this.value.length <= 0) || this.disabled || this.readonly;\n\t}\n}\n\nPromptInput.define();\n\nexport default PromptInput;\n"]}
@@ -0,0 +1,2 @@
1
+ import type PromptInput from "./PromptInput.js";
2
+ export default function PromptInputTemplate(this: PromptInput): import("@ui5/webcomponents-base/jsx-runtime").JSX.Element;
@@ -0,0 +1,12 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "@ui5/webcomponents-base/jsx-runtime";
2
+ import Label from "@ui5/webcomponents/dist/Label.js";
3
+ import Input from "@ui5/webcomponents/dist/Input.js";
4
+ import Button from "@ui5/webcomponents/dist/Button.js";
5
+ import paperPlane from "@ui5/webcomponents-icons/dist/paper-plane.js";
6
+ export default function PromptInputTemplate() {
7
+ return (_jsxs("div", { class: "ai-prompt-input-wrapper", children: [this.label &&
8
+ _jsx(Label, { for: "input", children: this.label }), _jsxs("div", { class: "ai-prompt-input-form-wrapper", children: [_jsxs("div", { class: "ai-prompt-inner-input-wrapper", children: [_jsxs(Input, { id: "input", value: this.value, placeholder: this.placeholder, valueState: this.valueState, showClearIcon: this.showClearIcon, disabled: this.disabled, readonly: this.readonly, showSuggestions: this.showSuggestions, onKeyDown: this._onkeydown, onInput: this._onInnerInput, onChange: this._onInnerChange, onTypeAhead: this._onTypeAhead, children: [_jsx("slot", {}), this.valueStateMessage.length > 0 &&
9
+ _jsx("slot", { name: "valueStateMessage", slot: "valueStateMessage" })] }), this.showExceededText &&
10
+ _jsx(Label, { class: "ai-prompt-input-counter", children: this._exceededText })] }), _jsx(Button, { icon: paperPlane, disabled: this._submitButtonDisabled, class: "ai-prompt-input-button", design: "Emphasized", onClick: this._onButtonClick })] })] }));
11
+ }
12
+ //# sourceMappingURL=PromptInputTemplate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PromptInputTemplate.js","sourceRoot":"","sources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wBAAwB,EAC9B,MAAM,EAAC,YAAY,EACnB,OAAO,EAAE,IAAI,CAAC,cAAc,GACpB,IACJ,IACD,CAAC,CAAC;AACV,CAAC","sourcesContent":["import type PromptInput from \"./PromptInput.js\";\nimport Label from \"@ui5/webcomponents/dist/Label.js\";\nimport Input from \"@ui5/webcomponents/dist/Input.js\";\nimport Button from \"@ui5/webcomponents/dist/Button.js\";\nimport paperPlane from \"@ui5/webcomponents-icons/dist/paper-plane.js\";\n\nexport default function PromptInputTemplate(this: PromptInput) {\n\treturn (\n\t\t<div class=\"ai-prompt-input-wrapper\">\n\t\t\t{this.label &&\n\t\t\t\t<Label for=\"input\">{this.label}</Label>\n\t\t\t}\n\n\t\t\t<div class=\"ai-prompt-input-form-wrapper\">\n\t\t\t\t<div class=\"ai-prompt-inner-input-wrapper\">\n\t\t\t\t\t<Input\n\t\t\t\t\t\tid=\"input\"\n\t\t\t\t\t\tvalue={this.value}\n\t\t\t\t\t\tplaceholder={this.placeholder}\n\t\t\t\t\t\tvalueState={this.valueState}\n\t\t\t\t\t\tshowClearIcon={this.showClearIcon}\n\t\t\t\t\t\tdisabled={this.disabled}\n\t\t\t\t\t\treadonly={this.readonly}\n\t\t\t\t\t\tshowSuggestions={this.showSuggestions}\n\t\t\t\t\t\tonKeyDown={this._onkeydown}\n\t\t\t\t\t\tonInput={this._onInnerInput}\n\t\t\t\t\t\tonChange={this._onInnerChange}\n\t\t\t\t\t\tonTypeAhead={this._onTypeAhead}\n\t\t\t\t\t>\n\t\t\t\t\t\t<slot></slot>\n\t\t\t\t\t\t{this.valueStateMessage.length > 0 &&\n\t\t\t\t\t\t\t<slot name=\"valueStateMessage\" slot=\"valueStateMessage\"></slot>\n\t\t\t\t\t\t}\n\t\t\t\t\t</Input>\n\n\t\t\t\t\t{this.showExceededText &&\n\t\t\t\t\t\t<Label class=\"ai-prompt-input-counter\">{this._exceededText}</Label>\n\t\t\t\t\t}\n\t\t\t\t</div>\n\t\t\t\t<Button\n\t\t\t\t\ticon={paperPlane}\n\t\t\t\t\tdisabled={this._submitButtonDisabled}\n\t\t\t\t\tclass=\"ai-prompt-input-button\"\n\t\t\t\t\tdesign=\"Emphasized\"\n\t\t\t\t\tonClick={this._onButtonClick}>\n\t\t\t\t</Button>\n\t\t\t</div>\n\t\t</div>);\n}\n"]}
@@ -0,0 +1,125 @@
1
+ import { BaseTextArea } from "@ui5/webcomponents/dist/TextArea.js";
2
+ import type I18nBundle from "@ui5/webcomponents-base/dist/i18nBundle.js";
3
+ import type { Slot } from "@ui5/webcomponents-base/dist/UI5Element.js";
4
+ type TextAreaVersionChangeEventDetail = {
5
+ backwards: boolean;
6
+ };
7
+ /**
8
+ * @class
9
+ *
10
+ * ### Overview
11
+ *
12
+ * The `ui5-ai-textarea` component extends the standard TextArea with Writing Assistant capabilities.
13
+ * It provides AI-powered text generation, editing suggestions, and version management functionality.
14
+ *
15
+ * ### Structure
16
+ * The `ui5-ai-textarea` consists of the following elements:
17
+ * - TextArea: The main text input area with all standard textarea functionality
18
+ * - WritingAssistant: Dedicated toolbar containing:
19
+ * - Versioning: A component with left/right navigation buttons and a label for browsing AI-generated versions
20
+ * - AI Button: Opens a menu that can be extended with custom AI generation options through slotting
21
+ *
22
+ * ### ES6 Module Import
23
+ *
24
+ * `import "@ui5/webcomponents-ai/dist/TextArea.js";`
25
+ *
26
+ * @constructor
27
+ * @extends BaseTextArea
28
+ * @experimental The **@ui5/webcomponents-ai** package is under development and considered experimental - components' APIs are subject to change.
29
+ * Furthermore, the package supports **Horizon** themes only.
30
+ * @since 2.16.0
31
+ * @public
32
+ * @slot {HTMLElement} menu Defines a slot for `ui5-menu` integration. This slot allows you to pass a `ui5-menu` instance that will be associated with the assistant.
33
+ */
34
+ declare class TextArea extends BaseTextArea {
35
+ eventDetails: BaseTextArea["eventDetails"] & {
36
+ "version-change": TextAreaVersionChangeEventDetail;
37
+ "stop-generation": void;
38
+ };
39
+ private _keydownHandler?;
40
+ private _menuFocusinHandler?;
41
+ private _menuFocusoutHandler?;
42
+ /**
43
+ * Defines whether the `ui5-ai-textarea` is currently in a loading(processing) state.
44
+ *
45
+ * @default false
46
+ * @public
47
+ */
48
+ loading: boolean;
49
+ /**
50
+ * Defines the prompt description of the current action.
51
+ *
52
+ * @default ""
53
+ * @public
54
+ */
55
+ promptDescription: string;
56
+ /**
57
+ * Indicates the index of the currently displayed version.
58
+ *
59
+ *
60
+ * @default 0
61
+ * @public
62
+ */
63
+ currentVersion: number;
64
+ /**
65
+ * Indicates the total number of result versions available.
66
+ *
67
+ * Notes:
68
+ * Versioning is hidden if the value is `0`
69
+ *
70
+ * @default 0
71
+ * @public
72
+ */
73
+ totalVersions: number;
74
+ focused: boolean;
75
+ menu: Slot<HTMLElement>;
76
+ static i18nBundle: I18nBundle;
77
+ static onDefine(): Promise<void>;
78
+ /**
79
+ * Handles the click event for the "Previous Version" button.
80
+ * Updates the current version index and syncs content.
81
+ */
82
+ _handlePreviousVersionClick(): void;
83
+ /**
84
+ * Handles the click event for the "Next Version" button.
85
+ * Updates the current version index and syncs content.
86
+ */
87
+ _handleNextVersionClick(): void;
88
+ /**
89
+ * Handles the version change event from the writing assistant.
90
+ */
91
+ _handleVersionChange(e: CustomEvent<{
92
+ backwards: boolean;
93
+ }>): void;
94
+ /**
95
+ * Handles keydown events for keyboard shortcuts.
96
+ * @private
97
+ */
98
+ _handleKeydown(keyboardEvent: KeyboardEvent): void;
99
+ /**
100
+ * Overrides the parent's onAfterRendering to add keydown handler.
101
+ * @private
102
+ */
103
+ onAfterRendering(): void;
104
+ _onfocusin(): void;
105
+ _onfocusout(e: FocusEvent): void;
106
+ /**
107
+ * Handles the generate click event from the AI toolbar.
108
+ * Opens the AI menu and sets the opener element.
109
+ *
110
+ * @private
111
+ */
112
+ _handleAIButtonClick: (e: CustomEvent<{
113
+ clickTarget?: HTMLElement;
114
+ }>) => void;
115
+ get _ariaLabel(): string;
116
+ /**
117
+ * Handles the stop generation event from the AI toolbar.
118
+ * Fires the stop-generation event to notify listeners.
119
+ *
120
+ * @private
121
+ */
122
+ handleStopGeneration: () => void;
123
+ }
124
+ export type { TextAreaVersionChangeEventDetail };
125
+ export default TextArea;