@kickstartds/ds-agency-premium 1.3.14--canary.456.8b32ca2.0 → 1.4.0--canary.12.465.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.
@@ -8,7 +8,7 @@ import { FaqProps } from "./FaqProps-ad618cd5.js";
8
8
  import { FeaturesProps } from "./FeaturesProps-b05859d6.js";
9
9
  import { GalleryProps } from "./GalleryProps-76e7de44.js";
10
10
  import { HeroProps } from "./HeroProps-cf82a16d.js";
11
- import { ImageStoryProps } from "./ImageStoryProps-03ff6d21.js";
11
+ import { ImageStoryProps } from "./ImageStoryProps-24e0335c.js";
12
12
  import { ImageTextProps } from "./ImageTextProps-9286cca4.js";
13
13
  import { LogosProps } from "./LogosProps-58c84ccc.js";
14
14
  import { MosaicProps } from "./MosaicProps-d52c7151.js";
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import { BlogOverviewProps } from "../../BlogOverviewProps-525f7f9f.js";
2
+ import { BlogOverviewProps } from "../../BlogOverviewProps-f385fc47.js";
3
3
  declare const BlogOverview: {
4
4
  ({ latest, more }: BlogOverviewProps): import("react/jsx-runtime").JSX.Element;
5
5
  displayName: string;
@@ -4,6 +4,7 @@ import { Section } from '../section/index.js';
4
4
  import { BlogTeaser } from '../blog-teaser/index.js';
5
5
  import 'classnames';
6
6
  import '@kickstartds/core/lib/react';
7
+ import '../headline-level-context/index.js';
7
8
  import '@kickstartds/base/lib/section';
8
9
  import '../section/js/Section.client.js';
9
10
  import '@kickstartds/core/lib/component';
@@ -9,6 +9,7 @@ import 'classnames';
9
9
  import 'react';
10
10
  import '@kickstartds/blog/lib/post-head';
11
11
  import '@kickstartds/core/lib/react';
12
+ import '../headline-level-context/index.js';
12
13
  import '@kickstartds/base/lib/section';
13
14
  import '../section/js/Section.client.js';
14
15
  import '@kickstartds/core/lib/component';
@@ -4,11 +4,17 @@ import classnames from 'classnames';
4
4
  import { forwardRef } from 'react';
5
5
  import { compiler } from 'markdown-to-jsx';
6
6
  import { HeadlineContext } from '@kickstartds/base/lib/headline';
7
+ import { useHeadlineLevel } from '../headline-level-context/index.js';
7
8
 
8
9
  const Headline = forwardRef(({ content, text = content, sub, align = "left", switchOrder = false, level = "h2",
9
10
  // @ts-expect-error: Some kDS Components set the `styleAs`Props (e.g. https://github.com/kickstartDS/content/blob/next/source/storytelling/StorytellingComponent.tsx#L146)
10
11
  styleAs, style = styleAs || "h2", spaceAfter = "small", className, renderContent = compiler, renderSubheadline = compiler, ...props }, ref) => {
11
- const TagName = level;
12
+ const computedLevel = useHeadlineLevel();
13
+ const TagName = level === "p"
14
+ ? level
15
+ : computedLevel
16
+ ? ("h" + computedLevel)
17
+ : level;
12
18
  return text || sub ? (jsxs("header", { className: classnames("dsa-headline", `dsa-headline--${style}`, style !== "none" && style !== level && `dsa-headline--${style}`, `dsa-headline--align-${align}`, spaceAfter && `dsa-headline--space-after-${spaceAfter}`, className), ref: ref, ...props, children: [sub && switchOrder && (jsx("p", { className: "dsa-headline__subheadline", children: renderSubheadline(sub) })), jsx(TagName, { className: classnames("dsa-headline__headline"), children: renderContent(text) }), sub && !switchOrder && (jsx("p", { className: "dsa-headline__subheadline", children: renderSubheadline(sub) }))] })) : null;
13
19
  });
14
20
  Headline.displayName = "Headline";
@@ -0,0 +1,4 @@
1
+ import { FC, PropsWithChildren } from "react";
2
+ declare const HeadlineLevelProvider: FC<PropsWithChildren>;
3
+ declare const useHeadlineLevel: () => number;
4
+ export { HeadlineLevelProvider, useHeadlineLevel };
@@ -0,0 +1,33 @@
1
+ import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
2
+ import { createContext, useContext, useRef, useCallback } from 'react';
3
+
4
+ const HeadlineLevelContext = createContext([1]);
5
+ const HeadlineLevelProvider = ({ children }) => {
6
+ const [parentInitialLevel, parentIsFirstHeadlineRef] = useContext(HeadlineLevelContext);
7
+ /* @refresh reset */
8
+ const isFirstHeadlineRef = useRef(true);
9
+ const initialLevel = !parentIsFirstHeadlineRef || parentIsFirstHeadlineRef.current
10
+ ? parentInitialLevel
11
+ : parentInitialLevel + 1;
12
+ // prevent first section without headlines to increase the headline leven
13
+ // this component has to run _after_ the children to check if any headline was rendered
14
+ const UpdateParent = useCallback(() => {
15
+ if (parentIsFirstHeadlineRef?.current) {
16
+ parentIsFirstHeadlineRef.current = isFirstHeadlineRef.current;
17
+ }
18
+ return null;
19
+ }, []);
20
+ return (jsxs(Fragment, { children: [jsx(HeadlineLevelContext.Provider, { value: [initialLevel, isFirstHeadlineRef], children: children }), jsx(UpdateParent, {})] }));
21
+ };
22
+ const useHeadlineLevel = () => {
23
+ const [initialLevel, isFirstHeadlineRef] = useContext(HeadlineLevelContext);
24
+ if (isFirstHeadlineRef?.current) {
25
+ isFirstHeadlineRef.current = false;
26
+ return initialLevel;
27
+ }
28
+ else {
29
+ return initialLevel + 1;
30
+ }
31
+ };
32
+
33
+ export { HeadlineLevelProvider, useHeadlineLevel };
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { HTMLAttributes } from "react";
3
- import { ImageStoryProps } from "../../ImageStoryProps-03ff6d21.js";
3
+ import { ImageStoryProps } from "../../ImageStoryProps-24e0335c.js";
4
4
  declare const ImageStoryContextDefault: import("react").ForwardRefExoticComponent<ImageStoryProps & HTMLAttributes<HTMLDivElement> & import("react").RefAttributes<HTMLDivElement>>;
5
5
  declare const ImageStoryContext: import("react").Context<import("react").ForwardRefExoticComponent<ImageStoryProps & HTMLAttributes<HTMLDivElement> & import("react").RefAttributes<HTMLDivElement>>>;
6
6
  declare const ImageStory: import("react").ForwardRefExoticComponent<ImageStoryProps & HTMLAttributes<HTMLDivElement> & import("react").RefAttributes<HTMLDivElement>>;
@@ -4,7 +4,7 @@
4
4
  * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
5
5
  * and run json-schema-to-typescript to regenerate this file.
6
6
  */
7
- import { SectionProps } from "../../SectionProps-83d399b4.js";
7
+ import { SectionProps } from "../../SectionProps-93230a76.js";
8
8
  import { SeoProps } from "../../SeoProps-f2d6dcaa.js";
9
9
  /* eslint-disable */
10
10
  /**
@@ -73,5 +73,5 @@ interface SettingsProps {
73
73
  seo: SeoProps;
74
74
  }
75
75
  export * from "../../BlogPostProps-e1cbd5d3.js";
76
- export * from "../../BlogOverviewProps-525f7f9f.js";
76
+ export * from "../../BlogOverviewProps-f385fc47.js";
77
77
  export { Sections, Floating, Inverted, Inverted1, PageProps, Header, Footer, SettingsProps };
@@ -1,10 +1,11 @@
1
1
  import "./tokens.css";
2
2
  import { jsxs, jsx } from 'react/jsx-runtime';
3
+ import { HeadlineLevelProvider } from '../headline-level-context/index.js';
3
4
  import Providers from '../providers/index.js';
4
5
  import '@kickstartds/base/lib/global/base';
5
6
  import '../../global-35f78d6d.js';
6
- import '../button/index.js';
7
7
  import 'react';
8
+ import '../button/index.js';
8
9
  import 'classnames';
9
10
  import '@kickstartds/base/lib/button';
10
11
  import '../section/index.js';
@@ -488,6 +489,6 @@ var IconSprite = (() => /*#__PURE__*/ jsxs("svg", {
488
489
  })]
489
490
  }));
490
491
 
491
- const PageWrapper = ({ children }) => (jsxs(Providers, { children: [jsx(IconSprite, {}), children] }));
492
+ const PageWrapper = ({ children }) => (jsx(HeadlineLevelProvider, { children: jsxs(Providers, { children: [jsx(IconSprite, {}), children] }) }));
492
493
 
493
494
  export { PageWrapper };
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Tue, 04 Jun 2024 08:34:53 GMT
3
+ * Generated on Fri, 28 Jun 2024 15:20:06 GMT
4
4
  */
5
5
  :root, [ks-theme] {
6
6
  --ks-background-color-accent-base: var(--ks-color-primary-to-bg-8-base);
@@ -9,6 +9,7 @@ import 'react';
9
9
  import 'classnames';
10
10
  import '@kickstartds/base/lib/button';
11
11
  import '@kickstartds/core/lib/react';
12
+ import '../headline-level-context/index.js';
12
13
  import '@kickstartds/base/lib/section';
13
14
  import '../section/js/Section.client.js';
14
15
  import '@kickstartds/core/lib/component';
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { HTMLAttributes, FC, PropsWithChildren } from "react";
3
- import { SectionProps } from "../../SectionProps-83d399b4.js";
3
+ import { SectionProps } from "../../SectionProps-93230a76.js";
4
4
  declare const Section: import("react").ForwardRefExoticComponent<SectionProps & Omit<HTMLAttributes<HTMLElement>, "style" | "content"> & import("react").RefAttributes<HTMLDivElement>>;
5
5
  declare const SectionProvider: FC<PropsWithChildren<any>>;
6
6
  export { Section, SectionProvider };
@@ -3,6 +3,7 @@ import { jsx } from 'react/jsx-runtime';
3
3
  import { forwardRef } from 'react';
4
4
  import classnames from 'classnames';
5
5
  import { useKsComponent } from '@kickstartds/core/lib/react';
6
+ import { HeadlineLevelProvider } from '../headline-level-context/index.js';
6
7
  import { SectionContextDefault, SectionContext } from '@kickstartds/base/lib/section';
7
8
  import { identifier } from './js/Section.client.js';
8
9
  import '@kickstartds/core/lib/component';
@@ -16,31 +17,31 @@ const Section = forwardRef(({ headline, content, headerSpacing, width = "default
16
17
  spotlight,
17
18
  content?.mode === "slider",
18
19
  ]);
19
- return (jsx(SectionContextDefault, { ...props, ...componentProps, className: classnames("dsa-section", style !== "default" &&
20
- `dsa-section-style--${style === "verticalGradient"
21
- ? "vertical-gradient"
22
- : style === "horizontalGradient"
23
- ? "horizontal-gradient"
24
- : style === "accentTransition"
25
- ? "accent-transition"
26
- : style === "boldTransition"
27
- ? "bold-transition"
28
- : style === "symmetricGlow"
29
- ? "symmetric-glow"
30
- : style === "anchorGlow"
31
- ? "anchor-glow"
32
- : style}`, headerSpacing && "dsa-section--header-spacing", spotlight && "dsa-section--spotlight", className), background: backgroundColor, content: content, headline: {
33
- ...headlineRest,
34
- spaceAfter: "large",
35
- // @ts-expect-error
36
- content: headlineRest.text,
37
- level: "h2",
38
- style: headlineLarge ? "h1" : "h2",
39
- }, buttons: {
40
- buttons,
41
- // @ts-expect-error
42
- items: buttons,
43
- }, width: width, spaceBefore: spaceBefore, spaceAfter: spaceAfter, inverted: inverted, ref: ref, children: props.children }));
20
+ return (jsx(HeadlineLevelProvider, { children: jsx(SectionContextDefault, { ...props, ...componentProps, className: classnames("dsa-section", style !== "default" &&
21
+ `dsa-section-style--${style === "verticalGradient"
22
+ ? "vertical-gradient"
23
+ : style === "horizontalGradient"
24
+ ? "horizontal-gradient"
25
+ : style === "accentTransition"
26
+ ? "accent-transition"
27
+ : style === "boldTransition"
28
+ ? "bold-transition"
29
+ : style === "symmetricGlow"
30
+ ? "symmetric-glow"
31
+ : style === "anchorGlow"
32
+ ? "anchor-glow"
33
+ : style}`, headerSpacing && "dsa-section--header-spacing", spotlight && "dsa-section--spotlight", className), background: backgroundColor, content: content, headline: {
34
+ ...headlineRest,
35
+ spaceAfter: "large",
36
+ // @ts-expect-error
37
+ content: headlineRest.text,
38
+ level: "h2",
39
+ style: headlineLarge ? "h1" : "h2",
40
+ }, buttons: {
41
+ buttons,
42
+ // @ts-expect-error
43
+ items: buttons,
44
+ }, width: width, spaceBefore: spaceBefore, spaceAfter: spaceAfter, inverted: inverted, ref: ref, children: props.children }) }));
44
45
  });
45
46
  Section.displayName = "Section";
46
47
  const SectionProvider = (props) => (jsx(SectionContext.Provider, { ...props, value: Section }));
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Tue, 04 Jun 2024 08:34:55 GMT
3
+ * Generated on Fri, 28 Jun 2024 15:20:09 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 Tue, 04 Jun 2024 08:34:59 GMT
2730
+ * Generated on Fri, 28 Jun 2024 15:20:13 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 Tue, 04 Jun 2024 08:34:57 GMT
5461
+ * Generated on Fri, 28 Jun 2024 15:20:11 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 Tue, 04 Jun 2024 08:35:01 GMT
8462
+ * Generated on Fri, 28 Jun 2024 15:20:16 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 Tue, 04 Jun 2024 08:34:53 GMT
3
+ * Generated on Fri, 28 Jun 2024 15:20:06 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 Tue, 04 Jun 2024 08:34:53 GMT
3
+ * Generated on Fri, 28 Jun 2024 15:20:07 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.3.14--canary.456.8b32ca2.0",
3
+ "version": "1.4.0--canary.12.465.0",
4
4
  "description": "",
5
5
  "homepage": "https://github.com/kickstartDS/ds-agency-premium#readme",
6
6
  "bugs": {