upload.pyi 8.4 KB

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