reflex 0.6.3a4__py3-none-any.whl → 0.6.4__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of reflex might be problematic. Click here for more details.
- reflex/.templates/jinja/web/pages/_app.js.jinja2 +2 -2
- reflex/.templates/jinja/web/utils/context.js.jinja2 +3 -1
- reflex/.templates/web/components/reflex/radix_themes_color_mode_provider.js +3 -3
- reflex/.templates/web/components/shiki/code.js +29 -0
- reflex/.templates/web/jsconfig.json +2 -1
- reflex/.templates/web/utils/state.js +6 -4
- reflex/__init__.py +6 -3
- reflex/__init__.pyi +4 -3
- reflex/app.py +6 -5
- reflex/compiler/compiler.py +6 -7
- reflex/compiler/utils.py +8 -1
- reflex/components/base/error_boundary.py +37 -24
- reflex/components/base/error_boundary.pyi +8 -7
- reflex/components/component.py +9 -4
- reflex/components/core/banner.py +2 -2
- reflex/components/core/client_side_routing.py +1 -1
- reflex/components/core/clipboard.py +1 -1
- reflex/components/core/clipboard.pyi +1 -1
- reflex/components/core/cond.py +1 -1
- reflex/components/core/debounce.py +5 -1
- reflex/components/core/upload.py +7 -9
- reflex/components/core/upload.pyi +2 -2
- reflex/components/datadisplay/code.py +1 -1
- reflex/components/datadisplay/dataeditor.py +83 -18
- reflex/components/datadisplay/dataeditor.pyi +67 -15
- reflex/components/datadisplay/shiki_code_block.py +813 -0
- reflex/components/datadisplay/shiki_code_block.pyi +2211 -0
- reflex/components/dynamic.py +3 -3
- reflex/components/el/elements/forms.py +37 -23
- reflex/components/el/elements/forms.pyi +7 -4
- reflex/components/markdown/markdown.py +12 -1
- reflex/components/moment/moment.pyi +1 -1
- reflex/components/radix/primitives/drawer.pyi +2 -2
- reflex/components/radix/themes/base.py +2 -2
- reflex/components/radix/themes/color_mode.pyi +1 -1
- reflex/components/radix/themes/components/alert_dialog.pyi +1 -1
- reflex/components/radix/themes/components/checkbox.pyi +3 -3
- reflex/components/radix/themes/components/context_menu.pyi +1 -1
- reflex/components/radix/themes/components/dialog.pyi +2 -2
- reflex/components/radix/themes/components/dropdown_menu.pyi +2 -2
- reflex/components/radix/themes/components/hover_card.pyi +2 -2
- reflex/components/radix/themes/components/popover.pyi +1 -1
- reflex/components/radix/themes/components/radio_cards.pyi +1 -1
- reflex/components/radix/themes/components/radio_group.pyi +1 -1
- reflex/components/radix/themes/components/select.pyi +6 -6
- reflex/components/radix/themes/components/switch.pyi +1 -1
- reflex/components/radix/themes/components/tabs.pyi +2 -2
- reflex/components/radix/themes/components/tooltip.pyi +4 -2
- reflex/components/react_player/__init__.py +1 -0
- reflex/components/react_player/audio.pyi +6 -3
- reflex/components/react_player/react_player.py +12 -1
- reflex/components/react_player/react_player.pyi +11 -3
- reflex/components/react_player/video.pyi +6 -3
- reflex/components/recharts/recharts.py +2 -2
- reflex/components/sonner/toast.py +1 -1
- reflex/components/suneditor/editor.py +40 -16
- reflex/components/suneditor/editor.pyi +15 -11
- reflex/config.py +284 -20
- reflex/constants/__init__.py +2 -0
- reflex/constants/base.py +53 -31
- reflex/constants/compiler.py +2 -12
- reflex/constants/config.py +1 -2
- reflex/constants/installer.py +88 -32
- reflex/constants/style.py +1 -1
- reflex/constants/utils.py +32 -0
- reflex/custom_components/custom_components.py +3 -3
- reflex/event.py +152 -84
- reflex/experimental/__init__.py +2 -0
- reflex/experimental/client_state.py +1 -1
- reflex/experimental/layout.pyi +1 -1
- reflex/istate/storage.py +144 -0
- reflex/model.py +8 -11
- reflex/reflex.py +18 -17
- reflex/state.py +89 -151
- reflex/style.py +1 -1
- reflex/testing.py +2 -1
- reflex/utils/build.py +0 -12
- reflex/utils/exceptions.py +8 -0
- reflex/utils/exec.py +22 -4
- reflex/utils/imports.py +6 -0
- reflex/utils/net.py +2 -4
- reflex/utils/path_ops.py +7 -21
- reflex/utils/prerequisites.py +11 -17
- reflex/utils/pyi_generator.py +91 -3
- reflex/utils/registry.py +2 -6
- reflex/utils/types.py +14 -0
- reflex/vars/base.py +453 -424
- reflex/vars/function.py +6 -16
- reflex/vars/number.py +46 -67
- reflex/vars/object.py +1 -31
- reflex/vars/sequence.py +177 -47
- {reflex-0.6.3a4.dist-info → reflex-0.6.4.dist-info}/METADATA +1 -1
- {reflex-0.6.3a4.dist-info → reflex-0.6.4.dist-info}/RECORD +96 -91
- {reflex-0.6.3a4.dist-info → reflex-0.6.4.dist-info}/LICENSE +0 -0
- {reflex-0.6.3a4.dist-info → reflex-0.6.4.dist-info}/WHEEL +0 -0
- {reflex-0.6.3a4.dist-info → reflex-0.6.4.dist-info}/entry_points.txt +0 -0
reflex/components/dynamic.py
CHANGED
|
@@ -90,7 +90,7 @@ def load_dynamic_serializer():
|
|
|
90
90
|
for lib, names in component._get_all_imports().items():
|
|
91
91
|
formatted_lib_name = format_library_name(lib)
|
|
92
92
|
if (
|
|
93
|
-
not lib.startswith((".", "/"))
|
|
93
|
+
not lib.startswith((".", "/", "$/"))
|
|
94
94
|
and not lib.startswith("http")
|
|
95
95
|
and formatted_lib_name not in libs_in_window
|
|
96
96
|
):
|
|
@@ -106,7 +106,7 @@ def load_dynamic_serializer():
|
|
|
106
106
|
# Rewrite imports from `/` to destructure from window
|
|
107
107
|
for ix, line in enumerate(module_code_lines[:]):
|
|
108
108
|
if line.startswith("import "):
|
|
109
|
-
if 'from "/' in line:
|
|
109
|
+
if 'from "$/' in line or 'from "/' in line:
|
|
110
110
|
module_code_lines[ix] = (
|
|
111
111
|
line.replace("import ", "const ", 1).replace(
|
|
112
112
|
" from ", " = window['__reflex'][", 1
|
|
@@ -157,7 +157,7 @@ def load_dynamic_serializer():
|
|
|
157
157
|
merge_var_data=VarData.merge(
|
|
158
158
|
VarData(
|
|
159
159
|
imports={
|
|
160
|
-
f"
|
|
160
|
+
f"$/{constants.Dirs.STATE_PATH}": [
|
|
161
161
|
imports.ImportVar(tag="evalReactComponent"),
|
|
162
162
|
],
|
|
163
163
|
"react": [
|
|
@@ -187,7 +187,7 @@ class Form(BaseHTML):
|
|
|
187
187
|
"""
|
|
188
188
|
return {
|
|
189
189
|
"react": "useCallback",
|
|
190
|
-
f"
|
|
190
|
+
f"$/{Dirs.STATE_PATH}": ["getRefValue", "getRefValues"],
|
|
191
191
|
}
|
|
192
192
|
|
|
193
193
|
def add_hooks(self) -> list[str]:
|
|
@@ -615,6 +615,42 @@ class Textarea(BaseHTML):
|
|
|
615
615
|
# Fired when a key is released
|
|
616
616
|
on_key_up: EventHandler[key_event]
|
|
617
617
|
|
|
618
|
+
@classmethod
|
|
619
|
+
def create(cls, *children, **props):
|
|
620
|
+
"""Create a textarea component.
|
|
621
|
+
|
|
622
|
+
Args:
|
|
623
|
+
*children: The children of the textarea.
|
|
624
|
+
**props: The properties of the textarea.
|
|
625
|
+
|
|
626
|
+
Returns:
|
|
627
|
+
The textarea component.
|
|
628
|
+
|
|
629
|
+
Raises:
|
|
630
|
+
ValueError: when `enter_key_submit` is combined with `on_key_down`.
|
|
631
|
+
"""
|
|
632
|
+
enter_key_submit = props.get("enter_key_submit")
|
|
633
|
+
auto_height = props.get("auto_height")
|
|
634
|
+
custom_attrs = props.setdefault("custom_attrs", {})
|
|
635
|
+
|
|
636
|
+
if enter_key_submit is not None:
|
|
637
|
+
enter_key_submit = Var.create(enter_key_submit)
|
|
638
|
+
if "on_key_down" in props:
|
|
639
|
+
raise ValueError(
|
|
640
|
+
"Cannot combine `enter_key_submit` with `on_key_down`.",
|
|
641
|
+
)
|
|
642
|
+
custom_attrs["on_key_down"] = Var(
|
|
643
|
+
_js_expr=f"(e) => enterKeySubmitOnKeyDown(e, {str(enter_key_submit)})",
|
|
644
|
+
_var_data=VarData.merge(enter_key_submit._get_all_var_data()),
|
|
645
|
+
)
|
|
646
|
+
if auto_height is not None:
|
|
647
|
+
auto_height = Var.create(auto_height)
|
|
648
|
+
custom_attrs["on_input"] = Var(
|
|
649
|
+
_js_expr=f"(e) => autoHeightOnInput(e, {str(auto_height)})",
|
|
650
|
+
_var_data=VarData.merge(auto_height._get_all_var_data()),
|
|
651
|
+
)
|
|
652
|
+
return super().create(*children, **props)
|
|
653
|
+
|
|
618
654
|
def _exclude_props(self) -> list[str]:
|
|
619
655
|
return super()._exclude_props() + [
|
|
620
656
|
"auto_height",
|
|
@@ -634,28 +670,6 @@ class Textarea(BaseHTML):
|
|
|
634
670
|
custom_code.add(ENTER_KEY_SUBMIT_JS)
|
|
635
671
|
return custom_code
|
|
636
672
|
|
|
637
|
-
def _render(self) -> Tag:
|
|
638
|
-
tag = super()._render()
|
|
639
|
-
if self.enter_key_submit is not None:
|
|
640
|
-
if "on_key_down" in self.event_triggers:
|
|
641
|
-
raise ValueError(
|
|
642
|
-
"Cannot combine `enter_key_submit` with `on_key_down`.",
|
|
643
|
-
)
|
|
644
|
-
tag.add_props(
|
|
645
|
-
on_key_down=Var(
|
|
646
|
-
_js_expr=f"(e) => enterKeySubmitOnKeyDown(e, {str(self.enter_key_submit)})",
|
|
647
|
-
_var_data=VarData.merge(self.enter_key_submit._get_all_var_data()),
|
|
648
|
-
)
|
|
649
|
-
)
|
|
650
|
-
if self.auto_height is not None:
|
|
651
|
-
tag.add_props(
|
|
652
|
-
on_input=Var(
|
|
653
|
-
_js_expr=f"(e) => autoHeightOnInput(e, {str(self.auto_height)})",
|
|
654
|
-
_var_data=VarData.merge(self.auto_height._get_all_var_data()),
|
|
655
|
-
)
|
|
656
|
-
)
|
|
657
|
-
return tag
|
|
658
|
-
|
|
659
673
|
|
|
660
674
|
button = Button.create
|
|
661
675
|
fieldset = Fieldset.create
|
|
@@ -1376,10 +1376,10 @@ class Textarea(BaseHTML):
|
|
|
1376
1376
|
on_unmount: Optional[EventType[[]]] = None,
|
|
1377
1377
|
**props,
|
|
1378
1378
|
) -> "Textarea":
|
|
1379
|
-
"""Create
|
|
1379
|
+
"""Create a textarea component.
|
|
1380
1380
|
|
|
1381
1381
|
Args:
|
|
1382
|
-
*children: The children of the
|
|
1382
|
+
*children: The children of the textarea.
|
|
1383
1383
|
auto_complete: Whether the form control should have autocomplete enabled
|
|
1384
1384
|
auto_focus: Automatically focuses the textarea when the page loads
|
|
1385
1385
|
auto_height: Automatically fit the content height to the text (use min-height with this prop)
|
|
@@ -1419,10 +1419,13 @@ class Textarea(BaseHTML):
|
|
|
1419
1419
|
class_name: The class name for the component.
|
|
1420
1420
|
autofocus: Whether the component should take the focus once the page is loaded
|
|
1421
1421
|
custom_attrs: custom attribute
|
|
1422
|
-
**props: The
|
|
1422
|
+
**props: The properties of the textarea.
|
|
1423
1423
|
|
|
1424
1424
|
Returns:
|
|
1425
|
-
The component.
|
|
1425
|
+
The textarea component.
|
|
1426
|
+
|
|
1427
|
+
Raises:
|
|
1428
|
+
ValueError: when `enter_key_submit` is combined with `on_key_down`.
|
|
1426
1429
|
"""
|
|
1427
1430
|
...
|
|
1428
1431
|
|
|
@@ -20,6 +20,8 @@ from reflex.components.tags.tag import Tag
|
|
|
20
20
|
from reflex.utils import types
|
|
21
21
|
from reflex.utils.imports import ImportDict, ImportVar
|
|
22
22
|
from reflex.vars.base import LiteralVar, Var
|
|
23
|
+
from reflex.vars.function import ARRAY_ISARRAY
|
|
24
|
+
from reflex.vars.number import ternary_operation
|
|
23
25
|
|
|
24
26
|
# Special vars used in the component map.
|
|
25
27
|
_CHILDREN = Var(_js_expr="children", _var_type=str)
|
|
@@ -199,7 +201,16 @@ class Markdown(Component):
|
|
|
199
201
|
raise ValueError(f"No markdown component found for tag: {tag}.")
|
|
200
202
|
|
|
201
203
|
special_props = [_PROPS_IN_TAG]
|
|
202
|
-
children = [
|
|
204
|
+
children = [
|
|
205
|
+
_CHILDREN
|
|
206
|
+
if tag != "codeblock"
|
|
207
|
+
# For codeblock, the mapping for some cases returns an array of elements. Let's join them into a string.
|
|
208
|
+
else ternary_operation(
|
|
209
|
+
ARRAY_ISARRAY.call(_CHILDREN), # type: ignore
|
|
210
|
+
_CHILDREN.to(list).join("\n"),
|
|
211
|
+
_CHILDREN,
|
|
212
|
+
).to(str)
|
|
213
|
+
]
|
|
203
214
|
|
|
204
215
|
# For certain tags, the props from the markdown renderer are not actually valid for the component.
|
|
205
216
|
if tag in NO_PROPS_TAGS:
|
|
@@ -58,7 +58,7 @@ class Moment(NoSSRComponent):
|
|
|
58
58
|
autofocus: Optional[bool] = None,
|
|
59
59
|
custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
|
|
60
60
|
on_blur: Optional[EventType[[]]] = None,
|
|
61
|
-
on_change: Optional[EventType] = None,
|
|
61
|
+
on_change: Optional[EventType[str]] = None,
|
|
62
62
|
on_click: Optional[EventType[[]]] = None,
|
|
63
63
|
on_context_menu: Optional[EventType[[]]] = None,
|
|
64
64
|
on_double_click: Optional[EventType[[]]] = None,
|
|
@@ -101,7 +101,7 @@ class DrawerRoot(DrawerComponent):
|
|
|
101
101
|
on_mouse_out: Optional[EventType[[]]] = None,
|
|
102
102
|
on_mouse_over: Optional[EventType[[]]] = None,
|
|
103
103
|
on_mouse_up: Optional[EventType[[]]] = None,
|
|
104
|
-
on_open_change: Optional[EventType] = None,
|
|
104
|
+
on_open_change: Optional[EventType[bool]] = None,
|
|
105
105
|
on_scroll: Optional[EventType[[]]] = None,
|
|
106
106
|
on_unmount: Optional[EventType[[]]] = None,
|
|
107
107
|
**props,
|
|
@@ -511,7 +511,7 @@ class Drawer(ComponentNamespace):
|
|
|
511
511
|
on_mouse_out: Optional[EventType[[]]] = None,
|
|
512
512
|
on_mouse_over: Optional[EventType[[]]] = None,
|
|
513
513
|
on_mouse_up: Optional[EventType[[]]] = None,
|
|
514
|
-
on_open_change: Optional[EventType] = None,
|
|
514
|
+
on_open_change: Optional[EventType[bool]] = None,
|
|
515
515
|
on_scroll: Optional[EventType[[]]] = None,
|
|
516
516
|
on_unmount: Optional[EventType[[]]] = None,
|
|
517
517
|
**props,
|
|
@@ -221,7 +221,7 @@ class Theme(RadixThemesComponent):
|
|
|
221
221
|
The import dict.
|
|
222
222
|
"""
|
|
223
223
|
_imports: ImportDict = {
|
|
224
|
-
"
|
|
224
|
+
"$/utils/theme.js": [ImportVar(tag="theme", is_default=True)],
|
|
225
225
|
}
|
|
226
226
|
if get_config().tailwind is None:
|
|
227
227
|
# When tailwind is disabled, import the radix-ui styles directly because they will
|
|
@@ -265,7 +265,7 @@ class ThemePanel(RadixThemesComponent):
|
|
|
265
265
|
class RadixThemesColorModeProvider(Component):
|
|
266
266
|
"""Next-themes integration for radix themes components."""
|
|
267
267
|
|
|
268
|
-
library = "
|
|
268
|
+
library = "$/components/reflex/radix_themes_color_mode_provider.js"
|
|
269
269
|
tag = "RadixThemesColorModeProvider"
|
|
270
270
|
is_default = True
|
|
271
271
|
|
|
@@ -383,7 +383,7 @@ class ColorModeSwitch(Switch):
|
|
|
383
383
|
autofocus: Optional[bool] = None,
|
|
384
384
|
custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
|
|
385
385
|
on_blur: Optional[EventType[[]]] = None,
|
|
386
|
-
on_change: Optional[EventType] = None,
|
|
386
|
+
on_change: Optional[EventType[bool]] = None,
|
|
387
387
|
on_click: Optional[EventType[[]]] = None,
|
|
388
388
|
on_context_menu: Optional[EventType[[]]] = None,
|
|
389
389
|
on_double_click: Optional[EventType[[]]] = None,
|
|
@@ -42,7 +42,7 @@ class AlertDialogRoot(RadixThemesComponent):
|
|
|
42
42
|
on_mouse_out: Optional[EventType[[]]] = None,
|
|
43
43
|
on_mouse_over: Optional[EventType[[]]] = None,
|
|
44
44
|
on_mouse_up: Optional[EventType[[]]] = None,
|
|
45
|
-
on_open_change: Optional[EventType] = None,
|
|
45
|
+
on_open_change: Optional[EventType[bool]] = None,
|
|
46
46
|
on_scroll: Optional[EventType[[]]] = None,
|
|
47
47
|
on_unmount: Optional[EventType[[]]] = None,
|
|
48
48
|
**props,
|
|
@@ -116,7 +116,7 @@ class Checkbox(RadixThemesComponent):
|
|
|
116
116
|
autofocus: Optional[bool] = None,
|
|
117
117
|
custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
|
|
118
118
|
on_blur: Optional[EventType[[]]] = None,
|
|
119
|
-
on_change: Optional[EventType] = None,
|
|
119
|
+
on_change: Optional[EventType[bool]] = None,
|
|
120
120
|
on_click: Optional[EventType[[]]] = None,
|
|
121
121
|
on_context_menu: Optional[EventType[[]]] = None,
|
|
122
122
|
on_double_click: Optional[EventType[[]]] = None,
|
|
@@ -263,7 +263,7 @@ class HighLevelCheckbox(RadixThemesComponent):
|
|
|
263
263
|
autofocus: Optional[bool] = None,
|
|
264
264
|
custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
|
|
265
265
|
on_blur: Optional[EventType[[]]] = None,
|
|
266
|
-
on_change: Optional[EventType] = None,
|
|
266
|
+
on_change: Optional[EventType[bool]] = None,
|
|
267
267
|
on_click: Optional[EventType[[]]] = None,
|
|
268
268
|
on_context_menu: Optional[EventType[[]]] = None,
|
|
269
269
|
on_double_click: Optional[EventType[[]]] = None,
|
|
@@ -407,7 +407,7 @@ class CheckboxNamespace(ComponentNamespace):
|
|
|
407
407
|
autofocus: Optional[bool] = None,
|
|
408
408
|
custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
|
|
409
409
|
on_blur: Optional[EventType[[]]] = None,
|
|
410
|
-
on_change: Optional[EventType] = None,
|
|
410
|
+
on_change: Optional[EventType[bool]] = None,
|
|
411
411
|
on_click: Optional[EventType[[]]] = None,
|
|
412
412
|
on_context_menu: Optional[EventType[[]]] = None,
|
|
413
413
|
on_double_click: Optional[EventType[[]]] = None,
|
|
@@ -39,7 +39,7 @@ class ContextMenuRoot(RadixThemesComponent):
|
|
|
39
39
|
on_mouse_out: Optional[EventType[[]]] = None,
|
|
40
40
|
on_mouse_over: Optional[EventType[[]]] = None,
|
|
41
41
|
on_mouse_up: Optional[EventType[[]]] = None,
|
|
42
|
-
on_open_change: Optional[EventType] = None,
|
|
42
|
+
on_open_change: Optional[EventType[bool]] = None,
|
|
43
43
|
on_scroll: Optional[EventType[[]]] = None,
|
|
44
44
|
on_unmount: Optional[EventType[[]]] = None,
|
|
45
45
|
**props,
|
|
@@ -40,7 +40,7 @@ class DialogRoot(RadixThemesComponent):
|
|
|
40
40
|
on_mouse_out: Optional[EventType[[]]] = None,
|
|
41
41
|
on_mouse_over: Optional[EventType[[]]] = None,
|
|
42
42
|
on_mouse_up: Optional[EventType[[]]] = None,
|
|
43
|
-
on_open_change: Optional[EventType] = None,
|
|
43
|
+
on_open_change: Optional[EventType[bool]] = None,
|
|
44
44
|
on_scroll: Optional[EventType[[]]] = None,
|
|
45
45
|
on_unmount: Optional[EventType[[]]] = None,
|
|
46
46
|
**props,
|
|
@@ -382,7 +382,7 @@ class Dialog(ComponentNamespace):
|
|
|
382
382
|
on_mouse_out: Optional[EventType[[]]] = None,
|
|
383
383
|
on_mouse_over: Optional[EventType[[]]] = None,
|
|
384
384
|
on_mouse_up: Optional[EventType[[]]] = None,
|
|
385
|
-
on_open_change: Optional[EventType] = None,
|
|
385
|
+
on_open_change: Optional[EventType[bool]] = None,
|
|
386
386
|
on_scroll: Optional[EventType[[]]] = None,
|
|
387
387
|
on_unmount: Optional[EventType[[]]] = None,
|
|
388
388
|
**props,
|
|
@@ -49,7 +49,7 @@ class DropdownMenuRoot(RadixThemesComponent):
|
|
|
49
49
|
on_mouse_out: Optional[EventType[[]]] = None,
|
|
50
50
|
on_mouse_over: Optional[EventType[[]]] = None,
|
|
51
51
|
on_mouse_up: Optional[EventType[[]]] = None,
|
|
52
|
-
on_open_change: Optional[EventType] = None,
|
|
52
|
+
on_open_change: Optional[EventType[bool]] = None,
|
|
53
53
|
on_scroll: Optional[EventType[[]]] = None,
|
|
54
54
|
on_unmount: Optional[EventType[[]]] = None,
|
|
55
55
|
**props,
|
|
@@ -363,7 +363,7 @@ class DropdownMenuSub(RadixThemesComponent):
|
|
|
363
363
|
on_mouse_out: Optional[EventType[[]]] = None,
|
|
364
364
|
on_mouse_over: Optional[EventType[[]]] = None,
|
|
365
365
|
on_mouse_up: Optional[EventType[[]]] = None,
|
|
366
|
-
on_open_change: Optional[EventType] = None,
|
|
366
|
+
on_open_change: Optional[EventType[bool]] = None,
|
|
367
367
|
on_scroll: Optional[EventType[[]]] = None,
|
|
368
368
|
on_unmount: Optional[EventType[[]]] = None,
|
|
369
369
|
**props,
|
|
@@ -43,7 +43,7 @@ class HoverCardRoot(RadixThemesComponent):
|
|
|
43
43
|
on_mouse_out: Optional[EventType[[]]] = None,
|
|
44
44
|
on_mouse_over: Optional[EventType[[]]] = None,
|
|
45
45
|
on_mouse_up: Optional[EventType[[]]] = None,
|
|
46
|
-
on_open_change: Optional[EventType] = None,
|
|
46
|
+
on_open_change: Optional[EventType[bool]] = None,
|
|
47
47
|
on_scroll: Optional[EventType[[]]] = None,
|
|
48
48
|
on_unmount: Optional[EventType[[]]] = None,
|
|
49
49
|
**props,
|
|
@@ -256,7 +256,7 @@ class HoverCard(ComponentNamespace):
|
|
|
256
256
|
on_mouse_out: Optional[EventType[[]]] = None,
|
|
257
257
|
on_mouse_over: Optional[EventType[[]]] = None,
|
|
258
258
|
on_mouse_up: Optional[EventType[[]]] = None,
|
|
259
|
-
on_open_change: Optional[EventType] = None,
|
|
259
|
+
on_open_change: Optional[EventType[bool]] = None,
|
|
260
260
|
on_scroll: Optional[EventType[[]]] = None,
|
|
261
261
|
on_unmount: Optional[EventType[[]]] = None,
|
|
262
262
|
**props,
|
|
@@ -41,7 +41,7 @@ class PopoverRoot(RadixThemesComponent):
|
|
|
41
41
|
on_mouse_out: Optional[EventType[[]]] = None,
|
|
42
42
|
on_mouse_over: Optional[EventType[[]]] = None,
|
|
43
43
|
on_mouse_up: Optional[EventType[[]]] = None,
|
|
44
|
-
on_open_change: Optional[EventType] = None,
|
|
44
|
+
on_open_change: Optional[EventType[bool]] = None,
|
|
45
45
|
on_scroll: Optional[EventType[[]]] = None,
|
|
46
46
|
on_unmount: Optional[EventType[[]]] = None,
|
|
47
47
|
**props,
|
|
@@ -177,7 +177,7 @@ class RadioCardsRoot(RadixThemesComponent):
|
|
|
177
177
|
on_mouse_up: Optional[EventType[[]]] = None,
|
|
178
178
|
on_scroll: Optional[EventType[[]]] = None,
|
|
179
179
|
on_unmount: Optional[EventType[[]]] = None,
|
|
180
|
-
on_value_change: Optional[EventType] = None,
|
|
180
|
+
on_value_change: Optional[EventType[str]] = None,
|
|
181
181
|
**props,
|
|
182
182
|
) -> "RadioCardsRoot":
|
|
183
183
|
"""Create a new component instance.
|
|
@@ -113,7 +113,7 @@ class RadioGroupRoot(RadixThemesComponent):
|
|
|
113
113
|
autofocus: Optional[bool] = None,
|
|
114
114
|
custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
|
|
115
115
|
on_blur: Optional[EventType[[]]] = None,
|
|
116
|
-
on_change: Optional[EventType] = None,
|
|
116
|
+
on_change: Optional[EventType[str]] = None,
|
|
117
117
|
on_click: Optional[EventType[[]]] = None,
|
|
118
118
|
on_context_menu: Optional[EventType[[]]] = None,
|
|
119
119
|
on_double_click: Optional[EventType[[]]] = None,
|
|
@@ -44,7 +44,7 @@ class SelectRoot(RadixThemesComponent):
|
|
|
44
44
|
autofocus: Optional[bool] = None,
|
|
45
45
|
custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
|
|
46
46
|
on_blur: Optional[EventType[[]]] = None,
|
|
47
|
-
on_change: Optional[EventType] = None,
|
|
47
|
+
on_change: Optional[EventType[str]] = None,
|
|
48
48
|
on_click: Optional[EventType[[]]] = None,
|
|
49
49
|
on_context_menu: Optional[EventType[[]]] = None,
|
|
50
50
|
on_double_click: Optional[EventType[[]]] = None,
|
|
@@ -57,7 +57,7 @@ class SelectRoot(RadixThemesComponent):
|
|
|
57
57
|
on_mouse_out: Optional[EventType[[]]] = None,
|
|
58
58
|
on_mouse_over: Optional[EventType[[]]] = None,
|
|
59
59
|
on_mouse_up: Optional[EventType[[]]] = None,
|
|
60
|
-
on_open_change: Optional[EventType] = None,
|
|
60
|
+
on_open_change: Optional[EventType[bool]] = None,
|
|
61
61
|
on_scroll: Optional[EventType[[]]] = None,
|
|
62
62
|
on_unmount: Optional[EventType[[]]] = None,
|
|
63
63
|
**props,
|
|
@@ -680,7 +680,7 @@ class HighLevelSelect(SelectRoot):
|
|
|
680
680
|
autofocus: Optional[bool] = None,
|
|
681
681
|
custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
|
|
682
682
|
on_blur: Optional[EventType[[]]] = None,
|
|
683
|
-
on_change: Optional[EventType] = None,
|
|
683
|
+
on_change: Optional[EventType[str]] = None,
|
|
684
684
|
on_click: Optional[EventType[[]]] = None,
|
|
685
685
|
on_context_menu: Optional[EventType[[]]] = None,
|
|
686
686
|
on_double_click: Optional[EventType[[]]] = None,
|
|
@@ -693,7 +693,7 @@ class HighLevelSelect(SelectRoot):
|
|
|
693
693
|
on_mouse_out: Optional[EventType[[]]] = None,
|
|
694
694
|
on_mouse_over: Optional[EventType[[]]] = None,
|
|
695
695
|
on_mouse_up: Optional[EventType[[]]] = None,
|
|
696
|
-
on_open_change: Optional[EventType] = None,
|
|
696
|
+
on_open_change: Optional[EventType[bool]] = None,
|
|
697
697
|
on_scroll: Optional[EventType[[]]] = None,
|
|
698
698
|
on_unmount: Optional[EventType[[]]] = None,
|
|
699
699
|
**props,
|
|
@@ -854,7 +854,7 @@ class Select(ComponentNamespace):
|
|
|
854
854
|
autofocus: Optional[bool] = None,
|
|
855
855
|
custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
|
|
856
856
|
on_blur: Optional[EventType[[]]] = None,
|
|
857
|
-
on_change: Optional[EventType] = None,
|
|
857
|
+
on_change: Optional[EventType[str]] = None,
|
|
858
858
|
on_click: Optional[EventType[[]]] = None,
|
|
859
859
|
on_context_menu: Optional[EventType[[]]] = None,
|
|
860
860
|
on_double_click: Optional[EventType[[]]] = None,
|
|
@@ -867,7 +867,7 @@ class Select(ComponentNamespace):
|
|
|
867
867
|
on_mouse_out: Optional[EventType[[]]] = None,
|
|
868
868
|
on_mouse_over: Optional[EventType[[]]] = None,
|
|
869
869
|
on_mouse_up: Optional[EventType[[]]] = None,
|
|
870
|
-
on_open_change: Optional[EventType] = None,
|
|
870
|
+
on_open_change: Optional[EventType[bool]] = None,
|
|
871
871
|
on_scroll: Optional[EventType[[]]] = None,
|
|
872
872
|
on_unmount: Optional[EventType[[]]] = None,
|
|
873
873
|
**props,
|
|
@@ -119,7 +119,7 @@ class Switch(RadixThemesComponent):
|
|
|
119
119
|
autofocus: Optional[bool] = None,
|
|
120
120
|
custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
|
|
121
121
|
on_blur: Optional[EventType[[]]] = None,
|
|
122
|
-
on_change: Optional[EventType] = None,
|
|
122
|
+
on_change: Optional[EventType[bool]] = None,
|
|
123
123
|
on_click: Optional[EventType[[]]] = None,
|
|
124
124
|
on_context_menu: Optional[EventType[[]]] = None,
|
|
125
125
|
on_double_click: Optional[EventType[[]]] = None,
|
|
@@ -41,7 +41,7 @@ class TabsRoot(RadixThemesComponent):
|
|
|
41
41
|
autofocus: Optional[bool] = None,
|
|
42
42
|
custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
|
|
43
43
|
on_blur: Optional[EventType[[]]] = None,
|
|
44
|
-
on_change: Optional[EventType] = None,
|
|
44
|
+
on_change: Optional[EventType[str]] = None,
|
|
45
45
|
on_click: Optional[EventType[[]]] = None,
|
|
46
46
|
on_context_menu: Optional[EventType[[]]] = None,
|
|
47
47
|
on_double_click: Optional[EventType[[]]] = None,
|
|
@@ -340,7 +340,7 @@ class Tabs(ComponentNamespace):
|
|
|
340
340
|
autofocus: Optional[bool] = None,
|
|
341
341
|
custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
|
|
342
342
|
on_blur: Optional[EventType[[]]] = None,
|
|
343
|
-
on_change: Optional[EventType] = None,
|
|
343
|
+
on_change: Optional[EventType[str]] = None,
|
|
344
344
|
on_click: Optional[EventType[[]]] = None,
|
|
345
345
|
on_context_menu: Optional[EventType[[]]] = None,
|
|
346
346
|
on_double_click: Optional[EventType[[]]] = None,
|
|
@@ -5,7 +5,9 @@
|
|
|
5
5
|
# ------------------------------------------------------
|
|
6
6
|
from typing import Any, Dict, Literal, Optional, Union, overload
|
|
7
7
|
|
|
8
|
-
from reflex.event import
|
|
8
|
+
from reflex.event import (
|
|
9
|
+
EventType,
|
|
10
|
+
)
|
|
9
11
|
from reflex.style import Style
|
|
10
12
|
from reflex.vars.base import Var
|
|
11
13
|
|
|
@@ -76,7 +78,7 @@ class Tooltip(RadixThemesComponent):
|
|
|
76
78
|
on_mouse_out: Optional[EventType[[]]] = None,
|
|
77
79
|
on_mouse_over: Optional[EventType[[]]] = None,
|
|
78
80
|
on_mouse_up: Optional[EventType[[]]] = None,
|
|
79
|
-
on_open_change: Optional[EventType] = None,
|
|
81
|
+
on_open_change: Optional[EventType[bool]] = None,
|
|
80
82
|
on_pointer_down_outside: Optional[EventType[[]]] = None,
|
|
81
83
|
on_scroll: Optional[EventType[[]]] = None,
|
|
82
84
|
on_unmount: Optional[EventType[[]]] = None,
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
# ------------------------------------------------------
|
|
6
6
|
from typing import Any, Dict, Optional, Union, overload
|
|
7
7
|
|
|
8
|
+
import reflex
|
|
8
9
|
from reflex.components.react_player.react_player import ReactPlayer
|
|
9
10
|
from reflex.event import EventType
|
|
10
11
|
from reflex.style import Style
|
|
@@ -41,7 +42,7 @@ class Audio(ReactPlayer):
|
|
|
41
42
|
on_context_menu: Optional[EventType[[]]] = None,
|
|
42
43
|
on_disable_pip: Optional[EventType[[]]] = None,
|
|
43
44
|
on_double_click: Optional[EventType[[]]] = None,
|
|
44
|
-
on_duration: Optional[EventType] = None,
|
|
45
|
+
on_duration: Optional[EventType[float]] = None,
|
|
45
46
|
on_enable_pip: Optional[EventType[[]]] = None,
|
|
46
47
|
on_ended: Optional[EventType[[]]] = None,
|
|
47
48
|
on_error: Optional[EventType[[]]] = None,
|
|
@@ -58,10 +59,12 @@ class Audio(ReactPlayer):
|
|
|
58
59
|
on_play: Optional[EventType[[]]] = None,
|
|
59
60
|
on_playback_quality_change: Optional[EventType[[]]] = None,
|
|
60
61
|
on_playback_rate_change: Optional[EventType[[]]] = None,
|
|
61
|
-
on_progress: Optional[
|
|
62
|
+
on_progress: Optional[
|
|
63
|
+
EventType[reflex.components.react_player.react_player.Progress]
|
|
64
|
+
] = None,
|
|
62
65
|
on_ready: Optional[EventType[[]]] = None,
|
|
63
66
|
on_scroll: Optional[EventType[[]]] = None,
|
|
64
|
-
on_seek: Optional[EventType] = None,
|
|
67
|
+
on_seek: Optional[EventType[float]] = None,
|
|
65
68
|
on_start: Optional[EventType[[]]] = None,
|
|
66
69
|
on_unmount: Optional[EventType[[]]] = None,
|
|
67
70
|
**props,
|
|
@@ -2,11 +2,22 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
+
from typing_extensions import TypedDict
|
|
6
|
+
|
|
5
7
|
from reflex.components.component import NoSSRComponent
|
|
6
8
|
from reflex.event import EventHandler, empty_event, identity_event
|
|
7
9
|
from reflex.vars.base import Var
|
|
8
10
|
|
|
9
11
|
|
|
12
|
+
class Progress(TypedDict):
|
|
13
|
+
"""Callback containing played and loaded progress as a fraction, and playedSeconds and loadedSeconds in seconds."""
|
|
14
|
+
|
|
15
|
+
played: float
|
|
16
|
+
playedSeconds: float
|
|
17
|
+
loaded: float
|
|
18
|
+
loadedSeconds: float
|
|
19
|
+
|
|
20
|
+
|
|
10
21
|
class ReactPlayer(NoSSRComponent):
|
|
11
22
|
"""Using react-player and not implement all props and callback yet.
|
|
12
23
|
reference: https://github.com/cookpete/react-player.
|
|
@@ -55,7 +66,7 @@ class ReactPlayer(NoSSRComponent):
|
|
|
55
66
|
on_play: EventHandler[empty_event]
|
|
56
67
|
|
|
57
68
|
# Callback containing played and loaded progress as a fraction, and playedSeconds and loadedSeconds in seconds. eg { played: 0.12, playedSeconds: 11.3, loaded: 0.34, loadedSeconds: 16.7 }
|
|
58
|
-
on_progress: EventHandler[
|
|
69
|
+
on_progress: EventHandler[identity_event(Progress)]
|
|
59
70
|
|
|
60
71
|
# Callback containing duration of the media, in seconds.
|
|
61
72
|
on_duration: EventHandler[identity_event(float)]
|
|
@@ -5,11 +5,19 @@
|
|
|
5
5
|
# ------------------------------------------------------
|
|
6
6
|
from typing import Any, Dict, Optional, Union, overload
|
|
7
7
|
|
|
8
|
+
from typing_extensions import TypedDict
|
|
9
|
+
|
|
8
10
|
from reflex.components.component import NoSSRComponent
|
|
9
11
|
from reflex.event import EventType
|
|
10
12
|
from reflex.style import Style
|
|
11
13
|
from reflex.vars.base import Var
|
|
12
14
|
|
|
15
|
+
class Progress(TypedDict):
|
|
16
|
+
played: float
|
|
17
|
+
playedSeconds: float
|
|
18
|
+
loaded: float
|
|
19
|
+
loadedSeconds: float
|
|
20
|
+
|
|
13
21
|
class ReactPlayer(NoSSRComponent):
|
|
14
22
|
@overload
|
|
15
23
|
@classmethod
|
|
@@ -39,7 +47,7 @@ class ReactPlayer(NoSSRComponent):
|
|
|
39
47
|
on_context_menu: Optional[EventType[[]]] = None,
|
|
40
48
|
on_disable_pip: Optional[EventType[[]]] = None,
|
|
41
49
|
on_double_click: Optional[EventType[[]]] = None,
|
|
42
|
-
on_duration: Optional[EventType] = None,
|
|
50
|
+
on_duration: Optional[EventType[float]] = None,
|
|
43
51
|
on_enable_pip: Optional[EventType[[]]] = None,
|
|
44
52
|
on_ended: Optional[EventType[[]]] = None,
|
|
45
53
|
on_error: Optional[EventType[[]]] = None,
|
|
@@ -56,10 +64,10 @@ class ReactPlayer(NoSSRComponent):
|
|
|
56
64
|
on_play: Optional[EventType[[]]] = None,
|
|
57
65
|
on_playback_quality_change: Optional[EventType[[]]] = None,
|
|
58
66
|
on_playback_rate_change: Optional[EventType[[]]] = None,
|
|
59
|
-
on_progress: Optional[EventType] = None,
|
|
67
|
+
on_progress: Optional[EventType[Progress]] = None,
|
|
60
68
|
on_ready: Optional[EventType[[]]] = None,
|
|
61
69
|
on_scroll: Optional[EventType[[]]] = None,
|
|
62
|
-
on_seek: Optional[EventType] = None,
|
|
70
|
+
on_seek: Optional[EventType[float]] = None,
|
|
63
71
|
on_start: Optional[EventType[[]]] = None,
|
|
64
72
|
on_unmount: Optional[EventType[[]]] = None,
|
|
65
73
|
**props,
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
# ------------------------------------------------------
|
|
6
6
|
from typing import Any, Dict, Optional, Union, overload
|
|
7
7
|
|
|
8
|
+
import reflex
|
|
8
9
|
from reflex.components.react_player.react_player import ReactPlayer
|
|
9
10
|
from reflex.event import EventType
|
|
10
11
|
from reflex.style import Style
|
|
@@ -41,7 +42,7 @@ class Video(ReactPlayer):
|
|
|
41
42
|
on_context_menu: Optional[EventType[[]]] = None,
|
|
42
43
|
on_disable_pip: Optional[EventType[[]]] = None,
|
|
43
44
|
on_double_click: Optional[EventType[[]]] = None,
|
|
44
|
-
on_duration: Optional[EventType] = None,
|
|
45
|
+
on_duration: Optional[EventType[float]] = None,
|
|
45
46
|
on_enable_pip: Optional[EventType[[]]] = None,
|
|
46
47
|
on_ended: Optional[EventType[[]]] = None,
|
|
47
48
|
on_error: Optional[EventType[[]]] = None,
|
|
@@ -58,10 +59,12 @@ class Video(ReactPlayer):
|
|
|
58
59
|
on_play: Optional[EventType[[]]] = None,
|
|
59
60
|
on_playback_quality_change: Optional[EventType[[]]] = None,
|
|
60
61
|
on_playback_rate_change: Optional[EventType[[]]] = None,
|
|
61
|
-
on_progress: Optional[
|
|
62
|
+
on_progress: Optional[
|
|
63
|
+
EventType[reflex.components.react_player.react_player.Progress]
|
|
64
|
+
] = None,
|
|
62
65
|
on_ready: Optional[EventType[[]]] = None,
|
|
63
66
|
on_scroll: Optional[EventType[[]]] = None,
|
|
64
|
-
on_seek: Optional[EventType] = None,
|
|
67
|
+
on_seek: Optional[EventType[float]] = None,
|
|
65
68
|
on_start: Optional[EventType[[]]] = None,
|
|
66
69
|
on_unmount: Optional[EventType[[]]] = None,
|
|
67
70
|
**props,
|
|
@@ -9,7 +9,7 @@ from reflex.utils import console
|
|
|
9
9
|
class Recharts(Component):
|
|
10
10
|
"""A component that wraps a recharts lib."""
|
|
11
11
|
|
|
12
|
-
library = "recharts@2.
|
|
12
|
+
library = "recharts@2.13.0"
|
|
13
13
|
|
|
14
14
|
def render(self) -> Dict:
|
|
15
15
|
"""Render the tag.
|
|
@@ -29,7 +29,7 @@ class Recharts(Component):
|
|
|
29
29
|
class RechartsCharts(NoSSRComponent, MemoizationLeaf):
|
|
30
30
|
"""A component that wraps a recharts lib."""
|
|
31
31
|
|
|
32
|
-
library = "recharts@2.
|
|
32
|
+
library = "recharts@2.13.0"
|
|
33
33
|
|
|
34
34
|
|
|
35
35
|
LiteralAnimationEasing = Literal["ease", "ease-in", "ease-out", "ease-in-out", "linear"]
|
|
@@ -251,7 +251,7 @@ class Toaster(Component):
|
|
|
251
251
|
_js_expr=f"{toast_ref} = toast",
|
|
252
252
|
_var_data=VarData(
|
|
253
253
|
imports={
|
|
254
|
-
"
|
|
254
|
+
"$/utils/state": [ImportVar(tag="refs")],
|
|
255
255
|
self.library: [ImportVar(tag="toast", install=False)],
|
|
256
256
|
}
|
|
257
257
|
),
|