reflex 0.7.0a5__py3-none-any.whl → 0.7.1__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.
- reflex/.templates/jinja/web/package.json.jinja2 +7 -1
- reflex/.templates/web/components/reflex/radix_themes_color_mode_provider.js +3 -1
- reflex/__init__.py +1 -0
- reflex/__init__.pyi +1 -0
- reflex/app.py +268 -85
- reflex/base.py +4 -10
- reflex/compiler/compiler.py +46 -12
- reflex/compiler/templates.py +1 -2
- reflex/compiler/utils.py +23 -14
- reflex/components/base/bare.py +109 -16
- reflex/components/component.py +179 -124
- reflex/components/core/__init__.py +1 -0
- reflex/components/core/__init__.pyi +1 -0
- reflex/components/core/auto_scroll.py +114 -0
- reflex/components/core/auto_scroll.pyi +284 -0
- reflex/components/core/banner.py +40 -9
- reflex/components/core/banner.pyi +400 -87
- reflex/components/core/breakpoints.py +1 -1
- reflex/components/core/cond.py +0 -8
- reflex/components/core/foreach.py +12 -2
- reflex/components/core/html.pyi +200 -19
- reflex/components/core/match.py +4 -4
- reflex/components/core/sticky.pyi +874 -90
- reflex/components/core/upload.py +3 -5
- reflex/components/core/upload.pyi +2 -4
- reflex/components/datadisplay/code.py +36 -10
- reflex/components/datadisplay/code.pyi +1 -1
- reflex/components/datadisplay/dataeditor.py +1 -3
- reflex/components/datadisplay/dataeditor.pyi +1 -3
- reflex/components/el/elements/base.py +95 -17
- reflex/components/el/elements/base.pyi +278 -19
- reflex/components/el/elements/forms.py +124 -102
- reflex/components/el/elements/forms.pyi +2787 -365
- reflex/components/el/elements/inline.py +24 -15
- reflex/components/el/elements/inline.pyi +5655 -546
- reflex/components/el/elements/media.py +79 -95
- reflex/components/el/elements/media.pyi +5167 -565
- reflex/components/el/elements/metadata.py +19 -17
- reflex/components/el/elements/metadata.pyi +841 -89
- reflex/components/el/elements/other.py +3 -5
- reflex/components/el/elements/other.pyi +1404 -137
- reflex/components/el/elements/scripts.py +10 -13
- reflex/components/el/elements/scripts.pyi +634 -65
- reflex/components/el/elements/sectioning.pyi +3001 -286
- reflex/components/el/elements/tables.py +14 -35
- reflex/components/el/elements/tables.pyi +2029 -218
- reflex/components/el/elements/typography.py +10 -13
- reflex/components/el/elements/typography.pyi +3014 -297
- reflex/components/lucide/icon.py +22 -6
- reflex/components/markdown/markdown.py +30 -10
- reflex/components/markdown/markdown.pyi +3 -2
- reflex/components/plotly/plotly.py +1 -3
- reflex/components/plotly/plotly.pyi +1 -3
- reflex/components/radix/primitives/form.pyi +624 -93
- reflex/components/radix/themes/color_mode.py +1 -1
- reflex/components/radix/themes/color_mode.pyi +213 -31
- reflex/components/radix/themes/components/alert_dialog.pyi +199 -18
- reflex/components/radix/themes/components/badge.pyi +199 -18
- reflex/components/radix/themes/components/button.pyi +213 -31
- reflex/components/radix/themes/components/callout.pyi +1000 -95
- reflex/components/radix/themes/components/card.pyi +199 -18
- reflex/components/radix/themes/components/context_menu.py +79 -1
- reflex/components/radix/themes/components/context_menu.pyi +320 -1
- reflex/components/radix/themes/components/dialog.pyi +199 -18
- reflex/components/radix/themes/components/hover_card.pyi +199 -18
- reflex/components/radix/themes/components/icon_button.pyi +213 -31
- reflex/components/radix/themes/components/inset.pyi +199 -18
- reflex/components/radix/themes/components/popover.pyi +199 -18
- reflex/components/radix/themes/components/table.pyi +1437 -154
- reflex/components/radix/themes/components/text_area.py +2 -2
- reflex/components/radix/themes/components/text_area.pyi +201 -20
- reflex/components/radix/themes/components/text_field.py +1 -1
- reflex/components/radix/themes/components/text_field.pyi +444 -88
- reflex/components/radix/themes/layout/box.pyi +200 -19
- reflex/components/radix/themes/layout/center.pyi +199 -18
- reflex/components/radix/themes/layout/container.pyi +199 -18
- reflex/components/radix/themes/layout/flex.pyi +199 -18
- reflex/components/radix/themes/layout/grid.pyi +199 -18
- reflex/components/radix/themes/layout/list.pyi +604 -57
- reflex/components/radix/themes/layout/section.pyi +199 -18
- reflex/components/radix/themes/layout/spacer.pyi +199 -18
- reflex/components/radix/themes/layout/stack.pyi +597 -54
- reflex/components/radix/themes/typography/blockquote.pyi +200 -19
- reflex/components/radix/themes/typography/code.pyi +199 -18
- reflex/components/radix/themes/typography/heading.pyi +199 -18
- reflex/components/radix/themes/typography/link.pyi +238 -28
- reflex/components/radix/themes/typography/text.pyi +1394 -127
- reflex/components/react_player/react_player.py +1 -1
- reflex/components/react_player/react_player.pyi +1 -3
- reflex/components/sonner/toast.py +41 -12
- reflex/components/sonner/toast.pyi +20 -6
- reflex/components/tags/iter_tag.py +4 -0
- reflex/components/tags/tag.py +3 -3
- reflex/config.py +187 -28
- reflex/constants/__init__.py +2 -0
- reflex/constants/base.py +6 -0
- reflex/constants/compiler.py +9 -0
- reflex/constants/event.py +1 -0
- reflex/constants/installer.py +8 -5
- reflex/constants/utils.py +1 -3
- reflex/event.py +7 -16
- reflex/experimental/layout.pyi +597 -54
- reflex/py.typed +0 -0
- reflex/reflex.py +30 -41
- reflex/state.py +49 -44
- reflex/style.py +15 -22
- reflex/testing.py +2 -0
- reflex/utils/build.py +12 -0
- reflex/utils/console.py +4 -0
- reflex/utils/decorator.py +25 -0
- reflex/utils/exec.py +92 -34
- reflex/utils/format.py +35 -6
- reflex/utils/path_ops.py +16 -1
- reflex/utils/prerequisites.py +25 -33
- reflex/utils/processes.py +12 -13
- reflex/utils/serializers.py +20 -43
- reflex/utils/telemetry.py +4 -15
- reflex/utils/types.py +36 -66
- reflex/vars/base.py +53 -76
- reflex/vars/function.py +17 -5
- reflex/vars/number.py +1 -1
- reflex/vars/sequence.py +80 -4
- {reflex-0.7.0a5.dist-info → reflex-0.7.1.dist-info}/METADATA +4 -5
- {reflex-0.7.0a5.dist-info → reflex-0.7.1.dist-info}/RECORD +127 -123
- {reflex-0.7.0a5.dist-info → reflex-0.7.1.dist-info}/LICENSE +0 -0
- {reflex-0.7.0a5.dist-info → reflex-0.7.1.dist-info}/WHEEL +0 -0
- {reflex-0.7.0a5.dist-info → reflex-0.7.1.dist-info}/entry_points.txt +0 -0
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
# ------------------------------------------------------
|
|
6
6
|
from typing import Any, Dict, Literal, Optional, Union, overload
|
|
7
7
|
|
|
8
|
+
from reflex.components.base.fragment import Fragment
|
|
8
9
|
from reflex.components.component import Component
|
|
9
10
|
from reflex.components.el.elements.typography import Div
|
|
10
11
|
from reflex.components.lucide.icon import Icon
|
|
11
|
-
from reflex.components.sonner.toast import Toaster, ToastProps
|
|
12
12
|
from reflex.constants.compiler import CompileVars
|
|
13
13
|
from reflex.event import EventType
|
|
14
14
|
from reflex.style import Style
|
|
@@ -41,48 +41,13 @@ class WebsocketTargetURL(Var):
|
|
|
41
41
|
|
|
42
42
|
def default_connection_error() -> list[str | Var | Component]: ...
|
|
43
43
|
|
|
44
|
-
class ConnectionToaster(
|
|
44
|
+
class ConnectionToaster(Fragment):
|
|
45
45
|
def add_hooks(self) -> list[str | Var]: ...
|
|
46
46
|
@overload
|
|
47
47
|
@classmethod
|
|
48
48
|
def create( # type: ignore
|
|
49
49
|
cls,
|
|
50
50
|
*children,
|
|
51
|
-
theme: Optional[Union[Var[str], str]] = None,
|
|
52
|
-
rich_colors: Optional[Union[Var[bool], bool]] = None,
|
|
53
|
-
expand: Optional[Union[Var[bool], bool]] = None,
|
|
54
|
-
visible_toasts: Optional[Union[Var[int], int]] = None,
|
|
55
|
-
position: Optional[
|
|
56
|
-
Union[
|
|
57
|
-
Literal[
|
|
58
|
-
"bottom-center",
|
|
59
|
-
"bottom-left",
|
|
60
|
-
"bottom-right",
|
|
61
|
-
"top-center",
|
|
62
|
-
"top-left",
|
|
63
|
-
"top-right",
|
|
64
|
-
],
|
|
65
|
-
Var[
|
|
66
|
-
Literal[
|
|
67
|
-
"bottom-center",
|
|
68
|
-
"bottom-left",
|
|
69
|
-
"bottom-right",
|
|
70
|
-
"top-center",
|
|
71
|
-
"top-left",
|
|
72
|
-
"top-right",
|
|
73
|
-
]
|
|
74
|
-
],
|
|
75
|
-
]
|
|
76
|
-
] = None,
|
|
77
|
-
close_button: Optional[Union[Var[bool], bool]] = None,
|
|
78
|
-
offset: Optional[Union[Var[str], str]] = None,
|
|
79
|
-
dir: Optional[Union[Var[str], str]] = None,
|
|
80
|
-
hotkey: Optional[Union[Var[str], str]] = None,
|
|
81
|
-
invert: Optional[Union[Var[bool], bool]] = None,
|
|
82
|
-
toast_options: Optional[Union[ToastProps, Var[ToastProps]]] = None,
|
|
83
|
-
gap: Optional[Union[Var[int], int]] = None,
|
|
84
|
-
loading_icon: Optional[Union[Icon, Var[Icon]]] = None,
|
|
85
|
-
pause_when_page_is_hidden: Optional[Union[Var[bool], bool]] = None,
|
|
86
51
|
style: Optional[Style] = None,
|
|
87
52
|
key: Optional[Any] = None,
|
|
88
53
|
id: Optional[Any] = None,
|
|
@@ -110,20 +75,6 @@ class ConnectionToaster(Toaster):
|
|
|
110
75
|
|
|
111
76
|
Args:
|
|
112
77
|
*children: The children of the component.
|
|
113
|
-
theme: the theme of the toast
|
|
114
|
-
rich_colors: whether to show rich colors
|
|
115
|
-
expand: whether to expand the toast
|
|
116
|
-
visible_toasts: the number of toasts that are currently visible
|
|
117
|
-
position: the position of the toast
|
|
118
|
-
close_button: whether to show the close button
|
|
119
|
-
offset: offset of the toast
|
|
120
|
-
dir: directionality of the toast (default: ltr)
|
|
121
|
-
hotkey: Keyboard shortcut that will move focus to the toaster area.
|
|
122
|
-
invert: Dark toasts in light mode and vice versa.
|
|
123
|
-
toast_options: These will act as default options for all toasts. See toast() for all available options.
|
|
124
|
-
gap: Gap between toasts when expanded
|
|
125
|
-
loading_icon: Changes the default loading icon
|
|
126
|
-
pause_when_page_is_hidden: Pauses toast timers when the page is hidden, e.g., when the tab is backgrounded, the browser is minimized, or the OS is locked.
|
|
127
78
|
style: The style of the component.
|
|
128
79
|
key: A unique key for the component.
|
|
129
80
|
id: The id for the component.
|
|
@@ -271,30 +222,211 @@ class ConnectionPulser(Div):
|
|
|
271
222
|
def create( # type: ignore
|
|
272
223
|
cls,
|
|
273
224
|
*children,
|
|
274
|
-
access_key: Optional[Union[Var[
|
|
225
|
+
access_key: Optional[Union[Var[str], str]] = None,
|
|
275
226
|
auto_capitalize: Optional[
|
|
276
|
-
Union[
|
|
227
|
+
Union[
|
|
228
|
+
Literal["characters", "none", "off", "on", "sentences", "words"],
|
|
229
|
+
Var[Literal["characters", "none", "off", "on", "sentences", "words"]],
|
|
230
|
+
]
|
|
277
231
|
] = None,
|
|
278
232
|
content_editable: Optional[
|
|
279
|
-
Union[
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
233
|
+
Union[
|
|
234
|
+
Literal["inherit", "plaintext-only", False, True],
|
|
235
|
+
Var[Literal["inherit", "plaintext-only", False, True]],
|
|
236
|
+
]
|
|
283
237
|
] = None,
|
|
284
|
-
|
|
285
|
-
|
|
238
|
+
context_menu: Optional[Union[Var[str], str]] = None,
|
|
239
|
+
dir: Optional[Union[Var[str], str]] = None,
|
|
240
|
+
draggable: Optional[Union[Var[bool], bool]] = None,
|
|
286
241
|
enter_key_hint: Optional[
|
|
287
|
-
Union[
|
|
242
|
+
Union[
|
|
243
|
+
Literal["done", "enter", "go", "next", "previous", "search", "send"],
|
|
244
|
+
Var[
|
|
245
|
+
Literal["done", "enter", "go", "next", "previous", "search", "send"]
|
|
246
|
+
],
|
|
247
|
+
]
|
|
248
|
+
] = None,
|
|
249
|
+
hidden: Optional[Union[Var[bool], bool]] = None,
|
|
250
|
+
input_mode: Optional[
|
|
251
|
+
Union[
|
|
252
|
+
Literal[
|
|
253
|
+
"decimal",
|
|
254
|
+
"email",
|
|
255
|
+
"none",
|
|
256
|
+
"numeric",
|
|
257
|
+
"search",
|
|
258
|
+
"tel",
|
|
259
|
+
"text",
|
|
260
|
+
"url",
|
|
261
|
+
],
|
|
262
|
+
Var[
|
|
263
|
+
Literal[
|
|
264
|
+
"decimal",
|
|
265
|
+
"email",
|
|
266
|
+
"none",
|
|
267
|
+
"numeric",
|
|
268
|
+
"search",
|
|
269
|
+
"tel",
|
|
270
|
+
"text",
|
|
271
|
+
"url",
|
|
272
|
+
]
|
|
273
|
+
],
|
|
274
|
+
]
|
|
275
|
+
] = None,
|
|
276
|
+
item_prop: Optional[Union[Var[str], str]] = None,
|
|
277
|
+
lang: Optional[Union[Var[str], str]] = None,
|
|
278
|
+
role: Optional[
|
|
279
|
+
Union[
|
|
280
|
+
Literal[
|
|
281
|
+
"alert",
|
|
282
|
+
"alertdialog",
|
|
283
|
+
"application",
|
|
284
|
+
"article",
|
|
285
|
+
"banner",
|
|
286
|
+
"button",
|
|
287
|
+
"cell",
|
|
288
|
+
"checkbox",
|
|
289
|
+
"columnheader",
|
|
290
|
+
"combobox",
|
|
291
|
+
"complementary",
|
|
292
|
+
"contentinfo",
|
|
293
|
+
"definition",
|
|
294
|
+
"dialog",
|
|
295
|
+
"directory",
|
|
296
|
+
"document",
|
|
297
|
+
"feed",
|
|
298
|
+
"figure",
|
|
299
|
+
"form",
|
|
300
|
+
"grid",
|
|
301
|
+
"gridcell",
|
|
302
|
+
"group",
|
|
303
|
+
"heading",
|
|
304
|
+
"img",
|
|
305
|
+
"link",
|
|
306
|
+
"list",
|
|
307
|
+
"listbox",
|
|
308
|
+
"listitem",
|
|
309
|
+
"log",
|
|
310
|
+
"main",
|
|
311
|
+
"marquee",
|
|
312
|
+
"math",
|
|
313
|
+
"menu",
|
|
314
|
+
"menubar",
|
|
315
|
+
"menuitem",
|
|
316
|
+
"menuitemcheckbox",
|
|
317
|
+
"menuitemradio",
|
|
318
|
+
"navigation",
|
|
319
|
+
"none",
|
|
320
|
+
"note",
|
|
321
|
+
"option",
|
|
322
|
+
"presentation",
|
|
323
|
+
"progressbar",
|
|
324
|
+
"radio",
|
|
325
|
+
"radiogroup",
|
|
326
|
+
"region",
|
|
327
|
+
"row",
|
|
328
|
+
"rowgroup",
|
|
329
|
+
"rowheader",
|
|
330
|
+
"scrollbar",
|
|
331
|
+
"search",
|
|
332
|
+
"searchbox",
|
|
333
|
+
"separator",
|
|
334
|
+
"slider",
|
|
335
|
+
"spinbutton",
|
|
336
|
+
"status",
|
|
337
|
+
"switch",
|
|
338
|
+
"tab",
|
|
339
|
+
"table",
|
|
340
|
+
"tablist",
|
|
341
|
+
"tabpanel",
|
|
342
|
+
"term",
|
|
343
|
+
"textbox",
|
|
344
|
+
"timer",
|
|
345
|
+
"toolbar",
|
|
346
|
+
"tooltip",
|
|
347
|
+
"tree",
|
|
348
|
+
"treegrid",
|
|
349
|
+
"treeitem",
|
|
350
|
+
],
|
|
351
|
+
Var[
|
|
352
|
+
Literal[
|
|
353
|
+
"alert",
|
|
354
|
+
"alertdialog",
|
|
355
|
+
"application",
|
|
356
|
+
"article",
|
|
357
|
+
"banner",
|
|
358
|
+
"button",
|
|
359
|
+
"cell",
|
|
360
|
+
"checkbox",
|
|
361
|
+
"columnheader",
|
|
362
|
+
"combobox",
|
|
363
|
+
"complementary",
|
|
364
|
+
"contentinfo",
|
|
365
|
+
"definition",
|
|
366
|
+
"dialog",
|
|
367
|
+
"directory",
|
|
368
|
+
"document",
|
|
369
|
+
"feed",
|
|
370
|
+
"figure",
|
|
371
|
+
"form",
|
|
372
|
+
"grid",
|
|
373
|
+
"gridcell",
|
|
374
|
+
"group",
|
|
375
|
+
"heading",
|
|
376
|
+
"img",
|
|
377
|
+
"link",
|
|
378
|
+
"list",
|
|
379
|
+
"listbox",
|
|
380
|
+
"listitem",
|
|
381
|
+
"log",
|
|
382
|
+
"main",
|
|
383
|
+
"marquee",
|
|
384
|
+
"math",
|
|
385
|
+
"menu",
|
|
386
|
+
"menubar",
|
|
387
|
+
"menuitem",
|
|
388
|
+
"menuitemcheckbox",
|
|
389
|
+
"menuitemradio",
|
|
390
|
+
"navigation",
|
|
391
|
+
"none",
|
|
392
|
+
"note",
|
|
393
|
+
"option",
|
|
394
|
+
"presentation",
|
|
395
|
+
"progressbar",
|
|
396
|
+
"radio",
|
|
397
|
+
"radiogroup",
|
|
398
|
+
"region",
|
|
399
|
+
"row",
|
|
400
|
+
"rowgroup",
|
|
401
|
+
"rowheader",
|
|
402
|
+
"scrollbar",
|
|
403
|
+
"search",
|
|
404
|
+
"searchbox",
|
|
405
|
+
"separator",
|
|
406
|
+
"slider",
|
|
407
|
+
"spinbutton",
|
|
408
|
+
"status",
|
|
409
|
+
"switch",
|
|
410
|
+
"tab",
|
|
411
|
+
"table",
|
|
412
|
+
"tablist",
|
|
413
|
+
"tabpanel",
|
|
414
|
+
"term",
|
|
415
|
+
"textbox",
|
|
416
|
+
"timer",
|
|
417
|
+
"toolbar",
|
|
418
|
+
"tooltip",
|
|
419
|
+
"tree",
|
|
420
|
+
"treegrid",
|
|
421
|
+
"treeitem",
|
|
422
|
+
]
|
|
423
|
+
],
|
|
424
|
+
]
|
|
288
425
|
] = None,
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None,
|
|
294
|
-
slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None,
|
|
295
|
-
spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None,
|
|
296
|
-
tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None,
|
|
297
|
-
title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None,
|
|
426
|
+
slot: Optional[Union[Var[str], str]] = None,
|
|
427
|
+
spell_check: Optional[Union[Var[bool], bool]] = None,
|
|
428
|
+
tab_index: Optional[Union[Var[int], int]] = None,
|
|
429
|
+
title: Optional[Union[Var[str], str]] = None,
|
|
298
430
|
style: Optional[Style] = None,
|
|
299
431
|
key: Optional[Any] = None,
|
|
300
432
|
id: Optional[Any] = None,
|
|
@@ -356,30 +488,211 @@ class BackendDisabled(Div):
|
|
|
356
488
|
def create( # type: ignore
|
|
357
489
|
cls,
|
|
358
490
|
*children,
|
|
359
|
-
access_key: Optional[Union[Var[
|
|
491
|
+
access_key: Optional[Union[Var[str], str]] = None,
|
|
360
492
|
auto_capitalize: Optional[
|
|
361
|
-
Union[
|
|
493
|
+
Union[
|
|
494
|
+
Literal["characters", "none", "off", "on", "sentences", "words"],
|
|
495
|
+
Var[Literal["characters", "none", "off", "on", "sentences", "words"]],
|
|
496
|
+
]
|
|
362
497
|
] = None,
|
|
363
498
|
content_editable: Optional[
|
|
364
|
-
Union[
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
499
|
+
Union[
|
|
500
|
+
Literal["inherit", "plaintext-only", False, True],
|
|
501
|
+
Var[Literal["inherit", "plaintext-only", False, True]],
|
|
502
|
+
]
|
|
368
503
|
] = None,
|
|
369
|
-
|
|
370
|
-
|
|
504
|
+
context_menu: Optional[Union[Var[str], str]] = None,
|
|
505
|
+
dir: Optional[Union[Var[str], str]] = None,
|
|
506
|
+
draggable: Optional[Union[Var[bool], bool]] = None,
|
|
371
507
|
enter_key_hint: Optional[
|
|
372
|
-
Union[
|
|
508
|
+
Union[
|
|
509
|
+
Literal["done", "enter", "go", "next", "previous", "search", "send"],
|
|
510
|
+
Var[
|
|
511
|
+
Literal["done", "enter", "go", "next", "previous", "search", "send"]
|
|
512
|
+
],
|
|
513
|
+
]
|
|
514
|
+
] = None,
|
|
515
|
+
hidden: Optional[Union[Var[bool], bool]] = None,
|
|
516
|
+
input_mode: Optional[
|
|
517
|
+
Union[
|
|
518
|
+
Literal[
|
|
519
|
+
"decimal",
|
|
520
|
+
"email",
|
|
521
|
+
"none",
|
|
522
|
+
"numeric",
|
|
523
|
+
"search",
|
|
524
|
+
"tel",
|
|
525
|
+
"text",
|
|
526
|
+
"url",
|
|
527
|
+
],
|
|
528
|
+
Var[
|
|
529
|
+
Literal[
|
|
530
|
+
"decimal",
|
|
531
|
+
"email",
|
|
532
|
+
"none",
|
|
533
|
+
"numeric",
|
|
534
|
+
"search",
|
|
535
|
+
"tel",
|
|
536
|
+
"text",
|
|
537
|
+
"url",
|
|
538
|
+
]
|
|
539
|
+
],
|
|
540
|
+
]
|
|
541
|
+
] = None,
|
|
542
|
+
item_prop: Optional[Union[Var[str], str]] = None,
|
|
543
|
+
lang: Optional[Union[Var[str], str]] = None,
|
|
544
|
+
role: Optional[
|
|
545
|
+
Union[
|
|
546
|
+
Literal[
|
|
547
|
+
"alert",
|
|
548
|
+
"alertdialog",
|
|
549
|
+
"application",
|
|
550
|
+
"article",
|
|
551
|
+
"banner",
|
|
552
|
+
"button",
|
|
553
|
+
"cell",
|
|
554
|
+
"checkbox",
|
|
555
|
+
"columnheader",
|
|
556
|
+
"combobox",
|
|
557
|
+
"complementary",
|
|
558
|
+
"contentinfo",
|
|
559
|
+
"definition",
|
|
560
|
+
"dialog",
|
|
561
|
+
"directory",
|
|
562
|
+
"document",
|
|
563
|
+
"feed",
|
|
564
|
+
"figure",
|
|
565
|
+
"form",
|
|
566
|
+
"grid",
|
|
567
|
+
"gridcell",
|
|
568
|
+
"group",
|
|
569
|
+
"heading",
|
|
570
|
+
"img",
|
|
571
|
+
"link",
|
|
572
|
+
"list",
|
|
573
|
+
"listbox",
|
|
574
|
+
"listitem",
|
|
575
|
+
"log",
|
|
576
|
+
"main",
|
|
577
|
+
"marquee",
|
|
578
|
+
"math",
|
|
579
|
+
"menu",
|
|
580
|
+
"menubar",
|
|
581
|
+
"menuitem",
|
|
582
|
+
"menuitemcheckbox",
|
|
583
|
+
"menuitemradio",
|
|
584
|
+
"navigation",
|
|
585
|
+
"none",
|
|
586
|
+
"note",
|
|
587
|
+
"option",
|
|
588
|
+
"presentation",
|
|
589
|
+
"progressbar",
|
|
590
|
+
"radio",
|
|
591
|
+
"radiogroup",
|
|
592
|
+
"region",
|
|
593
|
+
"row",
|
|
594
|
+
"rowgroup",
|
|
595
|
+
"rowheader",
|
|
596
|
+
"scrollbar",
|
|
597
|
+
"search",
|
|
598
|
+
"searchbox",
|
|
599
|
+
"separator",
|
|
600
|
+
"slider",
|
|
601
|
+
"spinbutton",
|
|
602
|
+
"status",
|
|
603
|
+
"switch",
|
|
604
|
+
"tab",
|
|
605
|
+
"table",
|
|
606
|
+
"tablist",
|
|
607
|
+
"tabpanel",
|
|
608
|
+
"term",
|
|
609
|
+
"textbox",
|
|
610
|
+
"timer",
|
|
611
|
+
"toolbar",
|
|
612
|
+
"tooltip",
|
|
613
|
+
"tree",
|
|
614
|
+
"treegrid",
|
|
615
|
+
"treeitem",
|
|
616
|
+
],
|
|
617
|
+
Var[
|
|
618
|
+
Literal[
|
|
619
|
+
"alert",
|
|
620
|
+
"alertdialog",
|
|
621
|
+
"application",
|
|
622
|
+
"article",
|
|
623
|
+
"banner",
|
|
624
|
+
"button",
|
|
625
|
+
"cell",
|
|
626
|
+
"checkbox",
|
|
627
|
+
"columnheader",
|
|
628
|
+
"combobox",
|
|
629
|
+
"complementary",
|
|
630
|
+
"contentinfo",
|
|
631
|
+
"definition",
|
|
632
|
+
"dialog",
|
|
633
|
+
"directory",
|
|
634
|
+
"document",
|
|
635
|
+
"feed",
|
|
636
|
+
"figure",
|
|
637
|
+
"form",
|
|
638
|
+
"grid",
|
|
639
|
+
"gridcell",
|
|
640
|
+
"group",
|
|
641
|
+
"heading",
|
|
642
|
+
"img",
|
|
643
|
+
"link",
|
|
644
|
+
"list",
|
|
645
|
+
"listbox",
|
|
646
|
+
"listitem",
|
|
647
|
+
"log",
|
|
648
|
+
"main",
|
|
649
|
+
"marquee",
|
|
650
|
+
"math",
|
|
651
|
+
"menu",
|
|
652
|
+
"menubar",
|
|
653
|
+
"menuitem",
|
|
654
|
+
"menuitemcheckbox",
|
|
655
|
+
"menuitemradio",
|
|
656
|
+
"navigation",
|
|
657
|
+
"none",
|
|
658
|
+
"note",
|
|
659
|
+
"option",
|
|
660
|
+
"presentation",
|
|
661
|
+
"progressbar",
|
|
662
|
+
"radio",
|
|
663
|
+
"radiogroup",
|
|
664
|
+
"region",
|
|
665
|
+
"row",
|
|
666
|
+
"rowgroup",
|
|
667
|
+
"rowheader",
|
|
668
|
+
"scrollbar",
|
|
669
|
+
"search",
|
|
670
|
+
"searchbox",
|
|
671
|
+
"separator",
|
|
672
|
+
"slider",
|
|
673
|
+
"spinbutton",
|
|
674
|
+
"status",
|
|
675
|
+
"switch",
|
|
676
|
+
"tab",
|
|
677
|
+
"table",
|
|
678
|
+
"tablist",
|
|
679
|
+
"tabpanel",
|
|
680
|
+
"term",
|
|
681
|
+
"textbox",
|
|
682
|
+
"timer",
|
|
683
|
+
"toolbar",
|
|
684
|
+
"tooltip",
|
|
685
|
+
"tree",
|
|
686
|
+
"treegrid",
|
|
687
|
+
"treeitem",
|
|
688
|
+
]
|
|
689
|
+
],
|
|
690
|
+
]
|
|
373
691
|
] = None,
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None,
|
|
379
|
-
slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None,
|
|
380
|
-
spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None,
|
|
381
|
-
tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None,
|
|
382
|
-
title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None,
|
|
692
|
+
slot: Optional[Union[Var[str], str]] = None,
|
|
693
|
+
spell_check: Optional[Union[Var[bool], bool]] = None,
|
|
694
|
+
tab_index: Optional[Union[Var[int], int]] = None,
|
|
695
|
+
title: Optional[Union[Var[str], str]] = None,
|
|
383
696
|
style: Optional[Style] = None,
|
|
384
697
|
key: Optional[Any] = None,
|
|
385
698
|
id: Optional[Any] = None,
|
reflex/components/core/cond.py
CHANGED
|
@@ -61,14 +61,6 @@ class Cond(MemoizationLeaf):
|
|
|
61
61
|
)
|
|
62
62
|
)
|
|
63
63
|
|
|
64
|
-
def _get_props_imports(self):
|
|
65
|
-
"""Get the imports needed for component's props.
|
|
66
|
-
|
|
67
|
-
Returns:
|
|
68
|
-
The imports for the component's props of the component.
|
|
69
|
-
"""
|
|
70
|
-
return []
|
|
71
|
-
|
|
72
64
|
def _render(self) -> Tag:
|
|
73
65
|
return CondTag(
|
|
74
66
|
cond=self.cond,
|
|
@@ -54,9 +54,10 @@ class Foreach(Component):
|
|
|
54
54
|
TypeError: If the render function is a ComponentState.
|
|
55
55
|
UntypedVarError: If the iterable is of type Any without a type annotation.
|
|
56
56
|
"""
|
|
57
|
-
from reflex.vars
|
|
57
|
+
from reflex.vars import ArrayVar, ObjectVar, StringVar
|
|
58
|
+
|
|
59
|
+
iterable = LiteralVar.create(iterable).guess_type()
|
|
58
60
|
|
|
59
|
-
iterable = LiteralVar.create(iterable)
|
|
60
61
|
if iterable._var_type == Any:
|
|
61
62
|
raise ForeachVarError(
|
|
62
63
|
f"Could not foreach over var `{iterable!s}` of type Any. "
|
|
@@ -75,6 +76,15 @@ class Foreach(Component):
|
|
|
75
76
|
if isinstance(iterable, ObjectVar):
|
|
76
77
|
iterable = iterable.entries()
|
|
77
78
|
|
|
79
|
+
if isinstance(iterable, StringVar):
|
|
80
|
+
iterable = iterable.split()
|
|
81
|
+
|
|
82
|
+
if not isinstance(iterable, ArrayVar):
|
|
83
|
+
raise ForeachVarError(
|
|
84
|
+
f"Could not foreach over var `{iterable!s}` of type {iterable._var_type}. "
|
|
85
|
+
"See https://reflex.dev/docs/library/dynamic-rendering/foreach/"
|
|
86
|
+
)
|
|
87
|
+
|
|
78
88
|
component = cls(
|
|
79
89
|
iterable=iterable,
|
|
80
90
|
render_fn=render_fn,
|