|
@@ -16,8 +16,7 @@ from ..base import (
|
|
|
RadixThemesComponent,
|
|
|
)
|
|
|
|
|
|
-LiteralFlexDirection = Literal["row",
|
|
|
- "column", "row-reverse", "column-reverse"]
|
|
|
+LiteralFlexDirection = Literal["row", "column", "row-reverse", "column-reverse"]
|
|
|
|
|
|
|
|
|
class RadioGroupRoot(RadixThemesComponent):
|
|
@@ -26,8 +25,7 @@ class RadioGroupRoot(RadixThemesComponent):
|
|
|
tag = "RadioGroup.Root"
|
|
|
|
|
|
# The size of the radio group: "1" | "2" | "3"
|
|
|
- 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
|
|
|
variant: Var[Literal["classic", "surface", "soft"]] = Var.create_safe(
|
|
@@ -100,8 +98,7 @@ class HighLevelRadioGroup(RadixThemesComponent):
|
|
|
spacing: Var[LiteralSpacing] = Var.create_safe("2", _var_is_string=True)
|
|
|
|
|
|
# The size of the radio group.
|
|
|
- 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
|
|
|
variant: Var[Literal["classic", "surface", "soft"]] = Var.create_safe(
|
|
@@ -161,8 +158,7 @@ class HighLevelRadioGroup(RadixThemesComponent):
|
|
|
if isinstance(default_value, str) or (
|
|
|
isinstance(default_value, Var) and default_value._var_type is str
|
|
|
):
|
|
|
- default_value = Var.create(
|
|
|
- default_value, _var_is_string=True) # type: ignore
|
|
|
+ default_value = Var.create(default_value, _var_is_string=True) # type: ignore
|
|
|
else:
|
|
|
default_value = (
|
|
|
Var.create(default_value, _var_is_string=False)
|
|
@@ -171,8 +167,7 @@ class HighLevelRadioGroup(RadixThemesComponent):
|
|
|
)
|
|
|
|
|
|
def radio_group_item(value: str | Var) -> Component:
|
|
|
- item_value = Var.create(
|
|
|
- value, _var_is_string=False) # type: ignore
|
|
|
+ item_value = Var.create(value, _var_is_string=False) # type: ignore
|
|
|
item_value = rx.cond(
|
|
|
item_value._type() == str, # type: ignore
|
|
|
item_value,
|
|
@@ -182,8 +177,8 @@ class HighLevelRadioGroup(RadixThemesComponent):
|
|
|
return Text.create(
|
|
|
Flex.create(
|
|
|
RadioGroupItem.create(
|
|
|
- value=item_value, disabled=props.get(
|
|
|
- "disabled", Var.create(False))
|
|
|
+ value=item_value,
|
|
|
+ disabled=props.get("disabled", Var.create(False)),
|
|
|
),
|
|
|
item_value,
|
|
|
spacing="2",
|