reflex 0.8.14a1__py3-none-any.whl → 0.8.14.post1__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/compiler/templates.py +4 -0
- reflex/components/core/upload.pyi +27 -9
- reflex/components/radix/primitives/__init__.py +1 -1
- reflex/components/radix/primitives/__init__.pyi +2 -1
- reflex/components/radix/primitives/base.py +31 -0
- reflex/components/radix/primitives/base.pyi +44 -0
- reflex/components/radix/primitives/dialog.py +148 -0
- reflex/components/radix/primitives/dialog.pyi +749 -0
- reflex/event.py +1 -1
- reflex/experimental/client_state.py +1 -1
- reflex/utils/js_runtimes.py +33 -23
- reflex/vars/base.py +3 -6
- reflex/vars/object.py +1 -3
- reflex/vars/sequence.py +2 -2
- {reflex-0.8.14a1.dist-info → reflex-0.8.14.post1.dist-info}/METADATA +1 -1
- {reflex-0.8.14a1.dist-info → reflex-0.8.14.post1.dist-info}/RECORD +19 -17
- {reflex-0.8.14a1.dist-info → reflex-0.8.14.post1.dist-info}/WHEEL +0 -0
- {reflex-0.8.14a1.dist-info → reflex-0.8.14.post1.dist-info}/entry_points.txt +0 -0
- {reflex-0.8.14a1.dist-info → reflex-0.8.14.post1.dist-info}/licenses/LICENSE +0 -0
reflex/compiler/templates.py
CHANGED
|
@@ -557,6 +557,10 @@ export default defineConfig((config) => ({{
|
|
|
557
557
|
build: {{
|
|
558
558
|
assetsDir: "{base}assets".slice(1),
|
|
559
559
|
rollupOptions: {{
|
|
560
|
+
onwarn(warning, warn) {{
|
|
561
|
+
if (warning.code === "EVAL" && warning.id && warning.id.endsWith("state.js")) return;
|
|
562
|
+
warn(warning);
|
|
563
|
+
}},
|
|
560
564
|
jsx: {{}},
|
|
561
565
|
output: {{
|
|
562
566
|
advancedChunks: {{
|
|
@@ -7,11 +7,19 @@ from collections.abc import Mapping, Sequence
|
|
|
7
7
|
from pathlib import Path
|
|
8
8
|
from typing import Any, ClassVar
|
|
9
9
|
|
|
10
|
+
import reflex
|
|
11
|
+
from reflex.app import UploadFile
|
|
10
12
|
from reflex.components.base.fragment import Fragment
|
|
11
13
|
from reflex.components.component import Component, ComponentNamespace, MemoizationLeaf
|
|
12
14
|
from reflex.components.core.breakpoints import Breakpoints
|
|
13
15
|
from reflex.constants import Dirs
|
|
14
|
-
from reflex.event import
|
|
16
|
+
from reflex.event import (
|
|
17
|
+
CallableEventSpec,
|
|
18
|
+
EventSpec,
|
|
19
|
+
EventType,
|
|
20
|
+
PointerEventInfo,
|
|
21
|
+
passthrough_event_spec,
|
|
22
|
+
)
|
|
15
23
|
from reflex.style import Style
|
|
16
24
|
from reflex.utils.imports import ImportVar
|
|
17
25
|
from reflex.vars import VarData
|
|
@@ -39,6 +47,8 @@ uploaded_files_url_prefix = Var(
|
|
|
39
47
|
|
|
40
48
|
def get_upload_url(file_path: str | Var[str]) -> Var[str]: ...
|
|
41
49
|
|
|
50
|
+
_on_drop_spec = passthrough_event_spec(list[UploadFile])
|
|
51
|
+
|
|
42
52
|
class UploadFilesProvider(Component):
|
|
43
53
|
@classmethod
|
|
44
54
|
def create(
|
|
@@ -107,8 +117,10 @@ class GhostUpload(Fragment):
|
|
|
107
117
|
on_click: EventType[()] | EventType[PointerEventInfo] | None = None,
|
|
108
118
|
on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None,
|
|
109
119
|
on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None,
|
|
110
|
-
on_drop: EventType[()] | EventType[
|
|
111
|
-
on_drop_rejected: EventType[()]
|
|
120
|
+
on_drop: EventType[()] | EventType[list[reflex.app.UploadFile]] | None = None,
|
|
121
|
+
on_drop_rejected: EventType[()]
|
|
122
|
+
| EventType[list[reflex.app.UploadFile]]
|
|
123
|
+
| None = None,
|
|
112
124
|
on_focus: EventType[()] | None = None,
|
|
113
125
|
on_mount: EventType[()] | None = None,
|
|
114
126
|
on_mouse_down: EventType[()] | None = None,
|
|
@@ -172,8 +184,10 @@ class Upload(MemoizationLeaf):
|
|
|
172
184
|
on_click: EventType[()] | EventType[PointerEventInfo] | None = None,
|
|
173
185
|
on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None,
|
|
174
186
|
on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None,
|
|
175
|
-
on_drop: EventType[()] | EventType[
|
|
176
|
-
on_drop_rejected: EventType[()]
|
|
187
|
+
on_drop: EventType[()] | EventType[list[reflex.app.UploadFile]] | None = None,
|
|
188
|
+
on_drop_rejected: EventType[()]
|
|
189
|
+
| EventType[list[reflex.app.UploadFile]]
|
|
190
|
+
| None = None,
|
|
177
191
|
on_focus: EventType[()] | None = None,
|
|
178
192
|
on_mount: EventType[()] | None = None,
|
|
179
193
|
on_mouse_down: EventType[()] | None = None,
|
|
@@ -245,8 +259,10 @@ class StyledUpload(Upload):
|
|
|
245
259
|
on_click: EventType[()] | EventType[PointerEventInfo] | None = None,
|
|
246
260
|
on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None,
|
|
247
261
|
on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None,
|
|
248
|
-
on_drop: EventType[()] | EventType[
|
|
249
|
-
on_drop_rejected: EventType[()]
|
|
262
|
+
on_drop: EventType[()] | EventType[list[reflex.app.UploadFile]] | None = None,
|
|
263
|
+
on_drop_rejected: EventType[()]
|
|
264
|
+
| EventType[list[reflex.app.UploadFile]]
|
|
265
|
+
| None = None,
|
|
250
266
|
on_focus: EventType[()] | None = None,
|
|
251
267
|
on_mount: EventType[()] | None = None,
|
|
252
268
|
on_mouse_down: EventType[()] | None = None,
|
|
@@ -319,8 +335,10 @@ class UploadNamespace(ComponentNamespace):
|
|
|
319
335
|
on_click: EventType[()] | EventType[PointerEventInfo] | None = None,
|
|
320
336
|
on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None,
|
|
321
337
|
on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None,
|
|
322
|
-
on_drop: EventType[()] | EventType[
|
|
323
|
-
on_drop_rejected: EventType[()]
|
|
338
|
+
on_drop: EventType[()] | EventType[list[reflex.app.UploadFile]] | None = None,
|
|
339
|
+
on_drop_rejected: EventType[()]
|
|
340
|
+
| EventType[list[reflex.app.UploadFile]]
|
|
341
|
+
| None = None,
|
|
324
342
|
on_focus: EventType[()] | None = None,
|
|
325
343
|
on_mount: EventType[()] | None = None,
|
|
326
344
|
on_mouse_down: EventType[()] | None = None,
|
|
@@ -8,7 +8,7 @@ from reflex.utils import lazy_loader
|
|
|
8
8
|
_SUBMOD_ATTRS: dict[str, list[str]] = {
|
|
9
9
|
"".join(k.split("components.radix.primitives.")[-1]): v
|
|
10
10
|
for k, v in RADIX_PRIMITIVES_MAPPING.items()
|
|
11
|
-
}
|
|
11
|
+
} | {"dialog": ["dialog"]}
|
|
12
12
|
|
|
13
13
|
__getattr__, __dir__, __all__ = lazy_loader.attach(
|
|
14
14
|
__name__,
|
|
@@ -4,8 +4,9 @@
|
|
|
4
4
|
# ------------------------------------------------------
|
|
5
5
|
|
|
6
6
|
from .accordion import accordion
|
|
7
|
+
from .dialog import dialog
|
|
7
8
|
from .drawer import drawer
|
|
8
9
|
from .form import form
|
|
9
10
|
from .progress import progress
|
|
10
11
|
|
|
11
|
-
__all__ = ["accordion", "drawer", "form", "progress"]
|
|
12
|
+
__all__ = ["accordion", "dialog", "drawer", "form", "progress"]
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"""The base component for Radix primitives."""
|
|
2
2
|
|
|
3
|
+
from typing import Any
|
|
4
|
+
|
|
3
5
|
from reflex.components.component import Component
|
|
4
6
|
from reflex.components.tags.tag import Tag
|
|
5
7
|
from reflex.utils import format
|
|
@@ -24,3 +26,32 @@ class RadixPrimitiveComponentWithClassName(RadixPrimitiveComponent):
|
|
|
24
26
|
class_name=f"{format.to_title_case(self.tag or '')} {self.class_name or ''}"
|
|
25
27
|
)
|
|
26
28
|
)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class RadixPrimitiveTriggerComponent(RadixPrimitiveComponent):
|
|
32
|
+
"""Base class for Trigger, Close, Cancel, and Accept components.
|
|
33
|
+
|
|
34
|
+
These components trigger some action in an overlay component that depends on the
|
|
35
|
+
on_click event, and thus if a child is provided and has on_click specified, it
|
|
36
|
+
will overtake the internal action, unless it is wrapped in some inert component,
|
|
37
|
+
in this case, a Flex.
|
|
38
|
+
"""
|
|
39
|
+
|
|
40
|
+
@classmethod
|
|
41
|
+
def create(cls, *children: Any, **props: Any) -> Component:
|
|
42
|
+
"""Create a new RadixPrimitiveTriggerComponent instance.
|
|
43
|
+
|
|
44
|
+
Args:
|
|
45
|
+
children: The children of the component.
|
|
46
|
+
props: The properties of the component.
|
|
47
|
+
|
|
48
|
+
Returns:
|
|
49
|
+
The new RadixPrimitiveTriggerComponent instance.
|
|
50
|
+
"""
|
|
51
|
+
from reflex.components.el.elements.typography import Div
|
|
52
|
+
|
|
53
|
+
for child in children:
|
|
54
|
+
if "on_click" in getattr(child, "event_triggers", {}):
|
|
55
|
+
children = (Div.create(*children),)
|
|
56
|
+
break
|
|
57
|
+
return super().create(*children, **props)
|
|
@@ -112,3 +112,47 @@ class RadixPrimitiveComponentWithClassName(RadixPrimitiveComponent):
|
|
|
112
112
|
Returns:
|
|
113
113
|
The component.
|
|
114
114
|
"""
|
|
115
|
+
|
|
116
|
+
class RadixPrimitiveTriggerComponent(RadixPrimitiveComponent):
|
|
117
|
+
@classmethod
|
|
118
|
+
def create(
|
|
119
|
+
cls,
|
|
120
|
+
*children,
|
|
121
|
+
as_child: Var[bool] | bool | None = None,
|
|
122
|
+
style: Sequence[Mapping[str, Any]]
|
|
123
|
+
| Mapping[str, Any]
|
|
124
|
+
| Var[Mapping[str, Any]]
|
|
125
|
+
| Breakpoints
|
|
126
|
+
| None = None,
|
|
127
|
+
key: Any | None = None,
|
|
128
|
+
id: Any | None = None,
|
|
129
|
+
ref: Var | None = None,
|
|
130
|
+
class_name: Any | None = None,
|
|
131
|
+
custom_attrs: dict[str, Var | Any] | None = None,
|
|
132
|
+
on_blur: EventType[()] | None = None,
|
|
133
|
+
on_click: EventType[()] | EventType[PointerEventInfo] | None = None,
|
|
134
|
+
on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None,
|
|
135
|
+
on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None,
|
|
136
|
+
on_focus: EventType[()] | None = None,
|
|
137
|
+
on_mount: EventType[()] | None = None,
|
|
138
|
+
on_mouse_down: EventType[()] | None = None,
|
|
139
|
+
on_mouse_enter: EventType[()] | None = None,
|
|
140
|
+
on_mouse_leave: EventType[()] | None = None,
|
|
141
|
+
on_mouse_move: EventType[()] | None = None,
|
|
142
|
+
on_mouse_out: EventType[()] | None = None,
|
|
143
|
+
on_mouse_over: EventType[()] | None = None,
|
|
144
|
+
on_mouse_up: EventType[()] | None = None,
|
|
145
|
+
on_scroll: EventType[()] | None = None,
|
|
146
|
+
on_scroll_end: EventType[()] | None = None,
|
|
147
|
+
on_unmount: EventType[()] | None = None,
|
|
148
|
+
**props,
|
|
149
|
+
) -> RadixPrimitiveTriggerComponent:
|
|
150
|
+
"""Create a new RadixPrimitiveTriggerComponent instance.
|
|
151
|
+
|
|
152
|
+
Args:
|
|
153
|
+
children: The children of the component.
|
|
154
|
+
props: The properties of the component.
|
|
155
|
+
|
|
156
|
+
Returns:
|
|
157
|
+
The new RadixPrimitiveTriggerComponent instance.
|
|
158
|
+
"""
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
"""Interactive components provided by @radix-ui/react-dialog."""
|
|
2
|
+
|
|
3
|
+
from typing import Any
|
|
4
|
+
|
|
5
|
+
from reflex.components.component import ComponentNamespace
|
|
6
|
+
from reflex.components.el import elements
|
|
7
|
+
from reflex.constants.compiler import MemoizationMode
|
|
8
|
+
from reflex.event import EventHandler, no_args_event_spec, passthrough_event_spec
|
|
9
|
+
from reflex.vars.base import Var
|
|
10
|
+
|
|
11
|
+
from .base import RadixPrimitiveComponent, RadixPrimitiveTriggerComponent
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class DialogElement(RadixPrimitiveComponent):
|
|
15
|
+
"""Base class for all @radix-ui/react-dialog components."""
|
|
16
|
+
|
|
17
|
+
library = "@radix-ui/react-dialog@1.1.15"
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class DialogRoot(DialogElement):
|
|
21
|
+
"""Root component for Dialog."""
|
|
22
|
+
|
|
23
|
+
tag = "Root"
|
|
24
|
+
alias = "RadixPrimitiveDialogRoot"
|
|
25
|
+
|
|
26
|
+
# The controlled open state of the dialog.
|
|
27
|
+
open: Var[bool]
|
|
28
|
+
|
|
29
|
+
# Fired when the open state changes.
|
|
30
|
+
on_open_change: EventHandler[passthrough_event_spec(bool)]
|
|
31
|
+
|
|
32
|
+
# The open state of the dialog when it is initially rendered. Use when you do not need to control its open state.
|
|
33
|
+
default_open: Var[bool]
|
|
34
|
+
|
|
35
|
+
# The modality of the dialog. When set to true, interaction with outside elements will be disabled and only dialog content will be visible to screen readers.
|
|
36
|
+
modal: Var[bool]
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
class DialogPortal(DialogElement):
|
|
40
|
+
"""Portal component for Dialog."""
|
|
41
|
+
|
|
42
|
+
tag = "Portal"
|
|
43
|
+
alias = "RadixPrimitiveDialogPortal"
|
|
44
|
+
|
|
45
|
+
# Used to force mounting when more control is needed. Useful when controlling animation with React animation libraries. If used on this part, it will be inherited by Dialog.Overlay and Dialog.Content.
|
|
46
|
+
force_mount: Var[bool]
|
|
47
|
+
|
|
48
|
+
# Specify a container element to portal the content into.
|
|
49
|
+
container: Var[Any]
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
class DialogOverlay(DialogElement):
|
|
53
|
+
"""A layer that covers the inert portion of the view when the dialog is open."""
|
|
54
|
+
|
|
55
|
+
tag = "Overlay"
|
|
56
|
+
alias = "RadixPrimitiveDialogOverlay"
|
|
57
|
+
|
|
58
|
+
# Change the default rendered element for the one passed as a child, merging their props and behavior.
|
|
59
|
+
as_child: Var[bool]
|
|
60
|
+
|
|
61
|
+
# Used to force mounting when more control is needed. Useful when controlling animation with React animation libraries. It inherits from Dialog.Portal.
|
|
62
|
+
force_mount: Var[bool]
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
class DialogTrigger(DialogElement, RadixPrimitiveTriggerComponent):
|
|
66
|
+
"""Trigger an action or event, to open a Dialog modal."""
|
|
67
|
+
|
|
68
|
+
tag = "Trigger"
|
|
69
|
+
alias = "RadixPrimitiveDialogTrigger"
|
|
70
|
+
|
|
71
|
+
# Change the default rendered element for the one passed as a child, merging their props and behavior.
|
|
72
|
+
as_child: Var[bool]
|
|
73
|
+
|
|
74
|
+
_memoization_mode = MemoizationMode(recursive=False)
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
class DialogContent(elements.Div, DialogElement):
|
|
78
|
+
"""Content component to display inside a Dialog modal."""
|
|
79
|
+
|
|
80
|
+
tag = "Content"
|
|
81
|
+
alias = "RadixPrimitiveDialogContent"
|
|
82
|
+
|
|
83
|
+
# Used to force mounting when more control is needed. Useful when controlling animation with React animation libraries. It inherits from Dialog.Portal.
|
|
84
|
+
force_mount: Var[bool]
|
|
85
|
+
|
|
86
|
+
# Change the default rendered element for the one passed as a child, merging their props and behavior.
|
|
87
|
+
as_child: Var[bool]
|
|
88
|
+
|
|
89
|
+
# Fired when the dialog is opened.
|
|
90
|
+
on_open_auto_focus: EventHandler[no_args_event_spec]
|
|
91
|
+
|
|
92
|
+
# Fired when the dialog is closed.
|
|
93
|
+
on_close_auto_focus: EventHandler[no_args_event_spec]
|
|
94
|
+
|
|
95
|
+
# Fired when the escape key is pressed.
|
|
96
|
+
on_escape_key_down: EventHandler[no_args_event_spec]
|
|
97
|
+
|
|
98
|
+
# Fired when the pointer is down outside the dialog.
|
|
99
|
+
on_pointer_down_outside: EventHandler[no_args_event_spec]
|
|
100
|
+
|
|
101
|
+
# Fired when the pointer interacts outside the dialog.
|
|
102
|
+
on_interact_outside: EventHandler[no_args_event_spec]
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
class DialogTitle(DialogElement):
|
|
106
|
+
"""Title component to display inside a Dialog modal."""
|
|
107
|
+
|
|
108
|
+
tag = "Title"
|
|
109
|
+
alias = "RadixPrimitiveDialogTitle"
|
|
110
|
+
|
|
111
|
+
# Change the default rendered element for the one passed as a child, merging their props and behavior.
|
|
112
|
+
as_child: Var[bool]
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
class DialogDescription(DialogElement):
|
|
116
|
+
"""Description component to display inside a Dialog modal."""
|
|
117
|
+
|
|
118
|
+
tag = "Description"
|
|
119
|
+
alias = "RadixPrimitiveDialogDescription"
|
|
120
|
+
|
|
121
|
+
# Change the default rendered element for the one passed as a child, merging their props and behavior.
|
|
122
|
+
as_child: Var[bool]
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
class DialogClose(DialogElement, RadixPrimitiveTriggerComponent):
|
|
126
|
+
"""Close button component to close an open Dialog modal."""
|
|
127
|
+
|
|
128
|
+
tag = "Close"
|
|
129
|
+
alias = "RadixPrimitiveDialogClose"
|
|
130
|
+
|
|
131
|
+
# Change the default rendered element for the one passed as a child, merging their props and behavior.
|
|
132
|
+
as_child: Var[bool]
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
class Dialog(ComponentNamespace):
|
|
136
|
+
"""Dialog components namespace."""
|
|
137
|
+
|
|
138
|
+
root = __call__ = staticmethod(DialogRoot.create)
|
|
139
|
+
portal = staticmethod(DialogPortal.create)
|
|
140
|
+
trigger = staticmethod(DialogTrigger.create)
|
|
141
|
+
title = staticmethod(DialogTitle.create)
|
|
142
|
+
overlay = staticmethod(DialogOverlay.create)
|
|
143
|
+
content = staticmethod(DialogContent.create)
|
|
144
|
+
description = staticmethod(DialogDescription.create)
|
|
145
|
+
close = staticmethod(DialogClose.create)
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
dialog = Dialog()
|