reflex 0.4.2a1__py3-none-any.whl → 0.4.3a2__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 (60) hide show
  1. reflex/.templates/apps/blank/code/blank.py +1 -1
  2. reflex/.templates/apps/sidebar/README.md +3 -2
  3. reflex/.templates/apps/sidebar/assets/reflex_white.svg +8 -0
  4. reflex/.templates/apps/sidebar/code/components/sidebar.py +26 -22
  5. reflex/.templates/apps/sidebar/code/pages/dashboard.py +6 -5
  6. reflex/.templates/apps/sidebar/code/pages/settings.py +45 -6
  7. reflex/.templates/apps/sidebar/code/styles.py +15 -17
  8. reflex/.templates/apps/sidebar/code/templates/__init__.py +1 -1
  9. reflex/.templates/apps/sidebar/code/templates/template.py +54 -40
  10. reflex/.templates/jinja/custom_components/README.md.jinja2 +9 -0
  11. reflex/.templates/jinja/custom_components/__init__.py.jinja2 +1 -0
  12. reflex/.templates/jinja/custom_components/demo_app.py.jinja2 +36 -0
  13. reflex/.templates/jinja/custom_components/pyproject.toml.jinja2 +35 -0
  14. reflex/.templates/jinja/custom_components/src.py.jinja2 +57 -0
  15. reflex/.templates/jinja/web/utils/context.js.jinja2 +26 -6
  16. reflex/.templates/web/utils/state.js +206 -146
  17. reflex/app.py +21 -18
  18. reflex/compiler/compiler.py +6 -2
  19. reflex/compiler/templates.py +17 -0
  20. reflex/compiler/utils.py +2 -2
  21. reflex/components/core/__init__.py +2 -1
  22. reflex/components/core/banner.py +99 -11
  23. reflex/components/core/banner.pyi +215 -2
  24. reflex/components/el/elements/__init__.py +1 -0
  25. reflex/components/el/elements/forms.py +6 -0
  26. reflex/components/el/elements/forms.pyi +4 -0
  27. reflex/components/markdown/markdown.py +13 -25
  28. reflex/components/markdown/markdown.pyi +5 -5
  29. reflex/components/plotly/plotly.py +3 -0
  30. reflex/components/plotly/plotly.pyi +2 -0
  31. reflex/components/radix/primitives/drawer.py +3 -7
  32. reflex/components/radix/themes/components/select.py +4 -4
  33. reflex/components/radix/themes/components/text_field.pyi +4 -0
  34. reflex/constants/__init__.py +4 -0
  35. reflex/constants/colors.py +1 -0
  36. reflex/constants/compiler.py +4 -3
  37. reflex/constants/custom_components.py +30 -0
  38. reflex/custom_components/__init__.py +1 -0
  39. reflex/custom_components/custom_components.py +565 -0
  40. reflex/reflex.py +11 -2
  41. reflex/route.py +4 -0
  42. reflex/state.py +594 -124
  43. reflex/testing.py +6 -0
  44. reflex/utils/exec.py +9 -0
  45. reflex/utils/prerequisites.py +28 -2
  46. reflex/utils/telemetry.py +3 -1
  47. reflex/utils/types.py +23 -0
  48. reflex/vars.py +48 -17
  49. reflex/vars.pyi +8 -3
  50. {reflex-0.4.2a1.dist-info → reflex-0.4.3a2.dist-info}/METADATA +4 -2
  51. {reflex-0.4.2a1.dist-info → reflex-0.4.3a2.dist-info}/RECORD +55 -51
  52. {reflex-0.4.2a1.dist-info → reflex-0.4.3a2.dist-info}/WHEEL +1 -1
  53. reflex/components/base/bare.pyi +0 -84
  54. reflex/constants/base.pyi +0 -94
  55. reflex/constants/event.pyi +0 -59
  56. reflex/constants/route.pyi +0 -50
  57. reflex/constants/style.pyi +0 -20
  58. /reflex/.templates/apps/sidebar/assets/{icon.svg → reflex_black.svg} +0 -0
  59. {reflex-0.4.2a1.dist-info → reflex-0.4.3a2.dist-info}/LICENSE +0 -0
  60. {reflex-0.4.2a1.dist-info → reflex-0.4.3a2.dist-info}/entry_points.txt +0 -0
@@ -8,15 +8,15 @@ from hashlib import md5
8
8
  from typing import Any, Callable, Dict, Union
9
9
 
10
10
  from reflex.compiler import utils
11
- from reflex.components.chakra.datadisplay.list import (
11
+ from reflex.components.component import Component, CustomComponent
12
+ from reflex.components.radix.themes.layout.list import (
12
13
  ListItem,
13
14
  OrderedList,
14
15
  UnorderedList,
15
16
  )
16
- from reflex.components.chakra.navigation import Link
17
- from reflex.components.chakra.typography.heading import Heading
18
- from reflex.components.chakra.typography.text import Text
19
- from reflex.components.component import Component, CustomComponent
17
+ from reflex.components.radix.themes.typography.heading import Heading
18
+ from reflex.components.radix.themes.typography.link import Link
19
+ from reflex.components.radix.themes.typography.text import Text
20
20
  from reflex.components.tags.tag import Tag
21
21
  from reflex.style import Style
22
22
  from reflex.utils import console, imports, types
@@ -50,28 +50,16 @@ def get_base_component_map() -> dict[str, Callable]:
50
50
  Returns:
51
51
  The base component map.
52
52
  """
53
- from reflex.components.chakra.datadisplay.code import Code
54
53
  from reflex.components.datadisplay.code import CodeBlock
54
+ from reflex.components.radix.themes.typography.code import Code
55
55
 
56
56
  return {
57
- "h1": lambda value: Heading.create(
58
- value, as_="h1", size="2xl", margin_y="0.5em"
59
- ),
60
- "h2": lambda value: Heading.create(
61
- value, as_="h2", size="xl", margin_y="0.5em"
62
- ),
63
- "h3": lambda value: Heading.create(
64
- value, as_="h3", size="lg", margin_y="0.5em"
65
- ),
66
- "h4": lambda value: Heading.create(
67
- value, as_="h4", size="md", margin_y="0.5em"
68
- ),
69
- "h5": lambda value: Heading.create(
70
- value, as_="h5", size="sm", margin_y="0.5em"
71
- ),
72
- "h6": lambda value: Heading.create(
73
- value, as_="h6", size="xs", margin_y="0.5em"
74
- ),
57
+ "h1": lambda value: Heading.create(value, as_="h1", size="6", margin_y="0.5em"),
58
+ "h2": lambda value: Heading.create(value, as_="h2", size="5", margin_y="0.5em"),
59
+ "h3": lambda value: Heading.create(value, as_="h3", size="4", margin_y="0.5em"),
60
+ "h4": lambda value: Heading.create(value, as_="h4", size="3", margin_y="0.5em"),
61
+ "h5": lambda value: Heading.create(value, as_="h5", size="2", margin_y="0.5em"),
62
+ "h6": lambda value: Heading.create(value, as_="h6", size="1", margin_y="0.5em"),
75
63
  "p": lambda value: Text.create(value, margin_y="1em"),
76
64
  "ul": lambda value: UnorderedList.create(value, margin_y="1em"), # type: ignore
77
65
  "ol": lambda value: OrderedList.create(value, margin_y="1em"), # type: ignore
@@ -165,8 +153,8 @@ class Markdown(Component):
165
153
 
166
154
  def _get_imports(self) -> imports.ImportDict:
167
155
  # Import here to avoid circular imports.
168
- from reflex.components.chakra.datadisplay.code import Code
169
156
  from reflex.components.datadisplay.code import CodeBlock
157
+ from reflex.components.radix.themes.typography.code import Code
170
158
 
171
159
  imports = super()._get_imports()
172
160
 
@@ -12,15 +12,15 @@ from functools import lru_cache
12
12
  from hashlib import md5
13
13
  from typing import Any, Callable, Dict, Union
14
14
  from reflex.compiler import utils
15
- from reflex.components.chakra.datadisplay.list import (
15
+ from reflex.components.component import Component, CustomComponent
16
+ from reflex.components.radix.themes.layout.list import (
16
17
  ListItem,
17
18
  OrderedList,
18
19
  UnorderedList,
19
20
  )
20
- from reflex.components.chakra.navigation import Link
21
- from reflex.components.chakra.typography.heading import Heading
22
- from reflex.components.chakra.typography.text import Text
23
- from reflex.components.component import Component, CustomComponent
21
+ from reflex.components.radix.themes.typography.heading import Heading
22
+ from reflex.components.radix.themes.typography.link import Link
23
+ from reflex.components.radix.themes.typography.text import Text
24
24
  from reflex.components.tags.tag import Tag
25
25
  from reflex.style import Style
26
26
  from reflex.utils import console, imports, types
@@ -32,6 +32,9 @@ class Plotly(PlotlyLib):
32
32
  # The layout of the graph.
33
33
  layout: Var[Dict]
34
34
 
35
+ # The config of the graph.
36
+ config: Var[Dict]
37
+
35
38
  # The width of the graph.
36
39
  width: Var[str]
37
40
 
@@ -103,6 +103,7 @@ class Plotly(PlotlyLib):
103
103
  *children,
104
104
  data: Optional[Union[Var[Figure], Figure]] = None, # type: ignore
105
105
  layout: Optional[Union[Var[Dict], Dict]] = None,
106
+ config: Optional[Union[Var[Dict], Dict]] = None,
106
107
  width: Optional[Union[Var[str], str]] = None,
107
108
  height: Optional[Union[Var[str], str]] = None,
108
109
  use_resize_handler: Optional[Union[Var[bool], bool]] = None,
@@ -165,6 +166,7 @@ class Plotly(PlotlyLib):
165
166
  *children: The children of the component.
166
167
  data: The figure to display. This can be a plotly figure or a plotly data json.
167
168
  layout: The layout of the graph.
169
+ config: The config of the graph.
168
170
  width: The width of the graph.
169
171
  height: The height of the graph.
170
172
  use_resize_handler: If true, the graph will resize when the window is resized.
@@ -1,4 +1,5 @@
1
1
  """Drawer components based on Radix primitives."""
2
+
2
3
  # Based on Vaul: https://github.com/emilkowalski/vaul
3
4
  # Style based on https://ui.shadcn.com/docs/components/drawer
4
5
  from __future__ import annotations
@@ -20,12 +21,7 @@ class DrawerComponent(RadixPrimitiveComponent):
20
21
  lib_dependencies: List[str] = ["@radix-ui/react-dialog@^1.0.5"]
21
22
 
22
23
 
23
- LiteralDirectionType = Literal[
24
- "top",
25
- "bottom",
26
- "left",
27
- "right",
28
- ]
24
+ LiteralDirectionType = Literal["top", "bottom", "left", "right"]
29
25
 
30
26
 
31
27
  class DrawerRoot(DrawerComponent):
@@ -70,7 +66,7 @@ class DrawerRoot(DrawerComponent):
70
66
  """
71
67
  return {
72
68
  **super().get_event_triggers(),
73
- EventTriggers.ON_OPEN_CHANGE: lambda e0: [e0.target.value],
69
+ EventTriggers.ON_OPEN_CHANGE: lambda e0: [e0],
74
70
  }
75
71
 
76
72
 
@@ -205,11 +205,11 @@ class HighLevelSelect(SelectRoot):
205
205
  if prop in props
206
206
  }
207
207
 
208
- color = props.pop("color", None)
208
+ color_scheme = props.pop("color_scheme", None)
209
209
 
210
- if color is not None:
211
- content_props["color_scheme"] = color
212
- trigger_props["color_scheme"] = color
210
+ if color_scheme is not None:
211
+ content_props["color_scheme"] = color_scheme
212
+ trigger_props["color_scheme"] = color_scheme
213
213
 
214
214
  label = props.pop("label", None)
215
215
 
@@ -256,6 +256,8 @@ class TextFieldInput(el.Input, TextFieldRoot):
256
256
  checked: Optional[
257
257
  Union[Var[Union[str, int, bool]], Union[str, int, bool]]
258
258
  ] = None,
259
+ default_checked: Optional[Union[Var[bool], bool]] = None,
260
+ default_value: Optional[Union[Var[str], str]] = None,
259
261
  dirname: Optional[
260
262
  Union[Var[Union[str, int, bool]], Union[str, int, bool]]
261
263
  ] = None,
@@ -499,6 +501,8 @@ class TextFieldInput(el.Input, TextFieldRoot):
499
501
  auto_focus: Automatically focuses the input when the page loads
500
502
  capture: Captures media from the user (camera or microphone)
501
503
  checked: Indicates whether the input is checked (for checkboxes and radio buttons)
504
+ default_checked: The initial value (for checkboxes and radio buttons)
505
+ default_value: The initial value for a text field
502
506
  dirname: Name part of the input to submit in 'dir' and 'name' pair when form is submitted
503
507
  disabled: Disables the input
504
508
  form: Associates the input with a form (by id)
@@ -40,6 +40,9 @@ from .config import (
40
40
  GitIgnore,
41
41
  RequirementsTxt,
42
42
  )
43
+ from .custom_components import (
44
+ CustomComponents,
45
+ )
43
46
  from .event import Endpoint, EventTriggers, SocketEvent
44
47
  from .installer import (
45
48
  Bun,
@@ -67,6 +70,7 @@ __ALL__ = [
67
70
  Config,
68
71
  COOKIES,
69
72
  ComponentName,
73
+ CustomComponents,
70
74
  DefaultPage,
71
75
  Dirs,
72
76
  Endpoint,
@@ -36,6 +36,7 @@ ColorType = Literal[
36
36
  "gold",
37
37
  "bronze",
38
38
  "gray",
39
+ "accent",
39
40
  ]
40
41
 
41
42
  ShadeType = Literal[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
@@ -1,4 +1,5 @@
1
1
  """Compiler variables."""
2
+
2
3
  import enum
3
4
  from enum import Enum
4
5
  from types import SimpleNamespace
@@ -55,13 +56,13 @@ class CompileVars(SimpleNamespace):
55
56
  # The name of the function to add events to the queue.
56
57
  ADD_EVENTS = "addEvents"
57
58
  # The name of the var storing any connection error.
58
- CONNECT_ERROR = "connectError"
59
+ CONNECT_ERROR = "connectErrors"
59
60
  # The name of the function for converting a dict to an event.
60
61
  TO_EVENT = "Event"
61
62
  # The name of the internal on_load event.
62
- ON_LOAD_INTERNAL = "on_load_internal"
63
+ ON_LOAD_INTERNAL = "on_load_internal_state.on_load_internal"
63
64
  # The name of the internal event to update generic state vars.
64
- UPDATE_VARS_INTERNAL = "update_vars_internal"
65
+ UPDATE_VARS_INTERNAL = "update_vars_internal_state.update_vars_internal"
65
66
 
66
67
 
67
68
  class PageNames(SimpleNamespace):
@@ -0,0 +1,30 @@
1
+ """Constants for the custom components."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from types import SimpleNamespace
6
+
7
+
8
+ class CustomComponents(SimpleNamespace):
9
+ """Constants for the custom components."""
10
+
11
+ # The name of the custom components source directory.
12
+ SRC_DIR = "custom_components"
13
+ # The name of the custom components pyproject.toml file.
14
+ PYPROJECT_TOML = "pyproject.toml"
15
+ # The name of the custom components package README file.
16
+ PACKAGE_README = "README.md"
17
+ # The name of the custom components package .gitignore file.
18
+ PACKAGE_GITIGNORE = ".gitignore"
19
+ # The name of the distribution directory as result of a build.
20
+ DIST_DIR = "dist"
21
+ # The name of the init file.
22
+ INIT_FILE = "__init__.py"
23
+ # Suffixes for the distribution files.
24
+ DISTRIBUTION_FILE_SUFFIXES = [".tar.gz", ".whl"]
25
+ # The name to the URL of python package repositories.
26
+ REPO_URLS = {
27
+ # Note: the trailing slash is required for below URLs.
28
+ "pypi": "https://upload.pypi.org/legacy/",
29
+ "testpypi": "https://test.pypi.org/legacy/",
30
+ }
@@ -0,0 +1 @@
1
+ """The Reflex custom components."""