@bonniernews/dn-design-system-web 14.0.4 → 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 (35) hide show
  1. package/CHANGELOG.md +11 -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/package.json +1 -1
  32. package/components/floating-button/README.md +0 -41
  33. package/components/floating-button/floating-button.njk +0 -41
  34. package/components/floating-button/floating-button.scss +0 -145
  35. package/components/icon-button-toggle/icon-button-toggle.js +0 -21
@@ -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 *;
@@ -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
@@ -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',
@@ -44,7 +44,7 @@
44
44
  {% if params.variant == 'toggle' %}
45
45
  {{ ButtonToggle({
46
46
  variant: 'brand',
47
- size: 'xsmall',
47
+ size: 'small',
48
48
  text: params.toggleText,
49
49
  selectedText: params.toggleSelectedText,
50
50
  selected: params.toggleSelected,
@@ -55,14 +55,16 @@
55
55
  {% elif (params.variant == 'arrows') %}
56
56
  <div class="{{ componentClassName + '__arrows' }} hidden-mobile hidden-tablet">
57
57
  {{ IconButton({
58
- variant: "elevated",
58
+ variant: "primary",
59
+ emphasis: "outline",
59
60
  size: "small",
60
61
  iconName: "arrow_back",
61
62
  classNames: "ds-group-header__arrow ds-group-header__arrow--left",
62
63
  attributes: {"aria-label": "Föregående"}
63
64
  }) }}
64
65
  {{ IconButton({
65
- variant: "elevated",
66
+ variant: "primary",
67
+ emphasis: "outline",
66
68
  size: "small",
67
69
  iconName: "arrow_forward",
68
70
  classNames: "ds-group-header__arrow ds-group-header__arrow--right",
@@ -42,7 +42,7 @@
42
42
 
43
43
  .ds-group-header__right-link,
44
44
  .ds-group-header__icon,
45
- .ds-btn-toggle {
45
+ .ds-btn--toggle {
46
46
  flex-shrink: 0;
47
47
  }
48
48
 
@@ -51,15 +51,15 @@
51
51
  flex-shrink: 0;
52
52
  align-items: center;
53
53
 
54
- .ds-icon-btn {
54
+ .ds-btn {
55
55
  margin: ds-spacing(0 $ds-s-050);
56
- + .ds-icon-btn {
56
+ + .ds-btn {
57
57
  margin: ds-spacing(0 0 0 $ds-s-075);
58
58
  }
59
59
  }
60
60
  }
61
61
 
62
- .ds-btn-toggle {
62
+ .ds-btn--toggle {
63
63
  align-self: center;
64
64
  }
65
65
 
@@ -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,19 @@
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
+ }) }}
53
19
  {% endmacro %}
@@ -1,141 +1,34 @@
1
1
  @use "../../foundations/helpers/forward.helpers.scss" as *;
2
- @use "../icon-sprite/icon-sprite.scss";
3
- @use "../spinner/spinner.scss" as *;
2
+ @use "../button/button.scss" as *;
4
3
 
5
- $ds-icon-btn__border-radius: 50%;
6
- $ds-btn-outlined__border-width: ds-metrics-border-width(x1);
4
+ .ds-btn.ds-btn--icon-only {
5
+ border-radius: 50%;
7
6
 
8
- .ds-icon-btn {
9
- --ds-icon-btn__padding: #{ds-spacing($ds-s-050)-$ds-btn-outlined__border-width};
10
- --ds-icon-btn__icon-size: #{ds-px-to-rem(24px)};
11
- --ds-icon-btn__background-color: transparent;
12
- --ds-icon-btn__background-color-hover: #{$ds-color-component-primary-overlay};
13
- --ds-icon-btn__background-color-active: #{$ds-color-component-primary-overlay-02};
14
- --ds-icon-btn__border-color: transparent;
15
- --ds-icon-btn__outline-color: #{$ds-color-border-focus-02};
16
- --ds-icon-btn__color: #{$ds-color-icon-primary};
17
-
18
- &--outlined {
19
- --ds-icon-btn__background-color: #{$ds-color-component-secondary};
20
- --ds-icon-btn__border-color: #{$ds-color-border-primary-02};
21
- --ds-icon-btn__color: #{$ds-color-icon-primary};
22
- }
23
-
24
- &--elevated {
25
- box-shadow: ds-shadow-get-box-shadow($ds-shadow-elevation-m);
26
- --ds-icon-btn__background-color: #{$ds-color-component-secondary};
27
- --ds-icon-btn__border-color: #{$ds-color-border-primary-02};
28
- --ds-icon-btn__color: #{$ds-color-icon-primary};
29
- }
30
-
31
- &--on-media {
32
- --ds-icon-btn__background-color: #{$ds-color-static-transparent-black};
33
- --ds-icon-btn__color: #{$ds-color-static-white};
34
- @include ds-hover() {
35
- &:hover:not(.ds-loading)::before {
36
- --ds-icon-btn__background-color-hover: #{$ds-color-static-transparent-white-10};
37
- }
38
- }
39
- &:active:not(.ds-loading)::before {
40
- --ds-icon-btn__background-color-active: $ds-color-static-transparent-white-10;
41
- }
42
- &:disabled:not(.ds-loading) {
43
- color: $ds-color-static-white;
44
- &::before {
45
- background-color: transparent;
46
- }
7
+ &.ds-btn--small {
8
+ padding: ds-px-to-rem(ds-spacing($ds-s-025) - $ds-btn-outlined__border-width);
9
+ @at-root .ds-force-px#{&} {
10
+ padding: ds-spacing($ds-s-025) - $ds-btn-outlined__border-width;
47
11
  }
48
- &:focus-visible {
49
- --ds-icon-btn__outline-color: #{$ds-color-static-white};
50
- }
51
- }
52
-
53
- &--outlined:disabled,
54
- &--elevated:disabled,
55
- &--on-media:disabled {
56
- --ds-icon-btn__border-color: #{$ds-color-border-primary};
57
- }
58
-
59
- &.ds-force-px {
60
- --ds-icon-btn__icon-size: 24px;
61
- }
62
-
63
- &.ds-icon-btn--small {
64
- --ds-icon-btn__padding: #{2px - $ds-btn-outlined__border-width};
65
12
  }
66
13
 
67
- &.ds-icon-btn--large {
68
- --ds-icon-btn__padding: #{ds-spacing($ds-s-075)-$ds-btn-outlined__border-width};
69
- }
70
-
71
- cursor: pointer;
72
- background-color: var(--ds-icon-btn__background-color);
73
- color: var(--ds-icon-btn__color);
74
- box-sizing: border-box;
75
- border-radius: $ds-icon-btn__border-radius;
76
- border: $ds-btn-outlined__border-width solid var(--ds-icon-btn__border-color);
77
- margin: 0;
78
- display: inline-flex;
79
- align-items: center;
80
- justify-content: center;
81
- position: relative;
82
- padding: var(--ds-icon-btn__padding);
83
-
84
- span {
85
- pointer-events: none;
86
- }
87
-
88
- &::before {
89
- content: "";
90
- border-radius: inherit;
91
- pointer-events: none;
92
- position: absolute;
93
- top: -$ds-btn-outlined__border-width;
94
- left: -$ds-btn-outlined__border-width;
95
- bottom: -$ds-btn-outlined__border-width;
96
- right: -$ds-btn-outlined__border-width;
97
- }
98
-
99
- @include min-click-surface();
100
-
101
- .ds-icon {
102
- position: relative;
103
- display: flex;
104
- height: var(--ds-icon-btn__icon-size);
105
- width: var(--ds-icon-btn__icon-size);
106
- margin: 0;
107
- svg {
108
- fill: currentColor;
14
+ &.ds-btn--medium {
15
+ padding: ds-px-to-rem(ds-spacing($ds-s-050) - $ds-btn-outlined__border-width);
16
+ @at-root .ds-force-px#{&} {
17
+ padding: ds-spacing($ds-s-050) - $ds-btn-outlined__border-width;
109
18
  }
110
19
  }
111
20
 
112
- @include ds-hover() {
113
- &:hover:not(.ds-loading)::before {
114
- background-color: var(--ds-icon-btn__background-color-hover);
21
+ &.ds-btn--large {
22
+ padding: ds-px-to-rem(ds-spacing($ds-s-075) - $ds-btn-outlined__border-width);
23
+ @at-root .ds-force-px#{&} {
24
+ padding: ds-spacing($ds-s-075) - $ds-btn-outlined__border-width;
115
25
  }
116
26
  }
117
- &:active:not(.ds-loading)::before {
118
- background-color: var(--ds-icon-btn__background-color-active);
119
- }
120
27
 
121
- &:focus-visible {
122
- outline: ds-metrics-border-width(x2) solid var(--ds-icon-btn__outline-color);
123
- outline-offset: 2px;
124
- }
125
- &:disabled:not(.ds-loading) {
126
- cursor: not-allowed;
127
- color: $ds-color-icon-disabled;
128
- outline: none;
129
- &::before {
130
- background-color: transparent;
28
+ &.ds-btn--xlarge {
29
+ padding: ds-px-to-rem(ds-spacing($ds-s-075) - $ds-btn-outlined__border-width);
30
+ @at-root .ds-force-px#{&} {
31
+ padding: ds-spacing($ds-s-075) - $ds-btn-outlined__border-width;
131
32
  }
132
33
  }
133
-
134
- @at-root a#{&} {
135
- box-sizing: border-box;
136
- text-align: center;
137
- text-decoration: none;
138
- }
139
-
140
- @include ds-loading();
141
34
  }
@@ -12,10 +12,11 @@
12
12
  |:--- | :--- | :--- | :--- | :--- | :--- |
13
13
  |selected | bool | no | true, false | false | |
14
14
  |iconName | String | yes | add, arrow_back, arrow_forward etc | | For all available icons see: https://designsystem.dn.se/?path=/story/foundations-icons--all-icons |
15
- |selectedIconName | String | yes | add, arrow_back, arrow_forward etc | | For all available icons see: https://designsystem.dn.se/?path=/story/foundations-icons--all-icons |v
15
+ |selectedIconName | String | yes | add, arrow_back, arrow_forward etc | | For all available icons see: https://designsystem.dn.se/?path=/story/foundations-icons--all-icons |
16
16
  |disabled | bool | no | true, false | false | Note: only works on button-tag, not on a-tag |
17
- |variant | String | no | outlined, transparent | outlined | Design variant |
18
- |size| String | no | default, small, large | default | |
17
+ |variant | String | no | primary, secondary, brand, staticWhite | primary | Design variant |
18
+ |emphasis | String | no | default, elevated, outline, transparent | default | |
19
+ |size| String | no | small, medium, large | medium | |
19
20
  |loading | bool | no | true, false | false | |
20
21
  |a11y.visuallyHidden | Object | no | | | Ex. a11y: { visuallyHidden: "Dela på TikTok" } |
21
22
  |attributes | Object | no | | | Ex. { target: "_blank", "data-test": "lorem ipsum" } |
@@ -32,7 +33,7 @@ These are copy paste friendly examples to quickliy get started using a component
32
33
  {% from '@bonniernews/dn-design-system-web/components/icon-button-toggle/icon-button-toggle.njk' import IconButtonToggle %}
33
34
 
34
35
  {{ IconButtonToggle({
35
- variant: 'outlined',
36
+ variant: 'primary',
36
37
  size: 'default',
37
38
  iconName: 'bookmarked',
38
39
  selectedIconName: 'bookmark-fill'
@@ -47,7 +48,7 @@ These are copy paste friendly examples to quickliy get started using a component
47
48
  ### Javascript
48
49
 
49
50
  ```javascript
50
- import dsIconButtonToggle from '@bonniernews/dn-design-system-web/components/icon-button-toggle/icon-button-toggle.js'
51
- const toggleElements = Array.from(document.getElementsByClassName("ds-icon-btn--toggle"));
52
- dsIconButtonToggle(toggleElements);
51
+ import dsButtonToggle from '@bonniernews/dn-design-system-web/components/button/button.js'
52
+ const toggleElements = Array.from(document.getElementsByClassName("ds-btn--toggle"));
53
+ dsButtonToggle(toggleElements);
53
54
  ```
@@ -1,5 +1,19 @@
1
1
  {% from '@bonniernews/dn-design-system-web/components/icon-button/icon-button.njk' import IconButton %}
2
2
 
3
3
  {% macro IconButtonToggle(params) %}
4
- {{ IconButton(params, true) }}
4
+ {{ IconButton({
5
+ isToggle: true,
6
+ variant: params.variant,
7
+ emphasis: params.emphasis,
8
+ disabled: params.disabled,
9
+ size: params.size,
10
+ iconName: params.iconName,
11
+ selectedIconName: params.selectedIconName,
12
+ loading: params.loading,
13
+ selected: params.selected,
14
+ forcePx: params.forcePx,
15
+ classNames: params.classNames,
16
+ attributes: params.attributes,
17
+ a11y: params.a11y
18
+ }) }}
5
19
  {% endmacro %}
@@ -1,17 +1 @@
1
- @use "../../foundations/helpers/forward.helpers.scss" as *;
2
- @use "../icon-button/icon-button.scss";
3
-
4
- .ds-icon-btn--toggle {
5
- .ds-icon-btn__on {
6
- display: none;
7
- }
8
-
9
- &.ds-icon-btn--selected {
10
- .ds-icon-btn__on {
11
- display: flex;
12
- }
13
- .ds-icon-btn__off {
14
- display: none;
15
- }
16
- }
17
- }
1
+ @use "../icon-button/icon-button.scss" as *;
@@ -1,4 +1,4 @@
1
- import {dsButtonToggle} from '@bonniernews/dn-design-system-web/components/button-toggle/button-toggle';
1
+ import {dsButtonToggle} from '@bonniernews/dn-design-system-web/components/button/button';
2
2
 
3
3
  export {
4
4
  dsListItem,
@@ -23,7 +23,7 @@ function dsListItemAccordion(accordionEl) {
23
23
  }
24
24
 
25
25
  function dsListItemToggle(toggleEl) {
26
- const toggleElements = Array.from(toggleEl.getElementsByClassName("ds-btn-toggle"));
26
+ const toggleElements = Array.from(toggleEl.getElementsByClassName("ds-btn--toggle"));
27
27
  dsButtonToggle(toggleElements);
28
28
  }
29
29