@salesforcedevs/dx-components 0.26.1-alpha0.6 → 0.27.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/LICENSE +12 -0
- package/lwc.config.json +2 -1
- package/package.json +3 -9
- package/src/assets/icons/action-sprite/svg/symbols.svg +1 -0
- package/src/assets/icons/brand-sprite/svg/symbols.svg +1381 -0
- package/src/assets/icons/custom-sprite/svg/symbols.svg +1 -0
- package/src/assets/icons/doctype-sprite/svg/symbols.svg +1 -0
- package/src/assets/icons/general-sprite/svg/symbols.svg +3013 -0
- package/src/assets/icons/salesforcebrand-sprite/svg/symbols.svg +257 -0
- package/src/assets/icons/standard-sprite/svg/symbols.svg +1 -0
- package/src/assets/icons/utility-sprite/svg/symbols.svg +1 -0
- package/src/assets/svg/card-news-learn-moar.svg +415 -0
- package/src/assets/svg/cloud-1.svg +24 -0
- package/src/assets/svg/cloud-2.svg +18 -0
- package/src/assets/svg/codey.svg +93 -0
- package/src/assets/svg/command.svg +9 -0
- package/src/assets/svg/control.svg +10 -0
- package/src/assets/svg/docs-empty-state-small.svg +72 -0
- package/src/assets/svg/docs-empty-state.svg +86 -0
- package/src/assets/svg/dsc-home-news-bear.svg +3 -0
- package/src/assets/svg/dsc-home-news-community.png +0 -0
- package/src/assets/svg/dsc-home-news-goatbear.svg +257 -0
- package/src/assets/svg/dsc-home-news-samplegallery.svg +76 -0
- package/src/assets/svg/empty-state-assistant.svg +1 -0
- package/src/assets/svg/fch-blog-cloud-1.png +0 -0
- package/src/assets/svg/fch-blog-cloud-2.png +0 -0
- package/src/assets/svg/fch-blog-planet.png +0 -0
- package/src/assets/svg/feature-backdrop1.svg +10 -0
- package/src/assets/svg/feature-backdrop2.svg +10 -0
- package/src/assets/svg/featured-demo-art-blank.svg +76 -0
- package/src/assets/svg/featured-demo-art-eBikes.svg +77 -0
- package/src/assets/svg/footer-graphic-large.svg +207 -0
- package/src/assets/svg/footer-graphic-mountains-small.svg +17 -0
- package/src/assets/svg/footer-graphic-mountains.svg +21 -0
- package/src/assets/svg/footer-graphic-trees-small.svg +33 -0
- package/src/assets/svg/footer-graphic-trees.svg +62 -0
- package/src/assets/svg/lake-mountain.svg +79 -0
- package/src/assets/svg/podcast-subscription-clouds-small.svg +49 -0
- package/src/assets/svg/podcast-subscription-clouds.svg +57 -0
- package/src/assets/svg/podcasts-subscription-apple.svg +164 -0
- package/src/assets/svg/podcasts-subscription-google.svg +29 -0
- package/src/assets/svg/podcasts-subscription-spotify.svg +11 -0
- package/src/assets/svg/salesforce-cloud.svg +7 -0
- package/src/assets/svg/salesforce-logo-corporate.svg +21 -0
- package/src/assets/svg/salesforce-logo.svg +14 -0
- package/src/assets/svg/sidebar-loading.svg +34 -0
- package/src/assets/svg/slack-cta-podcast-background-left.svg +28 -0
- package/src/assets/svg/slack-cta-podcast-background-right.svg +38 -0
- package/src/assets/svg/trees.svg +42 -0
- package/src/modules/base-elements/archiveCard/archiveCard.ts +35 -0
- package/src/modules/base-elements/headerBase/headerBase.ts +204 -0
- package/src/modules/dx/banner/banner.css +46 -0
- package/src/modules/dx/banner/banner.html +13 -0
- package/src/modules/dx/banner/banner.ts +14 -0
- package/src/modules/dx/brandThemeProvider/brandCssVars.ts +10 -0
- package/src/modules/dx/brandThemeProvider/brandThemeProvider.html +3 -0
- package/src/modules/dx/brandThemeProvider/brandThemeProvider.ts +46 -0
- package/src/modules/dx/breadcrumbs/breadcrumbs.css +111 -0
- package/src/modules/dx/breadcrumbs/breadcrumbs.html +44 -0
- package/src/modules/dx/breadcrumbs/breadcrumbs.ts +122 -0
- package/src/modules/dx/button/button.css +175 -0
- package/src/modules/dx/button/button.html +43 -0
- package/src/modules/dx/button/button.ts +63 -0
- package/src/modules/dx/cardBlogPost/cardBlogPost.css +13 -0
- package/src/modules/dx/cardBlogPost/cardBlogPost.html +24 -0
- package/src/modules/dx/cardBlogPost/cardBlogPost.ts +23 -0
- package/src/modules/dx/cardBlogPostProvider/cardBlogPostProvider.css +3 -0
- package/src/modules/dx/cardBlogPostProvider/cardBlogPostProvider.html +16 -0
- package/src/modules/dx/cardBlogPostProvider/cardBlogPostProvider.ts +29 -0
- package/src/modules/dx/cardCallout/cardCallout.css +57 -0
- package/src/modules/dx/cardCallout/cardCallout.html +15 -0
- package/src/modules/dx/cardCallout/cardCallout.ts +37 -0
- package/src/modules/dx/cardContent/cardContent.css +52 -0
- package/src/modules/dx/cardContent/cardContent.html +59 -0
- package/src/modules/dx/cardContent/cardContent.ts +68 -0
- package/src/modules/dx/cardDemo/cardDemo.css +1 -0
- package/src/modules/dx/cardDemo/cardDemo.html +12 -0
- package/src/modules/dx/cardDemo/cardDemo.ts +11 -0
- package/src/modules/dx/cardDocs/cardDocs.css +50 -0
- package/src/modules/dx/cardDocs/cardDocs.html +20 -0
- package/src/modules/dx/cardDocs/cardDocs.ts +30 -0
- package/src/modules/dx/cardEvent/cardEvent.css +107 -0
- package/src/modules/dx/cardEvent/cardEvent.html +94 -0
- package/src/modules/dx/cardEvent/cardEvent.ts +42 -0
- package/src/modules/dx/cardExpanded/cardExpanded.css +49 -0
- package/src/modules/dx/cardExpanded/cardExpanded.html +37 -0
- package/src/modules/dx/cardExpanded/cardExpanded.ts +45 -0
- package/src/modules/dx/cardGrid/cardGrid.css +89 -0
- package/src/modules/dx/cardGrid/cardGrid.html +46 -0
- package/src/modules/dx/cardGrid/cardGrid.ts +140 -0
- package/src/modules/dx/cardMinimal/cardMinimal.css +31 -0
- package/src/modules/dx/cardMinimal/cardMinimal.html +13 -0
- package/src/modules/dx/cardMinimal/cardMinimal.ts +3 -0
- package/src/modules/dx/cardNews/cardNews.css +159 -0
- package/src/modules/dx/cardNews/cardNews.html +37 -0
- package/src/modules/dx/cardNews/cardNews.ts +62 -0
- package/src/modules/dx/cardPodcastEpisode/cardPodcastEpisode.css +19 -0
- package/src/modules/dx/cardPodcastEpisode/cardPodcastEpisode.html +36 -0
- package/src/modules/dx/cardPodcastEpisode/cardPodcastEpisode.ts +36 -0
- package/src/modules/dx/cardPodcastEpisodeProvider/cardPodcastEpisodeProvider.css +3 -0
- package/src/modules/dx/cardPodcastEpisodeProvider/cardPodcastEpisodeProvider.html +12 -0
- package/src/modules/dx/cardPodcastEpisodeProvider/cardPodcastEpisodeProvider.ts +29 -0
- package/src/modules/dx/cardSmall/cardSmall.css +32 -0
- package/src/modules/dx/cardSmall/cardSmall.html +42 -0
- package/src/modules/dx/cardSmall/cardSmall.ts +38 -0
- package/src/modules/dx/cardTitle/cardTitle.css +41 -0
- package/src/modules/dx/cardTitle/cardTitle.html +20 -0
- package/src/modules/dx/cardTitle/cardTitle.ts +27 -0
- package/src/modules/dx/cardTrailheadModule/cardTrailheadModule.css +24 -0
- package/src/modules/dx/cardTrailheadModule/cardTrailheadModule.html +20 -0
- package/src/modules/dx/cardTrailheadModule/cardTrailheadModule.ts +18 -0
- package/src/modules/dx/cardVideoPreview/cardVideoPreview.css +14 -0
- package/src/modules/dx/cardVideoPreview/cardVideoPreview.html +26 -0
- package/src/modules/dx/cardVideoPreview/cardVideoPreview.ts +13 -0
- package/src/modules/dx/checkbox/checkbox.css +168 -0
- package/src/modules/dx/checkbox/checkbox.html +26 -0
- package/src/modules/dx/checkbox/checkbox.ts +55 -0
- package/src/modules/dx/checkboxGroup/checkboxGroup.css +12 -0
- package/src/modules/dx/checkboxGroup/checkboxGroup.html +15 -0
- package/src/modules/dx/checkboxGroup/checkboxGroup.ts +77 -0
- package/src/modules/dx/codeBlock/codeBlock.css +128 -0
- package/src/modules/dx/codeBlock/codeBlock.html +79 -0
- package/src/modules/dx/codeBlock/codeBlock.ts +215 -0
- package/src/modules/dx/codeBlock/darkTheme.css +88 -0
- package/src/modules/dx/codeBlock/lightTheme.css +72 -0
- package/src/modules/dx/dropdown/dropdown.css +93 -0
- package/src/modules/dx/dropdown/dropdown.html +67 -0
- package/src/modules/dx/dropdown/dropdown.ts +182 -0
- package/src/modules/dx/dropdownOption/dropdownOption.css +61 -0
- package/src/modules/dx/dropdownOption/dropdownOption.html +53 -0
- package/src/modules/dx/dropdownOption/dropdownOption.ts +39 -0
- package/src/modules/dx/emptyState/emptyState.css +64 -0
- package/src/modules/dx/emptyState/emptyState.html +9 -0
- package/src/modules/dx/emptyState/emptyState.ts +20 -0
- package/src/modules/dx/feature/feature.css +135 -0
- package/src/modules/dx/feature/feature.html +33 -0
- package/src/modules/dx/feature/feature.ts +34 -0
- package/src/modules/dx/featureGrid/featureGrid.html +3 -0
- package/src/modules/dx/featureGrid/featureGrid.ts +15 -0
- package/src/modules/dx/featuredContentHeader/featuredContentHeader.css +469 -0
- package/src/modules/dx/featuredContentHeader/featuredContentHeader.html +96 -0
- package/src/modules/dx/featuredContentHeader/featuredContentHeader.ts +113 -0
- package/src/modules/dx/featuredContentHeader/svgs.ts +35 -0
- package/src/modules/dx/featuresList/featuresList.css +24 -0
- package/src/modules/dx/featuresList/featuresList.html +20 -0
- package/src/modules/dx/featuresList/featuresList.ts +21 -0
- package/src/modules/dx/footer/footer.css +405 -0
- package/src/modules/dx/footer/footer.html +145 -0
- package/src/modules/dx/footer/footer.ts +124 -0
- package/src/modules/dx/footer/links.ts +140 -0
- package/src/modules/dx/footerOption/footerOption.css +4 -0
- package/src/modules/dx/footerOption/footerOption.html +12 -0
- package/src/modules/dx/footerOption/footerOption.ts +19 -0
- package/src/modules/dx/formattedDateTime/formattedDateTime.html +1 -0
- package/src/modules/dx/formattedDateTime/formattedDateTime.ts +72 -0
- package/src/modules/dx/grid/grid.css +48 -0
- package/src/modules/dx/grid/grid.html +3 -0
- package/src/modules/dx/grid/grid.md +14 -0
- package/src/modules/dx/grid/grid.ts +72 -0
- package/src/modules/dx/groupBio/groupBio.css +49 -0
- package/src/modules/dx/groupBio/groupBio.html +29 -0
- package/src/modules/dx/groupBio/groupBio.ts +41 -0
- package/src/modules/dx/groupText/groupText.css +119 -0
- package/src/modules/dx/groupText/groupText.html +65 -0
- package/src/modules/dx/groupText/groupText.ts +93 -0
- package/src/modules/dx/headTags/headTags.html +3 -0
- package/src/modules/dx/headTags/headTags.ts +39 -0
- package/src/modules/dx/header/__benchmarks__/header.benchmark.js +45 -0
- package/src/modules/dx/header/header.css +109 -0
- package/src/modules/dx/header/header.html +129 -0
- package/src/modules/dx/header/header.ts +27 -0
- package/src/modules/dx/headerMobileNavMenu/headerMobileNavMenu.css +160 -0
- package/src/modules/dx/headerMobileNavMenu/headerMobileNavMenu.html +73 -0
- package/src/modules/dx/headerMobileNavMenu/headerMobileNavMenu.ts +102 -0
- package/src/modules/dx/headerMobileNavMenuOption/headerMobileNavMenuOption.css +5 -0
- package/src/modules/dx/headerMobileNavMenuOption/headerMobileNavMenuOption.html +14 -0
- package/src/modules/dx/headerMobileNavMenuOption/headerMobileNavMenuOption.ts +20 -0
- package/src/modules/dx/headerNav/headerNav.css +31 -0
- package/src/modules/dx/headerNav/headerNav.html +48 -0
- package/src/modules/dx/headerNav/headerNav.ts +56 -0
- package/src/modules/dx/headerSearch/headerSearch.css +62 -0
- package/src/modules/dx/headerSearch/headerSearch.html +64 -0
- package/src/modules/dx/headerSearch/headerSearch.ts +159 -0
- package/src/modules/dx/helmet/helmet.css +83 -0
- package/src/modules/dx/helmet/helmet.html +39 -0
- package/src/modules/dx/helmet/helmet.ts +27 -0
- package/src/modules/dx/hr/hr.css +55 -0
- package/src/modules/dx/hr/hr.html +23 -0
- package/src/modules/dx/hr/hr.ts +45 -0
- package/src/modules/dx/icon/icon.css +14 -0
- package/src/modules/dx/icon/icon.html +11 -0
- package/src/modules/dx/icon/icon.ts +85 -0
- package/src/modules/dx/iconBadge/iconBadge.css +40 -0
- package/src/modules/dx/iconBadge/iconBadge.html +10 -0
- package/src/modules/dx/iconBadge/iconBadge.ts +42 -0
- package/src/modules/dx/imageAndLabel/imageAndLabel.css +54 -0
- package/src/modules/dx/imageAndLabel/imageAndLabel.html +22 -0
- package/src/modules/dx/imageAndLabel/imageAndLabel.ts +16 -0
- package/src/modules/dx/input/input.css +165 -0
- package/src/modules/dx/input/input.html +58 -0
- package/src/modules/dx/input/input.ts +238 -0
- package/src/modules/dx/input/validators.ts +5 -0
- package/src/modules/dx/instrumentation/instrumentation.html +1 -0
- package/src/modules/dx/instrumentation/instrumentation.ts +116 -0
- package/src/modules/dx/interactiveImage/interactiveImage.css +59 -0
- package/src/modules/dx/interactiveImage/interactiveImage.html +32 -0
- package/src/modules/dx/interactiveImage/interactiveImage.ts +71 -0
- package/src/modules/dx/lazy/lazy.html +5 -0
- package/src/modules/dx/lazy/lazy.ts +163 -0
- package/src/modules/dx/logo/logo.css +33 -0
- package/src/modules/dx/logo/logo.html +6 -0
- package/src/modules/dx/logo/logo.ts +8 -0
- package/src/modules/dx/modalDrawer/modalDrawer.css +40 -0
- package/src/modules/dx/modalDrawer/modalDrawer.html +11 -0
- package/src/modules/dx/modalDrawer/modalDrawer.ts +27 -0
- package/src/modules/dx/newsletterForm/newsletterForm.css +73 -0
- package/src/modules/dx/newsletterForm/newsletterForm.html +73 -0
- package/src/modules/dx/newsletterForm/newsletterForm.ts +238 -0
- package/src/modules/dx/pagination/pagination.css +51 -0
- package/src/modules/dx/pagination/pagination.html +45 -0
- package/src/modules/dx/pagination/pagination.ts +93 -0
- package/src/modules/dx/podcastHost/podcastHost.css +62 -0
- package/src/modules/dx/podcastHost/podcastHost.html +28 -0
- package/src/modules/dx/podcastHost/podcastHost.ts +13 -0
- package/src/modules/dx/podcastPlayer/podcastPlayer.css +10 -0
- package/src/modules/dx/podcastPlayer/podcastPlayer.html +3 -0
- package/src/modules/dx/podcastPlayer/podcastPlayer.ts +5 -0
- package/src/modules/dx/podcastSubscription/podcastSubscription.css +91 -0
- package/src/modules/dx/podcastSubscription/podcastSubscription.html +24 -0
- package/src/modules/dx/podcastSubscription/podcastSubscription.ts +58 -0
- package/src/modules/dx/popover/popover.css +63 -0
- package/src/modules/dx/popover/popover.html +16 -0
- package/src/modules/dx/popover/popover.ts +313 -0
- package/src/modules/dx/radioGroup/radioGroup.css +12 -0
- package/src/modules/dx/radioGroup/radioGroup.html +16 -0
- package/src/modules/dx/radioGroup/radioGroup.ts +65 -0
- package/src/modules/dx/relativeDateTime/relativeDateTime.html +3 -0
- package/src/modules/dx/relativeDateTime/relativeDateTime.ts +113 -0
- package/src/modules/dx/searchResults/coveo.css +18989 -0
- package/src/modules/dx/searchResults/searchResults.css +387 -0
- package/src/modules/dx/searchResults/searchResults.html +104 -0
- package/src/modules/dx/searchResults/searchResults.ts +186 -0
- package/src/modules/dx/section/section.css +130 -0
- package/src/modules/dx/section/section.html +66 -0
- package/src/modules/dx/section/section.ts +41 -0
- package/src/modules/dx/sectionSignup/sectionSignup.css +43 -0
- package/src/modules/dx/sectionSignup/sectionSignup.html +23 -0
- package/src/modules/dx/sectionSignup/sectionSignup.ts +44 -0
- package/src/modules/dx/select/select.css +44 -0
- package/src/modules/dx/select/select.html +60 -0
- package/src/modules/dx/select/select.ts +23 -0
- package/src/modules/dx/sidebar/sidebar.css +192 -0
- package/src/modules/dx/sidebar/sidebar.html +94 -0
- package/src/modules/dx/sidebar/sidebar.ts +255 -0
- package/src/modules/dx/sidebarOld/sidebarOld.css +160 -0
- package/src/modules/dx/sidebarOld/sidebarOld.html +70 -0
- package/src/modules/dx/sidebarOld/sidebarOld.ts +187 -0
- package/src/modules/dx/sidebarSearch/sidebarSearch.css +3 -0
- package/src/modules/dx/sidebarSearch/sidebarSearch.html +26 -0
- package/src/modules/dx/sidebarSearch/sidebarSearch.ts +437 -0
- package/src/modules/dx/sidebarSearchResult/sidebarSearchResult.css +36 -0
- package/src/modules/dx/sidebarSearchResult/sidebarSearchResult.html +14 -0
- package/src/modules/dx/sidebarSearchResult/sidebarSearchResult.ts +70 -0
- package/src/modules/dx/skipNavLink/skipNavLink.css +21 -0
- package/src/modules/dx/skipNavLink/skipNavLink.html +3 -0
- package/src/modules/dx/skipNavLink/skipNavLink.ts +3 -0
- package/src/modules/dx/slackCta/slackCta.css +47 -0
- package/src/modules/dx/slackCta/slackCta.html +17 -0
- package/src/modules/dx/slackCta/slackCta.ts +12 -0
- package/src/modules/dx/socials/socials.css +35 -0
- package/src/modules/dx/socials/socials.html +22 -0
- package/src/modules/dx/socials/socials.ts +81 -0
- package/src/modules/dx/spinner/spinner.css +750 -0
- package/src/modules/dx/spinner/spinner.html +6 -0
- package/src/modules/dx/spinner/spinner.ts +20 -0
- package/src/modules/dx/tab/tab.css +106 -0
- package/src/modules/dx/tab/tab.html +13 -0
- package/src/modules/dx/tab/tab.ts +52 -0
- package/src/modules/dx/toc/toc.css +94 -0
- package/src/modules/dx/toc/toc.html +28 -0
- package/src/modules/dx/toc/toc.ts +77 -0
- package/src/modules/dx/tooltip/microtip.css +269 -0
- package/src/modules/dx/tooltip/tooltip.css +36 -0
- package/src/modules/dx/tooltip/tooltip.html +5 -0
- package/src/modules/dx/tooltip/tooltip.ts +6 -0
- package/src/modules/dx/topics/topics.css +25 -0
- package/src/modules/dx/topics/topics.html +12 -0
- package/src/modules/dx/topics/topics.ts +25 -0
- package/src/modules/dx/tree/tree.css +5 -0
- package/src/modules/dx/tree/tree.html +11 -0
- package/src/modules/dx/tree/tree.ts +72 -0
- package/src/modules/dx/tree/treeHandler.ts +100 -0
- package/src/modules/dx/treeItem/treeItem.css +14 -0
- package/src/modules/dx/treeItem/treeItem.html +22 -0
- package/src/modules/dx/treeItem/treeItem.ts +110 -0
- package/src/modules/dx/treeTile/treeTile.css +190 -0
- package/src/modules/dx/treeTile/treeTile.html +27 -0
- package/src/modules/dx/treeTile/treeTile.ts +59 -0
- package/src/modules/dx/typeBadge/typeBadge.css +74 -0
- package/src/modules/dx/typeBadge/typeBadge.html +5 -0
- package/src/modules/dx/typeBadge/typeBadge.ts +65 -0
- package/src/modules/dx/typeBadgeGroup/typeBadgeGroup.css +12 -0
- package/src/modules/dx/typeBadgeGroup/typeBadgeGroup.html +11 -0
- package/src/modules/dx/typeBadgeGroup/typeBadgeGroup.ts +18 -0
- package/src/modules/helpers/animations/animations.css +15 -0
- package/src/modules/helpers/button/button.css +4 -0
- package/src/modules/helpers/card/card.css +258 -0
- package/src/modules/helpers/code/code.css +296 -0
- package/src/modules/helpers/commonHeader/commonHeader.css +130 -0
- package/src/modules/helpers/reset/reset.css +559 -0
- package/src/modules/helpers/sidebar/sidebar.css +21 -0
- package/src/modules/helpers/slds/slds.css +191 -0
- package/src/modules/helpers/table/table.css +110 -0
- package/src/modules/helpers/text/text.css +163 -0
- package/src/modules/utils/coveo/coveo.ts +70 -0
- package/src/modules/utils/css/css.ts +43 -0
- package/src/modules/utils/devices/devices.ts +1 -0
- package/src/modules/utils/highlight/highlight.ts +32 -0
- package/src/modules/utils/normalizers/normalizers.ts +91 -0
- package/src/modules/utils/options/options.ts +39 -0
- package/src/modules/utils/prismjs/prismjs.html +3 -0
- package/src/modules/utils/prismjs/prismjs.ts +3321 -0
- package/src/modules/utils/recentSearches/recentSearches.ts +57 -0
- package/src/modules/utils/regexps/regexps.ts +5 -0
- package/src/modules/utils/seo/seo.ts +4 -0
- package/src/modules/utils/slot/slot.ts +17 -0
- package/src/modules/utils/wordpress/wordpress.ts +13 -0
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<nav
|
|
3
|
+
aria-label="Navigation Menu"
|
|
4
|
+
class={className}
|
|
5
|
+
role="navigation"
|
|
6
|
+
onscroll={onScroll}
|
|
7
|
+
>
|
|
8
|
+
<ul>
|
|
9
|
+
<template for:each={navItems} for:item="navItem">
|
|
10
|
+
<li
|
|
11
|
+
class={navItem.liClassName}
|
|
12
|
+
key={navItem.id}
|
|
13
|
+
aria-expanded={navItem.open}
|
|
14
|
+
data-id={navItem.id}
|
|
15
|
+
>
|
|
16
|
+
<!-- NAV ITEM [WITHOUT OPTIONS] -->
|
|
17
|
+
<a
|
|
18
|
+
class={navItem.className}
|
|
19
|
+
href={navItem.link.href}
|
|
20
|
+
if:false={navItem.options}
|
|
21
|
+
onclick={onClickLink}
|
|
22
|
+
>
|
|
23
|
+
<span>{navItem.label}</span>
|
|
24
|
+
</a>
|
|
25
|
+
|
|
26
|
+
<!-- NAV ITEM [WITH OPTIONS] -->
|
|
27
|
+
<button
|
|
28
|
+
aria-label="Toggle accordian open"
|
|
29
|
+
class="nav-menu_item_cta nav-menu_item_cta-main"
|
|
30
|
+
data-id={navItem.id}
|
|
31
|
+
if:true={navItem.options}
|
|
32
|
+
onclick={onChange}
|
|
33
|
+
>
|
|
34
|
+
<span>{navItem.label}</span>
|
|
35
|
+
<dx-icon
|
|
36
|
+
class="chevrondown"
|
|
37
|
+
symbol="chevrondown"
|
|
38
|
+
size="medium"
|
|
39
|
+
></dx-icon>
|
|
40
|
+
</button>
|
|
41
|
+
<template if:true={navItem.options}>
|
|
42
|
+
<template for:each={navItem.options} for:item="options">
|
|
43
|
+
<div
|
|
44
|
+
class="nav-menu_item_cta-options"
|
|
45
|
+
key={options.id}
|
|
46
|
+
>
|
|
47
|
+
<template if:true={options.options}>
|
|
48
|
+
<template
|
|
49
|
+
for:each={options.options}
|
|
50
|
+
for:item="navSubItem"
|
|
51
|
+
>
|
|
52
|
+
<dx-header-mobile-nav-menu-option
|
|
53
|
+
key={navSubItem.id}
|
|
54
|
+
href={navSubItem.link.href}
|
|
55
|
+
class-name={navSubItem.className}
|
|
56
|
+
icon-symbol={navSubItem.iconSymbol}
|
|
57
|
+
menu-label={navItem.label}
|
|
58
|
+
item-label={navSubItem.label}
|
|
59
|
+
onclick={onClickLink}
|
|
60
|
+
target={navSubItem.link.target}
|
|
61
|
+
></dx-header-mobile-nav-menu-option>
|
|
62
|
+
</template>
|
|
63
|
+
</template>
|
|
64
|
+
</div>
|
|
65
|
+
</template>
|
|
66
|
+
</template>
|
|
67
|
+
</li>
|
|
68
|
+
</template>
|
|
69
|
+
</ul>
|
|
70
|
+
<slot></slot>
|
|
71
|
+
</nav>
|
|
72
|
+
<div class="backdrop" if:true={open} onclick={onClickBackground}></div>
|
|
73
|
+
</template>
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { LightningElement, api } from "lwc";
|
|
2
|
+
import cx from "classnames";
|
|
3
|
+
import { Option } from "typings/custom";
|
|
4
|
+
import { deepmapOptions } from "utils/options";
|
|
5
|
+
|
|
6
|
+
export default class HeaderMobileNavMenu extends LightningElement {
|
|
7
|
+
@api open: boolean = false;
|
|
8
|
+
@api value: string | null = null;
|
|
9
|
+
@api pathname: string | null = null;
|
|
10
|
+
|
|
11
|
+
@api
|
|
12
|
+
set navItems(_navItems: Option[]) {
|
|
13
|
+
this._navItems = _navItems;
|
|
14
|
+
}
|
|
15
|
+
get navItems() {
|
|
16
|
+
// first we assign container classnames to the topmost layer of options groupings
|
|
17
|
+
// (deepmapper only affects actual root options, not groups of options made for the purposes of labeling)
|
|
18
|
+
const navItems = this._navItems?.map((app) => {
|
|
19
|
+
const open = app.options ? app.id === this.value : null;
|
|
20
|
+
const liClassName = cx("nav-menu_item", open && "state-open");
|
|
21
|
+
return { ...app, open, liClassName };
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
// then we use deepmapper to affect the actual root options (actual links)
|
|
25
|
+
return deepmapOptions(
|
|
26
|
+
navItems,
|
|
27
|
+
(app: Option, index: number, level: number) => {
|
|
28
|
+
const active = app.link
|
|
29
|
+
? app.link.href === this.pathname
|
|
30
|
+
: false;
|
|
31
|
+
const className = cx(
|
|
32
|
+
"nav-menu_item_cta",
|
|
33
|
+
active && "state-active",
|
|
34
|
+
level > 1
|
|
35
|
+
? "nav-menu_item_cta-sub"
|
|
36
|
+
: "nav-menu_item_cta-main"
|
|
37
|
+
);
|
|
38
|
+
const iconSymbol =
|
|
39
|
+
app.link && app.link.target ? "new_window" : null;
|
|
40
|
+
|
|
41
|
+
return {
|
|
42
|
+
...app,
|
|
43
|
+
className,
|
|
44
|
+
iconSymbol
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
private _navItems: Option[] = [];
|
|
51
|
+
private navElement: HTMLElement | null = null;
|
|
52
|
+
private wasOpen: boolean = false;
|
|
53
|
+
private showScrollShadow: boolean = false;
|
|
54
|
+
|
|
55
|
+
private get className() {
|
|
56
|
+
return cx(
|
|
57
|
+
"nav-menu",
|
|
58
|
+
!this.open && "state-closed",
|
|
59
|
+
this.showScrollShadow && "has-scrollshadow"
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
renderedCallback() {
|
|
64
|
+
if (!this.navElement) {
|
|
65
|
+
this.navElement = this.template.querySelector("nav");
|
|
66
|
+
}
|
|
67
|
+
if (this.open && !this.wasOpen && this.value) {
|
|
68
|
+
this.scrollToAccordianSection();
|
|
69
|
+
}
|
|
70
|
+
if (this.open !== this.wasOpen) {
|
|
71
|
+
this.wasOpen = this.open;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
private scrollToAccordianSection() {
|
|
76
|
+
const element = this.template.querySelector(
|
|
77
|
+
`li[data-id="${this.value}"]`
|
|
78
|
+
);
|
|
79
|
+
const container = this.template.querySelector(".nav-menu");
|
|
80
|
+
if (element && container) {
|
|
81
|
+
container.scrollTop = element.offsetTop - 8;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
private onScroll(e: Event) {
|
|
86
|
+
this.showScrollShadow = (<HTMLElement>e.currentTarget).scrollTop > 4;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
private onChange(e: PointerEvent) {
|
|
90
|
+
const id = (<HTMLButtonElement>e.currentTarget).getAttribute("data-id");
|
|
91
|
+
const detail = id === this.value ? null : id; // toggles accordian open/closed
|
|
92
|
+
this.dispatchEvent(new CustomEvent("change", { detail }));
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
private onClickLink() {
|
|
96
|
+
this.dispatchEvent(new CustomEvent("requestclose"));
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
private onClickBackground() {
|
|
100
|
+
this.dispatchEvent(new CustomEvent("requestclose"));
|
|
101
|
+
}
|
|
102
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { LightningElement, api } from "lwc";
|
|
2
|
+
import { track } from "dx/instrumentation";
|
|
3
|
+
|
|
4
|
+
export default class HeaderMobileNavMenuOption extends LightningElement {
|
|
5
|
+
@api href: string | null = null;
|
|
6
|
+
@api className: string | null = null;
|
|
7
|
+
@api iconSymbol: string | null = null;
|
|
8
|
+
@api target: string | null = null;
|
|
9
|
+
@api menuLabel: string | null = null;
|
|
10
|
+
@api itemLabel: string | null = null;
|
|
11
|
+
|
|
12
|
+
private sendGtm(e: PointerEvent) {
|
|
13
|
+
track(e.currentTarget, "custEv_topNavLinkClick", {
|
|
14
|
+
navHeading: this.menuLabel || undefined,
|
|
15
|
+
navSubHeading: this.itemLabel || undefined,
|
|
16
|
+
clickText: this.href || undefined,
|
|
17
|
+
pageLocation: window.location.pathname || undefined
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
@import "helpers/reset";
|
|
2
|
+
|
|
3
|
+
a {
|
|
4
|
+
text-decoration: none;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
nav {
|
|
8
|
+
padding: 0;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.nav-list {
|
|
12
|
+
display: flex;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.nav-list li {
|
|
16
|
+
position: relative;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.nav-list-item-nav-menu {
|
|
20
|
+
display: none;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@media (max-width: 768px) {
|
|
24
|
+
.nav-list-item-nav-menu {
|
|
25
|
+
display: flex;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
dx-dropdown {
|
|
29
|
+
display: none;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<nav role="navigation" aria-label={ariaLabel}>
|
|
3
|
+
<ul class="nav-list">
|
|
4
|
+
<template for:each={navItems} for:item="navItem">
|
|
5
|
+
<li key={navItem.id}>
|
|
6
|
+
<dx-tab
|
|
7
|
+
if:false={navItem.options}
|
|
8
|
+
is-active={navItem.isActive}
|
|
9
|
+
label={navItem.label}
|
|
10
|
+
href={navItem.link.href}
|
|
11
|
+
variant={variant}
|
|
12
|
+
></dx-tab>
|
|
13
|
+
|
|
14
|
+
<!-- DESKTOP "MORE CONTENT" NAV ITEM -->
|
|
15
|
+
<dx-dropdown
|
|
16
|
+
analytics-event="custEv_topNavLinkClick"
|
|
17
|
+
if:true={navItem.options}
|
|
18
|
+
nav-item-label={navItem.label}
|
|
19
|
+
open-on-hover
|
|
20
|
+
offset="medium"
|
|
21
|
+
options={navItem.options}
|
|
22
|
+
placement="bottom"
|
|
23
|
+
stay-open-after-change
|
|
24
|
+
value={pathname}
|
|
25
|
+
value-path="link.href"
|
|
26
|
+
>
|
|
27
|
+
<dx-tab
|
|
28
|
+
label={navItem.label}
|
|
29
|
+
variant={variant}
|
|
30
|
+
use-icon
|
|
31
|
+
></dx-tab>
|
|
32
|
+
</dx-dropdown>
|
|
33
|
+
|
|
34
|
+
<!-- MOBILE "MORE CONTENT" NAV ITEM -->
|
|
35
|
+
<dx-tab
|
|
36
|
+
if:true={navItem.options}
|
|
37
|
+
class="nav-list-item-nav-menu"
|
|
38
|
+
data-id={navItem.id}
|
|
39
|
+
label={navItem.label}
|
|
40
|
+
use-icon
|
|
41
|
+
variant={variant}
|
|
42
|
+
onclick={requestOpenNavMenu}
|
|
43
|
+
></dx-tab>
|
|
44
|
+
</li>
|
|
45
|
+
</template>
|
|
46
|
+
</ul>
|
|
47
|
+
</nav>
|
|
48
|
+
</template>
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { LightningElement, api } from "lwc";
|
|
2
|
+
import { TabVariant, Option } from "typings/custom";
|
|
3
|
+
export default class HeaderNav extends LightningElement {
|
|
4
|
+
@api pathname: string | null = null;
|
|
5
|
+
@api variant: TabVariant = "default";
|
|
6
|
+
@api ariaLabel: string = "Navigation Bar";
|
|
7
|
+
|
|
8
|
+
@api
|
|
9
|
+
set navItems(_navItems: Option[]) {
|
|
10
|
+
this._navItems = _navItems;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
get navItems() {
|
|
14
|
+
const activeItem = this._navItems
|
|
15
|
+
.filter((navItem: Option) => {
|
|
16
|
+
if (!navItem.link || navItem.link.href === "/") {
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const fileExtension = navItem.link.href.match(/\.[0-9a-z]+$/i);
|
|
21
|
+
const baseLink = fileExtension
|
|
22
|
+
? navItem.link.href.substring(
|
|
23
|
+
0,
|
|
24
|
+
navItem.link.href.lastIndexOf("/")
|
|
25
|
+
)
|
|
26
|
+
: navItem.link.href;
|
|
27
|
+
return this.pathname?.includes(baseLink);
|
|
28
|
+
})
|
|
29
|
+
.sort(
|
|
30
|
+
(a, b) =>
|
|
31
|
+
(b.link?.href.length || 0) - (a.link?.href.length || 0)
|
|
32
|
+
)[0];
|
|
33
|
+
|
|
34
|
+
const items = this._navItems.map((navItem: Option) =>
|
|
35
|
+
navItem.link
|
|
36
|
+
? {
|
|
37
|
+
...navItem,
|
|
38
|
+
isActive:
|
|
39
|
+
navItem.link.href === this.pathname ||
|
|
40
|
+
navItem.id === activeItem?.id
|
|
41
|
+
}
|
|
42
|
+
: navItem
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
return items;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
private _navItems: Option[] = [];
|
|
49
|
+
|
|
50
|
+
private requestOpenNavMenu(e: PointerEvent) {
|
|
51
|
+
const detail = (<HTMLButtonElement>e.currentTarget).getAttribute(
|
|
52
|
+
"data-id"
|
|
53
|
+
);
|
|
54
|
+
this.dispatchEvent(new CustomEvent("requestopennavmenu", { detail }));
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
@import "helpers/reset";
|
|
2
|
+
|
|
3
|
+
/* DESKTOP */
|
|
4
|
+
|
|
5
|
+
:host {
|
|
6
|
+
--toggle-width: var(--dx-g-spacing-5xl);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.desktop_search-container {
|
|
10
|
+
position: relative;
|
|
11
|
+
display: flex;
|
|
12
|
+
height: var(--dx-g-spacing-xl);
|
|
13
|
+
font-size: var(--dx-g-text-sm);
|
|
14
|
+
font-family: var(--dx-g-font-sans);
|
|
15
|
+
color: var(--dx-g-gray-50);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.desktop_search-container dx-input {
|
|
19
|
+
--dx-c-input-width: calc(
|
|
20
|
+
var(--dx-c-header-search-width) - var(--toggle-width)
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/* MOBILE */
|
|
25
|
+
|
|
26
|
+
.mobile_search-button {
|
|
27
|
+
position: relative;
|
|
28
|
+
z-index: 3;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.mobile_search-dropdown {
|
|
32
|
+
--dx-c-popover-border-radius: 0;
|
|
33
|
+
--dx-c-popover-border: none;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.mobile_search-input {
|
|
37
|
+
position: absolute;
|
|
38
|
+
top: 0;
|
|
39
|
+
left: 0;
|
|
40
|
+
height: 100%;
|
|
41
|
+
width: 100%;
|
|
42
|
+
transition: var(--dx-g-transition-hue-1x);
|
|
43
|
+
opacity: 0;
|
|
44
|
+
pointer-events: none;
|
|
45
|
+
|
|
46
|
+
--dx-c-input-border: none;
|
|
47
|
+
--dx-c-input-border-radius: 0;
|
|
48
|
+
--dx-c-input-border-active: none;
|
|
49
|
+
--dx-c-input-icon-color: var(--dx-g-blue-vibrant-20);
|
|
50
|
+
--dx-c-input-padding: 0 var(--dx-g-spacing-4xl) 0 var(--dx-g-spacing-md);
|
|
51
|
+
--dx-c-input-background: var(--dx-g-brand-current-color-background-2);
|
|
52
|
+
--dx-c-input-background-active: var(
|
|
53
|
+
--dx-g-brand-current-color-background-2
|
|
54
|
+
);
|
|
55
|
+
--dx-c-input-height: 100% !important;
|
|
56
|
+
--dx-c-input-width: 100%;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.mobile_search-input.state-open {
|
|
60
|
+
opacity: 1;
|
|
61
|
+
pointer-events: auto;
|
|
62
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class={className} role="search" aria-label="Records Search">
|
|
3
|
+
<!-- MOBILE -->
|
|
4
|
+
<template if:true={mobile}>
|
|
5
|
+
<dx-dropdown
|
|
6
|
+
aria-label="Record Type"
|
|
7
|
+
class="mobile_search-dropdown"
|
|
8
|
+
open={isDropdownOpen}
|
|
9
|
+
options={suggestions}
|
|
10
|
+
onrequestclose={onDropdownRequestClose}
|
|
11
|
+
full-width
|
|
12
|
+
page-padding="0"
|
|
13
|
+
>
|
|
14
|
+
<dx-input
|
|
15
|
+
aria-label="Record Search Term"
|
|
16
|
+
class={mobileSearchInputClassName}
|
|
17
|
+
icon-size="large"
|
|
18
|
+
icon-symbol="search"
|
|
19
|
+
onchange={onInputChange}
|
|
20
|
+
onclear={onInputEscape}
|
|
21
|
+
onsubmit={onInputSubmit}
|
|
22
|
+
onfocus={openDropdown}
|
|
23
|
+
placeholder="Search"
|
|
24
|
+
size="override"
|
|
25
|
+
type="search"
|
|
26
|
+
></dx-input>
|
|
27
|
+
</dx-dropdown>
|
|
28
|
+
<dx-button
|
|
29
|
+
class="mobile_search-button"
|
|
30
|
+
aria-label={mobileSearchButtonAriaLabel}
|
|
31
|
+
icon-size="large"
|
|
32
|
+
icon-symbol={mobileSearchButtonIcon}
|
|
33
|
+
onclick={onMobileSearchButtonClick}
|
|
34
|
+
variant="tertiary"
|
|
35
|
+
></dx-button>
|
|
36
|
+
</template>
|
|
37
|
+
|
|
38
|
+
<!-- DESKTOP -->
|
|
39
|
+
<template if:false={mobile}>
|
|
40
|
+
<dx-dropdown
|
|
41
|
+
options={suggestions}
|
|
42
|
+
open={isDropdownOpen}
|
|
43
|
+
placement="bottom-end"
|
|
44
|
+
onrequestclose={onDropdownRequestClose}
|
|
45
|
+
offset="small"
|
|
46
|
+
full-width
|
|
47
|
+
>
|
|
48
|
+
<dx-input
|
|
49
|
+
aria-label="Record Search Term"
|
|
50
|
+
icon-symbol="search"
|
|
51
|
+
onchange={onInputChange}
|
|
52
|
+
onclear={onInputEscape}
|
|
53
|
+
onsubmit={onInputSubmit}
|
|
54
|
+
onfocus={openDropdown}
|
|
55
|
+
placeholder="Search"
|
|
56
|
+
shortcut-key="k"
|
|
57
|
+
size="small"
|
|
58
|
+
type="search"
|
|
59
|
+
value={searchBox.value}
|
|
60
|
+
></dx-input>
|
|
61
|
+
</dx-dropdown>
|
|
62
|
+
</template>
|
|
63
|
+
</div>
|
|
64
|
+
</template>
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { LightningElement, api } from "lwc";
|
|
2
|
+
import cx from "classnames";
|
|
3
|
+
import { PopoverRequestCloseType, Option } from "typings/custom";
|
|
4
|
+
import { buildSearchEngine } from "utils/coveo";
|
|
5
|
+
import {
|
|
6
|
+
StandaloneSearchBox as StandaloneSearchBoxType,
|
|
7
|
+
StandaloneSearchBoxState,
|
|
8
|
+
buildStandaloneSearchBox,
|
|
9
|
+
StandaloneSearchBoxOptions
|
|
10
|
+
} from "@coveo/headless";
|
|
11
|
+
|
|
12
|
+
const baseSearchHref = `/search`;
|
|
13
|
+
|
|
14
|
+
export default class HeaderSearch extends LightningElement {
|
|
15
|
+
@api mobile!: boolean;
|
|
16
|
+
@api coveoOrganizationId!: string;
|
|
17
|
+
@api coveoPublicAccessToken!: string;
|
|
18
|
+
@api coveoSearchPipeline!: string;
|
|
19
|
+
@api coveoSearchHub!: string;
|
|
20
|
+
|
|
21
|
+
private input: HTMLElement | null = null;
|
|
22
|
+
private isDropdownOpen: boolean = false;
|
|
23
|
+
private isMobileSearchOpen: boolean = false;
|
|
24
|
+
private searchBox: StandaloneSearchBoxType | null = null;
|
|
25
|
+
private searchState: StandaloneSearchBoxState | null = null;
|
|
26
|
+
|
|
27
|
+
private get className() {
|
|
28
|
+
return this.mobile ? null : "desktop_search-container";
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
private get suggestions(): Option[] {
|
|
32
|
+
if (this.searchState) {
|
|
33
|
+
return this.searchState.suggestions.map(
|
|
34
|
+
({ highlightedValue }: { highlightedValue: string }) => ({
|
|
35
|
+
id: highlightedValue,
|
|
36
|
+
label: highlightedValue,
|
|
37
|
+
link: {
|
|
38
|
+
href: this.createSearchHref(highlightedValue),
|
|
39
|
+
target: null
|
|
40
|
+
}
|
|
41
|
+
})
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
return [];
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
private get mobileSearchInputClassName() {
|
|
48
|
+
return cx(
|
|
49
|
+
"mobile_search-input",
|
|
50
|
+
this.isMobileSearchOpen && "state-open"
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
private get mobileSearchButtonIcon() {
|
|
55
|
+
return this.isMobileSearchOpen ? "close" : "search";
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
private get mobileSearchButtonAriaLabel() {
|
|
59
|
+
return this.isMobileSearchOpen
|
|
60
|
+
? "Hide mobile search"
|
|
61
|
+
: "Show mobile search";
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
connectedCallback() {
|
|
65
|
+
this.instantiateSearchbox();
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
private onDropdownRequestClose(e: CustomEvent) {
|
|
69
|
+
switch (e.detail as PopoverRequestCloseType) {
|
|
70
|
+
case "interact-outside":
|
|
71
|
+
case "keypress-escape":
|
|
72
|
+
this.closeDropdown();
|
|
73
|
+
break;
|
|
74
|
+
default:
|
|
75
|
+
break;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
private instantiateSearchbox() {
|
|
80
|
+
try {
|
|
81
|
+
const options: StandaloneSearchBoxOptions = {
|
|
82
|
+
numberOfSuggestions: 3,
|
|
83
|
+
redirectionUrl: "https://developer.salesforce.com"
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
const engine = buildSearchEngine({
|
|
87
|
+
organizationId: this.coveoOrganizationId,
|
|
88
|
+
publicAccessToken: this.coveoPublicAccessToken,
|
|
89
|
+
searchPipeline: this.coveoSearchPipeline,
|
|
90
|
+
searchHub: this.coveoSearchHub
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
this.searchBox = buildStandaloneSearchBox(engine, { options });
|
|
94
|
+
|
|
95
|
+
this.searchBox?.subscribe(() => {
|
|
96
|
+
if (this.searchBox) {
|
|
97
|
+
this.searchState = this.searchBox.state;
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
} catch (e) {
|
|
101
|
+
console.error(`Coveo searchbox failed to initialize (${e})`);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
private createSearchHref = (value: string | null = "") => {
|
|
106
|
+
return `${baseSearchHref}#q=${value}`;
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
private onInputChange(e: CustomEvent) {
|
|
110
|
+
if (this.searchBox) {
|
|
111
|
+
this.searchBox.updateText(e.detail);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
private onInputSubmit(e: CustomEvent) {
|
|
116
|
+
const href = this.createSearchHref(e.detail || "");
|
|
117
|
+
window.location.assign(href);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
private onMobileSearchButtonClick() {
|
|
121
|
+
this.isMobileSearchOpen = !this.isMobileSearchOpen;
|
|
122
|
+
const input = this.template.querySelector("dx-input");
|
|
123
|
+
if (this.isMobileSearchOpen && input) {
|
|
124
|
+
input.focus();
|
|
125
|
+
this.openDropdown();
|
|
126
|
+
} else {
|
|
127
|
+
this.closeDropdown();
|
|
128
|
+
}
|
|
129
|
+
if (!this.isMobileSearchOpen && this.searchBox) {
|
|
130
|
+
this.searchBox.updateText("");
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
private openDropdown() {
|
|
135
|
+
this.isDropdownOpen = true;
|
|
136
|
+
this.isMobileSearchOpen = true;
|
|
137
|
+
this.reportState<boolean>(true);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
private closeDropdown() {
|
|
141
|
+
this.isDropdownOpen = false;
|
|
142
|
+
this.isMobileSearchOpen = false;
|
|
143
|
+
this.reportState<boolean>(false);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
private onInputEscape() {
|
|
147
|
+
this.closeDropdown();
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
private reportState<T>(state: T) {
|
|
151
|
+
this.dispatchEvent(
|
|
152
|
+
new CustomEvent("statechange", {
|
|
153
|
+
detail: state,
|
|
154
|
+
bubbles: true,
|
|
155
|
+
composed: true
|
|
156
|
+
})
|
|
157
|
+
);
|
|
158
|
+
}
|
|
159
|
+
}
|