UNPKG

@zenithui/toast

Version:

A modern, lightweight toast notification system for React applications. ZenithUI Toast provides a simple and customizable way to display notifications, alerts, and messages to users with smooth animations and flexible styling options.

281 lines (237 loc) 5.3 kB
.zenithui-toast-wrapper { width: 350px; max-width: 350px; color: var(--text-color); background-color: var(--bg-color); box-shadow: 0px 4px 6px var(--box-shadow); border-radius: 8px; justify-content: space-between; align-items: center; gap: 8px; padding: 16px 20px; font-size: 14px; font-weight: 400; display: flex; position: relative; } [data-animation="enter-with-icon"] { width: max-content; } .zenithui-toast { justify-content: space-between; align-items: center; gap: 8px; width: max-content; display: flex; } [data-icon="loading"], [data-icon="promise"] { width: 16px; height: 16px; position: relative; } [data-wrapper-zenithui] { align-items: center; gap: 12px; width: 100%; display: flex; } [data-expand="true"] { opacity: 0; width: 0; height: 0; animation-name: zenithui-expand-content; animation-duration: .8s; animation-timing-function: ease-in-out; animation-delay: .2s; animation-fill-mode: forwards; } .zenithui-toast-close { background-color: var(--close-btn-bg); color: var(--bg-color); cursor: pointer; border: none; border-radius: 100%; padding: 4px; transition: transform .2s ease-in-out; position: absolute; top: 4px; right: 4px; transform: translate(50%, -50%); } .zenithui-toast-close:hover { background-color: var(--close-btn-hover); } .zenithui-toast-close:active { border: 0; outline: 2px solid #020617; } .zenithui-toast-close:focus, .zenithui-toast-close:focus-visible { outline: 2px solid var(--close-btn-hover); border: 0; } .zenithui-toast-close-rich:hover { background-color: var(--close-rich); } .zenithui-toast-close-rich:active, .zenithui-toast-close-rich:focus, .zenithui-toast-close-rich:focus-visible { outline: 2px solid var(--close-rich); border: 0; } .zenithui-toast-success { color: var(--success-text); border: 1px solid var(--success-border); background-color: var(--success-bg); box-shadow: 1px 1px 2px var(--success-shadow); } .zenithui-toast-error { color: var(--error-text); border: 1px solid var(--error-border); background-color: var(--error-bg); box-shadow: 1px 1px 2px var(--error-shadow); } .zenithui-toast-info { color: var(--info-text); border: 1px solid var(--info-border); background-color: var(--info-bg); box-shadow: 1px 1px 2px var(--info-shadow); } .zenithui-toast-warning { color: var(--warning-text); border: 1px solid var(--warning-border); background-color: var(--warning-bg); box-shadow: 1px 1px 2px var(--warning-shadow); } .zenithui-fade-in-top { animation-name: zenithui-fade-in-top; animation-duration: .2s; animation-timing-function: ease-in-out; animation-fill-mode: forwards; } .zenithui-fade-out-top { animation-name: zenithui-fade-out-top; animation-duration: .2s; animation-timing-function: ease-in-out; animation-fill-mode: forwards; } .zenithui-fade-in-bottom { animation-name: zenithui-fade-in-bottom; animation-duration: .2s; animation-timing-function: ease-in-out; animation-fill-mode: forwards; } .zenithui-fade-out-bottom { animation-name: zenithui-fade-out-bottom; animation-duration: .2s; animation-timing-function: ease-in-out; animation-fill-mode: forwards; } @keyframes zenithui-fade-in-top { from { opacity: "0"; transform: translateY(-20px); } to { opacity: "1"; transform: translateY(0); } } @keyframes zenithui-fade-out-top { from { opacity: "1"; transform: translateY(0); } to { opacity: "0"; transform: translateY(-20px); } } @keyframes zenithui-fade-in-bottom { from { opacity: "0"; transform: translateY(20px); } to { opacity: "1"; transform: translateY(0); } } @keyframes zenithui-fade-out-bottom { from { opacity: "1"; transform: translateY(0); } to { opacity: "0"; transform: translateY(20px); } } .zenithui-slide-in-left { animation-name: zenithui-slide-in-left; animation-duration: .3s; animation-timing-function: ease-in-out; animation-fill-mode: forwards; } .zenithui-slide-out-left { animation-name: zenithui-slide-out-left; animation-duration: .3s; animation-timing-function: ease-in-out; animation-fill-mode: forwards; } .zenithui-slide-in-right { animation-name: zenithui-slide-in-right; animation-duration: .3s; animation-timing-function: ease-in-out; animation-fill-mode: forwards; } .zenithui-slide-out-right { animation-name: zenithui-slide-out-right; animation-duration: .3s; animation-timing-function: ease-in-out; animation-fill-mode: forwards; } @keyframes zenithui-slide-in-left { from { transform: translateX(-150px); } to { transform: translateX(0); } } @keyframes zenithui-slide-out-left { from { transform: translateX(0); } to { transform: translateX(150px); } } @keyframes zenithui-slide-in-right { from { transform: translateX(150px); } to { transform: translateX(0); } } @keyframes zenithui-slide-out-right { from { transform: translateX(0); } to { transform: translateX(-150px); } } @keyframes zenithui-expand-content { 0% { opacity: 0; width: 0; height: 0; } 90% { opacity: 0; } 100% { opacity: 1; width: 300px; height: auto; } }