From 855a20fd1c1a8009aedbd12ee24dc92e20599fd4 Mon Sep 17 00:00:00 2001 From: Elijah Ahianyo Date: Fri, 8 Nov 2024 00:04:03 +0000 Subject: [PATCH] [GTM-648]Add Missing Table props (#4322) * Add Missing Table props * add more props --- reflex/components/radix/themes/base.py | 26 ++ reflex/components/radix/themes/base.pyi | 173 +++++++++++ .../radix/themes/components/table.py | 24 +- .../radix/themes/components/table.pyi | 282 +++++++++++++++++- reflex/components/radix/themes/layout/base.py | 25 +- .../components/radix/themes/layout/base.pyi | 130 ++++---- 6 files changed, 566 insertions(+), 94 deletions(-) diff --git a/reflex/components/radix/themes/base.py b/reflex/components/radix/themes/base.py index 20ebdc5a68..7a0fc809f2 100644 --- a/reflex/components/radix/themes/base.py +++ b/reflex/components/radix/themes/base.py @@ -5,6 +5,7 @@ from typing import Any, Dict, Literal from reflex.components import Component +from reflex.components.core.breakpoints import Responsive from reflex.components.tags import Tag from reflex.config import get_config from reflex.utils.imports import ImportDict, ImportVar @@ -74,6 +75,31 @@ class CommonMarginProps(Component): ml: Var[LiteralSpacing] +class CommonPaddingProps(Component): + """Many radix-themes elements accept shorthand padding props.""" + + # Padding: "0" - "9" + p: Var[Responsive[LiteralSpacing]] + + # Padding horizontal: "0" - "9" + px: Var[Responsive[LiteralSpacing]] + + # Padding vertical: "0" - "9" + py: Var[Responsive[LiteralSpacing]] + + # Padding top: "0" - "9" + pt: Var[Responsive[LiteralSpacing]] + + # Padding right: "0" - "9" + pr: Var[Responsive[LiteralSpacing]] + + # Padding bottom: "0" - "9" + pb: Var[Responsive[LiteralSpacing]] + + # Padding left: "0" - "9" + pl: Var[Responsive[LiteralSpacing]] + + class RadixLoadingProp(Component): """Base class for components that can be in a loading state.""" diff --git a/reflex/components/radix/themes/base.pyi b/reflex/components/radix/themes/base.pyi index 57cebcbb85..f0698bc2c4 100644 --- a/reflex/components/radix/themes/base.pyi +++ b/reflex/components/radix/themes/base.pyi @@ -6,6 +6,7 @@ from typing import Any, Dict, Literal, Optional, Union, overload from reflex.components import Component +from reflex.components.core.breakpoints import Breakpoints from reflex.event import BASE_STATE, EventType from reflex.style import Style from reflex.utils.imports import ImportDict @@ -144,6 +145,178 @@ class CommonMarginProps(Component): """ ... +class CommonPaddingProps(Component): + @overload + @classmethod + def create( # type: ignore + cls, + *children, + p: Optional[ + Union[ + Breakpoints[ + str, Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"] + ], + Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], + Var[ + Union[ + Breakpoints[ + str, + Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], + ], + Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], + ] + ], + ] + ] = None, + px: Optional[ + Union[ + Breakpoints[ + str, Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"] + ], + Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], + Var[ + Union[ + Breakpoints[ + str, + Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], + ], + Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], + ] + ], + ] + ] = None, + py: Optional[ + Union[ + Breakpoints[ + str, Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"] + ], + Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], + Var[ + Union[ + Breakpoints[ + str, + Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], + ], + Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], + ] + ], + ] + ] = None, + pt: Optional[ + Union[ + Breakpoints[ + str, Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"] + ], + Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], + Var[ + Union[ + Breakpoints[ + str, + Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], + ], + Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], + ] + ], + ] + ] = None, + pr: Optional[ + Union[ + Breakpoints[ + str, Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"] + ], + Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], + Var[ + Union[ + Breakpoints[ + str, + Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], + ], + Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], + ] + ], + ] + ] = None, + pb: Optional[ + Union[ + Breakpoints[ + str, Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"] + ], + Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], + Var[ + Union[ + Breakpoints[ + str, + Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], + ], + Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], + ] + ], + ] + ] = None, + pl: Optional[ + Union[ + Breakpoints[ + str, Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"] + ], + Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], + Var[ + Union[ + Breakpoints[ + str, + Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], + ], + Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], + ] + ], + ] + ] = None, + style: Optional[Style] = None, + key: Optional[Any] = None, + id: Optional[Any] = None, + class_name: Optional[Any] = None, + autofocus: Optional[bool] = None, + custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, + on_blur: Optional[EventType[[], BASE_STATE]] = None, + on_click: Optional[EventType[[], BASE_STATE]] = None, + on_context_menu: Optional[EventType[[], BASE_STATE]] = None, + on_double_click: Optional[EventType[[], BASE_STATE]] = None, + on_focus: Optional[EventType[[], BASE_STATE]] = None, + on_mount: Optional[EventType[[], BASE_STATE]] = None, + on_mouse_down: Optional[EventType[[], BASE_STATE]] = None, + on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None, + on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None, + on_mouse_move: Optional[EventType[[], BASE_STATE]] = None, + on_mouse_out: Optional[EventType[[], BASE_STATE]] = None, + on_mouse_over: Optional[EventType[[], BASE_STATE]] = None, + on_mouse_up: Optional[EventType[[], BASE_STATE]] = None, + on_scroll: Optional[EventType[[], BASE_STATE]] = None, + on_unmount: Optional[EventType[[], BASE_STATE]] = None, + **props, + ) -> "CommonPaddingProps": + """Create the component. + + Args: + *children: The children of the component. + p: Padding: "0" - "9" + px: Padding horizontal: "0" - "9" + py: Padding vertical: "0" - "9" + pt: Padding top: "0" - "9" + pr: Padding right: "0" - "9" + pb: Padding bottom: "0" - "9" + pl: Padding left: "0" - "9" + style: The style of the component. + key: A unique key for the component. + id: The id for the component. + class_name: The class name for the component. + autofocus: Whether the component should take the focus once the page is loaded + custom_attrs: custom attribute + **props: The props of the component. + + Returns: + The component. + """ + ... + class RadixLoadingProp(Component): @overload @classmethod diff --git a/reflex/components/radix/themes/components/table.py b/reflex/components/radix/themes/components/table.py index ce1058db53..a16002f588 100644 --- a/reflex/components/radix/themes/components/table.py +++ b/reflex/components/radix/themes/components/table.py @@ -7,7 +7,7 @@ from reflex.components.el import elements from reflex.vars.base import Var -from ..base import RadixThemesComponent +from ..base import CommonPaddingProps, RadixThemesComponent class TableRoot(elements.Table, RadixThemesComponent): @@ -51,6 +51,12 @@ class TableColumnHeaderCell(elements.Th, RadixThemesComponent): # The justification of the column justify: Var[Literal["start", "center", "end"]] + # The minimum width of the cell + min_width: Var[Responsive[str]] + + # The maximum width of the cell + max_width: Var[Responsive[str]] + _invalid_children: List[str] = [ "TableBody", "TableHeader", @@ -76,7 +82,7 @@ class TableBody(elements.Tbody, RadixThemesComponent): _valid_parents: List[str] = ["TableRoot"] -class TableCell(elements.Td, RadixThemesComponent): +class TableCell(elements.Td, CommonPaddingProps, RadixThemesComponent): """A cell containing data.""" tag = "Table.Cell" @@ -84,6 +90,12 @@ class TableCell(elements.Td, RadixThemesComponent): # The justification of the column justify: Var[Literal["start", "center", "end"]] + # The minimum width of the cell + min_width: Var[Responsive[str]] + + # The maximum width of the cell + max_width: Var[Responsive[str]] + _invalid_children: List[str] = [ "TableBody", "TableHeader", @@ -93,7 +105,7 @@ class TableCell(elements.Td, RadixThemesComponent): ] -class TableRowHeaderCell(elements.Th, RadixThemesComponent): +class TableRowHeaderCell(elements.Th, CommonPaddingProps, RadixThemesComponent): """A table cell that is semantically treated as a row header.""" tag = "Table.RowHeaderCell" @@ -101,6 +113,12 @@ class TableRowHeaderCell(elements.Th, RadixThemesComponent): # The justification of the column justify: Var[Literal["start", "center", "end"]] + # The minimum width of the cell + min_width: Var[Responsive[str]] + + # The maximum width of the cell + max_width: Var[Responsive[str]] + _invalid_children: List[str] = [ "TableBody", "TableHeader", diff --git a/reflex/components/radix/themes/components/table.pyi b/reflex/components/radix/themes/components/table.pyi index 822c4b56f7..9bc7bf7307 100644 --- a/reflex/components/radix/themes/components/table.pyi +++ b/reflex/components/radix/themes/components/table.pyi @@ -12,7 +12,7 @@ from reflex.event import BASE_STATE, EventType from reflex.style import Style from reflex.vars.base import Var -from ..base import RadixThemesComponent +from ..base import CommonPaddingProps, RadixThemesComponent class TableRoot(elements.Table, RadixThemesComponent): @overload @@ -322,6 +322,12 @@ class TableColumnHeaderCell(elements.Th, RadixThemesComponent): Var[Literal["center", "end", "start"]], ] ] = None, + min_width: Optional[ + Union[Breakpoints[str, str], Var[Union[Breakpoints[str, str], str]], str] + ] = None, + max_width: Optional[ + Union[Breakpoints[str, str], Var[Union[Breakpoints[str, str], str]], str] + ] = None, align: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, col_span: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, headers: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, @@ -382,6 +388,8 @@ class TableColumnHeaderCell(elements.Th, RadixThemesComponent): Args: *children: Child components. justify: The justification of the column + min_width: The minimum width of the cell + max_width: The maximum width of the cell align: Alignment of the content within the table header cell col_span: Number of columns a header cell should span headers: IDs of the headers associated with this header cell @@ -507,7 +515,7 @@ class TableBody(elements.Tbody, RadixThemesComponent): """ ... -class TableCell(elements.Td, RadixThemesComponent): +class TableCell(elements.Td, CommonPaddingProps, RadixThemesComponent): @overload @classmethod def create( # type: ignore @@ -519,6 +527,12 @@ class TableCell(elements.Td, RadixThemesComponent): Var[Literal["center", "end", "start"]], ] ] = None, + min_width: Optional[ + Union[Breakpoints[str, str], Var[Union[Breakpoints[str, str], str]], str] + ] = None, + max_width: Optional[ + Union[Breakpoints[str, str], Var[Union[Breakpoints[str, str], str]], str] + ] = None, align: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, col_span: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, headers: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, @@ -547,6 +561,125 @@ class TableCell(elements.Td, RadixThemesComponent): spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + p: Optional[ + Union[ + Breakpoints[ + str, Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"] + ], + Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], + Var[ + Union[ + Breakpoints[ + str, + Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], + ], + Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], + ] + ], + ] + ] = None, + px: Optional[ + Union[ + Breakpoints[ + str, Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"] + ], + Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], + Var[ + Union[ + Breakpoints[ + str, + Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], + ], + Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], + ] + ], + ] + ] = None, + py: Optional[ + Union[ + Breakpoints[ + str, Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"] + ], + Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], + Var[ + Union[ + Breakpoints[ + str, + Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], + ], + Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], + ] + ], + ] + ] = None, + pt: Optional[ + Union[ + Breakpoints[ + str, Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"] + ], + Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], + Var[ + Union[ + Breakpoints[ + str, + Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], + ], + Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], + ] + ], + ] + ] = None, + pr: Optional[ + Union[ + Breakpoints[ + str, Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"] + ], + Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], + Var[ + Union[ + Breakpoints[ + str, + Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], + ], + Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], + ] + ], + ] + ] = None, + pb: Optional[ + Union[ + Breakpoints[ + str, Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"] + ], + Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], + Var[ + Union[ + Breakpoints[ + str, + Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], + ], + Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], + ] + ], + ] + ] = None, + pl: Optional[ + Union[ + Breakpoints[ + str, Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"] + ], + Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], + Var[ + Union[ + Breakpoints[ + str, + Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], + ], + Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], + ] + ], + ] + ] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, @@ -578,6 +711,8 @@ class TableCell(elements.Td, RadixThemesComponent): Args: *children: Child components. justify: The justification of the column + min_width: The minimum width of the cell + max_width: The maximum width of the cell align: Alignment of the content within the table cell col_span: Number of columns a cell should span headers: IDs of the headers associated with this cell @@ -598,6 +733,13 @@ class TableCell(elements.Td, RadixThemesComponent): spell_check: Defines whether the element may be checked for spelling errors. tab_index: Defines the position of the current element in the tabbing order. title: Defines a tooltip for the element. + p: Padding: "0" - "9" + px: Padding horizontal: "0" - "9" + py: Padding vertical: "0" - "9" + pt: Padding top: "0" - "9" + pr: Padding right: "0" - "9" + pb: Padding bottom: "0" - "9" + pl: Padding left: "0" - "9" style: The style of the component. key: A unique key for the component. id: The id for the component. @@ -611,7 +753,7 @@ class TableCell(elements.Td, RadixThemesComponent): """ ... -class TableRowHeaderCell(elements.Th, RadixThemesComponent): +class TableRowHeaderCell(elements.Th, CommonPaddingProps, RadixThemesComponent): @overload @classmethod def create( # type: ignore @@ -623,6 +765,12 @@ class TableRowHeaderCell(elements.Th, RadixThemesComponent): Var[Literal["center", "end", "start"]], ] ] = None, + min_width: Optional[ + Union[Breakpoints[str, str], Var[Union[Breakpoints[str, str], str]], str] + ] = None, + max_width: Optional[ + Union[Breakpoints[str, str], Var[Union[Breakpoints[str, str], str]], str] + ] = None, align: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, col_span: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, headers: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, @@ -652,6 +800,125 @@ class TableRowHeaderCell(elements.Th, RadixThemesComponent): spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None, + p: Optional[ + Union[ + Breakpoints[ + str, Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"] + ], + Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], + Var[ + Union[ + Breakpoints[ + str, + Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], + ], + Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], + ] + ], + ] + ] = None, + px: Optional[ + Union[ + Breakpoints[ + str, Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"] + ], + Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], + Var[ + Union[ + Breakpoints[ + str, + Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], + ], + Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], + ] + ], + ] + ] = None, + py: Optional[ + Union[ + Breakpoints[ + str, Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"] + ], + Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], + Var[ + Union[ + Breakpoints[ + str, + Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], + ], + Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], + ] + ], + ] + ] = None, + pt: Optional[ + Union[ + Breakpoints[ + str, Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"] + ], + Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], + Var[ + Union[ + Breakpoints[ + str, + Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], + ], + Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], + ] + ], + ] + ] = None, + pr: Optional[ + Union[ + Breakpoints[ + str, Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"] + ], + Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], + Var[ + Union[ + Breakpoints[ + str, + Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], + ], + Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], + ] + ], + ] + ] = None, + pb: Optional[ + Union[ + Breakpoints[ + str, Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"] + ], + Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], + Var[ + Union[ + Breakpoints[ + str, + Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], + ], + Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], + ] + ], + ] + ] = None, + pl: Optional[ + Union[ + Breakpoints[ + str, Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"] + ], + Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], + Var[ + Union[ + Breakpoints[ + str, + Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], + ], + Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], + ] + ], + ] + ] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, @@ -683,6 +950,8 @@ class TableRowHeaderCell(elements.Th, RadixThemesComponent): Args: *children: Child components. justify: The justification of the column + min_width: The minimum width of the cell + max_width: The maximum width of the cell align: Alignment of the content within the table header cell col_span: Number of columns a header cell should span headers: IDs of the headers associated with this header cell @@ -704,6 +973,13 @@ class TableRowHeaderCell(elements.Th, RadixThemesComponent): spell_check: Defines whether the element may be checked for spelling errors. tab_index: Defines the position of the current element in the tabbing order. title: Defines a tooltip for the element. + p: Padding: "0" - "9" + px: Padding horizontal: "0" - "9" + py: Padding vertical: "0" - "9" + pt: Padding top: "0" - "9" + pr: Padding right: "0" - "9" + pb: Padding bottom: "0" - "9" + pl: Padding left: "0" - "9" style: The style of the component. key: A unique key for the component. id: The id for the component. diff --git a/reflex/components/radix/themes/layout/base.py b/reflex/components/radix/themes/layout/base.py index 61ba19710c..f31f6a72c8 100644 --- a/reflex/components/radix/themes/layout/base.py +++ b/reflex/components/radix/themes/layout/base.py @@ -7,38 +7,17 @@ from reflex.components.core.breakpoints import Responsive from reflex.vars.base import Var -from ..base import CommonMarginProps, LiteralSpacing, RadixThemesComponent +from ..base import CommonMarginProps, CommonPaddingProps, RadixThemesComponent LiteralBoolNumber = Literal["0", "1"] -class LayoutComponent(CommonMarginProps, RadixThemesComponent): +class LayoutComponent(CommonMarginProps, CommonPaddingProps, RadixThemesComponent): """Box, Flex and Grid are foundational elements you'll use to construct layouts. Box provides block-level spacing and sizing, while Flex and Grid let you create flexible columns, rows and grids. """ - # Padding: "0" - "9" - p: Var[Responsive[LiteralSpacing]] - - # Padding horizontal: "0" - "9" - px: Var[Responsive[LiteralSpacing]] - - # Padding vertical: "0" - "9" - py: Var[Responsive[LiteralSpacing]] - - # Padding top: "0" - "9" - pt: Var[Responsive[LiteralSpacing]] - - # Padding right: "0" - "9" - pr: Var[Responsive[LiteralSpacing]] - - # Padding bottom: "0" - "9" - pb: Var[Responsive[LiteralSpacing]] - - # Padding left: "0" - "9" - pl: Var[Responsive[LiteralSpacing]] - # Whether the element will take up the smallest possible space: "0" | "1" flex_shrink: Var[Responsive[LiteralBoolNumber]] diff --git a/reflex/components/radix/themes/layout/base.pyi b/reflex/components/radix/themes/layout/base.pyi index 3dc46492f5..440ec882a7 100644 --- a/reflex/components/radix/themes/layout/base.pyi +++ b/reflex/components/radix/themes/layout/base.pyi @@ -10,16 +10,72 @@ from reflex.event import BASE_STATE, EventType from reflex.style import Style from reflex.vars.base import Var -from ..base import CommonMarginProps, RadixThemesComponent +from ..base import CommonMarginProps, CommonPaddingProps, RadixThemesComponent LiteralBoolNumber = Literal["0", "1"] -class LayoutComponent(CommonMarginProps, RadixThemesComponent): +class LayoutComponent(CommonMarginProps, CommonPaddingProps, RadixThemesComponent): @overload @classmethod def create( # type: ignore cls, *children, + flex_shrink: Optional[ + Union[ + Breakpoints[str, Literal["0", "1"]], + Literal["0", "1"], + Var[Union[Breakpoints[str, Literal["0", "1"]], Literal["0", "1"]]], + ] + ] = None, + flex_grow: Optional[ + Union[ + Breakpoints[str, Literal["0", "1"]], + Literal["0", "1"], + Var[Union[Breakpoints[str, Literal["0", "1"]], Literal["0", "1"]]], + ] + ] = None, + m: Optional[ + Union[ + Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], + Var[Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]], + ] + ] = None, + mx: Optional[ + Union[ + Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], + Var[Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]], + ] + ] = None, + my: Optional[ + Union[ + Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], + Var[Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]], + ] + ] = None, + mt: Optional[ + Union[ + Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], + Var[Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]], + ] + ] = None, + mr: Optional[ + Union[ + Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], + Var[Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]], + ] + ] = None, + mb: Optional[ + Union[ + Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], + Var[Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]], + ] + ] = None, + ml: Optional[ + Union[ + Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], + Var[Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]], + ] + ] = None, p: Optional[ Union[ Breakpoints[ @@ -139,62 +195,6 @@ class LayoutComponent(CommonMarginProps, RadixThemesComponent): ], ] ] = None, - flex_shrink: Optional[ - Union[ - Breakpoints[str, Literal["0", "1"]], - Literal["0", "1"], - Var[Union[Breakpoints[str, Literal["0", "1"]], Literal["0", "1"]]], - ] - ] = None, - flex_grow: Optional[ - Union[ - Breakpoints[str, Literal["0", "1"]], - Literal["0", "1"], - Var[Union[Breakpoints[str, Literal["0", "1"]], Literal["0", "1"]]], - ] - ] = None, - m: Optional[ - Union[ - Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], - Var[Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]], - ] - ] = None, - mx: Optional[ - Union[ - Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], - Var[Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]], - ] - ] = None, - my: Optional[ - Union[ - Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], - Var[Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]], - ] - ] = None, - mt: Optional[ - Union[ - Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], - Var[Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]], - ] - ] = None, - mr: Optional[ - Union[ - Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], - Var[Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]], - ] - ] = None, - mb: Optional[ - Union[ - Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], - Var[Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]], - ] - ] = None, - ml: Optional[ - Union[ - Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], - Var[Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]], - ] - ] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, @@ -225,13 +225,6 @@ class LayoutComponent(CommonMarginProps, RadixThemesComponent): Args: *children: Child components. - p: Padding: "0" - "9" - px: Padding horizontal: "0" - "9" - py: Padding vertical: "0" - "9" - pt: Padding top: "0" - "9" - pr: Padding right: "0" - "9" - pb: Padding bottom: "0" - "9" - pl: Padding left: "0" - "9" flex_shrink: Whether the element will take up the smallest possible space: "0" | "1" flex_grow: Whether the element will take up the largest possible space: "0" | "1" m: Margin: "0" - "9" @@ -241,6 +234,13 @@ class LayoutComponent(CommonMarginProps, RadixThemesComponent): mr: Margin right: "0" - "9" mb: Margin bottom: "0" - "9" ml: Margin left: "0" - "9" + p: Padding: "0" - "9" + px: Padding horizontal: "0" - "9" + py: Padding vertical: "0" - "9" + pt: Padding top: "0" - "9" + pr: Padding right: "0" - "9" + pb: Padding bottom: "0" - "9" + pl: Padding left: "0" - "9" style: The style of the component. key: A unique key for the component. id: The id for the component.