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
@@ -8,6 +8,7 @@ from typing import Any, Dict, Iterator, Literal
8
8
  from jinja2 import Environment
9
9
 
10
10
  from reflex.components.component import Component
11
+ from reflex.components.radix.themes.components.textfield import TextFieldInput
11
12
  from reflex.components.tags.tag import Tag
12
13
  from reflex.constants.base import Dirs
13
14
  from reflex.constants.event import EventTriggers
@@ -52,7 +53,7 @@ class FormRoot(FormComponent):
52
53
  # If true, the form will be cleared after submit.
53
54
  reset_on_submit: Var[bool] = False # type: ignore
54
55
 
55
- # The name used to make this form's submit handler function unique
56
+ # The name used to make this form's submit handler function unique.
56
57
  handle_submit_unique_name: Var[str]
57
58
 
58
59
  def get_event_triggers(self) -> Dict[str, Any]:
@@ -64,7 +65,7 @@ class FormRoot(FormComponent):
64
65
  return {
65
66
  **super().get_event_triggers(),
66
67
  EventTriggers.ON_SUBMIT: lambda e0: [FORM_DATA],
67
- "on_clear_server_errors": lambda: [],
68
+ EventTriggers.ON_CLEAR_SERVER_ERRORS: lambda: [],
68
69
  }
69
70
 
70
71
  @classmethod
@@ -153,7 +154,7 @@ class FormRoot(FormComponent):
153
154
  )._replace(merge_var_data=ref_var._var_data)
154
155
  return form_refs
155
156
 
156
- def _apply_theme(self, theme: Component | None):
157
+ def _apply_theme(self, theme: Component):
157
158
  return {
158
159
  "width": "260px",
159
160
  **self.style,
@@ -171,11 +172,13 @@ class FormField(FormComponent):
171
172
 
172
173
  alias = "RadixFormField"
173
174
 
175
+ # The name of the form field, that is passed down to the control and used to match with validation messages.
174
176
  name: Var[str]
175
177
 
178
+ # Flag to mark the form field as invalid, for server side validation.
176
179
  server_invalid: Var[bool]
177
180
 
178
- def _apply_theme(self, theme: Component | None):
181
+ def _apply_theme(self, theme: Component):
179
182
  return {
180
183
  "display": "grid",
181
184
  "margin_bottom": "10px",
@@ -190,7 +193,7 @@ class FormLabel(FormComponent):
190
193
 
191
194
  alias = "RadixFormLabel"
192
195
 
193
- def _apply_theme(self, theme: Component | None):
196
+ def _apply_theme(self, theme: Component):
194
197
  return {
195
198
  "font_size": "15px",
196
199
  "font_weight": "500",
@@ -206,6 +209,32 @@ class FormControl(FormComponent):
206
209
 
207
210
  alias = "RadixFormControl"
208
211
 
212
+ @classmethod
213
+ def create(cls, *children, **props):
214
+ """Create a Form Control component.
215
+
216
+ Args:
217
+ *children: The children of the form.
218
+ **props: The properties of the form.
219
+
220
+ Raises:
221
+ ValueError: If the number of children is greater than 1.
222
+ TypeError: If a child exists but it is not a TextFieldInput.
223
+
224
+ Returns:
225
+ The form control component.
226
+ """
227
+ if len(children) > 1:
228
+ raise ValueError(
229
+ f"FormControl can only have at most one child, got {len(children)} children"
230
+ )
231
+ for child in children:
232
+ if not isinstance(child, TextFieldInput):
233
+ raise TypeError(
234
+ "Only Radix TextFieldInput is allowed as child of FormControl"
235
+ )
236
+ return super().create(*children, **props)
237
+
209
238
 
210
239
  LiteralMatcher = Literal[
211
240
  "badInput",
@@ -235,9 +264,9 @@ class FormMessage(FormComponent):
235
264
  match: Var[LiteralMatcher]
236
265
 
237
266
  # Forces the message to be shown. This is useful when using server-side validation.
238
- forceMatch: Var[bool]
267
+ force_match: Var[bool]
239
268
 
240
- def _apply_theme(self, theme: Component | None):
269
+ def _apply_theme(self, theme: Component):
241
270
  return {
242
271
  "font_size": "13px",
243
272
  "opacity": "0.8",
@@ -260,6 +289,9 @@ class FormSubmit(FormComponent):
260
289
  alias = "RadixFormSubmit"
261
290
 
262
291
 
292
+ # High Level API
293
+ Form = FormRoot
294
+
263
295
  form_root = FormRoot.create
264
296
  form_field = FormField.create
265
297
  form_label = FormLabel.create
@@ -267,3 +299,4 @@ form_control = FormControl.create
267
299
  form_message = FormMessage.create
268
300
  form_validity_state = FormValidityState.create
269
301
  form_submit = FormSubmit.create
302
+ form = Form.create
@@ -11,6 +11,7 @@ from hashlib import md5
11
11
  from typing import Any, Dict, Iterator, Literal
12
12
  from jinja2 import Environment
13
13
  from reflex.components.component import Component
14
+ from reflex.components.radix.themes.components.textfield import TextFieldInput
14
15
  from reflex.components.tags.tag import Tag
15
16
  from reflex.constants.base import Dirs
16
17
  from reflex.constants.event import EventTriggers
@@ -37,6 +38,7 @@ class FormComponent(RadixPrimitiveComponentWithClassName):
37
38
  id: Optional[Any] = None,
38
39
  class_name: Optional[Any] = None,
39
40
  autofocus: Optional[bool] = None,
41
+ _rename_props: Optional[Dict[str, str]] = None,
40
42
  custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
41
43
  on_blur: Optional[
42
44
  Union[EventHandler, EventSpec, list, function, BaseVar]
@@ -95,6 +97,7 @@ class FormComponent(RadixPrimitiveComponentWithClassName):
95
97
  id: The id for the component.
96
98
  class_name: The class name for the component.
97
99
  autofocus: Whether the component should take the focus once the page is loaded
100
+ _rename_props: props to change the name of
98
101
  custom_attrs: custom attribute
99
102
  **props: The props of the component.
100
103
 
@@ -121,6 +124,7 @@ class FormRoot(FormComponent):
121
124
  id: Optional[Any] = None,
122
125
  class_name: Optional[Any] = None,
123
126
  autofocus: Optional[bool] = None,
127
+ _rename_props: Optional[Dict[str, str]] = None,
124
128
  custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
125
129
  on_blur: Optional[
126
130
  Union[EventHandler, EventSpec, list, function, BaseVar]
@@ -180,13 +184,14 @@ class FormRoot(FormComponent):
180
184
  Args:
181
185
  *children: The children of the form.
182
186
  reset_on_submit: If true, the form will be cleared after submit.
183
- handle_submit_unique_name: The name used to make this form's submit handler function unique
187
+ handle_submit_unique_name: The name used to make this form's submit handler function unique.
184
188
  as_child: Change the default rendered element for the one passed as a child.
185
189
  style: The style of the component.
186
190
  key: A unique key for the component.
187
191
  id: The id for the component.
188
192
  class_name: The class name for the component.
189
193
  autofocus: Whether the component should take the focus once the page is loaded
194
+ _rename_props: props to change the name of
190
195
  custom_attrs: custom attribute
191
196
  **props: The properties of the form.
192
197
 
@@ -209,6 +214,7 @@ class FormField(FormComponent):
209
214
  id: Optional[Any] = None,
210
215
  class_name: Optional[Any] = None,
211
216
  autofocus: Optional[bool] = None,
217
+ _rename_props: Optional[Dict[str, str]] = None,
212
218
  custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
213
219
  on_blur: Optional[
214
220
  Union[EventHandler, EventSpec, list, function, BaseVar]
@@ -261,12 +267,15 @@ class FormField(FormComponent):
261
267
 
262
268
  Args:
263
269
  *children: The children of the component.
270
+ name: The name of the form field, that is passed down to the control and used to match with validation messages.
271
+ server_invalid: Flag to mark the form field as invalid, for server side validation.
264
272
  as_child: Change the default rendered element for the one passed as a child.
265
273
  style: The style of the component.
266
274
  key: A unique key for the component.
267
275
  id: The id for the component.
268
276
  class_name: The class name for the component.
269
277
  autofocus: Whether the component should take the focus once the page is loaded
278
+ _rename_props: props to change the name of
270
279
  custom_attrs: custom attribute
271
280
  **props: The props of the component.
272
281
 
@@ -290,6 +299,7 @@ class FormLabel(FormComponent):
290
299
  id: Optional[Any] = None,
291
300
  class_name: Optional[Any] = None,
292
301
  autofocus: Optional[bool] = None,
302
+ _rename_props: Optional[Dict[str, str]] = None,
293
303
  custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
294
304
  on_blur: Optional[
295
305
  Union[EventHandler, EventSpec, list, function, BaseVar]
@@ -348,6 +358,7 @@ class FormLabel(FormComponent):
348
358
  id: The id for the component.
349
359
  class_name: The class name for the component.
350
360
  autofocus: Whether the component should take the focus once the page is loaded
361
+ _rename_props: props to change the name of
351
362
  custom_attrs: custom attribute
352
363
  **props: The props of the component.
353
364
 
@@ -371,6 +382,7 @@ class FormControl(FormComponent):
371
382
  id: Optional[Any] = None,
372
383
  class_name: Optional[Any] = None,
373
384
  autofocus: Optional[bool] = None,
385
+ _rename_props: Optional[Dict[str, str]] = None,
374
386
  custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
375
387
  on_blur: Optional[
376
388
  Union[EventHandler, EventSpec, list, function, BaseVar]
@@ -419,24 +431,26 @@ class FormControl(FormComponent):
419
431
  ] = None,
420
432
  **props
421
433
  ) -> "FormControl":
422
- """Create the component.
434
+ """Create a Form Control component.
423
435
 
424
436
  Args:
425
- *children: The children of the component.
437
+ *children: The children of the form.
426
438
  as_child: Change the default rendered element for the one passed as a child.
427
439
  style: The style of the component.
428
440
  key: A unique key for the component.
429
441
  id: The id for the component.
430
442
  class_name: The class name for the component.
431
443
  autofocus: Whether the component should take the focus once the page is loaded
444
+ _rename_props: props to change the name of
432
445
  custom_attrs: custom attribute
433
- **props: The props of the component.
434
-
435
- Returns:
436
- The component.
446
+ **props: The properties of the form.
437
447
 
438
448
  Raises:
439
- TypeError: If an invalid child is passed.
449
+ ValueError: If the number of children is greater than 1.
450
+ TypeError: If a child exists but it is not a TextFieldInput.
451
+
452
+ Returns:
453
+ The form control component.
440
454
  """
441
455
  ...
442
456
 
@@ -490,13 +504,14 @@ class FormMessage(FormComponent):
490
504
  ],
491
505
  ]
492
506
  ] = None,
493
- forceMatch: Optional[Union[Var[bool], bool]] = None,
507
+ force_match: Optional[Union[Var[bool], bool]] = None,
494
508
  as_child: Optional[Union[Var[bool], bool]] = None,
495
509
  style: Optional[Style] = None,
496
510
  key: Optional[Any] = None,
497
511
  id: Optional[Any] = None,
498
512
  class_name: Optional[Any] = None,
499
513
  autofocus: Optional[bool] = None,
514
+ _rename_props: Optional[Dict[str, str]] = None,
500
515
  custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
501
516
  on_blur: Optional[
502
517
  Union[EventHandler, EventSpec, list, function, BaseVar]
@@ -551,13 +566,14 @@ class FormMessage(FormComponent):
551
566
  *children: The children of the component.
552
567
  name: Used to target a specific field by name when rendering outside of a Field part.
553
568
  match: Used to indicate on which condition the message should be visible.
554
- forceMatch: Forces the message to be shown. This is useful when using server-side validation.
569
+ force_match: Forces the message to be shown. This is useful when using server-side validation.
555
570
  as_child: Change the default rendered element for the one passed as a child.
556
571
  style: The style of the component.
557
572
  key: A unique key for the component.
558
573
  id: The id for the component.
559
574
  class_name: The class name for the component.
560
575
  autofocus: Whether the component should take the focus once the page is loaded
576
+ _rename_props: props to change the name of
561
577
  custom_attrs: custom attribute
562
578
  **props: The props of the component.
563
579
 
@@ -581,6 +597,7 @@ class FormValidityState(FormComponent):
581
597
  id: Optional[Any] = None,
582
598
  class_name: Optional[Any] = None,
583
599
  autofocus: Optional[bool] = None,
600
+ _rename_props: Optional[Dict[str, str]] = None,
584
601
  custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
585
602
  on_blur: Optional[
586
603
  Union[EventHandler, EventSpec, list, function, BaseVar]
@@ -639,6 +656,7 @@ class FormValidityState(FormComponent):
639
656
  id: The id for the component.
640
657
  class_name: The class name for the component.
641
658
  autofocus: Whether the component should take the focus once the page is loaded
659
+ _rename_props: props to change the name of
642
660
  custom_attrs: custom attribute
643
661
  **props: The props of the component.
644
662
 
@@ -662,6 +680,7 @@ class FormSubmit(FormComponent):
662
680
  id: Optional[Any] = None,
663
681
  class_name: Optional[Any] = None,
664
682
  autofocus: Optional[bool] = None,
683
+ _rename_props: Optional[Dict[str, str]] = None,
665
684
  custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
666
685
  on_blur: Optional[
667
686
  Union[EventHandler, EventSpec, list, function, BaseVar]
@@ -720,6 +739,7 @@ class FormSubmit(FormComponent):
720
739
  id: The id for the component.
721
740
  class_name: The class name for the component.
722
741
  autofocus: Whether the component should take the focus once the page is loaded
742
+ _rename_props: props to change the name of
723
743
  custom_attrs: custom attribute
724
744
  **props: The props of the component.
725
745
 
@@ -731,6 +751,7 @@ class FormSubmit(FormComponent):
731
751
  """
732
752
  ...
733
753
 
754
+ Form = FormRoot
734
755
  form_root = FormRoot.create
735
756
  form_field = FormField.create
736
757
  form_label = FormLabel.create
@@ -738,3 +759,4 @@ form_control = FormControl.create
738
759
  form_message = FormMessage.create
739
760
  form_validity_state = FormValidityState.create
740
761
  form_submit = FormSubmit.create
762
+ form = Form.create
@@ -28,7 +28,7 @@ class ProgressRoot(ProgressComponent):
28
28
  # The maximum progress value.
29
29
  max: Var[int]
30
30
 
31
- def _apply_theme(self, theme: Component | None):
31
+ def _apply_theme(self, theme: Component):
32
32
  self.style = Style(
33
33
  {
34
34
  "position": "relative",
@@ -52,7 +52,7 @@ class ProgressIndicator(ProgressComponent):
52
52
  # The current progress value.
53
53
  value: Var[Optional[int]]
54
54
 
55
- def _apply_theme(self, theme: Component | None):
55
+ def _apply_theme(self, theme: Component):
56
56
  self.style = Style(
57
57
  {
58
58
  "background-color": "white",
@@ -25,6 +25,7 @@ class ProgressComponent(RadixPrimitiveComponentWithClassName):
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]
@@ -83,6 +84,7 @@ class ProgressComponent(RadixPrimitiveComponentWithClassName):
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 ProgressRoot(ProgressComponent):
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]
@@ -168,6 +171,7 @@ class ProgressRoot(ProgressComponent):
168
171
  id: The id for the component.
169
172
  class_name: The class name for the component.
170
173
  autofocus: Whether the component should take the focus once the page is loaded
174
+ _rename_props: props to change the name of
171
175
  custom_attrs: custom attribute
172
176
  **props: The props of the component.
173
177
 
@@ -192,6 +196,7 @@ class ProgressIndicator(ProgressComponent):
192
196
  id: Optional[Any] = None,
193
197
  class_name: Optional[Any] = None,
194
198
  autofocus: Optional[bool] = None,
199
+ _rename_props: Optional[Dict[str, str]] = None,
195
200
  custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
196
201
  on_blur: Optional[
197
202
  Union[EventHandler, EventSpec, list, function, BaseVar]
@@ -251,6 +256,7 @@ class ProgressIndicator(ProgressComponent):
251
256
  id: The id for the component.
252
257
  class_name: The class name for the component.
253
258
  autofocus: Whether the component should take the focus once the page is loaded
259
+ _rename_props: props to change the name of
254
260
  custom_attrs: custom attribute
255
261
  **props: The props of the component.
256
262
 
@@ -28,6 +28,7 @@ class SliderComponent(RadixPrimitiveComponentWithClassName):
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]
@@ -86,6 +87,7 @@ class SliderComponent(RadixPrimitiveComponentWithClassName):
86
87
  id: The id for the component.
87
88
  class_name: The class name for the component.
88
89
  autofocus: Whether the component should take the focus once the page is loaded
90
+ _rename_props: props to change the name of
89
91
  custom_attrs: custom attribute
90
92
  **props: The props of the component.
91
93
 
@@ -126,6 +128,7 @@ class SliderRoot(SliderComponent):
126
128
  id: Optional[Any] = None,
127
129
  class_name: Optional[Any] = None,
128
130
  autofocus: Optional[bool] = None,
131
+ _rename_props: Optional[Dict[str, str]] = None,
129
132
  custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
130
133
  on_blur: Optional[
131
134
  Union[EventHandler, EventSpec, list, function, BaseVar]
@@ -190,6 +193,7 @@ class SliderRoot(SliderComponent):
190
193
  id: The id for the component.
191
194
  class_name: The class name for the component.
192
195
  autofocus: Whether the component should take the focus once the page is loaded
196
+ _rename_props: props to change the name of
193
197
  custom_attrs: custom attribute
194
198
  **props: The props of the component.
195
199
 
@@ -213,6 +217,7 @@ class SliderTrack(SliderComponent):
213
217
  id: Optional[Any] = None,
214
218
  class_name: Optional[Any] = None,
215
219
  autofocus: Optional[bool] = None,
220
+ _rename_props: Optional[Dict[str, str]] = None,
216
221
  custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
217
222
  on_blur: Optional[
218
223
  Union[EventHandler, EventSpec, list, function, BaseVar]
@@ -271,6 +276,7 @@ class SliderTrack(SliderComponent):
271
276
  id: The id for the component.
272
277
  class_name: The class name for the component.
273
278
  autofocus: Whether the component should take the focus once the page is loaded
279
+ _rename_props: props to change the name of
274
280
  custom_attrs: custom attribute
275
281
  **props: The props of the component.
276
282
 
@@ -294,6 +300,7 @@ class SliderRange(SliderComponent):
294
300
  id: Optional[Any] = None,
295
301
  class_name: Optional[Any] = None,
296
302
  autofocus: Optional[bool] = None,
303
+ _rename_props: Optional[Dict[str, str]] = None,
297
304
  custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
298
305
  on_blur: Optional[
299
306
  Union[EventHandler, EventSpec, list, function, BaseVar]
@@ -352,6 +359,7 @@ class SliderRange(SliderComponent):
352
359
  id: The id for the component.
353
360
  class_name: The class name for the component.
354
361
  autofocus: Whether the component should take the focus once the page is loaded
362
+ _rename_props: props to change the name of
355
363
  custom_attrs: custom attribute
356
364
  **props: The props of the component.
357
365
 
@@ -375,6 +383,7 @@ class SliderThumb(SliderComponent):
375
383
  id: Optional[Any] = None,
376
384
  class_name: Optional[Any] = None,
377
385
  autofocus: Optional[bool] = None,
386
+ _rename_props: Optional[Dict[str, str]] = None,
378
387
  custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
379
388
  on_blur: Optional[
380
389
  Union[EventHandler, EventSpec, list, function, BaseVar]
@@ -433,6 +442,7 @@ class SliderThumb(SliderComponent):
433
442
  id: The id for the component.
434
443
  class_name: The class name for the component.
435
444
  autofocus: Whether the component should take the focus once the page is loaded
445
+ _rename_props: props to change the name of
436
446
  custom_attrs: custom attribute
437
447
  **props: The props of the component.
438
448
 
@@ -2,9 +2,10 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
- from typing import Literal
5
+ from typing import Any, Literal
6
6
 
7
7
  from reflex.components import Component
8
+ from reflex.components.tags import Tag
8
9
  from reflex.utils import imports
9
10
  from reflex.vars import Var
10
11
 
@@ -14,7 +15,7 @@ LiteralSize = Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]
14
15
  LiteralVariant = Literal["classic", "solid", "soft", "surface", "outline", "ghost"]
15
16
  LiteralAppearance = Literal["inherit", "light", "dark"]
16
17
  LiteralGrayColor = Literal["gray", "mauve", "slate", "sage", "olive", "sand", "auto"]
17
- LiteralPanelBackground = Literal["solid", "transparent"]
18
+ LiteralPanelBackground = Literal["solid", "translucent"]
18
19
  LiteralRadius = Literal["none", "small", "medium", "large", "full"]
19
20
  LiteralScaling = Literal["90%", "95%", "100%", "105%", "110%"]
20
21
  LiteralAccentColor = Literal[
@@ -113,6 +114,21 @@ class RadixThemesComponent(Component):
113
114
  )
114
115
  return component
115
116
 
117
+ @classmethod
118
+ def get_fields(cls) -> dict[str, Any]:
119
+ """Get the pydantic fields for the component.
120
+
121
+ Returns:
122
+ Mapping of field name to ModelField instance.
123
+ """
124
+ fields = super().get_fields()
125
+ if "color_scheme" in fields:
126
+ # Treat "color" as a direct prop, so the translation of reflex "color_scheme"
127
+ # to "color" does not put the "color_scheme" value into the "style" prop.
128
+ fields["color"] = fields.pop("color_scheme")
129
+ fields["color"].required = False
130
+ return fields
131
+
116
132
  @staticmethod
117
133
  def _get_app_wrap_components() -> dict[tuple[int, str], Component]:
118
134
  return {
@@ -132,32 +148,49 @@ class Theme(RadixThemesComponent):
132
148
 
133
149
  tag = "Theme"
134
150
 
135
- # Whether to apply the themes background color to the theme node.
151
+ # Whether to apply the themes background color to the theme node. Defaults to True.
136
152
  has_background: Var[bool]
137
153
 
138
- # Override light or dark mode theme: "inherit" | "light" | "dark"
154
+ # Override light or dark mode theme: "inherit" | "light" | "dark". Defaults to "inherit".
139
155
  appearance: Var[LiteralAppearance]
140
156
 
141
157
  # The color used for default buttons, typography, backgrounds, etc
142
158
  accent_color: Var[LiteralAccentColor]
143
159
 
144
- # The shade of gray
160
+ # The shade of gray, defaults to "auto".
145
161
  gray_color: Var[LiteralGrayColor]
146
162
 
147
- # Whether panel backgrounds are transparent: "solid" | "transparent" (default)
163
+ # Whether panel backgrounds are translucent: "solid" | "translucent" (default)
148
164
  panel_background: Var[LiteralPanelBackground]
149
165
 
150
- # Element border radius: "none" | "small" | "medium" | "large" | "full"
166
+ # Element border radius: "none" | "small" | "medium" | "large" | "full". Defaults to "medium".
151
167
  radius: Var[LiteralRadius]
152
168
 
153
- # Scale of all theme items: "90%" | "95%" | "100%" | "105%" | "110%"
169
+ # Scale of all theme items: "90%" | "95%" | "100%" | "105%" | "110%". Defaults to "100%"
154
170
  scaling: Var[LiteralScaling]
155
171
 
156
172
  def _get_imports(self) -> imports.ImportDict:
157
- return {
158
- **super()._get_imports(),
159
- "": [imports.ImportVar(tag="@radix-ui/themes/styles.css", install=False)],
160
- }
173
+ return imports.merge_imports(
174
+ super()._get_imports(),
175
+ {
176
+ "": [
177
+ imports.ImportVar(tag="@radix-ui/themes/styles.css", install=False)
178
+ ],
179
+ "/utils/theme.js": [
180
+ imports.ImportVar(tag="theme", is_default=True),
181
+ ],
182
+ },
183
+ )
184
+
185
+ def _render(self, props: dict[str, Any] | None = None) -> Tag:
186
+ tag = super()._render(props)
187
+ tag.add_props(
188
+ css=Var.create(
189
+ "{{...theme.styles.global[':root'], ...theme.styles.global.body}}",
190
+ _var_is_local=False,
191
+ ),
192
+ )
193
+ return tag
161
194
 
162
195
 
163
196
  class ThemePanel(RadixThemesComponent):
@@ -168,6 +201,7 @@ class ThemePanel(RadixThemesComponent):
168
201
 
169
202
  tag = "ThemePanel"
170
203
 
204
+ # Whether the panel is open. Defaults to False.
171
205
  default_open: Var[bool]
172
206
 
173
207