blob: 4ef93c11a21bcec76e99bb4d1ab40ff9c0795c48 (
plain)
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
|
/* 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;
}
|