reflex 0.6.8a1__py3-none-any.whl → 0.7.0a1__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 (155) hide show
  1. reflex/.templates/jinja/custom_components/pyproject.toml.jinja2 +1 -1
  2. reflex/.templates/jinja/web/pages/_app.js.jinja2 +7 -7
  3. reflex/.templates/jinja/web/pages/utils.js.jinja2 +2 -2
  4. reflex/.templates/web/components/reflex/radix_themes_color_mode_provider.js +1 -4
  5. reflex/.templates/web/utils/state.js +65 -36
  6. reflex/__init__.py +4 -17
  7. reflex/__init__.pyi +1 -2
  8. reflex/app.py +244 -115
  9. reflex/app_mixins/lifespan.py +9 -9
  10. reflex/app_mixins/middleware.py +6 -6
  11. reflex/app_module_for_backend.py +3 -7
  12. reflex/base.py +7 -7
  13. reflex/compiler/compiler.py +8 -0
  14. reflex/compiler/utils.py +35 -6
  15. reflex/components/base/bare.py +1 -1
  16. reflex/components/base/error_boundary.py +2 -1
  17. reflex/components/base/error_boundary.pyi +2 -1
  18. reflex/components/base/meta.py +2 -2
  19. reflex/components/base/strict_mode.py +10 -0
  20. reflex/components/base/strict_mode.pyi +57 -0
  21. reflex/components/component.py +38 -77
  22. reflex/components/core/banner.py +83 -4
  23. reflex/components/core/banner.pyi +86 -0
  24. reflex/components/core/breakpoints.py +3 -1
  25. reflex/components/core/client_side_routing.py +1 -1
  26. reflex/components/core/client_side_routing.pyi +1 -1
  27. reflex/components/core/cond.py +9 -10
  28. reflex/components/core/debounce.py +1 -1
  29. reflex/components/core/foreach.py +23 -3
  30. reflex/components/core/html.py +1 -1
  31. reflex/components/core/match.py +5 -5
  32. reflex/components/core/sticky.py +160 -0
  33. reflex/components/core/sticky.pyi +449 -0
  34. reflex/components/core/upload.py +2 -2
  35. reflex/components/datadisplay/code.py +5 -14
  36. reflex/components/datadisplay/dataeditor.py +7 -4
  37. reflex/components/datadisplay/logo.py +13 -8
  38. reflex/components/datadisplay/shiki_code_block.py +14 -9
  39. reflex/components/dynamic.py +22 -3
  40. reflex/components/el/constants/reflex.py +1 -1
  41. reflex/components/el/element.py +1 -1
  42. reflex/components/el/elements/forms.py +4 -4
  43. reflex/components/el/elements/forms.pyi +4 -4
  44. reflex/components/lucide/icon.py +46 -8
  45. reflex/components/lucide/icon.pyi +54 -0
  46. reflex/components/markdown/markdown.py +10 -8
  47. reflex/components/moment/moment.py +2 -2
  48. reflex/components/next/image.py +16 -4
  49. reflex/components/next/image.pyi +4 -2
  50. reflex/components/next/link.py +1 -1
  51. reflex/components/plotly/plotly.py +5 -5
  52. reflex/components/props.py +3 -3
  53. reflex/components/radix/__init__.pyi +1 -1
  54. reflex/components/radix/primitives/accordion.py +9 -5
  55. reflex/components/radix/primitives/accordion.pyi +3 -1
  56. reflex/components/radix/primitives/drawer.py +5 -2
  57. reflex/components/radix/primitives/drawer.pyi +4 -4
  58. reflex/components/radix/primitives/form.pyi +6 -6
  59. reflex/components/radix/primitives/progress.py +1 -1
  60. reflex/components/radix/primitives/slider.py +1 -1
  61. reflex/components/radix/themes/color_mode.py +11 -9
  62. reflex/components/radix/themes/components/alert_dialog.py +3 -0
  63. reflex/components/radix/themes/components/card.py +1 -1
  64. reflex/components/radix/themes/components/card.pyi +1 -1
  65. reflex/components/radix/themes/components/context_menu.py +5 -0
  66. reflex/components/radix/themes/components/dialog.py +3 -0
  67. reflex/components/radix/themes/components/dropdown_menu.py +5 -0
  68. reflex/components/radix/themes/components/hover_card.py +3 -0
  69. reflex/components/radix/themes/components/icon_button.py +2 -2
  70. reflex/components/radix/themes/components/icon_button.pyi +1 -0
  71. reflex/components/radix/themes/components/popover.py +3 -0
  72. reflex/components/radix/themes/components/radio_cards.py +2 -0
  73. reflex/components/radix/themes/components/radio_group.py +1 -1
  74. reflex/components/radix/themes/components/select.py +3 -0
  75. reflex/components/radix/themes/components/tabs.py +3 -0
  76. reflex/components/radix/themes/components/text_area.py +12 -0
  77. reflex/components/radix/themes/components/text_area.pyi +2 -0
  78. reflex/components/radix/themes/components/text_field.py +1 -1
  79. reflex/components/radix/themes/components/tooltip.py +3 -1
  80. reflex/components/radix/themes/components/tooltip.pyi +1 -0
  81. reflex/components/radix/themes/layout/__init__.pyi +1 -1
  82. reflex/components/radix/themes/layout/list.py +2 -2
  83. reflex/components/radix/themes/layout/stack.py +2 -2
  84. reflex/components/radix/themes/typography/link.py +1 -1
  85. reflex/components/radix/themes/typography/text.py +2 -2
  86. reflex/components/react_player/react_player.py +1 -1
  87. reflex/components/recharts/__init__.py +2 -0
  88. reflex/components/recharts/__init__.pyi +2 -0
  89. reflex/components/recharts/charts.py +15 -15
  90. reflex/components/recharts/general.py +19 -4
  91. reflex/components/recharts/general.pyi +55 -4
  92. reflex/components/recharts/polar.py +2 -2
  93. reflex/components/recharts/recharts.py +4 -4
  94. reflex/components/sonner/toast.py +15 -13
  95. reflex/components/sonner/toast.pyi +6 -6
  96. reflex/components/suneditor/editor.py +6 -4
  97. reflex/components/suneditor/editor.pyi +2 -2
  98. reflex/components/tags/iter_tag.py +3 -3
  99. reflex/components/tags/tag.py +25 -3
  100. reflex/config.py +48 -20
  101. reflex/constants/__init__.py +1 -0
  102. reflex/constants/base.py +4 -1
  103. reflex/constants/compiler.py +5 -2
  104. reflex/constants/config.py +8 -1
  105. reflex/constants/installer.py +9 -9
  106. reflex/constants/style.py +1 -1
  107. reflex/custom_components/custom_components.py +9 -7
  108. reflex/event.py +137 -163
  109. reflex/experimental/__init__.py +19 -11
  110. reflex/experimental/client_state.py +53 -28
  111. reflex/experimental/hooks.py +5 -5
  112. reflex/experimental/layout.py +8 -5
  113. reflex/experimental/layout.pyi +1 -1
  114. reflex/experimental/misc.py +3 -3
  115. reflex/istate/wrappers.py +1 -1
  116. reflex/middleware/hydrate_middleware.py +2 -2
  117. reflex/model.py +11 -6
  118. reflex/page.py +3 -3
  119. reflex/reflex.py +90 -19
  120. reflex/route.py +1 -1
  121. reflex/state.py +358 -401
  122. reflex/style.py +27 -3
  123. reflex/testing.py +34 -39
  124. reflex/utils/build.py +6 -2
  125. reflex/utils/codespaces.py +1 -4
  126. reflex/utils/compat.py +6 -5
  127. reflex/utils/console.py +52 -21
  128. reflex/utils/exceptions.py +76 -26
  129. reflex/utils/exec.py +69 -74
  130. reflex/utils/export.py +6 -1
  131. reflex/utils/format.py +7 -39
  132. reflex/utils/imports.py +2 -2
  133. reflex/utils/lazy_loader.py +7 -1
  134. reflex/utils/path_ops.py +28 -14
  135. reflex/utils/prerequisites.py +324 -65
  136. reflex/utils/processes.py +45 -32
  137. reflex/utils/pyi_generator.py +30 -25
  138. reflex/utils/registry.py +4 -4
  139. reflex/utils/serializers.py +1 -1
  140. reflex/utils/telemetry.py +5 -4
  141. reflex/utils/types.py +42 -18
  142. reflex/vars/base.py +650 -333
  143. reflex/vars/datetime.py +6 -7
  144. reflex/vars/dep_tracking.py +344 -0
  145. reflex/vars/function.py +11 -5
  146. reflex/vars/number.py +31 -43
  147. reflex/vars/object.py +63 -62
  148. reflex/vars/sequence.py +79 -67
  149. {reflex-0.6.8a1.dist-info → reflex-0.7.0a1.dist-info}/METADATA +7 -10
  150. {reflex-0.6.8a1.dist-info → reflex-0.7.0a1.dist-info}/RECORD +153 -150
  151. {reflex-0.6.8a1.dist-info → reflex-0.7.0a1.dist-info}/WHEEL +1 -1
  152. reflex/experimental/assets.py +0 -37
  153. reflex/proxy.py +0 -119
  154. {reflex-0.6.8a1.dist-info → reflex-0.7.0a1.dist-info}/LICENSE +0 -0
  155. {reflex-0.6.8a1.dist-info → reflex-0.7.0a1.dist-info}/entry_points.txt +0 -0
@@ -11,6 +11,8 @@ from reflex.vars.base import Var
11
11
 
12
12
  from .base import NextComponent
13
13
 
14
+ DEFAULT_W_H = "100%"
15
+
14
16
  class Image(NextComponent):
15
17
  @overload
16
18
  @classmethod
@@ -30,7 +32,7 @@ class Image(NextComponent):
30
32
  loading: Optional[
31
33
  Union[Literal["eager", "lazy"], Var[Literal["eager", "lazy"]]]
32
34
  ] = None,
33
- blurDataURL: Optional[Union[Var[str], str]] = None,
35
+ blur_data_url: Optional[Union[Var[str], str]] = None,
34
36
  style: Optional[Style] = None,
35
37
  key: Optional[Any] = None,
36
38
  id: Optional[Any] = None,
@@ -71,7 +73,7 @@ class Image(NextComponent):
71
73
  priority: When true, the image will be considered high priority and preload. Lazy loading is automatically disabled for images using priority.
72
74
  placeholder: A placeholder to use while the image is loading. Possible values are blur, empty, or data:image/.... Defaults to empty.
73
75
  loading: The loading behavior of the image. Defaults to lazy. Can hurt performance, recommended to use `priority` instead.
74
- blurDataURL: A Data URL to be used as a placeholder image before the src image successfully loads. Only takes effect when combined with placeholder="blur".
76
+ blur_data_url: A Data URL to be used as a placeholder image before the src image successfully loads. Only takes effect when combined with placeholder="blur".
75
77
  on_load: Fires when the image has loaded.
76
78
  on_error: Fires when the image has an error.
77
79
  style: The style of the component.
@@ -17,4 +17,4 @@ class NextLink(Component):
17
17
  href: Var[str]
18
18
 
19
19
  # Whether to pass the href prop to the child.
20
- pass_href: Var[bool] = True # type: ignore
20
+ pass_href: Var[bool] = Var.create(True)
@@ -18,8 +18,8 @@ try:
18
18
  Template = layout.Template
19
19
  except ImportError:
20
20
  console.warn("Plotly is not installed. Please run `pip install plotly`.")
21
- Figure = Any # type: ignore
22
- Template = Any # type: ignore
21
+ Figure = Any
22
+ Template = Any
23
23
 
24
24
 
25
25
  def _event_points_data_signature(e0: Var) -> Tuple[Var[List[Point]]]:
@@ -95,20 +95,20 @@ class Plotly(NoSSRComponent):
95
95
 
96
96
  library = "react-plotly.js@2.6.0"
97
97
 
98
- lib_dependencies: List[str] = ["plotly.js@2.35.2"]
98
+ lib_dependencies: List[str] = ["plotly.js@2.35.3"]
99
99
 
100
100
  tag = "Plot"
101
101
 
102
102
  is_default = True
103
103
 
104
104
  # The figure to display. This can be a plotly figure or a plotly data json.
105
- data: Var[Figure] # type: ignore
105
+ data: Var[Figure] # pyright: ignore [reportInvalidTypeForm]
106
106
 
107
107
  # The layout of the graph.
108
108
  layout: Var[Dict]
109
109
 
110
110
  # The template for visual appearance of the graph.
111
- template: Var[Template] # type: ignore
111
+ template: Var[Template] # pyright: ignore [reportInvalidTypeForm]
112
112
 
113
113
  # The config of the graph.
114
114
  config: Var[Dict]
@@ -48,7 +48,7 @@ class PropsBase(Base):
48
48
  class NoExtrasAllowedProps(Base):
49
49
  """A class that holds props to be passed or applied to a component with no extra props allowed."""
50
50
 
51
- def __init__(self, component_name=None, **kwargs):
51
+ def __init__(self, component_name: str | None = None, **kwargs):
52
52
  """Initialize the props.
53
53
 
54
54
  Args:
@@ -62,13 +62,13 @@ class NoExtrasAllowedProps(Base):
62
62
  try:
63
63
  super().__init__(**kwargs)
64
64
  except ValidationError as e:
65
- invalid_fields = ", ".join([error["loc"][0] for error in e.errors()]) # type: ignore
65
+ invalid_fields = ", ".join([error["loc"][0] for error in e.errors()]) # pyright: ignore [reportCallIssue, reportArgumentType]
66
66
  supported_props_str = ", ".join(f'"{field}"' for field in self.get_fields())
67
67
  raise InvalidPropValueError(
68
68
  f"Invalid prop(s) {invalid_fields} for {component_name!r}. Supported props are {supported_props_str}"
69
69
  ) from None
70
70
 
71
- class Config:
71
+ class Config: # pyright: ignore [reportIncompatibleVariableOverride]
72
72
  """Pydantic config."""
73
73
 
74
74
  arbitrary_types_allowed = True
@@ -55,7 +55,7 @@ from .themes.layout.container import container as container
55
55
  from .themes.layout.flex import flex as flex
56
56
  from .themes.layout.grid import grid as grid
57
57
  from .themes.layout.list import list_item as list_item
58
- from .themes.layout.list import list_ns as list # noqa
58
+ from .themes.layout.list import list_ns as list # noqa: F401
59
59
  from .themes.layout.list import ordered_list as ordered_list
60
60
  from .themes.layout.list import unordered_list as unordered_list
61
61
  from .themes.layout.section import section as section
@@ -10,6 +10,7 @@ from reflex.components.core.cond import cond
10
10
  from reflex.components.lucide.icon import Icon
11
11
  from reflex.components.radix.primitives.base import RadixPrimitiveComponent
12
12
  from reflex.components.radix.themes.base import LiteralAccentColor, LiteralRadius
13
+ from reflex.constants.compiler import MemoizationMode
13
14
  from reflex.event import EventHandler
14
15
  from reflex.style import Style
15
16
  from reflex.vars import get_uuid_string_var
@@ -196,8 +197,9 @@ class AccordionItem(AccordionComponent):
196
197
 
197
198
  # The header of the accordion item.
198
199
  header: Var[Union[Component, str]]
200
+
199
201
  # The content of the accordion item.
200
- content: Var[Union[Component, str]] = Var.create(None)
202
+ content: Var[Union[Component, str, None]] = Var.create(None)
201
203
 
202
204
  _valid_children: List[str] = [
203
205
  "AccordionHeader",
@@ -341,6 +343,8 @@ class AccordionTrigger(AccordionComponent):
341
343
 
342
344
  alias = "RadixAccordionTrigger"
343
345
 
346
+ _memoization_mode = MemoizationMode(recursive=False)
347
+
344
348
  @classmethod
345
349
  def create(cls, *children, **props) -> Component:
346
350
  """Create the Accordion trigger component.
@@ -485,11 +489,11 @@ to {
485
489
  Returns:
486
490
  The style of the component.
487
491
  """
488
- slideDown = LiteralVar.create(
492
+ slide_down = LiteralVar.create(
489
493
  "${slideDown} var(--animation-duration) var(--animation-easing)",
490
494
  )
491
495
 
492
- slideUp = LiteralVar.create(
496
+ slide_up = LiteralVar.create(
493
497
  "${slideUp} var(--animation-duration) var(--animation-easing)",
494
498
  )
495
499
 
@@ -503,8 +507,8 @@ to {
503
507
  "display": "block",
504
508
  "height": "var(--space-3)",
505
509
  },
506
- "&[data-state='open']": {"animation": slideDown},
507
- "&[data-state='closed']": {"animation": slideUp},
510
+ "&[data-state='open']": {"animation": slide_down},
511
+ "&[data-state='closed']": {"animation": slide_up},
508
512
  _inherited_variant_selector("classic"): {
509
513
  "color": "var(--accent-contrast)",
510
514
  },
@@ -308,7 +308,9 @@ class AccordionItem(AccordionComponent):
308
308
  value: Optional[Union[Var[str], str]] = None,
309
309
  disabled: Optional[Union[Var[bool], bool]] = None,
310
310
  header: Optional[Union[Component, Var[Union[Component, str]], str]] = None,
311
- content: Optional[Union[Component, Var[Union[Component, str]], str]] = None,
311
+ content: Optional[
312
+ Union[Component, Var[Optional[Union[Component, str]]], str]
313
+ ] = None,
312
314
  color_scheme: Optional[
313
315
  Union[
314
316
  Literal[
@@ -10,6 +10,7 @@ from reflex.components.component import Component, ComponentNamespace
10
10
  from reflex.components.radix.primitives.base import RadixPrimitiveComponent
11
11
  from reflex.components.radix.themes.base import Theme
12
12
  from reflex.components.radix.themes.layout.flex import Flex
13
+ from reflex.constants.compiler import MemoizationMode
13
14
  from reflex.event import EventHandler, no_args_event_spec, passthrough_event_spec
14
15
  from reflex.vars.base import Var
15
16
 
@@ -66,7 +67,7 @@ class DrawerRoot(DrawerComponent):
66
67
  scroll_lock_timeout: Var[int]
67
68
 
68
69
  # When `True`, it prevents scroll restoration. Defaults to `True`.
69
- preventScrollRestoration: Var[bool]
70
+ prevent_scroll_restoration: Var[bool]
70
71
 
71
72
  # Enable background scaling, it requires container element with `vaul-drawer-wrapper` attribute to scale its background.
72
73
  should_scale_background: Var[bool]
@@ -83,7 +84,9 @@ class DrawerTrigger(DrawerComponent):
83
84
  alias = "Vaul" + tag
84
85
 
85
86
  # Defaults to true, if the first child acts as the trigger.
86
- as_child: Var[bool] = True # type: ignore
87
+ as_child: Var[bool] = Var.create(True)
88
+
89
+ _memoization_mode = MemoizationMode(recursive=False)
87
90
 
88
91
  @classmethod
89
92
  def create(cls, *children: Any, **props: Any) -> Component:
@@ -81,7 +81,7 @@ class DrawerRoot(DrawerComponent):
81
81
  snap_points: Optional[List[Union[float, str]]] = None,
82
82
  fade_from_index: Optional[Union[Var[int], int]] = None,
83
83
  scroll_lock_timeout: Optional[Union[Var[int], int]] = None,
84
- preventScrollRestoration: Optional[Union[Var[bool], bool]] = None,
84
+ prevent_scroll_restoration: Optional[Union[Var[bool], bool]] = None,
85
85
  should_scale_background: Optional[Union[Var[bool], bool]] = None,
86
86
  close_threshold: Optional[Union[Var[float], float]] = None,
87
87
  as_child: Optional[Union[Var[bool], bool]] = None,
@@ -129,7 +129,7 @@ class DrawerRoot(DrawerComponent):
129
129
  snap_points: 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.
130
130
  fade_from_index: Index of a snapPoint from which the overlay fade should be applied. Defaults to the last snap point.
131
131
  scroll_lock_timeout: Duration for which the drawer is not draggable after scrolling content inside of the drawer. Defaults to 500ms
132
- preventScrollRestoration: When `True`, it prevents scroll restoration. Defaults to `True`.
132
+ prevent_scroll_restoration: When `True`, it prevents scroll restoration. Defaults to `True`.
133
133
  should_scale_background: Enable background scaling, it requires container element with `vaul-drawer-wrapper` attribute to scale its background.
134
134
  close_threshold: Number between 0 and 1 that determines when the drawer should be closed.
135
135
  as_child: Change the default rendered element for the one passed as a child.
@@ -567,7 +567,7 @@ class Drawer(ComponentNamespace):
567
567
  snap_points: Optional[List[Union[float, str]]] = None,
568
568
  fade_from_index: Optional[Union[Var[int], int]] = None,
569
569
  scroll_lock_timeout: Optional[Union[Var[int], int]] = None,
570
- preventScrollRestoration: Optional[Union[Var[bool], bool]] = None,
570
+ prevent_scroll_restoration: Optional[Union[Var[bool], bool]] = None,
571
571
  should_scale_background: Optional[Union[Var[bool], bool]] = None,
572
572
  close_threshold: Optional[Union[Var[float], float]] = None,
573
573
  as_child: Optional[Union[Var[bool], bool]] = None,
@@ -615,7 +615,7 @@ class Drawer(ComponentNamespace):
615
615
  snap_points: 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.
616
616
  fade_from_index: Index of a snapPoint from which the overlay fade should be applied. Defaults to the last snap point.
617
617
  scroll_lock_timeout: Duration for which the drawer is not draggable after scrolling content inside of the drawer. Defaults to 500ms
618
- preventScrollRestoration: When `True`, it prevents scroll restoration. Defaults to `True`.
618
+ prevent_scroll_restoration: When `True`, it prevents scroll restoration. Defaults to `True`.
619
619
  should_scale_background: Enable background scaling, it requires container element with `vaul-drawer-wrapper` attribute to scale its background.
620
620
  close_threshold: Number between 0 and 1 that determines when the drawer should be closed.
621
621
  as_child: Change the default rendered element for the one passed as a child.
@@ -132,10 +132,10 @@ class FormRoot(FormComponent, HTMLForm):
132
132
  on_submit: Optional[
133
133
  Union[
134
134
  Union[
135
- EventType[[], BASE_STATE], EventType[[Dict[str, Any]], BASE_STATE]
135
+ EventType[[], BASE_STATE], EventType[[dict[str, Any]], BASE_STATE]
136
136
  ],
137
137
  Union[
138
- EventType[[], BASE_STATE], EventType[[Dict[str, str]], BASE_STATE]
138
+ EventType[[], BASE_STATE], EventType[[dict[str, str]], BASE_STATE]
139
139
  ],
140
140
  ]
141
141
  ] = None,
@@ -608,10 +608,10 @@ class Form(FormRoot):
608
608
  on_submit: Optional[
609
609
  Union[
610
610
  Union[
611
- EventType[[], BASE_STATE], EventType[[Dict[str, Any]], BASE_STATE]
611
+ EventType[[], BASE_STATE], EventType[[dict[str, Any]], BASE_STATE]
612
612
  ],
613
613
  Union[
614
- EventType[[], BASE_STATE], EventType[[Dict[str, str]], BASE_STATE]
614
+ EventType[[], BASE_STATE], EventType[[dict[str, str]], BASE_STATE]
615
615
  ],
616
616
  ]
617
617
  ] = None,
@@ -741,10 +741,10 @@ class FormNamespace(ComponentNamespace):
741
741
  on_submit: Optional[
742
742
  Union[
743
743
  Union[
744
- EventType[[], BASE_STATE], EventType[[Dict[str, Any]], BASE_STATE]
744
+ EventType[[], BASE_STATE], EventType[[dict[str, Any]], BASE_STATE]
745
745
  ],
746
746
  Union[
747
- EventType[[], BASE_STATE], EventType[[Dict[str, str]], BASE_STATE]
747
+ EventType[[], BASE_STATE], EventType[[dict[str, str]], BASE_STATE]
748
748
  ],
749
749
  ]
750
750
  ] = None,
@@ -83,7 +83,7 @@ class ProgressIndicator(ProgressComponent):
83
83
  "&[data_state='loading']": {
84
84
  "transition": f"transform {DEFAULT_ANIMATION_DURATION}ms linear",
85
85
  },
86
- "transform": f"translateX(calc(-100% + ({self.value} / {self.max} * 100%)))", # type: ignore
86
+ "transform": f"translateX(calc(-100% + ({self.value} / {self.max} * 100%)))",
87
87
  "boxShadow": "inset 0 0 0 1px var(--gray-a5)",
88
88
  }
89
89
 
@@ -30,7 +30,7 @@ def on_value_event_spec(
30
30
  Returns:
31
31
  The event handler spec.
32
32
  """
33
- return (value,) # type: ignore
33
+ return (value,)
34
34
 
35
35
 
36
36
  class SliderRoot(SliderComponent):
@@ -17,7 +17,7 @@ rx.text(
17
17
 
18
18
  from __future__ import annotations
19
19
 
20
- from typing import Dict, List, Literal, Optional, Union, get_args
20
+ from typing import Any, Dict, List, Literal, Optional, Union, get_args
21
21
 
22
22
  from reflex.components.component import BaseComponent
23
23
  from reflex.components.core.cond import Cond, color_mode_cond, cond
@@ -78,17 +78,19 @@ position_map: Dict[str, List[str]] = {
78
78
 
79
79
 
80
80
  # needed to inverse contains for find
81
- def _find(const: List[str], var):
81
+ def _find(const: List[str], var: Any):
82
82
  return LiteralArrayVar.create(const).contains(var)
83
83
 
84
84
 
85
- def _set_var_default(props, position, prop, default1, default2=""):
85
+ def _set_var_default(
86
+ props: dict, position: Any, prop: str, default1: str, default2: str = ""
87
+ ):
86
88
  props.setdefault(
87
89
  prop, cond(_find(position_map[prop], position), default1, default2)
88
90
  )
89
91
 
90
92
 
91
- def _set_static_default(props, position, prop, default):
93
+ def _set_static_default(props: dict, position: Any, prop: str, default: str):
92
94
  if prop in position:
93
95
  props.setdefault(prop, default)
94
96
 
@@ -115,12 +117,12 @@ class ColorModeIconButton(IconButton):
115
117
  Returns:
116
118
  The button component.
117
119
  """
118
- position = props.pop("position", None)
120
+ position: str | Var = props.pop("position", None)
119
121
  allow_system = props.pop("allow_system", False)
120
122
 
121
123
  # position is used to set nice defaults for positioning the icon button
122
124
  if isinstance(position, Var):
123
- _set_var_default(props, position, "position", "fixed", position) # type: ignore
125
+ _set_var_default(props, position, "position", "fixed", position) # pyright: ignore [reportArgumentType]
124
126
  _set_var_default(props, position, "bottom", "2rem")
125
127
  _set_var_default(props, position, "top", "2rem")
126
128
  _set_var_default(props, position, "left", "2rem")
@@ -142,7 +144,7 @@ class ColorModeIconButton(IconButton):
142
144
 
143
145
  if allow_system:
144
146
 
145
- def color_mode_item(_color_mode):
147
+ def color_mode_item(_color_mode: str):
146
148
  return dropdown_menu.item(
147
149
  _color_mode.title(), on_click=set_color_mode(_color_mode)
148
150
  )
@@ -151,8 +153,8 @@ class ColorModeIconButton(IconButton):
151
153
  dropdown_menu.trigger(
152
154
  super().create(
153
155
  ColorModeIcon.create(),
154
- **props,
155
- )
156
+ ),
157
+ **props,
156
158
  ),
157
159
  dropdown_menu.content(
158
160
  color_mode_item("light"),
@@ -5,6 +5,7 @@ from typing import Literal
5
5
  from reflex.components.component import ComponentNamespace
6
6
  from reflex.components.core.breakpoints import Responsive
7
7
  from reflex.components.el import elements
8
+ from reflex.constants.compiler import MemoizationMode
8
9
  from reflex.event import EventHandler, no_args_event_spec, passthrough_event_spec
9
10
  from reflex.vars.base import Var
10
11
 
@@ -33,6 +34,8 @@ class AlertDialogTrigger(RadixThemesTriggerComponent):
33
34
 
34
35
  tag = "AlertDialog.Trigger"
35
36
 
37
+ _memoization_mode = MemoizationMode(recursive=False)
38
+
36
39
 
37
40
  class AlertDialogContent(elements.Div, RadixThemesComponent):
38
41
  """Contains the content of the dialog. This component is based on the div element."""
@@ -20,7 +20,7 @@ class Card(elements.Div, RadixThemesComponent):
20
20
  # Card size: "1" - "5"
21
21
  size: Var[Responsive[Literal["1", "2", "3", "4", "5"],]]
22
22
 
23
- # Variant of Card: "solid" | "soft" | "outline" | "ghost"
23
+ # Variant of Card: "surface" | "classic" | "ghost"
24
24
  variant: Var[Literal["surface", "classic", "ghost"]]
25
25
 
26
26
 
@@ -94,7 +94,7 @@ class Card(elements.Div, RadixThemesComponent):
94
94
  *children: Child components.
95
95
  as_child: Change the default rendered element for the one passed as a child, merging their props and behavior.
96
96
  size: Card size: "1" - "5"
97
- variant: Variant of Card: "solid" | "soft" | "outline" | "ghost"
97
+ variant: Variant of Card: "surface" | "classic" | "ghost"
98
98
  access_key: Provides a hint for generating a keyboard shortcut for the current element.
99
99
  auto_capitalize: Controls whether and how text input is automatically capitalized as it is entered/edited by the user.
100
100
  content_editable: Indicates whether the element's content is editable.
@@ -4,6 +4,7 @@ from typing import Dict, List, Literal, Union
4
4
 
5
5
  from reflex.components.component import ComponentNamespace
6
6
  from reflex.components.core.breakpoints import Responsive
7
+ from reflex.constants.compiler import MemoizationMode
7
8
  from reflex.event import EventHandler, no_args_event_spec, passthrough_event_spec
8
9
  from reflex.vars.base import Var
9
10
 
@@ -55,6 +56,8 @@ class ContextMenuTrigger(RadixThemesComponent):
55
56
 
56
57
  _invalid_children: List[str] = ["ContextMenuContent"]
57
58
 
59
+ _memoization_mode = MemoizationMode(recursive=False)
60
+
58
61
 
59
62
  class ContextMenuContent(RadixThemesComponent):
60
63
  """The component that pops out when the context menu is open."""
@@ -153,6 +156,8 @@ class ContextMenuSubTrigger(RadixThemesComponent):
153
156
 
154
157
  _valid_parents: List[str] = ["ContextMenuContent", "ContextMenuSub"]
155
158
 
159
+ _memoization_mode = MemoizationMode(recursive=False)
160
+
156
161
 
157
162
  class ContextMenuSubContent(RadixThemesComponent):
158
163
  """The component that pops out when a submenu is open."""
@@ -5,6 +5,7 @@ from typing import Literal
5
5
  from reflex.components.component import ComponentNamespace
6
6
  from reflex.components.core.breakpoints import Responsive
7
7
  from reflex.components.el import elements
8
+ from reflex.constants.compiler import MemoizationMode
8
9
  from reflex.event import EventHandler, no_args_event_spec, passthrough_event_spec
9
10
  from reflex.vars.base import Var
10
11
 
@@ -31,6 +32,8 @@ class DialogTrigger(RadixThemesTriggerComponent):
31
32
 
32
33
  tag = "Dialog.Trigger"
33
34
 
35
+ _memoization_mode = MemoizationMode(recursive=False)
36
+
34
37
 
35
38
  class DialogTitle(RadixThemesComponent):
36
39
  """Title component to display inside a Dialog modal."""
@@ -4,6 +4,7 @@ from typing import Dict, List, Literal, Union
4
4
 
5
5
  from reflex.components.component import ComponentNamespace
6
6
  from reflex.components.core.breakpoints import Responsive
7
+ from reflex.constants.compiler import MemoizationMode
7
8
  from reflex.event import EventHandler, no_args_event_spec, passthrough_event_spec
8
9
  from reflex.vars.base import Var
9
10
 
@@ -60,6 +61,8 @@ class DropdownMenuTrigger(RadixThemesTriggerComponent):
60
61
 
61
62
  _invalid_children: List[str] = ["DropdownMenuContent"]
62
63
 
64
+ _memoization_mode = MemoizationMode(recursive=False)
65
+
63
66
 
64
67
  class DropdownMenuContent(RadixThemesComponent):
65
68
  """The Dropdown Menu Content component that pops out when the dropdown menu is open."""
@@ -143,6 +146,8 @@ class DropdownMenuSubTrigger(RadixThemesTriggerComponent):
143
146
 
144
147
  _valid_parents: List[str] = ["DropdownMenuContent", "DropdownMenuSub"]
145
148
 
149
+ _memoization_mode = MemoizationMode(recursive=False)
150
+
146
151
 
147
152
  class DropdownMenuSub(RadixThemesComponent):
148
153
  """Contains all the parts of a submenu."""
@@ -5,6 +5,7 @@ from typing import Dict, Literal, Union
5
5
  from reflex.components.component import ComponentNamespace
6
6
  from reflex.components.core.breakpoints import Responsive
7
7
  from reflex.components.el import elements
8
+ from reflex.constants.compiler import MemoizationMode
8
9
  from reflex.event import EventHandler, passthrough_event_spec
9
10
  from reflex.vars.base import Var
10
11
 
@@ -37,6 +38,8 @@ class HoverCardTrigger(RadixThemesTriggerComponent):
37
38
 
38
39
  tag = "HoverCard.Trigger"
39
40
 
41
+ _memoization_mode = MemoizationMode(recursive=False)
42
+
40
43
 
41
44
  class HoverCardContent(elements.Div, RadixThemesComponent):
42
45
  """Contains the content of the open hover card."""
@@ -22,6 +22,8 @@ from ..base import (
22
22
 
23
23
  LiteralButtonSize = Literal["1", "2", "3", "4"]
24
24
 
25
+ RADIX_TO_LUCIDE_SIZE = {"1": 12, "2": 24, "3": 36, "4": 48}
26
+
25
27
 
26
28
  class IconButton(elements.Button, RadixLoadingProp, RadixThemesComponent):
27
29
  """A button designed specifically for usage with a single icon."""
@@ -72,8 +74,6 @@ class IconButton(elements.Button, RadixLoadingProp, RadixThemesComponent):
72
74
  "IconButton requires a child icon. Pass a string as the first child or a rx.icon."
73
75
  )
74
76
  if "size" in props:
75
- RADIX_TO_LUCIDE_SIZE = {"1": 12, "2": 24, "3": 36, "4": 48}
76
-
77
77
  if isinstance(props["size"], str):
78
78
  children[0].size = RADIX_TO_LUCIDE_SIZE[props["size"]]
79
79
  else:
@@ -14,6 +14,7 @@ from reflex.vars.base import Var
14
14
  from ..base import RadixLoadingProp, RadixThemesComponent
15
15
 
16
16
  LiteralButtonSize = Literal["1", "2", "3", "4"]
17
+ RADIX_TO_LUCIDE_SIZE = {"1": 12, "2": 24, "3": 36, "4": 48}
17
18
 
18
19
  class IconButton(elements.Button, RadixLoadingProp, RadixThemesComponent):
19
20
  @overload
@@ -5,6 +5,7 @@ from typing import Dict, Literal, Union
5
5
  from reflex.components.component import ComponentNamespace
6
6
  from reflex.components.core.breakpoints import Responsive
7
7
  from reflex.components.el import elements
8
+ from reflex.constants.compiler import MemoizationMode
8
9
  from reflex.event import EventHandler, no_args_event_spec, passthrough_event_spec
9
10
  from reflex.vars.base import Var
10
11
 
@@ -34,6 +35,8 @@ class PopoverTrigger(RadixThemesTriggerComponent):
34
35
 
35
36
  tag = "Popover.Trigger"
36
37
 
38
+ _memoization_mode = MemoizationMode(recursive=False)
39
+
37
40
 
38
41
  class PopoverContent(elements.Div, RadixThemesComponent):
39
42
  """Contains content to be rendered in the open popover."""
@@ -85,6 +85,8 @@ class RadioCardsItem(RadixThemesComponent):
85
85
  # When true, indicates that the user must check the radio item before the owning form can be submitted.
86
86
  required: Var[bool]
87
87
 
88
+ _valid_parents: list[str] = ["RadioCardsRoot"]
89
+
88
90
 
89
91
  class RadioCards(SimpleNamespace):
90
92
  """RadioCards components namespace."""
@@ -155,7 +155,7 @@ class HighLevelRadioGroup(RadixThemesComponent):
155
155
  if isinstance(default_value, str) or (
156
156
  isinstance(default_value, Var) and default_value._var_type is str
157
157
  ):
158
- default_value = LiteralVar.create(default_value) # type: ignore
158
+ default_value = LiteralVar.create(default_value)
159
159
  else:
160
160
  default_value = LiteralVar.create(default_value).to_string()
161
161
 
@@ -5,6 +5,7 @@ from typing import List, Literal, Union
5
5
  import reflex as rx
6
6
  from reflex.components.component import Component, ComponentNamespace
7
7
  from reflex.components.core.breakpoints import Responsive
8
+ from reflex.constants.compiler import MemoizationMode
8
9
  from reflex.event import no_args_event_spec, passthrough_event_spec
9
10
  from reflex.vars.base import Var
10
11
 
@@ -69,6 +70,8 @@ class SelectTrigger(RadixThemesComponent):
69
70
 
70
71
  _valid_parents: List[str] = ["SelectRoot"]
71
72
 
73
+ _memoization_mode = MemoizationMode(recursive=False)
74
+
72
75
 
73
76
  class SelectContent(RadixThemesComponent):
74
77
  """The component that pops out when the select is open."""
@@ -7,6 +7,7 @@ from typing import Any, Dict, List, Literal
7
7
  from reflex.components.component import Component, ComponentNamespace
8
8
  from reflex.components.core.breakpoints import Responsive
9
9
  from reflex.components.core.colors import color
10
+ from reflex.constants.compiler import MemoizationMode
10
11
  from reflex.event import EventHandler, passthrough_event_spec
11
12
  from reflex.vars.base import Var
12
13
 
@@ -95,6 +96,8 @@ class TabsTrigger(RadixThemesComponent):
95
96
 
96
97
  _valid_parents: List[str] = ["TabsList"]
97
98
 
99
+ _memoization_mode = MemoizationMode(recursive=False)
100
+
98
101
  @classmethod
99
102
  def create(cls, *children, **props) -> Component:
100
103
  """Create a TabsTrigger component.
@@ -96,5 +96,17 @@ class TextArea(RadixThemesComponent, elements.Textarea):
96
96
  return DebounceInput.create(super().create(*children, **props))
97
97
  return super().create(*children, **props)
98
98
 
99
+ def add_style(self):
100
+ """Add the style to the component.
101
+
102
+ Returns:
103
+ The style of the component.
104
+ """
105
+ added_style: dict[str, dict] = {}
106
+ added_style.setdefault("& textarea", {})
107
+ if "padding" in self.style:
108
+ added_style["& textarea"]["padding"] = self.style.pop("padding")
109
+ return added_style
110
+
99
111
 
100
112
  text_area = TextArea.create
@@ -268,4 +268,6 @@ class TextArea(RadixThemesComponent, elements.Textarea):
268
268
  """
269
269
  ...
270
270
 
271
+ def add_style(self): ...
272
+
271
273
  text_area = TextArea.create
@@ -105,7 +105,7 @@ class TextFieldRoot(elements.Input, RadixThemesComponent):
105
105
  (value_var := Var.create(value))._var_type
106
106
  ):
107
107
  props["value"] = ternary_operation(
108
- (value_var != Var.create(None)) # pyright: ignore [reportGeneralTypeIssues]
108
+ (value_var != Var.create(None)) # pyright: ignore [reportArgumentType]
109
109
  & (value_var != Var(_js_expr="undefined")),
110
110
  value,
111
111
  Var.create(""),
@@ -28,6 +28,9 @@ LiteralStickyType = Literal[
28
28
  ]
29
29
 
30
30
 
31
+ ARIA_LABEL_KEY = "aria_label"
32
+
33
+
31
34
  # The Tooltip inherits props from the Tooltip.Root, Tooltip.Portal, Tooltip.Content
32
35
  class Tooltip(RadixThemesComponent):
33
36
  """Floating element that provides a control with contextual information via pointer or focus."""
@@ -104,7 +107,6 @@ class Tooltip(RadixThemesComponent):
104
107
  Returns:
105
108
  The created component.
106
109
  """
107
- ARIA_LABEL_KEY = "aria_label"
108
110
  if props.get(ARIA_LABEL_KEY) is not None:
109
111
  props[format.to_kebab_case(ARIA_LABEL_KEY)] = props.pop(ARIA_LABEL_KEY)
110
112