@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 cx from "classnames";
|
|
3
|
+
import { IconSize, IconSymbol } from "typings/custom";
|
|
4
|
+
import { isMac } from "utils-internal/devices";
|
|
5
|
+
import { isValidEmail } from "./validators";
|
|
6
|
+
|
|
7
|
+
type ValidatorMap = {
|
|
8
|
+
[key: string]: {
|
|
9
|
+
validator: (value: string | null) => boolean;
|
|
10
|
+
errorMessage: string;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const typeValidatorMap: ValidatorMap = {
|
|
15
|
+
email: {
|
|
16
|
+
validator: isValidEmail,
|
|
17
|
+
errorMessage: "Enter valid email"
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
export default class Input extends LightningElement {
|
|
21
|
+
@api ariaLabel!: string;
|
|
22
|
+
@api autocomplete: string | null = null;
|
|
23
|
+
@api clearable: boolean = false;
|
|
24
|
+
@api disabled: boolean = false;
|
|
25
|
+
@api iconSize: IconSize = "medium";
|
|
26
|
+
@api iconSymbol: IconSymbol | null = null;
|
|
27
|
+
@api label?: string;
|
|
28
|
+
@api loading: boolean = false;
|
|
29
|
+
@api missingErrorMessage: string = "Complete this field";
|
|
30
|
+
@api formatErrorMessage?: string;
|
|
31
|
+
@api name?: string;
|
|
32
|
+
@api placeholder!: string;
|
|
33
|
+
@api required = false;
|
|
34
|
+
@api role: string | null = null;
|
|
35
|
+
@api shortcutKey: string | null = null;
|
|
36
|
+
@api size: "small" | "large" | "override" = "small";
|
|
37
|
+
@api submitLabel?: string | null = null;
|
|
38
|
+
@api type: string = "text";
|
|
39
|
+
@api validityOnBlur = false;
|
|
40
|
+
|
|
41
|
+
@api
|
|
42
|
+
get value() {
|
|
43
|
+
return this._value;
|
|
44
|
+
}
|
|
45
|
+
set value(value: string | null) {
|
|
46
|
+
this._value = value || "";
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
@api
|
|
50
|
+
get errorMessage() {
|
|
51
|
+
return this._errorMessage;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
set errorMessage(value) {
|
|
55
|
+
this._errorMessage = value;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
@api focus() {
|
|
59
|
+
if (this.input) {
|
|
60
|
+
this.input.focus();
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
@api
|
|
65
|
+
reportValidity(): boolean {
|
|
66
|
+
if (this.isRequiredAndFilled) {
|
|
67
|
+
this._errorMessage = this.missingErrorMessage;
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const typeValidator = typeValidatorMap[this.type];
|
|
72
|
+
if (typeValidator && !typeValidator.validator(this.value)) {
|
|
73
|
+
this._errorMessage =
|
|
74
|
+
this.formatErrorMessage || typeValidator.errorMessage;
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
this._errorMessage = "";
|
|
79
|
+
return true;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
private _errorMessage: string = "";
|
|
83
|
+
private focused: boolean = false;
|
|
84
|
+
private input: HTMLInputElement | null = null;
|
|
85
|
+
private _value: string | null = null;
|
|
86
|
+
private _loading: boolean = false;
|
|
87
|
+
|
|
88
|
+
private get showClearButton(): boolean {
|
|
89
|
+
return this.clearable && !!this.value;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
private get showShortcutKey(): boolean {
|
|
93
|
+
return !this.showClearButton && !!this.shortcutKey;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
private get ariaKeyShortcuts() {
|
|
97
|
+
return this.shortcutKey ? `meta+${this.shortcutKey}` : null;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
private get inputLoading() {
|
|
101
|
+
return this.loading || this._loading;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
private get inputInvalid() {
|
|
105
|
+
const typeValidator = typeValidatorMap[this.type];
|
|
106
|
+
return (
|
|
107
|
+
this.isRequiredAndFilled &&
|
|
108
|
+
typeValidator &&
|
|
109
|
+
!typeValidator.validator(this.value)
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
private get inputDisabled() {
|
|
114
|
+
return this.inputLoading || this.disabled;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
private get className() {
|
|
118
|
+
return cx("input-group", `size-${this.size}`);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
private get inputContainerClassName() {
|
|
122
|
+
return cx(
|
|
123
|
+
"input-container",
|
|
124
|
+
this.focused && "state-focused",
|
|
125
|
+
(this.showClearButton || this.showShortcutKey) &&
|
|
126
|
+
"has-floating-item",
|
|
127
|
+
!!this.errorMessage && "has-error"
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
private get buttonDisabled() {
|
|
132
|
+
return this.inputLoading || this.inputInvalid || this.disabled;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
private get commandKey() {
|
|
136
|
+
return isMac() ? "command" : "control";
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
private get shortcutImgSrc() {
|
|
140
|
+
return `/assets/svg/${this.commandKey}.svg`;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
private get shortcutImgAlt() {
|
|
144
|
+
return `${this.commandKey}-${this.shortcutKey} is the search shortcut`;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
private get isRequiredAndFilled() {
|
|
148
|
+
return this.required && (!this.value || !this.value.trim());
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
connectedCallback() {
|
|
152
|
+
window.addEventListener("keydown", this.onWindowKeydown);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
disconnectedCallback() {
|
|
156
|
+
window.removeEventListener("keydown", this.onWindowKeydown);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
renderedCallback() {
|
|
160
|
+
if (!this.input) {
|
|
161
|
+
this.input = <HTMLInputElement>this.template.querySelector("input");
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
onClick() {
|
|
166
|
+
if (this.input) {
|
|
167
|
+
this.input.focus();
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
onInputFocus() {
|
|
172
|
+
this.focused = true;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
onInputBlur() {
|
|
176
|
+
this.focused = false;
|
|
177
|
+
|
|
178
|
+
if (this.validityOnBlur) {
|
|
179
|
+
this.reportValidity();
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
onInputChange(e: InputEvent) {
|
|
184
|
+
if (!e || !e.target) {
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
this.dispatchChange((<HTMLInputElement>e.target).value || "");
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
onButtonClick(e: Event) {
|
|
191
|
+
if (!this.buttonDisabled) {
|
|
192
|
+
e.stopPropagation();
|
|
193
|
+
}
|
|
194
|
+
this.submit();
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
dispatchChange(value: string) {
|
|
198
|
+
this._value = value;
|
|
199
|
+
this.dispatchEvent(new CustomEvent("change", { detail: this.value }));
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
clear(e?: Event) {
|
|
203
|
+
if (e) {
|
|
204
|
+
e.stopPropagation();
|
|
205
|
+
}
|
|
206
|
+
this.dispatchChange("");
|
|
207
|
+
this.dispatchEvent(new CustomEvent("clear"));
|
|
208
|
+
if (this.input) {
|
|
209
|
+
this.input.blur();
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
submit = async () => {
|
|
214
|
+
if (this.inputInvalid) {
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
217
|
+
this.dispatchEvent(new CustomEvent("submit", { detail: this.value }));
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
private onKeyDown(e: KeyboardEvent) {
|
|
221
|
+
switch (e.key) {
|
|
222
|
+
case "Escape":
|
|
223
|
+
this.clear();
|
|
224
|
+
break;
|
|
225
|
+
case "Enter":
|
|
226
|
+
this.submit();
|
|
227
|
+
break;
|
|
228
|
+
default:
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
private onWindowKeydown = (e: KeyboardEvent) => {
|
|
233
|
+
if (this.shortcutKey && e.metaKey && e.key === this.shortcutKey) {
|
|
234
|
+
e.preventDefault();
|
|
235
|
+
this.focus();
|
|
236
|
+
}
|
|
237
|
+
};
|
|
238
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { track, developerwebTrackEventListener } from "dx/instrumentation";
|
|
2
|
+
import InstrumentationTest from "test-components/instrumentationTest";
|
|
3
|
+
import { createRenderComponent } from "utils-internal/tests";
|
|
4
|
+
|
|
5
|
+
const TAG = "dx-instrumentation";
|
|
6
|
+
const render = createRenderComponent(
|
|
7
|
+
"dx-instrumentation-test",
|
|
8
|
+
InstrumentationTest
|
|
9
|
+
);
|
|
10
|
+
|
|
11
|
+
describe(TAG, () => {
|
|
12
|
+
afterEach(() => {
|
|
13
|
+
delete (window as any).dataLayer;
|
|
14
|
+
delete (window as any).__DX_INSTRUMENTATION_QUEUE__;
|
|
15
|
+
delete (window as any).__DX_INSTRUMENTATION_IS_INITIALIZED__;
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
it("catches bubbled events", () => {
|
|
19
|
+
const element = render();
|
|
20
|
+
|
|
21
|
+
const button = element.shadowRoot.querySelector("button");
|
|
22
|
+
button.dispatchEvent(new MouseEvent("click"));
|
|
23
|
+
expect((window as any).dataLayer.length).toBe(1);
|
|
24
|
+
expect((window as any).dataLayer[0]).toEqual({
|
|
25
|
+
event: "buttonClick",
|
|
26
|
+
buttonName: "default"
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
it("flushes events dispatched prior to render", () => {
|
|
31
|
+
track(document, "testEvent", { isSentBeforeRender: "yes" });
|
|
32
|
+
expect((window as any).__DX_INSTRUMENTATION_QUEUE__.length).toBe(1);
|
|
33
|
+
|
|
34
|
+
render();
|
|
35
|
+
|
|
36
|
+
expect((window as any).__DX_INSTRUMENTATION_IS_INITIALIZED__).toBe(
|
|
37
|
+
true
|
|
38
|
+
);
|
|
39
|
+
expect((window as any).dataLayer.length).toBe(1);
|
|
40
|
+
expect((window as any).dataLayer[0]).toEqual({
|
|
41
|
+
event: "testEvent",
|
|
42
|
+
isSentBeforeRender: "yes"
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
// Because Jest runs tests in parallel, and because these tests interact
|
|
47
|
+
// with global scope, this `describe` block needs to remain within the
|
|
48
|
+
// parent one to ensure that it's working with a cleaned-up environment.
|
|
49
|
+
describe("developerwebTrackEventListener", () => {
|
|
50
|
+
let t: ReturnType<developerwebTrackEventListener> | null = null;
|
|
51
|
+
|
|
52
|
+
afterEach(() => {
|
|
53
|
+
if (t !== null) {
|
|
54
|
+
t.remove();
|
|
55
|
+
}
|
|
56
|
+
delete (window as any).dataLayer;
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
it("catches tracked events", () => {
|
|
60
|
+
// Marked instrumentation as initialized, so we can capture the event
|
|
61
|
+
(window as any).__DX_INSTRUMENTATION_IS_INITIALIZED__ = true;
|
|
62
|
+
|
|
63
|
+
const spy = { track: jest.fn() };
|
|
64
|
+
t = developerwebTrackEventListener([spy]);
|
|
65
|
+
t.add();
|
|
66
|
+
track(document, "testEvent", { isTestEvent: "yes" });
|
|
67
|
+
|
|
68
|
+
expect(spy.track).toHaveBeenCalledTimes(1);
|
|
69
|
+
const { detail, composed, bubbles } = spy.track.mock.calls[0][0];
|
|
70
|
+
expect(detail).toEqual({
|
|
71
|
+
event: "testEvent",
|
|
72
|
+
payload: {
|
|
73
|
+
isTestEvent: "yes"
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
expect(composed).toBe(true);
|
|
77
|
+
expect(bubbles).toBe(true);
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
it("throws an exception if no trackerFns provided", () => {
|
|
81
|
+
expect(() => developerwebTrackEventListener([])).toThrow(
|
|
82
|
+
"No tracker functions passed"
|
|
83
|
+
);
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<template></template>
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { LightningElement, api } from "lwc";
|
|
2
|
+
|
|
3
|
+
const TRACKING_EVENT_NAME = "developerwebsite_track";
|
|
4
|
+
const LISTENER_QUEUE = "__DX_INSTRUMENTATION_QUEUE__";
|
|
5
|
+
const LISTENER_INDICATOR = "__DX_INSTRUMENTATION_IS_INITIALIZED__";
|
|
6
|
+
|
|
7
|
+
export function track(
|
|
8
|
+
element: EventTarget,
|
|
9
|
+
event: string,
|
|
10
|
+
payload: Record<string, unknown>
|
|
11
|
+
): void {
|
|
12
|
+
const detail = { event, payload };
|
|
13
|
+
// if window.LISTENER_INDICATOR is undefined, `dx-instrumentation` has not
|
|
14
|
+
// been mounted, and the listener hasn't been attached.
|
|
15
|
+
if ((window as any)[LISTENER_INDICATOR] === undefined) {
|
|
16
|
+
(window as any)[LISTENER_QUEUE] = (window as any)[LISTENER_QUEUE] || [];
|
|
17
|
+
(window as any)[LISTENER_QUEUE].push(detail);
|
|
18
|
+
} else {
|
|
19
|
+
const e = new CustomEvent(TRACKING_EVENT_NAME, {
|
|
20
|
+
bubbles: true,
|
|
21
|
+
composed: true,
|
|
22
|
+
detail
|
|
23
|
+
});
|
|
24
|
+
element.dispatchEvent(e);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const googleTagManager = {
|
|
29
|
+
track: function (e: Event) {
|
|
30
|
+
if ((window as any).dataLayer === undefined) {
|
|
31
|
+
(window as any).dataLayer = [];
|
|
32
|
+
}
|
|
33
|
+
const { event, payload } = (e as CustomEvent).detail;
|
|
34
|
+
(window as any).dataLayer.push({ ...payload, event });
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
interface TrackEventListener {
|
|
39
|
+
add: () => void;
|
|
40
|
+
remove: () => void;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export function developerwebTrackEventListener(
|
|
44
|
+
trackerFns: { track: (e: Event) => void }[] = []
|
|
45
|
+
): TrackEventListener {
|
|
46
|
+
if (trackerFns.length === 0) {
|
|
47
|
+
throw new Error("No tracker functions passed");
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const trackdeveloperwebEvent = (e: Event) => {
|
|
51
|
+
trackerFns.forEach((tracker) => {
|
|
52
|
+
tracker.track(e);
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
const attachEventListener = () => {
|
|
57
|
+
document.addEventListener(TRACKING_EVENT_NAME, trackdeveloperwebEvent);
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
const removeEventListener = () => {
|
|
61
|
+
document.removeEventListener(
|
|
62
|
+
TRACKING_EVENT_NAME,
|
|
63
|
+
trackdeveloperwebEvent
|
|
64
|
+
);
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
return {
|
|
68
|
+
add: attachEventListener,
|
|
69
|
+
remove: removeEventListener
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export default class Instrumentation extends LightningElement {
|
|
74
|
+
@api useGoogleTagManager = false;
|
|
75
|
+
|
|
76
|
+
private tracker: TrackEventListener | null = null;
|
|
77
|
+
|
|
78
|
+
private setupTracker() {
|
|
79
|
+
const trackerFunctions = this.useGoogleTagManager
|
|
80
|
+
? [googleTagManager]
|
|
81
|
+
: [];
|
|
82
|
+
this.tracker = developerwebTrackEventListener(trackerFunctions);
|
|
83
|
+
this.tracker.add();
|
|
84
|
+
(window as any)[LISTENER_INDICATOR] = true;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
private dispatchQueuedEvents() {
|
|
88
|
+
while ((window as any)[LISTENER_QUEUE].length > 0) {
|
|
89
|
+
const event = (window as any)[LISTENER_QUEUE].pop() as {
|
|
90
|
+
event: string;
|
|
91
|
+
payload: Record<string, unknown>;
|
|
92
|
+
};
|
|
93
|
+
track(this, event.event, event.payload);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
renderedCallback() {
|
|
98
|
+
if (this.tracker === null) {
|
|
99
|
+
this.setupTracker();
|
|
100
|
+
|
|
101
|
+
if (
|
|
102
|
+
(window as any)[LISTENER_QUEUE] !== undefined &&
|
|
103
|
+
(window as any)[LISTENER_QUEUE].length > 0
|
|
104
|
+
) {
|
|
105
|
+
this.dispatchQueuedEvents();
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
disconnectedCallback() {
|
|
111
|
+
if (this.tracker !== null) {
|
|
112
|
+
this.tracker.remove();
|
|
113
|
+
this.tracker = null;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import Dropdown from "dx/dropdown";
|
|
2
|
+
import InteractiveImage from "dx/interactiveImage";
|
|
3
|
+
import { createRenderComponent } from "utils-internal/tests";
|
|
4
|
+
import {
|
|
5
|
+
mockSingleDownloadPropsAsArray,
|
|
6
|
+
mockSingleDownloadPropsAsString,
|
|
7
|
+
mockMultipleDownloadProps,
|
|
8
|
+
mockMultipleDownloadOptions
|
|
9
|
+
} from "./mockProps";
|
|
10
|
+
|
|
11
|
+
const TAG = "dx-interactive-image";
|
|
12
|
+
const render = createRenderComponent(TAG, InteractiveImage);
|
|
13
|
+
|
|
14
|
+
describe(TAG, () => {
|
|
15
|
+
describe("single download", () => {
|
|
16
|
+
it("is accessible", () => {
|
|
17
|
+
const element = render(mockSingleDownloadPropsAsArray);
|
|
18
|
+
|
|
19
|
+
const sectionEl = element.shadowRoot.querySelector("article");
|
|
20
|
+
expect(sectionEl).not.toBeNull();
|
|
21
|
+
return expect(sectionEl).toBeAccessible();
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it("has the right download URL when URL passed as string", () => {
|
|
25
|
+
const element = render(mockSingleDownloadPropsAsString);
|
|
26
|
+
|
|
27
|
+
const dropdownEl = element.shadowRoot.querySelector("dx-dropdown");
|
|
28
|
+
expect(dropdownEl).toBeNull();
|
|
29
|
+
const buttonEl =
|
|
30
|
+
element.shadowRoot.querySelector("header dx-button");
|
|
31
|
+
expect(buttonEl).not.toBeNull();
|
|
32
|
+
expect(buttonEl.href).toBe(
|
|
33
|
+
mockSingleDownloadPropsAsString.downloadUrls
|
|
34
|
+
);
|
|
35
|
+
expect(buttonEl.download).toBe("FUsyxR5.jpg");
|
|
36
|
+
return expect(element).toBeAccessible();
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it("has the right download URL when URL passed as array", () => {
|
|
40
|
+
const element = render(mockSingleDownloadPropsAsArray);
|
|
41
|
+
|
|
42
|
+
const dropdownEl = element.shadowRoot.querySelector("dx-dropdown");
|
|
43
|
+
expect(dropdownEl).toBeNull();
|
|
44
|
+
const buttonEl =
|
|
45
|
+
element.shadowRoot.querySelector("header dx-button");
|
|
46
|
+
expect(buttonEl).not.toBeNull();
|
|
47
|
+
expect(buttonEl.href).toBe(
|
|
48
|
+
mockSingleDownloadPropsAsArray.downloadUrls[0]
|
|
49
|
+
);
|
|
50
|
+
expect(buttonEl.download).toBe("FUsyxR5.jpg");
|
|
51
|
+
return expect(element).toBeAccessible();
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
describe("multiple downloads", () => {
|
|
56
|
+
it("is accessible", () => {
|
|
57
|
+
const element = render(mockMultipleDownloadProps);
|
|
58
|
+
|
|
59
|
+
const sectionEl = element.shadowRoot.querySelector("article");
|
|
60
|
+
expect(sectionEl).not.toBeNull();
|
|
61
|
+
return expect(sectionEl).toBeAccessible();
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
it("renders a dropdown", () => {
|
|
65
|
+
const element = render(mockMultipleDownloadProps);
|
|
66
|
+
|
|
67
|
+
const dropdownEl: Dropdown =
|
|
68
|
+
element.shadowRoot.querySelector("dx-dropdown");
|
|
69
|
+
expect(dropdownEl).not.toBeNull();
|
|
70
|
+
const { options } = dropdownEl;
|
|
71
|
+
|
|
72
|
+
expect(options).toHaveLength(mockMultipleDownloadOptions.length);
|
|
73
|
+
options.forEach((option, index) => {
|
|
74
|
+
expect(option.id).toBe(mockMultipleDownloadOptions[index].id);
|
|
75
|
+
expect(option.label).toBe(
|
|
76
|
+
mockMultipleDownloadOptions[index].label
|
|
77
|
+
);
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
return expect(element).toBeAccessible();
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
});
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export const mockSingleDownloadPropsAsString = {
|
|
2
|
+
title:
|
|
3
|
+
"Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu",
|
|
4
|
+
featuredSrc: "https://i.imgur.com/FUsyxR5.jpg",
|
|
5
|
+
downloadUrls: "https://i.imgur.com/FUsyxR5.jpg"
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export const mockSingleDownloadPropsAsArray = {
|
|
9
|
+
title:
|
|
10
|
+
"Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu",
|
|
11
|
+
featuredSrc: "https://i.imgur.com/FUsyxR5.jpg",
|
|
12
|
+
downloadUrls: ["https://i.imgur.com/FUsyxR5.jpg"]
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export const mockMultipleDownloadProps = {
|
|
16
|
+
title:
|
|
17
|
+
"Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu",
|
|
18
|
+
featuredSrc: "https://i.imgur.com/FUsyxR5.jpg",
|
|
19
|
+
downloadUrls: [
|
|
20
|
+
"https://i.imgur.com/FUsyxR5.jpg",
|
|
21
|
+
"https://i.imgur.com/FUsyxR5.png",
|
|
22
|
+
"https://i.imgur.com/FUsyxR5.bmp"
|
|
23
|
+
]
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export const mockMultipleDownloadOptions = [
|
|
27
|
+
{
|
|
28
|
+
label: "Download as JPG",
|
|
29
|
+
id: mockMultipleDownloadProps.downloadUrls[0]
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
label: "Download as PNG",
|
|
33
|
+
id: mockMultipleDownloadProps.downloadUrls[1]
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
label: "Download as BMP",
|
|
37
|
+
id: mockMultipleDownloadProps.downloadUrls[2]
|
|
38
|
+
}
|
|
39
|
+
];
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
@import "helpers/reset";
|
|
2
|
+
@import "helpers/text";
|
|
3
|
+
|
|
4
|
+
article {
|
|
5
|
+
border: 1px solid var(--dx-g-gray-90);
|
|
6
|
+
border-radius: 0.3125rem;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
header {
|
|
10
|
+
display: flex;
|
|
11
|
+
align-items: flex-start;
|
|
12
|
+
justify-content: space-between;
|
|
13
|
+
border-radius: 0.3125rem 0.3125rem 0 0;
|
|
14
|
+
background-color: var(--dx-g-gray-95);
|
|
15
|
+
font-family: var(--dx-g-font-sans);
|
|
16
|
+
color: var(--dx-g-gray-10);
|
|
17
|
+
padding: var(--dx-g-spacing-sm);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
header span {
|
|
21
|
+
padding: var(--dx-g-spacing-sm) var(--dx-g-spacing-md);
|
|
22
|
+
font-size: var(--dx-g-text-sm);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
footer {
|
|
26
|
+
border-radius: 0 0 0.3125rem 0.3125rem;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.body {
|
|
30
|
+
margin: var(--dx-g-spacing-md);
|
|
31
|
+
overflow-x: auto;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.body img {
|
|
35
|
+
min-width: 650px;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.controls {
|
|
39
|
+
display: flex;
|
|
40
|
+
align-items: center;
|
|
41
|
+
justify-content: flex-end;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/* Breakpoints for mobile */
|
|
45
|
+
|
|
46
|
+
@media screen and (max-width: 640px) {
|
|
47
|
+
header {
|
|
48
|
+
flex-direction: column;
|
|
49
|
+
align-items: flex-end;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
@media screen and (max-width: 320px) {
|
|
54
|
+
.controls,
|
|
55
|
+
.controls dx-dropdown,
|
|
56
|
+
.controls dx-button {
|
|
57
|
+
width: 100%;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<article>
|
|
3
|
+
<header>
|
|
4
|
+
<span>{title}</span>
|
|
5
|
+
<div class="controls">
|
|
6
|
+
<template if:true={isSingleDownload}>
|
|
7
|
+
<dx-button
|
|
8
|
+
icon-symbol="download"
|
|
9
|
+
href={singleDownloadHref}
|
|
10
|
+
download={singleDownloadFilename}
|
|
11
|
+
>
|
|
12
|
+
{downloadButtonLabel}
|
|
13
|
+
</dx-button>
|
|
14
|
+
</template>
|
|
15
|
+
<template if:false={isSingleDownload}>
|
|
16
|
+
<dx-dropdown
|
|
17
|
+
options={urls}
|
|
18
|
+
onchange={handleDownloadOptionChange}
|
|
19
|
+
placement="bottom-end"
|
|
20
|
+
>
|
|
21
|
+
<dx-button variant="primary" icon-symbol="chevrondown">
|
|
22
|
+
{downloadButtonLabel}
|
|
23
|
+
</dx-button>
|
|
24
|
+
</dx-dropdown>
|
|
25
|
+
</template>
|
|
26
|
+
</div>
|
|
27
|
+
</header>
|
|
28
|
+
<div class="body">
|
|
29
|
+
<img src={featuredSrc} alt={title} />
|
|
30
|
+
</div>
|
|
31
|
+
</article>
|
|
32
|
+
</template>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { html } from "lit-html";
|
|
2
|
+
import { mockMultipleDownloadProps } from "./__tests__/mockProps";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: "dx/dx-interactive-image",
|
|
6
|
+
component: "dx-interactive-image"
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
// prettier-ignore
|
|
10
|
+
const createStyles = () => html `
|
|
11
|
+
<style>
|
|
12
|
+
#root {
|
|
13
|
+
max-width: 800px;
|
|
14
|
+
}
|
|
15
|
+
</style>`;
|
|
16
|
+
|
|
17
|
+
const urls = JSON.stringify(mockMultipleDownloadProps.downloadUrls);
|
|
18
|
+
|
|
19
|
+
export const SingleDownload = () => html` ${createStyles()}
|
|
20
|
+
<dx-interactive-image
|
|
21
|
+
title="Lorem ipsum dolor sit amet, consectetuer adipiscing elit. "
|
|
22
|
+
featured-src="https://i.imgur.com/FUsyxR5.jpg"
|
|
23
|
+
download-urls="https://i.imgur.com/FUsyxR5.jpg"
|
|
24
|
+
></dx-interactive-image>`;
|
|
25
|
+
|
|
26
|
+
export const MultipleDownloads = () => html` ${createStyles()}
|
|
27
|
+
<dx-interactive-image
|
|
28
|
+
title="Lorem ipsum dolor sit amet, consectetuer adipiscing elit. "
|
|
29
|
+
featured-src="https://i.imgur.com/FUsyxR5.jpg"
|
|
30
|
+
download-urls="${urls}"
|
|
31
|
+
></dx-interactive-image>`;
|