base.py 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. """Base classes."""
  2. from typing import Literal
  3. from reflex.components.el.element import Element
  4. from reflex.vars.base import Var
  5. AutoCapitalize = Literal["off", "none", "on", "sentences", "words", "characters"]
  6. ContentEditable = Literal[True, False, "inherit", "plaintext-only"]
  7. EnterKeyHint = Literal["enter", "done", "go", "next", "previous", "search", "send"]
  8. InputMode = Literal[
  9. "none", "text", "tel", "url", "email", "numeric", "decimal", "search", "search"
  10. ]
  11. AriaRole = Literal[
  12. "alert",
  13. "alertdialog",
  14. "application",
  15. "article",
  16. "banner",
  17. "button",
  18. "cell",
  19. "checkbox",
  20. "columnheader",
  21. "combobox",
  22. "complementary",
  23. "contentinfo",
  24. "definition",
  25. "dialog",
  26. "directory",
  27. "document",
  28. "feed",
  29. "figure",
  30. "form",
  31. "grid",
  32. "gridcell",
  33. "group",
  34. "heading",
  35. "img",
  36. "link",
  37. "list",
  38. "listbox",
  39. "listitem",
  40. "log",
  41. "main",
  42. "marquee",
  43. "math",
  44. "menu",
  45. "menubar",
  46. "menuitem",
  47. "menuitemcheckbox",
  48. "menuitemradio",
  49. "navigation",
  50. "none",
  51. "note",
  52. "option",
  53. "presentation",
  54. "progressbar",
  55. "radio",
  56. "radiogroup",
  57. "region",
  58. "row",
  59. "rowgroup",
  60. "rowheader",
  61. "scrollbar",
  62. "search",
  63. "searchbox",
  64. "separator",
  65. "slider",
  66. "spinbutton",
  67. "status",
  68. "switch",
  69. "tab",
  70. "table",
  71. "tablist",
  72. "tabpanel",
  73. "term",
  74. "textbox",
  75. "timer",
  76. "toolbar",
  77. "tooltip",
  78. "tree",
  79. "treegrid",
  80. "treeitem",
  81. ]
  82. class BaseHTML(Element):
  83. """Base class for common attributes."""
  84. # Provides a hint for generating a keyboard shortcut for the current element.
  85. access_key: Var[str]
  86. # Controls whether and how text input is automatically capitalized as it is entered/edited by the user.
  87. auto_capitalize: Var[AutoCapitalize]
  88. # Indicates whether the element's content is editable.
  89. content_editable: Var[ContentEditable]
  90. # Defines the ID of a <menu> element which will serve as the element's context menu.
  91. context_menu: Var[str]
  92. # Defines the text direction. Allowed values are ltr (Left-To-Right) or rtl (Right-To-Left)
  93. dir: Var[str]
  94. # Defines whether the element can be dragged.
  95. draggable: Var[bool]
  96. # Hints what media types the media element is able to play.
  97. enter_key_hint: Var[EnterKeyHint]
  98. # Defines whether the element is hidden.
  99. hidden: Var[bool]
  100. # Defines the type of the element.
  101. input_mode: Var[InputMode]
  102. # Defines the name of the element for metadata purposes.
  103. item_prop: Var[str]
  104. # Defines the language used in the element.
  105. lang: Var[str]
  106. # Defines the role of the element.
  107. role: Var[AriaRole]
  108. # Assigns a slot in a shadow DOM shadow tree to an element.
  109. slot: Var[str]
  110. # Defines whether the element may be checked for spelling errors.
  111. spell_check: Var[bool]
  112. # Defines the position of the current element in the tabbing order.
  113. tab_index: Var[int]
  114. # Defines a tooltip for the element.
  115. title: Var[str]