reflex 0.4.9a2__py3-none-any.whl → 0.5.0a1__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 (131) hide show
  1. reflex/.templates/apps/blank/code/blank.py +19 -16
  2. reflex/.templates/apps/demo/code/pages/datatable.py +4 -4
  3. reflex/.templates/apps/demo/code/pages/forms.py +2 -2
  4. reflex/.templates/web/utils/helpers/debounce.js +17 -0
  5. reflex/.templates/web/utils/helpers/throttle.js +22 -0
  6. reflex/.templates/web/utils/state.js +21 -3
  7. reflex/__init__.py +6 -1
  8. reflex/__init__.pyi +4 -1
  9. reflex/app.py +157 -140
  10. reflex/app_module_for_backend.py +1 -1
  11. reflex/base.py +13 -15
  12. reflex/compiler/compiler.py +10 -1
  13. reflex/compiler/utils.py +3 -30
  14. reflex/components/__init__.py +1 -0
  15. reflex/components/chakra/datadisplay/list.py +1 -3
  16. reflex/components/chakra/datadisplay/list.pyi +3 -3
  17. reflex/components/chakra/disclosure/accordion.py +1 -1
  18. reflex/components/chakra/forms/pininput.pyi +1 -1
  19. reflex/components/chakra/media/icon.py +2 -2
  20. reflex/components/component.py +279 -32
  21. reflex/components/core/__init__.py +2 -2
  22. reflex/components/core/cond.py +1 -10
  23. reflex/components/core/debounce.py +5 -2
  24. reflex/components/core/debounce.pyi +4 -2
  25. reflex/components/core/foreach.py +1 -16
  26. reflex/components/core/html.py +6 -0
  27. reflex/components/core/match.py +2 -17
  28. reflex/components/core/upload.py +42 -1
  29. reflex/components/core/upload.pyi +199 -1
  30. reflex/components/datadisplay/code.py +7 -3
  31. reflex/components/datadisplay/code.pyi +3 -1
  32. reflex/components/el/elements/forms.py +1 -1
  33. reflex/components/el/elements/forms.pyi +1 -1
  34. reflex/components/lucide/icon.py +5 -13
  35. reflex/components/lucide/icon.pyi +0 -1
  36. reflex/components/markdown/markdown.py +5 -23
  37. reflex/components/markdown/markdown.pyi +1 -4
  38. reflex/components/radix/primitives/accordion.py +227 -406
  39. reflex/components/radix/primitives/accordion.pyi +369 -28
  40. reflex/components/radix/primitives/form.py +33 -29
  41. reflex/components/radix/primitives/form.pyi +7 -2
  42. reflex/components/radix/primitives/progress.py +17 -9
  43. reflex/components/radix/primitives/progress.pyi +2 -0
  44. reflex/components/radix/primitives/slider.py +30 -18
  45. reflex/components/radix/primitives/slider.pyi +4 -0
  46. reflex/components/radix/themes/base.py +8 -1
  47. reflex/components/radix/themes/base.pyi +79 -1
  48. reflex/components/radix/themes/color_mode.py +74 -30
  49. reflex/components/radix/themes/color_mode.pyi +26 -185
  50. reflex/components/radix/themes/components/__init__.py +17 -0
  51. reflex/components/radix/themes/components/badge.py +2 -1
  52. reflex/components/radix/themes/components/badge.pyi +3 -1
  53. reflex/components/radix/themes/components/button.py +3 -1
  54. reflex/components/radix/themes/components/button.pyi +4 -1
  55. reflex/components/radix/themes/components/checkbox_cards.py +48 -0
  56. reflex/components/radix/themes/components/checkbox_cards.pyi +264 -0
  57. reflex/components/radix/themes/components/checkbox_group.py +42 -0
  58. reflex/components/radix/themes/components/checkbox_group.pyi +253 -0
  59. reflex/components/radix/themes/components/data_list.py +63 -0
  60. reflex/components/radix/themes/components/data_list.pyi +426 -0
  61. reflex/components/radix/themes/components/icon_button.py +20 -17
  62. reflex/components/radix/themes/components/icon_button.pyi +5 -1
  63. reflex/components/radix/themes/components/progress.py +55 -0
  64. reflex/components/radix/themes/components/progress.pyi +180 -0
  65. reflex/components/radix/themes/components/radio.py +31 -0
  66. reflex/components/radix/themes/components/radio.pyi +169 -0
  67. reflex/components/radix/themes/components/radio_cards.py +48 -0
  68. reflex/components/radix/themes/components/radio_cards.pyi +264 -0
  69. reflex/components/radix/themes/components/radio_group.py +2 -4
  70. reflex/components/radix/themes/components/segmented_control.py +48 -0
  71. reflex/components/radix/themes/components/segmented_control.pyi +262 -0
  72. reflex/components/radix/themes/components/skeleton.py +32 -0
  73. reflex/components/radix/themes/components/skeleton.pyi +106 -0
  74. reflex/components/radix/themes/components/spinner.py +26 -0
  75. reflex/components/radix/themes/components/spinner.pyi +101 -0
  76. reflex/components/radix/themes/components/tabs.py +26 -1
  77. reflex/components/radix/themes/components/tabs.pyi +69 -9
  78. reflex/components/radix/themes/components/text_field.py +101 -71
  79. reflex/components/radix/themes/components/text_field.pyi +81 -499
  80. reflex/components/radix/themes/layout/base.py +2 -2
  81. reflex/components/radix/themes/layout/base.pyi +4 -4
  82. reflex/components/radix/themes/layout/center.py +8 -3
  83. reflex/components/radix/themes/layout/center.pyi +2 -1
  84. reflex/components/radix/themes/layout/container.py +30 -2
  85. reflex/components/radix/themes/layout/container.pyi +9 -30
  86. reflex/components/radix/themes/layout/list.py +10 -5
  87. reflex/components/radix/themes/layout/list.pyi +5 -21
  88. reflex/components/radix/themes/layout/spacer.py +8 -3
  89. reflex/components/radix/themes/layout/spacer.pyi +2 -1
  90. reflex/components/radix/themes/layout/stack.py +7 -1
  91. reflex/components/radix/themes/layout/stack.pyi +3 -3
  92. reflex/components/radix/themes/typography/link.py +10 -2
  93. reflex/components/radix/themes/typography/link.pyi +5 -4
  94. reflex/components/sonner/__init__.py +3 -0
  95. reflex/components/sonner/toast.py +267 -0
  96. reflex/components/sonner/toast.pyi +205 -0
  97. reflex/components/tags/iter_tag.py +9 -6
  98. reflex/config.py +30 -54
  99. reflex/constants/__init__.py +0 -2
  100. reflex/constants/base.py +0 -5
  101. reflex/constants/colors.py +2 -0
  102. reflex/constants/installer.py +5 -1
  103. reflex/constants/route.py +4 -0
  104. reflex/custom_components/custom_components.py +22 -1
  105. reflex/event.py +75 -30
  106. reflex/experimental/__init__.py +5 -0
  107. reflex/experimental/layout.py +24 -6
  108. reflex/model.py +2 -1
  109. reflex/page.py +7 -4
  110. reflex/reflex.py +8 -3
  111. reflex/route.py +39 -0
  112. reflex/state.py +128 -131
  113. reflex/style.py +20 -1
  114. reflex/testing.py +10 -6
  115. reflex/utils/console.py +3 -1
  116. reflex/utils/exec.py +20 -7
  117. reflex/utils/format.py +1 -1
  118. reflex/utils/imports.py +3 -1
  119. reflex/utils/prerequisites.py +141 -20
  120. reflex/utils/processes.py +21 -1
  121. reflex/utils/pyi_generator.py +95 -5
  122. reflex/utils/serializers.py +1 -1
  123. reflex/utils/telemetry.py +26 -4
  124. reflex/utils/types.py +62 -18
  125. reflex/vars.py +11 -5
  126. {reflex-0.4.9a2.dist-info → reflex-0.5.0a1.dist-info}/METADATA +16 -4
  127. {reflex-0.4.9a2.dist-info → reflex-0.5.0a1.dist-info}/RECORD +130 -108
  128. {reflex-0.4.9a2.dist-info → reflex-0.5.0a1.dist-info}/WHEEL +1 -1
  129. reflex/app.pyi +0 -149
  130. {reflex-0.4.9a2.dist-info → reflex-0.5.0a1.dist-info}/LICENSE +0 -0
  131. {reflex-0.4.9a2.dist-info → reflex-0.5.0a1.dist-info}/entry_points.txt +0 -0
@@ -0,0 +1,426 @@
1
+ """Stub file for reflex/components/radix/themes/components/data_list.py"""
2
+ # ------------------- DO NOT EDIT ----------------------
3
+ # This file was generated by `reflex/utils/pyi_generator.py`!
4
+ # ------------------------------------------------------
5
+
6
+ from typing import Any, Dict, Literal, Optional, Union, overload
7
+ from reflex.vars import Var, BaseVar, ComputedVar
8
+ from reflex.event import EventChain, EventHandler, EventSpec
9
+ from reflex.style import Style
10
+ from types import SimpleNamespace
11
+ from typing import Literal
12
+ from reflex.vars import Var
13
+ from ..base import LiteralAccentColor, RadixThemesComponent
14
+
15
+ class DataListRoot(RadixThemesComponent):
16
+ @overload
17
+ @classmethod
18
+ def create( # type: ignore
19
+ cls,
20
+ *children,
21
+ orientation: Optional[
22
+ Union[
23
+ Var[Literal["horizontal", "vertical"]],
24
+ Literal["horizontal", "vertical"],
25
+ ]
26
+ ] = None,
27
+ size: Optional[
28
+ Union[Var[Literal["1", "2", "3"]], Literal["1", "2", "3"]]
29
+ ] = None,
30
+ trim: Optional[
31
+ Union[
32
+ Var[Literal["normal", "start", "end", "both"]],
33
+ Literal["normal", "start", "end", "both"],
34
+ ]
35
+ ] = None,
36
+ style: Optional[Style] = None,
37
+ key: Optional[Any] = None,
38
+ id: Optional[Any] = None,
39
+ class_name: Optional[Any] = None,
40
+ autofocus: Optional[bool] = None,
41
+ custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
42
+ on_blur: Optional[
43
+ Union[EventHandler, EventSpec, list, function, BaseVar]
44
+ ] = None,
45
+ on_click: Optional[
46
+ Union[EventHandler, EventSpec, list, function, BaseVar]
47
+ ] = None,
48
+ on_context_menu: Optional[
49
+ Union[EventHandler, EventSpec, list, function, BaseVar]
50
+ ] = None,
51
+ on_double_click: Optional[
52
+ Union[EventHandler, EventSpec, list, function, BaseVar]
53
+ ] = None,
54
+ on_focus: Optional[
55
+ Union[EventHandler, EventSpec, list, function, BaseVar]
56
+ ] = None,
57
+ on_mount: Optional[
58
+ Union[EventHandler, EventSpec, list, function, BaseVar]
59
+ ] = None,
60
+ on_mouse_down: Optional[
61
+ Union[EventHandler, EventSpec, list, function, BaseVar]
62
+ ] = None,
63
+ on_mouse_enter: Optional[
64
+ Union[EventHandler, EventSpec, list, function, BaseVar]
65
+ ] = None,
66
+ on_mouse_leave: Optional[
67
+ Union[EventHandler, EventSpec, list, function, BaseVar]
68
+ ] = None,
69
+ on_mouse_move: Optional[
70
+ Union[EventHandler, EventSpec, list, function, BaseVar]
71
+ ] = None,
72
+ on_mouse_out: Optional[
73
+ Union[EventHandler, EventSpec, list, function, BaseVar]
74
+ ] = None,
75
+ on_mouse_over: Optional[
76
+ Union[EventHandler, EventSpec, list, function, BaseVar]
77
+ ] = None,
78
+ on_mouse_up: Optional[
79
+ Union[EventHandler, EventSpec, list, function, BaseVar]
80
+ ] = None,
81
+ on_scroll: Optional[
82
+ Union[EventHandler, EventSpec, list, function, BaseVar]
83
+ ] = None,
84
+ on_unmount: Optional[
85
+ Union[EventHandler, EventSpec, list, function, BaseVar]
86
+ ] = None,
87
+ **props
88
+ ) -> "DataListRoot":
89
+ """Create a new component instance.
90
+
91
+ Will prepend "RadixThemes" to the component tag to avoid conflicts with
92
+ other UI libraries for common names, like Text and Button.
93
+
94
+ Args:
95
+ *children: Child components.
96
+ orientation: The orientation of the data list item: "horizontal" | "vertical"
97
+ size: The size of the data list item: "1" | "2" | "3"
98
+ trim: Trims the leading whitespace from the start or end of the text.
99
+ style: The style of the component.
100
+ key: A unique key for the component.
101
+ id: The id for the component.
102
+ class_name: The class name for the component.
103
+ autofocus: Whether the component should take the focus once the page is loaded
104
+ custom_attrs: custom attribute
105
+ **props: Component properties.
106
+
107
+ Returns:
108
+ A new component instance.
109
+ """
110
+ ...
111
+
112
+ class DataListItem(RadixThemesComponent):
113
+ @overload
114
+ @classmethod
115
+ def create( # type: ignore
116
+ cls,
117
+ *children,
118
+ align: Optional[
119
+ Union[
120
+ Var[Literal["start", "center", "end", "baseline", "stretch"]],
121
+ Literal["start", "center", "end", "baseline", "stretch"],
122
+ ]
123
+ ] = None,
124
+ style: Optional[Style] = None,
125
+ key: Optional[Any] = None,
126
+ id: Optional[Any] = None,
127
+ class_name: Optional[Any] = None,
128
+ autofocus: Optional[bool] = None,
129
+ custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
130
+ on_blur: Optional[
131
+ Union[EventHandler, EventSpec, list, function, BaseVar]
132
+ ] = None,
133
+ on_click: Optional[
134
+ Union[EventHandler, EventSpec, list, function, BaseVar]
135
+ ] = None,
136
+ on_context_menu: Optional[
137
+ Union[EventHandler, EventSpec, list, function, BaseVar]
138
+ ] = None,
139
+ on_double_click: Optional[
140
+ Union[EventHandler, EventSpec, list, function, BaseVar]
141
+ ] = None,
142
+ on_focus: Optional[
143
+ Union[EventHandler, EventSpec, list, function, BaseVar]
144
+ ] = None,
145
+ on_mount: Optional[
146
+ Union[EventHandler, EventSpec, list, function, BaseVar]
147
+ ] = None,
148
+ on_mouse_down: Optional[
149
+ Union[EventHandler, EventSpec, list, function, BaseVar]
150
+ ] = None,
151
+ on_mouse_enter: Optional[
152
+ Union[EventHandler, EventSpec, list, function, BaseVar]
153
+ ] = None,
154
+ on_mouse_leave: Optional[
155
+ Union[EventHandler, EventSpec, list, function, BaseVar]
156
+ ] = None,
157
+ on_mouse_move: Optional[
158
+ Union[EventHandler, EventSpec, list, function, BaseVar]
159
+ ] = None,
160
+ on_mouse_out: Optional[
161
+ Union[EventHandler, EventSpec, list, function, BaseVar]
162
+ ] = None,
163
+ on_mouse_over: Optional[
164
+ Union[EventHandler, EventSpec, list, function, BaseVar]
165
+ ] = None,
166
+ on_mouse_up: Optional[
167
+ Union[EventHandler, EventSpec, list, function, BaseVar]
168
+ ] = None,
169
+ on_scroll: Optional[
170
+ Union[EventHandler, EventSpec, list, function, BaseVar]
171
+ ] = None,
172
+ on_unmount: Optional[
173
+ Union[EventHandler, EventSpec, list, function, BaseVar]
174
+ ] = None,
175
+ **props
176
+ ) -> "DataListItem":
177
+ """Create a new component instance.
178
+
179
+ Will prepend "RadixThemes" to the component tag to avoid conflicts with
180
+ other UI libraries for common names, like Text and Button.
181
+
182
+ Args:
183
+ *children: Child components.
184
+ style: The style of the component.
185
+ key: A unique key for the component.
186
+ id: The id for the component.
187
+ class_name: The class name for the component.
188
+ autofocus: Whether the component should take the focus once the page is loaded
189
+ custom_attrs: custom attribute
190
+ **props: Component properties.
191
+
192
+ Returns:
193
+ A new component instance.
194
+ """
195
+ ...
196
+
197
+ class DataListLabel(RadixThemesComponent):
198
+ @overload
199
+ @classmethod
200
+ def create( # type: ignore
201
+ cls,
202
+ *children,
203
+ width: Optional[Union[Var[str], str]] = None,
204
+ min_width: Optional[Union[Var[str], str]] = None,
205
+ max_width: Optional[Union[Var[str], str]] = None,
206
+ color_scheme: Optional[
207
+ Union[
208
+ Var[
209
+ Literal[
210
+ "tomato",
211
+ "red",
212
+ "ruby",
213
+ "crimson",
214
+ "pink",
215
+ "plum",
216
+ "purple",
217
+ "violet",
218
+ "iris",
219
+ "indigo",
220
+ "blue",
221
+ "cyan",
222
+ "teal",
223
+ "jade",
224
+ "green",
225
+ "grass",
226
+ "brown",
227
+ "orange",
228
+ "sky",
229
+ "mint",
230
+ "lime",
231
+ "yellow",
232
+ "amber",
233
+ "gold",
234
+ "bronze",
235
+ "gray",
236
+ ]
237
+ ],
238
+ Literal[
239
+ "tomato",
240
+ "red",
241
+ "ruby",
242
+ "crimson",
243
+ "pink",
244
+ "plum",
245
+ "purple",
246
+ "violet",
247
+ "iris",
248
+ "indigo",
249
+ "blue",
250
+ "cyan",
251
+ "teal",
252
+ "jade",
253
+ "green",
254
+ "grass",
255
+ "brown",
256
+ "orange",
257
+ "sky",
258
+ "mint",
259
+ "lime",
260
+ "yellow",
261
+ "amber",
262
+ "gold",
263
+ "bronze",
264
+ "gray",
265
+ ],
266
+ ]
267
+ ] = None,
268
+ style: Optional[Style] = None,
269
+ key: Optional[Any] = None,
270
+ id: Optional[Any] = None,
271
+ class_name: Optional[Any] = None,
272
+ autofocus: Optional[bool] = None,
273
+ custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
274
+ on_blur: Optional[
275
+ Union[EventHandler, EventSpec, list, function, BaseVar]
276
+ ] = None,
277
+ on_click: Optional[
278
+ Union[EventHandler, EventSpec, list, function, BaseVar]
279
+ ] = None,
280
+ on_context_menu: Optional[
281
+ Union[EventHandler, EventSpec, list, function, BaseVar]
282
+ ] = None,
283
+ on_double_click: Optional[
284
+ Union[EventHandler, EventSpec, list, function, BaseVar]
285
+ ] = None,
286
+ on_focus: Optional[
287
+ Union[EventHandler, EventSpec, list, function, BaseVar]
288
+ ] = None,
289
+ on_mount: Optional[
290
+ Union[EventHandler, EventSpec, list, function, BaseVar]
291
+ ] = None,
292
+ on_mouse_down: Optional[
293
+ Union[EventHandler, EventSpec, list, function, BaseVar]
294
+ ] = None,
295
+ on_mouse_enter: Optional[
296
+ Union[EventHandler, EventSpec, list, function, BaseVar]
297
+ ] = None,
298
+ on_mouse_leave: Optional[
299
+ Union[EventHandler, EventSpec, list, function, BaseVar]
300
+ ] = None,
301
+ on_mouse_move: Optional[
302
+ Union[EventHandler, EventSpec, list, function, BaseVar]
303
+ ] = None,
304
+ on_mouse_out: Optional[
305
+ Union[EventHandler, EventSpec, list, function, BaseVar]
306
+ ] = None,
307
+ on_mouse_over: Optional[
308
+ Union[EventHandler, EventSpec, list, function, BaseVar]
309
+ ] = None,
310
+ on_mouse_up: Optional[
311
+ Union[EventHandler, EventSpec, list, function, BaseVar]
312
+ ] = None,
313
+ on_scroll: Optional[
314
+ Union[EventHandler, EventSpec, list, function, BaseVar]
315
+ ] = None,
316
+ on_unmount: Optional[
317
+ Union[EventHandler, EventSpec, list, function, BaseVar]
318
+ ] = None,
319
+ **props
320
+ ) -> "DataListLabel":
321
+ """Create a new component instance.
322
+
323
+ Will prepend "RadixThemes" to the component tag to avoid conflicts with
324
+ other UI libraries for common names, like Text and Button.
325
+
326
+ Args:
327
+ *children: Child components.
328
+ style: The style of the component.
329
+ key: A unique key for the component.
330
+ id: The id for the component.
331
+ class_name: The class name for the component.
332
+ autofocus: Whether the component should take the focus once the page is loaded
333
+ custom_attrs: custom attribute
334
+ **props: Component properties.
335
+
336
+ Returns:
337
+ A new component instance.
338
+ """
339
+ ...
340
+
341
+ class DataListValue(RadixThemesComponent):
342
+ @overload
343
+ @classmethod
344
+ def create( # type: ignore
345
+ cls,
346
+ *children,
347
+ style: Optional[Style] = None,
348
+ key: Optional[Any] = None,
349
+ id: Optional[Any] = None,
350
+ class_name: Optional[Any] = None,
351
+ autofocus: Optional[bool] = None,
352
+ custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
353
+ on_blur: Optional[
354
+ Union[EventHandler, EventSpec, list, function, BaseVar]
355
+ ] = None,
356
+ on_click: Optional[
357
+ Union[EventHandler, EventSpec, list, function, BaseVar]
358
+ ] = None,
359
+ on_context_menu: Optional[
360
+ Union[EventHandler, EventSpec, list, function, BaseVar]
361
+ ] = None,
362
+ on_double_click: Optional[
363
+ Union[EventHandler, EventSpec, list, function, BaseVar]
364
+ ] = None,
365
+ on_focus: Optional[
366
+ Union[EventHandler, EventSpec, list, function, BaseVar]
367
+ ] = None,
368
+ on_mount: Optional[
369
+ Union[EventHandler, EventSpec, list, function, BaseVar]
370
+ ] = None,
371
+ on_mouse_down: Optional[
372
+ Union[EventHandler, EventSpec, list, function, BaseVar]
373
+ ] = None,
374
+ on_mouse_enter: Optional[
375
+ Union[EventHandler, EventSpec, list, function, BaseVar]
376
+ ] = None,
377
+ on_mouse_leave: Optional[
378
+ Union[EventHandler, EventSpec, list, function, BaseVar]
379
+ ] = None,
380
+ on_mouse_move: Optional[
381
+ Union[EventHandler, EventSpec, list, function, BaseVar]
382
+ ] = None,
383
+ on_mouse_out: Optional[
384
+ Union[EventHandler, EventSpec, list, function, BaseVar]
385
+ ] = None,
386
+ on_mouse_over: Optional[
387
+ Union[EventHandler, EventSpec, list, function, BaseVar]
388
+ ] = None,
389
+ on_mouse_up: Optional[
390
+ Union[EventHandler, EventSpec, list, function, BaseVar]
391
+ ] = None,
392
+ on_scroll: Optional[
393
+ Union[EventHandler, EventSpec, list, function, BaseVar]
394
+ ] = None,
395
+ on_unmount: Optional[
396
+ Union[EventHandler, EventSpec, list, function, BaseVar]
397
+ ] = None,
398
+ **props
399
+ ) -> "DataListValue":
400
+ """Create a new component instance.
401
+
402
+ Will prepend "RadixThemes" to the component tag to avoid conflicts with
403
+ other UI libraries for common names, like Text and Button.
404
+
405
+ Args:
406
+ *children: Child components.
407
+ style: The style of the component.
408
+ key: A unique key for the component.
409
+ id: The id for the component.
410
+ class_name: The class name for the component.
411
+ autofocus: Whether the component should take the focus once the page is loaded
412
+ custom_attrs: custom attribute
413
+ **props: Component properties.
414
+
415
+ Returns:
416
+ A new component instance.
417
+ """
418
+ ...
419
+
420
+ class DataList(SimpleNamespace):
421
+ root = staticmethod(DataListRoot.create)
422
+ item = staticmethod(DataListItem.create)
423
+ label = staticmethod(DataListLabel.create)
424
+ value = staticmethod(DataListValue.create)
425
+
426
+ data_list = DataList()
@@ -1,4 +1,5 @@
1
1
  """Interactive components provided by @radix-ui/themes."""
2
+ from __future__ import annotations
2
3
 
3
4
  from typing import Literal
4
5
 
@@ -13,13 +14,14 @@ from ..base import (
13
14
  LiteralAccentColor,
14
15
  LiteralRadius,
15
16
  LiteralVariant,
17
+ RadixLoadingProp,
16
18
  RadixThemesComponent,
17
19
  )
18
20
 
19
21
  LiteralButtonSize = Literal["1", "2", "3", "4"]
20
22
 
21
23
 
22
- class IconButton(el.Button, RadixThemesComponent):
24
+ class IconButton(el.Button, RadixLoadingProp, RadixThemesComponent):
23
25
  """A button designed specifically for usage with a single icon."""
24
26
 
25
27
  tag = "IconButton"
@@ -57,7 +59,7 @@ class IconButton(el.Button, RadixThemesComponent):
57
59
  The IconButton component.
58
60
  """
59
61
  if children:
60
- if type(children[0]) == str:
62
+ if isinstance(children[0], str):
61
63
  children = [
62
64
  Icon.create(
63
65
  children[0],
@@ -68,27 +70,28 @@ class IconButton(el.Button, RadixThemesComponent):
68
70
  "IconButton requires a child icon. Pass a string as the first child or a rx.icon."
69
71
  )
70
72
  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
- }
73
+ RADIX_TO_LUCIDE_SIZE = {"1": 12, "2": 24, "3": 36, "4": 48}
74
+
75
+ if isinstance(props["size"], str):
78
76
  children[0].size = RADIX_TO_LUCIDE_SIZE[props["size"]]
79
77
  else:
80
- children[0].size = Match.create(
78
+ size_map_var = Match.create(
81
79
  props["size"],
82
- ("1", "12px"),
83
- ("2", "24px"),
84
- ("3", "36px"),
85
- ("4", "48px"),
86
- "12px",
80
+ *[(size, px) for size, px in RADIX_TO_LUCIDE_SIZE.items()],
81
+ 12,
87
82
  )
83
+ if not isinstance(size_map_var, Var):
84
+ raise ValueError(f"Match did not return a Var: {size_map_var}")
85
+ children[0].size = size_map_var
88
86
  return super().create(*children, **props)
89
87
 
90
- def _apply_theme(self, theme: Component):
91
- self.style = Style({"padding": "6px", **self.style})
88
+ def add_style(self):
89
+ """Add style to the component.
90
+
91
+ Returns:
92
+ The style of the component.
93
+ """
94
+ return Style({"padding": "6px"})
92
95
 
93
96
 
94
97
  icon_button = IconButton.create
@@ -18,12 +18,13 @@ from ..base import (
18
18
  LiteralAccentColor,
19
19
  LiteralRadius,
20
20
  LiteralVariant,
21
+ RadixLoadingProp,
21
22
  RadixThemesComponent,
22
23
  )
23
24
 
24
25
  LiteralButtonSize = Literal["1", "2", "3", "4"]
25
26
 
26
- class IconButton(el.Button, RadixThemesComponent):
27
+ class IconButton(el.Button, RadixLoadingProp, RadixThemesComponent):
27
28
  @overload
28
29
  @classmethod
29
30
  def create( # type: ignore
@@ -173,6 +174,7 @@ class IconButton(el.Button, RadixThemesComponent):
173
174
  title: Optional[
174
175
  Union[Var[Union[str, int, bool]], Union[str, int, bool]]
175
176
  ] = None,
177
+ loading: Optional[Union[Var[bool], bool]] = None,
176
178
  style: Optional[Style] = None,
177
179
  key: Optional[Any] = None,
178
180
  id: Optional[Any] = None,
@@ -263,6 +265,7 @@ class IconButton(el.Button, RadixThemesComponent):
263
265
  spell_check: Defines whether the element may be checked for spelling errors.
264
266
  tab_index: Defines the position of the current element in the tabbing order.
265
267
  title: Defines a tooltip for the element.
268
+ loading: If set, show an rx.spinner instead of the component children.
266
269
  style: The style of the component.
267
270
  key: A unique key for the component.
268
271
  id: The id for the component.
@@ -278,5 +281,6 @@ class IconButton(el.Button, RadixThemesComponent):
278
281
  The IconButton component.
279
282
  """
280
283
  ...
284
+ def add_style(self): ...
281
285
 
282
286
  icon_button = IconButton.create
@@ -0,0 +1,55 @@
1
+ """Progress from Radix Themes."""
2
+
3
+ from typing import Literal
4
+
5
+ from reflex.components.component import Component
6
+ from reflex.vars import Var
7
+
8
+ from ..base import LiteralAccentColor, RadixThemesComponent
9
+
10
+
11
+ class Progress(RadixThemesComponent):
12
+ """A progress bar component."""
13
+
14
+ tag = "Progress"
15
+
16
+ # The value of the progress bar: 0 to max (default 100)
17
+ value: Var[int]
18
+
19
+ # The maximum progress value.
20
+ max: Var[int]
21
+
22
+ # The size of the progress bar: "1" | "2" | "3"
23
+ size: Var[Literal["1", "2", "3"]]
24
+
25
+ # The variant of the progress bar: "classic" | "surface" | "soft"
26
+ variant: Var[Literal["classic", "surface", "soft"]]
27
+
28
+ # The color theme of the progress bar
29
+ color_scheme: Var[LiteralAccentColor]
30
+
31
+ # Whether to render the progress bar with higher contrast color against background
32
+ high_contrast: Var[bool]
33
+
34
+ # Override theme radius for progress bar: "none" | "small" | "medium" | "large" | "full"
35
+ radius: Var[Literal["none", "small", "medium", "large", "full"]]
36
+
37
+ # The duration of the progress bar animation. Once the duration times out, the progress bar will start an indeterminate animation.
38
+ duration: Var[str]
39
+
40
+ @classmethod
41
+ def create(cls, *children, **props) -> Component:
42
+ """Create a Progress component.
43
+
44
+ Args:
45
+ *children: The children of the component.
46
+ **props: The properties of the component.
47
+
48
+ Returns:
49
+ The Progress Component.
50
+ """
51
+ props.setdefault("width", "100%")
52
+ return super().create(*children, **props)
53
+
54
+
55
+ progress = Progress.create