Chakra input component type_ prop literal (#2292)
This commit is contained in:
parent
833ce48882
commit
53e402f47b
@ -9,6 +9,7 @@ from reflex.components.libs.chakra import (
|
|||||||
LiteralButtonSize,
|
LiteralButtonSize,
|
||||||
LiteralInputVariant,
|
LiteralInputVariant,
|
||||||
)
|
)
|
||||||
|
from reflex.components.literals import LiteralInputType
|
||||||
from reflex.constants import EventTriggers, MemoizationMode
|
from reflex.constants import EventTriggers, MemoizationMode
|
||||||
from reflex.utils import imports
|
from reflex.utils import imports
|
||||||
from reflex.vars import Var
|
from reflex.vars import Var
|
||||||
@ -29,7 +30,7 @@ class Input(ChakraComponent):
|
|||||||
placeholder: Var[str]
|
placeholder: Var[str]
|
||||||
|
|
||||||
# The type of input.
|
# The type of input.
|
||||||
type_: Var[str] = "text" # type: ignore
|
type_: Var[LiteralInputType] = "text" # type: ignore
|
||||||
|
|
||||||
# The border color when the input is invalid.
|
# The border color when the input is invalid.
|
||||||
error_border_color: Var[str]
|
error_border_color: Var[str]
|
||||||
|
@ -15,6 +15,7 @@ from reflex.components.libs.chakra import (
|
|||||||
LiteralButtonSize,
|
LiteralButtonSize,
|
||||||
LiteralInputVariant,
|
LiteralInputVariant,
|
||||||
)
|
)
|
||||||
|
from reflex.components.literals import LiteralInputType
|
||||||
from reflex.constants import EventTriggers, MemoizationMode
|
from reflex.constants import EventTriggers, MemoizationMode
|
||||||
from reflex.utils import imports
|
from reflex.utils import imports
|
||||||
from reflex.vars import Var
|
from reflex.vars import Var
|
||||||
@ -29,7 +30,60 @@ class Input(ChakraComponent):
|
|||||||
value: Optional[Union[Var[str], str]] = None,
|
value: Optional[Union[Var[str], str]] = None,
|
||||||
default_value: Optional[Union[Var[str], str]] = None,
|
default_value: Optional[Union[Var[str], str]] = None,
|
||||||
placeholder: Optional[Union[Var[str], str]] = None,
|
placeholder: Optional[Union[Var[str], str]] = None,
|
||||||
type_: Optional[Union[Var[str], str]] = None,
|
type_: Optional[
|
||||||
|
Union[
|
||||||
|
Var[
|
||||||
|
Literal[
|
||||||
|
"button",
|
||||||
|
"checkbox",
|
||||||
|
"color",
|
||||||
|
"date",
|
||||||
|
"datetime-local",
|
||||||
|
"email",
|
||||||
|
"file",
|
||||||
|
"hidden",
|
||||||
|
"image",
|
||||||
|
"month",
|
||||||
|
"number",
|
||||||
|
"password",
|
||||||
|
"radio",
|
||||||
|
"range",
|
||||||
|
"reset",
|
||||||
|
"search",
|
||||||
|
"submit",
|
||||||
|
"tel",
|
||||||
|
"text",
|
||||||
|
"time",
|
||||||
|
"url",
|
||||||
|
"week",
|
||||||
|
]
|
||||||
|
],
|
||||||
|
Literal[
|
||||||
|
"button",
|
||||||
|
"checkbox",
|
||||||
|
"color",
|
||||||
|
"date",
|
||||||
|
"datetime-local",
|
||||||
|
"email",
|
||||||
|
"file",
|
||||||
|
"hidden",
|
||||||
|
"image",
|
||||||
|
"month",
|
||||||
|
"number",
|
||||||
|
"password",
|
||||||
|
"radio",
|
||||||
|
"range",
|
||||||
|
"reset",
|
||||||
|
"search",
|
||||||
|
"submit",
|
||||||
|
"tel",
|
||||||
|
"text",
|
||||||
|
"time",
|
||||||
|
"url",
|
||||||
|
"week",
|
||||||
|
],
|
||||||
|
]
|
||||||
|
] = None,
|
||||||
error_border_color: Optional[Union[Var[str], str]] = None,
|
error_border_color: Optional[Union[Var[str], str]] = None,
|
||||||
focus_border_color: Optional[Union[Var[str], str]] = None,
|
focus_border_color: Optional[Union[Var[str], str]] = None,
|
||||||
is_disabled: Optional[Union[Var[bool], bool]] = None,
|
is_disabled: Optional[Union[Var[bool], bool]] = None,
|
||||||
|
@ -2,4 +2,31 @@
|
|||||||
|
|
||||||
from typing import Literal
|
from typing import Literal
|
||||||
|
|
||||||
|
# Base Literals
|
||||||
|
LiteralInputType = Literal[
|
||||||
|
"button",
|
||||||
|
"checkbox",
|
||||||
|
"color",
|
||||||
|
"date",
|
||||||
|
"datetime-local",
|
||||||
|
"email",
|
||||||
|
"file",
|
||||||
|
"hidden",
|
||||||
|
"image",
|
||||||
|
"month",
|
||||||
|
"number",
|
||||||
|
"password",
|
||||||
|
"radio",
|
||||||
|
"range",
|
||||||
|
"reset",
|
||||||
|
"search",
|
||||||
|
"submit",
|
||||||
|
"tel",
|
||||||
|
"text",
|
||||||
|
"time",
|
||||||
|
"url",
|
||||||
|
"week",
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
LiteralRowMarker = Literal["none", "number", "checkbox", "both", "clickable-number"]
|
LiteralRowMarker = Literal["none", "number", "checkbox", "both", "clickable-number"]
|
||||||
|
Loading…
Reference in New Issue
Block a user