Compare commits
8 Commits
main
...
release/re
Author | SHA1 | Date | |
---|---|---|---|
![]() |
3e9f346a54 | ||
![]() |
593ec2342f | ||
![]() |
1f7e7aff15 | ||
![]() |
d6e59b9b51 | ||
![]() |
cc337a8e52 | ||
![]() |
e0911c5e68 | ||
![]() |
4afea2d338 | ||
![]() |
103069a188 |
6
poetry.lock
generated
6
poetry.lock
generated
@ -1350,8 +1350,8 @@ files = [
|
|||||||
|
|
||||||
[package.dependencies]
|
[package.dependencies]
|
||||||
numpy = [
|
numpy = [
|
||||||
{version = ">=1.26.0", markers = "python_version >= \"3.12\""},
|
|
||||||
{version = ">=1.23.2", markers = "python_version == \"3.11\""},
|
{version = ">=1.23.2", markers = "python_version == \"3.11\""},
|
||||||
|
{version = ">=1.26.0", markers = "python_version >= \"3.12\""},
|
||||||
{version = ">=1.22.4", markers = "python_version < \"3.11\""},
|
{version = ">=1.22.4", markers = "python_version < \"3.11\""},
|
||||||
]
|
]
|
||||||
python-dateutil = ">=2.8.2"
|
python-dateutil = ">=2.8.2"
|
||||||
@ -1669,8 +1669,8 @@ files = [
|
|||||||
annotated-types = ">=0.6.0"
|
annotated-types = ">=0.6.0"
|
||||||
pydantic-core = "2.23.4"
|
pydantic-core = "2.23.4"
|
||||||
typing-extensions = [
|
typing-extensions = [
|
||||||
{version = ">=4.12.2", markers = "python_version >= \"3.13\""},
|
|
||||||
{version = ">=4.6.1", markers = "python_version < \"3.13\""},
|
{version = ">=4.6.1", markers = "python_version < \"3.13\""},
|
||||||
|
{version = ">=4.12.2", markers = "python_version >= \"3.13\""},
|
||||||
]
|
]
|
||||||
|
|
||||||
[package.extras]
|
[package.extras]
|
||||||
@ -3050,4 +3050,4 @@ type = ["pytest-mypy"]
|
|||||||
[metadata]
|
[metadata]
|
||||||
lock-version = "2.0"
|
lock-version = "2.0"
|
||||||
python-versions = "^3.9"
|
python-versions = "^3.9"
|
||||||
content-hash = "593a52e9f54e95b50074f1bc4b7cdbabe4fab325051c72b23219268c0c9aa3ba"
|
content-hash = "937f0cadb1a4566117dad8d0be6018ad1a8fe9aeb19c499d2a010d36ef391ee1"
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "reflex"
|
name = "reflex"
|
||||||
version = "0.6.5dev1"
|
version = "0.6.5"
|
||||||
description = "Web apps in pure Python."
|
description = "Web apps in pure Python."
|
||||||
license = "Apache-2.0"
|
license = "Apache-2.0"
|
||||||
authors = [
|
authors = [
|
||||||
@ -49,7 +49,7 @@ wrapt = [
|
|||||||
{version = ">=1.11.0,<2.0", python = "<3.11"},
|
{version = ">=1.11.0,<2.0", python = "<3.11"},
|
||||||
]
|
]
|
||||||
packaging = ">=23.1,<25.0"
|
packaging = ">=23.1,<25.0"
|
||||||
reflex-hosting-cli = ">=0.1.5,<2.0"
|
reflex-hosting-cli = ">=0.1.15,<2.0"
|
||||||
charset-normalizer = ">=3.3.2,<4.0"
|
charset-normalizer = ">=3.3.2,<4.0"
|
||||||
wheel = ">=0.42.0,<1.0"
|
wheel = ">=0.42.0,<1.0"
|
||||||
build = ">=1.0.3,<2.0"
|
build = ">=1.0.3,<2.0"
|
||||||
|
@ -5,6 +5,7 @@ from __future__ import annotations
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Any, Callable, ClassVar, Dict, List, Optional, Tuple
|
from typing import Any, Callable, ClassVar, Dict, List, Optional, Tuple
|
||||||
|
|
||||||
|
from reflex.components.base.fragment import Fragment
|
||||||
from reflex.components.component import (
|
from reflex.components.component import (
|
||||||
Component,
|
Component,
|
||||||
ComponentNamespace,
|
ComponentNamespace,
|
||||||
@ -181,6 +182,13 @@ class UploadFilesProvider(Component):
|
|||||||
tag = "UploadFilesProvider"
|
tag = "UploadFilesProvider"
|
||||||
|
|
||||||
|
|
||||||
|
class GhostUpload(Fragment):
|
||||||
|
"""A ghost upload component."""
|
||||||
|
|
||||||
|
# Fired when files are dropped.
|
||||||
|
on_drop: EventHandler[_on_drop_spec]
|
||||||
|
|
||||||
|
|
||||||
class Upload(MemoizationLeaf):
|
class Upload(MemoizationLeaf):
|
||||||
"""A file upload component."""
|
"""A file upload component."""
|
||||||
|
|
||||||
@ -276,8 +284,8 @@ class Upload(MemoizationLeaf):
|
|||||||
root_props_unique_name = get_unique_variable_name()
|
root_props_unique_name = get_unique_variable_name()
|
||||||
|
|
||||||
event_var, callback_str = StatefulComponent._get_memoized_event_triggers(
|
event_var, callback_str = StatefulComponent._get_memoized_event_triggers(
|
||||||
Box.create(on_click=upload_props["on_drop"]) # type: ignore
|
GhostUpload.create(on_drop=upload_props["on_drop"])
|
||||||
)["on_click"]
|
)["on_drop"]
|
||||||
|
|
||||||
upload_props["on_drop"] = event_var
|
upload_props["on_drop"] = event_var
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Any, ClassVar, Dict, List, Optional, Union, overload
|
from typing import Any, ClassVar, Dict, List, Optional, Union, overload
|
||||||
|
|
||||||
|
from reflex.components.base.fragment import Fragment
|
||||||
from reflex.components.component import Component, ComponentNamespace, MemoizationLeaf
|
from reflex.components.component import Component, ComponentNamespace, MemoizationLeaf
|
||||||
from reflex.constants import Dirs
|
from reflex.constants import Dirs
|
||||||
from reflex.event import BASE_STATE, CallableEventSpec, EventSpec, EventType
|
from reflex.event import BASE_STATE, CallableEventSpec, EventSpec, EventType
|
||||||
@ -84,6 +85,56 @@ class UploadFilesProvider(Component):
|
|||||||
"""
|
"""
|
||||||
...
|
...
|
||||||
|
|
||||||
|
class GhostUpload(Fragment):
|
||||||
|
@overload
|
||||||
|
@classmethod
|
||||||
|
def create( # type: ignore
|
||||||
|
cls,
|
||||||
|
*children,
|
||||||
|
style: Optional[Style] = None,
|
||||||
|
key: Optional[Any] = None,
|
||||||
|
id: Optional[Any] = None,
|
||||||
|
class_name: Optional[Any] = None,
|
||||||
|
autofocus: Optional[bool] = None,
|
||||||
|
custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
|
||||||
|
on_blur: Optional[EventType[[], BASE_STATE]] = None,
|
||||||
|
on_click: Optional[EventType[[], BASE_STATE]] = None,
|
||||||
|
on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
|
||||||
|
on_double_click: Optional[EventType[[], BASE_STATE]] = None,
|
||||||
|
on_drop: Optional[
|
||||||
|
Union[EventType[[], BASE_STATE], EventType[[Any], BASE_STATE]]
|
||||||
|
] = None,
|
||||||
|
on_focus: Optional[EventType[[], BASE_STATE]] = None,
|
||||||
|
on_mount: Optional[EventType[[], BASE_STATE]] = None,
|
||||||
|
on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
|
||||||
|
on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
|
||||||
|
on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
|
||||||
|
on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
|
||||||
|
on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
|
||||||
|
on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
|
||||||
|
on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
|
||||||
|
on_scroll: Optional[EventType[[], BASE_STATE]] = None,
|
||||||
|
on_unmount: Optional[EventType[[], BASE_STATE]] = None,
|
||||||
|
**props,
|
||||||
|
) -> "GhostUpload":
|
||||||
|
"""Create the component.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
*children: The children of the component.
|
||||||
|
on_drop: Fired when files are dropped.
|
||||||
|
style: The style of the component.
|
||||||
|
key: A unique key for the component.
|
||||||
|
id: The id for the component.
|
||||||
|
class_name: The class name for the component.
|
||||||
|
autofocus: Whether the component should take the focus once the page is loaded
|
||||||
|
custom_attrs: custom attribute
|
||||||
|
**props: The props of the component.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
The component.
|
||||||
|
"""
|
||||||
|
...
|
||||||
|
|
||||||
class Upload(MemoizationLeaf):
|
class Upload(MemoizationLeaf):
|
||||||
is_used: ClassVar[bool] = False
|
is_used: ClassVar[bool] = False
|
||||||
|
|
||||||
|
@ -112,6 +112,9 @@ class RadixThemesComponent(Component):
|
|||||||
|
|
||||||
library = "@radix-ui/themes@^3.0.0"
|
library = "@radix-ui/themes@^3.0.0"
|
||||||
|
|
||||||
|
# Temporary pin < 3.1.5 until radix-ui/themes#627 is resolved.
|
||||||
|
library = library + " && <3.1.5"
|
||||||
|
|
||||||
# "Fake" prop color_scheme is used to avoid shadowing CSS prop "color".
|
# "Fake" prop color_scheme is used to avoid shadowing CSS prop "color".
|
||||||
_rename_props: Dict[str, str] = {"colorScheme": "color"}
|
_rename_props: Dict[str, str] = {"colorScheme": "color"}
|
||||||
|
|
||||||
|
@ -46,6 +46,7 @@ from reflex import event
|
|||||||
from reflex.config import get_config
|
from reflex.config import get_config
|
||||||
from reflex.istate.data import RouterData
|
from reflex.istate.data import RouterData
|
||||||
from reflex.istate.storage import ClientStorageBase
|
from reflex.istate.storage import ClientStorageBase
|
||||||
|
from reflex.model import Model
|
||||||
from reflex.vars.base import (
|
from reflex.vars.base import (
|
||||||
ComputedVar,
|
ComputedVar,
|
||||||
DynamicRouteVar,
|
DynamicRouteVar,
|
||||||
@ -1733,15 +1734,20 @@ class BaseState(Base, ABC, extra=pydantic.Extra.allow):
|
|||||||
if value is None:
|
if value is None:
|
||||||
continue
|
continue
|
||||||
hinted_args = value_inside_optional(hinted_args)
|
hinted_args = value_inside_optional(hinted_args)
|
||||||
if (
|
if isinstance(value, dict) and inspect.isclass(hinted_args):
|
||||||
isinstance(value, dict)
|
if issubclass(hinted_args, Model):
|
||||||
and inspect.isclass(hinted_args)
|
# Remove non-fields from the payload
|
||||||
and (
|
payload[arg] = hinted_args(
|
||||||
dataclasses.is_dataclass(hinted_args)
|
**{
|
||||||
or issubclass(hinted_args, Base)
|
key: value
|
||||||
)
|
for key, value in value.items()
|
||||||
):
|
if key in hinted_args.__fields__
|
||||||
payload[arg] = hinted_args(**value)
|
}
|
||||||
|
)
|
||||||
|
elif dataclasses.is_dataclass(hinted_args) or issubclass(
|
||||||
|
hinted_args, Base
|
||||||
|
):
|
||||||
|
payload[arg] = hinted_args(**value)
|
||||||
if isinstance(value, list) and (hinted_args is set or hinted_args is Set):
|
if isinstance(value, list) and (hinted_args is set or hinted_args is Set):
|
||||||
payload[arg] = set(value)
|
payload[arg] = set(value)
|
||||||
if isinstance(value, list) and (
|
if isinstance(value, list) and (
|
||||||
|
@ -4,6 +4,7 @@ from reflex.components.core.banner import (
|
|||||||
ConnectionPulser,
|
ConnectionPulser,
|
||||||
WebsocketTargetURL,
|
WebsocketTargetURL,
|
||||||
)
|
)
|
||||||
|
from reflex.components.radix.themes.base import RadixThemesComponent
|
||||||
from reflex.components.radix.themes.typography.text import Text
|
from reflex.components.radix.themes.typography.text import Text
|
||||||
|
|
||||||
|
|
||||||
@ -24,7 +25,7 @@ def test_connection_banner():
|
|||||||
"react",
|
"react",
|
||||||
"$/utils/context",
|
"$/utils/context",
|
||||||
"$/utils/state",
|
"$/utils/state",
|
||||||
"@radix-ui/themes@^3.0.0",
|
RadixThemesComponent().library or "",
|
||||||
"$/env.json",
|
"$/env.json",
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@ -42,7 +43,7 @@ def test_connection_modal():
|
|||||||
"react",
|
"react",
|
||||||
"$/utils/context",
|
"$/utils/context",
|
||||||
"$/utils/state",
|
"$/utils/state",
|
||||||
"@radix-ui/themes@^3.0.0",
|
RadixThemesComponent().library or "",
|
||||||
"$/env.json",
|
"$/env.json",
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user