@salesforcedevs/arch-components 1.20.17-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 +7 -0
- package/package.json +19 -0
- package/src/modules/common/context/context.html +1 -0
- package/src/modules/common/context/context.ts +137 -0
- package/src/modules/common/effectAdapter/__tests__/effectAdapter.test.ts +12 -0
- package/src/modules/common/effectAdapter/effectAdapter.html +1 -0
- package/src/modules/common/effectAdapter/effectAdapter.ts +18 -0
- package/src/modules/common/reflectedElement/__tests__/modules/test/select/select.html +3 -0
- package/src/modules/common/reflectedElement/__tests__/modules/test/select/select.ts +7 -0
- package/src/modules/common/reflectedElement/__tests__/modules/test/selectTransform/selectTransform.html +3 -0
- package/src/modules/common/reflectedElement/__tests__/modules/test/selectTransform/selectTransform.ts +18 -0
- package/src/modules/common/reflectedElement/__tests__/reflectedElement.test.ts +75 -0
- package/src/modules/common/reflectedElement/reflectedElement.ts +50 -0
- package/src/modules/common/slot/__tests__/slot.test.ts +96 -0
- package/src/modules/common/slot/slot.ts +20 -0
- package/src/modules/sa/coverage/coverage.css +35 -0
- package/src/modules/sa/coverage/coverage.html +15 -0
- package/src/modules/sa/coverage/coverage.ts +406 -0
- package/src/modules/sa/coverage/types.d.ts +26 -0
- package/src/modules/sa/expandableSection/expandableSection.css +24 -0
- package/src/modules/sa/expandableSection/expandableSection.html +20 -0
- package/src/modules/sa/expandableSection/expandableSection.stories.ts +37 -0
- package/src/modules/sa/expandableSection/expandableSection.ts +24 -0
- package/src/modules/sa/explorer/explorer.css +303 -0
- package/src/modules/sa/explorer/explorer.html +403 -0
- package/src/modules/sa/explorer/explorer.ts +664 -0
- package/src/modules/sa/explorer/types.d.ts +60 -0
- package/src/modules/sa/gallery/gallery.css +358 -0
- package/src/modules/sa/gallery/gallery.html +65 -0
- package/src/modules/sa/gallery/gallery.ts +300 -0
- package/src/modules/sa/gallery/types.d.ts +35 -0
- package/src/modules/sa/socialShare/socialShare.css +49 -0
- package/src/modules/sa/socialShare/socialShare.html +56 -0
- package/src/modules/sa/socialShare/socialShare.ts +29 -0
- package/src/modules/shared/a11y/a11y.ts +25 -0
- package/src/modules/shared/children/children.ts +29 -0
- package/src/modules/shared/color/color.ts +52 -0
- package/src/modules/shared/debounce/debounce.ts +32 -0
- package/src/modules/shared/dialog/dialog.ts +154 -0
- package/src/modules/shared/elements/__tests__/overflow.test.ts +39 -0
- package/src/modules/shared/elements/overflow.ts +71 -0
- package/src/modules/shared/fetch/fetch.ts +52 -0
- package/src/modules/shared/helpers/helpers.ts +141 -0
- package/src/modules/shared/i18n/i18n.ts +74 -0
- package/src/modules/shared/labels/__tests__/helpers.test.ts +107 -0
- package/src/modules/shared/labels/__tests__/pointHelpers.test.ts +33 -0
- package/src/modules/shared/labels/__tests__/timeHelpers.test.ts +89 -0
- package/src/modules/shared/labels/helpers.ts +23 -0
- package/src/modules/shared/labels/pointHelpers.ts +47 -0
- package/src/modules/shared/labels/timeHelpers.ts +182 -0
- package/src/modules/shared/labels/types.d.ts +5 -0
- package/src/modules/shared/logger/logger.ts +33 -0
- package/src/modules/shared/menu/menu.ts +239 -0
- package/src/modules/shared/overflow/__tests__/overflow.test.ts +39 -0
- package/src/modules/shared/overflow/overflow.ts +71 -0
- package/src/modules/shared/polling-request.ts +97 -0
- package/src/modules/shared/testutils.ts +118 -0
- package/src/modules/shared/track/track.ts +23 -0
- package/src/modules/shared/trailhead.ts +123 -0
- package/src/modules/shared/types.d.ts +1 -0
- package/src/modules/shared/useEffectAttr.ts +16 -0
- package/src/modules/shared/withState.ts +21 -0
- package/src/modules/tds/appLauncher/__fixtures__/index.ts +34 -0
- package/src/modules/tds/appLauncher/__tests__/appLauncher.test.ts +119 -0
- package/src/modules/tds/appLauncher/appLauncher.css +65 -0
- package/src/modules/tds/appLauncher/appLauncher.html +38 -0
- package/src/modules/tds/appLauncher/appLauncher.stories.ts +39 -0
- package/src/modules/tds/appLauncher/appLauncher.ts +79 -0
- package/src/modules/tds/appLauncher/types.ts +8 -0
- package/src/modules/tds/avatar/__tests__/avatar.test.ts +11 -0
- package/src/modules/tds/avatar/avatar.css +77 -0
- package/src/modules/tds/avatar/avatar.html +36 -0
- package/src/modules/tds/avatar/avatar.stories.ts +64 -0
- package/src/modules/tds/avatar/avatar.ts +50 -0
- package/src/modules/tds/badge/__tests__/badge.test.js +11 -0
- package/src/modules/tds/badge/badge.css +22 -0
- package/src/modules/tds/badge/badge.html +5 -0
- package/src/modules/tds/badge/badge.stories.ts +10 -0
- package/src/modules/tds/badge/badge.ts +9 -0
- package/src/modules/tds/button/__tests__/button.test.ts +52 -0
- package/src/modules/tds/button/button.css +1 -0
- package/src/modules/tds/button/button.html +20 -0
- package/src/modules/tds/button/button.stories.js +54 -0
- package/src/modules/tds/button/button.ts +59 -0
- package/src/modules/tds/buttonIcon/__tests__/buttonIcon.test.ts +17 -0
- package/src/modules/tds/buttonIcon/buttonIcon.css +1 -0
- package/src/modules/tds/buttonIcon/buttonIcon.html +12 -0
- package/src/modules/tds/buttonIcon/buttonIcon.stories.js +38 -0
- package/src/modules/tds/buttonIcon/buttonIcon.ts +6 -0
- package/src/modules/tds/buttonIconLink/buttonIconLink.css +1 -0
- package/src/modules/tds/buttonIconLink/buttonIconLink.html +14 -0
- package/src/modules/tds/buttonIconLink/buttonIconLink.stories.ts +32 -0
- package/src/modules/tds/buttonIconLink/buttonIconLink.ts +9 -0
- package/src/modules/tds/buttonLink/__tests__/buttonLink.test.ts +17 -0
- package/src/modules/tds/buttonLink/buttonLink.css +1 -0
- package/src/modules/tds/buttonLink/buttonLink.html +19 -0
- package/src/modules/tds/buttonLink/buttonLink.stories.js +24 -0
- package/src/modules/tds/buttonLink/buttonLink.ts +8 -0
- package/src/modules/tds/buttonStyles/buttonStyles.css +232 -0
- package/src/modules/tds/childSummary/__tests__/childSummary.test.js +99 -0
- package/src/modules/tds/childSummary/childSummary.css +74 -0
- package/src/modules/tds/childSummary/childSummary.html +38 -0
- package/src/modules/tds/childSummary/childSummary.stories.ts +40 -0
- package/src/modules/tds/childSummary/childSummary.ts +63 -0
- package/src/modules/tds/childSummary/types.d.ts +10 -0
- package/src/modules/tds/contentChildListItem/__tests__/contentChildListItem.test.ts +32 -0
- package/src/modules/tds/contentChildListItem/contentChildListItem.css +1 -0
- package/src/modules/tds/contentChildListItem/contentChildListItem.html +10 -0
- package/src/modules/tds/contentChildListItem/contentChildListItem.stories.ts +46 -0
- package/src/modules/tds/contentChildListItem/contentChildListItem.ts +34 -0
- package/src/modules/tds/contentIcon/contentIcon.css +47 -0
- package/src/modules/tds/contentIcon/contentIcon.html +15 -0
- package/src/modules/tds/contentIcon/contentIcon.stories.js +110 -0
- package/src/modules/tds/contentIcon/contentIcon.ts +66 -0
- package/src/modules/tds/contextAdapter/__tests__/contextAdapter.test.ts +76 -0
- package/src/modules/tds/contextAdapter/constants.ts +1 -0
- package/src/modules/tds/contextAdapter/contextAdapter.html +1 -0
- package/src/modules/tds/contextAdapter/contextAdapter.ts +54 -0
- package/src/modules/tds/dialogStyles/dialogStyles.css +90 -0
- package/src/modules/tds/footerLinks/__tests__/__snapshots__/footerLinks.test.ts.snap +3 -0
- package/src/modules/tds/footerLinks/__tests__/footerLinks.test.ts +142 -0
- package/src/modules/tds/footerLinks/footerLinks.css +80 -0
- package/src/modules/tds/footerLinks/footerLinks.html +30 -0
- package/src/modules/tds/footerLinks/footerLinks.ts +48 -0
- package/src/modules/tds/footerLinks/types.ts +11 -0
- package/src/modules/tds/footerMfe/footerMfe.html +3 -0
- package/src/modules/tds/footerMfe/footerMfe.ts +19 -0
- package/src/modules/tds/headerAvatar/__tests__/headerAvatar.test.ts +43 -0
- package/src/modules/tds/headerAvatar/headerAvatar.css +45 -0
- package/src/modules/tds/headerAvatar/headerAvatar.html +25 -0
- package/src/modules/tds/headerAvatar/headerAvatar.ts +15 -0
- package/src/modules/tds/headerHelpButton/__tests__/headerHelpButton.test.ts +32 -0
- package/src/modules/tds/headerHelpButton/headerHelpButton.css +14 -0
- package/src/modules/tds/headerHelpButton/headerHelpButton.html +19 -0
- package/src/modules/tds/headerHelpButton/headerHelpButton.ts +12 -0
- package/src/modules/tds/heading/__tests__/heading.test.ts +50 -0
- package/src/modules/tds/heading/heading.css +1 -0
- package/src/modules/tds/heading/heading.html +9 -0
- package/src/modules/tds/heading/heading.stories.ts +36 -0
- package/src/modules/tds/heading/heading.ts +36 -0
- package/src/modules/tds/icon/icon.css +28 -0
- package/src/modules/tds/icon/icon.html +17 -0
- package/src/modules/tds/icon/icon.stories.js +18 -0
- package/src/modules/tds/icon/icon.ts +79 -0
- package/src/modules/tds/input/__tests__/input.test.ts +41 -0
- package/src/modules/tds/input/input.css +34 -0
- package/src/modules/tds/input/input.html +12 -0
- package/src/modules/tds/input/input.stories.ts +25 -0
- package/src/modules/tds/input/input.ts +41 -0
- package/src/modules/tds/instrumentation/instrumentation.css +0 -0
- package/src/modules/tds/instrumentation/instrumentation.html +1 -0
- package/src/modules/tds/instrumentation/instrumentation.ts +113 -0
- package/src/modules/tds/pbCard/pbCard.css +28 -0
- package/src/modules/tds/pbCard/pbCard.html +21 -0
- package/src/modules/tds/pbCard/pbCard.ts +18 -0
- package/src/modules/tds/pill/__tests__/pill.test.ts +56 -0
- package/src/modules/tds/pill/pill.css +70 -0
- package/src/modules/tds/pill/pill.html +17 -0
- package/src/modules/tds/pill/pill.stories.ts +41 -0
- package/src/modules/tds/pill/pill.ts +34 -0
- package/src/modules/tds/progressBar/__tests__/progressBar.test.js +11 -0
- package/src/modules/tds/progressBar/progressBar.css +42 -0
- package/src/modules/tds/progressBar/progressBar.html +14 -0
- package/src/modules/tds/progressBar/progressBar.stories.ts +24 -0
- package/src/modules/tds/progressBar/progressBar.ts +14 -0
- package/src/modules/tds/radio/__tests__/radio.test.ts +29 -0
- package/src/modules/tds/radio/radio.css +89 -0
- package/src/modules/tds/radio/radio.html +17 -0
- package/src/modules/tds/radio/radio.stories.ts +31 -0
- package/src/modules/tds/radio/radio.ts +32 -0
- package/src/modules/tds/reset/reset.css +39 -0
- package/src/modules/tds/search/__fixtures__/index.ts +32 -0
- package/src/modules/tds/search/__tests__/search.test.ts +235 -0
- package/src/modules/tds/search/lib/__tests__/__snapshots__/listbox.test.ts.snap +115 -0
- package/src/modules/tds/search/lib/__tests__/listbox.test.ts +192 -0
- package/src/modules/tds/search/lib/listbox.ts +209 -0
- package/src/modules/tds/search/search.css +122 -0
- package/src/modules/tds/search/search.html +21 -0
- package/src/modules/tds/search/search.stories.ts +20 -0
- package/src/modules/tds/search/search.ts +107 -0
- package/src/modules/tds/search/types.d.ts +22 -0
- package/src/modules/tds/searchList/searchList.css +120 -0
- package/src/modules/tds/searchList/searchList.html +43 -0
- package/src/modules/tds/searchList/searchList.stories.ts +10 -0
- package/src/modules/tds/searchList/searchList.ts +53 -0
- package/src/modules/tds/select/__tests__/select.test.ts +150 -0
- package/src/modules/tds/select/select.css +42 -0
- package/src/modules/tds/select/select.html +24 -0
- package/src/modules/tds/select/select.stories.ts +59 -0
- package/src/modules/tds/select/select.ts +60 -0
- package/src/modules/tds/spinner/__tests__/spinner.test.ts +11 -0
- package/src/modules/tds/spinner/spinner.css +194 -0
- package/src/modules/tds/spinner/spinner.html +9 -0
- package/src/modules/tds/spinner/spinner.stories.ts +20 -0
- package/src/modules/tds/spinner/spinner.ts +15 -0
- package/src/modules/tds/styles/styles.css +24 -0
- package/src/modules/tds/summary/__tests__/summary.test.ts +135 -0
- package/src/modules/tds/summary/summary.css +135 -0
- package/src/modules/tds/summary/summary.html +69 -0
- package/src/modules/tds/summary/summary.stories.js +148 -0
- package/src/modules/tds/summary/summary.ts +95 -0
- package/src/modules/tds/tab/__tests__/tab.test.ts +25 -0
- package/src/modules/tds/tab/tab.css +3 -0
- package/src/modules/tds/tab/tab.html +5 -0
- package/src/modules/tds/tab/tab.ts +46 -0
- package/src/modules/tds/tabset/__tests__/tabset.test.ts +108 -0
- package/src/modules/tds/tabset/tabset.css +112 -0
- package/src/modules/tds/tabset/tabset.html +63 -0
- package/src/modules/tds/tabset/tabset.stories.ts +32 -0
- package/src/modules/tds/tabset/tabset.ts +232 -0
- package/src/modules/tds/themeProvider/themeProvider.css +502 -0
- package/src/modules/tds/themeProvider/themeProvider.html +3 -0
- package/src/modules/tds/themeProvider/themeProvider.ts +37 -0
- package/src/modules/tds/tile/tile.css +23 -0
- package/src/modules/tds/tile/tile.html +5 -0
- package/src/modules/tds/tile/tile.stories.js +14 -0
- package/src/modules/tds/tile/tile.ts +12 -0
- package/src/modules/tds/xsfMfeEvents/xsfMfeEvents.html +1 -0
- package/src/modules/tds/xsfMfeEvents/xsfMfeEvents.ts +47 -0
- package/src/modules/th/contextAdapter/__tests__/contextAdapter.test.ts +104 -0
- package/src/modules/th/contextAdapter/contextAdapter.html +1 -0
- package/src/modules/th/contextAdapter/contextAdapter.ts +49 -0
- package/src/modules/th/favoriteButton/__tests__/favoriteButton.test.ts +56 -0
- package/src/modules/th/favoriteButton/favoriteButton.css +3 -0
- package/src/modules/th/favoriteButton/favoriteButton.html +15 -0
- package/src/modules/th/favoriteButton/favoriteButton.stories.js +30 -0
- package/src/modules/th/favoriteButton/favoriteButton.ts +84 -0
- package/src/modules/th/favoriteButton/mocks/index.ts +12 -0
- package/src/modules/th/search/__fixtures__/index.ts +14 -0
- package/src/modules/th/search/__tests__/search.test.ts +233 -0
- package/src/modules/th/search/constants.ts +2 -0
- package/src/modules/th/search/mocks/index.ts +30 -0
- package/src/modules/th/search/mocks/responses.ts +54 -0
- package/src/modules/th/search/search.css +4 -0
- package/src/modules/th/search/search.html +12 -0
- package/src/modules/th/search/search.ts +172 -0
- package/src/modules/th/search/types.d.ts +29 -0
- package/src/modules/th/tbid/__tests__/__snapshots__/tbid.test.ts.snap +3 -0
- package/src/modules/th/tbid/__tests__/tbid.test.ts +242 -0
- package/src/modules/th/tbid/tbid.html +1 -0
- package/src/modules/th/tbid/tbid.stories.mdx +25 -0
- package/src/modules/th/tbid/tbid.ts +215 -0
- package/src/modules/tm/card/__tests__/card.test.ts +65 -0
- package/src/modules/tm/card/card.css +131 -0
- package/src/modules/tm/card/card.html +81 -0
- package/src/modules/tm/card/card.ts +269 -0
- package/src/modules/tm/cardBase/cardBase.css +11 -0
- package/src/modules/tm/cardGridA/cardGridA.css +11 -0
- package/src/modules/tm/cardGridA/cardGridA.html +21 -0
- package/src/modules/tm/cardGridA/cardGridA.stories.js +107 -0
- package/src/modules/tm/cardGridA/cardGridA.ts +24 -0
- package/src/modules/tm/cardGridB/cardGridB.css +88 -0
- package/src/modules/tm/cardGridB/cardGridB.html +20 -0
- package/src/modules/tm/cardGridB/cardGridB.stories.js +58 -0
- package/src/modules/tm/cardGridB/cardGridB.ts +19 -0
- package/src/modules/tm/cardGridC/cardGridC.css +24 -0
- package/src/modules/tm/cardGridC/cardGridC.html +22 -0
- package/src/modules/tm/cardGridC/cardGridC.stories.js +42 -0
- package/src/modules/tm/cardGridC/cardGridC.ts +11 -0
- package/src/modules/tm/cardGridD/cardGridD.css +17 -0
- package/src/modules/tm/cardGridD/cardGridD.html +20 -0
- package/src/modules/tm/cardGridD/cardGridD.stories.js +34 -0
- package/src/modules/tm/cardGridD/cardGridD.ts +7 -0
- package/src/modules/tm/cardNew/cardNew.css +31 -0
- package/src/modules/tm/cardNew/cardNew.html +29 -0
- package/src/modules/tm/cardNew/cardNew.ts +66 -0
- package/src/modules/tm/content/__fixtures__/index.ts +884 -0
- package/src/modules/tm/content/__tests__/content.test.ts +95 -0
- package/src/modules/tm/content/content.css +641 -0
- package/src/modules/tm/content/content.html +53 -0
- package/src/modules/tm/content/content.stories.js +14 -0
- package/src/modules/tm/content/content.ts +171 -0
- package/src/modules/tm/endCapA/__tests__/endCapA.test.ts +52 -0
- package/src/modules/tm/endCapA/endCapA.css +64 -0
- package/src/modules/tm/endCapA/endCapA.html +21 -0
- package/src/modules/tm/endCapA/endCapA.stories.js +37 -0
- package/src/modules/tm/endCapA/endCapA.ts +23 -0
- package/src/modules/tm/eventsA/eventsA.css +107 -0
- package/src/modules/tm/eventsA/eventsA.html +26 -0
- package/src/modules/tm/eventsA/eventsA.stories.js +51 -0
- package/src/modules/tm/eventsA/eventsA.ts +48 -0
- package/src/modules/tm/faqA/faqA.css +87 -0
- package/src/modules/tm/faqA/faqA.html +27 -0
- package/src/modules/tm/faqA/faqA.stories.js +25 -0
- package/src/modules/tm/faqA/faqA.ts +40 -0
- package/src/modules/tm/featureGridA/__tests__/featureGridA.test.ts +116 -0
- package/src/modules/tm/featureGridA/featureGridA.css +95 -0
- package/src/modules/tm/featureGridA/featureGridA.html +34 -0
- package/src/modules/tm/featureGridA/featureGridA.stories.js +45 -0
- package/src/modules/tm/featureGridA/featureGridA.ts +59 -0
- package/src/modules/tm/footnote/footnote.css +28 -0
- package/src/modules/tm/footnote/footnote.html +3 -0
- package/src/modules/tm/footnote/footnote.stories.js +29 -0
- package/src/modules/tm/footnote/footnote.ts +35 -0
- package/src/modules/tm/heroA/__tests__/heroA.test.ts +51 -0
- package/src/modules/tm/heroA/heroA.css +116 -0
- package/src/modules/tm/heroA/heroA.html +27 -0
- package/src/modules/tm/heroA/heroA.stories.js +49 -0
- package/src/modules/tm/heroA/heroA.ts +56 -0
- package/src/modules/tm/heroB/heroB.css +78 -0
- package/src/modules/tm/heroB/heroB.html +26 -0
- package/src/modules/tm/heroB/heroB.stories.js +44 -0
- package/src/modules/tm/heroB/heroB.ts +26 -0
- package/src/modules/tm/page/__tests__/page.test.ts +35 -0
- package/src/modules/tm/page/page.css +3 -0
- package/src/modules/tm/page/page.html +3 -0
- package/src/modules/tm/page/page.stories.js +10 -0
- package/src/modules/tm/page/page.ts +3 -0
- package/src/modules/tm/pageHeaderA/pageHeaderA.css +82 -0
- package/src/modules/tm/pageHeaderA/pageHeaderA.html +24 -0
- package/src/modules/tm/pageHeaderA/pageHeaderA.stories.js +18 -0
- package/src/modules/tm/pageHeaderA/pageHeaderA.ts +51 -0
- package/src/modules/tm/pageNavigationA/pageNavigationA.css +41 -0
- package/src/modules/tm/pageNavigationA/pageNavigationA.html +9 -0
- package/src/modules/tm/pageNavigationA/pageNavigationA.stories.js +34 -0
- package/src/modules/tm/pageNavigationA/pageNavigationA.ts +18 -0
- package/src/modules/tm/promoA/__tests__/promoA.test.ts +89 -0
- package/src/modules/tm/promoA/promoA.css +95 -0
- package/src/modules/tm/promoA/promoA.html +22 -0
- package/src/modules/tm/promoA/promoA.stories.js +38 -0
- package/src/modules/tm/promoA/promoA.ts +62 -0
- package/src/modules/tm/sectionA/sectionA.css +64 -0
- package/src/modules/tm/sectionA/sectionA.html +21 -0
- package/src/modules/tm/sectionA/sectionA.stories.js +18 -0
- package/src/modules/tm/sectionA/sectionA.ts +27 -0
- package/src/modules/tm/sectionSpacer/sectionSpacer.css +4 -0
- package/src/modules/tm/sectionSpacer/sectionSpacer.html +1 -0
- package/src/modules/tm/sectionSpacer/sectionSpacer.ts +3 -0
- package/src/modules/tm/skillsCardA/skillsCardA.css +73 -0
- package/src/modules/tm/skillsCardA/skillsCardA.html +37 -0
- package/src/modules/tm/skillsCardA/skillsCardA.ts +38 -0
- package/src/modules/tm/skillsGridA/skillsGridA.css +12 -0
- package/src/modules/tm/skillsGridA/skillsGridA.html +5 -0
- package/src/modules/tm/skillsGridA/skillsGridA.stories.ts +65 -0
- package/src/modules/tm/skillsGridA/skillsGridA.ts +3 -0
- package/src/modules/tm/statsA/statsA.css +26 -0
- package/src/modules/tm/statsA/statsA.html +10 -0
- package/src/modules/tm/statsA/statsA.stories.js +29 -0
- package/src/modules/tm/statsA/statsA.ts +20 -0
- package/src/modules/tm/textItem/textItem.css +53 -0
- package/src/modules/tm/textItem/textItem.html +18 -0
- package/src/modules/tm/textItem/textItem.ts +32 -0
- package/src/modules/tm/textItemGridA/textItemGridA.css +11 -0
- package/src/modules/tm/textItemGridA/textItemGridA.html +15 -0
- package/src/modules/tm/textItemGridA/textItemGridA.stories.js +67 -0
- package/src/modules/tm/textItemGridA/textItemGridA.ts +20 -0
- package/src/modules/tm/threeCardGrid/threeCardGrid.css +6 -0
- package/src/modules/tm/threeCardGrid/threeCardGrid.html +5 -0
- package/src/modules/tm/threeCardGrid/threeCardGrid.ts +3 -0
- package/src/modules/tm/trailblazersA/trailblazersA.css +70 -0
- package/src/modules/tm/trailblazersA/trailblazersA.html +42 -0
- package/src/modules/tm/trailblazersA/trailblazersA.stories.js +52 -0
- package/src/modules/tm/trailblazersA/trailblazersA.ts +43 -0
- package/src/modules/tm/utils/utils.ts +18 -0
- package/src/modules/tm/youtube/youtube.css +7 -0
- package/src/modules/tm/youtube/youtube.html +10 -0
- package/src/modules/tm/youtube/youtube.stories.js +15 -0
- package/src/modules/tm/youtube/youtube.ts +27 -0
- package/src/modules/ui/focusTrap/focusTrap.html +5 -0
- package/src/modules/ui/focusTrap/focusTrap.ts +104 -0
- package/src/modules/ui/focusVisible/__tests__/focusVisible.test.ts +95 -0
- package/src/modules/ui/focusVisible/focusVisible.html +3 -0
- package/src/modules/ui/focusVisible/focusVisible.ts +46 -0
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
import { ShadowRootTheGoodPart } from 'lwc';
|
|
2
|
+
|
|
3
|
+
type Input = {
|
|
4
|
+
onChange: (state: ListboxState) => void;
|
|
5
|
+
onSelect: (index: number) => void;
|
|
6
|
+
onSubmit: () => void;
|
|
7
|
+
shadowRoot: ShadowRootTheGoodPart;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export type ListboxState = {
|
|
11
|
+
active: boolean;
|
|
12
|
+
selectedIndex: number;
|
|
13
|
+
setup: boolean;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export type Selector = 'root' | 'input' | 'options' | 'option';
|
|
17
|
+
|
|
18
|
+
const SELECTOR_ROOT = 'root';
|
|
19
|
+
const SELECTOR_INPUT = 'input';
|
|
20
|
+
const SELECTOR_OPTIONS = 'options';
|
|
21
|
+
const SELECTOR_OPTION = 'option';
|
|
22
|
+
|
|
23
|
+
export function getSelector(selector: Selector) {
|
|
24
|
+
return `[data-listbox="${selector}"]`;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export class Listbox {
|
|
28
|
+
private _count: number = 0;
|
|
29
|
+
private _state: ListboxState = {
|
|
30
|
+
active: false,
|
|
31
|
+
selectedIndex: -1,
|
|
32
|
+
setup: false
|
|
33
|
+
};
|
|
34
|
+
private get state(): ListboxState {
|
|
35
|
+
return this._state;
|
|
36
|
+
}
|
|
37
|
+
private set state(value: ListboxState) {
|
|
38
|
+
this._state = value;
|
|
39
|
+
this.update();
|
|
40
|
+
this.input.onChange(this._state);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
private get isExpanded() {
|
|
44
|
+
return this.state.active && this._count > 0;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
private hover = false;
|
|
48
|
+
|
|
49
|
+
constructor(private input: Input) {
|
|
50
|
+
input.onChange(this.state);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
private setState(
|
|
54
|
+
nextState:
|
|
55
|
+
| Partial<ListboxState>
|
|
56
|
+
| ((state: ListboxState) => Partial<ListboxState>)
|
|
57
|
+
) {
|
|
58
|
+
let { state } = this;
|
|
59
|
+
this.state = {
|
|
60
|
+
...state,
|
|
61
|
+
...(typeof nextState === 'function' ? nextState(state) : nextState)
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
renderedCallback() {
|
|
66
|
+
if (!this.state.setup) {
|
|
67
|
+
let $input = this.getElement('input')!;
|
|
68
|
+
let $options = this.getElement(SELECTOR_OPTIONS)!;
|
|
69
|
+
$input.addEventListener('blur', this.onBlur as EventListener);
|
|
70
|
+
$input.addEventListener('focus', this.onFocus as EventListener);
|
|
71
|
+
$input.addEventListener('keydown', this.onKeyDown as EventListener);
|
|
72
|
+
$options.addEventListener('click', this.onClick as EventListener);
|
|
73
|
+
$options.addEventListener('mouseenter', this.onMouseEnter as EventListener);
|
|
74
|
+
$options.addEventListener('mouseleave', this.onMouseLeave as EventListener);
|
|
75
|
+
this.state.setup = true;
|
|
76
|
+
}
|
|
77
|
+
this._count = this.input.shadowRoot.querySelectorAll(
|
|
78
|
+
getSelector(SELECTOR_OPTION)
|
|
79
|
+
).length;
|
|
80
|
+
this.update();
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
disconnectedCallback() {
|
|
84
|
+
let $input = this.getElement(SELECTOR_INPUT)!;
|
|
85
|
+
let $options = this.getElement(SELECTOR_OPTIONS)!;
|
|
86
|
+
if ($input) {
|
|
87
|
+
$input.removeEventListener('blur', this.onBlur as EventListener);
|
|
88
|
+
$input.removeEventListener('focus', this.onFocus as EventListener);
|
|
89
|
+
$input.removeEventListener('keydown', this.onKeyDown as EventListener);
|
|
90
|
+
}
|
|
91
|
+
if ($options) {
|
|
92
|
+
$options.removeEventListener('click', this.onClick as EventListener);
|
|
93
|
+
$options.removeEventListener('mouseenter', this.onMouseEnter as EventListener);
|
|
94
|
+
$options.removeEventListener('mouseleave', this.onMouseLeave as EventListener);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
private getElement(selector: Selector) {
|
|
99
|
+
return this.input.shadowRoot.querySelector(getSelector(selector));
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
private onClick = (e: MouseEvent) => {
|
|
103
|
+
let selectedIndex = Array.from(
|
|
104
|
+
this.input.shadowRoot.querySelectorAll(getSelector(SELECTOR_OPTION))
|
|
105
|
+
).findIndex((n) => n.contains(e.target as HTMLElement));
|
|
106
|
+
this.setState({ active: false, selectedIndex });
|
|
107
|
+
this.input.onSelect(this.state.selectedIndex);
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
private onBlur = (e: FocusEvent) => {
|
|
111
|
+
if (!this.hover) {
|
|
112
|
+
this.setState({ active: false });
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
private onFocus = (e: FocusEvent) => {
|
|
117
|
+
this.setState({ active: true, selectedIndex: -1 });
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
private onKeyDown = (e: KeyboardEvent) => {
|
|
121
|
+
switch (e.key) {
|
|
122
|
+
case 'ArrowUp':
|
|
123
|
+
this.setState((state) => {
|
|
124
|
+
let { selectedIndex } = state;
|
|
125
|
+
selectedIndex--;
|
|
126
|
+
if (selectedIndex < 0) selectedIndex = this._count - 1;
|
|
127
|
+
return { selectedIndex };
|
|
128
|
+
});
|
|
129
|
+
break;
|
|
130
|
+
case 'ArrowDown':
|
|
131
|
+
this.setState((state) => {
|
|
132
|
+
let { selectedIndex } = state;
|
|
133
|
+
selectedIndex++;
|
|
134
|
+
if (selectedIndex === this._count) selectedIndex = 0;
|
|
135
|
+
return { selectedIndex };
|
|
136
|
+
});
|
|
137
|
+
break;
|
|
138
|
+
case 'Enter':
|
|
139
|
+
this.setState({ active: false });
|
|
140
|
+
if (this.state.selectedIndex > -1) {
|
|
141
|
+
this.input.onSelect(this.state.selectedIndex);
|
|
142
|
+
} else {
|
|
143
|
+
this.input.onSubmit();
|
|
144
|
+
}
|
|
145
|
+
break;
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
private onMouseEnter = (e: MouseEvent) => {
|
|
150
|
+
this.hover = true;
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
private onMouseLeave = (e: MouseEvent) => {
|
|
154
|
+
this.hover = false;
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
private setRootAttributes() {
|
|
158
|
+
let $root = this.getElement(SELECTOR_ROOT)!;
|
|
159
|
+
$root.setAttribute('aria-expanded', String(this.isExpanded));
|
|
160
|
+
$root.setAttribute('aria-haspopup', 'listbox');
|
|
161
|
+
$root.setAttribute('role', 'combobox');
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
private setInputAttributes() {
|
|
165
|
+
let $activeDecendant = this.input.shadowRoot.querySelectorAll(
|
|
166
|
+
getSelector(SELECTOR_OPTION)
|
|
167
|
+
)[this.state.selectedIndex] as HTMLElement | undefined;
|
|
168
|
+
let $input = this.getElement(SELECTOR_INPUT)!;
|
|
169
|
+
let $options = this.getElement(SELECTOR_OPTIONS)!;
|
|
170
|
+
$input.setAttribute(
|
|
171
|
+
'aria-activedescendant',
|
|
172
|
+
$activeDecendant ? $activeDecendant.getAttribute('id') || '' : ''
|
|
173
|
+
);
|
|
174
|
+
$input.setAttribute('aria-autocomplete', 'list');
|
|
175
|
+
$input.setAttribute('aria-controls', $options.getAttribute('id') || '');
|
|
176
|
+
$input.setAttribute('autocomplete', 'off');
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
private setListboxAttributes() {
|
|
180
|
+
let $options = this.getElement(SELECTOR_OPTIONS)!;
|
|
181
|
+
$options.setAttribute('role', 'listbox');
|
|
182
|
+
$options.setAttribute('aria-hidden', String(!this.isExpanded));
|
|
183
|
+
this.input.shadowRoot.querySelectorAll('ui,li').forEach((node) => {
|
|
184
|
+
let element = node as HTMLElement;
|
|
185
|
+
if (element.hasAttribute('role')) return;
|
|
186
|
+
element.setAttribute('role', 'presentation');
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
private setListboxItemAttributes() {
|
|
191
|
+
this.input.shadowRoot
|
|
192
|
+
.querySelectorAll(getSelector(SELECTOR_OPTION))
|
|
193
|
+
.forEach((node, i) => {
|
|
194
|
+
let element = node as HTMLElement;
|
|
195
|
+
element.setAttribute(
|
|
196
|
+
'aria-selected',
|
|
197
|
+
String(i === this.state.selectedIndex)
|
|
198
|
+
);
|
|
199
|
+
element.setAttribute('role', 'option');
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
private update() {
|
|
204
|
+
this.setRootAttributes();
|
|
205
|
+
this.setInputAttributes();
|
|
206
|
+
this.setListboxAttributes();
|
|
207
|
+
this.setListboxItemAttributes();
|
|
208
|
+
}
|
|
209
|
+
}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
@import 'tds/reset';
|
|
2
|
+
|
|
3
|
+
:host {
|
|
4
|
+
font-size: var(--tds-font-size-md);
|
|
5
|
+
position: relative;
|
|
6
|
+
width: 100%;
|
|
7
|
+
z-index: 10;
|
|
8
|
+
padding-top: 10px;
|
|
9
|
+
padding-bottom: 10px;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.search-input__wrapper {
|
|
13
|
+
align-items: stretch;
|
|
14
|
+
display: flex;
|
|
15
|
+
position: relative;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.search-input__label {
|
|
19
|
+
position: absolute !important;
|
|
20
|
+
height: 1px;
|
|
21
|
+
width: 1px;
|
|
22
|
+
overflow: hidden;
|
|
23
|
+
clip: rect(1px, 1px, 1px, 1px);
|
|
24
|
+
white-space: nowrap;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.search-input__input {
|
|
28
|
+
border-radius: var(--tds-radius-md);
|
|
29
|
+
border: 1px solid var(--tds-color-fog);
|
|
30
|
+
color: var(--tds-color-black);
|
|
31
|
+
flex: 1;
|
|
32
|
+
font-family: inherit;
|
|
33
|
+
font-size: var(--tds-font-size-md);
|
|
34
|
+
line-height: 1.875;
|
|
35
|
+
overflow: hidden;
|
|
36
|
+
padding: 0.4rem 0;
|
|
37
|
+
padding-left: var(--tds-spacing-8);
|
|
38
|
+
position: relative;
|
|
39
|
+
text-overflow: ellipsis;
|
|
40
|
+
transition: border 0.1s linear, background-color 0.1s linear;
|
|
41
|
+
white-space: nowrap;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.search-input__icon {
|
|
45
|
+
color: var(--tds-color-granite);
|
|
46
|
+
left: 10px;
|
|
47
|
+
position: absolute;
|
|
48
|
+
top: 13px;
|
|
49
|
+
z-index: 1;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.search-results {
|
|
53
|
+
background-color: white;
|
|
54
|
+
border-radius: var(--tds-radius-lg);
|
|
55
|
+
box-shadow: var(--tds-shadow-lg);
|
|
56
|
+
left: 0;
|
|
57
|
+
position: absolute;
|
|
58
|
+
top: 100%;
|
|
59
|
+
width: 100%;
|
|
60
|
+
padding: var(--tds-spacing-6);
|
|
61
|
+
box-sizing: border-box;
|
|
62
|
+
margin-top: var(--tds-spacing-1);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.search-result:hover,
|
|
66
|
+
.search-result[aria-selected='true'] {
|
|
67
|
+
background-color: var(--tds-color-sand);
|
|
68
|
+
cursor: pointer;
|
|
69
|
+
border-radius: var(--tds-radius-lg);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.search-result,
|
|
73
|
+
.search-result__heading {
|
|
74
|
+
color: var(--tds-color-black);
|
|
75
|
+
font-size: var(--tds-font-size-sm);
|
|
76
|
+
line-height: var(--tds-line-height-snug);
|
|
77
|
+
padding-left: var(--tds-spacing-2);
|
|
78
|
+
padding-right: var(--tds-spacing-2);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.search-result__heading {
|
|
82
|
+
font-weight: bold;
|
|
83
|
+
margin: var(--tds-spacing-5) 0 var(--tds-spacing-1) 0;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.search-result__group:first-child .search-result__heading {
|
|
87
|
+
font-weight: bold;
|
|
88
|
+
margin: 0 0 var(--tds-spacing-1) 0;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.search-result {
|
|
92
|
+
align-items: center;
|
|
93
|
+
display: flex;
|
|
94
|
+
padding: var(--tds-spacing-2);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.search-result__icon {
|
|
98
|
+
color: #b0adab; /* TODO: token */
|
|
99
|
+
margin-right: var(--tds-spacing-2);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.search-result__image {
|
|
103
|
+
border-radius: var(--tds-radius-lg);
|
|
104
|
+
margin-right: var(--tds-spacing-2);
|
|
105
|
+
max-width: 40px;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.search-result__pretitle {
|
|
109
|
+
color: var(--tds-color-meteorite);
|
|
110
|
+
font-size: var(--tds-font-size-sm);
|
|
111
|
+
line-height: var(--tds-line-height-snug);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.search-result__title {
|
|
115
|
+
color: var(--tds-color-black);
|
|
116
|
+
font-size: var(--tds-font-size-md);
|
|
117
|
+
font-weight: bold;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
[data-listbox='options'][aria-hidden='true'] {
|
|
121
|
+
display: none;
|
|
122
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="search" data-listbox="root">
|
|
3
|
+
<div class="search-input__wrapper">
|
|
4
|
+
<label class="search-input__label" for="search"
|
|
5
|
+
>{placeholder}</label
|
|
6
|
+
>
|
|
7
|
+
<tds-icon
|
|
8
|
+
class="search-input__icon"
|
|
9
|
+
size="small"
|
|
10
|
+
symbol="search"
|
|
11
|
+
></tds-icon>
|
|
12
|
+
<input
|
|
13
|
+
class="search-input__input"
|
|
14
|
+
id="search"
|
|
15
|
+
onkeydown={onInput}
|
|
16
|
+
onfocus={onFocus}
|
|
17
|
+
placeholder={placeholder}
|
|
18
|
+
/>
|
|
19
|
+
</div>
|
|
20
|
+
</div>
|
|
21
|
+
</template>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { html } from 'lit-html';
|
|
2
|
+
|
|
3
|
+
import { completions, recents } from './__fixtures__/';
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
title: 'tds/tds-search',
|
|
7
|
+
parameters: {
|
|
8
|
+
modules: ['/modules/tds-search.js']
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const Completions = () =>
|
|
13
|
+
html`
|
|
14
|
+
<tds-search .completions=${completions} placeholder="Really really long placeholder that is too long"></th-search>
|
|
15
|
+
`;
|
|
16
|
+
|
|
17
|
+
export const Recents = () =>
|
|
18
|
+
html`
|
|
19
|
+
<tds-search .recents=${recents}></th-search>
|
|
20
|
+
`;
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { api, LightningElement } from 'lwc';
|
|
2
|
+
|
|
3
|
+
import { Listbox, ListboxState } from './lib/listbox';
|
|
4
|
+
|
|
5
|
+
import { Completion, RecentSection, SearchEvent } from './types';
|
|
6
|
+
|
|
7
|
+
export default class extends LightningElement {
|
|
8
|
+
@api completions: Completion[] | null = [];
|
|
9
|
+
@api defaultValue: string | null = null;
|
|
10
|
+
@api placeholder: string = 'Search on architect.salesforce.com';
|
|
11
|
+
@api recents: RecentSection[] | null = null;
|
|
12
|
+
|
|
13
|
+
private completionTerms: string | null = null;
|
|
14
|
+
private setup = false;
|
|
15
|
+
|
|
16
|
+
private listbox = new Listbox({
|
|
17
|
+
onChange: (state) => {
|
|
18
|
+
this.listboxState = state;
|
|
19
|
+
},
|
|
20
|
+
onSelect: (index) => {
|
|
21
|
+
let { completions, hasCompletions, hasRecents, recents } = this;
|
|
22
|
+
if (hasCompletions) {
|
|
23
|
+
this.dispatchSearchEvent({
|
|
24
|
+
type: 'completion',
|
|
25
|
+
value: completions![index]
|
|
26
|
+
});
|
|
27
|
+
} else if (hasRecents) {
|
|
28
|
+
this.dispatchSearchEvent({
|
|
29
|
+
type: 'recent',
|
|
30
|
+
value: recents!.flatMap((s) => s.items)[index]
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
onSubmit: () => {
|
|
35
|
+
let { completionTerms } = this;
|
|
36
|
+
if (!completionTerms) return;
|
|
37
|
+
this.dispatchSearchEvent({ type: 'input', value: completionTerms });
|
|
38
|
+
},
|
|
39
|
+
shadowRoot: this.template
|
|
40
|
+
});
|
|
41
|
+
private listboxState: ListboxState | null = null;
|
|
42
|
+
|
|
43
|
+
private get hasCompletions() {
|
|
44
|
+
return this.completions && this.completions.length > 0;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
private get hasRecents() {
|
|
48
|
+
return this.recents && this.recents.length > 0;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
private get recentsWithStyle() {
|
|
52
|
+
return this.recents!.map((section) =>
|
|
53
|
+
Object.assign({}, section, {
|
|
54
|
+
items: section.items.map((item) =>
|
|
55
|
+
Object.assign({}, item, {
|
|
56
|
+
iconStyle: item.iconBackgroundColor
|
|
57
|
+
? `background-color: ${item.iconBackgroundColor};`
|
|
58
|
+
: ''
|
|
59
|
+
})
|
|
60
|
+
)
|
|
61
|
+
})
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
private dispatchSearchEvent(event: SearchEvent) {
|
|
66
|
+
this.dispatchEvent(new CustomEvent('search', { detail: event }));
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
private onFocus(e: FocusEvent) {
|
|
70
|
+
this.dispatchEvent(new CustomEvent('focus'));
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
private onInput(e: InputEvent) {
|
|
74
|
+
let { value } = e.currentTarget as HTMLInputElement;
|
|
75
|
+
if ((e as any).key === 'Enter') {
|
|
76
|
+
const search = encodeURIComponent(value);
|
|
77
|
+
window.location.replace(`/search/?keywords=${search}`);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
private get showRecents() {
|
|
82
|
+
let { completionTerms, hasCompletions, hasRecents, listboxState } =
|
|
83
|
+
this;
|
|
84
|
+
if (!listboxState) return false;
|
|
85
|
+
if (completionTerms && completionTerms.length) return false;
|
|
86
|
+
return listboxState.active && hasRecents && !hasCompletions;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
private get showCompletions() {
|
|
90
|
+
let { hasCompletions, listboxState } = this;
|
|
91
|
+
if (!listboxState) return false;
|
|
92
|
+
return listboxState.active && hasCompletions;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
renderedCallback() {
|
|
96
|
+
if (!this.setup) {
|
|
97
|
+
this.setup = true;
|
|
98
|
+
if (this.defaultValue) {
|
|
99
|
+
let input = this.template.querySelector(
|
|
100
|
+
'input'
|
|
101
|
+
) as HTMLInputElement;
|
|
102
|
+
input.value = this.defaultValue;
|
|
103
|
+
this.completionTerms = this.defaultValue;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export type Completion = {
|
|
2
|
+
value: string;
|
|
3
|
+
valueHighlighted?: string;
|
|
4
|
+
};
|
|
5
|
+
|
|
6
|
+
export type Recent = {
|
|
7
|
+
icon?: string;
|
|
8
|
+
iconBackgroundColor?: string;
|
|
9
|
+
path: string;
|
|
10
|
+
pretitle: string;
|
|
11
|
+
title: string;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export type RecentSection = {
|
|
15
|
+
items: Recent[];
|
|
16
|
+
title: string;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export type SearchEvent =
|
|
20
|
+
| { type: 'completion'; value: Completion }
|
|
21
|
+
| { type: 'input'; value: string }
|
|
22
|
+
| { type: 'recent'; value: Recent };
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
@import 'tds/reset';
|
|
2
|
+
|
|
3
|
+
:host {
|
|
4
|
+
font-size: var(--tds-font-size-md);
|
|
5
|
+
position: relative;
|
|
6
|
+
width: 100%;
|
|
7
|
+
z-index: 10;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.search-input__wrapper {
|
|
11
|
+
align-items: stretch;
|
|
12
|
+
display: flex;
|
|
13
|
+
position: relative;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.search-input__label {
|
|
17
|
+
position: absolute !important;
|
|
18
|
+
height: 1px;
|
|
19
|
+
width: 1px;
|
|
20
|
+
overflow: hidden;
|
|
21
|
+
clip: rect(1px, 1px, 1px, 1px);
|
|
22
|
+
white-space: nowrap;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.search-input__input {
|
|
26
|
+
border-radius: var(--tds-radius-md);
|
|
27
|
+
border: 1px solid var(--tds-color-fog);
|
|
28
|
+
color: var(--tds-color-black);
|
|
29
|
+
flex: 1;
|
|
30
|
+
font-family: inherit;
|
|
31
|
+
font-size: var(--tds-font-size-md);
|
|
32
|
+
line-height: 1.875;
|
|
33
|
+
overflow: hidden;
|
|
34
|
+
padding: 0.4rem 0;
|
|
35
|
+
padding-left: var(--tds-spacing-8);
|
|
36
|
+
position: relative;
|
|
37
|
+
text-overflow: ellipsis;
|
|
38
|
+
transition: border 0.1s linear, background-color 0.1s linear;
|
|
39
|
+
white-space: nowrap;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.search-input__icon {
|
|
43
|
+
color: var(--tds-color-granite);
|
|
44
|
+
left: 10px;
|
|
45
|
+
position: absolute;
|
|
46
|
+
top: 13px;
|
|
47
|
+
z-index: 1;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.search-results {
|
|
51
|
+
background-color: white;
|
|
52
|
+
border-radius: var(--tds-radius-lg);
|
|
53
|
+
box-shadow: var(--tds-shadow-lg);
|
|
54
|
+
left: 0;
|
|
55
|
+
position: absolute;
|
|
56
|
+
top: 100%;
|
|
57
|
+
width: 100%;
|
|
58
|
+
padding: var(--tds-spacing-6);
|
|
59
|
+
box-sizing: border-box;
|
|
60
|
+
margin-top: var(--tds-spacing-1);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.search-result:hover,
|
|
64
|
+
.search-result[aria-selected='true'] {
|
|
65
|
+
background-color: var(--tds-color-sand);
|
|
66
|
+
cursor: pointer;
|
|
67
|
+
border-radius: var(--tds-radius-lg);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.search-result,
|
|
71
|
+
.search-result__heading {
|
|
72
|
+
color: var(--tds-color-black);
|
|
73
|
+
font-size: var(--tds-font-size-sm);
|
|
74
|
+
line-height: var(--tds-line-height-snug);
|
|
75
|
+
padding-left: var(--tds-spacing-2);
|
|
76
|
+
padding-right: var(--tds-spacing-2);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.search-result__heading {
|
|
80
|
+
font-weight: bold;
|
|
81
|
+
margin: var(--tds-spacing-5) 0 var(--tds-spacing-1) 0;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.search-result__group:first-child .search-result__heading {
|
|
85
|
+
font-weight: bold;
|
|
86
|
+
margin: 0 0 var(--tds-spacing-1) 0;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.search-result {
|
|
90
|
+
align-items: center;
|
|
91
|
+
display: flex;
|
|
92
|
+
padding: var(--tds-spacing-2);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.search-result__icon {
|
|
96
|
+
color: #b0adab; /* TODO: token */
|
|
97
|
+
margin-right: var(--tds-spacing-2);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.search-result__image {
|
|
101
|
+
border-radius: var(--tds-radius-lg);
|
|
102
|
+
margin-right: var(--tds-spacing-2);
|
|
103
|
+
max-width: 40px;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.search-result__pretitle {
|
|
107
|
+
color: var(--tds-color-meteorite);
|
|
108
|
+
font-size: var(--tds-font-size-sm);
|
|
109
|
+
line-height: var(--tds-line-height-snug);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.search-result__title {
|
|
113
|
+
color: var(--tds-color-black);
|
|
114
|
+
font-size: var(--tds-font-size-md);
|
|
115
|
+
font-weight: bold;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
[data-listbox='options'][aria-hidden='true'] {
|
|
119
|
+
display: none;
|
|
120
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<tm-section-a background="white" title={titleSearchResults}>
|
|
3
|
+
<template if:true={results}>
|
|
4
|
+
<template for:each={results} for:item="result">
|
|
5
|
+
<div key={result.title}>
|
|
6
|
+
<tds-summary
|
|
7
|
+
description={result.description}
|
|
8
|
+
compact
|
|
9
|
+
display-mode="brick-tile"
|
|
10
|
+
path={result.url}
|
|
11
|
+
title={result.title}
|
|
12
|
+
>
|
|
13
|
+
<tds-content-icon
|
|
14
|
+
slot="image"
|
|
15
|
+
src={result.image}
|
|
16
|
+
size="small"
|
|
17
|
+
></tds-content-icon>
|
|
18
|
+
|
|
19
|
+
<div slot="pretitle"></div>
|
|
20
|
+
<span slot="meta-right"></span>
|
|
21
|
+
<span slot="meta-left">{result.description}</span>
|
|
22
|
+
</tds-summary>
|
|
23
|
+
<!-- prettier-ignore -->
|
|
24
|
+
<hr>
|
|
25
|
+
</div>
|
|
26
|
+
</template>
|
|
27
|
+
</template>
|
|
28
|
+
<template if:true={showSearchSuggestions}>
|
|
29
|
+
<div style="display: block">
|
|
30
|
+
<center>
|
|
31
|
+
<img src="/assets/images/ruth_search.png" />
|
|
32
|
+
<h4 style="padding-top: 8px">Here are some search tips</h4>
|
|
33
|
+
<span style="display: block"
|
|
34
|
+
>Check the spelling of your keywords.</span
|
|
35
|
+
><span style="display: block"
|
|
36
|
+
>Try using fewer, different, or more general
|
|
37
|
+
words.</span
|
|
38
|
+
>
|
|
39
|
+
</center>
|
|
40
|
+
</div>
|
|
41
|
+
</template>
|
|
42
|
+
</tm-section-a>
|
|
43
|
+
</template>
|