@bonniernews/dn-design-system-web 14.3.9 → 14.4.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 (95) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/components/article-body-image/README-UXD.md +0 -0
  3. package/components/article-top-image/README-UXD.md +0 -0
  4. package/components/badge/README-UXD.md +0 -0
  5. package/components/blocked-content/README-UXD.md +0 -0
  6. package/components/blocked-content/blocked-content.js +1 -1
  7. package/components/blocked-content/blocked-content.njk +2 -2
  8. package/components/buddy-menu/README-UXD.md +0 -0
  9. package/components/button/README-UXD.md +40 -0
  10. package/components/button/README.md +4 -2
  11. package/components/{button-toggle/button-toggle.js → button/button.js} +3 -3
  12. package/components/button/button.njk +62 -15
  13. package/components/button/button.scss +179 -121
  14. package/components/button-toggle/README-UXD.md +0 -0
  15. package/components/button-toggle/README.md +4 -4
  16. package/components/button-toggle/button-toggle.njk +17 -36
  17. package/components/button-toggle/button-toggle.scss +1 -215
  18. package/components/byline/README-UXD.md +0 -0
  19. package/components/byline/README.md +2 -2
  20. package/components/byline/byline.njk +2 -2
  21. package/components/checkbox/README-UXD.md +0 -0
  22. package/components/direkt-circle/README-UXD.md +0 -0
  23. package/components/disclaimer/README-UXD.md +0 -0
  24. package/components/divider/README-UXD.md +0 -0
  25. package/components/factbox/README-UXD.md +0 -40
  26. package/components/factbox/factbox.njk +4 -4
  27. package/components/floating-button/README-UXD.md +0 -0
  28. package/components/footer/README-UXD.md +0 -0
  29. package/components/game-header/README-UXD.md +0 -0
  30. package/components/group-header/README-UXD.md +0 -0
  31. package/components/group-header/group-header.njk +5 -3
  32. package/components/group-header/group-header.scss +4 -4
  33. package/components/icon-button/README-UXD.md +0 -0
  34. package/components/icon-button/README.md +5 -3
  35. package/components/icon-button/icon-button.njk +18 -51
  36. package/components/icon-button/icon-button.scss +19 -126
  37. package/components/icon-button-toggle/README-UXD.md +0 -0
  38. package/components/icon-button-toggle/README.md +8 -8
  39. package/components/icon-button-toggle/icon-button-toggle.njk +14 -1
  40. package/components/icon-button-toggle/icon-button-toggle.scss +1 -17
  41. package/components/icon-sprite/README-UXD.md +0 -0
  42. package/components/icon-sprite/README.md +1 -0
  43. package/components/icon-with-wrapper/README-UXD.md +0 -0
  44. package/components/image-caption/README-UXD.md +0 -0
  45. package/components/link-box/README-UXD.md +0 -0
  46. package/components/list-item/README-UXD.md +0 -0
  47. package/components/list-item/list-item.js +2 -2
  48. package/components/list-item/list-item.njk +2 -2
  49. package/components/list-item/list-item.scss +1 -1
  50. package/components/modal/README-UXD.md +0 -0
  51. package/components/modal/modal.njk +3 -2
  52. package/components/modal/modal.scss +4 -4
  53. package/components/pictogram/README-UXD.md +0 -0
  54. package/components/quote/README-UXD.md +0 -0
  55. package/components/radio-button/README-UXD.md +0 -0
  56. package/components/spinner/README-UXD.md +0 -0
  57. package/components/switch/README-UXD.md +0 -0
  58. package/components/tag-header/README-UXD.md +0 -0
  59. package/components/tag-header/tag-header.njk +1 -1
  60. package/components/teaser-card/README-UXD.md +0 -0
  61. package/components/teaser-dot/README-UXD.md +0 -0
  62. package/components/teaser-footer/README-UXD.md +0 -0
  63. package/components/teaser-image/README-UXD.md +0 -0
  64. package/components/teaser-large/README-UXD.md +0 -0
  65. package/components/teaser-list-swipe/README-UXD.md +0 -0
  66. package/components/teaser-list-swipe/teaser-list-swipe.njk +4 -2
  67. package/components/teaser-list-vertical/README-UXD.md +0 -0
  68. package/components/teaser-list-vertical/teaser-list-vertical.njk +1 -1
  69. package/components/teaser-longlife/README-UXD.md +0 -0
  70. package/components/teaser-native/README-UXD.md +0 -0
  71. package/components/teaser-onsite/README-UXD.md +0 -0
  72. package/components/teaser-package/README-UXD.md +0 -0
  73. package/components/teaser-right-now/README-UXD.md +0 -0
  74. package/components/teaser-slideshow/README-UXD.md +0 -0
  75. package/components/teaser-split/README-UXD.md +0 -0
  76. package/components/teaser-standard/README-UXD.md +0 -0
  77. package/components/teaser-swipe-card/README-UXD.md +0 -0
  78. package/components/teaser-tipsa/README-UXD.md +0 -0
  79. package/components/text-button/README-UXD.md +0 -0
  80. package/components/text-button-toggle/README-UXD.md +0 -0
  81. package/components/text-input/README-UXD.md +0 -0
  82. package/components/text-input/text-input.scss +1 -1
  83. package/components/thematic-break/README-UXD.md +0 -0
  84. package/components/tooltip/README-UXD.md +0 -0
  85. package/components/video-caption/README-UXD.md +0 -0
  86. package/components/vip-badge/README-UXD.md +0 -0
  87. package/foundations/helpers/README-UXD.md +0 -0
  88. package/foundations/typography/README-UXD.md +0 -0
  89. package/introduction/README-UXD.md +1 -0
  90. package/introduction/README.md +19 -0
  91. package/package.json +1 -1
  92. package/components/floating-button/README.md +0 -41
  93. package/components/floating-button/floating-button.njk +0 -41
  94. package/components/floating-button/floating-button.scss +0 -145
  95. package/components/icon-button-toggle/icon-button-toggle.js +0 -21
@@ -14,8 +14,8 @@
14
14
  |text | String | yes | | | |
15
15
  |selectedText | String | yes | | | |
16
16
  |disabled | bool | no | true, false | false | |
17
- |variant | String | no | brand, SecondaryFilled | brand | Design variant |
18
- |size| String | no | default, small, xsmall | default | |
17
+ |variant | String | no | primary, secondary, brand | primary | Design variant |
18
+ |size| String | no | small, medium, large | medium | |
19
19
  |fullWidth | bool | no | true, false | false | Button will be full width on both desktop and mobile |
20
20
  |mobile.fullWidth | bool | no | true, false | false | Ex mobile: { fullWidth: true } |
21
21
  |loading | bool | no | true, false | false | |
@@ -50,7 +50,7 @@ These are copy paste friendly examples to quickliy get started using a component
50
50
  ### Javascript
51
51
 
52
52
  ```javascript
53
- import dsButtonToggle from '@bonniernews/dn-design-system-web/components/button-toggle/button-toggle.js'
54
- const toggleElements = Array.from(document.getElementsByClassName("ds-btn-toggle"));
53
+ import dsButtonToggle from '@bonniernews/dn-design-system-web/components/button/button.js'
54
+ const toggleElements = Array.from(document.getElementsByClassName("ds-btn--toggle"));
55
55
  dsButtonToggle(toggleElements);
56
56
  ```
@@ -1,39 +1,20 @@
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 %}
1
+ {% from '@bonniernews/dn-design-system-web/components/button/button.njk' import Button %}
4
2
 
5
3
  {% macro ButtonToggle(params) %}
6
- {%- set componentClassName = "ds-btn-toggle" %}
7
- {%- set classNamePrefix = componentClassName + "--" %}
8
- {%- set attributes = getAttributes(params.attributes) %}
9
- {%- set ariaLabel = 'aria-label="' + params.text + '"' if not params.attributes["aria-label"] else "" %}
10
- {%- set buttonVariant = params.variant | default("brand") %}
11
-
12
- {%- set spinnerMap = { primary: "secondary", brand: "onBrand", business: "onBusiness" } %}
13
- {%- set spinnerVariant = spinnerMap[buttonVariant] | default("primary") %}
14
- {%- set spinnerSize = "xsmall" if params.size == "xsmall" else "small" %}
15
-
16
- {%- set loadingHtml %}
17
- {{ Spinner({ size: spinnerSize, variant: spinnerVariant, forcePx: params.forcePx, attributes: { "aria-hidden": "true" } }) }}
18
- {% endset %}
19
-
20
- {%- set classes = [
21
- componentClassName,
22
- classNamePrefix + buttonVariant,
23
- classNamePrefix + "selected" if params.selected,
24
- classNamePrefix + params.size if params.size and params.size !== "default",
25
- classNamePrefix + "full-width" if params.fullWidth,
26
- classNamePrefix + "mobile-full-width" if params.mobile and params.mobile.fullWidth,
27
- "ds-loading" if params.loading,
28
- "ds-force-px" if params.forcePx,
29
- params.classNames if params.classNames
30
- ] | join(" ") %}
31
-
32
- <button type="button" role="switch" {{ ariaLabel | safe }} aria-checked="{{ "true" if params.selected else "false" }}" class="{{ classes }}" {{ "disabled" if params.disabled }} {{- attributes | safe }}>
33
- <span class="{{ componentClassName + '__off' }}" aria-hidden="true"><span>{{ params.text }}</span></span>
34
- <span class="{{ componentClassName + '__on' }}" aria-hidden="true">
35
- {{ IconUse({ icon: "check" }) }} <span>{{ params.selectedText }}</span>
36
- </span>
37
- {{ loadingHtml | safe }}
38
- </button>
4
+ {{ Button({
5
+ isToggle: true,
6
+ rounded: true,
7
+ selected: params.selected,
8
+ text: params.text,
9
+ selectedText: params.selectedText,
10
+ variant: params.variant,
11
+ disabled: params.disabled,
12
+ size: params.size,
13
+ fullWidth: params.fullWidth,
14
+ mobile: params.mobile,
15
+ loading: params.loading,
16
+ forcePx: params.forcePx,
17
+ classNames: params.classNames,
18
+ attributes: params.attributes
19
+ }) }}
39
20
  {% endmacro %}
@@ -1,215 +1 @@
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-btn-toggle-outlined__border-width: ds-metrics-border-width(x1);
7
- $ds-btn-toggle__icon-size: 24px;
8
- $ds-btn-toggle__icon-size-xsmall: 20px;
9
-
10
- .ds-btn-toggle {
11
- --ds-btn-toggle__background-color: transparent;
12
- --ds-btn-toggle__background-color-hover: #{$ds-color-component-primary-overlay};
13
- --ds-btn-toggle__background-color-active: #{$ds-color-component-primary-overlay-02};
14
- --ds-btn-toggle__border-color: #{$ds-color-border-primary-03};
15
- --ds-btn-toggle__outline-color: #{$ds-color-border-focus-02};
16
- --ds-btn-toggle__color: #{$ds-color-text-primary};
17
-
18
- &--brand:not(.ds-btn-toggle--selected) {
19
- --ds-btn-toggle__background-color: #{$ds-color-component-brand};
20
- --ds-btn-toggle__border-color: transparent;
21
- --ds-btn-toggle__outline-color: #{$ds-color-border-focus};
22
- --ds-btn-toggle__color: #{$ds-color-text-on-brand};
23
- &:not(.ds-loading):disabled {
24
- opacity: $ds-opacity-component-disabled;
25
- }
26
- }
27
-
28
- &--secondaryFilled:not(.ds-btn-toggle--selected) {
29
- --ds-btn-toggle__border-color: transparent;
30
- --ds-btn-toggle__outline-color: #{$ds-color-border-focus-02};
31
- --ds-btn-toggle__background-color: #{$ds-color-component-primary-overlay};
32
- }
33
-
34
- &--secondaryFilled,
35
- &--selected {
36
- &:not(.ds-loading):disabled {
37
- --ds-btn-toggle__border-color: transparent;
38
- --ds-btn-toggle__color: #{$ds-color-text-disabled};
39
- &::before {
40
- --ds-btn-toggle__background-color: unset;
41
- }
42
- }
43
- }
44
-
45
- &:not(.ds-loading):disabled {
46
- cursor: not-allowed;
47
- }
48
-
49
- @include ds-typography($ds-typography-detailstandard-button);
50
- cursor: pointer;
51
- color: var(--ds-btn-toggle__color);
52
- background-color: var(--ds-btn-toggle__background-color);
53
- min-width: 0;
54
- min-height: 0;
55
- display: inline-flex;
56
- align-items: center;
57
- justify-content: center;
58
- flex-shrink: 0;
59
- border: $ds-btn-toggle-outlined__border-width solid var(--ds-btn-toggle__border-color);
60
- border-radius: 100px;
61
- position: relative;
62
- padding: ds-spacing($ds-s-075, rem) - ds-px-to-rem($ds-btn-toggle-outlined__border-width) ds-spacing($ds-s-150, rem) - ds-px-to-rem(
63
- $ds-btn-toggle-outlined__border-width
64
- );
65
-
66
- &::before {
67
- content: "";
68
- border-radius: inherit;
69
- pointer-events: none;
70
- position: absolute;
71
- top: -$ds-btn-toggle-outlined__border-width;
72
- left: -$ds-btn-toggle-outlined__border-width;
73
- bottom: -$ds-btn-toggle-outlined__border-width;
74
- right: -$ds-btn-toggle-outlined__border-width;
75
- }
76
- span,
77
- i {
78
- position: relative;
79
- }
80
- .ds-btn-toggle__on {
81
- display: none;
82
- }
83
-
84
- span {
85
- pointer-events: none;
86
- }
87
-
88
- @include min-click-surface();
89
-
90
- &:focus-visible {
91
- outline: ds-metrics-border-width(x2) solid var(--ds-btn-toggle__outline-color);
92
- outline-offset: 2px;
93
- }
94
-
95
- @at-root a#{&} {
96
- box-sizing: border-box;
97
- text-align: center;
98
- text-decoration: none;
99
- }
100
-
101
- @include ds-hover() {
102
- &:hover:not(:disabled):not(.ds-loading)::before {
103
- background-color: var(--ds-btn-toggle__background-color-hover);
104
- }
105
- }
106
- &:active:not(:disabled):not(.ds-loading)::before {
107
- background-color: var(--ds-btn-toggle__background-color-active);
108
- }
109
-
110
- @include ds-loading();
111
- }
112
-
113
- .ds-btn-toggle--full-width {
114
- width: 100%;
115
- box-sizing: border-box;
116
- }
117
-
118
- .ds-btn-toggle--small {
119
- padding: ds-px-to-rem(ds-spacing($ds-s-050) - $ds-btn-toggle-outlined__border-width)
120
- ds-px-to-rem(ds-spacing($ds-s-125) - $ds-btn-toggle-outlined__border-width);
121
- }
122
-
123
- .ds-btn-toggle--xsmall {
124
- @include ds-typography($ds-typography-detailstandard-button-small);
125
- padding: ds-px-to-rem(ds-spacing($ds-s-025) - $ds-btn-toggle-outlined__border-width)
126
- ds-px-to-rem(ds-spacing($ds-s-075) - $ds-btn-toggle-outlined__border-width);
127
- }
128
-
129
- @include ds-mq-only-breakpoint(mobile) {
130
- .ds-btn-toggle--mobile-full-width {
131
- width: 100%;
132
- }
133
- }
134
-
135
- .ds-btn-toggle--selected {
136
- display: inline-flex;
137
- align-items: center;
138
- justify-content: center;
139
- padding-left: ds-px-to-rem(ds-spacing($ds-s-125) - $ds-btn-toggle-outlined__border-width);
140
-
141
- .ds-btn-toggle__on {
142
- display: flex;
143
- }
144
- .ds-btn-toggle__off {
145
- display: none;
146
- }
147
-
148
- .ds-icon {
149
- display: flex;
150
- height: ds-px-to-rem($ds-btn-toggle__icon-size);
151
- width: ds-px-to-rem($ds-btn-toggle__icon-size);
152
- margin: ds-spacing(0 $ds-s-050 0 0, rem);
153
- svg {
154
- fill: currentColor;
155
- }
156
- }
157
-
158
- &.ds-btn-toggle--small {
159
- padding-left: ds-px-to-rem(ds-spacing($ds-s-100) - $ds-btn-toggle-outlined__border-width);
160
- }
161
-
162
- &.ds-btn-toggle--xsmall {
163
- padding-left: ds-px-to-rem(ds-spacing($ds-s-050) - $ds-btn-toggle-outlined__border-width);
164
- .ds-icon {
165
- height: ds-px-to-rem($ds-btn-toggle__icon-size-xsmall);
166
- width: ds-px-to-rem($ds-btn-toggle__icon-size-xsmall);
167
- margin: ds-spacing(0 $ds-s-025 0 0, rem);
168
- }
169
- }
170
-
171
- // we have to override spinner styling since spinner variant is based on "off" button variant
172
- &.ds-loading {
173
- .ds-spinner__inner {
174
- border-top-color: $ds-color-icon-primary;
175
- &::before {
176
- border-color: $ds-color-icon-primary;
177
- }
178
- }
179
- }
180
- }
181
-
182
- .ds-btn-toggle.ds-force-px {
183
- /* stylelint-disable-next-line */
184
- padding: ds-spacing($ds-s-075) - $ds-btn-toggle-outlined__border-width ds-spacing($ds-s-150) -
185
- $ds-btn-toggle-outlined__border-width;
186
- @include ds-typography($ds-typography-detailstandard-button, true);
187
-
188
- &.ds-btn-toggle--selected {
189
- padding-left: ds-spacing($ds-s-125)-$ds-btn-toggle-outlined__border-width;
190
- .ds-icon {
191
- margin: ds-spacing(0 $ds-s-050 0 0);
192
- height: $ds-btn-toggle__icon-size;
193
- width: $ds-btn-toggle__icon-size;
194
- }
195
- }
196
- &.ds-btn-toggle--small {
197
- padding: ds-spacing($ds-s-050)-$ds-btn-toggle-outlined__border-width ds-spacing($ds-s-125)-$ds-btn-toggle-outlined__border-width;
198
-
199
- &.ds-btn-toggle--selected {
200
- padding-left: ds-spacing($ds-s-100)-$ds-btn-toggle-outlined__border-width;
201
- }
202
- }
203
- &.ds-btn-toggle--xsmall {
204
- @include ds-typography($ds-typography-detailstandard-button-small, true);
205
- padding: ds-spacing($ds-s-025)-$ds-btn-toggle-outlined__border-width ds-spacing($ds-s-075)-$ds-btn-toggle-outlined__border-width;
206
- .ds-icon {
207
- margin: ds-spacing(0 $ds-s-025 0 0);
208
- height: $ds-btn-toggle__icon-size-xsmall;
209
- width: $ds-btn-toggle__icon-size-xsmall;
210
- }
211
- &.ds-btn-toggle--selected {
212
- padding-left: ds-spacing($ds-s-050)-$ds-btn-toggle-outlined__border-width;
213
- }
214
- }
215
- }
1
+ @use "../button/button.scss" as *;
File without changes
@@ -62,7 +62,7 @@ These are copy paste friendly examples to quickliy get started using a component
62
62
  ### Javascript
63
63
 
64
64
  ```javascript
65
- import dsButtonToggle from '@bonniernews/dn-design-system-web/components/button-toggle/button-toggle.js'
66
- const toggleElements = Array.from(document.getElementsByClassName("ds-btn-toggle"));
65
+ import dsButtonToggle from '@bonniernews/dn-design-system-web/components/button/button.js'
66
+ const toggleElements = Array.from(document.getElementsByClassName("ds-btn--toggle"));
67
67
  dsButtonToggle(toggleElements);
68
68
  ```
@@ -28,8 +28,8 @@
28
28
  text: "Följ",
29
29
  selectedText: "Följer",
30
30
  selected: params.followed,
31
- variant: "secondaryFilled",
32
- size: "xsmall",
31
+ variant: "secondary",
32
+ size: "small",
33
33
  attributes: params.elementAttributes,
34
34
  classNames: elementClassNames | join(" "),
35
35
  forcePx: params.forcePx
File without changes
File without changes
File without changes
File without changes
@@ -1,40 +0,0 @@
1
- # Standard button
2
-
3
- Buttons are used to initialize an action. Button labels express what action will occur when the user interacts with it.
4
-
5
-
6
- ### Anatomy
7
-
8
- 1. **Label:** The text displayed on the button, indicating its function.
9
- 2. **Icon** Iconography that enhances the function.
10
- 3. **Background:** The background color or style that defines the button's appearance.
11
- 4. **Border:** The outline surrounding the button, providing visual separation from surrounding elements.
12
- 5. **Shape** The standard shape is rectangular but the component also supports a rounded format.
13
-
14
-
15
- ## Variants
16
-
17
- | Variant | How to use |
18
- | --------- | ---------------------------------------------------------------------------------------------------- |
19
- | Brand | Extra high emphasis button used for actions that are extra important for the user flow and conversion. I.e. ”Logga in” |
20
- | Primary | High emphasis button used to attract attention to the most important task of the layout, typically the next step in the user flow. I.e. ”Nästa fråga” in a quiz. |
21
- | Secondary | Medium emphasis button used for alternative non-primary actions. I.e. ”Alla nyheter” in a list of news. |
22
- | Outline | Low emphasis Button used for less important actions. Usually used in combination with a primary or brand Button. |
23
-
24
-
25
- ## Usage
26
-
27
- Buttons are used to initialize an action. Button labels express what action will occur when the user interacts with it.
28
-
29
-
30
- ### Dos
31
-
32
- - **Use Primary Buttons for Key Actions:** Employ primary buttons for primary actions within a given context, guiding user focus towards important interactions.
33
- - **Provide Clear Labeling:** Ensure button labels are concise, descriptive, and indicative of the action they perform, enhancing usability.
34
- - **Maintain Visual Hierarchy:** Utilize secondary and outline buttons to distinguish lesser actions or provide alternative choices, maintaining a clear visual hierarchy.
35
-
36
- ### Don'ts
37
-
38
- - **Avoid Ambiguous Labels:** Refrain from using vague or ambiguous labels like ”Fortsätt” that might confuse users about the button's function.
39
- - **Overuse of Primary Buttons:** Reserve primary buttons for the most crucial actions to avoid overwhelming users with excessive visual weight.
40
-
@@ -29,8 +29,8 @@
29
29
  <div class="{{ componentClassName + '__show-more'}}">
30
30
  {{ Button({
31
31
  text: 'Visa mer',
32
- variant: 'secondaryFilled',
33
- size: 'small',
32
+ variant: 'secondary',
33
+ size: 'medium',
34
34
  iconPosition: 'right',
35
35
  iconName: 'expand_more',
36
36
  classNames: 'ds-factbox__expand-more',
@@ -39,8 +39,8 @@
39
39
  })}}
40
40
  {{ Button({
41
41
  text: 'Visa mindre',
42
- variant: 'secondaryFilled',
43
- size: 'small',
42
+ variant: 'secondary',
43
+ size: 'medium',
44
44
  iconPosition: 'right',
45
45
  iconName: 'expand_less',
46
46
  classNames: 'ds-factbox__expand-less',
File without changes
File without changes
File without changes
File without changes
@@ -47,7 +47,7 @@
47
47
  {% if params.variant == 'toggle' %}
48
48
  {{ ButtonToggle({
49
49
  variant: 'brand',
50
- size: 'xsmall',
50
+ size: 'small',
51
51
  text: params.toggleText,
52
52
  selectedText: params.toggleSelectedText,
53
53
  selected: params.toggleSelected,
@@ -58,14 +58,16 @@
58
58
  {% elif (params.variant == 'arrows') %}
59
59
  <div class="{{ componentClassName + '__arrows' }} hidden-mobile hidden-tablet">
60
60
  {{ IconButton({
61
- variant: "elevated",
61
+ variant: "primary",
62
+ emphasis: "outline",
62
63
  size: "small",
63
64
  iconName: "arrow_back",
64
65
  classNames: "ds-group-header__arrow ds-group-header__arrow--left",
65
66
  attributes: {"aria-label": "Föregående"}
66
67
  }) }}
67
68
  {{ IconButton({
68
- variant: "elevated",
69
+ variant: "primary",
70
+ emphasis: "outline",
69
71
  size: "small",
70
72
  iconName: "arrow_forward",
71
73
  classNames: "ds-group-header__arrow ds-group-header__arrow--right",
@@ -49,7 +49,7 @@ $ds-group-header__icon-size: 24px;
49
49
 
50
50
  .ds-group-header__right-link,
51
51
  .ds-group-header__icon,
52
- .ds-btn-toggle {
52
+ .ds-btn--toggle {
53
53
  flex-shrink: 0;
54
54
  }
55
55
 
@@ -58,15 +58,15 @@ $ds-group-header__icon-size: 24px;
58
58
  flex-shrink: 0;
59
59
  align-items: center;
60
60
 
61
- .ds-icon-btn {
61
+ .ds-btn {
62
62
  margin: ds-spacing(0 $ds-s-050);
63
- + .ds-icon-btn {
63
+ + .ds-btn {
64
64
  margin: ds-spacing(0 0 0 $ds-s-075);
65
65
  }
66
66
  }
67
67
  }
68
68
 
69
- .ds-btn-toggle {
69
+ .ds-btn--toggle {
70
70
  align-self: center;
71
71
  }
72
72
 
File without changes
@@ -12,8 +12,9 @@
12
12
  |:--- | :--- | :--- | :--- | :--- | :--- |
13
13
  |iconName | String | yes | add, arrow_back, arrow_forward etc | | For all available icons see: https://designsystem.dn.se/?path=/story/foundations-icons--all-icons |
14
14
  |disabled | bool | no | true, false | false | Note: only works on button-tag, not on a-tag |
15
- |variant | String | no | outlined, transparent, elevated | outlined | Design variant |
16
- |size| String | no | default, small, large | default | |
15
+ |variant | String | no | primary, secondary, brand, staticWhite | primary | Design variant |
16
+ |emphasis | String | no | default, elevated, outline, transparent | default | |
17
+ |size| String | no | small, medium, large, xlarge | medium | |
17
18
  |loading | bool | no | true, false | false | |
18
19
  |a11y.visuallyHidden | Object | no | | | Ex. a11y: { visuallyHidden: "Dela på TikTok" } |
19
20
  |href | String | no | | | If href is set the button will be rendered as an a-tag |
@@ -31,7 +32,8 @@ These are copy paste friendly examples to quickliy get started using a component
31
32
  {% from '@bonniernews/dn-design-system-web/components/icon-button/icon-button.njk' import IconButton %}
32
33
 
33
34
  {{ IconButton({
34
- variant: 'outlined',
35
+ variant: 'primary',
36
+ emphasis: 'outline',
35
37
  size: 'default',
36
38
  iconName: 'arrow_forward',
37
39
  attributes: { 'aria-label': 'Nästa' }
@@ -1,53 +1,20 @@
1
- {% from '@bonniernews/dn-design-system-web/components/icon-sprite/icon-sprite.njk' import IconUse %}
2
- {% from '@bonniernews/dn-design-system-web/foundations/a11y/visually-hidden.njk' import VisuallyHidden %}
3
- {% from '@bonniernews/dn-design-system-web/components/spinner/spinner.njk' import Spinner %}
4
- {% from '@bonniernews/dn-design-system-web/njk-helpers/attributes.njk' import getAttributes %}
1
+ {% from '@bonniernews/dn-design-system-web/components/button/button.njk' import Button %}
5
2
 
6
- {% macro IconButton(params, isToggle) %}
7
- {%- set componentClassName = "ds-icon-btn" %}
8
- {%- set classNamePrefix = componentClassName + "--" %}
9
- {%- set additionalClasses = [] %}
10
- {%- set attributes = getAttributes(params.attributes) %}
11
- {%- set variantClass = classNamePrefix + (params.variant if params.variant else "outlined") %}
12
- {%- set classes = [
13
- componentClassName,
14
- "ds-force-px" if params.forcePx,
15
- "ds-loading" if params.loading,
16
- variantClass,
17
- classNamePrefix + "toggle" if isToggle,
18
- classNamePrefix + "selected" if isToggle and params.selected,
19
- classNamePrefix + params.size if params.size and params.size !== "default",
20
- params.classNames if params.classNames
21
- ] | join(" ") %}
22
-
23
- {%- set loadingHtml %}
24
- {{ Spinner({ size: "small", additionalClasses: "primary", forcePx: params.forcePx, attributes: { "aria-hidden": "true" } }) }}
25
- {% endset %}
26
-
27
- {%- if params.a11y and params.a11y.visuallyHidden %}
28
- {% set visuallyHidden = VisuallyHidden({ text: params.a11y.visuallyHidden }) %}
29
- {% endif %}
30
-
31
- {%- if isToggle %}
32
- <button type="button" role="switch" aria-checked="{{ "true" if params.selected else "false" }}" class="{{ classes }}" {{ "disabled" if params.disabled }} {{- attributes | safe }}>
33
- {{- visuallyHidden | safe if visuallyHidden -}}
34
- <span class="{{ componentClassName + '__off' }}" aria-hidden="true">{{ IconUse({ icon: params.iconName }) }}</span>
35
- <span class="{{ componentClassName + '__on' }}" aria-hidden="true">{{ IconUse({ icon: params.selectedIconName }) }}</span>
36
- {{ loadingHtml | safe }}
37
- </button>
38
- {% else %}
39
- {% if params.href %}
40
- <a href="{{ params.href | default('#', true) }}" class="{{ classes }}" {{- attributes | safe }}>
41
- {{- visuallyHidden | safe if visuallyHidden -}}
42
- {{ IconUse({ icon: params.iconName, attributes: { "aria-hidden": "true" } }) }}
43
- {{ loadingHtml | safe }}
44
- </a>
45
- {% else %}
46
- <button type="button" class="{{ classes }}" {{ "disabled" if params.disabled }} {{- attributes | safe }}>
47
- {{- visuallyHidden | safe if visuallyHidden -}}
48
- {{ IconUse({ icon: params.iconName, attributes: { "aria-hidden": "true" } }) }}
49
- {{ loadingHtml | safe }}
50
- </button>
51
- {% endif %}
52
- {% endif %}
3
+ {% macro IconButton(params) %}
4
+ {{ Button({
5
+ isIconBtn: true,
6
+ isToggle: params.isToggle,
7
+ variant: params.variant,
8
+ emphasis: params.emphasis,
9
+ disabled: params.disabled,
10
+ size: params.size,
11
+ iconName: params.iconName,
12
+ selectedIconName: params.selectedIconName,
13
+ loading: params.loading,
14
+ selected: params.selected,
15
+ forcePx: params.forcePx,
16
+ classNames: params.classNames,
17
+ attributes: params.attributes,
18
+ a11y: params.a11y
19
+ }) }}
53
20
  {% endmacro %}