@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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{% from '@bonniernews/dn-design-system-web/njk-helpers/attributes.njk' import getAttributes %}
|
|
2
2
|
{% from '@bonniernews/dn-design-system-web/components/icon-sprite/icon-sprite.njk' import IconUse %}
|
|
3
3
|
{% from '@bonniernews/dn-design-system-web/components/button-toggle/button-toggle.njk' import ButtonToggle %}
|
|
4
|
-
{% from '@bonniernews/dn-design-system-web/components/
|
|
4
|
+
{% from '@bonniernews/dn-design-system-web/components/button/button.njk' import Button %}
|
|
5
5
|
|
|
6
6
|
{% macro GroupHeader(params) %}
|
|
7
7
|
{% set componentClassName = "ds-group-header" %}
|
|
@@ -49,8 +49,8 @@
|
|
|
49
49
|
{# there is no static-white toggle btn so it is disabled for bauta for now #}
|
|
50
50
|
{% if params.type == 'toggle' and not params.variant %}
|
|
51
51
|
{{ ButtonToggle({
|
|
52
|
-
variant: "
|
|
53
|
-
size: '
|
|
52
|
+
variant: "primary",
|
|
53
|
+
size: 'sm',
|
|
54
54
|
text: params.toggleText,
|
|
55
55
|
selectedText: params.toggleSelectedText,
|
|
56
56
|
selected: params.toggleSelected,
|
|
@@ -59,20 +59,20 @@
|
|
|
59
59
|
attributes: params.toggleAttributes
|
|
60
60
|
}) }}
|
|
61
61
|
{% elif (params.type == 'arrows') %}
|
|
62
|
-
{% set buttonVariant = "staticWhite" if params.variant else "
|
|
62
|
+
{% set buttonVariant = "staticWhite" if params.variant else "secondaryOutline" %}
|
|
63
63
|
<div class="{{ componentClassName + '__arrows' }} hidden-mobile hidden-tablet">
|
|
64
|
-
{{
|
|
64
|
+
{{ Button({
|
|
65
65
|
variant: buttonVariant,
|
|
66
|
-
|
|
67
|
-
|
|
66
|
+
size: "sm",
|
|
67
|
+
isIconButton: true,
|
|
68
68
|
iconName: "arrow_back",
|
|
69
69
|
classNames: "ds-group-header__arrow ds-group-header__arrow--left",
|
|
70
70
|
attributes: {"aria-label": "Föregående"}
|
|
71
71
|
}) }}
|
|
72
|
-
{{
|
|
72
|
+
{{ Button({
|
|
73
73
|
variant: buttonVariant,
|
|
74
|
-
|
|
75
|
-
|
|
74
|
+
size: "sm",
|
|
75
|
+
isIconButton: true,
|
|
76
76
|
iconName: "arrow_forward",
|
|
77
77
|
classNames: "ds-group-header__arrow ds-group-header__arrow--right",
|
|
78
78
|
attributes: {"aria-label": "Nästa"}
|
|
@@ -3,7 +3,7 @@ import { ComponentChildren } from "preact";
|
|
|
3
3
|
import { ButtonProps } from '../radio-button/radio-button'
|
|
4
4
|
import type { DsIcon } from '@bonniernews/dn-design-system-web/types-lib/ds-icon.d.ts'
|
|
5
5
|
import { SwitchInnerProps } from '../switch/switch'
|
|
6
|
-
import {
|
|
6
|
+
import { ButtonToggleStandardProps } from '../button/button-types'
|
|
7
7
|
|
|
8
8
|
export interface ListItemSharedProps {
|
|
9
9
|
title?: string
|
|
@@ -67,7 +67,7 @@ export interface SwitchListItemProps
|
|
|
67
67
|
|
|
68
68
|
export interface ToggleListItemProps
|
|
69
69
|
extends ListItemSharedProps,
|
|
70
|
-
|
|
70
|
+
ButtonToggleStandardProps,
|
|
71
71
|
Pick<ListItemBaseProps, 'title' | 'subtitle' | 'disabled' | 'selected'> {
|
|
72
72
|
name: string
|
|
73
73
|
titleHref?: string
|
|
@@ -104,7 +104,7 @@ export interface InnerListItemProps
|
|
|
104
104
|
| 'toggleSelectedText'
|
|
105
105
|
| 'disabled'
|
|
106
106
|
>,
|
|
107
|
-
Pick<
|
|
107
|
+
Pick<ButtonToggleStandardProps, 'variant'> {
|
|
108
108
|
componentClassName: string
|
|
109
109
|
}
|
|
110
110
|
|
|
@@ -147,10 +147,10 @@
|
|
|
147
147
|
text: params.toggleText,
|
|
148
148
|
selected: params.selected,
|
|
149
149
|
selectedText: params.toggleSelectedText,
|
|
150
|
-
variant: params.variant | default("
|
|
150
|
+
variant: params.variant | default("secondaryFilled"),
|
|
151
151
|
disabled: params.disabled,
|
|
152
152
|
forcePx: params.forcePx,
|
|
153
|
-
size: "
|
|
153
|
+
size: "sm",
|
|
154
154
|
attributes: params.elementAttributes,
|
|
155
155
|
classNames: params.elementClassNames
|
|
156
156
|
})}}
|
|
@@ -164,10 +164,10 @@
|
|
|
164
164
|
text: params.toggleText,
|
|
165
165
|
selected: params.selected,
|
|
166
166
|
selectedText: params.toggleSelectedText,
|
|
167
|
-
variant: params.variant | default("
|
|
167
|
+
variant: params.variant | default("secondaryFilled"),
|
|
168
168
|
disabled: params.disabled,
|
|
169
169
|
forcePx: params.forcePx,
|
|
170
|
-
size: "
|
|
170
|
+
size: "sm",
|
|
171
171
|
attributes: params.elementAttributes,
|
|
172
172
|
classNames: params.elementClassNames
|
|
173
173
|
})}}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
{% from '@bonniernews/dn-design-system-web/components/icon-sprite/icon-sprite.njk' import IconUse %}
|
|
2
2
|
{% from '@bonniernews/dn-design-system-web/components/button/button.njk' import Button %}
|
|
3
|
-
{% from '@bonniernews/dn-design-system-web/components/icon-button/icon-button.njk' import IconButton %}
|
|
4
3
|
{% from '@bonniernews/dn-design-system-web/njk-helpers/attributes.njk' import getAttributes %}
|
|
5
4
|
|
|
6
5
|
{% macro Modal(params) %}
|
|
@@ -16,10 +15,11 @@
|
|
|
16
15
|
<div class="{{ classes }}">
|
|
17
16
|
<dialog class="{{ componentClassName + '__inner' }}" {{- attributes | safe }}>
|
|
18
17
|
<div class="{{ componentClassName + '__content' }}">
|
|
19
|
-
{{
|
|
18
|
+
{{ Button({
|
|
20
19
|
variant: "transparent",
|
|
21
|
-
size: "
|
|
20
|
+
size: "sm",
|
|
22
21
|
iconName: "close",
|
|
22
|
+
isIconButton: true,
|
|
23
23
|
classNames: "ds-modal__close ds-modal__close--icon"
|
|
24
24
|
})}}
|
|
25
25
|
|
|
@@ -32,14 +32,13 @@
|
|
|
32
32
|
{% if params.primaryButton or params.secondaryButton %}
|
|
33
33
|
<div class="ds-modal__buttons">
|
|
34
34
|
{% if params.secondaryButton %}
|
|
35
|
-
{%- set secondaryButtonClasses = [
|
|
35
|
+
{%- set secondaryButtonClasses = ["ds-modal__secondary-button",
|
|
36
36
|
"ds-modal__close" if params.secondaryButton.isCloseButton,
|
|
37
37
|
params.secondaryButton.classNames if params.secondaryButton.classNames
|
|
38
38
|
] | join(" ") %}
|
|
39
39
|
{{ Button({
|
|
40
40
|
text: params.secondaryButton.text,
|
|
41
|
-
variant: "
|
|
42
|
-
emphasis: "outline",
|
|
41
|
+
variant: "secondaryOutline",
|
|
43
42
|
href: params.secondaryButton.href,
|
|
44
43
|
classNames: secondaryButtonClasses,
|
|
45
44
|
attributes: params.secondaryButton.attributes,
|
|
@@ -51,11 +50,14 @@
|
|
|
51
50
|
{% endif %}
|
|
52
51
|
|
|
53
52
|
{% if params.primaryButton %}
|
|
53
|
+
{%- set primaryButtonClasses = ["ds-modal__primary-button",
|
|
54
|
+
params.primaryButton.classNames if params.primaryButton.classNames
|
|
55
|
+
] | join(" ") %}
|
|
54
56
|
{{ Button({
|
|
55
57
|
text: params.primaryButton.text,
|
|
56
|
-
variant: "
|
|
58
|
+
variant: "primaryBlack",
|
|
57
59
|
href: params.primaryButton.href,
|
|
58
|
-
classNames:
|
|
60
|
+
classNames: primaryButtonClasses,
|
|
59
61
|
attributes: params.primaryButton.attributes,
|
|
60
62
|
forcePx: params.forcePx,
|
|
61
63
|
mobile: {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
@use "../../foundations/helpers/forward.helpers.scss" as *;
|
|
2
2
|
@use "../../components/icon-sprite/icon-sprite.scss";
|
|
3
3
|
@use "../../components/button/button.scss";
|
|
4
|
-
@use "../../components/icon-button/icon-button.scss";
|
|
5
4
|
|
|
6
5
|
body:has(dialog[open]),
|
|
7
6
|
body.no-scroll {
|
|
@@ -107,12 +106,12 @@ body.no-scroll {
|
|
|
107
106
|
display: flex;
|
|
108
107
|
flex-wrap: wrap;
|
|
109
108
|
|
|
110
|
-
.ds-
|
|
109
|
+
.ds-modal__primary-button:not(:only-child) {
|
|
111
110
|
order: 1;
|
|
112
111
|
margin-bottom: ds-spacing($ds-s-100);
|
|
113
112
|
}
|
|
114
113
|
|
|
115
|
-
.ds-
|
|
114
|
+
.ds-modal__secondary-button:not(:only-child) {
|
|
116
115
|
order: 2;
|
|
117
116
|
}
|
|
118
117
|
}
|
|
@@ -121,7 +120,7 @@ body.no-scroll {
|
|
|
121
120
|
display: flex;
|
|
122
121
|
justify-content: center;
|
|
123
122
|
|
|
124
|
-
.ds-
|
|
123
|
+
.ds-modal__secondary-button:not(:only-child) {
|
|
125
124
|
margin-right: ds-spacing($ds-s-100);
|
|
126
125
|
}
|
|
127
126
|
}
|
|
@@ -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/text-button/text-button.njk' import TextButton %}
|
|
3
|
-
{% from '@bonniernews/dn-design-system-web/components/icon-button/icon-button.njk' import IconButton %}
|
|
4
3
|
|
|
5
4
|
{% macro Pagination(params) %}
|
|
6
5
|
{%- set componentClassName = "ds-pagination" %}
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
<h1 class="{{ componentClassName }}__title">{{ params.title}}</h1>
|
|
19
19
|
{% if params.toggle %}
|
|
20
20
|
{{ ButtonToggle({
|
|
21
|
-
variant: '
|
|
22
|
-
size: '
|
|
21
|
+
variant: 'primary',
|
|
22
|
+
size: 'md',
|
|
23
23
|
text: params.toggleText,
|
|
24
24
|
selectedText: params.toggleSelectedText,
|
|
25
25
|
selected: params.toggleSelected,
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
<h1 class="{{ componentClassName }}__title">{{ params.title}}</h1>
|
|
27
27
|
{% if params.toggle %}
|
|
28
28
|
{{ ButtonToggle({
|
|
29
|
-
variant: '
|
|
30
|
-
size: '
|
|
29
|
+
variant: 'primary',
|
|
30
|
+
size: 'md',
|
|
31
31
|
text: params.toggleText,
|
|
32
32
|
selectedText: params.toggleSelectedText,
|
|
33
33
|
selected: params.toggleSelected,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{% from '@bonniernews/dn-design-system-web/njk-helpers/attributes.njk' import getAttributes %}
|
|
2
2
|
{% from '@bonniernews/dn-design-system-web/components/teaser-card/teaser-card.njk' import TeaserCard %}
|
|
3
|
-
{% from '@bonniernews/dn-design-system-web/components/icon-button/icon-button.njk' import IconButton %}
|
|
4
3
|
{% from '@bonniernews/dn-design-system-web/components/group-header/group-header.njk' import GroupHeader %}
|
|
5
4
|
{% from '@bonniernews/dn-design-system-web/components/teaser-swipe-card/teaser-swipe-card.njk' import TeaserSwipeCard %}
|
|
5
|
+
{% from '@bonniernews/dn-design-system-web/components/button/button.njk' import Button %}
|
|
6
6
|
|
|
7
7
|
{% macro TeaserListSwipe(params) %}
|
|
8
8
|
{% set componentClassName = "ds-teaser" %}
|
|
@@ -45,20 +45,20 @@
|
|
|
45
45
|
</div>
|
|
46
46
|
|
|
47
47
|
{% if arrowPosition === 'floating' %}
|
|
48
|
-
{{
|
|
48
|
+
{{ Button({
|
|
49
49
|
iconName: 'arrow_back',
|
|
50
|
-
variant: '
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
variant: 'staticWhite',
|
|
51
|
+
size: 'sm',
|
|
52
|
+
isIconButton: true,
|
|
53
53
|
attributes: { 'aria-label': 'Föregående' },
|
|
54
54
|
classNames: componentClassName + '__swipe-arrow ' + componentClassName + '__swipe-arrow--back hidden-mobile hidden-tablet',
|
|
55
55
|
forcePx: true
|
|
56
56
|
}) }}
|
|
57
|
-
{{
|
|
57
|
+
{{ Button({
|
|
58
58
|
iconName: 'arrow_forward',
|
|
59
|
-
variant: '
|
|
60
|
-
|
|
61
|
-
|
|
59
|
+
variant: 'staticWhite',
|
|
60
|
+
size: 'sm',
|
|
61
|
+
isIconButton: true,
|
|
62
62
|
attributes: { 'aria-label': 'Nästa' },
|
|
63
63
|
classNames: componentClassName + '__swipe-arrow ' + componentClassName + '__swipe-arrow--forward hidden-mobile hidden-tablet',
|
|
64
64
|
forcePx: true
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
@use "../../foundations/helpers/forward.helpers.scss" as *;
|
|
2
2
|
@use "../../assets/teaser/teaser.scss" as *;
|
|
3
|
-
@use "../../components/
|
|
3
|
+
@use "../../components/button/button.scss";
|
|
4
4
|
@use "../../components/group-header/group-header";
|
|
5
5
|
@use "../../components/teaser-swipe-card/teaser-swipe-card";
|
|
6
6
|
|
|
@@ -47,11 +47,11 @@
|
|
|
47
47
|
z-index: 5;
|
|
48
48
|
|
|
49
49
|
&--back {
|
|
50
|
-
left:
|
|
50
|
+
left: ds-spacing($ds-s-125);
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
&--forward {
|
|
54
|
-
right:
|
|
54
|
+
right: ds-spacing($ds-s-125);
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
{% from '@bonniernews/dn-design-system-web/components/icon-button/icon-button.njk' import IconButton %} {# TODO switch to on-off button #}
|
|
2
1
|
{% from '@bonniernews/dn-design-system-web/assets/form-field/form-field.njk' import FormField %}
|
|
2
|
+
{% from '@bonniernews/dn-design-system-web/components/button-toggle/button-toggle.njk' import ButtonToggle %}
|
|
3
3
|
|
|
4
4
|
{% macro TextInput(params) %}
|
|
5
5
|
{% set componentClassName = "ds-text-input" %}
|
|
@@ -23,10 +23,12 @@
|
|
|
23
23
|
<label class="{{ componentClassName + '__label'}}" for="{{ params.name }}">{{ params.label }}</label>
|
|
24
24
|
{% endif %}
|
|
25
25
|
{% if password %}
|
|
26
|
-
{{
|
|
26
|
+
{{ ButtonToggle({
|
|
27
27
|
variant: "transparent",
|
|
28
|
-
size: "
|
|
28
|
+
size: "sm",
|
|
29
29
|
iconName: "visibility",
|
|
30
|
+
selectedIconName: "visibility_off",
|
|
31
|
+
isIconButton: true,
|
|
30
32
|
classNames: componentClassName + "__password-toggle",
|
|
31
33
|
attributes: {
|
|
32
34
|
id: params.name + "-password-toggle"
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
@use "../../foundations/helpers/forward.helpers.scss" as *;
|
|
2
2
|
@use "../../assets/form-field/form-field.scss";
|
|
3
|
-
@use "
|
|
4
|
-
@use "../icon-button/icon-button.scss"; // TODO remove when njk is removed
|
|
3
|
+
@use "../../components/button/button.scss";
|
|
5
4
|
|
|
6
5
|
$ds-text-input-toggle-btn__width: 28px;
|
|
7
|
-
$ds-text-input-toggle-btn__top:
|
|
6
|
+
$ds-text-input-toggle-btn__top: 20px;
|
|
8
7
|
$ds-text-input-toggle-btn__area: ($ds-text-input-toggle-btn__width + ds-spacing($ds-s-050));
|
|
9
8
|
|
|
10
9
|
.ds-form-field__error {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
{% from '@bonniernews/dn-design-system-web/components/icon-sprite/icon-sprite.njk' import IconUse %}
|
|
2
2
|
{% from '@bonniernews/dn-design-system-web/components/button/button.njk' import Button %}
|
|
3
|
-
{% from '@bonniernews/dn-design-system-web/components/icon-button/icon-button.njk' import IconButton %}
|
|
4
3
|
{% from '@bonniernews/dn-design-system-web/njk-helpers/attributes.njk' import getAttributes %}
|
|
5
4
|
|
|
6
5
|
{% macro Tooltip(params) %}
|
|
@@ -24,12 +23,13 @@
|
|
|
24
23
|
|
|
25
24
|
{{ caller() if caller }}
|
|
26
25
|
</div>
|
|
27
|
-
|
|
26
|
+
|
|
28
27
|
{% if params.closeButton %}
|
|
29
|
-
{{
|
|
28
|
+
{{ Button({
|
|
30
29
|
variant: "transparent",
|
|
31
|
-
size: "
|
|
30
|
+
size: "sm",
|
|
32
31
|
iconName: "close",
|
|
32
|
+
isIconButton: true,
|
|
33
33
|
classNames: "ds-tooltip__close",
|
|
34
34
|
attributes: { "aria-label": "Stäng" }
|
|
35
35
|
})}}
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
@use "../../foundations/variables/typographyFontWeight.scss";
|
|
3
3
|
@use "../../components/icon-sprite/icon-sprite.scss";
|
|
4
4
|
@use "../../components/button/button.scss";
|
|
5
|
-
@use "../../components/icon-button/icon-button.scss";
|
|
6
5
|
|
|
7
6
|
.ds-tooltip {
|
|
8
7
|
background-color: $ds-color-surface-primary-raised-strong;
|
package/package.json
CHANGED
|
@@ -74,9 +74,7 @@ var ButtonBase = ({
|
|
|
74
74
|
text,
|
|
75
75
|
disabled = false,
|
|
76
76
|
variant = "primary",
|
|
77
|
-
|
|
78
|
-
rounded = false,
|
|
79
|
-
size = "medium",
|
|
77
|
+
size = "md",
|
|
80
78
|
fullWidth = false,
|
|
81
79
|
mobileFullWidth = false,
|
|
82
80
|
iconPosition = "none",
|
|
@@ -98,13 +96,9 @@ var ButtonBase = ({
|
|
|
98
96
|
attributes["aria-label"] = text;
|
|
99
97
|
}
|
|
100
98
|
let spinnerVariant = "secondary";
|
|
101
|
-
if (variant === "staticWhite") {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
} else {
|
|
105
|
-
spinnerVariant = "staticBlack";
|
|
106
|
-
}
|
|
107
|
-
} else if (emphasis === "transparent" || emphasis === "outline" || variant === "secondary") {
|
|
99
|
+
if (variant === "staticWhite" || variant === "transparent") {
|
|
100
|
+
spinnerVariant = "staticBlack";
|
|
101
|
+
} else if (variant === "secondaryFilled" || variant === "secondaryOutline") {
|
|
108
102
|
spinnerVariant = "primary";
|
|
109
103
|
}
|
|
110
104
|
const loadingHtml = /* @__PURE__ */ jsx5(Spinner, { ...{ size: "small", variant: spinnerVariant, forcePx, attributes: { "aria-hidden": "true" } } });
|
|
@@ -116,14 +110,12 @@ var ButtonBase = ({
|
|
|
116
110
|
const classes = formatClassString([
|
|
117
111
|
"ds-btn",
|
|
118
112
|
`${classNamePrefix}${variant}`,
|
|
119
|
-
`${classNamePrefix}${emphasis}`,
|
|
120
113
|
`${classNamePrefix}${size}`,
|
|
121
114
|
isToggle && selected && `${classNamePrefix}selected`,
|
|
122
115
|
fullWidth && `${classNamePrefix}full-width`,
|
|
123
116
|
mobileFullWidth && `${classNamePrefix}mobile-full-width`,
|
|
124
117
|
icon && !isIconButton && `${classNamePrefix}icon-${iconPosition}`,
|
|
125
118
|
isIconButton && `${classNamePrefix}icon-only`,
|
|
126
|
-
rounded && `${classNamePrefix}rounded`,
|
|
127
119
|
isToggle && `${classNamePrefix}toggle`,
|
|
128
120
|
loading && "ds-loading",
|
|
129
121
|
forcePx && "ds-force-px",
|
|
@@ -161,9 +153,7 @@ var Button = ({
|
|
|
161
153
|
text,
|
|
162
154
|
disabled = false,
|
|
163
155
|
variant = "primary",
|
|
164
|
-
|
|
165
|
-
rounded = false,
|
|
166
|
-
size = "medium",
|
|
156
|
+
size = "md",
|
|
167
157
|
fullWidth = false,
|
|
168
158
|
mobileFullWidth = false,
|
|
169
159
|
iconPosition = "none",
|
|
@@ -171,6 +161,7 @@ var Button = ({
|
|
|
171
161
|
loading = false,
|
|
172
162
|
type = "button",
|
|
173
163
|
href,
|
|
164
|
+
isIconButton = false,
|
|
174
165
|
classNames,
|
|
175
166
|
attributes,
|
|
176
167
|
forcePx = false
|
|
@@ -179,8 +170,6 @@ var Button = ({
|
|
|
179
170
|
text,
|
|
180
171
|
disabled,
|
|
181
172
|
variant,
|
|
182
|
-
emphasis,
|
|
183
|
-
rounded,
|
|
184
173
|
size,
|
|
185
174
|
fullWidth,
|
|
186
175
|
mobileFullWidth,
|
|
@@ -189,50 +178,15 @@ var Button = ({
|
|
|
189
178
|
loading,
|
|
190
179
|
type,
|
|
191
180
|
href,
|
|
181
|
+
isIconButton,
|
|
192
182
|
classNames,
|
|
193
183
|
attributes,
|
|
194
184
|
forcePx
|
|
195
185
|
} });
|
|
196
186
|
};
|
|
197
187
|
|
|
198
|
-
// ../src/components/icon-button/icon-button.tsx
|
|
199
|
-
import { jsx as jsx7 } from "preact/jsx-runtime";
|
|
200
|
-
var IconButton = ({
|
|
201
|
-
iconName,
|
|
202
|
-
disabled = false,
|
|
203
|
-
variant = "primary",
|
|
204
|
-
emphasis = "default",
|
|
205
|
-
rounded = true,
|
|
206
|
-
size = "medium",
|
|
207
|
-
loading = false,
|
|
208
|
-
a11y,
|
|
209
|
-
attributes,
|
|
210
|
-
classNames,
|
|
211
|
-
forcePx = false
|
|
212
|
-
}) => {
|
|
213
|
-
return /* @__PURE__ */ jsx7(
|
|
214
|
-
ButtonBase,
|
|
215
|
-
{
|
|
216
|
-
...{
|
|
217
|
-
disabled,
|
|
218
|
-
variant,
|
|
219
|
-
emphasis,
|
|
220
|
-
rounded,
|
|
221
|
-
size,
|
|
222
|
-
loading,
|
|
223
|
-
iconName,
|
|
224
|
-
a11y,
|
|
225
|
-
attributes,
|
|
226
|
-
classNames,
|
|
227
|
-
forcePx,
|
|
228
|
-
isIconButton: true
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
);
|
|
232
|
-
};
|
|
233
|
-
|
|
234
188
|
// ../src/components/buddy-menu/buddy-menu.tsx
|
|
235
|
-
import { jsx as
|
|
189
|
+
import { jsx as jsx7, jsxs as jsxs3 } from "preact/jsx-runtime";
|
|
236
190
|
var BuddyMenu = ({
|
|
237
191
|
userName,
|
|
238
192
|
links,
|
|
@@ -247,16 +201,17 @@ var BuddyMenu = ({
|
|
|
247
201
|
}) => {
|
|
248
202
|
const componentClassName = "ds-buddy-menu";
|
|
249
203
|
const classes = formatClassString([componentClassName, forcePx && "ds-force-px", classNames]);
|
|
250
|
-
return /* @__PURE__ */
|
|
251
|
-
/* @__PURE__ */
|
|
252
|
-
|
|
204
|
+
return /* @__PURE__ */ jsx7("div", { class: `${classes} ${isDnSkola && "ds-buddy-menu--skola"}`, ...attributes, children: /* @__PURE__ */ jsx7("div", { class: `${componentClassName}__inner`, children: /* @__PURE__ */ jsx7("div", { class: "ds-buddy-menu__scrollable-container", children: /* @__PURE__ */ jsxs3("div", { class: "ds-buddy-menu__content", children: [
|
|
205
|
+
/* @__PURE__ */ jsx7(
|
|
206
|
+
Button,
|
|
253
207
|
{
|
|
254
208
|
...{
|
|
255
|
-
size: "
|
|
209
|
+
size: "sm",
|
|
256
210
|
iconName: "close",
|
|
257
211
|
classNames: "ds-buddy-menu__close",
|
|
258
212
|
forcePx,
|
|
259
|
-
|
|
213
|
+
variant: "transparent",
|
|
214
|
+
isIconButton: true
|
|
260
215
|
}
|
|
261
216
|
}
|
|
262
217
|
),
|
|
@@ -264,23 +219,23 @@ var BuddyMenu = ({
|
|
|
264
219
|
/* @__PURE__ */ jsxs3("span", { class: "ds-buddy-menu__greeting", children: [
|
|
265
220
|
"Hej",
|
|
266
221
|
" ",
|
|
267
|
-
/* @__PURE__ */
|
|
222
|
+
/* @__PURE__ */ jsx7("span", { class: "ds-buddy-menu__name js-buddy-menu-name", "data-name-type": "given", children: userName }),
|
|
268
223
|
"!"
|
|
269
224
|
] }),
|
|
270
225
|
!isDnSkola && /* @__PURE__ */ jsxs3("div", { class: "ds-buddy-menu__account", children: [
|
|
271
|
-
/* @__PURE__ */
|
|
272
|
-
/* @__PURE__ */
|
|
226
|
+
/* @__PURE__ */ jsx7("h2", { class: "ds-buddy-menu__account-title", children: "Min prenumeration" }),
|
|
227
|
+
/* @__PURE__ */ jsx7("span", { class: "ds-buddy-menu__account-level js-buddy-menu__account-level", children: accountLevel }),
|
|
273
228
|
addons && /* @__PURE__ */ jsxs3("div", { class: `ds-buddy-menu__addons ${addonsClassNames}`, children: [
|
|
274
|
-
/* @__PURE__ */
|
|
275
|
-
/* @__PURE__ */
|
|
229
|
+
/* @__PURE__ */ jsx7("h2", { class: "ds-buddy-menu__addons-title", children: "Mina till\xE4gg" }),
|
|
230
|
+
/* @__PURE__ */ jsx7("ul", { class: "ds-buddy-menu__addons-list", children: addons.map((addon) => /* @__PURE__ */ jsx7("li", { class: addon.classNames, children: /* @__PURE__ */ jsx7("a", { href: addon.href, children: addon.title }) })) })
|
|
276
231
|
] }),
|
|
277
|
-
/* @__PURE__ */
|
|
232
|
+
/* @__PURE__ */ jsx7(
|
|
278
233
|
Button,
|
|
279
234
|
{
|
|
280
235
|
...{
|
|
281
236
|
text: "Mitt konto",
|
|
282
|
-
size: "
|
|
283
|
-
variant: "
|
|
237
|
+
size: "lg",
|
|
238
|
+
variant: "primaryBlack",
|
|
284
239
|
fullWidth: true,
|
|
285
240
|
href: myAccountUrl,
|
|
286
241
|
attributes: { "data-hide-promo": "" },
|
|
@@ -291,8 +246,8 @@ var BuddyMenu = ({
|
|
|
291
246
|
] })
|
|
292
247
|
] }),
|
|
293
248
|
/* @__PURE__ */ jsxs3("div", { class: "ds-buddy-menu__links", children: [
|
|
294
|
-
/* @__PURE__ */
|
|
295
|
-
/* @__PURE__ */
|
|
249
|
+
/* @__PURE__ */ jsx7("h2", { class: "ds-buddy-menu__links-title", children: "Mitt inneh\xE5ll" }),
|
|
250
|
+
/* @__PURE__ */ jsx7("ul", { class: "ds-buddy-menu__links-list", children: links })
|
|
296
251
|
] })
|
|
297
252
|
] }) }) }) });
|
|
298
253
|
};
|