@kickstartds/ds-agency-premium 1.6.71--canary.45.2226.0 → 1.6.71--canary.50.2232.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.
@@ -40,8 +40,8 @@ interface PreviewImage {
40
40
  */
41
41
  src?: string;
42
42
  /**
43
- * Large display of the preview image.
43
+ * Small display of the preview image.
44
44
  */
45
- large?: boolean;
45
+ small?: boolean;
46
46
  }
47
47
  export { URL, Title, Text, ShowLink, ARIALabel, SearchResultProps, PreviewImage };
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Thu, 04 Sep 2025 08:25:20 GMT
3
+ * Generated on Thu, 04 Sep 2025 10:07:43 GMT
4
4
  */
5
5
  :root, [ks-theme] {
6
6
  --ks-background-color-accent-base: var(--ks-color-fg-to-bg-9-base);
@@ -3936,13 +3936,13 @@
3936
3936
  "id": "corporate-search-result--default",
3937
3937
  "group": "Corporate / Search Result",
3938
3938
  "name": "Default",
3939
- "code": "<SearchResult\n ariaLabel=\"Search Result: AI Conference 2023\"\n previewImage={{\n large: false,\n src: '/img/full-shot-different-people-working-together.png'\n }}\n showLink\n text=\"Join us for the annual **AI Conference** brings together experts from around the world\n[...] register now for the **AI Conference** to secure your spot\n[...] highlights from last year’s **AI Conference** included keynote speeches on machine learning\n[...] find out more about the **AI Conference** agenda and speakers\"\n title=\"AI Conference 2023\"\n url=\"https://www.example.com/ai-conference-2023\"\n/>",
3939
+ "code": "<SearchResult\n ariaLabel=\"Search Result: AI Conference 2023\"\n previewImage={{\n small: false,\n src: '/img/full-shot-different-people-working-together.png'\n }}\n showLink\n text=\"Join us for the annual **AI Conference** brings together experts from around the world\n[...] register now for the **AI Conference** to secure your spot\n[...] highlights from last year’s **AI Conference** included keynote speeches on machine learning\n[...] find out more about the **AI Conference** agenda and speakers\"\n title=\"AI Conference 2023\"\n url=\"https://www.example.com/ai-conference-2023\"\n/>",
3940
3940
  "args": {
3941
3941
  "url": "https://www.example.com/ai-conference-2023",
3942
3942
  "title": "AI Conference 2023",
3943
3943
  "previewImage": {
3944
- "src": "/img/full-shot-different-people-working-together.png",
3945
- "large": false
3944
+ "small": false,
3945
+ "src": "/img/full-shot-different-people-working-together.png"
3946
3946
  },
3947
3947
  "text": "Join us for the annual **AI Conference** brings together experts from around the world\n[...] register now for the **AI Conference** to secure your spot\n[...] highlights from last year’s **AI Conference** included keynote speeches on machine learning\n[...] find out more about the **AI Conference** agenda and speakers",
3948
3948
  "showLink": true,
@@ -0,0 +1,6 @@
1
+ declare class Search {
2
+ static identifier: string;
3
+ constructor(element: any);
4
+ on(element: any, type: any, fn: any): () => any;
5
+ }
6
+ export { Search as default };
@@ -0,0 +1,71 @@
1
+ import { define, Component } from '@kickstartds/core/lib/component';
2
+
3
+ const staticPageFindPath = "/pagefind/pagefind.js";
4
+ const parser = new DOMParser();
5
+ class Search extends Component {
6
+ constructor(element) {
7
+ super(element);
8
+ const input = element.querySelector(".dsa-search-bar__input");
9
+ const template = element.querySelector(".dsa\\.search\\.result");
10
+ const target = element.querySelector(".dsa\\.search\\.results");
11
+ // TODO: Arrow Key Navigation
12
+ const clearResults = () => {
13
+ target.textContent = "";
14
+ };
15
+ const showResults = (results) => {
16
+ for (const result of results) {
17
+ const clone = template.cloneNode(true);
18
+ clone.removeAttribute("hidden");
19
+ clone.firstElementChild.setAttribute("href", result.url);
20
+ if (result.title) {
21
+ const title = clone.querySelector(".dsa-search-result__title");
22
+ title.textContent = result.title;
23
+ }
24
+ if (result.excerpt) {
25
+ const doc = parser.parseFromString(result.excerpt, "text/html");
26
+ const excerpt = clone.querySelector(".dsa-search-result__text span");
27
+ excerpt.replaceChildren(...doc.body.childNodes);
28
+ }
29
+ const link = clone.querySelector(".dsa-search-result__link");
30
+ link.textContent = result.url;
31
+ target.appendChild(clone);
32
+ }
33
+ };
34
+ (async () => {
35
+ const pagefind = await import(/* @vite-ignore */ staticPageFindPath);
36
+ await pagefind.init();
37
+ this.on(input, "input", async (event) => {
38
+ if (!pagefind)
39
+ return;
40
+ if (input.value.length) {
41
+ const search = await pagefind.debouncedSearch(input.value);
42
+ if (search) {
43
+ if (search.results.length) {
44
+ // TODO: Pagination / Load More
45
+ const results = await Promise.all(search.results.map((result) => result.data()));
46
+ clearResults();
47
+ showResults(results.map((result) => ({
48
+ title: result.meta.title,
49
+ url: result.url,
50
+ excerpt: result.excerpt,
51
+ })));
52
+ }
53
+ }
54
+ }
55
+ else {
56
+ clearResults();
57
+ }
58
+ });
59
+ })();
60
+ }
61
+ on(element, type, fn) {
62
+ const cleanUp = () => element.removeventListener(type, fn);
63
+ element.addEventListener(type, fn);
64
+ this.onDisconnect(cleanUp);
65
+ return cleanUp;
66
+ }
67
+ }
68
+ Search.identifier = "dsa.search";
69
+ define(Search.identifier, Search);
70
+
71
+ export { Search as default };
@@ -8,7 +8,7 @@ import { FC, PropsWithChildren } from "react";
8
8
  import { HeadlineProps } from "../../HeadlineProps-e1305784.js";
9
9
  import { SearchBarProps } from "../../SearchBarProps-26263244.js";
10
10
  import { SearchFilterProps } from "../../SearchFilterProps-2fa6419b.js";
11
- import { SearchResultProps } from "../../SearchResultProps-5e57c4cb.js";
11
+ import { SearchResultProps } from "../../SearchResultProps-4035f21e.js";
12
12
  interface SearchProps {
13
13
  /**
14
14
  * Referenced component HeadlineProps
@@ -234,14 +234,11 @@
234
234
  "properties": {
235
235
  "src": {
236
236
  "type": "string",
237
- "description": "A URL to an image preview for the search result.",
238
- "examples": [
239
- "/img/full-shot-different-people-working-together.png"
240
- ]
237
+ "description": "A URL to an image preview for the search result."
241
238
  },
242
- "large": {
239
+ "small": {
243
240
  "type": "boolean",
244
- "description": "Large display of the preview image.",
241
+ "description": "Small display of the preview image.",
245
242
  "default": false
246
243
  }
247
244
  },
@@ -9,7 +9,7 @@ import { d as deepMergeDefaults } from '../../helpers-12f48df8.js';
9
9
 
10
10
  const defaults = {};
11
11
 
12
- const SearchBarContextDefault = forwardRef(({ placeholder, hint = "Press <kbd>Enter</kbd> to search", alternativeText = "Did you mean", alternativeResult = "AI Conference", }, ref) => (jsxs("div", { className: "dsa-search-bar", ref: ref, children: [jsxs("div", { className: "dsa-search-bar__input-container", children: [jsx(TextField, { hideLabel: true, type: "search", placeholder: placeholder || "Search...", className: "dsa-search-bar__input" }), jsx(Icon, { icon: "search" })] }), hint && jsx(Markdown, { className: "dsa-search-bar__hint", children: hint }), alternativeResult && (jsx("p", { className: "dsa-search-bar__alternative-text", children: jsxs(Fragment, { children: [alternativeText + " ", jsx(Link, { href: "#", children: alternativeResult })] }) }))] })));
12
+ const SearchBarContextDefault = forwardRef(({ placeholder, hint = "Press <kbd>Enter</kbd> to search", alternativeText = "Did you mean", alternativeResult = "AI Conference", }, ref) => (jsxs("div", { className: "dsa-search-bar", ref: ref, children: [jsxs("div", { className: "dsa-search-bar__input-container", children: [jsx(TextField, { hideLabel: true, type: "search", placeholder: placeholder || "Search...", className: "dsa-search-bar__input", autoComplete: "off" }), jsx(Icon, { icon: "search" })] }), hint && jsx(Markdown, { className: "dsa-search-bar__hint", children: hint }), alternativeResult && (jsx("p", { className: "dsa-search-bar__alternative-text", children: jsxs(Fragment, { children: [alternativeText + " ", jsx(Link, { href: "#", children: alternativeResult })] }) }))] })));
13
13
  const SearchBarContext = createContext(SearchBarContextDefault);
14
14
  const SearchBar = forwardRef((props, ref) => {
15
15
  const Component = useContext(SearchBarContext);
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import { SearchResultProps } from "../../SearchResultProps-5e57c4cb.js";
2
+ import { SearchResultProps } from "../../SearchResultProps-4035f21e.js";
3
3
  declare const SearchResultContextDefault: import("react").ForwardRefExoticComponent<SearchResultProps & import("react").RefAttributes<HTMLAnchorElement>>;
4
4
  declare const SearchResultContext: import("react").Context<import("react").ForwardRefExoticComponent<SearchResultProps & import("react").RefAttributes<HTMLAnchorElement>>>;
5
5
  declare const SearchResult: import("react").ForwardRefExoticComponent<SearchResultProps & import("react").RefAttributes<HTMLAnchorElement>>;
@@ -9,14 +9,14 @@ import { Picture } from '@kickstartds/base/lib/picture';
9
9
 
10
10
  const defaults = {
11
11
  "previewImage": {
12
- "large": false
12
+ "small": false
13
13
  },
14
14
  "showLink": true
15
15
  };
16
16
 
17
17
  const SearchResultContextDefault = forwardRef(({ title, previewImage, text, url, showLink, ariaLabel }, ref) => (jsxs(Link, { "aria-label": ariaLabel, href: url, className: classnames("dsa-search-result", {
18
- "dsa-search-result--image-large": previewImage?.large,
19
- }), ref: ref, children: [previewImage && (jsx(Picture, { src: previewImage?.src, alt: "", className: "dsa-search-result__image" })), jsxs("div", { className: "dsa-search-result__content", children: [jsx("span", { className: "dsa-search-result__title", children: title }), jsx(RichText, { text: text, className: "dsa-search-result__text" }), showLink && jsx("span", { className: "dsa-search-result__link", children: url })] })] })));
18
+ "dsa-search-result--image-small": previewImage?.small,
19
+ }), ref: ref, children: [jsx(Picture, { src: "img/full-shot-different-people-working-together.png", alt: "", className: "dsa-search-result__image" }), jsxs("div", { className: "dsa-search-result__content", children: [jsx("span", { className: "dsa-search-result__title", children: title }), jsx(RichText, { text: text, className: "dsa-search-result__text" }), showLink && jsx("span", { className: "dsa-search-result__link", children: url })] })] })));
20
20
  const SearchResultContext = createContext(SearchResultContextDefault);
21
21
  const SearchResult = forwardRef((props, ref) => {
22
22
  const Component = useContext(SearchResultContext);
@@ -12,20 +12,23 @@
12
12
  .dsa-search-result:hover {
13
13
  border-color: var(--ks-border-color-card-interactive-hover);
14
14
  }
15
- .dsa-search-result--image-large .dsa-search-result__image {
16
- max-width: var(--dsa-tile--width_medium);
15
+ .dsa-search-result--image-small .dsa-search-result__image {
16
+ max-width: var(--dsa-tile--width_smallest);
17
17
  }
18
18
  .dsa-search-result__image {
19
- flex-grow: 0;
20
- max-width: var(--dsa-tile--width_small);
21
- aspect-ratio: 4/3;
19
+ width: 100%;
20
+ height: fit-content;
22
21
  object-fit: cover;
22
+ aspect-ratio: 4/3;
23
+ border-radius: calc(var(--ks-border-radius-card) / 2);
24
+ max-width: var(--dsa-tile--width_small);
23
25
  }
24
26
  .dsa-search-result__content {
25
27
  display: flex;
26
28
  flex-direction: column;
27
29
  gap: var(--ks-spacing-stack-xs);
28
30
  flex-grow: 1;
31
+ flex-basis: var(--dsa-tile--width_medium);
29
32
  }
30
33
  .dsa-search-result__title {
31
34
  font: var(--dsa-topic--font);
@@ -33,7 +36,8 @@
33
36
  font-weight: var(--dsa-topic--font-weight);
34
37
  }
35
38
  .dsa-search-result__link {
36
- width: fit-content;
39
+ max-width: 100%;
40
+ width: auto;
37
41
  font: var(--ks-font-interface-s);
38
42
  color: var(--dsa-link--color);
39
43
  transition: inherit;
@@ -27,14 +27,11 @@
27
27
  "properties": {
28
28
  "src": {
29
29
  "type": "string",
30
- "description": "A URL to an image preview for the search result.",
31
- "examples": [
32
- "/img/full-shot-different-people-working-together.png"
33
- ]
30
+ "description": "A URL to an image preview for the search result."
34
31
  },
35
- "large": {
32
+ "small": {
36
33
  "type": "boolean",
37
- "description": "Large display of the preview image.",
34
+ "description": "Small display of the preview image.",
38
35
  "default": false
39
36
  }
40
37
  },
@@ -23,12 +23,11 @@
23
23
  "properties": {
24
24
  "src": {
25
25
  "type": "string",
26
- "description": "A URL to an image preview for the search result.",
27
- "examples": ["/img/full-shot-different-people-working-together.png"]
26
+ "description": "A URL to an image preview for the search result."
28
27
  },
29
- "large": {
28
+ "small": {
30
29
  "type": "boolean",
31
- "description": "Large display of the preview image.",
30
+ "description": "Small display of the preview image.",
32
31
  "default": false
33
32
  }
34
33
  }
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Thu, 04 Sep 2025 08:25:22 GMT
3
+ * Generated on Thu, 04 Sep 2025 10:07:45 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, 04 Sep 2025 08:25:27 GMT
2730
+ * Generated on Thu, 04 Sep 2025 10:07:50 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, 04 Sep 2025 08:25:25 GMT
5461
+ * Generated on Thu, 04 Sep 2025 10:07:47 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, 04 Sep 2025 08:25:29 GMT
8462
+ * Generated on Thu, 04 Sep 2025 10:07:52 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, 04 Sep 2025 08:25:20 GMT
3
+ * Generated on Thu, 04 Sep 2025 10:07:43 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, 04 Sep 2025 08:25:21 GMT
3
+ * Generated on Thu, 04 Sep 2025 10:07:43 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.45.2226.0",
3
+ "version": "1.6.71--canary.50.2232.0",
4
4
  "description": "",
5
5
  "homepage": "https://github.com/kickstartDS/ds-agency-premium#readme",
6
6
  "bugs": {
@@ -39,7 +39,7 @@
39
39
  "dist"
40
40
  ],
41
41
  "scripts": {
42
- "build-storybook": "yarn build-tokens && yarn schema && yarn token && storybook build",
42
+ "build-storybook": "yarn build-tokens && yarn schema && yarn token && yarn search && storybook build",
43
43
  "postbuild-storybook": "yarn presets && yarn playroom:build && mkdir -p dist/components && cp snippets.json dist/components/presets.json",
44
44
  "build-tokens-ds-agency": "kickstartDS tokens compile",
45
45
  "build-tokens-business": "kickstartDS tokens compile --token-dictionary-path src/token-business/dictionary --sd-config-path sd.config-business.cjs",
@@ -53,6 +53,7 @@
53
53
  "playroom:start": "playroom start",
54
54
  "playroom:build": "playroom build",
55
55
  "presets": "vitest run scripts/generatePresets.test.ts",
56
+ "search": "rm -rf static/pagefind && vitest run scripts/generateSearchIndex.test.ts",
56
57
  "husky:precommit": "yarn schema && rollup -c",
57
58
  "prepare": "patch-package && husky install",
58
59
  "prepublishOnly": "rm -rf dist && yarn build-tokens && yarn schema && rollup -c && yarn build-storybook",
@@ -120,6 +121,7 @@
120
121
  "kickstartds": "3.5.0--canary.62.324.0",
121
122
  "lazysizes": "^5.3.2",
122
123
  "npm-run-all": "^4.1.5",
124
+ "pagefind": "^1.4.0",
123
125
  "patch-package": "^8.0.0",
124
126
  "playroom": "^0.34.1",
125
127
  "postcss": "^8.4.29",