@bonniernews/dn-design-system-web 29.0.0 → 29.1.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 +27 -0
- package/assets/teaser/teaser.scss +0 -14
- package/components/button/button-types.ts +0 -2
- package/components/button/button.njk +5 -6
- package/components/teaser-centered/README.md +0 -2
- package/components/teaser-large/README.md +0 -1
- package/components/teaser-large/teaser-large.njk +0 -12
- package/components/teaser-longlife/README.md +0 -1
- package/components/teaser-longlife/teaser-longlife.njk +0 -6
- package/components/teaser-split/README.md +0 -1
- package/components/teaser-split/teaser-split.njk +0 -6
- package/components/teaser-standard/README.md +0 -1
- package/components/teaser-standard/teaser-standard.njk +0 -15
- package/package.json +1 -1
- package/preact/components/buddy-menu/buddy-menu.js +34 -41
- package/preact/components/buddy-menu/buddy-menu.js.map +4 -4
- package/preact/components/button/button-base.d.ts +2 -2
- package/preact/components/button/button-base.js +21 -28
- package/preact/components/button/button-base.js.map +4 -4
- package/preact/components/button/button-types.d.ts +0 -2
- package/preact/components/button/button.js +23 -30
- package/preact/components/button/button.js.map +4 -4
- package/preact/components/button-toggle/button-toggle.js +23 -30
- package/preact/components/button-toggle/button-toggle.js.map +4 -4
- package/preact/components/list-item/list-item.js +42 -49
- package/preact/components/list-item/list-item.js.map +4 -4
- package/preact/components/text-input/text-input.js +27 -34
- package/preact/components/text-input/text-input.js.map +4 -4
- package/components/vip-badge/README-UXD.md +0 -0
- package/components/vip-badge/README.md +0 -35
- package/components/vip-badge/vip-badge.njk +0 -18
- package/components/vip-badge/vip-badge.scss +0 -60
- package/preact/foundations/a11y/visually-hidden.d.ts +0 -4
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,33 @@ All changes to @bonniernews/dn-design-system-web will be documented in this file
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
+
## [29.1.0](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@29.0.1...@bonniernews/dn-design-system-web@29.1.0) (2025-02-20)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Features
|
|
11
|
+
|
|
12
|
+
* **app:** pill design updates ([#1625](https://github.com/BonnierNews/dn-design-system/issues/1625)) ([b8b9bbf](https://github.com/BonnierNews/dn-design-system/commit/b8b9bbfd4c88502b6b8a09a1e8f2c56b5af91cc4))
|
|
13
|
+
* **web:** remove vip badge ([#1624](https://github.com/BonnierNews/dn-design-system/issues/1624)) ([aac7e6d](https://github.com/BonnierNews/dn-design-system/commit/aac7e6d5dbffb764bb04a013de68f96114e43457))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Maintenance
|
|
17
|
+
|
|
18
|
+
* **deps:** bump @storybook/addon-react-native-web from 0.0.26 to 0.0.27 ([#1610](https://github.com/BonnierNews/dn-design-system/issues/1610)) ([48d5745](https://github.com/BonnierNews/dn-design-system/commit/48d5745614d69e8033e5700ac14981eed3eaf358))
|
|
19
|
+
* prerelease packages ([9944780](https://github.com/BonnierNews/dn-design-system/commit/9944780246dedc02db91c00fd4ed8f8d98f7e9c8))
|
|
20
|
+
* prerelease packages ([81cddbc](https://github.com/BonnierNews/dn-design-system/commit/81cddbca67a0298c7b912499852d50b51ae284f7))
|
|
21
|
+
|
|
22
|
+
## [29.0.1](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@29.0.0...@bonniernews/dn-design-system-web@29.0.1) (2025-02-17)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Bug Fixes
|
|
26
|
+
|
|
27
|
+
* **web:** button href aria-label fallback ([#1616](https://github.com/BonnierNews/dn-design-system/issues/1616)) ([0643b5e](https://github.com/BonnierNews/dn-design-system/commit/0643b5ebfbf5c802e2908808aa360698805d2824))
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
### Maintenance
|
|
31
|
+
|
|
32
|
+
* **web:** update documentation about rerunning failed tests ([#1615](https://github.com/BonnierNews/dn-design-system/issues/1615)) ([9206d7f](https://github.com/BonnierNews/dn-design-system/commit/9206d7fe1e2a9d171c4472167e31a709bb4a7406))
|
|
33
|
+
|
|
7
34
|
## [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
35
|
|
|
9
36
|
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
@use "../../foundations/helpers/forward.helpers.scss" as *;
|
|
2
2
|
@use "../../components/icon-sprite/icon-sprite.scss";
|
|
3
|
-
@use "../../components/vip-badge/vip-badge.scss";
|
|
4
3
|
@use "../../components/teaser-image/teaser-image.scss";
|
|
5
4
|
@use "../../components/teaser-dot/teaser-dot.scss";
|
|
6
5
|
@use "../../components/teaser-footer/teaser-footer.scss";
|
|
@@ -82,19 +81,6 @@ $ds-teaser-standard-image-width-desktop: 196px;
|
|
|
82
81
|
}
|
|
83
82
|
}
|
|
84
83
|
|
|
85
|
-
.ds-vip-badge {
|
|
86
|
-
position: absolute;
|
|
87
|
-
top: 0;
|
|
88
|
-
right: 0;
|
|
89
|
-
z-index: 5;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
&.ds-teaser--quote-badge {
|
|
93
|
-
.ds-teaser__title {
|
|
94
|
-
padding-right: ds-spacing($ds-s-075);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
|
|
98
84
|
&--podcast {
|
|
99
85
|
.ds-teaser__vignette {
|
|
100
86
|
display: flex;
|
|
@@ -31,7 +31,6 @@ export interface ButtonBaseProps extends ButtonSharedProps {
|
|
|
31
31
|
type?: 'button' | 'submit'
|
|
32
32
|
/** If href is set the button will be rendered as an a-tag */
|
|
33
33
|
href?: string
|
|
34
|
-
a11y?: AllyProps
|
|
35
34
|
selected?: boolean
|
|
36
35
|
isToggle?: boolean
|
|
37
36
|
selectedIconName?: DsIcon
|
|
@@ -42,7 +41,6 @@ export interface InnerButtonProps {
|
|
|
42
41
|
text?: string
|
|
43
42
|
isIconButton?: boolean
|
|
44
43
|
attributes?: object | any
|
|
45
|
-
a11y?: AllyProps
|
|
46
44
|
icon?: any
|
|
47
45
|
loadingHtml?: any
|
|
48
46
|
}
|
|
@@ -1,13 +1,12 @@
|
|
|
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/spinner/spinner.njk' import Spinner %}
|
|
3
3
|
{% from '@bonniernews/dn-design-system-web/njk-helpers/attributes.njk' import getAttributes %}
|
|
4
|
-
{% from '@bonniernews/dn-design-system-web/foundations/a11y/visually-hidden.njk' import VisuallyHidden %}
|
|
5
4
|
|
|
6
5
|
{% macro InnerButton(params) %}
|
|
7
|
-
{% if not params.isIconButton %}
|
|
6
|
+
{% if not params.isIconButton and params.attributes["aria-label"] %}
|
|
8
7
|
<span aria-hidden="true">{{ params.text }}</span>
|
|
9
|
-
{% elif not params.
|
|
10
|
-
{{
|
|
8
|
+
{% elif not params.isIconButton %}
|
|
9
|
+
<span>{{ params.text }}</span>
|
|
11
10
|
{% endif %}
|
|
12
11
|
{{- params.iconSvg | safe if params.iconSvg -}} {{ params.loadingHtml | safe }}
|
|
13
12
|
{% endmacro %}
|
|
@@ -24,7 +23,7 @@
|
|
|
24
23
|
{%- set classNamePrefix = componentClassName + "--" %}
|
|
25
24
|
{%- set text = params.text %}
|
|
26
25
|
{%- set attributes = getAttributes(params.attributes) %}
|
|
27
|
-
{%- set ariaLabel = 'aria-label="' + text + '"' if params.text and not params.attributes["aria-label"] else "" %}
|
|
26
|
+
{%- set ariaLabel = 'aria-label="' + text + '"' if (params.isIconButton or params.isToggle) and params.text and not params.attributes["aria-label"] else "" %}
|
|
28
27
|
{%- set buttonVariant = params.variant | default("primary") %}
|
|
29
28
|
|
|
30
29
|
{% if params.variant == "staticWhite" or params.variant == "transparent" %}
|
|
@@ -75,7 +74,7 @@
|
|
|
75
74
|
{% if params.href %}
|
|
76
75
|
{% set loadingHtml = null %}
|
|
77
76
|
{% endif %}
|
|
78
|
-
{% set buttonParams = { isIconButton: params.isIconButton,
|
|
77
|
+
{% set buttonParams = { isIconButton: params.isIconButton, text: text, iconSvg: iconSvg, loadingHtml: loadingHtml , attributes: params.attributes } %}
|
|
79
78
|
{%- if params.href %}
|
|
80
79
|
<a href="{{ params.href | default('#', true) }}" {{ ariaLabel | safe }} class="{{ classes }}" {{- attributes | safe }}>
|
|
81
80
|
{{ InnerButton(buttonParams) }}
|
|
@@ -24,7 +24,6 @@
|
|
|
24
24
|
|isItalicHeadline | bool | no | true, false | false | If the headline should be italic |
|
|
25
25
|
|isLargeHeadline | bool | no | true, false | false | If the headline should be large. Only has an effect if `isItalicHeadline` is true. |
|
|
26
26
|
|isFlashingDot | bool | no | true, false | false | If there should be a flashing ball before the text |
|
|
27
|
-
|isLocked | bool | no | true, false | false | If the paywall indicator should be shown. It is only shown if the teaser has an image. |
|
|
28
27
|
|publicationTime | string | no | | null | Publication time text. |
|
|
29
28
|
|duration | string | no | | null | Duration of podcast. |
|
|
30
29
|
|attributes | Object | no | | | Ex. { target: "_blank", "data-test": "lorem ipsum" } |
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
{% from '@bonniernews/dn-design-system-web/components/teaser-card/teaser-card.njk' import TeaserCard %}
|
|
2
|
-
{% from '@bonniernews/dn-design-system-web/components/vip-badge/vip-badge.njk' import VipBadge %}
|
|
3
2
|
{% from '@bonniernews/dn-design-system-web/components/teaser-dot/teaser-dot.njk' import TeaserDot %}
|
|
4
3
|
{% from '@bonniernews/dn-design-system-web/components/teaser-footer/teaser-footer.njk' import TeaserFooter %}
|
|
5
4
|
{% from '@bonniernews/dn-design-system-web/components/icon-sprite/icon-sprite.njk' import IconUse %}
|
|
@@ -8,7 +7,6 @@
|
|
|
8
7
|
{% set componentClassName = "ds-teaser" %}
|
|
9
8
|
{% set classNamePrefix = componentClassName + "--" %}
|
|
10
9
|
|
|
11
|
-
{% set isQuoteBadge = params.isLocked and not params.mediaHtml and not params.bylineHtml and params.isItalicHeadline %}
|
|
12
10
|
{% if params.isItalicHeadline %}
|
|
13
11
|
{% set italicsClass = "ds-teaser--large-big-italic" if params.isLargeHeadline and params.areaType !== "right" else "ds-teaser--large-italic" %}
|
|
14
12
|
{% endif %}
|
|
@@ -16,7 +14,6 @@
|
|
|
16
14
|
{% set extraClasses = [
|
|
17
15
|
"ds-teaser--large",
|
|
18
16
|
classNamePrefix + params.variant if params.variant,
|
|
19
|
-
classNamePrefix + "quote-badge" if isQuoteBadge,
|
|
20
17
|
classNamePrefix + 'hide-top-border' if params.mediaHtml,
|
|
21
18
|
italicsClass if italicsClass,
|
|
22
19
|
params.classNames if params.classNames
|
|
@@ -35,16 +32,7 @@
|
|
|
35
32
|
] | join(" ") %}
|
|
36
33
|
<div class="{{ mediaClass }}">
|
|
37
34
|
{{ params.mediaHtml }}
|
|
38
|
-
{% if params.isLocked %}
|
|
39
|
-
{{ VipBadge({
|
|
40
|
-
showText: true
|
|
41
|
-
}) }}
|
|
42
|
-
{% endif %}
|
|
43
35
|
</div>
|
|
44
|
-
{% elif params.isItalicHeadline and params.isLocked %}
|
|
45
|
-
{{ VipBadge({
|
|
46
|
-
showText: false
|
|
47
|
-
}) }}
|
|
48
36
|
{% endif %}
|
|
49
37
|
|
|
50
38
|
<div class="{{ componentClassName + '__content'}}">
|
|
@@ -14,7 +14,6 @@
|
|
|
14
14
|
|targetLink | String | yes | | | Target URL for the teaser |
|
|
15
15
|
|vignette | String | no | | | Top text in the teaser |
|
|
16
16
|
|mediaHtml | HTML String | no | | | Main image or other media |
|
|
17
|
-
|isLocked | bool | no | true, false | false | If the paywall indicator should be shown. It is only shown if the teaser has an image. |
|
|
18
17
|
|attributes | Object | no | | | Ex. { target: "_blank", "data-test": "lorem ipsum" } |
|
|
19
18
|
|classNames | String | no | | | Ex. "my-special-class" |
|
|
20
19
|
|~forcePx~ | | | | | Not supported |
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
{% from '@bonniernews/dn-design-system-web/components/teaser-card/teaser-card.njk' import TeaserCard %}
|
|
2
|
-
{% from '@bonniernews/dn-design-system-web/components/vip-badge/vip-badge.njk' import VipBadge %}
|
|
3
2
|
|
|
4
3
|
{% macro TeaserLonglife(params) %}
|
|
5
4
|
{%- set extraClasses = [
|
|
@@ -16,11 +15,6 @@
|
|
|
16
15
|
|
|
17
16
|
{% if params.mediaHtml %}
|
|
18
17
|
{{ params.mediaHtml }}
|
|
19
|
-
{% if params.isLocked %}
|
|
20
|
-
{{ VipBadge({
|
|
21
|
-
showText: false
|
|
22
|
-
}) }}
|
|
23
|
-
{% endif %}
|
|
24
18
|
{% endif %}
|
|
25
19
|
|
|
26
20
|
<div class="ds-teaser__content">
|
|
@@ -21,7 +21,6 @@
|
|
|
21
21
|
|sticker | String | no | | | Red text before the text |
|
|
22
22
|
|mediaHtml | HTML String | no | | | Main image or other media |
|
|
23
23
|
|isFlashingDot | bool | no | true, false | false | If there should be a flashing ball before the text |
|
|
24
|
-
|isLocked | bool | no | true, false | false | If the paywall indicator should be shown. It is only shown if the teaser has an image. |
|
|
25
24
|
|publicationTime | string | no | | null | Publication time text. |
|
|
26
25
|
|duration | string | no | | null | Duration of podcast. |
|
|
27
26
|
|attributes | Object | no | | | Ex. { target: "_blank", "data-test": "lorem ipsum" } |
|
|
@@ -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/teaser-card/teaser-card.njk' import TeaserCard %}
|
|
3
|
-
{% from '@bonniernews/dn-design-system-web/components/vip-badge/vip-badge.njk' import VipBadge %}
|
|
4
3
|
{% from '@bonniernews/dn-design-system-web/components/teaser-dot/teaser-dot.njk' import TeaserDot %}
|
|
5
4
|
{% from '@bonniernews/dn-design-system-web/components/teaser-footer/teaser-footer.njk' import TeaserFooter %}
|
|
6
5
|
{% from '@bonniernews/dn-design-system-web/components/icon-sprite/icon-sprite.njk' import IconUse %}
|
|
@@ -29,11 +28,6 @@
|
|
|
29
28
|
] | join(" ") %}
|
|
30
29
|
<div class="{{ mediaClass }}">
|
|
31
30
|
{{ params.mediaHtml }}
|
|
32
|
-
{% if params.isLocked %}
|
|
33
|
-
{{ VipBadge({
|
|
34
|
-
showText: false
|
|
35
|
-
}) }}
|
|
36
|
-
{% endif %}
|
|
37
31
|
</div>
|
|
38
32
|
{% endif %}
|
|
39
33
|
|
|
@@ -23,7 +23,6 @@
|
|
|
23
23
|
|isItalicHeadline | bool | no | true, false | false | If the headline should be italic |
|
|
24
24
|
|isCompact | bool | no | true, false | false | If the headline should be compact |
|
|
25
25
|
|isFlashingDot | bool | no | true, false | false | If there should be a flashing ball before the text |
|
|
26
|
-
|isLocked | bool | no | true, false | false | If the paywall indicator should be shown. It is only shown if the teaser has an image. |
|
|
27
26
|
|publicationTime | string | no | | null | Publication time text. |
|
|
28
27
|
|duration | string | no | | null | Duration of podcast. |
|
|
29
28
|
|isSquareImage | boolean | no | | false | Flag so we can handle square teaser images |
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
{% from '@bonniernews/dn-design-system-web/components/teaser-card/teaser-card.njk' import TeaserCard %}
|
|
2
|
-
{% from '@bonniernews/dn-design-system-web/components/vip-badge/vip-badge.njk' import VipBadge %}
|
|
3
2
|
{% from '@bonniernews/dn-design-system-web/components/teaser-dot/teaser-dot.njk' import TeaserDot %}
|
|
4
3
|
{% from '@bonniernews/dn-design-system-web/components/teaser-footer/teaser-footer.njk' import TeaserFooter %}
|
|
5
4
|
{% from '@bonniernews/dn-design-system-web/components/icon-sprite/icon-sprite.njk' import IconUse %}
|
|
@@ -8,12 +7,10 @@
|
|
|
8
7
|
{% set componentClassName = "ds-teaser" %}
|
|
9
8
|
{% set classNamePrefix = componentClassName + "--" %}
|
|
10
9
|
|
|
11
|
-
{% set hasQuoteBadge = params.isLocked and not params.mediaHtml and params.isItalicHeadline %}
|
|
12
10
|
{% set extraClasses = [
|
|
13
11
|
"ds-teaser--standard",
|
|
14
12
|
classNamePrefix + params.variant if params.variant,
|
|
15
13
|
classNamePrefix + "compact" if params.isCompact,
|
|
16
|
-
classNamePrefix + "quote-badge" if hasQuoteBadge,
|
|
17
14
|
params.classNames if params.classNames
|
|
18
15
|
] | join(" ") %}
|
|
19
16
|
|
|
@@ -24,13 +21,6 @@
|
|
|
24
21
|
attributes: params.attributes,
|
|
25
22
|
classNames: extraClasses
|
|
26
23
|
}) %}
|
|
27
|
-
|
|
28
|
-
{% if params.isLocked and not params.mediaHtml and params.isItalicHeadline %}
|
|
29
|
-
{{ VipBadge({
|
|
30
|
-
showText: false
|
|
31
|
-
}) }}
|
|
32
|
-
{% endif %}
|
|
33
|
-
|
|
34
24
|
<div class="{{ componentClassName + '__content'}}">
|
|
35
25
|
{% if params.mediaHtml %}
|
|
36
26
|
{% set mediaClass = [
|
|
@@ -40,11 +30,6 @@
|
|
|
40
30
|
] | join(" ") %}
|
|
41
31
|
<div class="{{ mediaClass }}">
|
|
42
32
|
{{ params.mediaHtml }}
|
|
43
|
-
{% if params.isLocked %}
|
|
44
|
-
{{ VipBadge({
|
|
45
|
-
showText: false
|
|
46
|
-
}) }}
|
|
47
|
-
{% endif %}
|
|
48
33
|
</div>
|
|
49
34
|
{% endif %}
|
|
50
35
|
|
package/package.json
CHANGED
|
@@ -34,20 +34,14 @@ var Spinner = ({ variant = "primary", size = "large", forcePx, classNames, attri
|
|
|
34
34
|
return /* @__PURE__ */ jsx3("span", { className: classes, ...attributes, children: /* @__PURE__ */ jsx3("span", { className: `${componentClassName}__inner` }) });
|
|
35
35
|
};
|
|
36
36
|
|
|
37
|
-
// ../src/foundations/a11y/visually-hidden.tsx
|
|
38
|
-
import { jsx as jsx4 } from "preact/jsx-runtime";
|
|
39
|
-
var VisuallyHidden = ({ text }) => {
|
|
40
|
-
return /* @__PURE__ */ jsx4("span", { className: "visually-hidden", dangerouslySetInnerHTML: { __html: text } });
|
|
41
|
-
};
|
|
42
|
-
|
|
43
37
|
// ../src/components/button/button-base.tsx
|
|
44
|
-
import { Fragment, jsx as
|
|
45
|
-
var InnerButton = ({ text, isIconButton = false, attributes,
|
|
38
|
+
import { Fragment, jsx as jsx4, jsxs as jsxs2 } from "preact/jsx-runtime";
|
|
39
|
+
var InnerButton = ({ text, isIconButton = false, attributes, icon, loadingHtml }) => {
|
|
46
40
|
let optionalHtml;
|
|
47
|
-
if (!isIconButton) {
|
|
48
|
-
optionalHtml = /* @__PURE__ */
|
|
49
|
-
} else if (!
|
|
50
|
-
optionalHtml = /* @__PURE__ */
|
|
41
|
+
if (!isIconButton && attributes["aria-label"]) {
|
|
42
|
+
optionalHtml = /* @__PURE__ */ jsx4("span", { "aria-hidden": "true", children: text });
|
|
43
|
+
} else if (!isIconButton) {
|
|
44
|
+
optionalHtml = /* @__PURE__ */ jsx4("span", { children: text });
|
|
51
45
|
}
|
|
52
46
|
return /* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
53
47
|
optionalHtml,
|
|
@@ -65,8 +59,8 @@ var ToggleWrapper = ({
|
|
|
65
59
|
loadingHtml
|
|
66
60
|
}) => {
|
|
67
61
|
return /* @__PURE__ */ jsxs2("button", { type: "button", role: "switch", "aria-checked": selected, className: classes, ...attributes, disabled, children: [
|
|
68
|
-
/* @__PURE__ */
|
|
69
|
-
/* @__PURE__ */
|
|
62
|
+
/* @__PURE__ */ jsx4("span", { className: "ds-btn__off", "aria-hidden": "true", children: onChild }),
|
|
63
|
+
/* @__PURE__ */ jsx4("span", { className: "ds-btn__on", "aria-hidden": "true", children: offChild }),
|
|
70
64
|
loadingHtml
|
|
71
65
|
] });
|
|
72
66
|
};
|
|
@@ -86,13 +80,12 @@ var ButtonBase = ({
|
|
|
86
80
|
attributes = {},
|
|
87
81
|
forcePx = false,
|
|
88
82
|
isIconButton = false,
|
|
89
|
-
a11y = {},
|
|
90
83
|
selected = false,
|
|
91
84
|
isToggle = false,
|
|
92
85
|
selectedIconName,
|
|
93
86
|
selectedText
|
|
94
87
|
}) => {
|
|
95
|
-
if (
|
|
88
|
+
if (isIconButton && text && !attributes["aria-label"]) {
|
|
96
89
|
attributes["aria-label"] = text;
|
|
97
90
|
}
|
|
98
91
|
let spinnerVariant = "secondary";
|
|
@@ -101,10 +94,10 @@ var ButtonBase = ({
|
|
|
101
94
|
} else if (variant === "secondaryFilled" || variant === "secondaryOutline") {
|
|
102
95
|
spinnerVariant = "primary";
|
|
103
96
|
}
|
|
104
|
-
const loadingHtml = /* @__PURE__ */
|
|
97
|
+
const loadingHtml = /* @__PURE__ */ jsx4(Spinner, { ...{ size: "small", variant: spinnerVariant, forcePx, attributes: { "aria-hidden": "true" } } });
|
|
105
98
|
let icon;
|
|
106
99
|
if (iconName && (iconPosition != "none" || isIconButton == true)) {
|
|
107
|
-
icon = /* @__PURE__ */
|
|
100
|
+
icon = /* @__PURE__ */ jsx4(IconUse, { ...{ iconName, attributes: { "aria-hidden": "true" } } });
|
|
108
101
|
}
|
|
109
102
|
const classNamePrefix = "ds-btn--";
|
|
110
103
|
const classes = formatClassString([
|
|
@@ -125,30 +118,30 @@ var ButtonBase = ({
|
|
|
125
118
|
if (isToggle) {
|
|
126
119
|
let onChild, offChild;
|
|
127
120
|
if (isIconButton && iconName && selectedIconName) {
|
|
128
|
-
onChild = /* @__PURE__ */
|
|
129
|
-
offChild = /* @__PURE__ */
|
|
121
|
+
onChild = /* @__PURE__ */ jsx4(IconUse, { iconName });
|
|
122
|
+
offChild = /* @__PURE__ */ jsx4(IconUse, { iconName: selectedIconName });
|
|
130
123
|
} else {
|
|
131
|
-
onChild = /* @__PURE__ */
|
|
124
|
+
onChild = /* @__PURE__ */ jsx4("span", { children: text });
|
|
132
125
|
offChild = /* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
133
|
-
/* @__PURE__ */
|
|
134
|
-
/* @__PURE__ */
|
|
126
|
+
/* @__PURE__ */ jsx4(IconUse, { iconName: "check" }),
|
|
127
|
+
/* @__PURE__ */ jsx4("span", { children: selectedText })
|
|
135
128
|
] });
|
|
136
129
|
}
|
|
137
|
-
buttonToRender = /* @__PURE__ */
|
|
130
|
+
buttonToRender = /* @__PURE__ */ jsx4(ToggleWrapper, { ...{ selected, classes, attributes, disabled, onChild, offChild, loadingHtml } });
|
|
138
131
|
} else {
|
|
139
|
-
const buttonParams = { isIconButton,
|
|
132
|
+
const buttonParams = { isIconButton, text, icon, loadingHtml, attributes };
|
|
140
133
|
if (href) {
|
|
141
134
|
const params = { ...buttonParams, loadingHtml: null };
|
|
142
|
-
buttonToRender = /* @__PURE__ */
|
|
135
|
+
buttonToRender = /* @__PURE__ */ jsx4("a", { href, className: classes, ...attributes, children: /* @__PURE__ */ jsx4(InnerButton, { ...params }) });
|
|
143
136
|
} else {
|
|
144
|
-
buttonToRender = /* @__PURE__ */
|
|
137
|
+
buttonToRender = /* @__PURE__ */ jsx4("button", { type, className: classes, ...attributes, disabled, children: /* @__PURE__ */ jsx4(InnerButton, { ...buttonParams }) });
|
|
145
138
|
}
|
|
146
139
|
}
|
|
147
|
-
return /* @__PURE__ */
|
|
140
|
+
return /* @__PURE__ */ jsx4(Fragment, { children: buttonToRender });
|
|
148
141
|
};
|
|
149
142
|
|
|
150
143
|
// ../src/components/button/button.tsx
|
|
151
|
-
import { jsx as
|
|
144
|
+
import { jsx as jsx5 } from "preact/jsx-runtime";
|
|
152
145
|
var Button = ({
|
|
153
146
|
text,
|
|
154
147
|
disabled = false,
|
|
@@ -166,7 +159,7 @@ var Button = ({
|
|
|
166
159
|
attributes,
|
|
167
160
|
forcePx = false
|
|
168
161
|
}) => {
|
|
169
|
-
return /* @__PURE__ */
|
|
162
|
+
return /* @__PURE__ */ jsx5(ButtonBase, { ...{
|
|
170
163
|
text,
|
|
171
164
|
disabled,
|
|
172
165
|
variant,
|
|
@@ -186,7 +179,7 @@ var Button = ({
|
|
|
186
179
|
};
|
|
187
180
|
|
|
188
181
|
// ../src/components/buddy-menu/buddy-menu.tsx
|
|
189
|
-
import { jsx as
|
|
182
|
+
import { jsx as jsx6, jsxs as jsxs3 } from "preact/jsx-runtime";
|
|
190
183
|
var BuddyMenu = ({
|
|
191
184
|
userName,
|
|
192
185
|
links,
|
|
@@ -201,8 +194,8 @@ var BuddyMenu = ({
|
|
|
201
194
|
}) => {
|
|
202
195
|
const componentClassName = "ds-buddy-menu";
|
|
203
196
|
const classes = formatClassString([componentClassName, forcePx && "ds-force-px", classNames]);
|
|
204
|
-
return /* @__PURE__ */
|
|
205
|
-
/* @__PURE__ */
|
|
197
|
+
return /* @__PURE__ */ jsx6("div", { class: `${classes} ${isDnSkola && "ds-buddy-menu--skola"}`, ...attributes, children: /* @__PURE__ */ jsx6("div", { class: `${componentClassName}__inner`, children: /* @__PURE__ */ jsx6("div", { class: "ds-buddy-menu__scrollable-container", children: /* @__PURE__ */ jsxs3("div", { class: "ds-buddy-menu__content", children: [
|
|
198
|
+
/* @__PURE__ */ jsx6(
|
|
206
199
|
Button,
|
|
207
200
|
{
|
|
208
201
|
...{
|
|
@@ -219,17 +212,17 @@ var BuddyMenu = ({
|
|
|
219
212
|
/* @__PURE__ */ jsxs3("span", { class: "ds-buddy-menu__greeting", children: [
|
|
220
213
|
"Hej",
|
|
221
214
|
" ",
|
|
222
|
-
/* @__PURE__ */
|
|
215
|
+
/* @__PURE__ */ jsx6("span", { class: "ds-buddy-menu__name js-buddy-menu-name", "data-name-type": "given", children: userName }),
|
|
223
216
|
"!"
|
|
224
217
|
] }),
|
|
225
218
|
!isDnSkola && /* @__PURE__ */ jsxs3("div", { class: "ds-buddy-menu__account", children: [
|
|
226
|
-
/* @__PURE__ */
|
|
227
|
-
/* @__PURE__ */
|
|
219
|
+
/* @__PURE__ */ jsx6("h2", { class: "ds-buddy-menu__account-title", children: "Min prenumeration" }),
|
|
220
|
+
/* @__PURE__ */ jsx6("span", { class: "ds-buddy-menu__account-level js-buddy-menu__account-level", children: accountLevel }),
|
|
228
221
|
addons && /* @__PURE__ */ jsxs3("div", { class: `ds-buddy-menu__addons ${addonsClassNames}`, children: [
|
|
229
|
-
/* @__PURE__ */
|
|
230
|
-
/* @__PURE__ */
|
|
222
|
+
/* @__PURE__ */ jsx6("h2", { class: "ds-buddy-menu__addons-title", children: "Mina till\xE4gg" }),
|
|
223
|
+
/* @__PURE__ */ jsx6("ul", { class: "ds-buddy-menu__addons-list", children: addons.map((addon) => /* @__PURE__ */ jsx6("li", { class: addon.classNames, children: /* @__PURE__ */ jsx6("a", { href: addon.href, children: addon.title }) })) })
|
|
231
224
|
] }),
|
|
232
|
-
/* @__PURE__ */
|
|
225
|
+
/* @__PURE__ */ jsx6(
|
|
233
226
|
Button,
|
|
234
227
|
{
|
|
235
228
|
...{
|
|
@@ -246,8 +239,8 @@ var BuddyMenu = ({
|
|
|
246
239
|
] })
|
|
247
240
|
] }),
|
|
248
241
|
/* @__PURE__ */ jsxs3("div", { class: "ds-buddy-menu__links", children: [
|
|
249
|
-
/* @__PURE__ */
|
|
250
|
-
/* @__PURE__ */
|
|
242
|
+
/* @__PURE__ */ jsx6("h2", { class: "ds-buddy-menu__links-title", children: "Mitt inneh\xE5ll" }),
|
|
243
|
+
/* @__PURE__ */ jsx6("ul", { class: "ds-buddy-menu__links-list", children: links })
|
|
251
244
|
] })
|
|
252
245
|
] }) }) }) });
|
|
253
246
|
};
|