From ab8b092e38c8a8c659660f7910564bd5f5434ca7 Mon Sep 17 00:00:00 2001 From: Elijah Date: Wed, 23 Oct 2024 13:03:33 +0000 Subject: [PATCH] fix counter tests --- reflex/components/radix/themes/color_mode.py | 6 +++--- reflex/components/radix/themes/color_mode.pyi | 10 +++++++++- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/reflex/components/radix/themes/color_mode.py b/reflex/components/radix/themes/color_mode.py index ab2304f75..ffb0ff750 100644 --- a/reflex/components/radix/themes/color_mode.py +++ b/reflex/components/radix/themes/color_mode.py @@ -17,7 +17,7 @@ rx.text( from __future__ import annotations -from typing import Dict, List, Literal, Optional, get_args +from typing import Dict, List, Literal, Optional, Union, get_args from reflex.components.component import BaseComponent from reflex.components.core.cond import Cond, color_mode_cond, cond @@ -97,7 +97,7 @@ class ColorModeIconButton(IconButton): """Icon Button for toggling light / dark mode via toggle_color_mode.""" # The position of the icon button. Follow document flow if None. - position: Optional[LiteralPosition] = None + position: Optional[Union[LiteralPosition, Var[LiteralPosition]]] = None # Allow picking the "system" value for the color mode. allow_system: bool = False @@ -160,7 +160,7 @@ class ColorModeIconButton(IconButton): color_mode_item("system"), ), ) - return super().create( + return IconButton.create( ColorModeIcon.create(), on_click=toggle_color_mode, **props, diff --git a/reflex/components/radix/themes/color_mode.pyi b/reflex/components/radix/themes/color_mode.pyi index e5c1131e4..7776a4274 100644 --- a/reflex/components/radix/themes/color_mode.pyi +++ b/reflex/components/radix/themes/color_mode.pyi @@ -76,7 +76,15 @@ class ColorModeIconButton(IconButton): cls, *children, position: Optional[ - Literal["bottom-left", "bottom-right", "top-left", "top-right"] + Union[ + Literal["bottom-left", "bottom-right", "top-left", "top-right"], + Union[ + Literal["bottom-left", "bottom-right", "top-left", "top-right"], + Var[ + Literal["bottom-left", "bottom-right", "top-left", "top-right"] + ], + ], + ] ] = None, allow_system: Optional[bool] = None, as_child: Optional[Union[Var[bool], bool]] = None,