reflex 0.5.1a3__py3-none-any.whl → 0.5.2a1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of reflex might be problematic. Click here for more details.

Files changed (34) hide show
  1. reflex/app.py +47 -2
  2. reflex/components/datadisplay/code.py +1 -1
  3. reflex/components/datadisplay/code.pyi +1 -1
  4. reflex/components/radix/primitives/accordion.py +74 -80
  5. reflex/components/radix/primitives/accordion.pyi +5 -5
  6. reflex/components/radix/primitives/form.py +8 -9
  7. reflex/components/radix/primitives/form.pyi +4 -5
  8. reflex/components/radix/primitives/progress.py +22 -27
  9. reflex/components/radix/primitives/progress.pyi +3 -4
  10. reflex/components/radix/primitives/slider.py +47 -56
  11. reflex/components/radix/primitives/slider.pyi +4 -5
  12. reflex/components/radix/themes/components/tabs.py +46 -0
  13. reflex/components/radix/themes/components/tabs.pyi +7 -0
  14. reflex/components/radix/themes/layout/center.py +7 -9
  15. reflex/components/radix/themes/layout/center.pyi +2 -2
  16. reflex/components/radix/themes/layout/list.py +6 -9
  17. reflex/components/radix/themes/layout/list.pyi +2 -3
  18. reflex/components/radix/themes/layout/spacer.py +7 -9
  19. reflex/components/radix/themes/layout/spacer.pyi +2 -2
  20. reflex/config.py +3 -0
  21. reflex/config.pyi +2 -0
  22. reflex/custom_components/custom_components.py +39 -14
  23. reflex/event.py +2 -1
  24. reflex/experimental/layout.py +3 -1
  25. reflex/state.py +5 -5
  26. reflex/style.py +2 -0
  27. reflex/testing.py +2 -0
  28. reflex/utils/exec.py +5 -1
  29. reflex/vars.py +22 -9
  30. {reflex-0.5.1a3.dist-info → reflex-0.5.2a1.dist-info}/METADATA +10 -9
  31. {reflex-0.5.1a3.dist-info → reflex-0.5.2a1.dist-info}/RECORD +34 -34
  32. {reflex-0.5.1a3.dist-info → reflex-0.5.2a1.dist-info}/LICENSE +0 -0
  33. {reflex-0.5.1a3.dist-info → reflex-0.5.2a1.dist-info}/WHEEL +0 -0
  34. {reflex-0.5.1a3.dist-info → reflex-0.5.2a1.dist-info}/entry_points.txt +0 -0
@@ -6,7 +6,6 @@ from typing import Any, Dict, List, Literal
6
6
 
7
7
  from reflex.components.component import Component, ComponentNamespace
8
8
  from reflex.components.radix.primitives.base import RadixPrimitiveComponentWithClassName
9
- from reflex.style import Style
10
9
  from reflex.vars import Var
11
10
 
12
11
  LiteralSliderOrientation = Literal["horizontal", "vertical"]
@@ -59,28 +58,26 @@ class SliderRoot(SliderComponent):
59
58
  "on_value_commit": lambda e0: [e0], # trigger when thumb is released
60
59
  }
61
60
 
62
- def add_style(self) -> Style | None:
61
+ def add_style(self) -> dict[str, Any] | None:
63
62
  """Add style to the component.
64
63
 
65
64
  Returns:
66
65
  The style of the component.
67
66
  """
68
- return Style(
69
- {
70
- "position": "relative",
71
- "display": "flex",
72
- "align_items": "center",
73
- "user_select": "none",
74
- "touch_action": "none",
75
- "width": "200px",
76
- "height": "20px",
77
- "&[data-orientation='vertical']": {
78
- "flex_direction": "column",
79
- "width": "20px",
80
- "height": "100px",
81
- },
82
- }
83
- )
67
+ return {
68
+ "position": "relative",
69
+ "display": "flex",
70
+ "align_items": "center",
71
+ "user_select": "none",
72
+ "touch_action": "none",
73
+ "width": "200px",
74
+ "height": "20px",
75
+ "&[data-orientation='vertical']": {
76
+ "flex_direction": "column",
77
+ "width": "20px",
78
+ "height": "100px",
79
+ },
80
+ }
84
81
 
85
82
 
86
83
  class SliderTrack(SliderComponent):
@@ -89,22 +86,20 @@ class SliderTrack(SliderComponent):
89
86
  tag = "Track"
90
87
  alias = "RadixSliderTrack"
91
88
 
92
- def add_style(self) -> Style | None:
89
+ def add_style(self) -> dict[str, Any] | None:
93
90
  """Add style to the component.
94
91
 
95
92
  Returns:
96
93
  The style of the component.
97
94
  """
98
- return Style(
99
- {
100
- "position": "relative",
101
- "flex_grow": "1",
102
- "background_color": "black",
103
- "border_radius": "9999px",
104
- "height": "3px",
105
- "&[data-orientation='vertical']": {"width": "3px"},
106
- }
107
- )
95
+ return {
96
+ "position": "relative",
97
+ "flex_grow": "1",
98
+ "background_color": "black",
99
+ "border_radius": "9999px",
100
+ "height": "3px",
101
+ "&[data-orientation='vertical']": {"width": "3px"},
102
+ }
108
103
 
109
104
 
110
105
  class SliderRange(SliderComponent):
@@ -113,20 +108,18 @@ class SliderRange(SliderComponent):
113
108
  tag = "Range"
114
109
  alias = "RadixSliderRange"
115
110
 
116
- def add_style(self) -> Style | None:
111
+ def add_style(self) -> dict[str, Any] | None:
117
112
  """Add style to the component.
118
113
 
119
114
  Returns:
120
115
  The style of the component.
121
116
  """
122
- return Style(
123
- {
124
- "position": "absolute",
125
- "background_color": "white",
126
- "height": "100%",
127
- "&[data-orientation='vertical']": {"width": "100%"},
128
- }
129
- )
117
+ return {
118
+ "position": "absolute",
119
+ "background_color": "white",
120
+ "height": "100%",
121
+ "&[data-orientation='vertical']": {"width": "100%"},
122
+ }
130
123
 
131
124
 
132
125
  class SliderThumb(SliderComponent):
@@ -135,29 +128,27 @@ class SliderThumb(SliderComponent):
135
128
  tag = "Thumb"
136
129
  alias = "RadixSliderThumb"
137
130
 
138
- def add_style(self) -> Style | None:
131
+ def add_style(self) -> dict[str, Any] | None:
139
132
  """Add style to the component.
140
133
 
141
134
  Returns:
142
135
  The style of the component.
143
136
  """
144
- return Style(
145
- {
146
- "display": "block",
147
- "width": "20px",
148
- "height": "20px",
149
- "background_color": "black",
150
- "box_shadow": "0 2px 10px black",
151
- "border_radius": "10px",
152
- "&:hover": {
153
- "background_color": "gray",
154
- },
155
- "&:focus": {
156
- "outline": "none",
157
- "box_shadow": "0 0 0 4px gray",
158
- },
159
- }
160
- )
137
+ return {
138
+ "display": "block",
139
+ "width": "20px",
140
+ "height": "20px",
141
+ "background_color": "black",
142
+ "box_shadow": "0 2px 10px black",
143
+ "border_radius": "10px",
144
+ "&:hover": {
145
+ "background_color": "gray",
146
+ },
147
+ "&:focus": {
148
+ "outline": "none",
149
+ "box_shadow": "0 0 0 4px gray",
150
+ },
151
+ }
161
152
 
162
153
 
163
154
  class Slider(ComponentNamespace):
@@ -10,7 +10,6 @@ from reflex.style import Style
10
10
  from typing import Any, Dict, List, Literal
11
11
  from reflex.components.component import Component, ComponentNamespace
12
12
  from reflex.components.radix.primitives.base import RadixPrimitiveComponentWithClassName
13
- from reflex.style import Style
14
13
  from reflex.vars import Var
15
14
 
16
15
  LiteralSliderOrientation = Literal["horizontal", "vertical"]
@@ -96,7 +95,7 @@ class SliderComponent(RadixPrimitiveComponentWithClassName):
96
95
 
97
96
  class SliderRoot(SliderComponent):
98
97
  def get_event_triggers(self) -> Dict[str, Any]: ...
99
- def add_style(self) -> Style | None: ...
98
+ def add_style(self) -> dict[str, Any] | None: ...
100
99
  @overload
101
100
  @classmethod
102
101
  def create( # type: ignore
@@ -197,7 +196,7 @@ class SliderRoot(SliderComponent):
197
196
  ...
198
197
 
199
198
  class SliderTrack(SliderComponent):
200
- def add_style(self) -> Style | None: ...
199
+ def add_style(self) -> dict[str, Any] | None: ...
201
200
  @overload
202
201
  @classmethod
203
202
  def create( # type: ignore
@@ -276,7 +275,7 @@ class SliderTrack(SliderComponent):
276
275
  ...
277
276
 
278
277
  class SliderRange(SliderComponent):
279
- def add_style(self) -> Style | None: ...
278
+ def add_style(self) -> dict[str, Any] | None: ...
280
279
  @overload
281
280
  @classmethod
282
281
  def create( # type: ignore
@@ -355,7 +354,7 @@ class SliderRange(SliderComponent):
355
354
  ...
356
355
 
357
356
  class SliderThumb(SliderComponent):
358
- def add_style(self) -> Style | None: ...
357
+ def add_style(self) -> dict[str, Any] | None: ...
359
358
  @overload
360
359
  @classmethod
361
360
  def create( # type: ignore
@@ -4,6 +4,7 @@ from __future__ import annotations
4
4
  from typing import Any, Dict, List, Literal
5
5
 
6
6
  from reflex.components.component import Component, ComponentNamespace
7
+ from reflex.components.core.colors import color
7
8
  from reflex.constants import EventTriggers
8
9
  from reflex.vars import Var
9
10
 
@@ -12,6 +13,8 @@ from ..base import (
12
13
  RadixThemesComponent,
13
14
  )
14
15
 
16
+ vertical_orientation_css = "&[data-orientation='vertical']"
17
+
15
18
 
16
19
  class TabsRoot(RadixThemesComponent):
17
20
  """Set of content sections to be displayed one at a time."""
@@ -41,6 +44,18 @@ class TabsRoot(RadixThemesComponent):
41
44
  EventTriggers.ON_CHANGE: lambda e0: [e0],
42
45
  }
43
46
 
47
+ def add_style(self) -> Dict[str, Any] | None:
48
+ """Add style for the component.
49
+
50
+ Returns:
51
+ The style to add.
52
+ """
53
+ return {
54
+ vertical_orientation_css: {
55
+ "display": "flex",
56
+ }
57
+ }
58
+
44
59
 
45
60
  class TabsList(RadixThemesComponent):
46
61
  """Contains the triggers that sit alongside the active content."""
@@ -50,6 +65,19 @@ class TabsList(RadixThemesComponent):
50
65
  # Tabs size "1" - "2"
51
66
  size: Var[Literal["1", "2"]]
52
67
 
68
+ def add_style(self):
69
+ """Add style for the component.
70
+
71
+ Returns:
72
+ The style to add.
73
+ """
74
+ return {
75
+ vertical_orientation_css: {
76
+ "display": "block",
77
+ "box_shadow": f"inset -1px 0 0 0 {color('gray', 5, alpha=True)}",
78
+ },
79
+ }
80
+
53
81
 
54
82
  class TabsTrigger(RadixThemesComponent):
55
83
  """The button that activates its associated content."""
@@ -86,6 +114,14 @@ class TabsTrigger(RadixThemesComponent):
86
114
  def _exclude_props(self) -> list[str]:
87
115
  return ["color_scheme"]
88
116
 
117
+ def add_style(self) -> Dict[str, Any] | None:
118
+ """Add style for the component.
119
+
120
+ Returns:
121
+ The style to add.
122
+ """
123
+ return {vertical_orientation_css: {"width": "100%"}}
124
+
89
125
 
90
126
  class TabsContent(RadixThemesComponent):
91
127
  """Contains the content associated with each trigger."""
@@ -95,6 +131,16 @@ class TabsContent(RadixThemesComponent):
95
131
  # The value of the tab. Must be unique for each tab.
96
132
  value: Var[str]
97
133
 
134
+ def add_style(self) -> dict[str, Any] | None:
135
+ """Add style for the component.
136
+
137
+ Returns:
138
+ The style to add.
139
+ """
140
+ return {
141
+ vertical_orientation_css: {"width": "100%", "margin": None},
142
+ }
143
+
98
144
 
99
145
  class Tabs(ComponentNamespace):
100
146
  """Set of content sections to be displayed one at a time."""
@@ -9,12 +9,16 @@ from reflex.event import EventChain, EventHandler, EventSpec
9
9
  from reflex.style import Style
10
10
  from typing import Any, Dict, List, Literal
11
11
  from reflex.components.component import Component, ComponentNamespace
12
+ from reflex.components.core.colors import color
12
13
  from reflex.constants import EventTriggers
13
14
  from reflex.vars import Var
14
15
  from ..base import LiteralAccentColor, RadixThemesComponent
15
16
 
17
+ vertical_orientation_css = "&[data-orientation='vertical']"
18
+
16
19
  class TabsRoot(RadixThemesComponent):
17
20
  def get_event_triggers(self) -> Dict[str, Any]: ...
21
+ def add_style(self) -> Dict[str, Any] | None: ...
18
22
  @overload
19
23
  @classmethod
20
24
  def create( # type: ignore
@@ -108,6 +112,7 @@ class TabsRoot(RadixThemesComponent):
108
112
  ...
109
113
 
110
114
  class TabsList(RadixThemesComponent):
115
+ def add_style(self): ...
111
116
  @overload
112
117
  @classmethod
113
118
  def create( # type: ignore
@@ -330,8 +335,10 @@ class TabsTrigger(RadixThemesComponent):
330
335
  The TabsTrigger Component.
331
336
  """
332
337
  ...
338
+ def add_style(self) -> Dict[str, Any] | None: ...
333
339
 
334
340
  class TabsContent(RadixThemesComponent):
341
+ def add_style(self) -> dict[str, Any] | None: ...
335
342
  @overload
336
343
  @classmethod
337
344
  def create( # type: ignore
@@ -2,7 +2,7 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
- from reflex.style import Style
5
+ from typing import Any
6
6
 
7
7
  from .flex import Flex
8
8
 
@@ -10,16 +10,14 @@ from .flex import Flex
10
10
  class Center(Flex):
11
11
  """A center component."""
12
12
 
13
- def add_style(self) -> Style | None:
13
+ def add_style(self) -> dict[str, Any] | None:
14
14
  """Add style that center the content.
15
15
 
16
16
  Returns:
17
17
  The style of the component.
18
18
  """
19
- return Style(
20
- {
21
- "display": "flex",
22
- "align_items": "center",
23
- "justify_content": "center",
24
- }
25
- )
19
+ return {
20
+ "display": "flex",
21
+ "align_items": "center",
22
+ "justify_content": "center",
23
+ }
@@ -7,11 +7,11 @@ from typing import Any, Dict, Literal, Optional, Union, overload
7
7
  from reflex.vars import Var, BaseVar, ComputedVar
8
8
  from reflex.event import EventChain, EventHandler, EventSpec
9
9
  from reflex.style import Style
10
- from reflex.style import Style
10
+ from typing import Any
11
11
  from .flex import Flex
12
12
 
13
13
  class Center(Flex):
14
- def add_style(self) -> Style | None: ...
14
+ def add_style(self) -> dict[str, Any] | None: ...
15
15
  @overload
16
16
  @classmethod
17
17
  def create( # type: ignore
@@ -1,14 +1,13 @@
1
1
  """List components."""
2
2
  from __future__ import annotations
3
3
 
4
- from typing import Iterable, Literal, Optional, Union
4
+ from typing import Any, Iterable, Literal, Optional, Union
5
5
 
6
6
  from reflex.components.component import Component, ComponentNamespace
7
7
  from reflex.components.core.foreach import Foreach
8
8
  from reflex.components.el.elements.typography import Li, Ol, Ul
9
9
  from reflex.components.lucide.icon import Icon
10
10
  from reflex.components.radix.themes.typography.text import Text
11
- from reflex.style import Style
12
11
  from reflex.vars import Var
13
12
 
14
13
  LiteralListStyleTypeUnordered = Literal[
@@ -78,18 +77,16 @@ class BaseList(Component):
78
77
  style["gap"] = props["gap"]
79
78
  return super().create(*children, **props)
80
79
 
81
- def add_style(self) -> Style | None:
80
+ def add_style(self) -> dict[str, Any] | None:
82
81
  """Add style to the component.
83
82
 
84
83
  Returns:
85
84
  The style of the component.
86
85
  """
87
- return Style(
88
- {
89
- "direction": "column",
90
- "list_style_position": "inside",
91
- }
92
- )
86
+ return {
87
+ "direction": "column",
88
+ "list_style_position": "inside",
89
+ }
93
90
 
94
91
 
95
92
  class UnorderedList(BaseList, Ul):
@@ -7,13 +7,12 @@ from typing import Any, Dict, Literal, Optional, Union, overload
7
7
  from reflex.vars import Var, BaseVar, ComputedVar
8
8
  from reflex.event import EventChain, EventHandler, EventSpec
9
9
  from reflex.style import Style
10
- from typing import Iterable, Literal, Optional, Union
10
+ from typing import Any, Iterable, Literal, Optional, Union
11
11
  from reflex.components.component import Component, ComponentNamespace
12
12
  from reflex.components.core.foreach import Foreach
13
13
  from reflex.components.el.elements.typography import Li, Ol, Ul
14
14
  from reflex.components.lucide.icon import Icon
15
15
  from reflex.components.radix.themes.typography.text import Text
16
- from reflex.style import Style
17
16
  from reflex.vars import Var
18
17
 
19
18
  LiteralListStyleTypeUnordered = Literal["none", "disc", "circle", "square"]
@@ -157,7 +156,7 @@ class BaseList(Component):
157
156
 
158
157
  """
159
158
  ...
160
- def add_style(self) -> Style | None: ...
159
+ def add_style(self) -> dict[str, Any] | None: ...
161
160
 
162
161
  class UnorderedList(BaseList, Ul):
163
162
  @overload
@@ -2,7 +2,7 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
- from reflex.style import Style
5
+ from typing import Any
6
6
 
7
7
  from .flex import Flex
8
8
 
@@ -10,16 +10,14 @@ from .flex import Flex
10
10
  class Spacer(Flex):
11
11
  """A spacer component."""
12
12
 
13
- def add_style(self) -> Style | None:
13
+ def add_style(self) -> dict[str, Any] | None:
14
14
  """Add style to the component.
15
15
 
16
16
  Returns:
17
17
  The style of the component.
18
18
  """
19
- return Style(
20
- {
21
- "flex": 1,
22
- "justify_self": "stretch",
23
- "align_self": "stretch",
24
- }
25
- )
19
+ return {
20
+ "flex": 1,
21
+ "justify_self": "stretch",
22
+ "align_self": "stretch",
23
+ }
@@ -7,11 +7,11 @@ from typing import Any, Dict, Literal, Optional, Union, overload
7
7
  from reflex.vars import Var, BaseVar, ComputedVar
8
8
  from reflex.event import EventChain, EventHandler, EventSpec
9
9
  from reflex.style import Style
10
- from reflex.style import Style
10
+ from typing import Any
11
11
  from .flex import Flex
12
12
 
13
13
  class Spacer(Flex):
14
- def add_style(self) -> Style | None: ...
14
+ def add_style(self) -> dict[str, Any] | None: ...
15
15
  @overload
16
16
  @classmethod
17
17
  def create( # type: ignore
reflex/config.py CHANGED
@@ -213,6 +213,9 @@ class Config(Base):
213
213
  # The worker class used in production mode
214
214
  gunicorn_worker_class: str = "uvicorn.workers.UvicornH11Worker"
215
215
 
216
+ # Number of gunicorn workers from user
217
+ gunicorn_workers: Optional[int] = None
218
+
216
219
  # Attributes that were explicitly set by the user.
217
220
  _non_default_attributes: Set[str] = pydantic.PrivateAttr(set())
218
221
 
reflex/config.pyi CHANGED
@@ -70,6 +70,7 @@ class Config(Base):
70
70
  cp_web_url: str
71
71
  username: Optional[str]
72
72
  gunicorn_worker_class: str
73
+ gunicorn_workers: Optional[int]
73
74
 
74
75
  def __init__(
75
76
  self,
@@ -97,6 +98,7 @@ class Config(Base):
97
98
  cp_web_url: Optional[str] = None,
98
99
  username: Optional[str] = None,
99
100
  gunicorn_worker_class: Optional[str] = None,
101
+ gunicorn_workers: Optional[int] = None,
100
102
  **kwargs
101
103
  ) -> None: ...
102
104
  @property
@@ -616,15 +616,17 @@ def publish(
616
616
  help="The API token to use for authentication on python package repository. If token is provided, no username/password should be provided at the same time",
617
617
  ),
618
618
  username: Optional[str] = typer.Option(
619
- None,
619
+ os.getenv("TWINE_USERNAME"),
620
620
  "-u",
621
621
  "--username",
622
+ show_default="TWINE_USERNAME environment variable value if set",
622
623
  help="The username to use for authentication on python package repository. Username and password must both be provided.",
623
624
  ),
624
625
  password: Optional[str] = typer.Option(
625
- None,
626
+ os.getenv("TWINE_PASSWORD"),
626
627
  "-p",
627
628
  "--password",
629
+ show_default="TWINE_PASSWORD environment variable value if set",
628
630
  help="The password to use for authentication on python package repository. Username and password must both be provided.",
629
631
  ),
630
632
  build: bool = typer.Option(
@@ -667,6 +669,9 @@ def publish(
667
669
  # Validate the credentials.
668
670
  username, password = _validate_credentials(username, password, token)
669
671
 
672
+ # Minimal Validation of the pyproject.toml.
673
+ _min_validate_project_info()
674
+
670
675
  # Get the version to publish from the pyproject.toml.
671
676
  version_to_publish = _get_version_to_publish()
672
677
 
@@ -735,25 +740,45 @@ def _process_entered_list(input: str | None) -> list | None:
735
740
  return [t.strip() for t in (input or "").split(",") if t if input] or None
736
741
 
737
742
 
738
- def _validate_project_info():
739
- """Validate the project information in the pyproject.toml file.
743
+ def _min_validate_project_info():
744
+ """Ensures minimal project information in the pyproject.toml file.
740
745
 
741
746
  Raises:
742
747
  Exit: If the pyproject.toml file is ill-formed.
743
748
  """
744
749
  pyproject_toml = _get_package_config()
745
750
 
746
- try:
747
- project = pyproject_toml.get("project", {})
748
- if not project:
749
- console.error("The project section not found in pyproject.toml")
750
- raise typer.Exit(code=1)
751
- console.print(
752
- f'Double check the information before publishing: {project["name"]} version {project["version"]}'
751
+ project = pyproject_toml.get("project")
752
+ if project is None:
753
+ console.error(
754
+ f"The project section is not found in {CustomComponents.PYPROJECT_TOML}"
753
755
  )
754
- except KeyError as ke:
755
- console.error(f"The pyproject.toml is possibly ill-formed due to {ke}")
756
- raise typer.Exit(code=1) from ke
756
+ raise typer.Exit(code=1)
757
+
758
+ if not project.get("name"):
759
+ console.error(
760
+ f"The project name is not found in {CustomComponents.PYPROJECT_TOML}"
761
+ )
762
+ raise typer.Exit(code=1)
763
+
764
+ if not project.get("version"):
765
+ console.error(
766
+ f"The project version is not found in {CustomComponents.PYPROJECT_TOML}"
767
+ )
768
+ raise typer.Exit(code=1)
769
+
770
+
771
+ def _validate_project_info():
772
+ """Validate the project information in the pyproject.toml file.
773
+
774
+ Raises:
775
+ Exit: If the pyproject.toml file is ill-formed.
776
+ """
777
+ pyproject_toml = _get_package_config()
778
+ project = pyproject_toml["project"]
779
+ console.print(
780
+ f'Double check the information before publishing: {project["name"]} version {project["version"]}'
781
+ )
757
782
 
758
783
  console.print("Update or enter to keep the current information.")
759
784
  project["description"] = console.ask(
reflex/event.py CHANGED
@@ -3,6 +3,7 @@
3
3
  from __future__ import annotations
4
4
 
5
5
  import inspect
6
+ import urllib.parse
6
7
  from base64 import b64encode
7
8
  from typing import (
8
9
  Any,
@@ -665,7 +666,7 @@ def download(
665
666
 
666
667
  if isinstance(data, str):
667
668
  # Caller provided a plain text string to download.
668
- url = "data:text/plain," + data
669
+ url = "data:text/plain," + urllib.parse.quote(data)
669
670
  elif isinstance(data, Var):
670
671
  # Need to check on the frontend if the Var already looks like a data: URI.
671
672
  is_data_url = data._replace(
@@ -2,6 +2,8 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
+ from typing import Any
6
+
5
7
  from reflex import color, cond
6
8
  from reflex.components.base.fragment import Fragment
7
9
  from reflex.components.component import Component, ComponentNamespace, MemoizationLeaf
@@ -40,7 +42,7 @@ class Sidebar(Box, MemoizationLeaf):
40
42
  Box.create(width=props.get("width")), # spacer for layout
41
43
  )
42
44
 
43
- def add_style(self) -> Style | None:
45
+ def add_style(self) -> dict[str, Any] | None:
44
46
  """Add style to the component.
45
47
 
46
48
  Returns: