Compare commits
3 Commits
main
...
radio-grou
Author | SHA1 | Date | |
---|---|---|---|
![]() |
c2117a3e19 | ||
![]() |
24be948a1c | ||
![]() |
c5212c3c0d |
@ -25,10 +25,12 @@ class RadioGroupRoot(RadixThemesComponent):
|
|||||||
tag = "RadioGroup.Root"
|
tag = "RadioGroup.Root"
|
||||||
|
|
||||||
# The size of the radio group: "1" | "2" | "3"
|
# The size of the radio group: "1" | "2" | "3"
|
||||||
size: Var[Literal["1", "2", "3"]]
|
size: Var[Literal["1", "2", "3"]] = Var.create_safe("2", _var_is_string=True)
|
||||||
|
|
||||||
# The variant of the radio group
|
# The variant of the radio group
|
||||||
variant: Var[Literal["classic", "surface", "soft"]]
|
variant: Var[Literal["classic", "surface", "soft"]] = Var.create_safe(
|
||||||
|
"classic", _var_is_string=True
|
||||||
|
)
|
||||||
|
|
||||||
# The color of the radio group
|
# The color of the radio group
|
||||||
color_scheme: Var[LiteralAccentColor]
|
color_scheme: Var[LiteralAccentColor]
|
||||||
@ -88,7 +90,9 @@ class HighLevelRadioGroup(RadixThemesComponent):
|
|||||||
items: Var[List[str]]
|
items: Var[List[str]]
|
||||||
|
|
||||||
# The direction of the radio group.
|
# The direction of the radio group.
|
||||||
direction: Var[LiteralFlexDirection]
|
direction: Var[LiteralFlexDirection] = Var.create_safe(
|
||||||
|
"column", _var_is_string=True
|
||||||
|
)
|
||||||
|
|
||||||
# The gap between the items of the radio group.
|
# The gap between the items of the radio group.
|
||||||
spacing: Var[LiteralSpacing] = Var.create_safe("2", _var_is_string=True)
|
spacing: Var[LiteralSpacing] = Var.create_safe("2", _var_is_string=True)
|
||||||
@ -97,7 +101,9 @@ class HighLevelRadioGroup(RadixThemesComponent):
|
|||||||
size: Var[Literal["1", "2", "3"]] = Var.create_safe("2", _var_is_string=True)
|
size: Var[Literal["1", "2", "3"]] = Var.create_safe("2", _var_is_string=True)
|
||||||
|
|
||||||
# The variant of the radio group
|
# The variant of the radio group
|
||||||
variant: Var[Literal["classic", "surface", "soft"]]
|
variant: Var[Literal["classic", "surface", "soft"]] = Var.create_safe(
|
||||||
|
"classic", _var_is_string=True
|
||||||
|
)
|
||||||
|
|
||||||
# The color of the radio group
|
# The color of the radio group
|
||||||
color_scheme: Var[LiteralAccentColor]
|
color_scheme: Var[LiteralAccentColor]
|
||||||
@ -141,8 +147,12 @@ class HighLevelRadioGroup(RadixThemesComponent):
|
|||||||
direction = props.pop("direction", "column")
|
direction = props.pop("direction", "column")
|
||||||
spacing = props.pop("spacing", "2")
|
spacing = props.pop("spacing", "2")
|
||||||
size = props.pop("size", "2")
|
size = props.pop("size", "2")
|
||||||
|
variant = props.pop("variant", "classic")
|
||||||
|
color_scheme = props.pop("color_scheme", None)
|
||||||
default_value = props.pop("default_value", "")
|
default_value = props.pop("default_value", "")
|
||||||
|
|
||||||
|
default_value = Var.create(default_value)
|
||||||
|
|
||||||
# convert only non-strings to json(JSON.stringify) so quotes are not rendered
|
# convert only non-strings to json(JSON.stringify) so quotes are not rendered
|
||||||
# for string literal types.
|
# for string literal types.
|
||||||
if isinstance(default_value, str) or (
|
if isinstance(default_value, str) or (
|
||||||
@ -166,7 +176,10 @@ class HighLevelRadioGroup(RadixThemesComponent):
|
|||||||
|
|
||||||
return Text.create(
|
return Text.create(
|
||||||
Flex.create(
|
Flex.create(
|
||||||
RadioGroupItem.create(value=item_value),
|
RadioGroupItem.create(
|
||||||
|
value=item_value,
|
||||||
|
disabled=props.get("disabled", Var.create(False)),
|
||||||
|
),
|
||||||
item_value,
|
item_value,
|
||||||
spacing="2",
|
spacing="2",
|
||||||
),
|
),
|
||||||
@ -184,6 +197,8 @@ class HighLevelRadioGroup(RadixThemesComponent):
|
|||||||
spacing=spacing,
|
spacing=spacing,
|
||||||
),
|
),
|
||||||
size=size,
|
size=size,
|
||||||
|
variant=variant,
|
||||||
|
color_scheme=color_scheme,
|
||||||
default_value=default_value,
|
default_value=default_value,
|
||||||
**props,
|
**props,
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user