/
toast.scss
157 lines (118 loc) · 2.94 KB
/
toast.scss
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
@import "./toast.vars";
// Toast
// --------------------------------------------------
:host {
/**
* @prop --background: Background of the toast
* @prop --color: Color of the toast text
*
* @prop --border-color: Border color of the toast
* @prop --border-radius: Border radius of the toast
* @prop --border-width: Border width of the toast
* @prop --border-style: Border style of the toast
*
* @prop --box-shadow: Box shadow of the toast
*
* @prop --min-width: Minimum width of the toast
* @prop --width: Width of the toast
* @prop --max-width: Maximum width of the toast
*
* @prop --min-height: Minimum height of the toast
* @prop --height: Height of the toast
* @prop --max-height: Maximum height of the toast
*
* @prop --button-color: Color of the button text
*
* @prop --start: Position from the left if direction is left-to-right, and from the right if direction is right-to-left
* @prop --end: Position from the right if direction is left-to-right, and from the left if direction is right-to-left
*/
--border-width: 0;
--border-style: none;
--border-color: initial;
--box-shadow: none;
--min-width: auto;
--width: auto;
--min-height: auto;
--height: auto;
--max-height: auto;
@include position(0, null, null, 0);
display: block;
position: absolute;
width: 100%;
height: 100%;
color: var(--color);
font-family: $font-family-base;
contain: strict;
z-index: $z-index-overlay;
pointer-events: none;
}
:host(.overlay-hidden) {
display: none;
}
:host(.ion-color) {
--button-color: inherit;
color: #{current-color(contrast)};
}
:host(.ion-color) .toast-button-cancel {
color: inherit;
}
:host(.ion-color) .toast-wrapper {
background: #{current-color(base)};
}
.toast-wrapper {
@include border-radius(var(--border-radius));
@include position-horizontal(var(--start), var(--end));
width: var(--width);
min-width: var(--min-width);
max-width: var(--max-width);
height: var(--height);
min-height: var(--min-height);
max-height: var(--max-height);
border-width: var(--border-width);
border-style: var(--border-style);
border-color: var(--border-color);
background: var(--background);
box-shadow: var(--box-shadow);
}
.toast-container {
display: flex;
align-items: center;
pointer-events: auto;
height: inherit;
min-height: inherit;
max-height: inherit;
contain: content;
}
.toast-content {
display: flex;
flex: 1;
flex-direction: column;
justify-content: center;
}
.toast-message {
flex: 1;
white-space: pre-wrap;
}
.toast-button-group {
display: flex;
}
.toast-button {
border: 0;
outline: none;
color: var(--button-color);
z-index: 0;
}
.toast-icon {
font-size: 1.4em;
}
.toast-button-inner {
display: flex;
align-items: center;
}
// Toast Button: Hover
// --------------------------------------------------
@media (any-hover: hover) {
.toast-button:hover {
cursor: pointer;
}
}