Pārlūkot izejas kodu

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

Tom Gotsman 1 gadu atpakaļ
vecāks
revīzija
c8693851fe

+ 0 - 1
reflex/components/radix/primitives/accordion.py

@@ -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(
                 {

+ 13 - 9
reflex/components/radix/themes/components/checkbox.py

@@ -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),

+ 10 - 3
reflex/components/radix/themes/components/checkbox.pyi

@@ -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

+ 0 - 1
reflex/vars.py

@@ -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