@carbon/type 10.33.0 → 10.35.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/index.js +128 -25
- package/lib/index.js +151 -24
- package/package.json +5 -5
- package/scss/_inlined/_scale.scss +1 -1
- package/scss/_inlined/_styles.import.scss +761 -0
- package/scss/_inlined/_styles.scss +214 -36
- package/scss/_scale.scss +1 -1
- package/scss/_styles.import.scss +761 -0
- package/scss/_styles.scss +214 -36
- package/scss/modules/_scale.scss +1 -1
- package/scss/modules/_styles.scss +187 -26
- package/scss/vendor/@carbon/layout/_breakpoint.scss +4 -4
- package/scss/vendor/@carbon/layout/_convert.import.scss +56 -0
- package/scss/vendor/@carbon/layout/_convert.scss +14 -0
- package/scss/vendor/@carbon/layout/_key-height.import.scss +112 -0
- package/scss/vendor/@carbon/layout/_key-height.scss +14 -0
- package/scss/vendor/@carbon/layout/modules/_breakpoint.scss +4 -4
- package/scss/vendor/@carbon/layout/modules/_convert.scss +4 -2
- package/src/__tests__/__snapshots__/styles-test.js.snap +190 -18
- package/src/__tests__/exports-test.js +72 -48
- package/src/styles.js +81 -21
- package/src/tokens.js +50 -0
- package/umd/index.js +151 -24
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
// LICENSE file in the root directory of this source tree.
|
|
6
6
|
//
|
|
7
7
|
|
|
8
|
+
/* stylelint-disable number-max-precision */
|
|
9
|
+
|
|
8
10
|
@use 'sass:map';
|
|
9
11
|
@use '@carbon/layout';
|
|
10
12
|
@use 'font-family';
|
|
@@ -12,11 +14,12 @@
|
|
|
12
14
|
|
|
13
15
|
/// @type Map
|
|
14
16
|
/// @access public
|
|
17
|
+
/// @deprecated
|
|
15
18
|
/// @group @carbon/type
|
|
16
19
|
$caption-01: (
|
|
17
20
|
font-size: scale.type-scale(1),
|
|
18
21
|
font-weight: font-family.font-weight('regular'),
|
|
19
|
-
line-height: 1.
|
|
22
|
+
line-height: 1.33333,
|
|
20
23
|
letter-spacing: 0.32px,
|
|
21
24
|
) !default;
|
|
22
25
|
|
|
@@ -26,16 +29,37 @@ $caption-01: (
|
|
|
26
29
|
$label-01: (
|
|
27
30
|
font-size: scale.type-scale(1),
|
|
28
31
|
font-weight: font-family.font-weight('regular'),
|
|
29
|
-
line-height: 1.
|
|
32
|
+
line-height: 1.33333,
|
|
30
33
|
letter-spacing: 0.32px,
|
|
31
34
|
) !default;
|
|
32
35
|
|
|
33
36
|
/// @type Map
|
|
34
37
|
/// @access public
|
|
35
38
|
/// @group @carbon/type
|
|
39
|
+
$legal-01: (
|
|
40
|
+
font-size: scale.type-scale(1),
|
|
41
|
+
font-weight: font-family.font-weight('regular'),
|
|
42
|
+
line-height: 1.33333,
|
|
43
|
+
letter-spacing: 0.32px,
|
|
44
|
+
) !default;
|
|
45
|
+
|
|
46
|
+
/// @type Map
|
|
47
|
+
/// @access public
|
|
48
|
+
/// @group @carbon/type
|
|
49
|
+
$legal-02: (
|
|
50
|
+
font-size: scale.type-scale(2),
|
|
51
|
+
font-weight: font-family.font-weight('regular'),
|
|
52
|
+
line-height: 1.28572,
|
|
53
|
+
letter-spacing: 0.16px,
|
|
54
|
+
) !default;
|
|
55
|
+
|
|
56
|
+
/// @type Map
|
|
57
|
+
/// @access public
|
|
58
|
+
/// @deprecated
|
|
59
|
+
/// @group @carbon/type
|
|
36
60
|
$helper-text-01: (
|
|
37
61
|
font-size: scale.type-scale(1),
|
|
38
|
-
line-height: 1.
|
|
62
|
+
line-height: 1.33333,
|
|
39
63
|
letter-spacing: 0.32px,
|
|
40
64
|
) !default;
|
|
41
65
|
|
|
@@ -45,20 +69,30 @@ $helper-text-01: (
|
|
|
45
69
|
$body-short-01: (
|
|
46
70
|
font-size: scale.type-scale(2),
|
|
47
71
|
font-weight: font-family.font-weight('regular'),
|
|
48
|
-
line-height: 1.
|
|
72
|
+
line-height: 1.28572,
|
|
49
73
|
letter-spacing: 0.16px,
|
|
50
74
|
) !default;
|
|
51
75
|
|
|
76
|
+
/// @type Map
|
|
77
|
+
/// @access public
|
|
78
|
+
/// @group @carbon/type
|
|
79
|
+
$body-compact-01: $body-short-01 !default;
|
|
80
|
+
|
|
52
81
|
/// @type Map
|
|
53
82
|
/// @access public
|
|
54
83
|
/// @group @carbon/type
|
|
55
84
|
$body-long-01: (
|
|
56
85
|
font-size: scale.type-scale(2),
|
|
57
86
|
font-weight: font-family.font-weight('regular'),
|
|
58
|
-
line-height: 1.
|
|
87
|
+
line-height: 1.42857,
|
|
59
88
|
letter-spacing: 0.16px,
|
|
60
89
|
) !default;
|
|
61
90
|
|
|
91
|
+
/// @type Map
|
|
92
|
+
/// @access public
|
|
93
|
+
/// @group @carbon/type
|
|
94
|
+
$body-01: $body-long-01 !default;
|
|
95
|
+
|
|
62
96
|
/// @type Map
|
|
63
97
|
/// @access public
|
|
64
98
|
/// @group @carbon/type
|
|
@@ -69,6 +103,11 @@ $body-short-02: (
|
|
|
69
103
|
letter-spacing: 0,
|
|
70
104
|
) !default;
|
|
71
105
|
|
|
106
|
+
/// @type Map
|
|
107
|
+
/// @access public
|
|
108
|
+
/// @group @carbon/type
|
|
109
|
+
$body-compact-02: $body-short-02 !default;
|
|
110
|
+
|
|
72
111
|
/// @type Map
|
|
73
112
|
/// @access public
|
|
74
113
|
/// @group @carbon/type
|
|
@@ -79,6 +118,11 @@ $body-long-02: (
|
|
|
79
118
|
letter-spacing: 0,
|
|
80
119
|
) !default;
|
|
81
120
|
|
|
121
|
+
/// @type Map
|
|
122
|
+
/// @access public
|
|
123
|
+
/// @group @carbon/type
|
|
124
|
+
$body-02: $body-long-02 !default;
|
|
125
|
+
|
|
82
126
|
/// @type Map
|
|
83
127
|
/// @access public
|
|
84
128
|
/// @group @carbon/type
|
|
@@ -86,7 +130,7 @@ $code-01: (
|
|
|
86
130
|
font-family: font-family.font-family('mono'),
|
|
87
131
|
font-size: scale.type-scale(1),
|
|
88
132
|
font-weight: font-family.font-weight('regular'),
|
|
89
|
-
line-height: 1.
|
|
133
|
+
line-height: 1.33333,
|
|
90
134
|
letter-spacing: 0.32px,
|
|
91
135
|
) !default;
|
|
92
136
|
|
|
@@ -97,7 +141,7 @@ $code-02: (
|
|
|
97
141
|
font-family: font-family.font-family('mono'),
|
|
98
142
|
font-size: scale.type-scale(2),
|
|
99
143
|
font-weight: font-family.font-weight('regular'),
|
|
100
|
-
line-height: 1.
|
|
144
|
+
line-height: 1.42857,
|
|
101
145
|
letter-spacing: 0.32px,
|
|
102
146
|
) !default;
|
|
103
147
|
|
|
@@ -107,19 +151,39 @@ $code-02: (
|
|
|
107
151
|
$heading-01: (
|
|
108
152
|
font-size: scale.type-scale(2),
|
|
109
153
|
font-weight: font-family.font-weight('semibold'),
|
|
110
|
-
line-height: 1.
|
|
154
|
+
line-height: 1.42857,
|
|
111
155
|
letter-spacing: 0.16px,
|
|
112
156
|
) !default;
|
|
113
157
|
|
|
114
158
|
/// @type Map
|
|
115
159
|
/// @access public
|
|
116
160
|
/// @group @carbon/type
|
|
117
|
-
$productive-heading-01:
|
|
161
|
+
$productive-heading-01: (
|
|
162
|
+
font-size: scale.type-scale(2),
|
|
163
|
+
font-weight: font-family.font-weight('semibold'),
|
|
164
|
+
line-height: 1.28572,
|
|
165
|
+
letter-spacing: 0.16px,
|
|
166
|
+
) !default;
|
|
167
|
+
|
|
168
|
+
/// @type Map
|
|
169
|
+
/// @access public
|
|
170
|
+
/// @group @carbon/type
|
|
171
|
+
$heading-compact-01: $productive-heading-01 !default;
|
|
118
172
|
|
|
119
173
|
/// @type Map
|
|
120
174
|
/// @access public
|
|
121
175
|
/// @group @carbon/type
|
|
122
176
|
$heading-02: (
|
|
177
|
+
font-size: scale.type-scale(3),
|
|
178
|
+
font-weight: font-family.font-weight('semibold'),
|
|
179
|
+
line-height: 1.5,
|
|
180
|
+
letter-spacing: 0,
|
|
181
|
+
) !default;
|
|
182
|
+
|
|
183
|
+
/// @type Map
|
|
184
|
+
/// @access public
|
|
185
|
+
/// @group @carbon/type
|
|
186
|
+
$productive-heading-02: (
|
|
123
187
|
font-size: scale.type-scale(3),
|
|
124
188
|
font-weight: font-family.font-weight('semibold'),
|
|
125
189
|
line-height: 1.375,
|
|
@@ -129,7 +193,7 @@ $heading-02: (
|
|
|
129
193
|
/// @type Map
|
|
130
194
|
/// @access public
|
|
131
195
|
/// @group @carbon/type
|
|
132
|
-
$
|
|
196
|
+
$heading-compact-02: $productive-heading-02 !default;
|
|
133
197
|
|
|
134
198
|
/// @type Map
|
|
135
199
|
/// @access public
|
|
@@ -141,16 +205,26 @@ $productive-heading-03: (
|
|
|
141
205
|
letter-spacing: 0,
|
|
142
206
|
) !default;
|
|
143
207
|
|
|
208
|
+
/// @type Map
|
|
209
|
+
/// @access public
|
|
210
|
+
/// @group @carbon/type
|
|
211
|
+
$heading-03: $productive-heading-03 !default;
|
|
212
|
+
|
|
144
213
|
/// @type Map
|
|
145
214
|
/// @access public
|
|
146
215
|
/// @group @carbon/type
|
|
147
216
|
$productive-heading-04: (
|
|
148
217
|
font-size: scale.type-scale(7),
|
|
149
218
|
font-weight: font-family.font-weight('regular'),
|
|
150
|
-
line-height: 1.
|
|
219
|
+
line-height: 1.28572,
|
|
151
220
|
letter-spacing: 0,
|
|
152
221
|
) !default;
|
|
153
222
|
|
|
223
|
+
/// @type Map
|
|
224
|
+
/// @access public
|
|
225
|
+
/// @group @carbon/type
|
|
226
|
+
$heading-04: $productive-heading-04 !default;
|
|
227
|
+
|
|
154
228
|
/// @type Map
|
|
155
229
|
/// @access public
|
|
156
230
|
/// @group @carbon/type
|
|
@@ -161,6 +235,11 @@ $productive-heading-05: (
|
|
|
161
235
|
letter-spacing: 0,
|
|
162
236
|
) !default;
|
|
163
237
|
|
|
238
|
+
/// @type Map
|
|
239
|
+
/// @access public
|
|
240
|
+
/// @group @carbon/type
|
|
241
|
+
$heading-05: $productive-heading-05 !default;
|
|
242
|
+
|
|
164
243
|
/// @type Map
|
|
165
244
|
/// @access public
|
|
166
245
|
/// @group @carbon/type
|
|
@@ -172,6 +251,11 @@ $productive-heading-06: (
|
|
|
172
251
|
letter-spacing: 0,
|
|
173
252
|
) !default;
|
|
174
253
|
|
|
254
|
+
/// @type Map
|
|
255
|
+
/// @access public
|
|
256
|
+
/// @group @carbon/type
|
|
257
|
+
$heading-06: $productive-heading-06 !default;
|
|
258
|
+
|
|
175
259
|
/// @type Map
|
|
176
260
|
/// @access public
|
|
177
261
|
/// @group @carbon/type
|
|
@@ -185,22 +269,17 @@ $productive-heading-07: (
|
|
|
185
269
|
/// @type Map
|
|
186
270
|
/// @access public
|
|
187
271
|
/// @group @carbon/type
|
|
188
|
-
$
|
|
189
|
-
$heading-01,
|
|
190
|
-
(
|
|
191
|
-
line-height: 1.25,
|
|
192
|
-
)
|
|
193
|
-
) !default;
|
|
272
|
+
$heading-07: $productive-heading-07 !default;
|
|
194
273
|
|
|
195
274
|
/// @type Map
|
|
196
275
|
/// @access public
|
|
197
276
|
/// @group @carbon/type
|
|
198
|
-
$expressive-heading-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
277
|
+
$expressive-heading-01: $heading-01 !default;
|
|
278
|
+
|
|
279
|
+
/// @type Map
|
|
280
|
+
/// @access public
|
|
281
|
+
/// @group @carbon/type
|
|
282
|
+
$expressive-heading-02: $heading-02 !default;
|
|
204
283
|
|
|
205
284
|
/// @type Map
|
|
206
285
|
/// @access public
|
|
@@ -222,13 +301,18 @@ $expressive-heading-03: (
|
|
|
222
301
|
),
|
|
223
302
|
) !default;
|
|
224
303
|
|
|
304
|
+
/// @type Map
|
|
305
|
+
/// @access public
|
|
306
|
+
/// @group @carbon/type
|
|
307
|
+
$fluid-heading-03: $expressive-heading-03 !default;
|
|
308
|
+
|
|
225
309
|
/// @type Map
|
|
226
310
|
/// @access public
|
|
227
311
|
/// @group @carbon/type
|
|
228
312
|
$expressive-heading-04: (
|
|
229
313
|
font-size: scale.type-scale(7),
|
|
230
314
|
font-weight: font-family.font-weight('regular'),
|
|
231
|
-
line-height: 1.
|
|
315
|
+
line-height: 1.28572,
|
|
232
316
|
letter-spacing: 0,
|
|
233
317
|
breakpoints: (
|
|
234
318
|
xlg: (
|
|
@@ -241,6 +325,11 @@ $expressive-heading-04: (
|
|
|
241
325
|
),
|
|
242
326
|
) !default;
|
|
243
327
|
|
|
328
|
+
/// @type Map
|
|
329
|
+
/// @access public
|
|
330
|
+
/// @group @carbon/type
|
|
331
|
+
$fluid-heading-04: $expressive-heading-04 !default;
|
|
332
|
+
|
|
244
333
|
/// @type Map
|
|
245
334
|
/// @access public
|
|
246
335
|
/// @group @carbon/type
|
|
@@ -269,6 +358,11 @@ $expressive-heading-05: (
|
|
|
269
358
|
),
|
|
270
359
|
) !default;
|
|
271
360
|
|
|
361
|
+
/// @type Map
|
|
362
|
+
/// @access public
|
|
363
|
+
/// @group @carbon/type
|
|
364
|
+
$fluid-heading-05: $expressive-heading-05 !default;
|
|
365
|
+
|
|
272
366
|
/// @type Map
|
|
273
367
|
/// @access public
|
|
274
368
|
/// @group @carbon/type
|
|
@@ -296,6 +390,11 @@ $expressive-heading-06: (
|
|
|
296
390
|
),
|
|
297
391
|
) !default;
|
|
298
392
|
|
|
393
|
+
/// @type Map
|
|
394
|
+
/// @access public
|
|
395
|
+
/// @group @carbon/type
|
|
396
|
+
$fluid-heading-06: $expressive-heading-06 !default;
|
|
397
|
+
|
|
299
398
|
/// @type Map
|
|
300
399
|
/// @access public
|
|
301
400
|
/// @group @carbon/type
|
|
@@ -307,7 +406,7 @@ $expressive-paragraph-01: (
|
|
|
307
406
|
breakpoints: (
|
|
308
407
|
lg: (
|
|
309
408
|
font-size: scale.type-scale(7),
|
|
310
|
-
line-height: 1.
|
|
409
|
+
line-height: 1.28572,
|
|
311
410
|
),
|
|
312
411
|
max: (
|
|
313
412
|
font-size: scale.type-scale(8),
|
|
@@ -316,10 +415,16 @@ $expressive-paragraph-01: (
|
|
|
316
415
|
),
|
|
317
416
|
);
|
|
318
417
|
|
|
418
|
+
/// @type Map
|
|
419
|
+
/// @access public
|
|
420
|
+
/// @group @carbon/type
|
|
421
|
+
$fluid-paragraph-01: $expressive-paragraph-01 !default;
|
|
422
|
+
|
|
319
423
|
/// @type Map
|
|
320
424
|
/// @access public
|
|
321
425
|
/// @group @carbon/type
|
|
322
426
|
$quotation-01: (
|
|
427
|
+
font-family: font-family.font-family('serif'),
|
|
323
428
|
font-size: scale.type-scale(5),
|
|
324
429
|
font-weight: font-family.font-weight('regular'),
|
|
325
430
|
line-height: 1.3,
|
|
@@ -334,7 +439,7 @@ $quotation-01: (
|
|
|
334
439
|
),
|
|
335
440
|
xlg: (
|
|
336
441
|
font-size: scale.type-scale(7),
|
|
337
|
-
line-height: 1.
|
|
442
|
+
line-height: 1.28572,
|
|
338
443
|
),
|
|
339
444
|
max: (
|
|
340
445
|
font-size: scale.type-scale(8),
|
|
@@ -343,10 +448,16 @@ $quotation-01: (
|
|
|
343
448
|
),
|
|
344
449
|
) !default;
|
|
345
450
|
|
|
451
|
+
/// @type Map
|
|
452
|
+
/// @access public
|
|
453
|
+
/// @group @carbon/type
|
|
454
|
+
$fluid-quotation-01: $quotation-01 !default;
|
|
455
|
+
|
|
346
456
|
/// @type Map
|
|
347
457
|
/// @access public
|
|
348
458
|
/// @group @carbon/type
|
|
349
459
|
$quotation-02: (
|
|
460
|
+
font-family: font-family.font-family('serif'),
|
|
350
461
|
font-size: scale.type-scale(8),
|
|
351
462
|
font-weight: font-family.font-weight('light'),
|
|
352
463
|
line-height: 1.25,
|
|
@@ -370,6 +481,11 @@ $quotation-02: (
|
|
|
370
481
|
),
|
|
371
482
|
) !default;
|
|
372
483
|
|
|
484
|
+
/// @type Map
|
|
485
|
+
/// @access public
|
|
486
|
+
/// @group @carbon/type
|
|
487
|
+
$fluid-quotation-02: $quotation-02 !default;
|
|
488
|
+
|
|
373
489
|
/// @type Map
|
|
374
490
|
/// @access public
|
|
375
491
|
/// @group @carbon/type
|
|
@@ -396,6 +512,11 @@ $display-01: (
|
|
|
396
512
|
),
|
|
397
513
|
) !default;
|
|
398
514
|
|
|
515
|
+
/// @type Map
|
|
516
|
+
/// @access public
|
|
517
|
+
/// @group @carbon/type
|
|
518
|
+
$fluid-display-01: $display-01 !default;
|
|
519
|
+
|
|
399
520
|
/// @type Map
|
|
400
521
|
/// @access public
|
|
401
522
|
/// @group @carbon/type
|
|
@@ -422,6 +543,11 @@ $display-02: (
|
|
|
422
543
|
),
|
|
423
544
|
) !default;
|
|
424
545
|
|
|
546
|
+
/// @type Map
|
|
547
|
+
/// @access public
|
|
548
|
+
/// @group @carbon/type
|
|
549
|
+
$fluid-display-02: $display-02 !default;
|
|
550
|
+
|
|
425
551
|
/// @type Map
|
|
426
552
|
/// @access public
|
|
427
553
|
/// @group @carbon/type
|
|
@@ -453,6 +579,11 @@ $display-03: (
|
|
|
453
579
|
),
|
|
454
580
|
) !default;
|
|
455
581
|
|
|
582
|
+
/// @type Map
|
|
583
|
+
/// @access public
|
|
584
|
+
/// @group @carbon/type
|
|
585
|
+
$fluid-display-03: $display-03 !default;
|
|
586
|
+
|
|
456
587
|
/// @type Map
|
|
457
588
|
/// @access public
|
|
458
589
|
/// @group @carbon/type
|
|
@@ -484,6 +615,11 @@ $display-04: (
|
|
|
484
615
|
),
|
|
485
616
|
) !default;
|
|
486
617
|
|
|
618
|
+
/// @type Map
|
|
619
|
+
/// @access public
|
|
620
|
+
/// @group @carbon/type
|
|
621
|
+
$fluid-display-04: $display-04 !default;
|
|
622
|
+
|
|
487
623
|
/// @type Map
|
|
488
624
|
/// @access public
|
|
489
625
|
/// @group @carbon/type
|
|
@@ -519,6 +655,31 @@ $tokens: (
|
|
|
519
655
|
display-02: $display-02,
|
|
520
656
|
display-03: $display-03,
|
|
521
657
|
display-04: $display-04,
|
|
658
|
+
// V11 Tokens
|
|
659
|
+
legal-01: $legal-01,
|
|
660
|
+
legal-02: $legal-02,
|
|
661
|
+
body-compact-01: $body-compact-01,
|
|
662
|
+
body-compact-02: $body-compact-02,
|
|
663
|
+
heading-compact-01: $heading-compact-01,
|
|
664
|
+
heading-compact-02: $heading-compact-02,
|
|
665
|
+
body-01: $body-01,
|
|
666
|
+
body-02: $body-02,
|
|
667
|
+
heading-03: $heading-03,
|
|
668
|
+
heading-04: $heading-04,
|
|
669
|
+
heading-05: $heading-05,
|
|
670
|
+
heading-06: $heading-06,
|
|
671
|
+
heading-07: $heading-07,
|
|
672
|
+
fluid-heading-03: $fluid-heading-03,
|
|
673
|
+
fluid-heading-04: $fluid-heading-04,
|
|
674
|
+
fluid-heading-05: $fluid-heading-05,
|
|
675
|
+
fluid-heading-06: $fluid-heading-06,
|
|
676
|
+
fluid-paragraph-01: $fluid-paragraph-01,
|
|
677
|
+
fluid-quotation-01: $fluid-quotation-01,
|
|
678
|
+
fluid-quotation-02: $fluid-quotation-02,
|
|
679
|
+
fluid-display-01: $fluid-display-01,
|
|
680
|
+
fluid-display-02: $fluid-display-02,
|
|
681
|
+
fluid-display-03: $fluid-display-03,
|
|
682
|
+
fluid-display-04: $fluid-display-04,
|
|
522
683
|
);
|
|
523
684
|
|
|
524
685
|
/// @param {Map} $map
|
|
@@ -54,7 +54,7 @@ $carbon--grid-breakpoints: (
|
|
|
54
54
|
) !default;
|
|
55
55
|
|
|
56
56
|
/// Get the value of the next breakpoint, or null for the last breakpoint
|
|
57
|
-
/// @param {String} $name - The name of the
|
|
57
|
+
/// @param {String} $name - The name of the breakpoint
|
|
58
58
|
/// @param {Map} $breakpoints [$carbon--grid-breakpoints] - A map of breakpoints where the key is the name of the breakpoint and the value is the values for the breakpoint
|
|
59
59
|
/// @param {List} $breakpoint-names [map-keys($breakpoints)] - A list of names from the `$breakpoints` map
|
|
60
60
|
/// @return {String}
|
|
@@ -73,7 +73,7 @@ $carbon--grid-breakpoints: (
|
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
/// Get the value of the previous breakpoint, or null for the first breakpoint
|
|
76
|
-
/// @param {String} $name - The name of the
|
|
76
|
+
/// @param {String} $name - The name of the breakpoint
|
|
77
77
|
/// @param {Map} $breakpoints [$carbon--grid-breakpoints] - A map of breakpoints where the key is the name of the breakpoint and the value is the values for the breakpoint
|
|
78
78
|
/// @param {List} $breakpoint-names [map-keys($breakpoints)] - A list of names from the `$breakpoints` map
|
|
79
79
|
/// @return {String}
|
|
@@ -92,7 +92,7 @@ $carbon--grid-breakpoints: (
|
|
|
92
92
|
}
|
|
93
93
|
|
|
94
94
|
/// Check to see if the given breakpoint name
|
|
95
|
-
/// @param {String} $name - The name of the
|
|
95
|
+
/// @param {String} $name - The name of the breakpoint
|
|
96
96
|
/// @param {Map} $breakpoints [$carbon--grid-breakpoints] - A map of breakpoints where the key is the name of the breakpoint and the value is the values for the breakpoint
|
|
97
97
|
/// @return {Bool}
|
|
98
98
|
/// @access public
|
|
@@ -116,7 +116,7 @@ $carbon--grid-breakpoints: (
|
|
|
116
116
|
@return carbon--key-by-index($breakpoints, $total-breakpoints);
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
-
/// Get the infix for a given breakpoint in a list of breakpoints.
|
|
119
|
+
/// Get the infix for a given breakpoint in a list of breakpoints. Useful for generating the size part in a selector, for example: `.prefix--col-sm-2`.
|
|
120
120
|
/// @param {String} $name - The name of the breakpoint
|
|
121
121
|
/// @return {String}
|
|
122
122
|
/// @access public
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright IBM Corp. 2018, 2018
|
|
3
|
+
//
|
|
4
|
+
// This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
// LICENSE file in the root directory of this source tree.
|
|
6
|
+
//
|
|
7
|
+
//-------------------------------------------
|
|
8
|
+
// Compatibility notes (*.import.scss)
|
|
9
|
+
// ------------------------------------------
|
|
10
|
+
//
|
|
11
|
+
// This file is intended to be consumed and processed with dart-sass.
|
|
12
|
+
// It is incompatible with node-sass/libsass as it contains sass language features
|
|
13
|
+
// or functions that are unavailable in node-sass/libsass, such as `math.div`.
|
|
14
|
+
//
|
|
15
|
+
// The non-`.import` suffixed version of this file eg. `_filename.scss`
|
|
16
|
+
// is intended to be compatible with node-sass/libsass.
|
|
17
|
+
//
|
|
18
|
+
// Styles authored within this file must be duplicated to the corresponding
|
|
19
|
+
// compatibility file to ensure we continue to support node-sass and dart-sass
|
|
20
|
+
// in v10.
|
|
21
|
+
|
|
22
|
+
@use 'sass:math';
|
|
23
|
+
|
|
24
|
+
/// Default font size
|
|
25
|
+
/// @type Number
|
|
26
|
+
/// @access public
|
|
27
|
+
/// @group @carbon/layout
|
|
28
|
+
$carbon--base-font-size: 16px !default;
|
|
29
|
+
|
|
30
|
+
/// Convert a given px unit to a rem unit
|
|
31
|
+
/// @param {Number} $px - Number with px unit
|
|
32
|
+
/// @return {Number} Number with rem unit
|
|
33
|
+
/// @access public
|
|
34
|
+
/// @group @carbon/layout
|
|
35
|
+
@function carbon--rem($px) {
|
|
36
|
+
@if unit($px) != 'px' {
|
|
37
|
+
// TODO: update to @error in v11
|
|
38
|
+
@warn "Expected argument $px to be of type `px`, instead received: `#{unit($px)}`";
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
@return math.div($px, $carbon--base-font-size) * 1rem;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/// Convert a given px unit to a em unit
|
|
45
|
+
/// @param {Number} $px - Number with px unit
|
|
46
|
+
/// @return {Number} Number with em unit
|
|
47
|
+
/// @access public
|
|
48
|
+
/// @group @carbon/layout
|
|
49
|
+
@function carbon--em($px) {
|
|
50
|
+
@if unit($px) != 'px' {
|
|
51
|
+
// TODO: update to @error in v11
|
|
52
|
+
@warn "Expected argument $px to be of type `px`, instead received: `#{unit($px)}`";
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
@return math.div($px, $carbon--base-font-size) * 1em;
|
|
56
|
+
}
|
|
@@ -4,6 +4,20 @@
|
|
|
4
4
|
// This source code is licensed under the Apache-2.0 license found in the
|
|
5
5
|
// LICENSE file in the root directory of this source tree.
|
|
6
6
|
//
|
|
7
|
+
//-------------------------------------------
|
|
8
|
+
// Compatibility notes
|
|
9
|
+
// ------------------------------------------
|
|
10
|
+
//
|
|
11
|
+
// This file is intended to be consumed and processed with node-sass/libsass.
|
|
12
|
+
// Sass language features only available in dart-sass, such as `math.div`,
|
|
13
|
+
// should not be used.
|
|
14
|
+
//
|
|
15
|
+
// The `.import` suffixed version of this file eg. `_filename.import.scss`
|
|
16
|
+
// is intended to be compatible with dart-sass.
|
|
17
|
+
//
|
|
18
|
+
// Styles authored within this file must be duplicated to the corresponding
|
|
19
|
+
// compatibility file to ensure we continue to support node-sass and dart-sass
|
|
20
|
+
// in v10.
|
|
7
21
|
|
|
8
22
|
/// Default font size
|
|
9
23
|
/// @type Number
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright IBM Corp. 2018, 2018
|
|
3
|
+
//
|
|
4
|
+
// This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
// LICENSE file in the root directory of this source tree.
|
|
6
|
+
//
|
|
7
|
+
//-------------------------------------------
|
|
8
|
+
// Compatibility notes (*.import.scss)
|
|
9
|
+
// ------------------------------------------
|
|
10
|
+
//
|
|
11
|
+
// This file is intended to be consumed and processed with dart-sass.
|
|
12
|
+
// It is incompatible with node-sass/libsass as it contains sass language features
|
|
13
|
+
// or functions that are unavailable in node-sass/libsass, such as `math.div`.
|
|
14
|
+
//
|
|
15
|
+
// The non-`.import` suffixed version of this file eg. `_filename.scss`
|
|
16
|
+
// is intended to be compatible with node-sass/libsass.
|
|
17
|
+
//
|
|
18
|
+
// Styles authored within this file must be duplicated to the corresponding
|
|
19
|
+
// compatibility file to ensure we continue to support node-sass and dart-sass
|
|
20
|
+
// in v10.
|
|
21
|
+
|
|
22
|
+
@use "sass:math";
|
|
23
|
+
@import 'breakpoint'; /* stylelint-disable-line no-invalid-position-at-import-rule */
|
|
24
|
+
@import 'utilities'; /* stylelint-disable-line no-invalid-position-at-import-rule */
|
|
25
|
+
|
|
26
|
+
/// Get the column width for a given breakpoint
|
|
27
|
+
/// @param {String} $breakpoint
|
|
28
|
+
/// @param {Map} $breakpoints [$carbon--grid-breakpoints]
|
|
29
|
+
/// @return {Number} In rem
|
|
30
|
+
/// @access public
|
|
31
|
+
/// @group @carbon/layout
|
|
32
|
+
@function carbon--get-column-width(
|
|
33
|
+
$breakpoint,
|
|
34
|
+
$breakpoints: $carbon--grid-breakpoints
|
|
35
|
+
) {
|
|
36
|
+
@if map-has-key($breakpoints, $breakpoint) {
|
|
37
|
+
$values: map-get($breakpoints, $breakpoint);
|
|
38
|
+
$width: map-get($values, width);
|
|
39
|
+
$margin: map-get($values, margin);
|
|
40
|
+
$columns: map-get($values, columns);
|
|
41
|
+
|
|
42
|
+
@return math.div($width - (2 * $margin), $columns);
|
|
43
|
+
} @else {
|
|
44
|
+
@warn 'Breakpoint: `#{$breakpoint}` is not a valid breakpoint.';
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/// @type Map
|
|
49
|
+
/// @access public
|
|
50
|
+
/// @group @carbon/layout
|
|
51
|
+
$carbon--key-height-scales: (
|
|
52
|
+
sm: (
|
|
53
|
+
carbon--get-column-width(sm),
|
|
54
|
+
carbon--get-column-width(sm) * 2,
|
|
55
|
+
carbon--get-column-width(sm) * 3,
|
|
56
|
+
carbon--get-column-width(sm) * 4,
|
|
57
|
+
carbon--get-column-width(sm) * 5,
|
|
58
|
+
carbon--get-column-width(sm) * 6,
|
|
59
|
+
),
|
|
60
|
+
md: (
|
|
61
|
+
carbon--get-column-width(md),
|
|
62
|
+
carbon--get-column-width(md) * 2,
|
|
63
|
+
carbon--get-column-width(md) * 3,
|
|
64
|
+
carbon--get-column-width(md) * 4,
|
|
65
|
+
carbon--get-column-width(md) * 5,
|
|
66
|
+
carbon--get-column-width(md) * 6,
|
|
67
|
+
),
|
|
68
|
+
lg: (
|
|
69
|
+
carbon--get-column-width(lg),
|
|
70
|
+
carbon--get-column-width(lg) * 2,
|
|
71
|
+
carbon--get-column-width(lg) * 3,
|
|
72
|
+
carbon--get-column-width(lg) * 4,
|
|
73
|
+
carbon--get-column-width(lg) * 5,
|
|
74
|
+
carbon--get-column-width(lg) * 6,
|
|
75
|
+
carbon--get-column-width(lg) * 7,
|
|
76
|
+
carbon--get-column-width(lg) * 8,
|
|
77
|
+
),
|
|
78
|
+
xlg: (
|
|
79
|
+
carbon--get-column-width(xlg),
|
|
80
|
+
carbon--get-column-width(xlg) * 2,
|
|
81
|
+
carbon--get-column-width(xlg) * 3,
|
|
82
|
+
carbon--get-column-width(xlg) * 4,
|
|
83
|
+
carbon--get-column-width(xlg) * 5,
|
|
84
|
+
carbon--get-column-width(xlg) * 6,
|
|
85
|
+
carbon--get-column-width(xlg) * 7,
|
|
86
|
+
carbon--get-column-width(xlg) * 8,
|
|
87
|
+
),
|
|
88
|
+
max: (
|
|
89
|
+
carbon--get-column-width(max),
|
|
90
|
+
carbon--get-column-width(max) * 2,
|
|
91
|
+
carbon--get-column-width(max) * 3,
|
|
92
|
+
carbon--get-column-width(max) * 4,
|
|
93
|
+
carbon--get-column-width(max) * 5,
|
|
94
|
+
carbon--get-column-width(max) * 6,
|
|
95
|
+
carbon--get-column-width(max) * 7,
|
|
96
|
+
carbon--get-column-width(max) * 8,
|
|
97
|
+
),
|
|
98
|
+
);
|
|
99
|
+
|
|
100
|
+
/// Get the value of a key height step at a given breakpoint
|
|
101
|
+
/// @param {String} $breakpoint
|
|
102
|
+
/// @param {Number} $step
|
|
103
|
+
/// @return {Number} In rem
|
|
104
|
+
/// @access public
|
|
105
|
+
/// @group @carbon/layout
|
|
106
|
+
@function carbon--key-height($breakpoint, $step) {
|
|
107
|
+
@if map-has-key($carbon--key-height-scales, $breakpoint) {
|
|
108
|
+
@return nth(map-get($carbon--key-height-scales, $breakpoint), $step);
|
|
109
|
+
} @else {
|
|
110
|
+
@warn 'Breakpoint: `#{$breakpoint}` is not a valid breakpoint.';
|
|
111
|
+
}
|
|
112
|
+
}
|