1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173
|
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
:host {
/* Icon */
--message-bar-icon-color: var(--icon-color-information);
--message-bar-icon-size: var(--size-item-small);
--message-bar-icon-close-url: url("chrome://global/skin/icons/close.svg");
/* Container */
--message-bar-container-min-height: var(--size-item-large);
/* Border */
--message-bar-border-color: color-mix(in srgb, currentColor 9%, transparent);
--message-bar-border-radius: var(--border-radius-small);
--message-bar-border-width: var(--border-width);
/* Text */
--message-bar-text-color: var(--text-color);
--message-bar-text-line-height: 1.5em;
/* Background */
--message-bar-background-color: var(--background-color-information);
background-color: var(--message-bar-background-color);
border: var(--message-bar-border-width) solid var(--message-bar-border-color);
border-radius: var(--message-bar-border-radius);
color: var(--message-bar-text-color);
text-align: start;
}
@media (prefers-contrast) {
:host {
--message-bar-border-color: var(--border-color);
}
}
/* Make the host to behave as a block by default, but allow hidden to hide it. */
:host(:not([hidden])) {
display: block;
}
/* MozMessageBar layout */
.container {
display: flex;
gap: 8px;
min-height: var(--message-bar-container-min-height);
padding-inline: 16px 8px;
padding-block: 8px;
}
.content {
display: flex;
flex-grow: 1;
flex-wrap: wrap;
align-items: center;
gap: 8px 12px;
margin-inline-start: 24px;
}
.text-container {
display: flex;
gap: 4px 8px;
padding-block: calc((var(--message-bar-container-min-height) - var(--message-bar-text-line-height)) / 2);
}
.text-content {
display: inline-flex;
gap: 4px 8px;
flex-wrap: wrap;
word-break: break-word;
line-height: var(--message-bar-text-line-height);
}
/* MozMessageBar icon style */
.icon-container {
height: var(--message-bar-text-line-height);
display: flex;
justify-content: center;
align-items: center;
margin-inline-start: -24px;
}
.icon {
width: var(--message-bar-icon-size);
height: var(--message-bar-icon-size);
flex-shrink: 0;
appearance: none;
-moz-context-properties: fill, stroke;
fill: currentColor;
stroke: currentColor;
color: var(--message-bar-icon-color);
}
/* MozMessageBar heading style */
.heading {
font-weight: 600;
}
/* MozMessageBar message style */
.message {
margin-inline-end: 4px;
}
/* MozMessageBar link style */
.link {
display: inline-block;
}
.link ::slotted(a) {
margin-inline-end: 4px;
}
/* MozMessageBar actions style */
.actions {
display: none;
}
.actions.active {
display: inline-flex;
gap: 8px;
}
.actions ::slotted(button) {
/* Enforce micro-button width. */
min-width: fit-content !important;
margin: 0 !important;
padding: 4px 16px !important;
}
/* Close icon styles */
moz-button::part(button) {
background-image: var(--message-bar-icon-close-url);
}
@media not (prefers-contrast) {
/* MozMessageBar colors by message type */
/* Colors from: https://www.figma.com/file/zd3B9UyknB2XNZNdrYLm2W/Outreachy?type=design&node-id=59-1921&mode=design&t=ZYS4e6pAbAlXGvun-4 */
:host([type=warning]) {
--message-bar-background-color: var(--background-color-warning);
.icon {
--message-bar-icon-color: var(--icon-color-warning);
}
}
:host([type=success]) {
--message-bar-background-color: var(--background-color-success);
.icon {
--message-bar-icon-color: var(--icon-color-success);
}
}
:host([type=error]),
:host([type=critical]) {
--message-bar-background-color: var(--background-color-critical);
.icon {
--message-bar-icon-color: var(--icon-color-critical);
}
}
}
|