From c6abeb31a5a4fd0a13e9959667eca9ecbaf65e74 Mon Sep 17 00:00:00 2001 From: Elijah Ahianyo Date: Mon, 16 Oct 2023 03:16:39 +0000 Subject: [PATCH] Props as Literals (#1921) --- reflex/components/component.py | 19 +- reflex/components/datadisplay/badge.py | 4 +- reflex/components/datadisplay/badge.pyi | 4 +- reflex/components/datadisplay/code.py | 6 +- reflex/components/datadisplay/code.pyi | 4 +- reflex/components/datadisplay/divider.py | 7 +- reflex/components/datadisplay/divider.pyi | 4 +- reflex/components/datadisplay/table.pyi | 5 +- reflex/components/datadisplay/tag.py | 15 +- reflex/components/datadisplay/tag.pyi | 4 +- reflex/components/disclosure/tabs.py | 13 +- reflex/components/disclosure/tabs.pyi | 4 +- reflex/components/feedback/alert.py | 10 +- reflex/components/feedback/alert.pyi | 4 +- .../components/feedback/circularprogress.py | 3 +- .../components/feedback/circularprogress.pyi | 3 +- reflex/components/feedback/progress.py | 2 +- reflex/components/feedback/progress.pyi | 2 +- reflex/components/feedback/spinner.py | 4 +- reflex/components/feedback/spinner.pyi | 4 +- reflex/components/forms/button.py | 22 +- reflex/components/forms/button.pyi | 11 +- reflex/components/forms/checkbox.py | 10 +- reflex/components/forms/checkbox.pyi | 4 +- reflex/components/forms/editor.py | 28 +- reflex/components/forms/editor.pyi | 2 +- reflex/components/forms/input.py | 10 +- reflex/components/forms/input.pyi | 4 +- reflex/components/forms/numberinput.py | 9 +- reflex/components/forms/numberinput.pyi | 51 +- reflex/components/forms/pininput.py | 4 +- reflex/components/forms/pininput.pyi | 4 +- reflex/components/forms/rangeslider.py | 4 +- reflex/components/forms/rangeslider.pyi | 4 +- reflex/components/forms/select.py | 4 +- reflex/components/forms/select.pyi | 4 +- reflex/components/forms/slider.py | 7 +- reflex/components/forms/slider.pyi | 4 +- reflex/components/forms/switch.py | 4 +- reflex/components/forms/switch.pyi | 4 +- reflex/components/forms/textarea.py | 4 +- reflex/components/forms/textarea.pyi | 4 +- .../components/graphing/recharts/__init__.py | 26 + .../components/graphing/recharts/cartesian.py | 50 +- .../graphing/recharts/cartesian.pyi | 471 ++++++++++++++++++ reflex/components/graphing/recharts/charts.py | 29 +- .../components/graphing/recharts/charts.pyi | 240 +++++++++ .../components/graphing/recharts/general.py | 23 +- .../components/graphing/recharts/general.pyi | 134 +++++ reflex/components/graphing/recharts/polar.py | 16 +- reflex/components/graphing/recharts/polar.pyi | 185 +++++++ .../components/graphing/recharts/recharts.py | 105 +++- .../components/graphing/recharts/recharts.pyi | 148 ++++++ reflex/components/layout/card.py | 15 +- reflex/components/layout/card.pyi | 4 +- reflex/components/layout/stack.py | 6 +- reflex/components/layout/stack.pyi | 4 +- reflex/components/libs/__init__.py | 30 ++ reflex/components/libs/chakra.py | 105 ++++ reflex/components/libs/chakra.pyi | 103 +++- reflex/components/media/avatar.py | 4 +- reflex/components/media/avatar.pyi | 4 +- reflex/components/media/image.py | 4 +- reflex/components/media/image.pyi | 15 +- reflex/components/navigation/stepper.py | 4 +- reflex/components/navigation/stepper.pyi | 4 +- reflex/components/overlay/alertdialog.py | 4 +- reflex/components/overlay/alertdialog.pyi | 4 +- reflex/components/overlay/drawer.py | 14 +- reflex/components/overlay/drawer.pyi | 60 +-- reflex/components/overlay/menu.py | 15 +- reflex/components/overlay/menu.pyi | 20 +- reflex/components/overlay/modal.py | 4 +- reflex/components/overlay/modal.pyi | 4 +- reflex/components/overlay/popover.py | 13 +- reflex/components/overlay/popover.pyi | 4 +- reflex/components/overlay/tooltip.py | 4 +- reflex/components/overlay/tooltip.pyi | 4 +- reflex/components/typography/heading.py | 5 +- reflex/components/typography/heading.pyi | 4 +- reflex/utils/types.py | 24 +- scripts/pyi_generator.py | 92 +++- tests/utils/test_utils.py | 12 +- 83 files changed, 2070 insertions(+), 269 deletions(-) create mode 100644 reflex/components/graphing/recharts/cartesian.pyi create mode 100644 reflex/components/graphing/recharts/charts.pyi create mode 100644 reflex/components/graphing/recharts/general.pyi create mode 100644 reflex/components/graphing/recharts/polar.pyi create mode 100644 reflex/components/graphing/recharts/recharts.pyi diff --git a/reflex/components/component.py b/reflex/components/component.py index 300bad3de..93978045b 100644 --- a/reflex/components/component.py +++ b/reflex/components/component.py @@ -106,6 +106,7 @@ class Component(Base, ABC): Raises: TypeError: If an invalid prop is passed. + ValueError: If a prop value is invalid. """ # Set the id and children initially. children = kwargs.get("children", []) @@ -154,9 +155,25 @@ class Component(Base, ABC): if kwargs[key] is None: raise TypeError + expected_type = fields[key].outer_type_.__args__[0] + + if ( + types.is_literal(expected_type) + and value not in expected_type.__args__ + ): + allowed_values = expected_type.__args__ + if value not in allowed_values: + raise ValueError( + f"prop value for {key} of the `{type(self).__name__}` component should be one of the following: {','.join(allowed_values)}. Got '{value}' instead" + ) + # Get the passed type and the var type. passed_type = kwargs[key]._var_type - expected_type = fields[key].outer_type_.__args__[0] + expected_type = ( + type(expected_type.__args__[0]) + if types.is_literal(expected_type) + else expected_type + ) except TypeError: # If it is not a valid var, check the base types. passed_type = type(value) diff --git a/reflex/components/datadisplay/badge.py b/reflex/components/datadisplay/badge.py index 743aba0c8..f1216782f 100644 --- a/reflex/components/datadisplay/badge.py +++ b/reflex/components/datadisplay/badge.py @@ -1,6 +1,6 @@ """Badge component.""" -from reflex.components.libs.chakra import ChakraComponent +from reflex.components.libs.chakra import ChakraComponent, LiteralVariant from reflex.vars import Var @@ -10,7 +10,7 @@ class Badge(ChakraComponent): tag = "Badge" # Variant of the badge ("solid" | "subtle" | "outline") - variant: Var[str] + variant: Var[LiteralVariant] # The color of the badge color_scheme: Var[str] diff --git a/reflex/components/datadisplay/badge.pyi b/reflex/components/datadisplay/badge.pyi index 975fa74dc..6b61671a0 100644 --- a/reflex/components/datadisplay/badge.pyi +++ b/reflex/components/datadisplay/badge.pyi @@ -3,7 +3,7 @@ # This file was generated by `scripts/pyi_generator.py`! # ------------------------------------------------------ -from typing import Optional, Union, overload +from typing import Literal, Optional, Union, overload from reflex.components.libs.chakra import ChakraComponent from reflex.components.component import Component from reflex.vars import Var, BaseVar, ComputedVar @@ -12,7 +12,7 @@ from reflex.event import EventHandler, EventChain, EventSpec class Badge(ChakraComponent): @overload @classmethod - def create(cls, *children, variant: Optional[Union[Var[str], str]] = None, color_scheme: Optional[Union[Var[str], 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) -> "Badge": # type: ignore + def create(cls, *children, variant: Optional[Union[Var[Literal["solid", "subtle", "outline"]], Literal["solid", "subtle", "outline"]]] = None, color_scheme: Optional[Union[Var[str], 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) -> "Badge": # type: ignore """Create the component. Args: diff --git a/reflex/components/datadisplay/code.py b/reflex/components/datadisplay/code.py index 7ab991a12..ec3f4d316 100644 --- a/reflex/components/datadisplay/code.py +++ b/reflex/components/datadisplay/code.py @@ -5,7 +5,7 @@ from typing import Dict, Optional, Union from reflex.components.component import Component from reflex.components.forms import Button from reflex.components.layout import Box -from reflex.components.libs.chakra import ChakraComponent +from reflex.components.libs.chakra import ChakraComponent, LiteralTheme from reflex.components.media import Icon from reflex.event import set_clipboard from reflex.style import Style @@ -24,7 +24,7 @@ class CodeBlock(Component): tag = "Prism" # The theme to use ("light" or "dark"). - theme: Var[str] + theme: Var[LiteralTheme] # The language to use. language: Var[str] @@ -59,7 +59,7 @@ class CodeBlock(Component): *children, can_copy: Optional[bool] = False, copy_button: Optional[Union[bool, Component]] = None, - **props + **props, ): """Create a text component. diff --git a/reflex/components/datadisplay/code.pyi b/reflex/components/datadisplay/code.pyi index d0b129e9d..96a0cc6b8 100644 --- a/reflex/components/datadisplay/code.pyi +++ b/reflex/components/datadisplay/code.pyi @@ -3,7 +3,7 @@ # This file was generated by `scripts/pyi_generator.py`! # ------------------------------------------------------ -from typing import Dict, Optional, Union, overload +from typing import Dict, Literal, Optional, Union, overload from reflex.components.libs.chakra import ChakraComponent from reflex.components.component import Component from reflex.vars import Var, BaseVar, ComputedVar @@ -14,7 +14,7 @@ PRISM_STYLES_PATH: str class CodeBlock(Component): @overload @classmethod - def create(cls, *children, can_copy: Optional[bool] = None, copy_button: Optional[Union[bool, Component]] = None, theme: Optional[Union[Var[str], str]] = None, language: Optional[Union[Var[str], str]] = None, show_line_numbers: Optional[Union[Var[bool], bool]] = None, starting_line_number: Optional[Union[Var[int], int]] = None, wrap_long_lines: Optional[Union[Var[bool], bool]] = None, custom_style: Optional[Union[Var[Dict[str, str]], Dict[str, str]]] = None, code_tag_props: Optional[Union[Var[Dict[str, str]], Dict[str, 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) -> "CodeBlock": # type: ignore + def create(cls, *children, can_copy: Optional[bool] = None, copy_button: Optional[Union[bool, Component]] = None, theme: Optional[Union[Var[Literal["light", "dark"]], Literal["light", "dark"]]] = None, language: Optional[Union[Var[str], str]] = None, show_line_numbers: Optional[Union[Var[bool], bool]] = None, starting_line_number: Optional[Union[Var[int], int]] = None, wrap_long_lines: Optional[Union[Var[bool], bool]] = None, custom_style: Optional[Dict[str, str]] = None, code_tag_props: Optional[Union[Var[Dict[str, str]], Dict[str, 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) -> "CodeBlock": # type: ignore """Create a text component. Args: diff --git a/reflex/components/datadisplay/divider.py b/reflex/components/datadisplay/divider.py index 4af9d1920..3b481eb7e 100644 --- a/reflex/components/datadisplay/divider.py +++ b/reflex/components/datadisplay/divider.py @@ -1,6 +1,7 @@ """A line to divide parts of the layout.""" -from reflex.components.libs.chakra import ChakraComponent +from reflex.components.graphing.recharts.recharts import LiteralLayout +from reflex.components.libs.chakra import ChakraComponent, LiteralDividerVariant from reflex.vars import Var @@ -10,7 +11,7 @@ class Divider(ChakraComponent): tag = "Divider" # Pass the orientation prop and set it to either horizontal or vertical. If the vertical orientation is used, make sure that the parent element is assigned a height. - orientation: Var[str] + orientation: Var[LiteralLayout] # Variant of the divider ("solid" | "dashed") - variant: Var[str] + variant: Var[LiteralDividerVariant] diff --git a/reflex/components/datadisplay/divider.pyi b/reflex/components/datadisplay/divider.pyi index 339bdc611..f4fd15501 100644 --- a/reflex/components/datadisplay/divider.pyi +++ b/reflex/components/datadisplay/divider.pyi @@ -3,7 +3,7 @@ # This file was generated by `scripts/pyi_generator.py`! # ------------------------------------------------------ -from typing import Optional, Union, overload +from typing import Literal, Optional, Union, overload from reflex.components.libs.chakra import ChakraComponent from reflex.components.component import Component from reflex.vars import Var, BaseVar, ComputedVar @@ -12,7 +12,7 @@ from reflex.event import EventHandler, EventChain, EventSpec class Divider(ChakraComponent): @overload @classmethod - def create(cls, *children, orientation: Optional[Union[Var[str], str]] = None, variant: Optional[Union[Var[str], 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) -> "Divider": # type: ignore + def create(cls, *children, orientation: Optional[Union[Var[Literal["horizontal", "vertical"]], Literal["horizontal", "vertical"]]] = None, variant: Optional[Union[Var[Literal["solid", "dashed"]], Literal["solid", "dashed"]]] = 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) -> "Divider": # type: ignore """Create the component. Args: diff --git a/reflex/components/datadisplay/table.pyi b/reflex/components/datadisplay/table.pyi index 8642cdacf..89caf3abc 100644 --- a/reflex/components/datadisplay/table.pyi +++ b/reflex/components/datadisplay/table.pyi @@ -3,7 +3,7 @@ # This file was generated by `scripts/pyi_generator.py`! # ------------------------------------------------------ -from typing import List, Optional, Union, overload +from typing import List, Optional, Tuple, Union, overload from reflex.components.libs.chakra import ChakraComponent from reflex.components.component import Component from reflex.vars import Var, BaseVar, ComputedVar @@ -46,6 +46,7 @@ class Thead(ChakraComponent): Returns: The table header component. + """ ... @@ -62,7 +63,7 @@ class Tbody(ChakraComponent): **props: The properties of the component. Returns: - Component: _description_ + Component: The table body component """ ... diff --git a/reflex/components/datadisplay/tag.py b/reflex/components/datadisplay/tag.py index 25f0ae310..dff02eac1 100644 --- a/reflex/components/datadisplay/tag.py +++ b/reflex/components/datadisplay/tag.py @@ -2,7 +2,12 @@ from typing import Optional from reflex.components.component import Component -from reflex.components.libs.chakra import ChakraComponent +from reflex.components.libs.chakra import ( + ChakraComponent, + LiteralTagColorScheme, + LiteralTagSize, + LiteralVariant, +) from reflex.vars import Var @@ -39,17 +44,17 @@ class Tag(ChakraComponent): # options: "gray" | "red" | "orange" | "yellow" | "green" | "teal" | "blue" | # "cyan" | "purple" | "pink" # default: "gray" - color_scheme: Var[str] + color_scheme: Var[LiteralTagColorScheme] # The size of the tag # options: "sm" | "md" | "lg" # default: "md" - size: Var[str] + size: Var[LiteralTagSize] # The variant of the tag # options: "solid" | "subtle" | "outline" # default: "solid" - variant: Var[str] + variant: Var[LiteralVariant] @classmethod def create( @@ -59,7 +64,7 @@ class Tag(ChakraComponent): left_icon: Optional[Component] = None, right_icon: Optional[Component] = None, close_button: Optional[Component] = None, - **props + **props, ) -> Component: """Creates a Chakra Tag with a label and optionally left_icon, right_icon, and close_button, and returns it. diff --git a/reflex/components/datadisplay/tag.pyi b/reflex/components/datadisplay/tag.pyi index a6e8e4d6f..e2db29422 100644 --- a/reflex/components/datadisplay/tag.pyi +++ b/reflex/components/datadisplay/tag.pyi @@ -3,7 +3,7 @@ # This file was generated by `scripts/pyi_generator.py`! # ------------------------------------------------------ -from typing import Optional, Union, overload +from typing import Literal, Optional, Union, overload from reflex.components.libs.chakra import ChakraComponent from reflex.components.component import Component from reflex.vars import Var, BaseVar, ComputedVar @@ -84,7 +84,7 @@ class TagCloseButton(ChakraComponent): class Tag(ChakraComponent): @overload @classmethod - def create(cls, *children, left_icon: Optional[Component] = None, right_icon: Optional[Component] = None, close_button: Optional[Component] = None, color_scheme: Optional[Union[Var[str], str]] = None, size: Optional[Union[Var[str], str]] = None, variant: Optional[Union[Var[str], 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) -> "Tag": # type: ignore + def create(cls, *children, left_icon: Optional[Component] = None, right_icon: Optional[Component] = None, close_button: Optional[Component] = None, color_scheme: Optional[Union[Var[Literal["gray", "red", "orange", "yellow", "green", "teal", "blue", "cyan", "purple", "pink"]], Literal["gray", "red", "orange", "yellow", "green", "teal", "blue", "cyan", "purple", "pink"]]] = None, size: Optional[Union[Var[Literal["sm", "md", "lg"]], Literal["sm", "md", "lg"]]] = None, variant: Optional[Union[Var[Literal["solid", "subtle", "outline"]], Literal["solid", "subtle", "outline"]]] = 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) -> "Tag": # type: ignore """Creates a Chakra Tag with a label and optionally left_icon, right_icon, and close_button, and returns it. Args: diff --git a/reflex/components/disclosure/tabs.py b/reflex/components/disclosure/tabs.py index 934ae03b9..53b7dccce 100644 --- a/reflex/components/disclosure/tabs.py +++ b/reflex/components/disclosure/tabs.py @@ -3,7 +3,12 @@ from typing import List, Optional, Tuple from reflex.components.component import Component -from reflex.components.libs.chakra import ChakraComponent +from reflex.components.libs.chakra import ( + ChakraComponent, + LiteralColorScheme, + LiteralTabsVariant, + LiteralTagAlign, +) from reflex.vars import Var @@ -13,7 +18,7 @@ class Tabs(ChakraComponent): tag = "Tabs" # The alignment of the tabs ("center" | "end" | "start"). - align: Var[str] + align: Var[LiteralTagAlign] # The initial index of the selected tab (in uncontrolled mode). default_index: Var[int] @@ -34,10 +39,10 @@ class Tabs(ChakraComponent): orientation: Var[str] # "line" | "enclosed" | "enclosed-colored" | "soft-rounded" | "solid-rounded" | "unstyled" - variant: Var[str] + variant: Var[LiteralTabsVariant] # The color scheme of the tabs. - color_scheme: Var[str] + color_scheme: Var[LiteralColorScheme] @classmethod def create( diff --git a/reflex/components/disclosure/tabs.pyi b/reflex/components/disclosure/tabs.pyi index dde3ebd7d..4f2b85c65 100644 --- a/reflex/components/disclosure/tabs.pyi +++ b/reflex/components/disclosure/tabs.pyi @@ -3,7 +3,7 @@ # This file was generated by `scripts/pyi_generator.py`! # ------------------------------------------------------ -from typing import List, Optional, Tuple, Union, overload +from typing import List, Literal, Optional, Tuple, Union, overload from reflex.components.libs.chakra import ChakraComponent from reflex.components.component import Component from reflex.vars import Var, BaseVar, ComputedVar @@ -12,7 +12,7 @@ from reflex.event import EventHandler, EventChain, EventSpec class Tabs(ChakraComponent): @overload @classmethod - def create(cls, *children, items: Optional[List[Tuple[str, str]]] = None, align: Optional[Union[Var[str], str]] = None, default_index: Optional[Union[Var[int], int]] = None, id_: Optional[Union[Var[str], str]] = None, is_fitted: Optional[Union[Var[bool], bool]] = None, is_lazy: Optional[Union[Var[bool], bool]] = None, is_manual: Optional[Union[Var[bool], bool]] = None, orientation: Optional[Union[Var[str], str]] = None, variant: Optional[Union[Var[str], str]] = None, color_scheme: Optional[Union[Var[str], 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) -> "Tabs": # type: ignore + def create(cls, *children, items: Optional[List[Tuple[str, str]]] = None, align: Optional[Union[Var[Literal["center", "end", "start"]], Literal["center", "end", "start"]]] = None, default_index: Optional[Union[Var[int], int]] = None, id_: Optional[Union[Var[str], str]] = None, is_fitted: Optional[Union[Var[bool], bool]] = None, is_lazy: Optional[Union[Var[bool], bool]] = None, is_manual: Optional[Union[Var[bool], bool]] = None, orientation: Optional[Union[Var[str], str]] = None, variant: Optional[Union[Var[Literal["line", "enclosed", "enclosed-colored", "soft-rounded", "solid-rounded", "unstyled"]], Literal["line", "enclosed", "enclosed-colored", "soft-rounded", "solid-rounded", "unstyled"]]] = None, color_scheme: Optional[Union[Var[Literal["gray", "red", "orange", "yellow", "green", "teal", "blue", "cyan", "purple", "pink", "whiteAlpha", "blackAlpha", "linkedin", "facebook", "messenger", "whatsapp", "twitter", "telegram"]], Literal["gray", "red", "orange", "yellow", "green", "teal", "blue", "cyan", "purple", "pink", "whiteAlpha", "blackAlpha", "linkedin", "facebook", "messenger", "whatsapp", "twitter", "telegram"]]] = 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) -> "Tabs": # type: ignore """Create a tab component. Args: diff --git a/reflex/components/feedback/alert.py b/reflex/components/feedback/alert.py index 2bb891d96..6553d0023 100644 --- a/reflex/components/feedback/alert.py +++ b/reflex/components/feedback/alert.py @@ -1,7 +1,11 @@ """Alert components.""" from reflex.components.component import Component -from reflex.components.libs.chakra import ChakraComponent +from reflex.components.libs.chakra import ( + ChakraComponent, + LiteralAlertVariant, + LiteralStatus, +) from reflex.vars import Var @@ -11,10 +15,10 @@ class Alert(ChakraComponent): tag = "Alert" # The status of the alert ("success" | "info" | "warning" | "error") - status: Var[str] + status: Var[LiteralStatus] # "subtle" | "left-accent" | "top-accent" | "solid" - variant: Var[str] + variant: Var[LiteralAlertVariant] @classmethod def create( diff --git a/reflex/components/feedback/alert.pyi b/reflex/components/feedback/alert.pyi index 66cf61124..1dddf691d 100644 --- a/reflex/components/feedback/alert.pyi +++ b/reflex/components/feedback/alert.pyi @@ -3,7 +3,7 @@ # This file was generated by `scripts/pyi_generator.py`! # ------------------------------------------------------ -from typing import Optional, Union, overload +from typing import Literal, Optional, Union, overload from reflex.components.libs.chakra import ChakraComponent from reflex.components.component import Component from reflex.vars import Var, BaseVar, ComputedVar @@ -12,7 +12,7 @@ from reflex.event import EventHandler, EventChain, EventSpec class Alert(ChakraComponent): @overload @classmethod - def create(cls, *children, icon, title, desc, status: Optional[Union[Var[str], str]] = None, variant: Optional[Union[Var[str], 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) -> "Alert": # type: ignore + def create(cls, *children, icon, title, desc, status: Optional[Union[Var[Literal["success", "info", "warning", "error"]], Literal["success", "info", "warning", "error"]]] = None, variant: Optional[Union[Var[Literal["subtle", "left-accent", "top-accent", "solid"]], Literal["subtle", "left-accent", "top-accent", "solid"]]] = 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) -> "Alert": # type: ignore """Create an alert component. Args: diff --git a/reflex/components/feedback/circularprogress.py b/reflex/components/feedback/circularprogress.py index 724b8c615..e0e9ad92b 100644 --- a/reflex/components/feedback/circularprogress.py +++ b/reflex/components/feedback/circularprogress.py @@ -1,4 +1,5 @@ """Container to stack elements with spacing.""" +from typing import Union from reflex.components.component import Component from reflex.components.libs.chakra import ChakraComponent @@ -23,7 +24,7 @@ class CircularProgress(ChakraComponent): min_: Var[int] # This defines the stroke width of the svg circle. - thickness: Var[str] + thickness: Var[Union[str, int]] # The color name of the progress track. Use a color key in the theme object track_color: Var[str] diff --git a/reflex/components/feedback/circularprogress.pyi b/reflex/components/feedback/circularprogress.pyi index 7ddf342fd..50f5d67a8 100644 --- a/reflex/components/feedback/circularprogress.pyi +++ b/reflex/components/feedback/circularprogress.pyi @@ -12,7 +12,7 @@ from reflex.event import EventHandler, EventChain, EventSpec class CircularProgress(ChakraComponent): @overload @classmethod - def create(cls, *children, label, cap_is_round: Optional[Union[Var[bool], bool]] = None, is_indeterminate: Optional[Union[Var[bool], bool]] = None, max_: Optional[Union[Var[int], int]] = None, min_: Optional[Union[Var[int], int]] = None, thickness: Optional[Union[Var[int], int]] = None, track_color: Optional[Union[Var[str], str]] = None, value: Optional[Union[Var[int], int]] = None, value_text: Optional[Union[Var[str], str]] = None, color: Optional[Union[Var[str], 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) -> "CircularProgress": # type: ignore + def create(cls, *children, label, cap_is_round: Optional[Union[Var[bool], bool]] = None, is_indeterminate: Optional[Union[Var[bool], bool]] = None, max_: Optional[Union[Var[int], int]] = None, min_: Optional[Union[Var[int], int]] = None, thickness: Optional[Union[Var[Union[str, int]], Union[str, int]]] = None, track_color: Optional[Union[Var[str], str]] = None, value: Optional[Union[Var[int], int]] = None, value_text: Optional[Union[Var[str], str]] = None, color: Optional[Union[Var[str], str]] = None, size: Optional[Union[Var[str], 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) -> "CircularProgress": # type: ignore """Create a circular progress component. Args: @@ -26,6 +26,7 @@ class CircularProgress(ChakraComponent): value: Current progress (must be between min/max). value_text: The desired valueText to use in place of the value. color: The color name of the progress bar + size: The size of the circular progress label: A label to add in the circular progress. Defaults to None. **props: the props of the component. diff --git a/reflex/components/feedback/progress.py b/reflex/components/feedback/progress.py index c0ac3bd17..17406c8db 100644 --- a/reflex/components/feedback/progress.py +++ b/reflex/components/feedback/progress.py @@ -14,7 +14,7 @@ class Progress(ChakraComponent): # If true, the progress bar will show stripe has_stripe: Var[bool] - # If true, and hasStripe is true, the stripes will be animated + # If true, and has_stripe is true, the stripes will be animated is_animated: Var[bool] # If true, the progress will be indeterminate and the value prop will be ignored diff --git a/reflex/components/feedback/progress.pyi b/reflex/components/feedback/progress.pyi index 46c791cd6..409730b09 100644 --- a/reflex/components/feedback/progress.pyi +++ b/reflex/components/feedback/progress.pyi @@ -18,7 +18,7 @@ class Progress(ChakraComponent): Args: *children: The children of the component. has_stripe: If true, the progress bar will show stripe - is_animated: If true, and hasStripe is true, the stripes will be animated + is_animated: If true, and has_stripe is true, the stripes will be animated is_indeterminate: If true, the progress will be indeterminate and the value prop will be ignored max_: The maximum value of the progress min_: The minimum value of the progress diff --git a/reflex/components/feedback/spinner.py b/reflex/components/feedback/spinner.py index 573c9e2c5..ef3de5498 100644 --- a/reflex/components/feedback/spinner.py +++ b/reflex/components/feedback/spinner.py @@ -1,6 +1,6 @@ """Container to stack elements with spacing.""" -from reflex.components.libs.chakra import ChakraComponent +from reflex.components.libs.chakra import ChakraComponent, LiteralSpinnerSize from reflex.vars import Var @@ -22,4 +22,4 @@ class Spinner(ChakraComponent): thickness: Var[int] # "xs" | "sm" | "md" | "lg" | "xl" - size: Var[str] + size: Var[LiteralSpinnerSize] diff --git a/reflex/components/feedback/spinner.pyi b/reflex/components/feedback/spinner.pyi index b3bace614..655b03454 100644 --- a/reflex/components/feedback/spinner.pyi +++ b/reflex/components/feedback/spinner.pyi @@ -3,7 +3,7 @@ # This file was generated by `scripts/pyi_generator.py`! # ------------------------------------------------------ -from typing import Optional, Union, overload +from typing import Literal, Optional, Union, overload from reflex.components.libs.chakra import ChakraComponent from reflex.components.component import Component from reflex.vars import Var, BaseVar, ComputedVar @@ -12,7 +12,7 @@ from reflex.event import EventHandler, EventChain, EventSpec class Spinner(ChakraComponent): @overload @classmethod - def create(cls, *children, empty_color: Optional[Union[Var[str], str]] = None, label: Optional[Union[Var[str], str]] = None, speed: Optional[Union[Var[str], str]] = None, thickness: Optional[Union[Var[int], int]] = None, size: Optional[Union[Var[str], 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) -> "Spinner": # type: ignore + def create(cls, *children, empty_color: Optional[Union[Var[str], str]] = None, label: Optional[Union[Var[str], str]] = None, speed: Optional[Union[Var[str], str]] = None, thickness: Optional[Union[Var[int], int]] = None, size: Optional[Union[Var[Literal["sm", "md", "lg", "xs"]], Literal["sm", "md", "lg", "xs"]]] = 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) -> "Spinner": # type: ignore """Create the component. Args: diff --git a/reflex/components/forms/button.py b/reflex/components/forms/button.py index 88d8d0e73..517d76c14 100644 --- a/reflex/components/forms/button.py +++ b/reflex/components/forms/button.py @@ -1,7 +1,13 @@ """A button component.""" from typing import List -from reflex.components.libs.chakra import ChakraComponent +from reflex.components.libs.chakra import ( + ChakraComponent, + LiteralButtonSize, + LiteralButtonVariant, + LiteralColorScheme, + LiteralSpinnerPlacement, +) from reflex.vars import Var @@ -29,21 +35,20 @@ class Button(ChakraComponent): loading_text: Var[str] # "lg" | "md" | "sm" | "xs" - size: Var[str] - + size: Var[LiteralButtonSize] # "ghost" | "outline" | "solid" | "link" | "unstyled" - variant: Var[str] + variant: Var[LiteralButtonVariant] # Built in color scheme for ease of use. # Options: # "whiteAlpha" | "blackAlpha" | "gray" | "red" | "orange" | "yellow" | "green" | "teal" | "blue" | "cyan" # | "purple" | "pink" | "linkedin" | "facebook" | "messenger" | "whatsapp" | "twitter" | "telegram" - color_scheme: Var[str] + color_scheme: Var[LiteralColorScheme] # Position of the loading spinner. # Options: # "start" | "end" - spinner_placement: Var[str] + spinner_placement: Var[LiteralSpinnerPlacement] # The type of button. type_: Var[str] @@ -67,7 +72,6 @@ class ButtonGroup(ChakraComponent): spacing: Var[int] # "lg" | "md" | "sm" | "xs" - size: Var[str] - + size: Var[LiteralButtonSize] # "ghost" | "outline" | "solid" | "link" | "unstyled" - variant: Var[str] + variant: Var[LiteralButtonVariant] diff --git a/reflex/components/forms/button.pyi b/reflex/components/forms/button.pyi index 3bab9d9d8..47d725726 100644 --- a/reflex/components/forms/button.pyi +++ b/reflex/components/forms/button.pyi @@ -3,7 +3,7 @@ # This file was generated by `scripts/pyi_generator.py`! # ------------------------------------------------------ -from typing import List, Optional, Union, overload +from typing import List, Literal, Optional, Union, overload from reflex.components.libs.chakra import ChakraComponent from reflex.components.component import Component from reflex.vars import Var, BaseVar, ComputedVar @@ -12,7 +12,7 @@ from reflex.event import EventHandler, EventChain, EventSpec class Button(ChakraComponent): @overload @classmethod - def create(cls, *children, icon_spacing: Optional[Union[Var[int], int]] = None, is_active: Optional[Union[Var[bool], bool]] = None, is_disabled: Optional[Union[Var[bool], bool]] = None, is_full_width: Optional[Union[Var[bool], bool]] = None, is_loading: Optional[Union[Var[bool], bool]] = None, loading_text: Optional[Union[Var[str], str]] = None, size: Optional[Union[Var[str], str]] = None, variant: Optional[Union[Var[str], str]] = None, color_scheme: Optional[Union[Var[str], str]] = None, type_: Optional[Union[Var[str], str]] = None, invalid_children: Optional[List[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) -> "Button": # type: ignore + def create(cls, *children, icon_spacing: Optional[Union[Var[int], int]] = None, is_active: Optional[Union[Var[bool], bool]] = None, is_disabled: Optional[Union[Var[bool], bool]] = None, is_full_width: Optional[Union[Var[bool], bool]] = None, is_loading: Optional[Union[Var[bool], bool]] = None, loading_text: Optional[Union[Var[str], str]] = None, size: Optional[Union[Var[Literal["sm", "md", "lg", "xs"]], Literal["sm", "md", "lg", "xs"]]] = None, variant: Optional[Union[Var[Literal["ghost", "outline", "solid", "link", "unstyled"]], Literal["ghost", "outline", "solid", "link", "unstyled"]]] = None, color_scheme: Optional[Union[Var[Literal["gray", "red", "orange", "yellow", "green", "teal", "blue", "cyan", "purple", "pink", "whiteAlpha", "blackAlpha", "linkedin", "facebook", "messenger", "whatsapp", "twitter", "telegram"]], Literal["gray", "red", "orange", "yellow", "green", "teal", "blue", "cyan", "purple", "pink", "whiteAlpha", "blackAlpha", "linkedin", "facebook", "messenger", "whatsapp", "twitter", "telegram"]]] = None, spinner_placement: Optional[Union[Var[Literal["start", "end"]], Literal["start", "end"]]] = None, type_: Optional[Union[Var[str], str]] = None, invalid_children: Optional[List[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) -> "Button": # type: ignore """Create the component. Args: @@ -29,6 +29,9 @@ class Button(ChakraComponent): Options: "whiteAlpha" | "blackAlpha" | "gray" | "red" | "orange" | "yellow" | "green" | "teal" | "blue" | "cyan" | "purple" | "pink" | "linkedin" | "facebook" | "messenger" | "whatsapp" | "twitter" | "telegram" + spinner_placement: Position of the loading spinner. + Options: + "start" | "end" type_: The type of button. invalid_children: Components that are not allowed as children. **props: The props of the component. @@ -44,7 +47,7 @@ class Button(ChakraComponent): class ButtonGroup(ChakraComponent): @overload @classmethod - def create(cls, *children, is_attached: Optional[Union[Var[bool], bool]] = None, is_disabled: Optional[Union[Var[bool], bool]] = None, spacing: Optional[Union[Var[int], int]] = 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) -> "ButtonGroup": # type: ignore + def create(cls, *children, is_attached: Optional[Union[Var[bool], bool]] = None, is_disabled: Optional[Union[Var[bool], bool]] = None, spacing: Optional[Union[Var[int], int]] = None, size: Optional[Union[Var[Literal["sm", "md", "lg", "xs"]], Literal["sm", "md", "lg", "xs"]]] = None, variant: Optional[Union[Var[Literal["ghost", "outline", "solid", "link", "unstyled"]], Literal["ghost", "outline", "solid", "link", "unstyled"]]] = 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) -> "ButtonGroup": # type: ignore """Create the component. Args: @@ -52,6 +55,8 @@ class ButtonGroup(ChakraComponent): is_attached: If true, the borderRadius of button that are direct children will be altered to look flushed together. is_disabled: If true, all wrapped button will be disabled. spacing: The spacing between the buttons. + size: "lg" | "md" | "sm" | "xs" + variant: "ghost" | "outline" | "solid" | "link" | "unstyled" **props: The props of the component. Returns: diff --git a/reflex/components/forms/checkbox.py b/reflex/components/forms/checkbox.py index 5ded5eeba..9444ed5ff 100644 --- a/reflex/components/forms/checkbox.py +++ b/reflex/components/forms/checkbox.py @@ -3,7 +3,11 @@ from __future__ import annotations from typing import Any, Union -from reflex.components.libs.chakra import ChakraComponent +from reflex.components.libs.chakra import ( + ChakraComponent, + LiteralColorScheme, + LiteralTagSize, +) from reflex.constants import EventTriggers from reflex.vars import Var @@ -17,10 +21,10 @@ class Checkbox(ChakraComponent): # Options: # "whiteAlpha" | "blackAlpha" | "gray" | "red" | "orange" | "yellow" | "green" | "teal" | "blue" | "cyan" # | "purple" | "pink" | "linkedin" | "facebook" | "messenger" | "whatsapp" | "twitter" | "telegram" - color_scheme: Var[str] + color_scheme: Var[LiteralColorScheme] # "sm" | "md" | "lg" - size: Var[str] + size: Var[LiteralTagSize] # If true, the checkbox will be checked. is_checked: Var[bool] diff --git a/reflex/components/forms/checkbox.pyi b/reflex/components/forms/checkbox.pyi index af74a5c9f..4fb9f0079 100644 --- a/reflex/components/forms/checkbox.pyi +++ b/reflex/components/forms/checkbox.pyi @@ -3,7 +3,7 @@ # This file was generated by `scripts/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Optional, Union, overload +from typing import Any, Literal, Optional, Union, overload from reflex.components.libs.chakra import ChakraComponent from reflex.components.component import Component from reflex.vars import Var, BaseVar, ComputedVar @@ -12,7 +12,7 @@ from reflex.event import EventHandler, EventChain, EventSpec class Checkbox(ChakraComponent): @overload @classmethod - def create(cls, *children, color_scheme: Optional[Union[Var[str], str]] = None, size: Optional[Union[Var[str], str]] = None, is_checked: Optional[Union[Var[bool], bool]] = None, is_disabled: Optional[Union[Var[bool], bool]] = None, is_focusable: Optional[Union[Var[bool], bool]] = None, is_indeterminate: Optional[Union[Var[bool], bool]] = None, is_invalid: Optional[Union[Var[bool], bool]] = None, is_read_only: Optional[Union[Var[bool], bool]] = None, is_required: Optional[Union[Var[bool], bool]] = None, name: Optional[Union[Var[str], str]] = None, spacing: Optional[Union[Var[str], str]] = None, on_blur: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_change: 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) -> "Checkbox": # type: ignore + def create(cls, *children, color_scheme: Optional[Union[Var[Literal["gray", "red", "orange", "yellow", "green", "teal", "blue", "cyan", "purple", "pink", "whiteAlpha", "blackAlpha", "linkedin", "facebook", "messenger", "whatsapp", "twitter", "telegram"]], Literal["gray", "red", "orange", "yellow", "green", "teal", "blue", "cyan", "purple", "pink", "whiteAlpha", "blackAlpha", "linkedin", "facebook", "messenger", "whatsapp", "twitter", "telegram"]]] = None, size: Optional[Union[Var[Literal["sm", "md", "lg"]], Literal["sm", "md", "lg"]]] = None, is_checked: Optional[Union[Var[bool], bool]] = None, is_disabled: Optional[Union[Var[bool], bool]] = None, is_focusable: Optional[Union[Var[bool], bool]] = None, is_indeterminate: Optional[Union[Var[bool], bool]] = None, is_invalid: Optional[Union[Var[bool], bool]] = None, is_read_only: Optional[Union[Var[bool], bool]] = None, is_required: Optional[Union[Var[bool], bool]] = None, name: Optional[Union[Var[str], str]] = None, spacing: Optional[Union[Var[str], str]] = None, on_blur: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_change: 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) -> "Checkbox": # type: ignore """Create the component. Args: diff --git a/reflex/components/forms/editor.py b/reflex/components/forms/editor.py index 9e3276f23..3f9bf34ff 100644 --- a/reflex/components/forms/editor.py +++ b/reflex/components/forms/editor.py @@ -2,7 +2,7 @@ from __future__ import annotations import enum -from typing import Any, Dict, List, Optional, Union +from typing import Any, Dict, List, Literal, Optional, Union from reflex.base import Base from reflex.components.component import Component, NoSSRComponent @@ -86,7 +86,31 @@ class Editor(NoSSRComponent): # options: "en" | "da" | "de" | "es" | "fr" | "ja" | "ko" | "pt_br" | # "ru" | "zh_cn" | "ro" | "pl" | "ckb" | "lv" | "se" | "ua" | "he" | "it" # default : "en" - lang: Var[Union[str, dict]] + lang: Var[ + Union[ + Literal[ + "en", + "da", + "de", + "es", + "fr", + "ja", + "ko", + "pt_br", + "ru", + "zh_cn", + "ro", + "pl", + "ckb", + "lv", + "se", + "ua", + "he", + "it", + ], + dict, + ] + ] # This is used to set the HTML form name of the editor. # This means on HTML form submission, diff --git a/reflex/components/forms/editor.pyi b/reflex/components/forms/editor.pyi index 240ca20b8..56517a29c 100644 --- a/reflex/components/forms/editor.pyi +++ b/reflex/components/forms/editor.pyi @@ -17,7 +17,7 @@ class EditorOptions(Base): ... class Editor(NoSSRComponent): @overload @classmethod - def create(cls, *children, lib_dependencies: Optional[List[str]] = None, lang: Optional[Union[Var[Union[str, dict]], Union[str, dict]]] = None, name: Optional[Union[Var[str], str]] = None, default_value: Optional[Union[Var[str], str]] = None, width: Optional[Union[Var[str], str]] = None, height: Optional[Union[Var[str], str]] = None, placeholder: Optional[Union[Var[str], str]] = None, auto_focus: Optional[Union[Var[bool], bool]] = None, set_options: Optional[Union[Var[Dict], Dict]] = None, set_all_plugins: Optional[Union[Var[bool], bool]] = None, set_contents: Optional[Union[Var[str], str]] = None, append_contents: Optional[Union[Var[str], str]] = None, set_default_style: Optional[Union[Var[str], str]] = None, disable: Optional[Union[Var[bool], bool]] = None, hide: Optional[Union[Var[bool], bool]] = None, hide_toolbar: Optional[Union[Var[bool], bool]] = None, disable_toolbar: Optional[Union[Var[bool], bool]] = None, on_blur: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_change: 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_copy: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_cut: 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_input: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_load: 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_paste: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_resize_editor: 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, toggle_code_view: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, toggle_full_screen: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, **props) -> "Editor": # type: ignore + def create(cls, *children, lib_dependencies: Optional[List[str]] = None, lang: Optional[Union[Var[Union[Literal["en", "da", "de", "es", "fr", "ja", "ko", "pt_br", "ru", "zh_cn", "ro", "pl", "ckb", "lv", "se", "ua", "he", "it"], dict]], Union[Literal["en", "da", "de", "es", "fr", "ja", "ko", "pt_br", "ru", "zh_cn", "ro", "pl", "ckb", "lv", "se", "ua", "he", "it"], dict]]] = None, name: Optional[Union[Var[str], str]] = None, default_value: Optional[Union[Var[str], str]] = None, width: Optional[Union[Var[str], str]] = None, height: Optional[Union[Var[str], str]] = None, placeholder: Optional[Union[Var[str], str]] = None, auto_focus: Optional[Union[Var[bool], bool]] = None, set_options: Optional[Union[Var[Dict], Dict]] = None, set_all_plugins: Optional[Union[Var[bool], bool]] = None, set_contents: Optional[Union[Var[str], str]] = None, append_contents: Optional[Union[Var[str], str]] = None, set_default_style: Optional[Union[Var[str], str]] = None, disable: Optional[Union[Var[bool], bool]] = None, hide: Optional[Union[Var[bool], bool]] = None, hide_toolbar: Optional[Union[Var[bool], bool]] = None, disable_toolbar: Optional[Union[Var[bool], bool]] = None, on_blur: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_change: 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_copy: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_cut: 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_input: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_load: 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_paste: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_resize_editor: 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, toggle_code_view: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, toggle_full_screen: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, **props) -> "Editor": # type: ignore """Create an instance of Editor. No children allowed. Args: diff --git a/reflex/components/forms/input.py b/reflex/components/forms/input.py index c21d6d5cb..75bbac4cd 100644 --- a/reflex/components/forms/input.py +++ b/reflex/components/forms/input.py @@ -4,7 +4,11 @@ from typing import Any, Dict from reflex.components.component import Component from reflex.components.forms.debounce import DebounceInput -from reflex.components.libs.chakra import ChakraComponent +from reflex.components.libs.chakra import ( + ChakraComponent, + LiteralButtonSize, + LiteralInputVariant, +) from reflex.constants import EventTriggers from reflex.utils import imports from reflex.vars import ImportVar, Var @@ -46,10 +50,10 @@ class Input(ChakraComponent): is_required: Var[bool] # "outline" | "filled" | "flushed" | "unstyled" - variant: Var[str] + variant: Var[LiteralInputVariant] # "lg" | "md" | "sm" | "xs" - size: Var[str] + size: Var[LiteralButtonSize] def _get_imports(self) -> imports.ImportDict: return imports.merge_imports( diff --git a/reflex/components/forms/input.pyi b/reflex/components/forms/input.pyi index 0d620dada..bd5094da1 100644 --- a/reflex/components/forms/input.pyi +++ b/reflex/components/forms/input.pyi @@ -3,7 +3,7 @@ # This file was generated by `scripts/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Dict, Optional, Union, overload +from typing import Any, Dict, Literal, Optional, Union, overload from reflex.components.libs.chakra import ChakraComponent from reflex.components.component import Component from reflex.vars import Var, BaseVar, ComputedVar @@ -12,7 +12,7 @@ from reflex.event import EventHandler, EventChain, EventSpec class Input(ChakraComponent): @overload @classmethod - def create(cls, *children, value: Optional[Union[Var[str], str]] = None, default_value: Optional[Union[Var[str], str]] = None, placeholder: Optional[Union[Var[str], str]] = None, type_: Optional[Union[Var[str], str]] = None, error_border_color: Optional[Union[Var[str], str]] = None, focus_border_color: Optional[Union[Var[str], str]] = None, is_disabled: Optional[Union[Var[bool], bool]] = None, is_invalid: Optional[Union[Var[bool], bool]] = None, is_read_only: Optional[Union[Var[bool], bool]] = None, is_required: Optional[Union[Var[bool], bool]] = None, variant: Optional[Union[Var[str], str]] = None, size: Optional[Union[Var[str], str]] = None, on_blur: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_change: 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_key_down: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_key_up: 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) -> "Input": # type: ignore + def create(cls, *children, value: Optional[Union[Var[str], str]] = None, default_value: Optional[Union[Var[str], str]] = None, placeholder: Optional[Union[Var[str], str]] = None, type_: Optional[Union[Var[str], str]] = None, error_border_color: Optional[Union[Var[str], str]] = None, focus_border_color: Optional[Union[Var[str], str]] = None, is_disabled: Optional[Union[Var[bool], bool]] = None, is_invalid: Optional[Union[Var[bool], bool]] = None, is_read_only: Optional[Union[Var[bool], bool]] = None, is_required: Optional[Union[Var[bool], bool]] = None, variant: Optional[Union[Var[Literal["outline", "filled", "flushed", "unstyled"]], Literal["outline", "filled", "flushed", "unstyled"]]] = None, size: Optional[Union[Var[Literal["sm", "md", "lg", "xs"]], Literal["sm", "md", "lg", "xs"]]] = None, on_blur: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_change: 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_key_down: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_key_up: 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) -> "Input": # type: ignore """Create an Input component. Args: diff --git a/reflex/components/forms/numberinput.py b/reflex/components/forms/numberinput.py index 79f74d562..1f93c6e8a 100644 --- a/reflex/components/forms/numberinput.py +++ b/reflex/components/forms/numberinput.py @@ -4,7 +4,10 @@ from numbers import Number from typing import Any, Dict from reflex.components.component import Component -from reflex.components.libs.chakra import ChakraComponent +from reflex.components.libs.chakra import ( + ChakraComponent, + LiteralInputVariant, +) from reflex.constants import EventTriggers from reflex.vars import Var @@ -36,7 +39,7 @@ class NumberInput(ChakraComponent): focus_input_on_change: Var[bool] # Hints at the type of data that might be entered by the user. It also determines the type of keyboard shown to the user on mobile devices ("text" | "search" | "none" | "tel" | "url" | "email" | "numeric" | "decimal") - input_mode: Var[str] + # input_mode: Var[LiteralInputNumberMode] # Whether the input should be disabled. is_disabled: Var[bool] @@ -63,7 +66,7 @@ class NumberInput(ChakraComponent): min_: Var[Number] # "outline" | "filled" | "flushed" | "unstyled" - variant: Var[str] + variant: Var[LiteralInputVariant] def get_event_triggers(self) -> Dict[str, Any]: """Get the event triggers that pass the component's value to the handler. diff --git a/reflex/components/forms/numberinput.pyi b/reflex/components/forms/numberinput.pyi index 25de0323b..2f7e04d4b 100644 --- a/reflex/components/forms/numberinput.pyi +++ b/reflex/components/forms/numberinput.pyi @@ -3,7 +3,7 @@ # This file was generated by `scripts/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Dict, Optional, Union, overload +from typing import Any, Dict, Literal, Optional, Union, overload from reflex.components.libs.chakra import ChakraComponent from reflex.components.component import Component from reflex.vars import Var, BaseVar, ComputedVar @@ -12,34 +12,35 @@ from reflex.event import EventHandler, EventChain, EventSpec class NumberInput(ChakraComponent): @overload @classmethod - def create(cls, *children, value: Optional[Union[Var[Number], Number]] = None, allow_mouse_wheel: Optional[Union[Var[bool], bool]] = None, clamped_value_on_blur: Optional[Union[Var[bool], bool]] = None, default_value: Optional[Union[Var[Number], Number]] = None, error_border_color: Optional[Union[Var[str], str]] = None, focus_border_color: Optional[Union[Var[str], str]] = None, focus_input_on_change: Optional[Union[Var[bool], bool]] = None, input_mode: Optional[Union[Var[str], str]] = None, is_disabled: Optional[Union[Var[bool], bool]] = None, is_invalid: Optional[Union[Var[bool], bool]] = None, is_read_only: Optional[Union[Var[bool], bool]] = None, is_required: Optional[Union[Var[bool], bool]] = None, is_valid_character: Optional[Union[Var[str], str]] = None, keep_within_range: Optional[Union[Var[bool], bool]] = None, max_: Optional[Union[Var[Number], Number]] = None, min_: Optional[Union[Var[Number], Number]] = None, variant: Optional[Union[Var[str], str]] = None, on_blur: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_change: 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) -> "NumberInput": # type: ignore + def create(cls, *children, value: Optional[Union[Var[Number], Number]] = None, allow_mouse_wheel: Optional[Union[Var[bool], bool]] = None, clamped_value_on_blur: Optional[Union[Var[bool], bool]] = None, default_value: Optional[Union[Var[Number], Number]] = None, error_border_color: Optional[Union[Var[str], str]] = None, focus_border_color: Optional[Union[Var[str], str]] = None, focus_input_on_change: Optional[Union[Var[bool], bool]] = None, is_disabled: Optional[Union[Var[bool], bool]] = None, is_invalid: Optional[Union[Var[bool], bool]] = None, is_read_only: Optional[Union[Var[bool], bool]] = None, is_required: Optional[Union[Var[bool], bool]] = None, is_valid_character: Optional[Union[Var[str], str]] = None, keep_within_range: Optional[Union[Var[bool], bool]] = None, max_: Optional[Union[Var[Number], Number]] = None, min_: Optional[Union[Var[Number], Number]] = None, variant: Optional[Union[Var[Literal["outline", "filled", "flushed", "unstyled"]], Literal["outline", "filled", "flushed", "unstyled"]]] = None, on_blur: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_change: 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) -> "NumberInput": # type: ignore """Create a number input component. - If no children are provided, a default stepper will be used. + If no children are provided, a default stepper will be used. - Args: - *children: The children of the component. - value: State var to bind the input. - allow_mouse_wheel: If true, the input's value will change based on mouse wheel. - clamped_value_on_blur: This controls the value update when you blur out of the input. - If true and the value is greater than max, the value will be reset to max - Else, the value remains the same. - default_value: The initial value of the counter. Should be less than max and greater than min - error_border_color: The border color when the input is invalid. - focus_border_color: The border color when the input is focused. - focus_input_on_change: If true, the input will be focused as you increment or decrement the value with the stepper - input_mode: Hints at the type of data that might be entered by the user. It also determines the type of keyboard shown to the user on mobile devices ("text" | "search" | "none" | "tel" | "url" | "email" | "numeric" | "decimal") - is_disabled: Whether the input should be disabled. - is_invalid: If true, the input will have `aria-invalid` set to true - is_read_only: If true, the input will be in readonly mode - is_required: Whether the input is required - is_valid_character: Whether the pressed key should be allowed in the input. The default behavior is to allow DOM floating point characters defined by /^[Ee0-9+\-.]$/ - keep_within_range: This controls the value update behavior in general. - If true and you use the stepper or up/down arrow keys, the value will not exceed the max or go lower than min - If false, the value will be allowed to go out of range. - max_: The maximum value of the counter - min_: The minimum value of the counter - variant: "outline" | "filled" | "flushed" | "unstyled" - **props: The props of the component. + Args: + *children: The children of the component. + value: State var to bind the input. + allow_mouse_wheel: If true, the input's value will change based on mouse wheel. + clamped_value_on_blur: This controls the value update when you blur out of the input. - If true and the value is greater than max, the value will be reset to max - Else, the value remains the same. + default_value: The initial value of the counter. Should be less than max and greater than min + error_border_color: The border color when the input is invalid. + focus_border_color: The border color when the input is focused. + focus_input_on_change: If true, the input will be focused as you increment or decrement the value with the stepper + is_disabled: Hints at the type of data that might be entered by the user. It also determines the type of keyboard shown to the user on mobile devices ("text" | "search" | "none" | "tel" | "url" | "email" | "numeric" | "decimal") + input_mode: Var[LiteralInputNumberMode] + Whether the input should be disabled. + is_invalid: If true, the input will have `aria-invalid` set to true + is_read_only: If true, the input will be in readonly mode + is_required: Whether the input is required + is_valid_character: Whether the pressed key should be allowed in the input. The default behavior is to allow DOM floating point characters defined by /^[Ee0-9+\-.]$/ + keep_within_range: This controls the value update behavior in general. - If true and you use the stepper or up/down arrow keys, the value will not exceed the max or go lower than min - If false, the value will be allowed to go out of range. + max_: The maximum value of the counter + min_: The minimum value of the counter + variant: "outline" | "filled" | "flushed" | "unstyled" + **props: The props of the component. - Returns: - The component. + Returns: + The component. """ ... diff --git a/reflex/components/forms/pininput.py b/reflex/components/forms/pininput.py index c5d312a81..4d81df7f1 100644 --- a/reflex/components/forms/pininput.py +++ b/reflex/components/forms/pininput.py @@ -5,7 +5,7 @@ from typing import Any, Optional, Union from reflex.components.component import Component from reflex.components.layout import Foreach -from reflex.components.libs.chakra import ChakraComponent +from reflex.components.libs.chakra import ChakraComponent, LiteralInputVariant from reflex.constants import EventTriggers from reflex.utils import format from reflex.vars import Var @@ -56,7 +56,7 @@ class PinInput(ChakraComponent): type_: Var[str] # "outline" | "flushed" | "filled" | "unstyled" - variant: Var[str] + variant: Var[LiteralInputVariant] def get_event_triggers(self) -> dict[str, Union[Var, Any]]: """Get the event triggers that pass the component's value to the handler. diff --git a/reflex/components/forms/pininput.pyi b/reflex/components/forms/pininput.pyi index 64346b9d2..aff296ab9 100644 --- a/reflex/components/forms/pininput.pyi +++ b/reflex/components/forms/pininput.pyi @@ -3,7 +3,7 @@ # This file was generated by `scripts/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Optional, Union, overload +from typing import Any, Literal, Optional, Union, overload from reflex.components.libs.chakra import ChakraComponent from reflex.components.component import Component from reflex.vars import Var, BaseVar, ComputedVar @@ -12,7 +12,7 @@ from reflex.event import EventHandler, EventChain, EventSpec class PinInput(ChakraComponent): @overload @classmethod - def create(cls, *children, value: Optional[Union[Var[str], str]] = None, auto_focus: Optional[Union[Var[bool], bool]] = None, default_value: Optional[Union[Var[str], str]] = None, error_border_color: Optional[Union[Var[str], str]] = None, focus_border_color: Optional[Union[Var[str], str]] = None, id_: Optional[Union[Var[str], str]] = None, length: Optional[Union[Var[int], int]] = None, is_disabled: Optional[Union[Var[bool], bool]] = None, is_invalid: Optional[Union[Var[bool], bool]] = None, manage_focus: Optional[Union[Var[bool], bool]] = None, mask: Optional[Union[Var[bool], bool]] = None, placeholder: Optional[Union[Var[str], str]] = None, type_: Optional[Union[Var[str], str]] = None, variant: Optional[Union[Var[str], str]] = None, on_blur: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_change: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_click: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_complete: 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) -> "PinInput": # type: ignore + def create(cls, *children, value: Optional[Union[Var[str], str]] = None, auto_focus: Optional[Union[Var[bool], bool]] = None, default_value: Optional[Union[Var[str], str]] = None, error_border_color: Optional[Union[Var[str], str]] = None, focus_border_color: Optional[Union[Var[str], str]] = None, id_: Optional[Union[Var[str], str]] = None, length: Optional[Union[Var[int], int]] = None, is_disabled: Optional[Union[Var[bool], bool]] = None, is_invalid: Optional[Union[Var[bool], bool]] = None, manage_focus: Optional[Union[Var[bool], bool]] = None, mask: Optional[Union[Var[bool], bool]] = None, placeholder: Optional[Union[Var[str], str]] = None, type_: Optional[Union[Var[str], str]] = None, variant: Optional[Union[Var[Literal["outline", "filled", "flushed", "unstyled"]], Literal["outline", "filled", "flushed", "unstyled"]]] = None, on_blur: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_change: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_click: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_complete: 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) -> "PinInput": # type: ignore """Create a pin input component. If no children are passed in, the component will create a default pin input diff --git a/reflex/components/forms/rangeslider.py b/reflex/components/forms/rangeslider.py index f1758e3e5..9879d0c69 100644 --- a/reflex/components/forms/rangeslider.py +++ b/reflex/components/forms/rangeslider.py @@ -4,7 +4,7 @@ from __future__ import annotations from typing import Any, List, Optional, Union from reflex.components.component import Component -from reflex.components.libs.chakra import ChakraComponent +from reflex.components.libs.chakra import ChakraComponent, LiteralChakraDirection from reflex.constants import EventTriggers from reflex.utils import format from reflex.vars import Var @@ -22,7 +22,7 @@ class RangeSlider(ChakraComponent): default_value: Var[List[int]] # The writing mode ("ltr" | "rtl") - direction: Var[str] + direction: Var[LiteralChakraDirection] # If false, the slider handle will not capture focus when value changes. focus_thumb_on_change: Var[bool] diff --git a/reflex/components/forms/rangeslider.pyi b/reflex/components/forms/rangeslider.pyi index de467025d..5e2c01f77 100644 --- a/reflex/components/forms/rangeslider.pyi +++ b/reflex/components/forms/rangeslider.pyi @@ -3,7 +3,7 @@ # This file was generated by `scripts/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, List, Optional, Union, overload +from typing import Any, List, Literal, Optional, Union, overload from reflex.components.libs.chakra import ChakraComponent from reflex.components.component import Component from reflex.vars import Var, BaseVar, ComputedVar @@ -12,7 +12,7 @@ from reflex.event import EventHandler, EventChain, EventSpec class RangeSlider(ChakraComponent): @overload @classmethod - def create(cls, *children, value: Optional[Union[Var[List[int]], List[int]]] = None, default_value: Optional[Union[Var[List[int]], List[int]]] = None, direction: Optional[Union[Var[str], str]] = None, focus_thumb_on_change: Optional[Union[Var[bool], bool]] = None, is_disabled: Optional[Union[Var[bool], bool]] = None, is_read_only: Optional[Union[Var[bool], bool]] = None, is_reversed: Optional[Union[Var[bool], bool]] = None, min_: Optional[Union[Var[int], int]] = None, max_: Optional[Union[Var[int], int]] = None, min_steps_between_thumbs: Optional[Union[Var[int], int]] = None, on_blur: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_change: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_change_end: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_change_start: 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) -> "RangeSlider": # type: ignore + def create(cls, *children, value: Optional[Union[Var[List[int]], List[int]]] = None, default_value: Optional[Union[Var[List[int]], List[int]]] = None, direction: Optional[Union[Var[Literal["ltr", "rtl"]], Literal["ltr", "rtl"]]] = None, focus_thumb_on_change: Optional[Union[Var[bool], bool]] = None, is_disabled: Optional[Union[Var[bool], bool]] = None, is_read_only: Optional[Union[Var[bool], bool]] = None, is_reversed: Optional[Union[Var[bool], bool]] = None, min_: Optional[Union[Var[int], int]] = None, max_: Optional[Union[Var[int], int]] = None, min_steps_between_thumbs: Optional[Union[Var[int], int]] = None, on_blur: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_change: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_change_end: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_change_start: 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) -> "RangeSlider": # type: ignore """Create a RangeSlider component. If no children are provided, a default RangeSlider will be created. diff --git a/reflex/components/forms/select.py b/reflex/components/forms/select.py index a2a840964..15f132ba8 100644 --- a/reflex/components/forms/select.py +++ b/reflex/components/forms/select.py @@ -4,7 +4,7 @@ from typing import Any, Dict, List, Union from reflex.components.component import Component from reflex.components.layout.foreach import Foreach -from reflex.components.libs.chakra import ChakraComponent +from reflex.components.libs.chakra import ChakraComponent, LiteralInputVariant from reflex.components.typography.text import Text from reflex.constants import EventTriggers from reflex.utils.types import _issubclass @@ -41,7 +41,7 @@ class Select(ChakraComponent): is_required: Var[bool] # "outline" | "filled" | "flushed" | "unstyled" - variant: Var[str] + variant: Var[LiteralInputVariant] # The size of the select. size: Var[str] diff --git a/reflex/components/forms/select.pyi b/reflex/components/forms/select.pyi index c28f7bea0..c4ce5b714 100644 --- a/reflex/components/forms/select.pyi +++ b/reflex/components/forms/select.pyi @@ -3,7 +3,7 @@ # This file was generated by `scripts/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Dict, List, Optional, Union, overload +from typing import Any, Dict, List, Literal, Optional, Union, overload from reflex.components.libs.chakra import ChakraComponent from reflex.components.component import Component from reflex.components.typography.text import Text @@ -13,7 +13,7 @@ from reflex.event import EventHandler, EventChain, EventSpec class Select(ChakraComponent): @overload @classmethod - def create(cls, *children, value: Optional[Union[Var[str], str]] = None, default_value: Optional[Union[Var[str], str]] = None, placeholder: Optional[Union[Var[str], str]] = None, error_border_color: Optional[Union[Var[str], str]] = None, focus_border_color: Optional[Union[Var[str], str]] = None, is_disabled: Optional[Union[Var[bool], bool]] = None, is_invalid: Optional[Union[Var[bool], bool]] = None, is_required: Optional[Union[Var[bool], bool]] = None, variant: Optional[Union[Var[str], str]] = None, size: Optional[Union[Var[str], str]] = None, on_blur: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_change: 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) -> "Select": # type: ignore + def create(cls, *children, value: Optional[Union[Var[str], str]] = None, default_value: Optional[Union[Var[str], str]] = None, placeholder: Optional[Union[Var[str], str]] = None, error_border_color: Optional[Union[Var[str], str]] = None, focus_border_color: Optional[Union[Var[str], str]] = None, is_disabled: Optional[Union[Var[bool], bool]] = None, is_invalid: Optional[Union[Var[bool], bool]] = None, is_required: Optional[Union[Var[bool], bool]] = None, variant: Optional[Union[Var[Literal["outline", "filled", "flushed", "unstyled"]], Literal["outline", "filled", "flushed", "unstyled"]]] = None, size: Optional[Union[Var[str], str]] = None, on_blur: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_change: 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) -> "Select": # type: ignore """Create a select component. If a list is provided as the first children, a default component diff --git a/reflex/components/forms/slider.py b/reflex/components/forms/slider.py index 23307d943..090e4c732 100644 --- a/reflex/components/forms/slider.py +++ b/reflex/components/forms/slider.py @@ -4,7 +4,8 @@ from __future__ import annotations from typing import Any, Union from reflex.components.component import Component -from reflex.components.libs.chakra import ChakraComponent +from reflex.components.graphing.recharts.recharts import LiteralLayout +from reflex.components.libs.chakra import ChakraComponent, LiteralChakraDirection from reflex.constants import EventTriggers from reflex.vars import Var @@ -24,7 +25,7 @@ class Slider(ChakraComponent): default_value: Var[int] # The writing mode ("ltr" | "rtl") - direction: Var[str] + direction: Var[LiteralChakraDirection] # If false, the slider handle will not capture focus when value changes. focus_thumb_on_change: Var[bool] @@ -51,7 +52,7 @@ class Slider(ChakraComponent): min_steps_between_thumbs: Var[int] # Oreintation of the slider vertical | horizontal. - orientation: Var[str] + orientation: Var[LiteralLayout] # Minimum height of the slider. min_h: Var[str] diff --git a/reflex/components/forms/slider.pyi b/reflex/components/forms/slider.pyi index ae62083df..0db2dd407 100644 --- a/reflex/components/forms/slider.pyi +++ b/reflex/components/forms/slider.pyi @@ -3,7 +3,7 @@ # This file was generated by `scripts/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Optional, Union, overload +from typing import Any, Literal, Optional, Union, overload from reflex.components.libs.chakra import ChakraComponent from reflex.components.component import Component from reflex.vars import Var, BaseVar, ComputedVar @@ -12,7 +12,7 @@ from reflex.event import EventHandler, EventChain, EventSpec class Slider(ChakraComponent): @overload @classmethod - def create(cls, *children, value: Optional[Union[Var[int], int]] = None, color_scheme: Optional[Union[Var[str], str]] = None, default_value: Optional[Union[Var[int], int]] = None, direction: Optional[Union[Var[str], str]] = None, focus_thumb_on_change: Optional[Union[Var[bool], bool]] = None, is_disabled: Optional[Union[Var[bool], bool]] = None, is_read_only: Optional[Union[Var[bool], bool]] = None, is_reversed: Optional[Union[Var[bool], bool]] = None, min_: Optional[Union[Var[int], int]] = None, max_: Optional[Union[Var[int], int]] = None, step: Optional[Union[Var[int], int]] = None, min_steps_between_thumbs: Optional[Union[Var[int], int]] = None, orientation: Optional[Union[Var[str], str]] = None, min_h: Optional[Union[Var[str], str]] = None, min_w: Optional[Union[Var[str], str]] = None, max_h: Optional[Union[Var[str], str]] = None, max_w: Optional[Union[Var[str], str]] = None, on_blur: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_change: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_change_end: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_change_start: 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) -> "Slider": # type: ignore + def create(cls, *children, value: Optional[Union[Var[int], int]] = None, color_scheme: Optional[Union[Var[str], str]] = None, default_value: Optional[Union[Var[int], int]] = None, direction: Optional[Union[Var[Literal["ltr", "rtl"]], Literal["ltr", "rtl"]]] = None, focus_thumb_on_change: Optional[Union[Var[bool], bool]] = None, is_disabled: Optional[Union[Var[bool], bool]] = None, is_read_only: Optional[Union[Var[bool], bool]] = None, is_reversed: Optional[Union[Var[bool], bool]] = None, min_: Optional[Union[Var[int], int]] = None, max_: Optional[Union[Var[int], int]] = None, step: Optional[Union[Var[int], int]] = None, min_steps_between_thumbs: Optional[Union[Var[int], int]] = None, orientation: Optional[Union[Var[Literal["horizontal", "vertical"]], Literal["horizontal", "vertical"]]] = None, min_h: Optional[Union[Var[str], str]] = None, min_w: Optional[Union[Var[str], str]] = None, max_h: Optional[Union[Var[str], str]] = None, max_w: Optional[Union[Var[str], str]] = None, on_blur: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_change: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_change_end: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_change_start: 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) -> "Slider": # type: ignore """Create a slider component. If no children are provided, a default slider will be created. diff --git a/reflex/components/forms/switch.py b/reflex/components/forms/switch.py index bbb429265..e6eb82728 100644 --- a/reflex/components/forms/switch.py +++ b/reflex/components/forms/switch.py @@ -3,7 +3,7 @@ from __future__ import annotations from typing import Any, Union -from reflex.components.libs.chakra import ChakraComponent +from reflex.components.libs.chakra import ChakraComponent, LiteralColorScheme from reflex.constants import EventTriggers from reflex.vars import Var @@ -41,7 +41,7 @@ class Switch(ChakraComponent): placeholder: Var[str] # The color scheme of the switch (e.g. "blue", "green", "red", etc.) - color_scheme: Var[str] + color_scheme: Var[LiteralColorScheme] def get_event_triggers(self) -> dict[str, Union[Var, Any]]: """Get the event triggers that pass the component's value to the handler. diff --git a/reflex/components/forms/switch.pyi b/reflex/components/forms/switch.pyi index 5531f1cd8..d1fe2499d 100644 --- a/reflex/components/forms/switch.pyi +++ b/reflex/components/forms/switch.pyi @@ -3,7 +3,7 @@ # This file was generated by `scripts/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Optional, Union, overload +from typing import Any, Literal, Optional, Union, overload from reflex.components.libs.chakra import ChakraComponent from reflex.components.component import Component from reflex.vars import Var, BaseVar, ComputedVar @@ -12,7 +12,7 @@ from reflex.event import EventHandler, EventChain, EventSpec class Switch(ChakraComponent): @overload @classmethod - def create(cls, *children, is_checked: Optional[Union[Var[bool], bool]] = None, is_disabled: Optional[Union[Var[bool], bool]] = None, is_focusable: Optional[Union[Var[bool], bool]] = None, is_invalid: Optional[Union[Var[bool], bool]] = None, is_read_only: Optional[Union[Var[bool], bool]] = None, is_required: Optional[Union[Var[bool], bool]] = None, name: Optional[Union[Var[str], str]] = None, spacing: Optional[Union[Var[str], str]] = None, placeholder: Optional[Union[Var[str], str]] = None, color_scheme: Optional[Union[Var[str], str]] = None, on_blur: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_change: 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) -> "Switch": # type: ignore + def create(cls, *children, is_checked: Optional[Union[Var[bool], bool]] = None, is_disabled: Optional[Union[Var[bool], bool]] = None, is_focusable: Optional[Union[Var[bool], bool]] = None, is_invalid: Optional[Union[Var[bool], bool]] = None, is_read_only: Optional[Union[Var[bool], bool]] = None, is_required: Optional[Union[Var[bool], bool]] = None, name: Optional[Union[Var[str], str]] = None, spacing: Optional[Union[Var[str], str]] = None, placeholder: Optional[Union[Var[str], str]] = None, color_scheme: Optional[Union[Var[Literal["gray", "red", "orange", "yellow", "green", "teal", "blue", "cyan", "purple", "pink", "whiteAlpha", "blackAlpha", "linkedin", "facebook", "messenger", "whatsapp", "twitter", "telegram"]], Literal["gray", "red", "orange", "yellow", "green", "teal", "blue", "cyan", "purple", "pink", "whiteAlpha", "blackAlpha", "linkedin", "facebook", "messenger", "whatsapp", "twitter", "telegram"]]] = None, on_blur: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_change: 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) -> "Switch": # type: ignore """Create the component. Args: diff --git a/reflex/components/forms/textarea.py b/reflex/components/forms/textarea.py index 329f1db47..794b26ed5 100644 --- a/reflex/components/forms/textarea.py +++ b/reflex/components/forms/textarea.py @@ -5,7 +5,7 @@ from typing import Any, Union from reflex.components.component import Component from reflex.components.forms.debounce import DebounceInput -from reflex.components.libs.chakra import ChakraComponent +from reflex.components.libs.chakra import ChakraComponent, LiteralInputVariant from reflex.constants import EventTriggers from reflex.vars import Var @@ -43,7 +43,7 @@ class TextArea(ChakraComponent): is_required: Var[bool] # "outline" | "filled" | "flushed" | "unstyled" - variant: Var[str] + variant: Var[LiteralInputVariant] def get_event_triggers(self) -> dict[str, Union[Var, Any]]: """Get the event triggers that pass the component's value to the handler. diff --git a/reflex/components/forms/textarea.pyi b/reflex/components/forms/textarea.pyi index 9d7c562bd..fa052095e 100644 --- a/reflex/components/forms/textarea.pyi +++ b/reflex/components/forms/textarea.pyi @@ -3,7 +3,7 @@ # This file was generated by `scripts/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Optional, Union, overload +from typing import Any, Literal, Optional, Union, overload from reflex.components.libs.chakra import ChakraComponent from reflex.components.component import Component from reflex.vars import Var, BaseVar, ComputedVar @@ -12,7 +12,7 @@ from reflex.event import EventHandler, EventChain, EventSpec class TextArea(ChakraComponent): @overload @classmethod - def create(cls, *children, value: Optional[Union[Var[str], str]] = None, default_value: Optional[Union[Var[str], str]] = None, placeholder: Optional[Union[Var[str], str]] = None, error_border_color: Optional[Union[Var[str], str]] = None, focus_border_color: Optional[Union[Var[str], str]] = None, is_disabled: Optional[Union[Var[bool], bool]] = None, is_invalid: Optional[Union[Var[bool], bool]] = None, is_read_only: Optional[Union[Var[bool], bool]] = None, is_required: Optional[Union[Var[bool], bool]] = None, variant: Optional[Union[Var[str], str]] = None, on_blur: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_change: 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_key_down: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_key_up: 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) -> "TextArea": # type: ignore + def create(cls, *children, value: Optional[Union[Var[str], str]] = None, default_value: Optional[Union[Var[str], str]] = None, placeholder: Optional[Union[Var[str], str]] = None, error_border_color: Optional[Union[Var[str], str]] = None, focus_border_color: Optional[Union[Var[str], str]] = None, is_disabled: Optional[Union[Var[bool], bool]] = None, is_invalid: Optional[Union[Var[bool], bool]] = None, is_read_only: Optional[Union[Var[bool], bool]] = None, is_required: Optional[Union[Var[bool], bool]] = None, variant: Optional[Union[Var[Literal["outline", "filled", "flushed", "unstyled"]], Literal["outline", "filled", "flushed", "unstyled"]]] = None, on_blur: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_change: 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_key_down: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_key_up: 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) -> "TextArea": # type: ignore """Create an Input component. Args: diff --git a/reflex/components/graphing/recharts/__init__.py b/reflex/components/graphing/recharts/__init__.py index 020b966cd..327b9b326 100644 --- a/reflex/components/graphing/recharts/__init__.py +++ b/reflex/components/graphing/recharts/__init__.py @@ -39,6 +39,32 @@ from .polar import ( Radar, RadialBar, ) +from .recharts import ( + LiteralAnimationEasing, + LiteralAreaType, + LiteralAxisType, + LiteralBarChartStackOffset, + LiteralComposedChartBaseValue, + LiteralDirection, + LiteralGridType, + LiteralIconType, + LiteralIfOverflow, + LiteralInterval, + LiteralLayout, + LiteralLegendAlign, + LiteralLegendType, + LiteralLineType, + LiteralOrientation, + LiteralOrientationLeftRightMiddle, + LiteralOrientationTopBottom, + LiteralOrientationTopBottomLeftRight, + LiteralPolarRadiusType, + LiteralScale, + LiteralShape, + LiteralStackOffset, + LiteralSyncMethod, + LiteralVerticalAlign, +) area_chart = AreaChart.create bar_chart = BarChart.create diff --git a/reflex/components/graphing/recharts/cartesian.py b/reflex/components/graphing/recharts/cartesian.py index 44efa0009..503149fb2 100644 --- a/reflex/components/graphing/recharts/cartesian.py +++ b/reflex/components/graphing/recharts/cartesian.py @@ -6,7 +6,21 @@ from typing import Any, Dict, List, Union from reflex.constants import EventTriggers from reflex.vars import Var -from .recharts import Recharts +from .recharts import ( + LiteralAnimationEasing, + LiteralAreaType, + LiteralDirection, + LiteralIfOverflow, + LiteralInterval, + LiteralLayout, + LiteralLineType, + LiteralOrientationTopBottom, + LiteralOrientationTopBottomLeftRight, + LiteralPolarRadiusType, + LiteralScale, + LiteralShape, + Recharts, +) class Axis(Recharts): @@ -19,10 +33,10 @@ class Axis(Recharts): hide: Var[bool] # The orientation of axis 'top' | 'bottom' - orientation: Var[str] + orientation: Var[LiteralOrientationTopBottom] # The type of axis 'number' | 'category' - type_: Var[str] + type_: Var[LiteralPolarRadiusType] # Allow the ticks of XAxis to be decimals or not. allow_decimals: Var[bool] @@ -46,7 +60,7 @@ class Axis(Recharts): reversed: Var[bool] # If 'auto' set, the scale function is decided by the type of chart, and the props type. 'auto' | 'linear' | 'pow' | 'sqrt' | 'log' | 'identity' | 'time' | 'band' | 'point' | 'ordinal' | 'quantile' | 'quantize' | 'utc' | 'sequential' | 'threshold' | Function - scale: Var[str] + scale: Var[LiteralScale] # The unit of data displayed in the axis. This option will be used to represent an index unit in a scatter chart. unit: Var[Union[str, int]] @@ -109,7 +123,7 @@ class ZAxis(Recharts): name: Var[Union[str, int]] # If 'auto' set, the scale function is decided by the type of chart, and the props type. - scale: Var[str] + scale: Var[LiteralScale] class Brush(Recharts): @@ -167,7 +181,7 @@ class Cartesian(Recharts): """A base class for cartesian charts in Recharts.""" # The layout of bar in the chart, usually inherited from parent. 'horizontal' | 'vertical' - layout: Var[str] + layout: Var[LiteralLayout] # The key of a group of data which should be unique in an area chart. data_key: Var[Union[str, int]] @@ -178,8 +192,8 @@ class Cartesian(Recharts): # The id of y-axis which is corresponding to the data. y_axis_id: Var[Union[str, int]] - # The type of icon in legend. If set to 'none', no legend item will be rendered. 'line' | 'plainline' | 'square' | 'rect'| 'circle' | 'cross' | 'diamond' | 'square' | 'star' | 'triangle' | 'wye' | 'none'optional - legend_type: Var[str] + # The type of icon in legend. If set to 'none', no legend item will be rendered. 'line' | 'plainline' | 'square' | 'rect'| 'circle' | 'cross' | 'diamond' | 'star' | 'triangle' | 'wye' | 'none'optional + # legend_type: Var[LiteralLegendType] def get_event_triggers(self) -> dict[str, Union[Var, Any]]: """Get the event triggers that pass the component's value to the handler. @@ -214,7 +228,7 @@ class Area(Cartesian): fill: Var[str] # The interpolation type of area. And customized interpolation function can be set to type. 'basis' | 'basisClosed' | 'basisOpen' | 'bumpX' | 'bumpY' | 'bump' | 'linear' | 'linearClosed' | 'natural' | 'monotoneX' | 'monotoneY' | 'monotone' | 'step' | 'stepBefore' | 'stepAfter' | - type_: Var[str] + type_: Var[LiteralAreaType] # If false set, dots will not be drawn. If true set, dots will be drawn which have the props calculated internally. dot: Var[bool] @@ -275,7 +289,7 @@ class Line(Cartesian): alias = "RechartsLine" # The interpolation type of line. And customized interpolation function can be set to type. It's the same as type in Area. - type_: Var[str] + type_: Var[LiteralAreaType] # The color of the line stroke. stroke: Var[str] @@ -319,10 +333,10 @@ class Scatter(Cartesian): line: Var[bool] # If a string set, specified symbol will be used to show scatter item. 'circle' | 'cross' | 'diamond' | 'square' | 'star' | 'triangle' | 'wye' - shape: Var[str] + shape: Var[LiteralShape] # If 'joint' set, line will generated by just jointing all the points. If 'fitting' set, line will be generated by fitting algorithm. 'joint' | 'fitting' - line_type: Var[str] + line_type: Var[LiteralLineType] # The fill fill: Var[str] @@ -351,7 +365,7 @@ class Funnel(Cartesian): animation_duration: Var[int] # The type of easing function. 'ease' | 'ease-in' | 'ease-out' | 'ease-in-out' | 'linear' - animation_easing: Var[str] + animation_easing: Var[LiteralAnimationEasing] # Valid children components valid_children: List[str] = ["LabelList", "Cell"] @@ -365,7 +379,7 @@ class ErrorBar(Recharts): alias = "RechartsErrorBar" # The direction of error bar. 'x' | 'y' | 'both' - direction: Var[str] + direction: Var[LiteralDirection] # The key of a group of data which should be unique in an area chart. data_key: Var[Union[str, int]] @@ -396,7 +410,7 @@ class Reference(Recharts): y: Var[str] # Defines how to draw the reference line if it falls partly outside the canvas. If set to 'discard', the reference line will not be drawn at all. If set to 'hidden', the reference line will be clipped to the canvas. If set to 'visible', the reference line will be drawn completely. If set to 'extendDomain', the domain of the overflown axis will be extended such that the reference line fits into the canvas. - if_overflow: Var[str] + if_overflow: Var[LiteralIfOverflow] # If set true, the line will be rendered in front of bars in BarChart, etc. is_front: Var[bool] @@ -477,7 +491,7 @@ class ReferenceArea(Recharts): y2: Var[Union[str, int]] # Defines how to draw the reference line if it falls partly outside the canvas. If set to 'discard', the reference line will not be drawn at all. If set to 'hidden', the reference line will be clipped to the canvas. If set to 'visible', the reference line will be drawn completely. If set to 'extendDomain', the domain of the overflown axis will be extended such that the reference line fits into the canvas. - if_overflow: Var[str] + if_overflow: Var[LiteralIfOverflow] # If set true, the line will be rendered in front of bars in BarChart, etc. is_front: Var[bool] @@ -533,7 +547,7 @@ class CartesianAxis(Grid): alias = "RechartsCartesianAxis" # The orientation of axis 'top' | 'bottom' | 'left' | 'right' - orientation: Var[str] + orientation: Var[LiteralOrientationTopBottomLeftRight] # If set false, no axis line will be drawn. If set a object, the option is the configuration of axis line. axis_line: Var[bool] @@ -545,7 +559,7 @@ class CartesianAxis(Grid): tick_size: Var[int] # If set 0, all the ticks will be shown. If set preserveStart", "preserveEnd" or "preserveStartEnd", the ticks which is to be shown or hidden will be calculated automatically. - interval: Var[str] + interval: Var[LiteralInterval] # If set false, no ticks will be drawn. ticks: Var[bool] diff --git a/reflex/components/graphing/recharts/cartesian.pyi b/reflex/components/graphing/recharts/cartesian.pyi new file mode 100644 index 000000000..ef458db4b --- /dev/null +++ b/reflex/components/graphing/recharts/cartesian.pyi @@ -0,0 +1,471 @@ +"""Stub file for cartesian.py""" +# ------------------- DO NOT EDIT ---------------------- +# This file was generated by `scripts/pyi_generator.py`! +# ------------------------------------------------------ + +from typing import Any, Dict, List, Literal, Optional, Union, overload +from reflex.components.component import Component +from reflex.components.graphing.recharts.recharts import Recharts +from reflex.vars import Var, BaseVar, ComputedVar +from reflex.event import EventHandler, EventChain, EventSpec + +class Axis(Recharts): + @overload + @classmethod + def create(cls, *children, data_key: Optional[Union[Var[Union[str, int]], Union[str, int]]] = None, hide: Optional[Union[Var[bool], bool]] = None, orientation: Optional[Union[Var[Literal["top", "bottom"]], Literal["top", "bottom"]]] = None, type_: Optional[Union[Var[Literal["number", "category"]], Literal["number", "category"]]] = None, allow_decimals: Optional[Union[Var[bool], bool]] = None, allow_data_overflow: Optional[Union[Var[bool], bool]] = None, allow_duplicated_category: Optional[Union[Var[bool], bool]] = None, axis_line: Optional[Union[Var[bool], bool]] = None, tick_line: Optional[Union[Var[bool], bool]] = None, mirror: Optional[Union[Var[bool], bool]] = None, reversed: Optional[Union[Var[bool], bool]] = None, scale: Optional[Union[Var[Literal["auto", "linear", "pow", "sqrt", "log", "identity", "time", "band", "point", "ordinal", "quantile", "quantize", "utc", "sequential", "threshold"]], Literal["auto", "linear", "pow", "sqrt", "log", "identity", "time", "band", "point", "ordinal", "quantile", "quantize", "utc", "sequential", "threshold"]]] = None, unit: Optional[Union[Var[Union[str, int]], Union[str, int]]] = None, name: Optional[Union[Var[Union[str, int]], Union[str, int]]] = None, on_click: 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, **props) -> "Axis": # type: ignore + """Create the component. + + Args: + *children: The children of the component. + data_key: The key of a group of data which should be unique in an area chart. + hide: If set true, the axis do not display in the chart. + orientation: The orientation of axis 'top' | 'bottom' + type_: The type of axis 'number' | 'category' + allow_decimals: Allow the ticks of XAxis to be decimals or not. + allow_data_overflow: When domain of the axis is specified and the type of the axis is 'number', if allowDataOverflow is set to be false, the domain will be adjusted when the minimum value of data is smaller than domain[0] or the maximum value of data is greater than domain[1] so that the axis displays all data values. If set to true, graphic elements (line, area, bars) will be clipped to conform to the specified domain. + allow_duplicated_category: Allow the axis has duplicated categorys or not when the type of axis is "category". + axis_line: If set false, no axis line will be drawn. If set a object, the option is the configuration of axis line. + tick_line: If set false, no axis tick lines will be drawn. If set a object, the option is the configuration of tick lines. + mirror: If set true, flips ticks around the axis line, displaying the labels inside the chart instead of outside. + reversed: Reverse the ticks or not. + scale: If 'auto' set, the scale function is decided by the type of chart, and the props type. 'auto' | 'linear' | 'pow' | 'sqrt' | 'log' | 'identity' | 'time' | 'band' | 'point' | 'ordinal' | 'quantile' | 'quantize' | 'utc' | 'sequential' | 'threshold' | Function + unit: The unit of data displayed in the axis. This option will be used to represent an index unit in a scatter chart. + name: The name of data displayed in the axis. This option will be used to represent an index in a scatter chart. + **props: The props of the component. + + Returns: + The component. + + Raises: + TypeError: If an invalid child is passed. + """ + ... + +class XAxis(Axis): + @overload + @classmethod + def create(cls, *children, on_click: 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, **props) -> "XAxis": # type: ignore + """Create the component. + + Args: + *children: The children of the component. + **props: The props of the component. + + Returns: + The component. + + Raises: + TypeError: If an invalid child is passed. + """ + ... + +class YAxis(Axis): + @overload + @classmethod + def create(cls, *children, data_key: Optional[Union[Var[Union[str, int]], Union[str, int]]] = None, on_click: 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, **props) -> "YAxis": # type: ignore + """Create the component. + + Args: + *children: The children of the component. + data_key: The key of data displayed in the axis. + **props: The props of the component. + + Returns: + The component. + + Raises: + TypeError: If an invalid child is passed. + """ + ... + +class ZAxis(Recharts): + @overload + @classmethod + def create(cls, *children, data_key: Optional[Union[Var[Union[str, int]], Union[str, int]]] = None, range: Optional[Union[Var[List[int]], List[int]]] = None, unit: Optional[Union[Var[Union[str, int]], Union[str, int]]] = None, name: Optional[Union[Var[Union[str, int]], Union[str, int]]] = None, scale: Optional[Union[Var[Literal["auto", "linear", "pow", "sqrt", "log", "identity", "time", "band", "point", "ordinal", "quantile", "quantize", "utc", "sequential", "threshold"]], Literal["auto", "linear", "pow", "sqrt", "log", "identity", "time", "band", "point", "ordinal", "quantile", "quantize", "utc", "sequential", "threshold"]]] = 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) -> "ZAxis": # type: ignore + """Create the component. + + Args: + *children: The children of the component. + data_key: The key of data displayed in the axis. + range: The range of axis. + unit: The unit of data displayed in the axis. This option will be used to represent an index unit in a scatter chart. + name: The name of data displayed in the axis. This option will be used to represent an index in a scatter chart. + scale: If 'auto' set, the scale function is decided by the type of chart, and the props type. + **props: The props of the component. + + Returns: + The component. + + Raises: + TypeError: If an invalid child is passed. + """ + ... + +class Brush(Recharts): + @overload + @classmethod + def create(cls, *children, stroke: Optional[Union[Var[str], str]] = None, data_key: Optional[Union[Var[Union[str, int]], Union[str, int]]] = None, x: Optional[Union[Var[int], int]] = None, y: Optional[Union[Var[int], int]] = None, width: Optional[Union[Var[int], int]] = None, height: Optional[Union[Var[int], int]] = None, data: Optional[Union[Var[List[Any]], List[Any]]] = None, traveller_width: Optional[Union[Var[int], int]] = None, gap: Optional[Union[Var[int], int]] = None, start_index: Optional[Union[Var[int], int]] = None, end_index: Optional[Union[Var[int], int]] = None, on_change: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, **props) -> "Brush": # type: ignore + """Create the component. + + Args: + *children: The children of the component. + stroke: Stroke color + data_key: The key of data displayed in the axis. + x: The x-coordinate of brush. + y: The y-coordinate of brush. + width: The width of brush. + height: The height of brush. + data: The data domain of brush, [min, max]. + traveller_width: The width of each traveller. + gap: The data with gap of refreshing chart. If the option is not set, the chart will be refreshed every time + start_index: The default start index of brush. If the option is not set, the start index will be 0. + end_index: The default end index of brush. If the option is not set, the end index will be 1. + **props: The props of the component. + + Returns: + The component. + + Raises: + TypeError: If an invalid child is passed. + """ + ... + +class Cartesian(Recharts): + @overload + @classmethod + def create(cls, *children, layout: Optional[Union[Var[Literal["horizontal", "vertical"]], Literal["horizontal", "vertical"]]] = None, data_key: Optional[Union[Var[Union[str, int]], Union[str, int]]] = None, x_axis_id: Optional[Union[Var[Union[str, int]], Union[str, int]]] = None, y_axis_id: Optional[Union[Var[Union[str, int]], Union[str, int]]] = None, on_click: 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, **props) -> "Cartesian": # type: ignore + """Create the component. + + Args: + *children: The children of the component. + layout: The layout of bar in the chart, usually inherited from parent. 'horizontal' | 'vertical' + data_key: The key of a group of data which should be unique in an area chart. + x_axis_id: The id of x-axis which is corresponding to the data. + y_axis_id: The id of y-axis which is corresponding to the data. + **props: The props of the component. + + Returns: + The component. + + Raises: + TypeError: If an invalid child is passed. + """ + ... + +class Area(Cartesian): + @overload + @classmethod + def create(cls, *children, stroke: Optional[Union[Var[str], str]] = None, stroke_width: Optional[Union[Var[int], int]] = None, fill: Optional[Union[Var[str], str]] = None, type_: Optional[Union[Var[Literal["basis", "basisClosed", "basisOpen", "bumpX", "bumpY", "bump", "linear", "linearClosed", "natural", "monotoneX", "monotoneY", "monotone", "step", "stepBefore", "stepAfter"]], Literal["basis", "basisClosed", "basisOpen", "bumpX", "bumpY", "bump", "linear", "linearClosed", "natural", "monotoneX", "monotoneY", "monotone", "step", "stepBefore", "stepAfter"]]] = None, dot: Optional[Union[Var[bool], bool]] = None, active_dot: Optional[Union[Var[bool], bool]] = None, label: Optional[Union[Var[bool], bool]] = None, stack_id: Optional[Union[Var[str], str]] = None, valid_children: Optional[List[str]] = None, on_click: 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, **props) -> "Area": # type: ignore + """Create the component. + + Args: + *children: The children of the component. + stroke: The color of the line stroke. + stroke_width: The width of the line stroke. + fill: The color of the area fill. + type_: The interpolation type of area. And customized interpolation function can be set to type. 'basis' | 'basisClosed' | 'basisOpen' | 'bumpX' | 'bumpY' | 'bump' | 'linear' | 'linearClosed' | 'natural' | 'monotoneX' | 'monotoneY' | 'monotone' | 'step' | 'stepBefore' | 'stepAfter' | + dot: If false set, dots will not be drawn. If true set, dots will be drawn which have the props calculated internally. + active_dot: The dot is shown when user enter an area chart and this chart has tooltip. If false set, no active dot will not be drawn. If true set, active dot will be drawn which have the props calculated internally. + label: If false set, labels will not be drawn. If true set, labels will be drawn which have the props calculated internally. + stack_id: The stack id of area, when two areas have the same value axis and same stackId, then the two areas area stacked in order. + valid_children: Valid children components + **props: The props of the component. + + Returns: + The component. + + Raises: + TypeError: If an invalid child is passed. + """ + ... + +class Bar(Cartesian): + @overload + @classmethod + def create(cls, *children, stroke: Optional[Union[Var[str], str]] = None, stroke_width: Optional[Union[Var[int], int]] = None, fill: Optional[Union[Var[str], str]] = None, background: Optional[Union[Var[bool], bool]] = None, label: Optional[Union[Var[bool], bool]] = None, stack_id: Optional[Union[Var[str], str]] = None, bar_size: Optional[Union[Var[int], int]] = None, max_bar_size: Optional[Union[Var[int], int]] = None, valid_children: Optional[List[str]] = None, on_click: 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, **props) -> "Bar": # type: ignore + """Create the component. + + Args: + *children: The children of the component. + stroke: The color of the line stroke. + stroke_width: The width of the line stroke. + fill: The width of the line stroke. + background: If false set, background of bars will not be drawn. If true set, background of bars will be drawn which have the props calculated internally. + label: If false set, labels will not be drawn. If true set, labels will be drawn which have the props calculated internally. + stack_id: The stack id of bar, when two areas have the same value axis and same stackId, then the two areas area stacked in order. + bar_size: Size of the bar + max_bar_size: Max size of the bar + valid_children: Valid children components + **props: The props of the component. + + Returns: + The component. + + Raises: + TypeError: If an invalid child is passed. + """ + ... + +class Line(Cartesian): + @overload + @classmethod + def create(cls, *children, type_: Optional[Union[Var[Literal["basis", "basisClosed", "basisOpen", "bumpX", "bumpY", "bump", "linear", "linearClosed", "natural", "monotoneX", "monotoneY", "monotone", "step", "stepBefore", "stepAfter"]], Literal["basis", "basisClosed", "basisOpen", "bumpX", "bumpY", "bump", "linear", "linearClosed", "natural", "monotoneX", "monotoneY", "monotone", "step", "stepBefore", "stepAfter"]]] = None, stroke: Optional[Union[Var[str], str]] = None, stoke_width: Optional[Union[Var[int], int]] = None, dot: Optional[Union[Var[bool], bool]] = None, active_dot: Optional[Union[Var[bool], bool]] = None, label: Optional[Union[Var[bool], bool]] = None, hide: Optional[Union[Var[bool], bool]] = None, connect_nulls: Optional[Union[Var[bool], bool]] = None, valid_children: Optional[List[str]] = None, on_click: 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, **props) -> "Line": # type: ignore + """Create the component. + + Args: + *children: The children of the component. + type_: The interpolation type of line. And customized interpolation function can be set to type. It's the same as type in Area. + stroke: The color of the line stroke. + stoke_width: The width of the line stroke. + dot: The dot is shown when mouse enter a line chart and this chart has tooltip. If false set, no active dot will not be drawn. If true set, active dot will be drawn which have the props calculated internally. + active_dot: The dot is shown when user enter an area chart and this chart has tooltip. If false set, no active dot will not be drawn. If true set, active dot will be drawn which have the props calculated internally. + label: If false set, labels will not be drawn. If true set, labels will be drawn which have the props calculated internally. + hide: Hides the line when true, useful when toggling visibility state via legend. + connect_nulls: Whether to connect a graph line across null points. + valid_children: Valid children components + **props: The props of the component. + + Returns: + The component. + + Raises: + TypeError: If an invalid child is passed. + """ + ... + +class Scatter(Cartesian): + @overload + @classmethod + def create(cls, *children, data: Optional[Union[Var[List[Dict[str, Any]]], List[Dict[str, Any]]]] = None, z_axis_id: Optional[Union[Var[str], str]] = None, line: Optional[Union[Var[bool], bool]] = None, shape: Optional[Union[Var[Literal["square", "circle", "cross", "diamond", "star", "triangle", "wye"]], Literal["square", "circle", "cross", "diamond", "star", "triangle", "wye"]]] = None, line_type: Optional[Union[Var[Literal["joint", "fitting"]], Literal["joint", "fitting"]]] = None, fill: Optional[Union[Var[str], str]] = None, name: Optional[Union[Var[Union[str, int]], Union[str, int]]] = None, valid_children: Optional[List[str]] = None, on_click: 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, **props) -> "Scatter": # type: ignore + """Create the component. + + Args: + *children: The children of the component. + data: The source data, in which each element is an object. + z_axis_id: The id of z-axis which is corresponding to the data. + line: If false set, line will not be drawn. If true set, line will be drawn which have the props calculated internally. + shape: If a string set, specified symbol will be used to show scatter item. 'circle' | 'cross' | 'diamond' | 'square' | 'star' | 'triangle' | 'wye' + line_type: If 'joint' set, line will generated by just jointing all the points. If 'fitting' set, line will be generated by fitting algorithm. 'joint' | 'fitting' + fill: The fill + name: the name + valid_children: Valid children components. + **props: The props of the component. + + Returns: + The component. + + Raises: + TypeError: If an invalid child is passed. + """ + ... + +class Funnel(Cartesian): + @overload + @classmethod + def create(cls, *children, data: Optional[Union[Var[List[Dict[str, Any]]], List[Dict[str, Any]]]] = None, animation_begin: Optional[Union[Var[int], int]] = None, animation_duration: Optional[Union[Var[int], int]] = None, animation_easing: Optional[Union[Var[Literal["ease", "ease-in", "ease-out", "ease-in-out", "linear"]], Literal["ease", "ease-in", "ease-out", "ease-in-out", "linear"]]] = None, valid_children: Optional[List[str]] = None, on_click: 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, **props) -> "Funnel": # type: ignore + """Create the component. + + Args: + *children: The children of the component. + data: The source data, in which each element is an object. + animation_begin: Specifies when the animation should begin, the unit of this option is ms. + animation_duration: Specifies the duration of animation, the unit of this option is ms. + animation_easing: The type of easing function. 'ease' | 'ease-in' | 'ease-out' | 'ease-in-out' | 'linear' + valid_children: Valid children components + **props: The props of the component. + + Returns: + The component. + + Raises: + TypeError: If an invalid child is passed. + """ + ... + +class ErrorBar(Recharts): + @overload + @classmethod + def create(cls, *children, direction: Optional[Union[Var[Literal["x", "y", "both"]], Literal["x", "y", "both"]]] = None, data_key: Optional[Union[Var[Union[str, int]], Union[str, int]]] = None, width: Optional[Union[Var[int], int]] = None, stroke: Optional[Union[Var[str], str]] = None, stroke_width: Optional[Union[Var[int], int]] = 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) -> "ErrorBar": # type: ignore + """Create the component. + + Args: + *children: The children of the component. + direction: The direction of error bar. 'x' | 'y' | 'both' + data_key: The key of a group of data which should be unique in an area chart. + width: The width of the error bar ends. + stroke: The stroke color of error bar. + stroke_width: The stroke width of error bar. + **props: The props of the component. + + Returns: + The component. + + Raises: + TypeError: If an invalid child is passed. + """ + ... + +class Reference(Recharts): + @overload + @classmethod + def create(cls, *children, x_axis_id: Optional[Union[Var[Union[str, int]], Union[str, int]]] = None, y_axis_id: Optional[Union[Var[Union[str, int]], Union[str, int]]] = None, x: Optional[Union[Var[str], str]] = None, y: Optional[Union[Var[str], str]] = None, if_overflow: Optional[Union[Var[Literal["discard", "hidden", "visible", "extendDomain"]], Literal["discard", "hidden", "visible", "extendDomain"]]] = None, is_front: Optional[Union[Var[bool], bool]] = 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) -> "Reference": # type: ignore + """Create the component. + + Args: + *children: The children of the component. + x_axis_id: The id of x-axis which is corresponding to the data. + y_axis_id: The id of y-axis which is corresponding to the data. + x: If set a string or a number, a vertical line perpendicular to the x-axis specified by xAxisId will be drawn. If the specified x-axis is a number axis, the type of x must be Number. If the specified x-axis is a category axis, the value of x must be one of the categorys, otherwise no line will be drawn. + y: If set a string or a number, a horizontal line perpendicular to the y-axis specified by yAxisId will be drawn. If the specified y-axis is a number axis, the type of y must be Number. If the specified y-axis is a category axis, the value of y must be one of the categorys, otherwise no line will be drawn. + if_overflow: Defines how to draw the reference line if it falls partly outside the canvas. If set to 'discard', the reference line will not be drawn at all. If set to 'hidden', the reference line will be clipped to the canvas. If set to 'visible', the reference line will be drawn completely. If set to 'extendDomain', the domain of the overflown axis will be extended such that the reference line fits into the canvas. + is_front: If set true, the line will be rendered in front of bars in BarChart, etc. + **props: The props of the component. + + Returns: + The component. + + Raises: + TypeError: If an invalid child is passed. + """ + ... + +class ReferenceLine(Reference): + @overload + @classmethod + def create(cls, *children, stroke_width: Optional[Union[Var[int], int]] = None, valid_children: Optional[List[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) -> "ReferenceLine": # type: ignore + """Create the component. + + Args: + *children: The children of the component. + stroke_width: The width of the stroke. + valid_children: Valid children components + **props: The props of the component. + + Returns: + The component. + + Raises: + TypeError: If an invalid child is passed. + """ + ... + +class ReferenceDot(Reference): + @overload + @classmethod + def create(cls, *children, valid_children: Optional[List[str]] = None, on_click: 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, **props) -> "ReferenceDot": # type: ignore + """Create the component. + + Args: + *children: The children of the component. + valid_children: Valid children components + **props: The props of the component. + + Returns: + The component. + + Raises: + TypeError: If an invalid child is passed. + """ + ... + +class ReferenceArea(Recharts): + @overload + @classmethod + def create(cls, *children, stroke: Optional[Union[Var[str], str]] = None, fill: Optional[Union[Var[str], str]] = None, fill_opacity: Optional[Union[Var[float], float]] = None, x_axis_id: Optional[Union[Var[Union[str, int]], Union[str, int]]] = None, y_axis_id: Optional[Union[Var[Union[str, int]], Union[str, int]]] = None, x1: Optional[Union[Var[Union[str, int]], Union[str, int]]] = None, x2: Optional[Union[Var[Union[str, int]], Union[str, int]]] = None, y1: Optional[Union[Var[Union[str, int]], Union[str, int]]] = None, y2: Optional[Union[Var[Union[str, int]], Union[str, int]]] = None, if_overflow: Optional[Union[Var[Literal["discard", "hidden", "visible", "extendDomain"]], Literal["discard", "hidden", "visible", "extendDomain"]]] = None, is_front: Optional[Union[Var[bool], bool]] = None, valid_children: Optional[List[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) -> "ReferenceArea": # type: ignore + """Create the component. + + Args: + *children: The children of the component. + stroke: Stroke color + fill: Fill color + fill_opacity: The opacity of area. + x_axis_id: The id of x-axis which is corresponding to the data. + y_axis_id: The id of y-axis which is corresponding to the data. + x1: A boundary value of the area. If the specified x-axis is a number axis, the type of x must be Number. If the specified x-axis is a category axis, the value of x must be one of the categorys. If one of x1 or x2 is invalidate, the area will cover along x-axis. + x2: A boundary value of the area. If the specified x-axis is a number axis, the type of x must be Number. If the specified x-axis is a category axis, the value of x must be one of the categorys. If one of x1 or x2 is invalidate, the area will cover along x-axis. + y1: A boundary value of the area. If the specified y-axis is a number axis, the type of y must be Number. If the specified y-axis is a category axis, the value of y must be one of the categorys. If one of y1 or y2 is invalidate, the area will cover along y-axis. + y2: A boundary value of the area. If the specified y-axis is a number axis, the type of y must be Number. If the specified y-axis is a category axis, the value of y must be one of the categorys. If one of y1 or y2 is invalidate, the area will cover along y-axis. + if_overflow: Defines how to draw the reference line if it falls partly outside the canvas. If set to 'discard', the reference line will not be drawn at all. If set to 'hidden', the reference line will be clipped to the canvas. If set to 'visible', the reference line will be drawn completely. If set to 'extendDomain', the domain of the overflown axis will be extended such that the reference line fits into the canvas. + is_front: If set true, the line will be rendered in front of bars in BarChart, etc. + valid_children: Valid children components + **props: The props of the component. + + Returns: + The component. + + Raises: + TypeError: If an invalid child is passed. + """ + ... + +class Grid(Recharts): + @overload + @classmethod + def create(cls, *children, x: Optional[Union[Var[int], int]] = None, y: Optional[Union[Var[int], int]] = None, width: Optional[Union[Var[int], int]] = None, height: Optional[Union[Var[int], int]] = 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) -> "Grid": # type: ignore + """Create the component. + + Args: + *children: The children of the component. + x: The x-coordinate of grid. + y: The y-coordinate of grid. + width: The width of grid. + height: The height of grid. + **props: The props of the component. + + Returns: + The component. + + Raises: + TypeError: If an invalid child is passed. + """ + ... + +class CartesianGrid(Grid): + @overload + @classmethod + def create(cls, *children, horizontal: Optional[Union[Var[Dict[str, Any]], Dict[str, Any]]] = None, vertical: Optional[Union[Var[Dict[str, Any]], Dict[str, Any]]] = None, fill: Optional[Union[Var[str], str]] = None, fill_opacity: Optional[Union[Var[float], float]] = None, stroke_dasharray: Optional[Union[Var[str], 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) -> "CartesianGrid": # type: ignore + """Create the component. + + Args: + *children: The children of the component. + horizontal: The horizontal line configuration. + vertical: The vertical line configuration. + fill: The background of grid. + fill_opacity: The opacity of the background used to fill the space between grid lines + stroke_dasharray: The pattern of dashes and gaps used to paint the lines of the grid + **props: The props of the component. + + Returns: + The component. + + Raises: + TypeError: If an invalid child is passed. + """ + ... + +class CartesianAxis(Grid): + @overload + @classmethod + def create(cls, *children, orientation: Optional[Union[Var[Literal["top", "bottom", "left", "right"]], Literal["top", "bottom", "left", "right"]]] = None, axis_line: Optional[Union[Var[bool], bool]] = None, tick_line: Optional[Union[Var[bool], bool]] = None, tick_size: Optional[Union[Var[int], int]] = None, interval: Optional[Union[Var[Literal["preserveStart", "preserveEnd", "preserveStartEnd"]], Literal["preserveStart", "preserveEnd", "preserveStartEnd"]]] = None, ticks: Optional[Union[Var[bool], bool]] = None, label: Optional[Union[Var[str], str]] = None, mirror: Optional[Union[Var[bool], bool]] = None, tick_margin: Optional[Union[Var[int], int]] = 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) -> "CartesianAxis": # type: ignore + """Create the component. + + Args: + *children: The children of the component. + orientation: The orientation of axis 'top' | 'bottom' | 'left' | 'right' + axis_line: If set false, no axis line will be drawn. If set a object, the option is the configuration of axis line. + tick_line: If set false, no axis tick lines will be drawn. If set a object, the option is the configuration of tick lines. + tick_size: The length of tick line. + interval: If set 0, all the ticks will be shown. If set preserveStart", "preserveEnd" or "preserveStartEnd", the ticks which is to be shown or hidden will be calculated automatically. + ticks: If set false, no ticks will be drawn. + label: If set a string or a number, default label will be drawn, and the option is content. + mirror: If set true, flips ticks around the axis line, displaying the labels inside the chart instead of outside. + tick_margin: The margin between tick line and tick. + **props: The props of the component. + + Returns: + The component. + + Raises: + TypeError: If an invalid child is passed. + """ + ... diff --git a/reflex/components/graphing/recharts/charts.py b/reflex/components/graphing/recharts/charts.py index 5edd0faeb..8834ecddd 100644 --- a/reflex/components/graphing/recharts/charts.py +++ b/reflex/components/graphing/recharts/charts.py @@ -8,7 +8,14 @@ from reflex.components.graphing.recharts.general import ResponsiveContainer from reflex.constants import EventTriggers from reflex.vars import Var -from .recharts import RechartsCharts +from .recharts import ( + LiteralAnimationEasing, + LiteralComposedChartBaseValue, + LiteralLayout, + LiteralStackOffset, + LiteralSyncMethod, + RechartsCharts, +) class ChartBase(RechartsCharts): @@ -21,7 +28,7 @@ class ChartBase(RechartsCharts): sync_id: Var[str] # When sync_id is provided, allows customisation of how the charts will synchronize GraphingTooltips and brushes. Using 'index' (default setting), other charts will reuse current datum's index within the data array. In cases where data does not have the same length, this might yield unexpected results. In that case use 'value' which will try to match other charts values, or a fully custom function which will receive tick, data as argument and should return an index. 'index' | 'value' | function - sync_method: Var[str] + sync_method: Var[LiteralSyncMethod] # The width of chart container. String or Integer width: Var[Union[str, int]] = "100%" # type: ignore @@ -30,13 +37,13 @@ class ChartBase(RechartsCharts): height: Var[Union[str, int]] = "100%" # type: ignore # The layout of area in the chart. 'horizontal' | 'vertical' - layout: Var[str] + layout: Var[LiteralLayout] # The sizes of whitespace around the chart. margin: Var[Dict[str, Any]] # The type of offset function used to generate the lower and upper values in the series array. The four types are built-in offsets in d3-shape. 'expand' | 'none' | 'wiggle' | 'silhouette' - stack_offset: Var[str] + stack_offset: Var[LiteralStackOffset] def get_event_triggers(self) -> dict[str, Union[Var, Any]]: """Get the event triggers that pass the component's value to the handler. @@ -77,10 +84,10 @@ class AreaChart(ChartBase): alias = "RechartsAreaChart" # The base value of area. Number | 'dataMin' | 'dataMax' | 'auto' - base_value: Var[Union[int, str]] + base_value: Var[Union[int, LiteralComposedChartBaseValue]] # The type of offset function used to generate the lower and upper values in the series array. The four types are built-in offsets in d3-shape. - stack_offset: Var[str] + stack_offset: Var[LiteralStackOffset] # Valid children components valid_children: List[str] = [ @@ -117,7 +124,7 @@ class BarChart(ChartBase): max_bar_size: Var[int] # The type of offset function used to generate the lower and upper values in the series array. The four types are built-in offsets in d3-shape. - stack_offset: Var[str] + stack_offset: Var[LiteralStackOffset] # If false set, stacked items will be rendered left to right. If true set, stacked items will be rendered right to left. (Render direction affects SVG layering, not x position.) reverse_stack_order: Var[bool] @@ -167,7 +174,7 @@ class ComposedChart(ChartBase): alias = "RechartsComposedChart" # The base value of area. Number | 'dataMin' | 'dataMax' | 'auto' - base_value: Var[Union[int, str]] + base_value: Var[Union[int, LiteralComposedChartBaseValue]] # The gap between two bar categories, which can be a percent value or a fixed value. Percentage | Number bar_category_gap: Var[Union[str, int]] # type: ignore @@ -396,13 +403,13 @@ class FunnelChart(RechartsCharts): height: Var[Union[str, int]] = "100%" # type: ignore # The layout of area in the chart. 'horizontal' | 'vertical' - layout: Var[str] + layout: Var[LiteralLayout] # The sizes of whitespace around the chart. margin: Var[Dict[str, Any]] # The type of offset function used to generate the lower and upper values in the series array. The four types are built-in offsets in d3-shape. 'expand' | 'none' | 'wiggle' | 'silhouette' - stack_offset: Var[str] + stack_offset: Var[LiteralStackOffset] # The layout of bars in the chart. centeric layout: Var[str] @@ -456,7 +463,7 @@ class Treemap(RechartsCharts): animation_duration: Var[int] # The type of easing function. 'ease' | 'ease-in' | 'ease-out' | 'ease-in-out' | 'linear' - animation_easing: Var[str] + animation_easing: Var[LiteralAnimationEasing] @classmethod def create(cls, *children, **props) -> Component: diff --git a/reflex/components/graphing/recharts/charts.pyi b/reflex/components/graphing/recharts/charts.pyi new file mode 100644 index 000000000..3db7ce5e3 --- /dev/null +++ b/reflex/components/graphing/recharts/charts.pyi @@ -0,0 +1,240 @@ +"""Stub file for charts.py""" +# ------------------- DO NOT EDIT ---------------------- +# This file was generated by `scripts/pyi_generator.py`! +# ------------------------------------------------------ + +from typing import Any, Dict, List, Literal, Optional, Union, overload +from reflex.components.component import Component +from reflex.components.graphing.recharts.recharts import RechartsCharts +from reflex.vars import Var, BaseVar, ComputedVar +from reflex.event import EventHandler, EventChain, EventSpec + +class ChartBase(RechartsCharts): + @overload + @classmethod + def create(cls, *children, data: Optional[Union[Var[List[Dict[str, Any]]], List[Dict[str, Any]]]] = None, sync_id: Optional[Union[Var[str], str]] = None, sync_method: Optional[Union[Var[Literal["index", "value"]], Literal["index", "value"]]] = None, width: Optional[Union[Var[Union[str, int]], Union[str, int]]] = None, height: Optional[Union[Var[Union[str, int]], Union[str, int]]] = None, layout: Optional[Union[Var[Literal["horizontal", "vertical"]], Literal["horizontal", "vertical"]]] = None, margin: Optional[Union[Var[Dict[str, Any]], Dict[str, Any]]] = None, stack_offset: Optional[Union[Var[Literal["expand", "none", "wiggle", "silhouette"]], Literal["expand", "none", "wiggle", "silhouette"]]] = None, on_click: 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, **props) -> "ChartBase": # type: ignore + """Create a chart component. + + Args: + *children: The children of the chart component. + data: The source data, in which each element is an object. + sync_id: If any two categorical charts(rx.line_chart, rx.area_chart, rx.bar_chart, rx.composed_chart) have the same sync_id, these two charts can sync the position GraphingTooltip, and the start_index, end_index of Brush. + sync_method: When sync_id is provided, allows customisation of how the charts will synchronize GraphingTooltips and brushes. Using 'index' (default setting), other charts will reuse current datum's index within the data array. In cases where data does not have the same length, this might yield unexpected results. In that case use 'value' which will try to match other charts values, or a fully custom function which will receive tick, data as argument and should return an index. 'index' | 'value' | function + width: The width of chart container. String or Integer + height: The height of chart container. + layout: The layout of area in the chart. 'horizontal' | 'vertical' + margin: The sizes of whitespace around the chart. + stack_offset: The type of offset function used to generate the lower and upper values in the series array. The four types are built-in offsets in d3-shape. 'expand' | 'none' | 'wiggle' | 'silhouette' + **props: The properties of the chart component. + + Returns: + The chart component wrapped in a responsive container. + """ + ... + +class AreaChart(ChartBase): + @overload + @classmethod + def create(cls, *children, base_value: Optional[Union[Var[Union[int, Literal["dataMin", "dataMax", "auto"]]], Union[int, Literal["dataMin", "dataMax", "auto"]]]] = None, stack_offset: Optional[Union[Var[Literal["expand", "none", "wiggle", "silhouette"]], Literal["expand", "none", "wiggle", "silhouette"]]] = None, valid_children: Optional[List[str]] = None, on_click: 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, **props) -> "AreaChart": # type: ignore + """Create a chart component. + + Args: + *children: The children of the chart component. + base_value: The base value of area. Number | 'dataMin' | 'dataMax' | 'auto' + stack_offset: The type of offset function used to generate the lower and upper values in the series array. The four types are built-in offsets in d3-shape. + valid_children: Valid children components + **props: The properties of the chart component. + + Returns: + The chart component wrapped in a responsive container. + """ + ... + +class BarChart(ChartBase): + @overload + @classmethod + def create(cls, *children, bar_category_gap: Optional[Union[Var[Union[str, int]], Union[str, int]]] = None, bar_gap: Optional[Union[Var[Union[str, int]], Union[str, int]]] = None, bar_size: Optional[Union[Var[int], int]] = None, max_bar_size: Optional[Union[Var[int], int]] = None, stack_offset: Optional[Union[Var[Literal["expand", "none", "wiggle", "silhouette"]], Literal["expand", "none", "wiggle", "silhouette"]]] = None, reverse_stack_order: Optional[Union[Var[bool], bool]] = None, valid_children: Optional[List[str]] = None, on_click: 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, **props) -> "BarChart": # type: ignore + """Create a chart component. + + Args: + *children: The children of the chart component. + bar_category_gap: The gap between two bar categories, which can be a percent value or a fixed value. Percentage | Number + bar_gap: The gap between two bars in the same category, which can be a percent value or a fixed value. Percentage | Number + bar_size: The width of all the bars in the chart. Number + max_bar_size: The maximum width of all the bars in a horizontal BarChart, or maximum height in a vertical BarChart. + stack_offset: The type of offset function used to generate the lower and upper values in the series array. The four types are built-in offsets in d3-shape. + reverse_stack_order: If false set, stacked items will be rendered left to right. If true set, stacked items will be rendered right to left. (Render direction affects SVG layering, not x position.) + valid_children: Valid children components + **props: The properties of the chart component. + + Returns: + The chart component wrapped in a responsive container. + """ + ... + +class LineChart(ChartBase): + @overload + @classmethod + def create(cls, *children, valid_children: Optional[List[str]] = None, on_click: 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, **props) -> "LineChart": # type: ignore + """Create a chart component. + + Args: + *children: The children of the chart component. + valid_children: Valid children components + **props: The properties of the chart component. + + Returns: + The chart component wrapped in a responsive container. + """ + ... + +class ComposedChart(ChartBase): + @overload + @classmethod + def create(cls, *children, base_value: Optional[Union[Var[Union[int, Literal["dataMin", "dataMax", "auto"]]], Union[int, Literal["dataMin", "dataMax", "auto"]]]] = None, bar_category_gap: Optional[Union[Var[Union[str, int]], Union[str, int]]] = None, bar_gap: Optional[Union[Var[int], int]] = None, bar_size: Optional[Union[Var[int], int]] = None, reverse_stack_order: Optional[Union[Var[bool], bool]] = None, valid_children: Optional[List[str]] = None, on_click: 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, **props) -> "ComposedChart": # type: ignore + """Create a chart component. + + Args: + *children: The children of the chart component. + base_value: The base value of area. Number | 'dataMin' | 'dataMax' | 'auto' + bar_category_gap: The gap between two bar categories, which can be a percent value or a fixed value. Percentage | Number + bar_gap: The gap between two bars in the same category, which can be a percent value or a fixed value. Percentage | Number + bar_size: The width of all the bars in the chart. Number + reverse_stack_order: If false set, stacked items will be rendered left to right. If true set, stacked items will be rendered right to left. (Render direction affects SVG layering, not x position.) + valid_children: Valid children components + **props: The properties of the chart component. + + Returns: + The chart component wrapped in a responsive container. + """ + ... + +class PieChart(ChartBase): + @overload + @classmethod + def create(cls, *children, valid_children: Optional[List[str]] = None, on_click: 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, **props) -> "PieChart": # type: ignore + """Create a chart component. + + Args: + *children: The children of the chart component. + valid_children: Valid children components + **props: The properties of the chart component. + + Returns: + The chart component wrapped in a responsive container. + """ + ... + +class RadarChart(ChartBase): + @overload + @classmethod + def create(cls, *children, cx: Optional[Union[Var[Union[int, str]], Union[int, str]]] = None, cy: Optional[Union[Var[Union[int, str]], Union[int, str]]] = None, start_angle: Optional[Union[Var[int], int]] = None, end_angle: Optional[Union[Var[int], int]] = None, inner_radius: Optional[Union[Var[Union[int, str]], Union[int, str]]] = None, outer_radius: Optional[Union[Var[Union[int, str]], Union[int, str]]] = None, valid_children: Optional[List[str]] = None, on_click: 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, **props) -> "RadarChart": # type: ignore + """Create a chart component. + + Args: + *children: The children of the chart component. + cx: The The x-coordinate of center. If set a percentage, the final value is obtained by multiplying the percentage of width. Number | Percentage + cy: The The y-coordinate of center. If set a percentage, the final value is obtained by multiplying the percentage of height. Number | Percentage + start_angle: The angle of first radial direction line. + end_angle: The angle of last point in the circle which should be startAngle - 360 or startAngle + 360. We'll calculate the direction of chart by 'startAngle' and 'endAngle'. + inner_radius: The inner radius of first circle grid. If set a percentage, the final value is obtained by multiplying the percentage of maxRadius which is calculated by the width, height, cx, cy. Number | Percentage + outer_radius: The outer radius of last circle grid. If set a percentage, the final value is obtained by multiplying the percentage of maxRadius which is calculated by the width, height, cx, cy. Number | Percentage + valid_children: Valid children components + **props: The properties of the chart component. + + Returns: + The chart component wrapped in a responsive container. + """ + ... + +class RadialBarChart(ChartBase): + @overload + @classmethod + def create(cls, *children, cx: Optional[Union[Var[Union[int, str]], Union[int, str]]] = None, cy: Optional[Union[Var[Union[int, str]], Union[int, str]]] = None, start_angle: Optional[Union[Var[int], int]] = None, end_angle: Optional[Union[Var[int], int]] = None, inner_radius: Optional[Union[Var[Union[int, str]], Union[int, str]]] = None, outer_radius: Optional[Union[Var[Union[int, str]], Union[int, str]]] = None, bar_category_gap: Optional[Union[Var[Union[int, str]], Union[int, str]]] = None, bar_gap: Optional[Union[Var[str], str]] = None, bar_size: Optional[Union[Var[int], int]] = None, valid_children: Optional[List[str]] = None, on_click: 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, **props) -> "RadialBarChart": # type: ignore + """Create a chart component. + + Args: + *children: The children of the chart component. + cx: The The x-coordinate of center. If set a percentage, the final value is obtained by multiplying the percentage of width. Number | Percentage + cy: The The y-coordinate of center. If set a percentage, the final value is obtained by multiplying the percentage of height. Number | Percentage + start_angle: The angle of first radial direction line. + end_angle: The angle of last point in the circle which should be startAngle - 360 or startAngle + 360. We'll calculate the direction of chart by 'startAngle' and 'endAngle'. + inner_radius: The inner radius of first circle grid. If set a percentage, the final value is obtained by multiplying the percentage of maxRadius which is calculated by the width, height, cx, cy. Number | Percentage + outer_radius: The outer radius of last circle grid. If set a percentage, the final value is obtained by multiplying the percentage of maxRadius which is calculated by the width, height, cx, cy. Number | Percentage + bar_category_gap: The gap between two bar categories, which can be a percent value or a fixed value. Percentage | Number + bar_gap: The gap between two bars in the same category, which can be a percent value or a fixed value. Percentage | Number + bar_size: The size of each bar. If the barSize is not specified, the size of bar will be calculated by the barCategoryGap, barGap and the quantity of bar groups. + valid_children: Valid children components + **props: The properties of the chart component. + + Returns: + The chart component wrapped in a responsive container. + """ + ... + +class ScatterChart(ChartBase): + @overload + @classmethod + def create(cls, *children, valid_children: Optional[List[str]] = None, on_click: 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, **props) -> "ScatterChart": # type: ignore + """Create a chart component. + + Args: + *children: The children of the chart component. + valid_children: Valid children components + **props: The properties of the chart component. + + Returns: + The chart component wrapped in a responsive container. + """ + ... + +class FunnelChart(RechartsCharts): + @overload + @classmethod + def create(cls, *children, data: Optional[Union[Var[List[Dict[str, Any]]], List[Dict[str, Any]]]] = None, sync_id: Optional[Union[Var[str], str]] = None, sync_method: Optional[Union[Var[str], str]] = None, width: Optional[Union[Var[Union[str, int]], Union[str, int]]] = None, height: Optional[Union[Var[Union[str, int]], Union[str, int]]] = None, layout: Optional[Union[Var[str], str]] = None, margin: Optional[Union[Var[Dict[str, Any]], Dict[str, Any]]] = None, stack_offset: Optional[Union[Var[Literal["expand", "none", "wiggle", "silhouette"]], Literal["expand", "none", "wiggle", "silhouette"]]] = None, valid_children: Optional[List[str]] = None, on_click: 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, **props) -> "FunnelChart": # type: ignore + """Create the component. + + Args: + *children: The children of the component. + data: The source data, in which each element is an object. + sync_id: If any two categorical charts(rx.line_chart, rx.area_chart, rx.bar_chart, rx.composed_chart) have the same sync_id, these two charts can sync the position GraphingTooltip, and the start_index, end_index of Brush. + sync_method: When sync_id is provided, allows customisation of how the charts will synchronize GraphingTooltips and brushes. Using 'index' (default setting), other charts will reuse current datum's index within the data array. In cases where data does not have the same length, this might yield unexpected results. In that case use 'value' which will try to match other charts values, or a fully custom function which will receive tick, data as argument and should return an index. 'index' | 'value' | function + width: The width of chart container. String or Integer + height: The height of chart container. + layout: The layout of bars in the chart. centeric + margin: The sizes of whitespace around the chart. + stack_offset: The type of offset function used to generate the lower and upper values in the series array. The four types are built-in offsets in d3-shape. 'expand' | 'none' | 'wiggle' | 'silhouette' + valid_children: Valid children components + **props: The props of the component. + + Returns: + The component. + + Raises: + TypeError: If an invalid child is passed. + """ + ... + +class Treemap(RechartsCharts): + @overload + @classmethod + def create(cls, *children, width: Optional[Union[Var[Union[str, int]], Union[str, int]]] = None, height: Optional[Union[Var[Union[str, int]], Union[str, int]]] = None, data: Optional[Union[Var[List[Dict[str, Any]]], List[Dict[str, Any]]]] = None, data_key: Optional[Union[Var[Union[str, int]], Union[str, int]]] = None, aspect_ratio: Optional[Union[Var[int], int]] = None, is_animation_active: Optional[Union[Var[bool], bool]] = None, animation_begin: Optional[Union[Var[int], int]] = None, animation_duration: Optional[Union[Var[int], int]] = None, animation_easing: Optional[Union[Var[Literal["ease", "ease-in", "ease-out", "ease-in-out", "linear"]], Literal["ease", "ease-in", "ease-out", "ease-in-out", "linear"]]] = 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) -> "Treemap": # type: ignore + """Create a chart component. + + Args: + *children: The children of the chart component. + width: The width of chart container. String or Integer + height: The height of chart container. + data: data of treemap. Array + data_key: The key of a group of data which should be unique in a treemap. String | Number | Function + aspect_ratio: The treemap will try to keep every single rectangle's aspect ratio near the aspectRatio given. Number + is_animation_active: If set false, animation of area will be disabled. + animation_begin: Specifies when the animation should begin, the unit of this option is ms. + animation_duration: Specifies the duration of animation, the unit of this option is ms. + animation_easing: The type of easing function. 'ease' | 'ease-in' | 'ease-out' | 'ease-in-out' | 'linear' + **props: The properties of the chart component. + + Returns: + The Treemap component wrapped in a responsive container. + """ + ... diff --git a/reflex/components/graphing/recharts/general.py b/reflex/components/graphing/recharts/general.py index 1053395ec..868187d6f 100644 --- a/reflex/components/graphing/recharts/general.py +++ b/reflex/components/graphing/recharts/general.py @@ -6,7 +6,14 @@ from typing import Any, Dict, List, Union from reflex.constants import EventTriggers from reflex.vars import Var -from .recharts import Recharts +from .recharts import ( + LiteralIconType, + LiteralLayout, + LiteralLegendAlign, + LiteralPosition, + LiteralVerticalAlign, + Recharts, +) class ResponsiveContainer(Recharts): @@ -62,19 +69,19 @@ class Legend(Recharts): height: Var[int] # The layout of legend items. 'horizontal' | 'vertical' - layout: Var[str] + layout: Var[LiteralLayout] # The alignment of legend items in 'horizontal' direction, which can be 'left', 'center', 'right'. - align: Var[str] + align: Var[LiteralLegendAlign] # The alignment of legend items in 'vertical' direction, which can be 'top', 'middle', 'bottom'. - vertical_align: Var[str] + vertical_align: Var[LiteralVerticalAlign] # The size of icon in each legend item. icon_size: Var[int] # The type of icon in each legend item. 'line' | 'plainline' | 'square' | 'rect' | 'circle' | 'cross' | 'diamond' | 'star' | 'triangle' | 'wye' - icon_type: Var[str] + icon_type: Var[LiteralIconType] # The width of chart container, usually calculated internally. chart_width: Var[int] @@ -150,7 +157,7 @@ class Label(Recharts): offset: Var[int] # The position of label which can be specified by this props or the children of