@bonniernews/dn-design-system-web 0.1.0-alpha.13 → 0.1.0-alpha.20

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 CHANGED
@@ -3,6 +3,77 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [0.1.0-alpha.20](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@0.1.0-alpha.19...@bonniernews/dn-design-system-web@0.1.0-alpha.20) (2022-10-07)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **web:** sync sass variables with tokens ([#269](https://github.com/BonnierNews/dn-design-system/issues/269)) ([b760051](https://github.com/BonnierNews/dn-design-system/commit/b760051a2a09ad299c20d193ac47cec95bbf5dab))
12
+
13
+
14
+
15
+
16
+
17
+ # 0.1.0-alpha.19 (2022-10-07)
18
+
19
+ **Note:** Version bump only for package @bonniernews/dn-design-system-web
20
+
21
+
22
+
23
+
24
+
25
+ # [0.1.0-alpha.18](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@0.1.0-alpha.17...@bonniernews/dn-design-system-web@0.1.0-alpha.18) (2022-10-03)
26
+
27
+
28
+ ### Features
29
+
30
+ * **web:** divider component for web ([#252](https://github.com/BonnierNews/dn-design-system/issues/252)) ([93f5dfb](https://github.com/BonnierNews/dn-design-system/commit/93f5dfb365da8a554b4ea21d519c614cc06081df))
31
+
32
+
33
+
34
+
35
+
36
+ # 0.1.0-alpha.17 (2022-10-03)
37
+
38
+
39
+ ### Features
40
+
41
+ * **web:** text button component for web ([#254](https://github.com/BonnierNews/dn-design-system/issues/254)) ([6711a5b](https://github.com/BonnierNews/dn-design-system/commit/6711a5b6d46da68eb25db1f9af4f25fbb219011d))
42
+
43
+
44
+
45
+
46
+
47
+ # [0.1.0-alpha.16](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@0.1.0-alpha.15...@bonniernews/dn-design-system-web@0.1.0-alpha.16) (2022-09-30)
48
+
49
+
50
+ ### Bug Fixes
51
+
52
+ * **web:** use metrics and new spacing tokens ([#249](https://github.com/BonnierNews/dn-design-system/issues/249)) ([67fe9a7](https://github.com/BonnierNews/dn-design-system/commit/67fe9a715fdadeb1cf08f7fb291d35cd4818307a))
53
+
54
+
55
+
56
+
57
+
58
+ # 0.1.0-alpha.15 (2022-09-29)
59
+
60
+ **Note:** Version bump only for package @bonniernews/dn-design-system-web
61
+
62
+
63
+
64
+
65
+
66
+ # 0.1.0-alpha.14 (2022-09-27)
67
+
68
+
69
+ ### Features
70
+
71
+ * **web:** update web typography ([#235](https://github.com/BonnierNews/dn-design-system/issues/235)) ([83a5039](https://github.com/BonnierNews/dn-design-system/commit/83a5039955f6df69f983b52531c46be29738e39d))
72
+
73
+
74
+
75
+
76
+
6
77
  # 0.1.0-alpha.13 (2022-09-09)
7
78
 
8
79
  **Note:** Version bump only for package @bonniernews/dn-design-system-web
@@ -11,7 +11,7 @@ attributes: {
11
11
  "data-test": "12345"
12
12
  },
13
13
  classNames: "my-special-class",
14
- href: "https://designsystem-latest.dn.se/"
14
+ href: "https://designsystem-latest.dn.se/",
15
15
  type: "submit",
16
16
  mobile: {
17
17
  fullWidth: true
@@ -42,8 +42,8 @@
42
42
  {% set classes = componentClassName + " " + variant | join(" ") %}
43
43
 
44
44
  {% if params.href %}
45
- <a href="{{ params.href | default('#', true) }}" class="{{ classes }}" {{ attributes }}>{{ text }}{{- iconSvg | safe if iconSvg -}}</a>
45
+ <a href="{{ params.href | default('#', true) }}" class="{{ classes }}" {{ attributes }}><span class="{{ componentClassName + '__inner'}}">{{ text }}{{- iconSvg | safe if iconSvg -}}</span></a>
46
46
  {% else %}
47
- <button type="{{ params.type | default('button') }}" class="{{ classes }}" {{ "disabled" if params.disabled }} {{ attributes }}><span>{{ text }}</span>{{- iconSvg | safe if iconSvg -}}</button>
47
+ <button type="{{ params.type | default('button') }}" class="{{ classes }}" {{ "disabled" if params.disabled }} {{ attributes }}><span class="{{ componentClassName + '__inner'}}">{{ text }}{{- iconSvg | safe if iconSvg -}}</span></button>
48
48
  {% endif %}
49
49
  {% endmacro %}
@@ -1,36 +1,38 @@
1
1
  @use "../../foundations/helpers/spacing.scss" as *;
2
2
  @use "../../foundations/helpers/typography.scss" as *;
3
3
  @use "../../foundations/helpers/mediaQueries.scss" as *;
4
+ @use "../../foundations/helpers/metrics.scss" as *;
4
5
 
5
- // Temporary variables we maybe should handle in a better way
6
- $ds-btn__border-radius: 2px;
7
- $ds-btn__border-width--outlined: 1px;
8
- $ds-btn__outline-width: 2px;
6
+ $ds-btn-outlined__border-width: ds-metrics-border-width(x1);
7
+ $ds-btn__clickable-area: 48px;
9
8
 
10
9
  @mixin ds-btn-disabled() {
11
10
  background-color: var(--ds-surface-secondary-soft);
12
11
  color: var(--ds-text-primary-soft);
13
- outline: none;
14
12
  &::before {
15
13
  background-color: unset;
16
14
  }
17
15
  }
18
16
 
19
17
  .ds-btn {
20
- @include ds-typography('detailstandard-button');
21
- font-size: 16px; // we should get this from detailstandard-button-token
22
18
  cursor: pointer;
19
+ background-color: transparent;
23
20
  border: 0;
24
- border-radius: $ds-btn__border-radius;
25
- display: inline-block;
26
- transition: background-color 50ms ease-out;
27
- padding: ds-spacing(1.5 3);
28
- position: relative;
21
+ min-width: $ds-btn__clickable-area;
22
+ min-height: $ds-btn__clickable-area;
23
+ display: inline-flex;
24
+ align-items: center;
25
+ justify-content: center;
26
+ padding: 0;
29
27
 
30
28
  &:focus-visible {
31
- outline-offset: 2px;
29
+ outline: none;
30
+ .ds-btn__inner {
31
+ outline: ds-metrics-border-width(x2) solid;
32
+ outline-offset: 2px;
33
+ }
32
34
  }
33
- &:disabled {
35
+ &:disabled .ds-btn__inner {
34
36
  @include ds-btn-disabled;
35
37
  }
36
38
 
@@ -40,163 +42,206 @@ $ds-btn__outline-width: 2px;
40
42
  text-decoration: none;
41
43
  }
42
44
 
45
+ .ds-btn__inner {
46
+ @include ds-typography('detailstandard-button');
47
+ border-radius: ds-metrics-border-radius(x1);
48
+ padding: ds-spacing-component(x3 x6);
49
+ position: relative;
50
+ &::before {
51
+ content: "";
52
+ border-radius: inherit;
53
+ pointer-events: none;
54
+ position: absolute;
55
+ top: 0;
56
+ left: 0;
57
+ bottom: 0;
58
+ right: 0;
59
+ }
60
+ }
61
+
43
62
  &--full-width {
44
- width: 100%;
63
+ &,
64
+ & .ds-btn__inner {
65
+ width: 100%;
66
+ }
45
67
  }
46
- &--small {
47
- padding: ds-spacing(1 2.5);
68
+ &--small .ds-btn__inner {
69
+ padding: ds-spacing-component(x2 x5);
48
70
  }
49
- &--outlined,
71
+ &--secondary-outlined,
50
72
  &--destructive {
51
- padding: ds-spacing(1.5)-$ds-btn__border-width--outlined ds-spacing(3)-$ds-btn__border-width--outlined;
73
+ .ds-btn__inner {
74
+ padding: ds-spacing-component(x3)-$ds-btn-outlined__border-width ds-spacing-component(x6)-$ds-btn-outlined__border-width;
75
+ }
52
76
 
53
- &.ds-btn--small {
54
- padding: ds-spacing(1)-$ds-btn__border-width--outlined ds-spacing(2.5)-$ds-btn__border-width--outlined;
77
+ &.ds-btn--small .ds-btn__inner {
78
+ padding: ds-spacing-component(x2)-$ds-btn-outlined__border-width ds-spacing-component(x5)-$ds-btn-outlined__border-width;
55
79
  }
56
80
  }
57
- &::before {
58
- content: "";
59
- border-radius: inherit;
60
- pointer-events: none;
61
- position: absolute;
62
- top: 0;
63
- left: 0;
64
- bottom: 0;
65
- right: 0;
66
- }
67
- span,
68
- i {
69
- position: relative;
70
- }
71
81
  }
72
82
 
73
83
  @include ds-mq-only-breakpoint(mobile) {
74
84
  .ds-btn--mobile-full-width {
75
- width: 100%;
85
+ &,
86
+ & .ds-btn__inner {
87
+ width: 100%;
88
+ }
76
89
  }
77
90
  }
78
91
 
79
- .ds-btn--icon-left,
80
- .ds-btn--icon-right {
92
+ .ds-btn--icon-left .ds-btn__inner,
93
+ .ds-btn--icon-right .ds-btn__inner {
81
94
  display: inline-flex;
82
95
  align-items: center;
83
96
  justify-content: center;
84
97
  .ds-icon {
85
98
  display: flex;
86
99
  height: 24px;
87
- margin: ds-spacing(0 0 0 1);
100
+ margin: ds-spacing-component(0 0 0 x2);
88
101
  svg {
89
102
  fill: currentColor;
90
103
  }
91
104
  }
92
105
  }
93
106
 
94
- .ds-btn--icon-left {
107
+ .ds-btn--icon-left .ds-btn__inner {
95
108
  flex-direction: row-reverse;
96
109
  .ds-icon {
97
- margin: ds-spacing(0 1 0 0);
110
+ margin: ds-spacing-component(0 x2 0 0);
98
111
  }
99
112
  }
100
113
 
101
114
  .ds-btn--brand {
102
- background-color: var(--ds-surface-brand-strong);
103
- color: var(--ds-text-on-brand);
104
- &::before {
105
- background-color: var(--ds-interaction-primary-none);
115
+ .ds-btn__inner {
116
+ background-color: var(--ds-surface-brand-strong);
117
+ color: var(--ds-text-on-brand);
118
+ &::before {
119
+ background-color: var(--ds-interaction-primary-none);
120
+ }
106
121
  }
107
- &:hover::before {
122
+ &:hover .ds-btn__inner::before {
108
123
  background-color: var(--ds-interaction-primary-soft);
109
124
  }
110
- &:active::before {
125
+ &:active .ds-btn__inner::before {
111
126
  background-color: var(--ds-interaction-primary-strong);
112
127
  }
113
- &:focus-visible {
114
- outline: $ds-btn__outline-width solid var(--ds-border-brand-strong);
128
+ &:focus-visible .ds-btn__inner {
129
+ outline-color: var(--ds-border-brand-strong);
115
130
  }
116
- &:disabled {
131
+ &:disabled .ds-btn__inner {
117
132
  @include ds-btn-disabled;
118
133
  }
119
134
  }
120
135
 
121
136
  .ds-btn--business {
122
- background-color: var(--ds-surface-business-strong);
123
- color: var(--ds-text-on-business);
124
- &::before {
125
- background-color: var(--ds-interaction-primary-none);
137
+ .ds-btn__inner {
138
+ background-color: var(--ds-surface-business-strong);
139
+ color: var(--ds-text-on-business);
140
+ &::before {
141
+ background-color: var(--ds-interaction-primary-none);
142
+ }
126
143
  }
127
- &:hover::before {
144
+ &:hover .ds-btn__inner::before {
128
145
  background-color: var(--ds-interaction-primary-soft);
129
146
  }
130
- &:active::before {
147
+ &:active .ds-btn__inner::before {
131
148
  background-color: var(--ds-interaction-primary-strong);
132
149
  }
133
- &:focus-visible {
134
- outline: $ds-btn__outline-width solid var(--ds-border-business-strong);
150
+ &:focus-visible .ds-btn__inner {
151
+ outline-color: var(--ds-border-business-strong);
135
152
  }
136
- &:disabled {
153
+ &:disabled .ds-btn__inner {
137
154
  @include ds-btn-disabled;
138
155
  }
139
156
  }
140
157
 
141
158
  .ds-btn--primary {
142
- background-color: var(--ds-surface-primary-strong);
143
- color: var(--ds-text-on-primary);
144
- &::before {
145
- background-color: var(--ds-interaction-secondary-none);
159
+ .ds-btn__inner {
160
+ background-color: var(--ds-surface-primary-strong);
161
+ color: var(--ds-text-on-primary);
162
+ &::before {
163
+ background-color: var(--ds-interaction-secondary-none);
164
+ }
146
165
  }
147
- &:hover::before {
166
+ &:hover .ds-btn__inner::before {
148
167
  background-color: var(--ds-interaction-secondary-soft);
149
168
  }
150
- &:active::before {
169
+ &:active .ds-btn__inner::before {
151
170
  background-color: var(--ds-interaction-secondary-strong);
152
171
  }
153
- &:focus-visible {
154
- outline: $ds-btn__outline-width solid var(--ds-border-primary-strong);
172
+ &:focus-visible .ds-btn__inner {
173
+ outline-color: var(--ds-border-primary-strong);
155
174
  }
156
- &:disabled {
175
+ &:disabled .ds-btn__inner {
157
176
  @include ds-btn-disabled;
158
177
  }
159
178
  }
160
179
 
161
- .ds-btn--outlined {
162
- background-color: var(--ds-surface-secondary-strong);
163
- border: $ds-btn__border-width--outlined solid var(--ds-border-primary-strong);
164
- color: var(--ds-text-primary-strong);
165
- &::before {
166
- background-color: var(--ds-interaction-primary-none);
180
+ .ds-btn--secondaryOutlined {
181
+ .ds-btn__inner {
182
+ background-color: var(--ds-surface-secondary-strong);
183
+ border: $ds-btn-outlined__border-width solid var(--ds-border-primary-strong);
184
+ color: var(--ds-text-primary-strong);
185
+ &::before {
186
+ background-color: var(--ds-interaction-primary-none);
187
+ }
167
188
  }
168
- &:hover::before {
189
+ &:hover .ds-btn__inner::before {
169
190
  background-color: var(--ds-interaction-primary-soft);
170
191
  }
171
- &:active::before {
192
+ &:active .ds-btn__inner::before {
172
193
  background-color: var(--ds-interaction-primary-strong);
173
194
  }
174
- &:focus-visible {
175
- outline: $ds-btn__outline-width solid var(--ds-border-primary-strong);
195
+ &:focus-visible .ds-btn__inner {
196
+ outline-color: var(--ds-border-primary-strong);
176
197
  }
177
- &:disabled {
198
+ &:disabled .ds-btn__inner {
178
199
  @include ds-btn-disabled;
179
200
  border-color: var(--ds-surface-secondary-soft);
180
201
  }
181
202
  }
182
203
 
204
+ .ds-btn--secondaryFilled {
205
+ .ds-btn__inner {
206
+ background-color: var(--ds-surface-secondary-soft);
207
+ color: var(--ds-text-primary-strong);
208
+ &::before {
209
+ background-color: var(--ds-interaction-secondary-none);
210
+ }
211
+ }
212
+ &:hover .ds-btn__inner::before {
213
+ background-color: var(--ds-interaction-primary-soft);
214
+ }
215
+ &:active .ds-btn__inner::before {
216
+ background-color: var(--ds-interaction-primary-strong);
217
+ }
218
+ &:focus-visible .ds-btn__inner {
219
+ outline-color: var(--ds-border-primary-strong);
220
+ }
221
+ &:disabled .ds-btn__inner {
222
+ @include ds-btn-disabled;
223
+ }
224
+ }
225
+
183
226
  .ds-btn--destructive {
184
- background-color: var(--ds-surface-secondary-strong);
185
- border: $ds-btn__border-width--outlined solid var(--ds-border-critical-strong);
186
- color: var(--ds-text-critical-strong);
227
+ .ds-btn__inner {
228
+ background-color: var(--ds-surface-secondary-strong);
229
+ border: $ds-btn-outlined__border-width solid var(--ds-border-critical-strong);
230
+ color: var(--ds-text-critical-strong);
231
+ }
187
232
  &::before {
188
233
  background-color: var(--ds-interaction-primary-none);
189
234
  }
190
- &:hover::before {
235
+ &:hover .ds-btn__inner::before {
191
236
  background-color: var(--ds-interaction-primary-soft);
192
237
  }
193
- &:active::before {
238
+ &:active .ds-btn__inner::before {
194
239
  background-color: var(--ds-interaction-primary-strong);
195
240
  }
196
- &:focus-visible {
197
- outline: $ds-btn__outline-width solid var(--ds-border-critical-strong);
241
+ &:focus-visible .ds-btn__inner {
242
+ outline-color: var(--ds-border-critical-strong);
198
243
  }
199
- &:disabled {
244
+ &:disabled .ds-btn__inner {
200
245
  @include ds-btn-disabled;
201
246
  border-color: var(--ds-surface-secondary-soft);
202
247
  }
@@ -0,0 +1,11 @@
1
+ **@bonniernews/dn-design-system-web/components/divider/README.md**
2
+
3
+ ----
4
+
5
+ # Divider
6
+
7
+ Parameters available but not used in storybook:
8
+
9
+ ```javascript
10
+ classNames: "my-special-class"
11
+ ```
@@ -0,0 +1,21 @@
1
+ {% macro Divider(params) %}
2
+ {% set componentClassName = "ds-divider" %}
3
+ {% set classNamePrefix = componentClassName + "--" %}
4
+ {% set variant = [] %}
5
+
6
+ {% if params.variant %}
7
+ {% set variant = (variant.push(classNamePrefix + params.variant), variant) %}
8
+ {% else %}
9
+ {% set variant = (variant.push(classNamePrefix + "soft"), variant) %}
10
+ {% endif %}
11
+
12
+ {% if params.classNames %}
13
+ {% set variant = (variant.push(params.classNames), variant) %}
14
+ {% endif%}
15
+
16
+ {% set classes = componentClassName + " " + variant | join(" ") %}
17
+
18
+ <div class="{{ classes }}">
19
+ <span class="{{ componentClassName + '__inner'}}"></span>
20
+ </div>
21
+ {% endmacro %}
@@ -0,0 +1,22 @@
1
+ @use "../../foundations/helpers/spacing.scss" as *;
2
+ @use "../../foundations/helpers/metrics.scss" as *;
3
+
4
+ .ds-divider {
5
+ margin: ds-spacing-layout(x2 0);
6
+ width: 100%;
7
+ .ds-divider__inner {
8
+ background-color: currentColor;
9
+ display: block;
10
+ height: ds-metrics-border-width(x1);
11
+ width: 100%;
12
+ }
13
+ &--soft {
14
+ color: var(--ds-border-primary-soft);
15
+ }
16
+ &--medium {
17
+ color: var(--ds-border-primary-medium);
18
+ }
19
+ &--strong {
20
+ color: var(--ds-border-primary-strong);
21
+ }
22
+ }
@@ -5,7 +5,6 @@
5
5
  {% set componentClassName = "ds-icon-btn" %}
6
6
  {% set classNamePrefix = componentClassName + "--" %}
7
7
  {% set variant = [] %}
8
- {% set text = params.text %}
9
8
  {% set attributes %}
10
9
  {% for attribute, value in params.attributes %}
11
10
  {{attribute}}={{value}}
@@ -40,14 +39,12 @@
40
39
  {% if params.href %}
41
40
  <a href="{{ params.href | default('#', true) }}" class="{{ classes }}" {{ attributes }}>
42
41
  {{- visuallyHidden | safe if visuallyHidden -}}
43
- {{ text }}
44
- {{- iconSvg | safe if iconSvg -}}
42
+ <span class="{{ componentClassName + '__inner'}}">{{- iconSvg | safe if iconSvg -}}</span>
45
43
  </a>
46
44
  {% else %}
47
45
  <button type="button" class="{{ classes }}" {{ "disabled" if params.disabled }} {{ attributes }}>
48
46
  {{- visuallyHidden | safe if visuallyHidden -}}
49
- {{ text }}
50
- {{- iconSvg | safe if iconSvg -}}
47
+ <span class="{{ componentClassName + '__inner'}}">{{- iconSvg | safe if iconSvg -}}</span>
51
48
  </button>
52
49
  {% endif %}
53
50
  {% endmacro %}