@takaro/lib-components 0.0.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 (398) hide show
  1. package/.babelrc +7 -0
  2. package/@types/files.d.ts +23 -0
  3. package/@types/react-table-config.d.ts +121 -0
  4. package/Dockerfile.dev +21 -0
  5. package/package.json +76 -0
  6. package/public/images/7-days-to-die/logo.png +0 -0
  7. package/public/images/csmm-icon.png +0 -0
  8. package/public/images/milk.png +0 -0
  9. package/public/images/placeholder-01.jpeg +0 -0
  10. package/public/images/placeholder-02.jpeg +0 -0
  11. package/public/images/placeholder-03.jpeg +0 -0
  12. package/public/images/rust/logo.png +0 -0
  13. package/readme.md +10 -0
  14. package/src/components/actions/Button/Button.stories.tsx +170 -0
  15. package/src/components/actions/Button/Button.test.tsx +7 -0
  16. package/src/components/actions/Button/Button.test.tsx.snap +89 -0
  17. package/src/components/actions/Button/index.tsx +99 -0
  18. package/src/components/actions/Button/style.ts +148 -0
  19. package/src/components/actions/ContextMenu/ContextMenu.stories.tsx +40 -0
  20. package/src/components/actions/ContextMenu/Group.tsx +34 -0
  21. package/src/components/actions/ContextMenu/MenuItem.tsx +66 -0
  22. package/src/components/actions/ContextMenu/index.tsx +217 -0
  23. package/src/components/actions/Dropdown/Dropdown.stories.tsx +88 -0
  24. package/src/components/actions/Dropdown/DropdownContext.tsx +21 -0
  25. package/src/components/actions/Dropdown/DropdownMenu.tsx +67 -0
  26. package/src/components/actions/Dropdown/DropdownMenuGroup.tsx +37 -0
  27. package/src/components/actions/Dropdown/DropdownMenuItem.tsx +128 -0
  28. package/src/components/actions/Dropdown/DropdownTrigger.tsx +89 -0
  29. package/src/components/actions/Dropdown/index.tsx +22 -0
  30. package/src/components/actions/Dropdown/useDropdown.tsx +82 -0
  31. package/src/components/actions/DropdownButton/DropdownButton.stories.tsx +88 -0
  32. package/src/components/actions/DropdownButton/index.tsx +113 -0
  33. package/src/components/actions/IconButton/IconButton.stories.tsx +54 -0
  34. package/src/components/actions/IconButton/IconButton.test.tsx +7 -0
  35. package/src/components/actions/IconButton/IconButton.test.tsx.snap +46 -0
  36. package/src/components/actions/IconButton/index.tsx +40 -0
  37. package/src/components/actions/IconButton/style.ts +75 -0
  38. package/src/components/actions/ToggleButton/ToggleButton.stories.tsx +84 -0
  39. package/src/components/actions/ToggleButton/ToggleButton.tsx +48 -0
  40. package/src/components/actions/ToggleButton/ToggleButtonGroup.tsx +99 -0
  41. package/src/components/actions/ToggleButton/index.tsx +2 -0
  42. package/src/components/actions/ToggleButton/style.ts +76 -0
  43. package/src/components/actions/index.ts +16 -0
  44. package/src/components/charts/AreaChart/AreaChart.stories.tsx +104 -0
  45. package/src/components/charts/AreaChart/index.tsx +379 -0
  46. package/src/components/charts/BarChart/BarChart.stories.tsx +32 -0
  47. package/src/components/charts/BarChart/index.tsx +287 -0
  48. package/src/components/charts/BrushHandle.tsx +21 -0
  49. package/src/components/charts/GeoMercator/GeoMercator.stories.tsx +65 -0
  50. package/src/components/charts/GeoMercator/index.tsx +141 -0
  51. package/src/components/charts/GeoMercator/world.d.ts +1 -0
  52. package/src/components/charts/GeoMercator/world.json +99485 -0
  53. package/src/components/charts/Heatmap/Heatmap.stories.tsx +55 -0
  54. package/src/components/charts/Heatmap/index.tsx +228 -0
  55. package/src/components/charts/LineChart/LineChart.stories.tsx +37 -0
  56. package/src/components/charts/LineChart/index.tsx +233 -0
  57. package/src/components/charts/PieChart/PieChart.stories.tsx +43 -0
  58. package/src/components/charts/PieChart/index.tsx +163 -0
  59. package/src/components/charts/PointHighlight.tsx +49 -0
  60. package/src/components/charts/RadarChart/RadarChart.stories.tsx +38 -0
  61. package/src/components/charts/RadarChart/generators.ts +30 -0
  62. package/src/components/charts/RadarChart/index.tsx +175 -0
  63. package/src/components/charts/RadialBarChart/RadialBarChart.stories.tsx +34 -0
  64. package/src/components/charts/RadialBarChart/index.tsx +165 -0
  65. package/src/components/charts/RadialLineChart/RadialLineChart.stories.tsx +26 -0
  66. package/src/components/charts/RadialLineChart/index.tsx +141 -0
  67. package/src/components/charts/index.tsx +20 -0
  68. package/src/components/charts/useGradients.tsx +37 -0
  69. package/src/components/charts/util.ts +40 -0
  70. package/src/components/data/Avatar/Avatar.stories.tsx +93 -0
  71. package/src/components/data/Avatar/context.tsx +20 -0
  72. package/src/components/data/Avatar/index.tsx +132 -0
  73. package/src/components/data/Avatar/style.ts +124 -0
  74. package/src/components/data/Avatar/useImageLoadingStatus.tsx +32 -0
  75. package/src/components/data/Chip/Chip.stories.tsx +67 -0
  76. package/src/components/data/Chip/Chip.test.tsx +7 -0
  77. package/src/components/data/Chip/Chip.test.tsx.snap +50 -0
  78. package/src/components/data/Chip/index.tsx +76 -0
  79. package/src/components/data/Chip/style.ts +84 -0
  80. package/src/components/data/Console/Console.stories.tsx +51 -0
  81. package/src/components/data/Console/Console.tsx +125 -0
  82. package/src/components/data/Console/ConsoleInput/index.tsx +87 -0
  83. package/src/components/data/Console/ConsoleInput/style.ts +41 -0
  84. package/src/components/data/Console/ConsoleLine/index.tsx +127 -0
  85. package/src/components/data/Console/ConsoleLine/style.ts +76 -0
  86. package/src/components/data/Console/MessageModel.ts +9 -0
  87. package/src/components/data/Console/index.tsx +4 -0
  88. package/src/components/data/Console/style.ts +31 -0
  89. package/src/components/data/Console/useConsoleLiveMode.ts +42 -0
  90. package/src/components/data/CopyId/CopyId.stories.tsx +36 -0
  91. package/src/components/data/CopyId/index.tsx +38 -0
  92. package/src/components/data/DateFormatter/DateFormatter.stories.tsx +26 -0
  93. package/src/components/data/DateFormatter/index.tsx +15 -0
  94. package/src/components/data/Drawer/Drawer.stories.tsx +144 -0
  95. package/src/components/data/Drawer/DrawerBody.tsx +22 -0
  96. package/src/components/data/Drawer/DrawerContent.tsx +110 -0
  97. package/src/components/data/Drawer/DrawerContext.tsx +21 -0
  98. package/src/components/data/Drawer/DrawerFooter.tsx +19 -0
  99. package/src/components/data/Drawer/DrawerHeading.tsx +49 -0
  100. package/src/components/data/Drawer/DrawerSkeleton.tsx +29 -0
  101. package/src/components/data/Drawer/index.tsx +25 -0
  102. package/src/components/data/Drawer/useDrawer.tsx +52 -0
  103. package/src/components/data/InfiniteScroll/InfiniteScroll.stories.tsx +33 -0
  104. package/src/components/data/InfiniteScroll/index.tsx +51 -0
  105. package/src/components/data/LinkCard/index.tsx +28 -0
  106. package/src/components/data/Stats/Stat.tsx +99 -0
  107. package/src/components/data/Stats/Stats.stories.tsx +72 -0
  108. package/src/components/data/Stats/context.tsx +11 -0
  109. package/src/components/data/Stats/index.tsx +50 -0
  110. package/src/components/data/Table/Table.stories.tsx +142 -0
  111. package/src/components/data/Table/index.tsx +365 -0
  112. package/src/components/data/Table/react-table.d.ts +11 -0
  113. package/src/components/data/Table/style.ts +75 -0
  114. package/src/components/data/Table/subcomponents/ColumnHeader/ColumnSettings.tsx +161 -0
  115. package/src/components/data/Table/subcomponents/ColumnHeader/index.tsx +207 -0
  116. package/src/components/data/Table/subcomponents/ColumnHeader/style.ts +89 -0
  117. package/src/components/data/Table/subcomponents/ColumnVisibility/index.tsx +61 -0
  118. package/src/components/data/Table/subcomponents/Filter/field.tsx +129 -0
  119. package/src/components/data/Table/subcomponents/Filter/index.tsx +239 -0
  120. package/src/components/data/Table/subcomponents/Filter/style.ts +26 -0
  121. package/src/components/data/Table/subcomponents/Pagination/index.tsx +108 -0
  122. package/src/components/data/Table/subcomponents/Pagination/style.ts +49 -0
  123. package/src/components/data/Table/subcomponents/index.ts +4 -0
  124. package/src/components/data/index.ts +28 -0
  125. package/src/components/dialogs/Dialog/Dialog.stories.tsx +74 -0
  126. package/src/components/dialogs/Dialog/DialogBody.tsx +62 -0
  127. package/src/components/dialogs/Dialog/DialogContent.tsx +46 -0
  128. package/src/components/dialogs/Dialog/DialogContext.tsx +21 -0
  129. package/src/components/dialogs/Dialog/DialogHeading.tsx +56 -0
  130. package/src/components/dialogs/Dialog/index.tsx +20 -0
  131. package/src/components/dialogs/Dialog/useDialog.tsx +50 -0
  132. package/src/components/feedback/Alert/Alert.stories.tsx +77 -0
  133. package/src/components/feedback/Alert/Alert.test.tsx +7 -0
  134. package/src/components/feedback/Alert/Alert.test.tsx.snap +146 -0
  135. package/src/components/feedback/Alert/index.tsx +109 -0
  136. package/src/components/feedback/Alert/style.ts +87 -0
  137. package/src/components/feedback/ErrorFallback/ErrorFallback.stories.tsx +10 -0
  138. package/src/components/feedback/ErrorFallback/index.tsx +48 -0
  139. package/src/components/feedback/ErrorPage/ErrorPage.stories.tsx +31 -0
  140. package/src/components/feedback/ErrorPage/index.tsx +193 -0
  141. package/src/components/feedback/FormError/FormError.stories.tsx +25 -0
  142. package/src/components/feedback/FormError/index.tsx +54 -0
  143. package/src/components/feedback/Loaders/Loaders.stories.tsx +28 -0
  144. package/src/components/feedback/Loaders/Loading.test.tsx +7 -0
  145. package/src/components/feedback/Loaders/Loading.test.tsx.snap +141 -0
  146. package/src/components/feedback/Loaders/Loading.tsx +107 -0
  147. package/src/components/feedback/Loaders/Spinner.test.tsx +7 -0
  148. package/src/components/feedback/Loaders/Spinner.test.tsx.snap +18 -0
  149. package/src/components/feedback/Loaders/Spinner.tsx +74 -0
  150. package/src/components/feedback/Loaders/index.ts +2 -0
  151. package/src/components/feedback/NetworkDetector/NetworkDetector.stories.tsx +21 -0
  152. package/src/components/feedback/NetworkDetector/NetworkDetector.test.tsx +7 -0
  153. package/src/components/feedback/NetworkDetector/NetworkDetector.test.tsx.snap +3 -0
  154. package/src/components/feedback/NetworkDetector/index.tsx +41 -0
  155. package/src/components/feedback/NotificationBanner/NotificationBanner.stories.tsx +13 -0
  156. package/src/components/feedback/NotificationBanner/NotificationBanner.test.tsx +14 -0
  157. package/src/components/feedback/NotificationBanner/NotificationBanner.test.tsx.snap +3 -0
  158. package/src/components/feedback/NotificationBanner/index.tsx +79 -0
  159. package/src/components/feedback/Popover/Popover.stories.tsx +33 -0
  160. package/src/components/feedback/Popover/PopoverContent.tsx +43 -0
  161. package/src/components/feedback/Popover/PopoverContext.tsx +21 -0
  162. package/src/components/feedback/Popover/PopoverTrigger.tsx +43 -0
  163. package/src/components/feedback/Popover/index.tsx +22 -0
  164. package/src/components/feedback/Popover/usePopover.tsx +87 -0
  165. package/src/components/feedback/ProgressBar/ProgressBar.stories.tsx +38 -0
  166. package/src/components/feedback/ProgressBar/index.tsx +103 -0
  167. package/src/components/feedback/QuestionTooltip/QuestionTooltip.stories.tsx +20 -0
  168. package/src/components/feedback/QuestionTooltip/index.tsx +36 -0
  169. package/src/components/feedback/Skeleton/Skeleton.stories.tsx +33 -0
  170. package/src/components/feedback/Skeleton/Skeleton.test.tsx +7 -0
  171. package/src/components/feedback/Skeleton/Skeleton.test.tsx.snap +35 -0
  172. package/src/components/feedback/Skeleton/index.tsx +62 -0
  173. package/src/components/feedback/Tooltip/Tooltip.stories.tsx +69 -0
  174. package/src/components/feedback/Tooltip/TooltipContent.tsx +50 -0
  175. package/src/components/feedback/Tooltip/TooltipContext.tsx +13 -0
  176. package/src/components/feedback/Tooltip/TooltipTrigger.tsx +39 -0
  177. package/src/components/feedback/Tooltip/index.tsx +26 -0
  178. package/src/components/feedback/Tooltip/useTooltip.tsx +79 -0
  179. package/src/components/feedback/index.ts +33 -0
  180. package/src/components/feedback/snacks/CookieConsent/index.tsx +122 -0
  181. package/src/components/feedback/snacks/CookieConsent/style.ts +100 -0
  182. package/src/components/feedback/snacks/Default/default.stories.tsx +72 -0
  183. package/src/components/feedback/snacks/Default/index.tsx +77 -0
  184. package/src/components/feedback/snacks/Default/style.ts +59 -0
  185. package/src/components/feedback/snacks/Drawer/Drawer.stories.tsx +46 -0
  186. package/src/components/feedback/snacks/Drawer/index.tsx +70 -0
  187. package/src/components/feedback/snacks/NetworkDetector/index.tsx +70 -0
  188. package/src/components/feedback/snacks/index.d.ts +15 -0
  189. package/src/components/feedback/snacks/index.ts +8 -0
  190. package/src/components/index.ts +9 -0
  191. package/src/components/inputs/CheckBox/CheckBox.stories.tsx +64 -0
  192. package/src/components/inputs/CheckBox/Controlled.tsx +124 -0
  193. package/src/components/inputs/CheckBox/Generic.tsx +96 -0
  194. package/src/components/inputs/CheckBox/index.tsx +4 -0
  195. package/src/components/inputs/CheckBox/style.ts +113 -0
  196. package/src/components/inputs/CodeField/CodeField.stories.tsx +87 -0
  197. package/src/components/inputs/CodeField/index.tsx +173 -0
  198. package/src/components/inputs/CodeField/style.ts +50 -0
  199. package/src/components/inputs/Date/DatePicker/Controlled.tsx +101 -0
  200. package/src/components/inputs/Date/DatePicker/DatePicker.stories.tsx +234 -0
  201. package/src/components/inputs/Date/DatePicker/Generic.tsx +253 -0
  202. package/src/components/inputs/Date/DatePicker/formats.tsx +32 -0
  203. package/src/components/inputs/Date/DatePicker/style.ts +43 -0
  204. package/src/components/inputs/Date/DateRangePicker/Context.tsx +112 -0
  205. package/src/components/inputs/Date/DateRangePicker/DateRangePicker.stories.tsx +32 -0
  206. package/src/components/inputs/Date/DateRangePicker/DateSelector/Absolute.tsx +98 -0
  207. package/src/components/inputs/Date/DateRangePicker/DateSelector/Relative.tsx +54 -0
  208. package/src/components/inputs/Date/DateRangePicker/DateSelector/index.tsx +49 -0
  209. package/src/components/inputs/Date/DateRangePicker/QuickSelect/index.tsx +270 -0
  210. package/src/components/inputs/Date/DateRangePicker/QuickSelect/style.ts +40 -0
  211. package/src/components/inputs/Date/DateRangePicker/index.tsx +134 -0
  212. package/src/components/inputs/Date/DateRangePicker/style.ts +51 -0
  213. package/src/components/inputs/Date/subcomponents/Calendar/index.tsx +150 -0
  214. package/src/components/inputs/Date/subcomponents/Calendar/style.ts +59 -0
  215. package/src/components/inputs/Date/subcomponents/RelativePicker/index.tsx +186 -0
  216. package/src/components/inputs/Date/subcomponents/RelativePicker/style.ts +50 -0
  217. package/src/components/inputs/Date/subcomponents/TimePicker/TimePicker.stories.tsx +25 -0
  218. package/src/components/inputs/Date/subcomponents/TimePicker/index.tsx +40 -0
  219. package/src/components/inputs/Date/subcomponents/TimePicker/style.ts +32 -0
  220. package/src/components/inputs/DurationField/Controlled.tsx +69 -0
  221. package/src/components/inputs/DurationField/Duration.stories.tsx +54 -0
  222. package/src/components/inputs/DurationField/Generic.tsx +200 -0
  223. package/src/components/inputs/DurationField/index.tsx +5 -0
  224. package/src/components/inputs/DurationField/style.ts +42 -0
  225. package/src/components/inputs/EditableField/EditableField.stories.tsx +65 -0
  226. package/src/components/inputs/EditableField/index.tsx +135 -0
  227. package/src/components/inputs/EditableField/style.ts +11 -0
  228. package/src/components/inputs/FileField/Controlled.tsx +104 -0
  229. package/src/components/inputs/FileField/FileField.stories.tsx +211 -0
  230. package/src/components/inputs/FileField/Generic.tsx +131 -0
  231. package/src/components/inputs/FileField/index.tsx +5 -0
  232. package/src/components/inputs/FileField/style.ts +34 -0
  233. package/src/components/inputs/InputProps.ts +61 -0
  234. package/src/components/inputs/RadioGroup/Controlled.tsx +46 -0
  235. package/src/components/inputs/RadioGroup/Generic.tsx +34 -0
  236. package/src/components/inputs/RadioGroup/RadioGroup.stories.tsx +116 -0
  237. package/src/components/inputs/RadioGroup/RadioItem.tsx +129 -0
  238. package/src/components/inputs/RadioGroup/context.tsx +20 -0
  239. package/src/components/inputs/RadioGroup/index.ts +5 -0
  240. package/src/components/inputs/RadioGroup/style.ts +3 -0
  241. package/src/components/inputs/Slider/Controlled.tsx +87 -0
  242. package/src/components/inputs/Slider/Generic.tsx +73 -0
  243. package/src/components/inputs/Slider/Slider.stories.tsx +101 -0
  244. package/src/components/inputs/Slider/handle.tsx +31 -0
  245. package/src/components/inputs/Slider/index.tsx +5 -0
  246. package/src/components/inputs/Slider/style.ts +140 -0
  247. package/src/components/inputs/Switch/Controlled.tsx +58 -0
  248. package/src/components/inputs/Switch/Generic.tsx +67 -0
  249. package/src/components/inputs/Switch/Switch.stories.tsx +91 -0
  250. package/src/components/inputs/Switch/index.ts +5 -0
  251. package/src/components/inputs/Switch/style.ts +56 -0
  252. package/src/components/inputs/TagField/Controlled.tsx +103 -0
  253. package/src/components/inputs/TagField/Generic.tsx +138 -0
  254. package/src/components/inputs/TagField/TagField.stories.tsx +68 -0
  255. package/src/components/inputs/TagField/index.ts +5 -0
  256. package/src/components/inputs/TagField/style.ts +25 -0
  257. package/src/components/inputs/TagField/util.ts +34 -0
  258. package/src/components/inputs/TextAreaField/Controlled.tsx +101 -0
  259. package/src/components/inputs/TextAreaField/Generic.tsx +56 -0
  260. package/src/components/inputs/TextAreaField/TextAreaField.stories.tsx +98 -0
  261. package/src/components/inputs/TextAreaField/index.ts +5 -0
  262. package/src/components/inputs/TextAreaField/style.ts +28 -0
  263. package/src/components/inputs/TextField/Controlled.tsx +120 -0
  264. package/src/components/inputs/TextField/Generic.tsx +113 -0
  265. package/src/components/inputs/TextField/TextField.stories.tsx +196 -0
  266. package/src/components/inputs/TextField/index.ts +5 -0
  267. package/src/components/inputs/TextField/style.ts +97 -0
  268. package/src/components/inputs/TextField/util.ts +19 -0
  269. package/src/components/inputs/ValueConfirmationField/ValueConfirmationField.stories.tsx +33 -0
  270. package/src/components/inputs/ValueConfirmationField/index.tsx +54 -0
  271. package/src/components/inputs/index.ts +67 -0
  272. package/src/components/inputs/layout/Description.tsx +40 -0
  273. package/src/components/inputs/layout/ErrorMessage/ErrorMessage.stories.tsx +28 -0
  274. package/src/components/inputs/layout/ErrorMessage/index.tsx +63 -0
  275. package/src/components/inputs/layout/InputWrapper.ts +6 -0
  276. package/src/components/inputs/layout/Label/index.tsx +71 -0
  277. package/src/components/inputs/layout/Label/style.ts +51 -0
  278. package/src/components/inputs/layout/index.ts +6 -0
  279. package/src/components/inputs/selects/SelectField/Controlled.tsx +130 -0
  280. package/src/components/inputs/selects/SelectField/Generic/FilterInput.tsx +45 -0
  281. package/src/components/inputs/selects/SelectField/Generic/index.tsx +302 -0
  282. package/src/components/inputs/selects/SelectField/SelectField.stories.tsx +253 -0
  283. package/src/components/inputs/selects/SelectField/index.ts +5 -0
  284. package/src/components/inputs/selects/SelectField/style.ts +29 -0
  285. package/src/components/inputs/selects/SelectQueryField/Controlled.tsx +100 -0
  286. package/src/components/inputs/selects/SelectQueryField/Generic/index.tsx +300 -0
  287. package/src/components/inputs/selects/SelectQueryField/SelectQueryField.stories.tsx +260 -0
  288. package/src/components/inputs/selects/SelectQueryField/index.tsx +5 -0
  289. package/src/components/inputs/selects/SelectQueryField/style.ts +14 -0
  290. package/src/components/inputs/selects/SubComponents/Option.tsx +114 -0
  291. package/src/components/inputs/selects/SubComponents/OptionGroup.tsx +16 -0
  292. package/src/components/inputs/selects/SubComponents/index.ts +10 -0
  293. package/src/components/inputs/selects/SubComponents/style.ts +39 -0
  294. package/src/components/inputs/selects/data.ts +123 -0
  295. package/src/components/inputs/selects/index.tsx +47 -0
  296. package/src/components/inputs/selects/sharedStyle.ts +78 -0
  297. package/src/components/layout/Container/index.ts +21 -0
  298. package/src/components/layout/index.ts +1 -0
  299. package/src/components/navigation/HorizontalNav/HorizontalNav.stories.tsx +45 -0
  300. package/src/components/navigation/HorizontalNav/index.tsx +40 -0
  301. package/src/components/navigation/HorizontalNav/style.ts +83 -0
  302. package/src/components/navigation/IconNav/IconNav.stories.tsx +46 -0
  303. package/src/components/navigation/IconNav/index.tsx +49 -0
  304. package/src/components/navigation/Steppers/SlimStepper/Stepper.stories.tsx +89 -0
  305. package/src/components/navigation/Steppers/SlimStepper/index.tsx +104 -0
  306. package/src/components/navigation/Steppers/SlimStepper/style.ts +86 -0
  307. package/src/components/navigation/Steppers/Stepper/Stepper.stories.tsx +87 -0
  308. package/src/components/navigation/Steppers/Stepper/index.tsx +114 -0
  309. package/src/components/navigation/Steppers/Stepper/style.ts +105 -0
  310. package/src/components/navigation/Steppers/context.tsx +49 -0
  311. package/src/components/navigation/Steppers/reducer.ts +51 -0
  312. package/src/components/navigation/Steppers/stepStates.ts +5 -0
  313. package/src/components/navigation/Tabs/Content.tsx +36 -0
  314. package/src/components/navigation/Tabs/Context.tsx +21 -0
  315. package/src/components/navigation/Tabs/List.tsx +17 -0
  316. package/src/components/navigation/Tabs/Tabs.stories.tsx +119 -0
  317. package/src/components/navigation/Tabs/Trigger.tsx +65 -0
  318. package/src/components/navigation/Tabs/index.tsx +35 -0
  319. package/src/components/navigation/Tabs/useTabs.tsx +28 -0
  320. package/src/components/navigation/index.ts +16 -0
  321. package/src/components/other/ActionMenu/ActionMenu.stories.tsx +86 -0
  322. package/src/components/other/ActionMenu/index.tsx +55 -0
  323. package/src/components/other/ActionMenu/style.ts +48 -0
  324. package/src/components/other/ClipBoard/ClipBoard.stories.tsx +14 -0
  325. package/src/components/other/ClipBoard/ClipBoard.test.tsx +7 -0
  326. package/src/components/other/ClipBoard/ClipBoard.test.tsx.snap +70 -0
  327. package/src/components/other/ClipBoard/index.tsx +70 -0
  328. package/src/components/other/CollapseList/CollapseList.stories.tsx +21 -0
  329. package/src/components/other/CollapseList/index.tsx +115 -0
  330. package/src/components/other/Collapsible/Collapsible.stories.tsx +19 -0
  331. package/src/components/other/Collapsible/CollapsibleContent.tsx +22 -0
  332. package/src/components/other/Collapsible/CollapsibleContext.tsx +17 -0
  333. package/src/components/other/Collapsible/CollapsibleTrigger.tsx +67 -0
  334. package/src/components/other/Collapsible/index.tsx +21 -0
  335. package/src/components/other/Company/index.tsx +45 -0
  336. package/src/components/other/Company/style.ts +58 -0
  337. package/src/components/other/Empty/Empty.stories.tsx +24 -0
  338. package/src/components/other/Empty/Empty.test.tsx +7 -0
  339. package/src/components/other/Empty/Empty.test.tsx.snap +85 -0
  340. package/src/components/other/Empty/index.tsx +87 -0
  341. package/src/components/other/PermissionsGuard/PermissionsGuard.stories.tsx +54 -0
  342. package/src/components/other/PermissionsGuard/index.tsx +43 -0
  343. package/src/components/other/index.ts +19 -0
  344. package/src/components/visual/Card/Card.stories.tsx +19 -0
  345. package/src/components/visual/Card/index.tsx +49 -0
  346. package/src/components/visual/Divider/Divider.stories.tsx +19 -0
  347. package/src/components/visual/Divider/Divider.test.tsx +7 -0
  348. package/src/components/visual/Divider/Divider.test.tsx.snap +35 -0
  349. package/src/components/visual/Divider/index.tsx +85 -0
  350. package/src/components/visual/index.ts +5 -0
  351. package/src/errors/base.ts +11 -0
  352. package/src/errors/errors.ts +109 -0
  353. package/src/errors/index.ts +14 -0
  354. package/src/helpers/camelCaseToSpaces.ts +5 -0
  355. package/src/helpers/getInitials.ts +15 -0
  356. package/src/helpers/getSnackbarProvider.tsx +57 -0
  357. package/src/helpers/getTransition.ts +9 -0
  358. package/src/helpers/index.ts +5 -0
  359. package/src/helpers/makeData.ts +34 -0
  360. package/src/helpers/regexprs.ts +7 -0
  361. package/src/hooks/index.ts +9 -0
  362. package/src/hooks/useCallbackRef.tsx +17 -0
  363. package/src/hooks/useDebounce.tsx +22 -0
  364. package/src/hooks/useFocus.tsx +10 -0
  365. package/src/hooks/useLocalStorage.tsx +38 -0
  366. package/src/hooks/useLockScroll.ts +26 -0
  367. package/src/hooks/useOnScreen.ts +24 -0
  368. package/src/hooks/useOutsideAlerter.tsx +15 -0
  369. package/src/hooks/useTableActions.ts +56 -0
  370. package/src/hooks/useTheme.tsx +7 -0
  371. package/src/images/company-icon-primary.svg +3 -0
  372. package/src/images/company-icon-secondary.svg +3 -0
  373. package/src/images/index.ts +4 -0
  374. package/src/index.ts +9 -0
  375. package/src/stories/Colors.stories.mdx +35 -0
  376. package/src/stories/Elevation.stories.mdx +56 -0
  377. package/src/stories/Introduction.stories.mdx +17 -0
  378. package/src/stories/Spacing.stories.mdx +25 -0
  379. package/src/styled/GlobalStyle.ts +207 -0
  380. package/src/styled/Snackbar.tsx +42 -0
  381. package/src/styled/animations.ts +36 -0
  382. package/src/styled/breakpoint.ts +7 -0
  383. package/src/styled/device.ts +10 -0
  384. package/src/styled/elevation.ts +20 -0
  385. package/src/styled/index.ts +11 -0
  386. package/src/styled/spacing.ts +38 -0
  387. package/src/styled/theme.ts +87 -0
  388. package/src/styled/types.ts +5 -0
  389. package/src/styled/zIndex.ts +31 -0
  390. package/src/test/__mocks__/fileMock.ts +2 -0
  391. package/src/test/setupTests.ts +3 -0
  392. package/src/test/snapshotResolver.js +21 -0
  393. package/src/test/testUtils.tsx +31 -0
  394. package/src/types/index.ts +1 -0
  395. package/src/types/json.ts +5 -0
  396. package/src/views/LoadingPage.tsx +36 -0
  397. package/src/views/index.ts +1 -0
  398. package/tsconfig.json +19 -0
@@ -0,0 +1,10 @@
1
+ import { useRef } from 'react';
2
+
3
+ export const useFocus = () => {
4
+ const htmlElRef = useRef<HTMLElement>(null);
5
+ const setFocus = () => {
6
+ htmlElRef.current && htmlElRef.current.focus();
7
+ };
8
+
9
+ return [htmlElRef, setFocus];
10
+ };
@@ -0,0 +1,38 @@
1
+ import { useState } from 'react';
2
+
3
+ export function useLocalStorage<T>(key: string, initialValue: T) {
4
+ const [error, setError] = useState<DOMException | null>(null);
5
+
6
+ const [storedValue, setStoredValue] = useState<T>(() => {
7
+ try {
8
+ const item = window.localStorage.getItem(key);
9
+ return item ? JSON.parse(item) : initialValue;
10
+ } catch (e) {
11
+ // eslint-disable-next-line no-console
12
+ console.error('Error reading the local storage value', e);
13
+ return initialValue;
14
+ }
15
+ });
16
+
17
+ const setValue = (value: T | ((prevValue: T) => T)): void => {
18
+ try {
19
+ setStoredValue((prevValue) => {
20
+ const valueToStore = value instanceof Function ? value(prevValue) : value;
21
+ window.localStorage.setItem(key, JSON.stringify(valueToStore));
22
+ return valueToStore;
23
+ });
24
+ } catch (e) {
25
+ // DOMException code 22 for QuotaExceededError
26
+ if (e instanceof DOMException && e.name === 'QuotaExceededError') {
27
+ // eslint-disable-next-line no-console
28
+ console.error('LocalStorage quota exceeded', e);
29
+ setError(e);
30
+ } else {
31
+ // eslint-disable-next-line no-console
32
+ console.error('Error setting the local storage value', e);
33
+ }
34
+ }
35
+ };
36
+
37
+ return { storedValue, setValue, error };
38
+ }
@@ -0,0 +1,26 @@
1
+ import { useLayoutEffect } from 'react';
2
+
3
+ export function useLockBodyScroll(lock = true): void {
4
+ useLayoutEffect(() => {
5
+ if (lock) {
6
+ const originalStyle = window.getComputedStyle(document.body).overflowY;
7
+ document.body.style.overflowY = 'hidden';
8
+ // Re-enable scrolling when component unmounts.
9
+ return (): void => {
10
+ document.body.style.overflowY = originalStyle;
11
+ };
12
+ }
13
+ }, []); // Empty array ensures effect is only run on mount and unmount.
14
+ }
15
+
16
+ export function useLockRefScroll(ref: React.MutableRefObject<HTMLElement>): void {
17
+ useLayoutEffect(() => {
18
+ if (ref) {
19
+ const originalStyle = ref.current.style.overflow;
20
+ ref.current.style.overflow = 'hidden';
21
+ return (): any => {
22
+ ref.current.style.overflow = originalStyle;
23
+ };
24
+ }
25
+ }, [ref]);
26
+ }
@@ -0,0 +1,24 @@
1
+ import { useState, useEffect } from 'react';
2
+
3
+ export function useOnScreen(ref: React.RefObject<any>, rootMargin = '0px'): boolean {
4
+ const [isIntersecting, setIntersecting] = useState(false);
5
+
6
+ useEffect(() => {
7
+ const observer = new IntersectionObserver(
8
+ ([entry]) => {
9
+ setIntersecting(entry.isIntersecting);
10
+ },
11
+ {
12
+ rootMargin,
13
+ }
14
+ );
15
+ if (ref.current) {
16
+ observer.observe(ref.current);
17
+ }
18
+ return (): void => {
19
+ observer.unobserve(ref.current);
20
+ };
21
+ }, []);
22
+
23
+ return isIntersecting;
24
+ }
@@ -0,0 +1,15 @@
1
+ import { useEffect, RefObject, MutableRefObject } from 'react';
2
+
3
+ export function useOutsideAlerter(ref: RefObject<HTMLElement> | MutableRefObject<HTMLElement>, f: () => void): void {
4
+ useEffect(() => {
5
+ function handleClickOutside(event: any): void {
6
+ if (ref.current && !ref.current.contains(event.target)) {
7
+ f();
8
+ }
9
+ }
10
+ document.addEventListener('mousedown', handleClickOutside);
11
+ return (): void => {
12
+ document.removeEventListener('mousedown', handleClickOutside);
13
+ };
14
+ }, [ref]);
15
+ }
@@ -0,0 +1,56 @@
1
+ import { PaginationState, SortingState, RowSelectionState } from '@tanstack/react-table';
2
+ import { useState } from 'react';
3
+ import { APIOutput } from '@takaro/apiclient';
4
+
5
+ interface ExtendedAPIOutput<T> extends APIOutput {
6
+ data: T[];
7
+ }
8
+
9
+ export interface PageOptions {
10
+ // amount of pages items are spread across
11
+ pageCount: number;
12
+ // total amount of items
13
+ total: number;
14
+ }
15
+
16
+ interface TableActionOptions {
17
+ pageIndex: number;
18
+ pageSize: number;
19
+ }
20
+
21
+ export interface ColumnFilter {
22
+ id: string;
23
+ value: string[];
24
+ }
25
+
26
+ export function useTableActions<T>({ pageIndex, pageSize }: TableActionOptions = { pageIndex: 0, pageSize: 9 }) {
27
+ const [paginationState, setPaginationState] = useState<PaginationState>({
28
+ pageIndex,
29
+ pageSize,
30
+ });
31
+ const [columnFiltersState, setColumnFiltersState] = useState<ColumnFilter[]>([]);
32
+ const [columnSearchState, setColumnSearchState] = useState<ColumnFilter[]>([]);
33
+ const [sortingState, setSortingState] = useState<SortingState>([]);
34
+ const [rowSelectionState, setRowSelectionState] = useState<RowSelectionState>({});
35
+
36
+ function getPageOptions(data: ExtendedAPIOutput<T>): PageOptions {
37
+ // we can use page 0 here because that data is the same for all pages
38
+ const limit = data.meta.limit!;
39
+ const total = data.meta.total!;
40
+
41
+ const pageCount = data.meta.total ? Math.ceil(total / limit) : Math.ceil(data.data.length / limit);
42
+
43
+ return {
44
+ pageCount,
45
+ total,
46
+ };
47
+ }
48
+
49
+ return {
50
+ pagination: { paginationState, setPaginationState, getPageOptions },
51
+ columnFilters: { columnFiltersState, setColumnFiltersState },
52
+ columnSearch: { columnSearchState, setColumnSearchState },
53
+ sorting: { sortingState, setSortingState },
54
+ rowSelection: { rowSelectionState, setRowSelectionState },
55
+ };
56
+ }
@@ -0,0 +1,7 @@
1
+ import { useContext } from 'react';
2
+ import type { ThemeType } from '../styled/theme';
3
+ import { ThemeContext } from 'styled-components';
4
+
5
+ export const useTheme = (): ThemeType => {
6
+ return useContext<ThemeType>(ThemeContext);
7
+ };
@@ -0,0 +1,3 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
2
+ <path fill="#664DE5" d="M512 165.4c0 127.9-70.05 235.3-175.3 270.1c-20.04 7.938-41.83 12.46-64.69 12.46c-64.9 0-125.2-36.51-155.7-94.47c-54.13 49.93-68.71 107-68.96 108.1C44.72 472.6 34.87 480 24.02 480c-1.844 0-3.727-.2187-5.602-.6562c-12.89-3.098-20.84-16.08-17.75-28.96c9.598-39.5 90.47-226.4 335.3-226.4C344.8 224 352 216.8 352 208S344.8 192 336 192C228.6 192 151 226.6 96.29 267.6c.1934-10.82 1.242-21.84 3.535-33.05c13.47-65.81 66.04-119 131.4-134.2c28.33-6.562 55.68-6.013 80.93-.0054c56 13.32 118.2-7.412 149.3-61.24c5.664-9.828 20.02-9.516 24.66 .8282C502.7 76.76 512 121.9 512 165.4z"/>
3
+ </svg>
@@ -0,0 +1,3 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
2
+ <path fill="#030917" d="M512 165.4c0 127.9-70.05 235.3-175.3 270.1c-20.04 7.938-41.83 12.46-64.69 12.46c-64.9 0-125.2-36.51-155.7-94.47c-54.13 49.93-68.71 107-68.96 108.1C44.72 472.6 34.87 480 24.02 480c-1.844 0-3.727-.2187-5.602-.6562c-12.89-3.098-20.84-16.08-17.75-28.96c9.598-39.5 90.47-226.4 335.3-226.4C344.8 224 352 216.8 352 208S344.8 192 336 192C228.6 192 151 226.6 96.29 267.6c.1934-10.82 1.242-21.84 3.535-33.05c13.47-65.81 66.04-119 131.4-134.2c28.33-6.562 55.68-6.013 80.93-.0054c56 13.32 118.2-7.412 149.3-61.24c5.664-9.828 20.02-9.516 24.66 .8282C502.7 76.76 512 121.9 512 165.4z"/>
3
+ </svg>
@@ -0,0 +1,4 @@
1
+ import CompanyIconPrimary from './company-icon-primary.svg';
2
+ import CompanyIconSecondary from './company-icon-secondary.svg';
3
+
4
+ export { CompanyIconPrimary, CompanyIconSecondary };
package/src/index.ts ADDED
@@ -0,0 +1,9 @@
1
+ export * from './components';
2
+ export * from './styled';
3
+ export * from './hooks';
4
+ export * from './helpers';
5
+ export * from './views';
6
+ export * as errors from './errors';
7
+ export * from './types';
8
+ export * from './images';
9
+ export * as testing from './test/testUtils';
@@ -0,0 +1,35 @@
1
+ import { Meta, ColorPalette, ColorItem } from '@storybook/addon-docs';
2
+ import { styled } from '../styled';
3
+ import { darkTheme as theme } from '../styled/theme';
4
+
5
+ <Meta title="Colors" />
6
+
7
+ # Colors
8
+
9
+ <ColorPalette>
10
+ <ColorItem title="theme.colors.primary" colors={[theme.colors.primary]} />
11
+ <ColorItem title="theme.colors.secondary" colors={[theme.colors.secondary]} />
12
+
13
+ ## Alert colors
14
+
15
+ <ColorItem title="theme.colors.info" colors={[theme.colors.info]} />
16
+ <ColorItem title="theme.colors.success" colors={[theme.colors.success]} />
17
+ <ColorItem title="theme.colors.warning" colors={[theme.colors.warning]} />
18
+ <ColorItem title="theme.colors.error" colors={[theme.colors.error]} />
19
+
20
+ ## backgrounds
21
+
22
+ <ColorItem title="theme.colors.background" colors={[theme.colors.background]} />
23
+ <ColorItem title="theme.colors.backgroundAlt" colors={[theme.colors.backgroundAlt]} />
24
+ <ColorItem title="theme.colors.backgroundAccent" colors={[theme.colors.backgroundAccent]} />
25
+ <ColorItem title="theme.colors.placeholder" colors={[theme.colors.placeholder]} />
26
+ <ColorItem title="theme.colors.placeholderHighlight" colors={[theme.colors.placeholderHighlight]} />
27
+
28
+
29
+ ## Text
30
+
31
+ <ColorItem title="theme.colors.text" colors={[theme.colors.text]} />
32
+ <ColorItem title="theme.colors.textAlt" colors={[theme.colors.textAlt]} />
33
+ <ColorItem title="theme.colors.disabled" colors={[theme.colors.disabled]} />
34
+
35
+ </ColorPalette>
@@ -0,0 +1,56 @@
1
+ import { Meta } from '@storybook/addon-docs';
2
+
3
+
4
+ <Meta title="Elevation" />
5
+
6
+ ## Surface and Elevation
7
+
8
+ Elevation styles are used to create separation between surfaces. 6 elevation styles are avilable in a range of depths.
9
+ In default mode, elevation is created through shadows and elevation design tokens. In dark mode, on surfaces with elevation (i.e. Cards),
10
+ an additional transparent overlay is used to lighten the surface color and creat the visual effect of an elevated surface.
11
+
12
+ ### Elevation styles
13
+
14
+
15
+
16
+ Elevation styles are used to create separation between surfaces. Six elevation styles are avilable in a range of depths.
17
+
18
+ <div>
19
+
20
+ </div>
21
+
22
+ ### Examples
23
+
24
+ Some elevation styles are used on specific components within the Design System:
25
+
26
+ <table>
27
+ <tr>
28
+ <th>Depth level</th>
29
+ <th>Uses</th>
30
+ </tr>
31
+
32
+ <tr>
33
+ <td>Elevation 00</td>
34
+ <td>Background</td>
35
+ </tr>
36
+ <tr>
37
+ <td>Elevation 01</td>
38
+ <td>Cards Minimal, Tooltips</td>
39
+ </tr>
40
+ <tr>
41
+ <td>Elevation 02</td>
42
+ <td>Panels, Cards Subtle</td>
43
+ </tr>
44
+ <tr>
45
+ <td>Elevation 03</td>
46
+ <td>Panels, Navigation Bars, Cards Bold, Dialogs</td>
47
+ </tr>
48
+ <tr>
49
+ <td>Elevation 04</td>
50
+ <td>Notifications, Menus</td>
51
+ </tr>
52
+ <tr>
53
+ <td>Elevation 05</td>
54
+ <td>No specific purpose</td>
55
+ </tr>
56
+ </table>
@@ -0,0 +1,17 @@
1
+ import { Meta } from '@storybook/addon-docs';
2
+
3
+ <Meta title="Introduction" />
4
+
5
+ <style>{``}</style>
6
+
7
+ # Takaro UI library
8
+
9
+ Takaro UI is a component library custom made to used within the Takaro ecosystem.
10
+
11
+ ## Roadmap
12
+
13
+ You can see what we have in mind at our projects page.
14
+
15
+ ## Development
16
+
17
+ If you'd like to help us out with the project, we welcome contributions of all types! Check out our Contributing.md for more details on how you can help make Takaro UI even better!
@@ -0,0 +1,25 @@
1
+ import { Meta } from '@storybook/addon-docs';
2
+ import { spacing } from '../styled/spacing';
3
+
4
+ <Meta title="Spacing" />
5
+
6
+ # Spacing
7
+ Cosistent spacing of width, height, margins and padding maintain visual balance in the design system.
8
+
9
+ ## Spacing tokens
10
+ The design system provides spacers that can be used vertically and horizontally. The smaller spacers should be used on more detailed spacing of elements within reusable components.
11
+ The larger spacers should be used on layout spacing. **These spacing tokens should be used for all possible spacings!**
12
+
13
+ <div style={{ display: 'flex', flexWrap: 'wrap', alignItems: 'flex-end', marginTop: '20px' }}>
14
+ {Object.entries(spacing)
15
+ .sort((a, b) => parseFloat(a[0].replace('_', '.')) - parseFloat(b[0].replace('_', '.')))
16
+ .map(([key, value]) => (
17
+ <div key={key} style={{ margin: '10px', textAlign: 'center' }}>
18
+ <div style={{ backgroundColor: '#333', width: '50px', height: value, marginBottom: '5px' }}></div>
19
+ {key.replace('_', '.')}
20
+ </div>
21
+ ))}
22
+ </div>
23
+
24
+
25
+
@@ -0,0 +1,207 @@
1
+ import { createGlobalStyle, keyframes } from 'styled-components';
2
+ import { ThemeType } from './theme';
3
+ import { SnackBarStyles } from './Snackbar';
4
+
5
+ const skeletonLoading = keyframes`
6
+ 0% { transform: translateX(-100%); }
7
+ 40%, 100% { transform: translateX(100%); }
8
+ `;
9
+
10
+ export const GlobalStyle = createGlobalStyle<{ theme: ThemeType }>`
11
+
12
+ *::selection {
13
+ background-color: ${({ theme }) => theme.colors.primary};
14
+ color: white;
15
+ }
16
+
17
+ :root {
18
+ font-size: 62.5%; /* (62.5/100) * 16px = 10px */
19
+ box-sizing: border-box;
20
+ }
21
+
22
+ #takaro-root {
23
+ margin: 0 auto;
24
+ overflow-x: hidden;
25
+ }
26
+
27
+
28
+ html, body {
29
+ width: 100%;
30
+ height: 100%;
31
+ margin: 0;
32
+ padding: 0;
33
+ scroll-behavior: smooth;
34
+ line-height: 1.5;
35
+ font-family: 'Inter', sans-serif;
36
+ font-weight: 400;
37
+ font-size: ${({ theme }) => theme.fontSize.medium};
38
+ -webkit-font-smoothing: antialiased;
39
+ -moz-osx-font-smoothing: grayscale;
40
+ background-color: ${({ theme }) => theme.colors.background};
41
+
42
+ @supports (scrollbar-gutter: stable) {
43
+ scrollbar-gutter: stable;
44
+ }
45
+ }
46
+
47
+ body{
48
+ transition: background-color 0.2s linear;
49
+ overflow: hidden;
50
+ }
51
+
52
+ a, p, div, ul, li, h1, h2, h3, h4, h5, h6, header, footer, fieldset, legend, dl, dt{
53
+ transition: background-color 0.2s linear;
54
+ transition: box-shadow 0.125s linear;
55
+ margin: 0;
56
+ padding: 0;
57
+ box-sizing: border-box;
58
+ color: ${({ theme }) => theme.colors.text};
59
+ }
60
+
61
+ span {
62
+ letter-spacing: normal;
63
+ }
64
+
65
+ h1 {
66
+ font-size: ${({ theme }) => theme.fontSize.large};
67
+ font-weight: 600;
68
+ }
69
+ h2 {
70
+ font-size: ${({ theme }) => theme.fontSize.mediumLarge};
71
+ font-weight: 600;
72
+ }
73
+ h3 {
74
+ font-size: ${({ theme }) => theme.fontSize.medium};
75
+ font-weight: 500;
76
+ }
77
+
78
+
79
+ strong {
80
+ padding: ${({ theme }) => `0 ${theme.spacing['0_25']}`};
81
+ border-radius: ${({ theme }) => theme.borderRadius.small};
82
+ border: 1px solid ${({ theme }) => theme.colors.backgroundAccent};
83
+ background-color: ${({ theme }) => theme.colors.backgroundAlt};
84
+ font-weight: 400;
85
+ white-space: no-wrap;
86
+ }
87
+
88
+ form {
89
+ display: block;
90
+ width: 100%;
91
+ fieldset {
92
+ border: none;
93
+ }
94
+ }
95
+
96
+ input, textarea {
97
+ box-sizing: border-box;
98
+ margin: 0;
99
+ outline: 0;
100
+ padding: ${({ theme }) => `${theme.spacing['0_75']} ${theme.spacing[1]}`};
101
+ border-width: 0.1rem;
102
+ border-radius: ${({ theme }) => theme.borderRadius.medium};
103
+ font-size: ${({ theme }) => theme.fontSize.small};
104
+ border-color: transparent;
105
+ background-color: ${({ theme }) => theme.colors.backgroundAlt};
106
+ color: ${({ theme }) => theme.colors.text};
107
+ font-family: inherit;
108
+ &[readOnly]{
109
+ cursor: default;
110
+ &:focus {
111
+ border-color: none!important;
112
+ }
113
+ }
114
+
115
+ &:disabled {
116
+ cursor: not-allowed;
117
+ &:focus {
118
+ border-color: none!important;
119
+ }
120
+ }
121
+
122
+
123
+ &:focus {
124
+ outline: 0;
125
+ }
126
+ }
127
+
128
+ textarea {
129
+ resize: vertical;
130
+ width: calc(100% - ${({ theme }) => theme.spacing[1]} * 2);
131
+ }
132
+
133
+ input[type='search']::-webkit-search-decoration,
134
+ input[type='search']::-webkit-search-cancel-button,
135
+ input[type='search']::-webkit-search-results-button,
136
+ input[type='search']::-webkit-search-results-decoration {
137
+ display: none;
138
+ }
139
+
140
+ li {
141
+ list-style: none;
142
+ }
143
+
144
+ button {
145
+ display: block;
146
+ padding: ${({ theme }) => `${theme.spacing['0_75']} ${theme.spacing['2_5']}`};
147
+ border-radius: ${({ theme }) => theme.borderRadius.medium};
148
+ border: none;
149
+
150
+ &:disabled {
151
+ cursor: default;
152
+ }
153
+ }
154
+
155
+ a.underline {
156
+ text-decoration: underline;
157
+ text-decoration-color: inherit;
158
+ text-decoration-thickness: 1px;
159
+ }
160
+
161
+ a, button {
162
+ cursor: pointer;
163
+ text-decoration: none;
164
+ background-position: -100px;
165
+ &:active, &:focus{
166
+ outline: 0;
167
+ outline-style: none;
168
+ -moz-outline-style: none;
169
+ }
170
+ }
171
+
172
+ .placeholder {
173
+ overflow: hidden;
174
+ position: relative;
175
+ border-radius: ${({ theme }): string => theme.borderRadius.large};
176
+ background-color: ${({ theme }): string => theme.colors.placeholder};
177
+ border: 1px solid ${({ theme }): string => theme.colors.backgroundAccent};
178
+ &::before {
179
+ content: '';
180
+ width: 100%;
181
+ position: absolute;
182
+ top: 0;
183
+ right: 0;
184
+ bottom: 0;
185
+ left: 0;
186
+ transform: translateX(-100%);
187
+ background-image: linear-gradient(
188
+ 90deg,
189
+ ${({ theme }): string => theme.colors.placeholderHighlight}d3 0,
190
+ ${({ theme }): string => theme.colors.placeholderHighlight}4d 20%,
191
+ ${({ theme }): string => theme.colors.placeholderHighlight}66 60%,
192
+ ${({ theme }): string => theme.colors.placeholderHighlight}d3
193
+ );
194
+ animation: ${skeletonLoading} 2.5s infinite ease-in-out;
195
+ }
196
+ }
197
+
198
+ .simplebar-mask {
199
+ &:focus-visible {
200
+ border: none;
201
+ }
202
+ }
203
+
204
+ /* notistack snackbar styling */
205
+ ${SnackBarStyles}
206
+
207
+ `;
@@ -0,0 +1,42 @@
1
+ import { css } from 'styled-components';
2
+ import { ThemeType } from './theme';
3
+
4
+ export const SnackBarStyles = css<{ theme: ThemeType }>`
5
+ /* Snackbar snack colors for every type */
6
+ .mui-snackbar {
7
+ color: white;
8
+ }
9
+ .MuiSnackbarContent-root {
10
+ background-color: ${({ theme }): string => theme.colors.primary};
11
+ color: white;
12
+ }
13
+ #notistack-snackbar {
14
+ font-weight: 600;
15
+ font-family: 'Lato', sans-serif;
16
+ color: ${({ theme }) => theme.colors.text};
17
+ font-size: 1.5rem;
18
+ padding: 2rem;
19
+ }
20
+
21
+ div.SnackbarContent-root {
22
+ border: 1px solid ${({ theme }) => theme.colors.background};
23
+ box-shadow: ${({ theme }): string => theme.elevation[4]}!important;
24
+ }
25
+
26
+ /* info */
27
+ div.SnackbarItem-variantInfo {
28
+ background-color: ${({ theme }): string => theme.colors.white}!important;
29
+ }
30
+ /* success */
31
+ div.SnackbarItem-variantSuccess {
32
+ background-color: ${({ theme }): string => theme.colors.white}!important;
33
+ }
34
+ /* warning */
35
+ div.SnackbarItem-variantWarning {
36
+ background-color: ${({ theme }): string => theme.colors.white}!important;
37
+ }
38
+ /* error */
39
+ div.SnackbarItem-variantError {
40
+ background-color: ${({ theme }): string => theme.colors.background}!important;
41
+ }
42
+ `;
@@ -0,0 +1,36 @@
1
+ import { keyframes } from 'styled-components';
2
+
3
+ export const pulseAnimation = (color: string) => keyframes`
4
+ 0% {
5
+ transform: scale(0.95);
6
+ box-shadow: 0 0 0 0 ${color}B3;
7
+ }
8
+ 30% {
9
+ transform: scale(1);
10
+ box-shadow: 0 0 0 10px rgba(0,0,0,0.0);
11
+ }
12
+ 45% {
13
+ transform: scale(0.95);
14
+ box-shadow: 0 0 0 0 rgba(0,0,0,0);
15
+ }
16
+ 100% {
17
+ transform: scale(0.95);
18
+ box-shadow: 0 0 0 0 rgba(0,0,0,0);
19
+ }
20
+ `;
21
+
22
+ export const shakeAnimation = keyframes`
23
+ 2.5%, 22.5% {
24
+ transform: translate3d(-1px, 0, 0);
25
+ }
26
+ 5%, 20% {
27
+ transform: translate3d(2px, 0, 0);
28
+ }
29
+
30
+ 7.5%, 12.5%, 17.5% {
31
+ transform: translate3d(-4px, 0, 0);
32
+ }
33
+ 10%, 15% {
34
+ transform: translate3d(4px, 0, 0);
35
+ }
36
+ `;
@@ -0,0 +1,7 @@
1
+ export const breakpoint = {
2
+ tiny: '640px',
3
+ small: '768px',
4
+ medium: '1024px',
5
+ large: '1280px',
6
+ huge: '1536px',
7
+ } as const;
@@ -0,0 +1,10 @@
1
+ export const device = {
2
+ // We see everything bigger as the default.
3
+ xxl: '(max-width: 1921px)',
4
+ xl: '(max-width: 1500px)',
5
+ lg: '(max-width: 1200px)',
6
+ md: '(max-width: 992px)',
7
+ sm: '(max-width: 768px)',
8
+ xs: '(max-width: 576px)',
9
+ xxs: '(max-width: 450px)',
10
+ };
@@ -0,0 +1,20 @@
1
+ export type Elevation = 0 | 1 | 2 | 3 | 4 | 5;
2
+
3
+ // TODO: add link to docs
4
+ export const elevationLight: Record<Elevation, string> = {
5
+ 0: '0 1px 4px -1px hsla(214, 45%, 20%, 0.52)',
6
+ 1: '0 2px 4px -1px hsla(214, 53%, 23%, 0.16), 0 3px 12px -1px hsla(214, 50%, 22%, 0.26)',
7
+ 2: '0 2px 6px -1px hsla(214, 53%, 23%, 0.16), 0 8px 24px -4px hsla(214, 47%, 21%, 0.38)',
8
+ 3: '0 3px 18px -2px hsla(214, 53%, 23%, 0.16), 0 12px 48px -6px hsla(214, 47%, 21%, 0.38)',
9
+ 4: '0 4px 24px -3px hsla(214, 53%, 23%, 0.16), 0 18px 64px -8px hsla(214, 47%, 21%, 0.38)',
10
+ 5: '0 5px 32px -4px hsla(214, 53%, 23%, 0.16), 0 24px 70px -12px hsla(214, 47%, 21%, 0.38)',
11
+ };
12
+
13
+ export const elevationDark: Record<Elevation, string> = {
14
+ 0: '0 1px 4px -1px hsla(0, 0%, 0%, 0.52)',
15
+ 1: '0 2px 4px -1px hsla(0, 0%, 0%, 0.16), 0 3px 12px -1px hsla(0, 0%, 0%, 0.26)',
16
+ 2: '0 2px 6px -1px hsla(0, 0%, 0%, 0.16), 0 8px 24px -4px hsla(0, 0%, 0%, 0.38)',
17
+ 3: '0 3px 18px -2px hsla(0, 0%, 0%, 0.16), 0 12px 48px -6px hsla(0, 0%, 0%, 0.38)',
18
+ 4: '0 4px 24px -3px hsla(0, 0%, 0%, 0.16), 0 18px 64px -8px hsla(0, 0%, 0%, 0.38)',
19
+ 5: '0 5px 32px -4px hsla(0, 0%, 0%, 0.16), 0 24px 70px -12px hsla(0, 0%, 0%, 0.38)',
20
+ };