@salesforcedevs/dx-components 0.3.12 → 0.3.14-banner-alpha1
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/lwc.config.json +56 -19
- package/package.json +20 -12
- package/src/assets/icons/salesforcebrand-sprite/svg/symbols.svg +528 -79
- package/src/assets/svg/big-moon.svg +1 -0
- package/src/assets/svg/blue-circle.svg +3 -0
- package/src/assets/svg/docs-empty-state-small.svg +72 -0
- package/src/assets/svg/featured-demo-art-blank.svg +76 -0
- package/src/assets/svg/login-widget-bg.png +0 -0
- package/src/assets/svg/no-results-combined.svg +80 -0
- package/src/assets/svg/sidebar-item-loading.svg +3 -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/subscribe-background-left.svg +14 -0
- package/src/assets/svg/subscribe-background-right.svg +11 -0
- package/src/assets/svg/trial-left.svg +6 -0
- package/src/assets/svg/trial-right.svg +26 -0
- package/src/modules/dx/banner/banner.css +31 -457
- package/src/modules/dx/banner/banner.html +9 -37
- package/src/modules/dx/banner/banner.ts +7 -125
- package/src/modules/dx/breadcrumbs/breadcrumbs.css +18 -22
- package/src/modules/dx/breadcrumbs/breadcrumbs.html +7 -9
- package/src/modules/dx/breadcrumbs/breadcrumbs.ts +47 -32
- package/src/modules/dx/button/button.css +46 -19
- package/src/modules/dx/button/button.ts +6 -1
- package/src/modules/dx/buttonToggle/buttonToggle.css +50 -0
- package/src/modules/dx/buttonToggle/buttonToggle.html +17 -0
- package/src/modules/dx/buttonToggle/buttonToggle.ts +75 -0
- package/src/modules/dx/cardBlogPost/cardBlogPost.css +2 -2
- package/src/modules/dx/cardCallout/cardCallout.css +10 -4
- package/src/modules/dx/cardCallout/cardCallout.ts +13 -9
- package/src/modules/dx/cardContent/cardContent.css +8 -5
- package/src/modules/dx/cardContent/cardContent.html +4 -1
- package/src/modules/dx/cardContent/cardContent.ts +4 -2
- package/src/modules/dx/cardDemo/cardDemo.css +1 -1
- package/src/modules/dx/cardDocs/cardDocs.css +4 -3
- package/src/modules/dx/cardDocs/cardDocs.html +4 -1
- package/src/modules/dx/cardDocs/cardDocs.ts +1 -1
- package/src/modules/dx/cardEvent/cardEvent.css +21 -3
- package/src/modules/dx/cardEvent/cardEvent.html +18 -4
- package/src/modules/dx/cardEvent/cardEvent.ts +8 -0
- package/src/modules/dx/cardExpanded/cardExpanded.css +50 -0
- package/src/modules/dx/cardExpanded/cardExpanded.html +31 -0
- package/src/modules/dx/cardExpanded/cardExpanded.ts +44 -0
- package/src/modules/dx/cardGridDocs/cardGridDocs.css +74 -0
- package/src/modules/dx/cardGridDocs/cardGridDocs.html +67 -0
- package/src/modules/dx/cardGridDocs/cardGridDocs.ts +86 -0
- package/src/modules/dx/cardMinimal/cardMinimal.css +31 -0
- package/src/modules/dx/cardMinimal/cardMinimal.html +8 -0
- package/src/modules/dx/cardMinimal/cardMinimal.ts +3 -0
- package/src/modules/dx/cardNews/cardNews.css +5 -5
- package/src/modules/dx/cardNews/cardNews.html +2 -0
- package/src/modules/dx/cardNews/cardNews.ts +16 -1
- package/src/modules/dx/cardPodcastEpisode/cardPodcastEpisode.css +3 -3
- package/src/modules/dx/cardPodcastEpisode/cardPodcastEpisode.html +1 -1
- package/src/modules/dx/cardSmall/cardSmall.css +7 -3
- package/src/modules/dx/cardSmall/cardSmall.ts +1 -1
- package/src/modules/dx/cardTitle/cardTitle.css +5 -3
- package/src/modules/dx/cardTitle/cardTitle.html +18 -16
- package/src/modules/dx/cardTrailheadModule/cardTrailheadModule.css +2 -2
- package/src/modules/dx/cardTrial/cardTrial.css +130 -0
- package/src/modules/dx/cardTrial/cardTrial.html +115 -0
- package/src/modules/dx/cardTrial/cardTrial.ts +102 -0
- package/src/modules/dx/cardTrialExpanded/cardTrialExpanded.css +149 -0
- package/src/modules/dx/cardTrialExpanded/cardTrialExpanded.html +85 -0
- package/src/modules/dx/cardTrialExpanded/cardTrialExpanded.ts +67 -0
- package/src/modules/dx/cardVideoPreview/cardVideoPreview.css +2 -2
- package/src/modules/dx/cardVideoPreview/cardVideoPreview.html +2 -0
- package/src/modules/dx/cardVideoPreview/cardVideoPreview.ts +2 -1
- package/src/modules/dx/checkbox/checkbox.css +39 -9
- package/src/modules/dx/checkbox/checkbox.html +24 -11
- package/src/modules/dx/checkbox/checkbox.ts +38 -5
- package/src/modules/dx/checkboxGroup/checkboxGroup.css +1 -1
- package/src/modules/dx/checkboxGroup/checkboxGroup.ts +1 -1
- package/src/modules/dx/checkboxNative/checkboxNative.css +21 -0
- package/src/modules/dx/checkboxNative/checkboxNative.html +14 -0
- package/src/modules/dx/checkboxNative/checkboxNative.ts +39 -0
- package/src/modules/dx/codeBlock/codeBlock.css +2 -2
- package/src/modules/dx/codeBlock/codeBlock.html +6 -4
- package/src/modules/dx/codeBlock/codeBlock.ts +91 -53
- package/src/modules/dx/codeBlock/darkTheme.css +0 -1
- package/src/modules/dx/codeBlock/lightTheme.css +0 -1
- package/src/modules/dx/dropdown/dropdown.css +7 -2
- package/src/modules/dx/dropdown/dropdown.html +20 -13
- package/src/modules/dx/dropdown/dropdown.ts +51 -24
- package/src/modules/dx/dropdownOption/dropdownOption.css +121 -3
- package/src/modules/dx/dropdownOption/dropdownOption.html +4 -0
- package/src/modules/dx/dropdownOption/dropdownOption.ts +43 -10
- package/src/modules/dx/emptyState/emptyState.css +48 -15
- package/src/modules/dx/emptyState/emptyState.html +6 -4
- package/src/modules/dx/emptyState/emptyState.ts +11 -20
- package/src/modules/dx/feature/feature.css +31 -2
- package/src/modules/dx/feature/feature.html +19 -3
- package/src/modules/dx/feature/feature.ts +8 -3
- package/src/modules/dx/featuredContentHeader/featuredContentHeader.css +105 -41
- package/src/modules/dx/featuredContentHeader/featuredContentHeader.html +107 -71
- package/src/modules/dx/featuredContentHeader/featuredContentHeader.ts +41 -18
- package/src/modules/dx/featuredContentHeader/svgs.ts +10 -497
- package/src/modules/dx/featuresList/featuresList.css +3 -3
- package/src/modules/dx/featuresList/featuresList.html +15 -10
- package/src/modules/dx/featuresList/featuresList.ts +1 -1
- package/src/modules/dx/filterMenu/filterMenu.css +138 -0
- package/src/modules/dx/filterMenu/filterMenu.html +116 -0
- package/src/modules/dx/filterMenu/filterMenu.ts +119 -0
- package/src/modules/dx/footer/footer.css +6 -10
- package/src/modules/dx/footer/footer.html +38 -29
- package/src/modules/dx/footer/footer.ts +67 -24
- package/src/modules/dx/footer/links.ts +110 -42
- package/src/modules/dx/footerOption/footerOption.css +4 -0
- package/src/modules/dx/footerOption/footerOption.ts +5 -4
- package/src/modules/dx/formattedDateTime/formattedDateTime.ts +5 -0
- package/src/modules/dx/grid/grid.css +7 -10
- package/src/modules/dx/grid/grid.md +14 -0
- package/src/modules/dx/grid/grid.ts +7 -9
- package/src/modules/dx/groupText/groupText.css +2 -2
- package/src/modules/dx/groupText/groupText.html +6 -1
- package/src/modules/dx/groupText/groupText.ts +21 -2
- package/src/modules/dx/header/header.css +25 -166
- package/src/modules/dx/header/header.html +37 -26
- package/src/modules/dx/header/header.ts +10 -180
- package/src/modules/dx/headerMobileNavMenu/headerMobileNavMenu.css +29 -12
- package/src/modules/dx/headerMobileNavMenu/headerMobileNavMenu.ts +6 -6
- package/src/modules/dx/headerMobileNavMenuOption/headerMobileNavMenuOption.ts +5 -4
- package/src/modules/dx/headerNav/headerNav.css +1 -45
- package/src/modules/dx/headerNav/headerNav.html +23 -20
- package/src/modules/dx/headerNav/headerNav.ts +32 -9
- package/src/modules/dx/headerSearch/headerSearch.css +1 -37
- package/src/modules/dx/headerSearch/headerSearch.html +6 -25
- package/src/modules/dx/headerSearch/headerSearch.ts +47 -50
- package/src/modules/dx/helmet/helmet.css +2 -2
- package/src/modules/dx/hr/hr.css +11 -9
- package/src/modules/dx/hr/hr.html +6 -12
- package/src/modules/dx/hr/hr.ts +11 -12
- package/src/modules/dx/icon/icon.css +1 -1
- package/src/modules/dx/icon/icon.ts +1 -1
- package/src/modules/dx/iconBadge/iconBadge.css +13 -1
- package/src/modules/dx/iconBadge/iconBadge.html +2 -7
- package/src/modules/dx/iconBadge/iconBadge.ts +16 -6
- package/src/modules/dx/imageAndLabel/imageAndLabel.css +3 -4
- package/src/modules/dx/imageAndLabel/imageAndLabel.html +14 -2
- package/src/modules/dx/input/input.css +68 -4
- package/src/modules/dx/input/input.html +27 -2
- package/src/modules/dx/input/input.ts +108 -32
- package/src/modules/dx/interactiveImage/interactiveImage.css +2 -2
- package/src/modules/dx/logo/logo.css +32 -0
- package/src/modules/dx/logo/logo.html +6 -0
- package/src/modules/dx/logo/logo.ts +8 -0
- package/src/modules/dx/metadataBadge/metadataBadge.css +41 -0
- package/src/modules/dx/metadataBadge/metadataBadge.html +5 -0
- package/src/modules/dx/metadataBadge/metadataBadge.ts +24 -0
- package/src/modules/dx/modal/modal.css +40 -0
- package/src/modules/dx/modal/modal.html +10 -0
- package/src/modules/dx/modal/modal.ts +50 -0
- package/src/modules/dx/modalDrawer/modalDrawer.css +41 -0
- package/src/modules/dx/modalDrawer/modalDrawer.html +11 -0
- package/src/modules/dx/modalDrawer/modalDrawer.ts +33 -0
- package/src/modules/dx/pagination/pagination.css +2 -3
- package/src/modules/dx/pagination/pagination.ts +50 -8
- package/src/modules/dx/podcastHost/podcastHost.css +2 -2
- package/src/modules/dx/podcastHost/podcastHost.html +2 -2
- package/src/modules/dx/popover/popover.css +29 -4
- package/src/modules/dx/popover/popover.html +2 -2
- package/src/modules/dx/popover/popover.ts +121 -86
- package/src/modules/dx/radioGroup/radioGroup.css +1 -1
- package/src/modules/dx/radioGroup/radioGroup.ts +1 -1
- package/src/modules/dx/searchResults/coveo.css +314 -111
- package/src/modules/dx/searchResults/searchResults.css +2 -2
- package/src/modules/dx/searchResults/searchResults.html +10 -11
- package/src/modules/dx/searchResults/searchResults.ts +41 -20
- package/src/modules/dx/section/section.css +15 -12
- package/src/modules/dx/section/section.html +1 -1
- package/src/modules/dx/section/section.ts +11 -11
- package/src/modules/dx/sectionSignup/sectionSignup.html +0 -1
- package/src/modules/dx/select/select.css +221 -0
- package/src/modules/dx/select/select.html +57 -0
- package/src/modules/dx/select/select.ts +141 -0
- package/src/modules/dx/sidebar/sidebar.css +27 -144
- package/src/modules/dx/sidebar/sidebar.html +63 -40
- package/src/modules/dx/sidebar/sidebar.ts +156 -69
- package/src/modules/dx/sidebarOld/sidebarOld.css +16 -0
- package/src/modules/dx/sidebarOld/sidebarOld.html +74 -0
- package/src/modules/dx/sidebarOld/sidebarOld.ts +194 -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 +463 -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/socials/socials.ts +1 -1
- package/src/modules/dx/spinner/spinner.css +743 -0
- package/src/modules/dx/spinner/spinner.html +6 -0
- package/src/modules/dx/spinner/spinner.ts +20 -0
- package/src/modules/dx/tab/tab.css +88 -17
- package/src/modules/dx/tab/tab.html +10 -12
- package/src/modules/dx/tab/tab.ts +35 -28
- package/src/modules/dx/tabPanel/tabPanel.css +12 -1
- package/src/modules/dx/tabPanelItem/tabPanelItem.css +39 -0
- package/src/modules/dx/tabPanelItem/tabPanelItem.html +15 -0
- package/src/modules/dx/tabPanelItem/tabPanelItem.ts +39 -0
- package/src/modules/dx/tabPanelList/tabPanelList.css +35 -0
- package/src/modules/dx/tabPanelList/tabPanelList.html +47 -0
- package/src/modules/dx/{tabs/tabs.ts → tabPanelList/tabPanelList.ts} +56 -4
- package/src/modules/dx/{tabs → tabPanelList}/uniqueId.ts +0 -0
- package/src/modules/dx/tbidAvatarButton/tbidAvatarButton.css +33 -0
- package/src/modules/dx/tbidAvatarButton/tbidAvatarButton.html +53 -0
- package/src/modules/dx/tbidAvatarButton/tbidAvatarButton.ts +440 -0
- package/src/modules/dx/toc/toc.css +16 -3
- package/src/modules/dx/toc/toc.html +1 -0
- package/src/modules/dx/toc/toc.ts +1 -1
- package/src/modules/dx/tooltip/microtip.css +269 -0
- package/src/modules/dx/tooltip/tooltip.css +23 -10
- package/src/modules/dx/tooltip/tooltip.html +1 -1
- package/src/modules/dx/tooltip/tooltip.ts +3 -39
- package/src/modules/dx/topics/topics.css +26 -0
- package/src/modules/dx/topics/topics.html +12 -0
- package/src/modules/dx/topics/topics.ts +25 -0
- package/src/modules/dx/tree/tree.css +1 -1
- package/src/modules/dx/tree/tree.ts +9 -1
- package/src/modules/dx/tree/treeHandler.ts +1 -0
- package/src/modules/dx/treeItem/treeItem.css +12 -1
- package/src/modules/dx/treeItem/treeItem.html +10 -11
- package/src/modules/dx/treeItem/treeItem.ts +64 -9
- package/src/modules/dx/treeTile/treeTile.css +63 -54
- package/src/modules/dx/treeTile/treeTile.html +13 -9
- package/src/modules/dx/treeTile/treeTile.ts +25 -5
- package/src/modules/dx/typeBadge/typeBadge.css +20 -43
- package/src/modules/dx/typeBadge/typeBadge.html +7 -1
- package/src/modules/dx/typeBadge/typeBadge.ts +155 -8
- package/src/modules/dx/vimeoPlayer/vimeoPlayer.css +1 -0
- package/src/modules/dx/vimeoPlayer/vimeoPlayer.html +3 -0
- package/src/modules/dx/vimeoPlayer/vimeoPlayer.ts +31 -0
- package/src/modules/dxBaseElements/archiveCard/archiveCard.ts +31 -0
- package/src/modules/dxBaseElements/headerBase/headerBase.ts +215 -0
- package/src/modules/dxBaseElements/matchMediaElement/matchMediaElement.ts +59 -0
- package/src/modules/dxBaseElements/sidebarBase/sidebarBase.ts +65 -0
- package/src/modules/dxConstants/brands/brands.ts +14 -0
- package/src/modules/dxConstants/colors/colors.ts +14 -0
- package/src/modules/dxConstants/contentTypes/contentTypes.ts +10 -0
- package/src/modules/{helpers → dxHelpers}/animations/animations.css +0 -0
- package/src/modules/{helpers → dxHelpers}/button/button.css +0 -0
- package/src/modules/{helpers → dxHelpers}/card/card.css +36 -13
- package/src/modules/{helpers → dxHelpers}/code/code.css +0 -0
- package/src/modules/dxHelpers/commonHeader/commonHeader.css +131 -0
- package/src/modules/dxHelpers/commonSidebar/commonSidebar.css +145 -0
- package/src/modules/dxHelpers/commonTreeItem/commonTreeItem.css +21 -0
- package/src/modules/{helpers → dxHelpers}/reset/reset.css +0 -0
- package/src/modules/dxHelpers/scrollbar/scrollbar.css +31 -0
- package/src/modules/{helpers → dxHelpers}/table/table.css +24 -8
- package/src/modules/{helpers → dxHelpers}/text/text.css +48 -0
- package/src/modules/dxUtils/analytics/analytics.ts +24 -0
- package/src/modules/dxUtils/async/async.ts +45 -0
- package/src/modules/dxUtils/browser/browser.ts +17 -0
- package/src/modules/dxUtils/constants/breakpoints.ts +9 -0
- package/src/modules/dxUtils/constants/constants.ts +1 -0
- package/src/modules/dxUtils/coveo/coveo.ts +70 -0
- package/src/modules/dxUtils/css/css.ts +53 -0
- package/src/modules/dxUtils/dates/dates.ts +60 -0
- package/src/modules/{utils → dxUtils}/devices/devices.ts +0 -0
- package/src/modules/dxUtils/highlight/highlight.ts +32 -0
- package/src/modules/dxUtils/language/language.ts +21 -0
- package/src/modules/dxUtils/lwc/lwc.ts +9 -0
- package/src/modules/{utils → dxUtils}/normalizers/normalizers.ts +15 -23
- package/src/modules/{utils → dxUtils}/options/options.ts +13 -9
- package/src/modules/{utils → dxUtils}/prismjs/prismjs.html +0 -0
- package/src/modules/dxUtils/prismjs/prismjs.ts +3937 -0
- package/src/modules/dxUtils/queryCoordinator/queryCoordinator.ts +43 -0
- package/src/modules/dxUtils/recentSearches/recentSearches.ts +57 -0
- package/src/modules/dxUtils/regexps/regexps.ts +5 -0
- package/src/modules/dxUtils/seo/seo.ts +4 -0
- package/src/modules/{utils → dxUtils}/slot/slot.ts +0 -0
- package/src/modules/{utils → dxUtils}/wordpress/wordpress.ts +0 -0
- package/LICENSE +0 -12
- package/src/modules/dx/banner/__tests__/banner.test.ts +0 -80
- package/src/modules/dx/banner/banner.stories.ts +0 -121
- package/src/modules/dx/banner/svgs.ts +0 -1107
- package/src/modules/dx/brandThemeProvider/__tests__/brandThemeProvider.test.ts +0 -49
- package/src/modules/dx/brandThemeProvider/brandThemeProvider.stories.ts +0 -321
- package/src/modules/dx/breadcrumbs/__tests__/breadcrumbs.test.ts +0 -82
- package/src/modules/dx/breadcrumbs/__tests__/mockProps.ts +0 -28
- package/src/modules/dx/breadcrumbs/breadcrumbs.stories.ts +0 -13
- package/src/modules/dx/button/__tests__/button.test.ts +0 -107
- package/src/modules/dx/button/button.stories.ts +0 -150
- package/src/modules/dx/cardBlogPost/__tests__/cardBlogPost.test.ts +0 -27
- package/src/modules/dx/cardBlogPost/__tests__/mockProps.ts +0 -12
- package/src/modules/dx/cardBlogPost/cardBlogPost.stories.ts +0 -164
- package/src/modules/dx/cardBlogPostProvider/__tests__/cardBlogPostProvider.test.ts +0 -34
- package/src/modules/dx/cardBlogPostProvider/__tests__/mockWordpressPosts.ts +0 -44
- package/src/modules/dx/cardBlogPostProvider/cardBlogPostProvider.css +0 -3
- package/src/modules/dx/cardBlogPostProvider/cardBlogPostProvider.html +0 -16
- package/src/modules/dx/cardBlogPostProvider/cardBlogPostProvider.ts +0 -29
- package/src/modules/dx/cardCallout/__tests__/cardCallout.test.ts +0 -23
- package/src/modules/dx/cardCallout/__tests__/mockProps.ts +0 -7
- package/src/modules/dx/cardCallout/cardCallout.stories.ts +0 -33
- package/src/modules/dx/cardContent/__tests__/cardContent.test.ts +0 -112
- package/src/modules/dx/cardContent/__tests__/mockProps.ts +0 -13
- package/src/modules/dx/cardContent/cardContent.stories.ts +0 -109
- package/src/modules/dx/cardDemo/cardDemo.stories.ts +0 -115
- package/src/modules/dx/cardDocs/__tests__/cardDocs.test.ts +0 -48
- package/src/modules/dx/cardDocs/__tests__/mockProps.ts +0 -9
- package/src/modules/dx/cardDocs/cardDocs.stories.ts +0 -299
- package/src/modules/dx/cardEvent/__tests__/cardEvent.test.ts +0 -70
- package/src/modules/dx/cardEvent/__tests__/mockProps.ts +0 -9
- package/src/modules/dx/cardEvent/cardEvent.stories.ts +0 -143
- package/src/modules/dx/cardNews/__tests__/cardNews.test.ts +0 -59
- package/src/modules/dx/cardNews/__tests__/mockProps.ts +0 -7
- package/src/modules/dx/cardNews/cardNews.stories.ts +0 -115
- package/src/modules/dx/cardPodcastEpisode/__tests__/cardPodcastEpisode.test.ts +0 -70
- package/src/modules/dx/cardPodcastEpisode/cardPodcastEpisode.stories.ts +0 -31
- package/src/modules/dx/cardPodcastEpisodeProvider/__tests__/cardPodcastEpisodeProvider.test.ts +0 -36
- package/src/modules/dx/cardPodcastEpisodeProvider/__tests__/mockWordpressEpisodes.ts +0 -50
- package/src/modules/dx/cardPodcastEpisodeProvider/cardPodcastEpisodeProvider.css +0 -3
- package/src/modules/dx/cardPodcastEpisodeProvider/cardPodcastEpisodeProvider.html +0 -12
- package/src/modules/dx/cardPodcastEpisodeProvider/cardPodcastEpisodeProvider.ts +0 -29
- package/src/modules/dx/cardSmall/__tests__/cardSmall.test.ts +0 -70
- package/src/modules/dx/cardSmall/__tests__/mockProps.ts +0 -8
- package/src/modules/dx/cardSmall/cardSmall.stories.ts +0 -166
- package/src/modules/dx/cardTitle/__tests__/cardTitle.test.ts +0 -46
- package/src/modules/dx/cardTrailheadModule/__tests__/cardTrailheadModule.test.ts +0 -18
- package/src/modules/dx/cardTrailheadModule/__tests__/mockProps.ts +0 -11
- package/src/modules/dx/cardTrailheadModule/cardTrailheadModule.stories.ts +0 -122
- package/src/modules/dx/cardVideoPreview/__tests__/cardVideoPreview.test.ts +0 -22
- package/src/modules/dx/cardVideoPreview/__tests__/mockProps.ts +0 -11
- package/src/modules/dx/cardVideoPreview/cardVideoPreview.stories.ts +0 -132
- package/src/modules/dx/checkbox/__tests__/checkbox.test.ts +0 -56
- package/src/modules/dx/checkbox/__tests__/mockProps.ts +0 -5
- package/src/modules/dx/checkbox/checkbox.stories.ts +0 -12
- package/src/modules/dx/checkboxGroup/__tests__/checkboxGroup.test.ts +0 -80
- package/src/modules/dx/checkboxGroup/__tests__/mockProps.ts +0 -14
- package/src/modules/dx/checkboxGroup/checkboxGroup.stories.ts +0 -33
- package/src/modules/dx/codeBlock/__tests__/codeBlock.test.ts +0 -96
- package/src/modules/dx/codeBlock/__tests__/mockProps.ts +0 -157
- package/src/modules/dx/codeBlock/codeBlock.stories.ts +0 -216
- package/src/modules/dx/dropdown/__tests__/dropdown.test.ts +0 -194
- package/src/modules/dx/dropdown/__tests__/mockNestedOptions.ts +0 -96
- package/src/modules/dx/dropdown/__tests__/mockOptions.ts +0 -10
- package/src/modules/dx/dropdown/__tests__/mockProps.ts +0 -6
- package/src/modules/dx/dropdown/dropdown.stories.ts +0 -75
- package/src/modules/dx/dropdownOption/__tests__/dropdownOption.test.ts +0 -82
- package/src/modules/dx/dropdownOption/__tests__/mockProps.ts +0 -20
- package/src/modules/dx/emptyState/__tests__/emptyState.test.ts +0 -33
- package/src/modules/dx/emptyState/__tests__/mockProps.ts +0 -6
- package/src/modules/dx/emptyState/emptyState.stories.ts +0 -65
- package/src/modules/dx/feature/__tests__/feature.test.ts +0 -30
- package/src/modules/dx/feature/__tests__/mockProps.ts +0 -8
- package/src/modules/dx/featureGrid/__tests__/featureGrid.test.ts +0 -21
- package/src/modules/dx/featureGrid/featureGrid.stories.ts +0 -81
- package/src/modules/dx/featuredContentHeader/__tests__/featuredContentHeader.test.ts +0 -113
- package/src/modules/dx/featuredContentHeader/__tests__/mockProps.ts +0 -43
- package/src/modules/dx/featuredContentHeader/featuredContentHeader.stories.ts +0 -153
- package/src/modules/dx/featuresList/__tests__/featuresList.test.ts +0 -47
- package/src/modules/dx/featuresList/__tests__/mockProps.ts +0 -17
- package/src/modules/dx/featuresList/featuresList.stories.ts +0 -30
- package/src/modules/dx/footer/__tests__/footer.test.ts +0 -136
- package/src/modules/dx/footer/__tests__/mockLocales.ts +0 -7
- package/src/modules/dx/footer/footer.stories.ts +0 -70
- package/src/modules/dx/footerOption/__tests__/footerOption.test.ts +0 -34
- package/src/modules/dx/footerOption/__tests__/mockProps.ts +0 -7
- package/src/modules/dx/formattedDateTime/__tests__/formattedDateTime.test.ts +0 -25
- package/src/modules/dx/formattedDateTime/__tests__/mockProps.ts +0 -13
- package/src/modules/dx/formattedDateTime/formattedDateTime.stories.ts +0 -103
- package/src/modules/dx/grid/__tests__/grid.test.ts +0 -45
- package/src/modules/dx/grid/grid.stories.ts +0 -128
- package/src/modules/dx/groupBio/__tests__/groupBio.test.ts +0 -82
- package/src/modules/dx/groupBio/__tests__/mockProps.ts +0 -15
- package/src/modules/dx/groupBio/groupBio.css +0 -49
- package/src/modules/dx/groupBio/groupBio.html +0 -29
- package/src/modules/dx/groupBio/groupBio.stories.ts +0 -66
- package/src/modules/dx/groupBio/groupBio.ts +0 -41
- package/src/modules/dx/groupText/__tests__/groupText.test.ts +0 -57
- package/src/modules/dx/groupText/__tests__/mockProps.ts +0 -35
- package/src/modules/dx/groupText/groupText.stories.ts +0 -81
- package/src/modules/dx/headTags/headTags.html +0 -1
- package/src/modules/dx/headTags/headTags.ts +0 -13
- package/src/modules/dx/header/__tests__/header.test.ts +0 -194
- package/src/modules/dx/header/__tests__/mockNavArchitects.ts +0 -169
- package/src/modules/dx/header/__tests__/mockNavDevelopers.ts +0 -419
- package/src/modules/dx/header/__tests__/mockNavs.ts +0 -115
- package/src/modules/dx/header/__tests__/mockProps.ts +0 -173
- package/src/modules/dx/header/header.stories.ts +0 -136
- package/src/modules/dx/headerMobileNavMenu/__tests__/headerMobileNavMenu.test.ts +0 -123
- package/src/modules/dx/headerMobileNavMenuOption/__tests__/headerMobileNavMenuOption.test.ts +0 -38
- package/src/modules/dx/headerNav/__tests__/headerNav.test.ts +0 -50
- package/src/modules/dx/headerNavOption/__tests__/headerNavOption.test.ts +0 -47
- package/src/modules/dx/headerNavOption/headerNavOption.css +0 -38
- package/src/modules/dx/headerNavOption/headerNavOption.html +0 -5
- package/src/modules/dx/headerNavOption/headerNavOption.ts +0 -15
- package/src/modules/dx/headerSearch/__tests__/headerSearch.test.ts +0 -273
- package/src/modules/dx/headerSearch/__tests__/mockData.ts +0 -11
- package/src/modules/dx/headerSearch/__tests__/mockProps.ts +0 -11
- package/src/modules/dx/headerSearch/scopes.ts +0 -10
- package/src/modules/dx/helmet/__tests__/helmet.test.ts +0 -53
- package/src/modules/dx/helmet/helmet.stories.ts +0 -53
- package/src/modules/dx/hr/__tests__/hr.test.ts +0 -77
- package/src/modules/dx/hr/__tests__/mockProps.ts +0 -18
- package/src/modules/dx/hr/hr.stories.ts +0 -55
- package/src/modules/dx/icon/__tests__/icon.test.ts +0 -54
- package/src/modules/dx/icon/icon.stories.ts +0 -98
- package/src/modules/dx/iconBadge/__tests__/iconBadge.test.ts +0 -17
- package/src/modules/dx/iconBadge/iconBadge.stories.ts +0 -32
- package/src/modules/dx/imageAndLabel/__tests__/imageAndLabel.test.ts +0 -39
- package/src/modules/dx/imageAndLabel/__tests__/mockProps.ts +0 -6
- package/src/modules/dx/imageAndLabel/imageAndLabel.stories.ts +0 -48
- package/src/modules/dx/input/__tests__/input.test.ts +0 -162
- package/src/modules/dx/input/input.stories.ts +0 -48
- package/src/modules/dx/instrumentation/__tests__/instrumentation.test.ts +0 -86
- package/src/modules/dx/instrumentation/instrumentation.html +0 -1
- package/src/modules/dx/instrumentation/instrumentation.ts +0 -116
- package/src/modules/dx/interactiveImage/__tests__/interactiveImage.test.ts +0 -76
- package/src/modules/dx/interactiveImage/__tests__/mockProps.ts +0 -42
- package/src/modules/dx/interactiveImage/interactiveImage.stories.ts +0 -31
- package/src/modules/dx/lazy/__tests__/lazy.test.ts +0 -43
- package/src/modules/dx/lazy/lazy.html +0 -5
- package/src/modules/dx/lazy/lazy.stories.ts +0 -132
- package/src/modules/dx/lazy/lazy.ts +0 -170
- package/src/modules/dx/pagination/__tests__/pagination.test.ts +0 -121
- package/src/modules/dx/pagination/pagination.stories.ts +0 -88
- package/src/modules/dx/podcastHost/__tests__/mockProps.ts +0 -8
- package/src/modules/dx/podcastHost/__tests__/podcastHost.test.ts +0 -21
- package/src/modules/dx/podcastHost/podcastHost.stories.ts +0 -17
- package/src/modules/dx/podcastPlayer/__tests__/podcastPlayer.test.ts +0 -20
- package/src/modules/dx/podcastPlayer/podcastPlayer.stories.ts +0 -13
- package/src/modules/dx/podcastSubscription/__tests__/podcastSubscription.test.ts +0 -16
- package/src/modules/dx/podcastSubscription/podcastSubscription.css +0 -92
- package/src/modules/dx/podcastSubscription/podcastSubscription.html +0 -24
- package/src/modules/dx/podcastSubscription/podcastSubscription.stories.ts +0 -23
- package/src/modules/dx/podcastSubscription/podcastSubscription.ts +0 -58
- package/src/modules/dx/popover/__tests__/popover.test.ts +0 -207
- package/src/modules/dx/popover/popover.stories.ts +0 -82
- package/src/modules/dx/radioGroup/__tests__/mockProps.ts +0 -12
- package/src/modules/dx/radioGroup/__tests__/radioGroup.test.ts +0 -42
- package/src/modules/dx/radioGroup/radioGroup.stories.ts +0 -25
- package/src/modules/dx/relativeDateTime/__tests__/mockProps.ts +0 -55
- package/src/modules/dx/relativeDateTime/__tests__/relativeDateTime.test.ts +0 -52
- package/src/modules/dx/relativeDateTime/relativeDateTime.stories.ts +0 -83
- package/src/modules/dx/searchResults/searchResults.stories.ts +0 -38
- package/src/modules/dx/section/__tests__/section.test.ts +0 -17
- package/src/modules/dx/section/section.stories.ts +0 -381
- package/src/modules/dx/sectionSignup/__tests__/sectionSignup.test.ts +0 -66
- package/src/modules/dx/sectionSignup/sectionSignup.stories.ts +0 -49
- package/src/modules/dx/sidebar/__tests__/mockProps.ts +0 -181
- package/src/modules/dx/sidebar/__tests__/sidebar.test.ts +0 -569
- package/src/modules/dx/sidebar/sidebar.stories.ts +0 -139
- package/src/modules/dx/socials/__tests__/socials.test.ts +0 -124
- package/src/modules/dx/socials/socials.stories.ts +0 -24
- package/src/modules/dx/tab/__tests__/mockProps.ts +0 -4
- package/src/modules/dx/tab/__tests__/tab.test.ts +0 -71
- package/src/modules/dx/tabPanel/__tests__/mockProps.ts +0 -4
- package/src/modules/dx/tabPanel/__tests__/tabPanel.test.ts +0 -46
- package/src/modules/dx/tabs/__tests__/mockProps.ts +0 -3
- package/src/modules/dx/tabs/__tests__/tabs.test.ts +0 -47
- package/src/modules/dx/tabs/tabs.css +0 -7
- package/src/modules/dx/tabs/tabs.html +0 -21
- package/src/modules/dx/tabs/tabs.stories.ts +0 -74
- package/src/modules/dx/toc/__tests__/mockProps.ts +0 -22
- package/src/modules/dx/toc/__tests__/toc.test.ts +0 -116
- package/src/modules/dx/toc/toc.stories.ts +0 -26
- package/src/modules/dx/tooltip/__tests__/tooltip.test.ts +0 -66
- package/src/modules/dx/tooltip/tippy.css +0 -1
- package/src/modules/dx/tooltip/tooltip.stories.ts +0 -65
- package/src/modules/dx/tree/__tests__/mockProps.ts +0 -215
- package/src/modules/dx/tree/__tests__/tree.test.ts +0 -357
- package/src/modules/dx/tree/__tests__/treeHandler.test.ts +0 -194
- package/src/modules/dx/tree/tree.stories.ts +0 -65
- package/src/modules/dx/treeItem/__tests__/mockProps.ts +0 -46
- package/src/modules/dx/treeItem/__tests__/treeItem.test.ts +0 -370
- package/src/modules/dx/treeTile/__tests__/mockProps.ts +0 -16
- package/src/modules/dx/treeTile/__tests__/treeTile.test.ts +0 -178
- package/src/modules/dx/typeBadge/__tests__/typeBadge.test.ts +0 -63
- package/src/modules/dx/typeBadge/typeBadge.stories.ts +0 -79
- package/src/modules/dx/typeBadgeGroup/__tests__/mockProps.ts +0 -11
- package/src/modules/dx/typeBadgeGroup/__tests__/typeBadgeGroup.test.ts +0 -76
- package/src/modules/dx/typeBadgeGroup/typeBadgeGroup.css +0 -12
- package/src/modules/dx/typeBadgeGroup/typeBadgeGroup.html +0 -11
- package/src/modules/dx/typeBadgeGroup/typeBadgeGroup.stories.ts +0 -19
- package/src/modules/dx/typeBadgeGroup/typeBadgeGroup.ts +0 -18
- package/src/modules/tests/buttonTest/buttonTest.html +0 -3
- package/src/modules/tests/buttonTest/buttonTest.ts +0 -3
- package/src/modules/tests/codeBlockTest/codeBlockTest.js +0 -4
- package/src/modules/tests/dropdownTest/dropdownTest.html +0 -5
- package/src/modules/tests/dropdownTest/dropdownTest.ts +0 -17
- package/src/modules/tests/featureGridTest/featureGridTest.html +0 -7
- package/src/modules/tests/featureGridTest/featureGridTest.ts +0 -5
- package/src/modules/tests/instrumentationTest/instrumentationTest.html +0 -4
- package/src/modules/tests/instrumentationTest/instrumentationTest.ts +0 -8
- package/src/modules/tests/popoverTest/popoverTest.html +0 -6
- package/src/modules/tests/popoverTest/popoverTest.ts +0 -5
- package/src/modules/utils/css/css.ts +0 -2
- package/src/modules/utils/jest/jest.ts +0 -13
- package/src/modules/utils/prismjs/prismjs.ts +0 -3225
- package/src/modules/utils/storybook/storybook.ts +0 -33
- package/src/modules/utils/tests/tests.ts +0 -14
- package/src/modules/utils/wordpress/__tests__/wordpress.test.ts +0 -15
|
@@ -1,15 +1,28 @@
|
|
|
1
|
-
import { LightningElement, api } from "lwc";
|
|
1
|
+
import { LightningElement, api, wire, track } from "lwc";
|
|
2
2
|
import { CodeBlockTheme, CodeBlockLanguage } from "typings/custom";
|
|
3
3
|
import cx from "classnames";
|
|
4
|
-
import Prism from "
|
|
4
|
+
import Prism from "dxUtils/prismjs";
|
|
5
|
+
import {
|
|
6
|
+
getLocalStorageData,
|
|
7
|
+
setLocalStorageData
|
|
8
|
+
} from "@sfdocs-internal/wires";
|
|
9
|
+
import { track as gtmTrack } from "dxUtils/analytics";
|
|
5
10
|
|
|
6
11
|
// Used por remove enclosing <pre> tag's (if occurs)
|
|
7
12
|
const preTagRegexp: RegExp = /^<pre.*?>(.*)<\/pre>$/is;
|
|
8
13
|
|
|
14
|
+
const LIGHT = "light";
|
|
15
|
+
const DARK = "dark";
|
|
16
|
+
const themes: CodeBlockTheme[] = [LIGHT, DARK];
|
|
17
|
+
const LOCAL_STORAGE_KEY = "dx-codeblock-theme";
|
|
18
|
+
|
|
9
19
|
export default class CodeBlock extends LightningElement {
|
|
20
|
+
@api defaultTheme: CodeBlockTheme = LIGHT;
|
|
10
21
|
@api title: string = "title";
|
|
11
22
|
@api sourceLink: string = "";
|
|
12
23
|
@api language: string = "";
|
|
24
|
+
// if it is true, it renders code as is coming instead of wrapping it into html/xml comments tags.
|
|
25
|
+
@api isEncoded = false;
|
|
13
26
|
|
|
14
27
|
private markupLangs = ["visualforce", "html", "xml"];
|
|
15
28
|
private _codeBlockRendered: boolean = false;
|
|
@@ -28,18 +41,32 @@ export default class CodeBlock extends LightningElement {
|
|
|
28
41
|
{ label: "Visualforce", id: "visualforce" },
|
|
29
42
|
{ label: "Html", id: "html" },
|
|
30
43
|
{ label: "xml", id: "xml" },
|
|
31
|
-
{ label: "TypeScript", id: "
|
|
32
|
-
{ label: "PHP", id: "php" }
|
|
44
|
+
{ label: "TypeScript", id: "typescript" },
|
|
45
|
+
{ label: "PHP", id: "php" },
|
|
46
|
+
{ label: "JSON", id: "json" },
|
|
47
|
+
{ label: "Swift", id: "swift" },
|
|
48
|
+
{ label: "Kotlin", id: "kotlin" },
|
|
49
|
+
{ label: "Python", id: "python" },
|
|
50
|
+
{ label: "Bash", id: "bash" },
|
|
51
|
+
{ label: "SQL", id: "sql" },
|
|
52
|
+
{ label: "YAML", id: "yaml" }
|
|
33
53
|
];
|
|
34
54
|
|
|
55
|
+
connectedCallback() {
|
|
56
|
+
if (!this.theme) {
|
|
57
|
+
this.theme = this.defaultTheme;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
35
61
|
_codeBlock: string = "";
|
|
36
62
|
@api
|
|
37
63
|
set codeBlock(value: string) {
|
|
38
64
|
this._codeBlockRendered = false;
|
|
39
65
|
let match;
|
|
40
|
-
this._codeBlock = (
|
|
41
|
-
|
|
42
|
-
|
|
66
|
+
this._codeBlock = (
|
|
67
|
+
(match = preTagRegexp.exec(value.trim())) === null
|
|
68
|
+
? value.trim()
|
|
69
|
+
: match[1]
|
|
43
70
|
).trim();
|
|
44
71
|
}
|
|
45
72
|
|
|
@@ -47,28 +74,22 @@ export default class CodeBlock extends LightningElement {
|
|
|
47
74
|
return this._codeBlock;
|
|
48
75
|
}
|
|
49
76
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
if (this._theme !== value && this.componentLoaded) {
|
|
57
|
-
this.updateTheme();
|
|
58
|
-
} else if (this._theme !== value && !this.componentLoaded) {
|
|
59
|
-
this._theme = value;
|
|
60
|
-
this.componentLoaded = true;
|
|
77
|
+
@track private theme: CodeBlockTheme | null = null;
|
|
78
|
+
|
|
79
|
+
@wire(getLocalStorageData, { key: "dx-codeblock-theme" })
|
|
80
|
+
updateThemeForCodeblock(value: any) {
|
|
81
|
+
if (themes.includes(value)) {
|
|
82
|
+
this.theme = value;
|
|
61
83
|
} else {
|
|
62
|
-
|
|
84
|
+
setLocalStorageData(
|
|
85
|
+
LOCAL_STORAGE_KEY,
|
|
86
|
+
this.theme || this.defaultTheme
|
|
87
|
+
);
|
|
63
88
|
}
|
|
64
89
|
}
|
|
65
90
|
|
|
66
|
-
get theme(): CodeBlockTheme {
|
|
67
|
-
return this._theme;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
91
|
get updateThemeBtnText(): string {
|
|
71
|
-
return `Switch to ${this.
|
|
92
|
+
return `Switch to ${this.theme === DARK ? "Light" : "Dark"} mode`;
|
|
72
93
|
}
|
|
73
94
|
|
|
74
95
|
get showCodeSourceBtn(): boolean {
|
|
@@ -76,21 +97,28 @@ export default class CodeBlock extends LightningElement {
|
|
|
76
97
|
}
|
|
77
98
|
|
|
78
99
|
get codeblocksClassname(): string {
|
|
79
|
-
return cx(`dx-theme-${this.
|
|
100
|
+
return cx(`dx-theme-${this.theme}`);
|
|
80
101
|
}
|
|
81
102
|
|
|
82
103
|
formatCodeBlock() {
|
|
83
104
|
const divEl = this.template.querySelector("div.code-block-content");
|
|
84
105
|
const templateEl = document.createElement("template");
|
|
85
|
-
if (
|
|
106
|
+
if (
|
|
107
|
+
!this.isEncoded &&
|
|
108
|
+
this.markupLangs.includes(this.selectedLanguage.id || "")
|
|
109
|
+
) {
|
|
86
110
|
// eslint-disable-next-line
|
|
87
|
-
templateEl.innerHTML = `<pre class='codeblock'
|
|
111
|
+
templateEl.innerHTML = `<pre class='codeblock'><!--${this.codeBlock.replace(
|
|
88
112
|
/<!--(.*?)-->/gs,
|
|
89
113
|
"@@$1##"
|
|
90
|
-
)}
|
|
114
|
+
)}--></pre>`;
|
|
91
115
|
} else {
|
|
92
116
|
// eslint-disable-next-line
|
|
93
|
-
|
|
117
|
+
const innerHtml = this.isEncoded
|
|
118
|
+
? this.codeBlock
|
|
119
|
+
: this.codeBlock.replace(/</g, "<").replace(/>/g, ">");
|
|
120
|
+
|
|
121
|
+
templateEl.innerHTML = `<pre class='codeblock'>${innerHtml}</pre>`;
|
|
94
122
|
}
|
|
95
123
|
const codeBlockEls = templateEl.content.querySelectorAll("pre");
|
|
96
124
|
codeBlockEls.forEach((codeBlockEl) => {
|
|
@@ -105,9 +133,12 @@ export default class CodeBlock extends LightningElement {
|
|
|
105
133
|
: this.selectedLanguage.id
|
|
106
134
|
}`
|
|
107
135
|
);
|
|
136
|
+
// for custom markup content, it is a workaround to be refactored later.
|
|
137
|
+
// eslint-disable-next-line
|
|
138
|
+
this.language !== "text"
|
|
139
|
+
? (codeEl.innerHTML = codeHTML)
|
|
140
|
+
: (codeEl.textContent = this._codeBlock.trim());
|
|
108
141
|
// eslint-disable-next-line
|
|
109
|
-
this.language !== 'text' ? codeEl.innerHTML = codeHTML : codeEl.textContent = codeHTML
|
|
110
|
-
// eslint-disable-next-line
|
|
111
142
|
codeBlockEl.innerHTML = "";
|
|
112
143
|
codeBlockEl.appendChild(codeEl);
|
|
113
144
|
Prism.highlightAllUnder(codeBlockEl);
|
|
@@ -140,32 +171,39 @@ export default class CodeBlock extends LightningElement {
|
|
|
140
171
|
this.formatCodeBlock();
|
|
141
172
|
}
|
|
142
173
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
}
|
|
174
|
+
/**
|
|
175
|
+
* Note: There is a known issue in storybook@6.1.13 where some apis are not available if you access Storybook through IP address.
|
|
176
|
+
* https://github.com/storybookjs/storybook/issues/13529
|
|
177
|
+
*/
|
|
178
|
+
async copySource(event: any) {
|
|
179
|
+
gtmTrack(event.target, "custEv_codeBlock", {
|
|
180
|
+
codeBlockAction: "copy"
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
try {
|
|
184
|
+
const snippetContainer: HTMLElement | null =
|
|
185
|
+
this.template.querySelector(".code-block-content");
|
|
186
|
+
if (snippetContainer && snippetContainer.textContent) {
|
|
187
|
+
await navigator.clipboard.writeText(
|
|
188
|
+
snippetContainer.textContent
|
|
189
|
+
);
|
|
190
|
+
this.copyBtnText = "Copied!";
|
|
191
|
+
setTimeout(() => {
|
|
192
|
+
this.copyBtnText = "Click to copy";
|
|
193
|
+
}, 2000);
|
|
163
194
|
}
|
|
195
|
+
} catch (error) {
|
|
196
|
+
console.error(error);
|
|
164
197
|
}
|
|
165
198
|
}
|
|
166
199
|
|
|
167
|
-
updateTheme() {
|
|
168
|
-
this.
|
|
200
|
+
updateTheme(event: any) {
|
|
201
|
+
this.theme = this.theme === DARK ? LIGHT : DARK;
|
|
202
|
+
setLocalStorageData(LOCAL_STORAGE_KEY, this.theme);
|
|
203
|
+
|
|
204
|
+
gtmTrack(event.target, "custEv_codeBlock", {
|
|
205
|
+
codeBlockAction: this.theme === DARK ? "darkmode" : "lightmode"
|
|
206
|
+
});
|
|
169
207
|
}
|
|
170
208
|
|
|
171
209
|
renderedCallback() {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
@import "
|
|
1
|
+
@import "dxHelpers/reset";
|
|
2
2
|
|
|
3
3
|
.menu-nested::part(content) {
|
|
4
4
|
padding-top: var(--dx-g-spacing-sm);
|
|
@@ -11,6 +11,10 @@
|
|
|
11
11
|
flex-wrap: nowrap;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
+
.menu-hidden::part(content) {
|
|
15
|
+
display: none;
|
|
16
|
+
}
|
|
17
|
+
|
|
14
18
|
@media screen and (max-width: 1000px) {
|
|
15
19
|
.menu-nested .menu_option:not(:first-child) {
|
|
16
20
|
border-top: var(--border);
|
|
@@ -73,11 +77,12 @@
|
|
|
73
77
|
}
|
|
74
78
|
|
|
75
79
|
.callout_link {
|
|
80
|
+
--dx-c-button-font-size: var(--dx-g-text-base);
|
|
81
|
+
|
|
76
82
|
display: block;
|
|
77
83
|
padding-top: var(--dx-g-spacing-xl);
|
|
78
84
|
margin-top: auto;
|
|
79
85
|
margin-left: var(--dx-g-spacing-sm);
|
|
80
|
-
font-size: var(--dx-g-text-base);
|
|
81
86
|
}
|
|
82
87
|
|
|
83
88
|
.empty {
|
|
@@ -4,8 +4,7 @@
|
|
|
4
4
|
class={className}
|
|
5
5
|
full-width={fullWidth}
|
|
6
6
|
offset={offset}
|
|
7
|
-
|
|
8
|
-
onopen={onOpen}
|
|
7
|
+
onclose={onClose}
|
|
9
8
|
open-on-hover={openOnHover}
|
|
10
9
|
open={open}
|
|
11
10
|
page-padding={pagePadding}
|
|
@@ -14,23 +13,27 @@
|
|
|
14
13
|
width={width}
|
|
15
14
|
>
|
|
16
15
|
<slot slot="control"></slot>
|
|
17
|
-
<div
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
if:false={areOptionsEmpty}
|
|
25
|
-
>
|
|
16
|
+
<div
|
|
17
|
+
class="menu_list"
|
|
18
|
+
if:false={areOptionsEmpty}
|
|
19
|
+
role={role}
|
|
20
|
+
slot="content"
|
|
21
|
+
>
|
|
22
|
+
<template for:each={options} for:item="option" for:index="index">
|
|
26
23
|
<dx-dropdown-option
|
|
24
|
+
suppress-gtm-nav-headings={suppressGtmNavHeadings}
|
|
25
|
+
analytics-event={analyticsEvent}
|
|
26
|
+
analytics-base-payload={analyticsBasePayload}
|
|
27
27
|
active={option.active}
|
|
28
|
+
key-value={option.keyValue}
|
|
28
29
|
if:false={option.options}
|
|
29
30
|
key={option.id}
|
|
31
|
+
index-position={index}
|
|
30
32
|
onfocus={onOptionFocus}
|
|
31
33
|
onselect={onOptionClick}
|
|
32
34
|
option={option}
|
|
33
35
|
nav-item-label={navItemLabel}
|
|
36
|
+
variant={variant}
|
|
34
37
|
></dx-dropdown-option>
|
|
35
38
|
<div
|
|
36
39
|
key={option.id}
|
|
@@ -41,8 +44,12 @@
|
|
|
41
44
|
<span class="menu_heading">{option.label}</span>
|
|
42
45
|
<template for:each={option.options} for:item="suboption">
|
|
43
46
|
<dx-dropdown-option
|
|
47
|
+
suppress-gtm-nav-headings={suppressGTMNavHeadings}
|
|
48
|
+
analytics-event={analyticsEvent}
|
|
49
|
+
analytics-base-payload={analyticsBasePayload}
|
|
44
50
|
active={suboption.active}
|
|
45
|
-
key={suboption.
|
|
51
|
+
key={suboption.id}
|
|
52
|
+
key-value={suboption.keyValue}
|
|
46
53
|
onfocus={onOptionFocus}
|
|
47
54
|
onselect={onOptionClick}
|
|
48
55
|
option={suboption}
|
|
@@ -55,7 +62,7 @@
|
|
|
55
62
|
href={option.calloutLink.href}
|
|
56
63
|
target={option.calloutLink.target}
|
|
57
64
|
icon-symbol="forward"
|
|
58
|
-
variant="inline
|
|
65
|
+
variant="inline"
|
|
59
66
|
>
|
|
60
67
|
{option.calloutLink.label}
|
|
61
68
|
</dx-button>
|
|
@@ -1,11 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
AnalyticsPayload,
|
|
3
|
+
OptionWithNested,
|
|
4
|
+
PopperPlacement,
|
|
5
|
+
DropdownVariant
|
|
6
|
+
} from "typings/custom";
|
|
2
7
|
import { LightningElement, api, track } from "lwc";
|
|
3
8
|
import cx from "classnames";
|
|
4
|
-
import { deepmapOptions } from "utils/options";
|
|
5
9
|
import get from "lodash.get";
|
|
6
|
-
import {
|
|
10
|
+
import { deepmapOptions } from "dxUtils/options";
|
|
11
|
+
import { toJson } from "dxUtils/normalizers";
|
|
7
12
|
|
|
8
|
-
interface DropdownOption extends
|
|
13
|
+
interface DropdownOption extends OptionWithNested {
|
|
9
14
|
// link that gets shown as a highlighted link at end of option group
|
|
10
15
|
calloutLink?: {
|
|
11
16
|
href: string;
|
|
@@ -15,11 +20,9 @@ interface DropdownOption extends Option {
|
|
|
15
20
|
}
|
|
16
21
|
|
|
17
22
|
export default class Dropdown extends LightningElement {
|
|
18
|
-
@api emptyMessage: string = "No results found";
|
|
19
23
|
@api value: string | null = null; // "active option" id
|
|
20
24
|
@api valuePath: string = "id"; // path to match for the active value (useful for url matching)
|
|
21
25
|
@api stayOpenAfterChange?: boolean = false;
|
|
22
|
-
|
|
23
26
|
// props forwarded to popover:
|
|
24
27
|
@api ariaLabel: string | null = null;
|
|
25
28
|
@api tempId: string | null = null;
|
|
@@ -32,26 +35,49 @@ export default class Dropdown extends LightningElement {
|
|
|
32
35
|
@api width?: string | null = null;
|
|
33
36
|
@api fullWidth?: boolean | null;
|
|
34
37
|
@api navItemLabel: string | null = null;
|
|
38
|
+
@api variant: DropdownVariant = "base";
|
|
39
|
+
|
|
40
|
+
// props forwarded to dropdown option
|
|
41
|
+
@api analyticsEvent: string | null = null;
|
|
42
|
+
@api analyticsBasePayload: AnalyticsPayload = {
|
|
43
|
+
elementType: "dropdown",
|
|
44
|
+
destinationType: "internal",
|
|
45
|
+
ctaClick: true
|
|
46
|
+
};
|
|
47
|
+
@api suppressGtmNavHeadings?: boolean = false;
|
|
35
48
|
|
|
36
49
|
@api
|
|
37
50
|
get options() {
|
|
38
51
|
return deepmapOptions(this._options, (option: DropdownOption) => ({
|
|
39
52
|
...option,
|
|
40
53
|
active: this.value === get(option, this.valuePath),
|
|
41
|
-
|
|
54
|
+
keyValue: get(option, this.valuePath)
|
|
42
55
|
}));
|
|
43
56
|
}
|
|
44
57
|
set options(value: DropdownOption[]) {
|
|
45
58
|
this._options = toJson(value);
|
|
46
59
|
}
|
|
60
|
+
|
|
61
|
+
@api
|
|
62
|
+
get focusedValue() {
|
|
63
|
+
return this._focusedValue;
|
|
64
|
+
}
|
|
65
|
+
|
|
47
66
|
@track
|
|
48
67
|
private _options!: DropdownOption[];
|
|
49
68
|
|
|
50
69
|
// PRIVATE VARS
|
|
51
70
|
|
|
52
|
-
private
|
|
71
|
+
private _focusedValue: string | null = null;
|
|
53
72
|
private popoverEl: HTMLElement | null = null;
|
|
54
73
|
|
|
74
|
+
constructor() {
|
|
75
|
+
super();
|
|
76
|
+
|
|
77
|
+
// @ts-ignore
|
|
78
|
+
this.addEventListener("keydown", this.onKeyDown);
|
|
79
|
+
}
|
|
80
|
+
|
|
55
81
|
// GETTERS
|
|
56
82
|
|
|
57
83
|
private get role() {
|
|
@@ -62,7 +88,8 @@ export default class Dropdown extends LightningElement {
|
|
|
62
88
|
return cx(
|
|
63
89
|
this.isNested && "menu-nested",
|
|
64
90
|
this.isNested && this.options.length >= 2 && "menu-nested-2-col",
|
|
65
|
-
this.offset && `menu-offset-${this.offset}
|
|
91
|
+
this.offset && `menu-offset-${this.offset}`,
|
|
92
|
+
this.areOptionsEmpty && "menu-hidden"
|
|
66
93
|
);
|
|
67
94
|
}
|
|
68
95
|
|
|
@@ -80,7 +107,7 @@ export default class Dropdown extends LightningElement {
|
|
|
80
107
|
|
|
81
108
|
// CLASS FNS
|
|
82
109
|
|
|
83
|
-
private onKeyDown(e: KeyboardEvent) {
|
|
110
|
+
private onKeyDown = (e: KeyboardEvent) => {
|
|
84
111
|
switch (e.key) {
|
|
85
112
|
case "ArrowDown":
|
|
86
113
|
e.preventDefault();
|
|
@@ -92,17 +119,13 @@ export default class Dropdown extends LightningElement {
|
|
|
92
119
|
break;
|
|
93
120
|
default:
|
|
94
121
|
}
|
|
95
|
-
}
|
|
122
|
+
};
|
|
96
123
|
|
|
97
124
|
private onOptionClick(e: CustomEvent) {
|
|
98
125
|
if (e.detail !== this.value) {
|
|
99
126
|
this.dispatchEvent(new CustomEvent("change", { detail: e.detail }));
|
|
100
127
|
}
|
|
101
128
|
if (!this.stayOpenAfterChange && this.popoverEl) {
|
|
102
|
-
if (this.popoverEl.controlled) {
|
|
103
|
-
this.popoverEl.dispatchRequestCloseEvent("click-option");
|
|
104
|
-
return;
|
|
105
|
-
}
|
|
106
129
|
this.popoverEl.closePopover();
|
|
107
130
|
}
|
|
108
131
|
}
|
|
@@ -110,7 +133,7 @@ export default class Dropdown extends LightningElement {
|
|
|
110
133
|
private onOptionFocus(e: PointerEvent) {
|
|
111
134
|
if (e.target) {
|
|
112
135
|
// @ts-ignore
|
|
113
|
-
this.
|
|
136
|
+
this._focusedValue = e.target.option.id;
|
|
114
137
|
}
|
|
115
138
|
}
|
|
116
139
|
|
|
@@ -122,12 +145,13 @@ export default class Dropdown extends LightningElement {
|
|
|
122
145
|
}
|
|
123
146
|
|
|
124
147
|
private incrementOptionFocus(indexChange: number) {
|
|
125
|
-
if (!this.
|
|
148
|
+
if (!this._focusedValue) {
|
|
149
|
+
this.focusDefaultOption();
|
|
126
150
|
return;
|
|
127
151
|
}
|
|
128
152
|
|
|
129
153
|
const focusedOptionIndex = this.findOptionElementIndex(
|
|
130
|
-
this.
|
|
154
|
+
this._focusedValue
|
|
131
155
|
);
|
|
132
156
|
|
|
133
157
|
let nextIndex = focusedOptionIndex + indexChange;
|
|
@@ -144,19 +168,22 @@ export default class Dropdown extends LightningElement {
|
|
|
144
168
|
}
|
|
145
169
|
}
|
|
146
170
|
|
|
147
|
-
private
|
|
148
|
-
this.
|
|
149
|
-
}
|
|
171
|
+
private onClose(): void {
|
|
172
|
+
this._focusedValue = null;
|
|
173
|
+
}
|
|
150
174
|
|
|
151
|
-
private focusDefaultOption
|
|
175
|
+
private focusDefaultOption() {
|
|
152
176
|
const defaultIndex = this.value
|
|
153
177
|
? this.findOptionElementIndex(this.value)
|
|
154
178
|
: 0;
|
|
155
|
-
|
|
179
|
+
|
|
180
|
+
const optionToFocus: any =
|
|
181
|
+
this.optionsElements[defaultIndex < 0 ? 0 : defaultIndex];
|
|
156
182
|
if (optionToFocus) {
|
|
157
183
|
optionToFocus.focus();
|
|
184
|
+
this._focusedValue = optionToFocus.option.id;
|
|
158
185
|
}
|
|
159
|
-
}
|
|
186
|
+
}
|
|
160
187
|
|
|
161
188
|
renderedCallback() {
|
|
162
189
|
if (!this.popoverEl) {
|
|
@@ -1,4 +1,25 @@
|
|
|
1
|
-
@import "
|
|
1
|
+
@import "dxHelpers/reset";
|
|
2
|
+
|
|
3
|
+
.indented-shape {
|
|
4
|
+
--background: rgb(170, 203, 255);
|
|
5
|
+
--wide: 2px;
|
|
6
|
+
|
|
7
|
+
background-color: var(--background);
|
|
8
|
+
height: var(--wide);
|
|
9
|
+
margin-bottom: var(--dx-g-spacing-xs);
|
|
10
|
+
margin-right: var(--dx-g-spacing-sm);
|
|
11
|
+
position: relative;
|
|
12
|
+
width: var(--shape-width);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.indented-shape::after {
|
|
16
|
+
background-color: var(--background);
|
|
17
|
+
bottom: 0;
|
|
18
|
+
content: "";
|
|
19
|
+
height: 15px;
|
|
20
|
+
position: absolute;
|
|
21
|
+
width: var(--wide);
|
|
22
|
+
}
|
|
2
23
|
|
|
3
24
|
.option {
|
|
4
25
|
display: flex;
|
|
@@ -37,12 +58,25 @@
|
|
|
37
58
|
text-align: left;
|
|
38
59
|
}
|
|
39
60
|
|
|
61
|
+
.option-indented .option_details {
|
|
62
|
+
align-items: center;
|
|
63
|
+
flex-direction: row;
|
|
64
|
+
}
|
|
65
|
+
|
|
40
66
|
.option_label {
|
|
41
|
-
color: var(--dx-g-blue-vibrant-50);
|
|
67
|
+
color: var(--dx-c-dropdown-option-label-color, var(--dx-g-blue-vibrant-50));
|
|
42
68
|
display: flex;
|
|
43
69
|
align-items: center;
|
|
44
70
|
font-weight: var(--dx-g-font-bold);
|
|
45
|
-
font-size: var(--dx-g-text-base);
|
|
71
|
+
font-size: var(--dx-c-dropdown-option-font-size, var(--dx-g-text-base));
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.option-indented .option_label {
|
|
75
|
+
display: -webkit-box;
|
|
76
|
+
max-width: 300px;
|
|
77
|
+
overflow: hidden;
|
|
78
|
+
-webkit-line-clamp: 1;
|
|
79
|
+
-webkit-box-orient: vertical;
|
|
46
80
|
}
|
|
47
81
|
|
|
48
82
|
.option_label > *:last-child {
|
|
@@ -59,3 +93,87 @@
|
|
|
59
93
|
margin-right: var(--dx-g-spacing-md);
|
|
60
94
|
flex-shrink: 0;
|
|
61
95
|
}
|
|
96
|
+
|
|
97
|
+
.option-indented {
|
|
98
|
+
padding-top: var(--dx-g-spacing-xs);
|
|
99
|
+
padding-bottom: var(--dx-g-spacing-xs);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.option-indented:not([data-index="0"]) {
|
|
103
|
+
--base-indentation: calc(var(--dx-g-spacing-md) + var(--shape-width));
|
|
104
|
+
--shape-width: 8px;
|
|
105
|
+
|
|
106
|
+
padding-left: calc(var(--indentation, 0px) + var(--dx-g-spacing-md));
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
[data-index="2"] {
|
|
110
|
+
--indentation: var(--base-indentation);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
[data-index="3"] {
|
|
114
|
+
--indentation: calc(2 * var(--base-indentation));
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
[data-index="4"] {
|
|
118
|
+
--indentation: calc(3 * var(--base-indentation));
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
[data-index="5"] {
|
|
122
|
+
--indentation: calc(4 * var(--base-indentation));
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
[data-index="6"] {
|
|
126
|
+
--indentation: calc(5 * var(--base-indentation));
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
[data-index="7"] {
|
|
130
|
+
--indentation: calc(6 * var(--base-indentation));
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
[data-index="8"] {
|
|
134
|
+
--indentation: calc(7 * var(--base-indentation));
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
[data-index="9"] {
|
|
138
|
+
--indentation: calc(8 * var(--base-indentation));
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
[data-index="10"] {
|
|
142
|
+
--indentation: calc(9 * var(--base-indentation));
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
[data-index="11"] {
|
|
146
|
+
--indentation: calc(10 * var(--base-indentation));
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
[data-index="12"] {
|
|
150
|
+
--indentation: calc(11 * var(--base-indentation));
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
[data-index="13"] {
|
|
154
|
+
--indentation: calc(12 * var(--base-indentation));
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
[data-index="14"] {
|
|
158
|
+
--indentation: calc(13 * var(--base-indentation));
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
[data-index="15"] {
|
|
162
|
+
--indentation: calc(14 * var(--base-indentation));
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
[data-index="16"] {
|
|
166
|
+
--indentation: calc(15 * var(--base-indentation));
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
[data-index="17"] {
|
|
170
|
+
--indentation: calc(16 * var(--base-indentation));
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
[data-index="18"] {
|
|
174
|
+
--indentation: calc(17 * var(--base-indentation));
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
[data-index="19"] {
|
|
178
|
+
--indentation: calc(18 * var(--base-indentation));
|
|
179
|
+
}
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
key={option.id}
|
|
8
8
|
role="menuitem"
|
|
9
9
|
tabindex="-1"
|
|
10
|
+
data-index={indexPosition}
|
|
10
11
|
onclick={onClick}
|
|
11
12
|
>
|
|
12
13
|
<dx-icon
|
|
@@ -17,6 +18,7 @@
|
|
|
17
18
|
size="large"
|
|
18
19
|
></dx-icon>
|
|
19
20
|
<div class="option_details">
|
|
21
|
+
<div if:true={renderIndentedShape} class="indented-shape"></div>
|
|
20
22
|
<div class="option_label">
|
|
21
23
|
{option.label}
|
|
22
24
|
<dx-icon
|
|
@@ -34,6 +36,7 @@
|
|
|
34
36
|
class={className}
|
|
35
37
|
role="menuitem"
|
|
36
38
|
tabindex="-1"
|
|
39
|
+
data-index={indexPosition}
|
|
37
40
|
onclick={onClick}
|
|
38
41
|
>
|
|
39
42
|
<dx-icon
|
|
@@ -44,6 +47,7 @@
|
|
|
44
47
|
size="large"
|
|
45
48
|
></dx-icon>
|
|
46
49
|
<div class="option_details">
|
|
50
|
+
<div if:true={renderIndentedShape} class="indented-shape"></div>
|
|
47
51
|
<div class="option_label">{option.label}</div>
|
|
48
52
|
<div if:true={option.description} class="option_description">
|
|
49
53
|
{option.description}
|