@carbon/styles 0.9.0-rc.0 → 0.11.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.
@@ -0,0 +1,153 @@
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 '../config';
9
+ @use './src';
10
+ @use './unicode';
11
+
12
+ $font-family: 'IBM Plex Sans';
13
+ $name: 'IBM-Plex-Sans';
14
+ $styles: (normal, italic);
15
+ $unicode-ranges: (Cyrillic, Pi, Latin3, Latin2, Latin1);
16
+ $formats: (woff2, woff);
17
+
18
+ @mixin thin($styles: $styles, $unicode-ranges: $unicode-ranges) {
19
+ @each $style in $styles {
20
+ @each $unicode-range in $unicode-ranges {
21
+ @font-face {
22
+ font-display: config.$font-display;
23
+ font-family: $font-family;
24
+ font-style: $style;
25
+ font-weight: 100;
26
+ src: src.get($name, Thin, $style, $unicode-range, $formats);
27
+ unicode-range: unicode.get-range($unicode-range);
28
+ }
29
+ }
30
+ }
31
+ }
32
+
33
+ @mixin extralight($styles: $styles, $unicode-ranges: $unicode-ranges) {
34
+ @each $style in $styles {
35
+ @each $unicode-range in $unicode-ranges {
36
+ @font-face {
37
+ font-display: config.$font-display;
38
+ font-family: $font-family;
39
+ font-style: $style;
40
+ font-weight: 200;
41
+ src: src.get($name, ExtraLight, $style, $unicode-range, $formats);
42
+ unicode-range: unicode.get-range($unicode-range);
43
+ }
44
+ }
45
+ }
46
+ }
47
+
48
+ @mixin light($styles: $styles, $unicode-ranges: $unicode-ranges) {
49
+ @each $style in $styles {
50
+ @each $unicode-range in $unicode-ranges {
51
+ @font-face {
52
+ font-display: config.$font-display;
53
+ font-family: $font-family;
54
+ font-style: $style;
55
+ font-weight: 300;
56
+ src: src.get($name, Light, $style, $unicode-range, $formats);
57
+ unicode-range: unicode.get-range($unicode-range);
58
+ }
59
+ }
60
+ }
61
+ }
62
+
63
+ @mixin regular($styles: $styles, $unicode-ranges: $unicode-ranges) {
64
+ @each $style in $styles {
65
+ @each $unicode-range in $unicode-ranges {
66
+ @font-face {
67
+ font-display: config.$font-display;
68
+ font-family: $font-family;
69
+ font-style: $style;
70
+ font-weight: 400;
71
+ src: src.get($name, Regular, $style, $unicode-range, $formats);
72
+ unicode-range: unicode.get-range($unicode-range);
73
+ }
74
+ }
75
+ }
76
+ }
77
+
78
+ @mixin text($styles: $styles, $unicode-ranges: $unicode-ranges) {
79
+ @each $style in $styles {
80
+ @each $unicode-range in $unicode-ranges {
81
+ @font-face {
82
+ font-display: config.$font-display;
83
+ font-family: $font-family;
84
+ font-style: $style;
85
+ font-weight: 450;
86
+ src: src.get($name, Text, $style, $unicode-range, $formats);
87
+ unicode-range: unicode.get-range($unicode-range);
88
+ }
89
+ }
90
+ }
91
+ }
92
+
93
+ @mixin medium($styles: $styles, $unicode-ranges: $unicode-ranges) {
94
+ @each $style in $styles {
95
+ @each $unicode-range in $unicode-ranges {
96
+ @font-face {
97
+ font-display: config.$font-display;
98
+ font-family: $font-family;
99
+ font-style: $style;
100
+ font-weight: 500;
101
+ src: src.get($name, Medium, $style, $unicode-range, $formats);
102
+ unicode-range: unicode.get-range($unicode-range);
103
+ }
104
+ }
105
+ }
106
+ }
107
+
108
+ @mixin semibold($styles: $styles, $unicode-ranges: $unicode-ranges) {
109
+ @each $style in $styles {
110
+ @each $unicode-range in $unicode-ranges {
111
+ @font-face {
112
+ font-display: config.$font-display;
113
+ font-family: $font-family;
114
+ font-style: $style;
115
+ font-weight: 600;
116
+ src: src.get($name, SemiBold, $style, $unicode-range, $formats);
117
+ unicode-range: unicode.get-range($unicode-range);
118
+ }
119
+ }
120
+ }
121
+ }
122
+
123
+ @mixin bold($styles: $styles, $unicode-ranges: $unicode-ranges) {
124
+ @each $style in $styles {
125
+ @each $unicode-range in $unicode-ranges {
126
+ @font-face {
127
+ font-display: config.$font-display;
128
+ font-family: $font-family;
129
+ font-style: $style;
130
+ font-weight: 700;
131
+ src: src.get($name, Bold, $style, $unicode-range, $formats);
132
+ unicode-range: unicode.get-range($unicode-range);
133
+ }
134
+ }
135
+ }
136
+ }
137
+
138
+ @mixin all($styles: $styles, $unicode-ranges: $unicode-ranges) {
139
+ @include thin($styles, $unicode-ranges);
140
+ @include extralight($styles, $unicode-ranges);
141
+ @include light($styles, $unicode-ranges);
142
+ @include regular($styles, $unicode-ranges);
143
+ @include text($styles, $unicode-ranges);
144
+ @include medium($styles, $unicode-ranges);
145
+ @include semibold($styles, $unicode-ranges);
146
+ @include bold($styles, $unicode-ranges);
147
+ }
148
+
149
+ @mixin default() {
150
+ @include light();
151
+ @include regular();
152
+ @include semibold();
153
+ }
@@ -0,0 +1,153 @@
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 '../config';
9
+ @use './src';
10
+ @use './unicode';
11
+
12
+ $font-family: 'IBM Plex Serif';
13
+ $name: 'IBM-Plex-Serif';
14
+ $styles: (normal, italic);
15
+ $unicode-ranges: (Cyrillic, Pi, Latin3, Latin2, Latin1);
16
+ $formats: (woff2, woff);
17
+
18
+ @mixin thin($styles: $styles, $unicode-ranges: $unicode-ranges) {
19
+ @each $style in $styles {
20
+ @each $unicode-range in $unicode-ranges {
21
+ @font-face {
22
+ font-display: config.$font-display;
23
+ font-family: $font-family;
24
+ font-style: $style;
25
+ font-weight: 100;
26
+ src: src.get($name, Thin, $style, $unicode-range, $formats);
27
+ unicode-range: unicode.get-range($unicode-range);
28
+ }
29
+ }
30
+ }
31
+ }
32
+
33
+ @mixin extralight($styles: $styles, $unicode-ranges: $unicode-ranges) {
34
+ @each $style in $styles {
35
+ @each $unicode-range in $unicode-ranges {
36
+ @font-face {
37
+ font-display: config.$font-display;
38
+ font-family: $font-family;
39
+ font-style: $style;
40
+ font-weight: 200;
41
+ src: src.get($name, ExtraLight, $style, $unicode-range, $formats);
42
+ unicode-range: unicode.get-range($unicode-range);
43
+ }
44
+ }
45
+ }
46
+ }
47
+
48
+ @mixin light($styles: $styles, $unicode-ranges: $unicode-ranges) {
49
+ @each $style in $styles {
50
+ @each $unicode-range in $unicode-ranges {
51
+ @font-face {
52
+ font-display: config.$font-display;
53
+ font-family: $font-family;
54
+ font-style: $style;
55
+ font-weight: 300;
56
+ src: src.get($name, Light, $style, $unicode-range, $formats);
57
+ unicode-range: unicode.get-range($unicode-range);
58
+ }
59
+ }
60
+ }
61
+ }
62
+
63
+ @mixin regular($styles: $styles, $unicode-ranges: $unicode-ranges) {
64
+ @each $style in $styles {
65
+ @each $unicode-range in $unicode-ranges {
66
+ @font-face {
67
+ font-display: config.$font-display;
68
+ font-family: $font-family;
69
+ font-style: $style;
70
+ font-weight: 400;
71
+ src: src.get($name, Regular, $style, $unicode-range, $formats);
72
+ unicode-range: unicode.get-range($unicode-range);
73
+ }
74
+ }
75
+ }
76
+ }
77
+
78
+ @mixin text($styles: $styles, $unicode-ranges: $unicode-ranges) {
79
+ @each $style in $styles {
80
+ @each $unicode-range in $unicode-ranges {
81
+ @font-face {
82
+ font-display: config.$font-display;
83
+ font-family: $font-family;
84
+ font-style: $style;
85
+ font-weight: 450;
86
+ src: src.get($name, Text, $style, $unicode-range, $formats);
87
+ unicode-range: unicode.get-range($unicode-range);
88
+ }
89
+ }
90
+ }
91
+ }
92
+
93
+ @mixin medium($styles: $styles, $unicode-ranges: $unicode-ranges) {
94
+ @each $style in $styles {
95
+ @each $unicode-range in $unicode-ranges {
96
+ @font-face {
97
+ font-display: config.$font-display;
98
+ font-family: $font-family;
99
+ font-style: $style;
100
+ font-weight: 500;
101
+ src: src.get($name, Medium, $style, $unicode-range, $formats);
102
+ unicode-range: unicode.get-range($unicode-range);
103
+ }
104
+ }
105
+ }
106
+ }
107
+
108
+ @mixin semibold($styles: $styles, $unicode-ranges: $unicode-ranges) {
109
+ @each $style in $styles {
110
+ @each $unicode-range in $unicode-ranges {
111
+ @font-face {
112
+ font-display: config.$font-display;
113
+ font-family: $font-family;
114
+ font-style: $style;
115
+ font-weight: 600;
116
+ src: src.get($name, SemiBold, $style, $unicode-range, $formats);
117
+ unicode-range: unicode.get-range($unicode-range);
118
+ }
119
+ }
120
+ }
121
+ }
122
+
123
+ @mixin bold($styles: $styles, $unicode-ranges: $unicode-ranges) {
124
+ @each $style in $styles {
125
+ @each $unicode-range in $unicode-ranges {
126
+ @font-face {
127
+ font-display: config.$font-display;
128
+ font-family: $font-family;
129
+ font-style: $style;
130
+ font-weight: 700;
131
+ src: src.get($name, Bold, $style, $unicode-range, $formats);
132
+ unicode-range: unicode.get-range($unicode-range);
133
+ }
134
+ }
135
+ }
136
+ }
137
+
138
+ @mixin all($styles: $styles, $unicode-ranges: $unicode-ranges) {
139
+ @include thin($styles, $unicode-ranges);
140
+ @include extralight($styles, $unicode-ranges);
141
+ @include light($styles, $unicode-ranges);
142
+ @include regular($styles, $unicode-ranges);
143
+ @include text($styles, $unicode-ranges);
144
+ @include medium($styles, $unicode-ranges);
145
+ @include semibold($styles, $unicode-ranges);
146
+ @include bold($styles, $unicode-ranges);
147
+ }
148
+
149
+ @mixin default() {
150
+ @include light();
151
+ @include regular();
152
+ @include semibold();
153
+ }
@@ -0,0 +1,102 @@
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 '../config';
9
+ @use 'sass:list';
10
+ @use 'sass:map';
11
+ @use 'sass:meta';
12
+
13
+ $-filenames: (
14
+ IBM-Plex-Mono: 'IBMPlexMono',
15
+ IBM-Plex-Sans-Arabic: 'IBMPlexSansArabic',
16
+ IBM-Plex-Sans-Devanagari: 'IBMPlexSansDevanagari',
17
+ IBM-Plex-Sans-Hebrew: 'IBMPlexSansHebrew',
18
+ IBM-Plex-Sans-Thai-Looped: 'IBMPlexSansThaiLooped',
19
+ IBM-Plex-Sans-Thai: 'IBMPlexSansThai',
20
+ IBM-Plex-Sans: 'IBMPlexSans',
21
+ IBM-Plex-Serif: 'IBMPlexSerif',
22
+ );
23
+
24
+ @function -get-base-filename($name) {
25
+ @return map.get($-filenames, $name);
26
+ }
27
+
28
+ /// The default resolver for locating a font file in the `@ibm/plex` package.
29
+ /// This function will return a path that will work in bundling tools like
30
+ /// webpack but will not work without a tool that understands paths that are
31
+ /// prefixed with `~`
32
+ ///
33
+ /// @param {String} $name
34
+ /// @param {String} $weight
35
+ /// @param {String} $style
36
+ /// @param {String} $unicode-range
37
+ /// @param {List} $formats
38
+ /// @returns List
39
+ @function -default-resolver($name, $weight, $style, $unicode-range, $formats) {
40
+ $filename: -get-base-filename($name);
41
+
42
+ // Special case for weight = Regular (400)
43
+ @if $weight == Regular {
44
+ @if $style == italic {
45
+ $filename: '#{$filename}-Italic';
46
+ } @else {
47
+ $filename: '#{$filename}-Regular';
48
+ }
49
+ } @else {
50
+ // Otherwise add weight + optional style (italic)
51
+ $filename: '#{$filename}-#{$weight}';
52
+ @if $style == italic {
53
+ $filename: '#{$filename}Italic';
54
+ }
55
+ }
56
+
57
+ $filenames: ();
58
+
59
+ @each $format in $formats {
60
+ $url: $filename;
61
+
62
+ @if $unicode-range {
63
+ $url: '#{config.$font-path}/#{$name}/fonts/split/#{$format}/#{$filename}-#{$unicode-range}';
64
+ } @else {
65
+ $url: '#{config.$font-path}/#{$name}/fonts/complete/#{$format}/#{$filename}';
66
+ }
67
+
68
+ // Add extension
69
+ $url: '#{$url}.#{$format}';
70
+ $filenames: list.append(
71
+ $filenames,
72
+ url('#{$url}') format('#{$format}'),
73
+ $separator: comma
74
+ );
75
+ }
76
+
77
+ @return $filenames;
78
+ }
79
+
80
+ /// The resolver used for locating the filepaths in `url() format()` values in
81
+ /// @font-face blocks
82
+ $resolver: meta.get-function('-default-resolver') !default;
83
+
84
+ /// Retrieve the list of `url() format()` values used in the `src` property in
85
+ /// an `@font-face` block
86
+
87
+ /// @param {String} $name
88
+ /// @param {String} $weight
89
+ /// @param {String} $style
90
+ /// @param {String} $unicode-range
91
+ /// @param {List} $formats
92
+ /// @returns List
93
+ @function get($name, $weight, $style, $unicode-range: null, $formats) {
94
+ @return meta.call(
95
+ $resolver,
96
+ $name: $name,
97
+ $weight: $weight,
98
+ $style: $style,
99
+ $unicode-range: $unicode-range,
100
+ $formats: $formats
101
+ );
102
+ }
@@ -0,0 +1,124 @@
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:map';
9
+
10
+ /// All available unicode ranges where the keys are unicode range names and the
11
+ /// value is the list of unicode ranges that are applicable
12
+ /// @type {List}
13
+ $ranges: (
14
+ Cyrillic: (
15
+ 'U+0400-045F',
16
+ 'U+0472-0473',
17
+ 'U+0490-049D',
18
+ 'U+04A0-04A5',
19
+ 'U+04AA-04AB',
20
+ 'U+04AE-04B3',
21
+ 'U+04B6-04BB',
22
+ 'U+04C0-04C2',
23
+ 'U+04CF-04D9',
24
+ 'U+04DC-04DF',
25
+ 'U+04E2-04E9',
26
+ 'U+04EE-04F5',
27
+ 'U+04F8-04F9',
28
+ ),
29
+ Greek: (
30
+ 'U+0384-038A',
31
+ 'U+038C',
32
+ 'U+038E-03A1',
33
+ 'U+03A3-03CE',
34
+ ),
35
+ Latin1: (
36
+ 'U+0000',
37
+ 'U+000D',
38
+ 'U+0020-007E',
39
+ 'U+00A0-00A3',
40
+ 'U+00A4-00FF',
41
+ 'U+0131',
42
+ 'U+0152-0153',
43
+ 'U+02C6',
44
+ 'U+02DA',
45
+ 'U+02DC',
46
+ 'U+2013-2014',
47
+ 'U+2018-201A',
48
+ 'U+201C-201E',
49
+ 'U+2020-2022',
50
+ 'U+2026',
51
+ 'U+2030',
52
+ 'U+2039-203A',
53
+ 'U+2044',
54
+ 'U+2074',
55
+ 'U+20AC',
56
+ 'U+2122',
57
+ 'U+2212',
58
+ 'U+FB01-FB02',
59
+ ),
60
+ Latin2: (
61
+ 'U+0100-024F',
62
+ 'U+0259',
63
+ 'U+1E00-1EFF',
64
+ 'U+20A0-20AB',
65
+ 'U+20AD-20CF',
66
+ 'U+2C60-2C7F',
67
+ 'U+A720-A7FF',
68
+ 'U+FB01-FB02',
69
+ ),
70
+ Latin3: (
71
+ 'U+0102-0103',
72
+ 'U+1EA0-1EF9',
73
+ 'U+20AB',
74
+ ),
75
+ Pi: (
76
+ 'U+0E3F',
77
+ 'U+2032-2033',
78
+ 'U+2070',
79
+ 'U+2075-2079',
80
+ 'U+2080-2081',
81
+ 'U+2083',
82
+ 'U+2085-2089',
83
+ 'U+2113',
84
+ 'U+2116',
85
+ 'U+2126',
86
+ 'U+212E',
87
+ 'U+2150-2151',
88
+ 'U+2153-215E',
89
+ 'U+2190-2199',
90
+ 'U+21A9-21AA',
91
+ 'U+21B0-21B3',
92
+ 'U+21B6-21B7',
93
+ 'U+21BA-21BB',
94
+ 'U+21C4',
95
+ 'U+21C6',
96
+ 'U+2202',
97
+ 'U+2206',
98
+ 'U+220F',
99
+ 'U+2211',
100
+ 'U+221A',
101
+ 'U+221E',
102
+ 'U+222B',
103
+ 'U+2248',
104
+ 'U+2260',
105
+ 'U+2264-2265',
106
+ 'U+25CA',
107
+ 'U+2713',
108
+ 'U+274C',
109
+ 'U+2B0E-2B11',
110
+ 'U+EBE1-EBE7',
111
+ 'U+ECE0',
112
+ 'U+EFCC',
113
+ ),
114
+ );
115
+
116
+ /// Retrieve the unicode range for a given unicode range name
117
+ /// @param {String} $name
118
+ /// @returns {List}
119
+ @function get-range($name) {
120
+ @if map.has-key($ranges, $name) {
121
+ @return map.get($ranges, $name);
122
+ }
123
+ @error 'Unable to find range with the name: #{$name}';
124
+ }
@@ -1,13 +0,0 @@
1
- @use 'config';
2
- @use '@ibm/plex/default' as sans;
3
- @use '@ibm/plex/mono' as mono;
4
- @use '@ibm/plex/arabic' as arabic;
5
-
6
- @if config.$css--font-face == true {
7
- @include sans.all;
8
- @include mono.all;
9
-
10
- @if config.$css--plex-arabic == true {
11
- @include arabic.all;
12
- }
13
- } ;