Skip to content

Commit 2cb9ffd

Browse files
committed
update slider event spec
1 parent 269723b commit 2cb9ffd

File tree

2 files changed

+4
-19
lines changed

2 files changed

+4
-19
lines changed

reflex/components/radix/primitives/slider.py

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
from reflex.components.component import Component, ComponentNamespace
99
from reflex.components.radix.primitives.base import RadixPrimitiveComponentWithClassName
10-
from reflex.event import EventHandler
10+
from reflex.event import EventHandler, passthrough_event_spec
1111
from reflex.vars.base import Var
1212

1313
LiteralSliderOrientation = Literal["horizontal", "vertical"]
@@ -20,20 +20,6 @@ class SliderComponent(RadixPrimitiveComponentWithClassName):
2020
library = "@radix-ui/[email protected]"
2121

2222

23-
def on_value_event_spec(
24-
value: Var[list[int]],
25-
) -> tuple[Var[list[int]]]:
26-
"""Event handler spec for the value event.
27-
28-
Args:
29-
value: The value of the event.
30-
31-
Returns:
32-
The event handler spec.
33-
"""
34-
return (value,)
35-
36-
3723
class SliderRoot(SliderComponent):
3824
"""The Slider component containing all slider parts."""
3925

@@ -63,10 +49,10 @@ class SliderRoot(SliderComponent):
6349
min_steps_between_thumbs: Var[int]
6450

6551
# Fired when the value of a thumb changes.
66-
on_value_change: EventHandler[on_value_event_spec]
52+
on_value_change: EventHandler[passthrough_event_spec(list[float])]
6753

6854
# Fired when a thumb is released.
69-
on_value_commit: EventHandler[on_value_event_spec]
55+
on_value_commit: EventHandler[passthrough_event_spec(list[float])]
7056

7157
def add_style(self) -> dict[str, Any] | None:
7258
"""Add style to the component.

reflex/components/radix/themes/components/slider.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,8 @@
1313
from reflex.vars.base import Var
1414

1515
on_value_event_spec = (
16-
passthrough_event_spec(list[int | float]),
17-
passthrough_event_spec(list[int]),
1816
passthrough_event_spec(list[float]),
17+
passthrough_event_spec(list[int]),
1918
)
2019

2120

0 commit comments

Comments
 (0)