upload.pyi 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. """Stub file for reflex/components/forms/upload.py"""
  2. # ------------------- DO NOT EDIT ----------------------
  3. # This file was generated by `scripts/pyi_generator.py`!
  4. # ------------------------------------------------------
  5. from typing import Any, Dict, Literal, Optional, Union, overload
  6. from reflex.vars import Var, BaseVar, ComputedVar
  7. from reflex.event import EventChain, EventHandler, EventSpec
  8. from reflex.style import Style
  9. from typing import Any, Dict, List, Optional, Union
  10. from reflex import constants
  11. from reflex.components.component import Component
  12. from reflex.components.forms.input import Input
  13. from reflex.components.layout.box import Box
  14. from reflex.event import CallableEventSpec, EventChain, EventSpec, call_script
  15. from reflex.utils import imports
  16. from reflex.vars import BaseVar, CallableVar, ImportVar, Var
  17. DEFAULT_UPLOAD_ID: str
  18. @CallableVar
  19. def upload_file(id_: str = DEFAULT_UPLOAD_ID) -> BaseVar: ...
  20. @CallableVar
  21. def selected_files(id_: str = DEFAULT_UPLOAD_ID) -> BaseVar: ...
  22. @CallableEventSpec
  23. def clear_selected_files(id_: str = DEFAULT_UPLOAD_ID) -> EventSpec: ...
  24. def cancel_upload(upload_id: str) -> EventSpec: ...
  25. class Upload(Component):
  26. @overload
  27. @classmethod
  28. def create( # type: ignore
  29. cls,
  30. *children,
  31. accept: Optional[
  32. Union[Var[Optional[Dict[str, List]]], Optional[Dict[str, List]]]
  33. ] = None,
  34. disabled: Optional[Union[Var[bool], bool]] = None,
  35. max_files: Optional[Union[Var[int], int]] = None,
  36. max_size: Optional[Union[Var[int], int]] = None,
  37. min_size: Optional[Union[Var[int], int]] = None,
  38. multiple: Optional[Union[Var[bool], bool]] = None,
  39. no_click: Optional[Union[Var[bool], bool]] = None,
  40. no_drag: Optional[Union[Var[bool], bool]] = None,
  41. no_keyboard: Optional[Union[Var[bool], bool]] = None,
  42. style: Optional[Style] = None,
  43. key: Optional[Any] = None,
  44. id: Optional[Any] = None,
  45. class_name: Optional[Any] = None,
  46. autofocus: Optional[bool] = None,
  47. custom_attrs: Optional[Dict[str, str]] = None,
  48. on_blur: Optional[
  49. Union[EventHandler, EventSpec, list, function, BaseVar]
  50. ] = None,
  51. on_click: Optional[
  52. Union[EventHandler, EventSpec, list, function, BaseVar]
  53. ] = None,
  54. on_context_menu: Optional[
  55. Union[EventHandler, EventSpec, list, function, BaseVar]
  56. ] = None,
  57. on_double_click: Optional[
  58. Union[EventHandler, EventSpec, list, function, BaseVar]
  59. ] = None,
  60. on_drop: Optional[
  61. Union[EventHandler, EventSpec, list, function, BaseVar]
  62. ] = None,
  63. on_focus: Optional[
  64. Union[EventHandler, EventSpec, list, function, BaseVar]
  65. ] = None,
  66. on_mount: Optional[
  67. Union[EventHandler, EventSpec, list, function, BaseVar]
  68. ] = None,
  69. on_mouse_down: Optional[
  70. Union[EventHandler, EventSpec, list, function, BaseVar]
  71. ] = None,
  72. on_mouse_enter: Optional[
  73. Union[EventHandler, EventSpec, list, function, BaseVar]
  74. ] = None,
  75. on_mouse_leave: Optional[
  76. Union[EventHandler, EventSpec, list, function, BaseVar]
  77. ] = None,
  78. on_mouse_move: Optional[
  79. Union[EventHandler, EventSpec, list, function, BaseVar]
  80. ] = None,
  81. on_mouse_out: Optional[
  82. Union[EventHandler, EventSpec, list, function, BaseVar]
  83. ] = None,
  84. on_mouse_over: Optional[
  85. Union[EventHandler, EventSpec, list, function, BaseVar]
  86. ] = None,
  87. on_mouse_up: Optional[
  88. Union[EventHandler, EventSpec, list, function, BaseVar]
  89. ] = None,
  90. on_scroll: Optional[
  91. Union[EventHandler, EventSpec, list, function, BaseVar]
  92. ] = None,
  93. on_unmount: Optional[
  94. Union[EventHandler, EventSpec, list, function, BaseVar]
  95. ] = None,
  96. **props
  97. ) -> "Upload":
  98. """Create an upload component.
  99. Args:
  100. *children: The children of the component.
  101. accept: The list of accepted file types. This should be a dictionary of MIME types as keys and array of file formats as values. supported MIME types: https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types
  102. disabled: Whether the dropzone is disabled.
  103. max_files: The maximum number of files that can be uploaded.
  104. max_size: The maximum file size (bytes) that can be uploaded.
  105. min_size: The minimum file size (bytes) that can be uploaded.
  106. multiple: Whether to allow multiple files to be uploaded.
  107. no_click: Whether to disable click to upload.
  108. no_drag: Whether to disable drag and drop.
  109. no_keyboard: Whether to disable using the space/enter keys to upload.
  110. style: The style of the component.
  111. key: A unique key for the component.
  112. id: The id for the component.
  113. class_name: The class name for the component.
  114. autofocus: Whether the component should take the focus once the page is loaded
  115. custom_attrs: custom attribute
  116. **props: The properties of the component.
  117. Returns:
  118. The upload component.
  119. """
  120. ...
  121. def get_event_triggers(self) -> dict[str, Union[Var, Any]]: ...