فهرست منبع

make array var sequence first (#4881)

* make array var sequence first

* list to sequence in components

* missing from merge conflict
Khaleel Al-Adhami 2 ماه پیش
والد
کامیت
ac18a0aefa
42فایلهای تغییر یافته به همراه1072 افزوده شده و 1050 حذف شده
  1. 3 1
      reflex/components/core/clipboard.py
  2. 2 2
      reflex/components/core/clipboard.pyi
  3. 2 2
      reflex/components/core/upload.py
  4. 4 4
      reflex/components/core/upload.pyi
  5. 3 3
      reflex/components/datadisplay/dataeditor.py
  6. 3 3
      reflex/components/datadisplay/dataeditor.pyi
  7. 2 2
      reflex/components/gridjs/datatable.py
  8. 2 2
      reflex/components/gridjs/datatable.pyi
  9. 3 3
      reflex/components/radix/primitives/accordion.py
  10. 3 3
      reflex/components/radix/primitives/accordion.pyi
  11. 2 2
      reflex/components/radix/primitives/drawer.py
  12. 3 3
      reflex/components/radix/primitives/drawer.pyi
  13. 3 3
      reflex/components/radix/primitives/slider.py
  14. 3 3
      reflex/components/radix/primitives/slider.pyi
  15. 2 2
      reflex/components/radix/themes/components/checkbox_group.py
  16. 2 2
      reflex/components/radix/themes/components/checkbox_group.pyi
  17. 2 2
      reflex/components/radix/themes/components/context_menu.pyi
  18. 3 3
      reflex/components/radix/themes/components/radio_group.py
  19. 3 3
      reflex/components/radix/themes/components/radio_group.pyi
  20. 3 3
      reflex/components/radix/themes/components/segmented_control.py
  21. 3 3
      reflex/components/radix/themes/components/segmented_control.pyi
  22. 2 2
      reflex/components/radix/themes/components/select.py
  23. 3 3
      reflex/components/radix/themes/components/select.pyi
  24. 3 3
      reflex/components/radix/themes/components/slider.py
  25. 4 4
      reflex/components/radix/themes/components/slider.pyi
  26. 15 15
      reflex/components/recharts/cartesian.py
  27. 22 20
      reflex/components/recharts/cartesian.pyi
  28. 5 5
      reflex/components/recharts/charts.py
  29. 9 9
      reflex/components/recharts/charts.pyi
  30. 2 2
      reflex/components/recharts/general.py
  31. 2 2
      reflex/components/recharts/general.pyi
  32. 8 11
      reflex/components/recharts/polar.py
  33. 9 9
      reflex/components/recharts/polar.pyi
  34. 2 2
      reflex/experimental/layout.pyi
  35. 1 0
      reflex/utils/pyi_generator.py
  36. 14 0
      reflex/utils/serializers.py
  37. 13 6
      reflex/vars/base.py
  38. 891 893
      reflex/vars/sequence.py
  39. 2 2
      tests/units/components/core/test_match.py
  40. 2 2
      tests/units/test_var.py
  41. 3 3
      tests/units/vars/test_base.py
  42. 4 3
      tests/units/vars/test_object.py

+ 3 - 1
reflex/components/core/clipboard.py

@@ -2,6 +2,8 @@
 
 from __future__ import annotations
 
+from typing import Sequence
+
 from reflex.components.base.fragment import Fragment
 from reflex.components.tags.tag import Tag
 from reflex.constants.compiler import Hooks
@@ -16,7 +18,7 @@ class Clipboard(Fragment):
     """Clipboard component."""
 
     # The element ids to attach the event listener to. Defaults to all child components or the document.
-    targets: Var[list[str]]
+    targets: Var[Sequence[str]]
 
     # Called when the user pastes data into the document. Data is a list of tuples of (mime_type, data). Binary types will be base64 encoded as a data uri.
     on_paste: EventHandler[passthrough_event_spec(list[tuple[str, str]])]

+ 2 - 2
reflex/components/core/clipboard.pyi

@@ -3,7 +3,7 @@
 # ------------------- DO NOT EDIT ----------------------
 # This file was generated by `reflex/utils/pyi_generator.py`!
 # ------------------------------------------------------
-from typing import Any, Optional, overload
+from typing import Any, Optional, Sequence, overload
 
 from reflex.components.base.fragment import Fragment
 from reflex.event import EventType
@@ -17,7 +17,7 @@ class Clipboard(Fragment):
     def create(  # type: ignore
         cls,
         *children,
-        targets: Var[list[str]] | list[str] | None = None,
+        targets: Sequence[str] | Var[Sequence[str]] | None = None,
         on_paste_event_actions: Var[dict[str, bool | int]]
         | dict[str, bool | int]
         | None = None,

+ 2 - 2
reflex/components/core/upload.py

@@ -3,7 +3,7 @@
 from __future__ import annotations
 
 from pathlib import Path
-from typing import Any, Callable, ClassVar, List
+from typing import Any, Callable, ClassVar, Sequence
 
 from reflex.components.base.fragment import Fragment
 from reflex.components.component import (
@@ -197,7 +197,7 @@ class Upload(MemoizationLeaf):
     # The list of accepted file types. This should be a dictionary of MIME types as keys and array of file formats as
     # values.
     # supported MIME types: https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types
-    accept: Var[dict[str, List] | None]
+    accept: Var[dict[str, Sequence] | None]
 
     # Whether the dropzone is disabled.
     disabled: Var[bool]

+ 4 - 4
reflex/components/core/upload.pyi

@@ -4,7 +4,7 @@
 # This file was generated by `reflex/utils/pyi_generator.py`!
 # ------------------------------------------------------
 from pathlib import Path
-from typing import Any, ClassVar, List, Optional, overload
+from typing import Any, ClassVar, Optional, Sequence, overload
 
 from reflex.components.base.fragment import Fragment
 from reflex.components.component import Component, ComponentNamespace, MemoizationLeaf
@@ -139,7 +139,7 @@ class Upload(MemoizationLeaf):
     def create(  # type: ignore
         cls,
         *children,
-        accept: Var[dict[str, List] | None] | dict[str, List] | None = None,
+        accept: Var[dict[str, Sequence] | None] | dict[str, Sequence] | None = None,
         disabled: Var[bool] | bool | None = None,
         max_files: Var[int] | int | None = None,
         max_size: Var[int] | int | None = None,
@@ -205,7 +205,7 @@ class StyledUpload(Upload):
     def create(  # type: ignore
         cls,
         *children,
-        accept: Var[dict[str, List] | None] | dict[str, List] | None = None,
+        accept: Var[dict[str, Sequence] | None] | dict[str, Sequence] | None = None,
         disabled: Var[bool] | bool | None = None,
         max_files: Var[int] | int | None = None,
         max_size: Var[int] | int | None = None,
@@ -271,7 +271,7 @@ class UploadNamespace(ComponentNamespace):
     @staticmethod
     def __call__(
         *children,
-        accept: Var[dict[str, List] | None] | dict[str, List] | None = None,
+        accept: Var[dict[str, Sequence] | None] | dict[str, Sequence] | None = None,
         disabled: Var[bool] | bool | None = None,
         max_files: Var[int] | int | None = None,
         max_size: Var[int] | int | None = None,

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

@@ -3,7 +3,7 @@
 from __future__ import annotations
 
 from enum import Enum
-from typing import Any, Dict, Literal, TypedDict
+from typing import Any, Dict, Literal, Sequence, TypedDict
 
 from reflex.base import Base
 from reflex.components.component import Component, NoSSRComponent
@@ -173,10 +173,10 @@ class DataEditor(NoSSRComponent):
     rows: Var[int]
 
     # Headers of the columns for the data grid.
-    columns: Var[list[dict[str, Any]]]
+    columns: Var[Sequence[dict[str, Any]]]
 
     # The data.
-    data: Var[list[list[Any]]]
+    data: Var[Sequence[Sequence[Any]]]
 
     # The name of the callback used to find the data to display.
     get_cell_content: Var[str]

+ 3 - 3
reflex/components/datadisplay/dataeditor.pyi

@@ -4,7 +4,7 @@
 # This file was generated by `reflex/utils/pyi_generator.py`!
 # ------------------------------------------------------
 from enum import Enum
-from typing import Any, Dict, Literal, Optional, TypedDict, Union, overload
+from typing import Any, Dict, Literal, Optional, Sequence, TypedDict, Union, overload
 
 from reflex.base import Base
 from reflex.components.component import NoSSRComponent
@@ -133,8 +133,8 @@ class DataEditor(NoSSRComponent):
         cls,
         *children,
         rows: Var[int] | int | None = None,
-        columns: Var[list[dict[str, Any]]] | list[dict[str, Any]] | None = None,
-        data: Var[list[list[Any]]] | list[list[Any]] | None = None,
+        columns: Sequence[dict[str, Any]] | Var[Sequence[dict[str, Any]]] | None = None,
+        data: Sequence[Sequence[Any]] | Var[Sequence[Sequence[Any]]] | None = None,
         get_cell_content: Var[str] | str | None = None,
         get_cells_for_selection: Var[bool] | bool | None = None,
         on_paste: Var[bool] | bool | None = None,

+ 2 - 2
reflex/components/gridjs/datatable.py

@@ -2,7 +2,7 @@
 
 from __future__ import annotations
 
-from typing import Any, Dict, List
+from typing import Any, Dict, List, Sequence
 
 from reflex.components.component import Component
 from reflex.components.tags import Tag
@@ -32,7 +32,7 @@ class DataTable(Gridjs):
 
     # The list of columns to display. Required if data is a list and should not be provided
     # if the data field is a dataframe
-    columns: Var[List]
+    columns: Var[Sequence]
 
     # Enable a search bar.
     search: Var[bool]

+ 2 - 2
reflex/components/gridjs/datatable.pyi

@@ -3,7 +3,7 @@
 # ------------------- DO NOT EDIT ----------------------
 # This file was generated by `reflex/utils/pyi_generator.py`!
 # ------------------------------------------------------
-from typing import Any, Dict, List, Optional, overload
+from typing import Any, Dict, Optional, Sequence, overload
 
 from reflex.components.component import Component
 from reflex.event import EventType
@@ -64,7 +64,7 @@ class DataTable(Gridjs):
         cls,
         *children,
         data: Any | None = None,
-        columns: List | Var[List] | None = None,
+        columns: Sequence | Var[Sequence] | None = None,
         search: Var[bool] | bool | None = None,
         sort: Var[bool] | bool | None = None,
         resizable: Var[bool] | bool | None = None,

+ 3 - 3
reflex/components/radix/primitives/accordion.py

@@ -2,7 +2,7 @@
 
 from __future__ import annotations
 
-from typing import Any, Literal
+from typing import Any, Literal, Sequence
 
 from reflex.components.component import Component, ComponentNamespace
 from reflex.components.core.colors import color
@@ -95,10 +95,10 @@ class AccordionRoot(AccordionComponent):
     type: Var[LiteralAccordionType]
 
     # The value of the item to expand.
-    value: Var[str | list[str]]
+    value: Var[str | Sequence[str]]
 
     # The default value of the item to expand.
-    default_value: Var[str | list[str]]
+    default_value: Var[str | Sequence[str]]
 
     # Whether or not the accordion is collapsible.
     collapsible: Var[bool]

+ 3 - 3
reflex/components/radix/primitives/accordion.pyi

@@ -3,7 +3,7 @@
 # ------------------- DO NOT EDIT ----------------------
 # This file was generated by `reflex/utils/pyi_generator.py`!
 # ------------------------------------------------------
-from typing import Any, Literal, Optional, overload
+from typing import Any, Literal, Optional, Sequence, overload
 
 from reflex.components.component import Component, ComponentNamespace
 from reflex.components.lucide.icon import Icon
@@ -144,8 +144,8 @@ class AccordionRoot(AccordionComponent):
         type: Literal["multiple", "single"]
         | Var[Literal["multiple", "single"]]
         | None = None,
-        value: Var[list[str] | str] | list[str] | str | None = None,
-        default_value: Var[list[str] | str] | list[str] | str | None = None,
+        value: Sequence[str] | Var[Sequence[str] | str] | str | None = None,
+        default_value: Sequence[str] | Var[Sequence[str] | str] | str | None = None,
         collapsible: Var[bool] | bool | None = None,
         disabled: Var[bool] | bool | None = None,
         dir: Literal["ltr", "rtl"] | Var[Literal["ltr", "rtl"]] | None = None,

+ 2 - 2
reflex/components/radix/primitives/drawer.py

@@ -4,7 +4,7 @@
 # Style based on https://ui.shadcn.com/docs/components/drawer
 from __future__ import annotations
 
-from typing import Any, Literal
+from typing import Any, Literal, Sequence
 
 from reflex.components.component import Component, ComponentNamespace
 from reflex.components.radix.primitives.base import RadixPrimitiveComponent
@@ -58,7 +58,7 @@ class DrawerRoot(DrawerComponent):
     handle_only: Var[bool]
 
     # Array of numbers from 0 to 100 that corresponds to % of the screen a given snap point should take up. Should go from least visible. Also Accept px values, which doesn't take screen height into account.
-    snap_points: list[str | float] | None
+    snap_points: Sequence[str | float] | None
 
     # Index of a snapPoint from which the overlay fade should be applied. Defaults to the last snap point.
     fade_from_index: Var[int]

+ 3 - 3
reflex/components/radix/primitives/drawer.pyi

@@ -3,7 +3,7 @@
 # ------------------- DO NOT EDIT ----------------------
 # This file was generated by `reflex/utils/pyi_generator.py`!
 # ------------------------------------------------------
-from typing import Any, Literal, Optional, overload
+from typing import Any, Literal, Optional, Sequence, overload
 
 from reflex.components.component import ComponentNamespace
 from reflex.components.radix.primitives.base import RadixPrimitiveComponent
@@ -75,7 +75,7 @@ class DrawerRoot(DrawerComponent):
         | None = None,
         dismissible: Var[bool] | bool | None = None,
         handle_only: Var[bool] | bool | None = None,
-        snap_points: list[float | str] | None = None,
+        snap_points: Sequence[float | str] | None = None,
         fade_from_index: Var[int] | int | None = None,
         scroll_lock_timeout: Var[int] | int | None = None,
         prevent_scroll_restoration: Var[bool] | bool | None = None,
@@ -554,7 +554,7 @@ class Drawer(ComponentNamespace):
         | None = None,
         dismissible: Var[bool] | bool | None = None,
         handle_only: Var[bool] | bool | None = None,
-        snap_points: list[float | str] | None = None,
+        snap_points: Sequence[float | str] | None = None,
         fade_from_index: Var[int] | int | None = None,
         scroll_lock_timeout: Var[int] | int | None = None,
         prevent_scroll_restoration: Var[bool] | bool | None = None,

+ 3 - 3
reflex/components/radix/primitives/slider.py

@@ -2,7 +2,7 @@
 
 from __future__ import annotations
 
-from typing import Any, Literal
+from typing import Any, Literal, Sequence
 
 from reflex.components.component import Component, ComponentNamespace
 from reflex.components.radix.primitives.base import RadixPrimitiveComponentWithClassName
@@ -39,9 +39,9 @@ class SliderRoot(SliderComponent):
     tag = "Root"
     alias = "RadixSliderRoot"
 
-    default_value: Var[list[int]]
+    default_value: Var[Sequence[int]]
 
-    value: Var[list[int]]
+    value: Var[Sequence[int]]
 
     name: Var[str]
 

+ 3 - 3
reflex/components/radix/primitives/slider.pyi

@@ -3,7 +3,7 @@
 # ------------------- DO NOT EDIT ----------------------
 # This file was generated by `reflex/utils/pyi_generator.py`!
 # ------------------------------------------------------
-from typing import Any, Literal, Optional, overload
+from typing import Any, Literal, Optional, Sequence, overload
 
 from reflex.components.component import Component, ComponentNamespace
 from reflex.components.radix.primitives.base import RadixPrimitiveComponentWithClassName
@@ -71,8 +71,8 @@ class SliderRoot(SliderComponent):
     def create(  # type: ignore
         cls,
         *children,
-        default_value: Var[list[int]] | list[int] | None = None,
-        value: Var[list[int]] | list[int] | None = None,
+        default_value: Sequence[int] | Var[Sequence[int]] | None = None,
+        value: Sequence[int] | Var[Sequence[int]] | None = None,
         name: Var[str] | str | None = None,
         disabled: Var[bool] | bool | None = None,
         orientation: Literal["horizontal", "vertical"]

+ 2 - 2
reflex/components/radix/themes/components/checkbox_group.py

@@ -1,7 +1,7 @@
 """Components for the CheckboxGroup component of Radix Themes."""
 
 from types import SimpleNamespace
-from typing import Literal
+from typing import Literal, Sequence
 
 from reflex.components.core.breakpoints import Responsive
 from reflex.vars.base import Var
@@ -27,7 +27,7 @@ class CheckboxGroupRoot(RadixThemesComponent):
     high_contrast: Var[bool]
 
     # determines which checkboxes, if any, are checked by default.
-    default_value: Var[list[str]]
+    default_value: Var[Sequence[str]]
 
     # used to assign a name to the entire group of checkboxes
     name: Var[str]

+ 2 - 2
reflex/components/radix/themes/components/checkbox_group.pyi

@@ -4,7 +4,7 @@
 # This file was generated by `reflex/utils/pyi_generator.py`!
 # ------------------------------------------------------
 from types import SimpleNamespace
-from typing import Any, Literal, Optional, overload
+from typing import Any, Literal, Optional, Sequence, overload
 
 from reflex.components.core.breakpoints import Breakpoints
 from reflex.event import EventType
@@ -86,7 +86,7 @@ class CheckboxGroupRoot(RadixThemesComponent):
         ]
         | None = None,
         high_contrast: Var[bool] | bool | None = None,
-        default_value: Var[list[str]] | list[str] | None = None,
+        default_value: Sequence[str] | Var[Sequence[str]] | None = None,
         name: Var[str] | str | None = None,
         style: Style | None = None,
         key: Any | None = None,

+ 2 - 2
reflex/components/radix/themes/components/context_menu.pyi

@@ -3,7 +3,7 @@
 # ------------------- DO NOT EDIT ----------------------
 # This file was generated by `reflex/utils/pyi_generator.py`!
 # ------------------------------------------------------
-from typing import Any, Literal, Optional, overload
+from typing import Any, Literal, Optional, Sequence, overload
 
 from reflex.components.component import ComponentNamespace
 from reflex.components.core.breakpoints import Breakpoints
@@ -1011,7 +1011,7 @@ class ContextMenuRadioItem(HighLevelRadioGroup):
         value: Var[str] | str | None = None,
         disabled: Var[bool] | bool | None = None,
         text_value: Var[str] | str | None = None,
-        items: Var[list[str]] | list[str] | None = None,
+        items: Sequence[str] | Var[Sequence[str]] | None = None,
         direction: Literal["column", "column-reverse", "row", "row-reverse"]
         | Var[Literal["column", "column-reverse", "row", "row-reverse"]]
         | None = None,

+ 3 - 3
reflex/components/radix/themes/components/radio_group.py

@@ -2,7 +2,7 @@
 
 from __future__ import annotations
 
-from typing import Literal
+from typing import Literal, Sequence
 
 import reflex as rx
 from reflex.components.component import Component, ComponentNamespace
@@ -77,7 +77,7 @@ class HighLevelRadioGroup(RadixThemesComponent):
     """High level wrapper for the RadioGroup component."""
 
     # The items of the radio group.
-    items: Var[list[str]]
+    items: Var[Sequence[str]]
 
     # The direction of the radio group.
     direction: Var[LiteralFlexDirection] = LiteralVar.create("row")
@@ -118,7 +118,7 @@ class HighLevelRadioGroup(RadixThemesComponent):
     @classmethod
     def create(
         cls,
-        items: Var[list[str | int | float | list | dict | bool | None]],
+        items: Var[Sequence[str | int | float | list | dict | bool | None]],
         **props,
     ) -> Component:
         """Create a radio group component.

+ 3 - 3
reflex/components/radix/themes/components/radio_group.pyi

@@ -3,7 +3,7 @@
 # ------------------- DO NOT EDIT ----------------------
 # This file was generated by `reflex/utils/pyi_generator.py`!
 # ------------------------------------------------------
-from typing import Any, Literal, Optional, overload
+from typing import Any, Literal, Optional, Sequence, overload
 
 from reflex.components.component import ComponentNamespace
 from reflex.components.core.breakpoints import Breakpoints
@@ -208,7 +208,7 @@ class HighLevelRadioGroup(RadixThemesComponent):
     def create(  # type: ignore
         cls,
         *children,
-        items: Var[list[str]] | list[str] | None = None,
+        items: Sequence[str] | Var[Sequence[str]] | None = None,
         direction: Literal["column", "column-reverse", "row", "row-reverse"]
         | Var[Literal["column", "column-reverse", "row", "row-reverse"]]
         | None = None,
@@ -346,7 +346,7 @@ class RadioGroup(ComponentNamespace):
     @staticmethod
     def __call__(
         *children,
-        items: Var[list[str]] | list[str] | None = None,
+        items: Sequence[str] | Var[Sequence[str]] | None = None,
         direction: Literal["column", "column-reverse", "row", "row-reverse"]
         | Var[Literal["column", "column-reverse", "row", "row-reverse"]]
         | None = None,

+ 3 - 3
reflex/components/radix/themes/components/segmented_control.py

@@ -3,7 +3,7 @@
 from __future__ import annotations
 
 from types import SimpleNamespace
-from typing import Literal
+from typing import Literal, Sequence
 
 from reflex.components.core.breakpoints import Responsive
 from reflex.event import EventHandler
@@ -47,10 +47,10 @@ class SegmentedControlRoot(RadixThemesComponent):
     radius: Var[Literal["none", "small", "medium", "large", "full"]]
 
     # The default value of the segmented control.
-    default_value: Var[str | list[str]]
+    default_value: Var[str | Sequence[str]]
 
     # The current value of the segmented control.
-    value: Var[str | list[str]]
+    value: Var[str | Sequence[str]]
 
     # Handles the `onChange` event for the SegmentedControl component.
     on_change: EventHandler[on_value_change]

+ 3 - 3
reflex/components/radix/themes/components/segmented_control.pyi

@@ -4,7 +4,7 @@
 # This file was generated by `reflex/utils/pyi_generator.py`!
 # ------------------------------------------------------
 from types import SimpleNamespace
-from typing import Any, Literal, Optional, overload
+from typing import Any, Literal, Optional, Sequence, overload
 
 from reflex.components.core.breakpoints import Breakpoints
 from reflex.event import EventType
@@ -93,8 +93,8 @@ class SegmentedControlRoot(RadixThemesComponent):
         radius: Literal["full", "large", "medium", "none", "small"]
         | Var[Literal["full", "large", "medium", "none", "small"]]
         | None = None,
-        default_value: Var[list[str] | str] | list[str] | str | None = None,
-        value: Var[list[str] | str] | list[str] | str | None = None,
+        default_value: Sequence[str] | Var[Sequence[str] | str] | str | None = None,
+        value: Sequence[str] | Var[Sequence[str] | str] | str | None = None,
         style: Style | None = None,
         key: Any | None = None,
         id: Any | None = None,

+ 2 - 2
reflex/components/radix/themes/components/select.py

@@ -1,6 +1,6 @@
 """Interactive components provided by @radix-ui/themes."""
 
-from typing import Literal
+from typing import Literal, Sequence
 
 import reflex as rx
 from reflex.components.component import Component, ComponentNamespace
@@ -152,7 +152,7 @@ class HighLevelSelect(SelectRoot):
     """High level wrapper for the Select component."""
 
     # The items of the select.
-    items: Var[list[str]]
+    items: Var[Sequence[str]]
 
     # The placeholder of the select.
     placeholder: Var[str]

+ 3 - 3
reflex/components/radix/themes/components/select.pyi

@@ -3,7 +3,7 @@
 # ------------------- DO NOT EDIT ----------------------
 # This file was generated by `reflex/utils/pyi_generator.py`!
 # ------------------------------------------------------
-from typing import Any, Literal, Optional, overload
+from typing import Any, Literal, Optional, Sequence, overload
 
 from reflex.components.component import ComponentNamespace
 from reflex.components.core.breakpoints import Breakpoints
@@ -545,7 +545,7 @@ class HighLevelSelect(SelectRoot):
     def create(  # type: ignore
         cls,
         *children,
-        items: Var[list[str]] | list[str] | None = None,
+        items: Sequence[str] | Var[Sequence[str]] | None = None,
         placeholder: Var[str] | str | None = None,
         label: Var[str] | str | None = None,
         color_scheme: Literal[
@@ -702,7 +702,7 @@ class Select(ComponentNamespace):
     @staticmethod
     def __call__(
         *children,
-        items: Var[list[str]] | list[str] | None = None,
+        items: Sequence[str] | Var[Sequence[str]] | None = None,
         placeholder: Var[str] | str | None = None,
         label: Var[str] | str | None = None,
         color_scheme: Literal[

+ 3 - 3
reflex/components/radix/themes/components/slider.py

@@ -2,7 +2,7 @@
 
 from __future__ import annotations
 
-from typing import Literal, Union
+from typing import Literal, Sequence
 
 from reflex.components.component import Component
 from reflex.components.core.breakpoints import Responsive
@@ -42,10 +42,10 @@ class Slider(RadixThemesComponent):
     radius: Var[Literal["none", "small", "full"]]
 
     # The value of the slider when initially rendered. Use when you do not need to control the state of the slider.
-    default_value: Var[Union[list[float | int], float, int]]
+    default_value: Var[Sequence[float | int] | float | int]
 
     # The controlled value of the slider. Must be used in conjunction with onValueChange.
-    value: Var[list[float | int]]
+    value: Var[Sequence[float | int]]
 
     # The name of the slider. Submitted with its owning form as part of a name/value pair.
     name: Var[str]

+ 4 - 4
reflex/components/radix/themes/components/slider.pyi

@@ -3,7 +3,7 @@
 # ------------------- DO NOT EDIT ----------------------
 # This file was generated by `reflex/utils/pyi_generator.py`!
 # ------------------------------------------------------
-from typing import Any, Literal, Optional, Union, overload
+from typing import Any, Literal, Optional, Sequence, Union, overload
 
 from reflex.components.core.breakpoints import Breakpoints
 from reflex.event import EventType, passthrough_event_spec
@@ -95,12 +95,12 @@ class Slider(RadixThemesComponent):
         radius: Literal["full", "none", "small"]
         | Var[Literal["full", "none", "small"]]
         | None = None,
-        default_value: Var[float | int | list[float | int]]
+        default_value: Sequence[float | int]
+        | Var[Sequence[float | int] | float | int]
         | float
         | int
-        | list[float | int]
         | None = None,
-        value: Var[list[float | int]] | list[float | int] | None = None,
+        value: Sequence[float | int] | Var[Sequence[float | int]] | None = None,
         name: Var[str] | str | None = None,
         width: Var[str | None] | str | None = None,
         min: Var[float | int] | float | int | None = None,

+ 15 - 15
reflex/components/recharts/cartesian.py

@@ -2,7 +2,7 @@
 
 from __future__ import annotations
 
-from typing import Any, List, Union
+from typing import Any, Sequence, Union
 
 from reflex.constants import EventTriggers
 from reflex.constants.colors import Color
@@ -61,7 +61,7 @@ class Axis(Recharts):
     allow_duplicated_category: Var[bool]
 
     # The range of the axis. Work best in conjunction with allow_data_overflow. Default: [0, "auto"]
-    domain: Var[List]
+    domain: Var[Sequence]
 
     # If set false, no axis line will be drawn. Default: True
     axis_line: Var[bool]
@@ -85,7 +85,7 @@ class Axis(Recharts):
     name: Var[str | int]
 
     # Set the values of axis ticks manually.
-    ticks: Var[list[str | int]]
+    ticks: Var[Sequence[str | int]]
 
     # If set false, no ticks will be drawn.
     tick: Var[bool]
@@ -184,7 +184,7 @@ class ZAxis(Recharts):
     z_axis_id: Var[str | int]
 
     # The range of axis. Default: [10, 10]
-    range: Var[list[int]]
+    range: Var[Sequence[int]]
 
     # The unit of data displayed in the axis. This option will be used to represent an index unit in a scatter chart.
     unit: Var[str | int]
@@ -225,7 +225,7 @@ class Brush(Recharts):
     height: Var[int]
 
     # The original data of a LineChart, a BarChart or an AreaChart.
-    data: Var[list[Any]]
+    data: Var[Sequence[Any]]
 
     # The width of each traveller. Default: 5
     traveller_width: Var[int]
@@ -357,10 +357,10 @@ class Area(Cartesian):
     label: Var[bool]
 
     # The value which can describle the line, usually calculated internally.
-    base_line: Var[Union[str, list[dict[str, Any]]]]
+    base_line: Var[str | Sequence[dict[str, Any]]]
 
     # The coordinates of all the points in the area, usually calculated internally.
-    points: Var[list[dict[str, Any]]]
+    points: Var[Sequence[dict[str, Any]]]
 
     # The stack id of area, when two areas have the same value axis and same stack_id, then the two areas are stacked in order.
     stack_id: Var[str | int]
@@ -413,7 +413,7 @@ class Bar(Cartesian):
     max_bar_size: Var[int]
 
     # If set a value, the option is the radius of all the rounded corners. If set a array, the option are in turn the radiuses of top-left corner, top-right corner, bottom-right corner, bottom-left corner. Default: 0
-    radius: Var[int | list[int]]
+    radius: Var[int | Sequence[int]]
 
     # The active bar is shown when a user enters a bar chart and this chart has tooltip. If set to false, no active bar will be drawn. If set to true, active bar will be drawn with the props calculated internally. If passed an object, active bar will be drawn, and the internally calculated props will be merged with the key value pairs of the passed object.
     # active_bar: Var[Union[bool, dict[str, Any]]] #noqa: ERA001
@@ -467,7 +467,7 @@ class Line(Cartesian):
     unit: Var[str | int]
 
     # The coordinates of all the points in the line, usually calculated internally.
-    points: Var[list[dict[str, Any]]]
+    points: Var[Sequence[dict[str, Any]]]
 
     # The pattern of dashes and gaps used to paint the line.
     stroke_dasharray: Var[str]
@@ -484,7 +484,7 @@ class Scatter(Recharts):
     alias = "RechartsScatter"
 
     # The source data, in which each element is an object.
-    data: Var[list[dict[str, Any]]]
+    data: Var[Sequence[dict[str, Any]]]
 
     # 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'. Default: "circle"
     legend_type: Var[LiteralLegendType]
@@ -558,7 +558,7 @@ class Funnel(Recharts):
     alias = "RechartsFunnel"
 
     # The source data, in which each element is an object.
-    data: Var[list[dict[str, Any]]]
+    data: Var[Sequence[dict[str, Any]]]
 
     # The key or getter of a group of data which should be unique in a FunnelChart.
     data_key: Var[str | int]
@@ -585,7 +585,7 @@ class Funnel(Recharts):
     stroke: Var[str | Color] = LiteralVar.create(Color("gray", 3))
 
     # The coordinates of all the trapezoids in the funnel, usually calculated internally.
-    trapezoids: Var[list[dict[str, Any]]]
+    trapezoids: Var[Sequence[dict[str, Any]]]
 
     # Valid children components
     _valid_children: list[str] = ["LabelList", "Cell"]
@@ -686,7 +686,7 @@ class ReferenceLine(Reference):
     _valid_children: list[str] = ["Label"]
 
     # Array of endpoints in { x, y } format. These endpoints would be used to draw the ReferenceLine.
-    segment: list[Any] = []
+    segment: Sequence[Any] = []
 
 
 class ReferenceDot(Reference):
@@ -813,10 +813,10 @@ class CartesianGrid(Grid):
     vertical: Var[bool]
 
     # The x-coordinates in pixel values of all vertical lines. Default: []
-    vertical_points: Var[list[str | int]]
+    vertical_points: Var[Sequence[str | int]]
 
     # The x-coordinates in pixel values of all vertical lines. Default: []
-    horizontal_points: Var[list[str | int]]
+    horizontal_points: Var[Sequence[str | int]]
 
     # The background of grid.
     fill: Var[str | Color]

+ 22 - 20
reflex/components/recharts/cartesian.pyi

@@ -3,7 +3,7 @@
 # ------------------- DO NOT EDIT ----------------------
 # This file was generated by `reflex/utils/pyi_generator.py`!
 # ------------------------------------------------------
-from typing import Any, List, Literal, Optional, overload
+from typing import Any, Literal, Optional, Sequence, overload
 
 from reflex.constants.colors import Color
 from reflex.event import EventType
@@ -45,7 +45,7 @@ class Axis(Recharts):
         allow_decimals: Var[bool] | bool | None = None,
         allow_data_overflow: Var[bool] | bool | None = None,
         allow_duplicated_category: Var[bool] | bool | None = None,
-        domain: List | Var[List] | None = None,
+        domain: Sequence | Var[Sequence] | None = None,
         axis_line: Var[bool] | bool | None = None,
         mirror: Var[bool] | bool | None = None,
         reversed: Var[bool] | bool | None = None,
@@ -93,7 +93,7 @@ class Axis(Recharts):
         | None = None,
         unit: Var[int | str] | int | str | None = None,
         name: Var[int | str] | int | str | None = None,
-        ticks: Var[list[int | str]] | list[int | str] | None = None,
+        ticks: Sequence[int | str] | Var[Sequence[int | str]] | None = None,
         tick: Var[bool] | bool | None = None,
         tick_count: Var[int] | int | None = None,
         tick_line: Var[bool] | bool | None = None,
@@ -215,7 +215,7 @@ class XAxis(Axis):
         allow_decimals: Var[bool] | bool | None = None,
         allow_data_overflow: Var[bool] | bool | None = None,
         allow_duplicated_category: Var[bool] | bool | None = None,
-        domain: List | Var[List] | None = None,
+        domain: Sequence | Var[Sequence] | None = None,
         axis_line: Var[bool] | bool | None = None,
         mirror: Var[bool] | bool | None = None,
         reversed: Var[bool] | bool | None = None,
@@ -263,7 +263,7 @@ class XAxis(Axis):
         | None = None,
         unit: Var[int | str] | int | str | None = None,
         name: Var[int | str] | int | str | None = None,
-        ticks: Var[list[int | str]] | list[int | str] | None = None,
+        ticks: Sequence[int | str] | Var[Sequence[int | str]] | None = None,
         tick: Var[bool] | bool | None = None,
         tick_count: Var[int] | int | None = None,
         tick_line: Var[bool] | bool | None = None,
@@ -388,7 +388,7 @@ class YAxis(Axis):
         allow_decimals: Var[bool] | bool | None = None,
         allow_data_overflow: Var[bool] | bool | None = None,
         allow_duplicated_category: Var[bool] | bool | None = None,
-        domain: List | Var[List] | None = None,
+        domain: Sequence | Var[Sequence] | None = None,
         axis_line: Var[bool] | bool | None = None,
         mirror: Var[bool] | bool | None = None,
         reversed: Var[bool] | bool | None = None,
@@ -436,7 +436,7 @@ class YAxis(Axis):
         | None = None,
         unit: Var[int | str] | int | str | None = None,
         name: Var[int | str] | int | str | None = None,
-        ticks: Var[list[int | str]] | list[int | str] | None = None,
+        ticks: Sequence[int | str] | Var[Sequence[int | str]] | None = None,
         tick: Var[bool] | bool | None = None,
         tick_count: Var[int] | int | None = None,
         tick_line: Var[bool] | bool | None = None,
@@ -529,7 +529,7 @@ class ZAxis(Recharts):
         *children,
         data_key: Var[int | str] | int | str | None = None,
         z_axis_id: Var[int | str] | int | str | None = None,
-        range: Var[list[int]] | list[int] | None = None,
+        range: Sequence[int] | Var[Sequence[int]] | None = None,
         unit: Var[int | str] | int | str | None = None,
         name: Var[int | str] | int | str | None = None,
         scale: Literal[
@@ -629,7 +629,7 @@ class Brush(Recharts):
         y: Var[int] | int | None = None,
         width: Var[int] | int | None = None,
         height: Var[int] | int | None = None,
-        data: Var[list[Any]] | list[Any] | None = None,
+        data: Sequence[Any] | Var[Sequence[Any]] | None = None,
         traveller_width: Var[int] | int | None = None,
         gap: Var[int] | int | None = None,
         start_index: Var[int] | int | None = None,
@@ -835,11 +835,11 @@ class Area(Cartesian):
         dot: Var[bool | dict[str, Any]] | bool | dict[str, Any] | None = None,
         active_dot: Var[bool | dict[str, Any]] | bool | dict[str, Any] | None = None,
         label: Var[bool] | bool | None = None,
-        base_line: Var[list[dict[str, Any]] | str]
-        | list[dict[str, Any]]
+        base_line: Sequence[dict[str, Any]]
+        | Var[Sequence[dict[str, Any]] | str]
         | str
         | None = None,
-        points: Var[list[dict[str, Any]]] | list[dict[str, Any]] | None = None,
+        points: Sequence[dict[str, Any]] | Var[Sequence[dict[str, Any]]] | None = None,
         stack_id: Var[int | str] | int | str | None = None,
         connect_nulls: Var[bool] | bool | None = None,
         layout: Literal["horizontal", "vertical"]
@@ -978,7 +978,7 @@ class Bar(Cartesian):
         name: Var[int | str] | int | str | None = None,
         bar_size: Var[int] | int | None = None,
         max_bar_size: Var[int] | int | None = None,
-        radius: Var[int | list[int]] | int | list[int] | None = None,
+        radius: Sequence[int] | Var[Sequence[int] | int] | int | None = None,
         layout: Literal["horizontal", "vertical"]
         | Var[Literal["horizontal", "vertical"]]
         | None = None,
@@ -1146,7 +1146,7 @@ class Line(Cartesian):
         hide: Var[bool] | bool | None = None,
         connect_nulls: Var[bool] | bool | None = None,
         unit: Var[int | str] | int | str | None = None,
-        points: Var[list[dict[str, Any]]] | list[dict[str, Any]] | None = None,
+        points: Sequence[dict[str, Any]] | Var[Sequence[dict[str, Any]]] | None = None,
         stroke_dasharray: Var[str] | str | None = None,
         layout: Literal["horizontal", "vertical"]
         | Var[Literal["horizontal", "vertical"]]
@@ -1271,7 +1271,7 @@ class Scatter(Recharts):
     def create(  # type: ignore
         cls,
         *children,
-        data: Var[list[dict[str, Any]]] | list[dict[str, Any]] | None = None,
+        data: Sequence[dict[str, Any]] | Var[Sequence[dict[str, Any]]] | None = None,
         legend_type: Literal[
             "circle",
             "cross",
@@ -1391,7 +1391,7 @@ class Funnel(Recharts):
     def create(  # type: ignore
         cls,
         *children,
-        data: Var[list[dict[str, Any]]] | list[dict[str, Any]] | None = None,
+        data: Sequence[dict[str, Any]] | Var[Sequence[dict[str, Any]]] | None = None,
         data_key: Var[int | str] | int | str | None = None,
         name_key: Var[str] | str | None = None,
         legend_type: Literal[
@@ -1432,7 +1432,9 @@ class Funnel(Recharts):
         | Var[Literal["ease", "ease-in", "ease-in-out", "ease-out", "linear"]]
         | None = None,
         stroke: Color | Var[Color | str] | str | None = None,
-        trapezoids: Var[list[dict[str, Any]]] | list[dict[str, Any]] | None = None,
+        trapezoids: Sequence[dict[str, Any]]
+        | Var[Sequence[dict[str, Any]]]
+        | None = None,
         style: Style | None = None,
         key: Any | None = None,
         id: Any | None = None,
@@ -1619,7 +1621,7 @@ class ReferenceLine(Reference):
         y: Var[int | str] | int | str | None = None,
         stroke: Color | Var[Color | str] | str | None = None,
         stroke_width: Var[int | str] | int | str | None = None,
-        segment: list[Any] | None = None,
+        segment: Sequence[Any] | None = None,
         x_axis_id: Var[int | str] | int | str | None = None,
         y_axis_id: Var[int | str] | int | str | None = None,
         if_overflow: Literal["discard", "extendDomain", "hidden", "visible"]
@@ -1885,8 +1887,8 @@ class CartesianGrid(Grid):
         *children,
         horizontal: Var[bool] | bool | None = None,
         vertical: Var[bool] | bool | None = None,
-        vertical_points: Var[list[int | str]] | list[int | str] | None = None,
-        horizontal_points: Var[list[int | str]] | list[int | str] | None = None,
+        vertical_points: Sequence[int | str] | Var[Sequence[int | str]] | None = None,
+        horizontal_points: Sequence[int | str] | Var[Sequence[int | str]] | None = None,
         fill: Color | Var[Color | str] | str | None = None,
         fill_opacity: Var[float] | float | None = None,
         stroke_dasharray: Var[str] | str | None = None,

+ 5 - 5
reflex/components/recharts/charts.py

@@ -2,7 +2,7 @@
 
 from __future__ import annotations
 
-from typing import Any
+from typing import Any, Sequence
 
 from reflex.components.component import Component
 from reflex.components.recharts.general import ResponsiveContainer
@@ -104,7 +104,7 @@ class CategoricalChartBase(ChartBase):
     """A component that wraps a Categorical Recharts charts."""
 
     # The source data, in which each element is an object.
-    data: Var[list[dict[str, Any]]]
+    data: Var[Sequence[dict[str, Any]]]
 
     # The sizes of whitespace around the chart, i.e. {"top": 50, "right": 30, "left": 20, "bottom": 5}.
     margin: Var[dict[str, Any]]
@@ -290,7 +290,7 @@ class RadarChart(ChartBase):
     alias = "RechartsRadarChart"
 
     # The source data, in which each element is an object.
-    data: Var[list[dict[str, Any]]]
+    data: Var[Sequence[dict[str, Any]]]
 
     # The sizes of whitespace around the chart, i.e. {"top": 50, "right": 30, "left": 20, "bottom": 5}. Default: {"top": 0, "right": 0, "left": 0, "bottom": 0}
     margin: Var[dict[str, Any]]
@@ -344,7 +344,7 @@ class RadialBarChart(ChartBase):
     alias = "RechartsRadialBarChart"
 
     # The source data which each element is an object.
-    data: Var[list[dict[str, Any]]]
+    data: Var[Sequence[dict[str, Any]]]
 
     # The sizes of whitespace around the chart. Default: {"top": 5, "right": 5, "left": 5 "bottom": 5}
     margin: Var[dict[str, Any]]
@@ -464,7 +464,7 @@ class Treemap(RechartsCharts):
     height: Var[str | int] = Var.create("100%")
 
     # data of treemap. Array
-    data: Var[list[dict[str, Any]]]
+    data: Var[Sequence[dict[str, Any]]]
 
     # The key of a group of data which should be unique in a treemap. String | Number. Default: "value"
     data_key: Var[str | int]

+ 9 - 9
reflex/components/recharts/charts.pyi

@@ -3,7 +3,7 @@
 # ------------------- DO NOT EDIT ----------------------
 # This file was generated by `reflex/utils/pyi_generator.py`!
 # ------------------------------------------------------
-from typing import Any, Literal, Optional, overload
+from typing import Any, Literal, Optional, Sequence, overload
 
 from reflex.constants.colors import Color
 from reflex.event import EventType
@@ -72,7 +72,7 @@ class CategoricalChartBase(ChartBase):
     def create(  # type: ignore
         cls,
         *children,
-        data: Var[list[dict[str, Any]]] | list[dict[str, Any]] | None = None,
+        data: Sequence[dict[str, Any]] | Var[Sequence[dict[str, Any]]] | None = None,
         margin: Var[dict[str, Any]] | dict[str, Any] | None = None,
         sync_id: Var[str] | str | None = None,
         sync_method: Literal["index", "value"]
@@ -148,7 +148,7 @@ class AreaChart(CategoricalChartBase):
         | Var[Literal["auto", "dataMax", "dataMin"] | int]
         | int
         | None = None,
-        data: Var[list[dict[str, Any]]] | list[dict[str, Any]] | None = None,
+        data: Sequence[dict[str, Any]] | Var[Sequence[dict[str, Any]]] | None = None,
         margin: Var[dict[str, Any]] | dict[str, Any] | None = None,
         sync_id: Var[str] | str | None = None,
         sync_method: Literal["index", "value"]
@@ -229,7 +229,7 @@ class BarChart(CategoricalChartBase):
         | Var[Literal["expand", "none", "silhouette", "wiggle"]]
         | None = None,
         reverse_stack_order: Var[bool] | bool | None = None,
-        data: Var[list[dict[str, Any]]] | list[dict[str, Any]] | None = None,
+        data: Sequence[dict[str, Any]] | Var[Sequence[dict[str, Any]]] | None = None,
         margin: Var[dict[str, Any]] | dict[str, Any] | None = None,
         sync_id: Var[str] | str | None = None,
         sync_method: Literal["index", "value"]
@@ -303,7 +303,7 @@ class LineChart(CategoricalChartBase):
     def create(  # type: ignore
         cls,
         *children,
-        data: Var[list[dict[str, Any]]] | list[dict[str, Any]] | None = None,
+        data: Sequence[dict[str, Any]] | Var[Sequence[dict[str, Any]]] | None = None,
         margin: Var[dict[str, Any]] | dict[str, Any] | None = None,
         sync_id: Var[str] | str | None = None,
         sync_method: Literal["index", "value"]
@@ -383,7 +383,7 @@ class ComposedChart(CategoricalChartBase):
         bar_gap: Var[int] | int | None = None,
         bar_size: Var[int] | int | None = None,
         reverse_stack_order: Var[bool] | bool | None = None,
-        data: Var[list[dict[str, Any]]] | list[dict[str, Any]] | None = None,
+        data: Sequence[dict[str, Any]] | Var[Sequence[dict[str, Any]]] | None = None,
         margin: Var[dict[str, Any]] | dict[str, Any] | None = None,
         sync_id: Var[str] | str | None = None,
         sync_method: Literal["index", "value"]
@@ -521,7 +521,7 @@ class RadarChart(ChartBase):
     def create(  # type: ignore
         cls,
         *children,
-        data: Var[list[dict[str, Any]]] | list[dict[str, Any]] | None = None,
+        data: Sequence[dict[str, Any]] | Var[Sequence[dict[str, Any]]] | None = None,
         margin: Var[dict[str, Any]] | dict[str, Any] | None = None,
         cx: Var[int | str] | int | str | None = None,
         cy: Var[int | str] | int | str | None = None,
@@ -578,7 +578,7 @@ class RadialBarChart(ChartBase):
     def create(  # type: ignore
         cls,
         *children,
-        data: Var[list[dict[str, Any]]] | list[dict[str, Any]] | None = None,
+        data: Sequence[dict[str, Any]] | Var[Sequence[dict[str, Any]]] | None = None,
         margin: Var[dict[str, Any]] | dict[str, Any] | None = None,
         cx: Var[int | str] | int | str | None = None,
         cy: Var[int | str] | int | str | None = None,
@@ -766,7 +766,7 @@ class Treemap(RechartsCharts):
         *children,
         width: Var[int | str] | int | str | None = None,
         height: Var[int | str] | int | str | None = None,
-        data: Var[list[dict[str, Any]]] | list[dict[str, Any]] | None = None,
+        data: Sequence[dict[str, Any]] | Var[Sequence[dict[str, Any]]] | None = None,
         data_key: Var[int | str] | int | str | None = None,
         name_key: Var[str] | str | None = None,
         aspect_ratio: Var[int] | int | None = None,

+ 2 - 2
reflex/components/recharts/general.py

@@ -2,7 +2,7 @@
 
 from __future__ import annotations
 
-from typing import Any, Union
+from typing import Any, Sequence, Union
 
 from reflex.components.component import MemoizationLeaf
 from reflex.constants.colors import Color
@@ -92,7 +92,7 @@ class Legend(Recharts):
     icon_type: Var[LiteralIconType]
 
     # The source data of the content to be displayed in the legend, usually calculated internally. Default: []
-    payload: Var[list[dict[str, Any]]]
+    payload: Var[Sequence[dict[str, Any]]]
 
     # The width of chart container, usually calculated internally.
     chart_width: Var[int]

+ 2 - 2
reflex/components/recharts/general.pyi

@@ -3,7 +3,7 @@
 # ------------------- DO NOT EDIT ----------------------
 # This file was generated by `reflex/utils/pyi_generator.py`!
 # ------------------------------------------------------
-from typing import Any, Literal, Optional, overload
+from typing import Any, Literal, Optional, Sequence, overload
 
 from reflex.components.component import MemoizationLeaf
 from reflex.constants.colors import Color
@@ -118,7 +118,7 @@ class Legend(Recharts):
             ]
         ]
         | None = None,
-        payload: Var[list[dict[str, Any]]] | list[dict[str, Any]] | None = None,
+        payload: Sequence[dict[str, Any]] | Var[Sequence[dict[str, Any]]] | None = None,
         chart_width: Var[int] | int | None = None,
         chart_height: Var[int] | int | None = None,
         margin: Var[dict[str, Any]] | dict[str, Any] | None = None,

+ 8 - 11
reflex/components/recharts/polar.py

@@ -2,7 +2,7 @@
 
 from __future__ import annotations
 
-from typing import Any, Union
+from typing import Any, Sequence, Union
 
 from reflex.constants import EventTriggers
 from reflex.constants.colors import Color
@@ -28,7 +28,7 @@ class Pie(Recharts):
     alias = "RechartsPie"
 
     # The source data which each element is an object.
-    data: Var[list[dict[str, Any]]]
+    data: Var[Sequence[dict[str, Any]]]
 
     # The key of each sector's value.
     data_key: Var[str | int]
@@ -69,9 +69,6 @@ class Pie(Recharts):
     # If false set, label lines will not be drawn. If true set, label lines will be drawn which have the props calculated internally. Default: False
     label_line: Var[bool]
 
-    # The index of active sector in Pie, this option can be changed in mouse event handlers.
-    data: Var[list[dict[str, Any]]]
-
     # Valid children components
     _valid_children: list[str] = ["Cell", "LabelList", "Bare"]
 
@@ -125,7 +122,7 @@ class Radar(Recharts):
     data_key: Var[str | int]
 
     # The coordinates of all the vertices of the radar shape, like [{ x, y }].
-    points: Var[list[dict[str, Any]]]
+    points: Var[Sequence[dict[str, Any]]]
 
     # If false set, dots will not be drawn. Default: True
     dot: Var[bool]
@@ -180,7 +177,7 @@ class RadialBar(Recharts):
     alias = "RechartsRadialBar"
 
     # The source data which each element is an object.
-    data: Var[list[dict[str, Any]]]
+    data: Var[Sequence[dict[str, Any]]]
 
     # The key of a group of data which should be unique to show the meaning of angle axis.
     data_key: Var[str | int]
@@ -262,7 +259,7 @@ class PolarAngleAxis(Recharts):
     tick: Var[Union[bool, dict[str, Any]]]
 
     # The array of every tick's value and angle.
-    ticks: Var[list[dict[str, Any]]]
+    ticks: Var[Sequence[dict[str, Any]]]
 
     # The orientation of axis text. Default: "outer"
     orientation: Var[str]
@@ -321,10 +318,10 @@ class PolarGrid(Recharts):
     outer_radius: Var[int]
 
     # The array of every line grid's angle.
-    polar_angles: Var[list[int]]
+    polar_angles: Var[Sequence[int]]
 
     # The array of every line grid's radius.
-    polar_radius: Var[list[int]]
+    polar_radius: Var[Sequence[int]]
 
     # The type of polar grids. 'polygon' | 'circle'. Default: "polygon"
     grid_type: Var[LiteralGridType]
@@ -380,7 +377,7 @@ class PolarRadiusAxis(Recharts):
     _valid_children: list[str] = ["Label"]
 
     # The domain of the polar radius axis, specifying the minimum and maximum values. Default: [0, "auto"]
-    domain: Var[list[int | str]]
+    domain: Var[Sequence[int | str]]
 
     # The stroke color of axis. Default: rx.color("gray", 10)
     stroke: Var[str | Color] = LiteralVar.create(Color("gray", 10))

+ 9 - 9
reflex/components/recharts/polar.pyi

@@ -3,7 +3,7 @@
 # ------------------- DO NOT EDIT ----------------------
 # This file was generated by `reflex/utils/pyi_generator.py`!
 # ------------------------------------------------------
-from typing import Any, Literal, Optional, overload
+from typing import Any, Literal, Optional, Sequence, overload
 
 from reflex.constants.colors import Color
 from reflex.event import EventType
@@ -19,7 +19,7 @@ class Pie(Recharts):
     def create(  # type: ignore
         cls,
         *children,
-        data: Var[list[dict[str, Any]]] | list[dict[str, Any]] | None = None,
+        data: Sequence[dict[str, Any]] | Var[Sequence[dict[str, Any]]] | None = None,
         data_key: Var[int | str] | int | str | None = None,
         cx: Var[int | str] | int | str | None = None,
         cy: Var[int | str] | int | str | None = None,
@@ -92,7 +92,7 @@ class Pie(Recharts):
 
         Args:
             *children: The children of the component.
-            data: The index of active sector in Pie, this option can be changed in mouse event handlers.
+            data: The source data which each element is an object.
             data_key: The key of each sector's value.
             cx: The x-coordinate of center. If set a percentage, the final value is obtained by multiplying the percentage of container width. Default: "50%"
             cy: The y-coordinate of center. If set a percentage, the final value is obtained by multiplying the percentage of container height. Default: "50%"
@@ -134,7 +134,7 @@ class Radar(Recharts):
         cls,
         *children,
         data_key: Var[int | str] | int | str | None = None,
-        points: Var[list[dict[str, Any]]] | list[dict[str, Any]] | None = None,
+        points: Sequence[dict[str, Any]] | Var[Sequence[dict[str, Any]]] | None = None,
         dot: Var[bool] | bool | None = None,
         stroke: Color | Var[Color | str] | str | None = None,
         fill: Var[str] | str | None = None,
@@ -223,7 +223,7 @@ class RadialBar(Recharts):
     def create(  # type: ignore
         cls,
         *children,
-        data: Var[list[dict[str, Any]]] | list[dict[str, Any]] | None = None,
+        data: Sequence[dict[str, Any]] | Var[Sequence[dict[str, Any]]] | None = None,
         data_key: Var[int | str] | int | str | None = None,
         min_angle: Var[int] | int | None = None,
         legend_type: Literal[
@@ -324,7 +324,7 @@ class PolarAngleAxis(Recharts):
         | None = None,
         tick_line: Var[bool | dict[str, Any]] | bool | dict[str, Any] | None = None,
         tick: Var[bool | dict[str, Any]] | bool | dict[str, Any] | None = None,
-        ticks: Var[list[dict[str, Any]]] | list[dict[str, Any]] | None = None,
+        ticks: Sequence[dict[str, Any]] | Var[Sequence[dict[str, Any]]] | None = None,
         orientation: Var[str] | str | None = None,
         stroke: Color | Var[Color | str] | str | None = None,
         allow_duplicated_category: Var[bool] | bool | None = None,
@@ -398,8 +398,8 @@ class PolarGrid(Recharts):
         cy: Var[int] | int | None = None,
         inner_radius: Var[int] | int | None = None,
         outer_radius: Var[int] | int | None = None,
-        polar_angles: Var[list[int]] | list[int] | None = None,
-        polar_radius: Var[list[int]] | list[int] | None = None,
+        polar_angles: Sequence[int] | Var[Sequence[int]] | None = None,
+        polar_radius: Sequence[int] | Var[Sequence[int]] | None = None,
         grid_type: Literal["circle", "polygon"]
         | Var[Literal["circle", "polygon"]]
         | None = None,
@@ -510,7 +510,7 @@ class PolarRadiusAxis(Recharts):
             ]
         ]
         | None = None,
-        domain: Var[list[int | str]] | list[int | str] | None = None,
+        domain: Sequence[int | str] | Var[Sequence[int | str]] | None = None,
         stroke: Color | Var[Color | str] | str | None = None,
         style: Style | None = None,
         key: Any | None = None,

+ 2 - 2
reflex/experimental/layout.pyi

@@ -3,7 +3,7 @@
 # ------------------- DO NOT EDIT ----------------------
 # This file was generated by `reflex/utils/pyi_generator.py`!
 # ------------------------------------------------------
-from typing import Any, Literal, Optional, overload
+from typing import Any, Literal, Optional, Sequence, overload
 
 from reflex import color
 from reflex.components.base.fragment import Fragment
@@ -257,7 +257,7 @@ class DrawerSidebar(DrawerRoot):
         | None = None,
         dismissible: Var[bool] | bool | None = None,
         handle_only: Var[bool] | bool | None = None,
-        snap_points: list[float | str] | None = None,
+        snap_points: Sequence[float | str] | None = None,
         fade_from_index: Var[int] | int | None = None,
         scroll_lock_timeout: Var[int] | int | None = None,
         prevent_scroll_restoration: Var[bool] | bool | None = None,

+ 1 - 0
reflex/utils/pyi_generator.py

@@ -61,6 +61,7 @@ DEFAULT_TYPING_IMPORTS = {
     "Callable",
     "Dict",
     # "List",
+    "Sequence",
     "Literal",
     "Optional",
     "Union",

+ 14 - 0
reflex/utils/serializers.py

@@ -15,6 +15,7 @@ from typing import (
     Any,
     Callable,
     Literal,
+    Sequence,
     Set,
     Type,
     TypeVar,
@@ -333,6 +334,19 @@ def serialize_set(value: Set) -> list:
     return list(value)
 
 
+@serializer
+def serialize_sequence(value: Sequence) -> list:
+    """Serialize a sequence to a JSON serializable list.
+
+    Args:
+        value: The sequence to serialize.
+
+    Returns:
+        The serialized list.
+    """
+    return list(value)
+
+
 @serializer(to=str)
 def serialize_datetime(dt: Union[date, datetime, time, timedelta]) -> str:
     """Serialize a datetime to a JSON string.

+ 13 - 6
reflex/vars/base.py

@@ -1210,7 +1210,7 @@ class Var(Generic[VAR_TYPE]):
 
     @overload
     @classmethod
-    def range(cls, stop: int | NumberVar, /) -> ArrayVar[list[int]]: ...
+    def range(cls, stop: int | NumberVar, /) -> ArrayVar[Sequence[int]]: ...
 
     @overload
     @classmethod
@@ -1220,7 +1220,7 @@ class Var(Generic[VAR_TYPE]):
         end: int | NumberVar,
         step: int | NumberVar = 1,
         /,
-    ) -> ArrayVar[list[int]]: ...
+    ) -> ArrayVar[Sequence[int]]: ...
 
     @classmethod
     def range(
@@ -1228,7 +1228,7 @@ class Var(Generic[VAR_TYPE]):
         first_endpoint: int | NumberVar,
         second_endpoint: int | NumberVar | None = None,
         step: int | NumberVar | None = None,
-    ) -> ArrayVar[list[int]]:
+    ) -> ArrayVar[Sequence[int]]:
         """Create a range of numbers.
 
         Args:
@@ -1686,7 +1686,7 @@ def figure_out_type(value: Any) -> types.GenericType:
     if has_args(type_):
         return type_
     if isinstance(value, list):
-        return list[unionize(*(figure_out_type(v) for v in value))]
+        return Sequence[unionize(*(figure_out_type(v) for v in value))]
     if isinstance(value, set):
         return set[unionize(*(figure_out_type(v) for v in value))]
     if isinstance(value, tuple):
@@ -3279,10 +3279,17 @@ class Field(Generic[FIELD_TYPE]):
 
     @overload
     def __get__(
-        self: Field[list[V]] | Field[set[V]] | Field[tuple[V, ...]],
+        self: Field[list[V]] | Field[set[V]],
         instance: None,
         owner: Any,
-    ) -> ArrayVar[list[V]]: ...
+    ) -> ArrayVar[Sequence[V]]: ...
+
+    @overload
+    def __get__(
+        self: Field[SEQUENCE_TYPE],
+        instance: None,
+        owner: Any,
+    ) -> ArrayVar[SEQUENCE_TYPE]: ...
 
     @overload
     def __get__(

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 891 - 893
reflex/vars/sequence.py


+ 2 - 2
tests/units/components/core/test_match.py

@@ -1,4 +1,4 @@
-from typing import Mapping, Tuple
+from typing import Mapping, Sequence, Tuple
 
 import pytest
 
@@ -58,7 +58,7 @@ def test_match_components():
     assert second_return_value_render["children"][0]["contents"] == '{"second value"}'
 
     assert match_cases[2][0]._js_expr == "[1, 2]"
-    assert match_cases[2][0]._var_type == list[int]
+    assert match_cases[2][0]._var_type == Sequence[int]
     third_return_value_render = match_cases[2][1]
     assert third_return_value_render["name"] == "RadixThemesText"
     assert third_return_value_render["children"][0]["contents"] == '{"third value"}'

+ 2 - 2
tests/units/test_var.py

@@ -1,7 +1,7 @@
 import json
 import math
 import typing
-from typing import List, Mapping, cast
+from typing import List, Mapping, Sequence, cast
 
 import pytest
 from pandas import DataFrame
@@ -273,7 +273,7 @@ def test_get_setter(prop: Var, expected):
         (1, Var(_js_expr="1", _var_type=int)),
         ("key", Var(_js_expr='"key"', _var_type=str)),
         (3.14, Var(_js_expr="3.14", _var_type=float)),
-        ([1, 2, 3], Var(_js_expr="[1, 2, 3]", _var_type=list[int])),
+        ([1, 2, 3], Var(_js_expr="[1, 2, 3]", _var_type=Sequence[int])),
         (
             {"a": 1, "b": 2},
             Var(_js_expr='({ ["a"] : 1, ["b"] : 2 })', _var_type=Mapping[str, int]),

+ 3 - 3
tests/units/vars/test_base.py

@@ -1,4 +1,4 @@
-from typing import Mapping
+from typing import Mapping, Sequence
 
 import pytest
 
@@ -36,8 +36,8 @@ class ChildGenericDict(GenericDict):
         (1, int),
         (1.0, float),
         ("a", str),
-        ([1, 2, 3], list[int]),
-        ([1, 2.0, "a"], list[int | float | str]),
+        ([1, 2, 3], Sequence[int]),
+        ([1, 2.0, "a"], Sequence[int | float | str]),
         ({"a": 1, "b": 2}, Mapping[str, int]),
         ({"a": 1, 2: "b"}, Mapping[int | str, str | int]),
         (CustomDict(), CustomDict),

+ 4 - 3
tests/units/vars/test_object.py

@@ -1,4 +1,5 @@
 import dataclasses
+from typing import Sequence
 
 import pytest
 from sqlalchemy.orm import DeclarativeBase, Mapped, MappedAsDataclass, mapped_column
@@ -137,7 +138,7 @@ def test_typing() -> None:
     optional_var = ObjectState.base_optional
     _ = assert_type(optional_var, ObjectVar[Base | None])
     list_var = ObjectState.base_list
-    _ = assert_type(list_var, ArrayVar[list[Base]])
+    _ = assert_type(list_var, ArrayVar[Sequence[Base]])
     list_var_0 = list_var[0]
     _ = assert_type(list_var_0, ObjectVar[Base])
 
@@ -147,7 +148,7 @@ def test_typing() -> None:
     optional_var = ObjectState.sqlamodel_optional
     _ = assert_type(optional_var, ObjectVar[SqlaModel | None])
     list_var = ObjectState.base_list
-    _ = assert_type(list_var, ArrayVar[list[Base]])
+    _ = assert_type(list_var, ArrayVar[Sequence[Base]])
     list_var_0 = list_var[0]
     _ = assert_type(list_var_0, ObjectVar[Base])
 
@@ -157,6 +158,6 @@ def test_typing() -> None:
     optional_var = ObjectState.dataclass_optional
     _ = assert_type(optional_var, ObjectVar[Dataclass | None])
     list_var = ObjectState.base_list
-    _ = assert_type(list_var, ArrayVar[list[Base]])
+    _ = assert_type(list_var, ArrayVar[Sequence[Base]])
     list_var_0 = list_var[0]
     _ = assert_type(list_var_0, ObjectVar[Base])

برخی فایل ها در این مقایسه diff نمایش داده نمی شوند زیرا تعداد فایل ها بسیار زیاد است