upload.pyi 8.4 KB

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