@kickstartds/ds-agency-premium 1.6.71--canary.50.2247.0 → 1.6.71--canary.50.2251.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/components/page-wrapper/tokens.css +1 -1
- package/dist/components/search-form/SearchForm.client.d.ts +2 -1
- package/dist/components/search-form/SearchForm.client.js +39 -16
- package/dist/components/search-form/SearchFormPagefind.client.js +6 -1
- package/dist/components/search-form/index.js +2 -2
- package/dist/components/search-form/search-form.css +1 -1
- package/dist/components/search-modal/RadioEmit.client.js +0 -1
- package/dist/components/search-result/index.js +1 -1
- package/dist/components/search-result/search-result.css +3 -0
- package/dist/components/search-result-match/index.js +1 -1
- 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
|
@@ -1,11 +1,40 @@
|
|
|
1
1
|
import { define, Component } from '@kickstartds/core/lib/component';
|
|
2
2
|
|
|
3
3
|
const parser = new DOMParser();
|
|
4
|
+
const renderResult = (result, element) => {
|
|
5
|
+
const $ = element.querySelector.bind(element), $$ = element.querySelectorAll.bind(element);
|
|
6
|
+
if (result.title) {
|
|
7
|
+
const title = $("[data-result-title]");
|
|
8
|
+
if (title)
|
|
9
|
+
title.textContent = result.title;
|
|
10
|
+
}
|
|
11
|
+
if (result.excerpt) {
|
|
12
|
+
const doc = parser.parseFromString(result.excerpt, "text/html");
|
|
13
|
+
const excerpt = $("[data-result-excerpt]");
|
|
14
|
+
if (excerpt)
|
|
15
|
+
excerpt.replaceChildren(...doc.body.childNodes);
|
|
16
|
+
}
|
|
17
|
+
if (result.url) {
|
|
18
|
+
const url = $("[data-result-url]");
|
|
19
|
+
if (url)
|
|
20
|
+
url.textContent = result.url;
|
|
21
|
+
const links = $$("[data-result-link]");
|
|
22
|
+
for (const link of links) {
|
|
23
|
+
link.setAttribute("href", result.url);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
if (result.image) {
|
|
27
|
+
const image = $("[data-result-image]");
|
|
28
|
+
if (image)
|
|
29
|
+
image.dataset.src = result.image;
|
|
30
|
+
}
|
|
31
|
+
};
|
|
4
32
|
class SearchForm extends Component {
|
|
5
33
|
constructor(element) {
|
|
6
34
|
super(element);
|
|
7
35
|
this.$searchInput = this.$(".dsa-search-bar__input");
|
|
8
|
-
this.$
|
|
36
|
+
this.$resultTemplate = this.$("[data-template=result]");
|
|
37
|
+
this.$subresultTemplate = this.$("[data-template=subresult]");
|
|
9
38
|
this.$results = this.$(".dsa-search-form__results");
|
|
10
39
|
this.on(element, "submit", (event) => {
|
|
11
40
|
event.preventDefault();
|
|
@@ -23,22 +52,16 @@ class SearchForm extends Component {
|
|
|
23
52
|
}
|
|
24
53
|
showResults(results) {
|
|
25
54
|
for (const result of results) {
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
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);
|
|
55
|
+
const $resultClone = this.$resultTemplate.cloneNode(true);
|
|
56
|
+
renderResult(result, $resultClone);
|
|
57
|
+
const $subResultsContainer = this.$("[data-result-subresults]", $resultClone);
|
|
58
|
+
for (const subResult of result.subResults) {
|
|
59
|
+
const $subResultClone = this.$subresultTemplate.cloneNode(true);
|
|
60
|
+
$subResultClone.setAttribute("href", subResult.url);
|
|
61
|
+
renderResult(subResult, $subResultClone);
|
|
62
|
+
$subResultsContainer.appendChild($subResultClone);
|
|
38
63
|
}
|
|
39
|
-
|
|
40
|
-
link.textContent = result.url;
|
|
41
|
-
this.$results.appendChild(clone);
|
|
64
|
+
this.$results.appendChild($resultClone);
|
|
42
65
|
}
|
|
43
66
|
}
|
|
44
67
|
onRadio(topic, fn) {
|
|
@@ -5,7 +5,6 @@ const staticPageFindPath = "/pagefind/pagefind.js";
|
|
|
5
5
|
class SearchFormPagefind extends SearchForm {
|
|
6
6
|
constructor(element) {
|
|
7
7
|
super(element);
|
|
8
|
-
console.log("hello");
|
|
9
8
|
(async () => {
|
|
10
9
|
const pagefind = await import(/* @vite-ignore */ staticPageFindPath);
|
|
11
10
|
await pagefind.init();
|
|
@@ -23,6 +22,12 @@ class SearchFormPagefind extends SearchForm {
|
|
|
23
22
|
title: result.meta.title,
|
|
24
23
|
url: result.url,
|
|
25
24
|
excerpt: result.excerpt,
|
|
25
|
+
image: result.meta.image,
|
|
26
|
+
subResults: (result.sub_results || []).map((subResult) => ({
|
|
27
|
+
title: subResult.title,
|
|
28
|
+
url: subResult.url,
|
|
29
|
+
excerpt: subResult.excerpt,
|
|
30
|
+
})),
|
|
26
31
|
})));
|
|
27
32
|
}
|
|
28
33
|
}
|
|
@@ -3,6 +3,7 @@ import { jsxs, jsx } from 'react/jsx-runtime';
|
|
|
3
3
|
import classnames from 'classnames';
|
|
4
4
|
import { SearchBar } from '../search-bar/index.js';
|
|
5
5
|
import { SearchResult } from '../search-result/index.js';
|
|
6
|
+
import { SearchResultMatch } from '../search-result-match/index.js';
|
|
6
7
|
import './SearchForm.client.js';
|
|
7
8
|
import 'react';
|
|
8
9
|
import '@kickstartds/form/lib/text-field';
|
|
@@ -13,9 +14,8 @@ import '../../helpers-12f48df8.js';
|
|
|
13
14
|
import '@kickstartds/base/lib/rich-text';
|
|
14
15
|
import '@kickstartds/base/lib/picture';
|
|
15
16
|
import '@kickstartds/core/lib/container';
|
|
16
|
-
import '../search-result-match/index.js';
|
|
17
17
|
import '@kickstartds/core/lib/component';
|
|
18
18
|
|
|
19
|
-
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",
|
|
19
|
+
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: "" }), jsxs("div", { hidden: true, children: [jsx("li", { "data-template": "result", children: jsx(SearchResult, { previewImage: {} }) }), jsx(SearchResultMatch, { "data-template": "subresult" })] }), jsx("ol", { className: "dsa-search-form__results" })] }));
|
|
20
20
|
|
|
21
21
|
export { SearchForm };
|
|
@@ -4,7 +4,6 @@ class RadioEmit extends Component {
|
|
|
4
4
|
constructor(element) {
|
|
5
5
|
super(element);
|
|
6
6
|
const { topic, action = "click", value } = element.dataset;
|
|
7
|
-
console.log(topic, action);
|
|
8
7
|
const handler = () => window._ks.radio.emit(topic, value);
|
|
9
8
|
element.addEventListener(action, handler);
|
|
10
9
|
this.onDisconnect(() => {
|
|
@@ -20,7 +20,7 @@ const defaults = {
|
|
|
20
20
|
|
|
21
21
|
const SearchResultContextDefault = forwardRef(({ title, previewImage, initialMatch, matches, url, showLink }, ref) => (jsx(Container, { name: "search-result", children: jsxs("div", { ref: ref, className: classnames("dsa-search-result", {
|
|
22
22
|
"dsa-search-result--image-large": previewImage?.large,
|
|
23
|
-
}), children: [jsxs("div", { className: "dsa-search-result__content", children: [jsx("div", { className: "dsa-search-result__header", children: jsx(Link, { href: url, className: "dsa-search-result__title", children: title }) }),
|
|
23
|
+
}), children: [jsxs("div", { className: "dsa-search-result__content", children: [jsx("div", { className: "dsa-search-result__header", children: jsx(Link, { href: url, className: "dsa-search-result__title", "data-result-link": true, "data-result-title": true, children: title }) }), jsx(RichText, { text: initialMatch, className: "dsa-search-result__initial-match", "data-result-excerpt": true }), jsx("div", { className: "dsa-search-result__matches", "data-result-subresults": true, children: matches?.map((match, index) => (jsx(SearchResultMatch, { ...match }, index))) }), showLink && (jsx(Link, { href: url, className: "dsa-search-result__link", "data-result-link": true, "data-result-url": true, children: url }))] }), previewImage && (jsx(Link, { tabIndex: -1, "aria-hidden": true, href: url, className: "dsa-search-result__preview-image-wrapper", "data-result-link": true, children: jsx(Picture, { src: previewImage.src, alt: "", className: "dsa-search-result__preview-image", "data-result-image": true }) }))] }) })));
|
|
24
24
|
const SearchResultContext = createContext(SearchResultContextDefault);
|
|
25
25
|
const SearchResult = forwardRef((props, ref) => {
|
|
26
26
|
const Component = useContext(SearchResultContext);
|
|
@@ -31,6 +31,9 @@
|
|
|
31
31
|
.dsa-search-result__matches {
|
|
32
32
|
padding: var(--ks-spacing-xxs) 0;
|
|
33
33
|
}
|
|
34
|
+
.dsa-search-result__matches:empty {
|
|
35
|
+
display: none;
|
|
36
|
+
}
|
|
34
37
|
.dsa-search-result__title {
|
|
35
38
|
font-size: var(--ks-font-size-display-l);
|
|
36
39
|
font-family: var(--ks-font-family-display);
|
|
@@ -8,7 +8,7 @@ import { Icon } from '@kickstartds/base/lib/icon';
|
|
|
8
8
|
|
|
9
9
|
const defaults = {};
|
|
10
10
|
|
|
11
|
-
const SearchResultMatchContextDefault = forwardRef(({ title, snippet, url }, ref) => (jsxs(Link, { ref: ref, href: url, className: "dsa-search-result-match", children: [jsxs("div", { className: "dsa-search-result-match__title", children: [jsx(Icon, { className: "dsa-search-result-match__chevron", icon: "chevron-right" }), title] }), jsx(RichText, { text: snippet, className: "dsa-search-result-match__snippet" })] })));
|
|
11
|
+
const SearchResultMatchContextDefault = forwardRef(({ title, snippet, url, ...props }, ref) => (jsxs(Link, { ref: ref, href: url, className: "dsa-search-result-match", "data-result-link": true, ...props, children: [jsxs("div", { className: "dsa-search-result-match__title", children: [jsx(Icon, { className: "dsa-search-result-match__chevron", icon: "chevron-right" }), jsx("span", { "data-result-title": true, children: title })] }), jsx(RichText, { text: snippet, className: "dsa-search-result-match__snippet", "data-result-excerpt": true })] })));
|
|
12
12
|
const SearchResultMatchContext = createContext(SearchResultMatchContextDefault);
|
|
13
13
|
const SearchResultMatch = forwardRef((props, ref) => {
|
|
14
14
|
const Component = useContext(SearchResultMatchContext);
|
package/dist/tokens/themes.css
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Do not edit directly
|
|
3
|
-
* Generated on Fri, 05 Sep 2025
|
|
3
|
+
* Generated on Fri, 05 Sep 2025 12:11:44 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
|
|
2730
|
+
* Generated on Fri, 05 Sep 2025 12:11:48 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
|
|
5461
|
+
* Generated on Fri, 05 Sep 2025 12:11:46 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
|
|
8462
|
+
* Generated on Fri, 05 Sep 2025 12:11:50 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