Add toast.loading from the sonner package (#4792)
This commit is contained in:
parent
64b1630d02
commit
894a01a5a5
@ -327,6 +327,19 @@ class Toaster(Component):
|
||||
"""
|
||||
return Toaster.send_toast(message, level="success", **kwargs)
|
||||
|
||||
@staticmethod
|
||||
def toast_loading(message: str | Var = "", **kwargs: Any):
|
||||
"""Display a loading toast message.
|
||||
|
||||
Args:
|
||||
message: The message to display.
|
||||
**kwargs: Additional toast props.
|
||||
|
||||
Returns:
|
||||
The toast event.
|
||||
"""
|
||||
return Toaster.send_toast(message, level="loading", **kwargs)
|
||||
|
||||
@staticmethod
|
||||
def toast_dismiss(id: Var | str | None = None):
|
||||
"""Dismiss a toast.
|
||||
@ -378,6 +391,7 @@ class ToastNamespace(ComponentNamespace):
|
||||
warning = staticmethod(Toaster.toast_warning)
|
||||
error = staticmethod(Toaster.toast_error)
|
||||
success = staticmethod(Toaster.toast_success)
|
||||
loading = staticmethod(Toaster.toast_loading)
|
||||
dismiss = staticmethod(Toaster.toast_dismiss)
|
||||
__call__ = staticmethod(Toaster.send_toast)
|
||||
|
||||
|
@ -70,6 +70,8 @@ class Toaster(Component):
|
||||
@staticmethod
|
||||
def toast_success(message: str | Var = "", **kwargs: Any): ...
|
||||
@staticmethod
|
||||
def toast_loading(message: str | Var = "", **kwargs: Any): ...
|
||||
@staticmethod
|
||||
def toast_dismiss(id: Var | str | None = None): ...
|
||||
@overload
|
||||
@classmethod
|
||||
@ -172,6 +174,7 @@ class ToastNamespace(ComponentNamespace):
|
||||
warning = staticmethod(Toaster.toast_warning)
|
||||
error = staticmethod(Toaster.toast_error)
|
||||
success = staticmethod(Toaster.toast_success)
|
||||
loading = staticmethod(Toaster.toast_loading)
|
||||
dismiss = staticmethod(Toaster.toast_dismiss)
|
||||
|
||||
@staticmethod
|
||||
|
Loading…
Reference in New Issue
Block a user