reflex 0.6.0__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/custom_components/pyproject.toml.jinja2 +2 -2
- reflex/.templates/jinja/web/pages/_app.js.jinja2 +1 -1
- reflex/.templates/jinja/web/pages/utils.js.jinja2 +2 -2
- reflex/.templates/web/components/reflex/chakra_color_mode_provider.js +36 -0
- reflex/.templates/web/utils/state.js +1 -3
- reflex/__init__.py +2 -8
- reflex/__init__.pyi +1 -2
- reflex/app.py +2 -4
- reflex/app_module_for_backend.py +1 -1
- reflex/base.py +1 -1
- reflex/compiler/compiler.py +2 -2
- reflex/compiler/utils.py +3 -3
- reflex/components/base/app_wrap.py +2 -2
- reflex/components/base/app_wrap.pyi +27 -17
- reflex/components/base/bare.py +5 -4
- reflex/components/base/body.pyi +27 -17
- reflex/components/base/document.pyi +131 -81
- reflex/components/base/error_boundary.py +7 -6
- reflex/components/base/error_boundary.pyi +33 -20
- reflex/components/base/fragment.pyi +27 -17
- reflex/components/base/head.pyi +53 -33
- reflex/components/base/link.py +1 -1
- reflex/components/base/link.pyi +54 -33
- reflex/components/base/meta.pyi +105 -65
- reflex/components/base/script.py +2 -1
- reflex/components/base/script.pyi +38 -21
- reflex/components/component.py +47 -53
- reflex/components/core/banner.py +27 -23
- reflex/components/core/banner.pyi +171 -134
- reflex/components/core/client_side_routing.py +3 -2
- reflex/components/core/client_side_routing.pyi +54 -33
- reflex/components/core/clipboard.py +1 -2
- reflex/components/core/clipboard.pyi +33 -20
- reflex/components/core/cond.py +5 -5
- reflex/components/core/debounce.py +5 -5
- reflex/components/core/debounce.pyi +33 -20
- reflex/components/core/foreach.py +4 -3
- reflex/components/core/html.py +1 -1
- reflex/components/core/html.pyi +46 -35
- reflex/components/core/match.py +17 -17
- reflex/components/core/upload.py +23 -17
- reflex/components/core/upload.pyi +124 -78
- reflex/components/datadisplay/code.py +10 -9
- reflex/components/datadisplay/code.pyi +409 -299
- reflex/components/datadisplay/dataeditor.py +10 -8
- reflex/components/datadisplay/dataeditor.pyi +53 -40
- reflex/components/el/element.pyi +27 -17
- reflex/components/el/elements/base.py +1 -1
- reflex/components/el/elements/base.pyi +45 -34
- reflex/components/el/elements/forms.py +16 -16
- reflex/components/el/elements/forms.pyi +707 -554
- reflex/components/el/elements/inline.py +1 -1
- reflex/components/el/elements/inline.pyi +1218 -937
- reflex/components/el/elements/media.py +1 -1
- reflex/components/el/elements/media.pyi +997 -786
- reflex/components/el/elements/metadata.py +6 -3
- reflex/components/el/elements/metadata.pyi +242 -181
- reflex/components/el/elements/other.py +1 -1
- reflex/components/el/elements/other.pyi +306 -235
- reflex/components/el/elements/scripts.py +1 -1
- reflex/components/el/elements/scripts.pyi +140 -109
- reflex/components/el/elements/sectioning.py +2 -0
- reflex/components/el/elements/sectioning.pyi +647 -496
- reflex/components/el/elements/tables.py +1 -1
- reflex/components/el/elements/tables.pyi +452 -351
- reflex/components/el/elements/typography.py +1 -1
- reflex/components/el/elements/typography.pyi +657 -506
- reflex/components/gridjs/datatable.py +9 -6
- reflex/components/gridjs/datatable.pyi +56 -35
- reflex/components/lucide/icon.py +1 -1
- reflex/components/lucide/icon.pyi +54 -33
- reflex/components/markdown/markdown.py +31 -26
- reflex/components/markdown/markdown.pyi +37 -27
- reflex/components/moment/moment.py +12 -13
- reflex/components/moment/moment.pyi +35 -23
- reflex/components/next/base.pyi +27 -17
- reflex/components/next/image.py +1 -1
- reflex/components/next/image.pyi +37 -22
- reflex/components/next/link.py +1 -1
- reflex/components/next/link.pyi +28 -17
- reflex/components/next/video.py +1 -1
- reflex/components/next/video.pyi +28 -17
- reflex/components/plotly/plotly.py +13 -12
- reflex/components/plotly/plotly.pyi +54 -39
- reflex/components/props.py +1 -1
- reflex/components/radix/__init__.pyi +0 -1
- reflex/components/radix/primitives/__init__.pyi +0 -1
- reflex/components/radix/primitives/accordion.py +4 -4
- reflex/components/radix/primitives/accordion.pyi +495 -424
- reflex/components/radix/primitives/base.py +1 -1
- reflex/components/radix/primitives/base.pyi +54 -33
- reflex/components/radix/primitives/drawer.py +1 -1
- reflex/components/radix/primitives/drawer.pyi +273 -172
- reflex/components/radix/primitives/form.py +1 -1
- reflex/components/radix/primitives/form.pyi +364 -257
- reflex/components/radix/primitives/progress.py +1 -1
- reflex/components/radix/primitives/progress.pyi +282 -231
- reflex/components/radix/primitives/slider.py +1 -1
- reflex/components/radix/primitives/slider.pyi +138 -87
- reflex/components/radix/themes/base.py +24 -3
- reflex/components/radix/themes/base.pyi +250 -178
- reflex/components/radix/themes/color_mode.py +5 -5
- reflex/components/radix/themes/color_mode.pyi +220 -187
- reflex/components/radix/themes/components/alert_dialog.py +1 -1
- reflex/components/radix/themes/components/alert_dialog.pyi +207 -136
- reflex/components/radix/themes/components/aspect_ratio.py +1 -1
- reflex/components/radix/themes/components/aspect_ratio.pyi +28 -17
- reflex/components/radix/themes/components/avatar.py +1 -1
- reflex/components/radix/themes/components/avatar.pyi +81 -70
- reflex/components/radix/themes/components/badge.py +1 -1
- reflex/components/radix/themes/components/badge.pyi +99 -88
- reflex/components/radix/themes/components/button.py +1 -1
- reflex/components/radix/themes/components/button.pyi +109 -98
- reflex/components/radix/themes/components/callout.py +1 -1
- reflex/components/radix/themes/components/callout.pyi +373 -322
- reflex/components/radix/themes/components/card.py +1 -1
- reflex/components/radix/themes/components/card.pyi +49 -38
- reflex/components/radix/themes/components/checkbox.py +2 -1
- reflex/components/radix/themes/components/checkbox.pyi +245 -208
- reflex/components/radix/themes/components/checkbox_cards.py +1 -1
- reflex/components/radix/themes/components/checkbox_cards.pyi +115 -94
- reflex/components/radix/themes/components/checkbox_group.py +1 -1
- reflex/components/radix/themes/components/checkbox_group.pyi +107 -86
- reflex/components/radix/themes/components/context_menu.py +1 -1
- reflex/components/radix/themes/components/context_menu.pyi +319 -238
- reflex/components/radix/themes/components/data_list.py +1 -1
- reflex/components/radix/themes/components/data_list.pyi +171 -130
- reflex/components/radix/themes/components/dialog.py +1 -1
- reflex/components/radix/themes/components/dialog.pyi +210 -139
- reflex/components/radix/themes/components/dropdown_menu.py +1 -1
- reflex/components/radix/themes/components/dropdown_menu.pyi +332 -249
- reflex/components/radix/themes/components/hover_card.py +1 -1
- reflex/components/radix/themes/components/hover_card.pyi +131 -90
- reflex/components/radix/themes/components/icon_button.py +3 -2
- reflex/components/radix/themes/components/icon_button.pyi +109 -98
- reflex/components/radix/themes/components/inset.py +1 -1
- reflex/components/radix/themes/components/inset.pyi +58 -47
- reflex/components/radix/themes/components/popover.py +1 -1
- reflex/components/radix/themes/components/popover.pyi +136 -95
- reflex/components/radix/themes/components/progress.py +1 -1
- reflex/components/radix/themes/components/progress.pyi +82 -71
- reflex/components/radix/themes/components/radio.py +1 -1
- reflex/components/radix/themes/components/radio.pyi +80 -69
- reflex/components/radix/themes/components/radio_cards.py +1 -1
- reflex/components/radix/themes/components/radio_cards.pyi +119 -98
- reflex/components/radix/themes/components/radio_group.py +11 -8
- reflex/components/radix/themes/components/radio_group.pyi +271 -228
- reflex/components/radix/themes/components/scroll_area.py +1 -1
- reflex/components/radix/themes/components/scroll_area.pyi +32 -21
- reflex/components/radix/themes/components/segmented_control.py +1 -1
- reflex/components/radix/themes/components/segmented_control.pyi +113 -90
- reflex/components/radix/themes/components/select.py +3 -2
- reflex/components/radix/themes/components/select.pyi +471 -374
- reflex/components/radix/themes/components/separator.py +2 -1
- reflex/components/radix/themes/components/separator.pyi +80 -69
- reflex/components/radix/themes/components/skeleton.py +1 -1
- reflex/components/radix/themes/components/skeleton.pyi +34 -23
- reflex/components/radix/themes/components/slider.py +3 -2
- reflex/components/radix/themes/components/slider.pyi +88 -75
- reflex/components/radix/themes/components/spinner.py +1 -1
- reflex/components/radix/themes/components/spinner.pyi +30 -19
- reflex/components/radix/themes/components/switch.py +1 -1
- reflex/components/radix/themes/components/switch.pyi +84 -71
- reflex/components/radix/themes/components/table.py +1 -1
- reflex/components/radix/themes/components/table.pyi +332 -261
- reflex/components/radix/themes/components/tabs.py +1 -1
- reflex/components/radix/themes/components/tabs.pyi +194 -139
- reflex/components/radix/themes/components/text_area.py +1 -1
- reflex/components/radix/themes/components/text_area.pyi +111 -96
- reflex/components/radix/themes/components/text_field.py +1 -1
- reflex/components/radix/themes/components/text_field.pyi +286 -247
- reflex/components/radix/themes/components/tooltip.py +1 -1
- reflex/components/radix/themes/components/tooltip.pyi +37 -26
- reflex/components/radix/themes/layout/__init__.pyi +0 -1
- reflex/components/radix/themes/layout/base.py +1 -1
- reflex/components/radix/themes/layout/base.pyi +67 -56
- reflex/components/radix/themes/layout/box.pyi +45 -34
- reflex/components/radix/themes/layout/center.pyi +67 -56
- reflex/components/radix/themes/layout/container.py +2 -1
- reflex/components/radix/themes/layout/container.pyi +47 -36
- reflex/components/radix/themes/layout/flex.py +1 -1
- reflex/components/radix/themes/layout/flex.pyi +67 -56
- reflex/components/radix/themes/layout/grid.py +1 -1
- reflex/components/radix/themes/layout/grid.pyi +75 -64
- reflex/components/radix/themes/layout/list.py +6 -5
- reflex/components/radix/themes/layout/list.pyi +244 -193
- reflex/components/radix/themes/layout/section.py +2 -1
- reflex/components/radix/themes/layout/section.pyi +47 -36
- reflex/components/radix/themes/layout/spacer.pyi +67 -56
- reflex/components/radix/themes/layout/stack.py +1 -1
- reflex/components/radix/themes/layout/stack.pyi +159 -128
- reflex/components/radix/themes/typography/blockquote.py +1 -1
- reflex/components/radix/themes/typography/blockquote.pyi +100 -89
- reflex/components/radix/themes/typography/code.py +1 -1
- reflex/components/radix/themes/typography/code.pyi +101 -90
- reflex/components/radix/themes/typography/heading.py +1 -1
- reflex/components/radix/themes/typography/heading.pyi +107 -96
- reflex/components/radix/themes/typography/link.py +1 -1
- reflex/components/radix/themes/typography/link.pyi +113 -102
- reflex/components/radix/themes/typography/text.py +1 -1
- reflex/components/radix/themes/typography/text.pyi +572 -501
- reflex/components/react_player/audio.pyi +60 -33
- reflex/components/react_player/react_player.py +1 -1
- reflex/components/react_player/react_player.pyi +60 -33
- reflex/components/react_player/video.pyi +60 -33
- reflex/components/recharts/cartesian.py +3 -2
- reflex/components/recharts/cartesian.pyi +861 -678
- reflex/components/recharts/charts.py +5 -4
- reflex/components/recharts/charts.pyi +357 -252
- reflex/components/recharts/general.py +2 -1
- reflex/components/recharts/general.pyi +231 -180
- reflex/components/recharts/polar.py +5 -4
- reflex/components/recharts/polar.pyi +181 -144
- reflex/components/recharts/recharts.pyi +53 -33
- reflex/components/sonner/toast.py +17 -16
- reflex/components/sonner/toast.pyi +47 -36
- reflex/components/suneditor/editor.py +3 -2
- reflex/components/suneditor/editor.pyi +78 -55
- reflex/components/tags/cond_tag.py +4 -6
- reflex/components/tags/iter_tag.py +16 -28
- reflex/components/tags/match_tag.py +4 -6
- reflex/components/tags/tag.py +23 -40
- reflex/custom_components/custom_components.py +1 -3
- reflex/event.py +65 -113
- reflex/experimental/client_state.py +24 -25
- reflex/experimental/hooks.py +16 -16
- reflex/experimental/layout.py +5 -5
- reflex/experimental/layout.pyi +187 -136
- reflex/{vars → ivars}/__init__.py +2 -6
- reflex/{vars → ivars}/base.py +216 -599
- reflex/{vars → ivars}/function.py +19 -15
- reflex/{vars → ivars}/number.py +20 -41
- reflex/{vars → ivars}/object.py +30 -28
- reflex/{vars → ivars}/sequence.py +50 -53
- reflex/middleware/hydrate_middleware.py +0 -2
- reflex/middleware/middleware.py +3 -3
- reflex/state.py +82 -148
- reflex/style.py +22 -21
- reflex/utils/exceptions.py +0 -20
- reflex/utils/format.py +34 -54
- reflex/utils/imports.py +73 -16
- reflex/utils/prerequisites.py +15 -35
- reflex/utils/pyi_generator.py +8 -13
- reflex/utils/serializers.py +22 -12
- reflex/utils/telemetry.py +2 -3
- reflex/utils/types.py +5 -10
- reflex/vars.py +501 -0
- {reflex-0.6.0.dist-info → reflex-0.6.0a1.dist-info}/METADATA +5 -4
- reflex-0.6.0a1.dist-info/RECORD +384 -0
- reflex-0.6.0.dist-info/RECORD +0 -382
- {reflex-0.6.0.dist-info → reflex-0.6.0a1.dist-info}/LICENSE +0 -0
- {reflex-0.6.0.dist-info → reflex-0.6.0a1.dist-info}/WHEEL +0 -0
- {reflex-0.6.0.dist-info → reflex-0.6.0a1.dist-info}/entry_points.txt +0 -0
|
@@ -6,10 +6,11 @@ from typing import Any, Dict, List, Union
|
|
|
6
6
|
|
|
7
7
|
from reflex.components.component import Component
|
|
8
8
|
from reflex.components.tags import Tag
|
|
9
|
+
from reflex.ivars.base import ImmutableVar, LiteralVar, is_computed_var
|
|
9
10
|
from reflex.utils import types
|
|
10
11
|
from reflex.utils.imports import ImportDict
|
|
11
12
|
from reflex.utils.serializers import serialize
|
|
12
|
-
from reflex.vars
|
|
13
|
+
from reflex.vars import Var
|
|
13
14
|
|
|
14
15
|
|
|
15
16
|
class Gridjs(Component):
|
|
@@ -82,7 +83,7 @@ class DataTable(Gridjs):
|
|
|
82
83
|
# If data is a pandas dataframe and columns are provided throw an error.
|
|
83
84
|
if (
|
|
84
85
|
types.is_dataframe(type(data))
|
|
85
|
-
or (isinstance(data,
|
|
86
|
+
or (isinstance(data, ImmutableVar) and types.is_dataframe(data._var_type))
|
|
86
87
|
) and columns is not None:
|
|
87
88
|
raise ValueError(
|
|
88
89
|
"Cannot pass in both a pandas dataframe and columns to the data_table component."
|
|
@@ -90,7 +91,7 @@ class DataTable(Gridjs):
|
|
|
90
91
|
|
|
91
92
|
# If data is a list and columns are not provided, throw an error
|
|
92
93
|
if (
|
|
93
|
-
(isinstance(data,
|
|
94
|
+
(isinstance(data, ImmutableVar) and types._issubclass(data._var_type, List))
|
|
94
95
|
or issubclass(type(data), List)
|
|
95
96
|
) and columns is None:
|
|
96
97
|
raise ValueError(
|
|
@@ -112,13 +113,15 @@ class DataTable(Gridjs):
|
|
|
112
113
|
return {"": "gridjs/dist/theme/mermaid.css"}
|
|
113
114
|
|
|
114
115
|
def _render(self) -> Tag:
|
|
115
|
-
if isinstance(self.data,
|
|
116
|
+
if isinstance(self.data, ImmutableVar) and types.is_dataframe(
|
|
117
|
+
self.data._var_type
|
|
118
|
+
):
|
|
116
119
|
self.columns = self.data._replace(
|
|
117
|
-
|
|
120
|
+
_var_name=f"{self.data._var_name}.columns",
|
|
118
121
|
_var_type=List[Any],
|
|
119
122
|
)
|
|
120
123
|
self.data = self.data._replace(
|
|
121
|
-
|
|
124
|
+
_var_name=f"{self.data._var_name}.data",
|
|
122
125
|
_var_type=List[List[Any]],
|
|
123
126
|
)
|
|
124
127
|
if types.is_dataframe(type(self.data)):
|
|
@@ -7,9 +7,10 @@ from typing import Any, Callable, Dict, List, Optional, Union, overload
|
|
|
7
7
|
|
|
8
8
|
from reflex.components.component import Component
|
|
9
9
|
from reflex.event import EventHandler, EventSpec
|
|
10
|
+
from reflex.ivars.base import ImmutableVar
|
|
10
11
|
from reflex.style import Style
|
|
11
12
|
from reflex.utils.imports import ImportDict
|
|
12
|
-
from reflex.vars
|
|
13
|
+
from reflex.vars import Var
|
|
13
14
|
|
|
14
15
|
class Gridjs(Component):
|
|
15
16
|
@overload
|
|
@@ -22,41 +23,51 @@ class Gridjs(Component):
|
|
|
22
23
|
id: Optional[Any] = None,
|
|
23
24
|
class_name: Optional[Any] = None,
|
|
24
25
|
autofocus: Optional[bool] = None,
|
|
25
|
-
custom_attrs: Optional[Dict[str, Union[
|
|
26
|
-
on_blur: Optional[
|
|
27
|
-
|
|
26
|
+
custom_attrs: Optional[Dict[str, Union[ImmutableVar, str]]] = None,
|
|
27
|
+
on_blur: Optional[
|
|
28
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
29
|
+
] = None,
|
|
30
|
+
on_click: Optional[
|
|
31
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
32
|
+
] = None,
|
|
28
33
|
on_context_menu: Optional[
|
|
29
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
34
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
30
35
|
] = None,
|
|
31
36
|
on_double_click: Optional[
|
|
32
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
37
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
38
|
+
] = None,
|
|
39
|
+
on_focus: Optional[
|
|
40
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
41
|
+
] = None,
|
|
42
|
+
on_mount: Optional[
|
|
43
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
33
44
|
] = None,
|
|
34
|
-
on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None,
|
|
35
|
-
on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None,
|
|
36
45
|
on_mouse_down: Optional[
|
|
37
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
46
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
38
47
|
] = None,
|
|
39
48
|
on_mouse_enter: Optional[
|
|
40
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
49
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
41
50
|
] = None,
|
|
42
51
|
on_mouse_leave: Optional[
|
|
43
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
52
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
44
53
|
] = None,
|
|
45
54
|
on_mouse_move: Optional[
|
|
46
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
55
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
47
56
|
] = None,
|
|
48
57
|
on_mouse_out: Optional[
|
|
49
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
58
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
50
59
|
] = None,
|
|
51
60
|
on_mouse_over: Optional[
|
|
52
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
61
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
53
62
|
] = None,
|
|
54
63
|
on_mouse_up: Optional[
|
|
55
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
64
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
65
|
+
] = None,
|
|
66
|
+
on_scroll: Optional[
|
|
67
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
56
68
|
] = None,
|
|
57
|
-
on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None,
|
|
58
69
|
on_unmount: Optional[
|
|
59
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
70
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
60
71
|
] = None,
|
|
61
72
|
**props,
|
|
62
73
|
) -> "Gridjs":
|
|
@@ -84,51 +95,61 @@ class DataTable(Gridjs):
|
|
|
84
95
|
cls,
|
|
85
96
|
*children,
|
|
86
97
|
data: Optional[Any] = None,
|
|
87
|
-
columns: Optional[Union[List,
|
|
98
|
+
columns: Optional[Union[Var[List], List]] = None,
|
|
88
99
|
search: Optional[Union[Var[bool], bool]] = None,
|
|
89
100
|
sort: Optional[Union[Var[bool], bool]] = None,
|
|
90
101
|
resizable: Optional[Union[Var[bool], bool]] = None,
|
|
91
|
-
pagination: Optional[Union[
|
|
102
|
+
pagination: Optional[Union[Var[Union[Dict, bool]], bool, Dict]] = None,
|
|
92
103
|
style: Optional[Style] = None,
|
|
93
104
|
key: Optional[Any] = None,
|
|
94
105
|
id: Optional[Any] = None,
|
|
95
106
|
class_name: Optional[Any] = None,
|
|
96
107
|
autofocus: Optional[bool] = None,
|
|
97
|
-
custom_attrs: Optional[Dict[str, Union[
|
|
98
|
-
on_blur: Optional[
|
|
99
|
-
|
|
108
|
+
custom_attrs: Optional[Dict[str, Union[ImmutableVar, str]]] = None,
|
|
109
|
+
on_blur: Optional[
|
|
110
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
111
|
+
] = None,
|
|
112
|
+
on_click: Optional[
|
|
113
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
114
|
+
] = None,
|
|
100
115
|
on_context_menu: Optional[
|
|
101
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
116
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
102
117
|
] = None,
|
|
103
118
|
on_double_click: Optional[
|
|
104
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
119
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
120
|
+
] = None,
|
|
121
|
+
on_focus: Optional[
|
|
122
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
123
|
+
] = None,
|
|
124
|
+
on_mount: Optional[
|
|
125
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
105
126
|
] = None,
|
|
106
|
-
on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None,
|
|
107
|
-
on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None,
|
|
108
127
|
on_mouse_down: Optional[
|
|
109
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
128
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
110
129
|
] = None,
|
|
111
130
|
on_mouse_enter: Optional[
|
|
112
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
131
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
113
132
|
] = None,
|
|
114
133
|
on_mouse_leave: Optional[
|
|
115
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
134
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
116
135
|
] = None,
|
|
117
136
|
on_mouse_move: Optional[
|
|
118
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
137
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
119
138
|
] = None,
|
|
120
139
|
on_mouse_out: Optional[
|
|
121
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
140
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
122
141
|
] = None,
|
|
123
142
|
on_mouse_over: Optional[
|
|
124
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
143
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
125
144
|
] = None,
|
|
126
145
|
on_mouse_up: Optional[
|
|
127
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
146
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
147
|
+
] = None,
|
|
148
|
+
on_scroll: Optional[
|
|
149
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
128
150
|
] = None,
|
|
129
|
-
on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None,
|
|
130
151
|
on_unmount: Optional[
|
|
131
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
152
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
132
153
|
] = None,
|
|
133
154
|
**props,
|
|
134
155
|
) -> "DataTable":
|
reflex/components/lucide/icon.py
CHANGED
|
@@ -7,8 +7,9 @@ from typing import Any, Callable, Dict, Optional, Union, overload
|
|
|
7
7
|
|
|
8
8
|
from reflex.components.component import Component
|
|
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
|
|
12
|
+
from reflex.vars import Var
|
|
12
13
|
|
|
13
14
|
class LucideIconComponent(Component):
|
|
14
15
|
@overload
|
|
@@ -21,41 +22,51 @@ class LucideIconComponent(Component):
|
|
|
21
22
|
id: Optional[Any] = None,
|
|
22
23
|
class_name: Optional[Any] = None,
|
|
23
24
|
autofocus: Optional[bool] = None,
|
|
24
|
-
custom_attrs: Optional[Dict[str, Union[
|
|
25
|
-
on_blur: Optional[
|
|
26
|
-
|
|
25
|
+
custom_attrs: Optional[Dict[str, Union[ImmutableVar, str]]] = None,
|
|
26
|
+
on_blur: Optional[
|
|
27
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
28
|
+
] = None,
|
|
29
|
+
on_click: Optional[
|
|
30
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
31
|
+
] = None,
|
|
27
32
|
on_context_menu: Optional[
|
|
28
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
33
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
29
34
|
] = None,
|
|
30
35
|
on_double_click: Optional[
|
|
31
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
36
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
37
|
+
] = None,
|
|
38
|
+
on_focus: Optional[
|
|
39
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
40
|
+
] = None,
|
|
41
|
+
on_mount: Optional[
|
|
42
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
32
43
|
] = None,
|
|
33
|
-
on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None,
|
|
34
|
-
on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None,
|
|
35
44
|
on_mouse_down: Optional[
|
|
36
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
45
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
37
46
|
] = None,
|
|
38
47
|
on_mouse_enter: Optional[
|
|
39
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
48
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
40
49
|
] = None,
|
|
41
50
|
on_mouse_leave: Optional[
|
|
42
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
51
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
43
52
|
] = None,
|
|
44
53
|
on_mouse_move: Optional[
|
|
45
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
54
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
46
55
|
] = None,
|
|
47
56
|
on_mouse_out: Optional[
|
|
48
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
57
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
49
58
|
] = None,
|
|
50
59
|
on_mouse_over: Optional[
|
|
51
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
60
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
52
61
|
] = None,
|
|
53
62
|
on_mouse_up: Optional[
|
|
54
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
63
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
64
|
+
] = None,
|
|
65
|
+
on_scroll: Optional[
|
|
66
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
55
67
|
] = None,
|
|
56
|
-
on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None,
|
|
57
68
|
on_unmount: Optional[
|
|
58
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
69
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
59
70
|
] = None,
|
|
60
71
|
**props,
|
|
61
72
|
) -> "LucideIconComponent":
|
|
@@ -88,41 +99,51 @@ class Icon(LucideIconComponent):
|
|
|
88
99
|
id: Optional[Any] = None,
|
|
89
100
|
class_name: Optional[Any] = None,
|
|
90
101
|
autofocus: Optional[bool] = None,
|
|
91
|
-
custom_attrs: Optional[Dict[str, Union[
|
|
92
|
-
on_blur: Optional[
|
|
93
|
-
|
|
102
|
+
custom_attrs: Optional[Dict[str, Union[ImmutableVar, str]]] = None,
|
|
103
|
+
on_blur: Optional[
|
|
104
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
105
|
+
] = None,
|
|
106
|
+
on_click: Optional[
|
|
107
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
108
|
+
] = None,
|
|
94
109
|
on_context_menu: Optional[
|
|
95
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
110
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
96
111
|
] = None,
|
|
97
112
|
on_double_click: Optional[
|
|
98
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
113
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
114
|
+
] = None,
|
|
115
|
+
on_focus: Optional[
|
|
116
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
117
|
+
] = None,
|
|
118
|
+
on_mount: Optional[
|
|
119
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
99
120
|
] = None,
|
|
100
|
-
on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None,
|
|
101
|
-
on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None,
|
|
102
121
|
on_mouse_down: Optional[
|
|
103
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
122
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
104
123
|
] = None,
|
|
105
124
|
on_mouse_enter: Optional[
|
|
106
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
125
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
107
126
|
] = None,
|
|
108
127
|
on_mouse_leave: Optional[
|
|
109
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
128
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
110
129
|
] = None,
|
|
111
130
|
on_mouse_move: Optional[
|
|
112
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
131
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
113
132
|
] = None,
|
|
114
133
|
on_mouse_out: Optional[
|
|
115
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
134
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
116
135
|
] = None,
|
|
117
136
|
on_mouse_over: Optional[
|
|
118
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
137
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
119
138
|
] = None,
|
|
120
139
|
on_mouse_up: Optional[
|
|
121
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
140
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
141
|
+
] = None,
|
|
142
|
+
on_scroll: Optional[
|
|
143
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
122
144
|
] = None,
|
|
123
|
-
on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None,
|
|
124
145
|
on_unmount: Optional[
|
|
125
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
146
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
126
147
|
] = None,
|
|
127
148
|
**props,
|
|
128
149
|
) -> "Icon":
|
|
@@ -17,25 +17,25 @@ from reflex.components.radix.themes.typography.heading import Heading
|
|
|
17
17
|
from reflex.components.radix.themes.typography.link import Link
|
|
18
18
|
from reflex.components.radix.themes.typography.text import Text
|
|
19
19
|
from reflex.components.tags.tag import Tag
|
|
20
|
+
from reflex.ivars.base import ImmutableVar, LiteralVar
|
|
20
21
|
from reflex.utils import types
|
|
21
22
|
from reflex.utils.imports import ImportDict, ImportVar
|
|
22
|
-
from reflex.vars.base import LiteralVar, Var
|
|
23
23
|
|
|
24
24
|
# Special vars used in the component map.
|
|
25
|
-
_CHILDREN =
|
|
26
|
-
_PROPS =
|
|
27
|
-
_PROPS_IN_TAG =
|
|
28
|
-
_MOCK_ARG =
|
|
25
|
+
_CHILDREN = ImmutableVar.create_safe("children")
|
|
26
|
+
_PROPS = ImmutableVar.create_safe("...props")
|
|
27
|
+
_PROPS_IN_TAG = ImmutableVar.create_safe("{...props}")
|
|
28
|
+
_MOCK_ARG = ImmutableVar.create_safe("")
|
|
29
29
|
|
|
30
30
|
# Special remark plugins.
|
|
31
|
-
_REMARK_MATH =
|
|
32
|
-
_REMARK_GFM =
|
|
33
|
-
_REMARK_UNWRAP_IMAGES =
|
|
31
|
+
_REMARK_MATH = ImmutableVar.create_safe("remarkMath")
|
|
32
|
+
_REMARK_GFM = ImmutableVar.create_safe("remarkGfm")
|
|
33
|
+
_REMARK_UNWRAP_IMAGES = ImmutableVar.create_safe("remarkUnwrapImages")
|
|
34
34
|
_REMARK_PLUGINS = LiteralVar.create([_REMARK_MATH, _REMARK_GFM, _REMARK_UNWRAP_IMAGES])
|
|
35
35
|
|
|
36
36
|
# Special rehype plugins.
|
|
37
|
-
_REHYPE_KATEX =
|
|
38
|
-
_REHYPE_RAW =
|
|
37
|
+
_REHYPE_KATEX = ImmutableVar.create_safe("rehypeKatex")
|
|
38
|
+
_REHYPE_RAW = ImmutableVar.create_safe("rehypeRaw")
|
|
39
39
|
_REHYPE_PLUGINS = LiteralVar.create([_REHYPE_KATEX, _REHYPE_RAW])
|
|
40
40
|
|
|
41
41
|
# These tags do NOT get props passed to them
|
|
@@ -99,7 +99,8 @@ class Markdown(Component):
|
|
|
99
99
|
The markdown component.
|
|
100
100
|
"""
|
|
101
101
|
assert (
|
|
102
|
-
len(children) == 1
|
|
102
|
+
len(children) == 1
|
|
103
|
+
and types._isinstance(children[0], Union[str, ImmutableVar])
|
|
103
104
|
), "Markdown component must have exactly one child containing the markdown source."
|
|
104
105
|
|
|
105
106
|
# Update the base component map with the custom component map.
|
|
@@ -154,19 +155,19 @@ class Markdown(Component):
|
|
|
154
155
|
{
|
|
155
156
|
"": "katex/dist/katex.min.css",
|
|
156
157
|
"remark-math@5.1.1": ImportVar(
|
|
157
|
-
tag=_REMARK_MATH.
|
|
158
|
+
tag=_REMARK_MATH._var_name, is_default=True
|
|
158
159
|
),
|
|
159
160
|
"remark-gfm@3.0.1": ImportVar(
|
|
160
|
-
tag=_REMARK_GFM.
|
|
161
|
+
tag=_REMARK_GFM._var_name, is_default=True
|
|
161
162
|
),
|
|
162
163
|
"remark-unwrap-images@4.0.0": ImportVar(
|
|
163
|
-
tag=_REMARK_UNWRAP_IMAGES.
|
|
164
|
+
tag=_REMARK_UNWRAP_IMAGES._var_name, is_default=True
|
|
164
165
|
),
|
|
165
166
|
"rehype-katex@6.0.3": ImportVar(
|
|
166
|
-
tag=_REHYPE_KATEX.
|
|
167
|
+
tag=_REHYPE_KATEX._var_name, is_default=True
|
|
167
168
|
),
|
|
168
169
|
"rehype-raw@6.1.1": ImportVar(
|
|
169
|
-
tag=_REHYPE_RAW.
|
|
170
|
+
tag=_REHYPE_RAW._var_name, is_default=True
|
|
170
171
|
),
|
|
171
172
|
},
|
|
172
173
|
*[
|
|
@@ -194,17 +195,19 @@ class Markdown(Component):
|
|
|
194
195
|
if tag not in self.component_map:
|
|
195
196
|
raise ValueError(f"No markdown component found for tag: {tag}.")
|
|
196
197
|
|
|
197
|
-
special_props =
|
|
198
|
+
special_props = {_PROPS_IN_TAG}
|
|
198
199
|
children = [_CHILDREN]
|
|
199
200
|
|
|
200
201
|
# For certain tags, the props from the markdown renderer are not actually valid for the component.
|
|
201
202
|
if tag in NO_PROPS_TAGS:
|
|
202
|
-
special_props =
|
|
203
|
+
special_props = set()
|
|
203
204
|
|
|
204
205
|
# If the children are set as a prop, don't pass them as children.
|
|
205
206
|
children_prop = props.pop("children", None)
|
|
206
207
|
if children_prop is not None:
|
|
207
|
-
special_props.
|
|
208
|
+
special_props.add(
|
|
209
|
+
ImmutableVar.create_safe(f"children={{{str(children_prop)}}}")
|
|
210
|
+
)
|
|
208
211
|
children = []
|
|
209
212
|
# Get the component.
|
|
210
213
|
component = self.component_map[tag](*children, **props).set(
|
|
@@ -224,22 +227,22 @@ class Markdown(Component):
|
|
|
224
227
|
"""
|
|
225
228
|
return str(self.get_component(tag, **props)).replace("\n", "")
|
|
226
229
|
|
|
227
|
-
def format_component_map(self) -> dict[str,
|
|
230
|
+
def format_component_map(self) -> dict[str, ImmutableVar]:
|
|
228
231
|
"""Format the component map for rendering.
|
|
229
232
|
|
|
230
233
|
Returns:
|
|
231
234
|
The formatted component map.
|
|
232
235
|
"""
|
|
233
236
|
components = {
|
|
234
|
-
tag:
|
|
235
|
-
|
|
237
|
+
tag: ImmutableVar.create_safe(
|
|
238
|
+
f"(({{node, {_CHILDREN._var_name}, {_PROPS._var_name}}}) => ({self.format_component(tag)}))"
|
|
236
239
|
)
|
|
237
240
|
for tag in self.component_map
|
|
238
241
|
}
|
|
239
242
|
|
|
240
243
|
# Separate out inline code and code blocks.
|
|
241
|
-
components["code"] =
|
|
242
|
-
|
|
244
|
+
components["code"] = ImmutableVar.create_safe(
|
|
245
|
+
f"""(({{node, inline, className, {_CHILDREN._var_name}, {_PROPS._var_name}}}) => {{
|
|
243
246
|
const match = (className || '').match(/language-(?<lang>.*)/);
|
|
244
247
|
const language = match ? match[1] : '';
|
|
245
248
|
if (language) {{
|
|
@@ -255,7 +258,7 @@ class Markdown(Component):
|
|
|
255
258
|
return inline ? (
|
|
256
259
|
{self.format_component("code")}
|
|
257
260
|
) : (
|
|
258
|
-
{self.format_component("codeblock", language=
|
|
261
|
+
{self.format_component("codeblock", language=ImmutableVar.create_safe("language"))}
|
|
259
262
|
);
|
|
260
263
|
}})""".replace("\n", " ")
|
|
261
264
|
)
|
|
@@ -295,7 +298,9 @@ class Markdown(Component):
|
|
|
295
298
|
.add_props(
|
|
296
299
|
remark_plugins=_REMARK_PLUGINS,
|
|
297
300
|
rehype_plugins=_REHYPE_PLUGINS,
|
|
298
|
-
components=
|
|
301
|
+
components=ImmutableVar.create_safe(
|
|
302
|
+
f"{self._get_component_map_name()}()"
|
|
303
|
+
),
|
|
299
304
|
)
|
|
300
305
|
.remove_props("componentMap", "componentMapHash")
|
|
301
306
|
)
|
|
@@ -8,20 +8,20 @@ from typing import Any, Callable, Dict, Optional, Union, overload
|
|
|
8
8
|
|
|
9
9
|
from reflex.components.component import Component
|
|
10
10
|
from reflex.event import EventHandler, EventSpec
|
|
11
|
+
from reflex.ivars.base import ImmutableVar, LiteralVar
|
|
11
12
|
from reflex.style import Style
|
|
12
13
|
from reflex.utils.imports import ImportDict
|
|
13
|
-
from reflex.vars.base import LiteralVar, Var
|
|
14
14
|
|
|
15
|
-
_CHILDREN =
|
|
16
|
-
_PROPS =
|
|
17
|
-
_PROPS_IN_TAG =
|
|
18
|
-
_MOCK_ARG =
|
|
19
|
-
_REMARK_MATH =
|
|
20
|
-
_REMARK_GFM =
|
|
21
|
-
_REMARK_UNWRAP_IMAGES =
|
|
15
|
+
_CHILDREN = ImmutableVar.create_safe("children")
|
|
16
|
+
_PROPS = ImmutableVar.create_safe("...props")
|
|
17
|
+
_PROPS_IN_TAG = ImmutableVar.create_safe("{...props}")
|
|
18
|
+
_MOCK_ARG = ImmutableVar.create_safe("")
|
|
19
|
+
_REMARK_MATH = ImmutableVar.create_safe("remarkMath")
|
|
20
|
+
_REMARK_GFM = ImmutableVar.create_safe("remarkGfm")
|
|
21
|
+
_REMARK_UNWRAP_IMAGES = ImmutableVar.create_safe("remarkUnwrapImages")
|
|
22
22
|
_REMARK_PLUGINS = LiteralVar.create([_REMARK_MATH, _REMARK_GFM, _REMARK_UNWRAP_IMAGES])
|
|
23
|
-
_REHYPE_KATEX =
|
|
24
|
-
_REHYPE_RAW =
|
|
23
|
+
_REHYPE_KATEX = ImmutableVar.create_safe("rehypeKatex")
|
|
24
|
+
_REHYPE_RAW = ImmutableVar.create_safe("rehypeRaw")
|
|
25
25
|
_REHYPE_PLUGINS = LiteralVar.create([_REHYPE_KATEX, _REHYPE_RAW])
|
|
26
26
|
NO_PROPS_TAGS = ("ul", "ol", "li")
|
|
27
27
|
|
|
@@ -41,41 +41,51 @@ class Markdown(Component):
|
|
|
41
41
|
id: Optional[Any] = None,
|
|
42
42
|
class_name: Optional[Any] = None,
|
|
43
43
|
autofocus: Optional[bool] = None,
|
|
44
|
-
custom_attrs: Optional[Dict[str, Union[
|
|
45
|
-
on_blur: Optional[
|
|
46
|
-
|
|
44
|
+
custom_attrs: Optional[Dict[str, Union[ImmutableVar, str]]] = None,
|
|
45
|
+
on_blur: Optional[
|
|
46
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
47
|
+
] = None,
|
|
48
|
+
on_click: Optional[
|
|
49
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
50
|
+
] = None,
|
|
47
51
|
on_context_menu: Optional[
|
|
48
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
52
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
49
53
|
] = None,
|
|
50
54
|
on_double_click: Optional[
|
|
51
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
55
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
56
|
+
] = None,
|
|
57
|
+
on_focus: Optional[
|
|
58
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
59
|
+
] = None,
|
|
60
|
+
on_mount: Optional[
|
|
61
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
52
62
|
] = None,
|
|
53
|
-
on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None,
|
|
54
|
-
on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None,
|
|
55
63
|
on_mouse_down: Optional[
|
|
56
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
64
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
57
65
|
] = None,
|
|
58
66
|
on_mouse_enter: Optional[
|
|
59
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
67
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
60
68
|
] = None,
|
|
61
69
|
on_mouse_leave: Optional[
|
|
62
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
70
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
63
71
|
] = None,
|
|
64
72
|
on_mouse_move: Optional[
|
|
65
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
73
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
66
74
|
] = None,
|
|
67
75
|
on_mouse_out: Optional[
|
|
68
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
76
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
69
77
|
] = None,
|
|
70
78
|
on_mouse_over: Optional[
|
|
71
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
79
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
72
80
|
] = None,
|
|
73
81
|
on_mouse_up: Optional[
|
|
74
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
82
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
83
|
+
] = None,
|
|
84
|
+
on_scroll: Optional[
|
|
85
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
75
86
|
] = None,
|
|
76
|
-
on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None,
|
|
77
87
|
on_unmount: Optional[
|
|
78
|
-
Union[EventHandler, EventSpec, list, Callable,
|
|
88
|
+
Union[EventHandler, EventSpec, list, Callable, ImmutableVar]
|
|
79
89
|
] = None,
|
|
80
90
|
**props,
|
|
81
91
|
) -> "Markdown":
|
|
@@ -101,4 +111,4 @@ class Markdown(Component):
|
|
|
101
111
|
def add_imports(self) -> ImportDict | list[ImportDict]: ...
|
|
102
112
|
def get_component(self, tag: str, **props) -> Component: ...
|
|
103
113
|
def format_component(self, tag: str, **props) -> str: ...
|
|
104
|
-
def format_component_map(self) -> dict[str,
|
|
114
|
+
def format_component_map(self) -> dict[str, ImmutableVar]: ...
|
|
@@ -1,27 +1,26 @@
|
|
|
1
1
|
"""Moment component for humanized date rendering."""
|
|
2
2
|
|
|
3
|
-
import dataclasses
|
|
4
3
|
from typing import List, Optional
|
|
5
4
|
|
|
5
|
+
from reflex.base import Base
|
|
6
6
|
from reflex.components.component import Component, NoSSRComponent
|
|
7
7
|
from reflex.event import EventHandler
|
|
8
8
|
from reflex.utils.imports import ImportDict
|
|
9
|
-
from reflex.vars
|
|
9
|
+
from reflex.vars import Var
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
class MomentDelta:
|
|
12
|
+
class MomentDelta(Base):
|
|
14
13
|
"""A delta used for add/subtract prop in Moment."""
|
|
15
14
|
|
|
16
|
-
years: Optional[int]
|
|
17
|
-
quarters: Optional[int]
|
|
18
|
-
months: Optional[int]
|
|
19
|
-
weeks: Optional[int]
|
|
20
|
-
days: Optional[int]
|
|
21
|
-
hours: Optional[int]
|
|
22
|
-
minutess: Optional[int]
|
|
23
|
-
seconds: Optional[int]
|
|
24
|
-
milliseconds: Optional[int]
|
|
15
|
+
years: Optional[int]
|
|
16
|
+
quarters: Optional[int]
|
|
17
|
+
months: Optional[int]
|
|
18
|
+
weeks: Optional[int]
|
|
19
|
+
days: Optional[int]
|
|
20
|
+
hours: Optional[int]
|
|
21
|
+
minutess: Optional[int]
|
|
22
|
+
seconds: Optional[int]
|
|
23
|
+
milliseconds: Optional[int]
|
|
25
24
|
|
|
26
25
|
|
|
27
26
|
class Moment(NoSSRComponent):
|