[GTM-648]Add Missing Table props (#4322)

* Add Missing Table props

* add more props
This commit is contained in:
Elijah Ahianyo 2024-11-08 00:04:03 +00:00 committed by GitHub
parent 227d09a02c
commit 855a20fd1c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 566 additions and 94 deletions

View File

@ -5,6 +5,7 @@ from __future__ import annotations
from typing import Any, Dict, Literal from typing import Any, Dict, Literal
from reflex.components import Component from reflex.components import Component
from reflex.components.core.breakpoints import Responsive
from reflex.components.tags import Tag from reflex.components.tags import Tag
from reflex.config import get_config from reflex.config import get_config
from reflex.utils.imports import ImportDict, ImportVar from reflex.utils.imports import ImportDict, ImportVar
@ -74,6 +75,31 @@ class CommonMarginProps(Component):
ml: Var[LiteralSpacing] 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): class RadixLoadingProp(Component):
"""Base class for components that can be in a loading state.""" """Base class for components that can be in a loading state."""

View File

@ -6,6 +6,7 @@
from typing import Any, Dict, Literal, Optional, Union, overload from typing import Any, Dict, Literal, Optional, Union, overload
from reflex.components import Component from reflex.components import Component
from reflex.components.core.breakpoints import Breakpoints
from reflex.event import BASE_STATE, EventType from reflex.event import BASE_STATE, EventType
from reflex.style import Style from reflex.style import Style
from reflex.utils.imports import ImportDict 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): class RadixLoadingProp(Component):
@overload @overload
@classmethod @classmethod

View File

@ -7,7 +7,7 @@ from reflex.components.core.breakpoints import Responsive
from reflex.components.el import elements from reflex.components.el import elements
from reflex.vars.base import Var from reflex.vars.base import Var
from ..base import RadixThemesComponent from ..base import CommonPaddingProps, RadixThemesComponent
class TableRoot(elements.Table, RadixThemesComponent): class TableRoot(elements.Table, RadixThemesComponent):
@ -51,6 +51,12 @@ class TableColumnHeaderCell(elements.Th, RadixThemesComponent):
# The justification of the column # The justification of the column
justify: Var[Literal["start", "center", "end"]] 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] = [ _invalid_children: List[str] = [
"TableBody", "TableBody",
"TableHeader", "TableHeader",
@ -76,7 +82,7 @@ class TableBody(elements.Tbody, RadixThemesComponent):
_valid_parents: List[str] = ["TableRoot"] _valid_parents: List[str] = ["TableRoot"]
class TableCell(elements.Td, RadixThemesComponent): class TableCell(elements.Td, CommonPaddingProps, RadixThemesComponent):
"""A cell containing data.""" """A cell containing data."""
tag = "Table.Cell" tag = "Table.Cell"
@ -84,6 +90,12 @@ class TableCell(elements.Td, RadixThemesComponent):
# The justification of the column # The justification of the column
justify: Var[Literal["start", "center", "end"]] 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] = [ _invalid_children: List[str] = [
"TableBody", "TableBody",
"TableHeader", "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.""" """A table cell that is semantically treated as a row header."""
tag = "Table.RowHeaderCell" tag = "Table.RowHeaderCell"
@ -101,6 +113,12 @@ class TableRowHeaderCell(elements.Th, RadixThemesComponent):
# The justification of the column # The justification of the column
justify: Var[Literal["start", "center", "end"]] 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] = [ _invalid_children: List[str] = [
"TableBody", "TableBody",
"TableHeader", "TableHeader",

View File

@ -12,7 +12,7 @@ from reflex.event import BASE_STATE, EventType
from reflex.style import Style from reflex.style import Style
from reflex.vars.base import Var from reflex.vars.base import Var
from ..base import RadixThemesComponent from ..base import CommonPaddingProps, RadixThemesComponent
class TableRoot(elements.Table, RadixThemesComponent): class TableRoot(elements.Table, RadixThemesComponent):
@overload @overload
@ -322,6 +322,12 @@ class TableColumnHeaderCell(elements.Th, RadixThemesComponent):
Var[Literal["center", "end", "start"]], Var[Literal["center", "end", "start"]],
] ]
] = None, ] = 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, 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, 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, headers: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None,
@ -382,6 +388,8 @@ class TableColumnHeaderCell(elements.Th, RadixThemesComponent):
Args: Args:
*children: Child components. *children: Child components.
justify: The justification of the column 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 align: Alignment of the content within the table header cell
col_span: Number of columns a header cell should span col_span: Number of columns a header cell should span
headers: IDs of the headers associated with this header cell 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 @overload
@classmethod @classmethod
def create( # type: ignore def create( # type: ignore
@ -519,6 +527,12 @@ class TableCell(elements.Td, RadixThemesComponent):
Var[Literal["center", "end", "start"]], Var[Literal["center", "end", "start"]],
] ]
] = None, ] = 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, 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, 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, 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, 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, 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, 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, style: Optional[Style] = None,
key: Optional[Any] = None, key: Optional[Any] = None,
id: Optional[Any] = None, id: Optional[Any] = None,
@ -578,6 +711,8 @@ class TableCell(elements.Td, RadixThemesComponent):
Args: Args:
*children: Child components. *children: Child components.
justify: The justification of the column 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 align: Alignment of the content within the table cell
col_span: Number of columns a cell should span col_span: Number of columns a cell should span
headers: IDs of the headers associated with this cell 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. 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. tab_index: Defines the position of the current element in the tabbing order.
title: Defines a tooltip for the element. 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. style: The style of the component.
key: A unique key for the component. key: A unique key for the component.
id: The id 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 @overload
@classmethod @classmethod
def create( # type: ignore def create( # type: ignore
@ -623,6 +765,12 @@ class TableRowHeaderCell(elements.Th, RadixThemesComponent):
Var[Literal["center", "end", "start"]], Var[Literal["center", "end", "start"]],
] ]
] = None, ] = 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, 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, 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, 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, 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, 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, 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, style: Optional[Style] = None,
key: Optional[Any] = None, key: Optional[Any] = None,
id: Optional[Any] = None, id: Optional[Any] = None,
@ -683,6 +950,8 @@ class TableRowHeaderCell(elements.Th, RadixThemesComponent):
Args: Args:
*children: Child components. *children: Child components.
justify: The justification of the column 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 align: Alignment of the content within the table header cell
col_span: Number of columns a header cell should span col_span: Number of columns a header cell should span
headers: IDs of the headers associated with this header cell 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. 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. tab_index: Defines the position of the current element in the tabbing order.
title: Defines a tooltip for the element. 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. style: The style of the component.
key: A unique key for the component. key: A unique key for the component.
id: The id for the component. id: The id for the component.

View File

@ -7,38 +7,17 @@ from typing import Literal
from reflex.components.core.breakpoints import Responsive from reflex.components.core.breakpoints import Responsive
from reflex.vars.base import Var from reflex.vars.base import Var
from ..base import CommonMarginProps, LiteralSpacing, RadixThemesComponent from ..base import CommonMarginProps, CommonPaddingProps, RadixThemesComponent
LiteralBoolNumber = Literal["0", "1"] 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 """Box, Flex and Grid are foundational elements you'll use to construct
layouts. Box provides block-level spacing and sizing, while Flex and Grid layouts. Box provides block-level spacing and sizing, while Flex and Grid
let you create flexible columns, rows and grids. 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" # Whether the element will take up the smallest possible space: "0" | "1"
flex_shrink: Var[Responsive[LiteralBoolNumber]] flex_shrink: Var[Responsive[LiteralBoolNumber]]

View File

@ -10,16 +10,72 @@ from reflex.event import BASE_STATE, EventType
from reflex.style import Style from reflex.style import Style
from reflex.vars.base import Var from reflex.vars.base import Var
from ..base import CommonMarginProps, RadixThemesComponent from ..base import CommonMarginProps, CommonPaddingProps, RadixThemesComponent
LiteralBoolNumber = Literal["0", "1"] LiteralBoolNumber = Literal["0", "1"]
class LayoutComponent(CommonMarginProps, RadixThemesComponent): class LayoutComponent(CommonMarginProps, CommonPaddingProps, RadixThemesComponent):
@overload @overload
@classmethod @classmethod
def create( # type: ignore def create( # type: ignore
cls, cls,
*children, *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[ p: Optional[
Union[ Union[
Breakpoints[ Breakpoints[
@ -139,62 +195,6 @@ class LayoutComponent(CommonMarginProps, RadixThemesComponent):
], ],
] ]
] = None, ] = 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, style: Optional[Style] = None,
key: Optional[Any] = None, key: Optional[Any] = None,
id: Optional[Any] = None, id: Optional[Any] = None,
@ -225,13 +225,6 @@ class LayoutComponent(CommonMarginProps, RadixThemesComponent):
Args: Args:
*children: Child components. *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_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" flex_grow: Whether the element will take up the largest possible space: "0" | "1"
m: Margin: "0" - "9" m: Margin: "0" - "9"
@ -241,6 +234,13 @@ class LayoutComponent(CommonMarginProps, RadixThemesComponent):
mr: Margin right: "0" - "9" mr: Margin right: "0" - "9"
mb: Margin bottom: "0" - "9" mb: Margin bottom: "0" - "9"
ml: Margin left: "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. style: The style of the component.
key: A unique key for the component. key: A unique key for the component.
id: The id for the component. id: The id for the component.