upload.pyi 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  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. is_used: ClassVar[bool] = False
  29. @overload
  30. @classmethod
  31. def create( # type: ignore
  32. cls,
  33. *children,
  34. style: Optional[Style] = None,
  35. key: Optional[Any] = None,
  36. id: Optional[Any] = None,
  37. class_name: Optional[Any] = None,
  38. autofocus: Optional[bool] = 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 an UploadFilesProvider 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. custom_attrs: custom attribute
  96. **props: The properties of the component.
  97. Returns:
  98. The UploadFilesProvider component.
  99. """
  100. ...
  101. class Upload(Component):
  102. @overload
  103. @classmethod
  104. def create( # type: ignore
  105. cls,
  106. *children,
  107. accept: Optional[
  108. Union[Var[Optional[Dict[str, List]]], Optional[Dict[str, List]]]
  109. ] = None,
  110. disabled: Optional[Union[Var[bool], bool]] = None,
  111. max_files: Optional[Union[Var[int], int]] = None,
  112. max_size: Optional[Union[Var[int], int]] = None,
  113. min_size: Optional[Union[Var[int], int]] = None,
  114. multiple: Optional[Union[Var[bool], bool]] = None,
  115. no_click: Optional[Union[Var[bool], bool]] = None,
  116. no_drag: Optional[Union[Var[bool], bool]] = None,
  117. no_keyboard: Optional[Union[Var[bool], bool]] = None,
  118. style: Optional[Style] = None,
  119. key: Optional[Any] = None,
  120. id: Optional[Any] = None,
  121. class_name: Optional[Any] = None,
  122. autofocus: Optional[bool] = None,
  123. custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
  124. on_blur: Optional[
  125. Union[EventHandler, EventSpec, list, function, BaseVar]
  126. ] = None,
  127. on_click: Optional[
  128. Union[EventHandler, EventSpec, list, function, BaseVar]
  129. ] = None,
  130. on_context_menu: Optional[
  131. Union[EventHandler, EventSpec, list, function, BaseVar]
  132. ] = None,
  133. on_double_click: Optional[
  134. Union[EventHandler, EventSpec, list, function, BaseVar]
  135. ] = None,
  136. on_drop: Optional[
  137. Union[EventHandler, EventSpec, list, function, BaseVar]
  138. ] = None,
  139. on_focus: Optional[
  140. Union[EventHandler, EventSpec, list, function, BaseVar]
  141. ] = None,
  142. on_mount: Optional[
  143. Union[EventHandler, EventSpec, list, function, BaseVar]
  144. ] = None,
  145. on_mouse_down: Optional[
  146. Union[EventHandler, EventSpec, list, function, BaseVar]
  147. ] = None,
  148. on_mouse_enter: Optional[
  149. Union[EventHandler, EventSpec, list, function, BaseVar]
  150. ] = None,
  151. on_mouse_leave: Optional[
  152. Union[EventHandler, EventSpec, list, function, BaseVar]
  153. ] = None,
  154. on_mouse_move: Optional[
  155. Union[EventHandler, EventSpec, list, function, BaseVar]
  156. ] = None,
  157. on_mouse_out: Optional[
  158. Union[EventHandler, EventSpec, list, function, BaseVar]
  159. ] = None,
  160. on_mouse_over: Optional[
  161. Union[EventHandler, EventSpec, list, function, BaseVar]
  162. ] = None,
  163. on_mouse_up: Optional[
  164. Union[EventHandler, EventSpec, list, function, BaseVar]
  165. ] = None,
  166. on_scroll: Optional[
  167. Union[EventHandler, EventSpec, list, function, BaseVar]
  168. ] = None,
  169. on_unmount: Optional[
  170. Union[EventHandler, EventSpec, list, function, BaseVar]
  171. ] = None,
  172. **props
  173. ) -> "Upload":
  174. """Create an upload component.
  175. Args:
  176. *children: The children of the component.
  177. 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
  178. disabled: Whether the dropzone is disabled.
  179. max_files: The maximum number of files that can be uploaded.
  180. max_size: The maximum file size (bytes) that can be uploaded.
  181. min_size: The minimum file size (bytes) that can be uploaded.
  182. multiple: Whether to allow multiple files to be uploaded.
  183. no_click: Whether to disable click to upload.
  184. no_drag: Whether to disable drag and drop.
  185. no_keyboard: Whether to disable using the space/enter keys to upload.
  186. style: The style of the component.
  187. key: A unique key for the component.
  188. id: The id for the component.
  189. class_name: The class name for the component.
  190. autofocus: Whether the component should take the focus once the page is loaded
  191. custom_attrs: custom attribute
  192. **props: The properties of the component.
  193. Returns:
  194. The upload component.
  195. """
  196. ...
  197. def get_event_triggers(self) -> dict[str, Union[Var, Any]]: ...