@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,187 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jest-environment jsdom
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import React from 'react'
|
|
6
|
+
import { cleanup, render, screen } from '@testing-library/react'
|
|
7
|
+
import { Avatar, AvatarGroup } from '../../../../lib/'
|
|
8
|
+
import FolderIcon from '@mui/icons-material/Folder'
|
|
9
|
+
// import logoImage from '../../../../lib/assets/avatar-1.jpg'
|
|
10
|
+
|
|
11
|
+
// Note: running cleanup afterEach is done automatically for you in @testing-library/react@9.0.0 or higher
|
|
12
|
+
// unmount and cleanup DOM after the test is finished.
|
|
13
|
+
afterEach(cleanup)
|
|
14
|
+
|
|
15
|
+
describe('Test -- Avatar component', () => {
|
|
16
|
+
it('renders a Avatar', () => {
|
|
17
|
+
render(<Avatar data-testid="AvatarTest">LP</Avatar>)
|
|
18
|
+
|
|
19
|
+
expect(screen.getByTestId('AvatarTest')).toMatchInlineSnapshot(`
|
|
20
|
+
<div
|
|
21
|
+
class="MuiAvatar-root MuiAvatar-circular MuiAvatar-colorDefault css-1hhrmaj-MuiAvatar-root"
|
|
22
|
+
data-testid="AvatarTest"
|
|
23
|
+
>
|
|
24
|
+
LP
|
|
25
|
+
</div>
|
|
26
|
+
`)
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
it('renders a group of avatars', () => {
|
|
30
|
+
render(
|
|
31
|
+
<AvatarGroup data-testid="AvatarTest">
|
|
32
|
+
<Avatar>RD</Avatar>
|
|
33
|
+
<Avatar>NS</Avatar>
|
|
34
|
+
<Avatar>AM</Avatar>
|
|
35
|
+
</AvatarGroup>
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
expect(screen.getByTestId('AvatarTest')).toMatchInlineSnapshot(`
|
|
39
|
+
<div
|
|
40
|
+
class="MuiAvatarGroup-root css-1ytufz-MuiAvatarGroup-root"
|
|
41
|
+
data-testid="AvatarTest"
|
|
42
|
+
>
|
|
43
|
+
<div
|
|
44
|
+
class="MuiAvatar-root MuiAvatar-circular MuiAvatar-colorDefault MuiAvatarGroup-avatar css-1hhrmaj-MuiAvatar-root"
|
|
45
|
+
>
|
|
46
|
+
AM
|
|
47
|
+
</div>
|
|
48
|
+
<div
|
|
49
|
+
class="MuiAvatar-root MuiAvatar-circular MuiAvatar-colorDefault MuiAvatarGroup-avatar css-1hhrmaj-MuiAvatar-root"
|
|
50
|
+
>
|
|
51
|
+
NS
|
|
52
|
+
</div>
|
|
53
|
+
<div
|
|
54
|
+
class="MuiAvatar-root MuiAvatar-circular MuiAvatar-colorDefault MuiAvatarGroup-avatar css-1hhrmaj-MuiAvatar-root"
|
|
55
|
+
>
|
|
56
|
+
RD
|
|
57
|
+
</div>
|
|
58
|
+
</div>
|
|
59
|
+
`)
|
|
60
|
+
})
|
|
61
|
+
|
|
62
|
+
it('displays the correct number of avatars in a group', () => {
|
|
63
|
+
render(
|
|
64
|
+
<AvatarGroup data-testid="AvatarTest" total={10}>
|
|
65
|
+
<Avatar>LP</Avatar>
|
|
66
|
+
<Avatar>LP</Avatar>
|
|
67
|
+
<Avatar>LP</Avatar>
|
|
68
|
+
<Avatar>LP</Avatar>
|
|
69
|
+
<Avatar>LP</Avatar>
|
|
70
|
+
<Avatar>LP</Avatar>
|
|
71
|
+
<Avatar>LP</Avatar>
|
|
72
|
+
<Avatar>LP</Avatar>
|
|
73
|
+
<Avatar>LP</Avatar>
|
|
74
|
+
<Avatar>LP</Avatar>
|
|
75
|
+
</AvatarGroup>
|
|
76
|
+
)
|
|
77
|
+
|
|
78
|
+
const el = screen.getByText(/6/i)
|
|
79
|
+
expect(el).toBeInTheDocument()
|
|
80
|
+
})
|
|
81
|
+
|
|
82
|
+
it('limits the number of avatars in a group', () => {
|
|
83
|
+
render(
|
|
84
|
+
<AvatarGroup max={3}>
|
|
85
|
+
<Avatar>RD</Avatar>
|
|
86
|
+
<Avatar>NS</Avatar>
|
|
87
|
+
<Avatar>AM</Avatar>
|
|
88
|
+
<Avatar>KW</Avatar>
|
|
89
|
+
<Avatar>DD</Avatar>
|
|
90
|
+
<Avatar>NT</Avatar>
|
|
91
|
+
</AvatarGroup>
|
|
92
|
+
)
|
|
93
|
+
|
|
94
|
+
const el = screen.getByText(/4/i)
|
|
95
|
+
expect(el).toBeInTheDocument()
|
|
96
|
+
})
|
|
97
|
+
|
|
98
|
+
it('renders the correct initials', () => {
|
|
99
|
+
render(<Avatar data-testid="AvatarTest">LP</Avatar>)
|
|
100
|
+
|
|
101
|
+
const el = screen.getByText('LP')
|
|
102
|
+
expect(el).toBeInTheDocument()
|
|
103
|
+
})
|
|
104
|
+
|
|
105
|
+
it('has an accessibile description', () => {
|
|
106
|
+
render(
|
|
107
|
+
<Avatar data-testid="AvatarTest" aria-label="Label">
|
|
108
|
+
LP
|
|
109
|
+
</Avatar>
|
|
110
|
+
)
|
|
111
|
+
|
|
112
|
+
const el = screen.getByTestId('AvatarTest')
|
|
113
|
+
expect(el).toHaveAttribute('aria-label', 'Label')
|
|
114
|
+
})
|
|
115
|
+
|
|
116
|
+
it('changes size', () => {
|
|
117
|
+
render(
|
|
118
|
+
<Avatar data-testid="AvatarTest" sx={{ width: 100, height: 100 }}>
|
|
119
|
+
LP
|
|
120
|
+
</Avatar>
|
|
121
|
+
)
|
|
122
|
+
|
|
123
|
+
const el = screen.getByTestId('AvatarTest')
|
|
124
|
+
expect(el).toHaveStyle('width: 100px')
|
|
125
|
+
expect(el).toHaveStyle('height: 100px')
|
|
126
|
+
})
|
|
127
|
+
|
|
128
|
+
it('renders an icon', () => {
|
|
129
|
+
render(
|
|
130
|
+
<Avatar>
|
|
131
|
+
<FolderIcon />
|
|
132
|
+
</Avatar>
|
|
133
|
+
)
|
|
134
|
+
|
|
135
|
+
const el = screen.getByTestId('FolderIcon')
|
|
136
|
+
expect(el).toBeInTheDocument()
|
|
137
|
+
})
|
|
138
|
+
|
|
139
|
+
it('automatically sets the text color', () => {
|
|
140
|
+
render(
|
|
141
|
+
<>
|
|
142
|
+
<Avatar data-testid="AvatarTest1" style={{ backgroundColor: '#000' }}>
|
|
143
|
+
LP
|
|
144
|
+
</Avatar>
|
|
145
|
+
{/* <Avatar data-testid="AvatarTest2" sx={{ bgcolor: '#fff' }}>
|
|
146
|
+
LP
|
|
147
|
+
</Avatar> */}
|
|
148
|
+
</>
|
|
149
|
+
)
|
|
150
|
+
|
|
151
|
+
const black = screen.getByTestId('AvatarTest1')
|
|
152
|
+
|
|
153
|
+
expect(screen.getByTestId('AvatarTest1')).toMatchInlineSnapshot(`
|
|
154
|
+
<div
|
|
155
|
+
class="MuiAvatar-root MuiAvatar-circular MuiAvatar-colorDefault css-1hhrmaj-MuiAvatar-root"
|
|
156
|
+
data-testid="AvatarTest1"
|
|
157
|
+
style="background-color: rgb(0, 0, 0);"
|
|
158
|
+
>
|
|
159
|
+
LP
|
|
160
|
+
</div>
|
|
161
|
+
`)
|
|
162
|
+
expect(black).toHaveStyle('color: #fff')
|
|
163
|
+
|
|
164
|
+
// const white = screen.getByTestId('AvatarTest2')
|
|
165
|
+
// expect(screen.getByTestId('AvatarTest2')).toMatchInlineSnapshot(`
|
|
166
|
+
// <div
|
|
167
|
+
// class="tss-26olqr-root MuiAvatar-root MuiAvatar-circular MuiAvatar-colorDefault css-ax6k3r-MuiAvatar-root"
|
|
168
|
+
// data-testid="AvatarTest2"
|
|
169
|
+
// >
|
|
170
|
+
// LP
|
|
171
|
+
// </div>
|
|
172
|
+
// `)
|
|
173
|
+
// expect(white).toHaveStyle('color: rgba(0, 0, 0, 0.87)')
|
|
174
|
+
})
|
|
175
|
+
|
|
176
|
+
it('properly renders a fallback image', () => {
|
|
177
|
+
render(
|
|
178
|
+
<Avatar
|
|
179
|
+
data-testid="AvatarTest"
|
|
180
|
+
src="https://source.unsplash.com/cUgSz7nO_RY"
|
|
181
|
+
/>
|
|
182
|
+
)
|
|
183
|
+
|
|
184
|
+
const el = screen.getByTestId('AvatarTest')
|
|
185
|
+
expect(el).toBeInTheDocument()
|
|
186
|
+
})
|
|
187
|
+
})
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import MUIAvatar, { AvatarProps } from '@mui/material/Avatar'
|
|
3
|
+
import GlobalStyles from '@mui/material/GlobalStyles'
|
|
4
|
+
import { styled } from '@mui/material/styles'
|
|
5
|
+
|
|
6
|
+
const StyledAvatar = styled(MUIAvatar, { shouldForwardProp: (prop) => prop !== 'sx' })<{
|
|
7
|
+
sx?: any
|
|
8
|
+
}>(({ theme, sx }) => ({
|
|
9
|
+
backgroundColor: sx?.bgcolor
|
|
10
|
+
? sx.bgcolor
|
|
11
|
+
: theme.palette.primary.main,
|
|
12
|
+
color: sx?.bgcolor
|
|
13
|
+
? sx.color ?? theme.palette.getContrastText(sx.bgcolor)
|
|
14
|
+
: theme.palette.primary.contrastText,
|
|
15
|
+
fontSize: '0.9rem',
|
|
16
|
+
textTransform: 'uppercase'
|
|
17
|
+
}))
|
|
18
|
+
|
|
19
|
+
const Avatar = (
|
|
20
|
+
props: AvatarProps | any
|
|
21
|
+
): React.ReactElement => (
|
|
22
|
+
<>
|
|
23
|
+
<GlobalStyles
|
|
24
|
+
styles={{
|
|
25
|
+
'.MuiAvatarGroup-root .MuiAvatar-root:first-of-type': {
|
|
26
|
+
backgroundColor: '#eee',
|
|
27
|
+
color: '#333'
|
|
28
|
+
}
|
|
29
|
+
}}
|
|
30
|
+
/>
|
|
31
|
+
<StyledAvatar {...props} />
|
|
32
|
+
</>
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
export default Avatar
|
|
Binary file
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { cleanup, render, screen } from '@testing-library/react'
|
|
3
|
+
import userEvent from '@testing-library/user-event'
|
|
4
|
+
import Chip from './Chip'
|
|
5
|
+
import FaceIcon from '@mui/icons-material/Face'
|
|
6
|
+
import Avatar from '@mui/material/Avatar'
|
|
7
|
+
|
|
8
|
+
// Note: running cleanup afterEach is done automatically for you in @testing-library/react@9.0.0 or higher
|
|
9
|
+
// unmount and cleanup DOM after the test is finished.
|
|
10
|
+
afterEach(cleanup)
|
|
11
|
+
|
|
12
|
+
describe('Test -- Chip component', () => {
|
|
13
|
+
it('renders a Chip', () => {
|
|
14
|
+
render(<Chip data-testid="ChipTest" label="label" />)
|
|
15
|
+
|
|
16
|
+
expect(screen.getByTestId('ChipTest')).toMatchInlineSnapshot(`
|
|
17
|
+
<div
|
|
18
|
+
class="MuiChip-root MuiChip-filled MuiChip-sizeMedium MuiChip-colorDefault MuiChip-filledDefault css-gac2fo-MuiChip-root"
|
|
19
|
+
data-testid="ChipTest"
|
|
20
|
+
>
|
|
21
|
+
<span
|
|
22
|
+
class="MuiChip-label MuiChip-labelMedium css-6od3lo-MuiChip-label"
|
|
23
|
+
>
|
|
24
|
+
label
|
|
25
|
+
</span>
|
|
26
|
+
</div>
|
|
27
|
+
`)
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
it('responds to a click event', () => {
|
|
31
|
+
const mockCallBack = jest.fn()
|
|
32
|
+
render(
|
|
33
|
+
<Chip onClick={mockCallBack} data-testid="ChipTest" label="label" />
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
userEvent.click(screen.getByTestId('ChipTest'))
|
|
37
|
+
expect(mockCallBack.mock.calls.length).toEqual(1)
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
it('renders a link element', () => {
|
|
41
|
+
render(
|
|
42
|
+
<Chip
|
|
43
|
+
label="label"
|
|
44
|
+
data-testid="ChipTest"
|
|
45
|
+
component="a"
|
|
46
|
+
href="#"
|
|
47
|
+
clickable
|
|
48
|
+
/>
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
const chip = screen.getByTestId('ChipTest')
|
|
52
|
+
expect(chip).toHaveAttribute('href', '#')
|
|
53
|
+
})
|
|
54
|
+
|
|
55
|
+
it('renders a delete icon', () => {
|
|
56
|
+
const mockCallBack = jest.fn()
|
|
57
|
+
render(
|
|
58
|
+
<Chip label="label" data-testid="ChipTest" onDelete={mockCallBack} />
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
expect(screen.getByTestId('CancelIcon')).toBeInTheDocument()
|
|
62
|
+
})
|
|
63
|
+
|
|
64
|
+
it('responds to a delete click event', () => {
|
|
65
|
+
const mockCallBack = jest.fn()
|
|
66
|
+
render(<Chip label="label" onDelete={mockCallBack} />)
|
|
67
|
+
userEvent.click(screen.getByTestId('CancelIcon'))
|
|
68
|
+
expect(mockCallBack.mock.calls.length).toEqual(1)
|
|
69
|
+
})
|
|
70
|
+
|
|
71
|
+
it('renders with correct adornments', () => {
|
|
72
|
+
// Check render with icon
|
|
73
|
+
const { rerender } = render(<Chip icon={<FaceIcon />} label="label" />)
|
|
74
|
+
const chip = screen.getByTestId('FaceIcon')
|
|
75
|
+
expect(chip).toBeInTheDocument()
|
|
76
|
+
|
|
77
|
+
// Check render with avatar
|
|
78
|
+
rerender(<Chip avatar={<Avatar>LP</Avatar>} label="Label" />)
|
|
79
|
+
const chipAvatar = screen.getByText('LP')
|
|
80
|
+
expect(chipAvatar).toBeInTheDocument()
|
|
81
|
+
})
|
|
82
|
+
})
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import MUIChip from '@mui/material/Chip'
|
|
3
|
+
import type { ChipProps } from '@mui/material/Chip'
|
|
4
|
+
|
|
5
|
+
interface IChipProps extends ChipProps {}
|
|
6
|
+
|
|
7
|
+
export default function Chip ({ ...rest }: IChipProps): JSX.Element {
|
|
8
|
+
return (
|
|
9
|
+
<MUIChip {...rest} />
|
|
10
|
+
)
|
|
11
|
+
}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jest-environment jsdom
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import React from 'react'
|
|
6
|
+
import { cleanup, render, screen } from '@testing-library/react'
|
|
7
|
+
import userEvent from '@testing-library/user-event'
|
|
8
|
+
import List from './List'
|
|
9
|
+
import {
|
|
10
|
+
ListItem,
|
|
11
|
+
ListItemText,
|
|
12
|
+
ListItemButton,
|
|
13
|
+
ListItemIcon
|
|
14
|
+
} from '../../../'
|
|
15
|
+
import FaceIcon from '@mui/icons-material/Face'
|
|
16
|
+
|
|
17
|
+
// Note: running cleanup afterEach is done automatically for you in @testing-library/react@9.0.0 or higher
|
|
18
|
+
// unmount and cleanup DOM after the test is finished.
|
|
19
|
+
afterEach(cleanup)
|
|
20
|
+
|
|
21
|
+
describe('Test -- List component', () => {
|
|
22
|
+
it('renders a List', () => {
|
|
23
|
+
render(
|
|
24
|
+
<List data-testid="ListTest">
|
|
25
|
+
<ListItem>
|
|
26
|
+
<ListItemText primary="One" />
|
|
27
|
+
</ListItem>
|
|
28
|
+
</List>
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
expect(screen.getByTestId('ListTest')).toMatchInlineSnapshot(`
|
|
32
|
+
<ul
|
|
33
|
+
class="MuiList-root MuiList-padding css-h4y409-MuiList-root"
|
|
34
|
+
data-testid="ListTest"
|
|
35
|
+
>
|
|
36
|
+
<li
|
|
37
|
+
class="MuiListItem-root MuiListItem-gutters MuiListItem-padding css-1p823my-MuiListItem-root"
|
|
38
|
+
>
|
|
39
|
+
<div
|
|
40
|
+
class="MuiListItemText-root css-tlelie-MuiListItemText-root"
|
|
41
|
+
>
|
|
42
|
+
<span
|
|
43
|
+
class="MuiTypography-root MuiTypography-body1 MuiListItemText-primary css-10hburv-MuiTypography-root"
|
|
44
|
+
>
|
|
45
|
+
One
|
|
46
|
+
</span>
|
|
47
|
+
</div>
|
|
48
|
+
</li>
|
|
49
|
+
</ul>
|
|
50
|
+
`)
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
it('renders the proper DOM elements', () => {
|
|
54
|
+
const { rerender } = render(
|
|
55
|
+
<List data-testid="ListTest" component="ol">
|
|
56
|
+
<ListItem>
|
|
57
|
+
<ListItemText primary="One" />
|
|
58
|
+
</ListItem>
|
|
59
|
+
</List>
|
|
60
|
+
)
|
|
61
|
+
expect(screen.getByTestId('ListTest')).toMatchInlineSnapshot(`
|
|
62
|
+
<ol
|
|
63
|
+
class="MuiList-root MuiList-padding css-h4y409-MuiList-root"
|
|
64
|
+
data-testid="ListTest"
|
|
65
|
+
>
|
|
66
|
+
<li
|
|
67
|
+
class="MuiListItem-root MuiListItem-gutters MuiListItem-padding css-1p823my-MuiListItem-root"
|
|
68
|
+
>
|
|
69
|
+
<div
|
|
70
|
+
class="MuiListItemText-root css-tlelie-MuiListItemText-root"
|
|
71
|
+
>
|
|
72
|
+
<span
|
|
73
|
+
class="MuiTypography-root MuiTypography-body1 MuiListItemText-primary css-10hburv-MuiTypography-root"
|
|
74
|
+
>
|
|
75
|
+
One
|
|
76
|
+
</span>
|
|
77
|
+
</div>
|
|
78
|
+
</li>
|
|
79
|
+
</ol>
|
|
80
|
+
`)
|
|
81
|
+
|
|
82
|
+
rerender(
|
|
83
|
+
<List data-testid="ListTest" component="nav">
|
|
84
|
+
<ListItemButton>
|
|
85
|
+
<ListItemText primary="One" />
|
|
86
|
+
</ListItemButton>
|
|
87
|
+
</List>
|
|
88
|
+
)
|
|
89
|
+
expect(screen.getByTestId('ListTest')).toMatchInlineSnapshot(`
|
|
90
|
+
<nav
|
|
91
|
+
class="MuiList-root MuiList-padding css-h4y409-MuiList-root"
|
|
92
|
+
data-testid="ListTest"
|
|
93
|
+
>
|
|
94
|
+
<div
|
|
95
|
+
class="MuiButtonBase-root MuiListItemButton-root MuiListItemButton-gutters css-16ac5r2-MuiButtonBase-root-MuiListItemButton-root"
|
|
96
|
+
role="button"
|
|
97
|
+
tabindex="0"
|
|
98
|
+
>
|
|
99
|
+
<div
|
|
100
|
+
class="MuiListItemText-root css-tlelie-MuiListItemText-root"
|
|
101
|
+
>
|
|
102
|
+
<span
|
|
103
|
+
class="MuiTypography-root MuiTypography-body1 MuiListItemText-primary css-10hburv-MuiTypography-root"
|
|
104
|
+
>
|
|
105
|
+
One
|
|
106
|
+
</span>
|
|
107
|
+
</div>
|
|
108
|
+
<span
|
|
109
|
+
class="MuiTouchRipple-root css-8je8zh-MuiTouchRipple-root"
|
|
110
|
+
/>
|
|
111
|
+
</div>
|
|
112
|
+
</nav>
|
|
113
|
+
`)
|
|
114
|
+
})
|
|
115
|
+
|
|
116
|
+
it('renders a selected element', () => {
|
|
117
|
+
render(
|
|
118
|
+
<List data-testid="ListTest">
|
|
119
|
+
<ListItemButton selected={true}>
|
|
120
|
+
<ListItemText primary="One" />
|
|
121
|
+
</ListItemButton>
|
|
122
|
+
</List>
|
|
123
|
+
)
|
|
124
|
+
expect(screen.getByRole('button')).toHaveClass('Mui-selected')
|
|
125
|
+
})
|
|
126
|
+
|
|
127
|
+
it('responds to a click event', () => {
|
|
128
|
+
const mockCallBack = jest.fn()
|
|
129
|
+
render(
|
|
130
|
+
<List data-testid="ListTest">
|
|
131
|
+
<ListItemButton onClick={mockCallBack}>
|
|
132
|
+
<ListItemText primary="One" />
|
|
133
|
+
</ListItemButton>
|
|
134
|
+
</List>
|
|
135
|
+
)
|
|
136
|
+
|
|
137
|
+
userEvent.click(screen.getByRole('button'))
|
|
138
|
+
expect(mockCallBack.mock.calls.length).toEqual(1)
|
|
139
|
+
})
|
|
140
|
+
|
|
141
|
+
it('renders a list item icon', () => {
|
|
142
|
+
render(
|
|
143
|
+
<List data-testid="ListTest">
|
|
144
|
+
<ListItemButton>
|
|
145
|
+
<ListItemIcon>
|
|
146
|
+
<FaceIcon />
|
|
147
|
+
</ListItemIcon>
|
|
148
|
+
</ListItemButton>
|
|
149
|
+
</List>
|
|
150
|
+
)
|
|
151
|
+
|
|
152
|
+
expect(screen.getByTestId('FaceIcon')).toBeInTheDocument()
|
|
153
|
+
})
|
|
154
|
+
|
|
155
|
+
it('renders a list item button', () => {
|
|
156
|
+
render(
|
|
157
|
+
<List data-testid="ListTest">
|
|
158
|
+
<ListItemButton>
|
|
159
|
+
<ListItemIcon>
|
|
160
|
+
<FaceIcon />
|
|
161
|
+
</ListItemIcon>
|
|
162
|
+
</ListItemButton>
|
|
163
|
+
</List>
|
|
164
|
+
)
|
|
165
|
+
|
|
166
|
+
expect(screen.getByRole('button')).toBeInTheDocument()
|
|
167
|
+
})
|
|
168
|
+
})
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { cleanup, render, screen } from '@testing-library/react'
|
|
3
|
+
import userEvent from '@testing-library/user-event'
|
|
4
|
+
import Tooltip from './Tooltip'
|
|
5
|
+
import Button from '../../../../lib/components/atoms/Button/Button'
|
|
6
|
+
|
|
7
|
+
// Note: running cleanup afterEach is done automatically for you in @testing-library/react@9.0.0 or higher
|
|
8
|
+
// unmount and cleanup DOM after the test is finished.
|
|
9
|
+
afterEach(cleanup)
|
|
10
|
+
|
|
11
|
+
describe('Test -- Tooltip component', () => {
|
|
12
|
+
it('properly renders the Tooltip', async () => {
|
|
13
|
+
render(
|
|
14
|
+
<Tooltip title="Tooltip title test" data-testid="TooltipTest">
|
|
15
|
+
<Button>Tooltip</Button>
|
|
16
|
+
</Tooltip>
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
// Confirm that the tooltip is not visible
|
|
20
|
+
expect(screen.queryByText('Tooltip title test')).not.toBeInTheDocument()
|
|
21
|
+
|
|
22
|
+
// Hover over the button
|
|
23
|
+
userEvent.hover(screen.getByTestId('TooltipTest'))
|
|
24
|
+
|
|
25
|
+
// Wait for the tooltip to appear and confirm that it is visible
|
|
26
|
+
expect(await screen.findByText('Tooltip title test')).toBeInTheDocument()
|
|
27
|
+
|
|
28
|
+
// Unhover over the button
|
|
29
|
+
userEvent.unhover(screen.getByTestId('TooltipTest'))
|
|
30
|
+
|
|
31
|
+
// Then wait 1 second for the tooltip to disappear and confirm that it is not visible
|
|
32
|
+
// @TODO: Revisit with act(() => {})
|
|
33
|
+
// await new Promise(function (resolve) { setTimeout(resolve, 1000) })
|
|
34
|
+
// expect(screen.queryByText('Tooltip title test')).not.toBeInTheDocument()
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
it('renders a Tooltip on a disabled element', async () => {
|
|
38
|
+
render(
|
|
39
|
+
<Tooltip title="Tooltip title test" data-testid="TooltipTest">
|
|
40
|
+
<span>
|
|
41
|
+
<Button disabled>Disabled Button</Button>
|
|
42
|
+
</span>
|
|
43
|
+
</Tooltip>
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
// Hover over the button
|
|
47
|
+
userEvent.hover(screen.getByTestId('TooltipTest'))
|
|
48
|
+
|
|
49
|
+
// Wait for the tooltip to appear
|
|
50
|
+
expect(await screen.findByText('Tooltip title test')).toBeInTheDocument()
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
it('has the proper role attribute', () => {
|
|
54
|
+
render(
|
|
55
|
+
<Tooltip open={true} title="Tooltip title test">
|
|
56
|
+
<Button>Button</Button>
|
|
57
|
+
</Tooltip>
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
expect(screen.getByRole('tooltip')).toHaveAttribute('role', 'tooltip')
|
|
61
|
+
})
|
|
62
|
+
|
|
63
|
+
it('renders the arrow element', () => {
|
|
64
|
+
render(
|
|
65
|
+
<Tooltip arrow open={true} title="Tooltip title test">
|
|
66
|
+
<Button>Button</Button>
|
|
67
|
+
</Tooltip>
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
// Look for the arrow <span> element inside the tooltip
|
|
71
|
+
expect(screen.getByRole('tooltip')).toContainHTML('<span class="MuiTooltip-arrow')
|
|
72
|
+
})
|
|
73
|
+
|
|
74
|
+
it('properly renders a followCursor Tooltip', async () => {
|
|
75
|
+
render(
|
|
76
|
+
<Tooltip followCursor title="Tooltip title test" data-testid="TooltipTest">
|
|
77
|
+
<Button>Tooltip</Button>
|
|
78
|
+
</Tooltip>
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
// Confirm that the tooltip is not visible
|
|
82
|
+
expect(screen.queryByText('Tooltip title test')).not.toBeInTheDocument()
|
|
83
|
+
|
|
84
|
+
// Hover over the button
|
|
85
|
+
userEvent.hover(screen.getByTestId('TooltipTest'))
|
|
86
|
+
|
|
87
|
+
// Wait for the tooltip to appear and confirm that it is visible
|
|
88
|
+
expect(await screen.findByText('Tooltip title test')).toBeInTheDocument()
|
|
89
|
+
|
|
90
|
+
// Unhover over the button
|
|
91
|
+
userEvent.unhover(screen.getByTestId('TooltipTest'))
|
|
92
|
+
|
|
93
|
+
// Then wait 1 second for the tooltip to disappear and confirm that it is not visible
|
|
94
|
+
// @TODO: Revisit with act(() => {})
|
|
95
|
+
// await new Promise(function (resolve) { setTimeout(resolve, 1000) })
|
|
96
|
+
// expect(screen.queryByText('Tooltip title test')).not.toBeInTheDocument()
|
|
97
|
+
})
|
|
98
|
+
})
|