Explorar el Código

Use align start by default stacks (#2619)

Nikhil Rao hace 1 año
padre
commit
80c62da062

+ 1 - 1
reflex/components/chakra/forms/input.py

@@ -30,7 +30,7 @@ class Input(ChakraComponent):
     placeholder: Var[str]
 
     # The type of input.
-    type_: Var[LiteralInputType] = "text"  # type: ignore
+    type_: Var[LiteralInputType]
 
     # The border color when the input is invalid.
     error_border_color: Var[str]

+ 0 - 6
reflex/components/radix/themes/layout/stack.py

@@ -19,8 +19,6 @@ class Stack(Flex):
     def create(
         cls,
         *children,
-        justify: LiteralJustify = "start",
-        align: LiteralAlign = "center",
         spacing: LiteralSize = "2",
         **props,
     ) -> Component:
@@ -28,8 +26,6 @@ class Stack(Flex):
 
         Args:
             *children: The children of the stack.
-            justify: The justify of the stack elements.
-            align: The alignment of the stack elements.
             spacing: The spacing between each stack item.
             **props: The properties of the stack.
 
@@ -38,8 +34,6 @@ class Stack(Flex):
         """
         return super().create(
             *children,
-            align=align,
-            justify=justify,
             spacing=spacing,
             **props,
         )

+ 42 - 12
reflex/components/radix/themes/layout/stack.pyi

@@ -21,8 +21,6 @@ class Stack(Flex):
     def create(  # type: ignore
         cls,
         *children,
-        justify: Optional[LiteralJustify] = "start",
-        align: Optional[LiteralAlign] = "center",
         spacing: Optional[LiteralSize] = "2",
         as_child: Optional[Union[Var[bool], bool]] = None,
         direction: Optional[
@@ -31,6 +29,18 @@ class Stack(Flex):
                 Literal["row", "column", "row-reverse", "column-reverse"],
             ]
         ] = None,
+        align: Optional[
+            Union[
+                Var[Literal["start", "center", "end", "baseline", "stretch"]],
+                Literal["start", "center", "end", "baseline", "stretch"],
+            ]
+        ] = None,
+        justify: Optional[
+            Union[
+                Var[Literal["start", "center", "end", "between"]],
+                Literal["start", "center", "end", "between"],
+            ]
+        ] = None,
         wrap: Optional[
             Union[
                 Var[Literal["nowrap", "wrap", "wrap-reverse"]],
@@ -134,11 +144,11 @@ class Stack(Flex):
 
         Args:
             *children: The children of the stack.
-            justify: The justify of the stack elements.
-            align: The alignment of the stack elements.
             spacing: The spacing between each stack item.
             as_child: Change the default rendered element for the one passed as a child, merging their props and behavior.
             direction: How child items are layed out: "row" | "column" | "row-reverse" | "column-reverse"
+            align: Alignment of children along the main axis: "start" | "center" | "end" | "baseline" | "stretch"
+            justify: Alignment of children along the cross axis: "start" | "center" | "end" | "between"
             wrap: Whether children should wrap when they reach the end of their container: "nowrap" | "wrap" | "wrap-reverse"
             access_key:  Provides a hint for generating a keyboard shortcut for the current element.
             auto_capitalize: Controls whether and how text input is automatically capitalized as it is entered/edited by the user.
@@ -175,8 +185,6 @@ class VStack(Stack):
     def create(  # type: ignore
         cls,
         *children,
-        justify: Optional[LiteralJustify] = "start",
-        align: Optional[LiteralAlign] = "center",
         spacing: Optional[LiteralSize] = "2",
         as_child: Optional[Union[Var[bool], bool]] = None,
         direction: Optional[
@@ -185,6 +193,18 @@ class VStack(Stack):
                 Literal["row", "column", "row-reverse", "column-reverse"],
             ]
         ] = None,
+        align: Optional[
+            Union[
+                Var[Literal["start", "center", "end", "baseline", "stretch"]],
+                Literal["start", "center", "end", "baseline", "stretch"],
+            ]
+        ] = None,
+        justify: Optional[
+            Union[
+                Var[Literal["start", "center", "end", "between"]],
+                Literal["start", "center", "end", "between"],
+            ]
+        ] = None,
         wrap: Optional[
             Union[
                 Var[Literal["nowrap", "wrap", "wrap-reverse"]],
@@ -288,11 +308,11 @@ class VStack(Stack):
 
         Args:
             *children: The children of the stack.
-            justify: The justify of the stack elements.
-            align: The alignment of the stack elements.
             spacing: The spacing between each stack item.
             as_child: Change the default rendered element for the one passed as a child, merging their props and behavior.
             direction: How child items are layed out: "row" | "column" | "row-reverse" | "column-reverse"
+            align: Alignment of children along the main axis: "start" | "center" | "end" | "baseline" | "stretch"
+            justify: Alignment of children along the cross axis: "start" | "center" | "end" | "between"
             wrap: Whether children should wrap when they reach the end of their container: "nowrap" | "wrap" | "wrap-reverse"
             access_key:  Provides a hint for generating a keyboard shortcut for the current element.
             auto_capitalize: Controls whether and how text input is automatically capitalized as it is entered/edited by the user.
@@ -329,8 +349,6 @@ class HStack(Stack):
     def create(  # type: ignore
         cls,
         *children,
-        justify: Optional[LiteralJustify] = "start",
-        align: Optional[LiteralAlign] = "center",
         spacing: Optional[LiteralSize] = "2",
         as_child: Optional[Union[Var[bool], bool]] = None,
         direction: Optional[
@@ -339,6 +357,18 @@ class HStack(Stack):
                 Literal["row", "column", "row-reverse", "column-reverse"],
             ]
         ] = None,
+        align: Optional[
+            Union[
+                Var[Literal["start", "center", "end", "baseline", "stretch"]],
+                Literal["start", "center", "end", "baseline", "stretch"],
+            ]
+        ] = None,
+        justify: Optional[
+            Union[
+                Var[Literal["start", "center", "end", "between"]],
+                Literal["start", "center", "end", "between"],
+            ]
+        ] = None,
         wrap: Optional[
             Union[
                 Var[Literal["nowrap", "wrap", "wrap-reverse"]],
@@ -442,11 +472,11 @@ class HStack(Stack):
 
         Args:
             *children: The children of the stack.
-            justify: The justify of the stack elements.
-            align: The alignment of the stack elements.
             spacing: The spacing between each stack item.
             as_child: Change the default rendered element for the one passed as a child, merging their props and behavior.
             direction: How child items are layed out: "row" | "column" | "row-reverse" | "column-reverse"
+            align: Alignment of children along the main axis: "start" | "center" | "end" | "baseline" | "stretch"
+            justify: Alignment of children along the cross axis: "start" | "center" | "end" | "between"
             wrap: Whether children should wrap when they reach the end of their container: "nowrap" | "wrap" | "wrap-reverse"
             access_key:  Provides a hint for generating a keyboard shortcut for the current element.
             auto_capitalize: Controls whether and how text input is automatically capitalized as it is entered/edited by the user.