reflex 0.5.10a3__py3-none-any.whl → 0.6.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.
- reflex/.templates/jinja/web/pages/utils.js.jinja2 +4 -4
- reflex/.templates/jinja/web/utils/context.js.jinja2 +1 -1
- reflex/.templates/jinja/web/utils/theme.js.jinja2 +1 -1
- reflex/__init__.py +3 -2
- reflex/__init__.pyi +2 -2
- reflex/app.py +43 -9
- reflex/base.py +3 -2
- reflex/compiler/compiler.py +6 -6
- reflex/compiler/utils.py +5 -3
- reflex/components/base/app_wrap.py +2 -4
- reflex/components/base/app_wrap.pyi +17 -17
- reflex/components/base/bare.py +7 -4
- reflex/components/base/body.pyi +17 -17
- reflex/components/base/document.pyi +81 -81
- reflex/components/base/error_boundary.py +10 -8
- reflex/components/base/error_boundary.pyi +20 -19
- reflex/components/base/fragment.pyi +17 -17
- reflex/components/base/head.pyi +33 -33
- reflex/components/base/link.pyi +34 -33
- reflex/components/base/meta.pyi +65 -65
- reflex/components/base/script.py +2 -1
- reflex/components/base/script.pyi +21 -20
- reflex/components/component.py +116 -145
- reflex/components/core/banner.py +59 -60
- reflex/components/core/banner.pyi +86 -150
- reflex/components/core/client_side_routing.py +2 -1
- reflex/components/core/client_side_routing.pyi +34 -33
- reflex/components/core/clipboard.py +2 -2
- reflex/components/core/clipboard.pyi +19 -18
- reflex/components/core/cond.py +21 -44
- reflex/components/core/debounce.py +6 -8
- reflex/components/core/debounce.pyi +19 -18
- reflex/components/core/foreach.py +5 -14
- reflex/components/core/html.pyi +18 -17
- reflex/components/core/match.py +36 -43
- reflex/components/core/upload.py +32 -25
- reflex/components/core/upload.pyi +84 -73
- reflex/components/datadisplay/code.py +55 -28
- reflex/components/datadisplay/code.pyi +20 -17
- reflex/components/datadisplay/dataeditor.py +17 -11
- reflex/components/datadisplay/dataeditor.pyi +34 -33
- reflex/components/el/__init__.py +0 -1
- reflex/components/el/__init__.pyi +0 -11
- reflex/components/el/element.pyi +17 -17
- reflex/components/el/elements/__init__.py +1 -7
- reflex/components/el/elements/__init__.pyi +1 -15
- reflex/components/el/elements/base.pyi +18 -17
- reflex/components/el/elements/forms.py +24 -31
- reflex/components/el/elements/forms.pyi +237 -236
- reflex/components/el/elements/inline.pyi +450 -449
- reflex/components/el/elements/media.py +0 -21
- reflex/components/el/elements/media.pyi +338 -337
- reflex/components/el/elements/metadata.py +3 -2
- reflex/components/el/elements/metadata.pyi +98 -97
- reflex/components/el/elements/other.pyi +114 -113
- reflex/components/el/elements/scripts.pyi +50 -49
- reflex/components/el/elements/sectioning.pyi +242 -241
- reflex/components/el/elements/tables.pyi +162 -161
- reflex/components/el/elements/typography.pyi +242 -241
- reflex/components/gridjs/datatable.py +13 -14
- reflex/components/gridjs/datatable.pyi +34 -33
- reflex/components/lucide/icon.py +2 -126
- reflex/components/lucide/icon.pyi +34 -142
- reflex/components/markdown/markdown.py +30 -35
- reflex/components/markdown/markdown.pyi +29 -32
- reflex/components/moment/moment.pyi +19 -18
- reflex/components/next/base.pyi +17 -17
- reflex/components/next/image.py +0 -4
- reflex/components/next/image.pyi +20 -19
- reflex/components/next/link.pyi +18 -17
- reflex/components/next/video.pyi +18 -17
- reflex/components/plotly/plotly.py +16 -28
- reflex/components/plotly/plotly.pyi +36 -35
- reflex/components/props.py +21 -10
- reflex/components/radix/__init__.pyi +1 -1
- reflex/components/radix/primitives/__init__.pyi +0 -1
- reflex/components/radix/primitives/accordion.py +7 -8
- reflex/components/radix/primitives/accordion.pyi +117 -116
- reflex/components/radix/primitives/base.pyi +34 -33
- reflex/components/radix/primitives/drawer.pyi +169 -168
- reflex/components/radix/primitives/form.pyi +168 -167
- reflex/components/radix/primitives/progress.pyi +82 -81
- reflex/components/radix/primitives/slider.pyi +84 -83
- reflex/components/radix/themes/base.py +8 -4
- reflex/components/radix/themes/base.pyi +114 -113
- reflex/components/radix/themes/color_mode.py +12 -21
- reflex/components/radix/themes/color_mode.pyi +67 -67
- reflex/components/radix/themes/components/__init__.pyi +1 -0
- reflex/components/radix/themes/components/alert_dialog.pyi +118 -117
- reflex/components/radix/themes/components/aspect_ratio.pyi +18 -17
- reflex/components/radix/themes/components/avatar.pyi +18 -17
- reflex/components/radix/themes/components/badge.pyi +18 -17
- reflex/components/radix/themes/components/button.pyi +18 -17
- reflex/components/radix/themes/components/callout.pyi +82 -81
- reflex/components/radix/themes/components/card.pyi +18 -17
- reflex/components/radix/themes/components/checkbox.py +2 -3
- reflex/components/radix/themes/components/checkbox.pyi +53 -52
- reflex/components/radix/themes/components/checkbox_cards.pyi +34 -33
- reflex/components/radix/themes/components/checkbox_group.pyi +34 -33
- reflex/components/radix/themes/components/context_menu.pyi +140 -139
- reflex/components/radix/themes/components/data_list.py +5 -0
- reflex/components/radix/themes/components/data_list.pyi +71 -65
- reflex/components/radix/themes/components/dialog.pyi +121 -120
- reflex/components/radix/themes/components/dropdown_menu.pyi +142 -141
- reflex/components/radix/themes/components/hover_card.pyi +68 -67
- reflex/components/radix/themes/components/icon_button.py +2 -1
- reflex/components/radix/themes/components/icon_button.pyi +18 -17
- reflex/components/radix/themes/components/inset.pyi +18 -17
- reflex/components/radix/themes/components/popover.pyi +73 -72
- reflex/components/radix/themes/components/progress.pyi +18 -17
- reflex/components/radix/themes/components/radio.pyi +18 -17
- reflex/components/radix/themes/components/radio_cards.pyi +35 -34
- reflex/components/radix/themes/components/radio_group.py +35 -31
- reflex/components/radix/themes/components/radio_group.pyi +73 -66
- reflex/components/radix/themes/components/scroll_area.pyi +18 -17
- reflex/components/radix/themes/components/segmented_control.pyi +35 -34
- reflex/components/radix/themes/components/select.py +2 -1
- reflex/components/radix/themes/components/select.pyi +155 -154
- reflex/components/radix/themes/components/separator.py +2 -3
- reflex/components/radix/themes/components/separator.pyi +18 -17
- reflex/components/radix/themes/components/skeleton.pyi +18 -17
- reflex/components/radix/themes/components/slider.py +2 -1
- reflex/components/radix/themes/components/slider.pyi +20 -19
- reflex/components/radix/themes/components/spinner.pyi +18 -17
- reflex/components/radix/themes/components/switch.pyi +19 -18
- reflex/components/radix/themes/components/table.pyi +114 -113
- reflex/components/radix/themes/components/tabs.pyi +84 -83
- reflex/components/radix/themes/components/text_area.pyi +21 -20
- reflex/components/radix/themes/components/text_field.py +0 -79
- reflex/components/radix/themes/components/text_field.pyi +57 -63
- reflex/components/radix/themes/components/tooltip.pyi +21 -20
- reflex/components/radix/themes/layout/base.pyi +18 -17
- reflex/components/radix/themes/layout/box.pyi +18 -17
- reflex/components/radix/themes/layout/center.pyi +18 -17
- reflex/components/radix/themes/layout/container.py +2 -3
- reflex/components/radix/themes/layout/container.pyi +18 -17
- reflex/components/radix/themes/layout/flex.pyi +18 -17
- reflex/components/radix/themes/layout/grid.pyi +18 -17
- reflex/components/radix/themes/layout/list.py +5 -4
- reflex/components/radix/themes/layout/list.pyi +86 -85
- reflex/components/radix/themes/layout/section.py +2 -3
- reflex/components/radix/themes/layout/section.pyi +18 -17
- reflex/components/radix/themes/layout/spacer.pyi +18 -17
- reflex/components/radix/themes/layout/stack.pyi +50 -49
- reflex/components/radix/themes/typography/blockquote.pyi +18 -17
- reflex/components/radix/themes/typography/code.pyi +18 -17
- reflex/components/radix/themes/typography/heading.pyi +18 -17
- reflex/components/radix/themes/typography/link.pyi +18 -17
- reflex/components/radix/themes/typography/text.pyi +114 -113
- reflex/components/react_player/audio.pyi +34 -33
- reflex/components/react_player/react_player.pyi +34 -33
- reflex/components/react_player/video.pyi +34 -33
- reflex/components/recharts/cartesian.py +23 -19
- reflex/components/recharts/cartesian.pyi +297 -296
- reflex/components/recharts/charts.py +6 -5
- reflex/components/recharts/charts.pyi +179 -178
- reflex/components/recharts/general.py +8 -7
- reflex/components/recharts/general.pyi +82 -81
- reflex/components/recharts/polar.py +14 -13
- reflex/components/recharts/polar.pyi +76 -75
- reflex/components/recharts/recharts.pyi +33 -33
- reflex/components/sonner/toast.py +30 -33
- reflex/components/sonner/toast.pyi +27 -25
- reflex/components/suneditor/editor.py +2 -1
- reflex/components/suneditor/editor.pyi +27 -26
- reflex/components/tags/iter_tag.py +16 -16
- reflex/components/tags/tag.py +8 -10
- reflex/constants/base.py +3 -1
- reflex/constants/event.py +1 -0
- reflex/event.py +89 -79
- reflex/experimental/__init__.py +25 -6
- reflex/experimental/client_state.py +34 -58
- reflex/experimental/hooks.py +13 -18
- reflex/experimental/layout.py +5 -5
- reflex/experimental/layout.pyi +84 -83
- reflex/{experimental/vars → ivars}/__init__.py +0 -1
- reflex/ivars/base.py +2180 -0
- reflex/ivars/function.py +200 -0
- reflex/ivars/number.py +1137 -0
- reflex/ivars/object.py +564 -0
- reflex/ivars/sequence.py +1601 -0
- reflex/model.py +22 -0
- reflex/reflex.py +4 -0
- reflex/state.py +388 -73
- reflex/style.py +52 -34
- reflex/testing.py +8 -3
- reflex/utils/exceptions.py +12 -0
- reflex/utils/exec.py +0 -14
- reflex/utils/format.py +74 -223
- reflex/utils/net.py +43 -0
- reflex/utils/path_ops.py +13 -1
- reflex/utils/prerequisites.py +46 -26
- reflex/utils/pyi_generator.py +5 -4
- reflex/utils/serializers.py +13 -31
- reflex/utils/types.py +44 -9
- reflex/vars.py +127 -2230
- {reflex-0.5.10a3.dist-info → reflex-0.6.0a1.dist-info}/METADATA +4 -6
- reflex-0.6.0a1.dist-info/RECORD +384 -0
- reflex/.templates/apps/demo/.gitignore +0 -4
- reflex/.templates/apps/demo/assets/favicon.ico +0 -0
- reflex/.templates/apps/demo/assets/github.svg +0 -10
- reflex/.templates/apps/demo/assets/icon.svg +0 -37
- reflex/.templates/apps/demo/assets/logo.svg +0 -68
- reflex/.templates/apps/demo/assets/paneleft.svg +0 -13
- reflex/.templates/apps/demo/code/__init__.py +0 -1
- reflex/.templates/apps/demo/code/demo.py +0 -127
- reflex/.templates/apps/demo/code/pages/__init__.py +0 -7
- reflex/.templates/apps/demo/code/pages/chatapp.py +0 -31
- reflex/.templates/apps/demo/code/pages/datatable.py +0 -360
- reflex/.templates/apps/demo/code/pages/forms.py +0 -257
- reflex/.templates/apps/demo/code/pages/graphing.py +0 -253
- reflex/.templates/apps/demo/code/pages/home.py +0 -56
- reflex/.templates/apps/demo/code/sidebar.py +0 -178
- reflex/.templates/apps/demo/code/state.py +0 -22
- reflex/.templates/apps/demo/code/states/form_state.py +0 -40
- reflex/.templates/apps/demo/code/states/pie_state.py +0 -47
- reflex/.templates/apps/demo/code/styles.py +0 -68
- reflex/.templates/apps/demo/code/webui/__init__.py +0 -0
- reflex/.templates/apps/demo/code/webui/components/__init__.py +0 -4
- reflex/.templates/apps/demo/code/webui/components/chat.py +0 -118
- reflex/.templates/apps/demo/code/webui/components/loading_icon.py +0 -19
- reflex/.templates/apps/demo/code/webui/components/modal.py +0 -56
- reflex/.templates/apps/demo/code/webui/components/navbar.py +0 -70
- reflex/.templates/apps/demo/code/webui/components/sidebar.py +0 -66
- reflex/.templates/apps/demo/code/webui/state.py +0 -146
- reflex/.templates/apps/demo/code/webui/styles.py +0 -88
- reflex/experimental/vars/base.py +0 -583
- reflex/experimental/vars/function.py +0 -290
- reflex/experimental/vars/number.py +0 -1458
- reflex/experimental/vars/object.py +0 -804
- reflex/experimental/vars/sequence.py +0 -1764
- reflex/utils/watch.py +0 -96
- reflex/vars.pyi +0 -218
- reflex-0.5.10a3.dist-info/RECORD +0 -413
- {reflex-0.5.10a3.dist-info → reflex-0.6.0a1.dist-info}/LICENSE +0 -0
- {reflex-0.5.10a3.dist-info → reflex-0.6.0a1.dist-info}/WHEEL +0 -0
- {reflex-0.5.10a3.dist-info → reflex-0.6.0a1.dist-info}/entry_points.txt +0 -0
|
@@ -7,15 +7,16 @@ from typing import Any, Callable, Dict, List, Literal, Optional, Union, overload
|
|
|
7
7
|
|
|
8
8
|
from reflex.constants.colors import Color
|
|
9
9
|
from reflex.event import EventHandler, EventSpec
|
|
10
|
+
from reflex.ivars.base import ImmutableVar
|
|
10
11
|
from reflex.style import Style
|
|
11
|
-
from reflex.vars import
|
|
12
|
+
from reflex.vars import Var
|
|
12
13
|
|
|
13
14
|
from .recharts import (
|
|
14
15
|
Recharts,
|
|
15
16
|
)
|
|
16
17
|
|
|
17
18
|
class Pie(Recharts):
|
|
18
|
-
def get_event_triggers(self) -> dict[str, Union[
|
|
19
|
+
def get_event_triggers(self) -> dict[str, Union[ImmutableVar, Any]]: ...
|
|
19
20
|
@overload
|
|
20
21
|
@classmethod
|
|
21
22
|
def create( # type: ignore
|
|
@@ -73,24 +74,24 @@ class Pie(Recharts):
|
|
|
73
74
|
id: Optional[Any] = None,
|
|
74
75
|
class_name: Optional[Any] = None,
|
|
75
76
|
autofocus: Optional[bool] = None,
|
|
76
|
-
custom_attrs: Optional[Dict[str, Union[
|
|
77
|
+
custom_attrs: Optional[Dict[str, Union[ImmutableVar, str]]] = None,
|
|
77
78
|
on_click: Optional[
|
|
78
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
79
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
79
80
|
] = None,
|
|
80
81
|
on_mouse_enter: Optional[
|
|
81
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
82
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
82
83
|
] = None,
|
|
83
84
|
on_mouse_leave: Optional[
|
|
84
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
85
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
85
86
|
] = None,
|
|
86
87
|
on_mouse_move: Optional[
|
|
87
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
88
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
88
89
|
] = None,
|
|
89
90
|
on_mouse_out: Optional[
|
|
90
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
91
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
91
92
|
] = None,
|
|
92
93
|
on_mouse_over: Optional[
|
|
93
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
94
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
94
95
|
] = None,
|
|
95
96
|
**props,
|
|
96
97
|
) -> "Pie":
|
|
@@ -154,51 +155,51 @@ class Radar(Recharts):
|
|
|
154
155
|
id: Optional[Any] = None,
|
|
155
156
|
class_name: Optional[Any] = None,
|
|
156
157
|
autofocus: Optional[bool] = None,
|
|
157
|
-
custom_attrs: Optional[Dict[str, Union[
|
|
158
|
+
custom_attrs: Optional[Dict[str, Union[ImmutableVar, str]]] = None,
|
|
158
159
|
on_blur: Optional[
|
|
159
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
160
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
160
161
|
] = None,
|
|
161
162
|
on_click: Optional[
|
|
162
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
163
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
163
164
|
] = None,
|
|
164
165
|
on_context_menu: Optional[
|
|
165
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
166
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
166
167
|
] = None,
|
|
167
168
|
on_double_click: Optional[
|
|
168
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
169
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
169
170
|
] = None,
|
|
170
171
|
on_focus: Optional[
|
|
171
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
172
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
172
173
|
] = None,
|
|
173
174
|
on_mount: Optional[
|
|
174
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
175
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
175
176
|
] = None,
|
|
176
177
|
on_mouse_down: Optional[
|
|
177
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
178
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
178
179
|
] = None,
|
|
179
180
|
on_mouse_enter: Optional[
|
|
180
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
181
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
181
182
|
] = None,
|
|
182
183
|
on_mouse_leave: Optional[
|
|
183
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
184
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
184
185
|
] = None,
|
|
185
186
|
on_mouse_move: Optional[
|
|
186
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
187
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
187
188
|
] = None,
|
|
188
189
|
on_mouse_out: Optional[
|
|
189
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
190
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
190
191
|
] = None,
|
|
191
192
|
on_mouse_over: Optional[
|
|
192
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
193
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
193
194
|
] = None,
|
|
194
195
|
on_mouse_up: Optional[
|
|
195
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
196
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
196
197
|
] = None,
|
|
197
198
|
on_scroll: Optional[
|
|
198
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
199
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
199
200
|
] = None,
|
|
200
201
|
on_unmount: Optional[
|
|
201
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
202
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
202
203
|
] = None,
|
|
203
204
|
**props,
|
|
204
205
|
) -> "Radar":
|
|
@@ -231,7 +232,7 @@ class Radar(Recharts):
|
|
|
231
232
|
...
|
|
232
233
|
|
|
233
234
|
class RadialBar(Recharts):
|
|
234
|
-
def get_event_triggers(self) -> dict[str, Union[
|
|
235
|
+
def get_event_triggers(self) -> dict[str, Union[ImmutableVar, Any]]: ...
|
|
235
236
|
@overload
|
|
236
237
|
@classmethod
|
|
237
238
|
def create( # type: ignore
|
|
@@ -260,30 +261,30 @@ class RadialBar(Recharts):
|
|
|
260
261
|
id: Optional[Any] = None,
|
|
261
262
|
class_name: Optional[Any] = None,
|
|
262
263
|
autofocus: Optional[bool] = None,
|
|
263
|
-
custom_attrs: Optional[Dict[str, Union[
|
|
264
|
+
custom_attrs: Optional[Dict[str, Union[ImmutableVar, str]]] = None,
|
|
264
265
|
on_animation_end: Optional[
|
|
265
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
266
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
266
267
|
] = None,
|
|
267
268
|
on_animation_start: Optional[
|
|
268
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
269
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
269
270
|
] = None,
|
|
270
271
|
on_click: Optional[
|
|
271
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
272
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
272
273
|
] = None,
|
|
273
274
|
on_mouse_enter: Optional[
|
|
274
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
275
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
275
276
|
] = None,
|
|
276
277
|
on_mouse_leave: Optional[
|
|
277
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
278
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
278
279
|
] = None,
|
|
279
280
|
on_mouse_move: Optional[
|
|
280
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
281
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
281
282
|
] = None,
|
|
282
283
|
on_mouse_out: Optional[
|
|
283
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
284
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
284
285
|
] = None,
|
|
285
286
|
on_mouse_over: Optional[
|
|
286
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
287
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
287
288
|
] = None,
|
|
288
289
|
**props,
|
|
289
290
|
) -> "RadialBar":
|
|
@@ -340,51 +341,51 @@ class PolarAngleAxis(Recharts):
|
|
|
340
341
|
id: Optional[Any] = None,
|
|
341
342
|
class_name: Optional[Any] = None,
|
|
342
343
|
autofocus: Optional[bool] = None,
|
|
343
|
-
custom_attrs: Optional[Dict[str, Union[
|
|
344
|
+
custom_attrs: Optional[Dict[str, Union[ImmutableVar, str]]] = None,
|
|
344
345
|
on_blur: Optional[
|
|
345
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
346
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
346
347
|
] = None,
|
|
347
348
|
on_click: Optional[
|
|
348
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
349
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
349
350
|
] = None,
|
|
350
351
|
on_context_menu: Optional[
|
|
351
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
352
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
352
353
|
] = None,
|
|
353
354
|
on_double_click: Optional[
|
|
354
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
355
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
355
356
|
] = None,
|
|
356
357
|
on_focus: Optional[
|
|
357
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
358
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
358
359
|
] = None,
|
|
359
360
|
on_mount: Optional[
|
|
360
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
361
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
361
362
|
] = None,
|
|
362
363
|
on_mouse_down: Optional[
|
|
363
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
364
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
364
365
|
] = None,
|
|
365
366
|
on_mouse_enter: Optional[
|
|
366
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
367
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
367
368
|
] = None,
|
|
368
369
|
on_mouse_leave: Optional[
|
|
369
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
370
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
370
371
|
] = None,
|
|
371
372
|
on_mouse_move: Optional[
|
|
372
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
373
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
373
374
|
] = None,
|
|
374
375
|
on_mouse_out: Optional[
|
|
375
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
376
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
376
377
|
] = None,
|
|
377
378
|
on_mouse_over: Optional[
|
|
378
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
379
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
379
380
|
] = None,
|
|
380
381
|
on_mouse_up: Optional[
|
|
381
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
382
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
382
383
|
] = None,
|
|
383
384
|
on_scroll: Optional[
|
|
384
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
385
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
385
386
|
] = None,
|
|
386
387
|
on_unmount: Optional[
|
|
387
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
388
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
388
389
|
] = None,
|
|
389
390
|
**props,
|
|
390
391
|
) -> "PolarAngleAxis":
|
|
@@ -438,51 +439,51 @@ class PolarGrid(Recharts):
|
|
|
438
439
|
id: Optional[Any] = None,
|
|
439
440
|
class_name: Optional[Any] = None,
|
|
440
441
|
autofocus: Optional[bool] = None,
|
|
441
|
-
custom_attrs: Optional[Dict[str, Union[
|
|
442
|
+
custom_attrs: Optional[Dict[str, Union[ImmutableVar, str]]] = None,
|
|
442
443
|
on_blur: Optional[
|
|
443
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
444
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
444
445
|
] = None,
|
|
445
446
|
on_click: Optional[
|
|
446
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
447
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
447
448
|
] = None,
|
|
448
449
|
on_context_menu: Optional[
|
|
449
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
450
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
450
451
|
] = None,
|
|
451
452
|
on_double_click: Optional[
|
|
452
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
453
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
453
454
|
] = None,
|
|
454
455
|
on_focus: Optional[
|
|
455
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
456
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
456
457
|
] = None,
|
|
457
458
|
on_mount: Optional[
|
|
458
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
459
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
459
460
|
] = None,
|
|
460
461
|
on_mouse_down: Optional[
|
|
461
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
462
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
462
463
|
] = None,
|
|
463
464
|
on_mouse_enter: Optional[
|
|
464
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
465
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
465
466
|
] = None,
|
|
466
467
|
on_mouse_leave: Optional[
|
|
467
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
468
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
468
469
|
] = None,
|
|
469
470
|
on_mouse_move: Optional[
|
|
470
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
471
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
471
472
|
] = None,
|
|
472
473
|
on_mouse_out: Optional[
|
|
473
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
474
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
474
475
|
] = None,
|
|
475
476
|
on_mouse_over: Optional[
|
|
476
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
477
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
477
478
|
] = None,
|
|
478
479
|
on_mouse_up: Optional[
|
|
479
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
480
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
480
481
|
] = None,
|
|
481
482
|
on_scroll: Optional[
|
|
482
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
483
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
483
484
|
] = None,
|
|
484
485
|
on_unmount: Optional[
|
|
485
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
486
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
486
487
|
] = None,
|
|
487
488
|
**props,
|
|
488
489
|
) -> "PolarGrid":
|
|
@@ -512,7 +513,7 @@ class PolarGrid(Recharts):
|
|
|
512
513
|
...
|
|
513
514
|
|
|
514
515
|
class PolarRadiusAxis(Recharts):
|
|
515
|
-
def get_event_triggers(self) -> dict[str, Union[
|
|
516
|
+
def get_event_triggers(self) -> dict[str, Union[ImmutableVar, Any]]: ...
|
|
516
517
|
@overload
|
|
517
518
|
@classmethod
|
|
518
519
|
def create( # type: ignore
|
|
@@ -579,24 +580,24 @@ class PolarRadiusAxis(Recharts):
|
|
|
579
580
|
id: Optional[Any] = None,
|
|
580
581
|
class_name: Optional[Any] = None,
|
|
581
582
|
autofocus: Optional[bool] = None,
|
|
582
|
-
custom_attrs: Optional[Dict[str, Union[
|
|
583
|
+
custom_attrs: Optional[Dict[str, Union[ImmutableVar, str]]] = None,
|
|
583
584
|
on_click: Optional[
|
|
584
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
585
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
585
586
|
] = None,
|
|
586
587
|
on_mouse_enter: Optional[
|
|
587
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
588
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
588
589
|
] = None,
|
|
589
590
|
on_mouse_leave: Optional[
|
|
590
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
591
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
591
592
|
] = None,
|
|
592
593
|
on_mouse_move: Optional[
|
|
593
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
594
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
594
595
|
] = None,
|
|
595
596
|
on_mouse_out: Optional[
|
|
596
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
597
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
597
598
|
] = None,
|
|
598
599
|
on_mouse_over: Optional[
|
|
599
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
600
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
600
601
|
] = None,
|
|
601
602
|
**props,
|
|
602
603
|
) -> "PolarRadiusAxis":
|
|
@@ -7,8 +7,8 @@ from typing import Any, Callable, Dict, Literal, Optional, Union, overload
|
|
|
7
7
|
|
|
8
8
|
from reflex.components.component import Component, MemoizationLeaf, NoSSRComponent
|
|
9
9
|
from reflex.event import EventHandler, EventSpec
|
|
10
|
+
from reflex.ivars.base import ImmutableVar
|
|
10
11
|
from reflex.style import Style
|
|
11
|
-
from reflex.vars import BaseVar, Var
|
|
12
12
|
|
|
13
13
|
class Recharts(Component):
|
|
14
14
|
def render(self) -> Dict: ...
|
|
@@ -22,51 +22,51 @@ class Recharts(Component):
|
|
|
22
22
|
id: Optional[Any] = None,
|
|
23
23
|
class_name: Optional[Any] = None,
|
|
24
24
|
autofocus: Optional[bool] = None,
|
|
25
|
-
custom_attrs: Optional[Dict[str, Union[
|
|
25
|
+
custom_attrs: Optional[Dict[str, Union[ImmutableVar, str]]] = None,
|
|
26
26
|
on_blur: Optional[
|
|
27
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
27
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
28
28
|
] = None,
|
|
29
29
|
on_click: Optional[
|
|
30
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
30
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
31
31
|
] = None,
|
|
32
32
|
on_context_menu: Optional[
|
|
33
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
33
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
34
34
|
] = None,
|
|
35
35
|
on_double_click: Optional[
|
|
36
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
36
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
37
37
|
] = None,
|
|
38
38
|
on_focus: Optional[
|
|
39
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
39
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
40
40
|
] = None,
|
|
41
41
|
on_mount: Optional[
|
|
42
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
42
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
43
43
|
] = None,
|
|
44
44
|
on_mouse_down: Optional[
|
|
45
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
45
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
46
46
|
] = None,
|
|
47
47
|
on_mouse_enter: Optional[
|
|
48
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
48
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
49
49
|
] = None,
|
|
50
50
|
on_mouse_leave: Optional[
|
|
51
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
51
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
52
52
|
] = None,
|
|
53
53
|
on_mouse_move: Optional[
|
|
54
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
54
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
55
55
|
] = None,
|
|
56
56
|
on_mouse_out: Optional[
|
|
57
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
57
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
58
58
|
] = None,
|
|
59
59
|
on_mouse_over: Optional[
|
|
60
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
60
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
61
61
|
] = None,
|
|
62
62
|
on_mouse_up: Optional[
|
|
63
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
63
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
64
64
|
] = None,
|
|
65
65
|
on_scroll: Optional[
|
|
66
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
66
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
67
67
|
] = None,
|
|
68
68
|
on_unmount: Optional[
|
|
69
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
69
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
70
70
|
] = None,
|
|
71
71
|
**props,
|
|
72
72
|
) -> "Recharts":
|
|
@@ -98,51 +98,51 @@ class RechartsCharts(NoSSRComponent, MemoizationLeaf):
|
|
|
98
98
|
id: Optional[Any] = None,
|
|
99
99
|
class_name: Optional[Any] = None,
|
|
100
100
|
autofocus: Optional[bool] = None,
|
|
101
|
-
custom_attrs: Optional[Dict[str, Union[
|
|
101
|
+
custom_attrs: Optional[Dict[str, Union[ImmutableVar, str]]] = None,
|
|
102
102
|
on_blur: Optional[
|
|
103
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
103
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
104
104
|
] = None,
|
|
105
105
|
on_click: Optional[
|
|
106
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
106
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
107
107
|
] = None,
|
|
108
108
|
on_context_menu: Optional[
|
|
109
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
109
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
110
110
|
] = None,
|
|
111
111
|
on_double_click: Optional[
|
|
112
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
112
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
113
113
|
] = None,
|
|
114
114
|
on_focus: Optional[
|
|
115
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
115
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
116
116
|
] = None,
|
|
117
117
|
on_mount: Optional[
|
|
118
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
118
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
119
119
|
] = None,
|
|
120
120
|
on_mouse_down: Optional[
|
|
121
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
121
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
122
122
|
] = None,
|
|
123
123
|
on_mouse_enter: Optional[
|
|
124
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
124
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
125
125
|
] = None,
|
|
126
126
|
on_mouse_leave: Optional[
|
|
127
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
127
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
128
128
|
] = None,
|
|
129
129
|
on_mouse_move: Optional[
|
|
130
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
130
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
131
131
|
] = None,
|
|
132
132
|
on_mouse_out: Optional[
|
|
133
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
133
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
134
134
|
] = None,
|
|
135
135
|
on_mouse_over: Optional[
|
|
136
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
136
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
137
137
|
] = None,
|
|
138
138
|
on_mouse_up: Optional[
|
|
139
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
139
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
140
140
|
] = None,
|
|
141
141
|
on_scroll: Optional[
|
|
142
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
142
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
143
143
|
] = None,
|
|
144
144
|
on_unmount: Optional[
|
|
145
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
145
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
146
146
|
] = None,
|
|
147
147
|
**props,
|
|
148
148
|
) -> "RechartsCharts":
|
|
@@ -14,6 +14,7 @@ from reflex.event import (
|
|
|
14
14
|
EventSpec,
|
|
15
15
|
call_script,
|
|
16
16
|
)
|
|
17
|
+
from reflex.ivars.base import ImmutableVar, LiteralVar
|
|
17
18
|
from reflex.style import Style, resolved_color_mode
|
|
18
19
|
from reflex.utils import format
|
|
19
20
|
from reflex.utils.imports import ImportVar
|
|
@@ -29,7 +30,7 @@ LiteralPosition = Literal[
|
|
|
29
30
|
"bottom-right",
|
|
30
31
|
]
|
|
31
32
|
|
|
32
|
-
toast_ref =
|
|
33
|
+
toast_ref = ImmutableVar.create_safe("refs['__toast']")
|
|
33
34
|
|
|
34
35
|
|
|
35
36
|
class ToastAction(Base):
|
|
@@ -55,7 +56,7 @@ def serialize_action(action: ToastAction) -> dict:
|
|
|
55
56
|
}
|
|
56
57
|
|
|
57
58
|
|
|
58
|
-
def _toast_callback_signature(toast: Var) -> list[
|
|
59
|
+
def _toast_callback_signature(toast: Var) -> list[ImmutableVar]:
|
|
59
60
|
"""The signature for the toast callback, stripping out unserializable keys.
|
|
60
61
|
|
|
61
62
|
Args:
|
|
@@ -65,9 +66,8 @@ def _toast_callback_signature(toast: Var) -> list[Var]:
|
|
|
65
66
|
A function call stripping non-serializable members of the toast object.
|
|
66
67
|
"""
|
|
67
68
|
return [
|
|
68
|
-
|
|
69
|
-
f"(() => {{let {{action, cancel, onDismiss, onAutoClose, ...rest}} = {toast}; return rest}})()"
|
|
70
|
-
_var_is_string=False,
|
|
69
|
+
ImmutableVar.create_safe(
|
|
70
|
+
f"(() => {{let {{action, cancel, onDismiss, onAutoClose, ...rest}} = {str(toast)}; return rest}})()"
|
|
71
71
|
)
|
|
72
72
|
]
|
|
73
73
|
|
|
@@ -75,8 +75,11 @@ def _toast_callback_signature(toast: Var) -> list[Var]:
|
|
|
75
75
|
class ToastProps(PropsBase):
|
|
76
76
|
"""Props for the toast component."""
|
|
77
77
|
|
|
78
|
+
# Toast's title, renders above the description.
|
|
79
|
+
title: Optional[Union[str, ImmutableVar]]
|
|
80
|
+
|
|
78
81
|
# Toast's description, renders underneath the title.
|
|
79
|
-
description: Optional[Union[str,
|
|
82
|
+
description: Optional[Union[str, ImmutableVar]]
|
|
80
83
|
|
|
81
84
|
# Whether to show the close button.
|
|
82
85
|
close_button: Optional[bool]
|
|
@@ -108,7 +111,7 @@ class ToastProps(PropsBase):
|
|
|
108
111
|
cancel: Optional[ToastAction]
|
|
109
112
|
|
|
110
113
|
# Custom id for the toast.
|
|
111
|
-
id: Optional[Union[str,
|
|
114
|
+
id: Optional[Union[str, ImmutableVar]]
|
|
112
115
|
|
|
113
116
|
# Removes the default styling, which allows for easier customization.
|
|
114
117
|
unstyled: Optional[bool]
|
|
@@ -168,12 +171,12 @@ class ToastProps(PropsBase):
|
|
|
168
171
|
d["cancel"] = self.cancel
|
|
169
172
|
if isinstance(self.cancel, dict):
|
|
170
173
|
d["cancel"] = ToastAction(**self.cancel)
|
|
171
|
-
if "
|
|
172
|
-
d["
|
|
174
|
+
if "onDismiss" in d:
|
|
175
|
+
d["onDismiss"] = format.format_queue_events(
|
|
173
176
|
self.on_dismiss, _toast_callback_signature
|
|
174
177
|
)
|
|
175
|
-
if "
|
|
176
|
-
d["
|
|
178
|
+
if "onAutoClose" in d:
|
|
179
|
+
d["onAutoClose"] = format.format_queue_events(
|
|
177
180
|
self.on_auto_close, _toast_callback_signature
|
|
178
181
|
)
|
|
179
182
|
return d
|
|
@@ -197,21 +200,19 @@ class Toaster(Component):
|
|
|
197
200
|
theme: Var[str] = resolved_color_mode
|
|
198
201
|
|
|
199
202
|
# whether to show rich colors
|
|
200
|
-
rich_colors: Var[bool] =
|
|
203
|
+
rich_colors: Var[bool] = LiteralVar.create(True)
|
|
201
204
|
|
|
202
205
|
# whether to expand the toast
|
|
203
|
-
expand: Var[bool] =
|
|
206
|
+
expand: Var[bool] = LiteralVar.create(True)
|
|
204
207
|
|
|
205
208
|
# the number of toasts that are currently visible
|
|
206
209
|
visible_toasts: Var[int]
|
|
207
210
|
|
|
208
211
|
# the position of the toast
|
|
209
|
-
position: Var[LiteralPosition] =
|
|
210
|
-
"bottom-right", _var_is_string=True
|
|
211
|
-
)
|
|
212
|
+
position: Var[LiteralPosition] = LiteralVar.create("bottom-right")
|
|
212
213
|
|
|
213
214
|
# whether to show the close button
|
|
214
|
-
close_button: Var[bool] =
|
|
215
|
+
close_button: Var[bool] = LiteralVar.create(False)
|
|
215
216
|
|
|
216
217
|
# offset of the toast
|
|
217
218
|
offset: Var[str]
|
|
@@ -240,16 +241,14 @@ class Toaster(Component):
|
|
|
240
241
|
# Marked True when any Toast component is created.
|
|
241
242
|
is_used: ClassVar[bool] = False
|
|
242
243
|
|
|
243
|
-
def add_hooks(self) -> list[
|
|
244
|
+
def add_hooks(self) -> list[ImmutableVar | str]:
|
|
244
245
|
"""Add hooks for the toaster component.
|
|
245
246
|
|
|
246
247
|
Returns:
|
|
247
248
|
The hooks for the toaster component.
|
|
248
249
|
"""
|
|
249
|
-
hook =
|
|
250
|
+
hook = ImmutableVar.create_safe(
|
|
250
251
|
f"{toast_ref} = toast",
|
|
251
|
-
_var_is_local=True,
|
|
252
|
-
_var_is_string=False,
|
|
253
252
|
_var_data=VarData(
|
|
254
253
|
imports={
|
|
255
254
|
"/utils/state": [ImportVar(tag="refs")],
|
|
@@ -287,11 +286,11 @@ class Toaster(Component):
|
|
|
287
286
|
else:
|
|
288
287
|
toast = f"{toast_command}(`{message}`)"
|
|
289
288
|
|
|
290
|
-
toast_action =
|
|
289
|
+
toast_action = ImmutableVar.create_safe(toast)
|
|
291
290
|
return call_script(toast_action)
|
|
292
291
|
|
|
293
292
|
@staticmethod
|
|
294
|
-
def toast_info(message: str, **kwargs):
|
|
293
|
+
def toast_info(message: str = "", **kwargs):
|
|
295
294
|
"""Display an info toast message.
|
|
296
295
|
|
|
297
296
|
Args:
|
|
@@ -304,7 +303,7 @@ class Toaster(Component):
|
|
|
304
303
|
return Toaster.send_toast(message, level="info", **kwargs)
|
|
305
304
|
|
|
306
305
|
@staticmethod
|
|
307
|
-
def toast_warning(message: str, **kwargs):
|
|
306
|
+
def toast_warning(message: str = "", **kwargs):
|
|
308
307
|
"""Display a warning toast message.
|
|
309
308
|
|
|
310
309
|
Args:
|
|
@@ -317,7 +316,7 @@ class Toaster(Component):
|
|
|
317
316
|
return Toaster.send_toast(message, level="warning", **kwargs)
|
|
318
317
|
|
|
319
318
|
@staticmethod
|
|
320
|
-
def toast_error(message: str, **kwargs):
|
|
319
|
+
def toast_error(message: str = "", **kwargs):
|
|
321
320
|
"""Display an error toast message.
|
|
322
321
|
|
|
323
322
|
Args:
|
|
@@ -330,7 +329,7 @@ class Toaster(Component):
|
|
|
330
329
|
return Toaster.send_toast(message, level="error", **kwargs)
|
|
331
330
|
|
|
332
331
|
@staticmethod
|
|
333
|
-
def toast_success(message: str, **kwargs):
|
|
332
|
+
def toast_success(message: str = "", **kwargs):
|
|
334
333
|
"""Display a success toast message.
|
|
335
334
|
|
|
336
335
|
Args:
|
|
@@ -354,18 +353,16 @@ class Toaster(Component):
|
|
|
354
353
|
"""
|
|
355
354
|
dismiss_var_data = None
|
|
356
355
|
|
|
357
|
-
if isinstance(id,
|
|
358
|
-
dismiss = f"{toast_ref}.dismiss({id
|
|
359
|
-
dismiss_var_data = id.
|
|
356
|
+
if isinstance(id, ImmutableVar):
|
|
357
|
+
dismiss = f"{toast_ref}.dismiss({str(id)})"
|
|
358
|
+
dismiss_var_data = id._get_all_var_data()
|
|
360
359
|
elif isinstance(id, str):
|
|
361
360
|
dismiss = f"{toast_ref}.dismiss('{id}')"
|
|
362
361
|
else:
|
|
363
362
|
dismiss = f"{toast_ref}.dismiss()"
|
|
364
|
-
dismiss_action =
|
|
363
|
+
dismiss_action = ImmutableVar.create_safe(
|
|
365
364
|
dismiss,
|
|
366
|
-
|
|
367
|
-
_var_is_local=True,
|
|
368
|
-
_var_data=dismiss_var_data,
|
|
365
|
+
_var_data=VarData.merge(dismiss_var_data),
|
|
369
366
|
)
|
|
370
367
|
return call_script(dismiss_action)
|
|
371
368
|
|