Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions reflex_ui/components/base/select.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
class ClassNames:
"""Class names for select components."""

LABEL = "block text-sm font-medium text-secondary-12"
TRIGGER = "flex min-w-48 items-center justify-between gap-3 select-none text-sm [&>span]:line-clamp-1 cursor-pointer focus:outline-none focus-visible:ring-1 focus-visible:ring-primary-4 group/trigger"
VALUE = "flex-1 text-left"
ICON = "flex size-4 text-secondary-10 group-data-[disabled]/trigger:text-current"
Expand Down Expand Up @@ -135,6 +136,22 @@ def create(cls, *children, **props) -> BaseUIComponent:
return super().create(*children, **props)


class SelectLabel(SelectBaseComponent):
"""An accessible label for the select trigger."""

tag = "Select.Label"

# The render prop
render_: Var[Component]

@classmethod
def create(cls, *children, **props) -> BaseUIComponent:
"""Create the select label component."""
props["data-slot"] = "select-label"
cls.set_class_name(ClassNames.LABEL, props)
return super().create(*children, **props)


class SelectTrigger(SelectBaseComponent):
"""A button that opens the select menu."""

Expand Down Expand Up @@ -602,6 +619,7 @@ class Select(ComponentNamespace):
"""Namespace for Select components."""

root = staticmethod(SelectRoot.create)
label = staticmethod(SelectLabel.create)
trigger = staticmethod(SelectTrigger.create)
value = staticmethod(SelectValue.create)
icon = staticmethod(SelectIcon.create)
Expand Down
39 changes: 39 additions & 0 deletions reflex_ui/components/base/select.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ LiteralPosition = Literal["absolute", "fixed"]
LiteralOrientation = Literal["horizontal", "vertical"]

class ClassNames:
LABEL = "block text-sm font-medium text-secondary-12"
TRIGGER = "flex min-w-48 items-center justify-between gap-3 select-none text-sm [&>span]:line-clamp-1 cursor-pointer focus:outline-none focus-visible:ring-1 focus-visible:ring-primary-4 group/trigger"
VALUE = "flex-1 text-left"
ICON = "flex size-4 text-secondary-10 group-data-[disabled]/trigger:text-current"
Expand Down Expand Up @@ -144,6 +145,43 @@ class SelectRoot(SelectBaseComponent):
) -> SelectRoot:
"""Create the select root component."""

class SelectLabel(SelectBaseComponent):
@classmethod
def create(
cls,
*children,
render_: Component | Var[Component] | None = None,
unstyled: Var[bool] | bool | None = None,
style: Sequence[Mapping[str, Any]]
| Mapping[str, Any]
| Var[Mapping[str, Any]]
| Breakpoints
| None = None,
key: Any | None = None,
id: Any | None = None,
ref: Var | None = None,
class_name: Any | None = None,
custom_attrs: dict[str, Var | Any] | None = None,
on_blur: EventType[()] | None = None,
on_click: EventType[()] | EventType[PointerEventInfo] | None = None,
on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None,
on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None,
on_focus: EventType[()] | None = None,
on_mount: EventType[()] | None = None,
on_mouse_down: EventType[()] | None = None,
on_mouse_enter: EventType[()] | None = None,
on_mouse_leave: EventType[()] | None = None,
on_mouse_move: EventType[()] | None = None,
on_mouse_out: EventType[()] | None = None,
on_mouse_over: EventType[()] | None = None,
on_mouse_up: EventType[()] | None = None,
on_scroll: EventType[()] | None = None,
on_scroll_end: EventType[()] | None = None,
on_unmount: EventType[()] | None = None,
**props,
) -> SelectLabel:
"""Create the select label component."""

class SelectTrigger(SelectBaseComponent):
@classmethod
def create(
Expand Down Expand Up @@ -934,6 +972,7 @@ class HighLevelSelect(SelectRoot):

class Select(ComponentNamespace):
root = staticmethod(SelectRoot.create)
label = staticmethod(SelectLabel.create)
trigger = staticmethod(SelectTrigger.create)
value = staticmethod(SelectValue.create)
icon = staticmethod(SelectIcon.create)
Expand Down
18 changes: 18 additions & 0 deletions reflex_ui/components/base/slider.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class ClassNames:
"""Class names for slider components."""

ROOT = "flex max-w-64 w-full touch-none items-center select-none"
LABEL = "text-sm text-secondary-12 font-medium"
VALUE = "text-sm text-primary-11 font-medium"
CONTROL = "flex items-center justify-center w-full"
TRACK = "h-2 w-full rounded-full bg-secondary-4 select-none"
Expand All @@ -44,6 +45,22 @@ def import_var(self):
return ImportVar(tag="Slider", package_path="", install=False)


class SliderLabel(SliderBaseComponent):
"""An accessible label for the slider."""

tag = "Slider.Label"

# The render prop
render_: Var[Component]

@classmethod
def create(cls, *children, **props) -> BaseUIComponent:
"""Create the slider label component."""
props["data-slot"] = "slider-label"
cls.set_class_name(ClassNames.LABEL, props)
return super().create(*children, **props)


class SliderRoot(SliderBaseComponent):
"""Groups all parts of the slider. Renders a div element."""

Expand Down Expand Up @@ -231,6 +248,7 @@ class Slider(ComponentNamespace):
"""Namespace for Slider components."""

root = staticmethod(SliderRoot.create)
label = staticmethod(SliderLabel.create)
value = staticmethod(SliderValue.create)
control = staticmethod(SliderControl.create)
track = staticmethod(SliderTrack.create)
Expand Down
39 changes: 39 additions & 0 deletions reflex_ui/components/base/slider.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ on_value_event_spec = (

class ClassNames:
ROOT = "flex max-w-64 w-full touch-none items-center select-none"
LABEL = "text-sm text-secondary-12 font-medium"
VALUE = "text-sm text-primary-11 font-medium"
CONTROL = "flex items-center justify-center w-full"
TRACK = "h-2 w-full rounded-full bg-secondary-4 select-none"
Expand Down Expand Up @@ -85,6 +86,43 @@ class SliderBaseComponent(BaseUIComponent):
The component.
"""

class SliderLabel(SliderBaseComponent):
@classmethod
def create(
cls,
*children,
render_: Component | Var[Component] | None = None,
unstyled: Var[bool] | bool | None = None,
style: Sequence[Mapping[str, Any]]
| Mapping[str, Any]
| Var[Mapping[str, Any]]
| Breakpoints
| None = None,
key: Any | None = None,
id: Any | None = None,
ref: Var | None = None,
class_name: Any | None = None,
custom_attrs: dict[str, Var | Any] | None = None,
on_blur: EventType[()] | None = None,
on_click: EventType[()] | EventType[PointerEventInfo] | None = None,
on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None,
on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None,
on_focus: EventType[()] | None = None,
on_mount: EventType[()] | None = None,
on_mouse_down: EventType[()] | None = None,
on_mouse_enter: EventType[()] | None = None,
on_mouse_leave: EventType[()] | None = None,
on_mouse_move: EventType[()] | None = None,
on_mouse_out: EventType[()] | None = None,
on_mouse_over: EventType[()] | None = None,
on_mouse_up: EventType[()] | None = None,
on_scroll: EventType[()] | None = None,
on_scroll_end: EventType[()] | None = None,
on_unmount: EventType[()] | None = None,
**props,
) -> SliderLabel:
"""Create the slider label component."""

class SliderRoot(SliderBaseComponent):
@classmethod
def create(
Expand Down Expand Up @@ -466,6 +504,7 @@ class HighLevelSlider(SliderRoot):

class Slider(ComponentNamespace):
root = staticmethod(SliderRoot.create)
label = staticmethod(SliderLabel.create)
value = staticmethod(SliderValue.create)
control = staticmethod(SliderControl.create)
track = staticmethod(SliderTrack.create)
Expand Down
4 changes: 4 additions & 0 deletions reflex_ui/components/base/tooltip.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ class TooltipTrigger(TooltipBaseComponent):

tag = "Tooltip.Trigger"

# Whether the tooltip should close when this trigger is clicked. Defaults to True.
close_on_click: Var[bool]

# How long to wait before the tooltip may be opened on hover. Specified in milliseconds. Defaults to 300.
delay: Var[int]

Expand Down Expand Up @@ -228,6 +231,7 @@ class HighLevelTooltip(TooltipRoot):
"disable_hoverable_popup",
}
_trigger_props = {
"close_on_click",
"delay",
"close_delay",
}
Expand Down
1 change: 1 addition & 0 deletions reflex_ui/components/base/tooltip.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ class TooltipTrigger(TooltipBaseComponent):
def create(
cls,
*children,
close_on_click: Var[bool] | bool | None = None,
delay: Var[int] | int | None = None,
close_delay: Var[int] | int | None = None,
render_: Component | Var[Component] | None = None,
Expand Down
2 changes: 1 addition & 1 deletion reflex_ui/components/base_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from reflex_ui.components.component import CoreComponent

PACKAGE_NAME = "@base-ui/react"
PACKAGE_VERSION = "1.2.0"
PACKAGE_VERSION = "1.3.0"


class BaseUIComponent(CoreComponent):
Expand Down
2 changes: 1 addition & 1 deletion reflex_ui/components/base_ui.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ from reflex.vars.base import Var
from reflex_ui.components.component import CoreComponent

PACKAGE_NAME = "@base-ui/react"
PACKAGE_VERSION = "1.2.0"
PACKAGE_VERSION = "1.3.0"

class BaseUIComponent(CoreComponent):
@classmethod
Expand Down
Loading