qpp-style 0.0.8 → 0.0.10
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/.eslintrc.js +28 -28
- package/.husky/pre-commit +5 -0
- package/README.md +45 -0
- package/components/Accordion/index.jsx +35 -43
- package/components/Alert/index.js +53 -0
- package/components/Breadcrumb/Breadcrumb.md +28 -0
- package/components/Breadcrumb/index.js +69 -11
- package/components/Button/index.js +90 -0
- package/components/CalloutBox/index.js +109 -0
- package/components/Card/index.js +137 -0
- package/components/Details/DetailsIcons.js +50 -0
- package/components/Details/index.js +53 -0
- package/components/Dropdown/index.js +85 -0
- package/components/DropdownButton/Menu.js +25 -0
- package/components/DropdownButton/MenuButton.js +41 -0
- package/components/DropdownButton/MenuItem.js +25 -0
- package/components/DropdownButton/MenuItemLink.js +27 -0
- package/components/Error/Collapsible.jsx +2 -2
- package/components/Footer/FooterUI.jsx +175 -177
- package/components/Footer/footer.js +2 -12
- package/components/GovBanner/index.js +117 -0
- package/components/Header/HeaderAccountMenu.jsx +63 -234
- package/components/Header/HeaderCancel.jsx +5 -10
- package/components/Header/HeaderContainer.jsx +74 -0
- package/components/Header/HeaderLogo.jsx +42 -0
- package/components/Header/HeaderMenuButton.js +50 -0
- package/components/Header/HeaderMenuItem.jsx +239 -0
- package/components/Header/HeaderMenuLink.js +56 -0
- package/components/Header/HeaderMenuSignOutButton.js +62 -0
- package/components/Header/HeaderMobileButton.js +37 -0
- package/components/Header/HeaderUI.jsx +130 -361
- package/components/Header/HelpIcon.jsx +32 -0
- package/components/Header/ImpersonatorBanner.jsx +81 -0
- package/components/Header/default-content.json +158 -87
- package/components/Header/header.js +2 -0
- package/components/Header/hooks.js +66 -0
- package/components/Header/utag-helpers.js +9 -0
- package/components/Infotip/Infotip.jsx +6 -10
- package/components/Infotip/InfotipContent.jsx +46 -0
- package/components/Infotip/InfotipIcon.jsx +3 -3
- package/components/Link/index.js +61 -0
- package/components/Modal/LegacyModal.jsx +72 -0
- package/components/Modal/Modal.jsx +140 -0
- package/components/Modal/index.jsx +13 -63
- package/components/NotificationBanner/CollapsedView.js +39 -0
- package/components/NotificationBanner/ExpandedView.js +45 -0
- package/components/NotificationBanner/index.js +219 -30
- package/components/Search/index.js +98 -0
- package/components/SessionDialog/sessionDialog.js +26 -0
- package/components/SessionDialogUI.jsx +34 -26
- package/components/SideNav/AnimationGroup/AnimationGroup.jsx +10 -4
- package/components/SideNav/Chart/ScoreChart.jsx +81 -109
- package/components/SideNav/Chart/__tests__/ScoreChart.test.js +3 -12
- package/components/SideNav/Chart/__tests__/__snapshots__/ScoreChart.test.js.snap +144 -35
- package/components/SideNav/Chart/index.js +1 -1
- package/components/SideNav/Content/LevelOneContent.jsx +146 -258
- package/components/SideNav/Content/LevelTwoContent.jsx +6 -4
- package/components/SideNav/Content/SelectRole/index.js +77 -0
- package/components/SideNav/Content/SelectRole/utils.js +140 -0
- package/components/SideNav/Details/PracticeDetails.jsx +4 -0
- package/components/SideNav/Links/CmsSwitchLink.jsx +1 -1
- package/components/SideNav/Links/NavLinkContainer.jsx +29 -34
- package/components/SideNav/Links/NavLinkDrawer.jsx +192 -124
- package/components/SideNav/Links/NavLinkInline.jsx +7 -2
- package/components/SideNav/Links/NavLinkToggle.jsx +1 -1
- package/components/SideNav/SideNav.md +28 -27
- package/components/SideNav/UI/SideNavUI.jsx +198 -268
- package/components/SideNav/UI/default-content.json +117 -0
- package/components/SideNav/helpers.js +316 -4
- package/components/Tabs/TabPanel.js +5 -0
- package/components/Tabs/Tabs.js +73 -0
- package/components/TextInput/index.js +137 -0
- package/components/hooks/useGetConfig.js +75 -0
- package/components/index.js +106 -9
- package/coverage/clover.xml +1194 -748
- package/coverage/coverage-final.json +72 -50
- package/coverage/lcov-report/block-navigation.js +8 -0
- package/coverage/lcov-report/components/Accordion/index.html +26 -21
- package/coverage/lcov-report/components/Accordion/index.jsx.html +106 -131
- package/coverage/lcov-report/{SideNav/Chart → components/Button}/index.html +29 -24
- package/coverage/lcov-report/{Error/Collapsible.jsx.html → components/Button/index.js.html} +125 -114
- package/coverage/lcov-report/components/Error/Collapsible.jsx.html +92 -87
- package/coverage/lcov-report/components/Error/ErrorUI.jsx.html +32 -33
- package/coverage/lcov-report/components/Error/index.html +11 -6
- package/coverage/lcov-report/components/Footer/FooterUI.jsx.html +200 -189
- package/coverage/lcov-report/components/Footer/SocialLinks.jsx.html +24 -61
- package/coverage/lcov-report/components/Footer/Subscribe.jsx.html +18 -13
- package/coverage/lcov-report/components/Footer/index.html +35 -45
- package/coverage/lcov-report/components/{InfoModal → GovBanner}/index.html +27 -22
- package/coverage/lcov-report/components/{InfoModal/index.jsx.html → GovBanner/index.js.html} +157 -122
- package/coverage/lcov-report/components/Header/HeaderAccountMenu.jsx.html +93 -520
- package/coverage/lcov-report/components/Header/HeaderCancel.jsx.html +19 -23
- package/coverage/lcov-report/components/Header/HeaderContainer.jsx.html +280 -0
- package/coverage/lcov-report/components/Header/HeaderLogo.jsx.html +211 -0
- package/coverage/lcov-report/components/Header/HeaderMenuButton.js.html +235 -0
- package/coverage/lcov-report/components/{Footer/LegacyFooterUI.jsx.html → Header/HeaderMenuItem.jsx.html} +334 -200
- package/coverage/lcov-report/components/Header/HeaderMenuLink.js.html +253 -0
- package/coverage/lcov-report/components/Header/HeaderMenuSignOutButton.js.html +271 -0
- package/coverage/lcov-report/components/Header/HeaderMobileButton.js.html +196 -0
- package/coverage/lcov-report/components/Header/HeaderUI.jsx.html +176 -756
- package/coverage/lcov-report/components/Header/HelpIcon.jsx.html +181 -0
- package/coverage/lcov-report/{Accordion/index.jsx.html → components/Header/ImpersonatorBanner.jsx.html} +109 -167
- package/coverage/lcov-report/components/Header/NavigationButtonIcon.jsx.html +24 -19
- package/coverage/lcov-report/components/Header/hooks.js.html +283 -0
- package/coverage/lcov-report/components/Header/index.html +203 -33
- package/coverage/lcov-report/components/{SideNav/Links/index.js.html → Header/utag-helpers.js.html} +35 -42
- package/coverage/lcov-report/components/Infotip/Infotip.jsx.html +53 -48
- package/coverage/lcov-report/components/Infotip/InfotipIcon.jsx.html +37 -32
- package/coverage/lcov-report/components/Infotip/index.html +8 -3
- package/coverage/lcov-report/components/Infotip/index.js.html +8 -3
- package/coverage/lcov-report/components/Modal/LegacyModal.jsx.html +301 -0
- package/coverage/lcov-report/components/Modal/Modal.jsx.html +505 -0
- package/coverage/lcov-report/components/Modal/index.html +146 -0
- package/coverage/lcov-report/components/{SideNav/Details/IndividualDetails.jsx.html → Modal/index.jsx.html} +50 -42
- package/coverage/lcov-report/components/NotificationBanner/CollapsedView.js.html +202 -0
- package/coverage/lcov-report/components/NotificationBanner/ExpandedView.js.html +220 -0
- package/coverage/lcov-report/components/NotificationBanner/index.html +58 -23
- package/coverage/lcov-report/components/{SideNav/Content/LevelTwoContent.jsx.html → NotificationBanner/index.js.html} +292 -272
- package/coverage/lcov-report/components/SanitizedContent/index.html +8 -3
- package/coverage/lcov-report/components/SanitizedContent/index.jsx.html +475 -50
- package/coverage/lcov-report/components/SessionDialogUI.jsx.html +248 -255
- package/coverage/lcov-report/components/SideNav/Chart/ScoreChart.jsx.html +272 -408
- package/coverage/lcov-report/components/SideNav/Chart/index.html +28 -38
- package/coverage/lcov-report/components/SideNav/Content/SelectRole/index.html +116 -0
- package/coverage/lcov-report/components/SideNav/Content/SelectRole/utils.js.html +505 -0
- package/coverage/lcov-report/components/SideNav/helpers.js.html +987 -46
- package/coverage/lcov-report/components/SideNav/index.html +24 -19
- package/coverage/lcov-report/components/Tooltip/Tooltip.jsx.html +70 -65
- package/coverage/lcov-report/components/Tooltip/index.html +8 -3
- package/coverage/lcov-report/components/Tooltip/index.js.html +8 -3
- package/coverage/lcov-report/components/Tooltip/position.js.html +57 -64
- package/coverage/lcov-report/components/hooks/index.html +116 -0
- package/coverage/lcov-report/components/hooks/useGetConfig.js.html +310 -0
- package/coverage/lcov-report/components/index.html +10 -5
- package/coverage/lcov-report/index.html +249 -154
- package/coverage/lcov-report/{Error/ErrorUI.jsx.html → lib/Chevron.jsx.html} +44 -42
- package/coverage/lcov-report/lib/SvgComponents.jsx.html +1840 -0
- package/coverage/lcov-report/lib/index.html +34 -14
- package/coverage/lcov-report/react/components/Accordion/index.html +26 -21
- package/coverage/lcov-report/react/components/Accordion/index.jsx.html +106 -131
- package/coverage/lcov-report/react/components/{FlashNotification → Button}/index.html +23 -33
- package/coverage/lcov-report/{components/SideNav/Links/NavLinkInline.jsx.html → react/components/Button/index.js.html} +119 -120
- package/coverage/lcov-report/react/components/{Tabs → Dropdown}/index.html +23 -33
- package/coverage/lcov-report/react/components/{InfoModal/index.jsx.html → Dropdown/index.js.html} +103 -155
- package/coverage/lcov-report/react/components/Error/Collapsible.jsx.html +92 -87
- package/coverage/lcov-report/react/components/Error/ErrorUI.jsx.html +32 -33
- package/coverage/lcov-report/react/components/Error/error.js.html +25 -20
- package/coverage/lcov-report/react/components/Error/index.html +11 -6
- package/coverage/lcov-report/react/components/Footer/FooterUI.jsx.html +200 -189
- package/coverage/lcov-report/react/components/Footer/LegacyFooterUI.jsx.html +14 -15
- package/coverage/lcov-report/react/components/Footer/SocialLinks.jsx.html +18 -13
- package/coverage/lcov-report/react/components/Footer/Subscribe.jsx.html +18 -13
- package/coverage/lcov-report/react/components/Footer/footer.js.html +12 -34
- package/coverage/lcov-report/react/components/Footer/index.html +35 -45
- package/coverage/lcov-report/react/components/{InfoModal → GovBanner}/index.html +27 -22
- package/coverage/lcov-report/react/components/{Tabs/TabsUI.jsx.html → GovBanner/index.js.html} +146 -153
- package/coverage/lcov-report/react/components/Header/HeaderAccountMenu.jsx.html +93 -520
- package/coverage/lcov-report/react/components/Header/HeaderCancel.jsx.html +19 -23
- package/coverage/lcov-report/react/components/Header/HeaderContainer.jsx.html +307 -0
- package/coverage/lcov-report/{components/SideNav/Links/CmsSwitchLink.jsx.html → react/components/Header/HeaderLogo.jsx.html} +64 -53
- package/coverage/lcov-report/{components/SideNav/Links/NavItemInline.jsx.html → react/components/Header/HeaderMenuButton.js.html} +64 -71
- package/coverage/lcov-report/{components/SideNav/Links/NavLinkDrawer.jsx.html → react/components/Header/HeaderMenuItem.jsx.html} +284 -261
- package/coverage/lcov-report/react/components/Header/HeaderMenuLink.js.html +253 -0
- package/coverage/lcov-report/react/components/Header/HeaderMenuSignOutButton.js.html +271 -0
- package/coverage/lcov-report/{components/SideNav/Links/NavLinkToggle.jsx.html → react/components/Header/HeaderMobileButton.js.html} +58 -41
- package/coverage/lcov-report/react/components/Header/HeaderUI.jsx.html +189 -745
- package/coverage/lcov-report/react/components/Header/HelpIcon.jsx.html +181 -0
- package/coverage/lcov-report/react/components/Header/ImpersonatorBanner.jsx.html +331 -0
- package/coverage/lcov-report/react/components/Header/NavigationButtonIcon.jsx.html +18 -13
- package/coverage/lcov-report/react/components/Header/header.js.html +18 -4
- package/coverage/lcov-report/react/components/Header/hooks.js.html +283 -0
- package/coverage/lcov-report/react/components/Header/index.html +205 -35
- package/coverage/lcov-report/react/components/{Spinner/index.js.html → Header/utag-helpers.js.html} +26 -21
- package/coverage/lcov-report/react/components/Infotip/Infotip.jsx.html +53 -48
- package/coverage/lcov-report/{components/SideNav/Links/NavLinkContainer.jsx.html → react/components/Infotip/InfotipContent.jsx.html} +83 -60
- package/coverage/lcov-report/react/components/Infotip/InfotipIcon.jsx.html +37 -32
- package/coverage/lcov-report/react/components/Infotip/index.html +8 -3
- package/coverage/lcov-report/react/components/Infotip/index.js.html +8 -3
- package/coverage/lcov-report/react/components/{FlashNotification/FlashNotificationUI.jsx.html → Modal/LegacyModal.jsx.html} +89 -84
- package/coverage/lcov-report/react/components/Modal/Modal.jsx.html +505 -0
- package/coverage/lcov-report/react/components/Modal/index.html +52 -17
- package/coverage/lcov-report/react/components/Modal/index.jsx.html +38 -201
- package/coverage/lcov-report/react/components/{Tabs/tabs.js.html → NotificationBanner/CollapsedView.js.html} +61 -47
- package/coverage/lcov-report/{components/SideNav/Details/PracticeDetails.jsx.html → react/components/NotificationBanner/ExpandedView.js.html} +74 -57
- package/coverage/lcov-report/react/components/NotificationBanner/index.html +58 -23
- package/coverage/lcov-report/react/components/NotificationBanner/index.js.html +615 -43
- package/coverage/lcov-report/react/components/SanitizedContent/index.html +8 -3
- package/coverage/lcov-report/react/components/SanitizedContent/index.jsx.html +478 -53
- package/coverage/lcov-report/react/components/{Spinner → SessionDialog}/index.html +11 -6
- package/coverage/lcov-report/react/components/{FlashNotification/index.js.html → SessionDialog/sessionDialog.js.html} +35 -42
- package/coverage/lcov-report/react/components/SessionDialogUI.jsx.html +248 -255
- package/coverage/lcov-report/react/components/SideNav/AnimationGroup/AnimationGroup.jsx.html +53 -18
- package/coverage/lcov-report/react/components/SideNav/AnimationGroup/index.html +18 -13
- package/coverage/lcov-report/react/components/SideNav/Chart/ScoreChart.jsx.html +272 -402
- package/coverage/lcov-report/react/components/SideNav/Chart/index.html +28 -23
- package/coverage/lcov-report/react/components/SideNav/Chart/index.js.html +9 -4
- package/coverage/lcov-report/react/components/SideNav/Content/LevelOneContent.jsx.html +190 -521
- package/coverage/lcov-report/react/components/SideNav/Content/LevelTwoContent.jsx.html +23 -12
- package/coverage/lcov-report/{components/SideNav/Details → react/components/SideNav/Content/SelectRole}/index.html +42 -52
- package/coverage/lcov-report/react/components/SideNav/Content/SelectRole/index.js.html +316 -0
- package/coverage/lcov-report/react/components/SideNav/Content/SelectRole/utils.js.html +505 -0
- package/coverage/lcov-report/react/components/SideNav/Content/index.html +32 -27
- package/coverage/lcov-report/react/components/SideNav/Content/index.js.html +8 -3
- package/coverage/lcov-report/react/components/SideNav/Details/IndividualDetails.jsx.html +20 -24
- package/coverage/lcov-report/react/components/SideNav/Details/PracticeDetails.jsx.html +54 -37
- package/coverage/lcov-report/react/components/SideNav/Details/index.html +23 -18
- package/coverage/lcov-report/react/components/SideNav/Details/index.js.html +8 -3
- package/coverage/lcov-report/react/components/SideNav/Links/CmsSwitchLink.jsx.html +9 -4
- package/coverage/lcov-report/react/components/SideNav/Links/NavItemInline.jsx.html +8 -3
- package/coverage/lcov-report/react/components/SideNav/Links/NavLinkContainer.jsx.html +56 -57
- package/coverage/lcov-report/react/components/SideNav/Links/NavLinkDrawer.jsx.html +351 -142
- package/coverage/lcov-report/react/components/SideNav/Links/NavLinkInline.jsx.html +60 -40
- package/coverage/lcov-report/react/components/SideNav/Links/NavLinkToggle.jsx.html +9 -4
- package/coverage/lcov-report/react/components/SideNav/Links/index.html +44 -39
- package/coverage/lcov-report/react/components/SideNav/Links/index.js.html +8 -3
- package/coverage/lcov-report/react/components/SideNav/UI/SideNavUI.jsx.html +243 -433
- package/coverage/lcov-report/react/components/SideNav/UI/index.html +28 -23
- package/coverage/lcov-report/react/components/SideNav/UI/index.js.html +8 -3
- package/coverage/lcov-report/react/components/SideNav/helpers.js.html +958 -17
- package/coverage/lcov-report/react/components/SideNav/index.html +27 -22
- package/coverage/lcov-report/react/components/SideNav/index.js.html +8 -3
- package/coverage/lcov-report/react/components/Tooltip/Tooltip.jsx.html +70 -65
- package/coverage/lcov-report/react/components/Tooltip/index.html +8 -3
- package/coverage/lcov-report/react/components/Tooltip/index.js.html +8 -3
- package/coverage/lcov-report/react/components/Tooltip/position.js.html +57 -64
- package/coverage/lcov-report/{components/SideNav/AnimationGroup → react/components/hooks}/index.html +29 -24
- package/coverage/lcov-report/react/components/hooks/useGetConfig.js.html +310 -0
- package/coverage/lcov-report/react/components/index.html +10 -5
- package/coverage/lcov-report/react/index.html +20 -15
- package/coverage/lcov-report/react/index.js.html +29 -9
- package/coverage/lcov-report/react/lib/Chevron.jsx.html +181 -0
- package/coverage/lcov-report/react/lib/SvgComponents.jsx.html +195 -106
- package/coverage/lcov-report/react/lib/index.html +37 -17
- package/coverage/lcov-report/react/lib/svg-definitions.svg.html +57 -916
- package/coverage/lcov-report/react/session/index.html +32 -27
- package/coverage/lcov-report/react/session/index.js.html +8 -3
- package/coverage/lcov-report/react/session/logout.js.html +121 -17
- package/coverage/lcov-report/react/session/refresh.js.html +11 -6
- package/coverage/lcov-report/react/session/ttl.js.html +8 -3
- package/coverage/lcov-report/session/index.html +50 -45
- package/coverage/lcov-report/session/index.js.html +8 -3
- package/coverage/lcov-report/session/logout.js.html +144 -49
- package/coverage/lcov-report/session/refresh.js.html +41 -36
- package/coverage/lcov-report/session/ttl.js.html +34 -29
- package/coverage/lcov-report/sorter.js +26 -0
- package/coverage/lcov.info +2427 -1491
- package/dist/browser.js +1 -1
- package/dist/browser.js.LICENSE.txt +1 -7
- package/dist/browser.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.LICENSE.txt +1 -7
- package/dist/index.js.map +1 -1
- package/dist/react/index.js +1 -1
- package/dist/react/index.js.LICENSE.txt +16 -16
- package/dist/react/index.js.map +1 -1
- package/fonts/PublicSans-Black.ttf +0 -0
- package/fonts/PublicSans-BlackItalic.ttf +0 -0
- package/fonts/PublicSans-Bold.ttf +0 -0
- package/fonts/PublicSans-BoldItalic.ttf +0 -0
- package/fonts/PublicSans-ExtraBold.ttf +0 -0
- package/fonts/PublicSans-ExtraBoldItalic.ttf +0 -0
- package/fonts/PublicSans-ExtraLight.ttf +0 -0
- package/fonts/PublicSans-ExtraLightItalic.ttf +0 -0
- package/fonts/PublicSans-Italic.ttf +0 -0
- package/fonts/PublicSans-Light.ttf +0 -0
- package/fonts/PublicSans-LightItalic.ttf +0 -0
- package/fonts/PublicSans-Medium.ttf +0 -0
- package/fonts/PublicSans-MediumItalic.ttf +0 -0
- package/fonts/PublicSans-Regular.ttf +0 -0
- package/fonts/PublicSans-SemiBold.ttf +0 -0
- package/fonts/PublicSans-SemiBoldItalic.ttf +0 -0
- package/fonts/PublicSans-Thin.ttf +0 -0
- package/fonts/PublicSans-ThinItalic.ttf +0 -0
- package/images/icon-dot-gov.svg +1 -0
- package/images/icon-https.svg +1 -0
- package/images/icons/close-x.svg +6 -0
- package/images/icons/svg/arrow-down.svg +3 -0
- package/images/icons/svg/arrow-download.svg +1 -0
- package/images/icons/svg/arrow-right.svg +1 -0
- package/images/icons/svg/arrow-up.svg +3 -0
- package/images/icons/svg/block.svg +5 -0
- package/images/icons/svg/calendar.svg +1 -0
- package/images/icons/svg/check-circle.svg +5 -0
- package/images/icons/svg/checkmark.svg +7 -0
- package/images/icons/svg/chevron-down.svg +11 -0
- package/images/icons/svg/chevron-left.svg +12 -0
- package/images/icons/svg/chevron-right.svg +12 -0
- package/images/icons/svg/chevron-up.svg +12 -0
- package/images/icons/svg/clipboard.svg +1 -0
- package/images/icons/svg/close.svg +1 -0
- package/images/icons/svg/divide.svg +13 -0
- package/images/icons/svg/doctors-and-clinicians-preview.svg +10 -0
- package/images/icons/svg/download.svg +1 -0
- package/images/icons/svg/dropdown-arrow.svg +1 -0
- package/images/icons/svg/equals.svg +13 -0
- package/images/icons/svg/exclamation.svg +11 -0
- package/images/icons/svg/external.svg +1 -0
- package/images/icons/svg/file-download.svg +1 -0
- package/images/icons/svg/file-upload.svg +1 -0
- package/images/icons/svg/info.svg +20 -0
- package/images/icons/svg/manage-user-access.svg +8 -0
- package/images/icons/svg/multiply.svg +12 -0
- package/images/icons/svg/performance-feedback.svg +1 -0
- package/images/icons/svg/plus.svg +12 -0
- package/images/icons/svg/preview.svg +17 -0
- package/images/icons/svg/print.svg +1 -0
- package/images/icons/svg/registration.svg +8 -0
- package/images/icons/svg/reporting.svg +17 -0
- package/images/icons/svg/save-disk.svg +5 -0
- package/images/icons/svg/search.svg +1 -0
- package/images/icons/svg/subtract.svg +15 -0
- package/images/icons/svg/targeted-review.svg +15 -0
- package/images/icons/svg/tooltip-question.svg +1 -0
- package/images/icons/svg/trash.svg +1 -0
- package/images/icons/svg/upload.svg +1 -0
- package/images/us_flag_small.png +0 -0
- package/index.js +5 -0
- package/jest.config.js +138 -134
- package/lib/Chevron.jsx +32 -0
- package/lib/SvgComponents.jsx +197 -49
- package/package.json +62 -77
- package/session/logout.js +35 -2
- package/styles/_global.scss +63 -62
- package/styles/_main.scss +6 -0
- package/styles/_qpp-style.scss +0 -3
- package/styles/components/_accordion.scss +249 -246
- package/styles/components/_autocomplete.scss +0 -3
- package/styles/components/_modals.scss +9 -9
- package/styles/components/_spinner.scss +0 -2
- package/styles/components/_tables.scss +77 -67
- package/styles/components/_text.scss +102 -102
- package/styles/components/_variables.scss +12 -12
- package/styles/qppds/base/_backgrounds.scss +7 -0
- package/styles/qppds/base/_fonts.scss +24 -0
- package/styles/qppds/base/_icon.scss +31 -0
- package/styles/qppds/base/_layout.scss +5 -0
- package/styles/qppds/base/_typography.scss +78 -44
- package/styles/qppds/base/index.scss +4 -5
- package/styles/qppds/components/_alert.scss +101 -0
- package/styles/qppds/components/_breadcrumbs.scss +42 -6
- package/styles/qppds/components/_button.scss +129 -11
- package/styles/qppds/components/_card.scss +175 -0
- package/styles/qppds/components/_checkbox.scss +199 -0
- package/styles/qppds/components/_circular-loader.scss +47 -0
- package/styles/qppds/components/_details.scss +90 -0
- package/styles/qppds/components/_dropdown-menu.scss +125 -0
- package/styles/qppds/components/_dropdown.scss +7 -1
- package/styles/qppds/components/_footer.scss +606 -0
- package/styles/qppds/components/_gov-banner.scss +344 -0
- package/styles/qppds/components/_header.scss +913 -0
- package/styles/qppds/components/_link.scss +52 -0
- package/styles/qppds/components/_modal.scss +118 -0
- package/styles/qppds/components/_page-header.scss +65 -2
- package/styles/qppds/components/_pagination.scss +227 -0
- package/styles/qppds/components/_process-list.scss +104 -0
- package/styles/qppds/components/_radio-button.scss +184 -0
- package/styles/qppds/components/_search.scss +118 -0
- package/styles/{components → qppds/components}/_sidebar.scss +2 -0
- package/styles/qppds/components/_step-indicator.scss +190 -0
- package/styles/qppds/components/_table.scss +157 -0
- package/styles/qppds/components/_tabs.scss +197 -0
- package/styles/qppds/components/_text-input.scss +60 -0
- package/styles/qppds/components/index.scss +20 -0
- package/styles/{components → qppds/components}/sidebar/_links.scss +48 -1
- package/styles/qppds/components/sidebar/_select-role-dropdown.scss +21 -0
- package/styles/qppds/components/sidebar/_sidebar-animation.scss +125 -0
- package/styles/qppds/components/sidebar/_sidebar.scss +146 -0
- package/styles/{components → qppds/components}/sidebar/project-specific/_wi.scss +1 -37
- package/styles/qppds/settings/_functions.scss +3 -1
- package/styles/qppds/settings/mixins/_borders.scss +6 -0
- package/styles/qppds/settings/mixins/_focus.scss +28 -0
- package/styles/qppds/settings/mixins/_icons.scss +39 -4
- package/styles/qppds/settings/mixins/_index.scss +4 -0
- package/styles/qppds/settings/mixins/_layout.scss +46 -7
- package/styles/qppds/settings/mixins/_table.scss +91 -0
- package/styles/qppds/settings/mixins/_type.scss +89 -0
- package/styles/qppds/settings/variables/_color.scss +47 -1
- package/styles/qppds/settings/variables/_index.scss +2 -1
- package/styles/qppds/settings/variables/_layout.scss +34 -9
- package/styles/qppds/settings/variables/_type.scss +41 -0
- package/styles/qppds/settings/variables/_z-index.scss +8 -0
- package/styles/qppds/utilities/_background-color.scss +4 -0
- package/styles/qppds/utilities/_color.scss +28 -0
- package/styles/qppds/utilities/{_display-visability.scss → _display-visibility.scss} +8 -0
- package/styles/qppds/utilities/_flexbox.scss +113 -0
- package/styles/qppds/utilities/_font-family.scss +4 -0
- package/styles/qppds/utilities/_gap.scss +38 -0
- package/styles/qppds/utilities/_height.scss +79 -0
- package/styles/qppds/utilities/_list-style.scss +18 -0
- package/styles/qppds/utilities/_position.scss +24 -0
- package/styles/qppds/utilities/_text-align.scss +40 -0
- package/styles/qppds/utilities/_text-transform.scss +7 -0
- package/styles/qppds/utilities/_truncate.scss +5 -5
- package/styles/qppds/utilities/_vertical-align.scss +72 -0
- package/styles/qppds/utilities/_width.scss +38 -1
- package/styles/qppds/utilities/index.scss +8 -2
- package/styles/third-party/legacy-bootstrap/_dropdowns.scss +0 -1
- package/svgo.config.js +14 -0
- package/test/components/Accordion.test.js +4 -13
- package/test/components/ErrorUI.test.js +10 -46
- package/test/components/FooterUI.test.js +0 -30
- package/test/components/HeaderUI.test.js +33 -15
- package/test/components/Infotip.test.js +18 -12
- package/test/components/SessionDialogUI.test.js +55 -70
- package/test/components/SideNavUI.test.js +6 -13
- package/test-setup.js +1 -3
- package/webpack.config.js +29 -39
- package/webpack.config.react.js +7 -18
- package/.storybook/.babelrc +0 -4
- package/.storybook/main.js +0 -89
- package/.storybook/preview-head.html +0 -9
- package/.storybook/preview.js +0 -16
- package/components/Accordion/Accordion.stories.js +0 -20
- package/components/Breadcrumb/Breadcrumb.js +0 -58
- package/components/Breadcrumb/Breadcrumb.stories.js +0 -62
- package/components/Breadcrumb/LegacyBreadcrumb.js +0 -46
- package/components/Footer/Footer.stories.js +0 -22
- package/components/Footer/LegacyFooterUI.jsx +0 -194
- package/components/Header/Header.stories.js +0 -32
- package/components/InfoModal/InfoModal.stories.js +0 -98
- package/components/InfoModal/index.jsx +0 -104
- package/components/Infotip/Infotip.stories.js +0 -58
- package/components/NotificationBanner/NotificationBanner.stories.js +0 -24
- package/components/NotificationBanner/NotificationBannerUI.jsx +0 -282
- package/components/SideNav/SideNav.stories.js +0 -320
- package/components/Spinner/index.js +0 -9
- package/components/Tabs/TabsUI.jsx +0 -118
- package/components/Tabs/tabs.js +0 -36
- package/components/Tooltip/Tooltip.jsx +0 -88
- package/components/Tooltip/Tooltip.stories.js +0 -90
- package/components/Tooltip/index.js +0 -3
- package/components/Tooltip/position.js +0 -68
- package/components/UnwrappedSpinner/index.js +0 -8
- package/components/UnwrappedTabs/TabPanelUI.jsx +0 -16
- package/components/UnwrappedTabs/TabsUI.jsx +0 -82
- package/coverage/lcov-report/Accordion/index.html +0 -111
- package/coverage/lcov-report/Error/index.html +0 -126
- package/coverage/lcov-report/ScoreChart.jsx.html +0 -1025
- package/coverage/lcov-report/SideNav/Chart/ScoreChart.jsx.html +0 -1025
- package/coverage/lcov-report/components/NotificationBanner/NotificationBannerUI.jsx.html +0 -1010
- package/coverage/lcov-report/components/SideNav/AnimationGroup/AnimationGroup.jsx.html +0 -131
- package/coverage/lcov-report/components/SideNav/Chart/index.js.html +0 -89
- package/coverage/lcov-report/components/SideNav/Content/LevelOneContent.jsx.html +0 -1007
- package/coverage/lcov-report/components/SideNav/Content/index.html +0 -141
- package/coverage/lcov-report/components/SideNav/Content/index.js.html +0 -92
- package/coverage/lcov-report/components/SideNav/Details/index.js.html +0 -92
- package/coverage/lcov-report/components/SideNav/Links/index.html +0 -201
- package/coverage/lcov-report/components/SideNav/UI/SideNavUI.jsx.html +0 -1298
- package/coverage/lcov-report/components/SideNav/UI/index.html +0 -126
- package/coverage/lcov-report/components/SideNav/UI/index.js.html +0 -89
- package/coverage/lcov-report/lib/svg-definitions.svg.html +0 -1319
- package/coverage/lcov-report/react/components/NotificationBanner/NotificationBannerUI.jsx.html +0 -926
- package/styles/components/_footer.scss +0 -593
- package/styles/components/_header.scss +0 -526
- package/styles/components/sidebar/_sidebar-animation.scss +0 -85
- package/styles/components/sidebar/_sidebar.scss +0 -141
- package/test/components/Tooltip.test.js +0 -147
- package/test/components/__snapshots__/Accordion.test.js.snap +0 -11439
- /package/styles/{components → qppds/components}/sidebar/_animations.scss +0 -0
- /package/styles/{components → qppds/components}/sidebar/_cms.scss +0 -0
- /package/styles/{components → qppds/components}/sidebar/_details.scss +0 -0
- /package/styles/{components → qppds/components}/sidebar/_sidebar-tooltip.scss +0 -0
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import React, { Component } from 'react';
|
|
2
|
+
import { render } from 'react-dom';
|
|
3
|
+
import ReactModal from 'react-modal';
|
|
4
|
+
import { CloseXIcon } from '../../lib/SvgComponents.jsx';
|
|
5
|
+
import SanitizedContent from '../SanitizedContent';
|
|
6
|
+
import PropTypes from 'prop-types';
|
|
7
|
+
|
|
8
|
+
class Modal extends Component {
|
|
9
|
+
constructor() {
|
|
10
|
+
super();
|
|
11
|
+
|
|
12
|
+
this.state = {
|
|
13
|
+
showModal: true,
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
this.handleOpenModal = this.handleOpenModal.bind(this);
|
|
17
|
+
this.handleCloseModal = this.handleCloseModal.bind(this);
|
|
18
|
+
|
|
19
|
+
ReactModal.setAppElement('body > *:not(.ReactModalPortal)');
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
handleOpenModal() {
|
|
23
|
+
this.setState({ showModal: true });
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
handleCloseModal() {
|
|
27
|
+
this.setState({ showModal: false });
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
UNSAFE_componentWillReceiveProps(newProps) {
|
|
31
|
+
this.setState({
|
|
32
|
+
showModal: newProps.showModal,
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
render() {
|
|
37
|
+
return (
|
|
38
|
+
<div>
|
|
39
|
+
<ReactModal
|
|
40
|
+
role="alertdialog"
|
|
41
|
+
contentLabel={this.props.contentLabel || 'Informational Modal Dialog'}
|
|
42
|
+
isOpen={this.state.showModal}
|
|
43
|
+
className="info-modal-content"
|
|
44
|
+
overlayClassName="info-modal-overlay"
|
|
45
|
+
onRequestClose={this.handleCloseModal}
|
|
46
|
+
>
|
|
47
|
+
<button
|
|
48
|
+
className="closeModal"
|
|
49
|
+
aria-label="Close modal"
|
|
50
|
+
onClick={this.handleCloseModal}
|
|
51
|
+
>
|
|
52
|
+
<svg className="close-icon" aria-hidden="true">
|
|
53
|
+
<CloseXIcon />
|
|
54
|
+
</svg>
|
|
55
|
+
</button>
|
|
56
|
+
<SanitizedContent html={this.props.content} />
|
|
57
|
+
</ReactModal>
|
|
58
|
+
</div>
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const displayModal = ({ content, main }) => {
|
|
64
|
+
render(<Modal content={content} showModal={true} />, main);
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
Modal.propTypes = {
|
|
68
|
+
contentLabel: PropTypes.string,
|
|
69
|
+
content: PropTypes.string,
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
export default displayModal;
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import React, { useRef, useState, useEffect } from 'react';
|
|
2
|
+
import ReactModal from 'react-modal';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
|
|
5
|
+
import { CloseXIcon2 } from '../../lib/SvgComponents.jsx';
|
|
6
|
+
|
|
7
|
+
const Modal = ({
|
|
8
|
+
children,
|
|
9
|
+
onRequestClose,
|
|
10
|
+
title,
|
|
11
|
+
primary,
|
|
12
|
+
secondary,
|
|
13
|
+
appElement,
|
|
14
|
+
isOpen,
|
|
15
|
+
...props
|
|
16
|
+
}) => {
|
|
17
|
+
const [overflowSeparator, setOverflowSeparator] = useState(false);
|
|
18
|
+
const closeButtonRef = useRef(null);
|
|
19
|
+
const contentRef = useRef(null);
|
|
20
|
+
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
ReactModal.setAppElement(appElement);
|
|
23
|
+
}, []);
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<ReactModal
|
|
27
|
+
onRequestClose={onRequestClose}
|
|
28
|
+
portalClassName="qpp-c-modal"
|
|
29
|
+
className="qpp-c-modal__content"
|
|
30
|
+
overlayClassName="qpp-c-modal__overlay"
|
|
31
|
+
bodyOpenClassName="qpp-c-modal__body-open"
|
|
32
|
+
isOpen={isOpen}
|
|
33
|
+
onAfterOpen={() => {
|
|
34
|
+
// Add heading separator based on overflow
|
|
35
|
+
if (
|
|
36
|
+
contentRef.current?.scrollHeight >
|
|
37
|
+
document.documentElement.clientHeight * 0.6
|
|
38
|
+
) {
|
|
39
|
+
setOverflowSeparator(true);
|
|
40
|
+
} else {
|
|
41
|
+
setOverflowSeparator(false);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// Set default focus
|
|
45
|
+
if (closeButtonRef?.current) {
|
|
46
|
+
closeButtonRef.current.focus();
|
|
47
|
+
}
|
|
48
|
+
}}
|
|
49
|
+
aria={{
|
|
50
|
+
labelledby: 'modal-heading',
|
|
51
|
+
describedby: 'modal-body',
|
|
52
|
+
}}
|
|
53
|
+
{...props}
|
|
54
|
+
>
|
|
55
|
+
<div
|
|
56
|
+
className={`qpp-c-modal__header ${
|
|
57
|
+
overflowSeparator ? 'qpp-c-modal__header-sep' : ''
|
|
58
|
+
}`}
|
|
59
|
+
>
|
|
60
|
+
<h3 id="modal-heading">{title}</h3>
|
|
61
|
+
<button
|
|
62
|
+
className="closex qpp-c-button qpp-c-button--text qpp-u-color--black"
|
|
63
|
+
aria-label="close modal"
|
|
64
|
+
data-testid="modal-close-btn"
|
|
65
|
+
onClick={onRequestClose}
|
|
66
|
+
ref={closeButtonRef}
|
|
67
|
+
>
|
|
68
|
+
<CloseXIcon2 />
|
|
69
|
+
</button>
|
|
70
|
+
</div>
|
|
71
|
+
<div
|
|
72
|
+
id="modal-body"
|
|
73
|
+
className="qpp-c-modal__body"
|
|
74
|
+
ref={contentRef}
|
|
75
|
+
tabIndex={overflowSeparator ? '0' : undefined}
|
|
76
|
+
>
|
|
77
|
+
{children}
|
|
78
|
+
</div>
|
|
79
|
+
{(primary || secondary) && (
|
|
80
|
+
<div className="qpp-c-modal__footer">
|
|
81
|
+
{secondary && (
|
|
82
|
+
<button
|
|
83
|
+
className={`qpp-c-button qpp-c-button--secondary ${
|
|
84
|
+
primary ? 'qpp-u-margin-right--16' : ''
|
|
85
|
+
}`}
|
|
86
|
+
loading={secondary.loading}
|
|
87
|
+
onClick={secondary.onClick || onRequestClose}
|
|
88
|
+
aria-label={secondary.title}
|
|
89
|
+
data-testid="modal-secondary-btn"
|
|
90
|
+
>
|
|
91
|
+
{secondary.title}
|
|
92
|
+
</button>
|
|
93
|
+
)}
|
|
94
|
+
{primary && (
|
|
95
|
+
<button
|
|
96
|
+
className="qpp-c-button"
|
|
97
|
+
loading={primary.loading}
|
|
98
|
+
onClick={primary.onClick}
|
|
99
|
+
data-testid="modal-primary-btn"
|
|
100
|
+
aria-label={primary.title}
|
|
101
|
+
>
|
|
102
|
+
{primary.title}
|
|
103
|
+
</button>
|
|
104
|
+
)}
|
|
105
|
+
</div>
|
|
106
|
+
)}
|
|
107
|
+
</ReactModal>
|
|
108
|
+
);
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
Modal.propTypes = {
|
|
112
|
+
title: PropTypes.string,
|
|
113
|
+
children: PropTypes.node.isRequired,
|
|
114
|
+
primary: PropTypes.shape({
|
|
115
|
+
title: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
|
|
116
|
+
onClick: PropTypes.func,
|
|
117
|
+
loading: PropTypes.bool,
|
|
118
|
+
loadingText: PropTypes.string,
|
|
119
|
+
}),
|
|
120
|
+
secondary: PropTypes.shape({
|
|
121
|
+
title: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
|
|
122
|
+
onClick: PropTypes.func,
|
|
123
|
+
loading: PropTypes.bool,
|
|
124
|
+
loadingText: PropTypes.string,
|
|
125
|
+
}),
|
|
126
|
+
onRequestClose: PropTypes.func,
|
|
127
|
+
appElement: PropTypes.string,
|
|
128
|
+
isOpen: PropTypes.bool,
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
Modal.defaultProps = {
|
|
132
|
+
onRequestClose: () => {},
|
|
133
|
+
title: undefined,
|
|
134
|
+
primary: null,
|
|
135
|
+
secondary: null,
|
|
136
|
+
appElement: 'body > *:not(.qpp-c-modal)',
|
|
137
|
+
isOpen: false,
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
export default Modal;
|
|
@@ -1,72 +1,22 @@
|
|
|
1
|
-
import React
|
|
2
|
-
import { render } from 'react-dom';
|
|
3
|
-
import ReactModal from 'react-modal';
|
|
4
|
-
import { CloseXIcon } from '../../lib/SvgComponents.jsx';
|
|
5
|
-
import SanitizedContent from '../SanitizedContent';
|
|
1
|
+
import React from 'react';
|
|
6
2
|
import PropTypes from 'prop-types';
|
|
7
3
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
super();
|
|
4
|
+
import LegacyModal from './LegacyModal';
|
|
5
|
+
import DsModal from './Modal';
|
|
11
6
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
this.handleOpenModal = this.handleOpenModal.bind(this);
|
|
17
|
-
this.handleCloseModal = this.handleCloseModal.bind(this);
|
|
18
|
-
|
|
19
|
-
ReactModal.setAppElement('body > *:not(.ReactModalPortal)');
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
handleOpenModal() {
|
|
23
|
-
this.setState({ showModal: true });
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
handleCloseModal() {
|
|
27
|
-
this.setState({ showModal: false });
|
|
7
|
+
const Modal = ({ useDesignSystem, ...rest }) => {
|
|
8
|
+
if (useDesignSystem) {
|
|
9
|
+
return <DsModal {...rest} />;
|
|
28
10
|
}
|
|
29
|
-
|
|
30
|
-
UNSAFE_componentWillReceiveProps(newProps) {
|
|
31
|
-
this.setState({
|
|
32
|
-
showModal: newProps.showModal,
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
render() {
|
|
37
|
-
return (
|
|
38
|
-
<div>
|
|
39
|
-
<ReactModal
|
|
40
|
-
role="alertdialog"
|
|
41
|
-
contentLabel={this.props.contentLabel || 'Informational Modal Dialog'}
|
|
42
|
-
isOpen={this.state.showModal}
|
|
43
|
-
className="info-modal-content"
|
|
44
|
-
overlayClassName="info-modal-overlay"
|
|
45
|
-
onRequestClose={this.handleCloseModal}
|
|
46
|
-
>
|
|
47
|
-
<button
|
|
48
|
-
className="closeModal"
|
|
49
|
-
aria-label="Close modal"
|
|
50
|
-
onClick={this.handleCloseModal}
|
|
51
|
-
>
|
|
52
|
-
<svg className="close-icon" aria-hidden="true">
|
|
53
|
-
<CloseXIcon />
|
|
54
|
-
</svg>
|
|
55
|
-
</button>
|
|
56
|
-
<SanitizedContent html={this.props.content} />
|
|
57
|
-
</ReactModal>
|
|
58
|
-
</div>
|
|
59
|
-
);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
const displayModal = ({ content, main }) => {
|
|
64
|
-
render(<Modal content={content} showModal={true} />, main);
|
|
11
|
+
return <LegacyModal {...rest} />;
|
|
65
12
|
};
|
|
66
13
|
|
|
67
14
|
Modal.propTypes = {
|
|
68
|
-
|
|
69
|
-
|
|
15
|
+
useDesignSystem: PropTypes.bool,
|
|
16
|
+
};
|
|
17
|
+
Modal.defaultProps = {
|
|
18
|
+
useDesignSystem: false,
|
|
70
19
|
};
|
|
20
|
+
Modal.displayName = 'Modal';
|
|
71
21
|
|
|
72
|
-
export default
|
|
22
|
+
export default Modal;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import React, { forwardRef } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { BellOutline } from '../../lib/SvgComponents.jsx';
|
|
4
|
+
|
|
5
|
+
const CollapsedView = forwardRef(
|
|
6
|
+
(
|
|
7
|
+
{ expandNotification, label },
|
|
8
|
+
{ collapsedWrapperRef, collapsedBannerRef }
|
|
9
|
+
) => {
|
|
10
|
+
return (
|
|
11
|
+
<div
|
|
12
|
+
ref={collapsedWrapperRef}
|
|
13
|
+
className={`notification-banner-wrapper collapsed-view`}
|
|
14
|
+
onClick={expandNotification}
|
|
15
|
+
>
|
|
16
|
+
<button
|
|
17
|
+
ref={collapsedBannerRef}
|
|
18
|
+
className={`notification-banner-label`}
|
|
19
|
+
>
|
|
20
|
+
{label}
|
|
21
|
+
<span className="bell-icon">
|
|
22
|
+
<svg aria-hidden="true" focusable="false">
|
|
23
|
+
<BellOutline />
|
|
24
|
+
</svg>
|
|
25
|
+
</span>
|
|
26
|
+
</button>
|
|
27
|
+
</div>
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
CollapsedView.displayName = 'CollapsedView';
|
|
33
|
+
|
|
34
|
+
CollapsedView.propTypes = {
|
|
35
|
+
expandNotification: PropTypes.func,
|
|
36
|
+
label: PropTypes.string,
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export default CollapsedView;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import SanitizedContent from '../SanitizedContent';
|
|
4
|
+
import { CloseXIcon } from '../../lib/SvgComponents.jsx';
|
|
5
|
+
|
|
6
|
+
const ExpandedView = ({
|
|
7
|
+
label,
|
|
8
|
+
expanded,
|
|
9
|
+
content,
|
|
10
|
+
dismissable,
|
|
11
|
+
collapseNotification,
|
|
12
|
+
}) => {
|
|
13
|
+
return (
|
|
14
|
+
<div className={`notification-banner-wrapper expanded-view`}>
|
|
15
|
+
<div className="notification-banner-label">{label}</div>
|
|
16
|
+
<div className="notification-banner-content">
|
|
17
|
+
<SanitizedContent
|
|
18
|
+
html={expanded ? content : '<p>No notifications to display</p>'}
|
|
19
|
+
/>
|
|
20
|
+
</div>
|
|
21
|
+
{expanded && dismissable && (
|
|
22
|
+
<button
|
|
23
|
+
onClick={collapseNotification}
|
|
24
|
+
type="button"
|
|
25
|
+
className="notification-banner-close"
|
|
26
|
+
>
|
|
27
|
+
<svg className="close-icon" aria-hidden="true" focusable="false">
|
|
28
|
+
<CloseXIcon />
|
|
29
|
+
</svg>
|
|
30
|
+
<span className="sr-only">Close</span>
|
|
31
|
+
</button>
|
|
32
|
+
)}
|
|
33
|
+
</div>
|
|
34
|
+
);
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
ExpandedView.propTypes = {
|
|
38
|
+
label: PropTypes.string,
|
|
39
|
+
expanded: PropTypes.bool,
|
|
40
|
+
content: PropTypes.string,
|
|
41
|
+
dismissable: PropTypes.bool,
|
|
42
|
+
collapseNotification: PropTypes.func,
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export default ExpandedView;
|
|
@@ -1,32 +1,221 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import React, { useState, useEffect, useRef } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import ExpandedView from './ExpandedView';
|
|
4
|
+
import CollapsedView from './CollapsedView';
|
|
5
|
+
import { withGetConfig } from '../hooks/useGetConfig';
|
|
6
|
+
|
|
7
|
+
function debounce(fn, ms) {
|
|
8
|
+
let timer;
|
|
9
|
+
return () => {
|
|
10
|
+
clearTimeout(timer);
|
|
11
|
+
timer = setTimeout(() => {
|
|
12
|
+
timer = null;
|
|
13
|
+
fn.apply(this, arguments);
|
|
14
|
+
}, ms);
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const NotificationBanner = ({ result }) => {
|
|
19
|
+
const {
|
|
20
|
+
color = 'blue',
|
|
21
|
+
content,
|
|
22
|
+
dismissable,
|
|
23
|
+
enabled,
|
|
24
|
+
label = 'Update',
|
|
25
|
+
} = result.content;
|
|
26
|
+
|
|
27
|
+
const bannerContainerRef = useRef(null);
|
|
28
|
+
const collapsedWrapperRef = useRef(null);
|
|
29
|
+
const collapsedBannerRef = useRef(null);
|
|
30
|
+
const VIEW_BREAKPOINT = 767;
|
|
31
|
+
const [height, setHeight] = useState('100%');
|
|
32
|
+
const [expanded, setExpanded] = useState();
|
|
33
|
+
const [windowWidth, setWindowWidth] = useState(window.innerWidth);
|
|
34
|
+
const cssDeterminesBannerView = expanded ? 'expanded' : 'collapsed';
|
|
35
|
+
|
|
36
|
+
useEffect(() => {
|
|
37
|
+
//setBannerHeight on Load & Resize
|
|
38
|
+
setBannerHeight();
|
|
39
|
+
|
|
40
|
+
if (window.innerWidth <= VIEW_BREAKPOINT) {
|
|
41
|
+
setExpanded(false);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const debounceBrowserResizeHandler = debounce(() => {
|
|
45
|
+
return setWindowWidth(window.innerWidth);
|
|
46
|
+
}, 600);
|
|
47
|
+
|
|
48
|
+
window.addEventListener('resize', debounceBrowserResizeHandler);
|
|
49
|
+
|
|
50
|
+
return () => {
|
|
51
|
+
window.removeEventListener('resize', debounceBrowserResizeHandler);
|
|
52
|
+
};
|
|
53
|
+
}, [windowWidth]);
|
|
54
|
+
|
|
55
|
+
useEffect(() => {
|
|
56
|
+
// setExpanded => updates cssDeterminesBannerView
|
|
57
|
+
if (Object.keys(result).length > 0) {
|
|
58
|
+
setExpanded(isNotificationExpanded());
|
|
59
|
+
}
|
|
60
|
+
}, [result]);
|
|
61
|
+
|
|
62
|
+
const isNotificationExpanded = () => {
|
|
63
|
+
const dateDismissed = new Date(result.content.dateDismissed);
|
|
64
|
+
const dateUpdated = new Date(result.content.dateUpdated);
|
|
65
|
+
const notDismissed =
|
|
66
|
+
(isDateValid(dateUpdated) &&
|
|
67
|
+
isDateValid(dateDismissed) &&
|
|
68
|
+
dateUpdated >= dateDismissed) ||
|
|
69
|
+
!isDateValid(dateDismissed);
|
|
70
|
+
return notDismissed;
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
const setBannerHeight = () => {
|
|
74
|
+
if (content) {
|
|
75
|
+
bannerContainerRef.current.style.transition = 'none';
|
|
76
|
+
expanded
|
|
77
|
+
? collapsedBannerRef.current.setAttribute('tabIndex', '-1')
|
|
78
|
+
: collapsedBannerRef.current.setAttribute('tabIndex', ' ');
|
|
79
|
+
|
|
80
|
+
setHeight(
|
|
81
|
+
expanded ? '100%' : `${collapsedWrapperRef.current.offsetHeight}px`
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
|
|
9
86
|
/**
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* @param {
|
|
13
|
-
* @
|
|
14
|
-
* @param {Boolean} options.fromStorage - Whether to load content from
|
|
15
|
-
* localStorage
|
|
16
|
-
* @param {String} options.type - Can be 'info' or 'warning'
|
|
17
|
-
* @param {HTMLElement} options.rootElement - Elem inside which to render
|
|
87
|
+
* Whether the date is valid, i.e. not null
|
|
88
|
+
*
|
|
89
|
+
* @param {Date} date
|
|
90
|
+
* @return {Boolean}
|
|
18
91
|
*/
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
);
|
|
31
|
-
|
|
32
|
-
|
|
92
|
+
|
|
93
|
+
const isDateValid = (date) => {
|
|
94
|
+
return !isNaN(Date.parse(date));
|
|
95
|
+
};
|
|
96
|
+
/**
|
|
97
|
+
* Try to find this NotificationBanner instance in localStorage, or else add
|
|
98
|
+
* a minimal version of it, and mark it with a dateDismissed, then update
|
|
99
|
+
* localStorage.
|
|
100
|
+
*/
|
|
101
|
+
|
|
102
|
+
const markNotificationClosed = () => {
|
|
103
|
+
const dateDismissed = new Date().toISOString();
|
|
104
|
+
const storageNotification = result || {};
|
|
105
|
+
|
|
106
|
+
if (storageNotification && Object.keys(storageNotification).length > 0) {
|
|
107
|
+
window.localStorage.setItem(
|
|
108
|
+
'notifications',
|
|
109
|
+
JSON.stringify({
|
|
110
|
+
...storageNotification,
|
|
111
|
+
content: {
|
|
112
|
+
...storageNotification.content,
|
|
113
|
+
dateDismissed,
|
|
114
|
+
},
|
|
115
|
+
})
|
|
116
|
+
);
|
|
117
|
+
} else {
|
|
118
|
+
window.localStorage.setItem(
|
|
119
|
+
'notifications',
|
|
120
|
+
JSON.stringify({
|
|
121
|
+
...storageNotification,
|
|
122
|
+
content: {
|
|
123
|
+
name: 'header-notification',
|
|
124
|
+
dateDismissed,
|
|
125
|
+
},
|
|
126
|
+
})
|
|
127
|
+
);
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Callback when the user dimisses a notification. Mark it as dismissed in
|
|
133
|
+
* localStorage, empty the contents, and dispatch a custom event to notify
|
|
134
|
+
* any observers that it has been dismissed.
|
|
135
|
+
*/
|
|
136
|
+
|
|
137
|
+
const collapseNotification = (e) => {
|
|
138
|
+
e.stopPropagation();
|
|
139
|
+
markNotificationClosed();
|
|
140
|
+
collapsedBannerRef.current.setAttribute('tabIndex', ' ');
|
|
141
|
+
bannerContainerRef.current.style.transition = 'height .2s ease-out';
|
|
142
|
+
|
|
143
|
+
setExpanded(false);
|
|
144
|
+
setHeight(`${collapsedWrapperRef.current.offsetHeight}px`);
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
const expandNotification = () => {
|
|
148
|
+
collapsedBannerRef.current.setAttribute('tabIndex', '-1');
|
|
149
|
+
bannerContainerRef.current.style.transition = 'height .2s ease-out';
|
|
150
|
+
setExpanded(true);
|
|
151
|
+
setHeight('100%');
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Render the notification if it has any contents.
|
|
156
|
+
*
|
|
157
|
+
* @return {String} HTML content
|
|
158
|
+
*/
|
|
159
|
+
|
|
160
|
+
return (
|
|
161
|
+
<>
|
|
162
|
+
{!content || !enabled ? (
|
|
163
|
+
<div id="notification-banner" />
|
|
164
|
+
) : (
|
|
165
|
+
<div
|
|
166
|
+
ref={bannerContainerRef}
|
|
167
|
+
style={{ height }}
|
|
168
|
+
className={`notification-banner notification-banner-${color} ${cssDeterminesBannerView}`}
|
|
169
|
+
>
|
|
170
|
+
<ExpandedView
|
|
171
|
+
label={label}
|
|
172
|
+
expanded={expanded}
|
|
173
|
+
content={content}
|
|
174
|
+
dismissable={dismissable}
|
|
175
|
+
collapseNotification={collapseNotification}
|
|
176
|
+
/>
|
|
177
|
+
|
|
178
|
+
<CollapsedView
|
|
179
|
+
expandNotification={expandNotification}
|
|
180
|
+
label={label}
|
|
181
|
+
ref={{ collapsedWrapperRef, collapsedBannerRef }}
|
|
182
|
+
/>
|
|
183
|
+
</div>
|
|
184
|
+
)}
|
|
185
|
+
</>
|
|
186
|
+
);
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
NotificationBanner.propTypes = {
|
|
190
|
+
result: PropTypes.shape({
|
|
191
|
+
content: PropTypes.shape({
|
|
192
|
+
color: PropTypes.string,
|
|
193
|
+
content: PropTypes.string,
|
|
194
|
+
dateDismissed: PropTypes.string,
|
|
195
|
+
dateUpdated: PropTypes.string,
|
|
196
|
+
dismissable: PropTypes.bool,
|
|
197
|
+
enabled: PropTypes.bool,
|
|
198
|
+
label: PropTypes.string,
|
|
199
|
+
}),
|
|
200
|
+
}),
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
NotificationBanner.defaultProps = {
|
|
204
|
+
result: {
|
|
205
|
+
content: {
|
|
206
|
+
color: 'blue',
|
|
207
|
+
content: null,
|
|
208
|
+
dismissable: true,
|
|
209
|
+
enabled: true,
|
|
210
|
+
label: 'Update',
|
|
211
|
+
},
|
|
212
|
+
},
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
export default withGetConfig(NotificationBanner, {
|
|
216
|
+
timeout: 5,
|
|
217
|
+
url: '/config/notification',
|
|
218
|
+
localStorageName: 'active_notification',
|
|
219
|
+
equalityCheckExclude: ['dateDismissed', 'dateUpdated'],
|
|
220
|
+
defaultContent: {},
|
|
221
|
+
});
|