@backstage-community/plugin-cost-insights 0.12.25 → 0.12.26

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 (230) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/alerts/ProjectGrowthAlert.esm.js +24 -0
  3. package/dist/alerts/ProjectGrowthAlert.esm.js.map +1 -0
  4. package/dist/alerts/UnlabeledDataflowAlert.esm.js +25 -0
  5. package/dist/alerts/UnlabeledDataflowAlert.esm.js.map +1 -0
  6. package/dist/api/CostInsightsApi.esm.js +8 -0
  7. package/dist/api/CostInsightsApi.esm.js.map +1 -0
  8. package/dist/components/ActionItems/ActionItemCard.esm.js +46 -0
  9. package/dist/components/ActionItems/ActionItemCard.esm.js.map +1 -0
  10. package/dist/components/ActionItems/ActionItems.esm.js +90 -0
  11. package/dist/components/ActionItems/ActionItems.esm.js.map +1 -0
  12. package/dist/components/AlertInsights/AlertDialog.esm.js +123 -0
  13. package/dist/components/AlertInsights/AlertDialog.esm.js.map +1 -0
  14. package/dist/components/AlertInsights/AlertInsights.esm.js +157 -0
  15. package/dist/components/AlertInsights/AlertInsights.esm.js.map +1 -0
  16. package/dist/components/AlertInsights/AlertInsightsHeader.esm.js +17 -0
  17. package/dist/components/AlertInsights/AlertInsightsHeader.esm.js.map +1 -0
  18. package/dist/components/AlertInsights/AlertInsightsSection.esm.js +57 -0
  19. package/dist/components/AlertInsights/AlertInsightsSection.esm.js.map +1 -0
  20. package/dist/components/AlertInsights/AlertInsightsSectionHeader.esm.js +30 -0
  21. package/dist/components/AlertInsights/AlertInsightsSectionHeader.esm.js.map +1 -0
  22. package/dist/components/AlertInsights/AlertStatusSummary.esm.js +93 -0
  23. package/dist/components/AlertInsights/AlertStatusSummary.esm.js.map +1 -0
  24. package/dist/components/AlertInsights/AlertStatusSummaryButton.esm.js +35 -0
  25. package/dist/components/AlertInsights/AlertStatusSummaryButton.esm.js.map +1 -0
  26. package/dist/components/AlertInstructionsLayout/AlertInstructionsLayout.esm.js +47 -0
  27. package/dist/components/AlertInstructionsLayout/AlertInstructionsLayout.esm.js.map +1 -0
  28. package/dist/components/BarChart/BarChart.esm.js +167 -0
  29. package/dist/components/BarChart/BarChart.esm.js.map +1 -0
  30. package/dist/components/BarChart/BarChartLabel.esm.js +31 -0
  31. package/dist/components/BarChart/BarChartLabel.esm.js.map +1 -0
  32. package/dist/components/BarChart/BarChartLegend.esm.js +47 -0
  33. package/dist/components/BarChart/BarChartLegend.esm.js.map +1 -0
  34. package/dist/components/BarChart/BarChartStepper.esm.js +91 -0
  35. package/dist/components/BarChart/BarChartStepper.esm.js.map +1 -0
  36. package/dist/components/BarChart/BarChartStepperButton.esm.js +27 -0
  37. package/dist/components/BarChart/BarChartStepperButton.esm.js.map +1 -0
  38. package/dist/components/BarChart/BarChartSteps.esm.js +25 -0
  39. package/dist/components/BarChart/BarChartSteps.esm.js.map +1 -0
  40. package/dist/components/BarChart/BarChartTick.esm.js +29 -0
  41. package/dist/components/BarChart/BarChartTick.esm.js.map +1 -0
  42. package/dist/components/BarChart/BarChartTooltip.esm.js +30 -0
  43. package/dist/components/BarChart/BarChartTooltip.esm.js.map +1 -0
  44. package/dist/components/BarChart/BarChartTooltipItem.esm.js +24 -0
  45. package/dist/components/BarChart/BarChartTooltipItem.esm.js.map +1 -0
  46. package/dist/components/CopyUrlToClipboard/CopyUrlToClipboard.esm.js +44 -0
  47. package/dist/components/CopyUrlToClipboard/CopyUrlToClipboard.esm.js.map +1 -0
  48. package/dist/components/CostGrowth/CostGrowth.esm.js +55 -0
  49. package/dist/components/CostGrowth/CostGrowth.esm.js.map +1 -0
  50. package/dist/components/CostGrowth/CostGrowthIndicator.esm.js +31 -0
  51. package/dist/components/CostGrowth/CostGrowthIndicator.esm.js.map +1 -0
  52. package/dist/components/CostInsightsHeader/CostInsightsHeader.esm.js +57 -0
  53. package/dist/components/CostInsightsHeader/CostInsightsHeader.esm.js.map +1 -0
  54. package/dist/components/CostInsightsLayout/CostInsightsLayout.esm.js +35 -0
  55. package/dist/components/CostInsightsLayout/CostInsightsLayout.esm.js.map +1 -0
  56. package/dist/components/CostInsightsNavigation/CostInsightsNavigation.esm.js +87 -0
  57. package/dist/components/CostInsightsNavigation/CostInsightsNavigation.esm.js.map +1 -0
  58. package/dist/components/CostInsightsPage/CostInsightsPage.esm.js +229 -0
  59. package/dist/components/CostInsightsPage/CostInsightsPage.esm.js.map +1 -0
  60. package/dist/components/CostInsightsPage/CostInsightsPageRoot.esm.js +15 -0
  61. package/dist/components/CostInsightsPage/CostInsightsPageRoot.esm.js.map +1 -0
  62. package/dist/components/CostInsightsPage/CostInsightsThemeProvider.esm.js +24 -0
  63. package/dist/components/CostInsightsPage/CostInsightsThemeProvider.esm.js.map +1 -0
  64. package/dist/components/CostInsightsPage/index.esm.js +2 -0
  65. package/dist/components/CostInsightsPage/index.esm.js.map +1 -0
  66. package/dist/components/CostInsightsPage/selector.esm.js +15 -0
  67. package/dist/components/CostInsightsPage/selector.esm.js.map +1 -0
  68. package/dist/components/CostInsightsTabs/CostInsightsTabs.esm.js +89 -0
  69. package/dist/components/CostInsightsTabs/CostInsightsTabs.esm.js.map +1 -0
  70. package/dist/components/CostInsightsTabs/selector.esm.js +17 -0
  71. package/dist/components/CostInsightsTabs/selector.esm.js.map +1 -0
  72. package/dist/components/CostOverviewCard/CostOverviewBreakdownChart.esm.js +196 -0
  73. package/dist/components/CostOverviewCard/CostOverviewBreakdownChart.esm.js.map +1 -0
  74. package/dist/components/CostOverviewCard/CostOverviewCard.esm.js +99 -0
  75. package/dist/components/CostOverviewCard/CostOverviewCard.esm.js.map +1 -0
  76. package/dist/components/CostOverviewCard/CostOverviewChart.esm.js +157 -0
  77. package/dist/components/CostOverviewCard/CostOverviewChart.esm.js.map +1 -0
  78. package/dist/components/CostOverviewCard/CostOverviewHeader.esm.js +25 -0
  79. package/dist/components/CostOverviewCard/CostOverviewHeader.esm.js.map +1 -0
  80. package/dist/components/CostOverviewCard/CostOverviewLegend.esm.js +54 -0
  81. package/dist/components/CostOverviewCard/CostOverviewLegend.esm.js.map +1 -0
  82. package/dist/components/CostOverviewCard/selector.esm.js +22 -0
  83. package/dist/components/CostOverviewCard/selector.esm.js.map +1 -0
  84. package/dist/components/CurrencySelect/CurrencySelect.esm.js +52 -0
  85. package/dist/components/CurrencySelect/CurrencySelect.esm.js.map +1 -0
  86. package/dist/{esm/index-BPzWHt3A.esm.js → components/EntityCosts/EntityCosts.esm.js} +14 -80
  87. package/dist/{esm/index-BPzWHt3A.esm.js.map → components/EntityCosts/EntityCosts.esm.js.map} +1 -1
  88. package/dist/components/EntityCosts/index.esm.js +2 -0
  89. package/dist/components/EntityCosts/index.esm.js.map +1 -0
  90. package/dist/{esm/index-BA6m_qFS.esm.js → components/LabelDataflowInstructionsPage/LabelDataflowInstructionsPage.esm.js} +2 -79
  91. package/dist/components/LabelDataflowInstructionsPage/LabelDataflowInstructionsPage.esm.js.map +1 -0
  92. package/dist/components/LabelDataflowInstructionsPage/index.esm.js +2 -0
  93. package/dist/components/LabelDataflowInstructionsPage/index.esm.js.map +1 -0
  94. package/dist/components/LegendItem/LegendItem.esm.js +44 -0
  95. package/dist/components/LegendItem/LegendItem.esm.js.map +1 -0
  96. package/dist/components/MetricSelect/MetricSelect.esm.js +37 -0
  97. package/dist/components/MetricSelect/MetricSelect.esm.js.map +1 -0
  98. package/dist/components/PeriodSelect/PeriodSelect.esm.js +72 -0
  99. package/dist/components/PeriodSelect/PeriodSelect.esm.js.map +1 -0
  100. package/dist/components/ProductInsights/ProductInsights.esm.js +98 -0
  101. package/dist/components/ProductInsights/ProductInsights.esm.js.map +1 -0
  102. package/dist/components/ProductInsightsCard/ProductEntityDialog.esm.js +42 -0
  103. package/dist/components/ProductInsightsCard/ProductEntityDialog.esm.js.map +1 -0
  104. package/dist/components/ProductInsightsCard/ProductEntityTable.esm.js +139 -0
  105. package/dist/components/ProductInsightsCard/ProductEntityTable.esm.js.map +1 -0
  106. package/dist/components/ProductInsightsCard/ProductInsightsCard.esm.js +83 -0
  107. package/dist/components/ProductInsightsCard/ProductInsightsCard.esm.js.map +1 -0
  108. package/dist/components/ProductInsightsCard/ProductInsightsCardList.esm.js +34 -0
  109. package/dist/components/ProductInsightsCard/ProductInsightsCardList.esm.js.map +1 -0
  110. package/dist/components/ProductInsightsCard/ProductInsightsChart.esm.js +148 -0
  111. package/dist/components/ProductInsightsCard/ProductInsightsChart.esm.js.map +1 -0
  112. package/dist/components/ProjectGrowthAlertCard/ProjectGrowthAlertCard.esm.js +20 -0
  113. package/dist/components/ProjectGrowthAlertCard/ProjectGrowthAlertCard.esm.js.map +1 -0
  114. package/dist/components/ProjectGrowthAlertCard/ProjectGrowthAlertChart.esm.js +46 -0
  115. package/dist/components/ProjectGrowthAlertCard/ProjectGrowthAlertChart.esm.js.map +1 -0
  116. package/dist/components/ProjectGrowthInstructionsPage/ProjectGrowthInstructionsPage.esm.js +111 -0
  117. package/dist/components/ProjectGrowthInstructionsPage/ProjectGrowthInstructionsPage.esm.js.map +1 -0
  118. package/dist/components/ProjectGrowthInstructionsPage/index.esm.js +2 -0
  119. package/dist/components/ProjectGrowthInstructionsPage/index.esm.js.map +1 -0
  120. package/dist/components/ProjectSelect/ProjectSelect.esm.js +47 -0
  121. package/dist/components/ProjectSelect/ProjectSelect.esm.js.map +1 -0
  122. package/dist/components/UnlabeledDataflowAlertCard/UnlabeledDataflowAlertCard.esm.js +41 -0
  123. package/dist/components/UnlabeledDataflowAlertCard/UnlabeledDataflowAlertCard.esm.js.map +1 -0
  124. package/dist/components/WhyCostsMatter/WhyCostsMatter.esm.js +21 -0
  125. package/dist/components/WhyCostsMatter/WhyCostsMatter.esm.js.map +1 -0
  126. package/dist/example/alerts/KubernetesMigrationAlert.esm.js +86 -0
  127. package/dist/example/alerts/KubernetesMigrationAlert.esm.js.map +1 -0
  128. package/dist/example/client.esm.js +194 -0
  129. package/dist/example/client.esm.js.map +1 -0
  130. package/dist/example/components/KubernetesMigrationAlertCard/KubernetesMigrationAlertCard.esm.js +33 -0
  131. package/dist/example/components/KubernetesMigrationAlertCard/KubernetesMigrationAlertCard.esm.js.map +1 -0
  132. package/dist/{esm/index-BTIHr4n_.esm.js → example/components/KubernetesMigrationAlertCard/KubernetesMigrationBarChart.esm.js} +69 -48
  133. package/dist/example/components/KubernetesMigrationAlertCard/KubernetesMigrationBarChart.esm.js.map +1 -0
  134. package/dist/example/components/KubernetesMigrationAlertCard/KubernetesMigrationBarChartLegend.esm.js +107 -0
  135. package/dist/example/components/KubernetesMigrationAlertCard/KubernetesMigrationBarChartLegend.esm.js.map +1 -0
  136. package/dist/example/forms/KubernetesMigrationDismissForm.esm.js +57 -0
  137. package/dist/example/forms/KubernetesMigrationDismissForm.esm.js.map +1 -0
  138. package/dist/forms/AlertAcceptForm.esm.js +27 -0
  139. package/dist/forms/AlertAcceptForm.esm.js.map +1 -0
  140. package/dist/forms/AlertDismissForm.esm.js +100 -0
  141. package/dist/forms/AlertDismissForm.esm.js.map +1 -0
  142. package/dist/forms/AlertSnoozeForm.esm.js +52 -0
  143. package/dist/forms/AlertSnoozeForm.esm.js.map +1 -0
  144. package/dist/hooks/useConfig.esm.js +153 -0
  145. package/dist/hooks/useConfig.esm.js.map +1 -0
  146. package/dist/hooks/useCurrency.esm.js +26 -0
  147. package/dist/hooks/useCurrency.esm.js.map +1 -0
  148. package/dist/hooks/useFilters.esm.js +67 -0
  149. package/dist/hooks/useFilters.esm.js.map +1 -0
  150. package/dist/hooks/useGroups.esm.js +55 -0
  151. package/dist/hooks/useGroups.esm.js.map +1 -0
  152. package/dist/hooks/useLastCompleteBillingDate.esm.js +65 -0
  153. package/dist/hooks/useLastCompleteBillingDate.esm.js.map +1 -0
  154. package/dist/hooks/useLoading.esm.js +54 -0
  155. package/dist/hooks/useLoading.esm.js.map +1 -0
  156. package/dist/hooks/useScroll.esm.js +24 -0
  157. package/dist/hooks/useScroll.esm.js.map +1 -0
  158. package/dist/index.esm.js +37 -22
  159. package/dist/index.esm.js.map +1 -1
  160. package/dist/plugin.esm.js +55 -0
  161. package/dist/plugin.esm.js.map +1 -0
  162. package/dist/testUtils/filters.esm.js +8 -0
  163. package/dist/testUtils/filters.esm.js.map +1 -0
  164. package/dist/testUtils/loading.esm.js +14 -0
  165. package/dist/testUtils/loading.esm.js.map +1 -0
  166. package/dist/testUtils/mockData.esm.js +485 -0
  167. package/dist/testUtils/mockData.esm.js.map +1 -0
  168. package/dist/testUtils/products.esm.js +49 -0
  169. package/dist/testUtils/products.esm.js.map +1 -0
  170. package/dist/testUtils/providers.esm.js +41 -0
  171. package/dist/testUtils/providers.esm.js.map +1 -0
  172. package/dist/testUtils/testUtils.esm.js +142 -0
  173. package/dist/testUtils/testUtils.esm.js.map +1 -0
  174. package/dist/types/Alert.esm.js +66 -0
  175. package/dist/types/Alert.esm.js.map +1 -0
  176. package/dist/types/ChangeStatistic.esm.js +15 -0
  177. package/dist/types/ChangeStatistic.esm.js.map +1 -0
  178. package/dist/types/CurrencyType.esm.js +10 -0
  179. package/dist/types/CurrencyType.esm.js.map +1 -0
  180. package/dist/types/DateFormat.esm.js +4 -0
  181. package/dist/types/DateFormat.esm.js.map +1 -0
  182. package/dist/types/Duration.esm.js +10 -0
  183. package/dist/types/Duration.esm.js.map +1 -0
  184. package/dist/types/Icon.esm.js +12 -0
  185. package/dist/types/Icon.esm.js.map +1 -0
  186. package/dist/utils/alerts.esm.js +72 -0
  187. package/dist/utils/alerts.esm.js.map +1 -0
  188. package/dist/utils/assert.esm.js +29 -0
  189. package/dist/utils/assert.esm.js.map +1 -0
  190. package/dist/utils/change.esm.js +58 -0
  191. package/dist/utils/change.esm.js.map +1 -0
  192. package/dist/utils/charts.esm.js +9 -0
  193. package/dist/utils/charts.esm.js.map +1 -0
  194. package/dist/utils/config.esm.js +19 -0
  195. package/dist/utils/config.esm.js.map +1 -0
  196. package/dist/utils/currency.esm.js +56 -0
  197. package/dist/utils/currency.esm.js.map +1 -0
  198. package/dist/utils/duration.esm.js +55 -0
  199. package/dist/utils/duration.esm.js.map +1 -0
  200. package/dist/utils/filters.esm.js +14 -0
  201. package/dist/utils/filters.esm.js.map +1 -0
  202. package/dist/utils/formatters.esm.js +103 -0
  203. package/dist/utils/formatters.esm.js.map +1 -0
  204. package/dist/utils/grammar.esm.js +14 -0
  205. package/dist/utils/grammar.esm.js.map +1 -0
  206. package/dist/utils/graphs.esm.js +48 -0
  207. package/dist/utils/graphs.esm.js.map +1 -0
  208. package/dist/utils/history.esm.js +32 -0
  209. package/dist/utils/history.esm.js.map +1 -0
  210. package/dist/utils/loading.esm.js +51 -0
  211. package/dist/utils/loading.esm.js.map +1 -0
  212. package/dist/utils/navigation.esm.js +56 -0
  213. package/dist/utils/navigation.esm.js.map +1 -0
  214. package/dist/utils/scroll.esm.js +38 -0
  215. package/dist/utils/scroll.esm.js.map +1 -0
  216. package/dist/utils/sort.esm.js +10 -0
  217. package/dist/utils/sort.esm.js.map +1 -0
  218. package/dist/utils/styles.esm.js +562 -0
  219. package/dist/utils/styles.esm.js.map +1 -0
  220. package/dist/utils/sum.esm.js +4 -0
  221. package/dist/utils/sum.esm.js.map +1 -0
  222. package/package.json +17 -12
  223. package/dist/esm/index-BA6m_qFS.esm.js.map +0 -1
  224. package/dist/esm/index-BFM2mP6Z.esm.js +0 -4084
  225. package/dist/esm/index-BFM2mP6Z.esm.js.map +0 -1
  226. package/dist/esm/index-BTIHr4n_.esm.js.map +0 -1
  227. package/dist/esm/index-DaitkcPN.esm.js +0 -1136
  228. package/dist/esm/index-DaitkcPN.esm.js.map +0 -1
  229. package/dist/esm/selector-D7iXJwd9.esm.js +0 -594
  230. package/dist/esm/selector-D7iXJwd9.esm.js.map +0 -1
@@ -0,0 +1,91 @@
1
+ import React, { useState, useEffect } from 'react';
2
+ import Paper from '@material-ui/core/Paper';
3
+ import Slide from '@material-ui/core/Slide';
4
+ import ChevronLeftIcon from '@material-ui/icons/ChevronLeft';
5
+ import ChevronRightIcon from '@material-ui/icons/ChevronRight';
6
+ import { BarChartStepperButton } from './BarChartStepperButton.esm.js';
7
+ import { BarChartSteps } from './BarChartSteps.esm.js';
8
+ import { useBarChartStepperStyles } from '../../utils/styles.esm.js';
9
+
10
+ const BarChartStepper = ({
11
+ steps,
12
+ disableScroll,
13
+ onChange
14
+ }) => {
15
+ const classes = useBarChartStepperStyles();
16
+ const [activeStep, setActiveStep] = useState(0);
17
+ const diff = steps % 10;
18
+ const stepsRemaining = steps - activeStep <= diff ? diff : steps;
19
+ const displayedStep = activeStep % 10;
20
+ useEffect(() => {
21
+ onChange(activeStep);
22
+ }, [activeStep, onChange]);
23
+ const handleNext = () => {
24
+ setActiveStep((prevStep) => prevStep + 1);
25
+ };
26
+ const handleBack = () => {
27
+ setActiveStep((prevStep) => prevStep - 1);
28
+ };
29
+ const handleClick = (index) => {
30
+ setActiveStep((prevStep) => {
31
+ const offset = index - prevStep % 10;
32
+ return prevStep + offset;
33
+ });
34
+ };
35
+ return /* @__PURE__ */ React.createElement(
36
+ Paper,
37
+ {
38
+ "data-testid": "bar-chart-stepper",
39
+ square: true,
40
+ elevation: 0,
41
+ className: classes.paper
42
+ },
43
+ /* @__PURE__ */ React.createElement(
44
+ Slide,
45
+ {
46
+ direction: "right",
47
+ in: !disableScroll && activeStep !== 0,
48
+ mountOnEnter: true,
49
+ unmountOnExit: true
50
+ },
51
+ /* @__PURE__ */ React.createElement(
52
+ BarChartStepperButton,
53
+ {
54
+ name: "back",
55
+ className: classes.backButton,
56
+ onClick: handleBack
57
+ },
58
+ /* @__PURE__ */ React.createElement(ChevronLeftIcon, null)
59
+ )
60
+ ),
61
+ /* @__PURE__ */ React.createElement(
62
+ BarChartSteps,
63
+ {
64
+ steps: Math.min(10, stepsRemaining),
65
+ activeStep: displayedStep,
66
+ onClick: handleClick
67
+ }
68
+ ),
69
+ /* @__PURE__ */ React.createElement(
70
+ Slide,
71
+ {
72
+ direction: "left",
73
+ in: !disableScroll && activeStep < steps - 1,
74
+ mountOnEnter: true,
75
+ unmountOnExit: true
76
+ },
77
+ /* @__PURE__ */ React.createElement(
78
+ BarChartStepperButton,
79
+ {
80
+ name: "next",
81
+ className: classes.nextButton,
82
+ onClick: handleNext
83
+ },
84
+ /* @__PURE__ */ React.createElement(ChevronRightIcon, null)
85
+ )
86
+ )
87
+ );
88
+ };
89
+
90
+ export { BarChartStepper };
91
+ //# sourceMappingURL=BarChartStepper.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BarChartStepper.esm.js","sources":["../../../src/components/BarChart/BarChartStepper.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { useEffect, useState } from 'react';\nimport Paper from '@material-ui/core/Paper';\nimport Slide from '@material-ui/core/Slide';\nimport ChevronLeftIcon from '@material-ui/icons/ChevronLeft';\nimport ChevronRightIcon from '@material-ui/icons/ChevronRight';\nimport { BarChartStepperButton } from './BarChartStepperButton';\nimport { BarChartSteps } from './BarChartSteps';\nimport { useBarChartStepperStyles } from '../../utils/styles';\n\ntype BarChartStepperProps = {\n disableScroll: boolean;\n steps: number;\n onChange: (activeStep: number) => void;\n};\n\nexport const BarChartStepper = ({\n steps,\n disableScroll,\n onChange,\n}: BarChartStepperProps) => {\n const classes = useBarChartStepperStyles();\n const [activeStep, setActiveStep] = useState(0);\n\n /*\n * This calc determines how many active steps to display in the stepper.\n * If the chart is displaying a large amount of resources,\n * the total dots are truncated to 10. As the user clicks forward,\n * eventually, there might be resources \"left over\" in excess of the ten dot limit.\n * Once the user has reached that threshold, the difference should appear constant\n * as the user clicks through the remaining resources and no extra dots should be displayed.\n */\n\n const diff = steps % 10;\n const stepsRemaining = steps - activeStep <= diff ? diff : steps;\n const displayedStep = activeStep % 10;\n\n useEffect(() => {\n onChange(activeStep);\n }, [activeStep, onChange]);\n\n const handleNext = () => {\n setActiveStep(prevStep => prevStep + 1);\n };\n\n const handleBack = () => {\n setActiveStep(prevStep => prevStep - 1);\n };\n\n const handleClick = (index: number) => {\n setActiveStep(prevStep => {\n const offset = index - (prevStep % 10);\n return prevStep + offset;\n });\n };\n\n return (\n <Paper\n data-testid=\"bar-chart-stepper\"\n square\n elevation={0}\n className={classes.paper}\n >\n <Slide\n direction=\"right\"\n in={!disableScroll && activeStep !== 0}\n mountOnEnter\n unmountOnExit\n >\n <BarChartStepperButton\n name=\"back\"\n className={classes.backButton}\n onClick={handleBack}\n >\n <ChevronLeftIcon />\n </BarChartStepperButton>\n </Slide>\n <BarChartSteps\n steps={Math.min(10, stepsRemaining)}\n activeStep={displayedStep}\n onClick={handleClick}\n />\n <Slide\n direction=\"left\"\n in={!disableScroll && activeStep < steps - 1}\n mountOnEnter\n unmountOnExit\n >\n <BarChartStepperButton\n name=\"next\"\n className={classes.nextButton}\n onClick={handleNext}\n >\n <ChevronRightIcon />\n </BarChartStepperButton>\n </Slide>\n </Paper>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;AA+BO,MAAM,kBAAkB,CAAC;AAAA,EAC9B,KAAA;AAAA,EACA,aAAA;AAAA,EACA,QAAA;AACF,CAA4B,KAAA;AAC1B,EAAA,MAAM,UAAU,wBAAyB,EAAA,CAAA;AACzC,EAAA,MAAM,CAAC,UAAA,EAAY,aAAa,CAAA,GAAI,SAAS,CAAC,CAAA,CAAA;AAW9C,EAAA,MAAM,OAAO,KAAQ,GAAA,EAAA,CAAA;AACrB,EAAA,MAAM,cAAiB,GAAA,KAAA,GAAQ,UAAc,IAAA,IAAA,GAAO,IAAO,GAAA,KAAA,CAAA;AAC3D,EAAA,MAAM,gBAAgB,UAAa,GAAA,EAAA,CA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AA;AAAA,OACnB;AAAA,KACF;AAAA,oBACA,KAAA,CAAA,aAAA;AAAA,MAAC,aAAA;AAAA,MAAA;AAAA,QACC,KAAO,EAAA,IAAA,CAAK,GAAI,CAAA,EAAA,EAAI,cAAc,CAAA;AAAA,QAClC,UAAY,EAAA,aAAA;AAAA,QACZ,OAAS,EAAA,WAAA;AAAA,OAAA;AAAA,KACX;AAAA,oBACA,KAAA,CAAA,aAAA;AAAA,MAAC,KAAA;AAAA,MAAA;AAAA,QACC,SAAU,EAAA,MAAA;AAAA,QACV,EAAI,EAAA,CAAC,aAAiB,IAAA,UAAA,GAAa,KAAQ,GAAA,CAAA;AAAA,QAC3C,YAAY,EAAA,IAAA;AAAA,QACZ,aAAa,EAAA,IAAA;AAAA,OAAA;AAAA,sBAEb,KAAA,CAAA,aAAA;AAAA,QAAC,qBAAA;AAAA,QAAA;AAAA,UACC,IAAK,EAAA,MAAA;AAAA,UACL,WAAW,OAAQ,CAAA,UAAA;AAAA,UACnB,OAAS,EAAA,UAAA;AAAA,SAAA;AAAA,4CAER,gBAAiB,EAAA,IAAA,CAAA;AAAA,OACpB;AAAA,KACF;AAAA,GACF,CAAA;AAEJ;;;;"}
@@ -0,0 +1,27 @@
1
+ import React, { forwardRef } from 'react';
2
+ import ButtonBase from '@material-ui/core/ButtonBase';
3
+ import { useBarChartStepperButtonStyles } from '../../utils/styles.esm.js';
4
+
5
+ const BarChartStepperButton = forwardRef(
6
+ ({
7
+ name,
8
+ children,
9
+ ...buttonBaseProps
10
+ }, ref) => {
11
+ const classes = useBarChartStepperButtonStyles();
12
+ return /* @__PURE__ */ React.createElement(
13
+ ButtonBase,
14
+ {
15
+ ref,
16
+ classes,
17
+ disableRipple: true,
18
+ "data-testid": `bar-chart-stepper-button-${name}`,
19
+ ...buttonBaseProps
20
+ },
21
+ children
22
+ );
23
+ }
24
+ );
25
+
26
+ export { BarChartStepperButton };
27
+ //# sourceMappingURL=BarChartStepperButton.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BarChartStepperButton.esm.js","sources":["../../../src/components/BarChart/BarChartStepperButton.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { forwardRef, PropsWithChildren, Ref } from 'react';\nimport ButtonBase, { ButtonBaseProps } from '@material-ui/core/ButtonBase';\nimport { useBarChartStepperButtonStyles as useStyles } from '../../utils/styles';\n\ninterface BarChartStepperButtonProps extends ButtonBaseProps {\n name: string;\n}\n\nexport const BarChartStepperButton = forwardRef(\n (\n {\n name,\n children,\n ...buttonBaseProps\n }: PropsWithChildren<BarChartStepperButtonProps>,\n ref: Ref<HTMLButtonElement>,\n ) => {\n const classes = useStyles();\n return (\n <ButtonBase\n ref={ref}\n classes={classes}\n disableRipple\n data-testid={`bar-chart-stepper-button-${name}`}\n {...buttonBaseProps}\n >\n {children}\n </ButtonBase>\n );\n },\n);\n"],"names":["useStyles"],"mappings":";;;;AAwBO,MAAM,qBAAwB,GAAA,UAAA;AAAA,EACnC,CACE;AAAA,IACE,IAAA;AAAA,IACA,QAAA;AAAA,IACA,GAAG,eAAA;AAAA,KAEL,GACG,KAAA;AACH,IAAA,MAAM,UAAUA,8BAAU,EAAA,CAAA;AAC1B,IACE,uBAAA,KAAA,CAAA,aAAA;AAAA,MAAC,UAAA;AAAA,MAAA;AAAA,QACC,GAAA;AAAA,QACA,OAAA;AAAA,QACA,aAAa,EAAA,IAAA;AAAA,QACb,aAAA,EAAa,4BAA4B,IAAI,CAAA,CAAA;AAAA,QAC5C,GAAG,eAAA;AAAA,OAAA;AAAA,MAEH,QAAA;AAAA,KACH,CAAA;AAAA,GAEJ;AACF;;;;"}
@@ -0,0 +1,25 @@
1
+ import React from 'react';
2
+ import ButtonBase from '@material-ui/core/ButtonBase';
3
+ import { useBarChartStepperStyles } from '../../utils/styles.esm.js';
4
+
5
+ const BarChartSteps = ({
6
+ steps,
7
+ activeStep,
8
+ onClick
9
+ }) => {
10
+ const classes = useBarChartStepperStyles();
11
+ const handleOnClick = (index) => (event) => {
12
+ event.preventDefault();
13
+ onClick(index);
14
+ };
15
+ return /* @__PURE__ */ React.createElement("div", { className: classes.steps }, [...new Array(steps)].map((_, index) => /* @__PURE__ */ React.createElement(ButtonBase, { key: index, centerRipple: true, onClick: handleOnClick(index) }, /* @__PURE__ */ React.createElement(
16
+ "div",
17
+ {
18
+ "data-testid": "bar-chart-step",
19
+ className: `${classes.step} ${index === activeStep ? classes.stepActive : ""}`
20
+ }
21
+ ))));
22
+ };
23
+
24
+ export { BarChartSteps };
25
+ //# sourceMappingURL=BarChartSteps.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BarChartSteps.esm.js","sources":["../../../src/components/BarChart/BarChartSteps.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from 'react';\nimport ButtonBase from '@material-ui/core/ButtonBase';\nimport { useBarChartStepperStyles as useStyles } from '../../utils/styles';\n\nexport type BarChartStepsProps = {\n steps: number;\n activeStep: number;\n onClick: (index: number) => void;\n};\n\nexport const BarChartSteps = ({\n steps,\n activeStep,\n onClick,\n}: BarChartStepsProps) => {\n const classes = useStyles();\n const handleOnClick =\n (index: number) =>\n (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => {\n event.preventDefault();\n onClick(index);\n };\n\n return (\n <div className={classes.steps}>\n {[...new Array(steps)].map((_, index) => (\n <ButtonBase key={index} centerRipple onClick={handleOnClick(index)}>\n <div\n data-testid=\"bar-chart-step\"\n className={`${classes.step} ${\n index === activeStep ? classes.stepActive : ''\n }`}\n />\n </ButtonBase>\n ))}\n </div>\n );\n};\n"],"names":["useStyles"],"mappings":";;;;AA0BO,MAAM,gBAAgB,CAAC;AAAA,EAC5B,KAAA;AAAA,EACA,UAAA;AAAA,EACA,OAAA;AACF,CAA0B,KAAA;AACxB,EAAA,MAAM,UAAUA,wBAAU,EAAA,CAAA;AAC1B,EAAA,MAAM,aACJ,GAAA,CAAC,KACD,KAAA,CAAC,KAA2D,KAAA;AAC1D,IAAA,KAAA,CAAM,cAAe,EAAA,CAAA;AACrB,IAAA,OAAA,CAAQ,KAAK,CAAA,CAAA;AAAA,GACf,CAAA;AAEF,EACE,uBAAA,KAAA,CAAA,aAAA,CAAC,KAAI,EAAA,EAAA,SAAA,EAAW,OAAQ,CAAA,KAAA,EAAA,EACrB,CAAC,GAAG,IAAI,KAAM,CAAA,KAAK,CAAC,CAAA,CAAE,IAAI,CAAC,CAAA,EAAG,KAC7B,qBAAA,KAAA,CAAA,aAAA,CAAC,UAAW,EAAA,EAAA,GAAA,EAAK,KAAO,EAAA,YAAA,EAAY,IAAC,EAAA,OAAA,EAAS,aAAc,CAAA,KAAK,CAC/D,EAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,aAAY,EAAA,gBAAA;AAAA,MACZ,SAAA,EAAW,GAAG,OAAQ,CAAA,IAAI,IACxB,KAAU,KAAA,UAAA,GAAa,OAAQ,CAAA,UAAA,GAAa,EAC9C,CAAA,CAAA;AAAA,KAAA;AAAA,GAEJ,CACD,CACH,CAAA,CAAA;AAEJ;;;;"}
@@ -0,0 +1,29 @@
1
+ import React from 'react';
2
+ import { BarChartLabel } from './BarChartLabel.esm.js';
3
+
4
+ const BarChartTick = ({
5
+ x,
6
+ y,
7
+ height,
8
+ width,
9
+ payload,
10
+ visibleTicksCount,
11
+ details
12
+ }) => {
13
+ const gutterWidth = 5;
14
+ const labelWidth = width / visibleTicksCount - gutterWidth * 2;
15
+ return /* @__PURE__ */ React.createElement(
16
+ BarChartLabel,
17
+ {
18
+ x,
19
+ y,
20
+ height,
21
+ width: labelWidth,
22
+ details
23
+ },
24
+ !payload.value ? "Unlabeled" : payload.value
25
+ );
26
+ };
27
+
28
+ export { BarChartTick };
29
+ //# sourceMappingURL=BarChartTick.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BarChartTick.esm.js","sources":["../../../src/components/BarChart/BarChartTick.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from 'react';\nimport { BarChartLabel } from './BarChartLabel';\n\ntype BarChartTickProps = {\n x: number;\n y: number;\n height: number;\n width: number;\n payload: {\n value: any;\n };\n visibleTicksCount: number;\n details?: JSX.Element;\n};\n\nexport const BarChartTick = ({\n x,\n y,\n height,\n width,\n payload,\n visibleTicksCount,\n details,\n}: BarChartTickProps) => {\n const gutterWidth = 5;\n const labelWidth = width / visibleTicksCount - gutterWidth * 2;\n return (\n <BarChartLabel\n x={x}\n y={y}\n height={height}\n width={labelWidth}\n details={details}\n >\n {!payload.value ? 'Unlabeled' : payload.value}\n </BarChartLabel>\n );\n};\n"],"names":[],"mappings":";;;AA+BO,MAAM,eAAe,CAAC;AAAA,EAC3B,CAAA;AAAA,EACA,CAAA;AAAA,EACA,MAAA;AAAA,EACA,KAAA;AAAA,EACA,OAAA;AAAA,EACA,iBAAA;AAAA,EACA,OAAA;AACF,CAAyB,KAAA;AACvB,EAAA,MAAM,WAAc,GAAA,CAAA,CAAA;AACpB,EAAM,MAAA,UAAA,GAAa,KAAQ,GAAA,iBAAA,GAAoB,WAAc,GAAA,CAAA,CAAA;AAC7D,EACE,uBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,aAAA;AAAA,IAAA;AAAA,MACC,CAAA;AAAA,MACA,CAAA;AAAA,MACA,MAAA;AAAA,MACA,KAAO,EAAA,UAAA;AAAA,MACP,OAAA;AAAA,KAAA;AAAA,IAEC,CAAC,OAAA,CAAQ,KAAQ,GAAA,WAAA,GAAc,OAAQ,CAAA,KAAA;AAAA,GAC1C,CAAA;AAEJ;;;;"}
@@ -0,0 +1,30 @@
1
+ import React from 'react';
2
+ import classnames from 'classnames';
3
+ import Box from '@material-ui/core/Box';
4
+ import Divider from '@material-ui/core/Divider';
5
+ import Typography from '@material-ui/core/Typography';
6
+ import { useTooltipStyles } from '../../utils/styles.esm.js';
7
+
8
+ const BarChartTooltip = (props) => {
9
+ const { title, content, subtitle, topRight, actions, children } = props;
10
+ const classes = useTooltipStyles();
11
+ const titleClassName = classnames(classes.truncate, {
12
+ [classes.maxWidth]: topRight === void 0
13
+ });
14
+ return /* @__PURE__ */ React.createElement(Box, { className: classes.tooltip, display: "flex", flexDirection: "column" }, /* @__PURE__ */ React.createElement(
15
+ Box,
16
+ {
17
+ display: "flex",
18
+ flexDirection: "row",
19
+ justifyContent: "space-between",
20
+ alignItems: "baseline",
21
+ px: 2,
22
+ pt: 2
23
+ },
24
+ /* @__PURE__ */ React.createElement(Box, { display: "flex", flexDirection: "column" }, /* @__PURE__ */ React.createElement(Typography, { className: titleClassName, variant: "h6" }, title), subtitle && /* @__PURE__ */ React.createElement(Typography, { className: classes.subtitle, variant: "subtitle1" }, subtitle)),
25
+ topRight && /* @__PURE__ */ React.createElement(Box, { ml: 2 }, topRight)
26
+ ), content && /* @__PURE__ */ React.createElement(Box, { px: 2, pt: 2, className: classes.maxWidth }, /* @__PURE__ */ React.createElement(Typography, { variant: "body1", paragraph: true }, content)), /* @__PURE__ */ React.createElement(Box, { display: "flex", flexDirection: "column", p: 2 }, children), actions && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Divider, { className: classes.divider, variant: "fullWidth" }), /* @__PURE__ */ React.createElement(Box, { display: "flex", flexDirection: "column", p: 2 }, actions)));
27
+ };
28
+
29
+ export { BarChartTooltip };
30
+ //# sourceMappingURL=BarChartTooltip.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BarChartTooltip.esm.js","sources":["../../../src/components/BarChart/BarChartTooltip.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { ReactNode, PropsWithChildren } from 'react';\nimport classnames from 'classnames';\nimport Box from '@material-ui/core/Box';\nimport Divider from '@material-ui/core/Divider';\nimport Typography from '@material-ui/core/Typography';\nimport { useTooltipStyles as useStyles } from '../../utils/styles';\n\n/** @public */\nexport type BarChartTooltipProps = {\n title: string;\n content?: ReactNode | string;\n subtitle?: ReactNode;\n topRight?: ReactNode;\n actions?: ReactNode;\n};\n\n/** @public */\nexport const BarChartTooltip = (\n props: PropsWithChildren<BarChartTooltipProps>,\n) => {\n const { title, content, subtitle, topRight, actions, children } = props;\n\n const classes = useStyles();\n const titleClassName = classnames(classes.truncate, {\n [classes.maxWidth]: topRight === undefined,\n });\n\n return (\n <Box className={classes.tooltip} display=\"flex\" flexDirection=\"column\">\n <Box\n display=\"flex\"\n flexDirection=\"row\"\n justifyContent=\"space-between\"\n alignItems=\"baseline\"\n px={2}\n pt={2}\n >\n <Box display=\"flex\" flexDirection=\"column\">\n <Typography className={titleClassName} variant=\"h6\">\n {title}\n </Typography>\n {subtitle && (\n <Typography className={classes.subtitle} variant=\"subtitle1\">\n {subtitle}\n </Typography>\n )}\n </Box>\n {topRight && <Box ml={2}>{topRight}</Box>}\n </Box>\n {content && (\n <Box px={2} pt={2} className={classes.maxWidth}>\n <Typography variant=\"body1\" paragraph>\n {content}\n </Typography>\n </Box>\n )}\n <Box display=\"flex\" flexDirection=\"column\" p={2}>\n {children}\n </Box>\n {actions && (\n <>\n <Divider className={classes.divider} variant=\"fullWidth\" />\n <Box display=\"flex\" flexDirection=\"column\" p={2}>\n {actions}\n </Box>\n </>\n )}\n </Box>\n );\n};\n"],"names":["useStyles"],"mappings":";;;;;;;AAiCa,MAAA,eAAA,GAAkB,CAC7B,KACG,KAAA;AACH,EAAA,MAAM,EAAE,KAAO,EAAA,OAAA,EAAS,UAAU,QAAU,EAAA,OAAA,EAAS,UAAa,GAAA,KAAA,CAAA;AAElE,EAAA,MAAM,UAAUA,gBAAU,EAAA,CAAA;AAC1B,EAAM,MAAA,cAAA,GAAiB,UAAW,CAAA,OAAA,CAAQ,QAAU,EAAA;AAAA,IAClD,CAAC,OAAA,CAAQ,QAAQ,GAAG,QAAa,KAAA,KAAA,CAAA;AAAA,GAClC,CAAA,CAAA;AAED,EACE,uBAAA,KAAA,CAAA,aAAA,CAAC,OAAI,SAAW,EAAA,OAAA,CAAQ,SAAS,OAAQ,EAAA,MAAA,EAAO,eAAc,QAC5D,EAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,GAAA;AAAA,IAAA;AAAA,MACC,OAAQ,EAAA,MAAA;AAAA,MACR,aAAc,EAAA,KAAA;AAAA,MACd,cAAe,EAAA,eA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react';
2
+ import Box from '@material-ui/core/Box';
3
+ import Typography from '@material-ui/core/Typography';
4
+ import LensIcon from '@material-ui/icons/Lens';
5
+ import { useTooltipStyles } from '../../utils/styles.esm.js';
6
+
7
+ const BarChartTooltipItem = (props) => {
8
+ const { item } = props;
9
+ const classes = useTooltipStyles();
10
+ return /* @__PURE__ */ React.createElement(
11
+ Box,
12
+ {
13
+ display: "flex",
14
+ alignItems: "center",
15
+ justifyContent: "space-between",
16
+ minHeight: 25
17
+ },
18
+ /* @__PURE__ */ React.createElement(Box, { display: "flex", alignContent: "center", marginRight: ".5em" }, /* @__PURE__ */ React.createElement(Box, { display: "flex", alignItems: "center", marginRight: ".5em" }, /* @__PURE__ */ React.createElement(LensIcon, { className: classes.lensIcon, style: { fill: item.fill } })), /* @__PURE__ */ React.createElement(Typography, null, item.label)),
19
+ /* @__PURE__ */ React.createElement(Typography, { display: "block" }, item.value)
20
+ );
21
+ };
22
+
23
+ export { BarChartTooltipItem };
24
+ //# sourceMappingURL=BarChartTooltipItem.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BarChartTooltipItem.esm.js","sources":["../../../src/components/BarChart/BarChartTooltipItem.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from 'react';\nimport Box from '@material-ui/core/Box';\nimport Typography from '@material-ui/core/Typography';\nimport LensIcon from '@material-ui/icons/Lens';\nimport { useTooltipStyles as useStyles } from '../../utils/styles';\n\n/** @public */\nexport type TooltipItem = {\n fill: string;\n label?: string;\n value?: string;\n};\n\n/** @public */\nexport type BarChartTooltipItemProps = {\n item: TooltipItem;\n};\n\n/** @public */\nexport const BarChartTooltipItem = (props: BarChartTooltipItemProps) => {\n const { item } = props;\n\n const classes = useStyles();\n\n return (\n <Box\n display=\"flex\"\n alignItems=\"center\"\n justifyContent=\"space-between\"\n minHeight={25}\n >\n <Box display=\"flex\" alignContent=\"center\" marginRight=\".5em\">\n <Box display=\"flex\" alignItems=\"center\" marginRight=\".5em\">\n <LensIcon className={classes.lensIcon} style={{ fill: item.fill }} />\n </Box>\n <Typography>{item.label}</Typography>\n </Box>\n <Typography display=\"block\">{item.value}</Typography>\n </Box>\n );\n};\n"],"names":["useStyles"],"mappings":";;;;;;AAmCa,MAAA,mBAAA,GAAsB,CAAC,KAAoC,KAAA;AACtE,EAAM,MAAA,EAAE,MAAS,GAAA,KAAA,CAAA;AAEjB,EAAA,MAAM,UAAUA,gBAAU,EAAA,CAAA;AAE1B,EACE,uBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,GAAA;AAAA,IAAA;AAAA,MACC,OAAQ,EAAA,MAAA;AAAA,MACR,UAAW,EAAA,QAAA;AAAA,MACX,cAAe,EAAA,eAAA;AAAA,MACf,SAAW,EAAA,EAAA;AAAA,KAAA;AAAA,oBAEV,KAAA,CAAA,aAAA,CAAA,GAAA,EAAA,EAAI,OAAQ,EAAA,MAAA,EAAO,cAAa,QAAS,EAAA,WAAA,EAAY,MACpD,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,GAAI,EAAA,EAAA,OAAA,EAAQ,MAAO,EAAA,UAAA,EAAW,UAAS,WAAY,EAAA,MAAA,EAAA,kBACjD,KAAA,CAAA,aAAA,CAAA,QAAA,EAAA,EAAS,SAAW,EAAA,OAAA,CAAQ,QAAU,EAAA,KAAA,EAAO,EAAE,IAAM,EAAA,IAAA,CAAK,IAAK,EAAA,EAAG,CACrE,CACA,kBAAA,KAAA,CAAA,aAAA,CAAC,UAAY,EAAA,IAAA,EAAA,IAAA,CAAK,KAAM,CAC1B,CAAA;AAAA,oBACC,KAAA,CAAA,aAAA,CAAA,UAAA,EAAA,EAAW,OAAQ,EAAA,OAAA,EAAA,EAAS,KAAK,KAAM,CAAA;AAAA,GAC1C,CAAA;AAEJ;;;;"}
@@ -0,0 +1,44 @@
1
+ import React, { useState, useEffect } from 'react';
2
+ import { useLocation } from 'react-router-dom';
3
+ import useCopyToClipboard from 'react-use/esm/useCopyToClipboard';
4
+ import Tooltip from '@material-ui/core/Tooltip';
5
+ import IconButton from '@material-ui/core/IconButton';
6
+ import AssignmentOutlinedIcon from '@material-ui/icons/AssignmentOutlined';
7
+ import AssignmentTurnedInOutlinedIcon from '@material-ui/icons/AssignmentTurnedInOutlined';
8
+ import SentimentVeryDissatisfiedIcon from '@material-ui/icons/SentimentVeryDissatisfied';
9
+
10
+ const ClipboardMessage = {
11
+ default: "Copy URL to clipboard",
12
+ success: "Copied!",
13
+ error: "Couldn't copy to clipboard"
14
+ };
15
+ const CopyUrlToClipboard = () => {
16
+ const location = useLocation();
17
+ const [state, copyToClipboard] = useCopyToClipboard();
18
+ const [copied, setCopied] = useState(false);
19
+ const origin = window.location.origin;
20
+ const pathname = location.pathname;
21
+ const search = location.search;
22
+ const url = `${origin}${pathname}${search}`;
23
+ useEffect(() => {
24
+ if (state.error) {
25
+ setCopied(false);
26
+ } else if (state.value) {
27
+ setCopied(true);
28
+ setTimeout(setCopied, 1500, false);
29
+ }
30
+ }, [state]);
31
+ let text = ClipboardMessage.default;
32
+ let Icon = AssignmentOutlinedIcon;
33
+ if (state.error) {
34
+ text = ClipboardMessage.error;
35
+ Icon = SentimentVeryDissatisfiedIcon;
36
+ } else if (copied) {
37
+ text = ClipboardMessage.success;
38
+ Icon = AssignmentTurnedInOutlinedIcon;
39
+ }
40
+ return /* @__PURE__ */ React.createElement(Tooltip, { title: text, arrow: true }, /* @__PURE__ */ React.createElement(IconButton, { onClick: () => copyToClipboard(url) }, /* @__PURE__ */ React.createElement(Icon, null)));
41
+ };
42
+
43
+ export { CopyUrlToClipboard };
44
+ //# sourceMappingURL=CopyUrlToClipboard.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CopyUrlToClipboard.esm.js","sources":["../../../src/components/CopyUrlToClipboard/CopyUrlToClipboard.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { useEffect, useState } from 'react';\nimport { useLocation } from 'react-router-dom';\nimport useCopyToClipboard from 'react-use/esm/useCopyToClipboard';\nimport Tooltip from '@material-ui/core/Tooltip';\nimport IconButton from '@material-ui/core/IconButton';\nimport AssignmentOutlinedIcon from '@material-ui/icons/AssignmentOutlined';\nimport AssignmentTurnedInOutlinedIcon from '@material-ui/icons/AssignmentTurnedInOutlined';\nimport SentimentVeryDissatisfiedIcon from '@material-ui/icons/SentimentVeryDissatisfied';\n\nconst ClipboardMessage = {\n default: 'Copy URL to clipboard',\n success: 'Copied!',\n error: \"Couldn't copy to clipboard\",\n};\n\nexport const CopyUrlToClipboard = () => {\n const location = useLocation();\n const [state, copyToClipboard] = useCopyToClipboard();\n const [copied, setCopied] = useState(false);\n\n const origin = window.location.origin;\n const pathname = location.pathname;\n const search = location.search;\n const url = `${origin}${pathname}${search}`;\n\n useEffect(() => {\n if (state.error) {\n setCopied(false);\n } else if (state.value) {\n setCopied(true);\n setTimeout(setCopied, 1500, false);\n }\n }, [state]);\n\n let text = ClipboardMessage.default;\n let Icon = AssignmentOutlinedIcon;\n\n if (state.error) {\n text = ClipboardMessage.error;\n Icon = SentimentVeryDissatisfiedIcon;\n } else if (copied) {\n text = ClipboardMessage.success;\n Icon = AssignmentTurnedInOutlinedIcon;\n }\n\n return (\n <Tooltip title={text} arrow>\n <IconButton onClick={() => copyToClipboard(url)}>\n <Icon />\n </IconButton>\n </Tooltip>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;AAyBA,MAAM,gBAAmB,GAAA;AAAA,EACvB,OAAS,EAAA,uBAAA;AAAA,EACT,OAAS,EAAA,SAAA;AAAA,EACT,KAAO,EAAA,4BAAA;AACT,CAAA,CAAA;AAEO,MAAM,qBAAqB,MAAM;AACtC,EAAA,MAAM,WAAW,WAAY,EAAA,CAAA;AAC7B,EAAA,MAAM,CAAC,KAAA,EAAO,eAAe,CAAA,GAAI,kBAAmB,EAAA,CAAA;AACpD,EAAA,MAAM,CAAC,MAAA,EAAQ,SAAS,CAAA,GAAI,SAAS,KAAK,CAAA,CAAA;AAE1C,EAAM,MAAA,MAAA,GAAS,OAAO,QAAS,CAAA,MAAA,CAAA;AAC/B,EAAA,MAAM,WAAW,QAAS,CAAA,QAAA,CAAA;AAC1B,EAAA,MAAM,SAAS,QAAS,CAAA,MAAA,CAAA;AACxB,EAAA,MAAM,MAAM,CAAG,EAAA,MAAM,CAAG,EAAA,QAAQ,GAAG,MAAM,CAAA,CAAA,CAAA;AAEzC,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,IAAI,MAAM,KAAO,EAAA;AACf,MAAA,SAAA,CAAU,KAAK,CAAA,CAAA;AAAA,KACjB,MAAA,IAAW,MAAM,KAAO,EAAA;AACtB,MAAA,SAAA,CAAU,IAAI,CAAA,CAAA;AACd,MAAW,UAAA,CAAA,SAAA,EAAW,MAAM,KAAK,CAAA,CAAA;AAAA,KACnC;AAAA,GACF,EAAG,CAAC,KAAK,CAAC,CAAA,CAAA;AAEV,EAAA,IAAI,OAAO,gBAAiB,CAAA,OAAA,CAAA;AAC5B,EAAA,IAAI,IAAO,GAAA,sBAAA,CAAA;AAEX,EAAA,IAAI,MAAM,KAAO,EAAA;AACf,IAAA,IAAA,GAAO,gBAAiB,CAAA,KAAA,CAAA;AACxB,IAAO,IAAA,GAAA,6BAAA,CAAA;AAAA,aACE,MAAQ,EAAA;AACjB,IAAA,IAAA,GAAO,gBAAiB,CAAA,OAAA,CAAA;AACxB,IAAO,IAAA,GAAA,8BAAA,CAAA;AAAA,GACT;AAEA,EAAA,2CACG,OAAQ,EAAA,EAAA,KAAA,EAAO,IAAM,EAAA,KAAA,EAAK,wBACxB,KAAA,CAAA,aAAA,CAAA,UAAA,EAAA,EAAW,OAAS,EAAA,MAAM,gBAAgB,GAAG,CAAA,EAAA,kBAC3C,KAAA,CAAA,aAAA,CAAA,IAAA,EAAA,IAAK,CACR,CACF,CAAA,CAAA;AAEJ;;;;"}
@@ -0,0 +1,55 @@
1
+ import React from 'react';
2
+ import classnames from 'classnames';
3
+ import Typography from '@material-ui/core/Typography';
4
+ import '../../types/Alert.esm.js';
5
+ import { GrowthType } from '../../types/ChangeStatistic.esm.js';
6
+ import { CurrencyType } from '../../types/CurrencyType.esm.js';
7
+ import { rateOf } from '../../utils/currency.esm.js';
8
+ import { growthOf } from '../../utils/change.esm.js';
9
+ import { useCostGrowthStyles } from '../../utils/styles.esm.js';
10
+ import { formatCurrency, formatPercent } from '../../utils/formatters.esm.js';
11
+ import { indefiniteArticleOf } from '../../utils/grammar.esm.js';
12
+ import { useConfig } from '../../hooks/useConfig.esm.js';
13
+ import { useCurrency } from '../../hooks/useCurrency.esm.js';
14
+ import '../../hooks/useFilters.esm.js';
15
+ import '../../hooks/useGroups.esm.js';
16
+ import '../../hooks/useLoading.esm.js';
17
+ import '../../hooks/useScroll.esm.js';
18
+ import '../../hooks/useLastCompleteBillingDate.esm.js';
19
+ import { notEmpty } from '../../utils/assert.esm.js';
20
+
21
+ const CostGrowth = (props) => {
22
+ const { change, duration } = props;
23
+ const styles = useCostGrowthStyles();
24
+ const { engineerCost, engineerThreshold } = useConfig();
25
+ const [currency] = useCurrency();
26
+ const amount = Math.abs(change.amount);
27
+ const ratio = Math.abs(change.ratio ?? NaN);
28
+ const rate = rateOf(engineerCost, duration);
29
+ const engineers = amount / rate;
30
+ const converted = amount / (currency.rate ?? rate);
31
+ const growth = notEmpty(change.ratio) ? growthOf({ ratio: change.ratio, amount: engineers }, engineerThreshold) : null;
32
+ const classes = classnames({
33
+ [styles.excess]: growth === GrowthType.Excess,
34
+ [styles.savings]: growth === GrowthType.Savings
35
+ });
36
+ if (engineers < engineerThreshold) {
37
+ return /* @__PURE__ */ React.createElement(Typography, { component: "span", className: classes }, "Negligible");
38
+ }
39
+ if (currency.kind === CurrencyType.USD) {
40
+ if (isNaN(ratio)) {
41
+ return /* @__PURE__ */ React.createElement(Typography, { component: "span", className: classes }, "~", currency.prefix, formatCurrency(converted));
42
+ }
43
+ return /* @__PURE__ */ React.createElement(Typography, { component: "span", className: classes }, formatPercent(ratio), " or ~", currency.prefix, formatCurrency(converted));
44
+ }
45
+ if (amount < 1) {
46
+ return /* @__PURE__ */ React.createElement(Typography, { component: "span", className: classes }, "less than ", indefiniteArticleOf(["a", "an"], currency.unit));
47
+ }
48
+ if (isNaN(ratio)) {
49
+ return /* @__PURE__ */ React.createElement(Typography, { component: "span", className: classes }, "~", formatCurrency(converted, currency.unit));
50
+ }
51
+ return /* @__PURE__ */ React.createElement(Typography, { component: "span", className: classes }, formatPercent(ratio), " or ~", formatCurrency(converted, currency.unit));
52
+ };
53
+
54
+ export { CostGrowth };
55
+ //# sourceMappingURL=CostGrowth.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CostGrowth.esm.js","sources":["../../../src/components/CostGrowth/CostGrowth.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from 'react';\nimport classnames from 'classnames';\nimport Typography from '@material-ui/core/Typography';\nimport { CurrencyType, Duration, GrowthType } from '../../types';\nimport { ChangeStatistic } from '@backstage-community/plugin-cost-insights-common';\nimport { rateOf } from '../../utils/currency';\nimport { growthOf } from '../../utils/change';\nimport { useCostGrowthStyles as useStyles } from '../../utils/styles';\nimport { formatPercent, formatCurrency } from '../../utils/formatters';\nimport { indefiniteArticleOf } from '../../utils/grammar';\nimport { useConfig, useCurrency } from '../../hooks';\nimport { notEmpty } from '../../utils/assert';\n\n/** @public */\nexport type CostGrowthProps = {\n change: ChangeStatistic;\n duration: Duration;\n};\n\n/** @public */\nexport const CostGrowth = (props: CostGrowthProps) => {\n const { change, duration } = props;\n\n const styles = useStyles();\n const { engineerCost, engineerThreshold } = useConfig();\n const [currency] = useCurrency();\n\n // Only display costs in absolute values\n const amount = Math.abs(change.amount);\n const ratio = Math.abs(change.ratio ?? NaN);\n\n const rate = rateOf(engineerCost, duration);\n const engineers = amount / rate;\n const converted = amount / (currency.rate ?? rate);\n\n // If a ratio cannot be calculated, don't format.\n const growth = notEmpty(change.ratio)\n ? growthOf({ ratio: change.ratio, amount: engineers }, engineerThreshold)\n : null;\n // Determine if growth is significant enough to highlight\n const classes = classnames({\n [styles.excess]: growth === GrowthType.Excess,\n [styles.savings]: growth === GrowthType.Savings,\n });\n\n if (engineers < engineerThreshold) {\n return (\n <Typography component=\"span\" className={classes}>\n Negligible\n </Typography>\n );\n }\n\n if (currency.kind === CurrencyType.USD) {\n // Do not display percentage if ratio cannot be calculated\n if (isNaN(ratio)) {\n return (\n <Typography component=\"span\" className={classes}>\n ~{currency.prefix}\n {formatCurrency(converted)}\n </Typography>\n );\n }\n\n return (\n <Typography component=\"span\" className={classes}>\n {formatPercent(ratio)} or ~{currency.prefix}\n {formatCurrency(converted)}\n </Typography>\n );\n }\n\n if (amount < 1) {\n return (\n <Typography component=\"span\" className={classes}>\n less than {indefiniteArticleOf(['a', 'an'], currency.unit)}\n </Typography>\n );\n }\n\n // Do not display percentage if ratio cannot be calculated\n if (isNaN(ratio)) {\n return (\n <Typography component=\"span\" className={classes}>\n ~{formatCurrency(converted, currency.unit)}\n </Typography>\n );\n }\n\n return (\n <Typography component=\"span\" className={classes}>\n {formatPercent(ratio)} or ~{formatCurrency(converted, currency.unit)}\n </Typography>\n );\n};\n"],"names":["useStyles"],"mappings":";;;;;;;;;;;;;;;;;;;;AAoCa,MAAA,UAAA,GAAa,CAAC,KAA2B,KAAA;AACpD,EAAM,MAAA,EAAE,MAAQ,EAAA,QAAA,EAAa,GAAA,KAAA,CAAA;AAE7B,EAAA,MAAM,SAASA,mBAAU,EAAA,CAAA;AACzB,EAAA,MAAM,EAAE,YAAA,EAAc,iBAAkB,EAAA,GAAI,SAAU,EAAA,CAAA;AACtD,EAAM,MAAA,CAAC,QAAQ,CAAA,GAAI,WAAY,EAAA,CAAA;AAG/B,EAAA,MAAM,MAAS,GAAA,IAAA,CAAK,GAAI,CAAA,MAAA,CAAO,MAAM,CAAA,CAAA;AACrC,EAAA,MAAM,KAAQ,GAAA,IAAA,CAAK,GAAI,CAAA,MAAA,CAAO,SAAS,GAAG,CAAA,CAAA;AAE1C,EAAM,MAAA,IAAA,GAAO,MAAO,CAAA,YAAA,EAAc,QAAQ,CAAA,CAAA;AAC1C,EAAA,MAAM,YAAY,MAAS,GAAA,IAAA,CAAA;AAC3B,EAAM,MAAA,SAAA,GAAY,MAAU,IAAA,QAAA,CAAS,IAAQ,IAAA,IAAA,CAAA,CAAA;AAG7C,EAAA,MAAM,MAAS,GAAA,QAAA,CAAS,MAAO,CAAA,KAAK,IAChC,QAAS,CAAA,EAAE,KAAO,EAAA,MAAA,CAAO,KAAO,EAAA,MAAA,EAAQ,SAAU,EAAA,EAAG,iBAAiB,CACtE,GAAA,IAAA,CAAA;AAEJ,EAAA,MAAM,UAAU,UAAW,CAAA;AAAA,IACzB,CAAC,MAAA,CA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EAAA,GAAA,EAC7C,cAAe,CAAA,SAAA,EAAW,QAAS,CAAA,IAAI,CAC3C,CAAA,CAAA;AAAA,GAEJ;AAEA,EAAA,uBACG,KAAA,CAAA,aAAA,CAAA,UAAA,EAAA,EAAW,SAAU,EAAA,MAAA,EAAO,WAAW,OACrC,EAAA,EAAA,aAAA,CAAc,KAAK,CAAA,EAAE,OAAM,EAAA,cAAA,CAAe,SAAW,EAAA,QAAA,CAAS,IAAI,CACrE,CAAA,CAAA;AAEJ;;;;"}
@@ -0,0 +1,31 @@
1
+ import React from 'react';
2
+ import classnames from 'classnames';
3
+ import Typography from '@material-ui/core/Typography';
4
+ import ArrowDropUp from '@material-ui/icons/ArrowDropUp';
5
+ import ArrowDropDown from '@material-ui/icons/ArrowDropDown';
6
+ import { growthOf } from '../../utils/change.esm.js';
7
+ import '../../types/Alert.esm.js';
8
+ import { GrowthType } from '../../types/ChangeStatistic.esm.js';
9
+ import { useCostGrowthStyles } from '../../utils/styles.esm.js';
10
+ import { useConfig } from '../../hooks/useConfig.esm.js';
11
+ import '../../hooks/useCurrency.esm.js';
12
+ import '../../hooks/useFilters.esm.js';
13
+ import '../../hooks/useGroups.esm.js';
14
+ import '../../hooks/useLoading.esm.js';
15
+ import '../../hooks/useScroll.esm.js';
16
+ import '../../hooks/useLastCompleteBillingDate.esm.js';
17
+
18
+ const CostGrowthIndicator = (props) => {
19
+ const { engineerThreshold } = useConfig();
20
+ const { change, formatter, className, ...extraProps } = props;
21
+ const classes = useCostGrowthStyles();
22
+ const growth = growthOf(change, engineerThreshold);
23
+ const classNames = classnames(classes.indicator, className, {
24
+ [classes.excess]: growth === GrowthType.Excess,
25
+ [classes.savings]: growth === GrowthType.Savings
26
+ });
27
+ return /* @__PURE__ */ React.createElement(Typography, { className: classNames, component: "span", ...extraProps }, formatter ? formatter(change, { absolute: true }) : change.ratio, growth === GrowthType.Excess && /* @__PURE__ */ React.createElement(ArrowDropUp, { "aria-label": "excess" }), growth === GrowthType.Savings && /* @__PURE__ */ React.createElement(ArrowDropDown, { "aria-label": "savings" }));
28
+ };
29
+
30
+ export { CostGrowthIndicator };
31
+ //# sourceMappingURL=CostGrowthIndicator.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CostGrowthIndicator.esm.js","sources":["../../../src/components/CostGrowth/CostGrowthIndicator.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from 'react';\nimport classnames from 'classnames';\nimport Typography, { TypographyProps } from '@material-ui/core/Typography';\nimport { default as ArrowDropUp } from '@material-ui/icons/ArrowDropUp';\nimport { default as ArrowDropDown } from '@material-ui/icons/ArrowDropDown';\nimport { growthOf } from '../../utils/change';\nimport { GrowthType } from '../../types';\nimport { useCostGrowthStyles as useStyles } from '../../utils/styles';\nimport {\n ChangeStatistic,\n Maybe,\n} from '@backstage-community/plugin-cost-insights-common';\nimport { useConfig } from '../../hooks';\n\n/** @public */\nexport type CostGrowthIndicatorProps = TypographyProps & {\n change: ChangeStatistic;\n formatter?: (\n change: ChangeStatistic,\n options?: { absolute: boolean },\n ) => Maybe<string>;\n};\n\n/** @public */\nexport const CostGrowthIndicator = (props: CostGrowthIndicatorProps) => {\n const { engineerThreshold } = useConfig();\n const { change, formatter, className, ...extraProps } = props;\n\n const classes = useStyles();\n\n const growth = growthOf(change, engineerThreshold);\n\n const classNames = classnames(classes.indicator, className, {\n [classes.excess]: growth === GrowthType.Excess,\n [classes.savings]: growth === GrowthType.Savings,\n });\n\n return (\n <Typography className={classNames} component=\"span\" {...extraProps}>\n {formatter ? formatter(change, { absolute: true }) : change.ratio}\n {growth === GrowthType.Excess && <ArrowDropUp aria-label=\"excess\" />}\n {growth === GrowthType.Savings && <ArrowDropDown aria-label=\"savings\" />}\n </Typography>\n );\n};\n"],"names":["useStyles"],"mappings":";;;;;;;;;;;;;;;;;AAwCa,MAAA,mBAAA,GAAsB,CAAC,KAAoC,KAAA;AACtE,EAAM,MAAA,EAAE,iBAAkB,EAAA,GAAI,SAAU,EAAA,CAAA;AACxC,EAAA,MAAM,EAAE,MAAQ,EAAA,SAAA,EAAW,SAAW,EAAA,GAAG,YAAe,GAAA,KAAA,CAAA;AAExD,EAAA,MAAM,UAAUA,mBAAU,EAAA,CAAA;AAE1B,EAAM,MAAA,MAAA,GAAS,QAAS,CAAA,MAAA,EAAQ,iBAAiB,CAAA,CAAA;AAEjD,EAAA,MAAM,UAAa,GAAA,UAAA,CAAW,OAAQ,CAAA,SAAA,EAAW,SAAW,EAAA;AAAA,IAC1D,CAAC,OAAA,CAAQ,MAAM,GAAG,WAAW,UAAW,CAAA,MAAA;AAAA,IACxC,CAAC,OAAA,CAAQ,OAAO,GAAG,WAAW,UAAW,CAAA,OAAA;AAAA,GAC1C,CAAA,CAAA;AAED,EAAA,uBACG,KAAA,CAAA,aAAA,CAAA,UAAA,EAAA,EAAW,SAAW,EAAA,UAAA,EAAY,WAAU,MAAQ,EAAA,GAAG,UACrD,EAAA,EAAA,SAAA,GAAY,SAAU,CAAA,MAAA,EAAQ,EAAE,QAAA,EAAU,MAAM,CAAA,GAAI,MAAO,CAAA,KAAA,EAC3D,MAAW,KAAA,UAAA,CAAW,MAAU,oBAAA,KAAA,CAAA,aAAA,CAAC,eAAY,YAAW,EAAA,QAAA,EAAS,CACjE,EAAA,MAAA,KAAW,WAAW,OAAW,oBAAA,KAAA,CAAA,aAAA,CAAC,aAAc,EAAA,EAAA,YAAA,EAAW,WAAU,CACxE,CAAA,CAAA;AAEJ;;;;"}
@@ -0,0 +1,57 @@
1
+ import React from 'react';
2
+ import Typography from '@material-ui/core/Typography';
3
+ import useAsync from 'react-use/esm/useAsync';
4
+ import { useCostInsightsStyles } from '../../utils/styles.esm.js';
5
+ import { useApi, identityApiRef } from '@backstage/core-plugin-api';
6
+
7
+ function useDisplayName() {
8
+ const identityApi = useApi(identityApiRef);
9
+ const state = useAsync(() => identityApi.getProfileInfo(), [identityApi]);
10
+ return state.loading ? "" : state.value?.displayName || "Mysterious Stranger";
11
+ }
12
+ const CostInsightsHeaderNoData = ({
13
+ groupId,
14
+ groups
15
+ }) => {
16
+ const displayName = useDisplayName();
17
+ const classes = useCostInsightsStyles();
18
+ const hasMultipleGroups = groups.length > 1;
19
+ const ownerName = groups.find(({ id }) => id === groupId)?.name ?? groupId;
20
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Typography, { variant: "h4", align: "center", gutterBottom: true }, /* @__PURE__ */ React.createElement(Typography, { component: "span", role: "img", "aria-label": "flushed-face" }, "\u{1F633}"), " ", "Well this is awkward"), /* @__PURE__ */ React.createElement(Typography, { className: classes.h6Subtle, align: "center", gutterBottom: true }, /* @__PURE__ */ React.createElement("b", null, "Hey, ", displayName, "!"), " ", /* @__PURE__ */ React.createElement("b", null, ownerName), " doesn't seem to have any cloud costs."), hasMultipleGroups && /* @__PURE__ */ React.createElement(Typography, { align: "center", gutterBottom: true }, "Maybe we picked the wrong team, choose another from the menu above?"));
21
+ };
22
+ const CostInsightsHeaderAlerts = ({
23
+ groupId,
24
+ groups,
25
+ alerts
26
+ }) => {
27
+ const displayName = useDisplayName();
28
+ const classes = useCostInsightsStyles();
29
+ const ownerName = groups.find(({ id }) => id === groupId)?.name ?? groupId;
30
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Typography, { variant: "h4", align: "center", gutterBottom: true }, /* @__PURE__ */ React.createElement(Typography, { component: "span", role: "img", "aria-label": "magnifying-glass" }, "\u{1F50E}"), " ", "You have ", alerts, " thing", alerts > 1 && "s", " to look into"), /* @__PURE__ */ React.createElement(Typography, { className: classes.h6Subtle, align: "center", gutterBottom: true }, /* @__PURE__ */ React.createElement("b", null, "Hey, ", displayName, "!"), " We've identified", " ", alerts > 1 ? "a few things " : "one thing ", /* @__PURE__ */ React.createElement("b", null, ownerName), " should look into next."));
31
+ };
32
+ const CostInsightsHeaderNoAlerts = ({
33
+ groupId,
34
+ groups
35
+ }) => {
36
+ const displayName = useDisplayName();
37
+ const classes = useCostInsightsStyles();
38
+ const ownerName = groups.find(({ id }) => id === groupId)?.name ?? groupId;
39
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Typography, { variant: "h4", gutterBottom: true, align: "center" }, /* @__PURE__ */ React.createElement(Typography, { component: "span", role: "img", "aria-label": "thumbs-up" }, "\u{1F44D}"), " ", "Your team is doing great"), /* @__PURE__ */ React.createElement(Typography, { className: classes.h6Subtle, align: "center", gutterBottom: true }, /* @__PURE__ */ React.createElement("b", null, "Hey, ", displayName, "!"), " ", /* @__PURE__ */ React.createElement("b", null, ownerName), " is doing well. No major changes this month."));
40
+ };
41
+ const CostInsightsHeaderNoGroups = () => {
42
+ const displayName = useDisplayName();
43
+ const classes = useCostInsightsStyles();
44
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Typography, { variant: "h4", align: "center", gutterBottom: true }, /* @__PURE__ */ React.createElement(Typography, { component: "span", role: "img", "aria-label": "flushed-face" }, "\u{1F633}"), " ", "Well this is awkward"), /* @__PURE__ */ React.createElement(Typography, { className: classes.h6Subtle, align: "center", gutterBottom: true }, /* @__PURE__ */ React.createElement("b", null, "Hey, ", displayName, "!"), " It doesn't look like you belong to any teams."));
45
+ };
46
+ const CostInsightsHeader = (props) => {
47
+ if (!props.hasCostData) {
48
+ return /* @__PURE__ */ React.createElement(CostInsightsHeaderNoData, { ...props });
49
+ }
50
+ if (props.alerts) {
51
+ return /* @__PURE__ */ React.createElement(CostInsightsHeaderAlerts, { ...props });
52
+ }
53
+ return /* @__PURE__ */ React.createElement(CostInsightsHeaderNoAlerts, { ...props });
54
+ };
55
+
56
+ export { CostInsightsHeader, CostInsightsHeaderNoGroups };
57
+ //# sourceMappingURL=CostInsightsHeader.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CostInsightsHeader.esm.js","sources":["../../../src/components/CostInsightsHeader/CostInsightsHeader.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from 'react';\nimport Typography from '@material-ui/core/Typography';\nimport useAsync from 'react-use/esm/useAsync';\nimport { useCostInsightsStyles } from '../../utils/styles';\nimport { Group } from '@backstage-community/plugin-cost-insights-common';\nimport { identityApiRef, useApi } from '@backstage/core-plugin-api';\n\nfunction useDisplayName(): string {\n const identityApi = useApi(identityApiRef);\n const state = useAsync(() => identityApi.getProfileInfo(), [identityApi]);\n return state.loading ? '' : state.value?.displayName || 'Mysterious Stranger';\n}\n\ntype CostInsightsHeaderProps = {\n groupId: string;\n groups: Group[];\n hasCostData: boolean;\n alerts: number;\n};\n\nconst CostInsightsHeaderNoData = ({\n groupId,\n groups,\n}: CostInsightsHeaderProps) => {\n const displayName = useDisplayName();\n const classes = useCostInsightsStyles();\n const hasMultipleGroups = groups.length > 1;\n const ownerName = groups.find(({ id }) => id === groupId)?.name ?? groupId;\n\n return (\n <>\n <Typography variant=\"h4\" align=\"center\" gutterBottom>\n <Typography component=\"span\" role=\"img\" aria-label=\"flushed-face\">\n 😳\n </Typography>{' '}\n Well this is awkward\n </Typography>\n <Typography className={classes.h6Subtle} align=\"center\" gutterBottom>\n <b>Hey, {displayName}!</b> <b>{ownerName}</b> doesn't seem to have any\n cloud costs.\n </Typography>\n {hasMultipleGroups && (\n <Typography align=\"center\" gutterBottom>\n Maybe we picked the wrong team, choose another from the menu above?\n </Typography>\n )}\n </>\n );\n};\n\nconst CostInsightsHeaderAlerts = ({\n groupId,\n groups,\n alerts,\n}: CostInsightsHeaderProps) => {\n const displayName = useDisplayName();\n const classes = useCostInsightsStyles();\n const ownerName = groups.find(({ id }) => id === groupId)?.name ?? groupId;\n\n return (\n <>\n <Typography variant=\"h4\" align=\"center\" gutterBottom>\n <Typography component=\"span\" role=\"img\" aria-label=\"magnifying-glass\">\n 🔎\n </Typography>{' '}\n You have {alerts} thing{alerts > 1 && 's'} to look into\n </Typography>\n <Typography className={classes.h6Subtle} align=\"center\" gutterBottom>\n <b>Hey, {displayName}!</b> We've identified{' '}\n {alerts > 1 ? 'a few things ' : 'one thing '}\n <b>{ownerName}</b> should look into next.\n </Typography>\n </>\n );\n};\n\nconst CostInsightsHeaderNoAlerts = ({\n groupId,\n groups,\n}: CostInsightsHeaderProps) => {\n const displayName = useDisplayName();\n const classes = useCostInsightsStyles();\n const ownerName = groups.find(({ id }) => id === groupId)?.name ?? groupId;\n\n return (\n <>\n <Typography variant=\"h4\" gutterBottom align=\"center\">\n <Typography component=\"span\" role=\"img\" aria-label=\"thumbs-up\">\n 👍\n </Typography>{' '}\n Your team is doing great\n </Typography>\n <Typography className={classes.h6Subtle} align=\"center\" gutterBottom>\n <b>Hey, {displayName}!</b> <b>{ownerName}</b> is doing well. No major\n changes this month.\n </Typography>\n </>\n );\n};\n\nexport const CostInsightsHeaderNoGroups = () => {\n const displayName = useDisplayName();\n const classes = useCostInsightsStyles();\n return (\n <>\n <Typography variant=\"h4\" align=\"center\" gutterBottom>\n <Typography component=\"span\" role=\"img\" aria-label=\"flushed-face\">\n 😳\n </Typography>{' '}\n Well this is awkward\n </Typography>\n <Typography className={classes.h6Subtle} align=\"center\" gutterBottom>\n <b>Hey, {displayName}!</b> It doesn't look like you belong to any teams.\n </Typography>\n </>\n );\n};\n\nexport const CostInsightsHeader = (props: CostInsightsHeaderProps) => {\n if (!props.hasCostData) {\n return <CostInsightsHeaderNoData {...props} />;\n }\n if (props.alerts) {\n return <CostInsightsHeaderAlerts {...props} />;\n }\n return <CostInsightsHeaderNoAlerts {...props} />;\n};\n"],"names":[],"mappings":";;;;;;AAuBA,SAAS,cAAyB,GAAA;AAChC,EAAM,MAAA,WAAA,GAAc,OAAO,cAAc,CAAA,CAAA;AACzC,EAAM,MAAA,KAAA,GAAQ,SAAS,MAAM,WAAA,CAAY,gBAAkB,EAAA,CAAC,WAAW,CAAC,CAAA,CAAA;AACxE,EAAA,OAAO,KAAM,CAAA,OAAA,GAAU,EAAK,GAAA,KAAA,CAAM,OAAO,WAAe,IAAA,qBAAA,CAAA;AAC1D,CAAA;AASA,MAAM,2BAA2B,CAAC;AAAA,EAChC,OAAA;AAAA,EACA,MAAA;AACF,CAA+B,KAAA;AAC7B,EAAA,MAAM,cAAc,cAAe,EAAA,CAAA;AACnC,EAAA,MAAM,UAAU,qBAAsB,EAAA,CAAA;AACtC,EAAM,MAAA,iBAAA,GAAoB,OAAO,MAAS,GAAA,CAAA,CAAA;AAC1C,EAAM,MAAA,SAAA,GAAY,MAAO,CAAA,IAAA,CAAK,CAAC,EAAE,IAAS,KAAA,EAAA,KAAO,OAAO,CAAA,EAAG,IAAQ,IAAA,OAAA,CAAA;AAEnE,EACE,uBAAA,KAAA,CAAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA,kBACG,KAAA,CAAA,aAAA,CAAA,UAAA,EAAA,EAAW,OAAQ,EAAA,IAAA,EAAK,OAAM,QAAS,EAAA,YAAA,EAAY,IAClD,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,UAAW,EAAA,EAAA,SAAA,EAAU,QAAO,IAAK,EAAA,KAAA,EAAM,YAAW,EAAA,cAAA,EAAA,EAAe,WAElE,CAAA,EAAc,K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CAAA;AAEJ,CAAA,CAAA;AAEO,MAAM,6BAA6B,MAAM;AAC9C,EAAA,MAAM,cAAc,cAAe,EAAA,CAAA;AACnC,EAAA,MAAM,UAAU,qBAAsB,EAAA,CAAA;AACtC,EAAA,iFAEK,KAAA,CAAA,aAAA,CAAA,UAAA,EAAA,EAAW,OAAQ,EAAA,IAAA,EAAK,OAAM,QAAS,EAAA,YAAA,EAAY,IAClD,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,cAAW,SAAU,EAAA,MAAA,EAAO,MAAK,KAAM,EAAA,YAAA,EAAW,kBAAe,WAElE,CAAA,EAAc,GAAI,EAAA,sBAEpB,mBACC,KAAA,CAAA,aAAA,CAAA,UAAA,EAAA,EAAW,SAAW,EAAA,OAAA,CAAQ,UAAU,KAAM,EAAA,QAAA,EAAS,YAAY,EAAA,IAAA,EAAA,sCACjE,GAAE,EAAA,IAAA,EAAA,OAAA,EAAM,aAAY,GAAC,CAAA,EAAI,gDAC5B,CACF,CAAA,CAAA;AAEJ,EAAA;AAEa,MAAA,kBAAA,GAAqB,CAAC,KAAmC,KAAA;AACpE,EAAI,IAAA,CAAC,MAAM,WAAa,EAAA;AACtB,IAAO,uBAAA,KAAA,CAAA,aAAA,CAAC,wBAA0B,EAAA,EAAA,GAAG,KAAO,EAAA,CAAA,CAAA;AAAA,GAC9C;AACA,EAAA,IAAI,MAAM,MAAQ,EAAA;AAChB,IAAO,uBAAA,KAAA,CAAA,aAAA,CAAC,wBAA0B,EAAA,EAAA,GAAG,KAAO,EAAA,CAAA,CAAA;AAAA,GAC9C;AACA,EAAO,uBAAA,KAAA,CAAA,aAAA,CAAC,0BAA4B,EAAA,EAAA,GAAG,KAAO,EAAA,CAAA,CAAA;AAChD;;;;"}
@@ -0,0 +1,35 @@
1
+ import React from 'react';
2
+ import { makeStyles } from '@material-ui/core/styles';
3
+ import { CostInsightsTabs } from '../CostInsightsTabs/CostInsightsTabs.esm.js';
4
+ import { Page, Header } from '@backstage/core-components';
5
+
6
+ const useStyles = makeStyles((theme) => ({
7
+ root: {
8
+ gridArea: "pageContent"
9
+ },
10
+ header: {
11
+ boxShadow: "none"
12
+ },
13
+ content: {
14
+ padding: theme.spacing(4)
15
+ }
16
+ }));
17
+ const CostInsightsLayout = ({
18
+ title = "Cost Insights",
19
+ groups,
20
+ children
21
+ }) => {
22
+ const classes = useStyles();
23
+ return /* @__PURE__ */ React.createElement(Page, { themeId: "tool" }, /* @__PURE__ */ React.createElement(
24
+ Header,
25
+ {
26
+ style: { boxShadow: "none" },
27
+ title: "Cost Insights",
28
+ pageTitleOverride: title,
29
+ type: "Tool"
30
+ }
31
+ ), /* @__PURE__ */ React.createElement("div", { className: classes.root }, /* @__PURE__ */ React.createElement(CostInsightsTabs, { groups }), /* @__PURE__ */ React.createElement("div", { className: classes.content }, children)));
32
+ };
33
+
34
+ export { CostInsightsLayout };
35
+ //# sourceMappingURL=CostInsightsLayout.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CostInsightsLayout.esm.js","sources":["../../../src/components/CostInsightsLayout/CostInsightsLayout.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { PropsWithChildren } from 'react';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { Group } from '@backstage-community/plugin-cost-insights-common';\nimport { CostInsightsTabs } from '../CostInsightsTabs';\nimport { Header, Page } from '@backstage/core-components';\n\nconst useStyles = makeStyles(theme => ({\n root: {\n gridArea: 'pageContent',\n },\n header: {\n boxShadow: 'none',\n },\n content: {\n padding: theme.spacing(4),\n },\n}));\n\ntype CostInsightsLayoutProps = {\n title?: string;\n groups: Group[];\n};\n\nexport const CostInsightsLayout = ({\n title = 'Cost Insights',\n groups,\n children,\n}: PropsWithChildren<CostInsightsLayoutProps>) => {\n const classes = useStyles();\n return (\n <Page themeId=\"tool\">\n <Header\n style={{ boxShadow: 'none' }}\n title=\"Cost Insights\"\n pageTitleOverride={title}\n type=\"Tool\"\n />\n <div className={classes.root}>\n <CostInsightsTabs groups={groups} />\n <div className={classes.content}>{children}</div>\n </div>\n </Page>\n );\n};\n"],"names":[],"mappings":";;;;;AAqBA,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,IAAM,EAAA;AAAA,IACJ,QAAU,EAAA,aAAA;AAAA,GACZ;AAAA,EACA,MAAQ,EAAA;AAAA,IACN,SAAW,EAAA,MAAA;AAAA,GACb;AAAA,EACA,OAAS,EAAA;AAAA,IACP,OAAA,EAAS,KAAM,CAAA,OAAA,CAAQ,CAAC,CAAA;AAAA,GAC1B;AACF,CAAE,CAAA,CAAA,CAAA;AAOK,MAAM,qBAAqB,CAAC;AAAA,EACjC,KAAQ,GAAA,eAAA;AAAA,EACR,MAAA;AAAA,EACA,QAAA;AACF,CAAkD,KAAA;AAChD,EAAA,MAAM,UAAU,SAAU,EAAA,CAAA;AAC1B,EACE,uBAAA,KAAA,CAAA,aAAA,CAAC,IAAK,EAAA,EAAA,OAAA,EAAQ,MACZ,EAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,MAAA;AAAA,IAAA;AAAA,MACC,KAAA,EAAO,EAAE,SAAA,EAAW,MAAO,EAAA;AAAA,MAC3B,KAAM,EAAA,eAAA;AAAA,MACN,iBAAmB,EAAA,KAAA;AAAA,MACnB,IAAK,EAAA,MAAA;AAAA,KAAA;AAAA,qBAEN,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAI,SAAW,EAAA,OAAA,CAAQ,wBACrB,KAAA,CAAA,aAAA,CAAA,gBAAA,EAAA,EAAiB,MAAgB,EAAA,CAAA,sCACjC,KAAI,EAAA,EAAA,SAAA,EAAW,QAAQ,OAAU,EAAA,EAAA,QAAS,CAC7C,CACF,CAAA,CAAA;AAEJ;;;;"}