@bonniernews/dn-design-system-web 14.0.3 → 15.0.0-beta.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.
Files changed (41) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/components/blocked-content/blocked-content.js +1 -1
  3. package/components/blocked-content/blocked-content.njk +2 -2
  4. package/components/button/README.md +4 -2
  5. package/components/{button-toggle/button-toggle.js → button/button.js} +3 -3
  6. package/components/button/button.njk +62 -14
  7. package/components/button/button.scss +169 -110
  8. package/components/button-toggle/README.md +4 -4
  9. package/components/button-toggle/button-toggle.njk +17 -36
  10. package/components/button-toggle/button-toggle.scss +1 -215
  11. package/components/byline/README.md +2 -2
  12. package/components/byline/byline.njk +2 -2
  13. package/components/factbox/factbox.njk +4 -4
  14. package/components/group-header/group-header.njk +5 -3
  15. package/components/group-header/group-header.scss +4 -4
  16. package/components/icon-button/README.md +5 -3
  17. package/components/icon-button/icon-button.njk +17 -51
  18. package/components/icon-button/icon-button.scss +19 -126
  19. package/components/icon-button-toggle/README.md +8 -7
  20. package/components/icon-button-toggle/icon-button-toggle.njk +15 -1
  21. package/components/icon-button-toggle/icon-button-toggle.scss +1 -17
  22. package/components/list-item/list-item.js +2 -2
  23. package/components/list-item/list-item.njk +2 -2
  24. package/components/list-item/list-item.scss +1 -1
  25. package/components/modal/modal.njk +3 -2
  26. package/components/modal/modal.scss +4 -4
  27. package/components/tag-header/tag-header.njk +1 -1
  28. package/components/teaser-list-swipe/teaser-list-swipe.njk +4 -2
  29. package/components/teaser-list-vertical/teaser-list-vertical.njk +1 -1
  30. package/components/text-input/text-input.scss +1 -1
  31. package/foundations/variables/opacity.scss +1 -1
  32. package/foundations/variables/typographyTokensList.scss +1 -0
  33. package/foundations/variables/typographyTokensScreenExtraLarge.scss +8 -1
  34. package/foundations/variables/typographyTokensScreenLarge.scss +8 -1
  35. package/foundations/variables/typographyTokensScreenSmall.scss +8 -1
  36. package/package.json +1 -1
  37. package/tokens/typography-list.json +1 -0
  38. package/components/floating-button/README.md +0 -41
  39. package/components/floating-button/floating-button.njk +0 -41
  40. package/components/floating-button/floating-button.scss +0 -145
  41. package/components/icon-button-toggle/icon-button-toggle.js +0 -21
@@ -144,10 +144,10 @@
144
144
  text: params.toggleText,
145
145
  selected: params.selected,
146
146
  selectedText: params.toggleSelectedText,
147
- variant: params.variant | default("secondaryFilled"),
147
+ variant: params.variant | default("secondary"),
148
148
  disabled: params.disabled,
149
149
  forcePx: params.forcePx,
150
- size: "xsmall",
150
+ size: "small",
151
151
  attributes: params.elementAttributes
152
152
  })}}
153
153
  {% endset %}
@@ -243,7 +243,7 @@ $ds-list-item__icon-size: 24px;
243
243
  .ds-list-item__titles {
244
244
  padding: ds-spacing($ds-s-100) 0;
245
245
  }
246
- .ds-btn-toggle {
246
+ .ds-btn--toggle {
247
247
  margin: ds-spacing(0 $ds-s-outer 0 $ds-s-100);
248
248
  }
249
249
  a {
@@ -20,7 +20,7 @@
20
20
  variant: "transparent",
21
21
  size: "small",
22
22
  iconName: "close",
23
- classNames: "ds-modal__close"
23
+ classNames: "ds-modal__close ds-modal__close--icon"
24
24
  })}}
25
25
 
26
26
  {% if params.title %}
@@ -38,7 +38,8 @@
38
38
  ] | join(" ") %}
39
39
  {{ Button({
40
40
  text: params.secondaryButton.text,
41
- variant: "secondaryOutlined",
41
+ variant: "primary",
42
+ emphasis: "outline",
42
43
  href: params.secondaryButton.href,
43
44
  classNames: secondaryButtonClasses,
44
45
  attributes: params.secondaryButton.attributes,
@@ -78,7 +78,7 @@ body.no-scroll {
78
78
  border-radius: ds-border-radius(x1);
79
79
  }
80
80
 
81
- .ds-icon-btn.ds-modal__close {
81
+ .ds-btn.ds-modal__close--icon {
82
82
  position: absolute;
83
83
  top: ds-spacing($ds-s-100);
84
84
  right: ds-spacing($ds-s-100);
@@ -105,12 +105,12 @@ body.no-scroll {
105
105
  display: flex;
106
106
  flex-wrap: wrap;
107
107
 
108
- .ds-btn--primary:not(:only-child) {
108
+ .ds-btn--default:not(:only-child) {
109
109
  order: 1;
110
110
  margin-bottom: ds-spacing($ds-s-100);
111
111
  }
112
112
 
113
- .ds-btn--secondaryOutlined:not(:only-child) {
113
+ .ds-btn--outline:not(:only-child) {
114
114
  order: 2;
115
115
  }
116
116
  }
@@ -119,7 +119,7 @@ body.no-scroll {
119
119
  display: flex;
120
120
  justify-content: center;
121
121
 
122
- .ds-btn--secondaryOutlined:not(:only-child) {
122
+ .ds-btn--outline:not(:only-child) {
123
123
  margin-right: ds-spacing($ds-s-100);
124
124
  }
125
125
  }
@@ -32,7 +32,7 @@
32
32
  {% if params.toggle %}
33
33
  {{ ButtonToggle({
34
34
  variant: 'brand',
35
- size: 'small',
35
+ size: 'medium',
36
36
  text: params.toggleText,
37
37
  selectedText: params.toggleSelectedText,
38
38
  selected: params.toggleSelected,
@@ -42,7 +42,8 @@
42
42
  {% if arrowPosition === 'floating' %}
43
43
  {{ IconButton({
44
44
  iconName: 'arrow_back',
45
- variant: 'elevated',
45
+ variant: 'primary',
46
+ emphasis: 'elevated',
46
47
  size: 'small',
47
48
  attributes: { 'aria-label': 'Föregående' },
48
49
  classNames: componentClassName + '__swipe-arrow ' + componentClassName + '__swipe-arrow--back hidden-mobile hidden-tablet',
@@ -50,7 +51,8 @@
50
51
  }) }}
51
52
  {{ IconButton({
52
53
  iconName: 'arrow_forward',
53
- variant: 'elevated',
54
+ variant: 'primary',
55
+ emphasis: 'elevated',
54
56
  size: 'small',
55
57
  attributes: { 'aria-label': 'Nästa' },
56
58
  classNames: componentClassName + '__swipe-arrow ' + componentClassName + '__swipe-arrow--forward hidden-mobile hidden-tablet',
@@ -35,7 +35,7 @@
35
35
  {{ Button({
36
36
  text: params.listLink.text,
37
37
  href: params.listLink.url,
38
- variant: 'secondaryFilled',
38
+ variant: 'secondary',
39
39
  fullWidth: true,
40
40
  classNames: params.listLink.classNames,
41
41
  attributes: params.listLink.attributes,
@@ -95,7 +95,7 @@ $ds-text-input-toggle-btn__area: ($ds-text-input-toggle-btn__width + ds-spacing(
95
95
  }
96
96
  }
97
97
 
98
- .ds-icon-btn.ds-text-input__password-toggle {
98
+ .ds-btn.ds-text-input__password-toggle {
99
99
  position: absolute;
100
100
  top: ds-px-to-rem($ds-text-input-toggle-btn__top);
101
101
  right: ds-spacing($ds-s-025);
@@ -1,2 +1,2 @@
1
1
  $ds-opacity-component-disabled: 0.5;
2
- $ds-opacity-component-hover-pressed: 0.8;
2
+ $ds-opacity-component-hover-pressed: 0.7;
@@ -23,6 +23,7 @@ $ds-typography-detailteaser-twin: 'detailteaser-twin';
23
23
  $ds-typography-detailteaser-large-compact: 'detailteaser-large-compact';
24
24
  $ds-typography-detailteaser-large-compact-opinion: 'detailteaser-large-compact-opinion';
25
25
  $ds-typography-detailteaser-large-storRubrik-opinion: 'detailteaser-large-storRubrik-opinion';
26
+ $ds-typography-detailstandard-button-xlarge: 'detailstandard-button-xlarge';
26
27
  $ds-typography-expressiveheading01: 'expressiveheading01';
27
28
  $ds-typography-expressiveheading02: 'expressiveheading02';
28
29
  $ds-typography-expressiveheading03: 'expressiveheading03';
@@ -181,6 +181,13 @@ $typographyTokensScreenExtraLarge: (
181
181
  textCase: uppercase,
182
182
  letterSpacing: 0.5
183
183
  ),
184
+ detailstandard-button-xlarge: (
185
+ fontFamily: "DN Sans",
186
+ fontWeight: SemiBold,
187
+ fontSize: 18,
188
+ lineHeight: 1.75,
189
+ letterSpacing: 0
190
+ ),
184
191
  expressiveheading01: (
185
192
  fontFamily: "DN Serif Text",
186
193
  fontWeight: Bold,
@@ -340,7 +347,7 @@ $typographyTokensScreenExtraLarge: (
340
347
  fontFamily: "DN Sans",
341
348
  fontWeight: Bold,
342
349
  fontSize: 24,
343
- lineHeight: 1.1,
350
+ lineHeight: 1.2,
344
351
  letterSpacing: 0
345
352
  ),
346
353
  functionalheading04: (
@@ -182,6 +182,13 @@ $typographyTokensScreenLarge: (
182
182
  textCase: uppercase,
183
183
  letterSpacing: 0.5
184
184
  ),
185
+ detailstandard-button-xlarge: (
186
+ fontFamily: "DN Sans",
187
+ fontWeight: SemiBold,
188
+ fontSize: 18,
189
+ lineHeight: 1.75,
190
+ letterSpacing: 0
191
+ ),
185
192
  expressiveheading01: (
186
193
  fontFamily: "DN Serif Text",
187
194
  fontWeight: Bold,
@@ -341,7 +348,7 @@ $typographyTokensScreenLarge: (
341
348
  fontFamily: "DN Sans",
342
349
  fontWeight: Bold,
343
350
  fontSize: 24,
344
- lineHeight: 1.1,
351
+ lineHeight: 1.2,
345
352
  letterSpacing: 0
346
353
  ),
347
354
  functionalheading04: (
@@ -182,6 +182,13 @@ $typographyTokensScreenSmall: (
182
182
  letterSpacing: 0,
183
183
  fontStyle: italic
184
184
  ),
185
+ detailstandard-button-xlarge: (
186
+ fontFamily: "DN Sans",
187
+ fontWeight: SemiBold,
188
+ fontSize: 18,
189
+ lineHeight: 1.75,
190
+ letterSpacing: 0
191
+ ),
185
192
  expressiveheading01: (
186
193
  fontFamily: "DN Serif Text",
187
194
  fontWeight: Bold,
@@ -341,7 +348,7 @@ $typographyTokensScreenSmall: (
341
348
  fontFamily: "DN Sans",
342
349
  fontWeight: Bold,
343
350
  fontSize: 20,
344
- lineHeight: 1.1,
351
+ lineHeight: 1.2,
345
352
  letterSpacing: 0
346
353
  ),
347
354
  functionalheading04: (
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bonniernews/dn-design-system-web",
3
- "version": "14.0.3",
3
+ "version": "15.0.0-beta.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",
@@ -24,6 +24,7 @@
24
24
  "detailteaser-large-compact": "'detailteaser-large-compact'",
25
25
  "detailteaser-large-compact-opinion": "'detailteaser-large-compact-opinion'",
26
26
  "detailteaser-large-storRubrik-opinion": "'detailteaser-large-storRubrik-opinion'",
27
+ "detailstandard-button-xlarge": "'detailstandard-button-xlarge'",
27
28
  "expressiveheading01": "'expressiveheading01'",
28
29
  "expressiveheading02": "'expressiveheading02'",
29
30
  "expressiveheading03": "'expressiveheading03'",
@@ -1,41 +0,0 @@
1
- - GitHub: [BonnierNews/dn-design-system/../web/src/components/floating-button](https://github.com/BonnierNews/dn-design-system/tree/main/web/src/components/floating-button)
2
- - Storybook: [Button > Web](https://designsystem.dn.se/?path=/story/components-app-web-floatingbutton-web)
3
-
4
- ----
5
-
6
- # FloatingButton
7
-
8
- ## Parameters
9
-
10
- |parameter | type | required | options | default | description |
11
- |:--- | :--- | :--- | :--- | :--- | :--- |
12
- |text | String | yes | | | |
13
- |disabled | bool | no | true, false | false | Note: only works on button-tag, not on a-tag |
14
- |size| String | no | default, small | default | |
15
- |iconName | String | no | add, arrow_back, arrow_forward etc | | For all available icons see: https://designsystem.dn.se/?path=/story/foundations-icon-web--all |
16
- |iconPosition | String | no | none, left, right | none | |
17
- |loading | bool | no | true, false | false | |
18
- |href | String | no | | | If href is set the button will be rendered as an a-tag |
19
- |attributes | Object | no | | | Ex. { target: "_blank", "data-test": "lorem ipsum" } |
20
- |classNames | String | no | | | Ex. "my-special-class" |
21
- |forcePx | bool | no | true, false | false | Fixed pixel value is used for typography to prevent scaling based on html font-size
22
-
23
- ## Minimum requirement example
24
-
25
- ### Nunjucks
26
-
27
- These are copy paste friendly examples to quickliy get started using a component.
28
-
29
- ```html
30
- {% from '@bonniernews/dn-design-system-web/components/floating-button/floating-button.njk' import FloatingButton %}
31
-
32
- {{ FloatingButton({
33
- text: 'With icon',
34
- iconName: 'arrow_forward'
35
- })}}
36
- ```
37
-
38
- ### SCSS
39
- ```scss
40
- @use "@bonniernews/dn-design-system-web/components/floating-button/floating-button";
41
- ```
@@ -1,41 +0,0 @@
1
- {% from '@bonniernews/dn-design-system-web/components/icon-sprite/icon-sprite.njk' import IconUse %}
2
- {% from '@bonniernews/dn-design-system-web/components/spinner/spinner.njk' import Spinner %}
3
- {% from '@bonniernews/dn-design-system-web/njk-helpers/attributes.njk' import getAttributes %}
4
-
5
- {% macro FloatingButton(params) %}
6
- {%- set componentClassName = "ds-floating-btn" %}
7
- {%- set classNamePrefix = componentClassName + "--" %}
8
- {%- set text = params.text %}
9
- {%- set attributes = getAttributes(params.attributes) %}
10
- {%- set ariaLabel = 'aria-label="' + text + '"' if not params.attributes["aria-label"] else "" %}
11
-
12
- {%- set loadingHtml %}
13
- {{ Spinner({ size: 'small', forcePx: params.forcePx }) }}
14
- {% endset %}
15
-
16
- {%- if params.iconName and params.iconPosition and params.iconPosition != "none" %}
17
- {% set iconSvg = IconUse({ icon: params.iconName, attributes: { "aria-hidden": "true" } }) %}
18
- {% endif %}
19
-
20
- {%- set classes = [
21
- componentClassName,
22
- "ds-force-px" if params.forcePx,
23
- "ds-loading" if params.loading,
24
- classNamePrefix + params.size if params.size and params.size !== "default",
25
- classNamePrefix + "icon" if iconSvg,
26
- classNamePrefix + "icon-" + params.iconPosition if iconSvg,
27
- params.classNames if params.classNames
28
- ] | join(" ") %}
29
-
30
- {%- if params.href %}
31
- <a href="{{ params.href | default('#', true) }}" {{ ariaLabel | safe }} class="{{ classes }}" {{- attributes | safe}}>
32
- <span aria-hidden="true">{{ text }}</span>
33
- {{- iconSvg | safe if iconSvg -}} {{ loadingHtml | safe }}
34
- </a>
35
- {% else %}
36
- <button {{ ariaLabel | safe }} class="{{ classes }}" {{ "disabled" if params.disabled }} {{- attributes | safe}}>
37
- <span aria-hidden="true">{{ text }}</span>
38
- {{- iconSvg | safe if iconSvg -}} {{ loadingHtml | safe }}
39
- </button>
40
- {% endif %}
41
- {% endmacro %}
@@ -1,145 +0,0 @@
1
- @use "sass:math";
2
- @use "../../foundations/helpers/forward.helpers.scss" as *;
3
- @use "../icon-sprite/icon-sprite.scss";
4
- @use "../spinner/spinner.scss" as *;
5
-
6
- .ds-floating-btn {
7
- --ds-floating-btn__padding: #{ds-spacing($ds-s-075 $ds-s-125, rem)};
8
- --ds-floating-btn__icon-size: #{ds-px-to-rem(24px)};
9
-
10
- &.ds-force-px {
11
- --ds-floating-btn__padding: #{ds-spacing($ds-s-075 $ds-s-125)};
12
- --ds-floating-btn__icon-size: 24px;
13
- @include ds-typography($ds-typography-detailstandard-button, true);
14
- }
15
-
16
- &.ds-floating-btn--icon-left {
17
- --ds-floating-btn__padding: #{ds-spacing($ds-s-075 $ds-s-125 $ds-s-075 $ds-s-100, rem)};
18
- --ds-floating-btn__icon-margin: #{ds-spacing(0 $ds-s-050 0 0)};
19
-
20
- &.ds-force-px {
21
- --ds-floating-btn__padding: #{ds-spacing($ds-s-075 $ds-s-125 $ds-s-075 $ds-s-100)};
22
- }
23
- }
24
-
25
- &.ds-floating-btn--icon-right {
26
- --ds-floating-btn__padding: #{ds-spacing($ds-s-075 $ds-s-100 $ds-s-075 $ds-s-125, rem)};
27
- --ds-floating-btn__icon-margin: #{ds-spacing(0 0 0 $ds-s-050)};
28
-
29
- &.ds-force-px {
30
- --ds-floating-btn__padding: #{ds-spacing($ds-s-075 $ds-s-100 $ds-s-075 $ds-s-125)};
31
- }
32
- }
33
-
34
- &.ds-floating-btn--small {
35
- --ds-floating-btn__padding: #{ds-spacing($ds-s-050 $ds-s-125, rem)};
36
-
37
- &.ds-force-px {
38
- --ds-floating-btn__padding: #{ds-spacing($ds-s-050 $ds-s-125)};
39
-
40
- &.ds-floating-btn--icon-left {
41
- --ds-floating-btn__padding: #{ds-spacing($ds-s-050 $ds-s-125 $ds-s-050 $ds-s-100)};
42
- }
43
-
44
- &.ds-floating-btn--icon-right {
45
- --ds-floating-btn__padding: #{ds-spacing($ds-s-050 $ds-s-100 $ds-s-050 $ds-s-125)};
46
- }
47
- }
48
-
49
- &.ds-floating-btn--icon-left {
50
- --ds-floating-btn__padding: #{ds-spacing($ds-s-050 $ds-s-125 $ds-s-050 $ds-s-100, rem)};
51
- }
52
-
53
- &.ds-floating-btn--icon-right {
54
- --ds-floating-btn__padding: #{ds-spacing($ds-s-050 $ds-s-100 $ds-s-050 $ds-s-125, rem)};
55
- }
56
- }
57
-
58
- cursor: pointer;
59
- @include ds-typography($ds-typography-detailstandard-button);
60
- color: $ds-color-text-secondary;
61
- background-color: $ds-color-component-primary;
62
- border-radius: 100px;
63
- padding: var(--ds-floating-btn__padding);
64
- position: relative;
65
- box-shadow: ds-shadow-get-box-shadow($ds-shadow-elevation-m);
66
- border: none;
67
- display: inline-flex;
68
- align-items: center;
69
- justify-content: center;
70
-
71
- span {
72
- pointer-events: none;
73
- }
74
-
75
- &:focus-visible {
76
- outline: ds-metrics-border-width(x2) solid;
77
- outline-offset: 2px;
78
- outline-color: $ds-color-border-focus-02;
79
- }
80
-
81
- @at-root a#{&} {
82
- box-sizing: border-box;
83
- text-align: center;
84
- text-decoration: none;
85
- }
86
-
87
- &::before {
88
- content: "";
89
- border-radius: inherit;
90
- pointer-events: none;
91
- position: absolute;
92
- top: 0;
93
- bottom: 0;
94
- left: 0;
95
- right: 0;
96
- }
97
-
98
- @include min-click-surface();
99
-
100
- @include ds-hover() {
101
- &:hover:not(:disabled):not(.ds-loading)::before {
102
- background-color: $ds-color-component-secondary-overlay;
103
- }
104
- }
105
-
106
- &:active:not(:disabled):not(.ds-loading)::before {
107
- background-color: $ds-color-component-secondary-overlay-02;
108
- }
109
-
110
- &:not(.ds-loading):disabled {
111
- opacity: $ds-opacity-component-disabled;
112
- cursor: not-allowed;
113
- }
114
-
115
- // we have to override spinner styling since spinner variant is based on "off" button variant
116
- &.ds-loading {
117
- border-top-color: $ds-color-icon-secondary;
118
- &::before {
119
- border-color: $ds-color-icon-secondary;
120
- }
121
- }
122
-
123
- @include ds-loading();
124
- }
125
-
126
- .ds-floating-btn--icon {
127
- display: inline-flex;
128
- align-items: center;
129
- justify-content: center;
130
-
131
- .ds-icon {
132
- display: flex;
133
- margin: var(--ds-floating-btn__icon-margin);
134
- height: var(--ds-floating-btn__icon-size);
135
- width: var(--ds-floating-btn__icon-size);
136
-
137
- svg {
138
- fill: currentColor;
139
- }
140
- }
141
- }
142
-
143
- .ds-floating-btn--icon-left {
144
- flex-direction: row-reverse;
145
- }
@@ -1,21 +0,0 @@
1
- export {
2
- dsIconButtonToggle,
3
- dsIconButtonToggleAll
4
- };
5
-
6
- function dsIconButtonToggle(toggleElements = []) {
7
- if (!toggleElements.length) return;
8
- toggleElements.forEach((toggleEl) => {
9
- toggleEl.addEventListener("click", () => {
10
- if (toggleEl.classList.contains("ds-icon-btn--disabled")) return;
11
- toggleEl.classList.toggle("ds-icon-btn--selected");
12
- const ariaChecked = toggleEl.getAttribute("aria-checked") === "true" ? "false" : "true";
13
- toggleEl.setAttribute("aria-checked", ariaChecked);
14
- });
15
- });
16
- }
17
-
18
- function dsIconButtonToggleAll() {
19
- const toggleElements = Array.from(document.getElementsByClassName("ds-icon-btn--toggle"));
20
- dsIconButtonToggle(toggleElements);
21
- }