@bonniernews/dn-design-system-web 28.0.1-beta.0 → 28.0.1
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 +17 -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 +1 -0
- package/components/button/README.md +8 -6
- package/components/button/button-types.ts +25 -34
- package/components/button/button.njk +15 -8
- package/components/button/button.scss +85 -58
- package/components/button-toggle/README.md +5 -8
- package/components/button-toggle/button-toggle.njk +0 -3
- package/components/divider/README.md +1 -1
- package/components/empty-state/empty-state.njk +3 -2
- package/components/factbox/factbox.njk +4 -4
- package/components/group-header/group-header.njk +10 -10
- package/components/group-header/group-header.scss +2 -1
- package/components/icon-button/README-NJK.md +47 -0
- package/components/icon-button/README-UXD.md +44 -0
- package/components/icon-button/README.md +31 -0
- package/components/icon-button/icon-button.njk +22 -0
- package/components/icon-button/icon-button.scss +32 -0
- package/components/icon-button-toggle/README-NJK.md +53 -0
- package/components/icon-button-toggle/README-UXD.md +0 -0
- package/components/icon-button-toggle/README.md +38 -0
- package/components/icon-button-toggle/icon-button-toggle.njk +18 -0
- package/components/icon-button-toggle/icon-button-toggle.scss +1 -0
- package/components/list-item/list-item-types.ts +3 -3
- package/components/list-item/list-item.njk +4 -4
- package/components/modal/modal.njk +8 -10
- package/components/modal/modal.scss +4 -3
- package/components/pagination/pagination.njk +1 -0
- 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 +3 -5
- package/components/text-input/text-input.scss +3 -2
- package/components/tooltip/tooltip.njk +4 -4
- package/components/tooltip/tooltip.scss +1 -0
- package/foundations/icons/icon.njk +15 -0
- package/foundations/icons/sprite.njk +1 -1
- package/foundations/icons/sprite.svg +1 -1
- package/foundations/icons/svg/auto-imported/autoplay.svg +3 -0
- package/foundations/icons/svg/auto-imported/notifications_off.svg +3 -0
- package/foundations/icons/svg/auto-imported/settings.svg +3 -0
- package/package.json +1 -1
- package/preact/components/buddy-menu/buddy-menu.js +69 -24
- 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 +12 -4
- package/preact/components/button/button-base.js.map +2 -2
- package/preact/components/button/button-types.d.ts +19 -24
- package/preact/components/button/button.d.ts +1 -1
- package/preact/components/button/button.js +17 -7
- 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 +14 -11
- package/preact/components/button-toggle/button-toggle.js.map +2 -2
- package/preact/components/checkbox/checkbox.js.map +2 -2
- package/preact/components/icon-button/icon-button.d.ts +10 -0
- package/preact/components/icon-button/icon-button.js +198 -0
- package/preact/components/icon-button/icon-button.js.map +7 -0
- package/preact/components/icon-button-toggle/icon-button-toggle.d.ts +18 -0
- package/preact/components/icon-button-toggle/icon-button-toggle.js +200 -0
- package/preact/components/icon-button-toggle/icon-button-toggle.js.map +7 -0
- package/preact/components/icon-sprite/icon-sprite.js +3 -0
- package/preact/components/icon-sprite/icon-sprite.js.map +2 -2
- package/preact/components/icon-with-wrapper/icon-with-wrapper.js.map +2 -2
- package/preact/components/list-item/list-item-types.d.ts +3 -3
- package/preact/components/list-item/list-item.js +16 -13
- package/preact/components/list-item/list-item.js.map +2 -2
- package/preact/components/pictogram/pictogram.js.map +2 -2
- package/preact/components/radio-button/radio-button.js.map +2 -2
- package/preact/components/text-input/text-input.js +29 -28
- package/preact/components/text-input/text-input.js.map +3 -3
- package/types-lib/ds-icon.d.ts +3 -0
- package/variables/icon-list.json +3 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,23 @@ All changes to @bonniernews/dn-design-system-web will be documented in this file
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
+
## [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
|
+
|
|
9
|
+
|
|
10
|
+
### Bug Fixes
|
|
11
|
+
|
|
12
|
+
* **web:** remove screenshots on update ([#1608](https://github.com/BonnierNews/dn-design-system/issues/1608)) ([363d51b](https://github.com/BonnierNews/dn-design-system/commit/363d51b6dd2ec71f6f81efb385709713048c0fb7))
|
|
13
|
+
* **web:** run github actions after readme update ([#1609](https://github.com/BonnierNews/dn-design-system/issues/1609)) ([6e7de34](https://github.com/BonnierNews/dn-design-system/commit/6e7de342cf66e4e22434e6dbf3ce22f1d2d84f7e))
|
|
14
|
+
* **web:** update web snapshots after color adjustments ([#1607](https://github.com/BonnierNews/dn-design-system/issues/1607)) ([9c7a347](https://github.com/BonnierNews/dn-design-system/commit/9c7a34707a71bb896824a42df81cd041e2dcc5da))
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Maintenance
|
|
18
|
+
|
|
19
|
+
* **deps-dev:** bump style-dictionary from 4.3.0 to 4.3.2 ([#1585](https://github.com/BonnierNews/dn-design-system/issues/1585)) ([06c2029](https://github.com/BonnierNews/dn-design-system/commit/06c2029191c8c2e0aa80b742cab087e19049c801))
|
|
20
|
+
* **deps:** bump store2 from 2.14.2 to 2.14.4 ([#1595](https://github.com/BonnierNews/dn-design-system/issues/1595)) ([97b7e84](https://github.com/BonnierNews/dn-design-system/commit/97b7e84f354add4b60560008769471352a642115))
|
|
21
|
+
* prerelease packages ([3c0cc37](https://github.com/BonnierNews/dn-design-system/commit/3c0cc3740e881ef01fd9924d86c5f089fe7116cc))
|
|
22
|
+
* update icons ([#1612](https://github.com/BonnierNews/dn-design-system/issues/1612)) ([fe3eeb5](https://github.com/BonnierNews/dn-design-system/commit/fe3eeb5e8fa0369ad596f8a7bf085411daced1bd))
|
|
23
|
+
|
|
7
24
|
## [28.0.0](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@27.0.1...@bonniernews/dn-design-system-web@28.0.0) (2025-02-10)
|
|
8
25
|
|
|
9
26
|
|
|
@@ -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--secondary ds-btn--default ds-btn--medium 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,5 +1,6 @@
|
|
|
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 %}
|
|
3
4
|
{% from '@bonniernews/dn-design-system-web/components/button/button.njk' import Button %}
|
|
4
5
|
|
|
5
6
|
{% macro BuddyMenu(params) %}
|
|
@@ -17,13 +18,12 @@
|
|
|
17
18
|
<div class="{{ componentClassName + '__inner'}}">
|
|
18
19
|
<div class="ds-buddy-menu__scrollable-container">
|
|
19
20
|
<div class="ds-buddy-menu__content">
|
|
20
|
-
{{
|
|
21
|
+
{{ IconButton({
|
|
21
22
|
variant: "transparent",
|
|
22
|
-
size: "
|
|
23
|
+
size: "small",
|
|
23
24
|
iconName: "close",
|
|
24
25
|
classNames: "ds-buddy-menu__close",
|
|
25
|
-
forcePx: params.forcePx
|
|
26
|
-
isIconButton: true
|
|
26
|
+
forcePx: params.forcePx
|
|
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: "primary",
|
|
50
50
|
fullWidth: true,
|
|
51
51
|
href: params.myAccountUrl | default("#"),
|
|
52
52
|
attributes: { "data-hide-promo" : "" },
|
|
@@ -9,25 +9,27 @@ Button
|
|
|
9
9
|
|
|
10
10
|
| Name | Description | Default |
|
|
11
11
|
|:--- | :--- | :--- |
|
|
12
|
-
|
|
|
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", "bookmark-filled", "bookmarked", "campaign" | \- |
|
|
14
|
-
| variant | Design variant<br />"primary", "staticWhite", "primaryBlack", "secondaryFilled", "secondaryOutline", "transparent" | "primary" |
|
|
12
|
+
| text\* | string | \- |
|
|
15
13
|
| disabled | Note: only works on button-tag, not on a-tag<br />boolean | false |
|
|
16
14
|
| classNames | string | \- |
|
|
17
15
|
| attributes | Ex. { target: "\_blank", "data-test": "lorem ipsum" }<br />{ \[key: string\]: string; } | \- |
|
|
18
16
|
| forcePx | Fixed pixel value is used for typography to prevent scaling based on html font-size<br />boolean | false |
|
|
19
|
-
| size | "
|
|
17
|
+
| size | "large", "small", "medium", "xlarge" | "medium" |
|
|
20
18
|
| loading | boolean | false |
|
|
21
|
-
|
|
|
19
|
+
| 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", "bookmark-filled", "bookmarked", "campaign" | \- |
|
|
20
|
+
| variant | Design variant<br />"brand", "secondary", "primary", "staticWhite" | "primary" |
|
|
22
21
|
| fullWidth | Button will be full width on both desktop and mobile<br />boolean | false |
|
|
23
22
|
| mobileFullWidth | Button will only full width on mobile<br />boolean | false |
|
|
24
23
|
| href | If href is set the button will be rendered as an a-tag<br />string | \- |
|
|
25
24
|
| type | "button", "submit" | "button" |
|
|
25
|
+
| emphasis | "default", "elevated", "outline", "transparent" | "default" |
|
|
26
|
+
| rounded | Button will be rounded<br />boolean | false |
|
|
26
27
|
| iconPosition | "right", "none", "left" | "none" |
|
|
27
28
|
|
|
28
29
|
```jsx
|
|
29
30
|
<Button
|
|
30
|
-
|
|
31
|
+
emphasis="default"
|
|
32
|
+
size="medium"
|
|
31
33
|
text="Primary"
|
|
32
34
|
variant="primary"
|
|
33
35
|
/>
|
|
@@ -1,20 +1,15 @@
|
|
|
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'
|
|
6
4
|
/** Note: only works on button-tag, not on a-tag */
|
|
7
5
|
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
|
|
10
6
|
classNames?: string
|
|
11
7
|
/** Ex. { target: "_blank", "data-test": "lorem ipsum" } */
|
|
12
8
|
attributes?: { [key: string]: string }
|
|
13
9
|
/** Fixed pixel value is used for typography to prevent scaling based on html font-size */
|
|
14
10
|
forcePx?: boolean
|
|
15
|
-
size?: '
|
|
16
|
-
loading?: boolean
|
|
17
|
-
isIconButton?: boolean
|
|
11
|
+
size?: 'small' | 'medium' | 'large' | 'xlarge'
|
|
12
|
+
loading?: boolean
|
|
18
13
|
}
|
|
19
14
|
|
|
20
15
|
export interface AllyProps {
|
|
@@ -22,15 +17,23 @@ export interface AllyProps {
|
|
|
22
17
|
}
|
|
23
18
|
|
|
24
19
|
export interface ButtonBaseProps extends ButtonSharedProps {
|
|
20
|
+
/** Design variant */
|
|
21
|
+
variant?: 'primary' | 'secondary' | 'brand' | 'staticWhite'
|
|
25
22
|
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
|
|
31
33
|
type?: 'button' | 'submit'
|
|
32
34
|
/** If href is set the button will be rendered as an a-tag */
|
|
33
35
|
href?: string
|
|
36
|
+
isIconButton?: boolean
|
|
34
37
|
a11y?: AllyProps
|
|
35
38
|
selected?: boolean
|
|
36
39
|
isToggle?: boolean
|
|
@@ -57,40 +60,28 @@ export interface ToggleWrapperProps {
|
|
|
57
60
|
offChild?: any
|
|
58
61
|
}
|
|
59
62
|
|
|
60
|
-
export interface
|
|
63
|
+
export interface ButtonProps
|
|
61
64
|
extends ButtonSharedProps,
|
|
62
65
|
Pick<
|
|
63
66
|
ButtonBaseProps,
|
|
64
|
-
'text' | 'fullWidth' | 'mobileFullWidth' | 'iconPosition' | 'type' | 'href'
|
|
67
|
+
'text' | 'variant' | 'emphasis' | 'rounded' | 'fullWidth' | 'mobileFullWidth' | 'iconPosition' | 'iconName' | 'type' | 'href'
|
|
65
68
|
> {
|
|
66
|
-
text: string
|
|
69
|
+
text: string // set as required
|
|
67
70
|
}
|
|
68
71
|
|
|
69
|
-
|
|
72
|
+
export interface ButtonToggleProps
|
|
70
73
|
extends ButtonSharedProps,
|
|
71
|
-
Pick<
|
|
72
|
-
|
|
73
|
-
|
|
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
|
|
74
|
+
Pick<ButtonBaseProps, 'selected' | 'text' | 'selectedText' | 'fullWidth' | 'mobileFullWidth'> {
|
|
75
|
+
selectedText: string // set as required
|
|
76
|
+
variant?: 'primary' | 'secondary' | 'brand'
|
|
85
77
|
}
|
|
78
|
+
export interface IconButtonProps extends ButtonSharedProps, Pick<ButtonBaseProps, 'iconName' | 'emphasis' | 'rounded' | 'href'> {
|
|
79
|
+
a11y?: object;
|
|
80
|
+
variant?: 'primary' | 'secondary' | 'brand'
|
|
81
|
+
}
|
|
86
82
|
|
|
87
|
-
export interface ButtonToggleIconProps
|
|
88
|
-
extends ButtonSharedProps,
|
|
89
|
-
Pick<ButtonBaseProps, 'selected' | 'text' | 'selectedText' | 'fullWidth' | 'mobileFullWidth'> {
|
|
90
|
-
iconName: DsIcon
|
|
91
|
-
selectedIconName: DsIcon
|
|
92
|
-
}
|
|
93
83
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
84
|
+
export interface IconButtonToggleProps extends ButtonSharedProps, Pick<ButtonBaseProps, 'iconName' | 'emphasis' | 'selectedIconName'> {
|
|
85
|
+
selected?: boolean;
|
|
86
|
+
variant?: 'primary' | 'secondary' | 'brand'
|
|
87
|
+
}
|
|
@@ -26,10 +26,15 @@
|
|
|
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") %}
|
|
29
30
|
|
|
30
|
-
{% if params.variant == "staticWhite"
|
|
31
|
+
{% if params.variant == "staticWhite" %}
|
|
32
|
+
{% if emphasis == "transparent" or emphasis == "outline" %}
|
|
33
|
+
{%- set spinnerVariant = "staticWhite" %}
|
|
34
|
+
{% else %}
|
|
31
35
|
{%- set spinnerVariant = "staticBlack" %}
|
|
32
|
-
|
|
36
|
+
{% endif %}
|
|
37
|
+
{% elif emphasis == "transparent" or emphasis == "outline" or params.variant == "secondary" %}
|
|
33
38
|
{%- set spinnerVariant = "primary" %}
|
|
34
39
|
{% else %}
|
|
35
40
|
{%- set spinnerVariant = "secondary" %}
|
|
@@ -39,19 +44,21 @@
|
|
|
39
44
|
{{ Spinner({ size: 'small', variant: spinnerVariant, forcePx: params.forcePx, attributes: { "aria-hidden": "true" } }) }}
|
|
40
45
|
{% endset %}
|
|
41
46
|
|
|
42
|
-
{%- if params.iconName and ((params.iconPosition and params.iconPosition != "none") or params.
|
|
47
|
+
{%- if params.iconName and ((params.iconPosition and params.iconPosition != "none") or params.isIconBtn == true) %}
|
|
43
48
|
{% set iconSvg = IconUse({ icon: params.iconName, attributes: { "aria-hidden": "true" } }) %}
|
|
44
49
|
{% endif %}
|
|
45
50
|
|
|
46
51
|
{%- set classes = [
|
|
47
52
|
componentClassName,
|
|
48
53
|
classNamePrefix + buttonVariant,
|
|
54
|
+
classNamePrefix + emphasis,
|
|
49
55
|
classNamePrefix + "selected" if params.selected,
|
|
50
|
-
classNamePrefix + params.size if params.size else classNamePrefix + "
|
|
56
|
+
classNamePrefix + params.size if params.size else classNamePrefix + "large",
|
|
51
57
|
classNamePrefix + "full-width" if params.fullWidth,
|
|
52
58
|
classNamePrefix + "mobile-full-width" if params.mobile and params.mobile.fullWidth,
|
|
53
|
-
classNamePrefix + "icon-" + params.iconPosition if iconSvg and not params.
|
|
54
|
-
classNamePrefix + "icon-only" if params.
|
|
59
|
+
classNamePrefix + "icon-" + params.iconPosition if iconSvg and not params.isIconBtn,
|
|
60
|
+
classNamePrefix + "icon-only" if params.isIconBtn,
|
|
61
|
+
classNamePrefix + "rounded" if params.rounded,
|
|
55
62
|
classNamePrefix + "toggle" if params.isToggle,
|
|
56
63
|
classNamePrefix + "selected" if params.isToggle and params.selected,
|
|
57
64
|
"ds-loading" if params.loading,
|
|
@@ -61,7 +68,7 @@
|
|
|
61
68
|
|
|
62
69
|
{%- if params.isToggle %}
|
|
63
70
|
{% call ToggleWrapper({ ariaLabel: ariaLabel, selected: params.selected, classes: classes, attributes: attributes, disabled: params.disabled, loadingHtml: loadingHtml }) %}
|
|
64
|
-
{%- if params.
|
|
71
|
+
{%- if params.isIconBtn %}
|
|
65
72
|
<span class="ds-btn__off" aria-hidden="true">{{ IconUse({ icon: params.iconName }) }}</span>
|
|
66
73
|
<span class="ds-btn__on" aria-hidden="true">{{ IconUse({ icon: params.selectedIconName }) }}</span>
|
|
67
74
|
{% else %}
|
|
@@ -75,7 +82,7 @@
|
|
|
75
82
|
{% if params.href %}
|
|
76
83
|
{% set loadingHtml = null %}
|
|
77
84
|
{% endif %}
|
|
78
|
-
{% set buttonParams = { isIconButton: params.
|
|
85
|
+
{% set buttonParams = { isIconButton: params.isIconBtn, a11y: params.a11y, text: text, iconSvg: iconSvg, loadingHtml: loadingHtml , attributes: params.attributes } %}
|
|
79
86
|
{%- if params.href %}
|
|
80
87
|
<a href="{{ params.href | default('#', true) }}" {{ ariaLabel | safe }} class="{{ classes }}" {{- attributes | safe }}>
|
|
81
88
|
{{ 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: ds-border-radius(012);
|
|
23
23
|
position: relative;
|
|
24
24
|
background-color: var(--ds-btn__background-color);
|
|
25
25
|
color: var(--ds-btn__color);
|
|
@@ -32,35 +32,66 @@ $ds-btn-outlined__border-width: ds-border-width(xxs);
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
&.ds-btn--primary {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
35
|
+
&.ds-btn--default,
|
|
36
|
+
&.ds-btn--elevated {
|
|
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
|
+
}
|
|
42
47
|
}
|
|
43
48
|
|
|
44
|
-
&.ds-btn--
|
|
45
|
-
|
|
46
|
-
|
|
49
|
+
&.ds-btn--secondary {
|
|
50
|
+
&.ds-btn--default,
|
|
51
|
+
&.ds-btn--elevated {
|
|
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
|
+
}
|
|
47
62
|
}
|
|
48
63
|
|
|
49
|
-
&.ds-btn--
|
|
50
|
-
--ds-
|
|
51
|
-
|
|
52
|
-
|
|
64
|
+
&.ds-btn--brand {
|
|
65
|
+
--ds-btn__outline-color: #{$ds-color-border-brand};
|
|
66
|
+
&.ds-btn--default,
|
|
67
|
+
&.ds-btn--elevated {
|
|
68
|
+
--ds-btn__background-color: #{$ds-color-surface-brand};
|
|
69
|
+
--ds-btn__color: #{$ds-color-neutral-white};
|
|
70
|
+
}
|
|
71
|
+
&.ds-btn--outline {
|
|
72
|
+
--ds-btn__border-color: #{$ds-color-surface-brand};
|
|
73
|
+
--ds-btn__color: #{$ds-color-text-brand};
|
|
74
|
+
}
|
|
75
|
+
&.ds-btn--transparent {
|
|
76
|
+
--ds-btn__color: #{$ds-color-text-brand};
|
|
77
|
+
}
|
|
53
78
|
}
|
|
54
79
|
|
|
55
80
|
&.ds-btn--staticWhite {
|
|
56
81
|
--ds-btn__outline-color: #{$ds-color-neutral-white};
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
82
|
+
&.ds-btn--default,
|
|
83
|
+
&.ds-btn--elevated {
|
|
84
|
+
--ds-btn__background-color: #{$ds-color-neutral-white};
|
|
85
|
+
--ds-btn__color: #{$ds-color-neutral-black};
|
|
86
|
+
}
|
|
87
|
+
&.ds-btn--outline {
|
|
88
|
+
--ds-btn__background-color: transparent;
|
|
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
|
+
}
|
|
64
95
|
}
|
|
65
96
|
|
|
66
97
|
&.ds-btn--toggle.ds-btn--selected:not(.ds-btn--icon-only) {
|
|
@@ -69,87 +100,83 @@ $ds-btn-outlined__border-width: ds-border-width(xxs);
|
|
|
69
100
|
--ds-btn__border-color: #{$ds-color-border-primary-strongest};
|
|
70
101
|
--ds-btn__outline-color: #{$ds-color-border-primary-strongest};
|
|
71
102
|
}
|
|
103
|
+
&.ds-btn--transparent {
|
|
104
|
+
--ds-btn__background-color: transparent;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
&.ds-btn--rounded {
|
|
108
|
+
border-radius: 100px;
|
|
109
|
+
}
|
|
72
110
|
|
|
73
|
-
&.ds-btn--
|
|
111
|
+
&.ds-btn--elevated {
|
|
112
|
+
box-shadow: ds-shadow-get-box-shadow($ds-shadow-elevation-md);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
&.ds-btn--small {
|
|
74
116
|
--ds-btn__icon-size: #{ds-px-to-rem(20px)};
|
|
75
117
|
--ds-btn__icon-padding: #{_btn-brdr(ds-spacing($ds-s-050), true)};
|
|
76
|
-
--ds-btn__icon-only-padding: #{ds-px-to-rem(5px)};
|
|
77
118
|
padding: _btn-brdr(ds-spacing($ds-s-025), true) _btn-brdr(ds-spacing($ds-s-075), true);
|
|
78
|
-
@include ds-typography($variable: $ds-typography-functional-body-
|
|
119
|
+
@include ds-typography($variable: $ds-typography-functional-body-sm, $fontWeight: $ds-fontweight-semibold);
|
|
79
120
|
@at-root .ds-force-px#{&} {
|
|
80
121
|
--ds-btn__icon-size: 20px;
|
|
81
122
|
--ds-btn__icon-padding: #{_btn-brdr(ds-spacing($ds-s-050))};
|
|
82
|
-
--ds-btn__icon-only-padding: 5px;
|
|
83
123
|
padding: _btn-brdr(ds-spacing($ds-s-025)) _btn-brdr(ds-spacing($ds-s-075));
|
|
84
124
|
@include ds-typography(
|
|
85
|
-
$variable: $ds-typography-functional-body-
|
|
86
|
-
$fontWeight: $ds-fontweight-
|
|
125
|
+
$variable: $ds-typography-functional-body-sm,
|
|
126
|
+
$fontWeight: $ds-fontweight-semibold,
|
|
87
127
|
$forcePx: true
|
|
88
128
|
);
|
|
89
129
|
}
|
|
90
130
|
}
|
|
91
131
|
|
|
92
|
-
&.ds-btn--
|
|
132
|
+
&.ds-btn--medium {
|
|
93
133
|
--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)};
|
|
95
134
|
padding: _btn-brdr(ds-spacing($ds-s-050), true) _btn-brdr(ds-spacing($ds-s-125), true);
|
|
96
|
-
@include ds-typography($variable: $ds-typography-functional-body-md, $fontWeight: $ds-fontweight-
|
|
135
|
+
@include ds-typography($variable: $ds-typography-functional-body-md, $fontWeight: $ds-fontweight-semibold);
|
|
97
136
|
@at-root .ds-force-px#{&} {
|
|
98
137
|
--ds-btn__icon-padding: #{_btn-brdr(ds-spacing($ds-s-100))};
|
|
99
|
-
--ds-btn__icon-only-padding: #{_btn-brdr(ds-spacing($ds-s-050))};
|
|
100
138
|
padding: _btn-brdr(ds-spacing($ds-s-050)) _btn-brdr(ds-spacing($ds-s-125));
|
|
101
139
|
@include ds-typography(
|
|
102
140
|
$variable: $ds-typography-functional-body-md,
|
|
103
|
-
$fontWeight: $ds-fontweight-
|
|
141
|
+
$fontWeight: $ds-fontweight-semibold,
|
|
104
142
|
$forcePx: true
|
|
105
143
|
);
|
|
106
144
|
}
|
|
107
145
|
}
|
|
108
146
|
|
|
109
|
-
&.ds-btn--
|
|
147
|
+
&.ds-btn--large {
|
|
110
148
|
--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)};
|
|
112
149
|
padding: _btn-brdr(ds-spacing($ds-s-075), true) _btn-brdr(ds-spacing($ds-s-150), true);
|
|
113
|
-
@include ds-typography($variable: $ds-typography-functional-body-md, $fontWeight: $ds-fontweight-
|
|
150
|
+
@include ds-typography($variable: $ds-typography-functional-body-md, $fontWeight: $ds-fontweight-semibold);
|
|
114
151
|
|
|
115
152
|
@at-root .ds-force-px#{&} {
|
|
116
153
|
--ds-btn__icon-padding: #{_btn-brdr(ds-spacing($ds-s-125))};
|
|
117
|
-
--ds-btn__icon-only-padding: #{_btn-brdr(ds-spacing($ds-s-075))};
|
|
118
154
|
padding: _btn-brdr(ds-spacing($ds-s-075)) _btn-brdr(ds-spacing($ds-s-150));
|
|
119
155
|
@include ds-typography(
|
|
120
156
|
$variable: $ds-typography-functional-body-md,
|
|
121
|
-
$fontWeight: $ds-fontweight-
|
|
157
|
+
$fontWeight: $ds-fontweight-semibold,
|
|
122
158
|
$forcePx: true
|
|
123
159
|
);
|
|
124
160
|
}
|
|
125
161
|
}
|
|
126
162
|
|
|
127
|
-
&.ds-btn--
|
|
128
|
-
--ds-btn__icon-size: #{ds-px-to-rem(
|
|
163
|
+
&.ds-btn--xlarge {
|
|
164
|
+
--ds-btn__icon-size: #{ds-px-to-rem(32px)};
|
|
129
165
|
--ds-btn__icon-padding: #{_btn-brdr(ds-spacing($ds-s-200), true) - ds-px-to-rem(4px)};
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
@include ds-typography($variable: $ds-typography-functional-body-md, $fontWeight: $ds-fontweight-medium);
|
|
166
|
+
padding: _btn-brdr(ds-spacing($ds-s-075), true) _btn-brdr(ds-spacing($ds-s-200), true);
|
|
167
|
+
@include ds-typography($variable: $ds-typography-functional-body-lg, $fontWeight: $ds-fontweight-semibold);
|
|
133
168
|
@at-root .ds-force-px#{&} {
|
|
134
|
-
--ds-btn__icon-size:
|
|
169
|
+
--ds-btn__icon-size: 32px;
|
|
135
170
|
--ds-btn__icon-padding: #{_btn-brdr(ds-spacing($ds-s-200)) - 4px};
|
|
136
|
-
|
|
137
|
-
padding: _btn-brdr(ds-spacing($ds-s-100)) _btn-brdr(ds-spacing($ds-s-200));
|
|
171
|
+
padding: _btn-brdr(ds-spacing($ds-s-075)) _btn-brdr(ds-spacing($ds-s-200));
|
|
138
172
|
@include ds-typography(
|
|
139
|
-
$variable: $ds-typography-functional-body-
|
|
140
|
-
$fontWeight: $ds-fontweight-
|
|
173
|
+
$variable: $ds-typography-functional-body-lg,
|
|
174
|
+
$fontWeight: $ds-fontweight-semibold,
|
|
141
175
|
$forcePx: true
|
|
142
176
|
);
|
|
143
177
|
}
|
|
144
178
|
}
|
|
145
179
|
|
|
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
|
-
|
|
153
180
|
span {
|
|
154
181
|
pointer-events: none;
|
|
155
182
|
}
|
|
@@ -240,7 +267,7 @@ $ds-btn-outlined__border-width: ds-border-width(xxs);
|
|
|
240
267
|
margin: ds-spacing(0 0 0 $ds-s-050);
|
|
241
268
|
}
|
|
242
269
|
}
|
|
243
|
-
&.ds-btn--
|
|
270
|
+
&.ds-btn--small .ds-icon {
|
|
244
271
|
margin: ds-spacing(0 0 0 $ds-s-025, rem);
|
|
245
272
|
@at-root .ds-force-px#{&} {
|
|
246
273
|
margin: ds-spacing(0 0 0 $ds-s-025);
|
|
@@ -254,7 +281,7 @@ $ds-btn-outlined__border-width: ds-border-width(xxs);
|
|
|
254
281
|
.ds-icon {
|
|
255
282
|
margin: ds-spacing(0 $ds-s-050 0 0, rem);
|
|
256
283
|
}
|
|
257
|
-
&.ds-btn--
|
|
284
|
+
&.ds-btn--small .ds-icon {
|
|
258
285
|
margin: ds-spacing(0 $ds-s-025 0 0, rem);
|
|
259
286
|
}
|
|
260
287
|
&.ds-force-px {
|
|
@@ -262,7 +289,7 @@ $ds-btn-outlined__border-width: ds-border-width(xxs);
|
|
|
262
289
|
.ds-icon {
|
|
263
290
|
margin: ds-spacing(0 $ds-s-050 0 0);
|
|
264
291
|
}
|
|
265
|
-
&.ds-btn--
|
|
292
|
+
&.ds-btn--small .ds-icon {
|
|
266
293
|
margin: ds-spacing(0 $ds-s-025 0 0);
|
|
267
294
|
}
|
|
268
295
|
}
|
|
@@ -16,27 +16,24 @@ 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
|
-
|
|
|
21
|
-
| variant | Design variant<br />"primary", "staticWhite", "primaryBlack", "secondaryFilled", "secondaryOutline", "transparent" | "primary" |
|
|
19
|
+
| selectedText\* | string | \- |
|
|
20
|
+
| variant | "brand", "secondary", "primary" | "primary" |
|
|
22
21
|
| 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", "bookmark-filled", "bookmarked", "campaign" | \- |
|
|
24
22
|
| classNames | string | \- |
|
|
25
23
|
| attributes | Ex. { target: "\_blank", "data-test": "lorem ipsum" }<br />{ \[key: string\]: string; } | { } |
|
|
26
24
|
| forcePx | Fixed pixel value is used for typography to prevent scaling based on html font-size<br />boolean | false |
|
|
27
|
-
| size | "
|
|
25
|
+
| size | "large", "small", "medium", "xlarge" | "medium" |
|
|
28
26
|
| loading | boolean | false |
|
|
29
27
|
| text | string | \- |
|
|
30
28
|
| selected | boolean | false |
|
|
31
|
-
| selectedIconName | "add", "arrow\_back", "arrow\_forward", "arrow\_outward", "arrow\_upward", "bookmark-filled", "bookmarked", "campaign" | \- |
|
|
32
29
|
| fullWidth | Button will be full width on both desktop and mobile<br />boolean | false |
|
|
33
30
|
| mobileFullWidth | Button will only full width on mobile<br />boolean | false |
|
|
34
31
|
|
|
35
32
|
```jsx
|
|
36
33
|
<ButtonToggle
|
|
37
34
|
selectedText="Följer"
|
|
38
|
-
size="
|
|
35
|
+
size="large"
|
|
39
36
|
text="Följ"
|
|
40
|
-
variant="
|
|
37
|
+
variant="brand"
|
|
41
38
|
/>
|
|
42
39
|
```
|
|
@@ -12,9 +12,6 @@
|
|
|
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,
|
|
18
15
|
loading: params.loading,
|
|
19
16
|
forcePx: params.forcePx,
|
|
20
17
|
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 | "medium", "soft", "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: "brand",
|
|
39
39
|
href: params.brandButton.href,
|
|
40
40
|
classNames: params.brandButton.classNames,
|
|
41
41
|
attributes: params.brandButton.attributes,
|
|
@@ -47,7 +47,8 @@
|
|
|
47
47
|
{% if params.primaryButton %}
|
|
48
48
|
{{ Button({
|
|
49
49
|
text: params.primaryButton.text,
|
|
50
|
-
variant: "
|
|
50
|
+
variant: "primary",
|
|
51
|
+
emphasis: "outline",
|
|
51
52
|
href: params.primaryButton.href,
|
|
52
53
|
classNames: params.primaryButton.classNames,
|
|
53
54
|
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: 'secondary',
|
|
33
|
+
size: 'medium',
|
|
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: 'secondary',
|
|
44
|
+
size: 'medium',
|
|
45
45
|
iconPosition: 'right',
|
|
46
46
|
iconName: 'expand_less',
|
|
47
47
|
classNames: 'ds-factbox__expand-less',
|