Fix radix radio cards component (#3545)
* ruff format * fix radio card component * generated radio_cards.pyi * ruff format
This commit is contained in:
parent
0314d19e7e
commit
e4c17deafb
@ -3,6 +3,7 @@
|
||||
from types import SimpleNamespace
|
||||
from typing import Literal, Union
|
||||
|
||||
from reflex.event import EventHandler
|
||||
from reflex.vars import Var
|
||||
|
||||
from ..base import LiteralAccentColor, RadixThemesComponent
|
||||
@ -13,6 +14,9 @@ class RadioCardsRoot(RadixThemesComponent):
|
||||
|
||||
tag = "RadioCards.Root"
|
||||
|
||||
# Change the default rendered element for the one passed as a child, merging their props and behavior.
|
||||
as_child: Var[bool]
|
||||
|
||||
# The size of the checkbox cards: "1" | "2" | "3"
|
||||
size: Var[Literal["1", "2", "3"]]
|
||||
|
||||
@ -31,12 +35,51 @@ class RadioCardsRoot(RadixThemesComponent):
|
||||
# The gap between the checkbox cards:
|
||||
gap: Var[Union[str, Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]]]
|
||||
|
||||
default_value: Var[str]
|
||||
|
||||
# The controlled value of the radio item to check. Should be used in conjunction with onValueChange.
|
||||
value: Var[str]
|
||||
|
||||
# The name of the group. Submitted with its owning form as part of a name/value pair.
|
||||
name: Var[str]
|
||||
|
||||
# When true, prevents the user from interacting with radio items.
|
||||
disabled: Var[bool]
|
||||
|
||||
# When true, indicates that the user must check a radio item before the owning form can be submitted.
|
||||
required: Var[bool]
|
||||
|
||||
# The orientation of the component.
|
||||
orientation: Var[Literal["horizontal", "vertical", "undefined"]]
|
||||
|
||||
# The reading direction of the radio group. If omitted,
|
||||
# inherits globally from DirectionProvider or assumes LTR (left-to-right) reading mode.
|
||||
dir: Var[Literal["ltr", "rtl"]]
|
||||
|
||||
# When true, keyboard navigation will loop from last item to first, and vice versa.
|
||||
loop: Var[bool]
|
||||
|
||||
# Event handler called when the value changes.
|
||||
on_value_change: EventHandler[lambda e0: [e0]]
|
||||
|
||||
|
||||
class RadioCardsItem(RadixThemesComponent):
|
||||
"""Item element for RadioCards component."""
|
||||
|
||||
tag = "RadioCards.Item"
|
||||
|
||||
# Change the default rendered element for the one passed as a child, merging their props and behavior.
|
||||
as_child: Var[bool]
|
||||
|
||||
# The value given as data when submitted with a name.
|
||||
value: Var[str]
|
||||
|
||||
# When true, prevents the user from interacting with the radio item.
|
||||
disabled: Var[bool]
|
||||
|
||||
# When true, indicates that the user must check the radio item before the owning form can be submitted.
|
||||
required: Var[bool]
|
||||
|
||||
|
||||
class RadioCards(SimpleNamespace):
|
||||
"""RadioCards components namespace."""
|
||||
|
@ -9,6 +9,7 @@ from reflex.event import EventChain, EventHandler, EventSpec
|
||||
from reflex.style import Style
|
||||
from types import SimpleNamespace
|
||||
from typing import Literal, Union
|
||||
from reflex.event import EventHandler
|
||||
from reflex.vars import Var
|
||||
from ..base import LiteralAccentColor, RadixThemesComponent
|
||||
|
||||
@ -18,6 +19,7 @@ class RadioCardsRoot(RadixThemesComponent):
|
||||
def create( # type: ignore
|
||||
cls,
|
||||
*children,
|
||||
as_child: Optional[Union[Var[bool], bool]] = None,
|
||||
size: Optional[
|
||||
Union[Var[Literal["1", "2", "3"]], Literal["1", "2", "3"]]
|
||||
] = None,
|
||||
@ -99,6 +101,19 @@ class RadioCardsRoot(RadixThemesComponent):
|
||||
Union[str, Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
|
||||
]
|
||||
] = None,
|
||||
default_value: Optional[Union[Var[str], str]] = None,
|
||||
value: Optional[Union[Var[str], str]] = None,
|
||||
name: Optional[Union[Var[str], str]] = None,
|
||||
disabled: Optional[Union[Var[bool], bool]] = None,
|
||||
required: Optional[Union[Var[bool], bool]] = None,
|
||||
orientation: Optional[
|
||||
Union[
|
||||
Var[Literal["horizontal", "vertical", "undefined"]],
|
||||
Literal["horizontal", "vertical", "undefined"],
|
||||
]
|
||||
] = None,
|
||||
dir: Optional[Union[Var[Literal["ltr", "rtl"]], Literal["ltr", "rtl"]]] = None,
|
||||
loop: Optional[Union[Var[bool], bool]] = None,
|
||||
style: Optional[Style] = None,
|
||||
key: Optional[Any] = None,
|
||||
id: Optional[Any] = None,
|
||||
@ -150,6 +165,9 @@ class RadioCardsRoot(RadixThemesComponent):
|
||||
on_unmount: Optional[
|
||||
Union[EventHandler, EventSpec, list, function, BaseVar]
|
||||
] = None,
|
||||
on_value_change: Optional[
|
||||
Union[EventHandler, EventSpec, list, function, BaseVar]
|
||||
] = None,
|
||||
**props
|
||||
) -> "RadioCardsRoot":
|
||||
"""Create a new component instance.
|
||||
@ -159,12 +177,20 @@ class RadioCardsRoot(RadixThemesComponent):
|
||||
|
||||
Args:
|
||||
*children: Child components.
|
||||
as_child: Change the default rendered element for the one passed as a child, merging their props and behavior.
|
||||
size: The size of the checkbox cards: "1" | "2" | "3"
|
||||
variant: Variant of button: "classic" | "surface" | "soft"
|
||||
color_scheme: Override theme color for button
|
||||
high_contrast: Uses a higher contrast color for the component.
|
||||
columns: The number of columns:
|
||||
gap: The gap between the checkbox cards:
|
||||
value: The controlled value of the radio item to check. Should be used in conjunction with onValueChange.
|
||||
name: The name of the group. Submitted with its owning form as part of a name/value pair.
|
||||
disabled: When true, prevents the user from interacting with radio items.
|
||||
required: When true, indicates that the user must check a radio item before the owning form can be submitted.
|
||||
orientation: The orientation of the component.
|
||||
dir: The reading direction of the radio group. If omitted, inherits globally from DirectionProvider or assumes LTR (left-to-right) reading mode.
|
||||
loop: When true, keyboard navigation will loop from last item to first, and vice versa.
|
||||
style: The style of the component.
|
||||
key: A unique key for the component.
|
||||
id: The id for the component.
|
||||
@ -184,6 +210,10 @@ class RadioCardsItem(RadixThemesComponent):
|
||||
def create( # type: ignore
|
||||
cls,
|
||||
*children,
|
||||
as_child: Optional[Union[Var[bool], bool]] = None,
|
||||
value: Optional[Union[Var[str], str]] = None,
|
||||
disabled: Optional[Union[Var[bool], bool]] = None,
|
||||
required: Optional[Union[Var[bool], bool]] = None,
|
||||
style: Optional[Style] = None,
|
||||
key: Optional[Any] = None,
|
||||
id: Optional[Any] = None,
|
||||
@ -244,6 +274,10 @@ class RadioCardsItem(RadixThemesComponent):
|
||||
|
||||
Args:
|
||||
*children: Child components.
|
||||
as_child: Change the default rendered element for the one passed as a child, merging their props and behavior.
|
||||
value: The value given as data when submitted with a name.
|
||||
disabled: When true, prevents the user from interacting with the radio item.
|
||||
required: When true, indicates that the user must check the radio item before the owning form can be submitted.
|
||||
style: The style of the component.
|
||||
key: A unique key for the component.
|
||||
id: The id for the component.
|
||||
|
Loading…
Reference in New Issue
Block a user