@bonniernews/dn-design-system-web 0.0.1-alpha.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 +8 -0
- package/LICENSE +9 -0
- package/README.md +3 -0
- package/components/button/README.md +22 -0
- package/components/button/button.njk +46 -0
- package/components/button/button.scss +157 -0
- package/components/hyperlink/hyperlink.njk +17 -0
- package/components/hyperlink/hyperlink.scss +9 -0
- package/components/icon-button/README.md +16 -0
- package/components/icon-button/icon-button.njk +41 -0
- package/components/icon-button/icon-button.scss +112 -0
- package/components/text/text-sans.njk +25 -0
- package/components/text/text-sans.scss +1 -0
- package/foundations/colors.scss +31 -0
- package/foundations/fonts.scss +42 -0
- package/foundations/helpers/colorMap.scss +15 -0
- package/foundations/helpers/fontFamily.scss +11 -0
- package/foundations/helpers/spacing.scss +44 -0
- package/foundations/helpers/variable.scss +17 -0
- package/foundations/icons/icon-sprite.svg +2 -0
- package/foundations/icons/icon.njk +83 -0
- package/foundations/icons/icon.scss +5 -0
- package/foundations/icons/svg/arrow_back.svg +8 -0
- package/foundations/icons/svg/arrow_forward.svg +8 -0
- package/foundations/icons/svg/check.svg +8 -0
- package/foundations/icons/svg/delete.svg +8 -0
- package/foundations/icons/svg/favorite-filled.svg +8 -0
- package/foundations/icons/svg/favorite.svg +8 -0
- package/foundations/icons/svg/headphones-filled.svg +8 -0
- package/foundations/icons/svg/headphones.svg +8 -0
- package/foundations/icons/svg/home-filled.svg +8 -0
- package/foundations/icons/svg/home.svg +8 -0
- package/foundations/icons/svg/manage_accounts-filled.svg +8 -0
- package/foundations/icons/svg/manage_accounts.svg +8 -0
- package/foundations/icons/svg/menu.svg +8 -0
- package/foundations/icons/svg/notifications.svg +8 -0
- package/foundations/icons/svg/visibility.svg +8 -0
- package/foundations/icons/svg/visibility_off.svg +8 -0
- package/foundations/typography-sans.scss +43 -0
- package/foundations/variables/colorsDnDark.scss +66 -0
- package/foundations/variables/colorsDnLight.scss +66 -0
- package/foundations/variables/spacingComponent.scss +7 -0
- package/foundations/variables/spacingLayout.scss +6 -0
- package/foundations/variables/typography.scss +149 -0
- package/package.json +18 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# Change Log
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
|
+
|
|
6
|
+
## 0.0.1-alpha.0 (2022-07-01)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @bonniernews/dn-design-system-web
|
package/LICENSE
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 Bonnier News AB
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
|
+
|
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
### @bonniernews/dn-design-system-web/components/button/README.md
|
|
2
|
+
|
|
3
|
+
----
|
|
4
|
+
|
|
5
|
+
#### **Some sample documentation for a component**
|
|
6
|
+
|
|
7
|
+
Here we can document **technical details** and for example list parameters not available in storybook but used in the *real world*.
|
|
8
|
+
|
|
9
|
+
```javascript
|
|
10
|
+
/* Additional available parameters */
|
|
11
|
+
attributes: {
|
|
12
|
+
"data-test": "12345"
|
|
13
|
+
},
|
|
14
|
+
classNames: "my-special-class",
|
|
15
|
+
href: "https://designsystem-latest.dn.se/" // if you add href parameter the button will rendered as an <a>
|
|
16
|
+
type: "submit"
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
We could also link to places where the component is/will be implemented
|
|
20
|
+
|
|
21
|
+
#### 🧐 See it in the wild:
|
|
22
|
+
- [DN Skola prenumeration](https://prenumerera.dn.se/skolor/)
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{% from '@bonniernews/dn-design-system-web/foundations/icons/icon.njk' import Icon %}
|
|
2
|
+
|
|
3
|
+
{% macro Button(params) %}
|
|
4
|
+
{% set componentClassName = "ds-btn" %}
|
|
5
|
+
{% set classNamePrefix = componentClassName + "--" %}
|
|
6
|
+
{% set variant = [] %}
|
|
7
|
+
{% set text = params.text %}
|
|
8
|
+
{% set isDisabled = true if params.state and params.state == 'disabled' else false %}
|
|
9
|
+
{% set attributes %}
|
|
10
|
+
{% for attribute, value in params.attributes %}
|
|
11
|
+
{{attribute}}={{value}}
|
|
12
|
+
{% endfor %}
|
|
13
|
+
{% endset %}
|
|
14
|
+
|
|
15
|
+
{% if params.variant %}
|
|
16
|
+
{% set variant = (variant.push(classNamePrefix + params.variant), variant) %}
|
|
17
|
+
{% else %}
|
|
18
|
+
{% set variant = (variant.push(classNamePrefix + "primary"), variant) %}
|
|
19
|
+
{% endif %}
|
|
20
|
+
|
|
21
|
+
{% if params.size and params.size != "default" %}
|
|
22
|
+
{% set variant = (variant.push(classNamePrefix + params.size), variant) %}
|
|
23
|
+
{% endif %}
|
|
24
|
+
|
|
25
|
+
{% if params.fullWidth %}
|
|
26
|
+
{% set variant = (variant.push(classNamePrefix + "full-width"), variant) %}
|
|
27
|
+
{% endif %}
|
|
28
|
+
|
|
29
|
+
{% if params.iconName and params.iconPosition and params.iconPosition != "none" %}
|
|
30
|
+
{% set iconName = params.iconName | lower %}
|
|
31
|
+
{% set variant = (variant.push(classNamePrefix + "icon" + "-" + params.iconPosition ), variant) %}
|
|
32
|
+
{% set iconSvg = Icon({ icon: iconName }) %}
|
|
33
|
+
{% endif %}
|
|
34
|
+
|
|
35
|
+
{% if params.classNames %}
|
|
36
|
+
{% set variant = (variant.push(params.classNames), variant) %}
|
|
37
|
+
{% endif%}
|
|
38
|
+
|
|
39
|
+
{% set classes = componentClassName + " " + variant | join(" ") %}
|
|
40
|
+
|
|
41
|
+
{% if params.href %}
|
|
42
|
+
<a href="{{ params.href | default('#', true) }}" class="{{ classes }}" {{ attributes }}>{{ text }}{{- iconSvg | safe if iconSvg -}}</a>
|
|
43
|
+
{% else %}
|
|
44
|
+
<button type="{{ type | default('button') }}" class="{{ classes }}" {{ "disabled" if isDisabled }} {{ attributes }}>{{ text }}{{- iconSvg | safe if iconSvg -}}</button>
|
|
45
|
+
{% endif %}
|
|
46
|
+
{% endmacro %}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
@use "../../foundations/helpers/spacing.scss" as *;
|
|
2
|
+
@use "../../foundations/helpers/variable.scss" as *;
|
|
3
|
+
@use "../../foundations/helpers/fontFamily.scss" as *;
|
|
4
|
+
@use "../../foundations/variables/colorsDnLight" as *;
|
|
5
|
+
|
|
6
|
+
// Temporary variables we maybe should handle in a better way
|
|
7
|
+
$ds-btn__border-radius: 2px;
|
|
8
|
+
$ds-btn__border-width--outlined: 1px;
|
|
9
|
+
$ds-btn__outline-width: 2px;
|
|
10
|
+
|
|
11
|
+
.ds-btn {
|
|
12
|
+
@include ds-font-sans();
|
|
13
|
+
cursor: pointer;
|
|
14
|
+
font-weight: 500;
|
|
15
|
+
font-size: 16px;
|
|
16
|
+
line-height: 24px;
|
|
17
|
+
letter-spacing: .4px;
|
|
18
|
+
border: 0;
|
|
19
|
+
border-radius: $ds-btn__border-radius;
|
|
20
|
+
display: inline-block;
|
|
21
|
+
transition: background-color 50ms ease-out;
|
|
22
|
+
padding: ds-spacing(1.5 3);
|
|
23
|
+
|
|
24
|
+
&:focus {
|
|
25
|
+
outline-offset: 2px;
|
|
26
|
+
}
|
|
27
|
+
&:disabled {
|
|
28
|
+
outline: none;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
@at-root a#{&} {
|
|
32
|
+
box-sizing: border-box;
|
|
33
|
+
text-align: center;
|
|
34
|
+
text-decoration: none;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
&--full-width {
|
|
38
|
+
width: 100%;
|
|
39
|
+
}
|
|
40
|
+
&--small {
|
|
41
|
+
padding: ds-spacing(1 2.5);
|
|
42
|
+
}
|
|
43
|
+
&--outlined,
|
|
44
|
+
&--destructive {
|
|
45
|
+
padding: ds-spacing(1.5)-$ds-btn__border-width--outlined ds-spacing(3)-$ds-btn__border-width--outlined;
|
|
46
|
+
|
|
47
|
+
&.ds-btn--small {
|
|
48
|
+
padding: ds-spacing(1)-$ds-btn__border-width--outlined ds-spacing(2.5)-$ds-btn__border-width--outlined;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.ds-btn--icon-left,
|
|
54
|
+
.ds-btn--icon-right {
|
|
55
|
+
display: inline-flex;
|
|
56
|
+
align-items: center;
|
|
57
|
+
justify-content: center;
|
|
58
|
+
.ds-icon {
|
|
59
|
+
display: flex;
|
|
60
|
+
height: 24px;
|
|
61
|
+
margin: ds-spacing(0 0 0 1);
|
|
62
|
+
svg {
|
|
63
|
+
fill: currentColor;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.ds-btn--icon-left {
|
|
69
|
+
flex-direction: row-reverse;
|
|
70
|
+
.ds-icon {
|
|
71
|
+
margin: ds-spacing(0 1 0 0);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.ds-btn--brand {
|
|
76
|
+
background-color: var(--ds-action-brand-default);
|
|
77
|
+
color: var(--ds-text-on-brand);
|
|
78
|
+
&:hover {
|
|
79
|
+
background-color: var(--ds-action-brand-hover);
|
|
80
|
+
}
|
|
81
|
+
&:focus {
|
|
82
|
+
outline: $ds-btn__outline-width solid var(--ds-border-brand-default);
|
|
83
|
+
}
|
|
84
|
+
&:disabled {
|
|
85
|
+
background-color: var(--ds-action-brand-disabled);
|
|
86
|
+
color: var(--ds-text-primary-disabled);
|
|
87
|
+
outline: none;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.ds-btn--business {
|
|
92
|
+
background-color: var(--ds-action-business-default);
|
|
93
|
+
color: var(--ds-text-on-business);
|
|
94
|
+
&:hover {
|
|
95
|
+
background-color: var(--ds-action-business-hover);
|
|
96
|
+
}
|
|
97
|
+
&:focus {
|
|
98
|
+
outline: $ds-btn__outline-width solid var(--ds-border-business-default);
|
|
99
|
+
}
|
|
100
|
+
&:disabled {
|
|
101
|
+
background-color: var(--ds-action-business-disabled);
|
|
102
|
+
color: var(--ds-text-primary-disabled);
|
|
103
|
+
outline: none;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.ds-btn--primary {
|
|
108
|
+
background-color: var(--ds-action-primary-default);
|
|
109
|
+
color: var(--ds-text-on-primary);
|
|
110
|
+
&:hover {
|
|
111
|
+
background-color: var(--ds-action-primary-hover);
|
|
112
|
+
}
|
|
113
|
+
&:focus {
|
|
114
|
+
outline: $ds-btn__outline-width solid var(--ds-border-primary-strong);
|
|
115
|
+
}
|
|
116
|
+
&:disabled {
|
|
117
|
+
background-color: var(--ds-action-primary-disabled);
|
|
118
|
+
color: var(--ds-text-primary-disabled);
|
|
119
|
+
outline: none;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.ds-btn--outlined {
|
|
124
|
+
background-color: var(--ds-action-secondary-default);
|
|
125
|
+
border: $ds-btn__border-width--outlined solid var(--ds-border-primary-strong);
|
|
126
|
+
color: var(--ds-text-primary-default);
|
|
127
|
+
&:hover {
|
|
128
|
+
background-color: var(--ds-action-secondary-hover);
|
|
129
|
+
}
|
|
130
|
+
&:focus {
|
|
131
|
+
outline: $ds-btn__outline-width solid var(--ds-border-primary-strong);
|
|
132
|
+
}
|
|
133
|
+
&:disabled {
|
|
134
|
+
background-color: var(--ds-action-secondary-disabled);
|
|
135
|
+
border-color: var(--ds-action-secondary-disabled);
|
|
136
|
+
color: var(--ds-text-primary-disabled);
|
|
137
|
+
outline: none;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.ds-btn--destructive {
|
|
142
|
+
background-color: var(--ds-action-secondary-default);
|
|
143
|
+
border: $ds-btn__border-width--outlined solid var(--ds-border-critical-default);
|
|
144
|
+
color: var(--ds-text-critical-default);
|
|
145
|
+
&:hover {
|
|
146
|
+
background-color: var(--ds-action-critical-hover);
|
|
147
|
+
}
|
|
148
|
+
&:focus {
|
|
149
|
+
outline: $ds-btn__outline-width solid var(--ds-border-primary-strong);
|
|
150
|
+
}
|
|
151
|
+
&:disabled {
|
|
152
|
+
background-color: var(--ds-action-secondary-disabled);
|
|
153
|
+
border-color: var(--ds-action-secondary-disabled);
|
|
154
|
+
color: var(--ds-text-primary-disabled);
|
|
155
|
+
outline: none;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{% macro Hyperlink(params) %}
|
|
2
|
+
{% set componentClassName = "ds-hyperlink" %}
|
|
3
|
+
{% set classNamePrefix = componentClassName + "--" %}
|
|
4
|
+
{% set variant = [] %}
|
|
5
|
+
|
|
6
|
+
{% if params.textColor %}
|
|
7
|
+
{% set variant = (variant.push("ds-color-text-" + params.textColor), variant) %}
|
|
8
|
+
{% endif %}
|
|
9
|
+
|
|
10
|
+
{% if params.classNames %}
|
|
11
|
+
{% set variant = (variant.push(params.classNames), variant) %}
|
|
12
|
+
{% endif%}
|
|
13
|
+
|
|
14
|
+
{% set classes = componentClassName + " " + variant | join(" ") %}
|
|
15
|
+
|
|
16
|
+
<a href="{{ params.href | default('#', true) }}" class="{{ classes }}">{{ params.text }}</a>
|
|
17
|
+
{% endmacro %}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
**@bonniernews/dn-design-system-web/components/icon-button/README.md**
|
|
2
|
+
|
|
3
|
+
----
|
|
4
|
+
|
|
5
|
+
# Icon button
|
|
6
|
+
|
|
7
|
+
Parameters not available in storybook but used in the *real world*.
|
|
8
|
+
|
|
9
|
+
```javascript
|
|
10
|
+
/* Additional available parameters */
|
|
11
|
+
attributes: {
|
|
12
|
+
"data-test": "12345"
|
|
13
|
+
},
|
|
14
|
+
classNames: "my-special-class",
|
|
15
|
+
href: "https://designsystem-latest.dn.se/" // if you add href parameter the button will rendered as an <a>
|
|
16
|
+
```
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{% from '@bonniernews/dn-design-system-web/foundations/icons/icon.njk' import Icon %}
|
|
2
|
+
|
|
3
|
+
{% macro IconButton(params) %}
|
|
4
|
+
{% set componentClassName = "ds-icon-btn" %}
|
|
5
|
+
{% set classNamePrefix = componentClassName + "--" %}
|
|
6
|
+
{% set variant = [] %}
|
|
7
|
+
{% set text = params.text %}
|
|
8
|
+
{% set isDisabled = true if params.state and params.state == 'disabled' else false %}
|
|
9
|
+
{% set attributes %}
|
|
10
|
+
{% for attribute, value in params.attributes %}
|
|
11
|
+
{{attribute}}={{value}}
|
|
12
|
+
{% endfor %}
|
|
13
|
+
{% endset %}
|
|
14
|
+
|
|
15
|
+
{% if params.variant %}
|
|
16
|
+
{% set variant = (variant.push(classNamePrefix + params.variant), variant) %}
|
|
17
|
+
{% else %}
|
|
18
|
+
{% set variant = (variant.push(classNamePrefix + "overlay"), variant) %}
|
|
19
|
+
{% endif %}
|
|
20
|
+
|
|
21
|
+
{% if params.size and params.size != "default" %}
|
|
22
|
+
{% set variant = (variant.push(classNamePrefix + params.size), variant) %}
|
|
23
|
+
{% endif %}
|
|
24
|
+
|
|
25
|
+
{% if params.iconName %}
|
|
26
|
+
{% set iconName = params.iconName | lower %}
|
|
27
|
+
{% set iconSvg = Icon({ icon: iconName }) %}
|
|
28
|
+
{% endif %}
|
|
29
|
+
|
|
30
|
+
{% if params.classNames %}
|
|
31
|
+
{% set variant = (variant.push(params.classNames), variant) %}
|
|
32
|
+
{% endif%}
|
|
33
|
+
|
|
34
|
+
{% set classes = componentClassName + " " + variant | join(" ") %}
|
|
35
|
+
|
|
36
|
+
{% if params.href %}
|
|
37
|
+
<a href="{{ params.href | default('#', true) }}" class="{{ classes }}" {{ attributes }}>{{ text }}{{- iconSvg | safe if iconSvg -}}</a>
|
|
38
|
+
{% else %}
|
|
39
|
+
<button type="button" class="{{ classes }}" {{ "disabled" if isDisabled }} {{ attributes }}>{{ text }}{{- iconSvg | safe if iconSvg -}}</button>
|
|
40
|
+
{% endif %}
|
|
41
|
+
{% endmacro %}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
@use "../../foundations/helpers/spacing.scss" as *;
|
|
2
|
+
@use "../../foundations/helpers/variable.scss" as *;
|
|
3
|
+
@use "../../foundations/helpers/fontFamily.scss" as *;
|
|
4
|
+
@use "../../foundations/variables/colorsDnLight" as *;
|
|
5
|
+
|
|
6
|
+
// Temporary variables we maybe should handle in a better way
|
|
7
|
+
$ds-icon-btn__border-radius: 100px;
|
|
8
|
+
$ds-icon-btn__border-width--outlined: 1px;
|
|
9
|
+
$ds-icon-btn__outline-width: 2px;
|
|
10
|
+
$ds-icon-btn__size: 40px;
|
|
11
|
+
$ds-icon-btn__size--l: 48px;
|
|
12
|
+
$ds-icon-btn__size--s: 32px;
|
|
13
|
+
$ds-icon-btn__icon-size: 24px;
|
|
14
|
+
$ds-icon-btn__icon-size--s: 20px;
|
|
15
|
+
|
|
16
|
+
.ds-icon-btn {
|
|
17
|
+
cursor: pointer;
|
|
18
|
+
border: 0;
|
|
19
|
+
border-radius: $ds-icon-btn__border-radius;
|
|
20
|
+
box-sizing: border-box;
|
|
21
|
+
transition: background-color 50ms ease-out;
|
|
22
|
+
padding: 0;
|
|
23
|
+
margin: 0;
|
|
24
|
+
width: $ds-icon-btn__size;
|
|
25
|
+
height: $ds-icon-btn__size;
|
|
26
|
+
display: inline-flex;
|
|
27
|
+
align-items: center;
|
|
28
|
+
justify-content: center;
|
|
29
|
+
|
|
30
|
+
.ds-icon {
|
|
31
|
+
display: flex;
|
|
32
|
+
height: $ds-icon-btn__icon-size;
|
|
33
|
+
margin: 0;
|
|
34
|
+
svg {
|
|
35
|
+
fill: currentColor;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
&:focus {
|
|
40
|
+
outline-offset: 2px;
|
|
41
|
+
}
|
|
42
|
+
&:disabled {
|
|
43
|
+
outline: none;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
@at-root a#{&} {
|
|
47
|
+
box-sizing: border-box;
|
|
48
|
+
text-align: center;
|
|
49
|
+
text-decoration: none;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
&--small {
|
|
53
|
+
width: $ds-icon-btn__size--s;
|
|
54
|
+
height: $ds-icon-btn__size--s;
|
|
55
|
+
.ds-icon {
|
|
56
|
+
height: $ds-icon-btn__icon-size--s;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
&--large {
|
|
60
|
+
width: $ds-icon-btn__size--l;
|
|
61
|
+
height: $ds-icon-btn__size--l;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.ds-icon-btn--transparent {
|
|
66
|
+
background-color: transparent;
|
|
67
|
+
color: var(--ds-icon-primary-default);
|
|
68
|
+
&:hover {
|
|
69
|
+
background-color: var(--ds-action-overlay-hover);
|
|
70
|
+
}
|
|
71
|
+
&:focus {
|
|
72
|
+
outline: $ds-icon-btn__outline-width solid var(--ds-border-primary-strong);
|
|
73
|
+
}
|
|
74
|
+
&:disabled {
|
|
75
|
+
color: var(--ds-icon-primary-disabled);
|
|
76
|
+
outline: none;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.ds-icon-btn--overlay {
|
|
81
|
+
background-color: var(--ds-action-overlay-default);
|
|
82
|
+
color: var(--ds-icon-primary-default);
|
|
83
|
+
&:hover {
|
|
84
|
+
background-color: var(--ds-action-overlay-hover);
|
|
85
|
+
}
|
|
86
|
+
&:focus {
|
|
87
|
+
outline: $ds-icon-btn__outline-width solid var(--ds-border-primary-strong);
|
|
88
|
+
}
|
|
89
|
+
&:disabled {
|
|
90
|
+
color: var(--ds-icon-primary-disabled);
|
|
91
|
+
outline: none;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.ds-icon-btn--outlined {
|
|
96
|
+
background-color: var(--ds-action-secondary-default);
|
|
97
|
+
border: $ds-icon-btn__border-width--outlined solid var(--ds-border-primary-default);
|
|
98
|
+
color: var(--ds-icon-primary-default);
|
|
99
|
+
&:hover {
|
|
100
|
+
background-color: var(--ds-action-secondary-hover);
|
|
101
|
+
}
|
|
102
|
+
&:focus {
|
|
103
|
+
outline: $ds-icon-btn__outline-width solid $ds-border-primary-strong;
|
|
104
|
+
outline-color: var(--ds-border-primary-strong);
|
|
105
|
+
}
|
|
106
|
+
&:disabled {
|
|
107
|
+
border: none;
|
|
108
|
+
background-color: var(--ds-action-secondary-disabled);
|
|
109
|
+
color: var(--ds-icon-primary-disabled);
|
|
110
|
+
outline: none;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{% macro TextSans(params) %}
|
|
2
|
+
{% set fontClassName = "ds-font-sans" %}
|
|
3
|
+
{% set classNamePrefix = fontClassName + "--" %}
|
|
4
|
+
{% set variant = [] %}
|
|
5
|
+
|
|
6
|
+
{% if params.monospace %}
|
|
7
|
+
{% set variant = (variant.push(classNamePrefix + "monospace"), variant) %}
|
|
8
|
+
{% endif %}
|
|
9
|
+
|
|
10
|
+
{% if params.size %}
|
|
11
|
+
{% set variant = (variant.push(classNamePrefix + params.size), variant) %}
|
|
12
|
+
{% endif %}
|
|
13
|
+
|
|
14
|
+
{% if params.weight %}
|
|
15
|
+
{% set variant = (variant.push(classNamePrefix + params.weight), variant) %}
|
|
16
|
+
{% endif %}
|
|
17
|
+
|
|
18
|
+
{% if params.textColor %}
|
|
19
|
+
{% set variant = (variant.push("ds-color-text-" + params.textColor), variant) %}
|
|
20
|
+
{% endif %}
|
|
21
|
+
|
|
22
|
+
{% set fontClasses = fontClassName + " " + variant | join(" ") %}
|
|
23
|
+
|
|
24
|
+
<p class="{{fontClasses}}">{{ params.text if params.text }}{{ caller() if caller }}</p>
|
|
25
|
+
{% endmacro %}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@use "../../foundations/typography-sans.scss" as *;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
@use 'sass:meta';
|
|
2
|
+
@use 'sass:string';
|
|
3
|
+
@use './variables/colorsDnLight';
|
|
4
|
+
@use './variables/colorsDnDark';
|
|
5
|
+
|
|
6
|
+
html {
|
|
7
|
+
@each $name, $value in meta.module-variables("colorsDnLight") {
|
|
8
|
+
--#{$name}: #{$value};
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
// Skip automatic dark mode since majority of dn.se is not adapted
|
|
12
|
+
// Better to toggle using .dnDark on adapted views and/or elements
|
|
13
|
+
// @media (prefers-color-scheme: dark) {
|
|
14
|
+
// @each $name, $value in meta.module-variables("colorsDnDark") {
|
|
15
|
+
// --ds-#{string.slice($name, 9)}: #{$value};
|
|
16
|
+
// }
|
|
17
|
+
// }
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
@each $name, $value in meta.module-variables("colorsDnLight") {
|
|
21
|
+
.ds-color-#{string.slice($name, 4)} {
|
|
22
|
+
color: var(--#{$name});
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// for manually switching on dark mode, for exemple used when switching theme in storybook
|
|
27
|
+
.dnDark {
|
|
28
|
+
@each $name, $value in meta.module-variables("colorsDnDark") {
|
|
29
|
+
--ds-#{string.slice($name, 9)}: #{$value};
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
@font-face {
|
|
2
|
+
font-family: DNSansVF;
|
|
3
|
+
src: url("~@bonniernews/dn-designsystem-foundations/src/typography/fonts/Variable/DNSans09VF.woff2") format('woff2-variations'),
|
|
4
|
+
url("~@bonniernews/dn-designsystem-foundations/src/typography/fonts/Variable/DNSans09VF.woff2") format('woff2');
|
|
5
|
+
font-weight: 300 900;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
@font-face {
|
|
9
|
+
font-family: DNSans;
|
|
10
|
+
font-weight: 300;
|
|
11
|
+
font-display: swap;
|
|
12
|
+
src: url("~@bonniernews/dn-designsystem-foundations/src/typography/fonts/web/DNSans09-Light.woff") format("woff");
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
@font-face {
|
|
16
|
+
font-family: DNSans;
|
|
17
|
+
font-weight: 400;
|
|
18
|
+
font-display: swap;
|
|
19
|
+
src: url("~@bonniernews/dn-designsystem-foundations/src/typography/fonts/web/DNSans09-Regular.woff") format("woff");
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
@font-face {
|
|
23
|
+
font-family: DNSans;
|
|
24
|
+
font-weight: 500;
|
|
25
|
+
font-display: swap;
|
|
26
|
+
src: url("~@bonniernews/dn-designsystem-foundations/src/typography/fonts/web/DNSans09-Medium.woff") format("woff");
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
@font-face {
|
|
30
|
+
font-family: DNSans;
|
|
31
|
+
font-weight: 700;
|
|
32
|
+
font-display: swap;
|
|
33
|
+
src: url("~@bonniernews/dn-designsystem-foundations/src/typography/fonts/web/DNSans09-Bold.woff") format("woff");
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
@font-face {
|
|
37
|
+
font-family: DNSans;
|
|
38
|
+
font-weight: 900;
|
|
39
|
+
font-display: swap;
|
|
40
|
+
src: url("~@bonniernews/dn-designsystem-foundations/src/typography/fonts/web/DNSans09-Black.woff") format("woff");
|
|
41
|
+
}
|
|
42
|
+
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
@use 'sass:meta';
|
|
2
|
+
@use 'sass:string';
|
|
3
|
+
@use 'sass:map';
|
|
4
|
+
@use '../variables/colorsDnLight';
|
|
5
|
+
@use '../variables/colorsDnDark';
|
|
6
|
+
|
|
7
|
+
$ds-light: ();
|
|
8
|
+
@each $name, $value in meta.module-variables("colorsDnLight") {
|
|
9
|
+
$ds-light: map.merge($ds-light, ($name: $value)) !global;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
$ds-dark: ();
|
|
13
|
+
@each $name, $value in meta.module-variables("colorsDnDark") {
|
|
14
|
+
$ds-dark: map.merge($ds-dark, ($name: $value)) !global;
|
|
15
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
@use "sass:list";
|
|
2
|
+
@use "sass:math";
|
|
3
|
+
@use "../variables/spacingComponent.scss" as *;
|
|
4
|
+
@use "../variables/spacingLayout.scss" as *;
|
|
5
|
+
|
|
6
|
+
$ds-spacing-component-base: $ds-spacing-component-x1;
|
|
7
|
+
|
|
8
|
+
$ds-spacing-layout-base: math.div($ds-spacing-layout-x2, 2);
|
|
9
|
+
|
|
10
|
+
@function ds-spacing($units) {
|
|
11
|
+
$spacings: ();
|
|
12
|
+
|
|
13
|
+
@each $unit in $units {
|
|
14
|
+
$spacing: $unit;
|
|
15
|
+
@if ($unit != 0) {
|
|
16
|
+
$spacing: math.clamp(0.5, $unit, 6) * $ds-spacing-component-base;
|
|
17
|
+
}
|
|
18
|
+
$spacings: list.append($spacings, $spacing);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
@if length($spacings) == 1 {
|
|
22
|
+
@return list.nth($spacings, 1);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
@return $spacings;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
@function ds-spacing-layout($units) {
|
|
29
|
+
$spacings: ();
|
|
30
|
+
|
|
31
|
+
@each $unit in $units {
|
|
32
|
+
$spacing: $unit;
|
|
33
|
+
@if ($unit != 0) {
|
|
34
|
+
$spacing: math.clamp(2, $unit, 12) * $ds-spacing-layout-base;
|
|
35
|
+
}
|
|
36
|
+
$spacings: list.append($spacings, $spacing);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
@if length($spacings) == 1 {
|
|
40
|
+
@return list.nth($spacings, 1);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
@return $spacings;
|
|
44
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
@use 'sass:string';
|
|
2
|
+
@use 'sass:map';
|
|
3
|
+
@use "./colorMap.scss" as *;
|
|
4
|
+
|
|
5
|
+
@function ds-get-var($var) {
|
|
6
|
+
@return var(--#{$var});
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
@function ds-get-var-clean($var) {
|
|
10
|
+
@return string.slice(#{$var}, 2);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
@mixin ds-color-variable($var, $property) {
|
|
14
|
+
$clean: ds-get-var-clean(#{$var});
|
|
15
|
+
|
|
16
|
+
#{$property}: ds-get-var($clean);
|
|
17
|
+
}
|