@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,179 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { cleanup, render, screen } from '@testing-library/react'
|
|
3
|
+
import userEvent from '@testing-library/user-event'
|
|
4
|
+
import Autocomplete from './Autocomplete'
|
|
5
|
+
import TextField from '../TextField/TextField'
|
|
6
|
+
|
|
7
|
+
const testData = ['One', 'Two', 'Three']
|
|
8
|
+
|
|
9
|
+
// Note: running cleanup afterEach is done automatically for you in @testing-library/react@9.0.0 or higher
|
|
10
|
+
// unmount and cleanup DOM after the test is finished.
|
|
11
|
+
afterEach(cleanup)
|
|
12
|
+
|
|
13
|
+
describe('Test -- Autocomplete component', () => {
|
|
14
|
+
it('renders a Autocomplete', () => {
|
|
15
|
+
render(
|
|
16
|
+
<Autocomplete
|
|
17
|
+
renderInput={(params) => <TextField {...params} label="Label" />}
|
|
18
|
+
id="combo-box-demo"
|
|
19
|
+
options={testData}
|
|
20
|
+
sx={{ width: 300 }}
|
|
21
|
+
/>
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
expect(screen.getByRole('combobox')).toMatchInlineSnapshot(`
|
|
25
|
+
<input
|
|
26
|
+
aria-autocomplete="list"
|
|
27
|
+
aria-expanded="false"
|
|
28
|
+
aria-invalid="false"
|
|
29
|
+
autocapitalize="none"
|
|
30
|
+
autocomplete="off"
|
|
31
|
+
class="MuiInputBase-input MuiOutlinedInput-input MuiInputBase-inputAdornedEnd MuiAutocomplete-input MuiAutocomplete-inputFocused css-nxo287-MuiInputBase-input-MuiOutlinedInput-input"
|
|
32
|
+
id="combo-box-demo"
|
|
33
|
+
role="combobox"
|
|
34
|
+
spellcheck="false"
|
|
35
|
+
type="text"
|
|
36
|
+
value=""
|
|
37
|
+
/>
|
|
38
|
+
`)
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
it('responds to a click event', () => {
|
|
42
|
+
const mockCallBack = jest.fn()
|
|
43
|
+
render(
|
|
44
|
+
<Autocomplete
|
|
45
|
+
renderInput={(params) => (
|
|
46
|
+
<TextField {...params} label="Label" onClick={mockCallBack} />
|
|
47
|
+
)}
|
|
48
|
+
id="combo-box-demo"
|
|
49
|
+
options={testData}
|
|
50
|
+
sx={{ width: 300 }}
|
|
51
|
+
/>
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
userEvent.click(screen.getByLabelText('Label'))
|
|
55
|
+
expect(mockCallBack.mock.calls.length).toEqual(1)
|
|
56
|
+
})
|
|
57
|
+
|
|
58
|
+
it('properly renders the options on click', () => {
|
|
59
|
+
render(
|
|
60
|
+
<Autocomplete
|
|
61
|
+
renderInput={(params) => <TextField {...params} label="Label" />}
|
|
62
|
+
id="combo-box-demo"
|
|
63
|
+
options={testData}
|
|
64
|
+
sx={{ width: 300 }}
|
|
65
|
+
/>
|
|
66
|
+
)
|
|
67
|
+
|
|
68
|
+
// Check that the options are not rendered
|
|
69
|
+
expect(screen.queryByText('One')).toBeNull()
|
|
70
|
+
|
|
71
|
+
// Click on the input and check that the options are rendered
|
|
72
|
+
userEvent.click(screen.getByLabelText('Label'))
|
|
73
|
+
expect(screen.getByText('One')).toBeInTheDocument()
|
|
74
|
+
})
|
|
75
|
+
|
|
76
|
+
it('properly renders the options on focus', () => {
|
|
77
|
+
render(
|
|
78
|
+
<Autocomplete
|
|
79
|
+
openOnFocus
|
|
80
|
+
renderInput={(params) => <TextField {...params} label="Label" />}
|
|
81
|
+
id="combo-box-demo"
|
|
82
|
+
options={testData}
|
|
83
|
+
sx={{ width: 300 }}
|
|
84
|
+
/>
|
|
85
|
+
)
|
|
86
|
+
|
|
87
|
+
// Check that the options are not rendered
|
|
88
|
+
expect(screen.queryByText('One')).toBeNull()
|
|
89
|
+
|
|
90
|
+
// Tab to set focus and check that the options are rendered
|
|
91
|
+
userEvent.tab()
|
|
92
|
+
expect(screen.getByText('One')).toBeInTheDocument()
|
|
93
|
+
})
|
|
94
|
+
|
|
95
|
+
it('displays a default value', () => {
|
|
96
|
+
render(
|
|
97
|
+
<Autocomplete
|
|
98
|
+
defaultValue={['test']}
|
|
99
|
+
// Prevents the console.warn
|
|
100
|
+
// https://stackoverflow.com/questions/61947941/material-ui-autocomplete-warning-the-value-provided-to-autocomplete-is-invalid#answer-65347275
|
|
101
|
+
isOptionEqualToValue={(option, value) => option.id === value.id}
|
|
102
|
+
getOptionLabel={() => 'test'}
|
|
103
|
+
renderInput={(params) => <TextField {...params} label="Label" />}
|
|
104
|
+
id="combo-box-demo"
|
|
105
|
+
options={['test']}
|
|
106
|
+
sx={{ width: 300 }}
|
|
107
|
+
/>
|
|
108
|
+
)
|
|
109
|
+
|
|
110
|
+
expect(screen.getByLabelText('Label')).toHaveValue('test')
|
|
111
|
+
expect(screen.getByLabelText('Label')).toBeVisible()
|
|
112
|
+
})
|
|
113
|
+
|
|
114
|
+
it('displays the label text', () => {
|
|
115
|
+
render(
|
|
116
|
+
<Autocomplete
|
|
117
|
+
getOptionLabel={(option) => option}
|
|
118
|
+
renderInput={(params) => <TextField {...params} label="Label" />}
|
|
119
|
+
id="combo-box-demo"
|
|
120
|
+
options={testData}
|
|
121
|
+
sx={{ width: 300 }}
|
|
122
|
+
/>
|
|
123
|
+
)
|
|
124
|
+
|
|
125
|
+
expect(screen.getByLabelText('Label')).toBeVisible()
|
|
126
|
+
})
|
|
127
|
+
|
|
128
|
+
it.skip('has the proper attributes', () => {
|
|
129
|
+
// Need to revisit this as the selection for the input
|
|
130
|
+
// is not correct - role and aria-expanded are checking
|
|
131
|
+
// an incorrect element
|
|
132
|
+
render(
|
|
133
|
+
<Autocomplete
|
|
134
|
+
data-testid="AutocompleteTest"
|
|
135
|
+
renderInput={(params) => <TextField {...params} label="Label" />}
|
|
136
|
+
id="combo-box-demo"
|
|
137
|
+
options={testData}
|
|
138
|
+
sx={{ width: 300 }}
|
|
139
|
+
/>
|
|
140
|
+
)
|
|
141
|
+
|
|
142
|
+
// Check the default container attributes
|
|
143
|
+
expect(screen.getByTestId('AutocompleteTest')).toHaveAttribute(
|
|
144
|
+
'role',
|
|
145
|
+
'combobox'
|
|
146
|
+
)
|
|
147
|
+
expect(screen.getByTestId('AutocompleteTest')).toHaveAttribute(
|
|
148
|
+
'aria-expanded',
|
|
149
|
+
'false'
|
|
150
|
+
)
|
|
151
|
+
|
|
152
|
+
// Check the default input attributes
|
|
153
|
+
expect(screen.getByLabelText('Label')).toHaveAttribute(
|
|
154
|
+
'aria-invalid',
|
|
155
|
+
'false'
|
|
156
|
+
)
|
|
157
|
+
expect(screen.getByLabelText('Label')).toHaveAttribute(
|
|
158
|
+
'aria-autocomplete',
|
|
159
|
+
'list'
|
|
160
|
+
)
|
|
161
|
+
expect(screen.getByLabelText('Label')).toHaveAttribute(
|
|
162
|
+
'autocomplete',
|
|
163
|
+
'off'
|
|
164
|
+
)
|
|
165
|
+
|
|
166
|
+
// Click the input
|
|
167
|
+
userEvent.click(screen.getByLabelText('Label'))
|
|
168
|
+
|
|
169
|
+
// Check the expanded container attributes
|
|
170
|
+
expect(screen.getByTestId('AutocompleteTest')).toHaveAttribute(
|
|
171
|
+
'aria-expanded',
|
|
172
|
+
'true'
|
|
173
|
+
)
|
|
174
|
+
expect(screen.getByTestId('AutocompleteTest')).toHaveAttribute(
|
|
175
|
+
'aria-owns',
|
|
176
|
+
'combo-box-demo-listbox'
|
|
177
|
+
)
|
|
178
|
+
})
|
|
179
|
+
})
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import MUIAutocomplete, { AutocompleteProps } from '@mui/material/Autocomplete'
|
|
3
|
+
|
|
4
|
+
interface IAutocompleteProps extends AutocompleteProps<any, true, true, true, 'div'> {}
|
|
5
|
+
|
|
6
|
+
const Autocomplete = (
|
|
7
|
+
props: IAutocompleteProps
|
|
8
|
+
): JSX.Element => {
|
|
9
|
+
return (
|
|
10
|
+
<MUIAutocomplete {...props} />
|
|
11
|
+
)
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export default Autocomplete
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { cleanup, render, screen } from '@testing-library/react'
|
|
3
|
+
import userEvent from '@testing-library/user-event'
|
|
4
|
+
import Button from './Button'
|
|
5
|
+
// import AllCombinations from "./AllCombinations";
|
|
6
|
+
import DeleteIcon from '@mui/icons-material/Delete'
|
|
7
|
+
|
|
8
|
+
/*
|
|
9
|
+
|
|
10
|
+
1. Displays a label
|
|
11
|
+
2. Conforms to accessibility
|
|
12
|
+
3. (multiple tests) renders differently based on props
|
|
13
|
+
a. Renders button with startIcon
|
|
14
|
+
b. Renders button with endIcon
|
|
15
|
+
4. Calls a function onClick
|
|
16
|
+
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
// Note: running cleanup afterEach is done automatically for you in @testing-library/react@9.0.0 or higher
|
|
20
|
+
// unmount and cleanup DOM after the test is finished.
|
|
21
|
+
afterEach(cleanup)
|
|
22
|
+
|
|
23
|
+
describe('Test -- Button component', () => {
|
|
24
|
+
it('renders button text', () => {
|
|
25
|
+
render(<Button>Button</Button>)
|
|
26
|
+
|
|
27
|
+
expect(screen.getByText(/Button/i)).toMatchInlineSnapshot(`
|
|
28
|
+
<button
|
|
29
|
+
class="MuiButtonBase-root MuiButton-root MuiButton-contained MuiButton-containedPrimary MuiButton-sizeMedium MuiButton-containedSizeMedium MuiButton-disableElevation css-zddlty-MuiButtonBase-root-MuiButton-root"
|
|
30
|
+
tabindex="0"
|
|
31
|
+
type="button"
|
|
32
|
+
>
|
|
33
|
+
Button
|
|
34
|
+
<span
|
|
35
|
+
class="MuiTouchRipple-root css-8je8zh-MuiTouchRipple-root"
|
|
36
|
+
/>
|
|
37
|
+
</button>
|
|
38
|
+
`)
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
it('renders button with startIcon', () => {
|
|
42
|
+
render(
|
|
43
|
+
<Button data-testid="Button" startIcon={<DeleteIcon />}>
|
|
44
|
+
Button
|
|
45
|
+
</Button>
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
expect(screen.getByTestId('Button')).toMatchInlineSnapshot(`
|
|
49
|
+
<button
|
|
50
|
+
class="MuiButtonBase-root MuiButton-root MuiButton-contained MuiButton-containedPrimary MuiButton-sizeMedium MuiButton-containedSizeMedium MuiButton-disableElevation css-zddlty-MuiButtonBase-root-MuiButton-root"
|
|
51
|
+
data-testid="Button"
|
|
52
|
+
tabindex="0"
|
|
53
|
+
type="button"
|
|
54
|
+
>
|
|
55
|
+
<span
|
|
56
|
+
class="MuiButton-startIcon MuiButton-iconSizeMedium css-1d6wzja-MuiButton-startIcon"
|
|
57
|
+
>
|
|
58
|
+
<svg
|
|
59
|
+
aria-hidden="true"
|
|
60
|
+
class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium css-i4bv87-MuiSvgIcon-root"
|
|
61
|
+
data-testid="DeleteIcon"
|
|
62
|
+
focusable="false"
|
|
63
|
+
viewBox="0 0 24 24"
|
|
64
|
+
>
|
|
65
|
+
<path
|
|
66
|
+
d="M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z"
|
|
67
|
+
/>
|
|
68
|
+
</svg>
|
|
69
|
+
</span>
|
|
70
|
+
Button
|
|
71
|
+
<span
|
|
72
|
+
class="MuiTouchRipple-root css-8je8zh-MuiTouchRipple-root"
|
|
73
|
+
/>
|
|
74
|
+
</button>
|
|
75
|
+
`)
|
|
76
|
+
})
|
|
77
|
+
|
|
78
|
+
it('responds to a click event', () => {
|
|
79
|
+
const mockCallBack = jest.fn()
|
|
80
|
+
render(
|
|
81
|
+
<Button data-testid="Button" onClick={mockCallBack}>
|
|
82
|
+
Ok!
|
|
83
|
+
</Button>
|
|
84
|
+
)
|
|
85
|
+
|
|
86
|
+
userEvent.click(screen.getByTestId('Button'))
|
|
87
|
+
|
|
88
|
+
expect(mockCallBack.mock.calls.length).toEqual(1)
|
|
89
|
+
})
|
|
90
|
+
|
|
91
|
+
it('has the proper aria attributes', () => {
|
|
92
|
+
const { rerender } = render(<Button>Hello</Button>)
|
|
93
|
+
|
|
94
|
+
// button has role="button"
|
|
95
|
+
let button = screen.getByRole('button')
|
|
96
|
+
expect(button).not.toHaveAttribute('aria-disabled')
|
|
97
|
+
|
|
98
|
+
// isLoading sets aria-disabled="true"
|
|
99
|
+
// rerender(<Button isLoading>Hello</Button>)
|
|
100
|
+
// button = screen.getByRole("button")
|
|
101
|
+
// expect(button).toHaveAttribute("data-loading", "")
|
|
102
|
+
|
|
103
|
+
// isDisabled sets aria-disabled="true"
|
|
104
|
+
rerender(<Button disabled>Hello</Button>)
|
|
105
|
+
button = screen.getByRole('button')
|
|
106
|
+
expect(button).toHaveAttribute('disabled', '')
|
|
107
|
+
})
|
|
108
|
+
|
|
109
|
+
it('has the proper type attribute', () => {
|
|
110
|
+
const { rerender } = render(<Button data-testid="btn">Email</Button>)
|
|
111
|
+
expect(screen.getByTestId('btn')).toHaveAttribute('type', 'button')
|
|
112
|
+
|
|
113
|
+
rerender(
|
|
114
|
+
<Button data-testid="btn" type="submit">
|
|
115
|
+
Email
|
|
116
|
+
</Button>
|
|
117
|
+
)
|
|
118
|
+
expect(screen.getByTestId('btn')).toHaveAttribute('type', 'submit')
|
|
119
|
+
|
|
120
|
+
rerender(
|
|
121
|
+
<Button data-testid="btn" component="button">
|
|
122
|
+
Email
|
|
123
|
+
</Button>
|
|
124
|
+
)
|
|
125
|
+
expect(screen.getByTestId('btn')).toMatchInlineSnapshot(`
|
|
126
|
+
<button
|
|
127
|
+
class="MuiButtonBase-root MuiButton-root MuiButton-contained MuiButton-containedPrimary MuiButton-sizeMedium MuiButton-containedSizeMedium MuiButton-disableElevation css-zddlty-MuiButtonBase-root-MuiButton-root"
|
|
128
|
+
data-testid="btn"
|
|
129
|
+
tabindex="0"
|
|
130
|
+
type="button"
|
|
131
|
+
>
|
|
132
|
+
Email
|
|
133
|
+
<span
|
|
134
|
+
class="MuiTouchRipple-root css-8je8zh-MuiTouchRipple-root"
|
|
135
|
+
/>
|
|
136
|
+
</button>
|
|
137
|
+
`)
|
|
138
|
+
expect(screen.getByTestId('btn')).toHaveAttribute('type')
|
|
139
|
+
|
|
140
|
+
rerender(
|
|
141
|
+
<Button data-testid="btn" component="span">
|
|
142
|
+
Email
|
|
143
|
+
</Button>
|
|
144
|
+
)
|
|
145
|
+
expect(screen.getByTestId('btn')).not.toHaveAttribute('type')
|
|
146
|
+
})
|
|
147
|
+
|
|
148
|
+
it('should be disabled', () => {
|
|
149
|
+
render(
|
|
150
|
+
<Button disabled data-testid="btn">
|
|
151
|
+
I'm a invalid button
|
|
152
|
+
</Button>
|
|
153
|
+
)
|
|
154
|
+
const button = screen.getByRole('button')
|
|
155
|
+
expect(button).toBeDisabled()
|
|
156
|
+
})
|
|
157
|
+
|
|
158
|
+
it('should take up full width', () => {
|
|
159
|
+
render(
|
|
160
|
+
<Button fullWidth data-testid="btn">
|
|
161
|
+
i'm a big button
|
|
162
|
+
</Button>
|
|
163
|
+
)
|
|
164
|
+
expect(screen.getByRole('button')).toHaveStyle('width: 100%')
|
|
165
|
+
})
|
|
166
|
+
})
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import MUIButton, { ButtonProps } from '@mui/material/Button'
|
|
3
|
+
|
|
4
|
+
const Button = React.forwardRef((
|
|
5
|
+
props: ButtonProps,
|
|
6
|
+
ref: React.Ref<HTMLButtonElement>
|
|
7
|
+
): JSX.Element => (
|
|
8
|
+
<MUIButton
|
|
9
|
+
disableElevation
|
|
10
|
+
variant='contained'
|
|
11
|
+
{...props}
|
|
12
|
+
ref={ref}
|
|
13
|
+
/>
|
|
14
|
+
))
|
|
15
|
+
|
|
16
|
+
export default Button
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { cleanup, render, screen } from '@testing-library/react'
|
|
3
|
+
import '@testing-library/jest-dom'
|
|
4
|
+
import userEvent from '@testing-library/user-event'
|
|
5
|
+
import Checkbox from './Checkbox'
|
|
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 -- Checkbox component', () => {
|
|
12
|
+
it('renders checkbox', () => {
|
|
13
|
+
render(<Checkbox />)
|
|
14
|
+
|
|
15
|
+
const buttonIcon = screen.getByTestId('CheckBoxOutlineBlankIcon')
|
|
16
|
+
|
|
17
|
+
expect(buttonIcon).toMatchInlineSnapshot(`
|
|
18
|
+
<svg
|
|
19
|
+
aria-hidden="true"
|
|
20
|
+
class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium css-i4bv87-MuiSvgIcon-root"
|
|
21
|
+
data-testid="CheckBoxOutlineBlankIcon"
|
|
22
|
+
focusable="false"
|
|
23
|
+
viewBox="0 0 24 24"
|
|
24
|
+
>
|
|
25
|
+
<path
|
|
26
|
+
d="M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z"
|
|
27
|
+
/>
|
|
28
|
+
</svg>
|
|
29
|
+
`)
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
it('responds to a click event', () => {
|
|
33
|
+
const mockCallBack = jest.fn()
|
|
34
|
+
render(<Checkbox onClick={mockCallBack} data-testid="checkboxTest" />)
|
|
35
|
+
|
|
36
|
+
userEvent.click(screen.getByTestId('checkboxTest'))
|
|
37
|
+
expect(mockCallBack.mock.calls.length).toEqual(1)
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
it('changes checked state on click', () => {
|
|
41
|
+
render(<Checkbox />)
|
|
42
|
+
const checkboxTest = screen.getByRole('checkbox')
|
|
43
|
+
|
|
44
|
+
// Check initial state
|
|
45
|
+
expect(checkboxTest).not.toBeChecked()
|
|
46
|
+
|
|
47
|
+
// Check state after click
|
|
48
|
+
userEvent.click(checkboxTest)
|
|
49
|
+
expect(checkboxTest).toBeChecked()
|
|
50
|
+
})
|
|
51
|
+
|
|
52
|
+
it('should be disabled', () => {
|
|
53
|
+
render(<Checkbox disabled />)
|
|
54
|
+
|
|
55
|
+
const checkboxTest = screen.getByRole('checkbox')
|
|
56
|
+
expect(checkboxTest).toBeDisabled()
|
|
57
|
+
})
|
|
58
|
+
|
|
59
|
+
it('has the proper aria attributes', () => {
|
|
60
|
+
const { rerender } = render(
|
|
61
|
+
<Checkbox inputProps={{ 'aria-label': 'test label' }} />
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
// Default Checkbox has proper aria attributes
|
|
65
|
+
const checkboxInput = screen.getByRole('checkbox')
|
|
66
|
+
expect(checkboxInput).toHaveAttribute('aria-label', 'test label')
|
|
67
|
+
expect(checkboxInput).not.toHaveAttribute('aria-disabled')
|
|
68
|
+
|
|
69
|
+
// Disabled Checkbox has proper aria attribute
|
|
70
|
+
rerender(<Checkbox data-testid="checkboxTest" disabled />)
|
|
71
|
+
const checkboxSpan = screen.getByTestId('checkboxTest')
|
|
72
|
+
expect(checkboxSpan).toHaveAttribute('aria-disabled')
|
|
73
|
+
})
|
|
74
|
+
|
|
75
|
+
it('has the proper type attribute', () => {
|
|
76
|
+
render(<Checkbox />)
|
|
77
|
+
expect(screen.getByRole('checkbox')).toHaveAttribute('type', 'checkbox')
|
|
78
|
+
})
|
|
79
|
+
|
|
80
|
+
it('changes color', () => {
|
|
81
|
+
// Color prop changes css class
|
|
82
|
+
render(<Checkbox data-testid="checkboxTest" color="success" />)
|
|
83
|
+
expect(screen.getByTestId('checkboxTest')).toHaveClass('MuiCheckbox-colorSuccess')
|
|
84
|
+
})
|
|
85
|
+
})
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import MUICheckbox, { CheckboxProps } from '@mui/material/Checkbox'
|
|
3
|
+
|
|
4
|
+
interface ICheckboxProps extends CheckboxProps {}
|
|
5
|
+
|
|
6
|
+
export default function Checkbox ({ ...rest }: ICheckboxProps): JSX.Element {
|
|
7
|
+
return (
|
|
8
|
+
<MUICheckbox {...rest} />
|
|
9
|
+
)
|
|
10
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { cleanup, render, screen } from '@testing-library/react'
|
|
3
|
+
import '@testing-library/jest-dom'
|
|
4
|
+
import userEvent from '@testing-library/user-event'
|
|
5
|
+
import IconButton from './IconButton'
|
|
6
|
+
import DeleteIcon from '@mui/icons-material/Delete'
|
|
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 -- Icon Button component', () => {
|
|
13
|
+
it('renders button icon', () => {
|
|
14
|
+
render(
|
|
15
|
+
<IconButton>
|
|
16
|
+
<DeleteIcon />
|
|
17
|
+
</IconButton>
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
const buttonIcon = screen.getByTestId('DeleteIcon')
|
|
21
|
+
|
|
22
|
+
expect(buttonIcon).toMatchInlineSnapshot(`
|
|
23
|
+
<svg
|
|
24
|
+
aria-hidden="true"
|
|
25
|
+
class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium css-i4bv87-MuiSvgIcon-root"
|
|
26
|
+
data-testid="DeleteIcon"
|
|
27
|
+
focusable="false"
|
|
28
|
+
viewBox="0 0 24 24"
|
|
29
|
+
>
|
|
30
|
+
<path
|
|
31
|
+
d="M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z"
|
|
32
|
+
/>
|
|
33
|
+
</svg>
|
|
34
|
+
`)
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
it('responds to a click event', () => {
|
|
38
|
+
const mockCallBack = jest.fn()
|
|
39
|
+
render(
|
|
40
|
+
<IconButton onClick={mockCallBack}>
|
|
41
|
+
<DeleteIcon />
|
|
42
|
+
</IconButton>
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
userEvent.click(screen.getByTestId('DeleteIcon'))
|
|
46
|
+
|
|
47
|
+
expect(mockCallBack.mock.calls.length).toEqual(1)
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
it('has the proper aria attribute', () => {
|
|
51
|
+
render(
|
|
52
|
+
<IconButton aria-label="delete" data-testid="IconButtonTest">
|
|
53
|
+
<DeleteIcon />
|
|
54
|
+
</IconButton>
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
const checkboxInput = screen.getByTestId('IconButtonTest')
|
|
58
|
+
expect(checkboxInput).toHaveAttribute('aria-label', 'delete')
|
|
59
|
+
})
|
|
60
|
+
})
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import MUIIconButton, { IconButtonProps } from '@mui/material/IconButton'
|
|
3
|
+
|
|
4
|
+
const IconButton = (props: IconButtonProps): JSX.Element => (
|
|
5
|
+
<MUIIconButton {...props} />
|
|
6
|
+
)
|
|
7
|
+
IconButton.muiName = 'MUIIconButton'
|
|
8
|
+
|
|
9
|
+
export default IconButton
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { cleanup, render, screen } from '@testing-library/react'
|
|
3
|
+
import userEvent from '@testing-library/user-event'
|
|
4
|
+
import Radio from './Radio'
|
|
5
|
+
import RadioGroup from '@mui/material/RadioGroup'
|
|
6
|
+
import FormControlLabel from '@mui/material/FormControlLabel'
|
|
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 -- Radio component', () => {
|
|
13
|
+
it('renders a radio button', () => {
|
|
14
|
+
render(
|
|
15
|
+
<Radio
|
|
16
|
+
data-testid="radioTest"
|
|
17
|
+
inputProps={{
|
|
18
|
+
'aria-label': 'label'
|
|
19
|
+
}}
|
|
20
|
+
/>
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
expect(screen.getByTestId('radioTest')).toMatchInlineSnapshot(`
|
|
24
|
+
<span
|
|
25
|
+
class="MuiButtonBase-root MuiRadio-root MuiRadio-colorPrimary PrivateSwitchBase-root MuiRadio-root MuiRadio-colorPrimary css-vqmohf-MuiButtonBase-root-MuiRadio-root"
|
|
26
|
+
data-testid="radioTest"
|
|
27
|
+
>
|
|
28
|
+
<input
|
|
29
|
+
aria-label="label"
|
|
30
|
+
class="PrivateSwitchBase-input css-1m9pwf3"
|
|
31
|
+
type="radio"
|
|
32
|
+
value=""
|
|
33
|
+
/>
|
|
34
|
+
<span
|
|
35
|
+
class="css-hyxlzm"
|
|
36
|
+
>
|
|
37
|
+
<svg
|
|
38
|
+
aria-hidden="true"
|
|
39
|
+
class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium css-1hbvpl3-MuiSvgIcon-root"
|
|
40
|
+
data-testid="RadioButtonUncheckedIcon"
|
|
41
|
+
focusable="false"
|
|
42
|
+
viewBox="0 0 24 24"
|
|
43
|
+
>
|
|
44
|
+
<path
|
|
45
|
+
d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"
|
|
46
|
+
/>
|
|
47
|
+
</svg>
|
|
48
|
+
<svg
|
|
49
|
+
aria-hidden="true"
|
|
50
|
+
class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium css-1hhw7if-MuiSvgIcon-root"
|
|
51
|
+
data-testid="RadioButtonCheckedIcon"
|
|
52
|
+
focusable="false"
|
|
53
|
+
viewBox="0 0 24 24"
|
|
54
|
+
>
|
|
55
|
+
<path
|
|
56
|
+
d="M8.465 8.465C9.37 7.56 10.62 7 12 7C14.76 7 17 9.24 17 12C17 13.38 16.44 14.63 15.535 15.535C14.63 16.44 13.38 17 12 17C9.24 17 7 14.76 7 12C7 10.62 7.56 9.37 8.465 8.465Z"
|
|
57
|
+
/>
|
|
58
|
+
</svg>
|
|
59
|
+
</span>
|
|
60
|
+
<span
|
|
61
|
+
class="MuiTouchRipple-root css-8je8zh-MuiTouchRipple-root"
|
|
62
|
+
/>
|
|
63
|
+
</span>
|
|
64
|
+
`)
|
|
65
|
+
})
|
|
66
|
+
|
|
67
|
+
it('responds to a click event', () => {
|
|
68
|
+
const mockCallBack = jest.fn()
|
|
69
|
+
render(<Radio onClick={mockCallBack} data-testid="radioTest" />)
|
|
70
|
+
|
|
71
|
+
userEvent.click(screen.getByTestId('radioTest'))
|
|
72
|
+
expect(mockCallBack.mock.calls.length).toEqual(1)
|
|
73
|
+
})
|
|
74
|
+
|
|
75
|
+
it('changes checked state on click', () => {
|
|
76
|
+
render(<Radio />)
|
|
77
|
+
const radioTest = screen.getByRole('radio')
|
|
78
|
+
|
|
79
|
+
// Check initial state
|
|
80
|
+
expect(radioTest).not.toBeChecked()
|
|
81
|
+
|
|
82
|
+
// Check state after click
|
|
83
|
+
userEvent.click(radioTest)
|
|
84
|
+
expect(radioTest).toBeChecked()
|
|
85
|
+
})
|
|
86
|
+
|
|
87
|
+
it('should be disabled', () => {
|
|
88
|
+
render(<Radio disabled />)
|
|
89
|
+
|
|
90
|
+
const radioTest = screen.getByRole('radio')
|
|
91
|
+
expect(radioTest).toBeDisabled()
|
|
92
|
+
})
|
|
93
|
+
|
|
94
|
+
it('has the proper attributes', () => {
|
|
95
|
+
const { rerender } = render(
|
|
96
|
+
<Radio inputProps={{ 'aria-label': 'test label' }} />
|
|
97
|
+
)
|
|
98
|
+
|
|
99
|
+
// Default Radio has proper type attribute
|
|
100
|
+
expect(screen.getByRole('radio')).toHaveAttribute('type', 'radio')
|
|
101
|
+
|
|
102
|
+
// Default Radio has proper aria attributes
|
|
103
|
+
const radioInput = screen.getByRole('radio')
|
|
104
|
+
expect(radioInput).toHaveAttribute('aria-label', 'test label')
|
|
105
|
+
expect(radioInput).not.toHaveAttribute('aria-disabled')
|
|
106
|
+
|
|
107
|
+
// Disabled Radio has proper aria attribut
|
|
108
|
+
rerender(<Radio data-testid="radioTest" disabled />)
|
|
109
|
+
const radioSpan = screen.getByTestId('radioTest')
|
|
110
|
+
expect(radioSpan).toHaveAttribute('aria-disabled')
|
|
111
|
+
})
|
|
112
|
+
|
|
113
|
+
it('has a default value', () => {
|
|
114
|
+
render(
|
|
115
|
+
<RadioGroup
|
|
116
|
+
aria-labelledby="demo-radio-buttons-group-label"
|
|
117
|
+
defaultValue="other"
|
|
118
|
+
name="radio-buttons-group"
|
|
119
|
+
>
|
|
120
|
+
<FormControlLabel value="female" control={<Radio />} label="Female" />
|
|
121
|
+
<FormControlLabel
|
|
122
|
+
value="male"
|
|
123
|
+
control={<Radio data-testid="notDefaultValue" />}
|
|
124
|
+
label="Male"
|
|
125
|
+
/>
|
|
126
|
+
<FormControlLabel
|
|
127
|
+
value="other"
|
|
128
|
+
control={<Radio data-testid="defaultValue" />}
|
|
129
|
+
label="Other"
|
|
130
|
+
/>
|
|
131
|
+
</RadioGroup>
|
|
132
|
+
)
|
|
133
|
+
expect(screen.getByLabelText('Other')).toBeChecked()
|
|
134
|
+
expect(screen.getByLabelText('Male')).not.toBeChecked()
|
|
135
|
+
})
|
|
136
|
+
})
|