|
@@ -7,12 +7,12 @@ from typing import Any, Dict, Literal, Optional, Union, overload
|
|
|
from reflex.vars import Var, BaseVar, ComputedVar
|
|
|
from reflex.event import EventChain, EventHandler, EventSpec
|
|
|
from reflex.style import Style
|
|
|
-from typing import Optional, Union
|
|
|
+from typing import Optional
|
|
|
from reflex.components.component import Component, ComponentNamespace
|
|
|
from reflex.components.core.colors import color
|
|
|
from reflex.components.radix.primitives.accordion import DEFAULT_ANIMATION_DURATION
|
|
|
from reflex.components.radix.primitives.base import RadixPrimitiveComponentWithClassName
|
|
|
-from reflex.components.radix.themes.base import LiteralAccentColor
|
|
|
+from reflex.components.radix.themes.base import LiteralAccentColor, LiteralRadius
|
|
|
from reflex.style import Style
|
|
|
from reflex.vars import Var
|
|
|
|
|
@@ -103,8 +103,12 @@ class ProgressRoot(ProgressComponent):
|
|
|
def create( # type: ignore
|
|
|
cls,
|
|
|
*children,
|
|
|
- value: Optional[Union[Var[Optional[int]], Optional[int]]] = None,
|
|
|
- max: Optional[Union[Var[int], int]] = None,
|
|
|
+ radius: Optional[
|
|
|
+ Union[
|
|
|
+ Var[Literal["none", "small", "medium", "large", "full"]],
|
|
|
+ Literal["none", "small", "medium", "large", "full"],
|
|
|
+ ]
|
|
|
+ ] = None,
|
|
|
as_child: Optional[Union[Var[bool], bool]] = None,
|
|
|
style: Optional[Style] = None,
|
|
|
key: Optional[Any] = None,
|
|
@@ -163,8 +167,7 @@ class ProgressRoot(ProgressComponent):
|
|
|
|
|
|
Args:
|
|
|
*children: The children of the component.
|
|
|
- value: The current progress value.
|
|
|
- max: The maximum progress value.
|
|
|
+ radius: Override theme radius for progress bar: "none" | "small" | "medium" | "large" | "full"
|
|
|
as_child: Change the default rendered element for the one passed as a child.
|
|
|
style: The style of the component.
|
|
|
key: A unique key for the component.
|
|
@@ -330,15 +333,307 @@ class ProgressIndicator(ProgressComponent):
|
|
|
"""
|
|
|
...
|
|
|
|
|
|
-class Progress(ComponentNamespace):
|
|
|
+class Progress(ProgressRoot):
|
|
|
+ @overload
|
|
|
+ @classmethod
|
|
|
+ def create( # type: ignore
|
|
|
+ cls,
|
|
|
+ *children,
|
|
|
+ color_scheme: Optional[
|
|
|
+ Union[
|
|
|
+ Var[
|
|
|
+ Literal[
|
|
|
+ "tomato",
|
|
|
+ "red",
|
|
|
+ "ruby",
|
|
|
+ "crimson",
|
|
|
+ "pink",
|
|
|
+ "plum",
|
|
|
+ "purple",
|
|
|
+ "violet",
|
|
|
+ "iris",
|
|
|
+ "indigo",
|
|
|
+ "blue",
|
|
|
+ "cyan",
|
|
|
+ "teal",
|
|
|
+ "jade",
|
|
|
+ "green",
|
|
|
+ "grass",
|
|
|
+ "brown",
|
|
|
+ "orange",
|
|
|
+ "sky",
|
|
|
+ "mint",
|
|
|
+ "lime",
|
|
|
+ "yellow",
|
|
|
+ "amber",
|
|
|
+ "gold",
|
|
|
+ "bronze",
|
|
|
+ "gray",
|
|
|
+ ]
|
|
|
+ ],
|
|
|
+ Literal[
|
|
|
+ "tomato",
|
|
|
+ "red",
|
|
|
+ "ruby",
|
|
|
+ "crimson",
|
|
|
+ "pink",
|
|
|
+ "plum",
|
|
|
+ "purple",
|
|
|
+ "violet",
|
|
|
+ "iris",
|
|
|
+ "indigo",
|
|
|
+ "blue",
|
|
|
+ "cyan",
|
|
|
+ "teal",
|
|
|
+ "jade",
|
|
|
+ "green",
|
|
|
+ "grass",
|
|
|
+ "brown",
|
|
|
+ "orange",
|
|
|
+ "sky",
|
|
|
+ "mint",
|
|
|
+ "lime",
|
|
|
+ "yellow",
|
|
|
+ "amber",
|
|
|
+ "gold",
|
|
|
+ "bronze",
|
|
|
+ "gray",
|
|
|
+ ],
|
|
|
+ ]
|
|
|
+ ] = None,
|
|
|
+ value: Optional[Union[Var[Optional[int]], Optional[int]]] = None,
|
|
|
+ max: Optional[Union[Var[Optional[int]], Optional[int]]] = None,
|
|
|
+ radius: Optional[
|
|
|
+ Union[
|
|
|
+ Var[Literal["none", "small", "medium", "large", "full"]],
|
|
|
+ Literal["none", "small", "medium", "large", "full"],
|
|
|
+ ]
|
|
|
+ ] = None,
|
|
|
+ as_child: Optional[Union[Var[bool], bool]] = None,
|
|
|
+ style: Optional[Style] = None,
|
|
|
+ key: Optional[Any] = None,
|
|
|
+ id: Optional[Any] = None,
|
|
|
+ class_name: Optional[Any] = None,
|
|
|
+ autofocus: Optional[bool] = None,
|
|
|
+ custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
|
|
|
+ on_blur: Optional[
|
|
|
+ Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
|
+ ] = None,
|
|
|
+ on_click: Optional[
|
|
|
+ Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
|
+ ] = None,
|
|
|
+ on_context_menu: Optional[
|
|
|
+ Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
|
+ ] = None,
|
|
|
+ on_double_click: Optional[
|
|
|
+ Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
|
+ ] = None,
|
|
|
+ on_focus: Optional[
|
|
|
+ Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
|
+ ] = None,
|
|
|
+ on_mount: Optional[
|
|
|
+ Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
|
+ ] = None,
|
|
|
+ on_mouse_down: Optional[
|
|
|
+ Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
|
+ ] = None,
|
|
|
+ on_mouse_enter: Optional[
|
|
|
+ Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
|
+ ] = None,
|
|
|
+ on_mouse_leave: Optional[
|
|
|
+ Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
|
+ ] = None,
|
|
|
+ on_mouse_move: Optional[
|
|
|
+ Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
|
+ ] = None,
|
|
|
+ on_mouse_out: Optional[
|
|
|
+ Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
|
+ ] = None,
|
|
|
+ on_mouse_over: Optional[
|
|
|
+ Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
|
+ ] = None,
|
|
|
+ on_mouse_up: Optional[
|
|
|
+ Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
|
+ ] = None,
|
|
|
+ on_scroll: Optional[
|
|
|
+ Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
|
+ ] = None,
|
|
|
+ on_unmount: Optional[
|
|
|
+ Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
|
+ ] = None,
|
|
|
+ **props
|
|
|
+ ) -> "Progress":
|
|
|
+ """High-level API for progress bar.
|
|
|
+
|
|
|
+ Args:
|
|
|
+ color_scheme: Override theme color for progress bar indicator
|
|
|
+ value: The current progress value.
|
|
|
+ max: The maximum progress value.
|
|
|
+ radius: Override theme radius for progress bar: "none" | "small" | "medium" | "large" | "full"
|
|
|
+ as_child: Change the default rendered element for the one passed as a child.
|
|
|
+ style: The style of the component.
|
|
|
+ key: A unique key for the component.
|
|
|
+ id: The id for the component.
|
|
|
+ class_name: The class name for the component.
|
|
|
+ autofocus: Whether the component should take the focus once the page is loaded
|
|
|
+ custom_attrs: custom attribute
|
|
|
+ **props: The props of the progress bar.
|
|
|
+
|
|
|
+ Returns:
|
|
|
+ The progress bar.
|
|
|
+ """
|
|
|
+ ...
|
|
|
+
|
|
|
+class ProgressNamespace(ComponentNamespace):
|
|
|
root = staticmethod(ProgressRoot.create)
|
|
|
indicator = staticmethod(ProgressIndicator.create)
|
|
|
|
|
|
@staticmethod
|
|
|
def __call__(
|
|
|
- width: Optional[str] = "100%",
|
|
|
- color_scheme: Optional[Union[Var, LiteralAccentColor]] = None,
|
|
|
+ *children,
|
|
|
+ color_scheme: Optional[
|
|
|
+ Union[
|
|
|
+ Var[
|
|
|
+ Literal[
|
|
|
+ "tomato",
|
|
|
+ "red",
|
|
|
+ "ruby",
|
|
|
+ "crimson",
|
|
|
+ "pink",
|
|
|
+ "plum",
|
|
|
+ "purple",
|
|
|
+ "violet",
|
|
|
+ "iris",
|
|
|
+ "indigo",
|
|
|
+ "blue",
|
|
|
+ "cyan",
|
|
|
+ "teal",
|
|
|
+ "jade",
|
|
|
+ "green",
|
|
|
+ "grass",
|
|
|
+ "brown",
|
|
|
+ "orange",
|
|
|
+ "sky",
|
|
|
+ "mint",
|
|
|
+ "lime",
|
|
|
+ "yellow",
|
|
|
+ "amber",
|
|
|
+ "gold",
|
|
|
+ "bronze",
|
|
|
+ "gray",
|
|
|
+ ]
|
|
|
+ ],
|
|
|
+ Literal[
|
|
|
+ "tomato",
|
|
|
+ "red",
|
|
|
+ "ruby",
|
|
|
+ "crimson",
|
|
|
+ "pink",
|
|
|
+ "plum",
|
|
|
+ "purple",
|
|
|
+ "violet",
|
|
|
+ "iris",
|
|
|
+ "indigo",
|
|
|
+ "blue",
|
|
|
+ "cyan",
|
|
|
+ "teal",
|
|
|
+ "jade",
|
|
|
+ "green",
|
|
|
+ "grass",
|
|
|
+ "brown",
|
|
|
+ "orange",
|
|
|
+ "sky",
|
|
|
+ "mint",
|
|
|
+ "lime",
|
|
|
+ "yellow",
|
|
|
+ "amber",
|
|
|
+ "gold",
|
|
|
+ "bronze",
|
|
|
+ "gray",
|
|
|
+ ],
|
|
|
+ ]
|
|
|
+ ] = None,
|
|
|
+ value: Optional[Union[Var[Optional[int]], Optional[int]]] = None,
|
|
|
+ max: Optional[Union[Var[Optional[int]], Optional[int]]] = None,
|
|
|
+ radius: Optional[
|
|
|
+ Union[
|
|
|
+ Var[Literal["none", "small", "medium", "large", "full"]],
|
|
|
+ Literal["none", "small", "medium", "large", "full"],
|
|
|
+ ]
|
|
|
+ ] = None,
|
|
|
+ as_child: Optional[Union[Var[bool], bool]] = None,
|
|
|
+ style: Optional[Style] = None,
|
|
|
+ key: Optional[Any] = None,
|
|
|
+ id: Optional[Any] = None,
|
|
|
+ class_name: Optional[Any] = None,
|
|
|
+ autofocus: Optional[bool] = None,
|
|
|
+ custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
|
|
|
+ on_blur: Optional[
|
|
|
+ Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
|
+ ] = None,
|
|
|
+ on_click: Optional[
|
|
|
+ Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
|
+ ] = None,
|
|
|
+ on_context_menu: Optional[
|
|
|
+ Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
|
+ ] = None,
|
|
|
+ on_double_click: Optional[
|
|
|
+ Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
|
+ ] = None,
|
|
|
+ on_focus: Optional[
|
|
|
+ Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
|
+ ] = None,
|
|
|
+ on_mount: Optional[
|
|
|
+ Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
|
+ ] = None,
|
|
|
+ on_mouse_down: Optional[
|
|
|
+ Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
|
+ ] = None,
|
|
|
+ on_mouse_enter: Optional[
|
|
|
+ Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
|
+ ] = None,
|
|
|
+ on_mouse_leave: Optional[
|
|
|
+ Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
|
+ ] = None,
|
|
|
+ on_mouse_move: Optional[
|
|
|
+ Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
|
+ ] = None,
|
|
|
+ on_mouse_out: Optional[
|
|
|
+ Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
|
+ ] = None,
|
|
|
+ on_mouse_over: Optional[
|
|
|
+ Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
|
+ ] = None,
|
|
|
+ on_mouse_up: Optional[
|
|
|
+ Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
|
+ ] = None,
|
|
|
+ on_scroll: Optional[
|
|
|
+ Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
|
+ ] = None,
|
|
|
+ on_unmount: Optional[
|
|
|
+ Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
|
+ ] = None,
|
|
|
**props
|
|
|
- ) -> Component: ...
|
|
|
+ ) -> "Progress":
|
|
|
+ """High-level API for progress bar.
|
|
|
+
|
|
|
+ Args:
|
|
|
+ color_scheme: Override theme color for progress bar indicator
|
|
|
+ value: The current progress value.
|
|
|
+ max: The maximum progress value.
|
|
|
+ radius: Override theme radius for progress bar: "none" | "small" | "medium" | "large" | "full"
|
|
|
+ as_child: Change the default rendered element for the one passed as a child.
|
|
|
+ style: The style of the component.
|
|
|
+ key: A unique key for the component.
|
|
|
+ id: The id for the component.
|
|
|
+ class_name: The class name for the component.
|
|
|
+ autofocus: Whether the component should take the focus once the page is loaded
|
|
|
+ custom_attrs: custom attribute
|
|
|
+ **props: The props of the progress bar.
|
|
|
+
|
|
|
+ Returns:
|
|
|
+ The progress bar.
|
|
|
+ """
|
|
|
+ ...
|
|
|
|
|
|
-progress = Progress()
|
|
|
+progress = ProgressNamespace()
|