upload.pyi 16 KB

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