@kickstartds/ds-agency-premium 1.6.0--canary.19.1102.0 → 1.6.0--canary.19.1105.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.
@@ -4,6 +4,7 @@
4
4
  * and run json-schema-to-typescript to regenerate this file.
5
5
  */
6
6
  type HTMLString = string;
7
+ type ShowHTMLAfterConsent = boolean;
7
8
  /**
8
9
  * Add additional css classes that should be applied to the element
9
10
  */
@@ -17,7 +18,12 @@ type KsComponentAttribute = string;
17
18
  */
18
19
  interface HtmlProps {
19
20
  html?: HTMLString;
21
+ consent?: ShowHTMLAfterConsent;
22
+ consentText?: string;
23
+ consentButtonLabel?: string;
24
+ consentBackgroundImage?: string;
25
+ consentAspectRatio?: "16:9" | "16:10" | "4:3" | "1:1";
20
26
  className?: AdditionalClasses;
21
27
  component?: KsComponentAttribute;
22
28
  }
23
- export { HTMLString, AdditionalClasses, KsComponentAttribute, HtmlProps };
29
+ export { HTMLString, ShowHTMLAfterConsent, AdditionalClasses, KsComponentAttribute, HtmlProps };
@@ -9,7 +9,7 @@ import { FaqProps } from "./FaqProps-ad618cd5.js";
9
9
  import { FeaturesProps } from "./FeaturesProps-b05859d6.js";
10
10
  import { GalleryProps } from "./GalleryProps-76e7de44.js";
11
11
  import { HeroProps } from "./HeroProps-cf82a16d.js";
12
- import { HtmlProps } from "./HtmlProps-8e3e725a.js";
12
+ import { HtmlProps } from "./HtmlProps-8e95ed81.js";
13
13
  import { ImageStoryProps } from "./ImageStoryProps-e853e1e7.js";
14
14
  import { ImageTextProps } from "./ImageTextProps-9286cca4.js";
15
15
  import { LogosProps } from "./LogosProps-f9474fe2.js";
@@ -902,9 +902,34 @@
902
902
  "title": "HTML string",
903
903
  "type": "string",
904
904
  "examples": [
905
- "<p>Hello world!</p>"
905
+ "<p style=\"color: var(--ks-text-color-default);\">Hello World</p>"
906
906
  ]
907
907
  },
908
+ "consent": {
909
+ "title": "Show HTML after consent",
910
+ "type": "boolean",
911
+ "default": false
912
+ },
913
+ "consentText": {
914
+ "type": "string"
915
+ },
916
+ "consentButtonLabel": {
917
+ "type": "string"
918
+ },
919
+ "consentBackgroundImage": {
920
+ "type": "string",
921
+ "format": "image"
922
+ },
923
+ "consentAspectRatio": {
924
+ "type": "string",
925
+ "enum": [
926
+ "16:9",
927
+ "16:10",
928
+ "4:3",
929
+ "1:1"
930
+ ],
931
+ "default": "16:9"
932
+ },
908
933
  "className": {
909
934
  "title": "Additional Classes",
910
935
  "description": "Add additional css classes that should be applied to the element",
@@ -1170,9 +1170,34 @@
1170
1170
  "title": "HTML string",
1171
1171
  "type": "string",
1172
1172
  "examples": [
1173
- "<p>Hello world!</p>"
1173
+ "<p style=\"color: var(--ks-text-color-default);\">Hello World</p>"
1174
1174
  ]
1175
1175
  },
1176
+ "consent": {
1177
+ "title": "Show HTML after consent",
1178
+ "type": "boolean",
1179
+ "default": false
1180
+ },
1181
+ "consentText": {
1182
+ "type": "string"
1183
+ },
1184
+ "consentButtonLabel": {
1185
+ "type": "string"
1186
+ },
1187
+ "consentBackgroundImage": {
1188
+ "type": "string",
1189
+ "format": "image"
1190
+ },
1191
+ "consentAspectRatio": {
1192
+ "type": "string",
1193
+ "enum": [
1194
+ "16:9",
1195
+ "16:10",
1196
+ "4:3",
1197
+ "1:1"
1198
+ ],
1199
+ "default": "16:9"
1200
+ },
1176
1201
  "className": {
1177
1202
  "title": "Additional Classes",
1178
1203
  "description": "Add additional css classes that should be applied to the element",
@@ -0,0 +1,5 @@
1
+ declare class Html {
2
+ static identifier: string;
3
+ constructor(element: any);
4
+ }
5
+ export { Html as default };
@@ -0,0 +1,41 @@
1
+ import { define, Component } from '@kickstartds/core/lib/component';
2
+
3
+ const consentButtonSelector = ".c-html__consent-button";
4
+ const copyScriptTag = (original) => {
5
+ if (original.tagName === "SCRIPT") {
6
+ const copy = document.createElement("script");
7
+ for (const attr of original.attributes) {
8
+ copy.setAttribute(attr.name, attr.value);
9
+ }
10
+ copy.textContent = original.textContent;
11
+ return copy;
12
+ }
13
+ return original;
14
+ };
15
+ class Html extends Component {
16
+ constructor(element) {
17
+ super(element);
18
+ const consentButton = element.querySelector(consentButtonSelector);
19
+ const replaceHtml = () => {
20
+ const template = element.querySelector("template");
21
+ if (template) {
22
+ const elements = [...template.content.children].map(copyScriptTag);
23
+ element.replaceChildren(...elements);
24
+ consentButton?.removeEventListener("click", replaceHtml);
25
+ }
26
+ };
27
+ if (consentButton) {
28
+ consentButton.addEventListener("click", replaceHtml);
29
+ this.onDisconnect(() => {
30
+ consentButton.removeEventListener("click", replaceHtml);
31
+ });
32
+ }
33
+ else {
34
+ replaceHtml();
35
+ }
36
+ }
37
+ }
38
+ Html.identifier = "dsa.html";
39
+ define(Html.identifier, Html);
40
+
41
+ export { Html as default };
@@ -0,0 +1,20 @@
1
+ .c-html__consent {
2
+ color: var(--ks-text-color-default);
3
+ font: var(--ks-font-interface-m);
4
+ display: flex;
5
+ align-items: center;
6
+ flex-direction: column;
7
+ justify-content: center;
8
+ }
9
+ .c-html__consent--sixteen-to-nine {
10
+ aspect-ratio: 16/9;
11
+ }
12
+ .c-html__consent--sixteen-to-ten {
13
+ aspect-ratio: 16/10;
14
+ }
15
+ .c-html__consent--four-to-three {
16
+ aspect-ratio: 4/3;
17
+ }
18
+ .c-html__consent--square {
19
+ aspect-ratio: 1;
20
+ }
@@ -9,9 +9,34 @@
9
9
  "title": "HTML string",
10
10
  "type": "string",
11
11
  "examples": [
12
- "<p>Hello world!</p>"
12
+ "<p style=\"color: var(--ks-text-color-default);\">Hello World</p>"
13
13
  ]
14
14
  },
15
+ "consent": {
16
+ "title": "Show HTML after consent",
17
+ "type": "boolean",
18
+ "default": false
19
+ },
20
+ "consentText": {
21
+ "type": "string"
22
+ },
23
+ "consentButtonLabel": {
24
+ "type": "string"
25
+ },
26
+ "consentBackgroundImage": {
27
+ "type": "string",
28
+ "format": "image"
29
+ },
30
+ "consentAspectRatio": {
31
+ "type": "string",
32
+ "enum": [
33
+ "16:9",
34
+ "16:10",
35
+ "4:3",
36
+ "1:1"
37
+ ],
38
+ "default": "16:9"
39
+ },
15
40
  "className": {
16
41
  "title": "Additional Classes",
17
42
  "description": "Add additional css classes that should be applied to the element",
@@ -8,7 +8,34 @@
8
8
  "html": {
9
9
  "title": "HTML string",
10
10
  "type": "string",
11
- "examples": ["<p>Hello world!</p>"]
11
+ "examples": [
12
+ "<p style=\"color: var(--ks-text-color-default);\">Hello World</p>"
13
+ ]
14
+ },
15
+ "consent": {
16
+ "title": "Show HTML after consent",
17
+ "type": "boolean",
18
+ "default": false
19
+ },
20
+ "consentText": {
21
+ "type": "string"
22
+ },
23
+ "consentButtonLabel": {
24
+ "type": "string"
25
+ },
26
+ "consentBackgroundImage": {
27
+ "type": "string",
28
+ "format": "image"
29
+ },
30
+ "consentAspectRatio": {
31
+ "type": "string",
32
+ "enum": [
33
+ "16:9",
34
+ "16:10",
35
+ "4:3",
36
+ "1:1"
37
+ ],
38
+ "default": "16:9"
12
39
  },
13
40
  "className": {
14
41
  "title": "Additional Classes",
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { HTMLAttributes } from "react";
3
- import { HtmlProps } from "../../HtmlProps-8e3e725a.js";
3
+ import { HtmlProps } from "../../HtmlProps-8e95ed81.js";
4
4
  declare const HtmlContextDefault: import("react").ForwardRefExoticComponent<HtmlProps & HTMLAttributes<HTMLDivElement> & import("react").RefAttributes<HTMLDivElement>>;
5
5
  declare const HtmlContext: import("react").Context<import("react").ForwardRefExoticComponent<HtmlProps & HTMLAttributes<HTMLDivElement> & import("react").RefAttributes<HTMLDivElement>>>;
6
6
  declare const Html: import("react").ForwardRefExoticComponent<HtmlProps & HTMLAttributes<HTMLDivElement> & import("react").RefAttributes<HTMLDivElement>>;
@@ -1,35 +1,23 @@
1
- import { jsx } from 'react/jsx-runtime';
2
- import { forwardRef, useRef, useImperativeHandle, useEffect, createContext, useContext } from 'react';
1
+ import "./html.css";
2
+ import { jsxs, jsx } from 'react/jsx-runtime';
3
+ import { forwardRef, createContext, useContext } from 'react';
3
4
  import classnames from 'classnames';
5
+ import { Button } from '@kickstartds/base/lib/button';
6
+ import { RichText } from '@kickstartds/base/lib/rich-text';
7
+ import './Html.client.js';
8
+ import '@kickstartds/core/lib/component';
4
9
 
5
- const copyScriptTag = (original) => {
6
- if (original.tagName !== "SCRIPT") {
7
- return original;
8
- }
9
- const copy = document.createElement("script");
10
- for (const attr of original.attributes) {
11
- copy.setAttribute(attr.name, attr.value);
12
- }
13
- copy.textContent = original.textContent;
14
- return copy;
15
- };
16
- const HtmlContextDefault = forwardRef(({ html, className, component, ...props }, forwardedRef) => {
17
- const ref = useRef(null);
18
- useImperativeHandle(forwardedRef, () => ref.current);
19
- useEffect(() => {
20
- if (html && ref.current) {
21
- const parser = new DOMParser();
22
- const doc = parser.parseFromString(html, "text/html");
23
- const elements = [...doc.head.children, ...doc.body.children];
24
- const insertedElements = elements.map((element) => ref.current.appendChild(copyScriptTag(element)));
25
- return () => {
26
- for (const insertedElement of insertedElements) {
27
- insertedElement?.remove();
28
- }
29
- };
30
- }
31
- }, [html, ref.current]);
32
- return (jsx("div", { ref: ref, className: classnames("c-html", className), "ks-component": component, ...props }));
10
+ const HtmlContextDefault = forwardRef(({ html, consent, consentText, consentBackgroundImage, consentButtonLabel, consentAspectRatio = "16:9", className, component = "dsa.html", ...props }, ref) => {
11
+ return (jsxs("div", { ref: ref, className: classnames("c-html", className), "ks-component": component, ...props, children: [jsx("template", { dangerouslySetInnerHTML: { __html: html } }), consent && (jsxs("div", { style: {
12
+ backgroundImage: consentBackgroundImage
13
+ ? `url(${consentBackgroundImage})`
14
+ : undefined,
15
+ }, className: classnames("c-html__consent", {
16
+ "c-html__consent--sixteen-to-nine": consentAspectRatio === "16:9",
17
+ "c-html__consent--sixteen-to-ten": consentAspectRatio === "16:10",
18
+ "c-html__consent--four-to-three": consentAspectRatio === "4:3",
19
+ "c-html__consent--square": consentAspectRatio === "1:1",
20
+ }), children: [consentText && jsx(RichText, { text: consentText }), jsx(Button, { type: "button", label: consentButtonLabel, className: "c-html__consent-button" })] }))] }));
33
21
  });
34
22
  const HtmlContext = createContext(HtmlContextDefault);
35
23
  const Html = forwardRef((props, ref) => {
@@ -902,9 +902,34 @@
902
902
  "title": "HTML string",
903
903
  "type": "string",
904
904
  "examples": [
905
- "<p>Hello world!</p>"
905
+ "<p style=\"color: var(--ks-text-color-default);\">Hello World</p>"
906
906
  ]
907
907
  },
908
+ "consent": {
909
+ "title": "Show HTML after consent",
910
+ "type": "boolean",
911
+ "default": false
912
+ },
913
+ "consentText": {
914
+ "type": "string"
915
+ },
916
+ "consentButtonLabel": {
917
+ "type": "string"
918
+ },
919
+ "consentBackgroundImage": {
920
+ "type": "string",
921
+ "format": "image"
922
+ },
923
+ "consentAspectRatio": {
924
+ "type": "string",
925
+ "enum": [
926
+ "16:9",
927
+ "16:10",
928
+ "4:3",
929
+ "1:1"
930
+ ],
931
+ "default": "16:9"
932
+ },
908
933
  "className": {
909
934
  "title": "Additional Classes",
910
935
  "description": "Add additional css classes that should be applied to the element",
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Thu, 24 Oct 2024 13:27:40 GMT
3
+ * Generated on Thu, 24 Oct 2024 14:37:17 GMT
4
4
  */
5
5
  :root, [ks-theme] {
6
6
  --ks-background-color-accent-base: var(--ks-color-primary-to-bg-8-base);
@@ -2153,6 +2153,46 @@
2153
2153
  },
2154
2154
  "screenshot": "img/screenshots/components-hero--text-box-on-full-screen.png"
2155
2155
  },
2156
+ {
2157
+ "id": "components-html--html",
2158
+ "group": "Components/HTML",
2159
+ "name": "HTML",
2160
+ "code": "<Html\n consentAspectRatio=\"16:9\"\n html=\"<p style=&quot;color: var(--ks-text-color-default);&quot;>Hello World</p>\"\n/>",
2161
+ "args": {
2162
+ "html": "<p style=\"color: var(--ks-text-color-default);\">Hello World</p>",
2163
+ "consent": false,
2164
+ "consentAspectRatio": "16:9"
2165
+ },
2166
+ "screenshot": "img/screenshots/components-html--html.png"
2167
+ },
2168
+ {
2169
+ "id": "components-html--with-consent",
2170
+ "group": "Components/HTML",
2171
+ "name": "WithConsent",
2172
+ "code": "<Html\n consent\n consentAspectRatio=\"16:9\"\n consentBackgroundImage=\"img/02.jpg\"\n consentButtonLabel=\"yes!\"\n consentText=\"would you like to watch the youtube video?\"\n html=\"<iframe width=&quot;560&quot; height=&quot;315&quot; src=&quot;https://www.youtube-nocookie.com/embed/oGGIkuGY-7U?si=Y5_JHflGsNwRCLu_&quot; title=&quot;YouTube video player&quot; frameborder=&quot;0&quot; allow=&quot;accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share&quot; referrerpolicy=&quot;strict-origin-when-cross-origin&quot; allowfullscreen></iframe>\"\n/>",
2173
+ "args": {
2174
+ "html": "<iframe width=\"560\" height=\"315\" src=\"https://www.youtube-nocookie.com/embed/oGGIkuGY-7U?si=Y5_JHflGsNwRCLu_\" title=\"YouTube video player\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen></iframe>",
2175
+ "consent": true,
2176
+ "consentAspectRatio": "16:9",
2177
+ "consentText": "would you like to watch the youtube video?",
2178
+ "consentButtonLabel": "yes!",
2179
+ "consentBackgroundImage": "img/02.jpg"
2180
+ },
2181
+ "screenshot": "img/screenshots/components-html--with-consent.png"
2182
+ },
2183
+ {
2184
+ "id": "components-html--with-script",
2185
+ "group": "Components/HTML",
2186
+ "name": "WithScript",
2187
+ "code": "<Html\n consent\n consentAspectRatio=\"16:9\"\n consentButtonLabel=\"Say hello\"\n html=\"<script>alert(&quot;Hello :)&quot;)</script><p style=&quot;color: var(--ks-text-color-default);&quot;>Nice to meet you!</p>\"\n/>",
2188
+ "args": {
2189
+ "html": "<script>alert(\"Hello :)\")</script><p style=\"color: var(--ks-text-color-default);\">Nice to meet you!</p>",
2190
+ "consent": true,
2191
+ "consentAspectRatio": "16:9",
2192
+ "consentButtonLabel": "Say hello"
2193
+ },
2194
+ "screenshot": "img/screenshots/components-html--with-script.png"
2195
+ },
2156
2196
  {
2157
2197
  "id": "components-image-story--sticky-image-next-to-scrolling-text",
2158
2198
  "group": "Components/Image Story",
@@ -888,9 +888,34 @@
888
888
  "title": "HTML string",
889
889
  "type": "string",
890
890
  "examples": [
891
- "<p>Hello world!</p>"
891
+ "<p style=\"color: var(--ks-text-color-default);\">Hello World</p>"
892
892
  ]
893
893
  },
894
+ "consent": {
895
+ "title": "Show HTML after consent",
896
+ "type": "boolean",
897
+ "default": false
898
+ },
899
+ "consentText": {
900
+ "type": "string"
901
+ },
902
+ "consentButtonLabel": {
903
+ "type": "string"
904
+ },
905
+ "consentBackgroundImage": {
906
+ "type": "string",
907
+ "format": "image"
908
+ },
909
+ "consentAspectRatio": {
910
+ "type": "string",
911
+ "enum": [
912
+ "16:9",
913
+ "16:10",
914
+ "4:3",
915
+ "1:1"
916
+ ],
917
+ "default": "16:9"
918
+ },
894
919
  "className": {
895
920
  "title": "Additional Classes",
896
921
  "description": "Add additional css classes that should be applied to the element",
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Thu, 24 Oct 2024 13:27:44 GMT
3
+ * Generated on Thu, 24 Oct 2024 14:37:21 GMT
4
4
  */
5
5
  :root [ks-theme=business] {
6
6
  --ks-background-color-accent-base: var(--ks-color-primary-to-bg-8-base);
@@ -2727,7 +2727,7 @@
2727
2727
  }
2728
2728
  /**
2729
2729
  * Do not edit directly
2730
- * Generated on Thu, 24 Oct 2024 13:27:49 GMT
2730
+ * Generated on Thu, 24 Oct 2024 14:37:26 GMT
2731
2731
  */
2732
2732
  :root [ks-theme=google] {
2733
2733
  --ks-background-color-accent-base: var(--ks-color-primary-to-bg-8-base);
@@ -5458,7 +5458,7 @@
5458
5458
  }
5459
5459
  /**
5460
5460
  * Do not edit directly
5461
- * Generated on Thu, 24 Oct 2024 13:27:47 GMT
5461
+ * Generated on Thu, 24 Oct 2024 14:37:24 GMT
5462
5462
  */
5463
5463
  :root [ks-theme=ngo] {
5464
5464
  --ks-background-color-accent-base: var(--ks-color-primary-to-bg-8-base);
@@ -8459,7 +8459,7 @@
8459
8459
  }
8460
8460
  /**
8461
8461
  * Do not edit directly
8462
- * Generated on Thu, 24 Oct 2024 13:27:51 GMT
8462
+ * Generated on Thu, 24 Oct 2024 14:37:29 GMT
8463
8463
  */
8464
8464
  :root [ks-theme=telekom] {
8465
8465
  --ks-background-color-accent-base: var(--ks-color-primary-to-bg-8-base);
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Thu, 24 Oct 2024 13:27:40 GMT
3
+ * Generated on Thu, 24 Oct 2024 14:37:17 GMT
4
4
  */
5
5
 
6
6
  :root, [ks-theme] {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Thu, 24 Oct 2024 13:27:41 GMT
3
+ * Generated on Thu, 24 Oct 2024 14:37:18 GMT
4
4
  */
5
5
 
6
6
  export const KsBackgroundColorAccentBase = "#230a2b";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kickstartds/ds-agency-premium",
3
- "version": "1.6.0--canary.19.1102.0",
3
+ "version": "1.6.0--canary.19.1105.0",
4
4
  "description": "",
5
5
  "homepage": "https://github.com/kickstartDS/ds-agency-premium#readme",
6
6
  "bugs": {