diff --git a/_dev/css/theme/components/_index.scss b/_dev/css/theme/components/_index.scss index 6edda917..6e2875a1 100644 --- a/_dev/css/theme/components/_index.scss +++ b/_dev/css/theme/components/_index.scss @@ -8,4 +8,3 @@ @import "search/index"; @import "page-loader/index"; @import "links-list/index"; -@import "alert-toast/index"; diff --git a/_dev/css/theme/components/alert-toast/_alert-toast-stack.scss b/_dev/css/theme/components/alert-toast/_alert-toast-stack.scss deleted file mode 100644 index 7fedf949..00000000 --- a/_dev/css/theme/components/alert-toast/_alert-toast-stack.scss +++ /dev/null @@ -1,11 +0,0 @@ -@use 'sass:map'; - - -.alert-toast-stack { - position: fixed; - right: map.get($spacers, 3); - top: map.get($spacers, 3); - width: rem-calc(250px); - display: block; - z-index: 101; -} diff --git a/_dev/css/theme/components/alert-toast/_alert-toast.scss b/_dev/css/theme/components/alert-toast/_alert-toast.scss deleted file mode 100644 index 5dab5b24..00000000 --- a/_dev/css/theme/components/alert-toast/_alert-toast.scss +++ /dev/null @@ -1,43 +0,0 @@ -@use "sass:map"; - -.alert-toast { - $self: &; - - @include font-size($font-size-sm); - margin-bottom: map.get($spacers, 3); - opacity: 0; - transform: translateX(100%); - box-shadow: $box-shadow; - border-radius: $border-radius; - transition: 0.4s ease-in-out; - - &__content { - padding: map.get($spacers, 2) map.get($spacers, 3); - } - - &.show { - opacity: 1; - transform: translateX(0); - } - - &--info { - color: color-yiq($primary); - background: $primary; - } - - &--danger { - color: color-yiq($danger); - background: $danger; - } - - &--warning { - color: color-yiq($warning); - background: $warning; - } - - &--success { - color: color-yiq($success); - background: $success; - } -} - diff --git a/_dev/css/theme/components/alert-toast/_index.scss b/_dev/css/theme/components/alert-toast/_index.scss deleted file mode 100644 index a39e6fdb..00000000 --- a/_dev/css/theme/components/alert-toast/_index.scss +++ /dev/null @@ -1,2 +0,0 @@ -@import "alert-toast-stack"; -@import "alert-toast"; diff --git a/_dev/css/theme/override/bootstrap/_toast.scss b/_dev/css/theme/override/bootstrap/_toast.scss new file mode 100644 index 00000000..e8be1d4b --- /dev/null +++ b/_dev/css/theme/override/bootstrap/_toast.scss @@ -0,0 +1,4 @@ + +.toast-container { + width: rem-calc(250px); +} diff --git a/_dev/js/theme/components/useAlertToast.js b/_dev/js/theme/components/useAlertToast.js index b1cced31..a4bfe22c 100644 --- a/_dev/js/theme/components/useAlertToast.js +++ b/_dev/js/theme/components/useAlertToast.js @@ -1,4 +1,5 @@ import { parseToHtml } from '../../utils/DOM/DOMHelpers'; +import { one } from '../../utils/event/eventHandler'; let id = 0; @@ -29,14 +30,18 @@ const useAlertToast = (params = {}) => { /** * Builds the template for an individual toast. * @param {string} text - The text content of the toast. - * @param {string} type - The type of toast ('info', 'success', 'danger', 'warning'). + * @param {string|null} type - The type of toast ('info', 'success', 'danger', 'warning'). * @param {string} toastId - The unique ID for the toast element. * @returns {HTMLElement} - The constructed toast element. */ const buildToastTemplate = (text, type, toastId) => parseToHtml(` -