@kickstartds/ds-agency-premium 1.6.71--canary.55.2416.0 → 1.6.72--canary.43.2474.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/BlogOverviewProps-9f207f1c.d.ts +1 -1
- package/dist/{BlogPostProps-c760fd2a.d.ts → BlogPostProps-6b3cff22.d.ts} +1 -1
- package/dist/ContactProps-7cac90e5.d.ts +70 -0
- package/dist/{FaqProps-ad618cd5.d.ts → FaqProps-78384db5.d.ts} +7 -12
- package/dist/HeadlineProps-e1305784.d.ts +53 -0
- package/dist/{LogosProps-f9474fe2.d.ts → LogosProps-d4677d2c.d.ts} +1 -23
- package/dist/PageProps-aa29c554.d.ts +1 -1
- package/dist/SearchBarProps-26263244.d.ts +29 -0
- package/dist/SearchFormProps-3d2c3462.d.ts +30 -0
- package/dist/SearchResultMatchProps-777cd47c.d.ts +23 -0
- package/dist/SearchResultProps-f6f07017.d.ts +44 -0
- package/dist/{SectionProps-d60aba86.d.ts → SectionProps-6a826e52.d.ts} +8 -4
- package/dist/SliderProps-789f8508.d.ts +2 -2
- package/dist/SplitEvenProps-789f8508.d.ts +12 -5
- package/dist/SplitWeightedProps-789f8508.d.ts +12 -5
- package/dist/{TeaserCardProps-994cb119.d.ts → TeaserCardProps-d069476f.d.ts} +6 -1
- package/dist/components/blog-overview/blog-overview.schema.dereffed.json +5254 -1550
- package/dist/components/blog-post/blog-post.schema.dereffed.json +5254 -1550
- package/dist/components/blog-post/index.d.ts +1 -1
- package/dist/components/business-card/business-card.css +7 -5
- package/dist/components/business-card/index.js +1 -1
- package/dist/components/button/button.css +6 -1
- package/dist/components/contact/index.d.ts +1 -70
- package/dist/components/content-nav/content-nav.css +2 -0
- package/dist/components/cookie-consent/C15t.client.js +57 -1
- package/dist/components/cookie-consent/CookieConsent.client.d.ts +5 -1
- package/dist/components/cookie-consent/CookieConsent.client.js +13 -13
- package/dist/components/cookie-consent/cookie-consent.css +17 -25
- package/dist/components/cookie-consent/index.js +1 -1
- package/dist/components/downloads/downloads.css +13 -8
- package/dist/components/event-latest-teaser/event-latest-teaser.css +2 -2
- package/dist/components/event-list-teaser/event-list-teaser.css +1 -1
- package/dist/components/event-location/event-location.css +3 -3
- package/dist/components/faq/faq.css +1 -1
- package/dist/components/faq/faq.schema.dereffed.json +2 -2
- package/dist/components/faq/faq.schema.json +2 -1
- package/dist/components/faq/index.d.ts +24 -7
- package/dist/components/faq/index.js +1 -1
- package/dist/components/feature/index.js +2 -2
- package/dist/components/features/index.js +1 -1
- package/dist/components/headline/headline.css +5 -9
- package/dist/components/headline/index.d.ts +1 -53
- package/dist/components/hero/hero.css +53 -32
- package/dist/components/image-story/image-story.css +4 -0
- package/dist/components/index/index.d.ts +1 -1
- package/dist/components/logos/index.d.ts +1 -1
- package/dist/components/logos/logos.css +8 -6
- package/dist/components/logos/logos.schema.dereffed.json +1 -2
- package/dist/components/logos/logos.schema.json +1 -2
- package/dist/components/nav-dropdown/nav-dropdown.css +5 -3
- package/dist/components/page/page.schema.dereffed.json +5254 -1550
- package/dist/components/page-wrapper/index.js +0 -1
- package/dist/components/pagination/index.d.ts +10 -2
- package/dist/components/pagination/index.js +32 -38
- package/dist/components/pagination/pagination.css +34 -10
- package/dist/components/pagination/pagination.schema.dereffed.json +3 -0
- package/dist/components/pagination/pagination.schema.json +3 -0
- package/dist/components/presets.json +156 -70
- package/dist/components/search/index.d.ts +11 -1
- package/dist/components/search/index.js +33 -20
- package/dist/components/search/search.schema.dereffed.json +189 -13
- package/dist/components/search/search.schema.json +6 -0
- package/dist/components/search-bar/index.d.ts +1 -29
- package/dist/components/search-bar/index.js +1 -1
- package/dist/components/search-form/SearchForm.client.d.ts +25 -0
- package/dist/components/search-form/SearchForm.client.js +228 -0
- package/dist/components/search-form/SearchFormPagefind.client.d.ts +5 -0
- package/dist/components/search-form/SearchFormPagefind.client.js +40 -0
- package/dist/components/search-form/index.d.ts +4 -0
- package/dist/components/search-form/index.js +25 -0
- package/dist/components/search-form/search-form.css +10 -0
- package/dist/components/search-form/search-form.schema.dereffed.json +49 -0
- package/dist/components/search-form/search-form.schema.json +38 -0
- package/dist/components/search-modal/RadioEmit.client.d.ts +5 -0
- package/dist/components/search-modal/RadioEmit.client.js +17 -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 +18 -0
- package/dist/components/search-modal/index.js +39 -0
- package/dist/components/search-modal/search-modal.css +27 -0
- package/dist/components/search-modal/search-modal.schema.dereffed.json +70 -0
- package/dist/components/search-modal/search-modal.schema.json +24 -0
- package/dist/components/search-result/index.d.ts +4 -4
- package/dist/components/search-result/index.js +11 -2
- package/dist/components/search-result/search-result.css +61 -13
- package/dist/components/search-result/search-result.schema.dereffed.json +56 -13
- package/dist/components/search-result/search-result.schema.json +23 -12
- package/dist/components/search-result-match/index.d.ts +7 -0
- package/dist/components/search-result-match/index.js +18 -0
- package/dist/components/search-result-match/search-result-match.css +18 -0
- package/dist/components/search-result-match/search-result-match.schema.dereffed.json +33 -0
- package/dist/components/search-result-match/search-result-match.schema.json +31 -0
- package/dist/components/section/index.d.ts +1 -1
- package/dist/components/section/section.css +12 -7
- package/dist/components/section/section.schema.dereffed.json +5254 -1550
- package/dist/components/section/section.schema.json +12 -0
- package/dist/components/slider/slider.schema.dereffed.json +7 -2
- package/dist/components/split-even/index.d.ts +6 -6
- package/dist/components/split-even/split-even.schema.dereffed.json +2406 -824
- package/dist/components/split-even/split-even.schema.json +42 -0
- package/dist/components/split-weighted/index.d.ts +6 -6
- package/dist/components/split-weighted/split-weighted.schema.dereffed.json +2406 -824
- package/dist/components/split-weighted/split-weighted.schema.json +42 -0
- package/dist/components/stats/stats.css +2 -0
- package/dist/components/teaser-card/index.d.ts +1 -1
- package/dist/components/teaser-card/index.js +2 -1
- package/dist/components/teaser-card/teaser-card.css +10 -6
- package/dist/components/teaser-card/teaser-card.schema.dereffed.json +6 -0
- package/dist/components/teaser-card/teaser-card.schema.json +6 -0
- package/dist/components/testimonials/testimonials.css +3 -1
- package/dist/global.css +3888 -177
- package/dist/static/fonts/dsa/Fredoka-Bold.woff +0 -0
- package/dist/static/fonts/dsa/Fredoka-Bold.woff2 +0 -0
- package/dist/static/fonts/dsa/Fredoka-Light.woff +0 -0
- package/dist/static/fonts/dsa/Fredoka-Light.woff2 +0 -0
- package/dist/static/fonts/dsa/Fredoka-Medium.woff +0 -0
- package/dist/static/fonts/dsa/Fredoka-Medium.woff2 +0 -0
- package/dist/static/fonts/dsa/Fredoka-Regular.woff +0 -0
- package/dist/static/fonts/dsa/Fredoka-Regular.woff2 +0 -0
- package/dist/static/fonts/dsa/Fredoka-SemiBold.woff +0 -0
- package/dist/static/fonts/dsa/Fredoka-SemiBold.woff2 +0 -0
- package/dist/static/fonts/dsa/Mulish-300.woff +0 -0
- package/dist/static/fonts/dsa/Mulish-300.woff2 +0 -0
- package/dist/static/fonts/dsa/Mulish-600.woff +0 -0
- package/dist/static/fonts/dsa/Mulish-600.woff2 +0 -0
- package/dist/static/fonts/dsa/Mulish-800.woff +0 -0
- package/dist/static/fonts/dsa/Mulish-800.woff2 +0 -0
- package/dist/static/fonts/dsa/Mulish-Regular.woff +0 -0
- package/dist/static/fonts/dsa/Mulish-Regular.woff2 +0 -0
- package/dist/static/img/bg-color-swatch.png +0 -0
- package/dist/static/img/screenshots/blog-blog-aside--default.png +0 -0
- package/dist/static/img/screenshots/blog-blog-author--default.png +0 -0
- package/dist/static/img/screenshots/blog-blog-head--default.png +0 -0
- package/dist/static/img/screenshots/blog-blog-teaser--default.png +0 -0
- package/dist/static/img/screenshots/components-button--primary-button.png +0 -0
- package/dist/static/img/screenshots/components-button--primary-disabled-button.png +0 -0
- package/dist/static/img/screenshots/components-button--secondary-button.png +0 -0
- package/dist/static/img/screenshots/components-button--tertiary-button.png +0 -0
- package/dist/static/img/screenshots/components-contact--circular-avatar.png +0 -0
- package/dist/static/img/screenshots/components-contact--full-image-width.png +0 -0
- package/dist/static/img/screenshots/components-contact--vertical-image-with-paragraph.png +0 -0
- package/dist/static/img/screenshots/components-contact--wide-image.png +0 -0
- package/dist/static/img/screenshots/components-cta--align-bottom.png +0 -0
- package/dist/static/img/screenshots/components-cta--angled-image.png +0 -0
- package/dist/static/img/screenshots/components-cta--banner.png +0 -0
- package/dist/static/img/screenshots/components-cta--colored-banner.png +0 -0
- package/dist/static/img/screenshots/components-cta--contact-banner.png +0 -0
- package/dist/static/img/screenshots/components-cta--highlighted.png +0 -0
- package/dist/static/img/screenshots/components-cta--left-aligned.png +0 -0
- package/dist/static/img/screenshots/components-cta--product-advertisement.png +0 -0
- package/dist/static/img/screenshots/components-cta--split-banner.png +0 -0
- package/dist/static/img/screenshots/components-faq--dropdown-list.png +0 -0
- package/dist/static/img/screenshots/components-faq--single-dropdown.png +0 -0
- package/dist/static/img/screenshots/components-features--icon-beside-with-link-in-text.png +0 -0
- package/dist/static/img/screenshots/components-features--icon-centered.png +0 -0
- package/dist/static/img/screenshots/components-features--icon-intext-with-link.png +0 -0
- package/dist/static/img/screenshots/components-features--list-view.png +0 -0
- package/dist/static/img/screenshots/components-features--stack-with-button.png +0 -0
- package/dist/static/img/screenshots/components-gallery--free-aspect-ratio.png +0 -0
- package/dist/static/img/screenshots/components-gallery--large-landscape-tiles.png +0 -0
- package/dist/static/img/screenshots/components-gallery--small-squares-with-lightbox.png +0 -0
- package/dist/static/img/screenshots/components-gallery--stack-landscape.png +0 -0
- package/dist/static/img/screenshots/components-headline--h-1.png +0 -0
- package/dist/static/img/screenshots/components-headline--h-2.png +0 -0
- package/dist/static/img/screenshots/components-headline--h-3.png +0 -0
- package/dist/static/img/screenshots/components-headline--h-4.png +0 -0
- package/dist/static/img/screenshots/components-headline--order-swapped.png +0 -0
- package/dist/static/img/screenshots/components-headline--with-markdown.png +0 -0
- package/dist/static/img/screenshots/components-headline--with-subheadline.png +0 -0
- package/dist/static/img/screenshots/components-hero--text-below-image.png +0 -0
- package/dist/static/img/screenshots/components-hero--text-box-on-full-screen.png +0 -0
- package/dist/static/img/screenshots/components-hero--text-on-image-with-overlay.png +0 -0
- package/dist/static/img/screenshots/components-html--html.png +0 -0
- package/dist/static/img/screenshots/components-html--with-consent.png +0 -0
- package/dist/static/img/screenshots/components-html--with-script.png +0 -0
- package/dist/static/img/screenshots/components-image-story--sticky-image-next-to-scrolling-text.png +0 -0
- package/dist/static/img/screenshots/components-image-text--above-layout.png +0 -0
- package/dist/static/img/screenshots/components-image-text--beside-right-layout.png +0 -0
- package/dist/static/img/screenshots/components-logos--centered-with-button.png +0 -0
- package/dist/static/img/screenshots/components-logos--left-aligned-with-text-link.png +0 -0
- package/dist/static/img/screenshots/components-logos--logo-row.png +0 -0
- package/dist/static/img/screenshots/components-logos--logo-wall.png +0 -0
- package/dist/static/img/screenshots/components-mosaic--colorful-text-with-illustrations.png +0 -0
- package/dist/static/img/screenshots/components-mosaic--colorful-tiles.png +0 -0
- package/dist/static/img/screenshots/components-stats--count-up-with-description.png +0 -0
- package/dist/static/img/screenshots/components-stats--count-up-with-icons.png +0 -0
- package/dist/static/img/screenshots/components-teaser-card--page-navigation.png +0 -0
- package/dist/static/img/screenshots/components-teaser-card--product-tiles.png +0 -0
- package/dist/static/img/screenshots/components-teaser-card--showcase-preview.png +0 -0
- package/dist/static/img/screenshots/components-testimonials--alternating-layout.png +0 -0
- package/dist/static/img/screenshots/components-testimonials--list-layout.png +0 -0
- package/dist/static/img/screenshots/components-testimonials--simple.png +0 -0
- package/dist/static/img/screenshots/components-testimonials--slider-layout.png +0 -0
- package/dist/static/img/screenshots/components-testimonials--with-rating.png +0 -0
- package/dist/static/img/screenshots/components-testimonials--with-title.png +0 -0
- package/dist/static/img/screenshots/components-text--centered.png +0 -0
- package/dist/static/img/screenshots/components-text--highlight.png +0 -0
- package/dist/static/img/screenshots/components-text--multi-column.png +0 -0
- package/dist/static/img/screenshots/components-text--single-column.png +0 -0
- package/dist/static/img/screenshots/components-video-curtain--atmospheric-video-with-overlay.png +0 -0
- package/dist/static/img/screenshots/components-video-curtain--color-neutral-text.png +0 -0
- package/dist/static/img/screenshots/components-video-curtain--color-neutral-video.png +0 -0
- package/dist/static/img/screenshots/corporate-breadcrumb--default.png +0 -0
- package/dist/static/img/screenshots/corporate-business-card--centered.png +0 -0
- package/dist/static/img/screenshots/corporate-business-card--default.png +0 -0
- package/dist/static/img/screenshots/corporate-business-card--without-image.png +0 -0
- package/dist/static/img/screenshots/corporate-content-nav--default.png +0 -0
- package/dist/static/img/screenshots/corporate-cookie-consent--banner.png +0 -0
- package/dist/static/img/screenshots/corporate-cookie-consent--c-15-t.png +0 -0
- package/dist/static/img/screenshots/corporate-cookie-consent--card.png +0 -0
- package/dist/static/img/screenshots/corporate-downloads--complete.png +0 -0
- package/dist/static/img/screenshots/corporate-downloads--description-only.png +0 -0
- package/dist/static/img/screenshots/corporate-downloads--mixed.png +0 -0
- package/dist/static/img/screenshots/corporate-downloads--technical-details-only.png +0 -0
- package/dist/static/img/screenshots/corporate-pagination--default.png +0 -0
- package/dist/static/img/screenshots/corporate-search-bar--default.png +0 -0
- package/dist/static/img/screenshots/corporate-search-filter--default.png +0 -0
- package/dist/static/img/screenshots/corporate-search-form--pagefind.png +0 -0
- package/dist/static/img/screenshots/corporate-search-modal--pagefind.png +0 -0
- package/dist/static/img/screenshots/corporate-search-result--default.png +0 -0
- package/dist/static/img/screenshots/event-event-filter--default.png +0 -0
- package/dist/static/img/screenshots/event-event-header--default.png +0 -0
- package/dist/static/img/screenshots/event-event-latest--default.png +0 -0
- package/dist/static/img/screenshots/event-event-latest-teaser--default.png +0 -0
- package/dist/static/img/screenshots/event-event-list-teaser--default.png +0 -0
- package/dist/static/img/screenshots/event-event-location--default.png +0 -0
- package/dist/static/img/screenshots/event-event-login--default.png +0 -0
- package/dist/static/img/screenshots/event-event-registration--default.png +0 -0
- package/dist/static/img/screenshots/form-checkbox--default.png +0 -0
- package/dist/static/img/screenshots/form-radio--default.png +0 -0
- package/dist/static/img/screenshots/form-select-field--default.png +0 -0
- package/dist/static/img/screenshots/form-text-area--default.png +0 -0
- package/dist/static/img/screenshots/form-text-field--default.png +0 -0
- package/dist/static/img/screenshots/layout-divider--accent.png +0 -0
- package/dist/static/img/screenshots/layout-divider--default.png +0 -0
- package/dist/static/img/screenshots/layout-footer--footer.png +0 -0
- package/dist/static/img/screenshots/layout-header--header.png +0 -0
- package/dist/static/img/screenshots/layout-section--accent-background.png +0 -0
- package/dist/static/img/screenshots/layout-section--background-image.png +0 -0
- package/dist/static/img/screenshots/layout-section--bold-background.png +0 -0
- package/dist/static/img/screenshots/layout-section--dynamic-layout.png +0 -0
- package/dist/static/img/screenshots/layout-section--framed.png +0 -0
- package/dist/static/img/screenshots/layout-section--inverted.png +0 -0
- package/dist/static/img/screenshots/layout-section--list-layout.png +0 -0
- package/dist/static/img/screenshots/layout-section--slider.png +0 -0
- package/dist/static/img/screenshots/layout-section--tile-layout.png +0 -0
- package/dist/static/img/screenshots/layout-section--with-buttons.png +0 -0
- package/dist/static/img/screenshots/layout-slider--with-arrows.png +0 -0
- package/dist/static/img/screenshots/layout-slider--with-autoplay.png +0 -0
- package/dist/static/img/screenshots/layout-slider--with-nav.png +0 -0
- package/dist/static/img/screenshots/layout-slider--with-teased-neighbours.png +0 -0
- package/dist/static/img/screenshots/layout-split-even--faq-with-form.png +0 -0
- package/dist/static/img/screenshots/layout-split-even--text-with-logos.png +0 -0
- package/dist/static/img/screenshots/layout-split-weighted--text-with-contact.png +0 -0
- package/dist/static/img/screenshots/layout-split-weighted--text-with-teaser.png +0 -0
- package/dist/static/img/screenshots/page-archetypes-about--about.png +0 -0
- package/dist/static/img/screenshots/page-archetypes-blog-overview--blog-overview.png +0 -0
- package/dist/static/img/screenshots/page-archetypes-blog-post--blog-post.png +0 -0
- package/dist/static/img/screenshots/page-archetypes-event-detail--event-detail.png +0 -0
- package/dist/static/img/screenshots/page-archetypes-event-list--event-list.png +0 -0
- package/dist/static/img/screenshots/page-archetypes-job-detail--job-detail.png +0 -0
- package/dist/static/img/screenshots/page-archetypes-jobs--jobs.png +0 -0
- package/dist/static/img/screenshots/page-archetypes-landingpage--landingpage.png +0 -0
- package/dist/static/img/screenshots/page-archetypes-overview--overview.png +0 -0
- package/dist/static/img/screenshots/page-archetypes-search--search.png +0 -0
- package/dist/static/img/screenshots/page-archetypes-showcase--showcase.png +0 -0
- package/dist/static/logo.svg +13 -57
- package/dist/tokens/themes.css +20 -20
- package/dist/tokens/tokens.css +359 -360
- package/dist/tokens/tokens.js +540 -541
- package/package.json +7 -4
- package/dist/SearchResultProps-224c2338.d.ts +0 -33
- package/dist/components/page-wrapper/tokens.css +0 -2480
- package/dist/static/fonts/dsa/permanent-marker-regular.woff2 +0 -0
- package/dist/static/fonts/dsa/wix-madefor-display-600.woff2 +0 -0
- package/dist/static/fonts/dsa/wix-madefor-display-700.woff2 +0 -0
- package/dist/static/fonts/dsa/wix-madefor-display-regular.woff2 +0 -0
- package/dist/static/fonts/dsa/wix-madefor-text-500.woff2 +0 -0
- package/dist/static/fonts/dsa/wix-madefor-text-600.woff2 +0 -0
- package/dist/static/fonts/dsa/wix-madefor-text-700.woff2 +0 -0
- package/dist/static/fonts/dsa/wix-madefor-text-regular.woff2 +0 -0
- package/dist/static/img/screenshots/components-image--custom-aspect-ratio.png +0 -0
- package/dist/static/img/screenshots/components-image--preset-size.png +0 -0
- package/dist/static/img/screenshots/components-image--responsive-image.png +0 -0
- package/dist/static/img/screenshots/layout-section--cards.png +0 -0
- package/dist/static/img/screenshots/layout-section--colorful-gradient.png +0 -0
- package/dist/static/img/screenshots/layout-section--flex-layout.png +0 -0
- package/dist/static/img/screenshots/layout-section--spotlight.png +0 -0
- package/dist/static/img/screenshots/layout-section--stagelights.png +0 -0
- package/dist/static/img/screenshots/pages-archetypes--blog-overview.png +0 -0
- package/dist/static/img/screenshots/pages-archetypes--blog-post.png +0 -0
- package/dist/static/img/screenshots/pages-archetypes--content.png +0 -0
- package/dist/static/img/screenshots/pages-archetypes--overview.png +0 -0
- package/dist/static/img/screenshots/pages-archetypes--start.png +0 -0
- package/dist/static/taktsoft-energy/preview.gif +0 -0
|
@@ -4,6 +4,139 @@
|
|
|
4
4
|
"title": "Search",
|
|
5
5
|
"type": "object",
|
|
6
6
|
"properties": {
|
|
7
|
+
"headline": {
|
|
8
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
9
|
+
"$id": "http://schema.mydesignsystem.com/headline.schema.json",
|
|
10
|
+
"title": "Headline",
|
|
11
|
+
"description": "Component used for headlines",
|
|
12
|
+
"type": "object",
|
|
13
|
+
"properties": {
|
|
14
|
+
"text": {
|
|
15
|
+
"type": "string",
|
|
16
|
+
"title": "Text",
|
|
17
|
+
"description": "Text content of headline",
|
|
18
|
+
"format": "markdown"
|
|
19
|
+
},
|
|
20
|
+
"sub": {
|
|
21
|
+
"type": "string",
|
|
22
|
+
"title": "Sub",
|
|
23
|
+
"description": "Subheadline content",
|
|
24
|
+
"format": "markdown"
|
|
25
|
+
},
|
|
26
|
+
"switchOrder": {
|
|
27
|
+
"type": "boolean",
|
|
28
|
+
"title": "Switch order?",
|
|
29
|
+
"description": "Switch order of headline and subheadline",
|
|
30
|
+
"default": false
|
|
31
|
+
},
|
|
32
|
+
"align": {
|
|
33
|
+
"type": "string",
|
|
34
|
+
"title": "Section alignment",
|
|
35
|
+
"enum": [
|
|
36
|
+
"left",
|
|
37
|
+
"center",
|
|
38
|
+
"right"
|
|
39
|
+
]
|
|
40
|
+
},
|
|
41
|
+
"level": {
|
|
42
|
+
"type": "string",
|
|
43
|
+
"title": "Level",
|
|
44
|
+
"description": "Level of headline to use",
|
|
45
|
+
"enum": [
|
|
46
|
+
"h1",
|
|
47
|
+
"h2",
|
|
48
|
+
"h3",
|
|
49
|
+
"h4",
|
|
50
|
+
"p"
|
|
51
|
+
],
|
|
52
|
+
"default": "h2"
|
|
53
|
+
},
|
|
54
|
+
"style": {
|
|
55
|
+
"type": "string",
|
|
56
|
+
"title": "Style",
|
|
57
|
+
"description": "Style of headline to show",
|
|
58
|
+
"enum": [
|
|
59
|
+
"h1",
|
|
60
|
+
"h2",
|
|
61
|
+
"h3",
|
|
62
|
+
"h4",
|
|
63
|
+
"p"
|
|
64
|
+
],
|
|
65
|
+
"default": "h2"
|
|
66
|
+
},
|
|
67
|
+
"spaceAfter": {
|
|
68
|
+
"type": "string",
|
|
69
|
+
"title": "Space after?",
|
|
70
|
+
"description": "Whether to display space after headline",
|
|
71
|
+
"enum": [
|
|
72
|
+
"minimum",
|
|
73
|
+
"small",
|
|
74
|
+
"large"
|
|
75
|
+
],
|
|
76
|
+
"default": "small"
|
|
77
|
+
},
|
|
78
|
+
"className": {
|
|
79
|
+
"type": "string",
|
|
80
|
+
"title": "Class Name",
|
|
81
|
+
"description": "Set a custom class name"
|
|
82
|
+
},
|
|
83
|
+
"id": {
|
|
84
|
+
"type": "string",
|
|
85
|
+
"title": "ID",
|
|
86
|
+
"description": "Set a custom id attribute"
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
"additionalProperties": false,
|
|
90
|
+
"required": [
|
|
91
|
+
"level",
|
|
92
|
+
"text"
|
|
93
|
+
]
|
|
94
|
+
},
|
|
95
|
+
"searchBar": {
|
|
96
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
97
|
+
"$id": "http://schema.mydesignsystem.com/search-bar.schema.json",
|
|
98
|
+
"title": "Search Bar",
|
|
99
|
+
"type": "object",
|
|
100
|
+
"properties": {
|
|
101
|
+
"placeholder": {
|
|
102
|
+
"title": "Placeholder",
|
|
103
|
+
"type": "string",
|
|
104
|
+
"description": "Placeholder text for the search input field.",
|
|
105
|
+
"examples": [
|
|
106
|
+
"Search..."
|
|
107
|
+
]
|
|
108
|
+
},
|
|
109
|
+
"buttonText": {
|
|
110
|
+
"type": "string",
|
|
111
|
+
"description": "Text displayed on the search button.",
|
|
112
|
+
"examples": [
|
|
113
|
+
"Search"
|
|
114
|
+
]
|
|
115
|
+
},
|
|
116
|
+
"hint": {
|
|
117
|
+
"type": "string",
|
|
118
|
+
"description": "Additional information or instructions related to the search functionality.",
|
|
119
|
+
"examples": [
|
|
120
|
+
"Press <kbd>Enter</kbd> to search"
|
|
121
|
+
]
|
|
122
|
+
},
|
|
123
|
+
"alternativeText": {
|
|
124
|
+
"type": "string",
|
|
125
|
+
"description": "Text to display when offering alternative results.",
|
|
126
|
+
"examples": [
|
|
127
|
+
"Did you mean"
|
|
128
|
+
]
|
|
129
|
+
},
|
|
130
|
+
"alternativeResult": {
|
|
131
|
+
"type": "string",
|
|
132
|
+
"description": "The alternative result to display when offering suggestions.",
|
|
133
|
+
"examples": [
|
|
134
|
+
"AI Conference"
|
|
135
|
+
]
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
"additionalProperties": false
|
|
139
|
+
},
|
|
7
140
|
"searchFilter": {
|
|
8
141
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
9
142
|
"$id": "http://schema.mydesignsystem.com/search-filter.schema.json",
|
|
@@ -94,27 +227,70 @@
|
|
|
94
227
|
"AI Conference 2023"
|
|
95
228
|
]
|
|
96
229
|
},
|
|
97
|
-
"
|
|
98
|
-
"title": "
|
|
230
|
+
"imageColSize": {
|
|
231
|
+
"title": "Image Row Size",
|
|
99
232
|
"type": "string",
|
|
100
|
-
"description": "The
|
|
101
|
-
"
|
|
102
|
-
|
|
233
|
+
"description": "The reserved space of the image row.",
|
|
234
|
+
"default": "small",
|
|
235
|
+
"enum": [
|
|
236
|
+
"none",
|
|
237
|
+
"small",
|
|
238
|
+
"large"
|
|
103
239
|
]
|
|
104
240
|
},
|
|
241
|
+
"previewImage": {
|
|
242
|
+
"title": "Preview Image",
|
|
243
|
+
"type": "string",
|
|
244
|
+
"description": "A URL to an image preview for the search result."
|
|
245
|
+
},
|
|
246
|
+
"initialMatch": {
|
|
247
|
+
"title": "Initial Match",
|
|
248
|
+
"type": "string",
|
|
249
|
+
"description": "The initial search match or summary of the search result."
|
|
250
|
+
},
|
|
251
|
+
"matches": {
|
|
252
|
+
"title": "Matches",
|
|
253
|
+
"type": "array",
|
|
254
|
+
"description": "An array of search matches.",
|
|
255
|
+
"items": {
|
|
256
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
257
|
+
"$id": "http://schema.mydesignsystem.com/search-result-match.schema.json",
|
|
258
|
+
"title": "Search Result Match",
|
|
259
|
+
"type": "object",
|
|
260
|
+
"properties": {
|
|
261
|
+
"title": {
|
|
262
|
+
"title": "Title",
|
|
263
|
+
"type": "string",
|
|
264
|
+
"description": "The title of the match.",
|
|
265
|
+
"examples": [
|
|
266
|
+
"Panel Discussion: Ethics in AI"
|
|
267
|
+
]
|
|
268
|
+
},
|
|
269
|
+
"snippet": {
|
|
270
|
+
"title": "Text",
|
|
271
|
+
"type": "string",
|
|
272
|
+
"description": "The main content or description of the search result.",
|
|
273
|
+
"examples": [
|
|
274
|
+
"Experts debate the ethical challenges and responsibilities of deploying AI technologies."
|
|
275
|
+
]
|
|
276
|
+
},
|
|
277
|
+
"url": {
|
|
278
|
+
"title": "URL",
|
|
279
|
+
"type": "string",
|
|
280
|
+
"description": "A URL linking to the specific match or more information.",
|
|
281
|
+
"examples": [
|
|
282
|
+
"https://www.example.com/ai-conference-2023/panel-discussion"
|
|
283
|
+
]
|
|
284
|
+
}
|
|
285
|
+
},
|
|
286
|
+
"additionalProperties": false
|
|
287
|
+
}
|
|
288
|
+
},
|
|
105
289
|
"showLink": {
|
|
106
290
|
"title": "Show Link",
|
|
107
291
|
"type": "boolean",
|
|
108
292
|
"description": "Whether to display the link to the search result.",
|
|
109
293
|
"default": true
|
|
110
|
-
},
|
|
111
|
-
"ariaLabel": {
|
|
112
|
-
"title": "ARIA Label",
|
|
113
|
-
"type": "string",
|
|
114
|
-
"description": "An ARIA label for accessibility purposes.",
|
|
115
|
-
"examples": [
|
|
116
|
-
"Search result: Conference 2023"
|
|
117
|
-
]
|
|
118
294
|
}
|
|
119
295
|
},
|
|
120
296
|
"additionalProperties": false
|
|
@@ -4,6 +4,12 @@
|
|
|
4
4
|
"title": "Search",
|
|
5
5
|
"type": "object",
|
|
6
6
|
"properties": {
|
|
7
|
+
"headline": {
|
|
8
|
+
"$ref": "http://schema.mydesignsystem.com/headline.schema.json"
|
|
9
|
+
},
|
|
10
|
+
"searchBar": {
|
|
11
|
+
"$ref": "http://schema.mydesignsystem.com/search-bar.schema.json"
|
|
12
|
+
},
|
|
7
13
|
"searchFilter": {
|
|
8
14
|
"$ref": "http://schema.mydesignsystem.com/search-filter.schema.json"
|
|
9
15
|
},
|
|
@@ -1,33 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
|
|
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
|
-
/**
|
|
9
|
-
* Placeholder text for the search input field.
|
|
10
|
-
*/
|
|
11
|
-
type Placeholder = string;
|
|
12
|
-
interface SearchBarProps {
|
|
13
|
-
placeholder?: Placeholder;
|
|
14
|
-
/**
|
|
15
|
-
* Text displayed on the search button.
|
|
16
|
-
*/
|
|
17
|
-
buttonText?: string;
|
|
18
|
-
/**
|
|
19
|
-
* Additional information or instructions related to the search functionality.
|
|
20
|
-
*/
|
|
21
|
-
hint?: string;
|
|
22
|
-
/**
|
|
23
|
-
* Text to display when offering alternative results.
|
|
24
|
-
*/
|
|
25
|
-
alternativeText?: string;
|
|
26
|
-
/**
|
|
27
|
-
* The alternative result to display when offering suggestions.
|
|
28
|
-
*/
|
|
29
|
-
alternativeResult?: string;
|
|
30
|
-
}
|
|
2
|
+
import { SearchBarProps } from "../../SearchBarProps-26263244.js";
|
|
31
3
|
declare const SearchBarContextDefault: import("react").ForwardRefExoticComponent<SearchBarProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
32
4
|
declare const SearchBarContext: import("react").Context<import("react").ForwardRefExoticComponent<SearchBarProps & import("react").RefAttributes<HTMLDivElement>>>;
|
|
33
5
|
declare const SearchBar: import("react").ForwardRefExoticComponent<SearchBarProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -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", 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,25 @@
|
|
|
1
|
+
declare class SearchForm {
|
|
2
|
+
static identifier: string;
|
|
3
|
+
constructor(element: any);
|
|
4
|
+
lazyResults: WeakMap<object, any>;
|
|
5
|
+
resultsPerPage: number;
|
|
6
|
+
state: {
|
|
7
|
+
term: any;
|
|
8
|
+
page: any;
|
|
9
|
+
results: any;
|
|
10
|
+
};
|
|
11
|
+
loadEngine(): Promise<void>;
|
|
12
|
+
$searchInput: any;
|
|
13
|
+
$resultTemplate: any;
|
|
14
|
+
$subresultTemplate: any;
|
|
15
|
+
$paginationLinkTemplate: any;
|
|
16
|
+
$pagination: any;
|
|
17
|
+
$results: any;
|
|
18
|
+
$moreButton: any;
|
|
19
|
+
updateFromHash(): void;
|
|
20
|
+
renderResults(results: any): void;
|
|
21
|
+
onRadio(topic: any, fn: any): () => void;
|
|
22
|
+
on(element: any, type: any, fn: any): () => any;
|
|
23
|
+
$(selector: any, element?: any): any;
|
|
24
|
+
}
|
|
25
|
+
export { SearchForm as default };
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
import { define, Component } from '@kickstartds/core/lib/component';
|
|
2
|
+
import { events } from '@kickstartds/core/lib/core';
|
|
3
|
+
import { debounce } from '@kickstartds/core/lib/utils';
|
|
4
|
+
|
|
5
|
+
const parser = new DOMParser();
|
|
6
|
+
const renderPagination = ($pagination, $linkTemplate, totalPages, currentPageIndex, hrefPrefix) => {
|
|
7
|
+
const [$first, $prev, $pages, $next, $last] = $pagination.children;
|
|
8
|
+
$pages.textContent = "";
|
|
9
|
+
for (let i = 0; i < totalPages; i++) {
|
|
10
|
+
const $link = $linkTemplate.cloneNode(true);
|
|
11
|
+
$link.textContent = i + 1;
|
|
12
|
+
$link.href = hrefPrefix + (i + 1);
|
|
13
|
+
$link.setAttribute("aria-current", i === currentPageIndex ? "page" : "false");
|
|
14
|
+
$pages.appendChild($link);
|
|
15
|
+
}
|
|
16
|
+
$first.href = hrefPrefix + 1;
|
|
17
|
+
$prev.href = hrefPrefix + (currentPageIndex + 1 - 1);
|
|
18
|
+
$next.href = hrefPrefix + (currentPageIndex + 1 + 1);
|
|
19
|
+
$last.href = hrefPrefix + totalPages;
|
|
20
|
+
if (currentPageIndex === 0) {
|
|
21
|
+
$first.setAttribute("hidden", "");
|
|
22
|
+
$prev.setAttribute("hidden", "");
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
$first.removeAttribute("hidden", "");
|
|
26
|
+
$prev.removeAttribute("hidden", "");
|
|
27
|
+
}
|
|
28
|
+
if (currentPageIndex === totalPages - 1) {
|
|
29
|
+
$next.setAttribute("hidden", "");
|
|
30
|
+
$last.setAttribute("hidden", "");
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
$next.removeAttribute("hidden", "");
|
|
34
|
+
$last.removeAttribute("hidden", "");
|
|
35
|
+
}
|
|
36
|
+
$pagination.removeAttribute("hidden");
|
|
37
|
+
};
|
|
38
|
+
const renderMoreButton = ($button, totalResults) => {
|
|
39
|
+
$button.removeAttribute("hidden");
|
|
40
|
+
const $count = $button.children[0].children[0];
|
|
41
|
+
$count.textContent = totalResults;
|
|
42
|
+
};
|
|
43
|
+
const renderResult = (result, element) => {
|
|
44
|
+
const $ = element.querySelector.bind(element), $$ = element.querySelectorAll.bind(element);
|
|
45
|
+
if (result.title) {
|
|
46
|
+
const title = $("[data-result-title]");
|
|
47
|
+
if (title)
|
|
48
|
+
title.textContent = result.title;
|
|
49
|
+
}
|
|
50
|
+
if (result.excerpt) {
|
|
51
|
+
const doc = parser.parseFromString(result.excerpt, "text/html");
|
|
52
|
+
const excerpt = $("[data-result-excerpt]");
|
|
53
|
+
if (excerpt)
|
|
54
|
+
excerpt.replaceChildren(...doc.body.childNodes);
|
|
55
|
+
}
|
|
56
|
+
if (result.url) {
|
|
57
|
+
const url = $("[data-result-url]");
|
|
58
|
+
if (url)
|
|
59
|
+
url.textContent = result.url;
|
|
60
|
+
const links = $$("[data-result-link]");
|
|
61
|
+
for (const link of links) {
|
|
62
|
+
link.setAttribute("href", result.url);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
if (result.image) {
|
|
66
|
+
const image = $("[data-result-image]");
|
|
67
|
+
if (image)
|
|
68
|
+
image.src = result.image;
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
const limitSubResults = (subResults, limit) => {
|
|
72
|
+
if (subResults.length <= limit)
|
|
73
|
+
return subResults;
|
|
74
|
+
const topUrls = [...subResults]
|
|
75
|
+
.sort((a, b) => b.locations.length - a.locations.length)
|
|
76
|
+
.slice(0, limit)
|
|
77
|
+
.map((r) => r.url);
|
|
78
|
+
return subResults.filter((r) => topUrls.includes(r.url));
|
|
79
|
+
};
|
|
80
|
+
const parseNumber = (value, fallback) => {
|
|
81
|
+
const number = Number(value);
|
|
82
|
+
return isNaN(number) ? fallback : number;
|
|
83
|
+
};
|
|
84
|
+
const debouncedSearch = debounce((term) => window._ks.radio.emit("dsa.search.search", { term }), 300);
|
|
85
|
+
class SearchForm extends Component {
|
|
86
|
+
async loadEngine() {
|
|
87
|
+
throw new Error("please connect a search engine");
|
|
88
|
+
}
|
|
89
|
+
constructor(element) {
|
|
90
|
+
super(element);
|
|
91
|
+
this.lazyResults = new WeakMap();
|
|
92
|
+
this.resultsPerPage = 10;
|
|
93
|
+
this.state = {
|
|
94
|
+
term: undefined,
|
|
95
|
+
page: undefined,
|
|
96
|
+
results: undefined,
|
|
97
|
+
};
|
|
98
|
+
this.$searchInput = this.$(".dsa-search-bar__input");
|
|
99
|
+
this.$resultTemplate = this.$("[data-template=result]");
|
|
100
|
+
this.$subresultTemplate = this.$("[data-template=subresult]");
|
|
101
|
+
this.$paginationLinkTemplate = this.$("[data-template=pagination-link]");
|
|
102
|
+
this.$pagination = this.$(".dsa-pagination");
|
|
103
|
+
this.$results = this.$(".dsa-search-form__results");
|
|
104
|
+
this.$moreButton = this.$(".c-button");
|
|
105
|
+
const subResultsLimit = parseNumber(element.dataset.maxSubresults, 3);
|
|
106
|
+
this.resultsPerPage = parseNumber(element.dataset.resultsPerPage, 10);
|
|
107
|
+
this.on(this.$searchInput, "input", () => {
|
|
108
|
+
const term = this.$searchInput.value.trim();
|
|
109
|
+
if (term.length) {
|
|
110
|
+
debouncedSearch(term);
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
window._ks.radio.emit("dsa.search.reset");
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
this.on(element, "submit", (event) => {
|
|
117
|
+
event.preventDefault();
|
|
118
|
+
const url = new URL(element.getAttribute("action") || "", window.location);
|
|
119
|
+
const formData = new FormData(element);
|
|
120
|
+
url.hash = new URLSearchParams(formData);
|
|
121
|
+
window.location.href = url;
|
|
122
|
+
});
|
|
123
|
+
this.on(element, "reset", (event) => {
|
|
124
|
+
window._ks.radio.emit("dsa.search.reset");
|
|
125
|
+
});
|
|
126
|
+
this.on(window, "hashchange", () => {
|
|
127
|
+
this.updateFromHash();
|
|
128
|
+
});
|
|
129
|
+
this.onRadio(events.beforeunveil, async (_, el) => {
|
|
130
|
+
if (this.lazyResults.has(el)) {
|
|
131
|
+
const lazyResult = this.lazyResults.get(el);
|
|
132
|
+
const result = await lazyResult();
|
|
133
|
+
renderResult(result, el);
|
|
134
|
+
const $subResults = this.$("[data-result-subresults]", el);
|
|
135
|
+
const subResults = limitSubResults(result.subResults, subResultsLimit);
|
|
136
|
+
for (const subResult of subResults) {
|
|
137
|
+
const $subResultClone = this.$subresultTemplate.cloneNode(true);
|
|
138
|
+
$subResultClone.setAttribute("href", subResult.url);
|
|
139
|
+
renderResult(subResult, $subResultClone);
|
|
140
|
+
$subResults.appendChild($subResultClone);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
// init
|
|
145
|
+
this.loadEngine().then((search) => {
|
|
146
|
+
this.updateFromHash();
|
|
147
|
+
this.onRadio("dsa.search.reset", () => {
|
|
148
|
+
this.$results.textContent = "";
|
|
149
|
+
this.$pagination.setAttribute("hidden", "");
|
|
150
|
+
this.state = {};
|
|
151
|
+
});
|
|
152
|
+
this.onRadio("dsa.search.search", async (_, { term, page = 0 }) => {
|
|
153
|
+
window._ks.radio.emit("dsa.search.loading");
|
|
154
|
+
this.state.term = term;
|
|
155
|
+
this.state.page = page;
|
|
156
|
+
try {
|
|
157
|
+
this.state.results = await search(term);
|
|
158
|
+
window._ks.radio.emit("dsa.search.loaded");
|
|
159
|
+
}
|
|
160
|
+
catch (e) {
|
|
161
|
+
console.error(e);
|
|
162
|
+
window._ks.radio.emit("dsa.search.reset");
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
this.onRadio("dsa.search.loaded", () => {
|
|
166
|
+
if (this.state.results.length) {
|
|
167
|
+
const startIndex = this.state.page * this.resultsPerPage;
|
|
168
|
+
const endIndex = startIndex + this.resultsPerPage;
|
|
169
|
+
const results = this.state.results.slice(startIndex, endIndex);
|
|
170
|
+
this.renderResults(results);
|
|
171
|
+
if (this.element.hasAttribute("action")) {
|
|
172
|
+
renderMoreButton(this.$moreButton, this.state.results.length);
|
|
173
|
+
}
|
|
174
|
+
else {
|
|
175
|
+
renderPagination(this.$pagination, this.$paginationLinkTemplate, Math.ceil(this.state.results.length / this.resultsPerPage), this.state.page, `#q=${this.state.term}&page=`);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
this.onRadio("dsa.search.goToPage", (_, page) => {
|
|
180
|
+
this.state.page = page;
|
|
181
|
+
window._ks.radio.emit("dsa.search.loaded");
|
|
182
|
+
});
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
updateFromHash() {
|
|
186
|
+
const params = new URLSearchParams(window.location.hash.slice(1));
|
|
187
|
+
if (params.has("q")) {
|
|
188
|
+
const term = params.get("q");
|
|
189
|
+
const page = params.has("page") ? Number(params.get("page")) - 1 : 0;
|
|
190
|
+
this.$searchInput.value = term;
|
|
191
|
+
if (term) {
|
|
192
|
+
if (term !== this.state.term) {
|
|
193
|
+
window._ks.radio.emit("dsa.search.search", { term, page });
|
|
194
|
+
}
|
|
195
|
+
else if (page !== this.state.page) {
|
|
196
|
+
window._ks.radio.emit("dsa.search.goToPage", page);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
renderResults(results) {
|
|
202
|
+
this.$results.textContent = "";
|
|
203
|
+
for (const result of results) {
|
|
204
|
+
const $resultClone = this.$resultTemplate.cloneNode(true);
|
|
205
|
+
this.lazyResults.set($resultClone, result);
|
|
206
|
+
this.$results.appendChild($resultClone);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
onRadio(topic, fn) {
|
|
210
|
+
const token = window._ks.radio.on(topic, fn);
|
|
211
|
+
const cleanUp = () => window._ks.radio.off(token);
|
|
212
|
+
this.onDisconnect(cleanUp);
|
|
213
|
+
return cleanUp;
|
|
214
|
+
}
|
|
215
|
+
on(element, type, fn) {
|
|
216
|
+
const cleanUp = () => element.removeventListener(type, fn);
|
|
217
|
+
element.addEventListener(type, fn);
|
|
218
|
+
this.onDisconnect(cleanUp);
|
|
219
|
+
return cleanUp;
|
|
220
|
+
}
|
|
221
|
+
$(selector, element = this.element) {
|
|
222
|
+
return element.querySelector(selector);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
SearchForm.identifier = "dsa.search-form";
|
|
226
|
+
define(SearchForm.identifier, SearchForm);
|
|
227
|
+
|
|
228
|
+
export { SearchForm as default };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { define } from '@kickstartds/core/lib/component';
|
|
2
|
+
import SearchForm from './SearchForm.client.js';
|
|
3
|
+
import '@kickstartds/core/lib/core';
|
|
4
|
+
import '@kickstartds/core/lib/utils';
|
|
5
|
+
|
|
6
|
+
const staticPageFindPath = "/pagefind/pagefind.js";
|
|
7
|
+
const pagefindResult2searchResult = ({ sub_results, ...result }) => {
|
|
8
|
+
const hasRootSubResult = sub_results?.[0]?.url === (result.meta.url || result.url);
|
|
9
|
+
const subResults = hasRootSubResult
|
|
10
|
+
? sub_results.slice(1)
|
|
11
|
+
: sub_results || [];
|
|
12
|
+
return {
|
|
13
|
+
title: result.meta.title,
|
|
14
|
+
url: result.meta.url || result.url,
|
|
15
|
+
excerpt: result.excerpt,
|
|
16
|
+
image: result.meta.image,
|
|
17
|
+
subResults: subResults.map((subResult) => ({
|
|
18
|
+
title: subResult.title,
|
|
19
|
+
url: subResult.url,
|
|
20
|
+
excerpt: subResult.excerpt,
|
|
21
|
+
locations: subResult.locations,
|
|
22
|
+
})),
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
class SearchFormPagefind extends SearchForm {
|
|
26
|
+
async loadEngine() {
|
|
27
|
+
const pagefind = await import(/* @vite-ignore */ staticPageFindPath);
|
|
28
|
+
await pagefind.init();
|
|
29
|
+
return async function search(term) {
|
|
30
|
+
const search = await pagefind.search(term);
|
|
31
|
+
if (search) {
|
|
32
|
+
return search.results.map((result) => () => result.data().then(pagefindResult2searchResult));
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
SearchFormPagefind.identifier = "dsa.search-form.pagefind";
|
|
38
|
+
define(SearchFormPagefind.identifier, SearchFormPagefind);
|
|
39
|
+
|
|
40
|
+
export { SearchFormPagefind as default };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import "./search-form.css";
|
|
2
|
+
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
3
|
+
import classnames from 'classnames';
|
|
4
|
+
import { Button } from '@kickstartds/base/lib/button';
|
|
5
|
+
import { SearchBar } from '../search-bar/index.js';
|
|
6
|
+
import { SearchResult } from '../search-result/index.js';
|
|
7
|
+
import { SearchResultMatch } from '../search-result-match/index.js';
|
|
8
|
+
import { PageLink, Pagination } from '../pagination/index.js';
|
|
9
|
+
import './SearchForm.client.js';
|
|
10
|
+
import 'react';
|
|
11
|
+
import '@kickstartds/form/lib/text-field';
|
|
12
|
+
import 'markdown-to-jsx';
|
|
13
|
+
import '@kickstartds/base/lib/icon';
|
|
14
|
+
import '@kickstartds/base/lib/link';
|
|
15
|
+
import '../../helpers-12f48df8.js';
|
|
16
|
+
import '@kickstartds/base/lib/rich-text';
|
|
17
|
+
import '@kickstartds/base/lib/picture';
|
|
18
|
+
import '@kickstartds/core/lib/container';
|
|
19
|
+
import '@kickstartds/core/lib/component';
|
|
20
|
+
import '@kickstartds/core/lib/core';
|
|
21
|
+
import '@kickstartds/core/lib/utils';
|
|
22
|
+
|
|
23
|
+
const SearchForm = ({ className, component = "dsa.search-form", result = {}, resultPerPage, moreButtonLabel = "View all results", ...props }) => (jsxs("form", { className: classnames("dsa-search-form", className), "ks-component": component, "data-max-subresults": result.maxSubresults, "data-results-per-page": resultPerPage, ...props, children: [jsx(SearchBar, { alternativeText: "", alternativeResult: "", hint: "" }), jsxs("div", { hidden: true, children: [jsx("li", { "data-template": "result", className: "lazyload", children: jsx(SearchResult, { showLink: result.showLink, imageColSize: result.imageColSize }) }), jsx(SearchResultMatch, { "data-template": "subresult" }), jsx(PageLink, { "data-template": "pagination-link" })] }), jsx("ol", { className: "dsa-search-form__results" }), jsxs("div", { className: "dsa-search-form__nav", children: [jsx(Pagination, { hidden: true }), jsx(Button, { variant: "primary", hidden: true, label: moreButtonLabel, type: "submit", renderLabel: (label) => (jsxs(Fragment, { children: [label, " (", jsx("span", {}), ")"] })) })] })] }));
|
|
24
|
+
|
|
25
|
+
export { SearchForm };
|