upload.pyi 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358
  1. """Stub file for reflex/components/core/upload.py"""
  2. # ------------------- DO NOT EDIT ----------------------
  3. # This file was generated by `reflex/utils/pyi_generator.py`!
  4. # ------------------------------------------------------
  5. from pathlib import Path
  6. from typing import Any, Callable, ClassVar, Dict, List, Optional, Union, overload
  7. from reflex.components.component import Component, ComponentNamespace, MemoizationLeaf
  8. from reflex.event import (
  9. CallableEventSpec,
  10. EventHandler,
  11. EventSpec,
  12. )
  13. from reflex.ivars.base import ImmutableCallableVar, ImmutableVar
  14. from reflex.style import Style
  15. from reflex.vars import Var, VarData
  16. DEFAULT_UPLOAD_ID: str
  17. upload_files_context_var_data: VarData
  18. @ImmutableCallableVar
  19. def upload_file(id_: str = DEFAULT_UPLOAD_ID) -> ImmutableVar: ...
  20. @ImmutableCallableVar
  21. def selected_files(id_: str = DEFAULT_UPLOAD_ID) -> ImmutableVar: ...
  22. @CallableEventSpec
  23. def clear_selected_files(id_: str = DEFAULT_UPLOAD_ID) -> EventSpec: ...
  24. def cancel_upload(upload_id: str) -> EventSpec: ...
  25. def get_upload_dir() -> Path: ...
  26. uploaded_files_url_prefix: Var
  27. def get_upload_url(file_path: str) -> Var[str]: ...
  28. class UploadFilesProvider(Component):
  29. @overload
  30. @classmethod
  31. def create( # type: ignore
  32. cls,
  33. *children,
  34. style: Optional[Style] = None,
  35. key: Optional[Any] = None,
  36. id: Optional[Any] = None,
  37. class_name: Optional[Any] = None,
  38. autofocus: Optional[bool] = None,
  39. custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
  40. on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None,
  41. on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None,
  42. on_context_menu: Optional[
  43. Union[EventHandler, EventSpec, list, Callable, Var]
  44. ] = None,
  45. on_double_click: Optional[
  46. Union[EventHandler, EventSpec, list, Callable, Var]
  47. ] = None,
  48. on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None,
  49. on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None,
  50. on_mouse_down: Optional[
  51. Union[EventHandler, EventSpec, list, Callable, Var]
  52. ] = None,
  53. on_mouse_enter: Optional[
  54. Union[EventHandler, EventSpec, list, Callable, Var]
  55. ] = None,
  56. on_mouse_leave: Optional[
  57. Union[EventHandler, EventSpec, list, Callable, Var]
  58. ] = None,
  59. on_mouse_move: Optional[
  60. Union[EventHandler, EventSpec, list, Callable, Var]
  61. ] = None,
  62. on_mouse_out: Optional[
  63. Union[EventHandler, EventSpec, list, Callable, Var]
  64. ] = None,
  65. on_mouse_over: Optional[
  66. Union[EventHandler, EventSpec, list, Callable, Var]
  67. ] = None,
  68. on_mouse_up: Optional[
  69. Union[EventHandler, EventSpec, list, Callable, Var]
  70. ] = None,
  71. on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None,
  72. on_unmount: Optional[
  73. Union[EventHandler, EventSpec, list, Callable, Var]
  74. ] = None,
  75. **props,
  76. ) -> "UploadFilesProvider":
  77. """Create the component.
  78. Args:
  79. *children: The children of the component.
  80. style: The style of the component.
  81. key: A unique key for the component.
  82. id: The id for the component.
  83. class_name: The class name for the component.
  84. autofocus: Whether the component should take the focus once the page is loaded
  85. custom_attrs: custom attribute
  86. **props: The props of the component.
  87. Returns:
  88. The component.
  89. """
  90. ...
  91. class Upload(MemoizationLeaf):
  92. is_used: ClassVar[bool] = False
  93. @overload
  94. @classmethod
  95. def create( # type: ignore
  96. cls,
  97. *children,
  98. accept: Optional[Union[Var[Optional[Dict[str, List]]], Dict[str, List]]] = None,
  99. disabled: Optional[Union[Var[bool], bool]] = None,
  100. max_files: Optional[Union[Var[int], int]] = None,
  101. max_size: Optional[Union[Var[int], int]] = None,
  102. min_size: Optional[Union[Var[int], int]] = None,
  103. multiple: Optional[Union[Var[bool], bool]] = None,
  104. no_click: Optional[Union[Var[bool], bool]] = None,
  105. no_drag: Optional[Union[Var[bool], bool]] = None,
  106. no_keyboard: Optional[Union[Var[bool], bool]] = None,
  107. style: Optional[Style] = None,
  108. key: Optional[Any] = None,
  109. id: Optional[Any] = None,
  110. class_name: Optional[Any] = None,
  111. autofocus: Optional[bool] = None,
  112. custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
  113. on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None,
  114. on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None,
  115. on_context_menu: Optional[
  116. Union[EventHandler, EventSpec, list, Callable, Var]
  117. ] = None,
  118. on_double_click: Optional[
  119. Union[EventHandler, EventSpec, list, Callable, Var]
  120. ] = None,
  121. on_drop: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None,
  122. on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None,
  123. on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None,
  124. on_mouse_down: Optional[
  125. Union[EventHandler, EventSpec, list, Callable, Var]
  126. ] = None,
  127. on_mouse_enter: Optional[
  128. Union[EventHandler, EventSpec, list, Callable, Var]
  129. ] = None,
  130. on_mouse_leave: Optional[
  131. Union[EventHandler, EventSpec, list, Callable, Var]
  132. ] = None,
  133. on_mouse_move: Optional[
  134. Union[EventHandler, EventSpec, list, Callable, Var]
  135. ] = None,
  136. on_mouse_out: Optional[
  137. Union[EventHandler, EventSpec, list, Callable, Var]
  138. ] = None,
  139. on_mouse_over: Optional[
  140. Union[EventHandler, EventSpec, list, Callable, Var]
  141. ] = None,
  142. on_mouse_up: Optional[
  143. Union[EventHandler, EventSpec, list, Callable, Var]
  144. ] = None,
  145. on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None,
  146. on_unmount: Optional[
  147. Union[EventHandler, EventSpec, list, Callable, Var]
  148. ] = None,
  149. **props,
  150. ) -> "Upload":
  151. """Create an upload component.
  152. Args:
  153. *children: The children of the component.
  154. 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
  155. disabled: Whether the dropzone is disabled.
  156. max_files: The maximum number of files that can be uploaded.
  157. max_size: The maximum file size (bytes) that can be uploaded.
  158. min_size: The minimum file size (bytes) that can be uploaded.
  159. multiple: Whether to allow multiple files to be uploaded.
  160. no_click: Whether to disable click to upload.
  161. no_drag: Whether to disable drag and drop.
  162. no_keyboard: Whether to disable using the space/enter keys to upload.
  163. style: The style of the component.
  164. key: A unique key for the component.
  165. id: The id for the component.
  166. class_name: The class name for the component.
  167. autofocus: Whether the component should take the focus once the page is loaded
  168. custom_attrs: custom attribute
  169. **props: The properties of the component.
  170. Returns:
  171. The upload component.
  172. """
  173. ...
  174. class StyledUpload(Upload):
  175. @overload
  176. @classmethod
  177. def create( # type: ignore
  178. cls,
  179. *children,
  180. accept: Optional[Union[Var[Optional[Dict[str, List]]], Dict[str, List]]] = None,
  181. disabled: Optional[Union[Var[bool], bool]] = None,
  182. max_files: Optional[Union[Var[int], int]] = None,
  183. max_size: Optional[Union[Var[int], int]] = None,
  184. min_size: Optional[Union[Var[int], int]] = None,
  185. multiple: Optional[Union[Var[bool], bool]] = None,
  186. no_click: Optional[Union[Var[bool], bool]] = None,
  187. no_drag: Optional[Union[Var[bool], bool]] = None,
  188. no_keyboard: Optional[Union[Var[bool], bool]] = None,
  189. style: Optional[Style] = None,
  190. key: Optional[Any] = None,
  191. id: Optional[Any] = None,
  192. class_name: Optional[Any] = None,
  193. autofocus: Optional[bool] = None,
  194. custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
  195. on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None,
  196. on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None,
  197. on_context_menu: Optional[
  198. Union[EventHandler, EventSpec, list, Callable, Var]
  199. ] = None,
  200. on_double_click: Optional[
  201. Union[EventHandler, EventSpec, list, Callable, Var]
  202. ] = None,
  203. on_drop: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None,
  204. on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None,
  205. on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None,
  206. on_mouse_down: Optional[
  207. Union[EventHandler, EventSpec, list, Callable, Var]
  208. ] = None,
  209. on_mouse_enter: Optional[
  210. Union[EventHandler, EventSpec, list, Callable, Var]
  211. ] = None,
  212. on_mouse_leave: Optional[
  213. Union[EventHandler, EventSpec, list, Callable, Var]
  214. ] = None,
  215. on_mouse_move: Optional[
  216. Union[EventHandler, EventSpec, list, Callable, Var]
  217. ] = None,
  218. on_mouse_out: Optional[
  219. Union[EventHandler, EventSpec, list, Callable, Var]
  220. ] = None,
  221. on_mouse_over: Optional[
  222. Union[EventHandler, EventSpec, list, Callable, Var]
  223. ] = None,
  224. on_mouse_up: Optional[
  225. Union[EventHandler, EventSpec, list, Callable, Var]
  226. ] = None,
  227. on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None,
  228. on_unmount: Optional[
  229. Union[EventHandler, EventSpec, list, Callable, Var]
  230. ] = None,
  231. **props,
  232. ) -> "StyledUpload":
  233. """Create the styled upload component.
  234. Args:
  235. *children: The children of the component.
  236. 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
  237. disabled: Whether the dropzone is disabled.
  238. max_files: The maximum number of files that can be uploaded.
  239. max_size: The maximum file size (bytes) that can be uploaded.
  240. min_size: The minimum file size (bytes) that can be uploaded.
  241. multiple: Whether to allow multiple files to be uploaded.
  242. no_click: Whether to disable click to upload.
  243. no_drag: Whether to disable drag and drop.
  244. no_keyboard: Whether to disable using the space/enter keys to upload.
  245. style: The style of the component.
  246. key: A unique key for the component.
  247. id: The id for the component.
  248. class_name: The class name for the component.
  249. autofocus: Whether the component should take the focus once the page is loaded
  250. custom_attrs: custom attribute
  251. **props: The properties of the component.
  252. Returns:
  253. The styled upload component.
  254. """
  255. ...
  256. class UploadNamespace(ComponentNamespace):
  257. root = Upload.create
  258. @staticmethod
  259. def __call__(
  260. *children,
  261. accept: Optional[Union[Var[Optional[Dict[str, List]]], Dict[str, List]]] = None,
  262. disabled: Optional[Union[Var[bool], bool]] = None,
  263. max_files: Optional[Union[Var[int], int]] = None,
  264. max_size: Optional[Union[Var[int], int]] = None,
  265. min_size: Optional[Union[Var[int], int]] = None,
  266. multiple: Optional[Union[Var[bool], bool]] = None,
  267. no_click: Optional[Union[Var[bool], bool]] = None,
  268. no_drag: Optional[Union[Var[bool], bool]] = None,
  269. no_keyboard: Optional[Union[Var[bool], bool]] = None,
  270. style: Optional[Style] = None,
  271. key: Optional[Any] = None,
  272. id: Optional[Any] = None,
  273. class_name: Optional[Any] = None,
  274. autofocus: Optional[bool] = None,
  275. custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
  276. on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None,
  277. on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None,
  278. on_context_menu: Optional[
  279. Union[EventHandler, EventSpec, list, Callable, Var]
  280. ] = None,
  281. on_double_click: Optional[
  282. Union[EventHandler, EventSpec, list, Callable, Var]
  283. ] = None,
  284. on_drop: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None,
  285. on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None,
  286. on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None,
  287. on_mouse_down: Optional[
  288. Union[EventHandler, EventSpec, list, Callable, Var]
  289. ] = None,
  290. on_mouse_enter: Optional[
  291. Union[EventHandler, EventSpec, list, Callable, Var]
  292. ] = None,
  293. on_mouse_leave: Optional[
  294. Union[EventHandler, EventSpec, list, Callable, Var]
  295. ] = None,
  296. on_mouse_move: Optional[
  297. Union[EventHandler, EventSpec, list, Callable, Var]
  298. ] = None,
  299. on_mouse_out: Optional[
  300. Union[EventHandler, EventSpec, list, Callable, Var]
  301. ] = None,
  302. on_mouse_over: Optional[
  303. Union[EventHandler, EventSpec, list, Callable, Var]
  304. ] = None,
  305. on_mouse_up: Optional[
  306. Union[EventHandler, EventSpec, list, Callable, Var]
  307. ] = None,
  308. on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None,
  309. on_unmount: Optional[
  310. Union[EventHandler, EventSpec, list, Callable, Var]
  311. ] = None,
  312. **props,
  313. ) -> "StyledUpload":
  314. """Create the styled upload component.
  315. Args:
  316. *children: The children of the component.
  317. 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
  318. disabled: Whether the dropzone is disabled.
  319. max_files: The maximum number of files that can be uploaded.
  320. max_size: The maximum file size (bytes) that can be uploaded.
  321. min_size: The minimum file size (bytes) that can be uploaded.
  322. multiple: Whether to allow multiple files to be uploaded.
  323. no_click: Whether to disable click to upload.
  324. no_drag: Whether to disable drag and drop.
  325. no_keyboard: Whether to disable using the space/enter keys to upload.
  326. style: The style of the component.
  327. key: A unique key for the component.
  328. id: The id for the component.
  329. class_name: The class name for the component.
  330. autofocus: Whether the component should take the focus once the page is loaded
  331. custom_attrs: custom attribute
  332. **props: The properties of the component.
  333. Returns:
  334. The styled upload component.
  335. """
  336. ...
  337. upload = UploadNamespace()