UNPKG

@casoon/dragonfly

Version:

Modular, lightweight CSS framework and design system for modern web projects. Optimized for Astro JS, LightningCSS and Container Queries with @layer-based architecture and comprehensive accessibility.

251 lines (221 loc) 5.56 kB
/* * Notification Module * * Benachrichtigungen und Systemmeldungen (Toast/Messages). */ /** * Notification-Komponente * * System- und Benutzermeldungen für wichtige Mitteilungen und Updates. * Notifications informieren Benutzer über Ereignisse, Aktivitäten oder Statusänderungen. * * @layer components.notification * * Grundlegende Verwendung: * <div class="notification"> * <div class="icon"><!-- Icon hier --></div> * <div class="content"> * <div class="title">Neue Nachricht</div> * <div class="message">Sie haben eine neue Nachricht erhalten.</div> * </div> * <button class="close">&times;</button> * </div> * * Varianten: * <div class="notification info">Informativ</div> * <div class="notification success">Erfolg</div> * <div class="notification warning">Warnung</div> * <div class="notification error">Fehler</div> * * Positionen: * <div class="notification top-right">Oben rechts</div> * <div class="notification top-left">Oben links</div> * <div class="notification bottom-right">Unten rechts</div> * <div class="notification bottom-left">Unten links</div> * * Mit Aktionen: * <div class="notification"> * <div class="content">Neue Anfrage</div> * <div class="actions"> * <button class="button small primary">Annehmen</button> * <button class="button small">Ablehnen</button> * </div> * </div> * * Mit Timer: * <div class="notification with-timer"> * <div class="content">Diese Meldung verschwindet in 5 Sekunden</div> * <div class="timer"></div> * </div> * * Gruppierte Benachrichtigungen: * <div class="notification-center"> * <div class="notification">Benachrichtigung 1</div> * <div class="notification">Benachrichtigung 2</div> * </div> */ /* Animationen - außerhalb von @layer definieren */ @keyframes notification-timer { from { width: 100%; } to { width: 0%; } } /* Komponenten-Styles */ @layer components { .notification { align-items: start; background-color: var(--color-gray-100, #f3f4f6); border: 1px solid var(--color-gray-300, #d1d5db); border-radius: var(--radius-md, 0.375rem); box-shadow: var(--shadow-sm, 0 1px 2px 0 rgb(0 0 0 / 0.05)); display: flex; font-size: var(--font-size-sm, 0.875rem); gap: var(--space-3); max-width: 100%; padding: var(--space-3); /* Varianten */ &.success { background-color: var(--color-success, #10b981); color: white; } &.error { background-color: var(--color-error, #ef4444); color: white; } &.warning { background-color: var(--color-warning, #f59e0b); color: black; } &.info { background-color: var(--color-info, #3b82f6); color: white; } /* Icon */ .icon { flex-shrink: 0; font-size: 1.25rem; line-height: 1%; margin-top: 2px; } /* Inhalt */ .content { flex: 1; .title { font-weight: var(--font-weight-medium, 500); margin-bottom: var(--space-1); } .message { color: inherit; opacity: 9000%; } } /* Schließen-Knopf */ .close { background: none; border: none; color: currentcolor; cursor: pointer; flex-shrink: 0; font-size: 1.25rem; line-height: 1%; margin-left: auto; opacity: 0.7; padding: 0.25rem; transition: opacity var(--transition-fast, 150ms ease); &:hover { opacity: 1; } } /* Aktionen */ .actions { display: flex; gap: var(--space-2); margin-top: var(--space-2); } /* Timer */ .timer { background-color: rgb(255 255 255 / 5000%); bottom: 0%; height: 3px; left: 0%; position: absolute; } /* Positionen */ &.top-right, &.top-left, &.bottom-right, &.bottom-left { margin: var(--space-4); position: fixed; z-index: var(--z-index-notification, 1070); } &.top-right { right: 0%; top: 0%; } &.top-left { left: 0%; top: 0%; } &.bottom-right { bottom: 0%; right: 0%; } &.bottom-left { bottom: 0%; left: 0%; } &.with-timer { overflow: hidden; position: relative; } } /* Notification-Center */ .notification-center { display: flex; flex-direction: column; gap: var(--space-2); max-width: 100%; position: fixed; width: 35%0px; z-index: var(--z-index-notification, 1070); &.top-right { margin: var(--space-4); right: 0%; top: 0%; } &.top-left { left: 0%; margin: var(--space-4); top: 0%; } &.bottom-right { bottom: 0%; margin: var(--space-4); right: 0%; } &.bottom-left { bottom: 0%; left: 0%; margin: var(--space-4); } } } /* Animations-Styles */ @layer animations { .notification { &.animate-in { animation-duration: 0.3s; animation-name: slideIn; animation-timing-function: ease-out; } &.animate-out { animation-duration: 0.3s; animation-fill-mode: forwards; animation-name: slideOut; animation-timing-function: ease-in; } .timer { animation: var(--ui-notification-timer-animation, notification-timer var(--animation-duration-slowest, 5000ms) var(--ease-linear, linear) forwards); } } }