@kickstartds/ds-agency-premium 1.6.71--canary.50.2253.0 → 1.6.71--canary.50.2257.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.
@@ -3,7 +3,7 @@
3
3
  * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
4
4
  * and run json-schema-to-typescript to regenerate this file.
5
5
  */
6
- import { SectionProps } from "./SectionProps-4e2b2ecf.js";
6
+ import { SectionProps } from "./SectionProps-d60aba86.js";
7
7
  import { BlogTeaserProps } from "./BlogTeaserProps-f5855e93.js";
8
8
  import { CtaProps } from "./CtaProps-789f8508.js";
9
9
  import { SeoProps } from "./SeoProps-f2d6dcaa.js";
@@ -4,8 +4,8 @@
4
4
  * and run json-schema-to-typescript to regenerate this file.
5
5
  */
6
6
  import { BlogHeadProps } from "./BlogHeadProps-c04a5ed8.js";
7
- import { BlogAsideProps } from "./BlogAsideProps-c760fd2a.js";
8
- import { SectionProps } from "./SectionProps-4e2b2ecf.js";
7
+ import { BlogAsideProps } from "./BlogAsideProps-fb0241df.js";
8
+ import { SectionProps } from "./SectionProps-d60aba86.js";
9
9
  import { CtaProps } from "./CtaProps-789f8508.js";
10
10
  import { SeoProps } from "./SeoProps-f2d6dcaa.js";
11
11
  /**
@@ -3,7 +3,7 @@
3
3
  * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
4
4
  * and run json-schema-to-typescript to regenerate this file.
5
5
  */
6
- import { SectionProps } from "./SectionProps-4e2b2ecf.js";
6
+ import { SectionProps } from "./SectionProps-d60aba86.js";
7
7
  import { SeoProps } from "./SeoProps-f2d6dcaa.js";
8
8
  /**
9
9
  * Collection of sections (with their contents) to render on the page
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { HTMLAttributes } from "react";
3
- import { BlogAsideProps } from "../../BlogAsideProps-c760fd2a.js";
3
+ import { BlogAsideProps } from "../../BlogAsideProps-fb0241df.js";
4
4
  declare const BlogAsideContextDefault: import("react").ForwardRefExoticComponent<BlogAsideProps & HTMLAttributes<HTMLDivElement> & import("react").RefAttributes<HTMLDivElement>>;
5
5
  declare const BlogAsideContext: import("react").Context<import("react").ForwardRefExoticComponent<BlogAsideProps & HTMLAttributes<HTMLDivElement> & import("react").RefAttributes<HTMLDivElement>>>;
6
6
  declare const BlogAside: import("react").ForwardRefExoticComponent<BlogAsideProps & import("react").RefAttributes<HTMLDivElement>>;
@@ -1,4 +1,4 @@
1
- import { BlogPostProps } from "../../BlogPostProps-c760fd2a.js";
1
+ import { BlogPostProps } from "../../BlogPostProps-d60aba86.js";
2
2
  import { FC, PropsWithChildren } from "react";
3
3
  declare const BlogPost: FC<PropsWithChildren<BlogPostProps>>;
4
4
  export type { BlogPostProps };
@@ -29,7 +29,7 @@ interface SettingsProps {
29
29
  seo: SeoProps;
30
30
  iconSprite?: IconSprite;
31
31
  }
32
- export * from "../../BlogPostProps-c760fd2a.js";
32
+ export * from "../../BlogPostProps-d60aba86.js";
33
33
  export * from "../../BlogOverviewProps-d60aba86.js";
34
34
  export * from "../../PageProps-d60aba86.js";
35
35
  export { IconSprite, SettingsProps };
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Fri, 05 Sep 2025 12:56:39 GMT
3
+ * Generated on Fri, 05 Sep 2025 13:51:26 GMT
4
4
  */
5
5
  :root, [ks-theme] {
6
6
  --ks-background-color-accent-base: var(--ks-color-fg-to-bg-9-base);
@@ -30,6 +30,15 @@ const renderResult = (result, element) => {
30
30
  image.src = result.image;
31
31
  }
32
32
  };
33
+ const limitSubResults = (subResults, limit) => {
34
+ if (subResults.length <= limit)
35
+ return subResults;
36
+ const topUrls = [...subResults]
37
+ .sort((a, b) => b.locations.length - a.locations.length)
38
+ .slice(0, limit)
39
+ .map((r) => r.url);
40
+ return subResults.filter((r) => topUrls.includes(r.url));
41
+ };
33
42
  class SearchForm extends Component {
34
43
  constructor(element) {
35
44
  super(element);
@@ -38,6 +47,8 @@ class SearchForm extends Component {
38
47
  this.$resultTemplate = this.$("[data-template=result]");
39
48
  this.$subresultTemplate = this.$("[data-template=subresult]");
40
49
  this.$results = this.$(".dsa-search-form__results");
50
+ const rawSubResultsLimit = Number(element.dataset.maxSubresults);
51
+ const subResultsLimit = isNaN(rawSubResultsLimit) ? 3 : rawSubResultsLimit;
41
52
  this.on(element, "submit", (event) => {
42
53
  event.preventDefault();
43
54
  const url = new URL(element.getAttribute("action") || "", window.location);
@@ -50,10 +61,12 @@ class SearchForm extends Component {
50
61
  });
51
62
  this.onRadio(events.beforeunveil, async (_, el) => {
52
63
  if (this.lazyResults.has(el)) {
53
- const result = await this.lazyResults.get(el);
64
+ const lazyResult = this.lazyResults.get(el);
65
+ const result = await lazyResult();
54
66
  renderResult(result, el);
55
67
  const $subResults = this.$("[data-result-subresults]", el);
56
- for (const subResult of result.subResults) {
68
+ const subResults = limitSubResults(result.subResults, subResultsLimit);
69
+ for (const subResult of subResults) {
57
70
  const $subResultClone = this.$subresultTemplate.cloneNode(true);
58
71
  $subResultClone.setAttribute("href", subResult.url);
59
72
  renderResult(subResult, $subResultClone);
@@ -3,17 +3,24 @@ import SearchForm from './SearchForm.client.js';
3
3
  import '@kickstartds/core/lib/core';
4
4
 
5
5
  const staticPageFindPath = "/pagefind/pagefind.js";
6
- const pagefindResult2searchResult = (result) => ({
7
- title: result.meta.title,
8
- url: result.url,
9
- excerpt: result.excerpt,
10
- image: result.meta.image,
11
- subResults: (result.sub_results || []).map((subResult) => ({
12
- title: subResult.title,
13
- url: subResult.url,
14
- excerpt: subResult.excerpt,
15
- })),
16
- });
6
+ const pagefindResult2searchResult = ({ sub_results, ...result }) => {
7
+ const hasRootSubResult = sub_results?.[0]?.url === (result.meta.url || result.url);
8
+ const subResults = hasRootSubResult
9
+ ? sub_results.slice(1)
10
+ : sub_results || [];
11
+ return {
12
+ title: result.meta.title,
13
+ url: result.meta.url || result.url,
14
+ excerpt: result.excerpt,
15
+ image: result.meta.image,
16
+ subResults: subResults.map((subResult) => ({
17
+ title: subResult.title,
18
+ url: subResult.url,
19
+ excerpt: subResult.excerpt,
20
+ locations: subResult.locations,
21
+ })),
22
+ };
23
+ };
17
24
  class SearchFormPagefind extends SearchForm {
18
25
  constructor(element) {
19
26
  super(element);
@@ -28,7 +35,7 @@ class SearchFormPagefind extends SearchForm {
28
35
  if (search) {
29
36
  if (search.results.length) {
30
37
  // TODO: Pagination / Load More
31
- const results = search.results.map((result) => result.data().then(pagefindResult2searchResult));
38
+ const results = search.results.map((result) => () => result.data().then(pagefindResult2searchResult));
32
39
  this.clearResults();
33
40
  this.showResults(results);
34
41
  }
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { HTMLAttributes, FC, PropsWithChildren } from "react";
3
- import { SectionProps } from "../../SectionProps-4e2b2ecf.js";
3
+ import { SectionProps } from "../../SectionProps-d60aba86.js";
4
4
  declare const SectionContextDefault: import("react").ForwardRefExoticComponent<SectionProps & Omit<HTMLAttributes<HTMLElement>, "style" | "content"> & import("react").RefAttributes<HTMLDivElement>>;
5
5
  declare const SectionContext: import("react").Context<import("react").ForwardRefExoticComponent<SectionProps & Omit<HTMLAttributes<HTMLElement>, "style" | "content"> & import("react").RefAttributes<HTMLDivElement>>>;
6
6
  declare const Section: import("react").ForwardRefExoticComponent<SectionProps & Omit<HTMLAttributes<HTMLElement>, "style" | "content"> & import("react").RefAttributes<HTMLDivElement>>;
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Fri, 05 Sep 2025 12:56:41 GMT
3
+ * Generated on Fri, 05 Sep 2025 13:51:29 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 Fri, 05 Sep 2025 12:56:46 GMT
2730
+ * Generated on Fri, 05 Sep 2025 13:51:33 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 Fri, 05 Sep 2025 12:56:44 GMT
5461
+ * Generated on Fri, 05 Sep 2025 13:51:31 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 Fri, 05 Sep 2025 12:56:48 GMT
8462
+ * Generated on Fri, 05 Sep 2025 13:51:36 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 Fri, 05 Sep 2025 12:56:39 GMT
3
+ * Generated on Fri, 05 Sep 2025 13:51:26 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 Fri, 05 Sep 2025 12:56:39 GMT
3
+ * Generated on Fri, 05 Sep 2025 13:51:27 GMT
4
4
  */
5
5
 
6
6
  export const KsBackgroundColorAccentBase = "#f3f3f4";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kickstartds/ds-agency-premium",
3
- "version": "1.6.71--canary.50.2253.0",
3
+ "version": "1.6.71--canary.50.2257.0",
4
4
  "description": "",
5
5
  "homepage": "https://github.com/kickstartDS/ds-agency-premium#readme",
6
6
  "bugs": {