form.pyi 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923
  1. """Stub file for reflex/components/radix/primitives/form.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 hashlib import md5
  10. from types import SimpleNamespace
  11. from typing import Any, Dict, Iterator, Literal
  12. from jinja2 import Environment
  13. from reflex.components.component import Component
  14. from reflex.components.radix.themes.components.text_field import TextFieldInput
  15. from reflex.components.tags.tag import Tag
  16. from reflex.constants.base import Dirs
  17. from reflex.constants.event import EventTriggers
  18. from reflex.event import EventChain
  19. from reflex.utils import imports
  20. from reflex.utils.format import format_event_chain, to_camel_case
  21. from reflex.vars import BaseVar, Var
  22. from .base import RadixPrimitiveComponentWithClassName
  23. FORM_DATA = Var.create("form_data")
  24. HANDLE_SUBMIT_JS_JINJA2 = Environment().from_string(
  25. "\n const handleSubmit_{{ handle_submit_unique_name }} = useCallback((ev) => {\n const $form = ev.target\n ev.preventDefault()\n const {{ form_data }} = {...Object.fromEntries(new FormData($form).entries()), ...{{ field_ref_mapping }}}\n\n {{ on_submit_event_chain }}\n\n if ({{ reset_on_submit }}) {\n $form.reset()\n }\n })\n "
  26. )
  27. class FormComponent(RadixPrimitiveComponentWithClassName):
  28. @overload
  29. @classmethod
  30. def create( # type: ignore
  31. cls,
  32. *children,
  33. as_child: Optional[Union[Var[bool], bool]] = None,
  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. ) -> "FormComponent":
  87. """Create the component.
  88. Args:
  89. *children: The children of the component.
  90. as_child: Change the default rendered element for the one passed as a child.
  91. style: The style of the component.
  92. key: A unique key for the component.
  93. id: The id for the component.
  94. class_name: The class name for the component.
  95. autofocus: Whether the component should take the focus once the page is loaded
  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 FormRoot(FormComponent):
  105. def get_event_triggers(self) -> Dict[str, Any]: ...
  106. @overload
  107. @classmethod
  108. def create( # type: ignore
  109. cls,
  110. *children,
  111. reset_on_submit: Optional[Union[Var[bool], bool]] = None,
  112. handle_submit_unique_name: Optional[Union[Var[str], str]] = None,
  113. as_child: Optional[Union[Var[bool], bool]] = None,
  114. style: Optional[Style] = None,
  115. key: Optional[Any] = None,
  116. id: Optional[Any] = None,
  117. class_name: Optional[Any] = None,
  118. autofocus: Optional[bool] = None,
  119. custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
  120. on_blur: Optional[
  121. Union[EventHandler, EventSpec, list, function, BaseVar]
  122. ] = None,
  123. on_clear_server_errors: Optional[
  124. Union[EventHandler, EventSpec, list, function, BaseVar]
  125. ] = None,
  126. on_click: Optional[
  127. Union[EventHandler, EventSpec, list, function, BaseVar]
  128. ] = None,
  129. on_context_menu: Optional[
  130. Union[EventHandler, EventSpec, list, function, BaseVar]
  131. ] = None,
  132. on_double_click: Optional[
  133. Union[EventHandler, EventSpec, list, function, BaseVar]
  134. ] = None,
  135. on_focus: Optional[
  136. Union[EventHandler, EventSpec, list, function, BaseVar]
  137. ] = None,
  138. on_mount: Optional[
  139. Union[EventHandler, EventSpec, list, function, BaseVar]
  140. ] = None,
  141. on_mouse_down: Optional[
  142. Union[EventHandler, EventSpec, list, function, BaseVar]
  143. ] = None,
  144. on_mouse_enter: Optional[
  145. Union[EventHandler, EventSpec, list, function, BaseVar]
  146. ] = None,
  147. on_mouse_leave: Optional[
  148. Union[EventHandler, EventSpec, list, function, BaseVar]
  149. ] = None,
  150. on_mouse_move: Optional[
  151. Union[EventHandler, EventSpec, list, function, BaseVar]
  152. ] = None,
  153. on_mouse_out: Optional[
  154. Union[EventHandler, EventSpec, list, function, BaseVar]
  155. ] = None,
  156. on_mouse_over: Optional[
  157. Union[EventHandler, EventSpec, list, function, BaseVar]
  158. ] = None,
  159. on_mouse_up: Optional[
  160. Union[EventHandler, EventSpec, list, function, BaseVar]
  161. ] = None,
  162. on_scroll: Optional[
  163. Union[EventHandler, EventSpec, list, function, BaseVar]
  164. ] = None,
  165. on_submit: Optional[
  166. Union[EventHandler, EventSpec, list, function, BaseVar]
  167. ] = None,
  168. on_unmount: Optional[
  169. Union[EventHandler, EventSpec, list, function, BaseVar]
  170. ] = None,
  171. **props
  172. ) -> "FormRoot":
  173. """Create a form component.
  174. Args:
  175. *children: The children of the form.
  176. reset_on_submit: If true, the form will be cleared after submit.
  177. handle_submit_unique_name: The name used to make this form's submit handler function unique.
  178. as_child: Change the default rendered element for the one passed as a child.
  179. style: The style of the component.
  180. key: A unique key for the component.
  181. id: The id for the component.
  182. class_name: The class name for the component.
  183. autofocus: Whether the component should take the focus once the page is loaded
  184. custom_attrs: custom attribute
  185. **props: The properties of the form.
  186. Returns:
  187. The form component.
  188. """
  189. ...
  190. class FormField(FormComponent):
  191. @overload
  192. @classmethod
  193. def create( # type: ignore
  194. cls,
  195. *children,
  196. name: Optional[Union[Var[str], str]] = None,
  197. server_invalid: Optional[Union[Var[bool], bool]] = None,
  198. as_child: Optional[Union[Var[bool], bool]] = None,
  199. style: Optional[Style] = None,
  200. key: Optional[Any] = None,
  201. id: Optional[Any] = None,
  202. class_name: Optional[Any] = None,
  203. autofocus: Optional[bool] = None,
  204. custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
  205. on_blur: Optional[
  206. Union[EventHandler, EventSpec, list, function, BaseVar]
  207. ] = None,
  208. on_click: Optional[
  209. Union[EventHandler, EventSpec, list, function, BaseVar]
  210. ] = None,
  211. on_context_menu: Optional[
  212. Union[EventHandler, EventSpec, list, function, BaseVar]
  213. ] = None,
  214. on_double_click: Optional[
  215. Union[EventHandler, EventSpec, list, function, BaseVar]
  216. ] = None,
  217. on_focus: Optional[
  218. Union[EventHandler, EventSpec, list, function, BaseVar]
  219. ] = None,
  220. on_mount: Optional[
  221. Union[EventHandler, EventSpec, list, function, BaseVar]
  222. ] = None,
  223. on_mouse_down: Optional[
  224. Union[EventHandler, EventSpec, list, function, BaseVar]
  225. ] = None,
  226. on_mouse_enter: Optional[
  227. Union[EventHandler, EventSpec, list, function, BaseVar]
  228. ] = None,
  229. on_mouse_leave: Optional[
  230. Union[EventHandler, EventSpec, list, function, BaseVar]
  231. ] = None,
  232. on_mouse_move: Optional[
  233. Union[EventHandler, EventSpec, list, function, BaseVar]
  234. ] = None,
  235. on_mouse_out: Optional[
  236. Union[EventHandler, EventSpec, list, function, BaseVar]
  237. ] = None,
  238. on_mouse_over: Optional[
  239. Union[EventHandler, EventSpec, list, function, BaseVar]
  240. ] = None,
  241. on_mouse_up: Optional[
  242. Union[EventHandler, EventSpec, list, function, BaseVar]
  243. ] = None,
  244. on_scroll: Optional[
  245. Union[EventHandler, EventSpec, list, function, BaseVar]
  246. ] = None,
  247. on_unmount: Optional[
  248. Union[EventHandler, EventSpec, list, function, BaseVar]
  249. ] = None,
  250. **props
  251. ) -> "FormField":
  252. """Create the component.
  253. Args:
  254. *children: The children of the component.
  255. name: The name of the form field, that is passed down to the control and used to match with validation messages.
  256. server_invalid: Flag to mark the form field as invalid, for server side validation.
  257. as_child: Change the default rendered element for the one passed as a child.
  258. style: The style of the component.
  259. key: A unique key for the component.
  260. id: The id for the component.
  261. class_name: The class name for the component.
  262. autofocus: Whether the component should take the focus once the page is loaded
  263. custom_attrs: custom attribute
  264. **props: The props of the component.
  265. Returns:
  266. The component.
  267. Raises:
  268. TypeError: If an invalid child is passed.
  269. """
  270. ...
  271. class FormLabel(FormComponent):
  272. @overload
  273. @classmethod
  274. def create( # type: ignore
  275. cls,
  276. *children,
  277. as_child: Optional[Union[Var[bool], bool]] = None,
  278. style: Optional[Style] = None,
  279. key: Optional[Any] = None,
  280. id: Optional[Any] = None,
  281. class_name: Optional[Any] = None,
  282. autofocus: Optional[bool] = None,
  283. custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
  284. on_blur: Optional[
  285. Union[EventHandler, EventSpec, list, function, BaseVar]
  286. ] = None,
  287. on_click: Optional[
  288. Union[EventHandler, EventSpec, list, function, BaseVar]
  289. ] = None,
  290. on_context_menu: Optional[
  291. Union[EventHandler, EventSpec, list, function, BaseVar]
  292. ] = None,
  293. on_double_click: Optional[
  294. Union[EventHandler, EventSpec, list, function, BaseVar]
  295. ] = None,
  296. on_focus: Optional[
  297. Union[EventHandler, EventSpec, list, function, BaseVar]
  298. ] = None,
  299. on_mount: Optional[
  300. Union[EventHandler, EventSpec, list, function, BaseVar]
  301. ] = None,
  302. on_mouse_down: Optional[
  303. Union[EventHandler, EventSpec, list, function, BaseVar]
  304. ] = None,
  305. on_mouse_enter: Optional[
  306. Union[EventHandler, EventSpec, list, function, BaseVar]
  307. ] = None,
  308. on_mouse_leave: Optional[
  309. Union[EventHandler, EventSpec, list, function, BaseVar]
  310. ] = None,
  311. on_mouse_move: Optional[
  312. Union[EventHandler, EventSpec, list, function, BaseVar]
  313. ] = None,
  314. on_mouse_out: Optional[
  315. Union[EventHandler, EventSpec, list, function, BaseVar]
  316. ] = None,
  317. on_mouse_over: Optional[
  318. Union[EventHandler, EventSpec, list, function, BaseVar]
  319. ] = None,
  320. on_mouse_up: Optional[
  321. Union[EventHandler, EventSpec, list, function, BaseVar]
  322. ] = None,
  323. on_scroll: Optional[
  324. Union[EventHandler, EventSpec, list, function, BaseVar]
  325. ] = None,
  326. on_unmount: Optional[
  327. Union[EventHandler, EventSpec, list, function, BaseVar]
  328. ] = None,
  329. **props
  330. ) -> "FormLabel":
  331. """Create the component.
  332. Args:
  333. *children: The children of the component.
  334. as_child: Change the default rendered element for the one passed as a child.
  335. style: The style of the component.
  336. key: A unique key for the component.
  337. id: The id for the component.
  338. class_name: The class name for the component.
  339. autofocus: Whether the component should take the focus once the page is loaded
  340. custom_attrs: custom attribute
  341. **props: The props of the component.
  342. Returns:
  343. The component.
  344. Raises:
  345. TypeError: If an invalid child is passed.
  346. """
  347. ...
  348. class FormControl(FormComponent):
  349. @overload
  350. @classmethod
  351. def create( # type: ignore
  352. cls,
  353. *children,
  354. as_child: Optional[Union[Var[bool], bool]] = None,
  355. style: Optional[Style] = None,
  356. key: Optional[Any] = None,
  357. id: Optional[Any] = None,
  358. class_name: Optional[Any] = None,
  359. autofocus: Optional[bool] = None,
  360. custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
  361. on_blur: Optional[
  362. Union[EventHandler, EventSpec, list, function, BaseVar]
  363. ] = None,
  364. on_click: Optional[
  365. Union[EventHandler, EventSpec, list, function, BaseVar]
  366. ] = None,
  367. on_context_menu: Optional[
  368. Union[EventHandler, EventSpec, list, function, BaseVar]
  369. ] = None,
  370. on_double_click: Optional[
  371. Union[EventHandler, EventSpec, list, function, BaseVar]
  372. ] = None,
  373. on_focus: Optional[
  374. Union[EventHandler, EventSpec, list, function, BaseVar]
  375. ] = None,
  376. on_mount: Optional[
  377. Union[EventHandler, EventSpec, list, function, BaseVar]
  378. ] = None,
  379. on_mouse_down: Optional[
  380. Union[EventHandler, EventSpec, list, function, BaseVar]
  381. ] = None,
  382. on_mouse_enter: Optional[
  383. Union[EventHandler, EventSpec, list, function, BaseVar]
  384. ] = None,
  385. on_mouse_leave: Optional[
  386. Union[EventHandler, EventSpec, list, function, BaseVar]
  387. ] = None,
  388. on_mouse_move: Optional[
  389. Union[EventHandler, EventSpec, list, function, BaseVar]
  390. ] = None,
  391. on_mouse_out: Optional[
  392. Union[EventHandler, EventSpec, list, function, BaseVar]
  393. ] = None,
  394. on_mouse_over: Optional[
  395. Union[EventHandler, EventSpec, list, function, BaseVar]
  396. ] = None,
  397. on_mouse_up: Optional[
  398. Union[EventHandler, EventSpec, list, function, BaseVar]
  399. ] = None,
  400. on_scroll: Optional[
  401. Union[EventHandler, EventSpec, list, function, BaseVar]
  402. ] = None,
  403. on_unmount: Optional[
  404. Union[EventHandler, EventSpec, list, function, BaseVar]
  405. ] = None,
  406. **props
  407. ) -> "FormControl":
  408. """Create a Form Control component.
  409. Args:
  410. *children: The children of the form.
  411. as_child: Change the default rendered element for the one passed as a child.
  412. style: The style of the component.
  413. key: A unique key for the component.
  414. id: The id for the component.
  415. class_name: The class name for the component.
  416. autofocus: Whether the component should take the focus once the page is loaded
  417. custom_attrs: custom attribute
  418. **props: The properties of the form.
  419. Raises:
  420. ValueError: If the number of children is greater than 1.
  421. TypeError: If a child exists but it is not a TextFieldInput.
  422. Returns:
  423. The form control component.
  424. """
  425. ...
  426. LiteralMatcher = Literal[
  427. "badInput",
  428. "patternMismatch",
  429. "rangeOverflow",
  430. "rangeUnderflow",
  431. "stepMismatch",
  432. "tooLong",
  433. "tooShort",
  434. "typeMismatch",
  435. "valid",
  436. "valueMissing",
  437. ]
  438. class FormMessage(FormComponent):
  439. @overload
  440. @classmethod
  441. def create( # type: ignore
  442. cls,
  443. *children,
  444. name: Optional[Union[Var[str], str]] = None,
  445. match: Optional[
  446. Union[
  447. Var[
  448. Literal[
  449. "badInput",
  450. "patternMismatch",
  451. "rangeOverflow",
  452. "rangeUnderflow",
  453. "stepMismatch",
  454. "tooLong",
  455. "tooShort",
  456. "typeMismatch",
  457. "valid",
  458. "valueMissing",
  459. ]
  460. ],
  461. Literal[
  462. "badInput",
  463. "patternMismatch",
  464. "rangeOverflow",
  465. "rangeUnderflow",
  466. "stepMismatch",
  467. "tooLong",
  468. "tooShort",
  469. "typeMismatch",
  470. "valid",
  471. "valueMissing",
  472. ],
  473. ]
  474. ] = None,
  475. force_match: Optional[Union[Var[bool], bool]] = None,
  476. as_child: Optional[Union[Var[bool], bool]] = None,
  477. style: Optional[Style] = None,
  478. key: Optional[Any] = None,
  479. id: Optional[Any] = None,
  480. class_name: Optional[Any] = None,
  481. autofocus: Optional[bool] = None,
  482. custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
  483. on_blur: Optional[
  484. Union[EventHandler, EventSpec, list, function, BaseVar]
  485. ] = None,
  486. on_click: Optional[
  487. Union[EventHandler, EventSpec, list, function, BaseVar]
  488. ] = None,
  489. on_context_menu: Optional[
  490. Union[EventHandler, EventSpec, list, function, BaseVar]
  491. ] = None,
  492. on_double_click: Optional[
  493. Union[EventHandler, EventSpec, list, function, BaseVar]
  494. ] = None,
  495. on_focus: Optional[
  496. Union[EventHandler, EventSpec, list, function, BaseVar]
  497. ] = None,
  498. on_mount: Optional[
  499. Union[EventHandler, EventSpec, list, function, BaseVar]
  500. ] = None,
  501. on_mouse_down: Optional[
  502. Union[EventHandler, EventSpec, list, function, BaseVar]
  503. ] = None,
  504. on_mouse_enter: Optional[
  505. Union[EventHandler, EventSpec, list, function, BaseVar]
  506. ] = None,
  507. on_mouse_leave: Optional[
  508. Union[EventHandler, EventSpec, list, function, BaseVar]
  509. ] = None,
  510. on_mouse_move: Optional[
  511. Union[EventHandler, EventSpec, list, function, BaseVar]
  512. ] = None,
  513. on_mouse_out: Optional[
  514. Union[EventHandler, EventSpec, list, function, BaseVar]
  515. ] = None,
  516. on_mouse_over: Optional[
  517. Union[EventHandler, EventSpec, list, function, BaseVar]
  518. ] = None,
  519. on_mouse_up: Optional[
  520. Union[EventHandler, EventSpec, list, function, BaseVar]
  521. ] = None,
  522. on_scroll: Optional[
  523. Union[EventHandler, EventSpec, list, function, BaseVar]
  524. ] = None,
  525. on_unmount: Optional[
  526. Union[EventHandler, EventSpec, list, function, BaseVar]
  527. ] = None,
  528. **props
  529. ) -> "FormMessage":
  530. """Create the component.
  531. Args:
  532. *children: The children of the component.
  533. name: Used to target a specific field by name when rendering outside of a Field part.
  534. match: Used to indicate on which condition the message should be visible.
  535. force_match: Forces the message to be shown. This is useful when using server-side validation.
  536. as_child: Change the default rendered element for the one passed as a child.
  537. style: The style of the component.
  538. key: A unique key for the component.
  539. id: The id for the component.
  540. class_name: The class name for the component.
  541. autofocus: Whether the component should take the focus once the page is loaded
  542. custom_attrs: custom attribute
  543. **props: The props of the component.
  544. Returns:
  545. The component.
  546. Raises:
  547. TypeError: If an invalid child is passed.
  548. """
  549. ...
  550. class FormValidityState(FormComponent):
  551. @overload
  552. @classmethod
  553. def create( # type: ignore
  554. cls,
  555. *children,
  556. as_child: Optional[Union[Var[bool], bool]] = None,
  557. style: Optional[Style] = None,
  558. key: Optional[Any] = None,
  559. id: Optional[Any] = None,
  560. class_name: Optional[Any] = None,
  561. autofocus: Optional[bool] = None,
  562. custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
  563. on_blur: Optional[
  564. Union[EventHandler, EventSpec, list, function, BaseVar]
  565. ] = None,
  566. on_click: Optional[
  567. Union[EventHandler, EventSpec, list, function, BaseVar]
  568. ] = None,
  569. on_context_menu: Optional[
  570. Union[EventHandler, EventSpec, list, function, BaseVar]
  571. ] = None,
  572. on_double_click: Optional[
  573. Union[EventHandler, EventSpec, list, function, BaseVar]
  574. ] = None,
  575. on_focus: Optional[
  576. Union[EventHandler, EventSpec, list, function, BaseVar]
  577. ] = None,
  578. on_mount: Optional[
  579. Union[EventHandler, EventSpec, list, function, BaseVar]
  580. ] = None,
  581. on_mouse_down: Optional[
  582. Union[EventHandler, EventSpec, list, function, BaseVar]
  583. ] = None,
  584. on_mouse_enter: Optional[
  585. Union[EventHandler, EventSpec, list, function, BaseVar]
  586. ] = None,
  587. on_mouse_leave: Optional[
  588. Union[EventHandler, EventSpec, list, function, BaseVar]
  589. ] = None,
  590. on_mouse_move: Optional[
  591. Union[EventHandler, EventSpec, list, function, BaseVar]
  592. ] = None,
  593. on_mouse_out: Optional[
  594. Union[EventHandler, EventSpec, list, function, BaseVar]
  595. ] = None,
  596. on_mouse_over: Optional[
  597. Union[EventHandler, EventSpec, list, function, BaseVar]
  598. ] = None,
  599. on_mouse_up: Optional[
  600. Union[EventHandler, EventSpec, list, function, BaseVar]
  601. ] = None,
  602. on_scroll: Optional[
  603. Union[EventHandler, EventSpec, list, function, BaseVar]
  604. ] = None,
  605. on_unmount: Optional[
  606. Union[EventHandler, EventSpec, list, function, BaseVar]
  607. ] = None,
  608. **props
  609. ) -> "FormValidityState":
  610. """Create the component.
  611. Args:
  612. *children: The children of the component.
  613. as_child: Change the default rendered element for the one passed as a child.
  614. style: The style of the component.
  615. key: A unique key for the component.
  616. id: The id for the component.
  617. class_name: The class name for the component.
  618. autofocus: Whether the component should take the focus once the page is loaded
  619. custom_attrs: custom attribute
  620. **props: The props of the component.
  621. Returns:
  622. The component.
  623. Raises:
  624. TypeError: If an invalid child is passed.
  625. """
  626. ...
  627. class FormSubmit(FormComponent):
  628. @overload
  629. @classmethod
  630. def create( # type: ignore
  631. cls,
  632. *children,
  633. as_child: Optional[Union[Var[bool], bool]] = None,
  634. style: Optional[Style] = None,
  635. key: Optional[Any] = None,
  636. id: Optional[Any] = None,
  637. class_name: Optional[Any] = None,
  638. autofocus: Optional[bool] = None,
  639. custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
  640. on_blur: Optional[
  641. Union[EventHandler, EventSpec, list, function, BaseVar]
  642. ] = None,
  643. on_click: Optional[
  644. Union[EventHandler, EventSpec, list, function, BaseVar]
  645. ] = None,
  646. on_context_menu: Optional[
  647. Union[EventHandler, EventSpec, list, function, BaseVar]
  648. ] = None,
  649. on_double_click: Optional[
  650. Union[EventHandler, EventSpec, list, function, BaseVar]
  651. ] = None,
  652. on_focus: Optional[
  653. Union[EventHandler, EventSpec, list, function, BaseVar]
  654. ] = None,
  655. on_mount: Optional[
  656. Union[EventHandler, EventSpec, list, function, BaseVar]
  657. ] = None,
  658. on_mouse_down: Optional[
  659. Union[EventHandler, EventSpec, list, function, BaseVar]
  660. ] = None,
  661. on_mouse_enter: Optional[
  662. Union[EventHandler, EventSpec, list, function, BaseVar]
  663. ] = None,
  664. on_mouse_leave: Optional[
  665. Union[EventHandler, EventSpec, list, function, BaseVar]
  666. ] = None,
  667. on_mouse_move: Optional[
  668. Union[EventHandler, EventSpec, list, function, BaseVar]
  669. ] = None,
  670. on_mouse_out: Optional[
  671. Union[EventHandler, EventSpec, list, function, BaseVar]
  672. ] = None,
  673. on_mouse_over: Optional[
  674. Union[EventHandler, EventSpec, list, function, BaseVar]
  675. ] = None,
  676. on_mouse_up: Optional[
  677. Union[EventHandler, EventSpec, list, function, BaseVar]
  678. ] = None,
  679. on_scroll: Optional[
  680. Union[EventHandler, EventSpec, list, function, BaseVar]
  681. ] = None,
  682. on_unmount: Optional[
  683. Union[EventHandler, EventSpec, list, function, BaseVar]
  684. ] = None,
  685. **props
  686. ) -> "FormSubmit":
  687. """Create the component.
  688. Args:
  689. *children: The children of the component.
  690. as_child: Change the default rendered element for the one passed as a child.
  691. style: The style of the component.
  692. key: A unique key for the component.
  693. id: The id for the component.
  694. class_name: The class name for the component.
  695. autofocus: Whether the component should take the focus once the page is loaded
  696. custom_attrs: custom attribute
  697. **props: The props of the component.
  698. Returns:
  699. The component.
  700. Raises:
  701. TypeError: If an invalid child is passed.
  702. """
  703. ...
  704. class Form(FormRoot):
  705. pass
  706. @overload
  707. @classmethod
  708. def create( # type: ignore
  709. cls,
  710. *children,
  711. reset_on_submit: Optional[Union[Var[bool], bool]] = None,
  712. handle_submit_unique_name: Optional[Union[Var[str], str]] = None,
  713. as_child: Optional[Union[Var[bool], bool]] = None,
  714. style: Optional[Style] = None,
  715. key: Optional[Any] = None,
  716. id: Optional[Any] = None,
  717. class_name: Optional[Any] = None,
  718. autofocus: Optional[bool] = None,
  719. custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
  720. on_blur: Optional[
  721. Union[EventHandler, EventSpec, list, function, BaseVar]
  722. ] = None,
  723. on_clear_server_errors: Optional[
  724. Union[EventHandler, EventSpec, list, function, BaseVar]
  725. ] = None,
  726. on_click: Optional[
  727. Union[EventHandler, EventSpec, list, function, BaseVar]
  728. ] = None,
  729. on_context_menu: Optional[
  730. Union[EventHandler, EventSpec, list, function, BaseVar]
  731. ] = None,
  732. on_double_click: Optional[
  733. Union[EventHandler, EventSpec, list, function, BaseVar]
  734. ] = None,
  735. on_focus: Optional[
  736. Union[EventHandler, EventSpec, list, function, BaseVar]
  737. ] = None,
  738. on_mount: Optional[
  739. Union[EventHandler, EventSpec, list, function, BaseVar]
  740. ] = None,
  741. on_mouse_down: Optional[
  742. Union[EventHandler, EventSpec, list, function, BaseVar]
  743. ] = None,
  744. on_mouse_enter: Optional[
  745. Union[EventHandler, EventSpec, list, function, BaseVar]
  746. ] = None,
  747. on_mouse_leave: Optional[
  748. Union[EventHandler, EventSpec, list, function, BaseVar]
  749. ] = None,
  750. on_mouse_move: Optional[
  751. Union[EventHandler, EventSpec, list, function, BaseVar]
  752. ] = None,
  753. on_mouse_out: Optional[
  754. Union[EventHandler, EventSpec, list, function, BaseVar]
  755. ] = None,
  756. on_mouse_over: Optional[
  757. Union[EventHandler, EventSpec, list, function, BaseVar]
  758. ] = None,
  759. on_mouse_up: Optional[
  760. Union[EventHandler, EventSpec, list, function, BaseVar]
  761. ] = None,
  762. on_scroll: Optional[
  763. Union[EventHandler, EventSpec, list, function, BaseVar]
  764. ] = None,
  765. on_submit: Optional[
  766. Union[EventHandler, EventSpec, list, function, BaseVar]
  767. ] = None,
  768. on_unmount: Optional[
  769. Union[EventHandler, EventSpec, list, function, BaseVar]
  770. ] = None,
  771. **props
  772. ) -> "Form":
  773. """Create a form component.
  774. Args:
  775. *children: The children of the form.
  776. reset_on_submit: If true, the form will be cleared after submit.
  777. handle_submit_unique_name: The name used to make this form's submit handler function unique.
  778. as_child: Change the default rendered element for the one passed as a child.
  779. style: The style of the component.
  780. key: A unique key for the component.
  781. id: The id for the component.
  782. class_name: The class name for the component.
  783. autofocus: Whether the component should take the focus once the page is loaded
  784. custom_attrs: custom attribute
  785. **props: The properties of the form.
  786. Returns:
  787. The form component.
  788. """
  789. ...
  790. class FormNamespace(SimpleNamespace):
  791. root = staticmethod(FormRoot.create)
  792. control = staticmethod(FormControl.create)
  793. field = staticmethod(FormField.create)
  794. label = staticmethod(FormLabel.create)
  795. message = staticmethod(FormMessage.create)
  796. submit = staticmethod(FormSubmit.create)
  797. validity_state = staticmethod(FormValidityState.create)
  798. @staticmethod
  799. def __call__(
  800. *children,
  801. reset_on_submit: Optional[Union[Var[bool], bool]] = None,
  802. handle_submit_unique_name: Optional[Union[Var[str], str]] = None,
  803. as_child: Optional[Union[Var[bool], bool]] = None,
  804. style: Optional[Style] = None,
  805. key: Optional[Any] = None,
  806. id: Optional[Any] = None,
  807. class_name: Optional[Any] = None,
  808. autofocus: Optional[bool] = None,
  809. custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
  810. on_blur: Optional[
  811. Union[EventHandler, EventSpec, list, function, BaseVar]
  812. ] = None,
  813. on_clear_server_errors: Optional[
  814. Union[EventHandler, EventSpec, list, function, BaseVar]
  815. ] = None,
  816. on_click: Optional[
  817. Union[EventHandler, EventSpec, list, function, BaseVar]
  818. ] = None,
  819. on_context_menu: Optional[
  820. Union[EventHandler, EventSpec, list, function, BaseVar]
  821. ] = None,
  822. on_double_click: Optional[
  823. Union[EventHandler, EventSpec, list, function, BaseVar]
  824. ] = None,
  825. on_focus: Optional[
  826. Union[EventHandler, EventSpec, list, function, BaseVar]
  827. ] = None,
  828. on_mount: Optional[
  829. Union[EventHandler, EventSpec, list, function, BaseVar]
  830. ] = None,
  831. on_mouse_down: Optional[
  832. Union[EventHandler, EventSpec, list, function, BaseVar]
  833. ] = None,
  834. on_mouse_enter: Optional[
  835. Union[EventHandler, EventSpec, list, function, BaseVar]
  836. ] = None,
  837. on_mouse_leave: Optional[
  838. Union[EventHandler, EventSpec, list, function, BaseVar]
  839. ] = None,
  840. on_mouse_move: Optional[
  841. Union[EventHandler, EventSpec, list, function, BaseVar]
  842. ] = None,
  843. on_mouse_out: Optional[
  844. Union[EventHandler, EventSpec, list, function, BaseVar]
  845. ] = None,
  846. on_mouse_over: Optional[
  847. Union[EventHandler, EventSpec, list, function, BaseVar]
  848. ] = None,
  849. on_mouse_up: Optional[
  850. Union[EventHandler, EventSpec, list, function, BaseVar]
  851. ] = None,
  852. on_scroll: Optional[
  853. Union[EventHandler, EventSpec, list, function, BaseVar]
  854. ] = None,
  855. on_submit: Optional[
  856. Union[EventHandler, EventSpec, list, function, BaseVar]
  857. ] = None,
  858. on_unmount: Optional[
  859. Union[EventHandler, EventSpec, list, function, BaseVar]
  860. ] = None,
  861. **props
  862. ) -> "Form":
  863. """Create a form component.
  864. Args:
  865. *children: The children of the form.
  866. reset_on_submit: If true, the form will be cleared after submit.
  867. handle_submit_unique_name: The name used to make this form's submit handler function unique.
  868. as_child: Change the default rendered element for the one passed as a child.
  869. style: The style of the component.
  870. key: A unique key for the component.
  871. id: The id for the component.
  872. class_name: The class name for the component.
  873. autofocus: Whether the component should take the focus once the page is loaded
  874. custom_attrs: custom attribute
  875. **props: The properties of the form.
  876. Returns:
  877. The form component.
  878. """
  879. ...
  880. form = FormNamespace()