Text as_ prop literals update (#2620)

Support more literal values
This commit is contained in:
Elijah Ahianyo 2024-02-15 19:08:19 +00:00 committed by GitHub
parent 80c62da062
commit 791fcc9b41
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 166 additions and 8 deletions

View File

@ -22,7 +22,26 @@ from .base import (
LiteralTextWeight,
)
LiteralType = Literal["p", "label", "div", "span"]
LiteralType = Literal[
"p",
"label",
"div",
"span",
"b",
"i",
"u",
"abbr",
"cite",
"del",
"em",
"ins",
"kbd",
"mark",
"s",
"samp",
"sub",
"sup",
]
class Text(el.Span, RadixThemesComponent):

View File

@ -14,7 +14,26 @@ from reflex.vars import Var
from ..base import LiteralAccentColor, RadixThemesComponent
from .base import LiteralTextAlign, LiteralTextSize, LiteralTextTrim, LiteralTextWeight
LiteralType = Literal["p", "label", "div", "span"]
LiteralType = Literal[
"p",
"label",
"div",
"span",
"b",
"i",
"u",
"abbr",
"cite",
"del",
"em",
"ins",
"kbd",
"mark",
"s",
"samp",
"sub",
"sup",
]
class Text(el.Span, RadixThemesComponent):
@overload
@ -25,8 +44,48 @@ class Text(el.Span, RadixThemesComponent):
as_child: Optional[Union[Var[bool], bool]] = None,
as_: Optional[
Union[
Var[Literal["p", "label", "div", "span"]],
Literal["p", "label", "div", "span"],
Var[
Literal[
"p",
"label",
"div",
"span",
"b",
"i",
"u",
"abbr",
"cite",
"del",
"em",
"ins",
"kbd",
"mark",
"s",
"samp",
"sub",
"sup",
]
],
Literal[
"p",
"label",
"div",
"span",
"b",
"i",
"u",
"abbr",
"cite",
"del",
"em",
"ins",
"kbd",
"mark",
"s",
"samp",
"sub",
"sup",
],
]
] = None,
size: Optional[
@ -261,8 +320,48 @@ class Span(Text):
*children,
as_: Optional[
Union[
Var[Literal["p", "label", "div", "span"]],
Literal["p", "label", "div", "span"],
Var[
Literal[
"p",
"label",
"div",
"span",
"b",
"i",
"u",
"abbr",
"cite",
"del",
"em",
"ins",
"kbd",
"mark",
"s",
"samp",
"sub",
"sup",
]
],
Literal[
"p",
"label",
"div",
"span",
"b",
"i",
"u",
"abbr",
"cite",
"del",
"em",
"ins",
"kbd",
"mark",
"s",
"samp",
"sub",
"sup",
],
]
] = None,
as_child: Optional[Union[Var[bool], bool]] = None,
@ -1052,8 +1151,48 @@ class TextNamespace(SimpleNamespace):
as_child: Optional[Union[Var[bool], bool]] = None,
as_: Optional[
Union[
Var[Literal["p", "label", "div", "span"]],
Literal["p", "label", "div", "span"],
Var[
Literal[
"p",
"label",
"div",
"span",
"b",
"i",
"u",
"abbr",
"cite",
"del",
"em",
"ins",
"kbd",
"mark",
"s",
"samp",
"sub",
"sup",
]
],
Literal[
"p",
"label",
"div",
"span",
"b",
"i",
"u",
"abbr",
"cite",
"del",
"em",
"ins",
"kbd",
"mark",
"s",
"samp",
"sub",
"sup",
],
]
] = None,
size: Optional[