@ui5/webcomponents-ai 2.0.0-rc.6 → 2.0.1

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 (125) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/README.md +1 -4
  3. package/dist/Button.d.ts +76 -6
  4. package/dist/Button.js +170 -14
  5. package/dist/Button.js.map +1 -1
  6. package/dist/ButtonState.d.ts +60 -0
  7. package/dist/ButtonState.js +51 -0
  8. package/dist/ButtonState.js.map +1 -0
  9. package/dist/PromptInput.d.ts +6 -5
  10. package/dist/PromptInput.js +57 -4
  11. package/dist/PromptInput.js.map +1 -1
  12. package/dist/bundle.esm.js +1 -0
  13. package/dist/bundle.esm.js.map +1 -1
  14. package/dist/css/themes/Button.css +1 -0
  15. package/dist/custom-elements-internal.json +220 -19
  16. package/dist/custom-elements.json +193 -17
  17. package/dist/generated/assets/i18n/messagebundle_ar.json +1 -0
  18. package/dist/generated/assets/i18n/messagebundle_bg.json +1 -0
  19. package/dist/generated/assets/i18n/messagebundle_ca.json +1 -0
  20. package/dist/generated/assets/i18n/messagebundle_cnr.json +1 -0
  21. package/dist/generated/assets/i18n/messagebundle_cs.json +1 -0
  22. package/dist/generated/assets/i18n/messagebundle_cy.json +1 -0
  23. package/dist/generated/assets/i18n/messagebundle_da.json +1 -0
  24. package/dist/generated/assets/i18n/messagebundle_de.json +1 -0
  25. package/dist/generated/assets/i18n/messagebundle_el.json +1 -0
  26. package/dist/generated/assets/i18n/messagebundle_en.json +1 -0
  27. package/dist/generated/assets/i18n/messagebundle_en_GB.json +1 -0
  28. package/dist/generated/assets/i18n/messagebundle_en_US_saprigi.json +1 -0
  29. package/dist/generated/assets/i18n/messagebundle_es.json +1 -0
  30. package/dist/generated/assets/i18n/messagebundle_es_MX.json +1 -0
  31. package/dist/generated/assets/i18n/messagebundle_et.json +1 -0
  32. package/dist/generated/assets/i18n/messagebundle_fi.json +1 -0
  33. package/dist/generated/assets/i18n/messagebundle_fr.json +1 -0
  34. package/dist/generated/assets/i18n/messagebundle_fr_CA.json +1 -0
  35. package/dist/generated/assets/i18n/messagebundle_hi.json +1 -0
  36. package/dist/generated/assets/i18n/messagebundle_hr.json +1 -0
  37. package/dist/generated/assets/i18n/messagebundle_hu.json +1 -0
  38. package/dist/generated/assets/i18n/messagebundle_it.json +1 -0
  39. package/dist/generated/assets/i18n/messagebundle_iw.json +1 -0
  40. package/dist/generated/assets/i18n/messagebundle_ja.json +1 -0
  41. package/dist/generated/assets/i18n/messagebundle_kk.json +1 -0
  42. package/dist/generated/assets/i18n/messagebundle_ko.json +1 -0
  43. package/dist/generated/assets/i18n/messagebundle_lt.json +1 -0
  44. package/dist/generated/assets/i18n/messagebundle_lv.json +1 -0
  45. package/dist/generated/assets/i18n/messagebundle_mk.json +1 -0
  46. package/dist/generated/assets/i18n/messagebundle_ms.json +1 -0
  47. package/dist/generated/assets/i18n/messagebundle_nl.json +1 -0
  48. package/dist/generated/assets/i18n/messagebundle_no.json +1 -0
  49. package/dist/generated/assets/i18n/messagebundle_pl.json +1 -0
  50. package/dist/generated/assets/i18n/messagebundle_pt.json +1 -0
  51. package/dist/generated/assets/i18n/messagebundle_pt_PT.json +1 -0
  52. package/dist/generated/assets/i18n/messagebundle_ro.json +1 -0
  53. package/dist/generated/assets/i18n/messagebundle_ru.json +1 -0
  54. package/dist/generated/assets/i18n/messagebundle_sh.json +1 -0
  55. package/dist/generated/assets/i18n/messagebundle_sk.json +1 -0
  56. package/dist/generated/assets/i18n/messagebundle_sl.json +1 -0
  57. package/dist/generated/assets/i18n/messagebundle_sr.json +1 -0
  58. package/dist/generated/assets/i18n/messagebundle_sv.json +1 -0
  59. package/dist/generated/assets/i18n/messagebundle_th.json +1 -0
  60. package/dist/generated/assets/i18n/messagebundle_tr.json +1 -0
  61. package/dist/generated/assets/i18n/messagebundle_uk.json +1 -0
  62. package/dist/generated/assets/i18n/messagebundle_vi.json +1 -0
  63. package/dist/generated/assets/i18n/messagebundle_zh_CN.json +1 -0
  64. package/dist/generated/assets/i18n/messagebundle_zh_TW.json +1 -0
  65. package/dist/generated/json-imports/i18n.d.ts +1 -0
  66. package/dist/generated/json-imports/i18n.js +113 -1
  67. package/dist/generated/json-imports/i18n.js.map +1 -1
  68. package/dist/generated/templates/ButtonTemplate.lit.js +2 -1
  69. package/dist/generated/templates/ButtonTemplate.lit.js.map +1 -1
  70. package/dist/generated/themes/Button.css.js +2 -1
  71. package/dist/generated/themes/Button.css.js.map +1 -1
  72. package/dist/vscode.html-custom-data.json +47 -3
  73. package/dist/web-types.json +103 -9
  74. package/package.json +7 -7
  75. package/src/Button.hbs +17 -3
  76. package/src/i18n/messagebundle_ar.properties +4 -0
  77. package/src/i18n/messagebundle_bg.properties +4 -0
  78. package/src/i18n/messagebundle_ca.properties +4 -0
  79. package/src/i18n/messagebundle_cnr.properties +4 -0
  80. package/src/i18n/messagebundle_cs.properties +4 -0
  81. package/src/i18n/messagebundle_cy.properties +4 -0
  82. package/src/i18n/messagebundle_da.properties +4 -0
  83. package/src/i18n/messagebundle_de.properties +4 -0
  84. package/src/i18n/messagebundle_el.properties +4 -0
  85. package/src/i18n/messagebundle_en.properties +4 -0
  86. package/src/i18n/messagebundle_en_GB.properties +4 -0
  87. package/src/i18n/messagebundle_en_US_saprigi.properties +4 -0
  88. package/src/i18n/messagebundle_es.properties +4 -0
  89. package/src/i18n/messagebundle_es_MX.properties +4 -0
  90. package/src/i18n/messagebundle_et.properties +4 -0
  91. package/src/i18n/messagebundle_fi.properties +4 -0
  92. package/src/i18n/messagebundle_fr.properties +4 -0
  93. package/src/i18n/messagebundle_fr_CA.properties +4 -0
  94. package/src/i18n/messagebundle_hi.properties +4 -0
  95. package/src/i18n/messagebundle_hr.properties +4 -0
  96. package/src/i18n/messagebundle_hu.properties +4 -0
  97. package/src/i18n/messagebundle_id.properties +4 -0
  98. package/src/i18n/messagebundle_it.properties +4 -0
  99. package/src/i18n/messagebundle_iw.properties +4 -0
  100. package/src/i18n/messagebundle_ja.properties +4 -0
  101. package/src/i18n/messagebundle_kk.properties +4 -0
  102. package/src/i18n/messagebundle_ko.properties +4 -0
  103. package/src/i18n/messagebundle_lt.properties +4 -0
  104. package/src/i18n/messagebundle_lv.properties +4 -0
  105. package/src/i18n/messagebundle_mk.properties +4 -0
  106. package/src/i18n/messagebundle_ms.properties +4 -0
  107. package/src/i18n/messagebundle_nl.properties +4 -0
  108. package/src/i18n/messagebundle_no.properties +4 -0
  109. package/src/i18n/messagebundle_pl.properties +4 -0
  110. package/src/i18n/messagebundle_pt.properties +4 -0
  111. package/src/i18n/messagebundle_pt_PT.properties +4 -0
  112. package/src/i18n/messagebundle_ro.properties +4 -0
  113. package/src/i18n/messagebundle_ru.properties +4 -0
  114. package/src/i18n/messagebundle_sh.properties +4 -0
  115. package/src/i18n/messagebundle_sk.properties +4 -0
  116. package/src/i18n/messagebundle_sl.properties +4 -0
  117. package/src/i18n/messagebundle_sr.properties +4 -0
  118. package/src/i18n/messagebundle_sv.properties +4 -0
  119. package/src/i18n/messagebundle_th.properties +4 -0
  120. package/src/i18n/messagebundle_tr.properties +4 -0
  121. package/src/i18n/messagebundle_uk.properties +4 -0
  122. package/src/i18n/messagebundle_vi.properties +4 -0
  123. package/src/i18n/messagebundle_zh_CN.properties +4 -0
  124. package/src/i18n/messagebundle_zh_TW.properties +4 -0
  125. package/src/themes/Button.css +88 -0
package/CHANGELOG.md CHANGED
@@ -3,6 +3,31 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [2.0.1](https://github.com/SAP/ui5-webcomponents/compare/v2.0.0...v2.0.1) (2024-07-05)
7
+
8
+ **Note:** Version bump only for package @ui5/webcomponents-ai
9
+
10
+
11
+
12
+
13
+
14
+ # [2.0.0](https://github.com/SAP/ui5-webcomponents/compare/v2.0.0-rc.6...v2.0.0) (2024-07-03)
15
+
16
+
17
+ ### Features
18
+
19
+ * add property initializers ([#8846](https://github.com/SAP/ui5-webcomponents/issues/8846)) ([eef0cc9](https://github.com/SAP/ui5-webcomponents/commit/eef0cc9b663fda6268b98e516ed46439435fa2b0))
20
+ * **ui5-ai-button:** initial implementation ([b39548f](https://github.com/SAP/ui5-webcomponents/commit/b39548f7af9e0dd76543327d5bab5242d9ef15a0))
21
+
22
+
23
+ ### BREAKING CHANGES
24
+
25
+ * @property decorator must be adapted according to new type parameter
26
+
27
+
28
+
29
+
30
+
6
31
  # [2.0.0-rc.6](https://github.com/SAP/ui5-webcomponents/compare/v2.0.0-rc.5...v2.0.0-rc.6) (2024-06-17)
7
32
 
8
33
 
package/README.md CHANGED
@@ -1,7 +1,4 @@
1
- ![UI5 icon](https://raw.githubusercontent.com/SAP/ui5-webcomponents/main/docs/images/UI5_logo_wide.png)
2
-
3
-
4
- # UI5 Web Components - AI
1
+ # ![UI5 icon](https://raw.githubusercontent.com/SAP/ui5-webcomponents/main/docs/images/UI5_logo_water.png)UI5 Web Components - AI
5
2
 
6
3
  [![npm Package Version](https://badge.fury.io/js/%40ui5%2Fwebcomponents.svg)](https://www.npmjs.com/package/@ui5/webcomponents)
7
4
 
package/dist/Button.d.ts CHANGED
@@ -1,4 +1,6 @@
1
1
  import UI5Element from "@ui5/webcomponents-base/dist/UI5Element.js";
2
+ import type ButtonDesign from "@ui5/webcomponents/dist/types/ButtonDesign.js";
3
+ import ButtonState from "./ButtonState.js";
2
4
  /**
3
5
  * @class
4
6
  *
@@ -11,12 +13,11 @@ import UI5Element from "@ui5/webcomponents-base/dist/UI5Element.js";
11
13
  * ### Usage
12
14
  *
13
15
  * For the `ui5-ai-button` UI, you can define one or more states of the button by placing `ai-button-state` components in its default slot.
14
- * Each state have a key that identifies it and can have text, icon, end icon, next state and hasPopup type defined (in any combination) depending on the state purpose.
16
+ * Each state have a name that identifies it and can have text, icon and end icon defined (in any combination) depending on the state purpose.
15
17
  *
16
- * You can choose from a set of predefined designs that offer different styling to correspond to the triggered action.
18
+ * You can choose from a set of predefined designs (the same as for regular `ui5-button` component) that allow different styling to correspond to the triggered action.
17
19
  *
18
- * You can set the `ui5-ai-button` as enabled or disabled. An enabled `ui5-ai-button` can be pressed by clicking or tapping it. On press `ui5-ai-button` changes its state to the next one (if defined).
19
- * the mouse cursor. A disabled `ui5-ai-button` appears inactive and cannot be pressed.
20
+ * `ui5-ai-button` can be activated by clicking or tapping it. The state can be changed in `click` event handler.
20
21
  *
21
22
  * ### ES6 Module Import
22
23
  *
@@ -26,8 +27,15 @@ import UI5Element from "@ui5/webcomponents-base/dist/UI5Element.js";
26
27
  * @extends UI5Element
27
28
  * @since 2.0
28
29
  * @public
30
+ * @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.
29
31
  */
30
32
  declare class Button extends UI5Element {
33
+ /**
34
+ * Defines the component design.
35
+ * @default "Default"
36
+ * @public
37
+ */
38
+ design?: `${ButtonDesign}`;
31
39
  /**
32
40
  * Defines whether the component is disabled.
33
41
  * A disabled component can't be pressed or
@@ -36,7 +44,69 @@ declare class Button extends UI5Element {
36
44
  * @public
37
45
  */
38
46
  disabled: boolean;
39
- icon: string;
40
- endIcon: string;
47
+ /**
48
+ * Defines the current state of the component.
49
+ *
50
+ * @default undefined
51
+ * @public
52
+ */
53
+ state?: string;
54
+ /**
55
+ * Keeps the current state object of the component.
56
+ * @private
57
+ */
58
+ _currentStateObject?: ButtonState;
59
+ /**
60
+ * Initiates button elements fade-out phase.
61
+ * @default false
62
+ * @private
63
+ */
64
+ fadeOut: boolean;
65
+ /**
66
+ * Initiates button fade middle phase.
67
+ * @default false
68
+ * @private
69
+ */
70
+ fadeMid: boolean;
71
+ /**
72
+ * Initiates button elements fade-in phase.
73
+ * @default false
74
+ * @private
75
+ */
76
+ fadeIn: boolean;
77
+ /**
78
+ * Defines the available states of the component.
79
+ * **Note:** Although this slot accepts HTML Elements, it is strongly recommended that you only use `ui5-ai-button-state` components in order to preserve the intended design.
80
+ * @public
81
+ */
82
+ states: Array<ButtonState>;
83
+ onBeforeRendering(): void;
84
+ /**
85
+ * Starts the fade-out animation.
86
+ * @private
87
+ */
88
+ _fadeOut(): Promise<void>;
89
+ /**
90
+ * Starts the fade-in animation.
91
+ * @private
92
+ */
93
+ _fadeIn(): void;
94
+ /**
95
+ * Resets the fade phases when the animation is completed.
96
+ * @private
97
+ */
98
+ _resetFade(): void;
99
+ /**
100
+ * Handles the click event.
101
+ * @private
102
+ */
103
+ _onclick(e: MouseEvent): void;
104
+ get _effectiveState(): string;
105
+ get _effectiveStateObject(): ButtonState | undefined;
106
+ get _stateIconOnly(): boolean;
107
+ get _stateText(): string | undefined;
108
+ get _stateIcon(): string | undefined;
109
+ get _stateEndIcon(): string | undefined;
110
+ get _hasText(): boolean;
41
111
  }
42
112
  export default Button;
package/dist/Button.js CHANGED
@@ -5,15 +5,18 @@ 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";
11
+ import event from "@ui5/webcomponents-base/dist/decorators/event.js";
12
+ import slot from "@ui5/webcomponents-base/dist/decorators/slot.js";
10
13
  import litRender from "@ui5/webcomponents-base/dist/renderer/LitRenderer.js";
11
- // Deps
12
14
  import MainButton from "@ui5/webcomponents/dist/Button.js";
13
- // Template
14
- import template from "./generated/templates/ButtonTemplate.lit.js";
15
+ import Icon from "@ui5/webcomponents/dist/Icon.js";
16
+ import ButtonState from "./ButtonState.js";
17
+ import ButtonTemplate from "./generated/templates/ButtonTemplate.lit.js";
15
18
  // Styles
16
- import styles from "./generated/themes/Button.css.js";
19
+ import ButtonCss from "./generated/themes/Button.css.js";
17
20
  /**
18
21
  * @class
19
22
  *
@@ -26,12 +29,11 @@ import styles from "./generated/themes/Button.css.js";
26
29
  * ### Usage
27
30
  *
28
31
  * For the `ui5-ai-button` UI, you can define one or more states of the button by placing `ai-button-state` components in its default slot.
29
- * Each state have a key that identifies it and can have text, icon, end icon, next state and hasPopup type defined (in any combination) depending on the state purpose.
32
+ * Each state have a name that identifies it and can have text, icon and end icon defined (in any combination) depending on the state purpose.
30
33
  *
31
- * You can choose from a set of predefined designs that offer different styling to correspond to the triggered action.
34
+ * You can choose from a set of predefined designs (the same as for regular `ui5-button` component) that allow different styling to correspond to the triggered action.
32
35
  *
33
- * You can set the `ui5-ai-button` as enabled or disabled. An enabled `ui5-ai-button` can be pressed by clicking or tapping it. On press `ui5-ai-button` changes its state to the next one (if defined).
34
- * the mouse cursor. A disabled `ui5-ai-button` appears inactive and cannot be pressed.
36
+ * `ui5-ai-button` can be activated by clicking or tapping it. The state can be changed in `click` event handler.
35
37
  *
36
38
  * ### ES6 Module Import
37
39
  *
@@ -41,26 +43,180 @@ import styles from "./generated/themes/Button.css.js";
41
43
  * @extends UI5Element
42
44
  * @since 2.0
43
45
  * @public
46
+ * @experimental The Button and ButtonState web components are availabe since 2.0 under an experimental flag and their API and behaviour are subject to change.
44
47
  */
45
48
  let Button = class Button extends UI5Element {
49
+ constructor() {
50
+ super(...arguments);
51
+ /**
52
+ * Defines the component design.
53
+ * @default "Default"
54
+ * @public
55
+ */
56
+ this.design = "Default";
57
+ /**
58
+ * Defines whether the component is disabled.
59
+ * A disabled component can't be pressed or
60
+ * focused, and it is not in the tab chain.
61
+ * @default false
62
+ * @public
63
+ */
64
+ this.disabled = false;
65
+ /**
66
+ * Initiates button elements fade-out phase.
67
+ * @default false
68
+ * @private
69
+ */
70
+ this.fadeOut = false;
71
+ /**
72
+ * Initiates button fade middle phase.
73
+ * @default false
74
+ * @private
75
+ */
76
+ this.fadeMid = false;
77
+ /**
78
+ * Initiates button elements fade-in phase.
79
+ * @default false
80
+ * @private
81
+ */
82
+ this.fadeIn = false;
83
+ }
84
+ onBeforeRendering() {
85
+ if (this.fadeOut || this.fadeIn) {
86
+ return;
87
+ }
88
+ if (!this._currentStateObject?.name) {
89
+ this._currentStateObject = this._effectiveStateObject;
90
+ }
91
+ const currentStateName = this._currentStateObject?.name || "";
92
+ if (currentStateName !== "" && currentStateName !== this._effectiveState) {
93
+ this._fadeOut();
94
+ }
95
+ }
96
+ /**
97
+ * Starts the fade-out animation.
98
+ * @private
99
+ */
100
+ async _fadeOut() {
101
+ const fadeOutDuration = 180;
102
+ const button = this.shadowRoot?.querySelector("[ui5-button]");
103
+ const newStateObject = this._effectiveStateObject;
104
+ if (!newStateObject) {
105
+ // eslint-disable-next-line no-console
106
+ console.warn(`State with name="${this.state}" doesn't exist!`);
107
+ }
108
+ else if (button) {
109
+ const buttonWidth = button.offsetWidth;
110
+ const hiddenButton = this.shadowRoot?.querySelector(".ui5-ai-button-hidden");
111
+ button.style.width = `${buttonWidth}px`;
112
+ hiddenButton.icon = newStateObject.icon;
113
+ hiddenButton.endIcon = newStateObject.endIcon;
114
+ hiddenButton.textContent = newStateObject.text || null;
115
+ await renderFinished();
116
+ const hiddenButtonWidth = hiddenButton.offsetWidth;
117
+ this.fadeOut = true;
118
+ button.style.width = `${hiddenButtonWidth}px`;
119
+ setTimeout(() => {
120
+ this.fadeMid = true;
121
+ this._currentStateObject = newStateObject;
122
+ this._fadeIn();
123
+ }, fadeOutDuration);
124
+ }
125
+ }
126
+ /**
127
+ * Starts the fade-in animation.
128
+ * @private
129
+ */
130
+ _fadeIn() {
131
+ const fadeInDuration = 60;
132
+ setTimeout(() => {
133
+ this.fadeIn = true;
134
+ this._resetFade();
135
+ }, fadeInDuration);
136
+ }
137
+ /**
138
+ * Resets the fade phases when the animation is completed.
139
+ * @private
140
+ */
141
+ _resetFade() {
142
+ const fadeResetDuration = 160;
143
+ setTimeout(() => {
144
+ this.fadeOut = false;
145
+ this.fadeMid = false;
146
+ this.fadeIn = false;
147
+ }, fadeResetDuration);
148
+ }
149
+ /**
150
+ * Handles the click event.
151
+ * @private
152
+ */
153
+ _onclick(e) {
154
+ e.stopImmediatePropagation();
155
+ this.fireEvent("click");
156
+ }
157
+ get _effectiveState() {
158
+ return this.state || (this.states.length && this.states[0].name) || "";
159
+ }
160
+ get _effectiveStateObject() {
161
+ return this.states.find(state => state.name === this._effectiveState);
162
+ }
163
+ get _stateIconOnly() {
164
+ return !this._stateText && !!this._stateIcon;
165
+ }
166
+ get _stateText() {
167
+ return this._currentStateObject?.text;
168
+ }
169
+ get _stateIcon() {
170
+ return this._currentStateObject?.icon;
171
+ }
172
+ get _stateEndIcon() {
173
+ return this._currentStateObject?.endIcon;
174
+ }
175
+ get _hasText() {
176
+ return !!this._stateText;
177
+ }
46
178
  };
179
+ __decorate([
180
+ property()
181
+ ], Button.prototype, "design", void 0);
47
182
  __decorate([
48
183
  property({ type: Boolean })
49
184
  ], Button.prototype, "disabled", void 0);
50
185
  __decorate([
51
186
  property()
52
- ], Button.prototype, "icon", void 0);
187
+ ], Button.prototype, "state", void 0);
53
188
  __decorate([
54
- property()
55
- ], Button.prototype, "endIcon", void 0);
189
+ property({ type: Object })
190
+ ], Button.prototype, "_currentStateObject", void 0);
191
+ __decorate([
192
+ property({ type: Boolean })
193
+ ], Button.prototype, "fadeOut", void 0);
194
+ __decorate([
195
+ property({ type: Boolean })
196
+ ], Button.prototype, "fadeMid", void 0);
197
+ __decorate([
198
+ property({ type: Boolean })
199
+ ], Button.prototype, "fadeIn", void 0);
200
+ __decorate([
201
+ slot({ type: HTMLElement, "default": true })
202
+ ], Button.prototype, "states", void 0);
56
203
  Button = __decorate([
57
204
  customElement({
58
205
  tag: "ui5-ai-button",
206
+ languageAware: true,
59
207
  renderer: litRender,
60
- template,
61
- styles,
62
- dependencies: [MainButton],
208
+ template: ButtonTemplate,
209
+ styles: ButtonCss,
210
+ dependencies: [MainButton, Icon, ButtonState],
211
+ shadowRootOptions: { delegatesFocus: true },
63
212
  })
213
+ /**
214
+ * Fired when the component is activated either with a
215
+ * mouse/tap or by using the Enter or Space key.
216
+ * @public
217
+ */
218
+ ,
219
+ event("click")
64
220
  ], Button);
65
221
  Button.define();
66
222
  export default Button;
@@ -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;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAQH,IAAM,MAAM,GAAZ,MAAM,MAAO,SAAQ,UAAU;CAgB9B,CAAA;AAPA;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;wCACT;AAGnB;IADC,QAAQ,EAAE;oCACG;AAGd;IADC,QAAQ,EAAE;uCACM;AAfZ,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,CAgBX;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 *\n * ### Overview\n *\n * The `ui5-ai-button` component represents a button used in AI-related scenarios.\n * It enables users to trigger actions by clicking or tapping the `ui5-ai-button`, or by pressing\n * certain keyboard keys, such as Enter.\n *\n * ### Usage\n *\n * For the `ui5-ai-button` UI, you can define one or more states of the button by placing `ai-button-state` components in its default slot.\n * Each state have a key that identifies it and can have text, icon, end icon, next state and hasPopup type defined (in any combination) depending on the state purpose.\n *\n * You can choose from a set of predefined designs that offer different styling to correspond to the triggered action.\n *\n * You can set the `ui5-ai-button` as enabled or disabled. An enabled `ui5-ai-button` can be pressed by clicking or tapping it. On press `ui5-ai-button` changes its state to the next one (if defined).\n * the mouse cursor. A disabled `ui5-ai-button` appears inactive and cannot be pressed.\n *\n * ### ES6 Module Import\n *\n * `import \"@ui5/webcomponents-ai/dist/Button.js\";`\n *\n * @constructor\n * @extends UI5Element\n * @since 2.0\n * @public\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/**\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!: boolean;\n\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,kDAAkD,CAAC;AACrE,OAAO,IAAI,MAAM,iDA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f;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;mDACO;AAQlC;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;uCACZ;AAQhB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;uCACZ;AAQhB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;sCACb;AAQf;IADC,IAAI,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;sCACjB;AAjEvB,MAAM;IAhBX,aAAa,CAAC;QACd,GAAG,EAAE,eAAe;QACpB,aAAa,EAAE,IAAI;QACnB,QAAQ,EAAE,SAAS;QACnB,QAAQ,EAAE,cAAc;QACxB,MAAM,EAAE,SAAS;QACjB,YAAY,EAAE,CAAC,UAAU,EAAE,IAAI,EAAE,WAAW,CAAC;QAC7C,iBAAiB,EAAE,EAAE,cAAc,EAAE,IAAI,EAAE;KAC3C,CAAC;IAEF;;;;OAIG;;IACF,KAAK,CAAC,OAAO,CAAC;GACT,MAAM,CAoLX;AAED,MAAM,CAAC,MAAM,EAAE,CAAC;AAChB,eAAe,MAAM,CAAC","sourcesContent":["import UI5Element from \"@ui5/webcomponents-base/dist/UI5Element.js\";\nimport { renderFinished } from \"@ui5/webcomponents-base/dist/Render.js\";\nimport customElement from \"@ui5/webcomponents-base/dist/decorators/customElement.js\";\nimport property from \"@ui5/webcomponents-base/dist/decorators/property.js\";\nimport event from \"@ui5/webcomponents-base/dist/decorators/event.js\";\nimport slot from \"@ui5/webcomponents-base/dist/decorators/slot.js\";\nimport litRender from \"@ui5/webcomponents-base/dist/renderer/LitRenderer.js\";\nimport MainButton from \"@ui5/webcomponents/dist/Button.js\";\nimport Icon from \"@ui5/webcomponents/dist/Icon.js\";\nimport type ButtonDesign from \"@ui5/webcomponents/dist/types/ButtonDesign.js\";\nimport ButtonState from \"./ButtonState.js\";\n\nimport ButtonTemplate from \"./generated/templates/ButtonTemplate.lit.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 represents a button used in AI-related scenarios.\n * It enables users to trigger actions by clicking or tapping the `ui5-ai-button`, or by pressing\n * certain keyboard keys, such as Enter.\n *\n * ### Usage\n *\n * For the `ui5-ai-button` UI, you can define one or more states of the button by placing `ai-button-state` components in its default slot.\n * Each state have a name that identifies it and can have text, icon and end icon defined (in any combination) depending on the state purpose.\n *\n * You can choose from a set of predefined designs (the same as for regular `ui5-button` component) that allow different styling to correspond to the triggered action.\n *\n * `ui5-ai-button` can be activated by clicking or tapping it. The state can be changed in `click` event handler.\n *\n * ### ES6 Module Import\n *\n * `import \"@ui5/webcomponents-ai/dist/Button.js\";`\n *\n * @constructor\n * @extends UI5Element\n * @since 2.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: litRender,\n\ttemplate: ButtonTemplate,\n\tstyles: ButtonCss,\n\tdependencies: [MainButton, Icon, ButtonState],\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\")\nclass Button extends UI5Element {\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 * 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 * Initiates button elements fade-out phase.\n\t * @default false\n\t * @private\n\t */\n\t@property({ type: Boolean })\n\tfadeOut = false;\n\n\t/**\n\t * Initiates button fade middle phase.\n\t * @default false\n\t * @private\n\t */\n\t@property({ type: Boolean })\n\tfadeMid = false;\n\n\t/**\n\t * Initiates button elements fade-in phase.\n\t * @default false\n\t * @private\n\t */\n\t@property({ type: Boolean })\n\tfadeIn = 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 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\tonBeforeRendering(): void {\n\t\tif (this.fadeOut || this.fadeIn) {\n\t\t\treturn;\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\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\n\t\tconst button = this.shadowRoot?.querySelector(\"[ui5-button]\") as MainButton;\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} else if (button) {\n\t\t\tconst buttonWidth = button.offsetWidth;\n\t\t\tconst hiddenButton = this.shadowRoot?.querySelector(\".ui5-ai-button-hidden\") as MainButton;\n\t\t\tbutton.style.width = `${buttonWidth}px`;\n\t\t\thiddenButton.icon = newStateObject.icon;\n\t\t\thiddenButton.endIcon = newStateObject.endIcon;\n\t\t\thiddenButton.textContent = newStateObject.text || null;\n\n\t\t\tawait renderFinished();\n\t\t\tconst hiddenButtonWidth = hiddenButton.offsetWidth;\n\t\t\tthis.fadeOut = true;\n\t\t\tbutton.style.width = `${hiddenButtonWidth}px`;\n\n\t\t\tsetTimeout(() => {\n\t\t\t\tthis.fadeMid = true;\n\t\t\t\tthis._currentStateObject = newStateObject;\n\t\t\t\tthis._fadeIn();\n\t\t\t}, fadeOutDuration);\n\t\t}\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 = 60;\n\n\t\tsetTimeout(() => {\n\t\t\tthis.fadeIn = true;\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.fadeOut = false;\n\t\t\tthis.fadeMid = false;\n\t\t\tthis.fadeIn = false;\n\t\t}, fadeResetDuration);\n\t}\n\n\t/**\n\t * Handles the click event.\n\t * @private\n\t */\n\t_onclick(e: MouseEvent): void {\n\t\te.stopImmediatePropagation();\n\t\tthis.fireEvent(\"click\");\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\treturn this._currentStateObject?.endIcon;\n\t}\n\n\tget _hasText() {\n\t\treturn !!this._stateText;\n\t}\n}\n\nButton.define();\nexport default Button;\n"]}
@@ -0,0 +1,60 @@
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-si-button-state` is an abstract element, representing a state of `ui5-ai-button`. It is meant to be used in the `states` slot
12
+ * of `ui5-ai-button` and should 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
21
+ * @public
22
+ * @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.
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
+ export default ButtonState;
@@ -0,0 +1,51 @@
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-si-button-state` is an abstract element, representing a state of `ui5-ai-button`. It is meant to be used in the `states` slot
20
+ * of `ui5-ai-button` and should 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
29
+ * @public
30
+ * @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.
31
+ */
32
+ let ButtonState = class ButtonState extends UI5Element {
33
+ };
34
+ __decorate([
35
+ property()
36
+ ], ButtonState.prototype, "name", void 0);
37
+ __decorate([
38
+ property()
39
+ ], ButtonState.prototype, "text", void 0);
40
+ __decorate([
41
+ property()
42
+ ], ButtonState.prototype, "icon", void 0);
43
+ __decorate([
44
+ property()
45
+ ], ButtonState.prototype, "endIcon", void 0);
46
+ ButtonState = __decorate([
47
+ customElement("ui5-ai-button-state")
48
+ ], ButtonState);
49
+ ButtonState.define();
50
+ export default ButtonState;
51
+ //# 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;CA0CnC,CAAA;AAnCA;IADC,QAAQ,EAAE;yCACG;AAQd;IADC,QAAQ,EAAE;yCACG;AAad;IADC,QAAQ,EAAE;yCACG;AAad;IADC,QAAQ,EAAE;4CACM;AAzCZ,WAAW;IADhB,aAAa,CAAC,qBAAqB,CAAC;GAC/B,WAAW,CA0ChB;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-si-button-state` is an abstract element, representing a state of `ui5-ai-button`. It is meant to be used in the `states` slot\n * of `ui5-ai-button` and should 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\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@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\nButtonState.define();\nexport default ButtonState;\n"]}
@@ -1,6 +1,6 @@
1
1
  import UI5Element from "@ui5/webcomponents-base/dist/UI5Element.js";
2
2
  import type I18nBundle from "@ui5/webcomponents-base/dist/i18nBundle.js";
3
- import ValueState from "@ui5/webcomponents-base/dist/types/ValueState.js";
3
+ import type ValueState from "@ui5/webcomponents-base/dist/types/ValueState.js";
4
4
  import "@ui5/webcomponents-icons/dist/paper-plane.js";
5
5
  import type { InputEventDetail } from "@ui5/webcomponents/dist/Input.js";
6
6
  /**
@@ -18,6 +18,7 @@ import type { InputEventDetail } from "@ui5/webcomponents/dist/Input.js";
18
18
  * @constructor
19
19
  * @public
20
20
  * @extends UI5Element
21
+ * @experimental The **@ui5/webcomponents-ai** package is under development and considered experimental - components' APIs are subject to change.
21
22
  */
22
23
  declare class PromptInput extends UI5Element {
23
24
  /**
@@ -31,19 +32,19 @@ declare class PromptInput extends UI5Element {
31
32
  /**
32
33
  * Defines a short hint intended to aid the user with data entry when the
33
34
  * component has no value.
34
- * @default ""
35
+ * @default undefined
35
36
  * @since 2.0.0
36
37
  * @public
37
38
  */
38
- placeholder: string;
39
+ placeholder?: string;
39
40
  /**
40
41
  * Defines the label of the input field.
41
42
  *
42
- * @default ""
43
+ * @default undefined
43
44
  * @since 2.0.0
44
45
  * @public
45
46
  */
46
- label: string;
47
+ label?: string;
47
48
  /**
48
49
  * Defines whether the clear icon of the input will be shown.
49
50
  * @default false
@@ -12,8 +12,6 @@ import event from "@ui5/webcomponents-base/dist/decorators/event.js";
12
12
  import slot from "@ui5/webcomponents-base/dist/decorators/slot.js";
13
13
  import litRender from "@ui5/webcomponents-base/dist/renderer/LitRenderer.js";
14
14
  import { getI18nBundle } from "@ui5/webcomponents-base/dist/i18nBundle.js";
15
- import Integer from "@ui5/webcomponents-base/dist/types/Integer.js";
16
- import ValueState from "@ui5/webcomponents-base/dist/types/ValueState.js";
17
15
  import "@ui5/webcomponents-icons/dist/paper-plane.js";
18
16
  import Input from "@ui5/webcomponents/dist/Input.js";
19
17
  import Label from "@ui5/webcomponents/dist/Label.js";
@@ -38,6 +36,7 @@ import PromptInputCss from "./generated/themes/PromptInput.css.js";
38
36
  * @constructor
39
37
  * @public
40
38
  * @extends UI5Element
39
+ * @experimental The **@ui5/webcomponents-ai** package is under development and considered experimental - components' APIs are subject to change.
41
40
  */
42
41
  let PromptInput = PromptInput_1 = class PromptInput extends UI5Element {
43
42
  static async onDefine() {
@@ -45,6 +44,60 @@ let PromptInput = PromptInput_1 = class PromptInput extends UI5Element {
45
44
  }
46
45
  constructor() {
47
46
  super();
47
+ /**
48
+ * Defines the value of the component.
49
+ *
50
+ * @default ""
51
+ * @since 2.0.0
52
+ * @public
53
+ */
54
+ this.value = "";
55
+ /**
56
+ * Defines whether the clear icon of the input will be shown.
57
+ * @default false
58
+ * @public
59
+ * @since 2.0.0
60
+ */
61
+ this.showClearIcon = false;
62
+ /**
63
+ * Determines whether the characters exceeding the maximum allowed character count are visible
64
+ * in the component.
65
+ *
66
+ * If set to `false`, the user is not allowed to enter more characters than what is set in the
67
+ * `maxlength` property.
68
+ * If set to `true` the characters exceeding the `maxlength` value are selected on
69
+ * paste and the counter below the component displays their number.
70
+ * @default false
71
+ * @public
72
+ * @since 2.0.0
73
+ */
74
+ this.showExceededText = false;
75
+ /**
76
+ * Defines whether the component is in disabled state.
77
+ *
78
+ * **Note:** A disabled component is completely noninteractive.
79
+ * @default false
80
+ * @public
81
+ * @since 2.0.0
82
+ */
83
+ this.disabled = false;
84
+ /**
85
+ * Defines whether the component is read-only.
86
+ *
87
+ * **Note:** A read-only component is not editable,
88
+ * but still provides visual feedback upon user interaction.
89
+ * @default false
90
+ * @public
91
+ * @since 2.0.0
92
+ */
93
+ this.readonly = false;
94
+ /**
95
+ * Defines the value state of the component.
96
+ * @default "None"
97
+ * @since 2.0.0
98
+ * @public
99
+ */
100
+ this.valueState = "None";
48
101
  }
49
102
  _onkeydown(e) {
50
103
  if (isEnter(e)) {
@@ -103,10 +156,10 @@ __decorate([
103
156
  property({ type: Boolean })
104
157
  ], PromptInput.prototype, "readonly", void 0);
105
158
  __decorate([
106
- property({ validator: Integer })
159
+ property({ type: Number })
107
160
  ], PromptInput.prototype, "maxlength", void 0);
108
161
  __decorate([
109
- property({ type: ValueState, defaultValue: ValueState.None })
162
+ property()
110
163
  ], PromptInput.prototype, "valueState", void 0);
111
164
  __decorate([
112
165
  slot({