reflex 0.3.9a2__py3-none-any.whl → 0.3.10__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 (246) hide show
  1. reflex/__init__.py +3 -1
  2. reflex/__init__.pyi +3 -1
  3. reflex/app.py +13 -5
  4. reflex/compiler/utils.py +13 -12
  5. reflex/components/base/app_wrap.pyi +1 -0
  6. reflex/components/base/body.pyi +2 -0
  7. reflex/components/base/document.pyi +10 -0
  8. reflex/components/base/fragment.pyi +2 -0
  9. reflex/components/base/head.pyi +4 -0
  10. reflex/components/base/link.pyi +4 -0
  11. reflex/components/base/meta.pyi +8 -0
  12. reflex/components/base/script.pyi +2 -0
  13. reflex/components/chakra/base.pyi +7 -0
  14. reflex/components/chakra/datadisplay/badge.pyi +2 -0
  15. reflex/components/chakra/datadisplay/code.pyi +4 -0
  16. reflex/components/chakra/datadisplay/divider.pyi +2 -0
  17. reflex/components/chakra/datadisplay/keyboard_key.pyi +2 -0
  18. reflex/components/chakra/datadisplay/list.pyi +8 -0
  19. reflex/components/chakra/datadisplay/stat.pyi +12 -0
  20. reflex/components/chakra/datadisplay/table.pyi +18 -0
  21. reflex/components/chakra/datadisplay/tag.pyi +9 -0
  22. reflex/components/chakra/disclosure/accordion.pyi +10 -0
  23. reflex/components/chakra/disclosure/tabs.py +8 -0
  24. reflex/components/chakra/disclosure/tabs.pyi +10 -0
  25. reflex/components/chakra/disclosure/transition.pyi +12 -0
  26. reflex/components/chakra/disclosure/visuallyhidden.pyi +2 -0
  27. reflex/components/chakra/feedback/alert.pyi +8 -0
  28. reflex/components/chakra/feedback/circularprogress.pyi +4 -0
  29. reflex/components/chakra/feedback/progress.pyi +2 -0
  30. reflex/components/chakra/feedback/skeleton.pyi +6 -0
  31. reflex/components/chakra/feedback/spinner.pyi +2 -0
  32. reflex/components/chakra/forms/button.pyi +4 -0
  33. reflex/components/chakra/forms/checkbox.pyi +4 -0
  34. reflex/components/chakra/forms/colormodeswitch.pyi +7 -0
  35. reflex/components/chakra/forms/date_picker.pyi +2 -0
  36. reflex/components/chakra/forms/date_time_picker.pyi +2 -0
  37. reflex/components/chakra/forms/editable.pyi +8 -0
  38. reflex/components/chakra/forms/email.pyi +2 -0
  39. reflex/components/chakra/forms/form.pyi +10 -0
  40. reflex/components/chakra/forms/iconbutton.py +1 -0
  41. reflex/components/chakra/forms/iconbutton.pyi +2 -0
  42. reflex/components/chakra/forms/input.pyi +12 -0
  43. reflex/components/chakra/forms/numberinput.pyi +10 -0
  44. reflex/components/chakra/forms/password.pyi +2 -0
  45. reflex/components/chakra/forms/pininput.pyi +4 -0
  46. reflex/components/chakra/forms/radio.pyi +4 -0
  47. reflex/components/chakra/forms/rangeslider.pyi +8 -0
  48. reflex/components/chakra/forms/select.pyi +4 -0
  49. reflex/components/chakra/forms/slider.pyi +10 -0
  50. reflex/components/chakra/forms/switch.pyi +2 -0
  51. reflex/components/chakra/forms/textarea.pyi +2 -0
  52. reflex/components/chakra/forms/time_picker.pyi +2 -0
  53. reflex/components/chakra/layout/aspect_ratio.pyi +2 -0
  54. reflex/components/chakra/layout/box.pyi +2 -0
  55. reflex/components/chakra/layout/card.pyi +7 -0
  56. reflex/components/chakra/layout/center.pyi +6 -0
  57. reflex/components/chakra/layout/container.pyi +2 -0
  58. reflex/components/chakra/layout/flex.pyi +2 -0
  59. reflex/components/chakra/layout/grid.pyi +6 -0
  60. reflex/components/chakra/layout/html.pyi +2 -0
  61. reflex/components/chakra/layout/spacer.pyi +2 -0
  62. reflex/components/chakra/layout/stack.pyi +6 -0
  63. reflex/components/chakra/layout/wrap.pyi +4 -0
  64. reflex/components/chakra/media/avatar.pyi +6 -0
  65. reflex/components/chakra/media/icon.pyi +4 -0
  66. reflex/components/chakra/media/image.pyi +2 -0
  67. reflex/components/chakra/navigation/breadcrumb.pyi +8 -0
  68. reflex/components/chakra/navigation/link.pyi +2 -0
  69. reflex/components/chakra/navigation/linkoverlay.pyi +4 -0
  70. reflex/components/chakra/navigation/stepper.pyi +18 -0
  71. reflex/components/chakra/overlay/alertdialog.pyi +14 -0
  72. reflex/components/chakra/overlay/drawer.pyi +14 -0
  73. reflex/components/chakra/overlay/menu.pyi +16 -0
  74. reflex/components/chakra/overlay/modal.pyi +14 -0
  75. reflex/components/chakra/overlay/popover.pyi +18 -0
  76. reflex/components/chakra/overlay/tooltip.pyi +2 -0
  77. reflex/components/chakra/typography/heading.pyi +2 -0
  78. reflex/components/chakra/typography/highlight.pyi +2 -0
  79. reflex/components/chakra/typography/span.pyi +2 -0
  80. reflex/components/chakra/typography/text.pyi +2 -0
  81. reflex/components/component.py +41 -3
  82. reflex/components/core/__init__.py +2 -0
  83. reflex/components/core/banner.pyi +3 -0
  84. reflex/components/core/client_side_routing.pyi +4 -0
  85. reflex/components/core/colors.py +21 -0
  86. reflex/components/core/cond.py +11 -2
  87. reflex/components/core/debounce.pyi +1 -0
  88. reflex/components/core/layout/__init__.py +1 -0
  89. reflex/components/core/match.py +44 -18
  90. reflex/components/core/upload.py +8 -2
  91. reflex/components/core/upload.pyi +7 -1
  92. reflex/components/datadisplay/dataeditor.pyi +2 -0
  93. reflex/components/el/element.pyi +2 -0
  94. reflex/components/el/elements/base.pyi +2 -0
  95. reflex/components/el/elements/forms.py +3 -0
  96. reflex/components/el/elements/forms.pyi +32 -0
  97. reflex/components/el/elements/inline.pyi +56 -0
  98. reflex/components/el/elements/media.pyi +28 -0
  99. reflex/components/el/elements/metadata.pyi +10 -0
  100. reflex/components/el/elements/other.pyi +14 -0
  101. reflex/components/el/elements/scripts.pyi +6 -0
  102. reflex/components/el/elements/sectioning.pyi +30 -0
  103. reflex/components/el/elements/tables.pyi +20 -0
  104. reflex/components/el/elements/typography.pyi +30 -0
  105. reflex/components/gridjs/datatable.pyi +4 -0
  106. reflex/components/lucide/__init__.py +5 -0
  107. reflex/components/lucide/icon.py +1484 -0
  108. reflex/components/lucide/icon.pyi +1594 -0
  109. reflex/components/markdown/markdown.pyi +2 -0
  110. reflex/components/moment/moment.pyi +2 -0
  111. reflex/components/next/base.pyi +2 -0
  112. reflex/components/next/image.pyi +2 -0
  113. reflex/components/next/link.pyi +2 -0
  114. reflex/components/next/video.pyi +2 -0
  115. reflex/components/plotly/plotly.pyi +4 -0
  116. reflex/components/radix/primitives/__init__.py +10 -0
  117. reflex/components/radix/primitives/accordion.py +51 -32
  118. reflex/components/radix/primitives/accordion.pyi +16 -3
  119. reflex/components/radix/primitives/base.pyi +4 -0
  120. reflex/components/radix/primitives/drawer.py +240 -0
  121. reflex/components/radix/primitives/drawer.pyi +814 -0
  122. reflex/components/radix/primitives/form.py +40 -7
  123. reflex/components/radix/primitives/form.pyi +32 -10
  124. reflex/components/radix/primitives/progress.py +2 -2
  125. reflex/components/radix/primitives/progress.pyi +6 -0
  126. reflex/components/radix/primitives/slider.pyi +10 -0
  127. reflex/components/radix/themes/base.py +46 -12
  128. reflex/components/radix/themes/base.pyi +23 -9
  129. reflex/components/radix/themes/components/__init__.py +4 -2
  130. reflex/components/radix/themes/components/alertdialog.py +13 -12
  131. reflex/components/radix/themes/components/alertdialog.pyi +23 -351
  132. reflex/components/radix/themes/components/aspectratio.py +2 -5
  133. reflex/components/radix/themes/components/aspectratio.pyi +4 -51
  134. reflex/components/radix/themes/components/avatar.py +3 -4
  135. reflex/components/radix/themes/components/avatar.pyi +4 -57
  136. reflex/components/radix/themes/components/badge.py +3 -4
  137. reflex/components/radix/themes/components/badge.pyi +4 -56
  138. reflex/components/radix/themes/components/button.py +2 -3
  139. reflex/components/radix/themes/components/button.pyi +3 -51
  140. reflex/components/radix/themes/components/callout.py +9 -12
  141. reflex/components/radix/themes/components/callout.pyi +24 -217
  142. reflex/components/radix/themes/components/card.py +1 -2
  143. reflex/components/radix/themes/components/card.pyi +4 -51
  144. reflex/components/radix/themes/components/checkbox.py +11 -5
  145. reflex/components/radix/themes/components/checkbox.pyi +13 -112
  146. reflex/components/radix/themes/components/contextmenu.py +21 -21
  147. reflex/components/radix/themes/components/contextmenu.pyi +26 -401
  148. reflex/components/radix/themes/components/dialog.py +13 -16
  149. reflex/components/radix/themes/components/dialog.pyi +20 -303
  150. reflex/components/radix/themes/components/dropdownmenu.py +196 -32
  151. reflex/components/radix/themes/components/dropdownmenu.pyi +147 -389
  152. reflex/components/radix/themes/components/hovercard.py +5 -5
  153. reflex/components/radix/themes/components/hovercard.pyi +11 -151
  154. reflex/components/radix/themes/components/iconbutton.py +56 -4
  155. reflex/components/radix/themes/components/iconbutton.pyi +25 -71
  156. reflex/components/radix/themes/components/icons.pyi +4 -0
  157. reflex/components/radix/themes/components/inset.py +1 -2
  158. reflex/components/radix/themes/components/inset.pyi +4 -51
  159. reflex/components/radix/themes/components/popover.py +12 -12
  160. reflex/components/radix/themes/components/popover.pyi +14 -201
  161. reflex/components/radix/themes/components/radiogroup.py +47 -20
  162. reflex/components/radix/themes/components/radiogroup.pyi +26 -171
  163. reflex/components/radix/themes/components/scrollarea.py +2 -3
  164. reflex/components/radix/themes/components/scrollarea.pyi +4 -51
  165. reflex/components/radix/themes/components/select.py +28 -25
  166. reflex/components/radix/themes/components/select.pyi +43 -419
  167. reflex/components/radix/themes/components/separator.py +4 -5
  168. reflex/components/radix/themes/components/separator.pyi +5 -52
  169. reflex/components/radix/themes/components/slider.py +8 -5
  170. reflex/components/radix/themes/components/slider.pyi +9 -60
  171. reflex/components/radix/themes/components/switch.py +6 -4
  172. reflex/components/radix/themes/components/switch.pyi +5 -53
  173. reflex/components/radix/themes/components/table.py +14 -15
  174. reflex/components/radix/themes/components/table.pyi +22 -351
  175. reflex/components/radix/themes/components/tabs.py +9 -6
  176. reflex/components/radix/themes/components/tabs.pyi +18 -205
  177. reflex/components/radix/themes/components/textarea.py +2 -3
  178. reflex/components/radix/themes/components/textarea.pyi +10 -53
  179. reflex/components/radix/themes/components/textfield.py +105 -4
  180. reflex/components/radix/themes/components/textfield.pyi +200 -108
  181. reflex/components/radix/themes/components/tooltip.py +102 -2
  182. reflex/components/radix/themes/components/tooltip.pyi +66 -110
  183. reflex/components/radix/themes/layout/__init__.py +7 -0
  184. reflex/components/radix/themes/layout/base.pyi +2 -0
  185. reflex/components/radix/themes/layout/box.py +2 -2
  186. reflex/components/radix/themes/layout/box.pyi +4 -104
  187. reflex/components/radix/themes/layout/center.py +19 -0
  188. reflex/components/radix/themes/layout/center.pyi +261 -0
  189. reflex/components/radix/themes/layout/container.py +2 -2
  190. reflex/components/radix/themes/layout/container.pyi +4 -104
  191. reflex/components/radix/themes/layout/flex.py +2 -2
  192. reflex/components/radix/themes/layout/flex.pyi +4 -105
  193. reflex/components/radix/themes/layout/grid.pyi +2 -0
  194. reflex/components/radix/themes/layout/section.py +2 -2
  195. reflex/components/radix/themes/layout/section.pyi +4 -104
  196. reflex/components/radix/themes/layout/spacer.py +19 -0
  197. reflex/components/radix/themes/layout/spacer.pyi +261 -0
  198. reflex/components/radix/themes/layout/stack.py +60 -0
  199. reflex/components/radix/themes/layout/stack.pyi +537 -0
  200. reflex/components/radix/themes/typography/blockquote.py +2 -3
  201. reflex/components/radix/themes/typography/blockquote.pyi +4 -51
  202. reflex/components/radix/themes/typography/code.py +2 -3
  203. reflex/components/radix/themes/typography/code.pyi +4 -56
  204. reflex/components/radix/themes/typography/em.py +1 -2
  205. reflex/components/radix/themes/typography/em.pyi +4 -51
  206. reflex/components/radix/themes/typography/heading.py +2 -3
  207. reflex/components/radix/themes/typography/heading.pyi +4 -51
  208. reflex/components/radix/themes/typography/kbd.py +1 -2
  209. reflex/components/radix/themes/typography/kbd.pyi +4 -51
  210. reflex/components/radix/themes/typography/link.py +34 -3
  211. reflex/components/radix/themes/typography/link.pyi +41 -86
  212. reflex/components/radix/themes/typography/quote.py +1 -2
  213. reflex/components/radix/themes/typography/quote.pyi +4 -51
  214. reflex/components/radix/themes/typography/strong.py +1 -2
  215. reflex/components/radix/themes/typography/strong.pyi +4 -51
  216. reflex/components/radix/themes/typography/text.py +2 -3
  217. reflex/components/radix/themes/typography/text.pyi +4 -51
  218. reflex/components/radix/themes/typography.py +10 -11
  219. reflex/components/react_player/audio.pyi +2 -0
  220. reflex/components/react_player/react_player.pyi +2 -0
  221. reflex/components/react_player/video.pyi +2 -0
  222. reflex/components/recharts/cartesian.pyi +38 -0
  223. reflex/components/recharts/charts.pyi +22 -0
  224. reflex/components/recharts/general.pyi +10 -0
  225. reflex/components/recharts/polar.pyi +12 -0
  226. reflex/components/recharts/recharts.pyi +4 -0
  227. reflex/components/suneditor/editor.pyi +2 -0
  228. reflex/components/tags/tag.py +1 -1
  229. reflex/constants/base.py +5 -1
  230. reflex/constants/colors.py +80 -0
  231. reflex/constants/event.py +10 -1
  232. reflex/page.py +1 -1
  233. reflex/reflex.py +4 -0
  234. reflex/style.py +8 -3
  235. reflex/testing.py +21 -10
  236. reflex/utils/format.py +13 -9
  237. reflex/utils/prerequisites.py +41 -3
  238. reflex/utils/serializers.py +14 -0
  239. reflex/utils/telemetry.py +8 -2
  240. reflex/utils/types.py +36 -2
  241. reflex/vars.py +53 -18
  242. {reflex-0.3.9a2.dist-info → reflex-0.3.10.dist-info}/METADATA +1 -2
  243. {reflex-0.3.9a2.dist-info → reflex-0.3.10.dist-info}/RECORD +246 -232
  244. {reflex-0.3.9a2.dist-info → reflex-0.3.10.dist-info}/WHEEL +1 -1
  245. {reflex-0.3.9a2.dist-info → reflex-0.3.10.dist-info}/LICENSE +0 -0
  246. {reflex-0.3.9a2.dist-info → reflex-0.3.10.dist-info}/entry_points.txt +0 -0
@@ -49,6 +49,7 @@ class Modal(ChakraComponent):
49
49
  id: Optional[Any] = None,
50
50
  class_name: Optional[Any] = None,
51
51
  autofocus: Optional[bool] = None,
52
+ _rename_props: Optional[Dict[str, str]] = None,
52
53
  custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
53
54
  on_blur: Optional[
54
55
  Union[EventHandler, EventSpec, list, function, BaseVar]
@@ -135,6 +136,7 @@ class Modal(ChakraComponent):
135
136
  id: The id for the component.
136
137
  class_name: The class name for the component.
137
138
  autofocus: Whether the component should take the focus once the page is loaded
139
+ _rename_props: props to change the name of
138
140
  custom_attrs: custom attribute
139
141
  **props: The properties of the component.
140
142
 
@@ -157,6 +159,7 @@ class ModalOverlay(ChakraComponent):
157
159
  id: Optional[Any] = None,
158
160
  class_name: Optional[Any] = None,
159
161
  autofocus: Optional[bool] = None,
162
+ _rename_props: Optional[Dict[str, str]] = None,
160
163
  custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
161
164
  on_blur: Optional[
162
165
  Union[EventHandler, EventSpec, list, function, BaseVar]
@@ -214,6 +217,7 @@ class ModalOverlay(ChakraComponent):
214
217
  id: The id for the component.
215
218
  class_name: The class name for the component.
216
219
  autofocus: Whether the component should take the focus once the page is loaded
220
+ _rename_props: props to change the name of
217
221
  custom_attrs: custom attribute
218
222
  **props: The props of the component.
219
223
 
@@ -236,6 +240,7 @@ class ModalHeader(ChakraComponent):
236
240
  id: Optional[Any] = None,
237
241
  class_name: Optional[Any] = None,
238
242
  autofocus: Optional[bool] = None,
243
+ _rename_props: Optional[Dict[str, str]] = None,
239
244
  custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
240
245
  on_blur: Optional[
241
246
  Union[EventHandler, EventSpec, list, function, BaseVar]
@@ -293,6 +298,7 @@ class ModalHeader(ChakraComponent):
293
298
  id: The id for the component.
294
299
  class_name: The class name for the component.
295
300
  autofocus: Whether the component should take the focus once the page is loaded
301
+ _rename_props: props to change the name of
296
302
  custom_attrs: custom attribute
297
303
  **props: The props of the component.
298
304
 
@@ -315,6 +321,7 @@ class ModalFooter(ChakraComponent):
315
321
  id: Optional[Any] = None,
316
322
  class_name: Optional[Any] = None,
317
323
  autofocus: Optional[bool] = None,
324
+ _rename_props: Optional[Dict[str, str]] = None,
318
325
  custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
319
326
  on_blur: Optional[
320
327
  Union[EventHandler, EventSpec, list, function, BaseVar]
@@ -372,6 +379,7 @@ class ModalFooter(ChakraComponent):
372
379
  id: The id for the component.
373
380
  class_name: The class name for the component.
374
381
  autofocus: Whether the component should take the focus once the page is loaded
382
+ _rename_props: props to change the name of
375
383
  custom_attrs: custom attribute
376
384
  **props: The props of the component.
377
385
 
@@ -394,6 +402,7 @@ class ModalContent(ChakraComponent):
394
402
  id: Optional[Any] = None,
395
403
  class_name: Optional[Any] = None,
396
404
  autofocus: Optional[bool] = None,
405
+ _rename_props: Optional[Dict[str, str]] = None,
397
406
  custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
398
407
  on_blur: Optional[
399
408
  Union[EventHandler, EventSpec, list, function, BaseVar]
@@ -451,6 +460,7 @@ class ModalContent(ChakraComponent):
451
460
  id: The id for the component.
452
461
  class_name: The class name for the component.
453
462
  autofocus: Whether the component should take the focus once the page is loaded
463
+ _rename_props: props to change the name of
454
464
  custom_attrs: custom attribute
455
465
  **props: The props of the component.
456
466
 
@@ -473,6 +483,7 @@ class ModalBody(ChakraComponent):
473
483
  id: Optional[Any] = None,
474
484
  class_name: Optional[Any] = None,
475
485
  autofocus: Optional[bool] = None,
486
+ _rename_props: Optional[Dict[str, str]] = None,
476
487
  custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
477
488
  on_blur: Optional[
478
489
  Union[EventHandler, EventSpec, list, function, BaseVar]
@@ -530,6 +541,7 @@ class ModalBody(ChakraComponent):
530
541
  id: The id for the component.
531
542
  class_name: The class name for the component.
532
543
  autofocus: Whether the component should take the focus once the page is loaded
544
+ _rename_props: props to change the name of
533
545
  custom_attrs: custom attribute
534
546
  **props: The props of the component.
535
547
 
@@ -552,6 +564,7 @@ class ModalCloseButton(ChakraComponent):
552
564
  id: Optional[Any] = None,
553
565
  class_name: Optional[Any] = None,
554
566
  autofocus: Optional[bool] = None,
567
+ _rename_props: Optional[Dict[str, str]] = None,
555
568
  custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
556
569
  on_blur: Optional[
557
570
  Union[EventHandler, EventSpec, list, function, BaseVar]
@@ -609,6 +622,7 @@ class ModalCloseButton(ChakraComponent):
609
622
  id: The id for the component.
610
623
  class_name: The class name for the component.
611
624
  autofocus: Whether the component should take the focus once the page is loaded
625
+ _rename_props: props to change the name of
612
626
  custom_attrs: custom attribute
613
627
  **props: The props of the component.
614
628
 
@@ -58,6 +58,7 @@ class Popover(ChakraComponent):
58
58
  id: Optional[Any] = None,
59
59
  class_name: Optional[Any] = None,
60
60
  autofocus: Optional[bool] = None,
61
+ _rename_props: Optional[Dict[str, str]] = None,
61
62
  custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
62
63
  on_blur: Optional[
63
64
  Union[EventHandler, EventSpec, list, function, BaseVar]
@@ -146,6 +147,7 @@ class Popover(ChakraComponent):
146
147
  id: The id for the component.
147
148
  class_name: The class name for the component.
148
149
  autofocus: Whether the component should take the focus once the page is loaded
150
+ _rename_props: props to change the name of
149
151
  custom_attrs: custom attribute
150
152
  **props: The properties of the component.
151
153
 
@@ -165,6 +167,7 @@ class PopoverContent(ChakraComponent):
165
167
  id: Optional[Any] = None,
166
168
  class_name: Optional[Any] = None,
167
169
  autofocus: Optional[bool] = None,
170
+ _rename_props: Optional[Dict[str, str]] = None,
168
171
  custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
169
172
  on_blur: Optional[
170
173
  Union[EventHandler, EventSpec, list, function, BaseVar]
@@ -222,6 +225,7 @@ class PopoverContent(ChakraComponent):
222
225
  id: The id for the component.
223
226
  class_name: The class name for the component.
224
227
  autofocus: Whether the component should take the focus once the page is loaded
228
+ _rename_props: props to change the name of
225
229
  custom_attrs: custom attribute
226
230
  **props: The props of the component.
227
231
 
@@ -244,6 +248,7 @@ class PopoverHeader(ChakraComponent):
244
248
  id: Optional[Any] = None,
245
249
  class_name: Optional[Any] = None,
246
250
  autofocus: Optional[bool] = None,
251
+ _rename_props: Optional[Dict[str, str]] = None,
247
252
  custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
248
253
  on_blur: Optional[
249
254
  Union[EventHandler, EventSpec, list, function, BaseVar]
@@ -301,6 +306,7 @@ class PopoverHeader(ChakraComponent):
301
306
  id: The id for the component.
302
307
  class_name: The class name for the component.
303
308
  autofocus: Whether the component should take the focus once the page is loaded
309
+ _rename_props: props to change the name of
304
310
  custom_attrs: custom attribute
305
311
  **props: The props of the component.
306
312
 
@@ -323,6 +329,7 @@ class PopoverFooter(ChakraComponent):
323
329
  id: Optional[Any] = None,
324
330
  class_name: Optional[Any] = None,
325
331
  autofocus: Optional[bool] = None,
332
+ _rename_props: Optional[Dict[str, str]] = None,
326
333
  custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
327
334
  on_blur: Optional[
328
335
  Union[EventHandler, EventSpec, list, function, BaseVar]
@@ -380,6 +387,7 @@ class PopoverFooter(ChakraComponent):
380
387
  id: The id for the component.
381
388
  class_name: The class name for the component.
382
389
  autofocus: Whether the component should take the focus once the page is loaded
390
+ _rename_props: props to change the name of
383
391
  custom_attrs: custom attribute
384
392
  **props: The props of the component.
385
393
 
@@ -402,6 +410,7 @@ class PopoverBody(ChakraComponent):
402
410
  id: Optional[Any] = None,
403
411
  class_name: Optional[Any] = None,
404
412
  autofocus: Optional[bool] = None,
413
+ _rename_props: Optional[Dict[str, str]] = None,
405
414
  custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
406
415
  on_blur: Optional[
407
416
  Union[EventHandler, EventSpec, list, function, BaseVar]
@@ -459,6 +468,7 @@ class PopoverBody(ChakraComponent):
459
468
  id: The id for the component.
460
469
  class_name: The class name for the component.
461
470
  autofocus: Whether the component should take the focus once the page is loaded
471
+ _rename_props: props to change the name of
462
472
  custom_attrs: custom attribute
463
473
  **props: The props of the component.
464
474
 
@@ -481,6 +491,7 @@ class PopoverArrow(ChakraComponent):
481
491
  id: Optional[Any] = None,
482
492
  class_name: Optional[Any] = None,
483
493
  autofocus: Optional[bool] = None,
494
+ _rename_props: Optional[Dict[str, str]] = None,
484
495
  custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
485
496
  on_blur: Optional[
486
497
  Union[EventHandler, EventSpec, list, function, BaseVar]
@@ -538,6 +549,7 @@ class PopoverArrow(ChakraComponent):
538
549
  id: The id for the component.
539
550
  class_name: The class name for the component.
540
551
  autofocus: Whether the component should take the focus once the page is loaded
552
+ _rename_props: props to change the name of
541
553
  custom_attrs: custom attribute
542
554
  **props: The props of the component.
543
555
 
@@ -560,6 +572,7 @@ class PopoverCloseButton(ChakraComponent):
560
572
  id: Optional[Any] = None,
561
573
  class_name: Optional[Any] = None,
562
574
  autofocus: Optional[bool] = None,
575
+ _rename_props: Optional[Dict[str, str]] = None,
563
576
  custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
564
577
  on_blur: Optional[
565
578
  Union[EventHandler, EventSpec, list, function, BaseVar]
@@ -617,6 +630,7 @@ class PopoverCloseButton(ChakraComponent):
617
630
  id: The id for the component.
618
631
  class_name: The class name for the component.
619
632
  autofocus: Whether the component should take the focus once the page is loaded
633
+ _rename_props: props to change the name of
620
634
  custom_attrs: custom attribute
621
635
  **props: The props of the component.
622
636
 
@@ -639,6 +653,7 @@ class PopoverAnchor(ChakraComponent):
639
653
  id: Optional[Any] = None,
640
654
  class_name: Optional[Any] = None,
641
655
  autofocus: Optional[bool] = None,
656
+ _rename_props: Optional[Dict[str, str]] = None,
642
657
  custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
643
658
  on_blur: Optional[
644
659
  Union[EventHandler, EventSpec, list, function, BaseVar]
@@ -696,6 +711,7 @@ class PopoverAnchor(ChakraComponent):
696
711
  id: The id for the component.
697
712
  class_name: The class name for the component.
698
713
  autofocus: Whether the component should take the focus once the page is loaded
714
+ _rename_props: props to change the name of
699
715
  custom_attrs: custom attribute
700
716
  **props: The props of the component.
701
717
 
@@ -718,6 +734,7 @@ class PopoverTrigger(ChakraComponent):
718
734
  id: Optional[Any] = None,
719
735
  class_name: Optional[Any] = None,
720
736
  autofocus: Optional[bool] = None,
737
+ _rename_props: Optional[Dict[str, str]] = None,
721
738
  custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
722
739
  on_blur: Optional[
723
740
  Union[EventHandler, EventSpec, list, function, BaseVar]
@@ -775,6 +792,7 @@ class PopoverTrigger(ChakraComponent):
775
792
  id: The id for the component.
776
793
  class_name: The class name for the component.
777
794
  autofocus: Whether the component should take the focus once the page is loaded
795
+ _rename_props: props to change the name of
778
796
  custom_attrs: custom attribute
779
797
  **props: The props of the component.
780
798
 
@@ -42,6 +42,7 @@ class Tooltip(ChakraComponent):
42
42
  id: Optional[Any] = None,
43
43
  class_name: Optional[Any] = None,
44
44
  autofocus: Optional[bool] = None,
45
+ _rename_props: Optional[Dict[str, str]] = None,
45
46
  custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
46
47
  on_blur: Optional[
47
48
  Union[EventHandler, EventSpec, list, function, BaseVar]
@@ -122,6 +123,7 @@ class Tooltip(ChakraComponent):
122
123
  id: The id for the component.
123
124
  class_name: The class name for the component.
124
125
  autofocus: Whether the component should take the focus once the page is loaded
126
+ _rename_props: props to change the name of
125
127
  custom_attrs: custom attribute
126
128
  **props: The props of the component.
127
129
 
@@ -28,6 +28,7 @@ class Heading(ChakraComponent):
28
28
  id: Optional[Any] = None,
29
29
  class_name: Optional[Any] = None,
30
30
  autofocus: Optional[bool] = None,
31
+ _rename_props: Optional[Dict[str, str]] = None,
31
32
  custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
32
33
  on_blur: Optional[
33
34
  Union[EventHandler, EventSpec, list, function, BaseVar]
@@ -87,6 +88,7 @@ class Heading(ChakraComponent):
87
88
  id: The id for the component.
88
89
  class_name: The class name for the component.
89
90
  autofocus: Whether the component should take the focus once the page is loaded
91
+ _rename_props: props to change the name of
90
92
  custom_attrs: custom attribute
91
93
  **props: The props of the component.
92
94
 
@@ -25,6 +25,7 @@ class Highlight(ChakraComponent):
25
25
  id: Optional[Any] = None,
26
26
  class_name: Optional[Any] = None,
27
27
  autofocus: Optional[bool] = None,
28
+ _rename_props: Optional[Dict[str, str]] = None,
28
29
  custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
29
30
  on_blur: Optional[
30
31
  Union[EventHandler, EventSpec, list, function, BaseVar]
@@ -84,6 +85,7 @@ class Highlight(ChakraComponent):
84
85
  id: The id for the component.
85
86
  class_name: The class name for the component.
86
87
  autofocus: Whether the component should take the focus once the page is loaded
88
+ _rename_props: props to change the name of
87
89
  custom_attrs: custom attribute
88
90
  **props: The props of the component.
89
91
 
@@ -22,6 +22,7 @@ class Span(ChakraComponent):
22
22
  id: Optional[Any] = None,
23
23
  class_name: Optional[Any] = None,
24
24
  autofocus: Optional[bool] = None,
25
+ _rename_props: Optional[Dict[str, str]] = None,
25
26
  custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
26
27
  on_blur: Optional[
27
28
  Union[EventHandler, EventSpec, list, function, BaseVar]
@@ -80,6 +81,7 @@ class Span(ChakraComponent):
80
81
  id: The id for the component.
81
82
  class_name: The class name for the component.
82
83
  autofocus: Whether the component should take the focus once the page is loaded
84
+ _rename_props: props to change the name of
83
85
  custom_attrs: custom attribute
84
86
  **props: The props of the component.
85
87
 
@@ -23,6 +23,7 @@ class Text(ChakraComponent):
23
23
  id: Optional[Any] = None,
24
24
  class_name: Optional[Any] = None,
25
25
  autofocus: Optional[bool] = None,
26
+ _rename_props: Optional[Dict[str, str]] = None,
26
27
  custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
27
28
  on_blur: Optional[
28
29
  Union[EventHandler, EventSpec, list, function, BaseVar]
@@ -82,6 +83,7 @@ class Text(ChakraComponent):
82
83
  id: The id for the component.
83
84
  class_name: The class name for the component.
84
85
  autofocus: Whether the component should take the focus once the page is loaded
86
+ _rename_props: props to change the name of
85
87
  custom_attrs: custom attribute
86
88
  **props: The props of the component.
87
89
 
@@ -115,7 +115,7 @@ class BaseComponent(Base, ABC):
115
115
 
116
116
 
117
117
  # Map from component to styling.
118
- ComponentStyle = Dict[Union[str, Type[BaseComponent]], Any]
118
+ ComponentStyle = Dict[Union[str, Type[BaseComponent], Callable], Any]
119
119
  ComponentChild = Union[types.PrimitiveType, Var, BaseComponent]
120
120
 
121
121
 
@@ -155,6 +155,12 @@ class Component(BaseComponent, ABC):
155
155
  # only components that are allowed as children
156
156
  _valid_children: List[str] = []
157
157
 
158
+ # only components that are allowed as parent
159
+ _valid_parents: List[str] = []
160
+
161
+ # props to change the name of
162
+ _rename_props: Dict[str, str] = {}
163
+
158
164
  # custom attribute
159
165
  custom_attrs: Dict[str, Union[Var, str]] = {}
160
166
 
@@ -597,10 +603,13 @@ class Component(BaseComponent, ABC):
597
603
  Returns:
598
604
  The component with the additional style.
599
605
  """
606
+ component_style = None
600
607
  if type(self) in style:
601
608
  # Extract the style for this component.
602
609
  component_style = Style(style[type(self)])
603
-
610
+ if self.create in style:
611
+ component_style = Style(style[self.create])
612
+ if component_style is not None:
604
613
  # Only add style props that are not overridden.
605
614
  component_style = {
606
615
  k: v for k, v in component_style.items() if k not in self.style
@@ -642,8 +651,24 @@ class Component(BaseComponent, ABC):
642
651
  ),
643
652
  autofocus=self.autofocus,
644
653
  )
654
+ self._replace_prop_names(rendered_dict)
645
655
  return rendered_dict
646
656
 
657
+ def _replace_prop_names(self, rendered_dict) -> None:
658
+ """Replace the prop names in the render dictionary.
659
+
660
+ Args:
661
+ rendered_dict: The render dictionary with all the component props and event handlers.
662
+ """
663
+ # fast path
664
+ if not self._rename_props:
665
+ return
666
+
667
+ for ix, prop in enumerate(rendered_dict["props"]):
668
+ for old_prop, new_prop in self._rename_props.items():
669
+ if prop.startswith(old_prop):
670
+ rendered_dict["props"][ix] = prop.replace(old_prop, new_prop)
671
+
647
672
  def _validate_component_children(self, children: List[Component]):
648
673
  """Validate the children components.
649
674
 
@@ -651,7 +676,8 @@ class Component(BaseComponent, ABC):
651
676
  children: The children of the component.
652
677
 
653
678
  """
654
- if not self._invalid_children and not self._valid_children:
679
+ skip_parentable = all(child._valid_parents == [] for child in children)
680
+ if not self._invalid_children and not self._valid_children and skip_parentable:
655
681
  return
656
682
 
657
683
  comp_name = type(self).__name__
@@ -671,6 +697,15 @@ class Component(BaseComponent, ABC):
671
697
  f"The component `{comp_name}` only allows the components: {valid_child_list} as children. Got `{child_name}` instead."
672
698
  )
673
699
 
700
+ def validate_vaild_parent(child_name, valid_parents):
701
+ if comp_name not in valid_parents:
702
+ valid_parent_list = ", ".join(
703
+ [f"`{v_parent}`" for v_parent in valid_parents]
704
+ )
705
+ raise ValueError(
706
+ f"The component `{child_name}` can only be a child of the components: {valid_parent_list}. Got `{comp_name}` instead."
707
+ )
708
+
674
709
  for child in children:
675
710
  name = type(child).__name__
676
711
 
@@ -680,6 +715,9 @@ class Component(BaseComponent, ABC):
680
715
  if self._valid_children:
681
716
  validate_valid_child(name)
682
717
 
718
+ if child._valid_parents:
719
+ validate_vaild_parent(name, child._valid_parents)
720
+
683
721
  @staticmethod
684
722
  def _get_vars_from_event_triggers(
685
723
  event_triggers: dict[str, EventChain | Var],
@@ -1,6 +1,8 @@
1
1
  """Core Reflex components."""
2
2
 
3
+ from . import layout as layout
3
4
  from .banner import ConnectionBanner, ConnectionModal
5
+ from .colors import color
4
6
  from .cond import Cond, cond
5
7
  from .debounce import DebounceInput
6
8
  from .foreach import Foreach
@@ -34,6 +34,7 @@ class WebsocketTargetURL(Bare):
34
34
  id: Optional[Any] = None,
35
35
  class_name: Optional[Any] = None,
36
36
  autofocus: Optional[bool] = None,
37
+ _rename_props: Optional[Dict[str, str]] = None,
37
38
  custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
38
39
  on_blur: Optional[
39
40
  Union[EventHandler, EventSpec, list, function, BaseVar]
@@ -102,6 +103,7 @@ class ConnectionBanner(Component):
102
103
  id: Optional[Any] = None,
103
104
  class_name: Optional[Any] = None,
104
105
  autofocus: Optional[bool] = None,
106
+ _rename_props: Optional[Dict[str, str]] = None,
105
107
  custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
106
108
  on_blur: Optional[
107
109
  Union[EventHandler, EventSpec, list, function, BaseVar]
@@ -171,6 +173,7 @@ class ConnectionModal(Component):
171
173
  id: Optional[Any] = None,
172
174
  class_name: Optional[Any] = None,
173
175
  autofocus: Optional[bool] = None,
176
+ _rename_props: Optional[Dict[str, str]] = None,
174
177
  custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
175
178
  on_blur: Optional[
176
179
  Union[EventHandler, EventSpec, list, function, BaseVar]
@@ -26,6 +26,7 @@ class ClientSideRouting(Component):
26
26
  id: Optional[Any] = None,
27
27
  class_name: Optional[Any] = None,
28
28
  autofocus: Optional[bool] = None,
29
+ _rename_props: Optional[Dict[str, str]] = None,
29
30
  custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
30
31
  on_blur: Optional[
31
32
  Union[EventHandler, EventSpec, list, function, BaseVar]
@@ -83,6 +84,7 @@ class ClientSideRouting(Component):
83
84
  id: The id for the component.
84
85
  class_name: The class name for the component.
85
86
  autofocus: Whether the component should take the focus once the page is loaded
87
+ _rename_props: props to change the name of
86
88
  custom_attrs: custom attribute
87
89
  **props: The props of the component.
88
90
 
@@ -108,6 +110,7 @@ class Default404Page(Component):
108
110
  id: Optional[Any] = None,
109
111
  class_name: Optional[Any] = None,
110
112
  autofocus: Optional[bool] = None,
113
+ _rename_props: Optional[Dict[str, str]] = None,
111
114
  custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
112
115
  on_blur: Optional[
113
116
  Union[EventHandler, EventSpec, list, function, BaseVar]
@@ -165,6 +168,7 @@ class Default404Page(Component):
165
168
  id: The id for the component.
166
169
  class_name: The class name for the component.
167
170
  autofocus: Whether the component should take the focus once the page is loaded
171
+ _rename_props: props to change the name of
168
172
  custom_attrs: custom attribute
169
173
  **props: The props of the component.
170
174
 
@@ -0,0 +1,21 @@
1
+ """The colors used in Reflex are a wrapper around https://www.radix-ui.com/colors."""
2
+
3
+ from reflex.constants.colors import Color, ColorType, ShadeType
4
+
5
+
6
+ def color(
7
+ color: ColorType,
8
+ shade: ShadeType = 7,
9
+ alpha: bool = False,
10
+ ) -> Color:
11
+ """Create a color object.
12
+
13
+ Args:
14
+ color: The color to use.
15
+ shade: The shade of the color to use.
16
+ alpha: Whether to use the alpha variant of the color.
17
+
18
+ Returns:
19
+ The color object.
20
+ """
21
+ return Color(color, shade, alpha)
@@ -59,10 +59,10 @@ class Cond(MemoizationLeaf):
59
59
  )
60
60
 
61
61
  def _get_props_imports(self):
62
- """Get the imports needed for components props.
62
+ """Get the imports needed for component's props.
63
63
 
64
64
  Returns:
65
- The imports for the components props of the component.
65
+ The imports for the component's props of the component.
66
66
  """
67
67
  return []
68
68
 
@@ -100,6 +100,15 @@ class Cond(MemoizationLeaf):
100
100
  _IS_TRUE_IMPORT,
101
101
  )
102
102
 
103
+ def _apply_theme(self, theme: Component):
104
+ """Apply the theme to this component.
105
+
106
+ Args:
107
+ theme: The theme to apply.
108
+ """
109
+ self.comp1.apply_theme(theme) # type: ignore
110
+ self.comp2.apply_theme(theme) # type: ignore
111
+
103
112
 
104
113
  @overload
105
114
  def cond(condition: Any, c1: Component, c2: Any) -> Component:
@@ -30,6 +30,7 @@ class DebounceInput(Component):
30
30
  id: Optional[Any] = None,
31
31
  class_name: Optional[Any] = None,
32
32
  autofocus: Optional[bool] = None,
33
+ _rename_props: Optional[Dict[str, str]] = None,
33
34
  custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
34
35
  on_blur: Optional[
35
36
  Union[EventHandler, EventSpec, list, function, BaseVar]
@@ -0,0 +1 @@
1
+ """Core layout components."""
@@ -5,6 +5,7 @@ from typing import Any, Dict, List, Optional, Tuple, Union
5
5
  from reflex.components.base import Fragment
6
6
  from reflex.components.component import BaseComponent, Component, MemoizationLeaf
7
7
  from reflex.components.tags import MatchTag, Tag
8
+ from reflex.style import Style
8
9
  from reflex.utils import format, imports, types
9
10
  from reflex.utils.exceptions import MatchTypeError
10
11
  from reflex.vars import BaseVar, Var, VarData
@@ -94,13 +95,33 @@ class Match(MemoizationLeaf):
94
95
  if not isinstance(cases[-1], tuple):
95
96
  default = cases.pop()
96
97
  default = (
97
- Var.create(default, _var_is_string=type(default) is str)
98
+ cls._create_case_var_with_var_data(default)
98
99
  if not isinstance(default, BaseComponent)
99
100
  else default
100
101
  )
101
102
 
102
103
  return cases, default # type: ignore
103
104
 
105
+ @classmethod
106
+ def _create_case_var_with_var_data(cls, case_element):
107
+ """Convert a case element into a Var.If the case
108
+ is a Style type, we extract the var data and merge it with the
109
+ newly created Var.
110
+
111
+ Args:
112
+ case_element: The case element.
113
+
114
+ Returns:
115
+ The case element Var.
116
+ """
117
+ _var_data = case_element._var_data if isinstance(case_element, Style) else None # type: ignore
118
+ case_element = Var.create(
119
+ case_element, _var_is_string=type(case_element) is str
120
+ )
121
+ if _var_data is not None:
122
+ case_element._var_data = VarData.merge(case_element._var_data, _var_data) # type: ignore
123
+ return case_element
124
+
104
125
  @classmethod
105
126
  def _process_match_cases(cls, cases: List) -> List[List[BaseVar]]:
106
127
  """Process the individual match cases.
@@ -130,7 +151,7 @@ class Match(MemoizationLeaf):
130
151
  for element in case:
131
152
  # convert all non component element to vars.
132
153
  el = (
133
- Var.create(element, _var_is_string=type(element) is str)
154
+ cls._create_case_var_with_var_data(element)
134
155
  if not isinstance(element, BaseComponent)
135
156
  else element
136
157
  )
@@ -199,6 +220,7 @@ class Match(MemoizationLeaf):
199
220
  cond=match_cond_var,
200
221
  match_cases=match_cases,
201
222
  default=default,
223
+ children=[case[-1] for case in match_cases] + [default], # type: ignore
202
224
  )
203
225
  )
204
226
 
@@ -243,19 +265,23 @@ class Match(MemoizationLeaf):
243
265
  tag.name = "match"
244
266
  return dict(tag)
245
267
 
246
- def _get_imports(self):
247
- merged_imports = super()._get_imports()
248
- # Obtain the imports of all components the in match case.
249
- for case in self.match_cases:
250
- if isinstance(case[-1], BaseComponent):
251
- merged_imports = imports.merge_imports(
252
- merged_imports,
253
- case[-1].get_imports(),
254
- )
255
- # Get the import of the default case component.
256
- if isinstance(self.default, BaseComponent):
257
- merged_imports = imports.merge_imports(
258
- merged_imports,
259
- self.default.get_imports(),
260
- )
261
- return merged_imports
268
+ def _get_imports(self) -> imports.ImportDict:
269
+ return imports.merge_imports(
270
+ super()._get_imports(),
271
+ getattr(self.cond._var_data, "imports", {}),
272
+ )
273
+
274
+ def _apply_theme(self, theme: Component):
275
+ """Apply the theme to this component.
276
+
277
+ Args:
278
+ theme: The theme to apply.
279
+ """
280
+ # apply theme to return components.
281
+ for match_case in self.match_cases:
282
+ if isinstance(match_case[-1], Component):
283
+ match_case[-1].apply_theme(theme)
284
+
285
+ # apply theme to default component
286
+ if isinstance(self.default, Component):
287
+ self.default.apply_theme(theme)