@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.
Files changed (437) hide show
  1. package/.eslintrc.js +40 -0
  2. package/.github/pull_request_template.md +23 -0
  3. package/.github/renovate.json +57 -0
  4. package/.github/workflows/integration.yml +53 -0
  5. package/.github/workflows/wss.yml +22 -0
  6. package/.jest-test-results.json +1 -0
  7. package/.releaserc +32 -0
  8. package/.storybook/learningpoolTheme.js +39 -0
  9. package/.storybook/main.js +21 -0
  10. package/.storybook/manager-head.html +175 -0
  11. package/.storybook/manager.js +34 -0
  12. package/.storybook/preview-head.html +212 -0
  13. package/.storybook/preview.js +120 -0
  14. package/.storybook/storybook-sort.js +54 -0
  15. package/CHANGELOG.md +6 -0
  16. package/amplify.yml +16 -0
  17. package/babel.config.json +14 -0
  18. package/{assets → dist/assets}/Images.d.ts +0 -0
  19. package/{assets → dist/assets}/Images.js +0 -0
  20. package/{components → dist/components}/atoms/Autocomplete/Autocomplete.d.ts +0 -0
  21. package/{components → dist/components}/atoms/Autocomplete/Autocomplete.js +0 -0
  22. package/{components → dist/components}/atoms/Button/Button.d.ts +0 -0
  23. package/{components → dist/components}/atoms/Button/Button.js +0 -0
  24. package/{components → dist/components}/atoms/Checkbox/Checkbox.d.ts +0 -0
  25. package/{components → dist/components}/atoms/Checkbox/Checkbox.js +0 -0
  26. package/{components → dist/components}/atoms/IconButton/IconButton.d.ts +0 -0
  27. package/{components → dist/components}/atoms/IconButton/IconButton.js +0 -0
  28. package/{components → dist/components}/atoms/Radio/Radio.d.ts +0 -0
  29. package/{components → dist/components}/atoms/Radio/Radio.js +0 -0
  30. package/{components → dist/components}/atoms/Select/Select.d.ts +0 -0
  31. package/{components → dist/components}/atoms/Select/Select.js +0 -0
  32. package/{components → dist/components}/atoms/Slider/Slider.d.ts +0 -0
  33. package/{components → dist/components}/atoms/Slider/Slider.js +0 -0
  34. package/{components → dist/components}/atoms/Switch/Switch.d.ts +0 -0
  35. package/{components → dist/components}/atoms/Switch/Switch.js +0 -0
  36. package/{components → dist/components}/atoms/TextField/TextField.d.ts +0 -0
  37. package/{components → dist/components}/atoms/TextField/TextField.js +0 -0
  38. package/{components → dist/components}/atoms/ToggleButton/ToggleButton.d.ts +0 -0
  39. package/{components → dist/components}/atoms/ToggleButton/ToggleButton.js +0 -0
  40. package/{components → dist/components}/datadisplay/Avatar/Avatar.d.ts +0 -0
  41. package/{components → dist/components}/datadisplay/Avatar/Avatar.js +0 -0
  42. package/{components → dist/components}/datadisplay/Chip/Chip.d.ts +0 -0
  43. package/{components → dist/components}/datadisplay/Chip/Chip.js +0 -0
  44. package/{components → dist/components}/datadisplay/List/List.d.ts +0 -0
  45. package/{components → dist/components}/datadisplay/List/List.js +0 -0
  46. package/{components → dist/components}/datadisplay/Tooltip/Tooltip.d.ts +0 -0
  47. package/{components → dist/components}/datadisplay/Tooltip/Tooltip.js +0 -0
  48. package/{components → dist/components}/feedback/Alert/Alert.d.ts +0 -0
  49. package/{components → dist/components}/feedback/Alert/Alert.js +0 -0
  50. package/{components → dist/components}/landmarks/Header/Header.d.ts +0 -0
  51. package/{components → dist/components}/landmarks/Header/Header.js +0 -0
  52. package/{components → dist/components}/landmarks/Header/HeaderActionButtons.d.ts +0 -0
  53. package/{components → dist/components}/landmarks/Header/HeaderActionButtons.js +0 -0
  54. package/{components → dist/components}/landmarks/Header/HeaderStyles.d.ts +0 -0
  55. package/{components → dist/components}/landmarks/Header/HeaderStyles.js +0 -0
  56. package/{components → dist/components}/navigation/Drawer/Drawer.d.ts +0 -0
  57. package/{components → dist/components}/navigation/Drawer/Drawer.js +0 -0
  58. package/{components → dist/components}/navigation/MobileNavigation/MobileNavigation.d.ts +0 -0
  59. package/{components → dist/components}/navigation/MobileNavigation/MobileNavigation.js +64 -41
  60. package/{components → dist/components}/navigation/MobileNavigation/MobileNavigationAvatar.d.ts +0 -0
  61. package/{components → dist/components}/navigation/MobileNavigation/MobileNavigationAvatar.js +23 -19
  62. package/dist/components/navigation/MobileNavigation/MobileNavigationAvatarStyles.d.ts +3296 -0
  63. package/{components → dist/components}/navigation/MobileNavigation/MobileNavigationAvatarStyles.js +4 -4
  64. package/{components → dist/components}/navigation/MobileNavigation/MobileNavigationDrawer.d.ts +0 -0
  65. package/dist/components/navigation/MobileNavigation/MobileNavigationDrawer.js +71 -0
  66. package/dist/components/navigation/MobileNavigation/MobileNavigationDrawerStyles.d.ts +1215 -0
  67. package/{components → dist/components}/navigation/MobileNavigation/MobileNavigationDrawerStyles.js +2 -2
  68. package/{components → dist/components}/navigation/MobileNavigation/MobileNavigationItem/MobileNavigationItem.d.ts +0 -0
  69. package/{components → dist/components}/navigation/MobileNavigation/MobileNavigationItem/MobileNavigationItem.js +0 -0
  70. package/{components → dist/components}/navigation/MobileNavigation/MobileNavigationItem/MobileNavigationItemFlyoutMenu.d.ts +0 -0
  71. package/{components → dist/components}/navigation/MobileNavigation/MobileNavigationItem/MobileNavigationItemFlyoutMenu.js +0 -0
  72. package/{components → dist/components}/navigation/MobileNavigation/MobileNavigationItem/MobileNavigationItemFlyoutMenuStyles.d.ts +0 -0
  73. package/{components → dist/components}/navigation/MobileNavigation/MobileNavigationItem/MobileNavigationItemFlyoutMenuStyles.js +0 -0
  74. package/{components → dist/components}/navigation/MobileNavigation/MobileNavigationItem/MobileNavigationItemStyles.d.ts +0 -0
  75. package/{components → dist/components}/navigation/MobileNavigation/MobileNavigationItem/MobileNavigationItemStyles.js +0 -0
  76. package/{components → dist/components}/navigation/MobileNavigation/MobileNavigationMotion.d.ts +0 -0
  77. package/{components → dist/components}/navigation/MobileNavigation/MobileNavigationMotion.js +0 -0
  78. package/dist/components/navigation/MobileNavigation/MobileNavigationNotchIndicator.d.ts +3 -0
  79. package/dist/components/navigation/MobileNavigation/MobileNavigationNotchIndicator.js +19 -0
  80. package/{components → dist/components}/navigation/MobileNavigation/MobileNavigationSearch.d.ts +0 -0
  81. package/{components → dist/components}/navigation/MobileNavigation/MobileNavigationSearch.js +8 -6
  82. package/dist/components/navigation/MobileNavigation/MobileNavigationSearchStyles.d.ts +1080 -0
  83. package/{components → dist/components}/navigation/MobileNavigation/MobileNavigationSearchStyles.js +2 -2
  84. package/{components → dist/components}/navigation/MobileNavigation/MobileNavigationStyles.d.ts +0 -0
  85. package/{components → dist/components}/navigation/MobileNavigation/MobileNavigationStyles.js +0 -0
  86. package/dist/components/navigation/MobileNavigation/MobileNavigationToggleSearchX.d.ts +3 -0
  87. package/dist/components/navigation/MobileNavigation/MobileNavigationToggleSearchX.js +28 -0
  88. package/dist/components/navigation/MobileNavigation/MobileNavigationToggleX.d.ts +3 -0
  89. package/dist/components/navigation/MobileNavigation/MobileNavigationToggleX.js +28 -0
  90. package/{components → dist/components}/navigation/VerticalNavigation/VerticalNavigation.d.ts +0 -0
  91. package/{components → dist/components}/navigation/VerticalNavigation/VerticalNavigation.js +18 -16
  92. package/{components → dist/components}/navigation/VerticalNavigation/VerticalNavigationAvatar.d.ts +0 -0
  93. package/{components → dist/components}/navigation/VerticalNavigation/VerticalNavigationAvatar.js +20 -25
  94. package/dist/components/navigation/VerticalNavigation/VerticalNavigationAvatarStyles.d.ts +3296 -0
  95. package/{components → dist/components}/navigation/VerticalNavigation/VerticalNavigationAvatarStyles.js +4 -4
  96. package/{components → dist/components}/navigation/VerticalNavigation/VerticalNavigationItem/VerticalNavigationItem.d.ts +0 -0
  97. package/{components → dist/components}/navigation/VerticalNavigation/VerticalNavigationItem/VerticalNavigationItem.js +5 -1
  98. package/{components → dist/components}/navigation/VerticalNavigation/VerticalNavigationItem/VerticalNavigationItemFlyoutMenu.d.ts +0 -0
  99. package/{components → dist/components}/navigation/VerticalNavigation/VerticalNavigationItem/VerticalNavigationItemFlyoutMenu.js +0 -0
  100. package/{components → dist/components}/navigation/VerticalNavigation/VerticalNavigationItem/VerticalNavigationItemFlyoutMenuStyles.d.ts +0 -0
  101. package/{components → dist/components}/navigation/VerticalNavigation/VerticalNavigationItem/VerticalNavigationItemFlyoutMenuStyles.js +0 -0
  102. package/{components → dist/components}/navigation/VerticalNavigation/VerticalNavigationItem/VerticalNavigationItemStyles.d.ts +0 -0
  103. package/{components → dist/components}/navigation/VerticalNavigation/VerticalNavigationItem/VerticalNavigationItemStyles.js +0 -0
  104. package/{components → dist/components}/navigation/VerticalNavigation/VerticalNavigationMotion.d.ts +0 -0
  105. package/{components → dist/components}/navigation/VerticalNavigation/VerticalNavigationMotion.js +0 -0
  106. package/dist/components/navigation/VerticalNavigation/VerticalNavigationStyles.d.ts +1163 -0
  107. package/{components → dist/components}/navigation/VerticalNavigation/VerticalNavigationStyles.js +3 -2
  108. package/{components → dist/components}/pages/ErrorPage/ErrorPage.d.ts +0 -0
  109. package/{components → dist/components}/pages/ErrorPage/ErrorPage.js +0 -0
  110. package/{components → dist/components}/pages/ErrorPage/ErrorPageStyles.d.ts +0 -0
  111. package/{components → dist/components}/pages/ErrorPage/ErrorPageStyles.js +0 -0
  112. package/{components → dist/components}/pages/SideInSide/SideInSide.d.ts +0 -0
  113. package/{components → dist/components}/pages/SideInSide/SideInSide.js +0 -0
  114. package/{components → dist/components}/pages/SideInSide/SideInSideStyles.d.ts +0 -0
  115. package/{components → dist/components}/pages/SideInSide/SideInSideStyles.js +0 -0
  116. package/{components → dist/components}/stream/AppSwitcher/AppSwitcher.d.ts +0 -0
  117. package/{components → dist/components}/stream/AppSwitcher/AppSwitcher.js +0 -0
  118. package/{components → dist/components}/stream/AppSwitcher/AppSwitcherItem.d.ts +0 -0
  119. package/{components → dist/components}/stream/AppSwitcher/AppSwitcherItem.js +0 -0
  120. package/{components → dist/components}/stream/AppSwitcher/AppSwitcherStyles.d.ts +0 -0
  121. package/{components → dist/components}/stream/AppSwitcher/AppSwitcherStyles.js +0 -0
  122. package/{components → dist/components}/stream/AppSwitcher/constants.d.ts +0 -0
  123. package/{components → dist/components}/stream/AppSwitcher/constants.js +0 -0
  124. package/{index.d.ts → dist/index.d.ts} +0 -0
  125. package/{index.js → dist/index.js} +0 -0
  126. package/{lang → dist/lang}/en-us.d.ts +0 -0
  127. package/{lang → dist/lang}/en-us.js +0 -0
  128. package/dist/package.json +41 -0
  129. package/{types → dist/types}/components/navigation/VerticalNavigation.d.ts +0 -0
  130. package/{types → dist/types}/components/navigation/VerticalNavigation.js +0 -0
  131. package/{types → dist/types}/components/navigation/VerticalNavigationAvatar.d.ts +1 -0
  132. package/{types → dist/types}/components/navigation/VerticalNavigationAvatar.js +0 -0
  133. package/{types → dist/types}/components/stream/AppSwitcher.d.ts +0 -0
  134. package/{types → dist/types}/components/stream/AppSwitcher.js +0 -0
  135. package/{types → dist/types}/index.d.ts +0 -0
  136. package/{types → dist/types}/index.js +0 -0
  137. package/{utils → dist/utils}/constants.d.ts +0 -0
  138. package/{utils → dist/utils}/constants.js +0 -0
  139. package/dist/utils/helpers.d.ts +21 -0
  140. package/dist/utils/helpers.js +64 -0
  141. package/{utils → dist/utils}/hooks.d.ts +0 -0
  142. package/{utils → dist/utils}/hooks.js +0 -0
  143. package/{utils → dist/utils}/index.d.ts +0 -0
  144. package/{utils → dist/utils}/index.js +0 -0
  145. package/{utils → dist/utils}/theme.d.ts +0 -0
  146. package/{utils → dist/utils}/theme.js +0 -0
  147. package/jest.config.ts +11 -0
  148. package/jest.setup.ts +5 -0
  149. package/{LICENSE → license} +0 -0
  150. package/merge.js +27 -0
  151. package/package.json +71 -4
  152. package/public/android-chrome-192x192.png +0 -0
  153. package/public/android-chrome-512x512.png +0 -0
  154. package/public/apple-touch-icon.png +0 -0
  155. package/public/assets/atoms.svg +5 -0
  156. package/public/assets/automation.svg +1 -0
  157. package/public/assets/avatar-1.jpg +0 -0
  158. package/public/assets/avatar-2.jpg +0 -0
  159. package/public/assets/avatar-3.jpg +0 -0
  160. package/public/assets/flux/icon-dark.svg +6 -0
  161. package/public/assets/flux/icon-light.svg +1 -0
  162. package/public/assets/flux/icon-white.svg +6 -0
  163. package/public/assets/flux/icon.svg +6 -0
  164. package/public/assets/flux/logo-dark.svg +22 -0
  165. package/public/assets/flux/logo-light.svg +1 -0
  166. package/public/assets/flux/logo-white.svg +22 -0
  167. package/public/assets/flux/logo.svg +22 -0
  168. package/public/assets/iPhone6.jpg +0 -0
  169. package/public/assets/iPhone6Plus.jpg +0 -0
  170. package/public/assets/lp-logo.png +0 -0
  171. package/public/assets/lplogo.svg +1 -0
  172. package/public/assets/molecules.svg +8 -0
  173. package/public/assets/organisms.svg +21 -0
  174. package/public/assets/pages.svg +4 -0
  175. package/public/assets/particles.svg +3 -0
  176. package/public/assets/stream-dark.png +0 -0
  177. package/public/assets/stream-suite-logo.svg +38 -0
  178. package/public/assets/stream-white.png +0 -0
  179. package/public/assets/stream.png +0 -0
  180. package/public/assets/templates.svg +3 -0
  181. package/public/favicon-16x16.png +0 -0
  182. package/public/favicon-32x32.png +0 -0
  183. package/public/favicon.ico +0 -0
  184. package/public/index.html +43 -0
  185. package/public/logo192.png +0 -0
  186. package/public/logo512.png +0 -0
  187. package/public/manifest.json +25 -0
  188. package/public/robots.txt +3 -0
  189. package/public/site.webmanifest +1 -0
  190. package/{README.md → readme.md} +0 -0
  191. package/src/docs.tsx +167 -0
  192. package/src/lib/assets/Images.tsx +47 -0
  193. package/src/lib/assets/stream-suite-logo.svg +38 -0
  194. package/src/lib/components/atoms/Autocomplete/Autocomplete.test.tsx +179 -0
  195. package/src/lib/components/atoms/Autocomplete/Autocomplete.tsx +14 -0
  196. package/src/lib/components/atoms/Button/Button.test.tsx +166 -0
  197. package/src/lib/components/atoms/Button/Button.tsx +16 -0
  198. package/src/lib/components/atoms/Checkbox/Checkbox.test.tsx +85 -0
  199. package/src/lib/components/atoms/Checkbox/Checkbox.tsx +10 -0
  200. package/src/lib/components/atoms/IconButton/IconButton.test.tsx +60 -0
  201. package/src/lib/components/atoms/IconButton/IconButton.tsx +9 -0
  202. package/src/lib/components/atoms/Radio/Radio.test.tsx +136 -0
  203. package/src/lib/components/atoms/Radio/Radio.tsx +10 -0
  204. package/src/lib/components/atoms/Select/Select.test.tsx +158 -0
  205. package/src/lib/components/atoms/Select/Select.tsx +12 -0
  206. package/src/lib/components/atoms/Slider/Slider.test.tsx +103 -0
  207. package/src/lib/components/atoms/Slider/Slider.tsx +10 -0
  208. package/src/lib/components/atoms/Switch/Switch.test.tsx +96 -0
  209. package/src/lib/components/atoms/Switch/Switch.tsx +10 -0
  210. package/src/lib/components/atoms/TextField/TextField.test.tsx +131 -0
  211. package/src/lib/components/atoms/TextField/TextField.tsx +31 -0
  212. package/src/lib/components/atoms/ToggleButton/ToggleButton.test.tsx +122 -0
  213. package/src/lib/components/atoms/ToggleButton/ToggleButton.tsx +10 -0
  214. package/src/lib/components/datadisplay/Avatar/Avatar.test.tsx +187 -0
  215. package/src/lib/components/datadisplay/Avatar/Avatar.tsx +35 -0
  216. package/src/lib/components/datadisplay/Avatar/avatar-1.jpg +0 -0
  217. package/src/lib/components/datadisplay/Chip/Chip.test.tsx +82 -0
  218. package/src/lib/components/datadisplay/Chip/Chip.tsx +11 -0
  219. package/src/lib/components/datadisplay/List/List.test.tsx +168 -0
  220. package/src/lib/components/datadisplay/List/List.tsx +8 -0
  221. package/src/lib/components/datadisplay/Tooltip/Tooltip.test.tsx +98 -0
  222. package/src/lib/components/datadisplay/Tooltip/Tooltip.tsx +9 -0
  223. package/src/lib/components/feedback/Alert/Alert.test.tsx +139 -0
  224. package/src/lib/components/feedback/Alert/Alert.tsx +10 -0
  225. package/src/lib/components/landmarks/Header/Header.tsx +140 -0
  226. package/src/lib/components/landmarks/Header/HeaderActionButtons.tsx +117 -0
  227. package/src/lib/components/landmarks/Header/HeaderStyles.tsx +62 -0
  228. package/src/lib/components/navigation/Drawer/Drawer.test.tsx +95 -0
  229. package/src/lib/components/navigation/Drawer/Drawer.tsx +21 -0
  230. package/src/lib/components/navigation/MobileNavigation/MobileNavigation.tsx +276 -0
  231. package/src/lib/components/navigation/MobileNavigation/MobileNavigationAvatar.tsx +334 -0
  232. package/src/lib/components/navigation/MobileNavigation/MobileNavigationAvatarStyles.tsx +77 -0
  233. package/src/lib/components/navigation/MobileNavigation/MobileNavigationDrawer.tsx +197 -0
  234. package/src/lib/components/navigation/MobileNavigation/MobileNavigationDrawerStyles.tsx +143 -0
  235. package/src/lib/components/navigation/MobileNavigation/MobileNavigationItem/MobileNavigationItem.tsx +192 -0
  236. package/src/lib/components/navigation/MobileNavigation/MobileNavigationItem/MobileNavigationItemFlyoutMenu.tsx +67 -0
  237. package/src/lib/components/navigation/MobileNavigation/MobileNavigationItem/MobileNavigationItemFlyoutMenuStyles.tsx +192 -0
  238. package/src/lib/components/navigation/MobileNavigation/MobileNavigationItem/MobileNavigationItemStyles.tsx +217 -0
  239. package/src/lib/components/navigation/MobileNavigation/MobileNavigationMotion.tsx +119 -0
  240. package/src/lib/components/navigation/MobileNavigation/MobileNavigationNotchIndicator.tsx +35 -0
  241. package/src/lib/components/navigation/MobileNavigation/MobileNavigationSearch.tsx +114 -0
  242. package/src/lib/components/navigation/MobileNavigation/MobileNavigationSearchStyles.tsx +47 -0
  243. package/src/lib/components/navigation/MobileNavigation/MobileNavigationStyles.tsx +320 -0
  244. package/src/lib/components/navigation/MobileNavigation/MobileNavigationToggleSearchX.tsx +59 -0
  245. package/src/lib/components/navigation/MobileNavigation/MobileNavigationToggleX.tsx +51 -0
  246. package/src/lib/components/navigation/VerticalNavigation/VerticalNavigation.tsx +467 -0
  247. package/src/lib/components/navigation/VerticalNavigation/VerticalNavigationAvatar.tsx +208 -0
  248. package/src/lib/components/navigation/VerticalNavigation/VerticalNavigationAvatarStyles.tsx +75 -0
  249. package/src/lib/components/navigation/VerticalNavigation/VerticalNavigationItem/VerticalNavigationItem.tsx +196 -0
  250. package/src/lib/components/navigation/VerticalNavigation/VerticalNavigationItem/VerticalNavigationItemFlyoutMenu.tsx +94 -0
  251. package/src/lib/components/navigation/VerticalNavigation/VerticalNavigationItem/VerticalNavigationItemFlyoutMenuStyles.tsx +212 -0
  252. package/src/lib/components/navigation/VerticalNavigation/VerticalNavigationItem/VerticalNavigationItemStyles.tsx +240 -0
  253. package/src/lib/components/navigation/VerticalNavigation/VerticalNavigationMotion.tsx +119 -0
  254. package/src/lib/components/navigation/VerticalNavigation/VerticalNavigationStyles.tsx +303 -0
  255. package/src/lib/components/pages/ErrorPage/ErrorPage.test.tsx +78 -0
  256. package/src/lib/components/pages/ErrorPage/ErrorPage.tsx +50 -0
  257. package/src/lib/components/pages/ErrorPage/ErrorPageStyles.tsx +30 -0
  258. package/src/lib/components/pages/SideInSide/SideInSide.tsx +100 -0
  259. package/src/lib/components/pages/SideInSide/SideInSideStyles.tsx +62 -0
  260. package/src/lib/components/stream/AppSwitcher/AppSwitcher.tsx +392 -0
  261. package/src/lib/components/stream/AppSwitcher/AppSwitcherItem.tsx +83 -0
  262. package/src/lib/components/stream/AppSwitcher/AppSwitcherStyles.tsx +325 -0
  263. package/src/lib/components/stream/AppSwitcher/constants.tsx +28 -0
  264. package/src/lib/index.tsx +148 -0
  265. package/src/lib/lang/en-us.js +6 -0
  266. package/src/lib/types/components/navigation/VerticalNavigation.ts +52 -0
  267. package/src/lib/types/components/navigation/VerticalNavigationAvatar.ts +26 -0
  268. package/src/lib/types/components/stream/AppSwitcher.ts +10 -0
  269. package/src/lib/types/index.ts +9 -0
  270. package/src/lib/utils/constants.tsx +11 -0
  271. package/src/lib/utils/helpers.tsx +77 -0
  272. package/src/lib/utils/hooks.tsx +33 -0
  273. package/src/lib/utils/index.tsx +4 -0
  274. package/src/lib/utils/theme.tsx +79 -0
  275. package/src/react-app-env.d.ts +1 -0
  276. package/src/setupTests.ts +5 -0
  277. package/src/stories/Components/DataDisplay/Avatar/Accessibility.stories.mdx +34 -0
  278. package/src/stories/Components/DataDisplay/Avatar/AllCombinations.tsx +56 -0
  279. package/src/stories/Components/DataDisplay/Avatar/Avatar.stories.tsx +19 -0
  280. package/src/stories/Components/DataDisplay/Avatar/Examples.stories.tsx +278 -0
  281. package/src/stories/Components/DataDisplay/Avatar/Overview.stories.mdx +47 -0
  282. package/src/stories/Components/DataDisplay/Chip/Accessibility.stories.mdx +29 -0
  283. package/src/stories/Components/DataDisplay/Chip/AllCombinations.tsx +58 -0
  284. package/src/stories/Components/DataDisplay/Chip/Chip.stories.tsx +21 -0
  285. package/src/stories/Components/DataDisplay/Chip/Examples.stories.tsx +126 -0
  286. package/src/stories/Components/DataDisplay/Chip/Overview.stories.mdx +57 -0
  287. package/src/stories/Components/DataDisplay/List/Accessibility.stories.mdx +54 -0
  288. package/src/stories/Components/DataDisplay/List/AllCombinations.tsx +396 -0
  289. package/src/stories/Components/DataDisplay/List/Examples.stories.tsx +501 -0
  290. package/src/stories/Components/DataDisplay/List/List.stories.tsx +35 -0
  291. package/src/stories/Components/DataDisplay/List/Overview.stories.mdx +69 -0
  292. package/src/stories/Components/DataDisplay/Table/Overview.stories.mdx +70 -0
  293. package/src/stories/Components/DataDisplay/Tooltip/Accessibility.stories.mdx +39 -0
  294. package/src/stories/Components/DataDisplay/Tooltip/AllCombinations.tsx +134 -0
  295. package/src/stories/Components/DataDisplay/Tooltip/Examples.stories.tsx +237 -0
  296. package/src/stories/Components/DataDisplay/Tooltip/Overview.stories.mdx +58 -0
  297. package/src/stories/Components/DataDisplay/Tooltip/Tooltip.stories.tsx +22 -0
  298. package/src/stories/Components/Feedback/Alert/Accessibility.stories.mdx +25 -0
  299. package/src/stories/Components/Feedback/Alert/Alert.stories.tsx +22 -0
  300. package/src/stories/Components/Feedback/Alert/AllCombinations.tsx +37 -0
  301. package/src/stories/Components/Feedback/Alert/Examples.stories.tsx +137 -0
  302. package/src/stories/Components/Feedback/Alert/Overview.stories.mdx +62 -0
  303. package/src/stories/Components/Inputs/Autocomplete/Accessibility.stories.mdx +31 -0
  304. package/src/stories/Components/Inputs/Autocomplete/AllCombinations.tsx +182 -0
  305. package/src/stories/Components/Inputs/Autocomplete/Autocomplete.stories.tsx +31 -0
  306. package/src/stories/Components/Inputs/Autocomplete/Examples.stories.tsx +233 -0
  307. package/src/stories/Components/Inputs/Autocomplete/Overview.stories.mdx +52 -0
  308. package/src/stories/Components/Inputs/Button/Accessibility.stories.mdx +52 -0
  309. package/src/stories/Components/Inputs/Button/AllCombinations.tsx +53 -0
  310. package/src/stories/Components/Inputs/Button/Button.stories.tsx +23 -0
  311. package/src/stories/Components/Inputs/Button/Examples.stories.tsx +190 -0
  312. package/src/stories/Components/Inputs/Button/Overview.stories.mdx +52 -0
  313. package/src/stories/Components/Inputs/Checkbox/Accessibility.stories.mdx +38 -0
  314. package/src/stories/Components/Inputs/Checkbox/AllCombinations.tsx +55 -0
  315. package/src/stories/Components/Inputs/Checkbox/Checkbox.stories.tsx +22 -0
  316. package/src/stories/Components/Inputs/Checkbox/Examples.stories.tsx +363 -0
  317. package/src/stories/Components/Inputs/Checkbox/Overview.stories.mdx +63 -0
  318. package/src/stories/Components/Inputs/IconButton/Examples.stories.tsx +24 -0
  319. package/src/stories/Components/Inputs/IconButton/IconButton.stories.tsx +26 -0
  320. package/src/stories/Components/Inputs/Radio/Accessibility.stories.mdx +61 -0
  321. package/src/stories/Components/Inputs/Radio/AllCombinations.tsx +75 -0
  322. package/src/stories/Components/Inputs/Radio/Examples.stories.tsx +333 -0
  323. package/src/stories/Components/Inputs/Radio/Overview.stories.mdx +74 -0
  324. package/src/stories/Components/Inputs/Radio/Radio.stories.tsx +22 -0
  325. package/src/stories/Components/Inputs/Select/Accessibility.stories.mdx +51 -0
  326. package/src/stories/Components/Inputs/Select/AllCombinations.tsx +63 -0
  327. package/src/stories/Components/Inputs/Select/Examples.stories.tsx +803 -0
  328. package/src/stories/Components/Inputs/Select/Overview.stories.mdx +73 -0
  329. package/src/stories/Components/Inputs/Select/Select.stories.tsx +22 -0
  330. package/src/stories/Components/Inputs/Slider/Accessibility.stories.mdx +43 -0
  331. package/src/stories/Components/Inputs/Slider/AllCombinations.tsx +30 -0
  332. package/src/stories/Components/Inputs/Slider/Examples.stories.tsx +146 -0
  333. package/src/stories/Components/Inputs/Slider/Overview.stories.mdx +59 -0
  334. package/src/stories/Components/Inputs/Slider/Slider.stories.tsx +27 -0
  335. package/src/stories/Components/Inputs/Switch/Accessibility.stories.mdx +34 -0
  336. package/src/stories/Components/Inputs/Switch/AllCombinations.tsx +45 -0
  337. package/src/stories/Components/Inputs/Switch/Examples.stories.tsx +213 -0
  338. package/src/stories/Components/Inputs/Switch/Overview.stories.mdx +62 -0
  339. package/src/stories/Components/Inputs/Switch/Switch.stories.tsx +22 -0
  340. package/src/stories/Components/Inputs/TextField/Accessibility.stories.mdx +29 -0
  341. package/src/stories/Components/Inputs/TextField/AllCombinations.tsx +57 -0
  342. package/src/stories/Components/Inputs/TextField/Examples.stories.tsx +127 -0
  343. package/src/stories/Components/Inputs/TextField/Overview.stories.mdx +60 -0
  344. package/src/stories/Components/Inputs/TextField/TextField.stories.tsx +261 -0
  345. package/src/stories/Components/Inputs/ToggleButton/Accessibility.stories.mdx +32 -0
  346. package/src/stories/Components/Inputs/ToggleButton/AllCombinations.tsx +113 -0
  347. package/src/stories/Components/Inputs/ToggleButton/Examples.stories.tsx +339 -0
  348. package/src/stories/Components/Inputs/ToggleButton/Overview.stories.mdx +55 -0
  349. package/src/stories/Components/Inputs/ToggleButton/ToggleButton.stories.tsx +19 -0
  350. package/src/stories/Components/Landmarks/Header/Examples.stories.tsx +197 -0
  351. package/src/stories/Components/Landmarks/Header/Header.stories.tsx +34 -0
  352. package/src/stories/Components/Landmarks/Header/Overview.stories.mdx +44 -0
  353. package/src/stories/Components/Navigation/Drawer/Accessibility.stories.mdx +13 -0
  354. package/src/stories/Components/Navigation/Drawer/Drawer.stories.tsx +80 -0
  355. package/src/stories/Components/Navigation/Drawer/Examples.stories.tsx +440 -0
  356. package/src/stories/Components/Navigation/Drawer/Overview.stories.mdx +43 -0
  357. package/src/stories/Components/Navigation/MobileNavigation/Accessibility.stories.mdx +14 -0
  358. package/src/stories/Components/Navigation/MobileNavigation/Examples.stories.tsx +384 -0
  359. package/src/stories/Components/Navigation/MobileNavigation/MobileNavigation.stories.tsx +24 -0
  360. package/src/stories/Components/Navigation/MobileNavigation/Overview.stories.mdx +47 -0
  361. package/src/stories/Components/Navigation/VerticalNavigation/Accessibility.stories.mdx +14 -0
  362. package/src/stories/Components/Navigation/VerticalNavigation/Examples.stories.tsx +307 -0
  363. package/src/stories/Components/Navigation/VerticalNavigation/Overview.stories.mdx +47 -0
  364. package/src/stories/Components/Navigation/VerticalNavigation/VerticalNavigation.stories.tsx +24 -0
  365. package/src/stories/ContactUs.stories.mdx +21 -0
  366. package/src/stories/Experimental/Test.stories.mdx +46 -0
  367. package/src/stories/GettingStarted/Designer.stories.mdx +86 -0
  368. package/src/stories/GettingStarted/Developer.stories.mdx +134 -0
  369. package/src/stories/Guidelines/Accessibility/AssistiveTechnology.stories.mdx +70 -0
  370. package/src/stories/Guidelines/Accessibility/ColorAndContrast.stories.mdx +109 -0
  371. package/src/stories/Guidelines/Accessibility/Hierarchy.stories.mdx +119 -0
  372. package/src/stories/Guidelines/Accessibility/Imagery.stories.mdx +136 -0
  373. package/src/stories/Guidelines/Accessibility/Overview.stories.mdx +44 -0
  374. package/src/stories/Guidelines/Accessibility/Principles.stories.mdx +156 -0
  375. package/src/stories/Guidelines/Accessibility/SoundAndMotion.stories.mdx +59 -0
  376. package/src/stories/Guidelines/Accessibility/Typography.stories.mdx +69 -0
  377. package/src/stories/Guidelines/Accessibility/Writing.stories.mdx +188 -0
  378. package/src/stories/Guidelines/Styleguide/ColorSwatch.tsx +53 -0
  379. package/src/stories/Guidelines/Styleguide/Colors.stories.mdx +118 -0
  380. package/src/stories/Guidelines/Styleguide/Typography.stories.mdx +84 -0
  381. package/src/stories/Introduction.stories.mdx +65 -0
  382. package/src/stories/Pages/ErrorPage.stories.tsx +30 -0
  383. package/src/stories/Pages/SideInSide.stories.tsx +195 -0
  384. package/src/stories/Roadmap.stories.mdx +19 -0
  385. package/src/stories/Templates/Login.stories.mdx +46 -0
  386. package/src/stories/assets/Atomic_Design_Icons-Dark.svg +24 -0
  387. package/src/stories/assets/Atomic_Design_Icons-Light.svg +25 -0
  388. package/src/stories/assets/accessibility-1.png +0 -0
  389. package/src/stories/assets/accessibility-2.png +0 -0
  390. package/src/stories/assets/accessibility-3.png +0 -0
  391. package/src/stories/assets/accessibility-banner.png +0 -0
  392. package/src/stories/assets/atoms.svg +6 -0
  393. package/src/stories/assets/design_system_2022-02-11_12.22pm.png +0 -0
  394. package/src/stories/assets/figma-tokens.png +0 -0
  395. package/src/stories/assets/hierarchy-1.jpg +0 -0
  396. package/src/stories/assets/hierarchy-2.jpg +0 -0
  397. package/src/stories/assets/hierarchy-3.jpg +0 -0
  398. package/src/stories/assets/icon-contrast-1.jpg +0 -0
  399. package/src/stories/assets/icon-contrast-2.jpg +0 -0
  400. package/src/stories/assets/imagery-1.png +0 -0
  401. package/src/stories/assets/imagery-2.png +0 -0
  402. package/src/stories/assets/imagery-3.png +0 -0
  403. package/src/stories/assets/imagery-4.jpg +0 -0
  404. package/src/stories/assets/molecules.svg +9 -0
  405. package/src/stories/assets/organisms.svg +22 -0
  406. package/src/stories/assets/pages.svg +5 -0
  407. package/src/stories/assets/particles.svg +4 -0
  408. package/src/stories/assets/templates.svg +4 -0
  409. package/src/stories/assets/testData.tsx +102 -0
  410. package/src/stories/assets/text-contrast-1.jpg +0 -0
  411. package/src/stories/assets/text-contrast-2.jpg +0 -0
  412. package/src/stories/assets/typography-1.png +0 -0
  413. package/src/stories/assets/visual-clues-1.png +0 -0
  414. package/src/stories/assets/visual-clues-2.png +0 -0
  415. package/src/stories/assets/writing-1.jpg +0 -0
  416. package/src/stories/assets/writing-2.png +0 -0
  417. package/src/stories/assets/writing-3.png +0 -0
  418. package/src/stories/assets/writing-4.png +0 -0
  419. package/src/stories/utils/CustomIcons.tsx +44 -0
  420. package/tsconfig.eslint.json +16 -0
  421. package/tsconfig.json +50 -0
  422. package/components/navigation/MobileNavigation/MobileNavigationAvatarStyles.d.ts +0 -827
  423. package/components/navigation/MobileNavigation/MobileNavigationDrawer.js +0 -147
  424. package/components/navigation/MobileNavigation/MobileNavigationDrawerStyles.d.ts +0 -392
  425. package/components/navigation/MobileNavigation/MobileNavigationNotchIndicator.d.ts +0 -3
  426. package/components/navigation/MobileNavigation/MobileNavigationNotchIndicator.js +0 -31
  427. package/components/navigation/MobileNavigation/MobileNavigationSearchStyles.d.ts +0 -257
  428. package/components/navigation/MobileNavigation/MobileNavigationToggleSearchX.d.ts +0 -3
  429. package/components/navigation/MobileNavigation/MobileNavigationToggleSearchX.js +0 -33
  430. package/components/navigation/MobileNavigation/MobileNavigationToggleX.d.ts +0 -3
  431. package/components/navigation/MobileNavigation/MobileNavigationToggleX.js +0 -27
  432. package/components/navigation/MobileNavigation/MobileNavigationToggleXStyles.d.ts +0 -36
  433. package/components/navigation/MobileNavigation/MobileNavigationToggleXStyles.js +0 -10
  434. package/components/navigation/VerticalNavigation/VerticalNavigationAvatarStyles.d.ts +0 -827
  435. package/components/navigation/VerticalNavigation/VerticalNavigationStyles.d.ts +0 -88
  436. package/utils/helpers.d.ts +0 -6
  437. package/utils/helpers.js +0 -17
@@ -0,0 +1,276 @@
1
+ import React, { useEffect } from 'react'
2
+ import { Person } from '@mui/icons-material'
3
+ import { IMobileNavigationItemProps } from './MobileNavigationItem/MobileNavigationItem'
4
+ import {
5
+ StyledBottomNavigationAction, StyledPaper, StyledBottomNavigation
6
+ } from './MobileNavigationStyles'
7
+ import { StyledAvatar } from './MobileNavigationAvatarStyles'
8
+ import SwipeableTemporaryDrawer from './MobileNavigationDrawer'
9
+ import SwipeableTemporarySearch from './MobileNavigationSearch'
10
+ import SwipeableTemporaryAvatar, { IAvatarMenuItemProps } from './MobileNavigationAvatar'
11
+ import NotchIndicator from './MobileNavigationNotchIndicator'
12
+ import ToggleX from './MobileNavigationToggleX'
13
+ import ToggleSearchX from './MobileNavigationToggleSearchX'
14
+ import { MOBILE_NAV_PANEL_TYPES } from '../../../utils/constants'
15
+ import { handleAvatarInitials } from '../../../utils/helpers'
16
+ import { useSpring, animated, useSpringRef, config } from '@react-spring/web'
17
+ import { useCurrentWidth } from '../../../utils/hooks'
18
+
19
+ interface MobileNavigationProps {
20
+ logo?: string
21
+ logoText?: string
22
+ logoOnClick?: any
23
+ items?: IMobileNavigationItemProps[]
24
+ secondaryItems?: IMobileNavigationItemProps[]
25
+ hasStreamHome?: boolean
26
+ streamHomeAccessToken?: string
27
+ streamHomeBaseUrl?: string
28
+ streamHomeApiKey?: string
29
+ avatarName?: string
30
+ isDrawerOpen?: boolean
31
+ isSearchOpen?: boolean
32
+ isAvatarOpen?: boolean
33
+ hideAvatarInitials?: boolean
34
+ showNotchIndicator?: boolean
35
+
36
+ // Search panel props
37
+ hasSearch?: boolean
38
+ searchPanelPlaceholder?: string
39
+ searchPanelDefaultValue?: string
40
+ searchPanelOnClickSearch?: any
41
+
42
+ // Avatar panel props
43
+ hasAvatar?: boolean
44
+ avatarPanelLogoutString?: string
45
+ avatarPanelOnClickSwitchDirection?: any
46
+ avatarPanelOnClickLogout?: any
47
+ avatarPanelOnClickViewProfile?: any
48
+ avatarPanelViewProfileString?: string
49
+ avatarPanelOnClickEditProfile?: any
50
+ avatarPanelEditProfileString?: string
51
+ avatarPanelMenuItems?: Array<IAvatarMenuItemProps>
52
+ avatarPanelOnClickMainAction?: any
53
+ avatarPanelMainActionString?: string
54
+ avatarPanelSettingItems?: Array<IAvatarMenuItemProps>
55
+ }
56
+
57
+ const MobileNavigation = (
58
+ props: MobileNavigationProps
59
+ ): React.ReactElement => {
60
+ const {
61
+ items, secondaryItems, hideAvatarInitials,
62
+ hasSearch, hasAvatar, showNotchIndicator, ...rest
63
+ } = props
64
+ const propIsDrawerOpen = typeof props?.isDrawerOpen === 'boolean' ? props.isDrawerOpen : undefined
65
+ const propIsSearchOpen = typeof props?.isSearchOpen === 'boolean' ? props.isSearchOpen : undefined
66
+ const propIsAvatarOpen = typeof props?.isAvatarOpen === 'boolean' ? props.isAvatarOpen : undefined
67
+ const avatarName = props?.avatarName ?? 'Avatar name'
68
+ const [isDrawerOpen, setIsDrawerOpen] = React.useState(propIsDrawerOpen ?? false)
69
+ const [isSearchOpen, setIsSearchOpen] = React.useState(propIsSearchOpen ?? false)
70
+ const [isAvatarOpen, setIsAvatarOpen] = React.useState(propIsAvatarOpen ?? false)
71
+ const [value, setValue] = React.useState(0)
72
+
73
+ const currentDirection = window.localStorage.getItem('@learningpool/ui/store/mobile-navigation-direction')
74
+ const [mobileNavDirection, setMobileNavDirection] = React.useState(currentDirection ?? 'ltr')
75
+
76
+ const [mobileNotchPosition, setMobileNotchPosition] = React.useState(0)
77
+ const windowWidth = useCurrentWidth()
78
+
79
+ useEffect(() => {
80
+ window.localStorage.setItem('@learningpool/ui/store/mobile-navigation-direction', mobileNavDirection)
81
+ positionMobileNotch()
82
+ }, [mobileNavDirection])
83
+
84
+ const NOTCH = {
85
+ Height: 50,
86
+ Width: 50
87
+ }
88
+
89
+ const BOTTOM_NAVIGATION_ITEM_DOM_ELEMENTS = document.querySelectorAll('.MuiBottomNavigationAction-root, .bottom-navigation-item')
90
+
91
+ const positionMobileNotch = () => {
92
+ const selectedDOMRect = BOTTOM_NAVIGATION_ITEM_DOM_ELEMENTS[value]?.getBoundingClientRect()
93
+ setMobileNotchPosition(selectedDOMRect ? selectedDOMRect.left + (selectedDOMRect.width / 2) - (NOTCH.Width / 2) : mobileNotchPosition)
94
+ }
95
+
96
+ useEffect(() => positionMobileNotch(), [
97
+ value,
98
+ windowWidth,
99
+ // Fix notch position if scrollbar is hidden/shown
100
+ BOTTOM_NAVIGATION_ITEM_DOM_ELEMENTS[value]?.getBoundingClientRect()
101
+ ])
102
+
103
+ useEffect(() => setIsDrawerOpen(propIsDrawerOpen ?? false), [propIsDrawerOpen])
104
+ useEffect(() => setIsSearchOpen(propIsSearchOpen ?? false), [propIsSearchOpen])
105
+ useEffect(() => setIsAvatarOpen(propIsAvatarOpen ?? false), [propIsAvatarOpen])
106
+ useEffect(() => setAvatarInitials(handleAvatarInitials(avatarName)), [avatarName])
107
+
108
+ useEffect(() => {
109
+ function hideNotch (): void {
110
+ const HIDE_NOTCH = -1
111
+
112
+ if (!isDrawerOpen && !isSearchOpen && !isAvatarOpen) {
113
+ setValue(HIDE_NOTCH)
114
+ }
115
+ }
116
+
117
+ hideNotch()
118
+ }, [isDrawerOpen, isSearchOpen, isAvatarOpen])
119
+
120
+ const [avatarInitials, setAvatarInitials] = React.useState(handleAvatarInitials(avatarName) ?? 'AN')
121
+
122
+ const toggleDrawer = (open: boolean, action: string) => (event: React.KeyboardEvent | React.MouseEvent) => {
123
+ event?.stopPropagation()
124
+
125
+ if (event.type === 'keydown') {
126
+ if ((event as React.KeyboardEvent).key === 'Tab' || (event as React.KeyboardEvent).key === 'Shift') {
127
+ return
128
+ }
129
+ }
130
+
131
+ // Close any open drawers
132
+ setIsDrawerOpen(false)
133
+ setIsSearchOpen(false)
134
+ setIsAvatarOpen(false)
135
+
136
+ // Handle drawer toggling based on 'action' or default to 'drawer'
137
+ switch (action) {
138
+ case MOBILE_NAV_PANEL_TYPES.SEARCH: {
139
+ setIsSearchOpen(open ?? !isSearchOpen)
140
+ setValue(1)
141
+ break
142
+ }
143
+ case MOBILE_NAV_PANEL_TYPES.AVATAR: {
144
+ setIsAvatarOpen(open ?? !isAvatarOpen)
145
+ setValue(2)
146
+ break
147
+ }
148
+ default: {
149
+ setIsDrawerOpen(open ?? !isDrawerOpen)
150
+ setValue(0)
151
+ break
152
+ }
153
+ }
154
+ }
155
+
156
+ const api = useSpringRef()
157
+ const animationConfig: any = {
158
+ MobileNavigationPaper: {
159
+ from: { opacity: 0 },
160
+ to: { opacity: 1 }
161
+ },
162
+ MobileNavigation: {
163
+ from: { opacity: 0 },
164
+ to: { opacity: 1 }
165
+ },
166
+ MobileNavigationButton: {
167
+ from: { opacity: 0 },
168
+ to: { opacity: 1 }
169
+ },
170
+ MobileNavigationNotch: {
171
+ ref: api,
172
+ config: {
173
+ ...config.default,
174
+ mass: 1
175
+ // friction: 30,
176
+ // tension: 200
177
+ },
178
+ x: mobileNotchPosition,
179
+ y: value < 0 ? 100 : 0
180
+ }
181
+ }
182
+
183
+ const MobileNavigationPaperAnimation = useSpring(animationConfig.MobileNavigationPaper)
184
+ const MobileNavigationAnimation = useSpring(animationConfig.MobileNavigation)
185
+ const MobileNavigationButtonAnimation = useSpring(animationConfig.MobileNavigationButton)
186
+
187
+ return (
188
+ <>
189
+ <SwipeableTemporaryDrawer
190
+ isDrawerOpen={isDrawerOpen}
191
+ setIsDrawerOpen={setIsDrawerOpen}
192
+ items={items}
193
+ secondaryItems={secondaryItems}
194
+ label='Primary'
195
+ {...rest}
196
+ />
197
+ {hasSearch && (
198
+ <SwipeableTemporarySearch
199
+ isSearchOpen={isSearchOpen}
200
+ setIsSearchOpen={setIsSearchOpen}
201
+ {...rest}
202
+ />
203
+ )}
204
+ {hasAvatar && (
205
+ <SwipeableTemporaryAvatar
206
+ isAvatarOpen={isAvatarOpen}
207
+ setIsAvatarOpen={setIsAvatarOpen}
208
+ avatarName={avatarName}
209
+ mobileNavDirection={mobileNavDirection}
210
+ setMobileNavDirection={setMobileNavDirection}
211
+ {...rest}
212
+ />
213
+ )}
214
+ <StyledPaper
215
+ elevation={3}
216
+ // @ts-expect-error
217
+ component={animated.div}
218
+ style={MobileNavigationPaperAnimation}
219
+ >
220
+ {showNotchIndicator && <NotchIndicator {...animationConfig.MobileNavigationNotch} />}
221
+
222
+ <StyledBottomNavigation
223
+ value={value}
224
+ onChange={(event, newValue) => setValue(newValue)}
225
+ // @ts-expect-error
226
+ component={animated.div}
227
+ style={{
228
+ flexDirection: mobileNavDirection && mobileNavDirection === 'rtl' ? 'row-reverse' : 'row',
229
+ ...MobileNavigationAnimation
230
+ }}
231
+ >
232
+ <StyledBottomNavigationAction
233
+ icon={<ToggleX isOpen={isDrawerOpen} />}
234
+ onClick={toggleDrawer(!isDrawerOpen, MOBILE_NAV_PANEL_TYPES.DRAWER)}
235
+ // @ts-expect-error
236
+ component={animated.div}
237
+ aria-label={isDrawerOpen ? 'Close drawer panel' : 'Open drawer panel'}
238
+ aria-expanded={isDrawerOpen ? 'true' : 'false'}
239
+ aria-controls='mobile-nav-menu'
240
+ style={{
241
+ marginInlineStart: (hasSearch || hasAvatar) && (mobileNavDirection && mobileNavDirection === 'rtl') ? 'auto' : 'initial',
242
+ marginInlineEnd: (hasSearch || hasAvatar) && (mobileNavDirection && mobileNavDirection === 'rtl') ? 'initial' : 'auto',
243
+ ...MobileNavigationButtonAnimation
244
+ }}
245
+ />
246
+ {hasSearch && (
247
+ <StyledBottomNavigationAction
248
+ icon={<ToggleSearchX isOpen={isSearchOpen} />}
249
+ onClick={toggleDrawer(!isSearchOpen, MOBILE_NAV_PANEL_TYPES.SEARCH)}
250
+ // @ts-expect-error
251
+ component={animated.div}
252
+ aria-label={isSearchOpen ? 'Close search panel' : 'Open search panel'}
253
+ aria-expanded={isSearchOpen ? 'true' : 'false'}
254
+ aria-controls='mobile-nav-menu'
255
+ style={MobileNavigationButtonAnimation}
256
+ />
257
+ )}
258
+ {hasAvatar && (
259
+ <StyledBottomNavigationAction
260
+ onClick={toggleDrawer(!isAvatarOpen, MOBILE_NAV_PANEL_TYPES.AVATAR)}
261
+ icon={!hideAvatarInitials ? <StyledAvatar>{avatarInitials}</StyledAvatar> : <Person />}
262
+ // @ts-expect-error
263
+ component={animated.button}
264
+ aria-label={isAvatarOpen ? 'Close Profile Menu' : 'Open Profile Menu'}
265
+ aria-expanded={isAvatarOpen ? 'true' : 'false'}
266
+ aria-controls='mobile-nav-menu'
267
+ style={MobileNavigationButtonAnimation}
268
+ />
269
+ )}
270
+ </StyledBottomNavigation>
271
+ </StyledPaper>
272
+ </>
273
+ )
274
+ }
275
+
276
+ export default MobileNavigation
@@ -0,0 +1,334 @@
1
+ import React, { useEffect } from 'react'
2
+ import {
3
+ Box, ButtonGroup, Button, Link,
4
+ List, ListItem, ListItemIcon,
5
+ ListItemText
6
+ } from '../../../index'
7
+ import {
8
+ StyledSwipeableAvatar, StyledBox, StyledBoxProfile,
9
+ StyledAvatarName, StyledAvatar, StyledOutlineButton,
10
+ StyledBoxProfileEdit, StyledListItemButton
11
+ } from './MobileNavigationAvatarStyles'
12
+ import { useTheme } from '@mui/material/styles'
13
+ import EditIcon from '@mui/icons-material/Edit'
14
+ import LogoutIcon from '@mui/icons-material/Logout'
15
+ import ToggleOffIcon from '@mui/icons-material/ToggleOff'
16
+ import ToggleOnIcon from '@mui/icons-material/ToggleOn'
17
+ import { handleAvatarInitials, useStaggerAnimation } from '../../../utils/helpers'
18
+ import { animated } from '@react-spring/web'
19
+
20
+ export interface IAvatarMenuItemProps {
21
+ label: string
22
+ icon: any
23
+ onClick: any
24
+ }
25
+
26
+ export interface ISwipeableTemporaryAvatarProps {
27
+ avatarName: string
28
+ editProfileText?: string
29
+ isAvatarOpen: boolean
30
+ setIsAvatarOpen?: any
31
+ mobileNavDirection?: string
32
+ setMobileNavDirection?: any
33
+
34
+ avatarPanelLogoutString?: string
35
+ avatarPanelOnClickSwitchDirection?: any
36
+ avatarPanelOnClickLogout?: any
37
+ avatarPanelOnClickViewProfile?: any
38
+ avatarPanelViewProfileString?: string
39
+ avatarPanelOnClickEditProfile?: any
40
+ avatarPanelEditProfileString?: string
41
+ avatarPanelMenuItems?: Array<IAvatarMenuItemProps>
42
+ avatarPanelOnClickMainAction?: any
43
+ avatarPanelMainActionString?: string
44
+ avatarPanelSettingItems?: Array<IAvatarMenuItemProps>
45
+ avatarPanelInvertNavString?: string
46
+ }
47
+
48
+ const SwipeableTemporaryAvatar = (
49
+ props: ISwipeableTemporaryAvatarProps
50
+ ): React.ReactElement => {
51
+ const theme = useTheme()
52
+ const {
53
+ avatarName, mobileNavDirection, avatarPanelLogoutString,
54
+ isAvatarOpen, setIsAvatarOpen, setMobileNavDirection,
55
+ avatarPanelOnClickSwitchDirection, avatarPanelOnClickLogout,
56
+ avatarPanelOnClickViewProfile, avatarPanelViewProfileString,
57
+ avatarPanelOnClickEditProfile, avatarPanelEditProfileString,
58
+ avatarPanelMenuItems, avatarPanelOnClickMainAction,
59
+ avatarPanelMainActionString, avatarPanelSettingItems,
60
+ avatarPanelInvertNavString
61
+ } = props
62
+
63
+ const [isOpen, setIsOpen] = React.useState(isAvatarOpen ?? false)
64
+
65
+ React.useEffect(() => handleOpenState(isAvatarOpen), [isAvatarOpen])
66
+
67
+ const handleOpenState = (open: boolean): void => {
68
+ setIsOpen(open)
69
+ setIsAvatarOpen(open)
70
+ }
71
+
72
+ const toggleAvatar =
73
+ (open: boolean) =>
74
+ (event: React.KeyboardEvent | React.MouseEvent) => {
75
+ if (event && event.type === 'keydown' &&
76
+ ((event as React.KeyboardEvent).key === 'Tab' ||
77
+ (event as React.KeyboardEvent).key === 'Shift')
78
+ ) {
79
+ return
80
+ }
81
+
82
+ handleOpenState(open)
83
+ }
84
+
85
+ const [avatarInitials, setAvatarInitials] = React.useState(handleAvatarInitials(avatarName) ?? 'AN')
86
+ useEffect(() => setAvatarInitials(handleAvatarInitials(avatarName)), [avatarName])
87
+
88
+ const handleOnClickSwitchDirection = () => {
89
+ setMobileNavDirection(mobileNavDirection === 'rtl' ? 'ltr' : 'rtl')
90
+ avatarPanelOnClickSwitchDirection && avatarPanelOnClickSwitchDirection()
91
+ }
92
+
93
+ // First item starts at 70ms
94
+ // see STAGGER_ITEMS_DELAY in helpers.js
95
+ let animationCount = 1
96
+ const incrementAnimationCount = () => animationCount++
97
+
98
+ return (
99
+ <StyledSwipeableAvatar
100
+ anchor='bottom'
101
+ open={isOpen}
102
+ onClose={toggleAvatar(false)}
103
+ hideBackdrop
104
+ ModalProps={{
105
+ keepMounted: true
106
+ }}
107
+ >
108
+ <StyledBox>
109
+ {avatarPanelOnClickLogout && (
110
+ <Button
111
+ // @ts-expect-error
112
+ component={animated.button}
113
+ style={{
114
+ left: theme.direction === 'rtl' ? theme.spacing(1) : 'auto',
115
+ position: 'absolute',
116
+ right: theme.direction === 'rtl' ? 'auto' : theme.spacing(1),
117
+ top: theme.spacing(1),
118
+ ...useStaggerAnimation(isOpen, animationCount, incrementAnimationCount)
119
+ }}
120
+ onClick={() => {
121
+ handleOpenState(false)
122
+ avatarPanelOnClickLogout()
123
+ }}
124
+ startIcon={<LogoutIcon />}
125
+ variant='text'
126
+ color='inherit'
127
+ >
128
+ {avatarPanelLogoutString ?? 'Logout'}
129
+ </Button>
130
+ )}
131
+
132
+ <Box
133
+ style={{
134
+ alignItems: 'center',
135
+ display: 'flex',
136
+ flexDirection: 'column'
137
+ }}
138
+ >
139
+ <StyledBoxProfile
140
+ style={useStaggerAnimation(isOpen, animationCount, incrementAnimationCount)}
141
+ >
142
+ <StyledAvatar style={{ marginRight: '0.5rem' }}>
143
+ {avatarInitials}
144
+ </StyledAvatar>
145
+ <StyledAvatarName>
146
+ <span style={{ fontWeight: 300 }}>
147
+ Hi,</span> <strong>{avatarName.split(' ')[0]}
148
+ </strong>
149
+ </StyledAvatarName>
150
+ </StyledBoxProfile>
151
+
152
+ {avatarPanelOnClickViewProfile && (
153
+ <StyledBoxProfileEdit
154
+ style={{
155
+ flexDirection: 'row',
156
+ marginBottom: theme.spacing(1),
157
+ ...useStaggerAnimation(isOpen, animationCount, incrementAnimationCount)
158
+ }}>
159
+ <ButtonGroup variant="contained" aria-label="split button">
160
+ <Button
161
+ variant='contained'
162
+ color='primary'
163
+ size='medium'
164
+ onClick={() => {
165
+ handleOpenState(false)
166
+ avatarPanelOnClickViewProfile()
167
+ }}
168
+ >{avatarPanelViewProfileString ?? 'View Profile'}</Button>
169
+ {avatarPanelOnClickEditProfile && (
170
+ <Button
171
+ size='medium'
172
+ aria-label={avatarPanelEditProfileString ?? 'Edit Profile'}
173
+ onClick={() => {
174
+ handleOpenState(false)
175
+ avatarPanelOnClickEditProfile()
176
+ }}
177
+ >
178
+ <EditIcon />
179
+ </Button>
180
+ )}
181
+ </ButtonGroup>
182
+ </StyledBoxProfileEdit>
183
+ )}
184
+ </Box>
185
+
186
+ <Box
187
+ style={{
188
+ alignItems: 'center',
189
+ display: 'flex',
190
+ flexDirection: 'column'
191
+ }}
192
+ >
193
+ {avatarPanelMenuItems && avatarPanelMenuItems.length > 0 && (
194
+ <List style={{
195
+ marginInlineStart: '3rem',
196
+ marginBottom: theme.spacing(2),
197
+ maxWidth: '18rem'
198
+ }}>
199
+ {avatarPanelMenuItems.map((avatarMenuItem: IAvatarMenuItemProps) => (
200
+ <ListItem
201
+ component={animated.div}
202
+ style={useStaggerAnimation(isOpen, animationCount, incrementAnimationCount)}
203
+ // whileHover={motionWhileHover}
204
+ // whileTap={motionWhileTap}
205
+ disablePadding
206
+ >
207
+ <StyledListItemButton
208
+ // TODO: figure out if these are links or buttons
209
+ // @ts-expect-error
210
+ component={Link}
211
+ role='link'
212
+ onClick={() => {
213
+ handleOpenState(false)
214
+ avatarMenuItem.onClick()
215
+ }}
216
+ >
217
+ <ListItemIcon
218
+ aria-hidden={true}
219
+ style={{
220
+ minWidth: theme.spacing(5)
221
+ }}
222
+ >
223
+ {avatarMenuItem.icon}
224
+ </ListItemIcon>
225
+ <ListItemText primary={avatarMenuItem.label} />
226
+ </StyledListItemButton>
227
+ </ListItem>
228
+ ))}
229
+ </List>
230
+ )}
231
+
232
+ {avatarPanelOnClickMainAction && <StyledOutlineButton
233
+ // @ts-expect-error
234
+ component={animated.button}
235
+ style={useStaggerAnimation(isOpen, animationCount, incrementAnimationCount)}
236
+ disablePadding
237
+ variant='outlined'
238
+ color='primary'
239
+ size='medium'
240
+ onClick={() => {
241
+ handleOpenState(false)
242
+ avatarPanelOnClickMainAction()
243
+ }}
244
+ >{avatarPanelMainActionString}</StyledOutlineButton>}
245
+
246
+ <List style={{ marginBottom: theme.spacing(2) }}>
247
+ {avatarPanelSettingItems &&
248
+ avatarPanelSettingItems.length > 0 &&
249
+ avatarPanelSettingItems.map((avatarMenuItem: IAvatarMenuItemProps) => (
250
+ <ListItem
251
+ component={animated.div}
252
+ style={useStaggerAnimation(isOpen, animationCount, incrementAnimationCount)}
253
+ // whileHover={motionWhileHover}
254
+ // whileTap={motionWhileTap}
255
+ disablePadding
256
+ >
257
+ <StyledListItemButton
258
+ // TODO: figure out if these are links or buttons
259
+ // @ts-expect-error
260
+ component={Link}
261
+ role='link'
262
+ onClick={() => {
263
+ handleOpenState(false)
264
+ avatarMenuItem.onClick()
265
+ }}
266
+ >
267
+ <ListItemIcon
268
+ aria-hidden={true}
269
+ style={{
270
+ minWidth: theme.spacing(5)
271
+ }}
272
+ >
273
+ {avatarMenuItem.icon}
274
+ </ListItemIcon>
275
+ <ListItemText primary={avatarMenuItem.label} />
276
+ </StyledListItemButton>
277
+ </ListItem>
278
+ ))}
279
+
280
+ {avatarPanelOnClickSwitchDirection && (
281
+ <ListItem
282
+ component={animated.div}
283
+ style={useStaggerAnimation(isOpen, animationCount, incrementAnimationCount)}
284
+ // whileHover={motionWhileHover}
285
+ // whileTap={motionWhileTap}
286
+ disablePadding
287
+ >
288
+ <StyledListItemButton
289
+ // TODO: figure out if these are links or buttons
290
+ // @ts-expect-error
291
+ component={Link}
292
+ role='link'
293
+ onClick={handleOnClickSwitchDirection}
294
+ >
295
+ <ListItemText primary={avatarPanelInvertNavString ?? 'Invert navigation bar'} />
296
+ <ListItemIcon
297
+ aria-hidden={true}
298
+ style={{
299
+ minWidth: theme.spacing(5),
300
+ marginInlineStart: '0.5rem'
301
+ }}
302
+ >
303
+ {mobileNavDirection === 'ltr'
304
+ ? (
305
+ <ToggleOffIcon
306
+ style={{
307
+ boxSizing: 'border-box',
308
+ height: '2em',
309
+ padding: '0.15em',
310
+ width: '2em'
311
+ }}
312
+ />)
313
+ : (
314
+ <ToggleOnIcon
315
+ style={{
316
+ boxSizing: 'border-box',
317
+ color: 'green',
318
+ height: '2em',
319
+ padding: '0.15em',
320
+ width: '2em'
321
+ }}
322
+ />)}
323
+ </ListItemIcon>
324
+ </StyledListItemButton>
325
+ </ListItem>
326
+ )}
327
+ </List>
328
+ </Box>
329
+ </StyledBox>
330
+ </StyledSwipeableAvatar>
331
+ )
332
+ }
333
+
334
+ export default SwipeableTemporaryAvatar
@@ -0,0 +1,77 @@
1
+ import {
2
+ Avatar, Button,
3
+ ListItemButton, Typography
4
+ } from '../../../index'
5
+ import { Drawer } from '@mui/material'
6
+ import { styled } from '@mui/material/styles'
7
+ import { animated } from '@react-spring/web'
8
+
9
+ export const StyledSwipeableAvatar = styled(Drawer)`
10
+ .MuiPaper-root {
11
+ color: ${props => props.theme.palette.mode === 'dark'
12
+ ? props.theme.palette.primary.contrastText
13
+ : props.theme.palette.text.primary};
14
+ height: 100vh;
15
+ border: none;
16
+ z-index: 1;
17
+ }
18
+ `
19
+
20
+ export const StyledBox = styled(animated.div)`
21
+ background-color: ${props => props.theme.palette.mode === 'dark'
22
+ ? '#003366'
23
+ : props.theme.palette.background.paper};
24
+ background-image: ${props => props.theme.palette.mode === 'dark'
25
+ ? 'none'
26
+ : 'radial-gradient( circle farthest-corner at 10% 20%, #fdfbfb 0.1%, #ebedee 99.8% )'};
27
+ display: flex;
28
+ flex-direction: column;
29
+ align-items: center;
30
+ justify-content: flex-start;
31
+ height: 100%;
32
+ overflow: auto;
33
+ padding: 15vh ${props => props.theme.spacing(2)};
34
+ position: relative;
35
+ `
36
+
37
+ export const StyledBoxProfile = styled(animated.div)`
38
+ display: flex;
39
+ flex-direction: row;
40
+ align-items: center;
41
+ margin-bottom: 2rem
42
+ `
43
+
44
+ export const StyledBoxProfileEdit = styled(animated.div)`
45
+ display: flex;
46
+ `
47
+
48
+ export const StyledAvatarName = styled(Typography)`
49
+ color: ${props => props.theme.palette.mode === 'dark'
50
+ ? props.theme.palette.primary.contrastText
51
+ : props.theme.palette.text.primary};
52
+ font-size: 1.75rem;
53
+ `
54
+
55
+ export const StyledOutlineButton = styled(Button)`
56
+ border-color: ${props => props.theme.palette.mode === 'dark'
57
+ ? props.theme.palette.primary.contrastText
58
+ : props.theme.palette.primary.main};
59
+ color: ${props => props.theme.palette.mode === 'dark'
60
+ ? props.theme.palette.primary.contrastText
61
+ : props.theme.palette.primary.main};
62
+ `
63
+
64
+ export const StyledAvatar = styled(Avatar)`
65
+ background-color: ${props => props.theme.palette.mode === 'dark'
66
+ ? props.theme.palette.primary.contrastText
67
+ : props.theme.palette.primary.main};
68
+ color: ${props => props.theme.palette.mode === 'dark'
69
+ ? props.theme.palette.primary.main
70
+ : props.theme.palette.primary.contrastText};
71
+ font-size: 0.85rem;
72
+ `
73
+
74
+ export const StyledListItemButton = styled(ListItemButton)`
75
+ border-radius: 50px;
76
+ margin-inline-end: 2rem;
77
+ `