reflex 0.6.8a1__py3-none-any.whl → 0.7.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.
- reflex/.templates/jinja/custom_components/pyproject.toml.jinja2 +1 -1
- reflex/.templates/jinja/web/pages/_app.js.jinja2 +7 -7
- reflex/.templates/jinja/web/pages/utils.js.jinja2 +3 -3
- reflex/.templates/web/components/reflex/radix_themes_color_mode_provider.js +1 -4
- reflex/.templates/web/utils/state.js +65 -36
- reflex/__init__.py +4 -17
- reflex/__init__.pyi +1 -2
- reflex/app.py +286 -135
- reflex/app_mixins/lifespan.py +9 -9
- reflex/app_mixins/middleware.py +6 -6
- reflex/app_module_for_backend.py +3 -7
- reflex/base.py +7 -7
- reflex/compiler/compiler.py +8 -0
- reflex/compiler/utils.py +57 -18
- reflex/components/base/app_wrap.pyi +16 -16
- reflex/components/base/bare.py +1 -1
- reflex/components/base/body.pyi +16 -16
- reflex/components/base/document.pyi +76 -76
- reflex/components/base/error_boundary.py +2 -1
- reflex/components/base/error_boundary.pyi +19 -22
- reflex/components/base/fragment.pyi +16 -16
- reflex/components/base/head.pyi +31 -31
- reflex/components/base/link.pyi +31 -31
- reflex/components/base/meta.py +2 -2
- reflex/components/base/meta.pyi +61 -61
- reflex/components/base/script.pyi +19 -19
- reflex/components/base/strict_mode.py +10 -0
- reflex/components/base/strict_mode.pyi +57 -0
- reflex/components/component.py +38 -77
- reflex/components/core/banner.py +159 -4
- reflex/components/core/banner.pyi +162 -76
- reflex/components/core/breakpoints.py +3 -1
- reflex/components/core/client_side_routing.py +1 -1
- reflex/components/core/client_side_routing.pyi +32 -32
- reflex/components/core/clipboard.pyi +17 -20
- reflex/components/core/cond.py +9 -10
- reflex/components/core/debounce.py +1 -1
- reflex/components/core/debounce.pyi +17 -17
- reflex/components/core/foreach.py +28 -3
- reflex/components/core/html.py +1 -1
- reflex/components/core/html.pyi +16 -16
- reflex/components/core/match.py +5 -5
- reflex/components/core/sticky.py +134 -0
- reflex/components/core/sticky.pyi +449 -0
- reflex/components/core/upload.py +2 -2
- reflex/components/core/upload.pyi +80 -88
- reflex/components/datadisplay/code.py +5 -14
- reflex/components/datadisplay/code.pyi +31 -31
- reflex/components/datadisplay/dataeditor.py +7 -4
- reflex/components/datadisplay/dataeditor.pyi +40 -54
- reflex/components/datadisplay/logo.py +13 -8
- reflex/components/datadisplay/shiki_code_block.py +14 -9
- reflex/components/datadisplay/shiki_code_block.pyi +46 -46
- reflex/components/dynamic.py +22 -3
- reflex/components/el/constants/reflex.py +1 -1
- reflex/components/el/element.py +1 -1
- reflex/components/el/element.pyi +16 -16
- reflex/components/el/elements/base.pyi +16 -16
- reflex/components/el/elements/forms.py +4 -4
- reflex/components/el/elements/forms.pyi +224 -258
- reflex/components/el/elements/inline.pyi +421 -421
- reflex/components/el/elements/media.pyi +376 -376
- reflex/components/el/elements/metadata.pyi +91 -91
- reflex/components/el/elements/other.pyi +106 -106
- reflex/components/el/elements/scripts.pyi +46 -46
- reflex/components/el/elements/sectioning.pyi +226 -226
- reflex/components/el/elements/tables.pyi +151 -151
- reflex/components/el/elements/typography.pyi +226 -226
- reflex/components/gridjs/datatable.pyi +31 -31
- reflex/components/lucide/icon.py +46 -8
- reflex/components/lucide/icon.pyi +85 -31
- reflex/components/markdown/markdown.py +10 -8
- reflex/components/markdown/markdown.pyi +16 -16
- reflex/components/moment/moment.py +2 -2
- reflex/components/moment/moment.pyi +17 -19
- reflex/components/next/base.pyi +16 -16
- reflex/components/next/image.py +16 -4
- reflex/components/next/image.pyi +22 -20
- reflex/components/next/link.py +1 -1
- reflex/components/next/link.pyi +16 -16
- reflex/components/next/video.pyi +16 -16
- reflex/components/plotly/__init__.py +29 -2
- reflex/components/plotly/plotly.py +240 -5
- reflex/components/plotly/plotly.pyi +799 -44
- reflex/components/props.py +3 -3
- reflex/components/radix/__init__.pyi +1 -1
- reflex/components/radix/primitives/accordion.py +9 -5
- reflex/components/radix/primitives/accordion.pyi +110 -108
- reflex/components/radix/primitives/base.pyi +31 -31
- reflex/components/radix/primitives/drawer.py +5 -2
- reflex/components/radix/primitives/drawer.pyi +179 -187
- reflex/components/radix/primitives/form.pyi +160 -172
- reflex/components/radix/primitives/progress.py +1 -1
- reflex/components/radix/primitives/progress.pyi +76 -76
- reflex/components/radix/primitives/slider.py +1 -1
- reflex/components/radix/primitives/slider.pyi +78 -82
- reflex/components/radix/themes/base.pyi +121 -121
- reflex/components/radix/themes/color_mode.py +11 -9
- reflex/components/radix/themes/color_mode.pyi +47 -49
- reflex/components/radix/themes/components/alert_dialog.py +3 -0
- reflex/components/radix/themes/components/alert_dialog.pyi +110 -112
- reflex/components/radix/themes/components/aspect_ratio.pyi +16 -16
- reflex/components/radix/themes/components/avatar.pyi +16 -16
- reflex/components/radix/themes/components/badge.pyi +16 -16
- reflex/components/radix/themes/components/button.pyi +16 -16
- reflex/components/radix/themes/components/callout.pyi +76 -76
- reflex/components/radix/themes/components/card.py +1 -1
- reflex/components/radix/themes/components/card.pyi +17 -17
- reflex/components/radix/themes/components/checkbox.pyi +49 -55
- reflex/components/radix/themes/components/checkbox_cards.pyi +31 -31
- reflex/components/radix/themes/components/checkbox_group.pyi +31 -31
- reflex/components/radix/themes/components/context_menu.py +5 -0
- reflex/components/radix/themes/components/context_menu.pyi +149 -155
- reflex/components/radix/themes/components/data_list.pyi +61 -61
- reflex/components/radix/themes/components/dialog.py +3 -0
- reflex/components/radix/themes/components/dialog.pyi +113 -117
- reflex/components/radix/themes/components/dropdown_menu.py +5 -0
- reflex/components/radix/themes/components/dropdown_menu.pyi +133 -137
- reflex/components/radix/themes/components/hover_card.py +3 -0
- reflex/components/radix/themes/components/hover_card.pyi +63 -67
- reflex/components/radix/themes/components/icon_button.py +2 -2
- reflex/components/radix/themes/components/icon_button.pyi +17 -16
- reflex/components/radix/themes/components/inset.pyi +16 -16
- reflex/components/radix/themes/components/popover.py +3 -0
- reflex/components/radix/themes/components/popover.pyi +68 -70
- reflex/components/radix/themes/components/progress.pyi +16 -16
- reflex/components/radix/themes/components/radio.pyi +16 -16
- reflex/components/radix/themes/components/radio_cards.py +2 -0
- reflex/components/radix/themes/components/radio_cards.pyi +32 -34
- reflex/components/radix/themes/components/radio_group.py +1 -1
- reflex/components/radix/themes/components/radio_group.pyi +62 -64
- reflex/components/radix/themes/components/scroll_area.pyi +16 -16
- reflex/components/radix/themes/components/segmented_control.pyi +32 -35
- reflex/components/radix/themes/components/select.py +4 -0
- reflex/components/radix/themes/components/select.pyi +145 -157
- reflex/components/radix/themes/components/separator.pyi +16 -16
- reflex/components/radix/themes/components/skeleton.py +3 -0
- reflex/components/radix/themes/components/skeleton.pyi +16 -16
- reflex/components/radix/themes/components/slider.pyi +22 -28
- reflex/components/radix/themes/components/spinner.pyi +16 -16
- reflex/components/radix/themes/components/switch.pyi +17 -19
- reflex/components/radix/themes/components/table.pyi +106 -106
- reflex/components/radix/themes/components/tabs.py +3 -0
- reflex/components/radix/themes/components/tabs.pyi +78 -82
- reflex/components/radix/themes/components/text_area.py +12 -0
- reflex/components/radix/themes/components/text_area.pyi +21 -33
- reflex/components/radix/themes/components/text_field.py +1 -1
- reflex/components/radix/themes/components/text_field.pyi +52 -80
- reflex/components/radix/themes/components/tooltip.py +6 -1
- reflex/components/radix/themes/components/tooltip.pyi +20 -21
- reflex/components/radix/themes/layout/__init__.pyi +1 -1
- reflex/components/radix/themes/layout/base.pyi +16 -16
- reflex/components/radix/themes/layout/box.pyi +16 -16
- reflex/components/radix/themes/layout/center.pyi +16 -16
- reflex/components/radix/themes/layout/container.pyi +16 -16
- reflex/components/radix/themes/layout/flex.pyi +16 -16
- reflex/components/radix/themes/layout/grid.pyi +16 -16
- reflex/components/radix/themes/layout/list.py +2 -2
- reflex/components/radix/themes/layout/list.pyi +76 -76
- reflex/components/radix/themes/layout/section.pyi +16 -16
- reflex/components/radix/themes/layout/spacer.pyi +16 -16
- reflex/components/radix/themes/layout/stack.py +2 -2
- reflex/components/radix/themes/layout/stack.pyi +46 -46
- reflex/components/radix/themes/typography/blockquote.pyi +16 -16
- reflex/components/radix/themes/typography/code.pyi +16 -16
- reflex/components/radix/themes/typography/heading.pyi +16 -16
- reflex/components/radix/themes/typography/link.py +1 -1
- reflex/components/radix/themes/typography/link.pyi +16 -16
- reflex/components/radix/themes/typography/text.py +2 -2
- reflex/components/radix/themes/typography/text.pyi +106 -106
- reflex/components/react_player/audio.pyi +33 -39
- reflex/components/react_player/react_player.py +1 -1
- reflex/components/react_player/react_player.pyi +32 -38
- reflex/components/react_player/video.pyi +33 -39
- reflex/components/recharts/__init__.py +2 -0
- reflex/components/recharts/__init__.pyi +2 -0
- reflex/components/recharts/cartesian.pyi +282 -282
- reflex/components/recharts/charts.py +15 -15
- reflex/components/recharts/charts.pyi +164 -164
- reflex/components/recharts/general.py +19 -4
- reflex/components/recharts/general.pyi +132 -81
- reflex/components/recharts/polar.py +2 -2
- reflex/components/recharts/polar.pyi +55 -55
- reflex/components/recharts/recharts.py +4 -4
- reflex/components/recharts/recharts.pyi +31 -31
- reflex/components/sonner/toast.py +15 -13
- reflex/components/sonner/toast.pyi +22 -22
- reflex/components/suneditor/editor.py +6 -4
- reflex/components/suneditor/editor.pyi +26 -40
- reflex/components/tags/iter_tag.py +3 -3
- reflex/components/tags/tag.py +25 -3
- reflex/config.py +48 -20
- reflex/constants/__init__.py +1 -0
- reflex/constants/base.py +4 -1
- reflex/constants/compiler.py +5 -2
- reflex/constants/config.py +8 -1
- reflex/constants/installer.py +9 -9
- reflex/constants/style.py +1 -1
- reflex/custom_components/custom_components.py +18 -10
- reflex/event.py +228 -233
- reflex/experimental/__init__.py +19 -11
- reflex/experimental/client_state.py +53 -28
- reflex/experimental/hooks.py +5 -5
- reflex/experimental/layout.py +8 -5
- reflex/experimental/layout.pyi +79 -83
- reflex/experimental/misc.py +3 -3
- reflex/istate/wrappers.py +1 -1
- reflex/middleware/hydrate_middleware.py +2 -2
- reflex/model.py +11 -6
- reflex/page.py +5 -5
- reflex/reflex.py +104 -26
- reflex/route.py +1 -1
- reflex/state.py +358 -401
- reflex/style.py +27 -3
- reflex/testing.py +34 -39
- reflex/utils/build.py +6 -2
- reflex/utils/codespaces.py +1 -4
- reflex/utils/compat.py +6 -5
- reflex/utils/console.py +71 -21
- reflex/utils/exceptions.py +89 -26
- reflex/utils/exec.py +69 -74
- reflex/utils/export.py +6 -1
- reflex/utils/format.py +8 -40
- reflex/utils/imports.py +5 -2
- reflex/utils/lazy_loader.py +7 -1
- reflex/utils/path_ops.py +74 -14
- reflex/utils/prerequisites.py +345 -68
- reflex/utils/processes.py +45 -32
- reflex/utils/pyi_generator.py +39 -33
- reflex/utils/registry.py +4 -4
- reflex/utils/serializers.py +1 -1
- reflex/utils/telemetry.py +5 -4
- reflex/utils/types.py +42 -18
- reflex/vars/base.py +695 -330
- reflex/vars/datetime.py +6 -7
- reflex/vars/dep_tracking.py +344 -0
- reflex/vars/function.py +11 -5
- reflex/vars/number.py +31 -43
- reflex/vars/object.py +74 -64
- reflex/vars/sequence.py +79 -67
- {reflex-0.6.8a1.dist-info → reflex-0.7.0.dist-info}/METADATA +7 -10
- reflex-0.7.0.dist-info/RECORD +401 -0
- {reflex-0.6.8a1.dist-info → reflex-0.7.0.dist-info}/WHEEL +1 -1
- reflex/experimental/assets.py +0 -37
- reflex/proxy.py +0 -119
- reflex-0.6.8a1.dist-info/RECORD +0 -398
- {reflex-0.6.8a1.dist-info → reflex-0.7.0.dist-info}/LICENSE +0 -0
- {reflex-0.6.8a1.dist-info → reflex-0.7.0.dist-info}/entry_points.txt +0 -0
|
@@ -10,7 +10,7 @@ from reflex.components.el.elements.typography import Div
|
|
|
10
10
|
from reflex.components.lucide.icon import Icon
|
|
11
11
|
from reflex.components.sonner.toast import Toaster, ToastProps
|
|
12
12
|
from reflex.constants.compiler import CompileVars
|
|
13
|
-
from reflex.event import
|
|
13
|
+
from reflex.event import EventType
|
|
14
14
|
from reflex.style import Style
|
|
15
15
|
from reflex.utils.imports import ImportVar
|
|
16
16
|
from reflex.vars import VarData
|
|
@@ -89,21 +89,21 @@ class ConnectionToaster(Toaster):
|
|
|
89
89
|
class_name: Optional[Any] = None,
|
|
90
90
|
autofocus: Optional[bool] = None,
|
|
91
91
|
custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
|
|
92
|
-
on_blur: Optional[EventType[
|
|
93
|
-
on_click: Optional[EventType[
|
|
94
|
-
on_context_menu: Optional[EventType[
|
|
95
|
-
on_double_click: Optional[EventType[
|
|
96
|
-
on_focus: Optional[EventType[
|
|
97
|
-
on_mount: Optional[EventType[
|
|
98
|
-
on_mouse_down: Optional[EventType[
|
|
99
|
-
on_mouse_enter: Optional[EventType[
|
|
100
|
-
on_mouse_leave: Optional[EventType[
|
|
101
|
-
on_mouse_move: Optional[EventType[
|
|
102
|
-
on_mouse_out: Optional[EventType[
|
|
103
|
-
on_mouse_over: Optional[EventType[
|
|
104
|
-
on_mouse_up: Optional[EventType[
|
|
105
|
-
on_scroll: Optional[EventType[
|
|
106
|
-
on_unmount: Optional[EventType[
|
|
92
|
+
on_blur: Optional[EventType[()]] = None,
|
|
93
|
+
on_click: Optional[EventType[()]] = None,
|
|
94
|
+
on_context_menu: Optional[EventType[()]] = None,
|
|
95
|
+
on_double_click: Optional[EventType[()]] = None,
|
|
96
|
+
on_focus: Optional[EventType[()]] = None,
|
|
97
|
+
on_mount: Optional[EventType[()]] = None,
|
|
98
|
+
on_mouse_down: Optional[EventType[()]] = None,
|
|
99
|
+
on_mouse_enter: Optional[EventType[()]] = None,
|
|
100
|
+
on_mouse_leave: Optional[EventType[()]] = None,
|
|
101
|
+
on_mouse_move: Optional[EventType[()]] = None,
|
|
102
|
+
on_mouse_out: Optional[EventType[()]] = None,
|
|
103
|
+
on_mouse_over: Optional[EventType[()]] = None,
|
|
104
|
+
on_mouse_up: Optional[EventType[()]] = None,
|
|
105
|
+
on_scroll: Optional[EventType[()]] = None,
|
|
106
|
+
on_unmount: Optional[EventType[()]] = None,
|
|
107
107
|
**props,
|
|
108
108
|
) -> "ConnectionToaster":
|
|
109
109
|
"""Create a connection toaster component.
|
|
@@ -149,21 +149,21 @@ class ConnectionBanner(Component):
|
|
|
149
149
|
class_name: Optional[Any] = None,
|
|
150
150
|
autofocus: Optional[bool] = None,
|
|
151
151
|
custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
|
|
152
|
-
on_blur: Optional[EventType[
|
|
153
|
-
on_click: Optional[EventType[
|
|
154
|
-
on_context_menu: Optional[EventType[
|
|
155
|
-
on_double_click: Optional[EventType[
|
|
156
|
-
on_focus: Optional[EventType[
|
|
157
|
-
on_mount: Optional[EventType[
|
|
158
|
-
on_mouse_down: Optional[EventType[
|
|
159
|
-
on_mouse_enter: Optional[EventType[
|
|
160
|
-
on_mouse_leave: Optional[EventType[
|
|
161
|
-
on_mouse_move: Optional[EventType[
|
|
162
|
-
on_mouse_out: Optional[EventType[
|
|
163
|
-
on_mouse_over: Optional[EventType[
|
|
164
|
-
on_mouse_up: Optional[EventType[
|
|
165
|
-
on_scroll: Optional[EventType[
|
|
166
|
-
on_unmount: Optional[EventType[
|
|
152
|
+
on_blur: Optional[EventType[()]] = None,
|
|
153
|
+
on_click: Optional[EventType[()]] = None,
|
|
154
|
+
on_context_menu: Optional[EventType[()]] = None,
|
|
155
|
+
on_double_click: Optional[EventType[()]] = None,
|
|
156
|
+
on_focus: Optional[EventType[()]] = None,
|
|
157
|
+
on_mount: Optional[EventType[()]] = None,
|
|
158
|
+
on_mouse_down: Optional[EventType[()]] = None,
|
|
159
|
+
on_mouse_enter: Optional[EventType[()]] = None,
|
|
160
|
+
on_mouse_leave: Optional[EventType[()]] = None,
|
|
161
|
+
on_mouse_move: Optional[EventType[()]] = None,
|
|
162
|
+
on_mouse_out: Optional[EventType[()]] = None,
|
|
163
|
+
on_mouse_over: Optional[EventType[()]] = None,
|
|
164
|
+
on_mouse_up: Optional[EventType[()]] = None,
|
|
165
|
+
on_scroll: Optional[EventType[()]] = None,
|
|
166
|
+
on_unmount: Optional[EventType[()]] = None,
|
|
167
167
|
**props,
|
|
168
168
|
) -> "ConnectionBanner":
|
|
169
169
|
"""Create a connection banner component.
|
|
@@ -188,21 +188,21 @@ class ConnectionModal(Component):
|
|
|
188
188
|
class_name: Optional[Any] = None,
|
|
189
189
|
autofocus: Optional[bool] = None,
|
|
190
190
|
custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
|
|
191
|
-
on_blur: Optional[EventType[
|
|
192
|
-
on_click: Optional[EventType[
|
|
193
|
-
on_context_menu: Optional[EventType[
|
|
194
|
-
on_double_click: Optional[EventType[
|
|
195
|
-
on_focus: Optional[EventType[
|
|
196
|
-
on_mount: Optional[EventType[
|
|
197
|
-
on_mouse_down: Optional[EventType[
|
|
198
|
-
on_mouse_enter: Optional[EventType[
|
|
199
|
-
on_mouse_leave: Optional[EventType[
|
|
200
|
-
on_mouse_move: Optional[EventType[
|
|
201
|
-
on_mouse_out: Optional[EventType[
|
|
202
|
-
on_mouse_over: Optional[EventType[
|
|
203
|
-
on_mouse_up: Optional[EventType[
|
|
204
|
-
on_scroll: Optional[EventType[
|
|
205
|
-
on_unmount: Optional[EventType[
|
|
191
|
+
on_blur: Optional[EventType[()]] = None,
|
|
192
|
+
on_click: Optional[EventType[()]] = None,
|
|
193
|
+
on_context_menu: Optional[EventType[()]] = None,
|
|
194
|
+
on_double_click: Optional[EventType[()]] = None,
|
|
195
|
+
on_focus: Optional[EventType[()]] = None,
|
|
196
|
+
on_mount: Optional[EventType[()]] = None,
|
|
197
|
+
on_mouse_down: Optional[EventType[()]] = None,
|
|
198
|
+
on_mouse_enter: Optional[EventType[()]] = None,
|
|
199
|
+
on_mouse_leave: Optional[EventType[()]] = None,
|
|
200
|
+
on_mouse_move: Optional[EventType[()]] = None,
|
|
201
|
+
on_mouse_out: Optional[EventType[()]] = None,
|
|
202
|
+
on_mouse_over: Optional[EventType[()]] = None,
|
|
203
|
+
on_mouse_up: Optional[EventType[()]] = None,
|
|
204
|
+
on_scroll: Optional[EventType[()]] = None,
|
|
205
|
+
on_unmount: Optional[EventType[()]] = None,
|
|
206
206
|
**props,
|
|
207
207
|
) -> "ConnectionModal":
|
|
208
208
|
"""Create a connection banner component.
|
|
@@ -228,21 +228,21 @@ class WifiOffPulse(Icon):
|
|
|
228
228
|
class_name: Optional[Any] = None,
|
|
229
229
|
autofocus: Optional[bool] = None,
|
|
230
230
|
custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
|
|
231
|
-
on_blur: Optional[EventType[
|
|
232
|
-
on_click: Optional[EventType[
|
|
233
|
-
on_context_menu: Optional[EventType[
|
|
234
|
-
on_double_click: Optional[EventType[
|
|
235
|
-
on_focus: Optional[EventType[
|
|
236
|
-
on_mount: Optional[EventType[
|
|
237
|
-
on_mouse_down: Optional[EventType[
|
|
238
|
-
on_mouse_enter: Optional[EventType[
|
|
239
|
-
on_mouse_leave: Optional[EventType[
|
|
240
|
-
on_mouse_move: Optional[EventType[
|
|
241
|
-
on_mouse_out: Optional[EventType[
|
|
242
|
-
on_mouse_over: Optional[EventType[
|
|
243
|
-
on_mouse_up: Optional[EventType[
|
|
244
|
-
on_scroll: Optional[EventType[
|
|
245
|
-
on_unmount: Optional[EventType[
|
|
231
|
+
on_blur: Optional[EventType[()]] = None,
|
|
232
|
+
on_click: Optional[EventType[()]] = None,
|
|
233
|
+
on_context_menu: Optional[EventType[()]] = None,
|
|
234
|
+
on_double_click: Optional[EventType[()]] = None,
|
|
235
|
+
on_focus: Optional[EventType[()]] = None,
|
|
236
|
+
on_mount: Optional[EventType[()]] = None,
|
|
237
|
+
on_mouse_down: Optional[EventType[()]] = None,
|
|
238
|
+
on_mouse_enter: Optional[EventType[()]] = None,
|
|
239
|
+
on_mouse_leave: Optional[EventType[()]] = None,
|
|
240
|
+
on_mouse_move: Optional[EventType[()]] = None,
|
|
241
|
+
on_mouse_out: Optional[EventType[()]] = None,
|
|
242
|
+
on_mouse_over: Optional[EventType[()]] = None,
|
|
243
|
+
on_mouse_up: Optional[EventType[()]] = None,
|
|
244
|
+
on_scroll: Optional[EventType[()]] = None,
|
|
245
|
+
on_unmount: Optional[EventType[()]] = None,
|
|
246
246
|
**props,
|
|
247
247
|
) -> "WifiOffPulse":
|
|
248
248
|
"""Create a wifi_off icon with an animated opacity pulse.
|
|
@@ -301,21 +301,21 @@ class ConnectionPulser(Div):
|
|
|
301
301
|
class_name: Optional[Any] = None,
|
|
302
302
|
autofocus: Optional[bool] = None,
|
|
303
303
|
custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
|
|
304
|
-
on_blur: Optional[EventType[
|
|
305
|
-
on_click: Optional[EventType[
|
|
306
|
-
on_context_menu: Optional[EventType[
|
|
307
|
-
on_double_click: Optional[EventType[
|
|
308
|
-
on_focus: Optional[EventType[
|
|
309
|
-
on_mount: Optional[EventType[
|
|
310
|
-
on_mouse_down: Optional[EventType[
|
|
311
|
-
on_mouse_enter: Optional[EventType[
|
|
312
|
-
on_mouse_leave: Optional[EventType[
|
|
313
|
-
on_mouse_move: Optional[EventType[
|
|
314
|
-
on_mouse_out: Optional[EventType[
|
|
315
|
-
on_mouse_over: Optional[EventType[
|
|
316
|
-
on_mouse_up: Optional[EventType[
|
|
317
|
-
on_scroll: Optional[EventType[
|
|
318
|
-
on_unmount: Optional[EventType[
|
|
304
|
+
on_blur: Optional[EventType[()]] = None,
|
|
305
|
+
on_click: Optional[EventType[()]] = None,
|
|
306
|
+
on_context_menu: Optional[EventType[()]] = None,
|
|
307
|
+
on_double_click: Optional[EventType[()]] = None,
|
|
308
|
+
on_focus: Optional[EventType[()]] = None,
|
|
309
|
+
on_mount: Optional[EventType[()]] = None,
|
|
310
|
+
on_mouse_down: Optional[EventType[()]] = None,
|
|
311
|
+
on_mouse_enter: Optional[EventType[()]] = None,
|
|
312
|
+
on_mouse_leave: Optional[EventType[()]] = None,
|
|
313
|
+
on_mouse_move: Optional[EventType[()]] = None,
|
|
314
|
+
on_mouse_out: Optional[EventType[()]] = None,
|
|
315
|
+
on_mouse_over: Optional[EventType[()]] = None,
|
|
316
|
+
on_mouse_up: Optional[EventType[()]] = None,
|
|
317
|
+
on_scroll: Optional[EventType[()]] = None,
|
|
318
|
+
on_unmount: Optional[EventType[()]] = None,
|
|
319
319
|
**props,
|
|
320
320
|
) -> "ConnectionPulser":
|
|
321
321
|
"""Create a connection pulser component.
|
|
@@ -350,7 +350,93 @@ class ConnectionPulser(Div):
|
|
|
350
350
|
"""
|
|
351
351
|
...
|
|
352
352
|
|
|
353
|
+
class BackendDisabled(Div):
|
|
354
|
+
@overload
|
|
355
|
+
@classmethod
|
|
356
|
+
def create( # type: ignore
|
|
357
|
+
cls,
|
|
358
|
+
*children,
|
|
359
|
+
access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None,
|
|
360
|
+
auto_capitalize: Optional[
|
|
361
|
+
Union[Var[Union[bool, int, str]], bool, int, str]
|
|
362
|
+
] = None,
|
|
363
|
+
content_editable: Optional[
|
|
364
|
+
Union[Var[Union[bool, int, str]], bool, int, str]
|
|
365
|
+
] = None,
|
|
366
|
+
context_menu: Optional[
|
|
367
|
+
Union[Var[Union[bool, int, str]], bool, int, str]
|
|
368
|
+
] = None,
|
|
369
|
+
dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None,
|
|
370
|
+
draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None,
|
|
371
|
+
enter_key_hint: Optional[
|
|
372
|
+
Union[Var[Union[bool, int, str]], bool, int, str]
|
|
373
|
+
] = None,
|
|
374
|
+
hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None,
|
|
375
|
+
input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None,
|
|
376
|
+
item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None,
|
|
377
|
+
lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None,
|
|
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,
|
|
383
|
+
style: Optional[Style] = None,
|
|
384
|
+
key: Optional[Any] = None,
|
|
385
|
+
id: Optional[Any] = None,
|
|
386
|
+
class_name: Optional[Any] = None,
|
|
387
|
+
autofocus: Optional[bool] = None,
|
|
388
|
+
custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
|
|
389
|
+
on_blur: Optional[EventType[()]] = None,
|
|
390
|
+
on_click: Optional[EventType[()]] = None,
|
|
391
|
+
on_context_menu: Optional[EventType[()]] = None,
|
|
392
|
+
on_double_click: Optional[EventType[()]] = None,
|
|
393
|
+
on_focus: Optional[EventType[()]] = None,
|
|
394
|
+
on_mount: Optional[EventType[()]] = None,
|
|
395
|
+
on_mouse_down: Optional[EventType[()]] = None,
|
|
396
|
+
on_mouse_enter: Optional[EventType[()]] = None,
|
|
397
|
+
on_mouse_leave: Optional[EventType[()]] = None,
|
|
398
|
+
on_mouse_move: Optional[EventType[()]] = None,
|
|
399
|
+
on_mouse_out: Optional[EventType[()]] = None,
|
|
400
|
+
on_mouse_over: Optional[EventType[()]] = None,
|
|
401
|
+
on_mouse_up: Optional[EventType[()]] = None,
|
|
402
|
+
on_scroll: Optional[EventType[()]] = None,
|
|
403
|
+
on_unmount: Optional[EventType[()]] = None,
|
|
404
|
+
**props,
|
|
405
|
+
) -> "BackendDisabled":
|
|
406
|
+
"""Create a backend disabled component.
|
|
407
|
+
|
|
408
|
+
Args:
|
|
409
|
+
access_key: Provides a hint for generating a keyboard shortcut for the current element.
|
|
410
|
+
auto_capitalize: Controls whether and how text input is automatically capitalized as it is entered/edited by the user.
|
|
411
|
+
content_editable: Indicates whether the element's content is editable.
|
|
412
|
+
context_menu: Defines the ID of a <menu> element which will serve as the element's context menu.
|
|
413
|
+
dir: Defines the text direction. Allowed values are ltr (Left-To-Right) or rtl (Right-To-Left)
|
|
414
|
+
draggable: Defines whether the element can be dragged.
|
|
415
|
+
enter_key_hint: Hints what media types the media element is able to play.
|
|
416
|
+
hidden: Defines whether the element is hidden.
|
|
417
|
+
input_mode: Defines the type of the element.
|
|
418
|
+
item_prop: Defines the name of the element for metadata purposes.
|
|
419
|
+
lang: Defines the language used in the element.
|
|
420
|
+
role: Defines the role of the element.
|
|
421
|
+
slot: Assigns a slot in a shadow DOM shadow tree to an element.
|
|
422
|
+
spell_check: Defines whether the element may be checked for spelling errors.
|
|
423
|
+
tab_index: Defines the position of the current element in the tabbing order.
|
|
424
|
+
title: Defines a tooltip for the element.
|
|
425
|
+
style: The style of the component.
|
|
426
|
+
key: A unique key for the component.
|
|
427
|
+
id: The id for the component.
|
|
428
|
+
class_name: The class name for the component.
|
|
429
|
+
autofocus: Whether the component should take the focus once the page is loaded
|
|
430
|
+
custom_attrs: custom attribute
|
|
431
|
+
**props: The properties of the component.
|
|
432
|
+
|
|
433
|
+
Returns:
|
|
434
|
+
The backend disabled component.
|
|
435
|
+
"""
|
|
436
|
+
...
|
|
437
|
+
|
|
353
438
|
connection_banner = ConnectionBanner.create
|
|
354
439
|
connection_modal = ConnectionModal.create
|
|
355
440
|
connection_toaster = ConnectionToaster.create
|
|
356
441
|
connection_pulser = ConnectionPulser.create
|
|
442
|
+
backend_disabled = BackendDisabled.create
|
|
@@ -41,7 +41,7 @@ class ClientSideRouting(Component):
|
|
|
41
41
|
return ""
|
|
42
42
|
|
|
43
43
|
|
|
44
|
-
def wait_for_client_redirect(component) -> Component:
|
|
44
|
+
def wait_for_client_redirect(component: Component) -> Component:
|
|
45
45
|
"""Wait for a redirect to occur before rendering a component.
|
|
46
46
|
|
|
47
47
|
This prevents the 404 page from flashing while the redirect is happening.
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
from typing import Any, Dict, Optional, Union, overload
|
|
7
7
|
|
|
8
8
|
from reflex.components.component import Component
|
|
9
|
-
from reflex.event import
|
|
9
|
+
from reflex.event import EventType
|
|
10
10
|
from reflex.style import Style
|
|
11
11
|
from reflex.vars.base import Var
|
|
12
12
|
|
|
@@ -26,21 +26,21 @@ class ClientSideRouting(Component):
|
|
|
26
26
|
class_name: Optional[Any] = None,
|
|
27
27
|
autofocus: Optional[bool] = None,
|
|
28
28
|
custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
|
|
29
|
-
on_blur: Optional[EventType[
|
|
30
|
-
on_click: Optional[EventType[
|
|
31
|
-
on_context_menu: Optional[EventType[
|
|
32
|
-
on_double_click: Optional[EventType[
|
|
33
|
-
on_focus: Optional[EventType[
|
|
34
|
-
on_mount: Optional[EventType[
|
|
35
|
-
on_mouse_down: Optional[EventType[
|
|
36
|
-
on_mouse_enter: Optional[EventType[
|
|
37
|
-
on_mouse_leave: Optional[EventType[
|
|
38
|
-
on_mouse_move: Optional[EventType[
|
|
39
|
-
on_mouse_out: Optional[EventType[
|
|
40
|
-
on_mouse_over: Optional[EventType[
|
|
41
|
-
on_mouse_up: Optional[EventType[
|
|
42
|
-
on_scroll: Optional[EventType[
|
|
43
|
-
on_unmount: Optional[EventType[
|
|
29
|
+
on_blur: Optional[EventType[()]] = None,
|
|
30
|
+
on_click: Optional[EventType[()]] = None,
|
|
31
|
+
on_context_menu: Optional[EventType[()]] = None,
|
|
32
|
+
on_double_click: Optional[EventType[()]] = None,
|
|
33
|
+
on_focus: Optional[EventType[()]] = None,
|
|
34
|
+
on_mount: Optional[EventType[()]] = None,
|
|
35
|
+
on_mouse_down: Optional[EventType[()]] = None,
|
|
36
|
+
on_mouse_enter: Optional[EventType[()]] = None,
|
|
37
|
+
on_mouse_leave: Optional[EventType[()]] = None,
|
|
38
|
+
on_mouse_move: Optional[EventType[()]] = None,
|
|
39
|
+
on_mouse_out: Optional[EventType[()]] = None,
|
|
40
|
+
on_mouse_over: Optional[EventType[()]] = None,
|
|
41
|
+
on_mouse_up: Optional[EventType[()]] = None,
|
|
42
|
+
on_scroll: Optional[EventType[()]] = None,
|
|
43
|
+
on_unmount: Optional[EventType[()]] = None,
|
|
44
44
|
**props,
|
|
45
45
|
) -> "ClientSideRouting":
|
|
46
46
|
"""Create the component.
|
|
@@ -60,7 +60,7 @@ class ClientSideRouting(Component):
|
|
|
60
60
|
"""
|
|
61
61
|
...
|
|
62
62
|
|
|
63
|
-
def wait_for_client_redirect(component) -> Component: ...
|
|
63
|
+
def wait_for_client_redirect(component: Component) -> Component: ...
|
|
64
64
|
|
|
65
65
|
class Default404Page(Component):
|
|
66
66
|
@overload
|
|
@@ -75,21 +75,21 @@ class Default404Page(Component):
|
|
|
75
75
|
class_name: Optional[Any] = None,
|
|
76
76
|
autofocus: Optional[bool] = None,
|
|
77
77
|
custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
|
|
78
|
-
on_blur: Optional[EventType[
|
|
79
|
-
on_click: Optional[EventType[
|
|
80
|
-
on_context_menu: Optional[EventType[
|
|
81
|
-
on_double_click: Optional[EventType[
|
|
82
|
-
on_focus: Optional[EventType[
|
|
83
|
-
on_mount: Optional[EventType[
|
|
84
|
-
on_mouse_down: Optional[EventType[
|
|
85
|
-
on_mouse_enter: Optional[EventType[
|
|
86
|
-
on_mouse_leave: Optional[EventType[
|
|
87
|
-
on_mouse_move: Optional[EventType[
|
|
88
|
-
on_mouse_out: Optional[EventType[
|
|
89
|
-
on_mouse_over: Optional[EventType[
|
|
90
|
-
on_mouse_up: Optional[EventType[
|
|
91
|
-
on_scroll: Optional[EventType[
|
|
92
|
-
on_unmount: Optional[EventType[
|
|
78
|
+
on_blur: Optional[EventType[()]] = None,
|
|
79
|
+
on_click: Optional[EventType[()]] = None,
|
|
80
|
+
on_context_menu: Optional[EventType[()]] = None,
|
|
81
|
+
on_double_click: Optional[EventType[()]] = None,
|
|
82
|
+
on_focus: Optional[EventType[()]] = None,
|
|
83
|
+
on_mount: Optional[EventType[()]] = None,
|
|
84
|
+
on_mouse_down: Optional[EventType[()]] = None,
|
|
85
|
+
on_mouse_enter: Optional[EventType[()]] = None,
|
|
86
|
+
on_mouse_leave: Optional[EventType[()]] = None,
|
|
87
|
+
on_mouse_move: Optional[EventType[()]] = None,
|
|
88
|
+
on_mouse_out: Optional[EventType[()]] = None,
|
|
89
|
+
on_mouse_over: Optional[EventType[()]] = None,
|
|
90
|
+
on_mouse_up: Optional[EventType[()]] = None,
|
|
91
|
+
on_scroll: Optional[EventType[()]] = None,
|
|
92
|
+
on_unmount: Optional[EventType[()]] = None,
|
|
93
93
|
**props,
|
|
94
94
|
) -> "Default404Page":
|
|
95
95
|
"""Create the component.
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
from typing import Any, Dict, List, Optional, Union, overload
|
|
7
7
|
|
|
8
8
|
from reflex.components.base.fragment import Fragment
|
|
9
|
-
from reflex.event import
|
|
9
|
+
from reflex.event import EventType
|
|
10
10
|
from reflex.style import Style
|
|
11
11
|
from reflex.utils.imports import ImportVar
|
|
12
12
|
from reflex.vars.base import Var
|
|
@@ -27,27 +27,24 @@ class Clipboard(Fragment):
|
|
|
27
27
|
class_name: Optional[Any] = None,
|
|
28
28
|
autofocus: Optional[bool] = None,
|
|
29
29
|
custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
|
|
30
|
-
on_blur: Optional[EventType[
|
|
31
|
-
on_click: Optional[EventType[
|
|
32
|
-
on_context_menu: Optional[EventType[
|
|
33
|
-
on_double_click: Optional[EventType[
|
|
34
|
-
on_focus: Optional[EventType[
|
|
35
|
-
on_mount: Optional[EventType[
|
|
36
|
-
on_mouse_down: Optional[EventType[
|
|
37
|
-
on_mouse_enter: Optional[EventType[
|
|
38
|
-
on_mouse_leave: Optional[EventType[
|
|
39
|
-
on_mouse_move: Optional[EventType[
|
|
40
|
-
on_mouse_out: Optional[EventType[
|
|
41
|
-
on_mouse_over: Optional[EventType[
|
|
42
|
-
on_mouse_up: Optional[EventType[
|
|
30
|
+
on_blur: Optional[EventType[()]] = None,
|
|
31
|
+
on_click: Optional[EventType[()]] = None,
|
|
32
|
+
on_context_menu: Optional[EventType[()]] = None,
|
|
33
|
+
on_double_click: Optional[EventType[()]] = None,
|
|
34
|
+
on_focus: Optional[EventType[()]] = None,
|
|
35
|
+
on_mount: Optional[EventType[()]] = None,
|
|
36
|
+
on_mouse_down: Optional[EventType[()]] = None,
|
|
37
|
+
on_mouse_enter: Optional[EventType[()]] = None,
|
|
38
|
+
on_mouse_leave: Optional[EventType[()]] = None,
|
|
39
|
+
on_mouse_move: Optional[EventType[()]] = None,
|
|
40
|
+
on_mouse_out: Optional[EventType[()]] = None,
|
|
41
|
+
on_mouse_over: Optional[EventType[()]] = None,
|
|
42
|
+
on_mouse_up: Optional[EventType[()]] = None,
|
|
43
43
|
on_paste: Optional[
|
|
44
|
-
Union[
|
|
45
|
-
EventType[[], BASE_STATE],
|
|
46
|
-
EventType[[list[tuple[str, str]]], BASE_STATE],
|
|
47
|
-
]
|
|
44
|
+
Union[EventType[()], EventType[list[tuple[str, str]]]]
|
|
48
45
|
] = None,
|
|
49
|
-
on_scroll: Optional[EventType[
|
|
50
|
-
on_unmount: Optional[EventType[
|
|
46
|
+
on_scroll: Optional[EventType[()]] = None,
|
|
47
|
+
on_unmount: Optional[EventType[()]] = None,
|
|
51
48
|
**props,
|
|
52
49
|
) -> "Clipboard":
|
|
53
50
|
"""Create a Clipboard component.
|
reflex/components/core/cond.py
CHANGED
|
@@ -26,10 +26,9 @@ class Cond(MemoizationLeaf):
|
|
|
26
26
|
cond: Var[Any]
|
|
27
27
|
|
|
28
28
|
# The component to render if the cond is true.
|
|
29
|
-
comp1: BaseComponent
|
|
30
|
-
|
|
29
|
+
comp1: BaseComponent | None = None
|
|
31
30
|
# The component to render if the cond is false.
|
|
32
|
-
comp2: BaseComponent
|
|
31
|
+
comp2: BaseComponent | None = None
|
|
33
32
|
|
|
34
33
|
@classmethod
|
|
35
34
|
def create(
|
|
@@ -73,8 +72,8 @@ class Cond(MemoizationLeaf):
|
|
|
73
72
|
def _render(self) -> Tag:
|
|
74
73
|
return CondTag(
|
|
75
74
|
cond=self.cond,
|
|
76
|
-
true_value=self.comp1.render(),
|
|
77
|
-
false_value=self.comp2.render(),
|
|
75
|
+
true_value=self.comp1.render(), # pyright: ignore [reportOptionalMemberAccess]
|
|
76
|
+
false_value=self.comp2.render(), # pyright: ignore [reportOptionalMemberAccess]
|
|
78
77
|
)
|
|
79
78
|
|
|
80
79
|
def render(self) -> Dict:
|
|
@@ -111,7 +110,7 @@ class Cond(MemoizationLeaf):
|
|
|
111
110
|
|
|
112
111
|
|
|
113
112
|
@overload
|
|
114
|
-
def cond(condition: Any, c1: Component, c2: Any) -> Component: ...
|
|
113
|
+
def cond(condition: Any, c1: Component, c2: Any) -> Component: ... # pyright: ignore [reportOverlappingOverload]
|
|
115
114
|
|
|
116
115
|
|
|
117
116
|
@overload
|
|
@@ -154,7 +153,7 @@ def cond(condition: Any, c1: Any, c2: Any = None) -> Component | Var:
|
|
|
154
153
|
if c2 is None:
|
|
155
154
|
raise ValueError("For conditional vars, the second argument must be set.")
|
|
156
155
|
|
|
157
|
-
def create_var(cond_part):
|
|
156
|
+
def create_var(cond_part: Any) -> Var[Any]:
|
|
158
157
|
return LiteralVar.create(cond_part)
|
|
159
158
|
|
|
160
159
|
# convert the truth and false cond parts into vars so the _var_data can be obtained.
|
|
@@ -163,16 +162,16 @@ def cond(condition: Any, c1: Any, c2: Any = None) -> Component | Var:
|
|
|
163
162
|
|
|
164
163
|
# Create the conditional var.
|
|
165
164
|
return ternary_operation(
|
|
166
|
-
cond_var.bool()._replace(
|
|
165
|
+
cond_var.bool()._replace(
|
|
167
166
|
merge_var_data=VarData(imports=_IS_TRUE_IMPORT),
|
|
168
|
-
),
|
|
167
|
+
),
|
|
169
168
|
c1,
|
|
170
169
|
c2,
|
|
171
170
|
)
|
|
172
171
|
|
|
173
172
|
|
|
174
173
|
@overload
|
|
175
|
-
def color_mode_cond(light: Component, dark: Component | None = None) -> Component: ... #
|
|
174
|
+
def color_mode_cond(light: Component, dark: Component | None = None) -> Component: ... # pyright: ignore [reportOverlappingOverload]
|
|
176
175
|
|
|
177
176
|
|
|
178
177
|
@overload
|
|
@@ -28,7 +28,7 @@ class DebounceInput(Component):
|
|
|
28
28
|
min_length: Var[int]
|
|
29
29
|
|
|
30
30
|
# Time to wait between end of input and triggering on_change
|
|
31
|
-
debounce_timeout: Var[int] = DEFAULT_DEBOUNCE_TIMEOUT
|
|
31
|
+
debounce_timeout: Var[int] = Var.create(DEFAULT_DEBOUNCE_TIMEOUT)
|
|
32
32
|
|
|
33
33
|
# If true, notify when Enter key is pressed
|
|
34
34
|
force_notify_by_enter: Var[bool]
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
from typing import Any, Dict, Optional, Type, Union, overload
|
|
7
7
|
|
|
8
8
|
from reflex.components.component import Component
|
|
9
|
-
from reflex.event import
|
|
9
|
+
from reflex.event import EventType
|
|
10
10
|
from reflex.style import Style
|
|
11
11
|
from reflex.vars.base import Var
|
|
12
12
|
|
|
@@ -31,22 +31,22 @@ class DebounceInput(Component):
|
|
|
31
31
|
class_name: Optional[Any] = None,
|
|
32
32
|
autofocus: Optional[bool] = None,
|
|
33
33
|
custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
|
|
34
|
-
on_blur: Optional[EventType[
|
|
35
|
-
on_change: Optional[EventType[
|
|
36
|
-
on_click: Optional[EventType[
|
|
37
|
-
on_context_menu: Optional[EventType[
|
|
38
|
-
on_double_click: Optional[EventType[
|
|
39
|
-
on_focus: Optional[EventType[
|
|
40
|
-
on_mount: Optional[EventType[
|
|
41
|
-
on_mouse_down: Optional[EventType[
|
|
42
|
-
on_mouse_enter: Optional[EventType[
|
|
43
|
-
on_mouse_leave: Optional[EventType[
|
|
44
|
-
on_mouse_move: Optional[EventType[
|
|
45
|
-
on_mouse_out: Optional[EventType[
|
|
46
|
-
on_mouse_over: Optional[EventType[
|
|
47
|
-
on_mouse_up: Optional[EventType[
|
|
48
|
-
on_scroll: Optional[EventType[
|
|
49
|
-
on_unmount: Optional[EventType[
|
|
34
|
+
on_blur: Optional[EventType[()]] = None,
|
|
35
|
+
on_change: Optional[EventType[()]] = None,
|
|
36
|
+
on_click: Optional[EventType[()]] = None,
|
|
37
|
+
on_context_menu: Optional[EventType[()]] = None,
|
|
38
|
+
on_double_click: Optional[EventType[()]] = None,
|
|
39
|
+
on_focus: Optional[EventType[()]] = None,
|
|
40
|
+
on_mount: Optional[EventType[()]] = None,
|
|
41
|
+
on_mouse_down: Optional[EventType[()]] = None,
|
|
42
|
+
on_mouse_enter: Optional[EventType[()]] = None,
|
|
43
|
+
on_mouse_leave: Optional[EventType[()]] = None,
|
|
44
|
+
on_mouse_move: Optional[EventType[()]] = None,
|
|
45
|
+
on_mouse_out: Optional[EventType[()]] = None,
|
|
46
|
+
on_mouse_over: Optional[EventType[()]] = None,
|
|
47
|
+
on_mouse_up: Optional[EventType[()]] = None,
|
|
48
|
+
on_scroll: Optional[EventType[()]] = None,
|
|
49
|
+
on_unmount: Optional[EventType[()]] = None,
|
|
50
50
|
**props,
|
|
51
51
|
) -> "DebounceInput":
|
|
52
52
|
"""Create a DebounceInput component.
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
+
import functools
|
|
5
6
|
import inspect
|
|
6
7
|
from typing import Any, Callable, Iterable
|
|
7
8
|
|
|
@@ -10,6 +11,7 @@ from reflex.components.component import Component
|
|
|
10
11
|
from reflex.components.tags import IterTag
|
|
11
12
|
from reflex.constants import MemoizationMode
|
|
12
13
|
from reflex.state import ComponentState
|
|
14
|
+
from reflex.utils.exceptions import UntypedVarError
|
|
13
15
|
from reflex.vars.base import LiteralVar, Var
|
|
14
16
|
|
|
15
17
|
|
|
@@ -50,7 +52,10 @@ class Foreach(Component):
|
|
|
50
52
|
Raises:
|
|
51
53
|
ForeachVarError: If the iterable is of type Any.
|
|
52
54
|
TypeError: If the render function is a ComponentState.
|
|
55
|
+
UntypedVarError: If the iterable is of type Any without a type annotation.
|
|
53
56
|
"""
|
|
57
|
+
from reflex.vars.object import ObjectVar
|
|
58
|
+
|
|
54
59
|
iterable = LiteralVar.create(iterable)
|
|
55
60
|
if iterable._var_type == Any:
|
|
56
61
|
raise ForeachVarError(
|
|
@@ -67,12 +72,21 @@ class Foreach(Component):
|
|
|
67
72
|
"Using a ComponentState as `render_fn` inside `rx.foreach` is not supported yet."
|
|
68
73
|
)
|
|
69
74
|
|
|
75
|
+
if isinstance(iterable, ObjectVar):
|
|
76
|
+
iterable = iterable.entries()
|
|
77
|
+
|
|
70
78
|
component = cls(
|
|
71
79
|
iterable=iterable,
|
|
72
80
|
render_fn=render_fn,
|
|
73
81
|
)
|
|
74
|
-
|
|
75
|
-
|
|
82
|
+
try:
|
|
83
|
+
# Keep a ref to a rendered component to determine correct imports/hooks/styles.
|
|
84
|
+
component.children = [component._render().render_component()]
|
|
85
|
+
except UntypedVarError as e:
|
|
86
|
+
raise UntypedVarError(
|
|
87
|
+
f"Could not foreach over var `{iterable!s}` without a type annotation. "
|
|
88
|
+
"See https://reflex.dev/docs/library/dynamic-rendering/foreach/"
|
|
89
|
+
) from e
|
|
76
90
|
return component
|
|
77
91
|
|
|
78
92
|
def _render(self) -> IterTag:
|
|
@@ -97,9 +111,20 @@ class Foreach(Component):
|
|
|
97
111
|
# Determine the index var name based on the params accepted by render_fn.
|
|
98
112
|
props["index_var_name"] = params[1].name
|
|
99
113
|
else:
|
|
114
|
+
render_fn = self.render_fn
|
|
100
115
|
# Otherwise, use a deterministic index, based on the render function bytecode.
|
|
101
116
|
code_hash = (
|
|
102
|
-
hash(
|
|
117
|
+
hash(
|
|
118
|
+
getattr(
|
|
119
|
+
render_fn,
|
|
120
|
+
"__code__",
|
|
121
|
+
(
|
|
122
|
+
repr(self.render_fn)
|
|
123
|
+
if not isinstance(render_fn, functools.partial)
|
|
124
|
+
else render_fn.func.__code__
|
|
125
|
+
),
|
|
126
|
+
)
|
|
127
|
+
)
|
|
103
128
|
.to_bytes(
|
|
104
129
|
length=8,
|
|
105
130
|
byteorder="big",
|