Skip to content

Commit

Permalink
add toast component (#3186)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lendemor committed May 3, 2024
1 parent 7903a10 commit 1817c30
Show file tree
Hide file tree
Showing 17 changed files with 600 additions and 18 deletions.
1 change: 1 addition & 0 deletions reflex/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@
"ordered_list",
"moment",
"logo",
"toast",
]

_MAPPING = {
Expand Down
1 change: 1 addition & 0 deletions reflex/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ from reflex.components import unordered_list as unordered_list
from reflex.components import ordered_list as ordered_list
from reflex.components import moment as moment
from reflex.components import logo as logo
from reflex.components import toast as toast
from reflex.components.component import Component as Component
from reflex.components.component import NoSSRComponent as NoSSRComponent
from reflex.components.component import memo as memo
Expand Down
1 change: 1 addition & 0 deletions reflex/components/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from .plotly import *
from .radix import *
from .react_player import *
from .sonner import *
from .suneditor import *

icon = lucide.icon
4 changes: 1 addition & 3 deletions reflex/components/chakra/datadisplay/list.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ class List(ChakraComponent):
style_type: Var[str]

@classmethod
def create(
cls, *children, items: list | Var[list] | None = None, **props
) -> Component:
def create(cls, *children, items: Var[list] | None = None, **props) -> Component:
"""Create a list component.
Args:
Expand Down
6 changes: 3 additions & 3 deletions reflex/components/chakra/datadisplay/list.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class List(ChakraComponent):
def create( # type: ignore
cls,
*children,
items: Optional[list | Var[list] | None] = None,
items: Optional[Union[Var[list], list]] = None,
spacing: Optional[Union[Var[str], str]] = None,
style_position: Optional[Union[Var[str], str]] = None,
style_type: Optional[Union[Var[str], str]] = None,
Expand Down Expand Up @@ -178,7 +178,7 @@ class OrderedList(List):
def create( # type: ignore
cls,
*children,
items: Optional[list | Var[list] | None] = None,
items: Optional[Union[Var[list], list]] = None,
spacing: Optional[Union[Var[str], str]] = None,
style_position: Optional[Union[Var[str], str]] = None,
style_type: Optional[Union[Var[str], str]] = None,
Expand Down Expand Up @@ -262,7 +262,7 @@ class UnorderedList(List):
def create( # type: ignore
cls,
*children,
items: Optional[list | Var[list] | None] = None,
items: Optional[Union[Var[list], list]] = None,
spacing: Optional[Union[Var[str], str]] = None,
style_position: Optional[Union[Var[str], str]] = None,
style_type: Optional[Union[Var[str], str]] = None,
Expand Down
2 changes: 1 addition & 1 deletion reflex/components/chakra/forms/pininput.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ class PinInputField(ChakraComponent):
def create( # type: ignore
cls,
*children,
index: Optional[Var[int]] = None,
index: Optional[Union[Var[int], int]] = None,
name: Optional[Union[Var[str], str]] = None,
style: Optional[Style] = None,
key: Optional[Any] = None,
Expand Down
4 changes: 2 additions & 2 deletions reflex/components/radix/primitives/accordion.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,10 +314,10 @@ class AccordionRoot(AccordionComponent):
type: Var[LiteralAccordionType]

# The value of the item to expand.
value: Var[Optional[Union[str, List[str]]]]
value: Var[Union[str, List[str]]]

# The default value of the item to expand.
default_value: Var[Optional[Union[str, List[str]]]]
default_value: Var[Union[str, List[str]]]

# Whether or not the accordion is collapsible.
collapsible: Var[bool]
Expand Down
4 changes: 2 additions & 2 deletions reflex/components/radix/primitives/accordion.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -303,8 +303,8 @@ class AccordionItem(AccordionComponent):
def create( # type: ignore
cls,
*children,
header: Optional[Component | Var] = None,
content: Optional[Component | Var] = None,
header: Optional[Union[Component, Var]] = None,
content: Optional[Union[Component, Var]] = None,
value: Optional[Union[Var[str], str]] = None,
disabled: Optional[Union[Var[bool], bool]] = None,
as_child: Optional[Union[Var[bool], bool]] = None,
Expand Down
2 changes: 1 addition & 1 deletion reflex/components/radix/themes/base.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ class Theme(RadixThemesComponent):
def create( # type: ignore
cls,
*children,
color_mode: Optional[LiteralAppearance | None] = None,
color_mode: Optional[Literal["inherit", "light", "dark"]] = None,
theme_panel: Optional[bool] = False,
has_background: Optional[Union[Var[bool], bool]] = None,
appearance: Optional[
Expand Down
4 changes: 3 additions & 1 deletion reflex/components/radix/themes/color_mode.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,9 @@ class ColorModeIconButton(IconButton):
def create( # type: ignore
cls,
*children,
position: Optional[LiteralPosition | None] = None,
position: Optional[
Literal["top-left", "top-right", "bottom-left", "bottom-right"]
] = None,
as_child: Optional[Union[Var[bool], bool]] = None,
size: Optional[
Union[Var[Literal["1", "2", "3", "4"]], Literal["1", "2", "3", "4"]]
Expand Down
4 changes: 2 additions & 2 deletions reflex/components/radix/themes/layout/list.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class BaseList(Component):
def create(
cls,
*children,
items: Optional[Union[Var[Iterable], Iterable]] = None,
items: Optional[Var[Iterable]] = None,
**props,
):
"""Create a list component.
Expand All @@ -68,7 +68,7 @@ def create(
if isinstance(items, Var):
children = [Foreach.create(items, ListItem.create)]
else:
children = [ListItem.create(item) for item in items]
children = [ListItem.create(item) for item in items] # type: ignore
props["list_style_position"] = "outside"
props["direction"] = "column"
style = props.setdefault("style", {})
Expand Down
4 changes: 2 additions & 2 deletions reflex/components/radix/themes/layout/list.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class BaseList(Component):
def create( # type: ignore
cls,
*children,
items: Optional[Union[Union[Var[Iterable], Iterable], Iterable]] = None,
items: Optional[Union[Var[Iterable], Iterable]] = None,
list_style_type: Optional[
Union[
Var[
Expand Down Expand Up @@ -600,7 +600,7 @@ class List(ComponentNamespace):
@staticmethod
def __call__(
*children,
items: Optional[Union[Union[Var[Iterable], Iterable], Iterable]] = None,
items: Optional[Union[Var[Iterable], Iterable]] = None,
list_style_type: Optional[
Union[
Var[
Expand Down
3 changes: 3 additions & 0 deletions reflex/components/sonner/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
"""Init file for the sonner component."""

from .toast import toast
Loading

0 comments on commit 1817c30

Please sign in to comment.