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
@@ -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 HoverCardRoot(CommonMarginProps, RadixThemesComponent):
13
+ class HoverCardRoot(RadixThemesComponent):
14
14
  """Trigger an action or event, such as submitting a form or displaying a dialog."""
15
15
 
16
16
  tag = "HoverCard.Root"
@@ -35,17 +35,17 @@ class HoverCardRoot(CommonMarginProps, RadixThemesComponent):
35
35
  """
36
36
  return {
37
37
  **super().get_event_triggers(),
38
- "on_open_change": lambda e0: [e0],
38
+ EventTriggers.ON_OPEN_CHANGE: lambda e0: [e0],
39
39
  }
40
40
 
41
41
 
42
- class HoverCardTrigger(CommonMarginProps, RadixThemesComponent):
42
+ class HoverCardTrigger(RadixThemesComponent):
43
43
  """Trigger an action or event, such as submitting a form or displaying a dialog."""
44
44
 
45
45
  tag = "HoverCard.Trigger"
46
46
 
47
47
 
48
- class HoverCardContent(el.Div, CommonMarginProps, RadixThemesComponent):
48
+ class HoverCardContent(el.Div, RadixThemesComponent):
49
49
  """Trigger an action or event, such as submitting a form or displaying a dialog."""
50
50
 
51
51
  tag = "HoverCard.Content"
@@ -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 HoverCardRoot(CommonMarginProps, RadixThemesComponent):
16
+ class HoverCardRoot(RadixThemesComponent):
16
17
  def get_event_triggers(self) -> Dict[str, Any]: ...
17
18
  @overload
18
19
  @classmethod
@@ -86,53 +87,12 @@ class HoverCardRoot(CommonMarginProps, RadixThemesComponent):
86
87
  open: Optional[Union[Var[bool], bool]] = None,
87
88
  open_delay: Optional[Union[Var[int], int]] = None,
88
89
  close_delay: Optional[Union[Var[int], int]] = None,
89
- m: Optional[
90
- Union[
91
- Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
92
- Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
93
- ]
94
- ] = None,
95
- mx: Optional[
96
- Union[
97
- Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
98
- Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
99
- ]
100
- ] = None,
101
- my: Optional[
102
- Union[
103
- Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
104
- Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
105
- ]
106
- ] = None,
107
- mt: Optional[
108
- Union[
109
- Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
110
- Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
111
- ]
112
- ] = None,
113
- mr: Optional[
114
- Union[
115
- Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
116
- Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
117
- ]
118
- ] = None,
119
- mb: Optional[
120
- Union[
121
- Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
122
- Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
123
- ]
124
- ] = None,
125
- ml: Optional[
126
- Union[
127
- Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
128
- Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
129
- ]
130
- ] = None,
131
90
  style: Optional[Style] = None,
132
91
  key: Optional[Any] = None,
133
92
  id: Optional[Any] = None,
134
93
  class_name: Optional[Any] = None,
135
94
  autofocus: Optional[bool] = None,
95
+ _rename_props: Optional[Dict[str, str]] = None,
136
96
  custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
137
97
  on_blur: Optional[
138
98
  Union[EventHandler, EventSpec, list, function, BaseVar]
@@ -197,18 +157,12 @@ class HoverCardRoot(CommonMarginProps, RadixThemesComponent):
197
157
  open: The controlled open state of the hover card. Must be used in conjunction with onOpenChange.
198
158
  open_delay: The duration from when the mouse enters the trigger until the hover card opens.
199
159
  close_delay: The duration from when the mouse leaves the trigger until the hover card closes.
200
- m: Margin: "0" - "9"
201
- mx: Margin horizontal: "0" - "9"
202
- my: Margin vertical: "0" - "9"
203
- mt: Margin top: "0" - "9"
204
- mr: Margin right: "0" - "9"
205
- mb: Margin bottom: "0" - "9"
206
- ml: Margin left: "0" - "9"
207
160
  style: The style of the component.
208
161
  key: A unique key for the component.
209
162
  id: The id for the component.
210
163
  class_name: The class name for the component.
211
164
  autofocus: Whether the component should take the focus once the page is loaded
165
+ _rename_props: props to change the name of
212
166
  custom_attrs: custom attribute
213
167
  **props: Component properties.
214
168
 
@@ -217,7 +171,7 @@ class HoverCardRoot(CommonMarginProps, RadixThemesComponent):
217
171
  """
218
172
  ...
219
173
 
220
- class HoverCardTrigger(CommonMarginProps, RadixThemesComponent):
174
+ class HoverCardTrigger(RadixThemesComponent):
221
175
  @overload
222
176
  @classmethod
223
177
  def create( # type: ignore
@@ -286,53 +240,12 @@ class HoverCardTrigger(CommonMarginProps, RadixThemesComponent):
286
240
  ],
287
241
  ]
288
242
  ] = None,
289
- m: Optional[
290
- Union[
291
- Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
292
- Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
293
- ]
294
- ] = None,
295
- mx: Optional[
296
- Union[
297
- Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
298
- Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
299
- ]
300
- ] = None,
301
- my: Optional[
302
- Union[
303
- Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
304
- Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
305
- ]
306
- ] = None,
307
- mt: Optional[
308
- Union[
309
- Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
310
- Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
311
- ]
312
- ] = None,
313
- mr: Optional[
314
- Union[
315
- Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
316
- Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
317
- ]
318
- ] = None,
319
- mb: Optional[
320
- Union[
321
- Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
322
- Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
323
- ]
324
- ] = None,
325
- ml: Optional[
326
- Union[
327
- Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
328
- Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
329
- ]
330
- ] = None,
331
243
  style: Optional[Style] = None,
332
244
  key: Optional[Any] = None,
333
245
  id: Optional[Any] = None,
334
246
  class_name: Optional[Any] = None,
335
247
  autofocus: Optional[bool] = None,
248
+ _rename_props: Optional[Dict[str, str]] = None,
336
249
  custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
337
250
  on_blur: Optional[
338
251
  Union[EventHandler, EventSpec, list, function, BaseVar]
@@ -390,18 +303,12 @@ class HoverCardTrigger(CommonMarginProps, RadixThemesComponent):
390
303
  *children: Child components.
391
304
  color: map to CSS default color property.
392
305
  color_scheme: map to radix color property.
393
- m: Margin: "0" - "9"
394
- mx: Margin horizontal: "0" - "9"
395
- my: Margin vertical: "0" - "9"
396
- mt: Margin top: "0" - "9"
397
- mr: Margin right: "0" - "9"
398
- mb: Margin bottom: "0" - "9"
399
- ml: Margin left: "0" - "9"
400
306
  style: The style of the component.
401
307
  key: A unique key for the component.
402
308
  id: The id for the component.
403
309
  class_name: The class name for the component.
404
310
  autofocus: Whether the component should take the focus once the page is loaded
311
+ _rename_props: props to change the name of
405
312
  custom_attrs: custom attribute
406
313
  **props: Component properties.
407
314
 
@@ -410,7 +317,7 @@ class HoverCardTrigger(CommonMarginProps, RadixThemesComponent):
410
317
  """
411
318
  ...
412
319
 
413
- class HoverCardContent(el.Div, CommonMarginProps, RadixThemesComponent):
320
+ class HoverCardContent(el.Div, RadixThemesComponent):
414
321
  @overload
415
322
  @classmethod
416
323
  def create( # type: ignore
@@ -536,53 +443,12 @@ class HoverCardContent(el.Div, CommonMarginProps, RadixThemesComponent):
536
443
  translate: Optional[
537
444
  Union[Var[Union[str, int, bool]], Union[str, int, bool]]
538
445
  ] = None,
539
- m: Optional[
540
- Union[
541
- Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
542
- Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
543
- ]
544
- ] = None,
545
- mx: Optional[
546
- Union[
547
- Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
548
- Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
549
- ]
550
- ] = None,
551
- my: Optional[
552
- Union[
553
- Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
554
- Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
555
- ]
556
- ] = None,
557
- mt: Optional[
558
- Union[
559
- Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
560
- Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
561
- ]
562
- ] = None,
563
- mr: Optional[
564
- Union[
565
- Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
566
- Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
567
- ]
568
- ] = None,
569
- mb: Optional[
570
- Union[
571
- Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
572
- Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
573
- ]
574
- ] = None,
575
- ml: Optional[
576
- Union[
577
- Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
578
- Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
579
- ]
580
- ] = None,
581
446
  style: Optional[Style] = None,
582
447
  key: Optional[Any] = None,
583
448
  id: Optional[Any] = None,
584
449
  class_name: Optional[Any] = None,
585
450
  autofocus: Optional[bool] = None,
451
+ _rename_props: Optional[Dict[str, str]] = None,
586
452
  custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
587
453
  on_blur: Optional[
588
454
  Union[EventHandler, EventSpec, list, function, BaseVar]
@@ -661,18 +527,12 @@ class HoverCardContent(el.Div, CommonMarginProps, RadixThemesComponent):
661
527
  tab_index: Defines the position of the current element in the tabbing order.
662
528
  title: Defines a tooltip for the element.
663
529
  translate: Specifies whether the content of an element should be translated or not.
664
- m: Margin: "0" - "9"
665
- mx: Margin horizontal: "0" - "9"
666
- my: Margin vertical: "0" - "9"
667
- mt: Margin top: "0" - "9"
668
- mr: Margin right: "0" - "9"
669
- mb: Margin bottom: "0" - "9"
670
- ml: Margin left: "0" - "9"
671
530
  style: The style of the component.
672
531
  key: A unique key for the component.
673
532
  id: The id for the component.
674
533
  class_name: The class name for the component.
675
534
  autofocus: Whether the component should take the focus once the page is loaded
535
+ _rename_props: props to change the name of
676
536
  custom_attrs: custom attribute
677
537
  **props: Component properties.
678
538
 
@@ -1,11 +1,15 @@
1
1
  """Interactive components provided by @radix-ui/themes."""
2
+
2
3
  from typing import Literal
3
4
 
4
5
  from reflex import el
6
+ from reflex.components.component import Component
7
+ from reflex.components.core import match
8
+ from reflex.components.lucide import Icon
9
+ from reflex.style import Style
5
10
  from reflex.vars import Var
6
11
 
7
12
  from ..base import (
8
- CommonMarginProps,
9
13
  LiteralAccentColor,
10
14
  LiteralRadius,
11
15
  LiteralVariant,
@@ -15,10 +19,10 @@ from ..base import (
15
19
  LiteralButtonSize = Literal["1", "2", "3", "4"]
16
20
 
17
21
 
18
- class IconButton(el.Button, CommonMarginProps, RadixThemesComponent):
22
+ class IconButton(el.Button, RadixThemesComponent):
19
23
  """Trigger an action or event, such as submitting a form or displaying a dialog."""
20
24
 
21
- tag = "Button"
25
+ tag = "IconButton"
22
26
 
23
27
  # Change the default rendered element for the one passed as a child, merging their props and behavior.
24
28
  as_child: Var[bool]
@@ -30,10 +34,58 @@ class IconButton(el.Button, CommonMarginProps, RadixThemesComponent):
30
34
  variant: Var[LiteralVariant]
31
35
 
32
36
  # Override theme color for button
33
- color: Var[LiteralAccentColor]
37
+ color_scheme: Var[LiteralAccentColor]
34
38
 
35
39
  # Whether to render the button with higher contrast color against background
36
40
  high_contrast: Var[bool]
37
41
 
38
42
  # Override theme radius for button: "none" | "small" | "medium" | "large" | "full"
39
43
  radius: Var[LiteralRadius]
44
+
45
+ @classmethod
46
+ def create(cls, *children, **props) -> Component:
47
+ """Create a IconButton component.
48
+
49
+ Args:
50
+ *children: The children of the component.
51
+ **props: The properties of the component.
52
+
53
+ Raises:
54
+ ValueError: If no children are passed.
55
+
56
+ Returns:
57
+ The IconButton component.
58
+ """
59
+ if children:
60
+ if type(children[0]) == str:
61
+ children = [
62
+ Icon.create(
63
+ children[0],
64
+ )
65
+ ]
66
+ else:
67
+ raise ValueError(
68
+ "IconButton requires a child icon. Pass a string as the first child or a rx.icon."
69
+ )
70
+ if "size" in props:
71
+ if type(props["size"]) == str:
72
+ RADIX_TO_LUCIDE_SIZE = {
73
+ "1": "12px",
74
+ "2": "24px",
75
+ "3": "36px",
76
+ "4": "48px",
77
+ }
78
+ children[0].size = RADIX_TO_LUCIDE_SIZE[props["size"]]
79
+ else:
80
+ children[0].size = match(
81
+ props["size"],
82
+ ("1", "12px"),
83
+ ("2", "24px"),
84
+ ("3", "36px"),
85
+ ("4", "48px"),
86
+ "12px",
87
+ )
88
+ return super().create(*children, **props)
89
+
90
+ def _apply_theme(self, theme: Component):
91
+ self.style = Style({"padding": "6px", **self.style})
@@ -9,9 +9,12 @@ from reflex.event import EventChain, EventHandler, EventSpec
9
9
  from reflex.style import Style
10
10
  from typing import Literal
11
11
  from reflex import el
12
+ from reflex.components.component import Component
13
+ from reflex.components.core import match
14
+ from reflex.components.lucide import Icon
15
+ from reflex.style import Style
12
16
  from reflex.vars import Var
13
17
  from ..base import (
14
- CommonMarginProps,
15
18
  LiteralAccentColor,
16
19
  LiteralRadius,
17
20
  LiteralVariant,
@@ -20,13 +23,22 @@ from ..base import (
20
23
 
21
24
  LiteralButtonSize = Literal["1", "2", "3", "4"]
22
25
 
23
- class IconButton(el.Button, CommonMarginProps, RadixThemesComponent):
26
+ class IconButton(el.Button, RadixThemesComponent):
24
27
  @overload
25
28
  @classmethod
26
29
  def create( # type: ignore
27
30
  cls,
28
31
  *children,
29
- color: Optional[Union[Var[str], str]] = None,
32
+ as_child: Optional[Union[Var[bool], bool]] = None,
33
+ size: Optional[
34
+ Union[Var[Literal["1", "2", "3", "4"]], Literal["1", "2", "3", "4"]]
35
+ ] = None,
36
+ variant: Optional[
37
+ Union[
38
+ Var[Literal["classic", "solid", "soft", "surface", "outline", "ghost"]],
39
+ Literal["classic", "solid", "soft", "surface", "outline", "ghost"],
40
+ ]
41
+ ] = None,
30
42
  color_scheme: Optional[
31
43
  Union[
32
44
  Var[
@@ -89,16 +101,6 @@ class IconButton(el.Button, CommonMarginProps, RadixThemesComponent):
89
101
  ],
90
102
  ]
91
103
  ] = None,
92
- as_child: Optional[Union[Var[bool], bool]] = None,
93
- size: Optional[
94
- Union[Var[Literal["1", "2", "3", "4"]], Literal["1", "2", "3", "4"]]
95
- ] = None,
96
- variant: Optional[
97
- Union[
98
- Var[Literal["classic", "solid", "soft", "surface", "outline", "ghost"]],
99
- Literal["classic", "solid", "soft", "surface", "outline", "ghost"],
100
- ]
101
- ] = None,
102
104
  high_contrast: Optional[Union[Var[bool], bool]] = None,
103
105
  radius: Optional[
104
106
  Union[
@@ -176,53 +178,12 @@ class IconButton(el.Button, CommonMarginProps, RadixThemesComponent):
176
178
  translate: Optional[
177
179
  Union[Var[Union[str, int, bool]], Union[str, int, bool]]
178
180
  ] = None,
179
- m: Optional[
180
- Union[
181
- Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
182
- Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
183
- ]
184
- ] = None,
185
- mx: Optional[
186
- Union[
187
- Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
188
- Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
189
- ]
190
- ] = None,
191
- my: Optional[
192
- Union[
193
- Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
194
- Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
195
- ]
196
- ] = None,
197
- mt: Optional[
198
- Union[
199
- Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
200
- Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
201
- ]
202
- ] = None,
203
- mr: Optional[
204
- Union[
205
- Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
206
- Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
207
- ]
208
- ] = None,
209
- mb: Optional[
210
- Union[
211
- Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
212
- Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
213
- ]
214
- ] = None,
215
- ml: Optional[
216
- Union[
217
- Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
218
- Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
219
- ]
220
- ] = None,
221
181
  style: Optional[Style] = None,
222
182
  key: Optional[Any] = None,
223
183
  id: Optional[Any] = None,
224
184
  class_name: Optional[Any] = None,
225
185
  autofocus: Optional[bool] = None,
186
+ _rename_props: Optional[Dict[str, str]] = None,
226
187
  custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
227
188
  on_blur: Optional[
228
189
  Union[EventHandler, EventSpec, list, function, BaseVar]
@@ -271,18 +232,14 @@ class IconButton(el.Button, CommonMarginProps, RadixThemesComponent):
271
232
  ] = None,
272
233
  **props
273
234
  ) -> "IconButton":
274
- """Create a new component instance.
275
-
276
- Will prepend "RadixThemes" to the component tag to avoid conflicts with
277
- other UI libraries for common names, like Text and Button.
235
+ """Create a IconButton component.
278
236
 
279
237
  Args:
280
- *children: Child components.
281
- color: map to CSS default color property.
282
- color_scheme: map to radix color property.
238
+ *children: The children of the component.
283
239
  as_child: Change the default rendered element for the one passed as a child, merging their props and behavior.
284
240
  size: Button size "1" - "4"
285
241
  variant: Variant of button: "classic" | "solid" | "soft" | "surface" | "outline" | "ghost"
242
+ color_scheme: Override theme color for button
286
243
  high_contrast: Whether to render the button with higher contrast color against background
287
244
  radius: Override theme radius for button: "none" | "small" | "medium" | "large" | "full"
288
245
  auto_focus: Automatically focuses the button when the page loads
@@ -313,22 +270,19 @@ class IconButton(el.Button, CommonMarginProps, RadixThemesComponent):
313
270
  tab_index: Defines the position of the current element in the tabbing order.
314
271
  title: Defines a tooltip for the element.
315
272
  translate: Specifies whether the content of an element should be translated or not.
316
- m: Margin: "0" - "9"
317
- mx: Margin horizontal: "0" - "9"
318
- my: Margin vertical: "0" - "9"
319
- mt: Margin top: "0" - "9"
320
- mr: Margin right: "0" - "9"
321
- mb: Margin bottom: "0" - "9"
322
- ml: Margin left: "0" - "9"
323
273
  style: The style of the component.
324
274
  key: A unique key for the component.
325
275
  id: The id for the component.
326
276
  class_name: The class name for the component.
327
277
  autofocus: Whether the component should take the focus once the page is loaded
278
+ _rename_props: props to change the name of
328
279
  custom_attrs: custom attribute
329
- **props: Component properties.
280
+ **props: The properties of the component.
281
+
282
+ Raises:
283
+ ValueError: If no children are passed.
330
284
 
331
285
  Returns:
332
- A new component instance.
286
+ The IconButton component.
333
287
  """
334
288
  ...
@@ -22,6 +22,7 @@ class RadixIconComponent(Component):
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]
@@ -79,6 +80,7 @@ class RadixIconComponent(Component):
79
80
  id: The id for the component.
80
81
  class_name: The class name for the component.
81
82
  autofocus: Whether the component should take the focus once the page is loaded
83
+ _rename_props: props to change the name of
82
84
  custom_attrs: custom attribute
83
85
  **props: The props of the component.
84
86
 
@@ -101,6 +103,7 @@ class Icon(RadixIconComponent):
101
103
  id: Optional[Any] = None,
102
104
  class_name: Optional[Any] = None,
103
105
  autofocus: Optional[bool] = None,
106
+ _rename_props: Optional[Dict[str, str]] = None,
104
107
  custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
105
108
  on_blur: Optional[
106
109
  Union[EventHandler, EventSpec, list, function, BaseVar]
@@ -160,6 +163,7 @@ class Icon(RadixIconComponent):
160
163
  id: The id for the component.
161
164
  class_name: The class name for the component.
162
165
  autofocus: Whether the component should take the focus once the page is loaded
166
+ _rename_props: props to change the name of
163
167
  custom_attrs: custom attribute
164
168
  **props: The keyword arguments
165
169
 
@@ -5,14 +5,13 @@ from reflex import el
5
5
  from reflex.vars import Var
6
6
 
7
7
  from ..base import (
8
- CommonMarginProps,
9
8
  RadixThemesComponent,
10
9
  )
11
10
 
12
11
  LiteralButtonSize = Literal["1", "2", "3", "4"]
13
12
 
14
13
 
15
- class Inset(el.Div, CommonMarginProps, RadixThemesComponent):
14
+ class Inset(el.Div, RadixThemesComponent):
16
15
  """Trigger an action or event, such as submitting a form or displaying a dialog."""
17
16
 
18
17
  tag = "Inset"