@bonniernews/dn-design-system-web 32.1.2-beta.0 → 32.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,20 @@ All changes to @bonniernews/dn-design-system-web will be documented in this file
4
4
 
5
5
 
6
6
 
7
+ ## [32.2.1](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@32.2.0...@bonniernews/dn-design-system-web@32.2.1) (2025-05-13)
8
+
9
+
10
+ ### Bug Fixes
11
+
12
+ * **web:** direkt circle as TSX ([#1732](https://github.com/BonnierNews/dn-design-system/issues/1732)) ([2bfaf60](https://github.com/BonnierNews/dn-design-system/commit/2bfaf608dd2b20618ccc5790eb3b783009273a91))
13
+
14
+ ## [32.2.0](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@32.1.1...@bonniernews/dn-design-system-web@32.2.0) (2025-05-12)
15
+
16
+
17
+ ### Features
18
+
19
+ * **web:** imagecaption tsx ([#1731](https://github.com/BonnierNews/dn-design-system/issues/1731)) ([c624840](https://github.com/BonnierNews/dn-design-system/commit/c62484032ce948d3ca12468e04467aa286d9082f))
20
+
7
21
  ## [32.1.1](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@32.1.0...@bonniernews/dn-design-system-web@32.1.1) (2025-05-07)
8
22
 
9
23
 
@@ -0,0 +1,32 @@
1
+ - GitHub: [BonnierNews/dn-design-system/../web/src/components/direkt-circle](https://github.com/BonnierNews/dn-design-system/tree/main/web/src/components/direkt-circle)
2
+ - Storybook: [Subcomponents > DirektCircle](https://designsystem.dn.se/?path=/docs/section-subcomponents-direkt-circle--docs)
3
+ - Storybook (Latest): [Subcomponents > DirektCircle](https://designsystem-latest.dn.se/?path=/docs/section-subcomponents-direkt-circle--docs)
4
+
5
+ ----
6
+
7
+ # DirektCircle
8
+
9
+ ## Parameters
10
+
11
+ |parameter | type | required | options | default | description |
12
+ |:--- | :--- | :--- | :--- | :--- | :--- |
13
+ |circleColor | String | no | | | Hex code or supported color name |
14
+ |classNames | String | no | | | Ex. "my-special-class" |
15
+ |attributes | Object | no | | | Ex. { target: "_blank", "data-test": "lorem ipsum" } |
16
+
17
+
18
+ ## Minimum requirement example
19
+
20
+ ### Nunjucks
21
+
22
+ These are copy paste friendly examples to quickliy get started using a component.
23
+
24
+ ```html
25
+ {% from '@bonniernews/dn-design-system-web/components/direkt-circle/direkt-circle.njk' import DirektCircle %}
26
+
27
+ {{ DirektCircle() }}
28
+ ```
29
+
30
+ ### SCSS
31
+ ```scss
32
+ @use "@bonniernews/dn-design-system-web/components/direkt-circle/direkt-circle";
@@ -1,32 +1,15 @@
1
- - GitHub: [BonnierNews/dn-design-system/../web/src/components/direkt-circle](https://github.com/BonnierNews/dn-design-system/tree/main/web/src/components/direkt-circle)
2
- - Storybook: [Subcomponents > DirektCircle](https://designsystem.dn.se/?path=/docs/section-subcomponents-direkt-circle--docs)
3
- - Storybook (Latest): [Subcomponents > DirektCircle](https://designsystem-latest.dn.se/?path=/docs/section-subcomponents-direkt-circle--docs)
1
+ DirektCircle
2
+ ============
4
3
 
5
- ----
4
+ * GitHub: [BonnierNews/dn-design-system/../web/src/components/direkt-circle](https://github.com/BonnierNews/dn-design-system/tree/main/web/src/components/direkt-circle)
5
+ * Storybook: [DirektCircle](https://designsystem.dn.se/?path=/docs/section-subcomponents-direktcircle--docs)
6
6
 
7
- # DirektCircle
7
+ | Name | Description | Default |
8
+ |:--- | :--- | :--- |
9
+ | circleColor | Hex code or supported color name<br />string | "white" |
10
+ | classNames | string | \- |
11
+ | attributes | object | { } |
8
12
 
9
- ## Parameters
10
-
11
- |parameter | type | required | options | default | description |
12
- |:--- | :--- | :--- | :--- | :--- | :--- |
13
- |circleColor | String | no | | | Hex code or supported color name |
14
- |classNames | String | no | | | Ex. "my-special-class" |
15
- |attributes | Object | no | | | Ex. { target: "_blank", "data-test": "lorem ipsum" } |
16
-
17
-
18
- ## Minimum requirement example
19
-
20
- ### Nunjucks
21
-
22
- These are copy paste friendly examples to quickliy get started using a component.
23
-
24
- ```html
25
- {% from '@bonniernews/dn-design-system-web/components/direkt-circle/direkt-circle.njk' import DirektCircle %}
26
-
27
- {{ DirektCircle() }}
28
- ```
29
-
30
- ### SCSS
31
- ```scss
32
- @use "@bonniernews/dn-design-system-web/components/direkt-circle/direkt-circle";
13
+ ```jsx
14
+ <DirektCircle />
15
+ ```
@@ -0,0 +1,39 @@
1
+ - GitHub: [BonnierNews/dn-design-system/../web/src/components/image-caption](https://github.com/BonnierNews/dn-design-system/tree/main/web/src/components/image-caption)
2
+ - Storybook: [ImageCaption](https://designsystem.dn.se/?path=/docs/article-imagecaption--docs)
3
+ - Storybook (Latest): [ImageCaption](https://designsystem-latest.dn.se/?path=/docs/article-imagecaption--docs)
4
+
5
+ ----
6
+
7
+ # ImageCaption
8
+
9
+ ## Parameters
10
+
11
+ |parameter | type | required | options | default | description |
12
+ |:--- | :--- | :--- | :--- | :--- | :--- |
13
+ |caption | String | no | | | Ex "Detta är en bildtext" |
14
+ |imageType | String | no | | | Type of image. Ex "Foto" |
15
+ |author | String | no | | | Ex "Paul Hansen" |
16
+ |attributes | Object | no | | | Ex. { target: "_blank", "data-test": "lorem ipsum" } |
17
+ |classNames | String | no | | | Ex. "my-special-class" |
18
+ |forcePx | Bool | no | true, false | false | Fixed pixel value is used for typography to prevent scaling based on html font-size
19
+
20
+ ## Minimum requirement example
21
+
22
+ ### Nunjucks
23
+
24
+ These are copy paste friendly examples to quickliy get started using a component.
25
+
26
+ ```html
27
+ {% from '@bonniernews/dn-design-system-web/components/image-caption/image-caption.njk' import ImageCaption %}
28
+
29
+ {{ ImageCaption({
30
+ caption: "En bildtext",
31
+ imageType: "Foto",
32
+ author: "Paul Hansen"
33
+ })}}
34
+ ```
35
+
36
+ ### SCSS
37
+ ```scss
38
+ @use "@bonniernews/dn-design-system-web/components/image-caption/image-caption";
39
+ ```
@@ -1,39 +1,24 @@
1
- - GitHub: [BonnierNews/dn-design-system/../web/src/components/image-caption](https://github.com/BonnierNews/dn-design-system/tree/main/web/src/components/image-caption)
2
- - Storybook: [ImageCaption](https://designsystem.dn.se/?path=/docs/article-imagecaption--docs)
3
- - Storybook (Latest): [ImageCaption](https://designsystem-latest.dn.se/?path=/docs/article-imagecaption--docs)
4
-
5
- ----
6
-
7
- # ImageCaption
8
-
9
- ## Parameters
10
-
11
- |parameter | type | required | options | default | description |
12
- |:--- | :--- | :--- | :--- | :--- | :--- |
13
- |caption | String | no | | | Ex "Detta är en bildtext" |
14
- |imageType | String | no | | | Type of image. Ex "Foto" |
15
- |author | String | no | | | Ex "Paul Hansen" |
16
- |attributes | Object | no | | | Ex. { target: "_blank", "data-test": "lorem ipsum" } |
17
- |classNames | String | no | | | Ex. "my-special-class" |
18
- |forcePx | Bool | no | true, false | false | Fixed pixel value is used for typography to prevent scaling based on html font-size
19
-
20
- ## Minimum requirement example
21
-
22
- ### Nunjucks
23
-
24
- These are copy paste friendly examples to quickliy get started using a component.
25
-
26
- ```html
27
- {% from '@bonniernews/dn-design-system-web/components/image-caption/image-caption.njk' import ImageCaption %}
28
-
29
- {{ ImageCaption({
30
- caption: "En bildtext",
31
- imageType: "Foto",
32
- author: "Paul Hansen"
33
- })}}
34
- ```
35
-
36
- ### SCSS
37
- ```scss
38
- @use "@bonniernews/dn-design-system-web/components/image-caption/image-caption";
39
- ```
1
+ ImageCaption
2
+ ============
3
+
4
+ * GitHub: [BonnierNews/dn-design-system/../web/src/components/image-caption](https://github.com/BonnierNews/dn-design-system/tree/main/web/src/components/image-caption)
5
+ * Storybook: [ImageCaption](https://designsystem.dn.se/?path=/docs/article-image-caption--docs)
6
+
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/image-caption/image-caption.scss'`
8
+
9
+ | Name | Description | Default |
10
+ |:--- | :--- | :--- |
11
+ | caption | Ex "Detta är en bildtext"<br />string | \- |
12
+ | author | Ex "Paul Hansen"<br />string | \- |
13
+ | imageType | Type of image. Ex "Foto" or "Illustration"<br />string | \- |
14
+ | classNames | Ex. "my-special-class another-class"<br />string | \- |
15
+ | attributes | Ex. { target: "\_blank", "data-test": "lorem ipsum" }<br />object | \- |
16
+ | forcePx | Fixed pixel value is used for typography to prevent scaling based on html font-size<br />boolean | \- |
17
+
18
+ ```jsx
19
+ <ImageCaption
20
+ author="Paul Hansen"
21
+ caption="Detta är en bildtext"
22
+ imageType="Foto"
23
+ />
24
+ ```
@@ -21,7 +21,7 @@
21
21
  {# Low estimate of how much will fit on tablet/desktop #}
22
22
  {% if (authorText | length) >= 27 and (authorText | length) < 60 %}
23
23
  {% set authorClasses = (authorClasses.push("ds-article-image__credits--nowrap-bigscreen"), authorClasses) %}
24
- {# Low estimate of how much will fit on iphone4 #}
24
+ {# Low estimate of how much will fit on 320px mobile #}
25
25
  {% elif (authorText | length) < 27 %}
26
26
  {% set authorClasses = (authorClasses.push("ds-article-image__credits--nowrap"), authorClasses) %}
27
27
  {% endif %}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bonniernews/dn-design-system-web",
3
- "version": "32.1.2-beta.0",
3
+ "version": "32.2.1",
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",
@@ -0,0 +1,12 @@
1
+ interface DirektCircleProps {
2
+ /** Hex code or supported color name */
3
+ circleColor?: string;
4
+ classNames?: string;
5
+ attributes?: object;
6
+ }
7
+ /**
8
+ * - GitHub: [BonnierNews/dn-design-system/../web/src/components/direkt-circle](https://github.com/BonnierNews/dn-design-system/tree/main/web/src/components/direkt-circle)
9
+ * - Storybook: [DirektCircle](https://designsystem.dn.se/?path=/docs/section-subcomponents-direktcircle--docs)
10
+ */
11
+ export declare const DirektCircle: ({ circleColor, classNames, attributes }: DirektCircleProps) => import("preact").JSX.Element;
12
+ export {};
@@ -0,0 +1,60 @@
1
+ // ../src/components/direkt-circle/direkt-circle.tsx
2
+ import { jsx, jsxs } from "preact/jsx-runtime";
3
+ var DirektCircle = ({ circleColor = "white", classNames, attributes = {} }) => {
4
+ const componentClassName = "ds-direkt-circle";
5
+ const circleOpacity = [
6
+ 0.25,
7
+ 0.25,
8
+ 0.25,
9
+ 0.25,
10
+ 0.25,
11
+ 0.25,
12
+ 0.25,
13
+ 0.25,
14
+ 0.24,
15
+ 0.235,
16
+ 0.222,
17
+ 0.218,
18
+ 0.212,
19
+ 0.202,
20
+ 0.19,
21
+ 0.178,
22
+ 0.165,
23
+ 0.155,
24
+ 0.145,
25
+ 0.135,
26
+ 0.12,
27
+ 0.107,
28
+ 0.095,
29
+ 0.083,
30
+ 0.07,
31
+ 0.06,
32
+ 0.047,
33
+ 0.035,
34
+ 0.023,
35
+ 0.02
36
+ ];
37
+ const classes = [componentClassName, classNames].filter(Boolean).join(" ");
38
+ return /* @__PURE__ */ jsxs(
39
+ "svg",
40
+ {
41
+ className: classes,
42
+ width: "500",
43
+ height: "500",
44
+ viewBox: "-250 -250 500 500",
45
+ fill: "none",
46
+ ...attributes,
47
+ children: [
48
+ /* @__PURE__ */ jsx("circle", { r: "5", fill: circleColor }),
49
+ circleOpacity.map((opacity, index) => {
50
+ const radius = (index + 1) * 8 + 5;
51
+ return /* @__PURE__ */ jsx("circle", { opacity, r: radius, stroke: circleColor, strokeWidth: "1.5" }, index);
52
+ })
53
+ ]
54
+ }
55
+ );
56
+ };
57
+ export {
58
+ DirektCircle
59
+ };
60
+ //# sourceMappingURL=direkt-circle.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../components/direkt-circle/direkt-circle.tsx"],
4
+ "sourcesContent": ["interface DirektCircleProps {\n /** Hex code or supported color name */\n circleColor?: string\n classNames?: string\n attributes?: object\n}\n\n/**\n * - GitHub: [BonnierNews/dn-design-system/../web/src/components/direkt-circle](https://github.com/BonnierNews/dn-design-system/tree/main/web/src/components/direkt-circle)\n * - Storybook: [DirektCircle](https://designsystem.dn.se/?path=/docs/section-subcomponents-direktcircle--docs)\n */\nexport const DirektCircle = ({ circleColor = 'white', classNames, attributes = {} }: DirektCircleProps) => {\n const componentClassName = 'ds-direkt-circle'\n const circleOpacity = [\n 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.24, 0.235, 0.222, 0.218, 0.212, 0.202, 0.19, 0.178, 0.165, 0.155,\n 0.145, 0.135, 0.12, 0.107, 0.095, 0.083, 0.07, 0.06, 0.047, 0.035, 0.023, 0.02,\n ];\n\n const classes = [componentClassName, classNames].filter(Boolean).join(' ')\n\n return (\n <svg\n className={classes}\n width='500'\n height='500'\n viewBox='-250 -250 500 500'\n fill='none'\n {...attributes}\n >\n <circle r='5' fill={circleColor} />\n {circleOpacity.map((opacity, index) => {\n const radius = (index + 1) * 8 + 5\n return <circle key={index} opacity={opacity} r={radius} stroke={circleColor} strokeWidth='1.5' />\n })}\n </svg>\n )\n}\n"],
5
+ "mappings": ";AAqBI,SAQE,KARF;AAVG,IAAM,eAAe,CAAC,EAAE,cAAc,SAAS,YAAY,aAAa,CAAC,EAAE,MAAyB;AACzG,QAAM,qBAAqB;AAC3B,QAAM,gBAAgB;AAAA,IACpB;AAAA,IAAM;AAAA,IAAM;AAAA,IAAM;AAAA,IAAM;AAAA,IAAM;AAAA,IAAM;AAAA,IAAM;AAAA,IAAM;AAAA,IAAM;AAAA,IAAO;AAAA,IAAO;AAAA,IAAO;AAAA,IAAO;AAAA,IAAO;AAAA,IAAM;AAAA,IAAO;AAAA,IAAO;AAAA,IAC7G;AAAA,IAAO;AAAA,IAAO;AAAA,IAAM;AAAA,IAAO;AAAA,IAAO;AAAA,IAAO;AAAA,IAAM;AAAA,IAAM;AAAA,IAAO;AAAA,IAAO;AAAA,IAAO;AAAA,EAC5E;AAEA,QAAM,UAAU,CAAC,oBAAoB,UAAU,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG;AAEzE,SACE;AAAA,IAAC;AAAA;AAAA,MACC,WAAW;AAAA,MACX,OAAM;AAAA,MACN,QAAO;AAAA,MACP,SAAQ;AAAA,MACR,MAAK;AAAA,MACJ,GAAG;AAAA,MAEJ;AAAA,4BAAC,YAAO,GAAE,KAAI,MAAM,aAAa;AAAA,QAChC,cAAc,IAAI,CAAC,SAAS,UAAU;AACrC,gBAAM,UAAU,QAAQ,KAAK,IAAI;AACjC,iBAAO,oBAAC,YAAmB,SAAkB,GAAG,QAAQ,QAAQ,aAAa,aAAY,SAArE,KAA2E;AAAA,QACjG,CAAC;AAAA;AAAA;AAAA,EACH;AAEJ;",
6
+ "names": []
7
+ }
@@ -0,0 +1,22 @@
1
+ export interface ImageCaptionProps {
2
+ /** Ex "Detta är en bildtext" */
3
+ caption?: string;
4
+ /** Ex "Paul Hansen" */
5
+ author?: string;
6
+ /** Type of image. Ex "Foto" or "Illustration" */
7
+ imageType?: string;
8
+ /** Ex. "my-special-class another-class" */
9
+ classNames?: string;
10
+ /** Ex. { target: "_blank", "data-test": "lorem ipsum" } */
11
+ attributes?: object;
12
+ /** Fixed pixel value is used for typography to prevent scaling based on html font-size */
13
+ forcePx?: boolean;
14
+ }
15
+ /**
16
+ * - GitHub: [BonnierNews/dn-design-system/../web/src/components/image-caption](https://github.com/BonnierNews/dn-design-system/tree/main/web/src/components/image-caption)
17
+ * - Storybook: [ImageCaption](https://designsystem.dn.se/?path=/docs/article-image-caption--docs)
18
+ *
19
+ * The component will not include styling by itself. Make sure to include the right styles for the component. See example below:
20
+ * `@use '@bonniernews/dn-design-system-web/components/image-caption/image-caption.scss'`
21
+ */
22
+ export declare const ImageCaption: ({ caption, author, imageType, classNames, attributes, forcePx }: ImageCaptionProps) => import("preact").JSX.Element;
@@ -0,0 +1,28 @@
1
+ // ../src/helpers/formatClassString.ts
2
+ var formatClassString = (classesArray) => {
3
+ return classesArray.filter((x) => !!x).join(" ");
4
+ };
5
+
6
+ // ../src/components/image-caption/image-caption.tsx
7
+ import { Fragment, jsx, jsxs } from "preact/jsx-runtime";
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
+ ]);
14
+ const authorText = imageType && author ? `${imageType.charAt(0).toUpperCase() + imageType.slice(1)}: ${author}` : author;
15
+ const authorClasses = [
16
+ "ds-article-image__credits",
17
+ authorText && authorText.length >= 27 && authorText.length < 60 ? "ds-article-image__credits--nowrap-bigscreen" : authorText && authorText.length < 27 ? "ds-article-image__credits--nowrap" : null
18
+ ].filter(Boolean).join(" ");
19
+ return /* @__PURE__ */ jsxs("figcaption", { className: classes, "aria-hidden": "true", ...attributes, children: [
20
+ caption && /* @__PURE__ */ jsx("span", { dangerouslySetInnerHTML: { __html: caption } }),
21
+ caption && authorText && "\xA0",
22
+ authorText && /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx("span", { className: authorClasses, children: authorText }) })
23
+ ] });
24
+ };
25
+ export {
26
+ ImageCaption
27
+ };
28
+ //# sourceMappingURL=image-caption.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../helpers/formatClassString.ts", "../../../components/image-caption/image-caption.tsx"],
4
+ "sourcesContent": ["export const formatClassString = (classesArray: (string|undefined|false)[]): string => {\n return classesArray.filter(x => !!x).join(' ');\n}\n", "import { formatClassString } from '@bonniernews/dn-design-system-web/helpers/formatClassString.ts';\n\nexport interface ImageCaptionProps {\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 /** Ex. \"my-special-class another-class\" */\n classNames?: string;\n /** Ex. { target: \"_blank\", \"data-test\": \"lorem ipsum\" } */\n attributes?: object;\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([\n 'ds-image-caption',\n forcePx && 'ds-force-px',\n classNames,\n ]);\n\n const authorText = 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' : authorText && authorText.length < 27 // Low estimate of how much will fit on 320px mobile\n ? 'ds-article-image__credits--nowrap' : null,\n ].filter(Boolean).join(' ');\n\n return (\n <figcaption className={classes} aria-hidden=\"true\" {...attributes} >\n {caption && <span dangerouslySetInnerHTML={{ __html: caption }} />}\n\n {/* non-breaking space between the caption-span and author-span */}\n {caption && authorText && '\\u00A0'}\n\n {authorText && (\n <>\n <span className={authorClasses}>\n {authorText}\n </span>\n </>\n )}\n </figcaption>\n );\n};\n"],
5
+ "mappings": ";AAAO,IAAM,oBAAoB,CAAC,iBAAqD;AACrF,SAAO,aAAa,OAAO,OAAK,CAAC,CAAC,CAAC,EAAE,KAAK,GAAG;AAC/C;;;ACuCI,SAOE,UANY,KADd;AAjBG,IAAM,eAAe,CAAC,EAAC,SAAS,QAAQ,WAAW,YAAY,YAAY,QAAO,MAAyB;AAChH,QAAM,UAAU,kBAAkB;AAAA,IAChC;AAAA,IACA,WAAW;AAAA,IACX;AAAA,EACF,CAAC;AAED,QAAM,aAAa,aAAa,SAAS,GAAG,UAAU,OAAO,CAAC,EAAE,YAAY,IAAI,UAAU,MAAM,CAAC,CAAC,KAAK,MAAM,KAAK;AAElH,QAAM,gBAAgB;AAAA,IACpB;AAAA,IACA,cAAc,WAAW,UAAU,MAAM,WAAW,SAAS,KACzD,gDAAgD,cAAc,WAAW,SAAS,KAClF,sCAAsC;AAAA,EAC5C,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG;AAE1B,SACE,qBAAC,gBAAW,WAAW,SAAS,eAAY,QAAQ,GAAG,YACpD;AAAA,eAAW,oBAAC,UAAK,yBAAyB,EAAE,QAAQ,QAAQ,GAAG;AAAA,IAG/D,WAAW,cAAc;AAAA,IAEzB,cACD,gCACE,8BAAC,UAAK,WAAW,eACd,sBACH,GACF;AAAA,KAEF;AAEJ;",
6
+ "names": []
7
+ }
@@ -1,79 +0,0 @@
1
- @use "../../foundations/helpers/forward.helpers.scss" as *;
2
-
3
- a.ds-teaser--counter.ds-teaser {
4
- color: inherit;
5
- text-decoration: none;
6
- }
7
-
8
- .ds-teaser--counter.ds-teaser {
9
- display: grid;
10
- grid-template-columns: auto auto;
11
- background-color: $ds-color-surface-primary;
12
- gap: ds-spacing($ds-s-075);
13
- padding: ds-spacing($ds-s-075);
14
-
15
- .ds-teaser__content {
16
- display: flex;
17
- flex-direction: column;
18
- gap: ds-spacing($ds-s-100);
19
- justify-content: space-between;
20
- }
21
-
22
- .ds-teaser--counter__title {
23
- @include ds-typography(
24
- $ds-typography-functional-heading-xs,
25
- $fontWeight: $ds-fontweight-regular,
26
- $lineHeight: $ds-lineheight-md
27
- );
28
- margin: 0;
29
- }
30
-
31
- .ds-teaser--counter__title--highlighted {
32
- font-weight: $ds-fontweight-bold;
33
- }
34
-
35
- .ds-teaser--counter__counter-wrapper {
36
- align-items: center;
37
- display: flex;
38
- gap: ds-spacing($ds-s-050);
39
- }
40
-
41
- .ds-teaser--counter__list {
42
- @include ds-typography($ds-typography-functional-heading-sm, $fontWeight: $ds-fontweight-regular);
43
- display: flex;
44
- font-variant-numeric: tabular-nums;
45
- gap: ds-spacing($ds-s-012);
46
- list-style: none;
47
- margin: 0;
48
- padding: 0;
49
-
50
- .ds-teaser--counter__item {
51
- background-color: $ds-color-brand-600;
52
- border-radius: ds-border-radius($ds-s-025);
53
- color: $ds-color-text-on-brand;
54
- padding: ds-spacing($ds-s-012) ds-spacing($ds-s-025);
55
- }
56
- }
57
-
58
- .ds-teaser--counter__counter-text {
59
- @include ds-typography($ds-typography-functional-meta-md);
60
- margin: 0;
61
- }
62
- .ds-teaser-image {
63
- display: flex;
64
- justify-content: flex-end;
65
- max-height: 130px;
66
- min-height: 86px;
67
- height: 100%;
68
- margin: 0;
69
- }
70
-
71
- .picture--placeholder {
72
- height: 100%;
73
- }
74
-
75
- .picture--placeholder,
76
- .picture__img {
77
- border-radius: ds-border-radius($ds-s-025);
78
- }
79
- }
@@ -1,26 +0,0 @@
1
- export interface TeaserCounterProps {
2
- title: string;
3
- counterText: string;
4
- subtitle?: string;
5
- areaType?: 'right' | 'bauta';
6
- targetLink?: string;
7
- mediaHtml?: string;
8
- counterDate?: string;
9
- countdown?: boolean;
10
- counterNumber?: number;
11
- classNames?: string;
12
- /** Ex. { target: "_blank", "data-test": "lorem ipsum" } */
13
- attributes?: object;
14
- }
15
- /**
16
- * Also known as "På Plats-puffen".
17
- *
18
- * In the CMS title will be set to a location like "Kiev, Ukraina" or "USA" and text is usually set to some author names like "Jan Banan och Kalle Kula"
19
- *
20
- * - GitHub: [BonnierNews/dn-design-system/../web/src/components/teaser-onsite](https://github.com/BonnierNews/dn-design-system/tree/main/web/src/components/teaser-counter)
21
- * - Storybook: [TeaserCounter](https://designsystem.dn.se/?path=/docs/section-teaser-counter--docs)
22
- *
23
- * The component will not include styling by itself. Make sure to include the right styles for the component. See example below:
24
- * `@use '@bonniernews/dn-design-system-web/components/teaser-counter/teaser-counter.scss'`
25
- */
26
- export declare const TeaserCounter: ({ areaType, targetLink, classNames, attributes, mediaHtml, counterText, countdown, counterDate, counterNumber, title, subtitle, }: TeaserCounterProps) => import("preact").JSX.Element;
@@ -1,78 +0,0 @@
1
- // ../src/helpers/formatClassString.ts
2
- var formatClassString = (classesArray) => {
3
- return classesArray.filter((x) => !!x).join(" ");
4
- };
5
-
6
- // ../src/components/teaser-card/teaser-card.tsx
7
- import { jsx } from "preact/jsx-runtime";
8
- var TeaserCard = ({ areaType, targetLink, theme = "nyheter", classes, attributes, children }) => {
9
- const componentClassName = "ds-teaser";
10
- const classNames = formatClassString([
11
- componentClassName,
12
- areaType && `${componentClassName}--${areaType}`,
13
- areaType == "bauta" && "ds-dark",
14
- `ds-theme--${theme}`,
15
- classes
16
- ]);
17
- if (targetLink) {
18
- return /* @__PURE__ */ jsx("a", { className: classNames, href: targetLink, ...attributes, children });
19
- }
20
- return /* @__PURE__ */ jsx("div", { className: classNames, ...attributes, children });
21
- };
22
-
23
- // ../src/helpers/teaser.tsx
24
- import { jsx as jsx2 } from "preact/jsx-runtime";
25
- var Media = ({ mediaHtml, rounded }) => {
26
- const classNames = "ds-teaser__media" + (rounded ? " ds-teaser__media--rounded" : "");
27
- return mediaHtml ? /* @__PURE__ */ jsx2("div", { className: classNames, dangerouslySetInnerHTML: { __html: mediaHtml } }) : null;
28
- };
29
- var Content = ({ children }) => {
30
- return /* @__PURE__ */ jsx2("div", { className: "ds-teaser__content", children });
31
- };
32
-
33
- // ../src/components/teaser-counter/teaser-counter.tsx
34
- import { jsx as jsx3, jsxs } from "preact/jsx-runtime";
35
- var TeaserCounter = ({
36
- areaType,
37
- targetLink,
38
- classNames,
39
- attributes,
40
- mediaHtml,
41
- counterText,
42
- countdown,
43
- counterDate,
44
- counterNumber,
45
- title,
46
- subtitle
47
- }) => {
48
- const componentClassName = "ds-teaser--counter";
49
- const classes = formatClassString([componentClassName, classNames]);
50
- const mergedAttributes = {
51
- ...attributes,
52
- "data-counter-date": counterDate,
53
- ...countdown ? { "data-countdown": countdown } : {}
54
- };
55
- return /* @__PURE__ */ jsxs(TeaserCard, { ...{ areaType, targetLink, classes, attributes: mergedAttributes }, children: [
56
- /* @__PURE__ */ jsxs(Content, { children: [
57
- title && /* @__PURE__ */ jsxs("h2", { className: `${componentClassName}__title`, children: [
58
- /* @__PURE__ */ jsx3("span", { className: `${componentClassName}__title--highlighted`, children: title }),
59
- subtitle && ` \u2013 ${subtitle}`
60
- ] }),
61
- (counterNumber || counterText) && /* @__PURE__ */ jsxs("div", { className: `${componentClassName}__counter-wrapper`, children: [
62
- counterNumber && /* @__PURE__ */ jsx3("ul", { className: `${componentClassName}__list`, children: counterNumber.toString().split("").map((digit, index) => /* @__PURE__ */ jsx3("li", { className: `${componentClassName}__item`, children: digit }, index)) }),
63
- counterText && /* @__PURE__ */ jsx3(
64
- "p",
65
- {
66
- className: `${componentClassName}__counter-text`,
67
- dangerouslySetInnerHTML: { __html: counterText }
68
- }
69
- )
70
- ] })
71
- ] }),
72
- /* @__PURE__ */ jsx3(Media, { ...{ mediaHtml } })
73
- ] });
74
- };
75
- export {
76
- TeaserCounter
77
- };
78
- //# sourceMappingURL=teaser-counter.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../helpers/formatClassString.ts", "../../../components/teaser-card/teaser-card.tsx", "../../../helpers/teaser.tsx", "../../../components/teaser-counter/teaser-counter.tsx"],
4
- "sourcesContent": ["export const formatClassString = (classesArray: (string|undefined|false)[]): string => {\n return classesArray.filter(x => !!x).join(' ');\n}\n", "import { formatClassString } from \"@bonniernews/dn-design-system-web/helpers/formatClassString.ts\";\nimport { ComponentChildren } from \"preact\";\n\nexport interface TeaserCardsProps {\n areaType?: 'right' | 'bauta' | 'bautaxl';\n targetLink?: string;\n theme?: 'kultur' | 'nyheter';\n classes?: string;\n /** Ex. { target: \"_blank\", \"data-test\": \"lorem ipsum\" } */\n attributes?: object;\n children: ComponentChildren;\n}\n\n/**\n * - GitHub: [BonnierNews/dn-design-system/../web/src/components/teaser-card](https://github.com/BonnierNews/dn-design-system/tree/main/web/src/components/teaser-card)\n * - Storybook: [Subcomponents > TeaserCard](https://designsystem.dn.se/?path=/docs/section-subcomponents-teaserdot--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/assets/teaser/teaser.scss'`\n */\nexport const TeaserCard = ({ areaType, targetLink, theme = 'nyheter', classes, attributes, children }: TeaserCardsProps) => {\n const componentClassName = 'ds-teaser';\n\n const classNames = formatClassString([\n componentClassName,\n areaType && `${componentClassName}--${areaType}`,\n areaType == 'bauta' && 'ds-dark',\n `ds-theme--${theme}`,\n classes,\n ])\n\n if (targetLink) {\n return (\n <a className={classNames} href={targetLink } {...attributes}>\n { children }\n </a>\n );\n }\n\n return (\n <div className={classNames}{...attributes}>\n { children }\n </div>\n );\n};\n", "import { ComponentChildren } from \"preact\";\n\ninterface MediaProps {\n mediaHtml?: string;\n rounded?: boolean;\n}\n\nexport const Media = ({ mediaHtml, rounded }: MediaProps) => {\n const classNames = 'ds-teaser__media' + (rounded ? ' ds-teaser__media--rounded' : '');\n return mediaHtml ? (<div className={classNames} dangerouslySetInnerHTML={{ __html: mediaHtml }} />) : (null)\n}\n\ninterface ContentProps {\n children: ComponentChildren;\n}\nexport const Content = ({ children }: ContentProps) => {\n return (<div className=\"ds-teaser__content\">\n {children}\n </div>)\n}\n\ninterface TitleProps {\n title?: string;\n}\nexport const Title = ({ title }: TitleProps) => {\n return title ? (<h2 className=\"ds-teaser__title\">{title}</h2>) : (null)\n}\n\ninterface BodyProps {\n text?: string;\n}\nexport const Body = ({ text }: BodyProps) => {\n return text ? (<p className=\"ds-teaser__text\">{text}</p>) : (null)\n}\n", "import { TeaserCard } from '@bonniernews/dn-design-system-web/components/teaser-card/teaser-card.tsx'\nimport { formatClassString } from '@bonniernews/dn-design-system-web/helpers/formatClassString.ts'\nimport { Content, Media } from '@bonniernews/dn-design-system-web/helpers/teaser.tsx'\nexport interface TeaserCounterProps {\n title: string\n counterText: string\n subtitle?: string\n areaType?: 'right' | 'bauta'\n targetLink?: string\n mediaHtml?: string\n counterDate?: string\n countdown?: boolean\n counterNumber?: number\n classNames?: string\n /** Ex. { target: \"_blank\", \"data-test\": \"lorem ipsum\" } */\n attributes?: object\n}\n\n/**\n * Also known as \"P\u00E5 Plats-puffen\".\n *\n * In the CMS title will be set to a location like \"Kiev, Ukraina\" or \"USA\" and text is usually set to some author names like \"Jan Banan och Kalle Kula\"\n *\n * - GitHub: [BonnierNews/dn-design-system/../web/src/components/teaser-onsite](https://github.com/BonnierNews/dn-design-system/tree/main/web/src/components/teaser-counter)\n * - Storybook: [TeaserCounter](https://designsystem.dn.se/?path=/docs/section-teaser-counter--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/teaser-counter/teaser-counter.scss'`\n */\nexport const TeaserCounter = ({\n areaType,\n targetLink,\n classNames,\n attributes,\n mediaHtml,\n counterText,\n countdown,\n counterDate,\n counterNumber,\n title,\n subtitle,\n}: TeaserCounterProps) => {\n const componentClassName = 'ds-teaser--counter'\n const classes = formatClassString([componentClassName, classNames])\n\n const mergedAttributes = {\n ...attributes,\n 'data-counter-date': counterDate,\n ...(countdown ? { 'data-countdown': countdown } : {}),\n }\n\n return (\n <TeaserCard {...{ areaType, targetLink, classes, attributes: mergedAttributes }}>\n <Content>\n {title && (\n <h2 className={`${componentClassName}__title`}>\n <span className={`${componentClassName}__title--highlighted`}>{title}</span>\n {subtitle && ` \u2013 ${subtitle}`}\n </h2>\n )}\n\n {(counterNumber || counterText) && (\n <div className={`${componentClassName}__counter-wrapper`}>\n {counterNumber && (\n <ul className={`${componentClassName}__list`}>\n {counterNumber\n .toString()\n .split('')\n .map((digit, index) => (\n <li key={index} className={`${componentClassName}__item`}>\n {digit}\n </li>\n ))}\n </ul>\n )}\n\n {counterText && (\n <p\n className={`${componentClassName}__counter-text`}\n dangerouslySetInnerHTML={{ __html: counterText }}\n ></p>\n )}\n </div>\n )}\n </Content>\n <Media {...{ mediaHtml }} />\n </TeaserCard>\n )\n}\n"],
5
- "mappings": ";AAAO,IAAM,oBAAoB,CAAC,iBAAqD;AACrF,SAAO,aAAa,OAAO,OAAK,CAAC,CAAC,CAAC,EAAE,KAAK,GAAG;AAC/C;;;AC+BM;AAbC,IAAM,aAAa,CAAC,EAAE,UAAU,YAAY,QAAQ,WAAW,SAAS,YAAY,SAAS,MAAwB;AAC1H,QAAM,qBAAqB;AAE3B,QAAM,aAAa,kBAAkB;AAAA,IACnC;AAAA,IACA,YAAY,GAAG,kBAAkB,KAAK,QAAQ;AAAA,IAC9C,YAAY,WAAW;AAAA,IACvB,aAAa,KAAK;AAAA,IAClB;AAAA,EACF,CAAC;AAED,MAAI,YAAY;AACd,WACE,oBAAC,OAAE,WAAW,YAAY,MAAM,YAAc,GAAG,YAC7C,UACJ;AAAA,EAEJ;AAEA,SACE,oBAAC,SAAI,WAAW,YAAY,GAAG,YAC3B,UACJ;AAEJ;;;ACnCsB,gBAAAA,YAAA;AAFf,IAAM,QAAQ,CAAC,EAAE,WAAW,QAAQ,MAAkB;AAC3D,QAAM,aAAa,sBAAsB,UAAU,+BAA+B;AAClF,SAAO,YAAa,gBAAAA,KAAC,SAAI,WAAW,YAAY,yBAAyB,EAAE,QAAQ,UAAU,GAAG,IAAO;AACzG;AAKO,IAAM,UAAU,CAAC,EAAE,SAAS,MAAoB;AACrD,SAAQ,gBAAAA,KAAC,SAAI,WAAU,sBACpB,UACH;AACF;;;ACoCU,SACE,OAAAC,MADF;AA1BH,IAAM,gBAAgB,CAAC;AAAA,EAC5B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAA0B;AACxB,QAAM,qBAAqB;AAC3B,QAAM,UAAU,kBAAkB,CAAC,oBAAoB,UAAU,CAAC;AAElE,QAAM,mBAAmB;AAAA,IACvB,GAAG;AAAA,IACH,qBAAqB;AAAA,IACrB,GAAI,YAAY,EAAE,kBAAkB,UAAU,IAAI,CAAC;AAAA,EACrD;AAEA,SACE,qBAAC,cAAY,GAAG,EAAE,UAAU,YAAY,SAAS,YAAY,iBAAiB,GAC5E;AAAA,yBAAC,WACE;AAAA,eACC,qBAAC,QAAG,WAAW,GAAG,kBAAkB,WAClC;AAAA,wBAAAA,KAAC,UAAK,WAAW,GAAG,kBAAkB,wBAAyB,iBAAM;AAAA,QACpE,YAAY,WAAM,QAAQ;AAAA,SAC7B;AAAA,OAGA,iBAAiB,gBACjB,qBAAC,SAAI,WAAW,GAAG,kBAAkB,qBAClC;AAAA,yBACC,gBAAAA,KAAC,QAAG,WAAW,GAAG,kBAAkB,UACjC,wBACE,SAAS,EACT,MAAM,EAAE,EACR,IAAI,CAAC,OAAO,UACX,gBAAAA,KAAC,QAAe,WAAW,GAAG,kBAAkB,UAC7C,mBADM,KAET,CACD,GACL;AAAA,QAGD,eACC,gBAAAA;AAAA,UAAC;AAAA;AAAA,YACC,WAAW,GAAG,kBAAkB;AAAA,YAChC,yBAAyB,EAAE,QAAQ,YAAY;AAAA;AAAA,QAChD;AAAA,SAEL;AAAA,OAEJ;AAAA,IACA,gBAAAA,KAAC,SAAO,GAAG,EAAE,UAAU,GAAG;AAAA,KAC5B;AAEJ;",
6
- "names": ["jsx", "jsx"]
7
- }