Skip to content

Commit

Permalink
fix(slider): dispatch on:input event
Browse files Browse the repository at this point in the history
  • Loading branch information
mmamedel authored and metonym committed Feb 11, 2024
1 parent 5c95891 commit b9adb10
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions COMPONENT_INDEX.md
Original file line number Diff line number Diff line change
Expand Up @@ -3533,6 +3533,7 @@ None.
| Event name | Type | Detail |
| :--------- | :--------- | :------------------ |
| change | dispatched | <code>number</code> |
| input | dispatched | <code>number</code> |
| click | forwarded | -- |
| mouseover | forwarded | -- |
| mouseenter | forwarded | -- |
Expand Down
1 change: 1 addition & 0 deletions docs/src/COMPONENT_API.json
Original file line number Diff line number Diff line change
Expand Up @@ -11361,6 +11361,7 @@
],
"events": [
{ "type": "dispatched", "name": "change", "detail": "number" },
{ "type": "dispatched", "name": "input", "detail": "number" },
{ "type": "forwarded", "name": "click", "element": "div" },
{ "type": "forwarded", "name": "mouseover", "element": "div" },
{ "type": "forwarded", "name": "mouseenter", "element": "div" },
Expand Down
2 changes: 2 additions & 0 deletions src/Slider/Slider.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<script>
/**
* @event {number} change
* @event {number} input
*/
/** Specify the value of the slider */
Expand Down Expand Up @@ -109,6 +110,7 @@
}
value = nextValue;
dispatch("input", value);
}
$: labelId = `label-${id}`;
Expand Down
3 changes: 3 additions & 0 deletions tests/Slider.test.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
on:change="{(e) => {
console.log(e.detail); // number
}}"
on:input="{(e) => {
console.log(e.detail); // number
}}"
/>

<Slider
Expand Down
1 change: 1 addition & 0 deletions types/Slider/Slider.svelte.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ export default class Slider extends SvelteComponentTyped<
SliderProps,
{
change: CustomEvent<number>;
input: CustomEvent<number>;
click: WindowEventMap["click"];
mouseover: WindowEventMap["mouseover"];
mouseenter: WindowEventMap["mouseenter"];
Expand Down

0 comments on commit b9adb10

Please sign in to comment.