@bonniernews/dn-design-system-web 2.1.0-alpha.3 → 2.1.0-alpha.5
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 +18 -0
- package/components/button/button.scss +1 -1
- package/components/button-toggle/button-toggle.njk +2 -5
- package/components/button-toggle/button-toggle.scss +6 -10
- package/components/footer/footer.njk +5 -10
- package/components/list-item/README-checkbox.md +1 -0
- package/components/list-item/README-radio.md +1 -0
- package/components/list-item/README-switch.md +1 -0
- package/components/list-item/README-toggle.md +2 -1
- package/components/list-item/list-item.njk +10 -10
- package/components/list-item/list-item.scss +1 -2
- package/components/switch/switch.scss +22 -15
- package/components/thematic-break/README.md +30 -0
- package/components/thematic-break/thematic-break.njk +16 -0
- package/components/thematic-break/thematic-break.scss +10 -0
- package/njk-helpers/attributes.njk +5 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,24 @@
|
|
|
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
|
+
## [2.1.0-alpha.5](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@2.1.0-alpha.4...@bonniernews/dn-design-system-web@2.1.0-alpha.5) (2023-02-20)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **web:** thematic break ([#673](https://github.com/BonnierNews/dn-design-system/issues/673)) ([6a48aac](https://github.com/BonnierNews/dn-design-system/commit/6a48aac61f29243afcc5980f6e4ba70e3ee7b1c1))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
## [2.1.0-alpha.4](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@2.1.0-alpha.3...@bonniernews/dn-design-system-web@2.1.0-alpha.4) (2023-02-20)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Bug Fixes
|
|
19
|
+
|
|
20
|
+
* **web:** add element attributes to list items ([#676](https://github.com/BonnierNews/dn-design-system/issues/676)) ([5858f74](https://github.com/BonnierNews/dn-design-system/commit/5858f74d99d24bec38b4d404b4b4dcbfacfab9d1))
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
6
24
|
## [2.1.0-alpha.3](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@2.1.0-alpha.2...@bonniernews/dn-design-system-web@2.1.0-alpha.3) (2023-02-17)
|
|
7
25
|
|
|
8
26
|
|
|
@@ -280,7 +280,7 @@ $ds-btn__icon-size: 24px;
|
|
|
280
280
|
.ds-btn--primary,
|
|
281
281
|
.ds-btn--staticWhiteFilled {
|
|
282
282
|
&:not(.ds-loading):disabled {
|
|
283
|
-
opacity:
|
|
283
|
+
opacity: $ds-opacity-component-disabled;
|
|
284
284
|
.ds-btn__inner {
|
|
285
285
|
cursor: not-allowed;
|
|
286
286
|
}
|
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
{% from '@bonniernews/dn-design-system-web/foundations/icons/icon.njk' import Icon %}
|
|
2
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 %}
|
|
3
4
|
|
|
4
5
|
{% macro ButtonToggle(params) %}
|
|
5
6
|
{% set componentClassName = "ds-btn-toggle" %}
|
|
6
7
|
{% set classNamePrefix = componentClassName + "--" %}
|
|
7
8
|
{% set variant = [] %}
|
|
8
|
-
{% set attributes %}
|
|
9
|
-
{% for attribute, value in params.attributes %}
|
|
10
|
-
{{attribute}}="{{value}}"
|
|
11
|
-
{% endfor %}
|
|
12
|
-
{% endset %}
|
|
9
|
+
{% set attributes = getAttributes(params.attributes) %}
|
|
13
10
|
|
|
14
11
|
{% if params.selected %}
|
|
15
12
|
{% set variant = (variant.push(classNamePrefix + "selected"), variant) %}
|
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
@use "sass:math";
|
|
2
|
-
@use "../../foundations/helpers/
|
|
3
|
-
@use "../../foundations/helpers/typography.scss" as *;
|
|
4
|
-
@use "../../foundations/helpers/mediaQueries.scss" as *;
|
|
5
|
-
@use "../../foundations/helpers/metrics.scss" as *;
|
|
6
|
-
@use "../../foundations/helpers/utilities.scss" as *;
|
|
7
|
-
@use "../../foundations/helpers/colors.scss" as *;
|
|
8
|
-
@use "../../foundations/helpers/loading.scss" as *;
|
|
2
|
+
@use "../../foundations/helpers/forward.helpers.scss" as *;
|
|
9
3
|
@use "../../foundations/icons/icon.scss" as *;
|
|
10
4
|
@use "../spinner/spinner.scss" as *;
|
|
11
5
|
|
|
@@ -71,8 +65,10 @@ $ds-btn-toggle__icon-size-xsmall: 20px;
|
|
|
71
65
|
}
|
|
72
66
|
}
|
|
73
67
|
|
|
74
|
-
|
|
75
|
-
|
|
68
|
+
@include ds-hover() {
|
|
69
|
+
&:hover:not(:disabled):not(.ds-loading) .ds-btn-toggle__inner::before {
|
|
70
|
+
background-color: $ds-color-component-primary-overlay;
|
|
71
|
+
}
|
|
76
72
|
}
|
|
77
73
|
&:active:not(:disabled):not(.ds-loading) .ds-btn-toggle__inner::before {
|
|
78
74
|
background-color: $ds-color-component-primary-overlay-02;
|
|
@@ -127,7 +123,7 @@ $ds-btn-toggle__icon-size-xsmall: 20px;
|
|
|
127
123
|
}
|
|
128
124
|
&:not(.ds-btn-toggle--selected) {
|
|
129
125
|
&:not(.ds-loading):disabled {
|
|
130
|
-
opacity:
|
|
126
|
+
opacity: $ds-opacity-component-disabled;
|
|
131
127
|
.ds-btn-toggle__inner {
|
|
132
128
|
cursor: not-allowed;
|
|
133
129
|
}
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
{%
|
|
2
|
-
{% macro _getAttributes(attributes) %}
|
|
3
|
-
{% for attribute, value in attributes %}
|
|
4
|
-
{{attribute}}="{{value}}"
|
|
5
|
-
{% endfor %}
|
|
6
|
-
{% endmacro %}
|
|
1
|
+
{% from '@bonniernews/dn-design-system-web/njk-helpers/attributes.njk' import getAttributes %}
|
|
7
2
|
|
|
3
|
+
{% macro Footer(params) %}
|
|
8
4
|
{% set componentClassName = "ds-footer" %}
|
|
9
5
|
{% set classNamePrefix = componentClassName + "--" %}
|
|
10
6
|
{% set variant = [] %}
|
|
@@ -23,11 +19,11 @@
|
|
|
23
19
|
<div class="{{ componentClassName + '__inner'}}">
|
|
24
20
|
<div class="{{ componentClassName + '__link-grid'}}">
|
|
25
21
|
{% for group in params.linkGroups %}
|
|
26
|
-
<div class="{{ componentClassName + '__link-group'}}" {{-
|
|
22
|
+
<div class="{{ componentClassName + '__link-group'}}" {{- getAttributes(group.attributes) | safe }}>
|
|
27
23
|
<h2>{{ group.title }}</h2>
|
|
28
24
|
<ul>
|
|
29
25
|
{% for link in group.links %}
|
|
30
|
-
<li><a href="{{ link.href }}" class="ds-footer__link {{ link.classNames }}" {{-
|
|
26
|
+
<li><a href="{{ link.href }}" class="ds-footer__link {{ link.classNames }}" {{- getAttributes(link.attributes) | safe }}>{{ link.text }}</a></li>
|
|
31
27
|
{% endfor %}
|
|
32
28
|
</ul>
|
|
33
29
|
</div>
|
|
@@ -51,11 +47,10 @@
|
|
|
51
47
|
{% if params.channels %}
|
|
52
48
|
<div class="{{ componentClassName + '__channels'}}">
|
|
53
49
|
{% for link in params.channels %}
|
|
54
|
-
<a href="{{ link.href }}" class="ds-footer__channel-link {{ link.classNames }}" {{-
|
|
50
|
+
<a href="{{ link.href }}" class="ds-footer__channel-link {{ link.classNames }}" {{- getAttributes(link.attributes) | safe }}>{{ link.text }}</a>
|
|
55
51
|
{% endfor %}
|
|
56
52
|
</div>
|
|
57
53
|
{% endif %}
|
|
58
54
|
</div>
|
|
59
55
|
</footer>
|
|
60
56
|
{% endmacro %}
|
|
61
|
-
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
|disabled | bool | no | true, false | false | |
|
|
19
19
|
|border | bool | no | true, false | false | |
|
|
20
20
|
|attributes | Object | no | | | Ex. { target: "_blank", "data-test": "lorem ipsum" } |
|
|
21
|
+
|elementAttributes | Object | no | | | Sets attributes on actual checkbox element and not list item. Same structure as attributes above |
|
|
21
22
|
|classNames | String | no | | | Ex. "my-special-class" |
|
|
22
23
|
|forcePx | bool | no | true, false | false | Fixed pixel value is used for typography to prevent scaling based on html font-size
|
|
23
24
|
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
|disabled | bool | no | true, false | false | |
|
|
20
20
|
|border | bool | no | true, false | false | |
|
|
21
21
|
|attributes | Object | no | | | Ex. { target: "_blank", "data-test": "lorem ipsum" } |
|
|
22
|
+
|elementAttributes | Object | no | | | Sets attributes on actual radio element and not list item. Same structure as attributes above |
|
|
22
23
|
|classNames | String | no | | | Ex. "my-special-class" |
|
|
23
24
|
|forcePx | bool | no | true, false | false | Fixed pixel value is used for typography to prevent scaling based on html font-size
|
|
24
25
|
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
|border | bool | no | true, false | false | |
|
|
19
19
|
|leadingIcon | String | no | add, arrow_back, arrow_forward etc | | For all available icons see: https://designsystem.dn.se/?path=/story/foundations-icon-web--all |
|
|
20
20
|
|attributes | Object | no | | | Ex. { target: "_blank", "data-test": "lorem ipsum" } |
|
|
21
|
+
|elementAttributes | Object | no | | | Sets attributes on actual switch element and not list item. Same structure as attributes above |
|
|
21
22
|
|classNames | String | no | | | Ex. "my-special-class" |
|
|
22
23
|
|forcePx | bool | no | true, false | false | Fixed pixel value is used for typography to prevent scaling based on html font-size
|
|
23
24
|
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
|disabled | bool | no | true, false | false | |
|
|
20
20
|
|border | bool | no | true, false | false | |
|
|
21
21
|
|attributes | Object | no | | | Ex. { target: "_blank", "data-test": "lorem ipsum" } |
|
|
22
|
+
|elementAttributes | Object | no | | | Sets attributes on actual toggle element and not list item. Same structure as attributes above |
|
|
22
23
|
|classNames | String | no | | | Ex. "my-special-class" |
|
|
23
24
|
|forcePx | bool | no | true, false | false | Fixed pixel value is used for typography to prevent scaling based on html font-size
|
|
24
25
|
|
|
@@ -34,7 +35,7 @@ These are copy paste friendly examples to quickliy get started using a component
|
|
|
34
35
|
{{ ListItem({
|
|
35
36
|
listItemType: 'toggle',
|
|
36
37
|
title: 'My toggle list item',
|
|
37
|
-
titleHref: '
|
|
38
|
+
titleHref: 'dn.se',
|
|
38
39
|
toggleText: 'Följ',
|
|
39
40
|
toggleSelectedText: 'Följer'
|
|
40
41
|
})}}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
{% from '@bonniernews/dn-design-system-web/components/checkbox/checkbox.njk' import Checkbox %}
|
|
4
4
|
{% from '@bonniernews/dn-design-system-web/components/radio-button/radio-button.njk' import RadioButton %}
|
|
5
5
|
{% from '@bonniernews/dn-design-system-web/components/button-toggle/button-toggle.njk' import ButtonToggle %}
|
|
6
|
+
{% from '@bonniernews/dn-design-system-web/njk-helpers/attributes.njk' import getAttributes %}
|
|
6
7
|
|
|
7
8
|
{% macro ListItem(params) %}
|
|
8
9
|
{% set componentClassName = "ds-list-item" %}
|
|
@@ -16,7 +17,7 @@
|
|
|
16
17
|
{% if params.title %}
|
|
17
18
|
<div class="{{ componentClassName + '__titles'}}">
|
|
18
19
|
{% if params.titleHref and not params.disabled %}
|
|
19
|
-
<a class="{{ componentClassName + '__title'}}" href="{{ params.
|
|
20
|
+
<a class="{{ componentClassName + '__title'}}" href="{{ params.titleHref }}">{{ params.title }}</a>
|
|
20
21
|
{% else %}
|
|
21
22
|
<span class="{{ componentClassName + '__title'}}">{{ params.title }}</span>
|
|
22
23
|
{% endif %}
|
|
@@ -43,11 +44,7 @@
|
|
|
43
44
|
{% macro ListItemInner(params, componentClassName) %}
|
|
44
45
|
{% set classNamePrefix = componentClassName + "--" %}
|
|
45
46
|
{% set variant = [] %}
|
|
46
|
-
{% set attributes %}
|
|
47
|
-
{% for attribute, value in params.attributes %}
|
|
48
|
-
{{attribute}}="{{value}}"
|
|
49
|
-
{% endfor %}
|
|
50
|
-
{% endset %}
|
|
47
|
+
{% set attributes = getAttributes(params.attributes) %}
|
|
51
48
|
|
|
52
49
|
{% if params.forcePx %}
|
|
53
50
|
{% set variant = (variant.push("ds-force-px"), variant) %}
|
|
@@ -101,7 +98,8 @@
|
|
|
101
98
|
condensed: true,
|
|
102
99
|
disabled: params.disabled,
|
|
103
100
|
forcePx: params.forcePx,
|
|
104
|
-
stripLabel: true
|
|
101
|
+
stripLabel: true,
|
|
102
|
+
attributes: params.elementAttributes
|
|
105
103
|
})}}
|
|
106
104
|
{% endset %}
|
|
107
105
|
{{ caller() if caller }}
|
|
@@ -115,7 +113,7 @@
|
|
|
115
113
|
condensed: true,
|
|
116
114
|
disabled: params.disabled,
|
|
117
115
|
forcePx: params.forcePx,
|
|
118
|
-
buttons: [{ id: params.id, checked: params.selected }]
|
|
116
|
+
buttons: [{ id: params.id, checked: params.selected, attributes: params.elementAttributes }]
|
|
119
117
|
})}}
|
|
120
118
|
{% endset %}
|
|
121
119
|
{{ caller() if caller }}
|
|
@@ -131,7 +129,8 @@
|
|
|
131
129
|
condensed: true,
|
|
132
130
|
disabled: params.disabled,
|
|
133
131
|
forcePx: params.forcePx,
|
|
134
|
-
stripLabel: true
|
|
132
|
+
stripLabel: true,
|
|
133
|
+
attributes: params.elementAttributes
|
|
135
134
|
})}}
|
|
136
135
|
{% endset %}
|
|
137
136
|
{{ caller() if caller }}
|
|
@@ -158,7 +157,8 @@
|
|
|
158
157
|
condensed: false,
|
|
159
158
|
disabled: params.disabled,
|
|
160
159
|
forcePx: params.forcePx,
|
|
161
|
-
size: "xsmall"
|
|
160
|
+
size: "xsmall",
|
|
161
|
+
attributes: params.elementAttributes
|
|
162
162
|
})}}
|
|
163
163
|
{% endset %}
|
|
164
164
|
{{ caller() if caller }}
|
|
@@ -210,8 +210,7 @@ $ds-list-item__padding: ds-spacing-component(x4);
|
|
|
210
210
|
|
|
211
211
|
.ds-list-item--accordion .ds-checkbox__accordion,
|
|
212
212
|
.ds-list-item--radio .ds-radio-btn__inner,
|
|
213
|
-
.ds-list-item--checkbox .ds-checkbox__inner
|
|
214
|
-
.ds-list-item--switch .ds-switch__inner {
|
|
213
|
+
.ds-list-item--checkbox .ds-checkbox__inner {
|
|
215
214
|
&::before {
|
|
216
215
|
display: none;
|
|
217
216
|
}
|
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
@use "../../foundations/helpers/
|
|
2
|
-
@use "../../foundations/helpers/typography.scss" as *;
|
|
3
|
-
@use "../../foundations/helpers/mediaQueries.scss" as *;
|
|
4
|
-
@use "../../foundations/helpers/metrics.scss" as *;
|
|
5
|
-
@use "../../foundations/helpers/utilities.scss" as *;
|
|
6
|
-
@use "../../foundations/helpers/colors.scss" as *;
|
|
1
|
+
@use "../../foundations/helpers/forward.helpers.scss" as *;
|
|
7
2
|
|
|
8
3
|
$ds-switch__knob-size: 16px;
|
|
9
4
|
$ds-switch__knob-padding: 4px;
|
|
@@ -108,18 +103,30 @@ $ds-switch__container-width: 44px;
|
|
|
108
103
|
outline-color: $ds-color-border-focus;
|
|
109
104
|
}
|
|
110
105
|
}
|
|
106
|
+
}
|
|
111
107
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
input:not(:disabled)
|
|
119
|
-
|
|
120
|
-
|
|
108
|
+
@include ds-hover() {
|
|
109
|
+
.ds-switch
|
|
110
|
+
input:not(:disabled)
|
|
111
|
+
+ .ds-switch__inner:hover
|
|
112
|
+
.ds-switch__box::before,
|
|
113
|
+
.ds-list-item--switch:hover
|
|
114
|
+
input:not(:disabled)
|
|
115
|
+
+ .ds-switch__inner
|
|
116
|
+
.ds-switch__box::before {
|
|
117
|
+
background-color: $ds-color-component-primary-overlay;
|
|
121
118
|
}
|
|
122
119
|
}
|
|
120
|
+
.ds-switch
|
|
121
|
+
input:not(:disabled)
|
|
122
|
+
+ .ds-switch__inner:active
|
|
123
|
+
.ds-switch__box::before,
|
|
124
|
+
.ds-list-item--switch:active
|
|
125
|
+
input:not(:disabled)
|
|
126
|
+
+ .ds-switch__inner
|
|
127
|
+
.ds-switch__box::before {
|
|
128
|
+
background-color: $ds-color-component-primary-overlay-02;
|
|
129
|
+
}
|
|
123
130
|
|
|
124
131
|
.ds-switch--condensed .ds-switch__inner {
|
|
125
132
|
padding: 0;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
- GitHub: [BonnierNews/dn-design-system/../web/src/components/thematic-break](https://github.com/BonnierNews/dn-design-system/tree/main/web/src/components/thematic-break)
|
|
2
|
+
- Storybook: [ThematicBreak > Web](https://designsystem.dn.se/?path=/story/components-app-web-thematicbreak-web)
|
|
3
|
+
|
|
4
|
+
----
|
|
5
|
+
|
|
6
|
+
# ThematicBreak
|
|
7
|
+
|
|
8
|
+
## Parameters
|
|
9
|
+
|
|
10
|
+
|parameter | type | required | options | default | description |
|
|
11
|
+
|:--- | :--- | :--- | :--- | :--- | :--- |
|
|
12
|
+
|attributes | Object | no | | | Ex. { target: "_blank", "data-test": "lorem ipsum" } |
|
|
13
|
+
|classNames | String | no | | | Ex. "my-special-class" |
|
|
14
|
+
|
|
15
|
+
## Minimum requirement example
|
|
16
|
+
|
|
17
|
+
### Nunjucks
|
|
18
|
+
|
|
19
|
+
These are copy paste friendly examples to quickliy get started using a component.
|
|
20
|
+
|
|
21
|
+
```html
|
|
22
|
+
{% from '@bonniernews/dn-design-system-web/components/thematic-break/thematic-break.njk' import ThematicBreak %}
|
|
23
|
+
|
|
24
|
+
{{ ThematicBreak() }}
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### SCSS
|
|
28
|
+
```scss
|
|
29
|
+
@use "@bonniernews/dn-design-system-web/components/thematic-break/thematic-break";
|
|
30
|
+
```
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{% macro ThematicBreak(params) %}
|
|
2
|
+
{% set componentClassName = "ds-thematic-break" %}
|
|
3
|
+
{% set additionalClasses = [] %}
|
|
4
|
+
{% set attributes %}
|
|
5
|
+
{% for attribute, value in params.attributes %}
|
|
6
|
+
{{attribute}}="{{value}}"
|
|
7
|
+
{% endfor %}
|
|
8
|
+
{% endset %}
|
|
9
|
+
|
|
10
|
+
{% if params.classNames %}
|
|
11
|
+
{% set additionalClasses = (additionalClasses.push(params.classNames), additionalClasses) %}
|
|
12
|
+
{% endif%}
|
|
13
|
+
|
|
14
|
+
{% set classes = componentClassName + " " + additionalClasses | join(" ") %}
|
|
15
|
+
<hr class="{{ classes }}" {{- attributes | safe }}></hr>
|
|
16
|
+
{% endmacro %}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
@use "../../foundations/helpers/forward.helpers.scss" as *;
|
|
2
|
+
|
|
3
|
+
.ds-thematic-break {
|
|
4
|
+
width: 128px;
|
|
5
|
+
height: 4px;
|
|
6
|
+
margin: ds-spacing-layout(gap-vertical-static-medium) auto
|
|
7
|
+
ds-spacing-layout(gap-vertical-static-large);
|
|
8
|
+
background-color: $ds-color-border-primary;
|
|
9
|
+
border: none;
|
|
10
|
+
}
|
package/package.json
CHANGED