reflex 0.6.8a2__py3-none-any.whl → 0.7.0a2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of reflex might be problematic. Click here for more details.
- reflex/.templates/jinja/custom_components/pyproject.toml.jinja2 +1 -1
- reflex/.templates/jinja/web/pages/_app.js.jinja2 +7 -7
- reflex/.templates/jinja/web/pages/utils.js.jinja2 +3 -3
- reflex/.templates/web/components/reflex/radix_themes_color_mode_provider.js +1 -4
- reflex/.templates/web/utils/state.js +65 -36
- reflex/__init__.py +4 -17
- reflex/__init__.pyi +1 -2
- reflex/app.py +249 -116
- reflex/app_mixins/lifespan.py +9 -9
- reflex/app_mixins/middleware.py +6 -6
- reflex/app_module_for_backend.py +3 -7
- reflex/base.py +7 -7
- reflex/compiler/compiler.py +8 -0
- reflex/compiler/utils.py +35 -6
- reflex/components/base/app_wrap.pyi +16 -16
- reflex/components/base/bare.py +1 -1
- reflex/components/base/body.pyi +16 -16
- reflex/components/base/document.pyi +76 -76
- reflex/components/base/error_boundary.py +2 -1
- reflex/components/base/error_boundary.pyi +19 -22
- reflex/components/base/fragment.pyi +16 -16
- reflex/components/base/head.pyi +31 -31
- reflex/components/base/link.pyi +31 -31
- reflex/components/base/meta.py +2 -2
- reflex/components/base/meta.pyi +61 -61
- reflex/components/base/script.pyi +19 -19
- reflex/components/base/strict_mode.py +10 -0
- reflex/components/base/strict_mode.pyi +57 -0
- reflex/components/component.py +38 -77
- reflex/components/core/banner.py +159 -4
- reflex/components/core/banner.pyi +162 -76
- reflex/components/core/breakpoints.py +3 -1
- reflex/components/core/client_side_routing.py +1 -1
- reflex/components/core/client_side_routing.pyi +32 -32
- reflex/components/core/clipboard.pyi +17 -20
- reflex/components/core/cond.py +9 -10
- reflex/components/core/debounce.py +1 -1
- reflex/components/core/debounce.pyi +17 -17
- reflex/components/core/foreach.py +28 -3
- reflex/components/core/html.py +1 -1
- reflex/components/core/html.pyi +16 -16
- reflex/components/core/match.py +5 -5
- reflex/components/core/sticky.py +160 -0
- reflex/components/core/sticky.pyi +449 -0
- reflex/components/core/upload.py +2 -2
- reflex/components/core/upload.pyi +80 -88
- reflex/components/datadisplay/code.py +5 -14
- reflex/components/datadisplay/code.pyi +31 -31
- reflex/components/datadisplay/dataeditor.py +7 -4
- reflex/components/datadisplay/dataeditor.pyi +40 -54
- reflex/components/datadisplay/logo.py +13 -8
- reflex/components/datadisplay/shiki_code_block.py +14 -9
- reflex/components/datadisplay/shiki_code_block.pyi +46 -46
- reflex/components/dynamic.py +22 -3
- reflex/components/el/constants/reflex.py +1 -1
- reflex/components/el/element.py +1 -1
- reflex/components/el/element.pyi +16 -16
- reflex/components/el/elements/base.pyi +16 -16
- reflex/components/el/elements/forms.py +4 -4
- reflex/components/el/elements/forms.pyi +224 -258
- reflex/components/el/elements/inline.pyi +421 -421
- reflex/components/el/elements/media.pyi +376 -376
- reflex/components/el/elements/metadata.pyi +91 -91
- reflex/components/el/elements/other.pyi +106 -106
- reflex/components/el/elements/scripts.pyi +46 -46
- reflex/components/el/elements/sectioning.pyi +226 -226
- reflex/components/el/elements/tables.pyi +151 -151
- reflex/components/el/elements/typography.pyi +226 -226
- reflex/components/gridjs/datatable.pyi +31 -31
- reflex/components/lucide/icon.py +46 -8
- reflex/components/lucide/icon.pyi +85 -31
- reflex/components/markdown/markdown.py +10 -8
- reflex/components/markdown/markdown.pyi +16 -16
- reflex/components/moment/moment.py +2 -2
- reflex/components/moment/moment.pyi +17 -19
- reflex/components/next/base.pyi +16 -16
- reflex/components/next/image.py +16 -4
- reflex/components/next/image.pyi +22 -20
- reflex/components/next/link.py +1 -1
- reflex/components/next/link.pyi +16 -16
- reflex/components/next/video.pyi +16 -16
- reflex/components/plotly/plotly.py +5 -5
- reflex/components/plotly/plotly.pyi +34 -44
- reflex/components/props.py +3 -3
- reflex/components/radix/__init__.pyi +1 -1
- reflex/components/radix/primitives/accordion.py +9 -5
- reflex/components/radix/primitives/accordion.pyi +110 -108
- reflex/components/radix/primitives/base.pyi +31 -31
- reflex/components/radix/primitives/drawer.py +5 -2
- reflex/components/radix/primitives/drawer.pyi +179 -187
- reflex/components/radix/primitives/form.pyi +160 -172
- reflex/components/radix/primitives/progress.py +1 -1
- reflex/components/radix/primitives/progress.pyi +76 -76
- reflex/components/radix/primitives/slider.py +1 -1
- reflex/components/radix/primitives/slider.pyi +78 -82
- reflex/components/radix/themes/base.pyi +121 -121
- reflex/components/radix/themes/color_mode.py +11 -9
- reflex/components/radix/themes/color_mode.pyi +47 -49
- reflex/components/radix/themes/components/alert_dialog.py +3 -0
- reflex/components/radix/themes/components/alert_dialog.pyi +110 -112
- reflex/components/radix/themes/components/aspect_ratio.pyi +16 -16
- reflex/components/radix/themes/components/avatar.pyi +16 -16
- reflex/components/radix/themes/components/badge.pyi +16 -16
- reflex/components/radix/themes/components/button.pyi +16 -16
- reflex/components/radix/themes/components/callout.pyi +76 -76
- reflex/components/radix/themes/components/card.py +1 -1
- reflex/components/radix/themes/components/card.pyi +17 -17
- reflex/components/radix/themes/components/checkbox.pyi +49 -55
- reflex/components/radix/themes/components/checkbox_cards.pyi +31 -31
- reflex/components/radix/themes/components/checkbox_group.pyi +31 -31
- reflex/components/radix/themes/components/context_menu.py +5 -0
- reflex/components/radix/themes/components/context_menu.pyi +149 -155
- reflex/components/radix/themes/components/data_list.pyi +61 -61
- reflex/components/radix/themes/components/dialog.py +3 -0
- reflex/components/radix/themes/components/dialog.pyi +113 -117
- reflex/components/radix/themes/components/dropdown_menu.py +5 -0
- reflex/components/radix/themes/components/dropdown_menu.pyi +133 -137
- reflex/components/radix/themes/components/hover_card.py +3 -0
- reflex/components/radix/themes/components/hover_card.pyi +63 -67
- reflex/components/radix/themes/components/icon_button.py +2 -2
- reflex/components/radix/themes/components/icon_button.pyi +17 -16
- reflex/components/radix/themes/components/inset.pyi +16 -16
- reflex/components/radix/themes/components/popover.py +3 -0
- reflex/components/radix/themes/components/popover.pyi +68 -70
- reflex/components/radix/themes/components/progress.pyi +16 -16
- reflex/components/radix/themes/components/radio.pyi +16 -16
- reflex/components/radix/themes/components/radio_cards.py +2 -0
- reflex/components/radix/themes/components/radio_cards.pyi +32 -34
- reflex/components/radix/themes/components/radio_group.py +1 -1
- reflex/components/radix/themes/components/radio_group.pyi +62 -64
- reflex/components/radix/themes/components/scroll_area.pyi +16 -16
- reflex/components/radix/themes/components/segmented_control.pyi +32 -35
- reflex/components/radix/themes/components/select.py +4 -0
- reflex/components/radix/themes/components/select.pyi +145 -157
- reflex/components/radix/themes/components/separator.pyi +16 -16
- reflex/components/radix/themes/components/skeleton.py +3 -0
- reflex/components/radix/themes/components/skeleton.pyi +16 -16
- reflex/components/radix/themes/components/slider.pyi +22 -28
- reflex/components/radix/themes/components/spinner.pyi +16 -16
- reflex/components/radix/themes/components/switch.pyi +17 -19
- reflex/components/radix/themes/components/table.pyi +106 -106
- reflex/components/radix/themes/components/tabs.py +3 -0
- reflex/components/radix/themes/components/tabs.pyi +78 -82
- reflex/components/radix/themes/components/text_area.py +12 -0
- reflex/components/radix/themes/components/text_area.pyi +21 -33
- reflex/components/radix/themes/components/text_field.py +1 -1
- reflex/components/radix/themes/components/text_field.pyi +52 -80
- reflex/components/radix/themes/components/tooltip.py +6 -1
- reflex/components/radix/themes/components/tooltip.pyi +20 -21
- reflex/components/radix/themes/layout/__init__.pyi +1 -1
- reflex/components/radix/themes/layout/base.pyi +16 -16
- reflex/components/radix/themes/layout/box.pyi +16 -16
- reflex/components/radix/themes/layout/center.pyi +16 -16
- reflex/components/radix/themes/layout/container.pyi +16 -16
- reflex/components/radix/themes/layout/flex.pyi +16 -16
- reflex/components/radix/themes/layout/grid.pyi +16 -16
- reflex/components/radix/themes/layout/list.py +2 -2
- reflex/components/radix/themes/layout/list.pyi +76 -76
- reflex/components/radix/themes/layout/section.pyi +16 -16
- reflex/components/radix/themes/layout/spacer.pyi +16 -16
- reflex/components/radix/themes/layout/stack.py +2 -2
- reflex/components/radix/themes/layout/stack.pyi +46 -46
- reflex/components/radix/themes/typography/blockquote.pyi +16 -16
- reflex/components/radix/themes/typography/code.pyi +16 -16
- reflex/components/radix/themes/typography/heading.pyi +16 -16
- reflex/components/radix/themes/typography/link.py +1 -1
- reflex/components/radix/themes/typography/link.pyi +16 -16
- reflex/components/radix/themes/typography/text.py +2 -2
- reflex/components/radix/themes/typography/text.pyi +106 -106
- reflex/components/react_player/audio.pyi +33 -39
- reflex/components/react_player/react_player.py +1 -1
- reflex/components/react_player/react_player.pyi +32 -38
- reflex/components/react_player/video.pyi +33 -39
- reflex/components/recharts/__init__.py +2 -0
- reflex/components/recharts/__init__.pyi +2 -0
- reflex/components/recharts/cartesian.pyi +282 -282
- reflex/components/recharts/charts.py +15 -15
- reflex/components/recharts/charts.pyi +164 -164
- reflex/components/recharts/general.py +19 -4
- reflex/components/recharts/general.pyi +132 -81
- reflex/components/recharts/polar.py +2 -2
- reflex/components/recharts/polar.pyi +55 -55
- reflex/components/recharts/recharts.py +4 -4
- reflex/components/recharts/recharts.pyi +31 -31
- reflex/components/sonner/toast.py +15 -13
- reflex/components/sonner/toast.pyi +22 -22
- reflex/components/suneditor/editor.py +6 -4
- reflex/components/suneditor/editor.pyi +26 -40
- reflex/components/tags/iter_tag.py +3 -3
- reflex/components/tags/tag.py +25 -3
- reflex/config.py +48 -15
- reflex/constants/__init__.py +1 -0
- reflex/constants/base.py +4 -1
- reflex/constants/compiler.py +5 -2
- reflex/constants/config.py +8 -1
- reflex/constants/installer.py +9 -9
- reflex/constants/style.py +1 -1
- reflex/custom_components/custom_components.py +9 -7
- reflex/event.py +215 -208
- reflex/experimental/__init__.py +19 -11
- reflex/experimental/client_state.py +53 -28
- reflex/experimental/hooks.py +5 -5
- reflex/experimental/layout.py +8 -5
- reflex/experimental/layout.pyi +79 -83
- reflex/experimental/misc.py +3 -3
- reflex/istate/wrappers.py +1 -1
- reflex/middleware/hydrate_middleware.py +2 -2
- reflex/model.py +11 -6
- reflex/page.py +5 -5
- reflex/reflex.py +90 -19
- reflex/route.py +1 -1
- reflex/state.py +358 -401
- reflex/style.py +27 -3
- reflex/testing.py +29 -23
- reflex/utils/build.py +6 -2
- reflex/utils/codespaces.py +1 -4
- reflex/utils/compat.py +6 -5
- reflex/utils/console.py +52 -16
- reflex/utils/exceptions.py +89 -26
- reflex/utils/exec.py +69 -74
- reflex/utils/export.py +6 -1
- reflex/utils/format.py +8 -40
- reflex/utils/imports.py +2 -2
- reflex/utils/lazy_loader.py +7 -1
- reflex/utils/path_ops.py +28 -14
- reflex/utils/prerequisites.py +326 -67
- reflex/utils/processes.py +45 -32
- reflex/utils/pyi_generator.py +39 -33
- reflex/utils/registry.py +4 -4
- reflex/utils/serializers.py +1 -1
- reflex/utils/telemetry.py +5 -4
- reflex/utils/types.py +42 -18
- reflex/vars/base.py +656 -333
- reflex/vars/datetime.py +6 -7
- reflex/vars/dep_tracking.py +344 -0
- reflex/vars/function.py +11 -5
- reflex/vars/number.py +31 -43
- reflex/vars/object.py +63 -62
- reflex/vars/sequence.py +79 -67
- {reflex-0.6.8a2.dist-info → reflex-0.7.0a2.dist-info}/METADATA +7 -8
- reflex-0.7.0a2.dist-info/RECORD +401 -0
- {reflex-0.6.8a2.dist-info → reflex-0.7.0a2.dist-info}/WHEEL +1 -1
- reflex/experimental/assets.py +0 -37
- reflex-0.6.8a2.dist-info/RECORD +0 -397
- {reflex-0.6.8a2.dist-info → reflex-0.7.0a2.dist-info}/LICENSE +0 -0
- {reflex-0.6.8a2.dist-info → reflex-0.7.0a2.dist-info}/entry_points.txt +0 -0
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
from typing import Any, Dict, List, Optional, Union, overload
|
|
7
7
|
|
|
8
8
|
from reflex.components.component import Component
|
|
9
|
-
from reflex.event import
|
|
9
|
+
from reflex.event import EventType
|
|
10
10
|
from reflex.style import Style
|
|
11
11
|
from reflex.utils.imports import ImportDict
|
|
12
12
|
from reflex.vars.base import Var
|
|
@@ -23,21 +23,21 @@ class Gridjs(Component):
|
|
|
23
23
|
class_name: Optional[Any] = None,
|
|
24
24
|
autofocus: Optional[bool] = None,
|
|
25
25
|
custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
|
|
26
|
-
on_blur: Optional[EventType[
|
|
27
|
-
on_click: Optional[EventType[
|
|
28
|
-
on_context_menu: Optional[EventType[
|
|
29
|
-
on_double_click: Optional[EventType[
|
|
30
|
-
on_focus: Optional[EventType[
|
|
31
|
-
on_mount: Optional[EventType[
|
|
32
|
-
on_mouse_down: Optional[EventType[
|
|
33
|
-
on_mouse_enter: Optional[EventType[
|
|
34
|
-
on_mouse_leave: Optional[EventType[
|
|
35
|
-
on_mouse_move: Optional[EventType[
|
|
36
|
-
on_mouse_out: Optional[EventType[
|
|
37
|
-
on_mouse_over: Optional[EventType[
|
|
38
|
-
on_mouse_up: Optional[EventType[
|
|
39
|
-
on_scroll: Optional[EventType[
|
|
40
|
-
on_unmount: Optional[EventType[
|
|
26
|
+
on_blur: Optional[EventType[()]] = None,
|
|
27
|
+
on_click: Optional[EventType[()]] = None,
|
|
28
|
+
on_context_menu: Optional[EventType[()]] = None,
|
|
29
|
+
on_double_click: Optional[EventType[()]] = None,
|
|
30
|
+
on_focus: Optional[EventType[()]] = None,
|
|
31
|
+
on_mount: Optional[EventType[()]] = None,
|
|
32
|
+
on_mouse_down: Optional[EventType[()]] = None,
|
|
33
|
+
on_mouse_enter: Optional[EventType[()]] = None,
|
|
34
|
+
on_mouse_leave: Optional[EventType[()]] = None,
|
|
35
|
+
on_mouse_move: Optional[EventType[()]] = None,
|
|
36
|
+
on_mouse_out: Optional[EventType[()]] = None,
|
|
37
|
+
on_mouse_over: Optional[EventType[()]] = None,
|
|
38
|
+
on_mouse_up: Optional[EventType[()]] = None,
|
|
39
|
+
on_scroll: Optional[EventType[()]] = None,
|
|
40
|
+
on_unmount: Optional[EventType[()]] = None,
|
|
41
41
|
**props,
|
|
42
42
|
) -> "Gridjs":
|
|
43
43
|
"""Create the component.
|
|
@@ -75,21 +75,21 @@ class DataTable(Gridjs):
|
|
|
75
75
|
class_name: Optional[Any] = None,
|
|
76
76
|
autofocus: Optional[bool] = None,
|
|
77
77
|
custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
|
|
78
|
-
on_blur: Optional[EventType[
|
|
79
|
-
on_click: Optional[EventType[
|
|
80
|
-
on_context_menu: Optional[EventType[
|
|
81
|
-
on_double_click: Optional[EventType[
|
|
82
|
-
on_focus: Optional[EventType[
|
|
83
|
-
on_mount: Optional[EventType[
|
|
84
|
-
on_mouse_down: Optional[EventType[
|
|
85
|
-
on_mouse_enter: Optional[EventType[
|
|
86
|
-
on_mouse_leave: Optional[EventType[
|
|
87
|
-
on_mouse_move: Optional[EventType[
|
|
88
|
-
on_mouse_out: Optional[EventType[
|
|
89
|
-
on_mouse_over: Optional[EventType[
|
|
90
|
-
on_mouse_up: Optional[EventType[
|
|
91
|
-
on_scroll: Optional[EventType[
|
|
92
|
-
on_unmount: Optional[EventType[
|
|
78
|
+
on_blur: Optional[EventType[()]] = None,
|
|
79
|
+
on_click: Optional[EventType[()]] = None,
|
|
80
|
+
on_context_menu: Optional[EventType[()]] = None,
|
|
81
|
+
on_double_click: Optional[EventType[()]] = None,
|
|
82
|
+
on_focus: Optional[EventType[()]] = None,
|
|
83
|
+
on_mount: Optional[EventType[()]] = None,
|
|
84
|
+
on_mouse_down: Optional[EventType[()]] = None,
|
|
85
|
+
on_mouse_enter: Optional[EventType[()]] = None,
|
|
86
|
+
on_mouse_leave: Optional[EventType[()]] = None,
|
|
87
|
+
on_mouse_move: Optional[EventType[()]] = None,
|
|
88
|
+
on_mouse_out: Optional[EventType[()]] = None,
|
|
89
|
+
on_mouse_over: Optional[EventType[()]] = None,
|
|
90
|
+
on_mouse_up: Optional[EventType[()]] = None,
|
|
91
|
+
on_scroll: Optional[EventType[()]] = None,
|
|
92
|
+
on_unmount: Optional[EventType[()]] = None,
|
|
93
93
|
**props,
|
|
94
94
|
) -> "DataTable":
|
|
95
95
|
"""Create a datatable component.
|
reflex/components/lucide/icon.py
CHANGED
|
@@ -2,13 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
from reflex.components.component import Component
|
|
4
4
|
from reflex.utils import format
|
|
5
|
-
from reflex.
|
|
5
|
+
from reflex.utils.imports import ImportVar
|
|
6
|
+
from reflex.vars.base import LiteralVar, Var
|
|
7
|
+
from reflex.vars.sequence import LiteralStringVar
|
|
6
8
|
|
|
7
9
|
|
|
8
10
|
class LucideIconComponent(Component):
|
|
9
11
|
"""Lucide Icon Component."""
|
|
10
12
|
|
|
11
|
-
library = "lucide-react@0.
|
|
13
|
+
library = "lucide-react@0.471.1"
|
|
12
14
|
|
|
13
15
|
|
|
14
16
|
class Icon(LucideIconComponent):
|
|
@@ -32,6 +34,7 @@ class Icon(LucideIconComponent):
|
|
|
32
34
|
Raises:
|
|
33
35
|
AttributeError: The errors tied to bad usage of the Icon component.
|
|
34
36
|
ValueError: If the icon tag is invalid.
|
|
37
|
+
TypeError: If the icon name is not a string.
|
|
35
38
|
|
|
36
39
|
Returns:
|
|
37
40
|
The created component.
|
|
@@ -39,7 +42,6 @@ class Icon(LucideIconComponent):
|
|
|
39
42
|
if children:
|
|
40
43
|
if len(children) == 1 and isinstance(children[0], str):
|
|
41
44
|
props["tag"] = children[0]
|
|
42
|
-
children = []
|
|
43
45
|
else:
|
|
44
46
|
raise AttributeError(
|
|
45
47
|
f"Passing multiple children to Icon component is not allowed: remove positional arguments {children[1:]} to fix"
|
|
@@ -47,19 +49,46 @@ class Icon(LucideIconComponent):
|
|
|
47
49
|
if "tag" not in props:
|
|
48
50
|
raise AttributeError("Missing 'tag' keyword-argument for Icon")
|
|
49
51
|
|
|
52
|
+
tag: str | Var | LiteralVar = props.pop("tag")
|
|
53
|
+
if isinstance(tag, LiteralVar):
|
|
54
|
+
if isinstance(tag, LiteralStringVar):
|
|
55
|
+
tag = tag._var_value
|
|
56
|
+
else:
|
|
57
|
+
raise TypeError(f"Icon name must be a string, got {type(tag)}")
|
|
58
|
+
elif isinstance(tag, Var):
|
|
59
|
+
return DynamicIcon.create(name=tag, **props)
|
|
60
|
+
|
|
50
61
|
if (
|
|
51
|
-
not isinstance(
|
|
52
|
-
or format.to_snake_case(
|
|
62
|
+
not isinstance(tag, str)
|
|
63
|
+
or format.to_snake_case(tag) not in LUCIDE_ICON_LIST
|
|
53
64
|
):
|
|
54
65
|
raise ValueError(
|
|
55
|
-
f"Invalid icon tag: {
|
|
66
|
+
f"Invalid icon tag: {tag}. Please use one of the following: {', '.join(LUCIDE_ICON_LIST[0:25])}, ..."
|
|
56
67
|
"\nSee full list at https://lucide.dev/icons."
|
|
57
68
|
)
|
|
58
69
|
|
|
59
|
-
|
|
70
|
+
if tag in LUCIDE_ICON_MAPPING_OVERRIDE:
|
|
71
|
+
props["tag"] = LUCIDE_ICON_MAPPING_OVERRIDE[tag]
|
|
72
|
+
else:
|
|
73
|
+
props["tag"] = format.to_title_case(format.to_snake_case(tag)) + "Icon"
|
|
60
74
|
props["alias"] = f"Lucide{props['tag']}"
|
|
61
75
|
props.setdefault("color", "var(--current-color)")
|
|
62
|
-
return super().create(
|
|
76
|
+
return super().create(**props)
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
class DynamicIcon(LucideIconComponent):
|
|
80
|
+
"""A DynamicIcon component."""
|
|
81
|
+
|
|
82
|
+
tag = "DynamicIcon"
|
|
83
|
+
|
|
84
|
+
name: Var[str]
|
|
85
|
+
|
|
86
|
+
def _get_imports(self):
|
|
87
|
+
_imports = super()._get_imports()
|
|
88
|
+
if self.library:
|
|
89
|
+
_imports.pop(self.library)
|
|
90
|
+
_imports["lucide-react/dynamic"] = [ImportVar("DynamicIcon", install=False)]
|
|
91
|
+
return _imports
|
|
63
92
|
|
|
64
93
|
|
|
65
94
|
LUCIDE_ICON_LIST = [
|
|
@@ -841,6 +870,7 @@ LUCIDE_ICON_LIST = [
|
|
|
841
870
|
"house",
|
|
842
871
|
"house_plug",
|
|
843
872
|
"house_plus",
|
|
873
|
+
"house_wifi",
|
|
844
874
|
"ice_cream_bowl",
|
|
845
875
|
"ice_cream_cone",
|
|
846
876
|
"id_card",
|
|
@@ -1529,6 +1559,7 @@ LUCIDE_ICON_LIST = [
|
|
|
1529
1559
|
"trending_up_down",
|
|
1530
1560
|
"triangle",
|
|
1531
1561
|
"triangle_alert",
|
|
1562
|
+
"triangle_dashed",
|
|
1532
1563
|
"triangle_right",
|
|
1533
1564
|
"trophy",
|
|
1534
1565
|
"truck",
|
|
@@ -1634,3 +1665,10 @@ LUCIDE_ICON_LIST = [
|
|
|
1634
1665
|
"zoom_in",
|
|
1635
1666
|
"zoom_out",
|
|
1636
1667
|
]
|
|
1668
|
+
|
|
1669
|
+
# The default transformation of some icon names doesn't match how the
|
|
1670
|
+
# icons are exported from Lucide. Manual overrides can go here.
|
|
1671
|
+
LUCIDE_ICON_MAPPING_OVERRIDE = {
|
|
1672
|
+
"grid_2x_2_check": "Grid2x2Check",
|
|
1673
|
+
"grid_2x_2_x": "Grid2x2X",
|
|
1674
|
+
}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
from typing import Any, Dict, Optional, Union, overload
|
|
7
7
|
|
|
8
8
|
from reflex.components.component import Component
|
|
9
|
-
from reflex.event import
|
|
9
|
+
from reflex.event import EventType
|
|
10
10
|
from reflex.style import Style
|
|
11
11
|
from reflex.vars.base import Var
|
|
12
12
|
|
|
@@ -22,21 +22,21 @@ class LucideIconComponent(Component):
|
|
|
22
22
|
class_name: Optional[Any] = None,
|
|
23
23
|
autofocus: Optional[bool] = None,
|
|
24
24
|
custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
|
|
25
|
-
on_blur: Optional[EventType[
|
|
26
|
-
on_click: Optional[EventType[
|
|
27
|
-
on_context_menu: Optional[EventType[
|
|
28
|
-
on_double_click: Optional[EventType[
|
|
29
|
-
on_focus: Optional[EventType[
|
|
30
|
-
on_mount: Optional[EventType[
|
|
31
|
-
on_mouse_down: Optional[EventType[
|
|
32
|
-
on_mouse_enter: Optional[EventType[
|
|
33
|
-
on_mouse_leave: Optional[EventType[
|
|
34
|
-
on_mouse_move: Optional[EventType[
|
|
35
|
-
on_mouse_out: Optional[EventType[
|
|
36
|
-
on_mouse_over: Optional[EventType[
|
|
37
|
-
on_mouse_up: Optional[EventType[
|
|
38
|
-
on_scroll: Optional[EventType[
|
|
39
|
-
on_unmount: Optional[EventType[
|
|
25
|
+
on_blur: Optional[EventType[()]] = None,
|
|
26
|
+
on_click: Optional[EventType[()]] = None,
|
|
27
|
+
on_context_menu: Optional[EventType[()]] = None,
|
|
28
|
+
on_double_click: Optional[EventType[()]] = None,
|
|
29
|
+
on_focus: Optional[EventType[()]] = None,
|
|
30
|
+
on_mount: Optional[EventType[()]] = None,
|
|
31
|
+
on_mouse_down: Optional[EventType[()]] = None,
|
|
32
|
+
on_mouse_enter: Optional[EventType[()]] = None,
|
|
33
|
+
on_mouse_leave: Optional[EventType[()]] = None,
|
|
34
|
+
on_mouse_move: Optional[EventType[()]] = None,
|
|
35
|
+
on_mouse_out: Optional[EventType[()]] = None,
|
|
36
|
+
on_mouse_over: Optional[EventType[()]] = None,
|
|
37
|
+
on_mouse_up: Optional[EventType[()]] = None,
|
|
38
|
+
on_scroll: Optional[EventType[()]] = None,
|
|
39
|
+
on_unmount: Optional[EventType[()]] = None,
|
|
40
40
|
**props,
|
|
41
41
|
) -> "LucideIconComponent":
|
|
42
42
|
"""Create the component.
|
|
@@ -69,21 +69,21 @@ class Icon(LucideIconComponent):
|
|
|
69
69
|
class_name: Optional[Any] = None,
|
|
70
70
|
autofocus: Optional[bool] = None,
|
|
71
71
|
custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
|
|
72
|
-
on_blur: Optional[EventType[
|
|
73
|
-
on_click: Optional[EventType[
|
|
74
|
-
on_context_menu: Optional[EventType[
|
|
75
|
-
on_double_click: Optional[EventType[
|
|
76
|
-
on_focus: Optional[EventType[
|
|
77
|
-
on_mount: Optional[EventType[
|
|
78
|
-
on_mouse_down: Optional[EventType[
|
|
79
|
-
on_mouse_enter: Optional[EventType[
|
|
80
|
-
on_mouse_leave: Optional[EventType[
|
|
81
|
-
on_mouse_move: Optional[EventType[
|
|
82
|
-
on_mouse_out: Optional[EventType[
|
|
83
|
-
on_mouse_over: Optional[EventType[
|
|
84
|
-
on_mouse_up: Optional[EventType[
|
|
85
|
-
on_scroll: Optional[EventType[
|
|
86
|
-
on_unmount: Optional[EventType[
|
|
72
|
+
on_blur: Optional[EventType[()]] = None,
|
|
73
|
+
on_click: Optional[EventType[()]] = None,
|
|
74
|
+
on_context_menu: Optional[EventType[()]] = None,
|
|
75
|
+
on_double_click: Optional[EventType[()]] = None,
|
|
76
|
+
on_focus: Optional[EventType[()]] = None,
|
|
77
|
+
on_mount: Optional[EventType[()]] = None,
|
|
78
|
+
on_mouse_down: Optional[EventType[()]] = None,
|
|
79
|
+
on_mouse_enter: Optional[EventType[()]] = None,
|
|
80
|
+
on_mouse_leave: Optional[EventType[()]] = None,
|
|
81
|
+
on_mouse_move: Optional[EventType[()]] = None,
|
|
82
|
+
on_mouse_out: Optional[EventType[()]] = None,
|
|
83
|
+
on_mouse_over: Optional[EventType[()]] = None,
|
|
84
|
+
on_mouse_up: Optional[EventType[()]] = None,
|
|
85
|
+
on_scroll: Optional[EventType[()]] = None,
|
|
86
|
+
on_unmount: Optional[EventType[()]] = None,
|
|
87
87
|
**props,
|
|
88
88
|
) -> "Icon":
|
|
89
89
|
"""Initialize the Icon component.
|
|
@@ -104,12 +104,60 @@ class Icon(LucideIconComponent):
|
|
|
104
104
|
Raises:
|
|
105
105
|
AttributeError: The errors tied to bad usage of the Icon component.
|
|
106
106
|
ValueError: If the icon tag is invalid.
|
|
107
|
+
TypeError: If the icon name is not a string.
|
|
107
108
|
|
|
108
109
|
Returns:
|
|
109
110
|
The created component.
|
|
110
111
|
"""
|
|
111
112
|
...
|
|
112
113
|
|
|
114
|
+
class DynamicIcon(LucideIconComponent):
|
|
115
|
+
@overload
|
|
116
|
+
@classmethod
|
|
117
|
+
def create( # type: ignore
|
|
118
|
+
cls,
|
|
119
|
+
*children,
|
|
120
|
+
name: Optional[Union[Var[str], str]] = None,
|
|
121
|
+
style: Optional[Style] = None,
|
|
122
|
+
key: Optional[Any] = None,
|
|
123
|
+
id: Optional[Any] = None,
|
|
124
|
+
class_name: Optional[Any] = None,
|
|
125
|
+
autofocus: Optional[bool] = None,
|
|
126
|
+
custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
|
|
127
|
+
on_blur: Optional[EventType[()]] = None,
|
|
128
|
+
on_click: Optional[EventType[()]] = None,
|
|
129
|
+
on_context_menu: Optional[EventType[()]] = None,
|
|
130
|
+
on_double_click: Optional[EventType[()]] = None,
|
|
131
|
+
on_focus: Optional[EventType[()]] = None,
|
|
132
|
+
on_mount: Optional[EventType[()]] = None,
|
|
133
|
+
on_mouse_down: Optional[EventType[()]] = None,
|
|
134
|
+
on_mouse_enter: Optional[EventType[()]] = None,
|
|
135
|
+
on_mouse_leave: Optional[EventType[()]] = None,
|
|
136
|
+
on_mouse_move: Optional[EventType[()]] = None,
|
|
137
|
+
on_mouse_out: Optional[EventType[()]] = None,
|
|
138
|
+
on_mouse_over: Optional[EventType[()]] = None,
|
|
139
|
+
on_mouse_up: Optional[EventType[()]] = None,
|
|
140
|
+
on_scroll: Optional[EventType[()]] = None,
|
|
141
|
+
on_unmount: Optional[EventType[()]] = None,
|
|
142
|
+
**props,
|
|
143
|
+
) -> "DynamicIcon":
|
|
144
|
+
"""Create the component.
|
|
145
|
+
|
|
146
|
+
Args:
|
|
147
|
+
*children: The children of the component.
|
|
148
|
+
style: The style of the component.
|
|
149
|
+
key: A unique key for the component.
|
|
150
|
+
id: The id for the component.
|
|
151
|
+
class_name: The class name for the component.
|
|
152
|
+
autofocus: Whether the component should take the focus once the page is loaded
|
|
153
|
+
custom_attrs: custom attribute
|
|
154
|
+
**props: The props of the component.
|
|
155
|
+
|
|
156
|
+
Returns:
|
|
157
|
+
The component.
|
|
158
|
+
"""
|
|
159
|
+
...
|
|
160
|
+
|
|
113
161
|
LUCIDE_ICON_LIST = [
|
|
114
162
|
"a_arrow_down",
|
|
115
163
|
"a_arrow_up",
|
|
@@ -889,6 +937,7 @@ LUCIDE_ICON_LIST = [
|
|
|
889
937
|
"house",
|
|
890
938
|
"house_plug",
|
|
891
939
|
"house_plus",
|
|
940
|
+
"house_wifi",
|
|
892
941
|
"ice_cream_bowl",
|
|
893
942
|
"ice_cream_cone",
|
|
894
943
|
"id_card",
|
|
@@ -1577,6 +1626,7 @@ LUCIDE_ICON_LIST = [
|
|
|
1577
1626
|
"trending_up_down",
|
|
1578
1627
|
"triangle",
|
|
1579
1628
|
"triangle_alert",
|
|
1629
|
+
"triangle_dashed",
|
|
1580
1630
|
"triangle_right",
|
|
1581
1631
|
"trophy",
|
|
1582
1632
|
"truck",
|
|
@@ -1682,3 +1732,7 @@ LUCIDE_ICON_LIST = [
|
|
|
1682
1732
|
"zoom_in",
|
|
1683
1733
|
"zoom_out",
|
|
1684
1734
|
]
|
|
1735
|
+
LUCIDE_ICON_MAPPING_OVERRIDE = {
|
|
1736
|
+
"grid_2x_2_check": "Grid2x2Check",
|
|
1737
|
+
"grid_2x_2_x": "Grid2x2X",
|
|
1738
|
+
}
|
|
@@ -8,7 +8,7 @@ from functools import lru_cache
|
|
|
8
8
|
from hashlib import md5
|
|
9
9
|
from typing import Any, Callable, Dict, Sequence, Union
|
|
10
10
|
|
|
11
|
-
from reflex.components.component import Component, CustomComponent
|
|
11
|
+
from reflex.components.component import BaseComponent, Component, CustomComponent
|
|
12
12
|
from reflex.components.tags.tag import Tag
|
|
13
13
|
from reflex.utils import types
|
|
14
14
|
from reflex.utils.imports import ImportDict, ImportVar
|
|
@@ -65,8 +65,8 @@ def get_base_component_map() -> dict[str, Callable]:
|
|
|
65
65
|
"h5": lambda value: Heading.create(value, as_="h5", size="2", margin_y="0.5em"),
|
|
66
66
|
"h6": lambda value: Heading.create(value, as_="h6", size="1", margin_y="0.5em"),
|
|
67
67
|
"p": lambda value: Text.create(value, margin_y="1em"),
|
|
68
|
-
"ul": lambda value: UnorderedList.create(value, margin_y="1em"),
|
|
69
|
-
"ol": lambda value: OrderedList.create(value, margin_y="1em"),
|
|
68
|
+
"ul": lambda value: UnorderedList.create(value, margin_y="1em"),
|
|
69
|
+
"ol": lambda value: OrderedList.create(value, margin_y="1em"),
|
|
70
70
|
"li": lambda value: ListItem.create(value, margin_y="0.5em"),
|
|
71
71
|
"a": lambda value: Link.create(value),
|
|
72
72
|
"code": lambda value: Code.create(value),
|
|
@@ -236,7 +236,7 @@ class Markdown(Component):
|
|
|
236
236
|
),
|
|
237
237
|
},
|
|
238
238
|
*[
|
|
239
|
-
component(_MOCK_ARG)._get_all_imports()
|
|
239
|
+
component(_MOCK_ARG)._get_all_imports()
|
|
240
240
|
for component in self.component_map.values()
|
|
241
241
|
],
|
|
242
242
|
]
|
|
@@ -327,7 +327,7 @@ const {_LANGUAGE!s} = match ? match[1] : '';
|
|
|
327
327
|
if tag != "codeblock"
|
|
328
328
|
# For codeblock, the mapping for some cases returns an array of elements. Let's join them into a string.
|
|
329
329
|
else ternary_operation(
|
|
330
|
-
ARRAY_ISARRAY.call(_CHILDREN), #
|
|
330
|
+
ARRAY_ISARRAY.call(_CHILDREN), # pyright: ignore [reportArgumentType]
|
|
331
331
|
_CHILDREN.to(list).join("\n"),
|
|
332
332
|
_CHILDREN,
|
|
333
333
|
).to(str)
|
|
@@ -379,7 +379,9 @@ const {_LANGUAGE!s} = match ? match[1] : '';
|
|
|
379
379
|
# fallback to the default fn Var creation if the component is not a MarkdownComponentMap.
|
|
380
380
|
return MarkdownComponentMap.create_map_fn_var(fn_body=formatted_component)
|
|
381
381
|
|
|
382
|
-
def _get_map_fn_custom_code_from_children(
|
|
382
|
+
def _get_map_fn_custom_code_from_children(
|
|
383
|
+
self, component: BaseComponent
|
|
384
|
+
) -> list[str]:
|
|
383
385
|
"""Recursively get markdown custom code from children components.
|
|
384
386
|
|
|
385
387
|
Args:
|
|
@@ -409,7 +411,7 @@ const {_LANGUAGE!s} = match ? match[1] : '';
|
|
|
409
411
|
return custom_code_list
|
|
410
412
|
|
|
411
413
|
@staticmethod
|
|
412
|
-
def _component_map_hash(component_map) -> str:
|
|
414
|
+
def _component_map_hash(component_map: dict) -> str:
|
|
413
415
|
inp = str(
|
|
414
416
|
{tag: component(_MOCK_ARG) for tag, component in component_map.items()}
|
|
415
417
|
).encode()
|
|
@@ -425,7 +427,7 @@ const {_LANGUAGE!s} = match ? match[1] : '';
|
|
|
425
427
|
for _component in self.component_map.values():
|
|
426
428
|
comp = _component(_MOCK_ARG)
|
|
427
429
|
hooks.update(comp._get_all_hooks())
|
|
428
|
-
formatted_hooks = MACROS.module.renderHooks(hooks) #
|
|
430
|
+
formatted_hooks = MACROS.module.renderHooks(hooks) # pyright: ignore [reportAttributeAccessIssue]
|
|
429
431
|
return f"""
|
|
430
432
|
function {self._get_component_map_name()} () {{
|
|
431
433
|
{formatted_hooks}
|
|
@@ -8,7 +8,7 @@ from functools import lru_cache
|
|
|
8
8
|
from typing import Any, Callable, Dict, Optional, Sequence, Union, overload
|
|
9
9
|
|
|
10
10
|
from reflex.components.component import Component
|
|
11
|
-
from reflex.event import
|
|
11
|
+
from reflex.event import EventType
|
|
12
12
|
from reflex.style import Style
|
|
13
13
|
from reflex.utils.imports import ImportDict
|
|
14
14
|
from reflex.vars.base import LiteralVar, Var
|
|
@@ -59,21 +59,21 @@ class Markdown(Component):
|
|
|
59
59
|
class_name: Optional[Any] = None,
|
|
60
60
|
autofocus: Optional[bool] = None,
|
|
61
61
|
custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
|
|
62
|
-
on_blur: Optional[EventType[
|
|
63
|
-
on_click: Optional[EventType[
|
|
64
|
-
on_context_menu: Optional[EventType[
|
|
65
|
-
on_double_click: Optional[EventType[
|
|
66
|
-
on_focus: Optional[EventType[
|
|
67
|
-
on_mount: Optional[EventType[
|
|
68
|
-
on_mouse_down: Optional[EventType[
|
|
69
|
-
on_mouse_enter: Optional[EventType[
|
|
70
|
-
on_mouse_leave: Optional[EventType[
|
|
71
|
-
on_mouse_move: Optional[EventType[
|
|
72
|
-
on_mouse_out: Optional[EventType[
|
|
73
|
-
on_mouse_over: Optional[EventType[
|
|
74
|
-
on_mouse_up: Optional[EventType[
|
|
75
|
-
on_scroll: Optional[EventType[
|
|
76
|
-
on_unmount: Optional[EventType[
|
|
62
|
+
on_blur: Optional[EventType[()]] = None,
|
|
63
|
+
on_click: Optional[EventType[()]] = None,
|
|
64
|
+
on_context_menu: Optional[EventType[()]] = None,
|
|
65
|
+
on_double_click: Optional[EventType[()]] = None,
|
|
66
|
+
on_focus: Optional[EventType[()]] = None,
|
|
67
|
+
on_mount: Optional[EventType[()]] = None,
|
|
68
|
+
on_mouse_down: Optional[EventType[()]] = None,
|
|
69
|
+
on_mouse_enter: Optional[EventType[()]] = None,
|
|
70
|
+
on_mouse_leave: Optional[EventType[()]] = None,
|
|
71
|
+
on_mouse_move: Optional[EventType[()]] = None,
|
|
72
|
+
on_mouse_out: Optional[EventType[()]] = None,
|
|
73
|
+
on_mouse_over: Optional[EventType[()]] = None,
|
|
74
|
+
on_mouse_up: Optional[EventType[()]] = None,
|
|
75
|
+
on_scroll: Optional[EventType[()]] = None,
|
|
76
|
+
on_unmount: Optional[EventType[()]] = None,
|
|
77
77
|
**props,
|
|
78
78
|
) -> "Markdown":
|
|
79
79
|
"""Create a markdown component.
|
|
@@ -28,9 +28,9 @@ class MomentDelta:
|
|
|
28
28
|
class Moment(NoSSRComponent):
|
|
29
29
|
"""The Moment component."""
|
|
30
30
|
|
|
31
|
-
tag: str = "Moment"
|
|
31
|
+
tag: str | None = "Moment"
|
|
32
32
|
is_default = True
|
|
33
|
-
library: str = "react-moment"
|
|
33
|
+
library: str | None = "react-moment"
|
|
34
34
|
lib_dependencies: List[str] = ["moment"]
|
|
35
35
|
|
|
36
36
|
# How often the date update (how often time update / 0 to disable).
|
|
@@ -8,7 +8,7 @@ from datetime import date, datetime, time, timedelta
|
|
|
8
8
|
from typing import Any, Dict, Optional, Union, overload
|
|
9
9
|
|
|
10
10
|
from reflex.components.component import NoSSRComponent
|
|
11
|
-
from reflex.event import
|
|
11
|
+
from reflex.event import EventType
|
|
12
12
|
from reflex.style import Style
|
|
13
13
|
from reflex.utils.imports import ImportDict
|
|
14
14
|
from reflex.vars.base import Var
|
|
@@ -68,24 +68,22 @@ class Moment(NoSSRComponent):
|
|
|
68
68
|
class_name: Optional[Any] = None,
|
|
69
69
|
autofocus: Optional[bool] = None,
|
|
70
70
|
custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
|
|
71
|
-
on_blur: Optional[EventType[
|
|
72
|
-
on_change: Optional[
|
|
73
|
-
|
|
74
|
-
] = None,
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
on_scroll: Optional[EventType[[], BASE_STATE]] = None,
|
|
88
|
-
on_unmount: Optional[EventType[[], BASE_STATE]] = None,
|
|
71
|
+
on_blur: Optional[EventType[()]] = None,
|
|
72
|
+
on_change: Optional[Union[EventType[()], EventType[str]]] = None,
|
|
73
|
+
on_click: Optional[EventType[()]] = None,
|
|
74
|
+
on_context_menu: Optional[EventType[()]] = None,
|
|
75
|
+
on_double_click: Optional[EventType[()]] = None,
|
|
76
|
+
on_focus: Optional[EventType[()]] = None,
|
|
77
|
+
on_mount: Optional[EventType[()]] = None,
|
|
78
|
+
on_mouse_down: Optional[EventType[()]] = None,
|
|
79
|
+
on_mouse_enter: Optional[EventType[()]] = None,
|
|
80
|
+
on_mouse_leave: Optional[EventType[()]] = None,
|
|
81
|
+
on_mouse_move: Optional[EventType[()]] = None,
|
|
82
|
+
on_mouse_out: Optional[EventType[()]] = None,
|
|
83
|
+
on_mouse_over: Optional[EventType[()]] = None,
|
|
84
|
+
on_mouse_up: Optional[EventType[()]] = None,
|
|
85
|
+
on_scroll: Optional[EventType[()]] = None,
|
|
86
|
+
on_unmount: Optional[EventType[()]] = None,
|
|
89
87
|
**props,
|
|
90
88
|
) -> "Moment":
|
|
91
89
|
"""Create the component.
|
reflex/components/next/base.pyi
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
from typing import Any, Dict, Optional, Union, overload
|
|
7
7
|
|
|
8
8
|
from reflex.components.component import Component
|
|
9
|
-
from reflex.event import
|
|
9
|
+
from reflex.event import EventType
|
|
10
10
|
from reflex.style import Style
|
|
11
11
|
from reflex.vars.base import Var
|
|
12
12
|
|
|
@@ -24,21 +24,21 @@ class NextComponent(Component):
|
|
|
24
24
|
class_name: Optional[Any] = None,
|
|
25
25
|
autofocus: Optional[bool] = None,
|
|
26
26
|
custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
|
|
27
|
-
on_blur: Optional[EventType[
|
|
28
|
-
on_click: Optional[EventType[
|
|
29
|
-
on_context_menu: Optional[EventType[
|
|
30
|
-
on_double_click: Optional[EventType[
|
|
31
|
-
on_focus: Optional[EventType[
|
|
32
|
-
on_mount: Optional[EventType[
|
|
33
|
-
on_mouse_down: Optional[EventType[
|
|
34
|
-
on_mouse_enter: Optional[EventType[
|
|
35
|
-
on_mouse_leave: Optional[EventType[
|
|
36
|
-
on_mouse_move: Optional[EventType[
|
|
37
|
-
on_mouse_out: Optional[EventType[
|
|
38
|
-
on_mouse_over: Optional[EventType[
|
|
39
|
-
on_mouse_up: Optional[EventType[
|
|
40
|
-
on_scroll: Optional[EventType[
|
|
41
|
-
on_unmount: Optional[EventType[
|
|
27
|
+
on_blur: Optional[EventType[()]] = None,
|
|
28
|
+
on_click: Optional[EventType[()]] = None,
|
|
29
|
+
on_context_menu: Optional[EventType[()]] = None,
|
|
30
|
+
on_double_click: Optional[EventType[()]] = None,
|
|
31
|
+
on_focus: Optional[EventType[()]] = None,
|
|
32
|
+
on_mount: Optional[EventType[()]] = None,
|
|
33
|
+
on_mouse_down: Optional[EventType[()]] = None,
|
|
34
|
+
on_mouse_enter: Optional[EventType[()]] = None,
|
|
35
|
+
on_mouse_leave: Optional[EventType[()]] = None,
|
|
36
|
+
on_mouse_move: Optional[EventType[()]] = None,
|
|
37
|
+
on_mouse_out: Optional[EventType[()]] = None,
|
|
38
|
+
on_mouse_over: Optional[EventType[()]] = None,
|
|
39
|
+
on_mouse_up: Optional[EventType[()]] = None,
|
|
40
|
+
on_scroll: Optional[EventType[()]] = None,
|
|
41
|
+
on_unmount: Optional[EventType[()]] = None,
|
|
42
42
|
**props,
|
|
43
43
|
) -> "NextComponent":
|
|
44
44
|
"""Create the component.
|
reflex/components/next/image.py
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
"""Image component from next/image."""
|
|
2
2
|
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
3
5
|
from typing import Any, Literal, Optional, Union
|
|
4
6
|
|
|
5
7
|
from reflex.event import EventHandler, no_args_event_spec
|
|
6
|
-
from reflex.utils import types
|
|
8
|
+
from reflex.utils import console, types
|
|
7
9
|
from reflex.vars.base import Var
|
|
8
10
|
|
|
9
11
|
from .base import NextComponent
|
|
10
12
|
|
|
13
|
+
DEFAULT_W_H = "100%"
|
|
14
|
+
|
|
11
15
|
|
|
12
16
|
class Image(NextComponent):
|
|
13
17
|
"""Display an image."""
|
|
@@ -53,7 +57,7 @@ class Image(NextComponent):
|
|
|
53
57
|
loading: Var[Literal["lazy", "eager"]]
|
|
54
58
|
|
|
55
59
|
# A Data URL to be used as a placeholder image before the src image successfully loads. Only takes effect when combined with placeholder="blur".
|
|
56
|
-
|
|
60
|
+
blur_data_url: Var[str]
|
|
57
61
|
|
|
58
62
|
# Fires when the image has loaded.
|
|
59
63
|
on_load: EventHandler[no_args_event_spec]
|
|
@@ -80,10 +84,18 @@ class Image(NextComponent):
|
|
|
80
84
|
Returns:
|
|
81
85
|
_type_: _description_
|
|
82
86
|
"""
|
|
87
|
+
if "blurDataURL" in props:
|
|
88
|
+
console.deprecate(
|
|
89
|
+
feature_name="blurDataURL",
|
|
90
|
+
reason="Use blur_data_url instead",
|
|
91
|
+
deprecation_version="0.7.0",
|
|
92
|
+
removal_version="0.8.0",
|
|
93
|
+
)
|
|
94
|
+
props["blur_data_url"] = props.pop("blurDataURL")
|
|
95
|
+
|
|
83
96
|
style = props.get("style", {})
|
|
84
|
-
DEFAULT_W_H = "100%"
|
|
85
97
|
|
|
86
|
-
def check_prop_type(prop_name, prop_value):
|
|
98
|
+
def check_prop_type(prop_name: str, prop_value: int | str | None):
|
|
87
99
|
if types.check_prop_in_allowed_types(prop_value, allowed_types=[int]):
|
|
88
100
|
props[prop_name] = prop_value
|
|
89
101
|
|