diff --git a/reflex_ui/components/base/select.py b/reflex_ui/components/base/select.py index a216f95..a6b7f2c 100644 --- a/reflex_ui/components/base/select.py +++ b/reflex_ui/components/base/select.py @@ -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" @@ -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.""" @@ -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) diff --git a/reflex_ui/components/base/select.pyi b/reflex_ui/components/base/select.pyi index 1bc20a2..1c3e93e 100644 --- a/reflex_ui/components/base/select.pyi +++ b/reflex_ui/components/base/select.pyi @@ -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" @@ -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( @@ -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) diff --git a/reflex_ui/components/base/slider.py b/reflex_ui/components/base/slider.py index 3172420..38c1906 100644 --- a/reflex_ui/components/base/slider.py +++ b/reflex_ui/components/base/slider.py @@ -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" @@ -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.""" @@ -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) diff --git a/reflex_ui/components/base/slider.pyi b/reflex_ui/components/base/slider.pyi index c09739a..72b9cf2 100644 --- a/reflex_ui/components/base/slider.pyi +++ b/reflex_ui/components/base/slider.pyi @@ -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" @@ -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( @@ -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) diff --git a/reflex_ui/components/base/tooltip.py b/reflex_ui/components/base/tooltip.py index 9ba3170..5479e9b 100644 --- a/reflex_ui/components/base/tooltip.py +++ b/reflex_ui/components/base/tooltip.py @@ -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] @@ -228,6 +231,7 @@ class HighLevelTooltip(TooltipRoot): "disable_hoverable_popup", } _trigger_props = { + "close_on_click", "delay", "close_delay", } diff --git a/reflex_ui/components/base/tooltip.pyi b/reflex_ui/components/base/tooltip.pyi index 0933ebe..6c9843e 100644 --- a/reflex_ui/components/base/tooltip.pyi +++ b/reflex_ui/components/base/tooltip.pyi @@ -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, diff --git a/reflex_ui/components/base_ui.py b/reflex_ui/components/base_ui.py index 7886975..b9fb7b9 100644 --- a/reflex_ui/components/base_ui.py +++ b/reflex_ui/components/base_ui.py @@ -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): diff --git a/reflex_ui/components/base_ui.pyi b/reflex_ui/components/base_ui.pyi index bac6c5a..335020e 100644 --- a/reflex_ui/components/base_ui.pyi +++ b/reflex_ui/components/base_ui.pyi @@ -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