/
menu.scss
257 lines (203 loc) · 6.94 KB
/
menu.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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
@import "./menu.vars";
// Menu
// --------------------------------------------------
:host {
/**
* @prop --background: Background of the menu
*
* @prop --min-width: Minimum width of the menu
* @prop --width: Width of the menu
* @prop --max-width: Maximum width of the menu
*
* @prop --min-height: Minimum height of the menu
* @prop --height: Height of the menu
* @prop --max-height: Maximum height of the menu
*/
--width: #{$menu-width};
--min-width: auto;
--max-width: auto;
--height: 100%;
--min-height: auto;
--max-height: auto;
--background: #{$background-color};
@include position(0, 0, 0, 0);
display: none;
position: absolute;
contain: strict;
}
:host(.show-menu) {
display: block;
}
.menu-inner {
@include transform(translateX(-9999px));
display: flex;
position: absolute;
flex-direction: column;
justify-content: space-between;
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);
background: var(--background);
contain: strict;
}
:host(.menu-side-start) .menu-inner {
/**
* Menu does not cover the whole screen so we need to set the safe area for the
* side that touches the screen edge only. Since safe area is not logical, it
* needs to be applied to the correct side depending on the language direction.
* Otherwise, the content will have less space on both sides.
*
* LTR:
* The left side of the menu touches the screen edge. The safe area padding has
* already been set in the core styles, so there's no need to set it again.
* The right side of the menu is not touching the screen edge. Padding is not
* applied to the right side of the menu. A value of 0 is set.
*/
--ion-safe-area-right: 0px;
@include position(0, auto, 0, 0);
@include rtl() {
/**
* Menu does not cover the whole screen so we need to set the safe area for the
* side that touches the screen edge only. Since safe area is not logical, it
* needs to be applied to the correct side depending on the language direction.
* Otherwise, the content will have less space on both sides.
*
* RTL:
* The right side of the menu touches the screen edge.
* The right side needs to revert back to the default value that was set in the core styles, so we unset it here.
* This would keep the variable consistent with the core styles.
* Additionally, it would continue to allow users to override the variable if they choose to.
* The left side of the menu is not touching the screen edge. Padding is not
* applied to the left side of the menu. A value of 0 is set.
*/
--ion-safe-area-right: unset;
--ion-safe-area-left: 0px;
}
}
:host(.menu-side-end) .menu-inner {
/**
* Menu does not cover the whole screen so we need to set the safe area for the
* side that touches the screen edge only. Since safe area is not logical, it
* needs to be applied to the correct side depending on the language direction.
* Otherwise, the content will have less space on both sides.
*
* LTR:
* The right side of the menu touches the screen edge. The safe area padding has
* already been set in the core styles, so there's no need to set it again.
* The left side of the menu is not touching the screen edge. Padding is not
* applied to the left side of the menu. A value of 0 is set.
*/
--ion-safe-area-left: 0px;
@include position(0, 0, 0, auto);
@include rtl() {
/**
* Menu does not cover the whole screen so we need to set the safe area for the
* side that touches the screen edge only. Since safe area is not logical, it
* needs to be applied to the correct side depending on the language direction.
* Otherwise, the content will have less space on both sides.
*
* RTL:
* The left side of the menu touches the screen edge.
* The left side needs to revert back to the default value that was set in the core styles, so we unset it here.
* This would keep the variable consistent with the core styles.
* Additionally, it would continue to allow users to override the variable if they choose to.
* The right side of the menu is not touching the screen edge. Padding is not
* applied to the right side of the menu. A value of 0 is set.
*/
--ion-safe-area-left: unset;
--ion-safe-area-right: 0px;
}
}
ion-backdrop {
display: none;
opacity: .01;
z-index: -1;
}
@media (max-width: 340px) {
.menu-inner {
--width: #{$menu-small-width};
}
}
// Menu Reveal
// --------------------------------------------------
// The content slides over to reveal the menu underneath.
// The menu itself, which is under the content, does not move.
:host(.menu-type-reveal) {
z-index: 0;
}
:host(.menu-type-reveal.show-menu) .menu-inner {
@include transform(translate3d(0, 0, 0));
}
// Menu Overlay
// --------------------------------------------------
// The menu slides over the content. The content
// itself, which is under the menu, does not move.
:host(.menu-type-overlay) {
z-index: $z-index-menu-overlay;
}
:host(.menu-type-overlay) .show-backdrop {
display: block;
cursor: pointer;
}
// Menu Split Pane
// --------------------------------------------------
/**
* The split pane styles for menu are defined
* in the menu stylesheets instead in the split pane
* stylesheets with ::slotted to allow for menus
* to be wrapped in custom components.
* If we used ::slotted to target the menu
* then menus wrapped in components would never
* receive these styles because they are not
* children of the split pane.
*/
/**
* Do not pass CSS Variables down on larger
* screens as we want them to affect the outer
* `ion-menu` rather than the inner content
*/
:host(.menu-pane-visible) {
flex: 0 1 auto;
width: var(--side-width, var(--width));
min-width: var(--side-min-width, var(--min-width));
max-width: var(--side-max-width, var(--max-width));
}
:host(.menu-pane-visible.split-pane-side) {
@include position(0, 0, 0, 0);
position: relative;
box-shadow: none;
z-index: 0;
}
:host(.menu-pane-visible.split-pane-side.menu-enabled) {
display: flex;
flex-shrink: 0;
}
:host(.menu-pane-visible.split-pane-side) {
order: -1;
}
:host(.menu-pane-visible.split-pane-side[side=end]) {
order: 1;
}
:host(.menu-pane-visible) .menu-inner {
@include position-horizontal(0, 0);
width: auto;
transform: none;
box-shadow: none;
}
:host(.menu-pane-visible) ion-backdrop {
/* stylelint-disable-next-line declaration-no-important */
display: hidden !important;
}
:host(.menu-pane-visible.split-pane-side) {
@include border(0, var(--border), 0, 0);
min-width: var(--side-min-width);
max-width: var(--side-max-width);
}
:host(.menu-pane-visible.split-pane-side[side=end]) {
@include border(0, 0, 0, var(--border));
min-width: var(--side-min-width);
max-width: var(--side-max-width);
}