@bonniernews/dn-design-system-web 1.0.0 → 1.1.0-alpha.10
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 +103 -0
- package/assets/form-field/form-field.scss +1 -0
- package/components/buddy-menu/README.md +9 -2
- package/components/buddy-menu/buddy-menu.njk +41 -37
- package/components/buddy-menu/buddy-menu.scss +47 -39
- package/components/button/button.scss +1 -0
- package/components/button-toggle/button-toggle.scss +1 -0
- package/components/checkbox/checkbox.scss +1 -0
- package/components/icon-button/icon-button.scss +1 -0
- package/components/list-item/README-accordion.md +3 -2
- package/components/list-item/list-item.js +13 -3
- package/components/list-item/list-item.scss +10 -1
- package/components/radio-button/radio-button.scss +1 -0
- package/components/text-button/text-button.scss +1 -0
- package/components/text-button-toggle/text-button-toggle.scss +1 -0
- package/components/text-input/text-input.scss +1 -0
- package/foundations/helpers/typography.scss +6 -3
- package/foundations/icons/icon.scss +1 -0
- package/foundations/typography/fontDefinitions.scss +142 -15
- package/foundations/variables/colorsCssVariables.scss +4 -0
- package/foundations/variables/colorsDnDarkTokens.scss +5 -1
- package/foundations/variables/colorsDnLightTokens.scss +4 -0
- package/foundations/variables/shadowsDnDarkTokens.scss +18 -2
- package/foundations/variables/shadowsDnLightTokens.scss +16 -0
- package/foundations/variables/shadowsTokensList.scss +2 -0
- package/foundations/variables/spacingComponent.scss +4 -1
- package/foundations/variables/spacingLayout.scss +4 -4
- package/foundations/variables/typographyTokensList.scss +26 -0
- package/foundations/variables/typographyTokensScreenLarge.scss +207 -26
- package/foundations/variables/typographyTokensScreenSmall.scss +211 -26
- package/package.json +1 -1
- package/tokens/colors-css-variables.json +4 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,109 @@
|
|
|
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
|
+
## [1.1.0-alpha.10](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@1.1.0-alpha.9...@bonniernews/dn-design-system-web@1.1.0-alpha.10) (2023-02-01)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @bonniernews/dn-design-system-web
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [1.1.0-alpha.9](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@1.1.0-alpha.8...@bonniernews/dn-design-system-web@1.1.0-alpha.9) (2023-01-31)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Bug Fixes
|
|
18
|
+
|
|
19
|
+
* **web:** always set width on icons ([#619](https://github.com/BonnierNews/dn-design-system/issues/619)) ([69f60b1](https://github.com/BonnierNews/dn-design-system/commit/69f60b152846fdffbe00207479e9ae0cc6e1d7d7))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
## [1.1.0-alpha.8](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@1.1.0-alpha.7...@bonniernews/dn-design-system-web@1.1.0-alpha.8) (2023-01-30)
|
|
24
|
+
|
|
25
|
+
**Note:** Version bump only for package @bonniernews/dn-design-system-web
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
## 1.1.0-alpha.7 (2023-01-30)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
### Bug Fixes
|
|
35
|
+
|
|
36
|
+
* **web:** add support for tablet in typography helper ([#616](https://github.com/BonnierNews/dn-design-system/issues/616)) ([0704561](https://github.com/BonnierNews/dn-design-system/commit/0704561de888c11213ca2c49246595bba85dc56e))
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
## [1.1.0-alpha.6](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@1.1.0-alpha.5...@bonniernews/dn-design-system-web@1.1.0-alpha.6) (2023-01-27)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
### Bug Fixes
|
|
44
|
+
|
|
45
|
+
* **web:** correct color on addon link in buddy ([#608](https://github.com/BonnierNews/dn-design-system/issues/608)) ([3677a10](https://github.com/BonnierNews/dn-design-system/commit/3677a1077bf67657d1f68efa1aaa5bfa2741b124))
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
## [1.1.0-alpha.5](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@1.1.0-alpha.4...@bonniernews/dn-design-system-web@1.1.0-alpha.5) (2023-01-26)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
### Bug Fixes
|
|
53
|
+
|
|
54
|
+
* **web:** use css variables in buddymenu ([#604](https://github.com/BonnierNews/dn-design-system/issues/604)) ([547119f](https://github.com/BonnierNews/dn-design-system/commit/547119f14095f53d73109360fe30d8bed89a940d))
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
## [1.1.0-alpha.4](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@1.1.0-alpha.3...@bonniernews/dn-design-system-web@1.1.0-alpha.4) (2023-01-26)
|
|
59
|
+
|
|
60
|
+
**Note:** Version bump only for package @bonniernews/dn-design-system-web
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
## [1.1.0-alpha.3](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@1.1.0-alpha.2...@bonniernews/dn-design-system-web@1.1.0-alpha.3) (2023-01-25)
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
### Bug Fixes
|
|
70
|
+
|
|
71
|
+
* **web:** move buddy campaign area below button ([#597](https://github.com/BonnierNews/dn-design-system/issues/597)) ([f14c24b](https://github.com/BonnierNews/dn-design-system/commit/f14c24b13c256b8ef2500ebd87b231b05676fc2f))
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
## 1.1.0-alpha.2 (2023-01-25)
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
### Bug Fixes
|
|
79
|
+
|
|
80
|
+
* **web:** adapt buddy menu to bang ([#593](https://github.com/BonnierNews/dn-design-system/issues/593)) ([37bb585](https://github.com/BonnierNews/dn-design-system/commit/37bb585df40132b39d552fdea67cd388be23f105))
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
## [1.1.0-alpha.1](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@1.1.0-alpha.0...@bonniernews/dn-design-system-web@1.1.0-alpha.1) (2023-01-24)
|
|
85
|
+
|
|
86
|
+
**Note:** Version bump only for package @bonniernews/dn-design-system-web
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
## 1.1.0-alpha.0 (2023-01-23)
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
### Features
|
|
96
|
+
|
|
97
|
+
* **foundations:** update font to serif 20 and added italic for serif display ([#581](https://github.com/BonnierNews/dn-design-system/issues/581)) ([66afa75](https://github.com/BonnierNews/dn-design-system/commit/66afa75397a11e4ff4b7947a644344f174a6714f))
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
### [1.0.1-alpha.0](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@1.0.0...@bonniernews/dn-design-system-web@1.0.1-alpha.0) (2023-01-23)
|
|
102
|
+
|
|
103
|
+
**Note:** Version bump only for package @bonniernews/dn-design-system-web
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
|
|
6
109
|
## [1.0.0](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@1.0.0-alpha.30...@bonniernews/dn-design-system-web@1.0.0) (2023-01-20)
|
|
7
110
|
|
|
8
111
|
**Note:** Version bump only for package @bonniernews/dn-design-system-web
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
|parameter | type | required | options | default | description |
|
|
11
11
|
|:--- | :--- | :--- | :--- | :--- | :--- |
|
|
12
|
-
|
|
|
12
|
+
|userName | String | no | | none | Should be populated with product specific js|
|
|
13
13
|
|links | HTML String | no | | | Should be list item components|
|
|
14
14
|
|accountLevel | String | no | | none | Should be populated with product specific js|
|
|
15
15
|
|myAccountUrl | String | yes | | | Url for "Mitt konto" button |
|
|
@@ -48,7 +48,7 @@ These are copy paste friendly examples to quickliy get started using a component
|
|
|
48
48
|
{% endmacro %}
|
|
49
49
|
|
|
50
50
|
{{ BuddyMenu({
|
|
51
|
-
|
|
51
|
+
userName: "",
|
|
52
52
|
accountLevel: "",
|
|
53
53
|
myAccountUrl: "https://kund.dn.se/mitt-konto",
|
|
54
54
|
links: BuddyMenuSample(),
|
|
@@ -60,4 +60,11 @@ These are copy paste friendly examples to quickliy get started using a component
|
|
|
60
60
|
### SCSS
|
|
61
61
|
```scss
|
|
62
62
|
@use "@bonniernews/dn-design-system-web/components/buddy-menu/buddy-menu" as *;
|
|
63
|
+
|
|
64
|
+
// these css variables can be overwritten to adjust
|
|
65
|
+
// top/right position:
|
|
66
|
+
--ds-buddy-menu-bottom-margin: 100px;
|
|
67
|
+
--ds-buddy-menu-position-top: 0;
|
|
68
|
+
// bottom-margin i.e. total max-height; calc(100vh - var(--ds-buddy-menu-bottom-margin))
|
|
69
|
+
--ds-buddy-menu-position-right: 0;
|
|
63
70
|
```
|
|
@@ -23,46 +23,50 @@
|
|
|
23
23
|
{% set classes = componentClassName + " " + variant | join(" ") %}
|
|
24
24
|
|
|
25
25
|
<div class="{{ classes }} {{ 'ds-buddy-menu--skola' if params.isDnSkola }}" {{- attributes | safe}}>
|
|
26
|
-
<div class="
|
|
27
|
-
<div class="ds-buddy-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
26
|
+
<div class="{{ componentClassName + '__inner'}}">
|
|
27
|
+
<div class="ds-buddy-menu__scrollable-container">
|
|
28
|
+
<div class="ds-buddy-menu__content">
|
|
29
|
+
{{ IconButton({
|
|
30
|
+
variant: "transparent",
|
|
31
|
+
size: "small",
|
|
32
|
+
iconName: "close",
|
|
33
|
+
classNames: "ds-buddy-menu__close",
|
|
34
|
+
forcePx: params.forcePx
|
|
35
|
+
})}}
|
|
35
36
|
|
|
36
|
-
{%- if params.isDnSkola %}
|
|
37
|
-
{# @todo add support for skola users #}
|
|
38
|
-
{%- else %}
|
|
39
37
|
<div class="ds-buddy-menu__header">
|
|
40
|
-
<span class="ds-buddy-menu__greeting">Hej <span class="ds-buddy-menu__name js-buddy-menu-name" data-name-type="given">{{ params.
|
|
41
|
-
|
|
42
|
-
<
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
{% if params.addons %}
|
|
46
|
-
<h2 class="ds-buddy-menu__addons-title">Mina tillägg</h2>
|
|
47
|
-
<ul class="ds-buddy-menu__addons-list">
|
|
48
|
-
{% for addon in params.addons %}
|
|
49
|
-
<li><a href="{{ addon.href }}">{{ addon.title }}</a></li>
|
|
50
|
-
{% endfor %}
|
|
51
|
-
</ul>
|
|
52
|
-
{% endif %}
|
|
38
|
+
<span class="ds-buddy-menu__greeting">Hej <span class="ds-buddy-menu__name js-buddy-menu-name" data-name-type="given">{{ params.userName }}</span>!</span>
|
|
39
|
+
{%- if not params.isDnSkola %}
|
|
40
|
+
<div class="ds-buddy-menu__account">
|
|
41
|
+
<h2 class="ds-buddy-menu__account-title">Min prenumeration</h2>
|
|
42
|
+
<span class="ds-buddy-menu__account-level js-buddy-menu__account-level">{{ params.accountLevel }}</span>
|
|
53
43
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
44
|
+
{% if params.addons %}
|
|
45
|
+
<div class="ds-buddy-menu__addons {{ params.addonClassNames }}">
|
|
46
|
+
<h2 class="ds-buddy-menu__addons-title">Mina tillägg</h2>
|
|
47
|
+
<ul class="ds-buddy-menu__addons-list">
|
|
48
|
+
{% for addon in params.addons %}
|
|
49
|
+
<li class="{{ addon.classNames }}"><a href="{{ addon.href }}">{{ addon.title }}</a></li>
|
|
50
|
+
{% endfor %}
|
|
51
|
+
</ul>
|
|
52
|
+
</div>
|
|
53
|
+
{% endif %}
|
|
54
|
+
|
|
55
|
+
{{ Button({
|
|
56
|
+
text: "Mitt konto",
|
|
57
|
+
variant: "primary",
|
|
58
|
+
fullWidth: true,
|
|
59
|
+
href: params.myAccountUrl | default("#"),
|
|
60
|
+
attributes: { "data-hide-promo" : "" },
|
|
61
|
+
forcePx: params.forcePx
|
|
62
|
+
})}}
|
|
64
63
|
|
|
65
|
-
|
|
64
|
+
<div class="ds-buddy-menu__campaign">
|
|
65
|
+
{{ params.campaignHtml | safe }}
|
|
66
|
+
</div>
|
|
67
|
+
</div>
|
|
68
|
+
{% endif %}
|
|
69
|
+
</div>
|
|
66
70
|
|
|
67
71
|
<div class="ds-buddy-menu__links">
|
|
68
72
|
<h2 class="ds-buddy-menu__links-title">Mitt innehåll</h2>
|
|
@@ -70,7 +74,7 @@
|
|
|
70
74
|
{{ params.links | safe }}
|
|
71
75
|
</ul>
|
|
72
76
|
</div>
|
|
73
|
-
|
|
77
|
+
</div>
|
|
74
78
|
</div>
|
|
75
79
|
</div>
|
|
76
80
|
</div>
|
|
@@ -9,86 +9,84 @@
|
|
|
9
9
|
@use "../icon-button/icon-button.scss" as *;
|
|
10
10
|
@use "../list-item/list-item.scss" as *;
|
|
11
11
|
|
|
12
|
+
:root {
|
|
13
|
+
--ds-buddy-menu-bottom-margin: 100px;
|
|
14
|
+
--ds-buddy-menu-position-top: 0;
|
|
15
|
+
--ds-buddy-menu-position-right: 0;
|
|
16
|
+
}
|
|
17
|
+
|
|
12
18
|
.ds-buddy-menu {
|
|
13
|
-
width: 360px;
|
|
14
|
-
background-color: $ds-color-surface-elevated;
|
|
15
|
-
border-radius: ds-metrics-border-radius(x2);
|
|
16
|
-
box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.15);
|
|
17
19
|
position: absolute;
|
|
18
|
-
top:
|
|
19
|
-
right:
|
|
20
|
-
|
|
20
|
+
top: var(--ds-buddy-menu-position-top);
|
|
21
|
+
right: var(--ds-buddy-menu-position-right);
|
|
22
|
+
|
|
23
|
+
&,
|
|
24
|
+
.ds-buddy-menu__inner {
|
|
25
|
+
width: 360px;
|
|
21
26
|
|
|
22
|
-
|
|
23
|
-
|
|
27
|
+
@include ds-mq-largest-breakpoint(mobile) {
|
|
28
|
+
width: 100vw;
|
|
29
|
+
}
|
|
24
30
|
}
|
|
25
31
|
|
|
26
|
-
|
|
27
|
-
|
|
32
|
+
.ds-buddy-menu__inner {
|
|
33
|
+
background-color: $ds-color-surface-elevated;
|
|
34
|
+
border-radius: ds-metrics-border-radius(x2);
|
|
35
|
+
box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.15);
|
|
36
|
+
position: relative;
|
|
37
|
+
z-index: 1;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.ds-buddy-menu__scrollable-container {
|
|
41
|
+
max-height: calc(100vh - var(--ds-buddy-menu-bottom-margin));
|
|
28
42
|
overflow-y: auto;
|
|
29
|
-
/* @todo - should we style scrollbar?
|
|
30
|
-
// Scrollbar styling based on existing styling in arkivet/bang
|
|
31
|
-
&::-webkit-scrollbar {
|
|
32
|
-
width: 8px;
|
|
33
|
-
}
|
|
34
|
-
&::-webkit-scrollbar-thumb {
|
|
35
|
-
border: 1px solid $ds-color-component-primary-overlay;
|
|
36
|
-
background-color: $ds-color-border-primary-02;
|
|
37
|
-
border-radius: ds-metrics-border-radius(x2);
|
|
38
|
-
}
|
|
39
|
-
&::-webkit-scrollbar-track {
|
|
40
|
-
border: 0;
|
|
41
|
-
background-color: $ds-color-component-primary-overlay;
|
|
42
|
-
border-radius: ds-metrics-border-radius(x2);
|
|
43
|
-
}
|
|
44
|
-
*/
|
|
45
43
|
}
|
|
46
|
-
|
|
44
|
+
.ds-buddy-menu__content {
|
|
47
45
|
position: relative;
|
|
48
46
|
}
|
|
49
|
-
|
|
47
|
+
.ds-buddy-menu__header {
|
|
50
48
|
padding: ds-spacing-component(x8 x4 x4);
|
|
51
49
|
margin: ds-spacing-component(0 0 x4);
|
|
52
50
|
}
|
|
53
|
-
|
|
51
|
+
.ds-buddy-menu__close {
|
|
54
52
|
position: absolute;
|
|
55
53
|
right: ds-spacing-component(x1);
|
|
56
54
|
top: ds-spacing-component(x1);
|
|
57
55
|
}
|
|
58
|
-
|
|
56
|
+
.ds-buddy-menu__greeting {
|
|
59
57
|
@include ds-typography($ds-typography-functional-heading03bold);
|
|
60
58
|
color: $ds-color-text-primary;
|
|
61
59
|
margin: ds-spacing-component(0 0 x4);
|
|
62
60
|
display: block;
|
|
63
61
|
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
62
|
+
.ds-buddy-menu__account-title,
|
|
63
|
+
.ds-buddy-menu__addons-title,
|
|
64
|
+
.ds-buddy-menu__links-title {
|
|
67
65
|
@include ds-typography($ds-typography-functional-body02medium);
|
|
68
66
|
color: $ds-color-text-primary;
|
|
69
67
|
margin: ds-spacing-component(0 0 x1);
|
|
70
68
|
}
|
|
71
|
-
|
|
69
|
+
.ds-buddy-menu__links-title {
|
|
72
70
|
padding: ds-spacing-component(0 x4);
|
|
73
71
|
}
|
|
74
|
-
|
|
72
|
+
.ds-buddy-menu__addons-list {
|
|
75
73
|
padding: 0;
|
|
76
74
|
margin: ds-spacing-component(0 0 x4);
|
|
77
75
|
list-style: none;
|
|
78
76
|
a {
|
|
77
|
+
@include ds-link($ds-link-list);
|
|
79
78
|
@include ds-typography($ds-typography-functional-body02regular);
|
|
80
79
|
color: $ds-color-text-primary-02;
|
|
81
80
|
margin: ds-spacing-component(0 0 x4);
|
|
82
|
-
@include ds-link($ds-link-list);
|
|
83
81
|
}
|
|
84
82
|
}
|
|
85
|
-
|
|
83
|
+
.ds-buddy-menu__account-level {
|
|
86
84
|
@include ds-typography($ds-typography-functional-body02regular);
|
|
87
85
|
color: $ds-color-text-primary-02;
|
|
88
86
|
margin: ds-spacing-component(0 0 x4);
|
|
89
87
|
display: block;
|
|
90
88
|
}
|
|
91
|
-
|
|
89
|
+
.ds-buddy-menu__links-list {
|
|
92
90
|
border-bottom-left-radius: ds-metrics-border-radius(x2);
|
|
93
91
|
border-bottom-right-radius: ds-metrics-border-radius(x2);
|
|
94
92
|
overflow: hidden;
|
|
@@ -112,4 +110,14 @@
|
|
|
112
110
|
@include ds-typography($ds-typography-functional-body02regular, true);
|
|
113
111
|
}
|
|
114
112
|
}
|
|
113
|
+
|
|
114
|
+
.ds-buddy-menu__campaign {
|
|
115
|
+
margin: 0 -#{ds-spacing-component(x4)};
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
&.ds-buddy-menu--skola {
|
|
119
|
+
.ds-buddy-menu__greeting {
|
|
120
|
+
margin: 0;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
115
123
|
}
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
@use "../../foundations/helpers/utilities.scss" as *;
|
|
7
7
|
@use "../../foundations/helpers/colors.scss" as *;
|
|
8
8
|
@use "../../foundations/helpers/loading.scss" as *;
|
|
9
|
+
@use "../../foundations/icons/icon.scss" as *;
|
|
9
10
|
@use "../spinner/spinner.scss" as *;
|
|
10
11
|
|
|
11
12
|
$ds-btn-outlined__border-width: ds-metrics-border-width(x1);
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
@use "../../foundations/helpers/utilities.scss" as *;
|
|
7
7
|
@use "../../foundations/helpers/colors.scss" as *;
|
|
8
8
|
@use "../../foundations/helpers/loading.scss" as *;
|
|
9
|
+
@use "../../foundations/icons/icon.scss" as *;
|
|
9
10
|
@use "../spinner/spinner.scss" as *;
|
|
10
11
|
|
|
11
12
|
$ds-btn-toggle-outlined__border-width: ds-metrics-border-width(x1);
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
@use "../../foundations/helpers/colors.scss" as *;
|
|
6
6
|
@use "../../foundations/helpers/shadows.scss" as *;
|
|
7
7
|
@use "../../foundations/helpers/loading.scss" as *;
|
|
8
|
+
@use "../../foundations/icons/icon.scss" as *;
|
|
8
9
|
@use "../spinner/spinner.scss" as *;
|
|
9
10
|
|
|
10
11
|
$ds-icon-btn__border-radius: 50%;
|
|
@@ -48,8 +48,9 @@ These are copy paste friendly examples to quickliy get started using a component
|
|
|
48
48
|
### Javascript
|
|
49
49
|
|
|
50
50
|
```javascript
|
|
51
|
-
import
|
|
52
|
-
|
|
51
|
+
import dsListItem from '@bonniernews/dn-design-system-web/components/list-item/list-item.js'
|
|
52
|
+
const accordionElements = Array.from(document.getElementsByClassName("ds-list-item--accordion"));
|
|
53
|
+
dsListItem(accordionElements);
|
|
53
54
|
```
|
|
54
55
|
|
|
55
56
|
*The javascript is only needed for list items of type accordion*
|
|
@@ -1,8 +1,18 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
1
|
+
export {
|
|
2
|
+
dsListItem,
|
|
3
|
+
dsListItemStorybook
|
|
4
|
+
};
|
|
5
|
+
|
|
6
|
+
function dsListItem(accordionElements = []) {
|
|
7
|
+
if (!accordionElements.length) return;
|
|
3
8
|
accordionElements.forEach((accordionEl) => {
|
|
4
9
|
accordionEl.addEventListener("click", () => {
|
|
5
|
-
accordionEl.classList.toggle(
|
|
10
|
+
accordionEl.classList.toggle("ds-list-item--accordion-active");
|
|
6
11
|
});
|
|
7
12
|
});
|
|
8
13
|
}
|
|
14
|
+
|
|
15
|
+
function dsListItemStorybook() {
|
|
16
|
+
const accordionElements = Array.from(document.getElementsByClassName("ds-list-item--accordion"));
|
|
17
|
+
dsListItem(accordionElements);
|
|
18
|
+
}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
@use "../../foundations/helpers/metrics.scss" as *;
|
|
4
4
|
@use "../../foundations/helpers/utilities.scss" as *;
|
|
5
5
|
@use "../../foundations/helpers/colors.scss" as *;
|
|
6
|
+
@use "../../foundations/icons/icon.scss" as *;
|
|
6
7
|
@use "../checkbox/checkbox.scss" as *;
|
|
7
8
|
@use "../switch/switch.scss" as *;
|
|
8
9
|
@use "../radio-button/radio-button.scss" as *;
|
|
@@ -137,7 +138,8 @@ $ds-list-item__icon-size: 24px;
|
|
|
137
138
|
.ds-list-item--border {
|
|
138
139
|
position: relative;
|
|
139
140
|
|
|
140
|
-
&::after
|
|
141
|
+
&::after,
|
|
142
|
+
&.ds-list-item--accordion-active + .ds-list-item__accordion-inner::after {
|
|
141
143
|
content: "";
|
|
142
144
|
height: ds-metrics-border-width(x1);
|
|
143
145
|
width: calc(100% - (ds-spacing-component(x4) * 2));
|
|
@@ -146,6 +148,12 @@ $ds-list-item__icon-size: 24px;
|
|
|
146
148
|
left: ds-spacing-component(x4);
|
|
147
149
|
bottom: 0;
|
|
148
150
|
}
|
|
151
|
+
|
|
152
|
+
&.ds-list-item--accordion-active {
|
|
153
|
+
&::after {
|
|
154
|
+
background-color: transparent;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
149
157
|
}
|
|
150
158
|
|
|
151
159
|
.ds-list-item--accordion {
|
|
@@ -171,6 +179,7 @@ $ds-list-item__icon-size: 24px;
|
|
|
171
179
|
|
|
172
180
|
& + .ds-list-item__accordion-inner {
|
|
173
181
|
display: block;
|
|
182
|
+
position: relative;
|
|
174
183
|
}
|
|
175
184
|
}
|
|
176
185
|
}
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
@use "../../foundations/helpers/metrics.scss" as *;
|
|
5
5
|
@use "../../foundations/helpers/utilities.scss" as *;
|
|
6
6
|
@use "../../foundations/helpers/colors.scss" as *;
|
|
7
|
+
@use "../../foundations/icons/icon.scss" as *;
|
|
7
8
|
@use "../../assets/form-field/form-field.scss" as *;
|
|
8
9
|
|
|
9
10
|
$ds-radio-btn__icon-size: 24px;
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
@use "../../foundations/helpers/utilities.scss" as *;
|
|
6
6
|
@use "../../foundations/helpers/colors.scss" as *;
|
|
7
7
|
@use "../../foundations/helpers/loading.scss" as *;
|
|
8
|
+
@use "../../foundations/icons/icon.scss" as *;
|
|
8
9
|
@use "../spinner/spinner.scss" as *;
|
|
9
10
|
|
|
10
11
|
$ds-text-btn__min-clickable-area: 0;
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
@use "../../foundations/helpers/utilities.scss" as *;
|
|
6
6
|
@use "../../foundations/helpers/colors.scss" as *;
|
|
7
7
|
@use "../../foundations/helpers/loading.scss" as *;
|
|
8
|
+
@use "../../foundations/icons/icon.scss" as *;
|
|
8
9
|
@use "../spinner/spinner.scss" as *;
|
|
9
10
|
|
|
10
11
|
$ds-text-btn-toggle__min-clickable-area: 0;
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
@use "../../foundations/helpers/typography.scss" as *;
|
|
5
5
|
@use "../../foundations/helpers/colors.scss" as *;
|
|
6
6
|
@use "../../assets/form-field/form-field.scss" as *;
|
|
7
|
+
@use "../../foundations/icons/icon.scss" as *;
|
|
7
8
|
@use "../icon-button/icon-button.scss" as *;
|
|
8
9
|
|
|
9
10
|
$ds-text-input-toggle-btn__width: 32px;
|
|
@@ -42,6 +42,7 @@ $dsTypographyKeys: (
|
|
|
42
42
|
letterSpacing: "letter-spacing",
|
|
43
43
|
textDecorationLine: "text-decoration-line",
|
|
44
44
|
color: "color",
|
|
45
|
+
fontStyle: "font-style",
|
|
45
46
|
);
|
|
46
47
|
|
|
47
48
|
$dsSansWeights: (
|
|
@@ -57,7 +58,7 @@ $dsSansWeights: (
|
|
|
57
58
|
// @todo fix how we handle weight for serif, current span is 86-180
|
|
58
59
|
$dsSerifWeights: (
|
|
59
60
|
light: 86,
|
|
60
|
-
regular:
|
|
61
|
+
regular: 104,
|
|
61
62
|
medium: 126,
|
|
62
63
|
semibold: 142,
|
|
63
64
|
bold: 150,
|
|
@@ -94,10 +95,10 @@ $dsSerifWeights: (
|
|
|
94
95
|
}
|
|
95
96
|
}
|
|
96
97
|
|
|
97
|
-
@mixin ds-typography-without-mq($component, $screen: false, $forcePx) {
|
|
98
|
+
@mixin ds-typography-without-mq($component, $screen: false, $forcePx: false) {
|
|
98
99
|
$tmpMap: false;
|
|
99
100
|
|
|
100
|
-
@if $screen == mobile {
|
|
101
|
+
@if $screen == mobile or $screen == tablet {
|
|
101
102
|
$tmpMap: map.get($typographyTokensScreenSmall, $component);
|
|
102
103
|
} @else if $screen == desktop {
|
|
103
104
|
$tmpMap: map.get($typographyTokensScreenLarge, $component);
|
|
@@ -130,6 +131,8 @@ $dsSerifWeights: (
|
|
|
130
131
|
$value: map.get($fontWeights, $value);
|
|
131
132
|
}
|
|
132
133
|
font-weight: #{$value};
|
|
134
|
+
} @else if $key == "fontStyle" {
|
|
135
|
+
font-style: string.to-lower-case($value);
|
|
133
136
|
} @else if $canForcePx and $value != "" {
|
|
134
137
|
@if $forcePx {
|
|
135
138
|
$value: $value * 1px;
|