@bonniernews/dn-design-system-web 32.7.44 → 32.7.46-beta.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/.prettierignore +10 -0
- package/.prettierrc +20 -1
- package/CHANGELOG.md +7 -0
- package/assets/types/shared-props.ts +6 -6
- package/assets/types/teaser-props.ts +20 -20
- package/components/article-body-image/README.md +1 -1
- package/components/article-top-image/README.md +1 -1
- package/components/blocked-content/README.md +1 -1
- package/components/blocked-content/blocked-content.js +16 -19
- package/components/buddy-menu/README.md +1 -1
- package/components/button/README.md +3 -4
- package/components/button/button-interactions.js +11 -14
- package/components/button/button-types.ts +29 -36
- package/components/button-toggle/README.md +1 -1
- package/components/byline/README.md +1 -1
- package/components/byline/byline-interaction.js +5 -5
- package/components/byline-list/README.md +1 -1
- package/components/byline-list/byline-list.js +3 -6
- package/components/checkbox/README.md +1 -1
- package/components/direkt-circle/README.md +1 -1
- package/components/direkt-header/README.md +1 -1
- package/components/disclaimer/README.md +1 -1
- package/components/divider/README.md +1 -1
- package/components/empty-state/README.md +1 -1
- package/components/factbox/README.md +1 -1
- package/components/factbox/factbox.js +6 -9
- package/components/footer/README.md +1 -1
- package/components/game-header/README.md +1 -1
- package/components/group-header/README.md +1 -1
- package/components/image-caption/README.md +1 -1
- package/components/link-box/README.md +1 -1
- package/components/list-item/README.md +1 -1
- package/components/list-item/list-item-types.ts +4 -3
- package/components/list-item/list-item.js +5 -8
- package/components/mask/README.md +1 -1
- package/components/modal/README.md +1 -1
- package/components/modal/modal.js +20 -24
- package/components/pagination/README.md +1 -1
- package/components/pictogram/README.md +1 -1
- package/components/pill/README.md +1 -1
- package/components/profile-header/README.md +1 -1
- package/components/quote/README.md +1 -1
- package/components/radio-button/README.md +1 -1
- package/components/spinner/README.md +1 -1
- package/components/switch/README.md +1 -1
- package/components/tag-header/README.md +1 -1
- package/components/teaser-card/README.md +1 -1
- package/components/teaser-centered/README.md +2 -2
- package/components/teaser-counter/README.md +2 -2
- package/components/teaser-dot/README.md +1 -1
- package/components/teaser-footer/README.md +1 -1
- package/components/teaser-image/README.md +1 -1
- package/components/teaser-large/README.md +2 -2
- package/components/teaser-list-swipe/README.md +1 -1
- package/components/teaser-list-vertical/README.md +1 -1
- package/components/teaser-list-vertical/teaser-list-vertical.js +7 -10
- package/components/teaser-longlife/README.md +1 -1
- package/components/teaser-onsite/README.md +2 -2
- package/components/teaser-package/README.md +1 -1
- package/components/teaser-right-now/README.md +2 -2
- package/components/teaser-slideshow/README.md +1 -1
- package/components/teaser-standard/README.md +2 -2
- package/components/teaser-standard/teaser-standard.js +11 -14
- package/components/teaser-swipe-card/README.md +2 -2
- package/components/teaser-text-on-image/README.md +2 -2
- package/components/teaser-tipsa/README.md +2 -2
- package/components/text-button/README.md +1 -1
- package/components/text-button-toggle/README.md +1 -1
- package/components/text-button-toggle/text-button-toggle.js +7 -10
- package/components/text-input/README.md +1 -1
- package/components/text-input/text-input-interactions.js +16 -16
- package/components/text-input/text-input.js +10 -10
- package/components/thematic-break/README.md +1 -1
- package/components/tooltip/README.md +1 -1
- package/components/tooltip/tooltip.js +11 -17
- package/components/video-caption/README.md +1 -1
- package/helpers/formatClassString.ts +2 -2
- package/index.d.ts +1 -1
- package/package.json +5 -1
- package/preact/assets/article-image/article-image.d.ts +1 -1
- package/preact/assets/form-field/form-field.d.ts +2 -2
- package/preact/components/article-body-image/article-body-image.d.ts +2 -2
- package/preact/components/article-body-image/article-body-image.js +1 -5
- package/preact/components/article-body-image/article-body-image.js.map +2 -2
- package/preact/components/article-top-image/article-top-image.d.ts +2 -2
- package/preact/components/article-top-image/article-top-image.js +10 -6
- package/preact/components/article-top-image/article-top-image.js.map +2 -2
- package/preact/components/blocked-content/blocked-content.d.ts +2 -2
- package/preact/components/blocked-content/blocked-content.js +23 -22
- package/preact/components/blocked-content/blocked-content.js.map +2 -2
- package/preact/components/buddy-menu/buddy-menu.d.ts +2 -2
- package/preact/components/buddy-menu/buddy-menu.js +22 -17
- package/preact/components/buddy-menu/buddy-menu.js.map +2 -2
- package/preact/components/button/button-base.js.map +2 -2
- package/preact/components/button/button.d.ts +4 -4
- package/preact/components/button/button.js +22 -17
- package/preact/components/button/button.js.map +2 -2
- package/preact/components/button-toggle/button-toggle.d.ts +2 -2
- package/preact/components/button-toggle/button-toggle.js.map +2 -2
- package/preact/components/byline/byline.d.ts +2 -2
- package/preact/components/byline/byline.js +185 -170
- package/preact/components/byline/byline.js.map +3 -3
- package/preact/components/byline-list/byline-list.d.ts +4 -4
- package/preact/components/byline-list/byline-list.js +32 -21
- package/preact/components/byline-list/byline-list.js.map +2 -2
- package/preact/components/checkbox/checkbox.d.ts +2 -2
- package/preact/components/checkbox/checkbox.js +9 -1
- package/preact/components/checkbox/checkbox.js.map +2 -2
- package/preact/components/direkt-circle/direkt-circle.d.ts +2 -2
- package/preact/components/direkt-circle/direkt-circle.js.map +2 -2
- package/preact/components/direkt-header/direkt-header.d.ts +2 -2
- package/preact/components/direkt-header/direkt-header.js.map +2 -2
- package/preact/components/disclaimer/disclaimer.d.ts +3 -3
- package/preact/components/disclaimer/disclaimer.js.map +2 -2
- package/preact/components/divider/divider.d.ts +2 -2
- package/preact/components/divider/divider.js +1 -5
- package/preact/components/divider/divider.js.map +2 -2
- package/preact/components/empty-state/empty-state.d.ts +2 -2
- package/preact/components/empty-state/empty-state.js +31 -23
- package/preact/components/empty-state/empty-state.js.map +2 -2
- package/preact/components/factbox/factbox.d.ts +5 -5
- package/preact/components/factbox/factbox.js +448 -293
- package/preact/components/factbox/factbox.js.map +4 -4
- package/preact/components/footer/footer.d.ts +2 -2
- package/preact/components/footer/footer.js +18 -9
- package/preact/components/footer/footer.js.map +2 -2
- package/preact/components/game-header/game-header.d.ts +3 -3
- package/preact/components/game-header/game-header.js +17 -6
- package/preact/components/game-header/game-header.js.map +2 -2
- package/preact/components/group-header/group-header.d.ts +2 -2
- package/preact/components/group-header/group-header.js +22 -17
- package/preact/components/group-header/group-header.js.map +2 -2
- package/preact/components/icon-sprite/icon-sprite.d.ts +2 -2
- package/preact/components/icon-sprite/icon-sprite.js +5 -5
- package/preact/components/icon-sprite/icon-sprite.js.map +3 -3
- package/preact/components/icon-with-wrapper/icon-with-wrapper.d.ts +3 -3
- package/preact/components/icon-with-wrapper/icon-with-wrapper.js +13 -6
- package/preact/components/icon-with-wrapper/icon-with-wrapper.js.map +3 -3
- package/preact/components/image-caption/image-caption.d.ts +2 -2
- package/preact/components/image-caption/image-caption.js +1 -5
- package/preact/components/image-caption/image-caption.js.map +2 -2
- package/preact/components/link-box/link-box-item.d.ts +1 -1
- package/preact/components/link-box/link-box-item.js.map +2 -2
- package/preact/components/link-box/link-box.d.ts +3 -3
- package/preact/components/link-box/link-box.js +23 -21
- package/preact/components/link-box/link-box.js.map +2 -2
- package/preact/components/list-item/list-item-types.d.ts +3 -3
- package/preact/components/list-item/list-item.d.ts +1 -1
- package/preact/components/list-item/list-item.js +208 -206
- package/preact/components/list-item/list-item.js.map +4 -4
- package/preact/components/mask/mask.d.ts +3 -3
- package/preact/components/mask/mask.js.map +2 -2
- package/preact/components/modal/modal.d.ts +2 -2
- package/preact/components/modal/modal.js +22 -17
- package/preact/components/modal/modal.js.map +2 -2
- package/preact/components/pagination/pagination.d.ts +1 -1
- package/preact/components/pagination/pagination.js +3 -20
- package/preact/components/pagination/pagination.js.map +2 -2
- package/preact/components/pictogram/pictogram.d.ts +2 -2
- package/preact/components/pictogram/pictogram.js +8 -1
- package/preact/components/pictogram/pictogram.js.map +2 -2
- package/preact/components/pill/pill.d.ts +3 -3
- package/preact/components/pill/pill.js +1 -8
- package/preact/components/pill/pill.js.map +2 -2
- package/preact/components/profile-header/profile-header.d.ts +3 -3
- package/preact/components/profile-header/profile-header.js.map +2 -2
- package/preact/components/quote/quote.d.ts +2 -2
- package/preact/components/quote/quote.js +1 -6
- package/preact/components/quote/quote.js.map +2 -2
- package/preact/components/radio-button/radio-button.d.ts +2 -2
- package/preact/components/radio-button/radio-button.js +9 -1
- package/preact/components/radio-button/radio-button.js.map +2 -2
- package/preact/components/spinner/spinner.d.ts +2 -2
- package/preact/components/spinner/spinner.js.map +2 -2
- package/preact/components/switch/switch.d.ts +2 -2
- package/preact/components/switch/switch.js.map +2 -2
- package/preact/components/tag-header/tag-header.d.ts +2 -2
- package/preact/components/tag-header/tag-header.js.map +2 -2
- package/preact/components/teaser-card/teaser-card.d.ts +4 -4
- package/preact/components/teaser-card/teaser-card.js +9 -2
- package/preact/components/teaser-card/teaser-card.js.map +2 -2
- package/preact/components/teaser-centered/teaser-centered.d.ts +4 -4
- package/preact/components/teaser-centered/teaser-centered.js +48 -40
- package/preact/components/teaser-centered/teaser-centered.js.map +4 -4
- package/preact/components/teaser-counter/teaser-counter.d.ts +2 -2
- package/preact/components/teaser-counter/teaser-counter.js +31 -24
- package/preact/components/teaser-counter/teaser-counter.js.map +4 -4
- package/preact/components/teaser-dot/teaser-dot.d.ts +3 -3
- package/preact/components/teaser-dot/teaser-dot.js +1 -6
- package/preact/components/teaser-dot/teaser-dot.js.map +2 -2
- package/preact/components/teaser-footer/teaser-footer.d.ts +2 -2
- package/preact/components/teaser-footer/teaser-footer.js.map +2 -2
- package/preact/components/teaser-image/teaser-image.d.ts +3 -3
- package/preact/components/teaser-image/teaser-image.js +1 -5
- package/preact/components/teaser-image/teaser-image.js.map +2 -2
- package/preact/components/teaser-large/teaser-large.d.ts +3 -3
- package/preact/components/teaser-large/teaser-large.js +72 -73
- package/preact/components/teaser-large/teaser-large.js.map +4 -4
- package/preact/components/teaser-list-swipe/teaser-list-swipe.d.ts +1 -1
- package/preact/components/teaser-list-swipe/teaser-list-swipe.js +59 -48
- package/preact/components/teaser-list-swipe/teaser-list-swipe.js.map +4 -4
- package/preact/components/teaser-list-vertical/teaser-list-vertical.d.ts +2 -2
- package/preact/components/teaser-list-vertical/teaser-list-vertical.js +22 -17
- package/preact/components/teaser-list-vertical/teaser-list-vertical.js.map +2 -2
- package/preact/components/teaser-longlife/teaser-longlife.d.ts +1 -1
- package/preact/components/teaser-longlife/teaser-longlife.js +33 -27
- package/preact/components/teaser-longlife/teaser-longlife.js.map +4 -4
- package/preact/components/teaser-native/teaser-native.d.ts +2 -2
- package/preact/components/teaser-native/teaser-native.js +36 -35
- package/preact/components/teaser-native/teaser-native.js.map +4 -4
- package/preact/components/teaser-onsite/teaser-onsite.d.ts +4 -4
- package/preact/components/teaser-onsite/teaser-onsite.js +44 -37
- package/preact/components/teaser-onsite/teaser-onsite.js.map +4 -4
- package/preact/components/teaser-package/teaser-package.d.ts +2 -2
- package/preact/components/teaser-package/teaser-package.js +32 -18
- package/preact/components/teaser-package/teaser-package.js.map +2 -2
- package/preact/components/teaser-right-now/teaser-right-now.d.ts +4 -4
- package/preact/components/teaser-right-now/teaser-right-now.js +37 -28
- package/preact/components/teaser-right-now/teaser-right-now.js.map +4 -4
- package/preact/components/teaser-slideshow/teaser-slideshow.d.ts +3 -3
- package/preact/components/teaser-slideshow/teaser-slideshow.js +43 -34
- package/preact/components/teaser-slideshow/teaser-slideshow.js.map +4 -4
- package/preact/components/teaser-split/teaser-split.d.ts +3 -3
- package/preact/components/teaser-split/teaser-split.js +10 -9
- package/preact/components/teaser-split/teaser-split.js.map +2 -2
- package/preact/components/teaser-standard/teaser-standard.d.ts +1 -1
- package/preact/components/teaser-standard/teaser-standard.js +10 -9
- package/preact/components/teaser-standard/teaser-standard.js.map +2 -2
- package/preact/components/teaser-swipe-card/teaser-swipe-card.d.ts +1 -1
- package/preact/components/teaser-swipe-card/teaser-swipe-card.js +30 -24
- package/preact/components/teaser-swipe-card/teaser-swipe-card.js.map +4 -4
- package/preact/components/teaser-text-on-image/teaser-text-on-image.d.ts +4 -4
- package/preact/components/teaser-text-on-image/teaser-text-on-image.js +45 -37
- package/preact/components/teaser-text-on-image/teaser-text-on-image.js.map +4 -4
- package/preact/components/teaser-tipsa/teaser-tipsa.d.ts +2 -2
- package/preact/components/teaser-tipsa/teaser-tipsa.js +33 -32
- package/preact/components/teaser-tipsa/teaser-tipsa.js.map +4 -4
- package/preact/components/text-button/text-button.d.ts +2 -2
- package/preact/components/text-button/text-button.js +4 -4
- package/preact/components/text-button/text-button.js.map +3 -3
- package/preact/components/text-button-toggle/text-button-toggle.d.ts +3 -3
- package/preact/components/text-button-toggle/text-button-toggle.js.map +2 -2
- package/preact/components/text-input/text-input.d.ts +2 -2
- package/preact/components/text-input/text-input.js +9 -1
- package/preact/components/text-input/text-input.js.map +2 -2
- package/preact/components/thematic-break/thematic-break.d.ts +2 -2
- package/preact/components/thematic-break/thematic-break.js +1 -4
- package/preact/components/thematic-break/thematic-break.js.map +2 -2
- package/preact/components/tooltip/tooltip.d.ts +2 -2
- package/preact/components/tooltip/tooltip.js +22 -17
- package/preact/components/tooltip/tooltip.js.map +2 -2
- package/preact/components/video-caption/video-caption.d.ts +2 -2
- package/preact/components/video-caption/video-caption.js +6 -10
- package/preact/components/video-caption/video-caption.js.map +3 -3
- package/types-lib/ds-color.d.ts +95 -95
- package/types-lib/ds-icon.d.ts +98 -98
- package/preact/assets/types/shared-props.d.ts +0 -6
- package/preact/assets/types/teaser-props.d.ts +0 -44
- package/preact/foundations/a11y/visually-hidden.d.ts +0 -4
- package/preact/foundations/icons/grade-icon.d.ts +0 -9
- package/preact/helpers/formatClassString.d.ts +0 -1
- package/preact/helpers/stringToHtml.d.ts +0 -6
- package/preact/helpers/teaser.d.ts +0 -21
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
TeaserTextOnImage
|
|
2
2
|
=================
|
|
3
3
|
|
|
4
|
-
* GitHub: [BonnierNews/dn-design-system
|
|
4
|
+
* GitHub: [BonnierNews/dn-design-system/web/src/components/teaser-text-on-image](https://github.com/BonnierNews/dn-design-system/tree/main/web/src/components/teaser-text-on-image)
|
|
5
5
|
* Storybook: [TeaserTextOnImage](https://designsystem.dn.se/?path=/docs/section-teasertextonimage--docs)
|
|
6
6
|
|
|
7
7
|
The component will not include styling by itself. Make sure to include the right styles for the component. See example below: `@use '@bonniernews/dn-design-system-web/components/teaser-text-on-image)/teaser-text-on-image.scss'`
|
|
@@ -11,7 +11,7 @@ The component will not include styling by itself. Make sure to include the right
|
|
|
11
11
|
| classNames | Ex. "my-special-class"<br />string | \- |
|
|
12
12
|
| attributes | Ex. { target: "\_blank", "data-test": "lorem ipsum" }<br />Record<string, unknown> | \- |
|
|
13
13
|
| targetLink\* | Target URL for the teaser<br />string | \- |
|
|
14
|
-
| areaType | The area where the column is rendered<br />"right", "bauta" | \- |
|
|
14
|
+
| areaType | The area where the column is rendered<br />"right", "bauta", "main" | \- |
|
|
15
15
|
| title\* | Heading of the teaser<br />string | \- |
|
|
16
16
|
| text | Teaser subtext<br />string | \- |
|
|
17
17
|
| vignette | Top text in the teaser<br />string | \- |
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
TeaserTipsa
|
|
2
2
|
===========
|
|
3
3
|
|
|
4
|
-
* GitHub: [BonnierNews/dn-design-system
|
|
4
|
+
* GitHub: [BonnierNews/dn-design-system/web/src/components/teaser-tipsa](https://github.com/BonnierNews/dn-design-system/tree/main/web/src/components/teaser-tipsa)
|
|
5
5
|
* Storybook: [TeaserTipsa](https://designsystem.dn.se/?path=/docs/section-teasertipsa--docs)
|
|
6
6
|
|
|
7
7
|
The component will not include styling by itself. Make sure to include the right styles for the component. See example below: `@use '@bonniernews/dn-design-system-web/components/teaser-tipsa/teaser-tipsa.scss'`
|
|
@@ -11,7 +11,7 @@ The component will not include styling by itself. Make sure to include the right
|
|
|
11
11
|
| classNames | Ex. "my-special-class"<br />string | \- |
|
|
12
12
|
| attributes | Ex. { target: "\_blank", "data-test": "lorem ipsum" }<br />Record<string, unknown> | { } |
|
|
13
13
|
| targetLink\* | Target URL for the teaser<br />string | \- |
|
|
14
|
-
| areaType | The area where the column is rendered<br />"right", "bauta" | \- |
|
|
14
|
+
| areaType | The area where the column is rendered<br />"right", "bauta", "main" | \- |
|
|
15
15
|
| title\* | Heading of the teaser<br />string | \- |
|
|
16
16
|
| text | Teaser subtext<br />string | \- |
|
|
17
17
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
TextButton
|
|
2
2
|
==========
|
|
3
3
|
|
|
4
|
-
* GitHub: [BonnierNews/dn-design-system
|
|
4
|
+
* GitHub: [BonnierNews/dn-design-system/web/src/components/text-button](https://github.com/BonnierNews/dn-design-system/tree/main/web/src/components/text-button)
|
|
5
5
|
* Storybook: [TextButton](https://designsystem.dn.se/?path=/docs/basic-buttons-textbutton--docs)
|
|
6
6
|
|
|
7
7
|
| Name | Description | Default |
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
TextButtonToggle
|
|
2
2
|
================
|
|
3
3
|
|
|
4
|
-
* GitHub: [BonnierNews/dn-design-system
|
|
4
|
+
* GitHub: [BonnierNews/dn-design-system/web/src/components/text-button-toggle](https://github.com/BonnierNews/dn-design-system/tree/main/web/src/components/text-button-toggle)
|
|
5
5
|
* Storybook: [TextButtonToggle](https://designsystem.dn.se/?path=/docs/basic-buttons-textbuttontoggle--docs)
|
|
6
6
|
|
|
7
7
|
The component will not include styling by itself. Make sure to include the right styles for the component. See example below: `@use '@bonniernews/dn-design-system-web/components/text-button-toggle/text-button-toggle.scss'`
|
|
@@ -1,21 +1,18 @@
|
|
|
1
|
-
export {
|
|
2
|
-
dsTextButtonToggle,
|
|
3
|
-
dsTextButtonToggleAll
|
|
4
|
-
};
|
|
1
|
+
export { dsTextButtonToggle, dsTextButtonToggleAll };
|
|
5
2
|
|
|
6
3
|
function dsTextButtonToggle(toggleElements = []) {
|
|
7
4
|
if (!toggleElements.length) return;
|
|
8
5
|
toggleElements.forEach((toggleEl) => {
|
|
9
|
-
toggleEl.addEventListener(
|
|
10
|
-
if (toggleEl.classList.contains(
|
|
11
|
-
toggleEl.classList.toggle(
|
|
12
|
-
const ariaChecked = toggleEl.getAttribute(
|
|
13
|
-
toggleEl.setAttribute(
|
|
6
|
+
toggleEl.addEventListener('click', () => {
|
|
7
|
+
if (toggleEl.classList.contains('ds-text-btn-toggle--disabled')) return;
|
|
8
|
+
toggleEl.classList.toggle('ds-text-btn-toggle--selected');
|
|
9
|
+
const ariaChecked = toggleEl.getAttribute('aria-checked') === 'true' ? 'false' : 'true';
|
|
10
|
+
toggleEl.setAttribute('aria-checked', ariaChecked);
|
|
14
11
|
});
|
|
15
12
|
});
|
|
16
13
|
}
|
|
17
14
|
|
|
18
15
|
function dsTextButtonToggleAll() {
|
|
19
|
-
const toggleElements = Array.from(document.getElementsByClassName(
|
|
16
|
+
const toggleElements = Array.from(document.getElementsByClassName('ds-text-btn-toggle'));
|
|
20
17
|
dsTextButtonToggle(toggleElements);
|
|
21
18
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
TextInput
|
|
2
2
|
=========
|
|
3
3
|
|
|
4
|
-
* GitHub: [BonnierNews/dn-design-system
|
|
4
|
+
* GitHub: [BonnierNews/dn-design-system/web/src/components/text-input](https://github.com/BonnierNews/dn-design-system/tree/main/web/src/components/text-input)
|
|
5
5
|
* Storybook: [Form > TextInput](https://designsystem.dn.se/?path=/docs/basic-form-textinput--docs)
|
|
6
6
|
|
|
7
7
|
The component will not include styling by itself. Make sure to include the right styles for the component. See example below: `@use "@bonniernews/dn-design-system-web/components/text-input/text-input";`
|
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
export const textInput = () => {
|
|
2
2
|
function passwordToggle(id, toggle) {
|
|
3
|
-
var x = document.getElementById(id)
|
|
3
|
+
var x = document.getElementById(id);
|
|
4
4
|
if (x.type === 'password') {
|
|
5
|
-
x.type = 'text'
|
|
6
|
-
toggle.classList.add('ds-btn--selected')
|
|
7
|
-
toggle.setAttribute('aria-checked', 'true')
|
|
8
|
-
toggle.setAttribute('aria-label', 'Dölj lösenord')
|
|
5
|
+
x.type = 'text';
|
|
6
|
+
toggle.classList.add('ds-btn--selected');
|
|
7
|
+
toggle.setAttribute('aria-checked', 'true');
|
|
8
|
+
toggle.setAttribute('aria-label', 'Dölj lösenord');
|
|
9
9
|
} else {
|
|
10
|
-
x.type = 'password'
|
|
11
|
-
toggle.classList.remove('ds-btn--selected')
|
|
12
|
-
toggle.setAttribute('aria-checked', 'false')
|
|
13
|
-
toggle.setAttribute('aria-label', 'Visa lösenord')
|
|
10
|
+
x.type = 'password';
|
|
11
|
+
toggle.classList.remove('ds-btn--selected');
|
|
12
|
+
toggle.setAttribute('aria-checked', 'false');
|
|
13
|
+
toggle.setAttribute('aria-label', 'Visa lösenord');
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
const passwordInputs = document.querySelectorAll('.ds-text-input [type=password]')
|
|
17
|
+
const passwordInputs = document.querySelectorAll('.ds-text-input [type=password]');
|
|
18
18
|
passwordInputs.forEach((input) => {
|
|
19
|
-
const toggle = document.getElementById(`${input.id}-password-toggle`)
|
|
19
|
+
const toggle = document.getElementById(`${input.id}-password-toggle`);
|
|
20
20
|
if (toggle) {
|
|
21
21
|
toggle.addEventListener('click', () => {
|
|
22
|
-
passwordToggle(input.id, toggle)
|
|
23
|
-
})
|
|
22
|
+
passwordToggle(input.id, toggle);
|
|
23
|
+
});
|
|
24
24
|
}
|
|
25
|
-
})
|
|
26
|
-
}
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
27
|
|
|
28
|
-
export default textInput
|
|
28
|
+
export default textInput;
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
const textInput = () => {
|
|
2
2
|
function passwordToggle(id) {
|
|
3
|
-
var x = document.getElementById(id)
|
|
3
|
+
var x = document.getElementById(id);
|
|
4
4
|
if (x.type === 'password') {
|
|
5
|
-
x.type = 'text'
|
|
5
|
+
x.type = 'text';
|
|
6
6
|
} else {
|
|
7
|
-
x.type = 'password'
|
|
7
|
+
x.type = 'password';
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
const passwordInputs = document.querySelectorAll('.ds-text-input [type=password]')
|
|
11
|
+
const passwordInputs = document.querySelectorAll('.ds-text-input [type=password]');
|
|
12
12
|
passwordInputs.forEach((input) => {
|
|
13
|
-
const toggle = document.getElementById(`${input.id}-password-toggle`)
|
|
13
|
+
const toggle = document.getElementById(`${input.id}-password-toggle`);
|
|
14
14
|
if (toggle) {
|
|
15
15
|
toggle.addEventListener('click', () => {
|
|
16
|
-
passwordToggle(input.id)
|
|
17
|
-
})
|
|
16
|
+
passwordToggle(input.id);
|
|
17
|
+
});
|
|
18
18
|
}
|
|
19
|
-
})
|
|
20
|
-
}
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
21
|
|
|
22
|
-
export default textInput
|
|
22
|
+
export default textInput;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
ThematicBreak
|
|
2
2
|
=============
|
|
3
3
|
|
|
4
|
-
* GitHub: [BonnierNews/dn-design-system
|
|
4
|
+
* GitHub: [BonnierNews/dn-design-system/web/src/components/thematic-break](https://github.com/BonnierNews/dn-design-system/tree/main/web/src/components/thematic-break)
|
|
5
5
|
* Storybook: [ThematicBreak](https://designsystem.dn.se/?path=/docs/article-thematicbreak--docs)
|
|
6
6
|
|
|
7
7
|
The component will not include styling by itself. Make sure to include the right styles for the component. See example below: `@use '@bonniernews/dn-design-system-web/components/thematic-break/thematic-break.scss'`
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Tooltip
|
|
2
2
|
=======
|
|
3
3
|
|
|
4
|
-
* GitHub: [BonnierNews/dn-design-system
|
|
4
|
+
* GitHub: [BonnierNews/dn-design-system/web/src/components/tooltip](https://github.com/BonnierNews/dn-design-system/tree/main/web/src/components/tooltip)
|
|
5
5
|
* Storybook: [Tooltip](https://designsystem.dn.se/?path=/docs/basic-tooltip--docs)
|
|
6
6
|
|
|
7
7
|
The component will not include styling by itself. Make sure to include the right styles for the component. See example below: `@use '@bonniernews/dn-design-system-web/components/tooltip/tooltip.scss'`
|
|
@@ -1,35 +1,29 @@
|
|
|
1
|
-
export {
|
|
2
|
-
initTooltip,
|
|
3
|
-
openTooltip,
|
|
4
|
-
closeTooltip,
|
|
5
|
-
toggleTooltip,
|
|
6
|
-
initTooltipStorybook
|
|
7
|
-
}
|
|
1
|
+
export { initTooltip, openTooltip, closeTooltip, toggleTooltip, initTooltipStorybook };
|
|
8
2
|
|
|
9
|
-
const TOOLTIP_HIDDEN =
|
|
3
|
+
const TOOLTIP_HIDDEN = 'ds-tooltip--hidden';
|
|
10
4
|
|
|
11
5
|
let setupTooltipClickListener = true;
|
|
12
6
|
|
|
13
7
|
function initTooltip(tooltipEl) {
|
|
14
|
-
const tooltipsClosingOnOutsideClick = document.getElementsByClassName(
|
|
15
|
-
|
|
8
|
+
const tooltipsClosingOnOutsideClick = document.getElementsByClassName('ds-tooltip--close-outside-click');
|
|
9
|
+
|
|
16
10
|
if (setupTooltipClickListener && tooltipsClosingOnOutsideClick.length > 0) {
|
|
17
11
|
setupTooltipClickListener = false;
|
|
18
12
|
|
|
19
|
-
document.addEventListener(
|
|
20
|
-
const tooltipClick = e.target.closest(
|
|
13
|
+
document.addEventListener('click', (e) => {
|
|
14
|
+
const tooltipClick = e.target.closest('.ds-tooltip');
|
|
21
15
|
if (tooltipClick) return;
|
|
22
|
-
|
|
16
|
+
|
|
23
17
|
const tooltipsToClose = document.getElementsByClassName('ds-tooltip--close-outside-click');
|
|
24
18
|
for (const tooltip of tooltipsToClose) {
|
|
25
|
-
closeTooltip(tooltip)
|
|
19
|
+
closeTooltip(tooltip);
|
|
26
20
|
}
|
|
27
21
|
});
|
|
28
22
|
}
|
|
29
23
|
|
|
30
|
-
const closeButtons = Array.from(tooltipEl.getElementsByClassName(
|
|
24
|
+
const closeButtons = Array.from(tooltipEl.getElementsByClassName('ds-tooltip__close'));
|
|
31
25
|
closeButtons.forEach((button) => {
|
|
32
|
-
button.addEventListener(
|
|
26
|
+
button.addEventListener('click', () => {
|
|
33
27
|
closeTooltip(tooltipEl);
|
|
34
28
|
});
|
|
35
29
|
});
|
|
@@ -51,7 +45,7 @@ function closeTooltip(tooltipEl) {
|
|
|
51
45
|
}
|
|
52
46
|
|
|
53
47
|
function initTooltipStorybook() {
|
|
54
|
-
const tooltips = Array.from(document.getElementsByClassName(
|
|
48
|
+
const tooltips = Array.from(document.getElementsByClassName('ds-tooltip'));
|
|
55
49
|
tooltips.forEach((tooltipEl) => {
|
|
56
50
|
initTooltip(tooltipEl);
|
|
57
51
|
openTooltip(tooltipEl);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
VideoCaption
|
|
2
2
|
============
|
|
3
3
|
|
|
4
|
-
* GitHub: [BonnierNews/dn-design-system
|
|
4
|
+
* GitHub: [BonnierNews/dn-design-system/web/src/components/video-caption](https://github.com/BonnierNews/dn-design-system/tree/main/web/src/components/video-caption)
|
|
5
5
|
* Storybook: [VideoCaption](https://designsystem.dn.se/?path=/docs/article-videocaption--docs)
|
|
6
6
|
|
|
7
7
|
The component will not include styling by itself. Make sure to include the right styles for the component. See example below: `@use '@bonniernews/dn-design-system-web/components/video-caption/video-caption.scss'`
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export const formatClassString = (classesArray: (string|undefined|false)[]): string => {
|
|
2
|
-
return classesArray.filter(x => !!x).join(' ')
|
|
1
|
+
export const formatClassString = (classesArray: (string | undefined | false)[]): string => {
|
|
2
|
+
return classesArray.filter((x) => !!x).join(' ')
|
|
3
3
|
}
|
package/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bonniernews/dn-design-system-web",
|
|
3
|
-
"version": "32.7.
|
|
3
|
+
"version": "32.7.46-beta.0",
|
|
4
4
|
"description": "DN design system for web.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"homepage": "https://github.com/BonnierNews/dn-design-system/tree/main/web/src#readme",
|
|
@@ -42,10 +42,12 @@
|
|
|
42
42
|
"@commitlint/cli": "^18.4.3",
|
|
43
43
|
"@commitlint/config-conventional": "^18.4.3",
|
|
44
44
|
"@release-it/conventional-changelog": "^8.0.1",
|
|
45
|
+
"@trivago/prettier-plugin-sort-imports": "^5.2.2",
|
|
45
46
|
"conventional-changelog-conventionalcommits": "^6.1.0",
|
|
46
47
|
"node-html-parser": "^7.0.1",
|
|
47
48
|
"postcss": "8.4.31",
|
|
48
49
|
"preact": "^10.24.0",
|
|
50
|
+
"prettier": "^3.0.1",
|
|
49
51
|
"release-it": "^17.0.0",
|
|
50
52
|
"stylelint": "^15.11.0",
|
|
51
53
|
"stylelint-config-recommended-scss": "^13.1.0",
|
|
@@ -56,6 +58,8 @@
|
|
|
56
58
|
},
|
|
57
59
|
"scripts": {
|
|
58
60
|
"lint:styles": "yarn stylelint \"**/*.scss\" \"!node_modules/\"",
|
|
61
|
+
"prettier-src-check": "prettier --check . --config ./.prettierrc",
|
|
62
|
+
"prettier-src-fix": "prettier --write . --config ./.prettierrc",
|
|
59
63
|
"release:web": "release-it --ci --vv",
|
|
60
64
|
"prerelease:web": "release-it --preRelease=beta --ci --vv --config .release-it-beta.cjs"
|
|
61
65
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ComponentChild } from 'preact';
|
|
2
|
-
import type { SharedProps } from
|
|
2
|
+
import type { SharedProps } from '@bonniernews/dn-design-system-web/assets/types/shared-props.ts';
|
|
3
3
|
export interface ArticleImageProps extends SharedProps {
|
|
4
4
|
image: ComponentChild;
|
|
5
5
|
caption?: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ComponentChildren } from
|
|
1
|
+
import { ComponentChildren } from 'preact';
|
|
2
2
|
export interface FormFieldProps {
|
|
3
3
|
error?: boolean;
|
|
4
4
|
errorMessage?: string;
|
|
@@ -8,5 +8,5 @@ export interface FormFieldProps {
|
|
|
8
8
|
type?: string;
|
|
9
9
|
children?: ComponentChildren;
|
|
10
10
|
}
|
|
11
|
-
export declare const FormField: ({ error, errorMessage, wrapperClasses, helpHtml, helpText, type, children }: FormFieldProps) => import("preact").JSX.Element;
|
|
11
|
+
export declare const FormField: ({ error, errorMessage, wrapperClasses, helpHtml, helpText, type, children, }: FormFieldProps) => import("preact").JSX.Element;
|
|
12
12
|
export default FormField;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ArticleImageProps } from '
|
|
1
|
+
import { ArticleImageProps } from '@bonniernews/dn-design-system-web/assets/article-image/article-image.tsx';
|
|
2
2
|
/**
|
|
3
|
-
* - GitHub: [BonnierNews/dn-design-system
|
|
3
|
+
* - GitHub: [BonnierNews/dn-design-system/web/src/components/article-body-image](https://github.com/BonnierNews/dn-design-system/tree/main/web/src/components/article-body-image)
|
|
4
4
|
* - Storybook: [ArticleBodyImage](https://designsystem.dn.se/?path=/docs/article-articlebodyimage--docs)
|
|
5
5
|
*
|
|
6
6
|
* The component will not include styling by itself. Make sure to include the right styles for the component. See example below:
|
|
@@ -6,11 +6,7 @@ var formatClassString = (classesArray) => {
|
|
|
6
6
|
// ../src/components/image-caption/image-caption.tsx
|
|
7
7
|
import { jsx, jsxs } from "preact/jsx-runtime";
|
|
8
8
|
var ImageCaption = ({ caption, author, imageType, classNames, attributes, forcePx }) => {
|
|
9
|
-
const classes = formatClassString([
|
|
10
|
-
"ds-image-caption",
|
|
11
|
-
forcePx && "ds-force-px",
|
|
12
|
-
classNames
|
|
13
|
-
]);
|
|
9
|
+
const classes = formatClassString(["ds-image-caption", forcePx && "ds-force-px", classNames]);
|
|
14
10
|
const authorText = imageType && author ? `${imageType.charAt(0).toUpperCase() + imageType.slice(1)}: ${author}` : author;
|
|
15
11
|
const authorClasses = [
|
|
16
12
|
"ds-article-image__credits",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../helpers/formatClassString.ts", "../../../components/image-caption/image-caption.tsx", "../../../assets/article-image/article-image.tsx", "../../../components/article-body-image/article-body-image.tsx"],
|
|
4
|
-
"sourcesContent": ["export const formatClassString = (classesArray: (string|undefined|false)[]): string => {\n return classesArray.filter(x => !!x).join(' ')
|
|
5
|
-
"mappings": ";AAAO,IAAM,oBAAoB,CAAC,
|
|
4
|
+
"sourcesContent": ["export const formatClassString = (classesArray: (string | undefined | false)[]): string => {\n return classesArray.filter((x) => !!x).join(' ')\n}\n", "import type { SharedProps } from '@bonniernews/dn-design-system-web/assets/types/shared-props.ts'\n\nimport { formatClassString } from '@bonniernews/dn-design-system-web/helpers/formatClassString.ts'\n\nexport interface ImageCaptionProps extends SharedProps {\n /** Ex \"Detta \u00E4r en bildtext\" */\n caption?: string\n /** Ex \"Paul Hansen\" */\n author?: string\n /** Type of image. Ex \"Foto\" or \"Illustration\" */\n imageType?: string\n /** Fixed pixel value is used for typography to prevent scaling based on html font-size */\n forcePx?: boolean\n}\n\n/**\n * - GitHub: [BonnierNews/dn-design-system/web/src/components/image-caption](https://github.com/BonnierNews/dn-design-system/tree/main/web/src/components/image-caption)\n * - Storybook: [ImageCaption](https://designsystem.dn.se/?path=/docs/article-image-caption--docs)\n *\n * The component will not include styling by itself. Make sure to include the right styles for the component. See example below:\n * `@use '@bonniernews/dn-design-system-web/components/image-caption/image-caption.scss'`\n */\nexport const ImageCaption = ({ caption, author, imageType, classNames, attributes, forcePx }: ImageCaptionProps) => {\n const classes = formatClassString(['ds-image-caption', forcePx && 'ds-force-px', classNames])\n\n const authorText =\n imageType && author ? `${imageType.charAt(0).toUpperCase() + imageType.slice(1)}: ${author}` : author\n\n const authorClasses = [\n 'ds-article-image__credits',\n authorText && authorText.length >= 27 && authorText.length < 60 // Low estimate of how much will fit on tablet/desktop\n ? 'ds-article-image__credits--nowrap-bigscreen'\n : authorText && authorText.length < 27 // Low estimate of how much will fit on 320px mobile\n ? 'ds-article-image__credits--nowrap'\n : null,\n ]\n .filter(Boolean)\n .join(' ')\n\n return (\n <figcaption className={classes} aria-hidden='true' {...attributes}>\n {/* This needs to be on the same line to maintain a space between the caption-span and author-span */}\n {caption && <span>{caption}</span>} {authorText && <span className={authorClasses}>{authorText}</span>}\n </figcaption>\n )\n}\n", "import { ComponentChild } from 'preact'\n\nimport type { SharedProps } from '@bonniernews/dn-design-system-web/assets/types/shared-props.ts'\n\nimport { formatClassString } from '@bonniernews/dn-design-system-web/helpers/formatClassString.ts'\n\nimport { ImageCaption } from '@bonniernews/dn-design-system-web/components/image-caption/image-caption.tsx'\n\nexport interface ArticleImageProps extends SharedProps {\n image: ComponentChild\n caption?: string\n author?: string\n imageType?: string\n fullWidth?: boolean\n forcePx?: boolean\n}\n\nexport const ArticleImage = ({\n image,\n caption = '',\n author = '',\n imageType = '',\n fullWidth,\n forcePx,\n classNames,\n attributes,\n}: ArticleImageProps) => {\n const componentClassName = 'ds-article-image'\n const classes = formatClassString([componentClassName, forcePx && 'ds-force-px', classNames])\n const showCaption = !!caption || !!author\n\n return (\n <figure className={classes} {...attributes}>\n {fullWidth ? <div className='ds-full-width-element'>{image}</div> : image}\n {showCaption && <ImageCaption caption={caption} author={author} imageType={imageType} forcePx={forcePx} />}\n </figure>\n )\n}\n", "import {\n ArticleImage,\n ArticleImageProps,\n} from '@bonniernews/dn-design-system-web/assets/article-image/article-image.tsx'\n\nimport { formatClassString } from '@bonniernews/dn-design-system-web/helpers/formatClassString.ts'\n\n/**\n * - GitHub: [BonnierNews/dn-design-system/web/src/components/article-body-image](https://github.com/BonnierNews/dn-design-system/tree/main/web/src/components/article-body-image)\n * - Storybook: [ArticleBodyImage](https://designsystem.dn.se/?path=/docs/article-articlebodyimage--docs)\n *\n * The component will not include styling by itself. Make sure to include the right styles for the component. See example below:\n * `@use '@bonniernews/dn-design-system-web/components/article-body-image/article-body-image.scss'`\n */\nexport const ArticleBodyImage = ({\n image,\n caption = '',\n author = '',\n imageType = '',\n fullWidth,\n forcePx,\n classNames,\n attributes,\n}: ArticleImageProps) => {\n const componentClassName = 'ds-article-image--body'\n const classes = formatClassString([componentClassName, classNames])\n\n return (\n <ArticleImage\n image={image}\n caption={caption}\n author={author}\n imageType={imageType}\n fullWidth={fullWidth}\n forcePx={forcePx}\n classNames={classes}\n attributes={attributes}\n />\n )\n}\n"],
|
|
5
|
+
"mappings": ";AAAO,IAAM,oBAAoB,CAAC,iBAAyD;AACzF,SAAO,aAAa,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,GAAG;AACjD;;;ACsCI,SAEc,KAFd;AAlBG,IAAM,eAAe,CAAC,EAAE,SAAS,QAAQ,WAAW,YAAY,YAAY,QAAQ,MAAyB;AAClH,QAAM,UAAU,kBAAkB,CAAC,oBAAoB,WAAW,eAAe,UAAU,CAAC;AAE5F,QAAM,aACJ,aAAa,SAAS,GAAG,UAAU,OAAO,CAAC,EAAE,YAAY,IAAI,UAAU,MAAM,CAAC,CAAC,KAAK,MAAM,KAAK;AAEjG,QAAM,gBAAgB;AAAA,IACpB;AAAA,IACA,cAAc,WAAW,UAAU,MAAM,WAAW,SAAS,KACzD,gDACA,cAAc,WAAW,SAAS,KAChC,sCACA;AAAA,EACR,EACG,OAAO,OAAO,EACd,KAAK,GAAG;AAEX,SACE,qBAAC,gBAAW,WAAW,SAAS,eAAY,QAAQ,GAAG,YAEpD;AAAA,eAAW,oBAAC,UAAM,mBAAQ;AAAA,IAAQ;AAAA,IAAE,cAAc,oBAAC,UAAK,WAAW,eAAgB,sBAAW;AAAA,KACjG;AAEJ;;;ACbI,SACe,OAAAA,MADf,QAAAC,aAAA;AAfG,IAAM,eAAe,CAAC;AAAA,EAC3B;AAAA,EACA,UAAU;AAAA,EACV,SAAS;AAAA,EACT,YAAY;AAAA,EACZ;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAyB;AACvB,QAAM,qBAAqB;AAC3B,QAAM,UAAU,kBAAkB,CAAC,oBAAoB,WAAW,eAAe,UAAU,CAAC;AAC5F,QAAM,cAAc,CAAC,CAAC,WAAW,CAAC,CAAC;AAEnC,SACE,gBAAAA,MAAC,YAAO,WAAW,SAAU,GAAG,YAC7B;AAAA,gBAAY,gBAAAD,KAAC,SAAI,WAAU,yBAAyB,iBAAM,IAAS;AAAA,IACnE,eAAe,gBAAAA,KAAC,gBAAa,SAAkB,QAAgB,WAAsB,SAAkB;AAAA,KAC1G;AAEJ;;;ACTI,gBAAAE,YAAA;AAdG,IAAM,mBAAmB,CAAC;AAAA,EAC/B;AAAA,EACA,UAAU;AAAA,EACV,SAAS;AAAA,EACT,YAAY;AAAA,EACZ;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAyB;AACvB,QAAM,qBAAqB;AAC3B,QAAM,UAAU,kBAAkB,CAAC,oBAAoB,UAAU,CAAC;AAElE,SACE,gBAAAA;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,YAAY;AAAA,MACZ;AAAA;AAAA,EACF;AAEJ;",
|
|
6
6
|
"names": ["jsx", "jsxs", "jsx"]
|
|
7
7
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ArticleImageProps } from '@bonniernews/dn-design-system-web/assets/article-image/article-image.tsx';
|
|
2
2
|
/**
|
|
3
|
-
* - GitHub: [BonnierNews/dn-design-system
|
|
3
|
+
* - GitHub: [BonnierNews/dn-design-system/web/src/components/article-top-image](https://github.com/BonnierNews/dn-design-system/tree/main/web/src/components/article-top-image)
|
|
4
4
|
* - Storybook: [ArticleTopImage](https://designsystem.dn.se/?path=/docs/article-articletopimage--docs)
|
|
5
5
|
*
|
|
6
6
|
* The component will not include styling by itself. Make sure to include the right styles for the component. See example below:
|
|
7
7
|
* `@use '@bonniernews/dn-design-system-web/components/article-top-image/article-top-image.scss'`
|
|
8
8
|
*/
|
|
9
|
-
export declare const ArticleTopImage: ({ caption, imageType, author, image, forcePx, classNames, attributes }: ArticleImageProps) => import("preact").JSX.Element;
|
|
9
|
+
export declare const ArticleTopImage: ({ caption, imageType, author, image, forcePx, classNames, attributes, }: ArticleImageProps) => import("preact").JSX.Element;
|
|
@@ -6,11 +6,7 @@ var formatClassString = (classesArray) => {
|
|
|
6
6
|
// ../src/components/image-caption/image-caption.tsx
|
|
7
7
|
import { jsx, jsxs } from "preact/jsx-runtime";
|
|
8
8
|
var ImageCaption = ({ caption, author, imageType, classNames, attributes, forcePx }) => {
|
|
9
|
-
const classes = formatClassString([
|
|
10
|
-
"ds-image-caption",
|
|
11
|
-
forcePx && "ds-force-px",
|
|
12
|
-
classNames
|
|
13
|
-
]);
|
|
9
|
+
const classes = formatClassString(["ds-image-caption", forcePx && "ds-force-px", classNames]);
|
|
14
10
|
const authorText = imageType && author ? `${imageType.charAt(0).toUpperCase() + imageType.slice(1)}: ${author}` : author;
|
|
15
11
|
const authorClasses = [
|
|
16
12
|
"ds-article-image__credits",
|
|
@@ -46,7 +42,15 @@ var ArticleImage = ({
|
|
|
46
42
|
|
|
47
43
|
// ../src/components/article-top-image/article-top-image.tsx
|
|
48
44
|
import { jsx as jsx3 } from "preact/jsx-runtime";
|
|
49
|
-
var ArticleTopImage = ({
|
|
45
|
+
var ArticleTopImage = ({
|
|
46
|
+
caption,
|
|
47
|
+
imageType,
|
|
48
|
+
author,
|
|
49
|
+
image,
|
|
50
|
+
forcePx,
|
|
51
|
+
classNames,
|
|
52
|
+
attributes
|
|
53
|
+
}) => {
|
|
50
54
|
const classes = formatClassString(["ds-article-image--top", classNames]);
|
|
51
55
|
const imageParams = {
|
|
52
56
|
fullWidth: true,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../helpers/formatClassString.ts", "../../../components/image-caption/image-caption.tsx", "../../../assets/article-image/article-image.tsx", "../../../components/article-top-image/article-top-image.tsx"],
|
|
4
|
-
"sourcesContent": ["export const formatClassString = (classesArray: (string|undefined|false)[]): string => {\n return classesArray.filter(x => !!x).join(' ')
|
|
5
|
-
"mappings": ";AAAO,IAAM,oBAAoB,CAAC,
|
|
4
|
+
"sourcesContent": ["export const formatClassString = (classesArray: (string | undefined | false)[]): string => {\n return classesArray.filter((x) => !!x).join(' ')\n}\n", "import type { SharedProps } from '@bonniernews/dn-design-system-web/assets/types/shared-props.ts'\n\nimport { formatClassString } from '@bonniernews/dn-design-system-web/helpers/formatClassString.ts'\n\nexport interface ImageCaptionProps extends SharedProps {\n /** Ex \"Detta \u00E4r en bildtext\" */\n caption?: string\n /** Ex \"Paul Hansen\" */\n author?: string\n /** Type of image. Ex \"Foto\" or \"Illustration\" */\n imageType?: string\n /** Fixed pixel value is used for typography to prevent scaling based on html font-size */\n forcePx?: boolean\n}\n\n/**\n * - GitHub: [BonnierNews/dn-design-system/web/src/components/image-caption](https://github.com/BonnierNews/dn-design-system/tree/main/web/src/components/image-caption)\n * - Storybook: [ImageCaption](https://designsystem.dn.se/?path=/docs/article-image-caption--docs)\n *\n * The component will not include styling by itself. Make sure to include the right styles for the component. See example below:\n * `@use '@bonniernews/dn-design-system-web/components/image-caption/image-caption.scss'`\n */\nexport const ImageCaption = ({ caption, author, imageType, classNames, attributes, forcePx }: ImageCaptionProps) => {\n const classes = formatClassString(['ds-image-caption', forcePx && 'ds-force-px', classNames])\n\n const authorText =\n imageType && author ? `${imageType.charAt(0).toUpperCase() + imageType.slice(1)}: ${author}` : author\n\n const authorClasses = [\n 'ds-article-image__credits',\n authorText && authorText.length >= 27 && authorText.length < 60 // Low estimate of how much will fit on tablet/desktop\n ? 'ds-article-image__credits--nowrap-bigscreen'\n : authorText && authorText.length < 27 // Low estimate of how much will fit on 320px mobile\n ? 'ds-article-image__credits--nowrap'\n : null,\n ]\n .filter(Boolean)\n .join(' ')\n\n return (\n <figcaption className={classes} aria-hidden='true' {...attributes}>\n {/* This needs to be on the same line to maintain a space between the caption-span and author-span */}\n {caption && <span>{caption}</span>} {authorText && <span className={authorClasses}>{authorText}</span>}\n </figcaption>\n )\n}\n", "import { ComponentChild } from 'preact'\n\nimport type { SharedProps } from '@bonniernews/dn-design-system-web/assets/types/shared-props.ts'\n\nimport { formatClassString } from '@bonniernews/dn-design-system-web/helpers/formatClassString.ts'\n\nimport { ImageCaption } from '@bonniernews/dn-design-system-web/components/image-caption/image-caption.tsx'\n\nexport interface ArticleImageProps extends SharedProps {\n image: ComponentChild\n caption?: string\n author?: string\n imageType?: string\n fullWidth?: boolean\n forcePx?: boolean\n}\n\nexport const ArticleImage = ({\n image,\n caption = '',\n author = '',\n imageType = '',\n fullWidth,\n forcePx,\n classNames,\n attributes,\n}: ArticleImageProps) => {\n const componentClassName = 'ds-article-image'\n const classes = formatClassString([componentClassName, forcePx && 'ds-force-px', classNames])\n const showCaption = !!caption || !!author\n\n return (\n <figure className={classes} {...attributes}>\n {fullWidth ? <div className='ds-full-width-element'>{image}</div> : image}\n {showCaption && <ImageCaption caption={caption} author={author} imageType={imageType} forcePx={forcePx} />}\n </figure>\n )\n}\n", "import {\n ArticleImage,\n ArticleImageProps,\n} from '@bonniernews/dn-design-system-web/assets/article-image/article-image.tsx'\n\nimport { formatClassString } from '@bonniernews/dn-design-system-web/helpers/formatClassString.ts'\n\n/**\n * - GitHub: [BonnierNews/dn-design-system/web/src/components/article-top-image](https://github.com/BonnierNews/dn-design-system/tree/main/web/src/components/article-top-image)\n * - Storybook: [ArticleTopImage](https://designsystem.dn.se/?path=/docs/article-articletopimage--docs)\n *\n * The component will not include styling by itself. Make sure to include the right styles for the component. See example below:\n * `@use '@bonniernews/dn-design-system-web/components/article-top-image/article-top-image.scss'`\n */\nexport const ArticleTopImage = ({\n caption,\n imageType,\n author,\n image,\n forcePx,\n classNames,\n attributes,\n}: ArticleImageProps) => {\n const classes = formatClassString(['ds-article-image--top', classNames])\n\n const imageParams = {\n fullWidth: true,\n caption,\n imageType,\n author,\n image,\n forcePx,\n classNames: classes,\n attributes,\n }\n\n return <ArticleImage {...imageParams} />\n}\n"],
|
|
5
|
+
"mappings": ";AAAO,IAAM,oBAAoB,CAAC,iBAAyD;AACzF,SAAO,aAAa,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,GAAG;AACjD;;;ACsCI,SAEc,KAFd;AAlBG,IAAM,eAAe,CAAC,EAAE,SAAS,QAAQ,WAAW,YAAY,YAAY,QAAQ,MAAyB;AAClH,QAAM,UAAU,kBAAkB,CAAC,oBAAoB,WAAW,eAAe,UAAU,CAAC;AAE5F,QAAM,aACJ,aAAa,SAAS,GAAG,UAAU,OAAO,CAAC,EAAE,YAAY,IAAI,UAAU,MAAM,CAAC,CAAC,KAAK,MAAM,KAAK;AAEjG,QAAM,gBAAgB;AAAA,IACpB;AAAA,IACA,cAAc,WAAW,UAAU,MAAM,WAAW,SAAS,KACzD,gDACA,cAAc,WAAW,SAAS,KAChC,sCACA;AAAA,EACR,EACG,OAAO,OAAO,EACd,KAAK,GAAG;AAEX,SACE,qBAAC,gBAAW,WAAW,SAAS,eAAY,QAAQ,GAAG,YAEpD;AAAA,eAAW,oBAAC,UAAM,mBAAQ;AAAA,IAAQ;AAAA,IAAE,cAAc,oBAAC,UAAK,WAAW,eAAgB,sBAAW;AAAA,KACjG;AAEJ;;;ACbI,SACe,OAAAA,MADf,QAAAC,aAAA;AAfG,IAAM,eAAe,CAAC;AAAA,EAC3B;AAAA,EACA,UAAU;AAAA,EACV,SAAS;AAAA,EACT,YAAY;AAAA,EACZ;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAyB;AACvB,QAAM,qBAAqB;AAC3B,QAAM,UAAU,kBAAkB,CAAC,oBAAoB,WAAW,eAAe,UAAU,CAAC;AAC5F,QAAM,cAAc,CAAC,CAAC,WAAW,CAAC,CAAC;AAEnC,SACE,gBAAAA,MAAC,YAAO,WAAW,SAAU,GAAG,YAC7B;AAAA,gBAAY,gBAAAD,KAAC,SAAI,WAAU,yBAAyB,iBAAM,IAAS;AAAA,IACnE,eAAe,gBAAAA,KAAC,gBAAa,SAAkB,QAAgB,WAAsB,SAAkB;AAAA,KAC1G;AAEJ;;;ACDS,gBAAAE,YAAA;AAtBF,IAAM,kBAAkB,CAAC;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAyB;AACvB,QAAM,UAAU,kBAAkB,CAAC,yBAAyB,UAAU,CAAC;AAEvE,QAAM,cAAc;AAAA,IAClB,WAAW;AAAA,IACX;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,YAAY;AAAA,IACZ;AAAA,EACF;AAEA,SAAO,gBAAAA,KAAC,gBAAc,GAAG,aAAa;AACxC;",
|
|
6
6
|
"names": ["jsx", "jsxs", "jsx"]
|
|
7
7
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { SharedProps } from
|
|
1
|
+
import type { SharedProps } from '@bonniernews/dn-design-system-web/assets/types/shared-props.ts';
|
|
2
2
|
export interface BlockedContentProps extends SharedProps {
|
|
3
3
|
title: string;
|
|
4
4
|
body: string;
|
|
@@ -9,7 +9,7 @@ export interface BlockedContentProps extends SharedProps {
|
|
|
9
9
|
};
|
|
10
10
|
}
|
|
11
11
|
/**
|
|
12
|
-
* - GitHub: [BonnierNews/dn-design-system
|
|
12
|
+
* - GitHub: [BonnierNews/dn-design-system/web/src/components/blocked-content](https://github.com/BonnierNews/dn-design-system/tree/main/web/src/components/blocked-content)
|
|
13
13
|
* - Storybook: [BlockedContent](https://designsystem.dn.se/?path=/docs/article-blockedcontent--docs)
|
|
14
14
|
*
|
|
15
15
|
* The component will not include styling by itself. Make sure to include the right styles for the component. See example below:
|
|
@@ -161,23 +161,28 @@ var Button = ({
|
|
|
161
161
|
attributes,
|
|
162
162
|
forcePx = false
|
|
163
163
|
}) => {
|
|
164
|
-
return /* @__PURE__ */ jsx5(
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
164
|
+
return /* @__PURE__ */ jsx5(
|
|
165
|
+
ButtonBase,
|
|
166
|
+
{
|
|
167
|
+
...{
|
|
168
|
+
text,
|
|
169
|
+
disabled,
|
|
170
|
+
variant,
|
|
171
|
+
size,
|
|
172
|
+
fullWidth,
|
|
173
|
+
mobileFullWidth,
|
|
174
|
+
iconPosition,
|
|
175
|
+
iconName,
|
|
176
|
+
loading,
|
|
177
|
+
type,
|
|
178
|
+
href,
|
|
179
|
+
isIconButton,
|
|
180
|
+
classNames,
|
|
181
|
+
attributes,
|
|
182
|
+
forcePx
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
);
|
|
181
186
|
};
|
|
182
187
|
|
|
183
188
|
// ../src/components/blocked-content/blocked-content.tsx
|
|
@@ -192,11 +197,7 @@ var BlockedContent = ({
|
|
|
192
197
|
elementAttributes = {}
|
|
193
198
|
}) => {
|
|
194
199
|
const componentClassName = "ds-blocked-content";
|
|
195
|
-
const classes = [
|
|
196
|
-
componentClassName,
|
|
197
|
-
forcePx ? "ds-force-px" : "",
|
|
198
|
-
classNames
|
|
199
|
-
].filter(Boolean).join(" ");
|
|
200
|
+
const classes = formatClassString([componentClassName, forcePx ? "ds-force-px" : "", classNames]);
|
|
200
201
|
return /* @__PURE__ */ jsx6("div", { className: classes, ...attributes, children: /* @__PURE__ */ jsxs3("div", { className: `${componentClassName}__inner`, children: [
|
|
201
202
|
/* @__PURE__ */ jsxs3("div", { className: `${componentClassName}__content`, children: [
|
|
202
203
|
/* @__PURE__ */ jsx6("h2", { className: `${componentClassName}__title`, children: title }),
|