@ssa-ui-kit/widgets 0.0.18-alpha → 0.0.20-alpha

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 (534) hide show
  1. package/.babelrc.js +4 -4
  2. package/.env +7 -7
  3. package/.storybook/main.ts +42 -42
  4. package/.storybook/preview.tsx +21 -21
  5. package/.storybook/style.css +31 -31
  6. package/custom-shots/widgets-bots-table--no-control-orders--menu-opened_[w1920px].png +0 -0
  7. package/custom-shots/widgets-bots-table--no-control-orders--run-reason-modal_[w1920px].png +0 -0
  8. package/custom-shots/widgets-collapsiblenavbar-opened__[w1439px].png +0 -0
  9. package/custom-shots/widgets-collapsiblenavbar-opened__[w1439px]_statistics_submenu_popover.png +0 -0
  10. package/custom-shots/widgets-collapsiblenavbar-opened__[w1920px].png +0 -0
  11. package/custom-shots/widgets-collapsiblenavbar-opened__[w1920px]_side_menu_expanded.png +0 -0
  12. package/custom-shots/widgets-collapsiblenavbar-opened__[w1920px]_statistics_submenu_expanded.png +0 -0
  13. package/custom-shots/widgets-collapsiblenavbar-opened__[w1920px]_statistics_submenu_popover.png +0 -0
  14. package/custom-shots/widgets-collapsiblenavbar-opened__[w899px]_default.png +0 -0
  15. package/custom-shots/widgets-collapsiblenavbar-opened__[w899px]_menu_opened.png +0 -0
  16. package/custom-shots/widgets-collapsiblenavbar-opened__[w899px]_statistics_submenu.png +0 -0
  17. package/custom-shots/widgets-filters--default__[w1920px].png +0 -0
  18. package/custom-shots/widgets-filters--filter-button-items-not-selected__[w390px].png +0 -0
  19. package/custom-shots/widgets-filters--filter-button__[w390px].png +0 -0
  20. package/custom-shots/widgets-filters--filter-button__[w900px].png +0 -0
  21. package/custom-shots/widgets-filters--more-button-items-selected__[w390px].png +0 -0
  22. package/custom-shots/widgets-filters--more-button__[w900px].png +0 -0
  23. package/custom-shots/widgets-heart-rate--hint-opened__[w1440px].png +0 -0
  24. package/custom-shots/widgets-heart-rate--hint-opened__[w1920px].png +0 -0
  25. package/custom-shots/widgets-heart-rate--hint-opened__[w390px].png +0 -0
  26. package/custom-shots/widgets-heart-rate--hint-opened__[w900px].png +0 -0
  27. package/custom-shots/widgets-linkstabbar--current-focus__[w1920px].png +0 -0
  28. package/custom-shots/widgets-linkstabbar--non-current-focus__[w1920px].png +0 -0
  29. package/custom-shots/widgets-meal-nutrients--hint-opened__[w1440px].png +0 -0
  30. package/custom-shots/widgets-meal-nutrients--hint-opened__[w1920px].png +0 -0
  31. package/custom-shots/widgets-meal-nutrients--hint-opened__[w390px].png +0 -0
  32. package/custom-shots/widgets-meal-nutrients--hint-opened__[w900px].png +0 -0
  33. package/custom-shots/widgets-meal-nutrients--hint-opened__dropdown__[w1440px].png +0 -0
  34. package/custom-shots/widgets-meal-nutrients--hint-opened__dropdown__[w1920px].png +0 -0
  35. package/custom-shots/widgets-meal-nutrients--hint-opened__dropdown__[w390px].png +0 -0
  36. package/custom-shots/widgets-meal-nutrients--hint-opened__dropdown__[w900px].png +0 -0
  37. package/custom-shots/widgets-navbar--mobile-opened__[w1440px].png +0 -0
  38. package/custom-shots/widgets-navbar--mobile-opened__[w1920px].png +0 -0
  39. package/custom-shots/widgets-navbar--mobile-opened__[w390px].png +0 -0
  40. package/custom-shots/widgets-navbar--mobile-opened__[w900px].png +0 -0
  41. package/custom-shots/widgets-navbar-opened__[w1440px].png +0 -0
  42. package/custom-shots/widgets-navbar-opened__[w1920px].png +0 -0
  43. package/custom-shots/widgets-navbar-opened__[w390px].png +0 -0
  44. package/custom-shots/widgets-navbar-opened__[w900px].png +0 -0
  45. package/custom-shots/widgets-notification-menu--is-opened__[w1440px].png +0 -0
  46. package/custom-shots/widgets-notification-menu--is-opened__[w1920px].png +0 -0
  47. package/custom-shots/widgets-notification-menu--is-opened__[w390px].png +0 -0
  48. package/custom-shots/widgets-notification-menu--is-opened__[w900px].png +0 -0
  49. package/custom-shots/widgets-pagination--next-hover__[w1920px].png +0 -0
  50. package/custom-shots/widgets-pagination--not-selected-hover__[w1920px].png +0 -0
  51. package/custom-shots/widgets-pagination--previous-hover__[w1920px].png +0 -0
  52. package/custom-shots/widgets-pagination--selected-hover__[w1920px].png +0 -0
  53. package/custom-shots/widgets-pagination-disabled--next-hover__[w1920px].png +0 -0
  54. package/custom-shots/widgets-pagination-disabled--not-selected-hover__[w1920px].png +0 -0
  55. package/custom-shots/widgets-pagination-disabled--previous-hover__[w1920px].png +0 -0
  56. package/custom-shots/widgets-pagination-disabled--selected-hover__[w1920px].png +0 -0
  57. package/custom-shots/widgets-progressInfo__[w1440px].png +0 -0
  58. package/custom-shots/widgets-progressInfo__[w1920px].png +0 -0
  59. package/custom-shots/widgets-progressInfo__[w390px].png +0 -0
  60. package/custom-shots/widgets-progressInfo__[w900px].png +0 -0
  61. package/custom-shots/widgets-progressInfo__dropdown__[w1440px].png +0 -0
  62. package/custom-shots/widgets-progressInfo__dropdown__[w1920px].png +0 -0
  63. package/custom-shots/widgets-progressInfo__dropdown__[w390px].png +0 -0
  64. package/custom-shots/widgets-progressInfo__dropdown__[w900px].png +0 -0
  65. package/custom-shots/widgets-searchbox--cross-icon__[w1920px].png +0 -0
  66. package/custom-shots/widgets-searchbox--cross-icon__[w900px].png +0 -0
  67. package/custom-shots/widgets-searchbox--search-icon__[w1920px].png +0 -0
  68. package/custom-shots/widgets-searchbox--search-icon__[w900px].png +0 -0
  69. package/custom-shots/widgets-table-bots--default_[w1920px].png +0 -0
  70. package/custom-shots/widgets-table-bots--menu-opened_[w1920px].png +0 -0
  71. package/custom-shots/widgets-table-bots--no-control-orders--menu-opened_[w1920px].png +0 -0
  72. package/custom-shots/widgets-table-bots--no-control-orders--run-reason-modal_[w1920px].png +0 -0
  73. package/custom-shots/widgets-table-bots--run-reason-modal_[w1920px].png +0 -0
  74. package/custom-shots/widgets-table-filters--opened__[w1920px].png +0 -0
  75. package/custom-shots/widgets-trading-info-card--hover__[w1920px].png +0 -0
  76. package/custom-shots/widgets-user-profile--is-opened__[w1920px].png +0 -0
  77. package/customTest.tsx +35 -35
  78. package/dist/components/CollapsibleNavBar/TriggerIcon.d.ts +4 -2
  79. package/dist/components/CollapsibleNavBar/stories/CustomIcon.d.ts +1 -0
  80. package/dist/components/CollapsibleNavBar/types.d.ts +2 -1
  81. package/dist/components/NavBar/types.d.ts +3 -0
  82. package/dist/index.js +1 -1
  83. package/dist/index.js.map +1 -1
  84. package/jest-setup.ts +17 -17
  85. package/lostpixel.config.ts +29 -29
  86. package/package.json +2 -2
  87. package/playwright.config.ts +7 -7
  88. package/src/components/AccountBalance/AccountBalance.spec.tsx +111 -111
  89. package/src/components/AccountBalance/AccountBalance.stories.tsx +77 -77
  90. package/src/components/AccountBalance/AccountBalance.tsx +64 -64
  91. package/src/components/AccountBalance/BalancePieChart.tsx +86 -86
  92. package/src/components/AccountBalance/BalancePieChartTitle.tsx +42 -42
  93. package/src/components/AccountBalance/WithLink.tsx +29 -29
  94. package/src/components/AccountBalance/index.ts +5 -5
  95. package/src/components/AccountBalance/stories/fixtures.ts +26 -26
  96. package/src/components/AccountBalance/types.ts +34 -34
  97. package/src/components/Activity/Activity.spec.tsx +79 -79
  98. package/src/components/Activity/Activity.stories.tsx +15 -15
  99. package/src/components/Activity/Activity.tsx +83 -83
  100. package/src/components/Activity/ActivityItem.tsx +38 -38
  101. package/src/components/Activity/index.tsx +2 -2
  102. package/src/components/Activity/mockActivityRequest.ts +106 -106
  103. package/src/components/Activity/styles.ts +12 -12
  104. package/src/components/Activity/types.ts +10 -10
  105. package/src/components/AddNewAccountCard/AddNewAccountCard.spec.tsx +39 -39
  106. package/src/components/AddNewAccountCard/AddNewAccountCard.stories.tsx +48 -48
  107. package/src/components/AddNewAccountCard/AddNewAccountCard.tsx +22 -22
  108. package/src/components/AddNewAccountCard/index.ts +2 -2
  109. package/src/components/AddNewAccountCard/styles.ts +29 -29
  110. package/src/components/AddNewAccountCard/types.ts +7 -7
  111. package/src/components/Bmi/Bmi.spec.tsx +68 -68
  112. package/src/components/Bmi/Bmi.stories.tsx +10 -10
  113. package/src/components/Bmi/Bmi.tsx +96 -96
  114. package/src/components/Bmi/BmiHeatbar.tsx +18 -18
  115. package/src/components/Bmi/BmiInfo.tsx +11 -11
  116. package/src/components/Bmi/BmiLabel.tsx +9 -9
  117. package/src/components/Bmi/BmiLabels.tsx +33 -33
  118. package/src/components/Bmi/BmiPointer.tsx +15 -15
  119. package/src/components/Bmi/index.tsx +2 -2
  120. package/src/components/Bmi/styles.ts +18 -18
  121. package/src/components/Bmi/types.ts +4 -4
  122. package/src/components/BotsTable/BotsTable.e2e.ts +77 -77
  123. package/src/components/BotsTable/BotsTable.spec.tsx +125 -125
  124. package/src/components/BotsTable/BotsTable.tsx +32 -32
  125. package/src/components/BotsTable/BotsTableCell.tsx +13 -13
  126. package/src/components/BotsTable/BotsTableHead.tsx +13 -13
  127. package/src/components/BotsTable/BotsTableRow.tsx +17 -17
  128. package/src/components/BotsTable/BotsTableWrapper.tsx +23 -23
  129. package/src/components/BotsTable/index.ts +5 -5
  130. package/src/components/BotsTable/stories/BotsTable/StoryComponent.tsx +59 -59
  131. package/src/components/BotsTable/stories/BotsTable/components/Actions/ActionIcon.tsx +11 -11
  132. package/src/components/BotsTable/stories/BotsTable/components/Actions/ActionItem.tsx +40 -40
  133. package/src/components/BotsTable/stories/BotsTable/components/Actions/ActionMore.tsx +89 -89
  134. package/src/components/BotsTable/stories/BotsTable/components/Actions/ActionRun.tsx +133 -133
  135. package/src/components/BotsTable/stories/BotsTable/components/Actions/Actions.tsx +13 -13
  136. package/src/components/BotsTable/stories/BotsTable/components/Actions/ActionsWrapper.tsx +21 -21
  137. package/src/components/BotsTable/stories/BotsTable/components/Actions/consts.tsx +118 -118
  138. package/src/components/BotsTable/stories/BotsTable/components/Actions/index.ts +6 -6
  139. package/src/components/BotsTable/stories/BotsTable/components/Exchange/Exchange.tsx +26 -26
  140. package/src/components/BotsTable/stories/BotsTable/components/Exchange/consts.tsx +157 -157
  141. package/src/components/BotsTable/stories/BotsTable/components/Exchange/index.ts +1 -1
  142. package/src/components/BotsTable/stories/BotsTable/components/Exchange/types.ts +6 -6
  143. package/src/components/BotsTable/stories/BotsTable/components/PNL.tsx +27 -27
  144. package/src/components/BotsTable/stories/BotsTable/components/ROI.tsx +25 -25
  145. package/src/components/BotsTable/stories/BotsTable/components/TableTag.tsx +22 -22
  146. package/src/components/BotsTable/stories/BotsTable/components/Trade/Trade.tsx +8 -8
  147. package/src/components/BotsTable/stories/BotsTable/components/Trade/consts.ts +14 -14
  148. package/src/components/BotsTable/stories/BotsTable/components/Trade/index.ts +1 -1
  149. package/src/components/BotsTable/stories/BotsTable/components/Trade/types.ts +5 -5
  150. package/src/components/BotsTable/stories/BotsTable/components/index.ts +6 -6
  151. package/src/components/BotsTable/stories/BotsTable/index.ts +1 -1
  152. package/src/components/BotsTable/stories/BotsTable/mockData.ts +84 -84
  153. package/src/components/BotsTable/stories/BotsTable.stories.tsx +39 -39
  154. package/src/components/BotsTable/stories/NoControlOrders/StoryComponent.tsx +35 -35
  155. package/src/components/BotsTable/stories/NoControlOrders/components/ActionMore.tsx +95 -95
  156. package/src/components/BotsTable/stories/NoControlOrders/components/Reason.tsx +11 -11
  157. package/src/components/BotsTable/stories/NoControlOrders/components/TableList.tsx +45 -45
  158. package/src/components/BotsTable/stories/NoControlOrders/components/TableRow.tsx +31 -31
  159. package/src/components/BotsTable/stories/NoControlOrders/components/index.ts +4 -4
  160. package/src/components/BotsTable/stories/NoControlOrders/mockData.ts +23 -23
  161. package/src/components/BotsTable/stories/NoControlOrders/types.ts +16 -16
  162. package/src/components/BotsTable/types.ts +31 -31
  163. package/src/components/Calories/Calories.spec.tsx +11 -11
  164. package/src/components/Calories/Calories.stories.tsx +26 -26
  165. package/src/components/Calories/Calories.tsx +54 -54
  166. package/src/components/Calories/index.tsx +2 -2
  167. package/src/components/Calories/innerContent.tsx +30 -30
  168. package/src/components/Calories/types.ts +4 -4
  169. package/src/components/CardList/CardList.spec.tsx +32 -32
  170. package/src/components/CardList/CardList.stories.tsx +37 -37
  171. package/src/components/CardList/CardList.tsx +37 -37
  172. package/src/components/CardList/index.ts +2 -2
  173. package/src/components/CardList/types.ts +10 -10
  174. package/src/components/CollapsibleNavBar/CollapsibleNavBar.e2e.ts +115 -115
  175. package/src/components/CollapsibleNavBar/CollapsibleNavBar.spec.tsx +50 -50
  176. package/src/components/CollapsibleNavBar/CollapsibleNavBar.tsx +77 -77
  177. package/src/components/CollapsibleNavBar/CollapsibleNavBarBase.ts +134 -134
  178. package/src/components/CollapsibleNavBar/CollapsibleNavBarItem.ts +28 -28
  179. package/src/components/CollapsibleNavBar/CollapsibleNavBarLink.ts +40 -40
  180. package/src/components/CollapsibleNavBar/CollapsibleNavBarList.ts +18 -18
  181. package/src/components/CollapsibleNavBar/CollapsibleNavBarWrapper.ts +24 -24
  182. package/src/components/CollapsibleNavBar/CollapsibleNavContentToggle.tsx +27 -27
  183. package/src/components/CollapsibleNavBar/CollapsibleNavToggle.tsx +49 -49
  184. package/src/components/CollapsibleNavBar/CollapsibleNavToggleWrapper.ts +16 -16
  185. package/src/components/CollapsibleNavBar/NavBarAccordionContent.tsx +52 -52
  186. package/src/components/CollapsibleNavBar/NavBarItemWithSubMenu.tsx +94 -94
  187. package/src/components/CollapsibleNavBar/NavBarItemWithoutSubMenu.tsx +33 -28
  188. package/src/components/CollapsibleNavBar/NavBarPopover.tsx +124 -124
  189. package/src/components/CollapsibleNavBar/TriggerIcon.tsx +43 -33
  190. package/src/components/CollapsibleNavBar/index.ts +2 -2
  191. package/src/components/CollapsibleNavBar/stories/CollapsibleNavBar.stories.tsx +73 -53
  192. package/src/components/CollapsibleNavBar/stories/CustomIcon.tsx +20 -0
  193. package/src/components/CollapsibleNavBar/stories/Layout.tsx +53 -53
  194. package/src/components/CollapsibleNavBar/stories/Logo.tsx +12 -12
  195. package/src/components/CollapsibleNavBar/stories/StoryComponent.tsx +20 -20
  196. package/src/components/CollapsibleNavBar/stories/consts.ts +37 -37
  197. package/src/components/CollapsibleNavBar/stories/styles.ts +21 -21
  198. package/src/components/CollapsibleNavBar/styles.ts +91 -91
  199. package/src/components/CollapsibleNavBar/types.ts +17 -16
  200. package/src/components/ExchangeAccount/ExchangeAccount.spec.tsx +110 -110
  201. package/src/components/ExchangeAccount/ExchangeAccount.stories.tsx +90 -90
  202. package/src/components/ExchangeAccount/ExchangeAccount.tsx +73 -73
  203. package/src/components/ExchangeAccount/helpers.tsx +153 -153
  204. package/src/components/ExchangeAccount/index.ts +2 -2
  205. package/src/components/ExchangeAccount/styles.ts +133 -133
  206. package/src/components/ExchangeAccount/types.ts +12 -12
  207. package/src/components/ExchangeAccountKeys/ExchangeAccountKeys.spec.tsx +43 -43
  208. package/src/components/ExchangeAccountKeys/ExchangeAccountKeys.stories.tsx +14 -14
  209. package/src/components/ExchangeAccountKeys/ExchangeAccountKeys.tsx +73 -73
  210. package/src/components/ExchangeAccountKeys/helpers.ts +7 -7
  211. package/src/components/ExchangeAccountKeys/index.ts +2 -2
  212. package/src/components/ExchangeAccountKeys/stories/StoryComponent.tsx +33 -33
  213. package/src/components/ExchangeAccountKeys/styles.ts +87 -87
  214. package/src/components/ExchangeAccountKeys/types.ts +8 -8
  215. package/src/components/Filters/FilterBlockWrapper.tsx +11 -11
  216. package/src/components/Filters/Filters.e2e.ts +115 -115
  217. package/src/components/Filters/Filters.spec.tsx +47 -47
  218. package/src/components/Filters/Filters.tsx +87 -87
  219. package/src/components/Filters/FiltersBlock.tsx +77 -77
  220. package/src/components/Filters/FiltersContext.tsx +44 -44
  221. package/src/components/Filters/FiltersWrapper.tsx +34 -34
  222. package/src/components/Filters/hooks/useVisibility.ts +101 -101
  223. package/src/components/Filters/index.ts +1 -1
  224. package/src/components/Filters/stories/Filters.stories.tsx +24 -24
  225. package/src/components/Filters/stories/StoryComponent.tsx +19 -19
  226. package/src/components/Filters/stories/mockData.ts +421 -421
  227. package/src/components/Filters/types.ts +4 -4
  228. package/src/components/HeartRate/BPM.tsx +43 -43
  229. package/src/components/HeartRate/HeartRate.e2e.ts +78 -78
  230. package/src/components/HeartRate/HeartRate.spec.tsx +91 -91
  231. package/src/components/HeartRate/HeartRate.stories.tsx +36 -36
  232. package/src/components/HeartRate/HeartRate.tsx +105 -105
  233. package/src/components/HeartRate/HeartRateLineChart.tsx +53 -53
  234. package/src/components/HeartRate/index.ts +2 -2
  235. package/src/components/HeartRate/mockHeartRateRequest.ts +15 -15
  236. package/src/components/HeartRate/types.ts +15 -15
  237. package/src/components/HeartRate/utils.tsx +8 -8
  238. package/src/components/LinksTabBar/LinksTabBar.e2e.ts +23 -23
  239. package/src/components/LinksTabBar/LinksTabBar.spec.tsx +48 -48
  240. package/src/components/LinksTabBar/LinksTabBar.stories.tsx +45 -45
  241. package/src/components/LinksTabBar/LinksTabBar.tsx +14 -14
  242. package/src/components/LinksTabBar/LinksTabBarBase.tsx +36 -36
  243. package/src/components/LinksTabBar/index.ts +2 -2
  244. package/src/components/LinksTabBar/stories/decorators.tsx +34 -34
  245. package/src/components/LinksTabBar/stories/mockData.ts +27 -27
  246. package/src/components/LinksTabBar/types.ts +12 -12
  247. package/src/components/ListGoals/ListGoals.spec.tsx +82 -82
  248. package/src/components/ListGoals/ListGoals.stories.tsx +58 -58
  249. package/src/components/ListGoals/ListGoals.tsx +29 -29
  250. package/src/components/ListGoals/ListGoalsCard.tsx +61 -61
  251. package/src/components/ListGoals/index.ts +2 -2
  252. package/src/components/ListGoals/styles.tsx +11 -11
  253. package/src/components/ListGoals/types.ts +25 -25
  254. package/src/components/MealNutrients/MealNutrients.e2e.ts +68 -68
  255. package/src/components/MealNutrients/MealNutrients.spec.tsx +134 -134
  256. package/src/components/MealNutrients/MealNutrients.stories.tsx +37 -37
  257. package/src/components/MealNutrients/MealNutrients.tsx +84 -84
  258. package/src/components/MealNutrients/MealNutrientsLineChart.tsx +87 -87
  259. package/src/components/MealNutrients/MealNutrientsTooltip.tsx +30 -30
  260. package/src/components/MealNutrients/chartDefaultConfig.tsx +87 -87
  261. package/src/components/MealNutrients/index.tsx +2 -2
  262. package/src/components/MealNutrients/mockMealNutrientsRequest.ts +1246 -1246
  263. package/src/components/MealNutrients/types.ts +37 -37
  264. package/src/components/MealNutrients/useChartConfig.ts +69 -69
  265. package/src/components/MealPlanner/MealPlanner.spec.tsx +77 -77
  266. package/src/components/MealPlanner/MealPlanner.stories.tsx +15 -15
  267. package/src/components/MealPlanner/MealPlanner.tsx +100 -100
  268. package/src/components/MealPlanner/MealPlannerBadge.tsx +15 -15
  269. package/src/components/MealPlanner/MealPlannerBars.tsx +19 -19
  270. package/src/components/MealPlanner/MealPlannerCard.tsx +73 -73
  271. package/src/components/MealPlanner/MealPlannerLegends.tsx +22 -22
  272. package/src/components/MealPlanner/index.ts +2 -2
  273. package/src/components/MealPlanner/mockMealPlannerRequest.ts +70 -70
  274. package/src/components/MealPlanner/types.ts +21 -21
  275. package/src/components/NavBar/NavBar.e2e.ts +64 -64
  276. package/src/components/NavBar/NavBar.stories.tsx +86 -86
  277. package/src/components/NavBar/NavBar.tsx +41 -41
  278. package/src/components/NavBar/NavBarBase.ts +45 -45
  279. package/src/components/NavBar/NavBarItem.ts +13 -13
  280. package/src/components/NavBar/NavBarLink.ts +33 -33
  281. package/src/components/NavBar/NavBarList.ts +16 -16
  282. package/src/components/NavBar/NavBarWrapper.ts +40 -40
  283. package/src/components/NavBar/NavToggle.tsx +36 -36
  284. package/src/components/NavBar/NavToggleWrapper.ts +21 -21
  285. package/src/components/NavBar/index.ts +2 -2
  286. package/src/components/NavBar/types.ts +25 -22
  287. package/src/components/NotificationCard/NotificationCard.spec.tsx +113 -113
  288. package/src/components/NotificationCard/NotificationCard.stories.tsx +112 -112
  289. package/src/components/NotificationCard/NotificationCard.tsx +95 -95
  290. package/src/components/NotificationCard/index.ts +2 -2
  291. package/src/components/NotificationCard/styles.tsx +134 -134
  292. package/src/components/NotificationCard/types.ts +12 -12
  293. package/src/components/NotificationMenu/NotificationMenu.e2e.ts +27 -27
  294. package/src/components/NotificationMenu/NotificationMenu.spec.tsx +64 -64
  295. package/src/components/NotificationMenu/NotificationMenu.tsx +77 -77
  296. package/src/components/NotificationMenu/helpers.ts +91 -91
  297. package/src/components/NotificationMenu/index.ts +2 -2
  298. package/src/components/NotificationMenu/stories/NotificationMenu.stories.tsx +14 -14
  299. package/src/components/NotificationMenu/stories/StoryComponent.tsx +85 -85
  300. package/src/components/NotificationMenu/stories/StoryContent.tsx +52 -52
  301. package/src/components/NotificationMenu/styles.ts +125 -125
  302. package/src/components/NotificationMenu/types.ts +11 -11
  303. package/src/components/Pagination/ArrowButton.tsx +32 -32
  304. package/src/components/Pagination/Pagination.e2e.ts +51 -51
  305. package/src/components/Pagination/Pagination.spec.tsx +228 -228
  306. package/src/components/Pagination/Pagination.stories.tsx +60 -60
  307. package/src/components/Pagination/Pagination.tsx +66 -66
  308. package/src/components/Pagination/PaginationButtons.tsx +63 -63
  309. package/src/components/Pagination/PaginationContext.tsx +20 -20
  310. package/src/components/Pagination/index.ts +3 -3
  311. package/src/components/Pagination/styles.tsx +98 -98
  312. package/src/components/Pagination/types.ts +38 -38
  313. package/src/components/PieChart/PieChart.spec.tsx +97 -97
  314. package/src/components/PieChart/PieChart.stories.tsx +129 -129
  315. package/src/components/PieChart/PieChart.tsx +40 -40
  316. package/src/components/PieChart/PieChartBases.tsx +26 -26
  317. package/src/components/PieChart/PieChartLegend.tsx +74 -74
  318. package/src/components/PieChart/PieChartLegendList.tsx +19 -19
  319. package/src/components/PieChart/PieChartLegendMarker.tsx +12 -12
  320. package/src/components/PieChart/colorPalettes.ts +28 -28
  321. package/src/components/PieChart/index.ts +4 -4
  322. package/src/components/PieChart/stories/fixtures.ts +39 -39
  323. package/src/components/PieChart/types.ts +30 -30
  324. package/src/components/ProgressInfo/ProgressInfo.e2e.ts +31 -31
  325. package/src/components/ProgressInfo/ProgressInfo.spec.tsx +91 -91
  326. package/src/components/ProgressInfo/ProgressInfo.stories.tsx +32 -32
  327. package/src/components/ProgressInfo/ProgressInfo.tsx +117 -117
  328. package/src/components/ProgressInfo/ProgressInfoTotals.tsx +60 -60
  329. package/src/components/ProgressInfo/index.ts +3 -3
  330. package/src/components/ProgressInfo/mockProgressInfoRequest.ts +166 -166
  331. package/src/components/ProgressInfo/styles.ts +20 -20
  332. package/src/components/ProgressInfo/types.ts +29 -29
  333. package/src/components/SearchBox/SearchBox.e2e.ts +37 -37
  334. package/src/components/SearchBox/SearchBox.spec.tsx +77 -77
  335. package/src/components/SearchBox/SearchBox.tsx +70 -70
  336. package/src/components/SearchBox/SearchBoxCrossIcon.tsx +26 -26
  337. package/src/components/SearchBox/SearchBoxInput.tsx +42 -42
  338. package/src/components/SearchBox/SearchBoxWrapper.tsx +9 -9
  339. package/src/components/SearchBox/index.ts +4 -4
  340. package/src/components/SearchBox/stories/SearchBox.stories.tsx +16 -16
  341. package/src/components/SearchBox/stories/StoryComponent.tsx +25 -25
  342. package/src/components/SearchBox/types.ts +9 -9
  343. package/src/components/StepsCounter/StepsCounter.spec.tsx +14 -14
  344. package/src/components/StepsCounter/StepsCounter.stories.tsx +16 -16
  345. package/src/components/StepsCounter/StepsCounter.tsx +74 -74
  346. package/src/components/StepsCounter/index.ts +2 -2
  347. package/src/components/StepsCounter/types.ts +4 -4
  348. package/src/components/TableFilters/TableFilterCancelButton.tsx +39 -39
  349. package/src/components/TableFilters/TableFilterCheckbox.tsx +24 -24
  350. package/src/components/TableFilters/TableFilterClearButton.tsx +47 -47
  351. package/src/components/TableFilters/TableFilterTrigger.tsx +66 -66
  352. package/src/components/TableFilters/TableFilterTriggerWithNotification.tsx +44 -44
  353. package/src/components/TableFilters/TableFilters.e2e.ts +32 -32
  354. package/src/components/TableFilters/TableFilters.spec.tsx +171 -171
  355. package/src/components/TableFilters/TableFilters.tsx +187 -187
  356. package/src/components/TableFilters/TableFiltersAccordion.tsx +14 -14
  357. package/src/components/TableFilters/TableFiltersAccordionContent.tsx +18 -18
  358. package/src/components/TableFilters/TableFiltersButtons.tsx +32 -32
  359. package/src/components/TableFilters/hooks/useTableData.ts +137 -137
  360. package/src/components/TableFilters/index.ts +9 -9
  361. package/src/components/TableFilters/stories/StoryComponent.tsx +35 -35
  362. package/src/components/TableFilters/stories/TableFilters.stories.tsx +17 -17
  363. package/src/components/TableFilters/stories/TableFiltersWrapper.tsx +7 -7
  364. package/src/components/TableFilters/stories/mockData.tsx +114 -114
  365. package/src/components/TableFilters/styles.ts +26 -26
  366. package/src/components/TableFilters/types.ts +34 -34
  367. package/src/components/TableFilters/utils/handlers.ts +73 -73
  368. package/src/components/TradingInfoCard/TradingInfoCard.e2e.ts +16 -16
  369. package/src/components/TradingInfoCard/TradingInfoCard.spec.tsx +116 -116
  370. package/src/components/TradingInfoCard/TradingInfoCard.stories.tsx +118 -118
  371. package/src/components/TradingInfoCard/TradingInfoCard.tsx +43 -43
  372. package/src/components/TradingInfoCard/TradingInfoCardContent.tsx +32 -32
  373. package/src/components/TradingInfoCard/TradingInfoCardTooltip.tsx +47 -47
  374. package/src/components/TradingInfoCard/TradingInfoCardWrapper.tsx +72 -72
  375. package/src/components/TradingInfoCard/index.ts +3 -3
  376. package/src/components/TradingInfoCard/types.ts +27 -27
  377. package/src/components/TradingScoreboard/TradingScoreboard.spec.tsx +119 -119
  378. package/src/components/TradingScoreboard/TradingScoreboard.stories.tsx +119 -119
  379. package/src/components/TradingScoreboard/TradingScoreboard.tsx +41 -41
  380. package/src/components/TradingScoreboard/TradingScoreboardBase.tsx +17 -17
  381. package/src/components/TradingScoreboard/helpers.tsx +134 -134
  382. package/src/components/TradingScoreboard/index.ts +2 -2
  383. package/src/components/TradingScoreboard/types.ts +18 -18
  384. package/src/components/UpcomingWorkouts/UpcomingWorkoutCard.tsx +64 -64
  385. package/src/components/UpcomingWorkouts/UpcomingWorkouts.spec.tsx +56 -56
  386. package/src/components/UpcomingWorkouts/UpcomingWorkouts.stories.tsx +32 -32
  387. package/src/components/UpcomingWorkouts/UpcomingWorkouts.tsx +27 -27
  388. package/src/components/UpcomingWorkouts/index.ts +2 -2
  389. package/src/components/UpcomingWorkouts/style.ts +12 -12
  390. package/src/components/UpcomingWorkouts/types.ts +23 -23
  391. package/src/components/UserCard/UserCard.tsx +46 -46
  392. package/src/components/UserCard/UserCardBMI.tsx +37 -37
  393. package/src/components/UserCard/UserCardCredentials.tsx +56 -56
  394. package/src/components/UserCard/UserCardItem.tsx +42 -42
  395. package/src/components/UserCard/index.tsx +2 -2
  396. package/src/components/UserCard/types.ts +8 -8
  397. package/src/components/UserProfile/UserProfile.e2e.ts +21 -21
  398. package/src/components/UserProfile/UserProfile.spec.tsx +107 -107
  399. package/src/components/UserProfile/UserProfile.stories.tsx +21 -21
  400. package/src/components/UserProfile/UserProfile.tsx +53 -53
  401. package/src/components/UserProfile/index.ts +2 -2
  402. package/src/components/UserProfile/styles.ts +47 -47
  403. package/src/components/UserProfile/types.ts +8 -8
  404. package/src/components/WaterConsume/WaterConsume.spec.tsx +62 -62
  405. package/src/components/WaterConsume/WaterConsume.stories.tsx +36 -36
  406. package/src/components/WaterConsume/WaterConsume.tsx +188 -188
  407. package/src/components/WaterConsume/index.ts +2 -2
  408. package/src/components/WaterConsume/types.ts +11 -11
  409. package/src/consts.ts +18 -18
  410. package/src/index.ts +53 -53
  411. package/src/injectGlobal.ts +41 -41
  412. package/storybook-static/106.9e8cbea9.iframe.bundle.js +1 -0
  413. package/storybook-static/134.2444003c.iframe.bundle.js +1 -0
  414. package/storybook-static/166.927d7b90.iframe.bundle.js +1 -0
  415. package/storybook-static/185.4df02b5b.iframe.bundle.js +139 -0
  416. package/storybook-static/185.4df02b5b.iframe.bundle.js.map +1 -0
  417. package/storybook-static/251.8c3ebcca.iframe.bundle.js +1 -0
  418. package/storybook-static/263.0a5aa731.iframe.bundle.js +1 -0
  419. package/storybook-static/283.258a25c8.iframe.bundle.js +1 -0
  420. package/storybook-static/326.7772ae66.iframe.bundle.js +1 -0
  421. package/storybook-static/494.f5410ab1.iframe.bundle.js +2 -0
  422. package/storybook-static/494.f5410ab1.iframe.bundle.js.LICENSE.txt +18 -0
  423. package/storybook-static/497.7e0c2fc7.iframe.bundle.js +44 -0
  424. package/storybook-static/497.7e0c2fc7.iframe.bundle.js.map +1 -0
  425. package/storybook-static/540.17a57e0e.iframe.bundle.js +1 -0
  426. package/storybook-static/547.951a46da.iframe.bundle.js +1 -0
  427. package/storybook-static/609.f12a4891.iframe.bundle.js +1 -0
  428. package/storybook-static/620.61fd9060.iframe.bundle.js +1 -0
  429. package/storybook-static/633.947e8b75.iframe.bundle.js +1 -0
  430. package/storybook-static/661.14057bc5.iframe.bundle.js +1 -0
  431. package/storybook-static/753.91179890.iframe.bundle.js +1 -0
  432. package/storybook-static/76.25b4aa80.iframe.bundle.js +1 -0
  433. package/storybook-static/767.1716b836.iframe.bundle.js +1 -0
  434. package/storybook-static/781.3faed4b1.iframe.bundle.js +2 -0
  435. package/storybook-static/781.3faed4b1.iframe.bundle.js.LICENSE.txt +32 -0
  436. package/storybook-static/906.a25e1330.iframe.bundle.js +402 -0
  437. package/storybook-static/906.a25e1330.iframe.bundle.js.LICENSE.txt +62 -0
  438. package/storybook-static/906.a25e1330.iframe.bundle.js.map +1 -0
  439. package/storybook-static/912.a84a00a8.iframe.bundle.js +1 -0
  440. package/storybook-static/973.d2780faa.iframe.bundle.js +1 -0
  441. package/storybook-static/979.9baaf9d9.iframe.bundle.js +1 -0
  442. package/storybook-static/995.818e1781.iframe.bundle.js +1 -0
  443. package/storybook-static/components-Activity-Activity-stories.1f2220be.iframe.bundle.js +1 -0
  444. package/storybook-static/components-Bmi-Bmi-stories.033dba0e.iframe.bundle.js +1 -0
  445. package/storybook-static/components-Calories-Calories-stories.61da75cb.iframe.bundle.js +1 -0
  446. package/storybook-static/components-CardList-CardList-stories.caaffeda.iframe.bundle.js +1 -0
  447. package/storybook-static/components-HeartRate-HeartRate-stories.bd133239.iframe.bundle.js +1 -0
  448. package/storybook-static/components-ListGoals-ListGoals-stories.e68d5cbf.iframe.bundle.js +1 -0
  449. package/storybook-static/components-MealNutrients-MealNutrients-stories.7e46bd1e.iframe.bundle.js +1 -0
  450. package/storybook-static/components-MealPlanner-MealPlanner-stories.4b8341d3.iframe.bundle.js +1 -0
  451. package/storybook-static/components-NavBar-NavBar-stories.4f37096a.iframe.bundle.js +1 -0
  452. package/storybook-static/components-Pagination-Pagination-stories.2fd0c446.iframe.bundle.js +1 -0
  453. package/storybook-static/components-ProgressInfo-ProgressInfo-stories.665cee18.iframe.bundle.js +1 -0
  454. package/storybook-static/components-StepsCounter-StepsCounter-stories.b87bd065.iframe.bundle.js +1 -0
  455. package/storybook-static/components-TableFilters-stories-TableFilters-stories.24c4f9e8.iframe.bundle.js +1 -0
  456. package/storybook-static/components-UpcomingWorkouts-UpcomingWorkouts-stories.fab18fcf.iframe.bundle.js +1 -0
  457. package/storybook-static/components-WaterConsume-WaterConsume-stories.5dae388e.iframe.bundle.js +1 -0
  458. package/storybook-static/favicon.svg +7 -0
  459. package/storybook-static/iframe.html +355 -0
  460. package/storybook-static/index.html +126 -0
  461. package/storybook-static/index.json +1 -0
  462. package/storybook-static/main.c21822d8.iframe.bundle.js +1 -0
  463. package/storybook-static/project.json +1 -0
  464. package/storybook-static/runtime~main.b259f462.iframe.bundle.js +1 -0
  465. package/storybook-static/sb-addons/essentials-actions-2/manager-bundle.js +4 -0
  466. package/storybook-static/sb-addons/essentials-actions-2/manager-bundle.js.LEGAL.txt +0 -0
  467. package/storybook-static/sb-addons/essentials-actions-2/manager-bundle.js.map +7 -0
  468. package/storybook-static/sb-addons/essentials-backgrounds-3/manager-bundle.js +13 -0
  469. package/storybook-static/sb-addons/essentials-backgrounds-3/manager-bundle.js.LEGAL.txt +0 -0
  470. package/storybook-static/sb-addons/essentials-backgrounds-3/manager-bundle.js.map +7 -0
  471. package/storybook-static/sb-addons/essentials-controls-1/manager-bundle.js +115 -0
  472. package/storybook-static/sb-addons/essentials-controls-1/manager-bundle.js.LEGAL.txt +18 -0
  473. package/storybook-static/sb-addons/essentials-controls-1/manager-bundle.js.map +7 -0
  474. package/storybook-static/sb-addons/essentials-measure-6/manager-bundle.js +4 -0
  475. package/storybook-static/sb-addons/essentials-measure-6/manager-bundle.js.LEGAL.txt +0 -0
  476. package/storybook-static/sb-addons/essentials-measure-6/manager-bundle.js.map +7 -0
  477. package/storybook-static/sb-addons/essentials-outline-7/manager-bundle.js +4 -0
  478. package/storybook-static/sb-addons/essentials-outline-7/manager-bundle.js.LEGAL.txt +0 -0
  479. package/storybook-static/sb-addons/essentials-outline-7/manager-bundle.js.map +7 -0
  480. package/storybook-static/sb-addons/essentials-toolbars-5/manager-bundle.js +4 -0
  481. package/storybook-static/sb-addons/essentials-toolbars-5/manager-bundle.js.LEGAL.txt +0 -0
  482. package/storybook-static/sb-addons/essentials-toolbars-5/manager-bundle.js.map +7 -0
  483. package/storybook-static/sb-addons/essentials-viewport-4/manager-bundle.js +4 -0
  484. package/storybook-static/sb-addons/essentials-viewport-4/manager-bundle.js.LEGAL.txt +0 -0
  485. package/storybook-static/sb-addons/essentials-viewport-4/manager-bundle.js.map +7 -0
  486. package/storybook-static/sb-addons/interactions-8/manager-bundle.js +28 -0
  487. package/storybook-static/sb-addons/interactions-8/manager-bundle.js.LEGAL.txt +0 -0
  488. package/storybook-static/sb-addons/interactions-8/manager-bundle.js.map +7 -0
  489. package/storybook-static/sb-addons/links-0/manager-bundle.js +4 -0
  490. package/storybook-static/sb-addons/links-0/manager-bundle.js.LEGAL.txt +0 -0
  491. package/storybook-static/sb-addons/links-0/manager-bundle.js.map +7 -0
  492. package/storybook-static/sb-common-assets/fonts.css +31 -0
  493. package/storybook-static/sb-common-assets/nunito-sans-bold-italic.woff2 +0 -0
  494. package/storybook-static/sb-common-assets/nunito-sans-bold.woff2 +0 -0
  495. package/storybook-static/sb-common-assets/nunito-sans-italic.woff2 +0 -0
  496. package/storybook-static/sb-common-assets/nunito-sans-regular.woff2 +0 -0
  497. package/storybook-static/sb-manager/CRUD-I5EZL2FS-LBZVDZXV.js +1 -0
  498. package/storybook-static/sb-manager/Communicate-7JXCND2Z-6SIVXWT4.js +1 -0
  499. package/storybook-static/sb-manager/Devices-SUYACUPO-DMGV6ENX.js +1 -0
  500. package/storybook-static/sb-manager/Documents-SGWAY3KW-XZRZ6I6S.js +1 -0
  501. package/storybook-static/sb-manager/Editing-7QFB6ZMG-J5U6QGB6.js +1 -0
  502. package/storybook-static/sb-manager/Git-DZ2D5ZUL-VKBWYJHE.js +1 -0
  503. package/storybook-static/sb-manager/GlobalScrollAreaStyles-4LLX2B3H-DOBSPBNW.js +7 -0
  504. package/storybook-static/sb-manager/Images-S2WTXNGG-NXAYS4VP.js +1 -0
  505. package/storybook-static/sb-manager/Logos-SJTNNI74-F3IVL4UV.js +1 -0
  506. package/storybook-static/sb-manager/OS-YZ2Y4VYS-KGSGCOHC.js +1 -0
  507. package/storybook-static/sb-manager/OverlayScrollbars-OL4C4TVX-FNYA4OIC.js +1 -0
  508. package/storybook-static/sb-manager/People-OD4EV7WZ-DBPUNUXW.js +1 -0
  509. package/storybook-static/sb-manager/Wayfinding-BB4H7CHP-N2QAVLVA.js +1 -0
  510. package/storybook-static/sb-manager/WithTooltip-YBG737T3-GLWUADFI.js +1 -0
  511. package/storybook-static/sb-manager/chunk-6KNXZZZ5.js +207 -0
  512. package/storybook-static/sb-manager/chunk-DP4DR4LA.js +15 -0
  513. package/storybook-static/sb-manager/chunk-GBCXFRBK.js +1 -0
  514. package/storybook-static/sb-manager/chunk-IFNK3PLJ.js +1 -0
  515. package/storybook-static/sb-manager/chunk-JMPBYCHU.js +1 -0
  516. package/storybook-static/sb-manager/chunk-JSPL73I3.js +1 -0
  517. package/storybook-static/sb-manager/chunk-SJD7EFYL.js +136 -0
  518. package/storybook-static/sb-manager/chunk-UBXIQABM.js +447 -0
  519. package/storybook-static/sb-manager/chunk-V7GYLJLR.js +7 -0
  520. package/storybook-static/sb-manager/chunk-Z4NRYNHR.js +1 -0
  521. package/storybook-static/sb-manager/formatter-6736J7QO-TGL2ZGQC.js +156 -0
  522. package/storybook-static/sb-manager/globals.js +1 -0
  523. package/storybook-static/sb-manager/index.js +1 -0
  524. package/storybook-static/sb-manager/runtime.js +1 -0
  525. package/storybook-static/sb-manager/syntaxhighlighter-4OVWVELQ-5IZ45DZY.js +1 -0
  526. package/storybook-static/sb-preview/globals.js +1 -0
  527. package/storybook-static/sb-preview/runtime.js +105 -0
  528. package/storybook-static/stories.json +1 -0
  529. package/tsbuildcache +1 -1
  530. package/tsconfig.build.json +44 -44
  531. package/tsconfig.json +17 -17
  532. package/tsconfig.tsbuildinfo +1 -0
  533. package/webpack.config.js +28 -28
  534. package/LICENSE +0 -21
@@ -1,37 +1,37 @@
1
- import { useState, useEffect } from 'react';
2
- import type { Meta } from '@storybook/react';
3
-
4
- import { MealNutrients } from './index';
5
- import { IMealNutrientsProps } from './types';
6
-
7
- import { mockStaticApi } from './mockMealNutrientsRequest';
8
- const { getData, getOptions } = mockStaticApi;
9
-
10
- export default {
11
- title: 'Widgets/MealNutrients',
12
- component: MealNutrients,
13
- } as Meta<typeof MealNutrients>;
14
-
15
- export const Default = () => {
16
- const [options, setOptions] = useState<IMealNutrientsProps['options']>([]);
17
- const [data, setData] = useState<IMealNutrientsProps['data']>([]);
18
-
19
- useEffect(() => {
20
- getOptions()
21
- .then((respOptions) => {
22
- setOptions(respOptions);
23
- return getData(respOptions[0].value);
24
- })
25
- .then(setData);
26
- }, []);
27
-
28
- return (
29
- <MealNutrients
30
- data={data}
31
- options={options}
32
- onOptionChange={({ value }) => {
33
- getData(String(value) as 'd' | 'w' | 'm').then(setData);
34
- }}
35
- />
36
- );
37
- };
1
+ import { useState, useEffect } from 'react';
2
+ import type { Meta } from '@storybook/react';
3
+
4
+ import { MealNutrients } from './index';
5
+ import { IMealNutrientsProps } from './types';
6
+
7
+ import { mockStaticApi } from './mockMealNutrientsRequest';
8
+ const { getData, getOptions } = mockStaticApi;
9
+
10
+ export default {
11
+ title: 'Widgets/MealNutrients',
12
+ component: MealNutrients,
13
+ } as Meta<typeof MealNutrients>;
14
+
15
+ export const Default = () => {
16
+ const [options, setOptions] = useState<IMealNutrientsProps['options']>([]);
17
+ const [data, setData] = useState<IMealNutrientsProps['data']>([]);
18
+
19
+ useEffect(() => {
20
+ getOptions()
21
+ .then((respOptions) => {
22
+ setOptions(respOptions);
23
+ return getData(respOptions[0].value);
24
+ })
25
+ .then(setData);
26
+ }, []);
27
+
28
+ return (
29
+ <MealNutrients
30
+ data={data}
31
+ options={options}
32
+ onOptionChange={({ value }) => {
33
+ getData(String(value) as 'd' | 'w' | 'm').then(setData);
34
+ }}
35
+ />
36
+ );
37
+ };
@@ -1,84 +1,84 @@
1
- import { useState, useEffect, useRef } from 'react';
2
-
3
- import {
4
- Card,
5
- CardContent,
6
- CardHeader,
7
- Typography,
8
- Dropdown,
9
- DropdownOption,
10
- } from '@ssa-ui-kit/core';
11
-
12
- import { MealNutrientsLineChart } from './MealNutrientsLineChart';
13
- import useChartConfig from './useChartConfig';
14
- import { IMealNutrientsProps, UseChartConfig, OptionType } from './types';
15
-
16
- /**
17
- *
18
- * UI Component that shows the nutrients consumed by the user
19
- */
20
- export const MealNutrients = ({
21
- caption = 'Meal Nutrients',
22
- options,
23
- data,
24
- onOptionChange,
25
- }: IMealNutrientsProps) => {
26
- const [selectedOption, setSelectedOption] = useState<OptionType>();
27
- const containerRef = useRef<HTMLDivElement>(null);
28
-
29
- const chartConfig = useChartConfig(
30
- containerRef,
31
- data,
32
- selectedOption?.precision as Parameters<UseChartConfig>[2],
33
- );
34
-
35
- useEffect(() => {
36
- if (options?.length > 0 && selectedOption == null) {
37
- handleChange(options[0]);
38
- }
39
- }, [options]);
40
-
41
- const handleChange = (e: OptionType) => {
42
- const item = options.filter((item) => item.value === e.value)[0];
43
-
44
- setSelectedOption(item);
45
- onOptionChange && onOptionChange(item);
46
- };
47
-
48
- return (
49
- <div ref={containerRef}>
50
- <CardHeader transparent>
51
- <Typography variant="h4" weight="bold" css={{ lineHeight: 'normal' }}>
52
- {caption}
53
- </Typography>
54
-
55
- {options?.length > 0 && (
56
- <Dropdown selectedItem={options[0]} onChange={handleChange}>
57
- {options.map((item) => (
58
- <DropdownOption
59
- key={item.value}
60
- value={item.value}
61
- label={item.label}
62
- />
63
- ))}
64
- </Dropdown>
65
- )}
66
- </CardHeader>
67
- <Card>
68
- <CardContent direction="column" css={{ width: '100%' }}>
69
- <div
70
- css={{
71
- height: '227px',
72
- svg: {
73
- overflow: 'visible',
74
- },
75
- }}>
76
- {data?.length > 0 && (
77
- <MealNutrientsLineChart data={data} {...chartConfig} />
78
- )}
79
- </div>
80
- </CardContent>
81
- </Card>
82
- </div>
83
- );
84
- };
1
+ import { useState, useEffect, useRef } from 'react';
2
+
3
+ import {
4
+ Card,
5
+ CardContent,
6
+ CardHeader,
7
+ Typography,
8
+ Dropdown,
9
+ DropdownOption,
10
+ } from '@ssa-ui-kit/core';
11
+
12
+ import { MealNutrientsLineChart } from './MealNutrientsLineChart';
13
+ import useChartConfig from './useChartConfig';
14
+ import { IMealNutrientsProps, UseChartConfig, OptionType } from './types';
15
+
16
+ /**
17
+ *
18
+ * UI Component that shows the nutrients consumed by the user
19
+ */
20
+ export const MealNutrients = ({
21
+ caption = 'Meal Nutrients',
22
+ options,
23
+ data,
24
+ onOptionChange,
25
+ }: IMealNutrientsProps) => {
26
+ const [selectedOption, setSelectedOption] = useState<OptionType>();
27
+ const containerRef = useRef<HTMLDivElement>(null);
28
+
29
+ const chartConfig = useChartConfig(
30
+ containerRef,
31
+ data,
32
+ selectedOption?.precision as Parameters<UseChartConfig>[2],
33
+ );
34
+
35
+ useEffect(() => {
36
+ if (options?.length > 0 && selectedOption == null) {
37
+ handleChange(options[0]);
38
+ }
39
+ }, [options]);
40
+
41
+ const handleChange = (e: OptionType) => {
42
+ const item = options.filter((item) => item.value === e.value)[0];
43
+
44
+ setSelectedOption(item);
45
+ onOptionChange && onOptionChange(item);
46
+ };
47
+
48
+ return (
49
+ <div ref={containerRef}>
50
+ <CardHeader transparent>
51
+ <Typography variant="h4" weight="bold" css={{ lineHeight: 'normal' }}>
52
+ {caption}
53
+ </Typography>
54
+
55
+ {options?.length > 0 && (
56
+ <Dropdown selectedItem={options[0]} onChange={handleChange}>
57
+ {options.map((item) => (
58
+ <DropdownOption
59
+ key={item.value}
60
+ value={item.value}
61
+ label={item.label}
62
+ />
63
+ ))}
64
+ </Dropdown>
65
+ )}
66
+ </CardHeader>
67
+ <Card>
68
+ <CardContent direction="column" css={{ width: '100%' }}>
69
+ <div
70
+ css={{
71
+ height: '227px',
72
+ svg: {
73
+ overflow: 'visible',
74
+ },
75
+ }}>
76
+ {data?.length > 0 && (
77
+ <MealNutrientsLineChart data={data} {...chartConfig} />
78
+ )}
79
+ </div>
80
+ </CardContent>
81
+ </Card>
82
+ </div>
83
+ );
84
+ };
@@ -1,87 +1,87 @@
1
- import { useMemo } from 'react';
2
- import { ResponsiveLine, LineSvgProps, LineProps } from '@nivo/line';
3
- import { useTheme } from '@emotion/react';
4
- import type { ColorsKeys, MainColors } from '@ssa-ui-kit/core';
5
-
6
- import { defaults } from './chartDefaultConfig';
7
- import { MealNutrientsTooltip } from './MealNutrientsTooltip';
8
-
9
- const colorPalette = ['pink', 'purple', 'turquoise', 'yellow', 'green', 'blue'];
10
-
11
- export const MealNutrientsLineChart = ({ data, ...props }: LineSvgProps) => {
12
- const theme = useTheme();
13
-
14
- const defaultColorMapping = useMemo(
15
- () =>
16
- colorPalette.reduce<Record<string, keyof MainColors>>(
17
- (res, colorName) => {
18
- const colorValue = theme.colors[
19
- `${colorName}Lighter` as ColorsKeys
20
- ] as string;
21
- res[colorValue] = colorName as keyof MainColors;
22
- return res;
23
- },
24
- {},
25
- ),
26
- [theme.colors],
27
- );
28
-
29
- const defaultSettings = useMemo(
30
- () =>
31
- Object.assign<Omit<LineProps, 'data'>, Omit<LineProps, 'data'>>(
32
- defaults,
33
- {
34
- colors: colorPalette.map(
35
- (color) => theme.colors[`${color}Lighter` as ColorsKeys] as string,
36
- ),
37
- tooltip: ({ point }) => {
38
- const color: keyof MainColors = defaultColorMapping[point.color];
39
- return <MealNutrientsTooltip point={point} colorName={color} />;
40
- },
41
- theme: {
42
- fontFamily: "'Manrope', sans-serif",
43
- axis: {
44
- ticks: {
45
- text: {
46
- fontSize: '0.833rem',
47
- fontWeight: 500,
48
- fill: theme.colors.greyDarker,
49
- },
50
- },
51
- },
52
- grid: {
53
- line: {
54
- stroke: theme.colors.greyLighter,
55
- strokeWidth: 1,
56
- strokeDasharray: '8 8',
57
- },
58
- },
59
- },
60
- },
61
- ),
62
- [theme.colors, defaultColorMapping],
63
- );
64
-
65
- return (
66
- <ResponsiveLine
67
- data={data}
68
- curve="catmullRom"
69
- axisTop={null}
70
- axisLeft={null}
71
- enableGridX={false}
72
- enableGridY={true}
73
- lineWidth={1}
74
- enablePoints={true}
75
- pointSize={8}
76
- pointBorderWidth={0}
77
- pointLabelYOffset={-12}
78
- enableArea={false}
79
- areaOpacity={0.1}
80
- enableCrosshair={false}
81
- useMesh={true}
82
- animate={false}
83
- {...defaultSettings}
84
- {...props}
85
- />
86
- );
87
- };
1
+ import { useMemo } from 'react';
2
+ import { ResponsiveLine, LineSvgProps, LineProps } from '@nivo/line';
3
+ import { useTheme } from '@emotion/react';
4
+ import type { ColorsKeys, MainColors } from '@ssa-ui-kit/core';
5
+
6
+ import { defaults } from './chartDefaultConfig';
7
+ import { MealNutrientsTooltip } from './MealNutrientsTooltip';
8
+
9
+ const colorPalette = ['pink', 'purple', 'turquoise', 'yellow', 'green', 'blue'];
10
+
11
+ export const MealNutrientsLineChart = ({ data, ...props }: LineSvgProps) => {
12
+ const theme = useTheme();
13
+
14
+ const defaultColorMapping = useMemo(
15
+ () =>
16
+ colorPalette.reduce<Record<string, keyof MainColors>>(
17
+ (res, colorName) => {
18
+ const colorValue = theme.colors[
19
+ `${colorName}Lighter` as ColorsKeys
20
+ ] as string;
21
+ res[colorValue] = colorName as keyof MainColors;
22
+ return res;
23
+ },
24
+ {},
25
+ ),
26
+ [theme.colors],
27
+ );
28
+
29
+ const defaultSettings = useMemo(
30
+ () =>
31
+ Object.assign<Omit<LineProps, 'data'>, Omit<LineProps, 'data'>>(
32
+ defaults,
33
+ {
34
+ colors: colorPalette.map(
35
+ (color) => theme.colors[`${color}Lighter` as ColorsKeys] as string,
36
+ ),
37
+ tooltip: ({ point }) => {
38
+ const color: keyof MainColors = defaultColorMapping[point.color];
39
+ return <MealNutrientsTooltip point={point} colorName={color} />;
40
+ },
41
+ theme: {
42
+ fontFamily: "'Manrope', sans-serif",
43
+ axis: {
44
+ ticks: {
45
+ text: {
46
+ fontSize: '0.833rem',
47
+ fontWeight: 500,
48
+ fill: theme.colors.greyDarker,
49
+ },
50
+ },
51
+ },
52
+ grid: {
53
+ line: {
54
+ stroke: theme.colors.greyLighter,
55
+ strokeWidth: 1,
56
+ strokeDasharray: '8 8',
57
+ },
58
+ },
59
+ },
60
+ },
61
+ ),
62
+ [theme.colors, defaultColorMapping],
63
+ );
64
+
65
+ return (
66
+ <ResponsiveLine
67
+ data={data}
68
+ curve="catmullRom"
69
+ axisTop={null}
70
+ axisLeft={null}
71
+ enableGridX={false}
72
+ enableGridY={true}
73
+ lineWidth={1}
74
+ enablePoints={true}
75
+ pointSize={8}
76
+ pointBorderWidth={0}
77
+ pointLabelYOffset={-12}
78
+ enableArea={false}
79
+ areaOpacity={0.1}
80
+ enableCrosshair={false}
81
+ useMesh={true}
82
+ animate={false}
83
+ {...defaultSettings}
84
+ {...props}
85
+ />
86
+ );
87
+ };
@@ -1,30 +1,30 @@
1
- import { ProgressChartTooltip } from '@ssa-ui-kit/core';
2
- import type { IMapIcons } from '@ssa-ui-kit/core';
3
-
4
- import { IMealNutrientsTooltipProps } from './types';
5
-
6
- const capitalize = (str: string) =>
7
- `${str[0].toUpperCase()}${str.substring(1)}`;
8
-
9
- export const MealNutrientsTooltip = ({
10
- colorName,
11
- point,
12
- }: IMealNutrientsTooltipProps) => {
13
- const caption = capitalize(String(point.serieId));
14
- const {
15
- data: { y, comp, unit },
16
- } = point;
17
- const iconName =
18
- ((comp && `arrow-${comp > 0 ? 'up' : 'down'}`) as keyof IMapIcons) ||
19
- undefined;
20
-
21
- return (
22
- <ProgressChartTooltip
23
- caption={caption}
24
- value={y as number}
25
- valueFormatted={`${comp}${unit}`}
26
- iconName={iconName}
27
- barProps={{ color: colorName }}
28
- />
29
- );
30
- };
1
+ import { ProgressChartTooltip } from '@ssa-ui-kit/core';
2
+ import type { IMapIcons } from '@ssa-ui-kit/core';
3
+
4
+ import { IMealNutrientsTooltipProps } from './types';
5
+
6
+ const capitalize = (str: string) =>
7
+ `${str[0].toUpperCase()}${str.substring(1)}`;
8
+
9
+ export const MealNutrientsTooltip = ({
10
+ colorName,
11
+ point,
12
+ }: IMealNutrientsTooltipProps) => {
13
+ const caption = capitalize(String(point.serieId));
14
+ const {
15
+ data: { y, comp, unit },
16
+ } = point;
17
+ const iconName =
18
+ ((comp && `arrow-${comp > 0 ? 'up' : 'down'}`) as keyof IMapIcons) ||
19
+ undefined;
20
+
21
+ return (
22
+ <ProgressChartTooltip
23
+ caption={caption}
24
+ value={y as number}
25
+ valueFormatted={`${comp}${unit}`}
26
+ iconName={iconName}
27
+ barProps={{ color: colorName }}
28
+ />
29
+ );
30
+ };
@@ -1,87 +1,87 @@
1
- import { LineProps } from '@nivo/line';
2
- import { DotsItem, useTheme as useNivoTheme } from '@nivo/core';
3
-
4
- import { dateFormatters } from '@ssa-ui-kit/utils';
5
-
6
- import { CustomPointLayerProps } from './types';
7
-
8
- const { formatDayOfWeek } = dateFormatters;
9
-
10
- const CustomPointLayer = ({
11
- currentPoint,
12
- pointSize,
13
- pointBorderWidth,
14
- ...props
15
- }: CustomPointLayerProps) => {
16
- const theme = useNivoTheme();
17
-
18
- if (!currentPoint) {
19
- return;
20
- }
21
-
22
- const point = currentPoint;
23
-
24
- return (
25
- <g>
26
- <DotsItem
27
- key={point.id}
28
- x={point.x}
29
- y={point.y}
30
- color={point.color}
31
- borderColor={point.borderColor}
32
- datum={point.data}
33
- theme={theme}
34
- size={pointSize || 0}
35
- borderWidth={pointBorderWidth || 0}
36
- {...props}
37
- />
38
- </g>
39
- );
40
- };
41
-
42
- const tickValues = [0, 20, 40, 60, 80, 100];
43
-
44
- export const defaults: Omit<LineProps, 'data'> = {
45
- margin: { top: 28, right: 50, bottom: 50, left: 5 },
46
- xScale: { type: 'time', format: '%L', precision: 'day' },
47
- yScale: {
48
- type: 'linear',
49
- min: 'auto',
50
- max: 'auto',
51
- stacked: false,
52
- reverse: false,
53
- },
54
- axisRight: {
55
- tickSize: 0,
56
- tickPadding: 10,
57
- tickRotation: 0,
58
- tickValues,
59
- format: (tick) => `${tick}%`,
60
- legend: '',
61
- legendOffset: 0,
62
- },
63
- axisBottom: {
64
- tickSize: 0,
65
- tickPadding: 30,
66
- tickRotation: 0,
67
- legend: '',
68
- tickValues: 'every day',
69
- format: formatDayOfWeek,
70
- },
71
- pointColor: { from: 'color', modifiers: [] },
72
- pointBorderColor: { from: 'color', modifiers: [] },
73
- legends: [],
74
- gridYValues: tickValues,
75
- layers: [
76
- 'grid',
77
- 'markers',
78
- 'axes',
79
- 'areas',
80
- 'crosshair',
81
- 'lines',
82
- CustomPointLayer,
83
- 'slices',
84
- 'mesh',
85
- 'legends',
86
- ],
87
- };
1
+ import { LineProps } from '@nivo/line';
2
+ import { DotsItem, useTheme as useNivoTheme } from '@nivo/core';
3
+
4
+ import { dateFormatters } from '@ssa-ui-kit/utils';
5
+
6
+ import { CustomPointLayerProps } from './types';
7
+
8
+ const { formatDayOfWeek } = dateFormatters;
9
+
10
+ const CustomPointLayer = ({
11
+ currentPoint,
12
+ pointSize,
13
+ pointBorderWidth,
14
+ ...props
15
+ }: CustomPointLayerProps) => {
16
+ const theme = useNivoTheme();
17
+
18
+ if (!currentPoint) {
19
+ return;
20
+ }
21
+
22
+ const point = currentPoint;
23
+
24
+ return (
25
+ <g>
26
+ <DotsItem
27
+ key={point.id}
28
+ x={point.x}
29
+ y={point.y}
30
+ color={point.color}
31
+ borderColor={point.borderColor}
32
+ datum={point.data}
33
+ theme={theme}
34
+ size={pointSize || 0}
35
+ borderWidth={pointBorderWidth || 0}
36
+ {...props}
37
+ />
38
+ </g>
39
+ );
40
+ };
41
+
42
+ const tickValues = [0, 20, 40, 60, 80, 100];
43
+
44
+ export const defaults: Omit<LineProps, 'data'> = {
45
+ margin: { top: 28, right: 50, bottom: 50, left: 5 },
46
+ xScale: { type: 'time', format: '%L', precision: 'day' },
47
+ yScale: {
48
+ type: 'linear',
49
+ min: 'auto',
50
+ max: 'auto',
51
+ stacked: false,
52
+ reverse: false,
53
+ },
54
+ axisRight: {
55
+ tickSize: 0,
56
+ tickPadding: 10,
57
+ tickRotation: 0,
58
+ tickValues,
59
+ format: (tick) => `${tick}%`,
60
+ legend: '',
61
+ legendOffset: 0,
62
+ },
63
+ axisBottom: {
64
+ tickSize: 0,
65
+ tickPadding: 30,
66
+ tickRotation: 0,
67
+ legend: '',
68
+ tickValues: 'every day',
69
+ format: formatDayOfWeek,
70
+ },
71
+ pointColor: { from: 'color', modifiers: [] },
72
+ pointBorderColor: { from: 'color', modifiers: [] },
73
+ legends: [],
74
+ gridYValues: tickValues,
75
+ layers: [
76
+ 'grid',
77
+ 'markers',
78
+ 'axes',
79
+ 'areas',
80
+ 'crosshair',
81
+ 'lines',
82
+ CustomPointLayer,
83
+ 'slices',
84
+ 'mesh',
85
+ 'legends',
86
+ ],
87
+ };
@@ -1,2 +1,2 @@
1
- export { MealNutrients } from './MealNutrients';
2
- export * from './types';
1
+ export { MealNutrients } from './MealNutrients';
2
+ export * from './types';