@carbon/type 10.1.1 → 10.2.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/LICENSE +2 -2
- package/README.md +69 -80
- package/es/index.js +23 -1
- package/lib/index.js +28 -0
- package/package.json +7 -7
- package/scss/_inlined/_classes.scss +41 -0
- package/scss/_inlined/_font-family.scss +70 -0
- package/scss/_inlined/_prefix.scss +11 -0
- package/scss/_inlined/_reset.scss +43 -0
- package/scss/_inlined/_scale.scss +59 -0
- package/scss/_inlined/_styles.scss +673 -0
- package/scss/_inlined/font-face/_mono.scss +430 -0
- package/scss/_inlined/font-face/_sans.scss +497 -0
- package/scss/_inlined/font-face/_serif.scss +430 -0
- package/scss/_inlined/font-face/_settings.scss +12 -0
- package/scss/_styles.scss +46 -0
- package/scss/index.scss +11 -0
- package/scss/type.scss +4 -4
- package/scss/vendor/@carbon/import-once/import-once.scss +27 -0
- package/scss/vendor/@carbon/import-once/index.scss +8 -0
- package/scss/vendor/@carbon/layout/_breakpoint.scss +237 -0
- package/scss/vendor/@carbon/layout/_convert.scss +30 -0
- package/scss/vendor/@carbon/layout/_key-height.scss +97 -0
- package/scss/vendor/@carbon/layout/_mini-unit.scss +23 -0
- package/scss/vendor/@carbon/layout/_spacing.scss +328 -0
- package/scss/vendor/@carbon/layout/_utilities.scss +41 -0
- package/scss/vendor/@carbon/layout/index.scss +8 -0
- package/scss/vendor/@carbon/layout/layout.scss +12 -0
- package/src/__tests__/__snapshots__/styles-test.js.snap +96 -0
- package/src/__tests__/exports-test.js +43 -37
- package/src/styles.js +22 -0
- package/umd/index.js +28 -0
|
@@ -0,0 +1,59 @@
|
|
|
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
|
+
@import '../vendor/@carbon/layout/convert';
|
|
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 carbon--get-type-size($step) {
|
|
16
|
+
@if $step == 1 {
|
|
17
|
+
@return 12px;
|
|
18
|
+
}
|
|
19
|
+
// Yn = Yn-1 + {INT[(n-2)/4] + 1} * 2
|
|
20
|
+
@return carbon--get-type-size($step - 1) + (floor(($step - 2) / 4) + 1) * 2;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/// Type scole 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
|
+
$carbon--type-scale: ();
|
|
28
|
+
@for $i from 1 through 23 {
|
|
29
|
+
$carbon--type-scale: append(
|
|
30
|
+
$carbon--type-scale,
|
|
31
|
+
carbon--rem(carbon--get-type-size($i))
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/// Get the value of a specific step in the typescale
|
|
36
|
+
/// @param {Number} $step
|
|
37
|
+
/// @return {Number} In rem
|
|
38
|
+
/// @access public
|
|
39
|
+
/// @group @carbon/type
|
|
40
|
+
@function carbon--type-scale($step) {
|
|
41
|
+
@return nth($carbon--type-scale, $step);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/// Set the font-size value of a selector with the value at the given `$step`
|
|
45
|
+
/// @param {Number} $step
|
|
46
|
+
/// @access public
|
|
47
|
+
/// @group @carbon/type
|
|
48
|
+
@mixin carbon--type-scale($step) {
|
|
49
|
+
font-size: carbon--type-scale($step);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/// Alias of `type-scale` mixin.
|
|
53
|
+
/// @param {Number} $step
|
|
54
|
+
/// @alias carbon--type-scale
|
|
55
|
+
/// @access public
|
|
56
|
+
/// @group @carbon/type
|
|
57
|
+
@mixin carbon--font-size($step) {
|
|
58
|
+
font-size: carbon--type-scale($step);
|
|
59
|
+
}
|