@carbon/styles 0.10.0-rc.0 → 0.12.0-rc.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/docs/sass.md +0 -17
- package/index.scss +3 -1
- package/package.json +10 -10
- package/scss/_config.scss +18 -11
- package/scss/_layer.scss +112 -0
- package/scss/_theme.scss +0 -69
- package/scss/_zone.scss +2 -0
- package/scss/components/button/_tokens.scss +2 -2
- package/scss/components/date-picker/_date-picker.scss +1 -1
- package/scss/components/list-box/_list-box.scss +2 -2
- package/scss/components/radio-button/_radio-button.scss +3 -3
- package/scss/components/tabs/_tabs.scss +86 -103
- package/scss/components/tag/_tokens.scss +60 -60
- package/scss/fonts/README.md +148 -0
- package/scss/fonts/_index.scss +75 -0
- package/scss/fonts/_mono.scss +153 -0
- package/scss/fonts/_sans-arabic.scss +151 -0
- package/scss/fonts/_sans-devanagari.scss +151 -0
- package/scss/fonts/_sans-hebrew.scss +151 -0
- package/scss/fonts/_sans-thai-looped.scss +151 -0
- package/scss/fonts/_sans-thai.scss +151 -0
- package/scss/fonts/_sans.scss +153 -0
- package/scss/fonts/_serif.scss +153 -0
- package/scss/fonts/_src.scss +102 -0
- package/scss/fonts/unicode/_index.scss +124 -0
- package/scss/_font-face.scss +0 -13
- package/scss/utilities/_layer-set.scss +0 -38
|
@@ -25,11 +25,11 @@ $tag-background-red: (
|
|
|
25
25
|
),
|
|
26
26
|
(
|
|
27
27
|
theme: themes.$g90,
|
|
28
|
-
value: colors.$red-
|
|
28
|
+
value: colors.$red-70,
|
|
29
29
|
),
|
|
30
30
|
(
|
|
31
31
|
theme: themes.$g100,
|
|
32
|
-
value: colors.$red-
|
|
32
|
+
value: colors.$red-70,
|
|
33
33
|
),
|
|
34
34
|
),
|
|
35
35
|
) !default;
|
|
@@ -47,11 +47,11 @@ $tag-color-red: (
|
|
|
47
47
|
),
|
|
48
48
|
(
|
|
49
49
|
theme: themes.$g90,
|
|
50
|
-
value: colors.$red-
|
|
50
|
+
value: colors.$red-20,
|
|
51
51
|
),
|
|
52
52
|
(
|
|
53
53
|
theme: themes.$g100,
|
|
54
|
-
value: colors.$red-
|
|
54
|
+
value: colors.$red-20,
|
|
55
55
|
),
|
|
56
56
|
),
|
|
57
57
|
) !default;
|
|
@@ -69,11 +69,11 @@ $tag-hover-red: (
|
|
|
69
69
|
),
|
|
70
70
|
(
|
|
71
71
|
theme: themes.$g90,
|
|
72
|
-
value: colors.$red-70,
|
|
72
|
+
value: colors.$red-70-hover,
|
|
73
73
|
),
|
|
74
74
|
(
|
|
75
75
|
theme: themes.$g100,
|
|
76
|
-
value: colors.$red-70,
|
|
76
|
+
value: colors.$red-70-hover,
|
|
77
77
|
),
|
|
78
78
|
),
|
|
79
79
|
) !default;
|
|
@@ -92,11 +92,11 @@ $tag-background-magenta: (
|
|
|
92
92
|
),
|
|
93
93
|
(
|
|
94
94
|
theme: themes.$g90,
|
|
95
|
-
value: colors.$magenta-
|
|
95
|
+
value: colors.$magenta-70,
|
|
96
96
|
),
|
|
97
97
|
(
|
|
98
98
|
theme: themes.$g100,
|
|
99
|
-
value: colors.$magenta-
|
|
99
|
+
value: colors.$magenta-70,
|
|
100
100
|
),
|
|
101
101
|
),
|
|
102
102
|
) !default;
|
|
@@ -114,11 +114,11 @@ $tag-color-magenta: (
|
|
|
114
114
|
),
|
|
115
115
|
(
|
|
116
116
|
theme: themes.$g90,
|
|
117
|
-
value: colors.$magenta-
|
|
117
|
+
value: colors.$magenta-20,
|
|
118
118
|
),
|
|
119
119
|
(
|
|
120
120
|
theme: themes.$g100,
|
|
121
|
-
value: colors.$magenta-
|
|
121
|
+
value: colors.$magenta-20,
|
|
122
122
|
),
|
|
123
123
|
),
|
|
124
124
|
) !default;
|
|
@@ -136,11 +136,11 @@ $tag-hover-magenta: (
|
|
|
136
136
|
),
|
|
137
137
|
(
|
|
138
138
|
theme: themes.$g90,
|
|
139
|
-
value: colors.$magenta-70,
|
|
139
|
+
value: colors.$magenta-70-hover,
|
|
140
140
|
),
|
|
141
141
|
(
|
|
142
142
|
theme: themes.$g100,
|
|
143
|
-
value: colors.$magenta-70,
|
|
143
|
+
value: colors.$magenta-70-hover,
|
|
144
144
|
),
|
|
145
145
|
),
|
|
146
146
|
) !default;
|
|
@@ -159,11 +159,11 @@ $tag-background-purple: (
|
|
|
159
159
|
),
|
|
160
160
|
(
|
|
161
161
|
theme: themes.$g90,
|
|
162
|
-
value: colors.$purple-
|
|
162
|
+
value: colors.$purple-70,
|
|
163
163
|
),
|
|
164
164
|
(
|
|
165
165
|
theme: themes.$g100,
|
|
166
|
-
value: colors.$purple-
|
|
166
|
+
value: colors.$purple-70,
|
|
167
167
|
),
|
|
168
168
|
),
|
|
169
169
|
) !default;
|
|
@@ -181,11 +181,11 @@ $tag-color-purple: (
|
|
|
181
181
|
),
|
|
182
182
|
(
|
|
183
183
|
theme: themes.$g90,
|
|
184
|
-
value: colors.$purple-
|
|
184
|
+
value: colors.$purple-20,
|
|
185
185
|
),
|
|
186
186
|
(
|
|
187
187
|
theme: themes.$g100,
|
|
188
|
-
value: colors.$purple-
|
|
188
|
+
value: colors.$purple-20,
|
|
189
189
|
),
|
|
190
190
|
),
|
|
191
191
|
) !default;
|
|
@@ -203,11 +203,11 @@ $tag-hover-purple: (
|
|
|
203
203
|
),
|
|
204
204
|
(
|
|
205
205
|
theme: themes.$g90,
|
|
206
|
-
value: colors.$purple-70,
|
|
206
|
+
value: colors.$purple-70-hover,
|
|
207
207
|
),
|
|
208
208
|
(
|
|
209
209
|
theme: themes.$g100,
|
|
210
|
-
value: colors.$purple-70,
|
|
210
|
+
value: colors.$purple-70-hover,
|
|
211
211
|
),
|
|
212
212
|
),
|
|
213
213
|
) !default;
|
|
@@ -226,11 +226,11 @@ $tag-background-blue: (
|
|
|
226
226
|
),
|
|
227
227
|
(
|
|
228
228
|
theme: themes.$g90,
|
|
229
|
-
value: colors.$blue-
|
|
229
|
+
value: colors.$blue-70,
|
|
230
230
|
),
|
|
231
231
|
(
|
|
232
232
|
theme: themes.$g100,
|
|
233
|
-
value: colors.$blue-
|
|
233
|
+
value: colors.$blue-70,
|
|
234
234
|
),
|
|
235
235
|
),
|
|
236
236
|
) !default;
|
|
@@ -248,11 +248,11 @@ $tag-color-blue: (
|
|
|
248
248
|
),
|
|
249
249
|
(
|
|
250
250
|
theme: themes.$g90,
|
|
251
|
-
value: colors.$blue-
|
|
251
|
+
value: colors.$blue-20,
|
|
252
252
|
),
|
|
253
253
|
(
|
|
254
254
|
theme: themes.$g100,
|
|
255
|
-
value: colors.$blue-
|
|
255
|
+
value: colors.$blue-20,
|
|
256
256
|
),
|
|
257
257
|
),
|
|
258
258
|
) !default;
|
|
@@ -270,11 +270,11 @@ $tag-hover-blue: (
|
|
|
270
270
|
),
|
|
271
271
|
(
|
|
272
272
|
theme: themes.$g90,
|
|
273
|
-
value: colors.$blue-70,
|
|
273
|
+
value: colors.$blue-70-hover,
|
|
274
274
|
),
|
|
275
275
|
(
|
|
276
276
|
theme: themes.$g100,
|
|
277
|
-
value: colors.$blue-70,
|
|
277
|
+
value: colors.$blue-70-hover,
|
|
278
278
|
),
|
|
279
279
|
),
|
|
280
280
|
) !default;
|
|
@@ -293,11 +293,11 @@ $tag-background-cyan: (
|
|
|
293
293
|
),
|
|
294
294
|
(
|
|
295
295
|
theme: themes.$g90,
|
|
296
|
-
value: colors.$cyan-
|
|
296
|
+
value: colors.$cyan-70,
|
|
297
297
|
),
|
|
298
298
|
(
|
|
299
299
|
theme: themes.$g100,
|
|
300
|
-
value: colors.$cyan-
|
|
300
|
+
value: colors.$cyan-70,
|
|
301
301
|
),
|
|
302
302
|
),
|
|
303
303
|
) !default;
|
|
@@ -315,11 +315,11 @@ $tag-color-cyan: (
|
|
|
315
315
|
),
|
|
316
316
|
(
|
|
317
317
|
theme: themes.$g90,
|
|
318
|
-
value: colors.$cyan-
|
|
318
|
+
value: colors.$cyan-20,
|
|
319
319
|
),
|
|
320
320
|
(
|
|
321
321
|
theme: themes.$g100,
|
|
322
|
-
value: colors.$cyan-
|
|
322
|
+
value: colors.$cyan-20,
|
|
323
323
|
),
|
|
324
324
|
),
|
|
325
325
|
) !default;
|
|
@@ -337,11 +337,11 @@ $tag-hover-cyan: (
|
|
|
337
337
|
),
|
|
338
338
|
(
|
|
339
339
|
theme: themes.$g90,
|
|
340
|
-
value: colors.$cyan-70,
|
|
340
|
+
value: colors.$cyan-70-hover,
|
|
341
341
|
),
|
|
342
342
|
(
|
|
343
343
|
theme: themes.$g100,
|
|
344
|
-
value: colors.$cyan-70,
|
|
344
|
+
value: colors.$cyan-70-hover,
|
|
345
345
|
),
|
|
346
346
|
),
|
|
347
347
|
) !default;
|
|
@@ -360,11 +360,11 @@ $tag-background-teal: (
|
|
|
360
360
|
),
|
|
361
361
|
(
|
|
362
362
|
theme: themes.$g90,
|
|
363
|
-
value: colors.$teal-
|
|
363
|
+
value: colors.$teal-70,
|
|
364
364
|
),
|
|
365
365
|
(
|
|
366
366
|
theme: themes.$g100,
|
|
367
|
-
value: colors.$teal-
|
|
367
|
+
value: colors.$teal-70,
|
|
368
368
|
),
|
|
369
369
|
),
|
|
370
370
|
) !default;
|
|
@@ -382,11 +382,11 @@ $tag-color-teal: (
|
|
|
382
382
|
),
|
|
383
383
|
(
|
|
384
384
|
theme: themes.$g90,
|
|
385
|
-
value: colors.$teal-
|
|
385
|
+
value: colors.$teal-20,
|
|
386
386
|
),
|
|
387
387
|
(
|
|
388
388
|
theme: themes.$g100,
|
|
389
|
-
value: colors.$teal-
|
|
389
|
+
value: colors.$teal-20,
|
|
390
390
|
),
|
|
391
391
|
),
|
|
392
392
|
) !default;
|
|
@@ -404,11 +404,11 @@ $tag-hover-teal: (
|
|
|
404
404
|
),
|
|
405
405
|
(
|
|
406
406
|
theme: themes.$g90,
|
|
407
|
-
value: colors.$teal-70,
|
|
407
|
+
value: colors.$teal-70-hover,
|
|
408
408
|
),
|
|
409
409
|
(
|
|
410
410
|
theme: themes.$g100,
|
|
411
|
-
value: colors.$teal-70,
|
|
411
|
+
value: colors.$teal-70-hover,
|
|
412
412
|
),
|
|
413
413
|
),
|
|
414
414
|
) !default;
|
|
@@ -427,11 +427,11 @@ $tag-background-green: (
|
|
|
427
427
|
),
|
|
428
428
|
(
|
|
429
429
|
theme: themes.$g90,
|
|
430
|
-
value: colors.$green-
|
|
430
|
+
value: colors.$green-70,
|
|
431
431
|
),
|
|
432
432
|
(
|
|
433
433
|
theme: themes.$g100,
|
|
434
|
-
value: colors.$green-
|
|
434
|
+
value: colors.$green-70,
|
|
435
435
|
),
|
|
436
436
|
),
|
|
437
437
|
) !default;
|
|
@@ -449,11 +449,11 @@ $tag-color-green: (
|
|
|
449
449
|
),
|
|
450
450
|
(
|
|
451
451
|
theme: themes.$g90,
|
|
452
|
-
value: colors.$green-
|
|
452
|
+
value: colors.$green-20,
|
|
453
453
|
),
|
|
454
454
|
(
|
|
455
455
|
theme: themes.$g100,
|
|
456
|
-
value: colors.$green-
|
|
456
|
+
value: colors.$green-20,
|
|
457
457
|
),
|
|
458
458
|
),
|
|
459
459
|
) !default;
|
|
@@ -471,11 +471,11 @@ $tag-hover-green: (
|
|
|
471
471
|
),
|
|
472
472
|
(
|
|
473
473
|
theme: themes.$g90,
|
|
474
|
-
value: colors.$green-70,
|
|
474
|
+
value: colors.$green-70-hover,
|
|
475
475
|
),
|
|
476
476
|
(
|
|
477
477
|
theme: themes.$g100,
|
|
478
|
-
value: colors.$green-70,
|
|
478
|
+
value: colors.$green-70-hover,
|
|
479
479
|
),
|
|
480
480
|
),
|
|
481
481
|
) !default;
|
|
@@ -494,11 +494,11 @@ $tag-background-gray: (
|
|
|
494
494
|
),
|
|
495
495
|
(
|
|
496
496
|
theme: themes.$g90,
|
|
497
|
-
value: colors.$gray-
|
|
497
|
+
value: colors.$gray-70,
|
|
498
498
|
),
|
|
499
499
|
(
|
|
500
500
|
theme: themes.$g100,
|
|
501
|
-
value: colors.$gray-
|
|
501
|
+
value: colors.$gray-70,
|
|
502
502
|
),
|
|
503
503
|
),
|
|
504
504
|
) !default;
|
|
@@ -516,11 +516,11 @@ $tag-color-gray: (
|
|
|
516
516
|
),
|
|
517
517
|
(
|
|
518
518
|
theme: themes.$g90,
|
|
519
|
-
value: colors.$gray-
|
|
519
|
+
value: colors.$gray-20,
|
|
520
520
|
),
|
|
521
521
|
(
|
|
522
522
|
theme: themes.$g100,
|
|
523
|
-
value: colors.$gray-
|
|
523
|
+
value: colors.$gray-20,
|
|
524
524
|
),
|
|
525
525
|
),
|
|
526
526
|
) !default;
|
|
@@ -538,11 +538,11 @@ $tag-hover-gray: (
|
|
|
538
538
|
),
|
|
539
539
|
(
|
|
540
540
|
theme: themes.$g90,
|
|
541
|
-
value: colors.$gray-70,
|
|
541
|
+
value: colors.$gray-70-hover,
|
|
542
542
|
),
|
|
543
543
|
(
|
|
544
544
|
theme: themes.$g100,
|
|
545
|
-
value: colors.$gray-70,
|
|
545
|
+
value: colors.$gray-70-hover,
|
|
546
546
|
),
|
|
547
547
|
),
|
|
548
548
|
) !default;
|
|
@@ -561,11 +561,11 @@ $tag-background-cool-gray: (
|
|
|
561
561
|
),
|
|
562
562
|
(
|
|
563
563
|
theme: themes.$g90,
|
|
564
|
-
value: colors.$cool-gray-
|
|
564
|
+
value: colors.$cool-gray-70,
|
|
565
565
|
),
|
|
566
566
|
(
|
|
567
567
|
theme: themes.$g100,
|
|
568
|
-
value: colors.$cool-gray-
|
|
568
|
+
value: colors.$cool-gray-70,
|
|
569
569
|
),
|
|
570
570
|
),
|
|
571
571
|
) !default;
|
|
@@ -583,11 +583,11 @@ $tag-color-cool-gray: (
|
|
|
583
583
|
),
|
|
584
584
|
(
|
|
585
585
|
theme: themes.$g90,
|
|
586
|
-
value: colors.$cool-gray-
|
|
586
|
+
value: colors.$cool-gray-20,
|
|
587
587
|
),
|
|
588
588
|
(
|
|
589
589
|
theme: themes.$g100,
|
|
590
|
-
value: colors.$cool-gray-
|
|
590
|
+
value: colors.$cool-gray-20,
|
|
591
591
|
),
|
|
592
592
|
),
|
|
593
593
|
) !default;
|
|
@@ -605,11 +605,11 @@ $tag-hover-cool-gray: (
|
|
|
605
605
|
),
|
|
606
606
|
(
|
|
607
607
|
theme: themes.$g90,
|
|
608
|
-
value: colors.$cool-gray-70,
|
|
608
|
+
value: colors.$cool-gray-70-hover,
|
|
609
609
|
),
|
|
610
610
|
(
|
|
611
611
|
theme: themes.$g100,
|
|
612
|
-
value: colors.$cool-gray-70,
|
|
612
|
+
value: colors.$cool-gray-70-hover,
|
|
613
613
|
),
|
|
614
614
|
),
|
|
615
615
|
) !default;
|
|
@@ -628,11 +628,11 @@ $tag-background-warm-gray: (
|
|
|
628
628
|
),
|
|
629
629
|
(
|
|
630
630
|
theme: themes.$g90,
|
|
631
|
-
value: colors.$warm-gray-
|
|
631
|
+
value: colors.$warm-gray-70,
|
|
632
632
|
),
|
|
633
633
|
(
|
|
634
634
|
theme: themes.$g100,
|
|
635
|
-
value: colors.$warm-gray-
|
|
635
|
+
value: colors.$warm-gray-70,
|
|
636
636
|
),
|
|
637
637
|
),
|
|
638
638
|
) !default;
|
|
@@ -650,11 +650,11 @@ $tag-color-warm-gray: (
|
|
|
650
650
|
),
|
|
651
651
|
(
|
|
652
652
|
theme: themes.$g90,
|
|
653
|
-
value: colors.$warm-gray-
|
|
653
|
+
value: colors.$warm-gray-20,
|
|
654
654
|
),
|
|
655
655
|
(
|
|
656
656
|
theme: themes.$g100,
|
|
657
|
-
value: colors.$warm-gray-
|
|
657
|
+
value: colors.$warm-gray-20,
|
|
658
658
|
),
|
|
659
659
|
),
|
|
660
660
|
) !default;
|
|
@@ -672,11 +672,11 @@ $tag-hover-warm-gray: (
|
|
|
672
672
|
),
|
|
673
673
|
(
|
|
674
674
|
theme: themes.$g90,
|
|
675
|
-
value: colors.$warm-gray-70,
|
|
675
|
+
value: colors.$warm-gray-70-hover,
|
|
676
676
|
),
|
|
677
677
|
(
|
|
678
678
|
theme: themes.$g100,
|
|
679
|
-
value: colors.$warm-gray-70,
|
|
679
|
+
value: colors.$warm-gray-70-hover,
|
|
680
680
|
),
|
|
681
681
|
),
|
|
682
682
|
) !default;
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
# `scss/fonts`
|
|
2
|
+
|
|
3
|
+
The `scss/fonts` folder provides a way to incorporate IBM Plex into your
|
|
4
|
+
project. Below is a table of what fonts are currently supported from IBM Plex in
|
|
5
|
+
Carbon:
|
|
6
|
+
|
|
7
|
+
| Font | Available | Entrypoint |
|
|
8
|
+
| ------------------------- | --------- | ----------------------------- |
|
|
9
|
+
| IBM Plex Mono | ✅ | `scss/fonts/mono` |
|
|
10
|
+
| IBM Plex Sans Arabic | ✅ | `scss/fonts/sans-arabic` |
|
|
11
|
+
| IBM Plex Sans Devanagari | ✅ | `scss/fonts/sans-devanagari` |
|
|
12
|
+
| IBM Plex Sans Hebrew | ✅ | `scss/fonts/sans-hebrew` |
|
|
13
|
+
| IBM Plex Sans KR | | |
|
|
14
|
+
| IBM Plex Sans JP | | |
|
|
15
|
+
| IBM Plex Sans Thai Looped | ✅ | `scss/fonts/sans-thai-looped` |
|
|
16
|
+
| IBM Plex Sans Thai | ✅ | `scss/fonts/sans-thai` |
|
|
17
|
+
| IBM Plex Sans | ✅ | `scss/fonts/sans` |
|
|
18
|
+
| IBM Plex Serif | ✅ | `scss/fonts/serif` |
|
|
19
|
+
|
|
20
|
+
By default, Carbon provides the default font weights for: IBM Plex Mono, IBM
|
|
21
|
+
Plex Sans, and IBM Plex Serif. To bring in additional fonts, you can include the
|
|
22
|
+
`@carbon/styles/scss/fonts` entrypoint and configure it:
|
|
23
|
+
|
|
24
|
+
```scss
|
|
25
|
+
@use '@carbon/styles/scss/fonts' with (
|
|
26
|
+
$fonts: (
|
|
27
|
+
IBM-Plex-Sans-Arabic: true,
|
|
28
|
+
),
|
|
29
|
+
);
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
You can also configure it to disable specific fonts:
|
|
33
|
+
|
|
34
|
+
```scss
|
|
35
|
+
@use '@carbon/styles/scss/fonts' with (
|
|
36
|
+
$fonts: (
|
|
37
|
+
IBM-Plex-Sans: false,
|
|
38
|
+
),
|
|
39
|
+
);
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
If you would like to disable all fonts, you can use the `$css--font-face` flag
|
|
43
|
+
in:
|
|
44
|
+
|
|
45
|
+
```scss
|
|
46
|
+
@use '@carbon/styles/scss/config' with (
|
|
47
|
+
$css--font-face: false,
|
|
48
|
+
);
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Features
|
|
52
|
+
|
|
53
|
+
Each font is available as an entrypoint in the `fonts` folder. You can use these
|
|
54
|
+
entrypoints to include specific font weights, styles, and more for IBM Plex. For
|
|
55
|
+
example, if you only want to include the regular font weight for IBM Plex Sans
|
|
56
|
+
then you could do the following:
|
|
57
|
+
|
|
58
|
+
```scss
|
|
59
|
+
@use '@carbon/styles/scss/fonts/sans';
|
|
60
|
+
|
|
61
|
+
@include sans.regular($styles: normal);
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Each font entrypoint supports the following weights:
|
|
65
|
+
|
|
66
|
+
- `thin`
|
|
67
|
+
- `extralight`
|
|
68
|
+
- `light`
|
|
69
|
+
- `regular`
|
|
70
|
+
- `tex`
|
|
71
|
+
- `medium`
|
|
72
|
+
- `semibold`
|
|
73
|
+
- `bold`
|
|
74
|
+
|
|
75
|
+
All fonts support the `normal` font style, some fonts include support for the
|
|
76
|
+
`italic` font style, as well.
|
|
77
|
+
|
|
78
|
+
### Custom font src resolver
|
|
79
|
+
|
|
80
|
+
By default, `@carbon/styles/scss/fonts` attempts to resolve fonts directly from
|
|
81
|
+
the `@ibm/plex` package. You can configure the location of these font files in
|
|
82
|
+
two ways:
|
|
83
|
+
|
|
84
|
+
- Use the `$font-path` option to define a path "prefix"
|
|
85
|
+
- Provide a custom resolver to point to where your font files are hosted
|
|
86
|
+
|
|
87
|
+
The `$font-path` options is available in `scss/config`:
|
|
88
|
+
|
|
89
|
+
```scss
|
|
90
|
+
@use '@carbon/styles/scss/config' with (
|
|
91
|
+
$font-path: 'https://cdn.custom-font-path.com/fonts',
|
|
92
|
+
);
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
And allows you to change the beginning part of each `src` URL that is generated.
|
|
96
|
+
You can also completely override the default behavior and provide your own URL
|
|
97
|
+
resolver through `scss/fonts/src`:
|
|
98
|
+
|
|
99
|
+
```scss
|
|
100
|
+
@use 'sass:meta';
|
|
101
|
+
@use './my-custom-resolver' as resolver;
|
|
102
|
+
@use '@carbon/styles/scss/fonts/src' with (
|
|
103
|
+
// Here, "resolve" is the name of the function in the "resolver" module
|
|
104
|
+
$resolver: meta.get-function('resolve', 'resolver')
|
|
105
|
+
);
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
This can be particularly useful for self-hosted projects that are not using
|
|
109
|
+
webpack. This custom resolver should follow the signature:
|
|
110
|
+
|
|
111
|
+
```scss
|
|
112
|
+
/// @param {String} $name
|
|
113
|
+
/// @param {String} $weight
|
|
114
|
+
/// @param {String} $style
|
|
115
|
+
/// @param {String} $unicode-range
|
|
116
|
+
/// @param {List} $formats
|
|
117
|
+
/// @returns List
|
|
118
|
+
@function resolver($name, $weight, $style, $unicode-range, $formats) {
|
|
119
|
+
// Here, you will need to return a list of url() format() that will be used in
|
|
120
|
+
// the src property
|
|
121
|
+
}
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## Contributing
|
|
125
|
+
|
|
126
|
+
**How do I add support for a font?**
|
|
127
|
+
|
|
128
|
+
You will need to do the following:
|
|
129
|
+
|
|
130
|
+
- [ ] Create a file for the font under `scss/fonts/`, for example
|
|
131
|
+
`scss/fonts/_sans-arabic.scss`
|
|
132
|
+
- [ ] Define all available weights as mixins in that file
|
|
133
|
+
- [ ] Emit `@font-face` blocks in each font weight mixin
|
|
134
|
+
- [ ] Add a `default` mixin for the default font weights to include for a font
|
|
135
|
+
- [ ] Add an `all` mixin which emits all font weights
|
|
136
|
+
- [ ] Export a `$name` variable for the name of the font to be used to detect if
|
|
137
|
+
a font should be auto-included
|
|
138
|
+
- [ ] Add the base font name to the `$-filenames` map in `fonts/_src.scss`. This
|
|
139
|
+
will be used in the font src resolver to get the correct path from
|
|
140
|
+
`@ibm/plex`
|
|
141
|
+
- [ ] In `fonts/_index.scss`
|
|
142
|
+
- [ ] Update the `$-fonts` map to include the `$name` for the font and specify
|
|
143
|
+
whether it should be included automatically
|
|
144
|
+
- [ ] Update the block at the end of the file to call the default mixin of the
|
|
145
|
+
file if the font is enabled
|
|
146
|
+
- [ ] Update `packages/carbon-react/tasks/build-styles.js` to include the font
|
|
147
|
+
file as a re-export
|
|
148
|
+
- [ ] Add a story for the font in `Plex.stories.js`
|
|
@@ -0,0 +1,75 @@
|
|
|
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
|
+
@use 'sass:meta';
|
|
9
|
+
@use 'sass:map';
|
|
10
|
+
@use '../config';
|
|
11
|
+
@use './mono';
|
|
12
|
+
@use './sans-arabic';
|
|
13
|
+
@use './sans-devanagari';
|
|
14
|
+
@use './sans-hebrew';
|
|
15
|
+
@use './sans-thai-looped';
|
|
16
|
+
@use './sans-thai';
|
|
17
|
+
@use './sans';
|
|
18
|
+
@use './serif';
|
|
19
|
+
|
|
20
|
+
$-fonts: (
|
|
21
|
+
IBM-Plex-Mono: true,
|
|
22
|
+
IBM-Plex-Sans-Arabic: false,
|
|
23
|
+
IBM-Plex-Sans-Devanagari: false,
|
|
24
|
+
IBM-Plex-Sans-Hebrew: false,
|
|
25
|
+
IBM-Plex-Sans-Thai-Looped: false,
|
|
26
|
+
IBM-Plex-Sans-Thai: false,
|
|
27
|
+
IBM-Plex-Sans: true,
|
|
28
|
+
IBM-Plex-Serif: true,
|
|
29
|
+
);
|
|
30
|
+
$fonts: () !default;
|
|
31
|
+
$fonts: map.merge($-fonts, $fonts);
|
|
32
|
+
|
|
33
|
+
/// Determine if the given font has been enabled or not
|
|
34
|
+
/// @param String $name
|
|
35
|
+
/// @returns Boolean
|
|
36
|
+
@function enabled($name) {
|
|
37
|
+
@if map.has-key($fonts, $name) {
|
|
38
|
+
@return map.get($fonts, $name);
|
|
39
|
+
}
|
|
40
|
+
@return false;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
@if config.$css--font-face == true {
|
|
44
|
+
@if enabled(mono.$name) {
|
|
45
|
+
@include mono.default();
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
@if enabled(sans-arabic.$name) {
|
|
49
|
+
@include sans-arabic.default();
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
@if enabled(sans-devanagari.$name) {
|
|
53
|
+
@include sans-devanagari.default();
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
@if enabled(sans-hebrew.$name) {
|
|
57
|
+
@include sans-hebrew.default();
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
@if enabled(sans-thai-looped.$name) {
|
|
61
|
+
@include sans-thai-looped.default();
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
@if enabled(sans-thai.$name) {
|
|
65
|
+
@include sans-thai.default();
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
@if enabled(sans.$name) {
|
|
69
|
+
@include sans.default();
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
@if enabled(serif.$name) {
|
|
73
|
+
@include serif.default();
|
|
74
|
+
}
|
|
75
|
+
}
|