update to allow items to be autogenerated for docs (#2419)

This commit is contained in:
Tom Gotsman 2024-01-18 17:37:20 -08:00 committed by GitHub
parent 676f2c5dc2
commit c8693851fe
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 23 additions and 14 deletions

View File

@ -441,7 +441,6 @@ class AccordionRoot(AccordionComponent):
return {"css": self._dynamic_themes._merge(format_as_emotion(self.style))} # type: ignore
def _apply_theme(self, theme: Component):
self._dynamic_themes = Var.create( # type: ignore
convert_dict_to_style_and_format_emotion(
{

View File

@ -70,25 +70,29 @@ class Checkbox(CommonMarginProps, RadixThemesComponent):
class HighLevelCheckbox(Checkbox):
"""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
def create(
cls,
text: str = "",
gap: Var[LiteralSize] = Var.create_safe("2"),
size: Var[LiteralCheckboxSize] = Var.create_safe("2"),
**props
) -> Component:
def create(cls, text: Var[str] = Var.create_safe(""), **props) -> Component:
"""Create a checkbox with a label.
Args:
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.
Returns:
The checkbox component with a label.
"""
gap = props.pop("gap", "2")
size = props.pop("size", "2")
return Text.create(
Flex.create(
Checkbox.create(size=size, **props),

View File

@ -252,10 +252,17 @@ class HighLevelCheckbox(Checkbox):
def create( # type: ignore
cls,
*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[
Union[Var[Literal["1", "2", "3"]], Literal["1", "2", "3"]]
] = None,
as_child: Optional[Union[Var[bool], bool]] = None,
variant: Optional[
Union[
Var[Literal["classic", "solid", "soft", "surface", "outline", "ghost"]],
@ -433,10 +440,10 @@ class HighLevelCheckbox(Checkbox):
Args:
text: The text of the label.
text: The text label for the checkbox.
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"
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"
color: Override theme color for button
high_contrast: Whether to render the button with higher contrast color against background

View File

@ -723,7 +723,6 @@ class Var:
# apply function to operands
if fn is not None:
if invoke_fn:
# invoke the function on left operand.
operation_name = f"{left_operand_full_name}.{fn}({right_operand_full_name})" # type: ignore