@sqrzro/admin 1.0.0-beta.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 (476) hide show
  1. package/.eslintrc +4 -0
  2. package/.gitattributes +1 -0
  3. package/.prettierrc +9 -0
  4. package/.storybook/main.js +40 -0
  5. package/.storybook/manager.js +4 -0
  6. package/.storybook/postcss.config.js +3 -0
  7. package/.storybook/preview.js +11 -0
  8. package/.storybook/theme.js +7 -0
  9. package/.stylelintrc +9 -0
  10. package/LICENSE +5 -0
  11. package/README.md +9 -0
  12. package/__mocks__/squarezero-utility.ts +40 -0
  13. package/assets/logo-horizontal-dark.svg +21 -0
  14. package/assets/logo-horizontal-white.svg +21 -0
  15. package/assets/logo-vertical-dark.svg +21 -0
  16. package/assets/logo-vertical-white.svg +21 -0
  17. package/dist/index.css +3554 -0
  18. package/dist/index.js +5099 -0
  19. package/dist/index.js.map +1 -0
  20. package/dist/types/components/Alert/index.d.ts +10 -0
  21. package/dist/types/components/Allow/index.d.ts +13 -0
  22. package/dist/types/components/App/index.d.ts +19 -0
  23. package/dist/types/components/AutoSuggest/index.d.ts +60 -0
  24. package/dist/types/components/Button/index.d.ts +36 -0
  25. package/dist/types/components/CalendarInput/index.d.ts +10 -0
  26. package/dist/types/components/CheckboxList/index.d.ts +4 -0
  27. package/dist/types/components/ConnectedDropdown/index.d.ts +8 -0
  28. package/dist/types/components/ConnectedList/index.d.ts +4 -0
  29. package/dist/types/components/ConnectedScene/index.d.ts +11 -0
  30. package/dist/types/components/ConnectedTable/index.d.ts +4 -0
  31. package/dist/types/components/ContentBlock/index.d.ts +6 -0
  32. package/dist/types/components/DateInput/index.d.ts +7 -0
  33. package/dist/types/components/Document/index.d.ts +6 -0
  34. package/dist/types/components/Dropdown/index.d.ts +14 -0
  35. package/dist/types/components/Fieldset/index.d.ts +11 -0
  36. package/dist/types/components/FileInput/index.d.ts +4 -0
  37. package/dist/types/components/FilterLink/index.d.ts +7 -0
  38. package/dist/types/components/Form/index.d.ts +11 -0
  39. package/dist/types/components/FormActions/index.d.ts +9 -0
  40. package/dist/types/components/FormField/index.d.ts +27 -0
  41. package/dist/types/components/FormRepeater/index.d.ts +8 -0
  42. package/dist/types/components/ImageInput/index.d.ts +4 -0
  43. package/dist/types/components/InfoPanel/index.d.ts +8 -0
  44. package/dist/types/components/Link/__mocks__/index.d.ts +6 -0
  45. package/dist/types/components/Link/index.d.ts +13 -0
  46. package/dist/types/components/List/index.d.ts +23 -0
  47. package/dist/types/components/ListActions/index.d.ts +9 -0
  48. package/dist/types/components/LoginForm/index.d.ts +3 -0
  49. package/dist/types/components/Message/index.d.ts +7 -0
  50. package/dist/types/components/ModalActions/index.d.ts +11 -0
  51. package/dist/types/components/MoneyInput/index.d.ts +10 -0
  52. package/dist/types/components/PasswordForm/index.d.ts +3 -0
  53. package/dist/types/components/PasswordInput/index.d.ts +8 -0
  54. package/dist/types/components/RadioList/index.d.ts +4 -0
  55. package/dist/types/components/Scene/index.d.ts +10 -0
  56. package/dist/types/components/SummaryList/index.d.ts +8 -0
  57. package/dist/types/components/Switch/index.d.ts +9 -0
  58. package/dist/types/components/Table/index.d.ts +13 -0
  59. package/dist/types/components/Tag/index.d.ts +8 -0
  60. package/dist/types/components/TextArea/index.d.ts +4 -0
  61. package/dist/types/components/TextInput/index.d.ts +17 -0
  62. package/dist/types/components/WebsiteInput/index.d.ts +10 -0
  63. package/dist/types/components/WeekCalendar/index.d.ts +12 -0
  64. package/dist/types/core/AppHeader/index.d.ts +3 -0
  65. package/dist/types/core/AppLogo/index.d.ts +6 -0
  66. package/dist/types/core/AppLogoImage/index.d.ts +3 -0
  67. package/dist/types/core/AppLogoPlaceholder/index.d.ts +3 -0
  68. package/dist/types/core/Assistive/index.d.ts +6 -0
  69. package/dist/types/core/Banner/index.d.ts +3 -0
  70. package/dist/types/core/BuildModal/index.d.ts +3 -0
  71. package/dist/types/core/Calendar/index.d.ts +11 -0
  72. package/dist/types/core/CalendarDay/index.d.ts +16 -0
  73. package/dist/types/core/CalendarMonth/index.d.ts +12 -0
  74. package/dist/types/core/CalendarNavigation/index.d.ts +9 -0
  75. package/dist/types/core/CalendarWeek/index.d.ts +14 -0
  76. package/dist/types/core/ChkRad/index.d.ts +10 -0
  77. package/dist/types/core/ChkRadIcon/index.d.ts +7 -0
  78. package/dist/types/core/ChkRadList/index.d.ts +15 -0
  79. package/dist/types/core/CloseButton/index.d.ts +9 -0
  80. package/dist/types/core/ConfirmModal/index.d.ts +3 -0
  81. package/dist/types/core/ConnectedRepeater/index.d.ts +26 -0
  82. package/dist/types/core/ConnectedRepeaterComponent/index.d.ts +24 -0
  83. package/dist/types/core/Container/index.d.ts +7 -0
  84. package/dist/types/core/DropdownPanel/index.d.ts +18 -0
  85. package/dist/types/core/EmptyMessage/index.d.ts +12 -0
  86. package/dist/types/core/ErrorBoundary/index.d.ts +15 -0
  87. package/dist/types/core/ErrorMessage/index.d.ts +8 -0
  88. package/dist/types/core/FilterItem/index.d.ts +10 -0
  89. package/dist/types/core/Filters/index.d.ts +11 -0
  90. package/dist/types/core/FixedActions/index.d.ts +12 -0
  91. package/dist/types/core/FormError/index.d.ts +6 -0
  92. package/dist/types/core/FormLabel/index.d.ts +8 -0
  93. package/dist/types/core/FormLegend/index.d.ts +6 -0
  94. package/dist/types/core/Header/index.d.ts +8 -0
  95. package/dist/types/core/Icon/index.d.ts +7 -0
  96. package/dist/types/core/IconButton/Icon/index.d.ts +7 -0
  97. package/dist/types/core/IconButton/index.d.ts +11 -0
  98. package/dist/types/core/InputPanel/index.d.ts +8 -0
  99. package/dist/types/core/ListItem/index.d.ts +16 -0
  100. package/dist/types/core/ListItemAction/index.d.ts +4 -0
  101. package/dist/types/core/ListItemActions/index.d.ts +8 -0
  102. package/dist/types/core/ListItemMetaItem/index.d.ts +10 -0
  103. package/dist/types/core/ListItemTitle/index.d.ts +9 -0
  104. package/dist/types/core/Loader/index.d.ts +6 -0
  105. package/dist/types/core/MeActions/index.d.ts +3 -0
  106. package/dist/types/core/MePanel/index.d.ts +9 -0
  107. package/dist/types/core/Modal/index.d.ts +12 -0
  108. package/dist/types/core/Navigation/index.d.ts +3 -0
  109. package/dist/types/core/NavigationDivider/index.d.ts +3 -0
  110. package/dist/types/core/NavigationItem/index.d.ts +7 -0
  111. package/dist/types/core/Pagination/index.d.ts +7 -0
  112. package/dist/types/core/PaginationItem/index.d.ts +7 -0
  113. package/dist/types/core/Panel/index.d.ts +8 -0
  114. package/dist/types/core/RadialProgress/index.d.ts +8 -0
  115. package/dist/types/core/StaticTextInput/index.d.ts +12 -0
  116. package/dist/types/core/Styled/index.d.ts +6 -0
  117. package/dist/types/core/SummaryListItem/index.d.ts +15 -0
  118. package/dist/types/core/TableActionsCell/index.d.ts +8 -0
  119. package/dist/types/core/TableCell/index.d.ts +8 -0
  120. package/dist/types/core/TableHead/index.d.ts +8 -0
  121. package/dist/types/core/TableRow/index.d.ts +13 -0
  122. package/dist/types/core/Tabs/index.d.ts +11 -0
  123. package/dist/types/core/TextInputAncillary/index.d.ts +11 -0
  124. package/dist/types/core/Toast/index.d.ts +3 -0
  125. package/dist/types/core/WeekCalendarDay/index.d.ts +14 -0
  126. package/dist/types/filters/BooleanFilter/index.d.ts +5 -0
  127. package/dist/types/filters/DateFilter/index.d.ts +5 -0
  128. package/dist/types/filters/DropdownFilter/index.d.ts +5 -0
  129. package/dist/types/filters/QuickDateFilter/index.d.ts +5 -0
  130. package/dist/types/filters/interfaces.d.ts +36 -0
  131. package/dist/types/hooks/useAccessiblePanel.d.ts +13 -0
  132. package/dist/types/hooks/useAppContext.d.ts +37 -0
  133. package/dist/types/hooks/useClickOutside.d.ts +3 -0
  134. package/dist/types/hooks/useConnectedList.d.ts +7 -0
  135. package/dist/types/hooks/useFilters.d.ts +3 -0
  136. package/dist/types/hooks/useForm.d.ts +26 -0
  137. package/dist/types/hooks/useFormData.d.ts +9 -0
  138. package/dist/types/hooks/useLayout.d.ts +6 -0
  139. package/dist/types/hooks/useModal.d.ts +12 -0
  140. package/dist/types/hooks/useVariant.d.ts +6 -0
  141. package/dist/types/index.d.ts +187 -0
  142. package/dist/types/scenes/Error404Scene.d.ts +3 -0
  143. package/dist/types/services/BuildService.d.ts +5 -0
  144. package/dist/types/services/ConfirmService.d.ts +12 -0
  145. package/dist/types/services/DateService.d.ts +17 -0
  146. package/dist/types/services/DownloadService.d.ts +5 -0
  147. package/dist/types/services/FilterComponentService.d.ts +8 -0
  148. package/dist/types/services/FilterService.d.ts +13 -0
  149. package/dist/types/services/FormatService.d.ts +7 -0
  150. package/dist/types/services/ToastService.d.ts +5 -0
  151. package/dist/types/utility/MockRouter/index.d.ts +2 -0
  152. package/dist/types/utility/StorybookPanel/index.d.ts +7 -0
  153. package/dist/types/utility/TestChangeHandler/index.d.ts +8 -0
  154. package/dist/types/utility/create-app.d.ts +4 -0
  155. package/dist/types/utility/interfaces.d.ts +72 -0
  156. package/dist/types/utility/prop-types.d.ts +40 -0
  157. package/docs/guides/01-installation.story.mdx +33 -0
  158. package/docs/guides/02-configuration.story.mdx +80 -0
  159. package/docs/guides/03-pages.story.mdx +18 -0
  160. package/docs/guides/04-integration.story.mdx +33 -0
  161. package/docs/guides/a11y.story.mdx +7 -0
  162. package/docs/guides/theming.story.mdx +7 -0
  163. package/docs/introduction.story.mdx +17 -0
  164. package/jest.config.js +19 -0
  165. package/package.json +101 -0
  166. package/postcss.config.js +3 -0
  167. package/rollup.config.js +36 -0
  168. package/scripts/create-exports.js +74 -0
  169. package/scripts/update-license.js +8 -0
  170. package/squarezero.config.js +5 -0
  171. package/src/components/Alert/Alert.module.css +50 -0
  172. package/src/components/Alert/Alert.spec.tsx +63 -0
  173. package/src/components/Alert/Alert.story.tsx +23 -0
  174. package/src/components/Alert/index.tsx +67 -0
  175. package/src/components/Allow/Allow.spec.tsx +37 -0
  176. package/src/components/Allow/index.tsx +42 -0
  177. package/src/components/App/App.module.css +22 -0
  178. package/src/components/App/App.spec.tsx +128 -0
  179. package/src/components/App/index.tsx +108 -0
  180. package/src/components/AutoSuggest/AutoSuggest.module.css +8 -0
  181. package/src/components/AutoSuggest/AutoSuggest.spec.tsx +211 -0
  182. package/src/components/AutoSuggest/AutoSuggest.story.tsx +30 -0
  183. package/src/components/AutoSuggest/index.tsx +216 -0
  184. package/src/components/Button/Button.module.css +95 -0
  185. package/src/components/Button/Button.spec.tsx +69 -0
  186. package/src/components/Button/Button.story.tsx +39 -0
  187. package/src/components/Button/index.tsx +99 -0
  188. package/src/components/CalendarInput/CalendarInput.module.css +8 -0
  189. package/src/components/CalendarInput/CalendarInput.spec.tsx +206 -0
  190. package/src/components/CalendarInput/CalendarInput.story.tsx +62 -0
  191. package/src/components/CalendarInput/index.tsx +122 -0
  192. package/src/components/CheckboxList/CheckboxList.spec.tsx +83 -0
  193. package/src/components/CheckboxList/index.tsx +53 -0
  194. package/src/components/ConnectedDropdown/index.tsx +56 -0
  195. package/src/components/ConnectedList/index.tsx +15 -0
  196. package/src/components/ConnectedScene/index.tsx +95 -0
  197. package/src/components/ConnectedTable/index.tsx +17 -0
  198. package/src/components/ContentBlock/ContentBlock.module.css +8 -0
  199. package/src/components/ContentBlock/ContentBlock.spec.tsx +15 -0
  200. package/src/components/ContentBlock/index.tsx +16 -0
  201. package/src/components/DateInput/DateInput.module.css +15 -0
  202. package/src/components/DateInput/DateInput.spec.tsx +91 -0
  203. package/src/components/DateInput/index.tsx +149 -0
  204. package/src/components/Document/index.tsx +20 -0
  205. package/src/components/Dropdown/Dropdown.module.css +8 -0
  206. package/src/components/Dropdown/Dropdown.spec.tsx +286 -0
  207. package/src/components/Dropdown/Dropdown.story.tsx +53 -0
  208. package/src/components/Dropdown/index.tsx +224 -0
  209. package/src/components/Fieldset/Fieldset.spec.tsx +22 -0
  210. package/src/components/Fieldset/Fieldset.story.tsx +21 -0
  211. package/src/components/Fieldset/index.tsx +30 -0
  212. package/src/components/FileInput/FileInput.module.css +18 -0
  213. package/src/components/FileInput/FileInput.spec.tsx +42 -0
  214. package/src/components/FileInput/FileInput.story.tsx +6 -0
  215. package/src/components/FileInput/index.tsx +72 -0
  216. package/src/components/FilterLink/FilterLink.module.css +9 -0
  217. package/src/components/FilterLink/FilterLink.spec.tsx +20 -0
  218. package/src/components/FilterLink/index.tsx +31 -0
  219. package/src/components/Form/Form.spec.tsx +68 -0
  220. package/src/components/Form/index.tsx +87 -0
  221. package/src/components/FormActions/FormActions.spec.tsx +10 -0
  222. package/src/components/FormActions/FormActions.story.tsx +23 -0
  223. package/src/components/FormActions/index.tsx +31 -0
  224. package/src/components/FormField/FormField.module.css +71 -0
  225. package/src/components/FormField/FormField.spec.tsx +137 -0
  226. package/src/components/FormField/FormField.story.tsx +22 -0
  227. package/src/components/FormField/index.tsx +162 -0
  228. package/src/components/FormRepeater/FormRepeater.module.css +3 -0
  229. package/src/components/FormRepeater/FormRepeater.spec.tsx +127 -0
  230. package/src/components/FormRepeater/index.tsx +118 -0
  231. package/src/components/ImageInput/ImageInput.module.css +74 -0
  232. package/src/components/ImageInput/ImageInput.spec.tsx +45 -0
  233. package/src/components/ImageInput/ImageInput.story.tsx +6 -0
  234. package/src/components/ImageInput/index.tsx +91 -0
  235. package/src/components/InfoPanel/InfoPanel.module.css +18 -0
  236. package/src/components/InfoPanel/InfoPanel.spec.tsx +15 -0
  237. package/src/components/InfoPanel/InfoPanel.story.tsx +32 -0
  238. package/src/components/InfoPanel/index.tsx +25 -0
  239. package/src/components/Link/Link.spec.tsx +62 -0
  240. package/src/components/Link/__mocks__/index.tsx +24 -0
  241. package/src/components/Link/index.tsx +51 -0
  242. package/src/components/List/List.module.css +9 -0
  243. package/src/components/List/List.spec.tsx +311 -0
  244. package/src/components/List/List.story.tsx +92 -0
  245. package/src/components/List/index.tsx +79 -0
  246. package/src/components/ListActions/ListActions.spec.tsx +10 -0
  247. package/src/components/ListActions/ListActions.story.tsx +6 -0
  248. package/src/components/ListActions/index.tsx +31 -0
  249. package/src/components/LoginForm/LoginForm.module.css +21 -0
  250. package/src/components/LoginForm/LoginForm.spec.tsx +63 -0
  251. package/src/components/LoginForm/index.tsx +102 -0
  252. package/src/components/Message/Message.module.css +14 -0
  253. package/src/components/Message/Message.spec.tsx +20 -0
  254. package/src/components/Message/index.tsx +27 -0
  255. package/src/components/ModalActions/ModalActions.module.css +5 -0
  256. package/src/components/ModalActions/ModalActions.spec.tsx +53 -0
  257. package/src/components/ModalActions/ModalActions.story.tsx +6 -0
  258. package/src/components/ModalActions/index.tsx +47 -0
  259. package/src/components/MoneyInput/MoneyInput.spec.tsx +17 -0
  260. package/src/components/MoneyInput/MoneyInput.story.tsx +6 -0
  261. package/src/components/MoneyInput/index.tsx +16 -0
  262. package/src/components/PasswordForm/PasswordForm.module.css +21 -0
  263. package/src/components/PasswordForm/index.tsx +94 -0
  264. package/src/components/PasswordInput/PasswordInput.module.css +23 -0
  265. package/src/components/PasswordInput/PasswordInput.spec.tsx +31 -0
  266. package/src/components/PasswordInput/PasswordInput.story.tsx +16 -0
  267. package/src/components/PasswordInput/index.tsx +27 -0
  268. package/src/components/RadioList/RadioList.spec.tsx +45 -0
  269. package/src/components/RadioList/index.tsx +10 -0
  270. package/src/components/Scene/Scene.spec.tsx +123 -0
  271. package/src/components/Scene/Scene.story.tsx +6 -0
  272. package/src/components/Scene/index.tsx +58 -0
  273. package/src/components/SummaryList/SummaryList.module.css +16 -0
  274. package/src/components/SummaryList/SummaryList.spec.tsx +77 -0
  275. package/src/components/SummaryList/SummaryList.story.tsx +11 -0
  276. package/src/components/SummaryList/index.tsx +37 -0
  277. package/src/components/Switch/Switch.module.css +86 -0
  278. package/src/components/Switch/Switch.spec.tsx +64 -0
  279. package/src/components/Switch/index.tsx +85 -0
  280. package/src/components/Table/Table.module.css +14 -0
  281. package/src/components/Table/Table.spec.tsx +128 -0
  282. package/src/components/Table/Table.story.tsx +101 -0
  283. package/src/components/Table/index.tsx +114 -0
  284. package/src/components/Tag/Tag.module.css +37 -0
  285. package/src/components/Tag/Tag.spec.tsx +10 -0
  286. package/src/components/Tag/Tag.story.tsx +55 -0
  287. package/src/components/Tag/index.tsx +27 -0
  288. package/src/components/TextArea/TextArea.module.css +23 -0
  289. package/src/components/TextArea/TextArea.spec.tsx +77 -0
  290. package/src/components/TextArea/index.tsx +59 -0
  291. package/src/components/TextInput/TextInput.module.css +57 -0
  292. package/src/components/TextInput/TextInput.spec.tsx +134 -0
  293. package/src/components/TextInput/TextInput.story.tsx +24 -0
  294. package/src/components/TextInput/index.tsx +146 -0
  295. package/src/components/WebsiteInput/WebsiteInput.spec.tsx +17 -0
  296. package/src/components/WebsiteInput/index.tsx +16 -0
  297. package/src/components/WeekCalendar/WeekCalendar.module.css +19 -0
  298. package/src/components/WeekCalendar/index.tsx +80 -0
  299. package/src/core/AppHeader/index.tsx +23 -0
  300. package/src/core/AppLogo/AppLogo.module.css +19 -0
  301. package/src/core/AppLogo/index.tsx +33 -0
  302. package/src/core/AppLogoImage/index.tsx +19 -0
  303. package/src/core/AppLogoPlaceholder/index.tsx +26 -0
  304. package/src/core/Assistive/Assistive.module.css +10 -0
  305. package/src/core/Assistive/index.tsx +18 -0
  306. package/src/core/Banner/Banner.module.css +36 -0
  307. package/src/core/Banner/index.tsx +25 -0
  308. package/src/core/BuildModal/index.tsx +119 -0
  309. package/src/core/Calendar/index.tsx +116 -0
  310. package/src/core/CalendarDay/CalendarDay.module.css +61 -0
  311. package/src/core/CalendarDay/index.tsx +82 -0
  312. package/src/core/CalendarMonth/CalendarMonth.module.css +13 -0
  313. package/src/core/CalendarMonth/index.tsx +101 -0
  314. package/src/core/CalendarNavigation/CalendarNavigation.module.css +26 -0
  315. package/src/core/CalendarNavigation/index.tsx +56 -0
  316. package/src/core/CalendarWeek/index.tsx +95 -0
  317. package/src/core/ChkRad/ChkRad.module.css +31 -0
  318. package/src/core/ChkRad/ChkRad.spec.tsx +72 -0
  319. package/src/core/ChkRad/index.tsx +80 -0
  320. package/src/core/ChkRadIcon/ChkRadIcon.module.css +28 -0
  321. package/src/core/ChkRadIcon/index.tsx +33 -0
  322. package/src/core/ChkRadList/ChkRadList.module.css +10 -0
  323. package/src/core/ChkRadList/index.tsx +85 -0
  324. package/src/core/CloseButton/CloseButton.spec.tsx +36 -0
  325. package/src/core/CloseButton/index.tsx +31 -0
  326. package/src/core/ConfirmModal/ConfirmModal.spec.tsx +88 -0
  327. package/src/core/ConfirmModal/index.tsx +51 -0
  328. package/src/core/ConnectedRepeater/index.tsx +248 -0
  329. package/src/core/ConnectedRepeaterComponent/index.tsx +66 -0
  330. package/src/core/Container/Container.module.css +12 -0
  331. package/src/core/Container/index.tsx +35 -0
  332. package/src/core/DropdownPanel/DropdownPanel.module.css +68 -0
  333. package/src/core/DropdownPanel/index.tsx +92 -0
  334. package/src/core/EmptyMessage/EmptyMessage.module.css +18 -0
  335. package/src/core/EmptyMessage/index.tsx +31 -0
  336. package/src/core/ErrorBoundary/ErrorBoundary.spec.tsx +33 -0
  337. package/src/core/ErrorBoundary/index.tsx +42 -0
  338. package/src/core/ErrorMessage/ErrorMessage.module.css +25 -0
  339. package/src/core/ErrorMessage/ErrorMessage.spec.tsx +31 -0
  340. package/src/core/ErrorMessage/index.tsx +37 -0
  341. package/src/core/FilterItem/FilterItem.module.css +104 -0
  342. package/src/core/FilterItem/index.tsx +164 -0
  343. package/src/core/Filters/Filters.module.css +86 -0
  344. package/src/core/Filters/Filters.spec.tsx +533 -0
  345. package/src/core/Filters/index.tsx +158 -0
  346. package/src/core/FixedActions/FixedActions.module.css +24 -0
  347. package/src/core/FixedActions/index.tsx +52 -0
  348. package/src/core/FormError/FormError.module.css +7 -0
  349. package/src/core/FormError/index.tsx +18 -0
  350. package/src/core/FormLabel/FormLabel.module.css +15 -0
  351. package/src/core/FormLabel/index.tsx +25 -0
  352. package/src/core/FormLegend/FormLegend.module.css +13 -0
  353. package/src/core/FormLegend/index.tsx +18 -0
  354. package/src/core/Header/Header.module.css +35 -0
  355. package/src/core/Header/index.tsx +37 -0
  356. package/src/core/Icon/Icon.spec.tsx +31 -0
  357. package/src/core/Icon/index.tsx +64 -0
  358. package/src/core/IconButton/Icon/Icon.spec.tsx +31 -0
  359. package/src/core/IconButton/Icon/index.tsx +64 -0
  360. package/src/core/IconButton/IconButton.module.css +32 -0
  361. package/src/core/IconButton/index.tsx +55 -0
  362. package/src/core/InputPanel/InputPanel.module.css +70 -0
  363. package/src/core/InputPanel/index.tsx +28 -0
  364. package/src/core/ListItem/ListItem.module.css +28 -0
  365. package/src/core/ListItem/ListItem.story.tsx +28 -0
  366. package/src/core/ListItem/index.tsx +99 -0
  367. package/src/core/ListItemAction/ListItemAction.module.css +28 -0
  368. package/src/core/ListItemAction/index.tsx +30 -0
  369. package/src/core/ListItemActions/ListItemActions.module.css +94 -0
  370. package/src/core/ListItemActions/index.tsx +55 -0
  371. package/src/core/ListItemMetaItem/ListItemMetaItem.module.css +18 -0
  372. package/src/core/ListItemMetaItem/index.tsx +54 -0
  373. package/src/core/ListItemTitle/ListItemTitle.module.css +14 -0
  374. package/src/core/ListItemTitle/ListItemTitle.spec.tsx +33 -0
  375. package/src/core/ListItemTitle/index.tsx +72 -0
  376. package/src/core/Loader/Loader.module.css +57 -0
  377. package/src/core/Loader/Loader.story.tsx +8 -0
  378. package/src/core/Loader/index.tsx +27 -0
  379. package/src/core/MeActions/MeActions.module.css +45 -0
  380. package/src/core/MeActions/index.tsx +46 -0
  381. package/src/core/MePanel/MePanel.module.css +75 -0
  382. package/src/core/MePanel/index.tsx +45 -0
  383. package/src/core/Modal/Modal.module.css +84 -0
  384. package/src/core/Modal/Modal.spec.tsx +51 -0
  385. package/src/core/Modal/index.tsx +66 -0
  386. package/src/core/Navigation/Navigation.module.css +83 -0
  387. package/src/core/Navigation/Navigation.spec.tsx +101 -0
  388. package/src/core/Navigation/index.tsx +109 -0
  389. package/src/core/NavigationDivider/NavigationDivider.module.css +18 -0
  390. package/src/core/NavigationDivider/index.tsx +13 -0
  391. package/src/core/NavigationItem/NavigationItem.module.css +51 -0
  392. package/src/core/NavigationItem/index.tsx +59 -0
  393. package/src/core/Pagination/Pagination.module.css +15 -0
  394. package/src/core/Pagination/index.tsx +100 -0
  395. package/src/core/PaginationItem/PaginationItem.module.css +33 -0
  396. package/src/core/PaginationItem/index.tsx +46 -0
  397. package/src/core/Panel/Panel.module.css +15 -0
  398. package/src/core/Panel/index.tsx +31 -0
  399. package/src/core/RadialProgress/RadialProgress.module.css +78 -0
  400. package/src/core/RadialProgress/index.tsx +52 -0
  401. package/src/core/StaticTextInput/StaticTextInput.module.css +79 -0
  402. package/src/core/StaticTextInput/StaticTextInput.spec.tsx +133 -0
  403. package/src/core/StaticTextInput/index.tsx +114 -0
  404. package/src/core/Styled/Styled.spec.tsx +38 -0
  405. package/src/core/Styled/Styled.story.tsx +10 -0
  406. package/src/core/Styled/index.tsx +62 -0
  407. package/src/core/SummaryListItem/SummaryListItem.module.css +28 -0
  408. package/src/core/SummaryListItem/index.tsx +60 -0
  409. package/src/core/TableActionsCell/TableActionsCell.module.css +3 -0
  410. package/src/core/TableActionsCell/index.tsx +37 -0
  411. package/src/core/TableCell/TableCell.module.css +16 -0
  412. package/src/core/TableCell/index.tsx +39 -0
  413. package/src/core/TableHead/TableHead.module.css +12 -0
  414. package/src/core/TableHead/index.tsx +48 -0
  415. package/src/core/TableRow/index.tsx +64 -0
  416. package/src/core/Tabs/Tabs.module.css +50 -0
  417. package/src/core/Tabs/index.tsx +94 -0
  418. package/src/core/TextInputAncillary/TextInputAncillary.module.css +64 -0
  419. package/src/core/TextInputAncillary/index.tsx +72 -0
  420. package/src/core/Toast/Toast.module.css +55 -0
  421. package/src/core/Toast/Toast.spec.tsx +78 -0
  422. package/src/core/Toast/index.tsx +81 -0
  423. package/src/core/WeekCalendarDay/WeekCalendarDay.module.css +32 -0
  424. package/src/core/WeekCalendarDay/index.tsx +68 -0
  425. package/src/filters/BooleanFilter/index.tsx +46 -0
  426. package/src/filters/DateFilter/index.tsx +36 -0
  427. package/src/filters/DropdownFilter/index.tsx +53 -0
  428. package/src/filters/QuickDateFilter/index.tsx +74 -0
  429. package/src/filters/interfaces.ts +40 -0
  430. package/src/hooks/useAccessiblePanel.spec.tsx +88 -0
  431. package/src/hooks/useAccessiblePanel.ts +74 -0
  432. package/src/hooks/useAppContext.ts +77 -0
  433. package/src/hooks/useClickOutside.ts +49 -0
  434. package/src/hooks/useConnectedList.ts +26 -0
  435. package/src/hooks/useFilters.ts +26 -0
  436. package/src/hooks/useForm.spec.ts +126 -0
  437. package/src/hooks/useForm.ts +99 -0
  438. package/src/hooks/useFormData.spec.ts +40 -0
  439. package/src/hooks/useFormData.ts +27 -0
  440. package/src/hooks/useLayout.spec.ts +55 -0
  441. package/src/hooks/useLayout.ts +29 -0
  442. package/src/hooks/useModal.spec.tsx +63 -0
  443. package/src/hooks/useModal.ts +60 -0
  444. package/src/hooks/useVariant.spec.ts +14 -0
  445. package/src/hooks/useVariant.ts +34 -0
  446. package/src/index.ts +194 -0
  447. package/src/scenes/Error404Scene.tsx +5 -0
  448. package/src/services/BuildService.spec.ts +56 -0
  449. package/src/services/BuildService.ts +34 -0
  450. package/src/services/ConfirmService.ts +21 -0
  451. package/src/services/DateService.spec.ts +87 -0
  452. package/src/services/DateService.ts +137 -0
  453. package/src/services/DownloadService.spec.ts +29 -0
  454. package/src/services/DownloadService.ts +14 -0
  455. package/src/services/FilterComponentService.tsx +46 -0
  456. package/src/services/FilterService.spec.ts +87 -0
  457. package/src/services/FilterService.ts +58 -0
  458. package/src/services/FormatService.spec.ts +83 -0
  459. package/src/services/FormatService.ts +55 -0
  460. package/src/services/ToastService.spec.ts +44 -0
  461. package/src/services/ToastService.ts +19 -0
  462. package/src/styles/layout.css +64 -0
  463. package/src/styles/variables.css +85 -0
  464. package/src/typings.d.ts +4 -0
  465. package/src/utility/MockRouter/index.ts +45 -0
  466. package/src/utility/StorybookPanel/StorybookPanel.module.css +9 -0
  467. package/src/utility/StorybookPanel/index.tsx +25 -0
  468. package/src/utility/TestChangeHandler/TestChangeHandler.module.css +7 -0
  469. package/src/utility/TestChangeHandler/TestChangeHandler.spec.tsx +24 -0
  470. package/src/utility/TestChangeHandler/index.tsx +54 -0
  471. package/src/utility/create-app.tsx +29 -0
  472. package/src/utility/interfaces.ts +119 -0
  473. package/src/utility/prop-types.ts +67 -0
  474. package/tests/setupFilesAfterEnv.js +10 -0
  475. package/tsconfig.json +26 -0
  476. package/tsconfig.types.json +9 -0
@@ -0,0 +1,134 @@
1
+ import React from 'react';
2
+ import { render, screen } from '@testing-library/react';
3
+ import userEvent from '@testing-library/user-event';
4
+
5
+ import TestChangeHandler from '@utility/TestChangeHandler';
6
+
7
+ import TextInput from './index';
8
+
9
+ describe('TextInput', () => {
10
+ it('should render', () => {
11
+ render(<TextInput name="lorem" />);
12
+ });
13
+
14
+ it('should handle onChange', () => {
15
+ render(
16
+ <TestChangeHandler>
17
+ <TextInput name="lorem" />
18
+ </TestChangeHandler>
19
+ );
20
+
21
+ userEvent.type(screen.getByRole('textbox'), 'lorem');
22
+
23
+ expect(screen.getByRole('textbox')).toHaveValue('lorem');
24
+ expect(screen.getByTestId('test-change-handler-value')).toHaveTextContent('lorem');
25
+ });
26
+
27
+ it('should handle change if no onChange', () => {
28
+ const mockFn = jest.fn();
29
+ render(<TextInput name="lorem" />);
30
+
31
+ expect(mockFn).toHaveBeenCalledTimes(0);
32
+
33
+ const input = screen.getByRole('textbox');
34
+ userEvent.type(input, 'lorem');
35
+
36
+ expect(mockFn).toHaveBeenCalledTimes(0);
37
+ });
38
+
39
+ it('should render disabled', () => {
40
+ render(<TextInput name="lorem" isDisabled />);
41
+
42
+ expect(screen.getByRole('textbox')).toBeDisabled();
43
+ expect(screen.getByTestId('text-input-root')).toHaveClass('root rootIsDisabled');
44
+ });
45
+
46
+ it('should render prefix', () => {
47
+ render(<TextInput name="lorem" prefix="LOREM" />);
48
+
49
+ expect(screen.getByTestId('text-input-root')).toHaveClass('root rootHasPrefix');
50
+ expect(screen.queryByText('LOREM')).toHaveClass('prefix');
51
+ });
52
+
53
+ it('should render suffix', () => {
54
+ render(<TextInput name="lorem" suffix="LOREM" />);
55
+
56
+ expect(screen.getByTestId('text-input-root')).toHaveClass('root rootHasSuffix');
57
+ expect(screen.queryByText('LOREM')).toHaveClass('suffix');
58
+ });
59
+
60
+ it('should handle prefix and suffix', () => {
61
+ render(<TextInput name="lorem" prefix="LOREM" suffix="LOREM" />);
62
+
63
+ expect(screen.getByTestId('text-input-root')).toHaveClass('root rootHasPrefix');
64
+ expect(screen.queryByText('LOREM')).toHaveClass('prefix');
65
+ });
66
+
67
+ it('should render no autocomplete', () => {
68
+ render(<TextInput autocomplete={false} name="lorem" />);
69
+ expect(screen.getByRole('textbox')).toHaveAttribute('autocomplete', 'off');
70
+ });
71
+
72
+ it('should have custom id', () => {
73
+ render(<TextInput id="ipsum" name="lorem" />);
74
+ expect(screen.getByRole('textbox')).toHaveAttribute('id', 'ipsum');
75
+ });
76
+
77
+ it('should render loading', () => {
78
+ render(<TextInput name="lorem" isLoading />);
79
+ expect(screen.getByText('Loading...')).toBeInTheDocument();
80
+ });
81
+
82
+ it('should render placeholder', () => {
83
+ render(<TextInput name="lorem" placeholder="lorem" />);
84
+ expect(screen.getByRole('textbox')).toHaveAttribute('placeholder', 'lorem');
85
+ });
86
+
87
+ it('should have error', () => {
88
+ render(<TextInput name="lorem" hasError />);
89
+ expect(screen.getByRole('textbox')).toHaveClass('input inputHasError');
90
+ });
91
+
92
+ it('should have prefix and error', () => {
93
+ render(<TextInput name="lorem" prefix="LOREM" hasError />);
94
+ expect(screen.queryByText('LOREM')).toHaveClass('hasError');
95
+ });
96
+
97
+ it('should have suffix and error', () => {
98
+ render(<TextInput name="lorem" suffix="LOREM" hasError />);
99
+ expect(screen.queryByText('LOREM')).toHaveClass('hasError');
100
+ });
101
+
102
+ it('should have clear button and error', () => {
103
+ render(<TextInput name="lorem" value="Lorem" hasError isClearable />);
104
+ expect(screen.getByTestId('text-input-ancillary-clear')).toHaveClass('hasError');
105
+ });
106
+
107
+ it('should handle onclear', () => {
108
+ const mockFn = jest.fn();
109
+ render(<TextInput name="lorem" onClear={mockFn} value="Lorem" isClearable />);
110
+
111
+ expect(mockFn).toHaveBeenCalledTimes(0);
112
+ userEvent.click(screen.getByText('Clear'));
113
+ expect(mockFn).toHaveBeenCalledTimes(1);
114
+ expect(mockFn).toHaveBeenLastCalledWith({ target: { name: 'lorem', value: '' } });
115
+ });
116
+
117
+ it('should handle onclear with onchange', () => {
118
+ const mockFn = jest.fn();
119
+ render(<TextInput name="lorem" onChange={mockFn} value="Lorem" isClearable />);
120
+
121
+ expect(mockFn).toHaveBeenCalledTimes(0);
122
+ userEvent.click(screen.getByText('Clear'));
123
+ expect(mockFn).toHaveBeenCalledTimes(1);
124
+ expect(mockFn).toHaveBeenLastCalledWith({ target: { name: 'lorem', value: '' } });
125
+ });
126
+
127
+ it('should handle onclear with no onchange', () => {
128
+ const mockFn = jest.fn();
129
+ render(<TextInput name="lorem" value="Lorem" isClearable />);
130
+
131
+ userEvent.click(screen.getByText('Clear'));
132
+ expect(mockFn).toHaveBeenCalledTimes(0);
133
+ });
134
+ });
@@ -0,0 +1,24 @@
1
+ import React from 'react';
2
+ import TextInput from './index';
3
+
4
+ import TestChangeHandler from '@utility/TestChangeHandler';
5
+
6
+ export default {
7
+ title: 'Components/TextInput',
8
+ component: TextInput,
9
+ decorators: [
10
+ (storyFn: () => React.ReactElement): React.ReactElement => (
11
+ <TestChangeHandler>{storyFn()}</TestChangeHandler>
12
+ ),
13
+ ],
14
+ };
15
+
16
+ export const Basic = (): React.ReactElement => <TextInput name="lorem" />;
17
+
18
+ export const WithError = (): React.ReactElement => <TextInput name="lorem" hasError />;
19
+
20
+ export const WithLoading = (): React.ReactElement => <TextInput name="lorem" isLoading />;
21
+
22
+ export const WithPlaceholder = (): React.ReactElement => (
23
+ <TextInput name="lorem" placeholder="Lorem Ipsum" />
24
+ );
@@ -0,0 +1,146 @@
1
+ import React from 'react';
2
+ import classNames from 'classnames';
3
+ import PropTypes from 'prop-types';
4
+
5
+ import TextInputAncillary from '@core/TextInputAncillary';
6
+
7
+ import type { InputProps, InputValue, SimpleEventHandler } from '@utility/interfaces';
8
+
9
+ import styles from './TextInput.module.css';
10
+
11
+ export interface TextInputProps
12
+ extends InputProps<InputValue, HTMLInputElement | HTMLTextAreaElement> {
13
+ autocomplete?: boolean;
14
+ isClearable?: boolean;
15
+ isLoading?: boolean;
16
+ onClear?: SimpleEventHandler;
17
+ placeholder?: string;
18
+ prefix?: string | null;
19
+ suffix?: string | null;
20
+ type?: string;
21
+ }
22
+
23
+ /**
24
+ * A customisable text input component.
25
+ */
26
+ const TextInput: React.FunctionComponent<TextInputProps> = ({
27
+ autocomplete,
28
+ hasError,
29
+ id,
30
+ isClearable,
31
+ isDisabled,
32
+ isLoading,
33
+ name,
34
+ onChange,
35
+ onClear,
36
+ onKeyDown,
37
+ placeholder,
38
+ prefix,
39
+ suffix,
40
+ value,
41
+ type,
42
+ }) => {
43
+ const handleChange = (event: React.ChangeEvent): void => {
44
+ const target = event.target as HTMLInputElement;
45
+ const simpleEvent = { target: { name, value: target.value } };
46
+
47
+ if (onChange) {
48
+ onChange(simpleEvent);
49
+ }
50
+ };
51
+
52
+ const handleClear = (): void => {
53
+ const simpleEvent = { target: { name, value: '' } };
54
+
55
+ if (onClear) {
56
+ onClear(simpleEvent);
57
+ return;
58
+ }
59
+
60
+ if (onChange) {
61
+ onChange(simpleEvent);
62
+ }
63
+ };
64
+
65
+ return (
66
+ <div
67
+ className={classNames(
68
+ styles.root,
69
+ prefix && styles.rootHasPrefix,
70
+ ((!prefix && suffix) || (isClearable && value)) && styles.rootHasSuffix,
71
+ isDisabled && styles.rootIsDisabled
72
+ )}
73
+ data-testid="text-input-root"
74
+ >
75
+ <input
76
+ autoComplete={
77
+ autocomplete === false
78
+ ? 'off'
79
+ : undefined /* eslint-disable-line no-undefined */
80
+ }
81
+ className={classNames(
82
+ styles.input,
83
+ hasError && styles.inputHasError,
84
+ prefix && styles.inputHasPrefix,
85
+ ((!prefix && suffix) || (isClearable && value)) && styles.inputHasSuffix
86
+ )}
87
+ disabled={isDisabled}
88
+ id={id || `c_${name}`}
89
+ name={name}
90
+ onChange={handleChange}
91
+ onKeyDown={onKeyDown}
92
+ placeholder={placeholder}
93
+ type={type}
94
+ value={value?.toString() || ''}
95
+ />
96
+ <TextInputAncillary
97
+ hasError={hasError}
98
+ isClearable={isClearable}
99
+ isLoading={isLoading}
100
+ name={name}
101
+ onClear={handleClear}
102
+ prefix={prefix}
103
+ suffix={suffix}
104
+ value={value}
105
+ />
106
+ </div>
107
+ );
108
+ };
109
+
110
+ TextInput.propTypes = {
111
+ /** The name of the field. An ID is also generated from this (`c_${name}`). */
112
+ name: PropTypes.string.isRequired,
113
+
114
+ /**
115
+ * Whether or not the browser's autocomplete should be enabled. This can interfere with
116
+ * components like `AutoSuggest`, so it is recommended to set this to false in these instances.
117
+ */
118
+ autocomplete: PropTypes.bool,
119
+
120
+ /** If set to true, the `TextInput` will be styled to indicate this */
121
+ hasError: PropTypes.bool,
122
+
123
+ id: PropTypes.string,
124
+
125
+ /** If set to true, and the input has a value, a control to clear the input is displayed */
126
+ isClearable: PropTypes.bool,
127
+
128
+ /** If set to true, the input and any associated controls are disabled */
129
+ isDisabled: PropTypes.bool,
130
+
131
+ /**
132
+ * For uses of `TextInput` that involve an asynchronous process, setting this to true will add a
133
+ * mini version of the `Loader` component, to indicate that a process is taking place
134
+ */
135
+ isLoading: PropTypes.bool,
136
+ placeholder: PropTypes.string,
137
+ prefix: PropTypes.string,
138
+ suffix: PropTypes.string,
139
+ type: PropTypes.string,
140
+ value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
141
+ onChange: PropTypes.func,
142
+ onClear: PropTypes.func,
143
+ onKeyDown: PropTypes.func,
144
+ };
145
+
146
+ export default TextInput;
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ import { render, screen } from '@testing-library/react';
3
+
4
+ import WebsiteInput from './index';
5
+
6
+ describe('WebsiteInput', () => {
7
+ it('should render', () => {
8
+ render(<WebsiteInput name="lorem" />);
9
+ });
10
+
11
+ it('should render prefix', () => {
12
+ render(<WebsiteInput name="lorem" />);
13
+
14
+ expect(screen.getByTestId('text-input-root')).toHaveClass('root rootHasPrefix');
15
+ expect(screen.queryByText('http://')).toHaveClass('prefix');
16
+ });
17
+ });
@@ -0,0 +1,16 @@
1
+ import React from 'react';
2
+
3
+ import TextInput from '@components/TextInput';
4
+ import type { TextInputProps } from '@components/TextInput';
5
+
6
+ /**
7
+ * A `TextInput` component with a pre-defined `prefix` prop set to a 'http://'. All other props are
8
+ * simply passed through to the TextInput. Technically, the order of the props is such that the
9
+ * prefix can be overridden or removed all together. If this is the case, the component is no
10
+ * different to a `TextInput`.
11
+ */
12
+ const WebsiteInput: React.FunctionComponent<TextInputProps> = (props) => (
13
+ <TextInput prefix="http://" {...props} />
14
+ );
15
+
16
+ export default WebsiteInput;
@@ -0,0 +1,19 @@
1
+ .root {
2
+ display: flex;
3
+ justify-content: space-between;
4
+ }
5
+
6
+ .scale {
7
+ background-color: var(--clr-white);
8
+ border-radius: .5rem;
9
+ padding-top: 3.2rem;
10
+ width: 6rem;
11
+ }
12
+
13
+ .hour {
14
+ color: var(--clr-grey700);
15
+ font-size: var(--fs-sml);
16
+ font-weight: var(--fw-bold);
17
+ height: 6rem;
18
+ text-align: center;
19
+ }
@@ -0,0 +1,80 @@
1
+ import React, { useMemo } from 'react';
2
+ import { addDays, getWeek } from 'date-fns';
3
+ import PropTypes from 'prop-types';
4
+
5
+ import FormatService from '@services/FormatService';
6
+
7
+ import WeekCalendarDay from '@core/WeekCalendarDay';
8
+
9
+ import styles from './WeekCalendar.module.css';
10
+
11
+ /*
12
+ * This function gets the first date of a week number. It 'Just Works', but it uses a lot of magic
13
+ * numbers, so it's easiest to just disable the eslint rule.
14
+ */
15
+ /* eslint-disable @typescript-eslint/no-magic-numbers */
16
+ const getFirstDayOfWeek = (week: number, year: number): Date => {
17
+ const weekInDays = 7 * week;
18
+ const firstDayOfWeek = new Date(year, 0, weekInDays - 6);
19
+ const dow = firstDayOfWeek.getDay();
20
+ const ISOweekStart = firstDayOfWeek;
21
+
22
+ if (dow <= 4) {
23
+ ISOweekStart.setDate(firstDayOfWeek.getDate() - firstDayOfWeek.getDay() + 1);
24
+ } else {
25
+ ISOweekStart.setDate(firstDayOfWeek.getDate() + 8 - firstDayOfWeek.getDay());
26
+ }
27
+
28
+ return ISOweekStart;
29
+ };
30
+ /* eslint-enable */
31
+
32
+ const formatHour = (hour: number): string => `${FormatService.twoDigits(hour)}00`;
33
+
34
+ const DAYS_IN_WEEK = 7;
35
+ const FIRST_HOUR = 8;
36
+
37
+ interface WeekCalendarProps {
38
+ data: { id: number; datetime: string; patient: { name: string } }[];
39
+ }
40
+
41
+ const WeekCalendar: React.FunctionComponent<WeekCalendarProps> = ({ data }) => {
42
+ const week = useMemo<number>(() => getWeek(new Date()), []);
43
+
44
+ let days = [getFirstDayOfWeek(week, new Date().getFullYear())];
45
+
46
+ for (let index = 1; index < DAYS_IN_WEEK; index += 1) {
47
+ days = [...days, addDays(days[0], index)];
48
+ }
49
+
50
+ return (
51
+ <div className={styles.root}>
52
+ <div className={styles.scale}>
53
+ {/* eslint-disable react/no-array-index-key */}
54
+ {Array.from({ length: 12 }).map((_item, index) => (
55
+ <div key={index} className={styles.hour}>
56
+ {formatHour(index + FIRST_HOUR)}
57
+ </div>
58
+ ))}
59
+ {/* eslint-enable */}
60
+ </div>
61
+ {days.map((item) => (
62
+ <WeekCalendarDay key={item.toString()} data={data} date={item} />
63
+ ))}
64
+ </div>
65
+ );
66
+ };
67
+
68
+ WeekCalendar.propTypes = {
69
+ data: PropTypes.arrayOf(
70
+ PropTypes.shape({
71
+ id: PropTypes.number.isRequired,
72
+ datetime: PropTypes.string.isRequired,
73
+ patient: PropTypes.shape({
74
+ name: PropTypes.string.isRequired,
75
+ }).isRequired,
76
+ }).isRequired
77
+ ).isRequired,
78
+ };
79
+
80
+ export default WeekCalendar;
@@ -0,0 +1,23 @@
1
+ import React, { useEffect, useState } from 'react';
2
+
3
+ import { EventService } from '@sqrzro/utility';
4
+
5
+ import Header from '@core/Header';
6
+
7
+ const AppHeader: React.FunctionComponent = () => {
8
+ const [title, setTitle] = useState<string>();
9
+
10
+ useEffect(() => {
11
+ const sub = EventService.subscribe<string>('@app/title', (_key, data) => {
12
+ setTitle(data);
13
+ });
14
+
15
+ return (): void => {
16
+ EventService.unsubscribe(sub);
17
+ };
18
+ }, []);
19
+
20
+ return <Header title={title} />;
21
+ };
22
+
23
+ export default AppHeader;
@@ -0,0 +1,19 @@
1
+ .root {
2
+ align-items: center;
3
+ display: flex;
4
+ flex-direction: column;
5
+ height: 100%;
6
+ justify-content: center;
7
+ position: relative;
8
+ text-indent: -999rem;
9
+ white-space: nowrap;
10
+ width: 100%;
11
+
12
+ & svg {
13
+ height: calc(100% - 2rem);
14
+ left: 1rem;
15
+ position: absolute;
16
+ top: 1rem;
17
+ width: calc(100% - 2rem);
18
+ }
19
+ }
@@ -0,0 +1,33 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+
4
+ import Link from '@components/Link';
5
+ import AppLogoImage from '@core/AppLogoImage';
6
+
7
+ import styles from './AppLogo.module.css';
8
+
9
+ interface AppLogoProps {
10
+ isLink?: boolean;
11
+ }
12
+
13
+ const AppLogo: React.FunctionComponent<AppLogoProps> = ({ isLink }) => {
14
+ if (isLink) {
15
+ return (
16
+ <Link className={styles.root} to="/">
17
+ <AppLogoImage />
18
+ </Link>
19
+ );
20
+ }
21
+
22
+ return (
23
+ <div className={styles.root}>
24
+ <AppLogoImage />
25
+ </div>
26
+ );
27
+ };
28
+
29
+ AppLogo.propTypes = {
30
+ isLink: PropTypes.bool,
31
+ };
32
+
33
+ export default AppLogo;
@@ -0,0 +1,19 @@
1
+ import React, { Fragment } from 'react';
2
+
3
+ import useAppContext from '@hooks/useAppContext';
4
+
5
+ import Assistive from '@core/Assistive';
6
+ import AppLogoPlaceholder from '@core/AppLogoPlaceholder';
7
+
8
+ const AppLogoImage: React.FunctionComponent = () => {
9
+ const { Logo, name } = useAppContext();
10
+
11
+ return (
12
+ <Fragment>
13
+ <Assistive>{name}</Assistive>
14
+ {Logo ? <Logo /> : <AppLogoPlaceholder />}
15
+ </Fragment>
16
+ );
17
+ };
18
+
19
+ export default AppLogoImage;
@@ -0,0 +1,26 @@
1
+ /* eslint-disable max-len */
2
+
3
+ import React from 'react';
4
+
5
+ const AppLogoPlaceholder: React.FunctionComponent = () => (
6
+ <svg height="58" viewBox="0 0 58 58" width="58" xmlns="http://www.w3.org/2000/svg">
7
+ <path
8
+ d="M11.2738 41.615C8.73625 38.0625 7.25 33.7125 7.25 29C7.25 17.0375 17.0375 7.25 29 7.25C33.7125 7.25 38.0625 8.73625 41.615 11.2738L49.8075 3.08125C50.9312 1.9575 50.1338 0 48.5387 0H7.25C3.2625 0 0 3.2625 0 7.25V48.5025C0 50.1338 1.9575 50.9313 3.08125 49.7713L11.2738 41.615Z"
9
+ fill="white"
10
+ />
11
+ <path
12
+ d="M43.4637 30.0512C43.6812 26.97 42.92 24.07 41.47 21.6412L21.6412 41.47C24.07 42.92 26.97 43.6812 30.0512 43.4637C37.1925 42.9562 42.9562 37.1925 43.4637 30.0512Z"
13
+ fill="white"
14
+ />
15
+ <path
16
+ d="M46.7263 16.385C49.2638 19.9375 50.75 24.2875 50.75 29C50.75 40.9625 40.9625 50.75 29 50.75C24.2875 50.75 19.9375 49.2638 16.385 46.7263L8.19251 54.9188C7.06876 56.0425 7.86626 58 9.46126 58H50.75C54.7375 58 58 54.7375 58 50.75V9.49751C58 7.86626 56.0425 7.06876 54.9188 8.22876L46.7263 16.385Z"
17
+ fill="white"
18
+ />
19
+ <path
20
+ d="M14.5362 27.9488C14.3187 31.03 15.08 33.93 16.53 36.3588L36.3587 16.53C33.93 15.08 31.03 14.3188 27.9487 14.5363C20.8075 15.0438 15.0437 20.8075 14.5362 27.9488Z"
21
+ fill="white"
22
+ />
23
+ </svg>
24
+ );
25
+
26
+ export default AppLogoPlaceholder;
@@ -0,0 +1,10 @@
1
+ .root {
2
+ height: .1rem;
3
+ left: -99em;
4
+ overflow: hidden;
5
+ pointer-events: none;
6
+ position: absolute;
7
+ top: auto;
8
+ white-space: nowrap;
9
+ width: .1rem;
10
+ }
@@ -0,0 +1,18 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+
4
+ import styles from './Assistive.module.css';
5
+
6
+ interface AssistiveProps {
7
+ children: React.ReactNode;
8
+ }
9
+
10
+ const Assistive: React.FunctionComponent<AssistiveProps> = ({ children }) => (
11
+ <span className={styles.root}>{children}</span>
12
+ );
13
+
14
+ Assistive.propTypes = {
15
+ children: PropTypes.node.isRequired,
16
+ };
17
+
18
+ export default Assistive;
@@ -0,0 +1,36 @@
1
+ .root {
2
+ background-color: var(--clr-grey900);
3
+ bottom: 0;
4
+ display: flex;
5
+ flex-direction: column;
6
+ left: 0;
7
+ padding-bottom: 2rem;
8
+ position: fixed;
9
+ top: 0;
10
+ width: var(--banner-width);
11
+ z-index: 5;
12
+ }
13
+
14
+ .rootTopbar {
15
+ align-items: center;
16
+ flex-direction: row;
17
+ height: 6rem;
18
+ justify-content: space-between;
19
+ padding: 0;
20
+ padding-right: 1rem;
21
+ position: sticky;
22
+ top: 0;
23
+ width: 100%;
24
+ }
25
+
26
+ .logo {
27
+ background-color: var(--clr-brand);
28
+ height: var(--header-height);
29
+ padding: 1rem;
30
+ }
31
+
32
+ .logoTopbar {
33
+ height: 100%;
34
+ padding: 0;
35
+ width: 6rem;
36
+ }
@@ -0,0 +1,25 @@
1
+ import React from 'react';
2
+ import classNames from 'classnames';
3
+
4
+ import AppLogo from '@core/AppLogo';
5
+ import Navigation from '@core/Navigation';
6
+ import MeActions from '@core/MeActions';
7
+ import useLayout from '@hooks/useLayout';
8
+
9
+ import styles from './Banner.module.css';
10
+
11
+ const Banner: React.FunctionComponent = () => {
12
+ const { applyLayoutClassName } = useLayout();
13
+
14
+ return (
15
+ <header className={classNames(styles.root, applyLayoutClassName(styles))}>
16
+ <div className={classNames(styles.logo, applyLayoutClassName(styles, 'logo'))}>
17
+ <AppLogo isLink />
18
+ </div>
19
+ <Navigation />
20
+ <MeActions />
21
+ </header>
22
+ );
23
+ };
24
+
25
+ export default Banner;