reflex 0.4.9a1__py3-none-any.whl → 0.5.0__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 (133) hide show
  1. reflex/.templates/apps/blank/code/blank.py +19 -16
  2. reflex/.templates/apps/demo/code/demo.py +1 -1
  3. reflex/.templates/apps/demo/code/pages/datatable.py +4 -4
  4. reflex/.templates/apps/demo/code/pages/forms.py +2 -2
  5. reflex/.templates/jinja/web/tailwind.config.js.jinja2 +12 -0
  6. reflex/.templates/web/utils/helpers/debounce.js +17 -0
  7. reflex/.templates/web/utils/helpers/throttle.js +22 -0
  8. reflex/.templates/web/utils/state.js +21 -3
  9. reflex/__init__.py +6 -1
  10. reflex/__init__.pyi +4 -1
  11. reflex/app.py +160 -140
  12. reflex/app_module_for_backend.py +1 -1
  13. reflex/base.py +13 -15
  14. reflex/compiler/compiler.py +10 -1
  15. reflex/compiler/utils.py +3 -30
  16. reflex/components/__init__.py +1 -0
  17. reflex/components/chakra/datadisplay/list.py +1 -3
  18. reflex/components/chakra/datadisplay/list.pyi +3 -3
  19. reflex/components/chakra/disclosure/accordion.py +1 -1
  20. reflex/components/chakra/forms/pininput.pyi +1 -1
  21. reflex/components/chakra/media/icon.py +2 -2
  22. reflex/components/component.py +275 -32
  23. reflex/components/core/__init__.py +2 -2
  24. reflex/components/core/cond.py +1 -10
  25. reflex/components/core/debounce.py +5 -2
  26. reflex/components/core/debounce.pyi +4 -2
  27. reflex/components/core/foreach.py +60 -49
  28. reflex/components/core/html.py +6 -0
  29. reflex/components/core/match.py +2 -17
  30. reflex/components/core/upload.py +42 -1
  31. reflex/components/core/upload.pyi +199 -1
  32. reflex/components/datadisplay/code.py +7 -3
  33. reflex/components/datadisplay/code.pyi +3 -1
  34. reflex/components/el/elements/forms.py +1 -1
  35. reflex/components/el/elements/forms.pyi +1 -1
  36. reflex/components/lucide/icon.py +5 -13
  37. reflex/components/lucide/icon.pyi +0 -1
  38. reflex/components/markdown/markdown.py +5 -23
  39. reflex/components/markdown/markdown.pyi +1 -4
  40. reflex/components/radix/primitives/accordion.py +265 -410
  41. reflex/components/radix/primitives/accordion.pyi +390 -36
  42. reflex/components/radix/primitives/form.py +33 -29
  43. reflex/components/radix/primitives/form.pyi +7 -2
  44. reflex/components/radix/primitives/progress.py +17 -9
  45. reflex/components/radix/primitives/progress.pyi +2 -0
  46. reflex/components/radix/primitives/slider.py +30 -18
  47. reflex/components/radix/primitives/slider.pyi +4 -0
  48. reflex/components/radix/themes/base.py +8 -1
  49. reflex/components/radix/themes/base.pyi +79 -1
  50. reflex/components/radix/themes/color_mode.py +88 -20
  51. reflex/components/radix/themes/color_mode.pyi +157 -139
  52. reflex/components/radix/themes/components/__init__.py +17 -0
  53. reflex/components/radix/themes/components/badge.py +2 -1
  54. reflex/components/radix/themes/components/badge.pyi +3 -1
  55. reflex/components/radix/themes/components/button.py +3 -1
  56. reflex/components/radix/themes/components/button.pyi +4 -1
  57. reflex/components/radix/themes/components/checkbox_cards.py +48 -0
  58. reflex/components/radix/themes/components/checkbox_cards.pyi +264 -0
  59. reflex/components/radix/themes/components/checkbox_group.py +42 -0
  60. reflex/components/radix/themes/components/checkbox_group.pyi +253 -0
  61. reflex/components/radix/themes/components/data_list.py +63 -0
  62. reflex/components/radix/themes/components/data_list.pyi +426 -0
  63. reflex/components/radix/themes/components/icon_button.py +20 -17
  64. reflex/components/radix/themes/components/icon_button.pyi +5 -1
  65. reflex/components/radix/themes/components/progress.py +55 -0
  66. reflex/components/radix/themes/components/progress.pyi +180 -0
  67. reflex/components/radix/themes/components/radio.py +31 -0
  68. reflex/components/radix/themes/components/radio.pyi +169 -0
  69. reflex/components/radix/themes/components/radio_cards.py +48 -0
  70. reflex/components/radix/themes/components/radio_cards.pyi +264 -0
  71. reflex/components/radix/themes/components/radio_group.py +2 -4
  72. reflex/components/radix/themes/components/segmented_control.py +48 -0
  73. reflex/components/radix/themes/components/segmented_control.pyi +262 -0
  74. reflex/components/radix/themes/components/skeleton.py +32 -0
  75. reflex/components/radix/themes/components/skeleton.pyi +106 -0
  76. reflex/components/radix/themes/components/spinner.py +26 -0
  77. reflex/components/radix/themes/components/spinner.pyi +101 -0
  78. reflex/components/radix/themes/components/tabs.py +26 -1
  79. reflex/components/radix/themes/components/tabs.pyi +69 -9
  80. reflex/components/radix/themes/components/text_field.py +101 -71
  81. reflex/components/radix/themes/components/text_field.pyi +81 -499
  82. reflex/components/radix/themes/layout/base.py +2 -2
  83. reflex/components/radix/themes/layout/base.pyi +4 -4
  84. reflex/components/radix/themes/layout/center.py +8 -3
  85. reflex/components/radix/themes/layout/center.pyi +2 -1
  86. reflex/components/radix/themes/layout/container.py +30 -2
  87. reflex/components/radix/themes/layout/container.pyi +9 -30
  88. reflex/components/radix/themes/layout/list.py +10 -5
  89. reflex/components/radix/themes/layout/list.pyi +5 -21
  90. reflex/components/radix/themes/layout/spacer.py +8 -3
  91. reflex/components/radix/themes/layout/spacer.pyi +2 -1
  92. reflex/components/radix/themes/layout/stack.py +7 -1
  93. reflex/components/radix/themes/layout/stack.pyi +3 -3
  94. reflex/components/radix/themes/typography/link.py +10 -2
  95. reflex/components/radix/themes/typography/link.pyi +5 -4
  96. reflex/components/sonner/__init__.py +3 -0
  97. reflex/components/sonner/toast.py +267 -0
  98. reflex/components/sonner/toast.pyi +205 -0
  99. reflex/components/tags/iter_tag.py +9 -6
  100. reflex/config.py +30 -54
  101. reflex/constants/__init__.py +0 -2
  102. reflex/constants/base.py +0 -5
  103. reflex/constants/colors.py +2 -0
  104. reflex/constants/installer.py +6 -1
  105. reflex/constants/route.py +4 -0
  106. reflex/custom_components/custom_components.py +24 -2
  107. reflex/event.py +75 -30
  108. reflex/experimental/__init__.py +5 -0
  109. reflex/experimental/layout.py +24 -6
  110. reflex/model.py +2 -1
  111. reflex/page.py +7 -4
  112. reflex/reflex.py +8 -3
  113. reflex/route.py +39 -0
  114. reflex/state.py +128 -131
  115. reflex/style.py +25 -3
  116. reflex/testing.py +10 -6
  117. reflex/utils/console.py +3 -1
  118. reflex/utils/exec.py +20 -7
  119. reflex/utils/format.py +1 -1
  120. reflex/utils/imports.py +3 -1
  121. reflex/utils/prerequisites.py +141 -20
  122. reflex/utils/processes.py +21 -1
  123. reflex/utils/pyi_generator.py +100 -5
  124. reflex/utils/serializers.py +1 -1
  125. reflex/utils/telemetry.py +26 -4
  126. reflex/utils/types.py +62 -18
  127. reflex/vars.py +11 -5
  128. {reflex-0.4.9a1.dist-info → reflex-0.5.0.dist-info}/METADATA +16 -4
  129. {reflex-0.4.9a1.dist-info → reflex-0.5.0.dist-info}/RECORD +132 -110
  130. {reflex-0.4.9a1.dist-info → reflex-0.5.0.dist-info}/WHEEL +1 -1
  131. reflex/app.pyi +0 -149
  132. {reflex-0.4.9a1.dist-info → reflex-0.5.0.dist-info}/LICENSE +0 -0
  133. {reflex-0.4.9a1.dist-info → reflex-0.5.0.dist-info}/entry_points.txt +0 -0
@@ -8,13 +8,15 @@ from reflex.vars import Var, BaseVar, ComputedVar
8
8
  from reflex.event import EventChain, EventHandler, EventSpec
9
9
  from reflex.style import Style
10
10
  import dataclasses
11
+ from typing import Literal, get_args
11
12
  from reflex.components.component import BaseComponent
12
- from reflex.components.core.cond import Cond, color_mode_cond
13
+ from reflex.components.core.cond import Cond, color_mode_cond, cond
13
14
  from reflex.components.lucide.icon import Icon
15
+ from reflex.components.radix.themes.components.switch import Switch
14
16
  from reflex.style import LIGHT_COLOR_MODE, color_mode, toggle_color_mode
15
- from reflex.vars import BaseVar
16
- from .components.button import Button
17
- from .components.switch import Switch
17
+ from reflex.utils import console
18
+ from reflex.vars import BaseVar, Var
19
+ from .components.icon_button import IconButton
18
20
 
19
21
  DEFAULT_LIGHT_ICON: Icon
20
22
  DEFAULT_DARK_ICON: Icon
@@ -92,26 +94,33 @@ class ColorModeIcon(Cond):
92
94
  """
93
95
  ...
94
96
 
95
- class ColorModeSwitch(Switch):
97
+ LiteralPosition = Literal["top-left", "top-right", "bottom-left", "bottom-right"]
98
+ position_values = get_args(LiteralPosition)
99
+ position_map = {
100
+ "position": position_values,
101
+ "left": ["top-left", "bottom-left"],
102
+ "right": ["top-right", "bottom-right"],
103
+ "top": ["top-left", "top-right"],
104
+ "bottom": ["bottom-left", "bottom-right"],
105
+ }
106
+
107
+ class ColorModeIconButton(IconButton):
96
108
  @overload
97
109
  @classmethod
98
110
  def create( # type: ignore
99
111
  cls,
100
112
  *children,
113
+ position: Optional[
114
+ Literal["top-left", "top-right", "bottom-left", "bottom-right"]
115
+ ] = None,
101
116
  as_child: Optional[Union[Var[bool], bool]] = None,
102
- default_checked: Optional[Union[Var[bool], bool]] = None,
103
- checked: Optional[Union[Var[bool], bool]] = None,
104
- disabled: Optional[Union[Var[bool], bool]] = None,
105
- required: Optional[Union[Var[bool], bool]] = None,
106
- name: Optional[Union[Var[str], str]] = None,
107
- value: Optional[Union[Var[str], str]] = None,
108
117
  size: Optional[
109
- Union[Var[Literal["1", "2", "3"]], Literal["1", "2", "3"]]
118
+ Union[Var[Literal["1", "2", "3", "4"]], Literal["1", "2", "3", "4"]]
110
119
  ] = None,
111
120
  variant: Optional[
112
121
  Union[
113
- Var[Literal["classic", "surface", "soft"]],
114
- Literal["classic", "surface", "soft"],
122
+ Var[Literal["classic", "solid", "soft", "surface", "outline", "ghost"]],
123
+ Literal["classic", "solid", "soft", "surface", "outline", "ghost"],
115
124
  ]
116
125
  ] = None,
117
126
  color_scheme: Optional[
@@ -179,9 +188,76 @@ class ColorModeSwitch(Switch):
179
188
  high_contrast: Optional[Union[Var[bool], bool]] = None,
180
189
  radius: Optional[
181
190
  Union[
182
- Var[Literal["none", "small", "full"]], Literal["none", "small", "full"]
191
+ Var[Literal["none", "small", "medium", "large", "full"]],
192
+ Literal["none", "small", "medium", "large", "full"],
183
193
  ]
184
194
  ] = None,
195
+ auto_focus: Optional[
196
+ Union[Var[Union[str, int, bool]], Union[str, int, bool]]
197
+ ] = None,
198
+ disabled: Optional[Union[Var[bool], bool]] = None,
199
+ form: Optional[Union[Var[Union[str, int, bool]], Union[str, int, bool]]] = None,
200
+ form_action: Optional[
201
+ Union[Var[Union[str, int, bool]], Union[str, int, bool]]
202
+ ] = None,
203
+ form_enc_type: Optional[
204
+ Union[Var[Union[str, int, bool]], Union[str, int, bool]]
205
+ ] = None,
206
+ form_method: Optional[
207
+ Union[Var[Union[str, int, bool]], Union[str, int, bool]]
208
+ ] = None,
209
+ form_no_validate: Optional[
210
+ Union[Var[Union[str, int, bool]], Union[str, int, bool]]
211
+ ] = None,
212
+ form_target: Optional[
213
+ Union[Var[Union[str, int, bool]], Union[str, int, bool]]
214
+ ] = None,
215
+ name: Optional[Union[Var[Union[str, int, bool]], Union[str, int, bool]]] = None,
216
+ type: Optional[Union[Var[Union[str, int, bool]], Union[str, int, bool]]] = None,
217
+ value: Optional[
218
+ Union[Var[Union[str, int, bool]], Union[str, int, bool]]
219
+ ] = None,
220
+ access_key: Optional[
221
+ Union[Var[Union[str, int, bool]], Union[str, int, bool]]
222
+ ] = None,
223
+ auto_capitalize: Optional[
224
+ Union[Var[Union[str, int, bool]], Union[str, int, bool]]
225
+ ] = None,
226
+ content_editable: Optional[
227
+ Union[Var[Union[str, int, bool]], Union[str, int, bool]]
228
+ ] = None,
229
+ context_menu: Optional[
230
+ Union[Var[Union[str, int, bool]], Union[str, int, bool]]
231
+ ] = None,
232
+ dir: Optional[Union[Var[Union[str, int, bool]], Union[str, int, bool]]] = None,
233
+ draggable: Optional[
234
+ Union[Var[Union[str, int, bool]], Union[str, int, bool]]
235
+ ] = None,
236
+ enter_key_hint: Optional[
237
+ Union[Var[Union[str, int, bool]], Union[str, int, bool]]
238
+ ] = None,
239
+ hidden: Optional[
240
+ Union[Var[Union[str, int, bool]], Union[str, int, bool]]
241
+ ] = None,
242
+ input_mode: Optional[
243
+ Union[Var[Union[str, int, bool]], Union[str, int, bool]]
244
+ ] = None,
245
+ item_prop: Optional[
246
+ Union[Var[Union[str, int, bool]], Union[str, int, bool]]
247
+ ] = None,
248
+ lang: Optional[Union[Var[Union[str, int, bool]], Union[str, int, bool]]] = None,
249
+ role: Optional[Union[Var[Union[str, int, bool]], Union[str, int, bool]]] = None,
250
+ slot: Optional[Union[Var[Union[str, int, bool]], Union[str, int, bool]]] = None,
251
+ spell_check: Optional[
252
+ Union[Var[Union[str, int, bool]], Union[str, int, bool]]
253
+ ] = None,
254
+ tab_index: Optional[
255
+ Union[Var[Union[str, int, bool]], Union[str, int, bool]]
256
+ ] = None,
257
+ title: Optional[
258
+ Union[Var[Union[str, int, bool]], Union[str, int, bool]]
259
+ ] = None,
260
+ loading: Optional[Union[Var[bool], bool]] = None,
185
261
  style: Optional[Style] = None,
186
262
  key: Optional[Any] = None,
187
263
  id: Optional[Any] = None,
@@ -191,9 +267,6 @@ class ColorModeSwitch(Switch):
191
267
  on_blur: Optional[
192
268
  Union[EventHandler, EventSpec, list, function, BaseVar]
193
269
  ] = None,
194
- on_change: Optional[
195
- Union[EventHandler, EventSpec, list, function, BaseVar]
196
- ] = None,
197
270
  on_click: Optional[
198
271
  Union[EventHandler, EventSpec, list, function, BaseVar]
199
272
  ] = None,
@@ -237,23 +310,46 @@ class ColorModeSwitch(Switch):
237
310
  Union[EventHandler, EventSpec, list, function, BaseVar]
238
311
  ] = None,
239
312
  **props
240
- ) -> "ColorModeSwitch":
241
- """Create a switch component bound to color_mode.
313
+ ) -> "ColorModeIconButton":
314
+ """Create a icon button component that calls toggle_color_mode on click.
242
315
 
243
316
  Args:
244
317
  *children: The children of the component.
318
+ position: The position of the icon button. Follow document flow if None.
245
319
  as_child: Change the default rendered element for the one passed as a child, merging their props and behavior.
246
- default_checked: Whether the switch is checked by default
247
- checked: Whether the switch is checked
248
- disabled: If true, prevent the user from interacting with the switch
249
- required: If true, the user must interact with the switch to submit the form
250
- name: The name of the switch (when submitting a form)
251
- value: The value associated with the "on" position
252
- size: Switch size "1" - "4"
253
- variant: Variant of switch: "classic" | "surface" | "soft"
254
- color_scheme: Override theme color for switch
255
- high_contrast: Whether to render the switch with higher contrast color against background
256
- radius: Override theme radius for switch: "none" | "small" | "full"
320
+ size: Button size "1" - "4"
321
+ variant: Variant of button: "classic" | "solid" | "soft" | "surface" | "outline" | "ghost"
322
+ color_scheme: Override theme color for button
323
+ high_contrast: Whether to render the button with higher contrast color against background
324
+ radius: Override theme radius for button: "none" | "small" | "medium" | "large" | "full"
325
+ auto_focus: Automatically focuses the button when the page loads
326
+ disabled: Disables the button
327
+ form: Associates the button with a form (by id)
328
+ form_action: URL to send the form data to (for type="submit" buttons)
329
+ form_enc_type: How the form data should be encoded when submitting to the server (for type="submit" buttons)
330
+ form_method: HTTP method to use for sending form data (for type="submit" buttons)
331
+ form_no_validate: Bypasses form validation when submitting (for type="submit" buttons)
332
+ form_target: Specifies where to display the response after submitting the form (for type="submit" buttons)
333
+ name: Name of the button, used when sending form data
334
+ type: Type of the button (submit, reset, or button)
335
+ value: Value of the button, used when sending form data
336
+ access_key: Provides a hint for generating a keyboard shortcut for the current element.
337
+ auto_capitalize: Controls whether and how text input is automatically capitalized as it is entered/edited by the user.
338
+ content_editable: Indicates whether the element's content is editable.
339
+ context_menu: Defines the ID of a <menu> element which will serve as the element's context menu.
340
+ dir: Defines the text direction. Allowed values are ltr (Left-To-Right) or rtl (Right-To-Left)
341
+ draggable: Defines whether the element can be dragged.
342
+ enter_key_hint: Hints what media types the media element is able to play.
343
+ hidden: Defines whether the element is hidden.
344
+ input_mode: Defines the type of the element.
345
+ item_prop: Defines the name of the element for metadata purposes.
346
+ lang: Defines the language used in the element.
347
+ role: Defines the role of the element.
348
+ slot: Assigns a slot in a shadow DOM shadow tree to an element.
349
+ spell_check: Defines whether the element may be checked for spelling errors.
350
+ tab_index: Defines the position of the current element in the tabbing order.
351
+ title: Defines a tooltip for the element.
352
+ loading: If set, show an rx.spinner instead of the component children.
257
353
  style: The style of the component.
258
354
  key: A unique key for the component.
259
355
  id: The id for the component.
@@ -263,24 +359,30 @@ class ColorModeSwitch(Switch):
263
359
  **props: The props to pass to the component.
264
360
 
265
361
  Returns:
266
- The switch component.
362
+ The button component.
267
363
  """
268
364
  ...
269
365
 
270
- class ColorModeButton(Button):
366
+ class ColorModeSwitch(Switch):
271
367
  @overload
272
368
  @classmethod
273
369
  def create( # type: ignore
274
370
  cls,
275
371
  *children,
276
372
  as_child: Optional[Union[Var[bool], bool]] = None,
373
+ default_checked: Optional[Union[Var[bool], bool]] = None,
374
+ checked: Optional[Union[Var[bool], bool]] = None,
375
+ disabled: Optional[Union[Var[bool], bool]] = None,
376
+ required: Optional[Union[Var[bool], bool]] = None,
377
+ name: Optional[Union[Var[str], str]] = None,
378
+ value: Optional[Union[Var[str], str]] = None,
277
379
  size: Optional[
278
- Union[Var[Literal["1", "2", "3", "4"]], Literal["1", "2", "3", "4"]]
380
+ Union[Var[Literal["1", "2", "3"]], Literal["1", "2", "3"]]
279
381
  ] = None,
280
382
  variant: Optional[
281
383
  Union[
282
- Var[Literal["classic", "solid", "soft", "surface", "outline", "ghost"]],
283
- Literal["classic", "solid", "soft", "surface", "outline", "ghost"],
384
+ Var[Literal["classic", "surface", "soft"]],
385
+ Literal["classic", "surface", "soft"],
284
386
  ]
285
387
  ] = None,
286
388
  color_scheme: Optional[
@@ -348,75 +450,9 @@ class ColorModeButton(Button):
348
450
  high_contrast: Optional[Union[Var[bool], bool]] = None,
349
451
  radius: Optional[
350
452
  Union[
351
- Var[Literal["none", "small", "medium", "large", "full"]],
352
- Literal["none", "small", "medium", "large", "full"],
453
+ Var[Literal["none", "small", "full"]], Literal["none", "small", "full"]
353
454
  ]
354
455
  ] = None,
355
- auto_focus: Optional[
356
- Union[Var[Union[str, int, bool]], Union[str, int, bool]]
357
- ] = None,
358
- disabled: Optional[Union[Var[bool], bool]] = None,
359
- form: Optional[Union[Var[Union[str, int, bool]], Union[str, int, bool]]] = None,
360
- form_action: Optional[
361
- Union[Var[Union[str, int, bool]], Union[str, int, bool]]
362
- ] = None,
363
- form_enc_type: Optional[
364
- Union[Var[Union[str, int, bool]], Union[str, int, bool]]
365
- ] = None,
366
- form_method: Optional[
367
- Union[Var[Union[str, int, bool]], Union[str, int, bool]]
368
- ] = None,
369
- form_no_validate: Optional[
370
- Union[Var[Union[str, int, bool]], Union[str, int, bool]]
371
- ] = None,
372
- form_target: Optional[
373
- Union[Var[Union[str, int, bool]], Union[str, int, bool]]
374
- ] = None,
375
- name: Optional[Union[Var[Union[str, int, bool]], Union[str, int, bool]]] = None,
376
- type: Optional[Union[Var[Union[str, int, bool]], Union[str, int, bool]]] = None,
377
- value: Optional[
378
- Union[Var[Union[str, int, bool]], Union[str, int, bool]]
379
- ] = None,
380
- access_key: Optional[
381
- Union[Var[Union[str, int, bool]], Union[str, int, bool]]
382
- ] = None,
383
- auto_capitalize: Optional[
384
- Union[Var[Union[str, int, bool]], Union[str, int, bool]]
385
- ] = None,
386
- content_editable: Optional[
387
- Union[Var[Union[str, int, bool]], Union[str, int, bool]]
388
- ] = None,
389
- context_menu: Optional[
390
- Union[Var[Union[str, int, bool]], Union[str, int, bool]]
391
- ] = None,
392
- dir: Optional[Union[Var[Union[str, int, bool]], Union[str, int, bool]]] = None,
393
- draggable: Optional[
394
- Union[Var[Union[str, int, bool]], Union[str, int, bool]]
395
- ] = None,
396
- enter_key_hint: Optional[
397
- Union[Var[Union[str, int, bool]], Union[str, int, bool]]
398
- ] = None,
399
- hidden: Optional[
400
- Union[Var[Union[str, int, bool]], Union[str, int, bool]]
401
- ] = None,
402
- input_mode: Optional[
403
- Union[Var[Union[str, int, bool]], Union[str, int, bool]]
404
- ] = None,
405
- item_prop: Optional[
406
- Union[Var[Union[str, int, bool]], Union[str, int, bool]]
407
- ] = None,
408
- lang: Optional[Union[Var[Union[str, int, bool]], Union[str, int, bool]]] = None,
409
- role: Optional[Union[Var[Union[str, int, bool]], Union[str, int, bool]]] = None,
410
- slot: Optional[Union[Var[Union[str, int, bool]], Union[str, int, bool]]] = None,
411
- spell_check: Optional[
412
- Union[Var[Union[str, int, bool]], Union[str, int, bool]]
413
- ] = None,
414
- tab_index: Optional[
415
- Union[Var[Union[str, int, bool]], Union[str, int, bool]]
416
- ] = None,
417
- title: Optional[
418
- Union[Var[Union[str, int, bool]], Union[str, int, bool]]
419
- ] = None,
420
456
  style: Optional[Style] = None,
421
457
  key: Optional[Any] = None,
422
458
  id: Optional[Any] = None,
@@ -426,6 +462,9 @@ class ColorModeButton(Button):
426
462
  on_blur: Optional[
427
463
  Union[EventHandler, EventSpec, list, function, BaseVar]
428
464
  ] = None,
465
+ on_change: Optional[
466
+ Union[EventHandler, EventSpec, list, function, BaseVar]
467
+ ] = None,
429
468
  on_click: Optional[
430
469
  Union[EventHandler, EventSpec, list, function, BaseVar]
431
470
  ] = None,
@@ -469,44 +508,23 @@ class ColorModeButton(Button):
469
508
  Union[EventHandler, EventSpec, list, function, BaseVar]
470
509
  ] = None,
471
510
  **props
472
- ) -> "ColorModeButton":
473
- """Create a button component that calls toggle_color_mode on click.
511
+ ) -> "ColorModeSwitch":
512
+ """Create a switch component bound to color_mode.
474
513
 
475
514
  Args:
476
515
  *children: The children of the component.
477
516
  as_child: Change the default rendered element for the one passed as a child, merging their props and behavior.
478
- size: Button size "1" - "4"
479
- variant: Variant of button: "solid" | "soft" | "outline" | "ghost"
480
- color_scheme: Override theme color for button
481
- high_contrast: Whether to render the button with higher contrast color against background
482
- radius: Override theme radius for button: "none" | "small" | "medium" | "large" | "full"
483
- auto_focus: Automatically focuses the button when the page loads
484
- disabled: Disables the button
485
- form: Associates the button with a form (by id)
486
- form_action: URL to send the form data to (for type="submit" buttons)
487
- form_enc_type: How the form data should be encoded when submitting to the server (for type="submit" buttons)
488
- form_method: HTTP method to use for sending form data (for type="submit" buttons)
489
- form_no_validate: Bypasses form validation when submitting (for type="submit" buttons)
490
- form_target: Specifies where to display the response after submitting the form (for type="submit" buttons)
491
- name: Name of the button, used when sending form data
492
- type: Type of the button (submit, reset, or button)
493
- value: Value of the button, used when sending form data
494
- access_key: Provides a hint for generating a keyboard shortcut for the current element.
495
- auto_capitalize: Controls whether and how text input is automatically capitalized as it is entered/edited by the user.
496
- content_editable: Indicates whether the element's content is editable.
497
- context_menu: Defines the ID of a <menu> element which will serve as the element's context menu.
498
- dir: Defines the text direction. Allowed values are ltr (Left-To-Right) or rtl (Right-To-Left)
499
- draggable: Defines whether the element can be dragged.
500
- enter_key_hint: Hints what media types the media element is able to play.
501
- hidden: Defines whether the element is hidden.
502
- input_mode: Defines the type of the element.
503
- item_prop: Defines the name of the element for metadata purposes.
504
- lang: Defines the language used in the element.
505
- role: Defines the role of the element.
506
- slot: Assigns a slot in a shadow DOM shadow tree to an element.
507
- spell_check: Defines whether the element may be checked for spelling errors.
508
- tab_index: Defines the position of the current element in the tabbing order.
509
- title: Defines a tooltip for the element.
517
+ default_checked: Whether the switch is checked by default
518
+ checked: Whether the switch is checked
519
+ disabled: If true, prevent the user from interacting with the switch
520
+ required: If true, the user must interact with the switch to submit the form
521
+ name: The name of the switch (when submitting a form)
522
+ value: The value associated with the "on" position
523
+ size: Switch size "1" - "4"
524
+ variant: Variant of switch: "classic" | "surface" | "soft"
525
+ color_scheme: Override theme color for switch
526
+ high_contrast: Whether to render the switch with higher contrast color against background
527
+ radius: Override theme radius for switch: "none" | "small" | "full"
510
528
  style: The style of the component.
511
529
  key: A unique key for the component.
512
530
  id: The id for the component.
@@ -516,13 +534,13 @@ class ColorModeButton(Button):
516
534
  **props: The props to pass to the component.
517
535
 
518
536
  Returns:
519
- The button component.
537
+ The switch component.
520
538
  """
521
539
  ...
522
540
 
523
541
  class ColorModeNamespace(BaseVar):
524
542
  icon = staticmethod(ColorModeIcon.create)
543
+ button = staticmethod(ColorModeIconButton.create)
525
544
  switch = staticmethod(ColorModeSwitch.create)
526
- button = staticmethod(ColorModeButton.create)
527
545
 
528
546
  color_mode_var_and_namespace = ColorModeNamespace(**dataclasses.asdict(color_mode))
@@ -8,7 +8,10 @@ from .button import button as button
8
8
  from .callout import callout as callout
9
9
  from .card import card as card
10
10
  from .checkbox import checkbox as checkbox
11
+ from .checkbox_cards import checkbox_cards as checkbox_cards
12
+ from .checkbox_group import checkbox_group as checkbox_group
11
13
  from .context_menu import context_menu as context_menu
14
+ from .data_list import data_list as data_list
12
15
  from .dialog import dialog as dialog
13
16
  from .dropdown_menu import dropdown_menu as dropdown_menu
14
17
  from .dropdown_menu import menu as menu
@@ -16,13 +19,18 @@ from .hover_card import hover_card as hover_card
16
19
  from .icon_button import icon_button as icon_button
17
20
  from .inset import inset as inset
18
21
  from .popover import popover as popover
22
+ from .progress import progress as progress
23
+ from .radio_cards import radio_cards as radio_cards
19
24
  from .radio_group import radio as radio
20
25
  from .radio_group import radio_group as radio_group
21
26
  from .scroll_area import scroll_area as scroll_area
27
+ from .segmented_control import segmented_control as segmented_control
22
28
  from .select import select as select
23
29
  from .separator import divider as divider
24
30
  from .separator import separator as separator
31
+ from .skeleton import skeleton as skeleton
25
32
  from .slider import slider as slider
33
+ from .spinner import spinner as spinner
26
34
  from .switch import switch as switch
27
35
  from .table import table as table
28
36
  from .tabs import tabs as tabs
@@ -41,7 +49,10 @@ __all__ = [
41
49
  "callout",
42
50
  "card",
43
51
  "checkbox",
52
+ "checkbox_cards",
53
+ "checkbox_group",
44
54
  "context_menu",
55
+ "data_list",
45
56
  "dialog",
46
57
  "divider",
47
58
  "dropdown_menu",
@@ -51,12 +62,18 @@ __all__ = [
51
62
  "inset",
52
63
  "menu",
53
64
  "popover",
65
+ # progress is in experimental namespace until https://github.com/radix-ui/themes/pull/492
66
+ # "progress",
54
67
  "radio",
68
+ "radio_cards",
55
69
  "radio_group",
56
70
  "scroll_area",
71
+ "segmented_control",
57
72
  "select",
58
73
  "separator",
74
+ "skeleton",
59
75
  "slider",
76
+ "spinner",
60
77
  "switch",
61
78
  "table",
62
79
  "tabs",
@@ -1,4 +1,5 @@
1
1
  """Interactive components provided by @radix-ui/themes."""
2
+
2
3
  from typing import Literal
3
4
 
4
5
  from reflex import el
@@ -20,7 +21,7 @@ class Badge(el.Span, RadixThemesComponent):
20
21
  variant: Var[Literal["solid", "soft", "surface", "outline"]]
21
22
 
22
23
  # The size of the badge
23
- size: Var[Literal["1", "2"]]
24
+ size: Var[Literal["1", "2", "3"]]
24
25
 
25
26
  # Color theme of the badge
26
27
  color_scheme: Var[LiteralAccentColor]
@@ -24,7 +24,9 @@ class Badge(el.Span, RadixThemesComponent):
24
24
  Literal["solid", "soft", "surface", "outline"],
25
25
  ]
26
26
  ] = None,
27
- size: Optional[Union[Var[Literal["1", "2"]], Literal["1", "2"]]] = None,
27
+ size: Optional[
28
+ Union[Var[Literal["1", "2", "3"]], Literal["1", "2", "3"]]
29
+ ] = None,
28
30
  color_scheme: Optional[
29
31
  Union[
30
32
  Var[
@@ -1,4 +1,5 @@
1
1
  """Interactive components provided by @radix-ui/themes."""
2
+
2
3
  from typing import Literal
3
4
 
4
5
  from reflex import el
@@ -8,13 +9,14 @@ from ..base import (
8
9
  LiteralAccentColor,
9
10
  LiteralRadius,
10
11
  LiteralVariant,
12
+ RadixLoadingProp,
11
13
  RadixThemesComponent,
12
14
  )
13
15
 
14
16
  LiteralButtonSize = Literal["1", "2", "3", "4"]
15
17
 
16
18
 
17
- class Button(el.Button, RadixThemesComponent):
19
+ class Button(el.Button, RadixLoadingProp, RadixThemesComponent):
18
20
  """Trigger an action or event, such as submitting a form or displaying a dialog."""
19
21
 
20
22
  tag = "Button"
@@ -14,12 +14,13 @@ from ..base import (
14
14
  LiteralAccentColor,
15
15
  LiteralRadius,
16
16
  LiteralVariant,
17
+ RadixLoadingProp,
17
18
  RadixThemesComponent,
18
19
  )
19
20
 
20
21
  LiteralButtonSize = Literal["1", "2", "3", "4"]
21
22
 
22
- class Button(el.Button, RadixThemesComponent):
23
+ class Button(el.Button, RadixLoadingProp, RadixThemesComponent):
23
24
  @overload
24
25
  @classmethod
25
26
  def create( # type: ignore
@@ -169,6 +170,7 @@ class Button(el.Button, RadixThemesComponent):
169
170
  title: Optional[
170
171
  Union[Var[Union[str, int, bool]], Union[str, int, bool]]
171
172
  ] = None,
173
+ loading: Optional[Union[Var[bool], bool]] = None,
172
174
  style: Optional[Style] = None,
173
175
  key: Optional[Any] = None,
174
176
  id: Optional[Any] = None,
@@ -262,6 +264,7 @@ class Button(el.Button, RadixThemesComponent):
262
264
  spell_check: Defines whether the element may be checked for spelling errors.
263
265
  tab_index: Defines the position of the current element in the tabbing order.
264
266
  title: Defines a tooltip for the element.
267
+ loading: If set, show an rx.spinner instead of the component children.
265
268
  style: The style of the component.
266
269
  key: A unique key for the component.
267
270
  id: The id for the component.
@@ -0,0 +1,48 @@
1
+ """Components for the Radix CheckboxCards component."""
2
+
3
+ from types import SimpleNamespace
4
+ from typing import Literal, Union
5
+
6
+ from reflex.vars import Var
7
+
8
+ from ..base import LiteralAccentColor, RadixThemesComponent
9
+
10
+
11
+ class CheckboxCardsRoot(RadixThemesComponent):
12
+ """Root element for a CheckboxCards component."""
13
+
14
+ tag = "CheckboxCards.Root"
15
+
16
+ # The size of the checkbox cards: "1" | "2" | "3"
17
+ size: Var[Literal["1", "2", "3"]]
18
+
19
+ # Variant of button: "classic" | "surface" | "soft"
20
+ variant: Var[Literal["classic", "surface"]]
21
+
22
+ # Override theme color for button
23
+ color_scheme: Var[LiteralAccentColor]
24
+
25
+ # Uses a higher contrast color for the component.
26
+ high_contrast: Var[bool]
27
+
28
+ # The number of columns:
29
+ columns: Var[Union[str, Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]]]
30
+
31
+ # The gap between the checkbox cards:
32
+ gap: Var[Union[str, Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]]]
33
+
34
+
35
+ class CheckboxCardsItem(RadixThemesComponent):
36
+ """An item in the CheckboxCards component."""
37
+
38
+ tag = "CheckboxCards.Item"
39
+
40
+
41
+ class CheckboxCards(SimpleNamespace):
42
+ """CheckboxCards components namespace."""
43
+
44
+ root = staticmethod(CheckboxCardsRoot.create)
45
+ item = staticmethod(CheckboxCardsItem.create)
46
+
47
+
48
+ checkbox_cards = CheckboxCards()