/* 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 { --info-icon-url: url("chrome://global/skin/icons/info.svg"); --warn-icon-url: url("chrome://global/skin/icons/warning.svg"); --check-icon-url: url("chrome://global/skin/icons/check.svg"); --error-icon-url: url("chrome://global/skin/icons/error.svg"); --close-icon-url: url("chrome://global/skin/icons/close.svg"); --icon-size: 16px; --close-icon-size: 32px; } /* MessageBar colors by message type */ /* Colors from: https://design.firefox.com/photon/components/message-bars.html#type-specific-style */ :host { /* Colors used by default, and for [type=generic] message bars.*/ background-color: var(--in-content-box-info-background); color: var(--in-content-text-color); --message-bar-icon-url: var(--info-icon-url); /* The default values of --in-content-button* are sufficient, even for dark themes */ } :host([type=warning]) { background-color: var(--yellow-50); color: var(--yellow-90); --message-bar-icon-url: var(--warn-icon-url); --in-content-button-background: var(--yellow-60); --in-content-button-background-hover: var(--yellow-70); --in-content-button-background-active: var(--yellow-80); } :host([type=success]) { background-color: var(--green-50); color: var(--green-90); --message-bar-icon-url: var(--check-icon-url); --in-content-button-background: var(--green-60); --in-content-button-background-hover: var(--green-70); --in-content-button-background-active: var(--green-80); } :host([type=error]) { background-color: var(--red-60); color: #ffffff; --message-bar-icon-url: var(--error-icon-url); --in-content-button-background: var(--red-70); --in-content-button-background-hover: var(--red-80); --in-content-button-background-active: var(--red-90); } :host { border-radius: 4px; } /* Make the host to behave as a block by default, but allow hidden to hide it. */ :host(:not([hidden])) { display: block; } ::slotted(button) { /* Enforce micro-button width. */ min-width: -moz-fit-content !important; } /* MessageBar Grid Layout */ .container { background: inherit; color: inherit; padding: 8px; min-height: 32px; border-radius: 4px; display: flex; /* Ensure that the message bar shadow dom elements are vertically aligned. */ align-items: center; } :host([align="center"]) .container { justify-content: center; } .content { margin: 0 4px; display: flex; /* Ensure that the message bar content is vertically aligned. */ align-items: center; /* Ensure that the message bar content is wrapped. */ word-break: break-word; } /* MessageBar icon style */ .icon { padding: 4px; width: var(--icon-size); height: var(--icon-size); flex-shrink: 0; } .icon::after { appearance: none; -moz-context-properties: fill, stroke; fill: currentColor; stroke: currentColor; content: var(--message-bar-icon-url); } /* Use a spacer to position the close button at the end, but also support * centering if required. */ .spacer { flex-grow: 1; } /* Close icon styles */ :host(:not([dismissable])) .close { display: none; } .close { background-image: var(--close-icon-url); background-repeat: no-repeat; background-position: center center; -moz-context-properties: fill, fill-opacity; fill: currentColor; fill-opacity: 0; min-width: auto; min-height: auto; width: var(--close-icon-size); height: var(--close-icon-size); margin: 0; margin-inline-end: 4px; padding: 0; flex-shrink: 0; }