@salesforcedevs/dx-components 0.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +12 -0
- package/lwc.config.json +96 -0
- package/package.json +32 -0
- 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 +608 -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/no-results-combined.svg +80 -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-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/trees.svg +42 -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 +12 -0
- package/src/modules/dx/brandThemeProvider/brandCssVars.ts +10 -0
- package/src/modules/dx/brandThemeProvider/brandThemeProvider.html +3 -0
- package/src/modules/dx/brandThemeProvider/brandThemeProvider.ts +46 -0
- package/src/modules/dx/breadcrumbs/breadcrumbs.css +111 -0
- package/src/modules/dx/breadcrumbs/breadcrumbs.html +44 -0
- package/src/modules/dx/breadcrumbs/breadcrumbs.ts +123 -0
- package/src/modules/dx/button/button.css +198 -0
- package/src/modules/dx/button/button.html +43 -0
- package/src/modules/dx/button/button.ts +68 -0
- package/src/modules/dx/cardBlogPost/cardBlogPost.css +13 -0
- package/src/modules/dx/cardBlogPost/cardBlogPost.html +24 -0
- package/src/modules/dx/cardBlogPost/cardBlogPost.ts +23 -0
- package/src/modules/dx/cardCallout/cardCallout.css +57 -0
- package/src/modules/dx/cardCallout/cardCallout.html +15 -0
- package/src/modules/dx/cardCallout/cardCallout.ts +41 -0
- package/src/modules/dx/cardContent/cardContent.css +52 -0
- package/src/modules/dx/cardContent/cardContent.html +62 -0
- package/src/modules/dx/cardContent/cardContent.ts +68 -0
- package/src/modules/dx/cardDemo/cardDemo.css +1 -0
- package/src/modules/dx/cardDemo/cardDemo.html +12 -0
- package/src/modules/dx/cardDemo/cardDemo.ts +11 -0
- package/src/modules/dx/cardDocs/cardDocs.css +50 -0
- package/src/modules/dx/cardDocs/cardDocs.html +23 -0
- package/src/modules/dx/cardDocs/cardDocs.ts +30 -0
- package/src/modules/dx/cardEvent/cardEvent.css +107 -0
- package/src/modules/dx/cardEvent/cardEvent.html +94 -0
- package/src/modules/dx/cardEvent/cardEvent.ts +42 -0
- package/src/modules/dx/cardExpanded/cardExpanded.css +50 -0
- package/src/modules/dx/cardExpanded/cardExpanded.html +36 -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 +13 -0
- package/src/modules/dx/cardMinimal/cardMinimal.ts +3 -0
- package/src/modules/dx/cardNews/cardNews.css +159 -0
- package/src/modules/dx/cardNews/cardNews.html +39 -0
- package/src/modules/dx/cardNews/cardNews.ts +77 -0
- package/src/modules/dx/cardPodcastEpisode/cardPodcastEpisode.css +19 -0
- package/src/modules/dx/cardPodcastEpisode/cardPodcastEpisode.html +36 -0
- package/src/modules/dx/cardPodcastEpisode/cardPodcastEpisode.ts +36 -0
- package/src/modules/dx/cardSmall/cardSmall.css +32 -0
- package/src/modules/dx/cardSmall/cardSmall.html +42 -0
- package/src/modules/dx/cardSmall/cardSmall.ts +38 -0
- package/src/modules/dx/cardTitle/cardTitle.css +43 -0
- package/src/modules/dx/cardTitle/cardTitle.html +20 -0
- package/src/modules/dx/cardTitle/cardTitle.ts +27 -0
- package/src/modules/dx/cardTrailheadModule/cardTrailheadModule.css +24 -0
- package/src/modules/dx/cardTrailheadModule/cardTrailheadModule.html +20 -0
- package/src/modules/dx/cardTrailheadModule/cardTrailheadModule.ts +18 -0
- package/src/modules/dx/cardTrial/cardTrial.css +71 -0
- package/src/modules/dx/cardTrial/cardTrial.html +31 -0
- package/src/modules/dx/cardTrial/cardTrial.ts +34 -0
- package/src/modules/dx/cardVideoPreview/cardVideoPreview.css +14 -0
- package/src/modules/dx/cardVideoPreview/cardVideoPreview.html +27 -0
- package/src/modules/dx/cardVideoPreview/cardVideoPreview.ts +13 -0
- package/src/modules/dx/checkbox/checkbox.css +172 -0
- package/src/modules/dx/checkbox/checkbox.html +26 -0
- package/src/modules/dx/checkbox/checkbox.ts +56 -0
- package/src/modules/dx/checkboxGroup/checkboxGroup.css +12 -0
- package/src/modules/dx/checkboxGroup/checkboxGroup.html +15 -0
- package/src/modules/dx/checkboxGroup/checkboxGroup.ts +77 -0
- package/src/modules/dx/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 +128 -0
- package/src/modules/dx/codeBlock/codeBlock.html +79 -0
- package/src/modules/dx/codeBlock/codeBlock.ts +222 -0
- package/src/modules/dx/codeBlock/darkTheme.css +88 -0
- package/src/modules/dx/codeBlock/lightTheme.css +72 -0
- package/src/modules/dx/dropdown/dropdown.css +93 -0
- package/src/modules/dx/dropdown/dropdown.html +73 -0
- package/src/modules/dx/dropdown/dropdown.ts +193 -0
- package/src/modules/dx/dropdownOption/dropdownOption.css +179 -0
- package/src/modules/dx/dropdownOption/dropdownOption.html +57 -0
- package/src/modules/dx/dropdownOption/dropdownOption.ts +67 -0
- package/src/modules/dx/emptyState/emptyState.css +64 -0
- package/src/modules/dx/emptyState/emptyState.html +9 -0
- package/src/modules/dx/emptyState/emptyState.ts +20 -0
- package/src/modules/dx/feature/feature.css +135 -0
- package/src/modules/dx/feature/feature.html +33 -0
- package/src/modules/dx/feature/feature.ts +34 -0
- package/src/modules/dx/featureGrid/featureGrid.html +3 -0
- package/src/modules/dx/featureGrid/featureGrid.ts +15 -0
- package/src/modules/dx/featuredContentHeader/featuredContentHeader.css +468 -0
- package/src/modules/dx/featuredContentHeader/featuredContentHeader.html +109 -0
- package/src/modules/dx/featuredContentHeader/featuredContentHeader.ts +102 -0
- package/src/modules/dx/featuredContentHeader/svgs.ts +35 -0
- package/src/modules/dx/featuresList/featuresList.css +24 -0
- package/src/modules/dx/featuresList/featuresList.html +20 -0
- package/src/modules/dx/featuresList/featuresList.ts +21 -0
- package/src/modules/dx/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 +405 -0
- package/src/modules/dx/footer/footer.html +150 -0
- package/src/modules/dx/footer/footer.ts +129 -0
- package/src/modules/dx/footer/links.ts +206 -0
- package/src/modules/dx/footerOption/footerOption.css +4 -0
- package/src/modules/dx/footerOption/footerOption.html +12 -0
- package/src/modules/dx/footerOption/footerOption.ts +19 -0
- package/src/modules/dx/formattedDateTime/formattedDateTime.html +1 -0
- package/src/modules/dx/formattedDateTime/formattedDateTime.ts +77 -0
- package/src/modules/dx/grid/grid.css +48 -0
- package/src/modules/dx/grid/grid.html +3 -0
- package/src/modules/dx/grid/grid.md +14 -0
- package/src/modules/dx/grid/grid.ts +74 -0
- package/src/modules/dx/groupText/groupText.css +119 -0
- package/src/modules/dx/groupText/groupText.html +68 -0
- package/src/modules/dx/groupText/groupText.ts +111 -0
- package/src/modules/dx/header/__benchmarks__/header.benchmark.js +45 -0
- package/src/modules/dx/header/header.css +99 -0
- package/src/modules/dx/header/header.html +122 -0
- package/src/modules/dx/header/header.ts +13 -0
- package/src/modules/dx/headerMobileNavMenu/headerMobileNavMenu.css +160 -0
- package/src/modules/dx/headerMobileNavMenu/headerMobileNavMenu.html +73 -0
- package/src/modules/dx/headerMobileNavMenu/headerMobileNavMenu.ts +102 -0
- package/src/modules/dx/headerMobileNavMenuOption/headerMobileNavMenuOption.css +5 -0
- package/src/modules/dx/headerMobileNavMenuOption/headerMobileNavMenuOption.html +14 -0
- package/src/modules/dx/headerMobileNavMenuOption/headerMobileNavMenuOption.ts +20 -0
- package/src/modules/dx/headerNav/headerNav.css +31 -0
- package/src/modules/dx/headerNav/headerNav.html +48 -0
- package/src/modules/dx/headerNav/headerNav.ts +56 -0
- package/src/modules/dx/headerSearch/headerSearch.css +62 -0
- package/src/modules/dx/headerSearch/headerSearch.html +62 -0
- package/src/modules/dx/headerSearch/headerSearch.ts +159 -0
- package/src/modules/dx/helmet/helmet.css +83 -0
- package/src/modules/dx/helmet/helmet.html +39 -0
- package/src/modules/dx/helmet/helmet.ts +27 -0
- package/src/modules/dx/hr/hr.css +56 -0
- package/src/modules/dx/hr/hr.html +23 -0
- package/src/modules/dx/hr/hr.ts +45 -0
- package/src/modules/dx/icon/icon.css +14 -0
- package/src/modules/dx/icon/icon.html +11 -0
- package/src/modules/dx/icon/icon.ts +85 -0
- package/src/modules/dx/iconBadge/iconBadge.css +52 -0
- package/src/modules/dx/iconBadge/iconBadge.html +5 -0
- package/src/modules/dx/iconBadge/iconBadge.ts +52 -0
- package/src/modules/dx/imageAndLabel/imageAndLabel.css +54 -0
- package/src/modules/dx/imageAndLabel/imageAndLabel.html +22 -0
- package/src/modules/dx/imageAndLabel/imageAndLabel.ts +16 -0
- package/src/modules/dx/input/input.css +181 -0
- package/src/modules/dx/input/input.html +62 -0
- package/src/modules/dx/input/input.ts +246 -0
- package/src/modules/dx/input/validators.ts +5 -0
- package/src/modules/dx/logo/logo.css +33 -0
- package/src/modules/dx/logo/logo.html +6 -0
- package/src/modules/dx/logo/logo.ts +8 -0
- package/src/modules/dx/modalDrawer/modalDrawer.css +41 -0
- package/src/modules/dx/modalDrawer/modalDrawer.html +11 -0
- package/src/modules/dx/modalDrawer/modalDrawer.ts +27 -0
- package/src/modules/dx/pagination/pagination.css +51 -0
- package/src/modules/dx/pagination/pagination.html +45 -0
- package/src/modules/dx/pagination/pagination.ts +135 -0
- package/src/modules/dx/podcastHost/podcastHost.css +62 -0
- package/src/modules/dx/podcastHost/podcastHost.html +28 -0
- package/src/modules/dx/podcastHost/podcastHost.ts +13 -0
- package/src/modules/dx/podcastPlayer/podcastPlayer.css +10 -0
- package/src/modules/dx/podcastPlayer/podcastPlayer.html +3 -0
- package/src/modules/dx/podcastPlayer/podcastPlayer.ts +5 -0
- package/src/modules/dx/popover/popover.css +65 -0
- package/src/modules/dx/popover/popover.html +16 -0
- package/src/modules/dx/popover/popover.ts +306 -0
- package/src/modules/dx/radioGroup/radioGroup.css +12 -0
- package/src/modules/dx/radioGroup/radioGroup.html +16 -0
- package/src/modules/dx/radioGroup/radioGroup.ts +65 -0
- package/src/modules/dx/relativeDateTime/relativeDateTime.html +3 -0
- package/src/modules/dx/relativeDateTime/relativeDateTime.ts +113 -0
- package/src/modules/dx/searchResults/coveo.css +18989 -0
- package/src/modules/dx/searchResults/searchResults.css +387 -0
- package/src/modules/dx/searchResults/searchResults.html +104 -0
- package/src/modules/dx/searchResults/searchResults.ts +187 -0
- package/src/modules/dx/section/section.css +130 -0
- package/src/modules/dx/section/section.html +66 -0
- package/src/modules/dx/section/section.ts +41 -0
- package/src/modules/dx/sectionSignup/sectionSignup.css +43 -0
- package/src/modules/dx/sectionSignup/sectionSignup.html +23 -0
- package/src/modules/dx/sectionSignup/sectionSignup.ts +44 -0
- package/src/modules/dx/select/select.css +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 +48 -0
- package/src/modules/dx/sidebar/sidebar.html +95 -0
- package/src/modules/dx/sidebar/sidebar.ts +258 -0
- 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.css +35 -0
- package/src/modules/dx/socials/socials.html +22 -0
- package/src/modules/dx/socials/socials.ts +81 -0
- package/src/modules/dx/spinner/spinner.css +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 +106 -0
- package/src/modules/dx/tab/tab.html +13 -0
- package/src/modules/dx/tab/tab.ts +52 -0
- package/src/modules/dx/toc/toc.css +106 -0
- package/src/modules/dx/toc/toc.html +29 -0
- package/src/modules/dx/toc/toc.ts +77 -0
- package/src/modules/dx/tooltip/microtip.css +269 -0
- package/src/modules/dx/tooltip/tooltip.css +37 -0
- package/src/modules/dx/tooltip/tooltip.html +5 -0
- package/src/modules/dx/tooltip/tooltip.ts +6 -0
- package/src/modules/dx/topics/topics.css +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 +5 -0
- package/src/modules/dx/tree/tree.html +11 -0
- package/src/modules/dx/tree/tree.ts +80 -0
- package/src/modules/dx/tree/treeHandler.ts +101 -0
- package/src/modules/dx/treeItem/treeItem.css +25 -0
- package/src/modules/dx/treeItem/treeItem.html +29 -0
- package/src/modules/dx/treeItem/treeItem.ts +146 -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 +60 -0
- package/src/modules/dx/typeBadge/typeBadge.css +74 -0
- package/src/modules/dx/typeBadge/typeBadge.html +5 -0
- package/src/modules/dx/typeBadge/typeBadge.ts +65 -0
- package/src/modules/dx/typeBadgeGroup/typeBadgeGroup.css +12 -0
- package/src/modules/dx/typeBadgeGroup/typeBadgeGroup.html +11 -0
- package/src/modules/dx/typeBadgeGroup/typeBadgeGroup.ts +18 -0
- package/src/modules/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 +35 -0
- package/src/modules/dxBaseElements/headerBase/headerBase.ts +205 -0
- package/src/modules/dxBaseElements/matchMediaElement/matchMediaElement.ts +59 -0
- package/src/modules/dxBaseElements/sidebarBase/sidebarBase.ts +65 -0
- package/src/modules/dxHelpers/animations/animations.css +15 -0
- package/src/modules/dxHelpers/button/button.css +4 -0
- package/src/modules/dxHelpers/card/card.css +263 -0
- package/src/modules/dxHelpers/code/code.css +296 -0
- package/src/modules/dxHelpers/commonHeader/commonHeader.css +130 -0
- package/src/modules/dxHelpers/commonSidebar/commonSidebar.css +145 -0
- package/src/modules/dxHelpers/commonTreeItem/commonTreeItem.css +21 -0
- package/src/modules/dxHelpers/reset/reset.css +559 -0
- package/src/modules/dxHelpers/scrollbar/scrollbar.css +31 -0
- package/src/modules/dxHelpers/table/table.css +110 -0
- package/src/modules/dxHelpers/text/text.css +197 -0
- package/src/modules/dxUtils/analytics/analytics.ts +24 -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 +43 -0
- package/src/modules/dxUtils/dates/dates.ts +60 -0
- package/src/modules/dxUtils/devices/devices.ts +1 -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/dxUtils/normalizers/normalizers.ts +80 -0
- package/src/modules/dxUtils/options/options.ts +43 -0
- package/src/modules/dxUtils/prismjs/prismjs.html +3 -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/dxUtils/slot/slot.ts +17 -0
- package/src/modules/dxUtils/wordpress/wordpress.ts +13 -0
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<label if:true={label} id="label" for="input" tabindex="-1">
|
|
3
|
+
{label}
|
|
4
|
+
<abbr if:true={required}>*</abbr>
|
|
5
|
+
</label>
|
|
6
|
+
<div class={className}>
|
|
7
|
+
<div class={inputContainerClassName} onclick={onClick} role={role}>
|
|
8
|
+
<dx-icon
|
|
9
|
+
if:true={iconSymbol}
|
|
10
|
+
symbol={iconSymbol}
|
|
11
|
+
size={iconSize}
|
|
12
|
+
></dx-icon>
|
|
13
|
+
<input
|
|
14
|
+
aria-label={ariaLabel}
|
|
15
|
+
aria-keyshortcuts={ariaKeyShortcuts}
|
|
16
|
+
autocomplete={autocomplete}
|
|
17
|
+
name={name}
|
|
18
|
+
disabled={inputDisabled}
|
|
19
|
+
id="input"
|
|
20
|
+
onblur={onInputBlur}
|
|
21
|
+
onfocus={onInputFocus}
|
|
22
|
+
oninput={onInputChange}
|
|
23
|
+
onkeydown={onKeyDown}
|
|
24
|
+
placeholder={placeholder}
|
|
25
|
+
type={type}
|
|
26
|
+
value={value}
|
|
27
|
+
aria-labelledby="label description"
|
|
28
|
+
/>
|
|
29
|
+
<button
|
|
30
|
+
class="clear-button"
|
|
31
|
+
aria-label="Clear"
|
|
32
|
+
if:true={showClearButton}
|
|
33
|
+
onclick={clear}
|
|
34
|
+
>
|
|
35
|
+
<dx-icon symbol="clear" size="medium"></dx-icon>
|
|
36
|
+
</button>
|
|
37
|
+
<div class="shortcut" if:true={showShortcutKey}>
|
|
38
|
+
<img src={shortcutImgSrc} alt={shortcutImgAlt} />
|
|
39
|
+
<span>{shortcutKey}</span>
|
|
40
|
+
</div>
|
|
41
|
+
</div>
|
|
42
|
+
<dx-button
|
|
43
|
+
if:true={submitLabel}
|
|
44
|
+
disabled={buttonDisabled}
|
|
45
|
+
onclick={onButtonClick}
|
|
46
|
+
type="submit"
|
|
47
|
+
size={size}
|
|
48
|
+
>
|
|
49
|
+
{submitLabel}
|
|
50
|
+
</dx-button>
|
|
51
|
+
</div>
|
|
52
|
+
<div id="description" class={descriptionClassName} tabindex="-1">
|
|
53
|
+
{description}
|
|
54
|
+
</div>
|
|
55
|
+
<div
|
|
56
|
+
if:true={errorMessage}
|
|
57
|
+
aria-live="assertive"
|
|
58
|
+
class="error-message-box dx-text-form-error-message"
|
|
59
|
+
>
|
|
60
|
+
{errorMessage}
|
|
61
|
+
</div>
|
|
62
|
+
</template>
|
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
import { LightningElement, api } from "lwc";
|
|
2
|
+
import cx from "classnames";
|
|
3
|
+
import { IconSize, IconSymbol } from "typings/custom";
|
|
4
|
+
import { isMac } from "dxUtils/devices";
|
|
5
|
+
import { setContainerInnerHtml } from "dxUtils/lwc";
|
|
6
|
+
import { isValidEmail } from "./validators";
|
|
7
|
+
|
|
8
|
+
type ValidatorMap = {
|
|
9
|
+
[key: string]: {
|
|
10
|
+
validator: (value: string | null) => boolean;
|
|
11
|
+
errorMessage: string;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const typeValidatorMap: ValidatorMap = {
|
|
16
|
+
email: {
|
|
17
|
+
validator: isValidEmail,
|
|
18
|
+
errorMessage: "Enter valid email"
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
export default class Input extends LightningElement {
|
|
22
|
+
@api ariaLabel!: string;
|
|
23
|
+
@api autocomplete: string | null = null;
|
|
24
|
+
@api clearable: boolean = false;
|
|
25
|
+
@api disabled: boolean = false;
|
|
26
|
+
@api iconSize: IconSize = "medium";
|
|
27
|
+
@api iconSymbol: IconSymbol | null = null;
|
|
28
|
+
@api label?: string;
|
|
29
|
+
@api descriptionMarkup?: string;
|
|
30
|
+
@api loading: boolean = false;
|
|
31
|
+
@api missingErrorMessage: string = "Complete this field";
|
|
32
|
+
@api formatErrorMessage?: string;
|
|
33
|
+
@api name?: string;
|
|
34
|
+
@api placeholder!: string;
|
|
35
|
+
@api required = false;
|
|
36
|
+
@api role: string | null = null;
|
|
37
|
+
@api shortcutKey: string | null = null;
|
|
38
|
+
@api size: "small" | "large" | "override" = "small";
|
|
39
|
+
@api submitLabel?: string | null = null;
|
|
40
|
+
@api type: string = "text";
|
|
41
|
+
@api validityOnBlur = false;
|
|
42
|
+
|
|
43
|
+
@api
|
|
44
|
+
get value() {
|
|
45
|
+
return this._value;
|
|
46
|
+
}
|
|
47
|
+
set value(value: string | null) {
|
|
48
|
+
this._value = value || "";
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
@api
|
|
52
|
+
get errorMessage() {
|
|
53
|
+
return this._errorMessage;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
set errorMessage(value) {
|
|
57
|
+
this._errorMessage = value;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
@api focus() {
|
|
61
|
+
if (this.input) {
|
|
62
|
+
this.input.focus();
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
@api
|
|
67
|
+
reportValidity(): boolean {
|
|
68
|
+
if (this.isRequiredAndFilled) {
|
|
69
|
+
this._errorMessage = this.missingErrorMessage;
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const typeValidator = typeValidatorMap[this.type];
|
|
74
|
+
if (typeValidator && !typeValidator.validator(this.value)) {
|
|
75
|
+
this._errorMessage =
|
|
76
|
+
this.formatErrorMessage || typeValidator.errorMessage;
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
this._errorMessage = "";
|
|
81
|
+
return true;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
private _errorMessage: string = "";
|
|
85
|
+
private focused: boolean = false;
|
|
86
|
+
private input: HTMLInputElement | null = null;
|
|
87
|
+
private _value: string | null = null;
|
|
88
|
+
private _loading: boolean = false;
|
|
89
|
+
|
|
90
|
+
private get showClearButton(): boolean {
|
|
91
|
+
return this.clearable && !!this.value;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
private get showShortcutKey(): boolean {
|
|
95
|
+
return !this.showClearButton && !!this.shortcutKey;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
private get ariaKeyShortcuts() {
|
|
99
|
+
return this.shortcutKey ? `meta+${this.shortcutKey}` : null;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
private get inputLoading() {
|
|
103
|
+
return this.loading || this._loading;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
private get inputInvalid() {
|
|
107
|
+
const typeValidator = typeValidatorMap[this.type];
|
|
108
|
+
return (
|
|
109
|
+
this.isRequiredAndFilled &&
|
|
110
|
+
typeValidator &&
|
|
111
|
+
!typeValidator.validator(this.value)
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
private get inputDisabled() {
|
|
116
|
+
return this.inputLoading || this.disabled;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
private get className() {
|
|
120
|
+
return cx("input-group", `size-${this.size}`);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
private get descriptionClassName() {
|
|
124
|
+
return cx("description", !this.descriptionMarkup && "hide");
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
private get inputContainerClassName() {
|
|
128
|
+
return cx(
|
|
129
|
+
"input-container",
|
|
130
|
+
this.focused && "state-focused",
|
|
131
|
+
(this.showClearButton || this.showShortcutKey) &&
|
|
132
|
+
"has-floating-item",
|
|
133
|
+
!!this.errorMessage && "has-error"
|
|
134
|
+
);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
private get buttonDisabled() {
|
|
138
|
+
return this.inputLoading || this.inputInvalid || this.disabled;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
private get commandKey() {
|
|
142
|
+
return isMac() ? "command" : "control";
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
private get shortcutImgSrc() {
|
|
146
|
+
return `/assets/svg/${this.commandKey}.svg`;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
private get shortcutImgAlt() {
|
|
150
|
+
return `${this.commandKey}-${this.shortcutKey} is the search shortcut`;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
private get isRequiredAndFilled() {
|
|
154
|
+
return this.required && (!this.value || !this.value.trim());
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
connectedCallback() {
|
|
158
|
+
window.addEventListener("keydown", this.onWindowKeydown);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
disconnectedCallback() {
|
|
162
|
+
window.removeEventListener("keydown", this.onWindowKeydown);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
renderedCallback() {
|
|
166
|
+
if (!this.input) {
|
|
167
|
+
this.input = <HTMLInputElement>this.template.querySelector("input");
|
|
168
|
+
}
|
|
169
|
+
const container = this.template.querySelector(".description");
|
|
170
|
+
setContainerInnerHtml(container, this.descriptionMarkup);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
onClick() {
|
|
174
|
+
if (this.input) {
|
|
175
|
+
this.input.focus();
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
onInputFocus() {
|
|
180
|
+
this.focused = true;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
onInputBlur() {
|
|
184
|
+
this.focused = false;
|
|
185
|
+
|
|
186
|
+
if (this.validityOnBlur) {
|
|
187
|
+
this.reportValidity();
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
onInputChange(e: InputEvent) {
|
|
192
|
+
if (!e || !e.target) {
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
this.dispatchChange((<HTMLInputElement>e.target).value || "");
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
onButtonClick(e: Event) {
|
|
199
|
+
if (!this.buttonDisabled) {
|
|
200
|
+
e.stopPropagation();
|
|
201
|
+
}
|
|
202
|
+
this.submit();
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
dispatchChange(value: string) {
|
|
206
|
+
this._value = value;
|
|
207
|
+
this.dispatchEvent(new CustomEvent("change", { detail: this.value }));
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
clear(e?: Event) {
|
|
211
|
+
if (e) {
|
|
212
|
+
e.stopPropagation();
|
|
213
|
+
}
|
|
214
|
+
this.dispatchChange("");
|
|
215
|
+
this.dispatchEvent(new CustomEvent("clear"));
|
|
216
|
+
if (this.input) {
|
|
217
|
+
this.input.blur();
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
submit = async () => {
|
|
222
|
+
if (this.inputInvalid) {
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
this.dispatchEvent(new CustomEvent("submit", { detail: this.value }));
|
|
226
|
+
};
|
|
227
|
+
|
|
228
|
+
private onKeyDown(e: KeyboardEvent) {
|
|
229
|
+
switch (e.key) {
|
|
230
|
+
case "Escape":
|
|
231
|
+
this.clear();
|
|
232
|
+
break;
|
|
233
|
+
case "Enter":
|
|
234
|
+
this.submit();
|
|
235
|
+
break;
|
|
236
|
+
default:
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
private onWindowKeydown = (e: KeyboardEvent) => {
|
|
241
|
+
if (this.shortcutKey && e.metaKey && e.key === this.shortcutKey) {
|
|
242
|
+
e.preventDefault();
|
|
243
|
+
this.focus();
|
|
244
|
+
}
|
|
245
|
+
};
|
|
246
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
@import "dxHelpers/reset";
|
|
2
|
+
@import "dxHelpers/text";
|
|
3
|
+
|
|
4
|
+
:host {
|
|
5
|
+
--dx-c-logo-label-color: var(--dx-g-blue-vibrant-20);
|
|
6
|
+
|
|
7
|
+
flex-shrink: 0;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
a {
|
|
11
|
+
transition: var(--dx-g-transition-hue-1x);
|
|
12
|
+
display: flex;
|
|
13
|
+
align-items: center;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
a:hover {
|
|
17
|
+
color: var(--dx-g-blue-vibrant-40);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.logo-link {
|
|
21
|
+
flex-shrink: 0;
|
|
22
|
+
margin-right: var(--dx-g-spacing-xs);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.logo-link > span {
|
|
26
|
+
margin-top: 3px;
|
|
27
|
+
color: var(--dx-c-logo-label-color);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.logo-link > img {
|
|
31
|
+
margin-right: var(--dx-g-spacing-sm);
|
|
32
|
+
width: 28px;
|
|
33
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
--dx-c-modal-drawer-z-index: 5000;
|
|
3
|
+
--dx-c-modal-padding-around: var(--dx-g-spacing-smd);
|
|
4
|
+
--dx-c-modal-height: calc(100vh - var(--dx-c-modal-padding-around) * 2);
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
dx-button {
|
|
8
|
+
display: block;
|
|
9
|
+
margin-left: auto;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.modal-drawer_container {
|
|
13
|
+
background-color: white;
|
|
14
|
+
height: var(--dx-c-modal-height);
|
|
15
|
+
left: 0;
|
|
16
|
+
padding: var(--dx-c-modal-padding-around);
|
|
17
|
+
position: fixed;
|
|
18
|
+
transform: translateX(-100%);
|
|
19
|
+
transition: transform 0.4s ease;
|
|
20
|
+
top: 0;
|
|
21
|
+
width: inherit;
|
|
22
|
+
z-index: var(--dx-c-modal-drawer-z-index);
|
|
23
|
+
overflow-y: auto;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.modal-drawer_container.modal-drawer_active {
|
|
27
|
+
transform: translateX(0);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.modal-drawer_overlay {
|
|
31
|
+
background-color: #195594;
|
|
32
|
+
bottom: 0;
|
|
33
|
+
height: 100%;
|
|
34
|
+
left: 0;
|
|
35
|
+
opacity: 0.62;
|
|
36
|
+
position: fixed;
|
|
37
|
+
right: 0;
|
|
38
|
+
top: 0;
|
|
39
|
+
width: 100%;
|
|
40
|
+
z-index: calc(var(--dx-c-modal-drawer-z-index) - 1);
|
|
41
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import cx from "classnames";
|
|
2
|
+
import { LightningElement, api } from "lwc";
|
|
3
|
+
import { normalizeBoolean } from "dxUtils/normalizers";
|
|
4
|
+
|
|
5
|
+
export default class ModalDrawer extends LightningElement {
|
|
6
|
+
private _open = false;
|
|
7
|
+
|
|
8
|
+
@api get open() {
|
|
9
|
+
return this._open;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
set open(value) {
|
|
13
|
+
this._open = normalizeBoolean(value);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
get containerClass(): string {
|
|
17
|
+
return cx(
|
|
18
|
+
"modal-drawer_container",
|
|
19
|
+
this._open && "modal-drawer_active"
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
handleCloseModal() {
|
|
24
|
+
this._open = !this._open;
|
|
25
|
+
this.dispatchEvent(new CustomEvent("clickclose"));
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
@import "dxHelpers/reset";
|
|
2
|
+
|
|
3
|
+
.dx-pagination {
|
|
4
|
+
display: flex;
|
|
5
|
+
align-items: center;
|
|
6
|
+
justify-content: space-between;
|
|
7
|
+
padding: 0;
|
|
8
|
+
width: min-content;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.dx-pagination dx-button {
|
|
12
|
+
--dx-c-button-primary-color: transparent;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.dx-pagination.has-prev dx-button:first-of-type {
|
|
16
|
+
--dx-c-button-primary-color: var(--dx-g-blue-vibrant-50);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.dx-pagination.has-next dx-button:last-of-type {
|
|
20
|
+
--dx-c-button-primary-color: var(--dx-g-blue-vibrant-50);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.dx-pagination-pages {
|
|
24
|
+
flex: 1;
|
|
25
|
+
display: flex;
|
|
26
|
+
justify-content: space-between;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.dx-pagination-pages button {
|
|
30
|
+
padding: var(--dx-g-spacing-sm) var(--dx-g-spacing-md)
|
|
31
|
+
var(--dx-g-spacing-2xs) var(--dx-g-spacing-md);
|
|
32
|
+
border-radius: var(--dx-g-spacing-lg);
|
|
33
|
+
font-family: var(--dx-g-font-display);
|
|
34
|
+
font-size: var(--dx-g-text-sm);
|
|
35
|
+
color: var(--dx-g-blue-vibrant-20);
|
|
36
|
+
transition: var(--dx-g-transition-hue-1x);
|
|
37
|
+
margin-left: var(--dx-g-spacing-sm);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.dx-pagination-pages button:last-child {
|
|
41
|
+
margin-right: var(--dx-g-spacing-sm);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.dx-pagination-pages button:hover {
|
|
45
|
+
background-color: var(--dx-g-cloud-blue-vibrant-95);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.dx-pagination-pages button.current-page {
|
|
49
|
+
background-color: var(--dx-g-blue-vibrant-50);
|
|
50
|
+
color: white;
|
|
51
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class={rootClass}>
|
|
3
|
+
<dx-button
|
|
4
|
+
data-part-id="previous"
|
|
5
|
+
aria-label="Previous Page"
|
|
6
|
+
variant="tertiary"
|
|
7
|
+
size="large"
|
|
8
|
+
icon-symbol="back"
|
|
9
|
+
icon-position="left"
|
|
10
|
+
onclick={onPageChange}
|
|
11
|
+
disabled={previousIsDisabled}
|
|
12
|
+
></dx-button>
|
|
13
|
+
<div class="dx-pagination-pages">
|
|
14
|
+
<template for:each={pages} for:item="item" for:index="i">
|
|
15
|
+
<button
|
|
16
|
+
if:true={item.isCurrentPage}
|
|
17
|
+
class="current-page"
|
|
18
|
+
onclick={onPageChange}
|
|
19
|
+
data-page-id={item.index}
|
|
20
|
+
key={item.index}
|
|
21
|
+
>
|
|
22
|
+
{item.label}
|
|
23
|
+
</button>
|
|
24
|
+
<button
|
|
25
|
+
if:false={item.isCurrentPage}
|
|
26
|
+
onclick={onPageChange}
|
|
27
|
+
data-page-id={item.index}
|
|
28
|
+
key={item.index}
|
|
29
|
+
>
|
|
30
|
+
{item.label}
|
|
31
|
+
</button>
|
|
32
|
+
</template>
|
|
33
|
+
</div>
|
|
34
|
+
<dx-button
|
|
35
|
+
data-part-id="next"
|
|
36
|
+
aria-label="Next Page"
|
|
37
|
+
variant="tertiary"
|
|
38
|
+
size="large"
|
|
39
|
+
icon-symbol="forward"
|
|
40
|
+
icon-position="right"
|
|
41
|
+
onclick={onPageChange}
|
|
42
|
+
disabled={nextIsDisabled}
|
|
43
|
+
></dx-button>
|
|
44
|
+
</div>
|
|
45
|
+
</template>
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import classNames from "classnames";
|
|
2
|
+
import { LightningElement, api } from "lwc";
|
|
3
|
+
import { track } from "dxUtils/analytics";
|
|
4
|
+
|
|
5
|
+
const ANALYTICS_INFO = {
|
|
6
|
+
clickUrl: window.location.href,
|
|
7
|
+
ctaClick: false,
|
|
8
|
+
elementType: "button",
|
|
9
|
+
destinationType: "internal"
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
enum PaginationClickType {
|
|
13
|
+
Number,
|
|
14
|
+
Next,
|
|
15
|
+
Previous
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export default class Pagination extends LightningElement {
|
|
19
|
+
@api currentPage: string = "1";
|
|
20
|
+
@api totalPages: string = "1";
|
|
21
|
+
@api pagesToShow: string = "5";
|
|
22
|
+
|
|
23
|
+
private get _currentPage() {
|
|
24
|
+
return parseInt(this.currentPage, 10);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
private get _totalPages() {
|
|
28
|
+
return parseInt(this.totalPages, 10);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
private get _pagesToShow() {
|
|
32
|
+
return parseInt(this.pagesToShow, 10);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
private get hasPrev(): boolean {
|
|
36
|
+
return this._currentPage > 1;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
private get hasNext(): boolean {
|
|
40
|
+
return this._currentPage < this._totalPages;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
private get previousIsDisabled(): boolean {
|
|
44
|
+
return !this.hasPrev;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
private get nextIsDisabled(): boolean {
|
|
48
|
+
return !this.hasNext;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
private get rootClass(): string {
|
|
52
|
+
return classNames(
|
|
53
|
+
"dx-pagination",
|
|
54
|
+
this.hasNext && "has-next",
|
|
55
|
+
this.hasPrev && "has-prev"
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
private get pages(): {
|
|
60
|
+
label: string;
|
|
61
|
+
index: number;
|
|
62
|
+
isCurrentPage: boolean;
|
|
63
|
+
}[] {
|
|
64
|
+
const offset =
|
|
65
|
+
this._pagesToShow === 2 ? 2 : Math.ceil(this._pagesToShow / 2);
|
|
66
|
+
let start = this._currentPage - offset + 1;
|
|
67
|
+
let end = this._currentPage + offset - 1;
|
|
68
|
+
|
|
69
|
+
if (this._totalPages < this._pagesToShow) {
|
|
70
|
+
start = 1;
|
|
71
|
+
end = this._totalPages;
|
|
72
|
+
} else if (this._currentPage < offset) {
|
|
73
|
+
start = 1;
|
|
74
|
+
end = this._pagesToShow;
|
|
75
|
+
} else if (this._currentPage + offset > this._totalPages) {
|
|
76
|
+
start = this._totalPages - this._pagesToShow + 1;
|
|
77
|
+
end = this._totalPages;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
return [
|
|
81
|
+
...Array.from(Array(end - start + 1).keys()).map((index) => {
|
|
82
|
+
const page = index + start;
|
|
83
|
+
return {
|
|
84
|
+
label: `${page}`,
|
|
85
|
+
index: page,
|
|
86
|
+
isCurrentPage: page === this._currentPage
|
|
87
|
+
};
|
|
88
|
+
})
|
|
89
|
+
];
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
private onPageChange(e: Event) {
|
|
93
|
+
const page = this.calculatePage(e);
|
|
94
|
+
const clickType = this.getPaginationClickType(e);
|
|
95
|
+
|
|
96
|
+
const clickText =
|
|
97
|
+
clickType === PaginationClickType.Number
|
|
98
|
+
? page
|
|
99
|
+
: (e.target as HTMLElement).dataset.partId;
|
|
100
|
+
|
|
101
|
+
track(e.currentTarget!, "custEv_pagination", {
|
|
102
|
+
...ANALYTICS_INFO,
|
|
103
|
+
clickText,
|
|
104
|
+
itemTitle: clickText
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
this.dispatchEvent(new CustomEvent("pagechange", { detail: page }));
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
private getPaginationClickType(e: Event): PaginationClickType {
|
|
111
|
+
const button = (e.target as HTMLElement).dataset.partId;
|
|
112
|
+
if (button === "previous") {
|
|
113
|
+
return PaginationClickType.Previous;
|
|
114
|
+
} else if (button === "next") {
|
|
115
|
+
return PaginationClickType.Next;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
return PaginationClickType.Number;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
private calculatePage(e: Event) {
|
|
122
|
+
const clickType = this.getPaginationClickType(e);
|
|
123
|
+
|
|
124
|
+
let page = 0;
|
|
125
|
+
if (clickType === PaginationClickType.Previous) {
|
|
126
|
+
page = this._currentPage - 1;
|
|
127
|
+
} else if (clickType === PaginationClickType.Next) {
|
|
128
|
+
page = this._currentPage + 1;
|
|
129
|
+
} else {
|
|
130
|
+
page = +(e.target as HTMLElement).dataset.pageId!;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
return page;
|
|
134
|
+
}
|
|
135
|
+
}
|