mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-14 18:01:06 +00:00
fix(combo-box): fix types for on:clear
(#2020)
This commit is contained in:
parent
49b5def815
commit
0831e87135
5 changed files with 11 additions and 3 deletions
|
@ -697,12 +697,12 @@ export interface ComboBoxItem {
|
||||||
| Event name | Type | Detail |
|
| Event name | Type | Detail |
|
||||||
| :--------- | :--------- | :---------------------------------------------------------------------- |
|
| :--------- | :--------- | :---------------------------------------------------------------------- |
|
||||||
| select | dispatched | <code>{ selectedId: ComboBoxItemId; selectedItem: ComboBoxItem }</code> |
|
| select | dispatched | <code>{ selectedId: ComboBoxItemId; selectedItem: ComboBoxItem }</code> |
|
||||||
|
| clear | dispatched | <code>KeyboardEvent | MouseEvent</code> |
|
||||||
| keydown | forwarded | -- |
|
| keydown | forwarded | -- |
|
||||||
| keyup | forwarded | -- |
|
| keyup | forwarded | -- |
|
||||||
| focus | forwarded | -- |
|
| focus | forwarded | -- |
|
||||||
| blur | forwarded | -- |
|
| blur | forwarded | -- |
|
||||||
| paste | forwarded | -- |
|
| paste | forwarded | -- |
|
||||||
| clear | forwarded | -- |
|
|
||||||
| scroll | forwarded | -- |
|
| scroll | forwarded | -- |
|
||||||
|
|
||||||
## `ComposedModal`
|
## `ComposedModal`
|
||||||
|
|
|
@ -1780,12 +1780,16 @@
|
||||||
"name": "select",
|
"name": "select",
|
||||||
"detail": "{ selectedId: ComboBoxItemId; selectedItem: ComboBoxItem }"
|
"detail": "{ selectedId: ComboBoxItemId; selectedItem: ComboBoxItem }"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "dispatched",
|
||||||
|
"name": "clear",
|
||||||
|
"detail": "KeyboardEvent | MouseEvent"
|
||||||
|
},
|
||||||
{ "type": "forwarded", "name": "keydown", "element": "input" },
|
{ "type": "forwarded", "name": "keydown", "element": "input" },
|
||||||
{ "type": "forwarded", "name": "keyup", "element": "input" },
|
{ "type": "forwarded", "name": "keyup", "element": "input" },
|
||||||
{ "type": "forwarded", "name": "focus", "element": "input" },
|
{ "type": "forwarded", "name": "focus", "element": "input" },
|
||||||
{ "type": "forwarded", "name": "blur", "element": "input" },
|
{ "type": "forwarded", "name": "blur", "element": "input" },
|
||||||
{ "type": "forwarded", "name": "paste", "element": "input" },
|
{ "type": "forwarded", "name": "paste", "element": "input" },
|
||||||
{ "type": "forwarded", "name": "clear", "element": "ListBoxSelection" },
|
|
||||||
{ "type": "forwarded", "name": "scroll", "element": "ListBoxMenu" }
|
{ "type": "forwarded", "name": "scroll", "element": "ListBoxMenu" }
|
||||||
],
|
],
|
||||||
"typedefs": [
|
"typedefs": [
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
* @typedef {any} ComboBoxItemId
|
* @typedef {any} ComboBoxItemId
|
||||||
* @typedef {{ id: ComboBoxItemId; text: string; disabled?: boolean; }} ComboBoxItem
|
* @typedef {{ id: ComboBoxItemId; text: string; disabled?: boolean; }} ComboBoxItem
|
||||||
* @event {{ selectedId: ComboBoxItemId; selectedItem: ComboBoxItem }} select
|
* @event {{ selectedId: ComboBoxItemId; selectedItem: ComboBoxItem }} select
|
||||||
|
* @event {KeyboardEvent | MouseEvent} clear
|
||||||
* @slot {{ item: ComboBoxItem; index: number }}
|
* @slot {{ item: ComboBoxItem; index: number }}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,9 @@
|
||||||
on:select="{(e) => {
|
on:select="{(e) => {
|
||||||
console.log(e.detail.selectedId);
|
console.log(e.detail.selectedId);
|
||||||
}}"
|
}}"
|
||||||
|
on:clear="{(e) => {
|
||||||
|
console.log(e.detail);
|
||||||
|
}}"
|
||||||
translateWithId="{(id) => {
|
translateWithId="{(id) => {
|
||||||
console.log(id); // "open" | "close"
|
console.log(id); // "open" | "close"
|
||||||
return id;
|
return id;
|
||||||
|
|
2
types/ComboBox/ComboBox.svelte.d.ts
vendored
2
types/ComboBox/ComboBox.svelte.d.ts
vendored
|
@ -164,12 +164,12 @@ export default class ComboBox extends SvelteComponentTyped<
|
||||||
selectedId: ComboBoxItemId;
|
selectedId: ComboBoxItemId;
|
||||||
selectedItem: ComboBoxItem;
|
selectedItem: ComboBoxItem;
|
||||||
}>;
|
}>;
|
||||||
|
clear: CustomEvent<KeyboardEvent | MouseEvent>;
|
||||||
keydown: WindowEventMap["keydown"];
|
keydown: WindowEventMap["keydown"];
|
||||||
keyup: WindowEventMap["keyup"];
|
keyup: WindowEventMap["keyup"];
|
||||||
focus: WindowEventMap["focus"];
|
focus: WindowEventMap["focus"];
|
||||||
blur: WindowEventMap["blur"];
|
blur: WindowEventMap["blur"];
|
||||||
paste: DocumentAndElementEventHandlersEventMap["paste"];
|
paste: DocumentAndElementEventHandlersEventMap["paste"];
|
||||||
clear: WindowEventMap["clear"];
|
|
||||||
scroll: WindowEventMap["scroll"];
|
scroll: WindowEventMap["scroll"];
|
||||||
},
|
},
|
||||||
{ default: { item: ComboBoxItem; index: number }; titleText: {} }
|
{ default: { item: ComboBoxItem; index: number }; titleText: {} }
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue