reflex 0.8.13__py3-none-any.whl → 0.8.14__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.

Files changed (40) hide show
  1. reflex/app.py +25 -5
  2. reflex/compiler/templates.py +4 -0
  3. reflex/components/core/upload.py +9 -13
  4. reflex/components/core/upload.pyi +27 -9
  5. reflex/components/plotly/plotly.py +9 -9
  6. reflex/components/radix/primitives/__init__.py +1 -1
  7. reflex/components/radix/primitives/__init__.pyi +2 -1
  8. reflex/components/radix/primitives/base.py +31 -0
  9. reflex/components/radix/primitives/base.pyi +44 -0
  10. reflex/components/radix/primitives/dialog.py +148 -0
  11. reflex/components/radix/primitives/dialog.pyi +749 -0
  12. reflex/components/radix/primitives/slider.py +3 -17
  13. reflex/components/radix/primitives/slider.pyi +2 -4
  14. reflex/components/radix/themes/components/slider.py +1 -2
  15. reflex/components/radix/themes/components/slider.pyi +3 -6
  16. reflex/constants/colors.py +1 -3
  17. reflex/constants/installer.py +5 -5
  18. reflex/custom_components/custom_components.py +18 -18
  19. reflex/environment.py +3 -0
  20. reflex/event.py +1 -1
  21. reflex/plugins/shared_tailwind.py +1 -1
  22. reflex/reflex.py +62 -24
  23. reflex/state.py +3 -2
  24. reflex/utils/exec.py +23 -4
  25. reflex/utils/frontend_skeleton.py +3 -5
  26. reflex/utils/js_runtimes.py +43 -33
  27. reflex/utils/prerequisites.py +5 -6
  28. reflex/utils/processes.py +10 -11
  29. reflex/utils/rename.py +3 -5
  30. reflex/utils/serializers.py +3 -7
  31. reflex/utils/templates.py +20 -22
  32. reflex/vars/base.py +3 -6
  33. reflex/vars/color.py +2 -68
  34. reflex/vars/object.py +1 -3
  35. reflex/vars/sequence.py +2 -2
  36. {reflex-0.8.13.dist-info → reflex-0.8.14.dist-info}/METADATA +1 -1
  37. {reflex-0.8.13.dist-info → reflex-0.8.14.dist-info}/RECORD +40 -38
  38. {reflex-0.8.13.dist-info → reflex-0.8.14.dist-info}/WHEEL +0 -0
  39. {reflex-0.8.13.dist-info → reflex-0.8.14.dist-info}/entry_points.txt +0 -0
  40. {reflex-0.8.13.dist-info → reflex-0.8.14.dist-info}/licenses/LICENSE +0 -0
reflex/app.py CHANGED
@@ -69,7 +69,6 @@ from reflex.components.core.banner import (
69
69
  )
70
70
  from reflex.components.core.breakpoints import set_breakpoints
71
71
  from reflex.components.core.sticky import sticky
72
- from reflex.components.core.upload import Upload, get_upload_dir
73
72
  from reflex.components.radix import themes
74
73
  from reflex.components.sonner.toast import toast
75
74
  from reflex.config import get_config
@@ -628,6 +627,18 @@ class App(MiddlewareMixin, LifespanMixin):
628
627
 
629
628
  asgi_app = self._api
630
629
 
630
+ if environment.REFLEX_MOUNT_FRONTEND_COMPILED_APP.get():
631
+ asgi_app.mount(
632
+ "/" + config.frontend_path.strip("/"),
633
+ StaticFiles(
634
+ directory=prerequisites.get_web_dir()
635
+ / constants.Dirs.STATIC
636
+ / config.frontend_path.strip("/"),
637
+ html=True,
638
+ ),
639
+ name="frontend",
640
+ )
641
+
631
642
  if self.api_transformer is not None:
632
643
  api_transformers: Sequence[Starlette | Callable[[ASGIApp], ASGIApp]] = (
633
644
  [self.api_transformer]
@@ -670,6 +681,8 @@ class App(MiddlewareMixin, LifespanMixin):
670
681
 
671
682
  def _add_optional_endpoints(self):
672
683
  """Add optional api endpoints (_upload)."""
684
+ from reflex.components.core.upload import Upload, get_upload_dir
685
+
673
686
  if not self._api:
674
687
  return
675
688
  upload_is_used_marker = (
@@ -1010,11 +1023,18 @@ class App(MiddlewareMixin, LifespanMixin):
1010
1023
  for component in tuple(app_wrappers.values()):
1011
1024
  app_wrappers.update(component._get_all_app_wrap_components())
1012
1025
  order = sorted(app_wrappers, key=lambda k: k[0], reverse=True)
1013
- root = parent = copy.deepcopy(app_wrappers[order[0]])
1014
- for key in order[1:]:
1026
+ root = copy.deepcopy(app_wrappers[order[0]])
1027
+
1028
+ def reducer(parent: Component, key: tuple[int, str]) -> Component:
1015
1029
  child = copy.deepcopy(app_wrappers[key])
1016
1030
  parent.children.append(child)
1017
- parent = child
1031
+ return child
1032
+
1033
+ functools.reduce(
1034
+ lambda parent, key: reducer(parent, key),
1035
+ order[1:],
1036
+ root,
1037
+ )
1018
1038
  return root
1019
1039
 
1020
1040
  def _should_compile(self) -> bool:
@@ -1274,7 +1294,7 @@ class App(MiddlewareMixin, LifespanMixin):
1274
1294
 
1275
1295
  toast_provider = Fragment.create(memoized_toast_provider())
1276
1296
 
1277
- app_wrappers[(1, "ToasterProvider")] = toast_provider
1297
+ app_wrappers[(44, "ToasterProvider")] = toast_provider
1278
1298
 
1279
1299
  # Add the app wraps to the app.
1280
1300
  for key, app_wrap in chain(
@@ -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: {{
@@ -6,6 +6,7 @@ from collections.abc import Callable, Sequence
6
6
  from pathlib import Path
7
7
  from typing import Any, ClassVar
8
8
 
9
+ from reflex.app import UploadFile
9
10
  from reflex.components.base.fragment import Fragment
10
11
  from reflex.components.component import (
11
12
  Component,
@@ -29,7 +30,9 @@ from reflex.event import (
29
30
  call_event_fn,
30
31
  call_event_handler,
31
32
  parse_args_spec,
33
+ passthrough_event_spec,
32
34
  run_script,
35
+ upload_files,
33
36
  )
34
37
  from reflex.style import Style
35
38
  from reflex.utils import format
@@ -168,16 +171,7 @@ def get_upload_url(file_path: str | Var[str]) -> Var[str]:
168
171
  return Var.create(f"{uploaded_files_url_prefix}/{file_path}")
169
172
 
170
173
 
171
- def _on_drop_spec(files: Var) -> tuple[Var[Any]]:
172
- """Args spec for the on_drop event trigger.
173
-
174
- Args:
175
- files: The files to upload.
176
-
177
- Returns:
178
- Signature for on_drop handler including the files to upload.
179
- """
180
- return (files,)
174
+ _on_drop_spec = passthrough_event_spec(list[UploadFile])
181
175
 
182
176
 
183
177
  def _default_drop_rejected(rejected_files: ArrayVar[list[dict[str, Any]]]) -> EventSpec:
@@ -302,11 +296,11 @@ class Upload(MemoizationLeaf):
302
296
  }
303
297
 
304
298
  # Create the component.
305
- upload_props["id"] = props.get("id", DEFAULT_UPLOAD_ID)
299
+ upload_props["id"] = upload_id = props.get("id", DEFAULT_UPLOAD_ID)
306
300
 
307
301
  if upload_props.get("on_drop") is None:
308
302
  # If on_drop is not provided, save files to be uploaded later.
309
- upload_props["on_drop"] = upload_file(upload_props["id"])
303
+ upload_props["on_drop"] = upload_file(upload_id)
310
304
  else:
311
305
  on_drop = (
312
306
  [on_drop_prop]
@@ -314,7 +308,9 @@ class Upload(MemoizationLeaf):
314
308
  else list(on_drop_prop)
315
309
  )
316
310
  for ix, event in enumerate(on_drop):
317
- if isinstance(event, (EventHandler, EventSpec)):
311
+ if isinstance(event, EventHandler):
312
+ event = event(upload_files(upload_id))
313
+ if isinstance(event, EventSpec):
318
314
  # Call the lambda to get the event chain.
319
315
  event = call_event_handler(event, _on_drop_spec)
320
316
  elif isinstance(event, Callable):
@@ -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 CallableEventSpec, EventSpec, EventType, PointerEventInfo
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[Any] | None = None,
111
- on_drop_rejected: EventType[()] | EventType[Any] | None = None,
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[Any] | None = None,
176
- on_drop_rejected: EventType[()] | EventType[Any] | None = None,
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[Any] | None = None,
249
- on_drop_rejected: EventType[()] | EventType[Any] | None = None,
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[Any] | None = None,
323
- on_drop_rejected: EventType[()] | EventType[Any] | None = None,
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,
@@ -72,7 +72,7 @@ class Plotly(NoSSRComponent):
72
72
 
73
73
  library = "react-plotly.js@2.6.0"
74
74
 
75
- lib_dependencies: list[str] = ["plotly.js@3.1.0"]
75
+ lib_dependencies: list[str] = ["plotly.js@3.1.1"]
76
76
 
77
77
  tag = "Plot"
78
78
 
@@ -303,7 +303,7 @@ class PlotlyBasic(Plotly):
303
303
 
304
304
  library = "react-plotly.js@2.6.0"
305
305
 
306
- lib_dependencies: list[str] = ["plotly.js-basic-dist-min@3.1.0"]
306
+ lib_dependencies: list[str] = ["plotly.js-basic-dist-min@3.1.1"]
307
307
 
308
308
  def add_imports(self) -> ImportDict | list[ImportDict]:
309
309
  """Add imports for the plotly basic component.
@@ -329,7 +329,7 @@ class PlotlyCartesian(Plotly):
329
329
 
330
330
  library = "react-plotly.js@2.6.0"
331
331
 
332
- lib_dependencies: list[str] = ["plotly.js-cartesian-dist-min@3.1.0"]
332
+ lib_dependencies: list[str] = ["plotly.js-cartesian-dist-min@3.1.1"]
333
333
 
334
334
  def add_imports(self) -> ImportDict | list[ImportDict]:
335
335
  """Add imports for the plotly cartesian component.
@@ -355,7 +355,7 @@ class PlotlyGeo(Plotly):
355
355
 
356
356
  library = "react-plotly.js@2.6.0"
357
357
 
358
- lib_dependencies: list[str] = ["plotly.js-geo-dist-min@3.1.0"]
358
+ lib_dependencies: list[str] = ["plotly.js-geo-dist-min@3.1.1"]
359
359
 
360
360
  def add_imports(self) -> ImportDict | list[ImportDict]:
361
361
  """Add imports for the plotly geo component.
@@ -381,7 +381,7 @@ class PlotlyGl3d(Plotly):
381
381
 
382
382
  library = "react-plotly.js@2.6.0"
383
383
 
384
- lib_dependencies: list[str] = ["plotly.js-gl3d-dist-min@3.1.0"]
384
+ lib_dependencies: list[str] = ["plotly.js-gl3d-dist-min@3.1.1"]
385
385
 
386
386
  def add_imports(self) -> ImportDict | list[ImportDict]:
387
387
  """Add imports for the plotly 3d component.
@@ -407,7 +407,7 @@ class PlotlyGl2d(Plotly):
407
407
 
408
408
  library = "react-plotly.js@2.6.0"
409
409
 
410
- lib_dependencies: list[str] = ["plotly.js-gl2d-dist-min@3.1.0"]
410
+ lib_dependencies: list[str] = ["plotly.js-gl2d-dist-min@3.1.1"]
411
411
 
412
412
  def add_imports(self) -> ImportDict | list[ImportDict]:
413
413
  """Add imports for the plotly 2d component.
@@ -433,7 +433,7 @@ class PlotlyMapbox(Plotly):
433
433
 
434
434
  library = "react-plotly.js@2.6.0"
435
435
 
436
- lib_dependencies: list[str] = ["plotly.js-mapbox-dist-min@3.1.0"]
436
+ lib_dependencies: list[str] = ["plotly.js-mapbox-dist-min@3.1.1"]
437
437
 
438
438
  def add_imports(self) -> ImportDict | list[ImportDict]:
439
439
  """Add imports for the plotly mapbox component.
@@ -459,7 +459,7 @@ class PlotlyFinance(Plotly):
459
459
 
460
460
  library = "react-plotly.js@2.6.0"
461
461
 
462
- lib_dependencies: list[str] = ["plotly.js-finance-dist-min@3.1.0"]
462
+ lib_dependencies: list[str] = ["plotly.js-finance-dist-min@3.1.1"]
463
463
 
464
464
  def add_imports(self) -> ImportDict | list[ImportDict]:
465
465
  """Add imports for the plotly finance component.
@@ -485,7 +485,7 @@ class PlotlyStrict(Plotly):
485
485
 
486
486
  library = "react-plotly.js@2.6.0"
487
487
 
488
- lib_dependencies: list[str] = ["plotly.js-strict-dist-min@3.1.0"]
488
+ lib_dependencies: list[str] = ["plotly.js-strict-dist-min@3.1.1"]
489
489
 
490
490
  def add_imports(self) -> ImportDict | list[ImportDict]:
491
491
  """Add imports for the plotly strict component.
@@ -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()