@bonniernews/dn-design-system-web 14.2.0 → 14.3.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/factbox/README-UXD.md +40 -0
- package/components/list-item/README-accordion.md +1 -1
- package/components/list-item/README-checkbox.md +1 -1
- package/components/list-item/README-image.md +48 -0
- package/components/list-item/README-radio.md +1 -1
- package/components/list-item/README-switch.md +1 -1
- package/components/list-item/README-toggle.md +1 -1
- package/components/list-item/README.md +1 -1
- package/components/list-item/list-item.njk +4 -1
- package/components/list-item/list-item.scss +12 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,25 @@ All changes to @bonniernews/dn-design-system-web will be documented in this file
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
+
## [14.3.0](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@14.2.1...@bonniernews/dn-design-system-web@14.3.0) (2024-03-13)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Features
|
|
11
|
+
|
|
12
|
+
* **web:** support for images in list item ([#1240](https://github.com/BonnierNews/dn-design-system/issues/1240)) ([0b83b22](https://github.com/BonnierNews/dn-design-system/commit/0b83b22ef2f843e63a127db7e4324d7d077c9ccb))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
* **app:** better flex in BaseListItem ([#1241](https://github.com/BonnierNews/dn-design-system/issues/1241)) ([12f7229](https://github.com/BonnierNews/dn-design-system/commit/12f72296fe2ae6b5c73273b9449d92b85f07b335))
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Maintenance
|
|
21
|
+
|
|
22
|
+
* prerelease packages ([114a615](https://github.com/BonnierNews/dn-design-system/commit/114a615923ab90db49adff9c6a9ce868d1b7d2f2))
|
|
23
|
+
|
|
24
|
+
## [14.2.1](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@14.2.0...@bonniernews/dn-design-system-web@14.2.1) (2024-03-12)
|
|
25
|
+
|
|
7
26
|
## [14.2.0](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@14.1.0...@bonniernews/dn-design-system-web@14.2.0) (2024-03-12)
|
|
8
27
|
|
|
9
28
|
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# Standard button
|
|
2
|
+
|
|
3
|
+
Buttons are used to initialize an action. Button labels express what action will occur when the user interacts with it.
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Anatomy
|
|
7
|
+
|
|
8
|
+
1. **Label:** The text displayed on the button, indicating its function.
|
|
9
|
+
2. **Icon** Iconography that enhances the function.
|
|
10
|
+
3. **Background:** The background color or style that defines the button's appearance.
|
|
11
|
+
4. **Border:** The outline surrounding the button, providing visual separation from surrounding elements.
|
|
12
|
+
5. **Shape** The standard shape is rectangular but the component also supports a rounded format.
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
## Variants
|
|
16
|
+
|
|
17
|
+
| Variant | How to use |
|
|
18
|
+
| --------- | ---------------------------------------------------------------------------------------------------- |
|
|
19
|
+
| Brand | Extra high emphasis button used for actions that are extra important for the user flow and conversion. I.e. ”Logga in” |
|
|
20
|
+
| Primary | High emphasis button used to attract attention to the most important task of the layout, typically the next step in the user flow. I.e. ”Nästa fråga” in a quiz. |
|
|
21
|
+
| Secondary | Medium emphasis button used for alternative non-primary actions. I.e. ”Alla nyheter” in a list of news. |
|
|
22
|
+
| Outline | Low emphasis Button used for less important actions. Usually used in combination with a primary or brand Button. |
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
## Usage
|
|
26
|
+
|
|
27
|
+
Buttons are used to initialize an action. Button labels express what action will occur when the user interacts with it.
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
### Dos
|
|
31
|
+
|
|
32
|
+
- **Use Primary Buttons for Key Actions:** Employ primary buttons for primary actions within a given context, guiding user focus towards important interactions.
|
|
33
|
+
- **Provide Clear Labeling:** Ensure button labels are concise, descriptive, and indicative of the action they perform, enhancing usability.
|
|
34
|
+
- **Maintain Visual Hierarchy:** Utilize secondary and outline buttons to distinguish lesser actions or provide alternative choices, maintaining a clear visual hierarchy.
|
|
35
|
+
|
|
36
|
+
### Don'ts
|
|
37
|
+
|
|
38
|
+
- **Avoid Ambiguous Labels:** Refrain from using vague or ambiguous labels like ”Fortsätt” that might confuse users about the button's function.
|
|
39
|
+
- **Overuse of Primary Buttons:** Reserve primary buttons for the most crucial actions to avoid overwhelming users with excessive visual weight.
|
|
40
|
+
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
|parameter | type | required | options | default | description |
|
|
12
12
|
|:--- | :--- | :--- | :--- | :--- | :--- |
|
|
13
|
-
|listItemType | String | yes | accordion, checkbox, radio, switch, standard | standard | Note that some parameters are **not** available for certain item types |
|
|
13
|
+
|listItemType | String | yes | accordion, checkbox, radio, switch, image, standard | standard | Note that some parameters are **not** available for certain item types |
|
|
14
14
|
|accordionContent | String | yes | | | It is possible to use html |
|
|
15
15
|
|title | String | no | | | |
|
|
16
16
|
|subtitle | String | no | | | |
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
|parameter | type | required | options | default | description |
|
|
12
12
|
|:--- | :--- | :--- | :--- | :--- | :--- |
|
|
13
|
-
|listItemType | String | yes | accordion, checkbox, radio, switch, standard | standard | Note that some parameters are **not** available for certain list item types |
|
|
13
|
+
|listItemType | String | yes | accordion, checkbox, radio, switch, image, standard | standard | Note that some parameters are **not** available for certain list item types |
|
|
14
14
|
|name | String | yes | | | Also used as id |
|
|
15
15
|
|title | String | no | | | |
|
|
16
16
|
|subtitle | String | no | | | |
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
- GitHub: [BonnierNews/dn-design-system/../web/src/components/list-item](https://github.com/BonnierNews/dn-design-system/tree/main/web/src/components/list-item)
|
|
2
|
+
- Storybook: [ListItem > ImageListItem](https://designsystem.dn.se/?path=/docs/basic-listitem-imagelistitem--docs)
|
|
3
|
+
- Storybook (Latest): [ListItem > ImageListItem](https://designsystem-latest.dn.se/?path=/docs/basic-listitem-imagelistitem--docs)
|
|
4
|
+
|
|
5
|
+
----
|
|
6
|
+
|
|
7
|
+
# Image List Item
|
|
8
|
+
|
|
9
|
+
## Parameters
|
|
10
|
+
|
|
11
|
+
|parameter | type | required | options | default | description |
|
|
12
|
+
|:--- | :--- | :--- | :--- | :--- | :--- |
|
|
13
|
+
|listItemType | String | no | accordion, checkbox, radio, switch, image, standard | standard | Note that some parameters are **not** available for certain list item types |
|
|
14
|
+
|title | String | no | | | |
|
|
15
|
+
|subtitle | String | no | | | |
|
|
16
|
+
|meta | String | no | | | |
|
|
17
|
+
|disabled | bool | no | true, false | false | Note: only works on button-tag, not on a-tag |
|
|
18
|
+
|border | bool | no | true, false | false | |
|
|
19
|
+
|mediaHtml | String | no | | | Main image |
|
|
20
|
+
|trailingIcon | String | no | add, arrow_back, arrow_forward etc | | For all available icons see: https://designsystem.dn.se/?path=/story/foundations-icons--all-icons |
|
|
21
|
+
|href | String | no | | | If href is set the list item will be rendered as an a-tag |
|
|
22
|
+
|attributes | Object | no | | | Ex. { target: "_blank", "data-test": "lorem ipsum" } |
|
|
23
|
+
|classNames | String | no | | | Ex. "my-special-class" |
|
|
24
|
+
|forcePx | bool | no | true, false | false | Fixed pixel value is used for typography to prevent scaling based on html font-size
|
|
25
|
+
|
|
26
|
+
## Minimum requirement example
|
|
27
|
+
|
|
28
|
+
### Nunjucks
|
|
29
|
+
|
|
30
|
+
These are copy paste friendly examples to quickliy get started using a component.
|
|
31
|
+
|
|
32
|
+
```html
|
|
33
|
+
{% from '@bonniernews/dn-design-system-web/components/list-item/list-item.njk' import ListItem %}
|
|
34
|
+
|
|
35
|
+
{{ ListItem({
|
|
36
|
+
listItemType: 'image',
|
|
37
|
+
title: 'My list item',
|
|
38
|
+
mediaHtml: 'image-html',
|
|
39
|
+
trailingIcon: 'arrow_forward',
|
|
40
|
+
subtitle: 'Subtitle text',
|
|
41
|
+
meta: 'Meta text'
|
|
42
|
+
})}}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### SCSS
|
|
46
|
+
```scss
|
|
47
|
+
@use "@bonniernews/dn-design-system-web/components/list-item/list-item";
|
|
48
|
+
```
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
|parameter | type | required | options | default | description |
|
|
12
12
|
|:--- | :--- | :--- | :--- | :--- | :--- |
|
|
13
|
-
|listItemType | String | yes | accordion, checkbox, radio, switch, standard | standard | Note that some parameters are **not** available for certain list item types |
|
|
13
|
+
|listItemType | String | yes | accordion, checkbox, radio, switch, image, standard | standard | Note that some parameters are **not** available for certain list item types |
|
|
14
14
|
|name | String | yes | | | |
|
|
15
15
|
|id | String | yes | | | |
|
|
16
16
|
|title | String | no | | | |
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
|parameter | type | required | options | default | description |
|
|
12
12
|
|:--- | :--- | :--- | :--- | :--- | :--- |
|
|
13
|
-
|listItemType | String | yes | accordion, checkbox, radio, switch, standard | standard | Note that some parameters are **not** available for certain list item types |
|
|
13
|
+
|listItemType | String | yes | accordion, checkbox, radio, switch, image, standard | standard | Note that some parameters are **not** available for certain list item types |
|
|
14
14
|
|name | String | yes | | | Also used as id |
|
|
15
15
|
|title | String | no | | | |
|
|
16
16
|
|subtitle | String | no | | | |
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
|parameter | type | required | options | default | description |
|
|
12
12
|
|:--- | :--- | :--- | :--- | :--- | :--- |
|
|
13
|
-
|listItemType | String | yes | accordion, checkbox, radio, toggle, standard | standard | Note that some parameters are **not** available for certain list item types |
|
|
13
|
+
|listItemType | String | yes | accordion, checkbox, radio, toggle, image, standard | standard | Note that some parameters are **not** available for certain list item types |
|
|
14
14
|
|title | String | yes | | | |
|
|
15
15
|
|titleHref | String | no | | | If titleHref is set the list item title will be rendered as an a-tag |
|
|
16
16
|
|subtitle | String | no | | | |
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
|parameter | type | required | options | default | description |
|
|
12
12
|
|:--- | :--- | :--- | :--- | :--- | :--- |
|
|
13
|
-
|listItemType | String | no | accordion, checkbox, radio, switch, standard | standard | Note that some parameters are **not** available for certain list item types |
|
|
13
|
+
|listItemType | String | no | accordion, checkbox, radio, switch, image, standard | standard | Note that some parameters are **not** available for certain list item types |
|
|
14
14
|
|title | String | no | | | |
|
|
15
15
|
|subtitle | String | no | | | |
|
|
16
16
|
|meta | String | no | | | |
|
|
@@ -14,6 +14,9 @@
|
|
|
14
14
|
{% if iconLeftSvg %}
|
|
15
15
|
<span class="{{ componentClassName + '__icon-left'}}">{{- iconLeftSvg | safe -}}</span>
|
|
16
16
|
{% endif %}
|
|
17
|
+
{% if params.listItemType == 'image' %}
|
|
18
|
+
<div class="{{ componentClassName + '__image'}}">{{ params.mediaHtml }}</div>
|
|
19
|
+
{% endif %}
|
|
17
20
|
{% if params.title %}
|
|
18
21
|
<div class="{{ componentClassName + '__titles'}}">
|
|
19
22
|
{% if params.titleHref and not params.disabled %}
|
|
@@ -54,7 +57,7 @@
|
|
|
54
57
|
{% set variantClass = classNamePrefix + params.listItemType %}
|
|
55
58
|
{% endif %}
|
|
56
59
|
|
|
57
|
-
{% if params.leadingIcon %}
|
|
60
|
+
{% if params.leadingIcon and params.listItemType != "image" %}
|
|
58
61
|
{% set iconLeftSvg = IconUse({ icon: params.leadingIcon }) %}
|
|
59
62
|
{% endif %}
|
|
60
63
|
|
|
@@ -110,6 +110,18 @@ $ds-list-item__icon-size: 24px;
|
|
|
110
110
|
margin-left: ds-spacing($ds-s-100);
|
|
111
111
|
}
|
|
112
112
|
|
|
113
|
+
.ds-list-item__image {
|
|
114
|
+
max-height: 24px;
|
|
115
|
+
|
|
116
|
+
figure {
|
|
117
|
+
margin: 0;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
+ .ds-list-item__titles {
|
|
121
|
+
margin-left: ds-spacing($ds-s-100);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
113
125
|
@include ds-hover() {
|
|
114
126
|
&:hover:not(.ds-list-item--disabled) .ds-list-item__inner::before {
|
|
115
127
|
background-color: $ds-color-component-primary-overlay;
|
package/package.json
CHANGED