small updates to size prop and type prop

This commit is contained in:
Tom Gotsman 2024-01-30 11:40:12 -08:00
parent bece5bdb44
commit 730489bc19
4 changed files with 121 additions and 0 deletions

View File

@ -17,6 +17,9 @@ class AlertDialogRoot(CommonMarginProps, RadixThemesComponent):
# The controlled open state of the dialog.
open: Var[bool]
# The size of the dialog.
size: Var[LiteralSize]
def get_event_triggers(self) -> Dict[str, Any]:
"""Get the events triggers signatures for the component.
@ -34,6 +37,9 @@ class AlertDialogTrigger(CommonMarginProps, RadixThemesComponent):
tag = "AlertDialog.Trigger"
# The size of the dialog.
size: Var[LiteralSize]
class AlertDialogContent(el.Div, CommonMarginProps, RadixThemesComponent):
"""Contains the content of the dialog. This component is based on the div element."""
@ -68,6 +74,9 @@ class AlertDialogTitle(CommonMarginProps, RadixThemesComponent):
tag = "AlertDialog.Title"
# The size of the dialog.
size: Var[LiteralSize]
class AlertDialogDescription(CommonMarginProps, RadixThemesComponent):
"""An optional accessible description that is announced when the dialog is opened.
@ -76,6 +85,9 @@ class AlertDialogDescription(CommonMarginProps, RadixThemesComponent):
tag = "AlertDialog.Description"
# The size of the dialog.
size: Var[LiteralSize]
class AlertDialogAction(CommonMarginProps, RadixThemesComponent):
"""Wraps the control that will close the dialog. This should be distinguished
@ -84,6 +96,9 @@ class AlertDialogAction(CommonMarginProps, RadixThemesComponent):
tag = "AlertDialog.Action"
# The size of the dialog.
size: Var[LiteralSize]
class AlertDialogCancel(CommonMarginProps, RadixThemesComponent):
"""Wraps the control that will close the dialog. This should be distinguished
@ -91,3 +106,6 @@ class AlertDialogCancel(CommonMarginProps, RadixThemesComponent):
"""
tag = "AlertDialog.Cancel"
# The size of the dialog.
size: Var[LiteralSize]

View File

@ -85,6 +85,12 @@ class AlertDialogRoot(CommonMarginProps, RadixThemesComponent):
]
] = None,
open: Optional[Union[Var[bool], bool]] = None,
size: Optional[
Union[
Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
]
] = None,
m: Optional[
Union[
Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
@ -193,6 +199,7 @@ class AlertDialogRoot(CommonMarginProps, RadixThemesComponent):
color: map to CSS default color property.
color_scheme: map to radix color property.
open: The controlled open state of the dialog.
size: The size of the dialog.
m: Margin: "0" - "9"
mx: Margin horizontal: "0" - "9"
my: Margin vertical: "0" - "9"
@ -282,6 +289,12 @@ class AlertDialogTrigger(CommonMarginProps, RadixThemesComponent):
],
]
] = None,
size: Optional[
Union[
Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
]
] = None,
m: Optional[
Union[
Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
@ -386,6 +399,7 @@ class AlertDialogTrigger(CommonMarginProps, RadixThemesComponent):
*children: Child components.
color: map to CSS default color property.
color_scheme: map to radix color property.
size: The size of the dialog.
m: Margin: "0" - "9"
mx: Margin horizontal: "0" - "9"
my: Margin vertical: "0" - "9"
@ -747,6 +761,12 @@ class AlertDialogTitle(CommonMarginProps, RadixThemesComponent):
],
]
] = None,
size: Optional[
Union[
Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
]
] = None,
m: Optional[
Union[
Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
@ -851,6 +871,7 @@ class AlertDialogTitle(CommonMarginProps, RadixThemesComponent):
*children: Child components.
color: map to CSS default color property.
color_scheme: map to radix color property.
size: The size of the dialog.
m: Margin: "0" - "9"
mx: Margin horizontal: "0" - "9"
my: Margin vertical: "0" - "9"
@ -940,6 +961,12 @@ class AlertDialogDescription(CommonMarginProps, RadixThemesComponent):
],
]
] = None,
size: Optional[
Union[
Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
]
] = None,
m: Optional[
Union[
Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
@ -1044,6 +1071,7 @@ class AlertDialogDescription(CommonMarginProps, RadixThemesComponent):
*children: Child components.
color: map to CSS default color property.
color_scheme: map to radix color property.
size: The size of the dialog.
m: Margin: "0" - "9"
mx: Margin horizontal: "0" - "9"
my: Margin vertical: "0" - "9"
@ -1133,6 +1161,12 @@ class AlertDialogAction(CommonMarginProps, RadixThemesComponent):
],
]
] = None,
size: Optional[
Union[
Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
]
] = None,
m: Optional[
Union[
Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
@ -1237,6 +1271,7 @@ class AlertDialogAction(CommonMarginProps, RadixThemesComponent):
*children: Child components.
color: map to CSS default color property.
color_scheme: map to radix color property.
size: The size of the dialog.
m: Margin: "0" - "9"
mx: Margin horizontal: "0" - "9"
my: Margin vertical: "0" - "9"
@ -1326,6 +1361,12 @@ class AlertDialogCancel(CommonMarginProps, RadixThemesComponent):
],
]
] = None,
size: Optional[
Union[
Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
]
] = None,
m: Optional[
Union[
Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
@ -1430,6 +1471,7 @@ class AlertDialogCancel(CommonMarginProps, RadixThemesComponent):
*children: Child components.
color: map to CSS default color property.
color_scheme: map to radix color property.
size: The size of the dialog.
m: Margin: "0" - "9"
mx: Margin horizontal: "0" - "9"
my: Margin vertical: "0" - "9"

View File

@ -5,6 +5,7 @@ import reflex as rx
from reflex.components import el
from reflex.components.component import Component
from reflex.components.core.debounce import DebounceInput
from reflex.components.literals import LiteralInputType
from reflex.components.radix.themes.components.icons import Icon
from reflex.constants import EventTriggers
from reflex.vars import Var
@ -136,6 +137,9 @@ class Input(RadixThemesComponent):
# Indicates that the input is required
required: Var[bool]
# The type of input.
type: Var[LiteralInputType] = "text" # type: ignore
# Value of the input
value: Var[str]
@ -160,6 +164,7 @@ class Input(RadixThemesComponent):
"name",
"placeholder",
"required",
"type",
"value",
"on_change",
"on_focus",

View File

@ -22,6 +22,7 @@ from ..base import (
LiteralSize,
RadixThemesComponent,
)
from reflex.components.literals import LiteralInputType
LiteralTextFieldSize = Literal["1", "2", "3"]
LiteralTextFieldVariant = Literal["classic", "surface", "soft"]
@ -924,6 +925,60 @@ class Input(RadixThemesComponent):
name: Optional[Union[Var[str], str]] = None,
placeholder: Optional[Union[Var[str], str]] = None,
required: Optional[Union[Var[bool], bool]] = 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,
value: Optional[Union[Var[str], str]] = None,
style: Optional[Style] = None,
key: Optional[Any] = None,
@ -1003,6 +1058,7 @@ class Input(RadixThemesComponent):
name: Name of the input, used when sending form data
placeholder: Placeholder text in the input
required: Indicates that the input is required
type: The type of input.
value: Value of the input
style: The style of the component.
key: A unique key for the component.