@kickstartds/ds-agency-premium 1.6.71--canary.50.2230.0 → 1.6.71--canary.50.2236.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.
- package/dist/{SearchResultProps-5e57c4cb.d.ts → SearchResultProps-4035f21e.d.ts} +2 -2
- package/dist/components/blog-post/index.d.ts +1 -1
- package/dist/components/index/index.d.ts +1 -1
- package/dist/components/page-wrapper/tokens.css +1 -1
- package/dist/components/presets.json +25 -3
- package/dist/components/search/index.d.ts +1 -1
- package/dist/components/search/search.schema.dereffed.json +3 -6
- package/dist/components/search-bar/index.js +1 -1
- package/dist/components/search-form/SearchForm.client.d.ts +13 -0
- package/dist/components/search-form/SearchForm.client.js +63 -0
- package/dist/components/search-form/SearchFormPagefind.client.d.ts +4 -0
- package/dist/components/search-form/SearchFormPagefind.client.js +57 -0
- package/dist/components/search-form/index.d.ts +5 -0
- package/dist/components/search-form/index.js +19 -0
- package/dist/components/search-form/search-form.css +7 -0
- package/dist/components/search-modal/RadioEmit.client.d.ts +5 -0
- package/dist/components/search-modal/RadioEmit.client.js +18 -0
- package/dist/components/search-modal/SearchModal.client.d.ts +5 -0
- package/dist/components/search-modal/SearchModal.client.js +31 -0
- package/dist/components/search-modal/index.d.ts +14 -0
- package/dist/components/search-modal/index.js +34 -0
- package/dist/components/search-modal/search-modal.css +24 -0
- package/dist/components/search-modal/search-modal.schema.dereffed.json +24 -0
- package/dist/components/search-modal/search-modal.schema.json +21 -0
- package/dist/components/search-result/index.d.ts +1 -1
- package/dist/components/search-result/index.js +3 -3
- package/dist/components/search-result/search-result.css +10 -6
- package/dist/components/search-result/search-result.schema.dereffed.json +3 -6
- package/dist/components/search-result/search-result.schema.json +3 -4
- package/dist/tokens/themes.css +4 -4
- package/dist/tokens/tokens.css +1 -1
- package/dist/tokens/tokens.js +1 -1
- package/package.json +1 -1
- package/dist/components/search/Search.client.d.ts +0 -6
- package/dist/components/search/Search.client.js +0 -71
- /package/dist/{BlogPostProps-c760fd2a.d.ts → BlogPostProps-6b3cff22.d.ts} +0 -0
|
@@ -40,8 +40,8 @@ interface PreviewImage {
|
|
|
40
40
|
*/
|
|
41
41
|
src?: string;
|
|
42
42
|
/**
|
|
43
|
-
*
|
|
43
|
+
* Small display of the preview image.
|
|
44
44
|
*/
|
|
45
|
-
|
|
45
|
+
small?: boolean;
|
|
46
46
|
}
|
|
47
47
|
export { URL, Title, Text, ShowLink, ARIALabel, SearchResultProps, PreviewImage };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BlogPostProps } from "../../BlogPostProps-
|
|
1
|
+
import { BlogPostProps } from "../../BlogPostProps-6b3cff22.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-
|
|
32
|
+
export * from "../../BlogPostProps-6b3cff22.js";
|
|
33
33
|
export * from "../../BlogOverviewProps-9f207f1c.js";
|
|
34
34
|
export * from "../../PageProps-aa29c554.js";
|
|
35
35
|
export { IconSprite, SettingsProps };
|
|
@@ -3932,17 +3932,39 @@
|
|
|
3932
3932
|
},
|
|
3933
3933
|
"screenshot": "img/screenshots/corporate-search-filter--default.png"
|
|
3934
3934
|
},
|
|
3935
|
+
{
|
|
3936
|
+
"id": "corporate-search-form--pagefind",
|
|
3937
|
+
"group": "Corporate / Search Form",
|
|
3938
|
+
"name": "Pagefind",
|
|
3939
|
+
"code": "<SearchForm component=\"dsa.search-form.pagefind\" />",
|
|
3940
|
+
"args": {
|
|
3941
|
+
"component": "dsa.search-form.pagefind"
|
|
3942
|
+
},
|
|
3943
|
+
"screenshot": "img/screenshots/corporate-search-form--pagefind.png"
|
|
3944
|
+
},
|
|
3945
|
+
{
|
|
3946
|
+
"id": "corporate-search-modal--pagefind",
|
|
3947
|
+
"group": "Corporate / Search Modal",
|
|
3948
|
+
"name": "Pagefind",
|
|
3949
|
+
"code": "<>\n <Button\n data-topic=\"dsa.search-modal.open\"\n ks-component=\"dsa.radio-emit\"\n label=\"open\"\n size=\"small\"\n />\n <hr />\n <SearchModal\n closeAriaLabel=\"close\"\n formComponent=\"dsa.search-form.pagefind\"\n headline=\"Search\"\n />\n</>",
|
|
3950
|
+
"args": {
|
|
3951
|
+
"headline": "Search",
|
|
3952
|
+
"closeAriaLabel": "close",
|
|
3953
|
+
"formComponent": "dsa.search-form.pagefind"
|
|
3954
|
+
},
|
|
3955
|
+
"screenshot": "img/screenshots/corporate-search-modal--pagefind.png"
|
|
3956
|
+
},
|
|
3935
3957
|
{
|
|
3936
3958
|
"id": "corporate-search-result--default",
|
|
3937
3959
|
"group": "Corporate / Search Result",
|
|
3938
3960
|
"name": "Default",
|
|
3939
|
-
"code": "<SearchResult\n ariaLabel=\"Search Result: AI Conference 2023\"\n previewImage={{\n
|
|
3961
|
+
"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
3962
|
"args": {
|
|
3941
3963
|
"url": "https://www.example.com/ai-conference-2023",
|
|
3942
3964
|
"title": "AI Conference 2023",
|
|
3943
3965
|
"previewImage": {
|
|
3944
|
-
"
|
|
3945
|
-
"
|
|
3966
|
+
"small": false,
|
|
3967
|
+
"src": "/img/full-shot-different-people-working-together.png"
|
|
3946
3968
|
},
|
|
3947
3969
|
"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
3970
|
"showLink": true,
|
|
@@ -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-
|
|
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
|
-
"
|
|
239
|
+
"small": {
|
|
243
240
|
"type": "boolean",
|
|
244
|
-
"description": "
|
|
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", 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 })] }) }))] })));
|
|
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", name: "q" }), 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);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
declare class SearchForm {
|
|
2
|
+
static identifier: string;
|
|
3
|
+
constructor(element: any);
|
|
4
|
+
$searchInput: any;
|
|
5
|
+
$template: any;
|
|
6
|
+
$results: any;
|
|
7
|
+
clearResults(): void;
|
|
8
|
+
showResults(results: any): void;
|
|
9
|
+
onRadio(topic: any, fn: any): () => void;
|
|
10
|
+
on(element: any, type: any, fn: any): () => any;
|
|
11
|
+
$(selector: any, element?: any): any;
|
|
12
|
+
}
|
|
13
|
+
export { SearchForm as default };
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { define, Component } from '@kickstartds/core/lib/component';
|
|
2
|
+
|
|
3
|
+
const parser = new DOMParser();
|
|
4
|
+
class SearchForm extends Component {
|
|
5
|
+
constructor(element) {
|
|
6
|
+
super(element);
|
|
7
|
+
this.$searchInput = this.$(".dsa-search-bar__input");
|
|
8
|
+
this.$template = this.$("[data-template=result]");
|
|
9
|
+
this.$results = this.$(".dsa-search-form__results");
|
|
10
|
+
this.on(element, "submit", (event) => {
|
|
11
|
+
event.preventDefault();
|
|
12
|
+
const url = new URL(element.getAttribute("action") || "", window.location);
|
|
13
|
+
const formData = new FormData(element);
|
|
14
|
+
url.hash = new URLSearchParams(formData);
|
|
15
|
+
window.location.href = url;
|
|
16
|
+
});
|
|
17
|
+
this.on(window, "hashchange", (event) => {
|
|
18
|
+
window._ks.radio.emit("dsa.search-form.hashchange");
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
clearResults() {
|
|
22
|
+
this.$results.textContent = "";
|
|
23
|
+
}
|
|
24
|
+
showResults(results) {
|
|
25
|
+
for (const result of results) {
|
|
26
|
+
const clone = this.$template.cloneNode(true);
|
|
27
|
+
clone.removeAttribute("hidden");
|
|
28
|
+
clone.removeAttribute("data-template");
|
|
29
|
+
clone.firstElementChild.setAttribute("href", result.url);
|
|
30
|
+
if (result.title) {
|
|
31
|
+
const title = clone.querySelector(".dsa-search-result__title");
|
|
32
|
+
title.textContent = result.title;
|
|
33
|
+
}
|
|
34
|
+
if (result.excerpt) {
|
|
35
|
+
const doc = parser.parseFromString(result.excerpt, "text/html");
|
|
36
|
+
const excerpt = clone.querySelector(".dsa-search-result__text span");
|
|
37
|
+
excerpt.replaceChildren(...doc.body.childNodes);
|
|
38
|
+
}
|
|
39
|
+
const link = clone.querySelector(".dsa-search-result__link");
|
|
40
|
+
link.textContent = result.url;
|
|
41
|
+
this.$results.appendChild(clone);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
onRadio(topic, fn) {
|
|
45
|
+
const token = window._ks.radio.on(topic, fn);
|
|
46
|
+
const cleanUp = () => window._ks.radio.off(token);
|
|
47
|
+
this.onDisconnect(cleanUp);
|
|
48
|
+
return cleanUp;
|
|
49
|
+
}
|
|
50
|
+
on(element, type, fn) {
|
|
51
|
+
const cleanUp = () => element.removeventListener(type, fn);
|
|
52
|
+
element.addEventListener(type, fn);
|
|
53
|
+
this.onDisconnect(cleanUp);
|
|
54
|
+
return cleanUp;
|
|
55
|
+
}
|
|
56
|
+
$(selector, element = this.element) {
|
|
57
|
+
return element.querySelector(selector);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
SearchForm.identifier = "dsa.search-form";
|
|
61
|
+
define(SearchForm.identifier, SearchForm);
|
|
62
|
+
|
|
63
|
+
export { SearchForm as default };
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { define } from '@kickstartds/core/lib/component';
|
|
2
|
+
import SearchForm from './SearchForm.client.js';
|
|
3
|
+
|
|
4
|
+
const staticPageFindPath = "/pagefind/pagefind.js";
|
|
5
|
+
class SearchFormPagefind extends SearchForm {
|
|
6
|
+
constructor(element) {
|
|
7
|
+
super(element);
|
|
8
|
+
console.log("hello");
|
|
9
|
+
(async () => {
|
|
10
|
+
const pagefind = await import(/* @vite-ignore */ staticPageFindPath);
|
|
11
|
+
await pagefind.init();
|
|
12
|
+
const search = async () => {
|
|
13
|
+
if (!pagefind)
|
|
14
|
+
return;
|
|
15
|
+
if (this.$searchInput.value.length) {
|
|
16
|
+
const search = await pagefind.debouncedSearch(this.$searchInput.value);
|
|
17
|
+
if (search) {
|
|
18
|
+
if (search.results.length) {
|
|
19
|
+
// TODO: Pagination / Load More
|
|
20
|
+
const results = await Promise.all(search.results.map((result) => result.data()));
|
|
21
|
+
this.clearResults();
|
|
22
|
+
this.showResults(results.map((result) => ({
|
|
23
|
+
title: result.meta.title,
|
|
24
|
+
url: result.url,
|
|
25
|
+
excerpt: result.excerpt,
|
|
26
|
+
})));
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
this.clearResults();
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
const searchFromHash = () => {
|
|
35
|
+
const params = new URLSearchParams(window.location.hash.slice(1));
|
|
36
|
+
if (params.size) {
|
|
37
|
+
for (const field of element.elements) {
|
|
38
|
+
if (params.has(field.name)) {
|
|
39
|
+
field.value = params.get(field.name);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
search();
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
this.on(this.$searchInput, "input", search);
|
|
46
|
+
this.on(element, "reset", (event) => {
|
|
47
|
+
this.clearResults();
|
|
48
|
+
});
|
|
49
|
+
this.onRadio("dsa.search-form.hashchange", searchFromHash);
|
|
50
|
+
searchFromHash();
|
|
51
|
+
})();
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
SearchFormPagefind.identifier = "dsa.search-form.pagefind";
|
|
55
|
+
define(SearchFormPagefind.identifier, SearchFormPagefind);
|
|
56
|
+
|
|
57
|
+
export { SearchFormPagefind as default };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import "./search-form.css";
|
|
2
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import classnames from 'classnames';
|
|
4
|
+
import { SearchBar } from '../search-bar/index.js';
|
|
5
|
+
import { SearchResult } from '../search-result/index.js';
|
|
6
|
+
import './SearchForm.client.js';
|
|
7
|
+
import 'react';
|
|
8
|
+
import '@kickstartds/form/lib/text-field';
|
|
9
|
+
import 'markdown-to-jsx';
|
|
10
|
+
import '@kickstartds/base/lib/icon';
|
|
11
|
+
import '@kickstartds/base/lib/link';
|
|
12
|
+
import '../../helpers-12f48df8.js';
|
|
13
|
+
import '@kickstartds/base/lib/rich-text';
|
|
14
|
+
import '@kickstartds/base/lib/picture';
|
|
15
|
+
import '@kickstartds/core/lib/component';
|
|
16
|
+
|
|
17
|
+
const SearchForm = ({ className, component = "dsa.search-form", ...props }) => (jsxs("form", { className: classnames("dsa-search-form", className), "ks-component": component, ...props, children: [jsx(SearchBar, { alternativeText: "", alternativeResult: "", hint: "" }), jsx("li", { "data-template": "result", hidden: true, children: jsx(SearchResult, {}) }), jsx("ol", { className: "dsa-search-form__results" })] }));
|
|
18
|
+
|
|
19
|
+
export { SearchForm };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { define, Component } from '@kickstartds/core/lib/component';
|
|
2
|
+
|
|
3
|
+
class RadioEmit extends Component {
|
|
4
|
+
constructor(element) {
|
|
5
|
+
super(element);
|
|
6
|
+
const { topic, action = "click", value } = element.dataset;
|
|
7
|
+
console.log(topic, action);
|
|
8
|
+
const handler = () => window._ks.radio.emit(topic, value);
|
|
9
|
+
element.addEventListener(action, handler);
|
|
10
|
+
this.onDisconnect(() => {
|
|
11
|
+
element.removeEventListener(action, handler);
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
RadioEmit.identifier = "dsa.radio-emit";
|
|
16
|
+
define(RadioEmit.identifier, RadioEmit);
|
|
17
|
+
|
|
18
|
+
export { RadioEmit as default };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { define, Component } from '@kickstartds/core/lib/component';
|
|
2
|
+
|
|
3
|
+
class SearchModal extends Component {
|
|
4
|
+
constructor(element) {
|
|
5
|
+
super(element);
|
|
6
|
+
const form = element.querySelector(".dsa-search-form");
|
|
7
|
+
const searchInput = element.querySelector(".dsa-search-bar__input");
|
|
8
|
+
const onBackdropClick = (event) => {
|
|
9
|
+
if (event.target === element)
|
|
10
|
+
window._ks.radio.emit("dsa.search-modal.close");
|
|
11
|
+
};
|
|
12
|
+
const openToken = window._ks.radio.on("dsa.search-modal.open", () => {
|
|
13
|
+
element.showModal();
|
|
14
|
+
searchInput.focus();
|
|
15
|
+
});
|
|
16
|
+
const closeToken = window._ks.radio.on("dsa.search-modal.close", () => {
|
|
17
|
+
form.reset();
|
|
18
|
+
element.close();
|
|
19
|
+
});
|
|
20
|
+
element.addEventListener("click", onBackdropClick);
|
|
21
|
+
this.onDisconnect(() => {
|
|
22
|
+
window._ks.radio.off(openToken);
|
|
23
|
+
window._ks.radio.off(closeToken);
|
|
24
|
+
element.removeEventListener("click", onBackdropClick);
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
SearchModal.identifier = "dsa.search-modal";
|
|
29
|
+
define(SearchModal.identifier, SearchModal);
|
|
30
|
+
|
|
31
|
+
export { SearchModal as default };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { FC } from "react";
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* This file was automatically generated by json-schema-to-typescript.
|
|
5
|
+
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
|
6
|
+
* and run json-schema-to-typescript to regenerate this file.
|
|
7
|
+
*/
|
|
8
|
+
interface SearchModalProps {
|
|
9
|
+
headline: string;
|
|
10
|
+
closeAriaLabel: string;
|
|
11
|
+
formComponent?: string;
|
|
12
|
+
}
|
|
13
|
+
declare const SearchModal: FC<SearchModalProps>;
|
|
14
|
+
export { SearchModal };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import "./search-modal.css";
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { Section } from '../section/index.js';
|
|
4
|
+
import { Button } from '../button/index.js';
|
|
5
|
+
import { SearchForm } from '../search-form/index.js';
|
|
6
|
+
import './SearchModal.client.js';
|
|
7
|
+
import 'react';
|
|
8
|
+
import 'classnames';
|
|
9
|
+
import '@kickstartds/core/lib/react';
|
|
10
|
+
import '@kickstartds/base/lib/section';
|
|
11
|
+
import '../section/js/Section.client.js';
|
|
12
|
+
import '@kickstartds/core/lib/component';
|
|
13
|
+
import '../../helpers-12f48df8.js';
|
|
14
|
+
import '@kickstartds/base/lib/button';
|
|
15
|
+
import '../search-bar/index.js';
|
|
16
|
+
import '@kickstartds/form/lib/text-field';
|
|
17
|
+
import 'markdown-to-jsx';
|
|
18
|
+
import '@kickstartds/base/lib/icon';
|
|
19
|
+
import '@kickstartds/base/lib/link';
|
|
20
|
+
import '../search-result/index.js';
|
|
21
|
+
import '@kickstartds/base/lib/rich-text';
|
|
22
|
+
import '@kickstartds/base/lib/picture';
|
|
23
|
+
import '../search-form/SearchForm.client.js';
|
|
24
|
+
|
|
25
|
+
const SearchModal = ({ headline = "Search", closeAriaLabel = "close", formComponent, }) => (jsx("dialog", { "ks-component": "dsa.search-modal", className: "dsa-search-modal", children: jsx(Section, { headline: {
|
|
26
|
+
text: headline,
|
|
27
|
+
sub: closeAriaLabel,
|
|
28
|
+
// @ts-expect-error
|
|
29
|
+
renderSubheadline(sub) {
|
|
30
|
+
return (jsx(Button, { "aria-label": sub, label: "", icon: "close", size: "small", "ks-component": "dsa.radio-emit", "data-topic": "dsa.search-modal.close" }));
|
|
31
|
+
},
|
|
32
|
+
}, spaceBefore: "small", spaceAfter: "small", children: jsx(SearchForm, { component: formComponent }) }) }));
|
|
33
|
+
|
|
34
|
+
export { SearchModal };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
.dsa-search-modal[open] {
|
|
2
|
+
border-radius: var(--ks-border-radius-card);
|
|
3
|
+
border: var(--ks-border-color-interface) solid var(--ks-border-width-default);
|
|
4
|
+
box-shadow: var(--dsa-cookie-consent-dialogue--box-shadow, var(--ks-box-shadow-card));
|
|
5
|
+
background-color: var(--ks-background-color-default);
|
|
6
|
+
padding: 0;
|
|
7
|
+
width: calc(100% - var(--ks-spacing-inset-xs) * 2);
|
|
8
|
+
max-height: calc(100% - var(--ks-spacing-inset-xs) * 2);
|
|
9
|
+
margin-top: var(--ks-spacing-inset-xs);
|
|
10
|
+
}
|
|
11
|
+
.dsa-search-modal::backdrop {
|
|
12
|
+
background-color: var(--dsa-overlay--background-color);
|
|
13
|
+
}
|
|
14
|
+
.dsa-search-modal .l-section__container--headline .dsa-headline {
|
|
15
|
+
flex-direction: row;
|
|
16
|
+
align-items: center;
|
|
17
|
+
justify-content: space-between;
|
|
18
|
+
}
|
|
19
|
+
.dsa-search-modal .dsa-search-bar {
|
|
20
|
+
position: sticky;
|
|
21
|
+
top: 0;
|
|
22
|
+
background: var(--ks-background-color-default);
|
|
23
|
+
padding: 1em 0;
|
|
24
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"$id": "http://schema.mydesignsystem.com/search-modal.schema.json",
|
|
4
|
+
"title": "Search Modal",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"headline": {
|
|
8
|
+
"type": "string",
|
|
9
|
+
"default": "Search"
|
|
10
|
+
},
|
|
11
|
+
"closeAriaLabel": {
|
|
12
|
+
"type": "string",
|
|
13
|
+
"default": "close"
|
|
14
|
+
},
|
|
15
|
+
"formComponent": {
|
|
16
|
+
"type": "string"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"required": [
|
|
20
|
+
"headline",
|
|
21
|
+
"closeAriaLabel"
|
|
22
|
+
],
|
|
23
|
+
"additionalProperties": false
|
|
24
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"$id": "http://schema.mydesignsystem.com/search-modal.schema.json",
|
|
4
|
+
"title": "Search Modal",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"headline": {
|
|
8
|
+
"type": "string",
|
|
9
|
+
"default": "Search"
|
|
10
|
+
},
|
|
11
|
+
"closeAriaLabel": {
|
|
12
|
+
"type": "string",
|
|
13
|
+
"default": "close"
|
|
14
|
+
},
|
|
15
|
+
"formComponent": {
|
|
16
|
+
"type": "string"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"required": ["headline", "closeAriaLabel"],
|
|
20
|
+
"additionalProperties": false
|
|
21
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { SearchResultProps } from "../../SearchResultProps-
|
|
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
|
-
"
|
|
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-
|
|
19
|
-
}), ref: ref, children: [
|
|
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-
|
|
16
|
-
max-width: var(--dsa-tile--
|
|
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
|
-
|
|
20
|
-
|
|
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:
|
|
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
|
-
"
|
|
32
|
+
"small": {
|
|
36
33
|
"type": "boolean",
|
|
37
|
-
"description": "
|
|
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
|
-
"
|
|
28
|
+
"small": {
|
|
30
29
|
"type": "boolean",
|
|
31
|
-
"description": "
|
|
30
|
+
"description": "Small display of the preview image.",
|
|
32
31
|
"default": false
|
|
33
32
|
}
|
|
34
33
|
}
|
package/dist/tokens/themes.css
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Do not edit directly
|
|
3
|
-
* Generated on Thu, 04 Sep 2025
|
|
3
|
+
* Generated on Thu, 04 Sep 2025 11:58:27 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
|
|
2730
|
+
* Generated on Thu, 04 Sep 2025 11:58:31 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
|
|
5461
|
+
* Generated on Thu, 04 Sep 2025 11:58:29 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
|
|
8462
|
+
* Generated on Thu, 04 Sep 2025 11:58:33 GMT
|
|
8463
8463
|
*/
|
|
8464
8464
|
:root [ks-theme=telekom] {
|
|
8465
8465
|
--ks-background-color-accent-base: var(--ks-color-primary-to-bg-8-base);
|
package/dist/tokens/tokens.css
CHANGED
package/dist/tokens/tokens.js
CHANGED
package/package.json
CHANGED
|
@@ -1,71 +0,0 @@
|
|
|
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 };
|
|
File without changes
|