Repository navigation
Expand file tree
/
Copy path_box.scss
More file actions
340 lines (270 loc) · 6.47 KB
/
Copy path_box.scss
File metadata and controls
340 lines (270 loc) · 6.47 KB
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
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
@import "carbon-components/scss/globals/scss/vars";
@import "carbon-components/scss/globals/scss/layer";
@import "carbon-components/scss/globals/scss/vendor/@carbon/elements/scss/import-once/import-once";
@import "./fill-tokens";
@import "./spacing-scale";
/// Box utility classes for fill, inset, and border tokens.
/// @access private
/// @group components
@mixin box {
@each $name, $value in ccs-fill-tokens() {
.#{$prefix}--box-fill-#{$name} {
background-color: $value;
}
}
$border-tokens: (
subtle: $border-subtle,
strong: $border-strong,
interactive: $border-interactive,
disabled: $border-disabled,
);
@each $name, $value in $border-tokens {
.#{$prefix}--box-border-#{$name} {
border: 1px solid $value;
}
}
.#{$prefix}--box-border-style-dashed {
border-style: dashed;
}
$border-sides: top, right, bottom, left;
@each $side in $border-sides {
.#{$prefix}--box-border-side-#{$side} {
@each $other in $border-sides {
@if $other != $side {
border-#{$other}-width: 0;
}
}
}
}
.#{$prefix}--box-shadow {
@include layer("raised");
}
@each $step, $size in $ccs-spacing-scale {
.#{$prefix}--box-p-#{$step} {
padding: $size;
}
.#{$prefix}--box-px-#{$step} {
padding-inline: $size;
}
.#{$prefix}--box-py-#{$step} {
padding-block: $size;
}
.#{$prefix}--box-m-#{$step} {
margin: $size;
}
.#{$prefix}--box-mx-#{$step} {
margin-inline: $size;
}
.#{$prefix}--box-my-#{$step} {
margin-block: $size;
}
.#{$prefix}--box-gap-#{$step} {
gap: $size;
}
}
// After the all-sides and axis rules so a single side wins at equal
// specificity, whatever the steps.
@each $step, $size in $ccs-spacing-scale {
.#{$prefix}--box-pt-#{$step} {
padding-top: $size;
}
.#{$prefix}--box-pr-#{$step} {
padding-right: $size;
}
.#{$prefix}--box-pb-#{$step} {
padding-bottom: $size;
}
.#{$prefix}--box-pl-#{$step} {
padding-left: $size;
}
.#{$prefix}--box-ps-#{$step} {
padding-inline-start: $size;
}
.#{$prefix}--box-pe-#{$step} {
padding-inline-end: $size;
}
.#{$prefix}--box-mt-#{$step} {
margin-top: $size;
}
.#{$prefix}--box-mr-#{$step} {
margin-right: $size;
}
.#{$prefix}--box-mb-#{$step} {
margin-bottom: $size;
}
.#{$prefix}--box-ml-#{$step} {
margin-left: $size;
}
.#{$prefix}--box-ms-#{$step} {
margin-inline-start: $size;
}
.#{$prefix}--box-me-#{$step} {
margin-inline-end: $size;
}
}
.#{$prefix}--box-full-width {
width: 100%;
}
@each $step, $size in $ccs-spacing-scale {
.#{$prefix}--box-height-#{$step} {
height: $size;
}
.#{$prefix}--box-min-height-#{$step} {
min-height: $size;
}
.#{$prefix}--box-max-height-#{$step} {
max-height: $size;
}
.#{$prefix}--box-top-#{$step} {
top: $size;
}
.#{$prefix}--box-bottom-#{$step} {
bottom: $size;
}
.#{$prefix}--box-left-#{$step} {
left: $size;
}
.#{$prefix}--box-right-#{$step} {
right: $size;
}
}
.#{$prefix}--box-top-0 {
top: 0;
}
.#{$prefix}--box-bottom-0 {
bottom: 0;
}
.#{$prefix}--box-left-0 {
left: 0;
}
.#{$prefix}--box-right-0 {
right: 0;
}
// 100vh first as a fallback for browsers without dvh support; 100dvh
// overrides it and tracks mobile browser chrome, so no scroll clipping.
.#{$prefix}--box-height-viewport {
height: 100vh;
height: 100dvh;
}
.#{$prefix}--box-min-height-viewport {
min-height: 100vh;
min-height: 100dvh;
}
.#{$prefix}--box-position-relative {
position: relative;
}
.#{$prefix}--box-position-absolute {
position: absolute;
}
.#{$prefix}--box-position-sticky {
position: sticky;
}
.#{$prefix}--box-display-block {
display: block;
}
.#{$prefix}--box-display-inline-block {
display: inline-block;
}
.#{$prefix}--box-display-flex {
display: flex;
}
.#{$prefix}--box-display-inline-flex {
display: inline-flex;
}
.#{$prefix}--box-display-grid {
display: grid;
}
.#{$prefix}--box-display-none {
display: none;
}
.#{$prefix}--box-direction-row {
flex-direction: row;
}
.#{$prefix}--box-direction-column {
flex-direction: column;
}
$align-values: (
start: flex-start,
center: center,
end: flex-end,
stretch: stretch,
baseline: baseline,
);
@each $name, $value in $align-values {
.#{$prefix}--box-align-#{$name} {
align-items: $value;
}
}
$justify-values: (
start: flex-start,
center: center,
end: flex-end,
space-between: space-between,
space-around: space-around,
space-evenly: space-evenly,
);
@each $name, $value in $justify-values {
.#{$prefix}--box-justify-#{$name} {
justify-content: $value;
}
}
$wrap-values: nowrap, wrap, wrap-reverse;
@each $value in $wrap-values {
.#{$prefix}--box-wrap-#{$value} {
flex-wrap: $value;
}
}
@each $name, $value in $align-values {
.#{$prefix}--box-align-self-#{$name} {
align-self: $value;
}
}
.#{$prefix}--box-grow {
flex-grow: 1;
}
// After the `display` rules so hiding wins at equal specificity. Nothing is
// below `sm` or above `max`, so those two classes are never emitted.
$hide-breakpoints: sm, md, lg, xlg, max;
@each $bp in $hide-breakpoints {
@if $bp != nth($hide-breakpoints, 1) {
.#{$prefix}--box-hide-below-#{$bp} {
@include carbon--breakpoint-down($bp) {
display: none;
}
}
}
$next: carbon--breakpoint-next($bp);
@if $next != null {
.#{$prefix}--box-hide-above-#{$bp} {
@include carbon--breakpoint-up($next) {
display: none;
}
}
}
}
.#{$prefix}--box-overflow-visible {
overflow: visible;
}
.#{$prefix}--box-overflow-hidden {
overflow: hidden;
}
.#{$prefix}--box-overflow-auto {
overflow: auto;
}
.#{$prefix}--box-overflow-scroll {
overflow: scroll;
}
// After the `overflow` rules so a per-axis class wins at equal specificity.
$overflow-values: visible, hidden, auto, scroll;
@each $value in $overflow-values {
.#{$prefix}--box-overflow-x-#{$value} {
overflow-x: $value;
}
.#{$prefix}--box-overflow-y-#{$value} {
overflow-y: $value;
}
}
}
@include exports("box") {
@include box;
}