@backstage-community/plugin-cost-insights 0.15.2 → 0.17.0

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 (159) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/alerts/ProjectGrowthAlert.esm.js +2 -2
  3. package/dist/alerts/ProjectGrowthAlert.esm.js.map +1 -1
  4. package/dist/alerts/UnlabeledDataflowAlert.esm.js +2 -2
  5. package/dist/alerts/UnlabeledDataflowAlert.esm.js.map +1 -1
  6. package/dist/alpha/plugin.esm.js +55 -0
  7. package/dist/alpha/plugin.esm.js.map +1 -0
  8. package/dist/alpha.d.ts +85 -0
  9. package/dist/alpha.esm.js +23 -0
  10. package/dist/alpha.esm.js.map +1 -0
  11. package/dist/components/ActionItems/ActionItemCard.esm.js +3 -3
  12. package/dist/components/ActionItems/ActionItemCard.esm.js.map +1 -1
  13. package/dist/components/ActionItems/ActionItems.esm.js +52 -41
  14. package/dist/components/ActionItems/ActionItems.esm.js.map +1 -1
  15. package/dist/components/AlertInsights/AlertDialog.esm.js +79 -58
  16. package/dist/components/AlertInsights/AlertDialog.esm.js.map +1 -1
  17. package/dist/components/AlertInsights/AlertInsights.esm.js +57 -44
  18. package/dist/components/AlertInsights/AlertInsights.esm.js.map +1 -1
  19. package/dist/components/AlertInsights/AlertInsightsHeader.esm.js +10 -2
  20. package/dist/components/AlertInsights/AlertInsightsHeader.esm.js.map +1 -1
  21. package/dist/components/AlertInsights/AlertInsightsSection.esm.js +42 -34
  22. package/dist/components/AlertInsights/AlertInsightsSection.esm.js.map +1 -1
  23. package/dist/components/AlertInsights/AlertInsightsSectionHeader.esm.js +23 -12
  24. package/dist/components/AlertInsights/AlertInsightsSectionHeader.esm.js.map +1 -1
  25. package/dist/components/AlertInsights/AlertStatusSummary.esm.js +63 -55
  26. package/dist/components/AlertInsights/AlertStatusSummary.esm.js.map +1 -1
  27. package/dist/components/AlertInsights/AlertStatusSummaryButton.esm.js +7 -6
  28. package/dist/components/AlertInsights/AlertStatusSummaryButton.esm.js.map +1 -1
  29. package/dist/components/AlertInstructionsLayout/AlertInstructionsLayout.esm.js +23 -17
  30. package/dist/components/AlertInstructionsLayout/AlertInstructionsLayout.esm.js.map +1 -1
  31. package/dist/components/BarChart/BarChart.esm.js +83 -78
  32. package/dist/components/BarChart/BarChart.esm.js.map +1 -1
  33. package/dist/components/BarChart/BarChartLabel.esm.js +8 -5
  34. package/dist/components/BarChart/BarChartLabel.esm.js.map +1 -1
  35. package/dist/components/BarChart/BarChartLegend.esm.js +20 -16
  36. package/dist/components/BarChart/BarChartLegend.esm.js.map +1 -1
  37. package/dist/components/BarChart/BarChartStepper.esm.js +51 -48
  38. package/dist/components/BarChart/BarChartStepper.esm.js.map +1 -1
  39. package/dist/components/BarChart/BarChartStepperButton.esm.js +6 -5
  40. package/dist/components/BarChart/BarChartStepperButton.esm.js.map +1 -1
  41. package/dist/components/BarChart/BarChartSteps.esm.js +3 -3
  42. package/dist/components/BarChart/BarChartSteps.esm.js.map +1 -1
  43. package/dist/components/BarChart/BarChartTick.esm.js +5 -5
  44. package/dist/components/BarChart/BarChartTick.esm.js.map +1 -1
  45. package/dist/components/BarChart/BarChartTooltip.esm.js +27 -14
  46. package/dist/components/BarChart/BarChartTooltip.esm.js.map +1 -1
  47. package/dist/components/BarChart/BarChartTooltipItem.esm.js +11 -6
  48. package/dist/components/BarChart/BarChartTooltipItem.esm.js.map +1 -1
  49. package/dist/components/CopyUrlToClipboard/CopyUrlToClipboard.esm.js +3 -2
  50. package/dist/components/CopyUrlToClipboard/CopyUrlToClipboard.esm.js.map +1 -1
  51. package/dist/components/CostGrowth/CostGrowth.esm.js +26 -7
  52. package/dist/components/CostGrowth/CostGrowth.esm.js.map +1 -1
  53. package/dist/components/CostGrowth/CostGrowthIndicator.esm.js +6 -2
  54. package/dist/components/CostGrowth/CostGrowthIndicator.esm.js.map +1 -1
  55. package/dist/components/CostInsightsHeader/CostInsightsHeader.esm.js +77 -8
  56. package/dist/components/CostInsightsHeader/CostInsightsHeader.esm.js.map +1 -1
  57. package/dist/components/CostInsightsLayout/CostInsightsLayout.esm.js +16 -10
  58. package/dist/components/CostInsightsLayout/CostInsightsLayout.esm.js.map +1 -1
  59. package/dist/components/CostInsightsNavigation/CostInsightsNavigation.esm.js +41 -35
  60. package/dist/components/CostInsightsNavigation/CostInsightsNavigation.esm.js.map +1 -1
  61. package/dist/components/CostInsightsPage/CostInsightsPage.esm.js +116 -79
  62. package/dist/components/CostInsightsPage/CostInsightsPage.esm.js.map +1 -1
  63. package/dist/components/CostInsightsPage/CostInsightsPageRoot.esm.js +2 -2
  64. package/dist/components/CostInsightsPage/CostInsightsPageRoot.esm.js.map +1 -1
  65. package/dist/components/CostInsightsPage/CostInsightsThemeProvider.esm.js +5 -5
  66. package/dist/components/CostInsightsPage/CostInsightsThemeProvider.esm.js.map +1 -1
  67. package/dist/components/CostInsightsTabs/CostInsightsTabs.esm.js +58 -51
  68. package/dist/components/CostInsightsTabs/CostInsightsTabs.esm.js.map +1 -1
  69. package/dist/components/CostOverviewCard/CostOverviewBreakdownChart.esm.js +74 -59
  70. package/dist/components/CostOverviewCard/CostOverviewBreakdownChart.esm.js.map +1 -1
  71. package/dist/components/CostOverviewCard/CostOverviewCard.esm.js +45 -35
  72. package/dist/components/CostOverviewCard/CostOverviewCard.esm.js.map +1 -1
  73. package/dist/components/CostOverviewCard/CostOverviewChart.esm.js +86 -73
  74. package/dist/components/CostOverviewCard/CostOverviewChart.esm.js.map +1 -1
  75. package/dist/components/CostOverviewCard/CostOverviewHeader.esm.js +11 -6
  76. package/dist/components/CostOverviewCard/CostOverviewHeader.esm.js.map +1 -1
  77. package/dist/components/CostOverviewCard/CostOverviewLegend.esm.js +21 -15
  78. package/dist/components/CostOverviewCard/CostOverviewLegend.esm.js.map +1 -1
  79. package/dist/components/CurrencySelect/CurrencySelect.esm.js +24 -21
  80. package/dist/components/CurrencySelect/CurrencySelect.esm.js.map +1 -1
  81. package/dist/components/EntityCosts/EntityCosts.esm.js +8 -7
  82. package/dist/components/EntityCosts/EntityCosts.esm.js.map +1 -1
  83. package/dist/components/LabelDataflowInstructionsPage/LabelDataflowInstructionsPage.esm.js +65 -20
  84. package/dist/components/LabelDataflowInstructionsPage/LabelDataflowInstructionsPage.esm.js.map +1 -1
  85. package/dist/components/LegendItem/LegendItem.esm.js +34 -29
  86. package/dist/components/LegendItem/LegendItem.esm.js.map +1 -1
  87. package/dist/components/MetricSelect/MetricSelect.esm.js +19 -14
  88. package/dist/components/MetricSelect/MetricSelect.esm.js.map +1 -1
  89. package/dist/components/PeriodSelect/PeriodSelect.esm.js +15 -15
  90. package/dist/components/PeriodSelect/PeriodSelect.esm.js.map +1 -1
  91. package/dist/components/ProductInsights/ProductInsights.esm.js +12 -8
  92. package/dist/components/ProductInsights/ProductInsights.esm.js.map +1 -1
  93. package/dist/components/ProductInsightsCard/ProductEntityDialog.esm.js +20 -15
  94. package/dist/components/ProductInsightsCard/ProductEntityDialog.esm.js.map +1 -1
  95. package/dist/components/ProductInsightsCard/ProductEntityTable.esm.js +9 -9
  96. package/dist/components/ProductInsightsCard/ProductEntityTable.esm.js.map +1 -1
  97. package/dist/components/ProductInsightsCard/ProductInsightsCard.esm.js +25 -15
  98. package/dist/components/ProductInsightsCard/ProductInsightsCard.esm.js.map +1 -1
  99. package/dist/components/ProductInsightsCard/ProductInsightsCardList.esm.js +14 -14
  100. package/dist/components/ProductInsightsCard/ProductInsightsCardList.esm.js.map +1 -1
  101. package/dist/components/ProductInsightsCard/ProductInsightsChart.esm.js +43 -35
  102. package/dist/components/ProductInsightsCard/ProductInsightsChart.esm.js.map +1 -1
  103. package/dist/components/ProjectGrowthAlertCard/ProjectGrowthAlertCard.esm.js +5 -5
  104. package/dist/components/ProjectGrowthAlertCard/ProjectGrowthAlertCard.esm.js.map +1 -1
  105. package/dist/components/ProjectGrowthAlertCard/ProjectGrowthAlertChart.esm.js +5 -2
  106. package/dist/components/ProjectGrowthAlertCard/ProjectGrowthAlertChart.esm.js.map +1 -1
  107. package/dist/components/ProjectGrowthInstructionsPage/ProjectGrowthInstructionsPage.esm.js +55 -9
  108. package/dist/components/ProjectGrowthInstructionsPage/ProjectGrowthInstructionsPage.esm.js.map +1 -1
  109. package/dist/components/ProjectSelect/ProjectSelect.esm.js +15 -15
  110. package/dist/components/ProjectSelect/ProjectSelect.esm.js.map +1 -1
  111. package/dist/components/UnlabeledDataflowAlertCard/UnlabeledDataflowAlertCard.esm.js +12 -9
  112. package/dist/components/UnlabeledDataflowAlertCard/UnlabeledDataflowAlertCard.esm.js.map +1 -1
  113. package/dist/components/WhyCostsMatter/WhyCostsMatter.esm.js +40 -10
  114. package/dist/components/WhyCostsMatter/WhyCostsMatter.esm.js.map +1 -1
  115. package/dist/example/alerts/KubernetesMigrationAlert.esm.js +10 -3
  116. package/dist/example/alerts/KubernetesMigrationAlert.esm.js.map +1 -1
  117. package/dist/example/client.esm.js +1 -1
  118. package/dist/example/components/KubernetesMigrationAlertCard/KubernetesMigrationAlertCard.esm.js +20 -17
  119. package/dist/example/components/KubernetesMigrationAlertCard/KubernetesMigrationAlertCard.esm.js.map +1 -1
  120. package/dist/example/components/KubernetesMigrationAlertCard/KubernetesMigrationBarChart.esm.js +3 -2
  121. package/dist/example/components/KubernetesMigrationAlertCard/KubernetesMigrationBarChart.esm.js.map +1 -1
  122. package/dist/example/components/KubernetesMigrationAlertCard/KubernetesMigrationBarChartLegend.esm.js +14 -9
  123. package/dist/example/components/KubernetesMigrationAlertCard/KubernetesMigrationBarChartLegend.esm.js.map +1 -1
  124. package/dist/example/forms/KubernetesMigrationDismissForm.esm.js +21 -17
  125. package/dist/example/forms/KubernetesMigrationDismissForm.esm.js.map +1 -1
  126. package/dist/forms/AlertAcceptForm.esm.js +5 -4
  127. package/dist/forms/AlertAcceptForm.esm.js.map +1 -1
  128. package/dist/forms/AlertDismissForm.esm.js +47 -38
  129. package/dist/forms/AlertDismissForm.esm.js.map +1 -1
  130. package/dist/forms/AlertSnoozeForm.esm.js +20 -16
  131. package/dist/forms/AlertSnoozeForm.esm.js.map +1 -1
  132. package/dist/hooks/useConfig.esm.js +3 -2
  133. package/dist/hooks/useConfig.esm.js.map +1 -1
  134. package/dist/hooks/useCurrency.esm.js +6 -3
  135. package/dist/hooks/useCurrency.esm.js.map +1 -1
  136. package/dist/hooks/useFilters.esm.js +10 -7
  137. package/dist/hooks/useFilters.esm.js.map +1 -1
  138. package/dist/hooks/useGroups.esm.js +7 -4
  139. package/dist/hooks/useGroups.esm.js.map +1 -1
  140. package/dist/hooks/useLastCompleteBillingDate.esm.js +8 -7
  141. package/dist/hooks/useLastCompleteBillingDate.esm.js.map +1 -1
  142. package/dist/hooks/useLoading.esm.js +6 -2
  143. package/dist/hooks/useLoading.esm.js.map +1 -1
  144. package/dist/hooks/useScroll.esm.js +6 -3
  145. package/dist/hooks/useScroll.esm.js.map +1 -1
  146. package/dist/index.d.ts +17 -17
  147. package/dist/index.esm.js +2 -1
  148. package/dist/index.esm.js.map +1 -1
  149. package/dist/plugin.esm.js +3 -11
  150. package/dist/plugin.esm.js.map +1 -1
  151. package/dist/routes.esm.js +14 -0
  152. package/dist/routes.esm.js.map +1 -0
  153. package/dist/testUtils/providers.esm.js +3 -3
  154. package/dist/testUtils/providers.esm.js.map +1 -1
  155. package/dist/utils/navigation.esm.js +10 -10
  156. package/dist/utils/navigation.esm.js.map +1 -1
  157. package/dist/utils/scroll.esm.js +3 -2
  158. package/dist/utils/scroll.esm.js.map +1 -1
  159. package/package.json +44 -17
@@ -1 +1 @@
1
- {"version":3,"file":"AlertStatusSummary.esm.js","sources":["../../../src/components/AlertInsights/AlertStatusSummary.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, { Fragment } from 'react';\nimport Avatar from '@material-ui/core/Avatar';\nimport Box from '@material-ui/core/Box';\nimport Collapse from '@material-ui/core/Collapse';\nimport Divider from '@material-ui/core/Divider';\nimport Tooltip from '@material-ui/core/Tooltip';\nimport { default as AcceptIcon } from '@material-ui/icons/Check';\nimport { default as DismissIcon } from '@material-ui/icons/Delete';\nimport { default as SnoozeIcon } from '@material-ui/icons/AccessTime';\nimport { ActionItemCard } from '../ActionItems';\nimport { Alert, AlertStatus } from '../../types';\nimport { useActionItemCardStyles as useStyles } from '../../utils/styles';\n\ntype AlertGroupProps = {\n alerts: Alert[];\n status: AlertStatus;\n title: string;\n icon: JSX.Element;\n};\n\nconst AlertGroup = ({ alerts, status, title, icon }: AlertGroupProps) => {\n const classes = useStyles();\n return (\n <Box p={1}>\n {alerts.map((alert, index) => (\n <Fragment key={`alert-${status}-${index}`}>\n <ActionItemCard\n disableScroll\n alert={alert}\n avatar={\n <Tooltip title={title}>\n <Avatar className={classes.avatar}>{icon}</Avatar>\n </Tooltip>\n }\n />\n {index < alerts.length - 1 && <Divider />}\n </Fragment>\n ))}\n </Box>\n );\n};\n\ntype AlertStatusSummaryProps = {\n open: boolean;\n snoozed: Alert[];\n accepted: Alert[];\n dismissed: Alert[];\n};\n\nexport const AlertStatusSummary = ({\n open,\n snoozed,\n accepted,\n dismissed,\n}: AlertStatusSummaryProps) => {\n const isSnoozedListDisplayed = !!snoozed.length;\n const isAcceptedListDisplayed = !!accepted.length;\n const isDismissedListDisplayed = !!dismissed.length;\n\n return (\n <Collapse in={open}>\n {isAcceptedListDisplayed && (\n <AlertGroup\n title=\"Accepted\"\n alerts={accepted}\n status={AlertStatus.Accepted}\n icon={\n <AcceptIcon\n role=\"img\"\n aria-hidden={false}\n aria-label={AlertStatus.Accepted}\n />\n }\n />\n )}\n {isSnoozedListDisplayed && (\n <AlertGroup\n title=\"Snoozed\"\n alerts={snoozed}\n status={AlertStatus.Snoozed}\n icon={\n <SnoozeIcon\n role=\"img\"\n aria-hidden={false}\n aria-label={AlertStatus.Snoozed}\n />\n }\n />\n )}\n {isDismissedListDisplayed && (\n <AlertGroup\n title=\"Dismissed\"\n alerts={dismissed}\n status={AlertStatus.Dismissed}\n icon={\n <DismissIcon\n role=\"img\"\n aria-hidden={false}\n aria-label={AlertStatus.Dismissed}\n />\n }\n />\n )}\n </Collapse>\n );\n};\n"],"names":["useStyles"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAoCA,MAAM,aAAa,CAAC,EAAE,QAAQ,MAAQ,EAAA,KAAA,EAAO,MAA4B,KAAA;AACvE,EAAA,MAAM,UAAUA,uBAAU,EAAA;AAC1B,EAAA,2CACG,GAAI,EAAA,EAAA,CAAA,EAAG,CACL,EAAA,EAAA,MAAA,CAAO,IAAI,CAAC,KAAA,EAAO,KAClB,qBAAA,KAAA,CAAA,aAAA,CAAC,YAAS,GAAK,EAAA,CAAA,MAAA,EAAS,MAAM,CAAA,CAAA,EAAI,KAAK,CACrC,CAAA,EAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,cAAA;AAAA,IAAA;AAAA,MACC,aAAa,EAAA,IAAA;AAAA,MACb,KAAA;AAAA,MACA,MAAA,kBACG,KAAA,CAAA,aAAA,CAAA,OAAA,EAAA,EAAQ,KACP,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,UAAO,SAAW,EAAA,OAAA,CAAQ,MAAS,EAAA,EAAA,IAAK,CAC3C;AAAA;AAAA,GAEJ,EACC,QAAQ,MAAO,CAAA,MAAA,GAAS,qBAAM,KAAA,CAAA,aAAA,CAAA,OAAA,EAAA,IAAQ,CACzC,CACD,CACH,CAAA;AAEJ,CAAA;AASO,MAAM,qBAAqB,CAAC;AAAA,EACjC,IAAA;AAAA,EACA,OAAA;AAAA,EACA,QAAA;A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AAA,UACC,IAAK,EAAA,KAAA;AAAA,UACL,aAAa,EAAA,KAAA;AAAA,UACb,cAAY,WAAY,CAAA;AAAA;AAAA;AAC1B;AAAA,GAIR,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"AlertStatusSummary.esm.js","sources":["../../../src/components/AlertInsights/AlertStatusSummary.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 { Fragment } from 'react';\nimport Avatar from '@material-ui/core/Avatar';\nimport Box from '@material-ui/core/Box';\nimport Collapse from '@material-ui/core/Collapse';\nimport Divider from '@material-ui/core/Divider';\nimport Tooltip from '@material-ui/core/Tooltip';\nimport { default as AcceptIcon } from '@material-ui/icons/Check';\nimport { default as DismissIcon } from '@material-ui/icons/Delete';\nimport { default as SnoozeIcon } from '@material-ui/icons/AccessTime';\nimport { ActionItemCard } from '../ActionItems';\nimport { Alert, AlertStatus } from '../../types';\nimport { useActionItemCardStyles as useStyles } from '../../utils/styles';\n\ntype AlertGroupProps = {\n alerts: Alert[];\n status: AlertStatus;\n title: string;\n icon: JSX.Element;\n};\n\nconst AlertGroup = ({ alerts, status, title, icon }: AlertGroupProps) => {\n const classes = useStyles();\n return (\n <Box p={1}>\n {alerts.map((alert, index) => (\n <Fragment key={`alert-${status}-${index}`}>\n <ActionItemCard\n disableScroll\n alert={alert}\n avatar={\n <Tooltip title={title}>\n <Avatar className={classes.avatar}>{icon}</Avatar>\n </Tooltip>\n }\n />\n {index < alerts.length - 1 && <Divider />}\n </Fragment>\n ))}\n </Box>\n );\n};\n\ntype AlertStatusSummaryProps = {\n open: boolean;\n snoozed: Alert[];\n accepted: Alert[];\n dismissed: Alert[];\n};\n\nexport const AlertStatusSummary = ({\n open,\n snoozed,\n accepted,\n dismissed,\n}: AlertStatusSummaryProps) => {\n const isSnoozedListDisplayed = !!snoozed.length;\n const isAcceptedListDisplayed = !!accepted.length;\n const isDismissedListDisplayed = !!dismissed.length;\n\n return (\n <Collapse in={open}>\n {isAcceptedListDisplayed && (\n <AlertGroup\n title=\"Accepted\"\n alerts={accepted}\n status={AlertStatus.Accepted}\n icon={\n <AcceptIcon\n role=\"img\"\n aria-hidden={false}\n aria-label={AlertStatus.Accepted}\n />\n }\n />\n )}\n {isSnoozedListDisplayed && (\n <AlertGroup\n title=\"Snoozed\"\n alerts={snoozed}\n status={AlertStatus.Snoozed}\n icon={\n <SnoozeIcon\n role=\"img\"\n aria-hidden={false}\n aria-label={AlertStatus.Snoozed}\n />\n }\n />\n )}\n {isDismissedListDisplayed && (\n <AlertGroup\n title=\"Dismissed\"\n alerts={dismissed}\n status={AlertStatus.Dismissed}\n icon={\n <DismissIcon\n role=\"img\"\n aria-hidden={false}\n aria-label={AlertStatus.Dismissed}\n />\n }\n />\n )}\n </Collapse>\n );\n};\n"],"names":["useStyles"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAoCA,MAAM,aAAa,CAAC,EAAE,QAAQ,MAAQ,EAAA,KAAA,EAAO,MAA4B,KAAA;AACvE,EAAA,MAAM,UAAUA,uBAAU,EAAA;AAC1B,EACE,uBAAA,GAAA,CAAC,GAAI,EAAA,EAAA,CAAA,EAAG,CACL,EAAA,QAAA,EAAA,MAAA,CAAO,IAAI,CAAC,KAAA,EAAO,KAClB,qBAAA,IAAA,CAAC,QACC,EAAA,EAAA,QAAA,EAAA;AAAA,oBAAA,GAAA;AAAA,MAAC,cAAA;AAAA,MAAA;AAAA,QACC,aAAa,EAAA,IAAA;AAAA,QACb,KAAA;AAAA,QACA,MAAA,kBACG,GAAA,CAAA,OAAA,EAAA,EAAQ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AAA,UAAC,UAAA;AAAA,UAAA;AAAA,YACC,IAAK,EAAA,KAAA;AAAA,YACL,aAAa,EAAA,KAAA;AAAA,YACb,cAAY,WAAY,CAAA;AAAA;AAAA;AAC1B;AAAA,KAEJ;AAAA,IAED,wBACC,oBAAA,GAAA;AAAA,MAAC,UAAA;AAAA,MAAA;AAAA,QACC,KAAM,EAAA,WAAA;AAAA,QACN,MAAQ,EAAA,SAAA;AAAA,QACR,QAAQ,WAAY,CAAA,SAAA;AAAA,QACpB,IACE,kBAAA,GAAA;AAAA,UAAC,WAAA;AAAA,UAAA;AAAA,YACC,IAAK,EAAA,KAAA;AAAA,YACL,aAAa,EAAA,KAAA;AAAA,YACb,cAAY,WAAY,CAAA;AAAA;AAAA;AAC1B;AAAA;AAEJ,GAEJ,EAAA,CAAA;AAEJ;;;;"}
@@ -1,4 +1,5 @@
1
- import React, { useState } from 'react';
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import { useState } from 'react';
2
3
  import classnames from 'classnames';
3
4
  import Button from '@material-ui/core/Button';
4
5
  import ExpandMoreIcon from '@material-ui/icons/ExpandMore';
@@ -17,17 +18,17 @@ const AlertStatusSummaryButton = ({
17
18
  setClicked((prevClicked) => !prevClicked);
18
19
  onClick(e);
19
20
  };
20
- return /* @__PURE__ */ React.createElement(
21
+ return /* @__PURE__ */ jsx(
21
22
  Button,
22
23
  {
23
24
  variant: "text",
24
25
  color: "primary",
25
26
  disableElevation: true,
26
27
  "aria-label": "expand",
27
- endIcon: /* @__PURE__ */ React.createElement(ExpandMoreIcon, { className: iconClassName }),
28
- onClick: handleOnClick
29
- },
30
- children
28
+ endIcon: /* @__PURE__ */ jsx(ExpandMoreIcon, { className: iconClassName }),
29
+ onClick: handleOnClick,
30
+ children
31
+ }
31
32
  );
32
33
  };
33
34
 
@@ -1 +1 @@
1
- {"version":3,"file":"AlertStatusSummaryButton.esm.js","sources":["../../../src/components/AlertInsights/AlertStatusSummaryButton.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, { useState, MouseEventHandler, PropsWithChildren } from 'react';\nimport classnames from 'classnames';\nimport Button from '@material-ui/core/Button';\nimport { default as ExpandMoreIcon } from '@material-ui/icons/ExpandMore';\nimport { useAlertStatusSummaryButtonStyles as useStyles } from '../../utils/styles';\n\ntype AlertStatusSummaryButtonProps = {\n onClick: MouseEventHandler;\n};\n\nexport const AlertStatusSummaryButton = ({\n children,\n onClick,\n}: PropsWithChildren<AlertStatusSummaryButtonProps>) => {\n const classes = useStyles();\n const [clicked, setClicked] = useState(false);\n const iconClassName = classnames(classes.icon, {\n [classes.clicked]: clicked,\n });\n\n const handleOnClick: MouseEventHandler = e => {\n setClicked(prevClicked => !prevClicked);\n onClick(e);\n };\n\n return (\n <Button\n variant=\"text\"\n color=\"primary\"\n disableElevation\n aria-label=\"expand\"\n endIcon={<ExpandMoreIcon className={iconClassName} />}\n onClick={handleOnClick}\n >\n {children}\n </Button>\n );\n};\n"],"names":["useStyles"],"mappings":";;;;;;AA0BO,MAAM,2BAA2B,CAAC;AAAA,EACvC,QAAA;AAAA,EACA;AACF,CAAwD,KAAA;AACtD,EAAA,MAAM,UAAUA,iCAAU,EAAA;AAC1B,EAAA,MAAM,CAAC,OAAA,EAAS,UAAU,CAAA,GAAI,SAAS,KAAK,CAAA;AAC5C,EAAM,MAAA,aAAA,GAAgB,UAAW,CAAA,OAAA,CAAQ,IAAM,EAAA;AAAA,IAC7C,CAAC,OAAQ,CAAA,OAAO,GAAG;AAAA,GACpB,CAAA;AAED,EAAA,MAAM,gBAAmC,CAAK,CAAA,KAAA;AAC5C,IAAW,UAAA,CAAA,CAAA,WAAA,KAAe,CAAC,WAAW,CAAA;AACtC,IAAA,OAAA,CAAQ,CAAC,CAAA;AAAA,GACX;AAEA,EACE,uBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,MAAA;AAAA,IAAA;AAAA,MACC,OAAQ,EAAA,MAAA;AAAA,MACR,KAAM,EAAA,SAAA;AAAA,MACN,gBAAgB,EAAA,IAAA;AAAA,MAChB,YAAW,EAAA,QAAA;AAAA,MACX,OAAS,kBAAA,KAAA,CAAA,aAAA,CAAC,cAAe,EAAA,EAAA,SAAA,EAAW,aAAe,EAAA,CAAA;AAAA,MACnD,OAAS,EAAA;AAAA,KAAA;AAAA,IAER;AAAA,GACH;AAEJ;;;;"}
1
+ {"version":3,"file":"AlertStatusSummaryButton.esm.js","sources":["../../../src/components/AlertInsights/AlertStatusSummaryButton.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 { useState, MouseEventHandler, PropsWithChildren } from 'react';\nimport classnames from 'classnames';\nimport Button from '@material-ui/core/Button';\nimport { default as ExpandMoreIcon } from '@material-ui/icons/ExpandMore';\nimport { useAlertStatusSummaryButtonStyles as useStyles } from '../../utils/styles';\n\ntype AlertStatusSummaryButtonProps = {\n onClick: MouseEventHandler;\n};\n\nexport const AlertStatusSummaryButton = ({\n children,\n onClick,\n}: PropsWithChildren<AlertStatusSummaryButtonProps>) => {\n const classes = useStyles();\n const [clicked, setClicked] = useState(false);\n const iconClassName = classnames(classes.icon, {\n [classes.clicked]: clicked,\n });\n\n const handleOnClick: MouseEventHandler = e => {\n setClicked(prevClicked => !prevClicked);\n onClick(e);\n };\n\n return (\n <Button\n variant=\"text\"\n color=\"primary\"\n disableElevation\n aria-label=\"expand\"\n endIcon={<ExpandMoreIcon className={iconClassName} />}\n onClick={handleOnClick}\n >\n {children}\n </Button>\n );\n};\n"],"names":["useStyles"],"mappings":";;;;;;;AA0BO,MAAM,2BAA2B,CAAC;AAAA,EACvC,QAAA;AAAA,EACA;AACF,CAAwD,KAAA;AACtD,EAAA,MAAM,UAAUA,iCAAU,EAAA;AAC1B,EAAA,MAAM,CAAC,OAAA,EAAS,UAAU,CAAA,GAAI,SAAS,KAAK,CAAA;AAC5C,EAAM,MAAA,aAAA,GAAgB,UAAW,CAAA,OAAA,CAAQ,IAAM,EAAA;AAAA,IAC7C,CAAC,OAAQ,CAAA,OAAO,GAAG;AAAA,GACpB,CAAA;AAED,EAAA,MAAM,gBAAmC,CAAK,CAAA,KAAA;AAC5C,IAAW,UAAA,CAAA,CAAA,WAAA,KAAe,CAAC,WAAW,CAAA;AACtC,IAAA,OAAA,CAAQ,CAAC,CAAA;AAAA,GACX;AAEA,EACE,uBAAA,GAAA;AAAA,IAAC,MAAA;AAAA,IAAA;AAAA,MACC,OAAQ,EAAA,MAAA;AAAA,MACR,KAAM,EAAA,SAAA;AAAA,MACN,gBAAgB,EAAA,IAAA;AAAA,MAChB,YAAW,EAAA,QAAA;AAAA,MACX,OAAS,kBAAA,GAAA,CAAC,cAAe,EAAA,EAAA,SAAA,EAAW,aAAe,EAAA,CAAA;AAAA,MACnD,OAAS,EAAA,aAAA;AAAA,MAER;AAAA;AAAA,GACH;AAEJ;;;;"}
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import { jsx, jsxs } from 'react/jsx-runtime';
2
2
  import Box from '@material-ui/core/Box';
3
3
  import Button from '@material-ui/core/Button';
4
4
  import Container from '@material-ui/core/Container';
@@ -25,22 +25,28 @@ const AlertInstructionsLayout = ({
25
25
  children
26
26
  }) => {
27
27
  const classes = useStyles();
28
- return /* @__PURE__ */ React.createElement(CostInsightsThemeProvider, null, /* @__PURE__ */ React.createElement(ConfigProvider, null, /* @__PURE__ */ React.createElement(CurrencyProvider, null, /* @__PURE__ */ React.createElement(Page, { themeId: "tool" }, /* @__PURE__ */ React.createElement(
29
- Header,
30
- {
31
- title: "Cost Insights",
32
- pageTitleOverride: title,
33
- type: "Tool"
34
- }
35
- ), /* @__PURE__ */ React.createElement(Container, { maxWidth: "md", disableGutters: true, className: classes.root }, /* @__PURE__ */ React.createElement(Box, { mb: 3 }, /* @__PURE__ */ React.createElement(
36
- Button,
37
- {
38
- variant: "outlined",
39
- startIcon: /* @__PURE__ */ React.createElement(ChevronLeftIcon, null),
40
- href: "/cost-insights"
41
- },
42
- "Back to Cost Insights"
43
- )), children)))));
28
+ return /* @__PURE__ */ jsx(CostInsightsThemeProvider, { children: /* @__PURE__ */ jsx(ConfigProvider, { children: /* @__PURE__ */ jsx(CurrencyProvider, { children: /* @__PURE__ */ jsxs(Page, { themeId: "tool", children: [
29
+ /* @__PURE__ */ jsx(
30
+ Header,
31
+ {
32
+ title: "Cost Insights",
33
+ pageTitleOverride: title,
34
+ type: "Tool"
35
+ }
36
+ ),
37
+ /* @__PURE__ */ jsxs(Container, { maxWidth: "md", disableGutters: true, className: classes.root, children: [
38
+ /* @__PURE__ */ jsx(Box, { mb: 3, children: /* @__PURE__ */ jsx(
39
+ Button,
40
+ {
41
+ variant: "outlined",
42
+ startIcon: /* @__PURE__ */ jsx(ChevronLeftIcon, {}),
43
+ href: "/cost-insights",
44
+ children: "Back to Cost Insights"
45
+ }
46
+ ) }),
47
+ children
48
+ ] })
49
+ ] }) }) }) });
44
50
  };
45
51
 
46
52
  export { AlertInstructionsLayout };
@@ -1 +1 @@
1
- {"version":3,"file":"AlertInstructionsLayout.esm.js","sources":["../../../src/components/AlertInstructionsLayout/AlertInstructionsLayout.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, { PropsWithChildren } from 'react';\nimport Box from '@material-ui/core/Box';\nimport Button from '@material-ui/core/Button';\nimport Container from '@material-ui/core/Container';\nimport { makeStyles } from '@material-ui/core/styles';\nimport ChevronLeftIcon from '@material-ui/icons/ChevronLeft';\nimport { CostInsightsThemeProvider } from '../CostInsightsPage/CostInsightsThemeProvider';\nimport { ConfigProvider, CurrencyProvider } from '../../hooks';\nimport { Header, Page } from '@backstage/core-components';\n\nconst useStyles = makeStyles(theme => ({\n root: {\n gridArea: 'pageContent',\n padding: theme.spacing(4),\n },\n}));\n\ntype AlertInstructionsLayoutProps = {\n title: string;\n};\n\nexport const AlertInstructionsLayout = ({\n title,\n children,\n}: PropsWithChildren<AlertInstructionsLayoutProps>) => {\n const classes = useStyles();\n return (\n <CostInsightsThemeProvider>\n <ConfigProvider>\n <CurrencyProvider>\n <Page themeId=\"tool\">\n <Header\n title=\"Cost Insights\"\n pageTitleOverride={title}\n type=\"Tool\"\n />\n <Container maxWidth=\"md\" disableGutters className={classes.root}>\n <Box mb={3}>\n <Button\n variant=\"outlined\"\n startIcon={<ChevronLeftIcon />}\n href=\"/cost-insights\"\n >\n Back to Cost Insights\n </Button>\n </Box>\n {children}\n </Container>\n </Page>\n </CurrencyProvider>\n </ConfigProvider>\n </CostInsightsThemeProvider>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;AA0BA,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,IAAM,EAAA;AAAA,IACJ,QAAU,EAAA,aAAA;AAAA,IACV,OAAA,EAAS,KAAM,CAAA,OAAA,CAAQ,CAAC;AAAA;AAE5B,CAAE,CAAA,CAAA;AAMK,MAAM,0BAA0B,CAAC;AAAA,EACtC,KAAA;AAAA,EACA;AACF,CAAuD,KAAA;AACrD,EAAA,MAAM,UAAU,SAAU,EAAA;AAC1B,EACE,uBAAA,KAAA,CAAA,aAAA,CAAC,iDACE,KAAA,CAAA,aAAA,CAAA,cAAA,EAAA,IAAA,sCACE,gBACC,EAAA,IAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,IAAK,EAAA,EAAA,OAAA,EAAQ,MACZ,EAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,MAAA;AAAA,IAAA;AAAA,MACC,KAAM,EAAA,eAAA;AAAA,MACN,iBAAmB,EAAA,KAAA;AAAA,MACnB,IAAK,EAAA;AAAA;AAAA,GAEP,kBAAA,KAAA,CAAA,aAAA,CAAC,SAAU,EAAA,EAAA,QAAA,EAAS,IAAK,EAAA,cAAA,EAAc,IAAC,EAAA,SAAA,EAAW,OAAQ,CAAA,IAAA,EAAA,kBACxD,KAAA,CAAA,aAAA,CAAA,GAAA,EAAA,EAAI,IAAI,CACP,EAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,MAAA;AAAA,IAAA;AAAA,MACC,OAAQ,EAAA,UAAA;AAAA,MACR,SAAA,sCAAY,eAAgB,EAAA,IAAA,CAAA;AAAA,MAC5B,IAAK,EAAA;AAAA,KAAA;AAAA,IACN;AAAA,GAGH,CACC,EAAA,QACH,CACF,CACF,CACF,CACF,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"AlertInstructionsLayout.esm.js","sources":["../../../src/components/AlertInstructionsLayout/AlertInstructionsLayout.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 { PropsWithChildren } from 'react';\nimport Box from '@material-ui/core/Box';\nimport Button from '@material-ui/core/Button';\nimport Container from '@material-ui/core/Container';\nimport { makeStyles } from '@material-ui/core/styles';\nimport ChevronLeftIcon from '@material-ui/icons/ChevronLeft';\nimport { CostInsightsThemeProvider } from '../CostInsightsPage/CostInsightsThemeProvider';\nimport { ConfigProvider, CurrencyProvider } from '../../hooks';\nimport { Header, Page } from '@backstage/core-components';\n\nconst useStyles = makeStyles(theme => ({\n root: {\n gridArea: 'pageContent',\n padding: theme.spacing(4),\n },\n}));\n\ntype AlertInstructionsLayoutProps = {\n title: string;\n};\n\nexport const AlertInstructionsLayout = ({\n title,\n children,\n}: PropsWithChildren<AlertInstructionsLayoutProps>) => {\n const classes = useStyles();\n return (\n <CostInsightsThemeProvider>\n <ConfigProvider>\n <CurrencyProvider>\n <Page themeId=\"tool\">\n <Header\n title=\"Cost Insights\"\n pageTitleOverride={title}\n type=\"Tool\"\n />\n <Container maxWidth=\"md\" disableGutters className={classes.root}>\n <Box mb={3}>\n <Button\n variant=\"outlined\"\n startIcon={<ChevronLeftIcon />}\n href=\"/cost-insights\"\n >\n Back to Cost Insights\n </Button>\n </Box>\n {children}\n </Container>\n </Page>\n </CurrencyProvider>\n </ConfigProvider>\n </CostInsightsThemeProvider>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;AA0BA,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,IAAM,EAAA;AAAA,IACJ,QAAU,EAAA,aAAA;AAAA,IACV,OAAA,EAAS,KAAM,CAAA,OAAA,CAAQ,CAAC;AAAA;AAE5B,CAAE,CAAA,CAAA;AAMK,MAAM,0BAA0B,CAAC;AAAA,EACtC,KAAA;AAAA,EACA;AACF,CAAuD,KAAA;AACrD,EAAA,MAAM,UAAU,SAAU,EAAA;AAC1B,EACE,uBAAA,GAAA,CAAC,6BACC,QAAC,kBAAA,GAAA,CAAA,cAAA,EAAA,EACC,8BAAC,gBACC,EAAA,EAAA,QAAA,kBAAA,IAAA,CAAC,IAAK,EAAA,EAAA,OAAA,EAAQ,MACZ,EAAA,QAAA,EAAA;AAAA,oBAAA,GAAA;AAAA,MAAC,MAAA;AAAA,MAAA;AAAA,QACC,KAAM,EAAA,eAAA;AAAA,QACN,iBAAmB,EAAA,KAAA;AAAA,QACnB,IAAK,EAAA;AAAA;AAAA,KACP;AAAA,oBACA,IAAA,CAAC,aAAU,QAAS,EAAA,IAAA,EAAK,gBAAc,IAAC,EAAA,SAAA,EAAW,QAAQ,IACzD,EAAA,QAAA,EAAA;AAAA,sBAAC,GAAA,CAAA,GAAA,EAAA,EAAI,IAAI,CACP,EAAA,QAAA,kBAAA,GAAA;AAAA,QAAC,MAAA;AAAA,QAAA;AAAA,UACC,OAAQ,EAAA,UAAA;AAAA,UACR,SAAA,sBAAY,eAAgB,EAAA,EAAA,CAAA;AAAA,UAC5B,IAAK,EAAA,gBAAA;AAAA,UACN,QAAA,EAAA;AAAA;AAAA,OAGH,EAAA,CAAA;AAAA,MACC;AAAA,KACH,EAAA;AAAA,GACF,EAAA,CAAA,EACF,GACF,CACF,EAAA,CAAA;AAEJ;;;;"}
@@ -1,4 +1,5 @@
1
- import React, { useState, useCallback } from 'react';
1
+ import { jsxs, jsx } from 'react/jsx-runtime';
2
+ import { useState, useCallback } from 'react';
2
3
  import { ResponsiveContainer, BarChart as BarChart$1, Tooltip, CartesianGrid, XAxis, YAxis, Bar } from 'recharts';
3
4
  import Box from '@material-ui/core/Box';
4
5
  import { useTheme } from '@material-ui/core/styles';
@@ -25,7 +26,7 @@ const defaultTooltip = (baseCurrency) => {
25
26
  if (isInvalid({ label, payload })) return null;
26
27
  const title = titleOf(label);
27
28
  const items = payload.map(tooltipItemOf(baseCurrency)).filter(notEmpty);
28
- return /* @__PURE__ */ React.createElement(BarChartTooltip, { title }, items.map((item, index) => /* @__PURE__ */ React.createElement(BarChartTooltipItem, { key: `${item.label}-${index}`, item })));
29
+ return /* @__PURE__ */ jsx(BarChartTooltip, { title, children: items.map((item, index) => /* @__PURE__ */ jsx(BarChartTooltipItem, { item }, `${item.label}-${index}`)) });
29
30
  };
30
31
  return tooltip;
31
32
  };
@@ -73,93 +74,97 @@ const BarChart = (props) => {
73
74
  },
74
75
  [setStepWindow, resources, displayAmount]
75
76
  );
76
- return /* @__PURE__ */ React.createElement(
77
+ return /* @__PURE__ */ jsxs(
77
78
  Box,
78
79
  {
79
80
  position: "relative",
80
81
  onMouseLeave: () => setActiveChart(false),
81
82
  onMouseEnter: () => setActiveChart(true),
82
- "data-testid": "bar-chart-wrapper"
83
- },
84
- /* @__PURE__ */ React.createElement(
85
- ResponsiveContainer,
86
- {
87
- height: styles.container.height,
88
- width: responsive ? "100%" : styles.container.width
89
- },
90
- /* @__PURE__ */ React.createElement(
91
- BarChart$1,
92
- {
93
- style: { cursor: onClick ? "pointer" : null },
94
- onClick,
95
- onMouseMove,
96
- data: sortedResources,
97
- margin: styles.barChart.margin,
98
- barSize: 45,
99
- "data-testid": "bar-chart"
100
- },
101
- tooltip && /* @__PURE__ */ React.createElement(
102
- Tooltip,
103
- {
104
- filterNull: true,
105
- cursor: styles.cursor,
106
- animationDuration: 100,
107
- content: tooltip
108
- }
109
- ),
110
- /* @__PURE__ */ React.createElement(
111
- CartesianGrid,
112
- {
113
- vertical: false,
114
- stroke: styles.cartesianGrid.stroke
115
- }
116
- ),
117
- /* @__PURE__ */ React.createElement(
118
- XAxis,
83
+ "data-testid": "bar-chart-wrapper",
84
+ children: [
85
+ /* @__PURE__ */ jsx(
86
+ ResponsiveContainer,
119
87
  {
120
- dataKey: DataKey.Name,
121
- tickLine: false,
122
- interval: 0,
123
- height: styles.xAxis.height,
124
- tick: BarChartTick
88
+ height: styles.container.height,
89
+ width: responsive ? "100%" : styles.container.width,
90
+ children: /* @__PURE__ */ jsxs(
91
+ BarChart$1,
92
+ {
93
+ style: { cursor: onClick ? "pointer" : null },
94
+ onClick,
95
+ onMouseMove,
96
+ data: sortedResources,
97
+ margin: styles.barChart.margin,
98
+ barSize: 45,
99
+ "data-testid": "bar-chart",
100
+ children: [
101
+ tooltip && /* @__PURE__ */ jsx(
102
+ Tooltip,
103
+ {
104
+ filterNull: true,
105
+ cursor: styles.cursor,
106
+ animationDuration: 100,
107
+ content: tooltip
108
+ }
109
+ ),
110
+ /* @__PURE__ */ jsx(
111
+ CartesianGrid,
112
+ {
113
+ vertical: false,
114
+ stroke: styles.cartesianGrid.stroke
115
+ }
116
+ ),
117
+ /* @__PURE__ */ jsx(
118
+ XAxis,
119
+ {
120
+ dataKey: DataKey.Name,
121
+ tickLine: false,
122
+ interval: 0,
123
+ height: styles.xAxis.height,
124
+ tick: BarChartTick
125
+ }
126
+ ),
127
+ /* @__PURE__ */ jsx(
128
+ YAxis,
129
+ {
130
+ tickFormatter: currencyFormatter(baseCurrency).format,
131
+ domain: [() => 0, globalResourcesMax],
132
+ tick: styles.axis
133
+ }
134
+ ),
135
+ /* @__PURE__ */ jsx(
136
+ Bar,
137
+ {
138
+ dataKey: DataKey.Previous,
139
+ name: data.previousName,
140
+ fill: data.previousFill,
141
+ isAnimationActive: false
142
+ }
143
+ ),
144
+ /* @__PURE__ */ jsx(
145
+ Bar,
146
+ {
147
+ dataKey: DataKey.Current,
148
+ name: data.currentName,
149
+ fill: data.currentFill,
150
+ isAnimationActive: false
151
+ }
152
+ )
153
+ ]
154
+ }
155
+ )
125
156
  }
126
157
  ),
127
- /* @__PURE__ */ React.createElement(
128
- YAxis,
158
+ !disableStepper && /* @__PURE__ */ jsx(
159
+ BarChartStepper,
129
160
  {
130
- tickFormatter: currencyFormatter(baseCurrency).format,
131
- domain: [() => 0, globalResourcesMax],
132
- tick: styles.axis
133
- }
134
- ),
135
- /* @__PURE__ */ React.createElement(
136
- Bar,
137
- {
138
- dataKey: DataKey.Previous,
139
- name: data.previousName,
140
- fill: data.previousFill,
141
- isAnimationActive: false
142
- }
143
- ),
144
- /* @__PURE__ */ React.createElement(
145
- Bar,
146
- {
147
- dataKey: DataKey.Current,
148
- name: data.currentName,
149
- fill: data.currentFill,
150
- isAnimationActive: false
161
+ steps,
162
+ disableScroll: !activeChart,
163
+ onChange: onStepChange
151
164
  }
152
165
  )
153
- )
154
- ),
155
- !disableStepper && /* @__PURE__ */ React.createElement(
156
- BarChartStepper,
157
- {
158
- steps,
159
- disableScroll: !activeChart,
160
- onChange: onStepChange
161
- }
162
- )
166
+ ]
167
+ }
163
168
  );
164
169
  };
165
170
 
@@ -1 +1 @@
1
- {"version":3,"file":"BarChart.esm.js","sources":["../../../src/components/BarChart/BarChart.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, { useState, useCallback } from 'react';\nimport {\n Bar,\n BarChart as RechartsBarChart,\n CartesianGrid,\n Tooltip as RechartsTooltip,\n ResponsiveContainer,\n XAxis,\n YAxis,\n} from 'recharts';\nimport Box from '@material-ui/core/Box';\nimport { useTheme } from '@material-ui/core/styles';\nimport { BarChartTick } from './BarChartTick';\nimport { BarChartStepper } from './BarChartStepper';\nimport { BarChartTooltip } from './BarChartTooltip';\nimport { BarChartTooltipItem } from './BarChartTooltipItem';\nimport { currencyFormatter } from '../../utils/formatters';\nimport {\n ResourceData,\n DataKey,\n CostInsightsTheme,\n BarChartOptions,\n} from '../../types';\nimport { notEmpty } from '../../utils/assert';\nimport { useBarChartStyles } from '../../utils/styles';\nimport { resourceSort } from '../../utils/sort';\nimport { isInvalid, titleOf, tooltipItemOf } from '../../utils/graphs';\nimport { TooltipRenderer } from '../../types';\nimport { useConfig } from '../../hooks';\n\nconst defaultTooltip = (baseCurrency: Intl.NumberFormat) => {\n const tooltip: TooltipRenderer = ({ label, payload = [] }) => {\n if (isInvalid({ label, payload })) return null;\n\n const title = titleOf(label);\n const items = payload.map(tooltipItemOf(baseCurrency)).filter(notEmpty);\n return (\n <BarChartTooltip title={title}>\n {items.map((item, index) => (\n <BarChartTooltipItem key={`${item.label}-${index}`} item={item} />\n ))}\n </BarChartTooltip>\n );\n };\n return tooltip;\n};\n\n/** @public */\nexport type BarChartProps = {\n resources: ResourceData[];\n responsive?: boolean;\n displayAmount?: number;\n options?: Partial<BarChartOptions>;\n tooltip?: TooltipRenderer;\n onClick?: (...args: any[]) => void;\n onMouseMove?: (...args: any[]) => void;\n};\n\n/** @public */\nexport const BarChart = (props: BarChartProps) => {\n const { baseCurrency } = useConfig();\n\n const {\n resources,\n responsive = true,\n displayAmount = 6,\n options = {},\n tooltip = defaultTooltip(baseCurrency),\n onClick,\n onMouseMove,\n } = props;\n\n const theme = useTheme<CostInsightsTheme>();\n const styles = useBarChartStyles(theme);\n const [activeChart, setActiveChart] = useState(false);\n const [stepWindow, setStepWindow] = useState(() => [0, displayAmount]);\n\n const data = Object.assign(\n {\n previousFill: theme.palette.lightBlue,\n currentFill: theme.palette.darkBlue,\n previousName: 'Previous',\n currentName: 'Current',\n },\n options,\n );\n\n const [stepStart, stepEnd] = stepWindow;\n const steps = Math.ceil(resources.length / displayAmount);\n const disableStepper = resources.length <= displayAmount;\n\n const sortedResources = resources\n .sort(resourceSort)\n .slice(stepStart, stepEnd);\n\n // Pin the domain to the largest value in the series.\n // Intentionally redundant - This could simply be derived from the first element in the already sorted list,\n // but that may not be the case in the future when custom sorting is implemented.\n const globalResourcesMax = resources.reduce(\n (max, r: ResourceData) => Math.max(max, r.current, r.previous),\n 0,\n );\n\n const onStepChange = useCallback(\n (activeStep: number) => {\n const start = activeStep * displayAmount;\n const end = start + displayAmount;\n if (end > resources.length) {\n setStepWindow([start, resources.length]);\n } else {\n setStepWindow([start, end]);\n }\n },\n [setStepWindow, resources, displayAmount],\n );\n\n return (\n <Box\n position=\"relative\"\n onMouseLeave={() => setActiveChart(false)}\n onMouseEnter={() => setActiveChart(true)}\n data-testid=\"bar-chart-wrapper\"\n >\n {/* Setting fixed values for height and width generates a console warning in testing but enables ResponsiveContainer to render its children. */}\n <ResponsiveContainer\n height={styles.container.height}\n width={responsive ? '100%' : styles.container.width}\n >\n <RechartsBarChart\n style={{ cursor: onClick ? 'pointer' : null }}\n onClick={onClick}\n onMouseMove={onMouseMove}\n data={sortedResources}\n margin={styles.barChart.margin}\n barSize={45}\n data-testid=\"bar-chart\"\n >\n {tooltip && (\n <RechartsTooltip\n filterNull\n cursor={styles.cursor}\n animationDuration={100}\n content={tooltip}\n />\n )}\n <CartesianGrid\n vertical={false}\n stroke={styles.cartesianGrid.stroke}\n />\n <XAxis\n dataKey={DataKey.Name}\n tickLine={false}\n interval={0}\n height={styles.xAxis.height}\n tick={BarChartTick}\n />\n <YAxis\n tickFormatter={currencyFormatter(baseCurrency).format}\n domain={[() => 0, globalResourcesMax]}\n tick={styles.axis}\n />\n <Bar\n dataKey={DataKey.Previous}\n name={data.previousName}\n fill={data.previousFill}\n isAnimationActive={false}\n />\n <Bar\n dataKey={DataKey.Current}\n name={data.currentName}\n fill={data.currentFill}\n isAnimationActive={false}\n />\n </RechartsBarChart>\n </ResponsiveContainer>\n {!disableStepper && (\n <BarChartStepper\n steps={steps}\n disableScroll={!activeChart}\n onChange={onStepChange}\n />\n )}\n </Box>\n );\n};\n"],"names":["RechartsBarChart","RechartsTooltip"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA8CA,MAAM,cAAA,GAAiB,CAAC,YAAoC,KAAA;AAC1D,EAAA,MAAM,UAA2B,CAAC,EAAE,OAAO,OAAU,GAAA,IA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AkB,CAAA,YAAY,CAAE,CAAA,MAAA;AAAA,YAC/C,MAAQ,EAAA,CAAC,MAAM,CAAA,EAAG,kBAAkB,CAAA;AAAA,YACpC,MAAM,MAAO,CAAA;AAAA;AAAA,SACf;AAAA,wBACA,KAAA,CAAA,aAAA;AAAA,UAAC,GAAA;AAAA,UAAA;AAAA,YACC,SAAS,OAAQ,CAAA,QAAA;AAAA,YACjB,MAAM,IAAK,CAAA,YAAA;AAAA,YACX,MAAM,IAAK,CAAA,YAAA;AAAA,YACX,iBAAmB,EAAA;AAAA;AAAA,SACrB;AAAA,wBACA,KAAA,CAAA,aAAA;AAAA,UAAC,GAAA;AAAA,UAAA;AAAA,YACC,SAAS,OAAQ,CAAA,OAAA;AAAA,YACjB,MAAM,IAAK,CAAA,WAAA;AAAA,YACX,MAAM,IAAK,CAAA,WAAA;AAAA,YACX,iBAAmB,EAAA;AAAA;AAAA;AACrB;AACF,KACF;AAAA,IACC,CAAC,cACA,oBAAA,KAAA,CAAA,aAAA;AAAA,MAAC,eAAA;AAAA,MAAA;AAAA,QACC,KAAA;AAAA,QACA,eAAe,CAAC,WAAA;AAAA,QAChB,QAAU,EAAA;AAAA;AAAA;AACZ,GAEJ;AAEJ;;;;"}
1
+ {"version":3,"file":"BarChart.esm.js","sources":["../../../src/components/BarChart/BarChart.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 { useState, useCallback } from 'react';\nimport {\n Bar,\n BarChart as RechartsBarChart,\n CartesianGrid,\n Tooltip as RechartsTooltip,\n ResponsiveContainer,\n XAxis,\n YAxis,\n} from 'recharts';\nimport Box from '@material-ui/core/Box';\nimport { useTheme } from '@material-ui/core/styles';\nimport { BarChartTick } from './BarChartTick';\nimport { BarChartStepper } from './BarChartStepper';\nimport { BarChartTooltip } from './BarChartTooltip';\nimport { BarChartTooltipItem } from './BarChartTooltipItem';\nimport { currencyFormatter } from '../../utils/formatters';\nimport {\n ResourceData,\n DataKey,\n CostInsightsTheme,\n BarChartOptions,\n} from '../../types';\nimport { notEmpty } from '../../utils/assert';\nimport { useBarChartStyles } from '../../utils/styles';\nimport { resourceSort } from '../../utils/sort';\nimport { isInvalid, titleOf, tooltipItemOf } from '../../utils/graphs';\nimport { TooltipRenderer } from '../../types';\nimport { useConfig } from '../../hooks';\n\nconst defaultTooltip = (baseCurrency: Intl.NumberFormat) => {\n const tooltip: TooltipRenderer = ({ label, payload = [] }) => {\n if (isInvalid({ label, payload })) return null;\n\n const title = titleOf(label);\n const items = payload.map(tooltipItemOf(baseCurrency)).filter(notEmpty);\n return (\n <BarChartTooltip title={title}>\n {items.map((item, index) => (\n <BarChartTooltipItem key={`${item.label}-${index}`} item={item} />\n ))}\n </BarChartTooltip>\n );\n };\n return tooltip;\n};\n\n/** @public */\nexport type BarChartProps = {\n resources: ResourceData[];\n responsive?: boolean;\n displayAmount?: number;\n options?: Partial<BarChartOptions>;\n tooltip?: TooltipRenderer;\n onClick?: (...args: any[]) => void;\n onMouseMove?: (...args: any[]) => void;\n};\n\n/** @public */\nexport const BarChart = (props: BarChartProps) => {\n const { baseCurrency } = useConfig();\n\n const {\n resources,\n responsive = true,\n displayAmount = 6,\n options = {},\n tooltip = defaultTooltip(baseCurrency),\n onClick,\n onMouseMove,\n } = props;\n\n const theme = useTheme<CostInsightsTheme>();\n const styles = useBarChartStyles(theme);\n const [activeChart, setActiveChart] = useState(false);\n const [stepWindow, setStepWindow] = useState(() => [0, displayAmount]);\n\n const data = Object.assign(\n {\n previousFill: theme.palette.lightBlue,\n currentFill: theme.palette.darkBlue,\n previousName: 'Previous',\n currentName: 'Current',\n },\n options,\n );\n\n const [stepStart, stepEnd] = stepWindow;\n const steps = Math.ceil(resources.length / displayAmount);\n const disableStepper = resources.length <= displayAmount;\n\n const sortedResources = resources\n .sort(resourceSort)\n .slice(stepStart, stepEnd);\n\n // Pin the domain to the largest value in the series.\n // Intentionally redundant - This could simply be derived from the first element in the already sorted list,\n // but that may not be the case in the future when custom sorting is implemented.\n const globalResourcesMax = resources.reduce(\n (max, r: ResourceData) => Math.max(max, r.current, r.previous),\n 0,\n );\n\n const onStepChange = useCallback(\n (activeStep: number) => {\n const start = activeStep * displayAmount;\n const end = start + displayAmount;\n if (end > resources.length) {\n setStepWindow([start, resources.length]);\n } else {\n setStepWindow([start, end]);\n }\n },\n [setStepWindow, resources, displayAmount],\n );\n\n return (\n <Box\n position=\"relative\"\n onMouseLeave={() => setActiveChart(false)}\n onMouseEnter={() => setActiveChart(true)}\n data-testid=\"bar-chart-wrapper\"\n >\n {/* Setting fixed values for height and width generates a console warning in testing but enables ResponsiveContainer to render its children. */}\n <ResponsiveContainer\n height={styles.container.height}\n width={responsive ? '100%' : styles.container.width}\n >\n <RechartsBarChart\n style={{ cursor: onClick ? 'pointer' : null }}\n onClick={onClick}\n onMouseMove={onMouseMove}\n data={sortedResources}\n margin={styles.barChart.margin}\n barSize={45}\n data-testid=\"bar-chart\"\n >\n {tooltip && (\n <RechartsTooltip\n filterNull\n cursor={styles.cursor}\n animationDuration={100}\n content={tooltip}\n />\n )}\n <CartesianGrid\n vertical={false}\n stroke={styles.cartesianGrid.stroke}\n />\n <XAxis\n dataKey={DataKey.Name}\n tickLine={false}\n interval={0}\n height={styles.xAxis.height}\n tick={BarChartTick}\n />\n <YAxis\n tickFormatter={currencyFormatter(baseCurrency).format}\n domain={[() => 0, globalResourcesMax]}\n tick={styles.axis}\n />\n <Bar\n dataKey={DataKey.Previous}\n name={data.previousName}\n fill={data.previousFill}\n isAnimationActive={false}\n />\n <Bar\n dataKey={DataKey.Current}\n name={data.currentName}\n fill={data.currentFill}\n isAnimationActive={false}\n />\n </RechartsBarChart>\n </ResponsiveContainer>\n {!disableStepper && (\n <BarChartStepper\n steps={steps}\n disableScroll={!activeChart}\n onChange={onStepChange}\n />\n )}\n </Box>\n );\n};\n"],"names":["RechartsBarChart","RechartsTooltip"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AA8CA,MAAM,cAAA,GAAiB,CAAC,YAAoC,KAAA;AAC1D,EAAA,MAAM,UAA2B,CAAC,EAAE,OAAO,OAAU,GAAA,IAAS,KAAA;AAC5D,IAAA,IAAI,UAAU,EAAE,KAAA,EAAO,OAAQ,EAAC,GAAU,OAAA,IAAA;AAE1C,IAAM,MAAA,KAAA,GAAQ,QAAQ,KAAK,CAAA;AAC3B,IAAM,MAAA,KAAA,GAAQ,QAAQ,GAAI,CAAA,aAAA,CAAc,YAAY,CAAC,CAAA,CAAE,OAAO,QAAQ,CAAA;AACtE,IAAA,2BACG,eAAgB,EAAA,EAAA,KAAA,EACd,gBAAM,GAAI,CAAA,CAAC,MAAM,KAChB,qBAAA,GAAA,CAAC,mBAAmD,EAAA,EAAA,IAAA,EAAA,EAA1B,GAAG,IAAK,CAAA,KAAK,IAAI,KAAK,CAAA,CAAgB,CACjE,CACH,EAAA,CAAA;AAAA,GAEJ;AACA,EAAO,OAAA,OAAA;AACT,CAAA;AAca,MAAA,QAAA,GAAW,CAAC,KAAyB,KAAA;AAChD,EAAM,MAAA,EAAE,YAAa,EAAA,GAAI,SAAU,EAAA;AAEnC,EAAM,MAAA;AAAA,IACJ,SAAA;AAAA,IACA,UAAa,GAAA,IAAA;AAAA,IACb,aAAgB,GAAA,CAAA;AAAA,IAChB,UAAU,EAAC;AAAA,IACX,OAAA,GAAU,eAAe,YAAY,CAAA;AAAA,IACrC,OAAA;AAAA,IACA;AAAA,GACE,GAAA,KAAA;AAEJ,EAAA,MAAM,QAAQ,QAA4B,EAAA;AAC1C,EAAM,MAAA,MAAA,GAAS,kBAAkB,KAAK,CAA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A;AAAA,oBAAC,KAAA;AAAA,oBAAA;AAAA,sBACC,SAAS,OAAQ,CAAA,IAAA;AAAA,sBACjB,QAAU,EAAA,KAAA;AAAA,sBACV,QAAU,EAAA,CAAA;AAAA,sBACV,MAAA,EAAQ,OAAO,KAAM,CAAA,MAAA;AAAA,sBACrB,IAAM,EAAA;AAAA;AAAA,mBACR;AAAA,kCACA,GAAA;AAAA,oBAAC,KAAA;AAAA,oBAAA;AAAA,sBACC,aAAA,EAAe,iBAAkB,CAAA,YAAY,CAAE,CAAA,MAAA;AAAA,sBAC/C,MAAQ,EAAA,CAAC,MAAM,CAAA,EAAG,kBAAkB,CAAA;AAAA,sBACpC,MAAM,MAAO,CAAA;AAAA;AAAA,mBACf;AAAA,kCACA,GAAA;AAAA,oBAAC,GAAA;AAAA,oBAAA;AAAA,sBACC,SAAS,OAAQ,CAAA,QAAA;AAAA,sBACjB,MAAM,IAAK,CAAA,YAAA;AAAA,sBACX,MAAM,IAAK,CAAA,YAAA;AAAA,sBACX,iBAAmB,EAAA;AAAA;AAAA,mBACrB;AAAA,kCACA,GAAA;AAAA,oBAAC,GAAA;AAAA,oBAAA;AAAA,sBACC,SAAS,OAAQ,CAAA,OAAA;AAAA,sBACjB,MAAM,IAAK,CAAA,WAAA;AAAA,sBACX,MAAM,IAAK,CAAA,WAAA;AAAA,sBACX,iBAAmB,EAAA;AAAA;AAAA;AACrB;AAAA;AAAA;AACF;AAAA,SACF;AAAA,QACC,CAAC,cACA,oBAAA,GAAA;AAAA,UAAC,eAAA;AAAA,UAAA;AAAA,YACC,KAAA;AAAA,YACA,eAAe,CAAC,WAAA;AAAA,YAChB,QAAU,EAAA;AAAA;AAAA;AACZ;AAAA;AAAA,GAEJ;AAEJ;;;;"}
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import { jsx, jsxs } from 'react/jsx-runtime';
2
2
  import Box from '@material-ui/core/Box';
3
3
  import Typography from '@material-ui/core/Typography';
4
4
  import { useBarChartLabelStyles } from '../../utils/styles.esm.js';
@@ -13,7 +13,7 @@ const BarChartLabel = ({
13
13
  }) => {
14
14
  const classes = useBarChartLabelStyles();
15
15
  const translateX = width * -0.5;
16
- return /* @__PURE__ */ React.createElement(
16
+ return /* @__PURE__ */ jsx(
17
17
  "foreignObject",
18
18
  {
19
19
  className: classes.foreignObject,
@@ -21,9 +21,12 @@ const BarChartLabel = ({
21
21
  x,
22
22
  y,
23
23
  height,
24
- width
25
- },
26
- /* @__PURE__ */ React.createElement(Box, { display: "flex", flexDirection: "column", justifyContent: "center" }, /* @__PURE__ */ React.createElement(Typography, { className: classes.label, gutterBottom: true }, children), details)
24
+ width,
25
+ children: /* @__PURE__ */ jsxs(Box, { display: "flex", flexDirection: "column", justifyContent: "center", children: [
26
+ /* @__PURE__ */ jsx(Typography, { className: classes.label, gutterBottom: true, children }),
27
+ details
28
+ ] })
29
+ }
27
30
  );
28
31
  };
29
32
 
@@ -1 +1 @@
1
- {"version":3,"file":"BarChartLabel.esm.js","sources":["../../../src/components/BarChart/BarChartLabel.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, { PropsWithChildren } from 'react';\nimport Box from '@material-ui/core/Box';\nimport Typography from '@material-ui/core/Typography';\nimport { useBarChartLabelStyles } from '../../utils/styles';\n\ntype BarChartLabelProps = {\n x: number;\n y: number;\n height: number;\n width: number;\n details?: JSX.Element;\n};\n\nexport const BarChartLabel = ({\n x,\n y,\n height,\n width,\n details,\n children,\n}: PropsWithChildren<BarChartLabelProps>) => {\n const classes = useBarChartLabelStyles();\n const translateX = width * -0.5;\n\n return (\n <foreignObject\n className={classes.foreignObject}\n style={{ transform: `translateX(${translateX}px)` }}\n x={x}\n y={y}\n height={height}\n width={width}\n >\n <Box display=\"flex\" flexDirection=\"column\" justifyContent=\"center\">\n <Typography className={classes.label} gutterBottom>\n {children}\n </Typography>\n {details}\n </Box>\n </foreignObject>\n );\n};\n"],"names":[],"mappings":";;;;;AA6BO,MAAM,gBAAgB,CAAC;AAAA,EAC5B,CAAA;AAAA,EACA,CAAA;AAAA,EACA,MAAA;AAAA,EACA,KAAA;AAAA,EACA,OAAA;AAAA,EACA;AACF,CAA6C,KAAA;AAC3C,EAAA,MAAM,UAAU,sBAAuB,EAAA;AACvC,EAAA,MAAM,aAAa,KAAQ,GAAA,CAAA,GAAA;AAE3B,EACE,uBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,eAAA;AAAA,IAAA;AAAA,MACC,WAAW,OAAQ,CAAA,aAAA;AAAA,MACnB,KAAO,EAAA,EAAE,SAAW,EAAA,CAAA,WAAA,EAAc,UAAU,CAAM,GAAA,CAAA,EAAA;AAAA,MAClD,CAAA;AAAA,MACA,CAAA;AAAA,MACA,MAAA;AAAA,MACA;AAAA,KAAA;AAAA,wCAEC,GAAI,EAAA,EAAA,OAAA,EAAQ,MAAO,EAAA,aAAA,EAAc,UAAS,cAAe,EAAA,QAAA,EAAA,kBACvD,KAAA,CAAA,aAAA,CAAA,UAAA,EAAA,EAAW,WAAW,OAAQ,CAAA,KAAA,EAAO,cAAY,IAC/C,EAAA,EAAA,QACH,GACC,OACH;AAAA,GACF;AAEJ;;;;"}
1
+ {"version":3,"file":"BarChartLabel.esm.js","sources":["../../../src/components/BarChart/BarChartLabel.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 { PropsWithChildren } from 'react';\nimport Box from '@material-ui/core/Box';\nimport Typography from '@material-ui/core/Typography';\nimport { useBarChartLabelStyles } from '../../utils/styles';\n\ntype BarChartLabelProps = {\n x: number;\n y: number;\n height: number;\n width: number;\n details?: JSX.Element;\n};\n\nexport const BarChartLabel = ({\n x,\n y,\n height,\n width,\n details,\n children,\n}: PropsWithChildren<BarChartLabelProps>) => {\n const classes = useBarChartLabelStyles();\n const translateX = width * -0.5;\n\n return (\n <foreignObject\n className={classes.foreignObject}\n style={{ transform: `translateX(${translateX}px)` }}\n x={x}\n y={y}\n height={height}\n width={width}\n >\n <Box display=\"flex\" flexDirection=\"column\" justifyContent=\"center\">\n <Typography className={classes.label} gutterBottom>\n {children}\n </Typography>\n {details}\n </Box>\n </foreignObject>\n );\n};\n"],"names":[],"mappings":";;;;;AA6BO,MAAM,gBAAgB,CAAC;AAAA,EAC5B,CAAA;AAAA,EACA,CAAA;AAAA,EACA,MAAA;AAAA,EACA,KAAA;AAAA,EACA,OAAA;AAAA,EACA;AACF,CAA6C,KAAA;AAC3C,EAAA,MAAM,UAAU,sBAAuB,EAAA;AACvC,EAAA,MAAM,aAAa,KAAQ,GAAA,CAAA,GAAA;AAE3B,EACE,uBAAA,GAAA;AAAA,IAAC,eAAA;AAAA,IAAA;AAAA,MACC,WAAW,OAAQ,CAAA,aAAA;AAAA,MACnB,KAAO,EAAA,EAAE,SAAW,EAAA,CAAA,WAAA,EAAc,UAAU,CAAM,GAAA,CAAA,EAAA;AAAA,MAClD,CAAA;AAAA,MACA,CAAA;AAAA,MACA,MAAA;AAAA,MACA,KAAA;AAAA,MAEA,+BAAC,GAAI,EAAA,EAAA,OAAA,EAAQ,QAAO,aAAc,EAAA,QAAA,EAAS,gBAAe,QACxD,EAAA,QAAA,EAAA;AAAA,wBAAA,GAAA,CAAC,cAAW,SAAW,EAAA,OAAA,CAAQ,KAAO,EAAA,YAAA,EAAY,MAC/C,QACH,EAAA,CAAA;AAAA,QACC;AAAA,OACH,EAAA;AAAA;AAAA,GACF;AAEJ;;;;"}
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import { jsxs, jsx } from 'react/jsx-runtime';
2
2
  import Box from '@material-ui/core/Box';
3
3
  import { useTheme } from '@material-ui/core/styles';
4
4
  import { LegendItem } from '../LegendItem/LegendItem.esm.js';
@@ -26,21 +26,25 @@ const BarChartLegend = (props) => {
26
26
  },
27
27
  options
28
28
  );
29
- return /* @__PURE__ */ React.createElement(Box, { className: classes.legend, display: "flex", flexDirection: "row" }, /* @__PURE__ */ React.createElement(Box, { marginRight: 2 }, /* @__PURE__ */ React.createElement(
30
- LegendItem,
31
- {
32
- title: data.previousName,
33
- markerColor: options.hideMarker ? void 0 : data.previousFill
34
- },
35
- currencyFormatter(baseCurrency).format(costStart)
36
- )), /* @__PURE__ */ React.createElement(Box, { marginRight: 2 }, /* @__PURE__ */ React.createElement(
37
- LegendItem,
38
- {
39
- title: data.currentName,
40
- markerColor: options.hideMarker ? void 0 : data.currentFill
41
- },
42
- currencyFormatter(baseCurrency).format(costEnd)
43
- )), children);
29
+ return /* @__PURE__ */ jsxs(Box, { className: classes.legend, display: "flex", flexDirection: "row", children: [
30
+ /* @__PURE__ */ jsx(Box, { marginRight: 2, children: /* @__PURE__ */ jsx(
31
+ LegendItem,
32
+ {
33
+ title: data.previousName,
34
+ markerColor: options.hideMarker ? void 0 : data.previousFill,
35
+ children: currencyFormatter(baseCurrency).format(costStart)
36
+ }
37
+ ) }),
38
+ /* @__PURE__ */ jsx(Box, { marginRight: 2, children: /* @__PURE__ */ jsx(
39
+ LegendItem,
40
+ {
41
+ title: data.currentName,
42
+ markerColor: options.hideMarker ? void 0 : data.currentFill,
43
+ children: currencyFormatter(baseCurrency).format(costEnd)
44
+ }
45
+ ) }),
46
+ children
47
+ ] });
44
48
  };
45
49
 
46
50
  export { BarChartLegend };
@@ -1 +1 @@
1
- {"version":3,"file":"BarChartLegend.esm.js","sources":["../../../src/components/BarChart/BarChartLegend.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, { PropsWithChildren } from 'react';\nimport Box from '@material-ui/core/Box';\nimport { useTheme } from '@material-ui/core/styles';\nimport { LegendItem } from '../LegendItem';\nimport { currencyFormatter } from '../../utils/formatters';\nimport { CostInsightsTheme } from '../../types';\nimport { useBarChartLayoutStyles as useStyles } from '../../utils/styles';\nimport { useConfig } from '../../hooks';\n\n/** @public */\nexport type BarChartLegendOptions = {\n previousName: string;\n previousFill: string;\n currentName: string;\n currentFill: string;\n hideMarker?: boolean;\n};\n\n/** @public */\nexport type BarChartLegendProps = {\n costStart: number;\n costEnd: number;\n options?: Partial<BarChartLegendOptions>;\n};\n\n/** @public */\nexport const BarChartLegend = (\n props: PropsWithChildren<BarChartLegendProps>,\n) => {\n const { costStart, costEnd, options = {}, children } = props;\n\n const theme = useTheme<CostInsightsTheme>();\n const classes = useStyles();\n const { baseCurrency } = useConfig();\n\n const data = Object.assign(\n {\n previousName: 'Previous',\n previousFill: theme.palette.lightBlue,\n currentName: 'Current',\n currentFill: theme.palette.darkBlue,\n },\n options,\n );\n\n return (\n <Box className={classes.legend} display=\"flex\" flexDirection=\"row\">\n <Box marginRight={2}>\n <LegendItem\n title={data.previousName}\n markerColor={options.hideMarker ? undefined : data.previousFill}\n >\n {currencyFormatter(baseCurrency).format(costStart)}\n </LegendItem>\n </Box>\n <Box marginRight={2}>\n <LegendItem\n title={data.currentName}\n markerColor={options.hideMarker ? undefined : data.currentFill}\n >\n {currencyFormatter(baseCurrency).format(costEnd)}\n </LegendItem>\n </Box>\n {children}\n </Box>\n );\n};\n"],"names":["useStyles"],"mappings":";;;;;;;;;;;;;;AA0Ca,MAAA,cAAA,GAAiB,CAC5B,KACG,KAAA;AACH,EAAA,MAAM,EAAE,SAAW,EAAA,OAAA,EAAS,UAAU,EAAC,EAAG,UAAa,GAAA,KAAA;AAEvD,EAAA,MAAM,QAAQ,QAA4B,EAAA;AAC1C,EAAA,MAAM,UAAUA,uBAAU,EAAA;AAC1B,EAAM,MAAA,EAAE,YAAa,EAAA,GAAI,SAAU,EAAA;AAEnC,EAAA,MAAM,OAAO,MAAO,CAAA,MAAA;AAAA,IAClB;AAAA,MACE,YAAc,EAAA,UAAA;AAAA,MACd,YAAA,EAAc,MAAM,OAAQ,CAAA,SAAA;AAAA,MAC5B,WAAa,EAAA,SAAA;AAAA,MACb,WAAA,EAAa,MAAM,OAAQ,CAAA;AAAA,KAC7B;AAAA,IACA;AAAA,GACF;AAEA,EAAA,uBACG,KAAA,CAAA,aAAA,CAAA,GAAA,EAAA,EAAI,SAAW,EAAA,OAAA,CAAQ,MAAQ,EAAA,OAAA,EAAQ,MAAO,EAAA,aAAA,EAAc,KAC3D,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,GAAI,EAAA,EAAA,WAAA,EAAa,CAChB,EAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,UAAA;AAAA,IAAA;AAAA,MACC,OAAO,IAAK,CAAA,YAAA;AAAA,MACZ,WAAa,EAAA,OAAA,CAAQ,UAAa,GAAA,KAAA,CAAA,GAAY,IAAK,CAAA;AAAA,KAAA;AAAA,IAElD,iBAAkB,CAAA,YAAY,CAAE,CAAA,MAAA,CAAO,SAAS;AAAA,GAErD,CAAA,kBACC,KAAA,CAAA,aAAA,CAAA,GAAA,EAAA,EAAI,aAAa,CAChB,EAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,UAAA;AAAA,IAAA;AAAA,MACC,OAAO,IAAK,CAAA,WAAA;AAAA,MACZ,WAAa,EAAA,OAAA,CAAQ,UAAa,GAAA,KAAA,CAAA,GAAY,IAAK,CAAA;AAAA,KAAA;AAAA,IAElD,iBAAkB,CAAA,YAAY,CAAE,CAAA,MAAA,CAAO,OAAO;AAAA,GAEnD,GACC,QACH,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"BarChartLegend.esm.js","sources":["../../../src/components/BarChart/BarChartLegend.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 { PropsWithChildren } from 'react';\nimport Box from '@material-ui/core/Box';\nimport { useTheme } from '@material-ui/core/styles';\nimport { LegendItem } from '../LegendItem';\nimport { currencyFormatter } from '../../utils/formatters';\nimport { CostInsightsTheme } from '../../types';\nimport { useBarChartLayoutStyles as useStyles } from '../../utils/styles';\nimport { useConfig } from '../../hooks';\n\n/** @public */\nexport type BarChartLegendOptions = {\n previousName: string;\n previousFill: string;\n currentName: string;\n currentFill: string;\n hideMarker?: boolean;\n};\n\n/** @public */\nexport type BarChartLegendProps = {\n costStart: number;\n costEnd: number;\n options?: Partial<BarChartLegendOptions>;\n};\n\n/** @public */\nexport const BarChartLegend = (\n props: PropsWithChildren<BarChartLegendProps>,\n) => {\n const { costStart, costEnd, options = {}, children } = props;\n\n const theme = useTheme<CostInsightsTheme>();\n const classes = useStyles();\n const { baseCurrency } = useConfig();\n\n const data = Object.assign(\n {\n previousName: 'Previous',\n previousFill: theme.palette.lightBlue,\n currentName: 'Current',\n currentFill: theme.palette.darkBlue,\n },\n options,\n );\n\n return (\n <Box className={classes.legend} display=\"flex\" flexDirection=\"row\">\n <Box marginRight={2}>\n <LegendItem\n title={data.previousName}\n markerColor={options.hideMarker ? undefined : data.previousFill}\n >\n {currencyFormatter(baseCurrency).format(costStart)}\n </LegendItem>\n </Box>\n <Box marginRight={2}>\n <LegendItem\n title={data.currentName}\n markerColor={options.hideMarker ? undefined : data.currentFill}\n >\n {currencyFormatter(baseCurrency).format(costEnd)}\n </LegendItem>\n </Box>\n {children}\n </Box>\n );\n};\n"],"names":["useStyles"],"mappings":";;;;;;;;;;;;;;AA0Ca,MAAA,cAAA,GAAiB,CAC5B,KACG,KAAA;AACH,EAAA,MAAM,EAAE,SAAW,EAAA,OAAA,EAAS,UAAU,EAAC,EAAG,UAAa,GAAA,KAAA;AAEvD,EAAA,MAAM,QAAQ,QAA4B,EAAA;AAC1C,EAAA,MAAM,UAAUA,uBAAU,EAAA;AAC1B,EAAM,MAAA,EAAE,YAAa,EAAA,GAAI,SAAU,EAAA;AAEnC,EAAA,MAAM,OAAO,MAAO,CAAA,MAAA;AAAA,IAClB;AAAA,MACE,YAAc,EAAA,UAAA;AAAA,MACd,YAAA,EAAc,MAAM,OAAQ,CAAA,SAAA;AAAA,MAC5B,WAAa,EAAA,SAAA;AAAA,MACb,WAAA,EAAa,MAAM,OAAQ,CAAA;AAAA,KAC7B;AAAA,IACA;AAAA,GACF;AAEA,EACE,uBAAA,IAAA,CAAC,OAAI,SAAW,EAAA,OAAA,CAAQ,QAAQ,OAAQ,EAAA,MAAA,EAAO,eAAc,KAC3D,EAAA,QAAA,EAAA;AAAA,oBAAC,GAAA,CAAA,GAAA,EAAA,EAAI,aAAa,CAChB,EAAA,QAAA,kBAAA,GAAA;AAAA,MAAC,UAAA;AAAA,MAAA;AAAA,QACC,OAAO,IAAK,CAAA,YAAA;AAAA,QACZ,WAAa,EAAA,OAAA,CAAQ,UAAa,GAAA,KAAA,CAAA,GAAY,IAAK,CAAA,YAAA;AAAA,QAElD,QAAkB,EAAA,iBAAA,CAAA,YAAY,CAAE,CAAA,MAAA,CAAO,SAAS;AAAA;AAAA,KAErD,EAAA,CAAA;AAAA,oBACA,GAAA,CAAC,GAAI,EAAA,EAAA,WAAA,EAAa,CAChB,EAAA,QAAA,kBAAA,GAAA;AAAA,MAAC,UAAA;AAAA,MAAA;AAAA,QACC,OAAO,IAAK,CAAA,WAAA;AAAA,QACZ,WAAa,EAAA,OAAA,CAAQ,UAAa,GAAA,KAAA,CAAA,GAAY,IAAK,CAAA,WAAA;AAAA,QAElD,QAAkB,EAAA,iBAAA,CAAA,YAAY,CAAE,CAAA,MAAA,CAAO,OAAO;AAAA;AAAA,KAEnD,EAAA,CAAA;AAAA,IACC;AAAA,GACH,EAAA,CAAA;AAEJ;;;;"}
@@ -1,4 +1,5 @@
1
- import React, { useState, useEffect } from 'react';
1
+ import { jsxs, jsx } from 'react/jsx-runtime';
2
+ import { useState, useEffect } from 'react';
2
3
  import Paper from '@material-ui/core/Paper';
3
4
  import Slide from '@material-ui/core/Slide';
4
5
  import ChevronLeftIcon from '@material-ui/icons/ChevronLeft';
@@ -32,58 +33,60 @@ const BarChartStepper = ({
32
33
  return prevStep + offset;
33
34
  });
34
35
  };
35
- return /* @__PURE__ */ React.createElement(
36
+ return /* @__PURE__ */ jsxs(
36
37
  Paper,
37
38
  {
38
39
  "data-testid": "bar-chart-stepper",
39
40
  square: true,
40
41
  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
- )
42
+ className: classes.paper,
43
+ children: [
44
+ /* @__PURE__ */ jsx(
45
+ Slide,
46
+ {
47
+ direction: "right",
48
+ in: !disableScroll && activeStep !== 0,
49
+ mountOnEnter: true,
50
+ unmountOnExit: true,
51
+ children: /* @__PURE__ */ jsx(
52
+ BarChartStepperButton,
53
+ {
54
+ name: "back",
55
+ className: classes.backButton,
56
+ onClick: handleBack,
57
+ children: /* @__PURE__ */ jsx(ChevronLeftIcon, {})
58
+ }
59
+ )
60
+ }
61
+ ),
62
+ /* @__PURE__ */ jsx(
63
+ BarChartSteps,
64
+ {
65
+ steps: Math.min(10, stepsRemaining),
66
+ activeStep: displayedStep,
67
+ onClick: handleClick
68
+ }
69
+ ),
70
+ /* @__PURE__ */ jsx(
71
+ Slide,
72
+ {
73
+ direction: "left",
74
+ in: !disableScroll && activeStep < steps - 1,
75
+ mountOnEnter: true,
76
+ unmountOnExit: true,
77
+ children: /* @__PURE__ */ jsx(
78
+ BarChartStepperButton,
79
+ {
80
+ name: "next",
81
+ className: classes.nextButton,
82
+ onClick: handleNext,
83
+ children: /* @__PURE__ */ jsx(ChevronRightIcon, {})
84
+ }
85
+ )
86
+ }
87
+ )
88
+ ]
89
+ }
87
90
  );
88
91
  };
89
92