upload.pyi 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. """Stub file for reflex/components/core/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. import os
  10. from pathlib import Path
  11. from typing import Any, Callable, ClassVar, Dict, List, Optional, Union
  12. from reflex import constants
  13. from reflex.components.chakra.forms.input import Input
  14. from reflex.components.chakra.layout.box import Box
  15. from reflex.components.component import Component, MemoizationLeaf
  16. from reflex.constants import Dirs
  17. from reflex.event import (
  18. CallableEventSpec,
  19. EventChain,
  20. EventSpec,
  21. call_event_fn,
  22. call_script,
  23. parse_args_spec,
  24. )
  25. from reflex.utils import imports
  26. from reflex.vars import BaseVar, CallableVar, Var, VarData
  27. DEFAULT_UPLOAD_ID: str
  28. upload_files_context_var_data: VarData
  29. @CallableVar
  30. def upload_file(id_: str = DEFAULT_UPLOAD_ID) -> BaseVar: ...
  31. @CallableVar
  32. def selected_files(id_: str = DEFAULT_UPLOAD_ID) -> BaseVar: ...
  33. @CallableEventSpec
  34. def clear_selected_files(id_: str = DEFAULT_UPLOAD_ID) -> EventSpec: ...
  35. def cancel_upload(upload_id: str) -> EventSpec: ...
  36. def get_upload_dir() -> Path: ...
  37. uploaded_files_url_prefix: Var
  38. def get_upload_url(file_path: str) -> str: ...
  39. class UploadFilesProvider(Component):
  40. @overload
  41. @classmethod
  42. def create( # type: ignore
  43. cls,
  44. *children,
  45. style: Optional[Style] = None,
  46. key: Optional[Any] = None,
  47. id: Optional[Any] = None,
  48. class_name: Optional[Any] = None,
  49. autofocus: Optional[bool] = None,
  50. custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
  51. on_blur: Optional[
  52. Union[EventHandler, EventSpec, list, function, BaseVar]
  53. ] = None,
  54. on_click: Optional[
  55. Union[EventHandler, EventSpec, list, function, BaseVar]
  56. ] = None,
  57. on_context_menu: Optional[
  58. Union[EventHandler, EventSpec, list, function, BaseVar]
  59. ] = None,
  60. on_double_click: 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. ) -> "UploadFilesProvider":
  98. """Create the component.
  99. Args:
  100. *children: The children of the component.
  101. style: The style of the component.
  102. key: A unique key for the component.
  103. id: The id for the component.
  104. class_name: The class name for the component.
  105. autofocus: Whether the component should take the focus once the page is loaded
  106. custom_attrs: custom attribute
  107. **props: The props of the component.
  108. Returns:
  109. The component.
  110. Raises:
  111. TypeError: If an invalid child is passed.
  112. """
  113. ...
  114. class Upload(MemoizationLeaf):
  115. is_used: ClassVar[bool] = False
  116. @overload
  117. @classmethod
  118. def create( # type: ignore
  119. cls,
  120. *children,
  121. accept: Optional[
  122. Union[Var[Optional[Dict[str, List]]], Optional[Dict[str, List]]]
  123. ] = None,
  124. disabled: Optional[Union[Var[bool], bool]] = None,
  125. max_files: Optional[Union[Var[int], int]] = None,
  126. max_size: Optional[Union[Var[int], int]] = None,
  127. min_size: Optional[Union[Var[int], int]] = None,
  128. multiple: Optional[Union[Var[bool], bool]] = None,
  129. no_click: Optional[Union[Var[bool], bool]] = None,
  130. no_drag: Optional[Union[Var[bool], bool]] = None,
  131. no_keyboard: Optional[Union[Var[bool], bool]] = None,
  132. style: Optional[Style] = None,
  133. key: Optional[Any] = None,
  134. id: Optional[Any] = None,
  135. class_name: Optional[Any] = None,
  136. autofocus: Optional[bool] = None,
  137. custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
  138. on_blur: Optional[
  139. Union[EventHandler, EventSpec, list, function, BaseVar]
  140. ] = None,
  141. on_click: Optional[
  142. Union[EventHandler, EventSpec, list, function, BaseVar]
  143. ] = None,
  144. on_context_menu: Optional[
  145. Union[EventHandler, EventSpec, list, function, BaseVar]
  146. ] = None,
  147. on_double_click: Optional[
  148. Union[EventHandler, EventSpec, list, function, BaseVar]
  149. ] = None,
  150. on_drop: Optional[
  151. Union[EventHandler, EventSpec, list, function, BaseVar]
  152. ] = None,
  153. on_focus: Optional[
  154. Union[EventHandler, EventSpec, list, function, BaseVar]
  155. ] = None,
  156. on_mount: Optional[
  157. Union[EventHandler, EventSpec, list, function, BaseVar]
  158. ] = None,
  159. on_mouse_down: Optional[
  160. Union[EventHandler, EventSpec, list, function, BaseVar]
  161. ] = None,
  162. on_mouse_enter: Optional[
  163. Union[EventHandler, EventSpec, list, function, BaseVar]
  164. ] = None,
  165. on_mouse_leave: Optional[
  166. Union[EventHandler, EventSpec, list, function, BaseVar]
  167. ] = None,
  168. on_mouse_move: Optional[
  169. Union[EventHandler, EventSpec, list, function, BaseVar]
  170. ] = None,
  171. on_mouse_out: Optional[
  172. Union[EventHandler, EventSpec, list, function, BaseVar]
  173. ] = None,
  174. on_mouse_over: Optional[
  175. Union[EventHandler, EventSpec, list, function, BaseVar]
  176. ] = None,
  177. on_mouse_up: Optional[
  178. Union[EventHandler, EventSpec, list, function, BaseVar]
  179. ] = None,
  180. on_scroll: Optional[
  181. Union[EventHandler, EventSpec, list, function, BaseVar]
  182. ] = None,
  183. on_unmount: Optional[
  184. Union[EventHandler, EventSpec, list, function, BaseVar]
  185. ] = None,
  186. **props
  187. ) -> "Upload":
  188. """Create an upload component.
  189. Args:
  190. *children: The children of the component.
  191. 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
  192. disabled: Whether the dropzone is disabled.
  193. max_files: The maximum number of files that can be uploaded.
  194. max_size: The maximum file size (bytes) that can be uploaded.
  195. min_size: The minimum file size (bytes) that can be uploaded.
  196. multiple: Whether to allow multiple files to be uploaded.
  197. no_click: Whether to disable click to upload.
  198. no_drag: Whether to disable drag and drop.
  199. no_keyboard: Whether to disable using the space/enter keys to upload.
  200. style: The style of the component.
  201. key: A unique key for the component.
  202. id: The id for the component.
  203. class_name: The class name for the component.
  204. autofocus: Whether the component should take the focus once the page is loaded
  205. custom_attrs: custom attribute
  206. **props: The properties of the component.
  207. Returns:
  208. The upload component.
  209. """
  210. ...
  211. def get_event_triggers(self) -> dict[str, Union[Var, Any]]: ...