reflex 0.7.1a4__py3-none-any.whl → 0.7.2a1__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/utils/context.js.jinja2 +8 -8
- reflex/.templates/web/components/reflex/radix_themes_color_mode_provider.js +3 -3
- reflex/admin.py +1 -2
- reflex/app.py +46 -49
- reflex/app_mixins/lifespan.py +2 -2
- reflex/app_mixins/middleware.py +1 -2
- reflex/assets.py +1 -2
- reflex/base.py +2 -2
- reflex/compiler/compiler.py +51 -16
- reflex/compiler/utils.py +4 -13
- reflex/components/base/app_wrap.pyi +7 -7
- reflex/components/base/bare.py +3 -3
- reflex/components/base/body.pyi +7 -7
- reflex/components/base/document.py +1 -3
- reflex/components/base/document.pyi +32 -32
- reflex/components/base/error_boundary.py +2 -4
- reflex/components/base/error_boundary.pyi +11 -13
- reflex/components/base/fragment.pyi +7 -7
- reflex/components/base/head.pyi +13 -13
- reflex/components/base/link.pyi +22 -22
- reflex/components/base/meta.py +5 -7
- reflex/components/base/meta.pyi +40 -40
- reflex/components/base/script.pyi +11 -14
- reflex/components/base/strict_mode.pyi +7 -7
- reflex/components/component.py +188 -113
- reflex/components/core/auto_scroll.py +8 -1
- reflex/components/core/auto_scroll.pyi +183 -210
- reflex/components/core/banner.py +2 -4
- reflex/components/core/banner.pyi +390 -444
- reflex/components/core/breakpoints.py +5 -5
- reflex/components/core/client_side_routing.pyi +14 -14
- reflex/components/core/clipboard.py +4 -4
- reflex/components/core/clipboard.pyi +12 -14
- reflex/components/core/cond.py +17 -25
- reflex/components/core/debounce.py +3 -3
- reflex/components/core/debounce.pyi +14 -14
- reflex/components/core/foreach.py +7 -2
- reflex/components/core/html.py +1 -3
- reflex/components/core/html.pyi +184 -213
- reflex/components/core/match.py +15 -19
- reflex/components/core/sticky.pyi +930 -1078
- reflex/components/core/upload.py +4 -4
- reflex/components/core/upload.pyi +62 -62
- reflex/components/datadisplay/code.py +6 -6
- reflex/components/datadisplay/code.pyi +1159 -1165
- reflex/components/datadisplay/dataeditor.py +49 -49
- reflex/components/datadisplay/dataeditor.pyi +95 -123
- reflex/components/datadisplay/logo.py +1 -3
- reflex/components/datadisplay/shiki_code_block.py +8 -10
- reflex/components/datadisplay/shiki_code_block.pyi +1678 -1720
- reflex/components/el/element.pyi +7 -7
- reflex/components/el/elements/base.pyi +183 -210
- reflex/components/el/elements/forms.py +23 -23
- reflex/components/el/elements/forms.pyi +2571 -2933
- reflex/components/el/elements/inline.py +4 -4
- reflex/components/el/elements/inline.pyi +5191 -5953
- reflex/components/el/elements/media.py +47 -47
- reflex/components/el/elements/media.pyi +4802 -5500
- reflex/components/el/elements/metadata.py +1 -3
- reflex/components/el/elements/metadata.pyi +782 -896
- reflex/components/el/elements/other.pyi +1278 -1467
- reflex/components/el/elements/scripts.pyi +580 -667
- reflex/components/el/elements/sectioning.pyi +2761 -3166
- reflex/components/el/elements/tables.pyi +1840 -2119
- reflex/components/el/elements/typography.pyi +2772 -3179
- reflex/components/gridjs/datatable.py +7 -7
- reflex/components/gridjs/datatable.pyi +19 -19
- reflex/components/lucide/icon.pyi +21 -21
- reflex/components/markdown/markdown.py +2 -2
- reflex/components/markdown/markdown.pyi +9 -9
- reflex/components/moment/moment.py +11 -12
- reflex/components/moment/moment.pyi +44 -47
- reflex/components/next/base.pyi +7 -7
- reflex/components/next/image.py +3 -3
- reflex/components/next/image.pyi +19 -21
- reflex/components/next/link.pyi +9 -9
- reflex/components/next/video.py +1 -3
- reflex/components/next/video.pyi +9 -9
- reflex/components/plotly/plotly.py +22 -45
- reflex/components/plotly/plotly.pyi +164 -164
- reflex/components/radix/primitives/accordion.py +14 -14
- reflex/components/radix/primitives/accordion.pyi +439 -487
- reflex/components/radix/primitives/base.py +1 -3
- reflex/components/radix/primitives/base.pyi +15 -15
- reflex/components/radix/primitives/drawer.py +3 -3
- reflex/components/radix/primitives/drawer.pyi +110 -116
- reflex/components/radix/primitives/form.py +1 -1
- reflex/components/radix/primitives/form.pyi +668 -752
- reflex/components/radix/primitives/progress.py +6 -6
- reflex/components/radix/primitives/progress.pyi +225 -243
- reflex/components/radix/primitives/slider.py +6 -6
- reflex/components/radix/primitives/slider.pyi +52 -55
- reflex/components/radix/themes/base.py +3 -6
- reflex/components/radix/themes/base.pyi +197 -303
- reflex/components/radix/themes/color_mode.py +5 -5
- reflex/components/radix/themes/color_mode.pyi +366 -436
- reflex/components/radix/themes/components/alert_dialog.pyi +229 -262
- reflex/components/radix/themes/components/aspect_ratio.py +1 -3
- reflex/components/radix/themes/components/aspect_ratio.pyi +8 -8
- reflex/components/radix/themes/components/avatar.pyi +79 -94
- reflex/components/radix/themes/components/badge.pyi +252 -295
- reflex/components/radix/themes/components/button.pyi +269 -314
- reflex/components/radix/themes/components/callout.py +2 -2
- reflex/components/radix/themes/components/callout.pyi +1116 -1290
- reflex/components/radix/themes/components/card.pyi +194 -229
- reflex/components/radix/themes/components/checkbox.pyi +243 -278
- reflex/components/radix/themes/components/checkbox_cards.py +3 -7
- reflex/components/radix/themes/components/checkbox_cards.pyi +101 -135
- reflex/components/radix/themes/components/checkbox_group.py +2 -2
- reflex/components/radix/themes/components/checkbox_group.pyi +83 -96
- reflex/components/radix/themes/components/context_menu.py +18 -15
- reflex/components/radix/themes/components/context_menu.pyi +408 -458
- reflex/components/radix/themes/components/data_list.pyi +122 -147
- reflex/components/radix/themes/components/dialog.pyi +231 -264
- reflex/components/radix/themes/components/dropdown_menu.py +16 -13
- reflex/components/radix/themes/components/dropdown_menu.pyi +223 -246
- reflex/components/radix/themes/components/hover_card.py +2 -2
- reflex/components/radix/themes/components/hover_card.pyi +237 -282
- reflex/components/radix/themes/components/icon_button.pyi +269 -314
- reflex/components/radix/themes/components/inset.py +8 -8
- reflex/components/radix/themes/components/inset.pyi +232 -292
- reflex/components/radix/themes/components/popover.py +2 -2
- reflex/components/radix/themes/components/popover.pyi +229 -271
- reflex/components/radix/themes/components/progress.pyi +80 -96
- reflex/components/radix/themes/components/radio.pyi +73 -86
- reflex/components/radix/themes/components/radio_cards.py +4 -8
- reflex/components/radix/themes/components/radio_cards.pyi +117 -154
- reflex/components/radix/themes/components/radio_group.py +3 -3
- reflex/components/radix/themes/components/radio_group.pyi +250 -291
- reflex/components/radix/themes/components/scroll_area.pyi +14 -20
- reflex/components/radix/themes/components/segmented_control.py +6 -6
- reflex/components/radix/themes/components/segmented_control.pyi +89 -108
- reflex/components/radix/themes/components/select.py +7 -7
- reflex/components/radix/themes/components/select.pyi +376 -444
- reflex/components/radix/themes/components/separator.pyi +79 -93
- reflex/components/radix/themes/components/skeleton.pyi +32 -26
- reflex/components/radix/themes/components/slider.py +8 -8
- reflex/components/radix/themes/components/slider.pyi +99 -122
- reflex/components/radix/themes/components/spinner.pyi +12 -19
- reflex/components/radix/themes/components/switch.pyi +84 -99
- reflex/components/radix/themes/components/table.py +9 -9
- reflex/components/radix/themes/components/table.pyi +1440 -1794
- reflex/components/radix/themes/components/tabs.py +4 -4
- reflex/components/radix/themes/components/tabs.pyi +120 -132
- reflex/components/radix/themes/components/text_area.pyi +281 -331
- reflex/components/radix/themes/components/text_field.py +2 -2
- reflex/components/radix/themes/components/text_field.pyi +639 -734
- reflex/components/radix/themes/components/tooltip.py +6 -6
- reflex/components/radix/themes/components/tooltip.pyi +34 -43
- reflex/components/radix/themes/layout/base.pyi +85 -182
- reflex/components/radix/themes/layout/box.pyi +183 -210
- reflex/components/radix/themes/layout/center.pyi +225 -286
- reflex/components/radix/themes/layout/container.pyi +191 -224
- reflex/components/radix/themes/layout/flex.py +2 -2
- reflex/components/radix/themes/layout/flex.pyi +225 -286
- reflex/components/radix/themes/layout/grid.py +2 -2
- reflex/components/radix/themes/layout/grid.pyi +245 -315
- reflex/components/radix/themes/layout/list.py +2 -2
- reflex/components/radix/themes/layout/list.pyi +712 -815
- reflex/components/radix/themes/layout/section.pyi +187 -221
- reflex/components/radix/themes/layout/spacer.pyi +225 -286
- reflex/components/radix/themes/layout/stack.pyi +625 -768
- reflex/components/radix/themes/typography/blockquote.pyi +257 -299
- reflex/components/radix/themes/typography/code.pyi +259 -304
- reflex/components/radix/themes/typography/heading.pyi +272 -324
- reflex/components/radix/themes/typography/link.pyi +302 -358
- reflex/components/radix/themes/typography/text.pyi +1669 -1945
- reflex/components/react_player/audio.pyi +20 -22
- reflex/components/react_player/react_player.pyi +19 -19
- reflex/components/react_player/video.pyi +20 -22
- reflex/components/recharts/cartesian.py +100 -97
- reflex/components/recharts/cartesian.pyi +891 -1007
- reflex/components/recharts/charts.py +42 -42
- reflex/components/recharts/charts.pyi +212 -249
- reflex/components/recharts/general.py +22 -21
- reflex/components/recharts/general.pyi +198 -223
- reflex/components/recharts/polar.py +42 -45
- reflex/components/recharts/polar.pyi +254 -288
- reflex/components/recharts/recharts.pyi +13 -13
- reflex/components/sonner/toast.py +20 -20
- reflex/components/sonner/toast.pyi +58 -61
- reflex/components/suneditor/editor.py +9 -9
- reflex/components/suneditor/editor.pyi +78 -83
- reflex/components/tags/cond_tag.py +2 -2
- reflex/components/tags/iter_tag.py +10 -14
- reflex/components/tags/match_tag.py +2 -2
- reflex/components/tags/tag.py +10 -10
- reflex/config.py +36 -35
- reflex/constants/__init__.py +56 -53
- reflex/custom_components/custom_components.py +6 -7
- reflex/event.py +38 -42
- reflex/experimental/client_state.py +2 -4
- reflex/experimental/layout.py +2 -2
- reflex/experimental/layout.pyi +579 -663
- reflex/istate/data.py +4 -5
- reflex/middleware/hydrate_middleware.py +2 -2
- reflex/middleware/middleware.py +2 -2
- reflex/model.py +3 -5
- reflex/page.py +2 -2
- reflex/reflex.py +9 -10
- reflex/state.py +77 -49
- reflex/style.py +9 -3
- reflex/testing.py +21 -24
- reflex/utils/console.py +1 -1
- reflex/utils/decorator.py +26 -1
- reflex/utils/exec.py +6 -11
- reflex/utils/export.py +2 -3
- reflex/utils/format.py +4 -4
- reflex/utils/imports.py +12 -12
- reflex/utils/prerequisites.py +35 -84
- reflex/utils/processes.py +5 -5
- reflex/utils/pyi_generator.py +33 -22
- reflex/utils/serializers.py +60 -15
- reflex/utils/types.py +237 -56
- reflex/vars/base.py +122 -72
- reflex/vars/datetime.py +2 -2
- reflex/vars/function.py +52 -55
- reflex/vars/number.py +59 -5
- reflex/vars/object.py +57 -26
- reflex/vars/sequence.py +983 -958
- {reflex-0.7.1a4.dist-info → reflex-0.7.2a1.dist-info}/METADATA +3 -6
- reflex-0.7.2a1.dist-info/RECORD +405 -0
- {reflex-0.7.1a4.dist-info → reflex-0.7.2a1.dist-info}/WHEEL +1 -1
- reflex-0.7.1a4.dist-info/RECORD +0 -405
- {reflex-0.7.1a4.dist-info → reflex-0.7.2a1.dist-info}/LICENSE +0 -0
- {reflex-0.7.1a4.dist-info → reflex-0.7.2a1.dist-info}/entry_points.txt +0 -0
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
# ------------------- DO NOT EDIT ----------------------
|
|
4
4
|
# This file was generated by `reflex/utils/pyi_generator.py`!
|
|
5
5
|
# ------------------------------------------------------
|
|
6
|
-
from typing import Any,
|
|
6
|
+
from typing import Any, Literal, Optional, overload
|
|
7
7
|
|
|
8
8
|
from reflex.components.component import Component, MemoizationLeaf, NoSSRComponent
|
|
9
9
|
from reflex.event import EventType
|
|
@@ -16,12 +16,12 @@ class Recharts(Component):
|
|
|
16
16
|
def create( # type: ignore
|
|
17
17
|
cls,
|
|
18
18
|
*children,
|
|
19
|
-
style:
|
|
20
|
-
key:
|
|
21
|
-
id:
|
|
22
|
-
class_name:
|
|
23
|
-
autofocus:
|
|
24
|
-
custom_attrs:
|
|
19
|
+
style: Style | None = None,
|
|
20
|
+
key: Any | None = None,
|
|
21
|
+
id: Any | None = None,
|
|
22
|
+
class_name: Any | None = None,
|
|
23
|
+
autofocus: bool | None = None,
|
|
24
|
+
custom_attrs: dict[str, Var | Any] | None = None,
|
|
25
25
|
on_blur: Optional[EventType[()]] = None,
|
|
26
26
|
on_click: Optional[EventType[()]] = None,
|
|
27
27
|
on_context_menu: Optional[EventType[()]] = None,
|
|
@@ -62,12 +62,12 @@ class RechartsCharts(NoSSRComponent, MemoizationLeaf):
|
|
|
62
62
|
def create( # type: ignore
|
|
63
63
|
cls,
|
|
64
64
|
*children,
|
|
65
|
-
style:
|
|
66
|
-
key:
|
|
67
|
-
id:
|
|
68
|
-
class_name:
|
|
69
|
-
autofocus:
|
|
70
|
-
custom_attrs:
|
|
65
|
+
style: Style | None = None,
|
|
66
|
+
key: Any | None = None,
|
|
67
|
+
id: Any | None = None,
|
|
68
|
+
class_name: Any | None = None,
|
|
69
|
+
autofocus: bool | None = None,
|
|
70
|
+
custom_attrs: dict[str, Var | Any] | None = None,
|
|
71
71
|
on_blur: Optional[EventType[()]] = None,
|
|
72
72
|
on_click: Optional[EventType[()]] = None,
|
|
73
73
|
on_context_menu: Optional[EventType[()]] = None,
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
-
from typing import Any, Literal
|
|
5
|
+
from typing import Any, Literal
|
|
6
6
|
|
|
7
7
|
from reflex.base import Base
|
|
8
8
|
from reflex.components.component import Component, ComponentNamespace
|
|
@@ -78,64 +78,64 @@ class ToastProps(PropsBase, NoExtrasAllowedProps):
|
|
|
78
78
|
"""Props for the toast component."""
|
|
79
79
|
|
|
80
80
|
# Toast's title, renders above the description.
|
|
81
|
-
title:
|
|
81
|
+
title: str | Var | None
|
|
82
82
|
|
|
83
83
|
# Toast's description, renders underneath the title.
|
|
84
|
-
description:
|
|
84
|
+
description: str | Var | None
|
|
85
85
|
|
|
86
86
|
# Whether to show the close button.
|
|
87
|
-
close_button:
|
|
87
|
+
close_button: bool | None
|
|
88
88
|
|
|
89
89
|
# Dark toast in light mode and vice versa.
|
|
90
|
-
invert:
|
|
90
|
+
invert: bool | None
|
|
91
91
|
|
|
92
92
|
# Control the sensitivity of the toast for screen readers
|
|
93
|
-
important:
|
|
93
|
+
important: bool | None
|
|
94
94
|
|
|
95
95
|
# Time in milliseconds that should elapse before automatically closing the toast.
|
|
96
|
-
duration:
|
|
96
|
+
duration: int | None
|
|
97
97
|
|
|
98
98
|
# Position of the toast.
|
|
99
|
-
position:
|
|
99
|
+
position: LiteralPosition | None
|
|
100
100
|
|
|
101
101
|
# If false, it'll prevent the user from dismissing the toast.
|
|
102
|
-
dismissible:
|
|
102
|
+
dismissible: bool | None
|
|
103
103
|
|
|
104
104
|
# TODO: fix serialization of icons for toast? (might not be possible yet)
|
|
105
105
|
# Icon displayed in front of toast's text, aligned vertically.
|
|
106
|
-
# icon:
|
|
106
|
+
# icon: Icon | None = None # noqa: ERA001
|
|
107
107
|
|
|
108
108
|
# TODO: fix implementation for action / cancel buttons
|
|
109
109
|
# Renders a primary button, clicking it will close the toast.
|
|
110
|
-
action:
|
|
110
|
+
action: ToastAction | None
|
|
111
111
|
|
|
112
112
|
# Renders a secondary button, clicking it will close the toast.
|
|
113
|
-
cancel:
|
|
113
|
+
cancel: ToastAction | None
|
|
114
114
|
|
|
115
115
|
# Custom id for the toast.
|
|
116
|
-
id:
|
|
116
|
+
id: str | Var | None
|
|
117
117
|
|
|
118
118
|
# Removes the default styling, which allows for easier customization.
|
|
119
|
-
unstyled:
|
|
119
|
+
unstyled: bool | None
|
|
120
120
|
|
|
121
121
|
# Custom style for the toast.
|
|
122
|
-
style:
|
|
122
|
+
style: Style | None
|
|
123
123
|
|
|
124
124
|
# Class name for the toast.
|
|
125
|
-
class_name:
|
|
125
|
+
class_name: str | None
|
|
126
126
|
|
|
127
127
|
# XXX: These still do not seem to work
|
|
128
128
|
# Custom style for the toast primary button.
|
|
129
|
-
action_button_styles:
|
|
129
|
+
action_button_styles: Style | None
|
|
130
130
|
|
|
131
131
|
# Custom style for the toast secondary button.
|
|
132
|
-
cancel_button_styles:
|
|
132
|
+
cancel_button_styles: Style | None
|
|
133
133
|
|
|
134
134
|
# The function gets called when either the close button is clicked, or the toast is swiped.
|
|
135
|
-
on_dismiss:
|
|
135
|
+
on_dismiss: Any | None
|
|
136
136
|
|
|
137
137
|
# Function that gets called when the toast disappears automatically after it's timeout (duration` prop).
|
|
138
|
-
on_auto_close:
|
|
138
|
+
on_auto_close: Any | None
|
|
139
139
|
|
|
140
140
|
def dict(self, *args: Any, **kwargs: Any) -> dict[str, Any]:
|
|
141
141
|
"""Convert the object to a dictionary.
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
# ------------------- DO NOT EDIT ----------------------
|
|
4
4
|
# This file was generated by `reflex/utils/pyi_generator.py`!
|
|
5
5
|
# ------------------------------------------------------
|
|
6
|
-
from typing import Any,
|
|
6
|
+
from typing import Any, Literal, Optional, overload
|
|
7
7
|
|
|
8
8
|
from reflex.base import Base
|
|
9
9
|
from reflex.components.component import Component, ComponentNamespace
|
|
@@ -38,24 +38,24 @@ class ToastAction(Base):
|
|
|
38
38
|
def serialize_action(action: ToastAction) -> dict: ...
|
|
39
39
|
|
|
40
40
|
class ToastProps(PropsBase, NoExtrasAllowedProps):
|
|
41
|
-
title:
|
|
42
|
-
description:
|
|
43
|
-
close_button:
|
|
44
|
-
invert:
|
|
45
|
-
important:
|
|
46
|
-
duration:
|
|
47
|
-
position:
|
|
48
|
-
dismissible:
|
|
49
|
-
action:
|
|
50
|
-
cancel:
|
|
51
|
-
id:
|
|
52
|
-
unstyled:
|
|
53
|
-
style:
|
|
54
|
-
class_name:
|
|
55
|
-
action_button_styles:
|
|
56
|
-
cancel_button_styles:
|
|
57
|
-
on_dismiss:
|
|
58
|
-
on_auto_close:
|
|
41
|
+
title: str | Var | None
|
|
42
|
+
description: str | Var | None
|
|
43
|
+
close_button: bool | None
|
|
44
|
+
invert: bool | None
|
|
45
|
+
important: bool | None
|
|
46
|
+
duration: int | None
|
|
47
|
+
position: LiteralPosition | None
|
|
48
|
+
dismissible: bool | None
|
|
49
|
+
action: ToastAction | None
|
|
50
|
+
cancel: ToastAction | None
|
|
51
|
+
id: str | Var | None
|
|
52
|
+
unstyled: bool | None
|
|
53
|
+
style: Style | None
|
|
54
|
+
class_name: str | None
|
|
55
|
+
action_button_styles: Style | None
|
|
56
|
+
cancel_button_styles: Style | None
|
|
57
|
+
on_dismiss: Any | None
|
|
58
|
+
on_auto_close: Any | None
|
|
59
59
|
|
|
60
60
|
def dict(self, *args: Any, **kwargs: Any) -> dict[str, Any]: ...
|
|
61
61
|
|
|
@@ -85,47 +85,44 @@ class Toaster(Component):
|
|
|
85
85
|
def create( # type: ignore
|
|
86
86
|
cls,
|
|
87
87
|
*children,
|
|
88
|
-
theme:
|
|
89
|
-
rich_colors:
|
|
90
|
-
expand:
|
|
91
|
-
visible_toasts:
|
|
92
|
-
position:
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
"top-left",
|
|
109
|
-
"top-right",
|
|
110
|
-
]
|
|
111
|
-
],
|
|
88
|
+
theme: Var[str] | str | None = None,
|
|
89
|
+
rich_colors: Var[bool] | bool | None = None,
|
|
90
|
+
expand: Var[bool] | bool | None = None,
|
|
91
|
+
visible_toasts: Var[int] | int | None = None,
|
|
92
|
+
position: Literal[
|
|
93
|
+
"bottom-center",
|
|
94
|
+
"bottom-left",
|
|
95
|
+
"bottom-right",
|
|
96
|
+
"top-center",
|
|
97
|
+
"top-left",
|
|
98
|
+
"top-right",
|
|
99
|
+
]
|
|
100
|
+
| Var[
|
|
101
|
+
Literal[
|
|
102
|
+
"bottom-center",
|
|
103
|
+
"bottom-left",
|
|
104
|
+
"bottom-right",
|
|
105
|
+
"top-center",
|
|
106
|
+
"top-left",
|
|
107
|
+
"top-right",
|
|
112
108
|
]
|
|
113
|
-
]
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
109
|
+
]
|
|
110
|
+
| None = None,
|
|
111
|
+
close_button: Var[bool] | bool | None = None,
|
|
112
|
+
offset: Var[str] | str | None = None,
|
|
113
|
+
dir: Var[str] | str | None = None,
|
|
114
|
+
hotkey: Var[str] | str | None = None,
|
|
115
|
+
invert: Var[bool] | bool | None = None,
|
|
116
|
+
toast_options: ToastProps | Var[ToastProps] | None = None,
|
|
117
|
+
gap: Var[int] | int | None = None,
|
|
118
|
+
loading_icon: Icon | Var[Icon] | None = None,
|
|
119
|
+
pause_when_page_is_hidden: Var[bool] | bool | None = None,
|
|
120
|
+
style: Style | None = None,
|
|
121
|
+
key: Any | None = None,
|
|
122
|
+
id: Any | None = None,
|
|
123
|
+
class_name: Any | None = None,
|
|
124
|
+
autofocus: bool | None = None,
|
|
125
|
+
custom_attrs: dict[str, Var | Any] | None = None,
|
|
129
126
|
on_blur: Optional[EventType[()]] = None,
|
|
130
127
|
on_click: Optional[EventType[()]] = None,
|
|
131
128
|
on_context_menu: Optional[EventType[()]] = None,
|
|
@@ -186,8 +183,8 @@ class ToastNamespace(ComponentNamespace):
|
|
|
186
183
|
|
|
187
184
|
@staticmethod
|
|
188
185
|
def __call__(
|
|
189
|
-
message:
|
|
190
|
-
level:
|
|
186
|
+
message: str | Var = "",
|
|
187
|
+
level: str | None = None,
|
|
191
188
|
fallback_to_alert: bool = False,
|
|
192
189
|
**props,
|
|
193
190
|
) -> "EventSpec":
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
5
|
import enum
|
|
6
|
-
from typing import Any, Dict,
|
|
6
|
+
from typing import Any, Dict, Literal, Union
|
|
7
7
|
|
|
8
8
|
from reflex.base import Base
|
|
9
9
|
from reflex.components.component import Component, NoSSRComponent
|
|
@@ -54,21 +54,21 @@ class EditorOptions(Base):
|
|
|
54
54
|
|
|
55
55
|
# Specifies default tag name of the editor.
|
|
56
56
|
# default: 'p' {String}
|
|
57
|
-
default_tag:
|
|
57
|
+
default_tag: str | None = None
|
|
58
58
|
|
|
59
59
|
# The mode of the editor ('classic', 'inline', 'balloon', 'balloon-always').
|
|
60
60
|
# default: 'classic' {String}
|
|
61
|
-
mode:
|
|
61
|
+
mode: str | None = None
|
|
62
62
|
|
|
63
63
|
# If true, the editor is set to RTL(Right To Left) mode.
|
|
64
64
|
# default: false {Boolean}
|
|
65
|
-
rtl:
|
|
65
|
+
rtl: bool | None = None
|
|
66
66
|
|
|
67
67
|
# List of buttons to use in the toolbar.
|
|
68
|
-
button_list:
|
|
68
|
+
button_list: list[list[str] | str] | None
|
|
69
69
|
|
|
70
70
|
|
|
71
|
-
def on_blur_spec(e: Var, content: Var[str]) ->
|
|
71
|
+
def on_blur_spec(e: Var, content: Var[str]) -> tuple[Var[str]]:
|
|
72
72
|
"""A helper function to specify the on_blur event handler.
|
|
73
73
|
|
|
74
74
|
Args:
|
|
@@ -83,7 +83,7 @@ def on_blur_spec(e: Var, content: Var[str]) -> Tuple[Var[str]]:
|
|
|
83
83
|
|
|
84
84
|
def on_paste_spec(
|
|
85
85
|
e: Var, clean_data: Var[str], max_char_count: Var[bool]
|
|
86
|
-
) ->
|
|
86
|
+
) -> tuple[Var[str], Var[bool]]:
|
|
87
87
|
"""A helper function to specify the on_paste event handler.
|
|
88
88
|
|
|
89
89
|
Args:
|
|
@@ -109,7 +109,7 @@ class Editor(NoSSRComponent):
|
|
|
109
109
|
|
|
110
110
|
is_default = True
|
|
111
111
|
|
|
112
|
-
lib_dependencies:
|
|
112
|
+
lib_dependencies: list[str] = ["suneditor"]
|
|
113
113
|
|
|
114
114
|
# Language of the editor.
|
|
115
115
|
# Alternatively to a string, a dict of your language can be passed to this prop.
|
|
@@ -245,7 +245,7 @@ class Editor(NoSSRComponent):
|
|
|
245
245
|
|
|
246
246
|
@classmethod
|
|
247
247
|
def create(
|
|
248
|
-
cls, set_options:
|
|
248
|
+
cls, set_options: EditorOptions | None = None, **props: Any
|
|
249
249
|
) -> Component:
|
|
250
250
|
"""Create an instance of Editor. No children allowed.
|
|
251
251
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
# This file was generated by `reflex/utils/pyi_generator.py`!
|
|
5
5
|
# ------------------------------------------------------
|
|
6
6
|
import enum
|
|
7
|
-
from typing import Any, Dict,
|
|
7
|
+
from typing import Any, Dict, Literal, Optional, overload
|
|
8
8
|
|
|
9
9
|
from reflex.base import Base
|
|
10
10
|
from reflex.components.component import NoSSRComponent
|
|
@@ -39,15 +39,15 @@ class EditorButtonList(list, enum.Enum):
|
|
|
39
39
|
]
|
|
40
40
|
|
|
41
41
|
class EditorOptions(Base):
|
|
42
|
-
default_tag:
|
|
43
|
-
mode:
|
|
44
|
-
rtl:
|
|
45
|
-
button_list:
|
|
42
|
+
default_tag: str | None
|
|
43
|
+
mode: str | None
|
|
44
|
+
rtl: bool | None
|
|
45
|
+
button_list: list[list[str] | str] | None
|
|
46
46
|
|
|
47
|
-
def on_blur_spec(e: Var, content: Var[str]) ->
|
|
47
|
+
def on_blur_spec(e: Var, content: Var[str]) -> tuple[Var[str]]: ...
|
|
48
48
|
def on_paste_spec(
|
|
49
49
|
e: Var, clean_data: Var[str], max_char_count: Var[bool]
|
|
50
|
-
) ->
|
|
50
|
+
) -> tuple[Var[str], Var[bool]]: ...
|
|
51
51
|
|
|
52
52
|
class Editor(NoSSRComponent):
|
|
53
53
|
def add_imports(self) -> ImportDict: ...
|
|
@@ -56,79 +56,74 @@ class Editor(NoSSRComponent):
|
|
|
56
56
|
def create( # type: ignore
|
|
57
57
|
cls,
|
|
58
58
|
*children,
|
|
59
|
-
lang:
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
"se",
|
|
100
|
-
"ua",
|
|
101
|
-
"zh_cn",
|
|
102
|
-
],
|
|
103
|
-
dict,
|
|
104
|
-
]
|
|
105
|
-
],
|
|
106
|
-
dict,
|
|
59
|
+
lang: Literal[
|
|
60
|
+
"ckb",
|
|
61
|
+
"da",
|
|
62
|
+
"de",
|
|
63
|
+
"en",
|
|
64
|
+
"es",
|
|
65
|
+
"fr",
|
|
66
|
+
"he",
|
|
67
|
+
"it",
|
|
68
|
+
"ja",
|
|
69
|
+
"ko",
|
|
70
|
+
"lv",
|
|
71
|
+
"pl",
|
|
72
|
+
"pt_br",
|
|
73
|
+
"ro",
|
|
74
|
+
"ru",
|
|
75
|
+
"se",
|
|
76
|
+
"ua",
|
|
77
|
+
"zh_cn",
|
|
78
|
+
]
|
|
79
|
+
| Var[
|
|
80
|
+
Literal[
|
|
81
|
+
"ckb",
|
|
82
|
+
"da",
|
|
83
|
+
"de",
|
|
84
|
+
"en",
|
|
85
|
+
"es",
|
|
86
|
+
"fr",
|
|
87
|
+
"he",
|
|
88
|
+
"it",
|
|
89
|
+
"ja",
|
|
90
|
+
"ko",
|
|
91
|
+
"lv",
|
|
92
|
+
"pl",
|
|
93
|
+
"pt_br",
|
|
94
|
+
"ro",
|
|
95
|
+
"ru",
|
|
96
|
+
"se",
|
|
97
|
+
"ua",
|
|
98
|
+
"zh_cn",
|
|
107
99
|
]
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
100
|
+
| dict
|
|
101
|
+
]
|
|
102
|
+
| dict
|
|
103
|
+
| None = None,
|
|
104
|
+
name: Var[str] | str | None = None,
|
|
105
|
+
default_value: Var[str] | str | None = None,
|
|
106
|
+
width: Var[str] | str | None = None,
|
|
107
|
+
height: Var[str] | str | None = None,
|
|
108
|
+
placeholder: Var[str] | str | None = None,
|
|
109
|
+
auto_focus: Var[bool] | bool | None = None,
|
|
110
|
+
set_options: Dict | Var[Dict] | None = None,
|
|
111
|
+
set_all_plugins: Var[bool] | bool | None = None,
|
|
112
|
+
set_contents: Var[str] | str | None = None,
|
|
113
|
+
append_contents: Var[str] | str | None = None,
|
|
114
|
+
set_default_style: Var[str] | str | None = None,
|
|
115
|
+
disable: Var[bool] | bool | None = None,
|
|
116
|
+
hide: Var[bool] | bool | None = None,
|
|
117
|
+
hide_toolbar: Var[bool] | bool | None = None,
|
|
118
|
+
disable_toolbar: Var[bool] | bool | None = None,
|
|
119
|
+
style: Style | None = None,
|
|
120
|
+
key: Any | None = None,
|
|
121
|
+
id: Any | None = None,
|
|
122
|
+
class_name: Any | None = None,
|
|
123
|
+
autofocus: bool | None = None,
|
|
124
|
+
custom_attrs: dict[str, Var | Any] | None = None,
|
|
125
|
+
on_blur: Optional[EventType[()] | EventType[str]] = None,
|
|
126
|
+
on_change: Optional[EventType[()] | EventType[str]] = None,
|
|
132
127
|
on_click: Optional[EventType[()]] = None,
|
|
133
128
|
on_context_menu: Optional[EventType[()]] = None,
|
|
134
129
|
on_copy: Optional[EventType[()]] = None,
|
|
@@ -136,7 +131,7 @@ class Editor(NoSSRComponent):
|
|
|
136
131
|
on_double_click: Optional[EventType[()]] = None,
|
|
137
132
|
on_focus: Optional[EventType[()]] = None,
|
|
138
133
|
on_input: Optional[EventType[()]] = None,
|
|
139
|
-
on_load: Optional[
|
|
134
|
+
on_load: Optional[EventType[()] | EventType[bool]] = None,
|
|
140
135
|
on_mount: Optional[EventType[()]] = None,
|
|
141
136
|
on_mouse_down: Optional[EventType[()]] = None,
|
|
142
137
|
on_mouse_enter: Optional[EventType[()]] = None,
|
|
@@ -146,12 +141,12 @@ class Editor(NoSSRComponent):
|
|
|
146
141
|
on_mouse_over: Optional[EventType[()]] = None,
|
|
147
142
|
on_mouse_up: Optional[EventType[()]] = None,
|
|
148
143
|
on_paste: Optional[
|
|
149
|
-
|
|
144
|
+
EventType[()] | EventType[str] | EventType[str, bool]
|
|
150
145
|
] = None,
|
|
151
146
|
on_scroll: Optional[EventType[()]] = None,
|
|
152
147
|
on_unmount: Optional[EventType[()]] = None,
|
|
153
|
-
toggle_code_view: Optional[
|
|
154
|
-
toggle_full_screen: Optional[
|
|
148
|
+
toggle_code_view: Optional[EventType[()] | EventType[bool]] = None,
|
|
149
|
+
toggle_full_screen: Optional[EventType[()] | EventType[bool]] = None,
|
|
155
150
|
**props,
|
|
156
151
|
) -> "Editor":
|
|
157
152
|
"""Create an instance of Editor. No children allowed.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"""Tag to conditionally render components."""
|
|
2
2
|
|
|
3
3
|
import dataclasses
|
|
4
|
-
from typing import Any, Dict
|
|
4
|
+
from typing import Any, Dict
|
|
5
5
|
|
|
6
6
|
from reflex.components.tags.tag import Tag
|
|
7
7
|
from reflex.vars.base import Var
|
|
@@ -18,4 +18,4 @@ class CondTag(Tag):
|
|
|
18
18
|
true_value: Dict = dataclasses.field(default_factory=dict)
|
|
19
19
|
|
|
20
20
|
# The code to render if the condition is false.
|
|
21
|
-
false_value:
|
|
21
|
+
false_value: Dict | None = None
|
|
@@ -4,10 +4,12 @@ from __future__ import annotations
|
|
|
4
4
|
|
|
5
5
|
import dataclasses
|
|
6
6
|
import inspect
|
|
7
|
-
from typing import TYPE_CHECKING,
|
|
7
|
+
from typing import TYPE_CHECKING, Callable, Iterable
|
|
8
8
|
|
|
9
9
|
from reflex.components.tags.tag import Tag
|
|
10
|
+
from reflex.utils.types import GenericType
|
|
10
11
|
from reflex.vars import LiteralArrayVar, Var, get_unique_variable_name
|
|
12
|
+
from reflex.vars.sequence import _determine_value_of_array_index
|
|
11
13
|
|
|
12
14
|
if TYPE_CHECKING:
|
|
13
15
|
from reflex.components.component import Component
|
|
@@ -31,24 +33,13 @@ class IterTag(Tag):
|
|
|
31
33
|
# The name of the index var.
|
|
32
34
|
index_var_name: str = dataclasses.field(default_factory=get_unique_variable_name)
|
|
33
35
|
|
|
34
|
-
def get_iterable_var_type(self) ->
|
|
36
|
+
def get_iterable_var_type(self) -> GenericType:
|
|
35
37
|
"""Get the type of the iterable var.
|
|
36
38
|
|
|
37
39
|
Returns:
|
|
38
40
|
The type of the iterable var.
|
|
39
41
|
"""
|
|
40
|
-
|
|
41
|
-
try:
|
|
42
|
-
if iterable._var_type.mro()[0] is dict:
|
|
43
|
-
# Arg is a tuple of (key, value).
|
|
44
|
-
return Tuple[get_args(iterable._var_type)] # pyright: ignore [reportReturnType]
|
|
45
|
-
elif iterable._var_type.mro()[0] is tuple:
|
|
46
|
-
# Arg is a union of any possible values in the tuple.
|
|
47
|
-
return Union[get_args(iterable._var_type)] # pyright: ignore [reportReturnType]
|
|
48
|
-
else:
|
|
49
|
-
return get_args(iterable._var_type)[0]
|
|
50
|
-
except Exception:
|
|
51
|
-
return Any # pyright: ignore [reportReturnType]
|
|
42
|
+
return _determine_value_of_array_index(self.iterable._var_type)
|
|
52
43
|
|
|
53
44
|
def get_index_var(self) -> Var:
|
|
54
45
|
"""Get the index var for the tag (with curly braces).
|
|
@@ -107,12 +98,14 @@ class IterTag(Tag):
|
|
|
107
98
|
|
|
108
99
|
Raises:
|
|
109
100
|
ValueError: If the render function takes more than 2 arguments.
|
|
101
|
+
ValueError: If the render function doesn't return a component.
|
|
110
102
|
|
|
111
103
|
Returns:
|
|
112
104
|
The rendered component.
|
|
113
105
|
"""
|
|
114
106
|
# Import here to avoid circular imports.
|
|
115
107
|
from reflex.components.base.fragment import Fragment
|
|
108
|
+
from reflex.components.component import Component
|
|
116
109
|
from reflex.components.core.cond import Cond
|
|
117
110
|
from reflex.components.core.foreach import Foreach
|
|
118
111
|
|
|
@@ -138,6 +131,9 @@ class IterTag(Tag):
|
|
|
138
131
|
if isinstance(component, tuple):
|
|
139
132
|
component = Fragment.create(*component)
|
|
140
133
|
|
|
134
|
+
if not isinstance(component, Component):
|
|
135
|
+
raise ValueError("The render function must return a component.")
|
|
136
|
+
|
|
141
137
|
# Set the component key.
|
|
142
138
|
if component.key is None:
|
|
143
139
|
component.key = index
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"""Tag to conditionally match cases."""
|
|
2
2
|
|
|
3
3
|
import dataclasses
|
|
4
|
-
from typing import Any
|
|
4
|
+
from typing import Any
|
|
5
5
|
|
|
6
6
|
from reflex.components.tags.tag import Tag
|
|
7
7
|
from reflex.vars.base import Var
|
|
@@ -15,7 +15,7 @@ class MatchTag(Tag):
|
|
|
15
15
|
cond: Var[Any] = dataclasses.field(default_factory=lambda: Var.create(True))
|
|
16
16
|
|
|
17
17
|
# The list of match cases to be matched.
|
|
18
|
-
match_cases:
|
|
18
|
+
match_cases: list[Any] = dataclasses.field(default_factory=list)
|
|
19
19
|
|
|
20
20
|
# The catchall case to match.
|
|
21
21
|
default: Any = dataclasses.field(default=Var.create(None))
|