@learningpool/ui 1.6.0 → 1.6.1
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 +40 -0
- package/.github/pull_request_template.md +23 -0
- package/.github/renovate.json +57 -0
- package/.github/workflows/integration.yml +53 -0
- package/.github/workflows/wss.yml +22 -0
- package/.jest-test-results.json +1 -0
- package/.releaserc +32 -0
- package/.storybook/learningpoolTheme.js +39 -0
- package/.storybook/main.js +21 -0
- package/.storybook/manager-head.html +175 -0
- package/.storybook/manager.js +34 -0
- package/.storybook/preview-head.html +212 -0
- package/.storybook/preview.js +120 -0
- package/.storybook/storybook-sort.js +54 -0
- package/CHANGELOG.md +6 -0
- package/amplify.yml +16 -0
- package/babel.config.json +14 -0
- package/{assets → dist/assets}/Images.d.ts +0 -0
- package/{assets → dist/assets}/Images.js +0 -0
- package/{components → dist/components}/atoms/Autocomplete/Autocomplete.d.ts +0 -0
- package/{components → dist/components}/atoms/Autocomplete/Autocomplete.js +0 -0
- package/{components → dist/components}/atoms/Button/Button.d.ts +0 -0
- package/{components → dist/components}/atoms/Button/Button.js +0 -0
- package/{components → dist/components}/atoms/Checkbox/Checkbox.d.ts +0 -0
- package/{components → dist/components}/atoms/Checkbox/Checkbox.js +0 -0
- package/{components → dist/components}/atoms/IconButton/IconButton.d.ts +0 -0
- package/{components → dist/components}/atoms/IconButton/IconButton.js +0 -0
- package/{components → dist/components}/atoms/Radio/Radio.d.ts +0 -0
- package/{components → dist/components}/atoms/Radio/Radio.js +0 -0
- package/{components → dist/components}/atoms/Select/Select.d.ts +0 -0
- package/{components → dist/components}/atoms/Select/Select.js +0 -0
- package/{components → dist/components}/atoms/Slider/Slider.d.ts +0 -0
- package/{components → dist/components}/atoms/Slider/Slider.js +0 -0
- package/{components → dist/components}/atoms/Switch/Switch.d.ts +0 -0
- package/{components → dist/components}/atoms/Switch/Switch.js +0 -0
- package/{components → dist/components}/atoms/TextField/TextField.d.ts +0 -0
- package/{components → dist/components}/atoms/TextField/TextField.js +0 -0
- package/{components → dist/components}/atoms/ToggleButton/ToggleButton.d.ts +0 -0
- package/{components → dist/components}/atoms/ToggleButton/ToggleButton.js +0 -0
- package/{components → dist/components}/datadisplay/Avatar/Avatar.d.ts +0 -0
- package/{components → dist/components}/datadisplay/Avatar/Avatar.js +0 -0
- package/{components → dist/components}/datadisplay/Chip/Chip.d.ts +0 -0
- package/{components → dist/components}/datadisplay/Chip/Chip.js +0 -0
- package/{components → dist/components}/datadisplay/List/List.d.ts +0 -0
- package/{components → dist/components}/datadisplay/List/List.js +0 -0
- package/{components → dist/components}/datadisplay/Tooltip/Tooltip.d.ts +0 -0
- package/{components → dist/components}/datadisplay/Tooltip/Tooltip.js +0 -0
- package/{components → dist/components}/feedback/Alert/Alert.d.ts +0 -0
- package/{components → dist/components}/feedback/Alert/Alert.js +0 -0
- package/{components → dist/components}/landmarks/Header/Header.d.ts +0 -0
- package/{components → dist/components}/landmarks/Header/Header.js +0 -0
- package/{components → dist/components}/landmarks/Header/HeaderActionButtons.d.ts +0 -0
- package/{components → dist/components}/landmarks/Header/HeaderActionButtons.js +0 -0
- package/{components → dist/components}/landmarks/Header/HeaderStyles.d.ts +0 -0
- package/{components → dist/components}/landmarks/Header/HeaderStyles.js +0 -0
- package/{components → dist/components}/navigation/Drawer/Drawer.d.ts +0 -0
- package/{components → dist/components}/navigation/Drawer/Drawer.js +0 -0
- package/{components → dist/components}/navigation/MobileNavigation/MobileNavigation.d.ts +0 -0
- package/{components → dist/components}/navigation/MobileNavigation/MobileNavigation.js +64 -41
- package/{components → dist/components}/navigation/MobileNavigation/MobileNavigationAvatar.d.ts +0 -0
- package/{components → dist/components}/navigation/MobileNavigation/MobileNavigationAvatar.js +23 -19
- package/dist/components/navigation/MobileNavigation/MobileNavigationAvatarStyles.d.ts +3296 -0
- package/{components → dist/components}/navigation/MobileNavigation/MobileNavigationAvatarStyles.js +4 -4
- package/{components → dist/components}/navigation/MobileNavigation/MobileNavigationDrawer.d.ts +0 -0
- package/dist/components/navigation/MobileNavigation/MobileNavigationDrawer.js +71 -0
- package/dist/components/navigation/MobileNavigation/MobileNavigationDrawerStyles.d.ts +1215 -0
- package/{components → dist/components}/navigation/MobileNavigation/MobileNavigationDrawerStyles.js +2 -2
- package/{components → dist/components}/navigation/MobileNavigation/MobileNavigationItem/MobileNavigationItem.d.ts +0 -0
- package/{components → dist/components}/navigation/MobileNavigation/MobileNavigationItem/MobileNavigationItem.js +0 -0
- package/{components → dist/components}/navigation/MobileNavigation/MobileNavigationItem/MobileNavigationItemFlyoutMenu.d.ts +0 -0
- package/{components → dist/components}/navigation/MobileNavigation/MobileNavigationItem/MobileNavigationItemFlyoutMenu.js +0 -0
- package/{components → dist/components}/navigation/MobileNavigation/MobileNavigationItem/MobileNavigationItemFlyoutMenuStyles.d.ts +0 -0
- package/{components → dist/components}/navigation/MobileNavigation/MobileNavigationItem/MobileNavigationItemFlyoutMenuStyles.js +0 -0
- package/{components → dist/components}/navigation/MobileNavigation/MobileNavigationItem/MobileNavigationItemStyles.d.ts +0 -0
- package/{components → dist/components}/navigation/MobileNavigation/MobileNavigationItem/MobileNavigationItemStyles.js +0 -0
- package/{components → dist/components}/navigation/MobileNavigation/MobileNavigationMotion.d.ts +0 -0
- package/{components → dist/components}/navigation/MobileNavigation/MobileNavigationMotion.js +0 -0
- package/dist/components/navigation/MobileNavigation/MobileNavigationNotchIndicator.d.ts +3 -0
- package/dist/components/navigation/MobileNavigation/MobileNavigationNotchIndicator.js +19 -0
- package/{components → dist/components}/navigation/MobileNavigation/MobileNavigationSearch.d.ts +0 -0
- package/{components → dist/components}/navigation/MobileNavigation/MobileNavigationSearch.js +8 -6
- package/dist/components/navigation/MobileNavigation/MobileNavigationSearchStyles.d.ts +1080 -0
- package/{components → dist/components}/navigation/MobileNavigation/MobileNavigationSearchStyles.js +2 -2
- package/{components → dist/components}/navigation/MobileNavigation/MobileNavigationStyles.d.ts +0 -0
- package/{components → dist/components}/navigation/MobileNavigation/MobileNavigationStyles.js +0 -0
- package/dist/components/navigation/MobileNavigation/MobileNavigationToggleSearchX.d.ts +3 -0
- package/dist/components/navigation/MobileNavigation/MobileNavigationToggleSearchX.js +28 -0
- package/dist/components/navigation/MobileNavigation/MobileNavigationToggleX.d.ts +3 -0
- package/dist/components/navigation/MobileNavigation/MobileNavigationToggleX.js +28 -0
- package/{components → dist/components}/navigation/VerticalNavigation/VerticalNavigation.d.ts +0 -0
- package/{components → dist/components}/navigation/VerticalNavigation/VerticalNavigation.js +18 -16
- package/{components → dist/components}/navigation/VerticalNavigation/VerticalNavigationAvatar.d.ts +0 -0
- package/{components → dist/components}/navigation/VerticalNavigation/VerticalNavigationAvatar.js +20 -25
- package/dist/components/navigation/VerticalNavigation/VerticalNavigationAvatarStyles.d.ts +3296 -0
- package/{components → dist/components}/navigation/VerticalNavigation/VerticalNavigationAvatarStyles.js +4 -4
- package/{components → dist/components}/navigation/VerticalNavigation/VerticalNavigationItem/VerticalNavigationItem.d.ts +0 -0
- package/{components → dist/components}/navigation/VerticalNavigation/VerticalNavigationItem/VerticalNavigationItem.js +5 -1
- package/{components → dist/components}/navigation/VerticalNavigation/VerticalNavigationItem/VerticalNavigationItemFlyoutMenu.d.ts +0 -0
- package/{components → dist/components}/navigation/VerticalNavigation/VerticalNavigationItem/VerticalNavigationItemFlyoutMenu.js +0 -0
- package/{components → dist/components}/navigation/VerticalNavigation/VerticalNavigationItem/VerticalNavigationItemFlyoutMenuStyles.d.ts +0 -0
- package/{components → dist/components}/navigation/VerticalNavigation/VerticalNavigationItem/VerticalNavigationItemFlyoutMenuStyles.js +0 -0
- package/{components → dist/components}/navigation/VerticalNavigation/VerticalNavigationItem/VerticalNavigationItemStyles.d.ts +0 -0
- package/{components → dist/components}/navigation/VerticalNavigation/VerticalNavigationItem/VerticalNavigationItemStyles.js +0 -0
- package/{components → dist/components}/navigation/VerticalNavigation/VerticalNavigationMotion.d.ts +0 -0
- package/{components → dist/components}/navigation/VerticalNavigation/VerticalNavigationMotion.js +0 -0
- package/dist/components/navigation/VerticalNavigation/VerticalNavigationStyles.d.ts +1163 -0
- package/{components → dist/components}/navigation/VerticalNavigation/VerticalNavigationStyles.js +3 -2
- package/{components → dist/components}/pages/ErrorPage/ErrorPage.d.ts +0 -0
- package/{components → dist/components}/pages/ErrorPage/ErrorPage.js +0 -0
- package/{components → dist/components}/pages/ErrorPage/ErrorPageStyles.d.ts +0 -0
- package/{components → dist/components}/pages/ErrorPage/ErrorPageStyles.js +0 -0
- package/{components → dist/components}/pages/SideInSide/SideInSide.d.ts +0 -0
- package/{components → dist/components}/pages/SideInSide/SideInSide.js +0 -0
- package/{components → dist/components}/pages/SideInSide/SideInSideStyles.d.ts +0 -0
- package/{components → dist/components}/pages/SideInSide/SideInSideStyles.js +0 -0
- package/{components → dist/components}/stream/AppSwitcher/AppSwitcher.d.ts +0 -0
- package/{components → dist/components}/stream/AppSwitcher/AppSwitcher.js +0 -0
- package/{components → dist/components}/stream/AppSwitcher/AppSwitcherItem.d.ts +0 -0
- package/{components → dist/components}/stream/AppSwitcher/AppSwitcherItem.js +0 -0
- package/{components → dist/components}/stream/AppSwitcher/AppSwitcherStyles.d.ts +0 -0
- package/{components → dist/components}/stream/AppSwitcher/AppSwitcherStyles.js +0 -0
- package/{components → dist/components}/stream/AppSwitcher/constants.d.ts +0 -0
- package/{components → dist/components}/stream/AppSwitcher/constants.js +0 -0
- package/{index.d.ts → dist/index.d.ts} +0 -0
- package/{index.js → dist/index.js} +0 -0
- package/{lang → dist/lang}/en-us.d.ts +0 -0
- package/{lang → dist/lang}/en-us.js +0 -0
- package/dist/package.json +41 -0
- package/{types → dist/types}/components/navigation/VerticalNavigation.d.ts +0 -0
- package/{types → dist/types}/components/navigation/VerticalNavigation.js +0 -0
- package/{types → dist/types}/components/navigation/VerticalNavigationAvatar.d.ts +1 -0
- package/{types → dist/types}/components/navigation/VerticalNavigationAvatar.js +0 -0
- package/{types → dist/types}/components/stream/AppSwitcher.d.ts +0 -0
- package/{types → dist/types}/components/stream/AppSwitcher.js +0 -0
- package/{types → dist/types}/index.d.ts +0 -0
- package/{types → dist/types}/index.js +0 -0
- package/{utils → dist/utils}/constants.d.ts +0 -0
- package/{utils → dist/utils}/constants.js +0 -0
- package/dist/utils/helpers.d.ts +21 -0
- package/dist/utils/helpers.js +64 -0
- package/{utils → dist/utils}/hooks.d.ts +0 -0
- package/{utils → dist/utils}/hooks.js +0 -0
- package/{utils → dist/utils}/index.d.ts +0 -0
- package/{utils → dist/utils}/index.js +0 -0
- package/{utils → dist/utils}/theme.d.ts +0 -0
- package/{utils → dist/utils}/theme.js +0 -0
- package/jest.config.ts +11 -0
- package/jest.setup.ts +5 -0
- package/{LICENSE → license} +0 -0
- package/merge.js +27 -0
- package/package.json +71 -4
- package/public/android-chrome-192x192.png +0 -0
- package/public/android-chrome-512x512.png +0 -0
- package/public/apple-touch-icon.png +0 -0
- package/public/assets/atoms.svg +5 -0
- package/public/assets/automation.svg +1 -0
- package/public/assets/avatar-1.jpg +0 -0
- package/public/assets/avatar-2.jpg +0 -0
- package/public/assets/avatar-3.jpg +0 -0
- package/public/assets/flux/icon-dark.svg +6 -0
- package/public/assets/flux/icon-light.svg +1 -0
- package/public/assets/flux/icon-white.svg +6 -0
- package/public/assets/flux/icon.svg +6 -0
- package/public/assets/flux/logo-dark.svg +22 -0
- package/public/assets/flux/logo-light.svg +1 -0
- package/public/assets/flux/logo-white.svg +22 -0
- package/public/assets/flux/logo.svg +22 -0
- package/public/assets/iPhone6.jpg +0 -0
- package/public/assets/iPhone6Plus.jpg +0 -0
- package/public/assets/lp-logo.png +0 -0
- package/public/assets/lplogo.svg +1 -0
- package/public/assets/molecules.svg +8 -0
- package/public/assets/organisms.svg +21 -0
- package/public/assets/pages.svg +4 -0
- package/public/assets/particles.svg +3 -0
- package/public/assets/stream-dark.png +0 -0
- package/public/assets/stream-suite-logo.svg +38 -0
- package/public/assets/stream-white.png +0 -0
- package/public/assets/stream.png +0 -0
- package/public/assets/templates.svg +3 -0
- package/public/favicon-16x16.png +0 -0
- package/public/favicon-32x32.png +0 -0
- package/public/favicon.ico +0 -0
- package/public/index.html +43 -0
- package/public/logo192.png +0 -0
- package/public/logo512.png +0 -0
- package/public/manifest.json +25 -0
- package/public/robots.txt +3 -0
- package/public/site.webmanifest +1 -0
- package/{README.md → readme.md} +0 -0
- package/src/docs.tsx +167 -0
- package/src/lib/assets/Images.tsx +47 -0
- package/src/lib/assets/stream-suite-logo.svg +38 -0
- package/src/lib/components/atoms/Autocomplete/Autocomplete.test.tsx +179 -0
- package/src/lib/components/atoms/Autocomplete/Autocomplete.tsx +14 -0
- package/src/lib/components/atoms/Button/Button.test.tsx +166 -0
- package/src/lib/components/atoms/Button/Button.tsx +16 -0
- package/src/lib/components/atoms/Checkbox/Checkbox.test.tsx +85 -0
- package/src/lib/components/atoms/Checkbox/Checkbox.tsx +10 -0
- package/src/lib/components/atoms/IconButton/IconButton.test.tsx +60 -0
- package/src/lib/components/atoms/IconButton/IconButton.tsx +9 -0
- package/src/lib/components/atoms/Radio/Radio.test.tsx +136 -0
- package/src/lib/components/atoms/Radio/Radio.tsx +10 -0
- package/src/lib/components/atoms/Select/Select.test.tsx +158 -0
- package/src/lib/components/atoms/Select/Select.tsx +12 -0
- package/src/lib/components/atoms/Slider/Slider.test.tsx +103 -0
- package/src/lib/components/atoms/Slider/Slider.tsx +10 -0
- package/src/lib/components/atoms/Switch/Switch.test.tsx +96 -0
- package/src/lib/components/atoms/Switch/Switch.tsx +10 -0
- package/src/lib/components/atoms/TextField/TextField.test.tsx +131 -0
- package/src/lib/components/atoms/TextField/TextField.tsx +31 -0
- package/src/lib/components/atoms/ToggleButton/ToggleButton.test.tsx +122 -0
- package/src/lib/components/atoms/ToggleButton/ToggleButton.tsx +10 -0
- package/src/lib/components/datadisplay/Avatar/Avatar.test.tsx +187 -0
- package/src/lib/components/datadisplay/Avatar/Avatar.tsx +35 -0
- package/src/lib/components/datadisplay/Avatar/avatar-1.jpg +0 -0
- package/src/lib/components/datadisplay/Chip/Chip.test.tsx +82 -0
- package/src/lib/components/datadisplay/Chip/Chip.tsx +11 -0
- package/src/lib/components/datadisplay/List/List.test.tsx +168 -0
- package/src/lib/components/datadisplay/List/List.tsx +8 -0
- package/src/lib/components/datadisplay/Tooltip/Tooltip.test.tsx +98 -0
- package/src/lib/components/datadisplay/Tooltip/Tooltip.tsx +9 -0
- package/src/lib/components/feedback/Alert/Alert.test.tsx +139 -0
- package/src/lib/components/feedback/Alert/Alert.tsx +10 -0
- package/src/lib/components/landmarks/Header/Header.tsx +140 -0
- package/src/lib/components/landmarks/Header/HeaderActionButtons.tsx +117 -0
- package/src/lib/components/landmarks/Header/HeaderStyles.tsx +62 -0
- package/src/lib/components/navigation/Drawer/Drawer.test.tsx +95 -0
- package/src/lib/components/navigation/Drawer/Drawer.tsx +21 -0
- package/src/lib/components/navigation/MobileNavigation/MobileNavigation.tsx +276 -0
- package/src/lib/components/navigation/MobileNavigation/MobileNavigationAvatar.tsx +334 -0
- package/src/lib/components/navigation/MobileNavigation/MobileNavigationAvatarStyles.tsx +77 -0
- package/src/lib/components/navigation/MobileNavigation/MobileNavigationDrawer.tsx +197 -0
- package/src/lib/components/navigation/MobileNavigation/MobileNavigationDrawerStyles.tsx +143 -0
- package/src/lib/components/navigation/MobileNavigation/MobileNavigationItem/MobileNavigationItem.tsx +192 -0
- package/src/lib/components/navigation/MobileNavigation/MobileNavigationItem/MobileNavigationItemFlyoutMenu.tsx +67 -0
- package/src/lib/components/navigation/MobileNavigation/MobileNavigationItem/MobileNavigationItemFlyoutMenuStyles.tsx +192 -0
- package/src/lib/components/navigation/MobileNavigation/MobileNavigationItem/MobileNavigationItemStyles.tsx +217 -0
- package/src/lib/components/navigation/MobileNavigation/MobileNavigationMotion.tsx +119 -0
- package/src/lib/components/navigation/MobileNavigation/MobileNavigationNotchIndicator.tsx +35 -0
- package/src/lib/components/navigation/MobileNavigation/MobileNavigationSearch.tsx +114 -0
- package/src/lib/components/navigation/MobileNavigation/MobileNavigationSearchStyles.tsx +47 -0
- package/src/lib/components/navigation/MobileNavigation/MobileNavigationStyles.tsx +320 -0
- package/src/lib/components/navigation/MobileNavigation/MobileNavigationToggleSearchX.tsx +59 -0
- package/src/lib/components/navigation/MobileNavigation/MobileNavigationToggleX.tsx +51 -0
- package/src/lib/components/navigation/VerticalNavigation/VerticalNavigation.tsx +467 -0
- package/src/lib/components/navigation/VerticalNavigation/VerticalNavigationAvatar.tsx +208 -0
- package/src/lib/components/navigation/VerticalNavigation/VerticalNavigationAvatarStyles.tsx +75 -0
- package/src/lib/components/navigation/VerticalNavigation/VerticalNavigationItem/VerticalNavigationItem.tsx +196 -0
- package/src/lib/components/navigation/VerticalNavigation/VerticalNavigationItem/VerticalNavigationItemFlyoutMenu.tsx +94 -0
- package/src/lib/components/navigation/VerticalNavigation/VerticalNavigationItem/VerticalNavigationItemFlyoutMenuStyles.tsx +212 -0
- package/src/lib/components/navigation/VerticalNavigation/VerticalNavigationItem/VerticalNavigationItemStyles.tsx +240 -0
- package/src/lib/components/navigation/VerticalNavigation/VerticalNavigationMotion.tsx +119 -0
- package/src/lib/components/navigation/VerticalNavigation/VerticalNavigationStyles.tsx +303 -0
- package/src/lib/components/pages/ErrorPage/ErrorPage.test.tsx +78 -0
- package/src/lib/components/pages/ErrorPage/ErrorPage.tsx +50 -0
- package/src/lib/components/pages/ErrorPage/ErrorPageStyles.tsx +30 -0
- package/src/lib/components/pages/SideInSide/SideInSide.tsx +100 -0
- package/src/lib/components/pages/SideInSide/SideInSideStyles.tsx +62 -0
- package/src/lib/components/stream/AppSwitcher/AppSwitcher.tsx +392 -0
- package/src/lib/components/stream/AppSwitcher/AppSwitcherItem.tsx +83 -0
- package/src/lib/components/stream/AppSwitcher/AppSwitcherStyles.tsx +325 -0
- package/src/lib/components/stream/AppSwitcher/constants.tsx +28 -0
- package/src/lib/index.tsx +148 -0
- package/src/lib/lang/en-us.js +6 -0
- package/src/lib/types/components/navigation/VerticalNavigation.ts +52 -0
- package/src/lib/types/components/navigation/VerticalNavigationAvatar.ts +26 -0
- package/src/lib/types/components/stream/AppSwitcher.ts +10 -0
- package/src/lib/types/index.ts +9 -0
- package/src/lib/utils/constants.tsx +11 -0
- package/src/lib/utils/helpers.tsx +77 -0
- package/src/lib/utils/hooks.tsx +33 -0
- package/src/lib/utils/index.tsx +4 -0
- package/src/lib/utils/theme.tsx +79 -0
- package/src/react-app-env.d.ts +1 -0
- package/src/setupTests.ts +5 -0
- package/src/stories/Components/DataDisplay/Avatar/Accessibility.stories.mdx +34 -0
- package/src/stories/Components/DataDisplay/Avatar/AllCombinations.tsx +56 -0
- package/src/stories/Components/DataDisplay/Avatar/Avatar.stories.tsx +19 -0
- package/src/stories/Components/DataDisplay/Avatar/Examples.stories.tsx +278 -0
- package/src/stories/Components/DataDisplay/Avatar/Overview.stories.mdx +47 -0
- package/src/stories/Components/DataDisplay/Chip/Accessibility.stories.mdx +29 -0
- package/src/stories/Components/DataDisplay/Chip/AllCombinations.tsx +58 -0
- package/src/stories/Components/DataDisplay/Chip/Chip.stories.tsx +21 -0
- package/src/stories/Components/DataDisplay/Chip/Examples.stories.tsx +126 -0
- package/src/stories/Components/DataDisplay/Chip/Overview.stories.mdx +57 -0
- package/src/stories/Components/DataDisplay/List/Accessibility.stories.mdx +54 -0
- package/src/stories/Components/DataDisplay/List/AllCombinations.tsx +396 -0
- package/src/stories/Components/DataDisplay/List/Examples.stories.tsx +501 -0
- package/src/stories/Components/DataDisplay/List/List.stories.tsx +35 -0
- package/src/stories/Components/DataDisplay/List/Overview.stories.mdx +69 -0
- package/src/stories/Components/DataDisplay/Table/Overview.stories.mdx +70 -0
- package/src/stories/Components/DataDisplay/Tooltip/Accessibility.stories.mdx +39 -0
- package/src/stories/Components/DataDisplay/Tooltip/AllCombinations.tsx +134 -0
- package/src/stories/Components/DataDisplay/Tooltip/Examples.stories.tsx +237 -0
- package/src/stories/Components/DataDisplay/Tooltip/Overview.stories.mdx +58 -0
- package/src/stories/Components/DataDisplay/Tooltip/Tooltip.stories.tsx +22 -0
- package/src/stories/Components/Feedback/Alert/Accessibility.stories.mdx +25 -0
- package/src/stories/Components/Feedback/Alert/Alert.stories.tsx +22 -0
- package/src/stories/Components/Feedback/Alert/AllCombinations.tsx +37 -0
- package/src/stories/Components/Feedback/Alert/Examples.stories.tsx +137 -0
- package/src/stories/Components/Feedback/Alert/Overview.stories.mdx +62 -0
- package/src/stories/Components/Inputs/Autocomplete/Accessibility.stories.mdx +31 -0
- package/src/stories/Components/Inputs/Autocomplete/AllCombinations.tsx +182 -0
- package/src/stories/Components/Inputs/Autocomplete/Autocomplete.stories.tsx +31 -0
- package/src/stories/Components/Inputs/Autocomplete/Examples.stories.tsx +233 -0
- package/src/stories/Components/Inputs/Autocomplete/Overview.stories.mdx +52 -0
- package/src/stories/Components/Inputs/Button/Accessibility.stories.mdx +52 -0
- package/src/stories/Components/Inputs/Button/AllCombinations.tsx +53 -0
- package/src/stories/Components/Inputs/Button/Button.stories.tsx +23 -0
- package/src/stories/Components/Inputs/Button/Examples.stories.tsx +190 -0
- package/src/stories/Components/Inputs/Button/Overview.stories.mdx +52 -0
- package/src/stories/Components/Inputs/Checkbox/Accessibility.stories.mdx +38 -0
- package/src/stories/Components/Inputs/Checkbox/AllCombinations.tsx +55 -0
- package/src/stories/Components/Inputs/Checkbox/Checkbox.stories.tsx +22 -0
- package/src/stories/Components/Inputs/Checkbox/Examples.stories.tsx +363 -0
- package/src/stories/Components/Inputs/Checkbox/Overview.stories.mdx +63 -0
- package/src/stories/Components/Inputs/IconButton/Examples.stories.tsx +24 -0
- package/src/stories/Components/Inputs/IconButton/IconButton.stories.tsx +26 -0
- package/src/stories/Components/Inputs/Radio/Accessibility.stories.mdx +61 -0
- package/src/stories/Components/Inputs/Radio/AllCombinations.tsx +75 -0
- package/src/stories/Components/Inputs/Radio/Examples.stories.tsx +333 -0
- package/src/stories/Components/Inputs/Radio/Overview.stories.mdx +74 -0
- package/src/stories/Components/Inputs/Radio/Radio.stories.tsx +22 -0
- package/src/stories/Components/Inputs/Select/Accessibility.stories.mdx +51 -0
- package/src/stories/Components/Inputs/Select/AllCombinations.tsx +63 -0
- package/src/stories/Components/Inputs/Select/Examples.stories.tsx +803 -0
- package/src/stories/Components/Inputs/Select/Overview.stories.mdx +73 -0
- package/src/stories/Components/Inputs/Select/Select.stories.tsx +22 -0
- package/src/stories/Components/Inputs/Slider/Accessibility.stories.mdx +43 -0
- package/src/stories/Components/Inputs/Slider/AllCombinations.tsx +30 -0
- package/src/stories/Components/Inputs/Slider/Examples.stories.tsx +146 -0
- package/src/stories/Components/Inputs/Slider/Overview.stories.mdx +59 -0
- package/src/stories/Components/Inputs/Slider/Slider.stories.tsx +27 -0
- package/src/stories/Components/Inputs/Switch/Accessibility.stories.mdx +34 -0
- package/src/stories/Components/Inputs/Switch/AllCombinations.tsx +45 -0
- package/src/stories/Components/Inputs/Switch/Examples.stories.tsx +213 -0
- package/src/stories/Components/Inputs/Switch/Overview.stories.mdx +62 -0
- package/src/stories/Components/Inputs/Switch/Switch.stories.tsx +22 -0
- package/src/stories/Components/Inputs/TextField/Accessibility.stories.mdx +29 -0
- package/src/stories/Components/Inputs/TextField/AllCombinations.tsx +57 -0
- package/src/stories/Components/Inputs/TextField/Examples.stories.tsx +127 -0
- package/src/stories/Components/Inputs/TextField/Overview.stories.mdx +60 -0
- package/src/stories/Components/Inputs/TextField/TextField.stories.tsx +261 -0
- package/src/stories/Components/Inputs/ToggleButton/Accessibility.stories.mdx +32 -0
- package/src/stories/Components/Inputs/ToggleButton/AllCombinations.tsx +113 -0
- package/src/stories/Components/Inputs/ToggleButton/Examples.stories.tsx +339 -0
- package/src/stories/Components/Inputs/ToggleButton/Overview.stories.mdx +55 -0
- package/src/stories/Components/Inputs/ToggleButton/ToggleButton.stories.tsx +19 -0
- package/src/stories/Components/Landmarks/Header/Examples.stories.tsx +197 -0
- package/src/stories/Components/Landmarks/Header/Header.stories.tsx +34 -0
- package/src/stories/Components/Landmarks/Header/Overview.stories.mdx +44 -0
- package/src/stories/Components/Navigation/Drawer/Accessibility.stories.mdx +13 -0
- package/src/stories/Components/Navigation/Drawer/Drawer.stories.tsx +80 -0
- package/src/stories/Components/Navigation/Drawer/Examples.stories.tsx +440 -0
- package/src/stories/Components/Navigation/Drawer/Overview.stories.mdx +43 -0
- package/src/stories/Components/Navigation/MobileNavigation/Accessibility.stories.mdx +14 -0
- package/src/stories/Components/Navigation/MobileNavigation/Examples.stories.tsx +384 -0
- package/src/stories/Components/Navigation/MobileNavigation/MobileNavigation.stories.tsx +24 -0
- package/src/stories/Components/Navigation/MobileNavigation/Overview.stories.mdx +47 -0
- package/src/stories/Components/Navigation/VerticalNavigation/Accessibility.stories.mdx +14 -0
- package/src/stories/Components/Navigation/VerticalNavigation/Examples.stories.tsx +307 -0
- package/src/stories/Components/Navigation/VerticalNavigation/Overview.stories.mdx +47 -0
- package/src/stories/Components/Navigation/VerticalNavigation/VerticalNavigation.stories.tsx +24 -0
- package/src/stories/ContactUs.stories.mdx +21 -0
- package/src/stories/Experimental/Test.stories.mdx +46 -0
- package/src/stories/GettingStarted/Designer.stories.mdx +86 -0
- package/src/stories/GettingStarted/Developer.stories.mdx +134 -0
- package/src/stories/Guidelines/Accessibility/AssistiveTechnology.stories.mdx +70 -0
- package/src/stories/Guidelines/Accessibility/ColorAndContrast.stories.mdx +109 -0
- package/src/stories/Guidelines/Accessibility/Hierarchy.stories.mdx +119 -0
- package/src/stories/Guidelines/Accessibility/Imagery.stories.mdx +136 -0
- package/src/stories/Guidelines/Accessibility/Overview.stories.mdx +44 -0
- package/src/stories/Guidelines/Accessibility/Principles.stories.mdx +156 -0
- package/src/stories/Guidelines/Accessibility/SoundAndMotion.stories.mdx +59 -0
- package/src/stories/Guidelines/Accessibility/Typography.stories.mdx +69 -0
- package/src/stories/Guidelines/Accessibility/Writing.stories.mdx +188 -0
- package/src/stories/Guidelines/Styleguide/ColorSwatch.tsx +53 -0
- package/src/stories/Guidelines/Styleguide/Colors.stories.mdx +118 -0
- package/src/stories/Guidelines/Styleguide/Typography.stories.mdx +84 -0
- package/src/stories/Introduction.stories.mdx +65 -0
- package/src/stories/Pages/ErrorPage.stories.tsx +30 -0
- package/src/stories/Pages/SideInSide.stories.tsx +195 -0
- package/src/stories/Roadmap.stories.mdx +19 -0
- package/src/stories/Templates/Login.stories.mdx +46 -0
- package/src/stories/assets/Atomic_Design_Icons-Dark.svg +24 -0
- package/src/stories/assets/Atomic_Design_Icons-Light.svg +25 -0
- package/src/stories/assets/accessibility-1.png +0 -0
- package/src/stories/assets/accessibility-2.png +0 -0
- package/src/stories/assets/accessibility-3.png +0 -0
- package/src/stories/assets/accessibility-banner.png +0 -0
- package/src/stories/assets/atoms.svg +6 -0
- package/src/stories/assets/design_system_2022-02-11_12.22pm.png +0 -0
- package/src/stories/assets/figma-tokens.png +0 -0
- package/src/stories/assets/hierarchy-1.jpg +0 -0
- package/src/stories/assets/hierarchy-2.jpg +0 -0
- package/src/stories/assets/hierarchy-3.jpg +0 -0
- package/src/stories/assets/icon-contrast-1.jpg +0 -0
- package/src/stories/assets/icon-contrast-2.jpg +0 -0
- package/src/stories/assets/imagery-1.png +0 -0
- package/src/stories/assets/imagery-2.png +0 -0
- package/src/stories/assets/imagery-3.png +0 -0
- package/src/stories/assets/imagery-4.jpg +0 -0
- package/src/stories/assets/molecules.svg +9 -0
- package/src/stories/assets/organisms.svg +22 -0
- package/src/stories/assets/pages.svg +5 -0
- package/src/stories/assets/particles.svg +4 -0
- package/src/stories/assets/templates.svg +4 -0
- package/src/stories/assets/testData.tsx +102 -0
- package/src/stories/assets/text-contrast-1.jpg +0 -0
- package/src/stories/assets/text-contrast-2.jpg +0 -0
- package/src/stories/assets/typography-1.png +0 -0
- package/src/stories/assets/visual-clues-1.png +0 -0
- package/src/stories/assets/visual-clues-2.png +0 -0
- package/src/stories/assets/writing-1.jpg +0 -0
- package/src/stories/assets/writing-2.png +0 -0
- package/src/stories/assets/writing-3.png +0 -0
- package/src/stories/assets/writing-4.png +0 -0
- package/src/stories/utils/CustomIcons.tsx +44 -0
- package/tsconfig.eslint.json +16 -0
- package/tsconfig.json +50 -0
- package/components/navigation/MobileNavigation/MobileNavigationAvatarStyles.d.ts +0 -827
- package/components/navigation/MobileNavigation/MobileNavigationDrawer.js +0 -147
- package/components/navigation/MobileNavigation/MobileNavigationDrawerStyles.d.ts +0 -392
- package/components/navigation/MobileNavigation/MobileNavigationNotchIndicator.d.ts +0 -3
- package/components/navigation/MobileNavigation/MobileNavigationNotchIndicator.js +0 -31
- package/components/navigation/MobileNavigation/MobileNavigationSearchStyles.d.ts +0 -257
- package/components/navigation/MobileNavigation/MobileNavigationToggleSearchX.d.ts +0 -3
- package/components/navigation/MobileNavigation/MobileNavigationToggleSearchX.js +0 -33
- package/components/navigation/MobileNavigation/MobileNavigationToggleX.d.ts +0 -3
- package/components/navigation/MobileNavigation/MobileNavigationToggleX.js +0 -27
- package/components/navigation/MobileNavigation/MobileNavigationToggleXStyles.d.ts +0 -36
- package/components/navigation/MobileNavigation/MobileNavigationToggleXStyles.js +0 -10
- package/components/navigation/VerticalNavigation/VerticalNavigationAvatarStyles.d.ts +0 -827
- package/components/navigation/VerticalNavigation/VerticalNavigationStyles.d.ts +0 -88
- package/utils/helpers.d.ts +0 -6
- package/utils/helpers.js +0 -17
|
@@ -0,0 +1,392 @@
|
|
|
1
|
+
import React, { useState, useEffect, ReactElement } from 'react'
|
|
2
|
+
import PropTypes from 'prop-types'
|
|
3
|
+
import jwtDecode from 'jwt-decode'
|
|
4
|
+
import queryString from 'query-string'
|
|
5
|
+
import { defaultMessages } from '../../../lang/en-us'
|
|
6
|
+
import AppSwitcherItem, { LogoVariants } from './AppSwitcherItem'
|
|
7
|
+
import {
|
|
8
|
+
AppListHeader, AppListItem, AppOrganisationCount, StyledSVG,
|
|
9
|
+
BackButton, MenuContent, OrganisationLink, OrganisationList,
|
|
10
|
+
SearchBox, SearchContent, SelectedOrganisation, AppSwitcherPanel
|
|
11
|
+
} from './AppSwitcherStyles'
|
|
12
|
+
import { Constants } from './constants'
|
|
13
|
+
import { DRAWER_WIDTH } from '../../navigation/VerticalNavigation/VerticalNavigationStyles'
|
|
14
|
+
import { IApplication } from '../../../types'
|
|
15
|
+
|
|
16
|
+
interface IProps {
|
|
17
|
+
userId?: string
|
|
18
|
+
layout?: string
|
|
19
|
+
token?: string
|
|
20
|
+
apiKey?: string
|
|
21
|
+
baseUrl?: string
|
|
22
|
+
applications?: IApplication[] | null
|
|
23
|
+
currentApplicationId?: number
|
|
24
|
+
localization?: any
|
|
25
|
+
isAppSwitcherOpen?: boolean
|
|
26
|
+
setIsAppSwitcherOpen?: any
|
|
27
|
+
isDrawerOpen?: boolean
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const AppSwitcher = (props: IProps): ReactElement | null => {
|
|
31
|
+
const {
|
|
32
|
+
isAppSwitcherOpen, setIsAppSwitcherOpen,
|
|
33
|
+
isDrawerOpen, localization,
|
|
34
|
+
apiKey = '', baseUrl
|
|
35
|
+
} = props
|
|
36
|
+
let { token } = props
|
|
37
|
+
|
|
38
|
+
// Controls whether the application panel is open or not.
|
|
39
|
+
// const [isOpen, setIsOpen] = useState(isAppSwitcherOpen)
|
|
40
|
+
// Holds the applications which are displayed.
|
|
41
|
+
const [applications, setApplications] = useState<IApplication[]>([])
|
|
42
|
+
// Controls which tab is active.
|
|
43
|
+
const [activeTab, setActiveTab] = useState(Constants.Tabs.ListApplications)
|
|
44
|
+
// Holds the list of filtered organisations (on the second tab).
|
|
45
|
+
const [filteredOrgs, setFilteredOrgs] = useState<any[] | undefined>([])
|
|
46
|
+
// Holds a reference to the active application (on the second tab).
|
|
47
|
+
const [activeApplication, setActiveApplication] = useState<IApplication | null>(null)
|
|
48
|
+
// Stores any org filter text (on the second tab).
|
|
49
|
+
const [searchString, setSearchString] = useState('')
|
|
50
|
+
|
|
51
|
+
const messages = { ...localization, ...defaultMessages }
|
|
52
|
+
|
|
53
|
+
let userId = props.userId ?? ''
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Toggles display of the Stream suite application dialog.
|
|
57
|
+
* @param event {React.MouseEvent} - Click event.
|
|
58
|
+
*/
|
|
59
|
+
// const handleToggleAppsClick = (event: React.MouseEvent<HTMLButtonElement>): void => {
|
|
60
|
+
// setIsOpen(!isOpen)
|
|
61
|
+
// }
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Handles closing of the application dialog.
|
|
65
|
+
*/
|
|
66
|
+
const handleDialogClose = (): void => {
|
|
67
|
+
// setIsOpen(false)
|
|
68
|
+
setIsAppSwitcherOpen(false)
|
|
69
|
+
|
|
70
|
+
setTimeout(() => {
|
|
71
|
+
setSearchString('')
|
|
72
|
+
setActiveApplication(null)
|
|
73
|
+
setActiveTab(Constants.Tabs.ListApplications)
|
|
74
|
+
}, 400)
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Updates the search/filter text.
|
|
79
|
+
* @param event {React.ChangeEvent}
|
|
80
|
+
*/
|
|
81
|
+
const handleSearchChange = (event: React.ChangeEvent<HTMLInputElement>): void => {
|
|
82
|
+
setSearchString(event.target.value)
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Navigates to the organisation tab for an application with children.
|
|
87
|
+
* @param event {React.MouseEvent} - Click event.
|
|
88
|
+
* @param applicationId {number | undefined} - Unique identifier of the application.
|
|
89
|
+
* @returns {void}
|
|
90
|
+
*/
|
|
91
|
+
const handleGoToAppClick = (event: React.MouseEvent, applicationId: number | undefined): any => {
|
|
92
|
+
event?.preventDefault()
|
|
93
|
+
event?.stopPropagation()
|
|
94
|
+
|
|
95
|
+
if (!applicationId) {
|
|
96
|
+
return
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
const selectedApplication = applications.find(a => a.applicationId === applicationId)
|
|
100
|
+
|
|
101
|
+
if (!selectedApplication) {
|
|
102
|
+
return
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
setFilteredOrgs(selectedApplication.children)
|
|
106
|
+
setActiveApplication(selectedApplication)
|
|
107
|
+
setActiveTab(Constants.Tabs.ListOrgs)
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Renders an application logo.
|
|
112
|
+
* @param internalName {string | null | undefined } - Internal name of the application.
|
|
113
|
+
* @returns {ReactElement | null } SVG containing the application logo retrieved from the CDN.
|
|
114
|
+
*/
|
|
115
|
+
const renderApplicationLogo = (internalName: string | null | undefined, logoVariant: string): ReactElement | null => {
|
|
116
|
+
if (!internalName) {
|
|
117
|
+
return <></>
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
const urlToIcon = `${Constants.AssetsUrl}${internalName}/logo/latest/${logoVariant ?? LogoVariants.Default}.svg`
|
|
121
|
+
|
|
122
|
+
return (
|
|
123
|
+
<svg>
|
|
124
|
+
<image xlinkHref={urlToIcon} width="60" height="60" />
|
|
125
|
+
</svg>
|
|
126
|
+
)
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Queries the Steam Home API to fetch a list of applications.
|
|
131
|
+
* @returns {Promise<IApplication[]>} A list of applications the user has access to.
|
|
132
|
+
*/
|
|
133
|
+
const getApplicationsForUser = async (): Promise<IApplication[]> => {
|
|
134
|
+
// If the access token has changed the endpoint should be called again.
|
|
135
|
+
if (token && typeof token === 'string' && token !== window.localStorage.getItem(Constants.LocalStorageKey.Token)) {
|
|
136
|
+
if (!userId) {
|
|
137
|
+
// Extract user identifier from the JWT.
|
|
138
|
+
const decodedToken: any = jwtDecode(token)
|
|
139
|
+
userId = decodedToken[Constants.HomeAttributes.UserId]
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
const response = await fetch(`${baseUrl ?? Constants.BaseUrl}/users/${userId}/application-instances`, {
|
|
143
|
+
method: 'get',
|
|
144
|
+
headers: new Headers({
|
|
145
|
+
Authorization: `Bearer ${token}`,
|
|
146
|
+
'x-api-key': apiKey
|
|
147
|
+
})
|
|
148
|
+
})
|
|
149
|
+
|
|
150
|
+
if (response.status !== 200) {
|
|
151
|
+
console.error('Unable to retrieve user applications from Stream Home')
|
|
152
|
+
return []
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
const data = await response.json()
|
|
156
|
+
|
|
157
|
+
// Store the latest access token.
|
|
158
|
+
window.localStorage.setItem(Constants.LocalStorageKey.Token, token)
|
|
159
|
+
|
|
160
|
+
return data.map((application: IApplication) => {
|
|
161
|
+
const { applicationId, applicationName, shortName, internalName, customName, url } = application
|
|
162
|
+
|
|
163
|
+
return {
|
|
164
|
+
applicationId,
|
|
165
|
+
applicationName,
|
|
166
|
+
shortName,
|
|
167
|
+
internalName,
|
|
168
|
+
customName,
|
|
169
|
+
url: url || ''
|
|
170
|
+
}
|
|
171
|
+
}) as [IApplication]
|
|
172
|
+
} else {
|
|
173
|
+
return []
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
useEffect(() => {
|
|
178
|
+
const loadData = async (): Promise<void> => {
|
|
179
|
+
let applicationInstances: IApplication[] = []
|
|
180
|
+
let userApplications: IApplication[] = []
|
|
181
|
+
|
|
182
|
+
if (!token) {
|
|
183
|
+
const parsedQueryString = queryString.parse(window.location.search)
|
|
184
|
+
|
|
185
|
+
if (parsedQueryString.token && typeof parsedQueryString.token === 'string') {
|
|
186
|
+
token = parsedQueryString.token
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
if (!props.applications || props.applications.length === 0) {
|
|
191
|
+
applicationInstances = await getApplicationsForUser()
|
|
192
|
+
} else {
|
|
193
|
+
// A hard-coded list of applications has been passed to the component.
|
|
194
|
+
applicationInstances = props.applications
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
if (Array.isArray(applicationInstances) && applicationInstances.length) {
|
|
198
|
+
// Get a distinct list of applications the user has access to.
|
|
199
|
+
const uniqueApplicationIds: number[] = applicationInstances.map((item: { applicationId: number }) => item.applicationId).filter((value: number, index: number, self: number[]) => self.indexOf(value) === index)
|
|
200
|
+
|
|
201
|
+
// Iterate over these to build up the userApplications array.
|
|
202
|
+
uniqueApplicationIds.forEach(applicationId => {
|
|
203
|
+
const applications = applicationInstances.filter(instance => instance.applicationId === applicationId)
|
|
204
|
+
|
|
205
|
+
if (applications.length > 1) {
|
|
206
|
+
// This is an application with multiple orgs/tenants the user has access to.
|
|
207
|
+
userApplications.push({
|
|
208
|
+
applicationId,
|
|
209
|
+
applicationName: applications[0].applicationName,
|
|
210
|
+
shortName: applications[0].shortName,
|
|
211
|
+
internalName: applications[0].internalName,
|
|
212
|
+
url: '',
|
|
213
|
+
children: applications.map(a => {
|
|
214
|
+
return {
|
|
215
|
+
name: a.customName ?? a.applicationName,
|
|
216
|
+
url: a.url
|
|
217
|
+
}
|
|
218
|
+
})
|
|
219
|
+
})
|
|
220
|
+
} else {
|
|
221
|
+
// This is a standalone application.
|
|
222
|
+
userApplications.push({
|
|
223
|
+
applicationId: applications[0].applicationId,
|
|
224
|
+
applicationName: applications[0].applicationName,
|
|
225
|
+
shortName: applications[0].shortName,
|
|
226
|
+
internalName: applications[0].internalName,
|
|
227
|
+
url: applications[0].url
|
|
228
|
+
})
|
|
229
|
+
}
|
|
230
|
+
})
|
|
231
|
+
|
|
232
|
+
// Serialize and cache the applications returned.
|
|
233
|
+
window.localStorage.setItem(Constants.LocalStorageKey.Applications, JSON.stringify(userApplications))
|
|
234
|
+
} else {
|
|
235
|
+
const localApplications: string | null = window.localStorage.getItem(Constants.LocalStorageKey.Applications)
|
|
236
|
+
|
|
237
|
+
if (localApplications) {
|
|
238
|
+
// Recreate the application state from local storage.
|
|
239
|
+
userApplications = JSON.parse(localApplications)
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
// Store the user's applications.
|
|
244
|
+
setApplications(userApplications)
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
loadData()
|
|
248
|
+
.catch(console.error)
|
|
249
|
+
}, [token, apiKey, baseUrl, userId])
|
|
250
|
+
|
|
251
|
+
const handleKeyDown = (event: React.KeyboardEvent) => {
|
|
252
|
+
if (event && event.type === 'keydown') {
|
|
253
|
+
// Close AppSwitcher if Escape key is pressed
|
|
254
|
+
if ((event as React.KeyboardEvent).key === 'Escape') {
|
|
255
|
+
handleDialogClose()
|
|
256
|
+
|
|
257
|
+
// Doesnt return focus but we need to investigate MUI again
|
|
258
|
+
// so that should handle it
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
if (!props.applications && (!token || !apiKey)) {
|
|
264
|
+
return null
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
return (
|
|
268
|
+
<AppSwitcherPanel
|
|
269
|
+
id="app-switcher-menu"
|
|
270
|
+
style={{
|
|
271
|
+
display: isAppSwitcherOpen ? 'block' : 'none',
|
|
272
|
+
left: isDrawerOpen ? DRAWER_WIDTH.Expanded : DRAWER_WIDTH.Collapsed - 3
|
|
273
|
+
}}
|
|
274
|
+
role='dialog'
|
|
275
|
+
aria-label="App Switcher"
|
|
276
|
+
onKeyDown={handleKeyDown}
|
|
277
|
+
>
|
|
278
|
+
{activeTab === Constants.Tabs.ListApplications
|
|
279
|
+
? (
|
|
280
|
+
<div>
|
|
281
|
+
<AppListHeader>
|
|
282
|
+
<svg>
|
|
283
|
+
<image
|
|
284
|
+
xlinkHref={`${Constants.AssetsUrl}suite/logo/latest/icon.svg`}
|
|
285
|
+
width="24"
|
|
286
|
+
height="24" />
|
|
287
|
+
</svg>
|
|
288
|
+
{messages['your-apps']}
|
|
289
|
+
</AppListHeader>
|
|
290
|
+
<MenuContent
|
|
291
|
+
style={{
|
|
292
|
+
display: activeTab === 1 ? 'flex' : 'none'
|
|
293
|
+
}}
|
|
294
|
+
>
|
|
295
|
+
{applications.map(({ applicationId, applicationName, shortName, internalName, url, children }) => (
|
|
296
|
+
<AppListItem key={applicationId}>
|
|
297
|
+
{url && (
|
|
298
|
+
<AppSwitcherItem
|
|
299
|
+
internalName={internalName}
|
|
300
|
+
shortName={shortName}
|
|
301
|
+
url={url}
|
|
302
|
+
handleGoToAppClick={handleGoToAppClick}
|
|
303
|
+
/>
|
|
304
|
+
)}
|
|
305
|
+
{!url && (
|
|
306
|
+
<AppSwitcherItem
|
|
307
|
+
internalName={internalName}
|
|
308
|
+
shortName={shortName}
|
|
309
|
+
handleGoToAppClick={handleGoToAppClick}
|
|
310
|
+
applicationId={applicationId}
|
|
311
|
+
/>
|
|
312
|
+
)}
|
|
313
|
+
{children && (
|
|
314
|
+
<AppOrganisationCount>
|
|
315
|
+
{children.length}
|
|
316
|
+
</AppOrganisationCount>
|
|
317
|
+
)}
|
|
318
|
+
</AppListItem>
|
|
319
|
+
))}
|
|
320
|
+
</MenuContent>
|
|
321
|
+
</div>)
|
|
322
|
+
: null}
|
|
323
|
+
{activeTab === Constants.Tabs.ListOrgs
|
|
324
|
+
? (
|
|
325
|
+
<SearchContent
|
|
326
|
+
style={{
|
|
327
|
+
display: activeTab === 2 ? 'flex' : 'none'
|
|
328
|
+
}}
|
|
329
|
+
>
|
|
330
|
+
<BackButton
|
|
331
|
+
onClick={() => {
|
|
332
|
+
setActiveTab(Constants.Tabs.ListApplications)
|
|
333
|
+
setSearchString('')
|
|
334
|
+
}}
|
|
335
|
+
>
|
|
336
|
+
<StyledSVG className="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium MuiBox-root css-1om0hkc" focusable="false" aria-hidden="true" viewBox="0 0 24 24" data-testid="ChevronLeftIcon">
|
|
337
|
+
<path d="M15.41 7.41 14 6l-6 6 6 6 1.41-1.41L10.83 12z"></path>
|
|
338
|
+
</StyledSVG>
|
|
339
|
+
{messages['back-to']}
|
|
340
|
+
</BackButton>
|
|
341
|
+
<SelectedOrganisation>
|
|
342
|
+
{renderApplicationLogo(activeApplication?.internalName, LogoVariants.Solid)}
|
|
343
|
+
<span>
|
|
344
|
+
{activeApplication ? activeApplication.applicationName : ''}
|
|
345
|
+
</span>
|
|
346
|
+
</SelectedOrganisation>
|
|
347
|
+
<SearchBox
|
|
348
|
+
id="app-switcher-search-org"
|
|
349
|
+
type={'text'}
|
|
350
|
+
value={searchString}
|
|
351
|
+
onChange={handleSearchChange}
|
|
352
|
+
placeholder={messages.search}
|
|
353
|
+
/>
|
|
354
|
+
<OrganisationList>
|
|
355
|
+
{filteredOrgs?.filter(o => o.name.toLowerCase().includes(searchString.toLowerCase())).map((org, i) => (
|
|
356
|
+
<OrganisationLink
|
|
357
|
+
key={i}
|
|
358
|
+
href={org.url}
|
|
359
|
+
target="_blank"
|
|
360
|
+
>
|
|
361
|
+
{org.name}
|
|
362
|
+
<StyledSVG className="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium MuiBox-root css-1om0hkc" focusable="false" aria-hidden="true" viewBox="0 0 24 24" data-testid="ChevronRightIcon">
|
|
363
|
+
<path d="M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"></path>
|
|
364
|
+
</StyledSVG>
|
|
365
|
+
</OrganisationLink>
|
|
366
|
+
))}
|
|
367
|
+
</OrganisationList>
|
|
368
|
+
</SearchContent>)
|
|
369
|
+
: null}
|
|
370
|
+
</AppSwitcherPanel>
|
|
371
|
+
)
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
AppSwitcher.propTypes = {
|
|
375
|
+
accessToken: PropTypes.string,
|
|
376
|
+
apiKey: PropTypes.string,
|
|
377
|
+
layout: PropTypes.string,
|
|
378
|
+
userId: PropTypes.number,
|
|
379
|
+
baseUrl: PropTypes.string,
|
|
380
|
+
localization: PropTypes.object,
|
|
381
|
+
currentApplicationId: PropTypes.number,
|
|
382
|
+
applications: PropTypes.array
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
AppSwitcher.defaultProps = {
|
|
386
|
+
layout: Constants.Layout.Vertical,
|
|
387
|
+
baseUrl: Constants.BaseUrl,
|
|
388
|
+
localization: {},
|
|
389
|
+
applications: []
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
export default AppSwitcher
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { ReactElement } from 'react'
|
|
2
|
+
import { Constants } from './constants'
|
|
3
|
+
import { AppLink, AppName, StyledLogoSVG } from './AppSwitcherStyles'
|
|
4
|
+
|
|
5
|
+
// Bug in the naming of the icons on the CDN
|
|
6
|
+
export const LogoVariants = {
|
|
7
|
+
Default: 'icon',
|
|
8
|
+
Solid: 'icon-solid',
|
|
9
|
+
Outlined: 'icon-outlined',
|
|
10
|
+
White: 'icon-white'
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
interface IAppSwitcherItemProps {
|
|
14
|
+
internalName: string
|
|
15
|
+
shortName: string
|
|
16
|
+
handleGoToAppClick: Function
|
|
17
|
+
applicationId?: number
|
|
18
|
+
url?: string
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const AppSwitcherItem = (props: IAppSwitcherItemProps): ReactElement => {
|
|
22
|
+
const {
|
|
23
|
+
applicationId, internalName, shortName,
|
|
24
|
+
url, handleGoToAppClick
|
|
25
|
+
} = props
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Renders an application logo.
|
|
29
|
+
* @param internalName {string | null | undefined } - Internal name of the application.
|
|
30
|
+
* @returns {ReactElement | null } SVG containing the application logo retrieved from the CDN.
|
|
31
|
+
*/
|
|
32
|
+
const renderApplicationLogo = (internalName: string | null | undefined, logoVariant: string): ReactElement | null => {
|
|
33
|
+
if (!internalName) {
|
|
34
|
+
return <></>
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const urlToIcon = `${Constants.AssetsUrl}${internalName}/logo/latest/${logoVariant ?? LogoVariants.Default}.svg`
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
<StyledLogoSVG>
|
|
41
|
+
<image xlinkHref={urlToIcon} width="60" height="60" />
|
|
42
|
+
</StyledLogoSVG>
|
|
43
|
+
)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const solidLogo = renderApplicationLogo(internalName, LogoVariants.Solid)
|
|
47
|
+
|
|
48
|
+
return (
|
|
49
|
+
<AppLink
|
|
50
|
+
href={url ?? '#'}
|
|
51
|
+
target="_blank"
|
|
52
|
+
onClick={event => applicationId ? handleGoToAppClick(event, applicationId) : null}
|
|
53
|
+
>
|
|
54
|
+
{applicationId && (
|
|
55
|
+
// Create a stack effect to indicate multiple
|
|
56
|
+
<>
|
|
57
|
+
<span style={{
|
|
58
|
+
position: 'absolute',
|
|
59
|
+
top: '4px',
|
|
60
|
+
transform: 'scale(0.8)',
|
|
61
|
+
zIndex: 0
|
|
62
|
+
}}>
|
|
63
|
+
{solidLogo}
|
|
64
|
+
</span>
|
|
65
|
+
<span style={{
|
|
66
|
+
position: 'absolute',
|
|
67
|
+
top: '10px',
|
|
68
|
+
transform: 'scale(0.9)',
|
|
69
|
+
zIndex: 0
|
|
70
|
+
}}>
|
|
71
|
+
{solidLogo}
|
|
72
|
+
</span>
|
|
73
|
+
</>
|
|
74
|
+
)}
|
|
75
|
+
{solidLogo}
|
|
76
|
+
<AppName>
|
|
77
|
+
{shortName}
|
|
78
|
+
</AppName>
|
|
79
|
+
</AppLink>
|
|
80
|
+
)
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export default AppSwitcherItem
|