Bläddra i källkod

Props as Literals (#1921)

Elijah Ahianyo 1 år sedan
förälder
incheckning
c6abeb31a5
83 ändrade filer med 1684 tillägg och 188 borttagningar
  1. 18 1
      reflex/components/component.py
  2. 2 2
      reflex/components/datadisplay/badge.py
  3. 2 2
      reflex/components/datadisplay/badge.pyi
  4. 3 3
      reflex/components/datadisplay/code.py
  5. 2 2
      reflex/components/datadisplay/code.pyi
  6. 4 3
      reflex/components/datadisplay/divider.py
  7. 2 2
      reflex/components/datadisplay/divider.pyi
  8. 3 2
      reflex/components/datadisplay/table.pyi
  9. 10 5
      reflex/components/datadisplay/tag.py
  10. 2 2
      reflex/components/datadisplay/tag.pyi
  11. 9 4
      reflex/components/disclosure/tabs.py
  12. 1 2
      reflex/components/disclosure/tabs.pyi
  13. 7 3
      reflex/components/feedback/alert.py
  14. 2 2
      reflex/components/feedback/alert.pyi
  15. 2 1
      reflex/components/feedback/circularprogress.py
  16. 2 1
      reflex/components/feedback/circularprogress.pyi
  17. 1 1
      reflex/components/feedback/progress.py
  18. 1 1
      reflex/components/feedback/progress.pyi
  19. 2 2
      reflex/components/feedback/spinner.py
  20. 2 2
      reflex/components/feedback/spinner.pyi
  21. 13 9
      reflex/components/forms/button.py
  22. 1 2
      reflex/components/forms/button.pyi
  23. 7 3
      reflex/components/forms/checkbox.py
  24. 1 1
      reflex/components/forms/checkbox.pyi
  25. 26 2
      reflex/components/forms/editor.py
  26. 0 0
      reflex/components/forms/editor.pyi
  27. 7 3
      reflex/components/forms/input.py
  28. 1 1
      reflex/components/forms/input.pyi
  29. 6 3
      reflex/components/forms/numberinput.py
  30. 1 1
      reflex/components/forms/numberinput.pyi
  31. 2 2
      reflex/components/forms/pininput.py
  32. 1 1
      reflex/components/forms/pininput.pyi
  33. 2 2
      reflex/components/forms/rangeslider.py
  34. 1 1
      reflex/components/forms/rangeslider.pyi
  35. 2 2
      reflex/components/forms/select.py
  36. 1 2
      reflex/components/forms/select.pyi
  37. 4 3
      reflex/components/forms/slider.py
  38. 1 1
      reflex/components/forms/slider.pyi
  39. 2 2
      reflex/components/forms/switch.py
  40. 1 2
      reflex/components/forms/switch.pyi
  41. 2 2
      reflex/components/forms/textarea.py
  42. 1 1
      reflex/components/forms/textarea.pyi
  43. 26 0
      reflex/components/graphing/recharts/__init__.py
  44. 32 18
      reflex/components/graphing/recharts/cartesian.py
  45. 373 0
      reflex/components/graphing/recharts/cartesian.pyi
  46. 18 11
      reflex/components/graphing/recharts/charts.py
  47. 220 0
      reflex/components/graphing/recharts/charts.pyi
  48. 15 8
      reflex/components/graphing/recharts/general.py
  49. 93 0
      reflex/components/graphing/recharts/general.pyi
  50. 11 5
      reflex/components/graphing/recharts/polar.py
  51. 49 0
      reflex/components/graphing/recharts/polar.pyi
  52. 104 1
      reflex/components/graphing/recharts/recharts.py
  53. 148 0
      reflex/components/graphing/recharts/recharts.pyi
  54. 10 5
      reflex/components/layout/card.py
  55. 1 2
      reflex/components/layout/card.pyi
  56. 4 2
      reflex/components/layout/stack.py
  57. 2 2
      reflex/components/layout/stack.pyi
  58. 30 0
      reflex/components/libs/__init__.py
  59. 105 0
      reflex/components/libs/chakra.py
  60. 102 1
      reflex/components/libs/chakra.pyi
  61. 2 2
      reflex/components/media/avatar.py
  62. 2 2
      reflex/components/media/avatar.pyi
  63. 2 2
      reflex/components/media/image.py
  64. 1 1
      reflex/components/media/image.pyi
  65. 2 2
      reflex/components/navigation/stepper.py
  66. 2 2
      reflex/components/navigation/stepper.pyi
  67. 2 2
      reflex/components/overlay/alertdialog.py
  68. 1 1
      reflex/components/overlay/alertdialog.pyi
  69. 12 2
      reflex/components/overlay/drawer.py
  70. 1 1
      reflex/components/overlay/drawer.pyi
  71. 10 5
      reflex/components/overlay/menu.py
  72. 1 1
      reflex/components/overlay/menu.pyi
  73. 2 2
      reflex/components/overlay/modal.py
  74. 1 1
      reflex/components/overlay/modal.pyi
  75. 9 4
      reflex/components/overlay/popover.py
  76. 1 1
      reflex/components/overlay/popover.pyi
  77. 2 2
      reflex/components/overlay/tooltip.py
  78. 1 1
      reflex/components/overlay/tooltip.pyi
  79. 3 2
      reflex/components/typography/heading.py
  80. 2 2
      reflex/components/typography/heading.pyi
  81. 23 1
      reflex/utils/types.py
  82. 88 4
      scripts/pyi_generator.py
  83. 11 1
      tests/utils/test_utils.py

+ 18 - 1
reflex/components/component.py

@@ -106,6 +106,7 @@ class Component(Base, ABC):
 
 
         Raises:
         Raises:
             TypeError: If an invalid prop is passed.
             TypeError: If an invalid prop is passed.
+            ValueError: If a prop value is invalid.
         """
         """
         # Set the id and children initially.
         # Set the id and children initially.
         children = kwargs.get("children", [])
         children = kwargs.get("children", [])
@@ -154,9 +155,25 @@ class Component(Base, ABC):
                     if kwargs[key] is None:
                     if kwargs[key] is None:
                         raise TypeError
                         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.
                     # Get the passed type and the var type.
                     passed_type = kwargs[key]._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:
                 except TypeError:
                     # If it is not a valid var, check the base types.
                     # If it is not a valid var, check the base types.
                     passed_type = type(value)
                     passed_type = type(value)

+ 2 - 2
reflex/components/datadisplay/badge.py

@@ -1,6 +1,6 @@
 """Badge component."""
 """Badge component."""
 
 
-from reflex.components.libs.chakra import ChakraComponent
+from reflex.components.libs.chakra import ChakraComponent, LiteralVariant
 from reflex.vars import Var
 from reflex.vars import Var
 
 
 
 
@@ -10,7 +10,7 @@ class Badge(ChakraComponent):
     tag = "Badge"
     tag = "Badge"
 
 
     # Variant of the badge ("solid" | "subtle" | "outline")
     # Variant of the badge ("solid" | "subtle" | "outline")
-    variant: Var[str]
+    variant: Var[LiteralVariant]
 
 
     # The color of the badge
     # The color of the badge
     color_scheme: Var[str]
     color_scheme: Var[str]

+ 2 - 2
reflex/components/datadisplay/badge.pyi

@@ -3,7 +3,7 @@
 # This file was generated by `scripts/pyi_generator.py`!
 # 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.libs.chakra import ChakraComponent
 from reflex.components.component import Component
 from reflex.components.component import Component
 from reflex.vars import Var, BaseVar, ComputedVar
 from reflex.vars import Var, BaseVar, ComputedVar
@@ -12,7 +12,7 @@ from reflex.event import EventHandler, EventChain, EventSpec
 class Badge(ChakraComponent):
 class Badge(ChakraComponent):
     @overload
     @overload
     @classmethod
     @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.
         """Create the component.
 
 
         Args:
         Args:

+ 3 - 3
reflex/components/datadisplay/code.py

@@ -5,7 +5,7 @@ from typing import Dict, Optional, Union
 from reflex.components.component import Component
 from reflex.components.component import Component
 from reflex.components.forms import Button
 from reflex.components.forms import Button
 from reflex.components.layout import Box
 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.components.media import Icon
 from reflex.event import set_clipboard
 from reflex.event import set_clipboard
 from reflex.style import Style
 from reflex.style import Style
@@ -24,7 +24,7 @@ class CodeBlock(Component):
     tag = "Prism"
     tag = "Prism"
 
 
     # The theme to use ("light" or "dark").
     # The theme to use ("light" or "dark").
-    theme: Var[str]
+    theme: Var[LiteralTheme]
 
 
     # The language to use.
     # The language to use.
     language: Var[str]
     language: Var[str]
@@ -59,7 +59,7 @@ class CodeBlock(Component):
         *children,
         *children,
         can_copy: Optional[bool] = False,
         can_copy: Optional[bool] = False,
         copy_button: Optional[Union[bool, Component]] = None,
         copy_button: Optional[Union[bool, Component]] = None,
-        **props
+        **props,
     ):
     ):
         """Create a text component.
         """Create a text component.
 
 

+ 2 - 2
reflex/components/datadisplay/code.pyi

@@ -3,7 +3,7 @@
 # This file was generated by `scripts/pyi_generator.py`!
 # 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.libs.chakra import ChakraComponent
 from reflex.components.component import Component
 from reflex.components.component import Component
 from reflex.vars import Var, BaseVar, ComputedVar
 from reflex.vars import Var, BaseVar, ComputedVar
@@ -14,7 +14,7 @@ PRISM_STYLES_PATH: str
 class CodeBlock(Component):
 class CodeBlock(Component):
     @overload
     @overload
     @classmethod
     @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.
         """Create a text component.
 
 
         Args:
         Args:

+ 4 - 3
reflex/components/datadisplay/divider.py

@@ -1,6 +1,7 @@
 """A line to divide parts of the layout."""
 """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
 from reflex.vars import Var
 
 
 
 
@@ -10,7 +11,7 @@ class Divider(ChakraComponent):
     tag = "Divider"
     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.
     # 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 of the divider ("solid" | "dashed")
-    variant: Var[str]
+    variant: Var[LiteralDividerVariant]

+ 2 - 2
reflex/components/datadisplay/divider.pyi

@@ -3,7 +3,7 @@
 # This file was generated by `scripts/pyi_generator.py`!
 # 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.libs.chakra import ChakraComponent
 from reflex.components.component import Component
 from reflex.components.component import Component
 from reflex.vars import Var, BaseVar, ComputedVar
 from reflex.vars import Var, BaseVar, ComputedVar
@@ -12,7 +12,7 @@ from reflex.event import EventHandler, EventChain, EventSpec
 class Divider(ChakraComponent):
 class Divider(ChakraComponent):
     @overload
     @overload
     @classmethod
     @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.
         """Create the component.
 
 
         Args:
         Args:

+ 3 - 2
reflex/components/datadisplay/table.pyi

@@ -3,7 +3,7 @@
 # This file was generated by `scripts/pyi_generator.py`!
 # 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.libs.chakra import ChakraComponent
 from reflex.components.component import Component
 from reflex.components.component import Component
 from reflex.vars import Var, BaseVar, ComputedVar
 from reflex.vars import Var, BaseVar, ComputedVar
@@ -46,6 +46,7 @@ class Thead(ChakraComponent):
 
 
         Returns:
         Returns:
             The table header component.
             The table header component.
+
         """
         """
         ...
         ...
 
 
@@ -62,7 +63,7 @@ class Tbody(ChakraComponent):
             **props: The properties of the component.
             **props: The properties of the component.
 
 
         Returns:
         Returns:
-            Component: _description_
+            Component: The table body component
         """
         """
         ...
         ...
 
 

+ 10 - 5
reflex/components/datadisplay/tag.py

@@ -2,7 +2,12 @@
 from typing import Optional
 from typing import Optional
 
 
 from reflex.components.component import Component
 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
 from reflex.vars import Var
 
 
 
 
@@ -39,17 +44,17 @@ class Tag(ChakraComponent):
     # options: "gray" | "red" | "orange" | "yellow" | "green" | "teal" | "blue" |
     # options: "gray" | "red" | "orange" | "yellow" | "green" | "teal" | "blue" |
     #  "cyan" | "purple" | "pink"
     #  "cyan" | "purple" | "pink"
     # default: "gray"
     # default: "gray"
-    color_scheme: Var[str]
+    color_scheme: Var[LiteralTagColorScheme]
 
 
     # The size of the tag
     # The size of the tag
     # options: "sm" | "md" | "lg"
     # options: "sm" | "md" | "lg"
     # default: "md"
     # default: "md"
-    size: Var[str]
+    size: Var[LiteralTagSize]
 
 
     # The variant of the tag
     # The variant of the tag
     # options: "solid" | "subtle" | "outline"
     # options: "solid" | "subtle" | "outline"
     # default: "solid"
     # default: "solid"
-    variant: Var[str]
+    variant: Var[LiteralVariant]
 
 
     @classmethod
     @classmethod
     def create(
     def create(
@@ -59,7 +64,7 @@ class Tag(ChakraComponent):
         left_icon: Optional[Component] = None,
         left_icon: Optional[Component] = None,
         right_icon: Optional[Component] = None,
         right_icon: Optional[Component] = None,
         close_button: Optional[Component] = None,
         close_button: Optional[Component] = None,
-        **props
+        **props,
     ) -> Component:
     ) -> Component:
         """Creates a Chakra Tag with a label and optionally left_icon, right_icon, and close_button, and returns it.
         """Creates a Chakra Tag with a label and optionally left_icon, right_icon, and close_button, and returns it.
 
 

+ 2 - 2
reflex/components/datadisplay/tag.pyi

@@ -3,7 +3,7 @@
 # This file was generated by `scripts/pyi_generator.py`!
 # 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.libs.chakra import ChakraComponent
 from reflex.components.component import Component
 from reflex.components.component import Component
 from reflex.vars import Var, BaseVar, ComputedVar
 from reflex.vars import Var, BaseVar, ComputedVar
@@ -84,7 +84,7 @@ class TagCloseButton(ChakraComponent):
 class Tag(ChakraComponent):
 class Tag(ChakraComponent):
     @overload
     @overload
     @classmethod
     @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.
         """Creates a Chakra Tag with a label and optionally left_icon, right_icon, and close_button, and returns it.
 
 
         Args:
         Args:

+ 9 - 4
reflex/components/disclosure/tabs.py

@@ -3,7 +3,12 @@
 from typing import List, Optional, Tuple
 from typing import List, Optional, Tuple
 
 
 from reflex.components.component import Component
 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
 from reflex.vars import Var
 
 
 
 
@@ -13,7 +18,7 @@ class Tabs(ChakraComponent):
     tag = "Tabs"
     tag = "Tabs"
 
 
     # The alignment of the tabs ("center" | "end" | "start").
     # The alignment of the tabs ("center" | "end" | "start").
-    align: Var[str]
+    align: Var[LiteralTagAlign]
 
 
     # The initial index of the selected tab (in uncontrolled mode).
     # The initial index of the selected tab (in uncontrolled mode).
     default_index: Var[int]
     default_index: Var[int]
@@ -34,10 +39,10 @@ class Tabs(ChakraComponent):
     orientation: Var[str]
     orientation: Var[str]
 
 
     # "line" | "enclosed" | "enclosed-colored" | "soft-rounded" | "solid-rounded" | "unstyled"
     # "line" | "enclosed" | "enclosed-colored" | "soft-rounded" | "solid-rounded" | "unstyled"
-    variant: Var[str]
+    variant: Var[LiteralTabsVariant]
 
 
     # The color scheme of the tabs.
     # The color scheme of the tabs.
-    color_scheme: Var[str]
+    color_scheme: Var[LiteralColorScheme]
 
 
     @classmethod
     @classmethod
     def create(
     def create(

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 1 - 2
reflex/components/disclosure/tabs.pyi


+ 7 - 3
reflex/components/feedback/alert.py

@@ -1,7 +1,11 @@
 """Alert components."""
 """Alert components."""
 
 
 from reflex.components.component import Component
 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
 from reflex.vars import Var
 
 
 
 
@@ -11,10 +15,10 @@ class Alert(ChakraComponent):
     tag = "Alert"
     tag = "Alert"
 
 
     # The status of the alert ("success" | "info" | "warning" | "error")
     # The status of the alert ("success" | "info" | "warning" | "error")
-    status: Var[str]
+    status: Var[LiteralStatus]
 
 
     # "subtle" | "left-accent" | "top-accent" | "solid"
     # "subtle" | "left-accent" | "top-accent" | "solid"
-    variant: Var[str]
+    variant: Var[LiteralAlertVariant]
 
 
     @classmethod
     @classmethod
     def create(
     def create(

+ 2 - 2
reflex/components/feedback/alert.pyi

@@ -3,7 +3,7 @@
 # This file was generated by `scripts/pyi_generator.py`!
 # 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.libs.chakra import ChakraComponent
 from reflex.components.component import Component
 from reflex.components.component import Component
 from reflex.vars import Var, BaseVar, ComputedVar
 from reflex.vars import Var, BaseVar, ComputedVar
@@ -12,7 +12,7 @@ from reflex.event import EventHandler, EventChain, EventSpec
 class Alert(ChakraComponent):
 class Alert(ChakraComponent):
     @overload
     @overload
     @classmethod
     @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.
         """Create an alert component.
 
 
         Args:
         Args:

+ 2 - 1
reflex/components/feedback/circularprogress.py

@@ -1,4 +1,5 @@
 """Container to stack elements with spacing."""
 """Container to stack elements with spacing."""
+from typing import Union
 
 
 from reflex.components.component import Component
 from reflex.components.component import Component
 from reflex.components.libs.chakra import ChakraComponent
 from reflex.components.libs.chakra import ChakraComponent
@@ -23,7 +24,7 @@ class CircularProgress(ChakraComponent):
     min_: Var[int]
     min_: Var[int]
 
 
     # This defines the stroke width of the svg circle.
     # 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
     # The color name of the progress track. Use a color key in the theme object
     track_color: Var[str]
     track_color: Var[str]

+ 2 - 1
reflex/components/feedback/circularprogress.pyi

@@ -12,7 +12,7 @@ from reflex.event import EventHandler, EventChain, EventSpec
 class CircularProgress(ChakraComponent):
 class CircularProgress(ChakraComponent):
     @overload
     @overload
     @classmethod
     @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.
         """Create a circular progress component.
 
 
         Args:
         Args:
@@ -26,6 +26,7 @@ class CircularProgress(ChakraComponent):
             value: Current progress (must be between min/max).
             value: Current progress (must be between min/max).
             value_text: The desired valueText to use in place of the value.
             value_text: The desired valueText to use in place of the value.
             color: The color name of the progress bar
             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.
             label: A label to add in the circular progress. Defaults to None.
             **props: the props of the component.
             **props: the props of the component.
 
 

+ 1 - 1
reflex/components/feedback/progress.py

@@ -14,7 +14,7 @@ class Progress(ChakraComponent):
     # If true, the progress bar will show stripe
     # If true, the progress bar will show stripe
     has_stripe: Var[bool]
     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]
     is_animated: Var[bool]
 
 
     # If true, the progress will be indeterminate and the value prop will be ignored
     # If true, the progress will be indeterminate and the value prop will be ignored

+ 1 - 1
reflex/components/feedback/progress.pyi

@@ -18,7 +18,7 @@ class Progress(ChakraComponent):
         Args:
         Args:
             *children: The children of the component.
             *children: The children of the component.
             has_stripe: If true, the progress bar will show stripe
             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
             is_indeterminate: If true, the progress will be indeterminate and the value prop will be ignored
             max_: The maximum value of the progress
             max_: The maximum value of the progress
             min_: The minimum value of the progress
             min_: The minimum value of the progress

+ 2 - 2
reflex/components/feedback/spinner.py

@@ -1,6 +1,6 @@
 """Container to stack elements with spacing."""
 """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
 from reflex.vars import Var
 
 
 
 
@@ -22,4 +22,4 @@ class Spinner(ChakraComponent):
     thickness: Var[int]
     thickness: Var[int]
 
 
     # "xs" | "sm" | "md" | "lg" | "xl"
     # "xs" | "sm" | "md" | "lg" | "xl"
-    size: Var[str]
+    size: Var[LiteralSpinnerSize]

+ 2 - 2
reflex/components/feedback/spinner.pyi

@@ -3,7 +3,7 @@
 # This file was generated by `scripts/pyi_generator.py`!
 # 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.libs.chakra import ChakraComponent
 from reflex.components.component import Component
 from reflex.components.component import Component
 from reflex.vars import Var, BaseVar, ComputedVar
 from reflex.vars import Var, BaseVar, ComputedVar
@@ -12,7 +12,7 @@ from reflex.event import EventHandler, EventChain, EventSpec
 class Spinner(ChakraComponent):
 class Spinner(ChakraComponent):
     @overload
     @overload
     @classmethod
     @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.
         """Create the component.
 
 
         Args:
         Args:

+ 13 - 9
reflex/components/forms/button.py

@@ -1,7 +1,13 @@
 """A button component."""
 """A button component."""
 from typing import List
 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
 from reflex.vars import Var
 
 
 
 
@@ -29,21 +35,20 @@ class Button(ChakraComponent):
     loading_text: Var[str]
     loading_text: Var[str]
 
 
     # "lg" | "md" | "sm" | "xs"
     # "lg" | "md" | "sm" | "xs"
-    size: Var[str]
-
+    size: Var[LiteralButtonSize]
     # "ghost" | "outline" | "solid" | "link" | "unstyled"
     # "ghost" | "outline" | "solid" | "link" | "unstyled"
-    variant: Var[str]
+    variant: Var[LiteralButtonVariant]
 
 
     # Built in color scheme for ease of use.
     # Built in color scheme for ease of use.
     # Options:
     # Options:
     # "whiteAlpha" | "blackAlpha" | "gray" | "red" | "orange" | "yellow" | "green" | "teal" | "blue" | "cyan"
     # "whiteAlpha" | "blackAlpha" | "gray" | "red" | "orange" | "yellow" | "green" | "teal" | "blue" | "cyan"
     # | "purple" | "pink" | "linkedin" | "facebook" | "messenger" | "whatsapp" | "twitter" | "telegram"
     # | "purple" | "pink" | "linkedin" | "facebook" | "messenger" | "whatsapp" | "twitter" | "telegram"
-    color_scheme: Var[str]
+    color_scheme: Var[LiteralColorScheme]
 
 
     # Position of the loading spinner.
     # Position of the loading spinner.
     # Options:
     # Options:
     # "start" | "end"
     # "start" | "end"
-    spinner_placement: Var[str]
+    spinner_placement: Var[LiteralSpinnerPlacement]
 
 
     # The type of button.
     # The type of button.
     type_: Var[str]
     type_: Var[str]
@@ -67,7 +72,6 @@ class ButtonGroup(ChakraComponent):
     spacing: Var[int]
     spacing: Var[int]
 
 
     # "lg" | "md" | "sm" | "xs"
     # "lg" | "md" | "sm" | "xs"
-    size: Var[str]
-
+    size: Var[LiteralButtonSize]
     # "ghost" | "outline" | "solid" | "link" | "unstyled"
     # "ghost" | "outline" | "solid" | "link" | "unstyled"
-    variant: Var[str]
+    variant: Var[LiteralButtonVariant]

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 1 - 2
reflex/components/forms/button.pyi


+ 7 - 3
reflex/components/forms/checkbox.py

@@ -3,7 +3,11 @@ from __future__ import annotations
 
 
 from typing import Any, Union
 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.constants import EventTriggers
 from reflex.vars import Var
 from reflex.vars import Var
 
 
@@ -17,10 +21,10 @@ class Checkbox(ChakraComponent):
     # Options:
     # Options:
     # "whiteAlpha" | "blackAlpha" | "gray" | "red" | "orange" | "yellow" | "green" | "teal" | "blue" | "cyan"
     # "whiteAlpha" | "blackAlpha" | "gray" | "red" | "orange" | "yellow" | "green" | "teal" | "blue" | "cyan"
     # | "purple" | "pink" | "linkedin" | "facebook" | "messenger" | "whatsapp" | "twitter" | "telegram"
     # | "purple" | "pink" | "linkedin" | "facebook" | "messenger" | "whatsapp" | "twitter" | "telegram"
-    color_scheme: Var[str]
+    color_scheme: Var[LiteralColorScheme]
 
 
     # "sm" | "md" | "lg"
     # "sm" | "md" | "lg"
-    size: Var[str]
+    size: Var[LiteralTagSize]
 
 
     # If true, the checkbox will be checked.
     # If true, the checkbox will be checked.
     is_checked: Var[bool]
     is_checked: Var[bool]

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 1 - 1
reflex/components/forms/checkbox.pyi


+ 26 - 2
reflex/components/forms/editor.py

@@ -2,7 +2,7 @@
 from __future__ import annotations
 from __future__ import annotations
 
 
 import enum
 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.base import Base
 from reflex.components.component import Component, NoSSRComponent
 from reflex.components.component import Component, NoSSRComponent
@@ -86,7 +86,31 @@ class Editor(NoSSRComponent):
     # options: "en" | "da" | "de" | "es" | "fr" | "ja" | "ko" | "pt_br" |
     # options: "en" | "da" | "de" | "es" | "fr" | "ja" | "ko" | "pt_br" |
     #  "ru" | "zh_cn" | "ro" | "pl" | "ckb" | "lv" | "se" | "ua" | "he" | "it"
     #  "ru" | "zh_cn" | "ro" | "pl" | "ckb" | "lv" | "se" | "ua" | "he" | "it"
     # default : "en"
     # 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 is used to set the HTML form name of the editor.
     # This means on HTML form submission,
     # This means on HTML form submission,

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 0 - 0
reflex/components/forms/editor.pyi


+ 7 - 3
reflex/components/forms/input.py

@@ -4,7 +4,11 @@ from typing import Any, Dict
 
 
 from reflex.components.component import Component
 from reflex.components.component import Component
 from reflex.components.forms.debounce import DebounceInput
 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.constants import EventTriggers
 from reflex.utils import imports
 from reflex.utils import imports
 from reflex.vars import ImportVar, Var
 from reflex.vars import ImportVar, Var
@@ -46,10 +50,10 @@ class Input(ChakraComponent):
     is_required: Var[bool]
     is_required: Var[bool]
 
 
     # "outline" | "filled" | "flushed" | "unstyled"
     # "outline" | "filled" | "flushed" | "unstyled"
-    variant: Var[str]
+    variant: Var[LiteralInputVariant]
 
 
     # "lg" | "md" | "sm" | "xs"
     # "lg" | "md" | "sm" | "xs"
-    size: Var[str]
+    size: Var[LiteralButtonSize]
 
 
     def _get_imports(self) -> imports.ImportDict:
     def _get_imports(self) -> imports.ImportDict:
         return imports.merge_imports(
         return imports.merge_imports(

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 1 - 1
reflex/components/forms/input.pyi


+ 6 - 3
reflex/components/forms/numberinput.py

@@ -4,7 +4,10 @@ from numbers import Number
 from typing import Any, Dict
 from typing import Any, Dict
 
 
 from reflex.components.component import Component
 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.constants import EventTriggers
 from reflex.vars import Var
 from reflex.vars import Var
 
 
@@ -36,7 +39,7 @@ class NumberInput(ChakraComponent):
     focus_input_on_change: Var[bool]
     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")
     # 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.
     # Whether the input should be disabled.
     is_disabled: Var[bool]
     is_disabled: Var[bool]
@@ -63,7 +66,7 @@ class NumberInput(ChakraComponent):
     min_: Var[Number]
     min_: Var[Number]
 
 
     # "outline" | "filled" | "flushed" | "unstyled"
     # "outline" | "filled" | "flushed" | "unstyled"
-    variant: Var[str]
+    variant: Var[LiteralInputVariant]
 
 
     def get_event_triggers(self) -> Dict[str, Any]:
     def get_event_triggers(self) -> Dict[str, Any]:
         """Get the event triggers that pass the component's value to the handler.
         """Get the event triggers that pass the component's value to the handler.

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 1 - 1
reflex/components/forms/numberinput.pyi


+ 2 - 2
reflex/components/forms/pininput.py

@@ -5,7 +5,7 @@ from typing import Any, Optional, Union
 
 
 from reflex.components.component import Component
 from reflex.components.component import Component
 from reflex.components.layout import Foreach
 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.constants import EventTriggers
 from reflex.utils import format
 from reflex.utils import format
 from reflex.vars import Var
 from reflex.vars import Var
@@ -56,7 +56,7 @@ class PinInput(ChakraComponent):
     type_: Var[str]
     type_: Var[str]
 
 
     # "outline" | "flushed" | "filled" | "unstyled"
     # "outline" | "flushed" | "filled" | "unstyled"
-    variant: Var[str]
+    variant: Var[LiteralInputVariant]
 
 
     def get_event_triggers(self) -> dict[str, Union[Var, Any]]:
     def get_event_triggers(self) -> dict[str, Union[Var, Any]]:
         """Get the event triggers that pass the component's value to the handler.
         """Get the event triggers that pass the component's value to the handler.

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 1 - 1
reflex/components/forms/pininput.pyi


+ 2 - 2
reflex/components/forms/rangeslider.py

@@ -4,7 +4,7 @@ from __future__ import annotations
 from typing import Any, List, Optional, Union
 from typing import Any, List, Optional, Union
 
 
 from reflex.components.component import Component
 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.constants import EventTriggers
 from reflex.utils import format
 from reflex.utils import format
 from reflex.vars import Var
 from reflex.vars import Var
@@ -22,7 +22,7 @@ class RangeSlider(ChakraComponent):
     default_value: Var[List[int]]
     default_value: Var[List[int]]
 
 
     # The writing mode ("ltr" | "rtl")
     # The writing mode ("ltr" | "rtl")
-    direction: Var[str]
+    direction: Var[LiteralChakraDirection]
 
 
     # If false, the slider handle will not capture focus when value changes.
     # If false, the slider handle will not capture focus when value changes.
     focus_thumb_on_change: Var[bool]
     focus_thumb_on_change: Var[bool]

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 1 - 1
reflex/components/forms/rangeslider.pyi


+ 2 - 2
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.component import Component
 from reflex.components.layout.foreach import Foreach
 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.components.typography.text import Text
 from reflex.constants import EventTriggers
 from reflex.constants import EventTriggers
 from reflex.utils.types import _issubclass
 from reflex.utils.types import _issubclass
@@ -41,7 +41,7 @@ class Select(ChakraComponent):
     is_required: Var[bool]
     is_required: Var[bool]
 
 
     # "outline" | "filled" | "flushed" | "unstyled"
     # "outline" | "filled" | "flushed" | "unstyled"
-    variant: Var[str]
+    variant: Var[LiteralInputVariant]
 
 
     # The size of the select.
     # The size of the select.
     size: Var[str]
     size: Var[str]

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 1 - 2
reflex/components/forms/select.pyi


+ 4 - 3
reflex/components/forms/slider.py

@@ -4,7 +4,8 @@ from __future__ import annotations
 from typing import Any, Union
 from typing import Any, Union
 
 
 from reflex.components.component import Component
 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.constants import EventTriggers
 from reflex.vars import Var
 from reflex.vars import Var
 
 
@@ -24,7 +25,7 @@ class Slider(ChakraComponent):
     default_value: Var[int]
     default_value: Var[int]
 
 
     # The writing mode ("ltr" | "rtl")
     # The writing mode ("ltr" | "rtl")
-    direction: Var[str]
+    direction: Var[LiteralChakraDirection]
 
 
     # If false, the slider handle will not capture focus when value changes.
     # If false, the slider handle will not capture focus when value changes.
     focus_thumb_on_change: Var[bool]
     focus_thumb_on_change: Var[bool]
@@ -51,7 +52,7 @@ class Slider(ChakraComponent):
     min_steps_between_thumbs: Var[int]
     min_steps_between_thumbs: Var[int]
 
 
     # Oreintation of the slider vertical | horizontal.
     # Oreintation of the slider vertical | horizontal.
-    orientation: Var[str]
+    orientation: Var[LiteralLayout]
 
 
     # Minimum height of the slider.
     # Minimum height of the slider.
     min_h: Var[str]
     min_h: Var[str]

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 1 - 1
reflex/components/forms/slider.pyi


+ 2 - 2
reflex/components/forms/switch.py

@@ -3,7 +3,7 @@ from __future__ import annotations
 
 
 from typing import Any, Union
 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.constants import EventTriggers
 from reflex.vars import Var
 from reflex.vars import Var
 
 
@@ -41,7 +41,7 @@ class Switch(ChakraComponent):
     placeholder: Var[str]
     placeholder: Var[str]
 
 
     # The color scheme of the switch (e.g. "blue", "green", "red", etc.)
     # 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]]:
     def get_event_triggers(self) -> dict[str, Union[Var, Any]]:
         """Get the event triggers that pass the component's value to the handler.
         """Get the event triggers that pass the component's value to the handler.

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 1 - 2
reflex/components/forms/switch.pyi


+ 2 - 2
reflex/components/forms/textarea.py

@@ -5,7 +5,7 @@ from typing import Any, Union
 
 
 from reflex.components.component import Component
 from reflex.components.component import Component
 from reflex.components.forms.debounce import DebounceInput
 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.constants import EventTriggers
 from reflex.vars import Var
 from reflex.vars import Var
 
 
@@ -43,7 +43,7 @@ class TextArea(ChakraComponent):
     is_required: Var[bool]
     is_required: Var[bool]
 
 
     # "outline" | "filled" | "flushed" | "unstyled"
     # "outline" | "filled" | "flushed" | "unstyled"
-    variant: Var[str]
+    variant: Var[LiteralInputVariant]
 
 
     def get_event_triggers(self) -> dict[str, Union[Var, Any]]:
     def get_event_triggers(self) -> dict[str, Union[Var, Any]]:
         """Get the event triggers that pass the component's value to the handler.
         """Get the event triggers that pass the component's value to the handler.

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 1 - 1
reflex/components/forms/textarea.pyi


+ 26 - 0
reflex/components/graphing/recharts/__init__.py

@@ -39,6 +39,32 @@ from .polar import (
     Radar,
     Radar,
     RadialBar,
     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
 area_chart = AreaChart.create
 bar_chart = BarChart.create
 bar_chart = BarChart.create

+ 32 - 18
reflex/components/graphing/recharts/cartesian.py

@@ -6,7 +6,21 @@ from typing import Any, Dict, List, Union
 from reflex.constants import EventTriggers
 from reflex.constants import EventTriggers
 from reflex.vars import Var
 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):
 class Axis(Recharts):
@@ -19,10 +33,10 @@ class Axis(Recharts):
     hide: Var[bool]
     hide: Var[bool]
 
 
     # The orientation of axis 'top' | 'bottom'
     # The orientation of axis 'top' | 'bottom'
-    orientation: Var[str]
+    orientation: Var[LiteralOrientationTopBottom]
 
 
     # The type of axis 'number' | 'category'
     # The type of axis 'number' | 'category'
-    type_: Var[str]
+    type_: Var[LiteralPolarRadiusType]
 
 
     # Allow the ticks of XAxis to be decimals or not.
     # Allow the ticks of XAxis to be decimals or not.
     allow_decimals: Var[bool]
     allow_decimals: Var[bool]
@@ -46,7 +60,7 @@ class Axis(Recharts):
     reversed: Var[bool]
     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
     # 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.
     # 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]]
     unit: Var[Union[str, int]]
@@ -109,7 +123,7 @@ class ZAxis(Recharts):
     name: Var[Union[str, int]]
     name: Var[Union[str, int]]
 
 
     # If 'auto' set, the scale function is decided by the type of chart, and the props type.
     # 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):
 class Brush(Recharts):
@@ -167,7 +181,7 @@ class Cartesian(Recharts):
     """A base class for cartesian charts in Recharts."""
     """A base class for cartesian charts in Recharts."""
 
 
     # The layout of bar in the chart, usually inherited from parent. 'horizontal' | 'vertical'
     # 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.
     # The key of a group of data which should be unique in an area chart.
     data_key: Var[Union[str, int]]
     data_key: Var[Union[str, int]]
@@ -178,8 +192,8 @@ class Cartesian(Recharts):
     # The id of y-axis which is corresponding to the data.
     # The id of y-axis which is corresponding to the data.
     y_axis_id: Var[Union[str, int]]
     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]]:
     def get_event_triggers(self) -> dict[str, Union[Var, Any]]:
         """Get the event triggers that pass the component's value to the handler.
         """Get the event triggers that pass the component's value to the handler.
@@ -214,7 +228,7 @@ class Area(Cartesian):
     fill: Var[str]
     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' |
     # 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.
     # If false set, dots will not be drawn. If true set, dots will be drawn which have the props calculated internally.
     dot: Var[bool]
     dot: Var[bool]
@@ -275,7 +289,7 @@ class Line(Cartesian):
     alias = "RechartsLine"
     alias = "RechartsLine"
 
 
     # The interpolation type of line. And customized interpolation function can be set to type. It's the same as type in Area.
     # 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.
     # The color of the line stroke.
     stroke: Var[str]
     stroke: Var[str]
@@ -319,10 +333,10 @@ class Scatter(Cartesian):
     line: Var[bool]
     line: Var[bool]
 
 
     # If a string set, specified symbol will be used to show scatter item. 'circle' | 'cross' | 'diamond' | 'square' | 'star' | 'triangle' | 'wye'
     # 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'
     # 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
     # The fill
     fill: Var[str]
     fill: Var[str]
@@ -351,7 +365,7 @@ class Funnel(Cartesian):
     animation_duration: Var[int]
     animation_duration: Var[int]
 
 
     # The type of easing function. 'ease' | 'ease-in' | 'ease-out' | 'ease-in-out' | 'linear'
     # 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 components
     valid_children: List[str] = ["LabelList", "Cell"]
     valid_children: List[str] = ["LabelList", "Cell"]
@@ -365,7 +379,7 @@ class ErrorBar(Recharts):
     alias = "RechartsErrorBar"
     alias = "RechartsErrorBar"
 
 
     # The direction of error bar. 'x' | 'y' | 'both'
     # 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.
     # The key of a group of data which should be unique in an area chart.
     data_key: Var[Union[str, int]]
     data_key: Var[Union[str, int]]
@@ -396,7 +410,7 @@ class Reference(Recharts):
     y: Var[str]
     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.
     # 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.
     # If set true, the line will be rendered in front of bars in BarChart, etc.
     is_front: Var[bool]
     is_front: Var[bool]
@@ -477,7 +491,7 @@ class ReferenceArea(Recharts):
     y2: Var[Union[str, int]]
     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.
     # 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.
     # If set true, the line will be rendered in front of bars in BarChart, etc.
     is_front: Var[bool]
     is_front: Var[bool]
@@ -533,7 +547,7 @@ class CartesianAxis(Grid):
     alias = "RechartsCartesianAxis"
     alias = "RechartsCartesianAxis"
 
 
     # The orientation of axis 'top' | 'bottom' | 'left' | 'right'
     # 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.
     # 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]
     axis_line: Var[bool]
@@ -545,7 +559,7 @@ class CartesianAxis(Grid):
     tick_size: Var[int]
     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.
     # 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.
     # If set false, no ticks will be drawn.
     ticks: Var[bool]
     ticks: Var[bool]

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 373 - 0
reflex/components/graphing/recharts/cartesian.pyi


+ 18 - 11
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.constants import EventTriggers
 from reflex.vars import Var
 from reflex.vars import Var
 
 
-from .recharts import RechartsCharts
+from .recharts import (
+    LiteralAnimationEasing,
+    LiteralComposedChartBaseValue,
+    LiteralLayout,
+    LiteralStackOffset,
+    LiteralSyncMethod,
+    RechartsCharts,
+)
 
 
 
 
 class ChartBase(RechartsCharts):
 class ChartBase(RechartsCharts):
@@ -21,7 +28,7 @@ class ChartBase(RechartsCharts):
     sync_id: Var[str]
     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
     # 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
     # The width of chart container. String or Integer
     width: Var[Union[str, int]] = "100%"  # type: ignore
     width: Var[Union[str, int]] = "100%"  # type: ignore
@@ -30,13 +37,13 @@ class ChartBase(RechartsCharts):
     height: Var[Union[str, int]] = "100%"  # type: ignore
     height: Var[Union[str, int]] = "100%"  # type: ignore
 
 
     # The layout of area in the chart. 'horizontal' | 'vertical'
     # The layout of area in the chart. 'horizontal' | 'vertical'
-    layout: Var[str]
+    layout: Var[LiteralLayout]
 
 
     # The sizes of whitespace around the chart.
     # The sizes of whitespace around the chart.
     margin: Var[Dict[str, Any]]
     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'
     # 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]]:
     def get_event_triggers(self) -> dict[str, Union[Var, Any]]:
         """Get the event triggers that pass the component's value to the handler.
         """Get the event triggers that pass the component's value to the handler.
@@ -77,10 +84,10 @@ class AreaChart(ChartBase):
     alias = "RechartsAreaChart"
     alias = "RechartsAreaChart"
 
 
     # The base value of area. Number | 'dataMin' | 'dataMax' | 'auto'
     # 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.
     # 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 components
     valid_children: List[str] = [
     valid_children: List[str] = [
@@ -117,7 +124,7 @@ class BarChart(ChartBase):
     max_bar_size: Var[int]
     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.
     # 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.)
     # 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]
     reverse_stack_order: Var[bool]
@@ -167,7 +174,7 @@ class ComposedChart(ChartBase):
     alias = "RechartsComposedChart"
     alias = "RechartsComposedChart"
 
 
     # The base value of area. Number | 'dataMin' | 'dataMax' | 'auto'
     # 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
     # 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
     bar_category_gap: Var[Union[str, int]]  # type: ignore
@@ -396,13 +403,13 @@ class FunnelChart(RechartsCharts):
     height: Var[Union[str, int]] = "100%"  # type: ignore
     height: Var[Union[str, int]] = "100%"  # type: ignore
 
 
     # The layout of area in the chart. 'horizontal' | 'vertical'
     # The layout of area in the chart. 'horizontal' | 'vertical'
-    layout: Var[str]
+    layout: Var[LiteralLayout]
 
 
     # The sizes of whitespace around the chart.
     # The sizes of whitespace around the chart.
     margin: Var[Dict[str, Any]]
     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'
     # 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
     # The layout of bars in the chart. centeric
     layout: Var[str]
     layout: Var[str]
@@ -456,7 +463,7 @@ class Treemap(RechartsCharts):
     animation_duration: Var[int]
     animation_duration: Var[int]
 
 
     # The type of easing function. 'ease' | 'ease-in' | 'ease-out' | 'ease-in-out' | 'linear'
     # The type of easing function. 'ease' | 'ease-in' | 'ease-out' | 'ease-in-out' | 'linear'
-    animation_easing: Var[str]
+    animation_easing: Var[LiteralAnimationEasing]
 
 
     @classmethod
     @classmethod
     def create(cls, *children, **props) -> Component:
     def create(cls, *children, **props) -> Component:

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 220 - 0
reflex/components/graphing/recharts/charts.pyi


+ 15 - 8
reflex/components/graphing/recharts/general.py

@@ -6,7 +6,14 @@ from typing import Any, Dict, List, Union
 from reflex.constants import EventTriggers
 from reflex.constants import EventTriggers
 from reflex.vars import Var
 from reflex.vars import Var
 
 
-from .recharts import Recharts
+from .recharts import (
+    LiteralIconType,
+    LiteralLayout,
+    LiteralLegendAlign,
+    LiteralPosition,
+    LiteralVerticalAlign,
+    Recharts,
+)
 
 
 
 
 class ResponsiveContainer(Recharts):
 class ResponsiveContainer(Recharts):
@@ -62,19 +69,19 @@ class Legend(Recharts):
     height: Var[int]
     height: Var[int]
 
 
     # The layout of legend items. 'horizontal' | 'vertical'
     # 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'.
     # 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'.
     # 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.
     # The size of icon in each legend item.
     icon_size: Var[int]
     icon_size: Var[int]
 
 
     # The type of icon in each legend item. 'line' | 'plainline' | 'square' | 'rect' | 'circle' | 'cross' | 'diamond' | 'star' | 'triangle' | 'wye'
     # 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.
     # The width of chart container, usually calculated internally.
     chart_width: Var[int]
     chart_width: Var[int]
@@ -150,7 +157,7 @@ class Label(Recharts):
     offset: Var[int]
     offset: Var[int]
 
 
     # The position of label which can be specified by this props or the children of <Label />
     # The position of label which can be specified by this props or the children of <Label />
-    position: Var[str]
+    position: Var[LiteralPosition]
 
 
 
 
 class LabelList(Recharts):
 class LabelList(Recharts):
@@ -163,8 +170,8 @@ class LabelList(Recharts):
     # The key of a group of label values in data.
     # The key of a group of label values in data.
     data_key: Var[Union[str, int]]
     data_key: Var[Union[str, int]]
 
 
-    # The position of each label relative to it view box。op" | "left" | "right" | "bottom" | "inside" | "outside" | "insideLeft" | "insideRight" | "insideTop" | "insideBottom" | "insideTopLeft" | "insideBottomLeft" | "insideTopRight" | "insideBottomRight" | "insideStart" | "insideEnd" | "end" | "center"
-    position: Var[str]
+    # The position of each label relative to it view box。"Top" | "left" | "right" | "bottom" | "inside" | "outside" | "insideLeft" | "insideRight" | "insideTop" | "insideBottom" | "insideTopLeft" | "insideBottomLeft" | "insideTopRight" | "insideBottomRight" | "insideStart" | "insideEnd" | "end" | "center"
+    position: Var[LiteralPosition]
 
 
     # The offset to the specified "position"
     # The offset to the specified "position"
     offset: Var[int]
     offset: Var[int]

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 93 - 0
reflex/components/graphing/recharts/general.pyi


+ 11 - 5
reflex/components/graphing/recharts/polar.py

@@ -6,7 +6,13 @@ from typing import Any, Dict, List, Union
 from reflex.constants import EventTriggers
 from reflex.constants import EventTriggers
 from reflex.vars import Var
 from reflex.vars import Var
 
 
-from .recharts import Recharts
+from .recharts import (
+    LiteralAnimationEasing,
+    LiteralGridType,
+    LiteralPolarRadiusType,
+    LiteralScale,
+    Recharts,
+)
 
 
 
 
 class Pie(Recharts):
 class Pie(Recharts):
@@ -121,7 +127,7 @@ class Radar(Recharts):
     animation_duration: Var[int]
     animation_duration: Var[int]
 
 
     # The type of easing function. 'ease' | 'ease-in' | 'ease-out' | 'ease-in-out' | 'linear'
     # 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 components
     valid_children: List[str] = ["LabelList"]
     valid_children: List[str] = ["LabelList"]
@@ -253,7 +259,7 @@ class PolarGrid(Recharts):
     polar_radius: Var[List[int]]
     polar_radius: Var[List[int]]
 
 
     # The type of polar grids. 'polygon' | 'circle'
     # The type of polar grids. 'polygon' | 'circle'
-    grid_type: Var[str]
+    grid_type: Var[LiteralGridType]
 
 
     # Valid children components
     # Valid children components
     valid_children: List[str] = ["RadarChart", "RadiarBarChart"]
     valid_children: List[str] = ["RadarChart", "RadiarBarChart"]
@@ -270,7 +276,7 @@ class PolarRadiusAxis(Recharts):
     angle: Var[int]
     angle: Var[int]
 
 
     # The type of axis line. 'number' | 'category'
     # The type of axis line. 'number' | 'category'
-    type_: Var[str]
+    type_: Var[LiteralPolarRadiusType]
 
 
     # Allow the axis has duplicated categorys or not when the type of axis is "category".
     # Allow the axis has duplicated categorys or not when the type of axis is "category".
     allow_duplicated_category: Var[bool]
     allow_duplicated_category: Var[bool]
@@ -297,7 +303,7 @@ class PolarRadiusAxis(Recharts):
     tick_count: Var[int]
     tick_count: Var[int]
 
 
     # If 'auto' set, the scale funtion is linear scale. 'auto' | 'linear' | 'pow' | 'sqrt' | 'log' | 'identity' | 'time' | 'band' | 'point' | 'ordinal' | 'quantile' | 'quantize' | 'utc' | 'sequential' | 'threshold'
     # If 'auto' set, the scale funtion is linear scale. 'auto' | 'linear' | 'pow' | 'sqrt' | 'log' | 'identity' | 'time' | 'band' | 'point' | 'ordinal' | 'quantile' | 'quantize' | 'utc' | 'sequential' | 'threshold'
-    scale: Var[str]
+    scale: Var[LiteralScale]
 
 
     # Valid children components
     # Valid children components
     valid_children: List[str] = ["Label"]
     valid_children: List[str] = ["Label"]

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 49 - 0
reflex/components/graphing/recharts/polar.pyi


+ 104 - 1
reflex/components/graphing/recharts/recharts.py

@@ -1,5 +1,5 @@
 """A component that wraps a recharts lib."""
 """A component that wraps a recharts lib."""
-
+from typing import Literal
 
 
 from reflex.components.component import Component, NoSSRComponent
 from reflex.components.component import Component, NoSSRComponent
 
 
@@ -14,3 +14,106 @@ class RechartsCharts(NoSSRComponent):
     """A component that wraps a victory lib."""
     """A component that wraps a victory lib."""
 
 
     library = "recharts@2.8.0"
     library = "recharts@2.8.0"
+
+
+LiteralAnimationEasing = Literal["ease", "ease-in", "ease-out", "ease-in-out", "linear"]
+LiteralIfOverflow = Literal["discard", "hidden", "visible", "extendDomain"]
+LiteralShape = Literal[
+    "square", "circle", "cross", "diamond", "star", "triangle", "wye"
+]
+LiteralLineType = Literal["joint", "fitting"]
+LiteralOrientation = Literal["top", "bottom", "left", "right", "middle"]
+LiteralOrientationLeftRightMiddle = Literal["left", "right", "middle"]
+LiteralOrientationTopBottom = Literal["top", "bottom"]
+LiteralOrientationTopBottomLeftRight = Literal["top", "bottom", "left", "right"]
+LiteralScale = Literal[
+    "auto",
+    "linear",
+    "pow",
+    "sqrt",
+    "log",
+    "identity",
+    "time",
+    "band",
+    "point",
+    "ordinal",
+    "quantile",
+    "quantize",
+    "utc",
+    "sequential",
+    "threshold",
+]
+LiteralLayout = Literal["horizontal", "vertical"]
+LiteralPolarRadiusType = Literal["number", "category"]
+LiteralGridType = Literal["polygon", "circle"]
+LiteralPosition = Literal[
+    "top",
+    "left",
+    "right",
+    "bottom",
+    "inside",
+    "outside",
+    "insideLeft",
+    "insideRight",
+    "insideTop",
+    "insideBottom",
+    "insideTopLeft",
+    "insideBottomLeft",
+    "insideTopRight",
+    "insideBottomRight",
+    "insideStart",
+    "insideEnd",
+    "end",
+    "center",
+]
+LiteralIconType = Literal[
+    "line",
+    "plainline",
+    "square",
+    "rect",
+    "circle",
+    "cross",
+    "diamond",
+    "star",
+    "triangle",
+    "wye",
+]
+LiteralLegendType = [
+    "line",
+    "plainline",
+    "square",
+    "rect",
+    "circle",
+    "cross",
+    "diamond",
+    "star",
+    "triangle",
+    "wye",
+    "none",
+]
+LiteralLegendAlign = Literal["left", "center", "right"]
+LiteralVerticalAlign = Literal["top", "middle", "bottom"]
+LiteralStackOffset = Literal["expand", "none", "wiggle", "silhouette"]
+LiteralBarChartStackOffset = Literal["expand", "none", "wiggle", "silhouette", "sign"]
+LiteralComposedChartBaseValue = Literal["dataMin", "dataMax", "auto"]
+LiteralAxisType = Literal["number", "category"]
+LiteralAreaType = Literal[
+    "basis",
+    "basisClosed",
+    "basisOpen",
+    "bumpX",
+    "bumpY",
+    "bump",
+    "linear",
+    "linearClosed",
+    "natural",
+    "monotoneX",
+    "monotoneY",
+    "monotone",
+    "step",
+    "stepBefore",
+    "stepAfter",
+]
+LiteralDirection = Literal["x", "y", "both"]
+LiteralInterval = Literal["preserveStart", "preserveEnd", "preserveStartEnd"]
+LiteralSyncMethod = Literal["index", "value"]

+ 148 - 0
reflex/components/graphing/recharts/recharts.pyi

@@ -0,0 +1,148 @@
+"""Stub file for recharts.py"""
+# ------------------- DO NOT EDIT ----------------------
+# This file was generated by `scripts/pyi_generator.py`!
+# ------------------------------------------------------
+
+from typing import Literal, Optional, Union, overload
+from reflex.components.component import Component
+from reflex.components.component import NoSSRComponent
+from reflex.vars import Var, BaseVar, ComputedVar
+from reflex.event import EventHandler, EventChain, EventSpec
+
+LiteralAnimationEasing = Literal["ease", "ease-in", "ease-out", "ease-in-out", "linear"]
+LiteralIfOverflow = Literal["discard", "hidden", "visible", "extendDomain"]
+LiteralShape = Literal[
+    "square", "circle", "cross", "diamond", "star", "triangle", "wye"
+]
+LiteralLineType = Literal["joint", "fitting"]
+LiteralOrientation = Literal["top", "bottom", "left", "right", "middle"]
+LiteralOrientationLeftRightMiddle = Literal["left", "right", "middle"]
+LiteralOrientationTopBottom = Literal["top", "bottom"]
+LiteralOrientationTopBottomLeftRight = Literal["top", "bottom", "left", "right"]
+LiteralScale = Literal[
+    "auto",
+    "linear",
+    "pow",
+    "sqrt",
+    "log",
+    "identity",
+    "time",
+    "band",
+    "point",
+    "ordinal",
+    "quantile",
+    "quantize",
+    "utc",
+    "sequential",
+    "threshold",
+]
+LiteralLayout = Literal["horizontal", "vertical"]
+LiteralPolarRadiusType = Literal["number", "category"]
+LiteralGridType = Literal["polygon", "circle"]
+LiteralPosition = Literal[
+    "top",
+    "left",
+    "right",
+    "bottom",
+    "inside",
+    "outside",
+    "insideLeft",
+    "insideRight",
+    "insideTop",
+    "insideBottom",
+    "insideTopLeft",
+    "insideBottomLeft",
+    "insideTopRight",
+    "insideBottomRight",
+    "insideStart",
+    "insideEnd",
+    "end",
+    "center",
+]
+LiteralIconType = Literal[
+    "line",
+    "plainline",
+    "square",
+    "rect",
+    "circle",
+    "cross",
+    "diamond",
+    "star",
+    "triangle",
+    "wye",
+]
+LiteralLegendType = [
+    "line",
+    "plainline",
+    "square",
+    "rect",
+    "circle",
+    "cross",
+    "diamond",
+    "star",
+    "triangle",
+    "wye",
+    "none",
+]
+LiteralLegendAlign = Literal["left", "center", "right"]
+LiteralVerticalAlign = Literal["top", "middle", "bottom"]
+LiteralStackOffset = Literal["expand", "none", "wiggle", "silhouette"]
+LiteralBarChartStackOffset = Literal["expand", "none", "wiggle", "silhouette", "sign"]
+LiteralComposedChartBaseValue = Literal["dataMin", "dataMax", "auto"]
+LiteralAxisType = Literal["number", "category"]
+LiteralAreaType = Literal[
+    "basis",
+    "basisClosed",
+    "basisOpen",
+    "bumpX",
+    "bumpY",
+    "bump",
+    "linear",
+    "linearClosed",
+    "natural",
+    "monotoneX",
+    "monotoneY",
+    "monotone",
+    "step",
+    "stepBefore",
+    "stepAfter",
+]
+LiteralDirection = Literal["x", "y", "both"]
+LiteralInterval = Literal["preserveStart", "preserveEnd", "preserveStartEnd"]
+LiteralSyncMethod = Literal["index", "value"]
+
+class Recharts(Component):
+    @overload
+    @classmethod
+    def create(cls, *children, 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) -> "Recharts":  # 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 RechartsCharts(NoSSRComponent):
+    @overload
+    @classmethod
+    def create(cls, *children, 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) -> "RechartsCharts":  # 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.
+        """
+        ...

+ 10 - 5
reflex/components/layout/card.py

@@ -3,7 +3,12 @@
 from typing import Optional
 from typing import Optional
 
 
 from reflex.components.component import Component
 from reflex.components.component import Component
-from reflex.components.libs.chakra import ChakraComponent
+from reflex.components.libs.chakra import (
+    ChakraComponent,
+    LiteralCardVariant,
+    LiteralColorScheme,
+    LiteralTagSize,
+)
 from reflex.vars import Var
 from reflex.vars import Var
 
 
 
 
@@ -44,17 +49,17 @@ class Card(ChakraComponent):
     #  "green" | "teal" | "blue" | "cyan" | "purple" | "pink" | "linkedin" |
     #  "green" | "teal" | "blue" | "cyan" | "purple" | "pink" | "linkedin" |
     #  "facebook" | "messenger" | "whatsapp" | "twitter" | "telegram"
     #  "facebook" | "messenger" | "whatsapp" | "twitter" | "telegram"
     # default: "gray"
     # default: "gray"
-    color_scheme: Var[str]
+    color_scheme: Var[LiteralColorScheme]
 
 
     # The size of the Card
     # The size of the Card
     # options: "sm" | "md" | "lg"
     # options: "sm" | "md" | "lg"
     # default: "md"
     # default: "md"
-    size: Var[str]
+    size: Var[LiteralTagSize]
 
 
     # The variant of the Card
     # The variant of the Card
     # options: "elevated" | "outline" | "filled" | "unstyled"
     # options: "elevated" | "outline" | "filled" | "unstyled"
     # default: "elevated"
     # default: "elevated"
-    variant: Var[str]
+    variant: Var[LiteralCardVariant]
 
 
     @classmethod
     @classmethod
     def create(
     def create(
@@ -63,7 +68,7 @@ class Card(ChakraComponent):
         *,
         *,
         header: Optional[Component] = None,
         header: Optional[Component] = None,
         footer: Optional[Component] = None,
         footer: Optional[Component] = None,
-        **props
+        **props,
     ) -> Component:
     ) -> Component:
         """Creates a Chakra Card with a body and optionally header and/or footer, and returns it.
         """Creates a Chakra Card with a body and optionally header and/or footer, and returns it.
         If header, body or footer are not already instances of Chead, Cbody or Cfoot respectively,
         If header, body or footer are not already instances of Chead, Cbody or Cfoot respectively,

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 1 - 2
reflex/components/layout/card.pyi


+ 4 - 2
reflex/components/layout/stack.py

@@ -1,6 +1,8 @@
 """Container to stack elements with spacing."""
 """Container to stack elements with spacing."""
 
 
-from reflex.components.libs.chakra import ChakraComponent
+from typing import List, Union
+
+from reflex.components.libs.chakra import ChakraComponent, LiteralStackDirection
 from reflex.vars import Var
 from reflex.vars import Var
 
 
 
 
@@ -13,7 +15,7 @@ class Stack(ChakraComponent):
     align_items: Var[str]
     align_items: Var[str]
 
 
     # The direction to stack the items.
     # The direction to stack the items.
-    direction: Var[str]
+    direction: Var[Union[LiteralStackDirection, List[str]]]
 
 
     # If true the items will be stacked horizontally.
     # If true the items will be stacked horizontally.
     is_inline: Var[bool]
     is_inline: Var[bool]

+ 2 - 2
reflex/components/layout/stack.pyi

@@ -3,7 +3,7 @@
 # This file was generated by `scripts/pyi_generator.py`!
 # This file was generated by `scripts/pyi_generator.py`!
 # ------------------------------------------------------
 # ------------------------------------------------------
 
 
-from typing import Optional, Union, overload
+from typing import List, Literal, Optional, Union, overload
 from reflex.components.libs.chakra import ChakraComponent
 from reflex.components.libs.chakra import ChakraComponent
 from reflex.components.component import Component
 from reflex.components.component import Component
 from reflex.vars import Var, BaseVar, ComputedVar
 from reflex.vars import Var, BaseVar, ComputedVar
@@ -12,7 +12,7 @@ from reflex.event import EventHandler, EventChain, EventSpec
 class Stack(ChakraComponent):
 class Stack(ChakraComponent):
     @overload
     @overload
     @classmethod
     @classmethod
-    def create(cls, *children, align_items: Optional[Union[Var[str], str]] = None, direction: Optional[Union[Var[str], str]] = None, is_inline: Optional[Union[Var[bool], bool]] = None, justify_content: Optional[Union[Var[str], str]] = None, should_wrap_children: Optional[Union[Var[bool], bool]] = None, spacing: Optional[Union[Var[str], str]] = None, wrap: Optional[Union[Var[str], str]] = None, justify: 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) -> "Stack":  # type: ignore
+    def create(cls, *children, align_items: Optional[Union[Var[str], str]] = None, direction: Optional[Union[Var[Union[Literal["row", "column"], List[str]]], Union[Literal["row", "column"], List[str]]]] = None, is_inline: Optional[Union[Var[bool], bool]] = None, justify_content: Optional[Union[Var[str], str]] = None, should_wrap_children: Optional[Union[Var[bool], bool]] = None, spacing: Optional[Union[Var[str], str]] = None, wrap: Optional[Union[Var[str], str]] = None, justify: 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) -> "Stack":  # type: ignore
         """Create the component.
         """Create the component.
 
 
         Args:
         Args:

+ 30 - 0
reflex/components/libs/__init__.py

@@ -1 +1,31 @@
 """React component libraries."""
 """React component libraries."""
+from .chakra import (
+    LiteralAlertDialogSize,
+    LiteralAlertVariant,
+    LiteralAvatarSize,
+    LiteralButtonSize,
+    LiteralButtonVariant,
+    LiteralCardVariant,
+    LiteralChakraDirection,
+    LiteralColorScheme,
+    LiteralDividerVariant,
+    LiteralDrawerSize,
+    LiteralHeadingSize,
+    LiteralImageLoading,
+    LiteralInputNumberMode,
+    LiteralInputVariant,
+    LiteralLanguage,
+    LiteralMenuOption,
+    LiteralMenuStrategy,
+    LiteralPopOverTrigger,
+    LiteralSpinnerPlacement,
+    LiteralSpinnerSize,
+    LiteralStackDirection,
+    LiteralStatus,
+    LiteralTabsVariant,
+    LiteralTagAlign,
+    LiteralTagColorScheme,
+    LiteralTagSize,
+    LiteralTheme,
+    LiteralVariant,
+)

+ 105 - 0
reflex/components/libs/chakra.py

@@ -1,5 +1,7 @@
 """Components that are based on Chakra-UI."""
 """Components that are based on Chakra-UI."""
 
 
+from typing import Literal
+
 from reflex.components.component import Component
 from reflex.components.component import Component
 
 
 
 
@@ -7,3 +9,106 @@ class ChakraComponent(Component):
     """A component that wraps a Chakra component."""
     """A component that wraps a Chakra component."""
 
 
     library = "@chakra-ui/react"
     library = "@chakra-ui/react"
+
+
+LiteralColorScheme = Literal[
+    "gray",
+    "red",
+    "orange",
+    "yellow",
+    "green",
+    "teal",
+    "blue",
+    "cyan",
+    "purple",
+    "pink",
+    "whiteAlpha",
+    "blackAlpha",
+    "linkedin",
+    "facebook",
+    "messenger",
+    "whatsapp",
+    "twitter",
+    "telegram",
+]
+
+
+LiteralVariant = Literal["solid", "subtle", "outline"]
+LiteralDividerVariant = Literal["solid", "dashed"]
+LiteralTheme = Literal["light", "dark"]
+LiteralTagColorScheme = Literal[
+    "gray",
+    "red",
+    "orange",
+    "yellow",
+    "green",
+    "teal",
+    "blue",
+    "cyan",
+    "purple",
+    "pink",
+]
+LiteralTagAlign = Literal["center", "end", "start"]
+LiteralTabsVariant = Literal[
+    "line",
+    "enclosed",
+    "enclosed-colored",
+    "soft-rounded",
+    "solid-rounded",
+    "unstyled",
+]
+
+LiteralStatus = Literal["success", "info", "warning", "error"]
+LiteralAlertVariant = Literal["subtle", "left-accent", "top-accent", "solid"]
+LiteralButtonVariant = Literal["ghost", "outline", "solid", "link", "unstyled"]
+LiteralSpinnerPlacement = Literal["start", "end"]
+LiteralLanguage = Literal[
+    "en",
+    "da",
+    "de",
+    "es",
+    "fr",
+    "ja",
+    "ko",
+    "pt_br",
+    "ru",
+    "zh_cn",
+    "ro",
+    "pl",
+    "ckb",
+    "lv",
+    "se",
+    "ua",
+    "he",
+    "it",
+]
+LiteralInputVariant = Literal["outline", "filled", "flushed", "unstyled"]
+LiteralInputNumberMode = [
+    "text",
+    "search",
+    "none",
+    "tel",
+    "url",
+    "email",
+    "numeric",
+    "decimal",
+]
+LiteralChakraDirection = Literal["ltr", "rtl"]
+LiteralCardVariant = Literal["outline", "filled", "elevated", "unstyled"]
+LiteralStackDirection = Literal["row", "column"]
+LiteralImageLoading = Literal["eager", "lazy"]
+LiteralTagSize = Literal["sm", "md", "lg"]
+LiteralSpinnerSize = Literal[Literal[LiteralTagSize], "xs", "xl"]
+LiteralAvatarSize = Literal[Literal[LiteralTagSize], "xl", "xs", "2xl", "full", "2xs"]
+LiteralButtonSize = Literal["sm", "md", "lg", "xs"]
+# Applies to AlertDialog and Modal
+LiteralAlertDialogSize = Literal[
+    "sm", "md", "lg", "xs", "2xl", "full", "3xl", "4xl", "5xl", "6xl"
+]
+LiteralDrawerSize = Literal[Literal[LiteralSpinnerSize], "xl", "full"]
+
+LiteralMenuStrategy = Literal["fixed", "absolute"]
+LiteralMenuOption = Literal["checkbox", "radio"]
+LiteralPopOverTrigger = Literal["click", "hover"]
+
+LiteralHeadingSize = Literal["lg", "md", "sm", "xs", "xl", "2xl", "3xl", "4xl"]

+ 102 - 1
reflex/components/libs/chakra.pyi

@@ -3,11 +3,112 @@
 # This file was generated by `scripts/pyi_generator.py`!
 # 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.component import Component
 from reflex.components.component import Component
 from reflex.vars import Var, BaseVar, ComputedVar
 from reflex.vars import Var, BaseVar, ComputedVar
 from reflex.event import EventHandler, EventChain, EventSpec
 from reflex.event import EventHandler, EventChain, EventSpec
 
 
+LiteralColorScheme = Literal[
+    "gray",
+    "red",
+    "orange",
+    "yellow",
+    "green",
+    "teal",
+    "blue",
+    "cyan",
+    "purple",
+    "pink",
+    "whiteAlpha",
+    "blackAlpha",
+    "linkedin",
+    "facebook",
+    "messenger",
+    "whatsapp",
+    "twitter",
+    "telegram",
+]
+
+LiteralVariant = Literal["solid", "subtle", "outline"]
+LiteralDividerVariant = Literal["solid", "dashed"]
+LiteralTheme = Literal["light", "dark"]
+LiteralTagColorScheme = Literal[
+    "gray",
+    "red",
+    "orange",
+    "yellow",
+    "green",
+    "teal",
+    "blue",
+    "cyan",
+    "purple",
+    "pink",
+]
+LiteralTagAlign = Literal["center", "end", "start"]
+LiteralTabsVariant = Literal[
+    "line",
+    "enclosed",
+    "enclosed-colored",
+    "soft-rounded",
+    "solid-rounded",
+    "unstyled",
+]
+
+LiteralStatus = Literal["success", "info", "warning", "error"]
+LiteralAlertVariant = Literal["subtle", "left-accent", "top-accent", "solid"]
+LiteralButtonVariant = Literal["ghost", "outline", "solid", "link", "unstyled"]
+LiteralSpinnerPlacement = Literal["start", "end"]
+LiteralLanguage = Literal[
+    "en",
+    "da",
+    "de",
+    "es",
+    "fr",
+    "ja",
+    "ko",
+    "pt_br",
+    "ru",
+    "zh_cn",
+    "ro",
+    "pl",
+    "ckb",
+    "lv",
+    "se",
+    "ua",
+    "he",
+    "it",
+]
+LiteralInputVariant = Literal["outline", "filled", "flushed", "unstyled"]
+LiteralInputNumberMode = [
+    "text",
+    "search",
+    "none",
+    "tel",
+    "url",
+    "email",
+    "numeric",
+    "decimal",
+]
+LiteralChakraDirection = Literal["ltr", "rtl"]
+LiteralCardVariant = Literal["outline", "filled", "elevated", "unstyled"]
+LiteralStackDirection = Literal["row", "column"]
+LiteralImageLoading = Literal["eager", "lazy"]
+LiteralTagSize = Literal["sm", "md", "lg"]
+LiteralSpinnerSize = Literal[Literal[LiteralTagSize], "xs"]
+LiteralAvatarSize = Literal[Literal[LiteralTagSize], "xs", "2xl", "full", "2xs"]
+LiteralButtonSize = Literal["sm", "md", "lg", "xs"]
+# Applies to AlertDialog and Modal
+LiteralAlertDialogSize = Literal[
+    "sm", "md", "lg", "xs", "2xl", "full", "3xl", "4xl", "5xl", "6xl"
+]
+LiteralDrawerSize = Literal[Literal[LiteralSpinnerSize], "xl", "full"]
+
+LiteralMenuStrategy = Literal["fixed", "absolute"]
+LiteralMenuOption = Literal["checkbox", "radio"]
+LiteralPopOverTrigger = Literal["click", "hover"]
+
+LiteralHeadingSize = Literal["lg", "md", "sm", "xs", "xl", "2xl", "3xl", "4xl"]
+
 class ChakraComponent(Component):
 class ChakraComponent(Component):
     @overload
     @overload
     @classmethod
     @classmethod

+ 2 - 2
reflex/components/media/avatar.py

@@ -3,7 +3,7 @@ from __future__ import annotations
 
 
 from typing import Any, Union
 from typing import Any, Union
 
 
-from reflex.components.libs.chakra import ChakraComponent
+from reflex.components.libs.chakra import ChakraComponent, LiteralAvatarSize
 from reflex.vars import Var
 from reflex.vars import Var
 
 
 
 
@@ -34,7 +34,7 @@ class Avatar(ChakraComponent):
     src_set: Var[str]
     src_set: Var[str]
 
 
     # "2xs" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "full"
     # "2xs" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "full"
-    size: Var[str]
+    size: Var[LiteralAvatarSize]
 
 
     def get_event_triggers(self) -> dict[str, Union[Var, Any]]:
     def get_event_triggers(self) -> dict[str, Union[Var, Any]]:
         """Get the event triggers for the component.
         """Get the event triggers for the component.

+ 2 - 2
reflex/components/media/avatar.pyi

@@ -3,7 +3,7 @@
 # This file was generated by `scripts/pyi_generator.py`!
 # 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.libs.chakra import ChakraComponent
 from reflex.components.component import Component
 from reflex.components.component import Component
 from reflex.vars import Var, BaseVar, ComputedVar
 from reflex.vars import Var, BaseVar, ComputedVar
@@ -12,7 +12,7 @@ from reflex.event import EventHandler, EventChain, EventSpec
 class Avatar(ChakraComponent):
 class Avatar(ChakraComponent):
     @overload
     @overload
     @classmethod
     @classmethod
-    def create(cls, *children, icon: Optional[Union[Var[str], str]] = None, icon_label: Optional[Union[Var[str], str]] = None, ignore_fallback: Optional[Union[Var[bool], bool]] = None, name: Optional[Union[Var[str], str]] = None, show_border: Optional[Union[Var[bool], bool]] = None, src: Optional[Union[Var[str], str]] = None, src_set: 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_error: 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) -> "Avatar":  # type: ignore
+    def create(cls, *children, icon: Optional[Union[Var[str], str]] = None, icon_label: Optional[Union[Var[str], str]] = None, ignore_fallback: Optional[Union[Var[bool], bool]] = None, name: Optional[Union[Var[str], str]] = None, show_border: Optional[Union[Var[bool], bool]] = None, src: Optional[Union[Var[str], str]] = None, src_set: Optional[Union[Var[str], str]] = None, size: Optional[Union[Var[Literal["sm", "md", "lg", "xs", "2xl", "full", "2xs"]], Literal["sm", "md", "lg", "xs", "2xl", "full", "2xs"]]] = 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_error: 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) -> "Avatar":  # type: ignore
         """Create the component.
         """Create the component.
 
 
         Args:
         Args:

+ 2 - 2
reflex/components/media/image.py

@@ -6,7 +6,7 @@ import io
 from typing import Any, Optional, Union
 from typing import Any, Optional, Union
 
 
 from reflex.components.component import Component
 from reflex.components.component import Component
-from reflex.components.libs.chakra import ChakraComponent
+from reflex.components.libs.chakra import ChakraComponent, LiteralImageLoading
 from reflex.utils.serializers import serializer
 from reflex.utils.serializers import serializer
 from reflex.vars import Var
 from reflex.vars import Var
 
 
@@ -38,7 +38,7 @@ class Image(ChakraComponent):
     ignore_fallback: Var[bool]
     ignore_fallback: Var[bool]
 
 
     # "eager" | "lazy"
     # "eager" | "lazy"
-    loading: Var[str]
+    loading: Var[LiteralImageLoading]
 
 
     # The path/url to the image or PIL image object.
     # The path/url to the image or PIL image object.
     src: Var[Any]
     src: Var[Any]

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 1 - 1
reflex/components/media/image.pyi


+ 2 - 2
reflex/components/navigation/stepper.py

@@ -3,7 +3,7 @@
 from typing import List, Optional, Tuple
 from typing import List, Optional, Tuple
 
 
 from reflex.components.component import Component
 from reflex.components.component import Component
-from reflex.components.libs.chakra import ChakraComponent
+from reflex.components.libs.chakra import ChakraComponent, LiteralColorScheme
 from reflex.vars import Var
 from reflex.vars import Var
 
 
 
 
@@ -13,7 +13,7 @@ class Stepper(ChakraComponent):
     tag = "Stepper"
     tag = "Stepper"
 
 
     # The color scheme to use for the stepper; default is blue.
     # The color scheme to use for the stepper; default is blue.
-    colorScheme: Var[str]
+    colorScheme: Var[LiteralColorScheme]
 
 
     # Chakra provides a useSteps hook to control the stepper.
     # Chakra provides a useSteps hook to control the stepper.
     # Instead, use an integer state value to set progress in the stepper.
     # Instead, use an integer state value to set progress in the stepper.

+ 2 - 2
reflex/components/navigation/stepper.pyi

@@ -3,7 +3,7 @@
 # This file was generated by `scripts/pyi_generator.py`!
 # 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.libs.chakra import ChakraComponent
 from reflex.components.component import Component
 from reflex.components.component import Component
 from reflex.vars import Var, BaseVar, ComputedVar
 from reflex.vars import Var, BaseVar, ComputedVar
@@ -12,7 +12,7 @@ from reflex.event import EventHandler, EventChain, EventSpec
 class Stepper(ChakraComponent):
 class Stepper(ChakraComponent):
     @overload
     @overload
     @classmethod
     @classmethod
-    def create(cls, *children, items: Optional[List[Tuple]] = None, colorScheme: Optional[Union[Var[str], str]] = None, index: 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) -> "Stepper":  # type: ignore
+    def create(cls, *children, items: Optional[List[Tuple]] = None, colorScheme: 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, index: 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) -> "Stepper":  # type: ignore
         """Create a Stepper component.
         """Create a Stepper component.
 
 
                If the kw-args `items` is provided and is a list, they will be added as children.
                If the kw-args `items` is provided and is a list, they will be added as children.

+ 2 - 2
reflex/components/overlay/alertdialog.py

@@ -4,7 +4,7 @@ from __future__ import annotations
 from typing import Any, Union
 from typing import Any, Union
 
 
 from reflex.components.component import Component
 from reflex.components.component import Component
-from reflex.components.libs.chakra import ChakraComponent
+from reflex.components.libs.chakra import ChakraComponent, LiteralAlertDialogSize
 from reflex.components.media.icon import Icon
 from reflex.components.media.icon import Icon
 from reflex.vars import Var
 from reflex.vars import Var
 
 
@@ -48,7 +48,7 @@ class AlertDialog(ChakraComponent):
     return_focus_on_close: Var[bool]
     return_focus_on_close: Var[bool]
 
 
     # "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | "4xl" | "5xl" | "6xl" | "full"
     # "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | "4xl" | "5xl" | "6xl" | "full"
-    size: Var[str]
+    size: Var[LiteralAlertDialogSize]
 
 
     # If true, the siblings of the modal will have `aria-hidden` set to true so that screen readers can only see the modal. This is commonly known as making the other elements **inert**
     # If true, the siblings of the modal will have `aria-hidden` set to true so that screen readers can only see the modal. This is commonly known as making the other elements **inert**
     use_inert: Var[bool]
     use_inert: Var[bool]

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 1 - 1
reflex/components/overlay/alertdialog.pyi


+ 12 - 2
reflex/components/overlay/drawer.py

@@ -4,7 +4,11 @@ from __future__ import annotations
 from typing import Any, Union
 from typing import Any, Union
 
 
 from reflex.components.component import Component
 from reflex.components.component import Component
-from reflex.components.libs.chakra import ChakraComponent
+from reflex.components.libs.chakra import (
+    ChakraComponent,
+    LiteralColorScheme,
+    LiteralDrawerSize,
+)
 from reflex.components.media.icon import Icon
 from reflex.components.media.icon import Icon
 from reflex.vars import Var
 from reflex.vars import Var
 
 
@@ -51,7 +55,7 @@ class Drawer(ChakraComponent):
     return_focus_on_close: Var[bool]
     return_focus_on_close: Var[bool]
 
 
     # "xs" | "sm" | "md" | "lg" | "xl" | "full"
     # "xs" | "sm" | "md" | "lg" | "xl" | "full"
-    size: Var[str]
+    size: Var[LiteralDrawerSize]
 
 
     # A11y: If true, the siblings of the modal will have `aria-hidden` set to true so that screen readers can only see the modal. This is commonly known as making the other elements **inert**
     # A11y: If true, the siblings of the modal will have `aria-hidden` set to true so that screen readers can only see the modal. This is commonly known as making the other elements **inert**
     use_inert: Var[bool]
     use_inert: Var[bool]
@@ -59,6 +63,12 @@ class Drawer(ChakraComponent):
     # Variant of drawer
     # Variant of drawer
     variant: Var[str]
     variant: Var[str]
 
 
+    # Color scheme of the Drawer
+    # Options:
+    # "whiteAlpha" | "blackAlpha" | "gray" | "red" | "orange" | "yellow" | "green" | "teal" | "blue" | "cyan"
+    # | "purple" | "pink" | "linkedin" | "facebook" | "messenger" | "whatsapp" | "twitter" | "telegram"
+    color_scheme: Var[LiteralColorScheme]
+
     def get_event_triggers(self) -> dict[str, Union[Var, Any]]:
     def get_event_triggers(self) -> dict[str, Union[Var, Any]]:
         """Get the event triggers for the component.
         """Get the event triggers for the component.
 
 

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 1 - 1
reflex/components/overlay/drawer.pyi


+ 10 - 5
reflex/components/overlay/menu.py

@@ -5,7 +5,12 @@ from typing import Any, List, Optional, Union
 
 
 from reflex.components.component import Component
 from reflex.components.component import Component
 from reflex.components.forms.button import Button
 from reflex.components.forms.button import Button
-from reflex.components.libs.chakra import ChakraComponent
+from reflex.components.libs.chakra import (
+    ChakraComponent,
+    LiteralChakraDirection,
+    LiteralMenuOption,
+    LiteralMenuStrategy,
+)
 from reflex.vars import Var
 from reflex.vars import Var
 
 
 
 
@@ -33,7 +38,7 @@ class Menu(ChakraComponent):
     default_is_open: Var[bool]
     default_is_open: Var[bool]
 
 
     # If rtl, popper placement positions will be flipped i.e. 'top-right' will become 'top-left' and vice-verse ("ltr" | "rtl")
     # If rtl, popper placement positions will be flipped i.e. 'top-right' will become 'top-left' and vice-verse ("ltr" | "rtl")
-    direction: Var[str]
+    direction: Var[LiteralChakraDirection]
 
 
     # If true, the popper will change its placement and flip when it's about to overflow its boundary area.
     # If true, the popper will change its placement and flip when it's about to overflow its boundary area.
     flip: Var[bool]
     flip: Var[bool]
@@ -60,7 +65,7 @@ class Menu(ChakraComponent):
     prevent_overflow: Var[bool]
     prevent_overflow: Var[bool]
 
 
     # The CSS positioning strategy to use. ("fixed" | "absolute")
     # The CSS positioning strategy to use. ("fixed" | "absolute")
-    strategy: Var[str]
+    strategy: Var[LiteralMenuStrategy]
 
 
     def get_event_triggers(self) -> dict[str, Union[Var, Any]]:
     def get_event_triggers(self) -> dict[str, Union[Var, Any]]:
         """Get the event triggers for the component.
         """Get the event triggers for the component.
@@ -196,7 +201,7 @@ class MenuItemOption(ChakraComponent):
     is_focusable: Var[bool]
     is_focusable: Var[bool]
 
 
     # "checkbox" | "radio"
     # "checkbox" | "radio"
-    type_: Var[str]
+    type_: Var[LiteralMenuOption]
 
 
     # Value of the menu item.
     # Value of the menu item.
     value: Var[str]
     value: Var[str]
@@ -214,7 +219,7 @@ class MenuOptionGroup(ChakraComponent):
     tag = "MenuOptionGroup"
     tag = "MenuOptionGroup"
 
 
     # "checkbox" | "radio"
     # "checkbox" | "radio"
-    type_: Var[str]
+    type_: Var[LiteralMenuOption]
 
 
     # Value of the option group.
     # Value of the option group.
     value: Var[str]
     value: Var[str]

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 1 - 1
reflex/components/overlay/menu.pyi


+ 2 - 2
reflex/components/overlay/modal.py

@@ -4,7 +4,7 @@ from __future__ import annotations
 from typing import Any, Optional, Union
 from typing import Any, Optional, Union
 
 
 from reflex.components.component import Component
 from reflex.components.component import Component
-from reflex.components.libs.chakra import ChakraComponent
+from reflex.components.libs.chakra import ChakraComponent, LiteralAlertDialogSize
 from reflex.components.media import Icon
 from reflex.components.media import Icon
 from reflex.vars import Var
 from reflex.vars import Var
 
 
@@ -48,7 +48,7 @@ class Modal(ChakraComponent):
     return_focus_on_close: Var[bool]
     return_focus_on_close: Var[bool]
 
 
     # "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | "4xl" | "5xl" | "6xl" | "full"
     # "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | "4xl" | "5xl" | "6xl" | "full"
-    size: Var[str]
+    size: Var[LiteralAlertDialogSize]
 
 
     # A11y: If true, the siblings of the modal will have `aria-hidden` set to true so that screen readers can only see the modal. This is commonly known as making the other elements **inert**
     # A11y: If true, the siblings of the modal will have `aria-hidden` set to true so that screen readers can only see the modal. This is commonly known as making the other elements **inert**
     use_inert: Var[bool]
     use_inert: Var[bool]

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 1 - 1
reflex/components/overlay/modal.pyi


+ 9 - 4
reflex/components/overlay/popover.py

@@ -4,7 +4,12 @@ from __future__ import annotations
 from typing import Any, Union
 from typing import Any, Union
 
 
 from reflex.components.component import Component
 from reflex.components.component import Component
-from reflex.components.libs.chakra import ChakraComponent
+from reflex.components.libs.chakra import (
+    ChakraComponent,
+    LiteralChakraDirection,
+    LiteralMenuStrategy,
+    LiteralPopOverTrigger,
+)
 from reflex.vars import Var
 from reflex.vars import Var
 
 
 
 
@@ -38,7 +43,7 @@ class Popover(ChakraComponent):
     default_is_open: Var[bool]
     default_is_open: Var[bool]
 
 
     # Theme direction ltr or rtl. Popper's placement will be set accordingly
     # Theme direction ltr or rtl. Popper's placement will be set accordingly
-    direction: Var[str]
+    direction: Var[LiteralChakraDirection]
 
 
     # If true, the popper will change its placement and flip when it's about to overflow its boundary area.
     # If true, the popper will change its placement and flip when it's about to overflow its boundary area.
     flip: Var[bool]
     flip: Var[bool]
@@ -71,10 +76,10 @@ class Popover(ChakraComponent):
     return_focus_on_close: Var[bool]
     return_focus_on_close: Var[bool]
 
 
     # The CSS positioning strategy to use. ("fixed" | "absolute")
     # The CSS positioning strategy to use. ("fixed" | "absolute")
-    strategy: Var[str]
+    strategy: Var[LiteralMenuStrategy]
 
 
     # The interaction that triggers the popover. hover - means the popover will open when you hover with mouse or focus with keyboard on the popover trigger click - means the popover will open on click or press Enter to Space on keyboard ("click" | "hover")
     # The interaction that triggers the popover. hover - means the popover will open when you hover with mouse or focus with keyboard on the popover trigger click - means the popover will open on click or press Enter to Space on keyboard ("click" | "hover")
-    trigger: Var[str]
+    trigger: Var[LiteralPopOverTrigger]
 
 
     def get_event_triggers(self) -> dict[str, Union[Var, Any]]:
     def get_event_triggers(self) -> dict[str, Union[Var, Any]]:
         """Get the event triggers for the component.
         """Get the event triggers for the component.

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 1 - 1
reflex/components/overlay/popover.pyi


+ 2 - 2
reflex/components/overlay/tooltip.py

@@ -3,7 +3,7 @@ from __future__ import annotations
 
 
 from typing import Any, Union
 from typing import Any, Union
 
 
-from reflex.components.libs.chakra import ChakraComponent
+from reflex.components.libs.chakra import ChakraComponent, LiteralChakraDirection
 from reflex.vars import Var
 from reflex.vars import Var
 
 
 
 
@@ -37,7 +37,7 @@ class Tooltip(ChakraComponent):
     default_is_open: Var[bool]
     default_is_open: Var[bool]
 
 
     # Theme direction ltr or rtl. Popper's placement will be set accordingly
     # Theme direction ltr or rtl. Popper's placement will be set accordingly
-    direction: Var[str]
+    direction: Var[LiteralChakraDirection]
 
 
     # The distance or margin between the reference and popper. It is used internally to create an offset modifier. NB: If you define offset prop, it'll override the gutter.
     # The distance or margin between the reference and popper. It is used internally to create an offset modifier. NB: If you define offset prop, it'll override the gutter.
     gutter: Var[int]
     gutter: Var[int]

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 1 - 1
reflex/components/overlay/tooltip.pyi


+ 3 - 2
reflex/components/typography/heading.py

@@ -1,6 +1,7 @@
 """A heading component."""
 """A heading component."""
 
 
-from reflex.components.libs.chakra import ChakraComponent
+
+from reflex.components.libs.chakra import ChakraComponent, LiteralHeadingSize
 from reflex.vars import Var
 from reflex.vars import Var
 
 
 
 
@@ -13,4 +14,4 @@ class Heading(ChakraComponent):
     as_: Var[str]
     as_: Var[str]
 
 
     # "4xl" | "3xl" | "2xl" | "xl" | "lg" | "md" | "sm" | "xs"
     # "4xl" | "3xl" | "2xl" | "xl" | "lg" | "md" | "sm" | "xs"
-    size: Var[str]
+    size: Var[LiteralHeadingSize]

+ 2 - 2
reflex/components/typography/heading.pyi

@@ -3,7 +3,7 @@
 # This file was generated by `scripts/pyi_generator.py`!
 # 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.libs.chakra import ChakraComponent
 from reflex.components.component import Component
 from reflex.components.component import Component
 from reflex.vars import Var, BaseVar, ComputedVar
 from reflex.vars import Var, BaseVar, ComputedVar
@@ -12,7 +12,7 @@ from reflex.event import EventHandler, EventChain, EventSpec
 class Heading(ChakraComponent):
 class Heading(ChakraComponent):
     @overload
     @overload
     @classmethod
     @classmethod
-    def create(cls, *children, as_: 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) -> "Heading":  # type: ignore
+    def create(cls, *children, as_: Optional[Union[Var[str], str]] = None, size: Optional[Union[Var[Literal["lg", "md", "sm", "xs", "xl", "2xl", "3xl", "4xl"]], Literal["lg", "md", "sm", "xs", "xl", "2xl", "3xl", "4xl"]]] = 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) -> "Heading":  # type: ignore
         """Create the component.
         """Create the component.
 
 
         Args:
         Args:

+ 23 - 1
reflex/utils/types.py

@@ -4,7 +4,7 @@ from __future__ import annotations
 
 
 import contextlib
 import contextlib
 import typing
 import typing
-from typing import Any, Callable, Type, Union, _GenericAlias  # type: ignore
+from typing import Any, Callable, Literal, Type, Union, _GenericAlias  # type: ignore
 
 
 from reflex.base import Base
 from reflex.base import Base
 from reflex.utils import serializers
 from reflex.utils import serializers
@@ -76,6 +76,18 @@ def is_union(cls: GenericType) -> bool:
     return cls.__origin__ == Union if is_generic_alias(cls) else False
     return cls.__origin__ == Union if is_generic_alias(cls) else False
 
 
 
 
+def is_literal(cls: GenericType) -> bool:
+    """Check if a class is a Literal.
+
+    Args:
+        cls: The class to check.
+
+    Returns:
+        Whether the class is a literal.
+    """
+    return hasattr(cls, "__origin__") and cls.__origin__ is Literal
+
+
 def get_base_class(cls: GenericType) -> Type:
 def get_base_class(cls: GenericType) -> Type:
     """Get the base class of a class.
     """Get the base class of a class.
 
 
@@ -84,7 +96,17 @@ def get_base_class(cls: GenericType) -> Type:
 
 
     Returns:
     Returns:
         The base class of the class.
         The base class of the class.
+
+    Raises:
+        TypeError: If a literal has multiple types.
     """
     """
+    if is_literal(cls):
+        # only literals of the same type are supported.
+        arg_type = type(get_args(cls)[0])
+        if not all(type(arg) == arg_type for arg in get_args(cls)):
+            raise TypeError("only literals of the same type are supported")
+        return type(get_args(cls)[0])
+
     if is_union(cls):
     if is_union(cls):
         return tuple(get_base_class(arg) for arg in get_args(cls))
         return tuple(get_base_class(arg) for arg in get_args(cls))
 
 

+ 88 - 4
scripts/pyi_generator.py

@@ -7,14 +7,89 @@ import re
 import sys
 import sys
 from inspect import getfullargspec
 from inspect import getfullargspec
 from pathlib import Path
 from pathlib import Path
-from typing import Any, Dict, List, Optional, Union, get_args  # NOQA
+from typing import Any, Dict, List, Literal, Optional, Union, get_args  # NOQA
 
 
 import black
 import black
 
 
 from reflex.components.component import Component
 from reflex.components.component import Component
+
+# NOQA
+from reflex.components.graphing.recharts.recharts import (
+    LiteralAnimationEasing,
+    LiteralAreaType,
+    LiteralComposedChartBaseValue,
+    LiteralDirection,
+    LiteralGridType,
+    LiteralIconType,
+    LiteralIfOverflow,
+    LiteralInterval,
+    LiteralLayout,
+    LiteralLegendAlign,
+    LiteralLineType,
+    LiteralOrientationTopBottom,
+    LiteralOrientationTopBottomLeftRight,
+    LiteralPolarRadiusType,
+    LiteralPosition,
+    LiteralScale,
+    LiteralShape,
+    LiteralStackOffset,
+    LiteralSyncMethod,
+    LiteralVerticalAlign,
+)
+from reflex.components.libs.chakra import (
+    LiteralAlertDialogSize,
+    LiteralAvatarSize,
+    LiteralChakraDirection,
+    LiteralColorScheme,
+    LiteralDrawerSize,
+    LiteralImageLoading,
+    LiteralInputVariant,
+    LiteralMenuOption,
+    LiteralMenuStrategy,
+    LiteralTagSize,
+)
+
+# NOQA
+from reflex.utils import format
+from reflex.utils import types as rx_types
 from reflex.vars import Var
 from reflex.vars import Var
 
 
-ruff_dont_remove = [Var, Optional, Dict, List]
+ruff_dont_remove = [
+    Var,
+    Optional,
+    Dict,
+    List,
+    LiteralInputVariant,
+    LiteralColorScheme,
+    LiteralChakraDirection,
+    LiteralTagSize,
+    LiteralDrawerSize,
+    LiteralMenuStrategy,
+    LiteralMenuOption,
+    LiteralAlertDialogSize,
+    LiteralAvatarSize,
+    LiteralImageLoading,
+    LiteralLayout,
+    LiteralAnimationEasing,
+    LiteralGridType,
+    LiteralPolarRadiusType,
+    LiteralScale,
+    LiteralSyncMethod,
+    LiteralStackOffset,
+    LiteralComposedChartBaseValue,
+    LiteralOrientationTopBottom,
+    LiteralAreaType,
+    LiteralShape,
+    LiteralLineType,
+    LiteralDirection,
+    LiteralIfOverflow,
+    LiteralOrientationTopBottomLeftRight,
+    LiteralInterval,
+    LiteralLegendAlign,
+    LiteralVerticalAlign,
+    LiteralIconType,
+    LiteralPosition,
+]
 
 
 EXCLUDED_FILES = [
 EXCLUDED_FILES = [
     "__init__.py",
     "__init__.py",
@@ -32,7 +107,16 @@ def _get_type_hint(value, top_level=True, no_union=False):
     res = ""
     res = ""
     args = get_args(value)
     args = get_args(value)
     if args:
     if args:
-        res = f"{value.__name__}[{', '.join([_get_type_hint(arg, top_level=False) for arg in args if arg is not type(None)])}]"
+        inner_container_type_args = (
+            [format.wrap(arg, '"') for arg in args]
+            if rx_types.is_literal(value)
+            else [
+                _get_type_hint(arg, top_level=False)
+                for arg in args
+                if arg is not type(None)
+            ]
+        )
+        res = f"{value.__name__}[{', '.join(inner_container_type_args)}]"
 
 
         if value.__name__ == "Var":
         if value.__name__ == "Var":
             types = [res] + [
             types = [res] + [
@@ -259,7 +343,7 @@ class PyiGenerator:
         ]
         ]
         if not class_names:
         if not class_names:
             return
             return
-        print(f"Parsed {file}: Found {[n for n,_ in class_names]}")
+        print(f"Parsed {file}: Found {[n for n, _ in class_names]}")
         self._write_pyi_file(local_variables, functions, class_names)
         self._write_pyi_file(local_variables, functions, class_names)
 
 
     def _scan_folder(self, folder):
     def _scan_folder(self, folder):

+ 11 - 1
tests/utils/test_utils.py

@@ -1,7 +1,7 @@
 import os
 import os
 import typing
 import typing
 from pathlib import Path
 from pathlib import Path
-from typing import Any, List, Union
+from typing import Any, List, Literal, Union
 
 
 import pytest
 import pytest
 import typer
 import typer
@@ -182,12 +182,22 @@ def test_is_backend_variable(input, output):
         (int, Any, True),
         (int, Any, True),
         (Any, Any, True),
         (Any, Any, True),
         (Union[int, float], Any, True),
         (Union[int, float], Any, True),
+        (str, Union[Literal["test", "value"], int], True),
+        (int, Union[Literal["test", "value"], int], True),
+        (str, Literal["test", "value"], True),
+        (int, Literal["test", "value"], False),
     ],
     ],
 )
 )
 def test_issubclass(cls: type, cls_check: type, expected: bool):
 def test_issubclass(cls: type, cls_check: type, expected: bool):
     assert types._issubclass(cls, cls_check) == expected
     assert types._issubclass(cls, cls_check) == expected
 
 
 
 
+@pytest.mark.parametrize("cls", [Literal["test", 1], Literal[1, "test"]])
+def test_unsupported_literals(cls: type):
+    with pytest.raises(TypeError):
+        types.get_base_class(cls)
+
+
 @pytest.mark.parametrize(
 @pytest.mark.parametrize(
     "app_name,expected_config_name",
     "app_name,expected_config_name",
     [
     [

Vissa filer visades inte eftersom för många filer har ändrats