@salesforcedevs/dx-components 0.26.1-alpha0.4 → 0.26.2
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/package.json +4 -5
- 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/dx/banner/__tests__/banner.test.ts +33 -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/__tests__/brandThemeProvider.test.ts +49 -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.stories.ts +321 -0
- package/src/modules/dx/brandThemeProvider/brandThemeProvider.ts +46 -0
- package/src/modules/dx/breadcrumbs/__tests__/breadcrumbs.test.ts +140 -0
- package/src/modules/dx/breadcrumbs/__tests__/mockProps.ts +28 -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.stories.ts +39 -0
- package/src/modules/dx/breadcrumbs/breadcrumbs.ts +122 -0
- package/src/modules/dx/button/__tests__/button.test.ts +107 -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.stories.ts +150 -0
- package/src/modules/dx/button/button.ts +63 -0
- package/src/modules/dx/cardBlogPost/__tests__/cardBlogPost.test.ts +26 -0
- package/src/modules/dx/cardBlogPost/__tests__/mockProps.ts +12 -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.stories.ts +164 -0
- package/src/modules/dx/cardBlogPost/cardBlogPost.ts +23 -0
- package/src/modules/dx/cardBlogPostProvider/__tests__/cardBlogPostProvider.test.ts +34 -0
- package/src/modules/dx/cardBlogPostProvider/__tests__/mockWordpressPosts.ts +44 -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/__tests__/cardCallout.test.ts +20 -0
- package/src/modules/dx/cardCallout/__tests__/mockProps.ts +7 -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.stories.ts +33 -0
- package/src/modules/dx/cardCallout/cardCallout.ts +37 -0
- package/src/modules/dx/cardContent/__tests__/cardContent.test.ts +100 -0
- package/src/modules/dx/cardContent/__tests__/mockProps.ts +13 -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.stories.ts +127 -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.stories.ts +115 -0
- package/src/modules/dx/cardDemo/cardDemo.ts +11 -0
- package/src/modules/dx/cardDocs/__tests__/cardDocs.test.ts +48 -0
- package/src/modules/dx/cardDocs/__tests__/mockProps.ts +9 -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.stories.ts +299 -0
- package/src/modules/dx/cardDocs/cardDocs.ts +30 -0
- package/src/modules/dx/cardEvent/__tests__/cardEvent.test.ts +95 -0
- package/src/modules/dx/cardEvent/__tests__/mockProps.ts +10 -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.stories.ts +153 -0
- package/src/modules/dx/cardEvent/cardEvent.ts +42 -0
- package/src/modules/dx/cardExpanded/__tests__/cardExpanded.test.ts +193 -0
- package/src/modules/dx/cardExpanded/__tests__/mockProps.ts +21 -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.stories.ts +59 -0
- package/src/modules/dx/cardExpanded/cardExpanded.ts +45 -0
- package/src/modules/dx/cardGrid/__tests__/cardMockProps.ts +431 -0
- package/src/modules/dx/cardGrid/__tests__/mockProps.ts +15 -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.stories.ts +111 -0
- package/src/modules/dx/cardGrid/cardGrid.ts +140 -0
- package/src/modules/dx/cardMinimal/__tests__/cardMinimal.test.ts +87 -0
- package/src/modules/dx/cardMinimal/__tests__/mockProps.ts +10 -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.stories.ts +32 -0
- package/src/modules/dx/cardMinimal/cardMinimal.ts +3 -0
- package/src/modules/dx/cardNews/__tests__/cardNews.test.ts +58 -0
- package/src/modules/dx/cardNews/__tests__/mockProps.ts +7 -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.stories.ts +115 -0
- package/src/modules/dx/cardNews/cardNews.ts +62 -0
- package/src/modules/dx/cardPodcastEpisode/__tests__/cardPodcastEpisode.test.ts +68 -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.stories.ts +31 -0
- package/src/modules/dx/cardPodcastEpisode/cardPodcastEpisode.ts +36 -0
- package/src/modules/dx/cardPodcastEpisodeProvider/__tests__/cardPodcastEpisodeProvider.test.ts +36 -0
- package/src/modules/dx/cardPodcastEpisodeProvider/__tests__/mockWordpressEpisodes.ts +50 -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/__tests__/cardSmall.test.ts +66 -0
- package/src/modules/dx/cardSmall/__tests__/mockProps.ts +8 -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.stories.ts +166 -0
- package/src/modules/dx/cardSmall/cardSmall.ts +38 -0
- package/src/modules/dx/cardTitle/__tests__/cardTitle.test.ts +46 -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/__tests__/cardTrailheadModule.test.ts +18 -0
- package/src/modules/dx/cardTrailheadModule/__tests__/mockProps.ts +11 -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.stories.ts +122 -0
- package/src/modules/dx/cardTrailheadModule/cardTrailheadModule.ts +18 -0
- package/src/modules/dx/cardVideoPreview/__tests__/cardVideoPreview.test.ts +22 -0
- package/src/modules/dx/cardVideoPreview/__tests__/mockProps.ts +11 -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.stories.ts +147 -0
- package/src/modules/dx/cardVideoPreview/cardVideoPreview.ts +13 -0
- package/src/modules/dx/checkbox/__tests__/checkbox.test.ts +85 -0
- package/src/modules/dx/checkbox/__tests__/mockProps.ts +5 -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.stories.ts +38 -0
- package/src/modules/dx/checkbox/checkbox.ts +55 -0
- package/src/modules/dx/checkboxGroup/__tests__/checkboxGroup.test.ts +80 -0
- package/src/modules/dx/checkboxGroup/__tests__/mockProps.ts +14 -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.stories.ts +33 -0
- package/src/modules/dx/checkboxGroup/checkboxGroup.ts +77 -0
- package/src/modules/dx/codeBlock/__tests__/codeBlock.test.ts +238 -0
- package/src/modules/dx/codeBlock/__tests__/mockProps.ts +160 -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.stories.ts +143 -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/__tests__/dropdown.test.ts +165 -0
- package/src/modules/dx/dropdown/__tests__/mockNestedOptions.ts +96 -0
- package/src/modules/dx/dropdown/__tests__/mockOptions.ts +10 -0
- package/src/modules/dx/dropdown/__tests__/mockProps.ts +6 -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.stories.ts +89 -0
- package/src/modules/dx/dropdown/dropdown.ts +182 -0
- package/src/modules/dx/dropdownOption/__tests__/dropdownOption.test.ts +112 -0
- package/src/modules/dx/dropdownOption/__tests__/mockProps.ts +20 -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/__tests__/emptyState.test.ts +52 -0
- package/src/modules/dx/emptyState/__tests__/mockProps.ts +4 -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.stories.ts +45 -0
- package/src/modules/dx/emptyState/emptyState.ts +20 -0
- package/src/modules/dx/feature/__tests__/feature.test.ts +51 -0
- package/src/modules/dx/feature/__tests__/mockProps.ts +8 -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/__tests__/featureGrid.test.ts +21 -0
- package/src/modules/dx/featureGrid/featureGrid.html +3 -0
- package/src/modules/dx/featureGrid/featureGrid.stories.ts +120 -0
- package/src/modules/dx/featureGrid/featureGrid.ts +15 -0
- package/src/modules/dx/featuredContentHeader/__tests__/featuredContentHeader.test.ts +178 -0
- package/src/modules/dx/featuredContentHeader/__tests__/mockProps.ts +73 -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.stories.ts +153 -0
- package/src/modules/dx/featuredContentHeader/featuredContentHeader.ts +113 -0
- package/src/modules/dx/featuredContentHeader/svgs.ts +35 -0
- package/src/modules/dx/featuresList/__tests__/featuresList.test.ts +43 -0
- package/src/modules/dx/featuresList/__tests__/mockProps.ts +17 -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.stories.ts +30 -0
- package/src/modules/dx/featuresList/featuresList.ts +21 -0
- package/src/modules/dx/footer/__tests__/footer.test.ts +147 -0
- package/src/modules/dx/footer/__tests__/mockLocales.ts +7 -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.stories.ts +88 -0
- package/src/modules/dx/footer/footer.ts +124 -0
- package/src/modules/dx/footer/links.ts +140 -0
- package/src/modules/dx/footerOption/__tests__/footerOption.test.ts +34 -0
- package/src/modules/dx/footerOption/__tests__/mockProps.ts +7 -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/__tests__/formattedDateTime.test.ts +25 -0
- package/src/modules/dx/formattedDateTime/__tests__/mockProps.ts +13 -0
- package/src/modules/dx/formattedDateTime/formattedDateTime.html +1 -0
- package/src/modules/dx/formattedDateTime/formattedDateTime.stories.ts +103 -0
- package/src/modules/dx/formattedDateTime/formattedDateTime.ts +72 -0
- package/src/modules/dx/grid/__tests__/grid.test.ts +32 -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.stories.ts +134 -0
- package/src/modules/dx/grid/grid.ts +72 -0
- package/src/modules/dx/groupBio/__tests__/groupBio.test.ts +82 -0
- package/src/modules/dx/groupBio/__tests__/mockProps.ts +15 -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.stories.ts +66 -0
- package/src/modules/dx/groupBio/groupBio.ts +41 -0
- package/src/modules/dx/groupText/__tests__/groupText.test.ts +69 -0
- package/src/modules/dx/groupText/__tests__/mockProps.ts +35 -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.stories.ts +81 -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/__tests__/header.test.ts +236 -0
- package/src/modules/dx/header/__tests__/mockNavArchitects.ts +169 -0
- package/src/modules/dx/header/__tests__/mockNavDevelopers.ts +419 -0
- package/src/modules/dx/header/__tests__/mockNavs.ts +115 -0
- package/src/modules/dx/header/__tests__/mockProps.ts +164 -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.stories.ts +172 -0
- package/src/modules/dx/header/header.ts +27 -0
- package/src/modules/dx/headerMobileNavMenu/__tests__/headerMobileNavMenu.test.ts +123 -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/__tests__/headerMobileNavMenuOption.test.ts +38 -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/__tests__/headerNav.test.ts +49 -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/__tests__/headerSearch.test.ts +182 -0
- package/src/modules/dx/headerSearch/__tests__/mockData.ts +11 -0
- package/src/modules/dx/headerSearch/__tests__/mockProps.ts +6 -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/__tests__/helmet.test.ts +52 -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.stories.ts +53 -0
- package/src/modules/dx/helmet/helmet.ts +27 -0
- package/src/modules/dx/hr/__tests__/hr.test.ts +53 -0
- package/src/modules/dx/hr/__tests__/mockProps.ts +16 -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.stories.ts +50 -0
- package/src/modules/dx/hr/hr.ts +45 -0
- package/src/modules/dx/icon/__tests__/icon.test.ts +54 -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.stories.ts +100 -0
- package/src/modules/dx/icon/icon.ts +85 -0
- package/src/modules/dx/iconBadge/__tests__/iconBadge.test.ts +17 -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.stories.ts +32 -0
- package/src/modules/dx/iconBadge/iconBadge.ts +42 -0
- package/src/modules/dx/imageAndLabel/__tests__/imageAndLabel.test.ts +39 -0
- package/src/modules/dx/imageAndLabel/__tests__/mockProps.ts +6 -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.stories.ts +48 -0
- package/src/modules/dx/imageAndLabel/imageAndLabel.ts +16 -0
- package/src/modules/dx/input/__tests__/input.test.ts +357 -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.stories.ts +102 -0
- package/src/modules/dx/input/input.ts +238 -0
- package/src/modules/dx/input/validators.ts +5 -0
- package/src/modules/dx/instrumentation/__tests__/instrumentation.test.ts +86 -0
- package/src/modules/dx/instrumentation/instrumentation.html +1 -0
- package/src/modules/dx/instrumentation/instrumentation.ts +116 -0
- package/src/modules/dx/interactiveImage/__tests__/interactiveImage.test.ts +83 -0
- package/src/modules/dx/interactiveImage/__tests__/mockProps.ts +39 -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.stories.ts +31 -0
- package/src/modules/dx/interactiveImage/interactiveImage.ts +71 -0
- package/src/modules/dx/lazy/__tests__/lazy.test.ts +43 -0
- package/src/modules/dx/lazy/lazy.html +5 -0
- package/src/modules/dx/lazy/lazy.stories.ts +132 -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/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/__tests__/pagination.test.ts +121 -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.stories.ts +88 -0
- package/src/modules/dx/pagination/pagination.ts +93 -0
- package/src/modules/dx/podcastHost/__tests__/mockProps.ts +8 -0
- package/src/modules/dx/podcastHost/__tests__/podcastHost.test.ts +21 -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.stories.ts +17 -0
- package/src/modules/dx/podcastHost/podcastHost.ts +13 -0
- package/src/modules/dx/podcastPlayer/__tests__/podcastPlayer.test.ts +20 -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.stories.ts +13 -0
- package/src/modules/dx/podcastPlayer/podcastPlayer.ts +5 -0
- package/src/modules/dx/podcastSubscription/__tests__/podcastSubscription.test.ts +16 -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.stories.ts +23 -0
- package/src/modules/dx/podcastSubscription/podcastSubscription.ts +58 -0
- package/src/modules/dx/popover/__tests__/mockProps.ts +8 -0
- package/src/modules/dx/popover/__tests__/popover.test.ts +313 -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.stories.ts +82 -0
- package/src/modules/dx/popover/popover.ts +313 -0
- package/src/modules/dx/radioGroup/__tests__/mockProps.ts +12 -0
- package/src/modules/dx/radioGroup/__tests__/radioGroup.test.ts +42 -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.stories.ts +25 -0
- package/src/modules/dx/radioGroup/radioGroup.ts +65 -0
- package/src/modules/dx/relativeDateTime/__tests__/mockProps.ts +55 -0
- package/src/modules/dx/relativeDateTime/__tests__/relativeDateTime.test.ts +52 -0
- package/src/modules/dx/relativeDateTime/relativeDateTime.html +3 -0
- package/src/modules/dx/relativeDateTime/relativeDateTime.stories.ts +83 -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.stories.ts +36 -0
- package/src/modules/dx/searchResults/searchResults.ts +186 -0
- package/src/modules/dx/section/__tests__/section.test.ts +17 -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.stories.ts +381 -0
- package/src/modules/dx/section/section.ts +41 -0
- package/src/modules/dx/sectionSignup/__tests__/sectionSignup.test.ts +66 -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.stories.ts +49 -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.stories.ts +59 -0
- package/src/modules/dx/select/select.ts +23 -0
- package/src/modules/dx/sidebar/__tests__/mockProps.ts +181 -0
- package/src/modules/dx/sidebar/__tests__/mockSearchChangeEmptyEvent.ts +6 -0
- package/src/modules/dx/sidebar/__tests__/mockSearchChangeEvent.ts +527 -0
- package/src/modules/dx/sidebar/__tests__/sidebar.test.ts +568 -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.stories.ts +188 -0
- package/src/modules/dx/sidebar/sidebar.ts +255 -0
- package/src/modules/dx/sidebarOld/__tests__/mockProps.ts +178 -0
- package/src/modules/dx/sidebarOld/__tests__/sidebarOld.test.ts +570 -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.stories.ts +139 -0
- package/src/modules/dx/sidebarOld/sidebarOld.ts +187 -0
- package/src/modules/dx/sidebarSearch/__tests__/mockPreloadedState.ts +1686 -0
- package/src/modules/dx/sidebarSearch/__tests__/sidebarSearch.test.ts +175 -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 +440 -0
- package/src/modules/dx/sidebarSearchResult/__tests__/sidebarSearchResult.test.ts +96 -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/__tests__/slackCta.test.ts +36 -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.stories.ts +25 -0
- package/src/modules/dx/slackCta/slackCta.ts +12 -0
- package/src/modules/dx/socials/__tests__/socials.test.ts +114 -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.stories.ts +24 -0
- package/src/modules/dx/socials/socials.ts +81 -0
- package/src/modules/dx/spinner/__tests__/spinner.test.ts +37 -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.stories.ts +69 -0
- package/src/modules/dx/spinner/spinner.ts +20 -0
- package/src/modules/dx/tab/__tests__/tab.test.ts +129 -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.stories.ts +57 -0
- package/src/modules/dx/tab/tab.ts +52 -0
- package/src/modules/dx/toc/__tests__/mockProps.ts +28 -0
- package/src/modules/dx/toc/__tests__/toc.test.ts +109 -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.stories.ts +26 -0
- package/src/modules/dx/toc/toc.ts +77 -0
- package/src/modules/dx/tooltip/__tests__/tooltip.test.ts +22 -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.stories.ts +46 -0
- package/src/modules/dx/tooltip/tooltip.ts +6 -0
- package/src/modules/dx/topics/__tests__/mockProps.ts +3 -0
- package/src/modules/dx/topics/__tests__/topics.test.ts +31 -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/__tests__/mockProps.ts +215 -0
- package/src/modules/dx/tree/__tests__/tree.test.ts +346 -0
- package/src/modules/dx/tree/__tests__/treeHandler.test.ts +194 -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.stories.ts +65 -0
- package/src/modules/dx/tree/tree.ts +72 -0
- package/src/modules/dx/tree/treeHandler.ts +100 -0
- package/src/modules/dx/treeItem/__tests__/mockProps.ts +46 -0
- package/src/modules/dx/treeItem/__tests__/treeItem.test.ts +377 -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/__tests__/mockProps.ts +16 -0
- package/src/modules/dx/treeTile/__tests__/treeTile.test.ts +168 -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/__tests__/typeBadge.test.ts +77 -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.stories.ts +114 -0
- package/src/modules/dx/typeBadge/typeBadge.ts +65 -0
- package/src/modules/dx/typeBadgeGroup/__tests__/mockProps.ts +11 -0
- package/src/modules/dx/typeBadgeGroup/__tests__/typeBadgeGroup.test.ts +72 -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.stories.ts +19 -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/test-components/buttonTest/buttonTest.html +3 -0
- package/src/modules/test-components/buttonTest/buttonTest.ts +3 -0
- package/src/modules/test-components/codeBlockTest/codeBlockTest.js +4 -0
- package/src/modules/test-components/featureGridTest/featureGridTest.html +7 -0
- package/src/modules/test-components/featureGridTest/featureGridTest.ts +5 -0
- package/src/modules/test-components/instrumentationTest/instrumentationTest.html +4 -0
- package/src/modules/test-components/instrumentationTest/instrumentationTest.ts +8 -0
- package/src/modules/test-components/popoverTest/popoverTest.html +6 -0
- package/src/modules/test-components/popoverTest/popoverTest.ts +5 -0
- package/src/modules/test-components/slackCtaTest/slackCtaTest.html +3 -0
- package/src/modules/test-components/slackCtaTest/slackCtaTest.ts +3 -0
- package/src/modules/utils/highlight/__tests__/highlight.test.ts +108 -0
- package/src/modules/utils/highlight/__tests__/mockProps.ts +45 -0
- package/src/modules/utils/highlight/highlight.ts +32 -0
- package/src/modules/utils/normalizers/normalizers.ts +91 -0
- package/src/modules/utils-internal/archiveCard/archiveCard.ts +35 -0
- package/src/modules/utils-internal/coveo/coveo.ts +70 -0
- package/src/modules/utils-internal/css/css.ts +43 -0
- package/src/modules/utils-internal/devices/devices.ts +1 -0
- package/src/modules/utils-internal/headerBase/headerBase.ts +204 -0
- package/src/modules/utils-internal/jest/jest.ts +58 -0
- package/src/modules/utils-internal/options/options.ts +39 -0
- package/src/modules/utils-internal/prismjs/prismjs.html +3 -0
- package/src/modules/utils-internal/prismjs/prismjs.ts +3321 -0
- package/src/modules/utils-internal/recentSearches/__tests__/recentSearches.test.ts +83 -0
- package/src/modules/utils-internal/recentSearches/recentSearches.ts +57 -0
- package/src/modules/utils-internal/regexps/regexps.ts +5 -0
- package/src/modules/utils-internal/seo/seo.ts +4 -0
- package/src/modules/utils-internal/slot/slot.ts +17 -0
- package/src/modules/utils-internal/storybook/storybook.ts +32 -0
- package/src/modules/utils-internal/tests/tests.ts +38 -0
- package/src/modules/utils-internal/wordpress/__tests__/wordpress.test.ts +15 -0
- package/src/modules/utils-internal/wordpress/wordpress.ts +13 -0
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
import { LightningElement, api } from "lwc";
|
|
2
|
+
import { track } from "dx/instrumentation";
|
|
3
|
+
import { CountryOptions, CheckboxTextSet } from "typings/custom";
|
|
4
|
+
|
|
5
|
+
const ANALYTICS_INFO = {
|
|
6
|
+
itemTitle: "newsletter sign up submit",
|
|
7
|
+
formName: "newsletter",
|
|
8
|
+
formType: "newsletter",
|
|
9
|
+
method: "email",
|
|
10
|
+
destinationType: "internal",
|
|
11
|
+
clickText: "Subscribe Now",
|
|
12
|
+
clickUrl: "/newsletter/success",
|
|
13
|
+
elementType: "button",
|
|
14
|
+
ctaClick: true
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export default class Form extends LightningElement {
|
|
18
|
+
@api checkboxTextSet: string = "";
|
|
19
|
+
@api countries: string = "";
|
|
20
|
+
|
|
21
|
+
private firstName: string = "";
|
|
22
|
+
private lastName: string = "";
|
|
23
|
+
private email: string = "";
|
|
24
|
+
private country: string = "";
|
|
25
|
+
|
|
26
|
+
private showLegalText: boolean = false;
|
|
27
|
+
private showLegalCheckbox: boolean = false;
|
|
28
|
+
private showMarketingCheckbox: boolean = false;
|
|
29
|
+
private legalText: string = "";
|
|
30
|
+
private marketingText: string | null = null;
|
|
31
|
+
private hasRendered: boolean = false;
|
|
32
|
+
|
|
33
|
+
renderedCallback() {
|
|
34
|
+
if (!this.hasRendered) {
|
|
35
|
+
// Focus the first input in the form
|
|
36
|
+
this.template.querySelector("dx-input")?.focus();
|
|
37
|
+
|
|
38
|
+
this.setInitialEmail();
|
|
39
|
+
this.hasRendered = true;
|
|
40
|
+
} else if (this.hasRendered && this.showLegalCheckbox) {
|
|
41
|
+
// Grab the legal checkbox and append the legal text as innerHTML (text has anchor links in it)
|
|
42
|
+
const legalCheckboxElement = this.template.querySelector(
|
|
43
|
+
"dx-checkbox.legal-checkbox"
|
|
44
|
+
);
|
|
45
|
+
const legalCheckboxSpan = document.createElement("span");
|
|
46
|
+
this.setInnerHtml(legalCheckboxSpan, this.legalText);
|
|
47
|
+
|
|
48
|
+
if (legalCheckboxElement) {
|
|
49
|
+
legalCheckboxElement.appendChild(legalCheckboxSpan);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
handleKeyDown(e: KeyboardEvent) {
|
|
55
|
+
if (e.key === "Enter") {
|
|
56
|
+
this.handleSubmit(e);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
handleChange(e: any) {
|
|
61
|
+
switch (e.target.name) {
|
|
62
|
+
case "fname":
|
|
63
|
+
this.firstName = e.target.value;
|
|
64
|
+
break;
|
|
65
|
+
case "lname":
|
|
66
|
+
this.lastName = e.target.value;
|
|
67
|
+
break;
|
|
68
|
+
case "email":
|
|
69
|
+
this.email = e.target.value;
|
|
70
|
+
break;
|
|
71
|
+
case "country":
|
|
72
|
+
this.country = e.target.value;
|
|
73
|
+
this.handleConsent(e.target);
|
|
74
|
+
break;
|
|
75
|
+
default:
|
|
76
|
+
break;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
handleSubmit(e: Event) {
|
|
81
|
+
e.preventDefault();
|
|
82
|
+
|
|
83
|
+
const allFormElements = Array.from(
|
|
84
|
+
this.template.querySelectorAll("dx-input, dx-select, dx-checkbox")
|
|
85
|
+
);
|
|
86
|
+
|
|
87
|
+
const legalCheckboxElement = this.template.querySelector(
|
|
88
|
+
"dx-checkbox.legal-checkbox"
|
|
89
|
+
);
|
|
90
|
+
|
|
91
|
+
if (legalCheckboxElement) {
|
|
92
|
+
allFormElements.push(legalCheckboxElement);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
const passed = !allFormElements
|
|
96
|
+
.map((formElement) => formElement.reportValidity())
|
|
97
|
+
.includes(false);
|
|
98
|
+
|
|
99
|
+
// All fields passed validation
|
|
100
|
+
if (passed) {
|
|
101
|
+
this.sendFormData();
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
setInitialEmail() {
|
|
106
|
+
// Set email if provided in the query param
|
|
107
|
+
const queryString = window.location.search;
|
|
108
|
+
const urlParams = new URLSearchParams(queryString);
|
|
109
|
+
|
|
110
|
+
const subscriberEmail = urlParams.get("subscriberEmail");
|
|
111
|
+
|
|
112
|
+
if (subscriberEmail) {
|
|
113
|
+
this.email = subscriberEmail;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
getFormData() {
|
|
118
|
+
const marketingConsented = this.template.querySelector(
|
|
119
|
+
"dx-checkbox.marketing-checkbox"
|
|
120
|
+
)?.checked;
|
|
121
|
+
const date = new Date().toISOString();
|
|
122
|
+
|
|
123
|
+
return {
|
|
124
|
+
InfoEmail: marketingConsented ? true : false,
|
|
125
|
+
"First Name": this.firstName,
|
|
126
|
+
"Last Name": this.lastName,
|
|
127
|
+
Consent: marketingConsented
|
|
128
|
+
? "Explicit"
|
|
129
|
+
: this.showMarketingCheckbox
|
|
130
|
+
? ""
|
|
131
|
+
: "Implied",
|
|
132
|
+
"Email Status Update": date,
|
|
133
|
+
email: this.email,
|
|
134
|
+
Country: this.country,
|
|
135
|
+
"Privacy Policy": true,
|
|
136
|
+
referrer: "footer"
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
async sendFormData() {
|
|
141
|
+
const formData = this.getFormData();
|
|
142
|
+
const errorMsg = "Error while subscribing to newsletter";
|
|
143
|
+
const submitButtonEl = this.template.querySelector(".form-submit");
|
|
144
|
+
|
|
145
|
+
submitButtonEl.setAttribute("disabled", "true");
|
|
146
|
+
submitButtonEl.textContent = "...Processing request";
|
|
147
|
+
|
|
148
|
+
try {
|
|
149
|
+
const res = await fetch("/pages/pardot/footer_optin", {
|
|
150
|
+
method: "POST",
|
|
151
|
+
headers: {
|
|
152
|
+
"Content-Type": "application/json"
|
|
153
|
+
},
|
|
154
|
+
body: JSON.stringify(formData)
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
if (!res.ok) {
|
|
158
|
+
throw new Error(errorMsg);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
const data = await res.json();
|
|
162
|
+
|
|
163
|
+
if (!data.success) {
|
|
164
|
+
throw new Error(errorMsg);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
// GTM event
|
|
168
|
+
track(submitButtonEl, "custEv_formCompletion", ANALYTICS_INFO);
|
|
169
|
+
|
|
170
|
+
window.location.assign("/newsletter/success");
|
|
171
|
+
} catch (error) {
|
|
172
|
+
submitButtonEl.setAttribute("disabled", "false");
|
|
173
|
+
submitButtonEl.textContent = "Subscribe Now";
|
|
174
|
+
console.error(error);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
handleConsent(countrySelectElement: any) {
|
|
179
|
+
if (this.checkboxTextSet) {
|
|
180
|
+
const countryOptions = countrySelectElement.jsonOptions.find(
|
|
181
|
+
(jsonOption) => jsonOption.value === countrySelectElement.value
|
|
182
|
+
);
|
|
183
|
+
|
|
184
|
+
this.setLegalAndMarketingData(countryOptions);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
setLegalAndMarketingData(countryOptions: CountryOptions) {
|
|
189
|
+
// Parse the text sets for the checkbox info
|
|
190
|
+
const parsedCheckboxTextSet = JSON.parse(this.checkboxTextSet);
|
|
191
|
+
|
|
192
|
+
// Check for alternate text set or set to default
|
|
193
|
+
const checkboxTextSet = countryOptions.checkboxTextSet
|
|
194
|
+
? parsedCheckboxTextSet[countryOptions.checkboxTextSet]
|
|
195
|
+
: parsedCheckboxTextSet.default;
|
|
196
|
+
|
|
197
|
+
// Set the checkbox text
|
|
198
|
+
this.setCheckboxTextSet(checkboxTextSet);
|
|
199
|
+
|
|
200
|
+
// Toggle visibility of legal/marketing data
|
|
201
|
+
this.toggleLegalAndMarketingVisibility(
|
|
202
|
+
countryOptions.showLegalText,
|
|
203
|
+
countryOptions.showLegalCheckbox,
|
|
204
|
+
countryOptions.showMarketingCheckbox
|
|
205
|
+
);
|
|
206
|
+
|
|
207
|
+
// Grab the legal text paragraph element and set inner html (this is due to text having html elements in the string)
|
|
208
|
+
const legalTextElement = this.template.querySelector(".legal-text");
|
|
209
|
+
|
|
210
|
+
if (legalTextElement && this.showLegalText) {
|
|
211
|
+
this.setInnerHtml(legalTextElement, this.legalText);
|
|
212
|
+
} else if (legalTextElement && !this.showLegalText) {
|
|
213
|
+
// Clear legal text
|
|
214
|
+
this.setInnerHtml(legalTextElement, "");
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
setCheckboxTextSet(checkboxTextSet: CheckboxTextSet) {
|
|
219
|
+
this.legalText = checkboxTextSet.legalText;
|
|
220
|
+
this.marketingText = checkboxTextSet.marketingText;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
toggleLegalAndMarketingVisibility(
|
|
224
|
+
showLegalText: boolean,
|
|
225
|
+
showLegalCheckbox: boolean,
|
|
226
|
+
showMarketingCheckbox: boolean
|
|
227
|
+
) {
|
|
228
|
+
this.showLegalText = showLegalText;
|
|
229
|
+
this.showLegalCheckbox = showLegalCheckbox;
|
|
230
|
+
this.showMarketingCheckbox = showMarketingCheckbox;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
setInnerHtml(element: HTMLElement, value: string) {
|
|
234
|
+
// disable lwc warning because text received from json has HTML
|
|
235
|
+
// eslint-disable-next-line @lwc/lwc/no-inner-html
|
|
236
|
+
element.innerHTML = value;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import Pagination from "dx/pagination";
|
|
2
|
+
import { createRenderComponent } from "utils-internal/tests";
|
|
3
|
+
|
|
4
|
+
const TAG = "dx-pagination";
|
|
5
|
+
const render = createRenderComponent(TAG, Pagination);
|
|
6
|
+
|
|
7
|
+
describe(TAG, () => {
|
|
8
|
+
it("renders with passed in props", () => {
|
|
9
|
+
const element = render({
|
|
10
|
+
currentPage: "1",
|
|
11
|
+
totalPages: "10",
|
|
12
|
+
pagesToShow: "5"
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
const pageButtons = element.shadowRoot.querySelectorAll(
|
|
16
|
+
"button[data-page-id]"
|
|
17
|
+
);
|
|
18
|
+
expect(pageButtons.length).toEqual(5);
|
|
19
|
+
|
|
20
|
+
const activeButton = element.shadowRoot.querySelector(
|
|
21
|
+
"button.current-page"
|
|
22
|
+
);
|
|
23
|
+
expect(activeButton.textContent).toEqual("1");
|
|
24
|
+
|
|
25
|
+
return expect(element).toBeAccessible();
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
it("doesn't render past totalPages", () => {
|
|
29
|
+
const element = render({
|
|
30
|
+
currentPage: "10",
|
|
31
|
+
totalPages: "10",
|
|
32
|
+
pagesToShow: "5"
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
const pageButtons = element.shadowRoot.querySelectorAll(
|
|
36
|
+
"button[data-page-id]"
|
|
37
|
+
);
|
|
38
|
+
for (const button of pageButtons) {
|
|
39
|
+
expect(parseInt(button.dataset.pageId, 10)).toBeLessThanOrEqual(10);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return expect(element).toBeAccessible();
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
it("only renders up to totalPages", () => {
|
|
46
|
+
const element = render({
|
|
47
|
+
currentPage: "1",
|
|
48
|
+
totalPages: "3",
|
|
49
|
+
pagesToShow: "5"
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
const pageButtons = element.shadowRoot.querySelectorAll(
|
|
53
|
+
"button[data-page-id]"
|
|
54
|
+
);
|
|
55
|
+
for (const button of pageButtons) {
|
|
56
|
+
expect(parseInt(button.dataset.pageId, 10)).toBeLessThanOrEqual(3);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return expect(element).toBeAccessible();
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
it("triggers custom event on previous button", () => {
|
|
63
|
+
const element = render({
|
|
64
|
+
currentPage: "3",
|
|
65
|
+
totalPages: "3",
|
|
66
|
+
pagesToShow: "5"
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
const handler = jest.fn();
|
|
70
|
+
element.addEventListener("pagechange", handler);
|
|
71
|
+
|
|
72
|
+
const previousButton: HTMLElement = element.shadowRoot.querySelector(
|
|
73
|
+
"[data-part-id=previous]"
|
|
74
|
+
);
|
|
75
|
+
previousButton.click();
|
|
76
|
+
expect(handler).toHaveBeenCalled();
|
|
77
|
+
expect(handler.mock.calls[0][0].detail).toEqual(2);
|
|
78
|
+
|
|
79
|
+
return expect(element).toBeAccessible();
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
it("triggers custom event on next button", () => {
|
|
83
|
+
const element = render({
|
|
84
|
+
currentPage: "3",
|
|
85
|
+
totalPages: "3",
|
|
86
|
+
pagesToShow: "5"
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
const handler = jest.fn();
|
|
90
|
+
element.addEventListener("pagechange", handler);
|
|
91
|
+
|
|
92
|
+
const nextButton: HTMLElement = element.shadowRoot.querySelector(
|
|
93
|
+
"[data-part-id=next]"
|
|
94
|
+
);
|
|
95
|
+
nextButton.click();
|
|
96
|
+
expect(handler).toHaveBeenCalled();
|
|
97
|
+
expect(handler.mock.calls[0][0].detail).toEqual(4);
|
|
98
|
+
|
|
99
|
+
return expect(element).toBeAccessible();
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
it("triggers custom event clicking on any page", () => {
|
|
103
|
+
const element = render({
|
|
104
|
+
currentPage: "3",
|
|
105
|
+
totalPages: "3",
|
|
106
|
+
pagesToShow: "5"
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
const handler = jest.fn();
|
|
110
|
+
element.addEventListener("pagechange", handler);
|
|
111
|
+
|
|
112
|
+
const activeButton = element.shadowRoot.querySelector(
|
|
113
|
+
"button.current-page"
|
|
114
|
+
);
|
|
115
|
+
activeButton.click();
|
|
116
|
+
expect(handler).toHaveBeenCalled();
|
|
117
|
+
expect(handler.mock.calls[0][0].detail).toEqual(3);
|
|
118
|
+
|
|
119
|
+
return expect(element).toBeAccessible();
|
|
120
|
+
});
|
|
121
|
+
});
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
@import "helpers/reset";
|
|
2
|
+
|
|
3
|
+
.dx-pagination {
|
|
4
|
+
display: flex;
|
|
5
|
+
align-items: center;
|
|
6
|
+
justify-content: space-between;
|
|
7
|
+
padding: 0;
|
|
8
|
+
width: min-content;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.dx-pagination dx-button {
|
|
12
|
+
--dx-c-button-primary-color: transparent;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.dx-pagination.has-prev dx-button:first-of-type {
|
|
16
|
+
--dx-c-button-primary-color: var(--dx-g-blue-vibrant-50);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.dx-pagination.has-next dx-button:last-of-type {
|
|
20
|
+
--dx-c-button-primary-color: var(--dx-g-blue-vibrant-50);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.dx-pagination-pages {
|
|
24
|
+
flex: 1;
|
|
25
|
+
display: flex;
|
|
26
|
+
justify-content: space-between;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.dx-pagination-pages button {
|
|
30
|
+
padding: var(--dx-g-spacing-sm) var(--dx-g-spacing-md)
|
|
31
|
+
var(--dx-g-spacing-2xs) var(--dx-g-spacing-md);
|
|
32
|
+
border-radius: var(--dx-g-spacing-lg);
|
|
33
|
+
font-family: var(--dx-g-font-display);
|
|
34
|
+
font-size: var(--dx-g-text-sm);
|
|
35
|
+
color: var(--dx-g-blue-vibrant-20);
|
|
36
|
+
transition: var(--dx-g-transition-hue-1x);
|
|
37
|
+
margin-left: var(--dx-g-spacing-sm);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.dx-pagination-pages button:last-child {
|
|
41
|
+
margin-right: var(--dx-g-spacing-sm);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.dx-pagination-pages button:hover {
|
|
45
|
+
background-color: var(--dx-g-cloud-blue-vibrant-95);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.dx-pagination-pages button.current-page {
|
|
49
|
+
background-color: var(--dx-g-blue-vibrant-50);
|
|
50
|
+
color: white;
|
|
51
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class={rootClass}>
|
|
3
|
+
<dx-button
|
|
4
|
+
data-part-id="previous"
|
|
5
|
+
aria-label="Previous Page"
|
|
6
|
+
variant="tertiary"
|
|
7
|
+
size="large"
|
|
8
|
+
icon-symbol="back"
|
|
9
|
+
icon-position="left"
|
|
10
|
+
onclick={onPageChange}
|
|
11
|
+
disabled={previousIsDisabled}
|
|
12
|
+
></dx-button>
|
|
13
|
+
<div class="dx-pagination-pages">
|
|
14
|
+
<template for:each={pages} for:item="item" for:index="i">
|
|
15
|
+
<button
|
|
16
|
+
if:true={item.isCurrentPage}
|
|
17
|
+
class="current-page"
|
|
18
|
+
onclick={onPageChange}
|
|
19
|
+
data-page-id={item.index}
|
|
20
|
+
key={item.index}
|
|
21
|
+
>
|
|
22
|
+
{item.label}
|
|
23
|
+
</button>
|
|
24
|
+
<button
|
|
25
|
+
if:false={item.isCurrentPage}
|
|
26
|
+
onclick={onPageChange}
|
|
27
|
+
data-page-id={item.index}
|
|
28
|
+
key={item.index}
|
|
29
|
+
>
|
|
30
|
+
{item.label}
|
|
31
|
+
</button>
|
|
32
|
+
</template>
|
|
33
|
+
</div>
|
|
34
|
+
<dx-button
|
|
35
|
+
data-part-id="next"
|
|
36
|
+
aria-label="Next Page"
|
|
37
|
+
variant="tertiary"
|
|
38
|
+
size="large"
|
|
39
|
+
icon-symbol="forward"
|
|
40
|
+
icon-position="right"
|
|
41
|
+
onclick={onPageChange}
|
|
42
|
+
disabled={nextIsDisabled}
|
|
43
|
+
></dx-button>
|
|
44
|
+
</div>
|
|
45
|
+
</template>
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { html } from "lit-html";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: "dx/dx-pagination",
|
|
5
|
+
component: "dx-pagination"
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
const createStyles = () => html`
|
|
9
|
+
<style>
|
|
10
|
+
body {
|
|
11
|
+
padding: 12px 0 0 0 !important;
|
|
12
|
+
}
|
|
13
|
+
.title {
|
|
14
|
+
font-weight: bold;
|
|
15
|
+
margin: 24px;
|
|
16
|
+
}
|
|
17
|
+
</style>
|
|
18
|
+
`;
|
|
19
|
+
|
|
20
|
+
const title = (value: string) => html`<p class="title">${value}</p>`;
|
|
21
|
+
|
|
22
|
+
export const Base = () => html`
|
|
23
|
+
${createStyles()}
|
|
24
|
+
${title("Current page: 1, total pages: 10, pages to show: 5")}
|
|
25
|
+
<dx-pagination
|
|
26
|
+
current-page="1"
|
|
27
|
+
total-pages="10"
|
|
28
|
+
pages-to-show="5"
|
|
29
|
+
></dx-pagination>
|
|
30
|
+
|
|
31
|
+
${title("Current page: 3, total pages: 10, pages to show: 5")}
|
|
32
|
+
<dx-pagination
|
|
33
|
+
current-page="3"
|
|
34
|
+
total-pages="10"
|
|
35
|
+
pages-to-show="5"
|
|
36
|
+
></dx-pagination>
|
|
37
|
+
|
|
38
|
+
${title("Current page: 3, total pages: 3, pages to show: 5")}
|
|
39
|
+
<dx-pagination
|
|
40
|
+
current-page="3"
|
|
41
|
+
total-pages="3"
|
|
42
|
+
pages-to-show="5"
|
|
43
|
+
></dx-pagination>
|
|
44
|
+
|
|
45
|
+
${title(
|
|
46
|
+
"Current page: 3, total pages: 10, pages to show: 6 (rounded down to 5)"
|
|
47
|
+
)}
|
|
48
|
+
<dx-pagination
|
|
49
|
+
current-page="3"
|
|
50
|
+
total-pages="10"
|
|
51
|
+
pages-to-show="6"
|
|
52
|
+
></dx-pagination>
|
|
53
|
+
|
|
54
|
+
${title("Current page: 3, total pages: 10, pages to show: 3")}
|
|
55
|
+
<dx-pagination
|
|
56
|
+
current-page="3"
|
|
57
|
+
total-pages="10"
|
|
58
|
+
pages-to-show="3"
|
|
59
|
+
></dx-pagination>
|
|
60
|
+
|
|
61
|
+
${title("Current page: 6, total pages: 20, pages to show: 11")}
|
|
62
|
+
<dx-pagination
|
|
63
|
+
current-page="6"
|
|
64
|
+
total-pages="20"
|
|
65
|
+
pages-to-show="11"
|
|
66
|
+
></dx-pagination>
|
|
67
|
+
|
|
68
|
+
${title("Current page: 20, total pages: 20, pages to show: 11")}
|
|
69
|
+
<dx-pagination
|
|
70
|
+
current-page="20"
|
|
71
|
+
total-pages="20"
|
|
72
|
+
pages-to-show="11"
|
|
73
|
+
></dx-pagination>
|
|
74
|
+
|
|
75
|
+
${title("Current page: 10, total pages: 10, pages to show: 5")}
|
|
76
|
+
<dx-pagination
|
|
77
|
+
current-page="10"
|
|
78
|
+
total-pages="10"
|
|
79
|
+
pages-to-show="5"
|
|
80
|
+
></dx-pagination>
|
|
81
|
+
|
|
82
|
+
${title("Current page: 1, total pages: 3, pages to show: 2")}
|
|
83
|
+
<dx-pagination
|
|
84
|
+
current-page="1"
|
|
85
|
+
total-pages="3"
|
|
86
|
+
pages-to-show="2"
|
|
87
|
+
></dx-pagination>
|
|
88
|
+
`;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import classNames from "classnames";
|
|
2
|
+
import { LightningElement, api } from "lwc";
|
|
3
|
+
|
|
4
|
+
export default class Pagination extends LightningElement {
|
|
5
|
+
@api currentPage: string = "1";
|
|
6
|
+
@api totalPages: string = "1";
|
|
7
|
+
@api pagesToShow: string = "5";
|
|
8
|
+
|
|
9
|
+
private get _currentPage() {
|
|
10
|
+
return parseInt(this.currentPage, 10);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
private get _totalPages() {
|
|
14
|
+
return parseInt(this.totalPages, 10);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
private get _pagesToShow() {
|
|
18
|
+
return parseInt(this.pagesToShow, 10);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
private get hasPrev(): boolean {
|
|
22
|
+
return this._currentPage > 1;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
private get hasNext(): boolean {
|
|
26
|
+
return this._currentPage < this._totalPages;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
private get previousIsDisabled(): boolean {
|
|
30
|
+
return !this.hasPrev;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
private get nextIsDisabled(): boolean {
|
|
34
|
+
return !this.hasNext;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
private get rootClass(): string {
|
|
38
|
+
return classNames(
|
|
39
|
+
"dx-pagination",
|
|
40
|
+
this.hasNext && "has-next",
|
|
41
|
+
this.hasPrev && "has-prev"
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
private get pages(): {
|
|
46
|
+
label: string;
|
|
47
|
+
index: number;
|
|
48
|
+
isCurrentPage: boolean;
|
|
49
|
+
}[] {
|
|
50
|
+
const offset =
|
|
51
|
+
this._pagesToShow === 2 ? 2 : Math.ceil(this._pagesToShow / 2);
|
|
52
|
+
let start = this._currentPage - offset + 1;
|
|
53
|
+
let end = this._currentPage + offset - 1;
|
|
54
|
+
|
|
55
|
+
if (this._totalPages < this._pagesToShow) {
|
|
56
|
+
start = 1;
|
|
57
|
+
end = this._totalPages;
|
|
58
|
+
} else if (this._currentPage < offset) {
|
|
59
|
+
start = 1;
|
|
60
|
+
end = this._pagesToShow;
|
|
61
|
+
} else if (this._currentPage + offset > this._totalPages) {
|
|
62
|
+
start = this._totalPages - this._pagesToShow + 1;
|
|
63
|
+
end = this._totalPages;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return [
|
|
67
|
+
...Array.from(Array(end - start + 1).keys()).map((index) => {
|
|
68
|
+
const page = index + start;
|
|
69
|
+
return {
|
|
70
|
+
label: `${page}`,
|
|
71
|
+
index: page,
|
|
72
|
+
isCurrentPage: page === this._currentPage
|
|
73
|
+
};
|
|
74
|
+
})
|
|
75
|
+
];
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
private onPageChange(e: Event) {
|
|
79
|
+
const button = (e.target as HTMLElement).dataset.partId;
|
|
80
|
+
let page = this.returnPage(button);
|
|
81
|
+
if (page === 0) {
|
|
82
|
+
page = +(e.target as HTMLElement).dataset.pageId!;
|
|
83
|
+
}
|
|
84
|
+
this.dispatchEvent(new CustomEvent("pagechange", { detail: page }));
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
private returnPage(button: string) {
|
|
88
|
+
if (!button) {
|
|
89
|
+
return 0;
|
|
90
|
+
}
|
|
91
|
+
return this._currentPage + (button === "previous" ? -1 : 1);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
firstName: "Maynard",
|
|
3
|
+
lastName: "Maynard James Keenan",
|
|
4
|
+
imgSrc: "https://placekitten.com/96/96",
|
|
5
|
+
twitterHref: "https://twitter.com/puscifer",
|
|
6
|
+
bio:
|
|
7
|
+
"Maynard James Keenan (born James Herbert Keenan; April 17, 1964) is an American singer, songwriter, musician, record producer, actor, martial artist, and winemaker. He is best known as the lead singer and primary lyricist of the rock band Tool, with whom he has released five studio albums, A Perfect Circle, with whom he has released four studio albums, and Puscifer, with whom he has released four studio albums."
|
|
8
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import PodcastHost from "dx/podcastHost";
|
|
2
|
+
import { createRenderComponent } from "utils-internal/tests";
|
|
3
|
+
import mockProps from "./mockProps";
|
|
4
|
+
|
|
5
|
+
const TAG = "dx-podcast-host";
|
|
6
|
+
const render = createRenderComponent(TAG, PodcastHost);
|
|
7
|
+
|
|
8
|
+
describe(TAG, () => {
|
|
9
|
+
it("renders the image, host, bio and link", () => {
|
|
10
|
+
const element = render(mockProps);
|
|
11
|
+
|
|
12
|
+
const els = [
|
|
13
|
+
".host-img > img",
|
|
14
|
+
".dx-text-heading-4",
|
|
15
|
+
".host-bio p",
|
|
16
|
+
"dx-button"
|
|
17
|
+
].map((query) => element.shadowRoot.querySelector(query));
|
|
18
|
+
expect(els).not.toContain(null);
|
|
19
|
+
return expect(element).toBeAccessible();
|
|
20
|
+
});
|
|
21
|
+
});
|