@bonniernews/dn-design-system-web 28.0.1 → 29.0.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 +11 -0
- package/components/blocked-content/blocked-content.js +1 -1
- package/components/blocked-content/blocked-content.njk +2 -2
- package/components/buddy-menu/buddy-menu.njk +5 -5
- package/components/buddy-menu/buddy-menu.scss +0 -1
- package/components/button/README.md +6 -8
- package/components/button/button-types.ts +34 -25
- package/components/button/button.njk +8 -15
- package/components/button/button.scss +58 -85
- package/components/button-toggle/README.md +8 -5
- package/components/button-toggle/button-toggle.njk +3 -0
- package/components/divider/README.md +1 -1
- package/components/empty-state/empty-state.njk +2 -3
- package/components/factbox/factbox.njk +4 -4
- package/components/group-header/group-header.njk +10 -10
- package/components/group-header/group-header.scss +1 -2
- package/components/list-item/list-item-types.ts +3 -3
- package/components/list-item/list-item.njk +4 -4
- package/components/modal/modal.njk +10 -8
- package/components/modal/modal.scss +3 -4
- package/components/pagination/pagination.njk +0 -1
- package/components/profile-header/profile-header.njk +2 -2
- package/components/tag-header/tag-header.njk +2 -2
- package/components/teaser-list-swipe/teaser-list-swipe.njk +9 -9
- package/components/teaser-list-swipe/teaser-list-swipe.scss +3 -3
- package/components/teaser-list-vertical/teaser-list-vertical.njk +1 -1
- package/components/text-input/text-input.njk +5 -3
- package/components/text-input/text-input.scss +2 -3
- package/components/tooltip/tooltip.njk +4 -4
- package/components/tooltip/tooltip.scss +0 -1
- package/package.json +1 -1
- package/preact/components/buddy-menu/buddy-menu.js +24 -69
- package/preact/components/buddy-menu/buddy-menu.js.map +4 -4
- package/preact/components/button/button-base.d.ts +1 -1
- package/preact/components/button/button-base.js +4 -12
- package/preact/components/button/button-base.js.map +2 -2
- package/preact/components/button/button-types.d.ts +24 -19
- package/preact/components/button/button.d.ts +1 -1
- package/preact/components/button/button.js +7 -17
- package/preact/components/button/button.js.map +2 -2
- package/preact/components/button-toggle/button-toggle.d.ts +1 -1
- package/preact/components/button-toggle/button-toggle.js +11 -14
- package/preact/components/button-toggle/button-toggle.js.map +2 -2
- package/preact/components/list-item/list-item-types.d.ts +3 -3
- package/preact/components/list-item/list-item.js +13 -16
- package/preact/components/list-item/list-item.js.map +2 -2
- package/preact/components/text-input/text-input.js +28 -29
- package/preact/components/text-input/text-input.js.map +3 -3
- package/components/icon-button/README-NJK.md +0 -47
- package/components/icon-button/README-UXD.md +0 -44
- package/components/icon-button/README.md +0 -31
- package/components/icon-button/icon-button.njk +0 -22
- package/components/icon-button/icon-button.scss +0 -32
- package/components/icon-button-toggle/README-NJK.md +0 -53
- package/components/icon-button-toggle/README-UXD.md +0 -0
- package/components/icon-button-toggle/README.md +0 -38
- package/components/icon-button-toggle/icon-button-toggle.njk +0 -18
- package/components/icon-button-toggle/icon-button-toggle.scss +0 -1
- package/preact/components/icon-button/icon-button.d.ts +0 -10
- package/preact/components/icon-button/icon-button.js +0 -198
- package/preact/components/icon-button/icon-button.js.map +0 -7
- package/preact/components/icon-button-toggle/icon-button-toggle.d.ts +0 -18
- package/preact/components/icon-button-toggle/icon-button-toggle.js +0 -200
- package/preact/components/icon-button-toggle/icon-button-toggle.js.map +0 -7
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,17 @@ All changes to @bonniernews/dn-design-system-web will be documented in this file
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
+
## [29.0.0](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@28.0.1...@bonniernews/dn-design-system-web@29.0.0) (2025-02-12)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### ⚠ BREAKING CHANGES
|
|
11
|
+
|
|
12
|
+
* **web:** buttons visuella toppar (#1602)
|
|
13
|
+
|
|
14
|
+
### Features
|
|
15
|
+
|
|
16
|
+
* **web:** buttons visuella toppar ([#1602](https://github.com/BonnierNews/dn-design-system/issues/1602)) ([8e2f044](https://github.com/BonnierNews/dn-design-system/commit/8e2f04492c7f9e20765b6aab68d853340a86ead5))
|
|
17
|
+
|
|
7
18
|
## [28.0.1](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@28.0.0...@bonniernews/dn-design-system-web@28.0.1) (2025-02-11)
|
|
8
19
|
|
|
9
20
|
|
|
@@ -15,7 +15,7 @@ function dsBlockedContent(params) {
|
|
|
15
15
|
<h2 class="ds-blocked-content__title">Hoppsan, här saknas något</h2>
|
|
16
16
|
<div class="ds-blocked-content__body">Innehållet ${ params.vendor ? `från ${params.vendor}` : '' } kunde inte visas på grund av dina val i kakinställningarna.</div>
|
|
17
17
|
</div>
|
|
18
|
-
<button type="button" class="ds-btn ds-btn--
|
|
18
|
+
<button type="button" class="ds-btn ds-btn--secondaryFilled ds-btn--default ds-btn--md ds-btn--full-width">
|
|
19
19
|
<div class="ds-btn__inner">
|
|
20
20
|
<span>Hantera kakor</span>
|
|
21
21
|
<div class="ds-spinner ds-spinner--small ds-spinner--primary">
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
{% from '@bonniernews/dn-design-system-web/njk-helpers/attributes.njk' import getAttributes %}
|
|
2
2
|
{% from '@bonniernews/dn-design-system-web/components/list-item/list-item.njk' import ListItem %}
|
|
3
|
-
{% from '@bonniernews/dn-design-system-web/components/icon-button/icon-button.njk' import IconButton %}
|
|
4
3
|
{% from '@bonniernews/dn-design-system-web/components/button/button.njk' import Button %}
|
|
5
4
|
|
|
6
5
|
{% macro BuddyMenu(params) %}
|
|
@@ -18,12 +17,13 @@
|
|
|
18
17
|
<div class="{{ componentClassName + '__inner'}}">
|
|
19
18
|
<div class="ds-buddy-menu__scrollable-container">
|
|
20
19
|
<div class="ds-buddy-menu__content">
|
|
21
|
-
{{
|
|
20
|
+
{{ Button({
|
|
22
21
|
variant: "transparent",
|
|
23
|
-
size: "
|
|
22
|
+
size: "sm",
|
|
24
23
|
iconName: "close",
|
|
25
24
|
classNames: "ds-buddy-menu__close",
|
|
26
|
-
forcePx: params.forcePx
|
|
25
|
+
forcePx: params.forcePx,
|
|
26
|
+
isIconButton: true
|
|
27
27
|
})}}
|
|
28
28
|
|
|
29
29
|
<div class="ds-buddy-menu__header">
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
|
|
47
47
|
{{ Button({
|
|
48
48
|
text: "Mitt konto",
|
|
49
|
-
variant: "
|
|
49
|
+
variant: "primaryBlack",
|
|
50
50
|
fullWidth: true,
|
|
51
51
|
href: params.myAccountUrl | default("#"),
|
|
52
52
|
attributes: { "data-hide-promo" : "" },
|
|
@@ -9,27 +9,25 @@ Button
|
|
|
9
9
|
|
|
10
10
|
| Name | Description | Default |
|
|
11
11
|
|:--- | :--- | :--- |
|
|
12
|
-
|
|
|
12
|
+
| isIconButton | boolean | false |
|
|
13
|
+
| iconName | add, arrow\_back, arrow\_forward etc | | For all available icons see: [https://designsystem.dn.se/?path=/story/foundations-icons--all-icons](https://designsystem.dn.se/?path=/story/foundations-icons--all-icons)<br />"add", "arrow\_back", "arrow\_forward", "arrow\_outward", "arrow\_upward", "autoplay", "bookmark-filled", "bookmarked" | \- |
|
|
14
|
+
| variant | Design variant<br />"primary", "staticWhite", "primaryBlack", "secondaryFilled", "secondaryOutline", "transparent" | "primary" |
|
|
13
15
|
| disabled | Note: only works on button-tag, not on a-tag<br />boolean | false |
|
|
14
16
|
| classNames | string | \- |
|
|
15
17
|
| attributes | Ex. { target: "\_blank", "data-test": "lorem ipsum" }<br />{ \[key: string\]: string; } | \- |
|
|
16
18
|
| forcePx | Fixed pixel value is used for typography to prevent scaling based on html font-size<br />boolean | false |
|
|
17
|
-
| size | "
|
|
19
|
+
| size | "sm", "md", "lg", "xl" | "md" |
|
|
18
20
|
| loading | boolean | false |
|
|
19
|
-
|
|
|
20
|
-
| variant | Design variant<br />"brand", "secondary", "primary", "staticWhite" | "primary" |
|
|
21
|
+
| text | string | \- |
|
|
21
22
|
| fullWidth | Button will be full width on both desktop and mobile<br />boolean | false |
|
|
22
23
|
| mobileFullWidth | Button will only full width on mobile<br />boolean | false |
|
|
23
24
|
| href | If href is set the button will be rendered as an a-tag<br />string | \- |
|
|
24
25
|
| type | "button", "submit" | "button" |
|
|
25
|
-
| emphasis | "default", "elevated", "outline", "transparent" | "default" |
|
|
26
|
-
| rounded | Button will be rounded<br />boolean | false |
|
|
27
26
|
| iconPosition | "right", "none", "left" | "none" |
|
|
28
27
|
|
|
29
28
|
```jsx
|
|
30
29
|
<Button
|
|
31
|
-
|
|
32
|
-
size="medium"
|
|
30
|
+
size="md"
|
|
33
31
|
text="Primary"
|
|
34
32
|
variant="primary"
|
|
35
33
|
/>
|
|
@@ -1,15 +1,20 @@
|
|
|
1
1
|
import type { DsIcon } from '@bonniernews/dn-design-system-web/types-lib/ds-icon.d.ts'
|
|
2
2
|
|
|
3
3
|
export interface ButtonSharedProps {
|
|
4
|
+
/** Design variant */
|
|
5
|
+
variant?: 'primary' | 'primaryBlack' | 'secondaryFilled' | 'secondaryOutline' | 'transparent' | 'staticWhite'
|
|
4
6
|
/** Note: only works on button-tag, not on a-tag */
|
|
5
7
|
disabled?: boolean
|
|
8
|
+
/** add, arrow_back, arrow_forward etc | | For all available icons see: https://designsystem.dn.se/?path=/story/foundations-icons--all-icons */
|
|
9
|
+
iconName?: DsIcon
|
|
6
10
|
classNames?: string
|
|
7
11
|
/** Ex. { target: "_blank", "data-test": "lorem ipsum" } */
|
|
8
12
|
attributes?: { [key: string]: string }
|
|
9
13
|
/** Fixed pixel value is used for typography to prevent scaling based on html font-size */
|
|
10
14
|
forcePx?: boolean
|
|
11
|
-
size?: '
|
|
12
|
-
loading?: boolean
|
|
15
|
+
size?: 'sm' | 'md' | 'lg' | 'xl'
|
|
16
|
+
loading?: boolean,
|
|
17
|
+
isIconButton?: boolean
|
|
13
18
|
}
|
|
14
19
|
|
|
15
20
|
export interface AllyProps {
|
|
@@ -17,23 +22,15 @@ export interface AllyProps {
|
|
|
17
22
|
}
|
|
18
23
|
|
|
19
24
|
export interface ButtonBaseProps extends ButtonSharedProps {
|
|
20
|
-
/** Design variant */
|
|
21
|
-
variant?: 'primary' | 'secondary' | 'brand' | 'staticWhite'
|
|
22
25
|
text?: string
|
|
23
|
-
emphasis?: 'default' | 'elevated' | 'outline' | 'transparent'
|
|
24
|
-
/** Button will be rounded */
|
|
25
|
-
rounded?: boolean
|
|
26
26
|
/** Button will be full width on both desktop and mobile */
|
|
27
27
|
fullWidth?: boolean
|
|
28
28
|
/** Button will only full width on mobile */
|
|
29
29
|
mobileFullWidth?: boolean
|
|
30
30
|
iconPosition?: 'none' | 'left' | 'right'
|
|
31
|
-
/** add, arrow_back, arrow_forward etc | | For all available icons see: https://designsystem.dn.se/?path=/story/foundations-icons--all-icons */
|
|
32
|
-
iconName?: DsIcon
|
|
33
31
|
type?: 'button' | 'submit'
|
|
34
32
|
/** If href is set the button will be rendered as an a-tag */
|
|
35
33
|
href?: string
|
|
36
|
-
isIconButton?: boolean
|
|
37
34
|
a11y?: AllyProps
|
|
38
35
|
selected?: boolean
|
|
39
36
|
isToggle?: boolean
|
|
@@ -60,28 +57,40 @@ export interface ToggleWrapperProps {
|
|
|
60
57
|
offChild?: any
|
|
61
58
|
}
|
|
62
59
|
|
|
63
|
-
export interface
|
|
60
|
+
export interface ButtonStandardProps
|
|
64
61
|
extends ButtonSharedProps,
|
|
65
62
|
Pick<
|
|
66
63
|
ButtonBaseProps,
|
|
67
|
-
'text' | '
|
|
64
|
+
'text' | 'fullWidth' | 'mobileFullWidth' | 'iconPosition' | 'type' | 'href'
|
|
68
65
|
> {
|
|
69
|
-
text: string
|
|
66
|
+
text: string
|
|
70
67
|
}
|
|
71
68
|
|
|
72
|
-
export interface
|
|
69
|
+
export interface ButtonIconProps
|
|
73
70
|
extends ButtonSharedProps,
|
|
74
|
-
Pick<
|
|
75
|
-
|
|
76
|
-
|
|
71
|
+
Pick<
|
|
72
|
+
ButtonBaseProps,
|
|
73
|
+
'text' | 'fullWidth' | 'mobileFullWidth' | 'iconPosition' | 'type' | 'href'> {
|
|
74
|
+
iconName: DsIcon
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export type ButtonProps =
|
|
78
|
+
| ({ isIconButton: true } & ButtonIconProps)
|
|
79
|
+
| ({ isIconButton?: false } & ButtonStandardProps)
|
|
80
|
+
|
|
81
|
+
export interface ButtonToggleStandardProps
|
|
82
|
+
extends ButtonSharedProps,
|
|
83
|
+
Pick<ButtonBaseProps, 'selected' | 'text' | 'selectedText' | 'selectedIconName' | 'fullWidth' | 'mobileFullWidth'> {
|
|
84
|
+
selectedText: string
|
|
77
85
|
}
|
|
78
|
-
export interface IconButtonProps extends ButtonSharedProps, Pick<ButtonBaseProps, 'iconName' | 'emphasis' | 'rounded' | 'href'> {
|
|
79
|
-
a11y?: object;
|
|
80
|
-
variant?: 'primary' | 'secondary' | 'brand'
|
|
81
|
-
}
|
|
82
86
|
|
|
87
|
+
export interface ButtonToggleIconProps
|
|
88
|
+
extends ButtonSharedProps,
|
|
89
|
+
Pick<ButtonBaseProps, 'selected' | 'text' | 'selectedText' | 'fullWidth' | 'mobileFullWidth'> {
|
|
90
|
+
iconName: DsIcon
|
|
91
|
+
selectedIconName: DsIcon
|
|
92
|
+
}
|
|
83
93
|
|
|
84
|
-
export
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
}
|
|
94
|
+
export type ButtonToggleProps =
|
|
95
|
+
| ({ isIconButton?: false } & ButtonToggleStandardProps)
|
|
96
|
+
| ({ isIconButton: true } & ButtonToggleIconProps)
|
|
@@ -26,15 +26,10 @@
|
|
|
26
26
|
{%- set attributes = getAttributes(params.attributes) %}
|
|
27
27
|
{%- set ariaLabel = 'aria-label="' + text + '"' if params.text and not params.attributes["aria-label"] else "" %}
|
|
28
28
|
{%- set buttonVariant = params.variant | default("primary") %}
|
|
29
|
-
{%- set emphasis = params.emphasis | default("default") %}
|
|
30
29
|
|
|
31
|
-
{% if params.variant == "staticWhite" %}
|
|
32
|
-
{% if emphasis == "transparent" or emphasis == "outline" %}
|
|
33
|
-
{%- set spinnerVariant = "staticWhite" %}
|
|
34
|
-
{% else %}
|
|
30
|
+
{% if params.variant == "staticWhite" or params.variant == "transparent" %}
|
|
35
31
|
{%- set spinnerVariant = "staticBlack" %}
|
|
36
|
-
|
|
37
|
-
{% elif emphasis == "transparent" or emphasis == "outline" or params.variant == "secondary" %}
|
|
32
|
+
{% elif params.variant == "secondaryFilled" or params.variant == "secondaryOutline" %}
|
|
38
33
|
{%- set spinnerVariant = "primary" %}
|
|
39
34
|
{% else %}
|
|
40
35
|
{%- set spinnerVariant = "secondary" %}
|
|
@@ -44,21 +39,19 @@
|
|
|
44
39
|
{{ Spinner({ size: 'small', variant: spinnerVariant, forcePx: params.forcePx, attributes: { "aria-hidden": "true" } }) }}
|
|
45
40
|
{% endset %}
|
|
46
41
|
|
|
47
|
-
{%- if params.iconName and ((params.iconPosition and params.iconPosition != "none") or params.
|
|
42
|
+
{%- if params.iconName and ((params.iconPosition and params.iconPosition != "none") or params.isIconButton == true) %}
|
|
48
43
|
{% set iconSvg = IconUse({ icon: params.iconName, attributes: { "aria-hidden": "true" } }) %}
|
|
49
44
|
{% endif %}
|
|
50
45
|
|
|
51
46
|
{%- set classes = [
|
|
52
47
|
componentClassName,
|
|
53
48
|
classNamePrefix + buttonVariant,
|
|
54
|
-
classNamePrefix + emphasis,
|
|
55
49
|
classNamePrefix + "selected" if params.selected,
|
|
56
|
-
classNamePrefix + params.size if params.size else classNamePrefix + "
|
|
50
|
+
classNamePrefix + params.size if params.size else classNamePrefix + "lg",
|
|
57
51
|
classNamePrefix + "full-width" if params.fullWidth,
|
|
58
52
|
classNamePrefix + "mobile-full-width" if params.mobile and params.mobile.fullWidth,
|
|
59
|
-
classNamePrefix + "icon-" + params.iconPosition if iconSvg and not params.
|
|
60
|
-
classNamePrefix + "icon-only" if params.
|
|
61
|
-
classNamePrefix + "rounded" if params.rounded,
|
|
53
|
+
classNamePrefix + "icon-" + params.iconPosition if iconSvg and not params.isIconButton,
|
|
54
|
+
classNamePrefix + "icon-only" if params.isIconButton,
|
|
62
55
|
classNamePrefix + "toggle" if params.isToggle,
|
|
63
56
|
classNamePrefix + "selected" if params.isToggle and params.selected,
|
|
64
57
|
"ds-loading" if params.loading,
|
|
@@ -68,7 +61,7 @@
|
|
|
68
61
|
|
|
69
62
|
{%- if params.isToggle %}
|
|
70
63
|
{% call ToggleWrapper({ ariaLabel: ariaLabel, selected: params.selected, classes: classes, attributes: attributes, disabled: params.disabled, loadingHtml: loadingHtml }) %}
|
|
71
|
-
{%- if params.
|
|
64
|
+
{%- if params.isIconButton %}
|
|
72
65
|
<span class="ds-btn__off" aria-hidden="true">{{ IconUse({ icon: params.iconName }) }}</span>
|
|
73
66
|
<span class="ds-btn__on" aria-hidden="true">{{ IconUse({ icon: params.selectedIconName }) }}</span>
|
|
74
67
|
{% else %}
|
|
@@ -82,7 +75,7 @@
|
|
|
82
75
|
{% if params.href %}
|
|
83
76
|
{% set loadingHtml = null %}
|
|
84
77
|
{% endif %}
|
|
85
|
-
{% set buttonParams = { isIconButton: params.
|
|
78
|
+
{% set buttonParams = { isIconButton: params.isIconButton, a11y: params.a11y, text: text, iconSvg: iconSvg, loadingHtml: loadingHtml , attributes: params.attributes } %}
|
|
86
79
|
{%- if params.href %}
|
|
87
80
|
<a href="{{ params.href | default('#', true) }}" {{ ariaLabel | safe }} class="{{ classes }}" {{- attributes | safe }}>
|
|
88
81
|
{{ InnerButton(buttonParams) }}
|
|
@@ -19,7 +19,7 @@ $ds-btn-outlined__border-width: ds-border-width(xxs);
|
|
|
19
19
|
|
|
20
20
|
cursor: pointer;
|
|
21
21
|
border: $ds-btn-outlined__border-width solid var(--ds-btn__border-color);
|
|
22
|
-
border-radius:
|
|
22
|
+
border-radius: 100px;
|
|
23
23
|
position: relative;
|
|
24
24
|
background-color: var(--ds-btn__background-color);
|
|
25
25
|
color: var(--ds-btn__color);
|
|
@@ -32,66 +32,35 @@ $ds-btn-outlined__border-width: ds-border-width(xxs);
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
&.ds-btn--primary {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
--ds-btn__background-color: #{$ds-color-surface-primaryinvert};
|
|
38
|
-
--ds-btn__color: #{$ds-color-text-primaryinvert};
|
|
39
|
-
}
|
|
40
|
-
&.ds-btn--outline {
|
|
41
|
-
--ds-btn__border-color: #{$ds-color-border-primary-strongest};
|
|
42
|
-
--ds-btn__color: #{$ds-color-text-primary};
|
|
43
|
-
}
|
|
44
|
-
&.ds-btn--transparent {
|
|
45
|
-
--ds-btn__color: #{$ds-color-text-primary};
|
|
46
|
-
}
|
|
35
|
+
--ds-btn__background-color: #{$ds-color-brand-600};
|
|
36
|
+
--ds-btn__color: #{$ds-color-text-on-brand};
|
|
47
37
|
}
|
|
48
38
|
|
|
49
|
-
&.ds-btn--
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
--ds-btn__background-color: #{$ds-color-surface-primary-raised-strong};
|
|
53
|
-
--ds-btn__color: #{$ds-color-text-primary};
|
|
54
|
-
}
|
|
55
|
-
&.ds-btn--outline {
|
|
56
|
-
--ds-btn__border-color: #{$ds-color-border-primary-strong};
|
|
57
|
-
--ds-btn__color: #{$ds-color-text-primary};
|
|
58
|
-
}
|
|
59
|
-
&.ds-btn--transparent {
|
|
60
|
-
--ds-btn__color: #{$ds-color-text-primary};
|
|
61
|
-
}
|
|
39
|
+
&.ds-btn--primaryBlack {
|
|
40
|
+
--ds-btn__background-color: #{$ds-color-surface-primaryinvert};
|
|
41
|
+
--ds-btn__color: #{$ds-color-text-primaryinvert};
|
|
62
42
|
}
|
|
63
43
|
|
|
64
|
-
&.ds-btn--
|
|
65
|
-
--ds-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
--ds-btn__color: #{$ds-color-text-brand};
|
|
74
|
-
}
|
|
75
|
-
&.ds-btn--transparent {
|
|
76
|
-
--ds-btn__color: #{$ds-color-text-brand};
|
|
77
|
-
}
|
|
44
|
+
&.ds-btn--secondaryFilled {
|
|
45
|
+
--ds-btn__background-color: #{$ds-color-surface-primary-raised-strong};
|
|
46
|
+
--ds-btn__color: #{$ds-color-text-primary};
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
&.ds-btn--secondaryOutline {
|
|
50
|
+
--ds-btn__background-color: transparent;
|
|
51
|
+
--ds-btn__color: #{$ds-color-text-primary};
|
|
52
|
+
--ds-btn__border-color: #{$ds-color-border-primary-strong};
|
|
78
53
|
}
|
|
79
54
|
|
|
80
55
|
&.ds-btn--staticWhite {
|
|
81
56
|
--ds-btn__outline-color: #{$ds-color-neutral-white};
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
--ds-btn__border-color: #{$ds-color-neutral-white};
|
|
90
|
-
--ds-btn__color: #{$ds-color-neutral-white};
|
|
91
|
-
}
|
|
92
|
-
&.ds-btn--transparent {
|
|
93
|
-
--ds-btn__color: #{$ds-color-neutral-white};
|
|
94
|
-
}
|
|
57
|
+
--ds-btn__background-color: #{$ds-color-neutral-white};
|
|
58
|
+
--ds-btn__color: #{$ds-color-neutral-black};
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
&.ds-btn--transparent {
|
|
62
|
+
--ds-btn__color: #{$ds-color-text-primary};
|
|
63
|
+
--ds-btn__background-color: transparent;
|
|
95
64
|
}
|
|
96
65
|
|
|
97
66
|
&.ds-btn--toggle.ds-btn--selected:not(.ds-btn--icon-only) {
|
|
@@ -100,83 +69,87 @@ $ds-btn-outlined__border-width: ds-border-width(xxs);
|
|
|
100
69
|
--ds-btn__border-color: #{$ds-color-border-primary-strongest};
|
|
101
70
|
--ds-btn__outline-color: #{$ds-color-border-primary-strongest};
|
|
102
71
|
}
|
|
103
|
-
&.ds-btn--transparent {
|
|
104
|
-
--ds-btn__background-color: transparent;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
&.ds-btn--rounded {
|
|
108
|
-
border-radius: 100px;
|
|
109
|
-
}
|
|
110
72
|
|
|
111
|
-
&.ds-btn--
|
|
112
|
-
box-shadow: ds-shadow-get-box-shadow($ds-shadow-elevation-md);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
&.ds-btn--small {
|
|
73
|
+
&.ds-btn--sm {
|
|
116
74
|
--ds-btn__icon-size: #{ds-px-to-rem(20px)};
|
|
117
75
|
--ds-btn__icon-padding: #{_btn-brdr(ds-spacing($ds-s-050), true)};
|
|
76
|
+
--ds-btn__icon-only-padding: #{ds-px-to-rem(5px)};
|
|
118
77
|
padding: _btn-brdr(ds-spacing($ds-s-025), true) _btn-brdr(ds-spacing($ds-s-075), true);
|
|
119
|
-
@include ds-typography($variable: $ds-typography-functional-body-
|
|
78
|
+
@include ds-typography($variable: $ds-typography-functional-body-md, $fontWeight: $ds-fontweight-medium);
|
|
120
79
|
@at-root .ds-force-px#{&} {
|
|
121
80
|
--ds-btn__icon-size: 20px;
|
|
122
81
|
--ds-btn__icon-padding: #{_btn-brdr(ds-spacing($ds-s-050))};
|
|
82
|
+
--ds-btn__icon-only-padding: 5px;
|
|
123
83
|
padding: _btn-brdr(ds-spacing($ds-s-025)) _btn-brdr(ds-spacing($ds-s-075));
|
|
124
84
|
@include ds-typography(
|
|
125
|
-
$variable: $ds-typography-functional-body-
|
|
126
|
-
$fontWeight: $ds-fontweight-
|
|
85
|
+
$variable: $ds-typography-functional-body-md,
|
|
86
|
+
$fontWeight: $ds-fontweight-medium,
|
|
127
87
|
$forcePx: true
|
|
128
88
|
);
|
|
129
89
|
}
|
|
130
90
|
}
|
|
131
91
|
|
|
132
|
-
&.ds-btn--
|
|
92
|
+
&.ds-btn--md {
|
|
133
93
|
--ds-btn__icon-padding: #{_btn-brdr(ds-spacing($ds-s-100), true)};
|
|
94
|
+
--ds-btn__icon-only-padding: #{_btn-brdr(ds-spacing($ds-s-050), true)};
|
|
134
95
|
padding: _btn-brdr(ds-spacing($ds-s-050), true) _btn-brdr(ds-spacing($ds-s-125), true);
|
|
135
|
-
@include ds-typography($variable: $ds-typography-functional-body-md, $fontWeight: $ds-fontweight-
|
|
96
|
+
@include ds-typography($variable: $ds-typography-functional-body-md, $fontWeight: $ds-fontweight-medium);
|
|
136
97
|
@at-root .ds-force-px#{&} {
|
|
137
98
|
--ds-btn__icon-padding: #{_btn-brdr(ds-spacing($ds-s-100))};
|
|
99
|
+
--ds-btn__icon-only-padding: #{_btn-brdr(ds-spacing($ds-s-050))};
|
|
138
100
|
padding: _btn-brdr(ds-spacing($ds-s-050)) _btn-brdr(ds-spacing($ds-s-125));
|
|
139
101
|
@include ds-typography(
|
|
140
102
|
$variable: $ds-typography-functional-body-md,
|
|
141
|
-
$fontWeight: $ds-fontweight-
|
|
103
|
+
$fontWeight: $ds-fontweight-medium,
|
|
142
104
|
$forcePx: true
|
|
143
105
|
);
|
|
144
106
|
}
|
|
145
107
|
}
|
|
146
108
|
|
|
147
|
-
&.ds-btn--
|
|
109
|
+
&.ds-btn--lg {
|
|
148
110
|
--ds-btn__icon-padding: #{_btn-brdr(ds-spacing($ds-s-125), true)};
|
|
111
|
+
--ds-btn__icon-only-padding: #{_btn-brdr(ds-spacing($ds-s-075), true)};
|
|
149
112
|
padding: _btn-brdr(ds-spacing($ds-s-075), true) _btn-brdr(ds-spacing($ds-s-150), true);
|
|
150
|
-
@include ds-typography($variable: $ds-typography-functional-body-md, $fontWeight: $ds-fontweight-
|
|
113
|
+
@include ds-typography($variable: $ds-typography-functional-body-md, $fontWeight: $ds-fontweight-medium);
|
|
151
114
|
|
|
152
115
|
@at-root .ds-force-px#{&} {
|
|
153
116
|
--ds-btn__icon-padding: #{_btn-brdr(ds-spacing($ds-s-125))};
|
|
117
|
+
--ds-btn__icon-only-padding: #{_btn-brdr(ds-spacing($ds-s-075))};
|
|
154
118
|
padding: _btn-brdr(ds-spacing($ds-s-075)) _btn-brdr(ds-spacing($ds-s-150));
|
|
155
119
|
@include ds-typography(
|
|
156
120
|
$variable: $ds-typography-functional-body-md,
|
|
157
|
-
$fontWeight: $ds-fontweight-
|
|
121
|
+
$fontWeight: $ds-fontweight-medium,
|
|
158
122
|
$forcePx: true
|
|
159
123
|
);
|
|
160
124
|
}
|
|
161
125
|
}
|
|
162
126
|
|
|
163
|
-
&.ds-btn--
|
|
164
|
-
--ds-btn__icon-size: #{ds-px-to-rem(
|
|
127
|
+
&.ds-btn--xl {
|
|
128
|
+
--ds-btn__icon-size: #{ds-px-to-rem(24px)};
|
|
165
129
|
--ds-btn__icon-padding: #{_btn-brdr(ds-spacing($ds-s-200), true) - ds-px-to-rem(4px)};
|
|
166
|
-
|
|
167
|
-
|
|
130
|
+
--ds-btn__icon-only-padding: #{_btn-brdr(ds-spacing($ds-s-100), true)};
|
|
131
|
+
padding: _btn-brdr(ds-spacing($ds-s-100), true) _btn-brdr(ds-spacing($ds-s-200), true);
|
|
132
|
+
@include ds-typography($variable: $ds-typography-functional-body-md, $fontWeight: $ds-fontweight-medium);
|
|
168
133
|
@at-root .ds-force-px#{&} {
|
|
169
|
-
--ds-btn__icon-size:
|
|
134
|
+
--ds-btn__icon-size: 24px;
|
|
170
135
|
--ds-btn__icon-padding: #{_btn-brdr(ds-spacing($ds-s-200)) - 4px};
|
|
171
|
-
|
|
136
|
+
--ds-btn__icon-only-padding: #{_btn-brdr(ds-spacing($ds-s-200))};
|
|
137
|
+
padding: _btn-brdr(ds-spacing($ds-s-100)) _btn-brdr(ds-spacing($ds-s-200));
|
|
172
138
|
@include ds-typography(
|
|
173
|
-
$variable: $ds-typography-functional-body-
|
|
174
|
-
$fontWeight: $ds-fontweight-
|
|
139
|
+
$variable: $ds-typography-functional-body-md,
|
|
140
|
+
$fontWeight: $ds-fontweight-medium,
|
|
175
141
|
$forcePx: true
|
|
176
142
|
);
|
|
177
143
|
}
|
|
178
144
|
}
|
|
179
145
|
|
|
146
|
+
&.ds-btn--icon-only {
|
|
147
|
+
padding: var(--ds-btn__icon-only-padding);
|
|
148
|
+
@at-root .ds-force-px#{&} {
|
|
149
|
+
padding: var(--ds-btn__icon-only-padding);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
180
153
|
span {
|
|
181
154
|
pointer-events: none;
|
|
182
155
|
}
|
|
@@ -267,7 +240,7 @@ $ds-btn-outlined__border-width: ds-border-width(xxs);
|
|
|
267
240
|
margin: ds-spacing(0 0 0 $ds-s-050);
|
|
268
241
|
}
|
|
269
242
|
}
|
|
270
|
-
&.ds-btn--
|
|
243
|
+
&.ds-btn--sm .ds-icon {
|
|
271
244
|
margin: ds-spacing(0 0 0 $ds-s-025, rem);
|
|
272
245
|
@at-root .ds-force-px#{&} {
|
|
273
246
|
margin: ds-spacing(0 0 0 $ds-s-025);
|
|
@@ -281,7 +254,7 @@ $ds-btn-outlined__border-width: ds-border-width(xxs);
|
|
|
281
254
|
.ds-icon {
|
|
282
255
|
margin: ds-spacing(0 $ds-s-050 0 0, rem);
|
|
283
256
|
}
|
|
284
|
-
&.ds-btn--
|
|
257
|
+
&.ds-btn--sm .ds-icon {
|
|
285
258
|
margin: ds-spacing(0 $ds-s-025 0 0, rem);
|
|
286
259
|
}
|
|
287
260
|
&.ds-force-px {
|
|
@@ -289,7 +262,7 @@ $ds-btn-outlined__border-width: ds-border-width(xxs);
|
|
|
289
262
|
.ds-icon {
|
|
290
263
|
margin: ds-spacing(0 $ds-s-050 0 0);
|
|
291
264
|
}
|
|
292
|
-
&.ds-btn--
|
|
265
|
+
&.ds-btn--sm .ds-icon {
|
|
293
266
|
margin: ds-spacing(0 $ds-s-025 0 0);
|
|
294
267
|
}
|
|
295
268
|
}
|
|
@@ -16,24 +16,27 @@ The component will not include styling by itself. Make sure to include the right
|
|
|
16
16
|
|
|
17
17
|
| Name | Description | Default |
|
|
18
18
|
|:--- | :--- | :--- |
|
|
19
|
-
|
|
|
20
|
-
|
|
|
19
|
+
| isIconButton | boolean | false |
|
|
20
|
+
| selectedText | string | \- |
|
|
21
|
+
| variant | Design variant<br />"primary", "staticWhite", "primaryBlack", "secondaryFilled", "secondaryOutline", "transparent" | "primary" |
|
|
21
22
|
| disabled | Note: only works on button-tag, not on a-tag<br />boolean | false |
|
|
23
|
+
| iconName | add, arrow\_back, arrow\_forward etc | | For all available icons see: [https://designsystem.dn.se/?path=/story/foundations-icons--all-icons](https://designsystem.dn.se/?path=/story/foundations-icons--all-icons)<br />"add", "arrow\_back", "arrow\_forward", "arrow\_outward", "arrow\_upward", "autoplay", "bookmark-filled", "bookmarked" | \- |
|
|
22
24
|
| classNames | string | \- |
|
|
23
25
|
| attributes | Ex. { target: "\_blank", "data-test": "lorem ipsum" }<br />{ \[key: string\]: string; } | { } |
|
|
24
26
|
| forcePx | Fixed pixel value is used for typography to prevent scaling based on html font-size<br />boolean | false |
|
|
25
|
-
| size | "
|
|
27
|
+
| size | "sm", "md", "lg", "xl" | "md" |
|
|
26
28
|
| loading | boolean | false |
|
|
27
29
|
| text | string | \- |
|
|
28
30
|
| selected | boolean | false |
|
|
31
|
+
| selectedIconName | "add", "arrow\_back", "arrow\_forward", "arrow\_outward", "arrow\_upward", "autoplay", "bookmark-filled", "bookmarked" | \- |
|
|
29
32
|
| fullWidth | Button will be full width on both desktop and mobile<br />boolean | false |
|
|
30
33
|
| mobileFullWidth | Button will only full width on mobile<br />boolean | false |
|
|
31
34
|
|
|
32
35
|
```jsx
|
|
33
36
|
<ButtonToggle
|
|
34
37
|
selectedText="Följer"
|
|
35
|
-
size="
|
|
38
|
+
size="lg"
|
|
36
39
|
text="Följ"
|
|
37
|
-
variant="
|
|
40
|
+
variant="primary"
|
|
38
41
|
/>
|
|
39
42
|
```
|
|
@@ -12,6 +12,9 @@
|
|
|
12
12
|
size: params.size,
|
|
13
13
|
fullWidth: params.fullWidth,
|
|
14
14
|
mobile: params.mobile,
|
|
15
|
+
isIconButton: params.isIconButton,
|
|
16
|
+
iconName: params.iconName,
|
|
17
|
+
selectedIconName: params.selectedIconName,
|
|
15
18
|
loading: params.loading,
|
|
16
19
|
forcePx: params.forcePx,
|
|
17
20
|
classNames: params.classNames,
|
|
@@ -8,7 +8,7 @@ The component will not include styling by itself. Make sure to include the right
|
|
|
8
8
|
|
|
9
9
|
| Name | Description | Default |
|
|
10
10
|
|:--- | :--- | :--- |
|
|
11
|
-
| variant | "
|
|
11
|
+
| variant | "soft", "medium", "hard" | "soft" |
|
|
12
12
|
| classNames | string | \- |
|
|
13
13
|
| attributes | object | \- |
|
|
14
14
|
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
{% if params.brandButton %}
|
|
36
36
|
{{ Button({
|
|
37
37
|
text: params.brandButton.text,
|
|
38
|
-
variant: "
|
|
38
|
+
variant: "primary",
|
|
39
39
|
href: params.brandButton.href,
|
|
40
40
|
classNames: params.brandButton.classNames,
|
|
41
41
|
attributes: params.brandButton.attributes,
|
|
@@ -47,8 +47,7 @@
|
|
|
47
47
|
{% if params.primaryButton %}
|
|
48
48
|
{{ Button({
|
|
49
49
|
text: params.primaryButton.text,
|
|
50
|
-
variant: "
|
|
51
|
-
emphasis: "outline",
|
|
50
|
+
variant: "secondaryOutline",
|
|
52
51
|
href: params.primaryButton.href,
|
|
53
52
|
classNames: params.primaryButton.classNames,
|
|
54
53
|
attributes: params.primaryButton.attributes,
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
<div class="{{ componentClassName + '__show-more'}}">
|
|
30
30
|
{{ Button({
|
|
31
31
|
text: 'Visa mer',
|
|
32
|
-
variant: '
|
|
33
|
-
size: '
|
|
32
|
+
variant: 'secondaryFilled',
|
|
33
|
+
size: 'md',
|
|
34
34
|
iconPosition: 'right',
|
|
35
35
|
iconName: 'expand_more',
|
|
36
36
|
classNames: 'ds-factbox__expand-more',
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
})}}
|
|
41
41
|
{{ Button({
|
|
42
42
|
text: 'Visa mindre',
|
|
43
|
-
variant: '
|
|
44
|
-
size: '
|
|
43
|
+
variant: 'secondaryFilled',
|
|
44
|
+
size: 'md',
|
|
45
45
|
iconPosition: 'right',
|
|
46
46
|
iconName: 'expand_less',
|
|
47
47
|
classNames: 'ds-factbox__expand-less',
|