|
@@ -7,14 +7,10 @@ from typing import Any, Dict, Literal, Optional, Union, overload
|
|
from reflex.vars import Var, BaseVar, ComputedVar
|
|
from reflex.vars import Var, BaseVar, ComputedVar
|
|
from reflex.event import EventChain, EventHandler, EventSpec
|
|
from reflex.event import EventChain, EventHandler, EventSpec
|
|
from reflex.style import Style
|
|
from reflex.style import Style
|
|
-from typing import Literal
|
|
|
|
from reflex.components.component import Component
|
|
from reflex.components.component import Component
|
|
-from ..base import LiteralSpacing
|
|
|
|
|
|
+from ..base import LiteralAlign, LiteralSpacing
|
|
from .flex import Flex
|
|
from .flex import Flex
|
|
|
|
|
|
-LiteralJustify = Literal["start", "center", "end"]
|
|
|
|
-LiteralAlign = Literal["start", "center", "end", "stretch"]
|
|
|
|
-
|
|
|
|
class Stack(Flex):
|
|
class Stack(Flex):
|
|
@overload
|
|
@overload
|
|
@classmethod
|
|
@classmethod
|
|
@@ -22,6 +18,7 @@ class Stack(Flex):
|
|
cls,
|
|
cls,
|
|
*children,
|
|
*children,
|
|
spacing: Optional[LiteralSpacing] = "2",
|
|
spacing: Optional[LiteralSpacing] = "2",
|
|
|
|
+ align: Optional[LiteralAlign] = "start",
|
|
as_child: Optional[Union[Var[bool], bool]] = None,
|
|
as_child: Optional[Union[Var[bool], bool]] = None,
|
|
direction: Optional[
|
|
direction: Optional[
|
|
Union[
|
|
Union[
|
|
@@ -29,12 +26,6 @@ class Stack(Flex):
|
|
Literal["row", "column", "row-reverse", "column-reverse"],
|
|
Literal["row", "column", "row-reverse", "column-reverse"],
|
|
]
|
|
]
|
|
] = None,
|
|
] = None,
|
|
- align: Optional[
|
|
|
|
- Union[
|
|
|
|
- Var[Literal["start", "center", "end", "baseline", "stretch"]],
|
|
|
|
- Literal["start", "center", "end", "baseline", "stretch"],
|
|
|
|
- ]
|
|
|
|
- ] = None,
|
|
|
|
justify: Optional[
|
|
justify: Optional[
|
|
Union[
|
|
Union[
|
|
Var[Literal["start", "center", "end", "between"]],
|
|
Var[Literal["start", "center", "end", "between"]],
|
|
@@ -145,9 +136,9 @@ class Stack(Flex):
|
|
Args:
|
|
Args:
|
|
*children: The children of the stack.
|
|
*children: The children of the stack.
|
|
spacing: The spacing between each stack item.
|
|
spacing: The spacing between each stack item.
|
|
|
|
+ align: The alignment of the stack items.
|
|
as_child: Change the default rendered element for the one passed as a child, merging their props and behavior.
|
|
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"
|
|
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"
|
|
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"
|
|
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.
|
|
access_key: Provides a hint for generating a keyboard shortcut for the current element.
|
|
@@ -186,6 +177,7 @@ class VStack(Stack):
|
|
cls,
|
|
cls,
|
|
*children,
|
|
*children,
|
|
spacing: Optional[LiteralSpacing] = "2",
|
|
spacing: Optional[LiteralSpacing] = "2",
|
|
|
|
+ align: Optional[LiteralAlign] = "start",
|
|
as_child: Optional[Union[Var[bool], bool]] = None,
|
|
as_child: Optional[Union[Var[bool], bool]] = None,
|
|
direction: Optional[
|
|
direction: Optional[
|
|
Union[
|
|
Union[
|
|
@@ -193,12 +185,6 @@ class VStack(Stack):
|
|
Literal["row", "column", "row-reverse", "column-reverse"],
|
|
Literal["row", "column", "row-reverse", "column-reverse"],
|
|
]
|
|
]
|
|
] = None,
|
|
] = None,
|
|
- align: Optional[
|
|
|
|
- Union[
|
|
|
|
- Var[Literal["start", "center", "end", "baseline", "stretch"]],
|
|
|
|
- Literal["start", "center", "end", "baseline", "stretch"],
|
|
|
|
- ]
|
|
|
|
- ] = None,
|
|
|
|
justify: Optional[
|
|
justify: Optional[
|
|
Union[
|
|
Union[
|
|
Var[Literal["start", "center", "end", "between"]],
|
|
Var[Literal["start", "center", "end", "between"]],
|
|
@@ -309,9 +295,9 @@ class VStack(Stack):
|
|
Args:
|
|
Args:
|
|
*children: The children of the stack.
|
|
*children: The children of the stack.
|
|
spacing: The spacing between each stack item.
|
|
spacing: The spacing between each stack item.
|
|
|
|
+ align: The alignment of the stack items.
|
|
as_child: Change the default rendered element for the one passed as a child, merging their props and behavior.
|
|
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"
|
|
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"
|
|
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"
|
|
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.
|
|
access_key: Provides a hint for generating a keyboard shortcut for the current element.
|
|
@@ -350,6 +336,7 @@ class HStack(Stack):
|
|
cls,
|
|
cls,
|
|
*children,
|
|
*children,
|
|
spacing: Optional[LiteralSpacing] = "2",
|
|
spacing: Optional[LiteralSpacing] = "2",
|
|
|
|
+ align: Optional[LiteralAlign] = "start",
|
|
as_child: Optional[Union[Var[bool], bool]] = None,
|
|
as_child: Optional[Union[Var[bool], bool]] = None,
|
|
direction: Optional[
|
|
direction: Optional[
|
|
Union[
|
|
Union[
|
|
@@ -357,12 +344,6 @@ class HStack(Stack):
|
|
Literal["row", "column", "row-reverse", "column-reverse"],
|
|
Literal["row", "column", "row-reverse", "column-reverse"],
|
|
]
|
|
]
|
|
] = None,
|
|
] = None,
|
|
- align: Optional[
|
|
|
|
- Union[
|
|
|
|
- Var[Literal["start", "center", "end", "baseline", "stretch"]],
|
|
|
|
- Literal["start", "center", "end", "baseline", "stretch"],
|
|
|
|
- ]
|
|
|
|
- ] = None,
|
|
|
|
justify: Optional[
|
|
justify: Optional[
|
|
Union[
|
|
Union[
|
|
Var[Literal["start", "center", "end", "between"]],
|
|
Var[Literal["start", "center", "end", "between"]],
|
|
@@ -473,9 +454,9 @@ class HStack(Stack):
|
|
Args:
|
|
Args:
|
|
*children: The children of the stack.
|
|
*children: The children of the stack.
|
|
spacing: The spacing between each stack item.
|
|
spacing: The spacing between each stack item.
|
|
|
|
+ align: The alignment of the stack items.
|
|
as_child: Change the default rendered element for the one passed as a child, merging their props and behavior.
|
|
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"
|
|
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"
|
|
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"
|
|
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.
|
|
access_key: Provides a hint for generating a keyboard shortcut for the current element.
|