@cloudtower/eagle 4100.0.17 → 4100.0.19

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 (276) hide show
  1. package/dist/cjs/core/AccordionCard/index.js +1 -1
  2. package/dist/cjs/core/Alert/alert.style.js +2 -2
  3. package/dist/cjs/core/Antd5Tree/Antd5Tree.style.js +1 -1
  4. package/dist/cjs/core/Avatar/index.js +1 -1
  5. package/dist/cjs/core/Banner/banner.style.js +4 -4
  6. package/dist/cjs/core/BasicCTError/BasicCTError.style.js +1 -1
  7. package/dist/cjs/core/BlankState/style.js +1 -1
  8. package/dist/cjs/core/Breadcrumb/index.js +1 -1
  9. package/dist/cjs/core/Button/index.js +1 -1
  10. package/dist/cjs/core/ButtonGroup/index.js +2 -2
  11. package/dist/cjs/core/Card/CardBody.js +1 -1
  12. package/dist/cjs/core/Card/CardTitle.js +1 -1
  13. package/dist/cjs/core/Card/CardWrapper.js +2 -2
  14. package/dist/cjs/core/Cascader/cascader.style.js +11 -11
  15. package/dist/cjs/core/Checkbox/checkbox.style.js +1 -1
  16. package/dist/cjs/core/DetailCard/index.js +1 -1
  17. package/dist/cjs/core/DonutChart/index.js +2 -2
  18. package/dist/cjs/core/DropdownMenu/index.js +1 -1
  19. package/dist/cjs/core/ExpandableList/ExpandIcon.js +1 -1
  20. package/dist/cjs/core/ExpandableList/ExpandableContainer.js +1 -1
  21. package/dist/cjs/core/ExpandableList/ExpandableItem.js +2 -2
  22. package/dist/cjs/core/ExpandableList/RoundOrder.js +1 -1
  23. package/dist/cjs/core/FailedLoad/index.js +1 -1
  24. package/dist/cjs/core/FormItem/index.js +1 -1
  25. package/dist/cjs/core/Icon/index.js +1 -1
  26. package/dist/cjs/core/ImmersiveDialog/styles.js +14 -14
  27. package/dist/cjs/core/Input/index.js +1 -1
  28. package/dist/cjs/core/InputGroup/index.js +1 -1
  29. package/dist/cjs/core/InputInteger/index.js +1 -1
  30. package/dist/cjs/core/InputNumber/index.js +1 -1
  31. package/dist/cjs/core/InputPassword/index.js +1 -1
  32. package/dist/cjs/core/InputTagItem/index.js +1 -1
  33. package/dist/cjs/core/LegacySelect/select.style.js +1 -1
  34. package/dist/cjs/core/Legend/index.js +5 -5
  35. package/dist/cjs/core/LineChart/AreaHighlightLayer.js +122 -0
  36. package/dist/cjs/core/LineChart/ForecastLineLayer.js +134 -0
  37. package/dist/cjs/core/LineChart/LineChartActions.js +2 -2
  38. package/dist/cjs/core/LineChart/RenderChart.js +274 -20
  39. package/dist/cjs/core/LineChart/ThresholdIntersectionLayer.js +144 -0
  40. package/dist/cjs/core/LineChart/TooltipFormatter.js +44 -39
  41. package/dist/cjs/core/LineChart/areaHighlightUtils.js +89 -0
  42. package/dist/cjs/core/LineChart/index.js +20 -2
  43. package/dist/cjs/core/LineChart/lineChartDisplayUtils.js +32 -0
  44. package/dist/cjs/core/LineChart/lineSegments.js +90 -0
  45. package/dist/cjs/core/LineChart/styled.js +21 -9
  46. package/dist/cjs/core/LineChart/utils.js +93 -4
  47. package/dist/cjs/core/Link/index.js +1 -1
  48. package/dist/cjs/core/Loading/style.js +4 -4
  49. package/dist/cjs/core/LocalUpload/LocalUpload.hooks.js +5 -2
  50. package/dist/cjs/core/LocalUpload/LocalUpload.js +53 -45
  51. package/dist/cjs/core/LocalUpload/LocalUpload.style.js +2 -2
  52. package/dist/cjs/core/LocalUpload/LocalUpload.widget.js +156 -133
  53. package/dist/cjs/core/LogView/LogView.style.js +5 -5
  54. package/dist/cjs/core/MediumDialog/MediumDialog.js +1 -1
  55. package/dist/cjs/core/Metric/styled.js +8 -8
  56. package/dist/cjs/core/Nav/index.js +1 -1
  57. package/dist/cjs/core/Nav/style.js +2 -2
  58. package/dist/cjs/core/Overflow/index.js +2 -2
  59. package/dist/cjs/core/Pagination/index.js +2 -2
  60. package/dist/cjs/core/Progress/components.js +2 -2
  61. package/dist/cjs/core/Progress/index.js +2 -2
  62. package/dist/cjs/core/Progress/progress.style.js +4 -4
  63. package/dist/cjs/core/Progress/progress.widgets.js +2 -2
  64. package/dist/cjs/core/Radio/index.js +3 -3
  65. package/dist/cjs/core/SearchInput/SearchInput.style.js +5 -5
  66. package/dist/cjs/core/SegmentControl/index.js +4 -4
  67. package/dist/cjs/core/Select/select.style.js +4 -4
  68. package/dist/cjs/core/Select/select.widgets.js +3 -3
  69. package/dist/cjs/core/SimplePagination/index.js +2 -2
  70. package/dist/cjs/core/Skeleton/Content.js +1 -1
  71. package/dist/cjs/core/SmallDialog/SmallDialog.style.js +7 -7
  72. package/dist/cjs/core/StatusCapsule/index.js +2 -2
  73. package/dist/cjs/core/StepProgress/index.js +1 -1
  74. package/dist/cjs/core/Steps/style.js +5 -5
  75. package/dist/cjs/core/Styled/index.js +40 -40
  76. package/dist/cjs/core/Switch/index.js +2 -2
  77. package/dist/cjs/core/Tab/Tab.js +1 -1
  78. package/dist/cjs/core/Tab/Tab.style.js +4 -4
  79. package/dist/cjs/core/Table/TableSkeleton.js +1 -1
  80. package/dist/cjs/core/Table/TableWidget.js +1 -1
  81. package/dist/cjs/core/Table/index.js +3 -3
  82. package/dist/cjs/core/TableForm/Columns/FormItem.js +1 -1
  83. package/dist/cjs/core/TableForm/style.js +7 -7
  84. package/dist/cjs/core/Tag/SplitTag.js +1 -1
  85. package/dist/cjs/core/Tag/style.js +5 -5
  86. package/dist/cjs/core/Time/index.js +1 -1
  87. package/dist/cjs/core/TimeZoneSelect/index.js +7 -7
  88. package/dist/cjs/core/Timeline/Timeline.style.js +5 -5
  89. package/dist/cjs/core/Token/index.js +4 -4
  90. package/dist/cjs/core/Token/style.js +1 -1
  91. package/dist/cjs/core/Tooltip/EllipsisTooltipContent.js +1 -1
  92. package/dist/cjs/core/Tooltip/index.js +1 -1
  93. package/dist/cjs/core/Truncate/index.js +1 -1
  94. package/dist/cjs/core/Typo/index.js +58 -58
  95. package/dist/cjs/core/WizardDialog/styles.js +4 -4
  96. package/dist/cjs/coreX/BarChart/index.js +1 -1
  97. package/dist/cjs/coreX/BatchOperation/index.js +2 -2
  98. package/dist/cjs/coreX/ChartWithTooltip/index.js +6 -6
  99. package/dist/cjs/coreX/CheckPointList/checkpointlist.style.js +3 -3
  100. package/dist/cjs/coreX/CircleLoading/index.js +1 -1
  101. package/dist/cjs/coreX/CronCalendar/index.js +4 -4
  102. package/dist/cjs/coreX/CronPlan/index.js +4 -4
  103. package/dist/cjs/coreX/DateRangePicker/DateRangePicker.style.js +12 -12
  104. package/dist/cjs/coreX/DateRangePicker/RelativeTime.js +9 -6
  105. package/dist/cjs/coreX/DateRangePicker/common.js +104 -5
  106. package/dist/cjs/coreX/DateRangePicker/index.js +107 -47
  107. package/dist/cjs/coreX/Dialogs/DeleteDialog/DeleteDialog.js +2 -2
  108. package/dist/cjs/coreX/Dialogs/RejectDialog/RejectDialog.js +6 -6
  109. package/dist/cjs/coreX/GoBackButton/index.js +1 -1
  110. package/dist/cjs/coreX/I18nNameTag/index.js +1 -1
  111. package/dist/cjs/coreX/InfoRowList/InfoRow.js +1 -1
  112. package/dist/cjs/coreX/InfoRowList/InfoRowList.js +4 -4
  113. package/dist/cjs/coreX/KubeConfigModal/KubeConfigModal.style.js +8 -8
  114. package/dist/cjs/coreX/NamesTooltip/index.js +3 -3
  115. package/dist/cjs/coreX/OverflowTooltip/index.js +4 -4
  116. package/dist/cjs/coreX/Sider/index.js +3 -3
  117. package/dist/cjs/coreX/SummaryTable/index.js +5 -5
  118. package/dist/cjs/coreX/SwitchWithText/index.js +1 -1
  119. package/dist/cjs/coreX/TabMenu/index.js +2 -2
  120. package/dist/cjs/coreX/UnderlineTootip/index.js +1 -1
  121. package/dist/cjs/coreX/UnitWithChart/index.js +3 -3
  122. package/dist/cjs/index.js +13 -0
  123. package/dist/cjs/stats1.html +1 -1
  124. package/dist/components.css +3935 -3863
  125. package/dist/esm/core/AccordionCard/index.js +1 -1
  126. package/dist/esm/core/Alert/alert.style.js +2 -2
  127. package/dist/esm/core/Antd5Tree/Antd5Tree.style.js +1 -1
  128. package/dist/esm/core/Avatar/index.js +1 -1
  129. package/dist/esm/core/Banner/banner.style.js +4 -4
  130. package/dist/esm/core/BasicCTError/BasicCTError.style.js +1 -1
  131. package/dist/esm/core/BlankState/style.js +1 -1
  132. package/dist/esm/core/Breadcrumb/index.js +1 -1
  133. package/dist/esm/core/Button/index.js +1 -1
  134. package/dist/esm/core/ButtonGroup/index.js +2 -2
  135. package/dist/esm/core/Card/CardBody.js +1 -1
  136. package/dist/esm/core/Card/CardTitle.js +1 -1
  137. package/dist/esm/core/Card/CardWrapper.js +2 -2
  138. package/dist/esm/core/Cascader/cascader.style.js +11 -11
  139. package/dist/esm/core/Checkbox/checkbox.style.js +1 -1
  140. package/dist/esm/core/DetailCard/index.js +1 -1
  141. package/dist/esm/core/DonutChart/index.js +2 -2
  142. package/dist/esm/core/DropdownMenu/index.js +1 -1
  143. package/dist/esm/core/ExpandableList/ExpandIcon.js +1 -1
  144. package/dist/esm/core/ExpandableList/ExpandableContainer.js +1 -1
  145. package/dist/esm/core/ExpandableList/ExpandableItem.js +2 -2
  146. package/dist/esm/core/ExpandableList/RoundOrder.js +1 -1
  147. package/dist/esm/core/FailedLoad/index.js +1 -1
  148. package/dist/esm/core/FormItem/index.js +1 -1
  149. package/dist/esm/core/Icon/index.js +1 -1
  150. package/dist/esm/core/ImmersiveDialog/styles.js +14 -14
  151. package/dist/esm/core/Input/index.js +1 -1
  152. package/dist/esm/core/InputGroup/index.js +1 -1
  153. package/dist/esm/core/InputInteger/index.js +1 -1
  154. package/dist/esm/core/InputNumber/index.js +1 -1
  155. package/dist/esm/core/InputPassword/index.js +1 -1
  156. package/dist/esm/core/InputTagItem/index.js +1 -1
  157. package/dist/esm/core/LegacySelect/select.style.js +1 -1
  158. package/dist/esm/core/Legend/index.js +5 -5
  159. package/dist/esm/core/LineChart/AreaHighlightLayer.js +115 -0
  160. package/dist/esm/core/LineChart/ForecastLineLayer.js +124 -0
  161. package/dist/esm/core/LineChart/LineChartActions.js +2 -2
  162. package/dist/esm/core/LineChart/RenderChart.js +276 -23
  163. package/dist/esm/core/LineChart/ThresholdIntersectionLayer.js +134 -0
  164. package/dist/esm/core/LineChart/TooltipFormatter.js +41 -39
  165. package/dist/esm/core/LineChart/areaHighlightUtils.js +87 -0
  166. package/dist/esm/core/LineChart/index.js +21 -3
  167. package/dist/esm/core/LineChart/lineChartDisplayUtils.js +26 -0
  168. package/dist/esm/core/LineChart/lineSegments.js +87 -0
  169. package/dist/esm/core/LineChart/styled.js +20 -10
  170. package/dist/esm/core/LineChart/utils.js +91 -5
  171. package/dist/esm/core/Link/index.js +1 -1
  172. package/dist/esm/core/Loading/style.js +4 -4
  173. package/dist/esm/core/LocalUpload/LocalUpload.hooks.js +6 -3
  174. package/dist/esm/core/LocalUpload/LocalUpload.js +52 -45
  175. package/dist/esm/core/LocalUpload/LocalUpload.style.js +2 -2
  176. package/dist/esm/core/LocalUpload/LocalUpload.widget.js +154 -131
  177. package/dist/esm/core/LogView/LogView.style.js +5 -5
  178. package/dist/esm/core/MediumDialog/MediumDialog.js +1 -1
  179. package/dist/esm/core/Metric/styled.js +8 -8
  180. package/dist/esm/core/Nav/index.js +1 -1
  181. package/dist/esm/core/Nav/style.js +2 -2
  182. package/dist/esm/core/Overflow/index.js +2 -2
  183. package/dist/esm/core/Pagination/index.js +2 -2
  184. package/dist/esm/core/Progress/components.js +2 -2
  185. package/dist/esm/core/Progress/index.js +2 -2
  186. package/dist/esm/core/Progress/progress.style.js +4 -4
  187. package/dist/esm/core/Progress/progress.widgets.js +2 -2
  188. package/dist/esm/core/Radio/index.js +3 -3
  189. package/dist/esm/core/SearchInput/SearchInput.style.js +5 -5
  190. package/dist/esm/core/SegmentControl/index.js +4 -4
  191. package/dist/esm/core/Select/select.style.js +4 -4
  192. package/dist/esm/core/Select/select.widgets.js +3 -3
  193. package/dist/esm/core/SimplePagination/index.js +2 -2
  194. package/dist/esm/core/Skeleton/Content.js +1 -1
  195. package/dist/esm/core/SmallDialog/SmallDialog.style.js +7 -7
  196. package/dist/esm/core/StatusCapsule/index.js +2 -2
  197. package/dist/esm/core/StepProgress/index.js +1 -1
  198. package/dist/esm/core/Steps/style.js +5 -5
  199. package/dist/esm/core/Styled/index.js +40 -40
  200. package/dist/esm/core/Switch/index.js +2 -2
  201. package/dist/esm/core/Tab/Tab.js +1 -1
  202. package/dist/esm/core/Tab/Tab.style.js +4 -4
  203. package/dist/esm/core/Table/TableSkeleton.js +1 -1
  204. package/dist/esm/core/Table/TableWidget.js +1 -1
  205. package/dist/esm/core/Table/index.js +3 -3
  206. package/dist/esm/core/TableForm/Columns/FormItem.js +1 -1
  207. package/dist/esm/core/TableForm/style.js +7 -7
  208. package/dist/esm/core/Tag/SplitTag.js +1 -1
  209. package/dist/esm/core/Tag/style.js +5 -5
  210. package/dist/esm/core/Time/index.js +1 -1
  211. package/dist/esm/core/TimeZoneSelect/index.js +7 -7
  212. package/dist/esm/core/Timeline/Timeline.style.js +5 -5
  213. package/dist/esm/core/Token/index.js +4 -4
  214. package/dist/esm/core/Token/style.js +1 -1
  215. package/dist/esm/core/Tooltip/EllipsisTooltipContent.js +1 -1
  216. package/dist/esm/core/Tooltip/index.js +1 -1
  217. package/dist/esm/core/Truncate/index.js +1 -1
  218. package/dist/esm/core/Typo/index.js +58 -58
  219. package/dist/esm/core/WizardDialog/styles.js +4 -4
  220. package/dist/esm/coreX/BarChart/index.js +1 -1
  221. package/dist/esm/coreX/BatchOperation/index.js +2 -2
  222. package/dist/esm/coreX/ChartWithTooltip/index.js +6 -6
  223. package/dist/esm/coreX/CheckPointList/checkpointlist.style.js +3 -3
  224. package/dist/esm/coreX/CircleLoading/index.js +1 -1
  225. package/dist/esm/coreX/CronCalendar/index.js +4 -4
  226. package/dist/esm/coreX/CronPlan/index.js +4 -4
  227. package/dist/esm/coreX/DateRangePicker/DateRangePicker.style.js +12 -12
  228. package/dist/esm/coreX/DateRangePicker/RelativeTime.js +10 -7
  229. package/dist/esm/coreX/DateRangePicker/common.js +99 -6
  230. package/dist/esm/coreX/DateRangePicker/index.js +108 -48
  231. package/dist/esm/coreX/Dialogs/DeleteDialog/DeleteDialog.js +2 -2
  232. package/dist/esm/coreX/Dialogs/RejectDialog/RejectDialog.js +6 -6
  233. package/dist/esm/coreX/GoBackButton/index.js +1 -1
  234. package/dist/esm/coreX/I18nNameTag/index.js +1 -1
  235. package/dist/esm/coreX/InfoRowList/InfoRow.js +1 -1
  236. package/dist/esm/coreX/InfoRowList/InfoRowList.js +4 -4
  237. package/dist/esm/coreX/KubeConfigModal/KubeConfigModal.style.js +8 -8
  238. package/dist/esm/coreX/NamesTooltip/index.js +3 -3
  239. package/dist/esm/coreX/OverflowTooltip/index.js +4 -4
  240. package/dist/esm/coreX/Sider/index.js +3 -3
  241. package/dist/esm/coreX/SummaryTable/index.js +5 -5
  242. package/dist/esm/coreX/SwitchWithText/index.js +1 -1
  243. package/dist/esm/coreX/TabMenu/index.js +2 -2
  244. package/dist/esm/coreX/UnderlineTootip/index.js +1 -1
  245. package/dist/esm/coreX/UnitWithChart/index.js +3 -3
  246. package/dist/esm/index.js +4 -1
  247. package/dist/esm/stats1.html +1 -1
  248. package/dist/linaria.merged.scss +4544 -4465
  249. package/dist/src/core/LineChart/AreaHighlightLayer.d.ts +31 -0
  250. package/dist/src/core/LineChart/ForecastLineLayer.d.ts +24 -0
  251. package/dist/src/core/LineChart/RenderChart.d.ts +5 -1
  252. package/dist/src/core/LineChart/ThresholdIntersectionLayer.d.ts +19 -0
  253. package/dist/src/core/LineChart/TooltipFormatter.d.ts +10 -0
  254. package/dist/src/core/LineChart/__test__/AreaHighlightLayer.test.d.ts +1 -0
  255. package/dist/src/core/LineChart/__test__/ForecastLineLayer.test.d.ts +1 -0
  256. package/dist/src/core/LineChart/__test__/utils.test.d.ts +1 -0
  257. package/dist/src/core/LineChart/areaHighlightUtils.d.ts +6 -0
  258. package/dist/src/core/LineChart/lineChartDisplayUtils.d.ts +7 -0
  259. package/dist/src/core/LineChart/lineSegments.d.ts +16 -0
  260. package/dist/src/core/LineChart/styled.d.ts +2 -0
  261. package/dist/src/core/LineChart/type.d.ts +94 -8
  262. package/dist/src/core/LineChart/utils.d.ts +31 -4
  263. package/dist/src/core/LocalUpload/LocalUpload.type.d.ts +12 -4
  264. package/dist/src/core/LocalUpload/LocalUpload.widget.d.ts +1 -0
  265. package/dist/src/core/LocalUpload/__test__/LocalUpload.test.d.ts +1 -0
  266. package/dist/src/coreX/DateRangePicker/__tests__/AbsoluteDate.test.d.ts +1 -0
  267. package/dist/src/coreX/DateRangePicker/__tests__/DateRangePicker.test.d.ts +1 -0
  268. package/dist/src/coreX/DateRangePicker/__tests__/RelativeTime.test.d.ts +1 -0
  269. package/dist/src/coreX/DateRangePicker/__tests__/common.test.d.ts +1 -0
  270. package/dist/src/coreX/DateRangePicker/common.d.ts +12 -3
  271. package/dist/src/coreX/DateRangePicker/dateRangePicker.type.d.ts +5 -1
  272. package/dist/stories/docs/core/LineChart.stories.d.ts +4 -0
  273. package/dist/stories/docs/core/LocalUpload.stories.d.ts +32 -13
  274. package/dist/stories/docs/coreX/DateRangePicker.stories.d.ts +1 -0
  275. package/dist/style.css +3936 -3864
  276. package/package.json +3 -3
@@ -96,10 +96,92 @@ function getLineChartXAxisDomain(dateRange, xaxisLastTime) {
96
96
  const [startDate, endDate] = dateRange;
97
97
  return [startDate.valueOf(), xaxisLastTime != null ? xaxisLastTime : endDate.valueOf()];
98
98
  }
99
+ const getLineChartMetricPayloadMatches = (payload, legends = []) => {
100
+ if (!(payload == null ? void 0 : payload.length)) {
101
+ return [];
102
+ }
103
+ return payload.flatMap((item) => {
104
+ const legend = legends.find((_legend, index) => `v${index}` === item.name);
105
+ if (!legend) {
106
+ return [];
107
+ }
108
+ return [{ payload: item, legend }];
109
+ });
110
+ };
111
+ const getLineChartAreaHighlightRanges = (ranges = [], xDomain) => {
112
+ const [domainStart, domainEnd] = xDomain;
113
+ return ranges.map((range) => __spreadProps(__spreadValues({}, range), {
114
+ start: Math.max(range.start, domainStart),
115
+ end: Math.min(range.end, domainEnd)
116
+ })).filter((range) => range.start < range.end);
117
+ };
99
118
  const getLineChartRangeTimestamp = (dateRange) => {
100
119
  const [startDate, endDate] = dateRange;
101
120
  return endDate.valueOf() - startDate.valueOf();
102
121
  };
122
+ const isSameIntersectionPoint = (prev, next) => {
123
+ if (!prev) {
124
+ return false;
125
+ }
126
+ return prev.streamIndex === next.streamIndex && Math.abs(prev.timestamp - next.timestamp) < 1e-6 && Math.abs(prev.value - next.value) < 1e-6;
127
+ };
128
+ const pushLineChartIntersection = (intersections, next) => {
129
+ if (!isSameIntersectionPoint(intersections[intersections.length - 1], next)) {
130
+ intersections.push(next);
131
+ }
132
+ };
133
+ const isValidLineChartValue = (value) => {
134
+ return ___default.default.isNumber(value) && Number.isFinite(value);
135
+ };
136
+ const getLineChartThresholdIntersections = (streams, thresholdValue, xDomain) => {
137
+ const [domainStart, domainEnd] = xDomain != null ? xDomain : [-Infinity, Infinity];
138
+ return streams.flatMap((stream, streamIndex) => {
139
+ const intersections = [];
140
+ for (let index = 0; index < stream.points.length - 1; index++) {
141
+ const currentPoint = stream.points[index];
142
+ const nextPoint = stream.points[index + 1];
143
+ if (!isValidLineChartValue(currentPoint == null ? void 0 : currentPoint.v) || !isValidLineChartValue(nextPoint == null ? void 0 : nextPoint.v) || currentPoint.t === nextPoint.t) {
144
+ continue;
145
+ }
146
+ const currentDiff = currentPoint.v - thresholdValue;
147
+ const nextDiff = nextPoint.v - thresholdValue;
148
+ if (currentDiff === 0 && nextDiff === 0) {
149
+ continue;
150
+ }
151
+ if (currentDiff === 0 && currentPoint.t >= domainStart && currentPoint.t <= domainEnd) {
152
+ pushLineChartIntersection(intersections, {
153
+ timestamp: currentPoint.t,
154
+ value: thresholdValue,
155
+ legend: stream.legend,
156
+ streamIndex
157
+ });
158
+ }
159
+ if (currentDiff * nextDiff < 0) {
160
+ const ratio = currentDiff / (currentDiff - nextDiff);
161
+ const timestamp = currentPoint.t + (nextPoint.t - currentPoint.t) * ratio;
162
+ if (timestamp >= domainStart && timestamp <= domainEnd) {
163
+ pushLineChartIntersection(intersections, {
164
+ timestamp,
165
+ value: thresholdValue,
166
+ legend: stream.legend,
167
+ streamIndex
168
+ });
169
+ }
170
+ }
171
+ if (nextDiff === 0 && nextPoint.t >= domainStart && nextPoint.t <= domainEnd) {
172
+ pushLineChartIntersection(intersections, {
173
+ timestamp: nextPoint.t,
174
+ value: thresholdValue,
175
+ legend: stream.legend,
176
+ streamIndex
177
+ });
178
+ }
179
+ }
180
+ return intersections.filter(
181
+ (intersection) => intersection.timestamp >= domainStart && intersection.timestamp <= domainEnd
182
+ );
183
+ });
184
+ };
103
185
  const getLineChartStep = (dateRange) => {
104
186
  const [startDate, endDate] = dateRange;
105
187
  const range = endDate.valueOf() - startDate.valueOf();
@@ -292,7 +374,7 @@ const UNIT_FORMATTER = {
292
374
  [type.ILineChartMetricUnit.Temperature]: [tower.formatTemperature, "\u2103"],
293
375
  [type.ILineChartMetricUnit.Load]: [tower.formatCount, ""]
294
376
  };
295
- const getLineChartYDataMax = (dataPoints, type$1) => {
377
+ const getLineChartYDataMax = (dataPoints, type$1, extraValues = []) => {
296
378
  const values = dataPoints.map((p) => {
297
379
  if (___default.default.isNumber(p == null ? void 0 : p.v)) {
298
380
  return p.v;
@@ -316,7 +398,11 @@ const getLineChartYDataMax = (dataPoints, type$1) => {
316
398
  return max;
317
399
  }
318
400
  });
319
- return Math.max(...values, 0);
401
+ return Math.max(
402
+ ...values,
403
+ 0,
404
+ ...extraValues.filter((value) => Number.isFinite(value))
405
+ );
320
406
  };
321
407
  const getYAxisUpperBound = (max, type$1) => {
322
408
  const DIVISOR = 2;
@@ -350,8 +436,8 @@ const getYAxisUpperBound = (max, type$1) => {
350
436
  return 2;
351
437
  }
352
438
  };
353
- const getYAxisDomain = (dataPoints, graphType, unitType) => {
354
- const max = getLineChartYDataMax(dataPoints, graphType);
439
+ const getYAxisDomain = (dataPoints, graphType, unitType, extraValues = []) => {
440
+ const max = getLineChartYDataMax(dataPoints, graphType, extraValues);
355
441
  if (!max) {
356
442
  if (unitType === type.ILineChartMetricUnit.Ratio) {
357
443
  return [0, 1];
@@ -382,8 +468,11 @@ exports.filterLineChartDataOverlapping = filterLineChartDataOverlapping;
382
468
  exports.filterLineChartOverlappingMetric = filterLineChartOverlappingMetric;
383
469
  exports.filterLineChartPointsByDateRange = filterLineChartPointsByDateRange;
384
470
  exports.getFirstExpectedTimestamp = getFirstExpectedTimestamp;
471
+ exports.getLineChartAreaHighlightRanges = getLineChartAreaHighlightRanges;
472
+ exports.getLineChartMetricPayloadMatches = getLineChartMetricPayloadMatches;
385
473
  exports.getLineChartRangeTimestamp = getLineChartRangeTimestamp;
386
474
  exports.getLineChartStep = getLineChartStep;
475
+ exports.getLineChartThresholdIntersections = getLineChartThresholdIntersections;
387
476
  exports.getLineChartXAxisDomain = getLineChartXAxisDomain;
388
477
  exports.getLineChartYDataMax = getLineChartYDataMax;
389
478
  exports.getYAxisDomain = getYAxisDomain;
@@ -37,7 +37,7 @@ var __objRest = (source, exclude) => {
37
37
  }
38
38
  return target;
39
39
  };
40
- const LinkStyle = "E_4100_0_17_l48ei06";
40
+ const LinkStyle = "E_4100_0_19_l48ei06";
41
41
  const Link = React__default.default.forwardRef((_a, ref) => {
42
42
  var _b = _a,
43
43
  {
@@ -1,9 +1,9 @@
1
1
  'use strict';
2
2
 
3
- const LoadingWrapper = "E_4100_0_17_lht19u8";
4
- const LoadingLine1 = "E_4100_0_17_lk3gkp4";
5
- const LoadingLine2 = "E_4100_0_17_ll4n94n";
6
- const LoadingLine3 = "E_4100_0_17_l17lbdo6";
3
+ const LoadingWrapper = "E_4100_0_19_lht19u8";
4
+ const LoadingLine1 = "E_4100_0_19_lk3gkp4";
5
+ const LoadingLine2 = "E_4100_0_19_ll4n94n";
6
+ const LoadingLine3 = "E_4100_0_19_l17lbdo6";
7
7
 
8
8
  exports.LoadingLine1 = LoadingLine1;
9
9
  exports.LoadingLine2 = LoadingLine2;
@@ -8,13 +8,16 @@ const useFileValidation = ({
8
8
  validate,
9
9
  createNewFile = false
10
10
  }) => {
11
+ const latestFileList = React.useRef(fileList);
11
12
  React.useEffect(() => {
13
+ latestFileList.current = fileList;
12
14
  if (!validate)
13
15
  return;
14
16
  const updateFile = (fileId, file) => {
15
- const index = fileList.findIndex((f) => f.uid === fileId);
17
+ const currentList = latestFileList.current;
18
+ const index = currentList.findIndex((f) => f.uid === fileId);
16
19
  if (index !== -1) {
17
- const newList = [...fileList];
20
+ const newList = [...currentList];
18
21
  const fileToUpdate = createNewFile ? (() => {
19
22
  const newFile = new File([file], file.name, { type: file.type });
20
23
  Object.assign(newFile, file);
@@ -1,12 +1,14 @@
1
1
  'use strict';
2
2
 
3
3
  var useParrotTranslation = require('../../hooks/useParrotTranslation.js');
4
+ var cs = require('classnames');
4
5
  var React = require('react');
5
6
  var LocalUpload_style = require('./LocalUpload.style.js');
6
7
  var LocalUpload_widget = require('./LocalUpload.widget.js');
7
8
 
8
9
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
9
10
 
11
+ var cs__default = /*#__PURE__*/_interopDefault(cs);
10
12
  var React__default = /*#__PURE__*/_interopDefault(React);
11
13
 
12
14
  var __defProp = Object.defineProperty;
@@ -30,6 +32,7 @@ const UploadComp = React__default.default.forwardRef(
30
32
  className,
31
33
  "data-testid": dataTestId,
32
34
  label,
35
+ labelPosition = "top",
33
36
  description,
34
37
  type = "dragger",
35
38
  multiple = false,
@@ -41,66 +44,71 @@ const UploadComp = React__default.default.forwardRef(
41
44
  setFileList,
42
45
  validate,
43
46
  buttonProps,
44
- listType = "list",
45
47
  disableRemoveList = false,
46
- onRemove
48
+ onRemove,
49
+ error
47
50
  }, ref) => {
48
51
  const { t } = useParrotTranslation();
49
52
  const removeFile = (id) => {
50
- const index = fileList.findIndex((f) => f.uid === id);
51
- if (index !== -1) {
52
- const file = fileList[index];
53
- fileList.splice(index, 1);
54
- setFileList([...fileList]);
55
- onRemove == null ? void 0 : onRemove(file);
53
+ const nextFileList = fileList.filter((file) => file.uid !== id);
54
+ if (nextFileList.length !== fileList.length) {
55
+ setFileList(nextFileList);
56
56
  }
57
57
  };
58
58
  const _maxCount = multiple ? maxCount || Infinity : 1;
59
59
  const isSingleSelect = _maxCount === 1;
60
+ const shouldShowDescriptionAbove = !!description && !!label && labelPosition === "top";
61
+ const shouldShowDescriptionBelow = !!description && !shouldShowDescriptionAbove;
62
+ const shouldDisableRemove = disabled || disableRemoveList;
63
+ const uploadContent = /* @__PURE__ */ React__default.default.createElement(React__default.default.Fragment, null, shouldShowDescriptionAbove ? /* @__PURE__ */ React__default.default.createElement(UploadComp.Description, null, description) : null, type === "button" ? /* @__PURE__ */ React__default.default.createElement(
64
+ UploadComp.Button,
65
+ __spreadValues({}, __spreadValues({
66
+ accept,
67
+ multiple,
68
+ disabled,
69
+ maxCount,
70
+ fileList,
71
+ setFileList,
72
+ validate,
73
+ error
74
+ }, buttonProps)),
75
+ t("components.select_file")
76
+ ) : /* @__PURE__ */ React__default.default.createElement(
77
+ UploadComp.Dragger,
78
+ __spreadValues({}, {
79
+ accept,
80
+ multiple,
81
+ disabled,
82
+ maxCount,
83
+ fileList,
84
+ setFileList,
85
+ validate,
86
+ disableRemove: shouldDisableRemove,
87
+ onRemove,
88
+ error
89
+ })
90
+ ), shouldShowDescriptionBelow ? /* @__PURE__ */ React__default.default.createElement(UploadComp.Description, { className: "description-below" }, description) : null, info, type === "button" || !isSingleSelect ? /* @__PURE__ */ React__default.default.createElement(
91
+ UploadComp.FileList,
92
+ {
93
+ fileList,
94
+ removeFile,
95
+ disableRemove: shouldDisableRemove,
96
+ onRemove
97
+ }
98
+ ) : null);
60
99
  return /* @__PURE__ */ React__default.default.createElement(
61
100
  UploadComp.Wrapper,
62
101
  {
63
- className,
102
+ className: cs__default.default(
103
+ className,
104
+ label && labelPosition === "left" ? "label-left" : "label-top",
105
+ !label && "no-label"
106
+ ),
64
107
  ref,
65
108
  "data-testid": dataTestId
66
109
  },
67
110
  label ? /* @__PURE__ */ React__default.default.createElement(UploadComp.Label, null, label) : null,
68
- description ? /* @__PURE__ */ React__default.default.createElement(UploadComp.Description, null, description) : null,
69
- type === "button" ? /* @__PURE__ */ React__default.default.createElement(
70
- UploadComp.Button,
71
- __spreadValues({}, __spreadValues({
72
- accept,
73
- multiple,
74
- disabled,
75
- maxCount,
76
- fileList,
77
- setFileList,
78
- validate
79
- }, buttonProps)),
80
- t("components.select_file")
81
- ) : /* @__PURE__ */ React__default.default.createElement(
82
- UploadComp.Dragger,
83
- __spreadValues({}, {
84
- accept,
85
- multiple,
86
- disabled,
87
- maxCount,
88
- fileList,
89
- setFileList,
90
- validate
91
- })
92
- ),
93
- info != null ? info : /* @__PURE__ */ React__default.default.createElement(React__default.default.Fragment, null),
94
- type === "button" || !isSingleSelect ? /* @__PURE__ */ React__default.default.createElement(
95
- UploadComp.FileList,
96
- {
97
- fileList,
98
- removeFile,
99
- type: listType,
100
- disableRemove: disableRemoveList,
101
- onRemove
102
- }
103
- ) : null
111
+ labelPosition === "left" && label ? /* @__PURE__ */ React__default.default.createElement("div", { className: "upload-main" }, uploadContent) : uploadContent
104
112
  );
105
113
  }
106
114
  );
@@ -4,10 +4,10 @@ var react = require('@linaria/react');
4
4
 
5
5
  const UploadWrapper = /*#__PURE__*/react.styled('div')({
6
6
  name: "UploadWrapper",
7
- class: "E_4100_0_17_u3l9ivi",
7
+ class: "E_4100_0_19_u3l9ivi",
8
8
  propsAsIs: false
9
9
  });
10
- const FileInfoWrapperStyle = "E_4100_0_17_ftdwz1g";
10
+ const FileInfoWrapperStyle = "E_4100_0_19_ftdwz1g";
11
11
 
12
12
  exports.FileInfoWrapperStyle = FileInfoWrapperStyle;
13
13
  exports.UploadWrapper = UploadWrapper;