| @use "config" as *; | |
| @use "functions" as *; | |
| @use "mixins/border-radius" as *; | |
| @use "mixins/tokens" as *; | |
| @use "mixins/transition" as *; | |
| $alert-tokens: () !default; | |
| // scss-docs-start alert-tokens | |
| // stylelint-disable-next-line scss/dollar-variable-default | |
| $alert-tokens: defaults( | |
| ( | |
| --alert-gap: var(--spacer-3), | |
| --alert-bg: var(--bg-1), | |
| --alert-padding-x: var(--spacer), | |
| --alert-padding-y: var(--spacer), | |
| --alert-color: inherit, | |
| --alert-border-width: var(--border-width), | |
| --alert-border-color: var(--border-color), | |
| --alert-border-radius: var(--radius-7), | |
| --alert-link-color: inherit, | |
| --alert-transition-property: "opacity", | |
| --alert-transition-duration: .15s, | |
| --alert-transition-timing: linear, | |
| --hr-border-color: var(--theme-border, var(--alert-border-color)), | |
| ), | |
| $alert-tokens | |
| ); | |
| // scss-docs-end alert-tokens | |
| @layer components { | |
| .alert { | |
| @include tokens($alert-tokens); | |
| display: flex; | |
| gap: var(--alert-gap); | |
| align-items: start; | |
| padding: var(--alert-padding-y) var(--alert-padding-x); | |
| color: var(--theme-fg, var(--alert-color)); | |
| background-color: var(--theme-bg-subtle, var(--alert-bg)); | |
| border: var(--alert-border-width) solid var(--theme-border, var(--alert-border-color)); | |
| @include border-radius(var(--alert-border-radius)); | |
| // scss-docs-start alert-transition | |
| // An alert is visible in the markup, so only the exit animates. The JS adds | |
| // .hiding for the length of it, then removes the element. Add | |
| // .alert-instant to remove the alert at once instead. | |
| &:not(.alert-instant) { | |
| @include transition-props( | |
| var(--alert-transition-property), | |
| var(--alert-transition-duration), | |
| var(--alert-transition-timing) | |
| ); | |
| } | |
| &.hiding { | |
| opacity: 0; | |
| } | |
| // scss-docs-end alert-transition | |
| } | |
| .alert > p { | |
| margin-bottom: 0; | |
| } | |
| .alert .btn-close { | |
| color: inherit; | |
| } | |
| .alert-heading { | |
| // Specified to prevent conflicts of changing --heading-color | |
| color: inherit; | |
| } | |
| // Provide class for links that match alerts | |
| .alert-link { | |
| font-weight: var(--font-weight-semibold); | |
| color: var(--alert-link-color); | |
| } | |
| } |