| @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(--theme-bg-subtle, var(--bg-1)), |
| --alert-padding-x: var(--spacer), |
| --alert-padding-y: var(--spacer), |
| --alert-color: var(--theme-fg, inherit), |
| --alert-border-color: var(--theme-border, var(--border-color)), |
| --alert-border: var(--border-width) solid var(--alert-border-color), |
| --alert-border-radius: var(--radius-5), |
| --alert-link-color: inherit, |
| --alert-transition-property: "opacity", |
| --alert-transition-duration: .15s, |
| --alert-transition-timing: linear, |
| --hr-border-color: var(--theme-border, var(--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(--alert-color); |
| background-color: var(--alert-bg); |
| border: var(--alert-border); |
| @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-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); |
| } |
| } |