@bonniernews/dn-design-system-web 8.2.0 → 8.3.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/CHANGELOG.md CHANGED
@@ -3,6 +3,15 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## 8.3.0 (2023-11-14)
7
+
8
+
9
+ ### Features
10
+
11
+ * **web:** add typography manual helper ([#1094](https://github.com/BonnierNews/dn-design-system/issues/1094)) ([8bd836f](https://github.com/BonnierNews/dn-design-system/commit/8bd836f19ec415af70cd878e855b001bce47c142))
12
+
13
+
14
+
6
15
  ## 8.2.0 (2023-11-14)
7
16
 
8
17
 
@@ -98,6 +98,30 @@ $dsSerifWeights: (
98
98
  }
99
99
  }
100
100
 
101
+ @mixin ds-typography-manual(
102
+ $family,
103
+ $size,
104
+ $lineHeight: $size * 1.2,
105
+ $weight: 400,
106
+ $fontStyle: "",
107
+ $letterSpacing: "",
108
+ $scaling: "small"
109
+ ) {
110
+ $dsTypographyKeys: (
111
+ fontFamily: $family,
112
+ fontSize: $size,
113
+ lineHeight: $lineHeight,
114
+ // numbers and strings are both handled as strings in fontWeight
115
+ fontWeight: "#{$weight}",
116
+ fontStyle: $fontStyle,
117
+ letterSpacing: $letterSpacing,
118
+ );
119
+ $forcePx: $scaling == false;
120
+ @each $key in map-keys($dsTypographyKeys) {
121
+ @include _ds-typography-get-property($dsTypographyKeys, $key, $forcePx, $scaling);
122
+ }
123
+ }
124
+
101
125
  @mixin _ds-typography-get-property($map, $key, $forcePx, $screen: "small") {
102
126
  $unit: "";
103
127
  $value: map.get($map, $key);
@@ -4,6 +4,8 @@
4
4
 
5
5
  # Typography
6
6
 
7
+ ## Typography token
8
+
7
9
  |parameter | type | required | options | default | description |
8
10
  |:--- | :--- | :--- | :--- | :--- | :--- |
9
11
  |token | Sass variable | yes | | | Ex. $ds-typography-functional-body01regular, all typography variables starts with prefix $ds-typography- |
@@ -13,7 +15,7 @@ These are copy paste friendly examples to quickliy get started using a component
13
15
 
14
16
  ### SCSS
15
17
  ```scss
16
- @use "@bonniernews/dn-design-system-web/foundations/helpers/typography" as *;
18
+ @use "@bonniernews/dn-design-system-web/foundations/helpers/forward.helpers" as *;
17
19
 
18
20
  @include ds-typography($ds-typography-functional-body01regular);
19
21
  ```
@@ -22,3 +24,24 @@ With forcePX parameter:
22
24
  ```scss
23
25
  @include ds-typography($ds-typography-functional-body01regular, true);
24
26
  ```
27
+
28
+ ## ⚠️ Manual typography (only for use in special circumstances)
29
+
30
+ |parameter | type | required | options | default | description |
31
+ |:--- | :--- | :--- | :--- | :--- | :--- |
32
+ |family | String | yes | Sans, Serif | | DN Font family |
33
+ |size | Number | yes | | | Font size in px without unit |
34
+ |lineHeight | Number | no | | size * 1.2 | Line height in px without unit |
35
+ |weight | String, Number | no | bold, 400, etc | 400 | Font weight accepts both name or number |
36
+ |fontStyle | String | no | | | Font style, ex Italic |
37
+ |letterSpacing | Number | no | | font default | Letter spacing |
38
+ |scaling | String, Bool | no | "small", "large", "extraLarge" or false | "small" | Applies typography scaling for screen size. If set to false font will not scale. |
39
+
40
+ These are copy paste friendly examples to quickliy get started using a component.
41
+
42
+ ### SCSS
43
+ ```scss
44
+ @use "@bonniernews/dn-design-system-web/foundations/helpers/forward.helpers" as *;
45
+
46
+ @include ds-typography-manual('Sans', 36, 48, bold);
47
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bonniernews/dn-design-system-web",
3
- "version": "8.2.0",
3
+ "version": "8.3.0",
4
4
  "description": "DN design system for web.",
5
5
  "main": "index.js",
6
6
  "homepage": "https://github.com/BonnierNews/dn-design-system/tree/main/web/src#readme",