reflex 0.5.4a3__py3-none-any.whl → 0.5.5__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/apps/demo/code/demo.py +1 -0
- reflex/.templates/apps/demo/code/pages/__init__.py +1 -0
- reflex/.templates/apps/demo/code/pages/datatable.py +1 -0
- reflex/.templates/apps/demo/code/pages/forms.py +1 -0
- reflex/.templates/apps/demo/code/pages/graphing.py +1 -0
- reflex/.templates/apps/demo/code/pages/home.py +1 -0
- reflex/.templates/apps/demo/code/styles.py +1 -0
- reflex/.templates/apps/demo/code/webui/components/loading_icon.py +1 -8
- reflex/.templates/web/components/reflex/chakra_color_mode_provider.js +27 -12
- reflex/.templates/web/components/reflex/radix_themes_color_mode_provider.js +19 -5
- reflex/.templates/web/utils/state.js +73 -7
- reflex/__init__.py +3 -0
- reflex/__init__.pyi +3 -0
- reflex/admin.py +1 -0
- reflex/app.py +8 -6
- reflex/app_module_for_backend.py +2 -1
- reflex/base.py +4 -4
- reflex/compiler/compiler.py +4 -3
- reflex/compiler/templates.py +2 -0
- reflex/compiler/utils.py +58 -35
- reflex/components/__init__.py +1 -0
- reflex/components/base/__init__.py +1 -0
- reflex/components/base/app_wrap.py +1 -0
- reflex/components/base/fragment.py +1 -0
- reflex/components/base/link.py +0 -1
- reflex/components/base/script.py +11 -15
- reflex/components/base/script.pyi +1 -2
- reflex/components/chakra/base.py +15 -13
- reflex/components/chakra/base.pyi +3 -1
- reflex/components/chakra/datadisplay/code.py +1 -0
- reflex/components/chakra/datadisplay/divider.py +1 -0
- reflex/components/chakra/datadisplay/table.py +1 -0
- reflex/components/chakra/datadisplay/table.pyi +3 -0
- reflex/components/chakra/datadisplay/tag.py +1 -0
- reflex/components/chakra/disclosure/transition.py +1 -0
- reflex/components/chakra/feedback/circularprogress.py +1 -0
- reflex/components/chakra/forms/button.py +1 -0
- reflex/components/chakra/forms/checkbox.py +4 -13
- reflex/components/chakra/forms/checkbox.pyi +1 -3
- reflex/components/chakra/forms/colormodeswitch.py +1 -0
- reflex/components/chakra/forms/editable.py +13 -16
- reflex/components/chakra/forms/editable.pyi +1 -3
- reflex/components/chakra/forms/form.py +1 -0
- reflex/components/chakra/forms/input.py +22 -21
- reflex/components/chakra/forms/input.pyi +4 -4
- reflex/components/chakra/forms/multiselect.py +1 -0
- reflex/components/chakra/forms/numberinput.py +3 -12
- reflex/components/chakra/forms/numberinput.pyi +1 -3
- reflex/components/chakra/forms/pininput.py +8 -14
- reflex/components/chakra/forms/pininput.pyi +2 -3
- reflex/components/chakra/forms/radio.py +4 -13
- reflex/components/chakra/forms/radio.pyi +2 -3
- reflex/components/chakra/forms/rangeslider.py +10 -13
- reflex/components/chakra/forms/rangeslider.pyi +2 -3
- reflex/components/chakra/forms/select.py +4 -12
- reflex/components/chakra/forms/select.pyi +2 -3
- reflex/components/chakra/forms/slider.py +10 -13
- reflex/components/chakra/forms/slider.pyi +2 -3
- reflex/components/chakra/forms/switch.py +4 -13
- reflex/components/chakra/forms/switch.pyi +1 -3
- reflex/components/chakra/forms/textarea.py +16 -17
- reflex/components/chakra/forms/textarea.pyi +1 -3
- reflex/components/chakra/media/avatar.py +4 -12
- reflex/components/chakra/media/avatar.pyi +1 -2
- reflex/components/chakra/media/icon.py +1 -0
- reflex/components/chakra/media/image.py +7 -11
- reflex/components/chakra/media/image.pyi +2 -2
- reflex/components/chakra/navigation/link.py +8 -4
- reflex/components/chakra/navigation/link.pyi +2 -1
- reflex/components/chakra/overlay/alertdialog.py +12 -14
- reflex/components/chakra/overlay/alertdialog.pyi +1 -2
- reflex/components/chakra/overlay/drawer.py +12 -14
- reflex/components/chakra/overlay/drawer.pyi +1 -2
- reflex/components/chakra/overlay/menu.py +7 -11
- reflex/components/chakra/overlay/menu.pyi +2 -2
- reflex/components/chakra/overlay/modal.py +13 -13
- reflex/components/chakra/overlay/modal.pyi +2 -2
- reflex/components/chakra/overlay/popover.py +6 -12
- reflex/components/chakra/overlay/popover.pyi +1 -2
- reflex/components/chakra/overlay/tooltip.py +7 -13
- reflex/components/chakra/overlay/tooltip.pyi +1 -2
- reflex/components/chakra/typography/heading.py +0 -1
- reflex/components/chakra/typography/span.py +1 -0
- reflex/components/chakra/typography/text.py +1 -0
- reflex/components/component.py +70 -43
- reflex/components/core/__init__.py +1 -0
- reflex/components/core/banner.py +27 -24
- reflex/components/core/banner.pyi +6 -2
- reflex/components/core/client_side_routing.py +1 -0
- reflex/components/core/cond.py +19 -17
- reflex/components/core/debounce.py +4 -11
- reflex/components/core/debounce.pyi +1 -1
- reflex/components/core/foreach.py +1 -0
- reflex/components/core/html.py +1 -0
- reflex/components/core/match.py +9 -6
- reflex/components/core/upload.py +26 -25
- reflex/components/core/upload.pyi +3 -4
- reflex/components/datadisplay/__init__.py +1 -0
- reflex/components/datadisplay/code.py +27 -23
- reflex/components/datadisplay/code.pyi +4 -2
- reflex/components/datadisplay/dataeditor.py +73 -80
- reflex/components/datadisplay/dataeditor.pyi +52 -4
- reflex/components/datadisplay/logo.py +1 -0
- reflex/components/el/__init__.py +1 -0
- reflex/components/el/__init__.pyi +8 -0
- reflex/components/el/element.py +0 -1
- reflex/components/el/elements/__init__.py +5 -0
- reflex/components/el/elements/__init__.pyi +12 -1
- reflex/components/el/elements/base.py +1 -0
- reflex/components/el/elements/forms.py +44 -61
- reflex/components/el/elements/forms.pyi +4 -6
- reflex/components/el/elements/inline.py +1 -0
- reflex/components/el/elements/media.py +53 -0
- reflex/components/el/elements/media.pyi +428 -0
- reflex/components/el/elements/metadata.py +11 -0
- reflex/components/el/elements/metadata.pyi +80 -0
- reflex/components/el/elements/other.py +1 -0
- reflex/components/el/elements/scripts.py +1 -0
- reflex/components/el/elements/tables.py +1 -0
- reflex/components/el/elements/typography.py +1 -0
- reflex/components/gridjs/datatable.py +9 -6
- reflex/components/gridjs/datatable.pyi +4 -1
- reflex/components/markdown/markdown.py +36 -41
- reflex/components/markdown/markdown.pyi +4 -3
- reflex/components/media/icon.py +1 -0
- reflex/components/moment/moment.py +11 -17
- reflex/components/moment/moment.pyi +4 -3
- reflex/components/next/base.py +1 -0
- reflex/components/next/image.py +6 -11
- reflex/components/next/image.pyi +2 -2
- reflex/components/plotly/plotly.py +1 -0
- reflex/components/props.py +1 -0
- reflex/components/radix/__init__.py +1 -0
- reflex/components/radix/primitives/__init__.py +1 -0
- reflex/components/radix/primitives/accordion.py +7 -15
- reflex/components/radix/primitives/accordion.pyi +7 -4
- reflex/components/radix/primitives/base.py +1 -0
- reflex/components/radix/primitives/drawer.py +17 -27
- reflex/components/radix/primitives/drawer.pyi +2 -4
- reflex/components/radix/primitives/form.py +4 -12
- reflex/components/radix/primitives/form.pyi +2 -3
- reflex/components/radix/primitives/slider.py +6 -11
- reflex/components/radix/primitives/slider.pyi +2 -2
- reflex/components/radix/themes/__init__.py +1 -0
- reflex/components/radix/themes/base.py +3 -3
- reflex/components/radix/themes/base.pyi +3 -2
- reflex/components/radix/themes/color_mode.py +31 -2
- reflex/components/radix/themes/color_mode.pyi +10 -1
- reflex/components/radix/themes/components/__init__.py +1 -0
- reflex/components/radix/themes/components/alert_dialog.py +13 -24
- reflex/components/radix/themes/components/alert_dialog.pyi +2 -4
- reflex/components/radix/themes/components/aspect_ratio.py +1 -0
- reflex/components/radix/themes/components/card.py +1 -0
- reflex/components/radix/themes/components/checkbox.py +6 -22
- reflex/components/radix/themes/components/checkbox.pyi +2 -4
- reflex/components/radix/themes/components/checkbox_group.py +15 -3
- reflex/components/radix/themes/components/checkbox_group.pyi +10 -2
- reflex/components/radix/themes/components/context_menu.py +29 -38
- reflex/components/radix/themes/components/context_menu.pyi +2 -5
- reflex/components/radix/themes/components/dialog.py +18 -26
- reflex/components/radix/themes/components/dialog.pyi +2 -4
- reflex/components/radix/themes/components/dropdown_menu.py +32 -57
- reflex/components/radix/themes/components/dropdown_menu.pyi +2 -7
- reflex/components/radix/themes/components/hover_card.py +5 -12
- reflex/components/radix/themes/components/hover_card.pyi +2 -3
- reflex/components/radix/themes/components/icon_button.py +1 -0
- reflex/components/radix/themes/components/icon_button.pyi +1 -0
- reflex/components/radix/themes/components/inset.py +1 -0
- reflex/components/radix/themes/components/popover.py +22 -27
- reflex/components/radix/themes/components/popover.pyi +2 -4
- reflex/components/radix/themes/components/radio_group.py +25 -17
- reflex/components/radix/themes/components/radio_group.pyi +2 -3
- reflex/components/radix/themes/components/scroll_area.py +1 -0
- reflex/components/radix/themes/components/segmented_control.py +18 -5
- reflex/components/radix/themes/components/segmented_control.pyi +16 -7
- reflex/components/radix/themes/components/select.py +13 -23
- reflex/components/radix/themes/components/select.pyi +1 -4
- reflex/components/radix/themes/components/separator.py +1 -0
- reflex/components/radix/themes/components/slider.py +7 -12
- reflex/components/radix/themes/components/slider.pyi +2 -3
- reflex/components/radix/themes/components/switch.py +5 -12
- reflex/components/radix/themes/components/switch.pyi +2 -3
- reflex/components/radix/themes/components/table.py +1 -0
- reflex/components/radix/themes/components/tabs.py +4 -11
- reflex/components/radix/themes/components/tabs.pyi +2 -2
- reflex/components/radix/themes/components/text_area.py +19 -18
- reflex/components/radix/themes/components/text_area.pyi +2 -3
- reflex/components/radix/themes/components/text_field.py +19 -18
- reflex/components/radix/themes/components/text_field.pyi +3 -3
- reflex/components/radix/themes/components/tooltip.py +10 -13
- reflex/components/radix/themes/components/tooltip.pyi +2 -3
- reflex/components/radix/themes/layout/__init__.py +1 -0
- reflex/components/radix/themes/layout/box.py +1 -0
- reflex/components/radix/themes/layout/container.py +1 -0
- reflex/components/radix/themes/layout/list.py +1 -0
- reflex/components/radix/themes/layout/list.pyi +1 -0
- reflex/components/radix/themes/layout/section.py +1 -0
- reflex/components/radix/themes/typography/__init__.py +1 -0
- reflex/components/radix/themes/typography/base.py +1 -0
- reflex/components/radix/themes/typography/blockquote.py +1 -0
- reflex/components/radix/themes/typography/code.py +1 -0
- reflex/components/radix/themes/typography/heading.py +1 -0
- reflex/components/radix/themes/typography/link.py +8 -3
- reflex/components/radix/themes/typography/link.pyi +2 -1
- reflex/components/react_player/audio.py +1 -0
- reflex/components/react_player/audio.pyi +48 -0
- reflex/components/react_player/react_player.py +49 -0
- reflex/components/react_player/react_player.pyi +49 -0
- reflex/components/react_player/video.py +1 -0
- reflex/components/react_player/video.pyi +48 -0
- reflex/components/recharts/__init__.py +1 -0
- reflex/components/recharts/cartesian.py +264 -74
- reflex/components/recharts/cartesian.pyi +573 -58
- reflex/components/recharts/charts.py +68 -78
- reflex/components/recharts/charts.pyi +373 -156
- reflex/components/recharts/general.py +52 -20
- reflex/components/recharts/general.pyi +52 -6
- reflex/components/recharts/polar.py +30 -18
- reflex/components/recharts/polar.pyi +66 -5
- reflex/components/recharts/recharts.py +5 -3
- reflex/components/recharts/recharts.pyi +2 -1
- reflex/components/sonner/toast.py +2 -2
- reflex/components/sonner/toast.pyi +1 -1
- reflex/components/suneditor/editor.py +39 -26
- reflex/components/suneditor/editor.pyi +4 -4
- reflex/components/tags/iter_tag.py +1 -0
- reflex/constants/__init__.py +3 -2
- reflex/constants/base.py +20 -21
- reflex/constants/compiler.py +3 -1
- reflex/constants/config.py +1 -0
- reflex/constants/event.py +1 -0
- reflex/constants/installer.py +3 -2
- reflex/constants/style.py +2 -8
- reflex/event.py +36 -6
- reflex/experimental/assets.py +1 -0
- reflex/experimental/client_state.py +9 -3
- reflex/experimental/hooks.py +1 -0
- reflex/experimental/misc.py +12 -3
- reflex/middleware/hydrate_middleware.py +1 -0
- reflex/middleware/middleware.py +1 -0
- reflex/state.py +38 -1
- reflex/style.py +67 -20
- reflex/testing.py +6 -2
- reflex/utils/build.py +76 -72
- reflex/utils/exec.py +17 -9
- reflex/utils/export.py +13 -9
- reflex/utils/imports.py +34 -5
- reflex/utils/lazy_loader.py +1 -0
- reflex/utils/path_ops.py +39 -33
- reflex/utils/prerequisites.py +38 -29
- reflex/utils/processes.py +1 -1
- reflex/utils/serializers.py +3 -6
- reflex/utils/watch.py +3 -1
- reflex/vars.py +26 -10
- reflex/vars.pyi +3 -3
- {reflex-0.5.4a3.dist-info → reflex-0.5.5.dist-info}/METADATA +3 -3
- {reflex-0.5.4a3.dist-info → reflex-0.5.5.dist-info}/RECORD +260 -260
- {reflex-0.5.4a3.dist-info → reflex-0.5.5.dist-info}/LICENSE +0 -0
- {reflex-0.5.4a3.dist-info → reflex-0.5.5.dist-info}/WHEEL +0 -0
- {reflex-0.5.4a3.dist-info → reflex-0.5.5.dist-info}/entry_points.txt +0 -0
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
"""An input component."""
|
|
2
2
|
|
|
3
|
-
from typing import Any, Dict
|
|
4
|
-
|
|
5
3
|
from reflex.components.chakra import (
|
|
6
4
|
ChakraComponent,
|
|
7
5
|
LiteralButtonSize,
|
|
@@ -10,8 +8,9 @@ from reflex.components.chakra import (
|
|
|
10
8
|
from reflex.components.component import Component
|
|
11
9
|
from reflex.components.core.debounce import DebounceInput
|
|
12
10
|
from reflex.components.literals import LiteralInputType
|
|
13
|
-
from reflex.constants import
|
|
14
|
-
from reflex.
|
|
11
|
+
from reflex.constants import MemoizationMode
|
|
12
|
+
from reflex.event import EventHandler
|
|
13
|
+
from reflex.utils.imports import ImportDict
|
|
15
14
|
from reflex.vars import Var
|
|
16
15
|
|
|
17
16
|
|
|
@@ -59,26 +58,28 @@ class Input(ChakraComponent):
|
|
|
59
58
|
# The name of the form field
|
|
60
59
|
name: Var[str]
|
|
61
60
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
61
|
+
# Fired when the input value changes.
|
|
62
|
+
on_change: EventHandler[lambda e0: [e0.target.value]]
|
|
63
|
+
|
|
64
|
+
# Fired when the input is focused.
|
|
65
|
+
on_focus: EventHandler[lambda e0: [e0.target.value]]
|
|
66
|
+
|
|
67
|
+
# Fired when the input lose focus.
|
|
68
|
+
on_blur: EventHandler[lambda e0: [e0.target.value]]
|
|
69
|
+
|
|
70
|
+
# Fired when a key is pressed down.
|
|
71
|
+
on_key_down: EventHandler[lambda e0: [e0.key]]
|
|
72
|
+
|
|
73
|
+
# Fired when a key is released.
|
|
74
|
+
on_key_up: EventHandler[lambda e0: [e0.key]]
|
|
67
75
|
|
|
68
|
-
def
|
|
69
|
-
"""
|
|
76
|
+
def add_imports(self) -> ImportDict:
|
|
77
|
+
"""Add imports for the Input component.
|
|
70
78
|
|
|
71
79
|
Returns:
|
|
72
|
-
|
|
80
|
+
The import dict.
|
|
73
81
|
"""
|
|
74
|
-
return {
|
|
75
|
-
**super().get_event_triggers(),
|
|
76
|
-
EventTriggers.ON_CHANGE: lambda e0: [e0.target.value],
|
|
77
|
-
EventTriggers.ON_FOCUS: lambda e0: [e0.target.value],
|
|
78
|
-
EventTriggers.ON_BLUR: lambda e0: [e0.target.value],
|
|
79
|
-
EventTriggers.ON_KEY_DOWN: lambda e0: [e0.key],
|
|
80
|
-
EventTriggers.ON_KEY_UP: lambda e0: [e0.key],
|
|
81
|
-
}
|
|
82
|
+
return {"/utils/state": "set_val"}
|
|
82
83
|
|
|
83
84
|
@classmethod
|
|
84
85
|
def create(cls, *children, **props) -> Component:
|
|
@@ -91,7 +92,7 @@ class Input(ChakraComponent):
|
|
|
91
92
|
Returns:
|
|
92
93
|
The component.
|
|
93
94
|
"""
|
|
94
|
-
if props.get("value") is not None and props.get("on_change"):
|
|
95
|
+
if props.get("value") is not None and props.get("on_change") is not None:
|
|
95
96
|
# create a debounced input if the user requests full control to avoid typing jank
|
|
96
97
|
return DebounceInput.create(super().create(*children, **props))
|
|
97
98
|
return super().create(*children, **props)
|
|
@@ -7,7 +7,6 @@ from typing import Any, Dict, Literal, Optional, Union, overload
|
|
|
7
7
|
from reflex.vars import Var, BaseVar, ComputedVar
|
|
8
8
|
from reflex.event import EventChain, EventHandler, EventSpec
|
|
9
9
|
from reflex.style import Style
|
|
10
|
-
from typing import Any, Dict
|
|
11
10
|
from reflex.components.chakra import (
|
|
12
11
|
ChakraComponent,
|
|
13
12
|
LiteralButtonSize,
|
|
@@ -16,12 +15,13 @@ from reflex.components.chakra import (
|
|
|
16
15
|
from reflex.components.component import Component
|
|
17
16
|
from reflex.components.core.debounce import DebounceInput
|
|
18
17
|
from reflex.components.literals import LiteralInputType
|
|
19
|
-
from reflex.constants import
|
|
20
|
-
from reflex.
|
|
18
|
+
from reflex.constants import MemoizationMode
|
|
19
|
+
from reflex.event import EventHandler
|
|
20
|
+
from reflex.utils.imports import ImportDict
|
|
21
21
|
from reflex.vars import Var
|
|
22
22
|
|
|
23
23
|
class Input(ChakraComponent):
|
|
24
|
-
def
|
|
24
|
+
def add_imports(self) -> ImportDict: ...
|
|
25
25
|
@overload
|
|
26
26
|
@classmethod
|
|
27
27
|
def create( # type: ignore
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"""A number input component."""
|
|
2
2
|
|
|
3
3
|
from numbers import Number
|
|
4
|
-
from typing import Any, Dict
|
|
5
4
|
|
|
6
5
|
from reflex.components.chakra import (
|
|
7
6
|
ChakraComponent,
|
|
@@ -9,7 +8,7 @@ from reflex.components.chakra import (
|
|
|
9
8
|
LiteralInputVariant,
|
|
10
9
|
)
|
|
11
10
|
from reflex.components.component import Component
|
|
12
|
-
from reflex.
|
|
11
|
+
from reflex.event import EventHandler
|
|
13
12
|
from reflex.vars import Var
|
|
14
13
|
|
|
15
14
|
|
|
@@ -75,16 +74,8 @@ class NumberInput(ChakraComponent):
|
|
|
75
74
|
# The name of the form field
|
|
76
75
|
name: Var[str]
|
|
77
76
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
Returns:
|
|
82
|
-
A dict mapping the event trigger to the var that is passed to the handler.
|
|
83
|
-
"""
|
|
84
|
-
return {
|
|
85
|
-
**super().get_event_triggers(),
|
|
86
|
-
EventTriggers.ON_CHANGE: lambda e0: [e0],
|
|
87
|
-
}
|
|
77
|
+
# Fired when the input value changes.
|
|
78
|
+
on_change: EventHandler[lambda e0: [e0]]
|
|
88
79
|
|
|
89
80
|
@classmethod
|
|
90
81
|
def create(cls, *children, **props) -> Component:
|
|
@@ -8,18 +8,16 @@ from reflex.vars import Var, BaseVar, ComputedVar
|
|
|
8
8
|
from reflex.event import EventChain, EventHandler, EventSpec
|
|
9
9
|
from reflex.style import Style
|
|
10
10
|
from numbers import Number
|
|
11
|
-
from typing import Any, Dict
|
|
12
11
|
from reflex.components.chakra import (
|
|
13
12
|
ChakraComponent,
|
|
14
13
|
LiteralButtonSize,
|
|
15
14
|
LiteralInputVariant,
|
|
16
15
|
)
|
|
17
16
|
from reflex.components.component import Component
|
|
18
|
-
from reflex.
|
|
17
|
+
from reflex.event import EventHandler
|
|
19
18
|
from reflex.vars import Var
|
|
20
19
|
|
|
21
20
|
class NumberInput(ChakraComponent):
|
|
22
|
-
def get_event_triggers(self) -> Dict[str, Any]: ...
|
|
23
21
|
@overload
|
|
24
22
|
@classmethod
|
|
25
23
|
def create( # type: ignore
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
-
from typing import
|
|
5
|
+
from typing import Optional
|
|
6
6
|
|
|
7
7
|
from reflex.components.chakra import ChakraComponent, LiteralInputVariant
|
|
8
8
|
from reflex.components.component import Component
|
|
9
9
|
from reflex.components.tags.tag import Tag
|
|
10
|
-
from reflex.
|
|
10
|
+
from reflex.event import EventHandler
|
|
11
11
|
from reflex.utils import format
|
|
12
12
|
from reflex.utils.imports import ImportDict, merge_imports
|
|
13
13
|
from reflex.vars import Var
|
|
@@ -63,6 +63,12 @@ class PinInput(ChakraComponent):
|
|
|
63
63
|
# The name of the form field
|
|
64
64
|
name: Var[str]
|
|
65
65
|
|
|
66
|
+
# Fired when the pin input is changed.
|
|
67
|
+
on_change: EventHandler[lambda e0: [e0]]
|
|
68
|
+
|
|
69
|
+
# Fired when the pin input is completed.
|
|
70
|
+
on_complete: EventHandler[lambda e0: [e0]]
|
|
71
|
+
|
|
66
72
|
def _get_imports(self) -> ImportDict:
|
|
67
73
|
"""Include PinInputField explicitly because it may not be a child component at compile time.
|
|
68
74
|
|
|
@@ -76,18 +82,6 @@ class PinInput(ChakraComponent):
|
|
|
76
82
|
range_var._var_data.imports if range_var._var_data is not None else {},
|
|
77
83
|
)
|
|
78
84
|
|
|
79
|
-
def get_event_triggers(self) -> dict[str, Union[Var, Any]]:
|
|
80
|
-
"""Get the event triggers that pass the component's value to the handler.
|
|
81
|
-
|
|
82
|
-
Returns:
|
|
83
|
-
A dict mapping the event trigger to the var that is passed to the handler.
|
|
84
|
-
"""
|
|
85
|
-
return {
|
|
86
|
-
**super().get_event_triggers(),
|
|
87
|
-
EventTriggers.ON_CHANGE: lambda e0: [e0],
|
|
88
|
-
EventTriggers.ON_COMPLETE: lambda e0: [e0],
|
|
89
|
-
}
|
|
90
|
-
|
|
91
85
|
def get_ref(self) -> str | None:
|
|
92
86
|
"""Override ref handling to handle array refs.
|
|
93
87
|
|
|
@@ -7,17 +7,16 @@ from typing import Any, Dict, Literal, Optional, Union, overload
|
|
|
7
7
|
from reflex.vars import Var, BaseVar, ComputedVar
|
|
8
8
|
from reflex.event import EventChain, EventHandler, EventSpec
|
|
9
9
|
from reflex.style import Style
|
|
10
|
-
from typing import
|
|
10
|
+
from typing import Optional
|
|
11
11
|
from reflex.components.chakra import ChakraComponent, LiteralInputVariant
|
|
12
12
|
from reflex.components.component import Component
|
|
13
13
|
from reflex.components.tags.tag import Tag
|
|
14
|
-
from reflex.
|
|
14
|
+
from reflex.event import EventHandler
|
|
15
15
|
from reflex.utils import format
|
|
16
16
|
from reflex.utils.imports import ImportDict, merge_imports
|
|
17
17
|
from reflex.vars import Var
|
|
18
18
|
|
|
19
19
|
class PinInput(ChakraComponent):
|
|
20
|
-
def get_event_triggers(self) -> dict[str, Union[Var, Any]]: ...
|
|
21
20
|
def get_ref(self) -> str | None: ...
|
|
22
21
|
@overload
|
|
23
22
|
@classmethod
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
"""A radio component."""
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
from typing import Any, Dict, List, Union
|
|
3
|
+
from typing import Any, List
|
|
5
4
|
|
|
6
5
|
from reflex.components.chakra import ChakraComponent
|
|
7
6
|
from reflex.components.chakra.typography.text import Text
|
|
8
7
|
from reflex.components.component import Component
|
|
9
8
|
from reflex.components.core.foreach import Foreach
|
|
10
|
-
from reflex.
|
|
9
|
+
from reflex.event import EventHandler
|
|
11
10
|
from reflex.utils.types import _issubclass
|
|
12
11
|
from reflex.vars import Var
|
|
13
12
|
|
|
@@ -26,16 +25,8 @@ class RadioGroup(ChakraComponent):
|
|
|
26
25
|
# The name of the form field
|
|
27
26
|
name: Var[str]
|
|
28
27
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
Returns:
|
|
33
|
-
A dict mapping the event trigger to the var that is passed to the handler.
|
|
34
|
-
"""
|
|
35
|
-
return {
|
|
36
|
-
**super().get_event_triggers(),
|
|
37
|
-
EventTriggers.ON_CHANGE: lambda e0: [e0],
|
|
38
|
-
}
|
|
28
|
+
# Fired when the radio group value changes.
|
|
29
|
+
on_change: EventHandler[lambda e0: [e0]]
|
|
39
30
|
|
|
40
31
|
@classmethod
|
|
41
32
|
def create(cls, *children, **props) -> Component:
|
|
@@ -7,17 +7,16 @@ from typing import Any, Dict, Literal, Optional, Union, overload
|
|
|
7
7
|
from reflex.vars import Var, BaseVar, ComputedVar
|
|
8
8
|
from reflex.event import EventChain, EventHandler, EventSpec
|
|
9
9
|
from reflex.style import Style
|
|
10
|
-
from typing import Any,
|
|
10
|
+
from typing import Any, List
|
|
11
11
|
from reflex.components.chakra import ChakraComponent
|
|
12
12
|
from reflex.components.chakra.typography.text import Text
|
|
13
13
|
from reflex.components.component import Component
|
|
14
14
|
from reflex.components.core.foreach import Foreach
|
|
15
|
-
from reflex.
|
|
15
|
+
from reflex.event import EventHandler
|
|
16
16
|
from reflex.utils.types import _issubclass
|
|
17
17
|
from reflex.vars import Var
|
|
18
18
|
|
|
19
19
|
class RadioGroup(ChakraComponent):
|
|
20
|
-
def get_event_triggers(self) -> Dict[str, Union[Var, Any]]: ...
|
|
21
20
|
@overload
|
|
22
21
|
@classmethod
|
|
23
22
|
def create( # type: ignore
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"""A range slider component."""
|
|
2
|
+
|
|
2
3
|
from __future__ import annotations
|
|
3
4
|
|
|
4
|
-
from typing import
|
|
5
|
+
from typing import List, Optional
|
|
5
6
|
|
|
6
7
|
from reflex.components.chakra import ChakraComponent, LiteralChakraDirection
|
|
7
8
|
from reflex.components.component import Component
|
|
8
|
-
from reflex.
|
|
9
|
+
from reflex.event import EventHandler
|
|
9
10
|
from reflex.utils import format
|
|
10
11
|
from reflex.vars import Var
|
|
11
12
|
|
|
@@ -48,18 +49,14 @@ class RangeSlider(ChakraComponent):
|
|
|
48
49
|
# The name of the form field
|
|
49
50
|
name: Var[str]
|
|
50
51
|
|
|
51
|
-
|
|
52
|
-
|
|
52
|
+
# Fired when the value changes.
|
|
53
|
+
on_change: EventHandler[lambda e0: [e0]]
|
|
53
54
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
EventTriggers.ON_CHANGE: lambda e0: [e0],
|
|
60
|
-
EventTriggers.ON_CHANGE_END: lambda e0: [e0],
|
|
61
|
-
EventTriggers.ON_CHANGE_START: lambda e0: [e0],
|
|
62
|
-
}
|
|
55
|
+
# Fired when the value starts changing.
|
|
56
|
+
on_change_start: EventHandler[lambda e0: [e0]]
|
|
57
|
+
|
|
58
|
+
# Fired when the value stops changing.
|
|
59
|
+
on_change_end: EventHandler[lambda e0: [e0]]
|
|
63
60
|
|
|
64
61
|
def get_ref(self):
|
|
65
62
|
"""Get the ref of the component.
|
|
@@ -7,15 +7,14 @@ from typing import Any, Dict, Literal, Optional, Union, overload
|
|
|
7
7
|
from reflex.vars import Var, BaseVar, ComputedVar
|
|
8
8
|
from reflex.event import EventChain, EventHandler, EventSpec
|
|
9
9
|
from reflex.style import Style
|
|
10
|
-
from typing import
|
|
10
|
+
from typing import List, Optional
|
|
11
11
|
from reflex.components.chakra import ChakraComponent, LiteralChakraDirection
|
|
12
12
|
from reflex.components.component import Component
|
|
13
|
-
from reflex.
|
|
13
|
+
from reflex.event import EventHandler
|
|
14
14
|
from reflex.utils import format
|
|
15
15
|
from reflex.vars import Var
|
|
16
16
|
|
|
17
17
|
class RangeSlider(ChakraComponent):
|
|
18
|
-
def get_event_triggers(self) -> dict[str, Union[Var, Any]]: ...
|
|
19
18
|
def get_ref(self): ...
|
|
20
19
|
@overload
|
|
21
20
|
@classmethod
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"""A select component."""
|
|
2
2
|
|
|
3
|
-
from typing import Any,
|
|
3
|
+
from typing import Any, List
|
|
4
4
|
|
|
5
5
|
from reflex.components.chakra import ChakraComponent, LiteralInputVariant
|
|
6
6
|
from reflex.components.chakra.typography.text import Text
|
|
7
7
|
from reflex.components.component import Component
|
|
8
8
|
from reflex.components.core.foreach import Foreach
|
|
9
|
-
from reflex.
|
|
9
|
+
from reflex.event import EventHandler
|
|
10
10
|
from reflex.utils.types import _issubclass
|
|
11
11
|
from reflex.vars import Var
|
|
12
12
|
|
|
@@ -49,16 +49,8 @@ class Select(ChakraComponent):
|
|
|
49
49
|
# The name of the form field
|
|
50
50
|
name: Var[str]
|
|
51
51
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
Returns:
|
|
56
|
-
A dict mapping the event trigger to the var that is passed to the handler.
|
|
57
|
-
"""
|
|
58
|
-
return {
|
|
59
|
-
**super().get_event_triggers(),
|
|
60
|
-
EventTriggers.ON_CHANGE: lambda e0: [e0.target.value],
|
|
61
|
-
}
|
|
52
|
+
# Fired when the value changes.
|
|
53
|
+
on_change: EventHandler[lambda e0: [e0.target.value]]
|
|
62
54
|
|
|
63
55
|
@classmethod
|
|
64
56
|
def create(cls, *children, **props) -> Component:
|
|
@@ -7,17 +7,16 @@ from typing import Any, Dict, Literal, Optional, Union, overload
|
|
|
7
7
|
from reflex.vars import Var, BaseVar, ComputedVar
|
|
8
8
|
from reflex.event import EventChain, EventHandler, EventSpec
|
|
9
9
|
from reflex.style import Style
|
|
10
|
-
from typing import Any,
|
|
10
|
+
from typing import Any, List
|
|
11
11
|
from reflex.components.chakra import ChakraComponent, LiteralInputVariant
|
|
12
12
|
from reflex.components.chakra.typography.text import Text
|
|
13
13
|
from reflex.components.component import Component
|
|
14
14
|
from reflex.components.core.foreach import Foreach
|
|
15
|
-
from reflex.
|
|
15
|
+
from reflex.event import EventHandler
|
|
16
16
|
from reflex.utils.types import _issubclass
|
|
17
17
|
from reflex.vars import Var
|
|
18
18
|
|
|
19
19
|
class Select(ChakraComponent):
|
|
20
|
-
def get_event_triggers(self) -> Dict[str, Union[Var, Any]]: ...
|
|
21
20
|
@overload
|
|
22
21
|
@classmethod
|
|
23
22
|
def create( # type: ignore
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"""A slider component."""
|
|
2
|
+
|
|
2
3
|
from __future__ import annotations
|
|
3
4
|
|
|
4
|
-
from typing import
|
|
5
|
+
from typing import Literal
|
|
5
6
|
|
|
6
7
|
from reflex.components.chakra import ChakraComponent, LiteralChakraDirection
|
|
7
8
|
from reflex.components.component import Component
|
|
8
|
-
from reflex.
|
|
9
|
+
from reflex.event import EventHandler
|
|
9
10
|
from reflex.vars import Var
|
|
10
11
|
|
|
11
12
|
LiteralLayout = Literal["horizontal", "vertical"]
|
|
@@ -70,18 +71,14 @@ class Slider(ChakraComponent):
|
|
|
70
71
|
# The name of the form field
|
|
71
72
|
name: Var[str]
|
|
72
73
|
|
|
73
|
-
|
|
74
|
-
|
|
74
|
+
# Fired when the value changes.
|
|
75
|
+
on_change: EventHandler[lambda e0: [e0]]
|
|
75
76
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
EventTriggers.ON_CHANGE: lambda e0: [e0],
|
|
82
|
-
EventTriggers.ON_CHANGE_END: lambda e0: [e0],
|
|
83
|
-
EventTriggers.ON_CHANGE_START: lambda e0: [e0],
|
|
84
|
-
} # type: ignore
|
|
77
|
+
# Fired when the value starts changing.
|
|
78
|
+
on_change_start: EventHandler[lambda e0: [e0]]
|
|
79
|
+
|
|
80
|
+
# Fired when the value stops changing.
|
|
81
|
+
on_change_end: EventHandler[lambda e0: [e0]]
|
|
85
82
|
|
|
86
83
|
@classmethod
|
|
87
84
|
def create(cls, *children, **props) -> Component:
|
|
@@ -7,16 +7,15 @@ from typing import Any, Dict, Literal, Optional, Union, overload
|
|
|
7
7
|
from reflex.vars import Var, BaseVar, ComputedVar
|
|
8
8
|
from reflex.event import EventChain, EventHandler, EventSpec
|
|
9
9
|
from reflex.style import Style
|
|
10
|
-
from typing import
|
|
10
|
+
from typing import Literal
|
|
11
11
|
from reflex.components.chakra import ChakraComponent, LiteralChakraDirection
|
|
12
12
|
from reflex.components.component import Component
|
|
13
|
-
from reflex.
|
|
13
|
+
from reflex.event import EventHandler
|
|
14
14
|
from reflex.vars import Var
|
|
15
15
|
|
|
16
16
|
LiteralLayout = Literal["horizontal", "vertical"]
|
|
17
17
|
|
|
18
18
|
class Slider(ChakraComponent):
|
|
19
|
-
def get_event_triggers(self) -> dict[str, Union[Var, Any]]: ...
|
|
20
19
|
@overload
|
|
21
20
|
@classmethod
|
|
22
21
|
def create( # type: ignore
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
"""A switch component."""
|
|
2
|
-
from __future__ import annotations
|
|
3
2
|
|
|
4
|
-
from
|
|
3
|
+
from __future__ import annotations
|
|
5
4
|
|
|
6
5
|
from reflex.components.chakra import ChakraComponent, LiteralColorScheme
|
|
7
|
-
from reflex.
|
|
6
|
+
from reflex.event import EventHandler
|
|
8
7
|
from reflex.vars import Var
|
|
9
8
|
|
|
10
9
|
|
|
@@ -46,13 +45,5 @@ class Switch(ChakraComponent):
|
|
|
46
45
|
# The color scheme of the switch (e.g. "blue", "green", "red", etc.)
|
|
47
46
|
color_scheme: Var[LiteralColorScheme]
|
|
48
47
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
Returns:
|
|
53
|
-
A dict mapping the event trigger to the var that is passed to the handler.
|
|
54
|
-
"""
|
|
55
|
-
return {
|
|
56
|
-
**super().get_event_triggers(),
|
|
57
|
-
EventTriggers.ON_CHANGE: lambda e0: [e0.target.checked],
|
|
58
|
-
}
|
|
48
|
+
# Fired when the switch value changes
|
|
49
|
+
on_change: EventHandler[lambda e0: [e0.target.checked]]
|
|
@@ -7,13 +7,11 @@ from typing import Any, Dict, Literal, Optional, Union, overload
|
|
|
7
7
|
from reflex.vars import Var, BaseVar, ComputedVar
|
|
8
8
|
from reflex.event import EventChain, EventHandler, EventSpec
|
|
9
9
|
from reflex.style import Style
|
|
10
|
-
from typing import Any, Union
|
|
11
10
|
from reflex.components.chakra import ChakraComponent, LiteralColorScheme
|
|
12
|
-
from reflex.
|
|
11
|
+
from reflex.event import EventHandler
|
|
13
12
|
from reflex.vars import Var
|
|
14
13
|
|
|
15
14
|
class Switch(ChakraComponent):
|
|
16
|
-
def get_event_triggers(self) -> dict[str, Union[Var, Any]]: ...
|
|
17
15
|
@overload
|
|
18
16
|
@classmethod
|
|
19
17
|
def create( # type: ignore
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
"""A textarea component."""
|
|
2
|
-
from __future__ import annotations
|
|
3
2
|
|
|
4
|
-
from
|
|
3
|
+
from __future__ import annotations
|
|
5
4
|
|
|
6
5
|
from reflex.components.chakra import ChakraComponent, LiteralInputVariant
|
|
7
6
|
from reflex.components.component import Component
|
|
8
7
|
from reflex.components.core.debounce import DebounceInput
|
|
9
|
-
from reflex.
|
|
8
|
+
from reflex.event import EventHandler
|
|
10
9
|
from reflex.vars import Var
|
|
11
10
|
|
|
12
11
|
|
|
@@ -48,20 +47,20 @@ class TextArea(ChakraComponent):
|
|
|
48
47
|
# The name of the form field
|
|
49
48
|
name: Var[str]
|
|
50
49
|
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
# Fired when the value changes.
|
|
51
|
+
on_change: EventHandler[lambda e0: [e0.target.value]]
|
|
53
52
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
53
|
+
# Fired when the textarea gets focus.
|
|
54
|
+
on_focus: EventHandler[lambda e0: [e0.target.value]]
|
|
55
|
+
|
|
56
|
+
# Fired when the textarea loses focus.
|
|
57
|
+
on_blur: EventHandler[lambda e0: [e0.target.value]]
|
|
58
|
+
|
|
59
|
+
# Fired when a key is pressed down.
|
|
60
|
+
on_key_down: EventHandler[lambda e0: [e0.key]]
|
|
61
|
+
|
|
62
|
+
# Fired when a key is released.
|
|
63
|
+
on_key_up: EventHandler[lambda e0: [e0.key]]
|
|
65
64
|
|
|
66
65
|
@classmethod
|
|
67
66
|
def create(cls, *children, **props) -> Component:
|
|
@@ -74,7 +73,7 @@ class TextArea(ChakraComponent):
|
|
|
74
73
|
Returns:
|
|
75
74
|
The component.
|
|
76
75
|
"""
|
|
77
|
-
if props.get("value") is not None and props.get("on_change"):
|
|
76
|
+
if props.get("value") is not None and props.get("on_change") is not None:
|
|
78
77
|
# create a debounced input if the user requests full control to avoid typing jank
|
|
79
78
|
return DebounceInput.create(super().create(*children, **props))
|
|
80
79
|
return super().create(*children, **props)
|
|
@@ -7,15 +7,13 @@ from typing import Any, Dict, Literal, Optional, Union, overload
|
|
|
7
7
|
from reflex.vars import Var, BaseVar, ComputedVar
|
|
8
8
|
from reflex.event import EventChain, EventHandler, EventSpec
|
|
9
9
|
from reflex.style import Style
|
|
10
|
-
from typing import Any, Union
|
|
11
10
|
from reflex.components.chakra import ChakraComponent, LiteralInputVariant
|
|
12
11
|
from reflex.components.component import Component
|
|
13
12
|
from reflex.components.core.debounce import DebounceInput
|
|
14
|
-
from reflex.
|
|
13
|
+
from reflex.event import EventHandler
|
|
15
14
|
from reflex.vars import Var
|
|
16
15
|
|
|
17
16
|
class TextArea(ChakraComponent):
|
|
18
|
-
def get_event_triggers(self) -> dict[str, Union[Var, Any]]: ...
|
|
19
17
|
@overload
|
|
20
18
|
@classmethod
|
|
21
19
|
def create( # type: ignore
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"""Avatar components."""
|
|
2
|
-
from __future__ import annotations
|
|
3
2
|
|
|
4
|
-
from
|
|
3
|
+
from __future__ import annotations
|
|
5
4
|
|
|
6
5
|
from reflex.components.chakra import ChakraComponent, LiteralAvatarSize
|
|
6
|
+
from reflex.event import EventHandler
|
|
7
7
|
from reflex.vars import Var
|
|
8
8
|
|
|
9
9
|
|
|
@@ -36,16 +36,8 @@ class Avatar(ChakraComponent):
|
|
|
36
36
|
# "2xs" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "full"
|
|
37
37
|
size: Var[LiteralAvatarSize]
|
|
38
38
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
Returns:
|
|
43
|
-
The event triggers.
|
|
44
|
-
"""
|
|
45
|
-
return {
|
|
46
|
-
**super().get_event_triggers(),
|
|
47
|
-
"on_error": lambda: [],
|
|
48
|
-
}
|
|
39
|
+
# Fired when the image fails to load.
|
|
40
|
+
on_error: EventHandler[lambda: []]
|
|
49
41
|
|
|
50
42
|
|
|
51
43
|
class AvatarBadge(ChakraComponent):
|
|
@@ -7,12 +7,11 @@ from typing import Any, Dict, Literal, Optional, Union, overload
|
|
|
7
7
|
from reflex.vars import Var, BaseVar, ComputedVar
|
|
8
8
|
from reflex.event import EventChain, EventHandler, EventSpec
|
|
9
9
|
from reflex.style import Style
|
|
10
|
-
from typing import Any, Union
|
|
11
10
|
from reflex.components.chakra import ChakraComponent, LiteralAvatarSize
|
|
11
|
+
from reflex.event import EventHandler
|
|
12
12
|
from reflex.vars import Var
|
|
13
13
|
|
|
14
14
|
class Avatar(ChakraComponent):
|
|
15
|
-
def get_event_triggers(self) -> dict[str, Union[Var, Any]]: ...
|
|
16
15
|
@overload
|
|
17
16
|
@classmethod
|
|
18
17
|
def create( # type: ignore
|