Skip to content

Commit c1d4154

Browse files
authored
docs: enhance ai/Input item-click event detail type (#12864)
1 parent 0431b5b commit c1d4154

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

packages/ai/src/Input.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ type InputVersionChangeEventDetail = {
3131
backwards: boolean,
3232
};
3333

34+
type InputItemClickEventDetail = MenuItemClickEventDetail;
35+
3436
/**
3537
* @class
3638
*
@@ -87,6 +89,8 @@ type InputVersionChangeEventDetail = {
8789
})
8890

8991
/** Fired when an item from the AI actions menu is clicked.
92+
* @param { HTMLElement } item The currently clicked menu item.
93+
* @param { string } text The text of the currently clicked menu item.
9094
* @public
9195
*/
9296
@event("item-click")
@@ -110,7 +114,7 @@ class Input extends BaseInput {
110114
"version-change": InputVersionChangeEventDetail;
111115
"stop-generation": void;
112116
"button-click": void;
113-
"item-click": MenuItemClickEventDetail;
117+
"item-click": InputItemClickEventDetail;
114118
};
115119

116120
/**
@@ -256,7 +260,7 @@ class Input extends BaseInput {
256260
this._handleVersionChange(new CustomEvent("version-change", { detail: { backwards: false } }));
257261
}
258262

259-
_onMenuIconClick(e: CustomEvent<MenuItemClickEventDetail>): void {
263+
_onMenuIconClick(e: CustomEvent<InputItemClickEventDetail>): void {
260264
this.fireDecoratorEvent("item-click", e.detail);
261265
}
262266

@@ -318,5 +322,8 @@ class Input extends BaseInput {
318322

319323
Input.define();
320324

321-
export type { InputVersionChangeEventDetail, MenuItemClickEventDetail as InputItemClickEventDetail };
325+
export type {
326+
InputVersionChangeEventDetail,
327+
InputItemClickEventDetail,
328+
};
322329
export default Input;

0 commit comments

Comments
 (0)