@bonniernews/dn-design-system-web 9.0.0 → 10.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.
- package/CHANGELOG.md +19 -0
- package/components/blocked-content/blocked-content.js +1 -1
- package/components/blocked-content/blocked-content.njk +0 -1
- package/components/buddy-menu/buddy-menu.scss +2 -2
- package/components/button/README.md +0 -1
- package/components/button/button.njk +6 -11
- package/components/button/button.scss +141 -216
- package/components/button-toggle/README.md +0 -1
- package/components/button-toggle/button-toggle.njk +5 -8
- package/components/button-toggle/button-toggle.scss +115 -144
- package/components/byline/byline.njk +1 -2
- package/components/factbox/factbox.njk +2 -4
- package/components/factbox/factbox.scss +2 -2
- package/components/floating-button/floating-button.njk +5 -9
- package/components/floating-button/floating-button.scss +46 -53
- package/components/group-header/group-header.scss +18 -6
- package/components/icon-button/icon-button.njk +6 -8
- package/components/icon-button/icon-button.scss +93 -111
- package/components/icon-button-toggle/icon-button-toggle.scss +3 -5
- package/components/list-item/list-item.njk +0 -1
- package/components/pictogram/pictogram.njk +1 -1
- package/components/teaser-list-swipe/teaser-list-swipe.scss +2 -2
- package/components/text-button/README.md +0 -1
- package/components/text-button/text-button.njk +7 -12
- package/components/text-button/text-button.scss +45 -61
- package/components/text-button-toggle/README.md +0 -1
- package/components/text-button-toggle/text-button-toggle.njk +7 -10
- package/components/text-button-toggle/text-button-toggle.scss +50 -60
- package/foundations/helpers/metrics.scss +1 -0
- package/package.json +1 -1
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
] | join(" ") %}
|
|
22
22
|
|
|
23
23
|
{%- set loadingHtml %}
|
|
24
|
-
{{ Spinner({ size: "small", additionalClasses: "primary", forcePx: params.forcePx }) }}
|
|
24
|
+
{{ Spinner({ size: "small", additionalClasses: "primary", forcePx: params.forcePx, attributes: { "aria-hidden": "true" } }) }}
|
|
25
25
|
{% endset %}
|
|
26
26
|
|
|
27
27
|
{%- if params.a11y and params.a11y.visuallyHidden %}
|
|
@@ -31,23 +31,21 @@
|
|
|
31
31
|
{%- if isToggle %}
|
|
32
32
|
<button type="button" role="switch" aria-checked="{{ "true" if params.selected else "false" }}" class="{{ classes }}" {{ "disabled" if params.disabled }} {{- attributes | safe }}>
|
|
33
33
|
{{- visuallyHidden | safe if visuallyHidden -}}
|
|
34
|
-
<span class="{{ componentClassName + '
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
{{ loadingHtml | safe }}
|
|
38
|
-
</span>
|
|
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 }}
|
|
39
37
|
</button>
|
|
40
38
|
{% else %}
|
|
41
39
|
{% if params.href %}
|
|
42
40
|
<a href="{{ params.href | default('#', true) }}" class="{{ classes }}" {{- attributes | safe }}>
|
|
43
41
|
{{- visuallyHidden | safe if visuallyHidden -}}
|
|
44
|
-
|
|
42
|
+
{{ IconUse({ icon: params.iconName, attributes: { "aria-hidden": "true" } }) }}
|
|
45
43
|
{{ loadingHtml | safe }}
|
|
46
44
|
</a>
|
|
47
45
|
{% else %}
|
|
48
46
|
<button type="button" class="{{ classes }}" {{ "disabled" if params.disabled }} {{- attributes | safe }}>
|
|
49
47
|
{{- visuallyHidden | safe if visuallyHidden -}}
|
|
50
|
-
|
|
48
|
+
{{ IconUse({ icon: params.iconName, attributes: { "aria-hidden": "true" } }) }}
|
|
51
49
|
{{ loadingHtml | safe }}
|
|
52
50
|
</button>
|
|
53
51
|
{% endif %}
|
|
@@ -3,97 +3,137 @@
|
|
|
3
3
|
@use "../spinner/spinner.scss" as *;
|
|
4
4
|
|
|
5
5
|
$ds-icon-btn__border-radius: 50%;
|
|
6
|
-
$ds-icon-btn__min-clickable-area: 48px;
|
|
7
6
|
$ds-btn-outlined__border-width: ds-metrics-border-width(x1);
|
|
8
7
|
|
|
9
8
|
.ds-icon-btn {
|
|
10
|
-
--ds-icon-
|
|
9
|
+
--ds-icon-btn__padding: #{ds-spacing($ds-s-050)-$ds-btn-outlined__border-width};
|
|
11
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-drop-shadow-02);
|
|
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
|
+
}
|
|
47
|
+
}
|
|
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
|
+
}
|
|
12
58
|
|
|
13
59
|
&.ds-force-px {
|
|
14
60
|
--ds-icon-btn__icon-size: 24px;
|
|
15
61
|
}
|
|
16
62
|
|
|
17
63
|
&.ds-icon-btn--small {
|
|
18
|
-
--ds-icon-
|
|
64
|
+
--ds-icon-btn__padding: #{2px - $ds-btn-outlined__border-width};
|
|
19
65
|
}
|
|
20
66
|
|
|
21
67
|
&.ds-icon-btn--large {
|
|
22
|
-
--ds-icon-
|
|
68
|
+
--ds-icon-btn__padding: #{ds-spacing($ds-s-075)-$ds-btn-outlined__border-width};
|
|
23
69
|
}
|
|
24
70
|
|
|
25
71
|
cursor: pointer;
|
|
26
|
-
background-color:
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
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;
|
|
30
78
|
display: inline-flex;
|
|
31
79
|
align-items: center;
|
|
32
80
|
justify-content: center;
|
|
33
|
-
padding: 0;
|
|
34
81
|
position: relative;
|
|
82
|
+
padding: var(--ds-icon-btn__padding);
|
|
35
83
|
|
|
36
84
|
span {
|
|
37
85
|
pointer-events: none;
|
|
38
86
|
}
|
|
39
87
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
border-radius:
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
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
|
+
}
|
|
50
98
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
bottom: -$ds-btn-outlined__border-width;
|
|
59
|
-
right: -$ds-btn-outlined__border-width;
|
|
60
|
-
}
|
|
99
|
+
&::after {
|
|
100
|
+
content: "";
|
|
101
|
+
position: absolute;
|
|
102
|
+
min-width: $ds-btn__min-clickable-area;
|
|
103
|
+
min-height: $ds-btn__min-clickable-area;
|
|
104
|
+
width: 100%;
|
|
105
|
+
}
|
|
61
106
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
}
|
|
107
|
+
.ds-icon {
|
|
108
|
+
position: relative;
|
|
109
|
+
display: flex;
|
|
110
|
+
height: var(--ds-icon-btn__icon-size);
|
|
111
|
+
width: var(--ds-icon-btn__icon-size);
|
|
112
|
+
margin: 0;
|
|
113
|
+
svg {
|
|
114
|
+
fill: currentColor;
|
|
71
115
|
}
|
|
72
116
|
}
|
|
117
|
+
|
|
73
118
|
@include ds-hover() {
|
|
74
|
-
&:hover:not(.ds-loading)
|
|
75
|
-
background-color:
|
|
119
|
+
&:hover:not(.ds-loading)::before {
|
|
120
|
+
background-color: var(--ds-icon-btn__background-color-hover);
|
|
76
121
|
}
|
|
77
122
|
}
|
|
78
|
-
&:active:not(.ds-loading)
|
|
79
|
-
background-color:
|
|
123
|
+
&:active:not(.ds-loading)::before {
|
|
124
|
+
background-color: var(--ds-icon-btn__background-color-active);
|
|
80
125
|
}
|
|
81
126
|
|
|
82
127
|
&:focus-visible {
|
|
83
|
-
outline:
|
|
84
|
-
|
|
85
|
-
outline: ds-metrics-border-width(x2) solid $ds-color-border-focus-02;
|
|
86
|
-
outline-offset: 2px;
|
|
87
|
-
}
|
|
128
|
+
outline: ds-metrics-border-width(x2) solid var(--ds-icon-btn__outline-color);
|
|
129
|
+
outline-offset: 2px;
|
|
88
130
|
}
|
|
89
131
|
&:disabled:not(.ds-loading) {
|
|
90
132
|
cursor: not-allowed;
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
background-color: transparent;
|
|
96
|
-
}
|
|
133
|
+
color: $ds-color-icon-disabled;
|
|
134
|
+
outline: none;
|
|
135
|
+
&::before {
|
|
136
|
+
background-color: transparent;
|
|
97
137
|
}
|
|
98
138
|
}
|
|
99
139
|
|
|
@@ -105,61 +145,3 @@ $ds-btn-outlined__border-width: ds-metrics-border-width(x1);
|
|
|
105
145
|
|
|
106
146
|
@include ds-loading();
|
|
107
147
|
}
|
|
108
|
-
|
|
109
|
-
.ds-icon-btn--transparent {
|
|
110
|
-
.ds-icon-btn__inner {
|
|
111
|
-
border-color: transparent;
|
|
112
|
-
color: $ds-color-icon-primary;
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
.ds-icon-btn--outlined {
|
|
117
|
-
.ds-icon-btn__inner {
|
|
118
|
-
background-color: $ds-color-component-secondary;
|
|
119
|
-
border-color: $ds-color-border-primary-02;
|
|
120
|
-
color: $ds-color-icon-primary;
|
|
121
|
-
}
|
|
122
|
-
&:disabled .ds-icon-btn__inner {
|
|
123
|
-
border-color: $ds-color-border-primary;
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
.ds-icon-btn--elevated {
|
|
128
|
-
.ds-icon-btn__inner {
|
|
129
|
-
box-shadow: ds-shadow-get-box-shadow($ds-shadow-drop-shadow-02);
|
|
130
|
-
background-color: $ds-color-component-secondary;
|
|
131
|
-
border-color: $ds-color-border-primary-02;
|
|
132
|
-
color: $ds-color-icon-primary;
|
|
133
|
-
}
|
|
134
|
-
&:disabled .ds-icon-btn__inner {
|
|
135
|
-
border-color: $ds-color-border-primary;
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
.ds-icon-btn--on-media {
|
|
140
|
-
.ds-icon-btn__inner {
|
|
141
|
-
background-color: $ds-color-static-transparent-black;
|
|
142
|
-
border-color: transparent;
|
|
143
|
-
color: $ds-color-static-white;
|
|
144
|
-
}
|
|
145
|
-
&:disabled .ds-icon-btn__inner {
|
|
146
|
-
border-color: $ds-color-border-primary;
|
|
147
|
-
}
|
|
148
|
-
@include ds-hover() {
|
|
149
|
-
&:hover:not(.ds-loading) .ds-icon-btn__inner::before {
|
|
150
|
-
background-color: $ds-color-static-transparent-white-10;
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
&:active:not(.ds-loading) .ds-icon-btn__inner::before {
|
|
154
|
-
background-color: $ds-color-static-transparent-white-10;
|
|
155
|
-
}
|
|
156
|
-
&:disabled:not(.ds-loading) .ds-icon-btn__inner {
|
|
157
|
-
color: $ds-color-static-white;
|
|
158
|
-
&::before {
|
|
159
|
-
background-color: transparent;
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
&:focus-visible .ds-icon-btn__inner {
|
|
163
|
-
outline-color: $ds-color-static-white;
|
|
164
|
-
}
|
|
165
|
-
}
|
|
@@ -2,13 +2,11 @@
|
|
|
2
2
|
@use "../icon-button/icon-button.scss";
|
|
3
3
|
|
|
4
4
|
.ds-icon-btn--toggle {
|
|
5
|
-
.ds-icon-
|
|
6
|
-
|
|
7
|
-
display: none;
|
|
8
|
-
}
|
|
5
|
+
.ds-icon-btn__on {
|
|
6
|
+
display: none;
|
|
9
7
|
}
|
|
10
8
|
|
|
11
|
-
&.ds-icon-btn--selected
|
|
9
|
+
&.ds-icon-btn--selected {
|
|
12
10
|
.ds-icon-btn__on {
|
|
13
11
|
display: flex;
|
|
14
12
|
}
|
|
@@ -15,6 +15,6 @@
|
|
|
15
15
|
] | join(" ") %}
|
|
16
16
|
|
|
17
17
|
<div class="{{ classes }}" {{- attributes | safe }}>
|
|
18
|
-
{{ IconUse({ icon: params.iconName,
|
|
18
|
+
{{ IconUse({ icon: params.iconName, attributes: { "aria-hidden": "true" } }) }}
|
|
19
19
|
</div>
|
|
20
20
|
{% endmacro %}
|
|
@@ -15,7 +15,6 @@
|
|
|
15
15
|
|disabled | bool | no | true, false | false | Note: only works on button-tag, not on a-tag |
|
|
16
16
|
|fullWidth | bool | no | true, false | false | Button will be full width on both desktop and mobile |
|
|
17
17
|
|mobile.fullWidth | bool | no | true, false | false | Ex mobile: { fullWidth: true } |
|
|
18
|
-
|condensed | bool | no | true, false | false | Condensed reduces spacing to a bare minimum, use with care since this might make touch target area smaller than recommended size |
|
|
19
18
|
|iconPosition | String | no | none, left, right | none | |
|
|
20
19
|
|iconName | String | no | add, arrow_back, arrow_forward etc | | For all available icons see: https://designsystem.dn.se/?path=/story/foundations-icons--all-icons |
|
|
21
20
|
|loading | bool | no | true, false | false | |
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
{%- set classNamePrefix = componentClassName + "--" %}
|
|
8
8
|
|
|
9
9
|
{%- if params.iconName and params.iconPosition and params.iconPosition != "none" %}
|
|
10
|
-
{% set iconSvg = IconUse({ icon: params.iconName }) %}
|
|
10
|
+
{% set iconSvg = IconUse({ icon: params.iconName, attributes: { "aria-hidden": "true" } }) %}
|
|
11
11
|
{% endif %}
|
|
12
12
|
|
|
13
13
|
{%- set classes = [
|
|
@@ -16,7 +16,6 @@
|
|
|
16
16
|
"ds-loading" if params.loading,
|
|
17
17
|
classNamePrefix + params.size if params.size and params.size !== "default",
|
|
18
18
|
classNamePrefix + "full-width" if params.fullWidth,
|
|
19
|
-
classNamePrefix + "condensed" if params.condensed and not params.fullWidth,
|
|
20
19
|
classNamePrefix + "mobile-full-width" if params.mobile and params.mobile.fullwWidth,
|
|
21
20
|
classNamePrefix + "icon-" + params.iconPosition if iconSvg,
|
|
22
21
|
params.classNames if params.classNames
|
|
@@ -27,25 +26,21 @@
|
|
|
27
26
|
|
|
28
27
|
{%- set loadingHtml %}
|
|
29
28
|
{% if (params.size == 'small') %}
|
|
30
|
-
{{ Spinner({ size: "xsmall", variant: "primary", forcePx: params.forcePx }) }}
|
|
29
|
+
{{ Spinner({ size: "xsmall", variant: "primary", forcePx: params.forcePx, attributes: { "aria-hidden": "true" } }) }}
|
|
31
30
|
{% else %}
|
|
32
|
-
{{ Spinner({ size: "small", variant: "primary", forcePx: params.forcePx }) }}
|
|
31
|
+
{{ Spinner({ size: "small", variant: "primary", forcePx: params.forcePx, attributes: { "aria-hidden": "true" } }) }}
|
|
33
32
|
{% endif %}
|
|
34
33
|
{% endset %}
|
|
35
34
|
|
|
36
35
|
{%- if params.href %}
|
|
37
36
|
<a href="{{ params.href | default('#', true) }}" {{ ariaLabel | safe }} class="{{ classes }}" {{- attributes | safe }}>
|
|
38
|
-
<span class="
|
|
39
|
-
|
|
40
|
-
{{- iconSvg | safe if iconSvg -}} {{ loadingHtml | safe }}
|
|
41
|
-
</span>
|
|
37
|
+
<span class="ds-text-btn__text" aria-hidden="true">{{ text }}</span>
|
|
38
|
+
{{- iconSvg | safe if iconSvg -}} {{ loadingHtml | safe }}
|
|
42
39
|
</a>
|
|
43
40
|
{%- else %}
|
|
44
41
|
<button type="{{ params.type | default('button') }}" {{ ariaLabel | safe }} class="{{ classes }}" {{ "disabled" if params.disabled }} {{- attributes | safe }}>
|
|
45
|
-
<span class="
|
|
46
|
-
|
|
47
|
-
{{- iconSvg | safe if iconSvg -}} {{ loadingHtml | safe }}
|
|
48
|
-
</span>
|
|
42
|
+
<span class="ds-text-btn__text" aria-hidden="true">{{ text }}</span>
|
|
43
|
+
{{- iconSvg | safe if iconSvg -}} {{ loadingHtml | safe }}
|
|
49
44
|
</button>
|
|
50
45
|
{% endif %}
|
|
51
46
|
{% endmacro %}
|
|
@@ -2,11 +2,9 @@
|
|
|
2
2
|
@use "../icon-sprite/icon-sprite.scss";
|
|
3
3
|
@use "../spinner/spinner.scss" as *;
|
|
4
4
|
|
|
5
|
-
$ds-text-btn__min-clickable-area: 0;
|
|
6
5
|
$ds-text-btn__underline-offset: 2px;
|
|
7
6
|
|
|
8
7
|
.ds-text-btn {
|
|
9
|
-
--ds-text-btn__inner-padding: #{ds-spacing($ds-s-075)};
|
|
10
8
|
--ds-text-btn__icon-size: #{ds-px-to-rem(24px)};
|
|
11
9
|
|
|
12
10
|
&.ds-force-px {
|
|
@@ -14,17 +12,14 @@ $ds-text-btn__underline-offset: 2px;
|
|
|
14
12
|
}
|
|
15
13
|
|
|
16
14
|
&.ds-text-btn--icon-left {
|
|
17
|
-
--ds-text-btn__inner-padding: #{ds-spacing($ds-s-075 $ds-s-075 $ds-s-075 $ds-s-050)};
|
|
18
15
|
--ds-text-btn__icon-margin: #{ds-spacing(0 $ds-s-050 0 0)};
|
|
19
16
|
}
|
|
20
17
|
|
|
21
18
|
&.ds-text-btn--icon-right {
|
|
22
|
-
--ds-text-btn__inner-padding: #{ds-spacing($ds-s-075 $ds-s-050 $ds-s-075 $ds-s-075)};
|
|
23
19
|
--ds-text-btn__icon-margin: #{ds-spacing(0 0 0 $ds-s-050)};
|
|
24
20
|
}
|
|
25
21
|
|
|
26
22
|
&.ds-text-btn--small {
|
|
27
|
-
--ds-text-btn__inner-padding: #{ds-spacing($ds-s-050)};
|
|
28
23
|
--ds-text-btn__icon-size: #{ds-px-to-rem(20px)};
|
|
29
24
|
|
|
30
25
|
&.ds-force-px {
|
|
@@ -33,92 +28,81 @@ $ds-text-btn__underline-offset: 2px;
|
|
|
33
28
|
|
|
34
29
|
&.ds-text-btn--icon-left {
|
|
35
30
|
--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
|
-
&.ds-text-btn--condensed {
|
|
38
|
-
--ds-text-btn__inner-padding: #{ds-spacing($ds-s-025 $ds-s-025 $ds-s-025 0)};
|
|
39
|
-
}
|
|
40
31
|
}
|
|
41
32
|
|
|
42
33
|
&.ds-text-btn--icon-right {
|
|
43
34
|
--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
|
-
&.ds-text-btn--condensed {
|
|
46
|
-
--ds-text-btn__inner-padding: #{ds-spacing($ds-s-025 0 $ds-s-025 $ds-s-025)};
|
|
47
|
-
}
|
|
48
35
|
}
|
|
49
36
|
}
|
|
50
37
|
|
|
51
|
-
&.ds-text-btn--condensed {
|
|
52
|
-
--ds-text-btn__inner-padding: #{ds-spacing($ds-s-025)};
|
|
53
|
-
}
|
|
54
|
-
|
|
55
38
|
cursor: pointer;
|
|
56
39
|
background-color: transparent;
|
|
57
40
|
border: 0;
|
|
58
|
-
min-width: $ds-text-btn__min-clickable-area;
|
|
59
|
-
min-height: $ds-text-btn__min-clickable-area;
|
|
60
41
|
display: inline-flex;
|
|
61
42
|
align-items: center;
|
|
62
43
|
justify-content: center;
|
|
44
|
+
border-radius: ds-border-radius(x1);
|
|
63
45
|
padding: 0;
|
|
64
46
|
position: relative;
|
|
65
47
|
|
|
48
|
+
&::before {
|
|
49
|
+
content: "";
|
|
50
|
+
border-radius: inherit;
|
|
51
|
+
pointer-events: none;
|
|
52
|
+
position: absolute;
|
|
53
|
+
top: 0;
|
|
54
|
+
left: 0;
|
|
55
|
+
bottom: 0;
|
|
56
|
+
right: 0;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
&::after {
|
|
60
|
+
content: "";
|
|
61
|
+
position: absolute;
|
|
62
|
+
min-width: $ds-btn__min-clickable-area;
|
|
63
|
+
min-height: $ds-btn__min-clickable-area;
|
|
64
|
+
width: 100%;
|
|
65
|
+
}
|
|
66
|
+
|
|
66
67
|
span {
|
|
67
68
|
pointer-events: none;
|
|
68
69
|
}
|
|
69
70
|
|
|
70
71
|
&:focus-visible {
|
|
71
|
-
outline:
|
|
72
|
-
|
|
73
|
-
outline: ds-border-width(x2) solid $ds-color-border-focus-02;
|
|
74
|
-
outline-offset: 2px;
|
|
75
|
-
}
|
|
72
|
+
outline: ds-border-width(x2) solid $ds-color-border-focus-02;
|
|
73
|
+
outline-offset: 2px;
|
|
76
74
|
}
|
|
77
75
|
|
|
78
76
|
@at-root a#{&} {
|
|
79
77
|
box-sizing: border-box;
|
|
80
78
|
text-align: center;
|
|
81
|
-
text-decoration: none;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
.ds-text-btn__inner {
|
|
85
|
-
background-color: transparent;
|
|
86
|
-
border-radius: ds-border-radius(x1);
|
|
87
|
-
padding: var(--ds-text-btn__inner-padding);
|
|
88
|
-
position: relative;
|
|
89
|
-
&::before {
|
|
90
|
-
content: "";
|
|
91
|
-
border-radius: inherit;
|
|
92
|
-
pointer-events: none;
|
|
93
|
-
position: absolute;
|
|
94
|
-
top: 0;
|
|
95
|
-
left: 0;
|
|
96
|
-
bottom: 0;
|
|
97
|
-
right: 0;
|
|
98
|
-
}
|
|
99
79
|
}
|
|
100
80
|
|
|
101
81
|
.ds-text-btn__text {
|
|
102
82
|
@include ds-typography-with-force-px($ds-typography-functional-body02regular);
|
|
103
|
-
text-decoration: underline;
|
|
104
83
|
text-underline-offset: $ds-text-btn__underline-offset;
|
|
105
84
|
color: $ds-color-text-primary;
|
|
106
85
|
}
|
|
107
86
|
|
|
87
|
+
&:not(:disabled) .ds-text-btn__text {
|
|
88
|
+
text-decoration: underline;
|
|
89
|
+
}
|
|
90
|
+
|
|
108
91
|
&.ds-text-btn--small .ds-text-btn__text {
|
|
109
92
|
@include ds-typography-with-force-px($ds-typography-functional-body01regular);
|
|
110
93
|
}
|
|
111
94
|
|
|
112
95
|
@include ds-hover() {
|
|
113
|
-
&:hover:not(.ds-loading) .ds-text-
|
|
114
|
-
|
|
96
|
+
&:hover:not(.ds-loading) .ds-text-btn__text {
|
|
97
|
+
text-decoration: none;
|
|
115
98
|
}
|
|
116
99
|
}
|
|
117
100
|
|
|
118
|
-
&:active:not(.ds-loading)
|
|
119
|
-
|
|
101
|
+
&:active:not(:disabled):not(.ds-loading) {
|
|
102
|
+
opacity: $ds-opacity-component-disabled;
|
|
120
103
|
}
|
|
121
|
-
|
|
104
|
+
|
|
105
|
+
&:disabled:not(.ds-loading) {
|
|
122
106
|
cursor: not-allowed;
|
|
123
107
|
&::before {
|
|
124
108
|
background-color: unset;
|
|
@@ -135,15 +119,12 @@ $ds-text-btn__underline-offset: 2px;
|
|
|
135
119
|
}
|
|
136
120
|
|
|
137
121
|
.ds-text-btn--full-width {
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
width: 100%;
|
|
141
|
-
box-sizing: border-box;
|
|
142
|
-
}
|
|
122
|
+
width: 100%;
|
|
123
|
+
box-sizing: border-box;
|
|
143
124
|
}
|
|
144
125
|
|
|
145
|
-
.ds-text-btn--icon-left
|
|
146
|
-
.ds-text-btn--icon-right
|
|
126
|
+
.ds-text-btn--icon-left,
|
|
127
|
+
.ds-text-btn--icon-right {
|
|
147
128
|
display: inline-flex;
|
|
148
129
|
align-items: center;
|
|
149
130
|
justify-content: center;
|
|
@@ -159,20 +140,23 @@ $ds-text-btn__underline-offset: 2px;
|
|
|
159
140
|
}
|
|
160
141
|
}
|
|
161
142
|
|
|
162
|
-
.ds-text-btn__text {
|
|
143
|
+
&:not(:disabled) .ds-text-btn__text {
|
|
163
144
|
text-decoration: none;
|
|
164
145
|
}
|
|
146
|
+
|
|
147
|
+
@include ds-hover() {
|
|
148
|
+
&:hover:not(:disabled):not(.ds-loading) .ds-text-btn__text {
|
|
149
|
+
text-decoration: underline;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
165
152
|
}
|
|
166
153
|
|
|
167
|
-
.ds-text-btn--icon-left
|
|
154
|
+
.ds-text-btn--icon-left {
|
|
168
155
|
flex-direction: row-reverse;
|
|
169
156
|
}
|
|
170
157
|
|
|
171
158
|
@include ds-mq-only-breakpoint(mobile) {
|
|
172
159
|
.ds-text-btn--mobile-full-width {
|
|
173
|
-
|
|
174
|
-
& .ds-text-btn__inner {
|
|
175
|
-
width: 100%;
|
|
176
|
-
}
|
|
160
|
+
width: 100%;
|
|
177
161
|
}
|
|
178
162
|
}
|
|
@@ -16,7 +16,6 @@
|
|
|
16
16
|
|iconName | String | yes | add, arrow_back, arrow_forward etc | | For all available icons see: https://designsystem.dn.se/?path=/story/foundations-icons--all-icons |
|
|
17
17
|
|selectedIconName | String | yes | add, arrow_back, arrow_forward etc | | For all available icons see: https://designsystem.dn.se/?path=/story/foundations-icons--all-icons |
|
|
18
18
|
|disabled | bool | no | true, false | false | Note: only works on button-tag, not on a-tag |
|
|
19
|
-
|condensed | bool | no | true, false | false | Condensed reduces spacing to a bare minimum, use with care since this might make touch target area smaller than recommended size |
|
|
20
19
|
|loading | bool | no | true, false | false | |
|
|
21
20
|
|attributes | Object | no | | | Ex. { target: "_blank", "data-test": "lorem ipsum" } |
|
|
22
21
|
|classNames | String | no | | | Ex. "my-special-class" |
|
|
@@ -10,7 +10,6 @@
|
|
|
10
10
|
"ds-force-px" if params.forcePx,
|
|
11
11
|
"ds-loading" if params.loading,
|
|
12
12
|
classNamePrefix + "selected" if params.selected,
|
|
13
|
-
classNamePrefix + "condensed" if params.condensed,
|
|
14
13
|
params.classNames if params.classNames
|
|
15
14
|
] | join(" ") %}
|
|
16
15
|
|
|
@@ -18,18 +17,16 @@
|
|
|
18
17
|
{%- set ariaLabel = 'aria-label="' + params.text + '"' if not params.attributes["aria-label"] else "" %}
|
|
19
18
|
|
|
20
19
|
{%- set loadingHtml %}
|
|
21
|
-
{{ Spinner({ size: "small", additionalClasses: "primary", forcePx: params.forcePx }) }}
|
|
20
|
+
{{ Spinner({ size: "small", additionalClasses: "primary", forcePx: params.forcePx, attributes: { "aria-hidden": "true" } }) }}
|
|
22
21
|
{%- endset %}
|
|
23
22
|
|
|
24
23
|
<button type="{{ params.type | default('button') }}" role="switch" {{ ariaLabel | safe }} aria-checked="{{ "true" if params.selected else "false" }}" class="{{ classes }}" {{ "disabled" if params.disabled }} {{- attributes | safe }}>
|
|
25
|
-
<span class="{{ componentClassName + '
|
|
26
|
-
<span class="{{ componentClassName + '
|
|
27
|
-
{{ IconUse({ icon: params.iconName }) }} <span class="{{ componentClassName + '__text'}}">{{ params.text }}</span>
|
|
28
|
-
</span>
|
|
29
|
-
<span class="{{ componentClassName + '__on' }}">
|
|
30
|
-
{{ IconUse({ icon: params.selectedIconName }) }} <span class="{{ componentClassName + '__text' }}">{{ params.selectedText }}</span>
|
|
31
|
-
</span>
|
|
32
|
-
{{ loadingHtml | safe }}
|
|
24
|
+
<span class="{{ componentClassName + '__off' }}" aria-hidden="true">
|
|
25
|
+
{{ IconUse({ icon: params.iconName }) }} <span class="{{ componentClassName + '__text'}}">{{ params.text }}</span>
|
|
33
26
|
</span>
|
|
27
|
+
<span class="{{ componentClassName + '__on' }}" aria-hidden="true">
|
|
28
|
+
{{ IconUse({ icon: params.selectedIconName }) }} <span class="{{ componentClassName + '__text' }}">{{ params.selectedText }}</span>
|
|
29
|
+
</span>
|
|
30
|
+
{{ loadingHtml | safe }}
|
|
34
31
|
</button>
|
|
35
32
|
{% endmacro %}
|