@ssa-ui-kit/widgets 1.0.12 → 1.1.55-canary-79b6b0d-20250224

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 (257) hide show
  1. package/dist/components/AccountBalance/AccountBalance.d.ts +1 -1
  2. package/dist/components/AccountBalance/BalancePieChart.d.ts +1 -1
  3. package/dist/components/AccountBalance/BalancePieChartTitle.d.ts +1 -1
  4. package/dist/components/AccountKeys/AccountKeys.d.ts +1 -1
  5. package/dist/components/AccountKeys/stories/StoryComponent.d.ts +1 -1
  6. package/dist/components/Activity/Activity.d.ts +1 -1
  7. package/dist/components/Activity/ActivityItem.d.ts +1 -1
  8. package/dist/components/Bmi/Bmi.d.ts +1 -1
  9. package/dist/components/Bmi/BmiLabels.d.ts +1 -1
  10. package/dist/components/BotsTable/BotsTable.d.ts +1 -1
  11. package/dist/components/BotsTable/stories/BotsTable/StoryComponent.d.ts +1 -1
  12. package/dist/components/BotsTable/stories/BotsTable/components/Actions/ActionIcon.d.ts +1 -1
  13. package/dist/components/BotsTable/stories/BotsTable/components/Actions/ActionItem.d.ts +1 -1
  14. package/dist/components/BotsTable/stories/BotsTable/components/Actions/ActionMore.d.ts +1 -1
  15. package/dist/components/BotsTable/stories/BotsTable/components/Actions/ActionRun.d.ts +1 -1
  16. package/dist/components/BotsTable/stories/BotsTable/components/Actions/Actions.d.ts +1 -1
  17. package/dist/components/BotsTable/stories/BotsTable/components/Actions/ActionsWrapper.d.ts +1 -1
  18. package/dist/components/BotsTable/stories/BotsTable/components/Actions/consts.d.ts +3 -3
  19. package/dist/components/BotsTable/stories/BotsTable/components/Exchange/Exchange.d.ts +1 -1
  20. package/dist/components/BotsTable/stories/BotsTable/components/Exchange/consts.d.ts +3 -3
  21. package/dist/components/BotsTable/stories/BotsTable/components/PNL.d.ts +1 -1
  22. package/dist/components/BotsTable/stories/BotsTable/components/ROI.d.ts +1 -1
  23. package/dist/components/BotsTable/stories/BotsTable/components/TableTag.d.ts +1 -1
  24. package/dist/components/BotsTable/stories/BotsTable/components/Trade/Trade.d.ts +1 -1
  25. package/dist/components/BotsTable/stories/NoControlOrders/StoryComponent.d.ts +1 -1
  26. package/dist/components/BotsTable/stories/NoControlOrders/components/ActionMore.d.ts +1 -1
  27. package/dist/components/BotsTable/stories/NoControlOrders/components/Reason.d.ts +1 -1
  28. package/dist/components/BotsTable/stories/NoControlOrders/components/TableList.d.ts +1 -1
  29. package/dist/components/BotsTable/stories/NoControlOrders/components/TableRow.d.ts +1 -1
  30. package/dist/components/Calories/Calories.d.ts +1 -1
  31. package/dist/components/Calories/innerContent.d.ts +1 -1
  32. package/dist/components/ExchangeAccount/ExchangeAccount.d.ts +1 -1
  33. package/dist/components/HeartRate/BPM.d.ts +1 -1
  34. package/dist/components/HeartRate/HeartRate.d.ts +1 -1
  35. package/dist/components/HeartRate/HeartRateLineChart.d.ts +1 -1
  36. package/dist/components/ListGoals/ListGoals.d.ts +1 -1
  37. package/dist/components/ListGoals/ListGoalsCard.d.ts +1 -1
  38. package/dist/components/MealNutrients/MealNutrients.d.ts +1 -1
  39. package/dist/components/MealNutrients/MealNutrientsLineChart.d.ts +1 -1
  40. package/dist/components/MealNutrients/MealNutrientsTooltip.d.ts +1 -1
  41. package/dist/components/MealPlanner/MealPlanner.d.ts +1 -1
  42. package/dist/components/MealPlanner/MealPlannerCard.d.ts +1 -1
  43. package/dist/components/StepsCounter/StepsCounter.d.ts +1 -1
  44. package/dist/components/TradingInfoCard/TradingInfoCard.d.ts +1 -1
  45. package/dist/components/TradingInfoCard/TradingInfoCardContent.d.ts +1 -1
  46. package/dist/components/TradingInfoCard/TradingInfoCardTooltip.d.ts +1 -1
  47. package/dist/components/TradingInfoCard/TradingInfoCardWrapper.d.ts +1 -1
  48. package/dist/components/TradingScoreboard/TradingScoreboard.d.ts +1 -1
  49. package/dist/components/TradingScoreboard/helpers.d.ts +4 -4
  50. package/dist/components/UpcomingWorkouts/UpcomingWorkoutCard.d.ts +1 -1
  51. package/dist/components/UpcomingWorkouts/UpcomingWorkouts.d.ts +1 -1
  52. package/dist/components/UserCard/UserCard.d.ts +1 -1
  53. package/dist/components/UserCard/UserCardBMI.d.ts +1 -1
  54. package/dist/components/UserCard/UserCardCredentials.d.ts +1 -1
  55. package/dist/components/UserCard/UserCardItem.d.ts +1 -1
  56. package/dist/components/WaterConsume/WaterConsume.d.ts +1 -1
  57. package/dist/index.js +2439 -1
  58. package/dist/index.js.map +1 -1
  59. package/package.json +24 -27
  60. package/.babelrc.js +0 -4
  61. package/.env +0 -7
  62. package/.storybook/main.ts +0 -47
  63. package/.storybook/preview.tsx +0 -22
  64. package/.storybook/style.css +0 -40
  65. package/custom-shots/widgets-bots-table--no-control-orders--menu-opened_[w1920px].png +0 -0
  66. package/custom-shots/widgets-bots-table--no-control-orders--run-reason-modal_[w1920px].png +0 -0
  67. package/custom-shots/widgets-heart-rate--hint-opened__[w1440px].png +0 -0
  68. package/custom-shots/widgets-heart-rate--hint-opened__[w1920px].png +0 -0
  69. package/custom-shots/widgets-heart-rate--hint-opened__[w390px].png +0 -0
  70. package/custom-shots/widgets-heart-rate--hint-opened__[w900px].png +0 -0
  71. package/custom-shots/widgets-meal-nutrients--hint-opened__[w1440px].png +0 -0
  72. package/custom-shots/widgets-meal-nutrients--hint-opened__[w1920px].png +0 -0
  73. package/custom-shots/widgets-meal-nutrients--hint-opened__[w390px].png +0 -0
  74. package/custom-shots/widgets-meal-nutrients--hint-opened__[w900px].png +0 -0
  75. package/custom-shots/widgets-meal-nutrients--hint-opened__dropdown__[w1440px].png +0 -0
  76. package/custom-shots/widgets-meal-nutrients--hint-opened__dropdown__[w1920px].png +0 -0
  77. package/custom-shots/widgets-meal-nutrients--hint-opened__dropdown__[w390px].png +0 -0
  78. package/custom-shots/widgets-meal-nutrients--hint-opened__dropdown__[w900px].png +0 -0
  79. package/custom-shots/widgets-trading-info-card--hover__[w1920px].png +0 -0
  80. package/customTest.tsx +0 -35
  81. package/jest-setup.ts +0 -20
  82. package/lostpixel.config.ts +0 -29
  83. package/playwright.config.ts +0 -7
  84. package/src/components/AccountBalance/AccountBalance.specBackup.tsx +0 -105
  85. package/src/components/AccountBalance/AccountBalance.stories.tsx +0 -138
  86. package/src/components/AccountBalance/AccountBalance.tsx +0 -60
  87. package/src/components/AccountBalance/BalancePieChart.tsx +0 -127
  88. package/src/components/AccountBalance/BalancePieChartTitle.tsx +0 -54
  89. package/src/components/AccountBalance/index.ts +0 -4
  90. package/src/components/AccountBalance/stories/fixtures.ts +0 -26
  91. package/src/components/AccountBalance/types.ts +0 -41
  92. package/src/components/AccountKeys/AccountKeys.specBackup.tsx +0 -43
  93. package/src/components/AccountKeys/AccountKeys.stories.tsx +0 -14
  94. package/src/components/AccountKeys/AccountKeys.tsx +0 -73
  95. package/src/components/AccountKeys/helpers.ts +0 -7
  96. package/src/components/AccountKeys/index.ts +0 -2
  97. package/src/components/AccountKeys/stories/StoryComponent.tsx +0 -33
  98. package/src/components/AccountKeys/styles.ts +0 -87
  99. package/src/components/AccountKeys/types.ts +0 -8
  100. package/src/components/Activity/Activity.specBackup.tsx +0 -79
  101. package/src/components/Activity/Activity.stories.tsx +0 -15
  102. package/src/components/Activity/Activity.tsx +0 -83
  103. package/src/components/Activity/ActivityItem.tsx +0 -38
  104. package/src/components/Activity/index.tsx +0 -2
  105. package/src/components/Activity/mockActivityRequest.ts +0 -106
  106. package/src/components/Activity/styles.ts +0 -12
  107. package/src/components/Activity/types.ts +0 -10
  108. package/src/components/Bmi/Bmi.spec.Backup.tsx +0 -68
  109. package/src/components/Bmi/Bmi.stories.tsx +0 -10
  110. package/src/components/Bmi/Bmi.tsx +0 -96
  111. package/src/components/Bmi/BmiHeatbar.tsx +0 -18
  112. package/src/components/Bmi/BmiInfo.tsx +0 -11
  113. package/src/components/Bmi/BmiLabel.tsx +0 -9
  114. package/src/components/Bmi/BmiLabels.tsx +0 -33
  115. package/src/components/Bmi/BmiPointer.tsx +0 -15
  116. package/src/components/Bmi/index.tsx +0 -2
  117. package/src/components/Bmi/styles.ts +0 -18
  118. package/src/components/Bmi/types.ts +0 -4
  119. package/src/components/BotsTable/BotsTable.e2e.ts +0 -77
  120. package/src/components/BotsTable/BotsTable.specBackup.tsx +0 -125
  121. package/src/components/BotsTable/BotsTable.tsx +0 -32
  122. package/src/components/BotsTable/BotsTableCell.tsx +0 -13
  123. package/src/components/BotsTable/BotsTableHead.tsx +0 -13
  124. package/src/components/BotsTable/BotsTableRow.tsx +0 -17
  125. package/src/components/BotsTable/BotsTableWrapper.tsx +0 -23
  126. package/src/components/BotsTable/index.ts +0 -5
  127. package/src/components/BotsTable/stories/BotsTable/StoryComponent.tsx +0 -59
  128. package/src/components/BotsTable/stories/BotsTable/components/Actions/ActionIcon.tsx +0 -11
  129. package/src/components/BotsTable/stories/BotsTable/components/Actions/ActionItem.tsx +0 -40
  130. package/src/components/BotsTable/stories/BotsTable/components/Actions/ActionMore.tsx +0 -89
  131. package/src/components/BotsTable/stories/BotsTable/components/Actions/ActionRun.tsx +0 -133
  132. package/src/components/BotsTable/stories/BotsTable/components/Actions/Actions.tsx +0 -13
  133. package/src/components/BotsTable/stories/BotsTable/components/Actions/ActionsWrapper.tsx +0 -21
  134. package/src/components/BotsTable/stories/BotsTable/components/Actions/consts.tsx +0 -118
  135. package/src/components/BotsTable/stories/BotsTable/components/Actions/index.ts +0 -6
  136. package/src/components/BotsTable/stories/BotsTable/components/Exchange/Exchange.tsx +0 -26
  137. package/src/components/BotsTable/stories/BotsTable/components/Exchange/consts.tsx +0 -157
  138. package/src/components/BotsTable/stories/BotsTable/components/Exchange/index.ts +0 -1
  139. package/src/components/BotsTable/stories/BotsTable/components/Exchange/types.ts +0 -6
  140. package/src/components/BotsTable/stories/BotsTable/components/PNL.tsx +0 -27
  141. package/src/components/BotsTable/stories/BotsTable/components/ROI.tsx +0 -25
  142. package/src/components/BotsTable/stories/BotsTable/components/TableTag.tsx +0 -22
  143. package/src/components/BotsTable/stories/BotsTable/components/Trade/Trade.tsx +0 -8
  144. package/src/components/BotsTable/stories/BotsTable/components/Trade/consts.ts +0 -14
  145. package/src/components/BotsTable/stories/BotsTable/components/Trade/index.ts +0 -1
  146. package/src/components/BotsTable/stories/BotsTable/components/Trade/types.ts +0 -5
  147. package/src/components/BotsTable/stories/BotsTable/components/index.ts +0 -6
  148. package/src/components/BotsTable/stories/BotsTable/index.ts +0 -1
  149. package/src/components/BotsTable/stories/BotsTable/mockData.ts +0 -84
  150. package/src/components/BotsTable/stories/BotsTable.stories.tsx +0 -39
  151. package/src/components/BotsTable/stories/NoControlOrders/StoryComponent.tsx +0 -35
  152. package/src/components/BotsTable/stories/NoControlOrders/components/ActionMore.tsx +0 -95
  153. package/src/components/BotsTable/stories/NoControlOrders/components/Reason.tsx +0 -11
  154. package/src/components/BotsTable/stories/NoControlOrders/components/TableList.tsx +0 -45
  155. package/src/components/BotsTable/stories/NoControlOrders/components/TableRow.tsx +0 -31
  156. package/src/components/BotsTable/stories/NoControlOrders/components/index.ts +0 -4
  157. package/src/components/BotsTable/stories/NoControlOrders/mockData.ts +0 -23
  158. package/src/components/BotsTable/stories/NoControlOrders/types.ts +0 -16
  159. package/src/components/BotsTable/types.ts +0 -31
  160. package/src/components/Calories/Calories.specBackup.tsx +0 -11
  161. package/src/components/Calories/Calories.stories.tsx +0 -26
  162. package/src/components/Calories/Calories.tsx +0 -54
  163. package/src/components/Calories/index.tsx +0 -2
  164. package/src/components/Calories/innerContent.tsx +0 -30
  165. package/src/components/Calories/types.ts +0 -4
  166. package/src/components/ExchangeAccount/ExchangeAccount.specBackup.tsx +0 -104
  167. package/src/components/ExchangeAccount/ExchangeAccount.stories.tsx +0 -108
  168. package/src/components/ExchangeAccount/ExchangeAccount.tsx +0 -90
  169. package/src/components/ExchangeAccount/helpers.tsx +0 -153
  170. package/src/components/ExchangeAccount/index.ts +0 -2
  171. package/src/components/ExchangeAccount/styles.ts +0 -115
  172. package/src/components/ExchangeAccount/types.ts +0 -14
  173. package/src/components/HeartRate/BPM.tsx +0 -43
  174. package/src/components/HeartRate/HeartRate.e2e.ts +0 -78
  175. package/src/components/HeartRate/HeartRate.specBackup.tsx +0 -91
  176. package/src/components/HeartRate/HeartRate.stories.tsx +0 -36
  177. package/src/components/HeartRate/HeartRate.tsx +0 -105
  178. package/src/components/HeartRate/HeartRateLineChart.tsx +0 -53
  179. package/src/components/HeartRate/index.ts +0 -2
  180. package/src/components/HeartRate/mockHeartRateRequest.ts +0 -15
  181. package/src/components/HeartRate/types.ts +0 -15
  182. package/src/components/HeartRate/utils.tsx +0 -8
  183. package/src/components/ListGoals/ListGoals.specBackup.tsx +0 -82
  184. package/src/components/ListGoals/ListGoals.stories.tsx +0 -58
  185. package/src/components/ListGoals/ListGoals.tsx +0 -29
  186. package/src/components/ListGoals/ListGoalsCard.tsx +0 -61
  187. package/src/components/ListGoals/index.ts +0 -2
  188. package/src/components/ListGoals/styles.tsx +0 -11
  189. package/src/components/ListGoals/types.ts +0 -25
  190. package/src/components/MealNutrients/MealNutrients.e2e.ts +0 -68
  191. package/src/components/MealNutrients/MealNutrients.specBackup.tsx +0 -134
  192. package/src/components/MealNutrients/MealNutrients.stories.tsx +0 -37
  193. package/src/components/MealNutrients/MealNutrients.tsx +0 -84
  194. package/src/components/MealNutrients/MealNutrientsLineChart.tsx +0 -89
  195. package/src/components/MealNutrients/MealNutrientsTooltip.tsx +0 -30
  196. package/src/components/MealNutrients/chartDefaultConfig.tsx +0 -87
  197. package/src/components/MealNutrients/index.tsx +0 -2
  198. package/src/components/MealNutrients/mockMealNutrientsRequest.ts +0 -1246
  199. package/src/components/MealNutrients/types.ts +0 -37
  200. package/src/components/MealNutrients/useChartConfig.ts +0 -69
  201. package/src/components/MealPlanner/MealPlanner.specBackup.tsx +0 -77
  202. package/src/components/MealPlanner/MealPlanner.stories.tsx +0 -15
  203. package/src/components/MealPlanner/MealPlanner.tsx +0 -100
  204. package/src/components/MealPlanner/MealPlannerBadge.tsx +0 -15
  205. package/src/components/MealPlanner/MealPlannerBars.tsx +0 -19
  206. package/src/components/MealPlanner/MealPlannerCard.tsx +0 -73
  207. package/src/components/MealPlanner/MealPlannerLegends.tsx +0 -22
  208. package/src/components/MealPlanner/index.ts +0 -2
  209. package/src/components/MealPlanner/mockMealPlannerRequest.ts +0 -70
  210. package/src/components/MealPlanner/types.ts +0 -21
  211. package/src/components/StepsCounter/StepsCounter.specBackup.tsx +0 -14
  212. package/src/components/StepsCounter/StepsCounter.stories.tsx +0 -16
  213. package/src/components/StepsCounter/StepsCounter.tsx +0 -74
  214. package/src/components/StepsCounter/index.ts +0 -2
  215. package/src/components/StepsCounter/types.ts +0 -4
  216. package/src/components/TradingInfoCard/TradingInfoCard.e2e.ts +0 -18
  217. package/src/components/TradingInfoCard/TradingInfoCard.specBackup.tsx +0 -116
  218. package/src/components/TradingInfoCard/TradingInfoCard.stories.tsx +0 -118
  219. package/src/components/TradingInfoCard/TradingInfoCard.tsx +0 -49
  220. package/src/components/TradingInfoCard/TradingInfoCardContent.tsx +0 -32
  221. package/src/components/TradingInfoCard/TradingInfoCardTooltip.tsx +0 -47
  222. package/src/components/TradingInfoCard/TradingInfoCardWrapper.tsx +0 -72
  223. package/src/components/TradingInfoCard/index.ts +0 -3
  224. package/src/components/TradingInfoCard/types.ts +0 -27
  225. package/src/components/TradingScoreboard/TradingScoreboard.specBackup.tsx +0 -119
  226. package/src/components/TradingScoreboard/TradingScoreboard.stories.tsx +0 -119
  227. package/src/components/TradingScoreboard/TradingScoreboard.tsx +0 -41
  228. package/src/components/TradingScoreboard/TradingScoreboardBase.tsx +0 -17
  229. package/src/components/TradingScoreboard/helpers.tsx +0 -134
  230. package/src/components/TradingScoreboard/index.ts +0 -2
  231. package/src/components/TradingScoreboard/types.ts +0 -18
  232. package/src/components/UpcomingWorkouts/UpcomingWorkoutCard.tsx +0 -64
  233. package/src/components/UpcomingWorkouts/UpcomingWorkouts.specBackup.tsx +0 -56
  234. package/src/components/UpcomingWorkouts/UpcomingWorkouts.stories.tsx +0 -32
  235. package/src/components/UpcomingWorkouts/UpcomingWorkouts.tsx +0 -27
  236. package/src/components/UpcomingWorkouts/index.ts +0 -2
  237. package/src/components/UpcomingWorkouts/style.ts +0 -12
  238. package/src/components/UpcomingWorkouts/types.ts +0 -23
  239. package/src/components/UserCard/UserCard.tsx +0 -46
  240. package/src/components/UserCard/UserCardBMI.tsx +0 -37
  241. package/src/components/UserCard/UserCardCredentials.tsx +0 -56
  242. package/src/components/UserCard/UserCardItem.tsx +0 -42
  243. package/src/components/UserCard/index.tsx +0 -2
  244. package/src/components/UserCard/types.ts +0 -8
  245. package/src/components/WaterConsume/WaterConsume.specBackup.tsx +0 -62
  246. package/src/components/WaterConsume/WaterConsume.stories.tsx +0 -36
  247. package/src/components/WaterConsume/WaterConsume.tsx +0 -188
  248. package/src/components/WaterConsume/index.ts +0 -2
  249. package/src/components/WaterConsume/types.ts +0 -11
  250. package/src/consts.ts +0 -18
  251. package/src/index.ts +0 -36
  252. package/src/injectGlobal.ts +0 -41
  253. package/test-results/.last-run.json +0 -21
  254. package/tsbuildcache +0 -1
  255. package/tsconfig.build.json +0 -44
  256. package/tsconfig.json +0 -17
  257. package/webpack.config.js +0 -28
@@ -1,37 +0,0 @@
1
- import { useState, useEffect } from 'react';
2
- import type { Meta } from '@storybook/react';
3
-
4
- import { MealNutrients } from './index';
5
- import { MealNutrientsProps } from './types';
6
-
7
- import { mockStaticApi } from './mockMealNutrientsRequest';
8
- const { getData, getOptions } = mockStaticApi;
9
-
10
- export default {
11
- title: 'Fitness/MealNutrients',
12
- component: MealNutrients,
13
- } as Meta<typeof MealNutrients>;
14
-
15
- export const Default = () => {
16
- const [options, setOptions] = useState<MealNutrientsProps['options']>([]);
17
- const [data, setData] = useState<MealNutrientsProps['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 +0,0 @@
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 { MealNutrientsProps, 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
- }: MealNutrientsProps) => {
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,89 +0,0 @@
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
- axis: {
43
- ticks: {
44
- text: {
45
- fontSize: '0.833rem',
46
- fontWeight: 500,
47
- fill: theme.colors.greyDarker,
48
- },
49
- },
50
- },
51
- grid: {
52
- line: {
53
- stroke: theme.colors.greyLighter,
54
- strokeWidth: 1,
55
- strokeDasharray: '8 8',
56
- },
57
- },
58
- text: {
59
- fontFamily: "'Manrope', sans-serif",
60
- },
61
- },
62
- },
63
- ),
64
- [theme.colors, defaultColorMapping],
65
- );
66
-
67
- return (
68
- <ResponsiveLine
69
- data={data}
70
- curve="catmullRom"
71
- axisTop={null}
72
- axisLeft={null}
73
- enableGridX={false}
74
- enableGridY={true}
75
- lineWidth={1}
76
- enablePoints={true}
77
- pointSize={8}
78
- pointBorderWidth={0}
79
- pointLabelYOffset={-12}
80
- enableArea={false}
81
- areaOpacity={0.1}
82
- enableCrosshair={false}
83
- useMesh={true}
84
- animate={false}
85
- {...defaultSettings}
86
- {...props}
87
- />
88
- );
89
- };
@@ -1,30 +0,0 @@
1
- import { ProgressChartTooltip } from '@ssa-ui-kit/core';
2
- import type { MapIconsType } from '@ssa-ui-kit/core';
3
-
4
- import { MealNutrientsTooltipProps } 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
- }: MealNutrientsTooltipProps) => {
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 MapIconsType) ||
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 +0,0 @@
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 +0,0 @@
1
- export { MealNutrients } from './MealNutrients';
2
- export * from './types';