Allow passing kwarg for toasts (#3857)
This commit is contained in:
parent
629850162a
commit
99a0236d21
@ -76,6 +76,9 @@ def _toast_callback_signature(toast: Var) -> list[Var]:
|
|||||||
class ToastProps(PropsBase):
|
class ToastProps(PropsBase):
|
||||||
"""Props for the toast component."""
|
"""Props for the toast component."""
|
||||||
|
|
||||||
|
# Toast's title, renders above the description.
|
||||||
|
title: Optional[Union[str, Var]]
|
||||||
|
|
||||||
# Toast's description, renders underneath the title.
|
# Toast's description, renders underneath the title.
|
||||||
description: Optional[Union[str, Var]]
|
description: Optional[Union[str, Var]]
|
||||||
|
|
||||||
@ -290,7 +293,7 @@ class Toaster(Component):
|
|||||||
return call_script(toast_action)
|
return call_script(toast_action)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def toast_info(message: str, **kwargs):
|
def toast_info(message: str = "", **kwargs):
|
||||||
"""Display an info toast message.
|
"""Display an info toast message.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
@ -303,7 +306,7 @@ class Toaster(Component):
|
|||||||
return Toaster.send_toast(message, level="info", **kwargs)
|
return Toaster.send_toast(message, level="info", **kwargs)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def toast_warning(message: str, **kwargs):
|
def toast_warning(message: str = "", **kwargs):
|
||||||
"""Display a warning toast message.
|
"""Display a warning toast message.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
@ -316,7 +319,7 @@ class Toaster(Component):
|
|||||||
return Toaster.send_toast(message, level="warning", **kwargs)
|
return Toaster.send_toast(message, level="warning", **kwargs)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def toast_error(message: str, **kwargs):
|
def toast_error(message: str = "", **kwargs):
|
||||||
"""Display an error toast message.
|
"""Display an error toast message.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
@ -329,7 +332,7 @@ class Toaster(Component):
|
|||||||
return Toaster.send_toast(message, level="error", **kwargs)
|
return Toaster.send_toast(message, level="error", **kwargs)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def toast_success(message: str, **kwargs):
|
def toast_success(message: str = "", **kwargs):
|
||||||
"""Display a success toast message.
|
"""Display a success toast message.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
|
@ -32,6 +32,7 @@ class ToastAction(Base):
|
|||||||
def serialize_action(action: ToastAction) -> dict: ...
|
def serialize_action(action: ToastAction) -> dict: ...
|
||||||
|
|
||||||
class ToastProps(PropsBase):
|
class ToastProps(PropsBase):
|
||||||
|
title: Optional[Union[str, Var]]
|
||||||
description: Optional[Union[str, Var]]
|
description: Optional[Union[str, Var]]
|
||||||
close_button: Optional[bool]
|
close_button: Optional[bool]
|
||||||
invert: Optional[bool]
|
invert: Optional[bool]
|
||||||
@ -65,13 +66,13 @@ class Toaster(Component):
|
|||||||
message: str = "", level: str | None = None, **props
|
message: str = "", level: str | None = None, **props
|
||||||
) -> EventSpec: ...
|
) -> EventSpec: ...
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def toast_info(message: str, **kwargs): ...
|
def toast_info(message: str = "", **kwargs): ...
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def toast_warning(message: str, **kwargs): ...
|
def toast_warning(message: str = "", **kwargs): ...
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def toast_error(message: str, **kwargs): ...
|
def toast_error(message: str = "", **kwargs): ...
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def toast_success(message: str, **kwargs): ...
|
def toast_success(message: str = "", **kwargs): ...
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def toast_dismiss(id: Var | str | None = None): ...
|
def toast_dismiss(id: Var | str | None = None): ...
|
||||||
@overload
|
@overload
|
||||||
|
Loading…
Reference in New Issue
Block a user