upload.pyi 8.6 KB

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