update to allow items to be autogenerated for docs (#2419)
This commit is contained in:
parent
676f2c5dc2
commit
c8693851fe
@ -441,7 +441,6 @@ class AccordionRoot(AccordionComponent):
|
|||||||
return {"css": self._dynamic_themes._merge(format_as_emotion(self.style))} # type: ignore
|
return {"css": self._dynamic_themes._merge(format_as_emotion(self.style))} # type: ignore
|
||||||
|
|
||||||
def _apply_theme(self, theme: Component):
|
def _apply_theme(self, theme: Component):
|
||||||
|
|
||||||
self._dynamic_themes = Var.create( # type: ignore
|
self._dynamic_themes = Var.create( # type: ignore
|
||||||
convert_dict_to_style_and_format_emotion(
|
convert_dict_to_style_and_format_emotion(
|
||||||
{
|
{
|
||||||
|
@ -70,25 +70,29 @@ class Checkbox(CommonMarginProps, RadixThemesComponent):
|
|||||||
class HighLevelCheckbox(Checkbox):
|
class HighLevelCheckbox(Checkbox):
|
||||||
"""A checkbox component with a label."""
|
"""A checkbox component with a label."""
|
||||||
|
|
||||||
|
# The text label for the checkbox.
|
||||||
|
text: Var[str]
|
||||||
|
|
||||||
|
# The gap between the checkbox and the label.
|
||||||
|
gap: Var[LiteralSize]
|
||||||
|
|
||||||
|
# The size of the checkbox.
|
||||||
|
size: Var[LiteralCheckboxSize]
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def create(
|
def create(cls, text: Var[str] = Var.create_safe(""), **props) -> Component:
|
||||||
cls,
|
|
||||||
text: str = "",
|
|
||||||
gap: Var[LiteralSize] = Var.create_safe("2"),
|
|
||||||
size: Var[LiteralCheckboxSize] = Var.create_safe("2"),
|
|
||||||
**props
|
|
||||||
) -> Component:
|
|
||||||
"""Create a checkbox with a label.
|
"""Create a checkbox with a label.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
text: The text of the label.
|
text: The text of the label.
|
||||||
gap: The gap between the checkbox and the label.
|
|
||||||
size: The size of the checkbox.
|
|
||||||
**props: Additional properties to apply to the checkbox item.
|
**props: Additional properties to apply to the checkbox item.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
The checkbox component with a label.
|
The checkbox component with a label.
|
||||||
"""
|
"""
|
||||||
|
gap = props.pop("gap", "2")
|
||||||
|
size = props.pop("size", "2")
|
||||||
|
|
||||||
return Text.create(
|
return Text.create(
|
||||||
Flex.create(
|
Flex.create(
|
||||||
Checkbox.create(size=size, **props),
|
Checkbox.create(size=size, **props),
|
||||||
|
@ -252,10 +252,17 @@ class HighLevelCheckbox(Checkbox):
|
|||||||
def create( # type: ignore
|
def create( # type: ignore
|
||||||
cls,
|
cls,
|
||||||
*children,
|
*children,
|
||||||
as_child: Optional[Union[Var[bool], bool]] = None,
|
text: Optional[Union[Var[str], str]] = None,
|
||||||
|
gap: Optional[
|
||||||
|
Union[
|
||||||
|
Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
|
||||||
|
Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
|
||||||
|
]
|
||||||
|
] = None,
|
||||||
size: Optional[
|
size: Optional[
|
||||||
Union[Var[Literal["1", "2", "3"]], Literal["1", "2", "3"]]
|
Union[Var[Literal["1", "2", "3"]], Literal["1", "2", "3"]]
|
||||||
] = None,
|
] = None,
|
||||||
|
as_child: Optional[Union[Var[bool], bool]] = None,
|
||||||
variant: Optional[
|
variant: Optional[
|
||||||
Union[
|
Union[
|
||||||
Var[Literal["classic", "solid", "soft", "surface", "outline", "ghost"]],
|
Var[Literal["classic", "solid", "soft", "surface", "outline", "ghost"]],
|
||||||
@ -433,10 +440,10 @@ class HighLevelCheckbox(Checkbox):
|
|||||||
|
|
||||||
Args:
|
Args:
|
||||||
text: The text of the label.
|
text: The text of the label.
|
||||||
|
text: The text label for the checkbox.
|
||||||
gap: The gap between the checkbox and the label.
|
gap: The gap between the checkbox and the label.
|
||||||
size: The size of the checkbox.
|
|
||||||
as_child: Change the default rendered element for the one passed as a child, merging their props and behavior.
|
|
||||||
size: Button size "1" - "3"
|
size: Button size "1" - "3"
|
||||||
|
as_child: Change the default rendered element for the one passed as a child, merging their props and behavior.
|
||||||
variant: Variant of button: "solid" | "soft" | "outline" | "ghost"
|
variant: Variant of button: "solid" | "soft" | "outline" | "ghost"
|
||||||
color: Override theme color for button
|
color: Override theme color for button
|
||||||
high_contrast: Whether to render the button with higher contrast color against background
|
high_contrast: Whether to render the button with higher contrast color against background
|
||||||
|
@ -723,7 +723,6 @@ class Var:
|
|||||||
|
|
||||||
# apply function to operands
|
# apply function to operands
|
||||||
if fn is not None:
|
if fn is not None:
|
||||||
|
|
||||||
if invoke_fn:
|
if invoke_fn:
|
||||||
# invoke the function on left operand.
|
# invoke the function on left operand.
|
||||||
operation_name = f"{left_operand_full_name}.{fn}({right_operand_full_name})" # type: ignore
|
operation_name = f"{left_operand_full_name}.{fn}({right_operand_full_name})" # type: ignore
|
||||||
|
Loading…
Reference in New Issue
Block a user