reflex 0.3.9a3__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 (247) hide show
  1. reflex/__init__.py +3 -1
  2. reflex/__init__.pyi +3 -1
  3. reflex/app.py +116 -86
  4. reflex/compiler/compiler.py +110 -0
  5. reflex/compiler/utils.py +13 -12
  6. reflex/components/base/app_wrap.pyi +1 -0
  7. reflex/components/base/body.pyi +2 -0
  8. reflex/components/base/document.pyi +10 -0
  9. reflex/components/base/fragment.pyi +2 -0
  10. reflex/components/base/head.pyi +4 -0
  11. reflex/components/base/link.pyi +4 -0
  12. reflex/components/base/meta.pyi +8 -0
  13. reflex/components/base/script.pyi +2 -0
  14. reflex/components/chakra/base.pyi +7 -0
  15. reflex/components/chakra/datadisplay/badge.pyi +2 -0
  16. reflex/components/chakra/datadisplay/code.pyi +4 -0
  17. reflex/components/chakra/datadisplay/divider.pyi +2 -0
  18. reflex/components/chakra/datadisplay/keyboard_key.pyi +2 -0
  19. reflex/components/chakra/datadisplay/list.pyi +8 -0
  20. reflex/components/chakra/datadisplay/stat.pyi +12 -0
  21. reflex/components/chakra/datadisplay/table.pyi +18 -0
  22. reflex/components/chakra/datadisplay/tag.pyi +9 -0
  23. reflex/components/chakra/disclosure/accordion.pyi +10 -0
  24. reflex/components/chakra/disclosure/tabs.py +8 -0
  25. reflex/components/chakra/disclosure/tabs.pyi +10 -0
  26. reflex/components/chakra/disclosure/transition.pyi +12 -0
  27. reflex/components/chakra/disclosure/visuallyhidden.pyi +2 -0
  28. reflex/components/chakra/feedback/alert.pyi +8 -0
  29. reflex/components/chakra/feedback/circularprogress.pyi +4 -0
  30. reflex/components/chakra/feedback/progress.pyi +2 -0
  31. reflex/components/chakra/feedback/skeleton.pyi +6 -0
  32. reflex/components/chakra/feedback/spinner.pyi +2 -0
  33. reflex/components/chakra/forms/button.pyi +4 -0
  34. reflex/components/chakra/forms/checkbox.pyi +4 -0
  35. reflex/components/chakra/forms/colormodeswitch.pyi +7 -0
  36. reflex/components/chakra/forms/date_picker.pyi +2 -0
  37. reflex/components/chakra/forms/date_time_picker.pyi +2 -0
  38. reflex/components/chakra/forms/editable.pyi +8 -0
  39. reflex/components/chakra/forms/email.pyi +2 -0
  40. reflex/components/chakra/forms/form.pyi +10 -0
  41. reflex/components/chakra/forms/iconbutton.py +1 -0
  42. reflex/components/chakra/forms/iconbutton.pyi +2 -0
  43. reflex/components/chakra/forms/input.pyi +12 -0
  44. reflex/components/chakra/forms/numberinput.pyi +10 -0
  45. reflex/components/chakra/forms/password.pyi +2 -0
  46. reflex/components/chakra/forms/pininput.pyi +4 -0
  47. reflex/components/chakra/forms/radio.pyi +4 -0
  48. reflex/components/chakra/forms/rangeslider.pyi +8 -0
  49. reflex/components/chakra/forms/select.pyi +4 -0
  50. reflex/components/chakra/forms/slider.pyi +10 -0
  51. reflex/components/chakra/forms/switch.pyi +2 -0
  52. reflex/components/chakra/forms/textarea.pyi +2 -0
  53. reflex/components/chakra/forms/time_picker.pyi +2 -0
  54. reflex/components/chakra/layout/aspect_ratio.pyi +2 -0
  55. reflex/components/chakra/layout/box.pyi +2 -0
  56. reflex/components/chakra/layout/card.pyi +7 -0
  57. reflex/components/chakra/layout/center.pyi +6 -0
  58. reflex/components/chakra/layout/container.pyi +2 -0
  59. reflex/components/chakra/layout/flex.pyi +2 -0
  60. reflex/components/chakra/layout/grid.pyi +6 -0
  61. reflex/components/chakra/layout/html.pyi +2 -0
  62. reflex/components/chakra/layout/spacer.pyi +2 -0
  63. reflex/components/chakra/layout/stack.pyi +6 -0
  64. reflex/components/chakra/layout/wrap.pyi +4 -0
  65. reflex/components/chakra/media/avatar.pyi +6 -0
  66. reflex/components/chakra/media/icon.pyi +4 -0
  67. reflex/components/chakra/media/image.pyi +2 -0
  68. reflex/components/chakra/navigation/breadcrumb.pyi +8 -0
  69. reflex/components/chakra/navigation/link.pyi +2 -0
  70. reflex/components/chakra/navigation/linkoverlay.pyi +4 -0
  71. reflex/components/chakra/navigation/stepper.pyi +18 -0
  72. reflex/components/chakra/overlay/alertdialog.pyi +14 -0
  73. reflex/components/chakra/overlay/drawer.pyi +14 -0
  74. reflex/components/chakra/overlay/menu.pyi +16 -0
  75. reflex/components/chakra/overlay/modal.pyi +14 -0
  76. reflex/components/chakra/overlay/popover.pyi +18 -0
  77. reflex/components/chakra/overlay/tooltip.pyi +2 -0
  78. reflex/components/chakra/typography/heading.pyi +2 -0
  79. reflex/components/chakra/typography/highlight.pyi +2 -0
  80. reflex/components/chakra/typography/span.pyi +2 -0
  81. reflex/components/chakra/typography/text.pyi +2 -0
  82. reflex/components/component.py +41 -3
  83. reflex/components/core/__init__.py +2 -0
  84. reflex/components/core/banner.pyi +3 -0
  85. reflex/components/core/client_side_routing.pyi +4 -0
  86. reflex/components/core/colors.py +21 -0
  87. reflex/components/core/cond.py +11 -2
  88. reflex/components/core/debounce.pyi +1 -0
  89. reflex/components/core/layout/__init__.py +1 -0
  90. reflex/components/core/match.py +44 -18
  91. reflex/components/core/upload.py +8 -2
  92. reflex/components/core/upload.pyi +7 -1
  93. reflex/components/datadisplay/dataeditor.pyi +2 -0
  94. reflex/components/el/element.pyi +2 -0
  95. reflex/components/el/elements/base.pyi +2 -0
  96. reflex/components/el/elements/forms.py +3 -0
  97. reflex/components/el/elements/forms.pyi +32 -0
  98. reflex/components/el/elements/inline.pyi +56 -0
  99. reflex/components/el/elements/media.pyi +28 -0
  100. reflex/components/el/elements/metadata.pyi +10 -0
  101. reflex/components/el/elements/other.pyi +14 -0
  102. reflex/components/el/elements/scripts.pyi +6 -0
  103. reflex/components/el/elements/sectioning.pyi +30 -0
  104. reflex/components/el/elements/tables.pyi +20 -0
  105. reflex/components/el/elements/typography.pyi +30 -0
  106. reflex/components/gridjs/datatable.pyi +4 -0
  107. reflex/components/lucide/__init__.py +5 -0
  108. reflex/components/lucide/icon.py +1484 -0
  109. reflex/components/lucide/icon.pyi +1594 -0
  110. reflex/components/markdown/markdown.pyi +2 -0
  111. reflex/components/moment/moment.pyi +2 -0
  112. reflex/components/next/base.pyi +2 -0
  113. reflex/components/next/image.pyi +2 -0
  114. reflex/components/next/link.pyi +2 -0
  115. reflex/components/next/video.pyi +2 -0
  116. reflex/components/plotly/plotly.pyi +4 -0
  117. reflex/components/radix/primitives/__init__.py +10 -0
  118. reflex/components/radix/primitives/accordion.py +51 -32
  119. reflex/components/radix/primitives/accordion.pyi +16 -3
  120. reflex/components/radix/primitives/base.pyi +4 -0
  121. reflex/components/radix/primitives/drawer.py +240 -0
  122. reflex/components/radix/primitives/drawer.pyi +814 -0
  123. reflex/components/radix/primitives/form.py +40 -7
  124. reflex/components/radix/primitives/form.pyi +32 -10
  125. reflex/components/radix/primitives/progress.py +2 -2
  126. reflex/components/radix/primitives/progress.pyi +6 -0
  127. reflex/components/radix/primitives/slider.pyi +10 -0
  128. reflex/components/radix/themes/base.py +46 -12
  129. reflex/components/radix/themes/base.pyi +23 -9
  130. reflex/components/radix/themes/components/__init__.py +4 -2
  131. reflex/components/radix/themes/components/alertdialog.py +13 -12
  132. reflex/components/radix/themes/components/alertdialog.pyi +23 -351
  133. reflex/components/radix/themes/components/aspectratio.py +2 -5
  134. reflex/components/radix/themes/components/aspectratio.pyi +4 -51
  135. reflex/components/radix/themes/components/avatar.py +3 -4
  136. reflex/components/radix/themes/components/avatar.pyi +4 -57
  137. reflex/components/radix/themes/components/badge.py +3 -4
  138. reflex/components/radix/themes/components/badge.pyi +4 -56
  139. reflex/components/radix/themes/components/button.py +2 -3
  140. reflex/components/radix/themes/components/button.pyi +3 -51
  141. reflex/components/radix/themes/components/callout.py +9 -12
  142. reflex/components/radix/themes/components/callout.pyi +24 -217
  143. reflex/components/radix/themes/components/card.py +1 -2
  144. reflex/components/radix/themes/components/card.pyi +4 -51
  145. reflex/components/radix/themes/components/checkbox.py +11 -5
  146. reflex/components/radix/themes/components/checkbox.pyi +13 -112
  147. reflex/components/radix/themes/components/contextmenu.py +21 -21
  148. reflex/components/radix/themes/components/contextmenu.pyi +26 -401
  149. reflex/components/radix/themes/components/dialog.py +13 -16
  150. reflex/components/radix/themes/components/dialog.pyi +20 -303
  151. reflex/components/radix/themes/components/dropdownmenu.py +196 -32
  152. reflex/components/radix/themes/components/dropdownmenu.pyi +147 -389
  153. reflex/components/radix/themes/components/hovercard.py +5 -5
  154. reflex/components/radix/themes/components/hovercard.pyi +11 -151
  155. reflex/components/radix/themes/components/iconbutton.py +56 -4
  156. reflex/components/radix/themes/components/iconbutton.pyi +25 -71
  157. reflex/components/radix/themes/components/icons.pyi +4 -0
  158. reflex/components/radix/themes/components/inset.py +1 -2
  159. reflex/components/radix/themes/components/inset.pyi +4 -51
  160. reflex/components/radix/themes/components/popover.py +12 -12
  161. reflex/components/radix/themes/components/popover.pyi +14 -201
  162. reflex/components/radix/themes/components/radiogroup.py +47 -20
  163. reflex/components/radix/themes/components/radiogroup.pyi +26 -171
  164. reflex/components/radix/themes/components/scrollarea.py +2 -3
  165. reflex/components/radix/themes/components/scrollarea.pyi +4 -51
  166. reflex/components/radix/themes/components/select.py +28 -25
  167. reflex/components/radix/themes/components/select.pyi +43 -419
  168. reflex/components/radix/themes/components/separator.py +4 -5
  169. reflex/components/radix/themes/components/separator.pyi +5 -52
  170. reflex/components/radix/themes/components/slider.py +8 -5
  171. reflex/components/radix/themes/components/slider.pyi +9 -60
  172. reflex/components/radix/themes/components/switch.py +6 -4
  173. reflex/components/radix/themes/components/switch.pyi +5 -53
  174. reflex/components/radix/themes/components/table.py +14 -15
  175. reflex/components/radix/themes/components/table.pyi +22 -351
  176. reflex/components/radix/themes/components/tabs.py +9 -6
  177. reflex/components/radix/themes/components/tabs.pyi +18 -205
  178. reflex/components/radix/themes/components/textarea.py +2 -3
  179. reflex/components/radix/themes/components/textarea.pyi +10 -53
  180. reflex/components/radix/themes/components/textfield.py +105 -4
  181. reflex/components/radix/themes/components/textfield.pyi +200 -108
  182. reflex/components/radix/themes/components/tooltip.py +102 -2
  183. reflex/components/radix/themes/components/tooltip.pyi +66 -110
  184. reflex/components/radix/themes/layout/__init__.py +7 -0
  185. reflex/components/radix/themes/layout/base.pyi +2 -0
  186. reflex/components/radix/themes/layout/box.py +2 -2
  187. reflex/components/radix/themes/layout/box.pyi +4 -104
  188. reflex/components/radix/themes/layout/center.py +19 -0
  189. reflex/components/radix/themes/layout/center.pyi +261 -0
  190. reflex/components/radix/themes/layout/container.py +2 -2
  191. reflex/components/radix/themes/layout/container.pyi +4 -104
  192. reflex/components/radix/themes/layout/flex.py +2 -2
  193. reflex/components/radix/themes/layout/flex.pyi +4 -105
  194. reflex/components/radix/themes/layout/grid.pyi +2 -0
  195. reflex/components/radix/themes/layout/section.py +2 -2
  196. reflex/components/radix/themes/layout/section.pyi +4 -104
  197. reflex/components/radix/themes/layout/spacer.py +19 -0
  198. reflex/components/radix/themes/layout/spacer.pyi +261 -0
  199. reflex/components/radix/themes/layout/stack.py +60 -0
  200. reflex/components/radix/themes/layout/stack.pyi +537 -0
  201. reflex/components/radix/themes/typography/blockquote.py +2 -3
  202. reflex/components/radix/themes/typography/blockquote.pyi +4 -51
  203. reflex/components/radix/themes/typography/code.py +2 -3
  204. reflex/components/radix/themes/typography/code.pyi +4 -56
  205. reflex/components/radix/themes/typography/em.py +1 -2
  206. reflex/components/radix/themes/typography/em.pyi +4 -51
  207. reflex/components/radix/themes/typography/heading.py +2 -3
  208. reflex/components/radix/themes/typography/heading.pyi +4 -51
  209. reflex/components/radix/themes/typography/kbd.py +1 -2
  210. reflex/components/radix/themes/typography/kbd.pyi +4 -51
  211. reflex/components/radix/themes/typography/link.py +34 -3
  212. reflex/components/radix/themes/typography/link.pyi +41 -86
  213. reflex/components/radix/themes/typography/quote.py +1 -2
  214. reflex/components/radix/themes/typography/quote.pyi +4 -51
  215. reflex/components/radix/themes/typography/strong.py +1 -2
  216. reflex/components/radix/themes/typography/strong.pyi +4 -51
  217. reflex/components/radix/themes/typography/text.py +2 -3
  218. reflex/components/radix/themes/typography/text.pyi +4 -51
  219. reflex/components/radix/themes/typography.py +10 -11
  220. reflex/components/react_player/audio.pyi +2 -0
  221. reflex/components/react_player/react_player.pyi +2 -0
  222. reflex/components/react_player/video.pyi +2 -0
  223. reflex/components/recharts/cartesian.pyi +38 -0
  224. reflex/components/recharts/charts.pyi +22 -0
  225. reflex/components/recharts/general.pyi +10 -0
  226. reflex/components/recharts/polar.pyi +12 -0
  227. reflex/components/recharts/recharts.pyi +4 -0
  228. reflex/components/suneditor/editor.pyi +2 -0
  229. reflex/components/tags/tag.py +1 -1
  230. reflex/constants/base.py +5 -1
  231. reflex/constants/colors.py +80 -0
  232. reflex/constants/event.py +10 -1
  233. reflex/page.py +1 -1
  234. reflex/reflex.py +4 -0
  235. reflex/style.py +8 -3
  236. reflex/testing.py +21 -10
  237. reflex/utils/format.py +13 -9
  238. reflex/utils/prerequisites.py +41 -3
  239. reflex/utils/serializers.py +14 -0
  240. reflex/utils/telemetry.py +8 -2
  241. reflex/utils/types.py +36 -2
  242. reflex/vars.py +53 -18
  243. {reflex-0.3.9a3.dist-info → reflex-0.3.10.dist-info}/METADATA +1 -2
  244. {reflex-0.3.9a3.dist-info → reflex-0.3.10.dist-info}/RECORD +247 -233
  245. {reflex-0.3.9a3.dist-info → reflex-0.3.10.dist-info}/WHEEL +1 -1
  246. {reflex-0.3.9a3.dist-info → reflex-0.3.10.dist-info}/LICENSE +0 -0
  247. {reflex-0.3.9a3.dist-info → reflex-0.3.10.dist-info}/entry_points.txt +0 -0
@@ -10,11 +10,11 @@ from reflex.style import Style
10
10
  from typing import Literal, Union
11
11
  from reflex import el
12
12
  from reflex.vars import Var
13
- from ..base import CommonMarginProps, RadixThemesComponent
13
+ from ..base import RadixThemesComponent
14
14
 
15
15
  LiteralButtonSize = Literal["1", "2", "3", "4"]
16
16
 
17
- class Inset(el.Div, CommonMarginProps, RadixThemesComponent):
17
+ class Inset(el.Div, RadixThemesComponent):
18
18
  @overload
19
19
  @classmethod
20
20
  def create( # type: ignore
@@ -145,53 +145,12 @@ class Inset(el.Div, CommonMarginProps, RadixThemesComponent):
145
145
  translate: Optional[
146
146
  Union[Var[Union[str, int, bool]], Union[str, int, bool]]
147
147
  ] = None,
148
- m: Optional[
149
- Union[
150
- Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
151
- Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
152
- ]
153
- ] = None,
154
- mx: Optional[
155
- Union[
156
- Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
157
- Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
158
- ]
159
- ] = None,
160
- my: Optional[
161
- Union[
162
- Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
163
- Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
164
- ]
165
- ] = None,
166
- mt: Optional[
167
- Union[
168
- Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
169
- Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
170
- ]
171
- ] = None,
172
- mr: Optional[
173
- Union[
174
- Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
175
- Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
176
- ]
177
- ] = None,
178
- mb: Optional[
179
- Union[
180
- Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
181
- Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
182
- ]
183
- ] = None,
184
- ml: Optional[
185
- Union[
186
- Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
187
- Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
188
- ]
189
- ] = None,
190
148
  style: Optional[Style] = None,
191
149
  key: Optional[Any] = None,
192
150
  id: Optional[Any] = None,
193
151
  class_name: Optional[Any] = None,
194
152
  autofocus: Optional[bool] = None,
153
+ _rename_props: Optional[Dict[str, str]] = None,
195
154
  custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
196
155
  on_blur: Optional[
197
156
  Union[EventHandler, EventSpec, list, function, BaseVar]
@@ -275,18 +234,12 @@ class Inset(el.Div, CommonMarginProps, RadixThemesComponent):
275
234
  tab_index: Defines the position of the current element in the tabbing order.
276
235
  title: Defines a tooltip for the element.
277
236
  translate: Specifies whether the content of an element should be translated or not.
278
- m: Margin: "0" - "9"
279
- mx: Margin horizontal: "0" - "9"
280
- my: Margin vertical: "0" - "9"
281
- mt: Margin top: "0" - "9"
282
- mr: Margin right: "0" - "9"
283
- mb: Margin bottom: "0" - "9"
284
- ml: Margin left: "0" - "9"
285
237
  style: The style of the component.
286
238
  key: A unique key for the component.
287
239
  id: The id for the component.
288
240
  class_name: The class name for the component.
289
241
  autofocus: Whether the component should take the focus once the page is loaded
242
+ _rename_props: props to change the name of
290
243
  custom_attrs: custom attribute
291
244
  **props: Component properties.
292
245
 
@@ -2,15 +2,15 @@
2
2
  from typing import Any, Dict, Literal
3
3
 
4
4
  from reflex import el
5
+ from reflex.constants import EventTriggers
5
6
  from reflex.vars import Var
6
7
 
7
8
  from ..base import (
8
- CommonMarginProps,
9
9
  RadixThemesComponent,
10
10
  )
11
11
 
12
12
 
13
- class PopoverRoot(CommonMarginProps, RadixThemesComponent):
13
+ class PopoverRoot(RadixThemesComponent):
14
14
  """Trigger an action or event, such as submitting a form or displaying a dialog."""
15
15
 
16
16
  tag = "Popover.Root"
@@ -29,17 +29,17 @@ class PopoverRoot(CommonMarginProps, RadixThemesComponent):
29
29
  """
30
30
  return {
31
31
  **super().get_event_triggers(),
32
- "on_open_change": lambda e0: [e0],
32
+ EventTriggers.ON_OPEN_CHANGE: lambda e0: [e0],
33
33
  }
34
34
 
35
35
 
36
- class PopoverTrigger(CommonMarginProps, RadixThemesComponent):
36
+ class PopoverTrigger(RadixThemesComponent):
37
37
  """Trigger an action or event, such as submitting a form or displaying a dialog."""
38
38
 
39
39
  tag = "Popover.Trigger"
40
40
 
41
41
 
42
- class PopoverContent(el.Div, CommonMarginProps, RadixThemesComponent):
42
+ class PopoverContent(el.Div, RadixThemesComponent):
43
43
  """Trigger an action or event, such as submitting a form or displaying a dialog."""
44
44
 
45
45
  tag = "Popover.Content"
@@ -70,16 +70,16 @@ class PopoverContent(el.Div, CommonMarginProps, RadixThemesComponent):
70
70
  """
71
71
  return {
72
72
  **super().get_event_triggers(),
73
- "on_open_auto_focus": lambda e0: [e0],
74
- "on_close_auto_focus": lambda e0: [e0],
75
- "on_escape_key_down": lambda e0: [e0],
76
- "on_pointer_down_outside": lambda e0: [e0],
77
- "on_focus_outside": lambda e0: [e0],
78
- "on_interact_outside": lambda e0: [e0],
73
+ EventTriggers.ON_OPEN_AUTO_FOCUS: lambda e0: [e0],
74
+ EventTriggers.ON_CLOSE_AUTO_FOCUS: lambda e0: [e0],
75
+ EventTriggers.ON_ESCAPE_KEY_DOWN: lambda e0: [e0],
76
+ EventTriggers.ON_POINTER_DOWN_OUTSIDE: lambda e0: [e0],
77
+ EventTriggers.ON_FOCUS_OUTSIDE: lambda e0: [e0],
78
+ EventTriggers.ON_INTERACT_OUTSIDE: lambda e0: [e0],
79
79
  }
80
80
 
81
81
 
82
- class PopoverClose(CommonMarginProps, RadixThemesComponent):
82
+ class PopoverClose(RadixThemesComponent):
83
83
  """Trigger an action or event, such as submitting a form or displaying a dialog."""
84
84
 
85
85
  tag = "Popover.Close"
@@ -9,10 +9,11 @@ from reflex.event import EventChain, EventHandler, EventSpec
9
9
  from reflex.style import Style
10
10
  from typing import Any, Dict, Literal
11
11
  from reflex import el
12
+ from reflex.constants import EventTriggers
12
13
  from reflex.vars import Var
13
- from ..base import CommonMarginProps, RadixThemesComponent
14
+ from ..base import RadixThemesComponent
14
15
 
15
- class PopoverRoot(CommonMarginProps, RadixThemesComponent):
16
+ class PopoverRoot(RadixThemesComponent):
16
17
  def get_event_triggers(self) -> Dict[str, Any]: ...
17
18
  @overload
18
19
  @classmethod
@@ -84,53 +85,12 @@ class PopoverRoot(CommonMarginProps, RadixThemesComponent):
84
85
  ] = None,
85
86
  open: Optional[Union[Var[bool], bool]] = None,
86
87
  modal: Optional[Union[Var[bool], bool]] = None,
87
- m: Optional[
88
- Union[
89
- Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
90
- Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
91
- ]
92
- ] = None,
93
- mx: Optional[
94
- Union[
95
- Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
96
- Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
97
- ]
98
- ] = None,
99
- my: Optional[
100
- Union[
101
- Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
102
- Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
103
- ]
104
- ] = None,
105
- mt: Optional[
106
- Union[
107
- Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
108
- Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
109
- ]
110
- ] = None,
111
- mr: Optional[
112
- Union[
113
- Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
114
- Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
115
- ]
116
- ] = None,
117
- mb: Optional[
118
- Union[
119
- Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
120
- Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
121
- ]
122
- ] = None,
123
- ml: Optional[
124
- Union[
125
- Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
126
- Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
127
- ]
128
- ] = None,
129
88
  style: Optional[Style] = None,
130
89
  key: Optional[Any] = None,
131
90
  id: Optional[Any] = None,
132
91
  class_name: Optional[Any] = None,
133
92
  autofocus: Optional[bool] = None,
93
+ _rename_props: Optional[Dict[str, str]] = None,
134
94
  custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
135
95
  on_blur: Optional[
136
96
  Union[EventHandler, EventSpec, list, function, BaseVar]
@@ -193,18 +153,12 @@ class PopoverRoot(CommonMarginProps, RadixThemesComponent):
193
153
  color_scheme: map to radix color property.
194
154
  open: The controlled open state of the popover.
195
155
  modal: The modality of the popover. When set to true, interaction with outside elements will be disabled and only popover content will be visible to screen readers.
196
- m: Margin: "0" - "9"
197
- mx: Margin horizontal: "0" - "9"
198
- my: Margin vertical: "0" - "9"
199
- mt: Margin top: "0" - "9"
200
- mr: Margin right: "0" - "9"
201
- mb: Margin bottom: "0" - "9"
202
- ml: Margin left: "0" - "9"
203
156
  style: The style of the component.
204
157
  key: A unique key for the component.
205
158
  id: The id for the component.
206
159
  class_name: The class name for the component.
207
160
  autofocus: Whether the component should take the focus once the page is loaded
161
+ _rename_props: props to change the name of
208
162
  custom_attrs: custom attribute
209
163
  **props: Component properties.
210
164
 
@@ -213,7 +167,7 @@ class PopoverRoot(CommonMarginProps, RadixThemesComponent):
213
167
  """
214
168
  ...
215
169
 
216
- class PopoverTrigger(CommonMarginProps, RadixThemesComponent):
170
+ class PopoverTrigger(RadixThemesComponent):
217
171
  @overload
218
172
  @classmethod
219
173
  def create( # type: ignore
@@ -282,53 +236,12 @@ class PopoverTrigger(CommonMarginProps, RadixThemesComponent):
282
236
  ],
283
237
  ]
284
238
  ] = None,
285
- m: Optional[
286
- Union[
287
- Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
288
- Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
289
- ]
290
- ] = None,
291
- mx: Optional[
292
- Union[
293
- Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
294
- Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
295
- ]
296
- ] = None,
297
- my: Optional[
298
- Union[
299
- Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
300
- Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
301
- ]
302
- ] = None,
303
- mt: Optional[
304
- Union[
305
- Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
306
- Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
307
- ]
308
- ] = None,
309
- mr: Optional[
310
- Union[
311
- Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
312
- Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
313
- ]
314
- ] = None,
315
- mb: Optional[
316
- Union[
317
- Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
318
- Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
319
- ]
320
- ] = None,
321
- ml: Optional[
322
- Union[
323
- Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
324
- Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
325
- ]
326
- ] = None,
327
239
  style: Optional[Style] = None,
328
240
  key: Optional[Any] = None,
329
241
  id: Optional[Any] = None,
330
242
  class_name: Optional[Any] = None,
331
243
  autofocus: Optional[bool] = None,
244
+ _rename_props: Optional[Dict[str, str]] = None,
332
245
  custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
333
246
  on_blur: Optional[
334
247
  Union[EventHandler, EventSpec, list, function, BaseVar]
@@ -386,18 +299,12 @@ class PopoverTrigger(CommonMarginProps, RadixThemesComponent):
386
299
  *children: Child components.
387
300
  color: map to CSS default color property.
388
301
  color_scheme: map to radix color property.
389
- m: Margin: "0" - "9"
390
- mx: Margin horizontal: "0" - "9"
391
- my: Margin vertical: "0" - "9"
392
- mt: Margin top: "0" - "9"
393
- mr: Margin right: "0" - "9"
394
- mb: Margin bottom: "0" - "9"
395
- ml: Margin left: "0" - "9"
396
302
  style: The style of the component.
397
303
  key: A unique key for the component.
398
304
  id: The id for the component.
399
305
  class_name: The class name for the component.
400
306
  autofocus: Whether the component should take the focus once the page is loaded
307
+ _rename_props: props to change the name of
401
308
  custom_attrs: custom attribute
402
309
  **props: Component properties.
403
310
 
@@ -406,7 +313,7 @@ class PopoverTrigger(CommonMarginProps, RadixThemesComponent):
406
313
  """
407
314
  ...
408
315
 
409
- class PopoverContent(el.Div, CommonMarginProps, RadixThemesComponent):
316
+ class PopoverContent(el.Div, RadixThemesComponent):
410
317
  def get_event_triggers(self) -> Dict[str, Any]: ...
411
318
  @overload
412
319
  @classmethod
@@ -535,53 +442,12 @@ class PopoverContent(el.Div, CommonMarginProps, RadixThemesComponent):
535
442
  translate: Optional[
536
443
  Union[Var[Union[str, int, bool]], Union[str, int, bool]]
537
444
  ] = None,
538
- m: Optional[
539
- Union[
540
- Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
541
- Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
542
- ]
543
- ] = None,
544
- mx: Optional[
545
- Union[
546
- Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
547
- Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
548
- ]
549
- ] = None,
550
- my: Optional[
551
- Union[
552
- Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
553
- Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
554
- ]
555
- ] = None,
556
- mt: Optional[
557
- Union[
558
- Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
559
- Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
560
- ]
561
- ] = None,
562
- mr: Optional[
563
- Union[
564
- Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
565
- Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
566
- ]
567
- ] = None,
568
- mb: Optional[
569
- Union[
570
- Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
571
- Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
572
- ]
573
- ] = None,
574
- ml: Optional[
575
- Union[
576
- Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
577
- Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
578
- ]
579
- ] = None,
580
445
  style: Optional[Style] = None,
581
446
  key: Optional[Any] = None,
582
447
  id: Optional[Any] = None,
583
448
  class_name: Optional[Any] = None,
584
449
  autofocus: Optional[bool] = None,
450
+ _rename_props: Optional[Dict[str, str]] = None,
585
451
  custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
586
452
  on_blur: Optional[
587
453
  Union[EventHandler, EventSpec, list, function, BaseVar]
@@ -680,18 +546,12 @@ class PopoverContent(el.Div, CommonMarginProps, RadixThemesComponent):
680
546
  tab_index: Defines the position of the current element in the tabbing order.
681
547
  title: Defines a tooltip for the element.
682
548
  translate: Specifies whether the content of an element should be translated or not.
683
- m: Margin: "0" - "9"
684
- mx: Margin horizontal: "0" - "9"
685
- my: Margin vertical: "0" - "9"
686
- mt: Margin top: "0" - "9"
687
- mr: Margin right: "0" - "9"
688
- mb: Margin bottom: "0" - "9"
689
- ml: Margin left: "0" - "9"
690
549
  style: The style of the component.
691
550
  key: A unique key for the component.
692
551
  id: The id for the component.
693
552
  class_name: The class name for the component.
694
553
  autofocus: Whether the component should take the focus once the page is loaded
554
+ _rename_props: props to change the name of
695
555
  custom_attrs: custom attribute
696
556
  **props: Component properties.
697
557
 
@@ -700,7 +560,7 @@ class PopoverContent(el.Div, CommonMarginProps, RadixThemesComponent):
700
560
  """
701
561
  ...
702
562
 
703
- class PopoverClose(CommonMarginProps, RadixThemesComponent):
563
+ class PopoverClose(RadixThemesComponent):
704
564
  @overload
705
565
  @classmethod
706
566
  def create( # type: ignore
@@ -769,53 +629,12 @@ class PopoverClose(CommonMarginProps, RadixThemesComponent):
769
629
  ],
770
630
  ]
771
631
  ] = None,
772
- m: Optional[
773
- Union[
774
- Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
775
- Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
776
- ]
777
- ] = None,
778
- mx: Optional[
779
- Union[
780
- Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
781
- Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
782
- ]
783
- ] = None,
784
- my: Optional[
785
- Union[
786
- Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
787
- Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
788
- ]
789
- ] = None,
790
- mt: Optional[
791
- Union[
792
- Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
793
- Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
794
- ]
795
- ] = None,
796
- mr: Optional[
797
- Union[
798
- Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
799
- Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
800
- ]
801
- ] = None,
802
- mb: Optional[
803
- Union[
804
- Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
805
- Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
806
- ]
807
- ] = None,
808
- ml: Optional[
809
- Union[
810
- Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
811
- Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
812
- ]
813
- ] = None,
814
632
  style: Optional[Style] = None,
815
633
  key: Optional[Any] = None,
816
634
  id: Optional[Any] = None,
817
635
  class_name: Optional[Any] = None,
818
636
  autofocus: Optional[bool] = None,
637
+ _rename_props: Optional[Dict[str, str]] = None,
819
638
  custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
820
639
  on_blur: Optional[
821
640
  Union[EventHandler, EventSpec, list, function, BaseVar]
@@ -873,18 +692,12 @@ class PopoverClose(CommonMarginProps, RadixThemesComponent):
873
692
  *children: Child components.
874
693
  color: map to CSS default color property.
875
694
  color_scheme: map to radix color property.
876
- m: Margin: "0" - "9"
877
- mx: Margin horizontal: "0" - "9"
878
- my: Margin vertical: "0" - "9"
879
- mt: Margin top: "0" - "9"
880
- mr: Margin right: "0" - "9"
881
- mb: Margin bottom: "0" - "9"
882
- ml: Margin left: "0" - "9"
883
695
  style: The style of the component.
884
696
  key: A unique key for the component.
885
697
  id: The id for the component.
886
698
  class_name: The class name for the component.
887
699
  autofocus: Whether the component should take the focus once the page is loaded
700
+ _rename_props: props to change the name of
888
701
  custom_attrs: custom attribute
889
702
  **props: Component properties.
890
703
 
@@ -1,14 +1,14 @@
1
1
  """Interactive components provided by @radix-ui/themes."""
2
- from typing import Any, Dict, List, Literal
2
+ from typing import Any, Dict, List, Literal, Optional, Union
3
3
 
4
4
  import reflex as rx
5
5
  from reflex.components.component import Component
6
6
  from reflex.components.radix.themes.layout.flex import Flex
7
7
  from reflex.components.radix.themes.typography.text import Text
8
+ from reflex.constants import EventTriggers
8
9
  from reflex.vars import Var
9
10
 
10
11
  from ..base import (
11
- CommonMarginProps,
12
12
  LiteralAccentColor,
13
13
  LiteralSize,
14
14
  RadixThemesComponent,
@@ -17,8 +17,8 @@ from ..base import (
17
17
  LiteralFlexDirection = Literal["row", "column", "row-reverse", "column-reverse"]
18
18
 
19
19
 
20
- class RadioGroupRoot(CommonMarginProps, RadixThemesComponent):
21
- """Trigger an action or event, such as submitting a form or displaying a dialog."""
20
+ class RadioGroupRoot(RadixThemesComponent):
21
+ """A set of interactive radio buttons where only one can be selected at a time."""
22
22
 
23
23
  tag = "RadioGroup.Root"
24
24
 
@@ -29,15 +29,15 @@ class RadioGroupRoot(CommonMarginProps, RadixThemesComponent):
29
29
  variant: Var[Literal["classic", "surface", "soft"]]
30
30
 
31
31
  # The color of the radio group
32
- color: Var[LiteralAccentColor]
32
+ color_scheme: Var[LiteralAccentColor]
33
33
 
34
34
  # Whether to render the radio group with higher contrast color against background
35
35
  high_contrast: Var[bool]
36
36
 
37
- # The controlled value of the radio item to check. Should be used in conjunction with onValueChange.
37
+ # The controlled value of the radio item to check. Should be used in conjunction with on_change.
38
38
  value: Var[str]
39
39
 
40
- # The initial value of checked radio item. Should be used in conjunction with onValueChange.
40
+ # The initial value of checked radio item. Should be used in conjunction with on_change.
41
41
  default_value: Var[str]
42
42
 
43
43
  # Whether the radio group is disabled
@@ -55,6 +55,9 @@ class RadioGroupRoot(CommonMarginProps, RadixThemesComponent):
55
55
  # When true, keyboard navigation will loop from last item to first, and vice versa.
56
56
  loop: Var[bool]
57
57
 
58
+ # Props to rename
59
+ _rename_props = {"onChange": "onValueChange"}
60
+
58
61
  def get_event_triggers(self) -> Dict[str, Any]:
59
62
  """Get the events triggers signatures for the component.
60
63
 
@@ -63,16 +66,16 @@ class RadioGroupRoot(CommonMarginProps, RadixThemesComponent):
63
66
  """
64
67
  return {
65
68
  **super().get_event_triggers(),
66
- "on_value_change": lambda e0: [e0],
69
+ EventTriggers.ON_CHANGE: lambda e0: [e0],
67
70
  }
68
71
 
69
72
 
70
- class RadioGroupItem(CommonMarginProps, RadixThemesComponent):
71
- """Trigger an action or event, such as submitting a form or displaying a dialog."""
73
+ class RadioGroupItem(RadixThemesComponent):
74
+ """An item in the group that can be checked."""
72
75
 
73
76
  tag = "RadioGroup.Item"
74
77
 
75
- # The value of the radio item to check. Should be used in conjunction with onCheckedChange.
78
+ # The value of the radio item to check. Should be used in conjunction with on_change.
76
79
  value: Var[str]
77
80
 
78
81
  # When true, prevents the user from interacting with the radio item.
@@ -98,7 +101,11 @@ class HighLevelRadioGroup(RadioGroupRoot):
98
101
  size: Var[Literal["1", "2", "3"]] = Var.create_safe("2")
99
102
 
100
103
  @classmethod
101
- def create(cls, items: Var[List[str]], **props) -> Component:
104
+ def create(
105
+ cls,
106
+ items: Var[List[Optional[Union[str, int, float, list, dict, bool]]]],
107
+ **props
108
+ ) -> Component:
102
109
  """Create a radio group component.
103
110
 
104
111
  Args:
@@ -111,29 +118,49 @@ class HighLevelRadioGroup(RadioGroupRoot):
111
118
  direction = props.pop("direction", "column")
112
119
  gap = props.pop("gap", "2")
113
120
  size = props.pop("size", "2")
121
+ default_value = props.pop("default_value", "")
122
+
123
+ # convert only non-strings to json(JSON.stringify) so quotes are not rendered
124
+ # for string literal types.
125
+ if (
126
+ type(default_value) is str
127
+ or isinstance(default_value, Var)
128
+ and default_value._var_type is str
129
+ ):
130
+ default_value = Var.create(default_value, _var_is_string=True) # type: ignore
131
+ else:
132
+ default_value = (
133
+ Var.create(default_value).to_string()._replace(_var_is_local=False) # type: ignore
134
+ )
135
+
136
+ def radio_group_item(value: str | Var) -> Component:
137
+ item_value = Var.create(value) # type: ignore
138
+ item_value = rx.cond(
139
+ item_value._type() == str, # type: ignore
140
+ item_value,
141
+ item_value.to_string()._replace(_var_is_local=False), # type: ignore
142
+ )._replace(_var_type=str)
114
143
 
115
- def radio_group_item(value: str) -> Component:
116
144
  return Text.create(
117
145
  Flex.create(
118
- RadioGroupItem.create(value=value),
119
- value,
146
+ RadioGroupItem.create(value=item_value),
147
+ item_value,
120
148
  gap="2",
121
149
  ),
122
150
  size=size,
123
151
  as_="label",
124
152
  )
125
153
 
126
- if isinstance(items, Var):
127
- child = [rx.foreach(items, radio_group_item)]
128
- else:
129
- child = [radio_group_item(value) for value in items] # type: ignore
154
+ items = Var.create(items) # type: ignore
155
+ children = [rx.foreach(items, radio_group_item)]
130
156
 
131
157
  return RadioGroupRoot.create(
132
158
  Flex.create(
133
- *child,
159
+ *children,
134
160
  direction=direction,
135
161
  gap=gap,
136
162
  ),
137
163
  size=size,
164
+ default_value=default_value,
138
165
  **props,
139
166
  )