@bonniernews/dn-design-system-web 7.1.0 → 7.2.1

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.
Files changed (45) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/assets/form-field/form-field.scss +4 -4
  3. package/assets/teaser/teaser.scss +6 -6
  4. package/components/article-body-image/article-body-image.scss +2 -2
  5. package/components/article-top-image/article-top-image.scss +1 -1
  6. package/components/badge/badge.scss +2 -2
  7. package/components/blocked-content/blocked-content.scss +6 -6
  8. package/components/buddy-menu/buddy-menu.scss +11 -11
  9. package/components/button/button.scss +19 -19
  10. package/components/button-toggle/button-toggle.scss +20 -20
  11. package/components/byline/byline.scss +9 -9
  12. package/components/checkbox/checkbox.scss +9 -9
  13. package/components/divider/divider.scss +1 -1
  14. package/components/factbox/factbox.scss +8 -8
  15. package/components/floating-button/floating-button.scss +14 -14
  16. package/components/footer/footer.scss +16 -16
  17. package/components/group-header/group-header.scss +4 -4
  18. package/components/icon-button/icon-button.scss +2 -2
  19. package/components/image-caption/image-caption.scss +1 -1
  20. package/components/list-item/list-item.scss +9 -9
  21. package/components/quote/quote.scss +3 -3
  22. package/components/radio-button/radio-button.scss +9 -9
  23. package/components/switch/switch.scss +2 -2
  24. package/components/teaser-image/teaser-image.scss +2 -2
  25. package/components/teaser-large/teaser-large.scss +9 -9
  26. package/components/teaser-list-swipe/teaser-list-swipe.scss +3 -3
  27. package/components/teaser-list-vertical/teaser-list-vertical.scss +9 -9
  28. package/components/teaser-longlife/teaser-longlife.scss +1 -1
  29. package/components/teaser-native/teaser-native.scss +5 -5
  30. package/components/teaser-onsite/teaser-onsite.scss +3 -3
  31. package/components/teaser-package/teaser-package.scss +1 -1
  32. package/components/teaser-right-now/teaser-right-now.scss +2 -2
  33. package/components/teaser-slideshow/teaser-slideshow.scss +2 -5
  34. package/components/teaser-split/teaser-split.scss +1 -1
  35. package/components/teaser-standard/teaser-standard.scss +5 -5
  36. package/components/teaser-swipe-card/teaser-swipe-card.scss +9 -9
  37. package/components/teaser-tipsa/teaser-tipsa.scss +4 -4
  38. package/components/text-button/text-button.scss +13 -13
  39. package/components/text-button-toggle/text-button-toggle.scss +3 -3
  40. package/components/text-input/text-input.scss +16 -16
  41. package/components/thematic-break/thematic-break.scss +2 -2
  42. package/components/video-caption/video-caption.scss +1 -1
  43. package/components/vip-badge/vip-badge.scss +6 -7
  44. package/foundations/helpers/typography.scss +59 -33
  45. package/package.json +1 -1
@@ -4,7 +4,7 @@
4
4
  .ds-split-container {
5
5
  padding: ds-spacing(
6
6
  $ds-s-teaser-vertical-small $ds-s-teaser-horizontal
7
- $ds-sl-teaser-vertical-medium
7
+ $ds-s-teaser-vertical-medium
8
8
  );
9
9
  display: flex;
10
10
  flex-wrap: wrap;
@@ -3,8 +3,8 @@
3
3
  @use "sass:math";
4
4
 
5
5
  .ds-teaser.ds-teaser--standard {
6
- @include ds-spacing-layout(
7
- $ds-sl-teaser-vertical-small $ds-sl-teaser-horizontal 0
6
+ padding: ds-spacing(
7
+ $ds-s-teaser-vertical-small $ds-s-teaser-horizontal 0
8
8
  );
9
9
  overflow: hidden;
10
10
 
@@ -18,7 +18,7 @@
18
18
 
19
19
  .ds-teaser__media,
20
20
  .ds-teaser__content {
21
- @include ds-spacing-layout($ds-sl-teaser-vertical-medium, margin-bottom);
21
+ margin-bottom: ds-spacing($ds-s-teaser-vertical-medium);
22
22
  }
23
23
 
24
24
  &::after {
@@ -32,8 +32,8 @@
32
32
  }
33
33
 
34
34
  .ds-teaser__media {
35
- @include ds-spacing-layout($ds-sl-teaser-vertical-medium, margin-bottom);
36
- margin-left: ds-spacing-component($ds-sc-x4);
35
+ margin-bottom: ds-spacing($ds-s-teaser-vertical-medium);
36
+ margin-left: ds-spacing($ds-s-100);
37
37
  float: right;
38
38
 
39
39
  @include ds-mq-only-breakpoint(mobile) {
@@ -21,7 +21,7 @@
21
21
  .ds-teaser__text {
22
22
  display: flex;
23
23
  flex-direction: column;
24
- padding: ds-spacing-component($ds-sc-x3);
24
+ padding: ds-spacing($ds-s-075);
25
25
  margin: 0;
26
26
  flex: 1;
27
27
  }
@@ -33,7 +33,7 @@
33
33
 
34
34
  .ds-teaser__title {
35
35
  @include ds-typography($ds-typography-expressive-heading01bold);
36
- margin-bottom: ds-spacing-component($ds-sc-x2);
36
+ margin-bottom: ds-spacing($ds-s-050);
37
37
  flex: 1;
38
38
  }
39
39
 
@@ -54,11 +54,11 @@
54
54
  border-radius: 0;
55
55
 
56
56
  &:not(:last-of-type) {
57
- margin-right: ds-spacing-component($ds-sc-x2);
57
+ margin-right: ds-spacing($ds-s-050);
58
58
  }
59
59
 
60
60
  .ds-teaser__text {
61
- padding: ds-spacing-component($ds-sc-x1 0 0 0);
61
+ padding: ds-spacing($ds-s-025 0 0 0);
62
62
  }
63
63
 
64
64
  .ds-teaser-swipe-card__time {
@@ -66,16 +66,16 @@
66
66
  @include ds-typography($ds-typography-functional-body01semibold);
67
67
  color: $ds-theme-color;
68
68
  align-items: center;
69
- margin-bottom: ds-spacing-component($ds-sc-x1);
69
+ margin-bottom: ds-spacing($ds-s-025);
70
70
 
71
71
  &::before {
72
72
  content: "";
73
73
  display: block;
74
- width: ds-spacing-component($ds-sc-x2);
75
- height: ds-spacing-component($ds-sc-x2);
74
+ width: ds-spacing($ds-s-050);
75
+ height: ds-spacing($ds-s-050);
76
76
  background-color: $ds-theme-color;
77
77
  border-radius: 50%;
78
- margin-right: ds-spacing-component($ds-sc-x2);
78
+ margin-right: ds-spacing($ds-s-050);
79
79
  }
80
80
 
81
81
  &::after {
@@ -84,7 +84,7 @@
84
84
  height: 2px;
85
85
  flex: 1;
86
86
  background-color: $ds-color-border-primary;
87
- margin-left: ds-spacing-component($ds-sc-x2);
87
+ margin-left: ds-spacing($ds-s-050);
88
88
  }
89
89
  }
90
90
  }
@@ -3,9 +3,9 @@
3
3
 
4
4
  .ds-teaser.ds-teaser--tipsa {
5
5
  .ds-teaser__content {
6
- @include ds-spacing-layout(
7
- $ds-sl-teaser-vertical-small $ds-sl-teaser-horizontal
8
- $ds-sl-teaser-vertical-medium
6
+ padding: ds-spacing(
7
+ $ds-s-teaser-vertical-small $ds-s-teaser-horizontal
8
+ $ds-s-teaser-vertical-medium
9
9
  );
10
10
  }
11
11
 
@@ -21,6 +21,6 @@
21
21
 
22
22
  .ds-teaser__text {
23
23
  @include ds-typography($ds-typography-functional-body02regular);
24
- margin-top: ds-spacing-component($ds-sc-x2);
24
+ margin-top: ds-spacing($ds-s-050);
25
25
  }
26
26
  }
@@ -6,7 +6,7 @@ $ds-text-btn__min-clickable-area: 0;
6
6
  $ds-text-btn__underline-offset: 2px;
7
7
 
8
8
  .ds-text-btn {
9
- --ds-text-btn__inner-padding: #{ds-spacing-component($ds-sc-x3)};
9
+ --ds-text-btn__inner-padding: #{ds-spacing($ds-s-075)};
10
10
  --ds-text-btn__icon-size: #{ds-px-to-rem(24px)};
11
11
 
12
12
  &.ds-force-px {
@@ -14,17 +14,17 @@ $ds-text-btn__underline-offset: 2px;
14
14
  }
15
15
 
16
16
  &.ds-text-btn--icon-left {
17
- --ds-text-btn__inner-padding: #{ds-spacing-component($ds-sc-x3 $ds-sc-x3 $ds-sc-x3 $ds-sc-x2)};
18
- --ds-text-btn__icon-margin: #{ds-spacing-component(0 $ds-sc-x2 0 0)};
17
+ --ds-text-btn__inner-padding: #{ds-spacing($ds-s-075 $ds-s-075 $ds-s-075 $ds-s-050)};
18
+ --ds-text-btn__icon-margin: #{ds-spacing(0 $ds-s-050 0 0)};
19
19
  }
20
20
 
21
21
  &.ds-text-btn--icon-right {
22
- --ds-text-btn__inner-padding: #{ds-spacing-component($ds-sc-x3 $ds-sc-x2 $ds-sc-x3 $ds-sc-x3)};
23
- --ds-text-btn__icon-margin: #{ds-spacing-component(0 0 0 $ds-sc-x2)};
22
+ --ds-text-btn__inner-padding: #{ds-spacing($ds-s-075 $ds-s-050 $ds-s-075 $ds-s-075)};
23
+ --ds-text-btn__icon-margin: #{ds-spacing(0 0 0 $ds-s-050)};
24
24
  }
25
25
 
26
26
  &.ds-text-btn--small {
27
- --ds-text-btn__inner-padding: #{ds-spacing-component($ds-sc-x2)};
27
+ --ds-text-btn__inner-padding: #{ds-spacing($ds-s-050)};
28
28
  --ds-text-btn__icon-size: #{ds-px-to-rem(20px)};
29
29
 
30
30
  &.ds-force-px {
@@ -32,24 +32,24 @@ $ds-text-btn__underline-offset: 2px;
32
32
  }
33
33
 
34
34
  &.ds-text-btn--icon-left {
35
- --ds-text-btn__icon-margin: #{ds-spacing-component(0 $ds-sc-x1 0 0)};
36
- --ds-text-btn__inner-padding: #{ds-spacing-component($ds-sc-x2 $ds-sc-x2 $ds-sc-x2 $ds-sc-x1)};
35
+ --ds-text-btn__icon-margin: #{ds-spacing(0 $ds-s-025 0 0)};
36
+ --ds-text-btn__inner-padding: #{ds-spacing($ds-s-050 $ds-s-050 $ds-s-050 $ds-s-025)};
37
37
  &.ds-text-btn--condensed {
38
- --ds-text-btn__inner-padding: #{ds-spacing-component($ds-sc-x1 $ds-sc-x1 $ds-sc-x1 0)};
38
+ --ds-text-btn__inner-padding: #{ds-spacing($ds-s-025 $ds-s-025 $ds-s-025 0)};
39
39
  }
40
40
  }
41
41
 
42
42
  &.ds-text-btn--icon-right {
43
- --ds-text-btn__icon-margin: #{ds-spacing-component(0 0 0 $ds-sc-x1)};
44
- --ds-text-btn__inner-padding: #{ds-spacing-component($ds-sc-x2 $ds-sc-x1 $ds-sc-x2 $ds-sc-x2)};
43
+ --ds-text-btn__icon-margin: #{ds-spacing(0 0 0 $ds-s-025)};
44
+ --ds-text-btn__inner-padding: #{ds-spacing($ds-s-050 $ds-s-025 $ds-s-050 $ds-s-050)};
45
45
  &.ds-text-btn--condensed {
46
- --ds-text-btn__inner-padding: #{ds-spacing-component($ds-sc-x1 0 $ds-sc-x1 $ds-sc-x1)};
46
+ --ds-text-btn__inner-padding: #{ds-spacing($ds-s-025 0 $ds-s-025 $ds-s-025)};
47
47
  }
48
48
  }
49
49
  }
50
50
 
51
51
  &.ds-text-btn--condensed {
52
- --ds-text-btn__inner-padding: #{ds-spacing-component($ds-sc-x1)};
52
+ --ds-text-btn__inner-padding: #{ds-spacing($ds-s-025)};
53
53
  }
54
54
  }
55
55
 
@@ -55,7 +55,7 @@ $ds-text-btn-toggle__icon-size: 24px;
55
55
  justify-content: center;
56
56
  background-color: transparent;
57
57
  border-radius: ds-metrics-border-radius(x1);
58
- padding: ds-spacing-component($ds-sc-x3 $ds-sc-x3 $ds-sc-x3 $ds-sc-x2);
58
+ padding: ds-spacing($ds-s-075 $ds-s-075 $ds-s-075 $ds-s-050);
59
59
  position: relative;
60
60
  &::before {
61
61
  content: "";
@@ -72,7 +72,7 @@ $ds-text-btn-toggle__icon-size: 24px;
72
72
  display: flex;
73
73
  height: ds-px-to-rem($ds-text-btn-toggle__icon-size);
74
74
  width: ds-px-to-rem($ds-text-btn-toggle__icon-size);
75
- margin: ds-spacing-component(0 $ds-sc-x2 0 0);
75
+ margin: ds-spacing(0 $ds-s-050 0 0);
76
76
  color: $ds-color-icon-primary;
77
77
  svg {
78
78
  fill: currentColor;
@@ -128,5 +128,5 @@ $ds-text-btn-toggle__icon-size: 24px;
128
128
  }
129
129
 
130
130
  .ds-text-btn-toggle--condensed .ds-text-btn-toggle__inner {
131
- padding: ds-spacing-component($ds-sc-x1);
131
+ padding: ds-spacing($ds-s-025);
132
132
  }
@@ -5,7 +5,7 @@
5
5
  $ds-text-input-toggle-btn__width: 28px;
6
6
  $ds-text-input-toggle-btn__top: 22px;
7
7
  $ds-text-input-toggle-btn__area: (
8
- $ds-text-input-toggle-btn__width + ds-spacing-component($ds-sc-x2)
8
+ $ds-text-input-toggle-btn__width + ds-spacing($ds-s-050)
9
9
  );
10
10
 
11
11
  .ds-form-field__error {
@@ -15,7 +15,7 @@ $ds-text-input-toggle-btn__area: (
15
15
  }
16
16
 
17
17
  .ds-text-input {
18
- padding-top: ds-px-to-rem(ds-spacing-component($ds-sc-x2));
18
+ padding-top: ds-spacing($ds-s-050, rem);
19
19
  position: relative;
20
20
  color: $ds-color-text-primary;
21
21
  }
@@ -27,7 +27,7 @@ $ds-text-input-toggle-btn__area: (
27
27
  background-color: $ds-color-component-secondary;
28
28
  @include ds-typography($ds-typography-functional-body02regular);
29
29
  /* stylelint-disable-next-line */
30
- padding: ds-px-to-rem(ds-spacing-component($ds-sc-x4) - ds-metrics-border-width(x1)) ds-spacing-component($ds-sc-x4) - ds-metrics-border-width(x1);
30
+ padding: ds-px-to-rem(ds-spacing($ds-s-100) - ds-metrics-border-width(x1)) ds-spacing($ds-s-100) - ds-metrics-border-width(x1);
31
31
  border: solid ds-metrics-border-width(x1) $ds-color-border-primary-02;
32
32
  border-radius: ds-metrics-border-radius(x1);
33
33
  margin: 0;
@@ -55,9 +55,9 @@ $ds-text-input-toggle-btn__area: (
55
55
 
56
56
  &:focus {
57
57
  padding: ds-px-to-rem(
58
- ds-spacing-component($ds-sc-x4) - ds-metrics-border-width(x2)
58
+ ds-spacing($ds-s-100) - ds-metrics-border-width(x2)
59
59
  )
60
- ds-spacing-component($ds-sc-x4) - ds-metrics-border-width(x2);
60
+ ds-spacing($ds-s-100) - ds-metrics-border-width(x2);
61
61
  border-color: $ds-color-border-primary-03;
62
62
  border-width: ds-metrics-border-width(x2);
63
63
 
@@ -83,18 +83,18 @@ $ds-text-input-toggle-btn__area: (
83
83
 
84
84
  .ds-text-input__label {
85
85
  position: absolute;
86
- top: ds-px-to-rem(ds-spacing-component($ds-sc-x6));
87
- left: ds-spacing-component($ds-sc-x4);
86
+ top: ds-spacing($ds-s-150, rem);
87
+ left: ds-spacing($ds-s-100);
88
88
  z-index: 1;
89
89
  transition: font-size 0.1s ease-in, top 0.1s ease-in;
90
90
  @include ds-typography($ds-typography-functional-body02regular);
91
91
  &::before {
92
92
  content: "";
93
- width: calc(100% + ds-spacing-component($ds-sc-x2));
94
- left: -#{ds-spacing-component($ds-sc-x1)};
93
+ width: calc(100% + ds-spacing($ds-s-050));
94
+ left: -#{ds-spacing($ds-s-025)};
95
95
  height: ds-metrics-border-width(x1);
96
96
  position: absolute;
97
- top: ds-px-to-rem(ds-spacing-component($ds-sc-x2));
97
+ top: ds-spacing($ds-s-050, rem);
98
98
  z-index: -1;
99
99
  background-color: transparent; // for animation
100
100
  transition: background-color 0.2s ease-in-out;
@@ -104,7 +104,7 @@ $ds-text-input-toggle-btn__area: (
104
104
  .ds-icon-btn.ds-text-input__password-toggle {
105
105
  position: absolute;
106
106
  top: ds-px-to-rem($ds-text-input-toggle-btn__top);
107
- right: ds-spacing-component($ds-sc-x1);
107
+ right: ds-spacing($ds-s-025);
108
108
  z-index: 1;
109
109
  min-width: 0;
110
110
  min-height: 0;
@@ -112,13 +112,13 @@ $ds-text-input-toggle-btn__area: (
112
112
 
113
113
  .ds-force-px {
114
114
  &.ds-text-input {
115
- padding-top: ds-spacing-component($ds-sc-x2);
115
+ padding-top: ds-spacing($ds-s-050);
116
116
  font-size: 16px;
117
117
  }
118
118
 
119
119
  .ds-text-input__input {
120
120
  @include ds-typography($ds-typography-functional-body02regular, true);
121
- padding: ds-spacing-component($ds-sc-x4) - ds-metrics-border-width(x1);
121
+ padding: ds-spacing($ds-s-100) - ds-metrics-border-width(x1);
122
122
 
123
123
  &.password-toggle {
124
124
  padding-right: $ds-text-input-toggle-btn__area;
@@ -137,15 +137,15 @@ $ds-text-input-toggle-btn__area: (
137
137
  }
138
138
 
139
139
  &:focus {
140
- padding: ds-spacing-component($ds-sc-x4) - ds-metrics-border-width(x2);
140
+ padding: ds-spacing($ds-s-100) - ds-metrics-border-width(x2);
141
141
  }
142
142
  }
143
143
 
144
144
  .ds-text-input__label {
145
145
  @include ds-typography($ds-typography-functional-body02regular, true);
146
- top: ds-spacing-component($ds-sc-x6);
146
+ top: ds-spacing($ds-s-150);
147
147
  &::before {
148
- top: ds-spacing-component($ds-sc-x2);
148
+ top: ds-spacing($ds-s-050);
149
149
  }
150
150
  }
151
151
 
@@ -2,8 +2,8 @@
2
2
 
3
3
  .ds-thematic-break {
4
4
  margin: 0;
5
- @include ds-spacing-layout(
6
- $ds-sl-gap-vertical-static-medium 0 $ds-sl-gap-vertical-static-large
5
+ padding: ds-spacing(
6
+ $ds-s-gap-vertical-static-medium 0 $ds-s-gap-vertical-static-large
7
7
  );
8
8
 
9
9
  hr {
@@ -6,7 +6,7 @@
6
6
 
7
7
  .ds-video-caption__duration {
8
8
  @include ds-typography($ds-typography-functional-body01bold);
9
- margin-right: ds-spacing-component($ds-sc-x1);
9
+ margin-right: ds-spacing($ds-s-025);
10
10
  }
11
11
 
12
12
  @at-root .ds-force-px#{&} {
@@ -14,13 +14,13 @@ $ds-vip-badge__icon-size: 16px;
14
14
  color: $ds-color-static-white;
15
15
  fill: $ds-color-static-white;
16
16
  @include ds-typography($ds-typography-functional-meta01regular);
17
- padding: ds-px-to-rem(ds-spacing-component($ds-sc-x1));
17
+ padding: ds-spacing($ds-s-025, rem);
18
18
 
19
19
  @at-root .ds-force-px#{&} {
20
20
  @include ds-typography($ds-typography-functional-meta01regular, true);
21
21
  border-radius: ds-metrics-border-radius(x1) 0 ds-metrics-border-radius(x1)
22
22
  ds-metrics-border-radius(x1);
23
- padding: ds-spacing-component($ds-sc-x1);
23
+ padding: ds-spacing($ds-s-025);
24
24
  }
25
25
 
26
26
  // bang class indicating that the user has premium access
@@ -39,16 +39,15 @@ $ds-vip-badge__icon-size: 16px;
39
39
  }
40
40
 
41
41
  .ds-vip-badge--text {
42
- padding: ds-px-to-rem(ds-spacing-component($ds-sc-x1))
43
- ds-px-to-rem(ds-spacing-component($ds-sc-x2));
42
+ padding: ds-spacing($ds-s-025 $ds-s-050, rem);
44
43
  @at-root .ds-force-px#{&} {
45
- padding: ds-spacing-component($ds-sc-x1 $ds-sc-x2);
44
+ padding: ds-spacing($ds-s-025 $ds-s-050);
46
45
  }
47
46
 
48
47
  .ds-icon {
49
- margin-right: ds-px-to-rem(ds-spacing-component($ds-sc-x1));
48
+ margin-right: ds-spacing($ds-s-025, rem);
50
49
  @at-root .ds-force-px#{&} {
51
- margin-right: ds-spacing-component($ds-sc-x1);
50
+ margin-right: ds-spacing($ds-s-025);
52
51
  }
53
52
  }
54
53
  }
@@ -70,7 +70,8 @@ $dsSerifWeights: (
70
70
  @include _ds-typography-get-property(
71
71
  $tmpMapScreenLarge,
72
72
  $key,
73
- $forcePx
73
+ $forcePx,
74
+ "large"
74
75
  );
75
76
  }
76
77
  }
@@ -83,7 +84,8 @@ $dsSerifWeights: (
83
84
  @include _ds-typography-get-property(
84
85
  $tmpMapScreenExtraLarge,
85
86
  $key,
86
- $forcePx
87
+ $forcePx,
88
+ "extraLarge"
87
89
  );
88
90
  }
89
91
  }
@@ -109,46 +111,70 @@ $dsSerifWeights: (
109
111
  }
110
112
  }
111
113
 
112
- @mixin _ds-typography-get-property($map, $key, $forcePx) {
114
+ @mixin _ds-typography-get-property($map, $key, $forcePx, $screen: "small") {
113
115
  $unit: "";
114
116
  $value: map.get($map, $key);
115
117
  $fontFamilyType: _ds-get-font-family-type($map);
116
118
  $fontWeights: if($fontFamilyType == "serif", $dsSerifWeights, $dsSansWeights);
117
- $canForcePx: list.index((fontSize, lineHeight, letterSpacing), $key);
118
119
 
119
- @if $key == "fontFamily" {
120
- @if $fontFamilyType == "serif" {
121
- font-family: $ds-font--serif;
122
- } @else if $fontFamilyType == "sans" {
123
- font-family: $ds-font--sans;
124
- }
125
- } @else if $key == "fontWeight" {
126
- $value: string.to-lower-case($value);
127
- @if map-has-key($fontWeights, $value) {
128
- $value: map.get($fontWeights, $value);
129
- }
130
- font-weight: #{$value};
131
- } @else if $key == "fontStyle" {
132
- font-style: string.to-lower-case($value);
133
- } @else if $key == "fontSize" {
134
- @if $forcePx {
135
- font-size: $value * 1px;
136
- } @else {
137
- font-size: ds-px-to-rem($value);
138
- }
139
- font-variation-settings: "opsz" $value;
140
- } @else if $canForcePx and $value != "" {
141
- @if $forcePx {
142
- $value: $value * 1px;
143
- } @else {
144
- $value: ds-px-to-rem($value);
120
+ @if $value != "" {
121
+ @if $key == "fontFamily" {
122
+ @if $fontFamilyType == "serif" {
123
+ font-family: $ds-font--serif;
124
+ } @else if $fontFamilyType == "sans" {
125
+ font-family: $ds-font--sans;
126
+ }
127
+ } @else if $key == "fontWeight" {
128
+ $value: string.to-lower-case($value);
129
+ @if map-has-key($fontWeights, $value) {
130
+ $value: map.get($fontWeights, $value);
131
+ }
132
+ font-weight: #{$value};
133
+ } @else if $key == "fontStyle" {
134
+ font-style: string.to-lower-case($value);
135
+ } @else if $key == "fontSize" {
136
+ @if $forcePx {
137
+ font-size: $value * 1px;
138
+ } @else {
139
+ font-size: ds-px-to-rem($value);
140
+ font-size: clamp($value * 1px, ds-px-to-rem($value), _ds-get-max-scaled-size($value, $screen));
141
+ }
142
+ font-variation-settings: "opsz" $value;
143
+ } @else if $key == "lineHeight" {
144
+ @if $forcePx {
145
+ line-height: $value * 1px;
146
+ } @else {
147
+ line-height: ds-px-to-rem($value);
148
+ line-height: clamp($value * 1px, ds-px-to-rem($value), _ds-get-max-scaled-size($value, $screen));
149
+ }
150
+ } @else if $key == "letterSpacing" {
151
+ @if $forcePx {
152
+ $value: $value * 1px;
153
+ } @else {
154
+ $value: ds-px-to-rem($value);
155
+ }
156
+ #{map.get($dsTypographyKeys, $key)}: $value;
157
+ } @else if index(map-keys($dsTypographyKeys), $key) {
158
+ #{map.get($dsTypographyKeys, $key)}: $value;
145
159
  }
146
- #{map.get($dsTypographyKeys, $key)}: $value;
147
- } @else if index(map-keys($dsTypographyKeys), $key) and $value != "" {
148
- #{map.get($dsTypographyKeys, $key)}: $value;
149
160
  }
150
161
  }
151
162
 
163
+ @function _ds-get-max-scaled-size($size, $screen: "small") {
164
+ $midPoint: 26;
165
+ $scalingFactor: 0.33;
166
+ @if ($screen == "large") {
167
+ $midPoint: 30;
168
+ $scalingFactor: 0.2;
169
+ } @else if ($screen == "extraLarge") {
170
+ $midPoint: 32;
171
+ $scalingFactor: 0.166;
172
+ }
173
+
174
+ $calculatedScalingFactor: 2 - math.div(1, (1 + math.pow(math.$e, $scalingFactor * ($midPoint - $size))));
175
+ @return math.round($calculatedScalingFactor * $size * 1px);
176
+ }
177
+
152
178
  @function _ds-get-font-family-type($map) {
153
179
  $fontFamily: map.get($map, "fontFamily");
154
180
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bonniernews/dn-design-system-web",
3
- "version": "7.1.0",
3
+ "version": "7.2.1",
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",