upload.pyi 8.2 KB

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