@carbon/type 10.20.0-rc.0 → 10.21.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/README.md CHANGED
@@ -250,12 +250,6 @@ There is also a `type-scale` mixin that will set `font-size` for your directly:
250
250
  }
251
251
  ```
252
252
 
253
- ## 📖 API Documentation
254
-
255
- If you're looking for `@carbon/type` API documentation, check out:
256
-
257
- - [Sass](./docs/sass.md)
258
-
259
253
  ## 📚 Examples
260
254
 
261
255
  If you're looking for more examples on how to use `@carbon/type`, we have some
package/es/index.js CHANGED
@@ -715,6 +715,38 @@ function subtract(a, b) {
715
715
  * This source code is licensed under the Apache-2.0 license found in the
716
716
  * LICENSE file in the root directory of this source tree.
717
717
  */
718
- var unstable_tokens = ['caption01', 'label01', 'helperText01', 'bodyShort01', 'bodyLong01', 'bodyShort02', 'bodyLong02', 'code01', 'code02', 'heading01', 'productiveHeading01', 'heading02', 'productiveHeading02', 'productiveHeading03', 'productiveHeading04', 'productiveHeading05', 'productiveHeading06', 'productiveHeading07', 'expressiveHeading01', 'expressiveHeading02', 'expressiveHeading03', 'expressiveHeading04', 'expressiveHeading05', 'expressiveHeading06', 'expressiveParagraph01', 'quotation01', 'quotation02', 'display01', 'display02', 'display03', 'display04'];
718
+ // Unstable tokens
719
+ var caption01$1 = 'caption01';
720
+ var label01$1 = 'label01';
721
+ var helperText01$1 = 'helperText01';
722
+ var bodyShort01$1 = 'bodyShort01';
723
+ var bodyLong01$1 = 'bodyLong01';
724
+ var bodyShort02$1 = 'bodyShort02';
725
+ var bodyLong02$1 = 'bodyLong02';
726
+ var code01$1 = 'code01';
727
+ var code02$1 = 'code02';
728
+ var heading01$1 = 'heading01';
729
+ var productiveHeading01$1 = 'productiveHeading01';
730
+ var heading02$1 = 'heading02';
731
+ var productiveHeading02$1 = 'productiveHeading02';
732
+ var productiveHeading03$1 = 'productiveHeading03';
733
+ var productiveHeading04$1 = 'productiveHeading04';
734
+ var productiveHeading05$1 = 'productiveHeading05';
735
+ var productiveHeading06$1 = 'productiveHeading06';
736
+ var productiveHeading07$1 = 'productiveHeading07';
737
+ var expressiveHeading01$1 = 'expressiveHeading01';
738
+ var expressiveHeading02$1 = 'expressiveHeading02';
739
+ var expressiveHeading03$1 = 'expressiveHeading03';
740
+ var expressiveHeading04$1 = 'expressiveHeading04';
741
+ var expressiveHeading05$1 = 'expressiveHeading05';
742
+ var expressiveHeading06$1 = 'expressiveHeading06';
743
+ var expressiveParagraph01$1 = 'expressiveParagraph01';
744
+ var quotation01$1 = 'quotation01';
745
+ var quotation02$1 = 'quotation02';
746
+ var display01$1 = 'display01';
747
+ var display02$1 = 'display02';
748
+ var display03$1 = 'display03';
749
+ var display04$1 = 'display04';
750
+ var unstable_tokens = [caption01$1, label01$1, helperText01$1, bodyShort01$1, bodyLong01$1, bodyShort02$1, bodyLong02$1, code01$1, code02$1, heading01$1, productiveHeading01$1, heading02$1, productiveHeading02$1, productiveHeading03$1, productiveHeading04$1, productiveHeading05$1, productiveHeading06$1, productiveHeading07$1, expressiveHeading01$1, expressiveHeading02$1, expressiveHeading03$1, expressiveHeading04$1, expressiveHeading05$1, expressiveHeading06$1, expressiveParagraph01$1, quotation01$1, quotation02$1, display01$1, display02$1, display03$1, display04$1];
719
751
 
720
752
  export { bodyLong01, bodyLong02, bodyShort01, bodyShort02, caption01, code01, code02, display01, display02, display03, display04, expressiveHeading01, expressiveHeading02, expressiveHeading03, expressiveHeading04, expressiveHeading05, expressiveHeading06, expressiveParagraph01, fluid, fontFamilies, fontFamily, fontWeight, fontWeights, getTypeSize, heading01, heading02, helperText01, label01, print, productiveHeading01, productiveHeading02, productiveHeading03, productiveHeading04, productiveHeading05, productiveHeading06, productiveHeading07, quotation01, quotation02, reset, scale, styles, unstable_tokens };
package/lib/index.js CHANGED
@@ -719,7 +719,39 @@ function subtract(a, b) {
719
719
  * This source code is licensed under the Apache-2.0 license found in the
720
720
  * LICENSE file in the root directory of this source tree.
721
721
  */
722
- var unstable_tokens = ['caption01', 'label01', 'helperText01', 'bodyShort01', 'bodyLong01', 'bodyShort02', 'bodyLong02', 'code01', 'code02', 'heading01', 'productiveHeading01', 'heading02', 'productiveHeading02', 'productiveHeading03', 'productiveHeading04', 'productiveHeading05', 'productiveHeading06', 'productiveHeading07', 'expressiveHeading01', 'expressiveHeading02', 'expressiveHeading03', 'expressiveHeading04', 'expressiveHeading05', 'expressiveHeading06', 'expressiveParagraph01', 'quotation01', 'quotation02', 'display01', 'display02', 'display03', 'display04'];
722
+ // Unstable tokens
723
+ var caption01$1 = 'caption01';
724
+ var label01$1 = 'label01';
725
+ var helperText01$1 = 'helperText01';
726
+ var bodyShort01$1 = 'bodyShort01';
727
+ var bodyLong01$1 = 'bodyLong01';
728
+ var bodyShort02$1 = 'bodyShort02';
729
+ var bodyLong02$1 = 'bodyLong02';
730
+ var code01$1 = 'code01';
731
+ var code02$1 = 'code02';
732
+ var heading01$1 = 'heading01';
733
+ var productiveHeading01$1 = 'productiveHeading01';
734
+ var heading02$1 = 'heading02';
735
+ var productiveHeading02$1 = 'productiveHeading02';
736
+ var productiveHeading03$1 = 'productiveHeading03';
737
+ var productiveHeading04$1 = 'productiveHeading04';
738
+ var productiveHeading05$1 = 'productiveHeading05';
739
+ var productiveHeading06$1 = 'productiveHeading06';
740
+ var productiveHeading07$1 = 'productiveHeading07';
741
+ var expressiveHeading01$1 = 'expressiveHeading01';
742
+ var expressiveHeading02$1 = 'expressiveHeading02';
743
+ var expressiveHeading03$1 = 'expressiveHeading03';
744
+ var expressiveHeading04$1 = 'expressiveHeading04';
745
+ var expressiveHeading05$1 = 'expressiveHeading05';
746
+ var expressiveHeading06$1 = 'expressiveHeading06';
747
+ var expressiveParagraph01$1 = 'expressiveParagraph01';
748
+ var quotation01$1 = 'quotation01';
749
+ var quotation02$1 = 'quotation02';
750
+ var display01$1 = 'display01';
751
+ var display02$1 = 'display02';
752
+ var display03$1 = 'display03';
753
+ var display04$1 = 'display04';
754
+ var unstable_tokens = [caption01$1, label01$1, helperText01$1, bodyShort01$1, bodyLong01$1, bodyShort02$1, bodyLong02$1, code01$1, code02$1, heading01$1, productiveHeading01$1, heading02$1, productiveHeading02$1, productiveHeading03$1, productiveHeading04$1, productiveHeading05$1, productiveHeading06$1, productiveHeading07$1, expressiveHeading01$1, expressiveHeading02$1, expressiveHeading03$1, expressiveHeading04$1, expressiveHeading05$1, expressiveHeading06$1, expressiveParagraph01$1, quotation01$1, quotation02$1, display01$1, display02$1, display03$1, display04$1];
723
755
 
724
756
  exports.bodyLong01 = bodyLong01;
725
757
  exports.bodyLong02 = bodyLong02;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@carbon/type",
3
3
  "description": "Typography for digital and software products using the Carbon Design System",
4
- "version": "10.20.0-rc.0",
4
+ "version": "10.21.0",
5
5
  "license": "Apache-2.0",
6
6
  "main": "lib/index.js",
7
7
  "module": "es/index.js",
@@ -32,16 +32,16 @@
32
32
  "access": "public"
33
33
  },
34
34
  "scripts": {
35
- "build": "yarn clean && carbon-cli bundle src/index.js --name CarbonType && carbon-cli sassdoc \"scss/**/*.scss\" -i \"**/{_inlined,vendor}**\" && carbon-cli inline && carbon-cli check \"scss/*.scss\"",
35
+ "build": "yarn clean && carbon-cli bundle src/index.js --name CarbonType && carbon-cli inline && carbon-cli check \"scss/*.scss\"",
36
36
  "clean": "rimraf css es lib umd scss/_inlined scss/vendor"
37
37
  },
38
38
  "dependencies": {
39
- "@carbon/import-once": "^10.5.0-rc.0",
40
- "@carbon/layout": "^10.17.0-rc.0"
39
+ "@carbon/import-once": "^10.6.0",
40
+ "@carbon/layout": "^10.18.0"
41
41
  },
42
42
  "devDependencies": {
43
- "@carbon/cli": "^10.18.0-rc.0",
44
- "@carbon/test-utils": "^10.14.0-rc.0",
43
+ "@carbon/cli": "^10.19.0",
44
+ "@carbon/test-utils": "^10.14.0",
45
45
  "change-case": "^4.1.1",
46
46
  "rimraf": "^3.0.0"
47
47
  },
@@ -51,5 +51,5 @@
51
51
  "sassDir": "scss",
52
52
  "needs": "^1.3.0"
53
53
  },
54
- "gitHead": "09a37296c3862fd5d9e0b49f16b0ff5d074156dc"
54
+ "gitHead": "79db5535fee7f58e0fe21bac154b638cd17f659e"
55
55
  }
@@ -0,0 +1,42 @@
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
+ @use 'font-family' as *;
10
+ @use 'prefix' as *;
11
+ @use 'styles' as *;
12
+
13
+ /// Create type classes for font families, weights, styles
14
+ /// @access public
15
+ /// @group @carbon/type
16
+ @mixin type-classes {
17
+ // Font families
18
+ @each $name, $value in $font-families {
19
+ .#{$prefix}--type-#{$name} {
20
+ font-family: $value;
21
+ }
22
+ }
23
+
24
+ // Font weights
25
+ @each $name, $value in $font-weights {
26
+ .#{$prefix}--type-#{$name} {
27
+ font-weight: $value;
28
+ }
29
+ }
30
+
31
+ // Font styles
32
+ .#{$prefix}--type-italic {
33
+ font-style: italic;
34
+ }
35
+
36
+ // Type styles
37
+ @each $name, $value in $tokens {
38
+ .#{$prefix}--type-#{$name} {
39
+ @include type-style($name, map.has-key($value, breakpoints));
40
+ }
41
+ }
42
+ }
@@ -0,0 +1,70 @@
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
+ /// Font family fallbacks for: IBM Plex Mono, IBM Plex Sans, IBM Plex Sans
9
+ /// Condensed, IBM Plex Sans Hebrew, and IBM Plex Serif
10
+ /// @type Map
11
+ /// @access public
12
+ /// @group @carbon/type
13
+ $font-families: (
14
+ 'mono':
15
+ unquote(
16
+ "'IBM Plex Mono', 'Menlo', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', Courier, monospace"
17
+ ),
18
+ 'sans': unquote("'IBM Plex Sans', 'Helvetica Neue', Arial, sans-serif"),
19
+ 'sans-condensed':
20
+ unquote("'IBM Plex Sans Condensed', 'Helvetica Neue', Arial, sans-serif"),
21
+ 'sans-hebrew':
22
+ unquote(
23
+ "'IBM Plex Sans Hebrew', 'Helvetica Hebrew', 'Arial Hebrew', sans-serif"
24
+ ),
25
+ 'serif': unquote("'IBM Plex Serif', 'Georgia', Times, serif"),
26
+ ) !default;
27
+
28
+ /// Get the font-family for an IBM Plex font
29
+ /// @param {String} $name
30
+ /// @return {String}
31
+ /// @access public
32
+ /// @group @carbon/type
33
+ @function font-family($name) {
34
+ @return map-get($font-families, $name);
35
+ }
36
+
37
+ /// Include the `font-family` definition for the given name in your selector
38
+ /// @param {String} $name
39
+ /// @access public
40
+ /// @group @carbon/type
41
+ @mixin font-family($name) {
42
+ font-family: font-family($name);
43
+ }
44
+
45
+ /// Suggested font weights to be used in product
46
+ /// @type Map
47
+ /// @access public
48
+ /// @group @carbon/type
49
+ $font-weights: (
50
+ 'light': 300,
51
+ 'regular': 400,
52
+ 'semibold': 600,
53
+ ) !default;
54
+
55
+ /// Retrieve the font-weight value for a given name
56
+ /// @param {String} $weight
57
+ /// @return {Number}
58
+ /// @access public
59
+ /// @group @carbon/type
60
+ @function font-weight($weight) {
61
+ @return map-get($font-weights, $weight);
62
+ }
63
+
64
+ /// Set the `font-weight` property with the value for a given name
65
+ /// @param {String} $weight
66
+ /// @access public
67
+ /// @group @carbon/type
68
+ @mixin font-weight($weight) {
69
+ font-weight: font-weight($weight);
70
+ }
@@ -0,0 +1,11 @@
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
+ /// @type String
9
+ /// @access public
10
+ /// @group @carbon/type
11
+ $prefix: 'bx' !default;
@@ -0,0 +1,92 @@
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
+ @use 'sass:meta';
10
+ @use '@carbon/layout';
11
+ @use 'font-family' as *;
12
+ @use 'styles' as *;
13
+
14
+ /// Include a type reset for a given body and mono font family
15
+ /// @param {String} $body-font-family [font-family('sans')] - The font family used on the `<body>` element
16
+ /// @param {String} $mono-font-family [font-family('mono')] - The font family used on elements that require mono fonts, like the `<code>` element
17
+ /// @access public
18
+ /// @group @carbon/type
19
+ @mixin type-reset(
20
+ // TODO: remove in next major release. This has been replaced with 100%
21
+ $base-font-size: layout.$base-font-size,
22
+ $body-font-family: font-family('sans'),
23
+ $mono-font-family: font-family('mono')
24
+ ) {
25
+ html {
26
+ font-size: 100%;
27
+ }
28
+
29
+ body {
30
+ @include font-weight('regular');
31
+
32
+ font-family: $body-font-family;
33
+ text-rendering: optimizeLegibility;
34
+ -webkit-font-smoothing: antialiased;
35
+ -moz-osx-font-smoothing: grayscale;
36
+ }
37
+
38
+ code {
39
+ font-family: $mono-font-family;
40
+ }
41
+
42
+ strong {
43
+ @include font-weight('semibold');
44
+ }
45
+ }
46
+
47
+ /// Include default type styles
48
+ /// @access public
49
+ /// @group @carbon/type
50
+ @mixin default-type {
51
+ h1 {
52
+ @include type-style('productive-heading-06');
53
+ }
54
+
55
+ h2 {
56
+ @include type-style('productive-heading-05');
57
+ }
58
+
59
+ h3 {
60
+ @include type-style('productive-heading-04');
61
+ }
62
+
63
+ h4 {
64
+ @include type-style('productive-heading-03');
65
+ }
66
+
67
+ h5 {
68
+ @include type-style('productive-heading-02');
69
+ }
70
+
71
+ h6 {
72
+ @include type-style('productive-heading-01');
73
+ }
74
+
75
+ p {
76
+ @include type-style('body-long-02');
77
+ }
78
+
79
+ a {
80
+ @if meta.global-variable-exists('carbon--theme') and
81
+ map.has-key($carbon--theme, 'link-01')
82
+ {
83
+ color: map.get($carbon--theme, 'link-01');
84
+ } @else {
85
+ color: #0062fe;
86
+ }
87
+ }
88
+
89
+ em {
90
+ font-style: italic;
91
+ }
92
+ }
@@ -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
+ @use '@carbon/layout';
9
+
10
+ /// Compute the type size for the given type scale step
11
+ /// @param {Number} $step
12
+ /// @return {Number} In px
13
+ /// @access public
14
+ /// @group @carbon/type
15
+ @function get-type-size($step) {
16
+ @if $step == 1 {
17
+ @return 12px;
18
+ }
19
+ // Yn = Yn-1 + {INT[(n-2)/4] + 1} * 2
20
+ @return get-type-size($step - 1) + (floor(($step - 2) / 4) + 1) * 2;
21
+ }
22
+
23
+ /// Type scale follows a custom formula for determining each step size and supports sizes from 12px to 92px
24
+ /// @type Map
25
+ /// @access public
26
+ /// @group @carbon/type
27
+ $type-scale: ();
28
+ @for $i from 1 through 23 {
29
+ $type-scale: append($type-scale, layout.rem(get-type-size($i)));
30
+ }
31
+
32
+ /// Get the value of a specific step in the type scale
33
+ /// @param {Number} $step
34
+ /// @return {Number} In rem
35
+ /// @access public
36
+ /// @group @carbon/type
37
+ @function type-scale($step) {
38
+ @return nth($type-scale, $step);
39
+ }
40
+
41
+ /// Set the font-size value of a selector with the value at the given `$step`
42
+ /// @param {Number} $step
43
+ /// @access public
44
+ /// @group @carbon/type
45
+ @mixin type-scale($step) {
46
+ font-size: type-scale($step);
47
+ }
48
+
49
+ /// Alias of `type-scale` mixin.
50
+ /// @param {Number} $step
51
+ /// @alias type-scale
52
+ /// @access public
53
+ /// @group @carbon/type
54
+ @mixin font-size($step) {
55
+ font-size: type-scale($step);
56
+ }